From adf1836fce75327c1e2d4700dc3069be50166237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Mon, 29 Jun 2026 19:26:24 +0200 Subject: [PATCH] 1.3.0 --- dist/places.d.ts | 6 ++++++ dist/places.js | 18 ++++++++++++++++++ docs/interfaces/PlacesClient.md | 20 ++++++++++++++++++++ package-lock.json | 4 ++-- package.json | 2 +- 5 files changed, 47 insertions(+), 3 deletions(-) diff --git a/dist/places.d.ts b/dist/places.d.ts index be10172..33980ac 100644 --- a/dist/places.d.ts +++ b/dist/places.d.ts @@ -192,6 +192,12 @@ export interface PlacesClient { * @param id - The slug ID of the list. */ get(id: string): Promise; + /** + * Get all places from a list. + * @param listId - The slug ID of the list. + * @returns Array of Place objects. + */ + getPlaces(listId: string): Promise; /** * Create or update a list. * @param id - The slug ID (e.g., "to-go"). diff --git a/dist/places.js b/dist/places.js index 9755e65..f9e773f 100644 --- a/dist/places.js +++ b/dist/places.js @@ -103,6 +103,24 @@ const Places = function (privateClient /*, publicClient: BaseClient */) { const path = `_lists/${id}`; return privateClient.getObject(path); }, + async getPlaces(listId) { + const list = await this.get(listId); + if (!list) { + throw new Error(`List not found: ${listId}`); + } + if (!list.placeRefs || !Array.isArray(list.placeRefs)) { + return []; + } + const promises = list.placeRefs.map(async (ref) => { + if (!ref.id || !ref.geohash) + return null; + const path = getPath(ref.geohash, ref.id); + const place = await privateClient.getObject(path); + return place; + }); + const results = await Promise.all(promises); + return results.filter((p) => !!p); + }, async create(id, title, color) { const path = `_lists/${id}`; let list = (await privateClient.getObject(path)); diff --git a/docs/interfaces/PlacesClient.md b/docs/interfaces/PlacesClient.md index f455c71..49dff8b 100644 --- a/docs/interfaces/PlacesClient.md +++ b/docs/interfaces/PlacesClient.md @@ -120,6 +120,26 @@ Get all lists. Array of List objects. +#### getPlaces() + +> **getPlaces**(`listId`): `Promise`\<[`Place`](../type-aliases/Place.md)[]\> + +Get all places from a list. + +##### Parameters + +###### listId + +`string` + +The slug ID of the list. + +##### Returns + +`Promise`\<[`Place`](../type-aliases/Place.md)[]\> + +Array of Place objects. + #### removePlace() > **removePlace**(`listId`, `placeId`): `Promise`\<[`List`](../type-aliases/List.md)\> diff --git a/package-lock.json b/package-lock.json index 38d7ab9..03e0116 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@remotestorage/module-places", - "version": "1.2.2", + "version": "1.3.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@remotestorage/module-places", - "version": "1.2.2", + "version": "1.3.0", "license": "MIT", "dependencies": { "latlon-geohash": "^2.0.0", diff --git a/package.json b/package.json index af9076d..70c92f7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@remotestorage/module-places", - "version": "1.2.2", + "version": "1.3.0", "description": "Manage favorite/saved places", "homepage": "https://gitea.kosmos.org/raucao/remotestorage-module-places#remotestoragemodule-places", "repository": {