@norbix.ai/react-redux 1.8.0 → 1.8.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 +45 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -221,6 +221,51 @@ Every `hub.database` method (73) and every `api.database` method (22) of `@norbi
|
|
|
221
221
|
| `useFindOwnQuery` | `api.database.findOwn` | provides `DatabaseCollections/<collectionName>` |
|
|
222
222
|
| `useFindMergedTermTreeQuery` | `api.database.findMergedTermTree` | provides `DatabaseTaxonomyTerms/<taxonomyName>` |
|
|
223
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
|
+
### Bulk record writes (core SDK 4.11.0)
|
|
242
|
+
|
|
243
|
+
`useUpdateManyRecordsMutation` / `useDeleteManyRecordsMutation` (Hub) and `useUpdateManyMutation` / `useDeleteManyMutation` (Api) take a new optional `allRecords` argument. An empty filter (`{}`, or no filter on update) matches the whole collection and the gateway refuses it with `CM-ERRORS-DATABASE-037` unless you pass `allRecords: true`:
|
|
244
|
+
|
|
245
|
+
```ts
|
|
246
|
+
const [deleteMany] = useDeleteManyRecordsMutation();
|
|
247
|
+
await deleteMany({ collectionName: 'orders', filter: '{}', allRecords: true });
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Other gateway rules that now show up as errors from these hooks: an update body with `$` operators (`$inc`, `$set`, …) is refused with `CM-ERRORS-DATABASE-035` (send the plain fields to set); a broken insert or replace document answers `CM-ERRORS-DATABASE-036`; soft-deleted records are "not found" for update, replace and change-owner, and a bulk update skips them. A caller with only own-record rights may now use the bulk hooks; they touch only that caller's records.
|
|
251
|
+
|
|
252
|
+
### Schemas per environment
|
|
253
|
+
|
|
254
|
+
`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.
|
|
255
|
+
|
|
256
|
+
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:
|
|
257
|
+
|
|
258
|
+
```tsx
|
|
259
|
+
// Per call: TEST and PROD cache apart.
|
|
260
|
+
const { data } = useGetDatabaseSchemasQuery({ env: 'TEST' });
|
|
261
|
+
|
|
262
|
+
// Or switch the whole client and drop what was cached for the old environment.
|
|
263
|
+
norbix.setEnvironment('TEST');
|
|
264
|
+
dispatch(norbixApi.util.invalidateTags(['DatabaseSchemas']));
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
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.
|
|
268
|
+
|
|
224
269
|
### End-user AI chat — `norbix.api.ai`
|
|
225
270
|
|
|
226
271
|
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.
|