xytara 1.18.0 → 1.20.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
|
@@ -190,6 +190,24 @@ The current `1.18.0` line starts turning that adapter-consumable handoff surface
|
|
|
190
190
|
|
|
191
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
192
|
|
|
193
|
+
The current `1.19.0` line starts turning that adapter-usable handoff package into a clearer adapter-ready execution package:
|
|
194
|
+
|
|
195
|
+
- execution-package summaries on top of the default handoff-package path
|
|
196
|
+
- compact execution-package bundles for direct adapter-facing execution posture
|
|
197
|
+
- default execution-package summaries for the next proof-side execution run posture
|
|
198
|
+
- clearer execution-package ids and stable execution-ready carry
|
|
199
|
+
|
|
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
|
+
|
|
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
|
+
|
|
193
211
|
## Package Surface
|
|
194
212
|
|
|
195
213
|
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
|
@@ -4680,6 +4680,102 @@ class CommerceClient {
|
|
|
4680
4680
|
});
|
|
4681
4681
|
}
|
|
4682
4682
|
|
|
4683
|
+
async prepareInteractionResultPackageExecutionPackageSummary(continuationRef, body, options) {
|
|
4684
|
+
const opts = options || {};
|
|
4685
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/execution-package-summary", {
|
|
4686
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.execution.package.summary",
|
|
4687
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4688
|
+
body: body || {},
|
|
4689
|
+
callback_url: opts.callbackUrl || null,
|
|
4690
|
+
settlement_mode: opts.settlementMode || null,
|
|
4691
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4692
|
+
protocol: opts.protocol || null,
|
|
4693
|
+
integration_id: opts.integrationId || null,
|
|
4694
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4695
|
+
integration_context: opts.integrationContext || null
|
|
4696
|
+
});
|
|
4697
|
+
}
|
|
4698
|
+
|
|
4699
|
+
async prepareInteractionResultPackageExecutionPackageBundle(continuationRef, body, options) {
|
|
4700
|
+
const opts = options || {};
|
|
4701
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/execution-package-bundle", {
|
|
4702
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.execution.package.bundle",
|
|
4703
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4704
|
+
body: body || {},
|
|
4705
|
+
callback_url: opts.callbackUrl || null,
|
|
4706
|
+
settlement_mode: opts.settlementMode || null,
|
|
4707
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4708
|
+
protocol: opts.protocol || null,
|
|
4709
|
+
integration_id: opts.integrationId || null,
|
|
4710
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4711
|
+
integration_context: opts.integrationContext || null
|
|
4712
|
+
});
|
|
4713
|
+
}
|
|
4714
|
+
|
|
4715
|
+
async prepareInteractionResultPackageExecutionPackageDefaultSummary(continuationRef, body, options) {
|
|
4716
|
+
const opts = options || {};
|
|
4717
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/execution-package-default-summary", {
|
|
4718
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.execution.package.default.summary",
|
|
4719
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4720
|
+
body: body || {},
|
|
4721
|
+
callback_url: opts.callbackUrl || null,
|
|
4722
|
+
settlement_mode: opts.settlementMode || null,
|
|
4723
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4724
|
+
protocol: opts.protocol || null,
|
|
4725
|
+
integration_id: opts.integrationId || null,
|
|
4726
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4727
|
+
integration_context: opts.integrationContext || null
|
|
4728
|
+
});
|
|
4729
|
+
}
|
|
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
|
+
|
|
4683
4779
|
async runNamedTaskRoute(path, payload) {
|
|
4684
4780
|
if (!this.apiKey || !this.walletId || !this.walletSecret) {
|
|
4685
4781
|
throw new Error("named task routes require apiKey, walletId, and walletSecret");
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -1568,6 +1568,110 @@ function buildPreparedContinuationDefaultUsableHandoffPackageSummary(portableHan
|
|
|
1568
1568
|
};
|
|
1569
1569
|
}
|
|
1570
1570
|
|
|
1571
|
+
function buildPreparedContinuationAdapterReadyExecutionPackageSummary(portableHandoff, continuation) {
|
|
1572
|
+
const handoffPackage = buildPreparedContinuationDefaultUsableHandoffPackageSummary(portableHandoff, continuation);
|
|
1573
|
+
return {
|
|
1574
|
+
ok: handoffPackage.ok === true,
|
|
1575
|
+
default_handoff_package_ref: handoffPackage.default_handoff_package_ref || null,
|
|
1576
|
+
execution_package_ref: handoffPackage.default_handoff_package_ref
|
|
1577
|
+
? `execution.${handoffPackage.default_handoff_package_ref}`
|
|
1578
|
+
: null,
|
|
1579
|
+
stable_execution_package_ids: Array.isArray(handoffPackage.stable_default_handoff_package_ids)
|
|
1580
|
+
? handoffPackage.stable_default_handoff_package_ids
|
|
1581
|
+
: [],
|
|
1582
|
+
execution_package_carry: handoffPackage.default_usable_handoff_package_carry || {},
|
|
1583
|
+
adapter_ready: handoffPackage.package_usable_by_default === true,
|
|
1584
|
+
next_surface: "/v1/proof-center/result-package-handoff/review/execution-package"
|
|
1585
|
+
};
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
function buildPreparedContinuationAdapterReadyExecutionPackageBundle(portableHandoff, continuation) {
|
|
1589
|
+
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1590
|
+
const summary = buildPreparedContinuationAdapterReadyExecutionPackageSummary(portableHandoff, continuation);
|
|
1591
|
+
return {
|
|
1592
|
+
ok: true,
|
|
1593
|
+
execution_package_summary: summary,
|
|
1594
|
+
execution_package_template: {
|
|
1595
|
+
ok: true,
|
|
1596
|
+
execution_package_ref: summary.execution_package_ref || null,
|
|
1597
|
+
target_surface: "/v1/proof-center/result-package-handoff/review/execution-package",
|
|
1598
|
+
request_template: {
|
|
1599
|
+
handoff_bundle: handoff
|
|
1600
|
+
},
|
|
1601
|
+
stable_boundary_ids: Array.isArray(summary.stable_execution_package_ids) ? summary.stable_execution_package_ids : []
|
|
1602
|
+
}
|
|
1603
|
+
};
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
function buildPreparedContinuationDefaultExecutionPackageSummary(portableHandoff, continuation) {
|
|
1607
|
+
const executionPackage = buildPreparedContinuationAdapterReadyExecutionPackageSummary(portableHandoff, continuation);
|
|
1608
|
+
return {
|
|
1609
|
+
ok: executionPackage.ok === true,
|
|
1610
|
+
execution_package_ref: executionPackage.execution_package_ref || null,
|
|
1611
|
+
default_execution_package_ref: executionPackage.execution_package_ref
|
|
1612
|
+
? `default.${executionPackage.execution_package_ref}`
|
|
1613
|
+
: null,
|
|
1614
|
+
stable_default_execution_package_ids: Array.isArray(executionPackage.stable_execution_package_ids)
|
|
1615
|
+
? executionPackage.stable_execution_package_ids
|
|
1616
|
+
: [],
|
|
1617
|
+
default_execution_package_carry: executionPackage.execution_package_carry || {},
|
|
1618
|
+
execution_ready_by_default: executionPackage.adapter_ready === true,
|
|
1619
|
+
next_surface: "/v1/proof-center/result-package-handoff/review/execution-package-run"
|
|
1620
|
+
};
|
|
1621
|
+
}
|
|
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
|
+
|
|
1571
1675
|
function buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation) {
|
|
1572
1676
|
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1573
1677
|
return {
|
|
@@ -3100,6 +3204,192 @@ async function routeRequest(req, res) {
|
|
|
3100
3204
|
return;
|
|
3101
3205
|
}
|
|
3102
3206
|
|
|
3207
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/execution-package-summary") {
|
|
3208
|
+
const body = await readJsonBody(req);
|
|
3209
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3210
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3211
|
+
if (!continuation) {
|
|
3212
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3213
|
+
return;
|
|
3214
|
+
}
|
|
3215
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3216
|
+
if (!resultPackage) {
|
|
3217
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3218
|
+
return;
|
|
3219
|
+
}
|
|
3220
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3221
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3222
|
+
spine_path_ref: resultPackage.source_ref
|
|
3223
|
+
});
|
|
3224
|
+
if (!payload) {
|
|
3225
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3226
|
+
return;
|
|
3227
|
+
}
|
|
3228
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3229
|
+
if (result.status !== 200) {
|
|
3230
|
+
sendJson(res, result.status, result.payload);
|
|
3231
|
+
return;
|
|
3232
|
+
}
|
|
3233
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3234
|
+
sendJson(res, 200, buildPreparedContinuationAdapterReadyExecutionPackageSummary(portableHandoff, continuation));
|
|
3235
|
+
return;
|
|
3236
|
+
}
|
|
3237
|
+
|
|
3238
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/execution-package-bundle") {
|
|
3239
|
+
const body = await readJsonBody(req);
|
|
3240
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3241
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3242
|
+
if (!continuation) {
|
|
3243
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3244
|
+
return;
|
|
3245
|
+
}
|
|
3246
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3247
|
+
if (!resultPackage) {
|
|
3248
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3249
|
+
return;
|
|
3250
|
+
}
|
|
3251
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3252
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3253
|
+
spine_path_ref: resultPackage.source_ref
|
|
3254
|
+
});
|
|
3255
|
+
if (!payload) {
|
|
3256
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3257
|
+
return;
|
|
3258
|
+
}
|
|
3259
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3260
|
+
if (result.status !== 200) {
|
|
3261
|
+
sendJson(res, result.status, result.payload);
|
|
3262
|
+
return;
|
|
3263
|
+
}
|
|
3264
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3265
|
+
sendJson(res, 200, buildPreparedContinuationAdapterReadyExecutionPackageBundle(portableHandoff, continuation));
|
|
3266
|
+
return;
|
|
3267
|
+
}
|
|
3268
|
+
|
|
3269
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/execution-package-default-summary") {
|
|
3270
|
+
const body = await readJsonBody(req);
|
|
3271
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3272
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3273
|
+
if (!continuation) {
|
|
3274
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3275
|
+
return;
|
|
3276
|
+
}
|
|
3277
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3278
|
+
if (!resultPackage) {
|
|
3279
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3280
|
+
return;
|
|
3281
|
+
}
|
|
3282
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3283
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3284
|
+
spine_path_ref: resultPackage.source_ref
|
|
3285
|
+
});
|
|
3286
|
+
if (!payload) {
|
|
3287
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3288
|
+
return;
|
|
3289
|
+
}
|
|
3290
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3291
|
+
if (result.status !== 200) {
|
|
3292
|
+
sendJson(res, result.status, result.payload);
|
|
3293
|
+
return;
|
|
3294
|
+
}
|
|
3295
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3296
|
+
sendJson(res, 200, buildPreparedContinuationDefaultExecutionPackageSummary(portableHandoff, continuation));
|
|
3297
|
+
return;
|
|
3298
|
+
}
|
|
3299
|
+
|
|
3300
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/execution-contract-summary") {
|
|
3301
|
+
const body = await readJsonBody(req);
|
|
3302
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3303
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3304
|
+
if (!continuation) {
|
|
3305
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3306
|
+
return;
|
|
3307
|
+
}
|
|
3308
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3309
|
+
if (!resultPackage) {
|
|
3310
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3311
|
+
return;
|
|
3312
|
+
}
|
|
3313
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3314
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3315
|
+
spine_path_ref: resultPackage.source_ref
|
|
3316
|
+
});
|
|
3317
|
+
if (!payload) {
|
|
3318
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3319
|
+
return;
|
|
3320
|
+
}
|
|
3321
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3322
|
+
if (result.status !== 200) {
|
|
3323
|
+
sendJson(res, result.status, result.payload);
|
|
3324
|
+
return;
|
|
3325
|
+
}
|
|
3326
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3327
|
+
sendJson(res, 200, buildPreparedContinuationAdapterOperableExecutionContractSummary(portableHandoff, continuation));
|
|
3328
|
+
return;
|
|
3329
|
+
}
|
|
3330
|
+
|
|
3331
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/execution-contract-bundle") {
|
|
3332
|
+
const body = await readJsonBody(req);
|
|
3333
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3334
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3335
|
+
if (!continuation) {
|
|
3336
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3337
|
+
return;
|
|
3338
|
+
}
|
|
3339
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3340
|
+
if (!resultPackage) {
|
|
3341
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3342
|
+
return;
|
|
3343
|
+
}
|
|
3344
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3345
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3346
|
+
spine_path_ref: resultPackage.source_ref
|
|
3347
|
+
});
|
|
3348
|
+
if (!payload) {
|
|
3349
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3350
|
+
return;
|
|
3351
|
+
}
|
|
3352
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3353
|
+
if (result.status !== 200) {
|
|
3354
|
+
sendJson(res, result.status, result.payload);
|
|
3355
|
+
return;
|
|
3356
|
+
}
|
|
3357
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3358
|
+
sendJson(res, 200, buildPreparedContinuationAdapterOperableExecutionContractBundle(portableHandoff, continuation));
|
|
3359
|
+
return;
|
|
3360
|
+
}
|
|
3361
|
+
|
|
3362
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/execution-contract-default-summary") {
|
|
3363
|
+
const body = await readJsonBody(req);
|
|
3364
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3365
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3366
|
+
if (!continuation) {
|
|
3367
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3368
|
+
return;
|
|
3369
|
+
}
|
|
3370
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3371
|
+
if (!resultPackage) {
|
|
3372
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3373
|
+
return;
|
|
3374
|
+
}
|
|
3375
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3376
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3377
|
+
spine_path_ref: resultPackage.source_ref
|
|
3378
|
+
});
|
|
3379
|
+
if (!payload) {
|
|
3380
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3381
|
+
return;
|
|
3382
|
+
}
|
|
3383
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3384
|
+
if (result.status !== 200) {
|
|
3385
|
+
sendJson(res, result.status, result.payload);
|
|
3386
|
+
return;
|
|
3387
|
+
}
|
|
3388
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3389
|
+
sendJson(res, 200, buildPreparedContinuationDefaultExecutionContractSummary(portableHandoff, continuation));
|
|
3390
|
+
return;
|
|
3391
|
+
}
|
|
3392
|
+
|
|
3103
3393
|
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/contract-template") {
|
|
3104
3394
|
const body = await readJsonBody(req);
|
|
3105
3395
|
const continuationRef = String(body && body.continuation_ref || "").trim();
|