xytara 1.23.0 → 1.25.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
|
@@ -235,6 +235,24 @@ The current `1.23.0` line starts turning that adapter-reliable operating interfa
|
|
|
235
235
|
|
|
236
236
|
This is intended to make the transaction-side continuation path easier to plug into adapters directly as a durable public operating path instead of only a reliable interface shape.
|
|
237
237
|
|
|
238
|
+
The current `1.24.0` line starts turning that adapter-integrable operating path into a clearer adapter-ready default path:
|
|
239
|
+
|
|
240
|
+
- operating-path summaries on top of the default operating-integration path
|
|
241
|
+
- compact operating-path bundles for direct adapter-facing default-path posture
|
|
242
|
+
- default operating-path summaries for the next proof-side operating-path run posture
|
|
243
|
+
- clearer operating-path ids and stable default-path carry
|
|
244
|
+
|
|
245
|
+
This is intended to make the transaction-side continuation path easier to use as the obvious first public adapter path instead of only a path that is integrable with a little extra coordination.
|
|
246
|
+
|
|
247
|
+
The current `1.25.0` line starts turning that adapter-ready default path into a clearer adapter-complete default path:
|
|
248
|
+
|
|
249
|
+
- complete-default-path summaries on top of the default operating-path path
|
|
250
|
+
- compact complete-default-path bundles for direct adapter-facing complete-path posture
|
|
251
|
+
- default complete-default-path summaries for the next proof-side complete-default-path run posture
|
|
252
|
+
- clearer complete-default-path ids and stable complete-path carry
|
|
253
|
+
|
|
254
|
+
This is intended to make the transaction-side continuation path easier to adopt as the complete public default path an outside builder can use without needing private interpretation.
|
|
255
|
+
|
|
238
256
|
## Package Surface
|
|
239
257
|
|
|
240
258
|
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
|
@@ -4920,6 +4920,102 @@ class CommerceClient {
|
|
|
4920
4920
|
});
|
|
4921
4921
|
}
|
|
4922
4922
|
|
|
4923
|
+
async prepareInteractionResultPackageOperatingPathSummary(continuationRef, body, options) {
|
|
4924
|
+
const opts = options || {};
|
|
4925
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/operating-path-summary", {
|
|
4926
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.operating.path.summary",
|
|
4927
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4928
|
+
body: body || {},
|
|
4929
|
+
callback_url: opts.callbackUrl || null,
|
|
4930
|
+
settlement_mode: opts.settlementMode || null,
|
|
4931
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4932
|
+
protocol: opts.protocol || null,
|
|
4933
|
+
integration_id: opts.integrationId || null,
|
|
4934
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4935
|
+
integration_context: opts.integrationContext || null
|
|
4936
|
+
});
|
|
4937
|
+
}
|
|
4938
|
+
|
|
4939
|
+
async prepareInteractionResultPackageOperatingPathBundle(continuationRef, body, options) {
|
|
4940
|
+
const opts = options || {};
|
|
4941
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/operating-path-bundle", {
|
|
4942
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.operating.path.bundle",
|
|
4943
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4944
|
+
body: body || {},
|
|
4945
|
+
callback_url: opts.callbackUrl || null,
|
|
4946
|
+
settlement_mode: opts.settlementMode || null,
|
|
4947
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4948
|
+
protocol: opts.protocol || null,
|
|
4949
|
+
integration_id: opts.integrationId || null,
|
|
4950
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4951
|
+
integration_context: opts.integrationContext || null
|
|
4952
|
+
});
|
|
4953
|
+
}
|
|
4954
|
+
|
|
4955
|
+
async prepareInteractionResultPackageOperatingPathDefaultSummary(continuationRef, body, options) {
|
|
4956
|
+
const opts = options || {};
|
|
4957
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/operating-path-default-summary", {
|
|
4958
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.operating.path.default.summary",
|
|
4959
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4960
|
+
body: body || {},
|
|
4961
|
+
callback_url: opts.callbackUrl || null,
|
|
4962
|
+
settlement_mode: opts.settlementMode || null,
|
|
4963
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4964
|
+
protocol: opts.protocol || null,
|
|
4965
|
+
integration_id: opts.integrationId || null,
|
|
4966
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4967
|
+
integration_context: opts.integrationContext || null
|
|
4968
|
+
});
|
|
4969
|
+
}
|
|
4970
|
+
|
|
4971
|
+
async prepareInteractionResultPackageCompleteDefaultPathSummary(continuationRef, body, options) {
|
|
4972
|
+
const opts = options || {};
|
|
4973
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/complete-default-path-summary", {
|
|
4974
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.complete.default.path.summary",
|
|
4975
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4976
|
+
body: body || {},
|
|
4977
|
+
callback_url: opts.callbackUrl || null,
|
|
4978
|
+
settlement_mode: opts.settlementMode || null,
|
|
4979
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4980
|
+
protocol: opts.protocol || null,
|
|
4981
|
+
integration_id: opts.integrationId || null,
|
|
4982
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4983
|
+
integration_context: opts.integrationContext || null
|
|
4984
|
+
});
|
|
4985
|
+
}
|
|
4986
|
+
|
|
4987
|
+
async prepareInteractionResultPackageCompleteDefaultPathBundle(continuationRef, body, options) {
|
|
4988
|
+
const opts = options || {};
|
|
4989
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/complete-default-path-bundle", {
|
|
4990
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.complete.default.path.bundle",
|
|
4991
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4992
|
+
body: body || {},
|
|
4993
|
+
callback_url: opts.callbackUrl || null,
|
|
4994
|
+
settlement_mode: opts.settlementMode || null,
|
|
4995
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4996
|
+
protocol: opts.protocol || null,
|
|
4997
|
+
integration_id: opts.integrationId || null,
|
|
4998
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4999
|
+
integration_context: opts.integrationContext || null
|
|
5000
|
+
});
|
|
5001
|
+
}
|
|
5002
|
+
|
|
5003
|
+
async prepareInteractionResultPackageCompleteDefaultPathDefaultSummary(continuationRef, body, options) {
|
|
5004
|
+
const opts = options || {};
|
|
5005
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/complete-default-path-default-summary", {
|
|
5006
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.complete.default.path.default.summary",
|
|
5007
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
5008
|
+
body: body || {},
|
|
5009
|
+
callback_url: opts.callbackUrl || null,
|
|
5010
|
+
settlement_mode: opts.settlementMode || null,
|
|
5011
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
5012
|
+
protocol: opts.protocol || null,
|
|
5013
|
+
integration_id: opts.integrationId || null,
|
|
5014
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
5015
|
+
integration_context: opts.integrationContext || null
|
|
5016
|
+
});
|
|
5017
|
+
}
|
|
5018
|
+
|
|
4923
5019
|
async runNamedTaskRoute(path, payload) {
|
|
4924
5020
|
if (!this.apiKey || !this.walletId || !this.walletSecret) {
|
|
4925
5021
|
throw new Error("named task routes require apiKey, walletId, and walletSecret");
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -1828,6 +1828,110 @@ function buildPreparedContinuationDefaultOperatingIntegrationSummary(portableHan
|
|
|
1828
1828
|
};
|
|
1829
1829
|
}
|
|
1830
1830
|
|
|
1831
|
+
function buildPreparedContinuationAdapterDefaultOperatingPathSummary(portableHandoff, continuation) {
|
|
1832
|
+
const operatingIntegration = buildPreparedContinuationDefaultOperatingIntegrationSummary(portableHandoff, continuation);
|
|
1833
|
+
return {
|
|
1834
|
+
ok: operatingIntegration.ok === true,
|
|
1835
|
+
default_operating_integration_ref: operatingIntegration.default_operating_integration_ref || null,
|
|
1836
|
+
operating_path_ref: operatingIntegration.default_operating_integration_ref
|
|
1837
|
+
? `path.${operatingIntegration.default_operating_integration_ref}`
|
|
1838
|
+
: null,
|
|
1839
|
+
default_operating_path_ids: Array.isArray(operatingIntegration.stable_default_operating_integration_ids)
|
|
1840
|
+
? operatingIntegration.stable_default_operating_integration_ids
|
|
1841
|
+
: [],
|
|
1842
|
+
operating_path_carry: operatingIntegration.default_operating_integration_carry || {},
|
|
1843
|
+
adapter_ready_by_default: operatingIntegration.operating_integration_integrable_by_default === true,
|
|
1844
|
+
next_surface: "/v1/proof-center/result-package-handoff/review/operating-path"
|
|
1845
|
+
};
|
|
1846
|
+
}
|
|
1847
|
+
|
|
1848
|
+
function buildPreparedContinuationAdapterDefaultOperatingPathBundle(portableHandoff, continuation) {
|
|
1849
|
+
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1850
|
+
const summary = buildPreparedContinuationAdapterDefaultOperatingPathSummary(portableHandoff, continuation);
|
|
1851
|
+
return {
|
|
1852
|
+
ok: true,
|
|
1853
|
+
operating_path_summary: summary,
|
|
1854
|
+
operating_path_template: {
|
|
1855
|
+
ok: true,
|
|
1856
|
+
operating_path_ref: summary.operating_path_ref || null,
|
|
1857
|
+
target_surface: "/v1/proof-center/result-package-handoff/review/operating-path",
|
|
1858
|
+
request_template: {
|
|
1859
|
+
handoff_bundle: handoff
|
|
1860
|
+
},
|
|
1861
|
+
stable_boundary_ids: Array.isArray(summary.default_operating_path_ids) ? summary.default_operating_path_ids : []
|
|
1862
|
+
}
|
|
1863
|
+
};
|
|
1864
|
+
}
|
|
1865
|
+
|
|
1866
|
+
function buildPreparedContinuationDefaultOperatingPathRunSummary(portableHandoff, continuation) {
|
|
1867
|
+
const operatingPath = buildPreparedContinuationAdapterDefaultOperatingPathSummary(portableHandoff, continuation);
|
|
1868
|
+
return {
|
|
1869
|
+
ok: operatingPath.ok === true,
|
|
1870
|
+
operating_path_ref: operatingPath.operating_path_ref || null,
|
|
1871
|
+
default_operating_path_ref: operatingPath.operating_path_ref
|
|
1872
|
+
? `default.${operatingPath.operating_path_ref}`
|
|
1873
|
+
: null,
|
|
1874
|
+
stable_default_operating_path_ids: Array.isArray(operatingPath.default_operating_path_ids)
|
|
1875
|
+
? operatingPath.default_operating_path_ids
|
|
1876
|
+
: [],
|
|
1877
|
+
default_operating_path_carry: operatingPath.operating_path_carry || {},
|
|
1878
|
+
operating_path_ready_by_default: operatingPath.adapter_ready_by_default === true,
|
|
1879
|
+
next_surface: "/v1/proof-center/result-package-handoff/review/operating-path-run"
|
|
1880
|
+
};
|
|
1881
|
+
}
|
|
1882
|
+
|
|
1883
|
+
function buildPreparedContinuationAdapterCompleteDefaultPathSummary(portableHandoff, continuation) {
|
|
1884
|
+
const operatingPath = buildPreparedContinuationDefaultOperatingPathRunSummary(portableHandoff, continuation);
|
|
1885
|
+
return {
|
|
1886
|
+
ok: operatingPath.ok === true,
|
|
1887
|
+
default_operating_path_ref: operatingPath.default_operating_path_ref || null,
|
|
1888
|
+
complete_default_path_ref: operatingPath.default_operating_path_ref
|
|
1889
|
+
? `complete.${operatingPath.default_operating_path_ref}`
|
|
1890
|
+
: null,
|
|
1891
|
+
complete_default_path_ids: Array.isArray(operatingPath.stable_default_operating_path_ids)
|
|
1892
|
+
? operatingPath.stable_default_operating_path_ids
|
|
1893
|
+
: [],
|
|
1894
|
+
complete_default_path_carry: operatingPath.default_operating_path_carry || {},
|
|
1895
|
+
adapter_complete_by_default: operatingPath.operating_path_ready_by_default === true,
|
|
1896
|
+
next_surface: "/v1/proof-center/result-package-handoff/review/complete-default-path"
|
|
1897
|
+
};
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
function buildPreparedContinuationAdapterCompleteDefaultPathBundle(portableHandoff, continuation) {
|
|
1901
|
+
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1902
|
+
const summary = buildPreparedContinuationAdapterCompleteDefaultPathSummary(portableHandoff, continuation);
|
|
1903
|
+
return {
|
|
1904
|
+
ok: true,
|
|
1905
|
+
complete_default_path_summary: summary,
|
|
1906
|
+
complete_default_path_template: {
|
|
1907
|
+
ok: true,
|
|
1908
|
+
complete_default_path_ref: summary.complete_default_path_ref || null,
|
|
1909
|
+
target_surface: "/v1/proof-center/result-package-handoff/review/complete-default-path",
|
|
1910
|
+
request_template: {
|
|
1911
|
+
handoff_bundle: handoff
|
|
1912
|
+
},
|
|
1913
|
+
stable_boundary_ids: Array.isArray(summary.complete_default_path_ids) ? summary.complete_default_path_ids : []
|
|
1914
|
+
}
|
|
1915
|
+
};
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
function buildPreparedContinuationDefaultCompletePathRunSummary(portableHandoff, continuation) {
|
|
1919
|
+
const completePath = buildPreparedContinuationAdapterCompleteDefaultPathSummary(portableHandoff, continuation);
|
|
1920
|
+
return {
|
|
1921
|
+
ok: completePath.ok === true,
|
|
1922
|
+
complete_default_path_ref: completePath.complete_default_path_ref || null,
|
|
1923
|
+
default_complete_default_path_ref: completePath.complete_default_path_ref
|
|
1924
|
+
? `default.${completePath.complete_default_path_ref}`
|
|
1925
|
+
: null,
|
|
1926
|
+
stable_default_complete_default_path_ids: Array.isArray(completePath.complete_default_path_ids)
|
|
1927
|
+
? completePath.complete_default_path_ids
|
|
1928
|
+
: [],
|
|
1929
|
+
default_complete_default_path_carry: completePath.complete_default_path_carry || {},
|
|
1930
|
+
complete_default_path_ready: completePath.adapter_complete_by_default === true,
|
|
1931
|
+
next_surface: "/v1/proof-center/result-package-handoff/review/complete-default-path-run"
|
|
1932
|
+
};
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1831
1935
|
function buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation) {
|
|
1832
1936
|
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1833
1937
|
return {
|
|
@@ -3825,6 +3929,192 @@ async function routeRequest(req, res) {
|
|
|
3825
3929
|
return;
|
|
3826
3930
|
}
|
|
3827
3931
|
|
|
3932
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/operating-path-summary") {
|
|
3933
|
+
const body = await readJsonBody(req);
|
|
3934
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3935
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3936
|
+
if (!continuation) {
|
|
3937
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3938
|
+
return;
|
|
3939
|
+
}
|
|
3940
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3941
|
+
if (!resultPackage) {
|
|
3942
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3943
|
+
return;
|
|
3944
|
+
}
|
|
3945
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3946
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3947
|
+
spine_path_ref: resultPackage.source_ref
|
|
3948
|
+
});
|
|
3949
|
+
if (!payload) {
|
|
3950
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3951
|
+
return;
|
|
3952
|
+
}
|
|
3953
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3954
|
+
if (result.status !== 200) {
|
|
3955
|
+
sendJson(res, result.status, result.payload);
|
|
3956
|
+
return;
|
|
3957
|
+
}
|
|
3958
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3959
|
+
sendJson(res, 200, buildPreparedContinuationAdapterDefaultOperatingPathSummary(portableHandoff, continuation));
|
|
3960
|
+
return;
|
|
3961
|
+
}
|
|
3962
|
+
|
|
3963
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/operating-path-bundle") {
|
|
3964
|
+
const body = await readJsonBody(req);
|
|
3965
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3966
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3967
|
+
if (!continuation) {
|
|
3968
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3969
|
+
return;
|
|
3970
|
+
}
|
|
3971
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3972
|
+
if (!resultPackage) {
|
|
3973
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3974
|
+
return;
|
|
3975
|
+
}
|
|
3976
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3977
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3978
|
+
spine_path_ref: resultPackage.source_ref
|
|
3979
|
+
});
|
|
3980
|
+
if (!payload) {
|
|
3981
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3982
|
+
return;
|
|
3983
|
+
}
|
|
3984
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3985
|
+
if (result.status !== 200) {
|
|
3986
|
+
sendJson(res, result.status, result.payload);
|
|
3987
|
+
return;
|
|
3988
|
+
}
|
|
3989
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3990
|
+
sendJson(res, 200, buildPreparedContinuationAdapterDefaultOperatingPathBundle(portableHandoff, continuation));
|
|
3991
|
+
return;
|
|
3992
|
+
}
|
|
3993
|
+
|
|
3994
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/operating-path-default-summary") {
|
|
3995
|
+
const body = await readJsonBody(req);
|
|
3996
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3997
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3998
|
+
if (!continuation) {
|
|
3999
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
4000
|
+
return;
|
|
4001
|
+
}
|
|
4002
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
4003
|
+
if (!resultPackage) {
|
|
4004
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
4005
|
+
return;
|
|
4006
|
+
}
|
|
4007
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
4008
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
4009
|
+
spine_path_ref: resultPackage.source_ref
|
|
4010
|
+
});
|
|
4011
|
+
if (!payload) {
|
|
4012
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
4013
|
+
return;
|
|
4014
|
+
}
|
|
4015
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
4016
|
+
if (result.status !== 200) {
|
|
4017
|
+
sendJson(res, result.status, result.payload);
|
|
4018
|
+
return;
|
|
4019
|
+
}
|
|
4020
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
4021
|
+
sendJson(res, 200, buildPreparedContinuationDefaultOperatingPathRunSummary(portableHandoff, continuation));
|
|
4022
|
+
return;
|
|
4023
|
+
}
|
|
4024
|
+
|
|
4025
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/complete-default-path-summary") {
|
|
4026
|
+
const body = await readJsonBody(req);
|
|
4027
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
4028
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
4029
|
+
if (!continuation) {
|
|
4030
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
4031
|
+
return;
|
|
4032
|
+
}
|
|
4033
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
4034
|
+
if (!resultPackage) {
|
|
4035
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
4036
|
+
return;
|
|
4037
|
+
}
|
|
4038
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
4039
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
4040
|
+
spine_path_ref: resultPackage.source_ref
|
|
4041
|
+
});
|
|
4042
|
+
if (!payload) {
|
|
4043
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
4044
|
+
return;
|
|
4045
|
+
}
|
|
4046
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
4047
|
+
if (result.status !== 200) {
|
|
4048
|
+
sendJson(res, result.status, result.payload);
|
|
4049
|
+
return;
|
|
4050
|
+
}
|
|
4051
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
4052
|
+
sendJson(res, 200, buildPreparedContinuationAdapterCompleteDefaultPathSummary(portableHandoff, continuation));
|
|
4053
|
+
return;
|
|
4054
|
+
}
|
|
4055
|
+
|
|
4056
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/complete-default-path-bundle") {
|
|
4057
|
+
const body = await readJsonBody(req);
|
|
4058
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
4059
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
4060
|
+
if (!continuation) {
|
|
4061
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
4062
|
+
return;
|
|
4063
|
+
}
|
|
4064
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
4065
|
+
if (!resultPackage) {
|
|
4066
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
4067
|
+
return;
|
|
4068
|
+
}
|
|
4069
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
4070
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
4071
|
+
spine_path_ref: resultPackage.source_ref
|
|
4072
|
+
});
|
|
4073
|
+
if (!payload) {
|
|
4074
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
4075
|
+
return;
|
|
4076
|
+
}
|
|
4077
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
4078
|
+
if (result.status !== 200) {
|
|
4079
|
+
sendJson(res, result.status, result.payload);
|
|
4080
|
+
return;
|
|
4081
|
+
}
|
|
4082
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
4083
|
+
sendJson(res, 200, buildPreparedContinuationAdapterCompleteDefaultPathBundle(portableHandoff, continuation));
|
|
4084
|
+
return;
|
|
4085
|
+
}
|
|
4086
|
+
|
|
4087
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/complete-default-path-default-summary") {
|
|
4088
|
+
const body = await readJsonBody(req);
|
|
4089
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
4090
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
4091
|
+
if (!continuation) {
|
|
4092
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
4093
|
+
return;
|
|
4094
|
+
}
|
|
4095
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
4096
|
+
if (!resultPackage) {
|
|
4097
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
4098
|
+
return;
|
|
4099
|
+
}
|
|
4100
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
4101
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
4102
|
+
spine_path_ref: resultPackage.source_ref
|
|
4103
|
+
});
|
|
4104
|
+
if (!payload) {
|
|
4105
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
4106
|
+
return;
|
|
4107
|
+
}
|
|
4108
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
4109
|
+
if (result.status !== 200) {
|
|
4110
|
+
sendJson(res, result.status, result.payload);
|
|
4111
|
+
return;
|
|
4112
|
+
}
|
|
4113
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
4114
|
+
sendJson(res, 200, buildPreparedContinuationDefaultCompletePathRunSummary(portableHandoff, continuation));
|
|
4115
|
+
return;
|
|
4116
|
+
}
|
|
4117
|
+
|
|
3828
4118
|
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/contract-template") {
|
|
3829
4119
|
const body = await readJsonBody(req);
|
|
3830
4120
|
const continuationRef = String(body && body.continuation_ref || "").trim();
|