xytara 1.14.0 → 1.15.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 +73 -0
- package/package.json +1 -1
- package/server.js +201 -0
package/README.md
CHANGED
|
@@ -154,6 +154,15 @@ The current `1.14.0` line starts hardening that reusable path into a clearer pub
|
|
|
154
154
|
|
|
155
155
|
This is intended to make the transaction-side continuation path easier to treat as a stable public contract instead of only a strong reusable default.
|
|
156
156
|
|
|
157
|
+
The current `1.15.0` line starts turning that same contract path into a clearer adapter-ready public bridge:
|
|
158
|
+
|
|
159
|
+
- prepared-artifact bridge summaries on top of the composition-contract continuation path
|
|
160
|
+
- bridge template surfaces that package the next proof-side review request directly
|
|
161
|
+
- compact bridge bundles for direct transaction-side bridge reuse
|
|
162
|
+
- compact bridge-carry surfaces for direct transaction-side bridge reuse
|
|
163
|
+
|
|
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
|
+
|
|
157
166
|
## Package Surface
|
|
158
167
|
|
|
159
168
|
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
|
@@ -1187,6 +1187,12 @@ function summarizeInteractionResultPackageContinuationPreparationPayload(payload
|
|
|
1187
1187
|
const compositionContractTemplate = item.composition_contract_template && typeof item.composition_contract_template === "object"
|
|
1188
1188
|
? item.composition_contract_template
|
|
1189
1189
|
: {};
|
|
1190
|
+
const adapterBridge = item.adapter_bridge_summary && typeof item.adapter_bridge_summary === "object"
|
|
1191
|
+
? item.adapter_bridge_summary
|
|
1192
|
+
: {};
|
|
1193
|
+
const adapterBridgeTemplate = item.adapter_bridge_template && typeof item.adapter_bridge_template === "object"
|
|
1194
|
+
? item.adapter_bridge_template
|
|
1195
|
+
: {};
|
|
1190
1196
|
return {
|
|
1191
1197
|
ok: item.ok === true,
|
|
1192
1198
|
continuation_ref: continuation ? continuation.continuation_ref : null,
|
|
@@ -1212,9 +1218,12 @@ function summarizeInteractionResultPackageContinuationPreparationPayload(payload
|
|
|
1212
1218
|
reusable_by_default: reusableDefault.default_followthrough && reusableDefault.default_followthrough.reusable_by_default === true,
|
|
1213
1219
|
composition_contract_ref: compositionContract.composition_contract_ref || null,
|
|
1214
1220
|
contract_ready: compositionContract.contract_ready === true,
|
|
1221
|
+
adapter_bridge_ref: adapterBridge.adapter_bridge_ref || null,
|
|
1222
|
+
bridge_ready: adapterBridge.bridge_ready === true,
|
|
1215
1223
|
future_adapter_hook_count: Number(extension.future_adapter_hook_count || 0),
|
|
1216
1224
|
reusable_default_target_surface: reusableDefaultTemplate.target_surface || null,
|
|
1217
1225
|
composition_contract_target_surface: compositionContractTemplate.target_surface || null,
|
|
1226
|
+
adapter_bridge_target_surface: adapterBridgeTemplate.target_surface || null,
|
|
1218
1227
|
extension_target_surface: extensionTemplate.target_surface || null
|
|
1219
1228
|
};
|
|
1220
1229
|
}
|
|
@@ -4447,6 +4456,70 @@ class CommerceClient {
|
|
|
4447
4456
|
});
|
|
4448
4457
|
}
|
|
4449
4458
|
|
|
4459
|
+
async prepareInteractionResultPackageAdapterBridgeSummary(continuationRef, body, options) {
|
|
4460
|
+
const opts = options || {};
|
|
4461
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/bridge-summary", {
|
|
4462
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.bridge.summary",
|
|
4463
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4464
|
+
body: body || {},
|
|
4465
|
+
callback_url: opts.callbackUrl || null,
|
|
4466
|
+
settlement_mode: opts.settlementMode || null,
|
|
4467
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4468
|
+
protocol: opts.protocol || null,
|
|
4469
|
+
integration_id: opts.integrationId || null,
|
|
4470
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4471
|
+
integration_context: opts.integrationContext || null
|
|
4472
|
+
});
|
|
4473
|
+
}
|
|
4474
|
+
|
|
4475
|
+
async prepareInteractionResultPackageAdapterBridgeTemplate(continuationRef, body, options) {
|
|
4476
|
+
const opts = options || {};
|
|
4477
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/bridge-template", {
|
|
4478
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.bridge.template",
|
|
4479
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4480
|
+
body: body || {},
|
|
4481
|
+
callback_url: opts.callbackUrl || null,
|
|
4482
|
+
settlement_mode: opts.settlementMode || null,
|
|
4483
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4484
|
+
protocol: opts.protocol || null,
|
|
4485
|
+
integration_id: opts.integrationId || null,
|
|
4486
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4487
|
+
integration_context: opts.integrationContext || null
|
|
4488
|
+
});
|
|
4489
|
+
}
|
|
4490
|
+
|
|
4491
|
+
async prepareInteractionResultPackageAdapterBridgeBundle(continuationRef, body, options) {
|
|
4492
|
+
const opts = options || {};
|
|
4493
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/bridge-bundle", {
|
|
4494
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.bridge.bundle",
|
|
4495
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4496
|
+
body: body || {},
|
|
4497
|
+
callback_url: opts.callbackUrl || null,
|
|
4498
|
+
settlement_mode: opts.settlementMode || null,
|
|
4499
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4500
|
+
protocol: opts.protocol || null,
|
|
4501
|
+
integration_id: opts.integrationId || null,
|
|
4502
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4503
|
+
integration_context: opts.integrationContext || null
|
|
4504
|
+
});
|
|
4505
|
+
}
|
|
4506
|
+
|
|
4507
|
+
async prepareInteractionResultPackageAdapterBridgeCarry(continuationRef, body, options) {
|
|
4508
|
+
const opts = options || {};
|
|
4509
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/bridge-carry", {
|
|
4510
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.bridge.carry",
|
|
4511
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4512
|
+
body: body || {},
|
|
4513
|
+
callback_url: opts.callbackUrl || null,
|
|
4514
|
+
settlement_mode: opts.settlementMode || null,
|
|
4515
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4516
|
+
protocol: opts.protocol || null,
|
|
4517
|
+
integration_id: opts.integrationId || null,
|
|
4518
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4519
|
+
integration_context: opts.integrationContext || null
|
|
4520
|
+
});
|
|
4521
|
+
}
|
|
4522
|
+
|
|
4450
4523
|
async runNamedTaskRoute(path, payload) {
|
|
4451
4524
|
if (!this.apiKey || !this.walletId || !this.walletSecret) {
|
|
4452
4525
|
throw new Error("named task routes require apiKey, walletId, and walletSecret");
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -1339,6 +1339,81 @@ function buildPreparedContinuationCompositionContractBundle(portableHandoff, con
|
|
|
1339
1339
|
};
|
|
1340
1340
|
}
|
|
1341
1341
|
|
|
1342
|
+
function buildPreparedContinuationAdapterBridgeSummary(portableHandoff, continuation) {
|
|
1343
|
+
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1344
|
+
const contract = buildPreparedContinuationCompositionContractSummary(portableHandoff, continuation);
|
|
1345
|
+
return {
|
|
1346
|
+
ok: true,
|
|
1347
|
+
adapter_bridge_ref: continuation && continuation.continuation_ref
|
|
1348
|
+
? `bridge.${continuation.continuation_ref}`
|
|
1349
|
+
: null,
|
|
1350
|
+
composition_contract_ref: contract.composition_contract_ref || null,
|
|
1351
|
+
stable_bridge_ids: [
|
|
1352
|
+
"prepared_artifact_bridge",
|
|
1353
|
+
"review_bridge_summary",
|
|
1354
|
+
"proof_run"
|
|
1355
|
+
],
|
|
1356
|
+
bridge_carry: {
|
|
1357
|
+
execution_context: {
|
|
1358
|
+
committed_ref: handoff.committed_ref || null,
|
|
1359
|
+
stable: Boolean(handoff.committed_ref)
|
|
1360
|
+
},
|
|
1361
|
+
economic_context: {
|
|
1362
|
+
payment_protocol: handoff.payment_protocol || null,
|
|
1363
|
+
settlement_mode: handoff.settlement_mode || null
|
|
1364
|
+
},
|
|
1365
|
+
proof_context: {
|
|
1366
|
+
source_ref: handoff.source_ref || null,
|
|
1367
|
+
proof_ref: handoff.proof_ref || null
|
|
1368
|
+
}
|
|
1369
|
+
},
|
|
1370
|
+
default_only_summary_ids: [
|
|
1371
|
+
"reusable_default_summary",
|
|
1372
|
+
"reusable_default_template"
|
|
1373
|
+
],
|
|
1374
|
+
bridge_ready: contract.contract_ready === true,
|
|
1375
|
+
next_surface: "/v1/proof-center/result-package-handoff/review/bridge-summary"
|
|
1376
|
+
};
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
function buildPreparedContinuationAdapterBridgeTemplate(portableHandoff, continuation) {
|
|
1380
|
+
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1381
|
+
const summary = buildPreparedContinuationAdapterBridgeSummary(portableHandoff, continuation);
|
|
1382
|
+
return {
|
|
1383
|
+
ok: true,
|
|
1384
|
+
adapter_bridge_ref: summary.adapter_bridge_ref || null,
|
|
1385
|
+
target_surface: "/v1/proof-center/result-package-handoff/review/bridge-summary",
|
|
1386
|
+
request_template: {
|
|
1387
|
+
handoff_bundle: handoff
|
|
1388
|
+
},
|
|
1389
|
+
stable_boundary_ids: [
|
|
1390
|
+
"prepared_artifact_bridge",
|
|
1391
|
+
"review_bridge_summary",
|
|
1392
|
+
"proof_run"
|
|
1393
|
+
]
|
|
1394
|
+
};
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
function buildPreparedContinuationAdapterBridgeBundle(portableHandoff, continuation) {
|
|
1398
|
+
return {
|
|
1399
|
+
ok: true,
|
|
1400
|
+
adapter_bridge_summary: buildPreparedContinuationAdapterBridgeSummary(portableHandoff, continuation),
|
|
1401
|
+
adapter_bridge_template: buildPreparedContinuationAdapterBridgeTemplate(portableHandoff, continuation)
|
|
1402
|
+
};
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
function buildPreparedContinuationAdapterBridgeCarry(portableHandoff, continuation) {
|
|
1406
|
+
const summary = buildPreparedContinuationAdapterBridgeSummary(portableHandoff, continuation);
|
|
1407
|
+
return {
|
|
1408
|
+
ok: true,
|
|
1409
|
+
adapter_bridge_ref: summary.adapter_bridge_ref || null,
|
|
1410
|
+
stable_bridge_ids: Array.isArray(summary.stable_bridge_ids) ? summary.stable_bridge_ids : [],
|
|
1411
|
+
bridge_carry: summary.bridge_carry || {},
|
|
1412
|
+
bridge_ready: summary.bridge_ready === true,
|
|
1413
|
+
review_surface: "/v1/proof-center/result-package-handoff/review/bridge-carry"
|
|
1414
|
+
};
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1342
1417
|
function buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation) {
|
|
1343
1418
|
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1344
1419
|
return {
|
|
@@ -2298,6 +2373,7 @@ async function routeRequest(req, res) {
|
|
|
2298
2373
|
reusable_default_summary: buildPreparedContinuationReusableDefaultSummary(portableHandoff, continuation),
|
|
2299
2374
|
reusable_default_template: buildPreparedContinuationReusableDefaultTemplate(portableHandoff, continuation),
|
|
2300
2375
|
...buildPreparedContinuationCompositionContractBundle(portableHandoff, continuation),
|
|
2376
|
+
...buildPreparedContinuationAdapterBridgeBundle(portableHandoff, continuation),
|
|
2301
2377
|
extension_template: buildPreparedContinuationExtensionTemplate(portableHandoff, continuation),
|
|
2302
2378
|
proof_request_template: buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation)
|
|
2303
2379
|
});
|
|
@@ -2337,6 +2413,7 @@ async function routeRequest(req, res) {
|
|
|
2337
2413
|
reusable_default_summary: buildPreparedContinuationReusableDefaultSummary(portableHandoff, continuation),
|
|
2338
2414
|
reusable_default_template: buildPreparedContinuationReusableDefaultTemplate(portableHandoff, continuation),
|
|
2339
2415
|
...buildPreparedContinuationCompositionContractBundle(portableHandoff, continuation),
|
|
2416
|
+
...buildPreparedContinuationAdapterBridgeBundle(portableHandoff, continuation),
|
|
2340
2417
|
extension_template: buildPreparedContinuationExtensionTemplate(portableHandoff, continuation)
|
|
2341
2418
|
});
|
|
2342
2419
|
return;
|
|
@@ -2435,6 +2512,130 @@ async function routeRequest(req, res) {
|
|
|
2435
2512
|
return;
|
|
2436
2513
|
}
|
|
2437
2514
|
|
|
2515
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/bridge-summary") {
|
|
2516
|
+
const body = await readJsonBody(req);
|
|
2517
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2518
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2519
|
+
if (!continuation) {
|
|
2520
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2521
|
+
return;
|
|
2522
|
+
}
|
|
2523
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2524
|
+
if (!resultPackage) {
|
|
2525
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2526
|
+
return;
|
|
2527
|
+
}
|
|
2528
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2529
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2530
|
+
spine_path_ref: resultPackage.source_ref
|
|
2531
|
+
});
|
|
2532
|
+
if (!payload) {
|
|
2533
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2534
|
+
return;
|
|
2535
|
+
}
|
|
2536
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2537
|
+
if (result.status !== 200) {
|
|
2538
|
+
sendJson(res, result.status, result.payload);
|
|
2539
|
+
return;
|
|
2540
|
+
}
|
|
2541
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2542
|
+
sendJson(res, 200, buildPreparedContinuationAdapterBridgeSummary(portableHandoff, continuation));
|
|
2543
|
+
return;
|
|
2544
|
+
}
|
|
2545
|
+
|
|
2546
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/bridge-template") {
|
|
2547
|
+
const body = await readJsonBody(req);
|
|
2548
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2549
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2550
|
+
if (!continuation) {
|
|
2551
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2552
|
+
return;
|
|
2553
|
+
}
|
|
2554
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2555
|
+
if (!resultPackage) {
|
|
2556
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2557
|
+
return;
|
|
2558
|
+
}
|
|
2559
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2560
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2561
|
+
spine_path_ref: resultPackage.source_ref
|
|
2562
|
+
});
|
|
2563
|
+
if (!payload) {
|
|
2564
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2565
|
+
return;
|
|
2566
|
+
}
|
|
2567
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2568
|
+
if (result.status !== 200) {
|
|
2569
|
+
sendJson(res, result.status, result.payload);
|
|
2570
|
+
return;
|
|
2571
|
+
}
|
|
2572
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2573
|
+
sendJson(res, 200, buildPreparedContinuationAdapterBridgeTemplate(portableHandoff, continuation));
|
|
2574
|
+
return;
|
|
2575
|
+
}
|
|
2576
|
+
|
|
2577
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/bridge-bundle") {
|
|
2578
|
+
const body = await readJsonBody(req);
|
|
2579
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2580
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2581
|
+
if (!continuation) {
|
|
2582
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2583
|
+
return;
|
|
2584
|
+
}
|
|
2585
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2586
|
+
if (!resultPackage) {
|
|
2587
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2588
|
+
return;
|
|
2589
|
+
}
|
|
2590
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2591
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2592
|
+
spine_path_ref: resultPackage.source_ref
|
|
2593
|
+
});
|
|
2594
|
+
if (!payload) {
|
|
2595
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2596
|
+
return;
|
|
2597
|
+
}
|
|
2598
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2599
|
+
if (result.status !== 200) {
|
|
2600
|
+
sendJson(res, result.status, result.payload);
|
|
2601
|
+
return;
|
|
2602
|
+
}
|
|
2603
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2604
|
+
sendJson(res, 200, buildPreparedContinuationAdapterBridgeBundle(portableHandoff, continuation));
|
|
2605
|
+
return;
|
|
2606
|
+
}
|
|
2607
|
+
|
|
2608
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/bridge-carry") {
|
|
2609
|
+
const body = await readJsonBody(req);
|
|
2610
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2611
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2612
|
+
if (!continuation) {
|
|
2613
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2614
|
+
return;
|
|
2615
|
+
}
|
|
2616
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2617
|
+
if (!resultPackage) {
|
|
2618
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2619
|
+
return;
|
|
2620
|
+
}
|
|
2621
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2622
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2623
|
+
spine_path_ref: resultPackage.source_ref
|
|
2624
|
+
});
|
|
2625
|
+
if (!payload) {
|
|
2626
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2627
|
+
return;
|
|
2628
|
+
}
|
|
2629
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2630
|
+
if (result.status !== 200) {
|
|
2631
|
+
sendJson(res, result.status, result.payload);
|
|
2632
|
+
return;
|
|
2633
|
+
}
|
|
2634
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2635
|
+
sendJson(res, 200, buildPreparedContinuationAdapterBridgeCarry(portableHandoff, continuation));
|
|
2636
|
+
return;
|
|
2637
|
+
}
|
|
2638
|
+
|
|
2438
2639
|
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/contract-template") {
|
|
2439
2640
|
const body = await readJsonBody(req);
|
|
2440
2641
|
const continuationRef = String(body && body.continuation_ref || "").trim();
|