@degenerate/endpoints 0.7.0 → 0.7.1

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.
@@ -0,0 +1,31 @@
1
+ import { LibraryTransport } from '@degenerate/generic';
2
+ /**
3
+ * Minimal fetch shape, so this transport needs neither the DOM lib nor a
4
+ * runtime dependency — any `fetch`-compatible function works (the Node 22+
5
+ * global by default).
6
+ */
7
+ type FetchLike = (url: string, init: {
8
+ method: string;
9
+ headers: Record<string, string>;
10
+ body: string;
11
+ }) => Promise<{
12
+ ok: boolean;
13
+ status: number;
14
+ json(): Promise<unknown>;
15
+ }>;
16
+ export interface HttpLibraryTransportOptions {
17
+ /** Extra headers (e.g. `Authorization`) sent with every request. */
18
+ headers?: Record<string, string>;
19
+ /** Override the fetch implementation (defaults to the global `fetch`). */
20
+ fetchImpl?: FetchLike;
21
+ }
22
+ /**
23
+ * A {@link LibraryTransport} that POSTs each request to a SAFE rules-server's
24
+ * `/library/v1` RPC endpoint. Compose with `createRemoteLibraryStore` (and
25
+ * `createCachingLibraryStore`) so a block resolves its rule references on
26
+ * demand over HTTP. Reads are re-verified client-side by the remote store, so
27
+ * the server stays a cache of proofs, never a trust anchor.
28
+ */
29
+ export declare const createHttpLibraryTransport: (baseUrl: string, options?: HttpLibraryTransportOptions) => LibraryTransport;
30
+ export {};
31
+ //# sourceMappingURL=http-library-transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-library-transport.d.ts","sourceRoot":"","sources":["../../src/clients/http-library-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA+C,MAAM,qBAAqB,CAAC;AAEpG;;;;GAIG;AACH,KAAK,SAAS,GAAG,CACb,GAAG,EAAE,MAAM,EACX,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,KACtE,OAAO,CAAC;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,CAAA;CAAE,CAAC,CAAC;AAExE,MAAM,WAAW,2BAA2B;IACxC,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,0EAA0E;IAC1E,SAAS,CAAC,EAAE,SAAS,CAAC;CACzB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,GACnC,SAAS,MAAM,EACf,UAAS,2BAAgC,KAC1C,gBA0BF,CAAC"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createHttpLibraryTransport = void 0;
4
+ /**
5
+ * A {@link LibraryTransport} that POSTs each request to a SAFE rules-server's
6
+ * `/library/v1` RPC endpoint. Compose with `createRemoteLibraryStore` (and
7
+ * `createCachingLibraryStore`) so a block resolves its rule references on
8
+ * demand over HTTP. Reads are re-verified client-side by the remote store, so
9
+ * the server stays a cache of proofs, never a trust anchor.
10
+ */
11
+ const createHttpLibraryTransport = (baseUrl, options = {}) => {
12
+ const doFetch = options.fetchImpl ?? globalThis.fetch;
13
+ const endpoint = `${baseUrl.replace(/\/+$/, '')}/library/v1`;
14
+ return {
15
+ async send(request) {
16
+ const res = await doFetch(endpoint, {
17
+ method: 'POST',
18
+ headers: { 'content-type': 'application/json', ...options.headers },
19
+ body: JSON.stringify(request),
20
+ });
21
+ if (!res.ok) {
22
+ // Non-2xx (malformed body, auth failure, …): surface as a library
23
+ // error the remote store turns into a thrown error.
24
+ let detail = `library server responded ${res.status}`;
25
+ try {
26
+ const body = (await res.json());
27
+ if (body?.error)
28
+ detail = String(body.error);
29
+ }
30
+ catch {
31
+ /* non-JSON body — keep the status-code message */
32
+ }
33
+ return { error: detail };
34
+ }
35
+ return (await res.json());
36
+ },
37
+ };
38
+ };
39
+ exports.createHttpLibraryTransport = createHttpLibraryTransport;
@@ -1 +1 @@
1
- {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/examples/express-server/app.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAAE,KAAK,OAAO,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAYzD,MAAM,WAAW,eAAe;IAC5B,GAAG,EAAE,OAAO,CAAC;IACb,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,gBAAgB,EAAE,gBAAgB,CAAC;CACtC;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,IAAI,eAAe,CA6B3C;;AAKD,wBAAmC"}
1
+ {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/examples/express-server/app.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAAE,KAAK,OAAO,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAczD,MAAM,WAAW,eAAe;IAC5B,GAAG,EAAE,OAAO,CAAC;IACb,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,gBAAgB,EAAE,gBAAgB,CAAC;CACtC;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,IAAI,eAAe,CAmC3C;;AAKD,wBAAmC"}
@@ -7,10 +7,12 @@ exports.createApp = createApp;
7
7
  const express_1 = __importDefault(require("express"));
8
8
  const generic_1 = require("@degenerate/generic");
9
9
  const sharedata_1 = require("@degenerate/sharedata");
10
+ const shareblock_1 = require("@degenerate/shareblock");
10
11
  //#region Route Imports
11
12
  const authorities_routes_1 = require("../../routes/authorities.routes");
12
13
  const events_routes_1 = require("../../routes/events.routes");
13
14
  const functions_routes_1 = require("../../routes/functions.routes");
15
+ const library_routes_1 = require("../../routes/library.routes");
14
16
  const rules_routes_1 = require("../../routes/rules.routes");
15
17
  const share_data_routes_1 = require("../../routes/share-data.routes");
16
18
  const validation_routes_1 = require("../../routes/validation.routes");
@@ -32,6 +34,11 @@ function createApp() {
32
34
  const shareDataManager = new sharedata_1.ShareDataManager();
33
35
  app.set('authorizedAuthorities', authorizedAuthorities);
34
36
  app.set('shareDataManager', shareDataManager);
37
+ // The rules server's backing store. The default self-seeding store
38
+ // materializes standard rules on demand as blocks register references, so
39
+ // the `/library` route can serve them with no explicit startup seeding; a
40
+ // real deployment would inject a DB-backed store seeded via `seedRuleLibrary`.
41
+ app.set('ruleLibraryStore', (0, shareblock_1.getDefaultRuleLibraryStore)());
35
42
  // Public, unauthenticated machine-readable API description. Generated once
36
43
  // from the same Zod schemas the routes validate against; no auth so tooling
37
44
  // (codegen, Swagger UI, contract tests) can fetch it freely.
@@ -42,6 +49,7 @@ function createApp() {
42
49
  app.use('/authorities', authorities_routes_1.authorities);
43
50
  app.use('/events', events_routes_1.events);
44
51
  app.use('/functions', functions_routes_1.functions);
52
+ app.use('/library', library_routes_1.library);
45
53
  app.use('/rules', rules_routes_1.rules);
46
54
  app.use('/share-data', share_data_routes_1.shareData);
47
55
  app.use('/validation', validation_routes_1.validation);
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './cors';
2
2
  export * from './openapi';
3
+ export * from './clients/http-library-transport';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,kCAAkC,CAAC"}
package/dist/index.js CHANGED
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  // This is the main file for the package
18
18
  __exportStar(require("./cors"), exports);
19
19
  __exportStar(require("./openapi"), exports);
20
+ __exportStar(require("./clients/http-library-transport"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"domain-schemas.d.ts","sourceRoot":"","sources":["../../src/openapi/domain-schemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAwB7B;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAqB5E,CAAC"}
1
+ {"version":3,"file":"domain-schemas.d.ts","sourceRoot":"","sources":["../../src/openapi/domain-schemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAyB7B;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAsB5E,CAAC"}
@@ -36,4 +36,5 @@ exports.domainComponentNames = [
36
36
  [generic_1.IShareRuleAppliedSchema, 'ShareRuleApplied'],
37
37
  [generic_1.IShareRuleSchema, 'ShareRule'],
38
38
  [generic_1.IConditionSchema, 'Condition'],
39
+ [generic_1.RemoteLibraryRequestSchema, 'RemoteLibraryRequest'],
39
40
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../src/openapi/operations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAQnD;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,mBAAmB,EAO3C,CAAC"}
1
+ {"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../src/openapi/operations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AASnD;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,mBAAmB,EAQ3C,CAAC"}
@@ -4,8 +4,9 @@ exports.operations = void 0;
4
4
  const v1_openapi_1 = require("../routes/authorities/v1.openapi");
5
5
  const v1_openapi_2 = require("../routes/events/v1.openapi");
6
6
  const v1_openapi_3 = require("../routes/functions/v1.openapi");
7
+ const v1_openapi_4 = require("../routes/library/v1.openapi");
7
8
  const rule_set_openapi_1 = require("../routes/rules/v1/rule-set.openapi");
8
- const v1_openapi_4 = require("../routes/sharedata/v1.openapi");
9
+ const v1_openapi_5 = require("../routes/sharedata/v1.openapi");
9
10
  const validate_rules_openapi_1 = require("../routes/validation/rules/validate-rules.openapi");
10
11
  /**
11
12
  * Every mounted SAFE HTTP operation, one descriptor each. This is the single
@@ -16,7 +17,8 @@ exports.operations = [
16
17
  ...v1_openapi_1.authorityOperations,
17
18
  ...v1_openapi_2.eventOperations,
18
19
  ...v1_openapi_3.functionOperations,
20
+ ...v1_openapi_4.libraryOperations,
19
21
  ...rule_set_openapi_1.ruleSetOperations,
20
- ...v1_openapi_4.shareDataOperations,
22
+ ...v1_openapi_5.shareDataOperations,
21
23
  ...validate_rules_openapi_1.validateRulesOperations,
22
24
  ];
@@ -1,6 +1,7 @@
1
1
  export * from './authorities.routes';
2
2
  export * from './events.routes';
3
3
  export * from './functions.routes';
4
+ export * from './library.routes';
4
5
  export * from './rules.routes';
5
6
  export * from './share-data.routes';
6
7
  export * from './validation.routes';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routes/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routes/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC"}
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./authorities.routes"), exports);
18
18
  __exportStar(require("./events.routes"), exports);
19
19
  __exportStar(require("./functions.routes"), exports);
20
+ __exportStar(require("./library.routes"), exports);
20
21
  __exportStar(require("./rules.routes"), exports);
21
22
  __exportStar(require("./share-data.routes"), exports);
22
23
  __exportStar(require("./validation.routes"), exports);
@@ -0,0 +1,9 @@
1
+ import type { OperationDescriptor } from '../../openapi/types';
2
+ /**
3
+ * The `/library` rules-server RPC operation — guarded by the RULES JWT
4
+ * audience. The body is a {@link RemoteLibraryRequest} (discriminated by `op`);
5
+ * the response carries the matching library result (entity / version / exists /
6
+ * entities) or an `error`.
7
+ */
8
+ export declare const libraryOperations: OperationDescriptor[];
9
+ //# sourceMappingURL=v1.openapi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v1.openapi.d.ts","sourceRoot":"","sources":["../../../src/routes/library/v1.openapi.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG/D;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,mBAAmB,EAclD,CAAC"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.libraryOperations = void 0;
4
+ const generic_1 = require("@degenerate/generic");
5
+ const response_schemas_1 = require("../../openapi/response-schemas");
6
+ /**
7
+ * The `/library` rules-server RPC operation — guarded by the RULES JWT
8
+ * audience. The body is a {@link RemoteLibraryRequest} (discriminated by `op`);
9
+ * the response carries the matching library result (entity / version / exists /
10
+ * entities) or an `error`.
11
+ */
12
+ exports.libraryOperations = [
13
+ {
14
+ method: 'post',
15
+ path: '/library/v1',
16
+ security: generic_1.AuthorizationAudience.RULES,
17
+ summary: 'Rules-server RPC. Resolve, list, save, or delete signed library entities (rules/functions) so a block ' +
18
+ 'can load its references on demand. Body is a RemoteLibraryRequest discriminated by `op`.',
19
+ request: generic_1.RemoteLibraryRequestSchema,
20
+ response: {
21
+ 200: response_schemas_1.SuccessResponseSchema,
22
+ 400: response_schemas_1.ErrorResponseSchema,
23
+ },
24
+ },
25
+ ];
@@ -0,0 +1,2 @@
1
+ export declare const v1: import("express-serve-static-core").Router;
2
+ //# sourceMappingURL=v1.routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v1.routes.d.ts","sourceRoot":"","sources":["../../../src/routes/library/v1.routes.ts"],"names":[],"mappings":"AA4CA,eAAO,MAAM,EAAE,4CAAS,CAAC"}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
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
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.v1 = void 0;
37
+ //#region Package Imports
38
+ const express = __importStar(require("express"));
39
+ const generic_1 = require("@degenerate/generic");
40
+ //#endregion Package Imports
41
+ //#region Middleware Protections
42
+ const add_unique_tracking_1 = require("../../cors/logging/add-unique-tracking");
43
+ //#endregion Middleware Protections
44
+ // eslint-disable-next-line new-cap
45
+ const router = express.Router({ mergeParams: true });
46
+ router.use(add_unique_tracking_1.addUniqueTracking); // add the unique tracking id to the request
47
+ /**
48
+ * Rules-server RPC endpoint. The transport-agnostic {@link createLibraryServer}
49
+ * is exposed over HTTP here: the body is a {@link RemoteLibraryRequest}, served
50
+ * from the app's backing `ruleLibraryStore`. A client wires a
51
+ * `createRemoteLibraryStore` transport to POST here so a block resolves its
52
+ * rule references on demand. Reads re-verify on the client side — the server is
53
+ * a cache of proofs, never a trust anchor.
54
+ *
55
+ * POST https://{hostname}/library/v1
56
+ */
57
+ router.post('/', async (req, res, next) => {
58
+ try {
59
+ const parsed = generic_1.RemoteLibraryRequestSchema.safeParse(req.body);
60
+ if (!parsed.success) {
61
+ res.status(400).json({ error: 'invalid library request', issues: parsed.error.issues });
62
+ return;
63
+ }
64
+ const store = req.app.get('ruleLibraryStore');
65
+ const response = await (0, generic_1.createLibraryServer)(store).handle(parsed.data);
66
+ res.status(200).json(response);
67
+ }
68
+ catch (err) {
69
+ next(err);
70
+ }
71
+ });
72
+ exports.v1 = router; // https://{hostname}/library/v1
@@ -0,0 +1,2 @@
1
+ export declare const library: import("express-serve-static-core").Router;
2
+ //# sourceMappingURL=library.routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"library.routes.d.ts","sourceRoot":"","sources":["../../src/routes/library.routes.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,OAAO,4CAAS,CAAC"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
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
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.library = void 0;
37
+ const express = __importStar(require("express"));
38
+ const get_set_audiences_1 = require("./../cors/authority/audience/get-set-audiences");
39
+ const request_logging_1 = require("./../cors/logging/request-logging");
40
+ const validate_jwt_rules_1 = require("./../cors/authority/jwt/validate-jwt-rules");
41
+ const v1_routes_1 = require("./library/v1.routes");
42
+ // The rules-server HTTP surface: serves signed, content-addressed library
43
+ // entities (rules/functions) so a block can resolve its references on demand.
44
+ // Guarded by the same RULES authority as the rule routes.
45
+ // eslint-disable-next-line new-cap
46
+ const router = express.Router({ mergeParams: true });
47
+ router.use(request_logging_1.requestLogging); // log the request
48
+ router.use(get_set_audiences_1.setAudienceRules); // set the audience to rules (throws if not set)
49
+ router.use(validate_jwt_rules_1.validateJWTRules); // make sure the rules authority is valid
50
+ router.use('/v1', v1_routes_1.v1);
51
+ exports.library = router;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@degenerate/endpoints",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
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.7.0",
54
- "@degenerate/realtime": "^0.7.0",
55
- "@degenerate/shareblock": "^0.7.0",
56
- "@degenerate/sharedata": "^0.7.0",
53
+ "@degenerate/generic": "^0.7.1",
54
+ "@degenerate/realtime": "^0.7.1",
55
+ "@degenerate/shareblock": "^0.7.1",
56
+ "@degenerate/sharedata": "^0.7.1",
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": "1f747e160c9022863c7b2d7b8a6a157f204be95b",
62
+ "gitHead": "5e9a8b3f1d17f6913ccac216ca1a64ad30c30ee5",
63
63
  "engines": {
64
64
  "node": ">=22"
65
65
  }