@degenerate/endpoints 0.0.12 → 0.0.13
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/dist/cors/index.d.ts +1 -2
- package/dist/cors/index.d.ts.map +1 -1
- package/dist/cors/index.js +2 -3
- package/dist/cors/logging/add-unique-tracking.js +2 -2
- package/dist/cors/routes/authorities/v1.routes.d.ts.map +1 -1
- package/dist/cors/routes/authorities/v1.routes.js +4 -5
- package/dist/cors/routes/rules/v1/rule-set.routes.d.ts.map +1 -1
- package/dist/cors/routes/rules/v1/rule-set.routes.js +4 -6
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -0
- package/package.json +3 -3
- package/dist/schema/rules-transactions.schema.d.ts +0 -278
- package/dist/schema/rules-transactions.schema.d.ts.map +0 -1
- package/dist/schema/rules-transactions.schema.js +0 -63
- package/dist/schema/transactions.schema.d.ts +0 -44
- package/dist/schema/transactions.schema.d.ts.map +0 -1
- package/dist/schema/transactions.schema.js +0 -41
package/dist/cors/index.d.ts
CHANGED
|
@@ -5,9 +5,8 @@ export * from './authority/jwt/validate-jwt-events';
|
|
|
5
5
|
export * from './authority/jwt/validate-jwt-functions';
|
|
6
6
|
export * from './authority/jwt/validate-jwt-rules';
|
|
7
7
|
export * from './authority/jwt/validate-jwt-share-data';
|
|
8
|
-
export * from './endpoints/authorities/validate-authorities-transaction';
|
|
9
|
-
export * from './endpoints/helpers/validate-request-body';
|
|
10
8
|
export * from './endpoints/helpers/validate-incoming-request-data';
|
|
9
|
+
export * from './endpoints/helpers/validate-request-body';
|
|
11
10
|
export * from './errors/all-error-handler';
|
|
12
11
|
export * from './errors/bad-request-handler';
|
|
13
12
|
export * from './errors/unauthorized-handler';
|
package/dist/cors/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cors/index.ts"],"names":[],"mappings":"AAAA,cAAc,wCAAwC,CAAC;AACvD,cAAc,0CAA0C,CAAC;AACzD,cAAc,wCAAwC,CAAC;AACvD,cAAc,qCAAqC,CAAC;AACpD,cAAc,wCAAwC,CAAC;AACvD,cAAc,oCAAoC,CAAC;AACnD,cAAc,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cors/index.ts"],"names":[],"mappings":"AAAA,cAAc,wCAAwC,CAAC;AACvD,cAAc,0CAA0C,CAAC;AACzD,cAAc,wCAAwC,CAAC;AACvD,cAAc,qCAAqC,CAAC;AACpD,cAAc,wCAAwC,CAAC;AACvD,cAAc,oCAAoC,CAAC;AACnD,cAAc,yCAAyC,CAAC;AAGxD,cAAc,oDAAoD,CAAC;AAEnE,cAAc,2CAA2C,CAAC;AAI1D,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAI9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAI1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC"}
|
package/dist/cors/index.js
CHANGED
|
@@ -22,11 +22,10 @@ __exportStar(require("./authority/jwt/validate-jwt-functions"), exports);
|
|
|
22
22
|
__exportStar(require("./authority/jwt/validate-jwt-rules"), exports);
|
|
23
23
|
__exportStar(require("./authority/jwt/validate-jwt-share-data"), exports);
|
|
24
24
|
//#region Endpoints
|
|
25
|
-
__exportStar(require("./endpoints/authorities/validate-authorities-transaction"), exports);
|
|
26
|
-
// zod checks
|
|
27
|
-
__exportStar(require("./endpoints/helpers/validate-request-body"), exports);
|
|
28
25
|
// object javascript checks
|
|
29
26
|
__exportStar(require("./endpoints/helpers/validate-incoming-request-data"), exports);
|
|
27
|
+
// zod checks
|
|
28
|
+
__exportStar(require("./endpoints/helpers/validate-request-body"), exports);
|
|
30
29
|
//#endregion Endpoints
|
|
31
30
|
//#region errors functions
|
|
32
31
|
__exportStar(require("./errors/all-error-handler"), exports);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addUniqueTracking = addUniqueTracking;
|
|
4
4
|
const generic_1 = require("@degenerate/generic");
|
|
5
|
-
const
|
|
5
|
+
const generic_2 = require("@degenerate/generic");
|
|
6
6
|
/**
|
|
7
7
|
* This function adds a unique tracking id to the request object.
|
|
8
8
|
*
|
|
@@ -12,7 +12,7 @@ const request_object_helpers_1 = require("@degenerate/generic/src/helpers/reques
|
|
|
12
12
|
* @returns
|
|
13
13
|
*/
|
|
14
14
|
function addUniqueTracking(req, res, next) {
|
|
15
|
-
(0,
|
|
15
|
+
(0, generic_2.setUniqueTrackingId)(req, `${(0, generic_1.createId)(30)}-${Date.now()}`);
|
|
16
16
|
next();
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v1.routes.d.ts","sourceRoot":"","sources":["../../../../src/cors/routes/authorities/v1.routes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"v1.routes.d.ts","sourceRoot":"","sources":["../../../../src/cors/routes/authorities/v1.routes.ts"],"names":[],"mappings":"AAkGA,eAAO,MAAM,EAAE,4CAAS,CAAC"}
|
|
@@ -32,14 +32,13 @@ const validate_request_body_1 = require("../../endpoints/helpers/validate-reques
|
|
|
32
32
|
const validate_incoming_request_data_1 = require("../../endpoints/helpers/validate-incoming-request-data");
|
|
33
33
|
// #endregion Middleware Protections
|
|
34
34
|
//#region Incoming Shape Validations
|
|
35
|
-
const
|
|
35
|
+
const generic_1 = require("@degenerate/generic");
|
|
36
36
|
//#endregion Incoming Shape Validations
|
|
37
37
|
//#region Functions and Models
|
|
38
38
|
const add_unique_tracking_1 = require("../../logging/add-unique-tracking");
|
|
39
39
|
//#endregion Functions and Models
|
|
40
40
|
//#region Route Imports
|
|
41
41
|
//#endregion Route Imports
|
|
42
|
-
const generic_1 = require("@degenerate/generic");
|
|
43
42
|
// eslint-disable-next-line new-cap
|
|
44
43
|
const router = express.Router({ mergeParams: true });
|
|
45
44
|
router.use(add_unique_tracking_1.addUniqueTracking); // add the unique tracking id to the request
|
|
@@ -49,7 +48,7 @@ router.use(add_unique_tracking_1.addUniqueTracking); // add the unique tracking
|
|
|
49
48
|
router.post(// https://{hostname}/authorities/v1
|
|
50
49
|
'/', add_unique_tracking_1.addUniqueTracking, // add a unique tracking id to the request
|
|
51
50
|
validate_request_body_1.validateRequestBody, // make sure this is a valid request body
|
|
52
|
-
(0, validate_incoming_request_data_1.validateIncomingRequestData)(
|
|
51
|
+
(0, validate_incoming_request_data_1.validateIncomingRequestData)(generic_1.ISAFETransactionAuthorityAddSchema), async (req, res) => {
|
|
53
52
|
return res.status(200).send({ successful: true });
|
|
54
53
|
});
|
|
55
54
|
/**
|
|
@@ -72,7 +71,7 @@ async (req, res) => {
|
|
|
72
71
|
*/
|
|
73
72
|
router.patch(// https://{hostname}/authorities/v1/{authorityid}
|
|
74
73
|
'/:authorityid', add_unique_tracking_1.addUniqueTracking, // add a unique tracking id to the request
|
|
75
|
-
validate_request_body_1.validateRequestBody, (0, validate_incoming_request_data_1.validateIncomingRequestData)(
|
|
74
|
+
validate_request_body_1.validateRequestBody, (0, validate_incoming_request_data_1.validateIncomingRequestData)(generic_1.ISAFETransactionAuthorityUpdateSchema), async (req, res) => {
|
|
76
75
|
const authorityId = (0, generic_1.getAuthorityId)(req); // get the authority id.
|
|
77
76
|
return res.status(200).send({ successful: true, authorityId });
|
|
78
77
|
});
|
|
@@ -81,7 +80,7 @@ validate_request_body_1.validateRequestBody, (0, validate_incoming_request_data_
|
|
|
81
80
|
*/
|
|
82
81
|
router.delete(// https://{hostname}/authorities/v1
|
|
83
82
|
'/:authorityid', add_unique_tracking_1.addUniqueTracking, // add a unique tracking id to the request
|
|
84
|
-
validate_request_body_1.validateRequestBody, (0, validate_incoming_request_data_1.validateIncomingRequestData)(
|
|
83
|
+
validate_request_body_1.validateRequestBody, (0, validate_incoming_request_data_1.validateIncomingRequestData)(generic_1.ISAFETransactionAuthorityDeleteSchema), async (req, res) => {
|
|
85
84
|
const authorityId = (0, generic_1.getAuthorityId)(req); // get the authority id.
|
|
86
85
|
return res.status(200).send({ successful: true, authorityId });
|
|
87
86
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule-set.routes.d.ts","sourceRoot":"","sources":["../../../../../src/cors/routes/rules/v1/rule-set.routes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rule-set.routes.d.ts","sourceRoot":"","sources":["../../../../../src/cors/routes/rules/v1/rule-set.routes.ts"],"names":[],"mappings":"AAkGA,eAAO,MAAM,QAAQ,4CAAS,CAAC"}
|
|
@@ -33,9 +33,7 @@ const express = __importStar(require("express"));
|
|
|
33
33
|
const validate_incoming_request_data_1 = require("../../../endpoints/helpers/validate-incoming-request-data");
|
|
34
34
|
//#endregion Incoming Shape Validations
|
|
35
35
|
//#region Functions and Models
|
|
36
|
-
const rules_transactions_schema_1 = require("../../../../schema/rules-transactions.schema");
|
|
37
36
|
const generic_1 = require("@degenerate/generic");
|
|
38
|
-
const params_object_helpers_1 = require("@degenerate/generic/src/helpers/request/params-object-helpers");
|
|
39
37
|
//#endregion Functions and Models
|
|
40
38
|
//#region Route Imports
|
|
41
39
|
//#endregion Route Imports
|
|
@@ -45,7 +43,7 @@ const router = express.Router({ mergeParams: true });
|
|
|
45
43
|
* This creates a new rules set object.
|
|
46
44
|
*/
|
|
47
45
|
router.post(// https://{hostname}/rules/v1/rule-sets
|
|
48
|
-
'/', (0, validate_incoming_request_data_1.validateIncomingRequestData)(
|
|
46
|
+
'/', (0, validate_incoming_request_data_1.validateIncomingRequestData)(generic_1.ISAFETransactionRuleSetAddSchema), async (req, res, next) => {
|
|
49
47
|
try {
|
|
50
48
|
return res.status(200).send({ successful: true });
|
|
51
49
|
}
|
|
@@ -70,7 +68,7 @@ router.get('/', async (req, res, next) => {
|
|
|
70
68
|
*/
|
|
71
69
|
router.get('/:rulesetsid', async (req, res, next) => {
|
|
72
70
|
try {
|
|
73
|
-
const rulesId = (0,
|
|
71
|
+
const rulesId = (0, generic_1.getParamRuleSetsId)(req); // get the rules id.
|
|
74
72
|
return res.status(200).send({ successful: true });
|
|
75
73
|
}
|
|
76
74
|
catch (err) {
|
|
@@ -82,7 +80,7 @@ router.get('/:rulesetsid', async (req, res, next) => {
|
|
|
82
80
|
*/
|
|
83
81
|
router.patch('/:rulesetsid', async (req, res, next) => {
|
|
84
82
|
try {
|
|
85
|
-
const rulesId = (0,
|
|
83
|
+
const rulesId = (0, generic_1.getParamRuleSetsId)(req); // get the rules id.
|
|
86
84
|
return res.status(200).send({ successful: true });
|
|
87
85
|
}
|
|
88
86
|
catch (err) {
|
|
@@ -94,7 +92,7 @@ router.patch('/:rulesetsid', async (req, res, next) => {
|
|
|
94
92
|
*/
|
|
95
93
|
router.delete('/:rulesetsid', async (req, res, next) => {
|
|
96
94
|
try {
|
|
97
|
-
const rulesId = (0,
|
|
95
|
+
const rulesId = (0, generic_1.getParamRuleSetsId)(req); // get the rules id.
|
|
98
96
|
return res.status(200).send({ successful: true });
|
|
99
97
|
}
|
|
100
98
|
catch (err) {
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,QAAQ,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
17
|
// This is the main file for the package
|
|
18
|
+
__exportStar(require("./cors"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@degenerate/endpoints",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
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.
|
|
42
|
+
"@degenerate/generic": "^0.1.12",
|
|
43
43
|
"express": "^4.21.1",
|
|
44
44
|
"zod": "^3.23.8"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "4e03fc84a8e12c1afb93df57e8da0bb02f932792"
|
|
47
47
|
}
|
|
@@ -1,278 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,63 +0,0 @@
|
|
|
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
|
|
@@ -1,44 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transactions.schema.d.ts","sourceRoot":"","sources":["../../src/schema/transactions.schema.ts"],"names":[],"mappings":"AAEA,OAAO,CAAC,MAAM,KAAK,CAAC;AAKpB,eAAO,MAAM,yBAAyB,oFAOpC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,+BAA+B,wCAI1C,CAAC;AAMH;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASrC,CAAC"}
|
|
@@ -1,41 +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.ISAFETransactionBaseSchema = exports.SAFETransactionActionTypeSchema = exports.SAFETransactionTypeSchema = void 0;
|
|
7
|
-
const zod_1 = __importDefault(require("zod"));
|
|
8
|
-
//#region Enums
|
|
9
|
-
// This is the schema for the authority data.
|
|
10
|
-
exports.SAFETransactionTypeSchema = zod_1.default.enum([
|
|
11
|
-
'AUTHORITY',
|
|
12
|
-
'SHAREDATA',
|
|
13
|
-
'FUNCTIONS',
|
|
14
|
-
'RULES',
|
|
15
|
-
'EVENTS',
|
|
16
|
-
'ENDPOINTS',
|
|
17
|
-
]);
|
|
18
|
-
/**
|
|
19
|
-
* This is the type of function that is being targetted in the transaction.
|
|
20
|
-
*/
|
|
21
|
-
exports.SAFETransactionActionTypeSchema = zod_1.default.enum([
|
|
22
|
-
'ADD',
|
|
23
|
-
'REMOVE',
|
|
24
|
-
'UPDATE',
|
|
25
|
-
]);
|
|
26
|
-
//#endregion Enums
|
|
27
|
-
//#region Transaction
|
|
28
|
-
/**
|
|
29
|
-
* This is the schema for the SAFE transaction base.
|
|
30
|
-
*/
|
|
31
|
-
exports.ISAFETransactionBaseSchema = zod_1.default.object({
|
|
32
|
-
createdAt: zod_1.default.number(), // the javascript timestamp of when the transaction was created
|
|
33
|
-
authority: zod_1.default.string(), // the public key of the authority that created the transaction
|
|
34
|
-
authoritySignature: zod_1.default.string(), // the signature of the authority that created the transaction
|
|
35
|
-
transaction: zod_1.default.object({
|
|
36
|
-
type: exports.SAFETransactionTypeSchema, // the type of transaction
|
|
37
|
-
action: exports.SAFETransactionActionTypeSchema, // the action to perform on the transaction
|
|
38
|
-
}),
|
|
39
|
-
version: zod_1.default.number(), // the version of the transaction
|
|
40
|
-
});
|
|
41
|
-
//#endregion Transaction
|