@degenerate/endpoints 0.0.11 → 0.0.12

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 (25) hide show
  1. package/dist/cors/endpoints/helpers/validate-incoming-request-data.d.ts.map +1 -1
  2. package/dist/cors/endpoints/helpers/validate-incoming-request-data.js +1 -0
  3. package/dist/cors/routes/authorities/v1.routes.d.ts.map +1 -1
  4. package/dist/cors/routes/authorities/v1.routes.js +4 -3
  5. package/dist/schema/rules-transactions.schema.d.ts +109 -281
  6. package/dist/schema/rules-transactions.schema.d.ts.map +1 -1
  7. package/dist/schema/transactions.schema.d.ts +16 -17
  8. package/dist/schema/transactions.schema.d.ts.map +1 -1
  9. package/dist/schema/transactions.schema.js +9 -11
  10. package/package.json +3 -3
  11. package/dist/cors/endpoints/authorities/validate-authorities-transaction.d.ts +0 -30
  12. package/dist/cors/endpoints/authorities/validate-authorities-transaction.d.ts.map +0 -1
  13. package/dist/cors/endpoints/authorities/validate-authorities-transaction.js +0 -155
  14. package/dist/schema/authorities-transactions.schema.d.ts +0 -306
  15. package/dist/schema/authorities-transactions.schema.d.ts.map +0 -1
  16. package/dist/schema/authorities-transactions.schema.js +0 -71
  17. package/dist/schema/rules/rules-conditions.schema.d.ts +0 -402
  18. package/dist/schema/rules/rules-conditions.schema.d.ts.map +0 -1
  19. package/dist/schema/rules/rules-conditions.schema.js +0 -99
  20. package/dist/schema/rules/rules-enums.schema.d.ts +0 -39
  21. package/dist/schema/rules/rules-enums.schema.d.ts.map +0 -1
  22. package/dist/schema/rules/rules-enums.schema.js +0 -90
  23. package/dist/schema/rules/rules.schema.d.ts +0 -2839
  24. package/dist/schema/rules/rules.schema.d.ts.map +0 -1
  25. package/dist/schema/rules/rules.schema.js +0 -76
@@ -4,26 +4,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ISAFETransactionBaseSchema = exports.SAFETransactionActionTypeSchema = exports.SAFETransactionTypeSchema = void 0;
7
- //This file contains the schema for the transaction data in the SAFE Ecosystem in zod format.
8
7
  const zod_1 = __importDefault(require("zod"));
9
- const generic_1 = require("@degenerate/generic");
10
8
  //#region Enums
11
9
  // This is the schema for the authority data.
12
10
  exports.SAFETransactionTypeSchema = zod_1.default.enum([
13
- generic_1.SAFETransactionType.AUTHORITY,
14
- generic_1.SAFETransactionType.SHAREDATA,
15
- generic_1.SAFETransactionType.FUNCTIONS,
16
- generic_1.SAFETransactionType.RULES,
17
- generic_1.SAFETransactionType.EVENTS,
18
- generic_1.SAFETransactionType.ENDPOINTS,
11
+ 'AUTHORITY',
12
+ 'SHAREDATA',
13
+ 'FUNCTIONS',
14
+ 'RULES',
15
+ 'EVENTS',
16
+ 'ENDPOINTS',
19
17
  ]);
20
18
  /**
21
19
  * This is the type of function that is being targetted in the transaction.
22
20
  */
23
21
  exports.SAFETransactionActionTypeSchema = zod_1.default.enum([
24
- generic_1.SAFETransactionActionType.ADD,
25
- generic_1.SAFETransactionActionType.REMOVE,
26
- generic_1.SAFETransactionActionType.UPDATE,
22
+ 'ADD',
23
+ 'REMOVE',
24
+ 'UPDATE',
27
25
  ]);
28
26
  //#endregion Enums
29
27
  //#region Transaction
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@degenerate/endpoints",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "devDependencies": {
@@ -39,9 +39,9 @@
39
39
  "author": "Degenerate Inc.",
