@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.
- package/README.md +27 -2
- package/dist/__tests__/jest.setup.d.ts +10 -0
- package/dist/__tests__/jest.setup.d.ts.map +1 -0
- package/dist/__tests__/jest.setup.js +2 -0
- package/dist/cors/authority/jwt/validate-jwt-authorities.d.ts +2 -2
- package/dist/cors/authority/jwt/validate-jwt-authorities.d.ts.map +1 -1
- package/dist/cors/authority/jwt/validate-jwt-authorities.js +0 -1
- package/dist/cors/authority/jwt/validate-jwt-endpoints.d.ts +16 -0
- package/dist/cors/authority/jwt/validate-jwt-endpoints.d.ts.map +1 -0
- package/dist/cors/authority/jwt/validate-jwt-endpoints.js +32 -0
- package/dist/cors/authority/jwt/validate-jwt-events.d.ts +16 -0
- package/dist/cors/authority/jwt/validate-jwt-events.d.ts.map +1 -0
- package/dist/cors/authority/jwt/validate-jwt-events.js +32 -0
- package/dist/cors/authority/jwt/validate-jwt-functions.d.ts +16 -0
- package/dist/cors/authority/jwt/validate-jwt-functions.d.ts.map +1 -0
- package/dist/cors/authority/jwt/validate-jwt-functions.js +32 -0
- package/dist/cors/authority/jwt/validate-jwt-rules.d.ts +16 -0
- package/dist/cors/authority/jwt/validate-jwt-rules.d.ts.map +1 -0
- package/dist/cors/authority/jwt/validate-jwt-rules.js +32 -0
- package/dist/cors/authority/jwt/validate-jwt-share-data.d.ts +16 -0
- package/dist/cors/authority/jwt/validate-jwt-share-data.d.ts.map +1 -0
- package/dist/cors/authority/jwt/validate-jwt-share-data.js +32 -0
- package/dist/cors/endpoints/helpers/validate-incoming-request-data.d.ts +10 -0
- package/dist/cors/endpoints/helpers/validate-incoming-request-data.d.ts.map +1 -0
- package/dist/cors/endpoints/helpers/validate-incoming-request-data.js +37 -0
- package/dist/cors/errors/bad-request-handler.d.ts.map +1 -1
- package/dist/cors/errors/bad-request-handler.js +1 -2
- package/dist/cors/index.d.ts +12 -4
- package/dist/cors/index.d.ts.map +1 -1
- package/dist/cors/index.js +20 -6
- package/dist/cors/logging/add-unique-tracking.d.ts +11 -0
- package/dist/cors/logging/add-unique-tracking.d.ts.map +1 -0
- package/dist/cors/logging/add-unique-tracking.js +18 -0
- package/dist/cors/logging/request-logging.d.ts +11 -0
- package/dist/cors/logging/request-logging.d.ts.map +1 -0
- package/dist/cors/logging/request-logging.js +26 -0
- package/dist/cors/routes/authorities/v1.routes.d.ts +2 -0
- package/dist/cors/routes/authorities/v1.routes.d.ts.map +1 -0
- package/dist/cors/routes/authorities/v1.routes.js +87 -0
- package/dist/cors/routes/authorities.routes.d.ts.map +1 -1
- package/dist/cors/routes/authorities.routes.js +8 -59
- package/dist/cors/routes/rules/v1/rule-set.routes.d.ts +2 -0
- package/dist/cors/routes/rules/v1/rule-set.routes.d.ts.map +1 -0
- package/dist/cors/routes/rules/v1/rule-set.routes.js +104 -0
- package/dist/cors/routes/rules/v1.routes.d.ts +2 -0
- package/dist/cors/routes/rules/v1.routes.d.ts.map +1 -0
- package/dist/cors/routes/rules/v1.routes.js +44 -0
- package/dist/cors/routes/rules.routes.d.ts.map +1 -1
- package/dist/cors/routes/rules.routes.js +6 -24
- package/dist/examples/express-server/app.d.ts.map +1 -1
- package/dist/examples/express-server/app.js +4 -0
- package/dist/schema/{authorities.schema.d.ts → authorities-transactions.schema.d.ts} +47 -154
- package/dist/schema/authorities-transactions.schema.d.ts.map +1 -0
- package/dist/schema/{authorities.schema.js → authorities-transactions.schema.js} +12 -29
- package/dist/schema/rules/rules-conditions.schema.d.ts +402 -0
- package/dist/schema/rules/rules-conditions.schema.d.ts.map +1 -0
- package/dist/schema/rules/rules-conditions.schema.js +99 -0
- package/dist/schema/rules/rules-enums.schema.d.ts +39 -0
- package/dist/schema/rules/rules-enums.schema.d.ts.map +1 -0
- package/dist/schema/rules/rules-enums.schema.js +90 -0
- package/dist/schema/rules/rules.schema.d.ts +2839 -0
- package/dist/schema/rules/rules.schema.d.ts.map +1 -0
- package/dist/schema/rules/rules.schema.js +76 -0
- package/dist/schema/rules-transactions.schema.d.ts +450 -0
- package/dist/schema/rules-transactions.schema.d.ts.map +1 -0
- package/dist/schema/rules-transactions.schema.js +63 -0
- package/dist/schema/transactions.schema.d.ts +45 -0
- package/dist/schema/transactions.schema.d.ts.map +1 -0
- package/dist/schema/{transaction.schema.js → transactions.schema.js} +16 -1
- package/package.json +3 -3
- package/dist/schema/authorities.schema.d.ts.map +0 -1
- package/dist/schema/transaction.schema.d.ts +0 -8
- package/dist/schema/transaction.schema.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.schema.d.ts","sourceRoot":"","sources":["../../../src/schema/rules/rules.schema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,CAAC,CAAC,SAI9B,CAAC;AAEJ;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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C,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//#region Rule
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.IRuleEvaluationResultsSchema = exports.IShareRulesEvaluationResultSchema = exports.IShareRuleEvaluationResultSchema = exports.IShareRuleSetSchema = exports.IShareRuleGroupSchema = exports.IShareRuleAppliedSchema = exports.IShareRuleSchema = void 0;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const rules_conditions_schema_1 = require("./rules-conditions.schema");
|
|
7
|
+
const rules_enums_schema_1 = require("./rules-enums.schema");
|
|
8
|
+
/**
|
|
9
|
+
* This contains the schema for a share rule in the share data object.
|
|
10
|
+
*/
|
|
11
|
+
exports.IShareRuleSchema = zod_1.z.lazy(() => zod_1.z.object({
|
|
12
|
+
ruleId: zod_1.z.string(),
|
|
13
|
+
currentDataConditions: zod_1.z.array(rules_conditions_schema_1.IConditionSchema),
|
|
14
|
+
proposedDataConditions: zod_1.z.array(rules_conditions_schema_1.IConditionSchema),
|
|
15
|
+
}));
|
|
16
|
+
/**
|
|
17
|
+
* This contains the applied rule information in the share data object.
|
|
18
|
+
*/
|
|
19
|
+
exports.IShareRuleAppliedSchema = zod_1.z.object({
|
|
20
|
+
ruleId: zod_1.z.string(),
|
|
21
|
+
currentDataConditions: zod_1.z.array(rules_conditions_schema_1.IConditionSchema), // Replace with actual condition schema
|
|
22
|
+
proposedDataConditions: zod_1.z.array(rules_conditions_schema_1.IConditionSchema), // Replace with actual condition schema
|
|
23
|
+
targettedProperty: zod_1.z.string(),
|
|
24
|
+
});
|
|
25
|
+
//#endregion Rule
|
|
26
|
+
//#region RuleGroup
|
|
27
|
+
/**
|
|
28
|
+
* This contains the schema for a rule group.
|
|
29
|
+
* A rule group can contain individual rules or nested rule groups.
|
|
30
|
+
*/
|
|
31
|
+
exports.IShareRuleGroupSchema = zod_1.z.lazy(() => zod_1.z.object({
|
|
32
|
+
operator: rules_enums_schema_1.LogicalOperatorSchema,
|
|
33
|
+
rules: zod_1.z.array(zod_1.z.union([exports.IShareRuleAppliedSchema, exports.IShareRuleGroupSchema])),
|
|
34
|
+
}));
|
|
35
|
+
//#endregion RuleGroup
|
|
36
|
+
//#region RuleSet
|
|
37
|
+
/**
|
|
38
|
+
* This contains the schema for the rule set in the share data object.
|
|
39
|
+
*/
|
|
40
|
+
exports.IShareRuleSetSchema = zod_1.z.object({
|
|
41
|
+
description: zod_1.z.string().optional(), // the description of the rule set
|
|
42
|
+
id: zod_1.z.string(), // the id of the rule set
|
|
43
|
+
name: zod_1.z.string(), // the name of the rule set
|
|
44
|
+
ruleGroups: zod_1.z.array(exports.IShareRuleGroupSchema), // the rules in the rule set
|
|
45
|
+
version: zod_1.z.number(), // the version of the rule set
|
|
46
|
+
});
|
|
47
|
+
//#endregion RuleSet
|
|
48
|
+
//#region Rule Evaluation
|
|
49
|
+
/**
|
|
50
|
+
* This contains the schema for the rule evaluation.
|
|
51
|
+
*/
|
|
52
|
+
exports.IShareRuleEvaluationResultSchema = zod_1.z.object({
|
|
53
|
+
ruleId: zod_1.z.string(),
|
|
54
|
+
currentResult: zod_1.z.boolean(),
|
|
55
|
+
currentConditionFailure: zod_1.z.array(rules_conditions_schema_1.IConditionSchema),
|
|
56
|
+
proposedResult: zod_1.z.boolean(),
|
|
57
|
+
proposedConditionFailure: zod_1.z.array(rules_conditions_schema_1.IConditionSchema),
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* This contains the schema for the rule evaluation.
|
|
61
|
+
*/
|
|
62
|
+
exports.IShareRulesEvaluationResultSchema = zod_1.z.object({
|
|
63
|
+
rootParam: zod_1.z.string(),
|
|
64
|
+
passedRuleCheck: zod_1.z.boolean(),
|
|
65
|
+
passedRuleId: zod_1.z.string(),
|
|
66
|
+
shareRuleEvaluationResults: zod_1.z.array(exports.IShareRuleEvaluationResultSchema),
|
|
67
|
+
});
|
|
68
|
+
/**
|
|
69
|
+
* This contains the schema for the rule evaluation results.
|
|
70
|
+
*/
|
|
71
|
+
exports.IRuleEvaluationResultsSchema = zod_1.z.object({
|
|
72
|
+
shareDataId: zod_1.z.string(),
|
|
73
|
+
rulesResults: zod_1.z.array(exports.IShareRulesEvaluationResultSchema),
|
|
74
|
+
isValidProposal: zod_1.z.boolean(),
|
|
75
|
+
});
|
|
76
|
+
//#endregion Rule Evaluation
|
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This contains the transactions for the SAFE Rules from the safe network functio s.
|
|
3
|
+
*/
|
|
4
|
+
import { IShareRuleSet, SAFETransactionActionType, SAFETransactionType } from '@degenerate/generic';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
/**
|
|
7
|
+
* This contains the enums for the authorities objects in the zod format.
|
|
8
|
+
*/
|
|
9
|
+
export declare enum SAFERulesTransactionType {
|
|
10
|
+
RULESETS = "RULESETS"
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* This contains the schemas for the authorities objects in the zod format.
|
|
14
|
+
*/
|
|
15
|
+
export declare const SAFERulesTransactionTypeSchema: z.ZodEnum<[SAFERulesTransactionType]>;
|
|
16
|
+
/**
|
|
17
|
+
* This is the interface for the safe transaction rule set data.
|
|
18
|
+
*/
|
|
19
|
+
export interface ISAFETransactionRuleSetData {
|
|
20
|
+
rulesTransactionType: SAFERulesTransactionType;
|
|
21
|
+
ruleSet: IShareRuleSet;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* This is the schema for the safe transaction rule set data.
|
|
25
|
+
*/
|
|
26
|
+
export declare const ISAFETransactionRuleSetDataSchema: z.ZodObject<{
|
|
27
|
+
rulesTransactionType: z.ZodEnum<[SAFERulesTransactionType]>;
|
|
28
|
+
ruleSet: z.ZodObject<{
|
|
29
|
+
description: z.ZodOptional<z.ZodString>;
|
|
30
|
+
id: z.ZodString;
|
|
31
|
+
name: z.ZodString;
|
|
32
|
+
ruleGroups: z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">;
|
|
33
|
+
version: z.ZodNumber;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
version: number;
|
|
36
|
+
id: string;
|
|
37
|
+
name: string;
|
|
38
|
+
ruleGroups: any[];
|
|
39
|
+
description?: string | undefined;
|
|
40
|
+
}, {
|
|
41
|
+
version: number;
|
|
42
|
+
id: string;
|
|
43
|
+
name: string;
|
|
44
|
+
ruleGroups: any[];
|
|
45
|
+
description?: string | undefined;
|
|
46
|
+
}>;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
rulesTransactionType: SAFERulesTransactionType;
|
|
49
|
+
ruleSet: {
|
|
50
|
+
version: number;
|
|
51
|
+
id: string;
|
|
52
|
+
name: string;
|
|
53
|
+
ruleGroups: any[];
|
|
54
|
+
description?: string | undefined;
|
|
55
|
+
};
|
|
56
|
+
}, {
|
|
57
|
+
rulesTransactionType: SAFERulesTransactionType;
|
|
58
|
+
ruleSet: {
|
|
59
|
+
version: number;
|
|
60
|
+
id: string;
|
|
61
|
+
name: string;
|
|
62
|
+
ruleGroups: any[];
|
|
63
|
+
description?: string | undefined;
|
|
64
|
+
};
|
|
65
|
+
}>;
|
|
66
|
+
/**
|
|
67
|
+
* This is the schema for the add rule set transaction
|
|
68
|
+
*/
|
|
69
|
+
export declare const ISAFETransactionRuleSetAddSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
70
|
+
createdAt: z.ZodNumber;
|
|
71
|
+
authority: z.ZodString;
|
|
72
|
+
authoritySignature: z.ZodString;
|
|
73
|
+
transaction: z.ZodObject<{
|
|
74
|
+
type: z.ZodEnum<[SAFETransactionType.AUTHORITY, SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS, SAFETransactionType.RULES, SAFETransactionType.EVENTS, SAFETransactionType.ENDPOINTS]>;
|
|
75
|
+
action: z.ZodEnum<[SAFETransactionActionType.ADD, SAFETransactionActionType.REMOVE, SAFETransactionActionType.UPDATE]>;
|
|
76
|
+
}, "strip", z.ZodTypeAny, {
|
|
77
|
+
type: SAFETransactionType;
|
|
78
|
+
action: SAFETransactionActionType;
|
|
79
|
+
}, {
|
|
80
|
+
type: SAFETransactionType;
|
|
81
|
+
action: SAFETransactionActionType;
|
|
82
|
+
}>;
|
|
83
|
+
version: z.ZodNumber;
|
|
84
|
+
}, {
|
|
85
|
+
transaction: z.ZodObject<{
|
|
86
|
+
type: z.ZodLiteral<SAFETransactionType.RULES>;
|
|
87
|
+
action: z.ZodLiteral<SAFETransactionActionType.ADD>;
|
|
88
|
+
data: z.ZodObject<{
|
|
89
|
+
rulesTransactionType: z.ZodEnum<[SAFERulesTransactionType]>;
|
|
90
|
+
ruleSet: z.ZodObject<{
|
|
91
|
+
description: z.ZodOptional<z.ZodString>;
|
|
92
|
+
id: z.ZodString;
|
|
93
|
+
name: z.ZodString;
|
|
94
|
+
ruleGroups: z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">;
|
|
95
|
+
version: z.ZodNumber;
|
|
96
|
+
}, "strip", z.ZodTypeAny, {
|
|
97
|
+
version: number;
|
|
98
|
+
id: string;
|
|
99
|
+
name: string;
|
|
100
|
+
ruleGroups: any[];
|
|
101
|
+
description?: string | undefined;
|
|
102
|
+
}, {
|
|
103
|
+
version: number;
|
|
104
|
+
id: string;
|
|
105
|
+
name: string;
|
|
106
|
+
ruleGroups: any[];
|
|
107
|
+
description?: string | undefined;
|
|
108
|
+
}>;
|
|
109
|
+
}, "strip", z.ZodTypeAny, {
|
|
110
|
+
rulesTransactionType: SAFERulesTransactionType;
|
|
111
|
+
ruleSet: {
|
|
112
|
+
version: number;
|
|
113
|
+
id: string;
|
|
114
|
+
name: string;
|
|
115
|
+
ruleGroups: any[];
|
|
116
|
+
description?: string | undefined;
|
|
117
|
+
};
|
|
118
|
+
}, {
|
|
119
|
+
rulesTransactionType: SAFERulesTransactionType;
|
|
120
|
+
ruleSet: {
|
|
121
|
+
version: number;
|
|
122
|
+
id: string;
|
|
123
|
+
name: string;
|
|
124
|
+
ruleGroups: any[];
|
|
125
|
+
description?: string | undefined;
|
|
126
|
+
};
|
|
127
|
+
}>;
|
|
128
|
+
}, "strip", z.ZodTypeAny, {
|
|
129
|
+
type: SAFETransactionType.RULES;
|
|
130
|
+
action: SAFETransactionActionType.ADD;
|
|
131
|
+
data: {
|
|
132
|
+
rulesTransactionType: SAFERulesTransactionType;
|
|
133
|
+
ruleSet: {
|
|
134
|
+
version: number;
|
|
135
|
+
id: string;
|
|
136
|
+
name: string;
|
|
137
|
+
ruleGroups: any[];
|
|
138
|
+
description?: string | undefined;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
}, {
|
|
142
|
+
type: SAFETransactionType.RULES;
|
|
143
|
+
action: SAFETransactionActionType.ADD;
|
|
144
|
+
data: {
|
|
145
|
+
rulesTransactionType: SAFERulesTransactionType;
|
|
146
|
+
ruleSet: {
|
|
147
|
+
version: number;
|
|
148
|
+
id: string;
|
|
149
|
+
name: string;
|
|
150
|
+
ruleGroups: any[];
|
|
151
|
+
description?: string | undefined;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
}>;
|
|
155
|
+
}>, "strip", z.ZodTypeAny, {
|
|
156
|
+
transaction: {
|
|
157
|
+
type: SAFETransactionType.RULES;
|
|
158
|
+
action: SAFETransactionActionType.ADD;
|
|
159
|
+
data: {
|
|
160
|
+
rulesTransactionType: SAFERulesTransactionType;
|
|
161
|
+
ruleSet: {
|
|
162
|
+
version: number;
|
|
163
|
+
id: string;
|
|
164
|
+
name: string;
|
|
165
|
+
ruleGroups: any[];
|
|
166
|
+
description?: string | undefined;
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
createdAt: number;
|
|
171
|
+
authority: string;
|
|
172
|
+
authoritySignature: string;
|
|
173
|
+
version: number;
|
|
174
|
+
}, {
|
|
175
|
+
transaction: {
|
|
176
|
+
type: SAFETransactionType.RULES;
|
|
177
|
+
action: SAFETransactionActionType.ADD;
|
|
178
|
+
data: {
|
|
179
|
+
rulesTransactionType: SAFERulesTransactionType;
|
|
180
|
+
ruleSet: {
|
|
181
|
+
version: number;
|
|
182
|
+
id: string;
|
|
183
|
+
name: string;
|
|
184
|
+
ruleGroups: any[];
|
|
185
|
+
description?: string | undefined;
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
createdAt: number;
|
|
190
|
+
authority: string;
|
|
191
|
+
authoritySignature: string;
|
|
192
|
+
version: number;
|
|
193
|
+
}>;
|
|
194
|
+
/**
|
|
195
|
+
* This is the schema for the update rule set transaction
|
|
196
|
+
*/
|
|
197
|
+
export declare const ISAFETransactionRuleSetUpdateSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
198
|
+
createdAt: z.ZodNumber;
|
|
199
|
+
authority: z.ZodString;
|
|
200
|
+
authoritySignature: z.ZodString;
|
|
201
|
+
transaction: z.ZodObject<{
|
|
202
|
+
type: z.ZodEnum<[SAFETransactionType.AUTHORITY, SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS, SAFETransactionType.RULES, SAFETransactionType.EVENTS, SAFETransactionType.ENDPOINTS]>;
|
|
203
|
+
action: z.ZodEnum<[SAFETransactionActionType.ADD, SAFETransactionActionType.REMOVE, SAFETransactionActionType.UPDATE]>;
|
|
204
|
+
}, "strip", z.ZodTypeAny, {
|
|
205
|
+
type: SAFETransactionType;
|
|
206
|
+
action: SAFETransactionActionType;
|
|
207
|
+
}, {
|
|
208
|
+
type: SAFETransactionType;
|
|
209
|
+
action: SAFETransactionActionType;
|
|
210
|
+
}>;
|
|
211
|
+
version: z.ZodNumber;
|
|
212
|
+
}, {
|
|
213
|
+
transaction: z.ZodObject<{
|
|
214
|
+
type: z.ZodLiteral<SAFETransactionType.RULES>;
|
|
215
|
+
action: z.ZodLiteral<SAFETransactionActionType.UPDATE>;
|
|
216
|
+
data: z.ZodObject<{
|
|
217
|
+
rulesTransactionType: z.ZodEnum<[SAFERulesTransactionType]>;
|
|
218
|
+
ruleSet: z.ZodObject<{
|
|
219
|
+
description: z.ZodOptional<z.ZodString>;
|
|
220
|
+
id: z.ZodString;
|
|
221
|
+
name: z.ZodString;
|
|
222
|
+
ruleGroups: z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">;
|
|
223
|
+
version: z.ZodNumber;
|
|
224
|
+
}, "strip", z.ZodTypeAny, {
|
|
225
|
+
version: number;
|
|
226
|
+
id: string;
|
|
227
|
+
name: string;
|
|
228
|
+
ruleGroups: any[];
|
|
229
|
+
description?: string | undefined;
|
|
230
|
+
}, {
|
|
231
|
+
version: number;
|
|
232
|
+
id: string;
|
|
233
|
+
name: string;
|
|
234
|
+
ruleGroups: any[];
|
|
235
|
+
description?: string | undefined;
|
|
236
|
+
}>;
|
|
237
|
+
}, "strip", z.ZodTypeAny, {
|
|
238
|
+
rulesTransactionType: SAFERulesTransactionType;
|
|
239
|
+
ruleSet: {
|
|
240
|
+
version: number;
|
|
241
|
+
id: string;
|
|
242
|
+
name: string;
|
|
243
|
+
ruleGroups: any[];
|
|
244
|
+
description?: string | undefined;
|
|
245
|
+
};
|
|
246
|
+
}, {
|
|
247
|
+
rulesTransactionType: SAFERulesTransactionType;
|
|
248
|
+
ruleSet: {
|
|
249
|
+
version: number;
|
|
250
|
+
id: string;
|
|
251
|
+
name: string;
|
|
252
|
+
ruleGroups: any[];
|
|
253
|
+
description?: string | undefined;
|
|
254
|
+
};
|
|
255
|
+
}>;
|
|
256
|
+
}, "strip", z.ZodTypeAny, {
|
|
257
|
+
type: SAFETransactionType.RULES;
|
|
258
|
+
action: SAFETransactionActionType.UPDATE;
|
|
259
|
+
data: {
|
|
260
|
+
rulesTransactionType: SAFERulesTransactionType;
|
|
261
|
+
ruleSet: {
|
|
262
|
+
version: number;
|
|
263
|
+
id: string;
|
|
264
|
+
name: string;
|
|
265
|
+
ruleGroups: any[];
|
|
266
|
+
description?: string | undefined;
|
|
267
|
+
};
|
|
268
|
+
};
|
|
269
|
+
}, {
|
|
270
|
+
type: SAFETransactionType.RULES;
|
|
271
|
+
action: SAFETransactionActionType.UPDATE;
|
|
272
|
+
data: {
|
|
273
|
+
rulesTransactionType: SAFERulesTransactionType;
|
|
274
|
+
ruleSet: {
|
|
275
|
+
version: number;
|
|
276
|
+
id: string;
|
|
277
|
+
name: string;
|
|
278
|
+
ruleGroups: any[];
|
|
279
|
+
description?: string | undefined;
|
|
280
|
+
};
|
|
281
|
+
};
|
|
282
|
+
}>;
|
|
283
|
+
}>, "strip", z.ZodTypeAny, {
|
|
284
|
+
transaction: {
|
|
285
|
+
type: SAFETransactionType.RULES;
|
|
286
|
+
action: SAFETransactionActionType.UPDATE;
|
|
287
|
+
data: {
|
|
288
|
+
rulesTransactionType: SAFERulesTransactionType;
|
|
289
|
+
ruleSet: {
|
|
290
|
+
version: number;
|
|
291
|
+
id: string;
|
|
292
|
+
name: string;
|
|
293
|
+
ruleGroups: any[];
|
|
294
|
+
description?: string | undefined;
|
|
295
|
+
};
|
|
296
|
+
};
|
|
297
|
+
};
|
|
298
|
+
createdAt: number;
|
|
299
|
+
authority: string;
|
|
300
|
+
authoritySignature: string;
|
|
301
|
+
version: number;
|
|
302
|
+
}, {
|
|
303
|
+
transaction: {
|
|
304
|
+
type: SAFETransactionType.RULES;
|
|
305
|
+
action: SAFETransactionActionType.UPDATE;
|
|
306
|
+
data: {
|
|
307
|
+
rulesTransactionType: SAFERulesTransactionType;
|
|
308
|
+
ruleSet: {
|
|
309
|
+
version: number;
|
|
310
|
+
id: string;
|
|
311
|
+
name: string;
|
|
312
|
+
ruleGroups: any[];
|
|
313
|
+
description?: string | undefined;
|
|
314
|
+
};
|
|
315
|
+
};
|
|
316
|
+
};
|
|
317
|
+
createdAt: number;
|
|
318
|
+
authority: string;
|
|
319
|
+
authoritySignature: string;
|
|
320
|
+
version: number;
|
|
321
|
+
}>;
|
|
322
|
+
/**
|
|
323
|
+
* This is the schema for the remove rule set transaction
|
|
324
|
+
*/
|
|
325
|
+
export declare const ISAFETransactionRuleSetRemoveSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
326
|
+
createdAt: z.ZodNumber;
|
|
327
|
+
authority: z.ZodString;
|
|
328
|
+
authoritySignature: z.ZodString;
|
|
329
|
+
transaction: z.ZodObject<{
|
|
330
|
+
type: z.ZodEnum<[SAFETransactionType.AUTHORITY, SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS, SAFETransactionType.RULES, SAFETransactionType.EVENTS, SAFETransactionType.ENDPOINTS]>;
|
|
331
|
+
action: z.ZodEnum<[SAFETransactionActionType.ADD, SAFETransactionActionType.REMOVE, SAFETransactionActionType.UPDATE]>;
|
|
332
|
+
}, "strip", z.ZodTypeAny, {
|
|
333
|
+
type: SAFETransactionType;
|
|
334
|
+
action: SAFETransactionActionType;
|
|
335
|
+
}, {
|
|
336
|
+
type: SAFETransactionType;
|
|
337
|
+
action: SAFETransactionActionType;
|
|
338
|
+
}>;
|
|
339
|
+
version: z.ZodNumber;
|
|
340
|
+
}, {
|
|
341
|
+
transaction: z.ZodObject<{
|
|
342
|
+
type: z.ZodLiteral<SAFETransactionType.RULES>;
|
|
343
|
+
action: z.ZodLiteral<SAFETransactionActionType.REMOVE>;
|
|
344
|
+
data: z.ZodObject<{
|
|
345
|
+
rulesTransactionType: z.ZodEnum<[SAFERulesTransactionType]>;
|
|
346
|
+
ruleSet: z.ZodObject<{
|
|
347
|
+
description: z.ZodOptional<z.ZodString>;
|
|
348
|
+
id: z.ZodString;
|
|
349
|
+
name: z.ZodString;
|
|
350
|
+
ruleGroups: z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">;
|
|
351
|
+
version: z.ZodNumber;
|
|
352
|
+
}, "strip", z.ZodTypeAny, {
|
|
353
|
+
version: number;
|
|
354
|
+
id: string;
|
|
355
|
+
name: string;
|
|
356
|
+
ruleGroups: any[];
|
|
357
|
+
description?: string | undefined;
|
|
358
|
+
}, {
|
|
359
|
+
version: number;
|
|
360
|
+
id: string;
|
|
361
|
+
name: string;
|
|
362
|
+
ruleGroups: any[];
|
|
363
|
+
description?: string | undefined;
|
|
364
|
+
}>;
|
|
365
|
+
}, "strip", z.ZodTypeAny, {
|
|
366
|
+
rulesTransactionType: SAFERulesTransactionType;
|
|
367
|
+
ruleSet: {
|
|
368
|
+
version: number;
|
|
369
|
+
id: string;
|
|
370
|
+
name: string;
|
|
371
|
+
ruleGroups: any[];
|
|
372
|
+
description?: string | undefined;
|
|
373
|
+
};
|
|
374
|
+
}, {
|
|
375
|
+
rulesTransactionType: SAFERulesTransactionType;
|
|
376
|
+
ruleSet: {
|
|
377
|
+
version: number;
|
|
378
|
+
id: string;
|
|
379
|
+
name: string;
|
|
380
|
+
ruleGroups: any[];
|
|
381
|
+
description?: string | undefined;
|
|
382
|
+
};
|
|
383
|
+
}>;
|
|
384
|
+
}, "strip", z.ZodTypeAny, {
|
|
385
|
+
type: SAFETransactionType.RULES;
|
|
386
|
+
action: SAFETransactionActionType.REMOVE;
|
|
387
|
+
data: {
|
|
388
|
+
rulesTransactionType: SAFERulesTransactionType;
|
|
389
|
+
ruleSet: {
|
|
390
|
+
version: number;
|
|
391
|
+
id: string;
|
|
392
|
+
name: string;
|
|
393
|
+
ruleGroups: any[];
|
|
394
|
+
description?: string | undefined;
|
|
395
|
+
};
|
|
396
|
+
};
|
|
397
|
+
}, {
|
|
398
|
+
type: SAFETransactionType.RULES;
|
|
399
|
+
action: SAFETransactionActionType.REMOVE;
|
|
400
|
+
data: {
|
|
401
|
+
rulesTransactionType: SAFERulesTransactionType;
|
|
402
|
+
ruleSet: {
|
|
403
|
+
version: number;
|
|
404
|
+
id: string;
|
|
405
|
+
name: string;
|
|
406
|
+
ruleGroups: any[];
|
|
407
|
+
description?: string | undefined;
|
|
408
|
+
};
|
|
409
|
+
};
|
|
410
|
+
}>;
|
|
411
|
+
}>, "strip", z.ZodTypeAny, {
|
|
412
|
+
transaction: {
|
|
413
|
+
type: SAFETransactionType.RULES;
|
|
414
|
+
action: SAFETransactionActionType.REMOVE;
|
|
415
|
+
data: {
|
|
416
|
+
rulesTransactionType: SAFERulesTransactionType;
|
|
417
|
+
ruleSet: {
|
|
418
|
+
version: number;
|
|
419
|
+
id: string;
|
|
420
|
+
name: string;
|
|
421
|
+
ruleGroups: any[];
|
|
422
|
+
description?: string | undefined;
|
|
423
|
+
};
|
|
424
|
+
};
|
|
425
|
+
};
|
|
426
|
+
createdAt: number;
|
|
427
|
+
authority: string;
|
|
428
|
+
authoritySignature: string;
|
|
429
|
+
version: number;
|
|
430
|
+
}, {
|
|
431
|
+
transaction: {
|
|
432
|
+
type: SAFETransactionType.RULES;
|
|
433
|
+
action: SAFETransactionActionType.REMOVE;
|
|
434
|
+
data: {
|
|
435
|
+
rulesTransactionType: SAFERulesTransactionType;
|
|
436
|
+
ruleSet: {
|
|
437
|
+
version: number;
|
|
438
|
+
id: string;
|
|
439
|
+
name: string;
|
|
440
|
+
ruleGroups: any[];
|
|
441
|
+
description?: string | undefined;
|
|
442
|
+
};
|
|
443
|
+
};
|
|
444
|
+
};
|
|
445
|
+
createdAt: number;
|
|
446
|
+
authority: string;
|
|
447
|
+
authoritySignature: string;
|
|
448
|
+
version: number;
|
|
449
|
+
}>;
|
|
450
|
+
//# sourceMappingURL=rules-transactions.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules-transactions.schema.d.ts","sourceRoot":"","sources":["../../src/schema/rules-transactions.schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAEpG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB;;GAEG;AACH,oBAAY,wBAAwB;IAChC,QAAQ,aAAa;CACxB;AAED;;GAEG;AACH,eAAO,MAAM,8BAA8B,uCAEzC,CAAC;AAMH;;GAEG;AACH,MAAM,WAAW,2BAA2B;IACxC,oBAAoB,EAAE,wBAAwB,CAAC;IAC/C,OAAO,EAAE,aAAa,CAAC;CAC1B;AAED;;GAEG;AACH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG5C,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM3C,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM9C,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM9C,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This contains the transactions for the SAFE Rules from the safe network functio s.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ISAFETransactionRuleSetRemoveSchema = exports.ISAFETransactionRuleSetUpdateSchema = exports.ISAFETransactionRuleSetAddSchema = exports.ISAFETransactionRuleSetDataSchema = exports.SAFERulesTransactionTypeSchema = exports.SAFERulesTransactionType = void 0;
|
|
7
|
+
const generic_1 = require("@degenerate/generic");
|
|
8
|
+
const transactions_schema_1 = require("./transactions.schema");
|
|
9
|
+
const zod_1 = require("zod");
|
|
10
|
+
const rules_schema_1 = require("./rules/rules.schema");
|
|
11
|
+
//#region Enums
|
|
12
|
+
/**
|
|
13
|
+
* This contains the enums for the authorities objects in the zod format.
|
|
14
|
+
*/
|
|
15
|
+
var SAFERulesTransactionType;
|
|
16
|
+
(function (SAFERulesTransactionType) {
|
|
17
|
+
SAFERulesTransactionType["RULESETS"] = "RULESETS";
|
|
18
|
+
})(SAFERulesTransactionType || (exports.SAFERulesTransactionType = SAFERulesTransactionType = {}));
|
|
19
|
+
;
|
|
20
|
+
/**
|
|
21
|
+
* This contains the schemas for the authorities objects in the zod format.
|
|
22
|
+
*/
|
|
23
|
+
exports.SAFERulesTransactionTypeSchema = zod_1.z.enum([
|
|
24
|
+
SAFERulesTransactionType.RULESETS,
|
|
25
|
+
]);
|
|
26
|
+
/**
|
|
27
|
+
* This is the schema for the safe transaction rule set data.
|
|
28
|
+
*/
|
|
29
|
+
exports.ISAFETransactionRuleSetDataSchema = zod_1.z.object({
|
|
30
|
+
rulesTransactionType: exports.SAFERulesTransactionTypeSchema,
|
|
31
|
+
ruleSet: rules_schema_1.IShareRuleSetSchema,
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* This is the schema for the add rule set transaction
|
|
35
|
+
*/
|
|
36
|
+
exports.ISAFETransactionRuleSetAddSchema = transactions_schema_1.ISAFETransactionBaseSchema.extend({
|
|
37
|
+
transaction: zod_1.z.object({
|
|
38
|
+
type: zod_1.z.literal(generic_1.SAFETransactionType.RULES),
|
|
39
|
+
action: zod_1.z.literal(generic_1.SAFETransactionActionType.ADD),
|
|
40
|
+
data: exports.ISAFETransactionRuleSetDataSchema,
|
|
41
|
+
}),
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* This is the schema for the update rule set transaction
|
|
45
|
+
*/
|
|
46
|
+
exports.ISAFETransactionRuleSetUpdateSchema = transactions_schema_1.ISAFETransactionBaseSchema.extend({
|
|
47
|
+
transaction: zod_1.z.object({
|
|
48
|
+
type: zod_1.z.literal(generic_1.SAFETransactionType.RULES),
|
|
49
|
+
action: zod_1.z.literal(generic_1.SAFETransactionActionType.UPDATE),
|
|
50
|
+
data: exports.ISAFETransactionRuleSetDataSchema,
|
|
51
|
+
}),
|
|
52
|
+
});
|
|
53
|
+
/**
|
|
54
|
+
* This is the schema for the remove rule set transaction
|
|
55
|
+
*/
|
|
56
|
+
exports.ISAFETransactionRuleSetRemoveSchema = transactions_schema_1.ISAFETransactionBaseSchema.extend({
|
|
57
|
+
transaction: zod_1.z.object({
|
|
58
|
+
type: zod_1.z.literal(generic_1.SAFETransactionType.RULES),
|
|
59
|
+
action: zod_1.z.literal(generic_1.SAFETransactionActionType.REMOVE),
|
|
60
|
+
data: exports.ISAFETransactionRuleSetDataSchema,
|
|
61
|
+
}),
|
|
62
|
+
});
|
|
63
|
+
//#endregion RuleSet
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
/**
|
|
9
|
+
* This is the schema for the SAFE transaction base.
|
|
10
|
+
*/
|
|
11
|
+
export declare const ISAFETransactionBaseSchema: z.ZodObject<{
|
|
12
|
+
createdAt: z.ZodNumber;
|
|
13
|
+
authority: z.ZodString;
|
|
14
|
+
authoritySignature: z.ZodString;
|
|
15
|
+
transaction: z.ZodObject<{
|
|
16
|
+
type: z.ZodEnum<[SAFETransactionType.AUTHORITY, SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS, SAFETransactionType.RULES, SAFETransactionType.EVENTS, SAFETransactionType.ENDPOINTS]>;
|
|
17
|
+
action: z.ZodEnum<[SAFETransactionActionType.ADD, SAFETransactionActionType.REMOVE, SAFETransactionActionType.UPDATE]>;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
type: SAFETransactionType;
|
|
20
|
+
action: SAFETransactionActionType;
|
|
21
|
+
}, {
|
|
22
|
+
type: SAFETransactionType;
|
|
23
|
+
action: SAFETransactionActionType;
|
|
24
|
+
}>;
|
|
25
|
+
version: z.ZodNumber;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
transaction: {
|
|
28
|
+
type: SAFETransactionType;
|
|
29
|
+
action: SAFETransactionActionType;
|
|
30
|
+
};
|
|
31
|
+
createdAt: number;
|
|
32
|
+
authority: string;
|
|
33
|
+
authoritySignature: string;
|
|
34
|
+
version: number;
|
|
35
|
+
}, {
|
|
36
|
+
transaction: {
|
|
37
|
+
type: SAFETransactionType;
|
|
38
|
+
action: SAFETransactionActionType;
|
|
39
|
+
};
|
|
40
|
+
createdAt: number;
|
|
41
|
+
authority: string;
|
|
42
|
+
authoritySignature: string;
|
|
43
|
+
version: number;
|
|
44
|
+
}>;
|
|
45
|
+
//# sourceMappingURL=transactions.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactions.schema.d.ts","sourceRoot":"","sources":["../../src/schema/transactions.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;AAMH;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASrC,CAAC"}
|
|
@@ -3,7 +3,7 @@ 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.SAFETransactionActionTypeSchema = exports.SAFETransactionTypeSchema = void 0;
|
|
6
|
+
exports.ISAFETransactionBaseSchema = exports.SAFETransactionActionTypeSchema = exports.SAFETransactionTypeSchema = void 0;
|
|
7
7
|
//This file contains the schema for the transaction data in the SAFE Ecosystem in zod format.
|
|
8
8
|
const zod_1 = __importDefault(require("zod"));
|
|
9
9
|
const generic_1 = require("@degenerate/generic");
|
|
@@ -26,3 +26,18 @@ exports.SAFETransactionActionTypeSchema = zod_1.default.enum([
|
|
|
26
26
|
generic_1.SAFETransactionActionType.UPDATE,
|
|
27
27
|
]);
|
|
28
28
|
//#endregion Enums
|
|
29
|
+
//#region Transaction
|
|
30
|
+
/**
|
|
31
|
+
* This is the schema for the SAFE transaction base.
|
|
32
|
+
*/
|
|
33
|
+
exports.ISAFETransactionBaseSchema = zod_1.default.object({
|
|
34
|
+
createdAt: zod_1.default.number(), // the javascript timestamp of when the transaction was created
|
|
35
|
+
authority: zod_1.default.string(), // the public key of the authority that created the transaction
|
|
36
|
+
authoritySignature: zod_1.default.string(), // the signature of the authority that created the transaction
|
|
37
|
+
transaction: zod_1.default.object({
|
|
38
|
+
type: exports.SAFETransactionTypeSchema, // the type of transaction
|
|
39
|
+
action: exports.SAFETransactionActionTypeSchema, // the action to perform on the transaction
|
|
40
|
+
}),
|
|
41
|
+
version: zod_1.default.number(), // the version of the transaction
|
|
42
|
+
});
|
|
43
|
+
//#endregion Transaction
|