xytara 1.15.0 → 1.17.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 +112 -0
- package/package.json +1 -1
- package/server.js +315 -0
package/README.md
CHANGED
|
@@ -163,6 +163,24 @@ The current `1.15.0` line starts turning that same contract path into a clearer
|
|
|
163
163
|
|
|
164
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
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
|
+
|
|
175
|
+
The current `1.17.0` line starts turning that stable handoff contract into a clearer adapter-consumable handoff surface:
|
|
176
|
+
|
|
177
|
+
- adapter-consumable handoff-surface summaries on top of prepared handoff artifacts
|
|
178
|
+
- direct handoff-surface template routes for proof-side intake review
|
|
179
|
+
- compact handoff-surface bundles for direct adapter-facing reuse
|
|
180
|
+
- clearer adapter-facing handoff-surface ids and stable consumable carry
|
|
181
|
+
|
|
182
|
+
This is intended to make the transaction-side continuation path easier to consume directly as a stable adapter-facing handoff surface instead of only a well-described handoff contract.
|
|
183
|
+
|
|
166
184
|
## Package Surface
|
|
167
185
|
|
|
168
186
|
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
|
@@ -4520,6 +4520,118 @@ class CommerceClient {
|
|
|
4520
4520
|
});
|
|
4521
4521
|
}
|
|
4522
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
|
+
|
|
4587
|
+
async prepareInteractionResultPackageHandoffSurfaceSummary(continuationRef, body, options) {
|
|
4588
|
+
const opts = options || {};
|
|
4589
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/handoff-surface-summary", {
|
|
4590
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.handoff.surface.summary",
|
|
4591
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4592
|
+
body: body || {},
|
|
4593
|
+
callback_url: opts.callbackUrl || null,
|
|
4594
|
+
settlement_mode: opts.settlementMode || null,
|
|
4595
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4596
|
+
protocol: opts.protocol || null,
|
|
4597
|
+
integration_id: opts.integrationId || null,
|
|
4598
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4599
|
+
integration_context: opts.integrationContext || null
|
|
4600
|
+
});
|
|
4601
|
+
}
|
|
4602
|
+
|
|
4603
|
+
async prepareInteractionResultPackageHandoffSurfaceTemplate(continuationRef, body, options) {
|
|
4604
|
+
const opts = options || {};
|
|
4605
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/handoff-surface-template", {
|
|
4606
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.handoff.surface.template",
|
|
4607
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4608
|
+
body: body || {},
|
|
4609
|
+
callback_url: opts.callbackUrl || null,
|
|
4610
|
+
settlement_mode: opts.settlementMode || null,
|
|
4611
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4612
|
+
protocol: opts.protocol || null,
|
|
4613
|
+
integration_id: opts.integrationId || null,
|
|
4614
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4615
|
+
integration_context: opts.integrationContext || null
|
|
4616
|
+
});
|
|
4617
|
+
}
|
|
4618
|
+
|
|
4619
|
+
async prepareInteractionResultPackageHandoffSurfaceBundle(continuationRef, body, options) {
|
|
4620
|
+
const opts = options || {};
|
|
4621
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/handoff-surface-bundle", {
|
|
4622
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.handoff.surface.bundle",
|
|
4623
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4624
|
+
body: body || {},
|
|
4625
|
+
callback_url: opts.callbackUrl || null,
|
|
4626
|
+
settlement_mode: opts.settlementMode || null,
|
|
4627
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4628
|
+
protocol: opts.protocol || null,
|
|
4629
|
+
integration_id: opts.integrationId || null,
|
|
4630
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4631
|
+
integration_context: opts.integrationContext || null
|
|
4632
|
+
});
|
|
4633
|
+
}
|
|
4634
|
+
|
|
4523
4635
|
async runNamedTaskRoute(path, payload) {
|
|
4524
4636
|
if (!this.apiKey || !this.walletId || !this.walletSecret) {
|
|
4525
4637
|
throw new Error("named task routes require apiKey, walletId, and walletSecret");
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -1414,6 +1414,104 @@ function buildPreparedContinuationAdapterBridgeCarry(portableHandoff, continuati
|
|
|
1414
1414
|
};
|
|
1415
1415
|
}
|
|
1416
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
|
+
|
|
1472
|
+
function buildPreparedContinuationAdapterConsumableHandoffSummary(portableHandoff, continuation) {
|
|
1473
|
+
const summary = buildPreparedContinuationHandoffSummary(portableHandoff, continuation);
|
|
1474
|
+
return {
|
|
1475
|
+
ok: summary.ok === true,
|
|
1476
|
+
handoff_contract_ref: summary.handoff_contract_ref || null,
|
|
1477
|
+
adapter_handoff_surface_ref: summary.handoff_contract_ref ? `surface.${summary.handoff_contract_ref}` : null,
|
|
1478
|
+
stable_handoff_surface_ids: [
|
|
1479
|
+
"prepared_artifact_handoff_surface",
|
|
1480
|
+
"review_handoff_intake",
|
|
1481
|
+
"proof_run"
|
|
1482
|
+
],
|
|
1483
|
+
consumable_handoff_carry: summary.stable_handoff_carry || {},
|
|
1484
|
+
adapter_consumable: summary.handoff_ready === true,
|
|
1485
|
+
next_surface: "/v1/proof-center/result-package-handoff/review/handoff-intake"
|
|
1486
|
+
};
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
function buildPreparedContinuationAdapterConsumableHandoffTemplate(portableHandoff, continuation) {
|
|
1490
|
+
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1491
|
+
const summary = buildPreparedContinuationAdapterConsumableHandoffSummary(portableHandoff, continuation);
|
|
1492
|
+
return {
|
|
1493
|
+
ok: true,
|
|
1494
|
+
adapter_handoff_surface_ref: summary.adapter_handoff_surface_ref || null,
|
|
1495
|
+
target_surface: "/v1/proof-center/result-package-handoff/review/handoff-intake",
|
|
1496
|
+
request_template: {
|
|
1497
|
+
handoff_bundle: handoff
|
|
1498
|
+
},
|
|
1499
|
+
stable_boundary_ids: [
|
|
1500
|
+
"prepared_artifact_handoff_surface",
|
|
1501
|
+
"review_handoff_intake",
|
|
1502
|
+
"proof_run"
|
|
1503
|
+
]
|
|
1504
|
+
};
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
function buildPreparedContinuationAdapterConsumableHandoffBundle(portableHandoff, continuation) {
|
|
1508
|
+
return {
|
|
1509
|
+
ok: true,
|
|
1510
|
+
adapter_handoff_surface_summary: buildPreparedContinuationAdapterConsumableHandoffSummary(portableHandoff, continuation),
|
|
1511
|
+
adapter_handoff_surface_template: buildPreparedContinuationAdapterConsumableHandoffTemplate(portableHandoff, continuation)
|
|
1512
|
+
};
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1417
1515
|
function buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation) {
|
|
1418
1516
|
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1419
1517
|
return {
|
|
@@ -2636,6 +2734,223 @@ async function routeRequest(req, res) {
|
|
|
2636
2734
|
return;
|
|
2637
2735
|
}
|
|
2638
2736
|
|
|
2737
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-summary") {
|
|
2738
|
+
const body = await readJsonBody(req);
|
|
2739
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2740
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2741
|
+
if (!continuation) {
|
|
2742
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2743
|
+
return;
|
|
2744
|
+
}
|
|
2745
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2746
|
+
if (!resultPackage) {
|
|
2747
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2748
|
+
return;
|
|
2749
|
+
}
|
|
2750
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2751
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2752
|
+
spine_path_ref: resultPackage.source_ref
|
|
2753
|
+
});
|
|
2754
|
+
if (!payload) {
|
|
2755
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2756
|
+
return;
|
|
2757
|
+
}
|
|
2758
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2759
|
+
if (result.status !== 200) {
|
|
2760
|
+
sendJson(res, result.status, result.payload);
|
|
2761
|
+
return;
|
|
2762
|
+
}
|
|
2763
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2764
|
+
sendJson(res, 200, buildPreparedContinuationHandoffSummary(portableHandoff, continuation));
|
|
2765
|
+
return;
|
|
2766
|
+
}
|
|
2767
|
+
|
|
2768
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-template") {
|
|
2769
|
+
const body = await readJsonBody(req);
|
|
2770
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2771
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2772
|
+
if (!continuation) {
|
|
2773
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2774
|
+
return;
|
|
2775
|
+
}
|
|
2776
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2777
|
+
if (!resultPackage) {
|
|
2778
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2779
|
+
return;
|
|
2780
|
+
}
|
|
2781
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2782
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2783
|
+
spine_path_ref: resultPackage.source_ref
|
|
2784
|
+
});
|
|
2785
|
+
if (!payload) {
|
|
2786
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2787
|
+
return;
|
|
2788
|
+
}
|
|
2789
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2790
|
+
if (result.status !== 200) {
|
|
2791
|
+
sendJson(res, result.status, result.payload);
|
|
2792
|
+
return;
|
|
2793
|
+
}
|
|
2794
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2795
|
+
sendJson(res, 200, buildPreparedContinuationHandoffTemplate(portableHandoff, continuation));
|
|
2796
|
+
return;
|
|
2797
|
+
}
|
|
2798
|
+
|
|
2799
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-bundle") {
|
|
2800
|
+
const body = await readJsonBody(req);
|
|
2801
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2802
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2803
|
+
if (!continuation) {
|
|
2804
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2805
|
+
return;
|
|
2806
|
+
}
|
|
2807
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2808
|
+
if (!resultPackage) {
|
|
2809
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2810
|
+
return;
|
|
2811
|
+
}
|
|
2812
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2813
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2814
|
+
spine_path_ref: resultPackage.source_ref
|
|
2815
|
+
});
|
|
2816
|
+
if (!payload) {
|
|
2817
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2818
|
+
return;
|
|
2819
|
+
}
|
|
2820
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2821
|
+
if (result.status !== 200) {
|
|
2822
|
+
sendJson(res, result.status, result.payload);
|
|
2823
|
+
return;
|
|
2824
|
+
}
|
|
2825
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2826
|
+
sendJson(res, 200, buildPreparedContinuationHandoffBundle(portableHandoff, continuation));
|
|
2827
|
+
return;
|
|
2828
|
+
}
|
|
2829
|
+
|
|
2830
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-carry") {
|
|
2831
|
+
const body = await readJsonBody(req);
|
|
2832
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2833
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2834
|
+
if (!continuation) {
|
|
2835
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2836
|
+
return;
|
|
2837
|
+
}
|
|
2838
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2839
|
+
if (!resultPackage) {
|
|
2840
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2841
|
+
return;
|
|
2842
|
+
}
|
|
2843
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2844
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2845
|
+
spine_path_ref: resultPackage.source_ref
|
|
2846
|
+
});
|
|
2847
|
+
if (!payload) {
|
|
2848
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2849
|
+
return;
|
|
2850
|
+
}
|
|
2851
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2852
|
+
if (result.status !== 200) {
|
|
2853
|
+
sendJson(res, result.status, result.payload);
|
|
2854
|
+
return;
|
|
2855
|
+
}
|
|
2856
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2857
|
+
sendJson(res, 200, buildPreparedContinuationHandoffCarry(portableHandoff, continuation));
|
|
2858
|
+
return;
|
|
2859
|
+
}
|
|
2860
|
+
|
|
2861
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-surface-summary") {
|
|
2862
|
+
const body = await readJsonBody(req);
|
|
2863
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2864
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2865
|
+
if (!continuation) {
|
|
2866
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2867
|
+
return;
|
|
2868
|
+
}
|
|
2869
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2870
|
+
if (!resultPackage) {
|
|
2871
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2872
|
+
return;
|
|
2873
|
+
}
|
|
2874
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2875
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2876
|
+
spine_path_ref: resultPackage.source_ref
|
|
2877
|
+
});
|
|
2878
|
+
if (!payload) {
|
|
2879
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2880
|
+
return;
|
|
2881
|
+
}
|
|
2882
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2883
|
+
if (result.status !== 200) {
|
|
2884
|
+
sendJson(res, result.status, result.payload);
|
|
2885
|
+
return;
|
|
2886
|
+
}
|
|
2887
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2888
|
+
sendJson(res, 200, buildPreparedContinuationAdapterConsumableHandoffSummary(portableHandoff, continuation));
|
|
2889
|
+
return;
|
|
2890
|
+
}
|
|
2891
|
+
|
|
2892
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-surface-template") {
|
|
2893
|
+
const body = await readJsonBody(req);
|
|
2894
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2895
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2896
|
+
if (!continuation) {
|
|
2897
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2898
|
+
return;
|
|
2899
|
+
}
|
|
2900
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2901
|
+
if (!resultPackage) {
|
|
2902
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2903
|
+
return;
|
|
2904
|
+
}
|
|
2905
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2906
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2907
|
+
spine_path_ref: resultPackage.source_ref
|
|
2908
|
+
});
|
|
2909
|
+
if (!payload) {
|
|
2910
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2911
|
+
return;
|
|
2912
|
+
}
|
|
2913
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2914
|
+
if (result.status !== 200) {
|
|
2915
|
+
sendJson(res, result.status, result.payload);
|
|
2916
|
+
return;
|
|
2917
|
+
}
|
|
2918
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2919
|
+
sendJson(res, 200, buildPreparedContinuationAdapterConsumableHandoffTemplate(portableHandoff, continuation));
|
|
2920
|
+
return;
|
|
2921
|
+
}
|
|
2922
|
+
|
|
2923
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-surface-bundle") {
|
|
2924
|
+
const body = await readJsonBody(req);
|
|
2925
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2926
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2927
|
+
if (!continuation) {
|
|
2928
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2929
|
+
return;
|
|
2930
|
+
}
|
|
2931
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2932
|
+
if (!resultPackage) {
|
|
2933
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2934
|
+
return;
|
|
2935
|
+
}
|
|
2936
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2937
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2938
|
+
spine_path_ref: resultPackage.source_ref
|
|
2939
|
+
});
|
|
2940
|
+
if (!payload) {
|
|
2941
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2942
|
+
return;
|
|
2943
|
+
}
|
|
2944
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2945
|
+
if (result.status !== 200) {
|
|
2946
|
+
sendJson(res, result.status, result.payload);
|
|
2947
|
+
return;
|
|
2948
|
+
}
|
|
2949
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2950
|
+
sendJson(res, 200, buildPreparedContinuationAdapterConsumableHandoffBundle(portableHandoff, continuation));
|
|
2951
|
+
return;
|
|
2952
|
+
}
|
|
2953
|
+
|
|
2639
2954
|
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/contract-template") {
|
|
2640
2955
|
const body = await readJsonBody(req);
|
|
2641
2956
|
const continuationRef = String(body && body.continuation_ref || "").trim();
|