xytara 1.16.0 → 1.18.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 +96 -0
- package/package.json +1 -1
- package/server.js +285 -0
package/README.md
CHANGED
|
@@ -172,6 +172,24 @@ The current `1.16.0` line starts turning that bridge into a clearer stable publi
|
|
|
172
172
|
|
|
173
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
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
|
+
|
|
184
|
+
The current `1.18.0` line starts turning that adapter-consumable handoff surface into a clearer adapter-usable handoff package:
|
|
185
|
+
|
|
186
|
+
- adapter-usable handoff-package summaries on top of prepared handoff artifacts
|
|
187
|
+
- compact handoff-package bundles for direct adapter-facing use
|
|
188
|
+
- default handoff-package summaries for the next proof-side follow-through
|
|
189
|
+
- clearer adapter-facing handoff-package ids and stable usable carry
|
|
190
|
+
|
|
191
|
+
This is intended to make the transaction-side continuation path easier to use directly as a stable public handoff package instead of only a surface that still needs extra glue logic.
|
|
192
|
+
|
|
175
193
|
## Package Surface
|
|
176
194
|
|
|
177
195
|
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
|
@@ -4584,6 +4584,102 @@ class CommerceClient {
|
|
|
4584
4584
|
});
|
|
4585
4585
|
}
|
|
4586
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
|
+
|
|
4635
|
+
async prepareInteractionResultPackageHandoffPackageSummary(continuationRef, body, options) {
|
|
4636
|
+
const opts = options || {};
|
|
4637
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/handoff-package-summary", {
|
|
4638
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.handoff.package.summary",
|
|
4639
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4640
|
+
body: body || {},
|
|
4641
|
+
callback_url: opts.callbackUrl || null,
|
|
4642
|
+
settlement_mode: opts.settlementMode || null,
|
|
4643
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4644
|
+
protocol: opts.protocol || null,
|
|
4645
|
+
integration_id: opts.integrationId || null,
|
|
4646
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4647
|
+
integration_context: opts.integrationContext || null
|
|
4648
|
+
});
|
|
4649
|
+
}
|
|
4650
|
+
|
|
4651
|
+
async prepareInteractionResultPackageHandoffPackageBundle(continuationRef, body, options) {
|
|
4652
|
+
const opts = options || {};
|
|
4653
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/handoff-package-bundle", {
|
|
4654
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.handoff.package.bundle",
|
|
4655
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4656
|
+
body: body || {},
|
|
4657
|
+
callback_url: opts.callbackUrl || null,
|
|
4658
|
+
settlement_mode: opts.settlementMode || null,
|
|
4659
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4660
|
+
protocol: opts.protocol || null,
|
|
4661
|
+
integration_id: opts.integrationId || null,
|
|
4662
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4663
|
+
integration_context: opts.integrationContext || null
|
|
4664
|
+
});
|
|
4665
|
+
}
|
|
4666
|
+
|
|
4667
|
+
async prepareInteractionResultPackageHandoffPackageDefaultSummary(continuationRef, body, options) {
|
|
4668
|
+
const opts = options || {};
|
|
4669
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/handoff-package-default-summary", {
|
|
4670
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.handoff.package.default.summary",
|
|
4671
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4672
|
+
body: body || {},
|
|
4673
|
+
callback_url: opts.callbackUrl || null,
|
|
4674
|
+
settlement_mode: opts.settlementMode || null,
|
|
4675
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4676
|
+
protocol: opts.protocol || null,
|
|
4677
|
+
integration_id: opts.integrationId || null,
|
|
4678
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4679
|
+
integration_context: opts.integrationContext || null
|
|
4680
|
+
});
|
|
4681
|
+
}
|
|
4682
|
+
|
|
4587
4683
|
async runNamedTaskRoute(path, payload) {
|
|
4588
4684
|
if (!this.apiKey || !this.walletId || !this.walletSecret) {
|
|
4589
4685
|
throw new Error("named task routes require apiKey, walletId, and walletSecret");
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -1469,6 +1469,105 @@ function buildPreparedContinuationHandoffCarry(portableHandoff, continuation) {
|
|
|
1469
1469
|
};
|
|
1470
1470
|
}
|
|
1471
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
|
+
|
|
1515
|
+
function buildPreparedContinuationAdapterUsableHandoffPackageSummary(portableHandoff, continuation) {
|
|
1516
|
+
const surface = buildPreparedContinuationAdapterConsumableHandoffSummary(portableHandoff, continuation);
|
|
1517
|
+
return {
|
|
1518
|
+
ok: surface.ok === true,
|
|
1519
|
+
adapter_handoff_surface_ref: surface.adapter_handoff_surface_ref || null,
|
|
1520
|
+
adapter_handoff_package_ref: surface.adapter_handoff_surface_ref ? `package.${surface.adapter_handoff_surface_ref}` : null,
|
|
1521
|
+
stable_handoff_package_ids: [
|
|
1522
|
+
"prepared_artifact_handoff_package",
|
|
1523
|
+
"review_handoff_package_intake",
|
|
1524
|
+
"proof_run"
|
|
1525
|
+
],
|
|
1526
|
+
usable_handoff_package_carry: surface.consumable_handoff_carry || {},
|
|
1527
|
+
adapter_usable: surface.adapter_consumable === true,
|
|
1528
|
+
next_surface: "/v1/proof-center/result-package-handoff/review/handoff-package-intake"
|
|
1529
|
+
};
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
function buildPreparedContinuationAdapterUsableHandoffPackageBundle(portableHandoff, continuation) {
|
|
1533
|
+
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1534
|
+
const summary = buildPreparedContinuationAdapterUsableHandoffPackageSummary(portableHandoff, continuation);
|
|
1535
|
+
return {
|
|
1536
|
+
ok: true,
|
|
1537
|
+
adapter_handoff_package_summary: summary,
|
|
1538
|
+
adapter_handoff_package_template: {
|
|
1539
|
+
ok: true,
|
|
1540
|
+
adapter_handoff_package_ref: summary.adapter_handoff_package_ref || null,
|
|
1541
|
+
target_surface: "/v1/proof-center/result-package-handoff/review/handoff-package-intake",
|
|
1542
|
+
request_template: {
|
|
1543
|
+
handoff_bundle: handoff
|
|
1544
|
+
},
|
|
1545
|
+
stable_boundary_ids: [
|
|
1546
|
+
"prepared_artifact_handoff_package",
|
|
1547
|
+
"review_handoff_package_intake",
|
|
1548
|
+
"proof_run"
|
|
1549
|
+
]
|
|
1550
|
+
}
|
|
1551
|
+
};
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
function buildPreparedContinuationDefaultUsableHandoffPackageSummary(portableHandoff, continuation) {
|
|
1555
|
+
const handoffPackage = buildPreparedContinuationAdapterUsableHandoffPackageSummary(portableHandoff, continuation);
|
|
1556
|
+
return {
|
|
1557
|
+
ok: handoffPackage.ok === true,
|
|
1558
|
+
adapter_handoff_package_ref: handoffPackage.adapter_handoff_package_ref || null,
|
|
1559
|
+
default_handoff_package_ref: handoffPackage.adapter_handoff_package_ref
|
|
1560
|
+
? `default.${handoffPackage.adapter_handoff_package_ref}`
|
|
1561
|
+
: null,
|
|
1562
|
+
stable_default_handoff_package_ids: Array.isArray(handoffPackage.stable_handoff_package_ids)
|
|
1563
|
+
? handoffPackage.stable_handoff_package_ids
|
|
1564
|
+
: [],
|
|
1565
|
+
default_usable_handoff_package_carry: handoffPackage.usable_handoff_package_carry || {},
|
|
1566
|
+
package_usable_by_default: handoffPackage.adapter_usable === true,
|
|
1567
|
+
next_surface: "/v1/proof-center/result-package-handoff/review/handoff-package-run"
|
|
1568
|
+
};
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1472
1571
|
function buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation) {
|
|
1473
1572
|
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1474
1573
|
return {
|
|
@@ -2815,6 +2914,192 @@ async function routeRequest(req, res) {
|
|
|
2815
2914
|
return;
|
|
2816
2915
|
}
|
|
2817
2916
|
|
|
2917
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-surface-summary") {
|
|
2918
|
+
const body = await readJsonBody(req);
|
|
2919
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2920
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2921
|
+
if (!continuation) {
|
|
2922
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2923
|
+
return;
|
|
2924
|
+
}
|
|
2925
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2926
|
+
if (!resultPackage) {
|
|
2927
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2928
|
+
return;
|
|
2929
|
+
}
|
|
2930
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2931
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2932
|
+
spine_path_ref: resultPackage.source_ref
|
|
2933
|
+
});
|
|
2934
|
+
if (!payload) {
|
|
2935
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2936
|
+
return;
|
|
2937
|
+
}
|
|
2938
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2939
|
+
if (result.status !== 200) {
|
|
2940
|
+
sendJson(res, result.status, result.payload);
|
|
2941
|
+
return;
|
|
2942
|
+
}
|
|
2943
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2944
|
+
sendJson(res, 200, buildPreparedContinuationAdapterConsumableHandoffSummary(portableHandoff, continuation));
|
|
2945
|
+
return;
|
|
2946
|
+
}
|
|
2947
|
+
|
|
2948
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-surface-template") {
|
|
2949
|
+
const body = await readJsonBody(req);
|
|
2950
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2951
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2952
|
+
if (!continuation) {
|
|
2953
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2954
|
+
return;
|
|
2955
|
+
}
|
|
2956
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2957
|
+
if (!resultPackage) {
|
|
2958
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2959
|
+
return;
|
|
2960
|
+
}
|
|
2961
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2962
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2963
|
+
spine_path_ref: resultPackage.source_ref
|
|
2964
|
+
});
|
|
2965
|
+
if (!payload) {
|
|
2966
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2967
|
+
return;
|
|
2968
|
+
}
|
|
2969
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2970
|
+
if (result.status !== 200) {
|
|
2971
|
+
sendJson(res, result.status, result.payload);
|
|
2972
|
+
return;
|
|
2973
|
+
}
|
|
2974
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2975
|
+
sendJson(res, 200, buildPreparedContinuationAdapterConsumableHandoffTemplate(portableHandoff, continuation));
|
|
2976
|
+
return;
|
|
2977
|
+
}
|
|
2978
|
+
|
|
2979
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-surface-bundle") {
|
|
2980
|
+
const body = await readJsonBody(req);
|
|
2981
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2982
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2983
|
+
if (!continuation) {
|
|
2984
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2985
|
+
return;
|
|
2986
|
+
}
|
|
2987
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2988
|
+
if (!resultPackage) {
|
|
2989
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2990
|
+
return;
|
|
2991
|
+
}
|
|
2992
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2993
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2994
|
+
spine_path_ref: resultPackage.source_ref
|
|
2995
|
+
});
|
|
2996
|
+
if (!payload) {
|
|
2997
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2998
|
+
return;
|
|
2999
|
+
}
|
|
3000
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3001
|
+
if (result.status !== 200) {
|
|
3002
|
+
sendJson(res, result.status, result.payload);
|
|
3003
|
+
return;
|
|
3004
|
+
}
|
|
3005
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3006
|
+
sendJson(res, 200, buildPreparedContinuationAdapterConsumableHandoffBundle(portableHandoff, continuation));
|
|
3007
|
+
return;
|
|
3008
|
+
}
|
|
3009
|
+
|
|
3010
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-package-summary") {
|
|
3011
|
+
const body = await readJsonBody(req);
|
|
3012
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3013
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3014
|
+
if (!continuation) {
|
|
3015
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3016
|
+
return;
|
|
3017
|
+
}
|
|
3018
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3019
|
+
if (!resultPackage) {
|
|
3020
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3021
|
+
return;
|
|
3022
|
+
}
|
|
3023
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3024
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3025
|
+
spine_path_ref: resultPackage.source_ref
|
|
3026
|
+
});
|
|
3027
|
+
if (!payload) {
|
|
3028
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3029
|
+
return;
|
|
3030
|
+
}
|
|
3031
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3032
|
+
if (result.status !== 200) {
|
|
3033
|
+
sendJson(res, result.status, result.payload);
|
|
3034
|
+
return;
|
|
3035
|
+
}
|
|
3036
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3037
|
+
sendJson(res, 200, buildPreparedContinuationAdapterUsableHandoffPackageSummary(portableHandoff, continuation));
|
|
3038
|
+
return;
|
|
3039
|
+
}
|
|
3040
|
+
|
|
3041
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-package-bundle") {
|
|
3042
|
+
const body = await readJsonBody(req);
|
|
3043
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3044
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3045
|
+
if (!continuation) {
|
|
3046
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3047
|
+
return;
|
|
3048
|
+
}
|
|
3049
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3050
|
+
if (!resultPackage) {
|
|
3051
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3052
|
+
return;
|
|
3053
|
+
}
|
|
3054
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3055
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3056
|
+
spine_path_ref: resultPackage.source_ref
|
|
3057
|
+
});
|
|
3058
|
+
if (!payload) {
|
|
3059
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3060
|
+
return;
|
|
3061
|
+
}
|
|
3062
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3063
|
+
if (result.status !== 200) {
|
|
3064
|
+
sendJson(res, result.status, result.payload);
|
|
3065
|
+
return;
|
|
3066
|
+
}
|
|
3067
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3068
|
+
sendJson(res, 200, buildPreparedContinuationAdapterUsableHandoffPackageBundle(portableHandoff, continuation));
|
|
3069
|
+
return;
|
|
3070
|
+
}
|
|
3071
|
+
|
|
3072
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-package-default-summary") {
|
|
3073
|
+
const body = await readJsonBody(req);
|
|
3074
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3075
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3076
|
+
if (!continuation) {
|
|
3077
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3078
|
+
return;
|
|
3079
|
+
}
|
|
3080
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3081
|
+
if (!resultPackage) {
|
|
3082
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3083
|
+
return;
|
|
3084
|
+
}
|
|
3085
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3086
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3087
|
+
spine_path_ref: resultPackage.source_ref
|
|
3088
|
+
});
|
|
3089
|
+
if (!payload) {
|
|
3090
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3091
|
+
return;
|
|
3092
|
+
}
|
|
3093
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3094
|
+
if (result.status !== 200) {
|
|
3095
|
+
sendJson(res, result.status, result.payload);
|
|
3096
|
+
return;
|
|
3097
|
+
}
|
|
3098
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3099
|
+
sendJson(res, 200, buildPreparedContinuationDefaultUsableHandoffPackageSummary(portableHandoff, continuation));
|
|
3100
|
+
return;
|
|
3101
|
+
}
|
|
3102
|
+
|
|
2818
3103
|
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/contract-template") {
|
|
2819
3104
|
const body = await readJsonBody(req);
|
|
2820
3105
|
const continuationRef = String(body && body.continuation_ref || "").trim();
|