@tinacms/graphql 0.0.0-2021111182621 → 0.0.0-2021111194859
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/CHANGELOG.md +1 -1
- package/dist/database/index.d.ts +1 -0
- package/dist/index.d.ts +244 -1
- package/dist/index.js +25 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/database/index.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ export declare class Database {
|
|
|
47
47
|
flush: (filepath: string) => Promise<string>;
|
|
48
48
|
getLookup: (returnType: string) => Promise<LookupMapType>;
|
|
49
49
|
getGraphQLSchema: () => Promise<DocumentNode>;
|
|
50
|
+
getGraphQLSchemaFromBridge: () => Promise<DocumentNode>;
|
|
50
51
|
getTinaSchema: () => Promise<TinaCloudSchemaBase>;
|
|
51
52
|
getSchema: () => Promise<TinaSchema>;
|
|
52
53
|
documentExists: (fullpath: unknown) => Promise<boolean>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,244 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
Copyright 2021 Forestry.io Holdings, Inc.
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software
|
|
8
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
9
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
10
|
+
See the License for the specific language governing permissions and
|
|
11
|
+
limitations under the License.
|
|
12
|
+
*/
|
|
13
|
+
export { indexDB } from './build';
|
|
14
|
+
export { resolve } from './resolve';
|
|
15
|
+
export { createDatabase } from './database';
|
|
16
|
+
export { GithubBridge } from './database/bridge/github';
|
|
17
|
+
export { GithubStore } from './database/store/github';
|
|
18
|
+
export { FilesystemBridge } from './database/bridge/filesystem';
|
|
19
|
+
export { FilesystemStore } from './database/store/filesystem';
|
|
20
|
+
export { MemoryStore } from './database/store/memory';
|
|
21
|
+
export { LevelStore } from './database/store/level';
|
|
22
|
+
export type { GithubManagerInit } from './database/bridge/github';
|
|
23
|
+
import type { Database } from './database';
|
|
24
|
+
export declare const buildSchema: (rootPath: string, database: Database) => Promise<import("graphql").GraphQLSchema>;
|
|
25
|
+
import type { TinaCloudSchema as TinaCloudSchemaBase, TinaCloudCollection as TinaCloudCollectionBase, TinaCloudTemplateBase as TinaTemplate, TinaFieldBase } from './types';
|
|
26
|
+
export declare const listBranches: ({ auth, owner, repo }: {
|
|
27
|
+
auth: any;
|
|
28
|
+
owner: any;
|
|
29
|
+
repo: any;
|
|
30
|
+
}) => Promise<import("@octokit/types").OctokitResponse<{
|
|
31
|
+
name: string;
|
|
32
|
+
commit: {
|
|
33
|
+
sha: string;
|
|
34
|
+
url: string;
|
|
35
|
+
};
|
|
36
|
+
protected: boolean;
|
|
37
|
+
protection?: {
|
|
38
|
+
url?: string;
|
|
39
|
+
enabled?: boolean;
|
|
40
|
+
required_status_checks?: {
|
|
41
|
+
url?: string;
|
|
42
|
+
enforcement_level?: string;
|
|
43
|
+
contexts: string[];
|
|
44
|
+
contexts_url?: string;
|
|
45
|
+
strict?: boolean;
|
|
46
|
+
};
|
|
47
|
+
enforce_admins?: {
|
|
48
|
+
url: string;
|
|
49
|
+
enabled: boolean;
|
|
50
|
+
};
|
|
51
|
+
required_pull_request_reviews?: {
|
|
52
|
+
url?: string;
|
|
53
|
+
dismissal_restrictions?: {
|
|
54
|
+
users?: {
|
|
55
|
+
name?: string;
|
|
56
|
+
email?: string;
|
|
57
|
+
login: string;
|
|
58
|
+
id: number;
|
|
59
|
+
node_id: string;
|
|
60
|
+
avatar_url: string;
|
|
61
|
+
gravatar_id: string;
|
|
62
|
+
url: string;
|
|
63
|
+
html_url: string;
|
|
64
|
+
followers_url: string;
|
|
65
|
+
following_url: string;
|
|
66
|
+
gists_url: string;
|
|
67
|
+
starred_url: string;
|
|
68
|
+
subscriptions_url: string;
|
|
69
|
+
organizations_url: string;
|
|
70
|
+
repos_url: string;
|
|
71
|
+
events_url: string;
|
|
72
|
+
received_events_url: string;
|
|
73
|
+
type: string;
|
|
74
|
+
site_admin: boolean;
|
|
75
|
+
starred_at?: string;
|
|
76
|
+
}[];
|
|
77
|
+
teams?: {
|
|
78
|
+
id: number;
|
|
79
|
+
node_id: string;
|
|
80
|
+
name: string;
|
|
81
|
+
slug: string;
|
|
82
|
+
description: string;
|
|
83
|
+
privacy?: string;
|
|
84
|
+
permission: string;
|
|
85
|
+
permissions?: {
|
|
86
|
+
pull: boolean;
|
|
87
|
+
triage: boolean;
|
|
88
|
+
push: boolean;
|
|
89
|
+
maintain: boolean;
|
|
90
|
+
admin: boolean;
|
|
91
|
+
};
|
|
92
|
+
url: string;
|
|
93
|
+
html_url: string;
|
|
94
|
+
members_url: string;
|
|
95
|
+
repositories_url: string;
|
|
96
|
+
parent: {
|
|
97
|
+
id: number;
|
|
98
|
+
node_id: string;
|
|
99
|
+
url: string;
|
|
100
|
+
members_url: string;
|
|
101
|
+
name: string;
|
|
102
|
+
description: string;
|
|
103
|
+
permission: string;
|
|
104
|
+
privacy?: string;
|
|
105
|
+
html_url: string;
|
|
106
|
+
repositories_url: string;
|
|
107
|
+
slug: string;
|
|
108
|
+
ldap_dn?: string;
|
|
109
|
+
};
|
|
110
|
+
}[];
|
|
111
|
+
url?: string;
|
|
112
|
+
users_url?: string;
|
|
113
|
+
teams_url?: string;
|
|
114
|
+
};
|
|
115
|
+
dismiss_stale_reviews: boolean;
|
|
116
|
+
require_code_owner_reviews: boolean;
|
|
117
|
+
required_approving_review_count?: number;
|
|
118
|
+
};
|
|
119
|
+
restrictions?: {
|
|
120
|
+
url: string;
|
|
121
|
+
users_url: string;
|
|
122
|
+
teams_url: string;
|
|
123
|
+
apps_url: string;
|
|
124
|
+
users: {
|
|
125
|
+
login?: string;
|
|
126
|
+
id?: number;
|
|
127
|
+
node_id?: string;
|
|
128
|
+
avatar_url?: string;
|
|
129
|
+
gravatar_id?: string;
|
|
130
|
+
url?: string;
|
|
131
|
+
html_url?: string;
|
|
132
|
+
followers_url?: string;
|
|
133
|
+
following_url?: string;
|
|
134
|
+
gists_url?: string;
|
|
135
|
+
starred_url?: string;
|
|
136
|
+
subscriptions_url?: string;
|
|
137
|
+
organizations_url?: string;
|
|
138
|
+
repos_url?: string;
|
|
139
|
+
events_url?: string;
|
|
140
|
+
received_events_url?: string;
|
|
141
|
+
type?: string;
|
|
142
|
+
site_admin?: boolean;
|
|
143
|
+
}[];
|
|
144
|
+
teams: {
|
|
145
|
+
id?: number;
|
|
146
|
+
node_id?: string;
|
|
147
|
+
url?: string;
|
|
148
|
+
html_url?: string;
|
|
149
|
+
name?: string;
|
|
150
|
+
slug?: string;
|
|
151
|
+
description?: string;
|
|
152
|
+
privacy?: string;
|
|
153
|
+
permission?: string;
|
|
154
|
+
members_url?: string;
|
|
155
|
+
repositories_url?: string;
|
|
156
|
+
parent?: string;
|
|
157
|
+
}[];
|
|
158
|
+
apps: {
|
|
159
|
+
id?: number;
|
|
160
|
+
slug?: string;
|
|
161
|
+
node_id?: string;
|
|
162
|
+
owner?: {
|
|
163
|
+
login?: string;
|
|
164
|
+
id?: number;
|
|
165
|
+
node_id?: string;
|
|
166
|
+
url?: string;
|
|
167
|
+
repos_url?: string;
|
|
168
|
+
events_url?: string;
|
|
169
|
+
hooks_url?: string;
|
|
170
|
+
issues_url?: string;
|
|
171
|
+
members_url?: string;
|
|
172
|
+
public_members_url?: string;
|
|
173
|
+
avatar_url?: string;
|
|
174
|
+
description?: string;
|
|
175
|
+
gravatar_id?: string;
|
|
176
|
+
html_url?: string;
|
|
177
|
+
followers_url?: string;
|
|
178
|
+
following_url?: string;
|
|
179
|
+
gists_url?: string;
|
|
180
|
+
starred_url?: string;
|
|
181
|
+
subscriptions_url?: string;
|
|
182
|
+
organizations_url?: string;
|
|
183
|
+
received_events_url?: string;
|
|
184
|
+
type?: string;
|
|
185
|
+
site_admin?: boolean;
|
|
186
|
+
};
|
|
187
|
+
name?: string;
|
|
188
|
+
description?: string;
|
|
189
|
+
external_url?: string;
|
|
190
|
+
html_url?: string;
|
|
191
|
+
created_at?: string;
|
|
192
|
+
updated_at?: string;
|
|
193
|
+
permissions?: {
|
|
194
|
+
metadata?: string;
|
|
195
|
+
contents?: string;
|
|
196
|
+
issues?: string;
|
|
197
|
+
single_file?: string;
|
|
198
|
+
};
|
|
199
|
+
events?: string[];
|
|
200
|
+
}[];
|
|
201
|
+
};
|
|
202
|
+
required_linear_history?: {
|
|
203
|
+
enabled?: boolean;
|
|
204
|
+
};
|
|
205
|
+
allow_force_pushes?: {
|
|
206
|
+
enabled?: boolean;
|
|
207
|
+
};
|
|
208
|
+
allow_deletions?: {
|
|
209
|
+
enabled?: boolean;
|
|
210
|
+
};
|
|
211
|
+
required_conversation_resolution?: {
|
|
212
|
+
enabled?: boolean;
|
|
213
|
+
};
|
|
214
|
+
name?: string;
|
|
215
|
+
protection_url?: string;
|
|
216
|
+
required_signatures?: {
|
|
217
|
+
url: string;
|
|
218
|
+
enabled: boolean;
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
protection_url?: string;
|
|
222
|
+
}[], 200>>;
|
|
223
|
+
export declare const createBranch: ({ auth, owner, repo, name, baseBranch }: {
|
|
224
|
+
auth: any;
|
|
225
|
+
owner: any;
|
|
226
|
+
repo: any;
|
|
227
|
+
name: any;
|
|
228
|
+
baseBranch: any;
|
|
229
|
+
}) => Promise<import("@octokit/types").OctokitResponse<{
|
|
230
|
+
ref: string;
|
|
231
|
+
node_id: string;
|
|
232
|
+
url: string;
|
|
233
|
+
object: {
|
|
234
|
+
type: string;
|
|
235
|
+
sha: string;
|
|
236
|
+
url: string;
|
|
237
|
+
};
|
|
238
|
+
}, 201>>;
|
|
239
|
+
export declare type TinaCloudSchema = TinaCloudSchemaBase<false>;
|
|
240
|
+
export declare type TinaSchema = TinaCloudSchema;
|
|
241
|
+
export declare type TinaCloudCollection = TinaCloudCollectionBase<false>;
|
|
242
|
+
export declare type TinaCollection = TinaCloudCollectionBase<false>;
|
|
243
|
+
export declare type TinaField = TinaFieldBase;
|
|
244
|
+
export type { TinaTemplate };
|
package/dist/index.js
CHANGED
|
@@ -23238,14 +23238,27 @@ var Database = class {
|
|
|
23238
23238
|
return stringifiedFile;
|
|
23239
23239
|
};
|
|
23240
23240
|
this.getLookup = async (returnType) => {
|
|
23241
|
+
console.log("get lookup");
|
|
23241
23242
|
const lookupPath = import_path4.default.join(GENERATED_FOLDER, `_lookup.json`);
|
|
23242
23243
|
if (!this._lookup) {
|
|
23243
|
-
const _lookup = await this.
|
|
23244
|
-
|
|
23244
|
+
const _lookup = await this.store.get(lookupPath);
|
|
23245
|
+
console.log("gotit", _lookup);
|
|
23246
|
+
this._lookup = _lookup;
|
|
23245
23247
|
}
|
|
23246
23248
|
return this._lookup[returnType];
|
|
23247
23249
|
};
|
|
23248
23250
|
this.getGraphQLSchema = async () => {
|
|
23251
|
+
console.log("get gql schema");
|
|
23252
|
+
const graphqlPath = import_path4.default.join(GENERATED_FOLDER, `_graphql.json`);
|
|
23253
|
+
console.log("at path", graphqlPath);
|
|
23254
|
+
if (!this._graphql) {
|
|
23255
|
+
const _graphql = await this.store.get(graphqlPath);
|
|
23256
|
+
console.log("got it", _graphql);
|
|
23257
|
+
this._graphql = _graphql;
|
|
23258
|
+
}
|
|
23259
|
+
return this._graphql;
|
|
23260
|
+
};
|
|
23261
|
+
this.getGraphQLSchemaFromBridge = async () => {
|
|
23249
23262
|
const graphqlPath = import_path4.default.join(GENERATED_FOLDER, `_graphql.json`);
|
|
23250
23263
|
if (!this._graphql) {
|
|
23251
23264
|
const _graphql = await this.bridge.get(graphqlPath);
|
|
@@ -23254,10 +23267,12 @@ var Database = class {
|
|
|
23254
23267
|
return this._graphql;
|
|
23255
23268
|
};
|
|
23256
23269
|
this.getTinaSchema = async () => {
|
|
23270
|
+
console.log("get tina schema");
|
|
23257
23271
|
const schemaPath = import_path4.default.join(GENERATED_FOLDER, `_schema.json`);
|
|
23258
23272
|
if (!this._tinaSchema) {
|
|
23259
|
-
const _tinaSchema = await this.
|
|
23260
|
-
|
|
23273
|
+
const _tinaSchema = await this.store.get(schemaPath);
|
|
23274
|
+
console.log("got it", _tinaSchema);
|
|
23275
|
+
this._tinaSchema = _tinaSchema;
|
|
23261
23276
|
}
|
|
23262
23277
|
return this._tinaSchema;
|
|
23263
23278
|
};
|
|
@@ -23291,10 +23306,13 @@ var Database = class {
|
|
|
23291
23306
|
const schemaPath = import_path4.default.join(GENERATED_FOLDER, `_schema.json`);
|
|
23292
23307
|
await this.bridge.putConfig(graphqlPath, JSON.stringify(graphQLSchema, null, 2));
|
|
23293
23308
|
await this.bridge.putConfig(schemaPath, JSON.stringify(tinaSchema.schema, null, 2));
|
|
23309
|
+
const lookup = JSON.parse(await this.bridge.get(import_path4.default.join(GENERATED_FOLDER, "_lookup.json")));
|
|
23294
23310
|
if (this.store.supportsSeeding()) {
|
|
23295
23311
|
this.store.clear();
|
|
23296
|
-
|
|
23297
|
-
await this.store.seed("
|
|
23312
|
+
console.log("seeding db");
|
|
23313
|
+
await this.store.seed(import_path4.default.join(GENERATED_FOLDER, "_graphql.json"), graphQLSchema);
|
|
23314
|
+
await this.store.seed(import_path4.default.join(GENERATED_FOLDER, "_schema.json"), tinaSchema.schema);
|
|
23315
|
+
await this.store.seed(import_path4.default.join(GENERATED_FOLDER, "_lookup.json"), lookup);
|
|
23298
23316
|
await _indexContent(tinaSchema, this);
|
|
23299
23317
|
} else {
|
|
23300
23318
|
if (this.store.supportsIndexing()) {
|
|
@@ -23881,7 +23899,7 @@ var buildSchema = async (rootPath, database) => {
|
|
|
23881
23899
|
const config = await import_fs_extra4.default.readFileSync(import_path10.default.join(tempConfig, "schema.json")).toString();
|
|
23882
23900
|
await import_fs_extra4.default.rmdir(tempConfig, { recursive: true });
|
|
23883
23901
|
await indexDB({ database, config: JSON.parse(config) });
|
|
23884
|
-
const gqlAst = await database.
|
|
23902
|
+
const gqlAst = await database.getGraphQLSchemaFromBridge();
|
|
23885
23903
|
return (0, import_graphql7.buildASTSchema)(gqlAst);
|
|
23886
23904
|
};
|
|
23887
23905
|
var listBranches = async ({ auth, owner, repo }) => {
|