semantic-atlas 0.4.0 → 2.0.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/.agents/skills/semantic-atlas/SKILL.md +134 -166
- package/.agents/skills/semantic-atlas/agents/openai.yaml +4 -0
- package/.agents/skills/semantic-atlas/references/observations.md +130 -0
- package/.agents/skills/semantic-atlas/scripts/query-context.mjs +110 -0
- package/.agents/skills/semantic-atlas-maintenance/SKILL.md +93 -0
- package/.agents/skills/semantic-atlas-maintenance/agents/openai.yaml +4 -0
- package/.agents/skills/semantic-atlas-maintenance/references/reconciliation.md +56 -0
- package/README.md +133 -265
- package/dist/application/map-application.d.ts +24 -0
- package/dist/application/map-application.d.ts.map +1 -0
- package/dist/application/map-application.js +134 -0
- package/dist/application/map-application.js.map +1 -0
- package/dist/cli/bin.js +6 -42
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/observation-commands.d.ts +16 -0
- package/dist/cli/observation-commands.d.ts.map +1 -0
- package/dist/cli/observation-commands.js +118 -0
- package/dist/cli/observation-commands.js.map +1 -0
- package/dist/cli/projection-writer.d.ts +2 -0
- package/dist/cli/projection-writer.d.ts.map +1 -0
- package/dist/cli/projection-writer.js +9 -0
- package/dist/cli/projection-writer.js.map +1 -0
- package/dist/cli/reconciliation-command.d.ts +7 -0
- package/dist/cli/reconciliation-command.d.ts.map +1 -0
- package/dist/cli/reconciliation-command.js +33 -0
- package/dist/cli/reconciliation-command.js.map +1 -0
- package/dist/cli/run-cli.d.ts +21 -0
- package/dist/cli/run-cli.d.ts.map +1 -0
- package/dist/cli/run-cli.js +299 -0
- package/dist/cli/run-cli.js.map +1 -0
- package/dist/contracts/cli.d.ts +166 -1211
- package/dist/contracts/cli.d.ts.map +1 -1
- package/dist/contracts/cli.js +2 -232
- package/dist/contracts/cli.js.map +1 -0
- package/dist/contracts/insights.d.ts +39 -1
- package/dist/contracts/insights.d.ts.map +1 -1
- package/dist/contracts/insights.js +2 -1
- package/dist/contracts/insights.js.map +1 -0
- package/dist/contracts/map.d.ts +154 -0
- package/dist/contracts/map.d.ts.map +1 -0
- package/dist/contracts/map.js +60 -0
- package/dist/contracts/map.js.map +1 -0
- package/dist/contracts/observation.d.ts +414 -0
- package/dist/contracts/observation.d.ts.map +1 -0
- package/dist/contracts/observation.js +125 -0
- package/dist/contracts/observation.js.map +1 -0
- package/dist/contracts/projection.d.ts +7 -0
- package/dist/contracts/projection.d.ts.map +1 -0
- package/dist/contracts/projection.js +2 -0
- package/dist/contracts/projection.js.map +1 -0
- package/dist/contracts/reconciliation.d.ts +40 -0
- package/dist/contracts/reconciliation.d.ts.map +1 -0
- package/dist/contracts/reconciliation.js +2 -0
- package/dist/contracts/reconciliation.js.map +1 -0
- package/dist/index.d.ts +7 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -9
- package/dist/index.js.map +1 -0
- package/dist/insights/insight-service.d.ts +14 -0
- package/dist/insights/insight-service.d.ts.map +1 -0
- package/dist/insights/insight-service.js +129 -0
- package/dist/insights/insight-service.js.map +1 -0
- package/dist/map/business-graph.d.ts +32 -0
- package/dist/map/business-graph.d.ts.map +1 -0
- package/dist/map/business-graph.js +122 -0
- package/dist/map/business-graph.js.map +1 -0
- package/dist/map/map-document-loader.d.ts +13 -0
- package/dist/map/map-document-loader.d.ts.map +1 -0
- package/dist/map/map-document-loader.js +86 -0
- package/dist/map/map-document-loader.js.map +1 -0
- package/dist/map/map-validator.d.ts +12 -0
- package/dist/map/map-validator.d.ts.map +1 -0
- package/dist/map/map-validator.js +322 -0
- package/dist/map/map-validator.js.map +1 -0
- package/dist/observations/observation-application.d.ts +23 -0
- package/dist/observations/observation-application.d.ts.map +1 -0
- package/dist/observations/observation-application.js +62 -0
- package/dist/observations/observation-application.js.map +1 -0
- package/dist/observations/observation-claim-manager.d.ts +17 -0
- package/dist/observations/observation-claim-manager.d.ts.map +1 -0
- package/dist/observations/observation-claim-manager.js +198 -0
- package/dist/observations/observation-claim-manager.js.map +1 -0
- package/dist/observations/observation-store.d.ts +43 -0
- package/dist/observations/observation-store.d.ts.map +1 -0
- package/dist/observations/observation-store.js +213 -0
- package/dist/observations/observation-store.js.map +1 -0
- package/dist/observations/repository-identity.d.ts +12 -0
- package/dist/observations/repository-identity.d.ts.map +1 -0
- package/dist/observations/repository-identity.js +108 -0
- package/dist/observations/repository-identity.js.map +1 -0
- package/dist/query/context-query-service.d.ts +15 -0
- package/dist/query/context-query-service.d.ts.map +1 -0
- package/dist/query/context-query-service.js +36 -0
- package/dist/query/context-query-service.js.map +1 -0
- package/dist/reconciliation/reconciliation-service.d.ts +10 -0
- package/dist/reconciliation/reconciliation-service.d.ts.map +1 -0
- package/dist/reconciliation/reconciliation-service.js +114 -0
- package/dist/reconciliation/reconciliation-service.js.map +1 -0
- package/dist/rendering/map-projector.d.ts +8 -0
- package/dist/rendering/map-projector.d.ts.map +1 -0
- package/dist/rendering/map-projector.js +386 -0
- package/dist/rendering/map-projector.js.map +1 -0
- package/dist/setup/managed-skill-installer.d.ts +60 -0
- package/dist/setup/managed-skill-installer.d.ts.map +1 -0
- package/dist/setup/managed-skill-installer.js +293 -0
- package/dist/setup/managed-skill-installer.js.map +1 -0
- package/dist/setup/package-identity.d.ts +6 -0
- package/dist/setup/package-identity.d.ts.map +1 -0
- package/dist/setup/package-identity.js +16 -0
- package/dist/setup/package-identity.js.map +1 -0
- package/dist/setup/package-upgrader.d.ts +10 -22
- package/dist/setup/package-upgrader.d.ts.map +1 -1
- package/dist/setup/package-upgrader.js +60 -76
- package/dist/setup/package-upgrader.js.map +1 -0
- package/docs/architecture.md +426 -0
- package/docs/evaluation.md +220 -174
- package/docs/index.md +27 -45
- package/docs/map-format.md +225 -0
- package/docs/observations.md +167 -0
- package/docs/product-contract.md +282 -165
- package/examples/commerce.yaml +204 -0
- package/package.json +31 -32
- package/.agents/skills/semantic-atlas/references/graph-patch.md +0 -190
- package/.agents/skills/semantic-atlas/references/product-feedback.md +0 -34
- package/.agents/skills/semantic-atlas/references/result-routing.md +0 -104
- package/.agents/skills/semantic-atlas/references/snapshot-bootstrap.md +0 -42
- package/.agents/skills/semantic-atlas-insights/SKILL.md +0 -55
- package/README.zh-CN.md +0 -296
- package/dist/business-flow/business-flow-derivation-service.d.ts +0 -11
- package/dist/business-flow/business-flow-derivation-service.d.ts.map +0 -1
- package/dist/business-flow/business-flow-derivation-service.js +0 -151
- package/dist/business-flow/business-flow-draft.d.ts +0 -16
- package/dist/business-flow/business-flow-draft.d.ts.map +0 -1
- package/dist/business-flow/business-flow-draft.js +0 -150
- package/dist/business-flow/framework-business-strategy.d.ts +0 -7
- package/dist/business-flow/framework-business-strategy.d.ts.map +0 -1
- package/dist/business-flow/framework-business-strategy.js +0 -1
- package/dist/business-flow/strategies/bullmq-business-strategy.d.ts +0 -10
- package/dist/business-flow/strategies/bullmq-business-strategy.d.ts.map +0 -1
- package/dist/business-flow/strategies/bullmq-business-strategy.js +0 -79
- package/dist/business-flow/strategies/called-operation-derivation.d.ts +0 -13
- package/dist/business-flow/strategies/called-operation-derivation.d.ts.map +0 -1
- package/dist/business-flow/strategies/called-operation-derivation.js +0 -32
- package/dist/business-flow/strategies/graphql-business-strategy.d.ts +0 -8
- package/dist/business-flow/strategies/graphql-business-strategy.d.ts.map +0 -1
- package/dist/business-flow/strategies/graphql-business-strategy.js +0 -65
- package/dist/business-flow/strategies/nestjs-business-strategy.d.ts +0 -8
- package/dist/business-flow/strategies/nestjs-business-strategy.d.ts.map +0 -1
- package/dist/business-flow/strategies/nestjs-business-strategy.js +0 -72
- package/dist/business-flow/strategies/strategy-helpers.d.ts +0 -32
- package/dist/business-flow/strategies/strategy-helpers.d.ts.map +0 -1
- package/dist/business-flow/strategies/strategy-helpers.js +0 -49
- package/dist/business-flow/strategies/typeorm-business-strategy.d.ts +0 -10
- package/dist/business-flow/strategies/typeorm-business-strategy.d.ts.map +0 -1
- package/dist/business-flow/strategies/typeorm-business-strategy.js +0 -136
- package/dist/business-flow/strategies/verified-invariant-strategy.d.ts +0 -5
- package/dist/business-flow/strategies/verified-invariant-strategy.d.ts.map +0 -1
- package/dist/business-flow/strategies/verified-invariant-strategy.js +0 -38
- package/dist/business-flow/strategies/verified-test-strategy.d.ts +0 -5
- package/dist/business-flow/strategies/verified-test-strategy.d.ts.map +0 -1
- package/dist/business-flow/strategies/verified-test-strategy.js +0 -26
- package/dist/business-flow/structural-flow-catalog.d.ts +0 -21
- package/dist/business-flow/structural-flow-catalog.d.ts.map +0 -1
- package/dist/business-flow/structural-flow-catalog.js +0 -125
- package/dist/business-flow/types.d.ts +0 -51
- package/dist/business-flow/types.d.ts.map +0 -1
- package/dist/business-flow/types.js +0 -1
- package/dist/cli/argument-parser.d.ts +0 -3
- package/dist/cli/argument-parser.d.ts.map +0 -1
- package/dist/cli/argument-parser.js +0 -200
- package/dist/cli/cli-application.d.ts +0 -39
- package/dist/cli/cli-application.d.ts.map +0 -1
- package/dist/cli/cli-application.js +0 -571
- package/dist/cli/cli-error.d.ts +0 -12
- package/dist/cli/cli-error.d.ts.map +0 -1
- package/dist/cli/cli-error.js +0 -44
- package/dist/cli/cli-presenter.d.ts +0 -14
- package/dist/cli/cli-presenter.d.ts.map +0 -1
- package/dist/cli/cli-presenter.js +0 -36
- package/dist/cli/insights-cli.d.ts +0 -6
- package/dist/cli/insights-cli.d.ts.map +0 -1
- package/dist/cli/insights-cli.js +0 -236
- package/dist/cli/main.d.ts +0 -3
- package/dist/cli/main.d.ts.map +0 -1
- package/dist/cli/main.js +0 -137
- package/dist/cli/standalone-cli.d.ts +0 -3
- package/dist/cli/standalone-cli.d.ts.map +0 -1
- package/dist/cli/standalone-cli.js +0 -104
- package/dist/cli/types.d.ts +0 -49
- package/dist/cli/types.d.ts.map +0 -1
- package/dist/cli/types.js +0 -1
- package/dist/cli/web-cli.d.ts +0 -9
- package/dist/cli/web-cli.d.ts.map +0 -1
- package/dist/cli/web-cli.js +0 -134
- package/dist/contracts/graph.d.ts +0 -266
- package/dist/contracts/graph.d.ts.map +0 -1
- package/dist/contracts/graph.js +0 -182
- package/dist/contracts/identifiers.d.ts +0 -4
- package/dist/contracts/identifiers.d.ts.map +0 -1
- package/dist/contracts/identifiers.js +0 -7
- package/dist/contracts/public-contracts.d.ts +0 -5
- package/dist/contracts/public-contracts.d.ts.map +0 -1
- package/dist/contracts/public-contracts.js +0 -4
- package/dist/evaluation/comparison.d.ts +0 -30
- package/dist/evaluation/comparison.d.ts.map +0 -1
- package/dist/evaluation/comparison.js +0 -108
- package/dist/evaluation/contracts.d.ts +0 -301
- package/dist/evaluation/contracts.d.ts.map +0 -1
- package/dist/evaluation/contracts.js +0 -413
- package/dist/graph/graph-store.d.ts +0 -55
- package/dist/graph/graph-store.d.ts.map +0 -1
- package/dist/graph/graph-store.js +0 -912
- package/dist/graph/types.d.ts +0 -189
- package/dist/graph/types.d.ts.map +0 -1
- package/dist/graph/types.js +0 -1
- package/dist/insights/contracts.d.ts +0 -266
- package/dist/insights/contracts.d.ts.map +0 -1
- package/dist/insights/contracts.js +0 -124
- package/dist/insights/insights-store.d.ts +0 -73
- package/dist/insights/insights-store.d.ts.map +0 -1
- package/dist/insights/insights-store.js +0 -246
- package/dist/knowledge/business-knowledge-service.d.ts +0 -24
- package/dist/knowledge/business-knowledge-service.d.ts.map +0 -1
- package/dist/knowledge/business-knowledge-service.js +0 -200
- package/dist/knowledge/graph-patch-conflict-error.d.ts +0 -8
- package/dist/knowledge/graph-patch-conflict-error.d.ts.map +0 -1
- package/dist/knowledge/graph-patch-conflict-error.js +0 -12
- package/dist/knowledge/structural-target-binding.d.ts +0 -14
- package/dist/knowledge/structural-target-binding.d.ts.map +0 -1
- package/dist/knowledge/structural-target-binding.js +0 -11
- package/dist/package-metadata.d.ts +0 -2
- package/dist/package-metadata.d.ts.map +0 -1
- package/dist/package-metadata.js +0 -9
- package/dist/repository/git-command.d.ts +0 -3
- package/dist/repository/git-command.d.ts.map +0 -1
- package/dist/repository/git-command.js +0 -25
- package/dist/repository/repository-inspector.d.ts +0 -8
- package/dist/repository/repository-inspector.d.ts.map +0 -1
- package/dist/repository/repository-inspector.js +0 -97
- package/dist/repository/repository-language-support.d.ts +0 -14
- package/dist/repository/repository-language-support.d.ts.map +0 -1
- package/dist/repository/repository-language-support.js +0 -64
- package/dist/repository/types.d.ts +0 -9
- package/dist/repository/types.d.ts.map +0 -1
- package/dist/repository/types.js +0 -1
- package/dist/runtime/sqlite-compatibility-process.d.ts +0 -8
- package/dist/runtime/sqlite-compatibility-process.d.ts.map +0 -1
- package/dist/runtime/sqlite-compatibility-process.js +0 -20
- package/dist/setup/skill-installer.d.ts +0 -20
- package/dist/setup/skill-installer.d.ts.map +0 -1
- package/dist/setup/skill-installer.js +0 -187
- package/dist/snapshots/repository-snapshot.d.ts +0 -4
- package/dist/snapshots/repository-snapshot.d.ts.map +0 -1
- package/dist/snapshots/repository-snapshot.js +0 -119
- package/dist/snapshots/types.d.ts +0 -30
- package/dist/snapshots/types.d.ts.map +0 -1
- package/dist/snapshots/types.js +0 -1
- package/dist/storage/atlas-database.d.ts +0 -25
- package/dist/storage/atlas-database.d.ts.map +0 -1
- package/dist/storage/atlas-database.js +0 -483
- package/dist/storage/snapshot-store.d.ts +0 -19
- package/dist/storage/snapshot-store.d.ts.map +0 -1
- package/dist/storage/snapshot-store.js +0 -74
- package/dist/structural-backend/codegraph-backend.d.ts +0 -57
- package/dist/structural-backend/codegraph-backend.d.ts.map +0 -1
- package/dist/structural-backend/codegraph-backend.js +0 -1230
- package/dist/structural-backend/codegraph-worker-client.d.ts +0 -5
- package/dist/structural-backend/codegraph-worker-client.d.ts.map +0 -1
- package/dist/structural-backend/codegraph-worker-client.js +0 -118
- package/dist/structural-backend/codegraph-worker-protocol.d.ts +0 -35
- package/dist/structural-backend/codegraph-worker-protocol.d.ts.map +0 -1
- package/dist/structural-backend/codegraph-worker-protocol.js +0 -1
- package/dist/structural-backend/codegraph-worker.d.ts +0 -2
- package/dist/structural-backend/codegraph-worker.d.ts.map +0 -1
- package/dist/structural-backend/codegraph-worker.js +0 -131
- package/dist/structural-backend/process-instance.d.ts +0 -18
- package/dist/structural-backend/process-instance.d.ts.map +0 -1
- package/dist/structural-backend/process-instance.js +0 -207
- package/dist/structural-backend/structural-fact-changes.d.ts +0 -7
- package/dist/structural-backend/structural-fact-changes.d.ts.map +0 -1
- package/dist/structural-backend/structural-fact-changes.js +0 -78
- package/dist/structural-backend/structural-projection-bootstrapper.d.ts +0 -10
- package/dist/structural-backend/structural-projection-bootstrapper.d.ts.map +0 -1
- package/dist/structural-backend/structural-projection-bootstrapper.js +0 -295
- package/dist/structural-backend/structural-publication.d.ts +0 -13
- package/dist/structural-backend/structural-publication.d.ts.map +0 -1
- package/dist/structural-backend/structural-publication.js +0 -255
- package/dist/structural-backend/structural-write-lock.d.ts +0 -8
- package/dist/structural-backend/structural-write-lock.d.ts.map +0 -1
- package/dist/structural-backend/structural-write-lock.js +0 -415
- package/dist/structural-backend/types.d.ts +0 -144
- package/dist/structural-backend/types.d.ts.map +0 -1
- package/dist/structural-backend/types.js +0 -11
- package/dist/web/application/atlas-read-service.d.ts +0 -27
- package/dist/web/application/atlas-read-service.d.ts.map +0 -1
- package/dist/web/application/atlas-read-service.js +0 -216
- package/dist/web/application/primary-repository-catalog.d.ts +0 -15
- package/dist/web/application/primary-repository-catalog.d.ts.map +0 -1
- package/dist/web/application/primary-repository-catalog.js +0 -202
- package/dist/web/application/types.d.ts +0 -41
- package/dist/web/application/types.d.ts.map +0 -1
- package/dist/web/application/types.js +0 -1
- package/dist/web/server/api-router.d.ts +0 -4
- package/dist/web/server/api-router.d.ts.map +0 -1
- package/dist/web/server/api-router.js +0 -151
- package/dist/web/server/local-web-server.d.ts +0 -12
- package/dist/web/server/local-web-server.d.ts.map +0 -1
- package/dist/web/server/local-web-server.js +0 -100
- package/dist/web-client/assets/index-DneaErDj.css +0 -1
- package/dist/web-client/assets/index-cze_4vtt.js +0 -2
- package/dist/web-client/assets/index-cze_4vtt.js.map +0 -1
- package/dist/web-client/index.html +0 -61
- package/dist/world/business-map-projector.d.ts +0 -14
- package/dist/world/business-map-projector.d.ts.map +0 -1
- package/dist/world/business-map-projector.js +0 -178
- package/dist/world/types.d.ts +0 -77
- package/dist/world/types.d.ts.map +0 -1
- package/dist/world/types.js +0 -1
- package/dist/world/world-graph-query.d.ts +0 -30
- package/dist/world/world-graph-query.d.ts.map +0 -1
- package/dist/world/world-graph-query.js +0 -252
- package/dist/world/world-model-service.d.ts +0 -21
- package/dist/world/world-model-service.d.ts.map +0 -1
- package/dist/world/world-model-service.js +0 -219
- package/dist/world/world-snapshot-store.d.ts +0 -41
- package/dist/world/world-snapshot-store.d.ts.map +0 -1
- package/dist/world/world-snapshot-store.js +0 -581
- package/docs/README.md +0 -30
- package/docs/architecture/codegraph-backend.md +0 -190
- package/docs/architecture/continuous-business-learning.md +0 -240
- package/docs/architecture/web-viewer.md +0 -225
- package/docs/contracts/cli-v1.md +0 -179
- package/docs/contracts/graph-model.md +0 -106
- package/docs/contracts/graph-patch-v1.md +0 -105
- package/docs/contracts/http-api-v1.md +0 -155
- package/docs/contracts/insights-v1.md +0 -84
- package/docs/log.md +0 -159
- package/docs/mindmaps/semantic-atlas-overview.drawio +0 -255
- package/docs/mindmaps/semantic-atlas-overview.png +0 -0
- package/docs/mindmaps/semantic-atlas-overview.zh-CN.drawio +0 -255
- package/docs/mindmaps/semantic-atlas-overview.zh-CN.png +0 -0
- package/schemas/cli-envelope-v1.schema.json +0 -1244
- package/schemas/evaluation-plan-v1.schema.json +0 -211
- package/schemas/evaluation-run-v1.schema.json +0 -659
- package/schemas/graph-patch-v1.schema.json +0 -392
- package/schemas/insights-envelope-v1.schema.json +0 -428
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
|
-
import { graphPatchV1Schema } from "../contracts/graph.js";
|
|
3
|
-
export class BusinessFlowDraft {
|
|
4
|
-
#snapshot;
|
|
5
|
-
#capabilityKey;
|
|
6
|
-
#nodes = new Map();
|
|
7
|
-
#relations = new Map();
|
|
8
|
-
#boundaries = new Map();
|
|
9
|
-
constructor(snapshot, capabilityKey) {
|
|
10
|
-
this.#snapshot = snapshot;
|
|
11
|
-
this.#capabilityKey = capabilityKey;
|
|
12
|
-
}
|
|
13
|
-
addNode(node) {
|
|
14
|
-
const existing = this.#nodes.get(node.key);
|
|
15
|
-
if (existing === undefined) {
|
|
16
|
-
this.#nodes.set(node.key, node);
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
if (existing.kind !== node.kind) {
|
|
20
|
-
throw new Error(`Business concept ${node.key} has conflicting kinds`);
|
|
21
|
-
}
|
|
22
|
-
this.#nodes.set(node.key, {
|
|
23
|
-
...existing,
|
|
24
|
-
aliases: uniqueStrings([...existing.aliases, ...node.aliases]),
|
|
25
|
-
evidence: uniqueEvidence([...existing.evidence, ...node.evidence]),
|
|
26
|
-
certainty: lowerCertainty(existing.certainty, node.certainty),
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
addRelation(relation) {
|
|
30
|
-
const identity = relationIdentity(relation);
|
|
31
|
-
const existing = this.#relations.get(identity);
|
|
32
|
-
if (existing === undefined) {
|
|
33
|
-
this.#relations.set(identity, relation);
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
this.#relations.set(identity, {
|
|
37
|
-
...existing,
|
|
38
|
-
evidence: uniqueEvidence([...existing.evidence, ...relation.evidence]),
|
|
39
|
-
certainty: lowerCertainty(existing.certainty, relation.certainty),
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
addBoundary(framework, operation, reason, owner, candidates = []) {
|
|
43
|
-
const id = `business-boundary:${digest([
|
|
44
|
-
framework,
|
|
45
|
-
operation,
|
|
46
|
-
owner.reference.id,
|
|
47
|
-
reason,
|
|
48
|
-
].join("\0"))}`;
|
|
49
|
-
this.#boundaries.set(id, {
|
|
50
|
-
id,
|
|
51
|
-
framework,
|
|
52
|
-
operation,
|
|
53
|
-
reason,
|
|
54
|
-
owner: { domain: "structural", id: owner.reference.id },
|
|
55
|
-
location: locationFor(owner, this.#snapshot),
|
|
56
|
-
candidates: uniqueStrings(candidates),
|
|
57
|
-
resolution: "source_fallback",
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
evidenceFor(node) {
|
|
61
|
-
const location = locationFor(node, this.#snapshot);
|
|
62
|
-
if (!/^(?:symbol|test):/u.test(node.reference.id)) {
|
|
63
|
-
throw new Error(`Structural node ${node.reference.id} cannot be GraphPatch evidence`);
|
|
64
|
-
}
|
|
65
|
-
return {
|
|
66
|
-
symbolId: node.reference.id,
|
|
67
|
-
file: location.file,
|
|
68
|
-
range: location.range,
|
|
69
|
-
contentHash: location.contentHash,
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
finish() {
|
|
73
|
-
this.addCapabilityOwnership();
|
|
74
|
-
const patch = graphPatchV1Schema.parse({
|
|
75
|
-
schemaVersion: 1,
|
|
76
|
-
baseSnapshotId: this.#snapshot.snapshotId,
|
|
77
|
-
nodeOperations: [...this.#nodes.values()]
|
|
78
|
-
.sort((left, right) => left.key.localeCompare(right.key))
|
|
79
|
-
.map((node) => ({ op: "upsert", node })),
|
|
80
|
-
relationOperations: [...this.#relations.values()]
|
|
81
|
-
.sort((left, right) => relationIdentity(left).localeCompare(relationIdentity(right)))
|
|
82
|
-
.map((relation) => ({ op: "upsert", relation })),
|
|
83
|
-
});
|
|
84
|
-
return {
|
|
85
|
-
patch,
|
|
86
|
-
boundaries: [...this.#boundaries.values()]
|
|
87
|
-
.sort((left, right) => left.id.localeCompare(right.id)),
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
addCapabilityOwnership() {
|
|
91
|
-
const capability = this.#nodes.get(this.#capabilityKey);
|
|
92
|
-
if (capability?.kind !== "Capability") {
|
|
93
|
-
throw new Error(`Business flow capability ${this.#capabilityKey} is missing from its draft`);
|
|
94
|
-
}
|
|
95
|
-
for (const node of this.#nodes.values()) {
|
|
96
|
-
if (node.key === this.#capabilityKey) {
|
|
97
|
-
continue;
|
|
98
|
-
}
|
|
99
|
-
this.addRelation({
|
|
100
|
-
from: { domain: "business", key: node.key },
|
|
101
|
-
type: "part_of",
|
|
102
|
-
to: { domain: "business", key: this.#capabilityKey },
|
|
103
|
-
certainty: lowerCertainty(node.certainty, capability.certainty),
|
|
104
|
-
evidence: node.evidence,
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
export function businessKeySegment(value, identity = value) {
|
|
110
|
-
const normalized = value
|
|
111
|
-
.normalize("NFKD")
|
|
112
|
-
.replace(/([a-z0-9])([A-Z])/gu, "$1-$2")
|
|
113
|
-
.toLowerCase()
|
|
114
|
-
.replace(/[^a-z0-9]+/gu, "-")
|
|
115
|
-
.replace(/^-+|-+$/gu, "")
|
|
116
|
-
.slice(0, 56);
|
|
117
|
-
const prefix = normalized.length > 0 ? normalized : "concept";
|
|
118
|
-
return `${prefix}-${digest(identity).slice(0, 8)}`;
|
|
119
|
-
}
|
|
120
|
-
function locationFor(node, snapshot) {
|
|
121
|
-
const source = snapshot.files.find((file) => file.path === node.path)?.worktree;
|
|
122
|
-
if (source === null || source === undefined) {
|
|
123
|
-
throw new Error(`Structural source ${node.path} is absent from snapshot ${snapshot.snapshotId}`);
|
|
124
|
-
}
|
|
125
|
-
return {
|
|
126
|
-
file: node.path,
|
|
127
|
-
range: node.range,
|
|
128
|
-
contentHash: source.contentHash,
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
function relationIdentity(relation) {
|
|
132
|
-
const target = relation.to.domain === "business" ? relation.to.key : relation.to.id;
|
|
133
|
-
return [relation.from.key, relation.type, relation.to.domain, target].join("\0");
|
|
134
|
-
}
|
|
135
|
-
function uniqueEvidence(evidence) {
|
|
136
|
-
return [...new Map(evidence.map((item) => [
|
|
137
|
-
[item.symbolId, item.file, JSON.stringify(item.range), item.contentHash].join("\0"),
|
|
138
|
-
item,
|
|
139
|
-
])).values()];
|
|
140
|
-
}
|
|
141
|
-
function uniqueStrings(values) {
|
|
142
|
-
return [...new Set(values)].sort();
|
|
143
|
-
}
|
|
144
|
-
function lowerCertainty(left, right) {
|
|
145
|
-
const rank = { hypothesis: 0, inferred: 1, exact: 2 };
|
|
146
|
-
return rank[left] <= rank[right] ? left : right;
|
|
147
|
-
}
|
|
148
|
-
function digest(value) {
|
|
149
|
-
return createHash("sha256").update(value).digest("hex");
|
|
150
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { BusinessFlowDraft } from "./business-flow-draft.js";
|
|
2
|
-
import type { StructuralFlowCatalog } from "./structural-flow-catalog.js";
|
|
3
|
-
import type { BusinessFlowDerivationOptions } from "./types.js";
|
|
4
|
-
export interface FrameworkBusinessStrategy {
|
|
5
|
-
derive(catalog: StructuralFlowCatalog, options: BusinessFlowDerivationOptions, draft: BusinessFlowDraft): void;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=framework-business-strategy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"framework-business-strategy.d.ts","sourceRoot":"","sources":["../../src/business-flow/framework-business-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAEhE,MAAM,WAAW,yBAAyB;IACxC,MAAM,CACJ,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,6BAA6B,EACtC,KAAK,EAAE,iBAAiB,GACvB,IAAI,CAAC;CACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { StructuralNode } from "../../structural-backend/types.js";
|
|
2
|
-
import type { BusinessFlowDraft } from "../business-flow-draft.js";
|
|
3
|
-
import type { FrameworkBusinessStrategy } from "../framework-business-strategy.js";
|
|
4
|
-
import type { StructuralFlowCatalog } from "../structural-flow-catalog.js";
|
|
5
|
-
import type { BusinessFlowDerivationOptions } from "../types.js";
|
|
6
|
-
export declare class BullMqBusinessStrategy implements FrameworkBusinessStrategy {
|
|
7
|
-
derive(catalog: StructuralFlowCatalog, options: BusinessFlowDerivationOptions, draft: BusinessFlowDraft): void;
|
|
8
|
-
}
|
|
9
|
-
export declare function findBullMqAnchors(catalog: StructuralFlowCatalog): StructuralNode[];
|
|
10
|
-
//# sourceMappingURL=bullmq-business-strategy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bullmq-business-strategy.d.ts","sourceRoot":"","sources":["../../../src/business-flow/strategies/bullmq-business-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AACnF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,KAAK,EACV,6BAA6B,EAE9B,MAAM,aAAa,CAAC;AASrB,qBAAa,sBAAuB,YAAW,yBAAyB;IACtE,MAAM,CACJ,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,6BAA6B,EACtC,KAAK,EAAE,iBAAiB,GACvB,IAAI;CAmBR;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,qBAAqB,GAAG,cAAc,EAAE,CAYlF"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { businessKeySegment } from "../business-flow-draft.js";
|
|
2
|
-
import { addBusinessNode, addBusinessRelation, addStructuralRelation, hasDecorator, nodeKey, } from "./strategy-helpers.js";
|
|
3
|
-
export class BullMqBusinessStrategy {
|
|
4
|
-
derive(catalog, options, draft) {
|
|
5
|
-
const verifiedReferences = new Set((options.messageFlows ?? []).flatMap((flow) => [
|
|
6
|
-
flow.producer.id,
|
|
7
|
-
flow.consumer.id,
|
|
8
|
-
]));
|
|
9
|
-
for (const candidate of findBullMqAnchors(catalog)) {
|
|
10
|
-
if (!verifiedReferences.has(candidate.reference.id)) {
|
|
11
|
-
draft.addBoundary("bullmq", "resolve_message_channel", `The BullMQ channel for ${candidate.qualifiedName} requires agent-verified runtime wiring.`, candidate);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
for (const flow of options.messageFlows ?? []) {
|
|
15
|
-
deriveVerifiedFlow(flow, catalog, options, draft);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
export function findBullMqAnchors(catalog) {
|
|
20
|
-
const frameworkPaths = new Set(catalog.nodes.flatMap((node) => (catalog.contextNodes(node.path))).filter((node) => (node.declarationKind === "import"
|
|
21
|
-
&& (node.name === "bullmq" || node.name === "@nestjs/bullmq"))).map((node) => node.path));
|
|
22
|
-
return catalog.nodes.filter((node) => (hasBullMqDecorator(node)
|
|
23
|
-
|| (frameworkPaths.has(node.path)
|
|
24
|
-
&& /(?:Processor|Consumer)(?:::|\.)/u.test(node.qualifiedName))));
|
|
25
|
-
}
|
|
26
|
-
function deriveVerifiedFlow(flow, catalog, options, draft) {
|
|
27
|
-
const producer = catalog.node(flow.producer.id);
|
|
28
|
-
const consumer = catalog.node(flow.consumer.id);
|
|
29
|
-
if (producer === undefined || consumer === undefined) {
|
|
30
|
-
throw new Error(`Verified message flow ${flow.channel} references missing structural evidence`);
|
|
31
|
-
}
|
|
32
|
-
const channelKey = `${options.capability.key}/interfaces/${businessKeySegment(flow.channel)}`;
|
|
33
|
-
const producerKey = nodeKey(options.capability.key, "operations", producer);
|
|
34
|
-
const consumerKey = nodeKey(options.capability.key, "operations", consumer);
|
|
35
|
-
addBusinessNode(draft, {
|
|
36
|
-
key: channelKey,
|
|
37
|
-
kind: "Interface",
|
|
38
|
-
label: flow.channel,
|
|
39
|
-
summary: `BullMQ channel ${flow.channel}.`,
|
|
40
|
-
evidence: producer,
|
|
41
|
-
certainty: flow.certainty ?? "inferred",
|
|
42
|
-
});
|
|
43
|
-
for (const [operation, key, summary] of [
|
|
44
|
-
[producer, producerKey, `Publishes ${flow.channel}.`],
|
|
45
|
-
[consumer, consumerKey, `Consumes ${flow.channel}.`],
|
|
46
|
-
]) {
|
|
47
|
-
addBusinessNode(draft, {
|
|
48
|
-
key,
|
|
49
|
-
kind: "Operation",
|
|
50
|
-
label: operation.name,
|
|
51
|
-
summary,
|
|
52
|
-
evidence: operation,
|
|
53
|
-
certainty: flow.certainty ?? "inferred",
|
|
54
|
-
});
|
|
55
|
-
addStructuralRelation(draft, {
|
|
56
|
-
from: key,
|
|
57
|
-
type: "realized_by",
|
|
58
|
-
to: operation,
|
|
59
|
-
certainty: flow.certainty ?? "inferred",
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
addBusinessRelation(draft, {
|
|
63
|
-
from: producerKey,
|
|
64
|
-
type: "publishes",
|
|
65
|
-
to: channelKey,
|
|
66
|
-
evidence: producer,
|
|
67
|
-
certainty: flow.certainty ?? "inferred",
|
|
68
|
-
});
|
|
69
|
-
addBusinessRelation(draft, {
|
|
70
|
-
from: consumerKey,
|
|
71
|
-
type: "consumes",
|
|
72
|
-
to: channelKey,
|
|
73
|
-
evidence: consumer,
|
|
74
|
-
certainty: flow.certainty ?? "inferred",
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
function hasBullMqDecorator(node) {
|
|
78
|
-
return hasDecorator(node, ["Processor", "Process", "InjectQueue"]);
|
|
79
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { StructuralNode } from "../../structural-backend/types.js";
|
|
2
|
-
import type { BusinessFlowDraft } from "../business-flow-draft.js";
|
|
3
|
-
import type { StructuralFlowCatalog } from "../structural-flow-catalog.js";
|
|
4
|
-
import type { SupportedBusinessFramework } from "../types.js";
|
|
5
|
-
interface CalledOperationDerivationInput {
|
|
6
|
-
readonly framework: Extract<SupportedBusinessFramework, "nestjs" | "graphql">;
|
|
7
|
-
readonly handler: StructuralNode;
|
|
8
|
-
readonly catalog: StructuralFlowCatalog;
|
|
9
|
-
readonly draft: BusinessFlowDraft;
|
|
10
|
-
}
|
|
11
|
-
export declare function deriveCalledOperationBoundaries(input: CalledOperationDerivationInput): void;
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=called-operation-derivation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"called-operation-derivation.d.ts","sourceRoot":"","sources":["../../../src/business-flow/strategies/called-operation-derivation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EAEf,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAG9D,UAAU,8BAA8B;IACtC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,0BAA0B,EAAE,QAAQ,GAAG,SAAS,CAAC,CAAC;IAC9E,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,qBAAqB,CAAC;IACxC,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;CACnC;AAED,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,8BAA8B,GAAG,IAAI,CAY3F"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { hasBusinessOperationEvidence } from "./strategy-helpers.js";
|
|
2
|
-
export function deriveCalledOperationBoundaries(input) {
|
|
3
|
-
for (const call of input.catalog.outgoing(input.handler.reference.id, "calls")) {
|
|
4
|
-
const target = input.catalog.node(call.to.id);
|
|
5
|
-
const candidates = calledOperationCandidates(target?.name, input.handler, input.catalog);
|
|
6
|
-
addResolutionBoundary(input, target?.name, target, call.support.status, candidates);
|
|
7
|
-
}
|
|
8
|
-
for (const boundary of input.catalog.boundaries.filter((candidate) => (candidate.owner.id === input.handler.reference.id && candidate.operation === "calls"))) {
|
|
9
|
-
addResolutionBoundary(input, boundary.target);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
function addResolutionBoundary(input, calledName, target, support, candidates = calledOperationCandidates(calledName, input.handler, input.catalog)) {
|
|
13
|
-
if (candidates.length === 0) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
input.draft.addBoundary(input.framework, "resolve_called_operation", calledOperationResolutionReason(input.handler, calledName, target, support), input.handler, candidates.map((candidate) => candidate.reference.id));
|
|
17
|
-
}
|
|
18
|
-
function calledOperationCandidates(name, handler, catalog) {
|
|
19
|
-
if (name === undefined) {
|
|
20
|
-
return [];
|
|
21
|
-
}
|
|
22
|
-
return catalog.nodes.filter((node) => (node.reference.id !== handler.reference.id
|
|
23
|
-
&& node.name === name
|
|
24
|
-
&& (node.declarationKind === "method" || node.declarationKind === "function")
|
|
25
|
-
&& hasBusinessOperationEvidence(node, catalog)));
|
|
26
|
-
}
|
|
27
|
-
function calledOperationResolutionReason(handler, calledName, target, support) {
|
|
28
|
-
if (target === undefined || support === undefined) {
|
|
29
|
-
return `The call ${calledName ?? "from the framework handler"} in ${handler.qualifiedName} is unresolved and requires source inspection.`;
|
|
30
|
-
}
|
|
31
|
-
return `The ${support} call target ${target.qualifiedName} cannot be uniquely tied to an owned business operation from ${handler.qualifiedName}.`;
|
|
32
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { BusinessFlowDraft } from "../business-flow-draft.js";
|
|
2
|
-
import type { FrameworkBusinessStrategy } from "../framework-business-strategy.js";
|
|
3
|
-
import type { StructuralFlowCatalog } from "../structural-flow-catalog.js";
|
|
4
|
-
import type { BusinessFlowDerivationOptions } from "../types.js";
|
|
5
|
-
export declare class GraphqlBusinessStrategy implements FrameworkBusinessStrategy {
|
|
6
|
-
derive(catalog: StructuralFlowCatalog, options: BusinessFlowDerivationOptions, draft: BusinessFlowDraft): void;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=graphql-business-strategy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graphql-business-strategy.d.ts","sourceRoot":"","sources":["../../../src/business-flow/strategies/graphql-business-strategy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AACnF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AASjE,qBAAa,uBAAwB,YAAW,yBAAyB;IACvE,MAAM,CACJ,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,6BAA6B,EACtC,KAAK,EAAE,iBAAiB,GACvB,IAAI;CAqER"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { deriveCalledOperationBoundaries } from "./called-operation-derivation.js";
|
|
2
|
-
import { addBusinessNode, addBusinessRelation, addStructuralRelation, nodeKey, } from "./strategy-helpers.js";
|
|
3
|
-
export class GraphqlBusinessStrategy {
|
|
4
|
-
derive(catalog, options, draft) {
|
|
5
|
-
for (const route of catalog.nodes.filter((node) => (node.declarationKind === "route" && GRAPHQL_ROUTE.test(node.name)))) {
|
|
6
|
-
const candidates = catalog.outgoing(route.reference.id, "references")
|
|
7
|
-
.filter((relation) => relation.support.status === "exact")
|
|
8
|
-
.map((relation) => catalog.node(relation.to.id))
|
|
9
|
-
.filter((node) => node !== undefined);
|
|
10
|
-
if (candidates.length !== 1) {
|
|
11
|
-
draft.addBoundary("graphql", "resolve_operation_handler", `The GraphQL operation ${route.name} does not have one exact normalized resolver.`, route, candidates.map((node) => node.reference.id));
|
|
12
|
-
continue;
|
|
13
|
-
}
|
|
14
|
-
const handler = candidates[0];
|
|
15
|
-
const interfaceKey = nodeKey(options.capability.key, "interfaces", route);
|
|
16
|
-
const operationKey = nodeKey(options.capability.key, "operations", handler);
|
|
17
|
-
const scenarioKey = nodeKey(options.capability.key, "scenarios", route);
|
|
18
|
-
addBusinessNode(draft, {
|
|
19
|
-
key: interfaceKey,
|
|
20
|
-
kind: "Interface",
|
|
21
|
-
label: route.name,
|
|
22
|
-
summary: `GraphQL operation ${route.name}.`,
|
|
23
|
-
evidence: route,
|
|
24
|
-
});
|
|
25
|
-
addBusinessNode(draft, {
|
|
26
|
-
key: operationKey,
|
|
27
|
-
kind: "Operation",
|
|
28
|
-
label: handler.name,
|
|
29
|
-
summary: `Resolves ${route.name}.`,
|
|
30
|
-
evidence: handler,
|
|
31
|
-
});
|
|
32
|
-
addBusinessNode(draft, {
|
|
33
|
-
key: scenarioKey,
|
|
34
|
-
kind: "Scenario",
|
|
35
|
-
label: route.name,
|
|
36
|
-
summary: `A GraphQL caller invokes ${route.name}.`,
|
|
37
|
-
evidence: route,
|
|
38
|
-
});
|
|
39
|
-
addBusinessRelation(draft, {
|
|
40
|
-
from: scenarioKey,
|
|
41
|
-
type: "consumes",
|
|
42
|
-
to: interfaceKey,
|
|
43
|
-
evidence: route,
|
|
44
|
-
});
|
|
45
|
-
addBusinessRelation(draft, {
|
|
46
|
-
from: scenarioKey,
|
|
47
|
-
type: "invokes",
|
|
48
|
-
to: operationKey,
|
|
49
|
-
evidence: route,
|
|
50
|
-
});
|
|
51
|
-
addStructuralRelation(draft, {
|
|
52
|
-
from: operationKey,
|
|
53
|
-
type: "realized_by",
|
|
54
|
-
to: handler,
|
|
55
|
-
});
|
|
56
|
-
deriveCalledOperationBoundaries({
|
|
57
|
-
framework: "graphql",
|
|
58
|
-
handler,
|
|
59
|
-
catalog,
|
|
60
|
-
draft,
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
const GRAPHQL_ROUTE = /^(?:QUERY|MUTATION|SUBSCRIPTION)\s+/u;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { BusinessFlowDraft } from "../business-flow-draft.js";
|
|
2
|
-
import type { FrameworkBusinessStrategy } from "../framework-business-strategy.js";
|
|
3
|
-
import type { StructuralFlowCatalog } from "../structural-flow-catalog.js";
|
|
4
|
-
import type { BusinessFlowDerivationOptions } from "../types.js";
|
|
5
|
-
export declare class NestJsBusinessStrategy implements FrameworkBusinessStrategy {
|
|
6
|
-
derive(catalog: StructuralFlowCatalog, options: BusinessFlowDerivationOptions, draft: BusinessFlowDraft): void;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=nestjs-business-strategy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nestjs-business-strategy.d.ts","sourceRoot":"","sources":["../../../src/business-flow/strategies/nestjs-business-strategy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AACnF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AASjE,qBAAa,sBAAuB,YAAW,yBAAyB;IACtE,MAAM,CACJ,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,6BAA6B,EACtC,KAAK,EAAE,iBAAiB,GACvB,IAAI;CAkER"}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { deriveCalledOperationBoundaries } from "./called-operation-derivation.js";
|
|
2
|
-
import { addBusinessNode, addBusinessRelation, addStructuralRelation, nodeKey, } from "./strategy-helpers.js";
|
|
3
|
-
export class NestJsBusinessStrategy {
|
|
4
|
-
derive(catalog, options, draft) {
|
|
5
|
-
const httpRoutes = catalog.nodes.filter((node) => (node.declarationKind === "route" && HTTP_ROUTE.test(node.name)));
|
|
6
|
-
for (const route of httpRoutes) {
|
|
7
|
-
const handler = uniqueExactHandler(route, catalog);
|
|
8
|
-
if (handler === undefined) {
|
|
9
|
-
draft.addBoundary("nestjs", "resolve_endpoint_handler", `The endpoint ${route.name} does not have one exact normalized handler.`, route, exactHandlerCandidates(route, catalog).map((node) => node.reference.id));
|
|
10
|
-
continue;
|
|
11
|
-
}
|
|
12
|
-
const interfaceKey = nodeKey(options.capability.key, "interfaces", route);
|
|
13
|
-
const operationKey = nodeKey(options.capability.key, "operations", handler);
|
|
14
|
-
const scenarioKey = nodeKey(options.capability.key, "scenarios", route);
|
|
15
|
-
addBusinessNode(draft, {
|
|
16
|
-
key: interfaceKey,
|
|
17
|
-
kind: "Interface",
|
|
18
|
-
label: route.name,
|
|
19
|
-
summary: `NestJS endpoint ${route.name}.`,
|
|
20
|
-
evidence: route,
|
|
21
|
-
});
|
|
22
|
-
addBusinessNode(draft, {
|
|
23
|
-
key: operationKey,
|
|
24
|
-
kind: "Operation",
|
|
25
|
-
label: handler.name,
|
|
26
|
-
summary: `Handles ${route.name}.`,
|
|
27
|
-
evidence: handler,
|
|
28
|
-
});
|
|
29
|
-
addBusinessNode(draft, {
|
|
30
|
-
key: scenarioKey,
|
|
31
|
-
kind: "Scenario",
|
|
32
|
-
label: route.name,
|
|
33
|
-
summary: `A caller invokes ${route.name}.`,
|
|
34
|
-
evidence: route,
|
|
35
|
-
});
|
|
36
|
-
addBusinessRelation(draft, {
|
|
37
|
-
from: scenarioKey,
|
|
38
|
-
type: "consumes",
|
|
39
|
-
to: interfaceKey,
|
|
40
|
-
evidence: route,
|
|
41
|
-
});
|
|
42
|
-
addBusinessRelation(draft, {
|
|
43
|
-
from: scenarioKey,
|
|
44
|
-
type: "invokes",
|
|
45
|
-
to: operationKey,
|
|
46
|
-
evidence: route,
|
|
47
|
-
});
|
|
48
|
-
addStructuralRelation(draft, {
|
|
49
|
-
from: operationKey,
|
|
50
|
-
type: "realized_by",
|
|
51
|
-
to: handler,
|
|
52
|
-
});
|
|
53
|
-
deriveCalledOperationBoundaries({
|
|
54
|
-
framework: "nestjs",
|
|
55
|
-
handler,
|
|
56
|
-
catalog,
|
|
57
|
-
draft,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
function uniqueExactHandler(route, catalog) {
|
|
63
|
-
const candidates = exactHandlerCandidates(route, catalog);
|
|
64
|
-
return candidates.length === 1 ? candidates[0] : undefined;
|
|
65
|
-
}
|
|
66
|
-
function exactHandlerCandidates(route, catalog) {
|
|
67
|
-
return catalog.outgoing(route.reference.id, "references")
|
|
68
|
-
.filter((relation) => relation.support.status === "exact")
|
|
69
|
-
.map((relation) => catalog.node(relation.to.id))
|
|
70
|
-
.filter((node) => node !== undefined);
|
|
71
|
-
}
|
|
72
|
-
const HTTP_ROUTE = /^(?:GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS|ALL)\s+/u;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { AssertionCertainty, BusinessNodeKind, BusinessRelationType } from "../../graph/types.js";
|
|
2
|
-
import type { StructuralNode } from "../../structural-backend/types.js";
|
|
3
|
-
import { type BusinessFlowDraft } from "../business-flow-draft.js";
|
|
4
|
-
import type { StructuralFlowCatalog } from "../structural-flow-catalog.js";
|
|
5
|
-
export declare function nodeKey(capabilityKey: string, category: string, node: StructuralNode): string;
|
|
6
|
-
export declare function addBusinessNode(draft: BusinessFlowDraft, input: {
|
|
7
|
-
readonly key: string;
|
|
8
|
-
readonly kind: BusinessNodeKind;
|
|
9
|
-
readonly label: string;
|
|
10
|
-
readonly summary: string;
|
|
11
|
-
readonly evidence: StructuralNode;
|
|
12
|
-
readonly aliases?: readonly string[];
|
|
13
|
-
readonly certainty?: AssertionCertainty;
|
|
14
|
-
}): void;
|
|
15
|
-
export declare function addBusinessRelation(draft: BusinessFlowDraft, input: {
|
|
16
|
-
readonly from: string;
|
|
17
|
-
readonly type: Exclude<BusinessRelationType, "realized_by" | "verified_by">;
|
|
18
|
-
readonly to: string;
|
|
19
|
-
readonly evidence: StructuralNode;
|
|
20
|
-
readonly certainty?: AssertionCertainty;
|
|
21
|
-
}): void;
|
|
22
|
-
export declare function addStructuralRelation(draft: BusinessFlowDraft, input: {
|
|
23
|
-
readonly from: string;
|
|
24
|
-
readonly type: "realized_by" | "verified_by";
|
|
25
|
-
readonly to: StructuralNode;
|
|
26
|
-
readonly evidence?: StructuralNode;
|
|
27
|
-
readonly certainty?: AssertionCertainty;
|
|
28
|
-
}): void;
|
|
29
|
-
export declare function decoratorNames(node: StructuralNode): readonly string[];
|
|
30
|
-
export declare function hasDecorator(node: StructuralNode, names: readonly string[]): boolean;
|
|
31
|
-
export declare function hasBusinessOperationEvidence(node: StructuralNode, catalog: StructuralFlowCatalog): boolean;
|
|
32
|
-
//# sourceMappingURL=strategy-helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"strategy-helpers.d.ts","sourceRoot":"","sources":["../../../src/business-flow/strategies/strategy-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAElB,gBAAgB,EAEhB,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAsB,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAE3E,wBAAgB,OAAO,CACrB,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,cAAc,GACnB,MAAM,CAER;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,iBAAiB,EACxB,KAAK,EAAE;IACL,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,SAAS,CAAC,EAAE,kBAAkB,CAAC;CACzC,GACA,IAAI,CAWN;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,iBAAiB,EACxB,KAAK,EAAE;IACL,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,oBAAoB,EAAE,aAAa,GAAG,aAAa,CAAC,CAAC;IAC5E,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,SAAS,CAAC,EAAE,kBAAkB,CAAC;CACzC,GACA,IAAI,CASN;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,iBAAiB,EACxB,KAAK,EAAE;IACL,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,aAAa,GAAG,aAAa,CAAC;IAC7C,QAAQ,CAAC,EAAE,EAAE,cAAc,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC;IACnC,QAAQ,CAAC,SAAS,CAAC,EAAE,kBAAkB,CAAC;CACzC,GACA,IAAI,CASN;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,cAAc,GAAG,SAAS,MAAM,EAAE,CAItE;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAGpF;AAED,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAKT"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { businessKeySegment } from "../business-flow-draft.js";
|
|
2
|
-
export function nodeKey(capabilityKey, category, node) {
|
|
3
|
-
return `${capabilityKey}/${category}/${businessKeySegment(node.name, node.reference.id)}`;
|
|
4
|
-
}
|
|
5
|
-
export function addBusinessNode(draft, input) {
|
|
6
|
-
const node = {
|
|
7
|
-
key: input.key,
|
|
8
|
-
kind: input.kind,
|
|
9
|
-
label: input.label,
|
|
10
|
-
summary: input.summary,
|
|
11
|
-
aliases: [...(input.aliases ?? [])],
|
|
12
|
-
certainty: input.certainty ?? "inferred",
|
|
13
|
-
evidence: [draft.evidenceFor(input.evidence)],
|
|
14
|
-
};
|
|
15
|
-
draft.addNode(node);
|
|
16
|
-
}
|
|
17
|
-
export function addBusinessRelation(draft, input) {
|
|
18
|
-
const relation = {
|
|
19
|
-
from: { domain: "business", key: input.from },
|
|
20
|
-
type: input.type,
|
|
21
|
-
to: { domain: "business", key: input.to },
|
|
22
|
-
certainty: input.certainty ?? "inferred",
|
|
23
|
-
evidence: [draft.evidenceFor(input.evidence)],
|
|
24
|
-
};
|
|
25
|
-
draft.addRelation(relation);
|
|
26
|
-
}
|
|
27
|
-
export function addStructuralRelation(draft, input) {
|
|
28
|
-
const relation = {
|
|
29
|
-
from: { domain: "business", key: input.from },
|
|
30
|
-
type: input.type,
|
|
31
|
-
to: { domain: "structural", id: input.to.reference.id },
|
|
32
|
-
certainty: input.certainty ?? "inferred",
|
|
33
|
-
evidence: [draft.evidenceFor(input.evidence ?? input.to)],
|
|
34
|
-
};
|
|
35
|
-
draft.addRelation(relation);
|
|
36
|
-
}
|
|
37
|
-
export function decoratorNames(node) {
|
|
38
|
-
return node.decorators.map((decorator) => (decorator.replace(/^@/u, "").split("(", 1)[0].split(".").at(-1)));
|
|
39
|
-
}
|
|
40
|
-
export function hasDecorator(node, names) {
|
|
41
|
-
const decorators = decoratorNames(node);
|
|
42
|
-
return names.some((name) => decorators.includes(name));
|
|
43
|
-
}
|
|
44
|
-
export function hasBusinessOperationEvidence(node, catalog) {
|
|
45
|
-
if (hasDecorator(node, ["CommandHandler", "EventsHandler", "QueryHandler", "Resolver"])) {
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
return catalog.isRoot(node.reference.id);
|
|
49
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { StructuralNode } from "../../structural-backend/types.js";
|
|
2
|
-
import type { BusinessFlowDraft } from "../business-flow-draft.js";
|
|
3
|
-
import type { FrameworkBusinessStrategy } from "../framework-business-strategy.js";
|
|
4
|
-
import type { StructuralFlowCatalog } from "../structural-flow-catalog.js";
|
|
5
|
-
import type { BusinessFlowDerivationOptions } from "../types.js";
|
|
6
|
-
export declare class TypeOrmBusinessStrategy implements FrameworkBusinessStrategy {
|
|
7
|
-
derive(catalog: StructuralFlowCatalog, options: BusinessFlowDerivationOptions, draft: BusinessFlowDraft): void;
|
|
8
|
-
}
|
|
9
|
-
export declare function findTypeOrmEntities(catalog: StructuralFlowCatalog): StructuralNode[];
|
|
10
|
-
//# sourceMappingURL=typeorm-business-strategy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typeorm-business-strategy.d.ts","sourceRoot":"","sources":["../../../src/business-flow/strategies/typeorm-business-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AACnF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAWjE,qBAAa,uBAAwB,YAAW,yBAAyB;IACvE,MAAM,CACJ,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,6BAA6B,EACtC,KAAK,EAAE,iBAAiB,GACvB,IAAI;CAgER;AAoCD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,qBAAqB,GAAG,cAAc,EAAE,CAmBpF"}
|