@norbix.ai/react-redux 1.7.0 → 1.8.1

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
@@ -183,6 +183,78 @@ A _curated_ set of hooks for the most common endpoints. Every hook is end-to-end
183
183
 
184
184
  > **Need a hook we don't ship?** Two options. (1) Drop down to the SDK with `useNorbix()` for a one-off call. (2) Add a new file under `src/hooks/api/` or `src/hooks/hub/`, follow the pattern of the others, and open a PR.
185
185
 
186
+ ### Database — records, trees, bundle, imports — `norbix.hub.database` / `norbix.api.database`
187
+
188
+ Every `hub.database` method (73) and every `api.database` method (22) of `@norbix.ai/ts` has a hook; Hub hooks keep the SDK method name. The rows below are the ones added for `@norbix.ai/ts` >= 4.9.0.
189
+
190
+ | Hook | SDK method | Cache |
191
+ | --------------------------------------------- | ----------------------------------------------- | ------------------------------------------------------------------ |
192
+ | `useFindRecordsQuery` | `hub.database.findRecords` | provides `DatabaseRecords/<collectionName>` |
193
+ | `useFindOneRecordQuery` | `hub.database.findOneRecord` | provides `DatabaseRecords/<collectionName>` |
194
+ | `useCountRecordsQuery` | `hub.database.countRecords` | provides `DatabaseRecords/<collectionName>` |
195
+ | `useDistinctRecordValuesQuery` | `hub.database.distinctRecordValues` | provides `DatabaseRecords/<collectionName>` |
196
+ | `useAggregateRecordsMutation` | `hub.database.aggregateRecords` | — (never cached) |
197
+ | `useExecuteRecordsAggregateMutation` | `hub.database.executeRecordsAggregate` | — (never cached) |
198
+ | `useGetCollectionIndexesQuery` | `hub.database.getCollectionIndexes` | provides `DatabaseCollections/<collectionName>` |
199
+ | `useInsertRecordMutation` | `hub.database.insertRecord` | invalidates `DatabaseRecords/<collectionName>` |
200
+ | `useInsertManyRecordsMutation` | `hub.database.insertManyRecords` | invalidates `DatabaseRecords/<collectionName>` |
201
+ | `useUpdateOneRecordMutation` | `hub.database.updateOneRecord` | invalidates `DatabaseRecords/<collectionName>` |
202
+ | `useUpdateManyRecordsMutation` | `hub.database.updateManyRecords` | invalidates `DatabaseRecords/<collectionName>` |
203
+ | `useReplaceRecordMutation` | `hub.database.replaceRecord` | invalidates `DatabaseRecords/<collectionName>` |
204
+ | `useDeleteRecordMutation` | `hub.database.deleteRecord` | invalidates `DatabaseRecords/<collectionName>` |
205
+ | `useDeleteManyRecordsMutation` | `hub.database.deleteManyRecords` | invalidates `DatabaseRecords/<collectionName>` |
206
+ | `useChangeRecordResponsibilityMutation` | `hub.database.changeRecordResponsibility` | invalidates `DatabaseRecords/<collectionName>` |
207
+ | `useSeedCollectionRecordsMutation` | `hub.database.seedCollectionRecords` | invalidates `DatabaseRecords` |
208
+ | `useGetDatabaseTaxonomyTreeQuery` | `hub.database.getDatabaseTaxonomyTree` | provides `DatabaseTaxonomies` + `DatabaseTaxonomyTerms` |
209
+ | `useGetDatabaseTaxonomyTermTreeQuery` | `hub.database.getDatabaseTaxonomyTermTree` | provides `DatabaseTaxonomyTerms/<taxonomyName>` |
210
+ | `useGetDatabaseMergedTermTreeQuery` | `hub.database.getDatabaseMergedTermTree` | provides `DatabaseTaxonomyTerms/<taxonomyName>` |
211
+ | `useApplyDatabaseSchemaBundleMutation` | `hub.database.applyDatabaseSchemaBundle` | invalidates `DatabaseSchemas` + taxonomies + terms |
212
+ | `useUpdateDatabaseSchemaEmbedMutation` | `hub.database.updateDatabaseSchemaEmbed` | invalidates `DatabaseSchemas` |
213
+ | `useGetDatabaseSchemaListSettingsQuery` | `hub.database.getDatabaseSchemaListSettings` | provides `DatabaseSchemas` |
214
+ | `useUpdateDatabaseSchemaListSettingsMutation` | `hub.database.updateDatabaseSchemaListSettings` | invalidates `DatabaseSchemas` |
215
+ | `useGetCollectionImportsQuery` | `hub.database.getCollectionImports` | provides `DatabaseImports` |
216
+ | `useGetCollectionImportQuery` | `hub.database.getCollectionImport` | provides `DatabaseImports` |
217
+ | `useCreateCollectionImportMutation` | `hub.database.createCollectionImport` | invalidates `DatabaseImports` + `DatabaseRecords/<collectionName>` |
218
+ | `useDeleteCollectionImportMutation` | `hub.database.deleteCollectionImport` | invalidates `DatabaseImports` |
219
+ | `useAnalyzeImportFileMutation` | `hub.database.analyzeImportFile` | — |
220
+ | `useRequestImportUploadUrlMutation` | `hub.database.requestImportUploadUrl` | — |
221
+ | `useFindOwnQuery` | `api.database.findOwn` | provides `DatabaseCollections/<collectionName>` |
222
+ | `useFindMergedTermTreeQuery` | `api.database.findMergedTermTree` | provides `DatabaseTaxonomyTerms/<taxonomyName>` |
223
+
224
+ ### Module switches send `PUT` (core SDK 4.10.0)
225
+
226
+ The module enable / disable hooks were always mutations, so nothing changes in your code. From `@norbix.ai/ts` 4.10.0 they send `PUT` instead of `GET` on the wire, matching the gateway:
227
+
228
+ | Hooks | Route | Cache |
229
+ | ------------------------------------------------------------- | ---------------------------------------------------- | ------------------------ |
230
+ | `useEnableDatabaseMutation`, `useDisableDatabaseMutation` | `PUT /{version}/database/enable\|disable` | invalidates `Database` |
231
+ | `useEnableFilesMutation`, `useDisableFilesMutation` | `PUT /{version}/files/enable\|disable` | invalidates `Files` |
232
+ | `useEnableLoggingMutation`, `useDisableLoggingMutation` | `PUT /{version}/logs/enable\|disable` | invalidates `Logs` |
233
+ | `useEnablePaymentsMutation`, `useDisablePaymentsMutation` | `PUT /{version}/payments/enable\|disable` | invalidates `Payments` |
234
+ | `useEnableMembershipMutation`, `useDisableMembershipMutation` | `PUT /{version}/membership/enable\|disable` | invalidates `Membership` |
235
+ | `useEnableEmailMutation`, `useDisableEmailMutation` | `PUT /{version}/notifications/email/enable\|disable` | invalidates `Emails` |
236
+ | `useEnableSmsMutation`, `useDisableSmsMutation` | `PUT /{version}/notifications/sms/enable\|disable` | invalidates `Sms` |
237
+ | `useEnablePushMutation`, `useDisablePushMutation` | `PUT /{version}/notifications/push/enable\|disable` | invalidates `Push` |
238
+
239
+ The gateway still answers the old `GET` on these paths for now (it logs a deprecation warning) and will drop it after gateway 0.2, so upgrade the core SDK before then. The scheduler switch moved to `PUT` earlier (core SDK 4.6.0). The code module (`hub.code`) has no hooks in this package yet; call `useNorbix().hub.code.enableCode(...)` directly.
240
+
241
+ ### Schemas per environment
242
+
243
+ `useGetDatabaseSchemasQuery` returns only the schemas of the environment the request targets: the `env` argument, or else the client's environment (`norbix.setEnvironment(...)`, sent as the `norbix-env` header), or `PROD` when neither is set. Each row carries `env`. The schema list settings (`useGetDatabaseSchemaListSettingsQuery` / `useUpdateDatabaseSchemaListSettingsMutation`) are stored per environment too.
244
+
245
+ RTK Query keys its cache by endpoint + arguments, and the client's environment is not an argument. So either pass `env` in the arguments — each environment then has its own cache entry — or reset the cache when you switch:
246
+
247
+ ```tsx
248
+ // Per call: TEST and PROD cache apart.
249
+ const { data } = useGetDatabaseSchemasQuery({ env: 'TEST' });
250
+
251
+ // Or switch the whole client and drop what was cached for the old environment.
252
+ norbix.setEnvironment('TEST');
253
+ dispatch(norbixApi.util.invalidateTags(['DatabaseSchemas']));
254
+ ```
255
+
256
+ The paging cursors of the schema list (`startingAfter` / `endingBefore`) are schema view ids (`sch_…`). A cursor saved against an older gateway will not match; start the list again from the first page.
257
+
186
258
  ### End-user AI chat — `norbix.api.ai`
