@flipstream/sdk 0.13.0 → 0.14.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.
Files changed (79) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +48 -20
  3. package/dist/api/backend.d.ts +7 -0
  4. package/dist/api/backend.js +7 -0
  5. package/dist/api/backend.js.map +1 -1
  6. package/dist/api/credentials.js +4 -4
  7. package/dist/api/credentials.js.map +1 -1
  8. package/dist/api/datasets.js +30 -50
  9. package/dist/api/datasets.js.map +1 -1
  10. package/dist/api/handoff.d.ts +1 -1
  11. package/dist/api/handoff.js +7 -0
  12. package/dist/api/handoff.js.map +1 -1
  13. package/dist/api/log.d.ts +4 -4
  14. package/dist/api/log.js +23 -42
  15. package/dist/api/log.js.map +1 -1
  16. package/dist/api/me.d.ts +5 -3
  17. package/dist/api/me.js +3 -3
  18. package/dist/api/me.js.map +1 -1
  19. package/dist/api/members.d.ts +40 -17
  20. package/dist/api/members.js +66 -29
  21. package/dist/api/members.js.map +1 -1
  22. package/dist/api/ownRecord.d.ts +46 -0
  23. package/dist/api/ownRecord.js +57 -0
  24. package/dist/api/ownRecord.js.map +1 -0
  25. package/dist/api/refusal.d.ts +14 -0
  26. package/dist/api/refusal.js +23 -0
  27. package/dist/api/refusal.js.map +1 -0
  28. package/dist/api/wallet.d.ts +2 -1
  29. package/dist/api/wallet.js +18 -24
  30. package/dist/api/wallet.js.map +1 -1
  31. package/dist/api/workspaces.d.ts +7 -2
  32. package/dist/api/workspaces.js +14 -8
  33. package/dist/api/workspaces.js.map +1 -1
  34. package/dist/auth/discovery.js +4 -5
  35. package/dist/auth/discovery.js.map +1 -1
  36. package/dist/core/call.d.ts +5 -4
  37. package/dist/core/call.js +5 -7
  38. package/dist/core/call.js.map +1 -1
  39. package/dist/core/identify.d.ts +6 -0
  40. package/dist/core/identify.js +15 -7
  41. package/dist/core/identify.js.map +1 -1
  42. package/dist/core/inPlaceOf.d.ts +6 -0
  43. package/dist/core/inPlaceOf.js +17 -0
  44. package/dist/core/inPlaceOf.js.map +1 -0
  45. package/dist/core/invalid.d.ts +32 -9
  46. package/dist/core/invalid.js +36 -23
  47. package/dist/core/invalid.js.map +1 -1
  48. package/dist/core/notFound.d.ts +2 -2
  49. package/dist/core/notFound.js.map +1 -1
  50. package/dist/core/read.d.ts +4 -10
  51. package/dist/core/read.js +1 -11
  52. package/dist/core/read.js.map +1 -1
  53. package/dist/core/result.d.ts +13 -9
  54. package/dist/core/result.js +1 -0
  55. package/dist/core/result.js.map +1 -1
  56. package/dist/core/shared.d.ts +13 -9
  57. package/dist/core/shared.js +7 -6
  58. package/dist/core/shared.js.map +1 -1
  59. package/dist/flipstream.d.ts +81 -27
  60. package/dist/flipstream.js +37 -26
  61. package/dist/flipstream.js.map +1 -1
  62. package/dist/index.d.ts +2 -2
  63. package/dist/index.js +3 -2
  64. package/dist/index.js.map +1 -1
  65. package/dist/node/keychainChild.js +60 -25
  66. package/dist/node/keychainChild.js.map +1 -1
  67. package/dist/node/keychainError.d.ts +4 -1
  68. package/dist/node/keychainError.js.map +1 -1
  69. package/dist/node/keychainStore.js +42 -8
  70. package/dist/node/keychainStore.js.map +1 -1
  71. package/dist/node/session.js +6 -7
  72. package/dist/node/session.js.map +1 -1
  73. package/dist/query/query.d.ts +52 -8
  74. package/dist/query/query.js +133 -19
  75. package/dist/query/query.js.map +1 -1
  76. package/dist/version.gen.js +1 -1
  77. package/docs/admin.md +53 -4
  78. package/docs/node-sign-in.md +8 -4
  79. package/package.json +1 -1
