@tinacms/graphql 1.4.40 → 1.5.1

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.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
 
3
3
  */
4
- import { FieldDefinitionNode, ScalarTypeDefinitionNode, InputValueDefinitionNode, ObjectTypeDefinitionNode, InterfaceTypeDefinitionNode, NamedTypeNode, UnionTypeDefinitionNode, TypeDefinitionNode, DirectiveNode, EnumTypeDefinitionNode, InputObjectTypeDefinitionNode, DocumentNode, FragmentDefinitionNode, SelectionNode, FieldNode, InlineFragmentNode, OperationDefinitionNode } from 'graphql';
4
+ import { type FieldDefinitionNode, type ScalarTypeDefinitionNode, type InputValueDefinitionNode, type ObjectTypeDefinitionNode, type InterfaceTypeDefinitionNode, type NamedTypeNode, type UnionTypeDefinitionNode, type TypeDefinitionNode, type DirectiveNode, type EnumTypeDefinitionNode, type InputObjectTypeDefinitionNode, type DocumentNode, type FragmentDefinitionNode, type SelectionNode, type FieldNode, type InlineFragmentNode, type OperationDefinitionNode } from 'graphql';
5
5
  export declare const SysFieldDefinition: {
6
6
  kind: "Field";
7
7
  name: {
@@ -152,9 +152,9 @@ export declare const astBuilder: {
152
152
  definitions: TypeDefinitionNode[];
153
153
  }) => DocumentNode;
154
154
  };
155
- declare type scalarNames = 'string' | 'boolean' | 'datetime' | 'image' | 'text' | 'number';
156
- export declare const extractInlineTypes: (item: TypeDefinitionNode | TypeDefinitionNode[]) => TypeDefinitionNode[];
157
- export declare function walk(maybeNode: TypeDefinitionNode, visited?: WeakSet<object>): IterableIterator<TypeDefinitionNode>;
155
+ type scalarNames = 'string' | 'boolean' | 'datetime' | 'image' | 'text' | 'number';
156
+ export declare const extractInlineTypes: (item: TypeDefinitionNode | TypeDefinitionNode[]) => any;
157
+ export declare function walk(maybeNode: TypeDefinitionNode, visited?: WeakSet<WeakKey>): IterableIterator<TypeDefinitionNode>;
158
158
  export declare function addNamespaceToSchema<T extends object | string>(maybeNode: T, namespace?: string[]): T;
