@flipstream/sdk 0.10.1 → 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 (94) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/README.md +98 -348
  3. package/dist/api/account.d.ts +50 -0
  4. package/dist/api/account.js +102 -0
  5. package/dist/api/account.js.map +1 -0
  6. package/dist/api/backend.d.ts +18 -0
  7. package/dist/api/backend.js +35 -4
  8. package/dist/api/backend.js.map +1 -1
  9. package/dist/api/created.d.ts +1 -1
  10. package/dist/api/created.js +3 -2
  11. package/dist/api/created.js.map +1 -1
  12. package/dist/api/credentials.js +4 -4
  13. package/dist/api/credentials.js.map +1 -1
  14. package/dist/api/datasets.d.ts +94 -14
  15. package/dist/api/datasets.js +210 -59
  16. package/dist/api/datasets.js.map +1 -1
  17. package/dist/api/index.d.ts +4 -3
  18. package/dist/api/log.d.ts +45 -24
  19. package/dist/api/log.js +113 -40
  20. package/dist/api/log.js.map +1 -1
  21. package/dist/api/me.d.ts +2 -0
  22. package/dist/api/me.js +9 -5
  23. package/dist/api/me.js.map +1 -1
  24. package/dist/api/members.d.ts +69 -7
  25. package/dist/api/members.js +110 -32
  26. package/dist/api/members.js.map +1 -1
  27. package/dist/api/time.js +4 -3
  28. package/dist/api/time.js.map +1 -1
  29. package/dist/api/wallet.d.ts +8 -5
  30. package/dist/api/wallet.js +36 -24
  31. package/dist/api/wallet.js.map +1 -1
  32. package/dist/api/workspaces.d.ts +42 -7
  33. package/dist/api/workspaces.js +80 -20
  34. package/dist/api/workspaces.js.map +1 -1
  35. package/dist/auth/discovery.d.ts +19 -6
  36. package/dist/auth/discovery.js +25 -4
  37. package/dist/auth/discovery.js.map +1 -1
  38. package/dist/auth/signIn.d.ts +18 -14
  39. package/dist/auth/signIn.js +29 -22
  40. package/dist/auth/signIn.js.map +1 -1
  41. package/dist/core/call.d.ts +4 -1
  42. package/dist/core/call.js +26 -6
  43. package/dist/core/call.js.map +1 -1
  44. package/dist/core/deadline.d.ts +30 -0
  45. package/dist/core/deadline.js +51 -0
  46. package/dist/core/deadline.js.map +1 -0
  47. package/dist/core/invalid.d.ts +7 -0
  48. package/dist/core/invalid.js +22 -0
  49. package/dist/core/invalid.js.map +1 -0
  50. package/dist/core/names.d.ts +31 -3
  51. package/dist/core/names.js +26 -6
  52. package/dist/core/names.js.map +1 -1
  53. package/dist/core/notFound.d.ts +8 -0
  54. package/dist/core/notFound.js +8 -0
  55. package/dist/core/notFound.js.map +1 -0
  56. package/dist/core/result.d.ts +17 -12
  57. package/dist/core/result.js +5 -5
  58. package/dist/core/result.js.map +1 -1
  59. package/dist/core/retry.d.ts +5 -2
  60. package/dist/core/retry.js +6 -3
  61. package/dist/core/retry.js.map +1 -1
  62. package/dist/core/scope.d.ts +20 -0
  63. package/dist/core/scope.js +54 -0
  64. package/dist/core/scope.js.map +1 -0
  65. package/dist/flipstream.d.ts +151 -70
  66. package/dist/flipstream.js +67 -45
  67. package/dist/flipstream.js.map +1 -1
  68. package/dist/node/clientSecret.js +5 -5
  69. package/dist/node/clientSecret.js.map +1 -1
  70. package/dist/node/headless.d.ts +14 -6
  71. package/dist/node/headless.js +8 -6
  72. package/dist/node/headless.js.map +1 -1
  73. package/dist/node/index.d.ts +1 -1
  74. package/dist/node/index.js +1 -1
  75. package/dist/node/index.js.map +1 -1
  76. package/dist/node/keychainChild.js +27 -10
  77. package/dist/node/keychainChild.js.map +1 -1
  78. package/dist/node/keychainError.d.ts +3 -3
  79. package/dist/node/keychainStore.d.ts +16 -12
  80. package/dist/node/keychainStore.js +50 -28
  81. package/dist/node/keychainStore.js.map +1 -1
  82. package/dist/node/loopback.d.ts +8 -1
  83. package/dist/node/loopback.js +19 -2
  84. package/dist/node/loopback.js.map +1 -1
  85. package/dist/node/session.d.ts +17 -9
  86. package/dist/node/session.js +55 -44
  87. package/dist/node/session.js.map +1 -1
  88. package/dist/node/store.d.ts +35 -2
  89. package/dist/node/store.js +56 -12
  90. package/dist/node/store.js.map +1 -1
  91. package/dist/version.gen.js +1 -1
  92. package/docs/admin.md +503 -0
  93. package/docs/node-sign-in.md +60 -35
  94. package/package.json +1 -1