@@ -1,28 +1,41 @@
1
- /*
2
- * An `invalid` the SDK finds by checking an answer after its read (#368): a record that isn't the one
3
- * asked for, another organisation's, a page that leaks, or an id that can't name the next path. It
4
- * has one shape wherever it's found, and `issues` names a place or a rule, never an id or a value.
5
- *
6
- * On our own backends' routes its `status` is assumed, never observed. A read takes any 2xx as ok,
7
- * and its data carries no status (#368's decision log dropped carrying one, since that would change
8
- * every read's shape). So it's the success status the route answers by its backend's own code: 200
9
- * for every GET the SDK sends to pulse-admin, pulse-auth and pulse-wallet, and for the two PUTs, whose
10
- * pulse-admin routes declare it at dff6bf9b
11
- * (adapters/connection/ingress/fastapi/__init__.py:423 and adapters/event_log/ingress/fastapi/__init__.py:164).
12
- * Where a route's success status isn't known, there's none: the two creates, POST /clients and POST
13
- * /event-logs, which come from a generic router with no recording of their answer.
14
- *
15
- * An authorisation server is any one the app names, so nothing in our code says how it answers: the
16
- * RFC 8414 metadata discover() reads and the OpenID configuration a session reads take the 2xx
17
- * call() heard instead (its `answered`), through invalidWith. A credentialed failure keeps its own
18
- * status (clientSecret.ts's vouchedFor). #385 would take the observed status for every check.
1
+ import { z } from 'zod';
2
+ // The status each answer came with, keyed by the answer itself, weakly, so it lives as long as the
3
+ // answer does. Only readParsed sets it, so only an answer as read is in it, with its status, or with
4
+ // none when its read heard none.
5
+ const answeredWith = new WeakMap();
6
+ /** Whether readParsed remembered `answer`: the one check that makes an answer `Heard` (#394). */
7
+ const isHeard = (answer) => answeredWith.has(answer);
8
+ /** The fault readParsed answers if it couldn't remember an answer it read. */
9
+ export const UNHEARD = "the answer couldn't be remembered with its status, so it isn't handed on";
10
+ /**
11
+ * `value`, a 2xx's JSON, read by `schema`: the data, as a `Heard` answer with the response's
12
+ * `status` remembered for a check of it after, or `invalid` with that `status`. readJson's own last
13
+ * step, and the one a scope's shared read takes for each call (#377's code review, 10), so both give
14
+ * one shape, status and issue text. Zod's issues name paths and expected types, never the body's
15
+ * values. The one place an answer becomes `Heard` (#398's code review, 3).
19
16
  */
20
- /** `invalid` with `status`, a status the SDK knows, or with none when it's undefined. */
17
+ export function readParsed(value, schema, status) {
18
+ const parsed = schema.safeParse(value);
19
+ if (!parsed.success)
20
+ return invalidWith(z.prettifyError(parsed.error), status);
21
+ const answer = { ok: true, data: parsed.data };
22
+ answeredWith.set(answer, status);
23
+ // The predicate reads what was just remembered, so it holds. Were it ever not to, the read answers
24
+ // invalid, naming why, as the session answers its own code's failure (session.ts's revoke, K6,
25
+ // rev140's round 3, P3.5): a result that fails closed, never a throw out of every read, and never
26
+ // an answer handed on that a check would find no status in (#398's code review, 6).
27
+ return isHeard(answer) ? answer : invalidWith(UNHEARD, status);
28
+ }
29
+ /** The status `answer` came with, as readParsed remembered it; none when its read heard none. */
30
+ export function statusOf(answer) {
31
+ return answeredWith.get(answer);
32
+ }
33
+ /** `invalid`, found by a check of `answer` after its read, with the status `answer` came with (#385). */
34
+ export function invalidIn(answer, issues) {
35
+ return invalidWith(issues, statusOf(answer));
36
+ }
37
+ /** `invalid` with `status`, a status the failure came with, or with none when it's undefined. */
21
38
  export function invalidWith(issues, status) {
22
39
  return { ok: false, error: status === undefined ? { kind: 'invalid', issues } : { kind: 'invalid', issues, status } };
23
40
  }
24
- /** `invalid`, found by a check of an answer whose route answers 200 by its backend's own code. */
25
- export const invalidAnswer = (issues) => invalidWith(issues, 200);
26
- /** `invalid`, found by a check of an answer whose route's success status isn't known: a create's. */
27
- export const invalidStatusUnknown = (issues) => invalidWith(issues, undefined);
28
41
  //# sourceMappingURL=invalid.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"invalid.js","sourceRoot":"","sources":["../../src/core/invalid.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,yFAAyF;AACzF,MAAM,UAAU,WAAW,CAAC,MAAc,EAAE,MAA0B;IACpE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAA;AACvH,CAAC;AAED,kGAAkG;AAClG,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAc,EAAoB,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAE3F,qGAAqG;AACrG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C,CAAA;AACjC,CAAC;AAED,yGAAyG;AACzG,MAAM,UAAU,SAAS,CAAC,MAAsB,EAAE,MAAc;IAC9D,OAAO,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAA;AAC9C,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,WAAW,CAAC,MAAc,EAAE,MAA0B;IACpE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAA;AACvH,CAAC"}
@@ -1,8 +1,8 @@
1
- import type { ApiResult } from './result.js';
1
+ import type { Failed } from './invalid.js';
2
2
  /**
3
3
  * `not_found` exactly as a service answers it for a record nobody has, its own `code` and `message`
4
4
  * included, so an answer the SDK makes for a record you can't see says no more than that (D571,
5
5
  * #372). A fresh object on each call: a caller that changes one answer never changes another's
6
6
  * (#373's code review, 8).
7
7
  */
