@bcrumbs.net/bc-api 0.0.46 → 0.0.48
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/index.cjs.d.ts +1 -1
- package/index.cjs.js +5815 -5349
- package/index.esm.d.ts +1 -1
- package/index.esm.js +5807 -5351
- package/package.json +1 -1
- package/src/index.d.ts +10 -8
- package/src/lib/clients/authRestClient.d.ts +2 -0
- package/src/lib/clients/dconfigContext.d.ts +6 -0
- package/src/lib/clients/utils.d.ts +24 -0
- package/src/lib/config/index.d.ts +3 -0
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
export * from './lib/clients/dconfigContext';
|
|
2
|
+
export * from './lib/clients/utils';
|
|
3
|
+
export * from './lib/clients/dconfigClient';
|
|
4
|
+
export * from './lib/clients/dqueryClient';
|
|
5
|
+
export * from './lib/clients/showcaseClient';
|
|
6
|
+
export * from './lib/clients/coreClient';
|
|
7
|
+
export * from './lib/clients/botClient';
|
|
8
|
+
export * from './lib/clients/authClient';
|
|
9
|
+
export * from './lib/clients/authRestClient';
|
|
10
|
+
export * from './lib/clients/billingClient';
|
|
1
11
|
export * from './lib/endpoints/rest/models';
|
|
2
12
|
export * from './lib/endpoints/graphql/config';
|
|
3
13
|
export * from './lib/endpoints/graphql/showcase';
|
|
@@ -8,13 +18,6 @@ export * from './lib/endpoints/rest/billing';
|
|
|
8
18
|
export * from './lib/endpoints/rest/contents';
|
|
9
19
|
export * from './lib/endpoints/rest/showcase';
|
|
10
20
|
export * from './lib/endpoints/rest/files';
|
|
11
|
-
export * from './lib/clients/dconfigClient';
|
|
12
|
-
export * from './lib/clients/dqueryClient';
|
|
13
|
-
export * from './lib/clients/showcaseClient';
|
|
14
|
-
export * from './lib/clients/coreClient';
|
|
15
|
-
export * from './lib/clients/botClient';
|
|
16
|
-
export * from './lib/clients/authClient';
|
|
17
|
-
export * from './lib/clients/billingClient';
|
|
18
21
|
export * from './lib/models/contentInstance';
|
|
19
22
|
export * from './lib/models/model';
|
|
20
23
|
export * from './lib/models/file';
|
|
@@ -24,4 +27,3 @@ export * from './lib/models/usage';
|
|
|
24
27
|
export * from './lib/models/config';
|
|
25
28
|
export * from './lib/models/form';
|
|
26
29
|
export * from './lib/config';
|
|
27
|
-
export * from './lib/clients/utils';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Apollo operation context key for an explicit DConfig ContextId (bypasses localStorage). */
|
|
2
|
+
export declare const DCONFIG_CONTEXT_ID_KEY = "contextId";
|
|
3
|
+
/**
|
|
4
|
+
* Resolves ContextId for dconfigClient: per-request override, then localStorage, then default.
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolveDconfigContextId(operationContext: Record<string, unknown> | undefined, storedContext: string | null | undefined): string | number;
|
|
@@ -1,8 +1,32 @@
|
|
|
1
1
|
import { ContextSetter } from '@apollo/client/link/context';
|
|
2
2
|
import { ErrorLink } from '@apollo/client/link/error';
|
|
3
|
+
export type AuthRestErrorResponse = {
|
|
4
|
+
result: string;
|
|
5
|
+
message: string;
|
|
6
|
+
};
|
|
7
|
+
/** Extract a user-facing message from Apollo / GraphQL failures (including HTTP 4xx bodies). */
|
|
8
|
+
export declare function getApolloErrorMessage(error: unknown): string;
|
|
9
|
+
/** Auth REST mutations return `{ result, message }` on 4xx; Apollo surfaces them as network errors. */
|
|
10
|
+
export declare function getAuthRestResponseFromApolloError(error: unknown): AuthRestErrorResponse | null;
|
|
11
|
+
/**
|
|
12
|
+
* GraphQL clients treat non-2xx HTTP responses as network errors and hide `errors[]` messages.
|
|
13
|
+
* Normalize 4xx responses to 200 so Apollo surfaces GraphQL error details to callers.
|
|
14
|
+
*/
|
|
15
|
+
export declare function normalizeGraphqlClientErrorFetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
16
|
+
/** Shared HttpLink / BatchHttpLink options for GraphQL clients. */
|
|
17
|
+
export declare const graphqlHttpLinkOptions: {
|
|
18
|
+
fetch: typeof normalizeGraphqlClientErrorFetch;
|
|
19
|
+
fetchOptions: {
|
|
20
|
+
mode: RequestMode;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
3
23
|
export declare const setErrorHandler: (handler: ErrorLink.ErrorHandler) => void;
|
|
4
24
|
export declare const getErrorHandler: () => ErrorLink.ErrorHandler;
|
|
5
25
|
export declare const handleHandler: ErrorLink.ErrorHandler;
|
|
26
|
+
/** Canonical prefix for workspace API keys. */
|
|
27
|
+
export declare const API_KEY_PREFIX = "bcak_";
|
|
28
|
+
export declare function isApiKeyToken(token: string | null | undefined): boolean;
|
|
29
|
+
export declare function formatAuthorizationHeader(token: string): string;
|
|
6
30
|
export declare const handleAuth: ContextSetter;
|
|
7
31
|
export declare function getUserToken(): Promise<string | undefined | null>;
|
|
8
32
|
export declare function getUserContext(): Promise<unknown>;
|