@substrat-run/engine-invites 0.5.2 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +80 -27
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +72 -9
- package/dist/index.js.map +1 -1
- package/dist/model.d.ts +12 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +14 -0
- package/dist/model.js.map +1 -0
- package/dist/operations.d.ts +13 -0
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +10 -0
- package/dist/operations.js.map +1 -1
- package/dist/seam.d.ts +5 -0
- package/dist/seam.d.ts.map +1 -0
- package/dist/seam.js +18 -0
- package/dist/seam.js.map +1 -0
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* engine-invites — composed **by call**, not by event.
|
|
3
|
+
*
|
|
4
|
+
* The in-scope functions are the surface: `sendInvite`, `acceptInvite`,
|
|
5
|
+
* `revokeInvite`, `listInvites`, `expireOverdue`. A vertical imports those into its
|
|
6
|
+
* own operations and runs them inside its own transaction — the dashboard and every
|
|
7
|
+
* hosted vertical need the same invitation surface, which is D-31's "two consumers
|
|
8
|
+
* on day one" and the reason this is an engine at all
|
|
9
|
+
* (`docs/engines/invites.md`).
|
|
10
|
+
*
|
|
11
|
+
* There are no consumers here. Nothing composes this engine by emitting at it.
|
|
12
|
+
*/
|
|
1
13
|
import { type OrgId } from '@substrat-run/contracts';
|
|
2
14
|
/**
|
|
3
15
|
* The conflict reasons this engine raises — its own vocabulary, narrowing the platform's
|
|
@@ -12,18 +24,19 @@ export declare const INVITES_CONFLICT_REASONS: readonly ['open_invite_limit'];
|
|
|
12
24
|
export type InvitesConflictReason = (typeof INVITES_CONFLICT_REASONS)[number];
|
|
13
25
|
export { invitation, invitesEntities, invitationRow } from './entities.js';
|
|
14
26
|
export { invitesOperations, INVITES_PERMISSIONS } from './operations.js';
|
|
27
|
+
import { z } from 'zod';
|
|
15
28
|
import { type ModuleRegistration, type OperationContext } from '@substrat-run/kernel';
|
|
16
29
|
export declare const INVITES_PERM: {
|
|
17
|
-
send: string &
|
|
18
|
-
read: string &
|
|
19
|
-
revoke: string &
|
|
30
|
+
send: string & z.$brand<"PermissionKey">;
|
|
31
|
+
read: string & z.$brand<"PermissionKey">;
|
|
32
|
+
revoke: string & z.$brand<"PermissionKey">;
|
|
20
33
|
};
|
|
21
34
|
export declare const invitesManifest: {
|
|
22
|
-
id: string &
|
|
35
|
+
id: string & z.$brand<"ModuleId">;
|
|
23
36
|
version: string;
|
|
24
37
|
kernelContract: string;
|
|
25
38
|
permissions: {
|
|
26
|
-
key: string &
|
|
39
|
+
key: string & z.$brand<"PermissionKey">;
|
|
27
40
|
description: string;
|
|
28
41
|
}[];
|
|
29
42
|
events: {
|
|
@@ -42,8 +55,8 @@ export declare const invitesManifest: {
|
|
|
42
55
|
};
|
|
43
56
|
attachmentTargets: {
|
|
44
57
|
entityType: string;
|
|
45
|
-
readPermission: string &
|
|
46
|
-
writePermission?: (string &
|
|
58
|
+
readPermission: string & z.$brand<"PermissionKey">;
|
|
59
|
+
writePermission?: (string & z.$brand<"PermissionKey">) | undefined;
|
|
47
60
|
}[];
|
|
48
61
|
entityRelations?: {
|
|
49
62
|
entityType: string;
|
|
@@ -60,7 +73,7 @@ export declare const invitesManifest: {
|
|
|
60
73
|
everyMinutes: number;
|
|
61
74
|
};
|
|
62
75
|
input?: Record<string, unknown> | undefined;
|
|
63
|
-
permissions: (string &
|
|
76
|
+
permissions: (string & z.$brand<"PermissionKey">)[];
|
|
64
77
|
}[] | undefined;
|
|
65
78
|
withdraws?: string[] | undefined;
|
|
66
79
|
entitlementKey: string;
|
|
@@ -74,7 +87,7 @@ export declare const invitesManifest: {
|
|
|
74
87
|
default?: string | undefined;
|
|
75
88
|
group?: string | undefined;
|
|
76
89
|
}[] | undefined;
|
|
77
|
-
ownerGrants?: (string &
|
|
90
|
+
ownerGrants?: (string & z.$brand<"PermissionKey">)[] | undefined;
|
|
78
91
|
entitlements?: string[] | undefined;
|
|
79
92
|
provides?: string[] | undefined;
|
|
80
93
|
requires?: string[] | undefined;
|
|
@@ -97,13 +110,13 @@ export declare const invitesManifest: {
|
|
|
97
110
|
routes?: {
|
|
98
111
|
path: string;
|
|
99
112
|
screen: string;
|
|
100
|
-
permission: string &
|
|
113
|
+
permission: string & z.$brand<"PermissionKey">;
|
|
101
114
|
}[] | undefined;
|
|
102
115
|
nav?: {
|
|
103
116
|
label: string;
|
|
104
117
|
icon?: string | undefined;
|
|
105
118
|
to: string;
|
|
106
|
-
permission: string &
|
|
119
|
+
permission: string & z.$brand<"PermissionKey">;
|
|
107
120
|
}[] | undefined;
|
|
108
121
|
entityViews?: {
|
|
109
122
|
entityType: string;
|
|
@@ -112,12 +125,12 @@ export declare const invitesManifest: {
|
|
|
112
125
|
widgets?: {
|
|
113
126
|
slot: string;
|
|
114
127
|
component: string;
|
|
115
|
-
permission: string &
|
|
128
|
+
permission: string & z.$brand<"PermissionKey">;
|
|
116
129
|
}[] | undefined;
|
|
117
130
|
settingsPanels?: {
|
|
118
131
|
label: string;
|
|
119
132
|
component: string;
|
|
120
|
-
permission: string &
|
|
133
|
+
permission: string & z.$brand<"PermissionKey">;
|
|
121
134
|
}[] | undefined;
|
|
122
135
|
} | undefined;
|
|
123
136
|
};
|
|
@@ -125,21 +138,61 @@ export declare const invitesMigrations: {
|
|
|
125
138
|
version: string;
|
|
126
139
|
sql: string;
|
|
127
140
|
}[];
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
+
/**
|
|
142
|
+
* The seam schemas (#771/#970).
|
|
143
|
+
*
|
|
144
|
+
* `entities.ts` describes what is STORED, which is what the journal comparison
|
|
145
|
+
* checks against, so `state` is a bare string there. The engine's own machine is
|
|
146
|
+
* narrower than that, and the narrowing is the point: `state` decides whether an
|
|
147
|
+
* invitation is acceptable, so a row that drifted to a state this engine does not
|
|
148
|
+
* know must be a throw at the seam rather than a value `acceptInvite` compares
|
|
149
|
+
* against and silently refuses.
|
|
150
|
+
*/
|
|
151
|
+
declare const inviteState: z.ZodEnum<{
|
|
152
|
+
accepted: "accepted";
|
|
153
|
+
expired: "expired";
|
|
154
|
+
invited: "invited";
|
|
155
|
+
revoked: "revoked";
|
|
156
|
+
}>;
|
|
157
|
+
export type InviteState = z.infer<typeof inviteState>;
|
|
158
|
+
/** The stored row, hash included — never returned, only matched against. */
|
|
159
|
+
declare const invitationStored: z.ZodObject<{
|
|
160
|
+
id: z.ZodString;
|
|
161
|
+
org_id: z.ZodString;
|
|
162
|
+
identifier_hash: z.ZodString;
|
|
163
|
+
role_key: z.ZodString;
|
|
164
|
+
invited_by: z.ZodString;
|
|
165
|
+
accepted_by: z.ZodNullable<z.ZodString>;
|
|
166
|
+
created_at: z.ZodString;
|
|
167
|
+
expires_at: z.ZodString;
|
|
168
|
+
settled_at: z.ZodNullable<z.ZodString>;
|
|
169
|
+
state: z.ZodEnum<{
|
|
170
|
+
accepted: "accepted";
|
|
171
|
+
expired: "expired";
|
|
172
|
+
invited: "invited";
|
|
173
|
+
revoked: "revoked";
|
|
174
|
+
}>;
|
|
175
|
+
}, z.core.$strip>;
|
|
176
|
+
export type InvitationRow = z.infer<typeof invitationStored>;
|
|
177
|
+
/** What crosses the seam: the row minus the hash (`entities.ts` omits it). */
|
|
178
|
+
declare const invitationPublished: z.ZodObject<{
|
|
179
|
+
id: z.ZodString;
|
|
180
|
+
org_id: z.ZodString;
|
|
181
|
+
role_key: z.ZodString;
|
|
182
|
+
invited_by: z.ZodString;
|
|
183
|
+
accepted_by: z.ZodNullable<z.ZodString>;
|
|
184
|
+
created_at: z.ZodString;
|
|
185
|
+
expires_at: z.ZodString;
|
|
186
|
+
settled_at: z.ZodNullable<z.ZodString>;
|
|
187
|
+
state: z.ZodEnum<{
|
|
188
|
+
accepted: "accepted";
|
|
189
|
+
expired: "expired";
|
|
190
|
+
invited: "invited";
|
|
191
|
+
revoked: "revoked";
|
|
192
|
+
}>;
|
|
193
|
+
}, z.core.$strip>;
|
|
141
194
|
/** Public shape: the hash never leaves the engine. */
|
|
142
|
-
export type Invitation =
|
|
195
|
+
export type Invitation = z.infer<typeof invitationPublished>;
|
|
143
196
|
/**
|
|
144
197
|
* Hash an identifier with the scope's own salt (Web Crypto, never a node-only
|
|
145
198
|
* import).
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAQL,KAAK,KAAK,EAEX,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,YACnC,mBAAmB,CACX,CAAC;AACX,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAS9E,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAI3E,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGzE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EAEtB,MAAM,sBAAsB,CAAC;AAoB9B,eAAO,MAAM,YAAY;IACvB,IAAI;IACJ,IAAI;IACJ,MAAM;CACP,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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KAAK,EAAE;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAClD,OAAO,CAAC,UAAU,CAAC,CAgErB;AAED,6EAA6E;AAC7E,wBAAgB,YAAY,CAAC,GAAG,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAc9E;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,GAAG,UAAU,EAAE,CAe7E;AAqCD,eAAO,MAAM,aAAa,EAAE,kBAW3B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* engine-invites — composed **by call**, not by event.
|
|
3
|
+
*
|
|
4
|
+
* The in-scope functions are the surface: `sendInvite`, `acceptInvite`,
|
|
5
|
+
* `revokeInvite`, `listInvites`, `expireOverdue`. A vertical imports those into its
|
|
6
|
+
* own operations and runs them inside its own transaction — the dashboard and every
|
|
7
|
+
* hosted vertical need the same invitation surface, which is D-31's "two consumers
|
|
8
|
+
* on day one" and the reason this is an engine at all
|
|
9
|
+
* (`docs/engines/invites.md`).
|
|
10
|
+
*
|
|
11
|
+
* There are no consumers here. Nothing composes this engine by emitting at it.
|
|
12
|
+
*/
|
|
13
|
+
import { entityRef, moduleManifest, operationInputsOf, pageOverFold, permissionKey, substratError, } from '@substrat-run/contracts';
|
|
2
14
|
/**
|
|
3
15
|
* The conflict reasons this engine raises — its own vocabulary, narrowing the platform's
|
|
4
16
|
* `conflict` code (#113). Exported so a vertical can branch on WHY a refusal happened
|
|
@@ -17,10 +29,13 @@ const conflict = (reason, message) => substratError('conflict', message, { reaso
|
|
|
17
29
|
// entity-type constants its relation edges name, and the row schema to declare
|
|
18
30
|
// an operation's output against without retyping this engine's shape.
|
|
19
31
|
export { invitation, invitesEntities, invitationRow } from './entities.js';
|
|
32
|
+
import { invitation, invitationRow } from './entities.js';
|
|
20
33
|
// The declared operation surface (#865): what each operation checks and takes,
|
|
21
34
|
// readable by the conformance kit and by a composing vertical's routes.
|
|
22
35
|
export { invitesOperations, INVITES_PERMISSIONS } from './operations.js';
|
|
23
36
|
import { invitesOperations } from './operations.js';
|
|
37
|
+
import { columnsOf, returns } from './seam.js';
|
|
38
|
+
import { z } from 'zod';
|
|
24
39
|
import { assertAllowed, ulid, } from '@substrat-run/kernel';
|
|
25
40
|
// ============================================================================
|
|
26
41
|
// The invites engine (membership.md §6; mechanics from booking-social.md
|
|
@@ -102,7 +117,35 @@ export const invitesMigrations = [
|
|
|
102
117
|
`,
|
|
103
118
|
},
|
|
104
119
|
];
|
|
105
|
-
|
|
120
|
+
/**
|
|
121
|
+
* The seam schemas (#771/#970).
|
|
122
|
+
*
|
|
123
|
+
* `entities.ts` describes what is STORED, which is what the journal comparison
|
|
124
|
+
* checks against, so `state` is a bare string there. The engine's own machine is
|
|
125
|
+
* narrower than that, and the narrowing is the point: `state` decides whether an
|
|
126
|
+
* invitation is acceptable, so a row that drifted to a state this engine does not
|
|
127
|
+
* know must be a throw at the seam rather than a value `acceptInvite` compares
|
|
128
|
+
* against and silently refuses.
|
|
129
|
+
*/
|
|
130
|
+
const inviteState = z.enum(['invited', 'accepted', 'revoked', 'expired']);
|
|
131
|
+
/** The stored row, hash included — never returned, only matched against. */
|
|
132
|
+
const invitationStored = invitationRow.extend({ state: inviteState });
|
|
133
|
+
/** What crosses the seam: the row minus the hash (`entities.ts` omits it). */
|
|
134
|
+
const invitationPublished = invitation.extend({ state: inviteState });
|
|
135
|
+
/**
|
|
136
|
+
* The SELECT lists, DERIVED from those schemas rather than transcribed (#771).
|
|
137
|
+
*
|
|
138
|
+
* `PUBLIC_COLUMNS` was a hand-written string, and it was the only thing keeping
|
|
139
|
+
* the hash out of a read — one `SELECT *` and the property this engine exists to
|
|
140
|
+
* hold would have been gone with nothing to notice. Deriving it from the schema
|
|
141
|
+
* that already omits `identifier_hash` makes the omission structural.
|
|
142
|
+
*/
|
|
143
|
+
const PUBLIC_COLUMNS = columnsOf(invitationPublished);
|
|
144
|
+
const ROW_COLUMNS = columnsOf(invitationStored);
|
|
145
|
+
/** A stored row, parsed BEFORE anything is made of it. */
|
|
146
|
+
const storedInvitation = (r) => returns(invitationStored, `invitation row ${r.id}`, r);
|
|
147
|
+
/** A row on its way OUT, parsed by the shape a composing vertical declared. */
|
|
148
|
+
const publishedInvitation = (r) => returns(invitationPublished, `invitation ${r.id}`, r);
|
|
106
149
|
/** How long an unaccepted invitation stands. Bounded, because a standing offer should be. */
|
|
107
150
|
const DEFAULT_TTL_MS = 14 * 24 * 60 * 60 * 1000;
|
|
108
151
|
/** Open invitations one sender may hold per org — booking-social's rate limit. */
|
|
@@ -183,13 +226,17 @@ export async function sendInvite(ctx, input) {
|
|
|
183
226
|
* state that this transaction cannot reach atomically.
|
|
184
227
|
*/
|
|
185
228
|
export async function acceptInvite(ctx, input) {
|
|
186
|
-
const
|
|
187
|
-
input.invitationId,
|
|
188
|
-
])[0];
|
|
229
|
+
const raw = ctx.sql.query(`SELECT ${ROW_COLUMNS} FROM invites_invitation WHERE id = ?`, [input.invitationId])[0];
|
|
189
230
|
// One message for every failure mode — wrong id, wrong person, already settled,
|
|
190
231
|
// expired. Distinguishing them would turn this into an oracle.
|
|
191
232
|
const refuse = () => new Error('invitation is not acceptable');
|
|
192
|
-
if (!
|
|
233
|
+
if (!raw)
|
|
234
|
+
throw refuse();
|
|
235
|
+
// Parsed before the state machine reads it: a `state` this engine does not know
|
|
236
|
+
// is an engine fault, and answering `refuse()` for it would file that fault
|
|
237
|
+
// under "not acceptable" — indistinguishable from a wrong identifier forever.
|
|
238
|
+
const row = storedInvitation(raw);
|
|
239
|
+
if (row.state !== 'invited')
|
|
193
240
|
throw refuse();
|
|
194
241
|
if (row.expires_at <= ctx.now()) {
|
|
195
242
|
ctx.sql.exec(`UPDATE invites_invitation SET state = 'expired', settled_at = ? WHERE id = ?`, [
|
|
@@ -231,7 +278,9 @@ export async function acceptInvite(ctx, input) {
|
|
|
231
278
|
invitationId: row.id,
|
|
232
279
|
},
|
|
233
280
|
});
|
|
234
|
-
return ctx.sql.query(`SELECT ${PUBLIC_COLUMNS} FROM invites_invitation WHERE id = ?`, [
|
|
281
|
+
return publishedInvitation(ctx.sql.query(`SELECT ${PUBLIC_COLUMNS} FROM invites_invitation WHERE id = ?`, [
|
|
282
|
+
row.id,
|
|
283
|
+
])[0]);
|
|
235
284
|
}
|
|
236
285
|
/** Withdraw an unaccepted invitation. Settled invitations are left alone. */
|
|
237
286
|
export function revokeInvite(ctx, invitationId) {
|
|
@@ -254,7 +303,16 @@ export function revokeInvite(ctx, invitationId) {
|
|
|
254
303
|
*/
|
|
255
304
|
export function listInvites(ctx, orgId) {
|
|
256
305
|
expireOverdue(ctx, orgId);
|
|
257
|
-
|
|
306
|
+
// Newest first, ordered by `id` rather than `created_at` (#959). Same intent —
|
|
307
|
+
// the id is a ULID, so it carries the same instant — but TOTAL: `created_at`
|
|
308
|
+
// comes from `ctx.now()`, which is stable for a whole invocation, so a seed or
|
|
309
|
+
// a batch that sends several invitations in one operation gives them all the
|
|
310
|
+
// same value and leaves their relative order to SQLite. That is fine for a
|
|
311
|
+
// whole-list read and fatal for the keyset walk `invites/list` now does, where
|
|
312
|
+
// a cursor over a column with ties skips or repeats rows.
|
|
313
|
+
return ctx.sql
|
|
314
|
+
.query(`SELECT ${PUBLIC_COLUMNS} FROM invites_invitation WHERE org_id = ? ORDER BY id DESC`, [orgId])
|
|
315
|
+
.map(publishedInvitation);
|
|
258
316
|
}
|
|
259
317
|
// -- operations: the permission check plus one exported function (D-28) -------
|
|
260
318
|
const sendOp = async (ctx, input) => {
|
|
@@ -267,9 +325,14 @@ const acceptOp = async (ctx, input) => {
|
|
|
267
325
|
// proven by re-hashing the identifier they present.
|
|
268
326
|
return acceptInvite(ctx, input);
|
|
269
327
|
};
|
|
328
|
+
// Paged (#959). `listInvites` above stays unpaged: a vertical composing it inside
|
|
329
|
+
// its own operation is reading one org's invitations to decide something, not
|
|
330
|
+
// rendering a table — the same split `listOrders` kept in #811.
|
|
270
331
|
const listOp = async (ctx, input) => {
|
|
271
332
|
assertAllowed(await ctx.check(INVITES_PERM.read));
|
|
272
|
-
|
|
333
|
+
// Newest first, so the walk descends; the id is a ULID, unique and ordered the
|
|
334
|
+
// same way `created_at` is.
|
|
335
|
+
return pageOverFold(listInvites(ctx, input.orgId), input, (i) => i.id, 'desc');
|
|
273
336
|
};
|
|
274
337
|
const revokeOp = async (ctx, input) => {
|
|
275
338
|
assertAllowed(await ctx.check(INVITES_PERM.revoke));
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,aAAa,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EACL,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,aAAa,GAId,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,mBAAmB;CACX,CAAC;AAGX,gGAAgG;AAChG,MAAM,QAAQ,GAAG,CAAC,MAA6B,EAAE,OAAe,EAAE,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AAGpH,4EAA4E;AAC5E,+EAA+E;AAC/E,sEAAsE;AACtE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC1D,+EAA+E;AAC/E,wEAAwE;AACxE,OAAO,EAAE,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AiB;IAC7B,+EAA+E;IAC/E,eAAe,EAAE,iBAAiB,CAAC,iBAAiB,CAAC;IACrD,UAAU,EAAE;QACV,cAAc,EAAE,MAAqD;QACrE,gBAAgB,EAAE,QAAuD;QACzE,cAAc,EAAE,MAAqD;QACrE,gBAAgB,EAAE,QAAuD;KAC1E;CACF,CAAC"}
|
package/dist/model.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The artifact of record for this engine (#697/#844, #976).
|
|
3
|
+
*
|
|
4
|
+
* `pnpm lint:model --check` re-emits this into `engines/invites/model.json`, so a
|
|
5
|
+
* changed table, a renamed field or a moved parent edge has to appear in a PR
|
|
6
|
+
* diff. No `lifecycles` option: this engine declares no state machine, and an
|
|
7
|
+
* empty one would claim otherwise.
|
|
8
|
+
*
|
|
9
|
+
* Imported by nothing, so the direction stays acyclic.
|
|
10
|
+
*/
|
|
11
|
+
export declare const invitesModel: import("@substrat-run/contracts").EmittedModel;
|
|
12
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,gDAA6B,CAAC"}
|
package/dist/model.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { emitModel } from '@substrat-run/contracts';
|
|
2
|
+
import { invitesEntities } from './entities.js';
|
|
3
|
+
/**
|
|
4
|
+
* The artifact of record for this engine (#697/#844, #976).
|
|
5
|
+
*
|
|
6
|
+
* `pnpm lint:model --check` re-emits this into `engines/invites/model.json`, so a
|
|
7
|
+
* changed table, a renamed field or a moved parent edge has to appear in a PR
|
|
8
|
+
* diff. No `lifecycles` option: this engine declares no state machine, and an
|
|
9
|
+
* empty one would claim otherwise.
|
|
10
|
+
*
|
|
11
|
+
* Imported by nothing, so the direction stays acyclic.
|
|
12
|
+
*/
|
|
13
|
+
export const invitesModel = emitModel(invitesEntities);
|
|
14
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,SAAS,CAAC,eAAe,CAAC,CAAC"}
|
package/dist/operations.d.ts
CHANGED
|
@@ -100,6 +100,19 @@ export declare const invitesOperations: {
|
|
|
100
100
|
expires_at: z.ZodString;
|
|
101
101
|
settled_at: z.ZodNullable<z.ZodString>;
|
|
102
102
|
}, z.core.$strip>;
|
|
103
|
+
/**
|
|
104
|
+
* Handler-composed, not `paged.over` (#959). The read answers the PROJECTION
|
|
105
|
+
* — the row minus the identifier hash — and it expires overdue invitations on
|
|
106
|
+
* the way past, which the kernel's walk has no place for.
|
|
107
|
+
*
|
|
108
|
+
* Newest first, so the page descends. `id` is the cursor rather than
|
|
109
|
+
* `created_at`: it is a ULID, so it is unique AND ordered the same way
|
|
110
|
+
* `created_at` is, and a keyset over a non-unique column skips ties.
|
|
111
|
+
*/
|
|
112
|
+
readonly paged: {
|
|
113
|
+
readonly sortKey: "id";
|
|
114
|
+
readonly order: "desc";
|
|
115
|
+
};
|
|
103
116
|
};
|
|
104
117
|
readonly 'invites/revoke': {
|
|
105
118
|
readonly summary: "Withdraw an invitation before it is accepted";
|
package/dist/operations.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,OAAO,EAAoB,CAAC,EAAE,MAAM,yBAAyB,CAAC;AAG9D,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,YAAI,cAAc,EAAE,cAAc,EAAE,gBAAgB,CAAU,CAAC;AAI/F,eAAO,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,OAAO,EAAoB,CAAC,EAAE,MAAM,yBAAyB,CAAC;AAG9D,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,YAAI,cAAc,EAAE,cAAc,EAAE,gBAAgB,CAAU,CAAC;AAI/F,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAoD1B;;;;;;;;WAQG;;;;;;;;;;;;;;CAaL,CAAC"}
|
package/dist/operations.js
CHANGED
|
@@ -97,6 +97,16 @@ export const invitesOperations = defineOperations(invitesEntities, INVITES_PERMI
|
|
|
97
97
|
// publish the identifier hash, which is the one thing hashing exists to keep
|
|
98
98
|
// unreadable.
|
|
99
99
|
output: invitation,
|
|
100
|
+
/**
|
|
101
|
+
* Handler-composed, not `paged.over` (#959). The read answers the PROJECTION
|
|
102
|
+
* — the row minus the identifier hash — and it expires overdue invitations on
|
|
103
|
+
* the way past, which the kernel's walk has no place for.
|
|
104
|
+
*
|
|
105
|
+
* Newest first, so the page descends. `id` is the cursor rather than
|
|
106
|
+
* `created_at`: it is a ULID, so it is unique AND ordered the same way
|
|
107
|
+
* `created_at` is, and a keyset over a non-unique column skips ties.
|
|
108
|
+
*/
|
|
109
|
+
paged: { sortKey: 'id', order: 'desc' },
|
|
100
110
|
},
|
|
101
111
|
'invites/revoke': {
|
|
102
112
|
summary: 'Withdraw an invitation before it is accepted',
|
package/dist/operations.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAA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,MAAM,EAAE;KACxC;IAED,gBAAgB,EAAE;QAChB,OAAO,EAAE,8CAA8C;QACvD,UAAU,EAAE,gBAAgB;QAC5B,KAAK,EAAE,YAAY;QACnB,mEAAmE;QACnE,yEAAyE;QACzE,kEAAkE;QAClE,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE;KACjB;CACF,CAAC,CAAC"}
|
package/dist/seam.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** How this engine names itself in a seam failure. */
|
|
2
|
+
export declare const columnsOf: (schema: {
|
|
3
|
+
readonly shape: Readonly<Record<string, unknown>>;
|
|
4
|
+
}) => string, returns: <T>(schema: import("zod").ZodType<T>, surface: string, value: unknown) => T;
|
|
5
|
+
//# sourceMappingURL=seam.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seam.d.ts","sourceRoot":"","sources":["../src/seam.ts"],"names":[],"mappings":"AAgBA,sDAAsD;AACtD,eAAO,MAAQ,SAAS;;cAAE,OAAO,6EAAiC,CAAC"}
|
package/dist/seam.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The engine seam (#771) for engine-invites — the NAME, and nothing else.
|
|
3
|
+
*
|
|
4
|
+
* `returns(schema, surface, value)` and `columnsOf(schema)` live in
|
|
5
|
+
* `@substrat-run/contracts` (#970), where the prose explaining what they are for
|
|
6
|
+
* lives with them; an engine supplies only the name it answers under.
|
|
7
|
+
*
|
|
8
|
+
* What is specific to this engine is what the seam must NOT publish. The stored
|
|
9
|
+
* row carries `identifier_hash`, and the whole non-enumerability property depends
|
|
10
|
+
* on it never leaving — so the published schema is the row minus the hash, and
|
|
11
|
+
* `columnsOf` derives the SELECT list from THAT. The exclusion is then a fact
|
|
12
|
+
* about the read rather than a column list somebody remembered to keep in step:
|
|
13
|
+
* `SELECT *` here would have leaked the hash on the first read that forgot.
|
|
14
|
+
*/
|
|
15
|
+
import { engineSeam } from '@substrat-run/contracts';
|
|
16
|
+
/** How this engine names itself in a seam failure. */
|
|
17
|
+
export const { columnsOf, returns } = engineSeam('engine-invites');
|
|
18
|
+
//# sourceMappingURL=seam.js.map
|
package/dist/seam.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seam.js","sourceRoot":"","sources":["../src/seam.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,sDAAsD;AACtD,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@substrat-run/engine-invites",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Substrat engine: invitations — invite by verified hashed identifier, accept-required, non-enumerable",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"repository": {
|
|
@@ -25,16 +25,16 @@
|
|
|
25
25
|
"access": "public"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@substrat-run/contracts": "^0.
|
|
29
|
-
"@substrat-run/kernel": "^0.
|
|
28
|
+
"@substrat-run/contracts": "^0.95.0",
|
|
29
|
+
"@substrat-run/kernel": "^0.95.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"typescript": "^7.0.0",
|
|
33
33
|
"vitest": "^3.2.7",
|
|
34
34
|
"zod": "^4.4.3",
|
|
35
|
-
"@substrat-run/contract-tests": "^0.
|
|
36
|
-
"@substrat-run/engine-test-kit": "^0.3.
|
|
37
|
-
"@substrat-run/model-emit": "0.8.
|
|
35
|
+
"@substrat-run/contract-tests": "^0.95.0",
|
|
36
|
+
"@substrat-run/engine-test-kit": "^0.3.22",
|
|
37
|
+
"@substrat-run/model-emit": "0.8.10"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"zod": "^4.4.0"
|