package/dist/api/log.js CHANGED
@@ -1,12 +1,15 @@
1
1
  import { z } from 'zod';
2
+ import { invalidAnswer, invalidWith } from '../core/invalid.js';
3
+ import { notFound } from '../core/notFound.js';
2
4
  import { sameUuid } from './ids.js';
5
+ import { readUser } from './me.js';
6
+ import { getMember, heldToYou, opensWorkspace } from './members.js';
3
7
  import { createdById, createdOn } from './created.js';
4
8
  import { instant } from './time.js';
5
9
  import { unsent } from './unsent.js';
6
- import { readOwnWorkspace } from './workspaces.js';
10
+ import { readOwnWorkspace, readOwnWorkspaceWith } from './workspaces.js';
7
11
  const id = z.string().min(1);
8
12
  const refusedPath = { ok: false, error: { kind: 'refused', reason: 'path' } };
9
- const invalid = (issues) => ({ ok: false, error: { kind: 'invalid', issues } });
10
13
  // An entry as read or written, in our names (so client_id is workspace_id), with the organisation
11
14
  // it's in, so one of another organisation or workspace is caught (D556); the public LogEntry drops
12
15
  // it. An object schema keeps only the fields it names, so the rest pulse-admin sends (account_id and
@@ -58,68 +61,136 @@ function inOrder(call, start, end) {
58
61
  if (Date.parse(start) > Date.parse(end))
59
62
  throw new TypeError(`log.${call}: start_date must not be after end_date`);
60
63
  }
64
+ // pulse-admin's own 404 for an entry nobody has (dff6bf9b, domain/event_log/__init__.py:116-123): one
65
+ // in a workspace you don't open answers exactly this (D571, #372).
66
+ const noSuchEntry = () => notFound('EVENTLOG_NOT_FOUND', 'EventLog not found!');
61
67
  /**
62
- * The entry `log_id` names, read by `schema` beside your organisation (D556, D557): one of another
63
- * organisation, or an answer that isn't the entry asked for, is invalid, echoing no id. The
64
- * organisation's failure, then the entry's, is the answer. A write reads it as stored, and `get`
65
- * as a caller sees it.
68
+ * The entry `log_id` names, read by `schema` beside your organisation (D556, D557) and you
69
+ * (`readUser`): one of another organisation, or an answer that isn't the entry asked for, is
70
+ * invalid, echoing no id. One in a workspace you don't open (`opensWorkspace`, D560) is
71
+ * `not_found`, exactly as one nobody has, so a write after it sends nothing (D571, #372). The entry
72
+ * names its workspace only once read, so a failure of its own read is the backend's, passed on as
73
+ * it is. The organisation's failure, then the entry's, then yours, is the answer. A write reads it
74
+ * as stored, and `get` as a caller sees it.
66
75
  */
