@nebutra/contracts 0.1.2 → 3.0.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.
@@ -1,37 +1,47 @@
1
1
 
2
- > @nebutra/contracts@0.1.2 build /Users/tseka_luk/Documents/Nebutra-SaaS-Lab/Nebutra-Sailor/packages/commerce/contracts
2
+ > @nebutra/contracts@3.0.0 build /home/runner/work/Nebutra-Sailor/Nebutra-Sailor/packages/commerce/contracts
3
3
  > tsup
4
4
 
5
- CLI Building entry: src/billing.ts, src/events.ts, src/identity.ts, src/index.ts, src/notifications.ts
6
- CLI Using tsconfig: tsconfig.json
7
- CLI tsup v8.5.1
8
- CLI Using tsup config: /Users/tseka_luk/Documents/Nebutra-SaaS-Lab/Nebutra-Sailor/packages/commerce/contracts/tsup.config.ts
9
- CLI Target: es2022
10
- CLI Cleaning output folder
11
- ESM Build start
12
- ESM dist/index.js 2.01 KB
13
- ESM dist/billing.js 332.00 B
14
- ESM dist/chunk-NFJTVIKD.js 1.32 KB
15
- ESM dist/chunk-2NXI4PJM.js 565.00 B
16
- ESM dist/chunk-5JNQ2KAT.js 2.07 KB
17
- ESM dist/notifications.js 1.11 KB
18
- ESM dist/events.js 173.00 B
19
- ESM dist/identity.js 563.00 B
20
- ESM dist/chunk-F4BR76CX.js 2.91 KB
21
- ESM dist/billing.js.map 71.00 B
22
- ESM dist/chunk-5JNQ2KAT.js.map 4.47 KB
23
- ESM dist/index.js.map 71.00 B
24
- ESM dist/chunk-NFJTVIKD.js.map 2.78 KB
25
- ESM dist/events.js.map 71.00 B
26
- ESM dist/identity.js.map 71.00 B
27
- ESM dist/notifications.js.map 71.00 B
28
- ESM dist/chunk-2NXI4PJM.js.map 1.16 KB
29
- ESM dist/chunk-F4BR76CX.js.map 6.05 KB
30
- ESM ⚡️ Build success in 95ms
31
- DTS Build start
32
- DTS ⚡️ Build success in 4639ms
33
- DTS dist/index.d.ts 1.69 KB
34
- DTS dist/billing.d.ts 2.11 KB
35
- DTS dist/events.d.ts 1020.00 B
36
- DTS dist/identity.d.ts 4.03 KB
37
- DTS dist/notifications.d.ts 6.09 KB
5
+ CLI Building entry: src/admin.ts, src/billing.ts, src/events.ts, src/identity.ts, src/index.ts, src/notifications.ts, src/sleptons.ts
6
+ CLI Using tsconfig: tsconfig.json
7
+ CLI tsup v8.5.1
8
+ CLI Using tsup config: /home/runner/work/Nebutra-Sailor/Nebutra-Sailor/packages/commerce/contracts/tsup.config.ts
9
+ CLI Target: es2022
10
+ CLI Cleaning output folder
11
+ ESM Build start
12
+ ESM dist/admin.js 1.12 KB
13
+ ESM dist/billing.js 332.00 B
14
+ ESM dist/events.js 173.00 B
15
+ ESM dist/identity.js 563.00 B
16
+ ESM dist/index.js 4.44 KB
17
+ ESM dist/chunk-G65TWQGE.js 8.52 KB
18
+ ESM dist/chunk-NFJTVIKD.js 1.32 KB
19
+ ESM dist/chunk-2NXI4PJM.js 565.00 B
20
+ ESM dist/chunk-5JNQ2KAT.js 2.07 KB
21
+ ESM dist/notifications.js 1.11 KB
22
+ ESM dist/sleptons.js 1.40 KB
23
+ ESM dist/chunk-BX2ZIODN.js 2.88 KB
24
+ ESM dist/chunk-PU65L2HQ.js 6.74 KB
25
+ ESM dist/admin.js.map 71.00 B
26
+ ESM dist/billing.js.map 71.00 B
27
+ ESM dist/events.js.map 71.00 B
28
+ ESM dist/identity.js.map 71.00 B
29
+ ESM dist/index.js.map 71.00 B
30
+ ESM dist/chunk-G65TWQGE.js.map 18.03 KB
31
+ ESM dist/chunk-NFJTVIKD.js.map 2.78 KB
32
+ ESM dist/chunk-2NXI4PJM.js.map 1.16 KB
33
+ ESM dist/chunk-5JNQ2KAT.js.map 4.47 KB
34
+ ESM dist/notifications.js.map 71.00 B
35
+ ESM dist/sleptons.js.map 71.00 B
36
+ ESM dist/chunk-BX2ZIODN.js.map 6.00 KB
37
+ ESM dist/chunk-PU65L2HQ.js.map 14.02 KB
38
+ ESM ⚡️ Build success in 96ms
39
+ DTS Build start
40
+ DTS ⚡️ Build success in 28456ms
41
+ DTS dist/index.d.ts 3.18 KB
42
+ DTS dist/admin.d.ts 15.67 KB
43
+ DTS dist/billing.d.ts 2.11 KB
44
+ DTS dist/events.d.ts 1020.00 B
45
+ DTS dist/identity.d.ts 4.03 KB
46
+ DTS dist/notifications.d.ts 6.02 KB
47
+ DTS dist/sleptons.d.ts 21.11 KB
@@ -0,0 +1,15 @@
1
+
2
+ > @nebutra/contracts@3.0.0 test /home/runner/work/Nebutra-Sailor/Nebutra-Sailor/packages/commerce/contracts
3
+ > vitest run
4
+
5
+
6
+  RUN  v4.1.4 /home/runner/work/Nebutra-Sailor/Nebutra-Sailor/packages/commerce/contracts
7
+
8
+ ✓ src/__tests__/admin.test.ts (5 tests) 110ms
9
+ ✓ src/sleptons.test.ts (6 tests) 136ms
10
+
11
+  Test Files  2 passed (2)
12
+  Tests  11 passed (11)
13
+  Start at  08:50:36
14
+  Duration  1.77s (transform 700ms, setup 0ms, import 1.66s, tests 246ms, environment 0ms)
15
+
@@ -1,4 +1,4 @@
1
1
 
