xytara 1.17.0 → 1.19.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 +294 -0
package/README.md
CHANGED
|
@@ -181,6 +181,24 @@ The current `1.17.0` line starts turning that stable handoff contract into a cle
|
|
|
181
181
|
|
|
182
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
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
|
+
|
|
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
|
+
|
|
184
202
|
## Package Surface
|
|
185
203
|
|
|
186
204
|
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
|
@@ -4632,6 +4632,102 @@ class CommerceClient {
|
|
|
4632
4632
|
});
|
|
4633
4633
|
}
|
|
4634
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
|
+
|
|
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
|
+
|
|
4635
4731
|
async runNamedTaskRoute(path, payload) {
|
|
4636
4732
|
if (!this.apiKey || !this.walletId || !this.walletSecret) {
|
|
4637
4733
|
throw new Error("named task routes require apiKey, walletId, and walletSecret");
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -1512,6 +1512,114 @@ function buildPreparedContinuationAdapterConsumableHandoffBundle(portableHandoff
|
|
|
1512
1512
|
};
|
|
1513
1513
|
}
|
|
1514
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
|
+
|
|
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
|
+
|
|
1515
1623
|
function buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation) {
|
|
1516
1624
|
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1517
1625
|
return {
|
|
@@ -2951,6 +3059,192 @@ async function routeRequest(req, res) {
|
|
|
2951
3059
|
return;
|
|
2952
3060
|
}
|
|
2953
3061
|
|
|
3062
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-package-summary") {
|
|
3063
|
+
const body = await readJsonBody(req);
|
|
3064
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3065
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3066
|
+
if (!continuation) {
|
|
3067
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3068
|
+
return;
|
|
3069
|
+
}
|
|
3070
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3071
|
+
if (!resultPackage) {
|
|
3072
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3073
|
+
return;
|
|
3074
|
+
}
|
|
3075
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3076
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3077
|
+
spine_path_ref: resultPackage.source_ref
|
|
3078
|
+
});
|
|
3079
|
+
if (!payload) {
|
|
3080
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3081
|
+
return;
|
|
3082
|
+
}
|
|
3083
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3084
|
+
if (result.status !== 200) {
|
|
3085
|
+
sendJson(res, result.status, result.payload);
|
|
3086
|
+
return;
|
|
3087
|
+
}
|
|
3088
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3089
|
+
sendJson(res, 200, buildPreparedContinuationAdapterUsableHandoffPackageSummary(portableHandoff, continuation));
|
|
3090
|
+
return;
|
|
3091
|
+
}
|
|
3092
|
+
|
|
3093
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-package-bundle") {
|
|
3094
|
+
const body = await readJsonBody(req);
|
|
3095
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3096
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3097
|
+
if (!continuation) {
|
|
3098
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3099
|
+
return;
|
|
3100
|
+
}
|
|
3101
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3102
|
+
if (!resultPackage) {
|
|
3103
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3104
|
+
return;
|
|
3105
|
+
}
|
|
3106
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3107
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3108
|
+
spine_path_ref: resultPackage.source_ref
|
|
3109
|
+
});
|
|
3110
|
+
if (!payload) {
|
|
3111
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3112
|
+
return;
|
|
3113
|
+
}
|
|
3114
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3115
|
+
if (result.status !== 200) {
|
|
3116
|
+
sendJson(res, result.status, result.payload);
|
|
3117
|
+
return;
|
|
3118
|
+
}
|
|
3119
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3120
|
+
sendJson(res, 200, buildPreparedContinuationAdapterUsableHandoffPackageBundle(portableHandoff, continuation));
|
|
3121
|
+
return;
|
|
3122
|
+
}
|
|
3123
|
+
|
|
3124
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-package-default-summary") {
|
|
3125
|
+
const body = await readJsonBody(req);
|
|
3126
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3127
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3128
|
+
if (!continuation) {
|
|
3129
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3130
|
+
return;
|
|
3131
|
+
}
|
|
3132
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3133
|
+
if (!resultPackage) {
|
|
3134
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3135
|
+
return;
|
|
3136
|
+
}
|
|
3137
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3138
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3139
|
+
spine_path_ref: resultPackage.source_ref
|
|
3140
|
+
});
|
|
3141
|
+
if (!payload) {
|
|
3142
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3143
|
+
return;
|
|
3144
|
+
}
|
|
3145
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3146
|
+
if (result.status !== 200) {
|
|
3147
|
+
sendJson(res, result.status, result.payload);
|
|
3148
|
+
return;
|
|
3149
|
+
}
|
|
3150
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3151
|
+
sendJson(res, 200, buildPreparedContinuationDefaultUsableHandoffPackageSummary(portableHandoff, continuation));
|
|
3152
|
+
return;
|
|
3153
|
+
}
|
|
3154
|
+
|
|
3155
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/execution-package-summary") {
|
|
3156
|
+
const body = await readJsonBody(req);
|
|
3157
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3158
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3159
|
+
if (!continuation) {
|
|
3160
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3161
|
+
return;
|
|
3162
|
+
}
|
|
3163
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3164
|
+
if (!resultPackage) {
|
|
3165
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3166
|
+
return;
|
|
3167
|
+
}
|
|
3168
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3169
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3170
|
+
spine_path_ref: resultPackage.source_ref
|
|
3171
|
+
});
|
|
3172
|
+
if (!payload) {
|
|
3173
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3174
|
+
return;
|
|
3175
|
+
}
|
|
3176
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3177
|
+
if (result.status !== 200) {
|
|
3178
|
+
sendJson(res, result.status, result.payload);
|
|
3179
|
+
return;
|
|
3180
|
+
}
|
|
3181
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3182
|
+
sendJson(res, 200, buildPreparedContinuationAdapterReadyExecutionPackageSummary(portableHandoff, continuation));
|
|
3183
|
+
return;
|
|
3184
|
+
}
|
|
3185
|
+
|
|
3186
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/execution-package-bundle") {
|
|
3187
|
+
const body = await readJsonBody(req);
|
|
3188
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3189
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3190
|
+
if (!continuation) {
|
|
3191
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3192
|
+
return;
|
|
3193
|
+
}
|
|
3194
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3195
|
+
if (!resultPackage) {
|
|
3196
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3197
|
+
return;
|
|
3198
|
+
}
|
|
3199
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3200
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3201
|
+
spine_path_ref: resultPackage.source_ref
|
|
3202
|
+
});
|
|
3203
|
+
if (!payload) {
|
|
3204
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3205
|
+
return;
|
|
3206
|
+
}
|
|
3207
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3208
|
+
if (result.status !== 200) {
|
|
3209
|
+
sendJson(res, result.status, result.payload);
|
|
3210
|
+
return;
|
|
3211
|
+
}
|
|
3212
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3213
|
+
sendJson(res, 200, buildPreparedContinuationAdapterReadyExecutionPackageBundle(portableHandoff, continuation));
|
|
3214
|
+
return;
|
|
3215
|
+
}
|
|
3216
|
+
|
|
3217
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/execution-package-default-summary") {
|
|
3218
|
+
const body = await readJsonBody(req);
|
|
3219
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3220
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3221
|
+
if (!continuation) {
|
|
3222
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3223
|
+
return;
|
|
3224
|
+
}
|
|
3225
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3226
|
+
if (!resultPackage) {
|
|
3227
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3228
|
+
return;
|
|
3229
|
+
}
|
|
3230
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3231
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3232
|
+
spine_path_ref: resultPackage.source_ref
|
|
3233
|
+
});
|
|
3234
|
+
if (!payload) {
|
|
3235
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3236
|
+
return;
|
|
3237
|
+
}
|
|
3238
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3239
|
+
if (result.status !== 200) {
|
|
3240
|
+
sendJson(res, result.status, result.payload);
|
|
3241
|
+
return;
|
|
3242
|
+
}
|
|
3243
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3244
|
+
sendJson(res, 200, buildPreparedContinuationDefaultExecutionPackageSummary(portableHandoff, continuation));
|
|
3245
|
+
return;
|
|
3246
|
+
}
|
|
3247
|
+
|
|
2954
3248
|
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/contract-template") {
|
|
2955
3249
|
const body = await readJsonBody(req);
|
|
2956
3250
|
const continuationRef = String(body && body.continuation_ref || "").trim();
|