@deliverart/sdk-js-integration-diagnostics 0.0.0-stage → 2.40.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 CHANGED
@@ -1,3 +1,298 @@
1
- # Temporary Holding Version
1
+ # Integration diagnostics
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Provider-neutral diagnostic contracts shared by Hub and Admin. Requires the API
4
+ integration diagnostics migrations and endpoints from the coordinated feature.
5
+ The package does not replace the native integration-issue or order-export APIs.
6
+
7
+ ```ts
8
+ import {
9
+ GetDiagnosticProblems,
10
+ GetDiagnosticProblemDetails,
11
+ VerifyDiagnosticProblem,
12
+ PreviewDiagnosticRecovery,
13
+ RequestDiagnosticRecovery,
14
+ describeDiagnostic,
15
+ } from '@deliverart/sdk-js-integration-diagnostics'
16
+
17
+ const page = await client.call(new GetDiagnosticProblems(posId, {
18
+ query: { state: 'open', page: 1, itemsPerPage: 30 },
19
+ }))
20
+ const problem = await client.call(new GetDiagnosticProblemDetails(problemId))
21
+ const explanation = describeDiagnostic(problem.operations[0]?.evidence ?? null, 'it')
22
+ const checked = await client.call(new VerifyDiagnosticProblem(problemId))
23
+
24
+ // Build this list from the operator's explicit selection, never every open row.
25
+ const input = { requestKey: crypto.randomUUID(), operations: selectedOperations }
26
+ const preview = await client.call(new PreviewDiagnosticRecovery(posId, input))
27
+ // Display eligibility before requesting recovery. The API revalidates again.
28
+ const receipt = await client.call(new RequestDiagnosticRecovery(posId, input))
29
+ ```
30
+
31
+ Keep the same request key when retrying a submission
32
+ whose HTTP response was lost. A submitted receipt or published queue message
33
+ is not business success; refresh the affected operation to observe its outcome.
34
+
35
+ `GetDiagnosticOverview` separates problem counts from unique affected operation
36
+ counts. Never add them together. Problem summaries separately report verified
37
+ success, manual handling and outstanding work: 17 successes out of 20 leave 3
38
+ operations outstanding even when the original cause has been corrected.
39
+
40
+ `VerifyDiagnosticProblem` performs a bounded local check with a shared cooldown.
41
+ Respect scope, checked/expiry times and `fresh`. A present local mapping does
42
+ not prove remote availability or order delivery. Refresh does not retry work.
43
+
44
+ `CloseDiagnosticOperation` requires the current revision and a non-blank reason.
45
+ Manual handling is distinct from success and blocks future export redispatch;
46
+ this initial API does not expose reopening. Do not invoke it for a whole problem
47
+ when the operator has only selected one affected operation.
48
+
49
+ Unknown finding schemas become null evidence and clear `evidenceComplete`.
50
+ Unknown recovery actions become null and ineligible previews, so newer server
51
+ capabilities cannot accidentally execute through an older client. Known evidence
52
+ preserves cause/affected/context roles. Resource names and authored narratives
53
+ are plain text; render with normal escaping, never as HTML. Application routes,
54
+ authorization, controls and realtime refresh remain owned by each consumer.
55
+
56
+ `describeDiagnostic`, `describeVerification` and `diagnosticResourceName` provide
57
+ shared Italian/English presentation without requiring React or a MUI version.
58
+ Unrecognized codes receive an incomplete-diagnosis explanation. These initial
59
+ messages cover missing Cassa modifier mappings and Elephant import interruptions
60
+ or partial failures, plus staged synchronization timeouts, partial errors and
61
+ unconfirmed completion. These explanations describe known process outcomes without
62
+ claiming a confirmed root cause. Add authored narratives alongside future
63
+ contributor coverage rather than parsing technical exception strings.
64
+
65
+
66
+ Operation rows include optional native `context`, validated independently from
67
+ failure evidence. Unknown context kinds become null; clients must not construct
68
+ resource links from unrecognized shapes. `describeDiagnosticOperation` provides
69
+ Italian/English labels for orders, staged sync scopes and imports. Order labels
70
+ use the authorized native reference; routes use `resourceId`, never the export
71
+ UUID or an arbitrary provider URL. Missing context keeps legacy rows readable.
72
+ Staged sync context may include `direction: inbound | outbound | null`, relative
73
+ to Deliverart. Labels spell out the source and destination; missing legacy values
74
+ remain "Direction not recorded". Direction is descriptive and never grants retry
75
+ eligibility or changes native synchronization settings.
76
+
77
+
78
+ `diagnosticInvalidationRevision` accepts only the diagnostic event envelope for
79
+ its requested POS. Revisions are decimal strings to preserve PostgreSQL bigint
80
+ precision. This event carries no findings or totals: use it to coalesce rereads,
81
+ not to mutate counters locally. Reconcile snapshots after reconnects and missed
82
+ messages even when revisions have already been seen.
83
+
84
+ Local menu validation findings provide field-specific, authored Italian/English
85
+ explanations for names, descriptions, prices, tax, selection limits, images and
86
+ references. They identify publication resources without assuming composite provider
87
+ IDs are local catalog UUIDs. Incomplete evidence has its own explicit explanation.
88
+ Pre-submission validation must not be presented as remote publication confirmation.
89
+
90
+ The `publication_validation` operation context identifies version-owned local
91
+ validation. Delivery/collection context resources have localized labels. Field
92
+ explanations allow partial submission: another menu portion may succeed while the
93
+ reported portion was excluded. Validation success is never publication success.
94
+
95
+ ### Problem assistance
96
+
97
+ Assistance is a human conversation attached to a diagnostic problem. Completing
98
+ assistance does not resolve the technical cause, close an operation, or retry it.
99
+ `GetDiagnosticAssistanceHistory` returns bounded public request summaries;
100
+ `GetDiagnosticAssistanceDetails` returns a separately paginated public timeline.
101
+ Use `RequestDiagnosticAssistance` with a stable `requestKey`, and
102
+ `ReplyDiagnosticAssistance` with a stable `actionKey` and the current revision.
103
+ Reuse the same key and payload after an uncertain HTTP result. A conflict requires
104
+ reloading the request; do not silently generate a fresh key and repeat an action.
105
+
106
+ Administrative consumers use `GetDiagnosticAssistanceInternal` for private notes
107
+ and operator identities, and `UpdateDiagnosticAssistance` for assignment, public
108
+ questions, completion, and notes. Notes default to `internal`; a customer question
109
+ requires `audience: 'public'` and a non-empty body. Customer replies cannot choose
110
+ an audience. API permissions remain authoritative; importing an administrative
111
+ request class grants no access. Public schemas strip unexpected identity fields,
112
+ but the API must exclude private events before pagination and serialization.
113
+
114
+ These endpoints return explicit bounded objects rather than generic API Platform
115
+ collections. All read requests accept `page` and `itemsPerPage` (at most 100).
116
+
117
+ `GetDiagnosticAssistanceQueue` is the separate global super-admin metadata queue.
118
+ It defaults to open requests, supports state/assignment/POS/integration filters,
119
+ and uses standard paginated SDK results. `assignment: 'mine'` is resolved by the
120
+ API from the current user. Queue rows contain no conversation bodies. Individual
121
+ conversation reads and actions retain their own source-access requirements;
122
+ a queue row must not be treated as an authorization capability.
123
+
124
+ Glovo structured remote pre-upload validation uses `remote_menu_resource_*_invalid`
125
+ narratives. These identify provider validation, not local validation or successful
126
+ publication. `remote_menu_validation_details_unavailable` explicitly reports
127
+ incomplete evidence; neither clients nor shared copy infer an item from free text.
128
+
129
+ `publication_receipt` operation context names a native asynchronous menu upload.
130
+ `menu_publication_*` guidance distinguishes rejected content, access/fetch/configuration
131
+ problems, provider errors, limits and exhausted polling. Unknown outcomes explicitly
132
+ require verification before another send. These descriptions do not imply successful
133
+ publication for another transaction or offer an unsupported retry capability.
134
+
135
+ Common `integration_*` issue codes have Italian/English explanations for
136
+ authentication, permission, missing references, menu validation, rejected data,
137
+ daily limits and generic process failures. A known classification is described
138
+ even when its precise cause remains unconfirmed. Guidance does not invent broken
139
+ credentials/resources or promise automatic recovery. Unknown codes retain the
140
+ safe incomplete-diagnosis fallback. `diagnosticResourceName` accepts an optional
141
+ source service for a readable integration label and translates known operation
142
+ scopes; recorded names/translations retain priority over fallback labels.
143
+
144
+ ### Operation action availability
145
+
146
+ Operation `actions` contains independent recovery/manual-closure decisions and
147
+ `evaluatedAt`. `describeDiagnosticActionAvailability` translates known reasons
148
+ into Italian/English. Unknown or malformed executable metadata parses as null;
149
+ clients must disable actions until availability is verified. An available read
150
+ is advisory: native submission still checks permissions, revision and state.
151
+
152
+ ### Product mapping narratives and regional resource names
153
+
154
+ Confirmed `catalog_product_mapping_missing` findings have Italian/English
155
+ explanations distinct from modifier failures and from unverified generic codes.
156
+ Names prefer the requested language, then a matching regional catalog locale
157
+ (underscore and BCP-47 separators are accepted), before the existing name/language
158
+ fallbacks. Regional names such as `it_IT` and `en_GB` must not degrade to UUIDs.
159
+ Local mapping correction is not remote availability or automatic recovery.
160
+
161
+ Confirmed top-level variant and sales-mode mapping failures have separate shared
162
+ Italian/English narratives. They do not infer product, payment or nested bundle
163
+ errors. Unverified legacy codes retain the incomplete-diagnosis fallback. Operator
164
+ selection remains explicit after any local correction.
165
+
166
+ Confirmed `catalog_choice_mapping_missing` findings have shared Italian/English
167
+ explanations distinguishing the affected selected choice from its mapped modifier
168
+ group. Resource snapshots identify the group and order rows, and recovery remains
169
+ an explicit operator selection. Unknown or unconfirmed evidence keeps the generic
170
+ incomplete-diagnosis fallback.
171
+
172
+ Bundle diagnostics distinguish missing and ambiguous component mappings using the
173
+ exact owning bundle plus modifier. Removed modifier/component definitions retain
174
+ historical order-group names and use separate narratives; a blind retry is not
175
+ presented as a repair. These explanations are shared by Hub/Admin in Italian and
176
+ English, with generic fallback for unconfirmed evidence.
177
+
178
+ `describeDiagnosticResourcePath` renders recorded parent relationships using the
179
+ same localized resource names as the main evidence list. It returns no path for
180
+ missing, ambiguous, cyclic, unnamed or excessively deep ancestry. Hub and Admin
181
+ render the returned plain text through React, without interpreting resource names
182
+ as HTML or guessing catalog links.
183
+
184
+ Local verification copy distinguishes a confirmed continuing mapping ambiguity
185
+ from inconclusive duplicate mappings. Current checked results also explain missing
186
+ mappings, unavailable resources, insufficient evidence, unsupported/unavailable
187
+ checks and changed evidence. Unknown reasons keep the generic safe fallback and
188
+ never expose the raw reason. Missing timestamps and stale evidence take priority
189
+ over all specific advice. None of these explanations selects or submits recovery.
190
+
191
+ Requested Deliveroo menu work uses the common narrative entry point with separate
192
+ codes for paused preparation, failed delivery, upload rejection, request limits,
193
+ uncertain outcomes, earlier submissions still pending, and positive publication evidence requiring review. Italian and
194
+ English copy never equates a matching read with completed recovery while native
195
+ state or other unresolved submissions remain unverified. These explanations do
196
+ not enable a retry capability; clients must keep using the API's action guards.
197
+
198
+ Staged synchronization evidence can include `process_step` context resources,
199
+ parented to the native process. These contain only recorded allowlisted stage
200
+ identifiers. Shared labels translate all CassaInCloud/Tilby steps; unknown future
201
+ steps show a neutral fallback. A recorded stage is not a causal resource or a
202
+ complete list of affected products, and does not grant recovery capability.
203
+
204
+
205
+ CassaInCloud inbound customer recovery uses `sync_current_state`. Its Italian and
206
+ English confirmation explains that this creates a new full import, updates linked
207
+ customers, imports missing customers and preserves the previous attempt. It also
208
+ warns that local customer updates can trigger other configured synchronizations.
209
+ The explanation never selects or submits an operation; current server eligibility
210
+ and an explicit customer confirmation remain required. Outbound customer recovery
211
+ and other staged sync kinds must not inherit this capability from their labels.
212
+
213
+
214
+ Resource labels reuse the closed synchronization-scope vocabulary for native
215
+ configuration context. Unnamed process resources use a localized process label
216
+ and a short reference; persisted resource names/translations still take priority.
217
+ This avoids exposing a bare process UUID or an English scope key as customer copy.
218
+
219
+
220
+ Elephant lifecycle diagnostics expose `integration_lifecycle` operation context
221
+ with integration/restaurant scope. Shared Italian/English narratives explain only
222
+ an allowlisted operational code and the recorded phase. Unknown remote codes never
223
+ become authored advice. The copy does not equate a cleared error with successful
224
+ activation or enable retries unsupported by the API. Phase labels come from the
225
+ closed native enum and remain distinct from a verified cause.
226
+
227
+ Tilby pre-send order findings use the stable `tilby_seller_missing`,
228
+ `tilby_department_mapping_missing`, `tilby_product_mapping_missing_for_variant`,
229
+ `tilby_variant_mapping_missing`, `tilby_modifier_mapping_missing` and
230
+ `tilby_choice_mapping_missing` codes. `describeDiagnostic` supplies shared English
231
+ and Italian recovery guidance. Resource labels preserve saved catalog/order names;
232
+ configuration identifiers have shared names. These findings do not authorize a
233
+ retry, certify remote existence or override uncertain-send reconciliation.
234
+
235
+ Local Tilby verification uses the same common verification envelope as other
236
+ providers. Seller checks distinguish `configuration_missing` from
237
+ `local_configuration_present`; the shared IT/EN presentation states explicitly
238
+ that a local correction neither retries work nor proves remote configuration.
239
+ Mapping checks keep the existing mapping reasons. Only fresh local results with
240
+ the matching outcome/reason pair receive this explanation; unknown, stale or
241
+ remote results retain their own fallback. Consumers must preserve separate
242
+ operation outcomes and explicit operator selection.
243
+
244
+ Selected Tilby fiscal recovery describes its full inbound VAT/department import,
245
+ preserved manual mapping resolutions, immutable prior history and separate order
246
+ recovery. The explanation is gated by the exact native source/action pair.
247
+
248
+ Provider labels use `diagnosticServiceName` and the optional service argument of `describeDiagnosticOperation`. Unknown services are not echoed. Receipt service metadata is nullable and permission-scoped.
249
+
250
+ Tilby fiscal affected-resource identities use `tilby:vat:<integer>` for tax resources and `tilby:departments:<integer>` for configuration resources. The shared narrative renders their complete external ID with an IT/EN label, without treating the ID as a local entity or a confirmed cause.
251
+
252
+ Recorded Tilby menu resource labels support `tilby:categories:<integer>`, `tilby:components:<integer>` and `tilby:products:<integer>` with category, configuration and product kinds respectively. Components deliberately use a neutral label rather than guessing whether the local mapping is an item or modifier.
253
+
254
+ Selected Tilby customer recovery uses the `tilby_sync_customers` / `sync_current_state` narrative in IT/EN: a full customer import, retained history, possible configured downstream updates and separate order recovery.
255
+
256
+ Recorded inbound Cassa menu resources use `cassa_in_cloud:<step>:<uuid>` identifiers. Shared resource presentation supports category, product, composite-product, option, department and sales-mode references in Italian and English, validates kind/step pairs and keeps the full external UUID visible. These identifiers must not be used as local catalog links or treated as proof of a root cause.
257
+
258
+ ### Recorded Tilby menu causes
259
+
260
+ `describeDiagnostic` translates the stable inbound `tilby_menu_*` codes into
261
+ Italian/English titles, historical explanations and operator next steps. Product
262
+ references identify affected remote items, not local catalog links. Unsupported
263
+ variation/component cases do not infer an exact modifier or choice. Guidance keeps
264
+ current-state verification separate and asks operators to choose recovery actions
265
+ explicitly after correcting the cause. Unknown codes retain the shared fallback.
266
+
267
+
268
+ Captured Tilby product names are displayed alongside the provider label and exact
269
+ external ID. These names come from the recorded failed attempt, not a current
270
+ mapping lookup. Legacy unnamed evidence remains ID-only. Labels are rendered as
271
+ text; markup in provider names never becomes HTML. Newer failures for the same
272
+ product/reason can update the displayed snapshot while retaining native history.
273
+
274
+ Verification may include optional `findings` (at most 100 typed findings). Render
275
+ these under the verification timestamp, separately from historical operation
276
+ evidence. An `unknown/current_local_blockers` result describes current local
277
+ configuration and does not reconstruct the historical failure. An
278
+ `unknown/local_validation_passed` result confirms neither historical correction
279
+ nor remote delivery. Old responses without `findings` remain readable.
280
+
281
+
282
+ Just Eat selected recovery uses `justeat_menu_submission` with
283
+ `sync_current_state`. The shared Italian/English confirmation explains full current
284
+ catalog publication, preserved historical evidence, and the distinction between
285
+ request acceptance, menu generation and provider-confirmed publication. Unknown
286
+ publication outcomes must remain ineligible for another submission; the API owns
287
+ eligibility and clients must not infer permission from this explanatory copy.
288
+
289
+ Shared publication diagnostics use provider-neutral wording for codes emitted by
290
+ multiple integrations. `menu_publication_queue_delivery_failed` describes an
291
+ unconfirmed internal delivery, not a remote rejection; its recovery guidance asks
292
+ support to verify the operation before another submission.
293
+
294
+ Kitchen access preparation failures use `kitchen_access_setup_failed` and the
295
+ `integration_lifecycle` context with `access_setup` scope. Shared Italian/English
296
+ copy explains exhausted setup attempts without asserting a technical root cause
297
+ or live device connectivity. Public evidence must never contain credential
298
+ values. Unknown codes continue to use the common safe fallback.