40
40
  "license": "ISC",
41
41
  "dependencies": {
42
- "@degenerate/generic": "^0.1.10",
42
+ "@degenerate/generic": "^0.1.11",
43
43
  "express": "^4.21.1",
44
44
  "zod": "^3.23.8"
45
45
  },
46
- "gitHead": "2c7096896ce9690807a9b492c6fbd20dbed47b0b"
46
+ "gitHead": "737d8d07f08124b2f4c05bd9e4a41c96bd571791"
47
47
  }
@@ -1,30 +0,0 @@
1
- import { Request, Response, NextFunction } from 'express';
2
- /**
3
- * This takes the incoming object and validates that it is the correct shape
4
- * @param req
5
- * @param res
6
- * @param next
7
- * @returns
8
- */
9
- export declare function validateAuthoritiesTransaction(req: Request, res: Response, next: NextFunction): Response<any, Record<string, any>> | undefined;
10
- /**
11
- * This is the transaction targetting an authority in the SAFE Ecosystem.
12
- *
13
- const sampleTransactionAuthority: ISAFETransactionAuthority = {
14
- createdAt: Date.now(),
15
- authority: '0xAuthorityPublicKey',
16
- authoritySignature: '0xAuthoritySignature',
17
- transaction: {
18
- type: SAFETransactionType.AUTHORITY,
19
- action: SAFETransactionActionType.CREATE,
20
- data: {
21
- authorizationIssuer: 'exampleIssuer-12345678' as IAuthorizationIssuer,
22
- authorizationPublicKey: '0xAuthorizationPublicKey',
23
- authorityValidationType: AuthorityValidationType.JWT,
24
- authorityOver: [SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS],
25
- },
26
- },
27
- version: 1,
28
- };
29
- */
30
- //# sourceMappingURL=validate-authorities-transaction.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate-authorities-transaction.d.ts","sourceRoot":"","sources":["../../../../src/cors/endpoints/authorities/validate-authorities-transaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE1D;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,kDAY7F;AAED;;;;;;;;;;;;;;;;;;;GAmBG"}
@@ -1,155 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateAuthoritiesTransaction = validateAuthoritiesTransaction;
4
- /**
5
- * This takes the incoming object and validates that it is the correct shape
6
- * @param req
7
- * @param res
8
- * @param next
9
- * @returns
10
- */
11
- function validateAuthoritiesTransaction(req, res, next) {
12
- const { transaction } = req.body;
13
- if (!transaction) {
14
- return res.status(400).send({ error: 'No transaction provided' });
15
- }
16
- if (!transaction.authorities) {
17
- return res.status(400).send({ error: 'No authorities provided' });
18
- }
19
- if (!transaction.authorities.length) {
20
- return res.status(400).send({ error: 'No authorities provided' });
21
- }
22
- next();
23
- }
24
- /**
25
- * This is the transaction targetting an authority in the SAFE Ecosystem.
26
- *
27
- const sampleTransactionAuthority: ISAFETransactionAuthority = {
28
- createdAt: Date.now(),
29
- authority: '0xAuthorityPublicKey',
30
- authoritySignature: '0xAuthoritySignature',
31
- transaction: {
32
- type: SAFETransactionType.AUTHORITY,
33
- action: SAFETransactionActionType.CREATE,
34
- data: {
35
- authorizationIssuer: 'exampleIssuer-12345678' as IAuthorizationIssuer,
36
- authorizationPublicKey: '0xAuthorizationPublicKey',
37
- authorityValidationType: AuthorityValidationType.JWT,
38
- authorityOver: [SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS],
39
- },
40
- },
41
- version: 1,
42
- };
43
- */
44
- /* eslint-disable @typescript-eslint/no-explicit-any */
45
- // /**
46
- // * This validates the incoming request for the shape of the add account holder record to a user
47
- // *
48
- // * @param req the incoming request
49
- // * @param res the response
50
- // * @param next the next function
51
- // * @returns
52
- // */
53
- // export function validateAddAccountHolderRecord(req: Request, res: Response, next: NextFunction): void | Response<any> {
54
- // let parsedBody;
55
- // if (typeof req.body === 'object') {
56
- // parsedBody = req.body;
57
- // } else {
58
- // parsedBody = JSON.parse(req.body);
59
- // }
60
- // // if we can't parse the body then it's not a valid object
61
- // if (!parsedBody) throw new RequestObjectValidationFailedError(req.body, 'req.body', 'object');
62
- // const bodyKeys = Object.keys(parsedBody);
63
- // if (bodyKeys.length !== 2) {
64
- // throw new RequestObjectShouldOnlyHaveXPropertiesError(parsedBody, 'req.body', bodyKeys.length, 2);
65
- // }
66
- // if (!validateString(parsedBody.userId, true, false, false)) {
67
- // throw new RequestObjectValidationFailedError(parsedBody.userId, 'userId', 'string');
68
- // }
69
- // if (!validateArray(parsedBody.accountHolderRecords)) {
70
- // throw new RequestObjectValidationFailedError(parsedBody.accountHolderRecords, 'accountHolderRecords', 'array');
71
- // }
72
- // for (const accountHolderRecord of parsedBody.accountHolderRecords) {
73
- // validateAccountHolderRecord(accountHolderRecord);
74
- // }
75
- // req.body = parsedBody as IAccountHolderRecordDoc;
76
- // next();
77
- // return;
78
- // }
79
- // /**
80
- // * Make sure the account holder record is valid
81
- // *
82
- // * @param accountHolderRecord the account holder record
83
- // */
84
- // function validateAccountHolderRecord(accountHolderRecord: any): void {
85
- // if (!accountHolderRecord) throw new RequestObjectValidationFailedError(accountHolderRecord, 'accountHolderRecord', 'object');
86
- // const bodyKeys = Object.keys(accountHolderRecord);
87
- // if (bodyKeys.length !== 3) {
88
- // throw new RequestObjectShouldOnlyHaveXPropertiesError(accountHolderRecord, 'accountHolderRecord', bodyKeys.length, 3);
89
- // }
90
- // if (!validateString(accountHolderRecord.financialEndpointProviderId, false, true, true)) {
91
- // throw new RequestObjectValidationFailedError(accountHolderRecord.financialEndpointProviderId,
92
- // 'financialEndpointProviderId', 'string');
93
- // }
94
- // if (!validateString(accountHolderRecord.institutionId, false, true, true)) {
95
- // throw new RequestObjectValidationFailedError(accountHolderRecord.institutionId, 'institutionId', 'string');
96
- // }
97
- // if (!accountHolderRecord.accountHolder) throw new RequestObjectValidationFailedError(accountHolderRecord, 'accountHolder', 'object');
98
- // validateAccountHolder(accountHolderRecord.accountHolder);
99
- // return;
100
- // }
101
- // /**
102
- // * This validates the account holder object
103
- // *
104
- // * @param accountHolder
105
- // * @returns
106
- // */
107
- // function validateAccountHolder(accountHolder: any): void {
108
- // if (!accountHolder) throw new RequestObjectValidationFailedError(accountHolder, 'accountHolder', 'object');
109
- // const bodyKeys = Object.keys(accountHolder);
110
- // if (bodyKeys.length !== 5) {
111
- // throw new RequestObjectShouldOnlyHaveXPropertiesError(accountHolder, 'accountHolder', bodyKeys.length, 5);
112
- // }
113
- // if (!validateString(accountHolder.accountId, false, true, true)) {
114
- // throw new RequestObjectValidationFailedError(accountHolder.accountId, 'accountId', 'string');
115
- // }
116
- // if (!accountHolder.address) throw new RequestObjectValidationFailedError(accountHolder, 'address', 'object');
117
- // validateAccountHolderAddress(accountHolder.address);
118
- // if (!validateString(accountHolder.name, false, true, true)) {
119
- // throw new RequestObjectValidationFailedError(accountHolder.name, 'name', 'string');
120
- // }
121
- // if (!validateString(accountHolder.email, false, true, true)) {
122
- // throw new RequestObjectValidationFailedError(accountHolder.email, 'email', 'string');
123
- // }
124
- // if (!validateString(accountHolder.phoneNumber, false, true, true)) {
125
- // throw new RequestObjectValidationFailedError(accountHolder.phoneNumber, 'phoneNumber', 'string');
126
- // }
127
- // return;
128
- // }
129
- // /**
130
- // * This validates the account holder address record
131
- // *
132
- // * @param address
133
- // */
134
- // function validateAccountHolderAddress(address: any): void {
135
- // if (!address) throw new RequestObjectValidationFailedError(address, 'address', 'object');
136
- // if (!validateString(address.civicAddress, false, true, true)) {
137
- // throw new RequestObjectValidationFailedError(address.civicAddress, 'civicAddress', 'string');
138
- // }
139
- // if (!validateString(address.city, false, true, true)) {
140
- // throw new RequestObjectValidationFailedError(address.city, 'city', 'string');
141
- // }
142
- // if (!validateString(address.province, false, true, true)) {
143
- // throw new RequestObjectValidationFailedError(address.province, 'province', 'string');
144
- // }
145
- // if (!validateString(address.postalCode, false, true, true)) {
146
- // throw new RequestObjectValidationFailedError(address.postalCode, 'postalCode', 'string');
147
- // }
148
- // if (!validateString(address.poBox, false, true, true)) {
149
- // throw new RequestObjectValidationFailedError(address.poBox, 'poBox', 'string');
150
- // }
151
- // if (!validateString(address.country, false, true, true)) {
152
- // throw new RequestObjectValidationFailedError(address.country, 'country', 'string');
153
- // }
154
- // return;
155
- // }
@@ -1,306 +0,0 @@
1
- import z from 'zod';
2
- import { AuthorityValidationType, SAFETransactionActionType, SAFETransactionType } from '@degenerate/generic';
3
- /**
4
- * This is the data for the authority in the SAFE Ecosystem.
5
- */
6
- export declare const ISAFETransactionAuthorityDataSchema: z.ZodObject<{
7
- authorizationIssuer: z.ZodString;
8
- authorizationPublicKey: z.ZodString;
9
- authorityValidationType: z.ZodEnum<[AuthorityValidationType]>;
10
- authorityOver: z.ZodArray<z.ZodEnum<[SAFETransactionType.AUTHORITY, SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS, SAFETransactionType.RULES, SAFETransactionType.EVENTS, SAFETransactionType.ENDPOINTS]>, "many">;
11
- }, "strip", z.ZodTypeAny, {
12
- authorizationIssuer: string;
13
- authorizationPublicKey: string;
14
- authorityValidationType: AuthorityValidationType;
15
- authorityOver: SAFETransactionType[];
16
- }, {
17
- authorizationIssuer: string;
18
- authorizationPublicKey: string;
19
- authorityValidationType: AuthorityValidationType;
20
- authorityOver: SAFETransactionType[];
21
- }>;
22
- /**
23
- * This is the transaction targetting an authority in the SAFE Ecosystem.
24
- *
25
- const sampleTransactionAuthority: ISAFETransactionAuthority = {
26
- createdAt: Date.now(),
27
- authority: '0xAuthorityPublicKey',
28
- authoritySignature: '0xAuthoritySignature',
29
- transaction: {
30
- type: SAFETransactionType.AUTHORITY,
31
- action: SAFETransactionActionType.CREATE,
32
- data: {
33
- authorizationIssuer: 'exampleIssuer-12345678' as IAuthorizationIssuer,
34
- authorizationPublicKey: '0xAuthorizationPublicKey',
35
- authorityValidationType: AuthorityValidationType.JWT,
36
- authorityOver: [SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS],
37
- },
38
- },
39
- version: 1,
40
- };
41
- */
42
- /**
43
- * This is the schema for the authority transaction add.
44
- */
45
- export declare const ISAFETransactionAuthorityAddSchema: z.ZodObject<z.objectUtil.extendShape<{
46
- createdAt: z.ZodNumber;
47
- authority: z.ZodString;
48
- authoritySignature: z.ZodString;
49
- transaction: z.ZodObject<{
50
- type: z.ZodEnum<[SAFETransactionType.AUTHORITY, SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS, SAFETransactionType.RULES, SAFETransactionType.EVENTS, SAFETransactionType.ENDPOINTS]>;
51
- action: z.ZodEnum<[SAFETransactionActionType.ADD, SAFETransactionActionType.REMOVE, SAFETransactionActionType.UPDATE]>;
52
- }, "strip", z.ZodTypeAny, {
53
- type: SAFETransactionType;
54
- action: SAFETransactionActionType;
55
- }, {
56
- type: SAFETransactionType;
57
- action: SAFETransactionActionType;
58
- }>;
59
- version: z.ZodNumber;
60
- }, {
61
- transaction: z.ZodObject<{
62
- type: z.ZodLiteral<SAFETransactionType.AUTHORITY>;
63
- action: z.ZodLiteral<SAFETransactionActionType.ADD>;
64
- data: z.ZodObject<{
65
- authorizationIssuer: z.ZodString;
66
- authorizationPublicKey: z.ZodString;
67
- authorityValidationType: z.ZodEnum<[AuthorityValidationType]>;
68
- authorityOver: z.ZodArray<z.ZodEnum<[SAFETransactionType.AUTHORITY, SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS, SAFETransactionType.RULES, SAFETransactionType.EVENTS, SAFETransactionType.ENDPOINTS]>, "many">;
69
- }, "strip", z.ZodTypeAny, {
70
- authorizationIssuer: string;
71
- authorizationPublicKey: string;
72
- authorityValidationType: AuthorityValidationType;
73
- authorityOver: SAFETransactionType[];
74
- }, {
75
- authorizationIssuer: string;
76
- authorizationPublicKey: string;
77
- authorityValidationType: AuthorityValidationType;
78
- authorityOver: SAFETransactionType[];
79
- }>;
80
- }, "strip", z.ZodTypeAny, {
81
- type: SAFETransactionType.AUTHORITY;
82
- action: SAFETransactionActionType.ADD;
83
- data: {
84
- authorizationIssuer: string;
85
- authorizationPublicKey: string;
86
- authorityValidationType: AuthorityValidationType;
87
- authorityOver: SAFETransactionType[];
88
- };
89
- }, {
90
- type: SAFETransactionType.AUTHORITY;
91
- action: SAFETransactionActionType.ADD;
92
- data: {
93
- authorizationIssuer: string;
94
- authorizationPublicKey: string;
95
- authorityValidationType: AuthorityValidationType;
96
- authorityOver: SAFETransactionType[];
97
- };
98
- }>;
99
- }>, "strip", z.ZodTypeAny, {
100
- transaction: {
101
- type: SAFETransactionType.AUTHORITY;
102
- action: SAFETransactionActionType.ADD;
103
- data: {
104
- authorizationIssuer: string;
105
- authorizationPublicKey: string;
106
- authorityValidationType: AuthorityValidationType;
107
- authorityOver: SAFETransactionType[];
108
- };
109
- };
110
- createdAt: number;
111
- authority: string;
112
- authoritySignature: string;
113
- version: number;
114
- }, {
115
- transaction: {
116
- type: SAFETransactionType.AUTHORITY;
117
- action: SAFETransactionActionType.ADD;
118
- data: {
119
- authorizationIssuer: string;
120
- authorizationPublicKey: string;
121
- authorityValidationType: AuthorityValidationType;
122
- authorityOver: SAFETransactionType[];
123
- };
124
- };
125
- createdAt: number;
126
- authority: string;
127
- authoritySignature: string;
128
- version: number;
129
- }>;
130
- /**
131
- * This is the schema for the authority transaction update.
132
- */
133
- export declare const ISAFETransactionAuthorityUpdateSchema: z.ZodObject<z.objectUtil.extendShape<{
134
- createdAt: z.ZodNumber;
135
- authority: z.ZodString;
136
- authoritySignature: z.ZodString;
137
- transaction: z.ZodObject<{
138
- type: z.ZodEnum<[SAFETransactionType.AUTHORITY, SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS, SAFETransactionType.RULES, SAFETransactionType.EVENTS, SAFETransactionType.ENDPOINTS]>;
139
- action: z.ZodEnum<[SAFETransactionActionType.ADD, SAFETransactionActionType.REMOVE, SAFETransactionActionType.UPDATE]>;
140
- }, "strip", z.ZodTypeAny, {
141
- type: SAFETransactionType;
142
- action: SAFETransactionActionType;
143
- }, {
144
- type: SAFETransactionType;
145
- action: SAFETransactionActionType;
146
- }>;
147
- version: z.ZodNumber;
148
- }, {
149
- transaction: z.ZodObject<{
150
- type: z.ZodLiteral<SAFETransactionType.AUTHORITY>;
151
- action: z.ZodLiteral<SAFETransactionActionType.UPDATE>;
152
- data: z.ZodObject<{
153
- authorizationIssuer: z.ZodString;
154
- authorizationPublicKey: z.ZodString;
155
- authorityValidationType: z.ZodEnum<[AuthorityValidationType]>;
156
- authorityOver: z.ZodArray<z.ZodEnum<[SAFETransactionType.AUTHORITY, SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS, SAFETransactionType.RULES, SAFETransactionType.EVENTS, SAFETransactionType.ENDPOINTS]>, "many">;
157
- }, "strip", z.ZodTypeAny, {
158
- authorizationIssuer: string;
159
- authorizationPublicKey: string;
160
- authorityValidationType: AuthorityValidationType;
161
- authorityOver: SAFETransactionType[];
162
- }, {
163
- authorizationIssuer: string;
164
- authorizationPublicKey: string;
165
- authorityValidationType: AuthorityValidationType;
166
- authorityOver: SAFETransactionType[];
167
- }>;
168
- }, "strip", z.ZodTypeAny, {
169
- type: SAFETransactionType.AUTHORITY;
170
- action: SAFETransactionActionType.UPDATE;
171
- data: {
172
- authorizationIssuer: string;
173
- authorizationPublicKey: string;
174
- authorityValidationType: AuthorityValidationType;
175
- authorityOver: SAFETransactionType[];
176
- };
177
- }, {
178
- type: SAFETransactionType.AUTHORITY;
179
- action: SAFETransactionActionType.UPDATE;
180
- data: {
181
- authorizationIssuer: string;
182
- authorizationPublicKey: string;
183
- authorityValidationType: AuthorityValidationType;
184
- authorityOver: SAFETransactionType[];
185
- };
186
- }>;
187
- }>, "strip", z.ZodTypeAny, {
188
- transaction: {
189
- type: SAFETransactionType.AUTHORITY;
190
- action: SAFETransactionActionType.UPDATE;
191
- data: {
192
- authorizationIssuer: string;
193
- authorizationPublicKey: string;
194
- authorityValidationType: AuthorityValidationType;
195
- authorityOver: SAFETransactionType[];
196
- };
197
- };
198
- createdAt: number;
199
- authority: string;
200
- authoritySignature: string;
201
- version: number;
202
- }, {
203
- transaction: {
204
- type: SAFETransactionType.AUTHORITY;
205
- action: SAFETransactionActionType.UPDATE;
206
- data: {
207
- authorizationIssuer: string;
208
- authorizationPublicKey: string;
209
- authorityValidationType: AuthorityValidationType;
210
- authorityOver: SAFETransactionType[];
211
- };
212
- };
213
- createdAt: number;
214
- authority: string;
215
- authoritySignature: string;
216
- version: number;
217
- }>;
218
- /**
219
- * This is the schema for the authority transaction remove.
220
- */
221
- export declare const ISAFETransactionAuthorityRemoveSchema: z.ZodObject<z.objectUtil.extendShape<{
222
- createdAt: z.ZodNumber;
223
- authority: z.ZodString;
224
- authoritySignature: z.ZodString;
225
- transaction: z.ZodObject<{
226
- type: z.ZodEnum<[SAFETransactionType.AUTHORITY, SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS, SAFETransactionType.RULES, SAFETransactionType.EVENTS, SAFETransactionType.ENDPOINTS]>;
227
- action: z.ZodEnum<[SAFETransactionActionType.ADD, SAFETransactionActionType.REMOVE, SAFETransactionActionType.UPDATE]>;
228
- }, "strip", z.ZodTypeAny, {
229
- type: SAFETransactionType;
230
- action: SAFETransactionActionType;
231
- }, {
232
- type: SAFETransactionType;
233
- action: SAFETransactionActionType;
234
- }>;
235
- version: z.ZodNumber;
236
- }, {
237
- transaction: z.ZodObject<{
238
- type: z.ZodLiteral<SAFETransactionType.AUTHORITY>;
239
- action: z.ZodLiteral<SAFETransactionActionType.REMOVE>;
240
- data: z.ZodObject<{
241
- authorizationIssuer: z.ZodString;
242
- authorizationPublicKey: z.ZodString;
243
- authorityValidationType: z.ZodEnum<[AuthorityValidationType]>;
244
- authorityOver: z.ZodArray<z.ZodEnum<[SAFETransactionType.AUTHORITY, SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS, SAFETransactionType.RULES, SAFETransactionType.EVENTS, SAFETransactionType.ENDPOINTS]>, "many">;
245
- }, "strip", z.ZodTypeAny, {
246
- authorizationIssuer: string;
247
- authorizationPublicKey: string;
248
- authorityValidationType: AuthorityValidationType;
249
- authorityOver: SAFETransactionType[];
250
- }, {
251
- authorizationIssuer: string;
252
- authorizationPublicKey: string;
253
- authorityValidationType: AuthorityValidationType;
254
- authorityOver: SAFETransactionType[];
255
- }>;
256
- }, "strip", z.ZodTypeAny, {
257
- type: SAFETransactionType.AUTHORITY;
258
- action: SAFETransactionActionType.REMOVE;
259
- data: {
260
- authorizationIssuer: string;
261
- authorizationPublicKey: string;
262
- authorityValidationType: AuthorityValidationType;
263
- authorityOver: SAFETransactionType[];
264
- };
265
- }, {
266
- type: SAFETransactionType.AUTHORITY;
267
- action: SAFETransactionActionType.REMOVE;
268
- data: {
269
- authorizationIssuer: string;
270
- authorizationPublicKey: string;
271
- authorityValidationType: AuthorityValidationType;
272
- authorityOver: SAFETransactionType[];
273
- };
274
- }>;
275
- }>, "strip", z.ZodTypeAny, {
276
- transaction: {
277
- type: SAFETransactionType.AUTHORITY;
278
- action: SAFETransactionActionType.REMOVE;
279
- data: {
280
- authorizationIssuer: string;
281
- authorizationPublicKey: string;
282
- authorityValidationType: AuthorityValidationType;
283
- authorityOver: SAFETransactionType[];
284
- };
285
- };
286
- createdAt: number;
287
- authority: string;
288
- authoritySignature: string;
289
- version: number;
290
- }, {
291
- transaction: {
292
- type: SAFETransactionType.AUTHORITY;
293
- action: SAFETransactionActionType.REMOVE;
294
- data: {
295
- authorizationIssuer: string;
296
- authorizationPublicKey: string;
297
- authorityValidationType: AuthorityValidationType;
298
- authorityOver: SAFETransactionType[];
299
- };
300
- };
301
- createdAt: number;
302
- authority: string;
303
- authoritySignature: string;
304
- version: number;
305
- }>;
306
- //# sourceMappingURL=authorities-transactions.schema.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,71 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ISAFETransactionAuthorityRemoveSchema = exports.ISAFETransactionAuthorityUpdateSchema = exports.ISAFETransactionAuthorityAddSchema = exports.ISAFETransactionAuthorityDataSchema = void 0;
7
- // This contains the schemas for the authorities objects in the zod format..
8
- const zod_1 = __importDefault(require("zod"));
9
- const transactions_schema_1 = require("./transactions.schema");
10
- const generic_1 = require("@degenerate/generic");
11
- const IAuthorizationIssuerSchema = zod_1.default.string().regex(/^[a-zA-Z0-9]+-[a-zA-Z0-9]+$/);
12
- const AuthorityValidationTypeSchema = zod_1.default.enum([generic_1.AuthorityValidationType.JWT]);
13
- /**
14
- * This is the data for the authority in the SAFE Ecosystem.
15
- */
16
- exports.ISAFETransactionAuthorityDataSchema = zod_1.default.object({
17
- authorizationIssuer: IAuthorizationIssuerSchema,
18
- authorizationPublicKey: zod_1.default.string(),
19
- authorityValidationType: AuthorityValidationTypeSchema,
20
- authorityOver: zod_1.default.array(transactions_schema_1.SAFETransactionTypeSchema),
21
- });
22
- /**
23
- * This is the transaction targetting an authority in the SAFE Ecosystem.
24
- *
25
- const sampleTransactionAuthority: ISAFETransactionAuthority = {
26
- createdAt: Date.now(),
27
- authority: '0xAuthorityPublicKey',
28
- authoritySignature: '0xAuthoritySignature',
29
- transaction: {
30
- type: SAFETransactionType.AUTHORITY,
31
- action: SAFETransactionActionType.CREATE,
32
- data: {
33
- authorizationIssuer: 'exampleIssuer-12345678' as IAuthorizationIssuer,
34
- authorizationPublicKey: '0xAuthorizationPublicKey',
35
- authorityValidationType: AuthorityValidationType.JWT,
36
- authorityOver: [SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS],
37
- },
38
- },
39
- version: 1,
40
- };
41
- */
42
- /**
43
- * This is the schema for the authority transaction add.
44
- */
45
- exports.ISAFETransactionAuthorityAddSchema = transactions_schema_1.ISAFETransactionBaseSchema.extend({
46
- transaction: zod_1.default.object({
47
- type: zod_1.default.literal(generic_1.SAFETransactionType.AUTHORITY),
48
- action: zod_1.default.literal(generic_1.SAFETransactionActionType.ADD),
49
- data: exports.ISAFETransactionAuthorityDataSchema,
50
- }),
51
- });
52
- /**
53
- * This is the schema for the authority transaction update.
54
- */
55
- exports.ISAFETransactionAuthorityUpdateSchema = transactions_schema_1.ISAFETransactionBaseSchema.extend({
56
- transaction: zod_1.default.object({
57
- type: zod_1.default.literal(generic_1.SAFETransactionType.AUTHORITY),
58
- action: zod_1.default.literal(generic_1.SAFETransactionActionType.UPDATE),
59
- data: exports.ISAFETransactionAuthorityDataSchema,
60
- }),
61
- });
62
- /**
63
- * This is the schema for the authority transaction remove.
64
- */
65
- exports.ISAFETransactionAuthorityRemoveSchema = transactions_schema_1.ISAFETransactionBaseSchema.extend({
66
- transaction: zod_1.default.object({
67
- type: zod_1.default.literal(generic_1.SAFETransactionType.AUTHORITY),
68
- action: zod_1.default.literal(generic_1.SAFETransactionActionType.REMOVE),
69
- data: exports.ISAFETransactionAuthorityDataSchema,
70
- }),
71
- });