xytara 1.20.0 → 1.21.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
|
@@ -208,6 +208,15 @@ The current `1.20.0` line starts turning that adapter-ready execution package in
|
|
|
208
208
|
|
|
209
209
|
This is intended to make the transaction-side continuation path easier to operate against repeatedly as a stable public contract instead of only a package that is execution-ready by posture.
|
|
210
210
|
|
|
211
|
+
The current `1.21.0` line starts turning that adapter-operable execution contract into a clearer adapter-stable operating contract:
|
|
212
|
+
|
|
213
|
+
- operating-contract summaries on top of the default execution-contract path
|
|
214
|
+
- compact operating-contract bundles for direct adapter-facing stable operation posture
|
|
215
|
+
- default operating-contract summaries for the next proof-side operating-contract run posture
|
|
216
|
+
- clearer operating-contract ids and stable recurring operating carry
|
|
217
|
+
|
|
218
|
+
This is intended to make the transaction-side continuation path easier to depend on repeatedly as a durable public operating contract instead of only a contract that is operable in the moment.
|
|
219
|
+
|
|
211
220
|
## Package Surface
|
|
212
221
|
|
|
213
222
|
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
|
@@ -4776,6 +4776,54 @@ class CommerceClient {
|
|
|
4776
4776
|
});
|
|
4777
4777
|
}
|
|
4778
4778
|
|
|
4779
|
+
async prepareInteractionResultPackageOperatingContractSummary(continuationRef, body, options) {
|
|
4780
|
+
const opts = options || {};
|
|
4781
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/operating-contract-summary", {
|
|
4782
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.operating.contract.summary",
|
|
4783
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4784
|
+
body: body || {},
|
|
4785
|
+
callback_url: opts.callbackUrl || null,
|
|
4786
|
+
settlement_mode: opts.settlementMode || null,
|
|
4787
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4788
|
+
protocol: opts.protocol || null,
|
|
4789
|
+
integration_id: opts.integrationId || null,
|
|
4790
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4791
|
+
integration_context: opts.integrationContext || null
|
|
4792
|
+
});
|
|
4793
|
+
}
|
|
4794
|
+
|
|
4795
|
+
async prepareInteractionResultPackageOperatingContractBundle(continuationRef, body, options) {
|
|
4796
|
+
const opts = options || {};
|
|
4797
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/operating-contract-bundle", {
|
|
4798
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.operating.contract.bundle",
|
|
4799
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4800
|
+
body: body || {},
|
|
4801
|
+
callback_url: opts.callbackUrl || null,
|
|
4802
|
+
settlement_mode: opts.settlementMode || null,
|
|
4803
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4804
|
+
protocol: opts.protocol || null,
|
|
4805
|
+
integration_id: opts.integrationId || null,
|
|
4806
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4807
|
+
integration_context: opts.integrationContext || null
|
|
4808
|
+
});
|
|
4809
|
+
}
|
|
4810
|
+
|
|
4811
|
+
async prepareInteractionResultPackageOperatingContractDefaultSummary(continuationRef, body, options) {
|
|
4812
|
+
const opts = options || {};
|
|
4813
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/operating-contract-default-summary", {
|
|
4814
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.operating.contract.default.summary",
|
|
4815
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4816
|
+
body: body || {},
|
|
4817
|
+
callback_url: opts.callbackUrl || null,
|
|
4818
|
+
settlement_mode: opts.settlementMode || null,
|
|
4819
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4820
|
+
protocol: opts.protocol || null,
|
|
4821
|
+
integration_id: opts.integrationId || null,
|
|
4822
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4823
|
+
integration_context: opts.integrationContext || null
|
|
4824
|
+
});
|
|
4825
|
+
}
|
|
4826
|
+
|
|
4779
4827
|
async runNamedTaskRoute(path, payload) {
|
|
4780
4828
|
if (!this.apiKey || !this.walletId || !this.walletSecret) {
|
|
4781
4829
|
throw new Error("named task routes require apiKey, walletId, and walletSecret");
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -1672,6 +1672,58 @@ function buildPreparedContinuationDefaultExecutionContractSummary(portableHandof
|
|
|
1672
1672
|
};
|
|
1673
1673
|
}
|
|
1674
1674
|
|
|
1675
|
+
function buildPreparedContinuationAdapterStableOperatingContractSummary(portableHandoff, continuation) {
|
|
1676
|
+
const executionContract = buildPreparedContinuationDefaultExecutionContractSummary(portableHandoff, continuation);
|
|
1677
|
+
return {
|
|
1678
|
+
ok: executionContract.ok === true,
|
|
1679
|
+
default_execution_contract_ref: executionContract.default_execution_contract_ref || null,
|
|
1680
|
+
operating_contract_ref: executionContract.default_execution_contract_ref
|
|
1681
|
+
? `operating.${executionContract.default_execution_contract_ref}`
|
|
1682
|
+
: null,
|
|
1683
|
+
stable_operating_contract_ids: Array.isArray(executionContract.stable_default_execution_contract_ids)
|
|
1684
|
+
? executionContract.stable_default_execution_contract_ids
|
|
1685
|
+
: [],
|
|
1686
|
+
operating_contract_carry: executionContract.default_execution_contract_carry || {},
|
|
1687
|
+
adapter_stable: executionContract.execution_operable_by_default === true,
|
|
1688
|
+
next_surface: "/v1/proof-center/result-package-handoff/review/operating-contract"
|
|
1689
|
+
};
|
|
1690
|
+
}
|
|
1691
|
+
|
|
1692
|
+
function buildPreparedContinuationAdapterStableOperatingContractBundle(portableHandoff, continuation) {
|
|
1693
|
+
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1694
|
+
const summary = buildPreparedContinuationAdapterStableOperatingContractSummary(portableHandoff, continuation);
|
|
1695
|
+
return {
|
|
1696
|
+
ok: true,
|
|
1697
|
+
operating_contract_summary: summary,
|
|
1698
|
+
operating_contract_template: {
|
|
1699
|
+
ok: true,
|
|
1700
|
+
operating_contract_ref: summary.operating_contract_ref || null,
|
|
1701
|
+
target_surface: "/v1/proof-center/result-package-handoff/review/operating-contract",
|
|
1702
|
+
request_template: {
|
|
1703
|
+
handoff_bundle: handoff
|
|
1704
|
+
},
|
|
1705
|
+
stable_boundary_ids: Array.isArray(summary.stable_operating_contract_ids) ? summary.stable_operating_contract_ids : []
|
|
1706
|
+
}
|
|
1707
|
+
};
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
function buildPreparedContinuationDefaultOperatingContractSummary(portableHandoff, continuation) {
|
|
1711
|
+
const operatingContract = buildPreparedContinuationAdapterStableOperatingContractSummary(portableHandoff, continuation);
|
|
1712
|
+
return {
|
|
1713
|
+
ok: operatingContract.ok === true,
|
|
1714
|
+
operating_contract_ref: operatingContract.operating_contract_ref || null,
|
|
1715
|
+
default_operating_contract_ref: operatingContract.operating_contract_ref
|
|
1716
|
+
? `default.${operatingContract.operating_contract_ref}`
|
|
1717
|
+
: null,
|
|
1718
|
+
stable_default_operating_contract_ids: Array.isArray(operatingContract.stable_operating_contract_ids)
|
|
1719
|
+
? operatingContract.stable_operating_contract_ids
|
|
1720
|
+
: [],
|
|
1721
|
+
default_operating_contract_carry: operatingContract.operating_contract_carry || {},
|
|
1722
|
+
operating_stable_by_default: operatingContract.adapter_stable === true,
|
|
1723
|
+
next_surface: "/v1/proof-center/result-package-handoff/review/operating-contract-run"
|
|
1724
|
+
};
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1675
1727
|
function buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation) {
|
|
1676
1728
|
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1677
1729
|
return {
|
|
@@ -3390,6 +3442,99 @@ async function routeRequest(req, res) {
|
|
|
3390
3442
|
return;
|
|
3391
3443
|
}
|
|
3392
3444
|
|
|
3445
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/operating-contract-summary") {
|
|
3446
|
+
const body = await readJsonBody(req);
|
|
3447
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3448
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3449
|
+
if (!continuation) {
|
|
3450
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3451
|
+
return;
|
|
3452
|
+
}
|
|
3453
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3454
|
+
if (!resultPackage) {
|
|
3455
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3456
|
+
return;
|
|
3457
|
+
}
|
|
3458
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3459
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3460
|
+
spine_path_ref: resultPackage.source_ref
|
|
3461
|
+
});
|
|
3462
|
+
if (!payload) {
|
|
3463
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3464
|
+
return;
|
|
3465
|
+
}
|
|
3466
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3467
|
+
if (result.status !== 200) {
|
|
3468
|
+
sendJson(res, result.status, result.payload);
|
|
3469
|
+
return;
|
|
3470
|
+
}
|
|
3471
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3472
|
+
sendJson(res, 200, buildPreparedContinuationAdapterStableOperatingContractSummary(portableHandoff, continuation));
|
|
3473
|
+
return;
|
|
3474
|
+
}
|
|
3475
|
+
|
|
3476
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/operating-contract-bundle") {
|
|
3477
|
+
const body = await readJsonBody(req);
|
|
3478
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3479
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3480
|
+
if (!continuation) {
|
|
3481
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3482
|
+
return;
|
|
3483
|
+
}
|
|
3484
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3485
|
+
if (!resultPackage) {
|
|
3486
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3487
|
+
return;
|
|
3488
|
+
}
|
|
3489
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3490
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3491
|
+
spine_path_ref: resultPackage.source_ref
|
|
3492
|
+
});
|
|
3493
|
+
if (!payload) {
|
|
3494
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3495
|
+
return;
|
|
3496
|
+
}
|
|
3497
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3498
|
+
if (result.status !== 200) {
|
|
3499
|
+
sendJson(res, result.status, result.payload);
|
|
3500
|
+
return;
|
|
3501
|
+
}
|
|
3502
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3503
|
+
sendJson(res, 200, buildPreparedContinuationAdapterStableOperatingContractBundle(portableHandoff, continuation));
|
|
3504
|
+
return;
|
|
3505
|
+
}
|
|
3506
|
+
|
|
3507
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/operating-contract-default-summary") {
|
|
3508
|
+
const body = await readJsonBody(req);
|
|
3509
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3510
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3511
|
+
if (!continuation) {
|
|
3512
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3513
|
+
return;
|
|
3514
|
+
}
|
|
3515
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3516
|
+
if (!resultPackage) {
|
|
3517
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3518
|
+
return;
|
|
3519
|
+
}
|
|
3520
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3521
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3522
|
+
spine_path_ref: resultPackage.source_ref
|
|
3523
|
+
});
|
|
3524
|
+
if (!payload) {
|
|
3525
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3526
|
+
return;
|
|
3527
|
+
}
|
|
3528
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3529
|
+
if (result.status !== 200) {
|
|
3530
|
+
sendJson(res, result.status, result.payload);
|
|
3531
|
+
return;
|
|
3532
|
+
}
|
|
3533
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3534
|
+
sendJson(res, 200, buildPreparedContinuationDefaultOperatingContractSummary(portableHandoff, continuation));
|
|
3535
|
+
return;
|
|
3536
|
+
}
|
|
3537
|
+
|
|
3393
3538
|
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/contract-template") {
|
|
3394
3539
|
const body = await readJsonBody(req);
|
|
3395
3540
|
const continuationRef = String(body && body.continuation_ref || "").trim();
|