@degenerate/endpoints 0.2.0 → 0.4.0
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 +18 -0
- package/dist/examples/express-server/app.d.ts.map +1 -1
- package/dist/examples/express-server/app.js +8 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/openapi/build-openapi-document.d.ts +27 -0
- package/dist/openapi/build-openapi-document.d.ts.map +1 -0
- package/dist/openapi/build-openapi-document.js +223 -0
- package/dist/openapi/domain-schemas.d.ts +16 -0
- package/dist/openapi/domain-schemas.d.ts.map +1 -0
- package/dist/openapi/domain-schemas.js +39 -0
- package/dist/openapi/index.d.ts +6 -0
- package/dist/openapi/index.d.ts.map +1 -0
- package/dist/openapi/index.js +21 -0
- package/dist/openapi/operations.d.ts +8 -0
- package/dist/openapi/operations.d.ts.map +1 -0
- package/dist/openapi/operations.js +22 -0
- package/dist/openapi/response-schemas.d.ts +32 -0
- package/dist/openapi/response-schemas.d.ts.map +1 -0
- package/dist/openapi/response-schemas.js +30 -0
- package/dist/openapi/types.d.ts +29 -0
- package/dist/openapi/types.d.ts.map +1 -0
- package/dist/openapi/types.js +2 -0
- package/dist/routes/authorities/v1.openapi.d.ts +4 -0
- package/dist/routes/authorities/v1.openapi.d.ts.map +1 -0
- package/dist/routes/authorities/v1.openapi.js +68 -0
- package/dist/routes/events/v1.openapi.d.ts +4 -0
- package/dist/routes/events/v1.openapi.d.ts.map +1 -0
- package/dist/routes/events/v1.openapi.js +54 -0
- package/dist/routes/events.routes.d.ts.map +1 -1
- package/dist/routes/events.routes.js +10 -60
- package/dist/routes/functions/v1.openapi.d.ts +4 -0
- package/dist/routes/functions/v1.openapi.d.ts.map +1 -0
- package/dist/routes/functions/v1.openapi.js +68 -0
- package/dist/routes/functions.routes.d.ts.map +1 -1
- package/dist/routes/functions.routes.js +10 -60
- package/dist/routes/rules/v1/rule-set.openapi.d.ts +4 -0
- package/dist/routes/rules/v1/rule-set.openapi.d.ts.map +1 -0
- package/dist/routes/rules/v1/rule-set.openapi.js +72 -0
- package/dist/routes/sharedata/v1.openapi.d.ts +8 -0
- package/dist/routes/sharedata/v1.openapi.d.ts.map +1 -0
- package/dist/routes/sharedata/v1.openapi.js +60 -0
- package/dist/routes/sharedata/v1.routes.d.ts.map +1 -1
- package/dist/routes/sharedata/v1.routes.js +13 -0
- package/dist/routes/validation/rules/validate-rules.openapi.d.ts +8 -0
- package/dist/routes/validation/rules/validate-rules.openapi.d.ts.map +1 -0
- package/dist/routes/validation/rules/validate-rules.openapi.js +76 -0
- package/package.json +6 -6
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.eventOperations = void 0;
|
|
4
|
+
const generic_1 = require("@degenerate/generic");
|
|
5
|
+
const response_schemas_1 = require("../../openapi/response-schemas");
|
|
6
|
+
/** Operations under `/events` — all gated by the EVENTS JWT audience. */
|
|
7
|
+
exports.eventOperations = [
|
|
8
|
+
{
|
|
9
|
+
method: 'post',
|
|
10
|
+
path: '/events/v1',
|
|
11
|
+
security: generic_1.AuthorizationAudience.EVENTS,
|
|
12
|
+
summary: 'Create an event.',
|
|
13
|
+
request: generic_1.ISAFETransactionEventAddSchema,
|
|
14
|
+
response: {
|
|
15
|
+
200: response_schemas_1.SuccessResponseSchema,
|
|
16
|
+
400: response_schemas_1.ErrorResponseSchema,
|
|
17
|
+
403: response_schemas_1.ErrorResponseSchema,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
method: 'get',
|
|
22
|
+
path: '/events/v1',
|
|
23
|
+
security: generic_1.AuthorizationAudience.EVENTS,
|
|
24
|
+
summary: 'Get events.',
|
|
25
|
+
response: {
|
|
26
|
+
200: response_schemas_1.SuccessResponseSchema,
|
|
27
|
+
403: response_schemas_1.ErrorResponseSchema,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
method: 'patch',
|
|
32
|
+
path: '/events/v1',
|
|
33
|
+
security: generic_1.AuthorizationAudience.EVENTS,
|
|
34
|
+
summary: 'Update an event.',
|
|
35
|
+
request: generic_1.ISAFETransactionEventUpdateSchema,
|
|
36
|
+
response: {
|
|
37
|
+
200: response_schemas_1.SuccessResponseSchema,
|
|
38
|
+
400: response_schemas_1.ErrorResponseSchema,
|
|
39
|
+
403: response_schemas_1.ErrorResponseSchema,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
method: 'delete',
|
|
44
|
+
path: '/events/v1',
|
|
45
|
+
security: generic_1.AuthorizationAudience.EVENTS,
|
|
46
|
+
summary: 'Delete an event.',
|
|
47
|
+
request: generic_1.ISAFETransactionEventDeleteSchema,
|
|
48
|
+
response: {
|
|
49
|
+
200: response_schemas_1.SuccessResponseSchema,
|
|
50
|
+
400: response_schemas_1.ErrorResponseSchema,
|
|
51
|
+
403: response_schemas_1.ErrorResponseSchema,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.routes.d.ts","sourceRoot":"","sources":["../../src/routes/events.routes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"events.routes.d.ts","sourceRoot":"","sources":["../../src/routes/events.routes.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,MAAM,4CAAS,CAAC"}
|
|
@@ -1,66 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
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 () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
35
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
6
|
exports.events = void 0;
|
|
37
|
-
const
|
|
7
|
+
const express_1 = __importDefault(require("express"));
|
|
38
8
|
const get_set_audiences_1 = require("../cors/authority/audience/get-set-audiences");
|
|
9
|
+
const request_logging_1 = require("../cors/logging/request-logging");
|
|
10
|
+
const v1_routes_1 = require("./events/v1.routes");
|
|
39
11
|
// eslint-disable-next-line new-cap
|
|
40
|
-
const router =
|
|
41
|
-
router.use(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
*/
|
|
45
|
-
router.post('/', async (req, res) => {
|
|
46
|
-
return res.status(200).send({ successful: true });
|
|
47
|
-
});
|
|
48
|
-
/**
|
|
49
|
-
* This gets the event object.
|
|
50
|
-
*/
|
|
51
|
-
router.get('/', async (req, res) => {
|
|
52
|
-
return res.status(200).send({ successful: true });
|
|
53
|
-
});
|
|
54
|
-
/**
|
|
55
|
-
* This updates the event object.
|
|
56
|
-
*/
|
|
57
|
-
router.patch('/', async (req, res) => {
|
|
58
|
-
return res.status(200).send({ successful: true });
|
|
59
|
-
});
|
|
60
|
-
/**
|
|
61
|
-
* This deletes the event object.
|
|
62
|
-
*/
|
|
63
|
-
router.delete('/', async (req, res) => {
|
|
64
|
-
return res.status(200).send({ successful: true });
|
|
65
|
-
});
|
|
12
|
+
const router = express_1.default.Router({ mergeParams: true });
|
|
13
|
+
router.use(request_logging_1.requestLogging); // log the request
|
|
14
|
+
router.use(get_set_audiences_1.setAudienceEvents); // set the audience to events
|
|
15
|
+
router.use('/v1', v1_routes_1.v1); // JWT validation + handlers + error handlers live in v1
|
|
66
16
|
exports.events = router;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v1.openapi.d.ts","sourceRoot":"","sources":["../../../src/routes/functions/v1.openapi.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAW/D,+EAA+E;AAC/E,eAAO,MAAM,kBAAkB,EAAE,mBAAmB,EAyDnD,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.functionOperations = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const generic_1 = require("@degenerate/generic");
|
|
6
|
+
const response_schemas_1 = require("../../openapi/response-schemas");
|
|
7
|
+
const FunctionIdResponseSchema = (0, response_schemas_1.successEnvelope)({ functionId: zod_1.z.string() }).meta({
|
|
8
|
+
id: 'FunctionIdResponse',
|
|
9
|
+
});
|
|
10
|
+
/** Operations under `/functions` — all gated by the FUNCTIONS JWT audience. */
|
|
11
|
+
exports.functionOperations = [
|
|
12
|
+
{
|
|
13
|
+
method: 'post',
|
|
14
|
+
path: '/functions/v1',
|
|
15
|
+
security: generic_1.AuthorizationAudience.FUNCTIONS,
|
|
16
|
+
summary: 'Create a function.',
|
|
17
|
+
request: generic_1.ISAFETransactionFunctionAddSchema,
|
|
18
|
+
response: {
|
|
19
|
+
200: response_schemas_1.SuccessResponseSchema,
|
|
20
|
+
400: response_schemas_1.ErrorResponseSchema,
|
|
21
|
+
403: response_schemas_1.ErrorResponseSchema,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
method: 'get',
|
|
26
|
+
path: '/functions/v1',
|
|
27
|
+
security: generic_1.AuthorizationAudience.FUNCTIONS,
|
|
28
|
+
summary: 'List functions.',
|
|
29
|
+
response: {
|
|
30
|
+
200: response_schemas_1.SuccessResponseSchema,
|
|
31
|
+
403: response_schemas_1.ErrorResponseSchema,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
method: 'get',
|
|
36
|
+
path: '/functions/v1/{functionid}',
|
|
37
|
+
security: generic_1.AuthorizationAudience.FUNCTIONS,
|
|
38
|
+
summary: 'Get a function by id.',
|
|
39
|
+
response: {
|
|
40
|
+
200: FunctionIdResponseSchema,
|
|
41
|
+
403: response_schemas_1.ErrorResponseSchema,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
method: 'patch',
|
|
46
|
+
path: '/functions/v1/{functionid}',
|
|
47
|
+
security: generic_1.AuthorizationAudience.FUNCTIONS,
|
|
48
|
+
summary: 'Update a function by id.',
|
|
49
|
+
request: generic_1.ISAFETransactionFunctionUpdateSchema,
|
|
50
|
+
response: {
|
|
51
|
+
200: FunctionIdResponseSchema,
|
|
52
|
+
400: response_schemas_1.ErrorResponseSchema,
|
|
53
|
+
403: response_schemas_1.ErrorResponseSchema,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
method: 'delete',
|
|
58
|
+
path: '/functions/v1/{functionid}',
|
|
59
|
+
security: generic_1.AuthorizationAudience.FUNCTIONS,
|
|
60
|
+
summary: 'Delete a function by id.',
|
|
61
|
+
request: generic_1.ISAFETransactionFunctionDeleteSchema,
|
|
62
|
+
response: {
|
|
63
|
+
200: FunctionIdResponseSchema,
|
|
64
|
+
400: response_schemas_1.ErrorResponseSchema,
|
|
65
|
+
403: response_schemas_1.ErrorResponseSchema,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.routes.d.ts","sourceRoot":"","sources":["../../src/routes/functions.routes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"functions.routes.d.ts","sourceRoot":"","sources":["../../src/routes/functions.routes.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,SAAS,4CAAS,CAAC"}
|
|
@@ -1,66 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
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 () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
35
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
6
|
exports.functions = void 0;
|
|
37
|
-
const
|
|
7
|
+
const express_1 = __importDefault(require("express"));
|
|
38
8
|
const get_set_audiences_1 = require("../cors/authority/audience/get-set-audiences");
|
|
9
|
+
const request_logging_1 = require("../cors/logging/request-logging");
|
|
10
|
+
const v1_routes_1 = require("./functions/v1.routes");
|
|
39
11
|
// eslint-disable-next-line new-cap
|
|
40
|
-
const router =
|
|
41
|
-
router.use(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
*/
|
|
45
|
-
router.post('/', async (req, res) => {
|
|
46
|
-
return res.status(200).send({ successful: true });
|
|
47
|
-
});
|
|
48
|
-
/**
|
|
49
|
-
* This gets the sharedata object.
|
|
50
|
-
*/
|
|
51
|
-
router.get('/', async (req, res) => {
|
|
52
|
-
return res.status(200).send({ successful: true });
|
|
53
|
-
});
|
|
54
|
-
/**
|
|
55
|
-
* This updates the sharedata object.
|
|
56
|
-
*/
|
|
57
|
-
router.patch('/', async (req, res) => {
|
|
58
|
-
return res.status(200).send({ successful: true });
|
|
59
|
-
});
|
|
60
|
-
/**
|
|
61
|
-
* This deletes the sharedata object.
|
|
62
|
-
*/
|
|
63
|
-
router.delete('/', async (req, res) => {
|
|
64
|
-
return res.status(200).send({ successful: true });
|
|
65
|
-
});
|
|
12
|
+
const router = express_1.default.Router({ mergeParams: true });
|
|
13
|
+
router.use(request_logging_1.requestLogging); // log the request
|
|
14
|
+
router.use(get_set_audiences_1.setAudienceFunctions); // set the audience to functions
|
|
15
|
+
router.use('/v1', v1_routes_1.v1); // JWT validation + handlers + error handlers live in v1
|
|
66
16
|
exports.functions = router;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rule-set.openapi.d.ts","sourceRoot":"","sources":["../../../../src/routes/rules/v1/rule-set.openapi.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAelE,oFAAoF;AACpF,eAAO,MAAM,iBAAiB,EAAE,mBAAmB,EAyDlD,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ruleSetOperations = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const generic_1 = require("@degenerate/generic");
|
|
6
|
+
const response_schemas_1 = require("../../../openapi/response-schemas");
|
|
7
|
+
const RuleSetListResponseSchema = (0, response_schemas_1.successEnvelope)({ ruleSets: zod_1.z.array(generic_1.IShareRuleSetSchema) }).meta({
|
|
8
|
+
id: 'RuleSetListResponse',
|
|
9
|
+
});
|
|
10
|
+
const RuleSetItemResponseSchema = (0, response_schemas_1.successEnvelope)({ ruleSet: generic_1.IShareRuleSetSchema.optional() }).meta({
|
|
11
|
+
id: 'RuleSetItemResponse',
|
|
12
|
+
});
|
|
13
|
+
const RulesIdResponseSchema = (0, response_schemas_1.successEnvelope)({ rulesId: zod_1.z.string() }).meta({ id: 'RulesIdResponse' });
|
|
14
|
+
/** Operations under `/rules/v1/rule-sets` — all gated by the RULES JWT audience. */
|
|
15
|
+
exports.ruleSetOperations = [
|
|
16
|
+
{
|
|
17
|
+
method: 'post',
|
|
18
|
+
path: '/rules/v1/rule-sets',
|
|
19
|
+
security: generic_1.AuthorizationAudience.RULES,
|
|
20
|
+
summary: 'Create a rule set.',
|
|
21
|
+
request: generic_1.ISAFETransactionRuleSetAddSchema,
|
|
22
|
+
response: {
|
|
23
|
+
200: response_schemas_1.SuccessResponseSchema,
|
|
24
|
+
400: response_schemas_1.ErrorResponseSchema,
|
|
25
|
+
403: response_schemas_1.ErrorResponseSchema,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
method: 'get',
|
|
30
|
+
path: '/rules/v1/rule-sets',
|
|
31
|
+
security: generic_1.AuthorizationAudience.RULES,
|
|
32
|
+
summary: 'List rule sets.',
|
|
33
|
+
response: {
|
|
34
|
+
200: RuleSetListResponseSchema,
|
|
35
|
+
403: response_schemas_1.ErrorResponseSchema,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
method: 'get',
|
|
40
|
+
path: '/rules/v1/rule-sets/{rulesetsid}',
|
|
41
|
+
security: generic_1.AuthorizationAudience.RULES,
|
|
42
|
+
summary: 'Get a rule set by id.',
|
|
43
|
+
response: {
|
|
44
|
+
200: RuleSetItemResponseSchema,
|
|
45
|
+
403: response_schemas_1.ErrorResponseSchema,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
method: 'patch',
|
|
50
|
+
path: '/rules/v1/rule-sets/{rulesetsid}',
|
|
51
|
+
security: generic_1.AuthorizationAudience.RULES,
|
|
52
|
+
summary: 'Update a rule set by id.',
|
|
53
|
+
request: generic_1.ISAFETransactionRuleSetUpdateSchema,
|
|
54
|
+
response: {
|
|
55
|
+
200: RulesIdResponseSchema,
|
|
56
|
+
400: response_schemas_1.ErrorResponseSchema,
|
|
57
|
+
403: response_schemas_1.ErrorResponseSchema,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
method: 'delete',
|
|
62
|
+
path: '/rules/v1/rule-sets/{rulesetsid}',
|
|
63
|
+
security: generic_1.AuthorizationAudience.RULES,
|
|
64
|
+
summary: 'Delete a rule set by id.',
|
|
65
|
+
request: generic_1.ISAFETransactionRuleSetDeleteSchema,
|
|
66
|
+
response: {
|
|
67
|
+
200: RulesIdResponseSchema,
|
|
68
|
+
400: response_schemas_1.ErrorResponseSchema,
|
|
69
|
+
403: response_schemas_1.ErrorResponseSchema,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { OperationDescriptor } from '../../openapi/types';
|
|
2
|
+
/**
|
|
3
|
+
* Operations under `/share-data` — gated by the SHAREDATA JWT audience, plus a
|
|
4
|
+
* per-resource (BOLA) check on create/delete: the verified token's
|
|
5
|
+
* `allowedSigningKeys` claim must vouch for the block's `creationPublicKey`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const shareDataOperations: OperationDescriptor[];
|
|
8
|
+
//# sourceMappingURL=v1.openapi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v1.openapi.d.ts","sourceRoot":"","sources":["../../../src/routes/sharedata/v1.openapi.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG/D;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,mBAAmB,EAiDpD,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shareDataOperations = void 0;
|
|
4
|
+
const generic_1 = require("@degenerate/generic");
|
|
5
|
+
const response_schemas_1 = require("../../openapi/response-schemas");
|
|
6
|
+
/**
|
|
7
|
+
* Operations under `/share-data` — gated by the SHAREDATA JWT audience, plus a
|
|
8
|
+
* per-resource (BOLA) check on create/delete: the verified token's
|
|
9
|
+
* `allowedSigningKeys` claim must vouch for the block's `creationPublicKey`.
|
|
10
|
+
*/
|
|
11
|
+
exports.shareDataOperations = [
|
|
12
|
+
{
|
|
13
|
+
method: 'post',
|
|
14
|
+
path: '/share-data/v1',
|
|
15
|
+
security: generic_1.AuthorizationAudience.SHAREDATA,
|
|
16
|
+
summary: 'Create a ShareData block. The JWT allowedSigningKeys claim must authorize the block creationPublicKey.',
|
|
17
|
+
request: generic_1.ISAFETransactionShareDataAddSchema,
|
|
18
|
+
response: {
|
|
19
|
+
200: response_schemas_1.SuccessResponseSchema,
|
|
20
|
+
400: response_schemas_1.ErrorResponseSchema,
|
|
21
|
+
403: response_schemas_1.ErrorResponseSchema,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
method: 'get',
|
|
26
|
+
path: '/share-data/v1',
|
|
27
|
+
security: generic_1.AuthorizationAudience.SHAREDATA,
|
|
28
|
+
summary: 'List ShareData blocks.',
|
|
29
|
+
response: {
|
|
30
|
+
200: response_schemas_1.SuccessResponseSchema,
|
|
31
|
+
403: response_schemas_1.ErrorResponseSchema,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
method: 'patch',
|
|
36
|
+
path: '/share-data/v1/{sharedataid}',
|
|
37
|
+
security: generic_1.AuthorizationAudience.SHAREDATA,
|
|
38
|
+
summary: 'Unsupported. ShareData mutations must go through the rule-engine-verified proposal path, never a wholesale state replacement. Always returns 501.',
|
|
39
|
+
request: generic_1.ISAFETransactionShareDataUpdateSchema,
|
|
40
|
+
deprecated: true,
|
|
41
|
+
response: {
|
|
42
|
+
400: response_schemas_1.ErrorResponseSchema,
|
|
43
|
+
403: response_schemas_1.ErrorResponseSchema,
|
|
44
|
+
501: response_schemas_1.ErrorResponseSchema,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
method: 'delete',
|
|
49
|
+
path: '/share-data/v1/{sharedataid}',
|
|
50
|
+
security: generic_1.AuthorizationAudience.SHAREDATA,
|
|
51
|
+
summary: 'Delete a ShareData block by id. The JWT must vouch for the stored block creationPublicKey (BOLA gate).',
|
|
52
|
+
request: generic_1.ISAFETransactionShareDataDeleteSchema,
|
|
53
|
+
response: {
|
|
54
|
+
200: response_schemas_1.SuccessResponseSchema,
|
|
55
|
+
400: response_schemas_1.ErrorResponseSchema,
|
|
56
|
+
403: response_schemas_1.ErrorResponseSchema,
|
|
57
|
+
404: response_schemas_1.ErrorResponseSchema,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v1.routes.d.ts","sourceRoot":"","sources":["../../../src/routes/sharedata/v1.routes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"v1.routes.d.ts","sourceRoot":"","sources":["../../../src/routes/sharedata/v1.routes.ts"],"names":[],"mappings":"AAwRA,eAAO,MAAM,EAAE,4CAAS,CAAC"}
|
|
@@ -143,6 +143,16 @@ router.post(// https://{hostname}/sharedata/v1
|
|
|
143
143
|
case generic_1.ShareBlockType.Distribution:
|
|
144
144
|
shareData = (0, shareblock_1.createDistributionShareBlock)(factoryArgs);
|
|
145
145
|
break;
|
|
146
|
+
case generic_1.ShareBlockType.GraceRepayment:
|
|
147
|
+
// Not creatable through this generic route: a GraceRepayment
|
|
148
|
+
// block's initialState needs grace-specific fields
|
|
149
|
+
// (outstandingPrincipalCents, per-lender graceDecision) that the
|
|
150
|
+
// shared create payload doesn't carry. Reject explicitly rather
|
|
151
|
+
// than mis-constructing one from a partial payload.
|
|
152
|
+
return res.status(400).send({
|
|
153
|
+
successful: false,
|
|
154
|
+
error: 'unsupported-block-type: GraceRepayment blocks are not created via this route',
|
|
155
|
+
});
|
|
146
156
|
default: {
|
|
147
157
|
// Exhaustiveness check — schema validation should prevent
|
|
148
158
|
// reaching this, but TS doesn't know that. A runtime fallback
|
|
@@ -176,6 +186,9 @@ const REQUIRED_PURPOSES_BY_BLOCK_TYPE = {
|
|
|
176
186
|
[generic_1.ShareBlockType.Clearing]: shareblock_1.CLEARING_REQUIRED_PROOF_PURPOSES,
|
|
177
187
|
[generic_1.ShareBlockType.Funding]: shareblock_1.FUNDING_REQUIRED_PROOF_PURPOSES,
|
|
178
188
|
[generic_1.ShareBlockType.Distribution]: shareblock_1.DISTRIBUTION_REQUIRED_PROOF_PURPOSES,
|
|
189
|
+
// Listed for type-completeness and to document the real proof set, even
|
|
190
|
+
// though the route currently rejects GraceRepayment creation above.
|
|
191
|
+
[generic_1.ShareBlockType.GraceRepayment]: shareblock_1.GRACE_REPAYMENT_REQUIRED_PROOF_PURPOSES,
|
|
179
192
|
};
|
|
180
193
|
/**
|
|
181
194
|
* This gets the sharedata objects and their data.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { OperationDescriptor } from '../../../openapi/types';
|
|
2
|
+
/**
|
|
3
|
+
* Operations under `/validation/v1/validate-rules` — public (no JWT). Each
|
|
4
|
+
* echoes `{ successful: true }` when the posted body parses against its domain
|
|
5
|
+
* schema, otherwise the shared 400 error envelope.
|
|
6
|
+
*/
|
|
7
|
+
export declare const validateRulesOperations: OperationDescriptor[];
|
|
8
|
+
//# sourceMappingURL=validate-rules.openapi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-rules.openapi.d.ts","sourceRoot":"","sources":["../../../../src/routes/validation/rules/validate-rules.openapi.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAGlE;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,mBAAmB,EAiExD,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateRulesOperations = void 0;
|
|
4
|
+
const generic_1 = require("@degenerate/generic");
|
|
5
|
+
const response_schemas_1 = require("../../../openapi/response-schemas");
|
|
6
|
+
/**
|
|
7
|
+
* Operations under `/validation/v1/validate-rules` — public (no JWT). Each
|
|
8
|
+
* echoes `{ successful: true }` when the posted body parses against its domain
|
|
9
|
+
* schema, otherwise the shared 400 error envelope.
|
|
10
|
+
*/
|
|
11
|
+
exports.validateRulesOperations = [
|
|
12
|
+
{
|
|
13
|
+
method: 'get',
|
|
14
|
+
path: '/validation',
|
|
15
|
+
security: 'public',
|
|
16
|
+
summary: 'Liveness probe for the validation service.',
|
|
17
|
+
response: {
|
|
18
|
+
200: response_schemas_1.SuccessResponseSchema,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
method: 'post',
|
|
23
|
+
path: '/validation/v1/validate-rules/rule-set',
|
|
24
|
+
security: 'public',
|
|
25
|
+
summary: 'Validate a rule set against its schema.',
|
|
26
|
+
request: generic_1.IShareRuleSetSchema,
|
|
27
|
+
response: {
|
|
28
|
+
200: response_schemas_1.SuccessResponseSchema,
|
|
29
|
+
400: response_schemas_1.ErrorResponseSchema,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
method: 'post',
|
|
34
|
+
path: '/validation/v1/validate-rules/rule-group',
|
|
35
|
+
security: 'public',
|
|
36
|
+
summary: 'Validate a rule group against its schema.',
|
|
37
|
+
request: generic_1.IShareRuleGroupSchema,
|
|
38
|
+
response: {
|
|
39
|
+
200: response_schemas_1.SuccessResponseSchema,
|
|
40
|
+
400: response_schemas_1.ErrorResponseSchema,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
method: 'post',
|
|
45
|
+
path: '/validation/v1/validate-rules/rule-applied',
|
|
46
|
+
security: 'public',
|
|
47
|
+
summary: 'Validate an applied rule against its schema.',
|
|
48
|
+
request: generic_1.IShareRuleAppliedSchema,
|
|
49
|
+
response: {
|
|
50
|
+
200: response_schemas_1.SuccessResponseSchema,
|
|
51
|
+
400: response_schemas_1.ErrorResponseSchema,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
method: 'post',
|
|
56
|
+
path: '/validation/v1/validate-rules/rule',
|
|
57
|
+
security: 'public',
|
|
58
|
+
summary: 'Validate a rule against its schema.',
|
|
59
|
+
request: generic_1.IShareRuleSchema,
|
|
60
|
+
response: {
|
|
61
|
+
200: response_schemas_1.SuccessResponseSchema,
|
|
62
|
+
400: response_schemas_1.ErrorResponseSchema,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
method: 'post',
|
|
67
|
+
path: '/validation/v1/validate-rules/condition',
|
|
68
|
+
security: 'public',
|
|
69
|
+
summary: 'Validate a condition against its schema.',
|
|
70
|
+
request: generic_1.IConditionSchema,
|
|
71
|
+
response: {
|
|
72
|
+
200: response_schemas_1.SuccessResponseSchema,
|
|
73
|
+
400: response_schemas_1.ErrorResponseSchema,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@degenerate/endpoints",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "This contains the ShareData Adaptive Framework Ecosystem (SAFE) network endpoint code",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -50,16 +50,16 @@
|
|
|
50
50
|
"author": "Degenerate Inc.",
|
|
51
51
|
"license": "ISC",
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@degenerate/generic": "^0.
|
|
54
|
-
"@degenerate/realtime": "^0.
|
|
55
|
-
"@degenerate/shareblock": "^0.
|
|
56
|
-
"@degenerate/sharedata": "^0.
|
|
53
|
+
"@degenerate/generic": "^0.4.0",
|
|
54
|
+
"@degenerate/realtime": "^0.4.0",
|
|
55
|
+
"@degenerate/shareblock": "^0.4.0",
|
|
56
|
+
"@degenerate/sharedata": "^0.4.0",
|
|
57
57
|
"@types/supertest": "^6.0.3",
|
|
58
58
|
"express": "^5.2.1",
|
|
59
59
|
"supertest": "^7.2.2",
|
|
60
60
|
"zod": "^4.4.3"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "9453d9ab785e03fd01eb5b408ed0e3ca22baefd5",
|
|
63
63
|
"engines": {
|
|
64
64
|
"node": ">=22"
|
|
65
65
|
}
|