@degenerate/endpoints 0.0.9 → 0.0.11

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.
Files changed (73) hide show
  1. package/README.md +27 -2
  2. package/dist/__tests__/jest.setup.d.ts +10 -0
  3. package/dist/__tests__/jest.setup.d.ts.map +1 -0
  4. package/dist/__tests__/jest.setup.js +2 -0
  5. package/dist/cors/authority/jwt/validate-jwt-authorities.d.ts +2 -2
  6. package/dist/cors/authority/jwt/validate-jwt-authorities.d.ts.map +1 -1
  7. package/dist/cors/authority/jwt/validate-jwt-authorities.js +0 -1
  8. package/dist/cors/authority/jwt/validate-jwt-endpoints.d.ts +16 -0
  9. package/dist/cors/authority/jwt/validate-jwt-endpoints.d.ts.map +1 -0
  10. package/dist/cors/authority/jwt/validate-jwt-endpoints.js +32 -0
  11. package/dist/cors/authority/jwt/validate-jwt-events.d.ts +16 -0
  12. package/dist/cors/authority/jwt/validate-jwt-events.d.ts.map +1 -0
  13. package/dist/cors/authority/jwt/validate-jwt-events.js +32 -0
  14. package/dist/cors/authority/jwt/validate-jwt-functions.d.ts +16 -0
  15. package/dist/cors/authority/jwt/validate-jwt-functions.d.ts.map +1 -0
  16. package/dist/cors/authority/jwt/validate-jwt-functions.js +32 -0
  17. package/dist/cors/authority/jwt/validate-jwt-rules.d.ts +16 -0
  18. package/dist/cors/authority/jwt/validate-jwt-rules.d.ts.map +1 -0
  19. package/dist/cors/authority/jwt/validate-jwt-rules.js +32 -0
  20. package/dist/cors/authority/jwt/validate-jwt-share-data.d.ts +16 -0
  21. package/dist/cors/authority/jwt/validate-jwt-share-data.d.ts.map +1 -0
  22. package/dist/cors/authority/jwt/validate-jwt-share-data.js +32 -0
  23. package/dist/cors/endpoints/helpers/validate-incoming-request-data.d.ts +10 -0
  24. package/dist/cors/endpoints/helpers/validate-incoming-request-data.d.ts.map +1 -0
  25. package/dist/cors/endpoints/helpers/validate-incoming-request-data.js +37 -0
  26. package/dist/cors/errors/bad-request-handler.d.ts.map +1 -1
  27. package/dist/cors/errors/bad-request-handler.js +1 -2
  28. package/dist/cors/index.d.ts +12 -4
  29. package/dist/cors/index.d.ts.map +1 -1
  30. package/dist/cors/index.js +20 -6
  31. package/dist/cors/logging/add-unique-tracking.d.ts +11 -0
  32. package/dist/cors/logging/add-unique-tracking.d.ts.map +1 -0
  33. package/dist/cors/logging/add-unique-tracking.js +18 -0
  34. package/dist/cors/logging/request-logging.d.ts +11 -0
  35. package/dist/cors/logging/request-logging.d.ts.map +1 -0
  36. package/dist/cors/logging/request-logging.js +26 -0
  37. package/dist/cors/routes/authorities/v1.routes.d.ts +2 -0
  38. package/dist/cors/routes/authorities/v1.routes.d.ts.map +1 -0
  39. package/dist/cors/routes/authorities/v1.routes.js +87 -0
  40. package/dist/cors/routes/authorities.routes.d.ts.map +1 -1
  41. package/dist/cors/routes/authorities.routes.js +8 -59
  42. package/dist/cors/routes/rules/v1/rule-set.routes.d.ts +2 -0
  43. package/dist/cors/routes/rules/v1/rule-set.routes.d.ts.map +1 -0
  44. package/dist/cors/routes/rules/v1/rule-set.routes.js +104 -0
  45. package/dist/cors/routes/rules/v1.routes.d.ts +2 -0
  46. package/dist/cors/routes/rules/v1.routes.d.ts.map +1 -0
  47. package/dist/cors/routes/rules/v1.routes.js +44 -0
  48. package/dist/cors/routes/rules.routes.d.ts.map +1 -1
  49. package/dist/cors/routes/rules.routes.js +6 -24
  50. package/dist/examples/express-server/app.d.ts.map +1 -1
  51. package/dist/examples/express-server/app.js +4 -0
  52. package/dist/schema/{authorities.schema.d.ts → authorities-transactions.schema.d.ts} +47 -154
  53. package/dist/schema/authorities-transactions.schema.d.ts.map +1 -0
  54. package/dist/schema/{authorities.schema.js → authorities-transactions.schema.js} +12 -29
  55. package/dist/schema/rules/rules-conditions.schema.d.ts +402 -0
  56. package/dist/schema/rules/rules-conditions.schema.d.ts.map +1 -0
  57. package/dist/schema/rules/rules-conditions.schema.js +99 -0
  58. package/dist/schema/rules/rules-enums.schema.d.ts +39 -0
  59. package/dist/schema/rules/rules-enums.schema.d.ts.map +1 -0
  60. package/dist/schema/rules/rules-enums.schema.js +90 -0
  61. package/dist/schema/rules/rules.schema.d.ts +2839 -0
  62. package/dist/schema/rules/rules.schema.d.ts.map +1 -0
  63. package/dist/schema/rules/rules.schema.js +76 -0
  64. package/dist/schema/rules-transactions.schema.d.ts +450 -0
  65. package/dist/schema/rules-transactions.schema.d.ts.map +1 -0
  66. package/dist/schema/rules-transactions.schema.js +63 -0
  67. package/dist/schema/transactions.schema.d.ts +45 -0
  68. package/dist/schema/transactions.schema.d.ts.map +1 -0
  69. package/dist/schema/{transaction.schema.js → transactions.schema.js} +16 -1
  70. package/package.json +3 -3
  71. package/dist/schema/authorities.schema.d.ts.map +0 -1
  72. package/dist/schema/transaction.schema.d.ts +0 -8
  73. package/dist/schema/transaction.schema.d.ts.map +0 -1
