@oblax/bookmarks 2.0.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,38 +1,48 @@
1
1
  import type { OblaxContext } from '@oblax/core';
2
- import type { Bookmark, BookmarksConfig, CreateBookmarkParams, DeleteBookmarkParams, ListBookmarksParams, ListMyBookmarksParams } from './types.js';
2
+ import type { Bookmark, BookmarkList, BookmarksConfig, CreateBookmarkParams, DeleteBookmarkParams, ListBookmarksParams, ListMyBookmarksParams } from './types.js';
3
3
  /**
4
- * The Bookmarks module.
5
- *
6
- * Manages bookmarks for the authenticated user or any user (when permitted).
4
+ * The Bookmarks module: the signed-in user's bookmarks, and for the admin role anyone's.
7
5
  *
8
6
  * @example
9
7
  * ```typescript
10
8
  * const oblax = new Oblax({
11
- * endpoint: 'https://api.my-app.oblax.io',
12
- * clientId: 'my-web-app',
13
- * modules: [PlatformServer(), Bookmarks()],
9
+ * endpoint: '<api-endpoint>', // the client's endpoint: `obx project clients list`
10
+ * clientId: '<client-id>',
11
+ * modules: [PlatformBrowser(), Auth({ realm: '<realm>' }), Bookmarks()],
14
12
  * })
15
13
  *
16
14
  * const bookmark = await oblax.bookmarks.create({
17
15
  * type: 'article',
18
- * userId: 'user-id',
19
16
  * recordId: 'article-id',
20
17
  * title: 'My favourite article',
21
18
  * })
22
19
  *
23
- * const mine = await oblax.bookmarks.listMy({ type: 'article' })
20
+ * const { data, count } = await oblax.bookmarks.listMy({ type: 'article' })
21
+ * const saved = await oblax.bookmarks.listMy({
22
+ * type: 'article',
23
+ * filters: [{ field: 'record_id', op: 'eq', value: 'article-id' }],
24
+ * })
24
25
  * ```
25
26
  */
26
27
  export declare class BookmarksModule {
27
28
  private readonly ctx;
28
29
  constructor(ctx: OblaxContext, _config: BookmarksConfig);
29
- /** Lists bookmarks of a given type for the currently authenticated user. */
30
- listMy(params: ListMyBookmarksParams): Promise<Bookmark[]>;
31
- /** Lists bookmarks of a given type for a specific user. */
32
- list(params: ListBookmarksParams): Promise<Bookmark[]>;
33
- /** Creates a new bookmark. */
30
+ /**
31
+ * A page of the signed-in user's bookmarks of a type (50 by default, newest first) and how
32
+ * many match. Filter by `record_id` to see whether a record is saved.
33
+ */
34
+ listMy(params: ListMyBookmarksParams): Promise<BookmarkList>;
35
+ /**
36
+ * `listMy` for the user in `userId`: the admin role reads anyone's, any other caller only
37
+ * their own (403 otherwise).
38
+ */
39
+ list(params: ListBookmarksParams): Promise<BookmarkList>;
40
+ /** Saves a bookmark for the signed-in user. */
34
41
  create(params: CreateBookmarkParams): Promise<Bookmark>;
35
- /** Deletes a bookmark by ID. Returns `void` (HTTP 204). */
42
+ /**
43
+ * Deletes one of the signed-in user's bookmarks (the admin role deletes any). Another user's,
44
+ * or one already deleted, is 404. Returns `void` (HTTP 204).
45
+ */
36
46
  delete(params: DeleteBookmarkParams): Promise<void>;
37
47
  }
38
48
  //# sourceMappingURL=bookmarks-module.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bookmarks-module.d.ts","sourceRoot":"","sources":["../src/bookmarks-module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EACV,QAAQ,EACR,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,YAAY,CAAA;AAYnB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,YAAY,EAAE,OAAO,EAAE,eAAe;IAExE,4EAA4E;IACtE,MAAM,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAIhE,2DAA2D;IACrD,IAAI,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAI5D,8BAA8B;IACxB,MAAM,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAO7D,2DAA2D;IACrD,MAAM,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;CAK1D"}
