@cadenza.io/service 2.20.0 → 2.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Cadenza-D787NzXY.d.mts → Cadenza-Duj65Skt.d.mts} +134 -2
- package/dist/{Cadenza-D787NzXY.d.ts → Cadenza-Duj65Skt.d.ts} +134 -2
- package/dist/browser/index.js +985 -182
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +926 -123
- package/dist/browser/index.mjs.map +1 -1
- package/dist/index.d.mts +4 -130
- package/dist/index.d.ts +4 -130
- package/dist/index.js +1184 -223
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1125 -164
- package/dist/index.mjs.map +1 -1
- package/dist/nuxt/index.d.mts +2 -2
- package/dist/nuxt/index.d.ts +2 -2
- package/dist/react/index.d.mts +2 -2
- package/dist/react/index.d.ts +2 -2
- package/dist/vue/index.d.mts +2 -2
- package/dist/vue/index.d.ts +2 -2
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -39,15 +39,15 @@ __export(src_exports, {
|
|
|
39
39
|
AUTHORITY_SERVICE_INSTANCE_TRANSPORT_REGISTER_TASK_NAME: () => AUTHORITY_SERVICE_INSTANCE_TRANSPORT_REGISTER_TASK_NAME,
|
|
40
40
|
AUTHORITY_SERVICE_MANIFEST_REPORT_INTENT: () => AUTHORITY_SERVICE_MANIFEST_REPORT_INTENT,
|
|
41
41
|
AUTHORITY_SERVICE_MANIFEST_UPDATED_SIGNAL: () => AUTHORITY_SERVICE_MANIFEST_UPDATED_SIGNAL,
|
|
42
|
-
Actor: () =>
|
|
42
|
+
Actor: () => import_core7.Actor,
|
|
43
43
|
DatabaseController: () => DatabaseController,
|
|
44
44
|
DatabaseTask: () => DatabaseTask,
|
|
45
|
-
DebounceTask: () =>
|
|
45
|
+
DebounceTask: () => import_core7.DebounceTask,
|
|
46
46
|
DeputyTask: () => DeputyTask,
|
|
47
47
|
EXECUTION_PERSISTENCE_BUNDLE_SIGNAL: () => EXECUTION_PERSISTENCE_BUNDLE_SIGNAL,
|
|
48
|
-
EphemeralTask: () =>
|
|
48
|
+
EphemeralTask: () => import_core7.EphemeralTask,
|
|
49
49
|
GraphMetadataController: () => GraphMetadataController,
|
|
50
|
-
GraphRoutine: () =>
|
|
50
|
+
GraphRoutine: () => import_core7.GraphRoutine,
|
|
51
51
|
RUNTIME_STATUS_AUTHORITY_SYNC_REQUESTED_SIGNAL: () => RUNTIME_STATUS_AUTHORITY_SYNC_REQUESTED_SIGNAL,
|
|
52
52
|
RUNTIME_VALIDATION_INTENTS: () => RUNTIME_VALIDATION_INTENTS,
|
|
53
53
|
RUNTIME_VALIDATION_SIGNALS: () => RUNTIME_VALIDATION_SIGNALS,
|
|
@@ -56,7 +56,7 @@ __export(src_exports, {
|
|
|
56
56
|
SignalController: () => SignalController,
|
|
57
57
|
SignalTransmissionTask: () => SignalTransmissionTask,
|
|
58
58
|
SocketController: () => SocketController,
|
|
59
|
-
Task: () =>
|
|
59
|
+
Task: () => import_core7.Task,
|
|
60
60
|
buildAuthorityRuntimeStatusSignature: () => buildAuthorityRuntimeStatusSignature,
|
|
61
61
|
buildExecutionPersistenceDependency: () => buildExecutionPersistenceDependency,
|
|
62
62
|
buildExecutionPersistenceEnsureEvent: () => buildExecutionPersistenceEnsureEvent,
|
|
@@ -87,7 +87,7 @@ __export(src_exports, {
|
|
|
87
87
|
module.exports = __toCommonJS(src_exports);
|
|
88
88
|
|
|
89
89
|
// src/Cadenza.ts
|
|
90
|
-
var
|
|
90
|
+
var import_core6 = __toESM(require("@cadenza.io/core"));
|
|
91
91
|
|
|
92
92
|
// src/graph/definition/DeputyTask.ts
|
|
93
93
|
var import_uuid2 = require("uuid");
|
|
@@ -163,14 +163,55 @@ var ROOT_METADATA_PASSTHROUGH_KEYS = [
|
|
|
163
163
|
"__inquirySourceRoutineExecutionId"
|
|
164
164
|
];
|
|
165
165
|
var DELEGATION_REQUEST_SNAPSHOT_KEY = "__delegationRequestContext";
|
|
166
|
+
var DELEGATION_FAILURE_CONTEXT_KEYS = [
|
|
167
|
+
"__remoteRoutineName",
|
|
168
|
+
"__serviceName",
|
|
169
|
+
"__timeout",
|
|
170
|
+
"__localTaskName",
|
|
171
|
+
"__localTaskVersion",
|
|
172
|
+
"__localServiceName",
|
|
173
|
+
"__localRoutineExecId",
|
|
174
|
+
"__previousTaskExecutionId",
|
|
175
|
+
"__fetchId",
|
|
176
|
+
"fetchId",
|
|
177
|
+
"__routeKey",
|
|
178
|
+
"routeKey",
|
|
179
|
+
"__instance",
|
|
180
|
+
"__transportId",
|
|
181
|
+
"__transportOrigin",
|
|
182
|
+
"__transportProtocols",
|
|
183
|
+
"__transportProtocol",
|
|
184
|
+
"__retries",
|
|
185
|
+
"__triedInstances",
|
|
186
|
+
"__delegationRequestContext",
|
|
187
|
+
"__metadata",
|
|
188
|
+
"serviceName",
|
|
189
|
+
"serviceInstanceId",
|
|
190
|
+
"serviceTransportId",
|
|
191
|
+
"serviceOrigin",
|
|
192
|
+
"transportProtocols",
|
|
193
|
+
"transportProtocol"
|
|
194
|
+
];
|
|
195
|
+
function isPlainObject(value) {
|
|
196
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
const prototype = Object.getPrototypeOf(value);
|
|
200
|
+
return prototype === Object.prototype || prototype === null;
|
|
201
|
+
}
|
|
166
202
|
function cloneDelegationValue(value) {
|
|
203
|
+
if (value instanceof Date) {
|
|
204
|
+
return new Date(value.getTime());
|
|
205
|
+
}
|
|
167
206
|
if (Array.isArray(value)) {
|
|
168
|
-
return value.map(
|
|
169
|
-
(item) => item && typeof item === "object" ? { ...item } : item
|
|
170
|
-
);
|
|
207
|
+
return value.map((item) => cloneDelegationValue(item));
|
|
171
208
|
}
|
|
172
|
-
if (value
|
|
173
|
-
|
|
209
|
+
if (isPlainObject(value)) {
|
|
210
|
+
const clone = {};
|
|
211
|
+
for (const [key, nestedValue] of Object.entries(value)) {
|
|
212
|
+
clone[key] = cloneDelegationValue(nestedValue);
|
|
213
|
+
}
|
|
214
|
+
return clone;
|
|
174
215
|
}
|
|
175
216
|
return value;
|
|
176
217
|
}
|
|
@@ -206,9 +247,9 @@ function attachDelegationRequestSnapshot(input) {
|
|
|
206
247
|
function restoreDelegationRequestSnapshot(input) {
|
|
207
248
|
const context = input && typeof input === "object" ? { ...input } : {};
|
|
208
249
|
const mutableContext = context;
|
|
209
|
-
const snapshotCandidate = mutableContext[DELEGATION_REQUEST_SNAPSHOT_KEY];
|
|
250
|
+
const snapshotCandidate = mutableContext[DELEGATION_REQUEST_SNAPSHOT_KEY] ?? (mutableContext.__metadata && typeof mutableContext.__metadata === "object" ? mutableContext.__metadata[DELEGATION_REQUEST_SNAPSHOT_KEY] : void 0);
|
|
210
251
|
const snapshot = snapshotCandidate && typeof snapshotCandidate === "object" ? snapshotCandidate : null;
|
|
211
|
-
const looksLikeDelegationResult = mutableContext.__status !== void 0 || mutableContext.__success !== void 0 || mutableContext.rowCount !== void 0 || mutableContext.__nextNodes !== void 0 || mutableContext.__isDeputy === true;
|
|
252
|
+
const looksLikeDelegationResult = mutableContext.__status !== void 0 || mutableContext.__success !== void 0 || mutableContext.rowCount !== void 0 || mutableContext.__nextNodes !== void 0 || mutableContext.__isDeputy === true || mutableContext.errored === true || mutableContext.failed === true || mutableContext.timedOut === true || mutableContext.__error !== void 0 || mutableContext.error !== void 0 || mutableContext.__inquiryMeta !== void 0;
|
|
212
253
|
if (!snapshot || !looksLikeDelegationResult) {
|
|
213
254
|
return context;
|
|
214
255
|
}
|
|
@@ -229,6 +270,26 @@ function stripDelegationRequestSnapshot(input) {
|
|
|
229
270
|
delete context[DELEGATION_REQUEST_SNAPSHOT_KEY];
|
|
230
271
|
return context;
|
|
231
272
|
}
|
|
273
|
+
function buildDelegationFailureContext(signalName, input, error) {
|
|
274
|
+
const source = input && typeof input === "object" ? { ...input } : {};
|
|
275
|
+
const slimContext = {};
|
|
276
|
+
for (const key of DELEGATION_FAILURE_CONTEXT_KEYS) {
|
|
277
|
+
if (source[key] !== void 0) {
|
|
278
|
+
slimContext[key] = cloneDelegationValue(source[key]);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
if (slimContext[DELEGATION_REQUEST_SNAPSHOT_KEY] === void 0 && source.__metadata && typeof source.__metadata === "object" && source.__metadata[DELEGATION_REQUEST_SNAPSHOT_KEY] !== void 0) {
|
|
282
|
+
slimContext[DELEGATION_REQUEST_SNAPSHOT_KEY] = cloneDelegationValue(
|
|
283
|
+
source.__metadata[DELEGATION_REQUEST_SNAPSHOT_KEY]
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
return {
|
|
287
|
+
__signalName: signalName,
|
|
288
|
+
__error: error instanceof Error ? error.message : String(error ?? "Unknown error"),
|
|
289
|
+
errored: true,
|
|
290
|
+
...slimContext
|
|
291
|
+
};
|
|
292
|
+
}
|
|
232
293
|
function stripTransportSelectionRoutingContext(input) {
|
|
233
294
|
const context = stripLocalRoutinePersistenceHints(
|
|
234
295
|
input && typeof input === "object" ? { ...input } : {}
|
|
@@ -448,6 +509,8 @@ var DeputyTask = class extends import_core.Task {
|
|
|
448
509
|
|
|
449
510
|
// src/graph/definition/DatabaseTask.ts
|
|
450
511
|
var ACTOR_SESSION_TRACE_ENABLED = process.env.CADENZA_ACTOR_SESSION_TRACE === "1" || process.env.CADENZA_ACTOR_SESSION_TRACE === "true";
|
|
512
|
+
var actorSessionEmptyDelegationLogCount = 0;
|
|
513
|
+
var ACTOR_SESSION_EMPTY_DELEGATION_LOG_LIMIT = 40;
|
|
451
514
|
var INSTANCE_TRACE_ENABLED = process.env.CADENZA_INSTANCE_DEBUG === "1" || process.env.CADENZA_INSTANCE_DEBUG === "true";
|
|
452
515
|
var EXECUTION_OBSERVABILITY_INSERT_ROUTINES = /* @__PURE__ */ new Set([
|
|
453
516
|
"Insert execution_trace",
|
|
@@ -549,15 +612,16 @@ var DatabaseTask = class extends DeputyTask {
|
|
|
549
612
|
}
|
|
550
613
|
delete ctx.__metadata;
|
|
551
614
|
const isResolverExecution = typeof ctx.__resolverRequestId === "string" && ctx.__resolverRequestId.length > 0;
|
|
552
|
-
const
|
|
615
|
+
const resolverQueryData = ctx.__resolverQueryData && typeof ctx.__resolverQueryData === "object" ? ctx.__resolverQueryData : null;
|
|
616
|
+
const dynamicQueryData = resolverQueryData ?? (ctx.queryData && typeof ctx.queryData === "object" ? ctx.queryData : {});
|
|
553
617
|
delete ctx.queryData;
|
|
554
618
|
const nextQueryData = {
|
|
555
619
|
...this.queryData,
|
|
556
|
-
data: {
|
|
557
|
-
...ctx.data
|
|
558
|
-
},
|
|
559
620
|
...dynamicQueryData
|
|
560
621
|
};
|
|
622
|
+
if (dynamicQueryData.data === void 0 && ctx.data !== void 0) {
|
|
623
|
+
nextQueryData.data = ctx.data && typeof ctx.data === "object" && !Array.isArray(ctx.data) ? { ...ctx.data } : ctx.data;
|
|
624
|
+
}
|
|
561
625
|
const deputyContext = attachDelegationRequestSnapshot(
|
|
562
626
|
stripDelegationRequestSnapshot(
|
|
563
627
|
hoistDelegationMetadataFields({
|
|
@@ -617,6 +681,22 @@ var DatabaseTask = class extends DeputyTask {
|
|
|
617
681
|
rootKeys: Object.keys(rawContext)
|
|
618
682
|
});
|
|
619
683
|
}
|
|
684
|
+
if (this.remoteRoutineName === "Insert actor_session_state" && deputyContext.data === void 0 && deputyContext.queryData === void 0 && actorSessionEmptyDelegationLogCount < ACTOR_SESSION_EMPTY_DELEGATION_LOG_LIMIT) {
|
|
685
|
+
actorSessionEmptyDelegationLogCount += 1;
|
|
686
|
+
console.warn("[CADENZA_ACTOR_SESSION_EMPTY_DELEGATION]", {
|
|
687
|
+
localServiceName: CadenzaService.serviceRegistry.serviceName,
|
|
688
|
+
localTaskName: this.name,
|
|
689
|
+
remoteRoutineName: this.remoteRoutineName,
|
|
690
|
+
hadSnapshotBeforeRestore: initialFullContext.__delegationRequestContext !== void 0 || initialFullContext.__metadata?.__delegationRequestContext !== void 0,
|
|
691
|
+
restoredRootKeys: Object.keys(rawContext),
|
|
692
|
+
deputyRootKeys: Object.keys(deputyContext),
|
|
693
|
+
signalName: rawContext.__signalName ?? rawContext.__metadata?.__signalName ?? null,
|
|
694
|
+
inquiryName: rawContext.__inquiryName ?? rawContext.__metadata?.__inquiryName ?? null,
|
|
695
|
+
sourceServiceName: rawContext.__localServiceName ?? rawContext.__metadata?.__localServiceName ?? null,
|
|
696
|
+
sourceRoutineName: rawContext.__routineName ?? rawContext.__metadata?.__routineName ?? null,
|
|
697
|
+
sourceTaskName: rawContext.__localTaskName ?? rawContext.__metadata?.__localTaskName ?? null
|
|
698
|
+
});
|
|
699
|
+
}
|
|
620
700
|
return this.taskFunction(deputyContext, emit2, inquire, progressCallback);
|
|
621
701
|
}
|
|
622
702
|
};
|
|
@@ -656,14 +736,14 @@ var META_INTENT_PREFIX = "meta-";
|
|
|
656
736
|
var META_RUNTIME_TRANSPORT_DIAGNOSTICS_INTENT = "meta-runtime-transport-diagnostics";
|
|
657
737
|
var META_RUNTIME_STATUS_INTENT = "meta-runtime-status";
|
|
658
738
|
var META_READINESS_INTENT = "meta-readiness";
|
|
659
|
-
function
|
|
739
|
+
function isPlainObject2(value) {
|
|
660
740
|
return typeof value === "object" && value !== null && !Array.isArray(value) && Object.getPrototypeOf(value) === Object.prototype;
|
|
661
741
|
}
|
|
662
742
|
function deepMergeDeterministic(left, right) {
|
|
663
743
|
if (Array.isArray(left) && Array.isArray(right)) {
|
|
664
744
|
return [...left, ...right];
|
|
665
745
|
}
|
|
666
|
-
if (
|
|
746
|
+
if (isPlainObject2(left) && isPlainObject2(right)) {
|
|
667
747
|
const merged = { ...left };
|
|
668
748
|
const keys = Array.from(/* @__PURE__ */ new Set([...Object.keys(left), ...Object.keys(right)])).sort();
|
|
669
749
|
for (const key of keys) {
|
|
@@ -1485,6 +1565,7 @@ function normalizeServiceManifestSnapshot(input) {
|
|
|
1485
1565
|
revision,
|
|
1486
1566
|
manifestHash,
|
|
1487
1567
|
publishedAt,
|
|
1568
|
+
publicationLayer: record.publicationLayer === "routing_capability" || record.publicationLayer === "business_structural" || record.publicationLayer === "local_meta_structural" ? record.publicationLayer : "business_structural",
|
|
1488
1569
|
tasks: normalizeArray(record.tasks),
|
|
1489
1570
|
signals: normalizeArray(record.signals),
|
|
1490
1571
|
intents: normalizeArray(record.intents),
|
|
@@ -1614,6 +1695,7 @@ function decomposeSignalName(signalName) {
|
|
|
1614
1695
|
}
|
|
1615
1696
|
|
|
1616
1697
|
// src/registry/serviceManifest.ts
|
|
1698
|
+
var import_core2 = __toESM(require("@cadenza.io/core"));
|
|
1617
1699
|
var ACTOR_TASK_METADATA = /* @__PURE__ */ Symbol.for("@cadenza.io/core/actor-task-meta");
|
|
1618
1700
|
function getActorTaskRuntimeMetadata(taskFunction) {
|
|
1619
1701
|
if (typeof taskFunction !== "function") {
|
|
@@ -1758,14 +1840,48 @@ function buildRoutineDefinition(routine, serviceName) {
|
|
|
1758
1840
|
};
|
|
1759
1841
|
}
|
|
1760
1842
|
function shouldExportTask(task) {
|
|
1761
|
-
return !task.isDeputy && !task.isEphemeral;
|
|
1843
|
+
return task.register !== false && task.isHidden !== true && !task.isDeputy && !task.isEphemeral;
|
|
1762
1844
|
}
|
|
1763
1845
|
function shouldExportRoutine(routine) {
|
|
1764
1846
|
return Boolean(String(routine?.name ?? "").trim());
|
|
1765
1847
|
}
|
|
1848
|
+
function buildTaskKey(task) {
|
|
1849
|
+
return `${task.service_name}|${task.name}|${task.version}`;
|
|
1850
|
+
}
|
|
1851
|
+
function buildActorKey(actor) {
|
|
1852
|
+
return `${actor.service_name}|${actor.name}|${actor.version}`;
|
|
1853
|
+
}
|
|
1854
|
+
function buildRoutineKey(routine) {
|
|
1855
|
+
return `${routine.service_name}|${routine.name}|${routine.version}`;
|
|
1856
|
+
}
|
|
1857
|
+
function listManifestTasks() {
|
|
1858
|
+
const registryTasks = Array.from(CadenzaService.registry.tasks.values()).filter(
|
|
1859
|
+
(task) => Boolean(task)
|
|
1860
|
+
);
|
|
1861
|
+
const cachedTasks = Array.from(
|
|
1862
|
+
import_core2.default.taskCache?.values?.() ?? []
|
|
1863
|
+
).filter((task) => Boolean(task));
|
|
1864
|
+
return Array.from(
|
|
1865
|
+
new Map(
|
|
1866
|
+
[...registryTasks, ...cachedTasks].map((task) => [task.name, task])
|
|
1867
|
+
).values()
|
|
1868
|
+
);
|
|
1869
|
+
}
|
|
1870
|
+
function isRoutingCriticalMetaSignal(_signal) {
|
|
1871
|
+
return false;
|
|
1872
|
+
}
|
|
1873
|
+
function isRoutingCriticalMetaIntent(_intent) {
|
|
1874
|
+
return false;
|
|
1875
|
+
}
|
|
1766
1876
|
function buildServiceManifestSnapshot(params) {
|
|
1767
|
-
const {
|
|
1768
|
-
|
|
1877
|
+
const {
|
|
1878
|
+
serviceName,
|
|
1879
|
+
serviceInstanceId,
|
|
1880
|
+
revision,
|
|
1881
|
+
publishedAt,
|
|
1882
|
+
publicationLayer = "business_structural"
|
|
1883
|
+
} = params;
|
|
1884
|
+
const tasks = listManifestTasks().filter(shouldExportTask);
|
|
1769
1885
|
const routines = Array.from(CadenzaService.registry.routines.values()).filter((routine) => Boolean(routine)).filter(shouldExportRoutine);
|
|
1770
1886
|
const actors = CadenzaService.getAllActors();
|
|
1771
1887
|
const taskDefinitions = tasks.map((task) => buildTaskDefinition(task, serviceName)).sort(
|
|
@@ -1913,41 +2029,385 @@ function buildServiceManifestSnapshot(params) {
|
|
|
1913
2029
|
}
|
|
1914
2030
|
}
|
|
1915
2031
|
}
|
|
1916
|
-
const
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
)
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
2032
|
+
const taskDefinitionsByKey = new Map(
|
|
2033
|
+
taskDefinitions.map((task) => [buildTaskKey(task), task])
|
|
2034
|
+
);
|
|
2035
|
+
const signalDefinitionsByName = new Map(
|
|
2036
|
+
Array.from(signalDefinitions.values()).map((signal) => [signal.name, signal])
|
|
2037
|
+
);
|
|
2038
|
+
const intentDefinitionsByName = new Map(
|
|
2039
|
+
intentDefinitions.map((intent) => [intent.name, intent])
|
|
2040
|
+
);
|
|
2041
|
+
const actorDefinitionsByKey = new Map(
|
|
2042
|
+
actorDefinitions.map((actor) => [buildActorKey(actor), actor])
|
|
2043
|
+
);
|
|
2044
|
+
const routineDefinitionsByKey = new Map(
|
|
2045
|
+
routineDefinitions.map((routine) => [buildRoutineKey(routine), routine])
|
|
2046
|
+
);
|
|
2047
|
+
const routingTaskKeys = /* @__PURE__ */ new Set();
|
|
2048
|
+
const routingSignalNames = /* @__PURE__ */ new Set();
|
|
2049
|
+
const routingIntentNames = /* @__PURE__ */ new Set();
|
|
2050
|
+
const publishedSignalTaskMaps = Array.from(signalTaskMaps.values()).filter((map) => {
|
|
2051
|
+
const signal = signalDefinitionsByName.get(map.signal_name);
|
|
2052
|
+
return signal?.is_meta !== true || (signal ? isRoutingCriticalMetaSignal(signal) : false);
|
|
2053
|
+
}).sort(
|
|
2054
|
+
(left, right) => `${left.signal_name}:${left.task_name}`.localeCompare(
|
|
2055
|
+
`${right.signal_name}:${right.task_name}`
|
|
2056
|
+
)
|
|
2057
|
+
);
|
|
2058
|
+
const publishedIntentTaskMaps = Array.from(intentTaskMaps.values()).filter((map) => {
|
|
2059
|
+
const intent = intentDefinitionsByName.get(map.intent_name);
|
|
2060
|
+
return intent?.is_meta !== true || (intent ? isRoutingCriticalMetaIntent(intent) : false);
|
|
2061
|
+
}).sort(
|
|
2062
|
+
(left, right) => `${left.intent_name}:${left.task_name}`.localeCompare(
|
|
2063
|
+
`${right.intent_name}:${right.task_name}`
|
|
2064
|
+
)
|
|
2065
|
+
);
|
|
2066
|
+
const localMetaSignalTaskMaps = Array.from(signalTaskMaps.values()).filter((map) => !publishedSignalTaskMaps.includes(map)).sort(
|
|
2067
|
+
(left, right) => `${left.signal_name}:${left.task_name}`.localeCompare(
|
|
2068
|
+
`${right.signal_name}:${right.task_name}`
|
|
2069
|
+
)
|
|
2070
|
+
);
|
|
2071
|
+
const localMetaIntentTaskMaps = Array.from(intentTaskMaps.values()).filter((map) => !publishedIntentTaskMaps.includes(map)).sort(
|
|
2072
|
+
(left, right) => `${left.intent_name}:${left.task_name}`.localeCompare(
|
|
2073
|
+
`${right.intent_name}:${right.task_name}`
|
|
2074
|
+
)
|
|
2075
|
+
);
|
|
2076
|
+
for (const map of publishedSignalTaskMaps) {
|
|
2077
|
+
routingTaskKeys.add(
|
|
2078
|
+
buildTaskKey({
|
|
2079
|
+
service_name: map.service_name,
|
|
2080
|
+
name: map.task_name,
|
|
2081
|
+
version: map.task_version
|
|
2082
|
+
})
|
|
2083
|
+
);
|
|
2084
|
+
routingSignalNames.add(map.signal_name);
|
|
2085
|
+
}
|
|
2086
|
+
for (const map of publishedIntentTaskMaps) {
|
|
2087
|
+
routingTaskKeys.add(
|
|
2088
|
+
buildTaskKey({
|
|
2089
|
+
service_name: map.service_name,
|
|
2090
|
+
name: map.task_name,
|
|
2091
|
+
version: map.task_version
|
|
2092
|
+
})
|
|
2093
|
+
);
|
|
2094
|
+
routingIntentNames.add(map.intent_name);
|
|
2095
|
+
}
|
|
2096
|
+
const routingTasks = Array.from(routingTaskKeys).map((key) => taskDefinitionsByKey.get(key) ?? null).filter((task) => task !== null).sort(
|
|
2097
|
+
(left, right) => `${left.name}:${left.version}`.localeCompare(`${right.name}:${right.version}`)
|
|
2098
|
+
);
|
|
2099
|
+
const routingSignals = Array.from(routingSignalNames).map((name) => signalDefinitionsByName.get(name) ?? null).filter((signal) => signal !== null).sort((left, right) => left.name.localeCompare(right.name));
|
|
2100
|
+
const routingIntents = Array.from(routingIntentNames).map((name) => intentDefinitionsByName.get(name) ?? null).filter((intent) => intent !== null).sort((left, right) => left.name.localeCompare(right.name));
|
|
2101
|
+
const businessTasks = taskDefinitions.filter((task) => task.is_meta !== true && task.is_sub_meta !== true).sort(
|
|
2102
|
+
(left, right) => `${left.name}:${left.version}`.localeCompare(`${right.name}:${right.version}`)
|
|
2103
|
+
);
|
|
2104
|
+
const businessSignals = Array.from(signalDefinitions.values()).filter((signal) => signal.is_meta !== true).sort((left, right) => left.name.localeCompare(right.name));
|
|
2105
|
+
const businessIntents = intentDefinitions.filter((intent) => intent.is_meta !== true).sort((left, right) => left.name.localeCompare(right.name));
|
|
2106
|
+
const businessActors = actorDefinitions.filter((actor) => actor.is_meta !== true).sort(
|
|
2107
|
+
(left, right) => `${left.name}:${left.version}`.localeCompare(`${right.name}:${right.version}`)
|
|
2108
|
+
);
|
|
2109
|
+
const businessRoutines = routineDefinitions.filter((routine) => routine.is_meta !== true).sort(
|
|
2110
|
+
(left, right) => `${left.name}:${left.version}`.localeCompare(`${right.name}:${right.version}`)
|
|
2111
|
+
);
|
|
2112
|
+
const businessDirectionalTaskMaps = Array.from(directionalTaskMaps.values()).filter((map) => {
|
|
2113
|
+
const predecessor = taskDefinitionsByKey.get(
|
|
2114
|
+
buildTaskKey({
|
|
2115
|
+
service_name: map.predecessor_service_name,
|
|
2116
|
+
name: map.predecessor_task_name,
|
|
2117
|
+
version: map.predecessor_task_version
|
|
2118
|
+
})
|
|
2119
|
+
);
|
|
2120
|
+
const task = taskDefinitionsByKey.get(
|
|
2121
|
+
buildTaskKey({
|
|
2122
|
+
service_name: map.service_name,
|
|
2123
|
+
name: map.task_name,
|
|
2124
|
+
version: map.task_version
|
|
2125
|
+
})
|
|
2126
|
+
);
|
|
2127
|
+
return predecessor?.is_meta !== true && predecessor?.is_sub_meta !== true && task?.is_meta !== true && task?.is_sub_meta !== true;
|
|
2128
|
+
}).sort(
|
|
2129
|
+
(left, right) => `${left.predecessor_task_name}:${left.task_name}`.localeCompare(
|
|
2130
|
+
`${right.predecessor_task_name}:${right.task_name}`
|
|
2131
|
+
)
|
|
2132
|
+
);
|
|
2133
|
+
const businessActorTaskMaps = Array.from(actorTaskMaps.values()).filter((map) => {
|
|
2134
|
+
const actor = actorDefinitionsByKey.get(
|
|
2135
|
+
buildActorKey({
|
|
2136
|
+
service_name: map.service_name,
|
|
2137
|
+
name: map.actor_name,
|
|
2138
|
+
version: map.actor_version
|
|
2139
|
+
})
|
|
2140
|
+
);
|
|
2141
|
+
const task = taskDefinitionsByKey.get(
|
|
2142
|
+
buildTaskKey({
|
|
2143
|
+
service_name: map.service_name,
|
|
2144
|
+
name: map.task_name,
|
|
2145
|
+
version: map.task_version
|
|
2146
|
+
})
|
|
2147
|
+
);
|
|
2148
|
+
return actor?.is_meta !== true && task?.is_meta !== true && task?.is_sub_meta !== true;
|
|
2149
|
+
}).sort(
|
|
2150
|
+
(left, right) => `${left.actor_name}:${left.task_name}`.localeCompare(
|
|
2151
|
+
`${right.actor_name}:${right.task_name}`
|
|
2152
|
+
)
|
|
2153
|
+
);
|
|
2154
|
+
const businessTaskToRoutineMaps = Array.from(taskToRoutineMaps.values()).filter((map) => {
|
|
2155
|
+
const routine = routineDefinitionsByKey.get(
|
|
2156
|
+
buildRoutineKey({
|
|
2157
|
+
service_name: map.service_name,
|
|
2158
|
+
name: map.routine_name,
|
|
2159
|
+
version: map.routine_version
|
|
2160
|
+
})
|
|
2161
|
+
);
|
|
2162
|
+
const task = taskDefinitionsByKey.get(
|
|
2163
|
+
buildTaskKey({
|
|
2164
|
+
service_name: map.service_name,
|
|
2165
|
+
name: map.task_name,
|
|
2166
|
+
version: map.task_version
|
|
2167
|
+
})
|
|
2168
|
+
);
|
|
2169
|
+
return routine?.is_meta !== true && task?.is_meta !== true && task?.is_sub_meta !== true;
|
|
2170
|
+
}).sort(
|
|
2171
|
+
(left, right) => `${left.routine_name}:${left.task_name}`.localeCompare(
|
|
2172
|
+
`${right.routine_name}:${right.task_name}`
|
|
2173
|
+
)
|
|
2174
|
+
);
|
|
2175
|
+
const localMetaTasks = taskDefinitions.filter((task) => task.is_meta === true || task.is_sub_meta === true).sort(
|
|
2176
|
+
(left, right) => `${left.name}:${left.version}`.localeCompare(`${right.name}:${right.version}`)
|
|
2177
|
+
);
|
|
2178
|
+
const localMetaSignals = Array.from(signalDefinitions.values()).filter((signal) => signal.is_meta === true).sort((left, right) => left.name.localeCompare(right.name));
|
|
2179
|
+
const localMetaIntents = intentDefinitions.filter((intent) => intent.is_meta === true).sort((left, right) => left.name.localeCompare(right.name));
|
|
2180
|
+
const localMetaActors = actorDefinitions.filter((actor) => actor.is_meta === true).sort(
|
|
2181
|
+
(left, right) => `${left.name}:${left.version}`.localeCompare(`${right.name}:${right.version}`)
|
|
2182
|
+
);
|
|
2183
|
+
const localMetaRoutines = routineDefinitions.filter((routine) => routine.is_meta === true).sort(
|
|
2184
|
+
(left, right) => `${left.name}:${left.version}`.localeCompare(`${right.name}:${right.version}`)
|
|
2185
|
+
);
|
|
2186
|
+
const localMetaDirectionalTaskMaps = Array.from(directionalTaskMaps.values()).filter((map) => !businessDirectionalTaskMaps.includes(map)).sort(
|
|
2187
|
+
(left, right) => `${left.predecessor_task_name}:${left.task_name}`.localeCompare(
|
|
2188
|
+
`${right.predecessor_task_name}:${right.task_name}`
|
|
2189
|
+
)
|
|
2190
|
+
);
|
|
2191
|
+
const localMetaActorTaskMaps = Array.from(actorTaskMaps.values()).filter((map) => !businessActorTaskMaps.includes(map)).sort(
|
|
2192
|
+
(left, right) => `${left.actor_name}:${left.task_name}`.localeCompare(
|
|
2193
|
+
`${right.actor_name}:${right.task_name}`
|
|
2194
|
+
)
|
|
2195
|
+
);
|
|
2196
|
+
const localMetaTaskToRoutineMaps = Array.from(taskToRoutineMaps.values()).filter((map) => !businessTaskToRoutineMaps.includes(map)).sort(
|
|
2197
|
+
(left, right) => `${left.routine_name}:${left.task_name}`.localeCompare(
|
|
2198
|
+
`${right.routine_name}:${right.task_name}`
|
|
2199
|
+
)
|
|
2200
|
+
);
|
|
2201
|
+
const businessLocalMetaTaskKeys = /* @__PURE__ */ new Set();
|
|
2202
|
+
const businessLocalMetaSignalNames = /* @__PURE__ */ new Set();
|
|
2203
|
+
const businessLocalMetaIntentNames = /* @__PURE__ */ new Set();
|
|
2204
|
+
const businessLocalMetaActorKeys = /* @__PURE__ */ new Set();
|
|
2205
|
+
const businessLocalMetaRoutineKeys = /* @__PURE__ */ new Set();
|
|
2206
|
+
for (const map of localMetaSignalTaskMaps) {
|
|
2207
|
+
businessLocalMetaSignalNames.add(map.signal_name);
|
|
2208
|
+
businessLocalMetaTaskKeys.add(
|
|
2209
|
+
buildTaskKey({
|
|
2210
|
+
service_name: map.service_name,
|
|
2211
|
+
name: map.task_name,
|
|
2212
|
+
version: map.task_version
|
|
2213
|
+
})
|
|
2214
|
+
);
|
|
2215
|
+
}
|
|
2216
|
+
for (const map of localMetaIntentTaskMaps) {
|
|
2217
|
+
businessLocalMetaIntentNames.add(map.intent_name);
|
|
2218
|
+
businessLocalMetaTaskKeys.add(
|
|
2219
|
+
buildTaskKey({
|
|
2220
|
+
service_name: map.service_name,
|
|
2221
|
+
name: map.task_name,
|
|
2222
|
+
version: map.task_version
|
|
2223
|
+
})
|
|
2224
|
+
);
|
|
2225
|
+
}
|
|
2226
|
+
for (const map of localMetaActorTaskMaps) {
|
|
2227
|
+
businessLocalMetaActorKeys.add(
|
|
2228
|
+
buildActorKey({
|
|
2229
|
+
service_name: map.service_name,
|
|
2230
|
+
name: map.actor_name,
|
|
2231
|
+
version: map.actor_version
|
|
2232
|
+
})
|
|
2233
|
+
);
|
|
2234
|
+
businessLocalMetaTaskKeys.add(
|
|
2235
|
+
buildTaskKey({
|
|
2236
|
+
service_name: map.service_name,
|
|
2237
|
+
name: map.task_name,
|
|
2238
|
+
version: map.task_version
|
|
2239
|
+
})
|
|
2240
|
+
);
|
|
2241
|
+
}
|
|
2242
|
+
for (const map of localMetaTaskToRoutineMaps) {
|
|
2243
|
+
businessLocalMetaRoutineKeys.add(
|
|
2244
|
+
buildRoutineKey({
|
|
2245
|
+
service_name: map.service_name,
|
|
2246
|
+
name: map.routine_name,
|
|
2247
|
+
version: map.routine_version
|
|
2248
|
+
})
|
|
2249
|
+
);
|
|
2250
|
+
businessLocalMetaTaskKeys.add(
|
|
2251
|
+
buildTaskKey({
|
|
2252
|
+
service_name: map.service_name,
|
|
2253
|
+
name: map.task_name,
|
|
2254
|
+
version: map.task_version
|
|
2255
|
+
})
|
|
2256
|
+
);
|
|
2257
|
+
}
|
|
2258
|
+
const businessLocalMetaTasks = Array.from(businessLocalMetaTaskKeys).map((key) => taskDefinitionsByKey.get(key) ?? null).filter(
|
|
2259
|
+
(task) => task !== null && (task.is_meta === true || task.is_sub_meta === true)
|
|
2260
|
+
).sort(
|
|
2261
|
+
(left, right) => `${left.name}:${left.version}`.localeCompare(`${right.name}:${right.version}`)
|
|
2262
|
+
);
|
|
2263
|
+
const businessLocalMetaSignals = Array.from(businessLocalMetaSignalNames).map((name) => signalDefinitionsByName.get(name) ?? null).filter(
|
|
2264
|
+
(signal) => signal !== null && signal.is_meta === true
|
|
2265
|
+
).sort((left, right) => left.name.localeCompare(right.name));
|
|
2266
|
+
const businessLocalMetaIntents = Array.from(businessLocalMetaIntentNames).map((name) => intentDefinitionsByName.get(name) ?? null).filter(
|
|
2267
|
+
(intent) => intent !== null && intent.is_meta === true
|
|
2268
|
+
).sort((left, right) => left.name.localeCompare(right.name));
|
|
2269
|
+
const businessLocalMetaActors = Array.from(businessLocalMetaActorKeys).map((key) => actorDefinitionsByKey.get(key) ?? null).filter(
|
|
2270
|
+
(actor) => actor !== null && actor.is_meta === true
|
|
2271
|
+
).sort(
|
|
2272
|
+
(left, right) => `${left.name}:${left.version}`.localeCompare(`${right.name}:${right.version}`)
|
|
2273
|
+
);
|
|
2274
|
+
const businessLocalMetaRoutines = Array.from(businessLocalMetaRoutineKeys).map((key) => routineDefinitionsByKey.get(key) ?? null).filter(
|
|
2275
|
+
(routine) => routine !== null && routine.is_meta === true
|
|
2276
|
+
).sort(
|
|
2277
|
+
(left, right) => `${left.name}:${left.version}`.localeCompare(`${right.name}:${right.version}`)
|
|
2278
|
+
);
|
|
2279
|
+
const cumulativeTasks = publicationLayer === "routing_capability" ? routingTasks : publicationLayer === "business_structural" ? Array.from(
|
|
2280
|
+
new Map(
|
|
2281
|
+
[...routingTasks, ...businessTasks, ...businessLocalMetaTasks].map((task) => [
|
|
2282
|
+
buildTaskKey(task),
|
|
2283
|
+
task
|
|
2284
|
+
])
|
|
2285
|
+
).values()
|
|
2286
|
+
).sort(
|
|
2287
|
+
(left, right) => `${left.name}:${left.version}`.localeCompare(`${right.name}:${right.version}`)
|
|
2288
|
+
) : Array.from(
|
|
2289
|
+
new Map(
|
|
2290
|
+
[...routingTasks, ...businessTasks, ...localMetaTasks].map((task) => [
|
|
2291
|
+
buildTaskKey(task),
|
|
2292
|
+
task
|
|
2293
|
+
])
|
|
2294
|
+
).values()
|
|
2295
|
+
).sort(
|
|
2296
|
+
(left, right) => `${left.name}:${left.version}`.localeCompare(`${right.name}:${right.version}`)
|
|
2297
|
+
);
|
|
2298
|
+
const cumulativeSignals = publicationLayer === "routing_capability" ? routingSignals : publicationLayer === "business_structural" ? Array.from(
|
|
2299
|
+
new Map(
|
|
2300
|
+
[...routingSignals, ...businessSignals, ...businessLocalMetaSignals].map(
|
|
2301
|
+
(signal) => [signal.name, signal]
|
|
1939
2302
|
)
|
|
1940
|
-
)
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
2303
|
+
).values()
|
|
2304
|
+
).sort((left, right) => left.name.localeCompare(right.name)) : Array.from(
|
|
2305
|
+
new Map(
|
|
2306
|
+
[...routingSignals, ...businessSignals, ...localMetaSignals].map((signal) => [
|
|
2307
|
+
signal.name,
|
|
2308
|
+
signal
|
|
2309
|
+
])
|
|
2310
|
+
).values()
|
|
2311
|
+
).sort((left, right) => left.name.localeCompare(right.name));
|
|
2312
|
+
const cumulativeIntents = publicationLayer === "routing_capability" ? routingIntents : publicationLayer === "business_structural" ? Array.from(
|
|
2313
|
+
new Map(
|
|
2314
|
+
[...routingIntents, ...businessIntents, ...businessLocalMetaIntents].map(
|
|
2315
|
+
(intent) => [intent.name, intent]
|
|
1944
2316
|
)
|
|
1945
|
-
)
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
2317
|
+
).values()
|
|
2318
|
+
).sort((left, right) => left.name.localeCompare(right.name)) : Array.from(
|
|
2319
|
+
new Map(
|
|
2320
|
+
[...routingIntents, ...businessIntents, ...localMetaIntents].map((intent) => [
|
|
2321
|
+
intent.name,
|
|
2322
|
+
intent
|
|
2323
|
+
])
|
|
2324
|
+
).values()
|
|
2325
|
+
).sort((left, right) => left.name.localeCompare(right.name));
|
|
2326
|
+
const cumulativeActors = publicationLayer === "routing_capability" ? [] : publicationLayer === "business_structural" ? Array.from(
|
|
2327
|
+
new Map(
|
|
2328
|
+
[...businessActors, ...businessLocalMetaActors].map((actor) => [
|
|
2329
|
+
buildActorKey(actor),
|
|
2330
|
+
actor
|
|
2331
|
+
])
|
|
2332
|
+
).values()
|
|
2333
|
+
).sort(
|
|
2334
|
+
(left, right) => `${left.name}:${left.version}`.localeCompare(`${right.name}:${right.version}`)
|
|
2335
|
+
) : Array.from(
|
|
2336
|
+
new Map(
|
|
2337
|
+
[...businessActors, ...localMetaActors].map((actor) => [
|
|
2338
|
+
buildActorKey(actor),
|
|
2339
|
+
actor
|
|
2340
|
+
])
|
|
2341
|
+
).values()
|
|
2342
|
+
).sort(
|
|
2343
|
+
(left, right) => `${left.name}:${left.version}`.localeCompare(`${right.name}:${right.version}`)
|
|
2344
|
+
);
|
|
2345
|
+
const cumulativeRoutines = publicationLayer === "routing_capability" ? [] : publicationLayer === "business_structural" ? Array.from(
|
|
2346
|
+
new Map(
|
|
2347
|
+
[...businessRoutines, ...businessLocalMetaRoutines].map((routine) => [
|
|
2348
|
+
buildRoutineKey(routine),
|
|
2349
|
+
routine
|
|
2350
|
+
])
|
|
2351
|
+
).values()
|
|
2352
|
+
).sort(
|
|
2353
|
+
(left, right) => `${left.name}:${left.version}`.localeCompare(`${right.name}:${right.version}`)
|
|
2354
|
+
) : Array.from(
|
|
2355
|
+
new Map(
|
|
2356
|
+
[...businessRoutines, ...localMetaRoutines].map((routine) => [
|
|
2357
|
+
buildRoutineKey(routine),
|
|
2358
|
+
routine
|
|
2359
|
+
])
|
|
2360
|
+
).values()
|
|
2361
|
+
).sort(
|
|
2362
|
+
(left, right) => `${left.name}:${left.version}`.localeCompare(`${right.name}:${right.version}`)
|
|
2363
|
+
);
|
|
2364
|
+
const cumulativeDirectionalTaskMaps = publicationLayer === "routing_capability" ? [] : publicationLayer === "business_structural" ? businessDirectionalTaskMaps : Array.from(
|
|
2365
|
+
new Map(
|
|
2366
|
+
[...businessDirectionalTaskMaps, ...localMetaDirectionalTaskMaps].map(
|
|
2367
|
+
(map) => [
|
|
2368
|
+
`${map.predecessor_service_name}|${map.predecessor_task_name}|${map.predecessor_task_version}|${map.service_name}|${map.task_name}|${map.task_version}`,
|
|
2369
|
+
map
|
|
2370
|
+
]
|
|
1949
2371
|
)
|
|
1950
|
-
)
|
|
2372
|
+
).values()
|
|
2373
|
+
);
|
|
2374
|
+
const cumulativeActorTaskMaps = publicationLayer === "routing_capability" ? [] : publicationLayer === "business_structural" ? Array.from(
|
|
2375
|
+
new Map(
|
|
2376
|
+
[...businessActorTaskMaps, ...localMetaActorTaskMaps].map((map) => [
|
|
2377
|
+
`${map.service_name}|${map.actor_name}|${map.actor_version}|${map.task_name}|${map.task_version}|${map.mode}`,
|
|
2378
|
+
map
|
|
2379
|
+
])
|
|
2380
|
+
).values()
|
|
2381
|
+
) : Array.from(
|
|
2382
|
+
new Map(
|
|
2383
|
+
[...businessActorTaskMaps, ...localMetaActorTaskMaps].map((map) => [
|
|
2384
|
+
`${map.service_name}|${map.actor_name}|${map.actor_version}|${map.task_name}|${map.task_version}|${map.mode}`,
|
|
2385
|
+
map
|
|
2386
|
+
])
|
|
2387
|
+
).values()
|
|
2388
|
+
);
|
|
2389
|
+
const cumulativeTaskToRoutineMaps = publicationLayer === "routing_capability" ? [] : publicationLayer === "business_structural" ? businessTaskToRoutineMaps : Array.from(
|
|
2390
|
+
new Map(
|
|
2391
|
+
[...businessTaskToRoutineMaps, ...localMetaTaskToRoutineMaps].map((map) => [
|
|
2392
|
+
`${map.service_name}|${map.task_name}|${map.task_version}|${map.routine_name}|${map.routine_version}`,
|
|
2393
|
+
map
|
|
2394
|
+
])
|
|
2395
|
+
).values()
|
|
2396
|
+
);
|
|
2397
|
+
const manifestBody = {
|
|
2398
|
+
serviceName,
|
|
2399
|
+
serviceInstanceId,
|
|
2400
|
+
publicationLayer,
|
|
2401
|
+
tasks: cumulativeTasks,
|
|
2402
|
+
signals: cumulativeSignals,
|
|
2403
|
+
intents: cumulativeIntents,
|
|
2404
|
+
actors: cumulativeActors,
|
|
2405
|
+
routines: cumulativeRoutines,
|
|
2406
|
+
directionalTaskMaps: cumulativeDirectionalTaskMaps,
|
|
2407
|
+
signalToTaskMaps: publicationLayer === "routing_capability" ? publishedSignalTaskMaps : publicationLayer === "local_meta_structural" ? [...publishedSignalTaskMaps, ...localMetaSignalTaskMaps] : [...publishedSignalTaskMaps, ...localMetaSignalTaskMaps],
|
|
2408
|
+
intentToTaskMaps: publicationLayer === "routing_capability" ? publishedIntentTaskMaps : publicationLayer === "local_meta_structural" ? [...publishedIntentTaskMaps, ...localMetaIntentTaskMaps] : [...publishedIntentTaskMaps, ...localMetaIntentTaskMaps],
|
|
2409
|
+
actorTaskMaps: cumulativeActorTaskMaps,
|
|
2410
|
+
taskToRoutineMaps: cumulativeTaskToRoutineMaps
|
|
1951
2411
|
};
|
|
1952
2412
|
return {
|
|
1953
2413
|
...manifestBody,
|
|
@@ -2085,7 +2545,7 @@ var SERVICE_REGISTRY_TRACE_SERVICE2 = (process.env.CADENZA_SERVICE_REGISTRY_TRAC
|
|
|
2085
2545
|
function shouldTraceServiceRegistry(serviceName) {
|
|
2086
2546
|
return SERVICE_REGISTRY_TRACE_SERVICE2.length > 0 && serviceName === SERVICE_REGISTRY_TRACE_SERVICE2;
|
|
2087
2547
|
}
|
|
2088
|
-
function buildServiceRegistryInsertQueryData(ctx, queryData) {
|
|
2548
|
+
function buildServiceRegistryInsertQueryData(tableName, ctx, queryData) {
|
|
2089
2549
|
const joinedContexts = Array.isArray(ctx.joinedContexts) ? ctx.joinedContexts : [];
|
|
2090
2550
|
const getJoinedValue = (key) => {
|
|
2091
2551
|
for (let index = joinedContexts.length - 1; index >= 0; index -= 1) {
|
|
@@ -2103,7 +2563,8 @@ function buildServiceRegistryInsertQueryData(ctx, queryData) {
|
|
|
2103
2563
|
if (!Object.prototype.hasOwnProperty.call(queryData, "onConflict")) {
|
|
2104
2564
|
delete nextQueryData.onConflict;
|
|
2105
2565
|
}
|
|
2106
|
-
const
|
|
2566
|
+
const preferRegistrationData = tableName === "service" || tableName === "service_instance" || tableName === "service_instance_transport";
|
|
2567
|
+
const resolvedData = preferRegistrationData ? registrationData ?? (Object.prototype.hasOwnProperty.call(ctx, "data") || ctx.data !== void 0 ? ctx.data : getJoinedValue("data")) : Object.prototype.hasOwnProperty.call(ctx, "data") || ctx.data !== void 0 ? ctx.data : getJoinedValue("data");
|
|
2107
2568
|
const resolvedBatch = Object.prototype.hasOwnProperty.call(ctx, "batch") || ctx.batch !== void 0 ? ctx.batch : getJoinedValue("batch");
|
|
2108
2569
|
const nextData = resolvedData !== void 0 ? resolvedData && typeof resolvedData === "object" ? { ...resolvedData } : resolvedData : registrationData && typeof registrationData === "object" && !Array.isArray(registrationData) ? { ...registrationData } : registrationData;
|
|
2109
2570
|
if (nextData !== void 0) {
|
|
@@ -2130,8 +2591,114 @@ function sanitizeServiceRegistryInsertExecutionContext(ctx) {
|
|
|
2130
2591
|
delete sanitized.returnedValue;
|
|
2131
2592
|
delete sanitized.queryData;
|
|
2132
2593
|
delete sanitized.onConflict;
|
|
2594
|
+
delete sanitized.task;
|
|
2595
|
+
delete sanitized.routine;
|
|
2596
|
+
delete sanitized.httpServer;
|
|
2597
|
+
delete sanitized.service;
|
|
2598
|
+
delete sanitized.serviceInstance;
|
|
2599
|
+
delete sanitized.joinedContexts;
|
|
2600
|
+
delete sanitized.__declaredTransports;
|
|
2601
|
+
delete sanitized.__resolverOriginalContext;
|
|
2602
|
+
delete sanitized.__resolverQueryData;
|
|
2603
|
+
return sanitized;
|
|
2604
|
+
}
|
|
2605
|
+
function sanitizeAuthorityBootstrapDelegationContext(ctx) {
|
|
2606
|
+
const sanitized = stripDelegationRequestSnapshot({
|
|
2607
|
+
...ctx
|
|
2608
|
+
});
|
|
2609
|
+
delete sanitized.__resolverOriginalContext;
|
|
2610
|
+
delete sanitized.__resolverQueryData;
|
|
2611
|
+
delete sanitized.joinedContexts;
|
|
2612
|
+
delete sanitized.httpServer;
|
|
2613
|
+
delete sanitized.service;
|
|
2614
|
+
delete sanitized.serviceInstance;
|
|
2615
|
+
delete sanitized.task;
|
|
2616
|
+
delete sanitized.routine;
|
|
2617
|
+
delete sanitized.__declaredTransports;
|
|
2618
|
+
const queryData = sanitized.queryData && typeof sanitized.queryData === "object" ? { ...sanitized.queryData } : null;
|
|
2619
|
+
if (queryData) {
|
|
2620
|
+
delete queryData.joinedContexts;
|
|
2621
|
+
sanitized.queryData = queryData;
|
|
2622
|
+
}
|
|
2133
2623
|
return sanitized;
|
|
2134
2624
|
}
|
|
2625
|
+
function cloneServiceRegistryContextValue(value) {
|
|
2626
|
+
if (value instanceof Date) {
|
|
2627
|
+
return new Date(value.getTime());
|
|
2628
|
+
}
|
|
2629
|
+
if (Array.isArray(value)) {
|
|
2630
|
+
return value.map(
|
|
2631
|
+
(entry) => cloneServiceRegistryContextValue(entry)
|
|
2632
|
+
);
|
|
2633
|
+
}
|
|
2634
|
+
if (value && typeof value === "object") {
|
|
2635
|
+
const clone = {};
|
|
2636
|
+
for (const [key, nestedValue] of Object.entries(value)) {
|
|
2637
|
+
clone[key] = cloneServiceRegistryContextValue(nestedValue);
|
|
2638
|
+
}
|
|
2639
|
+
return clone;
|
|
2640
|
+
}
|
|
2641
|
+
return value;
|
|
2642
|
+
}
|
|
2643
|
+
function buildServiceRegistryResolverOriginalContext(tableName, ctx, queryData) {
|
|
2644
|
+
const originalContext = {};
|
|
2645
|
+
for (const key of [
|
|
2646
|
+
"__serviceName",
|
|
2647
|
+
"serviceName",
|
|
2648
|
+
"__serviceInstanceId",
|
|
2649
|
+
"serviceInstanceId",
|
|
2650
|
+
"__registrationData",
|
|
2651
|
+
"__reason",
|
|
2652
|
+
"__syncing",
|
|
2653
|
+
"__syncSourceServiceName",
|
|
2654
|
+
"__preferredTransportProtocol",
|
|
2655
|
+
"__networkMode",
|
|
2656
|
+
"__securityProfile",
|
|
2657
|
+
"__loadBalance",
|
|
2658
|
+
"__cadenzaDBConnect",
|
|
2659
|
+
"__isFrontend",
|
|
2660
|
+
"__isDatabase",
|
|
2661
|
+
"__retryCount",
|
|
2662
|
+
"__retries",
|
|
2663
|
+
"__triedInstances"
|
|
2664
|
+
]) {
|
|
2665
|
+
if (ctx[key] !== void 0) {
|
|
2666
|
+
originalContext[key] = cloneServiceRegistryContextValue(ctx[key]);
|
|
2667
|
+
}
|
|
2668
|
+
}
|
|
2669
|
+
if (queryData.data !== void 0) {
|
|
2670
|
+
originalContext.data = cloneServiceRegistryContextValue(queryData.data);
|
|
2671
|
+
}
|
|
2672
|
+
if (queryData.batch !== void 0) {
|
|
2673
|
+
originalContext.batch = cloneServiceRegistryContextValue(queryData.batch);
|
|
2674
|
+
}
|
|
2675
|
+
if (Object.prototype.hasOwnProperty.call(queryData, "onConflict")) {
|
|
2676
|
+
originalContext.queryData = {
|
|
2677
|
+
data: queryData.data !== void 0 ? cloneServiceRegistryContextValue(queryData.data) : void 0,
|
|
2678
|
+
batch: queryData.batch !== void 0 ? cloneServiceRegistryContextValue(queryData.batch) : void 0,
|
|
2679
|
+
onConflict: cloneServiceRegistryContextValue(queryData.onConflict)
|
|
2680
|
+
};
|
|
2681
|
+
} else if (queryData.data !== void 0 || queryData.batch !== void 0) {
|
|
2682
|
+
originalContext.queryData = {
|
|
2683
|
+
data: queryData.data !== void 0 ? cloneServiceRegistryContextValue(queryData.data) : void 0,
|
|
2684
|
+
batch: queryData.batch !== void 0 ? cloneServiceRegistryContextValue(queryData.batch) : void 0
|
|
2685
|
+
};
|
|
2686
|
+
}
|
|
2687
|
+
if (tableName === "service_instance") {
|
|
2688
|
+
for (const key of [
|
|
2689
|
+
"__transportData",
|
|
2690
|
+
"transportData",
|
|
2691
|
+
"__useSocket",
|
|
2692
|
+
"__retryCount",
|
|
2693
|
+
"__isFrontend"
|
|
2694
|
+
]) {
|
|
2695
|
+
if (ctx[key] !== void 0) {
|
|
2696
|
+
originalContext[key] = cloneServiceRegistryContextValue(ctx[key]);
|
|
2697
|
+
}
|
|
2698
|
+
}
|
|
2699
|
+
}
|
|
2700
|
+
return originalContext;
|
|
2701
|
+
}
|
|
2135
2702
|
function clearTransientRoutingErrorState(context) {
|
|
2136
2703
|
delete context.errored;
|
|
2137
2704
|
delete context.failed;
|
|
@@ -2187,7 +2754,8 @@ function normalizeServiceRegistryInsertResult(tableName, ctx, queryData, rawResu
|
|
|
2187
2754
|
delete result.__resolverOriginalContext;
|
|
2188
2755
|
delete result.__resolverQueryData;
|
|
2189
2756
|
const normalizedQueryData = result.queryData && typeof result.queryData === "object" ? { ...result.queryData } : { ...queryData };
|
|
2190
|
-
const
|
|
2757
|
+
const preferRequestedData = tableName === "service" || tableName === "service_instance" || tableName === "service_instance_transport";
|
|
2758
|
+
const resolvedData = preferRequestedData ? normalizedQueryData.data ?? queryData.data ?? ctx.data ?? ctx.__registrationData ?? result.data : result.data ?? normalizedQueryData.data ?? queryData.data ?? ctx.data ?? ctx.__registrationData;
|
|
2191
2759
|
if (resolvedData !== void 0 && result.data === void 0) {
|
|
2192
2760
|
result.data = resolvedData;
|
|
2193
2761
|
}
|
|
@@ -2217,6 +2785,7 @@ function normalizeServiceRegistryInsertResult(tableName, ctx, queryData, rawResu
|
|
|
2217
2785
|
).trim();
|
|
2218
2786
|
if (resolvedServiceName) {
|
|
2219
2787
|
result.__serviceName = resolvedServiceName;
|
|
2788
|
+
result.serviceName = resolvedServiceName;
|
|
2220
2789
|
}
|
|
2221
2790
|
}
|
|
2222
2791
|
const resolvedLocalServiceInstanceId = String(
|
|
@@ -2225,6 +2794,18 @@ function normalizeServiceRegistryInsertResult(tableName, ctx, queryData, rawResu
|
|
|
2225
2794
|
if (resolvedLocalServiceInstanceId) {
|
|
2226
2795
|
result.__serviceInstanceId = resolvedLocalServiceInstanceId;
|
|
2227
2796
|
}
|
|
2797
|
+
if (tableName === "service_instance") {
|
|
2798
|
+
const resolvedServiceName = String(
|
|
2799
|
+
ctx.__serviceName ?? resolveServiceNameFromContext(ctx) ?? resolvedData?.service_name ?? resolvedData?.serviceName ?? ""
|
|
2800
|
+
).trim();
|
|
2801
|
+
if (resolvedServiceName) {
|
|
2802
|
+
result.__serviceName = resolvedServiceName;
|
|
2803
|
+
result.serviceName = resolvedServiceName;
|
|
2804
|
+
}
|
|
2805
|
+
if (resolvedLocalServiceInstanceId) {
|
|
2806
|
+
result.serviceInstanceId = resolvedLocalServiceInstanceId;
|
|
2807
|
+
}
|
|
2808
|
+
}
|
|
2228
2809
|
if (tableName === "service_instance" || tableName === "service_instance_transport") {
|
|
2229
2810
|
const resolvedUuid = String(
|
|
2230
2811
|
result.uuid ?? resolvedData?.uuid ?? ctx.__serviceInstanceId ?? ""
|
|
@@ -2324,9 +2905,15 @@ function resolveServiceRegistryInsertTask(tableName, queryData = {}, options = {
|
|
|
2324
2905
|
ctx
|
|
2325
2906
|
);
|
|
2326
2907
|
const nextQueryData = buildServiceRegistryInsertQueryData(
|
|
2908
|
+
tableName,
|
|
2327
2909
|
sanitizedContext,
|
|
2328
2910
|
queryData
|
|
2329
2911
|
);
|
|
2912
|
+
const resolverOriginalContext = buildServiceRegistryResolverOriginalContext(
|
|
2913
|
+
tableName,
|
|
2914
|
+
sanitizedContext,
|
|
2915
|
+
nextQueryData
|
|
2916
|
+
);
|
|
2330
2917
|
const delegationContext = ensureDelegationContextMetadata({
|
|
2331
2918
|
...sanitizedContext,
|
|
2332
2919
|
data: nextQueryData.data !== void 0 ? nextQueryData.data : sanitizedContext.data,
|
|
@@ -2339,9 +2926,7 @@ function resolveServiceRegistryInsertTask(tableName, queryData = {}, options = {
|
|
|
2339
2926
|
delegationContext.__metadata.__blockRemoteExecution = delegationContext.__metadata.__blockRemoteExecution ?? delegationContext.__blockRemoteExecution ?? false;
|
|
2340
2927
|
const nextContext = {
|
|
2341
2928
|
...delegationContext,
|
|
2342
|
-
__resolverOriginalContext:
|
|
2343
|
-
...sanitizedContext
|
|
2344
|
-
},
|
|
2929
|
+
__resolverOriginalContext: resolverOriginalContext,
|
|
2345
2930
|
__resolverQueryData: nextQueryData
|
|
2346
2931
|
};
|
|
2347
2932
|
if (tableName === "service_instance_transport" && shouldTraceServiceRegistry(
|
|
@@ -2513,6 +3098,7 @@ function resolveServiceRegistryInsertTask(tableName, queryData = {}, options = {
|
|
|
2513
3098
|
if (bootstrapAuthorityInsertSpec) {
|
|
2514
3099
|
const sanitizedContext = sanitizeServiceRegistryInsertExecutionContext(ctx);
|
|
2515
3100
|
const nextQueryData = buildServiceRegistryInsertQueryData(
|
|
3101
|
+
tableName,
|
|
2516
3102
|
sanitizedContext,
|
|
2517
3103
|
queryData
|
|
2518
3104
|
);
|
|
@@ -2947,6 +3533,9 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
2947
3533
|
ctx.deleted ?? ctx.serviceInstance?.deleted ?? ctx.data?.deleted
|
|
2948
3534
|
);
|
|
2949
3535
|
if (uuid9 === this.serviceInstanceId) return;
|
|
3536
|
+
if (serviceName === this.serviceName) {
|
|
3537
|
+
return false;
|
|
3538
|
+
}
|
|
2950
3539
|
if (deleted) {
|
|
2951
3540
|
const existingInstance = this.instances.get(serviceName)?.find((instance) => instance.uuid === uuid9);
|
|
2952
3541
|
const indexToDelete = this.instances.get(serviceName)?.findIndex((i) => i.uuid === uuid9) ?? -1;
|
|
@@ -3033,9 +3622,6 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
3033
3622
|
emit2
|
|
3034
3623
|
);
|
|
3035
3624
|
}
|
|
3036
|
-
if (this.serviceName === serviceName) {
|
|
3037
|
-
return false;
|
|
3038
|
-
}
|
|
3039
3625
|
if (trackedInstance?.isFrontend) {
|
|
3040
3626
|
return true;
|
|
3041
3627
|
}
|
|
@@ -3089,6 +3675,9 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
3089
3675
|
if (!ownerInstance) {
|
|
3090
3676
|
return false;
|
|
3091
3677
|
}
|
|
3678
|
+
if (ownerInstance.serviceName === this.serviceName && ownerInstance.uuid !== this.serviceInstanceId) {
|
|
3679
|
+
return false;
|
|
3680
|
+
}
|
|
3092
3681
|
if (transport.deleted) {
|
|
3093
3682
|
this.clearTransportFailureState(ownerInstance.uuid, transport.uuid);
|
|
3094
3683
|
const transportKey = this.buildTransportRouteKey(
|
|
@@ -5515,6 +6104,8 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
5515
6104
|
seenSignalMaps,
|
|
5516
6105
|
(row) => `${String(row.service_name ?? row.serviceName ?? "").trim()}|${String(
|
|
5517
6106
|
row.signal_name ?? row.signalName ?? ""
|
|
6107
|
+
).trim()}|${String(row.task_name ?? row.taskName ?? "").trim()}|${String(
|
|
6108
|
+
row.task_version ?? row.taskVersion ?? 1
|
|
5518
6109
|
).trim()}`
|
|
5519
6110
|
);
|
|
5520
6111
|
pushUnique(
|
|
@@ -5549,6 +6140,8 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
5549
6140
|
seenSignalMaps,
|
|
5550
6141
|
(entry) => `${String(entry.service_name ?? entry.serviceName ?? "").trim()}|${String(
|
|
5551
6142
|
entry.signal_name ?? entry.signalName ?? ""
|
|
6143
|
+
).trim()}|${String(entry.task_name ?? entry.taskName ?? "").trim()}|${String(
|
|
6144
|
+
entry.task_version ?? entry.taskVersion ?? 1
|
|
5552
6145
|
).trim()}`
|
|
5553
6146
|
);
|
|
5554
6147
|
continue;
|
|
@@ -5581,9 +6174,36 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
5581
6174
|
}
|
|
5582
6175
|
}
|
|
5583
6176
|
}
|
|
5584
|
-
const
|
|
5585
|
-
|
|
5586
|
-
|
|
6177
|
+
const activeServiceInstanceIds = new Set(
|
|
6178
|
+
serviceInstances.filter((row) => row.is_active === true || row.isActive === true).map((row) => String(row.uuid ?? "").trim()).filter((uuid9) => uuid9.length > 0)
|
|
6179
|
+
);
|
|
6180
|
+
const filteredServiceInstances = activeServiceInstanceIds.size > 0 ? serviceInstances.filter(
|
|
6181
|
+
(row) => activeServiceInstanceIds.has(String(row.uuid ?? "").trim())
|
|
6182
|
+
) : serviceInstances;
|
|
6183
|
+
const filteredServiceInstanceTransports = activeServiceInstanceIds.size > 0 ? serviceInstanceTransports.filter(
|
|
6184
|
+
(row) => activeServiceInstanceIds.has(
|
|
6185
|
+
String(row.service_instance_id ?? row.serviceInstanceId ?? "").trim()
|
|
6186
|
+
)
|
|
6187
|
+
) : serviceInstanceTransports;
|
|
6188
|
+
const filteredManifestSnapshots = activeServiceInstanceIds.size > 0 ? manifestSnapshots.filter(
|
|
6189
|
+
(snapshot) => activeServiceInstanceIds.has(snapshot.serviceInstanceId)
|
|
6190
|
+
) : manifestSnapshots;
|
|
6191
|
+
const activeServiceNames = new Set(
|
|
6192
|
+
filteredServiceInstances.map((row) => String(row.service_name ?? row.serviceName ?? "").trim()).filter((serviceName) => serviceName.length > 0)
|
|
6193
|
+
);
|
|
6194
|
+
const filteredSignalToTaskMaps = activeServiceNames.size > 0 ? signalToTaskMaps.filter(
|
|
6195
|
+
(row) => activeServiceNames.has(
|
|
6196
|
+
String(row.service_name ?? row.serviceName ?? "").trim()
|
|
6197
|
+
)
|
|
6198
|
+
) : signalToTaskMaps;
|
|
6199
|
+
const filteredIntentToTaskMaps = activeServiceNames.size > 0 ? intentToTaskMaps.filter(
|
|
6200
|
+
(row) => activeServiceNames.has(
|
|
6201
|
+
String(row.service_name ?? row.serviceName ?? "").trim()
|
|
6202
|
+
)
|
|
6203
|
+
) : intentToTaskMaps;
|
|
6204
|
+
const hasExplicitSignalRoutingRows = filteredSignalToTaskMaps.length > 0;
|
|
6205
|
+
const hasExplicitIntentRoutingRows = filteredIntentToTaskMaps.length > 0;
|
|
6206
|
+
const latestManifestSnapshots = selectLatestServiceManifestSnapshots(filteredManifestSnapshots);
|
|
5587
6207
|
const explodedManifest = explodeServiceManifestSnapshots(
|
|
5588
6208
|
latestManifestSnapshots
|
|
5589
6209
|
);
|
|
@@ -5666,7 +6286,7 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
5666
6286
|
if (!hasExplicitSignalRoutingRows) {
|
|
5667
6287
|
pushUnique(
|
|
5668
6288
|
explodedManifest.signalToTaskMaps,
|
|
5669
|
-
|
|
6289
|
+
filteredSignalToTaskMaps,
|
|
5670
6290
|
seenSignalMaps,
|
|
5671
6291
|
(row) => `${String(row.signal_name ?? "").trim()}|${String(
|
|
5672
6292
|
row.service_name ?? ""
|
|
@@ -5678,7 +6298,7 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
5678
6298
|
if (!hasExplicitIntentRoutingRows) {
|
|
5679
6299
|
pushUnique(
|
|
5680
6300
|
explodedManifest.intentToTaskMaps,
|
|
5681
|
-
|
|
6301
|
+
filteredIntentToTaskMaps,
|
|
5682
6302
|
seenIntentMaps,
|
|
5683
6303
|
(row) => `${String(row.intent_name ?? "").trim()}|${String(
|
|
5684
6304
|
row.service_name ?? ""
|
|
@@ -5688,8 +6308,8 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
5688
6308
|
);
|
|
5689
6309
|
}
|
|
5690
6310
|
return {
|
|
5691
|
-
serviceInstances,
|
|
5692
|
-
serviceInstanceTransports,
|
|
6311
|
+
serviceInstances: filteredServiceInstances,
|
|
6312
|
+
serviceInstanceTransports: filteredServiceInstanceTransports,
|
|
5693
6313
|
serviceManifests,
|
|
5694
6314
|
tasks,
|
|
5695
6315
|
signals,
|
|
@@ -5699,8 +6319,8 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
5699
6319
|
directionalTaskMaps,
|
|
5700
6320
|
actorTaskMaps,
|
|
5701
6321
|
taskToRoutineMaps,
|
|
5702
|
-
signalToTaskMaps,
|
|
5703
|
-
intentToTaskMaps
|
|
6322
|
+
signalToTaskMaps: filteredSignalToTaskMaps,
|
|
6323
|
+
intentToTaskMaps: filteredIntentToTaskMaps
|
|
5704
6324
|
};
|
|
5705
6325
|
}
|
|
5706
6326
|
buildRemoteIntentDeputyKey(map) {
|
|
@@ -6129,10 +6749,11 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
6129
6749
|
const controller = typeof AbortController === "function" ? new AbortController() : null;
|
|
6130
6750
|
const timeoutId = controller ? setTimeout(() => controller.abort(), timeoutMs) : null;
|
|
6131
6751
|
try {
|
|
6752
|
+
const sanitizedContext = sanitizeAuthorityBootstrapDelegationContext(context);
|
|
6132
6753
|
const requestBody = stripDelegationRequestSnapshot(
|
|
6133
6754
|
ensureDelegationContextMetadata(
|
|
6134
6755
|
attachDelegationRequestSnapshot({
|
|
6135
|
-
...
|
|
6756
|
+
...sanitizedContext,
|
|
6136
6757
|
__remoteRoutineName: remoteRoutineName,
|
|
6137
6758
|
__serviceName: "CadenzaDB",
|
|
6138
6759
|
__localServiceName: this.serviceName,
|
|
@@ -6146,7 +6767,7 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
6146
6767
|
__fetchId: target.fetchId,
|
|
6147
6768
|
fetchId: target.fetchId,
|
|
6148
6769
|
__metadata: {
|
|
6149
|
-
...
|
|
6770
|
+
...sanitizedContext.__metadata && typeof sanitizedContext.__metadata === "object" ? sanitizedContext.__metadata : {},
|
|
6150
6771
|
__timeout: timeoutMs,
|
|
6151
6772
|
__syncing: true,
|
|
6152
6773
|
__authorityBootstrapChannel: true
|
|
@@ -6164,22 +6785,22 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
6164
6785
|
});
|
|
6165
6786
|
if ("ok" in response && response.ok === false) {
|
|
6166
6787
|
return {
|
|
6167
|
-
...
|
|
6788
|
+
...sanitizedContext,
|
|
6168
6789
|
__error: `Bootstrap authority delegation failed with HTTP ${response.status}`,
|
|
6169
6790
|
errored: true
|
|
6170
6791
|
};
|
|
6171
6792
|
}
|
|
6172
6793
|
const payload = typeof response.json === "function" ? await response.json() : response;
|
|
6173
6794
|
return payload && typeof payload === "object" ? {
|
|
6174
|
-
...
|
|
6795
|
+
...sanitizedContext,
|
|
6175
6796
|
...payload
|
|
6176
6797
|
} : {
|
|
6177
|
-
...
|
|
6798
|
+
...sanitizedContext,
|
|
6178
6799
|
returnedValue: payload
|
|
6179
6800
|
};
|
|
6180
6801
|
} catch (error) {
|
|
6181
6802
|
return {
|
|
6182
|
-
...context,
|
|
6803
|
+
...sanitizeAuthorityBootstrapDelegationContext(context),
|
|
6183
6804
|
__error: error instanceof Error ? error.message : String(error),
|
|
6184
6805
|
errored: true
|
|
6185
6806
|
};
|
|
@@ -9287,9 +9908,9 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
9287
9908
|
};
|
|
9288
9909
|
|
|
9289
9910
|
// src/graph/definition/SignalTransmissionTask.ts
|
|
9290
|
-
var
|
|
9911
|
+
var import_core3 = require("@cadenza.io/core");
|
|
9291
9912
|
var import_uuid4 = require("uuid");
|
|
9292
|
-
var SignalTransmissionTask = class extends
|
|
9913
|
+
var SignalTransmissionTask = class extends import_core3.Task {
|
|
9293
9914
|
/**
|
|
9294
9915
|
* Constructs a new instance of the class and initializes it with the provided parameters.
|
|
9295
9916
|
*
|
|
@@ -11197,8 +11818,8 @@ var SocketController = class _SocketController {
|
|
|
11197
11818
|
}
|
|
11198
11819
|
const routedDelegateCtx = stripTransportSelectionRoutingContext(delegateCtx);
|
|
11199
11820
|
const normalizedDelegateCtx = ensureDelegationContextMetadata(
|
|
11200
|
-
|
|
11201
|
-
|
|
11821
|
+
restoreDelegationRequestSnapshot(
|
|
11822
|
+
attachDelegationRequestSnapshot(routedDelegateCtx)
|
|
11202
11823
|
)
|
|
11203
11824
|
);
|
|
11204
11825
|
delete normalizedDelegateCtx.__isSubMeta;
|
|
@@ -11271,13 +11892,11 @@ var SocketController = class _SocketController {
|
|
|
11271
11892
|
return resolvedResultContext;
|
|
11272
11893
|
} catch (error) {
|
|
11273
11894
|
const message = error instanceof Error ? error.message : String(error);
|
|
11274
|
-
const failedContext =
|
|
11275
|
-
|
|
11276
|
-
|
|
11277
|
-
|
|
11278
|
-
|
|
11279
|
-
...normalizedDelegateCtx.__metadata
|
|
11280
|
-
};
|
|
11895
|
+
const failedContext = buildDelegationFailureContext(
|
|
11896
|
+
"meta.socket_client.delegate_failed",
|
|
11897
|
+
normalizedDelegateCtx,
|
|
11898
|
+
error
|
|
11899
|
+
);
|
|
11281
11900
|
if (deputyExecId) {
|
|
11282
11901
|
emitter(`meta.socket_client.delegated:${deputyExecId}`, {
|
|
11283
11902
|
...failedContext,
|
|
@@ -12282,10 +12901,55 @@ var RuntimeValidationController = class _RuntimeValidationController {
|
|
|
12282
12901
|
};
|
|
12283
12902
|
|
|
12284
12903
|
// src/graph/controllers/registerActorSessionPersistence.ts
|
|
12285
|
-
var
|
|
12904
|
+
var import_core4 = require("@cadenza.io/core");
|
|
12286
12905
|
var ACTOR_SESSION_STATE_PERSIST_CONCURRENCY = 20;
|
|
12287
12906
|
var META_ACTOR_SESSION_STATE_HYDRATE_INTENT = "meta-actor-session-state-hydrate";
|
|
12288
12907
|
var ACTOR_SESSION_TRACE_ENABLED2 = process.env.CADENZA_ACTOR_SESSION_TRACE === "1" || process.env.CADENZA_ACTOR_SESSION_TRACE === "true";
|
|
12908
|
+
function findNestedContextValue(ctx, key) {
|
|
12909
|
+
if (!ctx || typeof ctx !== "object") {
|
|
12910
|
+
return void 0;
|
|
12911
|
+
}
|
|
12912
|
+
if (Object.prototype.hasOwnProperty.call(ctx, key) || ctx[key] !== void 0) {
|
|
12913
|
+
return ctx[key];
|
|
12914
|
+
}
|
|
12915
|
+
const joinedContexts = Array.isArray(ctx.joinedContexts) ? ctx.joinedContexts : [];
|
|
12916
|
+
for (let index = joinedContexts.length - 1; index >= 0; index -= 1) {
|
|
12917
|
+
const nested = joinedContexts[index];
|
|
12918
|
+
if (!nested || typeof nested !== "object") {
|
|
12919
|
+
continue;
|
|
12920
|
+
}
|
|
12921
|
+
const nestedValue = findNestedContextValue(nested, key);
|
|
12922
|
+
if (nestedValue !== void 0) {
|
|
12923
|
+
return nestedValue;
|
|
12924
|
+
}
|
|
12925
|
+
}
|
|
12926
|
+
return void 0;
|
|
12927
|
+
}
|
|
12928
|
+
function resolveActorSessionStateRow(ctx) {
|
|
12929
|
+
const singular = findNestedContextValue(ctx, "actorSessionState");
|
|
12930
|
+
if (singular && typeof singular === "object" && !Array.isArray(singular)) {
|
|
12931
|
+
return singular;
|
|
12932
|
+
}
|
|
12933
|
+
const plural = findNestedContextValue(ctx, "actorSessionStates");
|
|
12934
|
+
if (Array.isArray(plural)) {
|
|
12935
|
+
const first = plural.find(
|
|
12936
|
+
(entry) => entry && typeof entry === "object" && !Array.isArray(entry)
|
|
12937
|
+
);
|
|
12938
|
+
if (first) {
|
|
12939
|
+
return first;
|
|
12940
|
+
}
|
|
12941
|
+
}
|
|
12942
|
+
const rows = findNestedContextValue(ctx, "rows");
|
|
12943
|
+
if (Array.isArray(rows)) {
|
|
12944
|
+
const first = rows.find(
|
|
12945
|
+
(entry) => entry && typeof entry === "object" && !Array.isArray(entry)
|
|
12946
|
+
);
|
|
12947
|
+
if (first) {
|
|
12948
|
+
return first;
|
|
12949
|
+
}
|
|
12950
|
+
}
|
|
12951
|
+
return null;
|
|
12952
|
+
}
|
|
12289
12953
|
function shouldAssumeSuccessfulActorSessionRowCount(ctx) {
|
|
12290
12954
|
return ctx.__success === true && ctx.rowCount === void 0 && ctx.__status === "success" && ctx.__serviceName === "CadenzaDB" && ctx.__localTaskName === "Insert actor_session_state in CadenzaDB";
|
|
12291
12955
|
}
|
|
@@ -12358,7 +13022,7 @@ function registerActorSessionPersistenceTasks() {
|
|
|
12358
13022
|
)
|
|
12359
13023
|
);
|
|
12360
13024
|
}
|
|
12361
|
-
const row =
|
|
13025
|
+
const row = resolveActorSessionStateRow(ctx);
|
|
12362
13026
|
if (!row) {
|
|
12363
13027
|
return {
|
|
12364
13028
|
__success: true,
|
|
@@ -12536,11 +13200,11 @@ function registerActorSessionPersistenceTasks() {
|
|
|
12536
13200
|
},
|
|
12537
13201
|
"Validates and prepares actor_session_state payload for strict write-through persistence.",
|
|
12538
13202
|
localActorSessionTaskOptions
|
|
12539
|
-
).then(insertAndValidateActorSessionStateTask).respondsTo(
|
|
13203
|
+
).then(insertAndValidateActorSessionStateTask).respondsTo(import_core4.META_ACTOR_SESSION_STATE_PERSIST_INTENT);
|
|
12540
13204
|
}
|
|
12541
13205
|
|
|
12542
13206
|
// src/graph/controllers/GraphSyncController.ts
|
|
12543
|
-
var
|
|
13207
|
+
var import_core5 = require("@cadenza.io/core");
|
|
12544
13208
|
var import_uuid6 = require("uuid");
|
|
12545
13209
|
var ACTOR_TASK_METADATA2 = /* @__PURE__ */ Symbol.for("@cadenza.io/core/actor-task-meta");
|
|
12546
13210
|
function getActorTaskRuntimeMetadata2(taskFunction) {
|
|
@@ -12624,7 +13288,7 @@ function buildIntentRegistryData(intent) {
|
|
|
12624
13288
|
};
|
|
12625
13289
|
}
|
|
12626
13290
|
function isLocalOnlySyncIntent(intentName) {
|
|
12627
|
-
return intentName ===
|
|
13291
|
+
return intentName === import_core5.META_ACTOR_SESSION_STATE_PERSIST_INTENT;
|
|
12628
13292
|
}
|
|
12629
13293
|
function getJoinedContextValue(ctx, key) {
|
|
12630
13294
|
const joinedContexts = Array.isArray(ctx.joinedContexts) ? ctx.joinedContexts : [];
|
|
@@ -12763,16 +13427,20 @@ function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, opti
|
|
|
12763
13427
|
ctx,
|
|
12764
13428
|
queryData
|
|
12765
13429
|
);
|
|
12766
|
-
|
|
12767
|
-
|
|
12768
|
-
|
|
12769
|
-
|
|
12770
|
-
|
|
12771
|
-
|
|
12772
|
-
|
|
12773
|
-
|
|
12774
|
-
|
|
12775
|
-
|
|
13430
|
+
const hasEmptyObjectData = originalQueryData.data && typeof originalQueryData.data === "object" && !Array.isArray(originalQueryData.data) && Object.keys(originalQueryData.data).length === 0;
|
|
13431
|
+
const hasMissingData = originalQueryData.data === void 0;
|
|
13432
|
+
if ((tableName === "task" || tableName === "signal_registry" || tableName === "directional_task_graph_map") && (hasEmptyObjectData || hasMissingData)) {
|
|
13433
|
+
console.warn("[CADENZA_SYNC_EMPTY_INSERT]", {
|
|
13434
|
+
tableName,
|
|
13435
|
+
hasMissingData,
|
|
13436
|
+
hasEmptyObjectData,
|
|
13437
|
+
taskName: typeof ctx.__taskName === "string" ? ctx.__taskName : void 0,
|
|
13438
|
+
reason: typeof ctx.__reason === "string" ? ctx.__reason : void 0,
|
|
13439
|
+
syncSourceServiceName: typeof ctx.__syncSourceServiceName === "string" ? ctx.__syncSourceServiceName : void 0,
|
|
13440
|
+
queryData: originalQueryData,
|
|
13441
|
+
ctx,
|
|
13442
|
+
joinedContexts: Array.isArray(ctx.joinedContexts) ? ctx.joinedContexts : []
|
|
13443
|
+
});
|
|
12776
13444
|
}
|
|
12777
13445
|
return buildSyncExecutionEnvelope(
|
|
12778
13446
|
ctx,
|
|
@@ -12863,7 +13531,7 @@ function isBootstrapLocalOnlyActorName(actorName) {
|
|
|
12863
13531
|
return BOOTSTRAP_LOCAL_ONLY_ACTOR_NAMES.has(actorName);
|
|
12864
13532
|
}
|
|
12865
13533
|
function isBootstrapLocalOnlySignal(signalName) {
|
|
12866
|
-
return signalName.startsWith("meta.") || signalName === "meta.service_registry.insert_execution_requested" || signalName === "meta.service_registry.routeable_transport_missing" || signalName === "meta.signal_broker.added" || signalName === "meta.rest.handshake" || signalName === "meta.rest.delegation_target_not_found" || signalName === "meta.socket.handshake" || signalName === "meta.socket.delegation_target_not_found" || signalName === "meta.fetch.handshake_complete" || signalName === "sub_meta.signal_broker.new_trace" || signalName.startsWith("meta.task.") || signalName.startsWith("meta.sync_controller.") || isLocalServiceReadySignal(signalName);
|
|
13534
|
+
return signalName.startsWith("meta.") || signalName.startsWith("global.meta.") || signalName === "meta.service_registry.insert_execution_requested" || signalName === "meta.service_registry.routeable_transport_missing" || signalName === "meta.signal_broker.added" || signalName === "meta.rest.handshake" || signalName === "meta.rest.delegation_target_not_found" || signalName === "meta.socket.handshake" || signalName === "meta.socket.delegation_target_not_found" || signalName === "meta.fetch.handshake_complete" || signalName === "sub_meta.signal_broker.new_trace" || signalName.startsWith("meta.task.") || signalName.startsWith("meta.sync_controller.") || isLocalServiceReadySignal(signalName);
|
|
12867
13535
|
}
|
|
12868
13536
|
function hasNonZeroPending(summary) {
|
|
12869
13537
|
return Object.values(summary).some((value) => Number(value) > 0);
|
|
@@ -13091,6 +13759,12 @@ function resolveLocalRoutineFromSyncContext(ctx) {
|
|
|
13091
13759
|
);
|
|
13092
13760
|
return routineName ? CadenzaService.getRoutine(routineName) : void 0;
|
|
13093
13761
|
}
|
|
13762
|
+
function shouldTrackDirectionalTaskMapForBootstrap(predecessorTask, nextTask) {
|
|
13763
|
+
if (!predecessorTask || !nextTask) {
|
|
13764
|
+
return false;
|
|
13765
|
+
}
|
|
13766
|
+
return predecessorTask.isMeta !== true && predecessorTask.isSubMeta !== true && nextTask.isMeta !== true && nextTask.isSubMeta !== true;
|
|
13767
|
+
}
|
|
13094
13768
|
function resolveSignalNameFromSyncContext(ctx) {
|
|
13095
13769
|
const candidateSignalNames = [
|
|
13096
13770
|
ctx.signalName,
|
|
@@ -14167,7 +14841,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
14167
14841
|
return;
|
|
14168
14842
|
}
|
|
14169
14843
|
for (const t of task.nextTasks) {
|
|
14170
|
-
if (task.taskMapRegistration.has(t.name) || t.hidden || !t.register || !t.registered) {
|
|
14844
|
+
if (task.taskMapRegistration.has(t.name) || t.hidden || !t.register || !t.registered || !shouldTrackDirectionalTaskMapForBootstrap(task, t)) {
|
|
14171
14845
|
continue;
|
|
14172
14846
|
}
|
|
14173
14847
|
const serviceName2 = resolveSyncServiceName(t);
|
|
@@ -14235,7 +14909,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
14235
14909
|
return false;
|
|
14236
14910
|
}
|
|
14237
14911
|
for (const nextTask of task.nextTasks) {
|
|
14238
|
-
if (task.taskMapRegistration.has(nextTask.name) || nextTask.isHidden || !nextTask.register || !nextTask.registered) {
|
|
14912
|
+
if (task.taskMapRegistration.has(nextTask.name) || nextTask.isHidden || !nextTask.register || !nextTask.registered || !shouldTrackDirectionalTaskMapForBootstrap(task, nextTask)) {
|
|
14239
14913
|
continue;
|
|
14240
14914
|
}
|
|
14241
14915
|
if (resolveSyncServiceName(nextTask)) {
|
|
@@ -16553,6 +17227,15 @@ var DEFAULT_DEPUTY_TASK_CONCURRENCY = 50;
|
|
|
16553
17227
|
var DEFAULT_DEPUTY_TASK_TIMEOUT_MS = 12e4;
|
|
16554
17228
|
var DEFAULT_DATABASE_PROXY_TASK_CONCURRENCY = 50;
|
|
16555
17229
|
var DEFAULT_DATABASE_PROXY_TASK_TIMEOUT_MS = 12e4;
|
|
17230
|
+
var SERVICE_MANIFEST_PUBLICATION_ORDER = [
|
|
17231
|
+
"routing_capability",
|
|
17232
|
+
"business_structural",
|
|
17233
|
+
"local_meta_structural"
|
|
17234
|
+
];
|
|
17235
|
+
function getServiceManifestPublicationLayerRank(layer) {
|
|
17236
|
+
const index = SERVICE_MANIFEST_PUBLICATION_ORDER.indexOf(layer);
|
|
17237
|
+
return index >= 0 ? index : SERVICE_MANIFEST_PUBLICATION_ORDER.length - 1;
|
|
17238
|
+
}
|
|
16556
17239
|
var CadenzaService = class {
|
|
16557
17240
|
static unregisterGracefulShutdownHandlers() {
|
|
16558
17241
|
for (const cleanup of this.shutdownHandlerCleanup) {
|
|
@@ -16679,7 +17362,15 @@ var CadenzaService = class {
|
|
|
16679
17362
|
this.replayRegisteredTaskSignalObservations();
|
|
16680
17363
|
this.replayRegisteredTaskIntentAssociations();
|
|
16681
17364
|
}
|
|
16682
|
-
static
|
|
17365
|
+
static normalizeServiceManifestPublicationLayer(value, fallback = "business_structural") {
|
|
17366
|
+
return value === "routing_capability" || value === "business_structural" || value === "local_meta_structural" ? value : fallback;
|
|
17367
|
+
}
|
|
17368
|
+
static mergeServiceManifestPublicationRequest(reason, targetLayer) {
|
|
17369
|
+
this.serviceManifestPublicationPendingReason = reason;
|
|
17370
|
+
const currentTargetLayer = this.serviceManifestPublicationPendingLayer ?? "routing_capability";
|
|
17371
|
+
this.serviceManifestPublicationPendingLayer = getServiceManifestPublicationLayerRank(targetLayer) >= getServiceManifestPublicationLayerRank(currentTargetLayer) ? targetLayer : currentTargetLayer;
|
|
17372
|
+
}
|
|
17373
|
+
static requestServiceManifestPublication(reason, immediate = false, targetLayer = "business_structural") {
|
|
16683
17374
|
if (!this.serviceRegistry.serviceName || !this.serviceRegistry.serviceInstanceId) {
|
|
16684
17375
|
return;
|
|
16685
17376
|
}
|
|
@@ -16687,7 +17378,8 @@ var CadenzaService = class {
|
|
|
16687
17378
|
const payload = {
|
|
16688
17379
|
__reason: reason,
|
|
16689
17380
|
__serviceName: this.serviceRegistry.serviceName,
|
|
16690
|
-
__serviceInstanceId: this.serviceRegistry.serviceInstanceId
|
|
17381
|
+
__serviceInstanceId: this.serviceRegistry.serviceInstanceId,
|
|
17382
|
+
__publicationLayer: targetLayer
|
|
16691
17383
|
};
|
|
16692
17384
|
if (immediate) {
|
|
16693
17385
|
this.emit(signalName, payload);
|
|
@@ -16695,32 +17387,53 @@ var CadenzaService = class {
|
|
|
16695
17387
|
}
|
|
16696
17388
|
this.debounce(signalName, payload, 100);
|
|
16697
17389
|
}
|
|
16698
|
-
static scheduleServiceManifestPublicationRetry(reason) {
|
|
17390
|
+
static scheduleServiceManifestPublicationRetry(reason, targetLayer = "business_structural") {
|
|
16699
17391
|
if (!this.serviceRegistry.serviceName || !this.serviceRegistry.serviceInstanceId) {
|
|
16700
17392
|
return;
|
|
16701
17393
|
}
|
|
16702
17394
|
setTimeout(() => {
|
|
16703
|
-
this.requestServiceManifestPublication(reason, false);
|
|
17395
|
+
this.requestServiceManifestPublication(reason, false, targetLayer);
|
|
16704
17396
|
}, 1e3);
|
|
16705
17397
|
}
|
|
16706
|
-
static async publishServiceManifestIfNeeded(reason) {
|
|
17398
|
+
static async publishServiceManifestIfNeeded(reason, targetLayer = "business_structural") {
|
|
16707
17399
|
if (!this.serviceRegistry.connectsToCadenzaDB || !this.serviceRegistry.serviceName || !this.serviceRegistry.serviceInstanceId) {
|
|
16708
17400
|
return false;
|
|
16709
17401
|
}
|
|
16710
17402
|
const publishReason = typeof reason === "string" && reason.trim().length > 0 ? reason.trim() : "service_manifest_publish";
|
|
17403
|
+
const publishTargetLayer = this.normalizeServiceManifestPublicationLayer(
|
|
17404
|
+
targetLayer
|
|
17405
|
+
);
|
|
16711
17406
|
if (this.serviceManifestPublicationInFlight) {
|
|
16712
|
-
this.
|
|
17407
|
+
this.mergeServiceManifestPublicationRequest(
|
|
17408
|
+
publishReason,
|
|
17409
|
+
publishTargetLayer
|
|
17410
|
+
);
|
|
16713
17411
|
return false;
|
|
16714
17412
|
}
|
|
16715
|
-
const
|
|
16716
|
-
|
|
16717
|
-
|
|
16718
|
-
|
|
16719
|
-
|
|
17413
|
+
const publicationPlan = SERVICE_MANIFEST_PUBLICATION_ORDER.filter(
|
|
17414
|
+
(layer) => getServiceManifestPublicationLayerRank(layer) <= getServiceManifestPublicationLayerRank(publishTargetLayer)
|
|
17415
|
+
).map((layer) => {
|
|
17416
|
+
const snapshot2 = buildServiceManifestSnapshot({
|
|
17417
|
+
serviceName: this.serviceRegistry.serviceName,
|
|
17418
|
+
serviceInstanceId: this.serviceRegistry.serviceInstanceId,
|
|
17419
|
+
revision: this.serviceManifestRevision + 1,
|
|
17420
|
+
publishedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
17421
|
+
publicationLayer: layer
|
|
17422
|
+
});
|
|
17423
|
+
return {
|
|
17424
|
+
layer,
|
|
17425
|
+
snapshot: snapshot2,
|
|
17426
|
+
changed: this.lastPublishedServiceManifestHashes[layer] !== snapshot2.manifestHash
|
|
17427
|
+
};
|
|
16720
17428
|
});
|
|
16721
|
-
|
|
17429
|
+
const nextPublication = publicationPlan.find((entry) => entry.changed);
|
|
17430
|
+
if (!nextPublication) {
|
|
16722
17431
|
return false;
|
|
16723
17432
|
}
|
|
17433
|
+
const { layer: publicationLayer, snapshot } = nextPublication;
|
|
17434
|
+
const hasPendingFollowupLayer = publicationPlan.some(
|
|
17435
|
+
(entry) => entry.changed && getServiceManifestPublicationLayerRank(entry.layer) > getServiceManifestPublicationLayerRank(publicationLayer)
|
|
17436
|
+
);
|
|
16724
17437
|
this.serviceManifestPublicationInFlight = true;
|
|
16725
17438
|
try {
|
|
16726
17439
|
this.serviceRegistry.ensureBootstrapAuthorityControlPlaneForInquiry(
|
|
@@ -16728,7 +17441,10 @@ var CadenzaService = class {
|
|
|
16728
17441
|
snapshot
|
|
16729
17442
|
);
|
|
16730
17443
|
if (!this.serviceRegistry.hasAuthorityBootstrapHandshakeEstablished()) {
|
|
16731
|
-
this.scheduleServiceManifestPublicationRetry(
|
|
17444
|
+
this.scheduleServiceManifestPublicationRetry(
|
|
17445
|
+
publishReason,
|
|
17446
|
+
publishTargetLayer
|
|
17447
|
+
);
|
|
16732
17448
|
return false;
|
|
16733
17449
|
}
|
|
16734
17450
|
await this.inquire(AUTHORITY_SERVICE_MANIFEST_REPORT_INTENT, snapshot, {
|
|
@@ -16736,32 +17452,48 @@ var CadenzaService = class {
|
|
|
16736
17452
|
requireComplete: true
|
|
16737
17453
|
});
|
|
16738
17454
|
this.serviceManifestRevision = snapshot.revision;
|
|
16739
|
-
this.
|
|
17455
|
+
this.lastPublishedServiceManifestHashes[publicationLayer] = snapshot.manifestHash;
|
|
17456
|
+
if (hasPendingFollowupLayer) {
|
|
17457
|
+
this.mergeServiceManifestPublicationRequest(
|
|
17458
|
+
publishReason,
|
|
17459
|
+
publishTargetLayer
|
|
17460
|
+
);
|
|
17461
|
+
}
|
|
16740
17462
|
return {
|
|
16741
17463
|
serviceManifest: snapshot,
|
|
16742
|
-
published: true
|
|
17464
|
+
published: true,
|
|
17465
|
+
publicationLayer
|
|
16743
17466
|
};
|
|
16744
17467
|
} catch (error) {
|
|
16745
17468
|
this.log("Service manifest publication failed. Scheduling retry.", {
|
|
16746
17469
|
serviceName: this.serviceRegistry.serviceName,
|
|
16747
17470
|
serviceInstanceId: this.serviceRegistry.serviceInstanceId,
|
|
16748
17471
|
reason: publishReason,
|
|
17472
|
+
publicationLayer,
|
|
16749
17473
|
error: resolveInquiryFailureError(
|
|
16750
17474
|
AUTHORITY_SERVICE_MANIFEST_REPORT_INTENT,
|
|
16751
17475
|
error
|
|
16752
17476
|
),
|
|
16753
17477
|
inquiryMeta: error && typeof error === "object" && "__inquiryMeta" in error ? error.__inquiryMeta : null
|
|
16754
17478
|
});
|
|
16755
|
-
this.scheduleServiceManifestPublicationRetry(
|
|
17479
|
+
this.scheduleServiceManifestPublicationRetry(
|
|
17480
|
+
publishReason,
|
|
17481
|
+
publishTargetLayer
|
|
17482
|
+
);
|
|
16756
17483
|
return false;
|
|
16757
17484
|
} finally {
|
|
16758
17485
|
this.serviceManifestPublicationInFlight = false;
|
|
16759
|
-
if (this.serviceManifestPublicationPendingReason) {
|
|
17486
|
+
if (this.serviceManifestPublicationPendingReason && this.serviceManifestPublicationPendingLayer) {
|
|
16760
17487
|
const pendingReason = this.serviceManifestPublicationPendingReason;
|
|
17488
|
+
const pendingLayer = this.serviceManifestPublicationPendingLayer;
|
|
16761
17489
|
this.serviceManifestPublicationPendingReason = null;
|
|
17490
|
+
this.serviceManifestPublicationPendingLayer = null;
|
|
16762
17491
|
this.debounce(
|
|
16763
17492
|
"meta.service_manifest.publish_requested",
|
|
16764
|
-
{
|
|
17493
|
+
{
|
|
17494
|
+
__reason: pendingReason,
|
|
17495
|
+
__publicationLayer: pendingLayer
|
|
17496
|
+
},
|
|
16765
17497
|
100
|
|
16766
17498
|
);
|
|
16767
17499
|
}
|
|
@@ -16774,9 +17506,13 @@ var CadenzaService = class {
|
|
|
16774
17506
|
this.createMetaTask(
|
|
16775
17507
|
"Publish service manifest",
|
|
16776
17508
|
async (ctx) => this.publishServiceManifestIfNeeded(
|
|
16777
|
-
typeof ctx.__reason === "string" && ctx.__reason.trim().length > 0 ? ctx.__reason.trim() : "service_manifest_publish"
|
|
17509
|
+
typeof ctx.__reason === "string" && ctx.__reason.trim().length > 0 ? ctx.__reason.trim() : "service_manifest_publish",
|
|
17510
|
+
this.normalizeServiceManifestPublicationLayer(
|
|
17511
|
+
ctx.__publicationLayer,
|
|
17512
|
+
"business_structural"
|
|
17513
|
+
)
|
|
16778
17514
|
),
|
|
16779
|
-
"Publishes
|
|
17515
|
+
"Publishes staged static manifest snapshots to authority when the manifest hash changes.",
|
|
16780
17516
|
{
|
|
16781
17517
|
register: false,
|
|
16782
17518
|
isHidden: true
|
|
@@ -16786,13 +17522,18 @@ var CadenzaService = class {
|
|
|
16786
17522
|
"Request manifest publication after structural change",
|
|
16787
17523
|
(ctx) => {
|
|
16788
17524
|
const reason = typeof ctx.signal === "string" && ctx.signal.trim().length > 0 ? ctx.signal : typeof ctx.__reason === "string" && ctx.__reason.trim().length > 0 ? ctx.__reason : "manifest_structural_update";
|
|
17525
|
+
const targetLayer = reason === "meta.service_registry.instance_inserted" ? "business_structural" : this.normalizeServiceManifestPublicationLayer(
|
|
17526
|
+
ctx.__publicationLayer,
|
|
17527
|
+
"business_structural"
|
|
17528
|
+
);
|
|
16789
17529
|
this.requestServiceManifestPublication(
|
|
16790
17530
|
reason,
|
|
16791
|
-
reason === "meta.service_registry.instance_inserted"
|
|
17531
|
+
reason === "meta.service_registry.instance_inserted",
|
|
17532
|
+
targetLayer
|
|
16792
17533
|
);
|
|
16793
17534
|
return true;
|
|
16794
17535
|
},
|
|
16795
|
-
"Requests
|
|
17536
|
+
"Requests staged manifest publication when a static service primitive changes.",
|
|
16796
17537
|
{
|
|
16797
17538
|
register: false,
|
|
16798
17539
|
isHidden: true
|
|
@@ -16835,19 +17576,19 @@ var CadenzaService = class {
|
|
|
16835
17576
|
static bootstrap() {
|
|
16836
17577
|
if (this.isBootstrapped) return;
|
|
16837
17578
|
this.isBootstrapped = true;
|
|
16838
|
-
|
|
16839
|
-
|
|
17579
|
+
import_core6.default.bootstrap();
|
|
17580
|
+
import_core6.default.setRuntimeInquiryDelegate(
|
|
16840
17581
|
(inquiry, context, options) => this.inquire(
|
|
16841
17582
|
inquiry,
|
|
16842
17583
|
context,
|
|
16843
17584
|
options ?? {}
|
|
16844
17585
|
)
|
|
16845
17586
|
);
|
|
16846
|
-
this.signalBroker =
|
|
16847
|
-
this.inquiryBroker =
|
|
16848
|
-
this.runner =
|
|
16849
|
-
this.metaRunner =
|
|
16850
|
-
this.registry =
|
|
17587
|
+
this.signalBroker = import_core6.default.signalBroker;
|
|
17588
|
+
this.inquiryBroker = import_core6.default.inquiryBroker;
|
|
17589
|
+
this.runner = import_core6.default.runner;
|
|
17590
|
+
this.metaRunner = import_core6.default.metaRunner;
|
|
17591
|
+
this.registry = import_core6.default.registry;
|
|
16851
17592
|
this.serviceRegistry = ServiceRegistry.instance;
|
|
16852
17593
|
RestController.instance;
|
|
16853
17594
|
SocketController.instance;
|
|
@@ -16881,8 +17622,8 @@ var CadenzaService = class {
|
|
|
16881
17622
|
return;
|
|
16882
17623
|
}
|
|
16883
17624
|
this.frontendSyncScheduled = true;
|
|
16884
|
-
|
|
16885
|
-
|
|
17625
|
+
import_core6.default.interval("meta.sync_requested", { __syncing: false }, 18e4);
|
|
17626
|
+
import_core6.default.schedule("meta.sync_requested", { __syncing: false }, 250);
|
|
16886
17627
|
}
|
|
16887
17628
|
static normalizeDeclaredTransports(transports, serviceId, useSocket) {
|
|
16888
17629
|
return (transports ?? []).map((transport) => normalizeServiceTransportConfig(transport)).filter(
|
|
@@ -16940,7 +17681,7 @@ var CadenzaService = class {
|
|
|
16940
17681
|
* @return {void} Does not return any value.
|
|
16941
17682
|
*/
|
|
16942
17683
|
static validateName(name) {
|
|
16943
|
-
|
|
17684
|
+
import_core6.default.validateName(name);
|
|
16944
17685
|
}
|
|
16945
17686
|
/**
|
|
16946
17687
|
* Gets the current run strategy from the Cadenza configuration.
|
|
@@ -16948,7 +17689,7 @@ var CadenzaService = class {
|
|
|
16948
17689
|
* @return {Function} The run strategy function defined in the Cadenza configuration.
|
|
16949
17690
|
*/
|
|
16950
17691
|
static get runStrategy() {
|
|
16951
|
-
return
|
|
17692
|
+
return import_core6.default.runStrategy;
|
|
16952
17693
|
}
|
|
16953
17694
|
/**
|
|
16954
17695
|
* Sets the mode for the Cadenza application.
|
|
@@ -16957,7 +17698,7 @@ var CadenzaService = class {
|
|
|
16957
17698
|
* @return {void} This method does not return a value.
|
|
16958
17699
|
*/
|
|
16959
17700
|
static setMode(mode) {
|
|
16960
|
-
|
|
17701
|
+
import_core6.default.setMode(mode);
|
|
16961
17702
|
}
|
|
16962
17703
|
static hasCompletedBootstrapSync() {
|
|
16963
17704
|
return !this.serviceCreated || this.bootstrapSyncCompleted;
|
|
@@ -17000,16 +17741,16 @@ var CadenzaService = class {
|
|
|
17000
17741
|
* ```
|
|
17001
17742
|
*/
|
|
17002
17743
|
static emit(signal, data = {}, options = {}) {
|
|
17003
|
-
|
|
17744
|
+
import_core6.default.emit(signal, data, options);
|
|
17004
17745
|
}
|
|
17005
17746
|
static debounce(signal, context = {}, delayMs = 500) {
|
|
17006
|
-
|
|
17747
|
+
import_core6.default.debounce(signal, context, delayMs);
|
|
17007
17748
|
}
|
|
17008
17749
|
static schedule(signal, context, timeoutMs, exactDateTime) {
|
|
17009
|
-
|
|
17750
|
+
import_core6.default.schedule(signal, context, timeoutMs, exactDateTime);
|
|
17010
17751
|
}
|
|
17011
17752
|
static interval(signal, context, intervalMs, leading = false, startDateTime) {
|
|
17012
|
-
|
|
17753
|
+
import_core6.default.interval(signal, context, intervalMs, leading, startDateTime);
|
|
17013
17754
|
}
|
|
17014
17755
|
static defineIntent(intent) {
|
|
17015
17756
|
this.inquiryBroker?.addIntent(intent);
|
|
@@ -17017,35 +17758,35 @@ var CadenzaService = class {
|
|
|
17017
17758
|
}
|
|
17018
17759
|
static getRuntimeValidationPolicy() {
|
|
17019
17760
|
this.bootstrap();
|
|
17020
|
-
return
|
|
17761
|
+
return import_core6.default.getRuntimeValidationPolicy();
|
|
17021
17762
|
}
|
|
17022
17763
|
static setRuntimeValidationPolicy(policy = {}) {
|
|
17023
17764
|
this.bootstrap();
|
|
17024
|
-
return
|
|
17765
|
+
return import_core6.default.setRuntimeValidationPolicy(policy);
|
|
17025
17766
|
}
|
|
17026
17767
|
static replaceRuntimeValidationPolicy(policy = {}) {
|
|
17027
17768
|
this.bootstrap();
|
|
17028
|
-
return
|
|
17769
|
+
return import_core6.default.replaceRuntimeValidationPolicy(policy);
|
|
17029
17770
|
}
|
|
17030
17771
|
static clearRuntimeValidationPolicy() {
|
|
17031
17772
|
this.bootstrap();
|
|
17032
|
-
|
|
17773
|
+
import_core6.default.clearRuntimeValidationPolicy();
|
|
17033
17774
|
}
|
|
17034
17775
|
static getRuntimeValidationScopes() {
|
|
17035
17776
|
this.bootstrap();
|
|
17036
|
-
return
|
|
17777
|
+
return import_core6.default.getRuntimeValidationScopes();
|
|
17037
17778
|
}
|
|
17038
17779
|
static upsertRuntimeValidationScope(scope) {
|
|
17039
17780
|
this.bootstrap();
|
|
17040
|
-
return
|
|
17781
|
+
return import_core6.default.upsertRuntimeValidationScope(scope);
|
|
17041
17782
|
}
|
|
17042
17783
|
static removeRuntimeValidationScope(id) {
|
|
17043
17784
|
this.bootstrap();
|
|
17044
|
-
|
|
17785
|
+
import_core6.default.removeRuntimeValidationScope(id);
|
|
17045
17786
|
}
|
|
17046
17787
|
static clearRuntimeValidationScopes() {
|
|
17047
17788
|
this.bootstrap();
|
|
17048
|
-
|
|
17789
|
+
import_core6.default.clearRuntimeValidationScopes();
|
|
17049
17790
|
}
|
|
17050
17791
|
static getInquiryResponderDescriptor(task) {
|
|
17051
17792
|
return this.serviceRegistry.getInquiryResponderDescriptor(task);
|
|
@@ -17407,7 +18148,7 @@ var CadenzaService = class {
|
|
|
17407
18148
|
});
|
|
17408
18149
|
}
|
|
17409
18150
|
static get(taskName) {
|
|
17410
|
-
return
|
|
18151
|
+
return import_core6.default.get(taskName);
|
|
17411
18152
|
}
|
|
17412
18153
|
static getLocalCadenzaDBTask(tableName, operation) {
|
|
17413
18154
|
const generatedTaskName = this.buildGeneratedLocalCadenzaDBTaskName(
|
|
@@ -17418,7 +18159,7 @@ var CadenzaService = class {
|
|
|
17418
18159
|
tableName,
|
|
17419
18160
|
operation
|
|
17420
18161
|
);
|
|
17421
|
-
return
|
|
18162
|
+
return import_core6.default.get(generatedTaskName) ?? import_core6.default.get(legacyTaskName);
|
|
17422
18163
|
}
|
|
17423
18164
|
static getLocalCadenzaDBInsertTask(tableName) {
|
|
17424
18165
|
return this.getLocalCadenzaDBTask(tableName, "insert");
|
|
@@ -17427,15 +18168,15 @@ var CadenzaService = class {
|
|
|
17427
18168
|
return this.getLocalCadenzaDBTask(tableName, "query");
|
|
17428
18169
|
}
|
|
17429
18170
|
static getActor(actorName) {
|
|
17430
|
-
const cadenzaWithActors =
|
|
18171
|
+
const cadenzaWithActors = import_core6.default;
|
|
17431
18172
|
return cadenzaWithActors.getActor?.(actorName);
|
|
17432
18173
|
}
|
|
17433
18174
|
static getAllActors() {
|
|
17434
|
-
const cadenzaWithActors =
|
|
18175
|
+
const cadenzaWithActors = import_core6.default;
|
|
17435
18176
|
return cadenzaWithActors.getAllActors?.() ?? [];
|
|
17436
18177
|
}
|
|
17437
18178
|
static getRoutine(routineName) {
|
|
17438
|
-
return
|
|
18179
|
+
return import_core6.default.getRoutine(routineName);
|
|
17439
18180
|
}
|
|
17440
18181
|
/**
|
|
17441
18182
|
* Creates a new DeputyTask instance based on the provided routine name, service name, and options.
|
|
@@ -18047,10 +18788,28 @@ var CadenzaService = class {
|
|
|
18047
18788
|
__isFrontend: isFrontend,
|
|
18048
18789
|
__declaredTransports: declaredTransports
|
|
18049
18790
|
};
|
|
18791
|
+
let bootstrapServiceCreationRequested = false;
|
|
18050
18792
|
if (options.cadenzaDB?.connect) {
|
|
18051
|
-
this.
|
|
18052
|
-
|
|
18053
|
-
|
|
18793
|
+
this.createMetaTask(
|
|
18794
|
+
"Create service",
|
|
18795
|
+
async (context, emit2) => {
|
|
18796
|
+
const handshakeServiceName = String(context?.serviceName ?? "").trim();
|
|
18797
|
+
if (handshakeServiceName !== "CadenzaDB") {
|
|
18798
|
+
return false;
|
|
18799
|
+
}
|
|
18800
|
+
if (bootstrapServiceCreationRequested) {
|
|
18801
|
+
return false;
|
|
18802
|
+
}
|
|
18803
|
+
bootstrapServiceCreationRequested = true;
|
|
18804
|
+
emit2("meta.create_service_requested", initContext);
|
|
18805
|
+
return true;
|
|
18806
|
+
},
|
|
18807
|
+
"Requests local service creation only once after the initial authority bootstrap handshake completes.",
|
|
18808
|
+
{
|
|
18809
|
+
register: false,
|
|
18810
|
+
isHidden: true
|
|
18811
|
+
}
|
|
18812
|
+
).doOn("meta.fetch.handshake_complete");
|
|
18054
18813
|
} else {
|
|
18055
18814
|
this.emit("meta.create_service_requested", initContext);
|
|
18056
18815
|
this.createMetaTask("Create signal transmission for sync", (ctx, emit2) => {
|
|
@@ -18063,10 +18822,33 @@ var CadenzaService = class {
|
|
|
18063
18822
|
);
|
|
18064
18823
|
}).doOn("meta.rest.handshake", "meta.socket.handshake");
|
|
18065
18824
|
}
|
|
18825
|
+
let serviceSetupCompletedHandled = false;
|
|
18066
18826
|
this.createMetaTask("Handle service setup completion", (ctx, emit2) => {
|
|
18827
|
+
if (serviceSetupCompletedHandled) {
|
|
18828
|
+
return false;
|
|
18829
|
+
}
|
|
18830
|
+
const insertedServiceInstanceId = String(
|
|
18831
|
+
ctx?.serviceInstanceId ?? ctx?.service_instance_id ?? ctx?.serviceInstance?.uuid ?? ctx?.serviceInstance?.serviceInstanceId ?? ""
|
|
18832
|
+
).trim();
|
|
18833
|
+
const insertedServiceName = String(
|
|
18834
|
+
ctx?.serviceName ?? ctx?.service_name ?? ctx?.serviceInstance?.serviceName ?? ctx?.serviceInstance?.service_name ?? ""
|
|
18835
|
+
).trim();
|
|
18836
|
+
if (!insertedServiceInstanceId && !insertedServiceName) {
|
|
18837
|
+
return false;
|
|
18838
|
+
}
|
|
18839
|
+
if (insertedServiceInstanceId && insertedServiceInstanceId !== serviceId) {
|
|
18840
|
+
return false;
|
|
18841
|
+
}
|
|
18842
|
+
if (!insertedServiceInstanceId && insertedServiceName && insertedServiceName !== serviceName) {
|
|
18843
|
+
return false;
|
|
18844
|
+
}
|
|
18845
|
+
serviceSetupCompletedHandled = true;
|
|
18067
18846
|
if (options.cadenzaDB?.connect) {
|
|
18068
18847
|
this.serviceRegistry.bootstrapFullSync(emit2, ctx, "service_setup_completed");
|
|
18069
|
-
void this.publishServiceManifestIfNeeded(
|
|
18848
|
+
void this.publishServiceManifestIfNeeded(
|
|
18849
|
+
"service_setup_completed",
|
|
18850
|
+
"business_structural"
|
|
18851
|
+
);
|
|
18070
18852
|
}
|
|
18071
18853
|
if (isFrontend) {
|
|
18072
18854
|
registerActorSessionPersistenceTasks();
|
|
@@ -18076,7 +18858,7 @@ var CadenzaService = class {
|
|
|
18076
18858
|
return true;
|
|
18077
18859
|
}).doOn("meta.service_registry.instance_inserted");
|
|
18078
18860
|
if (!options.cadenzaDB?.connect) {
|
|
18079
|
-
|
|
18861
|
+
import_core6.default.schedule(
|
|
18080
18862
|
"meta.service_registry.instance_registration_requested",
|
|
18081
18863
|
{
|
|
18082
18864
|
data: {
|
|
@@ -18121,7 +18903,11 @@ var CadenzaService = class {
|
|
|
18121
18903
|
);
|
|
18122
18904
|
}
|
|
18123
18905
|
this.serviceCreated = true;
|
|
18124
|
-
this.requestServiceManifestPublication(
|
|
18906
|
+
this.requestServiceManifestPublication(
|
|
18907
|
+
"service_created",
|
|
18908
|
+
true,
|
|
18909
|
+
"routing_capability"
|
|
18910
|
+
);
|
|
18125
18911
|
}
|
|
18126
18912
|
/**
|
|
18127
18913
|
* Creates a Cadenza metadata service with the specified name, description, and options.
|
|
@@ -18382,7 +19168,7 @@ var CadenzaService = class {
|
|
|
18382
19168
|
}
|
|
18383
19169
|
static createActor(spec, options = {}) {
|
|
18384
19170
|
this.bootstrap();
|
|
18385
|
-
return
|
|
19171
|
+
return import_core6.default.createActor(
|
|
18386
19172
|
spec,
|
|
18387
19173
|
this.withActorSessionHydration(
|
|
18388
19174
|
spec,
|
|
@@ -18392,7 +19178,7 @@ var CadenzaService = class {
|
|
|
18392
19178
|
}
|
|
18393
19179
|
static createActorFromDefinition(definition, options = {}) {
|
|
18394
19180
|
this.bootstrap();
|
|
18395
|
-
return
|
|
19181
|
+
return import_core6.default.createActorFromDefinition(
|
|
18396
19182
|
definition,
|
|
18397
19183
|
this.withActorSessionHydration(
|
|
18398
19184
|
{
|
|
@@ -18430,7 +19216,7 @@ var CadenzaService = class {
|
|
|
18430
19216
|
...options,
|
|
18431
19217
|
hydrateDurableState: async (actorKey) => {
|
|
18432
19218
|
registerActorSessionPersistenceTasks();
|
|
18433
|
-
const response = await
|
|
19219
|
+
const response = await import_core6.default.inquire(
|
|
18434
19220
|
META_ACTOR_SESSION_STATE_HYDRATE_INTENT,
|
|
18435
19221
|
{
|
|
18436
19222
|
actor_name: actorName,
|
|
@@ -18533,7 +19319,7 @@ var CadenzaService = class {
|
|
|
18533
19319
|
*/
|
|
18534
19320
|
static createTask(name, func, description, options = {}) {
|
|
18535
19321
|
this.bootstrap();
|
|
18536
|
-
return
|
|
19322
|
+
return import_core6.default.createTask(name, func, description, options);
|
|
18537
19323
|
}
|
|
18538
19324
|
/**
|
|
18539
19325
|
* Creates a meta task with the specified name, functionality, description, and options.
|
|
@@ -18549,7 +19335,7 @@ var CadenzaService = class {
|
|
|
18549
19335
|
*/
|
|
18550
19336
|
static createMetaTask(name, func, description, options = {}) {
|
|
18551
19337
|
this.bootstrap();
|
|
18552
|
-
return
|
|
19338
|
+
return import_core6.default.createMetaTask(name, func, description, options);
|
|
18553
19339
|
}
|
|
18554
19340
|
/**
|
|
18555
19341
|
* Creates a unique task by wrapping the provided task function with a uniqueness constraint.
|
|
@@ -18599,7 +19385,7 @@ var CadenzaService = class {
|
|
|
18599
19385
|
*/
|
|
18600
19386
|
static createUniqueTask(name, func, description, options = {}) {
|
|
18601
19387
|
this.bootstrap();
|
|
18602
|
-
return
|
|
19388
|
+
return import_core6.default.createUniqueTask(name, func, description, options);
|
|
18603
19389
|
}
|
|
18604
19390
|
/**
|
|
18605
19391
|
* Creates a unique meta task with the specified name, function, description, and options.
|
|
@@ -18613,7 +19399,7 @@ var CadenzaService = class {
|
|
|
18613
19399
|
*/
|
|
18614
19400
|
static createUniqueMetaTask(name, func, description, options = {}) {
|
|
18615
19401
|
this.bootstrap();
|
|
18616
|
-
return
|
|
19402
|
+
return import_core6.default.createUniqueMetaTask(name, func, description, options);
|
|
18617
19403
|
}
|
|
18618
19404
|
/**
|
|
18619
19405
|
* Creates a throttled task with a concurrency limit of 1, ensuring that only one instance of the task can run at a time for a specific throttle tag.
|
|
@@ -18646,7 +19432,7 @@ var CadenzaService = class {
|
|
|
18646
19432
|
*/
|
|
18647
19433
|
static createThrottledTask(name, func, throttledIdGetter = () => "default", description, options = {}) {
|
|
18648
19434
|
this.bootstrap();
|
|
18649
|
-
return
|
|
19435
|
+
return import_core6.default.createThrottledTask(
|
|
18650
19436
|
name,
|
|
18651
19437
|
func,
|
|
18652
19438
|
throttledIdGetter,
|
|
@@ -18667,7 +19453,7 @@ var CadenzaService = class {
|
|
|
18667
19453
|
*/
|
|
18668
19454
|
static createThrottledMetaTask(name, func, throttledIdGetter = () => "default", description, options = {}) {
|
|
18669
19455
|
this.bootstrap();
|
|
18670
|
-
return
|
|
19456
|
+
return import_core6.default.createThrottledMetaTask(
|
|
18671
19457
|
name,
|
|
18672
19458
|
func,
|
|
18673
19459
|
throttledIdGetter,
|
|
@@ -18710,7 +19496,7 @@ var CadenzaService = class {
|
|
|
18710
19496
|
*/
|
|
18711
19497
|
static createDebounceTask(name, func, description, debounceTime = 1e3, options = {}) {
|
|
18712
19498
|
this.bootstrap();
|
|
18713
|
-
return
|
|
19499
|
+
return import_core6.default.createDebounceTask(
|
|
18714
19500
|
name,
|
|
18715
19501
|
func,
|
|
18716
19502
|
description,
|
|
@@ -18731,7 +19517,7 @@ var CadenzaService = class {
|
|
|
18731
19517
|
*/
|
|
18732
19518
|
static createDebounceMetaTask(name, func, description, debounceTime = 1e3, options = {}) {
|
|
18733
19519
|
this.bootstrap();
|
|
18734
|
-
return
|
|
19520
|
+
return import_core6.default.createDebounceMetaTask(
|
|
18735
19521
|
name,
|
|
18736
19522
|
func,
|
|
18737
19523
|
description,
|
|
@@ -18801,7 +19587,7 @@ var CadenzaService = class {
|
|
|
18801
19587
|
*/
|
|
18802
19588
|
static createEphemeralTask(name, func, description, options = {}) {
|
|
18803
19589
|
this.bootstrap();
|
|
18804
|
-
return
|
|
19590
|
+
return import_core6.default.createEphemeralTask(name, func, description, options);
|
|
18805
19591
|
}
|
|
18806
19592
|
/**
|
|
18807
19593
|
* Creates an ephemeral meta-task with the specified name, function, description, and options.
|
|
@@ -18815,7 +19601,7 @@ var CadenzaService = class {
|
|
|
18815
19601
|
*/
|
|
18816
19602
|
static createEphemeralMetaTask(name, func, description, options = {}) {
|
|
18817
19603
|
this.bootstrap();
|
|
18818
|
-
return
|
|
19604
|
+
return import_core6.default.createEphemeralMetaTask(name, func, description, options);
|
|
18819
19605
|
}
|
|
18820
19606
|
/**
|
|
18821
19607
|
* Creates a new routine with the specified name, tasks, and an optional description.
|
|
@@ -18847,7 +19633,7 @@ var CadenzaService = class {
|
|
|
18847
19633
|
*/
|
|
18848
19634
|
static createRoutine(name, tasks, description = "") {
|
|
18849
19635
|
this.bootstrap();
|
|
18850
|
-
return
|
|
19636
|
+
return import_core6.default.createRoutine(name, tasks, description);
|
|
18851
19637
|
}
|
|
18852
19638
|
/**
|
|
18853
19639
|
* Creates a meta routine with a given name, tasks, and optional description.
|
|
@@ -18862,10 +19648,10 @@ var CadenzaService = class {
|
|
|
18862
19648
|
*/
|
|
18863
19649
|
static createMetaRoutine(name, tasks, description = "") {
|
|
18864
19650
|
this.bootstrap();
|
|
18865
|
-
return
|
|
19651
|
+
return import_core6.default.createMetaRoutine(name, tasks, description);
|
|
18866
19652
|
}
|
|
18867
19653
|
static reset() {
|
|
18868
|
-
|
|
19654
|
+
import_core6.default.reset();
|
|
18869
19655
|
this.serviceRegistry?.reset();
|
|
18870
19656
|
this.unregisterGracefulShutdownHandlers();
|
|
18871
19657
|
this.isBootstrapped = false;
|
|
@@ -18877,6 +19663,11 @@ var CadenzaService = class {
|
|
|
18877
19663
|
this.warnedInvalidMetaIntentResponderKeys = /* @__PURE__ */ new Set();
|
|
18878
19664
|
this.hydratedInquiryResults = /* @__PURE__ */ new Map();
|
|
18879
19665
|
this.frontendSyncScheduled = false;
|
|
19666
|
+
this.serviceManifestRevision = 0;
|
|
19667
|
+
this.lastPublishedServiceManifestHashes = {};
|
|
19668
|
+
this.serviceManifestPublicationInFlight = false;
|
|
19669
|
+
this.serviceManifestPublicationPendingReason = null;
|
|
19670
|
+
this.serviceManifestPublicationPendingLayer = null;
|
|
18880
19671
|
resetBrowserRuntimeActorHandles();
|
|
18881
19672
|
}
|
|
18882
19673
|
};
|
|
@@ -18890,15 +19681,16 @@ CadenzaService.warnedInvalidMetaIntentResponderKeys = /* @__PURE__ */ new Set();
|
|
|
18890
19681
|
CadenzaService.hydratedInquiryResults = /* @__PURE__ */ new Map();
|
|
18891
19682
|
CadenzaService.frontendSyncScheduled = false;
|
|
18892
19683
|
CadenzaService.serviceManifestRevision = 0;
|
|
18893
|
-
CadenzaService.
|
|
19684
|
+
CadenzaService.lastPublishedServiceManifestHashes = {};
|
|
18894
19685
|
CadenzaService.serviceManifestPublicationInFlight = false;
|
|
18895
19686
|
CadenzaService.serviceManifestPublicationPendingReason = null;
|
|
19687
|
+
CadenzaService.serviceManifestPublicationPendingLayer = null;
|
|
18896
19688
|
CadenzaService.shutdownHandlersRegistered = false;
|
|
18897
19689
|
CadenzaService.shutdownInFlight = false;
|
|
18898
19690
|
CadenzaService.shutdownHandlerCleanup = [];
|
|
18899
19691
|
|
|
18900
19692
|
// src/index.ts
|
|
18901
|
-
var
|
|
19693
|
+
var import_core7 = require("@cadenza.io/core");
|
|
18902
19694
|
|
|
18903
19695
|
// src/ssr/createSSRInquiryBridge.ts
|
|
18904
19696
|
var import_uuid8 = require("uuid");
|
|
@@ -18920,6 +19712,17 @@ function normalizeArrayResponse(value, keys) {
|
|
|
18920
19712
|
if (Array.isArray(value?.data)) {
|
|
18921
19713
|
return value.data;
|
|
18922
19714
|
}
|
|
19715
|
+
const joinedContexts = Array.isArray(value?.joinedContexts) ? value.joinedContexts : [];
|
|
19716
|
+
for (let index = joinedContexts.length - 1; index >= 0; index -= 1) {
|
|
19717
|
+
const nested = joinedContexts[index];
|
|
19718
|
+
if (!nested || typeof nested !== "object") {
|
|
19719
|
+
continue;
|
|
19720
|
+
}
|
|
19721
|
+
const rows = normalizeArrayResponse(nested, keys);
|
|
19722
|
+
if (rows.length > 0) {
|
|
19723
|
+
return rows;
|
|
19724
|
+
}
|
|
19725
|
+
}
|
|
18923
19726
|
return [];
|
|
18924
19727
|
}
|
|
18925
19728
|
function buildQueryResponseKeys(tableName) {
|