@jskit-ai/http-web 0.2.8 → 0.2.9

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.
Files changed (68) hide show
  1. package/package.json +7 -6
  2. package/src/client/bulkActions.js +2 -0
  3. package/src/client/components/CrudAddEditScreen.vue +13 -18
  4. package/src/client/components/CrudDeleteAction.vue +1 -1
  5. package/src/client/components/CrudListBulkActionSurface.vue +13 -13
  6. package/src/client/components/CrudListDateFilterControl.vue +2 -2
  7. package/src/client/components/CrudListFilterControls.vue +4 -4
  8. package/src/client/components/CrudListFilterSurface.vue +8 -8
  9. package/src/client/components/CrudListRecordActionMenu.vue +9 -19
  10. package/src/client/components/CrudListScreen.vue +21 -39
  11. package/src/client/components/CrudViewScreen.vue +4 -4
  12. package/src/client/components/SelectField.vue +1 -0
  13. package/src/client/composables/crud/crudHttpClientSupport.js +10 -10
  14. package/src/client/composables/crud/crudJsonApiTransportSupport.js +1 -0
  15. package/src/client/composables/crud/crudLookupFieldRuntime.js +3 -3
  16. package/src/client/composables/crud/crudSchemaFormHelpers.js +3 -3
  17. package/src/client/composables/internal/crudListFilterLookupSupport.js +10 -8
  18. package/src/client/composables/internal/crudListParentTitleSupport.js +2 -2
  19. package/src/client/composables/internal/useOperationScope.js +7 -5
  20. package/src/client/composables/records/useAddEdit.js +12 -11
  21. package/src/client/composables/records/useCrudAddEdit.js +27 -40
  22. package/src/client/composables/records/useCrudList.js +4 -11
  23. package/src/client/composables/records/useCrudView.js +4 -10
  24. package/src/client/composables/records/useList.js +18 -11
  25. package/src/client/composables/records/useView.js +18 -11
  26. package/src/client/composables/runtime/addEditUiRuntime.js +10 -17
  27. package/src/client/composables/runtime/listUiRuntime.js +17 -20
  28. package/src/client/composables/runtime/modelStateHelpers.js +18 -8
  29. package/src/client/composables/runtime/operationUiHelpers.js +20 -20
  30. package/src/client/composables/runtime/operationValidationHelpers.js +10 -5
  31. package/src/client/composables/runtime/useAddEditCore.js +39 -36
  32. package/src/client/composables/runtime/useCommandCore.js +33 -32
  33. package/src/client/composables/runtime/useEndpointResource.js +10 -14
  34. package/src/client/composables/runtime/useFieldErrorBag.js +3 -2
  35. package/src/client/composables/runtime/useListCore.js +7 -11
  36. package/src/client/composables/runtime/useUiFeedback.js +3 -2
  37. package/src/client/composables/runtime/useViewCore.js +10 -20
  38. package/src/client/composables/runtime/viewUiRuntime.js +7 -6
  39. package/src/client/composables/support/listQueryParamSupport.js +6 -10
  40. package/src/client/composables/support/refValueHelpers.js +2 -6
  41. package/src/client/composables/support/requestQueryRuntimeSupport.js +2 -2
  42. package/src/client/composables/support/routeTemplateHelpers.js +13 -12
  43. package/src/client/composables/support/scopeHelpers.js +5 -4
  44. package/src/client/composables/useAccess.js +8 -5
  45. package/src/client/composables/useCommand.js +7 -6
  46. package/src/client/composables/useCrudAddEditScreen.js +13 -12
  47. package/src/client/composables/useCrudDeleteAction.js +13 -25
  48. package/src/client/composables/useCrudListBulkActions.js +18 -14
  49. package/src/client/composables/useCrudListFilterLookups.js +8 -4
  50. package/src/client/composables/useCrudListFilters.js +13 -6
  51. package/src/client/composables/useCrudListParentTitle.js +10 -9
  52. package/src/client/composables/useCrudListRowActions.js +15 -11
  53. package/src/client/composables/useCrudListScreen.js +17 -16
  54. package/src/client/composables/useCrudViewScreen.js +8 -7
  55. package/src/client/composables/usePagedCollection.js +9 -18
  56. package/src/client/composables/useRealtimeQueryInvalidation.js +15 -13
  57. package/src/client/composables/useScopeRuntime.js +3 -2
  58. package/src/client/lib/httpClient.js +12 -10
  59. package/src/client/rowActions.js +2 -0
  60. package/src/client/support/crudListActionSupport.js +16 -8
  61. package/src/client/types.js +596 -0
  62. package/test/crudScreenComponents.test.js +4 -2
  63. package/test/exportsContract.test.js +1 -0
  64. package/test/requestTransportOptions.test.js +7 -7
  65. package/test/translation.test.js +3 -0
  66. package/test/useAddEditCore.test.js +4 -0
  67. package/test/useCrudDeleteAction.test.js +4 -4
  68. package/test/viewCoreLoading.test.js +0 -19
