@flipstream/sdk 0.11.0 → 0.12.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 (85) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +97 -412
  3. package/dist/api/backend.d.ts +10 -0
  4. package/dist/api/backend.js +24 -4
  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.d.ts +82 -14
  9. package/dist/api/datasets.js +193 -57
  10. package/dist/api/datasets.js.map +1 -1
  11. package/dist/api/index.d.ts +1 -1
  12. package/dist/api/log.d.ts +25 -20
  13. package/dist/api/log.js +63 -48
  14. package/dist/api/log.js.map +1 -1
  15. package/dist/api/me.js +7 -4
  16. package/dist/api/me.js.map +1 -1
  17. package/dist/api/members.d.ts +34 -1
  18. package/dist/api/members.js +67 -27
  19. package/dist/api/members.js.map +1 -1
  20. package/dist/api/wallet.d.ts +8 -5
  21. package/dist/api/wallet.js +36 -24
  22. package/dist/api/wallet.js.map +1 -1
  23. package/dist/api/workspaces.d.ts +28 -7
  24. package/dist/api/workspaces.js +46 -16
  25. package/dist/api/workspaces.js.map +1 -1
  26. package/dist/auth/discovery.d.ts +19 -6
  27. package/dist/auth/discovery.js +25 -4
  28. package/dist/auth/discovery.js.map +1 -1
  29. package/dist/auth/signIn.d.ts +18 -14
  30. package/dist/auth/signIn.js +29 -22
  31. package/dist/auth/signIn.js.map +1 -1
  32. package/dist/core/call.d.ts +4 -1
  33. package/dist/core/call.js +26 -6
  34. package/dist/core/call.js.map +1 -1
  35. package/dist/core/deadline.d.ts +30 -0
  36. package/dist/core/deadline.js +51 -0
  37. package/dist/core/deadline.js.map +1 -0
  38. package/dist/core/invalid.d.ts +7 -0
  39. package/dist/core/invalid.js +22 -0
  40. package/dist/core/invalid.js.map +1 -0
  41. package/dist/core/names.d.ts +13 -2
  42. package/dist/core/names.js +11 -2
  43. package/dist/core/names.js.map +1 -1
  44. package/dist/core/notFound.d.ts +8 -0
  45. package/dist/core/notFound.js +8 -0
  46. package/dist/core/notFound.js.map +1 -0
  47. package/dist/core/result.d.ts +17 -12
  48. package/dist/core/result.js +5 -5
  49. package/dist/core/result.js.map +1 -1
  50. package/dist/core/retry.d.ts +5 -2
  51. package/dist/core/retry.js +6 -3
  52. package/dist/core/retry.js.map +1 -1
  53. package/dist/core/scope.d.ts +20 -0
  54. package/dist/core/scope.js +54 -0
  55. package/dist/core/scope.js.map +1 -0
  56. package/dist/flipstream.d.ts +136 -69
  57. package/dist/flipstream.js +67 -45
  58. package/dist/flipstream.js.map +1 -1
  59. package/dist/node/clientSecret.js +5 -5
  60. package/dist/node/clientSecret.js.map +1 -1
  61. package/dist/node/headless.d.ts +14 -6
  62. package/dist/node/headless.js +8 -6
  63. package/dist/node/headless.js.map +1 -1
  64. package/dist/node/index.d.ts +1 -1
  65. package/dist/node/index.js +1 -1
  66. package/dist/node/index.js.map +1 -1
  67. package/dist/node/keychainChild.js +26 -14
  68. package/dist/node/keychainChild.js.map +1 -1
  69. package/dist/node/keychainError.d.ts +3 -3
  70. package/dist/node/keychainStore.d.ts +10 -7
  71. package/dist/node/keychainStore.js +44 -23
  72. package/dist/node/keychainStore.js.map +1 -1
  73. package/dist/node/loopback.d.ts +8 -1
  74. package/dist/node/loopback.js +19 -2
  75. package/dist/node/loopback.js.map +1 -1
  76. package/dist/node/session.d.ts +17 -9
  77. package/dist/node/session.js +55 -44
  78. package/dist/node/session.js.map +1 -1
  79. package/dist/node/store.d.ts +35 -2
  80. package/dist/node/store.js +56 -12
  81. package/dist/node/store.js.map +1 -1
  82. package/dist/version.gen.js +1 -1
  83. package/docs/admin.md +503 -0
  84. package/docs/node-sign-in.md +60 -38
  85. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"result.js","sourceRoot":"","sources":["../../src/core/result.ts"],"names":[],"mappings":"AAoHA;;;;GAIG;AACH,MAAM,UAAU,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C/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"}
@@ -22,9 +22,12 @@ export type Decision = {
22
22
  };
