xytara 1.9.0 → 1.10.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/catalog_contract.js +64 -0
- package/lib/commerce_client.js +134 -0
- package/package.json +1 -1
- package/server.js +139 -0
package/README.md
CHANGED
|
@@ -130,6 +130,15 @@ The current `1.9.0` line starts hardening the output side of that spine into cle
|
|
|
130
130
|
|
|
131
131
|
This is intended to make grouped spine outputs easier to treat as stable artifacts and future adapter-ready boundaries instead of one-off route responses.
|
|
132
132
|
|
|
133
|
+
The current `1.10.0` line starts building on that by exposing reusable continuation templates on top of result packages:
|
|
134
|
+
|
|
135
|
+
- result-package continuation catalog, summary, and detail routes
|
|
136
|
+
- direct continuation run surfaces that preserve the default next proof path
|
|
137
|
+
- continuation preparation surfaces that emit proof-ready request templates
|
|
138
|
+
- continuation summaries that make the default transaction-to-proof bridge explicit instead of inferred
|
|
139
|
+
|
|
140
|
+
This is intended to make the public stack easier to compose after grouped execution, not just easier to inspect.
|
|
141
|
+
|
|
133
142
|
## Package Surface
|
|
134
143
|
|
|
135
144
|
The SDK is broad, but it stays organized into a few repeatable families instead of one-off surfaces.
|
package/index.js
CHANGED
package/lib/catalog_contract.js
CHANGED
|
@@ -332,6 +332,31 @@ function buildInteractionResultPackages() {
|
|
|
332
332
|
}));
|
|
333
333
|
}
|
|
334
334
|
|
|
335
|
+
function buildInteractionResultPackageContinuationTemplates() {
|
|
336
|
+
return buildInteractionResultPackages().map((resultPackage) => ({
|
|
337
|
+
continuation_ref: resultPackage && resultPackage.result_package_ref
|
|
338
|
+
? `continue.${resultPackage.result_package_ref}`
|
|
339
|
+
: null,
|
|
340
|
+
result_package_ref: resultPackage && resultPackage.result_package_ref ? resultPackage.result_package_ref : null,
|
|
341
|
+
source_ref: resultPackage && resultPackage.source_ref ? resultPackage.source_ref : null,
|
|
342
|
+
title: resultPackage && resultPackage.title
|
|
343
|
+
? `${resultPackage.title} Continuation`
|
|
344
|
+
: "Interaction Result Package Continuation",
|
|
345
|
+
description: resultPackage && resultPackage.description
|
|
346
|
+
? `${resultPackage.description} Continue through the reusable default path into proof-native follow-through.`
|
|
347
|
+
: "Continue through the reusable default path into proof-native follow-through.",
|
|
348
|
+
continuation_kind: "proof_native_default",
|
|
349
|
+
default_next_surface: "/v1/transaction-center/result-package-continuations/run",
|
|
350
|
+
default_export_surface: "/v1/transaction-center/result-packages/export",
|
|
351
|
+
default_proof_surface: "/v1/proof-center/result-package-handoff/run",
|
|
352
|
+
committed_ref: resultPackage && resultPackage.committed_ref ? resultPackage.committed_ref : null,
|
|
353
|
+
precommit_pack_ref: resultPackage && resultPackage.precommit_pack_ref ? resultPackage.precommit_pack_ref : null,
|
|
354
|
+
seam_layers: Array.isArray(resultPackage && resultPackage.seam_layers) ? resultPackage.seam_layers : [],
|
|
355
|
+
required_inputs: Array.isArray(resultPackage && resultPackage.required_inputs) ? resultPackage.required_inputs : [],
|
|
356
|
+
optional_inputs: Array.isArray(resultPackage && resultPackage.optional_inputs) ? resultPackage.optional_inputs : []
|
|
357
|
+
}));
|
|
358
|
+
}
|
|
359
|
+
|
|
335
360
|
function buildDefaultTransactionCenter() {
|
|
336
361
|
const settlementProfiles = Array.isArray(catalog.settlement_profiles) ? catalog.settlement_profiles : [];
|
|
337
362
|
const defaultSettlementProfile = settlementProfiles[0] || null;
|
|
@@ -590,6 +615,20 @@ function buildInteractionResultPackageCatalog() {
|
|
|
590
615
|
};
|
|
591
616
|
}
|
|
592
617
|
|
|
618
|
+
function buildInteractionResultPackageContinuationCatalog() {
|
|
619
|
+
const center = buildDefaultTransactionCenter();
|
|
620
|
+
const templates = buildInteractionResultPackageContinuationTemplates();
|
|
621
|
+
return {
|
|
622
|
+
ok: true,
|
|
623
|
+
brand: center.brand,
|
|
624
|
+
product: "interaction result package continuations",
|
|
625
|
+
default_payment_protocol: center.default_payment && center.default_payment.protocol ? center.default_payment.protocol : null,
|
|
626
|
+
default_settlement_mode: center.default_settlement && center.default_settlement.settlement_mode ? center.default_settlement.settlement_mode : null,
|
|
627
|
+
continuation_count: templates.length,
|
|
628
|
+
continuations: templates
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
|
|
593
632
|
function summarizeTransactionClassPacks() {
|
|
594
633
|
const catalogResponse = buildTransactionClassPackCatalog();
|
|
595
634
|
const packs = Array.isArray(catalogResponse.class_packs) ? catalogResponse.class_packs : [];
|
|
@@ -655,6 +694,22 @@ function summarizeInteractionResultPackages() {
|
|
|
655
694
|
};
|
|
656
695
|
}
|
|
657
696
|
|
|
697
|
+
function summarizeInteractionResultPackageContinuations() {
|
|
698
|
+
const catalogResponse = buildInteractionResultPackageContinuationCatalog();
|
|
699
|
+
const templates = Array.isArray(catalogResponse.continuations) ? catalogResponse.continuations : [];
|
|
700
|
+
return {
|
|
701
|
+
ok: true,
|
|
702
|
+
brand: catalogResponse.brand,
|
|
703
|
+
product: catalogResponse.product,
|
|
704
|
+
default_payment_protocol: catalogResponse.default_payment_protocol,
|
|
705
|
+
default_settlement_mode: catalogResponse.default_settlement_mode,
|
|
706
|
+
continuation_count: templates.length,
|
|
707
|
+
continuation_refs: templates.map((entry) => entry && entry.continuation_ref).filter(Boolean),
|
|
708
|
+
result_package_refs: templates.map((entry) => entry && entry.result_package_ref).filter(Boolean),
|
|
709
|
+
continuations: templates
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
|
|
658
713
|
function getTransactionClassPack(ref) {
|
|
659
714
|
const normalized = String(ref || "").trim();
|
|
660
715
|
if (!normalized) return null;
|
|
@@ -679,6 +734,12 @@ function getInteractionResultPackage(ref) {
|
|
|
679
734
|
return buildInteractionResultPackages().find((entry) => entry && entry.result_package_ref === normalized) || null;
|
|
680
735
|
}
|
|
681
736
|
|
|
737
|
+
function getInteractionResultPackageContinuation(ref) {
|
|
738
|
+
const normalized = String(ref || "").trim();
|
|
739
|
+
if (!normalized) return null;
|
|
740
|
+
return buildInteractionResultPackageContinuationTemplates().find((entry) => entry && entry.continuation_ref === normalized) || null;
|
|
741
|
+
}
|
|
742
|
+
|
|
682
743
|
function buildCatalogResponse() {
|
|
683
744
|
return {
|
|
684
745
|
ok: true,
|
|
@@ -814,6 +875,7 @@ module.exports = {
|
|
|
814
875
|
buildDefaultTransactionCenter,
|
|
815
876
|
buildDefaultTransactionGuidedLoopCatalog,
|
|
816
877
|
buildInteractionResultPackageCatalog,
|
|
878
|
+
buildInteractionResultPackageContinuationCatalog,
|
|
817
879
|
buildInteractionSpinePathCatalog,
|
|
818
880
|
buildPrecommitInteractionPackCatalog,
|
|
819
881
|
buildDefaultTransactionTaskPackCatalog,
|
|
@@ -822,6 +884,7 @@ module.exports = {
|
|
|
822
884
|
getDefaultTransactionGuidedLoop,
|
|
823
885
|
getDefaultTransactionTaskPack,
|
|
824
886
|
getInteractionResultPackage,
|
|
887
|
+
getInteractionResultPackageContinuation,
|
|
825
888
|
getInteractionSpinePath,
|
|
826
889
|
getPrecommitInteractionPack,
|
|
827
890
|
getTransactionClassPack,
|
|
@@ -833,6 +896,7 @@ module.exports = {
|
|
|
833
896
|
summarizeDefaultTransactionEconomics,
|
|
834
897
|
summarizeDefaultTransactionGuidedLoops,
|
|
835
898
|
summarizeDefaultTransactionTaskPacks,
|
|
899
|
+
summarizeInteractionResultPackageContinuations,
|
|
836
900
|
summarizeInteractionResultPackages,
|
|
837
901
|
summarizeInteractionSpinePaths,
|
|
838
902
|
summarizePrecommitInteractionPacks,
|
package/lib/commerce_client.js
CHANGED
|
@@ -1139,6 +1139,46 @@ function summarizeInteractionResultPackagePortableHandoffPayload(payload) {
|
|
|
1139
1139
|
};
|
|
1140
1140
|
}
|
|
1141
1141
|
|
|
1142
|
+
function summarizeInteractionResultPackageContinuationPayload(payload) {
|
|
1143
|
+
const item = payload && typeof payload === "object" ? payload : {};
|
|
1144
|
+
return {
|
|
1145
|
+
ok: item.ok === true,
|
|
1146
|
+
continuation_ref: item.continuation_ref || null,
|
|
1147
|
+
result_package_ref: item.result_package_ref || null,
|
|
1148
|
+
source_ref: item.source_ref || null,
|
|
1149
|
+
continuation_kind: item.continuation_kind || null,
|
|
1150
|
+
default_next_surface: item.default_next_surface || null,
|
|
1151
|
+
default_export_surface: item.default_export_surface || null,
|
|
1152
|
+
default_proof_surface: item.default_proof_surface || null,
|
|
1153
|
+
transaction_id: item.transaction_id || null,
|
|
1154
|
+
receipt_id: item.receipt_id || null,
|
|
1155
|
+
proof_ref: item.proof_ref || null,
|
|
1156
|
+
continuation_ready: item.continuation_ready === true,
|
|
1157
|
+
seam_layer_count: Number(item.seam_layer_count || 0)
|
|
1158
|
+
};
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
function summarizeInteractionResultPackageContinuationPreparationPayload(payload) {
|
|
1162
|
+
const item = payload && typeof payload === "object" ? payload : {};
|
|
1163
|
+
const continuation = item.continuation_summary && typeof item.continuation_summary === "object"
|
|
1164
|
+
? summarizeInteractionResultPackageContinuationPayload(item.continuation_summary)
|
|
1165
|
+
: null;
|
|
1166
|
+
const template = item.proof_request_template && typeof item.proof_request_template === "object"
|
|
1167
|
+
? item.proof_request_template
|
|
1168
|
+
: {};
|
|
1169
|
+
return {
|
|
1170
|
+
ok: item.ok === true,
|
|
1171
|
+
continuation_ref: continuation ? continuation.continuation_ref : null,
|
|
1172
|
+
result_package_ref: continuation ? continuation.result_package_ref : null,
|
|
1173
|
+
target_surface: template.target_surface || null,
|
|
1174
|
+
review_surface: template.review_surface || null,
|
|
1175
|
+
continuation_ready: continuation ? continuation.continuation_ready === true : false,
|
|
1176
|
+
evidence_ref_count: Array.isArray(template.request_template && template.request_template.evidence_refs)
|
|
1177
|
+
? template.request_template.evidence_refs.length
|
|
1178
|
+
: 0
|
|
1179
|
+
};
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1142
1182
|
function buildCatalogSummarySource(client) {
|
|
1143
1183
|
const baseCatalog = client && client.catalogCache && typeof client.catalogCache === "object"
|
|
1144
1184
|
? client.catalogCache
|
|
@@ -2781,6 +2821,30 @@ class CommerceClient {
|
|
|
2781
2821
|
return result && result.data ? result.data : null;
|
|
2782
2822
|
}
|
|
2783
2823
|
|
|
2824
|
+
async getInteractionResultPackageContinuations(forceRefresh) {
|
|
2825
|
+
if (!forceRefresh && this.catalogSummaryCache && this.catalogSummaryCache.resultPackageContinuations) {
|
|
2826
|
+
return this.catalogSummaryCache.resultPackageContinuations;
|
|
2827
|
+
}
|
|
2828
|
+
const result = await this.getJson("/v1/transaction-center/result-package-continuations");
|
|
2829
|
+
if (!forceRefresh) {
|
|
2830
|
+
this.catalogSummaryCache = this.catalogSummaryCache || {};
|
|
2831
|
+
this.catalogSummaryCache.resultPackageContinuations = result.data;
|
|
2832
|
+
}
|
|
2833
|
+
return result.data;
|
|
2834
|
+
}
|
|
2835
|
+
|
|
2836
|
+
async getInteractionResultPackageContinuationsSummary(forceRefresh) {
|
|
2837
|
+
const result = await this.getJson("/v1/transaction-center/result-package-continuations/summary");
|
|
2838
|
+
return result && result.data ? result.data : { ok: true, continuation_count: 0, continuation_refs: [], continuations: [] };
|
|
2839
|
+
}
|
|
2840
|
+
|
|
2841
|
+
async getInteractionResultPackageContinuation(continuationRef, forceRefresh) {
|
|
2842
|
+
const normalized = String(continuationRef || "").trim();
|
|
2843
|
+
if (!normalized) return null;
|
|
2844
|
+
const result = await this.getJson(`/v1/transaction-center/result-package-continuation?ref=${encodeURIComponent(normalized)}`);
|
|
2845
|
+
return result && result.data && result.data.continuation ? result.data.continuation : null;
|
|
2846
|
+
}
|
|
2847
|
+
|
|
2784
2848
|
async listSettlementPayees(forceRefresh) {
|
|
2785
2849
|
const summary = await this.getSettlementPayeeSummaries(forceRefresh);
|
|
2786
2850
|
return extractSummaryValues(summary, "settlement_payees", "payee_agent_id");
|
|
@@ -4171,6 +4235,66 @@ class CommerceClient {
|
|
|
4171
4235
|
};
|
|
4172
4236
|
}
|
|
4173
4237
|
|
|
4238
|
+
async runInteractionResultPackageContinuation(continuationRef, body, options) {
|
|
4239
|
+
const opts = options || {};
|
|
4240
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/run", {
|
|
4241
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.run",
|
|
4242
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4243
|
+
body: body || {},
|
|
4244
|
+
callback_url: opts.callbackUrl || null,
|
|
4245
|
+
settlement_mode: opts.settlementMode || null,
|
|
4246
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4247
|
+
protocol: opts.protocol || null,
|
|
4248
|
+
integration_id: opts.integrationId || null,
|
|
4249
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4250
|
+
integration_context: opts.integrationContext || null
|
|
4251
|
+
});
|
|
4252
|
+
}
|
|
4253
|
+
|
|
4254
|
+
async runInteractionResultPackageContinuationSummary(continuationRef, body, options) {
|
|
4255
|
+
const result = await this.runInteractionResultPackageContinuation(continuationRef, body, options);
|
|
4256
|
+
return {
|
|
4257
|
+
ok: result && result.ok === true,
|
|
4258
|
+
continuation_ref: result && result.continuation ? result.continuation.continuation_ref || null : null,
|
|
4259
|
+
result_package_ref: result && result.result_package ? result.result_package.result_package_ref || null : null,
|
|
4260
|
+
continuation_summary: this.summarizeInteractionResultPackageContinuation(
|
|
4261
|
+
result && result.continuation_summary ? result.continuation_summary : null
|
|
4262
|
+
),
|
|
4263
|
+
portable_handoff_summary: this.summarizeInteractionResultPackagePortableHandoff(
|
|
4264
|
+
result && result.portable_handoff_summary ? result.portable_handoff_summary : null
|
|
4265
|
+
),
|
|
4266
|
+
seam_summary: result && result.seam_summary ? {
|
|
4267
|
+
...result.seam_summary,
|
|
4268
|
+
proof_handoff_summary: this.summarizeProofHandoff(
|
|
4269
|
+
result.seam_summary && result.seam_summary.proof_handoff_summary
|
|
4270
|
+
? result.seam_summary.proof_handoff_summary
|
|
4271
|
+
: null
|
|
4272
|
+
)
|
|
4273
|
+
} : null
|
|
4274
|
+
};
|
|
4275
|
+
}
|
|
4276
|
+
|
|
4277
|
+
async prepareInteractionResultPackageContinuation(continuationRef, body, options) {
|
|
4278
|
+
const opts = options || {};
|
|
4279
|
+
return this.runNamedTaskRoute("/v1/transaction-center/result-package-continuations/prepare", {
|
|
4280
|
+
command: opts.command || String(continuationRef || "").trim() || "result.package.continuation.prepare",
|
|
4281
|
+
continuation_ref: String(continuationRef || "").trim(),
|
|
4282
|
+
body: body || {},
|
|
4283
|
+
callback_url: opts.callbackUrl || null,
|
|
4284
|
+
settlement_mode: opts.settlementMode || null,
|
|
4285
|
+
payment_protocol: opts.paymentProtocol || null,
|
|
4286
|
+
protocol: opts.protocol || null,
|
|
4287
|
+
integration_id: opts.integrationId || null,
|
|
4288
|
+
integration_ids: Array.isArray(opts.integrationIds) ? opts.integrationIds : [],
|
|
4289
|
+
integration_context: opts.integrationContext || null
|
|
4290
|
+
});
|
|
4291
|
+
}
|
|
4292
|
+
|
|
4293
|
+
async prepareInteractionResultPackageContinuationSummary(continuationRef, body, options) {
|
|
4294
|
+
const result = await this.prepareInteractionResultPackageContinuation(continuationRef, body, options);
|
|
4295
|
+
return summarizeInteractionResultPackageContinuationPreparationPayload(result);
|
|
4296
|
+
}
|
|
4297
|
+
|
|
4174
4298
|
async runNamedTaskRoute(path, payload) {
|
|
4175
4299
|
if (!this.apiKey || !this.walletId || !this.walletSecret) {
|
|
4176
4300
|
throw new Error("named task routes require apiKey, walletId, and walletSecret");
|
|
@@ -5678,6 +5802,14 @@ class CommerceClient {
|
|
|
5678
5802
|
return summarizeInteractionResultPackagePortableHandoffPayload(payload);
|
|
5679
5803
|
}
|
|
5680
5804
|
|
|
5805
|
+
summarizeInteractionResultPackageContinuation(payload) {
|
|
5806
|
+
return summarizeInteractionResultPackageContinuationPayload(payload);
|
|
5807
|
+
}
|
|
5808
|
+
|
|
5809
|
+
summarizeInteractionResultPackageContinuationPreparation(payload) {
|
|
5810
|
+
return summarizeInteractionResultPackageContinuationPreparationPayload(payload);
|
|
5811
|
+
}
|
|
5812
|
+
|
|
5681
5813
|
summarizeTask(task) {
|
|
5682
5814
|
return summarizeCatalogTask(task);
|
|
5683
5815
|
}
|
|
@@ -6431,6 +6563,8 @@ module.exports = {
|
|
|
6431
6563
|
summarizeQuotePreviewPayload,
|
|
6432
6564
|
summarizeDefaultTransactionCenterPayload,
|
|
6433
6565
|
summarizeDefaultTransactionEconomicsPayload,
|
|
6566
|
+
summarizeInteractionResultPackageContinuationPayload,
|
|
6567
|
+
summarizeInteractionResultPackageContinuationPreparationPayload,
|
|
6434
6568
|
summarizeInteractionResultPackagePayload,
|
|
6435
6569
|
summarizeInteractionResultPackagePortableHandoffPayload,
|
|
6436
6570
|
summarizeDefaultTaskPackCatalogPayload,
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -8,6 +8,7 @@ const {
|
|
|
8
8
|
buildDefaultTransactionEconomics,
|
|
9
9
|
buildDefaultTransactionGuidedLoopCatalog,
|
|
10
10
|
buildInteractionResultPackageCatalog,
|
|
11
|
+
buildInteractionResultPackageContinuationCatalog,
|
|
11
12
|
buildInteractionSpinePathCatalog,
|
|
12
13
|
buildPrecommitInteractionPackCatalog,
|
|
13
14
|
buildDefaultTransactionTaskPackCatalog,
|
|
@@ -16,6 +17,7 @@ const {
|
|
|
16
17
|
getDefaultTransactionGuidedLoop,
|
|
17
18
|
getDefaultTransactionTaskPack,
|
|
18
19
|
getInteractionResultPackage,
|
|
20
|
+
getInteractionResultPackageContinuation,
|
|
19
21
|
getInteractionSpinePath,
|
|
20
22
|
getPrecommitInteractionPack,
|
|
21
23
|
getTransactionClassPack,
|
|
@@ -26,6 +28,7 @@ const {
|
|
|
26
28
|
summarizeDefaultTransactionCenter,
|
|
27
29
|
summarizeDefaultTransactionEconomics,
|
|
28
30
|
summarizeDefaultTransactionGuidedLoops,
|
|
31
|
+
summarizeInteractionResultPackageContinuations,
|
|
29
32
|
summarizeInteractionResultPackages,
|
|
30
33
|
summarizeInteractionSpinePaths,
|
|
31
34
|
summarizeDefaultTransactionTaskPacks,
|
|
@@ -1087,6 +1090,42 @@ function summarizeInteractionResultPackagePortableHandoff(handoff) {
|
|
|
1087
1090
|
};
|
|
1088
1091
|
}
|
|
1089
1092
|
|
|
1093
|
+
function buildInteractionResultPackageContinuationSummary(portableHandoff, continuation) {
|
|
1094
|
+
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1095
|
+
return {
|
|
1096
|
+
ok: true,
|
|
1097
|
+
continuation_ref: continuation && continuation.continuation_ref ? continuation.continuation_ref : null,
|
|
1098
|
+
result_package_ref: continuation && continuation.result_package_ref ? continuation.result_package_ref : null,
|
|
1099
|
+
source_ref: continuation && continuation.source_ref ? continuation.source_ref : null,
|
|
1100
|
+
continuation_kind: continuation && continuation.continuation_kind ? continuation.continuation_kind : null,
|
|
1101
|
+
default_next_surface: continuation && continuation.default_next_surface ? continuation.default_next_surface : null,
|
|
1102
|
+
default_export_surface: continuation && continuation.default_export_surface ? continuation.default_export_surface : null,
|
|
1103
|
+
default_proof_surface: continuation && continuation.default_proof_surface ? continuation.default_proof_surface : null,
|
|
1104
|
+
transaction_id: handoff.transaction_id || null,
|
|
1105
|
+
receipt_id: handoff.receipt_id || null,
|
|
1106
|
+
proof_ref: handoff.proof_ref || null,
|
|
1107
|
+
continuation_ready: Boolean(handoff.result_package_ref && handoff.proof_ref),
|
|
1108
|
+
seam_layer_count: Array.isArray(handoff.seam_layers) ? handoff.seam_layers.length : 0
|
|
1109
|
+
};
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
function buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation) {
|
|
1113
|
+
const handoff = portableHandoff && typeof portableHandoff === "object" ? portableHandoff : {};
|
|
1114
|
+
return {
|
|
1115
|
+
ok: true,
|
|
1116
|
+
continuation_ref: continuation && continuation.continuation_ref ? continuation.continuation_ref : null,
|
|
1117
|
+
target_surface: "/v1/proof-center/result-package-handoff/run",
|
|
1118
|
+
review_surface: "/v1/proof-center/result-package-handoff/review",
|
|
1119
|
+
request_template: {
|
|
1120
|
+
handoff_bundle: handoff,
|
|
1121
|
+
evidence_refs: handoff.proof_ref ? [handoff.proof_ref] : [],
|
|
1122
|
+
options: {
|
|
1123
|
+
legacy_identity_material_hex: "<required_for_local_demo_signing>"
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
};
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1090
1129
|
function buildOperationsDashboard(filters) {
|
|
1091
1130
|
const disputes = listRecords(state.disputes, filters);
|
|
1092
1131
|
const refunds = listRecords(state.refunds, filters);
|
|
@@ -1274,6 +1313,26 @@ async function routeRequest(req, res) {
|
|
|
1274
1313
|
return;
|
|
1275
1314
|
}
|
|
1276
1315
|
|
|
1316
|
+
if (req.method === "GET" && url.pathname === "/v1/transaction-center/result-package-continuations") {
|
|
1317
|
+
sendJson(res, 200, buildInteractionResultPackageContinuationCatalog());
|
|
1318
|
+
return;
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
if (req.method === "GET" && url.pathname === "/v1/transaction-center/result-package-continuations/summary") {
|
|
1322
|
+
sendJson(res, 200, summarizeInteractionResultPackageContinuations());
|
|
1323
|
+
return;
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
if (req.method === "GET" && url.pathname === "/v1/transaction-center/result-package-continuation") {
|
|
1327
|
+
const continuation = getInteractionResultPackageContinuation(url.searchParams.get("ref"));
|
|
1328
|
+
if (!continuation) {
|
|
1329
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
1330
|
+
return;
|
|
1331
|
+
}
|
|
1332
|
+
sendJson(res, 200, { ok: true, continuation });
|
|
1333
|
+
return;
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1277
1336
|
if (req.method === "GET" && url.pathname === "/v1/transaction-center/transaction-class-packs") {
|
|
1278
1337
|
sendJson(res, 200, buildTransactionClassPackCatalog());
|
|
1279
1338
|
return;
|
|
@@ -1929,6 +1988,86 @@ async function routeRequest(req, res) {
|
|
|
1929
1988
|
return;
|
|
1930
1989
|
}
|
|
1931
1990
|
|
|
1991
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/run") {
|
|
1992
|
+
const body = await readJsonBody(req);
|
|
1993
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
1994
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
1995
|
+
if (!continuation) {
|
|
1996
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
1997
|
+
return;
|
|
1998
|
+
}
|
|
1999
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2000
|
+
if (!resultPackage) {
|
|
2001
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2002
|
+
return;
|
|
2003
|
+
}
|
|
2004
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2005
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2006
|
+
spine_path_ref: resultPackage.source_ref
|
|
2007
|
+
});
|
|
2008
|
+
if (!payload) {
|
|
2009
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2010
|
+
return;
|
|
2011
|
+
}
|
|
2012
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2013
|
+
if (result.status !== 200) {
|
|
2014
|
+
sendJson(res, result.status, result.payload);
|
|
2015
|
+
return;
|
|
2016
|
+
}
|
|
2017
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2018
|
+
sendJson(res, 200, {
|
|
2019
|
+
ok: true,
|
|
2020
|
+
continuation,
|
|
2021
|
+
result_package: resultPackage,
|
|
2022
|
+
result: result.payload,
|
|
2023
|
+
result_package_summary: buildInteractionResultPackageSummary(result.payload, resultPackage),
|
|
2024
|
+
portable_handoff_bundle: portableHandoff,
|
|
2025
|
+
portable_handoff_summary: summarizeInteractionResultPackagePortableHandoff(portableHandoff),
|
|
2026
|
+
continuation_summary: buildInteractionResultPackageContinuationSummary(portableHandoff, continuation),
|
|
2027
|
+
seam_summary: buildInteractionResultSeamSummary(result.payload, resultPackage)
|
|
2028
|
+
});
|
|
2029
|
+
return;
|
|
2030
|
+
}
|
|
2031
|
+
|
|
2032
|
+
if (req.method === "POST" && url.pathname === "/v1/transaction-center/result-package-continuations/prepare") {
|
|
2033
|
+
const body = await readJsonBody(req);
|
|
2034
|
+
const continuationRef = String(body && body.continuation_ref || "").trim();
|
|
2035
|
+
const continuation = getInteractionResultPackageContinuation(continuationRef);
|
|
2036
|
+
if (!continuation) {
|
|
2037
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2038
|
+
return;
|
|
2039
|
+
}
|
|
2040
|
+
const resultPackage = getInteractionResultPackage(continuation.result_package_ref);
|
|
2041
|
+
if (!resultPackage) {
|
|
2042
|
+
sendJson(res, 404, { ok: false, error: "result_package_not_found" });
|
|
2043
|
+
return;
|
|
2044
|
+
}
|
|
2045
|
+
const payload = buildInteractionSpinePathRunPayload({
|
|
2046
|
+
...(body && typeof body === "object" && !Array.isArray(body) ? body : {}),
|
|
2047
|
+
spine_path_ref: resultPackage.source_ref
|
|
2048
|
+
});
|
|
2049
|
+
if (!payload) {
|
|
2050
|
+
sendJson(res, 404, { ok: false, error: "result_package_continuation_not_found" });
|
|
2051
|
+
return;
|
|
2052
|
+
}
|
|
2053
|
+
const result = executeCommandRequest(state, payload, req.headers);
|
|
2054
|
+
if (result.status !== 200) {
|
|
2055
|
+
sendJson(res, result.status, result.payload);
|
|
2056
|
+
return;
|
|
2057
|
+
}
|
|
2058
|
+
const portableHandoff = buildInteractionResultPackagePortableHandoff(result.payload, resultPackage);
|
|
2059
|
+
sendJson(res, 200, {
|
|
2060
|
+
ok: true,
|
|
2061
|
+
continuation,
|
|
2062
|
+
result_package: resultPackage,
|
|
2063
|
+
result_package_summary: buildInteractionResultPackageSummary(result.payload, resultPackage),
|
|
2064
|
+
portable_handoff_summary: summarizeInteractionResultPackagePortableHandoff(portableHandoff),
|
|
2065
|
+
continuation_summary: buildInteractionResultPackageContinuationSummary(portableHandoff, continuation),
|
|
2066
|
+
proof_request_template: buildInteractionResultPackageContinuationRequestTemplate(portableHandoff, continuation)
|
|
2067
|
+
});
|
|
2068
|
+
return;
|
|
2069
|
+
}
|
|
2070
|
+
|
|
1932
2071
|
if (req.method === "POST" && url.pathname === "/v1/transaction-center/default-loops/run") {
|
|
1933
2072
|
const body = await readJsonBody(req);
|
|
1934
2073
|
const loopRef = String(body && body.loop_ref || "").trim();
|