@deliverart/sdk-js-legacy-migration 0.0.0-stage → 3.0.0-dev.2
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 +779 -2
- package/dist/index.cjs +5928 -0
- package/dist/index.d.cts +31524 -0
- package/dist/index.d.ts +31524 -0
- package/dist/index.js +5601 -0
- package/package.json +34 -3
package/README.md
CHANGED
|
@@ -1,3 +1,780 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Legacy account migration
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Typed contracts for importing data from a previous Deliverart installation into an existing point of sale. Requests require an authenticated human user with management permission on the destination POS.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import {
|
|
7
|
+
GetLegacySources,
|
|
8
|
+
ConnectLegacyAccount,
|
|
9
|
+
GetLegacySourcePointsOfSale,
|
|
10
|
+
GetLegacySourceMenus,
|
|
11
|
+
StartLegacyImport,
|
|
12
|
+
GetLegacyImportDetails,
|
|
13
|
+
GetLegacyImportPreparation,
|
|
14
|
+
GetLegacyImportProblems,
|
|
15
|
+
} from '@deliverart/sdk-js-legacy-migration'
|
|
16
|
+
|
|
17
|
+
const { sources } = await client.call(new GetLegacySources(posId))
|
|
18
|
+
const connection = await client.call(
|
|
19
|
+
new ConnectLegacyAccount(posId, {
|
|
20
|
+
source: sources[0].id,
|
|
21
|
+
username,
|
|
22
|
+
password,
|
|
23
|
+
}),
|
|
24
|
+
)
|
|
25
|
+
const points = await client.call(new GetLegacySourcePointsOfSale(posId, connection.id))
|
|
26
|
+
const menus = await client.call(new GetLegacySourceMenus(posId, connection.id, points.items[0].id))
|
|
27
|
+
const requestId = crypto.randomUUID()
|
|
28
|
+
const receipt = await client.call(
|
|
29
|
+
new StartLegacyImport(posId, {
|
|
30
|
+
requestId,
|
|
31
|
+
connectionId: connection.id,
|
|
32
|
+
sourcePosId: points.items[0].id,
|
|
33
|
+
menuId: menus.items[0].id,
|
|
34
|
+
scopes: ['catalog', 'customers'],
|
|
35
|
+
acknowledgeConflicts: true,
|
|
36
|
+
}),
|
|
37
|
+
)
|
|
38
|
+
const process = await client.call(new GetLegacyImportDetails(posId, receipt.id))
|
|
39
|
+
const preparation = await client.call(new GetLegacyImportPreparation(posId, receipt.id))
|
|
40
|
+
const problems = await client.call(
|
|
41
|
+
new GetLegacyImportProblems(posId, receipt.id, {
|
|
42
|
+
query: { page: 1, itemsPerPage: 30 },
|
|
43
|
+
}),
|
|
44
|
+
)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Check that sources, POSs, and menus are non-empty before selecting one. Source choices come from deployment configuration; clients never submit an arbitrary source URL. Never log credentials or SDK errors containing the login request body. Passwords are used for authentication only; connection handles expire.
|
|
48
|
+
|
|
49
|
+
Keep the same request ID and identical selection when retrying an uncertain start response. One import may be active per destination POS. Preparation and record processing have separate progress values; unknown totals remain `null`. Poll only active processes, with bounded retries and a delay between completed requests. Navigation does not cancel server work. Problems and process collections use the SDK's standard pagination contract.
|
|
50
|
+
|
|
51
|
+
Catalog, customer (including delivery addresses and business profiles), and private integration preparation scopes are executable. Integration preparation requires a selected source menu. Historical-order execution remains unavailable. Imported source IDs are durable correspondences and subsequent runs skip them.
|
|
52
|
+
|
|
53
|
+
Media problems use record kind `media` and the stable codes `media_unavailable` or `media_preparation_failed`. They identify independently retryable image records; a product already imported remains valid. These read schemas do not enable media execution: the backend keeps normal media snapshot input closed until complete preparation/cleanup/worker verification is installed. Internal image completion callbacks and private file plans are not SDK write operations.
|
|
54
|
+
|
|
55
|
+
Private integration observation problems use read/filter kind `integration_mapping`, independently of an imported integration configuration. Approved missing references and incomplete collections retain typed problem codes. Observations are per-process verification facts rather than reusable resource correspondences; a repeated import must capture them again even when its parent configuration was already imported. Private preparation transport does not expose capsules or add activation operations. Counters describe migration records, including verification facts; they do not assert that a native integration was activated. The package remains unpublished pending the coordinated SDK/Hub release.
|
|
56
|
+
|
|
57
|
+
Preparation reads include phase `preparing_media` and optional `completedMedia`, `totalMedia`, `failedMedia` counters, preserving compatibility with earlier servers. Image checks settle before the backend starts business-resource writes. This SDK schema does not enable the server-side media capability; source/worker/cleanup activation remains a separate verified deployment prerequisite.
|
|
58
|
+
|
|
59
|
+
Read-only integration review uses `GetLegacyIntegrationPreparations` (paginated,
|
|
60
|
+
optional closed service filter), `GetLegacyIntegrationPreparationDetails` and
|
|
61
|
+
`GetLegacyIntegrationMappingReview`. All routes require destination POS and
|
|
62
|
+
current process UUIDs. A preparation UUID is not a canonical Integration UUID.
|
|
63
|
+
The five configuration variants contain approved non-secret fields only;
|
|
64
|
+
credential presence and capture timestamps never reveal the captured credential.
|
|
65
|
+
`sourceStatus` is historical. `ready_for_review` means observed capture completed,
|
|
66
|
+
not verified ownership, native mapping installation or activation. A changed
|
|
67
|
+
requested menu returns an incomplete review with `menu_selection_changed`.
|
|
68
|
+
Native installation, activation and receiving cutover require their separate
|
|
69
|
+
completed workflow.
|
|
70
|
+
|
|
71
|
+
## Remote ingredient collection
|
|
72
|
+
|
|
73
|
+
For a recorded Tilby preparation, `GetLegacyComponentCaptureWorkspace` returns
|
|
74
|
+
local eligibility and the latest relevant safe collection progress. Use
|
|
75
|
+
`StartLegacyComponentCapture` with `{ requestId: crypto.randomUUID() }` only when
|
|
76
|
+
`canStart` is true. Preserve that exact input when acknowledgement is uncertain;
|
|
77
|
+
start is asynchronous and returns the committed capture plus `dispatchPending`.
|
|
78
|
+
Monitor with `GetLegacyComponentCapture` using the returned original `processId`,
|
|
79
|
+
`preparationId` and `id`, scoped to the destination POS. An active collection from
|
|
80
|
+
an earlier import may appear in the workspace; it retains its original process.
|
|
81
|
+
Never replace a pinned result silently with another active collection.
|
|
82
|
+
|
|
83
|
+
`pending` and `running` are monitorable; `collected` and `failed` are terminal.
|
|
84
|
+
Unknown percentage/totals remain null, and 100% means this collection finished.
|
|
85
|
+
Empty catalogs complete with zero pages/rows. Failure codes are closed, safe
|
|
86
|
+
contracts for translated operator guidance. Reads contain no credentials, remote
|
|
87
|
+
bodies, mapping evidence or authority to activate an integration. Stop automatic
|
|
88
|
+
reads on lost authorization or invalid responses, bound transient retries and
|
|
89
|
+
retain stale values with their last successful check time. A manual status check
|
|
90
|
+
must never issue another start. The complete commercial verification, native
|
|
91
|
+
mapping installation and exclusive receiver cutover remain separate prerequisites.
|
|
92
|
+
|
|
93
|
+
Repeat imports keep the same preparation/business identity but acquire a fresh
|
|
94
|
+
private configuration/credential observation. Preparation reads and mapping
|
|
95
|
+
reviews expose the exact requested import's safe fields and timestamps; older
|
|
96
|
+
versions remain unchanged. An invalid or missing current observation cannot fall
|
|
97
|
+
back to the original configuration. Earlier repeat runs that predate versioned
|
|
98
|
+
observations require another import to obtain current evidence. This does not
|
|
99
|
+
change the public schemas or activate an integration.
|
|
100
|
+
|
|
101
|
+
A collection with a different `processId` belongs to an earlier import, including
|
|
102
|
+
when displayed in the current workspace. Label that distinction before progress:
|
|
103
|
+
its completion does not verify the current connection. After authoritative
|
|
104
|
+
eligibility allows it, a new collection must use the current import identity.
|
|
105
|
+
|
|
106
|
+
## Read-only product verification
|
|
107
|
+
|
|
108
|
+
After collecting the remote catalog, read `GetLegacyProductVerificationWorkspace`
|
|
109
|
+
under the same POS/import/preparation. Start only when `canStart` is true, using
|
|
110
|
+
its `captureId` and one fresh `requestId`. After an uncertain acknowledgement,
|
|
111
|
+
repeat exactly the same input; do not select a newer capture or create another
|
|
112
|
+
request id. `StartLegacyProductVerification` returns the committed job plus
|
|
113
|
+
`dispatchPending`; queue publication failure does not erase that job.
|
|
114
|
+
|
|
115
|
+
Read the pinned job with `GetLegacyProductVerification`. Its percentage counts
|
|
116
|
+
checked products, independently of `matched` and `problems`. Completion does not
|
|
117
|
+
install mappings, prove all fiscal/native compatibility or activate an integration.
|
|
118
|
+
The workspace may expose an active earlier import; monitor its actual `processId`
|
|
119
|
+
and explain that it is not a check of the current import. Expired results remain
|
|
120
|
+
historical evidence and cannot authorize activation.
|
|
121
|
+
|
|
122
|
+
`GetLegacyProductVerificationItems` supports bounded `page`, `itemsPerPage` and
|
|
123
|
+
`status=pending|matched|problem`. Its explicit page response has `items` and a
|
|
124
|
+
filtered `total`, rather than the generic API Platform pagination wrapper. Source
|
|
125
|
+
product names contain approved locale/text labels only. Missing or invalid labels
|
|
126
|
+
are empty; ids are support references, never name-based mapping candidates.
|
|
127
|
+
Status/result reads never start work or make provider calls.
|
|
128
|
+
|
|
129
|
+
Product verification also checks the exact captured source VAT identity against
|
|
130
|
+
its explicit department association and fresh Tilby item/department/VAT records.
|
|
131
|
+
Equal percentages never identify an unrelated fiscal mapping. Safe item results
|
|
132
|
+
use `projection_source_fiscal_invalid` for missing/inconsistent source evidence and
|
|
133
|
+
`projection_remote_fiscal_changed` for changed live fiscal definitions. These are
|
|
134
|
+
completed product problems, not activation authorization; the percentage still
|
|
135
|
+
counts checked products. Keep these codes aligned with API OpenAPI and Hub IT/EN
|
|
136
|
+
recovery guidance. No native fiscal mapping write is performed by verification.
|
|
137
|
+
|
|
138
|
+
Integration preparation uses the normal asynchronous start/progress flow. Inspect
|
|
139
|
+
the source capabilities before offering it: older source deployments may expose
|
|
140
|
+
only catalog/customers. Keep the chosen source menu even in an integration-only
|
|
141
|
+
request. Both `integration` and `integration_mapping` records count toward import
|
|
142
|
+
progress; a finished import does not prove native mappings were installed or
|
|
143
|
+
receiving traffic moved. SDK acceptance never grants activation permission.
|
|
144
|
+
|
|
145
|
+
## Fresh source configuration checks
|
|
146
|
+
|
|
147
|
+
Use `GetLegacySourceAuthorityWorkspace`, `StartLegacySourceAuthorityCheck` and
|
|
148
|
+
`GetLegacySourceAuthorityCheck` to follow the asynchronous source recheck under an
|
|
149
|
+
imported integration preparation. Start accepts only a fresh request UUID and
|
|
150
|
+
the current user's owned source `connectionId`; it never accepts provider
|
|
151
|
+
credentials, export grants or activation options. Reuse the exact request and
|
|
152
|
+
connection ids after an uncertain acknowledgement.
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
import {
|
|
156
|
+
GetLegacySourceAuthorityWorkspace,
|
|
157
|
+
GetLegacySourceAuthorityCheck,
|
|
158
|
+
StartLegacySourceAuthorityCheck,
|
|
159
|
+
} from '@deliverart/sdk-js-legacy-migration'
|
|
160
|
+
|
|
161
|
+
const workspace = await client.call(
|
|
162
|
+
new GetLegacySourceAuthorityWorkspace(posId, processId, preparationId),
|
|
163
|
+
)
|
|
164
|
+
if (workspace.eligibility === 'ready') {
|
|
165
|
+
const receipt = await client.call(
|
|
166
|
+
new StartLegacySourceAuthorityCheck(posId, processId, preparationId, {
|
|
167
|
+
requestId,
|
|
168
|
+
connectionId,
|
|
169
|
+
}),
|
|
170
|
+
)
|
|
171
|
+
const check = await client.call(
|
|
172
|
+
new GetLegacySourceAuthorityCheck(posId, processId, preparationId, receipt.id),
|
|
173
|
+
)
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Pending progress is 0%; running/failed progress is unknown, and a matched check
|
|
178
|
+
is 100%. `fresh` describes only the observation's short clock validity, and
|
|
179
|
+
`validUntil` lets a consumer stop presenting an expired result as current.
|
|
180
|
+
`source_check_expired` means the check deadline expired; it is distinct from
|
|
181
|
+
`source_authentication_required`. An earlier active check for the same
|
|
182
|
+
preparation may appear in the workspace under its own `processId`; follow that
|
|
183
|
+
scope rather than queueing a second check. A matched check never grants native
|
|
184
|
+
integration installation, provider activation or receiver cutover permission.
|
|
185
|
+
|
|
186
|
+
Source-check workspaces include nullable `sourceKey`, the original configured
|
|
187
|
+
source identifier. Match it to the approved source list and source installation
|
|
188
|
+
before requesting credentials; installation identity alone cannot select a login
|
|
189
|
+
alias. A ready workspace requires a non-null key. Deploy this API field before
|
|
190
|
+
releasing the corresponding SDK/Hub consumer. The key contains no endpoint or
|
|
191
|
+
credential and never bypasses the server's exact-source authorization checks.
|
|
192
|
+
|
|
193
|
+
The migration feature has been rebased onto the SDK 2.48.0 mainline, preserving
|
|
194
|
+
its Tilby product channel policies and dependency/security updates. Local runtime
|
|
195
|
+
verification uses Node 24 and Vitest/coverage 4.1.12. This is source compatibility
|
|
196
|
+
evidence; the new package is still unpublished. Consumer exact pins, clean-install
|
|
197
|
+
builds and the authenticated source-to-Hub rehearsal remain release requirements.
|
|
198
|
+
|
|
199
|
+
## Imported order consultation
|
|
200
|
+
|
|
201
|
+
`GetLegacyImportedOrders` and `GetLegacyImportedOrderDetails` read preserved,
|
|
202
|
+
non-operational history for an authenticated human who can manage the destination
|
|
203
|
+
POS. Partner and full-access API tokens cannot use this consultation boundary.
|
|
204
|
+
|
|
205
|
+
```ts
|
|
206
|
+
const page = await client.call(
|
|
207
|
+
new GetLegacyImportedOrders(posId, {
|
|
208
|
+
query: { processId, from: '2020-01-01T00:00:00Z', until: '2021-01-01T00:00:00Z' },
|
|
209
|
+
}),
|
|
210
|
+
)
|
|
211
|
+
if (page.data.length > 0) {
|
|
212
|
+
const order = await client.call(new GetLegacyImportedOrderDetails(posId, page.data[0].id))
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Ranges use service time, include `from` and exclude `until`; query timestamps
|
|
217
|
+
require UTC and whole seconds. Pages contain at most 100 lightweight summaries
|
|
218
|
+
with `details: null`. Filtering by a repeated import also includes its successful
|
|
219
|
+
already-imported receipts; `processId` on each row remains the original creating
|
|
220
|
+
import. Item reads return closed factual details, with independent reserved and
|
|
221
|
+
registry addresses, source states, timestamps, physical charges, signed variants
|
|
222
|
+
and adjustments. Variant impacts are already included in charged item totals:
|
|
223
|
+
never add them again or reprice from the current menu.
|
|
224
|
+
|
|
225
|
+
Effective `currency` is `"EUR"` under ADR 0016; `sourceCurrency` remains null.
|
|
226
|
+
The required closed `currencyPolicy` contains `version: 1`,
|
|
227
|
+
`provenance: "owner_confirmed_legacy_system_policy"`, `decision: "adr_0016"` and
|
|
228
|
+
a lowercase SHA-256 `fingerprint` bound by the API to the retained historical row.
|
|
229
|
+
This is supplemental owner provenance, not recovered currency, FX conversion or
|
|
230
|
+
new source evidence. The SDK neither computes that fingerprint nor defaults
|
|
231
|
+
missing policy fields; old null-only responses fail validation and require a
|
|
232
|
+
coordinated API/SDK/client rollout. Original money scales and sealed facts stay
|
|
233
|
+
unchanged. Payment method/status are source assertions and
|
|
234
|
+
`financiallyVerified` remains false, including when the old system says paid.
|
|
235
|
+
Labels and customer data keep their reference-quality markers; current-registry
|
|
236
|
+
evidence is not a guaranteed point-in-time customer snapshot. Missing fields stay
|
|
237
|
+
null. Private provider identities, credentials and native menu/payment bindings
|
|
238
|
+
are not returned. Do not construct ordinary Order links, print/payment actions,
|
|
239
|
+
or live order mutations from these DTOs. Reads do not enable public history
|
|
240
|
+
import, historical statistics or integration activation. Unreadable encrypted
|
|
241
|
+
details return safe service unavailability rather than invented fallback data.
|
|
242
|
+
|
|
243
|
+
`details.reconciliation` exposes `kind` (`exact`, `fiscal_rounding` or
|
|
244
|
+
`canceled_zero_header`) and the exact observed `difference` money triple. It compares independently recorded
|
|
245
|
+
source root and component amounts. For exact/fiscal-rounding records, gross
|
|
246
|
+
equality remains exact; bounded opposing net/VAT residuals never become an additional charge, discount, refund or payment.
|
|
247
|
+
Preserve the original amounts and explain the rounding instead of recalculating
|
|
248
|
+
the root or summing variant effects again.
|
|
249
|
+
|
|
250
|
+
The `canceled_zero_header` kind is literal source evidence, not reconciled charged
|
|
251
|
+
money. It requires a canceled/waiting/to-prepare source observation, all three
|
|
252
|
+
recorded header values zero, nonempty original priced lines, explicit absent
|
|
253
|
+
actual/reservation times and a bounded nonzero residual. The API retains both
|
|
254
|
+
the observed zero header and every original line, variant and adjustment value.
|
|
255
|
+
Do not infer an unpaid balance, charge, discount, refund or payment from waiting.
|
|
256
|
+
Keep these observations outside monetary and sold/fulfilled statistics, and do
|
|
257
|
+
not expose operational order/payment/export actions. Existing exact and
|
|
258
|
+
fiscal-rounding semantics remain unchanged; old rejection receipts are immutable.
|
|
259
|
+
|
|
260
|
+
`LegacyImportProcess.warnings` is an optional non-blocking review count, separate
|
|
261
|
+
from rejected-record `issues`; it can overlap successfully created customers.
|
|
262
|
+
Shared source emails and existing destination email conflicts keep people distinct
|
|
263
|
+
and preserve the original address in restricted encrypted history while leaving
|
|
264
|
+
the incoming operational email empty. Existing destination contacts are unchanged.
|
|
265
|
+
`GetLegacyImportedCustomerEmails` reads the bounded archive with optional
|
|
266
|
+
`processId` filtering; `GetLegacyImportedCustomerEmail` reads one customer's
|
|
267
|
+
original assertion. Both are GET-only and require a human POS manager. Repeated
|
|
268
|
+
imports preserve original process provenance. `recordedEmail` preserves source
|
|
269
|
+
spelling exactly and must never be used automatically for communications or
|
|
270
|
+
written back into a customer contact. `hasOperationalEmail` describes the current
|
|
271
|
+
profile without disclosing its current address. No write/merge/send action exists.
|
|
272
|
+
|
|
273
|
+
### Gated historical import requests
|
|
274
|
+
|
|
275
|
+
`StartLegacyImport` accepts the optional `orders` scope only together with a
|
|
276
|
+
`historyCutoff`: an explicit UTC timestamp at second precision, strictly in the
|
|
277
|
+
past, for example `2021-01-01T00:00:00Z`. The cutoff uses planned service time
|
|
278
|
+
with creation-time fallback; an old order may still be open. Preserve the same
|
|
279
|
+
cutoff when replaying a request UUID. A changed cutoff requires a new request.
|
|
280
|
+
|
|
281
|
+
The server defaults `LEGACY_MIGRATION_HISTORY_ENABLED` to off. Schema support
|
|
282
|
+
does not enable history, certify provider callback/redelivery safety or grant
|
|
283
|
+
integration cutover. Source capability, destination rollout gates and the same
|
|
284
|
+
POS management/conflict-acknowledgement checks still apply.
|
|
285
|
+
|
|
286
|
+
### Verify packed consumers before release
|
|
287
|
+
|
|
288
|
+
From the SDK repository root, run `pnpm run test:legacy-consumer` after installing
|
|
289
|
+
the workspace dependencies. The command rebuilds and packs `core`, `global-types`
|
|
290
|
+
and `legacy-migration`, installs the three real archives into a new isolated
|
|
291
|
+
consumer with the repository-pinned pnpm version, and refuses source-checkout
|
|
292
|
+
package links. Installation disables lifecycle scripts and may fetch public
|
|
293
|
+
transitive dependencies from the registry when the pnpm store is cold.
|
|
294
|
+
|
|
295
|
+
The consumer verifies ESM/CommonJS exports, paired historical cutoff validation,
|
|
296
|
+
the actual client's serialized HTTP request and strict public TypeScript
|
|
297
|
+
declarations with `skipLibCheck=false`. The temporary workspace is removed on
|
|
298
|
+
success and failure. This verifies the package dependency closure without
|
|
299
|
+
publishing; it does not certify the complete Hub clean-install/release chain.
|
|
300
|
+
|
|
301
|
+
### Recorded historical statistics
|
|
302
|
+
|
|
303
|
+
`GetLegacyImportedOrderStatistics(posId, { from, until, processId? })` reads
|
|
304
|
+
`/point_of_sales/{id}/legacy_imported_order_statistics`. Both dates are required
|
|
305
|
+
UTC timestamps at second precision; the inclusive/exclusive service-time range
|
|
306
|
+
must be positive and at most 366 days. Optional import filtering follows only
|
|
307
|
+
successful original/repeated receipts and does not count repeated imports twice.
|
|
308
|
+
|
|
309
|
+
Buckets follow the returned POS timezone, including daylight-saving transitions,
|
|
310
|
+
and keep the original `valid`, `to_be_defined`, `aborted`, `canceled` or unknown
|
|
311
|
+
status separate. Monetary triples are decimal strings; total charges, physical
|
|
312
|
+
items, signed adjustments and fiscal differences remain distinct. Effective
|
|
313
|
+
`currency: "EUR"`, `sourceCurrency: null` and the same closed `currencyPolicy`
|
|
314
|
+
metadata are required. The report policy fingerprint binds the authorized POS,
|
|
315
|
+
normalized filters and actual report timezone; its private scope is not exposed.
|
|
316
|
+
`fundingVerified` remains false. Counts of recorded delivery/collection
|
|
317
|
+
timestamps are source assertions, not independently verified fulfillment. Empty
|
|
318
|
+
ranges return no buckets; incomplete statistical projections fail visibly rather
|
|
319
|
+
than returning partial totals. The operation requires a human POS manager and
|
|
320
|
+
provides no operational order, payment, refund or export action.
|
|
321
|
+
|
|
322
|
+
`canceledEvidence` is a separate count-only array of `{ day, observations,
|
|
323
|
+
recordedLines }` for `canceled_zero_header`. Its rows contain no monetary totals
|
|
324
|
+
and are excluded from the ordinary financial buckets. An absent field on an
|
|
325
|
+
older API response defaults to an empty array; decoded output includes the
|
|
326
|
+
array. Preserve this distinction in consumer summaries and empty-range views.
|
|
327
|
+
|
|
328
|
+
### Main dependency alignment verification
|
|
329
|
+
|
|
330
|
+
The migration package uses the same exact Zod 4.6.6 dependency as every other
|
|
331
|
+
runtime schema package. After rebasing onto main's SDK 2.48.1, the full workspace
|
|
332
|
+
build, all 698 package tests and root ESLint pass. Migration coverage remains
|
|
333
|
+
100% for 597 statements, 77 branches, 91 functions and 591 lines across its
|
|
334
|
+
36 tests. The separately packed core/global-types/migration consumer passes
|
|
335
|
+
isolated installation, ESM/CJS runtime, HTTP-body and strict declaration checks.
|
|
336
|
+
The order-address response-nullability and strict-input tests from main remain
|
|
337
|
+
present and pass within the 245-test order package. No package was published.
|
|
338
|
+
|
|
339
|
+
### Catalog problem context
|
|
340
|
+
|
|
341
|
+
Import problems may carry `catalogContext`, a closed typed read model identifying
|
|
342
|
+
the exact source product/category/ingredient (or a media record's source owner).
|
|
343
|
+
It retains a bounded original name when available, a stable reason, and optional
|
|
344
|
+
rule evidence with the original rule reference/name and minimum, maximum and
|
|
345
|
+
available choice counts. Missing names remain null. The context excludes
|
|
346
|
+
customer/order/integration data, arbitrary exception messages and raw records.
|
|
347
|
+
The schemas reject unrelated owners, mismatched diagnostic codes, unknown fields
|
|
348
|
+
and selection explanations that do not prove the stated source problem.
|
|
349
|
+
|
|
350
|
+
Older responses without this field, and explicit null context, remain valid.
|
|
351
|
+
Hub can keep its generic guidance for those records. Coordinated backend writes
|
|
352
|
+
and the matching schema migration must precede relying on the new evidence;
|
|
353
|
+
these optional SDK contracts do not activate it on an older server.
|
|
354
|
+
|
|
355
|
+
Historical imports expose `historical_provider_identity_conflict` when another
|
|
356
|
+
order already claims the same provider reference in the destination POS/location.
|
|
357
|
+
The refused order is not merged or overwritten. This stable diagnostic supports
|
|
358
|
+
filtering without exposing the private provider reference; an unchanged retry
|
|
359
|
+
does not resolve conflicting source data.
|
|
360
|
+
|
|
361
|
+
### Asynchronous paused inbound installation
|
|
362
|
+
|
|
363
|
+
After the selected integration preparation and a fresh owned source-authority check,
|
|
364
|
+
`GetLegacyNativeInstallationWorkspace` reports eligibility. Only `ready` permits a
|
|
365
|
+
new `StartLegacyNativeInstallation`, with the same connection used for that authority,
|
|
366
|
+
a server-issued authority ID, an owned destination sales mode and an explicit display
|
|
367
|
+
name. Glovo also requires a locale such as `it_IT`. A new request uses a new UUID;
|
|
368
|
+
retrying an uncertain acknowledgement must use the identical UUID and settings.
|
|
369
|
+
|
|
370
|
+
`GetLegacyNativeInstallation` follows the returned process/preparation/job scope.
|
|
371
|
+
`GetLegacyActiveNativeInstallation` discovers a POS-wide pending/running job and
|
|
372
|
+
prevents proposing another import while that job is active. Delay polls until the
|
|
373
|
+
previous read completes, stop at terminal status, and stop actions on permission loss.
|
|
374
|
+
Pending progress is zero, running progress is unknown (`null`), and completed is
|
|
375
|
+
100 percent. A retryable pending job can retain its last safe failure code and retry
|
|
376
|
+
time. A failed job exposes a stable problem code, never technical exceptions.
|
|
377
|
+
|
|
378
|
+
Completion means a paused supported provider copy was created or its old ID
|
|
379
|
+
was already imported. It does not prove activation, current provider routing, or
|
|
380
|
+
handoff from the source. `native_missing` preserves the old-ID skip after native
|
|
381
|
+
removal; clients must not recreate it automatically. Unsupported outbound providers
|
|
382
|
+
and installations disabled by the server remain unavailable. No operation accepts
|
|
383
|
+
credentials, remote writes, activation flags, native integration IDs or actor IDs.
|
|
384
|
+
|
|
385
|
+
### Durable integration handoff
|
|
386
|
+
|
|
387
|
+
`GetLegacyHandoffs(posId, { query: { active: true } })` discovers ongoing handoffs
|
|
388
|
+
without depending on a retained import process. `GetLegacyHandoff(posId,
|
|
389
|
+
handoffId)` reads the durable workspace; its identifier is the immutable native
|
|
390
|
+
installation UUID. `StartLegacyHandoffObservation(posId, handoffId,
|
|
391
|
+
{ connectionId })` requests a bounded observation with current source access.
|
|
392
|
+
The server derives the original hold and revalidates POS management permission.
|
|
393
|
+
|
|
394
|
+
Use the server's closed `allowedActions` values to render recovery controls.
|
|
395
|
+
`capturedWork.status = observed` certifies retained messages only; it does not
|
|
396
|
+
prove queue drainage, operational order conversion or integration activation.
|
|
397
|
+
`handoffComplete` remains false. Show a phase and count rather than deriving a
|
|
398
|
+
percentage from sparse source sequence numbers. A 202 acknowledgement with
|
|
399
|
+
`dispatchPending = true` retains the committed work for scheduler recovery.
|
|
400
|
+
No request accepts tokens, raw source messages, activation or hold-release flags.
|
|
401
|
+
|
|
402
|
+
`RecoverLegacySourceHold(posId, handoffId, { connectionId })` recovers an existing
|
|
403
|
+
source-writer hold intent through the original GET-first workflow. It never
|
|
404
|
+
creates another binding, request ID or hold. `sourceHoldRecoveryEligibility`
|
|
405
|
+
is independent of `observationEligibility`: source-hold recovery and captured-work
|
|
406
|
+
observation have separate default-off server controls. Render recovery only when
|
|
407
|
+
`allowedActions` contains `recover_source_hold`, and use
|
|
408
|
+
`sourceWriter.recoveryStatus` to distinguish `pending`, `checking`,
|
|
409
|
+
`needs_attention` and `confirmed`. A repeated request using the current execution
|
|
410
|
+
session preserves its active worker. New source credentials fence an old worker;
|
|
411
|
+
pruned original imports do not prevent recovery of an existing source receipt.
|
|
412
|
+
Neither a confirmed source writer hold nor captured messages certify full fleet
|
|
413
|
+
ownership, operational conversion, queue drainage or destination activation.
|
|
414
|
+
|
|
415
|
+
Provider request evidence is monitored independently through `providerEvidence`.
|
|
416
|
+
`CollectLegacyProviderEvidence` posts only `{ connectionId }` to the durable
|
|
417
|
+
handoff's `provider_evidence_collections`; `RetryLegacyProviderEvidence` explicitly
|
|
418
|
+
retries failed items through `provider_evidence_retries`. Use `allowedActions`
|
|
419
|
+
and the collection/retry eligibility fields before presenting either action.
|
|
420
|
+
A completed collection only certifies retained copies, never processed orders,
|
|
421
|
+
queue settlement, receiver activation, or completed handoff. Counts use actual
|
|
422
|
+
messages in the fixed scope, not the highest source sequence.
|
|
423
|
+
|
|
424
|
+
Evidence output validation requires the exact first `min(problemCount, 20)`
|
|
425
|
+
ordered problems. Only a running collection may report an in-flight message;
|
|
426
|
+
active or blocked collections must still have remaining work. A per-message
|
|
427
|
+
retry date is exposed only for a pending message in a pending/running collection.
|
|
428
|
+
|
|
429
|
+
### Initial source-writer hold
|
|
430
|
+
|
|
431
|
+
`StartLegacySourceHold(posId, handoffId, { requestId, connectionId, authorityId,
|
|
432
|
+
catalogProcessId, serviceBoundary })` reserves the initial hold intent for the
|
|
433
|
+
selected paused installation. The catalog process explicitly selects the completed
|
|
434
|
+
operational catalog import in the same destination POS and source account. It may
|
|
435
|
+
have a different menu from the provider configuration import; neither reference
|
|
436
|
+
is selected automatically from the latest import. The service boundary is an
|
|
437
|
+
explicitly confirmed past whole-second UTC timestamp ending in `Z`.
|
|
438
|
+
|
|
439
|
+
Source, provider, preparation and native identities are resolved on the server.
|
|
440
|
+
Retain the exact five input values after an uncertain response and resend that
|
|
441
|
+
same request. Do not replace the request ID, select a newer authority/catalog or
|
|
442
|
+
advance the boundary automatically. The server checks an exact retained replay
|
|
443
|
+
before mutable gates and source-session freshness. After a `202`, poll the
|
|
444
|
+
returned handoff through `GetLegacyHandoff`; `dispatchPending=true` means the
|
|
445
|
+
durable intent exists but queue publication needs recovery. Source-writer
|
|
446
|
+
confirmation, queue settlement and native activation remain separate;
|
|
447
|
+
`handoffComplete` is still false.
|
|
448
|
+
|
|
449
|
+
### SQL commercial evidence
|
|
450
|
+
|
|
451
|
+
Handoffs always expose `commercialEvidence`, independently of `providerEvidence`.
|
|
452
|
+
`CollectLegacyCommercialEvidence` and `RetryLegacyCommercialEvidence` POST only
|
|
453
|
+
`{ connectionId }` to the corresponding handoff operation. Use the required
|
|
454
|
+
`commercialCollectionEligibility`, `commercialRetryEligibility` and exact
|
|
455
|
+
`allowedActions` list; an active collection excludes competing workflows.
|
|
456
|
+
|
|
457
|
+
Classification counts the frozen candidate messages, including sequence gaps.
|
|
458
|
+
Until classification is sealed, `eligibleScopeCount`, `remainingCount` and
|
|
459
|
+
`captureProgressPercentage` are null. Existing recorded facts remain visible
|
|
460
|
+
while classification is retried. A zero eligible scope has no capture percentage.
|
|
461
|
+
`absentCount` means a captured SQL-order absence and remains a visible issue,
|
|
462
|
+
separate from `failedCount`. Unsupported work is a classification problem, while
|
|
463
|
+
`excludedCount` counts cancellations only. Blocked jobs promise no automatic
|
|
464
|
+
retry. Captured evidence does not prove order conversion, queue settlement or
|
|
465
|
+
receiver activation; `handoffComplete` remains false.
|
|
466
|
+
|
|
467
|
+
### Recorded legacy orders
|
|
468
|
+
|
|
469
|
+
Every handoff now includes required `recordedOrders`, `recordedImportEligibility`
|
|
470
|
+
and `recordedRetryEligibility` fields. Update the API and consumers together.
|
|
471
|
+
`StartLegacyRecordedOrders(posId, handoffId, {})` starts or resumes a frozen
|
|
472
|
+
retained-work scope. Pass `{ connectionId }` to reconnect an owned source session
|
|
473
|
+
when a missing header or item-details companion needs a protected source read.
|
|
474
|
+
Existing local facts and canonical replays remain usable without OAuth.
|
|
475
|
+
Both commands accept optional `fiscalConfirmationId` to adopt an exact, previously
|
|
476
|
+
recorded fee VAT confirmation. It must be a canonical lowercase UUID; no latest
|
|
477
|
+
confirmation is selected by the SDK, and an omitted field stays omitted. The API
|
|
478
|
+
rechecks the confirmation scope, current permission and frozen prefix. A selection
|
|
479
|
+
does not rewrite recorded fiscal facts or establish payment, release or activation.
|
|
480
|
+
`RetryLegacyRecordedOrders(posId, handoffId, {})` explicitly reopens failed items;
|
|
481
|
+
it does not replace an active run. Both commands return the current handoff with
|
|
482
|
+
`dispatchPending`: a true value means the committed job awaits queue publication,
|
|
483
|
+
so continue reading `GetLegacyHandoff` rather than creating another import.
|
|
484
|
+
|
|
485
|
+
Use `allowedActions` and the matching eligibility before offering either command.
|
|
486
|
+
The API rechecks current human permission and competing POS work at admission.
|
|
487
|
+
The closed `LegacyRecordedOrders` model separates actual created/replayed orders,
|
|
488
|
+
excluded cancellations, failures and pending historical recovery. Header/details
|
|
489
|
+
counts reflect retained companions and do not count as persisted orders.
|
|
490
|
+
`progressPercentage` is null for an empty scope; 100 can include failed items and
|
|
491
|
+
must not be described as a successful migration. Up to twenty ordered diagnostics
|
|
492
|
+
retain source sequence identifiers as decimal strings, including BIGINT values.
|
|
493
|
+
Neither a completed run nor an excluded cancellation acknowledges source work,
|
|
494
|
+
settles queues or activates an integration; `handoffComplete` remains false.
|
|
495
|
+
|
|
496
|
+
Recorded-order diagnostics include closed fresh-calculation, fiscal/catalog binding, lifecycle and native-reference failures. A cancellation review code does not acknowledge a source cancellation. Fresh held-order creation does not establish payment or provider acceptance; clients must keep those claims separate and use the server's allowed actions for every recovery attempt.
|
|
497
|
+
|
|
498
|
+
`legacy_recorded_order_remake_review_required` identifies a remake relation or parent that needs assistance before continuing; it remains pending blocked work without an automatic retry. `legacy_recorded_order_remake_invalid` identifies malformed retained relation evidence and is a permanent item failure. The earlier `legacy_operational_plan_remake_requires_review` remains readable. Clients should explain these as remake review, separately from cancellation, and must not promise that retrying or reconnecting repairs the relation.
|
|
499
|
+
|
|
500
|
+
Fee VAT confirmation starts with `StartLegacyFeeInventory(posId, handoffId)`.
|
|
501
|
+
Poll `GetLegacyFeeInventory(posId, handoffId, inventoryId)` and inspect bounded
|
|
502
|
+
`GetLegacyFeeInventoryItems` pages (optional `limit`, decimal-string `cursor`,
|
|
503
|
+
and `disposition`). `RetryLegacyFeeInventory` resumes a blocked analysis.
|
|
504
|
+
Start/retry responses contain `{ inventory, dispatchPending }`. Scope sequence
|
|
505
|
+
values are PostgreSQL BIGINT strings; message counts can contain sequence gaps.
|
|
506
|
+
Summary amounts remain exact signed four-decimal strings, including discounts.
|
|
507
|
+
|
|
508
|
+
Only `confirmationEligibility: 'ready'` permits explicit operator VAT selection.
|
|
509
|
+
Call `ConfirmLegacyFeeVat(posId, handoffId, { inventoryId,
|
|
510
|
+
inventoryFingerprint: inventory.manifestFingerprint, rates: { bag_fee: '22' } })`
|
|
511
|
+
with exactly the provider fee kinds requiring confirmation. The API checks the
|
|
512
|
+
sealed inventory and selections; no rate is inferred or defaulted. Pass the
|
|
513
|
+
returned confirmation `id` as `fiscalConfirmationId` when starting recorded-order
|
|
514
|
+
conversion. Inventory schemas expose only sanitized analysis metadata.
|
|
515
|
+
|
|
516
|
+
Reloaded handoffs expose `feeInventoryId` (nullable; omitted older API fields
|
|
517
|
+
normalize to `null`). It selects the active inventory, otherwise the latest
|
|
518
|
+
inventory retained for that handoff. Resume with
|
|
519
|
+
`GetLegacyFeeInventory(posId, handoff.id, handoff.feeInventoryId)` when present;
|
|
520
|
+
the request remains scoped to the same POS and handoff without starting a new
|
|
521
|
+
analysis. Progress and summary counts come from the inventory response.
|
|
522
|
+
|
|
523
|
+
`feeInventoryEligibility` advises whether inventory commands are available:
|
|
524
|
+
`ready`, `disabled`, `source_hold_required`, `source_hold_outcome_unknown`,
|
|
525
|
+
`native_unavailable`, or `another_process_active`. Older omitted fields default
|
|
526
|
+
to `disabled`. A retained `feeInventoryId` remains readable when commands are
|
|
527
|
+
disabled; use this eligibility together with inventory status to display actions,
|
|
528
|
+
and let each fresh POST enforce current authority.
|
|
529
|
+
|
|
530
|
+
Recorded-order progress includes separate `cancellationRecordedCount` and
|
|
531
|
+
`suppressedCreateCount` counters. Older API responses normalize omitted counters
|
|
532
|
+
to zero. Both count processed requests alongside created, replayed, excluded and
|
|
533
|
+
failed requests; they never increase `createdCount`. They record cancellation
|
|
534
|
+
requests and prevention of later creates, without asserting refunds, payment
|
|
535
|
+
settlement, canonical order status changes or activation of the new receiver.
|
|
536
|
+
Historical source evidence remains preserved.
|
|
537
|
+
|
|
538
|
+
### Paused outbound Tilby and CassaInCloud setup
|
|
539
|
+
|
|
540
|
+
`StartLegacyOutboundNativeInstallation(posId, processId, preparationId, { requestId, connectionId, authorityId })`
|
|
541
|
+
uses the dedicated `/native_outbound_installations` route. The strict input accepts only these three identifiers.
|
|
542
|
+
It returns the existing asynchronous native-installation receipt and uses the same workspace/job reads.
|
|
543
|
+
This creates a suspended provider configuration only; menu, mappings and activation still require completion. CassaInCloud requires an outbound source configuration and its valid captured locale. Workspace eligibility `locale_required` means the captured language needs assistance before continuing; clients must not guess a language or add one to the three-ID request.
|
|
544
|
+
Inbound native installation requests and their immutable inputs remain separate.
|
|
545
|
+
|
|
546
|
+
### Tilby mapping-run contracts (backend integration pending)
|
|
547
|
+
|
|
548
|
+
The eight `GetLegacyActiveTilbyMapping`, `GetLegacyTilbyMappingWorkspace`,
|
|
549
|
+
`StartLegacyTilbyMappingRun`, `GetLegacyTilbyMappingRun`,
|
|
550
|
+
`GetLegacyTilbyMappingRunItems`, `RetryLegacyTilbyMappingRun` and
|
|
551
|
+
`ReconnectLegacyTilbyMappingRun` and `AbandonLegacyTilbyMappingRun` requests describe the upcoming mapping API.
|
|
552
|
+
They do not establish server mutation readiness or activate an integration.
|
|
553
|
+
Backend admission, durable command acknowledgement journal and asynchronous dispatch
|
|
554
|
+
must be implemented before clients offer these actions.
|
|
555
|
+
|
|
556
|
+
Start sends only request, connection, authority, installation and component-capture
|
|
557
|
+
UUIDs. Retry sends request UUID and expected generation; reconnect additionally
|
|
558
|
+
sends connection and authority UUIDs. Reconnection can also resume eligible failed
|
|
559
|
+
products in a `completed_with_issues` run; it preserves lifetime attempts and
|
|
560
|
+
already installed facts. Workspace capabilities are advisory, and generation
|
|
561
|
+
capacity is required for every command. The server must verify current scope and
|
|
562
|
+
product eligibility before accepting a command. Acknowledgements bind the original request
|
|
563
|
+
UUID and accepted generation (1 for start, expected generation + 1 otherwise).
|
|
564
|
+
An uncertain POST must reuse the exact request UUID/body; a later GET is discovery,
|
|
565
|
+
not acknowledgement. No new UUID or changed generation should replace an unknown outcome.
|
|
566
|
+
|
|
567
|
+
All responses are closed and scoped to their route. Item pagination defaults to
|
|
568
|
+
page 1 / 50 rows, with at most 100 rows and an optional item status filter.
|
|
569
|
+
Progress is the floor of processed outcomes / total, including failed items;
|
|
570
|
+
empty totals have null percentage. A 100% result can contain issues and does not
|
|
571
|
+
claim activation or remote writes. Names may be absent after source pruning.
|
|
572
|
+
|
|
573
|
+
Abandonment uses `POST .../tilby_mapping_runs/{runId}/abandonments` with exactly
|
|
574
|
+
`{requestId,expectedGeneration}` and an acknowledgement bound to generation + 1.
|
|
575
|
+
The required workspace `canAbandon` advisory is true only for pending/blocked work
|
|
576
|
+
with generation capacity. Running attempts must settle before abandonment; no lease
|
|
577
|
+
is exposed. Backend closure and the immutable command journal remain pending.
|
|
578
|
+
|
|
579
|
+
### Starting source custody
|
|
580
|
+
|
|
581
|
+
`sourceHoldStartEligibility` defaults to `disabled` when omitted by an older API.
|
|
582
|
+
An initial command is offered only when it is `ready` and `allowedActions`
|
|
583
|
+
contains `start_source_hold`; this advisory never replaces server authorization.
|
|
584
|
+
`StartLegacySourceHold` retains its closed five-field body: `requestId`,
|
|
585
|
+
`connectionId`, `authorityId`, `catalogProcessId`, and `serviceBoundary`.
|
|
586
|
+
The operational catalog is an explicitly selected completed catalog import from
|
|
587
|
+
that POS and source account; its menu may differ from the provider integration.
|
|
588
|
+
The boundary is an explicit past whole-second UTC instant. An unknown POST must
|
|
589
|
+
replay the original complete body without replacing its request, access, catalog,
|
|
590
|
+
or boundary. A reserved source writer still requires confirmation before custody
|
|
591
|
+
is described as held; this command does not activate the native integration.
|
|
592
|
+
|
|
593
|
+
### Receiver custody association
|
|
594
|
+
|
|
595
|
+
Read the retained association for a handoff with `GetLegacyReceiverCustody`.
|
|
596
|
+
An HTTP 404 means there is no retained association for that scope. Use
|
|
597
|
+
`AdmitLegacyReceiverCustody` with the operator's original request ID when
|
|
598
|
+
admission is available. Preserve that ID when reconciling an uncertain reply.
|
|
599
|
+
|
|
600
|
+
```ts
|
|
601
|
+
const admitted = await client.call(new AdmitLegacyReceiverCustody(posId, handoffId, { requestId }))
|
|
602
|
+
const retained = await client.call(new GetLegacyReceiverCustody(posId, handoffId))
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
Both return the six immutable fields of `LegacyReceiverCustody`. The routing
|
|
606
|
+
workflow owns readiness checks and activation.
|
|
607
|
+
|
|
608
|
+
### Guided CassaInCloud product mapping
|
|
609
|
+
|
|
610
|
+
Cassa mapping uses its own typed one-product protocol. Start from `GetLegacyCassaMappingSourceProducts` with an explicitly selected completed import and provider preparation. Its current local labels and `imported` status are display hints, not current definition or provider identity proof; missing/deleted targets and import problems remain visible. Listing local products requires current POS permission but does not require renewing source credentials.
|
|
611
|
+
|
|
612
|
+
Use `GetLegacyCassaMappingCandidates` to read at most twenty authenticated, sales-point-scoped remote products. Despite its `Get` name this is a read-only `POST`, carrying the explicit process, preparation, source product, connection, authority and optional existing job. `ReviewLegacyCassaMappingProduct` is also read-only: it presents typed labeled source groups/choices and remote options/values, with bounded independent role pages. Names never imply identity. Select exact IDs from those observations and submit the complete typed `selection` for whole-product review. `exact_supported_projection` remains advisory until the worker repeats all checks.
|
|
613
|
+
|
|
614
|
+
```ts
|
|
615
|
+
const products = await client.call(
|
|
616
|
+
new GetLegacyCassaMappingSourceProducts(posId, installationId, {
|
|
617
|
+
query: { processId, preparationId, page: 1, itemsPerPage: 50 },
|
|
618
|
+
}),
|
|
619
|
+
)
|
|
620
|
+
// The operator chooses an imported product and exact remote roles from the typed review.
|
|
621
|
+
const accepted = await client.call(
|
|
622
|
+
new StartLegacyCassaMappingJob(posId, installationId, {
|
|
623
|
+
requestId,
|
|
624
|
+
processId,
|
|
625
|
+
preparationId,
|
|
626
|
+
sourceProductId,
|
|
627
|
+
connectionId,
|
|
628
|
+
authorityId,
|
|
629
|
+
selection,
|
|
630
|
+
}),
|
|
631
|
+
)
|
|
632
|
+
const job = await client.call(new GetLegacyCassaMappingJob(posId, installationId, accepted.jobId))
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
Read `GetLegacyCassaMappingJobs` for bounded history or `GetLegacyActiveCassaMapping` for POS-exclusive work. `ReselectLegacyCassaMappingJob`, `RetryLegacyCassaMappingJob`, `ReconnectLegacyCassaMappingJob` and `AbandonLegacyCassaMappingJob` require the observed `generation` and an immutable request UUID. Retry and reconnect preserve the five lifetime attempts and existing pending backoff. A changed local definition requires explicit reselection. Exact command replay returns its originally accepted generation; after an uncertain POST retain and replay the exact original request instead of creating another UUID or changing its body. `dispatchPending` means durable scheduling intent, not broker acceptance or completed mapping.
|
|
636
|
+
|
|
637
|
+
The protocol never activates an integration or writes the remote catalog. Fixed zero-price ingredients may have an explicit local-only witness; unsupported charged/fiscal/role/price/order cases remain finite operator-visible failures. These request/schema tests use synthetic HTTP and do not establish connected provider-account readiness.
|
|
638
|
+
|
|
639
|
+
### Fixed-prefix held source settlement
|
|
640
|
+
|
|
641
|
+
`StartLegacySourceSettlement(posId, {requestId, holdId, connectionId})` reserves
|
|
642
|
+
an explicitly selected held scope. The hold ID is distinct from a native installation
|
|
643
|
+
ID. `GetLegacyActiveSourceSettlement(posId)` discovers only pending, running or
|
|
644
|
+
blocked work; `GetLegacySourceSettlement(posId, settlementId)` reads retained progress
|
|
645
|
+
without source/provider HTTP or live import/native parents. Current human POS
|
|
646
|
+
permission remains required. The feature defaults off on the server.
|
|
647
|
+
|
|
648
|
+
`ResumeLegacySourceSettlement` sends `{requestId, generation, connectionId}`;
|
|
649
|
+
`AbandonLegacySourceSettlement` sends `{requestId, generation}`. Running work cannot
|
|
650
|
+
be taken over. Each acknowledgement binds the POS, request, operation, settlement
|
|
651
|
+
and original `acceptedGeneration` (1 for start, observed generation + 1 otherwise).
|
|
652
|
+
After an uncertain POST, retain the original request UUID and identical full body
|
|
653
|
+
and replay that command. A malformed or scope-mismatched acknowledgement also
|
|
654
|
+
leaves the POST outcome uncertain. Do not infer rejection from a lost acknowledgement or
|
|
655
|
+
replace it with a new UUID. `dispatchPending` reports a caught post-commit publication failure. A `false`
|
|
656
|
+
value does not prove broker publication: retained terminal work, work not yet due,
|
|
657
|
+
or a disabled publisher may legitimately send nothing. The value may change on
|
|
658
|
+
exact replay; it is not completion or source acceptance.
|
|
659
|
+
|
|
660
|
+
The denominator is `null` until the source prefix is frozen. `percentage` counts
|
|
661
|
+
acknowledged messages within that fixed prefix only. A pending job may have 100%
|
|
662
|
+
without its final acknowledgement. A genuinely empty prefix remains 0% until
|
|
663
|
+
`status: 'completed'` and `completionReceiptFingerprint` confirm its final ACK.
|
|
664
|
+
Neither 100% nor completion proves fleet drainage, ingress ownership, source
|
|
665
|
+
release, quarantine release, or native activation. No such operation is exposed
|
|
666
|
+
by these five requests.
|
|
667
|
+
|
|
668
|
+
Recorded operational orders require `nonImportableCount`, a subset of `failedCount`. SQL-absent Deliveroo remakes use `legacy_recorded_order_remake_sql_absent_not_importable`: their actual prices are unavailable, so they are not converted or offered for retry. Successful siblings continue. These failures count once in processed progress and never establish source settlement, refunds, cancellation or activation. Other remake review and invalid-data diagnostics retain their separate meanings.
|
|
669
|
+
|
|
670
|
+
Fee-inventory items and filters distinguish `not_applicable_non_importable_remake` from inspected charges. This classified exclusion has null currency, zero occurrences and no problem: it does not prove that the excluded order had no charges. VAT review covers importable orders; other classified orders can still require rate confirmation. Non-importable remakes remain visible during recorded conversion and do not become source-settlement, refund or cancellation evidence.
|
|
671
|
+
|
|
672
|
+
### Durable legacy configuration removal
|
|
673
|
+
|
|
674
|
+
The five typed operations are `StartLegacyConfigurationRemoval`,
|
|
675
|
+
`GetLegacyHandoffConfigurationRemoval`, `GetLegacyConfigurationRemovalRequest`,
|
|
676
|
+
`GetLegacyConfigurationRemoval`, and `RecoverLegacyConfigurationRemoval`.
|
|
677
|
+
They accept only owned reference IDs and conditional authority revisions; provider
|
|
678
|
+
commands and targets remain server-owned. After an unknown start, read the exact
|
|
679
|
+
original request before considering another submission. A conditional recovery is
|
|
680
|
+
an explicit operator action and retains the original command identity. The operation percentage refers only to verified configuration removal.
|
|
681
|
+
`handoffComplete=true` additionally requires the retained atomic routing activation
|
|
682
|
+
proof and completed custody/source-effect evidence; configuration removal alone
|
|
683
|
+
keeps it false. These read models do not authorize order release.
|
|
684
|
+
|
|
685
|
+
Operation progress includes required nullable `prefixProgress`. When present,
|
|
686
|
+
its safe integer counters describe the frozen provider custody cohort, not orders
|
|
687
|
+
created or source acknowledgements. `custodyComplete=true`, including an empty
|
|
688
|
+
0/0 cohort, does not authorize configuration removal, source disposition, order
|
|
689
|
+
release or native activation. `transfer_prefix` and `await_source_proof` retain
|
|
690
|
+
an indeterminate overall percentage until the exact removal receipt exists.
|
|
691
|
+
|
|
692
|
+
### Automatic routing consent
|
|
693
|
+
|
|
694
|
+
`GetLegacyRoutingPreference` and `UpdateLegacyRoutingPreference` read and conditionally save the retained, default-off preference for one POS-owned handoff. Enabling requires an explicitly connected current source session and `{enabled:true,expectedRevision,connectionId}`. Disabling accepts only `{enabled:false,expectedRevision}` and never cancels or creates another accepted operation. Unknown saves must be recovered with GET before another conditional write. A saved preference does not prove completed checks, configuration removal or native activation.
|
|
695
|
+
|
|
696
|
+
The configuration-removal workspace now requires nullable `reservedRequestId`. Manual start must use that authoritative UUID when present. A locally retained unknown request must first be resolved by its exact known-request GET; only an exact404 followed by a fresh inactive workspace permits replacing an unaccepted intent with the current reservation. Network failures never authorize replacing that original identity.
|
|
697
|
+
|
|
698
|
+
Configuration-removal responses require nullable `sourceEffectProgress`, separate from raw `prefixProgress`. A null processed ordinal is unknown even for an empty cohort; an exact verified zero of zero may be complete. Source-effect completion does not imply configuration removal, routing activation, or an overall percentage. The phases `transfer_source_effects`, `await_source_effects`, and `await_routing_prerequisites` describe this verification and the remaining routing checks.
|
|
699
|
+
|
|
700
|
+
The optional nullable `routingBarrierProgress` exposes safe final-custody counters
|
|
701
|
+
(`processedCount`, `observedCount`, `percentage`, `custodyComplete`). Its percentage
|
|
702
|
+
is exact integer progress against the currently observed frontier, which can grow
|
|
703
|
+
while new orders arrive. A verified empty frontier is complete at 100%; this does
|
|
704
|
+
not imply routing activation. Older responses without these counters remain readable.
|
|
705
|
+
|
|
706
|
+
Completed handoff workspaces retain historical `handoffComplete=true` even after a
|
|
707
|
+
manual integration pause. Current `nativeState` is `active`, `paused`, `changed`, or
|
|
708
|
+
`missing`; only a validated completed transfer can expose `active`. All ten source
|
|
709
|
+
eligibility fields become `handoff_completed`, with only `check_status` available.
|
|
710
|
+
The nullable `configurationRemovalStatus` describes the retained routing operation;
|
|
711
|
+
pending, running and unknown outcomes keep the workspace active. The SDK also reads
|
|
712
|
+
older responses that omit this field, without inventing completion.
|
|
713
|
+
|
|
714
|
+
|
|
715
|
+
### Late-delivery progress and recovery
|
|
716
|
+
|
|
717
|
+
`GetLegacyLateWork` reads observed delivery and recovery-command counts after
|
|
718
|
+
handoff. `GetLegacyLateDeliveries` uses a scoped cursor (default25, maximum50);
|
|
719
|
+
`GetLegacyLateDelivery` returns the authoritative stage eligibility. These reads
|
|
720
|
+
remain separate from historical handoff completion.
|
|
721
|
+
|
|
722
|
+
`RetryLegacyLateDelivery` submits an explicit conditional processing, publication
|
|
723
|
+
or service-recovery command using the backend's generation and blocked
|
|
724
|
+
fingerprint. Save the request UUID before sending. After a lost reply, call
|
|
725
|
+
`GetLegacyLateDeliveryRetry` and `GetLegacyLateDeliveryRetryStatus` before any new
|
|
726
|
+
command. Reuse the same UUID/input to recover its original acknowledgement.
|
|
727
|
+
|
|
728
|
+
When the backend permits reconciliation, `ReconcileLegacyLateDeliveryRetry`
|
|
729
|
+
requests only a known-result check or a no-work closure; it cannot restart
|
|
730
|
+
processing. Recover its immutable acknowledgement with
|
|
731
|
+
`GetLegacyLateDeliveryReconciliation`. Never infer permission from a displayed
|
|
732
|
+
status or automatically repeat a manager POST.
|
|
733
|
+
|
|
734
|
+
A service result of `applied` means restart accepted; `closed_unapplied` means
|
|
735
|
+
the attempt closed without restart. Neither proves order, provider receipt or
|
|
736
|
+
receiver completion. Counts cover observed work and must not become a permanent
|
|
737
|
+
whole-tail100% indicator. Recovery endpoints require the coordinated API/provider
|
|
738
|
+
feature gate and current POS-manager authorization.
|
|
739
|
+
|
|
740
|
+
## Source menu state during discovery
|
|
741
|
+
|
|
742
|
+
Menu discovery may include `sourceState: { version: 1, enabled, usable, editable }` with strict booleans. The object is optional for existing v1 sources; absence means unknown, rather than enabled or unavailable. Keep every authorized menu in the paginated result, including inactive, unusable and noneditable menus. `editable` describes source editing only and never controls menu/product availability or permission to copy. A client can prefer an enabled and usable default menu, but inactive/unknown menus need an explicit selection with a warning. No discovery field authorizes provider activation.
|
|
743
|
+
|
|
744
|
+
`source_menu_state_changed` is a typed product catalog problem reason: a previously copied product keeps its existing data when its source menu context changes, and requires review before reuse. It is not an instruction to overwrite or activate anything automatically.
|
|
745
|
+
|
|
746
|
+
|
|
747
|
+
## Local Storefront, KDS and printer preparations
|
|
748
|
+
|
|
749
|
+
`GetLegacyLocalResources` lists captured local configurations for one POS/process.
|
|
750
|
+
`GetLegacyLocalResourcePreparation` reads typed source configuration and the latest
|
|
751
|
+
installation summary. A preparation ID is not a target resource ID. Retain both
|
|
752
|
+
source and visual-evidence fingerprints when reviewing explicit installation choices.
|
|
753
|
+
|
|
754
|
+
The collection uses the standard SDK pagination result: `data` contains the rows
|
|
755
|
+
and `pagination.totalItems` is the filtered total. Support page navigation rather
|
|
756
|
+
than assuming the first page contains every preparation:
|
|
757
|
+
|
|
758
|
+
```ts
|
|
759
|
+
const page = await client.call(
|
|
760
|
+
new GetLegacyLocalResources(posId, processId, {
|
|
761
|
+
query: { page: 1, itemsPerPage: 30, sourceKind: 'kitchen' },
|
|
762
|
+
}),
|
|
763
|
+
)
|
|
764
|
+
const preparations = page.data
|
|
765
|
+
const totalPreparations = page.pagination.totalItems
|
|
766
|
+
```
|
|
767
|
+
|
|
768
|
+
`InstallLegacyLocalResource` accepts only the settings for that resource kind and a
|
|
769
|
+
new request ID after review. Its receipt records paused integrations or printer IDs;
|
|
770
|
+
it never performs activation, transfers branding, connects hardware or configures
|
|
771
|
+
automatic printing. KDS privacy choices are explicit because the old configuration
|
|
772
|
+
did not record them. Uber Eats is deliberately excluded.
|
|
773
|
+
|
|
774
|
+
After a timeout or uncertain acknowledgement, retain the request ID and use only
|
|
775
|
+
`GetLegacyLocalInstallation` to reconcile it. That read distinguishes original
|
|
776
|
+
receipt descriptors from current target state (`installed`, `changed`, `deleted`,
|
|
777
|
+
`unverified_baseline`). A missing receipt, unavailable read or revoked permission
|
|
778
|
+
must never trigger another POST. An old receipt without a trustworthy fingerprint
|
|
779
|
+
remains unverified. No source credential, target secret or captured CSS is submitted
|
|
780
|
+
as a setting. These contracts require the coordinated additive API companion.
|