23
23
  /**
24
24
  * Whether to try again after `attempt` attempts, and after how long. A wait that would not end
25
- * before `deadline` is not started: the outcome is the answer, and the caller decides.
25
+ * within the `leftMs` left of the deadline is not started: the outcome is the answer, and the caller
26
+ * decides. The caller reads `leftMs` off its deadline (#333), in whole ms rounded down, and this reads
27
+ * no clock. So a wait that would leave under 1 ms for the attempt after it isn't started: that
28
+ * attempt couldn't be sent and answered in the time (#337's code review, 3).
26
29
  */
27
- export declare function decide(rule: RetryRule, attempt: number, outcome: Outcome, now: number, deadline: number): Decision;
30
+ export declare function decide(rule: RetryRule, attempt: number, outcome: Outcome, leftMs: number): Decision;
28
31
  /**
29
32
  * The ceiling for a host's stated wait: a hostile or broken header must never park a caller for
30
33
  * hours (`Retry-After: 999999999` is about 31 years). From the CLI's `api/http.ts`.
@@ -8,9 +8,12 @@ const MAX_RETRIES = 2;
8
8
  const STOP = { kind: 'stop' };
9
9
  /**
10
10
  * Whether to try again after `attempt` attempts, and after how long. A wait that would not end
11
- * before `deadline` is not started: the outcome is the answer, and the caller decides.
11
+ * within the `leftMs` left of the deadline is not started: the outcome is the answer, and the caller
12
+ * decides. The caller reads `leftMs` off its deadline (#333), in whole ms rounded down, and this reads
13
+ * no clock. So a wait that would leave under 1 ms for the attempt after it isn't started: that
14
+ * attempt couldn't be sent and answered in the time (#337's code review, 3).
12
15
  */