@@ -0,0 +1,596 @@
1
+ // The values http-web's client hands out and receives across files, for its own modules and for the packages and
2
+ // applications that read records through it.
3
+
4
+ /**
5
+ * The client every request goes through: `getHttpWebClient()`, or one an application supplies.
6
+ * @typedef {object} HttpClient
7
+ * @property {(url: string, options?: Record<string, any>) => Promise<any>} request
8
+ */
9
+
10
+ /**
11
+ * A CRUD resource definition, as `@jskit-ai/resource-crud-core` declares it.
12
+ * @typedef {object} CrudResource
13
+ * @property {string} [namespace]
14
+ * @property {string} [apiAccess] `"authenticated"` by default; `"public"` sends no CSRF token.
15
+ * @property {Record<string, any>} [operations]
16
+ * @property {Record<string, any>} [contract]
17
+ * @property {Record<string, string>} [messages]
18
+ */
19
+
20
+ /** @typedef {import("vue").MaybeRefOrGetter<string>} TextSource */
21
+ /** @typedef {import("vue").MaybeRefOrGetter<boolean | undefined>} EnabledSource */
22
+ /** @typedef {string | ((context: Record<string, any>) => string) | import("vue").Ref<string>} ApiSuffix */
23
+ /** @typedef {boolean | import("vue").Ref<boolean> | ((context: Record<string, any>) => boolean)} ReadEnabled */
24
+ /** @typedef {(surfaceId: string, scopeParamValue?: string, ownershipFilter?: string) => unknown[]} QueryKeyFactory */
25
+ /** @typedef {false | string | { enabled?: boolean, label?: string, source?: string, dedupeKey?: string, method?: string, dedupeWindowMs?: number } | null} RequestRecovery */
26
+ /** @typedef {Record<string, any> | import("vue").Ref<Record<string, any>> | ((context: Record<string, any>) => Record<string, any>) | null} RequestQueryParams */
27
+ /** @typedef {(model: any, payload: any, context: Record<string, any>) => void} MapLoadedToModel */
28
+
29
+ /**
30
+ * What an operation's `realtime` option declares, or `false` to refuse a resource's own.
31
+ * @typedef {object} OperationRealtime
32
+ * @property {string} [event]
33
+ * @property {string[]} [events]
34
+ * @property {(context: import("@jskit-ai/realtime/client/types").RealtimeEventContext) => boolean} [matches]
35
+ * @property {(context: import("@jskit-ai/realtime/client/types").RealtimeEventContext) => unknown} [onEvent] Runs before the matching queries refresh.
36
+ * @property {unknown} [queryKey] Replaces the key the operation reads.
37
+ * @property {EnabledSource} [enabled]
38
+ */
39
+
40
+ /**
41
+ * What `useRealtimeQueryInvalidation()` listens for.
42
+ * @typedef {object} RealtimeQueryInvalidationOptions
43
+ * @property {import("vue").MaybeRef<string>} [event]
44
+ * @property {EnabledSource} [enabled]
45
+ * @property {(context: import("@jskit-ai/realtime/client/types").RealtimeEventContext) => boolean} [matches]
46
+ * @property {import("vue").MaybeRefOrGetter<unknown[] | null>} [queryKey] One key, or a list of keys.
47
+ * @property {(context: import("@jskit-ai/realtime/client/types").RealtimeEventContext) => unknown} [onEvent]
48
+ */
49
+
50
+ /**
51
+ * @typedef {object} OperationRealtimeOptions
52
+ * @property {OperationRealtime | false | null} [realtime]
53
+ * @property {import("vue").MaybeRefOrGetter<unknown[] | null>} [queryKey]
54
+ * @property {EnabledSource} [enabled]
55
+ */
56
+
57
+ /**
58
+ * @typedef {object} EndpointResourceOptions
59
+ * @property {import("vue").MaybeRefOrGetter<unknown[]>} [queryKey] A write-only resource has none.
60
+ * @property {import("vue").MaybeRef<string>} [path]
61
+ * @property {EnabledSource} [enabled]
62
+ * @property {HttpClient} [client]
63
+ * @property {string} [readMethod]
64
+ * @property {string} [writeMethod]
65
+ * @property {import("vue").MaybeRef<Record<string, any> | null>} [readQuery]
66
+ * @property {Record<string, any> | null} [transport]
67
+ * @property {boolean} [refreshOnPull]
68
+ * @property {OperationRealtime | false | null} [realtime]
69
+ * @property {Record<string, any> | null} [queryOptions]
70
+ * @property {Record<string, any> | null} [mutationOptions]
71
+ * @property {RequestRecovery} [requestRecovery]
72
+ * @property {string} [requestRecoveryLabel]
73
+ * @property {string} [fallbackLoadError]
74
+ * @property {string} [fallbackSaveError]
75
+ */
76
+
77
+ /** @typedef {ReturnType<typeof import("./composables/runtime/useEndpointResource.js").useEndpointResource>} EndpointResource */
78
+
79
+ /**
80
+ * @typedef {object} PagedCollectionOptions
81
+ * @property {import("vue").MaybeRef<unknown[]>} queryKey
82
+ * @property {EnabledSource} [enabled]
83
+ * @property {unknown} [initialPageParam]
84
+ * @property {(context: { pageParam: unknown, signal: AbortSignal }) => Promise<any>} queryFn
85
+ * @property {(lastPage: any, allPages: any[], lastPageParam: unknown, allPageParams: unknown[]) => unknown} [getNextPageParam]
86
+ * @property {(page: any) => any[]} [selectItems]
87
+ * @property {(item: any) => unknown} [dedupeBy] Keeps the first item of each key; without it every item stays.
88
+ * @property {Record<string, any> | null} [queryOptions]
89
+ * @property {string} [fallbackLoadError]
90
+ */
91
+
92
+ /** @typedef {ReturnType<typeof import("./composables/usePagedCollection.js").usePagedCollection>} PagedCollection */
93
+
94
+ /**
95
+ * @typedef {object} ListCoreOptions
96
+ * @property {import("vue").MaybeRef<unknown[]>} queryKey
97
+ * @property {import("vue").MaybeRef<string>} [path]
98
+ * @property {EnabledSource} [enabled]
99
+ * @property {HttpClient} [client]
100
+ * @property {Record<string, any> | null} [transport]
101
+ * @property {unknown} [initialPageParam]
102
+ * @property {PagedCollectionOptions["getNextPageParam"]} [getNextPageParam]
103
+ * @property {PagedCollectionOptions["selectItems"]} [selectItems]
104
+ * @property {import("vue").MaybeRef<Record<string, any> | null>} [requestOptions]
105
+ * @property {Record<string, any> | null} [queryOptions]
106
+ * @property {RequestRecovery} [requestRecovery]
107
+ * @property {string} [requestRecoveryLabel]
108
+ * @property {string} [fallbackLoadError]
109
+ */
110
+
111
+ /**
112
+ * @typedef {object} UiFeedbackOptions
113
+ * @property {string} [initialType]
114
+ * @property {string} [source]
115
+ * @property {string} [successChannel]
116
+ * @property {string} [errorChannel]
117
+ * @property {number} [dedupeWindowMs]
118
+ */
119
+
120
+ /** @typedef {ReturnType<typeof import("./composables/runtime/useUiFeedback.js").useUiFeedback>} UiFeedback */
121
+ /** @typedef {ReturnType<typeof import("./composables/runtime/useFieldErrorBag.js").useFieldErrorBag>} FieldErrorBag */
122
+
123
+ /**
124
+ * @typedef {object} OperationErrorReporting
125
+ * @property {boolean} [enabled]
126
+ * @property {string} [source]
127
+ * @property {import("vue").Ref<string> | null} [loadError]
128
+ * @property {import("vue").Ref<string> | null} [notFoundError]
129
+ * @property {(context: { message: string, kind: string }) => Record<string, any> | null} [loadActionFactory]
130
+ * @property {(context: { message: string, kind: string }) => Record<string, any> | null} [notFoundActionFactory]
131
+ * @property {string} [loadChannel]
132
+ * @property {string} [notFoundChannel]
133
+ * @property {string} [loadSeverity]
134
+ * @property {string} [notFoundSeverity]
135
+ * @property {number} [dedupeWindowMs]
136
+ */
137
+
138
+ /**
139
+ * A check of an operation's input. Left out, `fieldBag` and `feedback` stay silent.
140
+ * @typedef {object} OperationInputCheck
141
+ * @property {unknown} [input]
142
+ * @property {Record<string, any>} [rawPayload]
143
+ * @property {Pick<FieldErrorBag, "apply">} [fieldBag]
144
+ * @property {Pick<UiFeedback, "error">} [feedback]
145
+ * @property {string} [validationMessage]
146
+ */
147
+
148
+ /**
149
+ * @typedef {object} ScopeRuntimeOptions
150
+ * @property {string} [ownershipFilter]
151
+ * @property {string} [surfaceId]
152
+ * @property {string} [accessMode]
153
+ * @property {boolean} [hasPermissionRequirements]
154
+ */
155
+
156
+ /** @typedef {ReturnType<typeof import("./composables/useScopeRuntime.js").useScopeRuntime>} ScopeRuntime */
157
+
158
+ /**
159
+ * @typedef {object} AccessOptions
160
+ * @property {EnabledSource} [enabled]
161
+ * @property {string} [access]
162
+ * @property {boolean} [hasPermissionRequirements]
163
+ */
164
+
165
+ /** @typedef {ReturnType<typeof import("./composables/useAccess.js").useAccess>} AccessRuntime */
166
+
167
+ /**
168
+ * @typedef {object} OperationScopeOptions
169
+ * @property {string} [ownershipFilter]
170
+ * @property {string} [surfaceId]
171
+ * @property {string} [access]
172
+ * @property {ApiSuffix} [apiSuffix]
173
+ * @property {object} [model]
174
+ * @property {ReadEnabled} [readEnabled]
175
+ * @property {QueryKeyFactory} [queryKeyFactory] A command reads nothing and has none.
176
+ * @property {Record<string, string | string[]>} [permissionSets]
177
+ * @property {OperationRealtime | false | null} [realtime]
178
+ */
179
+
180
+ /** @typedef {ReturnType<typeof import("./composables/internal/useOperationScope.js").useOperationScope>} OperationScope */
181
+
182
+ /**
183
+ * @typedef {object} AddEditCoreOptions
184
+ * @property {object} [model]
185
+ * @property {EndpointResource} resource
186
+ * @property {import("vue").Ref<unknown>} queryKey
187
+ * @property {import("vue").Ref<boolean>} canSave
188
+ * @property {FieldErrorBag} fieldBag
189
+ * @property {UiFeedback} feedback
190
+ * @property {unknown} [input]
191
+ * @property {MapLoadedToModel} [mapLoadedToModel]
192
+ * @property {(model: any, context: Record<string, any>) => Record<string, any>} [buildRawPayload]
193
+ * @property {(parsedInput: any, context: Record<string, any>) => unknown} [buildSavePayload]
194
+ * @property {(payload: any, context: Record<string, any>) => unknown} [onSaveSuccess]
195
+ * @property {boolean} [validationFeedback]
196
+ * @property {Record<string, string>} [messages]
197
+ */
198
+
199
+ /**
200
+ * @typedef {object} CommandCoreOptions
201
+ * @property {object} [model]
202
+ * @property {EndpointResource} resource
203
+ * @property {string} [writeMethod]
204
+ * @property {import("vue").Ref<boolean>} canRun
205
+ * @property {FieldErrorBag} fieldBag
206
+ * @property {UiFeedback} feedback
207
+ * @property {unknown} [input]
208
+ * @property {(model: any, context: Record<string, any>) => Record<string, any>} [buildRawPayload]
209
+ * @property {(parsedInput: any, context: Record<string, any>) => unknown} [buildCommandPayload] Without it a command sends its parsed input, and nothing for DELETE.
210
+ * @property {(parsedInput: any, context: Record<string, any>) => Record<string, any>} [buildCommandOptions]
211
+ * @property {(response: any, context: Record<string, any>) => unknown} [onRunSuccess]
212
+ * @property {(error: unknown, context: Record<string, any>) => unknown} [onRunError]
213
+ * @property {boolean} [suppressSuccessMessage]
214
+ * @property {Record<string, string>} [messages]
215
+ */
216
+
217
+ /**
218
+ * @typedef {object} ViewCoreOptions
219
+ * @property {EndpointResource} resource
220
+ * @property {object} [model]
221
+ * @property {import("vue").Ref<boolean>} [canView]
222
+ * @property {MapLoadedToModel} [mapLoadedToModel]
223
+ * @property {number[]} [notFoundStatuses]
224
+ * @property {string} [notFoundMessage]
225
+ */
226
+
227
+ /**
228
+ * @typedef {object} RouteTemplateOptions
229
+ * @property {string} [recordIdParam]
230
+ * @property {import("vue").MaybeRefOrGetter<Record<string, unknown>> | null} [routeParams]
231
+ * @property {import("vue").MaybeRefOrGetter<string[]> | null} [routeParamNames]
232
+ * @property {import("vue").MaybeRefOrGetter<string>} [routePath]
233
+ */
234
+
235
+ /**
236
+ * @typedef {RouteTemplateOptions & {
237
+ * routeRecordId?: import("vue").MaybeRefOrGetter<unknown>,
238
+ * apiUrlTemplate?: string,
239
+ * viewUrlTemplate?: string,
240
+ * listUrlTemplate?: string,
241
+ * saveRecordIdSelector?: (payload: Record<string, any>) => unknown
242
+ * }} AddEditUiRuntimeOptions
243
+ */
244
+
245
+ /**
246
+ * @typedef {RouteTemplateOptions & {
247
+ * routeRecordId?: import("vue").MaybeRefOrGetter<unknown>,
248
+ * apiUrlTemplate?: string,
249
+ * listUrlTemplate?: string,
250
+ * editUrlTemplate?: string
251
+ * }} ViewUiRuntimeOptions
252
+ */
253
+
254
+ /**
255
+ * @typedef {RouteTemplateOptions & {
256
+ * items: import("vue").Ref<unknown>,
257
+ * isInitialLoading: import("vue").Ref<boolean>,
258
+ * recordIdSelector?: (record: Record<string, any>) => unknown,
259
+ * viewUrlTemplate?: string,
260
+ * editUrlTemplate?: string
261
+ * }} ListUiRuntimeOptions
262
+ */
263
+
264
+ /**
265
+ * @typedef {object} AddEditOptions
266
+ * @property {string} [ownershipFilter]
267
+ * @property {string} [surfaceId]
268
+ * @property {string} [access]
269
+ * @property {CrudResource | null} [resource]
270
+ * @property {ApiSuffix} [apiSuffix]
271
+ * @property {QueryKeyFactory} [queryKeyFactory]
272
+ * @property {string | string[]} [viewPermissions]
273
+ * @property {string | string[]} [savePermissions]
274
+ * @property {string} [readMethod]
275
+ * @property {ReadEnabled} [readEnabled]
276
+ * @property {string} [writeMethod]
277
+ * @property {HttpClient} [client]
278
+ * @property {Record<string, any> | null} [transport]
279
+ * @property {RequestRecovery} [requestRecovery]
280
+ * @property {string} [requestRecoveryLabel]
281
+ * @property {string} [placementSource]
282
+ * @property {string} [fallbackLoadError]
283
+ * @property {string} [fallbackSaveError]
284
+ * @property {string[]} [fieldErrorKeys]
285
+ * @property {boolean} [clearOnRouteChange]
286
+ * @property {object} [model]
287
+ * @property {unknown} [input]
288
+ * @property {MapLoadedToModel} [mapLoadedToModel]
289
+ * @property {(model: any, context: Record<string, any>) => Record<string, any>} [buildRawPayload]
290
+ * @property {(parsedInput: any, context: Record<string, any>) => unknown} [buildSavePayload]
291
+ * @property {(payload: any, context: Record<string, any>) => unknown} [onSaveSuccess]
292
+ * @property {boolean} [validationFeedback]
293
+ * @property {RequestQueryParams} [requestQueryParams]
294
+ * @property {string} [recordIdParam]
295
+ * @property {import("vue").MaybeRefOrGetter<Record<string, unknown>> | null} [routeParams]
296
+ * @property {import("vue").MaybeRefOrGetter<unknown>} [routeRecordId]
297
+ * @property {string} [apiUrlTemplate]
298
+ * @property {string} [viewUrlTemplate]
299
+ * @property {string} [listUrlTemplate]
300
+ * @property {(payload: Record<string, any>) => unknown} [saveRecordIdSelector]
301
+ * @property {Record<string, string>} [messages]
302
+ * @property {OperationRealtime | false | null} [realtime]
303
+ */
304
+
305
+ /** @typedef {ReturnType<typeof import("./composables/records/useAddEdit.js").useAddEdit>} AddEditRuntime */
306
+
307
+ /**
308
+ * @typedef {object} CommandOptions
309
+ * @property {string} [ownershipFilter]
310
+ * @property {string} [surfaceId]
311
+ * @property {string} [access]
312
+ * @property {ApiSuffix} [apiSuffix]
313
+ * @property {string | string[]} [runPermissions]
314
+ * @property {string} [writeMethod]
315
+ * @property {HttpClient} [client]
316
+ * @property {CrudResource | null} [resource]
317
+ * @property {Record<string, any> | null} [transport]
318
+ * @property {string} [placementSource]
319
+ * @property {string} [fallbackRunError]
320
+ * @property {string[]} [fieldErrorKeys]
321
+ * @property {boolean} [clearOnRouteChange]
322
+ * @property {object} [model]
323
+ * @property {unknown} [input]
324
+ * @property {CommandCoreOptions["buildRawPayload"]} [buildRawPayload]
325
+ * @property {CommandCoreOptions["buildCommandPayload"]} [buildCommandPayload]
326
+ * @property {CommandCoreOptions["buildCommandOptions"]} [buildCommandOptions]
327
+ * @property {CommandCoreOptions["onRunSuccess"]} [onRunSuccess]
328
+ * @property {CommandCoreOptions["onRunError"]} [onRunError]
329
+ * @property {boolean} [suppressSuccessMessage]
330
+ * @property {Record<string, string>} [messages]
331
+ * @property {OperationRealtime | false | null} [realtime]
332
+ */
333
+
334
+ /** @typedef {ReturnType<typeof import("./composables/useCommand.js").useCommand>} CommandRuntime */
335
+
336
+ /**
337
+ * @typedef {object} ViewOptions
338
+ * @property {CrudResource | null} [resource]
339
+ * @property {string} [ownershipFilter]
340
+ * @property {string} [surfaceId]
341
+ * @property {string} [access]
342
+ * @property {ApiSuffix} [apiSuffix]
343
+ * @property {QueryKeyFactory} [queryKeyFactory]
344
+ * @property {string | string[]} [viewPermissions]
345
+ * @property {string} [readMethod]
346
+ * @property {ReadEnabled} [readEnabled]
347
+ * @property {HttpClient} [client]
348
+ * @property {Record<string, any> | null} [transport]
349
+ * @property {RequestRecovery} [requestRecovery]
350
+ * @property {string} [requestRecoveryLabel]
351
+ * @property {string} [placementSource]
352
+ * @property {string} [fallbackLoadError]
353
+ * @property {number[]} [notFoundStatuses]
354
+ * @property {string} [notFoundMessage]
355
+ * @property {object} [model]
356
+ * @property {MapLoadedToModel} [mapLoadedToModel]
357
+ * @property {RequestQueryParams} [requestQueryParams]
358
+ * @property {RequestQueryParams} [requestFieldsets]
359
+ * @property {string} [recordIdParam]
360
+ * @property {import("vue").MaybeRefOrGetter<Record<string, unknown>> | null} [routeParams]
361
+ * @property {import("vue").MaybeRefOrGetter<unknown>} [routeRecordId]
362
+ * @property {string} [apiUrlTemplate]
363
+ * @property {string} [listUrlTemplate]
364
+ * @property {string} [editUrlTemplate]
365
+ * @property {boolean} [includeRecordIdInQueryKey]
366
+ * @property {OperationRealtime | false | null} [realtime]
367
+ */
368
+
369
+ /** @typedef {ReturnType<typeof import("./composables/records/useView.js").useView>} ViewRuntime */
370
+
371
+ /**
372
+ * @typedef {Omit<ViewOptions, "routeParams"> & {
373
+ * paramBinding?: Record<string, any> | null,
374
+ * route?: Record<string, any> | null
375
+ * }} CrudViewOptions
376
+ */
377
+
378
+ /**
379
+ * @typedef {object} ListOptions
380
+ * @property {string} [ownershipFilter]
381
+ * @property {string} [surfaceId]
382
+ * @property {string} [access]
383
+ * @property {ApiSuffix} [apiSuffix]
384
+ * @property {QueryKeyFactory} [queryKeyFactory]
385
+ * @property {string | string[]} [viewPermissions]
386
+ * @property {ReadEnabled} [readEnabled]
387
+ * @property {string} [placementSource]
388
+ * @property {string} [fallbackLoadError]
389
+ * @property {unknown} [initialPageParam]
390
+ * @property {PagedCollectionOptions["getNextPageParam"]} [getNextPageParam]
391
+ * @property {PagedCollectionOptions["selectItems"]} [selectItems]
392
+ * @property {HttpClient} [client]
393
+ * @property {Record<string, any> | null} [transport]
394
+ * @property {Record<string, any>} [requestOptions]
395
+ * @property {Record<string, any>} [queryOptions]
396
+ * @property {RequestRecovery} [requestRecovery]
397
+ * @property {string} [requestRecoveryLabel]
398
+ * @property {OperationRealtime | false | null} [realtime]
399
+ * @property {string} [recordIdParam]
400
+ * @property {(record: Record<string, any>) => unknown} [recordIdSelector]
401
+ * @property {string} [viewUrlTemplate]
402
+ * @property {string} [editUrlTemplate]
403
+ * @property {Record<string, any> | null} [search]
404
+ * @property {RequestQueryParams} [queryParams]
405
+ * @property {import("vue").MaybeRef<Record<string, (routeValue: unknown, context: { initial?: boolean }) => unknown>> | null} [routeQueryValueResolvers]
406
+ * @property {RequestQueryParams} [requestQueryParams]
407
+ * @property {RequestQueryParams} [requestFieldsets]
408
+ * @property {boolean | Record<string, any>} [syncToRoute]
409
+ */
410
+
411
+ /** @typedef {ReturnType<typeof import("./composables/records/useList.js").useList>} ListRuntime */
412
+
413
+ /**
414
+ * @typedef {ListOptions & {
415
+ * resource?: CrudResource | null,
416
+ * parentBinding?: Record<string, any> | null,
417
+ * route?: Record<string, any> | null
418
+ * }} CrudListOptions
419
+ */
420
+
421
+ /**
422
+ * The options every list action definition shares.
423
+ * @typedef {object} CrudListActionDefinition
424
+ * @property {string} [key]
425
+ * @property {string} [id]
426
+ * @property {string} [label]
427
+ * @property {string} [title]
428
+ * @property {string} [icon]
429
+ * @property {string} [color]
430
+ */
431
+
432
+ /**
433
+ * @typedef {CrudListActionDefinition & {
434
+ * variant?: string,
435
+ * confirmLabel?: string,
436
+ * run?: (context: Record<string, any>) => unknown,
437
+ * disabled?: boolean | ((context: Record<string, any>) => boolean)
438
+ * }} CrudListBulkActionDefinition
439
+ */
440
+
441
+ /**
442
+ * @typedef {CrudListActionDefinition & {
443
+ * run?: (context: Record<string, any>) => unknown,
444
+ * visible?: boolean | ((context: Record<string, any>) => boolean),
445
+ * disabled?: boolean | ((context: Record<string, any>) => boolean),
446
+ * loading?: boolean | ((context: Record<string, any>) => boolean)
447
+ * }} CrudListRowActionDefinition
448
+ */
449
+
450
+ /**
451
+ * @typedef {object} CrudListActionOptions
452
+ * @property {(record: Record<string, any>, index: number) => unknown} [resolveRecordId]
453
+ * @property {() => Record<string, any>} [resolveContext] What every action's context carries.
454
+ */
455
+
456
+ /** @typedef {ReturnType<typeof import("./composables/useCrudListBulkActions.js").useCrudListBulkActions>} CrudListBulkActions */
457
+ /** @typedef {ReturnType<typeof import("./composables/useCrudListRowActions.js").useCrudListRowActions>} CrudListRowActions */
458
+
459
+ /**
460
+ * @typedef {object} CrudListFiltersOptions
461
+ * @property {Record<string, (value: unknown, filter: object) => string>} [labelResolvers]
462
+ * @property {Record<string, (value: unknown, filter: object, values: object) => string>} [chipLabels]
463
+ * @property {{ key: string, label: string, values?: Record<string, unknown>, resolveValues?: (context: Record<string, any>) => Record<string, unknown> }[]} [presets]
464
+ */
465
+
466
+ /** @typedef {ReturnType<typeof import("./composables/useCrudListFilters.js").useCrudListFilters>} CrudListFilterRuntime */
467
+
468
+ /**
469
+ * @typedef {object} CrudListFilterLookupsOptions
470
+ * @property {Record<string, unknown>} [values]
471
+ * @property {string} [recordIdParam]
472
+ * @property {string[]} [queryKeyPrefix]
473
+ * @property {string} [placementSourcePrefix]
474
+ * @property {Record<string, RequestQueryParams>} [requestQueryParams]
475
+ * @property {Record<string, (record: Record<string, any>, filter: object) => string>} [labelResolvers]
476
+ */
477
+
478
+ /**
479
+ * @typedef {object} CrudListParentTitleOptions
480
+ * @property {ListRuntime} listRuntime
481
+ * @property {CrudResource} [resource]
482
+ * @property {string} [recordIdParam]
483
+ * @property {string | string[]} [queryKeyPrefix]
484
+ * @property {string} [placementSource]
485
+ * @property {string} [fallbackLoadError]
486
+ * @property {string} [notFoundMessage]
487
+ * @property {Record<string, any> | null} [route]
488
+ * @property {(options: ViewOptions) => ViewRuntime} [viewRuntimeFactory]
489
+ */
490
+
491
+ /**
492
+ * @typedef {object} CrudDeleteActionOptions
493
+ * @property {CrudViewScreen} screen
494
+ * @property {CrudResource | null} [resource]
495
+ * @property {string} [resourceNamespace]
496
+ * @property {import("vue").MaybeRef<string>} [apiUrlTemplate]
497
+ * @property {string} [access]
498
+ * @property {HttpClient} [client]
499
+ * @property {Pick<import("vue-router").Router, "push">} [router]
500
+ * @property {string} [fallbackDeleteError]
501
+ */
502
+
503
+ /** @typedef {ReturnType<typeof import("./composables/useCrudDeleteAction.js").useCrudDeleteAction>} CrudDeleteAction */
504
+
505
+ /**
506
+ * @typedef {object} CrudAddEditOptions
507
+ * @property {CrudResource | null} [resource]
508
+ * @property {string} [operationName]
509
+ * @property {Record<string, any>[]} [formFields]
510
+ * @property {Record<string, any>} [addEditOptions]
511
+ * @property {Record<string, any>} [saveSuccess]
512
+ * @property {Record<string, any> | null} [fieldBinding]
513
+ * @property {(fields: Record<string, any>[]) => Record<string, any>} [createModel]
514
+ * @property {(model: any, context: Record<string, any>) => Record<string, any>} [buildPayload]
515
+ * @property {MapLoadedToModel} [mapPayloadToModel] Without it a form maps a payload by its fields, or not at all when it reads nothing.
516
+ * @property {unknown} [input]
517
+ */
518
+
519
+ /** @typedef {ReturnType<typeof import("./composables/records/useCrudAddEdit.js").useCrudAddEdit>} CrudAddEditRuntime */
520
+
521
+ /**
522
+ * @typedef {CrudAddEditOptions & {
523
+ * screen?: CrudAddEditScreen | null,
524
+ * mode?: import("vue").MaybeRef<string>,
525
+ * title?: import("vue").MaybeRef<string>,
526
+ * subtitle?: import("vue").MaybeRef<string>,
527
+ * saveLabel?: import("vue").MaybeRef<string>,
528
+ * cancelTo?: import("vue").MaybeRef<unknown>,
529
+ * preserveCancelQuery?: boolean
530
+ * }} CrudAddEditScreenOptions
531
+ */
532
+
533
+ /**
534
+ * What `CrudAddEditScreen` renders: a `useCrudAddEditScreen()` result, or an object a page builds with these members.
535
+ * @typedef {object} CrudAddEditScreen
536
+ * @property {import("vue").MaybeRef<string>} [mode]
537
+ * @property {import("vue").MaybeRef<string>} [title]
538
+ * @property {import("vue").MaybeRef<string>} [subtitle]
539
+ * @property {import("vue").MaybeRef<string>} [saveLabel]
540
+ * @property {import("vue").MaybeRef<unknown>} [cancelTo]
541
+ * @property {{ showFormSkeleton: boolean }} formRuntime
542
+ * @property {Partial<AddEditRuntime>} addEdit
543
+ * @property {Record<string, any>} formState
544
+ * @property {(fieldKey: string) => string[]} resolveFieldErrors
545
+ * @property {(target?: unknown) => unknown} resolveCancelTo
546
+ */
547
+
548
+ /**
549
+ * @typedef {object} CrudViewScreenOptions
550
+ * @property {CrudResource | null} [resource]
551
+ * @property {string} [resourceNamespace]
552
+ * @property {string} [apiUrlTemplate]
553
+ * @property {string} [recordIdParam]
554
+ * @property {string} [titleFallbackFieldKey]
555
+ * @property {import("vue").MaybeRef<string>} [listUrlTemplate]
556
+ * @property {import("vue").MaybeRef<string>} [editUrlTemplate]
557
+ * @property {string} [recordChangedEvent]
558
+ * @property {RequestQueryParams} [requestQueryParams]
559
+ * @property {RequestQueryParams} [requestFieldsets]
560
+ * @property {ReadEnabled} [readEnabled]
561
+ * @property {QueryKeyFactory} [queryKeyFactory]
562
+ * @property {string} [requestRecoveryLabel]
563
+ * @property {string} [fallbackLoadError]
564
+ * @property {string} [notFoundMessage]
565
+ */
566
+
567
+ /** @typedef {ReturnType<typeof import("./composables/useCrudViewScreen.js").useCrudViewScreen>} CrudViewScreen */
568
+
569
+ /**
570
+ * @typedef {object} CrudListScreenOptions
571
+ * @property {HttpClient} [client]
572
+ * @property {CrudResource | null} [resource]
573
+ * @property {string} [resourceNamespace]
574
+ * @property {ApiSuffix} [apiSuffix]
575
+ * @property {string} [recordIdParam]
576
+ * @property {(record: Record<string, any>) => unknown} [recordIdSelector]
577
+ * @property {string} [titleFallbackFieldKey]
578
+ * @property {string} [viewUrlTemplate]
579
+ * @property {string} [editUrlTemplate]
580
+ * @property {string} [newUrlTemplate]
581
+ * @property {string[]} [recordChangedEvents]
582
+ * @property {Record<string, object>} [listFilters]
583
+ * @property {CrudListBulkActionDefinition[]} [listBulkActions]
584
+ * @property {readonly CrudListRowActionDefinition[]} [listRowActions]
585
+ * @property {unknown} [syntheticRows]
586
+ * @property {readonly string[]} [routeQueryBlacklist]
587
+ * @property {RequestQueryParams} [requestQueryParams]
588
+ * @property {RequestQueryParams} [requestFieldsets]
589
+ * @property {ReadEnabled} [readEnabled]
590
+ * @property {string} [requestRecoveryLabel]
591
+ * @property {string} [fallbackLoadError]
592
+ */
593
+
594
+ /** @typedef {ReturnType<typeof import("./composables/useCrudListScreen.js").useCrudListScreen>} CrudListScreen */
595
+
596
+ export {};
@@ -47,7 +47,10 @@ test("every CRUD list create action retains its configured label and destination
47
47
  for (const createLabel of [undefined, "Add book"]) {
48
48
  const screen = {
49
49
  records: {}, listPrimaryAction: "/books/new",
50
+ bulkActions: { hasActions: false },
51
+ rowActions: { hasActions: false, hasVisibleActionsFor: () => false },
50
52
  displayRows: populated ? [{ key: "1", recordKey: "1", record: { title: "Kindred" } }] : [],
53
+ selectableRows: [],
51
54
  resolveRecordTitle: (record) => record.title
52
55
  };
53
56
  const app = createSSRApp({ render: () => h(CrudListScreen, {
@@ -144,14 +147,13 @@ test("CRUD screen composables expose page extension inputs", async () => {
144
147
  const listSource = await readClientFile("composables", "useCrudListScreen.js");
145
148
  const viewSource = await readClientFile("composables", "useCrudViewScreen.js");
146
149
 
147
- assert.match(listSource, /listRowActions = \[\]/);
150
+ assert.match(listSource, /listRowActions = NO_LIST_ACTIONS/);
148
151
  assert.match(listSource, /syntheticRows = null/);
149
152
  assert.match(listSource, /readEnabled = true/);
150
153
  assert.match(listSource, /useCrudListRowActions/);
151
154
  assert.match(listSource, /selectableRows/);
152
155
  assert.match(listSource, /readEnabled,\n\s+requestRecoveryLabel/);
153
156
 
154
- assert.match(viewSource, /requestQueryParams = null/);
155
157
  assert.match(viewSource, /readEnabled = true/);
156
158
  assert.match(viewSource, /queryKeyFactory = null/);
157
159
  assert.match(viewSource, /requestQueryParams/);
@@ -51,6 +51,7 @@ test("http-web exports are explicit and aligned with production and generated us
51
51
  "./client/lib/httpClient",
52
52
  "./client/lib/permissions",
53
53
  "./client/support/contractGuards",
54
+ "./client/types",
54
55
  // The generated client bootstrap registers every package's English catalog.
55
56
  "./locales/en.json"
56
57
  ]