xytara 1.13.0 → 1.14.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 +57 -0
- package/package.json +1 -1
- package/server.js +160 -0
package/README.md
CHANGED
|
@@ -145,6 +145,15 @@ The current `1.10.0` line starts building on that by exposing reusable continuat
|
|
|
145
145
|
|
|
146
146
|
This is intended to make the public stack easier to compose after grouped execution, not just easier to inspect.
|
|
147
147
|
|
|
148
|
+
The current `1.14.0` line starts hardening that reusable path into a clearer public composition contract:
|
|
149
|
+
|
|
150
|
+
- prepared-artifact composition-contract summaries
|
|
151
|
+
- composition-contract template surfaces for proof-side contract review
|
|
152
|
+
- compact composition-contract bundles for direct transaction-side contract reuse
|
|
153
|
+
- clearer public contract ids across the reusable-default continuation path
|
|
154
|
+
|
|
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
|
+
|
|
148
157
|
## Package Surface
|
|
149
158
|
|
|
150
159
|
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
|
@@ -1181,6 +1181,12 @@ function summarizeInteractionResultPackageContinuationPreparationPayload(payload
|
|
|
1181
1181
|
const reusableDefaultTemplate = item.reusable_default_template && typeof item.reusable_default_template === "object"
|
|
1182
1182
|
? item.reusable_default_template
|
|
1183
1183
|
: {};
|
|
1184
|
+
const compositionContract = item.composition_contract_summary && typeof item.composition_contract_summary === "object"
|
|
1185
|
+
? item.composition_contract_summary
|
|
1186
|
+
: {};
|
|
1187
|
+
const compositionContractTemplate = item.composition_contract_template && typeof item.composition_contract_template === "object"
|
|
1188
|
+
? item.composition_contract_template
|
|
1189
|
+
: {};
|
|
1184
1190
|
return {
|
|
1185
1191
|
ok: item.ok === true,
|
|
1186
1192
|
continuation_ref: continuation ? continuation.continuation_ref : null,
|
|
@@ -1204,8 +1210,11 @@ function summarizeInteractionResultPackageContinuationPreparationPayload(payload
|
|
|
1204
1210
|
),
|
|
1205
1211
|
proof_ready: artifact.durable_path && artifact.durable_path.proof_ready === true,
|
|
1206
1212
|
reusable_by_default: reusableDefault.default_followthrough && reusableDefault.default_followthrough.reusable_by_default === true,
|
|
1213
|
+
composition_contract_ref: compositionContract.composition_contract_ref || null,
|
|
1214
|
+
contract_ready: compositionContract.contract_ready === true,
|
|
1207
1215
|
future_adapter_hook_count: Number(extension.future_adapter_hook_count || 0),
|
|
1208
1216
|
reusable_default_target_surface: reusableDefaultTemplate.target_surface || null,
|
|
1217
|
+
composition_contract_target_surface: compositionContractTemplate.target_surface || null,
|
|
1209
1218
|
extension_target_surface: extensionTemplate.target_surface || null
|
|
1210
1219
|
};
|
|
1211
1220
|
}
|
|
@@ -4390,6 +4399,54 @@ class CommerceClient {
|
|
|
4390
4399
|
});
|
|
4391
4400
|
}
|
|
4392
4401
|
|
|
4402
|
+
async prepareInteractionResultPackageCompositionContractSummary(continuationRef, body, options) {
|
|
4403
|
+
const opts = options || {};
|
|
4404
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/contract-summary", {
|
|
4405
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.contract.summary",
|
|
4406
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4407
|
+
body: body || {},
|
|
4408
|
+
callback_url: opts.callbackUrl || null,
|
|
4409
|
+
settlement_mode: opts.settlementMode || null,
|
|
4410
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4411
|
+
protocol: opts.protocol || null,
|
|
4412
|
+
integration_id: opts.integrationId || null,
|
|
4413
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4414
|
+
integration_context: opts.integrationContext || null
|
|
4415
|
+
});
|
|
4416
|
+
}
|
|
4417
|
+
|
|
4418
|
+
async prepareInteractionResultPackageCompositionContractBundle(continuationRef, body, options) {
|
|
4419
|
+
const opts = options || {};
|
|
4420
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/contract-bundle", {
|
|
4421
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.contract.bundle",
|
|
4422
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4423
|
+
body: body || {},
|
|
4424
|
+
callback_url: opts.callbackUrl || null,
|
|
4425
|
+
settlement_mode: opts.settlementMode || null,
|
|
4426
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4427
|
+
protocol: opts.protocol || null,
|
|
4428
|
+
integration_id: opts.integrationId || null,
|
|
4429
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4430
|
+
integration_context: opts.integrationContext || null
|
|
4431
|
+
});
|
|
4432
|
+
}
|
|
4433
|
+
|
|
4434
|
+
async prepareInteractionResultPackageCompositionContractTemplate(continuationRef, body, options) {
|
|
4435
|
+
const opts = options || {};
|
|
4436
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare/contract-template", {
|
|
4437
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.contract.template",
|
|
4438
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4439
|
+
body: body || {},
|
|
4440
|
+
callback_url: opts.callbackUrl || null,
|
|
4441
|
+
settlement_mode: opts.settlementMode || null,
|
|
4442
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4443
|
+
protocol: opts.protocol || null,
|
|
4444
|
+
integration_id: opts.integrationId || null,
|
|
4445
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4446
|
+
integration_context: opts.integrationContext || null
|
|
4447
|
+
});
|
|
4448
|
+
}
|
|
4449
|
+
|
|
4393
4450
|
async runNamedTaskRoute(path, payload) {
|
|
4394
4451
|
if (!this.apiKey || !this.walletId || !this.walletSecret) {
|
|
4395
4452
|
throw new Error("named task routes require apiKey, walletId, and walletSecret");
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -1274,6 +1274,71 @@ function buildPreparedContinuationReusableDefaultTemplate(portableHandoff, conti
|
|
|
1274
1274
|
};
|
|
1275
1275
|
}
|
|
1276
1276
|
|
|
1277
|
+
function buildPreparedContinuationCompositionContractSummary(portableHandoff, continuation) {
|
|
1278
|
+
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1279
|
+
const reusableDefault = buildPreparedContinuationReusableDefaultSummary(portableHandoff, continuation);
|
|
1280
|
+
const seamLayers = Array.isArray(handoff.seam_layers) ? handoff.seam_layers : [];
|
|
1281
|
+
return {
|
|
1282
|
+
ok: true,
|
|
1283
|
+
composition_contract_ref: continuation && continuation.continuation_ref
|
|
1284
|
+
? `contract.${continuation.continuation_ref}`
|
|
1285
|
+
: null,
|
|
1286
|
+
reusable_default_ref: reusableDefault.reusable_default_ref || null,
|
|
1287
|
+
public_contract_ids: [
|
|
1288
|
+
"prepared_artifact",
|
|
1289
|
+
"reusable_default_review",
|
|
1290
|
+
"proof_run"
|
|
1291
|
+
],
|
|
1292
|
+
contract_carry: {
|
|
1293
|
+
execution_context: {
|
|
1294
|
+
committed_ref: handoff.committed_ref || null,
|
|
1295
|
+
stable: Boolean(handoff.committed_ref)
|
|
1296
|
+
},
|
|
1297
|
+
economic_context: {
|
|
1298
|
+
payment_protocol: handoff.payment_protocol || null,
|
|
1299
|
+
settlement_mode: handoff.settlement_mode || null,
|
|
1300
|
+
treasury_destination_id: handoff.treasury_destination_id || null
|
|
1301
|
+
},
|
|
1302
|
+
proof_context: {
|
|
1303
|
+
source_ref: handoff.source_ref || null,
|
|
1304
|
+
seam_layer_count: seamLayers.length
|
|
1305
|
+
}
|
|
1306
|
+
},
|
|
1307
|
+
helper_only_summary_ids: [
|
|
1308
|
+
"extension_seam_summary",
|
|
1309
|
+
"portable_handoff_summary"
|
|
1310
|
+
],
|
|
1311
|
+
contract_ready: reusableDefault.default_followthrough && reusableDefault.default_followthrough.reusable_by_default === true,
|
|
1312
|
+
next_surface: "/v1/proof-center/result-package-handoff/review/contract-summary"
|
|
1313
|
+
};
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
function buildPreparedContinuationCompositionContractTemplate(portableHandoff, continuation) {
|
|
1317
|
+
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1318
|
+
const summary = buildPreparedContinuationCompositionContractSummary(portableHandoff, continuation);
|
|
1319
|
+
return {
|
|
1320
|
+
ok: true,
|
|
1321
|
+
composition_contract_ref: summary.composition_contract_ref || null,
|
|
1322
|
+
target_surface: "/v1/proof-center/result-package-handoff/review/contract-summary",
|
|
1323
|
+
request_template: {
|
|
1324
|
+
handoff_bundle: handoff
|
|
1325
|
+
},
|
|
1326
|
+
stable_boundary_ids: [
|
|
1327
|
+
"prepared_artifact_contract",
|
|
1328
|
+
"review_contract_summary",
|
|
1329
|
+
"proof_run"
|
|
1330
|
+
]
|
|
1331
|
+
};
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
function buildPreparedContinuationCompositionContractBundle(portableHandoff, continuation) {
|
|
1335
|
+
return {
|
|
1336
|
+
ok: true,
|
|
1337
|
+
composition_contract_summary: buildPreparedContinuationCompositionContractSummary(portableHandoff, continuation),
|
|
1338
|
+
composition_contract_template: buildPreparedContinuationCompositionContractTemplate(portableHandoff, continuation)
|
|
1339
|
+
};
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1277
1342
|
function buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation) {
|
|
1278
1343
|
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1279
1344
|
return {
|
|
@@ -2232,6 +2297,7 @@ async function routeRequest(req, res) {
|
|
|
2232
2297
|
extension_seam_summary: buildPreparedContinuationExtensionSeamSummary(portableHandoff, continuation),
|
|
2233
2298
|
reusable_default_summary: buildPreparedContinuationReusableDefaultSummary(portableHandoff, continuation),
|
|
2234
2299
|
reusable_default_template: buildPreparedContinuationReusableDefaultTemplate(portableHandoff, continuation),
|
|
2300
|
+
...buildPreparedContinuationCompositionContractBundle(portableHandoff, continuation),
|
|
2235
2301
|
extension_template: buildPreparedContinuationExtensionTemplate(portableHandoff, continuation),
|
|
2236
2302
|
proof_request_template: buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation)
|
|
2237
2303
|
});
|
|
@@ -2270,6 +2336,7 @@ async function routeRequest(req, res) {
|
|
|
2270
2336
|
extension_seam_summary: buildPreparedContinuationExtensionSeamSummary(portableHandoff, continuation),
|
|
2271
2337
|
reusable_default_summary: buildPreparedContinuationReusableDefaultSummary(portableHandoff, continuation),
|
|
2272
2338
|
reusable_default_template: buildPreparedContinuationReusableDefaultTemplate(portableHandoff, continuation),
|
|
2339
|
+
...buildPreparedContinuationCompositionContractBundle(portableHandoff, continuation),
|
|
2273
2340
|
extension_template: buildPreparedContinuationExtensionTemplate(portableHandoff, continuation)
|
|
2274
2341
|
});
|
|
2275
2342
|
return;
|
|
@@ -2306,6 +2373,99 @@ async function routeRequest(req, res) {
|
|
|
2306
2373
|
return;
|
|
2307
2374
|
}
|
|
2308
2375
|
|
|
2376
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/contract-summary") {
|
|
2377
|
+
const body = await readJsonBody(req);
|
|
2378
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2379
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2380
|
+
if (!continuation) {
|
|
2381
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2382
|
+
return;
|
|
2383
|
+
}
|
|
2384
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2385
|
+
if (!resultPackage) {
|
|
2386
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2387
|
+
return;
|
|
2388
|
+
}
|
|
2389
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2390
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2391
|
+
spine_path_ref: resultPackage.source_ref
|
|
2392
|
+
});
|
|
2393
|
+
if (!payload) {
|
|
2394
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2395
|
+
return;
|
|
2396
|
+
}
|
|
2397
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2398
|
+
if (result.status !== 200) {
|
|
2399
|
+
sendJson(res, result.status, result.payload);
|
|
2400
|
+
return;
|
|
2401
|
+
}
|
|
2402
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2403
|
+
sendJson(res, 200, buildPreparedContinuationCompositionContractSummary(portableHandoff, continuation));
|
|
2404
|
+
return;
|
|
2405
|
+
}
|
|
2406
|
+
|
|
2407
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/contract-bundle") {
|
|
2408
|
+
const body = await readJsonBody(req);
|
|
2409
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2410
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2411
|
+
if (!continuation) {
|
|
2412
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2413
|
+
return;
|
|
2414
|
+
}
|
|
2415
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2416
|
+
if (!resultPackage) {
|
|
2417
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2418
|
+
return;
|
|
2419
|
+
}
|
|
2420
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2421
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2422
|
+
spine_path_ref: resultPackage.source_ref
|
|
2423
|
+
});
|
|
2424
|
+
if (!payload) {
|
|
2425
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2426
|
+
return;
|
|
2427
|
+
}
|
|
2428
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2429
|
+
if (result.status !== 200) {
|
|
2430
|
+
sendJson(res, result.status, result.payload);
|
|
2431
|
+
return;
|
|
2432
|
+
}
|
|
2433
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2434
|
+
sendJson(res, 200, buildPreparedContinuationCompositionContractBundle(portableHandoff, continuation));
|
|
2435
|
+
return;
|
|
2436
|
+
}
|
|
2437
|
+
|
|
2438
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/contract-template") {
|
|
2439
|
+
const body = await readJsonBody(req);
|
|
2440
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2441
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2442
|
+
if (!continuation) {
|
|
2443
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2444
|
+
return;
|
|
2445
|
+
}
|
|
2446
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2447
|
+
if (!resultPackage) {
|
|
2448
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2449
|
+
return;
|
|
2450
|
+
}
|
|
2451
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2452
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2453
|
+
spine_path_ref: resultPackage.source_ref
|
|
2454
|
+
});
|
|
2455
|
+
if (!payload) {
|
|
2456
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2457
|
+
return;
|
|
2458
|
+
}
|
|
2459
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2460
|
+
if (result.status !== 200) {
|
|
2461
|
+
sendJson(res, result.status, result.payload);
|
|
2462
|
+
return;
|
|
2463
|
+
}
|
|
2464
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2465
|
+
sendJson(res, 200, buildPreparedContinuationCompositionContractTemplate(portableHandoff, continuation));
|
|
2466
|
+
return;
|
|
2467
|
+
}
|
|
2468
|
+
|
|
2309
2469
|
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare/default-template") {
|
|
2310
2470
|
const body = await readJsonBody(req);
|
|
2311
2471
|
const continuationRef = String(body && body.continuation_ref || "").trim();
|