@cadenza.io/service 2.17.25 → 2.17.26
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/browser/index.js +94 -22
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +94 -22
- package/dist/browser/index.mjs.map +1 -1
- package/dist/index.js +94 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +94 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -766,6 +766,38 @@ function buildServiceRegistryInsertQueryData(ctx, queryData) {
|
|
|
766
766
|
}
|
|
767
767
|
return nextQueryData;
|
|
768
768
|
}
|
|
769
|
+
function normalizeServiceRegistryInsertResult(tableName, ctx, queryData, rawResult) {
|
|
770
|
+
if (!rawResult || typeof rawResult !== "object") {
|
|
771
|
+
return rawResult;
|
|
772
|
+
}
|
|
773
|
+
const result = { ...rawResult };
|
|
774
|
+
const normalizedQueryData = result.queryData && typeof result.queryData === "object" ? { ...result.queryData } : { ...queryData };
|
|
775
|
+
const resolvedData = result.data ?? normalizedQueryData.data ?? queryData.data ?? ctx.data ?? ctx.__registrationData;
|
|
776
|
+
if (resolvedData !== void 0 && result.data === void 0) {
|
|
777
|
+
result.data = resolvedData;
|
|
778
|
+
}
|
|
779
|
+
if (resolvedData !== void 0 && (normalizedQueryData.data === void 0 || normalizedQueryData.data === null)) {
|
|
780
|
+
normalizedQueryData.data = resolvedData;
|
|
781
|
+
}
|
|
782
|
+
result.queryData = normalizedQueryData;
|
|
783
|
+
if (tableName === "service") {
|
|
784
|
+
const resolvedServiceName = String(
|
|
785
|
+
result.__serviceName ?? resolvedData?.name ?? resolvedData?.service_name ?? ctx.__serviceName ?? ""
|
|
786
|
+
).trim();
|
|
787
|
+
if (resolvedServiceName) {
|
|
788
|
+
result.__serviceName = resolvedServiceName;
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
if (tableName === "service_instance" || tableName === "service_instance_transport") {
|
|
792
|
+
const resolvedUuid = String(
|
|
793
|
+
result.uuid ?? resolvedData?.uuid ?? ctx.__serviceInstanceId ?? ""
|
|
794
|
+
).trim();
|
|
795
|
+
if (resolvedUuid) {
|
|
796
|
+
result.uuid = resolvedUuid;
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
return result;
|
|
800
|
+
}
|
|
769
801
|
function resolveServiceRegistryInsertTask(tableName, queryData = {}, options = {}) {
|
|
770
802
|
const remoteInsertTask = CadenzaService.createCadenzaDBInsertTask(
|
|
771
803
|
tableName,
|
|
@@ -789,14 +821,26 @@ function resolveServiceRegistryInsertTask(tableName, queryData = {}, options = {
|
|
|
789
821
|
);
|
|
790
822
|
}
|
|
791
823
|
const targetTask = CadenzaService.getLocalCadenzaDBInsertTask(tableName) ?? remoteInsertTask;
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
824
|
+
const delegationContext = ensureDelegationContextMetadata({
|
|
825
|
+
...ctx,
|
|
826
|
+
queryData: nextQueryData
|
|
827
|
+
});
|
|
828
|
+
delegationContext.__metadata.__skipRemoteExecution = delegationContext.__metadata.__skipRemoteExecution ?? delegationContext.__skipRemoteExecution ?? false;
|
|
829
|
+
delegationContext.__metadata.__blockRemoteExecution = delegationContext.__metadata.__blockRemoteExecution ?? delegationContext.__blockRemoteExecution ?? false;
|
|
830
|
+
return Promise.resolve(
|
|
831
|
+
targetTask.taskFunction(
|
|
832
|
+
delegationContext,
|
|
833
|
+
emit,
|
|
834
|
+
inquire,
|
|
835
|
+
progressCallback
|
|
836
|
+
)
|
|
837
|
+
).then(
|
|
838
|
+
(result) => normalizeServiceRegistryInsertResult(
|
|
839
|
+
tableName,
|
|
840
|
+
ctx,
|
|
841
|
+
nextQueryData,
|
|
842
|
+
result
|
|
843
|
+
)
|
|
800
844
|
);
|
|
801
845
|
},
|
|
802
846
|
`Resolves ${tableName} inserts through the local CadenzaDB task when available.`,
|
|
@@ -8368,7 +8412,22 @@ function getJoinedContextValue(ctx, key) {
|
|
|
8368
8412
|
return void 0;
|
|
8369
8413
|
}
|
|
8370
8414
|
function didSyncInsertSucceed(ctx) {
|
|
8371
|
-
|
|
8415
|
+
if (ctx.errored || ctx.__success === false) {
|
|
8416
|
+
return false;
|
|
8417
|
+
}
|
|
8418
|
+
const inquiryMeta = ctx.__inquiryMeta && typeof ctx.__inquiryMeta === "object" ? ctx.__inquiryMeta : null;
|
|
8419
|
+
if (!inquiryMeta) {
|
|
8420
|
+
return true;
|
|
8421
|
+
}
|
|
8422
|
+
const eligibleResponders = Number(inquiryMeta.eligibleResponders);
|
|
8423
|
+
if (Number.isFinite(eligibleResponders) && eligibleResponders === 0) {
|
|
8424
|
+
return false;
|
|
8425
|
+
}
|
|
8426
|
+
const responded = Number(inquiryMeta.responded);
|
|
8427
|
+
if (Number.isFinite(responded) && responded === 0) {
|
|
8428
|
+
return false;
|
|
8429
|
+
}
|
|
8430
|
+
return true;
|
|
8372
8431
|
}
|
|
8373
8432
|
function buildSyncInsertQueryData(ctx, queryData = {}) {
|
|
8374
8433
|
const joinedQueryData = getJoinedContextValue(ctx, "queryData");
|
|
@@ -9492,6 +9551,11 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
9492
9551
|
{ __syncing: true },
|
|
9493
9552
|
18e4
|
|
9494
9553
|
);
|
|
9554
|
+
CadenzaService.schedule(
|
|
9555
|
+
"meta.sync_controller.sync_tick",
|
|
9556
|
+
{ __syncing: true },
|
|
9557
|
+
250
|
|
9558
|
+
);
|
|
9495
9559
|
CadenzaService.schedule("meta.sync_requested", { __syncing: true }, 2e3);
|
|
9496
9560
|
}
|
|
9497
9561
|
}
|
|
@@ -9892,20 +9956,28 @@ var CadenzaService = class {
|
|
|
9892
9956
|
return false;
|
|
9893
9957
|
});
|
|
9894
9958
|
if (responders.length === 0) {
|
|
9959
|
+
const inquiryMeta = {
|
|
9960
|
+
inquiry,
|
|
9961
|
+
isMetaInquiry,
|
|
9962
|
+
totalResponders: allResponders.length,
|
|
9963
|
+
eligibleResponders: 0,
|
|
9964
|
+
filteredOutResponders: allResponders.length,
|
|
9965
|
+
responded: 0,
|
|
9966
|
+
failed: 0,
|
|
9967
|
+
timedOut: 0,
|
|
9968
|
+
pending: 0,
|
|
9969
|
+
durationMs: 0,
|
|
9970
|
+
responders: []
|
|
9971
|
+
};
|
|
9972
|
+
if (options.requireComplete) {
|
|
9973
|
+
throw {
|
|
9974
|
+
__inquiryMeta: inquiryMeta,
|
|
9975
|
+
__error: `Inquiry '${inquiry}' had no eligible responders`,
|
|
9976
|
+
errored: true
|
|
9977
|
+
};
|
|
9978
|
+
}
|
|
9895
9979
|
return {
|
|
9896
|
-
__inquiryMeta:
|
|
9897
|
-
inquiry,
|
|
9898
|
-
isMetaInquiry,
|
|
9899
|
-
totalResponders: allResponders.length,
|
|
9900
|
-
eligibleResponders: 0,
|
|
9901
|
-
filteredOutResponders: allResponders.length,
|
|
9902
|
-
responded: 0,
|
|
9903
|
-
failed: 0,
|
|
9904
|
-
timedOut: 0,
|
|
9905
|
-
pending: 0,
|
|
9906
|
-
durationMs: 0,
|
|
9907
|
-
responders: []
|
|
9908
|
-
}
|
|
9980
|
+
__inquiryMeta: inquiryMeta
|
|
9909
9981
|
};
|
|
9910
9982
|
}
|
|
9911
9983
|
responders.sort(this.compareInquiryResponders.bind(this));
|