8
- export declare const notFound: (code: string, message: string) => ApiResult<never>;
8
+ export declare const notFound: (code: string, message: string) => Failed;
@@ -1 +1 @@
1
- {"version":3,"file":"notFound.js","sourceRoot":"","sources":["../../src/core/notFound.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,OAAe,EAAoB,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,CAAA"}
1
+ {"version":3,"file":"notFound.js","sourceRoot":"","sources":["../../src/core/notFound.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,OAAe,EAAU,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,CAAA"}
@@ -1,18 +1,12 @@
1
- import { z } from 'zod';
2
- import { type ApiError, type ApiResult } from './result.js';
1
+ import type { z } from 'zod';
2
+ import { type HeardResult } from './invalid.js';
3
+ import { type ApiError } from './result.js';
3
4
  import type { ServiceName, TransportResult } from './transport.js';
4
5
  type NoAnswer = Exclude<TransportResult, {
5
6
  readonly kind: 'response';
6
7
  }>;
7
8
  /** readJson's issue for a 2xx whose body isn't JSON: a proxy's or a portal's page, never the host's answer. */
8
9
  export declare const NOT_JSON = "the body is not JSON";
9
- /**
10
- * `value`, a 2xx's JSON, read by `schema`: the data, or `invalid` with the response's `status`.
11
- * readJson's own last step, and the one a scope's shared read takes for each call (#377's code
12
- * review, 10), so both give one shape, status and issue text. Zod's issues name paths and expected
13
- * types, never the body's values.
14
- */
15
- export declare function readParsed<T>(value: unknown, schema: z.ZodType<T>, status: number): ApiResult<T>;
16
10
  /** Why a transport has no answer to read. */
17
11
  export declare function noAnswer(sent: NoAnswer): ApiError;
18
12
  /**
@@ -22,5 +16,5 @@ export declare function noAnswer(sent: NoAnswer): ApiError;
22
16
  * not JSON, or fails its schema, is `invalid`: reported, never shown as empty. Zod's issues name
23
17
  * paths and expected types, never the body's values.
24
18
  */
25
- export declare function readJson<T>(sent: TransportResult, schema: z.ZodType<T>, signal: AbortSignal, service: ServiceName, keepsNoText?: boolean): Promise<ApiResult<T>>;
19
+ export declare function readJson<T>(sent: TransportResult, schema: z.ZodType<T>, signal: AbortSignal, service: ServiceName, keepsNoText?: boolean): Promise<HeardResult<T>>;
26
20
  export {};
package/dist/core/read.js CHANGED
@@ -1,5 +1,5 @@
1
- import { z } from 'zod';
2
1
  import { parseJson, said } from './body.js';
2
+ import { readParsed } from './invalid.js';
3
3
  import { classifyStatus } from './result.js';
4
4
  // The reasons a transport may give, tied to its type: a reason TransportResult gains fails to
5
5
  // compile here until it's mapped. Checked as an own key, because an app's own transport may be
@@ -7,16 +7,6 @@ import { classifyStatus } from './result.js';
7
7
  const FROM_TRANSPORT = { destination: true, identification: true };
8
8
  /** readJson's issue for a 2xx whose body isn't JSON: a proxy's or a portal's page, never the host's answer. */
9
9
  export const NOT_JSON = 'the body is not JSON';
10
- /**
11
- * `value`, a 2xx's JSON, read by `schema`: the data, or `invalid` with the response's `status`.
12
- * readJson's own last step, and the one a scope's shared read takes for each call (#377's code
13
- * review, 10), so both give one shape, status and issue text. Zod's issues name paths and expected
14
- * types, never the body's values.
15
- */
16
- export function readParsed(value, schema, status) {
17
- const parsed = schema.safeParse(value);
18
- return parsed.success ? { ok: true, data: parsed.data } : failed({ kind: 'invalid', issues: z.prettifyError(parsed.error), status });
19
- }
20
10
  /** Why a transport has no answer to read. */
21
11
  export function noAnswer(sent) {
22
12
  switch (sent.kind) {
@@ -1 +1 @@
1
- {"version":3,"file":"read.js","sourceRoot":"","sources":["../../src/core/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,EAAE,cAAc,EAAiC,MAAM,aAAa,CAAA;AAM3E,8FAA8F;AAC9F,+FAA+F;AAC/F,wCAAwC;AACxC,MAAM,cAAc,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAoD,CAAA;AAEpH,+GAA+G;AAC/G,MAAM,CAAC,MAAM,QAAQ,GAAG,sBAAsB,CAAA;AAE9C;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAI,KAAc,EAAE,MAAoB,EAAE,MAAc;IAChF,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IACtC,OAAO,MAAM,CAA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M,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;IACtD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,CAAA;IACjF,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;IAC3C,CAAC;AACH,CAAC;AAED,MAAM,MAAM,GAAG,CAAC,KAAe,EAAU,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA"}
@@ -61,15 +61,14 @@ export type ApiError = Answered
61
61
  readonly status?: never;
62
62
  }
63
63
  /**
64
- * Outside the contract: reported, never shown as empty. `status` is set on a failure from an
65
- * answer whose status the SDK knows. When the answer's own status or shape is outside the
66
- * contract, or a read after pause's or resume's write failed, it's the response's. When a check
67
- * after the read found it (#368), on an authorisation server's answer (discover()'s metadata, a
68
- * session's OpenID configuration) it's the 2xx that server answered, since any server can be
69
- * named there. On Flipstream's own routes it's the success status that route answers by its
70
- * backend's own code, 200 for every read and both PUTs, assumed from a 2xx and never observed
71
- * until #385. A create's answer has none, since its route's success status isn't known. `text` is
72
- * its body, when a 2xx body is not JSON.
64
+ * Outside the contract: reported, never shown as empty. `status` is the one the answer came with,
65
+ * observed, never assumed, and set whenever an answer came. When the answer's own status or shape
66
+ * is outside the contract, or a read after pause's or resume's write failed, it's that response's.
67
+ * When a check after the read found it (#368), it's the 2xx the answer it was found in came with
68
+ * (#385), whatever the route or server: 200 where Flipstream's routes answer 200, the 2xx a
69
+ * create's answer came with, and what an authorisation server or anything in front of a route
70
+ * answered. A retried read's is the last attempt's. `text` is its body, when a 2xx body is not
71
+ * JSON.
73
72
  */
74
73
  | {
75
74
  readonly kind: 'invalid';
@@ -141,6 +140,11 @@ export type RefusedReason =
141
140
  | 'conversation-id'
142
141
  /** The request has keys the call doesn't send, named in `fields` (D513). */
143
142
  | 'fields'
143
+ /**
144
+ * A query that asks for no dimension and no metric: every answer to it could only be `invalid`,
145
+ * since none of its keys was asked for, so nothing is sent (#412's code review, 2).
146
+ */
147
+ | 'nothing_asked'
144
148
  /**
145
149
  * Sign-in: a pending sign-in that isn't one, wasn't started by this app at this server, or whose
146
150
  * token endpoint breaks its issuer's rule (an app's own server can give it one).
@@ -29,6 +29,7 @@ const REFUSED_BECAUSE = {
29
29
  identification: 'a value identifying the app, its agent or the conversation holds the access token',
30
30
  path: "a path value can't be '', '.' or '..'",
31
31
  'conversation-id': "the call's conversationId isn't 1 to 128 of A-Z, a-z, 0-9, ., _, : and -",
32
+ nothing_asked: 'the query asks for no dimension and no metric',
32
33
  pending: "the pending sign-in isn't one this app started at this server, or its token endpoint breaks its issuer's rule",
33
34
  callback: "the callback URL can't be read",
34
35
  };
@@ -1 +1 @@
1
- {"version":3,"file":"result.js","sourceRoot":"","sources":["../../src/core/result.ts"],"names":[],"mappings":"AA6HA;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC;QAAE,OAAO,kBAAkB,CAAA;IACxD,IAAI,MAAM,IAAI,GAAG,IAAI,MAAM,IAAI,GAAG;QAAE,OAAO,SAAS,CAAA;IACpD,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,cAAc,CAAA;IACzC,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,WAAW,CAAA;IACtC,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,WAAW,CAAA;IACtC,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,UAAU,CAAA;IACvD,IAAI,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,IAAI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AAO,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,gCAAgC,OAAO,EAAE,CAAA;AACvG,CAAC;AAED,yGAAyG;AACzG,MAAM,QAAQ,GAAG,gBAAgB,CAAA;AAEjC;;;;GAIG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK;IAC1B,KAAK,CAAU;IAOxB,YAAY,KAAe,EAAE,OAAgB;QAC3C,8FAA8F;QAC9F,MAAM,MAAM,GAAG,OAAO,OAAO,KAAK,QAAQ,IAAI,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAA;QAC1F,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,KAAK,CAAC,aAAa,MAAM,GAAG,CAAC,CAAA;QACpG,IAAI,CAAC,IAAI,GAAG,YAAY,CAAA;QACxB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,8FAA8F;QAC9F,IAAI,MAAM,KAAK,SAAS;YAAE,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAA;IAClD,CAAC;CACF;AAED,+FAA+F;AAC/F,MAAM,UAAU,OAAO,CAAI,MAAoB;IAC7C,IAAI,CAAC,MAAM,CAAC,EAAE;QAAE,MAAM,IAAI,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAA;IACnE,OAAO,MAAM,CAAC,IAAI,CAAA;AACpB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import type { CallSpec } from './call.js';
2
2
  import type { Deadline } from './deadline.js';
3
- import { type ApiResult } from './result.js';
3
+ import { type HeardResult } from './invalid.js';
4
4
  /** How a spec is shared in a scope (`CallSpec.shared`): its key, with its endpoint's, names one read. */
5
5
  export interface SharedRule {
6
6
  /** The path the read asks for, as the seam builds it, so no request is built to name it. */
@@ -14,16 +14,20 @@ export interface Waiter {
14
14
  }
15
15
  /**
16
16
  * How a shared read is sent: `spec`, its answer read as JSON and left unchecked, under `deadlineMs`,
17
- * its starter's, and ended by `end`, never by one call's signal. `answered` hears the 2xx's status.
18
- * Its `origin` is what the scope hands each call it answers: the read's own trace, in the client.
17
+ * its starter's, and ended by `end`, never by one call's signal. Its answer carries the status it
18
+ * came with (`statusOf`, #385), as every read's does, so a `Heard` one (#394). Its `origin` is what
19
+ * the scope hands each call it answers: the read's own trace, in the client.
19
20
  */
20
- export type StartRead<O> = (spec: CallSpec<unknown>, deadlineMs: number, end: AbortSignal, answered: (status: number) => void) => {
21
- readonly answer: Promise<ApiResult<unknown>>;
21
+ export type StartRead<O> = (spec: CallSpec<unknown>, deadlineMs: number, end: AbortSignal) => {
22
+ readonly answer: Promise<HeardResult<unknown>>;
22
23
  readonly origin: O;
23
24
  };
24
- /** What a call heard from a shared read: its result, and the read that answered it, when one did. */
25
- export interface Heard<T, O> {
26
- readonly result: ApiResult<T>;
25
+ /**
26
+ * What a call got from a shared read: its result, `Heard` as readParsed made it for this call
27
+ * (#394), and the read that answered it, when one did.
28
+ */
29
+ export interface SharedResult<T, O> {
30
+ readonly result: HeardResult<T>;
27
31
  readonly origin: O | undefined;
28
32
  }
29
33
  /** A scope's shared reads. */
@@ -31,7 +35,7 @@ export interface SharedReads<O> {
31
35
  /** True until the scope closes; then every call reads its own, as outside a scope. */
32
36
  readonly isOpen: () => boolean;
33
37
  /** `spec`'s answer for `waiter`, from the one read the scope makes of it, started with `start` when none is kept. */
34
- read<T>(spec: CallSpec<T>, rule: SharedRule, waiter: Waiter, start: StartRead<O>): Promise<Heard<T, O>>;
38
+ read<T>(spec: CallSpec<T>, rule: SharedRule, waiter: Waiter, start: StartRead<O>): Promise<SharedResult<T, O>>;
35
39
  /** Closes the scope: ends every shared read still in flight, and answers once each has settled. */
36
40
  close(): Promise<void>;
37
41
  }
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { NOT_JSON, readParsed } from './read.js';
2
+ import { NOT_JSON } from './read.js';
3
+ import { readParsed, statusOf } from './invalid.js';
3
4
  import { classifyStatus } from './result.js';
4
5
  import { stopListening } from './signal.js';
5
6
  // Built fresh each time, so no two calls hold one object.
@@ -92,11 +93,9 @@ export function sharedReads() {
92
93
  };
93
94
  const begin = (key, spec, first, start) => {
94
95
  const end = new AbortController();
95
- let status;
96
- const sent = start({ ...spec, schema: z.unknown() }, first.deadline.left(), end.signal, (answered) => (status = answered));
96
+ const sent = start({ ...spec, schema: z.unknown() }, first.deadline.left(), end.signal);
97
97
  // Settled in the read's own resolution, so every waiter hears an outcome the scope has kept or dropped.
98
98
  const answer = sent.answer.then((outcome) => {
99
- entry.status = status;
100
99
  settle(entry, outcome);
101
100
  return outcome;
102
101
  }, (error) => {
@@ -105,7 +104,7 @@ export function sharedReads() {
105
104
  });
106
105
  // Seen at once, so a rejection no call waits on is never unhandled.
107
106
  answer.catch(() => undefined);
108
- const entry = { key, answer, origin: sent.origin, waiters: new Set([first]), end, born: generation, status: undefined, settled: false };
107
+ const entry = { key, answer, origin: sent.origin, waiters: new Set([first]), end, born: generation, settled: false };
109
108
  entries.set(key, entry);
110
109
  live.add(entry);
111
110
  return entry;
@@ -161,7 +160,9 @@ export function sharedReads() {
161
160
  continue;
162
161
  if (!outcome.ok)
163
162
  return { result: copyOf(outcome.error), origin: entry.origin };
164
- return { result: readParsed(structuredClone(outcome.data), spec.schema, entry.status ?? 200), origin: entry.origin };
163
+ // Each call's answer, or its schema failure, with the status the read's own answer came with,
164
+ // never one assumed (#385).
165
+ return { result: readParsed(structuredClone(outcome.data), spec.schema, statusOf(outcome)), origin: entry.origin };
165
166
  }
166
167
  },
167
168
  async close() {
@@ -1 +1 @@
1
- {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/core/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAE,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AAA;QAC/D,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -127,6 +127,27 @@ declare global {
127
127
  readonly asyncDispose: unique symbol;
128
128
  }
129
129
  }
130
+ /** How a scope is made (#409, D579): `flipstream.scope(options)` and `withScope(run, options)`. */
131
+ export interface ScopeOptions {
132
+ /**
133
+ * The caller's own W3C trace context, for the scope's shared reads, as a call's `traceparent` is
134
+ * for its own requests: each shared read goes out under its trace-id and flags, with a parent-id of
135
+ * its own for each attempt. So one piece of work, such as a CLI command, is one trace.
136
+ * - **A call names the request that answered it** as its `trace_id` (#376): a shared read's whose
137
+ * failure is its answer, else its own requests', else the first shared read it asked for. So a
138
+ * call answered by shared reads alone, such as `me()`, names the scope's trace-id, even when it
139
+ * was given a `traceparent` of its own.
140
+ * - **Only where the SDK sends a trace:** Node's requests to the admin host, your organisation's
141
+ * and a workspace's own reads. The sign-in server, where your person is read, never gets one
142
+ * (#192), and from a browser the admin host gets none yet (#380), so there the option changes
143
+ * nothing.
144
+ * - **One that isn't a valid version-00 traceparent,** a value that isn't a string included, is
145
+ * dropped, as a call's is, and the shared reads keep traces of their own.
146
+ * - It never reaches a call's own requests, and a call's own `traceparent` never reaches a shared
147
+ * read.
148
+ */
149
+ readonly traceparent?: string;
150
+ }
130
151
  /**
131
152
  * One piece of work's shared reads (#376, D573): a route's load in the console, a command in the
132
153
  * CLI. Made by `flipstream.scope()`, taken by each call as `{ scope }`, and ended by `close()`, or
@@ -153,6 +174,13 @@ export interface Flipstream {
153
174
  readonly source: string;
154
175
  }, options?: CallOptions): Promise<ApiResult<CatalogSource>>;
155
176
  };
177
+ /**
178
+ * A query's answer. Every row, and its totals, are keyed by the dimensions and metrics asked for,
179
+ * and only those: any other key makes the answer `invalid`, so it never reaches you as data. The
180
+ * error names at most five of the keys, each shaped like a field name, and counts the rest, never
181
+ * a value (#237). A query that asks for no dimension and no metric is `refused`, with `reason`
182
+ * `nothing_asked`, and nothing is sent: no answer to it could pass that check.
183
+ */
156
184
  query(request: QueryRequest, options?: CallOptions): Promise<ApiResult<QueryResponse>>;
157
185
  /**
158
186
  * Whether the planner answers, signed out: `GET /health` with no token. It goes through neither
@@ -190,7 +218,8 @@ export interface Flipstream {
190
218
  * first, for its id, and a call under one workspace reads you beside it, all under one deadline
191
219
  * (the call's, or 30 s); the first failure is the answer. A workspace of another organisation is
192
220
  * `invalid`, never dropped or shown. A call under one workspace answers `not_found` for one you
193
- * don't open, as for one nobody has: see "The workspaces you open" in docs/admin.md (#372).
221
+ * don't open, as for one nobody has, and so does one for a workspace whose own read pulse-admin
222
+ * refuses (D578): see "The workspaces you open" in docs/admin.md (#372).
194
223
  */
195
224
  readonly workspaces: {
196
225
  /**
@@ -208,7 +237,8 @@ export interface Flipstream {
208
237
  /**
209
238
  * One workspace, by its id. An id that can't stay one path segment is `refused` (`path`), with
210
239
  * nothing sent. Your organisation and you are read first, so one you don't open is `not_found`,
211
- * exactly as one nobody has, with nothing under it read.
240
+ * exactly as one nobody has, with nothing under it read. One whose own read pulse-admin refuses,
241
+ * its own 403 (`FORBIDDEN_EXCEPTION`), is `not_found` too, as one nobody has (D578).
212
242
  */
213
243
  get(request: {
214
244
  readonly workspace_id: string;
@@ -231,8 +261,8 @@ export interface Flipstream {
231
261
  /**
232
262
  * A rename is a person's, in the console (D542): it answers `needs_person`, with why and, where
233
263
  * the console can be named, the workspace's settings page. It never writes, and the name isn't
234
- * sent: the person types it there. A workspace that isn't yours, or that you don't open, is
235
- * `not_found`, never handed off.
264
+ * sent: the person types it there. A workspace that isn't yours, that you don't open, or whose
265
+ * read pulse-admin refuses (D578), is `not_found`, never handed off.
236
266
  */
237
267
  rename(request: {
238
268
  readonly workspace_id: string;
@@ -249,8 +279,9 @@ export interface Flipstream {
249
279
  /**
250
280
  * The logbook (#218, #295), on the admin host: a workspace's notes on time ranges, and one
251
281
  * member's entries across your organisation's workspaces. A call under one workspace answers
252
- * `not_found` for one you don't open, as for one nobody has: see "The workspaces you open" in
253
- * docs/admin.md (#372).
282
+ * `not_found` for one you don't open, as for one nobody has, and so does one for a workspace or an
283
+ * entry whose own read pulse-admin refuses (D578): see "The workspaces you open" in docs/admin.md
284
+ * (#372).
254
285
  */
255
286
  readonly log: {
256
287
  /**
@@ -264,7 +295,8 @@ export interface Flipstream {
264
295
  * or removed in between, and entries written at the same moment have no fixed order among
265
296
  * themselves. A changed `total` shows that something was added or removed; an unchanged one
266
297
  * doesn't prove nothing was. Your organisation and you are read first, then the workspace
267
- * beside the list (#249, #372), under one deadline: one nobody has, or one you don't open, is
298
+ * beside the list (#249, #372), under one deadline: one nobody has, one you don't open, or one
299
+ * whose read pulse-admin refuses (D578), is
268
300
  * `not_found`, and another organisation's is `invalid`, never an empty page. An entry of
269
301
  * another workspace or organisation makes the answer `invalid`, never dropped. A limit or
270
302
  * offset that isn't a whole number in range rejects, with nothing sent, as every list's does.
@@ -281,7 +313,8 @@ export interface Flipstream {
281
313
  * One entry, by its id, read beside your organisation and you (#249, #372); `not_found` when
282
314
  * there's none, or it's in a workspace you don't open, and `invalid` when the answer is another
283
315
  * entry, or another organisation's. A failure of the entry's own read is the backend's, as it
284
- * answered.
316
+ * answered, but pulse-admin's own refusal (its 403, `FORBIDDEN_EXCEPTION`): that says the entry
317
+ * exists, so it's `not_found`, as one nobody has (D578).
285
318
  */
286
319
  get(request: {
287
320
  readonly log_id: string;
@@ -291,8 +324,9 @@ export interface Flipstream {
291
324
  * `refused` (`fields`, naming them), and a description that isn't a non-blank string, a time
292
325
  * not written as `2026-10-05T00:00:00Z` (a fraction may follow the seconds, and an offset such
293
326
  * as `+02:00`, or none, may take the place of the `Z`), or a start after the end rejects with a
294
- * TypeError. Your organisation and you are read first, then the workspace: one nobody has, or
295
- * one you don't open, is `not_found`, and another organisation's `invalid`, with nothing
327
+ * TypeError. Your organisation and you are read first, then the workspace: one nobody has, one
328
+ * you don't open, or one whose read pulse-admin refuses (D578), is `not_found`, and another
329
+ * organisation's `invalid`, with nothing
296
330
  * written. Times go as UTC instants; one with no offset is
297
331
  * read as UTC. Who may write is the backend's rule, not the SDK's: Owners, Admins and Editors
298
332
  * add; an Editor changes or removes only their own entries, and Owners and Admins any. Until the
@@ -330,9 +364,11 @@ export interface Flipstream {
330
364
  * dataset of another organisation is
331
365
  * `invalid`, never dropped or shown. The backend's answers embed each dataset's sign-in, so a
332
366
  * body that isn't its JSON is never kept: a failure of the dataset's own read or write has no
333
- * `text` (#279). The organisation's and the workspace's reads keep theirs. A call under one
334
- * workspace answers `not_found` for one you don't open, as for one nobody has: see "The
335
- * workspaces you open" in docs/admin.md (#372).
367
+ * `text` (#279). The organisation's and the workspace's reads keep theirs, but pulse-admin's own
368
+ * refusal of the workspace's read, which is `not_found`. A call under one workspace answers
369
+ * `not_found` for one you don't open, as for one nobody has, and so does one for a workspace or a
370
+ * dataset whose own read pulse-admin refuses (D578): see "The workspaces you open" in
371
+ * docs/admin.md (#372).
336
372
  */
337
373
  readonly datasets: {
338
374
  /**
@@ -342,8 +378,9 @@ export interface Flipstream {
342
378
  * can overlap or skip a dataset when datasets are added, removed or renamed in between, or when
343
379
  * two share a name. A changed `total` shows some of that; an unchanged one doesn't prove none
344
380
  * happened. For a complete, stable list, read it in one page, of up to 1,000. A dataset of
345
- * another workspace makes the answer `invalid`, never dropped. A workspace nobody has, or one
346
- * you don't open, is `not_found`, and another organisation's is `invalid`, never an empty page.
381
+ * another workspace makes the answer `invalid`, never dropped. A workspace nobody has, one you
382
+ * don't open, or one whose read pulse-admin refuses (D578), is `not_found`, and another
383
+ * organisation's is `invalid`, never an empty page.
347
384
  *
348
385
  * `{ organization: true }` instead of a workspace (#342): your organisation's datasets, in every
349
386
  * workspace you open, paged and ordered as a workspace's are. Exactly one of `workspace_id` and
@@ -363,7 +400,8 @@ export interface Flipstream {
363
400
  * workspace and organisation are read, so one `list` would refuse for anything else can't lose
364
401
  * the count, while one of another workspace or organisation, or a page whose count is smaller
365
402
  * than it or above 0 with no dataset on it, is `invalid`. The workspace is read beside it, by
366
- * `list`'s rules for it: a workspace nobody has, or one you don't open, is `not_found`, and
403
+ * `list`'s rules for it: a workspace nobody has, one you don't open, or one whose read
404
+ * pulse-admin refuses (D578), is `not_found`, and
367
405
  * another organisation's `invalid`, never a count of 0. The organisation's failure, then yours,
368
406
  * then the workspace's, then the count's, is the answer. A `workspace_id` that isn't a string
369
407
  * rejects with a TypeError, with nothing sent. A count across your organisation isn't here yet.
@@ -376,7 +414,9 @@ export interface Flipstream {
376
414
  /**
377
415
  * One dataset, by its id, read beside your organisation and you; `not_found` when there's none,
378
416
  * or it's in a workspace you don't open, and `invalid` when the answer is another dataset. A
379
- * failure of the dataset's own read is the backend's, as it answered.
417
+ * failure of the dataset's own read is the backend's, as it answered, but pulse-admin's own
418
+ * refusal (its 403, `FORBIDDEN_EXCEPTION`): that says the dataset exists, so it's `not_found`,
419
+ * as one nobody has (D578).
380
420
  */
381
421
  get(request: {
382
422
  readonly dataset_id: string;
@@ -386,7 +426,8 @@ export interface Flipstream {
386
426
  * sends the same write and answers the same. Before anything is sent, a key other than
387
427
  * `dataset_id` is `refused` (`fields`, naming them), and an id that isn't a string rejects with
388
428
  * a TypeError. The dataset is read first, fresh, beside your organisation and you: one nobody
389
- * has, or one in a workspace you don't open, is `not_found`, and another organisation's
429
+ * has, one in a workspace you don't open, or one whose read pulse-admin refuses (D578), is
430
+ * `not_found`, and another organisation's
390
431
  * `invalid`, with nothing written. Then `active` alone is sent, so a rename made meanwhile
391
432
  * stays. The dataset is read fresh again after the write, and the answer is that read: one
392
433
  * whose `active` isn't the one asked for is `invalid`, since the write may not have been
@@ -407,7 +448,8 @@ export interface Flipstream {
407
448
  /**
408
449
  * Deleting a dataset is a person's to do, in the console (D542, D546): it removes the dataset's
409
450
  * data for good, and the console can't delete one yet. Never a write: it reads the dataset (one
410
- * nobody has, or one in a workspace you don't open, is `not_found`, and another organisation's
451
+ * nobody has, one in a workspace you don't open, or one whose read pulse-admin refuses (D578), is
452
+ * `not_found`, and another organisation's
411
453
  * `invalid`), then answers `needs_person` with `why`, and the dataset's page as `url`, with
412
454
  * what it shows as `sees`, where a console can be named.
413
455
  */
@@ -507,6 +549,16 @@ export interface Flipstream {
507
549
  get(request: {
508
550
  readonly member_id: string;
509
551
  }, options?: CallOptions): Promise<ApiResult<Member>>;
552
+ /**
553
+ * Removing someone from your organisation is a person's to do, in the console (D542): it can't
554
+ * be undone. Never a write: it reads the person by `get`'s rules (one there's no such person
555
+ * for you, such as an API key, is `not_found`, a read pulse-auth refuses is `forbidden`, and
556
+ * another organisation's is `invalid`), then answers `needs_person` with `why`, and the
557
+ * person's page as `url`, with what it shows as `sees`, where a console can be named.
558
+ */
559
+ remove(request: {
560
+ readonly member_id: string;
561
+ }, options?: CallOptions): Promise<ApiResult<never>>;
510
562
  };
511
563
  /**
512
564
  * A scope for one piece of work, such as a page's load or a command (#376, D573): every call that
@@ -516,9 +568,11 @@ export interface Flipstream {
516
568
  * - They're read from the backend at the first call that needs them, and every later call reuses
517
569
  * that read, still on its way or answered. Nothing is taken on your word.
518
570
  * - A shared read is the starting call's own read, its deadline and retries, under a trace of its
519
- * own, and every call it answers names that trace. Each call keeps its own `deadlineMs` and
520
- * signal: they end that call's wait, never the read, and a call still waiting when the read times
521
- * out at its starter's deadline reads again. A read no call waits on any more is ended.
571
+ * own, or the scope's `traceparent`'s trace when it's given one (`ScopeOptions`, #409), and every
572
+ * call it answers names that trace. A call's own `traceparent` never reaches it. Each call keeps
573
+ * its own `deadlineMs` and signal: they end that call's wait, never the read, and a call still
574
+ * waiting when the read times out at its starter's deadline reads again. A read no call waits on
575
+ * any more is ended.
522
576
  * - A definitive failure (`forbidden`, `not_found`, `conflict`, `refused`, `rejected` but a 408 or
523
577
  * 425, and `invalid` but a 2xx whose body isn't JSON or a status outside the contract) is every
524
578
  * later call's answer too, as its own copy, with no new read. A transient one is the answer of
@@ -529,13 +583,13 @@ export interface Flipstream {
529
583
  * - Close it when the work is done (`close()`, or `await using`). It keeps each answer until then:
530
584
  * it's one piece of work, never a session. Nothing is kept past it.
531
585
  */
532
- scope(): Scope;
586
+ scope(options?: ScopeOptions): Scope;
533
587
  /**
534
- * `scope()` for the length of `run`: `run` gets the client with every call in the scope, and the
535
- * scope is closed when `run` settles, so it can't be left open. `run`'s answer is `withScope`'s,
536
- * and so is its rejection.
588
+ * `scope(options)` for the length of `run`: `run` gets the client with every call in the scope, and
589
+ * the scope is closed when `run` settles, so it can't be left open. `run`'s answer is
590
+ * `withScope`'s, and so is its rejection.
537
591
  */
538
- withScope<T>(run: (flipstream: ScopedFlipstream) => Promise<T>): Promise<T>;
592
+ withScope<T>(run: (flipstream: ScopedFlipstream) => Promise<T>, options?: ScopeOptions): Promise<T>;
539
593
  }
540
594
  /** The client inside `withScope`: every call in its scope, and no scope of its own (#376). */
541
595
  export type ScopedFlipstream = Omit<Flipstream, 'scope' | 'withScope'>;