@x12i/memorix-service 0.0.0-bootstrap.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -0
- package/dist/app.d.ts +21 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +67 -0
- package/dist/app.js.map +1 -0
- package/dist/catalog-bridge.d.ts +7 -0
- package/dist/catalog-bridge.d.ts.map +1 -0
- package/dist/catalog-bridge.js +155 -0
- package/dist/catalog-bridge.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +36 -0
- package/dist/cli.js.map +1 -0
- package/dist/errors.d.ts +25 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +79 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/isolation.d.ts +63 -0
- package/dist/isolation.d.ts.map +1 -0
- package/dist/isolation.js +175 -0
- package/dist/isolation.js.map +1 -0
- package/dist/known-packs.d.ts +5 -0
- package/dist/known-packs.d.ts.map +1 -0
- package/dist/known-packs.js +26 -0
- package/dist/known-packs.js.map +1 -0
- package/dist/mongo-metadata-store.d.ts +17 -0
- package/dist/mongo-metadata-store.d.ts.map +1 -0
- package/dist/mongo-metadata-store.js +81 -0
- package/dist/mongo-metadata-store.js.map +1 -0
- package/dist/openapi/openapi.json +6431 -0
- package/dist/platform.d.ts +52 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/platform.js +246 -0
- package/dist/platform.js.map +1 -0
- package/dist/relationships/operator-links.d.ts +23 -0
- package/dist/relationships/operator-links.d.ts.map +1 -0
- package/dist/relationships/operator-links.js +41 -0
- package/dist/relationships/operator-links.js.map +1 -0
- package/dist/request-scope.d.ts +7 -0
- package/dist/request-scope.d.ts.map +1 -0
- package/dist/request-scope.js +24 -0
- package/dist/request-scope.js.map +1 -0
- package/dist/routes/data.d.ts +4 -0
- package/dist/routes/data.d.ts.map +1 -0
- package/dist/routes/data.js +237 -0
- package/dist/routes/data.js.map +1 -0
- package/dist/routes/intelligence.d.ts +5 -0
- package/dist/routes/intelligence.d.ts.map +1 -0
- package/dist/routes/intelligence.js +94 -0
- package/dist/routes/intelligence.js.map +1 -0
- package/dist/routes/memory.d.ts +4 -0
- package/dist/routes/memory.d.ts.map +1 -0
- package/dist/routes/memory.js +80 -0
- package/dist/routes/memory.js.map +1 -0
- package/dist/routes/metadata.d.ts +4 -0
- package/dist/routes/metadata.d.ts.map +1 -0
- package/dist/routes/metadata.js +104 -0
- package/dist/routes/metadata.js.map +1 -0
- package/dist/routes/operations.d.ts +4 -0
- package/dist/routes/operations.d.ts.map +1 -0
- package/dist/routes/operations.js +66 -0
- package/dist/routes/operations.js.map +1 -0
- package/dist/routes/pipelines.d.ts +4 -0
- package/dist/routes/pipelines.d.ts.map +1 -0
- package/dist/routes/pipelines.js +128 -0
- package/dist/routes/pipelines.js.map +1 -0
- package/dist/routes/relationships.d.ts +4 -0
- package/dist/routes/relationships.d.ts.map +1 -0
- package/dist/routes/relationships.js +138 -0
- package/dist/routes/relationships.js.map +1 -0
- package/dist/routes/workflow.d.ts +4 -0
- package/dist/routes/workflow.d.ts.map +1 -0
- package/dist/routes/workflow.js +104 -0
- package/dist/routes/workflow.js.map +1 -0
- package/dist/scope.d.ts +19 -0
- package/dist/scope.d.ts.map +1 -0
- package/dist/scope.js +53 -0
- package/dist/scope.js.map +1 -0
- package/openapi/openapi.json +6431 -0
- package/package.json +65 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Production platform composition root — live wiring to accepted packages.
|
|
3
|
+
* Org-scoped metadata store; fail-closed when ports missing in prod.
|
|
4
|
+
*/
|
|
5
|
+
import { MongoClient, type Db } from "mongodb";
|
|
6
|
+
import { type UnifiedMetadataClient } from "@x12i/memorix-metadata-runtime";
|
|
7
|
+
import { type MemorixContentReader, type MemorixContentWriter, type MemorixAbstractWriter } from "@x12i/memorix-data";
|
|
8
|
+
import { type RelationshipEngine } from "@x12i/memorix-relationships";
|
|
9
|
+
import { type MemoryCollector } from "@x12i/memorix-memory";
|
|
10
|
+
import { type IntelligenceArtifactPersistence } from "@x12i/memorix-intelligence";
|
|
11
|
+
import { type RunLedger, type PipelineRuntime } from "@x12i/memorix-pipeline/v2";
|
|
12
|
+
import { ServiceError } from "./errors.js";
|
|
13
|
+
import { type ServiceCatalog } from "./catalog-bridge.js";
|
|
14
|
+
import type { MemorixScope } from "./scope.js";
|
|
15
|
+
import { type IsolationSession } from "./isolation.js";
|
|
16
|
+
export type RuntimeMode = "dev" | "prod";
|
|
17
|
+
export type PlatformDeps = {
|
|
18
|
+
mode: RuntimeMode;
|
|
19
|
+
mongoUri?: string;
|
|
20
|
+
client?: MongoClient;
|
|
21
|
+
allowMemoryMetadata?: boolean;
|
|
22
|
+
/** When set, metadata is isolated to session.orgId_metadata (acceptance). */
|
|
23
|
+
isolation?: IsolationSession;
|
|
24
|
+
};
|
|
25
|
+
export type OrgPorts = {
|
|
26
|
+
catalog: ServiceCatalog;
|
|
27
|
+
reader: MemorixContentReader;
|
|
28
|
+
writer: MemorixContentWriter;
|
|
29
|
+
abstractWriter: MemorixAbstractWriter;
|
|
30
|
+
relationships: RelationshipEngine;
|
|
31
|
+
memory: MemoryCollector;
|
|
32
|
+
pipeline: PipelineRuntime;
|
|
33
|
+
};
|
|
34
|
+
export type MemorixPlatform = {
|
|
35
|
+
mode: RuntimeMode;
|
|
36
|
+
client: MongoClient | null;
|
|
37
|
+
metadata: UnifiedMetadataClient;
|
|
38
|
+
isolation: IsolationSession | null;
|
|
39
|
+
operationalDbFor(orgId: string): Db;
|
|
40
|
+
metadataDbFor(orgId: string): Db;
|
|
41
|
+
pipelineLedgerFor(orgId: string): RunLedger;
|
|
42
|
+
intelligenceArtifactsFor(orgId: string): IntelligenceArtifactPersistence;
|
|
43
|
+
/** Fail-closed: throws if ports cannot be constructed. */
|
|
44
|
+
portsFor(scope: MemorixScope): OrgPorts;
|
|
45
|
+
close(): Promise<void>;
|
|
46
|
+
diagnostics(scope: MemorixScope): Record<string, unknown>;
|
|
47
|
+
};
|
|
48
|
+
export declare class PlatformStartupError extends ServiceError {
|
|
49
|
+
constructor(message: string);
|
|
50
|
+
}
|
|
51
|
+
export declare function createMemorixPlatform(deps: PlatformDeps): Promise<MemorixPlatform>;
|
|
52
|
+
//# sourceMappingURL=platform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAGL,KAAK,qBAAqB,EAC3B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAKL,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC3B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAGL,KAAK,+BAA+B,EACrC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,eAAe,EACrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAK3C,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AAExB,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,MAAM,CAAC;AAEzC,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,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CA4P1B"}
|
package/dist/platform.js
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Production platform composition root — live wiring to accepted packages.
|
|
3
|
+
* Org-scoped metadata store; fail-closed when ports missing in prod.
|
|
4
|
+
*/
|
|
5
|
+
import { MongoClient } from "mongodb";
|
|
6
|
+
import { createInMemoryMetadataStore, createMetadataClient, } from "@x12i/memorix-metadata-runtime";
|
|
7
|
+
import { createMongoContentReader, createMongoContentWriter, createMongoAbstractWriter, createMongoDataPlane, } from "@x12i/memorix-data";
|
|
8
|
+
import { createMongoRelationshipStore } from "@x12i/memorix-relationship-store";
|
|
9
|
+
import { createRelationshipEngine, } from "@x12i/memorix-relationships";
|
|
10
|
+
import { createMemoryCollector, createMongoMemoryRunStore, createStaticCredentialProvider, createOpsFixtureConnector, } from "@x12i/memorix-memory";
|
|
11
|
+
import { createIntelligenceArtifactPersistence, createMongoRunLedger, } from "@x12i/memorix-intelligence";
|
|
12
|
+
import { createMongoRunLedger as createPipelineLedger, createPipelineRuntime, createLivePortRegistry, } from "@x12i/memorix-pipeline/v2";
|
|
13
|
+
import { ServiceError } from "./errors.js";
|
|
14
|
+
import { createMongoMetadataStore, } from "./mongo-metadata-store.js";
|
|
15
|
+
import { catalogFromMetadataClient, relationshipMetadataResolver, } from "./catalog-bridge.js";
|
|
16
|
+
import { assertSafeAcceptanceOrgId, recordCreatedDatabase, } from "./isolation.js";
|
|
17
|
+
export class PlatformStartupError extends ServiceError {
|
|
18
|
+
constructor(message) {
|
|
19
|
+
super("PLATFORM_STARTUP_FAILED", message, 503);
|
|
20
|
+
this.name = "PlatformStartupError";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export async function createMemorixPlatform(deps) {
|
|
24
|
+
if (deps.mode !== "dev" && deps.mode !== "prod") {
|
|
25
|
+
throw new PlatformStartupError(`mode must be "dev" or "prod"`);
|
|
26
|
+
}
|
|
27
|
+
let client = null;
|
|
28
|
+
const ledgers = new Map();
|
|
29
|
+
const intelStores = new Map();
|
|
30
|
+
const portsCache = new Map();
|
|
31
|
+
let durableMetadata = null;
|
|
32
|
+
if (deps.mode === "prod") {
|
|
33
|
+
if (!deps.mongoUri && !deps.client) {
|
|
34
|
+
throw new PlatformStartupError("prod mode requires durable mongoUri (or injected MongoClient); no in-memory fallback");
|
|
35
|
+
}
|
|
36
|
+
if (deps.allowMemoryMetadata) {
|
|
37
|
+
throw new PlatformStartupError("prod mode rejects allowMemoryMetadata / in-memory metadata store");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (deps.client) {
|
|
41
|
+
client = deps.client;
|
|
42
|
+
}
|
|
43
|
+
else if (deps.mongoUri) {
|
|
44
|
+
client = new MongoClient(deps.mongoUri);
|
|
45
|
+
await client.connect();
|
|
46
|
+
}
|
|
47
|
+
else if (deps.mode === "dev") {
|
|
48
|
+
client = null;
|
|
49
|
+
}
|
|
50
|
+
if (deps.mode === "prod" && !client) {
|
|
51
|
+
throw new PlatformStartupError("prod mode requires connected MongoClient");
|
|
52
|
+
}
|
|
53
|
+
if (deps.isolation) {
|
|
54
|
+
assertSafeAcceptanceOrgId(deps.isolation.orgId);
|
|
55
|
+
}
|
|
56
|
+
let metadata;
|
|
57
|
+
if (deps.mode === "prod" || (client && !deps.allowMemoryMetadata)) {
|
|
58
|
+
const metaDbName = deps.isolation
|
|
59
|
+
? deps.isolation.isolatedMetadataDb
|
|
60
|
+
: "memorix_platform_metadata";
|
|
61
|
+
if (deps.isolation) {
|
|
62
|
+
// Touch creates DB; record in ledger
|
|
63
|
+
recordCreatedDatabase(deps.isolation, metaDbName);
|
|
64
|
+
}
|
|
65
|
+
const metaDb = client.db(metaDbName);
|
|
66
|
+
durableMetadata = createMongoMetadataStore(metaDb);
|
|
67
|
+
await durableMetadata.hydrate();
|
|
68
|
+
metadata = createMetadataClient(durableMetadata);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
metadata = createMetadataClient(createInMemoryMetadataStore());
|
|
72
|
+
}
|
|
73
|
+
function operationalDbFor(orgId) {
|
|
74
|
+
if (!client) {
|
|
75
|
+
throw new ServiceError("DURABLE_STORE_REQUIRED", "operational Mongo DB is required for this operation", 503);
|
|
76
|
+
}
|
|
77
|
+
if (deps.isolation) {
|
|
78
|
+
assertSafeAcceptanceOrgId(orgId);
|
|
79
|
+
if (orgId !== deps.isolation.orgId) {
|
|
80
|
+
throw new ServiceError("DB_ISOLATION_VIOLATION", "orgId does not match isolation session", 403);
|
|
81
|
+
}
|
|
82
|
+
recordCreatedDatabase(deps.isolation, `${orgId}_operational`);
|
|
83
|
+
}
|
|
84
|
+
return client.db(`${orgId}_operational`);
|
|
85
|
+
}
|
|
86
|
+
function metadataDbFor(orgId) {
|
|
87
|
+
if (!client) {
|
|
88
|
+
throw new ServiceError("DURABLE_STORE_REQUIRED", "mongo required", 503);
|
|
89
|
+
}
|
|
90
|
+
return client.db(`${orgId}_metadata`);
|
|
91
|
+
}
|
|
92
|
+
function pipelineLedgerFor(orgId) {
|
|
93
|
+
const existing = ledgers.get(orgId);
|
|
94
|
+
if (existing)
|
|
95
|
+
return existing;
|
|
96
|
+
if (deps.mode === "prod" || client) {
|
|
97
|
+
const ledger = createPipelineLedger(operationalDbFor(orgId));
|
|
98
|
+
ledgers.set(orgId, ledger);
|
|
99
|
+
return ledger;
|
|
100
|
+
}
|
|
101
|
+
throw new ServiceError("DURABLE_STORE_REQUIRED", "pipeline ledger requires durable mongo", 503);
|
|
102
|
+
}
|
|
103
|
+
function intelligenceArtifactsFor(orgId) {
|
|
104
|
+
const existing = intelStores.get(orgId);
|
|
105
|
+
if (existing)
|
|
106
|
+
return existing;
|
|
107
|
+
const ledger = createMongoRunLedger(operationalDbFor(orgId));
|
|
108
|
+
const store = createIntelligenceArtifactPersistence({
|
|
109
|
+
mode: deps.mode === "prod" ? "prod" : "dev",
|
|
110
|
+
orgId,
|
|
111
|
+
ledger,
|
|
112
|
+
allowMemoryArtifacts: false,
|
|
113
|
+
sessionId: `service:${orgId}`,
|
|
114
|
+
});
|
|
115
|
+
intelStores.set(orgId, store);
|
|
116
|
+
return store;
|
|
117
|
+
}
|
|
118
|
+
function portsFor(scope) {
|
|
119
|
+
if (!client) {
|
|
120
|
+
throw new ServiceError("CANONICAL_PORT_MISSING", "Mongo client required for data/relationship/memory/pipeline ports", 503);
|
|
121
|
+
}
|
|
122
|
+
const cacheKey = `${scope.orgId}:${scope.agentIds.join(",")}`;
|
|
123
|
+
const hit = portsCache.get(cacheKey);
|
|
124
|
+
if (hit)
|
|
125
|
+
return hit;
|
|
126
|
+
if (deps.isolation) {
|
|
127
|
+
assertSafeAcceptanceOrgId(scope.orgId);
|
|
128
|
+
for (const kind of ["entity", "event", "knowledge", "operational"]) {
|
|
129
|
+
recordCreatedDatabase(deps.isolation, `${scope.orgId}_${kind}`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
const catalog = catalogFromMetadataClient(metadata, scope.agentIds);
|
|
133
|
+
const plane = createMongoDataPlane(client);
|
|
134
|
+
const { writer } = createMongoContentWriter({ client, catalog, plane });
|
|
135
|
+
const { abstractWriter } = createMongoAbstractWriter({ client, catalog, plane });
|
|
136
|
+
const relationships = createRelationshipEngine({
|
|
137
|
+
client,
|
|
138
|
+
catalog,
|
|
139
|
+
metadataResolver: relationshipMetadataResolver(metadata),
|
|
140
|
+
});
|
|
141
|
+
const relStore = createMongoRelationshipStore({
|
|
142
|
+
client,
|
|
143
|
+
orgId: scope.orgId,
|
|
144
|
+
locator: {
|
|
145
|
+
async locate() {
|
|
146
|
+
return { dataCategory: "entity" };
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
const { reader } = createMongoContentReader({
|
|
151
|
+
client,
|
|
152
|
+
catalog,
|
|
153
|
+
plane,
|
|
154
|
+
relationshipStore: relStore,
|
|
155
|
+
});
|
|
156
|
+
const runStore = createMongoMemoryRunStore(client, scope.orgId);
|
|
157
|
+
const memory = createMemoryCollector({
|
|
158
|
+
writer,
|
|
159
|
+
reader,
|
|
160
|
+
runStore,
|
|
161
|
+
credentials: createStaticCredentialProvider({
|
|
162
|
+
// Local ops-source fixture only — values never appear in evidence/HAR bodies.
|
|
163
|
+
"ops-source-local": { token: "local-acceptance-token" },
|
|
164
|
+
}),
|
|
165
|
+
metadata: {
|
|
166
|
+
resolveSource(sourceId, agentIds) {
|
|
167
|
+
const def = metadata.getDefinition(agentIds, "sources", sourceId);
|
|
168
|
+
return def?.definition ?? null;
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
connectors: {
|
|
172
|
+
"ops-fixture": createOpsFixtureConnector(),
|
|
173
|
+
"rest-fixture": createOpsFixtureConnector(),
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
const portRegistry = createLivePortRegistry({
|
|
177
|
+
scope: { orgId: scope.orgId, agentIds: scope.agentIds },
|
|
178
|
+
collector: memory,
|
|
179
|
+
writer,
|
|
180
|
+
reader,
|
|
181
|
+
relationshipEngine: relationships,
|
|
182
|
+
honorForceFail: true,
|
|
183
|
+
});
|
|
184
|
+
const pipeline = createPipelineRuntime({
|
|
185
|
+
mode: deps.mode === "prod" ? "prod" : "dev",
|
|
186
|
+
orgId: scope.orgId,
|
|
187
|
+
agentIds: scope.agentIds,
|
|
188
|
+
operationalDb: operationalDbFor(scope.orgId),
|
|
189
|
+
ledger: pipelineLedgerFor(scope.orgId),
|
|
190
|
+
ports: portRegistry,
|
|
191
|
+
});
|
|
192
|
+
const orgPorts = {
|
|
193
|
+
catalog,
|
|
194
|
+
reader,
|
|
195
|
+
writer,
|
|
196
|
+
abstractWriter,
|
|
197
|
+
relationships,
|
|
198
|
+
memory,
|
|
199
|
+
pipeline,
|
|
200
|
+
};
|
|
201
|
+
portsCache.set(cacheKey, orgPorts);
|
|
202
|
+
return orgPorts;
|
|
203
|
+
}
|
|
204
|
+
return {
|
|
205
|
+
mode: deps.mode,
|
|
206
|
+
client,
|
|
207
|
+
metadata,
|
|
208
|
+
isolation: deps.isolation ?? null,
|
|
209
|
+
operationalDbFor,
|
|
210
|
+
metadataDbFor,
|
|
211
|
+
pipelineLedgerFor,
|
|
212
|
+
intelligenceArtifactsFor,
|
|
213
|
+
portsFor,
|
|
214
|
+
async close() {
|
|
215
|
+
if (durableMetadata)
|
|
216
|
+
await durableMetadata.drain();
|
|
217
|
+
if (client && !deps.client)
|
|
218
|
+
await client.close();
|
|
219
|
+
},
|
|
220
|
+
diagnostics(scope) {
|
|
221
|
+
return {
|
|
222
|
+
mode: deps.mode,
|
|
223
|
+
scope,
|
|
224
|
+
hasMongo: Boolean(client),
|
|
225
|
+
durableMetadata: Boolean(durableMetadata),
|
|
226
|
+
isolation: deps.isolation
|
|
227
|
+
? {
|
|
228
|
+
orgId: deps.isolation.orgId,
|
|
229
|
+
metadataDb: deps.isolation.isolatedMetadataDb,
|
|
230
|
+
allowed: deps.isolation.allowedDatabaseNames,
|
|
231
|
+
}
|
|
232
|
+
: null,
|
|
233
|
+
packages: [
|
|
234
|
+
"@x12i/memorix-metadata-runtime",
|
|
235
|
+
"@x12i/memorix-mapping",
|
|
236
|
+
"@x12i/memorix-data",
|
|
237
|
+
"@x12i/memorix-relationships",
|
|
238
|
+
"@x12i/memorix-memory",
|
|
239
|
+
"@x12i/memorix-pipeline/v2",
|
|
240
|
+
"@x12i/memorix-intelligence",
|
|
241
|
+
],
|
|
242
|
+
};
|
|
243
|
+
},
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
//# sourceMappingURL=platform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,WAAW,EAAW,MAAM,SAAS,CAAC;AAC/C,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,GAErB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,yBAAyB,EACzB,oBAAo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
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operator-facing relationship link normalization for Studio / G10 acceptance.
|
|
3
|
+
* relatedRecordId is always the opposite endpoint of the queried subject.
|
|
4
|
+
*/
|
|
5
|
+
export type OperatorRelationshipLink = {
|
|
6
|
+
relationshipId: string;
|
|
7
|
+
relationshipDefinitionId: string;
|
|
8
|
+
fromRecordId: string;
|
|
9
|
+
toRecordId: string;
|
|
10
|
+
relatedRecordId: string;
|
|
11
|
+
traversal: "forward" | "inverse";
|
|
12
|
+
targetStatus: "resolved" | "unresolved";
|
|
13
|
+
target?: unknown;
|
|
14
|
+
abstractTarget?: unknown;
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
};
|
|
17
|
+
/** Opposite endpoint relative to the queried subject record. */
|
|
18
|
+
export declare function relatedRecordIdForSubject(subjectRecordId: string, fromRecordId: string, toRecordId: string): string;
|
|
19
|
+
export declare function traversalForSubject(subjectRecordId: string, fromRecordId: string, queryTraversal?: "forward" | "inverse"): "forward" | "inverse";
|
|
20
|
+
/** Map data-plane availability to operator vocabulary (resolved | unresolved). */
|
|
21
|
+
export declare function operatorTargetStatus(status: string | undefined): "resolved" | "unresolved";
|
|
22
|
+
export declare function normalizeOperatorRelationshipLink(subjectRecordId: string, item: Record<string, unknown>, queryTraversal?: "forward" | "inverse"): OperatorRelationshipLink;
|
|
23
|
+
//# sourceMappingURL=operator-links.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operator-links.d.ts","sourceRoot":"","sources":["../../src/relationships/operator-links.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,wBAAwB,GAAG;IACrC,cAAc,EAAE,MAAM,CAAC;IACvB,wBAAwB,EAAE,MAAM,CAAC;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;IACjC,YAAY,EAAE,UAAU,GAAG,YAAY,CAAC;IACxC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,gEAAgE;AAChE,wBAAgB,yBAAyB,CACvC,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,GACjB,MAAM,CAER;AAED,wBAAgB,mBAAmB,CACjC,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,EACpB,cAAc,CAAC,EAAE,SAAS,GAAG,SAAS,GACrC,SAAS,GAAG,SAAS,CAGvB;AAED,kFAAkF;AAClF,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,GAAG,SAAS,GACzB,UAAU,GAAG,YAAY,CAI3B;AAED,wBAAgB,iCAAiC,CAC/C,eAAe,EAAE,MAAM,EACvB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,cAAc,CAAC,EAAE,SAAS,GAAG,SAAS,GACrC,wBAAwB,CAoB1B"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operator-facing relationship link normalization for Studio / G10 acceptance.
|
|
3
|
+
* relatedRecordId is always the opposite endpoint of the queried subject.
|
|
4
|
+
*/
|
|
5
|
+
/** Opposite endpoint relative to the queried subject record. */
|
|
6
|
+
export function relatedRecordIdForSubject(subjectRecordId, fromRecordId, toRecordId) {
|
|
7
|
+
return fromRecordId === subjectRecordId ? toRecordId : fromRecordId;
|
|
8
|
+
}
|
|
9
|
+
export function traversalForSubject(subjectRecordId, fromRecordId, queryTraversal) {
|
|
10
|
+
if (queryTraversal === "forward" || queryTraversal === "inverse")
|
|
11
|
+
return queryTraversal;
|
|
12
|
+
return fromRecordId === subjectRecordId ? "forward" : "inverse";
|
|
13
|
+
}
|
|
14
|
+
/** Map data-plane availability to operator vocabulary (resolved | unresolved). */
|
|
15
|
+
export function operatorTargetStatus(status) {
|
|
16
|
+
if (status === "unresolved")
|
|
17
|
+
return "unresolved";
|
|
18
|
+
if (status === "available" || status === "resolved")
|
|
19
|
+
return "resolved";
|
|
20
|
+
return status === "unresolved" ? "unresolved" : "resolved";
|
|
21
|
+
}
|
|
22
|
+
export function normalizeOperatorRelationshipLink(subjectRecordId, item, queryTraversal) {
|
|
23
|
+
const fromRecordId = String(item.fromRecordId ?? "");
|
|
24
|
+
const toRecordId = String(item.toRecordId ?? "");
|
|
25
|
+
const relatedRecordId = relatedRecordIdForSubject(subjectRecordId, fromRecordId, toRecordId);
|
|
26
|
+
const traversal = traversalForSubject(subjectRecordId, fromRecordId, queryTraversal);
|
|
27
|
+
const rawStatus = String(item.targetStatus ?? "");
|
|
28
|
+
return {
|
|
29
|
+
...item,
|
|
30
|
+
relationshipId: String(item.relationshipId ?? ""),
|
|
31
|
+
relationshipDefinitionId: String(item.relationshipDefinitionId ?? item.definitionId ?? ""),
|
|
32
|
+
fromRecordId,
|
|
33
|
+
toRecordId,
|
|
34
|
+
relatedRecordId,
|
|
35
|
+
traversal,
|
|
36
|
+
targetStatus: operatorTargetStatus(rawStatus),
|
|
37
|
+
target: item.target,
|
|
38
|
+
abstractTarget: item.abstractTarget,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=operator-links.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operator-links.js","sourceRoot":"","sources":["../../src/relationships/operator-links.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAeH,gEAAgE;AAChE,MAAM,UAAU,yBAAyB,CACvC,eAAuB,EACvB,YAAoB,EACpB,UAAkB;IAElB,OAAO,YAAY,KAAK,eAAe,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC;AACtE,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,eAAuB,EACvB,YAAoB,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AE,IAAI,CAAC,MAAM;QACnB,cAAc,EAAE,IAAI,CAAC,cAAc;KACpC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-scope.d.ts","sourceRoot":"","sources":["../src/request-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAGpF,wBAAgB,YAAY,CAAC,GAAG,EAAE;IAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;IACvD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,GAAG,YAAY,CAkBf"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { canonicalizeScope, scopeFromHeaders } from "./scope.js";
|
|
2
|
+
import { ServiceError } from "./errors.js";
|
|
3
|
+
export function resolveScope(req) {
|
|
4
|
+
const q = (req.query ?? {});
|
|
5
|
+
const b = (req.body ?? {});
|
|
6
|
+
try {
|
|
7
|
+
if (q.orgId || q.agentIds || b.orgId || b.agentIds) {
|
|
8
|
+
return canonicalizeScope({
|
|
9
|
+
orgId: (q.orgId ?? b.orgId ?? scopeFromHeaders(req.headers).orgId),
|
|
10
|
+
agentIds: (q.agentIds ??
|
|
11
|
+
b.agentIds ??
|
|
12
|
+
scopeFromHeaders(req.headers).agentIds),
|
|
13
|
+
agentId: q.agentId ?? b.agentId,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return scopeFromHeaders(req.headers);
|
|
17
|
+
}
|
|
18
|
+
catch (err) {
|
|
19
|
+
if (err instanceof Error && err.name === "ScopeValidationError")
|
|
20
|
+
throw err;
|
|
21
|
+
throw new ServiceError("SCOPE_INVALID", String(err), 400);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=request-scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|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