67
76
  async function readOwnEntry(seam, read, logId, schema) {
68
77
  const spec = seam.logEntry(logId, schema);
69
78
  if (spec === null)
70
79
  return refusedPath;
71
- const [organization, entry] = await Promise.all([read(seam.myOrganization(zOrganizationId)), read(spec)]);
80
+ const [organization, entry, you] = await Promise.all([read(seam.myOrganization(zOrganizationId)), read(spec), readUser(seam, read)]);
72
81
  if (!organization.ok)
73
82
  return organization;
74
83
  if (!entry.ok)
75
84
  return entry;
76
85
  if (!sameUuid(entry.data.id, logId))
77
- return invalid("the log entry read isn't the one asked for");
86
+ return invalidAnswer("the log entry read isn't the one asked for");
78
87
  if (!sameUuid(entry.data.organization_id, organization.data.id))
79
- return invalid("the log entry read is another organisation's");
88
+ return invalidAnswer("the log entry read is another organisation's");
89
+ if (!you.ok)
90
+ return you;
91
+ if (!opensWorkspace(you.data, entry.data.workspace_id))
92
+ return noSuchEntry();
80
93
  return entry;
81
94
  }
82
- /** A write's answer, held to the entry, the workspace and the organisation it was written for. */
83
- function checked(written, expected) {
95
+ /**
96
+ * A write's answer, held to the entry, the workspace and the organisation it was written for. What it
97
+ * finds is `invalid` with `status`, the route's success status by pulse-admin's code: the PUT's 200,
98
+ * or none for the POST's, whose isn't known (#368).
99
+ */
100
+ function checked(written, expected, status) {
84
101
  if (!written.ok)
85
102
  return written;
86
103
  if (expected.id !== undefined && !sameUuid(written.data.id, expected.id))
87
- return invalid("the log entry written isn't the one asked for");
104
+ return invalidWith("the log entry written isn't the one asked for", status);
88
105
  if (!sameUuid(written.data.workspace_id, expected.workspace_id))
89
- return invalid("the log entry written is another workspace's");
106
+ return invalidWith("the log entry written is another workspace's", status);
90
107
  if (!sameUuid(written.data.organization_id, expected.organization_id))
91
- return invalid("the log entry written is another organisation's");
108
+ return invalidWith("the log entry written is another organisation's", status);
92
109
  return { ok: true, data: publicOf(written.data) };
93
110
  }
94
111
  /**
95
- * `flipstream.log.list()`: one page of a workspace's logbook, in the backend's own order, newest
96
- * first (no sort is sent, D550). The workspace is read beside the list, by `readOwnWorkspace`'s
97
- * rules (D556, as amended), so one nobody has is `not_found` and another organisation's is invalid,
112
+ * `flipstream.log.list()`: exactly one of a workspace's logbook (`workspace_id`) and one member's
113
+ * entries (`member_id`, `listMemberLog`); both, or neither, is a TypeError, with nothing sent (#295).
114
+ *
115
+ * A workspace's: one page of its logbook, in the backend's own order, newest first (no sort is
116
+ * sent, D550). The workspace is read beside the list, by `readOwnWorkspaceWith`'s rules (D556, as
117
+ * amended; D571), once your organisation and you are read: one you don't open is `not_found` with
118
+ * no list asked for, one nobody has is `not_found` too, and another organisation's is invalid,
98
119
  * never an empty page. An entry of another workspace is invalid, naming its place; the caller's id
99
- * may be any form pulse-admin reads as the same UUID (sameUuid). An entry of another organisation is
100
- * invalid too, naming its place, never an id (D556). The organisation's failure, then the
101
- * workspace's, then the list's, is the answer, whichever finishes first. A bad limit or offset
102
- * throws, as every list's does.
120
+ * may be any form pulse-admin reads as the same UUID (sameUuid). An entry of another organisation
121
+ * is invalid too, naming its place, never an id (D556). The organisation's failure, then yours,
122
+ * then the workspace's, then the list's, is the answer, whichever finishes first. A bad limit or
123
+ * offset throws, as every list's does.
103
124
  */
104
125
  export async function listLog(seam, read, request) {
105
- const { workspace_id, ...page } = request;
126
+ const { workspace_id: workspace, member_id: member, ...page } = request;
127
+ const neither = 'log.list: give exactly one of workspace_id and member_id';
128
+ if (member !== undefined) {
129
+ if (workspace !== undefined)
130
+ throw new TypeError(neither);
131
+ return listMemberLog(seam, read, idOf('list', 'member_id', member), page);
132
+ }
133
+ if (workspace === undefined)
134
+ throw new TypeError(neither);
135
+ const workspace_id = idOf('list', 'workspace_id', workspace);
106
136
  const spec = seam.workspaceLog(workspace_id, page, zWritten, (entry) => sameUuid(entry.workspace_id, workspace_id));
107
137
  if (spec === null)
108
138
  return refusedPath;
109
- const [own, listed] = await Promise.all([readOwnWorkspace(seam, read, workspace_id, zOrganizationId), read(spec)]);
139
+ const own = await readOwnWorkspaceWith(seam, read, workspace_id, zOrganizationId, () => read(spec));
110
140
  if (!own.ok)
111
141
  return own;
142
+ const listed = own.data.alongside;
112
143
  if (!listed.ok)
113
144
  return listed;
114
145
  const foreign = listed.data.items.findIndex((entry) => !sameUuid(entry.organization_id, own.data.organization.id));
115
146
  if (foreign !== -1)
116
- return invalid(`records[${String(foreign)}] is another organisation's log entry`);
147
+ return invalidAnswer(`records[${String(foreign)}] is another organisation's log entry`);
117
148
  return { ok: true, data: { ...listed.data, items: listed.data.items.map(publicOf) } };
118
149
  }
119
150
  /**
120
- * `flipstream.log.get()`: one logbook entry, by its id, read beside your organisation (D556): an
151
+ * The `member_id` form of `flipstream.log.list()` (#295): one page of `GET /users/{id}/event-logs`, in
152
+ * the backend's own order (D550). Your organisation is read once; you (me()'s read, `readUser`) and
153
+ * the member (members.get's read and rules, against that organisation) beside it. A person who isn't
154
+ * a member, or a key, is `not_found`, and another organisation's member `invalid`, with no request
155
+ * for entries; once the member is proved, the entries are read alongside the rest of yours. Your
156
+ * organisation's failure, then yours, then the member's, then the entries', is the answer. An entry
157
+ * another person wrote, or whose writer the backend holds none of, is outside the list asked for
158
+ * (pageOf's check, naming its place); one of another organisation, or in a workspace you don't open
159
+ * (`workspacesOpenedBy`, D560), makes the page invalid too, naming its place. None is dropped, and no
160
+ * id is echoed. A bad limit or offset throws before anything is sent, as every list's does. A
161
+ * transport's rejection is the call's once no read is still waited on (the call scope, #349).
162
+ */
163
+ async function listMemberLog(seam, read, memberId, page) {
164
+ const spec = seam.memberLog(memberId, page, zWritten, (entry) => entry.created_by_id !== null && sameUuid(entry.created_by_id, memberId));
165
+ if (spec === null)
166
+ return refusedPath;
167
+ const organization = read(seam.myOrganization(zOrganizationId));
168
+ const caller = readUser(seam, read);
169
+ // Observed at once: a transport that rejects (the console brings its own) would otherwise leave
170
+ // your read's rejection unhandled while the member is read. It's still awaited, and thrown, below.
171
+ caller.catch(() => undefined);
172
+ const member = await getMember(seam, read, { member_id: memberId }, organization);
173
+ if (!member.ok) {
174
+ // No entries are asked for; your organisation's failure, then yours, still come first.
175
+ const [ours, you] = await Promise.all([organization, caller]);
176
+ return !ours.ok ? ours : !you.ok ? you : member;
177
+ }
178
+ // The member proved, the entries go beside the rest of your reads.
179
+ const [ours, you, listed] = await Promise.all([organization, caller, read(spec)]);
180
+ if (!ours.ok)
181
+ return ours;
182
+ if (!you.ok)
183
+ return you;
184
+ if (!listed.ok)
185
+ return listed;
186
+ const entries = listed.data.items;
187
+ return heldToYou(entries, ours.data.id, you.data, 'log entry') ?? { ok: true, data: { ...listed.data, items: entries.map(publicOf) } };
188
+ }
189
+ /**
190
+ * `flipstream.log.get()`: one logbook entry, by its id, by `readOwnEntry`'s rules (D556, D571): an
121
191
  * answer that isn't the entry asked for, or is another organisation's, is invalid, echoing no id,
122
- * as workspaces.get()'s is. The organisation's failure, then the entry's, is the answer.
192
+ * as workspaces.get()'s is, and one in a workspace you don't open is `not_found`. The
193
+ * organisation's failure, then the entry's, then yours, is the answer.
123
194
  */
124
195
  export async function getLog(seam, read, request) {
125
196
  const entry = await readOwnEntry(seam, read, request.log_id, zWritten);
@@ -129,9 +200,10 @@ export async function getLog(seam, read, request) {
129
200
  * `flipstream.log.add()`: a new entry in a workspace's logbook (#219), by D557's rules. Before
130
201
  * anything is sent, a key it doesn't send is `refused` (`fields`), and a description that isn't a
131
202
  * non-blank string, a time it can't read, or a start after the end is a TypeError. Then the
132
- * workspace is proved yours (`readOwnWorkspace`: one nobody has is `not_found`, another
133
- * organisation's `invalid`, with nothing written), and one POST sends the five fields, the times
134
- * as UTC instants. The answer is the entry made, held to that workspace and organisation.
203
+ * workspace is proved yours (`readOwnWorkspace`: one nobody has, or one you don't open, is
204
+ * `not_found`, another organisation's `invalid`, with nothing written), and one POST sends the five
205
+ * fields, the times as UTC instants. The answer is the entry made, held to that workspace and
206
+ * organisation.
135
207
  */
136
208
  export async function addLog(seam, send, request) {
137
209
  const refused = unsent(request, ['workspace_id', 'description', 'start_date', 'end_date']);
@@ -146,15 +218,16 @@ export async function addLog(seam, send, request) {
146
218
  if (!own.ok)
147
219
  return own;
148
220
  const entry = { description, start_date: start, end_date: end, organization_id: own.data.organization.id, workspace_id: own.data.workspace.id };
149
- return checked(await send(seam.addLogEntry(entry, zWritten)), entry);
221
+ return checked(await send(seam.addLogEntry(entry, zWritten)), entry, undefined);
150
222
  }
151
223
  /**
152
- * `flipstream.log.update()`: an entry's words or range changed (#219), by D557's rules: refused keys
153
- * and TypeErrors as `add()`'s, and at least one change. The entry is read first, beside your
154
- * organisation (`readOwnEntry`). Then one PUT sends the contract's five fields: the changed ones,
155
- * times as UTC instants, and the rest exactly as stored. When it gives a time, a start after the
156
- * end, the stored one included, is a TypeError, with nothing written. The answer is held to the
157
- * entry, its workspace and your organisation.
224
+ * `flipstream.log.update()`: an entry's words or range changed (#219), by D557's rules: refused
225
+ * keys and TypeErrors as `add()`'s, and at least one change. The entry is read first, by
226
+ * `readOwnEntry`'s rules, so one in a workspace you don't open is `not_found`, with nothing
227
+ * written. Then one PUT sends the contract's five fields: the changed ones, times as UTC instants,
228
+ * and the rest exactly as stored. When it gives a time, a start after the end, the stored one
229
+ * included, is a TypeError, with nothing written. The answer is held to the entry, its workspace
230
+ * and your organisation.
158
231
  */
159
232
  export async function updateLog(seam, send, request) {
160
233
  const refused = unsent(request, ['log_id', 'description', 'start_date', 'end_date']);
@@ -188,13 +261,13 @@ export async function updateLog(seam, send, request) {
188
261
  const spec = seam.updateLogEntry(was.id, entry, zWritten);
189
262
  if (spec === null)
190
263
  return refusedPath;
191
- return checked(await send(spec), { id: was.id, workspace_id: was.workspace_id, organization_id: was.organization_id });
264
+ return checked(await send(spec), { id: was.id, workspace_id: was.workspace_id, organization_id: was.organization_id }, 200);
192
265
  }
193
266
  /**
194
267
  * `flipstream.log.remove()`: an entry removed (#219), directly, not handed off: D542's hand-offs
195
- * are workspaces, datasets and members. A key it doesn't send is `refused`. The entry is read first,
196
- * beside your organisation (`readOwnEntry`), then one DELETE; its answer holds nothing, so an ok is
197
- * `null`.
268
+ * are workspaces, datasets and members. A key it doesn't send is `refused`. The entry is read
269
+ * first, by `readOwnEntry`'s rules, so one in a workspace you don't open is `not_found`, with
270
+ * nothing removed; then one DELETE; its answer holds nothing, so an ok is `null`.
198
271
  */
199
272
  export async function removeLog(seam, send, request) {
200
273
  const refused = unsent(request, ['log_id']);
@@ -1 +1 @@
1
- {"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/api/log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAEnC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAmDlD,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AAE5B,MAAM,WAAW,GAAqB,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAA;AAC/F,MAAM,OAAO,GAAG,CAAC,MAAc,EAAoB,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC,CAAA;AAEzG,kGAAkG;AAClG,mGAAmG;AACn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AAY,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;IAC7D,IAAI,CAAC,MAAM,CAAC,EAAE;QAAE,OAAO,MAAM,CAAA;IAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAA;IACnE,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,WAAW,CAAA;IACrC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,CAAA;IAChC,OAAO,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAA;AACxD,CAAC"}
package/dist/api/me.d.ts CHANGED
@@ -56,3 +56,5 @@ export type Read = <T>(spec: CallSpec<T>) => Promise<ApiResult<T>>;
56
56
  * The first failure, in that order whatever finishes first, is the answer.
57
57
  */
58
58
  export declare function readMe(seam: Backend, read: Read): Promise<ApiResult<Me>>;
59
+ /** You: the person userinfo names, read from pulse-auth, as me() reads you (and log.list({ member_id }), #295). */
60
+ export declare function readUser(seam: Backend, read: Read): Promise<ApiResult<Member>>;
package/dist/api/me.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { parseJson } from '../core/body.js';
3
+ import { invalidAnswer } from '../core/invalid.js';
4
+ import { sameUuid } from './ids.js';
3
5
  import { zMember } from './members.js';
4
6
  const id = z.string().min(1);
5
7
  // pulse-admin keeps billing in the organisation's `settings`, a JSON string
@@ -36,7 +38,6 @@ const zOrganization = z
36
38
  .object({ id, name: z.string(), slug: z.string(), settings: z.unknown().optional() })
37
39
  .transform(({ settings, ...organization }) => ({ ...organization, access: accessOf(settings) }));
38
40
  const zUserinfo = z.object({ sub: id });
39
- const invalid = (issues) => ({ ok: false, error: { kind: 'invalid', issues } });
40
41
  /**
41
42
  * `flipstream.me()`: the organisation, read beside userinfo, and then the person userinfo names.
42
43
  * The first failure, in that order whatever finishes first, is the answer.
@@ -49,16 +50,19 @@ export async function readMe(seam, read) {
49
50
  return user;
50
51
  return { ok: true, data: { organization: organization.data, user: user.data } };
51
52
  }
52
- async function readUser(seam, read) {
53
+ /** You: the person userinfo names, read from pulse-auth, as me() reads you (and log.list({ member_id }), #295). */
54
+ export async function readUser(seam, read) {
53
55
  const info = await read(seam.userinfo(zUserinfo));
54
56
  if (!info.ok)
55
57
  return info;
56
58
  const { sub } = info.data;
57
59
  const spec = seam.user(sub, zMember);
58
60
  if (spec === null)
59
- return invalid("userinfo's sub can't name a user");
61
+ return invalidAnswer("userinfo's sub can't name a user");
60
62
  const user = await read(spec);
61
- // A person other than the one the token names is someone else's account, never yours.
62
- return user.ok && user.data.id !== sub ? invalid("the user read isn't the one userinfo names") : user;
63
+ // A person other than the one the token names is someone else's account, never yours. pulse-auth
64
+ // reads `sub` in /users/{sub} as a UUID and answers its canonical form, so the two compare as
65
+ // UUIDs (sameUuid, #365's code review, 1).
66
+ return user.ok && !sameUuid(user.data.id, sub) ? invalidAnswer("the user read isn't the one userinfo names") : user;
63
67
  }
64
68
  //# sourceMappingURL=me.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"me.js","sourceRoot":"","sources":["../../src/api/me.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAI3C,OAAO,EAAE,OAAO,EAAe,MAAM,cAAc,CAAA;AAwCnD,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AAE5B,4EAA4E;AAC5E,6FAA6F;AAC7F,qGAAqG;AACrG,oGAAoG;AACpG,qCAAqC;AACrC,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,mBAAmB,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,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,IAAI,CAAA;IACzB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;IACpC,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,aAAa,CAAC,kCAAkC,CAAC,CAAA;IAC3E,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,CAAA;IAC7B,iGAAiG;IACjG,8FAA8F;IAC9F,2CAA2C;IAC3C,OAAO,IAAI,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,4CAA4C,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AACrH,CAAC"}
@@ -16,16 +16,47 @@ export interface Member {
16
16
  * (D544).
17
17
  */
18
18
  readonly role: Role | null;
19
+ /**
20
+ * Every role of ours they hold, ranked highest first, so `roles[0]` is `role` whenever they hold
21
+ * one (#297). Empty when they hold none of ours, and for Flipstream's staff whatever else they
22
+ * hold, as `role` is null for them (D544).
23
+ */
24
+ readonly roles: readonly Role[];
25
+ /**
26
+ * How many of the roles they hold aren't ours, never named: a role this version doesn't know, and
27
+ * pulse-auth's `user` and `client`, which it knows but reads as none of ours (#265, D559). An app
28
+ * can't act on a role it can't name, so it's counted, to say some weren't shown (#297). Each name
29
+ * counts once. Flipstream's staff roles are never counted or named: a staff member's other names
30
+ * that aren't ours count as anyone's do, so the count never sets them apart (D544).
31
+ */
32
+ readonly unknown_roles: number;
19
33
  /** Whether their account is switched on. */
20
34
  readonly active: boolean;
21
35
  /**
22
- * The workspaces their account names, as pulse-auth lists them. For a person whose only role is
23
- * viewer, they're the workspaces the viewer may open; a viewer with none opens every workspace of
24
- * the organisation. No other role is limited by them. (pulse-auth mints the token's clients from
25
- * them, at 0ae57c8, and pulse-admin limits only a viewer, and only by a list that isn't empty, at
26
- * dff6bf9b.)
36
+ * The workspaces their account names, as pulse-auth lists them. The backend limits only a person
37
+ * whose only role is viewer to these, and only when the list isn't empty: a viewer with none opens
38
+ * every workspace of the organisation. (pulse-auth mints the token's clients from them, at 0ae57c8,
39
+ * and pulse-admin limits by them, at dff6bf9b.) The SDK's own checks, such as
40
+ * `log.list({ member_id })`'s, also hold a person whose role it can't read to these, failing closed
41
+ * (D560).
27
42
  */
28
43
  readonly workspace_ids: readonly string[];
44
+ /**
45
+ * When pulse-auth made their account, an ISO 8601 instant in UTC (#294). For someone invited,
46
+ * that's when they were invited if the invitation made it, as an open invitation's was, or when
47
+ * they accepted if accepting did, as an invitation link's does (pulse-auth's accept registers the
48
+ * account: custom/domain/invitation/commands/accept.py at 0ae57c8b). Null when pulse-auth holds
49
+ * none, or holds one that isn't a time: unlike a dataset's or a log entry's, it
50
+ * never makes the answer invalid, since `me()`, `log.list({ member_id })` and every page of members
51
+ * read a person (#326's code review, 1).
52
+ */
53
+ readonly created_on: string | null;
54
+ /**
55
+ * Who made their account: a person's id (#294). Name them with `flipstream.members.get`; when it
56
+ * doesn't answer ok (see its docs), show the maker as unknown, for example for Flipstream's staff
57
+ * or another organisation's account. Null when pulse-auth holds none, or holds its empty default.
58
+ */
59
+ readonly created_by_id: string | null;
29
60
  }
30
61
  /** A person, as `flipstream.me()` answers its user: pulse-auth's user, in our names. */
31
62
  export declare const zMember: z.ZodType<Member>;
@@ -41,8 +72,39 @@ export declare function listMembers(seam: Backend, read: Read, page: PageRequest
41
72
  * `flipstream.members.get()`: one of your organisation's people, by their id. An answer that isn't
42
73
  * the person asked for, or is another organisation's, is invalid, echoing no id; an API user's is
43
74
  * `not_found`, as an id nobody has, whatever else its record holds. Only then is the person read.
44
- * The organisation's failure, then the person's, is the answer.
75
+ * Every invalid after the read keeps the response's status, 200.
76
+ * The organisation's failure, then the person's, is the answer. A caller that is reading your
77
+ * organisation already passes that read as `organization`, so it isn't read twice (#295); otherwise
78
+ * it's read here, and only once the path is known to be one, so a refused call sends nothing.
45
79
  */
46
80
  export declare function getMember(seam: Backend, read: Read, request: {
47
81
  readonly member_id: string;
48
- }): Promise<ApiResult<Member>>;
82
+ }, organization?: Promise<ApiResult<{
83
+ readonly id: string;
84
+ }>>): Promise<ApiResult<Member>>;
85
+ /**
86
+ * The workspaces `member` opens, by D560's rule, read so it fails closed: a person whose account
87
+ * names workspaces opens only those, unless their role is owner, admin or editor, which no list
88
+ * limits. A viewer is limited, and so is a role read as none (D559: pulse-auth's client-only role,
89
+ * or one this version doesn't know). An account that names none opens every workspace. Not exported
90
+ * from the package: `heldToYou` holds a page to the caller's (#295, #342).
91
+ */
92
+ export declare function workspacesOpenedBy(member: Member): readonly string[] | 'every';
93
+ /**
94
+ * Whether `you` open the workspace `workspaceId`, by `workspacesOpenedBy`'s rule (D560), the ids
95
+ * compared as UUIDs (sameUuid). The one check that a page held to you (`heldToYou`) and every call
96
+ * under one workspace (D571, #372) share, so the rule can't drift between them.
97
+ */
98
+ export declare function opensWorkspace(you: Member, workspaceId: string): boolean;
99
+ /**
100
+ * A page's `items` held to you (D556, D560): the first of another organisation than
101
+ * `organizationId`, then the first in a workspace `you` don't open (`workspacesOpenedBy`), is
102
+ * `invalid`, naming its place and never an id, with `noun` naming what the record is. Null when every
103
+ * one is yours to see. None is dropped. The one check that log.list({ member_id }) (#295) and
104
+ * datasets.list({ organization: true }) (#342) share, so the two can't drift apart (#342's code
105
+ * review, 7).
106
+ */
107
+ export declare function heldToYou(items: readonly {
108
+ readonly organization_id: string;
109
+ readonly workspace_id: string;
110
+ }[], organizationId: string, you: Member, noun: string): ApiResult<never> | null;