@fabriktor/client 0.0.99 → 0.0.101

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.
@@ -25,11 +25,11 @@ export type UpsertOneOptionsCRUD<In> = {
25
25
  export type FindOneOptionsCRUD = Pick<RequestOptions, "signal"> & {
26
26
  id: string;
27
27
  };
28
- export type ReplaceOneOptionsCRUD<In> = Pick<RequestOptions, "signal"> & {
28
+ export type ReplaceOneOptionsCRUD<In> = RequestOptions & {
29
29
  id: string;
30
30
  in: Partial<In>;
31
31
  };
32
- export type DeleteOneOptionsCRUD = {
32
+ export type DeleteOneOptionsCRUD = Pick<RequestOptions, "signal"> & {
33
33
  id: string;
34
34
  };
35
35
  export type SearchManyOptionsCRUD = Pick<RequestOptions, "signal"> & {
@@ -91,6 +91,7 @@ export class CRUDClient {
91
91
  method: HTTPMethodPatch,
92
92
  token,
93
93
  signal: opts.signal,
94
+ idempotency_key: opts.idempotency_key,
94
95
  body: opts.in,
95
96
  });
96
97
  }
@@ -105,6 +106,7 @@ export class CRUDClient {
105
106
  }),
106
107
  method: HTTPMethodDelete,
107
108
  token,
109
+ signal: opts.signal,
108
110
  });
109
111
  }
110
112
  async searchMany(opts) {
@@ -1,10 +1,10 @@
1
1
  import { type FeedFavorite, type FeedPost, type FeedReaction, type InFeedFavorite, type InFeedPost, type InFeedReaction, type OperationResult, type PLFeedPull, type PLFeedRestrict, type RPFeedPull } from "@fabriktor/schema";
2
2
  import type { TokenProvider } from "../core/auth.js";
3
3
  import type { DeleteOneOptionsCRUD, FindOneOptionsCRUD, InsertOneOptionsCRUD, OperationResultOf, QueryOptionsCRUD, ReplaceOneOptionsCRUD, SearchManyOptionsCRUD, SearchResultOf } from "../core/crud.js";
4
- import type { HTTPDoer } from "../core/http.js";
4
+ import type { HTTPDoer, RequestOptions } from "../core/http.js";
5
5
  import type { CompletePayload } from "../core/type.js";
6
- export type PullFeedOptions = CompletePayload<PLFeedPull>;
7
- export type RestrictFeedOptions = CompletePayload<PLFeedRestrict>;
6
+ export type PullFeedOptions = CompletePayload<PLFeedPull> & RequestOptions;
7
+ export type RestrictFeedOptions = CompletePayload<PLFeedRestrict> & RequestOptions;
8
8
  export type FeedClientOptions = {
9
9
  http: HTTPDoer;
10
10
  base_url: string;
@@ -6,6 +6,7 @@
6
6
  import { ColFeedFeedFavorites, ColFeedFeedPosts, ColFeedFeedReactions, HTTPMethodPost, PathFeedRestrict, PathPull, SvcFeed, } from "@fabriktor/schema";
7
7
  import { requiredToken } from "../core/auth.js";
8
8
  import { newCRUDClient } from "../core/crud.js";
9
+ import { newIdempotencyKey } from "../core/idempotency.js";
9
10
  import { buildPath } from "../core/path.js";
10
11
  export class FeedClient {
11
12
  feed_posts;
@@ -89,23 +90,31 @@ export class FeedClient {
89
90
  return await this.feed_favorites.deleteOne(opts);
90
91
  }
91
92
  async pull(opts) {
93
+ const { signal, idempotency_key, ...body } = opts;
94
+ signal?.throwIfAborted();
92
95
  const token = await requiredToken(this.get_token);
93
96
  return await this.http.do({
94
97
  base_url: this.base_url,
95
98
  path: feedPostPath(PathPull),
96
99
  method: HTTPMethodPost,
97
100
  token,
98
- body: opts,
101
+ body,
102
+ signal,
103
+ idempotency_key: idempotency_key ?? newIdempotencyKey(),
99
104
  });
100
105
  }
101
106
  async restrict(opts) {
107
+ const { signal, idempotency_key, ...body } = opts;
108
+ signal?.throwIfAborted();
102
109
  const token = await requiredToken(this.get_token);
103
110
  return await this.http.do({
104
111
  base_url: this.base_url,
105
112
  path: feedPostPath(PathFeedRestrict),
106
113
  method: HTTPMethodPost,
107
114
  token,
108
- body: opts,
115
+ body,
116
+ signal,
117
+ idempotency_key,
109
118
  });
110
119
  }
111
120
  }
@@ -1,9 +1,9 @@
1
1
  import { type InMarketplaceFavorite, type InMarketplacePost, type MarketplaceFavorite, type MarketplacePost, type OperationResult, type PLMarketplacePull, type RPMarketplacePull } from "@fabriktor/schema";
2
2
  import type { TokenProvider } from "../core/auth.js";
3
3
  import type { DeleteOneOptionsCRUD, FindOneOptionsCRUD, InsertOneOptionsCRUD, OperationResultOf, QueryOptionsCRUD, ReplaceOneOptionsCRUD, SearchManyOptionsCRUD, SearchResultOf } from "../core/crud.js";
4
- import type { HTTPDoer } from "../core/http.js";
4
+ import type { HTTPDoer, RequestOptions } from "../core/http.js";
5
5
  import type { CompletePayload } from "../core/type.js";
6
- export type PullMarketplaceOptions = CompletePayload<PLMarketplacePull>;
6
+ export type PullMarketplaceOptions = CompletePayload<PLMarketplacePull> & RequestOptions;
7
7
  export type MarketplaceClientOptions = {
8
8
  http: HTTPDoer;
9
9
  base_url: string;
@@ -6,6 +6,7 @@
6
6
  import { ColMarketplaceMarketplaceFavorites, ColMarketplaceMarketplacePosts, HTTPMethodPost, PathPull, SvcMarketplace, } from "@fabriktor/schema";
7
7
  import { requiredToken } from "../core/auth.js";
8
8
  import { newCRUDClient } from "../core/crud.js";
9
+ import { newIdempotencyKey } from "../core/idempotency.js";
9
10
  import { buildPath } from "../core/path.js";
10
11
  export class MarketplaceClient {
11
12
  marketplace_posts;
@@ -66,13 +67,17 @@ export class MarketplaceClient {
66
67
  return await this.marketplace_favorites.deleteOne(opts);
67
68
  }
68
69
  async pull(opts) {
70
+ const { signal, idempotency_key, ...body } = opts;
71
+ signal?.throwIfAborted();
69
72
  const token = await requiredToken(this.get_token);
70
73
  return await this.http.do({
71
74
  base_url: this.base_url,
72
75
  path: marketplacePostPath(PathPull),
73
76
  method: HTTPMethodPost,
74
77
  token,
75
- body: opts,
78
+ body,
79
+ signal,
80
+ idempotency_key: idempotency_key ?? newIdempotencyKey(),
76
81
  });
77
82
  }
78
83
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabriktor/client",
3
- "version": "0.0.99",
3
+ "version": "0.0.101",
4
4
  "description": "![Fabriktor Logo](./img/fabriktor-character.gif)",
5
5
  "type": "module",
6
6
  "exports": {
@@ -17,6 +17,6 @@
17
17
  "typescript": "^6.0.3"
18
18
  },
19
19
  "dependencies": {
20
- "@fabriktor/schema": "0.0.69"
20
+ "@fabriktor/schema": "0.0.70"
21
21
  }
22
22
  }