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,415 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from "node:crypto";
|
|
2
|
-
import { closeSync, constants as fileSystemConstants, fsyncSync, fstatSync, linkSync, lstatSync, openSync, readFileSync, readdirSync, unlinkSync, writeFileSync, } from "node:fs";
|
|
3
|
-
import { basename, dirname, join } from "node:path";
|
|
4
|
-
import { currentProcessInstance, inspectProcessInstance, isProcessAlive, processStartedAfter, } from "./process-instance.js";
|
|
5
|
-
const OWNERSHIP_FILE_MARKER = ".owner-";
|
|
6
|
-
export class StructuralWriteLock {
|
|
7
|
-
#path;
|
|
8
|
-
#identity;
|
|
9
|
-
#ownership;
|
|
10
|
-
#ownershipPath;
|
|
11
|
-
#ownershipDescriptor;
|
|
12
|
-
constructor(path, identity, ownership, ownershipPath, ownershipDescriptor) {
|
|
13
|
-
this.#path = path;
|
|
14
|
-
this.#identity = identity;
|
|
15
|
-
this.#ownership = ownership;
|
|
16
|
-
this.#ownershipPath = ownershipPath;
|
|
17
|
-
this.#ownershipDescriptor = ownershipDescriptor;
|
|
18
|
-
}
|
|
19
|
-
static acquire(path) {
|
|
20
|
-
if (hasCompetingOwnershipLease(path)) {
|
|
21
|
-
return undefined;
|
|
22
|
-
}
|
|
23
|
-
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
24
|
-
const acquired = StructuralWriteLock.create(path);
|
|
25
|
-
if (acquired !== undefined) {
|
|
26
|
-
return acquired;
|
|
27
|
-
}
|
|
28
|
-
const existing = observeLock(path);
|
|
29
|
-
if (existing === undefined || isObservedOwnershipActive(path, existing)) {
|
|
30
|
-
return undefined;
|
|
31
|
-
}
|
|
32
|
-
if (!removeObservedLock(path, existing)) {
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
|
-
release() {
|
|
39
|
-
try {
|
|
40
|
-
removeObservedLock(this.#path, {
|
|
41
|
-
identity: this.#identity,
|
|
42
|
-
ownership: this.#ownership,
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
finally {
|
|
46
|
-
try {
|
|
47
|
-
removeObservedLock(this.#ownershipPath, {
|
|
48
|
-
identity: this.#identity,
|
|
49
|
-
ownership: this.#ownership,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
finally {
|
|
53
|
-
if (this.#ownershipDescriptor !== undefined) {
|
|
54
|
-
closeSync(this.#ownershipDescriptor);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
static create(path) {
|
|
60
|
-
const processInstance = currentProcessInstance();
|
|
61
|
-
const ownership = {
|
|
62
|
-
pid: process.pid,
|
|
63
|
-
token: randomUUID(),
|
|
64
|
-
instanceId: processInstance.id,
|
|
65
|
-
instanceProof: processInstance.proof,
|
|
66
|
-
};
|
|
67
|
-
const ownershipPath = ownershipFilePath(path, ownership);
|
|
68
|
-
let ownershipFileCreated = false;
|
|
69
|
-
let ownershipLeaseRetained = false;
|
|
70
|
-
let ownershipDescriptor;
|
|
71
|
-
try {
|
|
72
|
-
const noFollow = fileSystemConstants.O_NOFOLLOW ?? 0;
|
|
73
|
-
ownershipDescriptor = openSync(ownershipPath, fileSystemConstants.O_CREAT |
|
|
74
|
-
fileSystemConstants.O_EXCL |
|
|
75
|
-
fileSystemConstants.O_RDWR |
|
|
76
|
-
noFollow, 0o600);
|
|
77
|
-
ownershipFileCreated = true;
|
|
78
|
-
writeFileSync(ownershipDescriptor, serializeOwnership(ownership), { encoding: "utf8" });
|
|
79
|
-
persistOwnershipFile(ownershipDescriptor);
|
|
80
|
-
if (ownership.instanceProof !== "open-file") {
|
|
81
|
-
closeSync(ownershipDescriptor);
|
|
82
|
-
ownershipDescriptor = undefined;
|
|
83
|
-
}
|
|
84
|
-
if (hasCompetingOwnershipLease(path, ownershipPath)) {
|
|
85
|
-
return undefined;
|
|
86
|
-
}
|
|
87
|
-
// Publish only a complete owner record at the contested lock path.
|
|
88
|
-
try {
|
|
89
|
-
linkSync(ownershipPath, path);
|
|
90
|
-
}
|
|
91
|
-
catch (error) {
|
|
92
|
-
if (isFileSystemError(error, "EEXIST")) {
|
|
93
|
-
return undefined;
|
|
94
|
-
}
|
|
95
|
-
throw error;
|
|
96
|
-
}
|
|
97
|
-
const identity = lstatSync(path);
|
|
98
|
-
try {
|
|
99
|
-
persistDirectory(dirname(path));
|
|
100
|
-
}
|
|
101
|
-
catch (error) {
|
|
102
|
-
removeObservedLock(path, { identity, ownership });
|
|
103
|
-
throw error;
|
|
104
|
-
}
|
|
105
|
-
if (hasCompetingOwnershipLease(path, ownershipPath) ||
|
|
106
|
-
!matchesObservedLock(path, { identity, ownership })) {
|
|
107
|
-
removeObservedLock(path, { identity, ownership });
|
|
108
|
-
return undefined;
|
|
109
|
-
}
|
|
110
|
-
ownershipLeaseRetained = true;
|
|
111
|
-
return new StructuralWriteLock(path, identity, ownership, ownershipPath, ownershipDescriptor);
|
|
112
|
-
}
|
|
113
|
-
finally {
|
|
114
|
-
if (ownershipFileCreated && !ownershipLeaseRetained) {
|
|
115
|
-
try {
|
|
116
|
-
removeRegularFile(ownershipPath);
|
|
117
|
-
}
|
|
118
|
-
finally {
|
|
119
|
-
if (ownershipDescriptor !== undefined) {
|
|
120
|
-
closeSync(ownershipDescriptor);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
function persistOwnershipFile(descriptor) {
|
|
128
|
-
fsyncSync(descriptor);
|
|
129
|
-
}
|
|
130
|
-
function persistDirectory(path) {
|
|
131
|
-
if (process.platform === "win32") {
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
const descriptor = openSync(path, fileSystemConstants.O_RDONLY);
|
|
135
|
-
try {
|
|
136
|
-
fsyncSync(descriptor);
|
|
137
|
-
}
|
|
138
|
-
finally {
|
|
139
|
-
closeSync(descriptor);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
function ownershipFilePath(path, ownership) {
|
|
143
|
-
if (ownership.instanceId === undefined) {
|
|
144
|
-
throw new Error("The structural lock owner lease requires a process instance identity");
|
|
145
|
-
}
|
|
146
|
-
if (ownership.instanceProof === undefined) {
|
|
147
|
-
throw new Error("The structural lock owner lease requires a process instance proof");
|
|
148
|
-
}
|
|
149
|
-
return `${path}${OWNERSHIP_FILE_MARKER}${ownership.pid}-${ownership.instanceProof}-${ownership.instanceId}-${ownership.token}`;
|
|
150
|
-
}
|
|
151
|
-
function hasCompetingOwnershipLease(lockPath, ownOwnershipPath) {
|
|
152
|
-
const directory = dirname(lockPath);
|
|
153
|
-
const prefix = `${basename(lockPath)}${OWNERSHIP_FILE_MARKER}`;
|
|
154
|
-
let entries;
|
|
155
|
-
try {
|
|
156
|
-
entries = readdirSync(directory);
|
|
157
|
-
}
|
|
158
|
-
catch {
|
|
159
|
-
return true;
|
|
160
|
-
}
|
|
161
|
-
for (const entry of entries) {
|
|
162
|
-
const path = join(directory, entry);
|
|
163
|
-
if (path === ownOwnershipPath) {
|
|
164
|
-
continue;
|
|
165
|
-
}
|
|
166
|
-
const ownership = parseOwnershipFileName(entry, prefix);
|
|
167
|
-
if (ownership === undefined) {
|
|
168
|
-
continue;
|
|
169
|
-
}
|
|
170
|
-
const observed = observeLock(path);
|
|
171
|
-
if (observed === undefined ||
|
|
172
|
-
observed.ownership.pid !== ownership.pid ||
|
|
173
|
-
observed.ownership.token !== ownership.token ||
|
|
174
|
-
observed.ownership.instanceId !== ownership.instanceId ||
|
|
175
|
-
observed.ownership.instanceProof !== ownership.instanceProof) {
|
|
176
|
-
if (ownership.instanceId === undefined
|
|
177
|
-
? isLegacyLeasePathActive(lockPath, path, ownership.pid)
|
|
178
|
-
: isOwnershipActive(ownership, path)) {
|
|
179
|
-
return true;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
else if (observed.ownership.instanceId === undefined) {
|
|
183
|
-
if (isLegacyLeaseActive(lockPath, observed)) {
|
|
184
|
-
return true;
|
|
185
|
-
}
|
|
186
|
-
if (matchesObservedLock(lockPath, observed) &&
|
|
187
|
-
!removeObservedLock(lockPath, observed)) {
|
|
188
|
-
return true;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
else if (isOwnershipActive(observed.ownership, path, observed.identity)) {
|
|
192
|
-
return true;
|
|
193
|
-
}
|
|
194
|
-
if (!removeRegularFile(path) && pathExists(path)) {
|
|
195
|
-
return true;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
return false;
|
|
199
|
-
}
|
|
200
|
-
function parseOwnershipFileName(name, prefix) {
|
|
201
|
-
if (!name.startsWith(prefix)) {
|
|
202
|
-
return undefined;
|
|
203
|
-
}
|
|
204
|
-
const serializedOwnership = name.slice(prefix.length);
|
|
205
|
-
const match = /^(\d+)-(?:(?<instanceProof>process-start|open-file)-)?(?:(?<instanceId>[0-9a-f]{64})-)?(?<token>[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$/iu
|
|
206
|
-
.exec(serializedOwnership);
|
|
207
|
-
if (match === null) {
|
|
208
|
-
return undefined;
|
|
209
|
-
}
|
|
210
|
-
const serializedPid = match[1] ?? "";
|
|
211
|
-
const pid = /^\d+$/u.test(serializedPid)
|
|
212
|
-
? Number.parseInt(serializedPid, 10)
|
|
213
|
-
: Number.NaN;
|
|
214
|
-
const token = match.groups?.token ?? "";
|
|
215
|
-
const instanceId = match.groups?.instanceId;
|
|
216
|
-
const instanceProof = match.groups?.instanceProof;
|
|
217
|
-
if (!Number.isSafeInteger(pid) ||
|
|
218
|
-
pid <= 0 ||
|
|
219
|
-
!isUuid(token) ||
|
|
220
|
-
(instanceProof !== undefined && instanceId === undefined)) {
|
|
221
|
-
return undefined;
|
|
222
|
-
}
|
|
223
|
-
return {
|
|
224
|
-
pid,
|
|
225
|
-
token,
|
|
226
|
-
...(instanceId === undefined ? {} : { instanceId }),
|
|
227
|
-
...(instanceProof === undefined ? {} : { instanceProof }),
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
function isUuid(value) {
|
|
231
|
-
return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu.test(value);
|
|
232
|
-
}
|
|
233
|
-
function removeRegularFile(path) {
|
|
234
|
-
let identity;
|
|
235
|
-
try {
|
|
236
|
-
identity = lstatSync(path);
|
|
237
|
-
}
|
|
238
|
-
catch {
|
|
239
|
-
return false;
|
|
240
|
-
}
|
|
241
|
-
if (!identity.isFile() || identity.isSymbolicLink()) {
|
|
242
|
-
return false;
|
|
243
|
-
}
|
|
244
|
-
try {
|
|
245
|
-
const current = lstatSync(path);
|
|
246
|
-
if (current.dev !== identity.dev || current.ino !== identity.ino) {
|
|
247
|
-
return false;
|
|
248
|
-
}
|
|
249
|
-
unlinkSync(path);
|
|
250
|
-
return true;
|
|
251
|
-
}
|
|
252
|
-
catch {
|
|
253
|
-
return false;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
function pathExists(path) {
|
|
257
|
-
try {
|
|
258
|
-
lstatSync(path);
|
|
259
|
-
return true;
|
|
260
|
-
}
|
|
261
|
-
catch (error) {
|
|
262
|
-
return !isFileSystemError(error, "ENOENT");
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
function observeLock(path) {
|
|
266
|
-
let descriptor;
|
|
267
|
-
try {
|
|
268
|
-
const identity = lstatSync(path);
|
|
269
|
-
if (!identity.isFile() || identity.isSymbolicLink()) {
|
|
270
|
-
return undefined;
|
|
271
|
-
}
|
|
272
|
-
descriptor = openSync(path, fileSystemConstants.O_RDONLY | (fileSystemConstants.O_NOFOLLOW ?? 0));
|
|
273
|
-
const openedIdentity = fstatSync(descriptor);
|
|
274
|
-
if (openedIdentity.dev !== identity.dev ||
|
|
275
|
-
openedIdentity.ino !== identity.ino) {
|
|
276
|
-
return undefined;
|
|
277
|
-
}
|
|
278
|
-
const ownership = parseOwnership(readFileSync(descriptor, "utf8"));
|
|
279
|
-
return ownership === undefined ? undefined : { identity: openedIdentity, ownership };
|
|
280
|
-
}
|
|
281
|
-
catch {
|
|
282
|
-
return undefined;
|
|
283
|
-
}
|
|
284
|
-
finally {
|
|
285
|
-
if (descriptor !== undefined) {
|
|
286
|
-
closeSync(descriptor);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
function removeObservedLock(path, expected) {
|
|
291
|
-
if (!matchesObservedLock(path, expected)) {
|
|
292
|
-
return false;
|
|
293
|
-
}
|
|
294
|
-
try {
|
|
295
|
-
unlinkSync(path);
|
|
296
|
-
return true;
|
|
297
|
-
}
|
|
298
|
-
catch {
|
|
299
|
-
return false;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
function matchesObservedLock(path, expected) {
|
|
303
|
-
const current = observeLock(path);
|
|
304
|
-
return current !== undefined &&
|
|
305
|
-
current.identity.dev === expected.identity.dev &&
|
|
306
|
-
current.identity.ino === expected.identity.ino &&
|
|
307
|
-
current.ownership.pid === expected.ownership.pid &&
|
|
308
|
-
current.ownership.token === expected.ownership.token &&
|
|
309
|
-
current.ownership.instanceId === expected.ownership.instanceId &&
|
|
310
|
-
current.ownership.instanceProof === expected.ownership.instanceProof;
|
|
311
|
-
}
|
|
312
|
-
function serializeOwnership(ownership) {
|
|
313
|
-
return `${JSON.stringify(ownership)}\n`;
|
|
314
|
-
}
|
|
315
|
-
function parseOwnership(value) {
|
|
316
|
-
try {
|
|
317
|
-
const parsed = JSON.parse(value);
|
|
318
|
-
const pid = typeof parsed === "object" && parsed !== null && "pid" in parsed
|
|
319
|
-
? parsed.pid
|
|
320
|
-
: undefined;
|
|
321
|
-
const token = typeof parsed === "object" && parsed !== null && "token" in parsed
|
|
322
|
-
? parsed.token
|
|
323
|
-
: undefined;
|
|
324
|
-
const instanceId = typeof parsed === "object" && parsed !== null && "instanceId" in parsed
|
|
325
|
-
? parsed.instanceId
|
|
326
|
-
: undefined;
|
|
327
|
-
const instanceProof = typeof parsed === "object" && parsed !== null && "instanceProof" in parsed
|
|
328
|
-
? parsed.instanceProof
|
|
329
|
-
: undefined;
|
|
330
|
-
if (typeof pid !== "number" ||
|
|
331
|
-
!Number.isSafeInteger(pid) ||
|
|
332
|
-
pid <= 0 ||
|
|
333
|
-
typeof token !== "string" ||
|
|
334
|
-
token.length === 0 ||
|
|
335
|
-
(instanceId !== undefined && !isProcessInstanceId(instanceId)) ||
|
|
336
|
-
(instanceProof !== undefined && !isProcessInstanceProof(instanceProof)) ||
|
|
337
|
-
(instanceProof !== undefined && instanceId === undefined)) {
|
|
338
|
-
return undefined;
|
|
339
|
-
}
|
|
340
|
-
return {
|
|
341
|
-
pid,
|
|
342
|
-
token,
|
|
343
|
-
...(instanceId === undefined ? {} : { instanceId }),
|
|
344
|
-
...(instanceProof === undefined ? {} : { instanceProof }),
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
|
-
catch {
|
|
348
|
-
return undefined;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
function isOwnershipActive(ownership, leasePath, leaseIdentity) {
|
|
352
|
-
if (ownership.instanceId === undefined) {
|
|
353
|
-
return isProcessAlive(ownership.pid);
|
|
354
|
-
}
|
|
355
|
-
let identity;
|
|
356
|
-
try {
|
|
357
|
-
identity = leaseIdentity ?? lstatSync(leasePath);
|
|
358
|
-
}
|
|
359
|
-
catch {
|
|
360
|
-
return false;
|
|
361
|
-
}
|
|
362
|
-
const status = inspectProcessInstance(ownership.pid, ownership.instanceId, ownership.instanceProof ?? "process-start", {
|
|
363
|
-
path: leasePath,
|
|
364
|
-
device: identity.dev,
|
|
365
|
-
inode: identity.ino,
|
|
366
|
-
writtenAtMs: Math.max(identity.birthtimeMs, identity.ctimeMs),
|
|
367
|
-
});
|
|
368
|
-
return status === "matching" || status === "unknown";
|
|
369
|
-
}
|
|
370
|
-
function isObservedOwnershipActive(lockPath, lock) {
|
|
371
|
-
return lock.ownership.instanceId === undefined
|
|
372
|
-
? isLegacyLeaseActive(lockPath, lock)
|
|
373
|
-
: isOwnershipActive(lock.ownership, lockPath, lock.identity);
|
|
374
|
-
}
|
|
375
|
-
function isLegacyLeaseActive(lockPath, lease) {
|
|
376
|
-
return isLegacyLeasePathActive(lockPath, lease.identity, lease.ownership.pid);
|
|
377
|
-
}
|
|
378
|
-
function isLegacyLeasePathActive(lockPath, leasePathOrIdentity, pid) {
|
|
379
|
-
if (!isProcessAlive(pid)) {
|
|
380
|
-
return false;
|
|
381
|
-
}
|
|
382
|
-
let leaseIdentity;
|
|
383
|
-
try {
|
|
384
|
-
leaseIdentity = typeof leasePathOrIdentity === "string"
|
|
385
|
-
? lstatSync(leasePathOrIdentity)
|
|
386
|
-
: leasePathOrIdentity;
|
|
387
|
-
}
|
|
388
|
-
catch {
|
|
389
|
-
return false;
|
|
390
|
-
}
|
|
391
|
-
try {
|
|
392
|
-
const fixedIdentity = lstatSync(lockPath);
|
|
393
|
-
const sameLease = fixedIdentity.isFile() &&
|
|
394
|
-
!fixedIdentity.isSymbolicLink() &&
|
|
395
|
-
fixedIdentity.dev === leaseIdentity.dev &&
|
|
396
|
-
fixedIdentity.ino === leaseIdentity.ino;
|
|
397
|
-
if (!sameLease) {
|
|
398
|
-
return false;
|
|
399
|
-
}
|
|
400
|
-
const leaseWrittenAtMs = Math.max(leaseIdentity.birthtimeMs, leaseIdentity.ctimeMs);
|
|
401
|
-
return processStartedAfter(pid, leaseWrittenAtMs) !== true;
|
|
402
|
-
}
|
|
403
|
-
catch {
|
|
404
|
-
return false;
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
function isProcessInstanceId(value) {
|
|
408
|
-
return typeof value === "string" && /^[0-9a-f]{64}$/u.test(value);
|
|
409
|
-
}
|
|
410
|
-
function isProcessInstanceProof(value) {
|
|
411
|
-
return value === "process-start" || value === "open-file";
|
|
412
|
-
}
|
|
413
|
-
function isFileSystemError(error, code) {
|
|
414
|
-
return error instanceof Error && "code" in error && error.code === code;
|
|
415
|
-
}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import type { z } from "zod";
|
|
2
|
-
import type { structuralProvenanceSchema, structuralSupportSchema, structuralSupportStatusSchema } from "../contracts/graph.js";
|
|
3
|
-
export declare const STRUCTURAL_BACKEND_VERSION = "1.5.0";
|
|
4
|
-
export type StructuralProjectionCompleteness = "missing" | "complete" | "incomplete";
|
|
5
|
-
export type StructuralSupportStatus = z.infer<typeof structuralSupportStatusSchema>;
|
|
6
|
-
export type StructuralProvenance = z.infer<typeof structuralProvenanceSchema>;
|
|
7
|
-
export type BackendStructuralNodeKind = "Module" | "File" | "Symbol" | "Test";
|
|
8
|
-
export type BackendDeclarationKind = "file" | "module" | "class" | "struct" | "interface" | "trait" | "protocol" | "function" | "method" | "property" | "field" | "variable" | "constant" | "enum" | "enum_member" | "type_alias" | "namespace" | "parameter" | "import" | "export" | "route" | "component" | "test" | "virtual_module";
|
|
9
|
-
export type BackendStructuralRelationType = "contains" | "declares" | "imports" | "exports" | "references" | "calls" | "extends" | "implements" | "instantiates" | "decorated_by";
|
|
10
|
-
export type StructuralSupport = z.infer<typeof structuralSupportSchema>;
|
|
11
|
-
export interface StructuralReference {
|
|
12
|
-
readonly id: string;
|
|
13
|
-
}
|
|
14
|
-
export interface StructuralSourcePosition {
|
|
15
|
-
readonly line: number;
|
|
16
|
-
readonly column: number;
|
|
17
|
-
}
|
|
18
|
-
export interface StructuralSourceRange {
|
|
19
|
-
readonly start: StructuralSourcePosition;
|
|
20
|
-
readonly end: StructuralSourcePosition;
|
|
21
|
-
}
|
|
22
|
-
export interface StructuralNode {
|
|
23
|
-
readonly reference: StructuralReference;
|
|
24
|
-
readonly kind: BackendStructuralNodeKind;
|
|
25
|
-
readonly declarationKind: BackendDeclarationKind;
|
|
26
|
-
readonly decorators: readonly string[];
|
|
27
|
-
readonly name: string;
|
|
28
|
-
readonly qualifiedName: string;
|
|
29
|
-
readonly path: string;
|
|
30
|
-
readonly language: string;
|
|
31
|
-
readonly range: StructuralSourceRange;
|
|
32
|
-
readonly support: StructuralSupport;
|
|
33
|
-
readonly virtual?: boolean;
|
|
34
|
-
}
|
|
35
|
-
export interface StructuralRelation {
|
|
36
|
-
readonly from: StructuralReference;
|
|
37
|
-
readonly type: BackendStructuralRelationType;
|
|
38
|
-
readonly to: StructuralReference;
|
|
39
|
-
readonly support: StructuralSupport;
|
|
40
|
-
readonly location?: {
|
|
41
|
-
readonly path: string;
|
|
42
|
-
readonly position: StructuralSourcePosition;
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
export interface StructuralUnknownBoundary {
|
|
46
|
-
readonly reference: StructuralReference;
|
|
47
|
-
readonly kind: "UnknownBoundary";
|
|
48
|
-
readonly owner: StructuralReference;
|
|
49
|
-
readonly operation: string;
|
|
50
|
-
readonly target?: string;
|
|
51
|
-
readonly reason: string;
|
|
52
|
-
readonly path?: string;
|
|
53
|
-
readonly position?: StructuralSourcePosition;
|
|
54
|
-
readonly candidates: readonly string[];
|
|
55
|
-
readonly support: StructuralSupport;
|
|
56
|
-
}
|
|
57
|
-
export interface StructuralDiagnostic {
|
|
58
|
-
readonly code: "STRUCTURAL_BACKEND_FAILURE" | "STRUCTURAL_INDEX_INCOMPLETE";
|
|
59
|
-
readonly message: string;
|
|
60
|
-
}
|
|
61
|
-
export interface StructuralIndexState {
|
|
62
|
-
readonly completeness: StructuralProjectionCompleteness;
|
|
63
|
-
readonly databasePath: string;
|
|
64
|
-
readonly backendVersion: string;
|
|
65
|
-
readonly extractionVersion: number | null;
|
|
66
|
-
readonly indexedAt: string | null;
|
|
67
|
-
readonly diagnostics: readonly StructuralDiagnostic[];
|
|
68
|
-
}
|
|
69
|
-
export interface StructuralBuildCounts {
|
|
70
|
-
readonly filesDiscovered: number;
|
|
71
|
-
readonly filesIndexed: number;
|
|
72
|
-
readonly filesSkipped: number;
|
|
73
|
-
readonly filesErrored: number;
|
|
74
|
-
readonly nodes: number;
|
|
75
|
-
readonly relations: number;
|
|
76
|
-
}
|
|
77
|
-
export interface StructuralFileChanges {
|
|
78
|
-
readonly added: readonly string[];
|
|
79
|
-
readonly modified: readonly string[];
|
|
80
|
-
readonly removed: readonly string[];
|
|
81
|
-
}
|
|
82
|
-
export interface StructuralFactChanges {
|
|
83
|
-
readonly added: number;
|
|
84
|
-
readonly changed: number;
|
|
85
|
-
readonly reused: number;
|
|
86
|
-
readonly removed: number;
|
|
87
|
-
}
|
|
88
|
-
export interface StructuralBuildResult extends StructuralIndexState {
|
|
89
|
-
readonly mode: "initial" | "full" | "incremental";
|
|
90
|
-
readonly counts: StructuralBuildCounts;
|
|
91
|
-
readonly changes: StructuralFileChanges;
|
|
92
|
-
readonly factChanges: StructuralFactChanges;
|
|
93
|
-
readonly boundaries: readonly StructuralUnknownBoundary[];
|
|
94
|
-
}
|
|
95
|
-
export interface StructuralSearchQuery {
|
|
96
|
-
readonly query: string;
|
|
97
|
-
readonly limit?: number;
|
|
98
|
-
}
|
|
99
|
-
export interface StructuralSearchResult {
|
|
100
|
-
readonly score: number;
|
|
101
|
-
readonly node: StructuralNode;
|
|
102
|
-
}
|
|
103
|
-
export interface StructuralProjectGraphQuery {
|
|
104
|
-
readonly declarationKinds: readonly BackendDeclarationKind[];
|
|
105
|
-
}
|
|
106
|
-
export interface StructuralTraversalQuery {
|
|
107
|
-
readonly reference: StructuralReference;
|
|
108
|
-
readonly maxDepth?: number;
|
|
109
|
-
readonly direction?: "incoming" | "outgoing" | "both";
|
|
110
|
-
readonly relationTypes?: readonly BackendStructuralRelationType[];
|
|
111
|
-
}
|
|
112
|
-
export interface StructuralTraversalResult {
|
|
113
|
-
readonly roots: readonly StructuralReference[];
|
|
114
|
-
readonly nodes: readonly StructuralNode[];
|
|
115
|
-
readonly relations: readonly StructuralRelation[];
|
|
116
|
-
readonly boundaries: readonly StructuralUnknownBoundary[];
|
|
117
|
-
}
|
|
118
|
-
export interface StructuralCallRelation {
|
|
119
|
-
readonly node: StructuralNode;
|
|
120
|
-
readonly relation: StructuralRelation;
|
|
121
|
-
}
|
|
122
|
-
export interface StructuralFileDependency {
|
|
123
|
-
readonly path: string;
|
|
124
|
-
readonly support: StructuralSupport;
|
|
125
|
-
}
|
|
126
|
-
export interface StructuralIndexBackend {
|
|
127
|
-
inspect(): Promise<StructuralIndexState>;
|
|
128
|
-
build(): Promise<StructuralBuildResult>;
|
|
129
|
-
sync(): Promise<StructuralBuildResult>;
|
|
130
|
-
listRoots(): Promise<readonly StructuralNode[]>;
|
|
131
|
-
readProjectGraph(query: StructuralProjectGraphQuery): Promise<StructuralTraversalResult>;
|
|
132
|
-
search(query: StructuralSearchQuery): Promise<readonly StructuralSearchResult[]>;
|
|
133
|
-
getNode(reference: StructuralReference): Promise<StructuralNode | undefined>;
|
|
134
|
-
traverse(query: StructuralTraversalQuery): Promise<StructuralTraversalResult>;
|
|
135
|
-
getCallers(reference: StructuralReference): Promise<readonly StructuralCallRelation[]>;
|
|
136
|
-
getCallees(reference: StructuralReference): Promise<readonly StructuralCallRelation[]>;
|
|
137
|
-
getFileDependencies(path: string): Promise<readonly StructuralFileDependency[]>;
|
|
138
|
-
}
|
|
139
|
-
export declare class StructuralBackendError extends Error {
|
|
140
|
-
readonly code: "STRUCTURAL_INDEX_MISSING" | "STRUCTURAL_INDEX_INCOMPLETE" | "STRUCTURAL_QUERY_FAILED";
|
|
141
|
-
readonly cause: unknown;
|
|
142
|
-
constructor(code: StructuralBackendError["code"], message: string, cause?: unknown);
|
|
143
|
-
}
|
|
144
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/structural-backend/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EACV,0BAA0B,EAC1B,uBAAuB,EACvB,6BAA6B,EAC9B,MAAM,uBAAuB,CAAC;AAE/B,eAAO,MAAM,0BAA0B,UAAU,CAAC;AAElD,MAAM,MAAM,gCAAgC,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,CAAC;AACrF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,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
|
|
1
|
-
export const STRUCTURAL_BACKEND_VERSION = "1.5.0";
|
|
2
|
-
export class StructuralBackendError extends Error {
|
|
3
|
-
code;
|
|
4
|
-
cause;
|
|
5
|
-
constructor(code, message, cause) {
|
|
6
|
-
super(message);
|
|
7
|
-
this.name = "StructuralBackendError";
|
|
8
|
-
this.code = code;
|
|
9
|
-
this.cause = cause;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { PrimaryRepositoryCatalog } from "./primary-repository-catalog.js";
|
|
2
|
-
import type { WebBusinessMap, WebBusinessNode, WebBusinessSearch, WebProjectStatus, WebProjectSummary } from "./types.js";
|
|
3
|
-
export type AtlasReadErrorCode = "PROJECT_NOT_FOUND" | "BUSINESS_NODE_NOT_FOUND" | "ATLAS_STATE_UNAVAILABLE" | "PUBLICATION_CHANGED";
|
|
4
|
-
export declare class AtlasReadError extends Error {
|
|
5
|
-
readonly statusCode: 404 | 409;
|
|
6
|
-
readonly code: AtlasReadErrorCode;
|
|
7
|
-
constructor(statusCode: 404 | 409, code: AtlasReadErrorCode, message: string);
|
|
8
|
-
}
|
|
9
|
-
export interface AtlasReadOperations {
|
|
10
|
-
listProjects(): Promise<readonly WebProjectSummary[]>;
|
|
11
|
-
getStatus(repositoryId: string): Promise<WebProjectStatus>;
|
|
12
|
-
getMap(repositoryId: string, focusKey?: string): Promise<WebBusinessMap>;
|
|
13
|
-
searchBusiness(repositoryId: string, query: string, limit: number): Promise<WebBusinessSearch>;
|
|
14
|
-
getBusinessNode(repositoryId: string, businessKey: string): Promise<WebBusinessNode>;
|
|
15
|
-
}
|
|
16
|
-
export declare class AtlasReadService implements AtlasReadOperations {
|
|
17
|
-
#private;
|
|
18
|
-
constructor(catalog?: PrimaryRepositoryCatalog);
|
|
19
|
-
listProjects(): Promise<readonly WebProjectSummary[]>;
|
|
20
|
-
getStatus(repositoryId: string): Promise<WebProjectStatus>;
|
|
21
|
-
getMap(repositoryId: string, focusKey?: string): Promise<WebBusinessMap>;
|
|
22
|
-
searchBusiness(repositoryId: string, queryText: string, limit: number): Promise<WebBusinessSearch>;
|
|
23
|
-
getBusinessNode(repositoryId: string, businessKey: string): Promise<WebBusinessNode>;
|
|
24
|
-
private withPublishedWorld;
|
|
25
|
-
private withRepositoryRead;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=atlas-read-service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"atlas-read-service.d.ts","sourceRoot":"","sources":["../../../src/web/application/atlas-read-service.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,wBAAwB,EAEzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,kBAAkB,GAC1B,mBAAmB,GACnB,yBAAyB,GACzB,yBAAyB,GACzB,qBAAqB,CAAC;AAE1B,qBAAa,cAAe,SAAQ,KAAK;IAErC,QAAQ,CAAC,UAAU,EAAE,GAAG,GAAG,GAAG;IAC9B,QAAQ,CAAC,IAAI,EAAE,kBAAkB;gBADxB,UAAU,EAAE,GAAG,GAAG,GAAG,EACrB,IAAI,EAAE,kBAAkB,EACjC,OAAO,EAAE,MAAM;CAKlB;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,IAAI,OAAO,CAAC,SAAS,iBAAiB,EAAE,CAAC,CAAC;IACtD,SAAS,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC3D,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACzE,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IA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