xytara 1.19.0 → 1.21.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
|
@@ -199,6 +199,24 @@ The current `1.19.0` line starts turning that adapter-usable handoff package int
|
|
|
199
199
|
|
|
200
200
|
This is intended to make the transaction-side continuation path easier to execute against directly as a stable public package instead of only a package that still needs execution glue.
|
|
201
201
|
|
|
202
|
+
The current `1.20.0` line starts turning that adapter-ready execution package into a clearer adapter-operable execution contract:
|
|
203
|
+
|
|
204
|
+
- execution-contract summaries on top of the default execution-package path
|
|
205
|
+
- compact execution-contract bundles for direct adapter-facing operation posture
|
|
206
|
+
- default execution-contract summaries for the next proof-side execution-contract run posture
|
|
207
|
+
- clearer execution-contract ids and stable operable carry
|
|
208
|
+
|
|
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
|
+
|
|
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
|
+
|
|
202
220
|
## Package Surface
|
|
203
221
|
|
|
204
222
|
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
|
@@ -4728,6 +4728,102 @@ class CommerceClient {
|
|
|
4728
4728
|
});
|
|
4729
4729
|
}
|
|
4730
4730
|
|
|
4731
|
+
async prepareInteractionResultPackageExecutionContractSummary(continuationRef, body, options) {
|
|
4732
|
+
const opts = options || {};
|
|
4733
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/execution-contract-summary", {
|
|
4734
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.execution.contract.summary",
|
|
4735
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4736
|
+
body: body || {},
|
|
4737
|
+
callback_url: opts.callbackUrl || null,
|
|
4738
|
+
settlement_mode: opts.settlementMode || null,
|
|
4739
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4740
|
+
protocol: opts.protocol || null,
|
|
4741
|
+
integration_id: opts.integrationId || null,
|
|
4742
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4743
|
+
integration_context: opts.integrationContext || null
|
|
4744
|
+
});
|
|
4745
|
+
}
|
|
4746
|
+
|
|
4747
|
+
async prepareInteractionResultPackageExecutionContractBundle(continuationRef, body, options) {
|
|
4748
|
+
const opts = options || {};
|
|
4749
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/execution-contract-bundle", {
|
|
4750
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.execution.contract.bundle",
|
|
4751
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4752
|
+
body: body || {},
|
|
4753
|
+
callback_url: opts.callbackUrl || null,
|
|
4754
|
+
settlement_mode: opts.settlementMode || null,
|
|
4755
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4756
|
+
protocol: opts.protocol || null,
|
|
4757
|
+
integration_id: opts.integrationId || null,
|
|
4758
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4759
|
+
integration_context: opts.integrationContext || null
|
|
4760
|
+
});
|
|
4761
|
+
}
|
|
4762
|
+
|
|
4763
|
+
async prepareInteractionResultPackageExecutionContractDefaultSummary(continuationRef, body, options) {
|
|
4764
|
+
const opts = options || {};
|
|
4765
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/execution-contract-default-summary", {
|
|
4766
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.execution.contract.default.summary",
|
|
4767
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4768
|
+
body: body || {},
|
|
4769
|
+
callback_url: opts.callbackUrl || null,
|
|
4770
|
+
settlement_mode: opts.settlementMode || null,
|
|
4771
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4772
|
+
protocol: opts.protocol || null,
|
|
4773
|
+
integration_id: opts.integrationId || null,
|
|
4774
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4775
|
+
integration_context: opts.integrationContext || null
|
|
4776
|
+
});
|
|
4777
|
+
}
|
|
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
|
+
|
|
4731
4827
|
async runNamedTaskRoute(path, payload) {
|
|
4732
4828
|
if (!this.apiKey || !this.walletId || !this.walletSecret) {
|
|
4733
4829
|
throw new Error("named task routes require apiKey, walletId, and walletSecret");
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -1620,6 +1620,110 @@ function buildPreparedContinuationDefaultExecutionPackageSummary(portableHandoff
|
|
|
1620
1620
|
};
|
|
1621
1621
|
}
|
|
1622
1622
|
|
|
1623
|
+
function buildPreparedContinuationAdapterOperableExecutionContractSummary(portableHandoff, continuation) {
|
|
1624
|
+
const executionPackage = buildPreparedContinuationDefaultExecutionPackageSummary(portableHandoff, continuation);
|
|
1625
|
+
return {
|
|
1626
|
+
ok: executionPackage.ok === true,
|
|
1627
|
+
default_execution_package_ref: executionPackage.default_execution_package_ref || null,
|
|
1628
|
+
execution_contract_ref: executionPackage.default_execution_package_ref
|
|
1629
|
+
? `contract.${executionPackage.default_execution_package_ref}`
|
|
1630
|
+
: null,
|
|
1631
|
+
stable_execution_contract_ids: Array.isArray(executionPackage.stable_default_execution_package_ids)
|
|
1632
|
+
? executionPackage.stable_default_execution_package_ids
|
|
1633
|
+
: [],
|
|
1634
|
+
execution_contract_carry: executionPackage.default_execution_package_carry || {},
|
|
1635
|
+
adapter_operable: executionPackage.execution_ready_by_default === true,
|
|
1636
|
+
next_surface: "/v1/proof-center/result-package-handoff/review/execution-contract"
|
|
1637
|
+
};
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
function buildPreparedContinuationAdapterOperableExecutionContractBundle(portableHandoff, continuation) {
|
|
1641
|
+
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1642
|
+
const summary = buildPreparedContinuationAdapterOperableExecutionContractSummary(portableHandoff, continuation);
|
|
1643
|
+
return {
|
|
1644
|
+
ok: true,
|
|
1645
|
+
execution_contract_summary: summary,
|
|
1646
|
+
execution_contract_template: {
|
|
1647
|
+
ok: true,
|
|
1648
|
+
execution_contract_ref: summary.execution_contract_ref || null,
|
|
1649
|
+
target_surface: "/v1/proof-center/result-package-handoff/review/execution-contract",
|
|
1650
|
+
request_template: {
|
|
1651
|
+
handoff_bundle: handoff
|
|
1652
|
+
},
|
|
1653
|
+
stable_boundary_ids: Array.isArray(summary.stable_execution_contract_ids) ? summary.stable_execution_contract_ids : []
|
|
1654
|
+
}
|
|
1655
|
+
};
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
function buildPreparedContinuationDefaultExecutionContractSummary(portableHandoff, continuation) {
|
|
1659
|
+
const executionContract = buildPreparedContinuationAdapterOperableExecutionContractSummary(portableHandoff, continuation);
|
|
1660
|
+
return {
|
|
1661
|
+
ok: executionContract.ok === true,
|
|
1662
|
+
execution_contract_ref: executionContract.execution_contract_ref || null,
|
|
1663
|
+
default_execution_contract_ref: executionContract.execution_contract_ref
|
|
1664
|
+
? `default.${executionContract.execution_contract_ref}`
|
|
1665
|
+
: null,
|
|
1666
|
+
stable_default_execution_contract_ids: Array.isArray(executionContract.stable_execution_contract_ids)
|
|
1667
|
+
? executionContract.stable_execution_contract_ids
|
|
1668
|
+
: [],
|
|
1669
|
+
default_execution_contract_carry: executionContract.execution_contract_carry || {},
|
|
1670
|
+
execution_operable_by_default: executionContract.adapter_operable === true,
|
|
1671
|
+
next_surface: "/v1/proof-center/result-package-handoff/review/execution-contract-run"
|
|
1672
|
+
};
|
|
1673
|
+
}
|
|
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
|
+
|
|
1623
1727
|
function buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation) {
|
|
1624
1728
|
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1625
1729
|
return {
|
|
@@ -3245,6 +3349,192 @@ async function routeRequest(req, res) {
|
|
|
3245
3349
|
return;
|
|
3246
3350
|
}
|
|
3247
3351
|
|
|
3352
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/execution-contract-summary") {
|
|
3353
|
+
const body = await readJsonBody(req);
|
|
3354
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3355
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3356
|
+
if (!continuation) {
|
|
3357
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3358
|
+
return;
|
|
3359
|
+
}
|
|
3360
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3361
|
+
if (!resultPackage) {
|
|
3362
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3363
|
+
return;
|
|
3364
|
+
}
|
|
3365
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3366
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3367
|
+
spine_path_ref: resultPackage.source_ref
|
|
3368
|
+
});
|
|
3369
|
+
if (!payload) {
|
|
3370
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3371
|
+
return;
|
|
3372
|
+
}
|
|
3373
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3374
|
+
if (result.status !== 200) {
|
|
3375
|
+
sendJson(res, result.status, result.payload);
|
|
3376
|
+
return;
|
|
3377
|
+
}
|
|
3378
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3379
|
+
sendJson(res, 200, buildPreparedContinuationAdapterOperableExecutionContractSummary(portableHandoff, continuation));
|
|
3380
|
+
return;
|
|
3381
|
+
}
|
|
3382
|
+
|
|
3383
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/execution-contract-bundle") {
|
|
3384
|
+
const body = await readJsonBody(req);
|
|
3385
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3386
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3387
|
+
if (!continuation) {
|
|
3388
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3389
|
+
return;
|
|
3390
|
+
}
|
|
3391
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3392
|
+
if (!resultPackage) {
|
|
3393
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3394
|
+
return;
|
|
3395
|
+
}
|
|
3396
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3397
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3398
|
+
spine_path_ref: resultPackage.source_ref
|
|
3399
|
+
});
|
|
3400
|
+
if (!payload) {
|
|
3401
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3402
|
+
return;
|
|
3403
|
+
}
|
|
3404
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3405
|
+
if (result.status !== 200) {
|
|
3406
|
+
sendJson(res, result.status, result.payload);
|
|
3407
|
+
return;
|
|
3408
|
+
}
|
|
3409
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3410
|
+
sendJson(res, 200, buildPreparedContinuationAdapterOperableExecutionContractBundle(portableHandoff, continuation));
|
|
3411
|
+
return;
|
|
3412
|
+
}
|
|
3413
|
+
|
|
3414
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/execution-contract-default-summary") {
|
|
3415
|
+
const body = await readJsonBody(req);
|
|
3416
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3417
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3418
|
+
if (!continuation) {
|
|
3419
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3420
|
+
return;
|
|
3421
|
+
}
|
|
3422
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3423
|
+
if (!resultPackage) {
|
|
3424
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3425
|
+
return;
|
|
3426
|
+
}
|
|
3427
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3428
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3429
|
+
spine_path_ref: resultPackage.source_ref
|
|
3430
|
+
});
|
|
3431
|
+
if (!payload) {
|
|
3432
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3433
|
+
return;
|
|
3434
|
+
}
|
|
3435
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3436
|
+
if (result.status !== 200) {
|
|
3437
|
+
sendJson(res, result.status, result.payload);
|
|
3438
|
+
return;
|
|
3439
|
+
}
|
|
3440
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3441
|
+
sendJson(res, 200, buildPreparedContinuationDefaultExecutionContractSummary(portableHandoff, continuation));
|
|
3442
|
+
return;
|
|
3443
|
+
}
|
|
3444
|
+
|
|
3445
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/operating-contract-summary") {
|
|
3446
|
+
const body = await readJsonBody(req);
|
|
3447
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3448
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3449
|
+
if (!continuation) {
|
|
3450
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3451
|
+
return;
|
|
3452
|
+
}
|
|
3453
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3454
|
+
if (!resultPackage) {
|
|
3455
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3456
|
+
return;
|
|
3457
|
+
}
|
|
3458
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3459
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3460
|
+
spine_path_ref: resultPackage.source_ref
|
|
3461
|
+
});
|
|
3462
|
+
if (!payload) {
|
|
3463
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3464
|
+
return;
|
|
3465
|
+
}
|
|
3466
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3467
|
+
if (result.status !== 200) {
|
|
3468
|
+
sendJson(res, result.status, result.payload);
|
|
3469
|
+
return;
|
|
3470
|
+
}
|
|
3471
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3472
|
+
sendJson(res, 200, buildPreparedContinuationAdapterStableOperatingContractSummary(portableHandoff, continuation));
|
|
3473
|
+
return;
|
|
3474
|
+
}
|
|
3475
|
+
|
|
3476
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/operating-contract-bundle") {
|
|
3477
|
+
const body = await readJsonBody(req);
|
|
3478
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3479
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3480
|
+
if (!continuation) {
|
|
3481
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3482
|
+
return;
|
|
3483
|
+
}
|
|
3484
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3485
|
+
if (!resultPackage) {
|
|
3486
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3487
|
+
return;
|
|
3488
|
+
}
|
|
3489
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3490
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3491
|
+
spine_path_ref: resultPackage.source_ref
|
|
3492
|
+
});
|
|
3493
|
+
if (!payload) {
|
|
3494
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3495
|
+
return;
|
|
3496
|
+
}
|
|
3497
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3498
|
+
if (result.status !== 200) {
|
|
3499
|
+
sendJson(res, result.status, result.payload);
|
|
3500
|
+
return;
|
|
3501
|
+
}
|
|
3502
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3503
|
+
sendJson(res, 200, buildPreparedContinuationAdapterStableOperatingContractBundle(portableHandoff, continuation));
|
|
3504
|
+
return;
|
|
3505
|
+
}
|
|
3506
|
+
|
|
3507
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/operating-contract-default-summary") {
|
|
3508
|
+
const body = await readJsonBody(req);
|
|
3509
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3510
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3511
|
+
if (!continuation) {
|
|
3512
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3513
|
+
return;
|
|
3514
|
+
}
|
|
3515
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3516
|
+
if (!resultPackage) {
|
|
3517
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3518
|
+
return;
|
|
3519
|
+
}
|
|
3520
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3521
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3522
|
+
spine_path_ref: resultPackage.source_ref
|
|
3523
|
+
});
|
|
3524
|
+
if (!payload) {
|
|
3525
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3526
|
+
return;
|
|
3527
|
+
}
|
|
3528
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3529
|
+
if (result.status !== 200) {
|
|
3530
|
+
sendJson(res, result.status, result.payload);
|
|
3531
|
+
return;
|
|
3532
|
+
}
|
|
3533
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3534
|
+
sendJson(res, 200, buildPreparedContinuationDefaultOperatingContractSummary(portableHandoff, continuation));
|
|
3535
|
+
return;
|
|
3536
|
+
}
|
|
3537
|
+
|
|
3248
3538
|
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/contract-template") {
|
|
3249
3539
|
const body = await readJsonBody(req);
|
|
3250
3540
|
const continuationRef = String(body && body.continuation_ref || "").trim();
|