@classytic/access 0.3.0 → 0.4.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/CHANGELOG.md +3 -74
- package/README.md +11 -13
- package/dist/domain/access-decision.d.mts +13 -44
- package/dist/domain/access-decision.mjs +40 -18
- package/dist/event-catalog-CIxQavRC.mjs +480 -0
- package/dist/event-catalog-DarRYj3Y.d.mts +358 -0
- package/dist/events/event-catalog.d.mts +2 -2
- package/dist/events/event-catalog.mjs +2 -2
- package/dist/index.d.mts +203 -438
- package/dist/index.mjs +598 -1133
- package/dist/schemas/entitlement.d.mts +16 -10
- package/dist/schemas/entitlement.mjs +19 -14
- package/llms.txt +27 -0
- package/package.json +18 -11
- package/skills/access/SKILL.md +116 -0
- package/skills/access/references/events-errors.md +46 -0
- package/skills/access/references/repository.md +72 -0
- package/skills/access/references/wiring.md +60 -0
- package/dist/event-catalog-BVD_rFlc.mjs +0 -111
- package/dist/event-catalog-Dxo3cxR3.d.mts +0 -136
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
import { DomainEvent, EventMeta } from "@classytic/primitives/events";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/events/event-constants.d.ts
|
|
4
|
+
/** ACCESS_EVENTS — the event names `@classytic/access` publishes. Subscribe by constant, never by literal. */
|
|
5
|
+
declare const ACCESS_EVENTS: {
|
|
6
|
+
readonly GRANTED: "access:granted";
|
|
7
|
+
readonly EXTENDED: "access:extended";
|
|
8
|
+
readonly SUSPENDED: "access:suspended";
|
|
9
|
+
readonly RESUMED: "access:resumed";
|
|
10
|
+
readonly REVOKED: "access:revoked";
|
|
11
|
+
readonly EXPIRED: "access:expired";
|
|
12
|
+
readonly CONSUMED: "access:consumed";
|
|
13
|
+
readonly EXHAUSTED: "access:exhausted";
|
|
14
|
+
readonly REFUNDED: "access:refunded";
|
|
15
|
+
};
|
|
16
|
+
type AccessEventName = (typeof ACCESS_EVENTS)[keyof typeof ACCESS_EVENTS];
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/events/event-catalog.d.ts
|
|
19
|
+
/** The payload JSON Schema — the object shape event registries (arc's `EventSchema`) accept. */
|
|
20
|
+
interface AccessEventSchema {
|
|
21
|
+
type: 'object';
|
|
22
|
+
properties?: Record<string, {
|
|
23
|
+
type?: string;
|
|
24
|
+
[key: string]: unknown;
|
|
25
|
+
}>;
|
|
26
|
+
required?: string[];
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
}
|
|
29
|
+
interface AccessEventDefinition<TSchema extends z.ZodType = z.ZodType> {
|
|
30
|
+
name: AccessEventName;
|
|
31
|
+
version: number;
|
|
32
|
+
description: string;
|
|
33
|
+
zodSchema: TSchema;
|
|
34
|
+
/** The same schema, under the name event registries validate with. */
|
|
35
|
+
payloadSchema: TSchema;
|
|
36
|
+
schema: AccessEventSchema;
|
|
37
|
+
create(payload: z.infer<TSchema>, meta?: Partial<EventMeta>): DomainEvent<z.infer<TSchema>>;
|
|
38
|
+
}
|
|
39
|
+
declare const Granted: AccessEventDefinition<z.ZodObject<{
|
|
40
|
+
entitlementId: z.ZodString;
|
|
41
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
42
|
+
subjectRef: z.ZodString;
|
|
43
|
+
subjectModel: z.ZodString;
|
|
44
|
+
resourceRef: z.ZodString;
|
|
45
|
+
resourceType: z.ZodString;
|
|
46
|
+
scopeKey: z.ZodString;
|
|
47
|
+
status: z.ZodEnum<{
|
|
48
|
+
active: "active";
|
|
49
|
+
suspended: "suspended";
|
|
50
|
+
expired: "expired";
|
|
51
|
+
consumed: "consumed";
|
|
52
|
+
revoked: "revoked";
|
|
53
|
+
refunded: "refunded";
|
|
54
|
+
}>;
|
|
55
|
+
allowed: z.ZodBoolean;
|
|
56
|
+
reason: z.ZodEnum<{
|
|
57
|
+
active: "active";
|
|
58
|
+
suspended: "suspended";
|
|
59
|
+
expired: "expired";
|
|
60
|
+
consumed: "consumed";
|
|
61
|
+
revoked: "revoked";
|
|
62
|
+
refunded: "refunded";
|
|
63
|
+
not_found: "not_found";
|
|
64
|
+
not_yet_active: "not_yet_active";
|
|
65
|
+
quota_exhausted: "quota_exhausted";
|
|
66
|
+
invalid_grant: "invalid_grant";
|
|
67
|
+
}>;
|
|
68
|
+
originModel: z.ZodOptional<z.ZodString>;
|
|
69
|
+
originRef: z.ZodOptional<z.ZodString>;
|
|
70
|
+
accessExpiresAt: z.ZodOptional<z.ZodISODateTime>;
|
|
71
|
+
usageLimit: z.ZodOptional<z.ZodNumber>;
|
|
72
|
+
usageUsed: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
}, z.core.$strip>>;
|
|
74
|
+
declare const Extended: AccessEventDefinition<z.ZodObject<{
|
|
75
|
+
entitlementId: z.ZodString;
|
|
76
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
77
|
+
subjectRef: z.ZodString;
|
|
78
|
+
subjectModel: z.ZodString;
|
|
79
|
+
resourceRef: z.ZodString;
|
|
80
|
+
resourceType: z.ZodString;
|
|
81
|
+
scopeKey: z.ZodString;
|
|
82
|
+
status: z.ZodEnum<{
|
|
83
|
+
active: "active";
|
|
84
|
+
suspended: "suspended";
|
|
85
|
+
expired: "expired";
|
|
86
|
+
consumed: "consumed";
|
|
87
|
+
revoked: "revoked";
|
|
88
|
+
refunded: "refunded";
|
|
89
|
+
}>;
|
|
90
|
+
allowed: z.ZodBoolean;
|
|
91
|
+
reason: z.ZodEnum<{
|
|
92
|
+
active: "active";
|
|
93
|
+
suspended: "suspended";
|
|
94
|
+
expired: "expired";
|
|
95
|
+
consumed: "consumed";
|
|
96
|
+
revoked: "revoked";
|
|
97
|
+
refunded: "refunded";
|
|
98
|
+
not_found: "not_found";
|
|
99
|
+
not_yet_active: "not_yet_active";
|
|
100
|
+
quota_exhausted: "quota_exhausted";
|
|
101
|
+
invalid_grant: "invalid_grant";
|
|
102
|
+
}>;
|
|
103
|
+
originModel: z.ZodOptional<z.ZodString>;
|
|
104
|
+
originRef: z.ZodOptional<z.ZodString>;
|
|
105
|
+
accessExpiresAt: z.ZodOptional<z.ZodISODateTime>;
|
|
106
|
+
usageLimit: z.ZodOptional<z.ZodNumber>;
|
|
107
|
+
usageUsed: z.ZodOptional<z.ZodNumber>;
|
|
108
|
+
}, z.core.$strip>>;
|
|
109
|
+
declare const Suspended: AccessEventDefinition<z.ZodObject<{
|
|
110
|
+
entitlementId: z.ZodString;
|
|
111
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
112
|
+
subjectRef: z.ZodString;
|
|
113
|
+
subjectModel: z.ZodString;
|
|
114
|
+
resourceRef: z.ZodString;
|
|
115
|
+
resourceType: z.ZodString;
|
|
116
|
+
scopeKey: z.ZodString;
|
|
117
|
+
status: z.ZodEnum<{
|
|
118
|
+
active: "active";
|
|
119
|
+
suspended: "suspended";
|
|
120
|
+
expired: "expired";
|
|
121
|
+
consumed: "consumed";
|
|
122
|
+
revoked: "revoked";
|
|
123
|
+
refunded: "refunded";
|
|
124
|
+
}>;
|
|
125
|
+
allowed: z.ZodBoolean;
|
|
126
|
+
reason: z.ZodEnum<{
|
|
127
|
+
active: "active";
|
|
128
|
+
suspended: "suspended";
|
|
129
|
+
expired: "expired";
|
|
130
|
+
consumed: "consumed";
|
|
131
|
+
revoked: "revoked";
|
|
132
|
+
refunded: "refunded";
|
|
133
|
+
not_found: "not_found";
|
|
134
|
+
not_yet_active: "not_yet_active";
|
|
135
|
+
quota_exhausted: "quota_exhausted";
|
|
136
|
+
invalid_grant: "invalid_grant";
|
|
137
|
+
}>;
|
|
138
|
+
originModel: z.ZodOptional<z.ZodString>;
|
|
139
|
+
originRef: z.ZodOptional<z.ZodString>;
|
|
140
|
+
accessExpiresAt: z.ZodOptional<z.ZodISODateTime>;
|
|
141
|
+
usageLimit: z.ZodOptional<z.ZodNumber>;
|
|
142
|
+
usageUsed: z.ZodOptional<z.ZodNumber>;
|
|
143
|
+
}, z.core.$strip>>;
|
|
144
|
+
declare const Resumed: AccessEventDefinition<z.ZodObject<{
|
|
145
|
+
entitlementId: z.ZodString;
|
|
146
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
147
|
+
subjectRef: z.ZodString;
|
|
148
|
+
subjectModel: z.ZodString;
|
|
149
|
+
resourceRef: z.ZodString;
|
|
150
|
+
resourceType: z.ZodString;
|
|
151
|
+
scopeKey: z.ZodString;
|
|
152
|
+
status: z.ZodEnum<{
|
|
153
|
+
active: "active";
|
|
154
|
+
suspended: "suspended";
|
|
155
|
+
expired: "expired";
|
|
156
|
+
consumed: "consumed";
|
|
157
|
+
revoked: "revoked";
|
|
158
|
+
refunded: "refunded";
|
|
159
|
+
}>;
|
|
160
|
+
allowed: z.ZodBoolean;
|
|
161
|
+
reason: z.ZodEnum<{
|
|
162
|
+
active: "active";
|
|
163
|
+
suspended: "suspended";
|
|
164
|
+
expired: "expired";
|
|
165
|
+
consumed: "consumed";
|
|
166
|
+
revoked: "revoked";
|
|
167
|
+
refunded: "refunded";
|
|
168
|
+
not_found: "not_found";
|
|
169
|
+
not_yet_active: "not_yet_active";
|
|
170
|
+
quota_exhausted: "quota_exhausted";
|
|
171
|
+
invalid_grant: "invalid_grant";
|
|
172
|
+
}>;
|
|
173
|
+
originModel: z.ZodOptional<z.ZodString>;
|
|
174
|
+
originRef: z.ZodOptional<z.ZodString>;
|
|
175
|
+
accessExpiresAt: z.ZodOptional<z.ZodISODateTime>;
|
|
176
|
+
usageLimit: z.ZodOptional<z.ZodNumber>;
|
|
177
|
+
usageUsed: z.ZodOptional<z.ZodNumber>;
|
|
178
|
+
}, z.core.$strip>>;
|
|
179
|
+
declare const Revoked: AccessEventDefinition<z.ZodObject<{
|
|
180
|
+
entitlementId: z.ZodString;
|
|
181
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
182
|
+
subjectRef: z.ZodString;
|
|
183
|
+
subjectModel: z.ZodString;
|
|
184
|
+
resourceRef: z.ZodString;
|
|
185
|
+
resourceType: z.ZodString;
|
|
186
|
+
scopeKey: z.ZodString;
|
|
187
|
+
status: z.ZodEnum<{
|
|
188
|
+
active: "active";
|
|
189
|
+
suspended: "suspended";
|
|
190
|
+
expired: "expired";
|
|
191
|
+
consumed: "consumed";
|
|
192
|
+
revoked: "revoked";
|
|
193
|
+
refunded: "refunded";
|
|
194
|
+
}>;
|
|
195
|
+
allowed: z.ZodBoolean;
|
|
196
|
+
reason: z.ZodEnum<{
|
|
197
|
+
active: "active";
|
|
198
|
+
suspended: "suspended";
|
|
199
|
+
expired: "expired";
|
|
200
|
+
consumed: "consumed";
|
|
201
|
+
revoked: "revoked";
|
|
202
|
+
refunded: "refunded";
|
|
203
|
+
not_found: "not_found";
|
|
204
|
+
not_yet_active: "not_yet_active";
|
|
205
|
+
quota_exhausted: "quota_exhausted";
|
|
206
|
+
invalid_grant: "invalid_grant";
|
|
207
|
+
}>;
|
|
208
|
+
originModel: z.ZodOptional<z.ZodString>;
|
|
209
|
+
originRef: z.ZodOptional<z.ZodString>;
|
|
210
|
+
accessExpiresAt: z.ZodOptional<z.ZodISODateTime>;
|
|
211
|
+
usageLimit: z.ZodOptional<z.ZodNumber>;
|
|
212
|
+
usageUsed: z.ZodOptional<z.ZodNumber>;
|
|
213
|
+
}, z.core.$strip>>;
|
|
214
|
+
declare const Expired: AccessEventDefinition<z.ZodObject<{
|
|
215
|
+
entitlementId: z.ZodString;
|
|
216
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
217
|
+
subjectRef: z.ZodString;
|
|
218
|
+
subjectModel: z.ZodString;
|
|
219
|
+
resourceRef: z.ZodString;
|
|
220
|
+
resourceType: z.ZodString;
|
|
221
|
+
scopeKey: z.ZodString;
|
|
222
|
+
status: z.ZodEnum<{
|
|
223
|
+
active: "active";
|
|
224
|
+
suspended: "suspended";
|
|
225
|
+
expired: "expired";
|
|
226
|
+
consumed: "consumed";
|
|
227
|
+
revoked: "revoked";
|
|
228
|
+
refunded: "refunded";
|
|
229
|
+
}>;
|
|
230
|
+
allowed: z.ZodBoolean;
|
|
231
|
+
reason: z.ZodEnum<{
|
|
232
|
+
active: "active";
|
|
233
|
+
suspended: "suspended";
|
|
234
|
+
expired: "expired";
|
|
235
|
+
consumed: "consumed";
|
|
236
|
+
revoked: "revoked";
|
|
237
|
+
refunded: "refunded";
|
|
238
|
+
not_found: "not_found";
|
|
239
|
+
not_yet_active: "not_yet_active";
|
|
240
|
+
quota_exhausted: "quota_exhausted";
|
|
241
|
+
invalid_grant: "invalid_grant";
|
|
242
|
+
}>;
|
|
243
|
+
originModel: z.ZodOptional<z.ZodString>;
|
|
244
|
+
originRef: z.ZodOptional<z.ZodString>;
|
|
245
|
+
accessExpiresAt: z.ZodOptional<z.ZodISODateTime>;
|
|
246
|
+
usageLimit: z.ZodOptional<z.ZodNumber>;
|
|
247
|
+
usageUsed: z.ZodOptional<z.ZodNumber>;
|
|
248
|
+
}, z.core.$strip>>;
|
|
249
|
+
declare const Consumed: AccessEventDefinition<z.ZodObject<{
|
|
250
|
+
entitlementId: z.ZodString;
|
|
251
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
252
|
+
subjectRef: z.ZodString;
|
|
253
|
+
subjectModel: z.ZodString;
|
|
254
|
+
resourceRef: z.ZodString;
|
|
255
|
+
resourceType: z.ZodString;
|
|
256
|
+
scopeKey: z.ZodString;
|
|
257
|
+
status: z.ZodEnum<{
|
|
258
|
+
active: "active";
|
|
259
|
+
suspended: "suspended";
|
|
260
|
+
expired: "expired";
|
|
261
|
+
consumed: "consumed";
|
|
262
|
+
revoked: "revoked";
|
|
263
|
+
refunded: "refunded";
|
|
264
|
+
}>;
|
|
265
|
+
allowed: z.ZodBoolean;
|
|
266
|
+
reason: z.ZodEnum<{
|
|
267
|
+
active: "active";
|
|
268
|
+
suspended: "suspended";
|
|
269
|
+
expired: "expired";
|
|
270
|
+
consumed: "consumed";
|
|
271
|
+
revoked: "revoked";
|
|
272
|
+
refunded: "refunded";
|
|
273
|
+
not_found: "not_found";
|
|
274
|
+
not_yet_active: "not_yet_active";
|
|
275
|
+
quota_exhausted: "quota_exhausted";
|
|
276
|
+
invalid_grant: "invalid_grant";
|
|
277
|
+
}>;
|
|
278
|
+
originModel: z.ZodOptional<z.ZodString>;
|
|
279
|
+
originRef: z.ZodOptional<z.ZodString>;
|
|
280
|
+
accessExpiresAt: z.ZodOptional<z.ZodISODateTime>;
|
|
281
|
+
usageLimit: z.ZodOptional<z.ZodNumber>;
|
|
282
|
+
usageUsed: z.ZodOptional<z.ZodNumber>;
|
|
283
|
+
consumptionKey: z.ZodString;
|
|
284
|
+
amount: z.ZodNumber;
|
|
285
|
+
}, z.core.$strip>>;
|
|
286
|
+
declare const Exhausted: AccessEventDefinition<z.ZodObject<{
|
|
287
|
+
entitlementId: z.ZodString;
|
|
288
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
289
|
+
subjectRef: z.ZodString;
|
|
290
|
+
subjectModel: z.ZodString;
|
|
291
|
+
resourceRef: z.ZodString;
|
|
292
|
+
resourceType: z.ZodString;
|
|
293
|
+
scopeKey: z.ZodString;
|
|
294
|
+
status: z.ZodEnum<{
|
|
295
|
+
active: "active";
|
|
296
|
+
suspended: "suspended";
|
|
297
|
+
expired: "expired";
|
|
298
|
+
consumed: "consumed";
|
|
299
|
+
revoked: "revoked";
|
|
300
|
+
refunded: "refunded";
|
|
301
|
+
}>;
|
|
302
|
+
allowed: z.ZodBoolean;
|
|
303
|
+
reason: z.ZodEnum<{
|
|
304
|
+
active: "active";
|
|
305
|
+
suspended: "suspended";
|
|
306
|
+
expired: "expired";
|
|
307
|
+
consumed: "consumed";
|
|
308
|
+
revoked: "revoked";
|
|
309
|
+
refunded: "refunded";
|
|
310
|
+
not_found: "not_found";
|
|
311
|
+
not_yet_active: "not_yet_active";
|
|
312
|
+
quota_exhausted: "quota_exhausted";
|
|
313
|
+
invalid_grant: "invalid_grant";
|
|
314
|
+
}>;
|
|
315
|
+
originModel: z.ZodOptional<z.ZodString>;
|
|
316
|
+
originRef: z.ZodOptional<z.ZodString>;
|
|
317
|
+
accessExpiresAt: z.ZodOptional<z.ZodISODateTime>;
|
|
318
|
+
usageLimit: z.ZodOptional<z.ZodNumber>;
|
|
319
|
+
usageUsed: z.ZodOptional<z.ZodNumber>;
|
|
320
|
+
}, z.core.$strip>>;
|
|
321
|
+
declare const Refunded: AccessEventDefinition<z.ZodObject<{
|
|
322
|
+
entitlementId: z.ZodString;
|
|
323
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
324
|
+
subjectRef: z.ZodString;
|
|
325
|
+
subjectModel: z.ZodString;
|
|
326
|
+
resourceRef: z.ZodString;
|
|
327
|
+
resourceType: z.ZodString;
|
|
328
|
+
scopeKey: z.ZodString;
|
|
329
|
+
status: z.ZodEnum<{
|
|
330
|
+
active: "active";
|
|
331
|
+
suspended: "suspended";
|
|
332
|
+
expired: "expired";
|
|
333
|
+
consumed: "consumed";
|
|
334
|
+
revoked: "revoked";
|
|
335
|
+
refunded: "refunded";
|
|
336
|
+
}>;
|
|
337
|
+
allowed: z.ZodBoolean;
|
|
338
|
+
reason: z.ZodEnum<{
|
|
339
|
+
active: "active";
|
|
340
|
+
suspended: "suspended";
|
|
341
|
+
expired: "expired";
|
|
342
|
+
consumed: "consumed";
|
|
343
|
+
revoked: "revoked";
|
|
344
|
+
refunded: "refunded";
|
|
345
|
+
not_found: "not_found";
|
|
346
|
+
not_yet_active: "not_yet_active";
|
|
347
|
+
quota_exhausted: "quota_exhausted";
|
|
348
|
+
invalid_grant: "invalid_grant";
|
|
349
|
+
}>;
|
|
350
|
+
originModel: z.ZodOptional<z.ZodString>;
|
|
351
|
+
originRef: z.ZodOptional<z.ZodString>;
|
|
352
|
+
accessExpiresAt: z.ZodOptional<z.ZodISODateTime>;
|
|
353
|
+
usageLimit: z.ZodOptional<z.ZodNumber>;
|
|
354
|
+
usageUsed: z.ZodOptional<z.ZodNumber>;
|
|
355
|
+
}, z.core.$strip>>;
|
|
356
|
+
declare const accessEventDefinitions: ReadonlyArray<AccessEventDefinition>;
|
|
357
|
+
//#endregion
|
|
358
|
+
export { Expired as a, Refunded as c, Suspended as d, accessEventDefinitions as f, Exhausted as i, Resumed as l, AccessEventName as m, AccessEventSchema as n, Extended as o, ACCESS_EVENTS as p, Consumed as r, Granted as s, AccessEventDefinition as t, Revoked as u };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { AccessEventDefinition, AccessEventSchema, Exhausted, Expired, Extended, Granted, Refunded, Resumed, Revoked, Suspended, accessEventDefinitions };
|
|
1
|
+
import { a as Expired, c as Refunded, d as Suspended, f as accessEventDefinitions, i as Exhausted, l as Resumed, n as AccessEventSchema, o as Extended, r as Consumed, s as Granted, t as AccessEventDefinition, u as Revoked } from "../event-catalog-DarRYj3Y.mjs";
|
|
2
|
+
export { AccessEventDefinition, AccessEventSchema, Consumed, Exhausted, Expired, Extended, Granted, Refunded, Resumed, Revoked, Suspended, accessEventDefinitions };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { Exhausted, Expired, Extended, Granted, Refunded, Resumed, Revoked, Suspended, accessEventDefinitions };
|
|
1
|
+
import "../domain/access-decision.mjs";
|
|
2
|
+
export { t as Consumed, n as Exhausted, r as Expired, i as Extended, a as Granted, o as Refunded, s as Resumed, c as Revoked, l as Suspended, u as accessEventDefinitions } from "../event-catalog-CIxQavRC.mjs";
|