@tinacms/graphql 3.0.0 → 4.0.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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  */
4
4
  import { BatchOp, Level } from './level';
5
- import type { Collection } from '@tinacms/schema-tools';
5
+ import type { Collection, TinaSchema } from '@tinacms/schema-tools';
6
6
  export declare enum OP {
7
7
  EQ = "eq",
8
8
  GT = "gt",
@@ -77,7 +77,7 @@ export declare class FolderTreeBuilder {
77
77
  }
78
78
  export declare const makeFolderOpsForCollection: <T extends object>(folderTree: FolderTree, collection: Collection<true>, indexDefinitions: Record<string, IndexDefinition>, opType: "put" | "del", level: Level, escapeStr?: StringEscaper) => BatchOp[];
79
79
  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[];
80
- export declare const makeRefOpsForDocument: <T extends object>(filepath: string, collection: string | undefined, references: Record<string, string[]> | undefined | null, data: T, opType: "put" | "del", level: Level) => BatchOp[];
80
+ export declare const makeRefOpsForDocument: <T extends object>(filepath: string, collectionName: string | undefined, tinaSchema: TinaSchema | undefined, data: T, opType: "put" | "del", level: Level) => BatchOp[];
81
81
  export declare const makeStringEscaper: (regex: RegExp, replacement: string) => StringEscaper;
82
82
  export declare const stringEscaper: StringEscaper;
83
83
  export {};
@@ -20,6 +20,16 @@ export interface DatabaseArgs {
20
20
  version?: boolean;
21
21
  namespace?: string;
22
22
  levelBatchSize?: number;
23
+ authCollection?: AuthCollectionOptions;
24
+ }
25
+ export interface AuthCollectionOptions {
26
+ /** Values of the uid field of users who can edit the auth collection. */
27
+ admins?: string[];
28
+ /**
29
+ * Allow writes to the auth collection from calls that pass no ctxUser.
30
+ * A null ctxUser means nobody is signed in, and is still refused.
31
+ */
32
+ allowUnauthenticatedWrites?: boolean;
23
33
  }
24
34
  export interface GitProvider {
25
35
  onPut: (key: string, value: string) => Promise<void>;
@@ -47,6 +57,10 @@ export type CreateLocalDatabaseArgs = Omit<DatabaseArgs, 'level'> & {
47
57
  };
48
58
  export declare const createLocalDatabase: (config?: CreateLocalDatabaseArgs) => Database;
49
59
  export declare const createDatabase: (config: CreateDatabase) => Database;
60
+ /**
61
+ * Builds a database for CLI tooling and tests. It trusts requests without a
62
+ * user, so do not use it for a public endpoint. Use `createDatabase` instead.
63
+ */
50
64
  export declare const createDatabaseInternal: (config: DatabaseArgs) => Database;
51
65
  /** Options for {@link Database.query} **/
52
66
  export type QueryOptions = {
@@ -71,6 +85,10 @@ export declare class Database {
71
85
  private readonly onPut;
72
86
  private readonly onDelete;
73
87
  private readonly levelBatchSize;
88
+ readonly authCollection: Readonly<{
89
+ admins: readonly string[];
90
+ allowUnauthenticatedWrites: boolean;
91
+ }>;
74
92
  private tinaSchema;
75
93
  private contentNamespace;
76
94
  private collectionIndexDefinitions;