@tinacms/graphql 1.4.28 → 1.4.30

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.
@@ -123,6 +123,7 @@ export declare const astBuilder: {
123
123
  CollectionDocumentUnion: string;
124
124
  Folder: string;
125
125
  String: string;
126
+ Password: string;
126
127
  Reference: string;
127
128
  Collection: string;
128
129
  ID: string;
@@ -0,0 +1,22 @@
1
+ import { Collectable } from '@tinacms/schema-tools';
2
+ export declare type HashOptions = {
3
+ saltLength?: number;
4
+ keyLength?: number;
5
+ iterations?: number;
6
+ digest?: 'sha256' | 'sha512';
7
+ };
8
+ export declare const generatePasswordHash: ({ password, opts: { saltLength, keyLength, iterations, digest, }, }: {
9
+ password: string;
10
+ opts?: HashOptions;
11
+ }) => Promise<string>;
12
+ export declare const checkPasswordHash: ({ saltedHash, password, opts: { saltLength, keyLength, iterations, digest, }, }: {
13
+ saltedHash: string;
14
+ password: string;
15
+ opts?: HashOptions;
16
+ }) => Promise<boolean>;
17
+ export declare const mapUserFields: (collectable: Collectable, prefix?: string[]) => {
18
+ path: string[];
19
+ collectable: Collectable;
20
+ idFieldName?: string;
21
+ passwordFieldName?: string;
22
+ }[];
@@ -148,6 +148,9 @@ export declare class Builder {
148
148
  * @param collection
149
149
  */
150
150
  collectionDocument: (collection: Collection<true>) => Promise<FieldDefinitionNode>;
151
+ authenticationCollectionDocument: (collection: Collection<true>) => Promise<FieldDefinitionNode>;
152
+ updatePasswordMutation: (collection: Collection<true>) => Promise<FieldDefinitionNode>;
153
+ authorizationCollectionDocument: (collection: Collection<true>) => Promise<FieldDefinitionNode>;
151
154
  /**
152
155
  * Turns a collection into a fragment that gets updated on build. This fragment does not resolve references
153
156
  * ```graphql
@@ -231,6 +234,7 @@ export declare class Builder {
231
234
  */
232
235
  buildStaticDefinitions: () => (import("graphql").ScalarTypeDefinitionNode | ObjectTypeDefinitionNode | import("graphql").InterfaceTypeDefinitionNode[])[];
233
236
  private _buildCollectionDocumentType;
237
+ private _buildAuthDocumentType;
234
238
  private _filterCollectionDocumentType;
235
239
  private _buildTemplateFilter;
236
240
  private _updateCollectionDocumentMutationType;
@@ -240,6 +244,7 @@ export declare class Builder {
240
244
  private _buildFieldFilter;
241
245
  private _buildFieldMutation;
242
246
  private _buildReferenceMutation;
247
+ private _buildPasswordMutation;
243
248
  private _buildUpdateDocumentMutationParams;
244
249
  private _buildObjectOrUnionData;
245
250
  private _connectionFilterBuilder;
@@ -69,7 +69,7 @@ export declare class FolderTreeBuilder {
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: IndexDefinition[], 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
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;
@@ -10,7 +10,7 @@ declare type IndexStatusEvent = {
10
10
  declare type IndexStatusCallback = (event: IndexStatusEvent) => Promise<void>;
11
11
  export declare type OnPutCallback = (key: string, value: any) => Promise<void>;
12
12
  export declare type OnDeleteCallback = (key: string) => Promise<void>;
13
- export declare type CreateDatabase = {
13
+ export interface DatabaseArgs {
14
14
  bridge?: Bridge;
15
15
  level: Level;
16
16
  onPut?: (key: string, value: any) => Promise<void>;
@@ -18,8 +18,35 @@ export declare type CreateDatabase = {
18
18
  tinaDirectory?: string;
19
19
  indexStatusCallback?: IndexStatusCallback;
20
20
  version?: boolean;
21
+ namespace?: string;
22
+ }
23
+ export interface GitProvider {
24
+ onPut: (key: string, value: string) => Promise<void>;
25
+ onDelete: (key: string) => Promise<void>;
26
+ }
27
+ export declare type CreateDatabase = Omit<DatabaseArgs, 'level' | 'onPut' | 'onDelete'> & {
28
+ databaseAdapter: Level;
29
+ gitProvider: GitProvider;
30
+ /**
31
+ * @deprecated Use databaseAdapter instead
32
+ */
33
+ level?: Level;
34
+ /**
35
+ * @deprecated Use gitProvider instead
36
+ */
37
+ onPut?: OnPutCallback;
38
+ /**
39
+ * @deprecated Use gitProvider instead
40
+ */
41
+ onDelete?: OnDeleteCallback;
42
+ };
43
+ export declare type CreateLocalDatabaseArgs = Omit<DatabaseArgs, 'level'> & {
44
+ port?: number;
45
+ rootPath?: string;
21
46
  };
47
+ export declare const createLocalDatabase: (config?: CreateLocalDatabaseArgs) => Database;
22
48
  export declare const createDatabase: (config: CreateDatabase) => Database;
49
+ export declare const createDatabaseInternal: (config: DatabaseArgs) => Database;
23
50
  /** Options for {@link Database.query} **/
24
51
  export declare type QueryOptions = {
25
52
  fileExtension?: string;
@@ -33,18 +60,20 @@ export declare type QueryOptions = {
33
60
  folder?: string;
34
61
  };
35
62
  export declare class Database {
36
- config: CreateDatabase;
63
+ config: DatabaseArgs;
37
64
  bridge?: Bridge;
38
65
  rootLevel: Level;
39
- level: Level | undefined;
66
+ appLevel: Level | undefined;
67
+ contentLevel: Level | undefined;
40
68
  tinaDirectory: string;
41
69
  indexStatusCallback: IndexStatusCallback | undefined;
42
- private onPut;
43
- private onDelete;
70
+ private readonly onPut;
71
+ private readonly onDelete;
44
72
  private tinaSchema;
73
+ private contentNamespace;
45
74
  private collectionIndexDefinitions;
46
75
  private _lookup;
47
- constructor(config: CreateDatabase);
76
+ constructor(config: DatabaseArgs);
48
77
  private collectionForPath;
49
78
  private getGeneratedFolder;
50
79
  private updateDatabaseVersion;
@@ -74,7 +103,7 @@ export declare class Database {
74
103
  defaultItem?: import("@tinacms/schema-tools").DefaultItem<Record<string, any>>;
75
104
  previewSrc?: string;
76
105
  };
77
- fields: ((import("@tinacms/schema-tools").StringField | import("@tinacms/schema-tools").NumberField | import("@tinacms/schema-tools").BooleanField | import("@tinacms/schema-tools").DateTimeField | import("@tinacms/schema-tools").ImageField | import("@tinacms/schema-tools").ReferenceField | import("@tinacms/schema-tools").RichTextField<false> | import("@tinacms/schema-tools").ObjectField<false>) & {})[];
106
+ fields: ((import("@tinacms/schema-tools").StringField | import("@tinacms/schema-tools").NumberField | import("@tinacms/schema-tools").BooleanField | import("@tinacms/schema-tools").DateTimeField | import("@tinacms/schema-tools").ImageField | import("@tinacms/schema-tools").ReferenceField | import("@tinacms/schema-tools").PasswordField | import("@tinacms/schema-tools").RichTextField<false> | import("@tinacms/schema-tools").ObjectField<false>) & {})[];
78
107
  };
79
108
  info: CollectionTemplateable;
80
109
  }>;
package/dist/index.d.ts CHANGED
@@ -3,11 +3,13 @@ import { buildDotTinaFiles } from './build';
3
3
  export { resolve } from './resolve';
4
4
  export { transformDocumentIntoPayload } from './resolver';
5
5
  export * from './resolver/error';
6
- export { createDatabase } from './database';
7
6
  export { TinaLevelClient } from './level/tinaLevel';
8
- export type { QueryOptions, Database, OnDeleteCallback, OnPutCallback, CreateDatabase, } from './database';
7
+ export type { Level } from './database/level';
8
+ export type { QueryOptions, OnDeleteCallback, OnPutCallback, DatabaseArgs, GitProvider, CreateDatabase, } from './database';
9
+ export { Database, createDatabaseInternal, createDatabase, createLocalDatabase, } from './database';
9
10
  import type { Config } from '@tinacms/schema-tools';
10
11
  export { getChangedFiles, getSha, shaExists } from './git';
12
+ export * from './auth/utils';
11
13
  export { sequential, assertShape } from './util';
12
14
  export { loadAndParseWithAliases, stringifyFile, parseFile, scanAllContent, scanContentByPaths, transformDocument, } from './database/util';
13
15
  export { createSchema } from './schema/createSchema';