@@ -19,43 +19,6 @@ export declare const ISAFETransactionAuthorityDataSchema: z.ZodObject<{
19
19
  authorityValidationType: AuthorityValidationType;
20
20
  authorityOver: SAFETransactionType[];
21
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
22
  /**
60
23
  * This is the transaction targetting an authority in the SAFE Ecosystem.
61
24
  *
@@ -77,9 +40,9 @@ const sampleTransactionAuthority: ISAFETransactionAuthority = {
77
40
  };
78
41
  */
79
42
  /**
80
- * This is the schema for the authority transaction.
43
+ * This is the schema for the authority transaction add.
81
44
  */
82
- export declare const ISAFETransactionAuthoritySchema: z.ZodObject<z.objectUtil.extendShape<{
45
+ export declare const ISAFETransactionAuthorityAddSchema: z.ZodObject<z.objectUtil.extendShape<{
83
46
  createdAt: z.ZodNumber;
84
47
  authority: z.ZodString;
85
48
  authoritySignature: z.ZodString;
@@ -97,7 +60,7 @@ export declare const ISAFETransactionAuthoritySchema: z.ZodObject<z.objectUtil.e
97
60
  }, {
98
61
  transaction: z.ZodObject<{
99
62
  type: z.ZodLiteral<SAFETransactionType.AUTHORITY>;
100
- action: z.ZodEnum<[SAFETransactionActionType.ADD, SAFETransactionActionType.REMOVE, SAFETransactionActionType.UPDATE]>;
63
+ action: z.ZodLiteral<SAFETransactionActionType.ADD>;
101
64
  data: z.ZodObject<{
102
65
  authorizationIssuer: z.ZodString;
103
66
  authorizationPublicKey: z.ZodString;
@@ -115,34 +78,34 @@ export declare const ISAFETransactionAuthoritySchema: z.ZodObject<z.objectUtil.e
115
78
  authorityOver: SAFETransactionType[];
116
79
  }>;
117
80
  }, "strip", z.ZodTypeAny, {
81
+ type: SAFETransactionType.AUTHORITY;
82
+ action: SAFETransactionActionType.ADD;
118
83
  data: {
119
84
  authorizationIssuer: string;
120
85
  authorizationPublicKey: string;
121
86
  authorityValidationType: AuthorityValidationType;
122
87
  authorityOver: SAFETransactionType[];
123
88
  };
124
- type: SAFETransactionType.AUTHORITY;
125
- action: SAFETransactionActionType;
126
89
  }, {
90
+ type: SAFETransactionType.AUTHORITY;
91
+ action: SAFETransactionActionType.ADD;
127
92
  data: {
128
93
  authorizationIssuer: string;
129
94
  authorizationPublicKey: string;
130
95
  authorityValidationType: AuthorityValidationType;
131
96
  authorityOver: SAFETransactionType[];
132
97
  };
133
- type: SAFETransactionType.AUTHORITY;
134
- action: SAFETransactionActionType;
135
98
  }>;
136
99
  }>, "strip", z.ZodTypeAny, {
137
100
  transaction: {
101
+ type: SAFETransactionType.AUTHORITY;
102
+ action: SAFETransactionActionType.ADD;
138
103
  data: {
139
104
  authorizationIssuer: string;
140
105
  authorizationPublicKey: string;
141
106
  authorityValidationType: AuthorityValidationType;
142
107
  authorityOver: SAFETransactionType[];
143
108
  };
144
- type: SAFETransactionType.AUTHORITY;
145
- action: SAFETransactionActionType;
146
109
  };
147
110
  createdAt: number;
148
111
  authority: string;
@@ -150,14 +113,14 @@ export declare const ISAFETransactionAuthoritySchema: z.ZodObject<z.objectUtil.e
150
113
  version: number;
151
114
  }, {
152
115
  transaction: {
116
+ type: SAFETransactionType.AUTHORITY;
117
+ action: SAFETransactionActionType.ADD;
153
118
  data: {
154
119
  authorizationIssuer: string;
155
120
  authorizationPublicKey: string;
156
121
  authorityValidationType: AuthorityValidationType;
157
122
  authorityOver: SAFETransactionType[];
158
123
  };
159
- type: SAFETransactionType.AUTHORITY;
160
- action: SAFETransactionActionType;
161
124
  };
162
125
  createdAt: number;
163
126
  authority: string;
@@ -165,9 +128,9 @@ export declare const ISAFETransactionAuthoritySchema: z.ZodObject<z.objectUtil.e
165
128
  version: number;
166
129
  }>;
167
130
  /**
168
- * This is the schema for the authority transaction add.
131
+ * This is the schema for the authority transaction update.
169
132
  */
170
- export declare const ISAFETransactionAuthorityAddSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
133
+ export declare const ISAFETransactionAuthorityUpdateSchema: z.ZodObject<z.objectUtil.extendShape<{
171
134
  createdAt: z.ZodNumber;
172
135
  authority: z.ZodString;
173
136
  authoritySignature: z.ZodString;
@@ -185,7 +148,7 @@ export declare const ISAFETransactionAuthorityAddSchema: z.ZodObject<z.objectUti
185
148
  }, {
186
149
  transaction: z.ZodObject<{
187
150
  type: z.ZodLiteral<SAFETransactionType.AUTHORITY>;
188
- action: z.ZodEnum<[SAFETransactionActionType.ADD, SAFETransactionActionType.REMOVE, SAFETransactionActionType.UPDATE]>;
151
+ action: z.ZodLiteral<SAFETransactionActionType.UPDATE>;
189
152
  data: z.ZodObject<{
190
153
  authorizationIssuer: z.ZodString;
191
154
  authorizationPublicKey: z.ZodString;
@@ -203,117 +166,34 @@ export declare const ISAFETransactionAuthorityAddSchema: z.ZodObject<z.objectUti
203
166
  authorityOver: SAFETransactionType[];
204
167
  }>;
205
168
  }, "strip", z.ZodTypeAny, {
169
+ type: SAFETransactionType.AUTHORITY;
170
+ action: SAFETransactionActionType.UPDATE;
206
171
  data: {
207
172
  authorizationIssuer: string;
208
173
  authorizationPublicKey: string;
209
174
  authorityValidationType: AuthorityValidationType;
210
175
  authorityOver: SAFETransactionType[];
211
176
  };
212
- type: SAFETransactionType.AUTHORITY;
213
- action: SAFETransactionActionType;
214
177
  }, {
178
+ type: SAFETransactionType.AUTHORITY;
179
+ action: SAFETransactionActionType.UPDATE;
215
180
  data: {
216
181
  authorizationIssuer: string;
217
182
  authorizationPublicKey: string;
218
183
  authorityValidationType: AuthorityValidationType;
219
184
  authorityOver: SAFETransactionType[];
220
185
  };
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
186
  }>;
232
187
  }>, "strip", z.ZodTypeAny, {
233
188
  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
189
  type: SAFETransactionType.AUTHORITY;
295
- action: SAFETransactionActionType;
296
- }, {
190
+ action: SAFETransactionActionType.UPDATE;
297
191
  data: {
298
192
  authorizationIssuer: string;
299
193
  authorizationPublicKey: string;
300
194
  authorityValidationType: AuthorityValidationType;
301
195
  authorityOver: SAFETransactionType[];
302
196
  };
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
197
  };
318
198
  createdAt: number;
319
199
  authority: string;
@@ -321,7 +201,14 @@ export declare const ISAFETransactionAuthorityUpdateSchema: z.ZodObject<z.object
321
201
  version: number;
322
202
  }, {
323
203
  transaction: {
204
+ type: SAFETransactionType.AUTHORITY;
324
205
  action: SAFETransactionActionType.UPDATE;
206
+ data: {
207
+ authorizationIssuer: string;
208
+ authorizationPublicKey: string;
209
+ authorityValidationType: AuthorityValidationType;
210
+ authorityOver: SAFETransactionType[];
211
+ };
325
212
  };
326
213
  createdAt: number;
327
214
  authority: string;
@@ -331,7 +218,7 @@ export declare const ISAFETransactionAuthorityUpdateSchema: z.ZodObject<z.object
331
218
  /**
332
219
  * This is the schema for the authority transaction remove.
333
220
  */
334
- export declare const ISAFETransactionAuthorityRemoveSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
221
+ export declare const ISAFETransactionAuthorityRemoveSchema: z.ZodObject<z.objectUtil.extendShape<{
335
222
  createdAt: z.ZodNumber;
336
223
  authority: z.ZodString;
337
224
  authoritySignature: z.ZodString;
@@ -349,7 +236,7 @@ export declare const ISAFETransactionAuthorityRemoveSchema: z.ZodObject<z.object
349
236
  }, {
350
237
  transaction: z.ZodObject<{
351
238
  type: z.ZodLiteral<SAFETransactionType.AUTHORITY>;
352
- action: z.ZodEnum<[SAFETransactionActionType.ADD, SAFETransactionActionType.REMOVE, SAFETransactionActionType.UPDATE]>;
239
+ action: z.ZodLiteral<SAFETransactionActionType.REMOVE>;
353
240
  data: z.ZodObject<{
354
241
  authorizationIssuer: z.ZodString;
355
242
  authorizationPublicKey: z.ZodString;
@@ -367,35 +254,34 @@ export declare const ISAFETransactionAuthorityRemoveSchema: z.ZodObject<z.object
367
254
  authorityOver: SAFETransactionType[];
368
255
  }>;
369
256
  }, "strip", z.ZodTypeAny, {
257
+ type: SAFETransactionType.AUTHORITY;
258
+ action: SAFETransactionActionType.REMOVE;
370
259
  data: {
371
260
  authorizationIssuer: string;
372
261
  authorizationPublicKey: string;
373
262
  authorityValidationType: AuthorityValidationType;
374
263
  authorityOver: SAFETransactionType[];
375
264
  };
376
- type: SAFETransactionType.AUTHORITY;
377
- action: SAFETransactionActionType;
378
265
  }, {
266
+ type: SAFETransactionType.AUTHORITY;
267
+ action: SAFETransactionActionType.REMOVE;
379
268
  data: {
380
269
  authorizationIssuer: string;
381
270
  authorizationPublicKey: string;
382
271
  authorityValidationType: AuthorityValidationType;
383
272
  authorityOver: SAFETransactionType[];
384
273
  };
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
274
  }>;
396
275
  }>, "strip", z.ZodTypeAny, {
397
276
  transaction: {
277
+ type: SAFETransactionType.AUTHORITY;
398
278
  action: SAFETransactionActionType.REMOVE;
279
+ data: {
280
+ authorizationIssuer: string;
281
+ authorizationPublicKey: string;
282
+ authorityValidationType: AuthorityValidationType;
283
+ authorityOver: SAFETransactionType[];
284
+ };
399
285
  };
400
286
  createdAt: number;
401
287
  authority: string;
@@ -403,11 +289,18 @@ export declare const ISAFETransactionAuthorityRemoveSchema: z.ZodObject<z.object
403
289
  version: number;
404
290
  }, {
405
291
  transaction: {
292
+ type: SAFETransactionType.AUTHORITY;
406
293
  action: SAFETransactionActionType.REMOVE;
294
+ data: {
295
+ authorizationIssuer: string;
296
+ authorizationPublicKey: string;
297
+ authorityValidationType: AuthorityValidationType;
298
+ authorityOver: SAFETransactionType[];
299
+ };
407
300
  };
408
301
  createdAt: number;
409
302
  authority: string;
410
303
  authoritySignature: string;
411
304
  version: number;
412
305
  }>;
413
- //# sourceMappingURL=authorities.schema.d.ts.map
306
+ //# sourceMappingURL=authorities-transactions.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorities-transactions.schema.d.ts","sourceRoot":"","sources":["../../src/schema/authorities-transactions.schema.ts"],"names":[],"mappings":"AACA,OAAO,CAAC,MAAM,KAAK,CAAC;AAMpB,OAAO,EACH,uBAAuB,EACvB,yBAAyB,EACzB,mBAAmB,EACtB,MAAM,qBAAqB,CAAC;AAK7B;;GAEG;AACH,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;EAK9C,CAAC;AAIH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;GAEG;AACH,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM7C,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMhD,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMhD,CAAC"}
@@ -3,10 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ISAFETransactionAuthorityRemoveSchema = exports.ISAFETransactionAuthorityUpdateSchema = exports.ISAFETransactionAuthorityAddSchema = exports.ISAFETransactionAuthoritySchema = exports.ISAFETransactionBaseSchema = exports.ISAFETransactionAuthorityDataSchema = void 0;
6
+ exports.ISAFETransactionAuthorityRemoveSchema = exports.ISAFETransactionAuthorityUpdateSchema = exports.ISAFETransactionAuthorityAddSchema = exports.ISAFETransactionAuthorityDataSchema = void 0;
7
7
  // This contains the schemas for the authorities objects in the zod format..
8
8
  const zod_1 = __importDefault(require("zod"));
9
- const transaction_schema_1 = require("./transaction.schema");
9
+ const transactions_schema_1 = require("./transactions.schema");
10
10
  const generic_1 = require("@degenerate/generic");
11
11
  const IAuthorizationIssuerSchema = zod_1.default.string().regex(/^[a-zA-Z0-9]+-[a-zA-Z0-9]+$/);
12
12
  const AuthorityValidationTypeSchema = zod_1.default.enum([generic_1.AuthorityValidationType.JWT]);
@@ -17,20 +17,7 @@ exports.ISAFETransactionAuthorityDataSchema = zod_1.default.object({
17
17
  authorizationIssuer: IAuthorizationIssuerSchema,
18
18
  authorizationPublicKey: zod_1.default.string(),
19
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
20
+ authorityOver: zod_1.default.array(transactions_schema_1.SAFETransactionTypeSchema),
34
21
  });
35
22
  /**
36
23
  * This is the transaction targetting an authority in the SAFE Ecosystem.
@@ -52,37 +39,33 @@ const sampleTransactionAuthority: ISAFETransactionAuthority = {
52
39
  version: 1,
53
40
  };
54
41
  */
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
42
  /**
66
43
  * This is the schema for the authority transaction add.
67
44
  */
68
- exports.ISAFETransactionAuthorityAddSchema = exports.ISAFETransactionAuthoritySchema.extend({
45
+ exports.ISAFETransactionAuthorityAddSchema = transactions_schema_1.ISAFETransactionBaseSchema.extend({
69
46
  transaction: zod_1.default.object({
47
+ type: zod_1.default.literal(generic_1.SAFETransactionType.AUTHORITY),
70
48
  action: zod_1.default.literal(generic_1.SAFETransactionActionType.ADD),
49
+ data: exports.ISAFETransactionAuthorityDataSchema,
71
50
  }),
72
51
  });
73
52
  /**
74
53
  * This is the schema for the authority transaction update.
75
54
  */
76
- exports.ISAFETransactionAuthorityUpdateSchema = exports.ISAFETransactionAuthoritySchema.extend({
55
+ exports.ISAFETransactionAuthorityUpdateSchema = transactions_schema_1.ISAFETransactionBaseSchema.extend({
77
56
  transaction: zod_1.default.object({
57
+ type: zod_1.default.literal(generic_1.SAFETransactionType.AUTHORITY),
78
58
  action: zod_1.default.literal(generic_1.SAFETransactionActionType.UPDATE),
59
+ data: exports.ISAFETransactionAuthorityDataSchema,
79
60
  }),
80
61
  });
81
62
  /**
82
63
  * This is the schema for the authority transaction remove.
83
64
  */
84
- exports.ISAFETransactionAuthorityRemoveSchema = exports.ISAFETransactionAuthoritySchema.extend({
65
+ exports.ISAFETransactionAuthorityRemoveSchema = transactions_schema_1.ISAFETransactionBaseSchema.extend({
85
66
  transaction: zod_1.default.object({
67
+ type: zod_1.default.literal(generic_1.SAFETransactionType.AUTHORITY),
86
68
  action: zod_1.default.literal(generic_1.SAFETransactionActionType.REMOVE),
69
+ data: exports.ISAFETransactionAuthorityDataSchema,
87
70
  }),
88
71
  });