2
- > @nebutra/contracts@0.1.2 typecheck /Users/tseka_luk/Documents/Nebutra-SaaS-Lab/Nebutra-Sailor/packages/commerce/contracts
2
+ > @nebutra/contracts@3.0.0 typecheck /home/runner/work/Nebutra-Sailor/Nebutra-Sailor/packages/commerce/contracts
3
3
  > tsc --noEmit
4
4
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @nebutra/contracts
2
2
 
3
+ ## 3.0.0
4
+
5
+ ## 2.0.0
6
+
7
+ ### Minor Changes
8
+
9
+ - [#541](https://github.com/Nebutra/Nebutra-Sailor/pull/541) [`a29746f`](https://github.com/Nebutra/Nebutra-Sailor/commit/a29746fdd9eabdfb9c1692a2dc43fc7d5810779c) Thanks [@TsekaLuk](https://github.com/TsekaLuk)! - Sleptons résumé R0: schema, storage, and owner read/write.
10
+ - `@nebutra/contracts/sleptons` — `ResumeContentV1Schema` (the structured "track record" attached to a member profile), `ResumeWriteSchema`, `ResumeDerivedSchema`. Additive subpath export; nothing else in the package changes.
11
+ - `@nebutra/db` — `SleptonsResume` model + `ResumeLang` enum (migration `20260907000000_sleptons_resume`), 1:1 on `sleptons_member_profiles`, cascade delete. Not tenant-scoped, same as the other Sleptons tables.
12
+ - `@nebutra/sleptons` — `GET/PUT /api/resume` for the signed-in member: validate → derive (`headline`, `skills_flat`, `highlights`, `years_active`, `completeness`) → upsert. Plus a one-time importer for legacy CVise JSON exports.
13
+
14
+ Spec: `docs/superpowers/specs/2026-09-07-sleptons-resume-system-design.md`.
15
+
3
16
  ## 0.1.2
4
17
 
5
18
  ### Patch Changes
@@ -0,0 +1,433 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * Admin Contract — `nebutra.admin/v1`.
5
+ *
6
+ * Every Nebutra SaaS exposes one manifest describing the admin surface it
7
+ * owns: resources (nouns), actions (audited verbs, plan → apply), signals
8
+ * (probed facts) and policies (actions the system runs by itself). The
9
+ * platform admin renders any product from its manifest; an agent derives
10
+ * tools from it. Nothing product-specific lives in the renderer.
11
+ *
12
+ * See docs/plans/2026-09-08-admin-of-admins-model.md.
13
+ */
14
+ declare const ADMIN_CONTRACT_VERSION: "nebutra.admin/v1";
15
+ /** One status vocabulary. `unknown` is first-class and never renders green. */
16
+ declare const AdminStatusSchema: z.ZodEnum<{
17
+ healthy: "healthy";
18
+ degraded: "degraded";
19
+ down: "down";
20
+ unknown: "unknown";
21
+ }>;
22
+ type AdminStatus = z.infer<typeof AdminStatusSchema>;
23
+ /** One role ladder; product roles map onto it, staff grants mean the same everywhere. */
24
+ declare const StaffRoleSchema: z.ZodEnum<{
25
+ platform_readonly: "platform_readonly";
26
+ platform_support: "platform_support";
27
+ platform_operator: "platform_operator";
28
+ platform_owner: "platform_owner";
29
+ }>;
30
+ type StaffRole = z.infer<typeof StaffRoleSchema>;
31
+ declare const STAFF_ROLE_RANK: Record<StaffRole, number>;
32
+ declare function roleAtLeast(role: StaffRole, required: StaffRole): boolean;
33
+ declare const AdminSeveritySchema: z.ZodEnum<{
34
+ info: "info";
35
+ warn: "warn";
36
+ critical: "critical";
37
+ }>;
38
+ type AdminSeverity = z.infer<typeof AdminSeveritySchema>;
39
+ /** The canonical eleven. A product declares the subset it has. */
40
+ declare const AdminDomainIdSchema: z.ZodEnum<{
41
+ identity: "identity";
42
+ access: "access";
43
+ commerce: "commerce";
44
+ usage: "usage";
45
+ catalog: "catalog";
46
+ operations: "operations";
47
+ integrations: "integrations";
48
+ trust: "trust";
49
+ support: "support";
50
+ growth: "growth";
51
+ settings: "settings";
52
+ supply: "supply";
53
+ }>;
54
+ type AdminDomainId = z.infer<typeof AdminDomainIdSchema>;
55
+ declare const AdminColumnSchema: z.ZodObject<{
56
+ key: z.ZodString;
57
+ label: z.ZodString;
58
+ kind: z.ZodDefault<z.ZodEnum<{
59
+ number: "number";
60
+ text: "text";
61
+ mono: "mono";
62
+ status: "status";
63
+ badge: "badge";
64
+ time: "time";
65
+ link: "link";
66
+ }>>;
67
+ align: z.ZodDefault<z.ZodEnum<{
68
+ start: "start";
69
+ end: "end";
70
+ }>>;
71
+ }, z.core.$strip>;
72
+ type AdminColumn = z.infer<typeof AdminColumnSchema>;
73
+ declare const AdminResourceSchema: z.ZodObject<{
74
+ id: z.ZodString;
75
+ label: z.ZodString;
76
+ list: z.ZodString;
77
+ detail: z.ZodOptional<z.ZodString>;
78
+ columns: z.ZodArray<z.ZodObject<{
79
+ key: z.ZodString;
80
+ label: z.ZodString;
81
+ kind: z.ZodDefault<z.ZodEnum<{
82
+ number: "number";
83
+ text: "text";
84
+ mono: "mono";
85
+ status: "status";
86
+ badge: "badge";
87
+ time: "time";
88
+ link: "link";
89
+ }>>;
90
+ align: z.ZodDefault<z.ZodEnum<{
91
+ start: "start";
92
+ end: "end";
93
+ }>>;
94
+ }, z.core.$strip>>;
95
+ key: z.ZodDefault<z.ZodString>;
96
+ search: z.ZodDefault<z.ZodBoolean>;
97
+ actions: z.ZodDefault<z.ZodArray<z.ZodString>>;
98
+ }, z.core.$strip>;
99
+ type AdminResource = z.infer<typeof AdminResourceSchema>;
100
+ declare const AdminActionSchema: z.ZodObject<{
101
+ id: z.ZodString;
102
+ verb: z.ZodString;
103
+ resource: z.ZodOptional<z.ZodString>;
104
+ role: z.ZodEnum<{
105
+ platform_readonly: "platform_readonly";
106
+ platform_support: "platform_support";
107
+ platform_operator: "platform_operator";
108
+ platform_owner: "platform_owner";
109
+ }>;
110
+ url: z.ZodString;
111
+ plan: z.ZodDefault<z.ZodBoolean>;
112
+ destructive: z.ZodDefault<z.ZodBoolean>;
113
+ input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
114
+ description: z.ZodOptional<z.ZodString>;
115
+ }, z.core.$strip>;
116
+ type AdminAction = z.infer<typeof AdminActionSchema>;
117
+ declare const AdminSignalSchema: z.ZodObject<{
118
+ id: z.ZodString;
119
+ label: z.ZodString;
120
+ severity: z.ZodEnum<{
121
+ info: "info";
122
+ warn: "warn";
123
+ critical: "critical";
124
+ }>;
125
+ probe: z.ZodString;
126
+ resource: z.ZodOptional<z.ZodString>;
127
+ action: z.ZodOptional<z.ZodString>;
128
+ }, z.core.$strip>;
129
+ type AdminSignal = z.infer<typeof AdminSignalSchema>;
130
+ declare const AdminPolicySchema: z.ZodObject<{
131
+ id: z.ZodString;
132
+ label: z.ZodString;
133
+ on: z.ZodString;
134
+ runs: z.ZodString;
135
+ enabled: z.ZodDefault<z.ZodBoolean>;
136
+ intent: z.ZodOptional<z.ZodString>;
137
+ }, z.core.$strip>;
138
+ type AdminPolicy = z.infer<typeof AdminPolicySchema>;
139
+ declare const AdminDomainSchema: z.ZodObject<{
140
+ id: z.ZodEnum<{
141
+ identity: "identity";
142
+ access: "access";
143
+ commerce: "commerce";
144
+ usage: "usage";
145
+ catalog: "catalog";
146
+ operations: "operations";
147
+ integrations: "integrations";
148
+ trust: "trust";
149
+ support: "support";
150
+ growth: "growth";
151
+ settings: "settings";
152
+ supply: "supply";
153
+ }>;
154
+ label: z.ZodString;
155
+ resources: z.ZodDefault<z.ZodArray<z.ZodObject<{
156
+ id: z.ZodString;
157
+ label: z.ZodString;
158
+ list: z.ZodString;
159
+ detail: z.ZodOptional<z.ZodString>;
160
+ columns: z.ZodArray<z.ZodObject<{
161
+ key: z.ZodString;
162
+ label: z.ZodString;
163
+ kind: z.ZodDefault<z.ZodEnum<{
164
+ number: "number";
165
+ text: "text";
166
+ mono: "mono";
167
+ status: "status";
168
+ badge: "badge";
169
+ time: "time";
170
+ link: "link";
171
+ }>>;
172
+ align: z.ZodDefault<z.ZodEnum<{
173
+ start: "start";
174
+ end: "end";
175
+ }>>;
176
+ }, z.core.$strip>>;
177
+ key: z.ZodDefault<z.ZodString>;
178
+ search: z.ZodDefault<z.ZodBoolean>;
179
+ actions: z.ZodDefault<z.ZodArray<z.ZodString>>;
180
+ }, z.core.$strip>>>;
181
+ actions: z.ZodDefault<z.ZodArray<z.ZodObject<{
182
+ id: z.ZodString;
183
+ verb: z.ZodString;
184
+ resource: z.ZodOptional<z.ZodString>;
185
+ role: z.ZodEnum<{
186
+ platform_readonly: "platform_readonly";
187
+ platform_support: "platform_support";
188
+ platform_operator: "platform_operator";
189
+ platform_owner: "platform_owner";
190
+ }>;
191
+ url: z.ZodString;
192
+ plan: z.ZodDefault<z.ZodBoolean>;
193
+ destructive: z.ZodDefault<z.ZodBoolean>;
194
+ input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
195
+ description: z.ZodOptional<z.ZodString>;
196
+ }, z.core.$strip>>>;
197
+ signals: z.ZodDefault<z.ZodArray<z.ZodObject<{
198
+ id: z.ZodString;
199
+ label: z.ZodString;
200
+ severity: z.ZodEnum<{
201
+ info: "info";
202
+ warn: "warn";
203
+ critical: "critical";
204
+ }>;
205
+ probe: z.ZodString;
206
+ resource: z.ZodOptional<z.ZodString>;
207
+ action: z.ZodOptional<z.ZodString>;
208
+ }, z.core.$strip>>>;
209
+ policies: z.ZodDefault<z.ZodArray<z.ZodObject<{
210
+ id: z.ZodString;
211
+ label: z.ZodString;
212
+ on: z.ZodString;
213
+ runs: z.ZodString;
214
+ enabled: z.ZodDefault<z.ZodBoolean>;
215
+ intent: z.ZodOptional<z.ZodString>;
216
+ }, z.core.$strip>>>;
217
+ slot: z.ZodOptional<z.ZodString>;
218
+ }, z.core.$strip>;
219
+ type AdminDomain = z.infer<typeof AdminDomainSchema>;
220
+ declare const AdminManifestSchema: z.ZodObject<{
221
+ contract: z.ZodLiteral<"nebutra.admin/v1">;
222
+ product: z.ZodString;
223
+ label: z.ZodString;
224
+ version: z.ZodString;
225
+ origin: z.ZodString;
226
+ graph: z.ZodEnum<{
227
+ core: "core";
228
+ runtime: "runtime";
229
+ labs: "labs";
230
+ }>;
231
+ status: z.ZodEnum<{
232
+ stable: "stable";
233
+ foundation: "foundation";
234
+ wip: "wip";
235
+ experimental: "experimental";
236
+ }>;
237
+ health: z.ZodString;
238
+ audit: z.ZodOptional<z.ZodString>;
239
+ domains: z.ZodArray<z.ZodObject<{
240
+ id: z.ZodEnum<{
241
+ identity: "identity";
242
+ access: "access";
243
+ commerce: "commerce";
244
+ usage: "usage";
245
+ catalog: "catalog";
246
+ operations: "operations";
247
+ integrations: "integrations";
248
+ trust: "trust";
249
+ support: "support";
250
+ growth: "growth";
251
+ settings: "settings";
252
+ supply: "supply";
253
+ }>;
254
+ label: z.ZodString;
255
+ resources: z.ZodDefault<z.ZodArray<z.ZodObject<{
256
+ id: z.ZodString;
257
+ label: z.ZodString;
258
+ list: z.ZodString;
259
+ detail: z.ZodOptional<z.ZodString>;
260
+ columns: z.ZodArray<z.ZodObject<{
261
+ key: z.ZodString;
262
+ label: z.ZodString;
263
+ kind: z.ZodDefault<z.ZodEnum<{
264
+ number: "number";
265
+ text: "text";
266
+ mono: "mono";
267
+ status: "status";
268
+ badge: "badge";
269
+ time: "time";
270
+ link: "link";
271
+ }>>;
272
+ align: z.ZodDefault<z.ZodEnum<{
273
+ start: "start";
274
+ end: "end";
275
+ }>>;
276
+ }, z.core.$strip>>;
277
+ key: z.ZodDefault<z.ZodString>;
278
+ search: z.ZodDefault<z.ZodBoolean>;
279
+ actions: z.ZodDefault<z.ZodArray<z.ZodString>>;
280
+ }, z.core.$strip>>>;
281
+ actions: z.ZodDefault<z.ZodArray<z.ZodObject<{
282
+ id: z.ZodString;
283
+ verb: z.ZodString;
284
+ resource: z.ZodOptional<z.ZodString>;
285
+ role: z.ZodEnum<{
286
+ platform_readonly: "platform_readonly";
287
+ platform_support: "platform_support";
288
+ platform_operator: "platform_operator";
289
+ platform_owner: "platform_owner";
290
+ }>;
291
+ url: z.ZodString;
292
+ plan: z.ZodDefault<z.ZodBoolean>;
293
+ destructive: z.ZodDefault<z.ZodBoolean>;
294
+ input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
295
+ description: z.ZodOptional<z.ZodString>;
296
+ }, z.core.$strip>>>;
297
+ signals: z.ZodDefault<z.ZodArray<z.ZodObject<{
298
+ id: z.ZodString;
299
+ label: z.ZodString;
300
+ severity: z.ZodEnum<{
301
+ info: "info";
302
+ warn: "warn";
303
+ critical: "critical";
304
+ }>;
305
+ probe: z.ZodString;
306
+ resource: z.ZodOptional<z.ZodString>;
307
+ action: z.ZodOptional<z.ZodString>;
308
+ }, z.core.$strip>>>;
309
+ policies: z.ZodDefault<z.ZodArray<z.ZodObject<{
310
+ id: z.ZodString;
311
+ label: z.ZodString;
312
+ on: z.ZodString;
313
+ runs: z.ZodString;
314
+ enabled: z.ZodDefault<z.ZodBoolean>;
315
+ intent: z.ZodOptional<z.ZodString>;
316
+ }, z.core.$strip>>>;
317
+ slot: z.ZodOptional<z.ZodString>;
318
+ }, z.core.$strip>>;
319
+ }, z.core.$strip>;
320
+ type AdminManifest = z.infer<typeof AdminManifestSchema>;
321
+ declare const ResourceListSchema: z.ZodObject<{
322
+ items: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
323
+ total: z.ZodNumber;
324
+ probedAt: z.ZodOptional<z.ZodString>;
325
+ }, z.core.$strip>;
326
+ type ResourceList = z.infer<typeof ResourceListSchema>;
327
+ declare const ActionRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
328
+ mode: z.ZodLiteral<"plan">;
329
+ input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
330
+ }, z.core.$strip>, z.ZodObject<{
331
+ mode: z.ZodLiteral<"apply">;
332
+ input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
333
+ planId: z.ZodOptional<z.ZodString>;
334
+ }, z.core.$strip>], "mode">;
335
+ type ActionRequest = z.infer<typeof ActionRequestSchema>;
336
+ declare const PlanDiffEntrySchema: z.ZodObject<{
337
+ op: z.ZodEnum<{
338
+ add: "add";
339
+ remove: "remove";
340
+ change: "change";
341
+ }>;
342
+ path: z.ZodString;
343
+ from: z.ZodOptional<z.ZodUnknown>;
344
+ to: z.ZodOptional<z.ZodUnknown>;
345
+ }, z.core.$strip>;
346
+ declare const ActionPlanSchema: z.ZodObject<{
347
+ planId: z.ZodString;
348
+ summary: z.ZodString;
349
+ diff: z.ZodArray<z.ZodObject<{
350
+ op: z.ZodEnum<{
351
+ add: "add";
352
+ remove: "remove";
353
+ change: "change";
354
+ }>;
355
+ path: z.ZodString;
356
+ from: z.ZodOptional<z.ZodUnknown>;
357
+ to: z.ZodOptional<z.ZodUnknown>;
358
+ }, z.core.$strip>>;
359
+ affected: z.ZodDefault<z.ZodArray<z.ZodObject<{
360
+ resource: z.ZodString;
361
+ id: z.ZodString;
362
+ label: z.ZodOptional<z.ZodString>;
363
+ }, z.core.$strip>>>;
364
+ warnings: z.ZodDefault<z.ZodArray<z.ZodString>>;
365
+ expiresAt: z.ZodString;
366
+ }, z.core.$strip>;
367
+ type ActionPlan = z.infer<typeof ActionPlanSchema>;
368
+ declare const ActionResultSchema: z.ZodObject<{
369
+ auditId: z.ZodString;
370
+ summary: z.ZodString;
371
+ result: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
372
+ }, z.core.$strip>;
373
+ type ActionResult = z.infer<typeof ActionResultSchema>;
374
+ declare const SignalReadingSchema: z.ZodObject<{
375
+ id: z.ZodString;
376
+ status: z.ZodEnum<{
377
+ unknown: "unknown";
378
+ ok: "ok";
379
+ raised: "raised";
380
+ }>;
381
+ severity: z.ZodEnum<{
382
+ info: "info";
383
+ warn: "warn";
384
+ critical: "critical";
385
+ }>;
386
+ probedAt: z.ZodString;
387
+ title: z.ZodOptional<z.ZodString>;
388
+ detail: z.ZodOptional<z.ZodString>;
389
+ resource: z.ZodOptional<z.ZodString>;
390
+ action: z.ZodOptional<z.ZodString>;
391
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
392
+ }, z.core.$strip>;
393
+ type SignalReading = z.infer<typeof SignalReadingSchema>;
394
+ /** Standard error body for contract endpoints. */
395
+ declare const AdminErrorSchema: z.ZodObject<{
396
+ error: z.ZodObject<{
397
+ code: z.ZodEnum<{
398
+ unauthenticated: "unauthenticated";
399
+ forbidden: "forbidden";
400
+ not_found: "not_found";
401
+ invalid_input: "invalid_input";
402
+ plan_required: "plan_required";
403
+ plan_expired: "plan_expired";
404
+ upstream_unavailable: "upstream_unavailable";
405
+ internal: "internal";
406
+ }>;
407
+ message: z.ZodString;
408
+ }, z.core.$strip>;
409
+ }, z.core.$strip>;
410
+ type AdminError = z.infer<typeof AdminErrorSchema>;
411
+ /** Validate an apply against its action: destructive applies must reference a plan. */
412
+ declare function assertApplyAllowed(action: AdminAction, request: ActionRequest): AdminError | null;
413
+ /** Resolve a contract path against the manifest origin. */
414
+ declare function resolveContractUrl(manifest: Pick<AdminManifest, "origin">, path: string): string;
415
+ /**
416
+ * The HTTP status an admin error travels as.
417
+ *
418
+ * Cloudflare sits in front of every admin and product host, and it replaces an
419
+ * origin's `502` or `504` with its own branded HTML error page. The body we
420
+ * wrote — the code and the message the operator needs — is discarded before the
421
+ * browser sees it, so the console can only report `network · HTTP 502`. A
422
+ * contract endpoint therefore never answers with a gateway status: an upstream
423
+ * that failed is `503`, and a fault of our own is `500`. Both reach the client
424
+ * with their JSON envelope intact.
425
+ */
426
+ declare const ADMIN_ERROR_STATUS: Record<AdminError["error"]["code"], number>;
427
+ /**
428
+ * Narrow an arbitrary status to one that survives the CDN, preserving anything
429
+ * already safe. Use it when echoing an upstream contract call's status.
430
+ */
431
+ declare function cdnSafeStatus(status: number | undefined, fallback?: number): number;
432
+
433
+ export { ADMIN_CONTRACT_VERSION, ADMIN_ERROR_STATUS, type ActionPlan, ActionPlanSchema, type ActionRequest, ActionRequestSchema, type ActionResult, ActionResultSchema, type AdminAction, AdminActionSchema, type AdminColumn, AdminColumnSchema, type AdminDomain, type AdminDomainId, AdminDomainIdSchema, AdminDomainSchema, type AdminError, AdminErrorSchema, type AdminManifest, AdminManifestSchema, type AdminPolicy, AdminPolicySchema, type AdminResource, AdminResourceSchema, type AdminSeverity, AdminSeveritySchema, type AdminSignal, AdminSignalSchema, type AdminStatus, AdminStatusSchema, PlanDiffEntrySchema, type ResourceList, ResourceListSchema, STAFF_ROLE_RANK, type SignalReading, SignalReadingSchema, type StaffRole, StaffRoleSchema, assertApplyAllowed, cdnSafeStatus, resolveContractUrl, roleAtLeast };
package/dist/admin.js ADDED
@@ -0,0 +1,55 @@
1
+ import {
2
+ ADMIN_CONTRACT_VERSION,
3
+ ADMIN_ERROR_STATUS,
4
+ ActionPlanSchema,
5
+ ActionRequestSchema,
6
+ ActionResultSchema,
7
+ AdminActionSchema,
8
+ AdminColumnSchema,
9
+ AdminDomainIdSchema,
10
+ AdminDomainSchema,
11
+ AdminErrorSchema,
12
+ AdminManifestSchema,
13
+ AdminPolicySchema,
14
+ AdminResourceSchema,
15
+ AdminSeveritySchema,
16
+ AdminSignalSchema,
17
+ AdminStatusSchema,
18
+ PlanDiffEntrySchema,
19
+ ResourceListSchema,
20
+ STAFF_ROLE_RANK,
21
+ SignalReadingSchema,
22
+ StaffRoleSchema,
23
+ assertApplyAllowed,
24
+ cdnSafeStatus,
25
+ resolveContractUrl,
26
+ roleAtLeast
27
+ } from "./chunk-G65TWQGE.js";
28
+ export {
29
+ ADMIN_CONTRACT_VERSION,
30
+ ADMIN_ERROR_STATUS,
31
+ ActionPlanSchema,
32
+ ActionRequestSchema,
33
+ ActionResultSchema,
34
+ AdminActionSchema,
35
+ AdminColumnSchema,
36
+ AdminDomainIdSchema,
37
+ AdminDomainSchema,
38
+ AdminErrorSchema,
39
+ AdminManifestSchema,
40
+ AdminPolicySchema,
41
+ AdminResourceSchema,
42
+ AdminSeveritySchema,
43
+ AdminSignalSchema,
44
+ AdminStatusSchema,
45
+ PlanDiffEntrySchema,
46
+ ResourceListSchema,
47
+ STAFF_ROLE_RANK,
48
+ SignalReadingSchema,
49
+ StaffRoleSchema,
50
+ assertApplyAllowed,
51
+ cdnSafeStatus,
52
+ resolveContractUrl,
53
+ roleAtLeast
54
+ };
55
+ //# sourceMappingURL=admin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -8,9 +8,9 @@ var NotificationFrequencyContractSchema = z.enum([
8
8
  "never"
