@degenerate/endpoints 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +27 -2
  2. package/dist/__tests__/jest.setup.d.ts +10 -0
  3. package/dist/__tests__/jest.setup.d.ts.map +1 -0
  4. package/dist/__tests__/jest.setup.js +2 -0
  5. package/dist/cors/authority/jwt/validate-jwt-authorities.d.ts +2 -2
  6. package/dist/cors/authority/jwt/validate-jwt-authorities.d.ts.map +1 -1
  7. package/dist/cors/authority/jwt/validate-jwt-endpoints.d.ts +16 -0
  8. package/dist/cors/authority/jwt/validate-jwt-endpoints.d.ts.map +1 -0
  9. package/dist/cors/authority/jwt/validate-jwt-endpoints.js +32 -0
  10. package/dist/cors/authority/jwt/validate-jwt-events.d.ts +16 -0
  11. package/dist/cors/authority/jwt/validate-jwt-events.d.ts.map +1 -0
  12. package/dist/cors/authority/jwt/validate-jwt-events.js +32 -0
  13. package/dist/cors/authority/jwt/validate-jwt-functions.d.ts +16 -0
  14. package/dist/cors/authority/jwt/validate-jwt-functions.d.ts.map +1 -0
  15. package/dist/cors/authority/jwt/validate-jwt-functions.js +32 -0
  16. package/dist/cors/authority/jwt/validate-jwt-rules.d.ts +16 -0
  17. package/dist/cors/authority/jwt/validate-jwt-rules.d.ts.map +1 -0
  18. package/dist/cors/authority/jwt/validate-jwt-rules.js +32 -0
  19. package/dist/cors/authority/jwt/validate-jwt-share-data.d.ts +16 -0
  20. package/dist/cors/authority/jwt/validate-jwt-share-data.d.ts.map +1 -0
  21. package/dist/cors/authority/jwt/validate-jwt-share-data.js +32 -0
  22. package/dist/cors/index.d.ts +12 -4
  23. package/dist/cors/index.d.ts.map +1 -1
  24. package/dist/cors/index.js +20 -6
  25. package/dist/cors/logging/add-unique-tracking.d.ts +11 -0
  26. package/dist/cors/logging/add-unique-tracking.d.ts.map +1 -0
  27. package/dist/cors/logging/add-unique-tracking.js +18 -0
  28. package/dist/cors/logging/request-logging.d.ts +11 -0
  29. package/dist/cors/logging/request-logging.d.ts.map +1 -0
  30. package/dist/cors/logging/request-logging.js +26 -0
  31. package/dist/cors/routes/authorities/v1.routes.d.ts +2 -0
  32. package/dist/cors/routes/authorities/v1.routes.d.ts.map +1 -0
  33. package/dist/cors/routes/authorities/v1.routes.js +87 -0
  34. package/dist/cors/routes/authorities.routes.d.ts.map +1 -1
  35. package/dist/cors/routes/authorities.routes.js +8 -61
  36. package/dist/cors/routes/rules/v1/rule-set.routes.d.ts +2 -0
  37. package/dist/cors/routes/rules/v1/rule-set.routes.d.ts.map +1 -0
  38. package/dist/cors/routes/rules/v1/rule-set.routes.js +104 -0
  39. package/dist/cors/routes/rules/v1.routes.d.ts +2 -0
  40. package/dist/cors/routes/rules/v1.routes.d.ts.map +1 -0
  41. package/dist/cors/routes/rules/v1.routes.js +44 -0
  42. package/dist/cors/routes/rules.routes.d.ts.map +1 -1
  43. package/dist/cors/routes/rules.routes.js +6 -24
  44. package/dist/schema/{authorities.schema.d.ts → authorities-transactions.schema.d.ts} +16 -53
  45. package/dist/schema/authorities-transactions.schema.d.ts.map +1 -0
  46. package/dist/schema/{authorities.schema.js → authorities-transactions.schema.js} +6 -19
  47. package/dist/schema/rules/rules-conditions.schema.d.ts +402 -0
  48. package/dist/schema/rules/rules-conditions.schema.d.ts.map +1 -0
  49. package/dist/schema/rules/rules-conditions.schema.js +99 -0
  50. package/dist/schema/rules/rules-enums.schema.d.ts +39 -0
  51. package/dist/schema/rules/rules-enums.schema.d.ts.map +1 -0
  52. package/dist/schema/rules/rules-enums.schema.js +90 -0
  53. package/dist/schema/rules/rules.schema.d.ts +2839 -0
  54. package/dist/schema/rules/rules.schema.d.ts.map +1 -0
  55. package/dist/schema/rules/rules.schema.js +76 -0
  56. package/dist/schema/rules-transactions.schema.d.ts +450 -0
  57. package/dist/schema/rules-transactions.schema.d.ts.map +1 -0
  58. package/dist/schema/rules-transactions.schema.js +63 -0
  59. package/dist/schema/transactions.schema.d.ts +45 -0
  60. package/dist/schema/transactions.schema.d.ts.map +1 -0
  61. package/dist/schema/{transaction.schema.js → transactions.schema.js} +16 -1
  62. package/package.json +3 -3
  63. package/dist/schema/authorities.schema.d.ts.map +0 -1
  64. package/dist/schema/transaction.schema.d.ts +0 -8
  65. package/dist/schema/transaction.schema.d.ts.map +0 -1