159
159
  export declare const NAMER: {
160
160
  dataFilterTypeNameOn: (namespace: string[]) => string;
@@ -1,5 +1,5 @@
1
1
  import { Collectable } from '@tinacms/schema-tools';
2
- export declare type HashOptions = {
2
+ export type HashOptions = {
3
3
  saltLength?: number;
4
4
  keyLength?: number;
5
5
  iterations?: number;
package/dist/build.d.ts CHANGED
@@ -1,8 +1,7 @@
1
1
  /**
2
2
 
3
3
  */
4
- import { TinaSchema, Config } from '@tinacms/schema-tools';
5
- import { LookupMapType } from './database';
4
+ import type { TinaSchema, Config } from '@tinacms/schema-tools';
6
5
  export declare const buildDotTinaFiles: ({ config, flags, buildSDK, }: {
7
6
  config: Config;
8
7
  flags?: string[];
@@ -10,10 +9,10 @@ export declare const buildDotTinaFiles: ({ config, flags, buildSDK, }: {
10
9
  }) => Promise<{
11
10
  graphQLSchema: {
12
11
  kind: "Document";
13
- definitions: import("graphql").TypeDefinitionNode[];
12
+ definitions: any;
14
13
  };
15
14
  tinaSchema: TinaSchema;
16
- lookup: Record<string, LookupMapType>;
15
+ lookup: Record<string, import("./database").LookupMapType>;
17
16
  fragDoc: string;
18
17
  queryDoc: string;
19
18
  }>;
@@ -1,6 +1,6 @@
1
1
  import { CallbackFsClient, PromiseFsClient } from 'isomorphic-git';
2
2
  import type { Bridge } from './index';
3
- export declare type IsomorphicGitBridgeOptions = {
3
+ export type IsomorphicGitBridgeOptions = {
4
4
  gitRoot: string;
5
5
  fsModule?: CallbackFsClient | PromiseFsClient;
6
6
  commitMessage?: string;
@@ -12,7 +12,7 @@ export declare enum OP {
12
12
  STARTS_WITH = "startsWith",
13
13
  IN = "in"
14
14
  }
15
- export declare type BinaryFilter = {
15
+ export type BinaryFilter = {
16
16
  pathExpression: string;
17
17
  rightOperand: FilterOperand;
18
18
  operator: OP.EQ | OP.GT | OP.LT | OP.GTE | OP.LTE | OP.STARTS_WITH | OP.IN;
@@ -20,7 +20,7 @@ export declare type BinaryFilter = {
20
20
  pad?: PadDefinition;
21
21
  list: boolean;
22
22
  };
23
- export declare type TernaryFilter = {
23
+ export type TernaryFilter = {
24
24
  pathExpression: string;
25
25
  leftOperand: FilterOperand;
26
26
  rightOperand: FilterOperand;
@@ -30,7 +30,7 @@ export declare type TernaryFilter = {
30
30
  pad?: PadDefinition;
31
31
  list: boolean;
32
32
  };
33
- export declare type IndexDefinition = {
33
+ export type IndexDefinition = {
34
34
  fields: {
35
35
  name: string;
36
36
  type?: string;
@@ -38,22 +38,22 @@ export declare type IndexDefinition = {
38
38
  list: boolean;
39
39
  }[];
40
40
  };
41
- export declare type PadDefinition = {
41
+ export type PadDefinition = {
42
42
  fillString: string;
43
43
  maxLength: number;
44
44
  };
45
- export declare type FilterOperand = string | number | boolean | string[] | number[];
46
- export declare type FilterCondition = {
45
+ export type FilterOperand = string | number | boolean | string[] | number[];
46
+ export type FilterCondition = {
47
47
  filterExpression: Record<string, FilterOperand>;
48
48
  filterPath: string;
49
49
  };
50
- declare type StringEscaper = <T extends string | string[]>(input: T) => T;
50
+ type StringEscaper = <T extends string | string[]>(input: T) => T;
51
51
  export declare const DEFAULT_COLLECTION_SORT_KEY = "__filepath__";
52
52
  export declare const DEFAULT_NUMERIC_LPAD = 4;
53
53
  export declare const coerceFilterChainOperands: (filterChain: (BinaryFilter | TernaryFilter)[], escapeString?: StringEscaper) => (BinaryFilter | TernaryFilter)[];
54
54
  export declare const makeFilter: ({ filterChain, }: {
55
55
  filterChain?: (BinaryFilter | TernaryFilter)[];
56
- }) => (values: Record<string, object | FilterOperand>) => boolean;
56
+ }) => ((values: Record<string, object | FilterOperand>) => boolean);
57
57
  export declare const makeFilterChain: ({ conditions, }: {
58
58
  conditions: FilterCondition[];
59
59
  }) => (BinaryFilter | TernaryFilter)[];
@@ -62,15 +62,15 @@ export declare const makeFilterSuffixes: (filterChain: (BinaryFilter | TernaryFi
62
62
  right?: string;
63
63
  } | undefined;
64
64
  export declare const FOLDER_ROOT = "~";
65
- declare type FolderTree = Record<string, Set<string>>;
65
+ type FolderTree = Record<string, Set<string>>;
66
66
  export declare class FolderTreeBuilder {
67
67
  _tree: FolderTree;
68
68
  constructor();
69
69
  get tree(): FolderTree;
70
70
  update(documentPath: string, collectionPath: string): any;
71
71
  }
72
- export declare const makeFolderOpsForCollection: <T extends object>(folderTree: FolderTree, collection: Collection<true>, indexDefinitions: Record<string, IndexDefinition>, opType: 'put' | 'del', level: Level, escapeStr?: StringEscaper) => BatchOp[];
73
- export declare const makeIndexOpsForDocument: <T extends object>(filepath: string, collection: string | undefined, indexDefinitions: Record<string, IndexDefinition>, data: T, opType: 'put' | 'del', level: Level, escapeStr?: StringEscaper) => BatchOp[];
72
+ export declare const makeFolderOpsForCollection: <T extends object>(folderTree: FolderTree, collection: Collection<true>, indexDefinitions: Record<string, IndexDefinition>, opType: "put" | "del", level: Level, escapeStr?: StringEscaper) => BatchOp[];
73
+ export declare const makeIndexOpsForDocument: <T extends object>(filepath: string, collection: string | undefined, indexDefinitions: Record<string, IndexDefinition>, data: T, opType: "put" | "del", level: Level, escapeStr?: StringEscaper) => BatchOp[];
74
74
  export declare const makeStringEscaper: (regex: RegExp, replacement: string) => StringEscaper;
75
75
  export declare const stringEscaper: StringEscaper;
76
76
  export {};
@@ -1,15 +1,15 @@
1
1
  import type { DocumentNode } from 'graphql';
2
2
  import type { Collection, CollectionTemplateable, Schema, TinaSchema } from '@tinacms/schema-tools';
3
3
  import type { Bridge } from './bridge';
4
- import { BinaryFilter, IndexDefinition, TernaryFilter } from './datalayer';
5
- import { Level } from './level';
6
- declare type IndexStatusEvent = {
4
+ import { type BinaryFilter, type IndexDefinition, type TernaryFilter } from './datalayer';
5
+ import { type Level } from './level';
6
+ type IndexStatusEvent = {
7
7
  status: 'inprogress' | 'complete' | 'failed';
8
8
  error?: Error;
9
9
  };
10
- declare type IndexStatusCallback = (event: IndexStatusEvent) => Promise<void>;
11
- export declare type OnPutCallback = (key: string, value: any) => Promise<void>;
12
- export declare type OnDeleteCallback = (key: string) => Promise<void>;
10
+ type IndexStatusCallback = (event: IndexStatusEvent) => Promise<void>;
11
+ export type OnPutCallback = (key: string, value: any) => Promise<void>;
12
+ export type OnDeleteCallback = (key: string) => Promise<void>;
13
13
  export interface DatabaseArgs {
14
14
  bridge?: Bridge;
15
15
  level: Level;
@@ -24,7 +24,7 @@ export interface GitProvider {
24
24
  onPut: (key: string, value: string) => Promise<void>;
25
25
  onDelete: (key: string) => Promise<void>;
26
26
  }
27
- export declare type CreateDatabase = Omit<DatabaseArgs, 'level' | 'onPut' | 'onDelete'> & {
27
+ export type CreateDatabase = Omit<DatabaseArgs, 'level' | 'onPut' | 'onDelete'> & {
28
28
  databaseAdapter: Level;
29
29
  gitProvider: GitProvider;
30
30
  /**
@@ -40,7 +40,7 @@ export declare type CreateDatabase = Omit<DatabaseArgs, 'level' | 'onPut' | 'onD
40
40
  */
41
41
  onDelete?: OnDeleteCallback;
42
42
  };
43
- export declare type CreateLocalDatabaseArgs = Omit<DatabaseArgs, 'level'> & {
43
+ export type CreateLocalDatabaseArgs = Omit<DatabaseArgs, 'level'> & {
44
44
  port?: number;
45
45
  rootPath?: string;
46
46
  };
@@ -48,7 +48,7 @@ export declare const createLocalDatabase: (config?: CreateLocalDatabaseArgs) =>
48
48
  export declare const createDatabase: (config: CreateDatabase) => Database;
49
49
  export declare const createDatabaseInternal: (config: DatabaseArgs) => Database;
50
50
  /** Options for {@link Database.query} **/
51
- export declare type QueryOptions = {
51
+ export type QueryOptions = {
52
52
  fileExtension?: string;
53
53
  collection: string;
54
54
  filterChain?: (BinaryFilter | TernaryFilter)[];
@@ -154,43 +154,43 @@ export declare class Database {
154
154
  warnings: string[];
155
155
  }>;
156
156
  }
157
- export declare type LookupMapType = GlobalDocumentLookup | CollectionDocumentLookup | CollectionFolderLookup | MultiCollectionDocumentLookup | MultiCollectionDocumentListLookup | CollectionDocumentListLookup | UnionDataLookup | NodeDocument;
158
- declare type NodeDocument = {
157
+ export type LookupMapType = GlobalDocumentLookup | CollectionDocumentLookup | CollectionFolderLookup | MultiCollectionDocumentLookup | MultiCollectionDocumentListLookup | CollectionDocumentListLookup | UnionDataLookup | NodeDocument;
158
+ type NodeDocument = {
159
159
  type: string;
160
160
  resolveType: 'nodeDocument';
161
161
  };
162
- declare type GlobalDocumentLookup = {
162
+ type GlobalDocumentLookup = {
163
163
  type: string;
164
164
  resolveType: 'globalDocument';
165
165
  collection: string;
166
166
  };
167
- declare type CollectionDocumentLookup = {
167
+ type CollectionDocumentLookup = {
168
168
  type: string;
169
169
  resolveType: 'collectionDocument';
170
170
  collection: string;
171
171
  };
172
- declare type CollectionFolderLookup = {
172
+ type CollectionFolderLookup = {
173
173
  type: string;
174
174
  resolveType: 'collectionFolder';
175
175
  collection: string;
176
176
  };
177
- declare type MultiCollectionDocumentLookup = {
177
+ type MultiCollectionDocumentLookup = {
178
178
  type: string;
179
179
  resolveType: 'multiCollectionDocument';
180
180
  createDocument: 'create';
181
181
  updateDocument: 'update';
182
182
  };
183
- declare type MultiCollectionDocumentListLookup = {
183
+ type MultiCollectionDocumentListLookup = {
184
184
  type: string;
185
185
  resolveType: 'multiCollectionDocumentList';
186
186
  collections: string[];
187
187
  };
188
- export declare type CollectionDocumentListLookup = {
188
+ export type CollectionDocumentListLookup = {
189
189
  type: string;
190
190
  resolveType: 'collectionDocumentList';
191
191
  collection: string;
192
192
  };
193
- declare type UnionDataLookup = {
193
+ type UnionDataLookup = {
194
194
  type: string;
195
195
  resolveType: 'unionData';
196
196
  collection?: string;
@@ -1,21 +1,20 @@
1
1
  /**
2
2
 
3
3
  */
4
- /// <reference types="node" />
5
4
  import { AbstractLevel, AbstractSublevel, AbstractSublevelOptions } from 'abstract-level';
6
- export declare type Level = AbstractLevel<Buffer | Uint8Array | string, string, Record<string, any>>;
7
- export declare type PutOp = {
5
+ export type Level = AbstractLevel<Buffer | Uint8Array | string, string, Record<string, any>>;
6
+ export type PutOp = {
8
7
  type: 'put';
9
8
  key: string;
10
9
  value: Record<string, any>;
11
10
  sublevel?: AbstractSublevel<Level, Buffer | Uint8Array | string, string, Record<string, any>>;
12
11
  };
13
- export declare type DelOp = {
12
+ export type DelOp = {
14
13
  type: 'del';
15
14
  key: string;
16
15
  sublevel?: AbstractSublevel<Level, Buffer | Uint8Array | string, string, Record<string, Record<string, any>>>;
17
16
  };
18
- export declare type BatchOp = PutOp | DelOp;
17
+ export type BatchOp = PutOp | DelOp;
19
18
  export declare const ARRAY_ITEM_VALUE_SEPARATOR = ",";
20
19
  export declare const INDEX_KEY_FIELD_SEPARATOR = "\u001D";
21
20
  export declare const CONTENT_ROOT_PREFIX = "~";
@@ -6,14 +6,14 @@ import { Collection, CollectionTemplateable, normalizePath, TinaSchema } from '@
6
6
  import { Bridge } from './bridge';
7
7
  export { normalizePath };
8
8
  export declare const stringifyFile: (content: object, format: FormatType | string, keepTemplateKey: boolean, markdownParseConfig?: {
9
- frontmatterFormat?: 'toml' | 'yaml' | 'json';
9
+ frontmatterFormat?: "toml" | "yaml" | "json";
10
10
  frontmatterDelimiters?: [string, string] | string;
11
11
  }) => string;
12
12
  export declare const parseFile: <T extends object>(content: string, format: FormatType | string, yupSchema: (args: typeof yup) => yup.ObjectSchema<any>, markdownParseConfig?: {
13
- frontmatterFormat?: 'toml' | 'yaml' | 'json';
13
+ frontmatterFormat?: "toml" | "yaml" | "json";
14
14
  frontmatterDelimiters?: [string, string] | string;
15
15
  }) => T;
16
- export declare type FormatType = 'json' | 'md' | 'mdx' | 'markdown';
16
+ export type FormatType = 'json' | 'md' | 'mdx' | 'markdown';
17
17
  export declare const atob: (b64Encoded: string) => string;
18
18
  export declare const btoa: (string: string) => string;
19
19
  export declare const scanAllContent: (tinaSchema: TinaSchema, bridge: Bridge, callback: (collection: Collection<true>, contentPaths: string[]) => Promise<void>) => Promise<string[]>;
package/dist/index.d.ts CHANGED
@@ -14,18 +14,18 @@ export { sequential, assertShape } from './util';
14
14
  export { loadAndParseWithAliases, stringifyFile, parseFile, scanAllContent, scanContentByPaths, transformDocument, } from './database/util';
15
15
  export { createSchema } from './schema/createSchema';
16
16
  export { buildDotTinaFiles };
17
- export declare type DummyType = unknown;
17
+ export type DummyType = unknown;
18
18
  export declare const buildSchema: (config: Config, flags?: string[]) => Promise<{
19
19
  graphQLSchema: {
20
20
  kind: "Document";
21
- definitions: import("graphql").TypeDefinitionNode[];
21
+ definitions: any;
22
22
  };
23
23
  tinaSchema: import("@tinacms/schema-tools").TinaSchema;
24
24
  lookup: Record<string, import("./database").LookupMapType>;
25
25
  fragDoc: string;
26
26
  queryDoc: string;
27
27
  }>;
28
- export declare type TinaSchema = Schema;
28
+ export type TinaSchema = Schema;
29
29
  export type { TinaTemplate, Schema, Collection };
30
30
  export { FilesystemBridge, AuditFileSystemBridge, } from './database/bridge/filesystem';
31
31
  export { IsomorphicBridge } from './database/bridge/isomorphic';