xytara 1.24.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 +9 -0
- package/index.js +1 -1
- package/lib/commerce_client.js +48 -0
- package/package.json +1 -1
- package/server.js +145 -0
package/README.md
CHANGED
|
@@ -244,6 +244,15 @@ The current `1.24.0` line starts turning that adapter-integrable operating path
|
|
|
244
244
|
|
|
245
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
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
|
+
|
|
247
256
|
## Package Surface
|
|
248
257
|
|
|
249
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
|
@@ -4968,6 +4968,54 @@ class CommerceClient {
|
|
|
4968
4968
|
});
|
|
4969
4969
|
}
|
|
4970
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
|
+
|
|
4971
5019
|
async runNamedTaskRoute(path, payload) {
|
|
4972
5020
|
if (!this.apiKey || !this.walletId || !this.walletSecret) {
|
|
4973
5021
|
throw new Error("named task routes require apiKey, walletId, and walletSecret");
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -1880,6 +1880,58 @@ function buildPreparedContinuationDefaultOperatingPathRunSummary(portableHandoff
|
|
|
1880
1880
|
};
|
|
1881
1881
|
}
|
|
1882
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
|
+
|
|
1883
1935
|
function buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation) {
|
|
1884
1936
|
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1885
1937
|
return {
|
|
@@ -3970,6 +4022,99 @@ async function routeRequest(req, res) {
|
|
|
3970
4022
|
return;
|
|
3971
4023
|
}
|
|
3972
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
|
+
|
|
3973
4118
|
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/contract-template") {
|
|
3974
4119
|
const body = await readJsonBody(req);
|
|
3975
4120
|
const continuationRef = String(body && body.continuation_ref || "").trim();
|