xytara 1.14.0 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -0
- package/index.js +1 -1
- package/lib/commerce_client.js +137 -0
- package/package.json +1 -1
- package/server.js +380 -0
package/README.md
CHANGED
|
@@ -154,6 +154,24 @@ The current `1.14.0` line starts hardening that reusable path into a clearer pub
|
|
|
154
154
|
|
|
155
155
|
This is intended to make the transaction-side continuation path easier to treat as a stable public contract instead of only a strong reusable default.
|
|
156
156
|
|
|
157
|
+
The current `1.15.0` line starts turning that same contract path into a clearer adapter-ready public bridge:
|
|
158
|
+
|
|
159
|
+
- prepared-artifact bridge summaries on top of the composition-contract continuation path
|
|
160
|
+
- bridge template surfaces that package the next proof-side review request directly
|
|
161
|
+
- compact bridge bundles for direct transaction-side bridge reuse
|
|
162
|
+
- compact bridge-carry surfaces for direct transaction-side bridge reuse
|
|
163
|
+
|
|
164
|
+
This is intended to make the transaction-side continuation path easier to hand across a stable adapter-ready bridge instead of treating bridge preparation as an implicit follow-on concern.
|
|
165
|
+
|
|
166
|
+
The current `1.16.0` line starts turning that bridge into a clearer stable public handoff contract:
|
|
167
|
+
|
|
168
|
+
- prepared-artifact handoff summaries on top of the bridge path
|
|
169
|
+
- direct handoff template surfaces for proof-side handoff continuity review
|
|
170
|
+
- compact handoff bundles for direct transaction-side handoff reuse
|
|
171
|
+
- compact handoff-carry surfaces for direct transaction-side handoff reuse
|
|
172
|
+
|
|
173
|
+
This is intended to make the transaction-side continuation path easier to treat as a stable handoff contract instead of only a well-described bridge.
|
|
174
|
+
|
|
157
175
|
## Package Surface
|
|
158
176
|
|
|
159
177
|
The SDK is broad, but it stays organized into a few repeatable families instead of one-off surfaces.
|
package/index.js
CHANGED
package/lib/commerce_client.js
CHANGED
|
@@ -1187,6 +1187,12 @@ function summarizeInteractionResultPackageContinuationPreparationPayload(payload
|
|
|
1187
1187
|
const compositionContractTemplate = item.composition_contract_template && typeof item.composition_contract_template === "object"
|
|
1188
1188
|
? item.composition_contract_template
|
|
1189
1189
|
: {};
|
|
1190
|
+
const adapterBridge = item.adapter_bridge_summary && typeof item.adapter_bridge_summary === "object"
|
|
1191
|
+
? item.adapter_bridge_summary
|
|
1192
|
+
: {};
|
|
1193
|
+
const adapterBridgeTemplate = item.adapter_bridge_template && typeof item.adapter_bridge_template === "object"
|
|
1194
|
+
? item.adapter_bridge_template
|
|
1195
|
+
: {};
|
|
1190
1196
|
return {
|
|
1191
1197
|
ok: item.ok === true,
|
|
1192
1198
|
continuation_ref: continuation ? continuation.continuation_ref : null,
|
|
@@ -1212,9 +1218,12 @@ function summarizeInteractionResultPackageContinuationPreparationPayload(payload
|
|
|
1212
1218
|
reusable_by_default: reusableDefault.default_followthrough && reusableDefault.default_followthrough.reusable_by_default === true,
|
|
1213
1219
|
composition_contract_ref: compositionContract.composition_contract_ref || null,
|
|
1214
1220
|
contract_ready: compositionContract.contract_ready === true,
|
|
1221
|
+
adapter_bridge_ref: adapterBridge.adapter_bridge_ref || null,
|
|
1222
|
+
bridge_ready: adapterBridge.bridge_ready === true,
|
|
1215
1223
|
future_adapter_hook_count: Number(extension.future_adapter_hook_count || 0),
|
|
1216
1224
|
reusable_default_target_surface: reusableDefaultTemplate.target_surface || null,
|
|
1217
1225
|
composition_contract_target_surface: compositionContractTemplate.target_surface || null,
|
|
1226
|
+
adapter_bridge_target_surface: adapterBridgeTemplate.target_surface || null,
|
|
1218
1227
|
extension_target_surface: extensionTemplate.target_surface || null
|
|
1219
1228
|
};
|
|
1220
1229
|
}
|
|
@@ -4447,6 +4456,134 @@ class CommerceClient {
|
|
|
4447
4456
|
});
|
|
4448
4457
|
}
|
|
4449
4458
|
|
|
4459
|
+
async prepareInteractionResultPackageAdapterBridgeSummary(continuationRef, body, options) {
|
|
4460
|
+
const opts = options || {};
|
|
4461
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/bridge-summary", {
|
|
4462
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.bridge.summary",
|
|
4463
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4464
|
+
body: body || {},
|
|
4465
|
+
callback_url: opts.callbackUrl || null,
|
|
4466
|
+
settlement_mode: opts.settlementMode || null,
|
|
4467
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4468
|
+
protocol: opts.protocol || null,
|
|
4469
|
+
integration_id: opts.integrationId || null,
|
|
4470
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4471
|
+
integration_context: opts.integrationContext || null
|
|
4472
|
+
});
|
|
4473
|
+
}
|
|
4474
|
+
|
|
4475
|
+
async prepareInteractionResultPackageAdapterBridgeTemplate(continuationRef, body, options) {
|
|
4476
|
+
const opts = options || {};
|
|
4477
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/bridge-template", {
|
|
4478
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.bridge.template",
|
|
4479
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4480
|
+
body: body || {},
|
|
4481
|
+
callback_url: opts.callbackUrl || null,
|
|
4482
|
+
settlement_mode: opts.settlementMode || null,
|
|
4483
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4484
|
+
protocol: opts.protocol || null,
|
|
4485
|
+
integration_id: opts.integrationId || null,
|
|
4486
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4487
|
+
integration_context: opts.integrationContext || null
|
|
4488
|
+
});
|
|
4489
|
+
}
|
|
4490
|
+
|
|
4491
|
+
async prepareInteractionResultPackageAdapterBridgeBundle(continuationRef, body, options) {
|
|
4492
|
+
const opts = options || {};
|
|
4493
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/bridge-bundle", {
|
|
4494
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.bridge.bundle",
|
|
4495
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4496
|
+
body: body || {},
|
|
4497
|
+
callback_url: opts.callbackUrl || null,
|
|
4498
|
+
settlement_mode: opts.settlementMode || null,
|
|
4499
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4500
|
+
protocol: opts.protocol || null,
|
|
4501
|
+
integration_id: opts.integrationId || null,
|
|
4502
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4503
|
+
integration_context: opts.integrationContext || null
|
|
4504
|
+
});
|
|
4505
|
+
}
|
|
4506
|
+
|
|
4507
|
+
async prepareInteractionResultPackageAdapterBridgeCarry(continuationRef, body, options) {
|
|
4508
|
+
const opts = options || {};
|
|
4509
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/bridge-carry", {
|
|
4510
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.bridge.carry",
|
|
4511
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4512
|
+
body: body || {},
|
|
4513
|
+
callback_url: opts.callbackUrl || null,
|
|
4514
|
+
settlement_mode: opts.settlementMode || null,
|
|
4515
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4516
|
+
protocol: opts.protocol || null,
|
|
4517
|
+
integration_id: opts.integrationId || null,
|
|
4518
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4519
|
+
integration_context: opts.integrationContext || null
|
|
4520
|
+
});
|
|
4521
|
+
}
|
|
4522
|
+
|
|
4523
|
+
async prepareInteractionResultPackageHandoffSummary(continuationRef, body, options) {
|
|
4524
|
+
const opts = options || {};
|
|
4525
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/handoff-summary", {
|
|
4526
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.handoff.summary",
|
|
4527
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4528
|
+
body: body || {},
|
|
4529
|
+
callback_url: opts.callbackUrl || null,
|
|
4530
|
+
settlement_mode: opts.settlementMode || null,
|
|
4531
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4532
|
+
protocol: opts.protocol || null,
|
|
4533
|
+
integration_id: opts.integrationId || null,
|
|
4534
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4535
|
+
integration_context: opts.integrationContext || null
|
|
4536
|
+
});
|
|
4537
|
+
}
|
|
4538
|
+
|
|
4539
|
+
async prepareInteractionResultPackageHandoffTemplate(continuationRef, body, options) {
|
|
4540
|
+
const opts = options || {};
|
|
4541
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/handoff-template", {
|
|
4542
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.handoff.template",
|
|
4543
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4544
|
+
body: body || {},
|
|
4545
|
+
callback_url: opts.callbackUrl || null,
|
|
4546
|
+
settlement_mode: opts.settlementMode || null,
|
|
4547
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4548
|
+
protocol: opts.protocol || null,
|
|
4549
|
+
integration_id: opts.integrationId || null,
|
|
4550
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4551
|
+
integration_context: opts.integrationContext || null
|
|
4552
|
+
});
|
|
4553
|
+
}
|
|
4554
|
+
|
|
4555
|
+
async prepareInteractionResultPackageHandoffBundle(continuationRef, body, options) {
|
|
4556
|
+
const opts = options || {};
|
|
4557
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/handoff-bundle", {
|
|
4558
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.handoff.bundle",
|
|
4559
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4560
|
+
body: body || {},
|
|
4561
|
+
callback_url: opts.callbackUrl || null,
|
|
4562
|
+
settlement_mode: opts.settlementMode || null,
|
|
4563
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4564
|
+
protocol: opts.protocol || null,
|
|
4565
|
+
integration_id: opts.integrationId || null,
|
|
4566
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4567
|
+
integration_context: opts.integrationContext || null
|
|
4568
|
+
});
|
|
4569
|
+
}
|
|
4570
|
+
|
|
4571
|
+
async prepareInteractionResultPackageHandoffCarry(continuationRef, body, options) {
|
|
4572
|
+
const opts = options || {};
|
|
4573
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/handoff-carry", {
|
|
4574
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.handoff.carry",
|
|
4575
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4576
|
+
body: body || {},
|
|
4577
|
+
callback_url: opts.callbackUrl || null,
|
|
4578
|
+
settlement_mode: opts.settlementMode || null,
|
|
4579
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4580
|
+
protocol: opts.protocol || null,
|
|
4581
|
+
integration_id: opts.integrationId || null,
|
|
4582
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4583
|
+
integration_context: opts.integrationContext || null
|
|
4584
|
+
});
|
|
4585
|
+
}
|
|
4586
|
+
|
|
4450
4587
|
async runNamedTaskRoute(path, payload) {
|
|
4451
4588
|
if (!this.apiKey || !this.walletId || !this.walletSecret) {
|
|
4452
4589
|
throw new Error("named task routes require apiKey, walletId, and walletSecret");
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -1339,6 +1339,136 @@ function buildPreparedContinuationCompositionContractBundle(portableHandoff, con
|
|
|
1339
1339
|
};
|
|
1340
1340
|
}
|
|
1341
1341
|
|
|
1342
|
+
function buildPreparedContinuationAdapterBridgeSummary(portableHandoff, continuation) {
|
|
1343
|
+
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1344
|
+
const contract = buildPreparedContinuationCompositionContractSummary(portableHandoff, continuation);
|
|
1345
|
+
return {
|
|
1346
|
+
ok: true,
|
|
1347
|
+
adapter_bridge_ref: continuation && continuation.continuation_ref
|
|
1348
|
+
? `bridge.${continuation.continuation_ref}`
|
|
1349
|
+
: null,
|
|
1350
|
+
composition_contract_ref: contract.composition_contract_ref || null,
|
|
1351
|
+
stable_bridge_ids: [
|
|
1352
|
+
"prepared_artifact_bridge",
|
|
1353
|
+
"review_bridge_summary",
|
|
1354
|
+
"proof_run"
|
|
1355
|
+
],
|
|
1356
|
+
bridge_carry: {
|
|
1357
|
+
execution_context: {
|
|
1358
|
+
committed_ref: handoff.committed_ref || null,
|
|
1359
|
+
stable: Boolean(handoff.committed_ref)
|
|
1360
|
+
},
|
|
1361
|
+
economic_context: {
|
|
1362
|
+
payment_protocol: handoff.payment_protocol || null,
|
|
1363
|
+
settlement_mode: handoff.settlement_mode || null
|
|
1364
|
+
},
|
|
1365
|
+
proof_context: {
|
|
1366
|
+
source_ref: handoff.source_ref || null,
|
|
1367
|
+
proof_ref: handoff.proof_ref || null
|
|
1368
|
+
}
|
|
1369
|
+
},
|
|
1370
|
+
default_only_summary_ids: [
|
|
1371
|
+
"reusable_default_summary",
|
|
1372
|
+
"reusable_default_template"
|
|
1373
|
+
],
|
|
1374
|
+
bridge_ready: contract.contract_ready === true,
|
|
1375
|
+
next_surface: "/v1/proof-center/result-package-handoff/review/bridge-summary"
|
|
1376
|
+
};
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
function buildPreparedContinuationAdapterBridgeTemplate(portableHandoff, continuation) {
|
|
1380
|
+
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1381
|
+
const summary = buildPreparedContinuationAdapterBridgeSummary(portableHandoff, continuation);
|
|
1382
|
+
return {
|
|
1383
|
+
ok: true,
|
|
1384
|
+
adapter_bridge_ref: summary.adapter_bridge_ref || null,
|
|
1385
|
+
target_surface: "/v1/proof-center/result-package-handoff/review/bridge-summary",
|
|
1386
|
+
request_template: {
|
|
1387
|
+
handoff_bundle: handoff
|
|
1388
|
+
},
|
|
1389
|
+
stable_boundary_ids: [
|
|
1390
|
+
"prepared_artifact_bridge",
|
|
1391
|
+
"review_bridge_summary",
|
|
1392
|
+
"proof_run"
|
|
1393
|
+
]
|
|
1394
|
+
};
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
function buildPreparedContinuationAdapterBridgeBundle(portableHandoff, continuation) {
|
|
1398
|
+
return {
|
|
1399
|
+
ok: true,
|
|
1400
|
+
adapter_bridge_summary: buildPreparedContinuationAdapterBridgeSummary(portableHandoff, continuation),
|
|
1401
|
+
adapter_bridge_template: buildPreparedContinuationAdapterBridgeTemplate(portableHandoff, continuation)
|
|
1402
|
+
};
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
function buildPreparedContinuationAdapterBridgeCarry(portableHandoff, continuation) {
|
|
1406
|
+
const summary = buildPreparedContinuationAdapterBridgeSummary(portableHandoff, continuation);
|
|
1407
|
+
return {
|
|
1408
|
+
ok: true,
|
|
1409
|
+
adapter_bridge_ref: summary.adapter_bridge_ref || null,
|
|
1410
|
+
stable_bridge_ids: Array.isArray(summary.stable_bridge_ids) ? summary.stable_bridge_ids : [],
|
|
1411
|
+
bridge_carry: summary.bridge_carry || {},
|
|
1412
|
+
bridge_ready: summary.bridge_ready === true,
|
|
1413
|
+
review_surface: "/v1/proof-center/result-package-handoff/review/bridge-carry"
|
|
1414
|
+
};
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
function buildPreparedContinuationHandoffSummary(portableHandoff, continuation) {
|
|
1418
|
+
const bridge = buildPreparedContinuationAdapterBridgeSummary(portableHandoff, continuation);
|
|
1419
|
+
return {
|
|
1420
|
+
ok: bridge.ok === true,
|
|
1421
|
+
adapter_bridge_ref: bridge.adapter_bridge_ref || null,
|
|
1422
|
+
handoff_contract_ref: bridge.adapter_bridge_ref ? `handoff.${bridge.adapter_bridge_ref}` : null,
|
|
1423
|
+
stable_handoff_ids: [
|
|
1424
|
+
"prepared_artifact_handoff",
|
|
1425
|
+
"review_handoff_summary",
|
|
1426
|
+
"proof_run"
|
|
1427
|
+
],
|
|
1428
|
+
stable_handoff_carry: bridge.bridge_carry || {},
|
|
1429
|
+
handoff_ready: bridge.bridge_ready === true,
|
|
1430
|
+
next_surface: "/v1/proof-center/result-package-handoff/review/handoff-continuity"
|
|
1431
|
+
};
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
function buildPreparedContinuationHandoffTemplate(portableHandoff, continuation) {
|
|
1435
|
+
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1436
|
+
const summary = buildPreparedContinuationHandoffSummary(portableHandoff, continuation);
|
|
1437
|
+
return {
|
|
1438
|
+
ok: true,
|
|
1439
|
+
handoff_contract_ref: summary.handoff_contract_ref || null,
|
|
1440
|
+
target_surface: "/v1/proof-center/result-package-handoff/review/handoff-continuity",
|
|
1441
|
+
request_template: {
|
|
1442
|
+
handoff_bundle: handoff
|
|
1443
|
+
},
|
|
1444
|
+
stable_boundary_ids: [
|
|
1445
|
+
"prepared_artifact_handoff",
|
|
1446
|
+
"review_handoff_summary",
|
|
1447
|
+
"proof_run"
|
|
1448
|
+
]
|
|
1449
|
+
};
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
function buildPreparedContinuationHandoffBundle(portableHandoff, continuation) {
|
|
1453
|
+
return {
|
|
1454
|
+
ok: true,
|
|
1455
|
+
handoff_summary: buildPreparedContinuationHandoffSummary(portableHandoff, continuation),
|
|
1456
|
+
handoff_template: buildPreparedContinuationHandoffTemplate(portableHandoff, continuation)
|
|
1457
|
+
};
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
function buildPreparedContinuationHandoffCarry(portableHandoff, continuation) {
|
|
1461
|
+
const summary = buildPreparedContinuationHandoffSummary(portableHandoff, continuation);
|
|
1462
|
+
return {
|
|
1463
|
+
ok: true,
|
|
1464
|
+
handoff_contract_ref: summary.handoff_contract_ref || null,
|
|
1465
|
+
stable_handoff_ids: Array.isArray(summary.stable_handoff_ids) ? summary.stable_handoff_ids : [],
|
|
1466
|
+
stable_handoff_carry: summary.stable_handoff_carry || {},
|
|
1467
|
+
handoff_ready: summary.handoff_ready === true,
|
|
1468
|
+
review_surface: "/v1/proof-center/result-package-handoff/review/handoff-run"
|
|
1469
|
+
};
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1342
1472
|
function buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation) {
|
|
1343
1473
|
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1344
1474
|
return {
|
|
@@ -2298,6 +2428,7 @@ async function routeRequest(req, res) {
|
|
|
2298
2428
|
reusable_default_summary: buildPreparedContinuationReusableDefaultSummary(portableHandoff, continuation),
|
|
2299
2429
|
reusable_default_template: buildPreparedContinuationReusableDefaultTemplate(portableHandoff, continuation),
|
|
2300
2430
|
...buildPreparedContinuationCompositionContractBundle(portableHandoff, continuation),
|
|
2431
|
+
...buildPreparedContinuationAdapterBridgeBundle(portableHandoff, continuation),
|
|
2301
2432
|
extension_template: buildPreparedContinuationExtensionTemplate(portableHandoff, continuation),
|
|
2302
2433
|
proof_request_template: buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation)
|
|
2303
2434
|
});
|
|
@@ -2337,6 +2468,7 @@ async function routeRequest(req, res) {
|
|
|
2337
2468
|
reusable_default_summary: buildPreparedContinuationReusableDefaultSummary(portableHandoff, continuation),
|
|
2338
2469
|
reusable_default_template: buildPreparedContinuationReusableDefaultTemplate(portableHandoff, continuation),
|
|
2339
2470
|
...buildPreparedContinuationCompositionContractBundle(portableHandoff, continuation),
|
|
2471
|
+
...buildPreparedContinuationAdapterBridgeBundle(portableHandoff, continuation),
|
|
2340
2472
|
extension_template: buildPreparedContinuationExtensionTemplate(portableHandoff, continuation)
|
|
2341
2473
|
});
|
|
2342
2474
|
return;
|
|
@@ -2435,6 +2567,254 @@ async function routeRequest(req, res) {
|
|
|
2435
2567
|
return;
|
|
2436
2568
|
}
|
|
2437
2569
|
|
|
2570
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/bridge-summary") {
|
|
2571
|
+
const body = await readJsonBody(req);
|
|
2572
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2573
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2574
|
+
if (!continuation) {
|
|
2575
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2576
|
+
return;
|
|
2577
|
+
}
|
|
2578
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2579
|
+
if (!resultPackage) {
|
|
2580
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2581
|
+
return;
|
|
2582
|
+
}
|
|
2583
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2584
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2585
|
+
spine_path_ref: resultPackage.source_ref
|
|
2586
|
+
});
|
|
2587
|
+
if (!payload) {
|
|
2588
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2589
|
+
return;
|
|
2590
|
+
}
|
|
2591
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2592
|
+
if (result.status !== 200) {
|
|
2593
|
+
sendJson(res, result.status, result.payload);
|
|
2594
|
+
return;
|
|
2595
|
+
}
|
|
2596
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2597
|
+
sendJson(res, 200, buildPreparedContinuationAdapterBridgeSummary(portableHandoff, continuation));
|
|
2598
|
+
return;
|
|
2599
|
+
}
|
|
2600
|
+
|
|
2601
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/bridge-template") {
|
|
2602
|
+
const body = await readJsonBody(req);
|
|
2603
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2604
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2605
|
+
if (!continuation) {
|
|
2606
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2607
|
+
return;
|
|
2608
|
+
}
|
|
2609
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2610
|
+
if (!resultPackage) {
|
|
2611
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2612
|
+
return;
|
|
2613
|
+
}
|
|
2614
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2615
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2616
|
+
spine_path_ref: resultPackage.source_ref
|
|
2617
|
+
});
|
|
2618
|
+
if (!payload) {
|
|
2619
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2620
|
+
return;
|
|
2621
|
+
}
|
|
2622
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2623
|
+
if (result.status !== 200) {
|
|
2624
|
+
sendJson(res, result.status, result.payload);
|
|
2625
|
+
return;
|
|
2626
|
+
}
|
|
2627
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2628
|
+
sendJson(res, 200, buildPreparedContinuationAdapterBridgeTemplate(portableHandoff, continuation));
|
|
2629
|
+
return;
|
|
2630
|
+
}
|
|
2631
|
+
|
|
2632
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/bridge-bundle") {
|
|
2633
|
+
const body = await readJsonBody(req);
|
|
2634
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2635
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2636
|
+
if (!continuation) {
|
|
2637
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2638
|
+
return;
|
|
2639
|
+
}
|
|
2640
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2641
|
+
if (!resultPackage) {
|
|
2642
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2643
|
+
return;
|
|
2644
|
+
}
|
|
2645
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2646
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2647
|
+
spine_path_ref: resultPackage.source_ref
|
|
2648
|
+
});
|
|
2649
|
+
if (!payload) {
|
|
2650
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2651
|
+
return;
|
|
2652
|
+
}
|
|
2653
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2654
|
+
if (result.status !== 200) {
|
|
2655
|
+
sendJson(res, result.status, result.payload);
|
|
2656
|
+
return;
|
|
2657
|
+
}
|
|
2658
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2659
|
+
sendJson(res, 200, buildPreparedContinuationAdapterBridgeBundle(portableHandoff, continuation));
|
|
2660
|
+
return;
|
|
2661
|
+
}
|
|
2662
|
+
|
|
2663
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/bridge-carry") {
|
|
2664
|
+
const body = await readJsonBody(req);
|
|
2665
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2666
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2667
|
+
if (!continuation) {
|
|
2668
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2669
|
+
return;
|
|
2670
|
+
}
|
|
2671
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2672
|
+
if (!resultPackage) {
|
|
2673
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2674
|
+
return;
|
|
2675
|
+
}
|
|
2676
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2677
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2678
|
+
spine_path_ref: resultPackage.source_ref
|
|
2679
|
+
});
|
|
2680
|
+
if (!payload) {
|
|
2681
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2682
|
+
return;
|
|
2683
|
+
}
|
|
2684
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2685
|
+
if (result.status !== 200) {
|
|
2686
|
+
sendJson(res, result.status, result.payload);
|
|
2687
|
+
return;
|
|
2688
|
+
}
|
|
2689
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2690
|
+
sendJson(res, 200, buildPreparedContinuationAdapterBridgeCarry(portableHandoff, continuation));
|
|
2691
|
+
return;
|
|
2692
|
+
}
|
|
2693
|
+
|
|
2694
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-summary") {
|
|
2695
|
+
const body = await readJsonBody(req);
|
|
2696
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2697
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2698
|
+
if (!continuation) {
|
|
2699
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2700
|
+
return;
|
|
2701
|
+
}
|
|
2702
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2703
|
+
if (!resultPackage) {
|
|
2704
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2705
|
+
return;
|
|
2706
|
+
}
|
|
2707
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2708
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2709
|
+
spine_path_ref: resultPackage.source_ref
|
|
2710
|
+
});
|
|
2711
|
+
if (!payload) {
|
|
2712
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2713
|
+
return;
|
|
2714
|
+
}
|
|
2715
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2716
|
+
if (result.status !== 200) {
|
|
2717
|
+
sendJson(res, result.status, result.payload);
|
|
2718
|
+
return;
|
|
2719
|
+
}
|
|
2720
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2721
|
+
sendJson(res, 200, buildPreparedContinuationHandoffSummary(portableHandoff, continuation));
|
|
2722
|
+
return;
|
|
2723
|
+
}
|
|
2724
|
+
|
|
2725
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-template") {
|
|
2726
|
+
const body = await readJsonBody(req);
|
|
2727
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2728
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2729
|
+
if (!continuation) {
|
|
2730
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2731
|
+
return;
|
|
2732
|
+
}
|
|
2733
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2734
|
+
if (!resultPackage) {
|
|
2735
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2736
|
+
return;
|
|
2737
|
+
}
|
|
2738
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2739
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2740
|
+
spine_path_ref: resultPackage.source_ref
|
|
2741
|
+
});
|
|
2742
|
+
if (!payload) {
|
|
2743
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2744
|
+
return;
|
|
2745
|
+
}
|
|
2746
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2747
|
+
if (result.status !== 200) {
|
|
2748
|
+
sendJson(res, result.status, result.payload);
|
|
2749
|
+
return;
|
|
2750
|
+
}
|
|
2751
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2752
|
+
sendJson(res, 200, buildPreparedContinuationHandoffTemplate(portableHandoff, continuation));
|
|
2753
|
+
return;
|
|
2754
|
+
}
|
|
2755
|
+
|
|
2756
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-bundle") {
|
|
2757
|
+
const body = await readJsonBody(req);
|
|
2758
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2759
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2760
|
+
if (!continuation) {
|
|
2761
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2762
|
+
return;
|
|
2763
|
+
}
|
|
2764
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2765
|
+
if (!resultPackage) {
|
|
2766
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2767
|
+
return;
|
|
2768
|
+
}
|
|
2769
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2770
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2771
|
+
spine_path_ref: resultPackage.source_ref
|
|
2772
|
+
});
|
|
2773
|
+
if (!payload) {
|
|
2774
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2775
|
+
return;
|
|
2776
|
+
}
|
|
2777
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2778
|
+
if (result.status !== 200) {
|
|
2779
|
+
sendJson(res, result.status, result.payload);
|
|
2780
|
+
return;
|
|
2781
|
+
}
|
|
2782
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2783
|
+
sendJson(res, 200, buildPreparedContinuationHandoffBundle(portableHandoff, continuation));
|
|
2784
|
+
return;
|
|
2785
|
+
}
|
|
2786
|
+
|
|
2787
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-carry") {
|
|
2788
|
+
const body = await readJsonBody(req);
|
|
2789
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2790
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2791
|
+
if (!continuation) {
|
|
2792
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2793
|
+
return;
|
|
2794
|
+
}
|
|
2795
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2796
|
+
if (!resultPackage) {
|
|
2797
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2798
|
+
return;
|
|
2799
|
+
}
|
|
2800
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2801
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2802
|
+
spine_path_ref: resultPackage.source_ref
|
|
2803
|
+
});
|
|
2804
|
+
if (!payload) {
|
|
2805
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2806
|
+
return;
|
|
2807
|
+
}
|
|
2808
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2809
|
+
if (result.status !== 200) {
|
|
2810
|
+
sendJson(res, result.status, result.payload);
|
|
2811
|
+
return;
|
|
2812
|
+
}
|
|
2813
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2814
|
+
sendJson(res, 200, buildPreparedContinuationHandoffCarry(portableHandoff, continuation));
|
|
2815
|
+
return;
|
|
2816
|
+
}
|
|
2817
|
+
|
|
2438
2818
|
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/contract-template") {
|
|
2439
2819
|
const body = await readJsonBody(req);
|
|
2440
2820
|
const continuationRef = String(body && body.continuation_ref || "").trim();
|