xytara 1.15.0 → 1.16.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 +64 -0
- package/package.json +1 -1
- package/server.js +179 -0
package/README.md
CHANGED
|
@@ -163,6 +163,15 @@ The current `1.15.0` line starts turning that same contract path into a clearer
|
|
|
163
163
|
|
|
164
164
|
This is intended to make the transaction-side continuation path easier to hand across a stable adapter-ready bridge instead of treating bridge preparation as an implicit follow-on concern.
|
|
165
165
|
|
|
166
|
+
The current `1.16.0` line starts turning that bridge into a clearer stable public handoff contract:
|
|
167
|
+
|
|
168
|
+
- prepared-artifact handoff summaries on top of the bridge path
|
|
169
|
+
- direct handoff template surfaces for proof-side handoff continuity review
|
|
170
|
+
- compact handoff bundles for direct transaction-side handoff reuse
|
|
171
|
+
- compact handoff-carry surfaces for direct transaction-side handoff reuse
|
|
172
|
+
|
|
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
|
+
|
|
166
175
|
## Package Surface
|
|
167
176
|
|
|
168
177
|
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
|
@@ -4520,6 +4520,70 @@ class CommerceClient {
|
|
|
4520
4520
|
});
|
|
4521
4521
|
}
|
|
4522
4522
|
|
|
4523
|
+
async prepareInteractionResultPackageHandoffSummary(continuationRef, body, options) {
|
|
4524
|
+
const opts = options || {};
|
|
4525
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/handoff-summary", {
|
|
4526
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.handoff.summary",
|
|
4527
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4528
|
+
body: body || {},
|
|
4529
|
+
callback_url: opts.callbackUrl || null,
|
|
4530
|
+
settlement_mode: opts.settlementMode || null,
|
|
4531
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4532
|
+
protocol: opts.protocol || null,
|
|
4533
|
+
integration_id: opts.integrationId || null,
|
|
4534
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4535
|
+
integration_context: opts.integrationContext || null
|
|
4536
|
+
});
|
|
4537
|
+
}
|
|
4538
|
+
|
|
4539
|
+
async prepareInteractionResultPackageHandoffTemplate(continuationRef, body, options) {
|
|
4540
|
+
const opts = options || {};
|
|
4541
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/handoff-template", {
|
|
4542
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.handoff.template",
|
|
4543
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4544
|
+
body: body || {},
|
|
4545
|
+
callback_url: opts.callbackUrl || null,
|
|
4546
|
+
settlement_mode: opts.settlementMode || null,
|
|
4547
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4548
|
+
protocol: opts.protocol || null,
|
|
4549
|
+
integration_id: opts.integrationId || null,
|
|
4550
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4551
|
+
integration_context: opts.integrationContext || null
|
|
4552
|
+
});
|
|
4553
|
+
}
|
|
4554
|
+
|
|
4555
|
+
async prepareInteractionResultPackageHandoffBundle(continuationRef, body, options) {
|
|
4556
|
+
const opts = options || {};
|
|
4557
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/handoff-bundle", {
|
|
4558
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.handoff.bundle",
|
|
4559
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4560
|
+
body: body || {},
|
|
4561
|
+
callback_url: opts.callbackUrl || null,
|
|
4562
|
+
settlement_mode: opts.settlementMode || null,
|
|
4563
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4564
|
+
protocol: opts.protocol || null,
|
|
4565
|
+
integration_id: opts.integrationId || null,
|
|
4566
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4567
|
+
integration_context: opts.integrationContext || null
|
|
4568
|
+
});
|
|
4569
|
+
}
|
|
4570
|
+
|
|
4571
|
+
async prepareInteractionResultPackageHandoffCarry(continuationRef, body, options) {
|
|
4572
|
+
const opts = options || {};
|
|
4573
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/handoff-carry", {
|
|
4574
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.handoff.carry",
|
|
4575
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4576
|
+
body: body || {},
|
|
4577
|
+
callback_url: opts.callbackUrl || null,
|
|
4578
|
+
settlement_mode: opts.settlementMode || null,
|
|
4579
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4580
|
+
protocol: opts.protocol || null,
|
|
4581
|
+
integration_id: opts.integrationId || null,
|
|
4582
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4583
|
+
integration_context: opts.integrationContext || null
|
|
4584
|
+
});
|
|
4585
|
+
}
|
|
4586
|
+
|
|
4523
4587
|
async runNamedTaskRoute(path, payload) {
|
|
4524
4588
|
if (!this.apiKey || !this.walletId || !this.walletSecret) {
|
|
4525
4589
|
throw new Error("named task routes require apiKey, walletId, and walletSecret");
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -1414,6 +1414,61 @@ function buildPreparedContinuationAdapterBridgeCarry(portableHandoff, continuati
|
|
|
1414
1414
|
};
|
|
1415
1415
|
}
|
|
1416
1416
|
|
|
1417
|
+
function buildPreparedContinuationHandoffSummary(portableHandoff, continuation) {
|
|
1418
|
+
const bridge = buildPreparedContinuationAdapterBridgeSummary(portableHandoff, continuation);
|
|
1419
|
+
return {
|
|
1420
|
+
ok: bridge.ok === true,
|
|
1421
|
+
adapter_bridge_ref: bridge.adapter_bridge_ref || null,
|
|
1422
|
+
handoff_contract_ref: bridge.adapter_bridge_ref ? `handoff.${bridge.adapter_bridge_ref}` : null,
|
|
1423
|
+
stable_handoff_ids: [
|
|
1424
|
+
"prepared_artifact_handoff",
|
|
1425
|
+
"review_handoff_summary",
|
|
1426
|
+
"proof_run"
|
|
1427
|
+
],
|
|
1428
|
+
stable_handoff_carry: bridge.bridge_carry || {},
|
|
1429
|
+
handoff_ready: bridge.bridge_ready === true,
|
|
1430
|
+
next_surface: "/v1/proof-center/result-package-handoff/review/handoff-continuity"
|
|
1431
|
+
};
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
function buildPreparedContinuationHandoffTemplate(portableHandoff, continuation) {
|
|
1435
|
+
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1436
|
+
const summary = buildPreparedContinuationHandoffSummary(portableHandoff, continuation);
|
|
1437
|
+
return {
|
|
1438
|
+
ok: true,
|
|
1439
|
+
handoff_contract_ref: summary.handoff_contract_ref || null,
|
|
1440
|
+
target_surface: "/v1/proof-center/result-package-handoff/review/handoff-continuity",
|
|
1441
|
+
request_template: {
|
|
1442
|
+
handoff_bundle: handoff
|
|
1443
|
+
},
|
|
1444
|
+
stable_boundary_ids: [
|
|
1445
|
+
"prepared_artifact_handoff",
|
|
1446
|
+
"review_handoff_summary",
|
|
1447
|
+
"proof_run"
|
|
1448
|
+
]
|
|
1449
|
+
};
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
function buildPreparedContinuationHandoffBundle(portableHandoff, continuation) {
|
|
1453
|
+
return {
|
|
1454
|
+
ok: true,
|
|
1455
|
+
handoff_summary: buildPreparedContinuationHandoffSummary(portableHandoff, continuation),
|
|
1456
|
+
handoff_template: buildPreparedContinuationHandoffTemplate(portableHandoff, continuation)
|
|
1457
|
+
};
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
function buildPreparedContinuationHandoffCarry(portableHandoff, continuation) {
|
|
1461
|
+
const summary = buildPreparedContinuationHandoffSummary(portableHandoff, continuation);
|
|
1462
|
+
return {
|
|
1463
|
+
ok: true,
|
|
1464
|
+
handoff_contract_ref: summary.handoff_contract_ref || null,
|
|
1465
|
+
stable_handoff_ids: Array.isArray(summary.stable_handoff_ids) ? summary.stable_handoff_ids : [],
|
|
1466
|
+
stable_handoff_carry: summary.stable_handoff_carry || {},
|
|
1467
|
+
handoff_ready: summary.handoff_ready === true,
|
|
1468
|
+
review_surface: "/v1/proof-center/result-package-handoff/review/handoff-run"
|
|
1469
|
+
};
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1417
1472
|
function buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation) {
|
|
1418
1473
|
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1419
1474
|
return {
|
|
@@ -2636,6 +2691,130 @@ async function routeRequest(req, res) {
|
|
|
2636
2691
|
return;
|
|
2637
2692
|
}
|
|
2638
2693
|
|
|
2694
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-summary") {
|
|
2695
|
+
const body = await readJsonBody(req);
|
|
2696
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2697
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2698
|
+
if (!continuation) {
|
|
2699
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2700
|
+
return;
|
|
2701
|
+
}
|
|
2702
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2703
|
+
if (!resultPackage) {
|
|
2704
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2705
|
+
return;
|
|
2706
|
+
}
|
|
2707
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2708
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2709
|
+
spine_path_ref: resultPackage.source_ref
|
|
2710
|
+
});
|
|
2711
|
+
if (!payload) {
|
|
2712
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2713
|
+
return;
|
|
2714
|
+
}
|
|
2715
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2716
|
+
if (result.status !== 200) {
|
|
2717
|
+
sendJson(res, result.status, result.payload);
|
|
2718
|
+
return;
|
|
2719
|
+
}
|
|
2720
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2721
|
+
sendJson(res, 200, buildPreparedContinuationHandoffSummary(portableHandoff, continuation));
|
|
2722
|
+
return;
|
|
2723
|
+
}
|
|
2724
|
+
|
|
2725
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-template") {
|
|
2726
|
+
const body = await readJsonBody(req);
|
|
2727
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2728
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2729
|
+
if (!continuation) {
|
|
2730
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2731
|
+
return;
|
|
2732
|
+
}
|
|
2733
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2734
|
+
if (!resultPackage) {
|
|
2735
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2736
|
+
return;
|
|
2737
|
+
}
|
|
2738
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2739
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2740
|
+
spine_path_ref: resultPackage.source_ref
|
|
2741
|
+
});
|
|
2742
|
+
if (!payload) {
|
|
2743
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2744
|
+
return;
|
|
2745
|
+
}
|
|
2746
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2747
|
+
if (result.status !== 200) {
|
|
2748
|
+
sendJson(res, result.status, result.payload);
|
|
2749
|
+
return;
|
|
2750
|
+
}
|
|
2751
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2752
|
+
sendJson(res, 200, buildPreparedContinuationHandoffTemplate(portableHandoff, continuation));
|
|
2753
|
+
return;
|
|
2754
|
+
}
|
|
2755
|
+
|
|
2756
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-bundle") {
|
|
2757
|
+
const body = await readJsonBody(req);
|
|
2758
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2759
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2760
|
+
if (!continuation) {
|
|
2761
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2762
|
+
return;
|
|
2763
|
+
}
|
|
2764
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2765
|
+
if (!resultPackage) {
|
|
2766
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2767
|
+
return;
|
|
2768
|
+
}
|
|
2769
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2770
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2771
|
+
spine_path_ref: resultPackage.source_ref
|
|
2772
|
+
});
|
|
2773
|
+
if (!payload) {
|
|
2774
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2775
|
+
return;
|
|
2776
|
+
}
|
|
2777
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2778
|
+
if (result.status !== 200) {
|
|
2779
|
+
sendJson(res, result.status, result.payload);
|
|
2780
|
+
return;
|
|
2781
|
+
}
|
|
2782
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2783
|
+
sendJson(res, 200, buildPreparedContinuationHandoffBundle(portableHandoff, continuation));
|
|
2784
|
+
return;
|
|
2785
|
+
}
|
|
2786
|
+
|
|
2787
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/handoff-carry") {
|
|
2788
|
+
const body = await readJsonBody(req);
|
|
2789
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2790
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2791
|
+
if (!continuation) {
|
|
2792
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2793
|
+
return;
|
|
2794
|
+
}
|
|
2795
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2796
|
+
if (!resultPackage) {
|
|
2797
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2798
|
+
return;
|
|
2799
|
+
}
|
|
2800
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2801
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2802
|
+
spine_path_ref: resultPackage.source_ref
|
|
2803
|
+
});
|
|
2804
|
+
if (!payload) {
|
|
2805
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2806
|
+
return;
|
|
2807
|
+
}
|
|
2808
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2809
|
+
if (result.status !== 200) {
|
|
2810
|
+
sendJson(res, result.status, result.payload);
|
|
2811
|
+
return;
|
|
2812
|
+
}
|
|
2813
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2814
|
+
sendJson(res, 200, buildPreparedContinuationHandoffCarry(portableHandoff, continuation));
|
|
2815
|
+
return;
|
|
2816
|
+
}
|
|
2817
|
+
|
|
2639
2818
|
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/contract-template") {
|
|
2640
2819
|
const body = await readJsonBody(req);
|
|
2641
2820
|
const continuationRef = String(body && body.continuation_ref || "").trim();
|