@toa.io/extensions.introspection 1.0.0-alpha.259
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/LICENSE +22 -0
- package/components/introspection.edges/manifest.toa.yaml +48 -0
- package/components/introspection.edges/operations/lib/types.d.ts +28 -0
- package/components/introspection.edges/operations/lib/types.js +3 -0
- package/components/introspection.edges/operations/lib/types.js.map +1 -0
- package/components/introspection.edges/operations/merge.d.ts +9 -0
- package/components/introspection.edges/operations/merge.js +25 -0
- package/components/introspection.edges/operations/merge.js.map +1 -0
- package/components/introspection.edges/operations/tsconfig.tsbuildinfo +1 -0
- package/components/introspection.edges/source/lib/types.ts +33 -0
- package/components/introspection.edges/source/merge.ts +26 -0
- package/components/introspection.edges/tsconfig.json +9 -0
- package/components/introspection.nodes/manifest.toa.yaml +49 -0
- package/components/introspection.nodes/operations/lib/types.d.ts +16 -0
- package/components/introspection.nodes/operations/lib/types.js +3 -0
- package/components/introspection.nodes/operations/lib/types.js.map +1 -0
- package/components/introspection.nodes/operations/merge.d.ts +9 -0
- package/components/introspection.nodes/operations/merge.js +21 -0
- package/components/introspection.nodes/operations/merge.js.map +1 -0
- package/components/introspection.nodes/operations/tsconfig.tsbuildinfo +1 -0
- package/components/introspection.nodes/source/lib/types.ts +18 -0
- package/components/introspection.nodes/source/merge.ts +21 -0
- package/components/introspection.nodes/tsconfig.json +9 -0
- package/cucumber.js +8 -0
- package/features/calls.feature +123 -0
- package/features/nodes.feature +70 -0
- package/features/samples.feature +75 -0
- package/features/shutdown.feature +37 -0
- package/features/site/_app/immutable/asset.js +1 -0
- package/features/site/index.html +6 -0
- package/features/steps/Map.ts +151 -0
- package/features/steps/UI.ts +88 -0
- package/features/steps/components/probe.discreet/manifest.toa.yaml +12 -0
- package/features/steps/components/probe.discreet/operations/ping.js +7 -0
- package/features/steps/components/probe.quiet/manifest.toa.yaml +11 -0
- package/features/steps/components/probe.quiet/operations/ping.js +7 -0
- package/features/steps/components/probe.source/manifest.toa.yaml +27 -0
- package/features/steps/components/probe.source/operations/crash.js +7 -0
- package/features/steps/components/probe.source/operations/fail.js +12 -0
- package/features/steps/components/probe.source/operations/relay.js +7 -0
- package/features/steps/components/probe.target/manifest.toa.yaml +24 -0
- package/features/steps/components/probe.target/operations/compute.js +7 -0
- package/features/steps/components/probe.target/operations/count.js +9 -0
- package/features/steps/config.ts +20 -0
- package/features/steps/tsconfig.json +9 -0
- package/features/ui.feature +85 -0
- package/package.json +32 -0
- package/readme.md +135 -0
- package/schemas/annotation.cos.yaml +21 -0
- package/schemas/declaration.cos.yaml +2 -0
- package/source/Composition.ts +61 -0
- package/source/Explorer.ts +16 -0
- package/source/Factory.ts +119 -0
- package/source/Reporter.ts +210 -0
- package/source/Tenant.ts +47 -0
- package/source/UI.ts +197 -0
- package/source/annotation.ts +83 -0
- package/source/const.ts +32 -0
- package/source/describe.ts +68 -0
- package/source/extension.ts +45 -0
- package/source/index.ts +7 -0
- package/source/keys.ts +0 -0
- package/source/manifest.ts +19 -0
- package/source/model.ts +82 -0
- package/source/sample.ts +49 -0
- package/source/schemas.ts +10 -0
- package/transpiled/Composition.d.ts +21 -0
- package/transpiled/Composition.js +48 -0
- package/transpiled/Composition.js.map +1 -0
- package/transpiled/Explorer.d.ts +9 -0
- package/transpiled/Explorer.js +19 -0
- package/transpiled/Explorer.js.map +1 -0
- package/transpiled/Factory.d.ts +22 -0
- package/transpiled/Factory.js +93 -0
- package/transpiled/Factory.js.map +1 -0
- package/transpiled/Reporter.d.ts +44 -0
- package/transpiled/Reporter.js +187 -0
- package/transpiled/Reporter.js.map +1 -0
- package/transpiled/Tenant.d.ts +18 -0
- package/transpiled/Tenant.js +40 -0
- package/transpiled/Tenant.js.map +1 -0
- package/transpiled/UI.d.ts +25 -0
- package/transpiled/UI.js +186 -0
- package/transpiled/UI.js.map +1 -0
- package/transpiled/annotation.d.ts +40 -0
- package/transpiled/annotation.js +46 -0
- package/transpiled/annotation.js.map +1 -0
- package/transpiled/const.d.ts +23 -0
- package/transpiled/const.js +27 -0
- package/transpiled/const.js.map +1 -0
- package/transpiled/describe.d.ts +9 -0
- package/transpiled/describe.js +64 -0
- package/transpiled/describe.js.map +1 -0
- package/transpiled/extension.d.ts +11 -0
- package/transpiled/extension.js +64 -0
- package/transpiled/extension.js.map +1 -0
- package/transpiled/index.d.ts +6 -0
- package/transpiled/index.js +25 -0
- package/transpiled/index.js.map +1 -0
- package/transpiled/keys.d.ts +9 -0
- package/transpiled/keys.js +0 -0
- package/transpiled/keys.js.map +1 -0
- package/transpiled/manifest.d.ts +9 -0
- package/transpiled/manifest.js +43 -0
- package/transpiled/manifest.js.map +1 -0
- package/transpiled/model.d.ts +71 -0
- package/transpiled/model.js +3 -0
- package/transpiled/model.js.map +1 -0
- package/transpiled/sample.d.ts +7 -0
- package/transpiled/sample.js +44 -0
- package/transpiled/sample.js.map +1 -0
- package/transpiled/schemas.d.ts +4 -0
- package/transpiled/schemas.js +13 -0
- package/transpiled/schemas.js.map +1 -0
- package/transpiled/tsconfig.tsbuildinfo +1 -0
- package/tsconfig.json +12 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SAMPLE_LIMIT = exports.REDACTED = exports.DENIED = exports.MAX_EDGES = exports.ANNOUNCE_INTERVAL = exports.DEFAULT_THRESHOLD = exports.DEFAULT_INTERVAL = exports.UI_PORT = exports.UI_PATH = exports.EDGES = exports.NODES = exports.ENV = exports.NAMESPACE = exports.ID = void 0;
|
|
4
|
+
exports.ID = 'introspection';
|
|
5
|
+
exports.NAMESPACE = 'introspection';
|
|
6
|
+
exports.ENV = 'TOA_INTROSPECTION';
|
|
7
|
+
exports.NODES = 'nodes';
|
|
8
|
+
exports.EDGES = 'edges';
|
|
9
|
+
/** Where the UI is mounted; `/introspection/*` belongs to the components' own API. */
|
|
10
|
+
exports.UI_PATH = '/.introspection';
|
|
11
|
+
exports.UI_PORT = 8002;
|
|
12
|
+
exports.DEFAULT_INTERVAL = 300;
|
|
13
|
+
exports.DEFAULT_THRESHOLD = 1024;
|
|
14
|
+
/** How often a component re-announces its description, so that removed components fade out. */
|
|
15
|
+
exports.ANNOUNCE_INTERVAL = 1_800_000;
|
|
16
|
+
/**
|
|
17
|
+
* `source` arrives over the wire, so the number of distinct edges a process
|
|
18
|
+
* can hold must be bounded regardless of what peers send.
|
|
19
|
+
*/
|
|
20
|
+
exports.MAX_EDGES = 4096;
|
|
21
|
+
/** Never capture samples for these namespaces, whatever the annotation says. */
|
|
22
|
+
exports.DENIED = new Set(['identity', 'introspection']);
|
|
23
|
+
/** Keys never stored in a sample, even when sampling is on. */
|
|
24
|
+
exports.REDACTED = /^(password|secret|token|credentials?|key|authorization|cookie)$/i;
|
|
25
|
+
/** Serialized size cap of a single sample. */
|
|
26
|
+
exports.SAMPLE_LIMIT = 4096;
|
|
27
|
+
//# sourceMappingURL=const.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"const.js","sourceRoot":"","sources":["../source/const.ts"],"names":[],"mappings":";;;AAAa,QAAA,EAAE,GAAG,eAAe,CAAA;AACpB,QAAA,SAAS,GAAG,eAAe,CAAA;AAE3B,QAAA,GAAG,GAAG,mBAAmB,CAAA;AAEzB,QAAA,KAAK,GAAG,OAAO,CAAA;AACf,QAAA,KAAK,GAAG,OAAO,CAAA;AAE5B,sFAAsF;AACzE,QAAA,OAAO,GAAG,iBAAiB,CAAA;AAC3B,QAAA,OAAO,GAAG,IAAI,CAAA;AAEd,QAAA,gBAAgB,GAAG,GAAG,CAAA;AACtB,QAAA,iBAAiB,GAAG,IAAI,CAAA;AAErC,+FAA+F;AAClF,QAAA,iBAAiB,GAAG,SAAS,CAAA;AAE1C;;;GAGG;AACU,QAAA,SAAS,GAAG,IAAI,CAAA;AAE7B,gFAAgF;AACnE,QAAA,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC,CAAA;AAE5D,+DAA+D;AAClD,QAAA,QAAQ,GAAG,kEAAkE,CAAA;AAE1F,8CAA8C;AACjC,QAAA,YAAY,GAAG,IAAI,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Node } from './model';
|
|
2
|
+
import type { Manifest } from '@toa.io/norm';
|
|
3
|
+
/**
|
|
4
|
+
* Turns a normalized component manifest into the node of the map.
|
|
5
|
+
*
|
|
6
|
+
* Everything here is already expanded by norm: concise schemas are resolved and
|
|
7
|
+
* the prototype chain is collapsed, so this is the shape the runtime actually runs.
|
|
8
|
+
*/
|
|
9
|
+
export declare function describe(manifest: Manifest): Node;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.describe = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Turns a normalized component manifest into the node of the map.
|
|
6
|
+
*
|
|
7
|
+
* Everything here is already expanded by norm: concise schemas are resolved and
|
|
8
|
+
* the prototype chain is collapsed, so this is the shape the runtime actually runs.
|
|
9
|
+
*/
|
|
10
|
+
function describe(manifest) {
|
|
11
|
+
return {
|
|
12
|
+
namespace: manifest.namespace,
|
|
13
|
+
component: manifest.name,
|
|
14
|
+
version: manifest.version,
|
|
15
|
+
entity: entity(manifest),
|
|
16
|
+
operations: operations(manifest),
|
|
17
|
+
events: events(manifest),
|
|
18
|
+
receivers: receivers(manifest),
|
|
19
|
+
// names only: extension declarations carry configuration and secrets
|
|
20
|
+
extensions: Object.keys(manifest.extensions ?? {})
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
exports.describe = describe;
|
|
24
|
+
function entity(manifest) {
|
|
25
|
+
if (manifest.entity === undefined)
|
|
26
|
+
return null;
|
|
27
|
+
return {
|
|
28
|
+
schema: manifest.entity.schema,
|
|
29
|
+
storage: manifest.entity.storage,
|
|
30
|
+
associated: manifest.entity.associated === true
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function operations(manifest) {
|
|
34
|
+
return Object.entries(manifest.operations ?? {})
|
|
35
|
+
.map(([endpoint, definition]) => ({
|
|
36
|
+
endpoint,
|
|
37
|
+
type: definition.type,
|
|
38
|
+
scope: definition.scope,
|
|
39
|
+
query: definition.query,
|
|
40
|
+
input: definition.input ?? null,
|
|
41
|
+
output: definition.output ?? null,
|
|
42
|
+
errors: definition.errors ?? []
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
function events(manifest) {
|
|
46
|
+
return Object.entries(manifest.events ?? {})
|
|
47
|
+
.map(([label, definition]) => ({ label, binding: definition.binding }));
|
|
48
|
+
}
|
|
49
|
+
/*
|
|
50
|
+
* Receiver labels contain dots (`identity.bans.created`), which is why nodes keep
|
|
51
|
+
* these as arrays rather than maps — a dot in a document key is a hazard in Mongo.
|
|
52
|
+
*/
|
|
53
|
+
function receivers(manifest) {
|
|
54
|
+
return Object.entries(manifest.receivers ?? {})
|
|
55
|
+
.map(([label, definition]) => ({
|
|
56
|
+
label,
|
|
57
|
+
source: definition.source ?? label.split('.').slice(0, 2).join('.'),
|
|
58
|
+
event: label.split('.').pop(),
|
|
59
|
+
operation: definition.operation,
|
|
60
|
+
conditioned: definition.conditioned === true,
|
|
61
|
+
adaptive: definition.adaptive === true
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=describe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../source/describe.ts"],"names":[],"mappings":";;;AAGA;;;;;GAKG;AACH,SAAgB,QAAQ,CAAE,QAAkB;IAC1C,OAAO;QACL,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,SAAS,EAAE,QAAQ,CAAC,IAAI;QACxB,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC;QACxB,UAAU,EAAE,UAAU,CAAC,QAAQ,CAAC;QAChC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC;QACxB,SAAS,EAAE,SAAS,CAAC,QAAQ,CAAC;QAE9B,qEAAqE;QACrE,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,IAAI,EAAE,CAAC;KACnD,CAAA;AACH,CAAC;AAbD,4BAaC;AAED,SAAS,MAAM,CAAE,QAAkB;IACjC,IAAI,QAAQ,CAAC,MAAM,KAAK,SAAS;QAC/B,OAAO,IAAI,CAAA;IAEb,OAAO;QACL,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM;QAC9B,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO;QAChC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,KAAK,IAAI;KAChD,CAAA;AACH,CAAC;AAED,SAAS,UAAU,CAAE,QAAkB;IACrC,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,IAAI,EAAE,CAAC;SAC7C,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,UAAU,CAAgB,EAAE,EAAE,CAAC,CAAC;QAC/C,QAAQ;QACR,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,IAAI;QAC/B,MAAM,EAAE,UAAU,CAAC,MAAM,IAAI,IAAI;QACjC,MAAM,EAAE,UAAU,CAAC,MAAM,IAAI,EAAE;KAChC,CAAC,CAAC,CAAA;AACP,CAAC;AAED,SAAS,MAAM,CAAE,QAAkB;IACjC,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,IAAI,EAAE,CAAC;SACzC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,UAAU,CAAgB,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;AAC1F,CAAC;AAED;;;GAGG;AACH,SAAS,SAAS,CAAE,QAAkB;IACpC,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,IAAI,EAAE,CAAC;SAC5C,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,UAAU,CAAgB,EAAE,EAAE,CAAC,CAAC;QAC5C,KAAK;QACL,MAAM,EAAE,UAAU,CAAC,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;QACnE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAG;QAC9B,SAAS,EAAE,UAAU,CAAC,SAAS;QAC/B,WAAW,EAAE,UAAU,CAAC,WAAW,KAAK,IAAI;QAC5C,QAAQ,EAAE,UAAU,CAAC,QAAQ,KAAK,IAAI;KACvC,CAAC,CAAC,CAAA;AACP,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Annotation } from './annotation';
|
|
2
|
+
import type { Dependency, Instances } from '@toa.io/operations';
|
|
3
|
+
export declare const standalone = true;
|
|
4
|
+
/**
|
|
5
|
+
* The explorer hosts the introspection components, exactly as the exposition
|
|
6
|
+
* gateway hosts the identity ones. Collection is on unless the context says
|
|
7
|
+
* `introspection: false`, and the environment variable is emitted together
|
|
8
|
+
* with the service — never on its own, or tasks would pile up in a queue
|
|
9
|
+
* nothing consumes.
|
|
10
|
+
*/
|
|
11
|
+
export declare function deployment(_: Instances<unknown>, annotation?: Annotation): Dependency;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.deployment = exports.standalone = void 0;
|
|
27
|
+
const generic_1 = require("@toa.io/generic");
|
|
28
|
+
const annotation_1 = require("./annotation");
|
|
29
|
+
const Composition_1 = require("./Composition");
|
|
30
|
+
const const_1 = require("./const");
|
|
31
|
+
const schemas = __importStar(require("./schemas"));
|
|
32
|
+
exports.standalone = true;
|
|
33
|
+
/**
|
|
34
|
+
* The explorer hosts the introspection components, exactly as the exposition
|
|
35
|
+
* gateway hosts the identity ones. Collection is on unless the context says
|
|
36
|
+
* `introspection: false`, and the environment variable is emitted together
|
|
37
|
+
* with the service — never on its own, or tasks would pile up in a queue
|
|
38
|
+
* nothing consumes.
|
|
39
|
+
*/
|
|
40
|
+
function deployment(_, annotation) {
|
|
41
|
+
if (annotation === false)
|
|
42
|
+
return {};
|
|
43
|
+
if (annotation !== undefined)
|
|
44
|
+
schemas.annotation.validate(annotation);
|
|
45
|
+
const opts = (0, annotation_1.options)(annotation);
|
|
46
|
+
const service = {
|
|
47
|
+
group: 'introspection',
|
|
48
|
+
name: 'explorer',
|
|
49
|
+
version: require('../package.json').version,
|
|
50
|
+
components: (0, Composition_1.components)().labels,
|
|
51
|
+
resources: annotation?.resources,
|
|
52
|
+
variables: []
|
|
53
|
+
};
|
|
54
|
+
if (opts.ui) {
|
|
55
|
+
service.port = const_1.UI_PORT;
|
|
56
|
+
service.ingress = { path: const_1.UI_PATH };
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
services: [service],
|
|
60
|
+
variables: { global: [{ name: const_1.ENV, value: (0, generic_1.encode)(opts) }] }
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
exports.deployment = deployment;
|
|
64
|
+
//# sourceMappingURL=extension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../source/extension.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAwC;AACxC,6CAAsC;AACtC,+CAA0C;AAC1C,mCAA+C;AAC/C,mDAAoC;AAIvB,QAAA,UAAU,GAAG,IAAI,CAAA;AAE9B;;;;;;GAMG;AACH,SAAgB,UAAU,CAAE,CAAqB,EAAE,UAAuB;IACxE,IAAI,UAAU,KAAK,KAAK;QACtB,OAAO,EAAE,CAAA;IAEX,IAAI,UAAU,KAAK,SAAS;QAC1B,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;IAEzC,MAAM,IAAI,GAAG,IAAA,oBAAO,EAAC,UAAU,CAAC,CAAA;IAEhC,MAAM,OAAO,GAAY;QACvB,KAAK,EAAE,eAAe;QACtB,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAAO;QAC3C,UAAU,EAAE,IAAA,wBAAU,GAAE,CAAC,MAAM;QAC/B,SAAS,EAAE,UAAU,EAAE,SAAS;QAChC,SAAS,EAAE,EAAE;KACd,CAAA;IAED,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC;QACZ,OAAO,CAAC,IAAI,GAAG,eAAO,CAAA;QACtB,OAAO,CAAC,OAAO,GAAG,EAAE,IAAI,EAAE,eAAO,EAAE,CAAA;IACrC,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,CAAC,OAAO,CAAC;QACnB,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,WAAG,EAAE,KAAK,EAAE,IAAA,gBAAM,EAAC,IAAI,CAAC,EAAE,CAAC,EAAE;KAC5D,CAAA;AACH,CAAC;AA3BD,gCA2BC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
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 });
|
|
17
|
+
exports.components = exports.manifest = exports.Factory = void 0;
|
|
18
|
+
var Factory_1 = require("./Factory");
|
|
19
|
+
Object.defineProperty(exports, "Factory", { enumerable: true, get: function () { return Factory_1.Factory; } });
|
|
20
|
+
var manifest_1 = require("./manifest");
|
|
21
|
+
Object.defineProperty(exports, "manifest", { enumerable: true, get: function () { return manifest_1.manifest; } });
|
|
22
|
+
var Composition_1 = require("./Composition");
|
|
23
|
+
Object.defineProperty(exports, "components", { enumerable: true, get: function () { return Composition_1.components; } });
|
|
24
|
+
__exportStar(require("./extension"), exports);
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qCAAmC;AAA1B,kGAAA,OAAO,OAAA;AAChB,uCAAqC;AAA5B,oGAAA,QAAQ,OAAA;AACjB,6CAA0C;AAAjC,yGAAA,UAAU,OAAA;AACnB,8CAA2B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Origin, Target } from './model';
|
|
2
|
+
/**
|
|
3
|
+
* Entity ids must match `^[a-fA-F0-9]{32}$`, and both nodes and edges are
|
|
4
|
+
* addressed by a value derived from their identity, so that every replica
|
|
5
|
+
* of a component updates the very same object.
|
|
6
|
+
*/
|
|
7
|
+
export declare function digest(...parts: Array<string | undefined>): string;
|
|
8
|
+
export declare function node(namespace: string, component: string): string;
|
|
9
|
+
export declare function edge(src: Origin, dst: Target): string;
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../source/keys.ts"],"names":[],"mappings":";;;AAAA,6CAAwC;AAGxC;;;;GAIG;AACH,SAAgB,MAAM,CAAE,GAAG,KAAgC;IACzD,OAAO,IAAA,wBAAU,EAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAChE,CAAC;AAFD,wBAEC;AAED,SAAgB,IAAI,CAAE,SAAiB,EAAE,SAAiB;IACxD,OAAO,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC,CAAA;AAC7C,CAAC;AAFD,oBAEC;AAED,SAAgB,IAAI,CAAE,GAAW,EAAE,GAAW;IAC5C,OAAO,MAAM,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,CAAA;AACnF,CAAC;AAFD,oBAEC;AAED,SAAS,KAAK,CAAE,MAAc;IAC5B,IAAI,SAAS,IAAI,MAAM;QACrB,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,CAAA;IAEpC,OAAO;QACL,WAAW;QACX,MAAM,CAAC,SAAS;QAChB,MAAM,CAAC,SAAS;QAChB,WAAW,IAAI,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;QACpD,OAAO,IAAI,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;KAC7C,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Declaration } from './annotation';
|
|
2
|
+
/**
|
|
3
|
+
* The component level of the annotation.
|
|
4
|
+
*
|
|
5
|
+
* The extension is predefined, so most components say nothing and the
|
|
6
|
+
* declaration arrives as `null` — which still has to produce a value,
|
|
7
|
+
* or norm rejects the extension.
|
|
8
|
+
*/
|
|
9
|
+
export declare function manifest(declaration: Declaration | null | undefined): Declaration;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.manifest = void 0;
|
|
27
|
+
const annotation_1 = require("./annotation");
|
|
28
|
+
const schemas = __importStar(require("./schemas"));
|
|
29
|
+
/**
|
|
30
|
+
* The component level of the annotation.
|
|
31
|
+
*
|
|
32
|
+
* The extension is predefined, so most components say nothing and the
|
|
33
|
+
* declaration arrives as `null` — which still has to produce a value,
|
|
34
|
+
* or norm rejects the extension.
|
|
35
|
+
*/
|
|
36
|
+
function manifest(declaration) {
|
|
37
|
+
const normalized = (0, annotation_1.component)(declaration);
|
|
38
|
+
if (normalized !== false)
|
|
39
|
+
schemas.declaration.validate(normalized);
|
|
40
|
+
return normalized;
|
|
41
|
+
}
|
|
42
|
+
exports.manifest = manifest;
|
|
43
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../source/manifest.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAwC;AACxC,mDAAoC;AAGpC;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAE,WAA2C;IACnE,MAAM,UAAU,GAAG,IAAA,sBAAS,EAAC,WAAW,CAAC,CAAA;IAEzC,IAAI,UAAU,KAAK,KAAK;QACtB,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;IAE1C,OAAO,UAAU,CAAA;AACnB,CAAC;AAPD,4BAOC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { Source } from '@toa.io/core';
|
|
2
|
+
export type { Source };
|
|
3
|
+
/**
|
|
4
|
+
* The caller side of an edge: the operation that made the call, the event that
|
|
5
|
+
* caused it, or the service the call came from.
|
|
6
|
+
*/
|
|
7
|
+
export type Origin = Source;
|
|
8
|
+
/** The callee side of an edge. */
|
|
9
|
+
export interface Target {
|
|
10
|
+
namespace: string;
|
|
11
|
+
component: string;
|
|
12
|
+
operation: string;
|
|
13
|
+
}
|
|
14
|
+
export interface Operation {
|
|
15
|
+
endpoint: string;
|
|
16
|
+
type: string;
|
|
17
|
+
scope?: string;
|
|
18
|
+
query?: boolean;
|
|
19
|
+
input?: object | null;
|
|
20
|
+
output?: object | null;
|
|
21
|
+
errors?: string[];
|
|
22
|
+
}
|
|
23
|
+
export interface Event {
|
|
24
|
+
label: string;
|
|
25
|
+
binding?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface Receiver {
|
|
28
|
+
label: string;
|
|
29
|
+
source: string;
|
|
30
|
+
event: string;
|
|
31
|
+
operation: string;
|
|
32
|
+
conditioned: boolean;
|
|
33
|
+
adaptive: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface Entity {
|
|
36
|
+
schema: object;
|
|
37
|
+
storage?: string;
|
|
38
|
+
associated: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The static description of a component, derived from its manifest.
|
|
42
|
+
* Sent to `introspection.nodes`.
|
|
43
|
+
*/
|
|
44
|
+
export interface Node {
|
|
45
|
+
namespace: string;
|
|
46
|
+
component: string;
|
|
47
|
+
version: string;
|
|
48
|
+
entity: Entity | null;
|
|
49
|
+
operations: Operation[];
|
|
50
|
+
events: Event[];
|
|
51
|
+
receivers: Receiver[];
|
|
52
|
+
extensions: string[];
|
|
53
|
+
}
|
|
54
|
+
export interface Sample {
|
|
55
|
+
at: number;
|
|
56
|
+
input?: unknown;
|
|
57
|
+
outcome: Outcome;
|
|
58
|
+
}
|
|
59
|
+
export type Outcome = 'ok' | 'error' | 'exception';
|
|
60
|
+
/**
|
|
61
|
+
* A call observed in a process between flushes. What the application declares —
|
|
62
|
+
* which events exist, and which receiver takes which — is a node's business;
|
|
63
|
+
* an edge is what actually happened.
|
|
64
|
+
*
|
|
65
|
+
* Sent to `introspection.edges`.
|
|
66
|
+
*/
|
|
67
|
+
export interface Edge {
|
|
68
|
+
src: Origin;
|
|
69
|
+
dst: Target;
|
|
70
|
+
sample?: Sample;
|
|
71
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../source/model.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Outcome, Sample } from './model';
|
|
2
|
+
/**
|
|
3
|
+
* Captures the payload of a call. Only reached when both the context and the
|
|
4
|
+
* component have opted in, and never for a denied namespace.
|
|
5
|
+
*/
|
|
6
|
+
export declare function capture(input: unknown, outcome: Outcome): Sample;
|
|
7
|
+
export declare function samplable(input: unknown): boolean;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.samplable = exports.capture = void 0;
|
|
4
|
+
const node_stream_1 = require("node:stream");
|
|
5
|
+
const const_1 = require("./const");
|
|
6
|
+
/**
|
|
7
|
+
* Captures the payload of a call. Only reached when both the context and the
|
|
8
|
+
* component have opted in, and never for a denied namespace.
|
|
9
|
+
*/
|
|
10
|
+
function capture(input, outcome) {
|
|
11
|
+
return { at: Date.now(), input: redact(input), outcome };
|
|
12
|
+
}
|
|
13
|
+
exports.capture = capture;
|
|
14
|
+
function samplable(input) {
|
|
15
|
+
return !(input instanceof node_stream_1.Readable);
|
|
16
|
+
}
|
|
17
|
+
exports.samplable = samplable;
|
|
18
|
+
function redact(value) {
|
|
19
|
+
if (value === null || value === undefined || typeof value !== 'object')
|
|
20
|
+
return truncate(value);
|
|
21
|
+
if (Array.isArray(value))
|
|
22
|
+
return truncate(value.map(redact));
|
|
23
|
+
const result = {};
|
|
24
|
+
for (const [key, property] of Object.entries(value))
|
|
25
|
+
result[key] = const_1.REDACTED.test(key) ? '***' : redact(property);
|
|
26
|
+
return truncate(result);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The map holds one sample per edge indefinitely, so a single oversized
|
|
30
|
+
* payload must not become a permanent tenant of the collection.
|
|
31
|
+
*/
|
|
32
|
+
function truncate(value) {
|
|
33
|
+
let serialized;
|
|
34
|
+
try {
|
|
35
|
+
serialized = JSON.stringify(value) ?? '';
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return '[unserializable]';
|
|
39
|
+
}
|
|
40
|
+
if (serialized.length <= const_1.SAMPLE_LIMIT)
|
|
41
|
+
return value;
|
|
42
|
+
return '[truncated]';
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=sample.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sample.js","sourceRoot":"","sources":["../source/sample.ts"],"names":[],"mappings":";;;AAAA,6CAAsC;AACtC,mCAAgD;AAGhD;;;GAGG;AACH,SAAgB,OAAO,CAAE,KAAc,EAAE,OAAgB;IACvD,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,CAAA;AAC1D,CAAC;AAFD,0BAEC;AAED,SAAgB,SAAS,CAAE,KAAc;IACvC,OAAO,CAAC,CAAC,KAAK,YAAY,sBAAQ,CAAC,CAAA;AACrC,CAAC;AAFD,8BAEC;AAED,SAAS,MAAM,CAAE,KAAc;IAC7B,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ;QACpE,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAA;IAExB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACtB,OAAO,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IAEpC,MAAM,MAAM,GAA4B,EAAE,CAAA;IAE1C,KAAK,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;QACjD,MAAM,CAAC,GAAG,CAAC,GAAG,gBAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IAE7D,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAA;AACzB,CAAC;AAED;;;GAGG;AACH,SAAS,QAAQ,CAAE,KAAc;IAC/B,IAAI,UAAkB,CAAA;IAEtB,IAAI,CAAC;QACH,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,CAAA;IAC1C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,kBAAkB,CAAA;IAC3B,CAAC;IAED,IAAI,UAAU,CAAC,MAAM,IAAI,oBAAY;QACnC,OAAO,KAAK,CAAA;IAEd,OAAO,aAAa,CAAA;AACtB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
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.declaration = exports.annotation = void 0;
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
|
+
const schemas_1 = __importDefault(require("@toa.io/schemas"));
|
|
9
|
+
const path = (0, node_path_1.resolve)(__dirname, '../schemas');
|
|
10
|
+
const namespace = schemas_1.default.namespace(path);
|
|
11
|
+
exports.annotation = namespace.schema('annotation');
|
|
12
|
+
exports.declaration = namespace.schema('declaration');
|
|
13
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../source/schemas.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAmC;AACnC,8DAAqC;AAIrC,MAAM,IAAI,GAAG,IAAA,mBAAO,EAAC,SAAS,EAAE,YAAY,CAAC,CAAA;AAC7C,MAAM,SAAS,GAAG,iBAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;AAE5B,QAAA,UAAU,GAAuC,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAA;AAC/E,QAAA,WAAW,GAAwC,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA"}
|