xytara 1.18.0 → 1.19.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
|
@@ -190,6 +190,15 @@ The current `1.18.0` line starts turning that adapter-consumable handoff surface
|
|
|
190
190
|
|
|
191
191
|
This is intended to make the transaction-side continuation path easier to use directly as a stable public handoff package instead of only a surface that still needs extra glue logic.
|
|
192
192
|
|
|
193
|
+
The current `1.19.0` line starts turning that adapter-usable handoff package into a clearer adapter-ready execution package:
|
|
194
|
+
|
|
195
|
+
- execution-package summaries on top of the default handoff-package path
|
|
196
|
+
- compact execution-package bundles for direct adapter-facing execution posture
|
|
197
|
+
- default execution-package summaries for the next proof-side execution run posture
|
|
198
|
+
- clearer execution-package ids and stable execution-ready carry
|
|
199
|
+
|
|
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
|
+
|
|
193
202
|
## Package Surface
|
|
194
203
|
|
|
195
204
|
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
|
@@ -4680,6 +4680,54 @@ class CommerceClient {
|
|
|
4680
4680
|
});
|
|
4681
4681
|
}
|
|
4682
4682
|
|
|
4683
|
+
async prepareInteractionResultPackageExecutionPackageSummary(continuationRef, body, options) {
|
|
4684
|
+
const opts = options || {};
|
|
4685
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/execution-package-summary", {
|
|
4686
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.execution.package.summary",
|
|
4687
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4688
|
+
body: body || {},
|
|
4689
|
+
callback_url: opts.callbackUrl || null,
|
|
4690
|
+
settlement_mode: opts.settlementMode || null,
|
|
4691
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4692
|
+
protocol: opts.protocol || null,
|
|
4693
|
+
integration_id: opts.integrationId || null,
|
|
4694
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4695
|
+
integration_context: opts.integrationContext || null
|
|
4696
|
+
});
|
|
4697
|
+
}
|
|
4698
|
+
|
|
4699
|
+
async prepareInteractionResultPackageExecutionPackageBundle(continuationRef, body, options) {
|
|
4700
|
+
const opts = options || {};
|
|
4701
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/execution-package-bundle", {
|
|
4702
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.execution.package.bundle",
|
|
4703
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4704
|
+
body: body || {},
|
|
4705
|
+
callback_url: opts.callbackUrl || null,
|
|
4706
|
+
settlement_mode: opts.settlementMode || null,
|
|
4707
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4708
|
+
protocol: opts.protocol || null,
|
|
4709
|
+
integration_id: opts.integrationId || null,
|
|
4710
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4711
|
+
integration_context: opts.integrationContext || null
|
|
4712
|
+
});
|
|
4713
|
+
}
|
|
4714
|
+
|
|
4715
|
+
async prepareInteractionResultPackageExecutionPackageDefaultSummary(continuationRef, body, options) {
|
|
4716
|
+
const opts = options || {};
|
|
4717
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/execution-package-default-summary", {
|
|
4718
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.execution.package.default.summary",
|
|
4719
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4720
|
+
body: body || {},
|
|
4721
|
+
callback_url: opts.callbackUrl || null,
|
|
4722
|
+
settlement_mode: opts.settlementMode || null,
|
|
4723
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4724
|
+
protocol: opts.protocol || null,
|
|
4725
|
+
integration_id: opts.integrationId || null,
|
|
4726
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4727
|
+
integration_context: opts.integrationContext || null
|
|
4728
|
+
});
|
|
4729
|
+
}
|
|
4730
|
+
|
|
4683
4731
|
async runNamedTaskRoute(path, payload) {
|
|
4684
4732
|
if (!this.apiKey || !this.walletId || !this.walletSecret) {
|
|
4685
4733
|
throw new Error("named task routes require apiKey, walletId, and walletSecret");
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -1568,6 +1568,58 @@ function buildPreparedContinuationDefaultUsableHandoffPackageSummary(portableHan
|
|
|
1568
1568
|
};
|
|
1569
1569
|
}
|
|
1570
1570
|
|
|
1571
|
+
function buildPreparedContinuationAdapterReadyExecutionPackageSummary(portableHandoff, continuation) {
|
|
1572
|
+
const handoffPackage = buildPreparedContinuationDefaultUsableHandoffPackageSummary(portableHandoff, continuation);
|
|
1573
|
+
return {
|
|
1574
|
+
ok: handoffPackage.ok === true,
|
|
1575
|
+
default_handoff_package_ref: handoffPackage.default_handoff_package_ref || null,
|
|
1576
|
+
execution_package_ref: handoffPackage.default_handoff_package_ref
|
|
1577
|
+
? `execution.${handoffPackage.default_handoff_package_ref}`
|
|
1578
|
+
: null,
|
|
1579
|
+
stable_execution_package_ids: Array.isArray(handoffPackage.stable_default_handoff_package_ids)
|
|
1580
|
+
? handoffPackage.stable_default_handoff_package_ids
|
|
1581
|
+
: [],
|
|
1582
|
+
execution_package_carry: handoffPackage.default_usable_handoff_package_carry || {},
|
|
1583
|
+
adapter_ready: handoffPackage.package_usable_by_default === true,
|
|
1584
|
+
next_surface: "/v1/proof-center/result-package-handoff/review/execution-package"
|
|
1585
|
+
};
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
function buildPreparedContinuationAdapterReadyExecutionPackageBundle(portableHandoff, continuation) {
|
|
1589
|
+
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1590
|
+
const summary = buildPreparedContinuationAdapterReadyExecutionPackageSummary(portableHandoff, continuation);
|
|
1591
|
+
return {
|
|
1592
|
+
ok: true,
|
|
1593
|
+
execution_package_summary: summary,
|
|
1594
|
+
execution_package_template: {
|
|
1595
|
+
ok: true,
|
|
1596
|
+
execution_package_ref: summary.execution_package_ref || null,
|
|
1597
|
+
target_surface: "/v1/proof-center/result-package-handoff/review/execution-package",
|
|
1598
|
+
request_template: {
|
|
1599
|
+
handoff_bundle: handoff
|
|
1600
|
+
},
|
|
1601
|
+
stable_boundary_ids: Array.isArray(summary.stable_execution_package_ids) ? summary.stable_execution_package_ids : []
|
|
1602
|
+
}
|
|
1603
|
+
};
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
function buildPreparedContinuationDefaultExecutionPackageSummary(portableHandoff, continuation) {
|
|
1607
|
+
const executionPackage = buildPreparedContinuationAdapterReadyExecutionPackageSummary(portableHandoff, continuation);
|
|
1608
|
+
return {
|
|
1609
|
+
ok: executionPackage.ok === true,
|
|
1610
|
+
execution_package_ref: executionPackage.execution_package_ref || null,
|
|
1611
|
+
default_execution_package_ref: executionPackage.execution_package_ref
|
|
1612
|
+
? `default.${executionPackage.execution_package_ref}`
|
|
1613
|
+
: null,
|
|
1614
|
+
stable_default_execution_package_ids: Array.isArray(executionPackage.stable_execution_package_ids)
|
|
1615
|
+
? executionPackage.stable_execution_package_ids
|
|
1616
|
+
: [],
|
|
1617
|
+
default_execution_package_carry: executionPackage.execution_package_carry || {},
|
|
1618
|
+
execution_ready_by_default: executionPackage.adapter_ready === true,
|
|
1619
|
+
next_surface: "/v1/proof-center/result-package-handoff/review/execution-package-run"
|
|
1620
|
+
};
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1571
1623
|
function buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation) {
|
|
1572
1624
|
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1573
1625
|
return {
|
|
@@ -3100,6 +3152,99 @@ async function routeRequest(req, res) {
|
|
|
3100
3152
|
return;
|
|
3101
3153
|
}
|
|
3102
3154
|
|
|
3155
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/execution-package-summary") {
|
|
3156
|
+
const body = await readJsonBody(req);
|
|
3157
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3158
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3159
|
+
if (!continuation) {
|
|
3160
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3161
|
+
return;
|
|
3162
|
+
}
|
|
3163
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3164
|
+
if (!resultPackage) {
|
|
3165
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3166
|
+
return;
|
|
3167
|
+
}
|
|
3168
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3169
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3170
|
+
spine_path_ref: resultPackage.source_ref
|
|
3171
|
+
});
|
|
3172
|
+
if (!payload) {
|
|
3173
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3174
|
+
return;
|
|
3175
|
+
}
|
|
3176
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3177
|
+
if (result.status !== 200) {
|
|
3178
|
+
sendJson(res, result.status, result.payload);
|
|
3179
|
+
return;
|
|
3180
|
+
}
|
|
3181
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3182
|
+
sendJson(res, 200, buildPreparedContinuationAdapterReadyExecutionPackageSummary(portableHandoff, continuation));
|
|
3183
|
+
return;
|
|
3184
|
+
}
|
|
3185
|
+
|
|
3186
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/execution-package-bundle") {
|
|
3187
|
+
const body = await readJsonBody(req);
|
|
3188
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3189
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3190
|
+
if (!continuation) {
|
|
3191
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3192
|
+
return;
|
|
3193
|
+
}
|
|
3194
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3195
|
+
if (!resultPackage) {
|
|
3196
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3197
|
+
return;
|
|
3198
|
+
}
|
|
3199
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3200
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3201
|
+
spine_path_ref: resultPackage.source_ref
|
|
3202
|
+
});
|
|
3203
|
+
if (!payload) {
|
|
3204
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3205
|
+
return;
|
|
3206
|
+
}
|
|
3207
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3208
|
+
if (result.status !== 200) {
|
|
3209
|
+
sendJson(res, result.status, result.payload);
|
|
3210
|
+
return;
|
|
3211
|
+
}
|
|
3212
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3213
|
+
sendJson(res, 200, buildPreparedContinuationAdapterReadyExecutionPackageBundle(portableHandoff, continuation));
|
|
3214
|
+
return;
|
|
3215
|
+
}
|
|
3216
|
+
|
|
3217
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/execution-package-default-summary") {
|
|
3218
|
+
const body = await readJsonBody(req);
|
|
3219
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
3220
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
3221
|
+
if (!continuation) {
|
|
3222
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3223
|
+
return;
|
|
3224
|
+
}
|
|
3225
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
3226
|
+
if (!resultPackage) {
|
|
3227
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
3228
|
+
return;
|
|
3229
|
+
}
|
|
3230
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
3231
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
3232
|
+
spine_path_ref: resultPackage.source_ref
|
|
3233
|
+
});
|
|
3234
|
+
if (!payload) {
|
|
3235
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
3236
|
+
return;
|
|
3237
|
+
}
|
|
3238
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
3239
|
+
if (result.status !== 200) {
|
|
3240
|
+
sendJson(res, result.status, result.payload);
|
|
3241
|
+
return;
|
|
3242
|
+
}
|
|
3243
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
3244
|
+
sendJson(res, 200, buildPreparedContinuationDefaultExecutionPackageSummary(portableHandoff, continuation));
|
|
3245
|
+
return;
|
|
3246
|
+
}
|
|
3247
|
+
|
|
3103
3248
|
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/contract-template") {
|
|
3104
3249
|
const body = await readJsonBody(req);
|
|
3105
3250
|
const continuationRef = String(body && body.continuation_ref || "").trim();
|