@conduit-client/service-bindings-imperative 2.1.0 → 3.2.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/dist/types/v1/index.d.ts +7 -7
- package/dist/types/v1/invokers/default-invoker.d.ts +3 -5
- package/dist/types/v1/invokers/graphql-invoker.d.ts +8 -9
- package/dist/types/v1/invokers/graphql-legacy-invoker.d.ts +3 -6
- package/dist/types/v1/invokers/graphql-mutation-invoker.d.ts +3 -5
- package/dist/types/v1/invokers/legacy-invoker.d.ts +3 -6
- package/dist/types/v1/invokers/query-invoker.d.ts +3 -5
- package/dist/types/v1/invokers/subscribable-invoker.d.ts +10 -10
- package/dist/v1/index.js +4 -1
- package/dist/v1/index.js.map +1 -1
- package/package.json +7 -7
package/dist/types/v1/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { buildServiceDescriptor as buildDefaultImperativeBindingsServiceDescriptor } from './invokers/default-invoker';
|
|
2
|
-
export { buildServiceDescriptor as buildQueryImperativeBindingsServiceDescriptor } from './invokers/query-invoker';
|
|
3
|
-
export { buildServiceDescriptor as buildSubscribableImperativeBindingsServiceDescriptor } from './invokers/subscribable-invoker';
|
|
4
|
-
export { buildServiceDescriptor as buildLegacyImperativeBindingsServiceDescriptor } from './invokers/legacy-invoker';
|
|
5
|
-
export { buildServiceDescriptor as buildGraphQLImperativeBindingsServiceDescriptor } from './invokers/graphql-invoker';
|
|
6
|
-
export { buildServiceDescriptor as buildGraphQLLegacyImperativeBindingsServiceDescriptor } from './invokers/graphql-legacy-invoker';
|
|
7
|
-
export { buildServiceDescriptor as buildGraphQLMutationBindingsServiceDescriptor } from './invokers/graphql-mutation-invoker';
|
|
1
|
+
export { type DefaultImperativeBindingsServiceDescriptor, type NamedDefaultImperativeBindingsService, type DefaultImperativeResult, buildServiceDescriptor as buildDefaultImperativeBindingsServiceDescriptor, } from './invokers/default-invoker';
|
|
2
|
+
export { type QueryImperativeBindingsServiceDescriptor, type NamedQueryImperativeBindingsService, type QueryImperativeResult, buildServiceDescriptor as buildQueryImperativeBindingsServiceDescriptor, } from './invokers/query-invoker';
|
|
3
|
+
export { type SubscribableImperativeBindingsServiceDescriptor, type NamedSubscribableImperativeBindingsService, type SubscribableImperativeResult, type SubscribableRefreshableImperativeResult, buildServiceDescriptor as buildSubscribableImperativeBindingsServiceDescriptor, } from './invokers/subscribable-invoker';
|
|
4
|
+
export { type LegacyImperativeBindingsServiceDescriptor, type NamedLegacyImperativeBindingsService, type LegacyImperativeShape, buildServiceDescriptor as buildLegacyImperativeBindingsServiceDescriptor, } from './invokers/legacy-invoker';
|
|
5
|
+
export { type GraphQLImperativeBindingsServiceDescriptor, type NamedGraphQLImperativeBindingsService, type SubscribableRefreshableGraphQLImperativeResult, buildServiceDescriptor as buildGraphQLImperativeBindingsServiceDescriptor, } from './invokers/graphql-invoker';
|
|
6
|
+
export { type GraphQLLegacyImperativeBindingsServiceDescriptor, type NamedGraphQLLegacyImperativeBindingsService, type LegacyGraphQLImperativeShape, buildServiceDescriptor as buildGraphQLLegacyImperativeBindingsServiceDescriptor, } from './invokers/graphql-legacy-invoker';
|
|
7
|
+
export { type GraphQLMutationBindingsServiceDescriptor, type NamedGraphQLMutationBindingsService, type GraphQLMutationResult, buildServiceDescriptor as buildGraphQLMutationBindingsServiceDescriptor, } from './invokers/graphql-mutation-invoker';
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
+
import { ServiceDescriptor, NamedService } from '@conduit-client/utils';
|
|
1
2
|
import { ImperativeCommand, GetCommand } from '../utils';
|
|
2
3
|
export type DefaultImperativeResult<Data> = PromiseLike<Data>;
|
|
3
4
|
export declare class DefaultImperativeBindingsService {
|
|
4
5
|
bind<Params extends Array<any>, Data>(getCommand: GetCommand<Params, ImperativeCommand<Data>>): (...params: Params) => DefaultImperativeResult<Data>;
|
|
5
6
|
}
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
version: string;
|
|
9
|
-
service: DefaultImperativeBindingsService;
|
|
10
|
-
}
|
|
7
|
+
export type DefaultImperativeBindingsServiceDescriptor = ServiceDescriptor<DefaultImperativeBindingsService, 'defaultImperativeBindings', '1.0'>;
|
|
8
|
+
export type NamedDefaultImperativeBindingsService<Name extends string = 'defaultImperativeBindings'> = NamedService<Name, DefaultImperativeBindingsService>;
|
|
11
9
|
export declare function buildServiceDescriptor(): DefaultImperativeBindingsServiceDescriptor;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { type Callback, type SubscribableResult } from '@conduit-client/utils';
|
|
1
|
+
import { type Callback, type SubscribableResult, ServiceDescriptor, NamedService } from '@conduit-client/utils';
|
|
2
2
|
import { type GraphQLCommandError, type GraphQLResponse, type GraphQLCommand } from '@conduit-client/graphql-normalization/v1';
|
|
3
3
|
import { GetCommand } from '../utils';
|
|
4
|
-
|
|
4
|
+
type SubscribableRefreshableGraphQLResult = GraphQLResponse & {
|
|
5
5
|
subscribe?: (cb: Callback<any>) => void;
|
|
6
6
|
refresh?: () => PromiseLike<void>;
|
|
7
7
|
};
|
|
8
|
+
export type SubscribableRefreshableGraphQLImperativeResult = PromiseLike<SubscribableRefreshableGraphQLResult>;
|
|
8
9
|
export declare class GraphQLImperativeBindingsService {
|
|
9
|
-
bind<Params extends Array<any>>(getCommand: GetCommand<Params, GraphQLCommand>, exposeRefresh?: boolean): (...params: Params) =>
|
|
10
|
-
transformResult<Data extends GraphQLResponse<Record<string, any>>>(result: SubscribableResult<Data, GraphQLCommandError>, exposeRefresh?: boolean):
|
|
11
|
-
}
|
|
12
|
-
export interface GraphQLImperativeBindingsServiceDescriptor {
|
|
13
|
-
type: 'graphQLImperativeBindings';
|
|
14
|
-
version: string;
|
|
15
|
-
service: GraphQLImperativeBindingsService;
|
|
10
|
+
bind<Params extends Array<any>>(getCommand: GetCommand<Params, GraphQLCommand>, exposeRefresh?: boolean): (...params: Params) => SubscribableRefreshableGraphQLImperativeResult;
|
|
11
|
+
transformResult<Data extends GraphQLResponse<Record<string, any>>>(result: SubscribableResult<Data, GraphQLCommandError>, exposeRefresh?: boolean): SubscribableRefreshableGraphQLResult;
|
|
16
12
|
}
|
|
13
|
+
export type GraphQLImperativeBindingsServiceDescriptor = ServiceDescriptor<GraphQLImperativeBindingsService, 'graphQLImperativeBindings', '1.0'>;
|
|
14
|
+
export type NamedGraphQLImperativeBindingsService<Name extends string = 'graphQLImperativeBindings'> = NamedService<Name, GraphQLImperativeBindingsService>;
|
|
17
15
|
export declare function buildServiceDescriptor(): GraphQLImperativeBindingsServiceDescriptor;
|
|
16
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Unsubscribe } from '@conduit-client/utils';
|
|
1
|
+
import { Unsubscribe, ServiceDescriptor, NamedService } from '@conduit-client/utils';
|
|
2
2
|
import { JSONSchema } from '@conduit-client/jsonschema-validate';
|
|
3
3
|
import { type GraphQLResponse, type GraphQLCommand } from '@conduit-client/graphql-normalization/v1';
|
|
4
4
|
import type { Command } from '@conduit-client/command-base/v1';
|
|
@@ -16,10 +16,7 @@ export type GetGraphQLLegacyCommand<Config> = (options: {
|
|
|
16
16
|
export declare class GraphQLLegacyImperativeBindingsService {
|
|
17
17
|
bind<Config>(getCommand: GetGraphQLLegacyCommand<Config>): LegacyGraphQLImperativeShape<Config>;
|
|
18
18
|
}
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
version: string;
|
|
22
|
-
service: GraphQLLegacyImperativeBindingsService;
|
|
23
|
-
}
|
|
19
|
+
export type GraphQLLegacyImperativeBindingsServiceDescriptor = ServiceDescriptor<GraphQLLegacyImperativeBindingsService, 'graphQLLegacyImperativeBindings', '1.0'>;
|
|
20
|
+
export type NamedGraphQLLegacyImperativeBindingsService<Name extends string = 'graphQLLegacyImperativeBindings'> = NamedService<Name, GraphQLLegacyImperativeBindingsService>;
|
|
24
21
|
export declare function buildServiceDescriptor(): GraphQLLegacyImperativeBindingsServiceDescriptor;
|
|
25
22
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NamedService, ServiceDescriptor } from '@conduit-client/utils';
|
|
1
2
|
import { JSONSchema } from '@conduit-client/jsonschema-validate';
|
|
2
3
|
import { type GraphQLResponse, type GraphQLCommand } from '@conduit-client/graphql-normalization/v1';
|
|
3
4
|
import type { Command } from '@conduit-client/command-base/v1';
|
|
@@ -10,10 +11,7 @@ type GetGraphQLCommand<Params> = (options: {
|
|
|
10
11
|
export declare class GraphQLMutationBindingsService {
|
|
11
12
|
bind<Params extends Array<any>>(getCommand: GetGraphQLCommand<Params>): (...params: Params) => GraphQLMutationResult;
|
|
12
13
|
}
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
version: string;
|
|
16
|
-
service: GraphQLMutationBindingsService;
|
|
17
|
-
}
|
|
14
|
+
export type GraphQLMutationBindingsServiceDescriptor = ServiceDescriptor<GraphQLMutationBindingsService, 'graphQLMutationBindings', '1.0'>;
|
|
15
|
+
export type NamedGraphQLMutationBindingsService<Name extends string = 'graphQLMutationBindings'> = NamedService<Name, GraphQLMutationBindingsService>;
|
|
18
16
|
export declare function buildServiceDescriptor(): GraphQLMutationBindingsServiceDescriptor;
|
|
19
17
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Unsubscribe } from '@conduit-client/utils';
|
|
1
|
+
import { Unsubscribe, ServiceDescriptor, NamedService } from '@conduit-client/utils';
|
|
2
2
|
import { JSONSchema } from '@conduit-client/jsonschema-validate';
|
|
3
3
|
import { LegacyExecuteOverrides } from '../utils';
|
|
4
4
|
import { SubscribableResultCommand } from '@conduit-client/bindings-utils/v1';
|
|
@@ -22,10 +22,7 @@ export type GetLegacyCommand<Config, Data> = (options: {
|
|
|
22
22
|
export declare class LegacyImperativeBindingsService {
|
|
23
23
|
bind<Config, Data>(getCommand: GetLegacyCommand<Config, Data>): LegacyImperativeShape<Config, Data>;
|
|
24
24
|
}
|
|
25
|
-
export
|
|
26
|
-
|
|
27
|
-
version: string;
|
|
28
|
-
service: LegacyImperativeBindingsService;
|
|
29
|
-
}
|
|
25
|
+
export type LegacyImperativeBindingsServiceDescriptor = ServiceDescriptor<LegacyImperativeBindingsService, 'legacyImperativeBindings', '1.0'>;
|
|
26
|
+
export type NamedLegacyImperativeBindingsService<Name extends string = 'legacyImperativeBindings'> = NamedService<Name, LegacyImperativeBindingsService>;
|
|
30
27
|
export declare function buildServiceDescriptor(): LegacyImperativeBindingsServiceDescriptor;
|
|
31
28
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NamedService, ServiceDescriptor } from '@conduit-client/utils';
|
|
1
2
|
import { GetCommand, ImperativeCommand } from '../utils';
|
|
2
3
|
type QueryResult<Data> = {
|
|
3
4
|
data: Data;
|
|
@@ -6,10 +7,7 @@ export type QueryImperativeResult<Data> = PromiseLike<QueryResult<Data>>;
|
|
|
6
7
|
export declare class QueryImperativeBindingsService {
|
|
7
8
|
bind<Params extends Array<any>, Data>(getCommand: GetCommand<Params, ImperativeCommand<Data>>): (...params: Params) => QueryImperativeResult<Data>;
|
|
8
9
|
}
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
version: string;
|
|
12
|
-
service: QueryImperativeBindingsService;
|
|
13
|
-
}
|
|
10
|
+
export type QueryImperativeBindingsServiceDescriptor = ServiceDescriptor<QueryImperativeBindingsService, 'queryImperativeBindings', '1.0'>;
|
|
11
|
+
export type NamedQueryImperativeBindingsService<Name extends string = 'queryImperativeBindings'> = NamedService<Name, QueryImperativeBindingsService>;
|
|
14
12
|
export declare function buildServiceDescriptor(): QueryImperativeBindingsServiceDescriptor;
|
|
15
13
|
export {};
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import { Callback } from '@conduit-client/utils';
|
|
1
|
+
import { Callback, NamedService, ServiceDescriptor } from '@conduit-client/utils';
|
|
2
2
|
import { type ResultOrSubscribableResult } from '@conduit-client/bindings-utils/v1';
|
|
3
3
|
import { GetCommand, ImperativeCommand } from '../utils';
|
|
4
|
-
|
|
4
|
+
type SubscribableResult<Data> = {
|
|
5
5
|
data: Data;
|
|
6
6
|
subscribe: (cb: Callback<any>) => void;
|
|
7
7
|
};
|
|
8
|
-
export type
|
|
8
|
+
export type SubscribableImperativeResult<Data> = PromiseLike<SubscribableResult<Data>>;
|
|
9
|
+
type SubscribableRefreshableResult<Data> = {
|
|
9
10
|
data: Data;
|
|
10
11
|
subscribe: (cb: Callback<any>) => void;
|
|
11
12
|
refresh: () => PromiseLike<void>;
|
|
12
13
|
};
|
|
13
|
-
export type
|
|
14
|
+
export type SubscribableRefreshableImperativeResult<Data> = PromiseLike<SubscribableRefreshableResult<Data>>;
|
|
15
|
+
type MaybeRefreshableSubscribableImperativeResult<Data> = SubscribableImperativeResult<Data> | SubscribableRefreshableImperativeResult<Data>;
|
|
14
16
|
export declare class SubscribableImperativeBindingsService {
|
|
15
|
-
bind<Params extends Array<any>, Data>(getCommand: GetCommand<Params, ImperativeCommand<Data>>, exposeRefresh?: boolean): (...params: Params) =>
|
|
17
|
+
bind<Params extends Array<any>, Data>(getCommand: GetCommand<Params, ImperativeCommand<Data>>, exposeRefresh?: boolean): (...params: Params) => MaybeRefreshableSubscribableImperativeResult<Data>;
|
|
16
18
|
transformResult<Data>(result: ResultOrSubscribableResult<Data>, exposeRefresh?: boolean): {
|
|
17
19
|
data: Data;
|
|
18
20
|
subscribe: (cb: Callback<any>) => void;
|
|
@@ -22,9 +24,7 @@ export declare class SubscribableImperativeBindingsService {
|
|
|
22
24
|
subscribe: (cb: Callback<any>) => void;
|
|
23
25
|
};
|
|
24
26
|
}
|
|
25
|
-
export
|
|
26
|
-
|
|
27
|
-
version: string;
|
|
28
|
-
service: SubscribableImperativeBindingsService;
|
|
29
|
-
}
|
|
27
|
+
export type SubscribableImperativeBindingsServiceDescriptor = ServiceDescriptor<SubscribableImperativeBindingsService, 'subscribableImperativeBindings', '1.0'>;
|
|
28
|
+
export type NamedSubscribableImperativeBindingsService<Name extends string = 'subscribableImperativeBindings'> = NamedService<Name, SubscribableImperativeBindingsService>;
|
|
30
29
|
export declare function buildServiceDescriptor(): SubscribableImperativeBindingsServiceDescriptor;
|
|
30
|
+
export {};
|
package/dist/v1/index.js
CHANGED
|
@@ -94,7 +94,10 @@ function buildServiceDescriptor$5() {
|
|
|
94
94
|
}
|
|
95
95
|
class SubscribableImperativeBindingsService {
|
|
96
96
|
bind(getCommand, exposeRefresh = false) {
|
|
97
|
-
return buildBaseImperativeInvoker(
|
|
97
|
+
return buildBaseImperativeInvoker(
|
|
98
|
+
getCommand,
|
|
99
|
+
(result) => this.transformResult(result, exposeRefresh)
|
|
100
|
+
);
|
|
98
101
|
}
|
|
99
102
|
transformResult(result, exposeRefresh = false) {
|
|
100
103
|
if (!isSubscribableResult(result)) {
|
package/dist/v1/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/v1/utils.ts","../../src/v1/invokers/default-invoker.ts","../../src/v1/invokers/query-invoker.ts","../../src/v1/invokers/subscribable-invoker.ts","../../src/v1/invokers/legacy-invoker.ts","../../src/v1/invokers/graphql-invoker.ts","../../src/v1/invokers/graphql-legacy-invoker.ts","../../src/v1/invokers/graphql-mutation-invoker.ts"],"sourcesContent":["import { assertIsValid, type JSONSchema } from '@conduit-client/jsonschema-validate';\nimport {\n SubscribableResultCommand,\n ResultCommand,\n MaybeSubscribableResultCommand,\n ResultOrSubscribableResult,\n throwUserlandError,\n} from '@conduit-client/bindings-utils/v1';\nimport type {\n GraphQLCommandError,\n GraphQLResponse,\n} from '@conduit-client/graphql-normalization/v1';\nimport { Result, isUserVisibleError, logError } from '@conduit-client/utils';\n\nexport type ImperativeCommand<Data> =\n | SubscribableResultCommand<Data>\n | ResultCommand<Data>\n | MaybeSubscribableResultCommand<Data>;\n\nexport type GetCommand<Params extends Array<any>, CommandType> = (options: {\n params: Params;\n // utility to validate data against a JSONSchema\n assertIsValid: <T>(data: unknown, schema: JSONSchema) => asserts data is T;\n}) => CommandType;\n\nexport function buildBaseImperativeInvoker<\n Params extends Array<any>,\n Data,\n InvokerResult = Data,\n CommandType extends ImperativeCommand<Data> = ImperativeCommand<Data>,\n CommandResult extends ResultOrSubscribableResult<Data> = ResultOrSubscribableResult<Data>,\n>(\n getCommand: GetCommand<Params, CommandType>,\n transformResult: (result: CommandResult) => InvokerResult\n): (...params: Params) => PromiseLike<InvokerResult> {\n return async (...params: Params) => {\n const command = getCommand({ params, assertIsValid });\n try {\n return command.execute().then((result) => transformResult(result as CommandResult));\n } catch (error) {\n throwUserlandError(error);\n }\n };\n}\n\nexport const supportedCachePolicyTypes = ['no-cache', 'only-if-cached'] as const;\nexport type SupportedCachePolicyType = (typeof supportedCachePolicyTypes)[number];\n\nexport type CachePolicy = {\n cachePolicy: {\n type: SupportedCachePolicyType;\n };\n};\n\n/**\n * Type guard for legacy requestContext objects used with imperative-legacy bindings.\n *\n * When this function returns true, it indicates the caller requested a supported\n * cache policy override. Currently the only supported policy is `no-cache`.\n *\n * This helper is intentionally low-level; prefer using\n * {@link getOverridesForLegacyRequestContext} at call sites to construct the\n * proper `execute` overrides for Commands.\n */\nexport function requestContextIsSupportedCachePolicy(\n requestContext: unknown\n): requestContext is CachePolicy {\n return (\n typeof requestContext === 'object' &&\n requestContext !== null &&\n 'cachePolicy' in requestContext &&\n typeof requestContext.cachePolicy === 'object' &&\n requestContext.cachePolicy !== null &&\n 'type' in requestContext.cachePolicy &&\n typeof requestContext.cachePolicy.type === 'string' &&\n supportedCachePolicyTypes.includes(\n requestContext.cachePolicy.type as SupportedCachePolicyType\n )\n );\n}\n\nexport type LegacyExecuteOverrides = {\n cacheControlConfig?: { type: SupportedCachePolicyType };\n};\n\n/**\n * Builds the `execute` overrides for legacy imperative invokers based on the\n * provided requestContext. Encapsulates all hard-coded knowledge of supported\n * cache policies for legacy adapters.\n *\n * - If {@link requestContextIsSupportedCachePolicy} matches `no-cache`, returns\n * `{ cacheControlConfig: { type: 'no-cache' } }`.\n * - Otherwise returns `{}`.\n *\n * Use this in `buildAsyncImperativeLegacyInvoker` and GraphQL legacy invokers\n * to centralize override behavior.\n */\nexport function getOverridesForLegacyRequestContext(\n requestContext: unknown\n): LegacyExecuteOverrides {\n if (requestContextIsSupportedCachePolicy(requestContext)) {\n return { cacheControlConfig: { type: requestContext.cachePolicy.type } };\n }\n return {};\n}\n\nexport function handleEmit(\n res: Result<GraphQLResponse<Record<string, any>>, GraphQLCommandError>,\n callback: (result: GraphQLResponse) => void\n) {\n const consumerEmittedData = {\n data: undefined,\n errors: undefined,\n } as {\n data: GraphQLResponse | undefined;\n errors: any | undefined;\n };\n if (res.isOk()) {\n consumerEmittedData.data = res.value.data;\n } else {\n const { data, errors } = toGraphQLResponseFromFailure(res.error);\n consumerEmittedData.data = data;\n consumerEmittedData.errors = errors;\n }\n callback(consumerEmittedData);\n}\n\n/**\n * Maps a command failure (unknown or user-visible) into a GraphQLResponse suitable for consumers.\n */\nexport function toGraphQLResponseFromFailure(failure: unknown): {\n data: GraphQLResponse['data'];\n errors: GraphQLResponse['errors'];\n} {\n if (isUserVisibleError<GraphQLResponse>(failure)) {\n return {\n data: failure.data.data,\n errors: failure.data.errors,\n };\n }\n logError(failure);\n return {\n data: undefined,\n errors: [{ message: 'Internal error in GraphQL adapter occurred', locations: [] }],\n };\n}\n","import { isSubscribableResult, deepFreeze, toError } from '@conduit-client/utils';\nimport { buildBaseImperativeInvoker, ImperativeCommand, GetCommand } from '../utils';\n\nexport type DefaultImperativeResult<Data> = PromiseLike<Data>;\nexport class DefaultImperativeBindingsService {\n bind<Params extends Array<any>, Data>(\n getCommand: GetCommand<Params, ImperativeCommand<Data>>\n ): (...params: Params) => DefaultImperativeResult<Data> {\n return buildBaseImperativeInvoker<Params, Data>(getCommand, (result) => {\n if (result.isOk()) {\n deepFreeze(result.value);\n // For subscribable results processed by this invoker, only return data\n return isSubscribableResult(result) ? result.value.data : result.value;\n }\n\n throw toError(isSubscribableResult(result) ? result.error.failure : result.error);\n });\n }\n}\nexport interface DefaultImperativeBindingsServiceDescriptor {\n type: 'defaultImperativeBindings';\n version: string;\n service: DefaultImperativeBindingsService;\n}\n\nexport function buildServiceDescriptor(): DefaultImperativeBindingsServiceDescriptor {\n return {\n type: 'defaultImperativeBindings',\n version: '1.0',\n service: new DefaultImperativeBindingsService(),\n };\n}\n","import { deepFreeze, isSubscribableResult, toError } from '@conduit-client/utils';\nimport { buildBaseImperativeInvoker, GetCommand, ImperativeCommand } from '../utils';\n\ntype QueryResult<Data> = { data: Data };\nexport type QueryImperativeResult<Data> = PromiseLike<QueryResult<Data>>;\n\nexport class QueryImperativeBindingsService {\n bind<Params extends Array<any>, Data>(\n getCommand: GetCommand<Params, ImperativeCommand<Data>>\n ): (...params: Params) => QueryImperativeResult<Data> {\n return buildBaseImperativeInvoker<Params, Data, QueryResult<Data>>(getCommand, (result) => {\n if (result.isOk()) {\n deepFreeze(result.value);\n return isSubscribableResult(result)\n ? { data: result.value.data }\n : { data: result.value };\n }\n\n throw toError(isSubscribableResult(result) ? result.error.failure : result.error);\n });\n }\n}\n\nexport interface QueryImperativeBindingsServiceDescriptor {\n type: 'queryImperativeBindings';\n version: string;\n service: QueryImperativeBindingsService;\n}\n\nexport function buildServiceDescriptor(): QueryImperativeBindingsServiceDescriptor {\n return {\n type: 'queryImperativeBindings',\n version: '1.0',\n service: new QueryImperativeBindingsService(),\n };\n}\n","import { Callback, deepFreeze, isSubscribableResult, toError } from '@conduit-client/utils';\nimport { type ResultOrSubscribableResult } from '@conduit-client/bindings-utils/v1';\nimport { buildBaseImperativeInvoker, GetCommand, ImperativeCommand } from '../utils';\n\nexport type SubscribableImperativeResult<Data> = {\n data: Data;\n subscribe: (cb: Callback<any>) => void;\n};\n\nexport type SubscribableRefreshableImperativeResult<Data> = {\n data: Data;\n subscribe: (cb: Callback<any>) => void;\n refresh: () => PromiseLike<void>;\n};\n\nexport type MaybeRefreshableSubscribableImperativeResult<Data> =\n | SubscribableImperativeResult<Data>\n | SubscribableRefreshableImperativeResult<Data>;\n\nexport class SubscribableImperativeBindingsService {\n bind<Params extends Array<any>, Data>(\n getCommand: GetCommand<Params, ImperativeCommand<Data>>,\n exposeRefresh = false\n ): (...params: Params) => PromiseLike<MaybeRefreshableSubscribableImperativeResult<Data>> {\n return buildBaseImperativeInvoker<\n Params,\n Data,\n MaybeRefreshableSubscribableImperativeResult<Data>\n >(getCommand, (result) => this.transformResult(result, exposeRefresh));\n }\n\n transformResult<Data>(result: ResultOrSubscribableResult<Data>, exposeRefresh = false) {\n if (!isSubscribableResult(result)) {\n console.error(\n 'Non-subscribable result encountered - please use correct operation type'\n );\n throw new Error('Internal error in Lightning Data Service adapter occurred');\n }\n if (result.isOk()) {\n deepFreeze(result.value.data);\n\n const api = {\n data: result.value.data,\n subscribe: (cb: Callback<any>) => {\n result.value.subscribe((result) => {\n if (result.isErr()) {\n return cb({ data: undefined, error: toError(result.error) });\n }\n\n return cb({ data: result.value, error: undefined });\n });\n },\n };\n\n if (exposeRefresh) {\n return {\n ...api,\n refresh: () => {\n return result.value.refresh().then((res) => {\n if (res.isOk()) {\n return undefined;\n }\n throw res.error;\n });\n },\n };\n } else {\n return api;\n }\n } else {\n throw toError(result.error.failure);\n }\n }\n}\n\nexport interface SubscribableImperativeBindingsServiceDescriptor {\n type: 'subscribableImperativeBindings';\n version: string;\n service: SubscribableImperativeBindingsService;\n}\n\nexport function buildServiceDescriptor(): SubscribableImperativeBindingsServiceDescriptor {\n return {\n type: 'subscribableImperativeBindings',\n version: '1.0',\n service: new SubscribableImperativeBindingsService(),\n };\n}\n","import { Result, deepFreeze, toError, Unsubscribe } from '@conduit-client/utils';\nimport { JSONSchema, assertIsValid } from '@conduit-client/jsonschema-validate';\nimport { LegacyExecuteOverrides, getOverridesForLegacyRequestContext } from '../utils';\nimport { emitError, SubscribableResultCommand } from '@conduit-client/bindings-utils/v1';\n\ntype LegacyImperativeCallbackResult<Data> =\n | { data: Data; error: undefined }\n | { data: undefined; error: Error };\n\ntype LegacyImperativeAdapterInvokeType<Config, Data> = (\n config: Config,\n context: unknown,\n callback: (result: LegacyImperativeCallbackResult<Data>) => void\n) => void;\n\ntype LegacyImperativeAdapterSubscribeType<Config, Data> = (\n config: Config,\n context: unknown,\n callback: (result: LegacyImperativeCallbackResult<Data>) => void\n) => Unsubscribe;\n\nexport type LegacyImperativeShape<Config, Data> = {\n invoke: LegacyImperativeAdapterInvokeType<Config, Data>;\n subscribe: LegacyImperativeAdapterSubscribeType<Config, Data>;\n};\n\nexport type GetLegacyCommand<Config, Data> = (options: {\n config: Config;\n assertIsValid: <T>(data: unknown, schema: JSONSchema) => asserts data is T;\n}) => SubscribableResultCommand<Data, unknown, [LegacyExecuteOverrides?]>;\n\nexport class LegacyImperativeBindingsService {\n bind<Config, Data>(\n getCommand: GetLegacyCommand<Config, Data>\n ): LegacyImperativeShape<Config, Data> {\n const invoke: LegacyImperativeAdapterInvokeType<Config, Data> = async (\n config: Config,\n requestContext: unknown,\n callback: (result: LegacyImperativeCallbackResult<Data>) => void\n ) => {\n const command = getCommand({ config, assertIsValid });\n\n try {\n const overrides = getOverridesForLegacyRequestContext(requestContext);\n const result = await command.execute(overrides);\n if (result.isOk()) {\n deepFreeze(result.value);\n callback({ data: result.value.data, error: undefined });\n } else {\n callback({ data: undefined, error: toError(result.error.failure) });\n }\n } catch (error) {\n emitError(callback, error);\n }\n };\n\n const subscribe: LegacyImperativeAdapterSubscribeType<Config, Data> = (\n config: Config,\n requestContext: unknown,\n callback: (result: LegacyImperativeCallbackResult<Data>) => void\n ) => {\n const command = getCommand({ config, assertIsValid });\n\n let unsubscribe: Unsubscribe = () => {};\n\n try {\n const overrides = getOverridesForLegacyRequestContext(requestContext);\n command.execute(overrides).then(\n (result: Awaited<ReturnType<typeof command.execute>>) => {\n if (!result.isOk()) {\n callback({ data: undefined, error: toError(result.error.failure) });\n return;\n }\n\n unsubscribe = result.value.subscribe((res: Result<Data, unknown>) => {\n if (res.isOk()) {\n callback({ data: res.value, error: undefined });\n } else {\n callback({ data: undefined, error: toError(res.error) });\n }\n });\n\n callback({ data: result.value.data, error: undefined });\n },\n (e: unknown) => {\n emitError(callback, e);\n }\n );\n } catch (e) {\n emitError(callback, e);\n }\n\n return () => {\n unsubscribe();\n };\n };\n\n return { invoke, subscribe };\n }\n}\n\nexport interface LegacyImperativeBindingsServiceDescriptor {\n type: 'legacyImperativeBindings';\n version: string;\n service: LegacyImperativeBindingsService;\n}\n\nexport function buildServiceDescriptor(): LegacyImperativeBindingsServiceDescriptor {\n return {\n type: 'legacyImperativeBindings',\n version: '1.0',\n service: new LegacyImperativeBindingsService(),\n };\n}\n","import {\n deepFreeze,\n type Callback,\n type SubscribableResult,\n logError,\n isUserVisibleError,\n} from '@conduit-client/utils';\nimport {\n type GraphQLCommandError,\n type GraphQLResponse,\n type GraphQLCommand,\n} from '@conduit-client/graphql-normalization/v1';\nimport { wrapConfigAndVerify } from '@conduit-client/onestore-graphql-parser/v1';\nimport { buildBaseImperativeInvoker, GetCommand, toGraphQLResponseFromFailure } from '../utils';\n\nexport type SubscribableRefreshableGraphQLImperativeResult = GraphQLResponse & {\n subscribe?: (cb: Callback<any>) => void;\n refresh?: () => PromiseLike<void>;\n};\n\nexport class GraphQLImperativeBindingsService {\n bind<Params extends Array<any>>(\n getCommand: GetCommand<Params, GraphQLCommand>,\n exposeRefresh = false\n ): (...params: Params) => PromiseLike<SubscribableRefreshableGraphQLImperativeResult> {\n return async (...params: Params) => {\n try {\n if (params.length) {\n params[0] = wrapConfigAndVerify(params[0]);\n }\n return await buildBaseImperativeInvoker<\n Params,\n GraphQLResponse<Record<string, any>>,\n SubscribableRefreshableGraphQLImperativeResult,\n GraphQLCommand,\n SubscribableResult<GraphQLResponse<Record<string, any>>, GraphQLCommandError>\n >(getCommand, (result) => this.transformResult(result, exposeRefresh))(...params);\n } catch (error) {\n logError(error);\n return {\n data: undefined,\n errors: [\n { message: 'Internal error in GraphQL adapter occurred', locations: [] },\n ],\n };\n }\n };\n }\n\n transformResult<Data extends GraphQLResponse<Record<string, any>>>(\n result: SubscribableResult<Data, GraphQLCommandError>,\n exposeRefresh = false\n ): SubscribableRefreshableGraphQLImperativeResult {\n const consumerEmittedData = {\n data: undefined,\n errors: undefined,\n } as {\n data: GraphQLResponse | undefined;\n errors: any | undefined;\n subscribe: (cb: Callback<any>) => void;\n refresh: () => PromiseLike<void>;\n };\n\n if (result.isOk()) {\n deepFreeze(result.value);\n consumerEmittedData.data = result.value.data.data;\n consumerEmittedData.subscribe = (cb: Callback<any>) => {\n result.value.subscribe((res) => {\n const consumerEmittedData = {\n data: undefined,\n errors: undefined,\n } as {\n data: GraphQLResponse | undefined;\n errors: any | undefined;\n };\n if (res.isOk()) {\n consumerEmittedData.data = res.value.data;\n } else {\n if (isUserVisibleError<GraphQLResponse>(res.error)) {\n consumerEmittedData.data = res.error.data.data;\n consumerEmittedData.errors = res.error.data.errors;\n } else {\n logError(res.error);\n consumerEmittedData.errors = [\n {\n message: 'Internal error in GraphQL adapter occurred',\n locations: [],\n },\n ];\n }\n }\n cb(consumerEmittedData);\n });\n };\n if (exposeRefresh) {\n consumerEmittedData.refresh = () => {\n return new Promise((resolve, reject) => {\n try {\n result.value.refresh().then((res) => {\n if (res.isOk()) {\n resolve();\n } else {\n reject(\n new Error(\n 'Internal error in GraphQL adapter occurred: Failed to refresh GraphQL data'\n )\n );\n }\n });\n } catch (error) {\n logError(error);\n reject(\n new Error(\n 'Internal error in GraphQL adapter occurred: Failed to refresh GraphQL data'\n )\n );\n }\n });\n };\n }\n } else {\n const resp = toGraphQLResponseFromFailure(result.error.failure);\n consumerEmittedData.data = resp.data;\n consumerEmittedData.errors = resp.errors;\n }\n\n return consumerEmittedData;\n }\n}\n\nexport interface GraphQLImperativeBindingsServiceDescriptor {\n type: 'graphQLImperativeBindings';\n version: string;\n service: GraphQLImperativeBindingsService;\n}\n\nexport function buildServiceDescriptor(): GraphQLImperativeBindingsServiceDescriptor {\n return {\n type: 'graphQLImperativeBindings',\n version: '1.0',\n service: new GraphQLImperativeBindingsService(),\n };\n}\n","import { deepFreeze, Result, Unsubscribe, logError } from '@conduit-client/utils';\nimport { JSONSchema, assertIsValid } from '@conduit-client/jsonschema-validate';\nimport {\n type GraphQLCommandError,\n type GraphQLResponse,\n type GraphQLCommand,\n} from '@conduit-client/graphql-normalization/v1';\nimport { wrapConfigAndVerify } from '@conduit-client/onestore-graphql-parser/v1';\nimport type { Command } from '@conduit-client/command-base/v1';\nimport { getOverridesForLegacyRequestContext, handleEmit } from '../utils';\nimport { type LegacyExecuteOverrides, toGraphQLResponseFromFailure } from '../utils';\n\ntype LegacyGraphQLImperativeAdapterInvokeType<Config> = (\n config: Config,\n context: unknown,\n callback: (result: GraphQLResponse) => void\n) => void;\n\ntype LegacyGraphQLImperativeAdapterSubscribeType<Config> = (\n config: Config,\n context: unknown,\n callback: (result: GraphQLResponse) => void\n) => Unsubscribe;\n\nexport type LegacyGraphQLImperativeShape<Config> = {\n invoke: LegacyGraphQLImperativeAdapterInvokeType<Config>;\n subscribe: LegacyGraphQLImperativeAdapterSubscribeType<Config>;\n};\n\nexport type GetGraphQLLegacyCommand<Config> = (options: {\n config: Config;\n assertIsValid: <T>(data: unknown, schema: JSONSchema) => asserts data is T;\n}) => Command<ReturnType<GraphQLCommand['execute']>, [LegacyExecuteOverrides?]>;\n\nexport class GraphQLLegacyImperativeBindingsService {\n bind<Config>(\n getCommand: GetGraphQLLegacyCommand<Config>\n ): LegacyGraphQLImperativeShape<Config> {\n const invoke: LegacyGraphQLImperativeAdapterInvokeType<Config> = async (\n config: Config,\n requestContext: unknown,\n callback: (result: GraphQLResponse) => void\n ) => {\n config = wrapConfigAndVerify(config);\n const command = getCommand({ config, assertIsValid });\n\n try {\n const overrides = getOverridesForLegacyRequestContext(requestContext);\n const result: Awaited<ReturnType<typeof command.execute>> =\n await command.execute(overrides);\n\n const consumerEmittedData = {\n data: undefined,\n errors: undefined,\n } as {\n data: GraphQLResponse | undefined;\n errors: any | undefined;\n };\n\n if (result.isOk()) {\n deepFreeze(result.value);\n consumerEmittedData.data = result.value.data.data;\n } else {\n const { data, errors } = toGraphQLResponseFromFailure(result.error.failure);\n consumerEmittedData.data = data;\n consumerEmittedData.errors = errors;\n }\n\n callback(consumerEmittedData);\n } catch (error) {\n logError(error);\n callback({\n data: undefined,\n errors: [\n { message: 'Internal error in GraphQL adapter occurred', locations: [] },\n ],\n } satisfies GraphQLResponse);\n }\n };\n\n const subscribe: LegacyGraphQLImperativeAdapterSubscribeType<Config> = (\n config: Config,\n requestContext: unknown,\n callback: (result: GraphQLResponse) => void\n ) => {\n config = wrapConfigAndVerify(config);\n const command = getCommand({ config, assertIsValid });\n\n let unsubscribe: Unsubscribe = () => {};\n\n const overrides = getOverridesForLegacyRequestContext(requestContext);\n command\n .execute(overrides)\n .then((result: Awaited<ReturnType<typeof command.execute>>) => {\n const consumerEmittedData = {\n data: undefined,\n errors: undefined,\n } as {\n data: GraphQLResponse | undefined;\n errors: any | undefined;\n };\n\n if (result.isOk()) {\n deepFreeze(result.value);\n consumerEmittedData.data = result.value.data.data;\n unsubscribe = result.value.subscribe(\n (\n res: Result<\n GraphQLResponse<Record<string, any>>,\n GraphQLCommandError\n >\n ) => {\n handleEmit(res, callback);\n }\n );\n } else {\n const { data, errors } = toGraphQLResponseFromFailure(result.error.failure);\n consumerEmittedData.data = data;\n consumerEmittedData.errors = errors;\n unsubscribe = result.error.subscribe(\n (\n res: Result<\n GraphQLResponse<Record<string, any>>,\n GraphQLCommandError\n >\n ) => {\n handleEmit(res, callback);\n }\n );\n }\n\n callback(consumerEmittedData);\n });\n\n return () => {\n unsubscribe();\n };\n };\n\n return { invoke, subscribe };\n }\n}\n\nexport interface GraphQLLegacyImperativeBindingsServiceDescriptor {\n type: 'graphQLLegacyImperativeBindings';\n version: string;\n service: GraphQLLegacyImperativeBindingsService;\n}\n\nexport function buildServiceDescriptor(): GraphQLLegacyImperativeBindingsServiceDescriptor {\n return {\n type: 'graphQLLegacyImperativeBindings',\n version: '1.0',\n service: new GraphQLLegacyImperativeBindingsService(),\n };\n}\n","import { deepFreeze, logError } from '@conduit-client/utils';\nimport { JSONSchema, assertIsValid } from '@conduit-client/jsonschema-validate';\nimport {\n type GraphQLResponse,\n type GraphQLCommand,\n} from '@conduit-client/graphql-normalization/v1';\nimport { wrapConfigAndVerify } from '@conduit-client/onestore-graphql-parser/v1';\nimport type { Command } from '@conduit-client/command-base/v1';\nimport { type LegacyExecuteOverrides, toGraphQLResponseFromFailure } from '../utils';\n\nexport type GraphQLMutationResult = Promise<GraphQLResponse>;\ntype GetGraphQLCommand<Params> = (options: {\n params: Params;\n assertIsValid: <T>(data: unknown, schema: JSONSchema) => asserts data is T;\n}) => Command<ReturnType<GraphQLCommand['execute']>, [LegacyExecuteOverrides?]>;\n\nexport class GraphQLMutationBindingsService {\n bind<Params extends Array<any>>(\n getCommand: GetGraphQLCommand<Params>\n ): (...params: Params) => GraphQLMutationResult {\n return async (...params: Params) => {\n try {\n if (params.length) {\n params[0] = wrapConfigAndVerify(params[0], {\n acceptedOperations: ['mutation'],\n });\n }\n const command = getCommand({ params, assertIsValid });\n const result = await command.execute({ cacheControlConfig: { type: 'no-cache' } });\n\n if (result.isOk()) {\n deepFreeze(result.value);\n return result.value.data;\n } else {\n return toGraphQLResponseFromFailure(result.error.failure);\n }\n } catch (error) {\n logError(error);\n return {\n data: undefined,\n errors: [\n { message: 'Internal error in GraphQL adapter occurred', locations: [] },\n ],\n } satisfies GraphQLResponse;\n }\n };\n }\n}\n\nexport interface GraphQLMutationBindingsServiceDescriptor {\n type: 'graphQLMutationBindings';\n version: string;\n service: GraphQLMutationBindingsService;\n}\n\nexport function buildServiceDescriptor(): GraphQLMutationBindingsServiceDescriptor {\n return {\n type: 'graphQLMutationBindings',\n version: '1.0',\n service: new GraphQLMutationBindingsService(),\n };\n}\n"],"names":["buildServiceDescriptor","result","consumerEmittedData"],"mappings":";;;;;;;;;AAyBO,SAAS,2BAOZ,YACA,iBACiD;AACjD,SAAO,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AAA,YACvC,oBAAoB,CAAC,UAAU;AAAA,UAAA,CAClC;AAAA,QACL;AACA,cAAM,UAAU,WAAW,EAAE,QAAQ,eAAe;AACpD,cAAM,SAAS,MAAM,QAAQ,QAAQ,EAAE,oBAAoB,EAAE,MAAM,WAAA,GAAc;AAEjF,YAAI,OAAO,QAAQ;AACf,qBAAW,OAAO,KAAK;AACvB,iBAAO,OAAO,MAAM;AAAA,QACxB,OAAO;AACH,iBAAO,6BAA6B,OAAO,MAAM,OAAO;AAAA,QAC5D;AAAA,MACJ,SAAS,OAAO;AACZ,iBAAS,KAAK;AACd,eAAO;AAAA,UACH,MAAM;AAAA,UACN,QAAQ;AAAA,YACJ,EAAE,SAAS,8CAA8C,WAAW,CAAA,EAAC;AAAA,UAAE;AAAA,QAC3E;AAAA,MAER;AAAA,IACJ;AAAA,EACJ;AACJ;AAQO,SAAS,yBAAmE;AAC/E,SAAO;AAAA,IACH,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS,IAAI,+BAAA;AAAA,EAA+B;AAEpD;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/v1/utils.ts","../../src/v1/invokers/default-invoker.ts","../../src/v1/invokers/query-invoker.ts","../../src/v1/invokers/subscribable-invoker.ts","../../src/v1/invokers/legacy-invoker.ts","../../src/v1/invokers/graphql-invoker.ts","../../src/v1/invokers/graphql-legacy-invoker.ts","../../src/v1/invokers/graphql-mutation-invoker.ts"],"sourcesContent":["import { assertIsValid, type JSONSchema } from '@conduit-client/jsonschema-validate';\nimport {\n SubscribableResultCommand,\n ResultCommand,\n MaybeSubscribableResultCommand,\n ResultOrSubscribableResult,\n throwUserlandError,\n} from '@conduit-client/bindings-utils/v1';\nimport type {\n GraphQLCommandError,\n GraphQLResponse,\n} from '@conduit-client/graphql-normalization/v1';\nimport { Result, isUserVisibleError, logError } from '@conduit-client/utils';\n\nexport type ImperativeCommand<Data> =\n | SubscribableResultCommand<Data>\n | ResultCommand<Data>\n | MaybeSubscribableResultCommand<Data>;\n\nexport type GetCommand<Params extends Array<any>, CommandType> = (options: {\n params: Params;\n // utility to validate data against a JSONSchema\n assertIsValid: <T>(data: unknown, schema: JSONSchema) => asserts data is T;\n}) => CommandType;\n\nexport function buildBaseImperativeInvoker<\n Params extends Array<any>,\n Data,\n InvokerResult = Data,\n CommandType extends ImperativeCommand<Data> = ImperativeCommand<Data>,\n CommandResult extends ResultOrSubscribableResult<Data> = ResultOrSubscribableResult<Data>,\n>(\n getCommand: GetCommand<Params, CommandType>,\n transformResult: (result: CommandResult) => InvokerResult\n): (...params: Params) => PromiseLike<InvokerResult> {\n return async (...params: Params) => {\n const command = getCommand({ params, assertIsValid });\n try {\n return command.execute().then((result) => transformResult(result as CommandResult));\n } catch (error) {\n throwUserlandError(error);\n }\n };\n}\n\nexport const supportedCachePolicyTypes = ['no-cache', 'only-if-cached'] as const;\nexport type SupportedCachePolicyType = (typeof supportedCachePolicyTypes)[number];\n\nexport type CachePolicy = {\n cachePolicy: {\n type: SupportedCachePolicyType;\n };\n};\n\n/**\n * Type guard for legacy requestContext objects used with imperative-legacy bindings.\n *\n * When this function returns true, it indicates the caller requested a supported\n * cache policy override. Currently the only supported policy is `no-cache`.\n *\n * This helper is intentionally low-level; prefer using\n * {@link getOverridesForLegacyRequestContext} at call sites to construct the\n * proper `execute` overrides for Commands.\n */\nexport function requestContextIsSupportedCachePolicy(\n requestContext: unknown\n): requestContext is CachePolicy {\n return (\n typeof requestContext === 'object' &&\n requestContext !== null &&\n 'cachePolicy' in requestContext &&\n typeof requestContext.cachePolicy === 'object' &&\n requestContext.cachePolicy !== null &&\n 'type' in requestContext.cachePolicy &&\n typeof requestContext.cachePolicy.type === 'string' &&\n supportedCachePolicyTypes.includes(\n requestContext.cachePolicy.type as SupportedCachePolicyType\n )\n );\n}\n\nexport type LegacyExecuteOverrides = {\n cacheControlConfig?: { type: SupportedCachePolicyType };\n};\n\n/**\n * Builds the `execute` overrides for legacy imperative invokers based on the\n * provided requestContext. Encapsulates all hard-coded knowledge of supported\n * cache policies for legacy adapters.\n *\n * - If {@link requestContextIsSupportedCachePolicy} matches `no-cache`, returns\n * `{ cacheControlConfig: { type: 'no-cache' } }`.\n * - Otherwise returns `{}`.\n *\n * Use this in `buildAsyncImperativeLegacyInvoker` and GraphQL legacy invokers\n * to centralize override behavior.\n */\nexport function getOverridesForLegacyRequestContext(\n requestContext: unknown\n): LegacyExecuteOverrides {\n if (requestContextIsSupportedCachePolicy(requestContext)) {\n return { cacheControlConfig: { type: requestContext.cachePolicy.type } };\n }\n return {};\n}\n\nexport function handleEmit(\n res: Result<GraphQLResponse<Record<string, any>>, GraphQLCommandError>,\n callback: (result: GraphQLResponse) => void\n) {\n const consumerEmittedData = {\n data: undefined,\n errors: undefined,\n } as {\n data: GraphQLResponse | undefined;\n errors: any | undefined;\n };\n if (res.isOk()) {\n consumerEmittedData.data = res.value.data;\n } else {\n const { data, errors } = toGraphQLResponseFromFailure(res.error);\n consumerEmittedData.data = data;\n consumerEmittedData.errors = errors;\n }\n callback(consumerEmittedData);\n}\n\n/**\n * Maps a command failure (unknown or user-visible) into a GraphQLResponse suitable for consumers.\n */\nexport function toGraphQLResponseFromFailure(failure: unknown): {\n data: GraphQLResponse['data'];\n errors: GraphQLResponse['errors'];\n} {\n if (isUserVisibleError<GraphQLResponse>(failure)) {\n return {\n data: failure.data.data,\n errors: failure.data.errors,\n };\n }\n logError(failure);\n return {\n data: undefined,\n errors: [{ message: 'Internal error in GraphQL adapter occurred', locations: [] }],\n };\n}\n","import {\n isSubscribableResult,\n deepFreeze,\n toError,\n ServiceDescriptor,\n NamedService,\n} from '@conduit-client/utils';\nimport { buildBaseImperativeInvoker, ImperativeCommand, GetCommand } from '../utils';\n\nexport type DefaultImperativeResult<Data> = PromiseLike<Data>;\nexport class DefaultImperativeBindingsService {\n bind<Params extends Array<any>, Data>(\n getCommand: GetCommand<Params, ImperativeCommand<Data>>\n ): (...params: Params) => DefaultImperativeResult<Data> {\n return buildBaseImperativeInvoker<Params, Data>(getCommand, (result) => {\n if (result.isOk()) {\n deepFreeze(result.value);\n // For subscribable results processed by this invoker, only return data\n return isSubscribableResult(result) ? result.value.data : result.value;\n }\n\n throw toError(isSubscribableResult(result) ? result.error.failure : result.error);\n });\n }\n}\n\nexport type DefaultImperativeBindingsServiceDescriptor = ServiceDescriptor<\n DefaultImperativeBindingsService,\n 'defaultImperativeBindings',\n '1.0'\n>;\n\nexport type NamedDefaultImperativeBindingsService<\n Name extends string = 'defaultImperativeBindings',\n> = NamedService<Name, DefaultImperativeBindingsService>;\n\nexport function buildServiceDescriptor(): DefaultImperativeBindingsServiceDescriptor {\n return {\n type: 'defaultImperativeBindings',\n version: '1.0',\n service: new DefaultImperativeBindingsService(),\n };\n}\n","import {\n deepFreeze,\n isSubscribableResult,\n NamedService,\n ServiceDescriptor,\n toError,\n} from '@conduit-client/utils';\nimport { buildBaseImperativeInvoker, GetCommand, ImperativeCommand } from '../utils';\n\ntype QueryResult<Data> = { data: Data };\nexport type QueryImperativeResult<Data> = PromiseLike<QueryResult<Data>>;\n\nexport class QueryImperativeBindingsService {\n bind<Params extends Array<any>, Data>(\n getCommand: GetCommand<Params, ImperativeCommand<Data>>\n ): (...params: Params) => QueryImperativeResult<Data> {\n return buildBaseImperativeInvoker<Params, Data, QueryResult<Data>>(getCommand, (result) => {\n if (result.isOk()) {\n deepFreeze(result.value);\n return isSubscribableResult(result)\n ? { data: result.value.data }\n : { data: result.value };\n }\n\n throw toError(isSubscribableResult(result) ? result.error.failure : result.error);\n });\n }\n}\n\nexport type QueryImperativeBindingsServiceDescriptor = ServiceDescriptor<\n QueryImperativeBindingsService,\n 'queryImperativeBindings',\n '1.0'\n>;\n\nexport type NamedQueryImperativeBindingsService<Name extends string = 'queryImperativeBindings'> =\n NamedService<Name, QueryImperativeBindingsService>;\n\nexport function buildServiceDescriptor(): QueryImperativeBindingsServiceDescriptor {\n return {\n type: 'queryImperativeBindings',\n version: '1.0',\n service: new QueryImperativeBindingsService(),\n };\n}\n","import {\n Callback,\n deepFreeze,\n isSubscribableResult,\n NamedService,\n ServiceDescriptor,\n toError,\n} from '@conduit-client/utils';\nimport { type ResultOrSubscribableResult } from '@conduit-client/bindings-utils/v1';\nimport { buildBaseImperativeInvoker, GetCommand, ImperativeCommand } from '../utils';\n\ntype SubscribableResult<Data> = {\n data: Data;\n subscribe: (cb: Callback<any>) => void;\n};\nexport type SubscribableImperativeResult<Data> = PromiseLike<SubscribableResult<Data>>;\n\ntype SubscribableRefreshableResult<Data> = {\n data: Data;\n subscribe: (cb: Callback<any>) => void;\n refresh: () => PromiseLike<void>;\n};\nexport type SubscribableRefreshableImperativeResult<Data> = PromiseLike<\n SubscribableRefreshableResult<Data>\n>;\n\ntype MaybeRefreshableSubscribableResult<Data> =\n | SubscribableResult<Data>\n | SubscribableRefreshableResult<Data>;\ntype MaybeRefreshableSubscribableImperativeResult<Data> =\n | SubscribableImperativeResult<Data>\n | SubscribableRefreshableImperativeResult<Data>;\n\nexport class SubscribableImperativeBindingsService {\n bind<Params extends Array<any>, Data>(\n getCommand: GetCommand<Params, ImperativeCommand<Data>>,\n exposeRefresh = false\n ): (...params: Params) => MaybeRefreshableSubscribableImperativeResult<Data> {\n return buildBaseImperativeInvoker<Params, Data, MaybeRefreshableSubscribableResult<Data>>(\n getCommand,\n (result) => this.transformResult(result, exposeRefresh)\n );\n }\n\n transformResult<Data>(result: ResultOrSubscribableResult<Data>, exposeRefresh = false) {\n if (!isSubscribableResult(result)) {\n console.error(\n 'Non-subscribable result encountered - please use correct operation type'\n );\n throw new Error('Internal error in Lightning Data Service adapter occurred');\n }\n if (result.isOk()) {\n deepFreeze(result.value.data);\n\n const api = {\n data: result.value.data,\n subscribe: (cb: Callback<any>) => {\n result.value.subscribe((result) => {\n if (result.isErr()) {\n return cb({ data: undefined, error: toError(result.error) });\n }\n\n return cb({ data: result.value, error: undefined });\n });\n },\n };\n\n if (exposeRefresh) {\n return {\n ...api,\n refresh: () => {\n return result.value.refresh().then((res) => {\n if (res.isOk()) {\n return undefined;\n }\n throw res.error;\n });\n },\n };\n } else {\n return api;\n }\n } else {\n throw toError(result.error.failure);\n }\n }\n}\n\nexport type SubscribableImperativeBindingsServiceDescriptor = ServiceDescriptor<\n SubscribableImperativeBindingsService,\n 'subscribableImperativeBindings',\n '1.0'\n>;\n\nexport type NamedSubscribableImperativeBindingsService<\n Name extends string = 'subscribableImperativeBindings',\n> = NamedService<Name, SubscribableImperativeBindingsService>;\n\nexport function buildServiceDescriptor(): SubscribableImperativeBindingsServiceDescriptor {\n return {\n type: 'subscribableImperativeBindings',\n version: '1.0',\n service: new SubscribableImperativeBindingsService(),\n };\n}\n","import {\n Result,\n deepFreeze,\n toError,\n Unsubscribe,\n ServiceDescriptor,\n NamedService,\n} from '@conduit-client/utils';\nimport { JSONSchema, assertIsValid } from '@conduit-client/jsonschema-validate';\nimport { LegacyExecuteOverrides, getOverridesForLegacyRequestContext } from '../utils';\nimport { emitError, SubscribableResultCommand } from '@conduit-client/bindings-utils/v1';\n\ntype LegacyImperativeCallbackResult<Data> =\n | { data: Data; error: undefined }\n | { data: undefined; error: Error };\n\ntype LegacyImperativeAdapterInvokeType<Config, Data> = (\n config: Config,\n context: unknown,\n callback: (result: LegacyImperativeCallbackResult<Data>) => void\n) => void;\n\ntype LegacyImperativeAdapterSubscribeType<Config, Data> = (\n config: Config,\n context: unknown,\n callback: (result: LegacyImperativeCallbackResult<Data>) => void\n) => Unsubscribe;\n\nexport type LegacyImperativeShape<Config, Data> = {\n invoke: LegacyImperativeAdapterInvokeType<Config, Data>;\n subscribe: LegacyImperativeAdapterSubscribeType<Config, Data>;\n};\n\nexport type GetLegacyCommand<Config, Data> = (options: {\n config: Config;\n assertIsValid: <T>(data: unknown, schema: JSONSchema) => asserts data is T;\n}) => SubscribableResultCommand<Data, unknown, [LegacyExecuteOverrides?]>;\n\nexport class LegacyImperativeBindingsService {\n bind<Config, Data>(\n getCommand: GetLegacyCommand<Config, Data>\n ): LegacyImperativeShape<Config, Data> {\n const invoke: LegacyImperativeAdapterInvokeType<Config, Data> = async (\n config: Config,\n requestContext: unknown,\n callback: (result: LegacyImperativeCallbackResult<Data>) => void\n ) => {\n const command = getCommand({ config, assertIsValid });\n\n try {\n const overrides = getOverridesForLegacyRequestContext(requestContext);\n const result = await command.execute(overrides);\n if (result.isOk()) {\n deepFreeze(result.value);\n callback({ data: result.value.data, error: undefined });\n } else {\n callback({ data: undefined, error: toError(result.error.failure) });\n }\n } catch (error) {\n emitError(callback, error);\n }\n };\n\n const subscribe: LegacyImperativeAdapterSubscribeType<Config, Data> = (\n config: Config,\n requestContext: unknown,\n callback: (result: LegacyImperativeCallbackResult<Data>) => void\n ) => {\n const command = getCommand({ config, assertIsValid });\n\n let unsubscribe: Unsubscribe = () => {};\n\n try {\n const overrides = getOverridesForLegacyRequestContext(requestContext);\n command.execute(overrides).then(\n (result: Awaited<ReturnType<typeof command.execute>>) => {\n if (!result.isOk()) {\n callback({ data: undefined, error: toError(result.error.failure) });\n return;\n }\n\n unsubscribe = result.value.subscribe((res: Result<Data, unknown>) => {\n if (res.isOk()) {\n callback({ data: res.value, error: undefined });\n } else {\n callback({ data: undefined, error: toError(res.error) });\n }\n });\n\n callback({ data: result.value.data, error: undefined });\n },\n (e: unknown) => {\n emitError(callback, e);\n }\n );\n } catch (e) {\n emitError(callback, e);\n }\n\n return () => {\n unsubscribe();\n };\n };\n\n return { invoke, subscribe };\n }\n}\n\nexport type LegacyImperativeBindingsServiceDescriptor = ServiceDescriptor<\n LegacyImperativeBindingsService,\n 'legacyImperativeBindings',\n '1.0'\n>;\n\nexport type NamedLegacyImperativeBindingsService<Name extends string = 'legacyImperativeBindings'> =\n NamedService<Name, LegacyImperativeBindingsService>;\n\nexport function buildServiceDescriptor(): LegacyImperativeBindingsServiceDescriptor {\n return {\n type: 'legacyImperativeBindings',\n version: '1.0',\n service: new LegacyImperativeBindingsService(),\n };\n}\n","import {\n deepFreeze,\n type Callback,\n type SubscribableResult,\n logError,\n isUserVisibleError,\n ServiceDescriptor,\n NamedService,\n} from '@conduit-client/utils';\nimport {\n type GraphQLCommandError,\n type GraphQLResponse,\n type GraphQLCommand,\n} from '@conduit-client/graphql-normalization/v1';\nimport { wrapConfigAndVerify } from '@conduit-client/onestore-graphql-parser/v1';\nimport { buildBaseImperativeInvoker, GetCommand, toGraphQLResponseFromFailure } from '../utils';\n\ntype SubscribableRefreshableGraphQLResult = GraphQLResponse & {\n subscribe?: (cb: Callback<any>) => void;\n refresh?: () => PromiseLike<void>;\n};\nexport type SubscribableRefreshableGraphQLImperativeResult =\n PromiseLike<SubscribableRefreshableGraphQLResult>;\n\nexport class GraphQLImperativeBindingsService {\n bind<Params extends Array<any>>(\n getCommand: GetCommand<Params, GraphQLCommand>,\n exposeRefresh = false\n ): (...params: Params) => SubscribableRefreshableGraphQLImperativeResult {\n return async (...params: Params) => {\n try {\n if (params.length) {\n params[0] = wrapConfigAndVerify(params[0]);\n }\n return await buildBaseImperativeInvoker<\n Params,\n GraphQLResponse<Record<string, any>>,\n SubscribableRefreshableGraphQLResult,\n GraphQLCommand,\n SubscribableResult<GraphQLResponse<Record<string, any>>, GraphQLCommandError>\n >(getCommand, (result) => this.transformResult(result, exposeRefresh))(...params);\n } catch (error) {\n logError(error);\n return {\n data: undefined,\n errors: [\n { message: 'Internal error in GraphQL adapter occurred', locations: [] },\n ],\n };\n }\n };\n }\n\n transformResult<Data extends GraphQLResponse<Record<string, any>>>(\n result: SubscribableResult<Data, GraphQLCommandError>,\n exposeRefresh = false\n ): SubscribableRefreshableGraphQLResult {\n const consumerEmittedData = {\n data: undefined,\n errors: undefined,\n } as {\n data: GraphQLResponse | undefined;\n errors: any | undefined;\n subscribe: (cb: Callback<any>) => void;\n refresh: () => PromiseLike<void>;\n };\n\n if (result.isOk()) {\n deepFreeze(result.value);\n consumerEmittedData.data = result.value.data.data;\n consumerEmittedData.subscribe = (cb: Callback<any>) => {\n result.value.subscribe((res) => {\n const consumerEmittedData = {\n data: undefined,\n errors: undefined,\n } as {\n data: GraphQLResponse | undefined;\n errors: any | undefined;\n };\n if (res.isOk()) {\n consumerEmittedData.data = res.value.data;\n } else {\n if (isUserVisibleError<GraphQLResponse>(res.error)) {\n consumerEmittedData.data = res.error.data.data;\n consumerEmittedData.errors = res.error.data.errors;\n } else {\n logError(res.error);\n consumerEmittedData.errors = [\n {\n message: 'Internal error in GraphQL adapter occurred',\n locations: [],\n },\n ];\n }\n }\n cb(consumerEmittedData);\n });\n };\n if (exposeRefresh) {\n consumerEmittedData.refresh = () => {\n return new Promise((resolve, reject) => {\n try {\n result.value.refresh().then((res) => {\n if (res.isOk()) {\n resolve();\n } else {\n reject(\n new Error(\n 'Internal error in GraphQL adapter occurred: Failed to refresh GraphQL data'\n )\n );\n }\n });\n } catch (error) {\n logError(error);\n reject(\n new Error(\n 'Internal error in GraphQL adapter occurred: Failed to refresh GraphQL data'\n )\n );\n }\n });\n };\n }\n } else {\n const resp = toGraphQLResponseFromFailure(result.error.failure);\n consumerEmittedData.data = resp.data;\n consumerEmittedData.errors = resp.errors;\n }\n\n return consumerEmittedData;\n }\n}\n\nexport type GraphQLImperativeBindingsServiceDescriptor = ServiceDescriptor<\n GraphQLImperativeBindingsService,\n 'graphQLImperativeBindings',\n '1.0'\n>;\n\nexport type NamedGraphQLImperativeBindingsService<\n Name extends string = 'graphQLImperativeBindings',\n> = NamedService<Name, GraphQLImperativeBindingsService>;\n\nexport function buildServiceDescriptor(): GraphQLImperativeBindingsServiceDescriptor {\n return {\n type: 'graphQLImperativeBindings',\n version: '1.0',\n service: new GraphQLImperativeBindingsService(),\n };\n}\n","import {\n deepFreeze,\n Result,\n Unsubscribe,\n logError,\n ServiceDescriptor,\n NamedService,\n} from '@conduit-client/utils';\nimport { JSONSchema, assertIsValid } from '@conduit-client/jsonschema-validate';\nimport {\n type GraphQLCommandError,\n type GraphQLResponse,\n type GraphQLCommand,\n} from '@conduit-client/graphql-normalization/v1';\nimport { wrapConfigAndVerify } from '@conduit-client/onestore-graphql-parser/v1';\nimport type { Command } from '@conduit-client/command-base/v1';\nimport { getOverridesForLegacyRequestContext, handleEmit } from '../utils';\nimport { type LegacyExecuteOverrides, toGraphQLResponseFromFailure } from '../utils';\n\ntype LegacyGraphQLImperativeAdapterInvokeType<Config> = (\n config: Config,\n context: unknown,\n callback: (result: GraphQLResponse) => void\n) => void;\n\ntype LegacyGraphQLImperativeAdapterSubscribeType<Config> = (\n config: Config,\n context: unknown,\n callback: (result: GraphQLResponse) => void\n) => Unsubscribe;\n\nexport type LegacyGraphQLImperativeShape<Config> = {\n invoke: LegacyGraphQLImperativeAdapterInvokeType<Config>;\n subscribe: LegacyGraphQLImperativeAdapterSubscribeType<Config>;\n};\n\nexport type GetGraphQLLegacyCommand<Config> = (options: {\n config: Config;\n assertIsValid: <T>(data: unknown, schema: JSONSchema) => asserts data is T;\n}) => Command<ReturnType<GraphQLCommand['execute']>, [LegacyExecuteOverrides?]>;\n\nexport class GraphQLLegacyImperativeBindingsService {\n bind<Config>(\n getCommand: GetGraphQLLegacyCommand<Config>\n ): LegacyGraphQLImperativeShape<Config> {\n const invoke: LegacyGraphQLImperativeAdapterInvokeType<Config> = async (\n config: Config,\n requestContext: unknown,\n callback: (result: GraphQLResponse) => void\n ) => {\n config = wrapConfigAndVerify(config);\n const command = getCommand({ config, assertIsValid });\n\n try {\n const overrides = getOverridesForLegacyRequestContext(requestContext);\n const result: Awaited<ReturnType<typeof command.execute>> =\n await command.execute(overrides);\n\n const consumerEmittedData = {\n data: undefined,\n errors: undefined,\n } as {\n data: GraphQLResponse | undefined;\n errors: any | undefined;\n };\n\n if (result.isOk()) {\n deepFreeze(result.value);\n consumerEmittedData.data = result.value.data.data;\n } else {\n const { data, errors } = toGraphQLResponseFromFailure(result.error.failure);\n consumerEmittedData.data = data;\n consumerEmittedData.errors = errors;\n }\n\n callback(consumerEmittedData);\n } catch (error) {\n logError(error);\n callback({\n data: undefined,\n errors: [\n { message: 'Internal error in GraphQL adapter occurred', locations: [] },\n ],\n } satisfies GraphQLResponse);\n }\n };\n\n const subscribe: LegacyGraphQLImperativeAdapterSubscribeType<Config> = (\n config: Config,\n requestContext: unknown,\n callback: (result: GraphQLResponse) => void\n ) => {\n config = wrapConfigAndVerify(config);\n const command = getCommand({ config, assertIsValid });\n\n let unsubscribe: Unsubscribe = () => {};\n\n const overrides = getOverridesForLegacyRequestContext(requestContext);\n command\n .execute(overrides)\n .then((result: Awaited<ReturnType<typeof command.execute>>) => {\n const consumerEmittedData = {\n data: undefined,\n errors: undefined,\n } as {\n data: GraphQLResponse | undefined;\n errors: any | undefined;\n };\n\n if (result.isOk()) {\n deepFreeze(result.value);\n consumerEmittedData.data = result.value.data.data;\n unsubscribe = result.value.subscribe(\n (\n res: Result<\n GraphQLResponse<Record<string, any>>,\n GraphQLCommandError\n >\n ) => {\n handleEmit(res, callback);\n }\n );\n } else {\n const { data, errors } = toGraphQLResponseFromFailure(result.error.failure);\n consumerEmittedData.data = data;\n consumerEmittedData.errors = errors;\n unsubscribe = result.error.subscribe(\n (\n res: Result<\n GraphQLResponse<Record<string, any>>,\n GraphQLCommandError\n >\n ) => {\n handleEmit(res, callback);\n }\n );\n }\n\n callback(consumerEmittedData);\n });\n\n return () => {\n unsubscribe();\n };\n };\n\n return { invoke, subscribe };\n }\n}\n\nexport type GraphQLLegacyImperativeBindingsServiceDescriptor = ServiceDescriptor<\n GraphQLLegacyImperativeBindingsService,\n 'graphQLLegacyImperativeBindings',\n '1.0'\n>;\n\nexport type NamedGraphQLLegacyImperativeBindingsService<\n Name extends string = 'graphQLLegacyImperativeBindings',\n> = NamedService<Name, GraphQLLegacyImperativeBindingsService>;\n\nexport function buildServiceDescriptor(): GraphQLLegacyImperativeBindingsServiceDescriptor {\n return {\n type: 'graphQLLegacyImperativeBindings',\n version: '1.0',\n service: new GraphQLLegacyImperativeBindingsService(),\n };\n}\n","import { deepFreeze, logError, NamedService, ServiceDescriptor } from '@conduit-client/utils';\nimport { JSONSchema, assertIsValid } from '@conduit-client/jsonschema-validate';\nimport {\n type GraphQLResponse,\n type GraphQLCommand,\n} from '@conduit-client/graphql-normalization/v1';\nimport { wrapConfigAndVerify } from '@conduit-client/onestore-graphql-parser/v1';\nimport type { Command } from '@conduit-client/command-base/v1';\nimport { type LegacyExecuteOverrides, toGraphQLResponseFromFailure } from '../utils';\n\nexport type GraphQLMutationResult = Promise<GraphQLResponse>;\ntype GetGraphQLCommand<Params> = (options: {\n params: Params;\n assertIsValid: <T>(data: unknown, schema: JSONSchema) => asserts data is T;\n}) => Command<ReturnType<GraphQLCommand['execute']>, [LegacyExecuteOverrides?]>;\n\nexport class GraphQLMutationBindingsService {\n bind<Params extends Array<any>>(\n getCommand: GetGraphQLCommand<Params>\n ): (...params: Params) => GraphQLMutationResult {\n return async (...params: Params) => {\n try {\n if (params.length) {\n params[0] = wrapConfigAndVerify(params[0], {\n acceptedOperations: ['mutation'],\n });\n }\n const command = getCommand({ params, assertIsValid });\n const result = await command.execute({ cacheControlConfig: { type: 'no-cache' } });\n\n if (result.isOk()) {\n deepFreeze(result.value);\n return result.value.data;\n } else {\n return toGraphQLResponseFromFailure(result.error.failure);\n }\n } catch (error) {\n logError(error);\n return {\n data: undefined,\n errors: [\n { message: 'Internal error in GraphQL adapter occurred', locations: [] },\n ],\n } satisfies GraphQLResponse;\n }\n };\n }\n}\n\nexport type GraphQLMutationBindingsServiceDescriptor = ServiceDescriptor<\n GraphQLMutationBindingsService,\n 'graphQLMutationBindings',\n '1.0'\n>;\n\nexport type NamedGraphQLMutationBindingsService<Name extends string = 'graphQLMutationBindings'> =\n NamedService<Name, GraphQLMutationBindingsService>;\n\nexport function buildServiceDescriptor(): GraphQLMutationBindingsServiceDescriptor {\n return {\n type: 'graphQLMutationBindings',\n version: '1.0',\n service: new GraphQLMutationBindingsService(),\n };\n}\n"],"names":["buildServiceDescriptor","result","consumerEmittedData"],"mappings":";;;;;;;;;AAyBO,SAAS,2BAOZ,YACA,iBACiD;AACjD,SAA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,CAAC,GAAG;AAAA,YACvC,oBAAoB,CAAC,UAAU;AAAA,UAAA,CAClC;AAAA,QACL;AACA,cAAM,UAAU,WAAW,EAAE,QAAQ,eAAe;AACpD,cAAM,SAAS,MAAM,QAAQ,QAAQ,EAAE,oBAAoB,EAAE,MAAM,WAAA,GAAc;AAEjF,YAAI,OAAO,QAAQ;AACf,qBAAW,OAAO,KAAK;AACvB,iBAAO,OAAO,MAAM;AAAA,QACxB,OAAO;AACH,iBAAO,6BAA6B,OAAO,MAAM,OAAO;AAAA,QAC5D;AAAA,MACJ,SAAS,OAAO;AACZ,iBAAS,KAAK;AACd,eAAO;AAAA,UACH,MAAM;AAAA,UACN,QAAQ;AAAA,YACJ,EAAE,SAAS,8CAA8C,WAAW,CAAA,EAAC;AAAA,UAAE;AAAA,QAC3E;AAAA,MAER;AAAA,IACJ;AAAA,EACJ;AACJ;AAWO,SAAS,yBAAmE;AAC/E,SAAO;AAAA,IACH,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS,IAAI,+BAAA;AAAA,EAA+B;AAEpD;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@conduit-client/service-bindings-imperative",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Conduit services for imperative bindings",
|
|
6
6
|
"type": "module",
|
|
@@ -31,14 +31,14 @@
|
|
|
31
31
|
"watch": "npm run build --watch"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@conduit-client/bindings-utils": "2.
|
|
35
|
-
"@conduit-client/command-base": "2.
|
|
36
|
-
"@conduit-client/jsonschema-validate": "2.
|
|
37
|
-
"@conduit-client/onestore-graphql-parser": "2.
|
|
38
|
-
"@conduit-client/utils": "2.
|
|
34
|
+
"@conduit-client/bindings-utils": "3.2.0",
|
|
35
|
+
"@conduit-client/command-base": "3.2.0",
|
|
36
|
+
"@conduit-client/jsonschema-validate": "3.2.0",
|
|
37
|
+
"@conduit-client/onestore-graphql-parser": "3.2.0",
|
|
38
|
+
"@conduit-client/utils": "3.2.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@conduit-client/graphql-normalization": "2.
|
|
41
|
+
"@conduit-client/graphql-normalization": "3.2.0"
|
|
42
42
|
},
|
|
43
43
|
"volta": {
|
|
44
44
|
"extends": "../../../../package.json"
|