@degenerate/endpoints 0.0.10 → 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.
- 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-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.map +1 -1
- package/dist/cors/endpoints/helpers/validate-incoming-request-data.js +1 -0
- 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 +88 -0
- package/dist/cors/routes/authorities.routes.d.ts.map +1 -1
- package/dist/cors/routes/authorities.routes.js +8 -61
- 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/schema/rules-transactions.schema.d.ts +278 -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 +44 -0
- package/dist/schema/transactions.schema.d.ts.map +1 -0
- package/dist/schema/transactions.schema.js +41 -0
- package/package.json +3 -3
- package/dist/cors/endpoints/authorities/validate-authorities-transaction.d.ts +0 -30
- package/dist/cors/endpoints/authorities/validate-authorities-transaction.d.ts.map +0 -1
- package/dist/cors/endpoints/authorities/validate-authorities-transaction.js +0 -155
- package/dist/schema/authorities.schema.d.ts +0 -343
- package/dist/schema/authorities.schema.d.ts.map +0 -1
- package/dist/schema/authorities.schema.js +0 -84
- package/dist/schema/transaction.schema.d.ts +0 -8
- package/dist/schema/transaction.schema.d.ts.map +0 -1
- package/dist/schema/transaction.schema.js +0 -28
|
@@ -1,71 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
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
|
|
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
|
|
31
|
-
const
|
|
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 =
|
|
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 @@
|
|
|
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 @@
|
|
|
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":"
|
|
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
|
-
|
|
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;
|
|
@@ -0,0 +1,278 @@
|
|
|
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: any;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
[x: string]: any;
|
|
31
|
+
rulesTransactionType?: unknown;
|
|
32
|
+
ruleSet?: unknown;
|
|
33
|
+
}, {
|
|
34
|
+
[x: string]: any;
|
|
35
|
+
rulesTransactionType?: unknown;
|
|
36
|
+
ruleSet?: unknown;
|
|
37
|
+
}>;
|
|
38
|
+
/**
|
|
39
|
+
* This is the schema for the add rule set transaction
|
|
40
|
+
*/
|
|
41
|
+
export declare const ISAFETransactionRuleSetAddSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
42
|
+
createdAt: z.ZodNumber;
|
|
43
|
+
authority: z.ZodString;
|
|
44
|
+
authoritySignature: z.ZodString;
|
|
45
|
+
transaction: z.ZodObject<{
|
|
46
|
+
type: z.ZodEnum<["AUTHORITY", "SHAREDATA", "FUNCTIONS", "RULES", "EVENTS", "ENDPOINTS"]>;
|
|
47
|
+
action: z.ZodEnum<["ADD", "REMOVE", "UPDATE"]>;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
type: "SHAREDATA" | "FUNCTIONS" | "RULES" | "EVENTS" | "ENDPOINTS" | "AUTHORITY";
|
|
50
|
+
action: "ADD" | "REMOVE" | "UPDATE";
|
|
51
|
+
}, {
|
|
52
|
+
type: "SHAREDATA" | "FUNCTIONS" | "RULES" | "EVENTS" | "ENDPOINTS" | "AUTHORITY";
|
|
53
|
+
action: "ADD" | "REMOVE" | "UPDATE";
|
|
54
|
+
}>;
|
|
55
|
+
version: z.ZodNumber;
|
|
56
|
+
}, {
|
|
57
|
+
transaction: z.ZodObject<{
|
|
58
|
+
type: z.ZodLiteral<SAFETransactionType.RULES>;
|
|
59
|
+
action: z.ZodLiteral<SAFETransactionActionType.ADD>;
|
|
60
|
+
data: z.ZodObject<{
|
|
61
|
+
rulesTransactionType: z.ZodEnum<[SAFERulesTransactionType]>;
|
|
62
|
+
ruleSet: any;
|
|
63
|
+
}, "strip", z.ZodTypeAny, {
|
|
64
|
+
[x: string]: any;
|
|
65
|
+
rulesTransactionType?: unknown;
|
|
66
|
+
ruleSet?: unknown;
|
|
67
|
+
}, {
|
|
68
|
+
[x: string]: any;
|
|
69
|
+
rulesTransactionType?: unknown;
|
|
70
|
+
ruleSet?: unknown;
|
|
71
|
+
}>;
|
|
72
|
+
}, "strip", z.ZodTypeAny, {
|
|
73
|
+
type: SAFETransactionType.RULES;
|
|
74
|
+
data: {
|
|
75
|
+
[x: string]: any;
|
|
76
|
+
rulesTransactionType?: unknown;
|
|
77
|
+
ruleSet?: unknown;
|
|
78
|
+
};
|
|
79
|
+
action: SAFETransactionActionType.ADD;
|
|
80
|
+
}, {
|
|
81
|
+
type: SAFETransactionType.RULES;
|
|
82
|
+
data: {
|
|
83
|
+
[x: string]: any;
|
|
84
|
+
rulesTransactionType?: unknown;
|
|
85
|
+
ruleSet?: unknown;
|
|
86
|
+
};
|
|
87
|
+
action: SAFETransactionActionType.ADD;
|
|
88
|
+
}>;
|
|
89
|
+
}>, "strip", z.ZodTypeAny, {
|
|
90
|
+
createdAt: number;
|
|
91
|
+
authority: string;
|
|
92
|
+
authoritySignature: string;
|
|
93
|
+
transaction: {
|
|
94
|
+
type: SAFETransactionType.RULES;
|
|
95
|
+
data: {
|
|
96
|
+
[x: string]: any;
|
|
97
|
+
rulesTransactionType?: unknown;
|
|
98
|
+
ruleSet?: unknown;
|
|
99
|
+
};
|
|
100
|
+
action: SAFETransactionActionType.ADD;
|
|
101
|
+
};
|
|
102
|
+
version: number;
|
|
103
|
+
}, {
|
|
104
|
+
createdAt: number;
|
|
105
|
+
authority: string;
|
|
106
|
+
authoritySignature: string;
|
|
107
|
+
transaction: {
|
|
108
|
+
type: SAFETransactionType.RULES;
|
|
109
|
+
data: {
|
|
110
|
+
[x: string]: any;
|
|
111
|
+
rulesTransactionType?: unknown;
|
|
112
|
+
ruleSet?: unknown;
|
|
113
|
+
};
|
|
114
|
+
action: SAFETransactionActionType.ADD;
|
|
115
|
+
};
|
|
116
|
+
version: number;
|
|
117
|
+
}>;
|
|
118
|
+
/**
|
|
119
|
+
* This is the schema for the update rule set transaction
|
|
120
|
+
*/
|
|
121
|
+
export declare const ISAFETransactionRuleSetUpdateSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
122
|
+
createdAt: z.ZodNumber;
|
|
123
|
+
authority: z.ZodString;
|
|
124
|
+
authoritySignature: z.ZodString;
|
|
125
|
+
transaction: z.ZodObject<{
|
|
126
|
+
type: z.ZodEnum<["AUTHORITY", "SHAREDATA", "FUNCTIONS", "RULES", "EVENTS", "ENDPOINTS"]>;
|
|
127
|
+
action: z.ZodEnum<["ADD", "REMOVE", "UPDATE"]>;
|
|
128
|
+
}, "strip", z.ZodTypeAny, {
|
|
129
|
+
type: "SHAREDATA" | "FUNCTIONS" | "RULES" | "EVENTS" | "ENDPOINTS" | "AUTHORITY";
|
|
130
|
+
action: "ADD" | "REMOVE" | "UPDATE";
|
|
131
|
+
}, {
|
|
132
|
+
type: "SHAREDATA" | "FUNCTIONS" | "RULES" | "EVENTS" | "ENDPOINTS" | "AUTHORITY";
|
|
133
|
+
action: "ADD" | "REMOVE" | "UPDATE";
|
|
134
|
+
}>;
|
|
135
|
+
version: z.ZodNumber;
|
|
136
|
+
}, {
|
|
137
|
+
transaction: z.ZodObject<{
|
|
138
|
+
type: z.ZodLiteral<SAFETransactionType.RULES>;
|
|
139
|
+
action: z.ZodLiteral<SAFETransactionActionType.UPDATE>;
|
|
140
|
+
data: z.ZodObject<{
|
|
141
|
+
rulesTransactionType: z.ZodEnum<[SAFERulesTransactionType]>;
|
|
142
|
+
ruleSet: any;
|
|
143
|
+
}, "strip", z.ZodTypeAny, {
|
|
144
|
+
[x: string]: any;
|
|
145
|
+
rulesTransactionType?: unknown;
|
|
146
|
+
ruleSet?: unknown;
|
|
147
|
+
}, {
|
|
148
|
+
[x: string]: any;
|
|
149
|
+
rulesTransactionType?: unknown;
|
|
150
|
+
ruleSet?: unknown;
|
|
151
|
+
}>;
|
|
152
|
+
}, "strip", z.ZodTypeAny, {
|
|
153
|
+
type: SAFETransactionType.RULES;
|
|
154
|
+
data: {
|
|
155
|
+
[x: string]: any;
|
|
156
|
+
rulesTransactionType?: unknown;
|
|
157
|
+
ruleSet?: unknown;
|
|
158
|
+
};
|
|
159
|
+
action: SAFETransactionActionType.UPDATE;
|
|
160
|
+
}, {
|
|
161
|
+
type: SAFETransactionType.RULES;
|
|
162
|
+
data: {
|
|
163
|
+
[x: string]: any;
|
|
164
|
+
rulesTransactionType?: unknown;
|
|
165
|
+
ruleSet?: unknown;
|
|
166
|
+
};
|
|
167
|
+
action: SAFETransactionActionType.UPDATE;
|
|
168
|
+
}>;
|
|
169
|
+
}>, "strip", z.ZodTypeAny, {
|
|
170
|
+
createdAt: number;
|
|
171
|
+
authority: string;
|
|
172
|
+
authoritySignature: string;
|
|
173
|
+
transaction: {
|
|
174
|
+
type: SAFETransactionType.RULES;
|
|
175
|
+
data: {
|
|
176
|
+
[x: string]: any;
|
|
177
|
+
rulesTransactionType?: unknown;
|
|
178
|
+
ruleSet?: unknown;
|
|
179
|
+
};
|
|
180
|
+
action: SAFETransactionActionType.UPDATE;
|
|
181
|
+
};
|
|
182
|
+
version: number;
|
|
183
|
+
}, {
|
|
184
|
+
createdAt: number;
|
|
185
|
+
authority: string;
|
|
186
|
+
authoritySignature: string;
|
|
187
|
+
transaction: {
|
|
188
|
+
type: SAFETransactionType.RULES;
|
|
189
|
+
data: {
|
|
190
|
+
[x: string]: any;
|
|
191
|
+
rulesTransactionType?: unknown;
|
|
192
|
+
ruleSet?: unknown;
|
|
193
|
+
};
|
|
194
|
+
action: SAFETransactionActionType.UPDATE;
|
|
195
|
+
};
|
|
196
|
+
version: number;
|
|
197
|
+
}>;
|
|
198
|
+
/**
|
|
199
|
+
* This is the schema for the remove rule set transaction
|
|
200
|
+
*/
|
|
201
|
+
export declare const ISAFETransactionRuleSetRemoveSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
202
|
+
createdAt: z.ZodNumber;
|
|
203
|
+
authority: z.ZodString;
|
|
204
|
+
authoritySignature: z.ZodString;
|
|
205
|
+
transaction: z.ZodObject<{
|
|
206
|
+
type: z.ZodEnum<["AUTHORITY", "SHAREDATA", "FUNCTIONS", "RULES", "EVENTS", "ENDPOINTS"]>;
|
|
207
|
+
action: z.ZodEnum<["ADD", "REMOVE", "UPDATE"]>;
|
|
208
|
+
}, "strip", z.ZodTypeAny, {
|
|
209
|
+
type: "SHAREDATA" | "FUNCTIONS" | "RULES" | "EVENTS" | "ENDPOINTS" | "AUTHORITY";
|
|
210
|
+
action: "ADD" | "REMOVE" | "UPDATE";
|
|
211
|
+
}, {
|
|
212
|
+
type: "SHAREDATA" | "FUNCTIONS" | "RULES" | "EVENTS" | "ENDPOINTS" | "AUTHORITY";
|
|
213
|
+
action: "ADD" | "REMOVE" | "UPDATE";
|
|
214
|
+
}>;
|
|
215
|
+
version: z.ZodNumber;
|
|
216
|
+
}, {
|
|
217
|
+
transaction: z.ZodObject<{
|
|
218
|
+
type: z.ZodLiteral<SAFETransactionType.RULES>;
|
|
219
|
+
action: z.ZodLiteral<SAFETransactionActionType.REMOVE>;
|
|
220
|
+
data: z.ZodObject<{
|
|
221
|
+
rulesTransactionType: z.ZodEnum<[SAFERulesTransactionType]>;
|
|
222
|
+
ruleSet: any;
|
|
223
|
+
}, "strip", z.ZodTypeAny, {
|
|
224
|
+
[x: string]: any;
|
|
225
|
+
rulesTransactionType?: unknown;
|
|
226
|
+
ruleSet?: unknown;
|
|
227
|
+
}, {
|
|
228
|
+
[x: string]: any;
|
|
229
|
+
rulesTransactionType?: unknown;
|
|
230
|
+
ruleSet?: unknown;
|
|
231
|
+
}>;
|
|
232
|
+
}, "strip", z.ZodTypeAny, {
|
|
233
|
+
type: SAFETransactionType.RULES;
|
|
234
|
+
data: {
|
|
235
|
+
[x: string]: any;
|
|
236
|
+
rulesTransactionType?: unknown;
|
|
237
|
+
ruleSet?: unknown;
|
|
238
|
+
};
|
|
239
|
+
action: SAFETransactionActionType.REMOVE;
|
|
240
|
+
}, {
|
|
241
|
+
type: SAFETransactionType.RULES;
|
|
242
|
+
data: {
|
|
243
|
+
[x: string]: any;
|
|
244
|
+
rulesTransactionType?: unknown;
|
|
245
|
+
ruleSet?: unknown;
|
|
246
|
+
};
|
|
247
|
+
action: SAFETransactionActionType.REMOVE;
|
|
248
|
+
}>;
|
|
249
|
+
}>, "strip", z.ZodTypeAny, {
|
|
250
|
+
createdAt: number;
|
|
251
|
+
authority: string;
|
|
252
|
+
authoritySignature: string;
|
|
253
|
+
transaction: {
|
|
254
|
+
type: SAFETransactionType.RULES;
|
|
255
|
+
data: {
|
|
256
|
+
[x: string]: any;
|
|
257
|
+
rulesTransactionType?: unknown;
|
|
258
|
+
ruleSet?: unknown;
|
|
259
|
+
};
|
|
260
|
+
action: SAFETransactionActionType.REMOVE;
|
|
261
|
+
};
|
|
262
|
+
version: number;
|
|
263
|
+
}, {
|
|
264
|
+
createdAt: number;
|
|
265
|
+
authority: string;
|
|
266
|
+
authoritySignature: string;
|
|
267
|
+
transaction: {
|
|
268
|
+
type: SAFETransactionType.RULES;
|
|
269
|
+
data: {
|
|
270
|
+
[x: string]: any;
|
|
271
|
+
rulesTransactionType?: unknown;
|
|
272
|
+
ruleSet?: unknown;
|
|
273
|
+
};
|
|
274
|
+
action: SAFETransactionActionType.REMOVE;
|
|
275
|
+
};
|
|
276
|
+
version: number;
|
|
277
|
+
}>;
|
|
278
|
+
//# 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,44 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
export declare const SAFETransactionTypeSchema: z.ZodEnum<["AUTHORITY", "SHAREDATA", "FUNCTIONS", "RULES", "EVENTS", "ENDPOINTS"]>;
|
|
3
|
+
/**
|
|
4
|
+
* This is the type of function that is being targetted in the transaction.
|
|
5
|
+
*/
|
|
6
|
+
export declare const SAFETransactionActionTypeSchema: z.ZodEnum<["ADD", "REMOVE", "UPDATE"]>;
|
|
7
|
+
/**
|
|
8
|
+
* This is the schema for the SAFE transaction base.
|
|
9
|
+
*/
|
|
10
|
+
export declare const ISAFETransactionBaseSchema: z.ZodObject<{
|
|
11
|
+
createdAt: z.ZodNumber;
|
|
12
|
+
authority: z.ZodString;
|
|
13
|
+
authoritySignature: z.ZodString;
|
|
14
|
+
transaction: z.ZodObject<{
|
|
15
|
+
type: z.ZodEnum<["AUTHORITY", "SHAREDATA", "FUNCTIONS", "RULES", "EVENTS", "ENDPOINTS"]>;
|
|
16
|
+
action: z.ZodEnum<["ADD", "REMOVE", "UPDATE"]>;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
type: "SHAREDATA" | "FUNCTIONS" | "RULES" | "EVENTS" | "ENDPOINTS" | "AUTHORITY";
|
|
19
|
+
action: "ADD" | "REMOVE" | "UPDATE";
|
|
20
|
+
}, {
|
|
21
|
+
type: "SHAREDATA" | "FUNCTIONS" | "RULES" | "EVENTS" | "ENDPOINTS" | "AUTHORITY";
|
|
22
|
+
action: "ADD" | "REMOVE" | "UPDATE";
|
|
23
|
+
}>;
|
|
24
|
+
version: z.ZodNumber;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
createdAt: number;
|
|
27
|
+
authority: string;
|
|
28
|
+
authoritySignature: string;
|
|
29
|
+
transaction: {
|
|
30
|
+
type: "SHAREDATA" | "FUNCTIONS" | "RULES" | "EVENTS" | "ENDPOINTS" | "AUTHORITY";
|
|
31
|
+
action: "ADD" | "REMOVE" | "UPDATE";
|
|
32
|
+
};
|
|
33
|
+
version: number;
|
|
34
|
+
}, {
|
|
35
|
+
createdAt: number;
|
|
36
|
+
authority: string;
|
|
37
|
+
authoritySignature: string;
|
|
38
|
+
transaction: {
|
|
39
|
+
type: "SHAREDATA" | "FUNCTIONS" | "RULES" | "EVENTS" | "ENDPOINTS" | "AUTHORITY";
|
|
40
|
+
action: "ADD" | "REMOVE" | "UPDATE";
|
|
41
|
+
};
|
|
42
|
+
version: number;
|
|
43
|
+
}>;
|
|
44
|
+
//# sourceMappingURL=transactions.schema.d.ts.map
|