@degenerate/endpoints 0.0.7 → 0.0.9

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,5 +1,5 @@
1
1
  import { AuthorizationAudience } from '@degenerate/generic';
2
- import { Request } from 'express';
2
+ import { Request, Response, NextFunction } from 'express';
3
3
  /**
4
4
  * This function gets the audience authority.
5
5
  *
@@ -16,7 +16,7 @@ export declare function getAudienceAuthority(req: Request): AuthorizationAudienc
16
16
  * @param res the response object
17
17
  * @param next the next function
18
18
  */
19
- export declare function setAudienceAuthority(req: Request): void;
19
+ export declare function setAudienceAuthority(req: Request, res: Response, next: NextFunction): void;
20
20
  /**
21
21
  * This function sets the audience to share data.
22
22
  *
@@ -24,7 +24,7 @@ export declare function setAudienceAuthority(req: Request): void;
24
24
  * @param res the response object
25
25
  * @param next the next function
26
26
  */
27
- export declare function setAudienceShareData(req: Request): void;
27
+ export declare function setAudienceShareData(req: Request, res: Response, next: NextFunction): void;
28
28
  /**
29
29
  * This function sets the audience to functions.
30
30
  *
@@ -32,7 +32,7 @@ export declare function setAudienceShareData(req: Request): void;
32
32
  * @param res the response object
33
33
  * @param next the next function
34
34
  */
35
- export declare function setAudienceFunctions(req: Request): void;
35
+ export declare function setAudienceFunctions(req: Request, res: Response, next: NextFunction): void;
36
36
  /**
37
37
  * This function sets the audience to rules.
38
38
  *
@@ -40,7 +40,7 @@ export declare function setAudienceFunctions(req: Request): void;
40
40
  * @param res the response object
41
41
  * @param next the next function
42
42
  */
43
- export declare function setAudienceRules(req: Request): void;
43
+ export declare function setAudienceRules(req: Request, res: Response, next: NextFunction): void;
44
44
  /**
45
45
  * This function sets the audience to events.
46
46
  *
@@ -48,7 +48,7 @@ export declare function setAudienceRules(req: Request): void;
48
48
  * @param res the response object
49
49
  * @param next the next function
50
50
  */
51
- export declare function setAudienceEvents(req: Request): void;
51
+ export declare function setAudienceEvents(req: Request, res: Response, next: NextFunction): void;
52
52
  /**
53
53
  * This function sets the audience to endpoints.
54
54
  *
@@ -56,5 +56,5 @@ export declare function setAudienceEvents(req: Request): void;
56
56
  * @param res the response object
57
57
  * @param next the next function
58
58
  */
59
- export declare function setAudienceEndpoints(req: Request): void;
59
+ export declare function setAudienceEndpoints(req: Request, res: Response, next: NextFunction): void;
60
60
  //# sourceMappingURL=get-set-audiences.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-set-audiences.d.ts","sourceRoot":"","sources":["../../../../src/cors/authority/audience/get-set-audiences.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,qBAAqB,EAGxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,qBAAqB,CAGxE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,QAGhD;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,QAEhD;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,QAEhD;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,QAE5C;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,QAE7C;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,QAEhD"}