1
+ {"version":3,"file":"bookmarks-module.d.ts","sourceRoot":"","sources":["../src/bookmarks-module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,OAAO,KAAK,EACV,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,YAAY,CAAA;AAQnB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,YAAY,EAAE,OAAO,EAAE,eAAe;IAExE;;;OAGG;IACG,MAAM,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,YAAY,CAAC;IAOlE;;;OAGG;IACG,IAAI,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,YAAY,CAAC;IAO9D,+CAA+C;IACzC,MAAM,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAO7D;;;OAGG;IACG,MAAM,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;CAK1D"}
@@ -1,54 +1,63 @@
1
- /** Maps camelCase input to the snake_case wire format. */
2
- function bookmarkToApi(params) {
3
- return {
4
- type: params.type,
5
- record_id: params.recordId,
6
- user_id: params.userId,
7
- title: params.title,
8
- };
9
- }
1
+ import { buildQuery, listPairs, pathSegment } from '@oblax/core';
10
2
  /**
11
- * The Bookmarks module.
12
- *
13
- * Manages bookmarks for the authenticated user or any user (when permitted).
3
+ * The route's `:uid` (and on delete, `:type`) when the server doesn't read it: it takes the user
4
+ * from the token
5
+ */
6
+ const UNUSED_SEGMENT = 'me';
7
+ /**
8
+ * The Bookmarks module: the signed-in user's bookmarks, and for the admin role anyone's.
14
9
  *
15
10
  * @example
16
11
  * ```typescript
17
12
  * const oblax = new Oblax({
18
- * endpoint: 'https://api.my-app.oblax.io',
19
- * clientId: 'my-web-app',
20
- * modules: [PlatformServer(), Bookmarks()],
13
+ * endpoint: '<api-endpoint>', // the client's endpoint: `obx project clients list`
14
+ * clientId: '<client-id>',
15
+ * modules: [PlatformBrowser(), Auth({ realm: '<realm>' }), Bookmarks()],
21
16
  * })
22
17
  *
23
18
  * const bookmark = await oblax.bookmarks.create({
24
19
  * type: 'article',
25
- * userId: 'user-id',
26
20
  * recordId: 'article-id',
27
21
  * title: 'My favourite article',
28
22
  * })
29
23
  *
30
- * const mine = await oblax.bookmarks.listMy({ type: 'article' })
24
+ * const { data, count } = await oblax.bookmarks.listMy({ type: 'article' })
25
+ * const saved = await oblax.bookmarks.listMy({
26
+ * type: 'article',
27
+ * filters: [{ field: 'record_id', op: 'eq', value: 'article-id' }],
28
+ * })
31
29
  * ```
32
30
  */
33
31
  export class BookmarksModule {
34
32
  constructor(ctx, _config) {
35
33
  this.ctx = ctx;
36
34
  }
37
- /** Lists bookmarks of a given type for the currently authenticated user. */
35
+ /**
36
+ * A page of the signed-in user's bookmarks of a type (50 by default, newest first) and how
37
+ * many match. Filter by `record_id` to see whether a record is saved.
38
+ */
38
39
  async listMy(params) {
39
- return this.ctx.http.get(`/bookmarks/me/type/${params.type}`);
40
+ const { type, ...query } = params;
41
+ return this.ctx.http.get(`/bookmarks/me/type/${pathSegment(type)}${buildQuery({}, listPairs(query))}`);
40
42
  }
41
- /** Lists bookmarks of a given type for a specific user. */
43
+ /**
44
+ * `listMy` for the user in `userId`: the admin role reads anyone's, any other caller only
45
+ * their own (403 otherwise).
46
+ */
42
47
  async list(params) {
43
- return this.ctx.http.get(`/bookmarks/${params.userId}/type/${params.type}`);
48
+ const { type, userId, ...query } = params;
49
+ return this.ctx.http.get(`/bookmarks/${pathSegment(userId)}/type/${pathSegment(type)}${buildQuery({}, listPairs(query))}`);
44
50
  }
45
- /** Creates a new bookmark. */
51
+ /** Saves a bookmark for the signed-in user. */
46
52
  async create(params) {
47
- return this.ctx.http.post(`/bookmarks/${params.userId}/type/${params.type}`, bookmarkToApi(params));
53
+ return this.ctx.http.post(`/bookmarks/${UNUSED_SEGMENT}/type/${pathSegment(params.type)}`, { record_id: params.recordId, title: params.title });
48
54
  }
49
- /** Deletes a bookmark by ID. Returns `void` (HTTP 204). */
55
+ /**
56
+ * Deletes one of the signed-in user's bookmarks (the admin role deletes any). Another user's,
57
+ * or one already deleted, is 404. Returns `void` (HTTP 204).
58
+ */
50
59
  async delete(params) {
51
- return this.ctx.http.delete(`/bookmarks/${params.userId}/type/${params.type}/${params.id}`);
60
+ return this.ctx.http.delete(`/bookmarks/${UNUSED_SEGMENT}/type/${UNUSED_SEGMENT}/${pathSegment(params.id)}`);
52
61
  }
53
62
  }
54
63
  //# sourceMappingURL=bookmarks-module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bookmarks-module.js","sourceRoot":"","sources":["../src/bookmarks-module.ts"],"names":[],"mappings":"AAUA,0DAA0D;AAC1D,SAAS,aAAa,CAAC,MAA4B;IACjD,OAAO;QACL,IAAI,EAAO,MAAM,CAAC,IAAI;QACtB,SAAS,EAAE,MAAM,CAAC,QAAQ;QAC1B,OAAO,EAAI,MAAM,CAAC,MAAM;QACxB,KAAK,EAAM,MAAM,CAAC,KAAK;KACxB,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,eAAe;IAC1B,YAA6B,GAAiB,EAAE,OAAwB;QAA3C,QAAG,GAAH,GAAG,CAAc;IAA6B,CAAC;IAE5E,4EAA4E;IAC5E,KAAK,CAAC,MAAM,CAAC,MAA6B;QACxC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAa,sBAAsB,MAAM,CAAC,IAA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,EAAE,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAC7E,CAAA;IACH,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,IAAI,CAAC,MAA2B;QACpC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,CAAA;QACzC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CACtB,cAAc,WAAW,CAAC,MAAM,CAAC,SAAS,WAAW,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,EAAE,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CACjG,CAAA;IACH,CAAC;IAED,+CAA+C;IAC/C,KAAK,CAAC,MAAM,CAAC,MAA4B;QACvC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CACvB,cAAc,cAAc,SAAS,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,EAC/D,EAAE,SAAS,EAAE,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CACpD,CAAA;IACH,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,MAAM,CAAC,MAA4B;QACvC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CACzB,cAAc,cAAc,SAAS,cAAc,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAChF,CAAA;IACH,CAAC;CACF"}
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import type { OblaxModulePlugin } from '@oblax/core';
2
2
  import { BookmarksModule } from './bookmarks-module.js';
3
3
  import type { BookmarksConfig } from './types.js';
4
4
  export { BookmarksModule } from './bookmarks-module.js';
5
- export type { BookmarksConfig, Bookmark, CreateBookmarkParams, ListBookmarksParams, ListMyBookmarksParams, DeleteBookmarkParams, } from './types.js';
5
+ export type { BookmarksConfig, Bookmark, BookmarkList, BookmarkListQuery, CreateBookmarkParams, ListBookmarksParams, ListMyBookmarksParams, DeleteBookmarkParams, } from './types.js';
6
6
  /**
7
7
  * Bookmarks module factory.
8
8
  *
@@ -12,20 +12,18 @@ export type { BookmarksConfig, Bookmark, CreateBookmarkParams, ListBookmarksPara
12
12
  * @example
13
13
  * ```typescript
14
14
  * import { Oblax } from '@oblax/core'
15
- * import { PlatformServer } from '@oblax/platform-server'
15
+ * import { PlatformBrowser } from '@oblax/platform-browser'
16
+ * import { Auth } from '@oblax/auth'
16
17
  * import { Bookmarks } from '@oblax/bookmarks'
17
18
  *
18
19
  * const oblax = new Oblax({
19
- * endpoint: 'https://api.my-app.oblax.io',
20
- * clientId: 'my-web-app',
21
- * modules: [PlatformServer(), Bookmarks()],
20
+ * endpoint: '<api-endpoint>', // the client's endpoint: `obx project clients list`
21
+ * clientId: '<client-id>',
22
+ * modules: [PlatformBrowser(), Auth({ realm: '<realm>' }), Bookmarks()],
22
23
  * })
23
24
  *
24
- * const bookmark = await oblax.bookmarks.create({
25
- * type: 'article',
26
- * userId: 'user-id',
27
- * recordId: 'article-id',
28
- * })
25
+ * // saved for the signed-in user
26
+ * const bookmark = await oblax.bookmarks.create({ type: 'article', recordId: 'article-id' })
29
27
  * ```
30
28
  */
31
29
  export declare function Bookmarks(config?: BookmarksConfig): OblaxModulePlugin<'bookmarks', BookmarksModule>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,YAAY,EACV,eAAe,EACf,QAAQ,EACR,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,YAAY,CAAA;AAEnB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,SAAS,CAAC,MAAM,GAAE,eAAoB,GAAG,iBAAiB,CAAC,WAAW,EAAE,eAAe,CAAC,CAOvG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,YAAY,EACV,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,YAAY,CAAA;AAEnB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,SAAS,CAAC,MAAM,GAAE,eAAoB,GAAG,iBAAiB,CAAC,WAAW,EAAE,eAAe,CAAC,CAOvG"}
package/dist/index.js CHANGED
@@ -9,20 +9,18 @@ export { BookmarksModule } from './bookmarks-module.js';
9
9
  * @example
10
10
  * ```typescript
11
11
  * import { Oblax } from '@oblax/core'
12
- * import { PlatformServer } from '@oblax/platform-server'
12
+ * import { PlatformBrowser } from '@oblax/platform-browser'
13
+ * import { Auth } from '@oblax/auth'
13
14
  * import { Bookmarks } from '@oblax/bookmarks'
14
15
  *
15
16
  * const oblax = new Oblax({
16
- * endpoint: 'https://api.my-app.oblax.io',
17
- * clientId: 'my-web-app',
18
- * modules: [PlatformServer(), Bookmarks()],
17
+ * endpoint: '<api-endpoint>', // the client's endpoint: `obx project clients list`
18
+ * clientId: '<client-id>',
19
+ * modules: [PlatformBrowser(), Auth({ realm: '<realm>' }), Bookmarks()],
19
20
  * })
20
21
  *
21
- * const bookmark = await oblax.bookmarks.create({
22
- * type: 'article',
23
- * userId: 'user-id',
24
- * recordId: 'article-id',
25
- * })
22
+ * // saved for the signed-in user
23
+ * const bookmark = await oblax.bookmarks.create({ type: 'article', recordId: 'article-id' })
26
24
  * ```
27
25
  */
28
26
  export function Bookmarks(config = {}) {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAGvD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAWvD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,SAAS,CAAC,SAA0B,EAAE;IACpD,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,MAAM,CAAC,GAAiB;YACtB,OAAO,IAAI,eAAe,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;QACzC,CAAC;KACF,CAAA;AACH,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAGvD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAavD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,SAAS,CAAC,SAA0B,EAAE;IACpD,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,MAAM,CAAC,GAAiB;YACtB,OAAO,IAAI,eAAe,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;QACzC,CAAC;KACF,CAAA;AACH,CAAC"}
package/dist/types.d.ts CHANGED
@@ -1,8 +1,7 @@
1
+ import type { ListQuery } from '@oblax/core';
1
2
  /**
2
- * A bookmark links a user to a record of a given type.
3
- *
4
- * The backend model expects `type`, `record_id` and `user_id`;
5
- * `title` is optional.
3
+ * A bookmark links a user to a record of a given type. `user_id` is the user who saved it,
4
+ * always the signed-in user of the request that made it.
6
5
  */
7
6
  export interface Bookmark {
8
7
  id: string;
@@ -11,27 +10,45 @@ export interface Bookmark {
11
10
  user_id: string;
12
11
  title: string;
13
12
  }
13
+ /** A page of bookmarks and the number of bookmarks that match. */
14
+ export interface BookmarkList {
15
+ data: Bookmark[];
16
+ count: number;
17
+ }
18
+ /**
19
+ * A bookmark list's filters, order and page. Filters: `record_id`, `title`. Order by `_created`
20
+ * (the default, newest first) or `title`. Pages of 50 (`limit` up to 100; more is a 400),
21
+ * `offset`. Any other filter is a 400.
22
+ */
23
+ export type BookmarkListQuery = ListQuery;
14
24
  export interface CreateBookmarkParams {
15
- /** Bookmark category, also sent as the `:type` route parameter. */
25
+ /** Bookmark category, sent as the `:type` route parameter. */
16
26
  type: string;
17
- /** User identifier, also sent as the `:uid` route parameter. */
18
- userId: string;
27
+ /**
28
+ * @deprecated Ignored: a bookmark always belongs to the signed-in user who saves it, whatever
29
+ * this says.
30
+ */
31
+ userId?: string;
19
32
  /** Target record identifier (required). */
20
33
  recordId: string;
21
34
  /** Optional display title. */
22
35
  title?: string;
23
36
  }
24
- export interface ListBookmarksParams {
37
+ export interface ListBookmarksParams extends BookmarkListQuery {
25
38
  type: string;
39
+ /** The user whose bookmarks to list (their user ID). Another user's need the admin role. */
26
40
  userId: string;
27
41
  }
28
- export interface ListMyBookmarksParams {
42
+ export interface ListMyBookmarksParams extends BookmarkListQuery {
29
43
  type: string;
30
44
  }
31
45
  export interface DeleteBookmarkParams {
32
- type: string;
33
- userId: string;
46
+ /** The bookmark's ID. */
34
47
  id: string;
48
+ /** @deprecated Ignored: the bookmark's ID is enough. */
49
+ type?: string;
50
+ /** @deprecated Ignored: a user deletes their own bookmarks; the admin role deletes any. */
51
+ userId?: string;
35
52
  }
36
53
  /** Bookmarks module configuration. Reserved for future options. */
37
54
  export interface BookmarksConfig {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;I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CAAA;IACZ;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAA;IAChB,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;IAC5D,IAAI,EAAE,MAAM,CAAA;IACZ,4FAA4F;IAC5F,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,qBAAsB,SAAQ,iBAAiB;IAC9D,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,oBAAoB;IACnC,yBAAyB;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,wDAAwD;IACxD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,2FAA2F;IAC3F,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,mEAAmE;AACnE,MAAM,WAAW,eAAe;CAE/B"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@oblax/bookmarks",
3
- "version": "2.0.0",
3
+ "version": "2.2.0",
4
4
  "description": "Oblax SDK — bookmarks module",
5
5
  "license": "MIT",
6
6
  "author": {
7
7
  "name": "Oblax SDK for JavaScript Team",
8
- "url": "https://docs.oblax.io/docs/getting-started/your-first-sdk-call"
8
+ "url": "https://docs.oblax.io/docs/getting-started/first-call/"
9
9
  },
10
10
  "homepage": "https://github.com/oblaxio/oblax-sdk-js#readme",
11
11
  "repository": {
@@ -37,11 +37,11 @@
37
37
  "access": "public"
38
38
  },
39
39
  "peerDependencies": {
40
- "@oblax/core": "^2.0.0"
40
+ "@oblax/core": "^2.2.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "typescript": "^5.5.0",
44
- "@oblax/core": "2.0.0"
44
+ "@oblax/core": "2.2.0"
45
45
  },
46
46
  "scripts": {
47
47
  "build": "tsc --build tsconfig.json",