13
- export function decide(rule, attempt, outcome, now, deadline) {
16
+ export function decide(rule, attempt, outcome, leftMs) {
14
17
  if (rule === 'never' || outcome.kind === 'final' || attempt > MAX_RETRIES)
15
18
  return STOP;
16
19
  if (outcome.kind === 'answered' && !READ_STATUSES.has(outcome.status))
@@ -18,7 +21,7 @@ export function decide(rule, attempt, outcome, now, deadline) {
18
21
  const asked = outcome.kind === 'answered' ? parseRetryAfterMs(outcome.retryAfter) : undefined;
19
22
  // When the host names no wait: 500 ms, then 1 s. No jitter, so the decision stays pure.
20
23
  const ms = asked ?? (attempt === 1 ? 500 : 1000);
21
- return now + ms < deadline ? { kind: 'wait', ms } : STOP;
24
+ return ms < leftMs ? { kind: 'wait', ms } : STOP;
22
25
  }
23
26
  /**
24
27
  * The ceiling for a host's stated wait: a hostile or broken header must never park a caller for
@@ -1 +1 @@
1
- {"version":3,"file":"retry.js","sourceRoot":"","sources":["../../src/core/retry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAeH,oGAAoG;AACpG,MAAM,aAAa,GAAwB,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;AAC7E,MAAM,WAAW,GAAG,CAAC,CAAA;AACrB,MAAM,IAAI,GAAa,EAAE,IAAI,EAAE,MAAM,EAAE,CAAA;AAEvC;;;GAGG;AACH,MAAM,UAAU,MAAM,CAAC,IAAe,EAAE,OAAe,EAAE,OAAgB,EAAE,GAAW,EAAE,QAAgB;IACtG,IAAI,IAAI,KAAK,OAAO,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,IAAI,OAAO,GAAG,WAAW;QAAE,OAAO,IAAI,CAAA;IACtF,IAAI,OAAO,CAAC,IAAI,KAAK,UAAU,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC;QAAE,OAAO,IAAI,CAAA;IAClF,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,iBAAiB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAC7F,wFAAwF;IACxF,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC,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,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC;QAAE,OAAO,IAAI,CAAA;IAClF,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,iBAAiB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAC7F,wFAAwF;IACxF,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IAChD,OAAO,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AAClD,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,CAAA;AAE3C;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAqB;IACrD,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,SAAS,CAAA;IACrC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,EAAE,CAAA;IAC7B,OAAO,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,kBAAkB,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AACtG,CAAC"}
@@ -0,0 +1,20 @@
1
+ /** What a call's reads are sent with: the signal that ends them, and where each is recorded. */
2
+ export interface CallScope {
3
+ /** The call's own end, which each read also goes with (call()'s `callEnd`). Never a write's. */
4
+ readonly signal: AbortSignal;
5
+ /** `work`, a read or a write the call started, recorded in order; the same promise, returned. */
6
+ track<R>(work: Promise<R>): Promise<R>;
7
+ }
8
+ /**
9
+ * `run`'s answer, once every read and write it started (`scope.track`) has settled (#349).
10
+ * - A read still on its way when `run` answers or rejects is ended (`scope.signal`), and so is every
11
+ * read the moment any one rejects, even one `run` is waiting on, so a hanging read never holds the
12
+ * call to its deadline. An ended read answers `aborted` at once, as call() does. A write is never
13
+ * ended, even beside a read that rejects, only waited for: an ended write's outcome would be a lie,
14
+ * since it may still have been made.
15
+ * - A rejection is an exception, never a result: when any read or write rejected, the call rejects
16
+ * with the first in the order started, whatever `run` answered. Otherwise `run`'s own rejection,
17
+ * or its answer.
18
+ * The caller's own signal isn't the scope's: each read gets it beside the scope's (call()'s `signal`).
19
+ */
20
+ export declare function withReads<T>(run: (scope: CallScope) => Promise<T>): Promise<T>;
@@ -0,0 +1,54 @@
1
+ /*
2
+ * One SDK call's reads (#349): the call scope. Each read and write the call starts is recorded, in
3
+ * the order started, and each read goes under the call's own end as well as the caller's signal
4
+ * (call()'s `callEnd`, kept apart, so the scope never listens to the caller's signal), so the call
5
+ * answers, or rejects, with none still being waited on. A transport may keep running after its read
6
+ * was ended or timed out: call() lets it go (#57), and nothing waits for it.
7
+ */
8
+ /**
9
+ * `run`'s answer, once every read and write it started (`scope.track`) has settled (#349).
10
+ * - A read still on its way when `run` answers or rejects is ended (`scope.signal`), and so is every
11
+ * read the moment any one rejects, even one `run` is waiting on, so a hanging read never holds the
12
+ * call to its deadline. An ended read answers `aborted` at once, as call() does. A write is never
13
+ * ended, even beside a read that rejects, only waited for: an ended write's outcome would be a lie,
14
+ * since it may still have been made.
15
+ * - A rejection is an exception, never a result: when any read or write rejected, the call rejects
16
+ * with the first in the order started, whatever `run` answered. Otherwise `run`'s own rejection,
17
+ * or its answer.
18
+ * The caller's own signal isn't the scope's: each read gets it beside the scope's (call()'s `signal`).
19
+ */
20
+ export async function withReads(run) {
21
+ const end = new AbortController();
22
+ const ended = new DOMException('the call has ended', 'AbortError');
23
+ const started = [];
24
+ const scope = {
25
+ signal: end.signal,
26
+ track: (work) => {
27
+ started.push(work);
28
+ // Seen at once, so a rejection is never unhandled while the call goes on, and it ends the rest.
29
+ void work.catch(() => end.abort(ended));
30
+ return work;
31
+ },
32
+ };
33
+ let outcome;
34
+ try {
35
+ outcome = { ok: true, value: await run(scope) };
36
+ }
37
+ catch (error) {
38
+ outcome = { ok: false, error };
39
+ }
40
+ end.abort(ended);
41
+ // Every one, a read begun as the call ends included: it goes out ended, and answers at once.
42
+ for (let seen = 0; seen < started.length;) {
43
+ const batch = started.slice(seen);
44
+ seen = started.length;
45
+ await Promise.allSettled(batch);
46
+ }
47
+ const rejected = (await Promise.allSettled(started)).find((settled) => settled.status === 'rejected');
48
+ if (rejected !== undefined)
49
+ throw rejected.reason;
50
+ if (!outcome.ok)
51
+ throw outcome.error;
52
+ return outcome.value;
53
+ }
54
+ //# sourceMappingURL=scope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope.js","sourceRoot":"","sources":["../../src/core/scope.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAI,GAAqC;IACtE,MAAM,GAAG,GAAG,IAAI,eAAe,EAAE,CAAA;IACjC,MAAM,KAAK,GAAG,IAAI,YAAY,CAAC,oBAAoB,EAAE,YAAY,CAAC,CAAA;IAClE,MAAM,OAAO,GAAuB,EAAE,CAAA;IACtC,MAAM,KAAK,GAAc;QACvB,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE;YACd,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YAClB,gGAAgG;YAChG,KAAK,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;YACvC,OAAO,IAAI,CAAA;QACb,CAAC;KACF,CAAA;IACD,IAAI,OAAmG,CAAA;IACvG,IAAI,CAAC;QACH,OAAO,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,KAAK,CAAC,EAAE,CAAA;IACjD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;IAChC,CAAC;IACD,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IAChB,6FAA6F;IAC7F,KAAK,IAAI,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,GAAI,CAAC;QAC3C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QACjC,IAAI,GAAG,OAAO,CAAC,MAAM,CAAA;QACrB,MAAM,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;IACjC,CAAC;IACD,MAAM,QAAQ,GAAG,CAAC,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAoC,EAAE,CAAC,OAAO,CAAC,MAAM,KAAK,UAAU,CAAC,CAAA;IACvI,IAAI,QAAQ,KAAK,SAAS;QAAE,MAAM,QAAQ,CAAC,MAAM,CAAA;IACjD,IAAI,CAAC,OAAO,CAAC,EAAE;QAAE,MAAM,OAAO,CAAC,KAAK,CAAA;IACpC,OAAO,OAAO,CAAC,KAAK,CAAA;AACtB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { type Credential } from './api/credentials.js';
2
- import { type Dataset, type DatasetListRequest, type DatasetType } from './api/datasets.js';
2
+ import { type Dataset, type DatasetListRequest, type DatasetOrganizationListRequest, type DatasetType } from './api/datasets.js';
3
3
  import { type LogAddRequest, type LogEntry, type LogListRequest, type LogMemberListRequest, type LogUpdateRequest } from './api/log.js';
4
4
  import { type Me } from './api/me.js';
5
5
  import { type Member } from './api/members.js';
@@ -56,7 +56,11 @@ export interface Identification {
56
56
  readonly conversationId?: string;
57
57
  }
58
58
  export type FlipstreamOptions = Identification & (
59
- /** The console: its own transport, which attaches the token and decides what may go. */
59
+ /**
60
+ * The console: its own transport, which attaches the token and decides what may go. When it
61
+ * rejects, the call rejects once none of its reads is still waited on: its other reads are ended
62
+ * through their signal, and the rejection is the first to reject in the order started (#349).
63
+ */
60
64
  {
61
65
  readonly transport: Transport;
62
66
  readonly hosts?: Hosts;
@@ -84,7 +88,13 @@ export type FlipstreamOptions = Identification & (
84
88
  export interface CallOptions {
85
89
  /** Ends the call at once: its answer is `aborted`. */
86
90
  readonly signal?: AbortSignal;
87
- /** The whole call's deadline, every attempt and wait included; the endpoint's own when left out. */
91
+ /**
92
+ * The whole call's deadline, every attempt and wait included; the endpoint's own when left out
93
+ * or `null`. A number of ms up to 2147483647, the most a timer holds, taken in whole ms, rounded
94
+ * down. One that can't be a deadline (not a number, NaN, ±Infinity, or more than that once rounded
95
+ * down) is a TypeError naming the call, with nothing sent. A spent deadline, under 1 ms or one
96
+ * spent before a request goes out, answers `timeout`, and sends nothing (#339).
97
+ */
88
98
  readonly deadlineMs?: number;
89
99
  /**
90
100
  * This call's conversation, in place of the client's, under the same rule. One that breaks it
@@ -93,7 +103,7 @@ export interface CallOptions {
93
103
  readonly conversationId?: string;
94
104
  /**
95
105
  * The caller's own W3C trace context, carried on: the call keeps its trace-id and flags, with a
96
- * parent-id of its own for each attempt, and its result's `traceId` is that trace-id (#251). One
106
+ * parent-id of its own for each attempt, and its result's `trace_id` is that trace-id (#251). One
97
107
  * that isn't a valid version-00 traceparent is dropped, as W3C Trace Context says, and the call
98
108
  * starts its own trace.
99
109
  */
@@ -141,8 +151,10 @@ export interface Flipstream {
141
151
  };
142
152
  /**
143
153
  * Your organisation's workspaces (#208), through the admin API. Each call reads your organisation
144
- * first, for its id, under one deadline for both reads (the call's, or 30 s); its failure is the
145
- * answer. A workspace of another organisation is `invalid`, never dropped or shown.
154
+ * first, for its id, and a call under one workspace reads you beside it, all under one deadline
155
+ * (the call's, or 30 s); the first failure is the answer. A workspace of another organisation is
156
+ * `invalid`, never dropped or shown. A call under one workspace answers `not_found` for one you
157
+ * don't open, as for one nobody has: see "The workspaces you open" in docs/admin.md (#372).
146
158
  */
147
159
  readonly workspaces: {
148
160
  /**
@@ -151,10 +163,17 @@ export interface Flipstream {
151
163
  * backend's, by name alone (D550): pages read at different times can overlap or skip a
152
164
  * workspace when workspaces are added, removed or renamed in between, or when two share a name.
153
165
  * A changed `total` shows some of that; an unchanged one doesn't prove none happened. For a
154
- * complete, stable list, read it in one page, of up to 1,000.
166
+ * complete, stable list, read it in one page, of up to 1,000. The list isn't held to the
167
+ * workspaces you open (#372's round 1, O1.F1): the backend scopes it only for an account whose
168
+ * roles are exactly `['viewer']`, so another account the SDK holds to its workspaces (a role
169
+ * read as none, say) can list ones every other call answers `not_found` for.
155
170
  */
156
171
  list(request?: PageRequest, options?: CallOptions): Promise<ApiResult<Page<Workspace>>>;
157
- /** One workspace, by its id. An id that can't stay one path segment is `refused` (`path`), with nothing sent. */
172
+ /**
173
+ * One workspace, by its id. An id that can't stay one path segment is `refused` (`path`), with
174
+ * nothing sent. Your organisation and you are read first, so one you don't open is `not_found`,
175
+ * exactly as one nobody has, with nothing under it read.
176
+ */
158
177
  get(request: {
159
178
  readonly workspace_id: string;
160
179
  }, options?: CallOptions): Promise<ApiResult<Workspace>>;
@@ -176,7 +195,8 @@ export interface Flipstream {
176
195
  /**
177
196
  * A rename is a person's, in the console (D542): it answers `needs_person`, with why and, where
178
197
  * the console can be named, the workspace's settings page. It never writes, and the name isn't
179
- * sent: the person types it there. A workspace that isn't yours is `not_found`, never handed off.
198
+ * sent: the person types it there. A workspace that isn't yours, or that you don't open, is
199
+ * `not_found`, never handed off.
180
200
  */
181
201
  rename(request: {
182
202
  readonly workspace_id: string;
@@ -191,8 +211,10 @@ export interface Flipstream {
191
211
  }, options?: CallOptions): Promise<ApiResult<never>>;
192
212
  };
193
213
  /**
194
- * The logbook (#218, #295), on the admin host: a workspace's notes on time ranges, and one member's
195
- * entries across your organisation's workspaces.
214
+ * The logbook (#218, #295), on the admin host: a workspace's notes on time ranges, and one
215
+ * member's entries across your organisation's workspaces. A call under one workspace answers
216
+ * `not_found` for one you don't open, as for one nobody has: see "The workspaces you open" in
217
+ * docs/admin.md (#372).
196
218
  */
197
219
  readonly log: {
198
220
  /**
@@ -200,16 +222,16 @@ export interface Flipstream {
200
222
  * workspace of your organisation (`{ member_id }`, #295). Exactly one of the two: both, or neither,
201
223
  * rejects with a TypeError, with nothing sent.
202
224
  *
203
- * A workspace's entries come newest first by when they were written: the backend's
204
- * own order, since no other is asked for. When an entry was written never changes, so editing
205
- * one doesn't move it, but pages read at different times can overlap or skip an entry when one
206
- * is written or removed in between, and entries written at the same moment have no fixed order
207
- * among themselves. A changed `total` shows that something was added or removed; an unchanged
208
- * one doesn't prove nothing was. The workspace is read beside the list (#249), with your
209
- * organisation, under one deadline: one nobody has is `not_found`, and another organisation's is
210
- * `invalid`, never an empty page. An entry of another workspace or organisation makes the answer
211
- * `invalid`, never dropped. A limit or offset that isn't a whole number in range rejects, with
212
- * nothing sent, as every list's does.
225
+ * A workspace's entries come newest first by when they were written: the backend's own order,
226
+ * since no other is asked for. When an entry was written never changes, so editing one doesn't
227
+ * move it, but pages read at different times can overlap or skip an entry when one is written
228
+ * or removed in between, and entries written at the same moment have no fixed order among
229
+ * themselves. A changed `total` shows that something was added or removed; an unchanged one
230
+ * doesn't prove nothing was. Your organisation and you are read first, then the workspace
231
+ * beside the list (#249, #372), under one deadline: one nobody has, or one you don't open, is
232
+ * `not_found`, and another organisation's is `invalid`, never an empty page. An entry of
233
+ * another workspace or organisation makes the answer `invalid`, never dropped. A limit or
234
+ * offset that isn't a whole number in range rejects, with nothing sent, as every list's does.
213
235
  *
214
236
  * A member's: your organisation, you and the member are read first, under the same deadline. A
215
237
  * person who isn't a member, or a key, is `not_found`, and another organisation's member
@@ -220,8 +242,10 @@ export interface Flipstream {
220
242
  */
221
243
  list(request: LogListRequest | LogMemberListRequest, options?: CallOptions): Promise<ApiResult<Page<LogEntry>>>;
222
244
  /**
223
- * One entry, by its id, read beside your organisation (#249); `not_found` when there's none, and
224
- * `invalid` when the answer is another entry, or another organisation's.
245
+ * One entry, by its id, read beside your organisation and you (#249, #372); `not_found` when
246
+ * there's none, or it's in a workspace you don't open, and `invalid` when the answer is another
247
+ * entry, or another organisation's. A failure of the entry's own read is the backend's, as it
248
+ * answered.
225
249
  */
226
250
  get(request: {
227
251
  readonly log_id: string;
@@ -231,8 +255,9 @@ export interface Flipstream {
231
255
  * `refused` (`fields`, naming them), and a description that isn't a non-blank string, a time
232
256
  * not written as `2026-10-05T00:00:00Z` (a fraction may follow the seconds, and an offset such
233
257
  * as `+02:00`, or none, may take the place of the `Z`), or a start after the end rejects with a
234
- * TypeError. The workspace is read first: one nobody has is `not_found`, and another
235
- * organisation's `invalid`, with nothing written. Times go as UTC instants; one with no offset is
258
+ * TypeError. Your organisation and you are read first, then the workspace: one nobody has, or
259
+ * one you don't open, is `not_found`, and another organisation's `invalid`, with nothing
260
+ * written. Times go as UTC instants; one with no offset is
236
261
  * read as UTC. Who may write is the backend's rule, not the SDK's: Owners, Admins and Editors
237
262
  * add; an Editor changes or removes only their own entries, and Owners and Admins any. Until the
238
263
  * backend enforces it (pulse-admin#161, for Editors), a Viewer can also add, change and remove
@@ -243,44 +268,80 @@ export interface Flipstream {
243
268
  add(request: LogAddRequest, options?: CallOptions): Promise<ApiResult<LogEntry>>;
244
269
  /**
245
270
  * An entry's words or range changed (#219), with the same rules as `add`, and at least one
246
- * change. The entry is read first (one that isn't yours is `not_found` or `invalid`, with
247
- * nothing written), then sent back whole: what you change, and the rest exactly as stored. When
248
- * you give a time, a start after the end, the stored one included, rejects with a TypeError, with
249
- * nothing written. Since the whole entry goes back, a change someone else made between the read
250
- * and the write is overwritten.
271
+ * change. The entry is read first, as `get` reads it (one that isn't yours, or is in a
272
+ * workspace you don't open, is `not_found` or `invalid`, with nothing written), then sent back
273
+ * whole: what you change, and the rest exactly as stored. When you give a time, a start after
274
+ * the end, the stored one included, rejects with a TypeError, with nothing written. Since the
275
+ * whole entry goes back, a change someone else made between the read and the write is
276
+ * overwritten.
251
277
  */
252
278
  update(request: LogUpdateRequest, options?: CallOptions): Promise<ApiResult<LogEntry>>;
253
279
  /**
254
280
  * An entry removed (#219), directly: a log entry isn't one of the hand-offs. The entry is read
255
- * first (one that isn't yours is `not_found` or `invalid`, with nothing removed); an ok is
256
- * `null`.
281
+ * first, as `get` reads it (one that isn't yours, or is in a workspace you don't open, is
282
+ * `not_found` or `invalid`, with nothing removed); an ok is `null`.
257
283
  */
258
284
  remove(request: {
259
285
  readonly log_id: string;
260
286
  }, options?: CallOptions): Promise<ApiResult<null>>;
261
287
  };
262
288
  /**
263
- * A workspace's datasets (#211), on the admin host: its uploads and connected accounts, the
264
- * backend's connections. Each call reads your organisation beside the datasets, and a list reads
265
- * its workspace too, under one deadline for every read (the call's, or 30 s). The organisation's
266
- * failure, then the workspace's, then the datasets', is the answer, and a dataset of another
267
- * organisation is `invalid`, never dropped or shown. The backend's answers embed each dataset's
268
- * sign-in, so a body that isn't its JSON is never kept: a failure of the dataset's own read or
269
- * write has no `text` (#279). The organisation's and the workspace's reads keep theirs.
289
+ * A workspace's datasets (#211), or your organisation's (#342), on the admin host: uploads and
290
+ * connected accounts, the backend's connections. Each call reads your organisation and you, under
291
+ * one deadline for every read (the call's, or 30 s). A workspace's calls read those first, then
292
+ * the workspace beside its datasets, so the organisation's failure, then yours, then the
293
+ * workspace's, then the datasets', is the answer; a dataset by its id is read beside them. A
294
+ * dataset of another organisation is
295
+ * `invalid`, never dropped or shown. The backend's answers embed each dataset's sign-in, so a
296
+ * body that isn't its JSON is never kept: a failure of the dataset's own read or write has no
297
+ * `text` (#279). The organisation's and the workspace's reads keep theirs. A call under one
298
+ * workspace answers `not_found` for one you don't open, as for one nobody has: see "The
299
+ * workspaces you open" in docs/admin.md (#372).
270
300
  */
271
301
  readonly datasets: {
272
302
  /**
273
303
  * One page of the workspace's datasets: `limit` (100 when left out, at most 1,000) and `offset`
274
304
  * (0). A limit or offset that isn't a whole number in range rejects with a TypeError, with
275
- * nothing sent. The order is the backend's, by name alone (D550): pages read at different
276
- * times can overlap or skip a dataset when datasets are added, removed or renamed in between,
277
- * or when two share a name. A changed `total` shows some of that; an unchanged one doesn't
278
- * prove none happened. For a complete, stable list, read it in one page, of up to 1,000. A
279
- * dataset of another workspace makes the answer `invalid`, never dropped. A workspace nobody has
280
- * is `not_found`, and another organisation's is `invalid`, never an empty page.
305
+ * nothing sent. The order is the backend's, by name alone (D550): pages read at different times
306
+ * can overlap or skip a dataset when datasets are added, removed or renamed in between, or when
307
+ * two share a name. A changed `total` shows some of that; an unchanged one doesn't prove none
308
+ * happened. For a complete, stable list, read it in one page, of up to 1,000. A dataset of
309
+ * another workspace makes the answer `invalid`, never dropped. A workspace nobody has, or one
310
+ * you don't open, is `not_found`, and another organisation's is `invalid`, never an empty page.
311
+ *
312
+ * `{ organization: true }` instead of a workspace (#342): your organisation's datasets, in every
313
+ * workspace you open, paged and ordered as a workspace's are. Exactly one of `workspace_id` and
314
+ * `organization: true`: both, neither, or an `organization` that isn't `true` rejects with a
315
+ * TypeError, with nothing sent. Your organisation is read first, since its id names the route,
316
+ * and the list once it answers, with you read beside both: two round trips in a row, under the
317
+ * same deadline. No workspace is read. Every dataset must be your organisation's and in a
318
+ * workspace you open (if your account names workspaces, only those, unless you're an owner, an
319
+ * admin or an editor): any other makes the answer `invalid`, never dropped. The backend holds a
320
+ * viewer to their workspaces too; this is the second check. Your organisation's failure (an id
321
+ * that can't name the route among them), then yours, then the datasets', is the answer.
322
+ */
323
+ list(request: DatasetListRequest | DatasetOrganizationListRequest, options?: CallOptions): Promise<ApiResult<Page<Dataset>>>;
324
+ /**
325
+ * How many datasets the workspace has (#364): `{ count }`, from the backend's own count, the
326
+ * total of one page of one dataset, read as `list` reads a page. Of that dataset only its
327
+ * workspace and organisation are read, so one `list` would refuse for anything else can't lose
328
+ * the count, while one of another workspace or organisation, or a page whose count is smaller
329
+ * than it or above 0 with no dataset on it, is `invalid`. The workspace is read beside it, by
330
+ * `list`'s rules for it: a workspace nobody has, or one you don't open, is `not_found`, and
331
+ * another organisation's `invalid`, never a count of 0. The organisation's failure, then yours,
332
+ * then the workspace's, then the count's, is the answer. A `workspace_id` that isn't a string
333
+ * rejects with a TypeError, with nothing sent. A count across your organisation isn't here yet.
334
+ */
335
+ count(request: {
336
+ readonly workspace_id: string;
337
+ }, options?: CallOptions): Promise<ApiResult<{
338
+ readonly count: number;
339
+ }>>;
340
+ /**
341
+ * One dataset, by its id, read beside your organisation and you; `not_found` when there's none,
342
+ * or it's in a workspace you don't open, and `invalid` when the answer is another dataset. A
343
+ * failure of the dataset's own read is the backend's, as it answered.
281
344
  */
282
- list(request: DatasetListRequest, options?: CallOptions): Promise<ApiResult<Page<Dataset>>>;
283
- /** One dataset, by its id; `not_found` when there's none, and `invalid` when the answer is another dataset. */
284
345
  get(request: {
285
346
  readonly dataset_id: string;
286
347
  }, options?: CallOptions): Promise<ApiResult<Dataset>>;
@@ -288,16 +349,17 @@ export interface Flipstream {
288
349
  * Pauses a dataset (#212): the answer is the `Dataset`, `active` false. Pausing a paused one
289
350
  * sends the same write and answers the same. Before anything is sent, a key other than
290
351
  * `dataset_id` is `refused` (`fields`, naming them), and an id that isn't a string rejects with
291
- * a TypeError. The dataset is read first, fresh: one nobody has is `not_found`, and another
292
- * organisation's `invalid`, with nothing written. Then `active` alone is sent, so a rename made
293
- * meanwhile stays. The dataset is read fresh again after the write, and the answer is that read:
294
- * one whose `active` isn't the one asked for is `invalid`, since the write may not have been
352
+ * a TypeError. The dataset is read first, fresh, beside your organisation and you: one nobody
353
+ * has, or one in a workspace you don't open, is `not_found`, and another organisation's
354
+ * `invalid`, with nothing written. Then `active` alone is sent, so a rename made meanwhile
355
+ * stays. The dataset is read fresh again after the write, and the answer is that read: one
356
+ * whose `active` isn't the one asked for is `invalid`, since the write may not have been
295
357
  * stored. That read comes after the write was sent, so its failure that would say nothing was
296
- * written (a 4xx kind, `refused`, `no_token`) is `invalid` too, naming its kind. Who may is
297
- * the backend's rule: Owners, Admins and Editors pause and resume, and a Viewer doesn't. Anyone
298
- * it refuses gets `forbidden`. A write is never tried again: only a refusal (a 4xx kind),
299
- * `refused` or `no_token` shows nothing was written. After any other failure it may have been;
300
- * pausing again is safe, since it's the same write.
358
+ * written (a 4xx kind, `refused`, `no_token`) is `invalid` too, naming its kind, with that
359
+ * read's status when it had one. Who may is the backend's rule: Owners, Admins and Editors
360
+ * pause and resume, and a Viewer doesn't. Anyone it refuses gets `forbidden`. A write is never
361
+ * tried again: only a refusal (a 4xx kind), `refused` or `no_token` shows nothing was written.
362
+ * After any other failure it may have been; pausing again is safe, since it's the same write.
301
363
  */
302
364
  pause(request: {
303
365
  readonly dataset_id: string;
@@ -309,9 +371,9 @@ export interface Flipstream {
309
371
  /**
310
372
  * Deleting a dataset is a person's to do, in the console (D542, D546): it removes the dataset's
311
373
  * data for good, and the console can't delete one yet. Never a write: it reads the dataset (one
312
- * nobody has is `not_found`, and another organisation's `invalid`), then answers `needs_person`
313
- * with `why`, and the dataset's page as `url`, with what it shows as `sees`, where a console can
314
- * be named.
374
+ * nobody has, or one in a workspace you don't open, is `not_found`, and another organisation's
375
+ * `invalid`), then answers `needs_person` with `why`, and the dataset's page as `url`, with
376
+ * what it shows as `sees`, where a console can be named.
315
377
  */
316
378
  delete(request: {
317
379
  readonly dataset_id: string;
@@ -359,7 +421,8 @@ export interface Flipstream {
359
421
  * your organisation first, for the wallet's id, under one deadline for both reads; its failure is
360
422
  * the answer. Who may read it is the wallet's rule, not the SDK's: today Owners and Admins, and
361
423
  * Editors too once pulse-wallet#15 lands. Anyone the wallet refuses gets `forbidden`, never an
362
- * empty ledger. Amounts are integer micro, and each answer says how many make a euro.
424
+ * empty ledger. Both reads answer null when your organisation has no wallet (#374). Amounts are
425
+ * integer micro, and every answer that holds them says how many make a euro, in `micro_per_euro`.
363
426
  */
364
427
  readonly wallet: {
365
428
  /**
@@ -369,18 +432,22 @@ export interface Flipstream {
369
432
  */
370
433
  balance(options?: CallOptions): Promise<ApiResult<Balance | null>>;
371
434
  /**
372
- * Your whole ledger, in one answer, with no paging. Its rows carry no wallet id, so the balance
373
- * is read beside it, and the ledger is answered only when that is your organisation's wallet.
435
+ * Your whole ledger, in one answer, with no paging, or null when the organisation has no
436
+ * wallet, as `balance()` answers: a wallet with no rows is an empty ledger, never null. Its rows
437
+ * carry no wallet id, so the balance is read beside it, and the ledger is answered only when
438
+ * that is your organisation's wallet. The balance settles no wallet: null, even when the
439
+ * ledger can't be read, and a ledger row then is `invalid`, as is a ledger answer the SDK
440
+ * can't read, which may hold rows.
374
441
  */
375
- transactions(options?: CallOptions): Promise<ApiResult<Ledger>>;
442
+ transactions(options?: CallOptions): Promise<ApiResult<Ledger | null>>;
376
443
  };
377
444
  /**
378
- * Your organisation's people (#220), from the auth host, each as `me()` answers you: one role by
379
- * D544's rule, and `null` for none and for Flipstream's staff. People, not keys: an API user, a
380
- * service account, is never listed, counted or answered (`get` of one is `not_found`), as the
381
- * console's People has it. An open invitation is listed, with an empty `first_name`. Each call
382
- * reads your organisation beside them, under one deadline for both reads (the call's, or 30 s).
383
- * The organisation's failure, then the people's, is the answer, and a person of another
445
+ * Your organisation's people (#220), from the auth host, each as `me()` answers you, their roles
446
+ * as `Member`'s `role`, `roles` and `unknown_roles` say (D544, #297). People, not keys: an API
447
+ * user, a service account, is never listed, counted or answered (`get` of one is `not_found`), as
448
+ * the console's People has it. An open invitation is listed, with an empty `first_name`. Each
449
+ * call reads your organisation beside them, under one deadline for both reads (the call's, or
450
+ * 30 s). The organisation's failure, then the people's, is the answer, and a person of another
384
451
  * organisation is `invalid`, never dropped or shown.
385
452
  */
386
453
  readonly members: {