xytara 1.16.0 → 1.17.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 +136 -0
package/README.md
CHANGED
|
@@ -172,6 +172,15 @@ The current `1.16.0` line starts turning that bridge into a clearer stable publi
|
|
|
172
172
|
|
|
173
173
|
This is intended to make the transaction-side continuation path easier to treat as a stable handoff contract instead of only a well-described bridge.
|
|
174
174
|
|
|
175
|
+
The current `1.17.0` line starts turning that stable handoff contract into a clearer adapter-consumable handoff surface:
|
|
176
|
+
|
|
177
|
+
- adapter-consumable handoff-surface summaries on top of prepared handoff artifacts
|
|
178
|
+
- direct handoff-surface template routes for proof-side intake review
|
|
179
|
+
- compact handoff-surface bundles for direct adapter-facing reuse
|
|
180
|
+
- clearer adapter-facing handoff-surface ids and stable consumable carry
|
|
181
|
+
|
|
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
|
+
|
|
175
184
|
## Package Surface
|
|
176
185
|
|
|
177
186
|
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
|
@@ -4584,6 +4584,54 @@ class CommerceClient {
|
|
|
4584
4584
|
});
|
|
4585
4585
|
}
|
|
4586
4586
|
|
|
4587
|
+
async prepareInteractionResultPackageHandoffSurfaceSummary(continuationRef, body, options) {
|
|
4588
|
+
const opts = options || {};
|
|
4589
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/handoff-surface-summary", {
|
|
4590
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.handoff.surface.summary",
|
|
4591
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4592
|
+
body: body || {},
|
|
4593
|
+
callback_url: opts.callbackUrl || null,
|
|
4594
|
+
settlement_mode: opts.settlementMode || null,
|
|
4595
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4596
|
+
protocol: opts.protocol || null,
|
|
4597
|
+
integration_id: opts.integrationId || null,
|
|
4598
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4599
|
+
integration_context: opts.integrationContext || null
|
|
4600
|
+
});
|
|
4601
|
+
}
|
|
4602
|
+
|
|
4603
|
+
async prepareInteractionResultPackageHandoffSurfaceTemplate(continuationRef, body, options) {
|
|
4604
|
+
const opts = options || {};
|
|
4605
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/handoff-surface-template", {
|
|
4606
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.handoff.surface.template",
|
|
4607
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4608
|
+
body: body || {},
|
|
4609
|
+
callback_url: opts.callbackUrl || null,
|
|
4610
|
+
settlement_mode: opts.settlementMode || null,
|
|
4611
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4612
|
+
protocol: opts.protocol || null,
|
|
4613
|
+
integration_id: opts.integrationId || null,
|
|
4614
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4615
|
+
integration_context: opts.integrationContext || null
|
|
4616
|
+
});
|
|
4617
|
+
}
|
|
4618
|
+
|
|
4619
|
+
async prepareInteractionResultPackageHandoffSurfaceBundle(continuationRef, body, options) {
|
|
4620
|
+
const opts = options || {};
|
|
4621
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/handoff-surface-bundle", {
|
|
4622
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.handoff.surface.bundle",
|
|
4623
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4624
|
+
body: body || {},
|
|
4625
|
+
callback_url: opts.callbackUrl || null,
|
|
4626
|
+
settlement_mode: opts.settlementMode || null,
|
|
4627
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4628
|
+
protocol: opts.protocol || null,
|
|
4629
|
+
integration_id: opts.integrationId || null,
|
|
4630
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4631
|
+
integration_context: opts.integrationContext || null
|
|
4632
|
+
});
|
|
4633
|
+
}
|
|
4634
|
+
|
|
4587
4635
|
async runNamedTaskRoute(path, payload) {
|
|
4588
4636
|
if (!this.apiKey || !this.walletId || !this.walletSecret) {
|
|
4589
4637
|
throw new Error("named task routes require apiKey, walletId, and walletSecret");
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -1469,6 +1469,49 @@ function buildPreparedContinuationHandoffCarry(portableHandoff, continuation) {
|
|
|
1469
1469
|
};
|
|
1470
1470
|
}
|
|
1471
1471
|
|
|
1472
|
+
function buildPreparedContinuationAdapterConsumableHandoffSummary(portableHandoff, continuation) {
|
|
1473
|
+
const summary = buildPreparedContinuationHandoffSummary(portableHandoff, continuation);
|
|
1474
|
+
return {
|
|
1475
|
+
ok: summary.ok === true,
|
|
1476
|
+
handoff_contract_ref: summary.handoff_contract_ref || null,
|
|
1477
|
+
adapter_handoff_surface_ref: summary.handoff_contract_ref ? `surface.${summary.handoff_contract_ref}` : null,
|
|
1478
|
+
stable_handoff_surface_ids: [
|
|
1479
|
+
"prepared_artifact_handoff_surface",
|
|
1480
|
+
"review_handoff_intake",
|
|
1481
|
+
"proof_run"
|
|
1482
|
+
],
|
|
1483
|
+
consumable_handoff_carry: summary.stable_handoff_carry || {},
|
|
1484
|
+
adapter_consumable: summary.handoff_ready === true,
|
|
1485
|
+
next_surface: "/v1/proof-center/result-package-handoff/review/handoff-intake"
|
|
1486
|
+
};
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
function buildPreparedContinuationAdapterConsumableHandoffTemplate(portableHandoff, continuation) {
|
|
1490
|
+
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1491
|
+
const summary = buildPreparedContinuationAdapterConsumableHandoffSummary(portableHandoff, continuation);
|
|
1492
|
+
return {
|
|
1493
|
+
ok: true,
|
|
1494
|
+
adapter_handoff_surface_ref: summary.adapter_handoff_surface_ref || null,
|
|
1495
|
+
target_surface: "/v1/proof-center/result-package-handoff/review/handoff-intake",
|
|
1496
|
+
request_template: {
|
|
1497
|
+
handoff_bundle: handoff
|
|
1498
|
+
},
|
|
1499
|
+
stable_boundary_ids: [
|
|
1500
|
+
"prepared_artifact_handoff_surface",
|
|
1501
|
+
"review_handoff_intake",
|
|
1502
|
+
"proof_run"
|
|
1503
|
+
]
|
|
1504
|
+
};
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
function buildPreparedContinuationAdapterConsumableHandoffBundle(portableHandoff, continuation) {
|
|
1508
|
+
return {
|
|
1509
|
+
ok: true,
|
|
1510
|
+
adapter_handoff_surface_summary: buildPreparedContinuationAdapterConsumableHandoffSummary(portableHandoff, continuation),
|
|
1511
|
+
adapter_handoff_surface_template: buildPreparedContinuationAdapterConsumableHandoffTemplate(portableHandoff, continuation)
|
|
1512
|
+
};
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1472
1515
|
function buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation) {
|
|
1473
1516
|
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1474
1517
|
return {
|
|
@@ -2815,6 +2858,99 @@ async function routeRequest(req, res) {
|
|
|
2815
2858
|
return;
|
|
2816
2859
|
}
|
|
2817
2860
|
|
|
2861
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-surface-summary") {
|
|
2862
|
+
const body = await readJsonBody(req);
|
|
2863
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2864
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2865
|
+
if (!continuation) {
|
|
2866
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2867
|
+
return;
|
|
2868
|
+
}
|
|
2869
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2870
|
+
if (!resultPackage) {
|
|
2871
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2872
|
+
return;
|
|
2873
|
+
}
|
|
2874
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2875
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2876
|
+
spine_path_ref: resultPackage.source_ref
|
|
2877
|
+
});
|
|
2878
|
+
if (!payload) {
|
|
2879
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2880
|
+
return;
|
|
2881
|
+
}
|
|
2882
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2883
|
+
if (result.status !== 200) {
|
|
2884
|
+
sendJson(res, result.status, result.payload);
|
|
2885
|
+
return;
|
|
2886
|
+
}
|
|
2887
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2888
|
+
sendJson(res, 200, buildPreparedContinuationAdapterConsumableHandoffSummary(portableHandoff, continuation));
|
|
2889
|
+
return;
|
|
2890
|
+
}
|
|
2891
|
+
|
|
2892
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-surface-template") {
|
|
2893
|
+
const body = await readJsonBody(req);
|
|
2894
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2895
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2896
|
+
if (!continuation) {
|
|
2897
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2898
|
+
return;
|
|
2899
|
+
}
|
|
2900
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2901
|
+
if (!resultPackage) {
|
|
2902
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2903
|
+
return;
|
|
2904
|
+
}
|
|
2905
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2906
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2907
|
+
spine_path_ref: resultPackage.source_ref
|
|
2908
|
+
});
|
|
2909
|
+
if (!payload) {
|
|
2910
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2911
|
+
return;
|
|
2912
|
+
}
|
|
2913
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2914
|
+
if (result.status !== 200) {
|
|
2915
|
+
sendJson(res, result.status, result.payload);
|
|
2916
|
+
return;
|
|
2917
|
+
}
|
|
2918
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2919
|
+
sendJson(res, 200, buildPreparedContinuationAdapterConsumableHandoffTemplate(portableHandoff, continuation));
|
|
2920
|
+
return;
|
|
2921
|
+
}
|
|
2922
|
+
|
|
2923
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-surface-bundle") {
|
|
2924
|
+
const body = await readJsonBody(req);
|
|
2925
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2926
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2927
|
+
if (!continuation) {
|
|
2928
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2929
|
+
return;
|
|
2930
|
+
}
|
|
2931
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2932
|
+
if (!resultPackage) {
|
|
2933
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2934
|
+
return;
|
|
2935
|
+
}
|
|
2936
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2937
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2938
|
+
spine_path_ref: resultPackage.source_ref
|
|
2939
|
+
});
|
|
2940
|
+
if (!payload) {
|
|
2941
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2942
|
+
return;
|
|
2943
|
+
}
|
|
2944
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2945
|
+
if (result.status !== 200) {
|
|
2946
|
+
sendJson(res, result.status, result.payload);
|
|
2947
|
+
return;
|
|
2948
|
+
}
|
|
2949
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2950
|
+
sendJson(res, 200, buildPreparedContinuationAdapterConsumableHandoffBundle(portableHandoff, continuation));
|
|
2951
|
+
return;
|
|
2952
|
+
}
|
|
2953
|
+
|
|
2818
2954
|
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/contract-template") {
|
|
2819
2955
|
const body = await readJsonBody(req);
|
|
2820
2956
|
const continuationRef = String(body && body.continuation_ref || "").trim();
|