@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.
@@ -1,136 +0,0 @@
1
- import { DomainEvent, EventMeta } from "@classytic/primitives/events";
2
- import { z } from "zod";
3
- //#region src/events/event-constants.d.ts
4
- /**
5
- * ACCESS_EVENTS — domain event constants. Prefix `access:` per
6
- * PACKAGE_RULES §12. Hosts subscribe glob-style so typos are compile errors.
7
- */
8
- declare const ACCESS_EVENTS: {
9
- readonly GRANTED: "access:granted";
10
- readonly EXTENDED: "access:extended";
11
- readonly SUSPENDED: "access:suspended";
12
- readonly RESUMED: "access:resumed";
13
- readonly REVOKED: "access:revoked";
14
- readonly EXPIRED: "access:expired";
15
- readonly EXHAUSTED: "access:exhausted";
16
- readonly REFUNDED: "access:refunded";
17
- };
18
- type AccessEventName = (typeof ACCESS_EVENTS)[keyof typeof ACCESS_EVENTS];
19
- //#endregion
20
- //#region src/events/event-catalog.d.ts
21
- type AccessEventSchema = Record<string, unknown>;
22
- interface AccessEventDefinition<TSchema extends z.ZodType = z.ZodType> {
23
- name: AccessEventName;
24
- version: number;
25
- description: string;
26
- zodSchema: TSchema;
27
- schema: AccessEventSchema;
28
- create(payload: z.infer<TSchema>, meta?: Partial<EventMeta>): DomainEvent<z.infer<TSchema>>;
29
- }
30
- declare const Granted: AccessEventDefinition<z.ZodObject<{
31
- entitlementId: z.ZodString;
32
- organizationId: z.ZodOptional<z.ZodString>;
33
- subjectRef: z.ZodString;
34
- subjectModel: z.ZodString;
35
- resourceRef: z.ZodString;
36
- resourceType: z.ZodString;
37
- scopeKey: z.ZodString;
38
- status: z.ZodString;
39
- accessExpiresAt: z.ZodOptional<z.ZodISODateTime>;
40
- usageLimit: z.ZodOptional<z.ZodNumber>;
41
- usageUsed: z.ZodOptional<z.ZodNumber>;
42
- }, z.core.$strip>>;
43
- declare const Extended: AccessEventDefinition<z.ZodObject<{
44
- entitlementId: z.ZodString;
45
- organizationId: z.ZodOptional<z.ZodString>;
46
- subjectRef: z.ZodString;
47
- subjectModel: z.ZodString;
48
- resourceRef: z.ZodString;
49
- resourceType: z.ZodString;
50
- scopeKey: z.ZodString;
51
- status: z.ZodString;
52
- accessExpiresAt: z.ZodOptional<z.ZodISODateTime>;
53
- usageLimit: z.ZodOptional<z.ZodNumber>;
54
- usageUsed: z.ZodOptional<z.ZodNumber>;
55
- }, z.core.$strip>>;
56
- declare const Suspended: AccessEventDefinition<z.ZodObject<{
57
- entitlementId: z.ZodString;
58
- organizationId: z.ZodOptional<z.ZodString>;
59
- subjectRef: z.ZodString;
60
- subjectModel: z.ZodString;
61
- resourceRef: z.ZodString;
62
- resourceType: z.ZodString;
63
- scopeKey: z.ZodString;
64
- status: z.ZodString;
65
- accessExpiresAt: z.ZodOptional<z.ZodISODateTime>;
66
- usageLimit: z.ZodOptional<z.ZodNumber>;
67
- usageUsed: z.ZodOptional<z.ZodNumber>;
68
- }, z.core.$strip>>;
69
- declare const Resumed: AccessEventDefinition<z.ZodObject<{
70
- entitlementId: z.ZodString;
71
- organizationId: z.ZodOptional<z.ZodString>;
72
- subjectRef: z.ZodString;
73
- subjectModel: z.ZodString;
74
- resourceRef: z.ZodString;
75
- resourceType: z.ZodString;
76
- scopeKey: z.ZodString;
77
- status: z.ZodString;
78
- accessExpiresAt: z.ZodOptional<z.ZodISODateTime>;
79
- usageLimit: z.ZodOptional<z.ZodNumber>;
80
- usageUsed: z.ZodOptional<z.ZodNumber>;
81
- }, z.core.$strip>>;
82
- declare const Revoked: AccessEventDefinition<z.ZodObject<{
83
- entitlementId: z.ZodString;
84
- organizationId: z.ZodOptional<z.ZodString>;
85
- subjectRef: z.ZodString;
86
- subjectModel: z.ZodString;
87
- resourceRef: z.ZodString;
88
- resourceType: z.ZodString;
89
- scopeKey: z.ZodString;
90
- status: z.ZodString;
91
- accessExpiresAt: z.ZodOptional<z.ZodISODateTime>;
92
- usageLimit: z.ZodOptional<z.ZodNumber>;
93
- usageUsed: z.ZodOptional<z.ZodNumber>;
94
- }, z.core.$strip>>;
95
- declare const Expired: AccessEventDefinition<z.ZodObject<{
96
- entitlementId: z.ZodString;
97
- organizationId: z.ZodOptional<z.ZodString>;
98
- subjectRef: z.ZodString;
99
- subjectModel: z.ZodString;
100
- resourceRef: z.ZodString;
101
- resourceType: z.ZodString;
102
- scopeKey: z.ZodString;
103
- status: z.ZodString;
104
- accessExpiresAt: z.ZodOptional<z.ZodISODateTime>;
105
- usageLimit: z.ZodOptional<z.ZodNumber>;
106
- usageUsed: z.ZodOptional<z.ZodNumber>;
107
- }, z.core.$strip>>;
108
- declare const Exhausted: AccessEventDefinition<z.ZodObject<{
109
- entitlementId: z.ZodString;
110
- organizationId: z.ZodOptional<z.ZodString>;
111
- subjectRef: z.ZodString;
112
- subjectModel: z.ZodString;
113
- resourceRef: z.ZodString;
114
- resourceType: z.ZodString;
115
- scopeKey: z.ZodString;
116
- status: z.ZodString;
117
- accessExpiresAt: z.ZodOptional<z.ZodISODateTime>;
118
- usageLimit: z.ZodOptional<z.ZodNumber>;
119
- usageUsed: z.ZodOptional<z.ZodNumber>;
120
- }, z.core.$strip>>;
121
- declare const Refunded: AccessEventDefinition<z.ZodObject<{
122
- entitlementId: z.ZodString;
123
- organizationId: z.ZodOptional<z.ZodString>;
124
- subjectRef: z.ZodString;
125
- subjectModel: z.ZodString;
126
- resourceRef: z.ZodString;
127
- resourceType: z.ZodString;
128
- scopeKey: z.ZodString;
129
- status: z.ZodString;
130
- accessExpiresAt: z.ZodOptional<z.ZodISODateTime>;
131
- usageLimit: z.ZodOptional<z.ZodNumber>;
132
- usageUsed: z.ZodOptional<z.ZodNumber>;
133
- }, z.core.$strip>>;
134
- declare const accessEventDefinitions: ReadonlyArray<AccessEventDefinition>;
135
- //#endregion
136
- export { Extended as a, Resumed as c, accessEventDefinitions as d, ACCESS_EVENTS as f, Expired as i, Revoked as l, AccessEventSchema as n, Granted as o, AccessEventName as p, Exhausted as r, Refunded as s, AccessEventDefinition as t, Suspended as u };