@deliverd/sdk 0.6.0 → 0.6.1

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.
package/dist/dev.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../src/dev.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EAKb,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC;AAElF,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,OAAO,CAAC,EAAE,kBAAkB,GAAG,CAAC,CAAC,OAAO,EAAE,YAAY,KAAK,kBAAkB,CAAC,CAAC;IAC/E,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAcD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,UAAU,CAAC,KAAK,CAyW1F"}
1
+ {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../src/dev.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EAKb,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC;AAElF,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,OAAO,CAAC,EAAE,kBAAkB,GAAG,CAAC,CAAC,OAAO,EAAE,YAAY,KAAK,kBAAkB,CAAC,CAAC;IAC/E,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAcD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,UAAU,CAAC,KAAK,CA8X1F"}
package/dist/dev.js CHANGED
@@ -158,6 +158,29 @@ export function developmentFetch(options = {}) {
158
158
  settleReview(stored);
159
159
  return json(stored.data);
160
160
  }
161
+ /*
162
+ * Listing approvals, which `findByExternalId` needs.
163
+ *
164
+ * Missing until an example used `externalId` for retry safety and got a
165
+ * 501 instead. Reviews, collections and flows all had their list route
166
+ * from the start; approvals — the primitive the feature is most documented
167
+ * on — did not, so the one thing that stops a restarted agent asking twice
168
+ * was the one thing you could not try without an account.
169
+ */
170
+ if (method === "GET" && path === "/approvals") {
171
+ const externalId = url.searchParams.get("externalId");
172
+ const status = url.searchParams.get("status");
173
+ // Settle first: a caller listing before polling should see the same
174
+ // state a poll would have shown it, not a stale `pending`.
175
+ for (const stored of store.values())
176
+ settle(stored);
177
+ let all = [...store.values()].map((a) => a.data);
178
+ if (externalId)
179
+ all = all.filter((a) => a.externalId === externalId);
180
+ if (status)
181
+ all = all.filter((a) => a.status === status);
182
+ return json({ approvals: all });
183
+ }
161
184
  if (method === "GET" && path === "/reviews") {
162
185
  const externalId = url.searchParams.get("externalId");
163
186
  const all = [...reviewStore.values()].map((r) => r.data);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deliverd/sdk",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Add human approval to any AI agent. Ask a person, wait for the answer, act on it.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/dev.ts CHANGED
@@ -225,6 +225,27 @@ export function developmentFetch(options: DevelopmentOptions = {}): typeof globa
225
225
  return json(stored.data);
226
226
  }
227
227
 
228
+ /*
229
+ * Listing approvals, which `findByExternalId` needs.
230
+ *
231
+ * Missing until an example used `externalId` for retry safety and got a
232
+ * 501 instead. Reviews, collections and flows all had their list route
233
+ * from the start; approvals — the primitive the feature is most documented
234
+ * on — did not, so the one thing that stops a restarted agent asking twice
235
+ * was the one thing you could not try without an account.
236
+ */
237
+ if (method === "GET" && path === "/approvals") {
238
+ const externalId = url.searchParams.get("externalId");
239
+ const status = url.searchParams.get("status");
240
+ // Settle first: a caller listing before polling should see the same
241
+ // state a poll would have shown it, not a stale `pending`.
242
+ for (const stored of store.values()) settle(stored);
243
+ let all = [...store.values()].map((a) => a.data);
244
+ if (externalId) all = all.filter((a) => a.externalId === externalId);
245
+ if (status) all = all.filter((a) => a.status === status);
246
+ return json({ approvals: all });
247
+ }
248
+
228
249
  if (method === "GET" && path === "/reviews") {
229
250
  const externalId = url.searchParams.get("externalId");
230
251
  const all = [...reviewStore.values()].map((r) => r.data);