@conduit-client/graphql-normalization 5.67.0-dev1

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.
Files changed (36) hide show
  1. package/dist/main/index.js +6 -0
  2. package/dist/main/index.js.map +1 -0
  3. package/dist/types/index.d.ts +0 -0
  4. package/dist/types/v1/__tests__/aura-normalized-cache-control-base.spec.d.ts +1 -0
  5. package/dist/types/v1/__tests__/aura-normalized-cache-control-connection.spec.d.ts +1 -0
  6. package/dist/types/v1/__tests__/aura-normalized-cache-control-directives.spec.d.ts +1 -0
  7. package/dist/types/v1/__tests__/aura-normalized-cache-control-fragments.spec.d.ts +1 -0
  8. package/dist/types/v1/__tests__/aura-normalized-cache-control-unidentifiable.spec.d.ts +1 -0
  9. package/dist/types/v1/__tests__/aura-normalized-cache-control-union.spec.d.ts +1 -0
  10. package/dist/types/v1/__tests__/connection-query-params.spec.d.ts +1 -0
  11. package/dist/types/v1/__tests__/directives.spec.d.ts +1 -0
  12. package/dist/types/v1/__tests__/identifiable-repository-cache-key-alias.spec.d.ts +1 -0
  13. package/dist/types/v1/__tests__/identifiable-repository-normalize-no-mutate.spec.d.ts +1 -0
  14. package/dist/types/v1/__tests__/query-augmentation.spec.d.ts +1 -0
  15. package/dist/types/v1/__tests__/selection-equality.spec.d.ts +1 -0
  16. package/dist/types/v1/__tests__/test-utils.d.ts +721 -0
  17. package/dist/types/v1/__tests__/utils.spec.d.ts +1 -0
  18. package/dist/types/v1/__tests__/value-extraction.spec.d.ts +1 -0
  19. package/dist/types/v1/base-object-repository.d.ts +29 -0
  20. package/dist/types/v1/cursor-connection-graphql-type-repository.d.ts +51 -0
  21. package/dist/types/v1/directives.d.ts +5 -0
  22. package/dist/types/v1/errors.d.ts +7 -0
  23. package/dist/types/v1/field-defs.d.ts +40 -0
  24. package/dist/types/v1/identifiable-object-repository.d.ts +34 -0
  25. package/dist/types/v1/index.d.ts +11 -0
  26. package/dist/types/v1/json-schema.d.ts +2 -0
  27. package/dist/types/v1/repository.d.ts +8 -0
  28. package/dist/types/v1/type-registry.d.ts +2 -0
  29. package/dist/types/v1/types.d.ts +52 -0
  30. package/dist/types/v1/unidentifiable-object-repository.d.ts +11 -0
  31. package/dist/types/v1/union-interface-repositories.d.ts +38 -0
  32. package/dist/types/v1/utils.d.ts +21 -0
  33. package/dist/types/v1/value-extraction.d.ts +61 -0
  34. package/dist/v1/index.js +1638 -0
  35. package/dist/v1/index.js.map +1 -0
  36. package/package.json +56 -0
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,29 @@
1
+ import { DenormalizeDataInput, ReadErrors, WriteErrors, NormalizeDataInput } from '@conduit-client/type-normalization/v1';
2
+ import { AugmentSelectionsData, GraphQLData, GraphQLFragmentDefinitions, GraphQLInputExtension, GraphQLVariables } from './types';
3
+ import { ReadonlyCache, Cache } from '@conduit-client/service-cache/v1';
4
+ import { FieldNode, FragmentDefinitionNode, FragmentSpreadNode, InlineFragmentNode } from '@conduit-client/onestore-graphql-parser/v1';
5
+ import { Result } from '@conduit-client/utils';
6
+ import { FieldDef, FieldDefs } from './field-defs';
7
+ export declare abstract class BaseGraphQLTypeRepository<Data extends GraphQLData = GraphQLData, NormalizedData extends GraphQLData = GraphQLData, ExtraInputExtension extends Record<string, any> = Record<string, unknown>> {
8
+ abstract readonly namespace: string;
9
+ abstract readonly typeName: string;
10
+ abstract readonly fields: FieldDefs<any, any, ExtraInputExtension>;
11
+ abstract readonly implementedInterfaces: string[];
12
+ equals(x: Data, y: Data): boolean;
13
+ augmentSelections(input: AugmentSelectionsData): AugmentSelectionsData;
14
+ augmentFieldSelection(selection: FieldNode, fragments: GraphQLFragmentDefinitions): AugmentSelectionsData;
15
+ augmentInlineFragmentSelection(fragment: InlineFragmentNode, fragments: GraphQLFragmentDefinitions): AugmentSelectionsData;
16
+ augmentFragmentSpreadSelection(selection: FragmentSpreadNode, fragments: GraphQLFragmentDefinitions): AugmentSelectionsData;
17
+ normalizeSelections(cache: Cache, input: NormalizeDataInput<Data, NormalizedData, GraphQLInputExtension & ExtraInputExtension>): Result<NormalizedData, WriteErrors>;
18
+ protected normalizeFieldSelection(cache: Cache, input: NormalizeDataInput<Data, NormalizedData, GraphQLInputExtension & ExtraInputExtension>, selection: FieldNode, errorCollector: WriteErrors): GraphQLData;
19
+ protected normalizeFragment(cache: Cache, input: NormalizeDataInput<Data, NormalizedData, GraphQLInputExtension & ExtraInputExtension>, fragment: InlineFragmentNode | FragmentDefinitionNode, errorCollector: WriteErrors): {};
20
+ denormalizeSelections(cache: ReadonlyCache, input: DenormalizeDataInput<NormalizedData, GraphQLInputExtension & ExtraInputExtension>): Result<Data, ReadErrors>;
21
+ protected getNormalizedFieldData(selection: FieldNode, input: NormalizeDataInput<Data, NormalizedData, GraphQLInputExtension & ExtraInputExtension> | DenormalizeDataInput<NormalizedData, GraphQLInputExtension & ExtraInputExtension>): Result<unknown, Error>;
22
+ protected denormalizeFieldSelection(cache: ReadonlyCache, input: DenormalizeDataInput<NormalizedData, GraphQLInputExtension & ExtraInputExtension>, selection: FieldNode, errorCollector: ReadErrors): GraphQLData;
23
+ protected denormalizeFragment(cache: ReadonlyCache, input: DenormalizeDataInput<NormalizedData, GraphQLInputExtension & ExtraInputExtension>, fragment: InlineFragmentNode | FragmentDefinitionNode, errorCollector: ReadErrors): {};
24
+ protected getFieldDef(input: NormalizeDataInput<Data, NormalizedData, GraphQLInputExtension & ExtraInputExtension> | DenormalizeDataInput<NormalizedData, GraphQLInputExtension & ExtraInputExtension> | undefined, selection: FieldNode): FieldDef<Data, NormalizedData> | undefined;
25
+ shouldProcessFragment(input: NormalizeDataInput<Data, NormalizedData, GraphQLInputExtension & ExtraInputExtension> | DenormalizeDataInput<NormalizedData, GraphQLInputExtension & ExtraInputExtension>, fragment: InlineFragmentNode | FragmentDefinitionNode): Result<boolean, Error>;
26
+ satisfiesFragmentTypeCondition(_input: NormalizeDataInput<Data, NormalizedData, GraphQLInputExtension & ExtraInputExtension> | DenormalizeDataInput<NormalizedData, GraphQLInputExtension & ExtraInputExtension> | undefined, fragment: InlineFragmentNode | FragmentDefinitionNode): Result<boolean, Error>;
27
+ protected getCacheKeyFieldArguments(selection: FieldNode): readonly import("@conduit-client/onestore-graphql-parser/v1").ArgumentNode[] | undefined;
28
+ buildFieldKey(selection: FieldNode, variables: GraphQLVariables): Result<string, Error>;
29
+ }
@@ -0,0 +1,51 @@
1
+ import { Cache, ReadonlyCache } from '@conduit-client/service-cache/v1';
2
+ import { DenormalizeDataInput, NormalizeDataInput, WriteResult, ReadResult } from '@conduit-client/type-normalization/v1';
3
+ import { RelayPaginationStrategy, ResponsePaginationMetadata, ManagedPaginationMetadata } from '@conduit-client/pagination';
4
+ import { GraphQLData, AugmentSelectionsData, GraphQLInputExtension } from './types';
5
+ import { UnidentifiableGraphQLTypeRepository } from '.';
6
+ import { ArgumentNode, FieldNode } from '@conduit-client/onestore-graphql-parser/v1';
7
+ import { FieldDef, FieldDefs } from './field-defs';
8
+ /**
9
+ * Extended response type that includes both core pagination metadata and additional connection fields
10
+ */
11
+ export type PaginatedResponse = ResponsePaginationMetadata<GraphQLData> & GraphQLData;
12
+ export type ConnectionNormalizedData = {
13
+ pagination: ManagedPaginationMetadata<unknown>;
14
+ } & GraphQLData;
15
+ /**
16
+ * Constrains the GraphQL type fields for cursor connections to ensure:
17
+ * - edges is always an array of objects with repositories
18
+ * - pageInfo is always an object with a repository
19
+ * - other fields can be any valid GraphQL type
20
+ */
21
+ export interface CursorConnectionTypeFields<Data, NormalizedData> extends FieldDefs<Data, NormalizedData> {
22
+ edges: FieldDef<Data, NormalizedData>;
23
+ pageInfo: FieldDef<Data, NormalizedData>;
24
+ [key: string]: FieldDef<Data, NormalizedData>;
25
+ }
26
+ export declare abstract class CursorConnectionGraphQLTypeRepository<Data extends PaginatedResponse = PaginatedResponse, NormalizedData extends ConnectionNormalizedData = ConnectionNormalizedData, ExtraInputExtension extends Record<string, any> = Record<string, unknown>> extends UnidentifiableGraphQLTypeRepository<Data, NormalizedData, ExtraInputExtension> {
27
+ abstract readonly fields: CursorConnectionTypeFields<Data, NormalizedData>;
28
+ abstract readonly defaultPageSize: number;
29
+ abstract readonly implementedInterfaces: string[];
30
+ protected paginationStrategy: RelayPaginationStrategy<unknown>;
31
+ augmentSelections(input: AugmentSelectionsData): AugmentSelectionsData;
32
+ write(cache: Cache, input: NormalizeDataInput<Data, NormalizedData, GraphQLInputExtension & ExtraInputExtension>): WriteResult<NormalizedData>;
33
+ read(cache: ReadonlyCache, input: DenormalizeDataInput<NormalizedData, GraphQLInputExtension & ExtraInputExtension>): ReadResult<Data>;
34
+ protected getCacheKeyFieldArguments(selection: FieldNode): ArgumentNode[] | undefined;
35
+ /**
36
+ * Helper method to extract fields from an object, excluding specified keys
37
+ */
38
+ private extractFieldsExcluding;
39
+ /**
40
+ * Builds incoming pagination data from response data.
41
+ */
42
+ private buildIncomingPaginationData;
43
+ private buildCanonicalManagedPaginationData;
44
+ private buildCacheManagedPaginationData;
45
+ private buildCacheResponsePaginationData;
46
+ /**
47
+ * Merges additional fields (non-pagination) from new and existing data
48
+ */
49
+ private mergeNonPaginationFields;
50
+ private mergeDefaultPageSize;
51
+ }
@@ -0,0 +1,5 @@
1
+ import { FragmentDefinitionNode, InlineFragmentNode, FieldNode } from '@conduit-client/onestore-graphql-parser/v1';
2
+ import { GraphQLVariables } from './types';
3
+ import { Result } from '@conduit-client/utils';
4
+ export type SkipableNode = FragmentDefinitionNode | InlineFragmentNode | FieldNode;
5
+ export declare function shouldSkip(selection: SkipableNode, variables: GraphQLVariables): Result<boolean, Error>;
@@ -0,0 +1,7 @@
1
+ import { GraphQLResponse } from './types';
2
+ import { InternalError } from '@conduit-client/utils';
3
+ export type GraphQLUserVisibleError = Error & {
4
+ type: 'user-visible';
5
+ data: GraphQLResponse;
6
+ };
7
+ export type GraphQLCommandError = InternalError | GraphQLUserVisibleError | Error;
@@ -0,0 +1,40 @@
1
+ import type { AugmentSelectionsData, GraphQLFieldInputExtension, GraphQLVariables } from './types';
2
+ import type { GraphQLTypeRepository } from './repository';
3
+ import { FieldNode } from '@conduit-client/onestore-graphql-parser/v1';
4
+ import { DenormalizeDataInput, NormalizeDataInput, ReadResult, WriteResult } from '@conduit-client/type-normalization/v1';
5
+ import { Cache, ReadonlyCache } from '@conduit-client/service-cache/v1';
6
+ import { Result } from '@conduit-client/utils';
7
+ export type FieldDef<Data = unknown, NormalizedData = unknown, ExtraInputExtension extends Record<string, any> = Record<string, unknown>> = {
8
+ write(cache: Cache, input: NormalizeDataInput<Data, NormalizedData, ExtraInputExtension>): WriteResult<NormalizedData>;
9
+ read(cache: ReadonlyCache, input: DenormalizeDataInput<NormalizedData, ExtraInputExtension>): ReadResult<Data>;
10
+ buildFieldKey(selection: FieldNode, variables: GraphQLVariables): Result<string, Error>;
11
+ augmentSelections(input: AugmentSelectionsData): AugmentSelectionsData;
12
+ };
13
+ export type FieldDefs<Data = unknown, NormalizedData = unknown, ExtraInputExtension extends Record<string, any> = Record<string, unknown>> = Record<string, FieldDef<Data, NormalizedData, ExtraInputExtension>>;
14
+ export declare class BaseScalarFieldDef<Data = unknown, NormalizedData = unknown, ExtraInputExtension extends Record<string, any> = Record<string, unknown>> implements FieldDef<Data, NormalizedData, ExtraInputExtension> {
15
+ readonly nullable: boolean;
16
+ constructor(nullable: boolean);
17
+ write(_cache: Cache, input: NormalizeDataInput<Data, NormalizedData, GraphQLFieldInputExtension & ExtraInputExtension>): WriteResult<NormalizedData>;
18
+ read(_cache: ReadonlyCache, input: DenormalizeDataInput<NormalizedData, GraphQLFieldInputExtension & ExtraInputExtension>): ReadResult<Data>;
19
+ augmentSelections(input: AugmentSelectionsData): AugmentSelectionsData;
20
+ buildFieldKey(selection: FieldNode, variables: GraphQLVariables): Result<string, Error>;
21
+ }
22
+ export declare class BaseArrayFieldDef<Data = unknown, NormalizedData = unknown, ExtraInputExtension extends Record<string, any> = Record<string, unknown>> implements FieldDef<Data, NormalizedData, ExtraInputExtension> {
23
+ readonly items: FieldDef<Data, NormalizedData, ExtraInputExtension>;
24
+ readonly nullable: boolean;
25
+ constructor(items: FieldDef<Data, NormalizedData, ExtraInputExtension>, nullable: boolean);
26
+ augmentSelections(input: AugmentSelectionsData): AugmentSelectionsData;
27
+ buildFieldKey(selection: FieldNode, variables: GraphQLVariables): Result<string, Error>;
28
+ write(cache: Cache, input: NormalizeDataInput<Data, NormalizedData, GraphQLFieldInputExtension & ExtraInputExtension>): WriteResult<NormalizedData>;
29
+ read(cache: ReadonlyCache, input: DenormalizeDataInput<NormalizedData, GraphQLFieldInputExtension & ExtraInputExtension>): ReadResult<Data>;
30
+ }
31
+ export declare class BaseObjectFieldDef<Data = unknown, NormalizedData = unknown, ExtraInputExtension extends Record<string, any> = Record<string, unknown>> implements FieldDef<Data, NormalizedData, ExtraInputExtension> {
32
+ readonly repository: GraphQLTypeRepository<Data, NormalizedData, ExtraInputExtension>;
33
+ readonly nullable: boolean;
34
+ constructor(repository: GraphQLTypeRepository<Data, NormalizedData, ExtraInputExtension>, nullable: boolean);
35
+ augmentSelections(input: AugmentSelectionsData): AugmentSelectionsData;
36
+ buildFieldKey(selection: FieldNode, variables: GraphQLVariables): Result<string, Error>;
37
+ write(cache: Cache, input: NormalizeDataInput<Data, NormalizedData, GraphQLFieldInputExtension & ExtraInputExtension>): WriteResult<NormalizedData>;
38
+ read(cache: ReadonlyCache, input: DenormalizeDataInput<NormalizedData, GraphQLFieldInputExtension & ExtraInputExtension>): ReadResult<Data>;
39
+ }
40
+ export declare const missingFieldDef: BaseScalarFieldDef<any, any, any>;
@@ -0,0 +1,34 @@
1
+ import { Cache, ReadonlyCache } from '@conduit-client/service-cache/v1';
2
+ import { DenormalizeDataInput, IdentifiableTypeRepository, NormalizedLink, ReadResult, WriteInput, WriteResult } from '@conduit-client/type-normalization/v1';
3
+ import { BaseGraphQLTypeRepository } from './base-object-repository';
4
+ import { GraphQLData, GraphQLInputExtension, GraphQLRequestParams, AugmentSelectionsData, GraphQLVariables } from './types';
5
+ import { Result } from '@conduit-client/utils';
6
+ import { DocumentNode, FieldNode } from '@conduit-client/onestore-graphql-parser/v1';
7
+ import { FieldDefs } from './field-defs';
8
+ import { GraphQLTypeRepository } from './repository';
9
+ export declare abstract class IdentifiableGraphQLTypeRepository<Data extends GraphQLData, NormalizedData extends GraphQLData, KeyParams extends Record<string, unknown> | null = Record<string, unknown>, ExtraInputExtension extends Record<string, any> = Record<string, unknown>> extends IdentifiableTypeRepository<Data, NormalizedData, KeyParams, GraphQLInputExtension & ExtraInputExtension, GraphQLInputExtension & ExtraInputExtension> implements GraphQLTypeRepository {
10
+ abstract readonly namespace: string;
11
+ abstract readonly typeName: string;
12
+ abstract readonly implementedInterfaces: string[];
13
+ abstract readonly fields: FieldDefs<any, any, ExtraInputExtension>;
14
+ readonly idField: string;
15
+ private _graphqlRepository;
16
+ protected get graphqlRepository(): BaseGraphQLTypeRepository<Data, NormalizedData, Record<string, unknown>>;
17
+ private LocalGraphQLRepository;
18
+ write(cache: Cache, input: WriteInput<Data, GraphQLInputExtension & ExtraInputExtension>): WriteResult<NormalizedLink>;
19
+ normalizeData(cache: Cache, input: WriteInput<Data, GraphQLInputExtension & ExtraInputExtension>): WriteResult<NormalizedData>;
20
+ denormalizeData(cache: ReadonlyCache, input: DenormalizeDataInput<NormalizedData, GraphQLInputExtension & ExtraInputExtension>): ReadResult<Data>;
21
+ augmentSelections(input: AugmentSelectionsData): AugmentSelectionsData;
22
+ buildFieldKey(selection: FieldNode, variables: GraphQLVariables): Result<string, Error>;
23
+ buildKeyParams(input: WriteInput<Data, GraphQLInputExtension & ExtraInputExtension>): KeyParams;
24
+ }
25
+ export declare abstract class GraphQLDocumentRootTypeRepository<Data extends GraphQLData, NormalizedData extends GraphQLData, ExtraInputExtension extends Record<string, any> = Record<string, unknown>> extends IdentifiableGraphQLTypeRepository<Data, NormalizedData, null, ExtraInputExtension> {
26
+ implementedInterfaces: never[];
27
+ private _rootGraphqlRepository;
28
+ protected get graphqlRepository(): BaseGraphQLTypeRepository<Data, NormalizedData, Record<string, unknown>>;
29
+ private LocalRootGraphQLRepository;
30
+ augmentSelections(input: AugmentSelectionsData): AugmentSelectionsData;
31
+ buildKeyParams(_input: WriteInput<Data, GraphQLInputExtension & ExtraInputExtension>): null;
32
+ denormalizeData(cache: ReadonlyCache, input: DenormalizeDataInput<NormalizedData, GraphQLInputExtension & ExtraInputExtension>): ReadResult<Data>;
33
+ buildAugmentedQuery(input: GraphQLRequestParams): Result<DocumentNode, Error>;
34
+ }
@@ -0,0 +1,11 @@
1
+ export { IdentifiableGraphQLTypeRepository, GraphQLDocumentRootTypeRepository, } from './identifiable-object-repository';
2
+ export { UnidentifiableGraphQLTypeRepository } from './unidentifiable-object-repository';
3
+ export { BaseInterfaceRepository, BaseUnionRepository } from './union-interface-repositories';
4
+ export { BaseGraphQLTypeRepository } from './base-object-repository';
5
+ export * from './field-defs';
6
+ export * from './types';
7
+ export { BaseScalarFieldDef, BaseObjectFieldDef } from './field-defs';
8
+ export { findExecutableOperation, buildGraphQLInputExtension, buildFieldKey, buildAugmentedFieldSelection, deepMerge, addTypenameToDocument, } from './utils';
9
+ export { GraphQLQueryJsonSchema } from './json-schema';
10
+ export * from './errors';
11
+ export { shouldSkip } from './directives';
@@ -0,0 +1,2 @@
1
+ import { JSONSchema } from '@conduit-client/jsonschema-validate';
2
+ export declare const GraphQLQueryJsonSchema: JSONSchema;
@@ -0,0 +1,8 @@
1
+ import { DenormalizeDataInput, NormalizeDataInput, TypeRepository } from '@conduit-client/type-normalization/v1';
2
+ import { AugmentSelectionsData, GraphQLInputExtension, GraphQLVariables } from './types';
3
+ import { FieldNode } from '@conduit-client/onestore-graphql-parser/v1';
4
+ import { Result } from '@conduit-client/utils';
5
+ export type GraphQLTypeRepository<Data = unknown, NormalizedData = unknown, ExtraInputExtension extends Record<string, any> = Record<string, unknown>> = TypeRepository<Data, DenormalizeDataInput<NormalizedData, GraphQLInputExtension & ExtraInputExtension>, NormalizedData, NormalizeDataInput<Data, NormalizedData, GraphQLInputExtension & ExtraInputExtension>> & {
6
+ augmentSelections(input: AugmentSelectionsData): AugmentSelectionsData;
7
+ buildFieldKey(selection: FieldNode, variables: GraphQLVariables): Result<string, Error>;
8
+ };
@@ -0,0 +1,2 @@
1
+ import { GraphQLTypeRepository } from './repository';
2
+ export type GraphQLTypeRegistry = Record<string, GraphQLTypeRepository>;
@@ -0,0 +1,52 @@
1
+ import { DocumentNode, FieldNode, FragmentDefinitionNode, SelectionNode, VariableDefinitionNode } from '@conduit-client/onestore-graphql-parser/v1';
2
+ import { QueryParams } from '@conduit-client/pagination';
3
+ export interface GraphQLRequestParams {
4
+ query: DocumentNode;
5
+ variables?: Record<string, any>;
6
+ operationName?: string;
7
+ }
8
+ export type AugmentSelectionsData = {
9
+ selections: SelectionNode[];
10
+ fragments: GraphQLFragmentDefinitions;
11
+ };
12
+ export type GraphQLInputExtension = {
13
+ readonly selections: SelectionNode[];
14
+ request: {
15
+ definitions: {
16
+ variables: GraphQLVariables;
17
+ fragments: GraphQLFragmentDefinitions;
18
+ };
19
+ };
20
+ readonly parentFieldSelection: FieldNode | undefined;
21
+ };
22
+ export type GraphQLFieldInputExtension = {
23
+ readonly selection: FieldNode;
24
+ request: {
25
+ definitions: {
26
+ variables: GraphQLVariables;
27
+ fragments: GraphQLFragmentDefinitions;
28
+ };
29
+ };
30
+ };
31
+ export type GraphQLConnectionRepositoryInputExtension = {
32
+ connectionQueryParams: QueryParams;
33
+ } & GraphQLInputExtension;
34
+ export interface GraphQLResponse<T extends GraphQLData = GraphQLData> {
35
+ data?: T;
36
+ errors?: Array<{
37
+ message?: string;
38
+ locations?: Array<{
39
+ line: number;
40
+ column: number;
41
+ }>;
42
+ path?: Array<string | number>;
43
+ extensions?: Record<string, any>;
44
+ }>;
45
+ extensions?: Record<string, any>;
46
+ }
47
+ export type GraphQLData<T extends Record<string, any> = Record<string, any>> = T;
48
+ export type GraphQLVariables = Record<string, {
49
+ definition: VariableDefinitionNode;
50
+ value: unknown;
51
+ }>;
52
+ export type GraphQLFragmentDefinitions = Record<string, FragmentDefinitionNode>;
@@ -0,0 +1,11 @@
1
+ import { Cache, ReadonlyCache } from '@conduit-client/service-cache/v1';
2
+ import { DenormalizeDataInput, NormalizeDataInput, ReadResult, WriteResult } from '@conduit-client/type-normalization/v1';
3
+ import { BaseGraphQLTypeRepository } from './base-object-repository';
4
+ import { GraphQLData, GraphQLInputExtension } from './types';
5
+ import { GraphQLTypeRepository } from './repository';
6
+ export declare abstract class UnidentifiableGraphQLTypeRepository<Data extends GraphQLData, NormalizedData extends GraphQLData, ExtraInputExtension extends Record<string, any> = Record<string, unknown>> extends BaseGraphQLTypeRepository<Data, NormalizedData, ExtraInputExtension> implements GraphQLTypeRepository {
7
+ protected services: {};
8
+ constructor(services: {});
9
+ write(cache: Cache, input: NormalizeDataInput<Data, NormalizedData, GraphQLInputExtension & ExtraInputExtension>): WriteResult<NormalizedData>;
10
+ read(cache: ReadonlyCache, input: DenormalizeDataInput<NormalizedData, GraphQLInputExtension & ExtraInputExtension>): ReadResult<Data>;
11
+ }
@@ -0,0 +1,38 @@
1
+ import { AugmentSelectionsData, GraphQLInputExtension, GraphQLVariables } from './types';
2
+ import { GraphQLTypeRepository } from './repository';
3
+ import { FieldDefs } from './field-defs';
4
+ import { FieldNode, SelectionNode } from '@conduit-client/onestore-graphql-parser/v1';
5
+ import { Cache, ReadonlyCache } from '@conduit-client/service-cache/v1';
6
+ import { DenormalizeDataInput, NormalizeDataInput, ReadErrors, ReadResult, WriteErrors, WriteResult } from '@conduit-client/type-normalization/v1';
7
+ import { Result } from '@conduit-client/utils';
8
+ export declare abstract class BaseInterfaceRepository<Data = unknown, NormalizedData = unknown, ExtraInputExtension extends Record<string, any> = Record<string, unknown>> implements GraphQLTypeRepository<Data, NormalizedData, ExtraInputExtension> {
9
+ protected services: {};
10
+ abstract namespace: string;
11
+ abstract typeName: string;
12
+ abstract get possibleTypes(): Record<string, GraphQLTypeRepository<any, any, ExtraInputExtension>>;
13
+ abstract fields: FieldDefs<Data, NormalizedData, ExtraInputExtension>;
14
+ constructor(services: {});
15
+ equals(x: unknown, y: unknown): boolean;
16
+ write(cache: Cache, input: NormalizeDataInput<Data, NormalizedData, GraphQLInputExtension & ExtraInputExtension>): WriteResult<NormalizedData>;
17
+ read(cache: ReadonlyCache, input: DenormalizeDataInput<NormalizedData, GraphQLInputExtension & ExtraInputExtension>): ReadResult<Data>;
18
+ augmentSelections(input: AugmentSelectionsData): AugmentSelectionsData;
19
+ protected getTypeDiscriminator(data: any, selections: SelectionNode[]): any;
20
+ protected verifyInterfaceFields(selections: readonly SelectionNode[]): (ReadErrors & WriteErrors) | void;
21
+ buildFieldKey(selection: FieldNode, variables: GraphQLVariables): Result<string, Error>;
22
+ protected getCacheKeyFieldArguments(selection: FieldNode): readonly import("@conduit-client/onestore-graphql-parser/v1").ArgumentNode[] | undefined;
23
+ }
24
+ export declare abstract class BaseUnionRepository<Data = unknown, NormalizedData = unknown, ExtraInputExtension extends Record<string, any> = Record<string, unknown>> implements GraphQLTypeRepository<Data, NormalizedData, ExtraInputExtension> {
25
+ protected services: {};
26
+ abstract namespace: string;
27
+ abstract typeName: string;
28
+ abstract get possibleTypes(): Record<string, GraphQLTypeRepository<any, any, ExtraInputExtension>>;
29
+ constructor(services: {});
30
+ equals(x: unknown, y: unknown): boolean;
31
+ write(cache: Cache, input: NormalizeDataInput<Data, NormalizedData, GraphQLInputExtension & ExtraInputExtension>): WriteResult<NormalizedData>;
32
+ read(cache: ReadonlyCache, input: DenormalizeDataInput<NormalizedData, GraphQLInputExtension & ExtraInputExtension>): ReadResult<Data>;
33
+ augmentSelections(input: AugmentSelectionsData): AugmentSelectionsData;
34
+ protected getTypeDiscriminator(data: any, selections: SelectionNode[]): any;
35
+ protected verifyUnionFields(selections: readonly SelectionNode[]): (ReadErrors & WriteErrors) | void;
36
+ buildFieldKey(selection: FieldNode, variables: GraphQLVariables): Result<string, Error>;
37
+ protected getCacheKeyFieldArguments(selection: FieldNode): readonly import("@conduit-client/onestore-graphql-parser/v1").ArgumentNode[] | undefined;
38
+ }
@@ -0,0 +1,21 @@
1
+ import { Result } from '@conduit-client/utils';
2
+ import { GraphQLFragmentDefinitions, GraphQLRequestParams, GraphQLVariables, GraphQLInputExtension } from './types';
3
+ import { ArgumentNode, FieldNode, FragmentDefinitionNode, OperationDefinitionNode, SelectionNode, ASTNode, DocumentNode, InlineFragmentNode, FragmentSpreadNode, DirectiveNode, ValueNode } from '@conduit-client/onestore-graphql-parser/v1';
4
+ export declare function deepMerge(target: Record<string, unknown>, ...sources: Record<string, unknown>[]): Record<string, unknown>;
5
+ export declare function findExecutableOperation(input: GraphQLRequestParams): Result<OperationDefinitionNode, Error>;
6
+ export declare function buildGraphQLInputExtension(input: GraphQLRequestParams): Result<GraphQLInputExtension, Error>;
7
+ export declare function buildAugmentedFieldSelection(newSelection: FieldNode, selections: SelectionNode[], fragments: GraphQLFragmentDefinitions): FieldNode | undefined;
8
+ export declare function selectionExists(selection: FieldNode, selections: SelectionNode[]): boolean;
9
+ export declare function selectionEquals(a: SelectionNode, b: SelectionNode): boolean;
10
+ export declare function argumentValueEquals(a: ValueNode, b: ValueNode): boolean;
11
+ export declare function directivesEqual(a: readonly DirectiveNode[] | undefined, b: readonly DirectiveNode[] | undefined): boolean;
12
+ export declare function argumentsEqual(a: readonly ArgumentNode[] | undefined, b: readonly ArgumentNode[] | undefined): boolean;
13
+ export declare function selectionSetsEqual(a: readonly SelectionNode[] | undefined, b: readonly SelectionNode[] | undefined): boolean;
14
+ export declare function getUniqueSelectionName(fieldName: string, selections: SelectionNode[], fragments: GraphQLFragmentDefinitions): string;
15
+ export declare function collectFieldNames(selections: SelectionNode[], fragments: GraphQLFragmentDefinitions): string[];
16
+ export declare function buildFieldKey(canonicalFieldName: string, fieldArguments: readonly ArgumentNode[] | undefined, variables: GraphQLVariables): Result<string, Error>;
17
+ export declare function addTypenameToDocument(doc: DocumentNode): DocumentNode;
18
+ export declare function isField(node: ASTNode): node is FieldNode;
19
+ export declare function isFragmentSpread(node: ASTNode): node is FragmentSpreadNode;
20
+ export declare function isInlineFragment(node: ASTNode): node is InlineFragmentNode;
21
+ export declare function isFragmentDefinition(node: ASTNode): node is FragmentDefinitionNode;
@@ -0,0 +1,61 @@
1
+ import { ArgumentNode, ValueNode } from '@conduit-client/onestore-graphql-parser/v1';
2
+ import { GraphQLVariables } from './types';
3
+ import { QueryParams } from '@conduit-client/pagination';
4
+ import { Result } from '@conduit-client/utils';
5
+ export type ExpectedType = {
6
+ type: 'string';
7
+ nullable?: false;
8
+ } | {
9
+ type: 'string';
10
+ nullable: true;
11
+ } | {
12
+ type: 'number';
13
+ nullable?: false;
14
+ } | {
15
+ type: 'number';
16
+ nullable: true;
17
+ } | {
18
+ type: 'boolean';
19
+ nullable?: false;
20
+ } | {
21
+ type: 'boolean';
22
+ nullable: true;
23
+ };
24
+ export declare function extractValue(valueNode: ValueNode, variableDefinitions: GraphQLVariables, expectedType: {
25
+ type: 'string';
26
+ nullable?: false;
27
+ }): Result<string, Error>;
28
+ export declare function extractValue(valueNode: ValueNode, variableDefinitions: GraphQLVariables, expectedType: {
29
+ type: 'string';
30
+ nullable: true;
31
+ }): Result<string | null, Error>;
32
+ export declare function extractValue(valueNode: ValueNode, variableDefinitions: GraphQLVariables, expectedType: {
33
+ type: 'number';
34
+ nullable?: false;
35
+ }): Result<number, Error>;
36
+ export declare function extractValue(valueNode: ValueNode, variableDefinitions: GraphQLVariables, expectedType: {
37
+ type: 'number';
38
+ nullable: true;
39
+ }): Result<number | null, Error>;
40
+ export declare function extractValue(valueNode: ValueNode, variableDefinitions: GraphQLVariables, expectedType: {
41
+ type: 'boolean';
42
+ nullable?: false;
43
+ }): Result<boolean, Error>;
44
+ export declare function extractValue(valueNode: ValueNode, variableDefinitions: GraphQLVariables, expectedType: {
45
+ type: 'boolean';
46
+ nullable: true;
47
+ }): Result<boolean | null, Error>;
48
+ export declare function extractValue(valueNode: ValueNode, variableDefinitions: GraphQLVariables): Result<unknown, Error>;
49
+ /**
50
+ * Helper function to extract and validate a pagination argument from GraphQL arguments
51
+ */
52
+ export declare function findArgumentNode(argName: string, args: readonly ArgumentNode[] | undefined): ArgumentNode | undefined;
53
+ /**
54
+ * Extracts and validates GraphQL connection pagination parameters into a standardized QueryParams object.
55
+ * Implements the Relay Cursor Pagination specification.
56
+ *
57
+ * @param args - The GraphQL arguments array from the query
58
+ * @param variables - The GraphQL variables object
59
+ * @returns QueryParams object with validated pagination parameters
60
+ */
61
+ export declare function extractConnectionQueryParams(args: readonly ArgumentNode[] | undefined, variables: GraphQLVariables): Result<QueryParams, Error>;