xytara 1.20.0 → 1.22.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 +290 -0
package/README.md
CHANGED
|
@@ -208,6 +208,24 @@ The current `1.20.0` line starts turning that adapter-ready execution package in
|
|
|
208
208
|
|
|
209
209
|
This is intended to make the transaction-side continuation path easier to operate against repeatedly as a stable public contract instead of only a package that is execution-ready by posture.
|
|
210
210
|
|
|
211
|
+
The current `1.21.0` line starts turning that adapter-operable execution contract into a clearer adapter-stable operating contract:
|
|
212
|
+
|
|
213
|
+
- operating-contract summaries on top of the default execution-contract path
|
|
214
|
+
- compact operating-contract bundles for direct adapter-facing stable operation posture
|
|
215
|
+
- default operating-contract summaries for the next proof-side operating-contract run posture
|
|
216
|
+
- clearer operating-contract ids and stable recurring operating carry
|
|
217
|
+
|
|
218
|
+
This is intended to make the transaction-side continuation path easier to depend on repeatedly as a durable public operating contract instead of only a contract that is operable in the moment.
|
|
219
|
+
|
|
220
|
+
The current `1.22.0` line starts turning that adapter-stable operating contract into a clearer adapter-reliable operating interface:
|
|
221
|
+
|
|
222
|
+
- operating-interface summaries on top of the default operating-contract path
|
|
223
|
+
- compact operating-interface bundles for direct adapter-facing reliable interface posture
|
|
224
|
+
- default operating-interface summaries for the next proof-side operating-interface run posture
|
|
225
|
+
- clearer operating-interface ids and stable reliable interface carry
|
|
226
|
+
|
|
227
|
+
This is intended to make the transaction-side continuation path easier to rely on operationally as a durable public interface instead of only a stable operating contract shape.
|
|
228
|
+
|
|
211
229
|
## Package Surface
|
|
212
230
|
|
|
213
231
|
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
|
@@ -4776,6 +4776,102 @@ class CommerceClient {
|
|
|
4776
4776
|
});
|
|
4777
4777
|
}
|
|
4778
4778
|
|
|
4779
|
+
async prepareInteractionResultPackageOperatingContractSummary(continuationRef, body, options) {
|
|
4780
|
+
const opts = options || {};
|
|
4781
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/operating-contract-summary", {
|
|
4782
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.operating.contract.summary",
|
|
4783
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4784
|
+
body: body || {},
|
|
4785
|
+
callback_url: opts.callbackUrl || null,
|
|
4786
|
+
settlement_mode: opts.settlementMode || null,
|
|
4787
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4788
|
+
protocol: opts.protocol || null,
|
|
4789
|
+
integration_id: opts.integrationId || null,
|
|
4790
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4791
|
+
integration_context: opts.integrationContext || null
|
|
4792
|
+
});
|
|
4793
|
+
}
|
|
4794
|
+
|
|
4795
|
+
async prepareInteractionResultPackageOperatingContractBundle(continuationRef, body, options) {
|
|
4796
|
+
const opts = options || {};
|
|
4797
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/operating-contract-bundle", {
|
|
4798
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.operating.contract.bundle",
|
|
4799
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4800
|
+
body: body || {},
|
|
4801
|
+
callback_url: opts.callbackUrl || null,
|
|
4802
|
+
settlement_mode: opts.settlementMode || null,
|
|
4803
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4804
|
+
protocol: opts.protocol || null,
|
|
4805
|
+
integration_id: opts.integrationId || null,
|
|
4806
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4807
|
+
integration_context: opts.integrationContext || null
|
|
4808
|
+
});
|
|
4809
|
+
}
|
|
4810
|
+
|
|
4811
|
+
async prepareInteractionResultPackageOperatingContractDefaultSummary(continuationRef, body, options) {
|
|
4812
|
+
const opts = options || {};
|
|
4813
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/operating-contract-default-summary", {
|
|
4814
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.operating.contract.default.summary",
|
|
4815
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4816
|
+
body: body || {},
|
|
4817
|
+
callback_url: opts.callbackUrl || null,
|
|
4818
|
+
settlement_mode: opts.settlementMode || null,
|
|
4819
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4820
|
+
protocol: opts.protocol || null,
|
|
4821
|
+
integration_id: opts.integrationId || null,
|
|
4822
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4823
|
+
integration_context: opts.integrationContext || null
|
|
4824
|
+
});
|
|
4825
|
+
}
|
|
4826
|
+
|
|
4827
|
+
async prepareInteractionResultPackageOperatingInterfaceSummary(continuationRef, body, options) {
|
|
4828
|
+
const opts = options || {};
|
|
4829
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/operating-interface-summary", {
|
|
4830
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.operating.interface.summary",
|
|
4831
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4832
|
+
body: body || {},
|
|
4833
|
+
callback_url: opts.callbackUrl || null,
|
|
4834
|
+
settlement_mode: opts.settlementMode || null,
|
|
4835
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4836
|
+
protocol: opts.protocol || null,
|
|
4837
|
+
integration_id: opts.integrationId || null,
|
|
4838
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4839
|
+
integration_context: opts.integrationContext || null
|
|
4840
|
+
});
|
|
4841
|
+
}
|
|
4842
|
+
|
|
4843
|
+
async prepareInteractionResultPackageOperatingInterfaceBundle(continuationRef, body, options) {
|
|
4844
|
+
const opts = options || {};
|
|
4845
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/operating-interface-bundle", {
|
|
4846
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.operating.interface.bundle",
|
|
4847
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4848
|
+
body: body || {},
|
|
4849
|
+
callback_url: opts.callbackUrl || null,
|
|
4850
|
+
settlement_mode: opts.settlementMode || null,
|
|
4851
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4852
|
+
protocol: opts.protocol || null,
|
|
4853
|
+
integration_id: opts.integrationId || null,
|
|
4854
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4855
|
+
integration_context: opts.integrationContext || null
|
|
4856
|
+
});
|
|
4857
|
+
}
|
|
4858
|
+
|
|
4859
|
+
async prepareInteractionResultPackageOperatingInterfaceDefaultSummary(continuationRef, body, options) {
|
|
4860
|
+
const opts = options || {};
|
|
4861
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/operating-interface-default-summary", {
|
|
4862
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.operating.interface.default.summary",
|
|
4863
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4864
|
+
body: body || {},
|
|
4865
|
+
callback_url: opts.callbackUrl || null,
|
|
4866
|
+
settlement_mode: opts.settlementMode || null,
|
|
4867
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4868
|
+
protocol: opts.protocol || null,
|
|
4869
|
+
integration_id: opts.integrationId || null,
|
|
4870
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4871
|
+
integration_context: opts.integrationContext || null
|
|
4872
|
+
});
|
|
4873
|
+
}
|
|
4874
|
+
|
|
4779
4875
|
async runNamedTaskRoute(path, payload) {
|
|
4780
4876
|
if (!this.apiKey || !this.walletId || !this.walletSecret) {
|
|
4781
4877
|
throw new Error("named task routes require apiKey, walletId, and walletSecret");
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -1672,6 +1672,110 @@ function buildPreparedContinuationDefaultExecutionContractSummary(portableHandof
|
|
|
1672
1672
|
};
|
|
1673
1673
|
}
|
|
1674
1674
|
|
|
1675
|
+
function buildPreparedContinuationAdapterStableOperatingContractSummary(portableHandoff, continuation) {
|
|
1676
|
+
const executionContract = buildPreparedContinuationDefaultExecutionContractSummary(portableHandoff, continuation);
|
|
1677
|
+
return {
|
|
1678
|
+
ok: executionContract.ok === true,
|
|
1679
|
+
default_execution_contract_ref: executionContract.default_execution_contract_ref || null,
|
|
1680
|
+
operating_contract_ref: executionContract.default_execution_contract_ref
|
|
1681
|
+
? `operating.${executionContract.default_execution_contract_ref}`
|
|
1682
|
+
: null,
|
|
1683
|
+
stable_operating_contract_ids: Array.isArray(executionContract.stable_default_execution_contract_ids)
|
|
1684
|
+
? executionContract.stable_default_execution_contract_ids
|
|
1685
|
+
: [],
|
|
1686
|
+
operating_contract_carry: executionContract.default_execution_contract_carry || {},
|
|
1687
|
+
adapter_stable: executionContract.execution_operable_by_default === true,
|
|
1688
|
+
next_surface: "/v1/proof-center/result-package-handoff/review/operating-contract"
|
|
1689
|
+
};
|
|
1690
|
+
}
|
|
1691
|
+
|
|
1692
|
+
function buildPreparedContinuationAdapterStableOperatingContractBundle(portableHandoff, continuation) {
|
|
1693
|
+
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1694
|
+
const summary = buildPreparedContinuationAdapterStableOperatingContractSummary(portableHandoff, continuation);
|
|
1695
|
+
return {
|
|
1696
|
+
ok: true,
|
|
1697
|
+
operating_contract_summary: summary,
|
|
1698
|
+
operating_contract_template: {
|
|
1699
|
+
ok: true,
|
|
1700
|
+
operating_contract_ref: summary.operating_contract_ref || null,
|
|
1701
|
+
target_surface: "/v1/proof-center/result-package-handoff/review/operating-contract",
|
|
1702
|
+
request_template: {
|
|
1703
|
+
handoff_bundle: handoff
|
|
1704
|
+
},
|
|
1705
|
+
stable_boundary_ids: Array.isArray(summary.stable_operating_contract_ids) ? summary.stable_operating_contract_ids : []
|
|
1706
|
+
}
|
|
1707
|
+
};
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
function buildPreparedContinuationDefaultOperatingContractSummary(portableHandoff, continuation) {
|
|
1711
|
+
const operatingContract = buildPreparedContinuationAdapterStableOperatingContractSummary(portableHandoff, continuation);
|
|
1712
|
+
return {
|
|
1713
|
+
ok: operatingContract.ok === true,
|
|
1714
|
+
operating_contract_ref: operatingContract.operating_contract_ref || null,
|
|
1715
|
+
default_operating_contract_ref: operatingContract.operating_contract_ref
|
|
1716
|
+
? `default.${operatingContract.operating_contract_ref}`
|
|
1717
|
+
: null,
|
|
1718
|
+
stable_default_operating_contract_ids: Array.isArray(operatingContract.stable_operating_contract_ids)
|
|
1719
|
+
? operatingContract.stable_operating_contract_ids
|
|
1720
|
+
: [],
|
|
1721
|
+
default_operating_contract_carry: operatingContract.operating_contract_carry || {},
|
|
1722
|
+
operating_stable_by_default: operatingContract.adapter_stable === true,
|
|
1723
|
+
next_surface: "/v1/proof-center/result-package-handoff/review/operating-contract-run"
|
|
1724
|
+
};
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1727
|
+
function buildPreparedContinuationAdapterReliableOperatingInterfaceSummary(portableHandoff, continuation) {
|
|
1728
|
+
const operatingContract = buildPreparedContinuationDefaultOperatingContractSummary(portableHandoff, continuation);
|
|
1729
|
+
return {
|
|
1730
|
+
ok: operatingContract.ok === true,
|
|
1731
|
+
default_operating_contract_ref: operatingContract.default_operating_contract_ref || null,
|
|
1732
|
+
operating_interface_ref: operatingContract.default_operating_contract_ref
|
|
1733
|
+
? `interface.${operatingContract.default_operating_contract_ref}`
|
|
1734
|
+
: null,
|
|
1735
|
+
reliable_operating_interface_ids: Array.isArray(operatingContract.stable_default_operating_contract_ids)
|
|
1736
|
+
? operatingContract.stable_default_operating_contract_ids
|
|
1737
|
+
: [],
|
|
1738
|
+
operating_interface_carry: operatingContract.default_operating_contract_carry || {},
|
|
1739
|
+
adapter_reliable: operatingContract.operating_stable_by_default === true,
|
|
1740
|
+
next_surface: "/v1/proof-center/result-package-handoff/review/operating-interface"
|
|
1741
|
+
};
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
function buildPreparedContinuationAdapterReliableOperatingInterfaceBundle(portableHandoff, continuation) {
|
|
1745
|
+
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1746
|
+
const summary = buildPreparedContinuationAdapterReliableOperatingInterfaceSummary(portableHandoff, continuation);
|
|
1747
|
+
return {
|
|
1748
|
+
ok: true,
|
|
1749
|
+
operating_interface_summary: summary,
|
|
1750
|
+
operating_interface_template: {
|
|
1751
|
+
ok: true,
|
|
1752
|
+
operating_interface_ref: summary.operating_interface_ref || null,
|
|
1753
|
+
target_surface: "/v1/proof-center/result-package-handoff/review/operating-interface",
|
|
1754
|
+
request_template: {
|
|
1755
|
+
handoff_bundle: handoff
|
|
1756
|
+
},
|
|
1757
|
+
stable_boundary_ids: Array.isArray(summary.reliable_operating_interface_ids) ? summary.reliable_operating_interface_ids : []
|
|
1758
|
+
}
|
|
1759
|
+
};
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
function buildPreparedContinuationDefaultOperatingInterfaceSummary(portableHandoff, continuation) {
|
|
1763
|
+
const operatingInterface = buildPreparedContinuationAdapterReliableOperatingInterfaceSummary(portableHandoff, continuation);
|
|
1764
|
+
return {
|
|
1765
|
+
ok: operatingInterface.ok === true,
|
|
1766
|
+
operating_interface_ref: operatingInterface.operating_interface_ref || null,
|
|
1767
|
+
default_operating_interface_ref: operatingInterface.operating_interface_ref
|
|
1768
|
+
? `default.${operatingInterface.operating_interface_ref}`
|
|
1769
|
+
: null,
|
|
1770
|
+
stable_default_operating_interface_ids: Array.isArray(operatingInterface.reliable_operating_interface_ids)
|
|
1771
|
+
? operatingInterface.reliable_operating_interface_ids
|
|
1772
|
+
: [],
|
|
1773
|
+
default_operating_interface_carry: operatingInterface.operating_interface_carry || {},
|
|
1774
|
+
operating_interface_reliable_by_default: operatingInterface.adapter_reliable === true,
|
|
1775
|
+
next_surface: "/v1/proof-center/result-package-handoff/review/operating-interface-run"
|
|
1776
|
+
};
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1675
1779
|
function buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation) {
|
|
1676
1780
|
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1677
1781
|
return {
|
|
@@ -3390,6 +3494,192 @@ async function routeRequest(req, res) {
|
|
|
3390
3494
|
return;
|
|
3391
3495
|
}
|
|
3392
3496
|
|
|
3497
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/operating-contract-summary") {
|
|
3498
|
+
const body = await readJsonBody(req);
|
|
3499
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3500
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3501
|
+
if (!continuation) {
|
|
3502
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3503
|
+
return;
|
|
3504
|
+
}
|
|
3505
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3506
|
+
if (!resultPackage) {
|
|
3507
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3508
|
+
return;
|
|
3509
|
+
}
|
|
3510
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3511
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3512
|
+
spine_path_ref: resultPackage.source_ref
|
|
3513
|
+
});
|
|
3514
|
+
if (!payload) {
|
|
3515
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3516
|
+
return;
|
|
3517
|
+
}
|
|
3518
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3519
|
+
if (result.status !== 200) {
|
|
3520
|
+
sendJson(res, result.status, result.payload);
|
|
3521
|
+
return;
|
|
3522
|
+
}
|
|
3523
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3524
|
+
sendJson(res, 200, buildPreparedContinuationAdapterStableOperatingContractSummary(portableHandoff, continuation));
|
|
3525
|
+
return;
|
|
3526
|
+
}
|
|
3527
|
+
|
|
3528
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/operating-contract-bundle") {
|
|
3529
|
+
const body = await readJsonBody(req);
|
|
3530
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3531
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3532
|
+
if (!continuation) {
|
|
3533
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3534
|
+
return;
|
|
3535
|
+
}
|
|
3536
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3537
|
+
if (!resultPackage) {
|
|
3538
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3539
|
+
return;
|
|
3540
|
+
}
|
|
3541
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3542
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3543
|
+
spine_path_ref: resultPackage.source_ref
|
|
3544
|
+
});
|
|
3545
|
+
if (!payload) {
|
|
3546
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3547
|
+
return;
|
|
3548
|
+
}
|
|
3549
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3550
|
+
if (result.status !== 200) {
|
|
3551
|
+
sendJson(res, result.status, result.payload);
|
|
3552
|
+
return;
|
|
3553
|
+
}
|
|
3554
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3555
|
+
sendJson(res, 200, buildPreparedContinuationAdapterStableOperatingContractBundle(portableHandoff, continuation));
|
|
3556
|
+
return;
|
|
3557
|
+
}
|
|
3558
|
+
|
|
3559
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/operating-contract-default-summary") {
|
|
3560
|
+
const body = await readJsonBody(req);
|
|
3561
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3562
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3563
|
+
if (!continuation) {
|
|
3564
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3565
|
+
return;
|
|
3566
|
+
}
|
|
3567
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3568
|
+
if (!resultPackage) {
|
|
3569
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3570
|
+
return;
|
|
3571
|
+
}
|
|
3572
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3573
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3574
|
+
spine_path_ref: resultPackage.source_ref
|
|
3575
|
+
});
|
|
3576
|
+
if (!payload) {
|
|
3577
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3578
|
+
return;
|
|
3579
|
+
}
|
|
3580
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3581
|
+
if (result.status !== 200) {
|
|
3582
|
+
sendJson(res, result.status, result.payload);
|
|
3583
|
+
return;
|
|
3584
|
+
}
|
|
3585
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3586
|
+
sendJson(res, 200, buildPreparedContinuationDefaultOperatingContractSummary(portableHandoff, continuation));
|
|
3587
|
+
return;
|
|
3588
|
+
}
|
|
3589
|
+
|
|
3590
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/operating-interface-summary") {
|
|
3591
|
+
const body = await readJsonBody(req);
|
|
3592
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3593
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3594
|
+
if (!continuation) {
|
|
3595
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3596
|
+
return;
|
|
3597
|
+
}
|
|
3598
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3599
|
+
if (!resultPackage) {
|
|
3600
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3601
|
+
return;
|
|
3602
|
+
}
|
|
3603
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3604
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3605
|
+
spine_path_ref: resultPackage.source_ref
|
|
3606
|
+
});
|
|
3607
|
+
if (!payload) {
|
|
3608
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3609
|
+
return;
|
|
3610
|
+
}
|
|
3611
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3612
|
+
if (result.status !== 200) {
|
|
3613
|
+
sendJson(res, result.status, result.payload);
|
|
3614
|
+
return;
|
|
3615
|
+
}
|
|
3616
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3617
|
+
sendJson(res, 200, buildPreparedContinuationAdapterReliableOperatingInterfaceSummary(portableHandoff, continuation));
|
|
3618
|
+
return;
|
|
3619
|
+
}
|
|
3620
|
+
|
|
3621
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/operating-interface-bundle") {
|
|
3622
|
+
const body = await readJsonBody(req);
|
|
3623
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3624
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3625
|
+
if (!continuation) {
|
|
3626
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3627
|
+
return;
|
|
3628
|
+
}
|
|
3629
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3630
|
+
if (!resultPackage) {
|
|
3631
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3632
|
+
return;
|
|
3633
|
+
}
|
|
3634
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3635
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3636
|
+
spine_path_ref: resultPackage.source_ref
|
|
3637
|
+
});
|
|
3638
|
+
if (!payload) {
|
|
3639
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3640
|
+
return;
|
|
3641
|
+
}
|
|
3642
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3643
|
+
if (result.status !== 200) {
|
|
3644
|
+
sendJson(res, result.status, result.payload);
|
|
3645
|
+
return;
|
|
3646
|
+
}
|
|
3647
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3648
|
+
sendJson(res, 200, buildPreparedContinuationAdapterReliableOperatingInterfaceBundle(portableHandoff, continuation));
|
|
3649
|
+
return;
|
|
3650
|
+
}
|
|
3651
|
+
|
|
3652
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/operating-interface-default-summary") {
|
|
3653
|
+
const body = await readJsonBody(req);
|
|
3654
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3655
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3656
|
+
if (!continuation) {
|
|
3657
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3658
|
+
return;
|
|
3659
|
+
}
|
|
3660
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3661
|
+
if (!resultPackage) {
|
|
3662
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3663
|
+
return;
|
|
3664
|
+
}
|
|
3665
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3666
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3667
|
+
spine_path_ref: resultPackage.source_ref
|
|
3668
|
+
});
|
|
3669
|
+
if (!payload) {
|
|
3670
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3671
|
+
return;
|
|
3672
|
+
}
|
|
3673
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3674
|
+
if (result.status !== 200) {
|
|
3675
|
+
sendJson(res, result.status, result.payload);
|
|
3676
|
+
return;
|
|
3677
|
+
}
|
|
3678
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3679
|
+
sendJson(res, 200, buildPreparedContinuationDefaultOperatingInterfaceSummary(portableHandoff, continuation));
|
|
3680
|
+
return;
|
|
3681
|
+
}
|
|
3682
|
+
|
|
3393
3683
|
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/contract-template") {
|
|
3394
3684
|
const body = await readJsonBody(req);
|
|
3395
3685
|
const continuationRef = String(body && body.continuation_ref || "").trim();
|