@norbix.ai/react-redux 1.8.2 → 1.10.0
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 +72 -33
- package/dist/index.cjs +88 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +88 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -187,39 +187,40 @@ A _curated_ set of hooks for the most common endpoints. Every hook is end-to-end
|
|
|
187
187
|
|
|
188
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
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
|
-
| `
|
|
215
|
-
| `
|
|
216
|
-
| `
|
|
217
|
-
| `
|
|
218
|
-
| `
|
|
219
|
-
| `
|
|
220
|
-
| `
|
|
221
|
-
| `
|
|
222
|
-
| `
|
|
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
|
+
| `useGetDatabaseSchemaIndexStatusQuery` | `hub.database.getDatabaseSchemaIndexStatus` | provides `DatabaseSchemas/<id>` — the last schema-index run (building / ready / refused / partial) |
|
|
215
|
+
| `useUpdateDatabaseSchemaListSettingsMutation` | `hub.database.updateDatabaseSchemaListSettings` | invalidates `DatabaseSchemas` |
|
|
216
|
+
| `useGetCollectionImportsQuery` | `hub.database.getCollectionImports` | provides `DatabaseImports` |
|
|
217
|
+
| `useGetCollectionImportQuery` | `hub.database.getCollectionImport` | provides `DatabaseImports` |
|
|
218
|
+
| `useCreateCollectionImportMutation` | `hub.database.createCollectionImport` | invalidates `DatabaseImports` + `DatabaseRecords/<collectionName>` |
|
|
219
|
+
| `useDeleteCollectionImportMutation` | `hub.database.deleteCollectionImport` | invalidates `DatabaseImports` |
|
|
220
|
+
| `useAnalyzeImportFileMutation` | `hub.database.analyzeImportFile` | — |
|
|
221
|
+
| `useRequestImportUploadUrlMutation` | `hub.database.requestImportUploadUrl` | — |
|
|
222
|
+
| `useFindOwnQuery` | `api.database.findOwn` | provides `DatabaseCollections/<collectionName>` |
|
|
223
|
+
| `useFindMergedTermTreeQuery` | `api.database.findMergedTermTree` | provides `DatabaseTaxonomyTerms/<taxonomyName>` |
|
|
223
224
|
|
|
224
225
|
### Module switches send `PUT` (core SDK 4.10.0)
|
|
225
226
|
|
|
@@ -505,6 +506,44 @@ The typed `task` body (plain `'EmailCampaign'` / `'AllUsers'` strings, no
|
|
|
505
506
|
cast) comes from `@norbix.ai/ts` 4.6.0. Full method reference: the core SDK's
|
|
506
507
|
`docs/hub/scheduler.md`.
|
|
507
508
|
|
|
509
|
+
## Code — integrations and cloud functions
|
|
510
|
+
|
|
511
|
+
Every `hub.code` endpoint outside the marketplace (15) has a hook, 1:1 with
|
|
512
|
+
`norbix.hub.code`: the module switch, the Code integrations (AWS Lambda, Azure
|
|
513
|
+
Functions, Google Cloud Functions credentials) and the cloud functions they
|
|
514
|
+
may call — list, aliases / versions, a call by hand, a sample envelope for a
|
|
515
|
+
local run, and the last runs of a trigger or task. The five function hooks
|
|
516
|
+
need `@norbix.ai/ts` 4.19.0.
|
|
517
|
+
|
|
518
|
+
| Area | Hooks | Cache tag |
|
|
519
|
+
| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
|
|
520
|
+
| Module switch | `useEnableCodeModuleMutation`, `useDisableCodeModuleMutation` | invalidates `Account`, `Projects`, `Code` |
|
|
521
|
+
| Integrations | `useGetCodeIntegrationsQuery`, `useGetCodeIntegrationQuery`, `useSaveCodeIntegrationMutation`, `useDeleteCodeIntegrationMutation`, `useEnableCodeIntegrationMutation`, `useDisableCodeIntegrationMutation`, `useSetCodeIntegrationAsDefaultMutation`, `useTestCodeIntegrationMutation` | provides / invalidates `CodeIntegrations/LIST` and `CodeIntegrations/<id>`; `test` touches nothing |
|
|
522
|
+
| Cloud functions | `useGetCodeFunctionsQuery`, `useGetCodeFunctionQualifiersQuery`, `useGetCodeFunctionEventSampleQuery`, `useGetCodeFunctionRunsQuery`, `useInvokeCodeFunctionMutation` | provides `CodeFunctions/LIST`, `CodeFunctions/SAMPLE`, `CodeFunctions/RUNS`; `invoke` touches nothing |
|
|
523
|
+
|
|
524
|
+
```tsx
|
|
525
|
+
const integrationId = 'int_6rBACnEaxQ0x1jTiHtAuWV';
|
|
526
|
+
const { data } = useGetCodeFunctionsQuery({ integrationId, prefix: 'orders-' });
|
|
527
|
+
const [invoke, { data: result }] = useInvokeCodeFunctionMutation();
|
|
528
|
+
|
|
529
|
+
await invoke({
|
|
530
|
+
functionRef: { integrationId, functionId: 'orders-on-update', qualifier: 'prod' },
|
|
531
|
+
payload: { orderId: '6ac54a59212c29912eaddd81', dryRun: true },
|
|
532
|
+
invocationType: 'Sync',
|
|
533
|
+
});
|
|
534
|
+
// result: { statusCode, durationMs, output, requestId, logs }
|
|
535
|
+
|
|
536
|
+
// The last runs of a trigger (or `{ taskId }` for a scheduled task), newest first.
|
|
537
|
+
const { data: runs } = useGetCodeFunctionRunsQuery({
|
|
538
|
+
triggerId: 'trg_1p4R3gTobGZpD6fXvHT4rd',
|
|
539
|
+
limit: 20,
|
|
540
|
+
});
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
The function side — parsing the envelope your function receives — is
|
|
544
|
+
`parseFunctionEvent` in the core SDK (`docs/code-functions.md`), not a hook.
|
|
545
|
+
Full method reference: the core SDK's `docs/hub/code.md`.
|
|
546
|
+
|
|
508
547
|
## Working with terms
|
|
509
548
|
|
|
510
549
|
A **taxonomy** is a named tree of **terms** (labels). A term can have one parent (a clean hierarchy) or several parents (the same item under many categories). There is one read hook per scenario — pick the one that matches what you want:
|
package/dist/index.cjs
CHANGED
|
@@ -937,6 +937,84 @@ var hubApikeys = (b) => ({
|
|
|
937
937
|
})
|
|
938
938
|
});
|
|
939
939
|
|
|
940
|
+
// src/hooks/hub/code.ts
|
|
941
|
+
var hubCode = (b) => {
|
|
942
|
+
const callHC = (norbix) => norbix.hub.code;
|
|
943
|
+
const integrationTags = (arg) => [
|
|
944
|
+
{ type: "CodeIntegrations", id: "LIST" },
|
|
945
|
+
{
|
|
946
|
+
type: "CodeIntegrations",
|
|
947
|
+
id: arg?.id ?? arg?.Id ?? "CURRENT"
|
|
948
|
+
}
|
|
949
|
+
];
|
|
950
|
+
return {
|
|
951
|
+
// ---- Module toggle ----
|
|
952
|
+
enableCodeModule: b.mutation({
|
|
953
|
+
query: (args) => (norbix) => callHC(norbix).enableCode(args),
|
|
954
|
+
invalidatesTags: ["Account", "Projects", "Code"]
|
|
955
|
+
}),
|
|
956
|
+
disableCodeModule: b.mutation({
|
|
957
|
+
query: (args) => (norbix) => callHC(norbix).disableCode(args),
|
|
958
|
+
invalidatesTags: ["Account", "Projects", "Code"]
|
|
959
|
+
}),
|
|
960
|
+
// ---- Integrations ----
|
|
961
|
+
getCodeIntegrations: b.query({
|
|
962
|
+
query: (args) => (norbix) => callHC(norbix).getCodeIntegrations(args),
|
|
963
|
+
providesTags: [{ type: "CodeIntegrations", id: "LIST" }]
|
|
964
|
+
}),
|
|
965
|
+
getCodeIntegration: b.query({
|
|
966
|
+
query: (args) => (norbix) => callHC(norbix).getCodeIntegration(args),
|
|
967
|
+
providesTags: (_res, _err, arg) => [
|
|
968
|
+
{ type: "CodeIntegrations", id: arg?.id ?? "CURRENT" }
|
|
969
|
+
]
|
|
970
|
+
}),
|
|
971
|
+
saveCodeIntegration: b.mutation({
|
|
972
|
+
query: (args) => (norbix) => callHC(norbix).saveCodeIntegration(args),
|
|
973
|
+
invalidatesTags: (_res, _err, arg) => integrationTags(arg)
|
|
974
|
+
}),
|
|
975
|
+
deleteCodeIntegration: b.mutation({
|
|
976
|
+
query: (args) => (norbix) => callHC(norbix).deleteCodeIntegration(args),
|
|
977
|
+
invalidatesTags: (_res, _err, arg) => integrationTags(arg)
|
|
978
|
+
}),
|
|
979
|
+
enableCodeIntegration: b.mutation({
|
|
980
|
+
query: (args) => (norbix) => callHC(norbix).enableCodeIntegration(args),
|
|
981
|
+
invalidatesTags: (_res, _err, arg) => integrationTags(arg)
|
|
982
|
+
}),
|
|
983
|
+
disableCodeIntegration: b.mutation({
|
|
984
|
+
query: (args) => (norbix) => callHC(norbix).disableCodeIntegration(args),
|
|
985
|
+
invalidatesTags: (_res, _err, arg) => integrationTags(arg)
|
|
986
|
+
}),
|
|
987
|
+
setCodeIntegrationAsDefault: b.mutation({
|
|
988
|
+
query: (args) => (norbix) => callHC(norbix).setCodeIntegrationAsDefault(args),
|
|
989
|
+
// The default flag moves between integrations: the whole list changes.
|
|
990
|
+
invalidatesTags: ["CodeIntegrations"]
|
|
991
|
+
}),
|
|
992
|
+
testCodeIntegration: b.mutation({
|
|
993
|
+
query: (args) => (norbix) => callHC(norbix).testCodeIntegration(args)
|
|
994
|
+
}),
|
|
995
|
+
// ---- Cloud functions (core SDK 4.19.0) ----
|
|
996
|
+
getCodeFunctions: b.query({
|
|
997
|
+
query: (args) => (norbix) => callHC(norbix).getCodeFunctions(args),
|
|
998
|
+
providesTags: [{ type: "CodeFunctions", id: "LIST" }]
|
|
999
|
+
}),
|
|
1000
|
+
getCodeFunctionQualifiers: b.query({
|
|
1001
|
+
query: (args) => (norbix) => callHC(norbix).getCodeFunctionQualifiers(args),
|
|
1002
|
+
providesTags: [{ type: "CodeFunctions", id: "LIST" }]
|
|
1003
|
+
}),
|
|
1004
|
+
getCodeFunctionEventSample: b.query({
|
|
1005
|
+
query: (args) => (norbix) => callHC(norbix).getCodeFunctionEventSample(args),
|
|
1006
|
+
providesTags: [{ type: "CodeFunctions", id: "SAMPLE" }]
|
|
1007
|
+
}),
|
|
1008
|
+
getCodeFunctionRuns: b.query({
|
|
1009
|
+
query: (args) => (norbix) => callHC(norbix).getCodeFunctionRuns(args),
|
|
1010
|
+
providesTags: [{ type: "CodeFunctions", id: "RUNS" }]
|
|
1011
|
+
}),
|
|
1012
|
+
invokeCodeFunction: b.mutation({
|
|
1013
|
+
query: (args) => (norbix) => callHC(norbix).invokeCodeFunction(args)
|
|
1014
|
+
})
|
|
1015
|
+
};
|
|
1016
|
+
};
|
|
1017
|
+
|
|
940
1018
|
// src/hooks/hub/database.ts
|
|
941
1019
|
var recordsTag = (arg) => [
|
|
942
1020
|
{
|
|
@@ -1225,6 +1303,15 @@ var hubDatabase = (b) => ({
|
|
|
1225
1303
|
query: (args) => (norbix) => norbix.hub.database.getDatabaseSchemaListSettings(args),
|
|
1226
1304
|
providesTags: ["DatabaseSchemas"]
|
|
1227
1305
|
}),
|
|
1306
|
+
// The last schema-index run (campaign 24 mongo-indexes): building | ready |
|
|
1307
|
+
// refused | partial, one entry per database. Cached per schema so a List
|
|
1308
|
+
// tab polling one schema never refetches the others.
|
|
1309
|
+
getDatabaseSchemaIndexStatus: b.query({
|
|
1310
|
+
query: (args) => (norbix) => norbix.hub.database.getDatabaseSchemaIndexStatus(args),
|
|
1311
|
+
providesTags: (_res, _err, arg) => [
|
|
1312
|
+
{ type: "DatabaseSchemas", id: arg?.id ?? "ANY" }
|
|
1313
|
+
]
|
|
1314
|
+
}),
|
|
1228
1315
|
updateDatabaseSchemaListSettings: b.mutation({
|
|
1229
1316
|
query: (args) => (norbix) => norbix.hub.database.updateDatabaseSchemaListSettings(args),
|
|
1230
1317
|
invalidatesTags: ["DatabaseSchemas"]
|
|
@@ -2254,6 +2341,7 @@ function buildEndpoints(builder) {
|
|
|
2254
2341
|
...hubAccount(builder),
|
|
2255
2342
|
...hubAi(builder),
|
|
2256
2343
|
...hubApikeys(builder),
|
|
2344
|
+
...hubCode(builder),
|
|
2257
2345
|
...hubMembership(builder),
|
|
2258
2346
|
...hubDatabase(builder),
|
|
2259
2347
|
...hubFiles(builder),
|