@@ -1,71 +1,18 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
24
4
  };
25
5
  Object.defineProperty(exports, "__esModule", { value: true });
26
6
  exports.authorities = void 0;
27
- const express = __importStar(require("express"));
7
+ const express_1 = __importDefault(require("express"));
28
8
  const get_set_audiences_1 = require("../authority/audience/get-set-audiences");
29
9
  const validate_jwt_authorities_1 = require("../authority/jwt/validate-jwt-authorities");
30
- const validate_request_body_1 = require("../endpoints/helpers/validate-request-body");
31
- const generic_1 = require("@degenerate/generic");
32
- const validate_incoming_request_data_1 = require("../endpoints/helpers/validate-incoming-request-data");
33
- const authorities_schema_1 = require("../../schema/authorities.schema");
10
+ const request_logging_1 = require("../logging/request-logging");
11
+ const v1_routes_1 = require("./authorities/v1.routes");
34
12
  // eslint-disable-next-line new-cap
35
- const router = express.Router({ mergeParams: true });
13
+ const router = express_1.default.Router({ mergeParams: true });
14
+ router.use(request_logging_1.requestLogging); // log the request
36
15
  router.use(get_set_audiences_1.setAudienceAuthority); // set the audience to share data (this will throw an error if the audience is not set)
37
16
  router.use(validate_jwt_authorities_1.validateJWTAuthorities); // get the audience authority
38
- /**
39
- * This creates a new authority object.
40
- */
41
- router.post('/', validate_request_body_1.validateRequestBody, // make sure this is a valid request body
42
- (0, validate_incoming_request_data_1.validateIncomingRequestData)(authorities_schema_1.ISAFETransactionAuthorityAddSchema), async (req, res) => {
43
- return res.status(200).send({ successful: true });
44
- });
45
- /**
46
- * This gets the authorities objects and their data.
47
- */
48
- router.get('/', async (req, res) => {
49
- console.log('GET /authorities called');
50
- res.status(200).send({ successful: true });
51
- return;
52
- });
53
- router.get('/:authorityid', async (req, res) => {
54
- console.log('GET /authorities params called');
55
- const authorityId = (0, generic_1.getAuthorityId)(req); // get the authority id.
56
- console.log(`Authority ID: ${authorityId}`);
57
- return res.status(200).send({ successful: true, authorityId });
58
- });
59
- /**
60
- * This updates the authority object.
61
- */
62
- router.patch('/', validate_request_body_1.validateRequestBody, async (req, res) => {
63
- return res.status(200).send({ successful: true });
64
- });
65
- /**
66
- * This deletes the authority object.
67
- */
68
- router.delete('/', async (req, res) => {
69
- return res.status(200).send({ successful: true });
70
- });
17
+ router.use('/v1', v1_routes_1.v1); // use the v1 routes
71
18
  exports.authorities = router;
