@degenerate/generic 0.1.10 → 0.1.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 (58) hide show
  1. package/dist/authorization/jwt/sign/create-authorization-issuer.d.ts +2 -2
  2. package/dist/authorization/jwt/sign/create-authorization-issuer.d.ts.map +1 -1
  3. package/dist/authorization/jwt/sign/create-authorization-subject.d.ts +2 -2
  4. package/dist/authorization/jwt/sign/create-authorization-subject.d.ts.map +1 -1
  5. package/dist/authorization/jwt/sign/create-jwt-options.d.ts +2 -2
  6. package/dist/authorization/jwt/sign/create-jwt-options.d.ts.map +1 -1
  7. package/dist/authorization/safe/authorization/authorized-authorities.d.ts +5 -5
  8. package/dist/authorization/safe/authorization/authorized-authorities.d.ts.map +1 -1
  9. package/dist/authorization/safe/request/determine-issuer-from-request.d.ts +2 -2
  10. package/dist/authorization/safe/request/determine-issuer-from-request.d.ts.map +1 -1
  11. package/dist/authorization/safe/request/issuer/determine-issuer-from-bearer-token.d.ts +2 -2
  12. package/dist/authorization/safe/request/issuer/determine-issuer-from-bearer-token.d.ts.map +1 -1
  13. package/dist/authorization/safe/validation/jwt/payload/verify-authorization-issuer.d.ts +2 -2
  14. package/dist/authorization/safe/validation/jwt/payload/verify-authorization-issuer.d.ts.map +1 -1
  15. package/dist/authorization/safe/validation/jwt/payload/verify-authorization-subject.d.ts +2 -2
  16. package/dist/authorization/safe/validation/jwt/payload/verify-authorization-subject.d.ts.map +1 -1
  17. package/dist/models/authorization/authorization-models.d.ts +3 -3
  18. package/dist/models/authorization/authorization-models.d.ts.map +1 -1
  19. package/dist/models/authorization/authorization-models.js +3 -1
  20. package/dist/models/crypto/crypto-models.d.ts +10 -2
  21. package/dist/models/crypto/crypto-models.d.ts.map +1 -1
  22. package/dist/models/crypto/crypto-models.js +6 -0
  23. package/dist/models/data/data-models.d.ts +18 -5
  24. package/dist/models/data/data-models.d.ts.map +1 -1
  25. package/dist/models/data/data-models.js +24 -1
  26. package/dist/models/dynamic-execution/dynamic-execution-models.d.ts +13 -3
  27. package/dist/models/dynamic-execution/dynamic-execution-models.d.ts.map +1 -1
  28. package/dist/models/dynamic-execution/dynamic-execution-models.js +10 -0
  29. package/dist/models/events/share-event-models.d.ts +145 -24
  30. package/dist/models/events/share-event-models.d.ts.map +1 -1
  31. package/dist/models/events/share-event-models.js +53 -2
  32. package/dist/models/functions/share-data-function-models.d.ts +251 -32
  33. package/dist/models/functions/share-data-function-models.d.ts.map +1 -1
  34. package/dist/models/functions/share-data-function-models.js +100 -3
  35. package/dist/models/generic/request-response-models.d.ts +11 -3
  36. package/dist/models/generic/request-response-models.d.ts.map +1 -1
  37. package/dist/models/generic/request-response-models.js +9 -0
  38. package/dist/models/index.d.ts +2 -1
  39. package/dist/models/index.d.ts.map +1 -1
  40. package/dist/models/index.js +6 -1
  41. package/dist/models/safe/rules/share-rule-models.d.ts +931 -0
  42. package/dist/models/safe/rules/share-rule-models.d.ts.map +1 -0
  43. package/dist/models/safe/rules/share-rule-models.js +341 -0
  44. package/dist/models/safe/safe-transaction-models.d.ts +137 -20
  45. package/dist/models/safe/safe-transaction-models.d.ts.map +1 -1
  46. package/dist/models/safe/safe-transaction-models.js +88 -3
  47. package/dist/models/safe/transactions/authorities-transactions-models.d.ts +391 -0
  48. package/dist/models/safe/transactions/authorities-transactions-models.d.ts.map +1 -0
  49. package/dist/models/safe/transactions/authorities-transactions-models.js +56 -0
  50. package/dist/models/share-data/share-data.d.ts +144 -23
  51. package/dist/models/share-data/share-data.d.ts.map +1 -1
  52. package/dist/models/share-data/share-data.js +66 -1
  53. package/dist/transactions/authority/create-safe-transaction-authority-data.d.ts +2 -2
  54. package/dist/transactions/authority/create-safe-transaction-authority-data.d.ts.map +1 -1
  55. package/package.json +2 -2
  56. package/dist/models/rules/share-rule-models.d.ts +0 -303
  57. package/dist/models/rules/share-rule-models.d.ts.map +0 -1
  58. package/dist/models/rules/share-rule-models.js +0 -93
