xytara 1.19.0 → 1.20.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
|
@@ -199,6 +199,15 @@ The current `1.19.0` line starts turning that adapter-usable handoff package int
|
|
|
199
199
|
|
|
200
200
|
This is intended to make the transaction-side continuation path easier to execute against directly as a stable public package instead of only a package that still needs execution glue.
|
|
201
201
|
|
|
202
|
+
The current `1.20.0` line starts turning that adapter-ready execution package into a clearer adapter-operable execution contract:
|
|
203
|
+
|
|
204
|
+
- execution-contract summaries on top of the default execution-package path
|
|
205
|
+
- compact execution-contract bundles for direct adapter-facing operation posture
|
|
206
|
+
- default execution-contract summaries for the next proof-side execution-contract run posture
|
|
207
|
+
- clearer execution-contract ids and stable operable carry
|
|
208
|
+
|
|
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
|
+
|
|
202
211
|
## Package Surface
|
|
203
212
|
|
|
204
213
|
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
|
@@ -4728,6 +4728,54 @@ class CommerceClient {
|
|
|
4728
4728
|
});
|
|
4729
4729
|
}
|
|
4730
4730
|
|
|
4731
|
+
async prepareInteractionResultPackageExecutionContractSummary(continuationRef, body, options) {
|
|
4732
|
+
const opts = options || {};
|
|
4733
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/execution-contract-summary", {
|
|
4734
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.execution.contract.summary",
|
|
4735
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4736
|
+
body: body || {},
|
|
4737
|
+
callback_url: opts.callbackUrl || null,
|
|
4738
|
+
settlement_mode: opts.settlementMode || null,
|
|
4739
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4740
|
+
protocol: opts.protocol || null,
|
|
4741
|
+
integration_id: opts.integrationId || null,
|
|
4742
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4743
|
+
integration_context: opts.integrationContext || null
|
|
4744
|
+
});
|
|
4745
|
+
}
|
|
4746
|
+
|
|
4747
|
+
async prepareInteractionResultPackageExecutionContractBundle(continuationRef, body, options) {
|
|
4748
|
+
const opts = options || {};
|
|
4749
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/execution-contract-bundle", {
|
|
4750
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.execution.contract.bundle",
|
|
4751
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4752
|
+
body: body || {},
|
|
4753
|
+
callback_url: opts.callbackUrl || null,
|
|
4754
|
+
settlement_mode: opts.settlementMode || null,
|
|
4755
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4756
|
+
protocol: opts.protocol || null,
|
|
4757
|
+
integration_id: opts.integrationId || null,
|
|
4758
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4759
|
+
integration_context: opts.integrationContext || null
|
|
4760
|
+
});
|
|
4761
|
+
}
|
|
4762
|
+
|
|
4763
|
+
async prepareInteractionResultPackageExecutionContractDefaultSummary(continuationRef, body, options) {
|
|
4764
|
+
const opts = options || {};
|
|
4765
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/execution-contract-default-summary", {
|
|
4766
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.execution.contract.default.summary",
|
|
4767
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4768
|
+
body: body || {},
|
|
4769
|
+
callback_url: opts.callbackUrl || null,
|
|
4770
|
+
settlement_mode: opts.settlementMode || null,
|
|
4771
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4772
|
+
protocol: opts.protocol || null,
|
|
4773
|
+
integration_id: opts.integrationId || null,
|
|
4774
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4775
|
+
integration_context: opts.integrationContext || null
|
|
4776
|
+
});
|
|
4777
|
+
}
|
|
4778
|
+
|
|
4731
4779
|
async runNamedTaskRoute(path, payload) {
|
|
4732
4780
|
if (!this.apiKey || !this.walletId || !this.walletSecret) {
|
|
4733
4781
|
throw new Error("named task routes require apiKey, walletId, and walletSecret");
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -1620,6 +1620,58 @@ function buildPreparedContinuationDefaultExecutionPackageSummary(portableHandoff
|
|
|
1620
1620
|
};
|
|
1621
1621
|
}
|
|
1622
1622
|
|
|
1623
|
+
function buildPreparedContinuationAdapterOperableExecutionContractSummary(portableHandoff, continuation) {
|
|
1624
|
+
const executionPackage = buildPreparedContinuationDefaultExecutionPackageSummary(portableHandoff, continuation);
|
|
1625
|
+
return {
|
|
1626
|
+
ok: executionPackage.ok === true,
|
|
1627
|
+
default_execution_package_ref: executionPackage.default_execution_package_ref || null,
|
|
1628
|
+
execution_contract_ref: executionPackage.default_execution_package_ref
|
|
1629
|
+
? `contract.${executionPackage.default_execution_package_ref}`
|
|
1630
|
+
: null,
|
|
1631
|
+
stable_execution_contract_ids: Array.isArray(executionPackage.stable_default_execution_package_ids)
|
|
1632
|
+
? executionPackage.stable_default_execution_package_ids
|
|
1633
|
+
: [],
|
|
1634
|
+
execution_contract_carry: executionPackage.default_execution_package_carry || {},
|
|
1635
|
+
adapter_operable: executionPackage.execution_ready_by_default === true,
|
|
1636
|
+
next_surface: "/v1/proof-center/result-package-handoff/review/execution-contract"
|
|
1637
|
+
};
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
function buildPreparedContinuationAdapterOperableExecutionContractBundle(portableHandoff, continuation) {
|
|
1641
|
+
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1642
|
+
const summary = buildPreparedContinuationAdapterOperableExecutionContractSummary(portableHandoff, continuation);
|
|
1643
|
+
return {
|
|
1644
|
+
ok: true,
|
|
1645
|
+
execution_contract_summary: summary,
|
|
1646
|
+
execution_contract_template: {
|
|
1647
|
+
ok: true,
|
|
1648
|
+
execution_contract_ref: summary.execution_contract_ref || null,
|
|
1649
|
+
target_surface: "/v1/proof-center/result-package-handoff/review/execution-contract",
|
|
1650
|
+
request_template: {
|
|
1651
|
+
handoff_bundle: handoff
|
|
1652
|
+
},
|
|
1653
|
+
stable_boundary_ids: Array.isArray(summary.stable_execution_contract_ids) ? summary.stable_execution_contract_ids : []
|
|
1654
|
+
}
|
|
1655
|
+
};
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
function buildPreparedContinuationDefaultExecutionContractSummary(portableHandoff, continuation) {
|
|
1659
|
+
const executionContract = buildPreparedContinuationAdapterOperableExecutionContractSummary(portableHandoff, continuation);
|
|
1660
|
+
return {
|
|
1661
|
+
ok: executionContract.ok === true,
|
|
1662
|
+
execution_contract_ref: executionContract.execution_contract_ref || null,
|
|
1663
|
+
default_execution_contract_ref: executionContract.execution_contract_ref
|
|
1664
|
+
? `default.${executionContract.execution_contract_ref}`
|
|
1665
|
+
: null,
|
|
1666
|
+
stable_default_execution_contract_ids: Array.isArray(executionContract.stable_execution_contract_ids)
|
|
1667
|
+
? executionContract.stable_execution_contract_ids
|
|
1668
|
+
: [],
|
|
1669
|
+
default_execution_contract_carry: executionContract.execution_contract_carry || {},
|
|
1670
|
+
execution_operable_by_default: executionContract.adapter_operable === true,
|
|
1671
|
+
next_surface: "/v1/proof-center/result-package-handoff/review/execution-contract-run"
|
|
1672
|
+
};
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1623
1675
|
function buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation) {
|
|
1624
1676
|
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1625
1677
|
return {
|
|
@@ -3245,6 +3297,99 @@ async function routeRequest(req, res) {
|
|
|
3245
3297
|
return;
|
|
3246
3298
|
}
|
|
3247
3299
|
|
|
3300
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/execution-contract-summary") {
|
|
3301
|
+
const body = await readJsonBody(req);
|
|
3302
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3303
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3304
|
+
if (!continuation) {
|
|
3305
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3306
|
+
return;
|
|
3307
|
+
}
|
|
3308
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3309
|
+
if (!resultPackage) {
|
|
3310
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3311
|
+
return;
|
|
3312
|
+
}
|
|
3313
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3314
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3315
|
+
spine_path_ref: resultPackage.source_ref
|
|
3316
|
+
});
|
|
3317
|
+
if (!payload) {
|
|
3318
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3319
|
+
return;
|
|
3320
|
+
}
|
|
3321
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3322
|
+
if (result.status !== 200) {
|
|
3323
|
+
sendJson(res, result.status, result.payload);
|
|
3324
|
+
return;
|
|
3325
|
+
}
|
|
3326
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3327
|
+
sendJson(res, 200, buildPreparedContinuationAdapterOperableExecutionContractSummary(portableHandoff, continuation));
|
|
3328
|
+
return;
|
|
3329
|
+
}
|
|
3330
|
+
|
|
3331
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/execution-contract-bundle") {
|
|
3332
|
+
const body = await readJsonBody(req);
|
|
3333
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3334
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3335
|
+
if (!continuation) {
|
|
3336
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3337
|
+
return;
|
|
3338
|
+
}
|
|
3339
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3340
|
+
if (!resultPackage) {
|
|
3341
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3342
|
+
return;
|
|
3343
|
+
}
|
|
3344
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3345
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3346
|
+
spine_path_ref: resultPackage.source_ref
|
|
3347
|
+
});
|
|
3348
|
+
if (!payload) {
|
|
3349
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3350
|
+
return;
|
|
3351
|
+
}
|
|
3352
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3353
|
+
if (result.status !== 200) {
|
|
3354
|
+
sendJson(res, result.status, result.payload);
|
|
3355
|
+
return;
|
|
3356
|
+
}
|
|
3357
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3358
|
+
sendJson(res, 200, buildPreparedContinuationAdapterOperableExecutionContractBundle(portableHandoff, continuation));
|
|
3359
|
+
return;
|
|
3360
|
+
}
|
|
3361
|
+
|
|
3362
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/execution-contract-default-summary") {
|
|
3363
|
+
const body = await readJsonBody(req);
|
|
3364
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3365
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3366
|
+
if (!continuation) {
|
|
3367
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3368
|
+
return;
|
|
3369
|
+
}
|
|
3370
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3371
|
+
if (!resultPackage) {
|
|
3372
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3373
|
+
return;
|
|
3374
|
+
}
|
|
3375
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3376
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3377
|
+
spine_path_ref: resultPackage.source_ref
|
|
3378
|
+
});
|
|
3379
|
+
if (!payload) {
|
|
3380
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3381
|
+
return;
|
|
3382
|
+
}
|
|
3383
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3384
|
+
if (result.status !== 200) {
|
|
3385
|
+
sendJson(res, result.status, result.payload);
|
|
3386
|
+
return;
|
|
3387
|
+
}
|
|
3388
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3389
|
+
sendJson(res, 200, buildPreparedContinuationDefaultExecutionContractSummary(portableHandoff, continuation));
|
|
3390
|
+
return;
|
|
3391
|
+
}
|
|
3392
|
+
|
|
3248
3393
|
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/contract-template") {
|
|
3249
3394
|
const body = await readJsonBody(req);
|
|
3250
3395
|
const continuationRef = String(body && body.continuation_ref || "").trim();
|