9 Commits

Author SHA1 Message Date
d36bef185c 1.2.2
All checks were successful
Test / test (push) Successful in 32s
2026-03-14 14:50:59 +04:00
b84010a332 Add proper lists documentation to README
Some checks failed
Test / test (push) Has been cancelled
2026-03-14 14:50:30 +04:00
05516e7642 Add more install commands
All checks were successful
Test / test (push) Successful in 33s
Not just pnpm
2026-03-14 14:35:31 +04:00
22c6b02e4b Add test/CI status to README
All checks were successful
Test / test (push) Successful in 32s
2026-03-14 14:29:57 +04:00
e859bc3ee7 Merge pull request 'Set up CI' (#3) from chore/setup_ci into master
All checks were successful
Test / test (push) Successful in 33s
Reviewed-on: #3
2026-03-14 10:25:39 +00:00
b3fd092acf Set up CI
All checks were successful
Test / test (pull_request) Successful in 32s
Test / test (push) Successful in 1m42s
2026-03-14 14:12:52 +04:00
cd349944cf Update AGENTS.md with testing details 2026-03-14 14:04:23 +04:00
6b434adde4 1.2.1 2026-03-13 16:59:06 +04:00
a966df95f0 Add doc for List type definition 2026-03-13 16:58:36 +04:00
8 changed files with 119 additions and 8 deletions

View File

@@ -0,0 +1,17 @@
name: Test
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- run: pnpm install
- run: pnpm test

View File

@@ -26,8 +26,10 @@ It is written in TypeScript and compiled to a JavaScript module suitable for use
- `dist/`: specific build artifacts. Do not edit files here directly.
## Testing
- Currently, no automated test suite is configured.
- `pnpm test` will exit with an error.
- **Framework:** `vitest`
- **Run tests:** `pnpm test`
- **Watch mode:** `pnpm run test:watch`
- **Location:** Tests are located in the `test/` directory.
## Contribution Guidelines
- When adding new functionality, ensure proper types are exported in `src/types.d.ts` or within the module files.

View File

@@ -1,6 +1,6 @@
# @remotestorage/module-places
[![npm version](https://img.shields.io/npm/v/@remotestorage/module-places.svg)](https://www.npmjs.com/package/@remotestorage/module-places)
[![npm version](https://img.shields.io/npm/v/@remotestorage/module-places.svg)](https://www.npmjs.com/package/@remotestorage/module-places) [![Build Status](https://gitea.kosmos.org/raucao/remotestorage-module-places/actions/workflows/test.yaml/badge.svg)](https://gitea.kosmos.org/raucao/remotestorage-module-places/actions)
This module allows you to manage saved places (Points of Interest) using the [remoteStorage](https://remotestorage.io/) protocol.
@@ -11,7 +11,17 @@ For a demo application, as well as source code using this module, check out [Mar
## Installation
```bash
# npm
npm install @remotestorage/module-places
# pnpm
pnpm add @remotestorage/module-places
# yarn
yarn add @remotestorage/module-places
# bun
bun add @remotestorage/module-places
```
## Usage
@@ -41,12 +51,56 @@ console.log(allPlaces);
// List places for specific geohash prefixes (e.g. for a map view)
const areaPlaces = await places.getPlaces(['u33d', 'u33e']);
console.log(areaPlaces);
```
## Lists
### Default lists
There are currently two default lists, which you can initiate like this:
```javascript
await places.lists.initDefaults();
```
This will create the lists if they don't exist yet (meaning the user hasn't yet
used an app that integrates this module).
The default lists are:
| Path | Default Name | Default Color |
| --- | --- | --- |
| `_lists/to-go` | Want to go | #2e9e4f (green) |
| `_lists/to-do` | To do | #2a7fff (blue) |
### Custom lists
```javascript
// Create a list
await places.lists.create('favorites', 'My Favorites');
await places.lists.create('hiking', 'Hiking', '#74d3ba');
// Delete a list
await places.lists.delete('hiking');
```
### List membership
```javascript
// Add a place to a list (requires list ID, place ID, and place geohash)
await places.lists.addPlace('favorites', 'place-id-123', 'u33dc0');
await places.lists.addPlace('to-go', 'place-id-123', 'u33dc0');
// Remove from list
await places.lists.removePlace('to-go', 'place-id-123');
```
### Reading lists
```javascript
// Get all lists
await places.lists.getAll();
// Get specific list
await places.lists.get('to-do');
```
## API Reference

13
dist/places.d.ts vendored
View File

@@ -96,6 +96,19 @@ declare const listSchema: {
};
readonly required: readonly ["id", "title", "placeRefs", "createdAt"];
};
/**
* Represents a List object.
*
* Core properties enforced by schema:
* - `id`: Unique identifier (slug)
* - `title`: Human readable title
* - `placeRefs`: Array of place references containing `id` and `geohash`
* - `createdAt`: ISO date string
*
* Optional properties:
* - `color`: Hex color code
* - `updatedAt`: ISO date string
*/
export type List = FromSchema<typeof listSchema> & {
[key: string]: any;
};

View File

@@ -7,3 +7,15 @@
# Type Alias: List
> **List** = `FromSchema`\<*typeof* `listSchema`\> & `object`
Represents a List object.
Core properties enforced by schema:
- `id`: Unique identifier (slug)
- `title`: Human readable title
- `placeRefs`: Array of place references containing `id` and `geohash`
- `createdAt`: ISO date string
Optional properties:
- `color`: Hex color code
- `updatedAt`: ISO date string

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@remotestorage/module-places",
"version": "1.2.0",
"version": "1.2.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@remotestorage/module-places",
"version": "1.2.0",
"version": "1.2.2",
"license": "MIT",
"dependencies": {
"latlon-geohash": "^2.0.0",

View File

@@ -1,6 +1,6 @@
{
"name": "@remotestorage/module-places",
"version": "1.2.0",
"version": "1.2.2",
"description": "Manage favorite/saved places",
"homepage": "https://gitea.kosmos.org/raucao/remotestorage-module-places#remotestoragemodule-places",
"repository": {

View File

@@ -55,6 +55,19 @@ const listSchema = {
required: ['id', 'title', 'placeRefs', 'createdAt'],
} as const;
/**
* Represents a List object.
*
* Core properties enforced by schema:
* - `id`: Unique identifier (slug)
* - `title`: Human readable title
* - `placeRefs`: Array of place references containing `id` and `geohash`
* - `createdAt`: ISO date string
*
* Optional properties:
* - `color`: Hex color code
* - `updatedAt`: ISO date string
*/
export type List = FromSchema<typeof listSchema> & { [key: string]: any };
/**