@cadenza.io/service 2.17.16 → 2.17.18
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 +51 -23
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +51 -23
- package/dist/browser/index.mjs.map +1 -1
- package/dist/index.js +51 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +51 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -5790,6 +5790,9 @@ function buildIntentRegistryData(intent) {
|
|
|
5790
5790
|
isMeta: isMetaIntentName(name)
|
|
5791
5791
|
};
|
|
5792
5792
|
}
|
|
5793
|
+
function resolveSyncInsertTask(isCadenzaDBReady, tableName, queryData = {}, options = {}) {
|
|
5794
|
+
return CadenzaService.getLocalCadenzaDBInsertTask(tableName) ?? (isCadenzaDBReady ? CadenzaService.createCadenzaDBInsertTask(tableName, queryData, options) : void 0);
|
|
5795
|
+
}
|
|
5793
5796
|
var GraphSyncController = class _GraphSyncController {
|
|
5794
5797
|
constructor() {
|
|
5795
5798
|
this.registeredActors = /* @__PURE__ */ new Set();
|
|
@@ -5802,7 +5805,8 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
5802
5805
|
return this._instance;
|
|
5803
5806
|
}
|
|
5804
5807
|
init() {
|
|
5805
|
-
const insertIntentRegistryTask =
|
|
5808
|
+
const insertIntentRegistryTask = resolveSyncInsertTask(
|
|
5809
|
+
this.isCadenzaDBReady,
|
|
5806
5810
|
"intent_registry",
|
|
5807
5811
|
{
|
|
5808
5812
|
onConflict: {
|
|
@@ -5813,7 +5817,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
5813
5817
|
}
|
|
5814
5818
|
},
|
|
5815
5819
|
{ concurrency: 30 }
|
|
5816
|
-
)
|
|
5820
|
+
);
|
|
5817
5821
|
this.splitRoutinesTask = CadenzaService.createMetaTask(
|
|
5818
5822
|
"Split routines for registration",
|
|
5819
5823
|
async function* (ctx, emit) {
|
|
@@ -5841,7 +5845,8 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
5841
5845
|
}
|
|
5842
5846
|
}
|
|
5843
5847
|
).then(
|
|
5844
|
-
(
|
|
5848
|
+
resolveSyncInsertTask(
|
|
5849
|
+
this.isCadenzaDBReady,
|
|
5845
5850
|
"routine",
|
|
5846
5851
|
{
|
|
5847
5852
|
onConflict: {
|
|
@@ -5852,7 +5857,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
5852
5857
|
}
|
|
5853
5858
|
},
|
|
5854
5859
|
{ concurrency: 30 }
|
|
5855
|
-
)
|
|
5860
|
+
)?.then(
|
|
5856
5861
|
CadenzaService.createMetaTask("Register routine", (ctx) => {
|
|
5857
5862
|
if (!ctx.__syncing) {
|
|
5858
5863
|
return;
|
|
@@ -5908,7 +5913,8 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
5908
5913
|
}
|
|
5909
5914
|
}
|
|
5910
5915
|
).then(
|
|
5911
|
-
(
|
|
5916
|
+
resolveSyncInsertTask(
|
|
5917
|
+
this.isCadenzaDBReady,
|
|
5912
5918
|
"task_to_routine_map",
|
|
5913
5919
|
{
|
|
5914
5920
|
onConflict: {
|
|
@@ -5925,7 +5931,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
5925
5931
|
}
|
|
5926
5932
|
},
|
|
5927
5933
|
{ concurrency: 30 }
|
|
5928
|
-
)
|
|
5934
|
+
)?.then(
|
|
5929
5935
|
CadenzaService.createMetaTask("Register routine task", (ctx) => {
|
|
5930
5936
|
if (!ctx.__syncing) {
|
|
5931
5937
|
return;
|
|
@@ -5965,7 +5971,8 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
5965
5971
|
}
|
|
5966
5972
|
}
|
|
5967
5973
|
).then(
|
|
5968
|
-
(
|
|
5974
|
+
resolveSyncInsertTask(
|
|
5975
|
+
this.isCadenzaDBReady,
|
|
5969
5976
|
"signal_registry",
|
|
5970
5977
|
{
|
|
5971
5978
|
onConflict: {
|
|
@@ -5976,7 +5983,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
5976
5983
|
}
|
|
5977
5984
|
},
|
|
5978
5985
|
{ concurrency: 30 }
|
|
5979
|
-
)
|
|
5986
|
+
)?.then(
|
|
5980
5987
|
CadenzaService.createMetaTask("Process signal registration", (ctx) => {
|
|
5981
5988
|
if (!ctx.__syncing) {
|
|
5982
5989
|
return;
|
|
@@ -6047,7 +6054,8 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6047
6054
|
}
|
|
6048
6055
|
}
|
|
6049
6056
|
).then(
|
|
6050
|
-
(
|
|
6057
|
+
resolveSyncInsertTask(
|
|
6058
|
+
this.isCadenzaDBReady,
|
|
6051
6059
|
"task",
|
|
6052
6060
|
{
|
|
6053
6061
|
onConflict: {
|
|
@@ -6058,8 +6066,8 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6058
6066
|
}
|
|
6059
6067
|
},
|
|
6060
6068
|
{ concurrency: 30 }
|
|
6061
|
-
)
|
|
6062
|
-
CadenzaService.createMetaTask("Record registration", (ctx) => {
|
|
6069
|
+
)?.then(
|
|
6070
|
+
CadenzaService.createMetaTask("Record registration", (ctx, emit) => {
|
|
6063
6071
|
if (!ctx.__syncing) {
|
|
6064
6072
|
return;
|
|
6065
6073
|
}
|
|
@@ -6067,6 +6075,10 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6067
6075
|
delayMs: 3e3
|
|
6068
6076
|
});
|
|
6069
6077
|
CadenzaService.get(ctx.__taskName).registered = true;
|
|
6078
|
+
emit("meta.sync_controller.task_registered", {
|
|
6079
|
+
...ctx,
|
|
6080
|
+
task: CadenzaService.get(ctx.__taskName)
|
|
6081
|
+
});
|
|
6070
6082
|
return true;
|
|
6071
6083
|
}).then(
|
|
6072
6084
|
CadenzaService.createUniqueMetaTask(
|
|
@@ -6106,7 +6118,8 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6106
6118
|
}
|
|
6107
6119
|
}.bind(this)
|
|
6108
6120
|
).then(
|
|
6109
|
-
(
|
|
6121
|
+
resolveSyncInsertTask(
|
|
6122
|
+
this.isCadenzaDBReady,
|
|
6110
6123
|
"actor",
|
|
6111
6124
|
{
|
|
6112
6125
|
onConflict: {
|
|
@@ -6117,7 +6130,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6117
6130
|
}
|
|
6118
6131
|
},
|
|
6119
6132
|
{ concurrency: 30 }
|
|
6120
|
-
)
|
|
6133
|
+
)?.then(
|
|
6121
6134
|
CadenzaService.createMetaTask("Record actor registration", (ctx) => {
|
|
6122
6135
|
if (!ctx.__syncing) {
|
|
6123
6136
|
return;
|
|
@@ -6169,7 +6182,8 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6169
6182
|
};
|
|
6170
6183
|
}.bind(this)
|
|
6171
6184
|
).then(
|
|
6172
|
-
(
|
|
6185
|
+
resolveSyncInsertTask(
|
|
6186
|
+
this.isCadenzaDBReady,
|
|
6173
6187
|
"actor_task_map",
|
|
6174
6188
|
{
|
|
6175
6189
|
onConflict: {
|
|
@@ -6186,7 +6200,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6186
6200
|
}
|
|
6187
6201
|
},
|
|
6188
6202
|
{ concurrency: 30 }
|
|
6189
|
-
)
|
|
6203
|
+
)?.then(
|
|
6190
6204
|
CadenzaService.createMetaTask("Record actor task map registration", (ctx) => {
|
|
6191
6205
|
if (!ctx.__syncing) {
|
|
6192
6206
|
return;
|
|
@@ -6237,7 +6251,8 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6237
6251
|
}
|
|
6238
6252
|
}
|
|
6239
6253
|
).then(
|
|
6240
|
-
(
|
|
6254
|
+
resolveSyncInsertTask(
|
|
6255
|
+
this.isCadenzaDBReady,
|
|
6241
6256
|
"signal_to_task_map",
|
|
6242
6257
|
{
|
|
6243
6258
|
onConflict: {
|
|
@@ -6253,7 +6268,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6253
6268
|
}
|
|
6254
6269
|
},
|
|
6255
6270
|
{ concurrency: 30 }
|
|
6256
|
-
)
|
|
6271
|
+
)?.then(registerSignalTask)
|
|
6257
6272
|
);
|
|
6258
6273
|
this.splitIntentsTask = CadenzaService.createMetaTask(
|
|
6259
6274
|
"Split intents for registration",
|
|
@@ -6386,7 +6401,8 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6386
6401
|
};
|
|
6387
6402
|
}
|
|
6388
6403
|
).then(
|
|
6389
|
-
(
|
|
6404
|
+
resolveSyncInsertTask(
|
|
6405
|
+
this.isCadenzaDBReady,
|
|
6390
6406
|
"intent_to_task_map",
|
|
6391
6407
|
{
|
|
6392
6408
|
onConflict: {
|
|
@@ -6402,7 +6418,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6402
6418
|
}
|
|
6403
6419
|
},
|
|
6404
6420
|
{ concurrency: 30 }
|
|
6405
|
-
)
|
|
6421
|
+
)?.then(registerIntentTask)
|
|
6406
6422
|
)
|
|
6407
6423
|
)
|
|
6408
6424
|
)
|
|
@@ -6442,7 +6458,8 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6442
6458
|
}
|
|
6443
6459
|
}
|
|
6444
6460
|
).then(
|
|
6445
|
-
(
|
|
6461
|
+
resolveSyncInsertTask(
|
|
6462
|
+
this.isCadenzaDBReady,
|
|
6446
6463
|
"directional_task_graph_map",
|
|
6447
6464
|
{
|
|
6448
6465
|
onConflict: {
|
|
@@ -6460,7 +6477,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6460
6477
|
}
|
|
6461
6478
|
},
|
|
6462
6479
|
{ concurrency: 30 }
|
|
6463
|
-
)
|
|
6480
|
+
)?.then(
|
|
6464
6481
|
CadenzaService.createMetaTask("Record task map registration", (ctx) => {
|
|
6465
6482
|
if (!ctx.__syncing) {
|
|
6466
6483
|
return;
|
|
@@ -6500,7 +6517,8 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6500
6517
|
}
|
|
6501
6518
|
}
|
|
6502
6519
|
).then(
|
|
6503
|
-
(
|
|
6520
|
+
resolveSyncInsertTask(
|
|
6521
|
+
this.isCadenzaDBReady,
|
|
6504
6522
|
"directional_task_graph_map",
|
|
6505
6523
|
{
|
|
6506
6524
|
onConflict: {
|
|
@@ -6518,7 +6536,7 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6518
6536
|
}
|
|
6519
6537
|
},
|
|
6520
6538
|
{ concurrency: 30 }
|
|
6521
|
-
)
|
|
6539
|
+
)?.then(
|
|
6522
6540
|
CadenzaService.createMetaTask(
|
|
6523
6541
|
"Record deputy relationship registration",
|
|
6524
6542
|
(ctx) => {
|
|
@@ -6557,6 +6575,16 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
6557
6575
|
this.registerDeputyRelationshipTask
|
|
6558
6576
|
);
|
|
6559
6577
|
CadenzaService.registry.doForEachTask.clone().doOn("meta.sync_controller.synced_tasks", "meta.sync_controller.synced_intents").then(this.registerIntentToTaskMapTask);
|
|
6578
|
+
CadenzaService.createMetaTask("Get registered task for intent sync", (ctx) => {
|
|
6579
|
+
const task = ctx.task ?? (ctx.__taskName ? CadenzaService.get(ctx.__taskName) : void 0);
|
|
6580
|
+
if (!task) {
|
|
6581
|
+
return false;
|
|
6582
|
+
}
|
|
6583
|
+
return {
|
|
6584
|
+
...ctx,
|
|
6585
|
+
task
|
|
6586
|
+
};
|
|
6587
|
+
}).doOn("meta.sync_controller.task_registered").then(this.registerIntentToTaskMapTask);
|
|
6560
6588
|
CadenzaService.registry.doForEachTask.clone().doOn("meta.sync_controller.synced_tasks", "meta.sync_controller.synced_actors").then(this.registerActorTaskMapTask);
|
|
6561
6589
|
CadenzaService.registry.getAllRoutines.clone().doOn("meta.sync_controller.synced_routines").then(this.splitTasksInRoutines);
|
|
6562
6590
|
CadenzaService.createMetaTask("Finish sync", (ctx, emit) => {
|