@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.
- package/CHANGELOG.md +44 -0
- package/README.md +48 -20
- package/dist/api/backend.d.ts +7 -0
- package/dist/api/backend.js +7 -0
- package/dist/api/backend.js.map +1 -1
- package/dist/api/credentials.js +4 -4
- package/dist/api/credentials.js.map +1 -1
- package/dist/api/datasets.js +30 -50
- package/dist/api/datasets.js.map +1 -1
- package/dist/api/handoff.d.ts +1 -1
- package/dist/api/handoff.js +7 -0
- package/dist/api/handoff.js.map +1 -1
- package/dist/api/log.d.ts +4 -4
- package/dist/api/log.js +23 -42
- package/dist/api/log.js.map +1 -1
- package/dist/api/me.d.ts +5 -3
- package/dist/api/me.js +3 -3
- package/dist/api/me.js.map +1 -1
- package/dist/api/members.d.ts +40 -17
- package/dist/api/members.js +66 -29
- package/dist/api/members.js.map +1 -1
- package/dist/api/ownRecord.d.ts +46 -0
- package/dist/api/ownRecord.js +57 -0
- package/dist/api/ownRecord.js.map +1 -0
- package/dist/api/refusal.d.ts +14 -0
- package/dist/api/refusal.js +23 -0
- package/dist/api/refusal.js.map +1 -0
- package/dist/api/wallet.d.ts +2 -1
- package/dist/api/wallet.js +18 -24
- package/dist/api/wallet.js.map +1 -1
- package/dist/api/workspaces.d.ts +7 -2
- package/dist/api/workspaces.js +14 -8
- package/dist/api/workspaces.js.map +1 -1
- package/dist/auth/discovery.js +4 -5
- package/dist/auth/discovery.js.map +1 -1
- package/dist/core/call.d.ts +5 -4
- package/dist/core/call.js +5 -7
- package/dist/core/call.js.map +1 -1
- package/dist/core/identify.d.ts +6 -0
- package/dist/core/identify.js +15 -7
- package/dist/core/identify.js.map +1 -1
- package/dist/core/inPlaceOf.d.ts +6 -0
- package/dist/core/inPlaceOf.js +17 -0
- package/dist/core/inPlaceOf.js.map +1 -0
- package/dist/core/invalid.d.ts +32 -9
- package/dist/core/invalid.js +36 -23
- package/dist/core/invalid.js.map +1 -1
- package/dist/core/notFound.d.ts +2 -2
- package/dist/core/notFound.js.map +1 -1
- package/dist/core/read.d.ts +4 -10
- package/dist/core/read.js +1 -11
- package/dist/core/read.js.map +1 -1
- package/dist/core/result.d.ts +13 -9
- package/dist/core/result.js +1 -0
- package/dist/core/result.js.map +1 -1
- package/dist/core/shared.d.ts +13 -9
- package/dist/core/shared.js +7 -6
- package/dist/core/shared.js.map +1 -1
- package/dist/flipstream.d.ts +81 -27
- package/dist/flipstream.js +37 -26
- package/dist/flipstream.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/node/keychainChild.js +60 -25
- package/dist/node/keychainChild.js.map +1 -1
- package/dist/node/keychainError.d.ts +4 -1
- package/dist/node/keychainError.js.map +1 -1
- package/dist/node/keychainStore.js +42 -8
- package/dist/node/keychainStore.js.map +1 -1
- package/dist/node/session.js +6 -7
- package/dist/node/session.js.map +1 -1
- package/dist/query/query.d.ts +52 -8
- package/dist/query/query.js +133 -19
- package/dist/query/query.js.map +1 -1
- package/dist/version.gen.js +1 -1
- package/docs/admin.md +53 -4
- package/docs/node-sign-in.md +8 -4
- package/package.json +1 -1
package/dist/api/log.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { invalidIn } from '../core/invalid.js';
|
|
3
3
|
import { notFound } from '../core/notFound.js';
|
|
4
4
|
import { sameUuid } from './ids.js';
|
|
5
5
|
import { readUser } from './me.js';
|
|
6
|
-
import { getMember, heldToYou
|
|
6
|
+
import { foreignRow, getMember, heldToYou } from './members.js';
|
|
7
7
|
import { createdById, createdOn } from './created.js';
|
|
8
8
|
import { instant } from './time.js';
|
|
9
|
+
import { readOwnRecord } from './ownRecord.js';
|
|
9
10
|
import { unsent } from './unsent.js';
|
|
10
11
|
import { readOwnWorkspace, readOwnWorkspaceWith } from './workspaces.js';
|
|
11
12
|
const id = z.string().min(1);
|
|
@@ -65,47 +66,31 @@ function inOrder(call, start, end) {
|
|
|
65
66
|
// in a workspace you don't open answers exactly this (D571, #372).
|
|
66
67
|
const noSuchEntry = () => notFound('EVENTLOG_NOT_FOUND', 'EventLog not found!');
|
|
67
68
|
/**
|
|
68
|
-
* The entry `log_id` names, read by `schema
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
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.
|
|
69
|
+
* The entry `log_id` names, read by `schema`, by `readOwnRecord`'s rules (D556, D557, #404). The
|
|
70
|
+
* answer is your organisation's failure, then yours, then the entry's, then its checks: another
|
|
71
|
+
* organisation's entry is `invalid`, and one in a workspace you don't open is `not_found`. A write
|
|
72
|
+
* reads it as stored, and `get` as a caller sees it.
|
|
75
73
|
*/
|
|
76
74
|
async function readOwnEntry(seam, read, logId, schema) {
|
|
77
75
|
const spec = seam.logEntry(logId, schema);
|
|
78
76
|
if (spec === null)
|
|
79
77
|
return refusedPath;
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
return organization;
|
|
83
|
-
if (!entry.ok)
|
|
84
|
-
return entry;
|
|
85
|
-
if (!sameUuid(entry.data.id, logId))
|
|
86
|
-
return invalidAnswer("the log entry read isn't the one asked for");
|
|
87
|
-
if (!sameUuid(entry.data.organization_id, organization.data.id))
|
|
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();
|
|
93
|
-
return entry;
|
|
78
|
+
const own = await readOwnRecord(seam, read, spec, logId, zOrganizationId, 'log entry', noSuchEntry);
|
|
79
|
+
return own.ok ? own.data.record : own;
|
|
94
80
|
}
|
|
95
81
|
/**
|
|
96
82
|
* A write's answer, held to the entry, the workspace and the organisation it was written for. What it
|
|
97
|
-
* finds is `invalid` with
|
|
98
|
-
* or none for the POST's, whose isn't known (#368).
|
|
83
|
+
* finds is `invalid` with the status that answer came with, the PUT's and the POST's alike (#385).
|
|
99
84
|
*/
|
|
100
|
-
function checked(written, expected
|
|
85
|
+
function checked(written, expected) {
|
|
101
86
|
if (!written.ok)
|
|
102
87
|
return written;
|
|
103
88
|
if (expected.id !== undefined && !sameUuid(written.data.id, expected.id))
|
|
104
|
-
return
|
|
89
|
+
return invalidIn(written, "the log entry written isn't the one asked for");
|
|
105
90
|
if (!sameUuid(written.data.workspace_id, expected.workspace_id))
|
|
106
|
-
return
|
|
91
|
+
return invalidIn(written, "the log entry written is another workspace's");
|
|
107
92
|
if (!sameUuid(written.data.organization_id, expected.organization_id))
|
|
108
|
-
return
|
|
93
|
+
return invalidIn(written, "the log entry written is another organisation's");
|
|
109
94
|
return { ok: true, data: publicOf(written.data) };
|
|
110
95
|
}
|
|
111
96
|
/**
|
|
@@ -142,10 +127,7 @@ export async function listLog(seam, read, request) {
|
|
|
142
127
|
const listed = own.data.alongside;
|
|
143
128
|
if (!listed.ok)
|
|
144
129
|
return listed;
|
|
145
|
-
|
|
146
|
-
if (foreign !== -1)
|
|
147
|
-
return invalidAnswer(`records[${String(foreign)}] is another organisation's log entry`);
|
|
148
|
-
return { ok: true, data: { ...listed.data, items: listed.data.items.map(publicOf) } };
|
|
130
|
+
return foreignRow(listed, own.data.organization.id, 'log entry') ?? { ok: true, data: { ...listed.data, items: listed.data.items.map(publicOf) } };
|
|
149
131
|
}
|
|
150
132
|
/**
|
|
151
133
|
* The `member_id` form of `flipstream.log.list()` (#295): one page of `GET /users/{id}/event-logs`, in
|
|
@@ -169,7 +151,7 @@ async function listMemberLog(seam, read, memberId, page) {
|
|
|
169
151
|
// Observed at once: a transport that rejects (the console brings its own) would otherwise leave
|
|
170
152
|
// your read's rejection unhandled while the member is read. It's still awaited, and thrown, below.
|
|
171
153
|
caller.catch(() => undefined);
|
|
172
|
-
const member = await getMember(seam, read, { member_id: memberId }, organization);
|
|
154
|
+
const member = await getMember(seam, read, { member_id: memberId }, () => organization);
|
|
173
155
|
if (!member.ok) {
|
|
174
156
|
// No entries are asked for; your organisation's failure, then yours, still come first.
|
|
175
157
|
const [ours, you] = await Promise.all([organization, caller]);
|
|
@@ -183,14 +165,13 @@ async function listMemberLog(seam, read, memberId, page) {
|
|
|
183
165
|
return you;
|
|
184
166
|
if (!listed.ok)
|
|
185
167
|
return listed;
|
|
186
|
-
|
|
187
|
-
return heldToYou(entries, ours.data.id, you.data, 'log entry') ?? { ok: true, data: { ...listed.data, items: entries.map(publicOf) } };
|
|
168
|
+
return heldToYou(listed, ours.data.id, you.data, 'log entry') ?? { ok: true, data: { ...listed.data, items: listed.data.items.map(publicOf) } };
|
|
188
169
|
}
|
|
189
170
|
/**
|
|
190
|
-
* `flipstream.log.get()`: one logbook entry, by its id, by `readOwnEntry`'s rules (D556, D571)
|
|
191
|
-
* answer
|
|
192
|
-
*
|
|
193
|
-
*
|
|
171
|
+
* `flipstream.log.get()`: one logbook entry, by its id, by `readOwnEntry`'s rules (D556, D571). The
|
|
172
|
+
* answer is your organisation's failure, then yours, then the entry's, then its checks: another
|
|
173
|
+
* organisation's entry is `invalid`, and one in a workspace you don't open is `not_found` (#404). An
|
|
174
|
+
* answer that isn't the entry asked for is `invalid` too, echoing no id, as workspaces.get()'s is.
|
|
194
175
|
*/
|
|
195
176
|
export async function getLog(seam, read, request) {
|
|
196
177
|
const entry = await readOwnEntry(seam, read, request.log_id, zWritten);
|
|
@@ -218,7 +199,7 @@ export async function addLog(seam, send, request) {
|
|
|
218
199
|
if (!own.ok)
|
|
219
200
|
return own;
|
|
220
201
|
const entry = { description, start_date: start, end_date: end, organization_id: own.data.organization.id, workspace_id: own.data.workspace.id };
|
|
221
|
-
return checked(await send(seam.addLogEntry(entry, zWritten)), entry
|
|
202
|
+
return checked(await send(seam.addLogEntry(entry, zWritten)), entry);
|
|
222
203
|
}
|
|
223
204
|
/**
|
|
224
205
|
* `flipstream.log.update()`: an entry's words or range changed (#219), by D557's rules: refused
|
|
@@ -261,7 +242,7 @@ export async function updateLog(seam, send, request) {
|
|
|
261
242
|
const spec = seam.updateLogEntry(was.id, entry, zWritten);
|
|
262
243
|
if (spec === null)
|
|
263
244
|
return refusedPath;
|
|
264
|
-
return checked(await send(spec), { id: was.id, workspace_id: was.workspace_id, organization_id: was.organization_id }
|
|
245
|
+
return checked(await send(spec), { id: was.id, workspace_id: was.workspace_id, organization_id: was.organization_id });
|
|
265
246
|
}
|
|
266
247
|
/**
|
|
267
248
|
* `flipstream.log.remove()`: an entry removed (#219), directly, not handed off: D542's hand-offs
|
package/dist/api/log.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/api/log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAI9C,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAa,MAAM,SAAS,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AACnE,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,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAkExE,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AAE5B,MAA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EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAA;AACxD,CAAC"}
|
package/dist/api/me.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CallSpec } from '../core/call.js';
|
|
2
|
+
import { type HeardResult } from '../core/invalid.js';
|
|
2
3
|
import type { ApiResult } from '../core/result.js';
|
|
3
4
|
import type { Backend } from './backend.js';
|
|
4
5
|
import { type Member } from './members.js';
|
|
@@ -48,13 +49,14 @@ export type OrganizationAccess =
|
|
|
48
49
|
};
|
|
49
50
|
/**
|
|
50
51
|
* One call through the client, under what is left of the call's deadline, and its signal: each
|
|
51
|
-
* read, and `workspaces.create()`'s one write.
|
|
52
|
+
* read, and `workspaces.create()`'s one write. Its answer is `Heard`, as readParsed made it
|
|
53
|
+
* (#394), so a check of it can take its status (`invalidIn`); one rebuilt from its data isn't.
|
|
52
54
|
*/
|
|
53
|
-
export type Read = <T>(spec: CallSpec<T>) => Promise<
|
|
55
|
+
export type Read = <T>(spec: CallSpec<T>) => Promise<HeardResult<T>>;
|
|
54
56
|
/**
|
|
55
57
|
* `flipstream.me()`: the organisation, read beside userinfo, and then the person userinfo names.
|
|
56
58
|
* The first failure, in that order whatever finishes first, is the answer.
|
|
57
59
|
*/
|
|
58
60
|
export declare function readMe(seam: Backend, read: Read): Promise<ApiResult<Me>>;
|
|
59
61
|
/** 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<
|
|
62
|
+
export declare function readUser(seam: Backend, read: Read): Promise<HeardResult<Member>>;
|
package/dist/api/me.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { parseJson } from '../core/body.js';
|
|
3
|
-
import {
|
|
3
|
+
import { invalidIn } from '../core/invalid.js';
|
|
4
4
|
import { sameUuid } from './ids.js';
|
|
5
5
|
import { zMember } from './members.js';
|
|
6
6
|
const id = z.string().min(1);
|
|
@@ -59,11 +59,11 @@ export async function readUser(seam, read) {
|
|
|
59
59
|
// You, shared inside a scope (#376), as your organisation and userinfo are; another member's read isn't.
|
|
60
60
|
const spec = seam.you(sub, zMember);
|
|
61
61
|
if (spec === null)
|
|
62
|
-
return
|
|
62
|
+
return invalidIn(info, "userinfo's sub can't name a user");
|
|
63
63
|
const user = await read(spec);
|
|
64
64
|
// A person other than the one the token names is someone else's account, never yours. pulse-auth
|
|
65
65
|
// reads `sub` in /users/{sub} as a UUID and answers its canonical form, so the two compare as
|
|
66
66
|
// UUIDs (sameUuid, #365's code review, 1).
|
|
67
|
-
return user.ok && !sameUuid(user.data.id, sub) ?
|
|
67
|
+
return user.ok && !sameUuid(user.data.id, sub) ? invalidIn(user, "the user read isn't the one userinfo names") : user;
|
|
68
68
|
}
|
|
69
69
|
//# sourceMappingURL=me.js.map
|
package/dist/api/me.js.map
CHANGED
|
@@ -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;AAE3C,OAAO,EAAE,
|
|
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;AAE3C,OAAO,EAAE,SAAS,EAAoB,MAAM,oBAAoB,CAAA;AAGhE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,EAAE,OAAO,EAAe,MAAM,cAAc,CAAA;AAwCnD,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AAE5B,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,CAAC,IAAa,EAAE,IAAU;IACtD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAA;IACjD,IAAI,CAAC,IAAI,CAAC,EAAE;QAAE,OAAO,IAAI,CAAA;IACzB,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,IAAI,CAAA;IACzB,yGAAyG;IACzG,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;IACnC,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC,IAAI,EAAE,kCAAkC,CAAC,CAAA;IAC7E,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,SAAS,CAAC,IAAI,EAAE,4CAA4C,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AACvH,CAAC"}
|
package/dist/api/members.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { type Heard, type HeardResult } from '../core/invalid.js';
|
|
2
3
|
import { type Role } from '../core/names.js';
|
|
3
4
|
import type { ApiResult } from '../core/result.js';
|
|
4
5
|
import type { Backend } from './backend.js';
|
|
@@ -69,19 +70,27 @@ export declare const zMember: z.ZodType<Member>;
|
|
|
69
70
|
*/
|
|
70
71
|
export declare function listMembers(seam: Backend, read: Read, page: PageRequest): Promise<ApiResult<Page<Member>>>;
|
|
71
72
|
/**
|
|
72
|
-
* `flipstream.members.get()`: one of your organisation's people, by their id
|
|
73
|
-
*
|
|
74
|
-
*
|
|
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.
|
|
73
|
+
* `flipstream.members.get()`: one of your organisation's people, by their id, by `readMember`'s
|
|
74
|
+
* rules. A caller that is reading your organisation already passes that read as `organization`, so
|
|
75
|
+
* it isn't read twice (#295).
|
|
79
76
|
*/
|
|
80
77
|
export declare function getMember(seam: Backend, read: Read, request: {
|
|
81
78
|
readonly member_id: string;
|
|
82
|
-
}, organization?: Promise<
|
|
79
|
+
}, organization?: () => Promise<HeardResult<{
|
|
83
80
|
readonly id: string;
|
|
84
81
|
}>>): Promise<ApiResult<Member>>;
|
|
82
|
+
/**
|
|
83
|
+
* `flipstream.members.remove()`: a D542 hand-off, as `datasets.delete` is. The person is read by
|
|
84
|
+
* `readMember`'s rules, with your organisation read for its short name too: your organisation's
|
|
85
|
+
* failure, then the person's, is the answer, so one nobody has, one your role can't read or an API
|
|
86
|
+
* key is `not_found`, a refused read is `forbidden`, and another organisation's person is
|
|
87
|
+
* `invalid`. A path that can't stay one segment is refused before anything is read. Only then
|
|
88
|
+
* `needs_person`, never a write (no call sends `DELETE /users/{id}`), with the person's page in the
|
|
89
|
+
* console where one can be named.
|
|
90
|
+
*/
|
|
91
|
+
export declare function handOffMemberRemove(seam: Backend, read: Read, request: {
|
|
92
|
+
readonly member_id: string;
|
|
93
|
+
}): Promise<ApiResult<never>>;
|
|
85
94
|
/**
|
|
86
95
|
* The workspaces `member` opens, by D560's rule, read so it fails closed: a person whose account
|
|
87
96
|
* names workspaces opens only those, unless their role is owner, admin or editor, which no list
|
|
@@ -96,15 +105,29 @@ export declare function workspacesOpenedBy(member: Member): readonly string[] |
|
|
|
96
105
|
* under one workspace (D571, #372) share, so the rule can't drift between them.
|
|
97
106
|
*/
|
|
98
107
|
export declare function opensWorkspace(you: Member, workspaceId: string): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* A page's first row of another organisation than `organizationId` (D556), as `invalid` naming its
|
|
110
|
+
* place, never an id, with `noun` naming what the row is, and the status the page's answer came with
|
|
111
|
+
* (#385); null when every row is your organisation's. None is dropped. The one check every page held
|
|
112
|
+
* to your organisation makes: your members, a workspace's datasets, their count and its logbook, and
|
|
113
|
+
* `heldToYou`'s first (#385's code review, 5).
|
|
114
|
+
*/
|
|
115
|
+
export declare function foreignRow(page: Heard<{
|
|
116
|
+
readonly items: readonly {
|
|
117
|
+
readonly organization_id: string;
|
|
118
|
+
}[];
|
|
119
|
+
}>, organizationId: string, noun: string): ApiResult<never> | null;
|
|
99
120
|
/**
|
|
100
121
|
* A page's `items` held to you (D556, D560): the first of another organisation than
|
|
101
|
-
* `organizationId
|
|
102
|
-
* `invalid`, naming its place and never an id, with `noun` naming what the
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* review, 7).
|
|
122
|
+
* `organizationId` (`foreignRow`), then the first in a workspace `you` don't open
|
|
123
|
+
* (`workspacesOpenedBy`), is `invalid`, naming its place and never an id, with `noun` naming what the
|
|
124
|
+
* record is, and the status the page's answer came with (#385). Null when every one is yours to see.
|
|
125
|
+
* None is dropped. The one check that log.list({ member_id }) (#295) and datasets.list({
|
|
126
|
+
* organization: true }) (#342) share, so the two can't drift apart (#342's code review, 7).
|
|
106
127
|
*/
|
|
107
|
-
export declare function heldToYou(
|
|
108
|
-
readonly
|
|
109
|
-
|
|
110
|
-
|
|
128
|
+
export declare function heldToYou(page: Heard<{
|
|
129
|
+
readonly items: readonly {
|
|
130
|
+
readonly organization_id: string;
|
|
131
|
+
readonly workspace_id: string;
|
|
132
|
+
}[];
|
|
133
|
+
}>, organizationId: string, you: Member, noun: string): ApiResult<never> | null;
|
package/dist/api/members.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { invalidIn } from '../core/invalid.js';
|
|
3
3
|
import { notFound } from '../core/notFound.js';
|
|
4
4
|
import { RANKED, roleFromBackend } from '../core/names.js';
|
|
5
5
|
import { createdById } from './created.js';
|
|
6
|
+
import { needsPerson, zHandOffOrganization } from './handoff.js';
|
|
6
7
|
import { sameUuid } from './ids.js';
|
|
7
8
|
import { instant } from './time.js';
|
|
8
9
|
const id = z.string().min(1);
|
|
@@ -103,28 +104,38 @@ export async function listMembers(seam, read, page) {
|
|
|
103
104
|
return organization;
|
|
104
105
|
if (!listed.ok)
|
|
105
106
|
return listed;
|
|
106
|
-
const foreign = listed
|
|
107
|
-
if (foreign !==
|
|
108
|
-
return
|
|
107
|
+
const foreign = foreignRow(listed, organization.data.id, 'member');
|
|
108
|
+
if (foreign !== null)
|
|
109
|
+
return foreign;
|
|
109
110
|
const key = listed.data.items.findIndex((member) => member.is_api_user);
|
|
110
111
|
if (key !== -1)
|
|
111
|
-
return
|
|
112
|
+
return invalidIn(listed, `records[${String(key)}] is an API user, not a person`);
|
|
112
113
|
return { ok: true, data: { ...listed.data, items: listed.data.items.map(publicOf) } };
|
|
113
114
|
}
|
|
114
115
|
/**
|
|
115
|
-
* `flipstream.members.get()`: one of your organisation's people, by their id
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
* Every invalid after the read keeps the response's status, 200.
|
|
119
|
-
* The organisation's failure, then the person's, is the answer. A caller that is reading your
|
|
120
|
-
* organisation already passes that read as `organization`, so it isn't read twice (#295); otherwise
|
|
121
|
-
* it's read here, and only once the path is known to be one, so a refused call sends nothing.
|
|
116
|
+
* `flipstream.members.get()`: one of your organisation's people, by their id, by `readMember`'s
|
|
117
|
+
* rules. A caller that is reading your organisation already passes that read as `organization`, so
|
|
118
|
+
* it isn't read twice (#295).
|
|
122
119
|
*/
|
|
123
|
-
export async function getMember(seam, read, request, organization) {
|
|
120
|
+
export async function getMember(seam, read, request, organization = () => read(seam.myOrganization(zOrganizationId))) {
|
|
121
|
+
const found = await readMember(seam, read, request, organization);
|
|
122
|
+
return found.ok ? { ok: true, data: found.data.member } : found;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* One of your organisation's people, by their id, with your organisation as `organization` reads
|
|
126
|
+
* it. `organization` is a function, called only once the id is known to be one path segment, so a
|
|
127
|
+
* refused id asks no token, hands no transport a request and starts no shared read, whoever the
|
|
128
|
+
* caller is (#415's code review, 1 to 4). An answer that isn't the person asked for, or is another
|
|
129
|
+
* organisation's, is invalid, echoing no id; an API user's is `not_found`, as an id nobody has,
|
|
130
|
+
* whatever else its record holds. Only then is the person read. Every invalid after the read keeps
|
|
131
|
+
* the status the person's answer came with (#385). The organisation's failure, then the person's,
|
|
132
|
+
* is the answer.
|
|
133
|
+
*/
|
|
134
|
+
async function readMember(seam, read, request, organization) {
|
|
124
135
|
const spec = seam.user(request.member_id, zWho);
|
|
125
136
|
if (spec === null)
|
|
126
137
|
return { ok: false, error: { kind: 'refused', reason: 'path' } };
|
|
127
|
-
const [ours, who] = await Promise.all([organization
|
|
138
|
+
const [ours, who] = await Promise.all([organization(), read(spec)]);
|
|
128
139
|
if (!ours.ok)
|
|
129
140
|
return ours;
|
|
130
141
|
if (!who.ok)
|
|
@@ -132,15 +143,30 @@ export async function getMember(seam, read, request, organization) {
|
|
|
132
143
|
const whose = zWhose.safeParse(who.data);
|
|
133
144
|
// A key is not_found even when whose it is can't be read, as an id nobody has (#367's code review, 8).
|
|
134
145
|
if (!whose.success)
|
|
135
|
-
return who.data.is_api_user ? noSuchMember() :
|
|
146
|
+
return who.data.is_api_user ? noSuchMember() : invalidIn(who, z.prettifyError(whose.error));
|
|
136
147
|
if (!sameUuid(whose.data.id, request.member_id))
|
|
137
|
-
return
|
|
148
|
+
return invalidIn(who, "the member read isn't the one asked for");
|
|
138
149
|
if (!sameUuid(whose.data.organization_id, ours.data.id))
|
|
139
|
-
return
|
|
150
|
+
return invalidIn(who, "the member read is another organisation's");
|
|
140
151
|
if (who.data.is_api_user)
|
|
141
152
|
return noSuchMember();
|
|
142
153
|
const person = zRecord.safeParse(who.data);
|
|
143
|
-
return person.success ? { ok: true, data: publicOf(person.data) } :
|
|
154
|
+
return person.success ? { ok: true, data: { member: publicOf(person.data), organization: ours.data } } : invalidIn(who, z.prettifyError(person.error));
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* `flipstream.members.remove()`: a D542 hand-off, as `datasets.delete` is. The person is read by
|
|
158
|
+
* `readMember`'s rules, with your organisation read for its short name too: your organisation's
|
|
159
|
+
* failure, then the person's, is the answer, so one nobody has, one your role can't read or an API
|
|
160
|
+
* key is `not_found`, a refused read is `forbidden`, and another organisation's person is
|
|
161
|
+
* `invalid`. A path that can't stay one segment is refused before anything is read. Only then
|
|
162
|
+
* `needs_person`, never a write (no call sends `DELETE /users/{id}`), with the person's page in the
|
|
163
|
+
* console where one can be named.
|
|
164
|
+
*/
|
|
165
|
+
export async function handOffMemberRemove(seam, read, request) {
|
|
166
|
+
const member = await readMember(seam, read, request, () => read(seam.myOrganization(zHandOffOrganization)));
|
|
167
|
+
if (!member.ok)
|
|
168
|
+
return member;
|
|
169
|
+
return needsPerson('member.remove', seam.memberPage(member.data.organization.slug, member.data.member.id));
|
|
144
170
|
}
|
|
145
171
|
/**
|
|
146
172
|
* The workspaces `member` opens, by D560's rule, read so it fails closed: a person whose account
|
|
@@ -162,19 +188,30 @@ export function opensWorkspace(you, workspaceId) {
|
|
|
162
188
|
const opens = workspacesOpenedBy(you);
|
|
163
189
|
return opens === 'every' || opens.some((id) => sameUuid(id, workspaceId));
|
|
164
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* A page's first row of another organisation than `organizationId` (D556), as `invalid` naming its
|
|
193
|
+
* place, never an id, with `noun` naming what the row is, and the status the page's answer came with
|
|
194
|
+
* (#385); null when every row is your organisation's. None is dropped. The one check every page held
|
|
195
|
+
* to your organisation makes: your members, a workspace's datasets, their count and its logbook, and
|
|
196
|
+
* `heldToYou`'s first (#385's code review, 5).
|
|
197
|
+
*/
|
|
198
|
+
export function foreignRow(page, organizationId, noun) {
|
|
199
|
+
const at = page.data.items.findIndex((row) => !sameUuid(row.organization_id, organizationId));
|
|
200
|
+
return at === -1 ? null : invalidIn(page, `records[${String(at)}] is another organisation's ${noun}`);
|
|
201
|
+
}
|
|
165
202
|
/**
|
|
166
203
|
* A page's `items` held to you (D556, D560): the first of another organisation than
|
|
167
|
-
* `organizationId
|
|
168
|
-
* `invalid`, naming its place and never an id, with `noun` naming what the
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
* review, 7).
|
|
204
|
+
* `organizationId` (`foreignRow`), then the first in a workspace `you` don't open
|
|
205
|
+
* (`workspacesOpenedBy`), is `invalid`, naming its place and never an id, with `noun` naming what the
|
|
206
|
+
* record is, and the status the page's answer came with (#385). Null when every one is yours to see.
|
|
207
|
+
* None is dropped. The one check that log.list({ member_id }) (#295) and datasets.list({
|
|
208
|
+
* organization: true }) (#342) share, so the two can't drift apart (#342's code review, 7).
|
|
172
209
|
*/
|
|
173
|
-
export function heldToYou(
|
|
174
|
-
const foreign =
|
|
175
|
-
if (foreign !==
|
|
176
|
-
return
|
|
177
|
-
const closed = items.findIndex((item) => !opensWorkspace(you, item.workspace_id));
|
|
178
|
-
return closed === -1 ? null :
|
|
210
|
+
export function heldToYou(page, organizationId, you, noun) {
|
|
211
|
+
const foreign = foreignRow(page, organizationId, noun);
|
|
212
|
+
if (foreign !== null)
|
|
213
|
+
return foreign;
|
|
214
|
+
const closed = page.data.items.findIndex((item) => !opensWorkspace(you, item.workspace_id));
|
|
215
|
+
return closed === -1 ? null : invalidIn(page, `records[${String(closed)}].workspace_id is a workspace you don't open`);
|
|
179
216
|
}
|
|
180
217
|
//# sourceMappingURL=members.js.map
|
package/dist/api/members.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"members.js","sourceRoot":"","sources":["../../src/api/members.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"members.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OAAO,KAAK,IAAI;QAAE,OAAO,OAAO,CAAA;IACpC,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAA;IAC3F,OAAO,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,WAAW,MAAM,CAAC,MAAM,CAAC,8CAA8C,CAAC,CAAA;AACxH,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { CallSpec } from '../core/call.js';
|
|
3
|
+
import { type Failed, type Heard } from '../core/invalid.js';
|
|
4
|
+
import type { ApiResult } from '../core/result.js';
|
|
5
|
+
import type { Backend } from './backend.js';
|
|
6
|
+
import { type Read } from './me.js';
|
|
7
|
+
/** What a record read by its id names: itself, its organisation and its workspace. */
|
|
8
|
+
interface Placed {
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly organization_id: string;
|
|
11
|
+
readonly workspace_id: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A record read by its id, a dataset or a log entry, held to you: the one rule both use (#404's
|
|
15
|
+
* code review, 1), as two copies of it drifted apart before (#404). The record names its workspace
|
|
16
|
+
* only once read, so it's read beside your organisation (D556) and you (`readUser`), all three
|
|
17
|
+
* started at once. A workspace named up front is `readOwnWorkspaceWith`'s rule instead.
|
|
18
|
+
* - **The order:** the answer is your organisation's failure, then yours, then the record's, then
|
|
19
|
+
* its checks: another organisation's record is `invalid`, and one in a workspace you don't open is
|
|
20
|
+
* `not_found`. So a sign-in whose read of you fails gets that failure whether the record exists or
|
|
21
|
+
* not (D571).
|
|
22
|
+
* - **No wait for the record once the answer is known:** when your organisation's read or yours has
|
|
23
|
+
* failed, the call answers once your organisation's read and yours have answered, without waiting
|
|
24
|
+
* for the record, and its end ends the record's read (the call scope, withReads, #349), whose
|
|
25
|
+
* rejection is still the call's.
|
|
26
|
+
* - **The record's own failure** is the backend's, passed on as it came, but pulse-admin's own
|
|
27
|
+
* refusal of it: that says it exists, so it answers `noSuch`, as one nobody has
|
|
28
|
+
* (`refusedAsNobodyHas`, D578), as one in a workspace you don't open does (D571). A role pulse-admin
|
|
29
|
+
* refuses every record gets `not_found` for every id, as accepted. A write's own 403, once the
|
|
30
|
+
* record is read, stays the caller's.
|
|
31
|
+
* - **An answer that isn't the record asked for** is `invalid`, and so is another organisation's,
|
|
32
|
+
* echoing no id: a staff token's reach is never shown as yours (D544). That `invalid` still says
|
|
33
|
+
* the record exists, to a token the backend answers other organisations' records for, as intended.
|
|
34
|
+
* - **One in a workspace you don't open** answers `noSuch`, the backend's own 404 for one nobody
|
|
35
|
+
* has, so a write after it sends nothing (D560, D571, #372).
|
|
36
|
+
* Both come back: the record as read, so a check after it keeps its status (#385), and your
|
|
37
|
+
* organisation, as `organizationSchema` reads it, so only a read that needs more than its id asks
|
|
38
|
+
* for more (#280). `what` names the record in an `invalid`'s words.
|
|
39
|
+
*/
|
|
40
|
+
export declare function readOwnRecord<R extends Placed, O extends {
|
|
41
|
+
readonly id: string;
|
|
42
|
+
}>(seam: Backend, read: Read, spec: CallSpec<R>, id: string, organizationSchema: z.ZodType<O>, what: string, noSuch: () => Failed): Promise<ApiResult<{
|
|
43
|
+
readonly record: Heard<R>;
|
|
44
|
+
readonly organization: O;
|
|
45
|
+
}>>;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { invalidIn } from '../core/invalid.js';
|
|
2
|
+
import { sameUuid } from './ids.js';
|
|
3
|
+
import { readUser } from './me.js';
|
|
4
|
+
import { opensWorkspace } from './members.js';
|
|
5
|
+
import { refusedAsNobodyHas } from './refusal.js';
|
|
6
|
+
/**
|
|
7
|
+
* A record read by its id, a dataset or a log entry, held to you: the one rule both use (#404's
|
|
8
|
+
* code review, 1), as two copies of it drifted apart before (#404). The record names its workspace
|
|
9
|
+
* only once read, so it's read beside your organisation (D556) and you (`readUser`), all three
|
|
10
|
+
* started at once. A workspace named up front is `readOwnWorkspaceWith`'s rule instead.
|
|
11
|
+
* - **The order:** the answer is your organisation's failure, then yours, then the record's, then
|
|
12
|
+
* its checks: another organisation's record is `invalid`, and one in a workspace you don't open is
|
|
13
|
+
* `not_found`. So a sign-in whose read of you fails gets that failure whether the record exists or
|
|
14
|
+
* not (D571).
|
|
15
|
+
* - **No wait for the record once the answer is known:** when your organisation's read or yours has
|
|
16
|
+
* failed, the call answers once your organisation's read and yours have answered, without waiting
|
|
17
|
+
* for the record, and its end ends the record's read (the call scope, withReads, #349), whose
|
|
18
|
+
* rejection is still the call's.
|
|
19
|
+
* - **The record's own failure** is the backend's, passed on as it came, but pulse-admin's own
|
|
20
|
+
* refusal of it: that says it exists, so it answers `noSuch`, as one nobody has
|
|
21
|
+
* (`refusedAsNobodyHas`, D578), as one in a workspace you don't open does (D571). A role pulse-admin
|
|
22
|
+
* refuses every record gets `not_found` for every id, as accepted. A write's own 403, once the
|
|
23
|
+
* record is read, stays the caller's.
|
|
24
|
+
* - **An answer that isn't the record asked for** is `invalid`, and so is another organisation's,
|
|
25
|
+
* echoing no id: a staff token's reach is never shown as yours (D544). That `invalid` still says
|
|
26
|
+
* the record exists, to a token the backend answers other organisations' records for, as intended.
|
|
27
|
+
* - **One in a workspace you don't open** answers `noSuch`, the backend's own 404 for one nobody
|
|
28
|
+
* has, so a write after it sends nothing (D560, D571, #372).
|
|
29
|
+
* Both come back: the record as read, so a check after it keeps its status (#385), and your
|
|
30
|
+
* organisation, as `organizationSchema` reads it, so only a read that needs more than its id asks
|
|
31
|
+
* for more (#280). `what` names the record in an `invalid`'s words.
|
|
32
|
+
*/
|
|
33
|
+
export async function readOwnRecord(seam, read, spec, id, organizationSchema, what, noSuch) {
|
|
34
|
+
// Started in this order, as they always were, so a transport's rejection is still the first
|
|
35
|
+
// read's to reject in that order (withReads, #349).
|
|
36
|
+
const organization = read(seam.myOrganization(organizationSchema));
|
|
37
|
+
const record = read(spec);
|
|
38
|
+
const you = readUser(seam, read);
|
|
39
|
+
// Observed at once: once your organisation's read or yours has failed, it isn't waited for.
|
|
40
|
+
record.catch(() => undefined);
|
|
41
|
+
const [ours, yours] = await Promise.all([organization, you]);
|
|
42
|
+
if (!ours.ok)
|
|
43
|
+
return ours;
|
|
44
|
+
if (!yours.ok)
|
|
45
|
+
return yours;
|
|
46
|
+
const answer = await record;
|
|
47
|
+
if (!answer.ok)
|
|
48
|
+
return refusedAsNobodyHas(answer, noSuch);
|
|
49
|
+
if (!sameUuid(answer.data.id, id))
|
|
50
|
+
return invalidIn(answer, `the ${what} read isn't the one asked for`);
|
|
51
|
+
if (!sameUuid(answer.data.organization_id, ours.data.id))
|
|
52
|
+
return invalidIn(answer, `the ${what} read is another organisation's`);
|
|
53
|
+
if (!opensWorkspace(yours.data, answer.data.workspace_id))
|
|
54
|
+
return noSuch();
|
|
55
|
+
return { ok: true, data: { record: answer, organization: ours.data } };
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=ownRecord.js.map
|