@@ -0,0 +1 @@
1
+ {"version":3,"file":"share-rule-models.d.ts","sourceRoot":"","sources":["../../../../src/models/safe/rules/share-rule-models.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB;;GAEG;AAIH;;GAEG;AACH,oBAAY,eAAe;IACvB,GAAG,QAAQ;IACX,EAAE,OAAO;CACZ;AAED,eAAO,MAAM,qBAAqB,0BAGhC,CAAC;AAEH;;GAEG;AACH,oBAAY,sBAAsB;IAC9B,EAAE,OAAO;IACT,MAAM,WAAW;CACpB;AAED,eAAO,MAAM,4BAA4B,6BAGvC,CAAC;AAEH;;GAEG;AACH,oBAAY,mBAAmB;IAC3B,MAAM,WAAW,CAAE,2BAA2B;IAC9C,KAAK,UAAU,CAAE,4CAA4C;IAC7D,QAAQ,aAAa,CAAE,yCAAyC;IAChE,IAAI,SAAS,CAAE,oBAAoB;IACnC,KAAK,UAAU,CAAE,qBAAqB;IACtC,UAAU,eAAe;CAC5B;AAED,eAAO,MAAM,yBAAyB,2EAOpC,CAAC;AAEH;;GAEG;AACH,oBAAY,kBAAkB;IAC1B,YAAY,iBAAiB;IAC7B,SAAS,cAAc;IACvB,qBAAqB,0BAA0B;IAC/C,kBAAkB,uBAAuB;CAC5C;AAED,eAAO,MAAM,wBAAwB,yFAKnC,CAAC;AAEH;;GAEG;AACH,oBAAY,2BAA2B;IACnC,WAAW,gBAAgB;IAC3B,SAAS,cAAc;CAC1B;AAED,eAAO,MAAM,iCAAiC,yCAG5C,CAAC;AAEH;;GAEG;AACH,oBAAY,oBAAoB;IAC5B,IAAI,SAAS;IACb,KAAK,UAAU;CAClB;AAED,eAAO,MAAM,0BAA0B,8BAGrC,CAAC;AAEH;;GAEG;AACH,oBAAY,oBAAoB;IAC5B,OAAO,YAAY;CACtB;AAED,eAAO,MAAM,0BAA0B,wBAErC,CAAC;AACH;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,mBAAmB,GACnB,kBAAkB,GAClB,2BAA2B,GAC3B,oBAAoB,GAC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CAAC,CAAC;AAMvE;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;EAM9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
@@ -0,0 +1,341 @@
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.IShareRuleSetSchema = exports.IShareRuleGroupSchema = exports.IRuleEvaluationResultsSchema = exports.IShareRulesEvaluationResultSchema = exports.IShareRuleEvalutionResultSchema = exports.IShareRuleAppliedSchema = exports.IShareRuleSchema = exports.IConditionSpecialSchema = exports.IConditionEmptySchema = exports.IConditionBooleanSchema = exports.IConditionNullSchema = exports.IConditionStartsEndsWithSchema = exports.IConditionContainsSchema = exports.IConditionRangeSchema = exports.IConditionEqualitySchema = exports.IConditionTypeOfSchema = exports.IConditionBaseSchema = exports.ConditionTypeOfSchema = exports.ConditionTypeOf = exports.ConditionTypeSchema = exports.ConditionTypeSpecialSchema = exports.ConditionTypeSpecial = exports.ConditionTypeBooleanSchema = exports.ConditionTypeBoolean = exports.ConditionTypeStartsEndsWithSchema = exports.ConditionTypeStartsEndsWith = exports.ConditionTypeRangeSchema = exports.ConditionTypeRange = exports.ConditionTypeSingleSchema = exports.ConditionTypeSingle = exports.ConditionTypeQualifierSchema = exports.ConditionTypeQualifier = exports.LogicalOperatorSchema = exports.LogicalOperator = void 0;
7
+ const zod_1 = __importDefault(require("zod"));
8
+ /**
9
+ * This file contains the models for the rules used in the share data.
10
+ */
11
+ //#region enums
12
+ /**
13
+ * This contains the logical operators for combining rules.
14
+ */
15
+ var LogicalOperator;
16
+ (function (LogicalOperator) {
17
+ LogicalOperator["AND"] = "AND";
18
+ LogicalOperator["OR"] = "OR";
19
+ })(LogicalOperator || (exports.LogicalOperator = LogicalOperator = {}));
20
+ exports.LogicalOperatorSchema = zod_1.default.enum([
21
+ 'AND',
22
+ 'OR',
23
+ ]);
24
+ /**
25
+ * This contains the choices for the type of qualifier.
26
+ */
27
+ var ConditionTypeQualifier;
28
+ (function (ConditionTypeQualifier) {
29
+ ConditionTypeQualifier["IS"] = "IS";
30
+ ConditionTypeQualifier["IS_NOT"] = "IS_NOT";
31
+ })(ConditionTypeQualifier || (exports.ConditionTypeQualifier = ConditionTypeQualifier = {}));
32
+ exports.ConditionTypeQualifierSchema = zod_1.default.enum([
33
+ 'IS',
34
+ 'IS_NOT',
35
+ ]);
36
+ /**
37
+ * This contains the choices for the type of condition.
38
+ */
39
+ var ConditionTypeSingle;
40
+ (function (ConditionTypeSingle) {
41
+ ConditionTypeSingle["TYPEOF"] = "TYPEOF";
42
+ ConditionTypeSingle["EQUAL"] = "EQUAL";
43
+ ConditionTypeSingle["CONTAINS"] = "CONTAINS";
44
+ ConditionTypeSingle["NULL"] = "NULL";
45
+ ConditionTypeSingle["EMPTY"] = "EMPTY";
46
+ ConditionTypeSingle["SHARE_RULE"] = "SHARE_RULE";
47
+ })(ConditionTypeSingle || (exports.ConditionTypeSingle = ConditionTypeSingle = {}));
48
+ exports.ConditionTypeSingleSchema = zod_1.default.enum([
49
+ 'TYPEOF',
50
+ 'EQUAL',
51
+ 'CONTAINS',
52
+ 'NULL',
53
+ 'EMPTY',
54
+ 'SHARE_RULE',
55
+ ]);
56
+ /**
57
+ * This contains the choices for the range conditions.
58
+ */
59
+ var ConditionTypeRange;
60
+ (function (ConditionTypeRange) {
61
+ ConditionTypeRange["GREATER_THAN"] = "GREATER_THAN";
62
+ ConditionTypeRange["LESS_THAN"] = "LESS_THAN";
63
+ ConditionTypeRange["GREATER_THAN_OR_EQUAL"] = "GREATER_THAN_OR_EQUAL";
64
+ ConditionTypeRange["LESS_THAN_OR_EQUAL"] = "LESS_THAN_OR_EQUAL";
65
+ })(ConditionTypeRange || (exports.ConditionTypeRange = ConditionTypeRange = {}));
66
+ exports.ConditionTypeRangeSchema = zod_1.default.enum([
67
+ 'GREATER_THAN',
68
+ 'LESS_THAN',
69
+ 'GREATER_THAN_OR_EQUAL',
70
+ 'LESS_THAN_OR_EQUAL',
71
+ ]);
72
+ /**
73
+ * This contains the choices for the starts with and ends with conditions.
74
+ */
75
+ var ConditionTypeStartsEndsWith;
76
+ (function (ConditionTypeStartsEndsWith) {
77
+ ConditionTypeStartsEndsWith["STARTS_WITH"] = "STARTS_WITH";
78
+ ConditionTypeStartsEndsWith["ENDS_WITH"] = "ENDS_WITH";
79
+ })(ConditionTypeStartsEndsWith || (exports.ConditionTypeStartsEndsWith = ConditionTypeStartsEndsWith = {}));
80
+ exports.ConditionTypeStartsEndsWithSchema = zod_1.default.enum([
81
+ 'STARTS_WITH',
82
+ 'ENDS_WITH',
83
+ ]);
84
+ /**
85
+ * This contains the choices for the boolean conditions.
86
+ */
87
+ var ConditionTypeBoolean;
88
+ (function (ConditionTypeBoolean) {
89
+ ConditionTypeBoolean["TRUE"] = "TRUE";
90
+ ConditionTypeBoolean["FALSE"] = "FALSE";
91
+ })(ConditionTypeBoolean || (exports.ConditionTypeBoolean = ConditionTypeBoolean = {}));
92
+ exports.ConditionTypeBooleanSchema = zod_1.default.enum([
93
+ 'TRUE',
94
+ 'FALSE',
95
+ ]);
96
+ /**
97
+ * This contains the choices for the special conditions.
98
+ */
99
+ var ConditionTypeSpecial;
100
+ (function (ConditionTypeSpecial) {
101
+ ConditionTypeSpecial["PATTERN"] = "PATTERN";
102
+ })(ConditionTypeSpecial || (exports.ConditionTypeSpecial = ConditionTypeSpecial = {}));
103
+ exports.ConditionTypeSpecialSchema = zod_1.default.enum([
104
+ 'PATTERN',
105
+ ]);
106
+ exports.ConditionTypeSchema = zod_1.default.union([
107
+ exports.ConditionTypeSingleSchema,
108
+ exports.ConditionTypeRangeSchema,
109
+ exports.ConditionTypeStartsEndsWithSchema,
110
+ exports.ConditionTypeBooleanSchema,
111
+ exports.ConditionTypeSpecialSchema,
112
+ ]);
113
+ /**
114
+ * These are the different choices for the types of data in a condition.
115
+ */
116
+ var ConditionTypeOf;
117
+ (function (ConditionTypeOf) {
118
+ ConditionTypeOf["STRING"] = "STRING";
119
+ ConditionTypeOf["NUMBER"] = "NUMBER";
120
+ ConditionTypeOf["INTEGER"] = "INTEGER";
121
+ ConditionTypeOf["BOOLEAN"] = "BOOLEAN";
122
+ ConditionTypeOf["OBJECT"] = "OBJECT";
123
+ ConditionTypeOf["ARRAY"] = "ARRAY";
124
+ ConditionTypeOf["NULL"] = "NULL";
125
+ ConditionTypeOf["UNDEFINED"] = "UNDEFINED";
126
+ ConditionTypeOf["FUNCTION"] = "FUNCTION";
127
+ ConditionTypeOf["BIGINT"] = "BIGINT";
128
+ })(ConditionTypeOf || (exports.ConditionTypeOf = ConditionTypeOf = {}));
129
+ exports.ConditionTypeOfSchema = zod_1.default.enum([
130
+ 'STRING',
131
+ 'NUMBER',
132
+ 'INTEGER',
133
+ 'BOOLEAN',
134
+ 'OBJECT',
135
+ 'ARRAY',
136
+ 'NULL',
137
+ 'UNDEFINED',
138
+ 'FUNCTION',
139
+ 'BIGINT',
140
+ ]);
141
+ //#endregion enums
142
+ //#region Conditions
143
+ /**
144
+ * This is the interface for the base condition.
145
+ */
146
+ exports.IConditionBaseSchema = zod_1.default.object({
147
+ conditionType: exports.ConditionTypeSchema,
148
+ conditionTypeQualifier: exports.ConditionTypeQualifierSchema,
149
+ targettedProperty: zod_1.default.string(),
150
+ });
151
+ /**
152
+ * This is the interface for the type of condition.
153
+ *
154
+ const exampleConditionTypeOf: IConditionTypeOf = {
155
+ conditionType: ConditionTypeSingle.TYPEOF,
156
+ ConditionTypeQualifier: ConditionTypeQualifier.IS,
157
+ conditionValue: ConditionTypeOf.NUMBER,
158
+ targettedProperty: 'address.city.total',
159
+ };
160
+ */
161
+ exports.IConditionTypeOfSchema = exports.IConditionBaseSchema.extend({
162
+ conditionType: zod_1.default.literal(exports.ConditionTypeSingleSchema.Enum.TYPEOF),
163
+ conditionValue: exports.ConditionTypeOfSchema,
164
+ });
165
+ /**
166
+ * This is the interface for the equality condition.
167
+ *
168
+ const exampleConditionEquality: IConditionEquality = {
169
+ conditionType: ConditionTypeSingle.EQUAL,
170
+ ConditionTypeQualifier: ConditionTypeQualifier.IS,
171
+ conditionValue: 100,
172
+ targettedProperty: 'address.city.total',
173
+ };
174
+ */
175
+ exports.IConditionEqualitySchema = exports.IConditionBaseSchema.extend({
176
+ conditionType: zod_1.default.literal(exports.ConditionTypeSingleSchema.Enum.EQUAL),
177
+ conditionValue: zod_1.default.union([zod_1.default.number(), zod_1.default.string()]),
178
+ });
179
+ /**
180
+ * This is the interface for the range condition.
181
+ *
182
+ const exampleConditionRange: IConditionRange = {
183
+ conditionType: ConditionTypeRange.GREATER_THAN,
184
+ ConditionTypeQualifier: ConditionTypeQualifier.IS,
185
+ conditionValue: 100,
186
+ targettedProperty: 'address.city.total',
187
+ };
188
+ */
189
+ exports.IConditionRangeSchema = exports.IConditionBaseSchema.extend({
190
+ conditionType: zod_1.default.literal(exports.ConditionTypeRangeSchema.Enum.GREATER_THAN),
191
+ conditionValue: zod_1.default.union([zod_1.default.number(), zod_1.default.string()]),
192
+ });
193
+ /**
194
+ * This is the interface for the contains condition.
195
+ *
196
+ const exampleConditionContains: IConditionContains = {
197
+ conditionType: ConditionTypeSingle.CONTAINS,
198
+ conditionTypeQualifier: ConditionTypeQualifier.IS,
199
+ conditionValue: ['gar'| 'garison' | 'garage']
200
+ targettedProperty: 'address.city.name',
201
+ * };
202
+ */
203
+ exports.IConditionContainsSchema = exports.IConditionBaseSchema.extend({
204
+ conditionType: zod_1.default.literal(exports.ConditionTypeSingleSchema.Enum.CONTAINS),
205
+ conditionValue: zod_1.default.union([zod_1.default.string(), zod_1.default.array(zod_1.default.string()), zod_1.default.array(zod_1.default.number())]),
206
+ });
207
+ /**
208
+ * This is the interface for the starts with and ends with condition.
209
+ *
210
+ const exampleConditionStartsEndsWith: IConditionStartsEndsWith = {
211
+ conditionType: ConditionTypeStartsEndsWith.STARTS_WITH,
212
+ conditionTypeQualifier: ConditionTypeQualifier.IS,
213
+ conditionValue: 'cal'
214
+ targettedProperty: 'address.city.name',
215
+ };
216
+ */
217
+ exports.IConditionStartsEndsWithSchema = exports.IConditionBaseSchema.extend({
218
+ conditionType: exports.ConditionTypeStartsEndsWithSchema,
219
+ conditionValue: zod_1.default.string(),
220
+ });
221
+ /**
222
+ * This is the interface for the null condition.
223
+ *
224
+ const exampleConditionNull: IConditionNull = {
225
+ conditionType: ConditionTypeSingle.NULL
226
+ targettedProperty: 'address.city.name',
227
+ };
228
+ */
229
+ exports.IConditionNullSchema = exports.IConditionBaseSchema.extend({
230
+ conditionType: zod_1.default.literal(exports.ConditionTypeSingleSchema.Enum.NULL),
231
+ });
232
+ /**
233
+ * This is the interface for the boolean condition.
234
+ *
235
+ const exampleConditionBoolean: IConditionBoolean = {
236
+ conditionType: ConditionTypeBoolean.TRUE,
237
+ conditionTypeQualifier: ConditionTypeQualifier.IS,
238
+ targettedProperty: 'address.city.name',
239
+ };
240
+ */
241
+ exports.IConditionBooleanSchema = exports.IConditionBaseSchema.extend({
242
+ conditionType: exports.ConditionTypeBooleanSchema,
243
+ });
244
+ /**
245
+ * This is the interface for the empty condition.
246
+ *
247
+ const exampleConditionEmpty: IConditionEmpty = {
248
+ conditionType: ConditionTypeEmpty.IS_EMPTY,
249
+ conditionTypeQualifier: ConditionTypeQualifier.IS,
250
+ targettedProperty: 'address.city.name',
251
+ };
252
+ */
253
+ exports.IConditionEmptySchema = exports.IConditionBaseSchema.extend({
254
+ conditionType: zod_1.default.literal(exports.ConditionTypeSingleSchema.Enum.EMPTY),
255
+ });
256
+ /**
257
+ * This is the interface for the special condition.
258
+ *
259
+ const exampleConditionSpecial: IConditionSpecial = {
260
+ conditionType: ConditionTypeSpecial.PATTERN,
261
+ conditionTypeQualifier: ConditionTypeQualifier.IS,
262
+ conditionValue: '^[a-zA-Z0-9]*$'
263
+ targettedProperty: 'address.city.name',
264
+ };
265
+ */
266
+ exports.IConditionSpecialSchema = exports.IConditionBaseSchema.extend({
267
+ conditionType: zod_1.default.literal(exports.ConditionTypeSpecialSchema.Enum.PATTERN),
268
+ conditionValue: zod_1.default.string(),
269
+ });
270
+ //#endregion Conditions
271
+ //#region Rule
272
+ /**
273
+ * This contains the interface for a share rule in the share data object
274
+ */
275
+ exports.IShareRuleSchema = zod_1.default.object({
276
+ ruleId: zod_1.default.string(),
277
+ currentDataConditions: zod_1.default.array(exports.IConditionBaseSchema),
278
+ proposedDataConditions: zod_1.default.array(exports.IConditionBaseSchema),
279
+ });
280
+ /**
281
+ * This contains the applied rule informaiton in the share data object.
282
+ */
283
+ exports.IShareRuleAppliedSchema = exports.IShareRuleSchema.extend({
284
+ targettedProperty: zod_1.default.string(),
285
+ });
286
+ //#endregion Rule
287
+ //#region Rule Evaluation
288
+ /**
289
+ * This contains the interface for the rule evaluation.
290
+ */
291
+ exports.IShareRuleEvalutionResultSchema = zod_1.default.object({
292
+ ruleId: zod_1.default.string(),
293
+ currentResult: zod_1.default.boolean(),
294
+ currentConditionFailure: zod_1.default.array(exports.IConditionBaseSchema),
295
+ proposedResult: zod_1.default.boolean(),
296
+ proposedConditionFailure: zod_1.default.array(exports.IConditionBaseSchema),
297
+ });
298
+ /**
299
+ * This contains the interface for the rule evaluation.
300
+ */
301
+ exports.IShareRulesEvaluationResultSchema = zod_1.default.object({
302
+ rootParam: zod_1.default.string(),
303
+ passedRuleCheck: zod_1.default.boolean(),
304
+ passedRuleId: zod_1.default.string(),
305
+ shareRuleEvalutionResults: zod_1.default.array(exports.IShareRuleEvalutionResultSchema),
306
+ });
307
+ /**
308
+ * This contains the interface for the rule evaluation results.
309
+ */
310
+ exports.IRuleEvaluationResultsSchema = zod_1.default.object({
311
+ shareDataId: zod_1.default.string(),
312
+ rulesResults: zod_1.default.array(exports.IShareRulesEvaluationResultSchema),
313
+ isValidProposal: zod_1.default.boolean(),
314
+ });
315
+ //#endregion Rule Evaluation
316
+ //#region RuleGroup
317
+ /**
318
+ * This contains the interface for a rule group.
319
+ *
320
+ * A rule group can contain individual rules or nested rule groups.
321
+ */
322
+ // Define the base schema for IShareRuleGroupSchema
323
+ const BaseShareRuleGroupSchema = zod_1.default.object({
324
+ operator: exports.LogicalOperatorSchema,
325
+ rules: zod_1.default.array(zod_1.default.union([exports.IShareRuleAppliedSchema, zod_1.default.lazy(() => exports.IShareRuleGroupSchema)])),
326
+ });
327
+ // Define the recursive schema using z.lazy
328
+ exports.IShareRuleGroupSchema = BaseShareRuleGroupSchema;
329
+ //#endregion RuleGroup
330
+ //#region RuleSet
331
+ /**
332
+ * This contains the interface for the rule set in the share data object
333
+ */
334
+ exports.IShareRuleSetSchema = zod_1.default.object({
335
+ description: zod_1.default.string().optional(),
336
+ id: zod_1.default.string(),
337
+ name: zod_1.default.string(),
338
+ ruleGroups: zod_1.default.array(exports.IShareRuleGroupSchema),
339
+ version: zod_1.default.number(),
340
+ });
341
+ //#endregion RuleSet
@@ -1,12 +1,13 @@
1
- import { AuthorityValidationType, IAuthorizationIssuer } from '../authorization/authorization-models';
1
+ import z from 'zod';
2
2
  /**
3
3
  * This is the type of function that is being targetted in the transaction.
4
4
  */
5
5
  export declare enum SAFETransactionActionType {
6
6
  ADD = "ADD",
7
- REMOVE = "REMOVE",
7
+ REMOVE = "DELETE",
8
8
  UPDATE = "UPDATE"
9
9
  }
10
+ export declare const SAFETransactionActionTypeSchema: z.ZodEnum<["ADD", "DELETE", "UPDATE"]>;
10
11
  /**
11
12
  * This is the transaction for sharing data in the SAFE Ecosystem.
12
13
  */
@@ -18,6 +19,7 @@ export declare enum SAFETransactionType {
18
19
  EVENTS = "EVENTS",// the events in the SAFE Ecosystem
19
20
  ENDPOINTS = "ENDPOINTS"
20
21
  }
22
+ export declare const SAFETransactionTypeSchema: z.ZodEnum<["AUTHORITY", "SHAREDATA", "FUNCTIONS", "RULES", "EVENTS", "ENDPOINTS"]>;
21
23
  /**
22
24
  * This contains the minimum information required for a SAFE transaction.
23
25
  *
@@ -32,16 +34,61 @@ const sampleTransactionBase: ISAFETransactionBase = {
32
34
  version: 1,
33
35
  };
34
36
  */
35
- export interface ISAFETransactionBase {
37
+ export declare const ISAFETransactionBaseSchema: z.ZodObject<{
38
+ createdAt: z.ZodNumber;
39
+ authority: z.ZodString;
40
+ authoritySignature: z.ZodString;
41
+ transaction: z.ZodObject<{
42
+ type: z.ZodEnum<["AUTHORITY", "SHAREDATA", "FUNCTIONS", "RULES", "EVENTS", "ENDPOINTS"]>;
43
+ action: z.ZodEnum<["ADD", "DELETE", "UPDATE"]>;
44
+ }, "strip", z.ZodTypeAny, {
45
+ type: "SHAREDATA" | "FUNCTIONS" | "RULES" | "EVENTS" | "ENDPOINTS" | "AUTHORITY";
46
+ action: "ADD" | "DELETE" | "UPDATE";
47
+ }, {
48
+ type: "SHAREDATA" | "FUNCTIONS" | "RULES" | "EVENTS" | "ENDPOINTS" | "AUTHORITY";
49
+ action: "ADD" | "DELETE" | "UPDATE";
50
+ }>;
51
+ version: z.ZodNumber;
52
+ }, "strip", z.ZodTypeAny, {
36
53
  createdAt: number;
54
+ version: number;
37
55
  authority: string;
38
56
  authoritySignature: string;
39
57
  transaction: {
40
- type: SAFETransactionType;
41
- action: SAFETransactionActionType;
58
+ type: "SHAREDATA" | "FUNCTIONS" | "RULES" | "EVENTS" | "ENDPOINTS" | "AUTHORITY";
59
+ action: "ADD" | "DELETE" | "UPDATE";
42
60
  };
61
+ }, {
62
+ createdAt: number;
43
63
  version: number;
44
- }
64
+ authority: string;
65
+ authoritySignature: string;
66
+ transaction: {
67
+ type: "SHAREDATA" | "FUNCTIONS" | "RULES" | "EVENTS" | "ENDPOINTS" | "AUTHORITY";
68
+ action: "ADD" | "DELETE" | "UPDATE";
69
+ };
70
+ }>;
71
+ export type ISAFETransactionBase = z.infer<typeof ISAFETransactionBaseSchema>;
72
+ /**
73
+ * This is the data for the authority in the SAFE Ecosystem.
74
+ */
75
+ export declare const ISAFETransactionAuthorityDataSchema: z.ZodObject<{
76
+ authorizationIssuer: z.ZodString;
77
+ authorizationPublicKey: z.ZodString;
78
+ authorityValidationType: z.ZodEnum<["JWT"]>;
79
+ authorityOver: z.ZodArray<z.ZodEnum<["AUTHORITY", "SHAREDATA", "FUNCTIONS", "RULES", "EVENTS", "ENDPOINTS"]>, "many">;
80
+ }, "strip", z.ZodTypeAny, {
81
+ authorizationIssuer: string;
82
+ authorizationPublicKey: string;
83
+ authorityValidationType: "JWT";
84
+ authorityOver: ("SHAREDATA" | "FUNCTIONS" | "RULES" | "EVENTS" | "ENDPOINTS" | "AUTHORITY")[];
85
+ }, {
86
+ authorizationIssuer: string;
87
+ authorizationPublicKey: string;
88
+ authorityValidationType: "JWT";
89
+ authorityOver: ("SHAREDATA" | "FUNCTIONS" | "RULES" | "EVENTS" | "ENDPOINTS" | "AUTHORITY")[];
90
+ }>;
91
+ export type ISAFETransactionAuthorityData = z.infer<typeof ISAFETransactionAuthorityDataSchema>;
45
92
  /**
46
93
  * This is the transaction targetting an authority in the SAFE Ecosystem.
47
94
  *
@@ -53,7 +100,7 @@ const sampleTransactionAuthority: ISAFETransactionAuthority = {
53
100
  type: SAFETransactionType.AUTHORITY,
54
101
  action: SAFETransactionActionType.CREATE,
55
102
  data: {
56
- authorizationIssuer: 'exampleIssuer-12345678' as IAuthorizationIssuer,
103
+ authorizationIssuer: 'exampleIssuer-12345678' as AuthorizationIssuer,
57
104
  authorizationPublicKey: '0xAuthorizationPublicKey',
58
105
  authorityValidationType: AuthorityValidationType.JWT,
59
106
  authorityOver: [SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS],
@@ -62,20 +109,90 @@ const sampleTransactionAuthority: ISAFETransactionAuthority = {
62
109
  version: 1,
63
110
  };
64
111
  */
65
- export interface ISAFETransactionAuthority extends ISAFETransactionBase {
112
+ export declare const ISAFETransactionAuthoritySchema: z.ZodObject<z.objectUtil.extendShape<{
113
+ createdAt: z.ZodNumber;
114
+ authority: z.ZodString;
115
+ authoritySignature: z.ZodString;
116
+ transaction: z.ZodObject<{
117
+ type: z.ZodEnum<["AUTHORITY", "SHAREDATA", "FUNCTIONS", "RULES", "EVENTS", "ENDPOINTS"]>;
118
+ action: z.ZodEnum<["ADD", "DELETE", "UPDATE"]>;
119
+ }, "strip", z.ZodTypeAny, {
120
+ type: "SHAREDATA" | "FUNCTIONS" | "RULES" | "EVENTS" | "ENDPOINTS" | "AUTHORITY";
121
+ action: "ADD" | "DELETE" | "UPDATE";
122
+ }, {
123
+ type: "SHAREDATA" | "FUNCTIONS" | "RULES" | "EVENTS" | "ENDPOINTS" | "AUTHORITY";
124
+ action: "ADD" | "DELETE" | "UPDATE";
125
+ }>;
126
+ version: z.ZodNumber;
127
+ }, {
128
+ transaction: z.ZodObject<{
129
+ type: z.ZodLiteral<SAFETransactionType.AUTHORITY>;
130
+ action: z.ZodEnum<["ADD", "DELETE", "UPDATE"]>;
131
+ data: z.ZodObject<{
132
+ authorizationIssuer: z.ZodString;
133
+ authorizationPublicKey: z.ZodString;
134
+ authorityValidationType: z.ZodEnum<["JWT"]>;
135
+ authorityOver: z.ZodArray<z.ZodEnum<["AUTHORITY", "SHAREDATA", "FUNCTIONS", "RULES", "EVENTS", "ENDPOINTS"]>, "many">;
136
+ }, "strip", z.ZodTypeAny, {
137
+ authorizationIssuer: string;
138
+ authorizationPublicKey: string;
139
+ authorityValidationType: "JWT";
140
+ authorityOver: ("SHAREDATA" | "FUNCTIONS" | "RULES" | "EVENTS" | "ENDPOINTS" | "AUTHORITY")[];
141
+ }, {
142
+ authorizationIssuer: string;
143
+ authorizationPublicKey: string;
144
+ authorityValidationType: "JWT";
145
+ authorityOver: ("SHAREDATA" | "FUNCTIONS" | "RULES" | "EVENTS" | "ENDPOINTS" | "AUTHORITY")[];
146
+ }>;
147
+ }, "strip", z.ZodTypeAny, {
148
+ type: SAFETransactionType.AUTHORITY;
149
+ action: "ADD" | "DELETE" | "UPDATE";
150
+ data: {
151
+ authorizationIssuer: string;
152
+ authorizationPublicKey: string;
153
+ authorityValidationType: "JWT";
154
+ authorityOver: ("SHAREDATA" | "FUNCTIONS" | "RULES" | "EVENTS" | "ENDPOINTS" | "AUTHORITY")[];
155
+ };
156
+ }, {
157
+ type: SAFETransactionType.AUTHORITY;
158
+ action: "ADD" | "DELETE" | "UPDATE";
159
+ data: {
160
+ authorizationIssuer: string;
161
+ authorizationPublicKey: string;
162
+ authorityValidationType: "JWT";
163
+ authorityOver: ("SHAREDATA" | "FUNCTIONS" | "RULES" | "EVENTS" | "ENDPOINTS" | "AUTHORITY")[];
164
+ };
165
+ }>;
166
+ }>, "strip", z.ZodTypeAny, {
167
+ createdAt: number;
168
+ version: number;
169
+ authority: string;
170
+ authoritySignature: string;
66
171
  transaction: {
67
172
  type: SAFETransactionType.AUTHORITY;
68
- action: SAFETransactionActionType;
69
- data: ISAFETransactionAuthorityData;
173
+ action: "ADD" | "DELETE" | "UPDATE";
174
+ data: {
175
+ authorizationIssuer: string;
176
+ authorizationPublicKey: string;
177
+ authorityValidationType: "JWT";
178
+ authorityOver: ("SHAREDATA" | "FUNCTIONS" | "RULES" | "EVENTS" | "ENDPOINTS" | "AUTHORITY")[];
179
+ };
70
180
  };
71
- }
72
- /**
73
- * This is the data for the authority in the SAFE Ecosystem.
74
- */
75
- export interface ISAFETransactionAuthorityData {
76
- authorizationIssuer: IAuthorizationIssuer;
77
- authorizationPublicKey: string;
78
- authorityValidationType: AuthorityValidationType;
79
- authorityOver: SAFETransactionType[];
80
- }
181
+ }, {
182
+ createdAt: number;
183
+ version: number;
184
+ authority: string;
185
+ authoritySignature: string;
186
+ transaction: {
187
+ type: SAFETransactionType.AUTHORITY;
188
+ action: "ADD" | "DELETE" | "UPDATE";
189
+ data: {
190
+ authorizationIssuer: string;
191
+ authorizationPublicKey: string;
192
+ authorityValidationType: "JWT";
193
+ authorityOver: ("SHAREDATA" | "FUNCTIONS" | "RULES" | "EVENTS" | "ENDPOINTS" | "AUTHORITY")[];
194
+ };
195
+ };
196
+ }>;
197
+ export type ISAFETransactionAuthority = z.infer<typeof ISAFETransactionAuthoritySchema>;
81
198
  //# sourceMappingURL=safe-transaction-models.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"safe-transaction-models.d.ts","sourceRoot":"","sources":["../../../src/models/safe/safe-transaction-models.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAItG;;GAEG;AACH,oBAAY,yBAAyB;IACjC,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,MAAM,WAAW;CACpB;AAED;;GAEG;AACH,oBAAY,mBAAmB;IAC3B,SAAS,cAAc,CAAE,sCAAsC;IAC/D,SAAS,cAAc,CAAE,uCAAuC;IAChE,SAAS,cAAc,CAAE,sCAAsC;IAC/D,KAAK,UAAU,CAAE,kCAAkC;IACnD,MAAM,WAAW,CAAE,mCAAmC;IACtD,SAAS,cAAc;CAC1B;AAID;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,oBAAoB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,WAAW,EAAE;QACT,IAAI,EAAE,mBAAmB,CAAC;QAC1B,MAAM,EAAE,yBAAyB,CAAC;KACrC,CAAC;IACF,OAAO,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,yBAA0B,SAAQ,oBAAoB;IACnE,WAAW,EAAE;QACT,IAAI,EAAE,mBAAmB,CAAC,SAAS,CAAC;QACpC,MAAM,EAAE,yBAAyB,CAAC;QAClC,IAAI,EAAE,6BAA6B,CAAC;KACvC,CAAA;CACJ;AAED;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC1C,mBAAmB,EAAE,oBAAoB,CAAC;IAC1C,sBAAsB,EAAE,MAAM,CAAC;IAC/B,uBAAuB,EAAE,uBAAuB,CAAC;IACjD,aAAa,EAAE,mBAAmB,EAAE,CAAC;CACxC"}
1
+ {"version":3,"file":"safe-transaction-models.d.ts","sourceRoot":"","sources":["../../../src/models/safe/safe-transaction-models.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAUpB;;GAEG;AACH,oBAAY,yBAAyB;IACjC,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,MAAM,WAAW;CACpB;AAED,eAAO,MAAM,+BAA+B,wCAI1C,CAAC;AAEH;;GAEG;AACH,oBAAY,mBAAmB;IAC3B,SAAS,cAAc,CAAE,sCAAsC;IAC/D,SAAS,cAAc,CAAE,uCAAuC;IAChE,SAAS,cAAc,CAAE,sCAAsC;IAC/D,KAAK,UAAU,CAAE,kCAAkC;IACnD,MAAM,WAAW,CAAE,mCAAmC;IACtD,SAAS,cAAc;CAC1B;AAED,eAAO,MAAM,yBAAyB,oFAOpC,CAAC;AAMH;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAS9E;;GAEG;AACH,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;EAK9C,CAAC;AAEH,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,CAAC;AAEhG;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM1C,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC"}
@@ -1,7 +1,12 @@
1
1
  "use strict";
2
- /// This file is used to keep all safe transactions for the SAFE system.
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
3
5
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.SAFETransactionType = exports.SAFETransactionActionType = void 0;
6
+ exports.ISAFETransactionAuthoritySchema = exports.ISAFETransactionAuthorityDataSchema = exports.ISAFETransactionBaseSchema = exports.SAFETransactionTypeSchema = exports.SAFETransactionType = exports.SAFETransactionActionTypeSchema = exports.SAFETransactionActionType = void 0;
7
+ const zod_1 = __importDefault(require("zod"));
8
+ const authorization_models_1 = require("../authorization/authorization-models");
9
+ /// This file is used to keep all safe transactions for the SAFE system.
5
10
  //#region Enums
6
11
  /**
7
12
  * This is the type of function that is being targetted in the transaction.
@@ -9,9 +14,14 @@ exports.SAFETransactionType = exports.SAFETransactionActionType = void 0;
9
14
  var SAFETransactionActionType;
10
15
  (function (SAFETransactionActionType) {
11
16
  SAFETransactionActionType["ADD"] = "ADD";
12
- SAFETransactionActionType["REMOVE"] = "REMOVE";
17
+ SAFETransactionActionType["REMOVE"] = "DELETE";
13
18
  SAFETransactionActionType["UPDATE"] = "UPDATE";
14
19
  })(SAFETransactionActionType || (exports.SAFETransactionActionType = SAFETransactionActionType = {}));
20
+ exports.SAFETransactionActionTypeSchema = zod_1.default.enum([
21
+ 'ADD',
22
+ 'DELETE',
23
+ 'UPDATE',
24
+ ]);
15
25
  /**
16
26
  * This is the transaction for sharing data in the SAFE Ecosystem.
17
27
  */
@@ -24,3 +34,78 @@ var SAFETransactionType;
24
34
  SAFETransactionType["EVENTS"] = "EVENTS";
25
35
  SAFETransactionType["ENDPOINTS"] = "ENDPOINTS";
26
36
  })(SAFETransactionType || (exports.SAFETransactionType = SAFETransactionType = {}));
37
+ exports.SAFETransactionTypeSchema = zod_1.default.enum([
38
+ 'AUTHORITY',
39
+ 'SHAREDATA',
40
+ 'FUNCTIONS',
41
+ 'RULES',
42
+ 'EVENTS',
43
+ 'ENDPOINTS',
44
+ ]);
45
+ //#endregion Enums
46
+ //#region Base Transaction
47
+ /**
48
+ * This contains the minimum information required for a SAFE transaction.
49
+ *
50
+ const sampleTransactionBase: ISAFETransactionBase = {
51
+ createdAt: Date.now(),
52
+ authority: '0xAuthorityPublicKey',
53
+ authoritySignature: '0xAuthoritySignature',
54
+ transaction: {
55
+ type: SAFETransactionType.AUTHORITY,
56
+ action: SAFETransactionActionType.CREATE,
57
+ },
58
+ version: 1,
59
+ };
60
+ */
61
+ exports.ISAFETransactionBaseSchema = zod_1.default.object({
62
+ createdAt: zod_1.default.number(), // the time the transaction was created (in milliseconds)
63
+ authority: zod_1.default.string(), // the public key of the authority that created the transaction
64
+ authoritySignature: zod_1.default.string(), // the signature of the authority that created the transaction
65
+ transaction: zod_1.default.object({
66
+ type: exports.SAFETransactionTypeSchema, // the type of transaction
67
+ action: exports.SAFETransactionActionTypeSchema, // the action to perform on the transaction
68
+ }),
69
+ version: zod_1.default.number(), // the version of the transaction
70
+ });
71
+ //#endregion Base Transaction
72
+ //#region Authorities Transaction
73
+ // const AuthorizationIssuerSchema = z.string().regex(/^[a-zA-Z0-9]+-[a-zA-Z0-9]+$/);
74
+ // const AuthorityValidationTypeSchema = z.enum(['JWT']);
75
+ /**
76
+ * This is the data for the authority in the SAFE Ecosystem.
77
+ */
78
+ exports.ISAFETransactionAuthorityDataSchema = zod_1.default.object({
79
+ authorizationIssuer: authorization_models_1.AuthorizationIssuerSchema,
80
+ authorizationPublicKey: zod_1.default.string(),
81
+ authorityValidationType: authorization_models_1.AuthorityValidationTypeSchema,
82
+ authorityOver: zod_1.default.array(exports.SAFETransactionTypeSchema),
83
+ });
84
+ /**
85
+ * This is the transaction targetting an authority in the SAFE Ecosystem.
86
+ *
87
+ const sampleTransactionAuthority: ISAFETransactionAuthority = {
88
+ createdAt: Date.now(),
89
+ authority: '0xAuthorityPublicKey',
90
+ authoritySignature: '0xAuthoritySignature',
91
+ transaction: {
92
+ type: SAFETransactionType.AUTHORITY,
93
+ action: SAFETransactionActionType.CREATE,
94
+ data: {
95
+ authorizationIssuer: 'exampleIssuer-12345678' as AuthorizationIssuer,
96
+ authorizationPublicKey: '0xAuthorizationPublicKey',
97
+ authorityValidationType: AuthorityValidationType.JWT,
98
+ authorityOver: [SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS],
99
+ },
100
+ },
101
+ version: 1,
102
+ };
103
+ */
104
+ exports.ISAFETransactionAuthoritySchema = exports.ISAFETransactionBaseSchema.extend({
105
+ transaction: zod_1.default.object({
106
+ type: zod_1.default.literal(SAFETransactionType.AUTHORITY),
107
+ action: exports.SAFETransactionActionTypeSchema,
108
+ data: exports.ISAFETransactionAuthorityDataSchema,
109
+ }),
110
+ });
111
+ //#endregion Authorities Transaction