9
9
  ]);
10
10
  var NotificationRuntimeStatusContractSchema = z.object({
11
- provider: z.enum(["novu", "direct"]),
11
+ provider: z.enum(["direct"]),
12
12
  providerLabel: z.string().min(1),
13
- mode: z.enum(["managed", "self_hosted", "preview", "degraded"]),
13
+ mode: z.enum(["self_hosted", "preview"]),
14
14
  canManagePreferences: z.boolean(),
15
15
  canViewInbox: z.boolean(),
16
16
  canMarkInboxRead: z.boolean(),
@@ -82,4 +82,4 @@ export {
82
82
  NotificationSettingsUpdateRequestContractSchema,
83
83
  NotificationSettingsUpdateResponseContractSchema
84
84
  };
85
- //# sourceMappingURL=chunk-F4BR76CX.js.map
85
+ //# sourceMappingURL=chunk-BX2ZIODN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/notifications.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const NotificationChannelContractSchema = z.enum([\"in_app\", \"email\", \"push\", \"sms\", \"chat\"]);\nexport type NotificationChannelContract = z.infer<typeof NotificationChannelContractSchema>;\n\nexport const NotificationFrequencyContractSchema = z.enum([\n \"immediate\",\n \"daily\",\n \"weekly\",\n \"never\",\n]);\nexport type NotificationFrequencyContract = z.infer<typeof NotificationFrequencyContractSchema>;\n\nexport const NotificationRuntimeStatusContractSchema = z.object({\n provider: z.enum([\"direct\"]),\n providerLabel: z.string().min(1),\n mode: z.enum([\"self_hosted\", \"preview\"]),\n canManagePreferences: z.boolean(),\n canViewInbox: z.boolean(),\n canMarkInboxRead: z.boolean(),\n summary: z.string().min(1),\n reason: z.string().optional(),\n missing: z.array(z.string()),\n});\nexport type NotificationRuntimeStatusContract = z.infer<\n typeof NotificationRuntimeStatusContractSchema\n>;\n\nexport const NotificationPreferenceContractSchema = z.object({\n userId: z.string().min(1),\n tenantId: z.string().min(1).optional(),\n channel: NotificationChannelContractSchema,\n enabled: z.boolean(),\n disabledCategories: z.array(z.string()).optional(),\n frequency: NotificationFrequencyContractSchema,\n updatedAt: z.string().datetime().optional(),\n});\nexport type NotificationPreferenceContract = z.infer<typeof NotificationPreferenceContractSchema>;\n\nexport const NotificationItemContractSchema = z.object({\n id: z.string().min(1),\n userId: z.string().min(1),\n tenantId: z.string().min(1).optional(),\n type: z.string().min(1),\n title: z.string(),\n body: z.string(),\n data: z.record(z.string(), z.unknown()).optional(),\n read: z.boolean(),\n createdAt: z.string().datetime(),\n updatedAt: z.string().datetime(),\n});\nexport type NotificationItemContract = z.infer<typeof NotificationItemContractSchema>;\n\nexport const NotificationListQueryContractSchema = z.object({\n limit: z.coerce.number().int().min(1).max(100).default(50),\n offset: z.coerce.number().int().min(0).default(0),\n unreadOnly: z.coerce.boolean().optional(),\n});\nexport type NotificationListQueryContract = z.infer<typeof NotificationListQueryContractSchema>;\n\nexport const NotificationListResponseContractSchema = z.object({\n items: z.array(NotificationItemContractSchema),\n total: z.number().int().nonnegative(),\n unreadCount: z.number().int().nonnegative(),\n});\nexport type NotificationListResponseContract = z.infer<\n typeof NotificationListResponseContractSchema\n>;\n\nexport const NotificationUnreadCountResponseContractSchema = z.object({\n count: z.number().int().nonnegative(),\n});\nexport type NotificationUnreadCountResponseContract = z.infer<\n typeof NotificationUnreadCountResponseContractSchema\n>;\n\nexport const NotificationMarkReadRequestContractSchema = z.object({\n ids: z.array(z.string().min(1)).min(1).max(100),\n});\nexport type NotificationMarkReadRequestContract = z.infer<\n typeof NotificationMarkReadRequestContractSchema\n>;\n\nexport const NotificationMutationCountResponseContractSchema = z.object({\n count: z.number().int().nonnegative(),\n});\nexport type NotificationMutationCountResponseContract = z.infer<\n typeof NotificationMutationCountResponseContractSchema\n>;\n\nexport const NotificationSettingsUpdateRequestContractSchema = z.object({\n type: z.string().min(1),\n channel: NotificationChannelContractSchema,\n enabled: z.boolean(),\n});\nexport type NotificationSettingsUpdateRequestContract = z.infer<\n typeof NotificationSettingsUpdateRequestContractSchema\n>;\n\nexport const NotificationSettingsUpdateResponseContractSchema = z.object({\n ok: z.literal(true),\n preference: NotificationPreferenceContractSchema,\n});\nexport type NotificationSettingsUpdateResponseContract = z.infer<\n typeof NotificationSettingsUpdateResponseContractSchema\n>;\n"],"mappings":";AAAA,SAAS,SAAS;AAEX,IAAM,oCAAoC,EAAE,KAAK,CAAC,UAAU,SAAS,QAAQ,OAAO,MAAM,CAAC;AAG3F,IAAM,sCAAsC,EAAE,KAAK;AAAA,EACxD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGM,IAAM,0CAA0C,EAAE,OAAO;AAAA,EAC9D,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC;AAAA,EAC3B,eAAe,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EAC/B,MAAM,EAAE,KAAK,CAAC,eAAe,SAAS,CAAC;AAAA,EACvC,sBAAsB,EAAE,QAAQ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