1
+ {"version":3,"file":"get-set-audiences.d.ts","sourceRoot":"","sources":["../../../../src/cors/authority/audience/get-set-audiences.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,qBAAqB,EAGxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE1D;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,qBAAqB,CAGxE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI,CAI1F;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI,CAI1F;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI,CAI1F;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI,CAItF;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI,CAIvF;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI,CAI1F"}
@@ -28,9 +28,10 @@ function getAudienceAuthority(req) {
28
28
  * @param res the response object
29
29
  * @param next the next function
30
30
  */
31
- function setAudienceAuthority(req) {
32
- console.log('setAudienceAuthority called');
31
+ function setAudienceAuthority(req, res, next) {
33
32
  (0, generic_1.setAuthorizationAudience)(req, generic_1.AuthorizationAudience.AUTHORITIES);
33
+ next();
34
+ return;
34
35
  }
35
36
  ;
36
37
  /**
@@ -40,8 +41,10 @@ function setAudienceAuthority(req) {
40
41
  * @param res the response object
41
42
  * @param next the next function
42
43
  */
43
- function setAudienceShareData(req) {
44
+ function setAudienceShareData(req, res, next) {
44
45
  (0, generic_1.setAuthorizationAudience)(req, generic_1.AuthorizationAudience.SHAREDATA);
46
+ next();
47
+ return;
45
48
  }
46
49
  ;
47
50
  /**
@@ -51,8 +54,10 @@ function setAudienceShareData(req) {
51
54
  * @param res the response object
52
55
  * @param next the next function
53
56
  */
54
- function setAudienceFunctions(req) {
57
+ function setAudienceFunctions(req, res, next) {
55
58
  (0, generic_1.setAuthorizationAudience)(req, generic_1.AuthorizationAudience.FUNCTIONS);
59
+ next();
60
+ return;
56
61
  }
57
62
  ;
58
63
  /**
@@ -62,8 +67,10 @@ function setAudienceFunctions(req) {
62
67
  * @param res the response object
63
68
  * @param next the next function
64
69
  */
65
- function setAudienceRules(req) {
70
+ function setAudienceRules(req, res, next) {
66
71
  (0, generic_1.setAuthorizationAudience)(req, generic_1.AuthorizationAudience.RULES);
72
+ next();
73
+ return;
67
74
  }
68
75
  ;
69
76
  /**
@@ -73,8 +80,10 @@ function setAudienceRules(req) {
73
80
  * @param res the response object
74
81
  * @param next the next function
75
82
  */
76
- function setAudienceEvents(req) {
83
+ function setAudienceEvents(req, res, next) {
77
84
  (0, generic_1.setAuthorizationAudience)(req, generic_1.AuthorizationAudience.EVENTS);
85
+ next();
86
+ return;
78
87
  }
79
88
  ;
80
89
  /**
@@ -84,7 +93,9 @@ function setAudienceEvents(req) {
84
93
  * @param res the response object
85
94
  * @param next the next function
86
95
  */
87
- function setAudienceEndpoints(req) {
96
+ function setAudienceEndpoints(req, res, next) {
88
97
  (0, generic_1.setAuthorizationAudience)(req, generic_1.AuthorizationAudience.ENDPOINTS);
98
+ next();
99
+ return;
89
100
  }
90
101
  ;
@@ -0,0 +1,413 @@
1
+ import z from 'zod';
2
+ import { AuthorityValidationType, SAFETransactionActionType, SAFETransactionType } from '@degenerate/generic';
3
+ /**
4
+ * This is the data for the authority in the SAFE Ecosystem.
5
+ */
6
+ export declare const ISAFETransactionAuthorityDataSchema: z.ZodObject<{
7
+ authorizationIssuer: z.ZodString;
8
+ authorizationPublicKey: z.ZodString;
9
+ authorityValidationType: z.ZodEnum<[AuthorityValidationType]>;
10
+ authorityOver: z.ZodArray<z.ZodEnum<[SAFETransactionType.AUTHORITY, SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS, SAFETransactionType.RULES, SAFETransactionType.EVENTS, SAFETransactionType.ENDPOINTS]>, "many">;
11
+ }, "strip", z.ZodTypeAny, {
12
+ authorizationIssuer: string;
13
+ authorizationPublicKey: string;
14
+ authorityValidationType: AuthorityValidationType;
15
+ authorityOver: SAFETransactionType[];
16
+ }, {
17
+ authorizationIssuer: string;
18
+ authorizationPublicKey: string;
19
+ authorityValidationType: AuthorityValidationType;
20
+ authorityOver: SAFETransactionType[];
21
+ }>;
22
+ /**
23
+ * This is the schema for the SAFE transaction base.
24
+ */
25
+ export declare const ISAFETransactionBaseSchema: z.ZodObject<{
26
+ createdAt: z.ZodNumber;
27
+ authority: z.ZodString;
28
+ authoritySignature: z.ZodString;
29
+ transaction: z.ZodObject<{
30
+ type: z.ZodEnum<[SAFETransactionType.AUTHORITY, SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS, SAFETransactionType.RULES, SAFETransactionType.EVENTS, SAFETransactionType.ENDPOINTS]>;
31
+ action: z.ZodEnum<[SAFETransactionActionType.ADD, SAFETransactionActionType.REMOVE, SAFETransactionActionType.UPDATE]>;
32
+ }, "strip", z.ZodTypeAny, {
33
+ type: SAFETransactionType;
34
+ action: SAFETransactionActionType;
35
+ }, {
36
+ type: SAFETransactionType;
37
+ action: SAFETransactionActionType;
38
+ }>;
39
+ version: z.ZodNumber;
40
+ }, "strip", z.ZodTypeAny, {
41
+ transaction: {
42
+ type: SAFETransactionType;
43
+ action: SAFETransactionActionType;
44
+ };
45
+ createdAt: number;
46
+ authority: string;
47
+ authoritySignature: string;
48
+ version: number;
49
+ }, {
50
+ transaction: {
51
+ type: SAFETransactionType;
52
+ action: SAFETransactionActionType;
53
+ };
54
+ createdAt: number;
55
+ authority: string;
56
+ authoritySignature: string;
57
+ version: number;
58
+ }>;
59
+ /**
60
+ * This is the transaction targetting an authority in the SAFE Ecosystem.
61
+ *
62
+ const sampleTransactionAuthority: ISAFETransactionAuthority = {
63
+ createdAt: Date.now(),
64
+ authority: '0xAuthorityPublicKey',
65
+ authoritySignature: '0xAuthoritySignature',
66
+ transaction: {
67
+ type: SAFETransactionType.AUTHORITY,
68
+ action: SAFETransactionActionType.CREATE,
69
+ data: {
70
+ authorizationIssuer: 'exampleIssuer-12345678' as IAuthorizationIssuer,
71
+ authorizationPublicKey: '0xAuthorizationPublicKey',
72
+ authorityValidationType: AuthorityValidationType.JWT,
73
+ authorityOver: [SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS],
74
+ },
75
+ },
76
+ version: 1,
77
+ };
78
+ */
79
+ /**
80
+ * This is the schema for the authority transaction.
81
+ */
82
+ export declare const ISAFETransactionAuthoritySchema: z.ZodObject<z.objectUtil.extendShape<{
83
+ createdAt: z.ZodNumber;
84
+ authority: z.ZodString;
85
+ authoritySignature: z.ZodString;
86
+ transaction: z.ZodObject<{
87
+ type: z.ZodEnum<[SAFETransactionType.AUTHORITY, SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS, SAFETransactionType.RULES, SAFETransactionType.EVENTS, SAFETransactionType.ENDPOINTS]>;
88
+ action: z.ZodEnum<[SAFETransactionActionType.ADD, SAFETransactionActionType.REMOVE, SAFETransactionActionType.UPDATE]>;
89
+ }, "strip", z.ZodTypeAny, {
90
+ type: SAFETransactionType;
91
+ action: SAFETransactionActionType;
92
+ }, {
93
+ type: SAFETransactionType;
94
+ action: SAFETransactionActionType;
95
+ }>;
96
+ version: z.ZodNumber;
97
+ }, {
98
+ transaction: z.ZodObject<{
99
+ type: z.ZodLiteral<SAFETransactionType.AUTHORITY>;
100
+ action: z.ZodEnum<[SAFETransactionActionType.ADD, SAFETransactionActionType.REMOVE, SAFETransactionActionType.UPDATE]>;
101
+ data: z.ZodObject<{
102
+ authorizationIssuer: z.ZodString;
103
+ authorizationPublicKey: z.ZodString;
104
+ authorityValidationType: z.ZodEnum<[AuthorityValidationType]>;
105
+ authorityOver: z.ZodArray<z.ZodEnum<[SAFETransactionType.AUTHORITY, SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS, SAFETransactionType.RULES, SAFETransactionType.EVENTS, SAFETransactionType.ENDPOINTS]>, "many">;
106
+ }, "strip", z.ZodTypeAny, {
107
+ authorizationIssuer: string;
108
+ authorizationPublicKey: string;
109
+ authorityValidationType: AuthorityValidationType;
110
+ authorityOver: SAFETransactionType[];
111
+ }, {
112
+ authorizationIssuer: string;
113
+ authorizationPublicKey: string;
114
+ authorityValidationType: AuthorityValidationType;
115
+ authorityOver: SAFETransactionType[];
116
+ }>;
117
+ }, "strip", z.ZodTypeAny, {
118
+ data: {
119
+ authorizationIssuer: string;
120
+ authorizationPublicKey: string;
121
+ authorityValidationType: AuthorityValidationType;
122
+ authorityOver: SAFETransactionType[];
123
+ };
124
+ type: SAFETransactionType.AUTHORITY;
125
+ action: SAFETransactionActionType;
126
+ }, {
127
+ data: {
128
+ authorizationIssuer: string;
129
+ authorizationPublicKey: string;
130
+ authorityValidationType: AuthorityValidationType;
131
+ authorityOver: SAFETransactionType[];
132
+ };
133
+ type: SAFETransactionType.AUTHORITY;
134
+ action: SAFETransactionActionType;
135
+ }>;
136
+ }>, "strip", z.ZodTypeAny, {
137
+ transaction: {
138
+ data: {
139
+ authorizationIssuer: string;
140
+ authorizationPublicKey: string;
141
+ authorityValidationType: AuthorityValidationType;
142
+ authorityOver: SAFETransactionType[];
143
+ };
144
+ type: SAFETransactionType.AUTHORITY;
145
+ action: SAFETransactionActionType;
146
+ };
147
+ createdAt: number;
148
+ authority: string;
149
+ authoritySignature: string;
150
+ version: number;
151
+ }, {
152
+ transaction: {
153
+ data: {
154
+ authorizationIssuer: string;
155
+ authorizationPublicKey: string;
156
+ authorityValidationType: AuthorityValidationType;
157
+ authorityOver: SAFETransactionType[];
158
+ };
159
+ type: SAFETransactionType.AUTHORITY;
160
+ action: SAFETransactionActionType;
161
+ };
162
+ createdAt: number;
163
+ authority: string;
164
+ authoritySignature: string;
165
+ version: number;
166
+ }>;
167
+ /**
168
+ * This is the schema for the authority transaction add.
169
+ */
170
+ export declare const ISAFETransactionAuthorityAddSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
171
+ createdAt: z.ZodNumber;
172
+ authority: z.ZodString;
173
+ authoritySignature: z.ZodString;
174
+ transaction: z.ZodObject<{
175
+ type: z.ZodEnum<[SAFETransactionType.AUTHORITY, SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS, SAFETransactionType.RULES, SAFETransactionType.EVENTS, SAFETransactionType.ENDPOINTS]>;
176
+ action: z.ZodEnum<[SAFETransactionActionType.ADD, SAFETransactionActionType.REMOVE, SAFETransactionActionType.UPDATE]>;
177
+ }, "strip", z.ZodTypeAny, {
178
+ type: SAFETransactionType;
179
+ action: SAFETransactionActionType;
180
+ }, {
181
+ type: SAFETransactionType;
182
+ action: SAFETransactionActionType;
183
+ }>;
184
+ version: z.ZodNumber;
185
+ }, {
186
+ transaction: z.ZodObject<{
187
+ type: z.ZodLiteral<SAFETransactionType.AUTHORITY>;
188
+ action: z.ZodEnum<[SAFETransactionActionType.ADD, SAFETransactionActionType.REMOVE, SAFETransactionActionType.UPDATE]>;
189
+ data: z.ZodObject<{
190
+ authorizationIssuer: z.ZodString;
191
+ authorizationPublicKey: z.ZodString;
192
+ authorityValidationType: z.ZodEnum<[AuthorityValidationType]>;
193
+ authorityOver: z.ZodArray<z.ZodEnum<[SAFETransactionType.AUTHORITY, SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS, SAFETransactionType.RULES, SAFETransactionType.EVENTS, SAFETransactionType.ENDPOINTS]>, "many">;
194
+ }, "strip", z.ZodTypeAny, {
195
+ authorizationIssuer: string;
196
+ authorizationPublicKey: string;
197
+ authorityValidationType: AuthorityValidationType;
198
+ authorityOver: SAFETransactionType[];
199
+ }, {
200
+ authorizationIssuer: string;
201
+ authorizationPublicKey: string;
202
+ authorityValidationType: AuthorityValidationType;
203
+ authorityOver: SAFETransactionType[];
204
+ }>;
205
+ }, "strip", z.ZodTypeAny, {
206
+ data: {
207
+ authorizationIssuer: string;
208
+ authorizationPublicKey: string;
209
+ authorityValidationType: AuthorityValidationType;
210
+ authorityOver: SAFETransactionType[];
211
+ };
212
+ type: SAFETransactionType.AUTHORITY;
213
+ action: SAFETransactionActionType;
214
+ }, {
215
+ data: {
216
+ authorizationIssuer: string;
217
+ authorizationPublicKey: string;
218
+ authorityValidationType: AuthorityValidationType;
219
+ authorityOver: SAFETransactionType[];
220
+ };
221
+ type: SAFETransactionType.AUTHORITY;
222
+ action: SAFETransactionActionType;
223
+ }>;
224
+ }>, {
225
+ transaction: z.ZodObject<{
226
+ action: z.ZodLiteral<SAFETransactionActionType.ADD>;
227
+ }, "strip", z.ZodTypeAny, {
228
+ action: SAFETransactionActionType.ADD;
229
+ }, {
230
+ action: SAFETransactionActionType.ADD;
231
+ }>;
232
+ }>, "strip", z.ZodTypeAny, {
233
+ transaction: {
234
+ action: SAFETransactionActionType.ADD;
235
+ };
236
+ createdAt: number;
237
+ authority: string;
238
+ authoritySignature: string;
239
+ version: number;
240
+ }, {
241
+ transaction: {
242
+ action: SAFETransactionActionType.ADD;
243
+ };
244
+ createdAt: number;
245
+ authority: string;
246
+ authoritySignature: string;
247
+ version: number;
248
+ }>;
249
+ /**
250
+ * This is the schema for the authority transaction update.
251
+ */
252
+ export declare const ISAFETransactionAuthorityUpdateSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
253
+ createdAt: z.ZodNumber;
254
+ authority: z.ZodString;
255
+ authoritySignature: z.ZodString;
256
+ transaction: z.ZodObject<{
257
+ type: z.ZodEnum<[SAFETransactionType.AUTHORITY, SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS, SAFETransactionType.RULES, SAFETransactionType.EVENTS, SAFETransactionType.ENDPOINTS]>;
258
+ action: z.ZodEnum<[SAFETransactionActionType.ADD, SAFETransactionActionType.REMOVE, SAFETransactionActionType.UPDATE]>;
259
+ }, "strip", z.ZodTypeAny, {
260
+ type: SAFETransactionType;
261
+ action: SAFETransactionActionType;
262
+ }, {
263
+ type: SAFETransactionType;
264
+ action: SAFETransactionActionType;
265
+ }>;
266
+ version: z.ZodNumber;
267
+ }, {
268
+ transaction: z.ZodObject<{
269
+ type: z.ZodLiteral<SAFETransactionType.AUTHORITY>;
270
+ action: z.ZodEnum<[SAFETransactionActionType.ADD, SAFETransactionActionType.REMOVE, SAFETransactionActionType.UPDATE]>;
271
+ data: z.ZodObject<{
272
+ authorizationIssuer: z.ZodString;
273
+ authorizationPublicKey: z.ZodString;
274
+ authorityValidationType: z.ZodEnum<[AuthorityValidationType]>;
275
+ authorityOver: z.ZodArray<z.ZodEnum<[SAFETransactionType.AUTHORITY, SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS, SAFETransactionType.RULES, SAFETransactionType.EVENTS, SAFETransactionType.ENDPOINTS]>, "many">;
276
+ }, "strip", z.ZodTypeAny, {
277
+ authorizationIssuer: string;
278
+ authorizationPublicKey: string;
279
+ authorityValidationType: AuthorityValidationType;
280
+ authorityOver: SAFETransactionType[];
281
+ }, {
282
+ authorizationIssuer: string;
283
+ authorizationPublicKey: string;
284
+ authorityValidationType: AuthorityValidationType;
285
+ authorityOver: SAFETransactionType[];
286
+ }>;
287
+ }, "strip", z.ZodTypeAny, {
288
+ data: {
289
+ authorizationIssuer: string;
290
+ authorizationPublicKey: string;
291
+ authorityValidationType: AuthorityValidationType;
292
+ authorityOver: SAFETransactionType[];
293
+ };
294
+ type: SAFETransactionType.AUTHORITY;
295
+ action: SAFETransactionActionType;
296
+ }, {
297
+ data: {
298
+ authorizationIssuer: string;
299
+ authorizationPublicKey: string;
300
+ authorityValidationType: AuthorityValidationType;
301
+ authorityOver: SAFETransactionType[];
302
+ };
303
+ type: SAFETransactionType.AUTHORITY;
304
+ action: SAFETransactionActionType;
305
+ }>;
306
+ }>, {
307
+ transaction: z.ZodObject<{
308
+ action: z.ZodLiteral<SAFETransactionActionType.UPDATE>;
309
+ }, "strip", z.ZodTypeAny, {
310
+ action: SAFETransactionActionType.UPDATE;
311
+ }, {
312
+ action: SAFETransactionActionType.UPDATE;
313
+ }>;
314
+ }>, "strip", z.ZodTypeAny, {
315
+ transaction: {
316
+ action: SAFETransactionActionType.UPDATE;
317
+ };
318
+ createdAt: number;
319
+ authority: string;
320
+ authoritySignature: string;
321
+ version: number;
322
+ }, {
323
+ transaction: {
324
+ action: SAFETransactionActionType.UPDATE;
325
+ };
326
+ createdAt: number;
327
+ authority: string;
328
+ authoritySignature: string;
329
+ version: number;
330
+ }>;
331
+ /**
332
+ * This is the schema for the authority transaction remove.
333
+ */
334
+ export declare const ISAFETransactionAuthorityRemoveSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
335
+ createdAt: z.ZodNumber;
336
+ authority: z.ZodString;
337
+ authoritySignature: z.ZodString;
338
+ transaction: z.ZodObject<{
339
+ type: z.ZodEnum<[SAFETransactionType.AUTHORITY, SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS, SAFETransactionType.RULES, SAFETransactionType.EVENTS, SAFETransactionType.ENDPOINTS]>;
340
+ action: z.ZodEnum<[SAFETransactionActionType.ADD, SAFETransactionActionType.REMOVE, SAFETransactionActionType.UPDATE]>;
341
+ }, "strip", z.ZodTypeAny, {
342
+ type: SAFETransactionType;
343
+ action: SAFETransactionActionType;
344
+ }, {
345
+ type: SAFETransactionType;
346
+ action: SAFETransactionActionType;
347
+ }>;
348
+ version: z.ZodNumber;
349
+ }, {
350
+ transaction: z.ZodObject<{
351
+ type: z.ZodLiteral<SAFETransactionType.AUTHORITY>;
352
+ action: z.ZodEnum<[SAFETransactionActionType.ADD, SAFETransactionActionType.REMOVE, SAFETransactionActionType.UPDATE]>;
353
+ data: z.ZodObject<{
354
+ authorizationIssuer: z.ZodString;
355
+ authorizationPublicKey: z.ZodString;
356
+ authorityValidationType: z.ZodEnum<[AuthorityValidationType]>;
357
+ authorityOver: z.ZodArray<z.ZodEnum<[SAFETransactionType.AUTHORITY, SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS, SAFETransactionType.RULES, SAFETransactionType.EVENTS, SAFETransactionType.ENDPOINTS]>, "many">;
358
+ }, "strip", z.ZodTypeAny, {
359
+ authorizationIssuer: string;
360
+ authorizationPublicKey: string;
361
+ authorityValidationType: AuthorityValidationType;
362
+ authorityOver: SAFETransactionType[];
363
+ }, {
364
+ authorizationIssuer: string;
365
+ authorizationPublicKey: string;
366
+ authorityValidationType: AuthorityValidationType;
367
+ authorityOver: SAFETransactionType[];
368
+ }>;
369
+ }, "strip", z.ZodTypeAny, {
370
+ data: {
371
+ authorizationIssuer: string;
372
+ authorizationPublicKey: string;
373
+ authorityValidationType: AuthorityValidationType;
374
+ authorityOver: SAFETransactionType[];
375
+ };
376
+ type: SAFETransactionType.AUTHORITY;
377
+ action: SAFETransactionActionType;
378
+ }, {
379
+ data: {
380
+ authorizationIssuer: string;
381
+ authorizationPublicKey: string;
382
+ authorityValidationType: AuthorityValidationType;
383
+ authorityOver: SAFETransactionType[];
384
+ };
385
+ type: SAFETransactionType.AUTHORITY;
386
+ action: SAFETransactionActionType;
387
+ }>;
388
+ }>, {
389
+ transaction: z.ZodObject<{
390
+ action: z.ZodLiteral<SAFETransactionActionType.REMOVE>;
391
+ }, "strip", z.ZodTypeAny, {
392
+ action: SAFETransactionActionType.REMOVE;
393
+ }, {
394
+ action: SAFETransactionActionType.REMOVE;
395
+ }>;
396
+ }>, "strip", z.ZodTypeAny, {
397
+ transaction: {
398
+ action: SAFETransactionActionType.REMOVE;
399
+ };
400
+ createdAt: number;
401
+ authority: string;
402
+ authoritySignature: string;
403
+ version: number;
404
+ }, {
405
+ transaction: {
406
+ action: SAFETransactionActionType.REMOVE;
407
+ };
408
+ createdAt: number;
409
+ authority: string;
410
+ authoritySignature: string;
411
+ version: number;
412
+ }>;
413
+ //# sourceMappingURL=authorities.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorities.schema.d.ts","sourceRoot":"","sources":["../../src/schema/authorities.schema.ts"],"names":[],"mappings":"AACA,OAAO,CAAC,MAAM,KAAK,CAAC;AAKpB,OAAO,EACH,uBAAuB,EACvB,yBAAyB,EACzB,mBAAmB,EACtB,MAAM,qBAAqB,CAAC;AAK7B;;GAEG;AACH,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;EAK9C,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASrC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;GAEG;AACH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM1C,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI7C,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIhD,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIhD,CAAC"}
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ISAFETransactionAuthorityRemoveSchema = exports.ISAFETransactionAuthorityUpdateSchema = exports.ISAFETransactionAuthorityAddSchema = exports.ISAFETransactionAuthoritySchema = exports.ISAFETransactionBaseSchema = exports.ISAFETransactionAuthorityDataSchema = void 0;
7
+ // This contains the schemas for the authorities objects in the zod format..
8
+ const zod_1 = __importDefault(require("zod"));
9
+ const transaction_schema_1 = require("./transaction.schema");
10
+ const generic_1 = require("@degenerate/generic");
11
+ const IAuthorizationIssuerSchema = zod_1.default.string().regex(/^[a-zA-Z0-9]+-[a-zA-Z0-9]+$/);
12
+ const AuthorityValidationTypeSchema = zod_1.default.enum([generic_1.AuthorityValidationType.JWT]);
13
+ /**
14
+ * This is the data for the authority in the SAFE Ecosystem.
15
+ */
16
+ exports.ISAFETransactionAuthorityDataSchema = zod_1.default.object({
17
+ authorizationIssuer: IAuthorizationIssuerSchema,
18
+ authorizationPublicKey: zod_1.default.string(),
19
+ authorityValidationType: AuthorityValidationTypeSchema,
20
+ authorityOver: zod_1.default.array(transaction_schema_1.SAFETransactionTypeSchema),
21
+ });
22
+ /**
23
+ * This is the schema for the SAFE transaction base.
24
+ */
25
+ exports.ISAFETransactionBaseSchema = zod_1.default.object({
26
+ createdAt: zod_1.default.number(), // the javascript timestamp of when the transaction was created
27
+ authority: zod_1.default.string(), // the public key of the authority that created the transaction
28
+ authoritySignature: zod_1.default.string(), // the signature of the authority that created the transaction
29
+ transaction: zod_1.default.object({
30
+ type: transaction_schema_1.SAFETransactionTypeSchema, // the type of transaction
31
+ action: transaction_schema_1.SAFETransactionActionTypeSchema, // the action to perform on the transaction
32
+ }),
33
+ version: zod_1.default.number(), // the version of the transaction
34
+ });
35
+ /**
36
+ * This is the transaction targetting an authority in the SAFE Ecosystem.
37
+ *
38
+ const sampleTransactionAuthority: ISAFETransactionAuthority = {
39
+ createdAt: Date.now(),
40
+ authority: '0xAuthorityPublicKey',
41
+ authoritySignature: '0xAuthoritySignature',
42
+ transaction: {
43
+ type: SAFETransactionType.AUTHORITY,
44
+ action: SAFETransactionActionType.CREATE,
45
+ data: {
46
+ authorizationIssuer: 'exampleIssuer-12345678' as IAuthorizationIssuer,
47
+ authorizationPublicKey: '0xAuthorizationPublicKey',
48
+ authorityValidationType: AuthorityValidationType.JWT,
49
+ authorityOver: [SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS],
50
+ },
51
+ },
52
+ version: 1,
53
+ };
54
+ */
55
+ /**
56
+ * This is the schema for the authority transaction.
57
+ */
58
+ exports.ISAFETransactionAuthoritySchema = exports.ISAFETransactionBaseSchema.extend({
59
+ transaction: zod_1.default.object({
60
+ type: zod_1.default.literal(generic_1.SAFETransactionType.AUTHORITY),
61
+ action: transaction_schema_1.SAFETransactionActionTypeSchema,
62
+ data: exports.ISAFETransactionAuthorityDataSchema,
63
+ }),
64
+ });
65
+ /**
66
+ * This is the schema for the authority transaction add.
67
+ */
68
+ exports.ISAFETransactionAuthorityAddSchema = exports.ISAFETransactionAuthoritySchema.extend({
69
+ transaction: zod_1.default.object({
70
+ action: zod_1.default.literal(generic_1.SAFETransactionActionType.ADD),
71
+ }),
72
+ });
73
+ /**
74
+ * This is the schema for the authority transaction update.
75
+ */
76
+ exports.ISAFETransactionAuthorityUpdateSchema = exports.ISAFETransactionAuthoritySchema.extend({
77
+ transaction: zod_1.default.object({
78
+ action: zod_1.default.literal(generic_1.SAFETransactionActionType.UPDATE),
79
+ }),
80
+ });
81
+ /**
82
+ * This is the schema for the authority transaction remove.
83
+ */
84
+ exports.ISAFETransactionAuthorityRemoveSchema = exports.ISAFETransactionAuthoritySchema.extend({
85
+ transaction: zod_1.default.object({
86
+ action: zod_1.default.literal(generic_1.SAFETransactionActionType.REMOVE),
87
+ }),
88
+ });
@@ -0,0 +1,8 @@
1
+ import z from 'zod';
2
+ import { SAFETransactionActionType, SAFETransactionType } from '@degenerate/generic';
3
+ export declare const SAFETransactionTypeSchema: z.ZodEnum<[SAFETransactionType.AUTHORITY, SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS, SAFETransactionType.RULES, SAFETransactionType.EVENTS, SAFETransactionType.ENDPOINTS]>;
4
+ /**
5
+ * This is the type of function that is being targetted in the transaction.
6
+ */
7
+ export declare const SAFETransactionActionTypeSchema: z.ZodEnum<[SAFETransactionActionType.ADD, SAFETransactionActionType.REMOVE, SAFETransactionActionType.UPDATE]>;
8
+ //# sourceMappingURL=transaction.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.schema.d.ts","sourceRoot":"","sources":["../../src/schema/transaction.schema.ts"],"names":[],"mappings":"AACA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EACH,yBAAyB,EACzB,mBAAmB,EACtB,MAAM,qBAAqB,CAAC;AAM7B,eAAO,MAAM,yBAAyB,gMAOpC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,+BAA+B,gHAI1C,CAAC"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SAFETransactionActionTypeSchema = exports.SAFETransactionTypeSchema = void 0;
7
+ //This file contains the schema for the transaction data in the SAFE Ecosystem in zod format.
8
+ const zod_1 = __importDefault(require("zod"));
9
+ const generic_1 = require("@degenerate/generic");
10
+ //#region Enums
11
+ // This is the schema for the authority data.
12
+ exports.SAFETransactionTypeSchema = zod_1.default.enum([
13
+ generic_1.SAFETransactionType.AUTHORITY,
14
+ generic_1.SAFETransactionType.SHAREDATA,
15
+ generic_1.SAFETransactionType.FUNCTIONS,
16
+ generic_1.SAFETransactionType.RULES,
17
+ generic_1.SAFETransactionType.EVENTS,
18
+ generic_1.SAFETransactionType.ENDPOINTS,
19
+ ]);
20
+ /**
21
+ * This is the type of function that is being targetted in the transaction.
22
+ */
23
+ exports.SAFETransactionActionTypeSchema = zod_1.default.enum([
24
+ generic_1.SAFETransactionActionType.ADD,
25
+ generic_1.SAFETransactionActionType.REMOVE,
26
+ generic_1.SAFETransactionActionType.UPDATE,
27
+ ]);
28
+ //#endregion Enums
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@degenerate/endpoints",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "devDependencies": {
@@ -39,8 +39,9 @@
39
39
  "author": "Degenerate Inc.",
40
40
  "license": "ISC",
41
41
  "dependencies": {
42
- "@degenerate/generic": "^0.1.7",
43
- "express": "^4.21.1"
42
+ "@degenerate/generic": "^0.1.9",
43
+ "express": "^4.21.1",
44
+ "zod": "^3.23.8"
44
45
  },
45
- "gitHead": "d158ea8a4c8109a7a5373cbd3d5c89f89888af6e"
46
+ "gitHead": "97a0ffd55ceb8dfb323efdd4b9de181511261902"
46
47
  }