@norbix.ai/react-redux 0.1.1 → 1.0.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 +57 -0
- package/dist/index.cjs +48 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -12
- package/dist/index.d.ts +30 -12
- package/dist/index.js +48 -6
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -15,27 +15,44 @@ import { ReactNode } from 'react';
|
|
|
15
15
|
* we cannot store a `NorbixError` instance directly (Error objects don't
|
|
16
16
|
* serialize cleanly). This shape preserves the high-signal fields the SDK
|
|
17
17
|
* already exposes and is safe to round-trip through the store / devtools.
|
|
18
|
+
*
|
|
19
|
+
* The message and the error code are the gateway's own: `@norbix.ai/ts` reads
|
|
20
|
+
* them out of `responseStatus.errors[]`, where the gateway puts them
|
|
21
|
+
* (10b-files slice ERRORS, issue #66). Each field is here under two names —
|
|
22
|
+
* `httpStatus` / `errorCode` / `errors` are the names every Norbix SDK uses,
|
|
23
|
+
* `status` / `code` / `fieldErrors` are the same values under the names this
|
|
24
|
+
* package has always used.
|
|
18
25
|
*/
|
|
26
|
+
interface SerializedNorbixErrorItem {
|
|
27
|
+
errorCode?: string;
|
|
28
|
+
fieldName?: string;
|
|
29
|
+
message?: string;
|
|
30
|
+
meta?: Record<string, string | null>;
|
|
31
|
+
}
|
|
19
32
|
interface SerializedNorbixError {
|
|
20
|
-
/** HTTP status (0 for network / timeout). */
|
|
33
|
+
/** HTTP status (0 for network / timeout). 200 when the gateway refused a 200 answer. */
|
|
21
34
|
status: number;
|
|
22
|
-
/**
|
|
35
|
+
/** Same value as `status`. The name every Norbix SDK uses for it. */
|
|
36
|
+
httpStatus: number;
|
|
37
|
+
/** Machine-readable error code, e.g. `CM-ERRORS-FILES-016`. */
|
|
23
38
|
code?: string;
|
|
39
|
+
/** Same value as `code`. The name every Norbix SDK uses for it. */
|
|
40
|
+
errorCode?: string;
|
|
24
41
|
/** Human-readable message from the SDK / gateway. */
|
|
25
42
|
message: string;
|
|
26
|
-
/**
|
|
27
|
-
fieldErrors:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
message?: string;
|
|
31
|
-
meta?: Record<string, string>;
|
|
32
|
-
}>;
|
|
43
|
+
/** Every error the gateway sent, in the order it sent them. */
|
|
44
|
+
fieldErrors: SerializedNorbixErrorItem[];
|
|
45
|
+
/** Same list as `fieldErrors`. The name every Norbix SDK uses for it. */
|
|
46
|
+
errors: SerializedNorbixErrorItem[];
|
|
33
47
|
/** Originating URL when known, useful for debugging. */
|
|
34
48
|
url?: string;
|
|
35
49
|
}
|
|
36
50
|
/**
|
|
37
51
|
* Convert an unknown thrown value (typically a NorbixError) into the
|
|
38
52
|
* serializable shape RTK Query stores in state.
|
|
53
|
+
*
|
|
54
|
+
* Both name sets are read, because `httpStatus` / `errorCode` / `errors` are
|
|
55
|
+
* getters on `NorbixError` (on the prototype, so a spread would miss them).
|
|
39
56
|
*/
|
|
40
57
|
declare function serializeNorbixError(err: unknown): SerializedNorbixError;
|
|
41
58
|
|
|
@@ -115,7 +132,7 @@ declare function createNorbixApi(getClient: GetNorbixClient, options?: {
|
|
|
115
132
|
revealWebhookIntegrationSecret: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_hub.CodeMashHub2.RevealWebhookIntegrationSecretRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_hub.CodeMashHub2.RevealWebhookIntegrationSecretResponse, string, unknown>;
|
|
116
133
|
rotateWebhookIntegrationSecret: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_hub.CodeMashHub2.RotateWebhookIntegrationSecretRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_hub.CodeMashHub2.RotateWebhookIntegrationSecretResponse, string, unknown>;
|
|
117
134
|
updateWebhookIntegrationExtraHeaders: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_hub.CodeMashHub2.UpdateWebhookIntegrationExtraHeadersRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_hub.CodeMashHub2.EmptyResponse, string, unknown>;
|
|
118
|
-
receiveWebhook: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_hub.CodeMashHub2.ReceiveWebhook> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags,
|
|
135
|
+
receiveWebhook: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_hub.CodeMashHub2.ReceiveWebhook> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, void, string, unknown>;
|
|
119
136
|
disableWebhookDestination: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_hub.CodeMashHub2.DisableWebhookDestinationRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_hub.CodeMashHub2.EmptyResponse, string, unknown>;
|
|
120
137
|
enableWebhookDestination: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_hub.CodeMashHub2.EnableWebhookDestinationRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_hub.CodeMashHub2.EmptyResponse, string, unknown>;
|
|
121
138
|
removeWebhookDestination: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_hub.CodeMashHub2.RemoveWebhookDestinationRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_hub.CodeMashHub2.EmptyResponse, string, unknown>;
|
|
@@ -434,12 +451,13 @@ declare function createNorbixApi(getClient: GetNorbixClient, options?: {
|
|
|
434
451
|
commitUpload: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_api.CodeMashApi2.CommitUploadRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_api.CodeMashApi2.EmptyResponse, string, unknown>;
|
|
435
452
|
deleteFileApi: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_api.CodeMashApi2.DeleteFileApiRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_api.CodeMashApi2.EmptyResponse, string, unknown>;
|
|
436
453
|
deleteManyFilesApi: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_api.CodeMashApi2.DeleteManyFilesApiRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_api.CodeMashApi2.EmptyResponse, string, unknown>;
|
|
437
|
-
downloadFileApi: _reduxjs_toolkit_query.QueryDefinition<Partial<_norbix_ai_ts_types_api.CodeMashApi2.DownloadFileApiRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags,
|
|
454
|
+
downloadFileApi: _reduxjs_toolkit_query.QueryDefinition<Partial<_norbix_ai_ts_types_api.CodeMashApi2.DownloadFileApiRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, Uint8Array<ArrayBufferLike>, string, unknown>;
|
|
438
455
|
getFileInfo: _reduxjs_toolkit_query.QueryDefinition<Partial<_norbix_ai_ts_types_api.CodeMashApi2.GetFileInfoRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_api.CodeMashApi2.GetFileInfoResponse, string, unknown>;
|
|
439
456
|
getSignedUrl: _reduxjs_toolkit_query.QueryDefinition<Partial<_norbix_ai_ts_types_api.CodeMashApi2.GetSignedUrlRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_api.CodeMashApi2.GetSignedUrlResponse, string, unknown>;
|
|
440
457
|
listFiles: _reduxjs_toolkit_query.QueryDefinition<Partial<_norbix_ai_ts_types_api.CodeMashApi2.ListFilesRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_api.CodeMashApi2.ListFilesResponse, string, unknown>;
|
|
441
458
|
requestUploadUrl: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_api.CodeMashApi2.RequestUploadUrlRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_api.CodeMashApi2.RequestUploadUrlResponse, string, unknown>;
|
|
442
459
|
getPublicFile: _reduxjs_toolkit_query.QueryDefinition<Partial<_norbix_ai_ts_types_api.CodeMashApi2.GetPublicFileRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, Uint8Array<ArrayBufferLike>, string, unknown>;
|
|
460
|
+
testFilesIntegrationApi: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_api.CodeMashApi2.TestFilesIntegrationRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_api.CodeMashApi2.TestFilesIntegrationResponse, string, unknown>;
|
|
443
461
|
askChat: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_api.CodeMashApi2.AskChatRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_api.CodeMashApi2.AskChatResponse, string, unknown>;
|
|
444
462
|
getApiKeys: _reduxjs_toolkit_query.QueryDefinition<Partial<_norbix_ai_ts_types_api.CodeMashApi2.GetApiKeys> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_api.CodeMashApi2.GetApiKeysResponse, string, unknown>;
|
|
445
463
|
regenerateApiKeys: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_api.CodeMashApi2.RegenerateApiKeys> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_api.CodeMashApi2.RegenerateApiKeysResponse, string, unknown>;
|
|
@@ -651,4 +669,4 @@ type IntegrationEndpointKeys<P extends string> = `get${P}Integrations` | `get${P
|
|
|
651
669
|
*/
|
|
652
670
|
declare function buildIntegrationsEndpoints<Prefix extends string, Tag extends AllTags>(b: Builder, opts: BuildIntegrationsOptions<Prefix, Tag>): Record<IntegrationEndpointKeys<Prefix>, unknown>;
|
|
653
671
|
|
|
654
|
-
export { type AllTags, type BuildIntegrationsOptions, type Builder, type GetNorbixClient, type IntegrationEndpointKeys, type NorbixApi, type NorbixCall, NorbixProvider, type NorbixProviderProps, type SerializedNorbixError, buildIntegrationsEndpoints, createNorbixApi, createNorbixBaseQuery, serializeNorbixError, useNorbix, useOptionalNorbix };
|
|
672
|
+
export { type AllTags, type BuildIntegrationsOptions, type Builder, type GetNorbixClient, type IntegrationEndpointKeys, type NorbixApi, type NorbixCall, NorbixProvider, type NorbixProviderProps, type SerializedNorbixError, type SerializedNorbixErrorItem, buildIntegrationsEndpoints, createNorbixApi, createNorbixBaseQuery, serializeNorbixError, useNorbix, useOptionalNorbix };
|
package/dist/index.d.ts
CHANGED
|
@@ -15,27 +15,44 @@ import { ReactNode } from 'react';
|
|
|
15
15
|
* we cannot store a `NorbixError` instance directly (Error objects don't
|
|
16
16
|
* serialize cleanly). This shape preserves the high-signal fields the SDK
|
|
17
17
|
* already exposes and is safe to round-trip through the store / devtools.
|
|
18
|
+
*
|
|
19
|
+
* The message and the error code are the gateway's own: `@norbix.ai/ts` reads
|
|
20
|
+
* them out of `responseStatus.errors[]`, where the gateway puts them
|
|
21
|
+
* (10b-files slice ERRORS, issue #66). Each field is here under two names —
|
|
22
|
+
* `httpStatus` / `errorCode` / `errors` are the names every Norbix SDK uses,
|
|
23
|
+
* `status` / `code` / `fieldErrors` are the same values under the names this
|
|
24
|
+
* package has always used.
|
|
18
25
|
*/
|
|
26
|
+
interface SerializedNorbixErrorItem {
|
|
27
|
+
errorCode?: string;
|
|
28
|
+
fieldName?: string;
|
|
29
|
+
message?: string;
|
|
30
|
+
meta?: Record<string, string | null>;
|
|
31
|
+
}
|
|
19
32
|
interface SerializedNorbixError {
|
|
20
|
-
/** HTTP status (0 for network / timeout). */
|
|
33
|
+
/** HTTP status (0 for network / timeout). 200 when the gateway refused a 200 answer. */
|
|
21
34
|
status: number;
|
|
22
|
-
/**
|
|
35
|
+
/** Same value as `status`. The name every Norbix SDK uses for it. */
|
|
36
|
+
httpStatus: number;
|
|
37
|
+
/** Machine-readable error code, e.g. `CM-ERRORS-FILES-016`. */
|
|
23
38
|
code?: string;
|
|
39
|
+
/** Same value as `code`. The name every Norbix SDK uses for it. */
|
|
40
|
+
errorCode?: string;
|
|
24
41
|
/** Human-readable message from the SDK / gateway. */
|
|
25
42
|
message: string;
|
|
26
|
-
/**
|
|
27
|
-
fieldErrors:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
message?: string;
|
|
31
|
-
meta?: Record<string, string>;
|
|
32
|
-
}>;
|
|
43
|
+
/** Every error the gateway sent, in the order it sent them. */
|
|
44
|
+
fieldErrors: SerializedNorbixErrorItem[];
|
|
45
|
+
/** Same list as `fieldErrors`. The name every Norbix SDK uses for it. */
|
|
46
|
+
errors: SerializedNorbixErrorItem[];
|
|
33
47
|
/** Originating URL when known, useful for debugging. */
|
|
34
48
|
url?: string;
|
|
35
49
|
}
|
|
36
50
|
/**
|
|
37
51
|
* Convert an unknown thrown value (typically a NorbixError) into the
|
|
38
52
|
* serializable shape RTK Query stores in state.
|
|
53
|
+
*
|
|
54
|
+
* Both name sets are read, because `httpStatus` / `errorCode` / `errors` are
|
|
55
|
+
* getters on `NorbixError` (on the prototype, so a spread would miss them).
|
|
39
56
|
*/
|
|
40
57
|
declare function serializeNorbixError(err: unknown): SerializedNorbixError;
|
|
41
58
|
|
|
@@ -115,7 +132,7 @@ declare function createNorbixApi(getClient: GetNorbixClient, options?: {
|
|
|
115
132
|
revealWebhookIntegrationSecret: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_hub.CodeMashHub2.RevealWebhookIntegrationSecretRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_hub.CodeMashHub2.RevealWebhookIntegrationSecretResponse, string, unknown>;
|
|
116
133
|
rotateWebhookIntegrationSecret: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_hub.CodeMashHub2.RotateWebhookIntegrationSecretRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_hub.CodeMashHub2.RotateWebhookIntegrationSecretResponse, string, unknown>;
|
|
117
134
|
updateWebhookIntegrationExtraHeaders: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_hub.CodeMashHub2.UpdateWebhookIntegrationExtraHeadersRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_hub.CodeMashHub2.EmptyResponse, string, unknown>;
|
|
118
|
-
receiveWebhook: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_hub.CodeMashHub2.ReceiveWebhook> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags,
|
|
135
|
+
receiveWebhook: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_hub.CodeMashHub2.ReceiveWebhook> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, void, string, unknown>;
|
|
119
136
|
disableWebhookDestination: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_hub.CodeMashHub2.DisableWebhookDestinationRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_hub.CodeMashHub2.EmptyResponse, string, unknown>;
|
|
120
137
|
enableWebhookDestination: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_hub.CodeMashHub2.EnableWebhookDestinationRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_hub.CodeMashHub2.EmptyResponse, string, unknown>;
|
|
121
138
|
removeWebhookDestination: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_hub.CodeMashHub2.RemoveWebhookDestinationRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_hub.CodeMashHub2.EmptyResponse, string, unknown>;
|
|
@@ -434,12 +451,13 @@ declare function createNorbixApi(getClient: GetNorbixClient, options?: {
|
|
|
434
451
|
commitUpload: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_api.CodeMashApi2.CommitUploadRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_api.CodeMashApi2.EmptyResponse, string, unknown>;
|
|
435
452
|
deleteFileApi: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_api.CodeMashApi2.DeleteFileApiRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_api.CodeMashApi2.EmptyResponse, string, unknown>;
|
|
436
453
|
deleteManyFilesApi: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_api.CodeMashApi2.DeleteManyFilesApiRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_api.CodeMashApi2.EmptyResponse, string, unknown>;
|
|
437
|
-
downloadFileApi: _reduxjs_toolkit_query.QueryDefinition<Partial<_norbix_ai_ts_types_api.CodeMashApi2.DownloadFileApiRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags,
|
|
454
|
+
downloadFileApi: _reduxjs_toolkit_query.QueryDefinition<Partial<_norbix_ai_ts_types_api.CodeMashApi2.DownloadFileApiRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, Uint8Array<ArrayBufferLike>, string, unknown>;
|
|
438
455
|
getFileInfo: _reduxjs_toolkit_query.QueryDefinition<Partial<_norbix_ai_ts_types_api.CodeMashApi2.GetFileInfoRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_api.CodeMashApi2.GetFileInfoResponse, string, unknown>;
|
|
439
456
|
getSignedUrl: _reduxjs_toolkit_query.QueryDefinition<Partial<_norbix_ai_ts_types_api.CodeMashApi2.GetSignedUrlRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_api.CodeMashApi2.GetSignedUrlResponse, string, unknown>;
|
|
440
457
|
listFiles: _reduxjs_toolkit_query.QueryDefinition<Partial<_norbix_ai_ts_types_api.CodeMashApi2.ListFilesRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_api.CodeMashApi2.ListFilesResponse, string, unknown>;
|
|
441
458
|
requestUploadUrl: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_api.CodeMashApi2.RequestUploadUrlRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_api.CodeMashApi2.RequestUploadUrlResponse, string, unknown>;
|
|
442
459
|
getPublicFile: _reduxjs_toolkit_query.QueryDefinition<Partial<_norbix_ai_ts_types_api.CodeMashApi2.GetPublicFileRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, Uint8Array<ArrayBufferLike>, string, unknown>;
|
|
460
|
+
testFilesIntegrationApi: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_api.CodeMashApi2.TestFilesIntegrationRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_api.CodeMashApi2.TestFilesIntegrationResponse, string, unknown>;
|
|
443
461
|
askChat: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_api.CodeMashApi2.AskChatRequest> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_api.CodeMashApi2.AskChatResponse, string, unknown>;
|
|
444
462
|
getApiKeys: _reduxjs_toolkit_query.QueryDefinition<Partial<_norbix_ai_ts_types_api.CodeMashApi2.GetApiKeys> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_api.CodeMashApi2.GetApiKeysResponse, string, unknown>;
|
|
445
463
|
regenerateApiKeys: _reduxjs_toolkit_query.MutationDefinition<Partial<_norbix_ai_ts_types_api.CodeMashApi2.RegenerateApiKeys> | undefined, _reduxjs_toolkit_query.BaseQueryFn<NorbixCall<unknown>, unknown, SerializedNorbixError>, AllTags, _norbix_ai_ts_types_api.CodeMashApi2.RegenerateApiKeysResponse, string, unknown>;
|
|
@@ -651,4 +669,4 @@ type IntegrationEndpointKeys<P extends string> = `get${P}Integrations` | `get${P
|
|
|
651
669
|
*/
|
|
652
670
|
declare function buildIntegrationsEndpoints<Prefix extends string, Tag extends AllTags>(b: Builder, opts: BuildIntegrationsOptions<Prefix, Tag>): Record<IntegrationEndpointKeys<Prefix>, unknown>;
|
|
653
671
|
|
|
654
|
-
export { type AllTags, type BuildIntegrationsOptions, type Builder, type GetNorbixClient, type IntegrationEndpointKeys, type NorbixApi, type NorbixCall, NorbixProvider, type NorbixProviderProps, type SerializedNorbixError, buildIntegrationsEndpoints, createNorbixApi, createNorbixBaseQuery, serializeNorbixError, useNorbix, useOptionalNorbix };
|
|
672
|
+
export { type AllTags, type BuildIntegrationsOptions, type Builder, type GetNorbixClient, type IntegrationEndpointKeys, type NorbixApi, type NorbixCall, NorbixProvider, type NorbixProviderProps, type SerializedNorbixError, type SerializedNorbixErrorItem, buildIntegrationsEndpoints, createNorbixApi, createNorbixBaseQuery, serializeNorbixError, useNorbix, useOptionalNorbix };
|
package/dist/index.js
CHANGED
|
@@ -8,18 +8,27 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
8
8
|
function serializeNorbixError(err) {
|
|
9
9
|
if (err && typeof err === "object") {
|
|
10
10
|
const e = err;
|
|
11
|
+
const status = typeof e.status === "number" ? e.status : typeof e.httpStatus === "number" ? e.httpStatus : 0;
|
|
12
|
+
const code = e.code ?? e.errorCode;
|
|
13
|
+
const list = Array.isArray(e.fieldErrors) ? e.fieldErrors : Array.isArray(e.errors) ? e.errors : [];
|
|
11
14
|
return {
|
|
12
|
-
status
|
|
13
|
-
|
|
15
|
+
status,
|
|
16
|
+
httpStatus: status,
|
|
17
|
+
code,
|
|
18
|
+
errorCode: code,
|
|
14
19
|
message: e.message ?? "Unknown Norbix error",
|
|
15
|
-
fieldErrors:
|
|
20
|
+
fieldErrors: list,
|
|
21
|
+
errors: list,
|
|
16
22
|
url: e.url
|
|
17
23
|
};
|
|
18
24
|
}
|
|
25
|
+
const message = typeof err === "string" ? err : "Unknown Norbix error";
|
|
19
26
|
return {
|
|
20
27
|
status: 0,
|
|
21
|
-
|
|
22
|
-
|
|
28
|
+
httpStatus: 0,
|
|
29
|
+
message,
|
|
30
|
+
fieldErrors: [],
|
|
31
|
+
errors: []
|
|
23
32
|
};
|
|
24
33
|
}
|
|
25
34
|
|
|
@@ -36,9 +45,12 @@ function createNorbixBaseQuery(getClient) {
|
|
|
36
45
|
return {
|
|
37
46
|
error: {
|
|
38
47
|
status: 0,
|
|
48
|
+
httpStatus: 0,
|
|
39
49
|
code: "NORBIX_NO_CLIENT",
|
|
50
|
+
errorCode: "NORBIX_NO_CLIENT",
|
|
40
51
|
message: "No Norbix client available. Did you forget <NorbixProvider>?",
|
|
41
|
-
fieldErrors: []
|
|
52
|
+
fieldErrors: [],
|
|
53
|
+
errors: []
|
|
42
54
|
}
|
|
43
55
|
};
|
|
44
56
|
}
|
|
@@ -274,6 +286,36 @@ var apiFiles = (b) => ({
|
|
|
274
286
|
providesTags: (_res, _err, arg) => [
|
|
275
287
|
{ type: "Files", id: `PUBLIC:${arg?.publicId ?? "unknown"}` }
|
|
276
288
|
]
|
|
289
|
+
}),
|
|
290
|
+
/**
|
|
291
|
+
* Runs a live probe against a files integration with the caller's own API
|
|
292
|
+
* key or session: uploads a small file, reads it, lists the folder and
|
|
293
|
+
* deletes the file again. Answers one item per step (`UploadFile`,
|
|
294
|
+
* `GetFile`, `GetAllFiles`, `DeleteFile`) with `result` `OK`, `FAILED` or
|
|
295
|
+
* `NOT_TESTED`, plus the step's `errors`. Needs the `files:create`
|
|
296
|
+
* permission, because the probe writes to the storage.
|
|
297
|
+
*
|
|
298
|
+
* Wraps `api.files.testFilesIntegration`
|
|
299
|
+
* (`POST /{version}/files/{filesIntegrationId}/test`). This is NOT the
|
|
300
|
+
* dashboard endpoint `hub.files.testFilesIntegration`
|
|
301
|
+
* (`POST /{version}/files/integrations/test`), whose hook is
|
|
302
|
+
* `useTestFilesIntegrationMutation`. Both live in one flat endpoint map,
|
|
303
|
+
* so this one carries the `Api` suffix — the same way `deleteFileApi` and
|
|
304
|
+
* `downloadFileApi` do — otherwise the Hub one, spread later, would
|
|
305
|
+
* silently replace it. Hook: `useTestFilesIntegrationApiMutation`.
|
|
306
|
+
*
|
|
307
|
+
* A mutation, like every other write in this file, so its answer is never
|
|
308
|
+
* served from cache. It invalidates:
|
|
309
|
+
* - `Files`, like its write neighbours: the probe uploads and deletes a
|
|
310
|
+
* real file in the storage `listFiles` reads, and if the delete step
|
|
311
|
+
* fails the probe file stays behind;
|
|
312
|
+
* - `FilesIntegrations`: the gateway records the outcome on the
|
|
313
|
+
* integration (last test time, success, errors), which
|
|
314
|
+
* `getFilesIntegration(s)` return.
|
|
315
|
+
*/
|
|
316
|
+
testFilesIntegrationApi: b.mutation({
|
|
317
|
+
query: (args) => (norbix) => norbix.api.files.testFilesIntegration(args),
|
|
318
|
+
invalidatesTags: ["Files", "FilesIntegrations"]
|
|
277
319
|
})
|
|
278
320
|
});
|
|
279
321
|
|