187
259
 
188
260
  For a signed-in project user. `useStartEndUserChatTurnMutation` answers at once with a `turnId`; the answer streams on the user's SSE channel `ai-chat:{projectId}:{authId}` — open it with `norbix.aiChat({ authId })` from `@norbix.ai/ts` (a foreign channel is refused with 403 `AiChatChannelRefused`, no retry). Needs `@norbix.ai/ts` >= 4.3.0.
package/dist/index.cjs CHANGED
@@ -183,25 +183,47 @@ var apiDatabase = (b) => ({
183
183
  findCollection: b.query({
184
184
  query: (args) => (norbix) => norbix.api.database.find(args),
185
185
  providesTags: (_res, _err, arg) => [
186
- { type: "DatabaseCollections", id: arg?.collectionName ?? "ANY" }
186
+ {
187
+ type: "DatabaseCollections",
188
+ id: arg?.collectionName ?? "ANY"
189
+ }
187
190
  ]
188
191
  }),
189
192
  findOne: b.query({
190
193
  query: (args) => (norbix) => norbix.api.database.findOne(args),
191
194
  providesTags: (_res, _err, arg) => [
192
- { type: "DatabaseCollections", id: arg?.collectionName ?? "ANY" }
195
+ {
196
+ type: "DatabaseCollections",
197
+ id: arg?.collectionName ?? "ANY"
198
+ }
199
+ ]
200
+ }),
201
+ // Only the records the caller is responsible for (owner-scoped find).
202
+ findOwn: b.query({
203
+ query: (args) => (norbix) => norbix.api.database.findOwn(args),
204
+ providesTags: (_res, _err, arg) => [
205
+ {
206
+ type: "DatabaseCollections",
207
+ id: arg?.collectionName ?? "ANY"
208
+ }
193
209
  ]
194
210
  }),
195
211
  countCollection: b.query({
196
212
  query: (args) => (norbix) => norbix.api.database.count(args),
197
213
  providesTags: (_res, _err, arg) => [
198
- { type: "DatabaseCollections", id: arg?.collectionName ?? "ANY" }
214
+ {
215
+ type: "DatabaseCollections",
216
+ id: arg?.collectionName ?? "ANY"
217
+ }
199
218
  ]
200
219
  }),
201
220
  distinct: b.query({
202
221
  query: (args) => (norbix) => norbix.api.database.distinct(args),
203
222
  providesTags: (_res, _err, arg) => [
204
- { type: "DatabaseCollections", id: arg?.collectionName ?? "ANY" }
223
+ {
224
+ type: "DatabaseCollections",
225
+ id: arg?.collectionName ?? "ANY"
226
+ }
205
227
  ]
206
228
  }),
207
229
  aggregate: b.mutation({
@@ -214,69 +236,102 @@ var apiDatabase = (b) => ({
214
236
  insertOne: b.mutation({
215
237
  query: (args) => (norbix) => norbix.api.database.insertOne(args),
216
238
  invalidatesTags: (_res, _err, arg) => [
217
- { type: "DatabaseCollections", id: arg?.collectionName ?? "ANY" }
239
+ {
240
+ type: "DatabaseCollections",
241
+ id: arg?.collectionName ?? "ANY"
242
+ }
218
243
  ]
219
244
  }),
220
245
  insertMany: b.mutation({
221
246
  query: (args) => (norbix) => norbix.api.database.insertMany(args),
222
247
  invalidatesTags: (_res, _err, arg) => [
223
- { type: "DatabaseCollections", id: arg?.collectionName ?? "ANY" }
248
+ {
249
+ type: "DatabaseCollections",
250
+ id: arg?.collectionName ?? "ANY"
251
+ }
224
252
  ]
225
253
  }),
226
254
  updateOne: b.mutation({
227
255
  query: (args) => (norbix) => norbix.api.database.updateOne(args),
228
256
  invalidatesTags: (_res, _err, arg) => [
229
- { type: "DatabaseCollections", id: arg?.collectionName ?? "ANY" }
257
+ {
258
+ type: "DatabaseCollections",
259
+ id: arg?.collectionName ?? "ANY"
260
+ }
230
261
  ]
231
262
  }),
232
263
  updateMany: b.mutation({
233
264
  query: (args) => (norbix) => norbix.api.database.updateMany(args),
234
265
  invalidatesTags: (_res, _err, arg) => [
235
- { type: "DatabaseCollections", id: arg?.collectionName ?? "ANY" }
266
+ {
267
+ type: "DatabaseCollections",
268
+ id: arg?.collectionName ?? "ANY"
269
+ }
236
270
  ]
237
271
  }),
238
272
  replaceOne: b.mutation({
239
273
  query: (args) => (norbix) => norbix.api.database.replaceOne(args),
240
274
  invalidatesTags: (_res, _err, arg) => [
241
- { type: "DatabaseCollections", id: arg?.collectionName ?? "ANY" }
275
+ {
276
+ type: "DatabaseCollections",
277
+ id: arg?.collectionName ?? "ANY"
278
+ }
242
279
  ]
243
280
  }),
244
281
  deleteOne: b.mutation({
245
282
  query: (args) => (norbix) => norbix.api.database.deleteOne(args),
246
283
  invalidatesTags: (_res, _err, arg) => [
247
- { type: "DatabaseCollections", id: arg?.collectionName ?? "ANY" }
284
+ {
285
+ type: "DatabaseCollections",
286
+ id: arg?.collectionName ?? "ANY"
287
+ }
248
288
  ]
249
289
  }),
250
290
  deleteMany: b.mutation({
251
291
  query: (args) => (norbix) => norbix.api.database.deleteMany(args),
252
292
  invalidatesTags: (_res, _err, arg) => [
253
- { type: "DatabaseCollections", id: arg?.collectionName ?? "ANY" }
293
+ {
294
+ type: "DatabaseCollections",
295
+ id: arg?.collectionName ?? "ANY"
296
+ }
254
297
  ]
255
298
  }),
256
299
  changeResponsibility: b.mutation({
257
300
  query: (args) => (norbix) => norbix.api.database.changeResponsibility(args),
258
301
  invalidatesTags: (_res, _err, arg) => [
259
- { type: "DatabaseCollections", id: arg?.collectionName ?? "ANY" }
302
+ {
303
+ type: "DatabaseCollections",
304
+ id: arg?.collectionName ?? "ANY"
305
+ }
260
306
  ]
261
307
  }),
262
308
  // ---- Taxonomies (read-only on api; admin lives in hub.database) ----
263
309
  findTerms: b.query({
264
310
  query: (args) => (norbix) => norbix.api.database.findTerms(args),
265
311
  providesTags: (_res, _err, arg) => [
266
- { type: "DatabaseTaxonomyTerms", id: arg?.taxonomyName ?? "ANY" }
312
+ {
313
+ type: "DatabaseTaxonomyTerms",
314
+ id: arg?.taxonomyName ?? "ANY"
315
+ }
267
316
  ]
268
317
  }),
269
318
  findTermsChildren: b.query({
270
319
  query: (args) => (norbix) => norbix.api.database.findTermsChildren(args),
271
320
  providesTags: (_res, _err, arg) => [
272
- { type: "DatabaseTaxonomyTerms", id: arg?.taxonomyName ?? "ANY" }
321
+ {
322
+ type: "DatabaseTaxonomyTerms",
323
+ id: arg?.taxonomyName ?? "ANY"
324
+ }
273
325
  ]
274
326
  }),
275
327
  // Whole term tree of a taxonomy (or a sub-tree from a root term) in one call.
276
328
  findTermTree: b.query({
277
329
  query: (args) => (norbix) => norbix.api.database.findTermTree(args),
278
330
  providesTags: (_res, _err, arg) => [
279
- { type: "DatabaseTaxonomyTerms", id: arg?.taxonomyName ?? "ANY" }
331
+ {
332
+ type: "DatabaseTaxonomyTerms",
333
+ id: arg?.taxonomyName ?? "ANY"
334
+ }
280
335
  ]
281
336
  }),
282
337
  // Single-parent taxonomy structure tree (Countries → Cities), optionally with terms.
@@ -284,6 +339,16 @@ var apiDatabase = (b) => ({
284
339
  query: (args) => (norbix) => norbix.api.database.findTaxonomyTree(args),
285
340
  providesTags: () => [{ type: "DatabaseTaxonomyTerms", id: "ANY" }]
286
341
  }),
342
+ // One tree across related taxonomies (Countries + Cities: each country with its cities).
343
+ findMergedTermTree: b.query({
344
+ query: (args) => (norbix) => norbix.api.database.findMergedTermTree(args),
345
+ providesTags: (_res, _err, arg) => [
346
+ {
347
+ type: "DatabaseTaxonomyTerms",
348
+ id: arg?.taxonomyName ?? "ANY"
349
+ }
350
+ ]
351
+ }),
287
352
  // ---- Schemas (read-only mirror; full CRUD lives in hub.database) ----
288
353
  getApiDatabaseSchema: b.query({
289
354
  query: (args) => (norbix) => norbix.api.database.getDatabaseSchema(args),
@@ -873,6 +938,18 @@ var hubApikeys = (b) => ({
873
938
  });
874
939
 
875
940
  // src/hooks/hub/database.ts
941
+ var recordsTag = (arg) => [
942
+ {
943
+ type: "DatabaseRecords",
944
+ id: arg?.collectionName ?? "ANY"
945
+ }
946
+ ];
947
+ var termsTag = (arg) => [
948
+ {
949
+ type: "DatabaseTaxonomyTerms",
950
+ id: arg?.taxonomyName ?? "ANY"
951
+ }
952
+ ];
876
953
  var hubDatabase = (b) => ({
877
954
  disableDatabase: b.mutation({
878
955
  query: (args) => (norbix) => norbix.hub.database.disableDatabase(args),
@@ -1049,6 +1126,134 @@ var hubDatabase = (b) => ({
1049
1126
  testDatabaseAggregate: b.mutation({
1050
1127
  query: (args) => (norbix) => norbix.hub.database.testDatabaseAggregate(args),
1051
1128
  invalidatesTags: ["DatabaseAggregates"]
1129
+ }),
1130
+ // ---- Records (Hub data browser: same operations as api.database, admin-scoped) ----
1131
+ findRecords: b.query({
1132
+ query: (args) => (norbix) => norbix.hub.database.findRecords(args),
1133
+ providesTags: (_res, _err, arg) => recordsTag(arg)
1134
+ }),
1135
+ findOneRecord: b.query({
1136
+ query: (args) => (norbix) => norbix.hub.database.findOneRecord(args),
1137
+ providesTags: (_res, _err, arg) => recordsTag(arg)
1138
+ }),
1139
+ countRecords: b.query({
1140
+ query: (args) => (norbix) => norbix.hub.database.countRecords(args),
1141
+ providesTags: (_res, _err, arg) => recordsTag(arg)
1142
+ }),
1143
+ distinctRecordValues: b.query({
1144
+ query: (args) => (norbix) => norbix.hub.database.distinctRecordValues(args),
1145
+ providesTags: (_res, _err, arg) => recordsTag(arg)
1146
+ }),
1147
+ // Aggregations run a pipeline on demand: mutations, so the answer is never served from cache.
1148
+ aggregateRecords: b.mutation({
1149
+ query: (args) => (norbix) => norbix.hub.database.aggregateRecords(args)
1150
+ }),
1151
+ executeRecordsAggregate: b.mutation({
1152
+ query: (args) => (norbix) => norbix.hub.database.executeRecordsAggregate(args)
1153
+ }),
1154
+ getCollectionIndexes: b.query({
1155
+ query: (args) => (norbix) => norbix.hub.database.getCollectionIndexes(args),
1156
+ providesTags: (_res, _err, arg) => [
1157
+ {
1158
+ type: "DatabaseCollections",
1159
+ id: arg?.collectionName ?? "ANY"
1160
+ }
1161
+ ]
1162
+ }),
1163
+ insertRecord: b.mutation({
1164
+ query: (args) => (norbix) => norbix.hub.database.insertRecord(args),
1165
+ invalidatesTags: (_res, _err, arg) => recordsTag(arg)
1166
+ }),
1167
+ insertManyRecords: b.mutation({
1168
+ query: (args) => (norbix) => norbix.hub.database.insertManyRecords(args),
1169
+ invalidatesTags: (_res, _err, arg) => recordsTag(arg)
1170
+ }),
1171
+ updateOneRecord: b.mutation({
1172
+ query: (args) => (norbix) => norbix.hub.database.updateOneRecord(args),
1173
+ invalidatesTags: (_res, _err, arg) => recordsTag(arg)
1174
+ }),
1175
+ updateManyRecords: b.mutation({
1176
+ query: (args) => (norbix) => norbix.hub.database.updateManyRecords(args),
1177
+ invalidatesTags: (_res, _err, arg) => recordsTag(arg)
1178
+ }),
1179
+ replaceRecord: b.mutation({
1180
+ query: (args) => (norbix) => norbix.hub.database.replaceRecord(args),
1181
+ invalidatesTags: (_res, _err, arg) => recordsTag(arg)
1182
+ }),
1183
+ deleteRecord: b.mutation({
1184
+ query: (args) => (norbix) => norbix.hub.database.deleteRecord(args),
1185
+ invalidatesTags: (_res, _err, arg) => recordsTag(arg)
1186
+ }),
1187
+ deleteManyRecords: b.mutation({
1188
+ query: (args) => (norbix) => norbix.hub.database.deleteManyRecords(args),
1189
+ invalidatesTags: (_res, _err, arg) => recordsTag(arg)
1190
+ }),
1191
+ changeRecordResponsibility: b.mutation({
1192
+ query: (args) => (norbix) => norbix.hub.database.changeRecordResponsibility(args),
1193
+ invalidatesTags: (_res, _err, arg) => recordsTag(arg)
1194
+ }),
1195
+ // Seeds several collections at once (`collections` is a JSON map), so every record list is stale.
1196
+ seedCollectionRecords: b.mutation({
1197
+ query: (args) => (norbix) => norbix.hub.database.seedCollectionRecords(args),
1198
+ invalidatesTags: ["DatabaseRecords"]
1199
+ }),
1200
+ // ---- Taxonomy trees ----
1201
+ getDatabaseTaxonomyTree: b.query({
1202
+ query: (args) => (norbix) => norbix.hub.database.getDatabaseTaxonomyTree(args),
1203
+ providesTags: ["DatabaseTaxonomies", "DatabaseTaxonomyTerms"]
1204
+ }),
1205
+ getDatabaseTaxonomyTermTree: b.query({
1206
+ query: (args) => (norbix) => norbix.hub.database.getDatabaseTaxonomyTermTree(args),
1207
+ providesTags: (_res, _err, arg) => termsTag(arg)
1208
+ }),
1209
+ // One tree across related taxonomies (Countries + Cities: each country with its cities).
1210
+ getDatabaseMergedTermTree: b.query({
1211
+ query: (args) => (norbix) => norbix.hub.database.getDatabaseMergedTermTree(args),
1212
+ providesTags: (_res, _err, arg) => termsTag(arg)
1213
+ }),
1214
+ // ---- Schema bundle, embed and list settings ----
1215
+ // A bundle can create schemas, taxonomies and terms in one call.
1216
+ applyDatabaseSchemaBundle: b.mutation({
1217
+ query: (args) => (norbix) => norbix.hub.database.applyDatabaseSchemaBundle(args),
1218
+ invalidatesTags: ["DatabaseSchemas", "DatabaseTaxonomies", "DatabaseTaxonomyTerms"]
1219
+ }),
1220
+ updateDatabaseSchemaEmbed: b.mutation({
1221
+ query: (args) => (norbix) => norbix.hub.database.updateDatabaseSchemaEmbed(args),
1222
+ invalidatesTags: ["DatabaseSchemas"]
1223
+ }),
1224
+ getDatabaseSchemaListSettings: b.query({
1225
+ query: (args) => (norbix) => norbix.hub.database.getDatabaseSchemaListSettings(args),
1226
+ providesTags: ["DatabaseSchemas"]
1227
+ }),
1228
+ updateDatabaseSchemaListSettings: b.mutation({
1229
+ query: (args) => (norbix) => norbix.hub.database.updateDatabaseSchemaListSettings(args),
1230
+ invalidatesTags: ["DatabaseSchemas"]
1231
+ }),
1232
+ // ---- Collection imports (CSV) ----
1233
+ getCollectionImports: b.query({
1234
+ query: (args) => (norbix) => norbix.hub.database.getCollectionImports(args),
1235
+ providesTags: ["DatabaseImports"]
1236
+ }),
1237
+ getCollectionImport: b.query({
1238
+ query: (args) => (norbix) => norbix.hub.database.getCollectionImport(args),
1239
+ providesTags: ["DatabaseImports"]
1240
+ }),
1241
+ // An import writes records into the target collection.
1242
+ createCollectionImport: b.mutation({
1243
+ query: (args) => (norbix) => norbix.hub.database.createCollectionImport(args),
1244
+ invalidatesTags: (_res, _err, arg) => [{ type: "DatabaseImports" }, ...recordsTag(arg)]
1245
+ }),
1246
+ deleteCollectionImport: b.mutation({
1247
+ query: (args) => (norbix) => norbix.hub.database.deleteCollectionImport(args),
1248
+ invalidatesTags: ["DatabaseImports"]
1249
+ }),
1250
+ // Reads the uploaded file and suggests a column mapping; saves nothing.
1251
+ analyzeImportFile: b.mutation({
1252
+ query: (args) => (norbix) => norbix.hub.database.analyzeImportFile(args)
1253
+ }),
1254
+ // Returns a one-time signed upload URL; saves nothing.
1255
+ requestImportUploadUrl: b.mutation({
1256
+ query: (args) => (norbix) => norbix.hub.database.requestImportUploadUrl(args)
1052
1257
  })
1053
1258
  });
1054
1259