@@ -0,0 +1,2 @@
1
+ export declare const ruleSets: import("express-serve-static-core").Router;
2
+ //# sourceMappingURL=rule-set.routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rule-set.routes.d.ts","sourceRoot":"","sources":["../../../../../src/cors/routes/rules/v1/rule-set.routes.ts"],"names":[],"mappings":"AAiGA,eAAO,MAAM,QAAQ,4CAAS,CAAC"}
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ //#region Package Imports
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || function (mod) {
20
+ if (mod && mod.__esModule) return mod;
21
+ var result = {};
22
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
+ __setModuleDefault(result, mod);
24
+ return result;
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.ruleSets = void 0;
28
+ const express = __importStar(require("express"));
29
+ //#endregion Package Imports
30
+ // #region Middleware Protections
31
+ // #endregion Middleware Protections
32
+ //#region Incoming Shape Validations
33
+ const validate_incoming_request_data_1 = require("../../../endpoints/helpers/validate-incoming-request-data");
34
+ //#endregion Incoming Shape Validations
35
+ //#region Functions and Models
36
+ const rules_transactions_schema_1 = require("../../../../schema/rules-transactions.schema");
37
+ const generic_1 = require("@degenerate/generic");
38
+ const params_object_helpers_1 = require("@degenerate/generic/src/helpers/request/params-object-helpers");
39
+ //#endregion Functions and Models
40
+ //#region Route Imports
41
+ //#endregion Route Imports
42
+ // eslint-disable-next-line new-cap
43
+ const router = express.Router({ mergeParams: true });
44
+ /**
45
+ * This creates a new rules set object.
46
+ */
47
+ router.post(// https://{hostname}/rules/v1/rule-sets
48
+ '/', (0, validate_incoming_request_data_1.validateIncomingRequestData)(rules_transactions_schema_1.ISAFETransactionRuleSetAddSchema), async (req, res, next) => {
49
+ try {
50
+ return res.status(200).send({ successful: true });
51
+ }
52
+ catch (err) {
53
+ next(err);
54
+ }
55
+ });
56
+ /**
57
+ * This gets all the rules set objects.
58
+ */
59
+ router.get('/', async (req, res, next) => {
60
+ try {
61
+ const lastId = (0, generic_1.getQueryLastId)(req); // get the last id from the query object
62
+ return res.status(200).send({ successful: true });
63
+ }
64
+ catch (err) {
65
+ next(err);
66
+ }
67
+ });
68
+ /**
69
+ * This gets the rules set object by id
70
+ */
71
+ router.get('/:rulesetsid', async (req, res, next) => {
72
+ try {
73
+ const rulesId = (0, params_object_helpers_1.getParamRuleSetsId)(req); // get the rules id.
74
+ return res.status(200).send({ successful: true });
75
+ }
76
+ catch (err) {
77
+ next(err);
78
+ }
79
+ });
80
+ /**
81
+ * This updates the rules set object by id
82
+ */
83
+ router.patch('/:rulesetsid', async (req, res, next) => {
84
+ try {
85
+ const rulesId = (0, params_object_helpers_1.getParamRuleSetsId)(req); // get the rules id.
86
+ return res.status(200).send({ successful: true });
87
+ }
88
+ catch (err) {
89
+ next(err);
90
+ }
91
+ });
92
+ /**
93
+ * This deletes the rules object by id
94
+ */
95
+ router.delete('/:rulesetsid', async (req, res, next) => {
96
+ try {
97
+ const rulesId = (0, params_object_helpers_1.getParamRuleSetsId)(req); // get the rules id.
98
+ return res.status(200).send({ successful: true });
99
+ }
100
+ catch (err) {
101
+ next(err);
102
+ }
103
+ });
104
+ exports.ruleSets = router; // https://{hostname}/rules/v1/rule-sets
@@ -0,0 +1,2 @@
1
+ export declare const v1: import("express-serve-static-core").Router;
2
+ //# sourceMappingURL=v1.routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v1.routes.d.ts","sourceRoot":"","sources":["../../../../src/cors/routes/rules/v1.routes.ts"],"names":[],"mappings":"AA6BA,eAAO,MAAM,EAAE,4CAAS,CAAC"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ //#region Package Imports
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || function (mod) {
20
+ if (mod && mod.__esModule) return mod;
21
+ var result = {};
22
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
+ __setModuleDefault(result, mod);
24
+ return result;
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.v1 = void 0;
28
+ const express = __importStar(require("express"));
29
+ //#endregion Package Imports
30
+ // #region Middleware Protections
31
+ const add_unique_tracking_1 = require("../../logging/add-unique-tracking");
32
+ // #endregion Middleware Protections
33
+ //#region Incoming Shape Validations
34
+ //#endregion Incoming Shape Validations
35
+ //#region Functions and Models
36
+ //#endregion Functions and Models
37
+ //#region Route Imports
38
+ const rule_set_routes_1 = require("./v1/rule-set.routes");
39
+ //#endregion Route Imports
40
+ // eslint-disable-next-line new-cap
41
+ const router = express.Router({ mergeParams: true });
42
+ router.use(add_unique_tracking_1.addUniqueTracking); // add the unique tracking id to the request
43
+ router.use('/rule-sets', rule_set_routes_1.ruleSets); // https://{hostname}/rules/v1/rule-sets
44
+ exports.v1 = router; // https://{hostname}/rules/v1
@@ -1 +1 @@
1
- {"version":3,"file":"rules.routes.d.ts","sourceRoot":"","sources":["../../../src/cors/routes/rules.routes.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,KAAK,4CAAS,CAAC"}
1
+ {"version":3,"file":"rules.routes.d.ts","sourceRoot":"","sources":["../../../src/cors/routes/rules.routes.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,KAAK,4CAAS,CAAC"}
@@ -26,31 +26,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.rules = void 0;
27
27
  const express = __importStar(require("express"));
28
28
  const get_set_audiences_1 = require("../authority/audience/get-set-audiences");
29
+ const request_logging_1 = require("../logging/request-logging");
30
+ const validate_jwt_rules_1 = require("../authority/jwt/validate-jwt-rules");
31
+ const v1_routes_1 = require("./rules/v1.routes");
29
32
  // eslint-disable-next-line new-cap
30
33
  const router = express.Router({ mergeParams: true });
34
+ router.use(request_logging_1.requestLogging); // log the request
31
35
  router.use(get_set_audiences_1.setAudienceRules); // set the audience to share data (this will throw an error if the audience is not set)
32
- /**
33
- * This creates a new sharedata object.
34
- */
35
- router.post('/', async (req, res) => {
36
- return res.status(200).send({ successful: true });
37
- });
38
- /**
39
- * This gets the sharedata object.
40
- */
41
- router.get('/', async (req, res) => {
42
- return res.status(200).send({ successful: true });
43
- });
44
- /**
45
- * This updates the sharedata object.
46
- */
47
- router.patch('/', async (req, res) => {
48
- return res.status(200).send({ successful: true });
49
- });
50
- /**
51
- * This deletes the sharedata object.
52
- */
53
- router.delete('/', async (req, res) => {
54
- return res.status(200).send({ successful: true });
55
- });
36
+ router.use(validate_jwt_rules_1.validateJWTRules); // make sure the rules authority is valid.
37
+ router.use('/v1', v1_routes_1.v1);
56
38
  exports.rules = router;
@@ -19,43 +19,6 @@ export declare const ISAFETransactionAuthorityDataSchema: z.ZodObject<{
19
19
  authorityValidationType: AuthorityValidationType;
20
20
  authorityOver: SAFETransactionType[];
21
21
  }>;
22
- /**
23
- * This is the schema for the SAFE transaction base.
24
- */
25
- export declare const ISAFETransactionBaseSchema: z.ZodObject<{
26
- createdAt: z.ZodNumber;
27
- authority: z.ZodString;
28
- authoritySignature: z.ZodString;
29
- transaction: z.ZodObject<{
30
- type: z.ZodEnum<[SAFETransactionType.AUTHORITY, SAFETransactionType.SHAREDATA, SAFETransactionType.FUNCTIONS, SAFETransactionType.RULES, SAFETransactionType.EVENTS, SAFETransactionType.ENDPOINTS]>;
31
- action: z.ZodEnum<[SAFETransactionActionType.ADD, SAFETransactionActionType.REMOVE, SAFETransactionActionType.UPDATE]>;
32
- }, "strip", z.ZodTypeAny, {
33
- type: SAFETransactionType;
34
- action: SAFETransactionActionType;
35
- }, {
36
- type: SAFETransactionType;
37
- action: SAFETransactionActionType;
38
- }>;
39
- version: z.ZodNumber;
40
- }, "strip", z.ZodTypeAny, {
41
- createdAt: number;
42
- authority: string;
43
- authoritySignature: string;
44
- transaction: {
45
- type: SAFETransactionType;
46
- action: SAFETransactionActionType;
47
- };
48
- version: number;
49
- }, {
50
- createdAt: number;
51
- authority: string;
52
- authoritySignature: string;
53
- transaction: {
54
- type: SAFETransactionType;
55
- action: SAFETransactionActionType;
56
- };
57
- version: number;
58
- }>;
59
22
  /**
60
23
  * This is the transaction targetting an authority in the SAFE Ecosystem.
61
24
  *
@@ -134,9 +97,6 @@ export declare const ISAFETransactionAuthorityAddSchema: z.ZodObject<z.objectUti
134
97
  };
135
98
  }>;
136
99
  }>, "strip", z.ZodTypeAny, {
137
- createdAt: number;
138
- authority: string;
139
- authoritySignature: string;
140
100
  transaction: {
141
101
  type: SAFETransactionType.AUTHORITY;
142
102
  action: SAFETransactionActionType.ADD;
@@ -147,11 +107,11 @@ export declare const ISAFETransactionAuthorityAddSchema: z.ZodObject<z.objectUti
147
107
  authorityOver: SAFETransactionType[];
148
108
  };
149
109
  };
150
- version: number;
151
- }, {
152
110
  createdAt: number;
153
111
  authority: string;
154
112
  authoritySignature: string;
113
+ version: number;
114
+ }, {
155
115
  transaction: {
156
116
  type: SAFETransactionType.AUTHORITY;
157
117
  action: SAFETransactionActionType.ADD;
@@ -162,6 +122,9 @@ export declare const ISAFETransactionAuthorityAddSchema: z.ZodObject<z.objectUti
162
122
  authorityOver: SAFETransactionType[];
163
123
  };
164
124
  };
125
+ createdAt: number;
126
+ authority: string;
127
+ authoritySignature: string;
165
128
  version: number;
166
129
  }>;
167
130
  /**
@@ -222,9 +185,6 @@ export declare const ISAFETransactionAuthorityUpdateSchema: z.ZodObject<z.object
222
185
  };
223
186
  }>;
224
187
  }>, "strip", z.ZodTypeAny, {
225
- createdAt: number;
226
- authority: string;
227
- authoritySignature: string;
228
188
  transaction: {
229
189
  type: SAFETransactionType.AUTHORITY;
230
190
  action: SAFETransactionActionType.UPDATE;
@@ -235,11 +195,11 @@ export declare const ISAFETransactionAuthorityUpdateSchema: z.ZodObject<z.object
235
195
  authorityOver: SAFETransactionType[];
236
196
  };
237
197
  };
238
- version: number;
239
- }, {
240
198
  createdAt: number;
241
199
  authority: string;
242
200
  authoritySignature: string;
201
+ version: number;
202
+ }, {
243
203
  transaction: {
244
204
  type: SAFETransactionType.AUTHORITY;
245
205
  action: SAFETransactionActionType.UPDATE;
@@ -250,6 +210,9 @@ export declare const ISAFETransactionAuthorityUpdateSchema: z.ZodObject<z.object
250
210
  authorityOver: SAFETransactionType[];
251
211
  };
252
212
  };
213
+ createdAt: number;
214
+ authority: string;
215
+ authoritySignature: string;
253
216
  version: number;
254
217
  }>;
255
218
  /**
@@ -310,9 +273,6 @@ export declare const ISAFETransactionAuthorityRemoveSchema: z.ZodObject<z.object
310
273
  };
311
274
  }>;
312
275
  }>, "strip", z.ZodTypeAny, {
313
- createdAt: number;
314
- authority: string;
315
- authoritySignature: string;
316
276
  transaction: {
317
277
  type: SAFETransactionType.AUTHORITY;
318
278
  action: SAFETransactionActionType.REMOVE;
@@ -323,11 +283,11 @@ export declare const ISAFETransactionAuthorityRemoveSchema: z.ZodObject<z.object
323
283
  authorityOver: SAFETransactionType[];
324
284
  };
325
285
  };
326
- version: number;
327
- }, {
328
286
  createdAt: number;
329
287
  authority: string;
330
288
  authoritySignature: string;
289
+ version: number;
290
+ }, {
331
291
  transaction: {
332
292
  type: SAFETransactionType.AUTHORITY;
333
293
  action: SAFETransactionActionType.REMOVE;
@@ -338,6 +298,9 @@ export declare const ISAFETransactionAuthorityRemoveSchema: z.ZodObject<z.object
338
298
  authorityOver: SAFETransactionType[];
339
299
  };
340
300
  };
301
+ createdAt: number;
302
+ authority: string;
303
+ authoritySignature: string;
341
304
  version: number;
342
305
  }>;
343
- //# sourceMappingURL=authorities.schema.d.ts.map
306
+ //# sourceMappingURL=authorities-transactions.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorities-transactions.schema.d.ts","sourceRoot":"","sources":["../../src/schema/authorities-transactions.schema.ts"],"names":[],"mappings":"AACA,OAAO,CAAC,MAAM,KAAK,CAAC;AAMpB,OAAO,EACH,uBAAuB,EACvB,yBAAyB,EACzB,mBAAmB,EACtB,MAAM,qBAAqB,CAAC;AAK7B;;GAEG;AACH,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;EAK9C,CAAC;AAIH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;GAEG;AACH,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM7C,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMhD,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMhD,CAAC"}
@@ -3,10 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ISAFETransactionAuthorityRemoveSchema = exports.ISAFETransactionAuthorityUpdateSchema = exports.ISAFETransactionAuthorityAddSchema = exports.ISAFETransactionBaseSchema = exports.ISAFETransactionAuthorityDataSchema = void 0;
6
+ exports.ISAFETransactionAuthorityRemoveSchema = exports.ISAFETransactionAuthorityUpdateSchema = exports.ISAFETransactionAuthorityAddSchema = exports.ISAFETransactionAuthorityDataSchema = void 0;
7
7
  // This contains the schemas for the authorities objects in the zod format..
8
8
  const zod_1 = __importDefault(require("zod"));
9
- const transaction_schema_1 = require("./transaction.schema");
9
+ const transactions_schema_1 = require("./transactions.schema");
10
10
  const generic_1 = require("@degenerate/generic");
11
11
  const IAuthorizationIssuerSchema = zod_1.default.string().regex(/^[a-zA-Z0-9]+-[a-zA-Z0-9]+$/);
12
12
  const AuthorityValidationTypeSchema = zod_1.default.enum([generic_1.AuthorityValidationType.JWT]);
@@ -17,20 +17,7 @@ exports.ISAFETransactionAuthorityDataSchema = zod_1.default.object({
17
17
  authorizationIssuer: IAuthorizationIssuerSchema,
18
18
  authorizationPublicKey: zod_1.default.string(),
19
19
  authorityValidationType: AuthorityValidationTypeSchema,
20
- authorityOver: zod_1.default.array(transaction_schema_1.SAFETransactionTypeSchema),
21
- });
22
- /**
23
- * This is the schema for the SAFE transaction base.
24
- */
25
- exports.ISAFETransactionBaseSchema = zod_1.default.object({
26
- createdAt: zod_1.default.number(), // the javascript timestamp of when the transaction was created
27
- authority: zod_1.default.string(), // the public key of the authority that created the transaction
28
- authoritySignature: zod_1.default.string(), // the signature of the authority that created the transaction
29
- transaction: zod_1.default.object({
30
- type: transaction_schema_1.SAFETransactionTypeSchema, // the type of transaction
31
- action: transaction_schema_1.SAFETransactionActionTypeSchema, // the action to perform on the transaction
32
- }),
33
- version: zod_1.default.number(), // the version of the transaction
20
+ authorityOver: zod_1.default.array(transactions_schema_1.SAFETransactionTypeSchema),
34
21
  });
35
22
  /**
36
23
  * This is the transaction targetting an authority in the SAFE Ecosystem.
@@ -55,7 +42,7 @@ const sampleTransactionAuthority: ISAFETransactionAuthority = {
55
42
  /**
56
43
  * This is the schema for the authority transaction add.
57
44
  */
58
- exports.ISAFETransactionAuthorityAddSchema = exports.ISAFETransactionBaseSchema.extend({
45
+ exports.ISAFETransactionAuthorityAddSchema = transactions_schema_1.ISAFETransactionBaseSchema.extend({
59
46
  transaction: zod_1.default.object({
60
47
  type: zod_1.default.literal(generic_1.SAFETransactionType.AUTHORITY),
61
48
  action: zod_1.default.literal(generic_1.SAFETransactionActionType.ADD),
@@ -65,7 +52,7 @@ exports.ISAFETransactionAuthorityAddSchema = exports.ISAFETransactionBaseSchema.
65
52
  /**
66
53
  * This is the schema for the authority transaction update.
67
54
  */
68
- exports.ISAFETransactionAuthorityUpdateSchema = exports.ISAFETransactionBaseSchema.extend({
55
+ exports.ISAFETransactionAuthorityUpdateSchema = transactions_schema_1.ISAFETransactionBaseSchema.extend({
69
56
  transaction: zod_1.default.object({
70
57
  type: zod_1.default.literal(generic_1.SAFETransactionType.AUTHORITY),
71
58
  action: zod_1.default.literal(generic_1.SAFETransactionActionType.UPDATE),
@@ -75,7 +62,7 @@ exports.ISAFETransactionAuthorityUpdateSchema = exports.ISAFETransactionBaseSche
75
62
  /**
76
63
  * This is the schema for the authority transaction remove.
77
64
  */
78
- exports.ISAFETransactionAuthorityRemoveSchema = exports.ISAFETransactionBaseSchema.extend({
65
+ exports.ISAFETransactionAuthorityRemoveSchema = transactions_schema_1.ISAFETransactionBaseSchema.extend({
79
66
  transaction: zod_1.default.object({
80
67
  type: zod_1.default.literal(generic_1.SAFETransactionType.AUTHORITY),
81
68
  action: zod_1.default.literal(generic_1.SAFETransactionActionType.REMOVE),