@tinacms/datalayer 0.0.1 → 0.0.2
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 +6 -0
- package/dist/database/bridge/filesystem.d.ts +6 -0
- package/dist/database/store/filesystem.d.ts +4 -1
- package/dist/database/store/index.d.ts +1 -3
- package/dist/index.d.ts +2 -5
- package/dist/index.js +53 -231
- package/package.json +2 -2
- package/dist/database/bridge/github.d.ts +0 -33
- package/dist/database/store/github.d.ts +0 -37
package/CHANGELOG.md
CHANGED
|
@@ -25,3 +25,9 @@ export declare class FilesystemBridge implements Bridge {
|
|
|
25
25
|
putConfig(filepath: string, data: string): Promise<void>;
|
|
26
26
|
put(filepath: string, data: string): Promise<void>;
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Same as the `FileSystemBridge` except it does not save files
|
|
30
|
+
*/
|
|
31
|
+
export declare class AuditFileSystemBridge extends FilesystemBridge {
|
|
32
|
+
put(_filepath: string, _data: string): Promise<void>;
|
|
33
|
+
}
|
|
@@ -24,5 +24,8 @@ export declare class FilesystemStore implements Store {
|
|
|
24
24
|
supportsSeeding(): boolean;
|
|
25
25
|
supportsIndexing(): boolean;
|
|
26
26
|
glob(pattern: string, callback: any): Promise<any[]>;
|
|
27
|
-
put(filepath: string, data: object): Promise<void>;
|
|
27
|
+
put(filepath: string, data: object, keepTemplateKey: boolean): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
export declare class AuditFilesystemStore extends FilesystemStore {
|
|
30
|
+
put(_filepath: string, _data: object): Promise<void>;
|
|
28
31
|
}
|
|
@@ -68,7 +68,5 @@ export interface Store {
|
|
|
68
68
|
* user's repo.
|
|
69
69
|
*/
|
|
70
70
|
supportsIndexing(): boolean;
|
|
71
|
-
put(filepath: string, data: object,
|
|
72
|
-
includeTemplate?: boolean;
|
|
73
|
-
}): Promise<void>;
|
|
71
|
+
put(filepath: string, data: object, keepTemplateKey: boolean): Promise<void>;
|
|
74
72
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,10 +10,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
10
10
|
See the License for the specific language governing permissions and
|
|
11
11
|
limitations under the License.
|
|
12
12
|
*/
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export { FilesystemBridge } from './database/bridge/filesystem';
|
|
16
|
-
export { FilesystemStore } from './database/store/filesystem';
|
|
13
|
+
export { FilesystemBridge, AuditFileSystemBridge, } from './database/bridge/filesystem';
|
|
14
|
+
export { FilesystemStore, AuditFilesystemStore, } from './database/store/filesystem';
|
|
17
15
|
export { MemoryStore } from './database/store/memory';
|
|
18
16
|
export { LevelStore } from './database/store/level';
|
|
19
|
-
export type { GithubManagerInit } from './database/bridge/github';
|
package/dist/index.js
CHANGED
|
@@ -51,112 +51,66 @@ var __toModule = (module2) => {
|
|
|
51
51
|
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
-
// pnp:/
|
|
54
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/datalayer/src/index.ts
|
|
55
55
|
__export(exports, {
|
|
56
|
+
AuditFileSystemBridge: () => AuditFileSystemBridge,
|
|
57
|
+
AuditFilesystemStore: () => AuditFilesystemStore,
|
|
56
58
|
FilesystemBridge: () => FilesystemBridge,
|
|
57
59
|
FilesystemStore: () => FilesystemStore,
|
|
58
|
-
GithubBridge: () => GithubBridge,
|
|
59
|
-
GithubStore: () => GithubStore,
|
|
60
60
|
LevelStore: () => LevelStore,
|
|
61
61
|
MemoryStore: () => MemoryStore
|
|
62
62
|
});
|
|
63
63
|
|
|
64
|
-
// pnp:/
|
|
65
|
-
var
|
|
64
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/datalayer/src/database/bridge/filesystem.ts
|
|
65
|
+
var import_fs_extra = __toModule(require("fs-extra"));
|
|
66
|
+
var import_fast_glob = __toModule(require("fast-glob"));
|
|
66
67
|
var import_path = __toModule(require("path"));
|
|
67
|
-
var
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
this.rootPath = rootPath;
|
|
72
|
-
this.repoConfig = {
|
|
73
|
-
owner,
|
|
74
|
-
repo,
|
|
75
|
-
ref
|
|
76
|
-
};
|
|
77
|
-
this.appOctoKit = new import_rest.Octokit({
|
|
78
|
-
auth: accessToken
|
|
79
|
-
});
|
|
68
|
+
var import_normalize_path = __toModule(require("normalize-path"));
|
|
69
|
+
var FilesystemBridge = class {
|
|
70
|
+
constructor(rootPath) {
|
|
71
|
+
this.rootPath = rootPath || "";
|
|
80
72
|
}
|
|
81
|
-
async
|
|
82
|
-
const
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const nestedItems = await this.readDir(d.path);
|
|
90
|
-
if (Array.isArray(nestedItems)) {
|
|
91
|
-
return nestedItems.map((nestedItem) => {
|
|
92
|
-
return import_path.default.join(d.path, nestedItem);
|
|
93
|
-
});
|
|
94
|
-
} else {
|
|
95
|
-
throw new Error(`Expected items to be an array of strings for readDir at ${d.path}`);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return d.path;
|
|
99
|
-
}));
|
|
100
|
-
}
|
|
101
|
-
throw new Error(`Expected to return an array from Github directory ${import_path.default}`);
|
|
73
|
+
async glob(pattern) {
|
|
74
|
+
const basePath = import_path.default.join(this.rootPath, ...pattern.split("/"));
|
|
75
|
+
const items = await (0, import_fast_glob.default)(import_path.default.join(basePath, "**", "/*").replace(/\\/g, "/"), {
|
|
76
|
+
dot: true
|
|
77
|
+
});
|
|
78
|
+
const posixRootPath = (0, import_normalize_path.default)(this.rootPath);
|
|
79
|
+
return items.map((item) => {
|
|
80
|
+
return item.replace(posixRootPath, "").replace(/^\/|\/$/g, "");
|
|
102
81
|
});
|
|
103
|
-
return import_lodash.default.flatten(repos);
|
|
104
82
|
}
|
|
105
83
|
supportsBuilding() {
|
|
106
|
-
return
|
|
107
|
-
}
|
|
108
|
-
async glob(pattern) {
|
|
109
|
-
const results = await this.readDir(pattern);
|
|
110
|
-
return results.map((item) => item.replace(this.rootPath, "").replace(/^\/|\/$/g, ""));
|
|
84
|
+
return true;
|
|
111
85
|
}
|
|
112
86
|
async get(filepath) {
|
|
113
|
-
|
|
114
|
-
return this.appOctoKit.repos.getContent(__spreadProps(__spreadValues({}, this.repoConfig), {
|
|
115
|
-
path: realpath
|
|
116
|
-
})).then((response) => {
|
|
117
|
-
return Buffer.from(response.data.content, "base64").toString();
|
|
118
|
-
}).catch((e) => {
|
|
119
|
-
if (e.status === 401) {
|
|
120
|
-
throw new import_graphql.GraphQLError(`Unauthorized request to Github Repository: '${this.repoConfig.owner}/${this.repoConfig.repo}', please ensure your access token is valid.`, null, null, null, null, e, { status: e.status });
|
|
121
|
-
}
|
|
122
|
-
throw new import_graphql.GraphQLError(`Unable to find record '${filepath}' in Github Repository: '${this.repoConfig.owner}/${this.repoConfig.repo}', Ref: '${this.repoConfig.ref}'`, null, null, null, null, e, { status: e.status });
|
|
123
|
-
});
|
|
87
|
+
return import_fs_extra.default.readFileSync(import_path.default.join(this.rootPath, filepath)).toString();
|
|
124
88
|
}
|
|
125
89
|
async putConfig(filepath, data) {
|
|
126
|
-
|
|
90
|
+
await this.put(filepath, data);
|
|
127
91
|
}
|
|
128
92
|
async put(filepath, data) {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
fileSha = fileContent.data.sha;
|
|
136
|
-
} catch (e) {
|
|
137
|
-
console.log("No file exists, creating new one");
|
|
138
|
-
}
|
|
139
|
-
await this.appOctoKit.repos.createOrUpdateFileContents(__spreadProps(__spreadValues({}, this.repoConfig), {
|
|
140
|
-
branch: this.repoConfig.ref,
|
|
141
|
-
path: realpath,
|
|
142
|
-
message: "Update from GraphQL client",
|
|
143
|
-
content: new Buffer(data).toString("base64"),
|
|
144
|
-
sha: fileSha
|
|
145
|
-
}));
|
|
93
|
+
await import_fs_extra.default.outputFileSync(import_path.default.join(this.rootPath, filepath), data);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
var AuditFileSystemBridge = class extends FilesystemBridge {
|
|
97
|
+
async put(_filepath, _data) {
|
|
98
|
+
return;
|
|
146
99
|
}
|
|
147
100
|
};
|
|
148
101
|
|
|
149
|
-
// pnp:/
|
|
150
|
-
var
|
|
102
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/datalayer/src/database/store/filesystem.ts
|
|
103
|
+
var import_fs_extra2 = __toModule(require("fs-extra"));
|
|
104
|
+
var import_fast_glob2 = __toModule(require("fast-glob"));
|
|
151
105
|
var import_path2 = __toModule(require("path"));
|
|
152
|
-
var
|
|
106
|
+
var import_normalize_path2 = __toModule(require("normalize-path"));
|
|
153
107
|
|
|
154
|
-
// pnp:/
|
|
108
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/datalayer/src/database/util.ts
|
|
155
109
|
var import_gray_matter = __toModule(require("gray-matter"));
|
|
156
110
|
|
|
157
|
-
// pnp:/
|
|
111
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/datalayer/src/util.ts
|
|
158
112
|
var yup = __toModule(require("yup"));
|
|
159
|
-
var
|
|
113
|
+
var import_graphql = __toModule(require("graphql"));
|
|
160
114
|
var sequential = async (items, callback) => {
|
|
161
115
|
const accum = [];
|
|
162
116
|
if (!items) {
|
|
@@ -181,13 +135,13 @@ function assertShape(value, yupSchema, errorMessage) {
|
|
|
181
135
|
shape.validateSync(value);
|
|
182
136
|
} catch (e) {
|
|
183
137
|
const message = errorMessage || `Failed to assertShape - ${e.message}`;
|
|
184
|
-
throw new
|
|
138
|
+
throw new import_graphql.GraphQLError(message, null, null, null, null, null, {
|
|
185
139
|
stack: e.stack
|
|
186
140
|
});
|
|
187
141
|
}
|
|
188
142
|
}
|
|
189
143
|
|
|
190
|
-
// pnp:/
|
|
144
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/datalayer/src/database/util.ts
|
|
191
145
|
var stringifyFile = (content, format, keepTemplateKey) => {
|
|
192
146
|
switch (format) {
|
|
193
147
|
case ".markdown":
|
|
@@ -242,144 +196,7 @@ var parseFile = (content, format, yupSchema) => {
|
|
|
242
196
|
}
|
|
243
197
|
};
|
|
244
198
|
|
|
245
|
-
// pnp:/
|
|
246
|
-
var import_graphql3 = __toModule(require("graphql"));
|
|
247
|
-
var GithubStore = class {
|
|
248
|
-
async clear() {
|
|
249
|
-
}
|
|
250
|
-
async print() {
|
|
251
|
-
}
|
|
252
|
-
constructor({ rootPath, accessToken, owner, repo, ref }) {
|
|
253
|
-
this.rootPath = rootPath;
|
|
254
|
-
this.repoConfig = {
|
|
255
|
-
owner,
|
|
256
|
-
repo,
|
|
257
|
-
ref
|
|
258
|
-
};
|
|
259
|
-
this.appOctoKit = new import_rest2.Octokit({
|
|
260
|
-
auth: accessToken
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
async query(queryStrings) {
|
|
264
|
-
throw new Error(`Unable to perform query for GithubStore`);
|
|
265
|
-
}
|
|
266
|
-
supportsSeeding() {
|
|
267
|
-
return false;
|
|
268
|
-
}
|
|
269
|
-
async seed() {
|
|
270
|
-
throw new Error(`Seeding data is not possible for Github data store`);
|
|
271
|
-
}
|
|
272
|
-
async readDir(filepath) {
|
|
273
|
-
const fullPath = import_path2.default.join(this.rootPath, filepath);
|
|
274
|
-
const repos = await this.appOctoKit.repos.getContent(__spreadProps(__spreadValues({}, this.repoConfig), {
|
|
275
|
-
path: fullPath
|
|
276
|
-
})).then(async (response) => {
|
|
277
|
-
if (Array.isArray(response.data)) {
|
|
278
|
-
return await Promise.all(await response.data.map(async (d) => {
|
|
279
|
-
if (d.type === "dir") {
|
|
280
|
-
const nestedItems = await this.readDir(d.path);
|
|
281
|
-
if (Array.isArray(nestedItems)) {
|
|
282
|
-
return nestedItems.map((nestedItem) => {
|
|
283
|
-
return import_path2.default.join(d.path, nestedItem);
|
|
284
|
-
});
|
|
285
|
-
} else {
|
|
286
|
-
throw new Error(`Expected items to be an array of strings for readDir at ${d.path}`);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
return d.path;
|
|
290
|
-
}));
|
|
291
|
-
}
|
|
292
|
-
throw new Error(`Expected to return an array from Github directory ${import_path2.default}`);
|
|
293
|
-
});
|
|
294
|
-
return import_lodash2.default.flatten(repos);
|
|
295
|
-
}
|
|
296
|
-
async glob(pattern, callback) {
|
|
297
|
-
const results = await this.readDir(pattern);
|
|
298
|
-
const items = results.map((item) => item.replace(this.rootPath, "").replace(/^\/|\/$/g, ""));
|
|
299
|
-
if (callback) {
|
|
300
|
-
return sequential(items, async (item) => {
|
|
301
|
-
return callback(item);
|
|
302
|
-
});
|
|
303
|
-
} else {
|
|
304
|
-
return items;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
async get(filepath) {
|
|
308
|
-
const realpath = import_path2.default.join(this.rootPath, filepath);
|
|
309
|
-
return this.appOctoKit.repos.getContent(__spreadProps(__spreadValues({}, this.repoConfig), {
|
|
310
|
-
path: realpath
|
|
311
|
-
})).then((response) => {
|
|
312
|
-
const responseString = Buffer.from(response.data.content, "base64").toString();
|
|
313
|
-
return parseFile(responseString, import_path2.default.extname(filepath), (yup2) => yup2.object());
|
|
314
|
-
}).catch((e) => {
|
|
315
|
-
if (e.status === 401) {
|
|
316
|
-
throw new import_graphql3.GraphQLError(`Unauthorized request to Github Repository: '${this.repoConfig.owner}/${this.repoConfig.repo}', please ensure your access token is valid.`, null, null, null, null, e, { status: e.status });
|
|
317
|
-
}
|
|
318
|
-
throw new import_graphql3.GraphQLError(`Unable to find record '${filepath}' in Github Repository: '${this.repoConfig.owner}/${this.repoConfig.repo}', Ref: '${this.repoConfig.ref}'`, null, null, null, null, e, { status: e.status });
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
supportsIndexing() {
|
|
322
|
-
return false;
|
|
323
|
-
}
|
|
324
|
-
async put(filepath, data) {
|
|
325
|
-
const realpath = import_path2.default.join(this.rootPath, filepath);
|
|
326
|
-
let fileSha = void 0;
|
|
327
|
-
try {
|
|
328
|
-
const fileContent = await this.appOctoKit.repos.getContent(__spreadProps(__spreadValues({}, this.repoConfig), {
|
|
329
|
-
path: realpath
|
|
330
|
-
}));
|
|
331
|
-
fileSha = fileContent.data.sha;
|
|
332
|
-
} catch (e) {
|
|
333
|
-
console.log("No file exists, creating new one");
|
|
334
|
-
}
|
|
335
|
-
await this.appOctoKit.repos.createOrUpdateFileContents(__spreadProps(__spreadValues({}, this.repoConfig), {
|
|
336
|
-
branch: this.repoConfig.ref,
|
|
337
|
-
path: realpath,
|
|
338
|
-
message: "Update from GraphQL client",
|
|
339
|
-
content: new Buffer(stringifyFile(data, import_path2.default.extname(filepath), false)).toString("base64"),
|
|
340
|
-
sha: fileSha
|
|
341
|
-
}));
|
|
342
|
-
}
|
|
343
|
-
};
|
|
344
|
-
|
|
345
|
-
// pnp:/Users/jeffsee/code/tinacms/packages/@tinacms/datalayer/src/database/bridge/filesystem.ts
|
|
346
|
-
var import_fs_extra = __toModule(require("fs-extra"));
|
|
347
|
-
var import_fast_glob = __toModule(require("fast-glob"));
|
|
348
|
-
var import_path3 = __toModule(require("path"));
|
|
349
|
-
var import_normalize_path = __toModule(require("normalize-path"));
|
|
350
|
-
var FilesystemBridge = class {
|
|
351
|
-
constructor(rootPath) {
|
|
352
|
-
this.rootPath = rootPath || "";
|
|
353
|
-
}
|
|
354
|
-
async glob(pattern) {
|
|
355
|
-
const basePath = import_path3.default.join(this.rootPath, ...pattern.split("/"));
|
|
356
|
-
const items = await (0, import_fast_glob.default)(import_path3.default.join(basePath, "**", "/*").replace(/\\/g, "/"), {
|
|
357
|
-
dot: true
|
|
358
|
-
});
|
|
359
|
-
const posixRootPath = (0, import_normalize_path.default)(this.rootPath);
|
|
360
|
-
return items.map((item) => {
|
|
361
|
-
return item.replace(posixRootPath, "").replace(/^\/|\/$/g, "");
|
|
362
|
-
});
|
|
363
|
-
}
|
|
364
|
-
supportsBuilding() {
|
|
365
|
-
return true;
|
|
366
|
-
}
|
|
367
|
-
async get(filepath) {
|
|
368
|
-
return import_fs_extra.default.readFileSync(import_path3.default.join(this.rootPath, filepath)).toString();
|
|
369
|
-
}
|
|
370
|
-
async putConfig(filepath, data) {
|
|
371
|
-
await this.put(filepath, data);
|
|
372
|
-
}
|
|
373
|
-
async put(filepath, data) {
|
|
374
|
-
await import_fs_extra.default.outputFileSync(import_path3.default.join(this.rootPath, filepath), data);
|
|
375
|
-
}
|
|
376
|
-
};
|
|
377
|
-
|
|
378
|
-
// pnp:/Users/jeffsee/code/tinacms/packages/@tinacms/datalayer/src/database/store/filesystem.ts
|
|
379
|
-
var import_fs_extra2 = __toModule(require("fs-extra"));
|
|
380
|
-
var import_fast_glob2 = __toModule(require("fast-glob"));
|
|
381
|
-
var import_path4 = __toModule(require("path"));
|
|
382
|
-
var import_normalize_path2 = __toModule(require("normalize-path"));
|
|
199
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/datalayer/src/database/store/filesystem.ts
|
|
383
200
|
var FilesystemStore = class {
|
|
384
201
|
async clear() {
|
|
385
202
|
}
|
|
@@ -395,7 +212,7 @@ var FilesystemStore = class {
|
|
|
395
212
|
throw new Error(`Seeding data is not possible for Filesystem store`);
|
|
396
213
|
}
|
|
397
214
|
async get(filepath) {
|
|
398
|
-
return parseFile(await import_fs_extra2.default.readFileSync(
|
|
215
|
+
return parseFile(await import_fs_extra2.default.readFileSync(import_path2.default.join(this.rootPath, filepath)).toString(), import_path2.default.extname(filepath), (yup2) => yup2.object());
|
|
399
216
|
}
|
|
400
217
|
supportsSeeding() {
|
|
401
218
|
return false;
|
|
@@ -404,8 +221,8 @@ var FilesystemStore = class {
|
|
|
404
221
|
return false;
|
|
405
222
|
}
|
|
406
223
|
async glob(pattern, callback) {
|
|
407
|
-
const basePath =
|
|
408
|
-
const itemsRaw = await (0, import_fast_glob2.default)(
|
|
224
|
+
const basePath = import_path2.default.join(this.rootPath, ...pattern.split("/"));
|
|
225
|
+
const itemsRaw = await (0, import_fast_glob2.default)(import_path2.default.join(basePath, "**", "/*").replace(/\\/g, "/"), {
|
|
409
226
|
dot: true
|
|
410
227
|
});
|
|
411
228
|
const posixRootPath = (0, import_normalize_path2.default)(this.rootPath);
|
|
@@ -420,12 +237,17 @@ var FilesystemStore = class {
|
|
|
420
237
|
return items;
|
|
421
238
|
}
|
|
422
239
|
}
|
|
423
|
-
async put(filepath, data) {
|
|
424
|
-
await import_fs_extra2.default.outputFileSync(
|
|
240
|
+
async put(filepath, data, keepTemplateKey) {
|
|
241
|
+
await import_fs_extra2.default.outputFileSync(import_path2.default.join(this.rootPath, filepath), stringifyFile(data, import_path2.default.extname(filepath), keepTemplateKey));
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
var AuditFilesystemStore = class extends FilesystemStore {
|
|
245
|
+
async put(_filepath, _data) {
|
|
246
|
+
return;
|
|
425
247
|
}
|
|
426
248
|
};
|
|
427
249
|
|
|
428
|
-
// pnp:/
|
|
250
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/datalayer/src/database/store/memory.ts
|
|
429
251
|
var MemoryStore = class {
|
|
430
252
|
constructor(rootPath, object = {}) {
|
|
431
253
|
this.map = object;
|
|
@@ -492,8 +314,8 @@ var MemoryStore = class {
|
|
|
492
314
|
}
|
|
493
315
|
};
|
|
494
316
|
|
|
495
|
-
// pnp:/
|
|
496
|
-
var
|
|
317
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/datalayer/src/database/store/level.ts
|
|
318
|
+
var import_path3 = __toModule(require("path"));
|
|
497
319
|
var import_level = __toModule(require("level"));
|
|
498
320
|
var import_levelup = __toModule(require("levelup"));
|
|
499
321
|
var import_memdown = __toModule(require("memdown"));
|
|
@@ -505,7 +327,7 @@ var LevelStore = class {
|
|
|
505
327
|
const db = (0, import_levelup.default)((0, import_encoding_down.default)((0, import_memdown.default)(), { valueEncoding: "json" }));
|
|
506
328
|
this.db = db;
|
|
507
329
|
} else {
|
|
508
|
-
const db = (0, import_level.default)(
|
|
330
|
+
const db = (0, import_level.default)(import_path3.default.join(rootPath, ".tina/__generated__/db"), {
|
|
509
331
|
valueEncoding: "json"
|
|
510
332
|
});
|
|
511
333
|
this.db = db;
|
|
@@ -600,10 +422,10 @@ var LevelStore = class {
|
|
|
600
422
|
};
|
|
601
423
|
// Annotate the CommonJS export names for ESM import in node:
|
|
602
424
|
0 && (module.exports = {
|
|
425
|
+
AuditFileSystemBridge,
|
|
426
|
+
AuditFilesystemStore,
|
|
603
427
|
FilesystemBridge,
|
|
604
428
|
FilesystemStore,
|
|
605
|
-
GithubBridge,
|
|
606
|
-
GithubStore,
|
|
607
429
|
LevelStore,
|
|
608
430
|
MemoryStore
|
|
609
431
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/datalayer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"directory": "packages/@tinacms/datalayer"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@tinacms/scripts": "0.50.
|
|
51
|
+
"@tinacms/scripts": "0.50.5",
|
|
52
52
|
"@types/fs-extra": "^9.0.2",
|
|
53
53
|
"@types/jest": "^26.0.4",
|
|
54
54
|
"@types/js-yaml": "^3.12.5",
|
|
@@ -1,33 +0,0 @@
|
|
|
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
|
-
import { Octokit } from '@octokit/rest';
|
|
14
|
-
import { Bridge } from '.';
|
|
15
|
-
export declare type GithubManagerInit = {
|
|
16
|
-
rootPath: string;
|
|
17
|
-
accessToken: string;
|
|
18
|
-
owner: string;
|
|
19
|
-
repo: string;
|
|
20
|
-
ref: string;
|
|
21
|
-
};
|
|
22
|
-
export declare class GithubBridge implements Bridge {
|
|
23
|
-
rootPath: string;
|
|
24
|
-
repoConfig: Pick<GithubManagerInit, 'owner' | 'ref' | 'repo'>;
|
|
25
|
-
appOctoKit: Octokit;
|
|
26
|
-
constructor({ rootPath, accessToken, owner, repo, ref }: GithubManagerInit);
|
|
27
|
-
private readDir;
|
|
28
|
-
supportsBuilding(): boolean;
|
|
29
|
-
glob(pattern: string): Promise<string[]>;
|
|
30
|
-
get(filepath: string): Promise<string>;
|
|
31
|
-
putConfig(filepath: string, data: string): Promise<void>;
|
|
32
|
-
put(filepath: string, data: string): Promise<void>;
|
|
33
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
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
|
-
import { Octokit } from '@octokit/rest';
|
|
14
|
-
import { Store } from '.';
|
|
15
|
-
export declare type GithubManagerInit = {
|
|
16
|
-
rootPath: string;
|
|
17
|
-
accessToken: string;
|
|
18
|
-
owner: string;
|
|
19
|
-
repo: string;
|
|
20
|
-
ref: string;
|
|
21
|
-
};
|
|
22
|
-
export declare class GithubStore implements Store {
|
|
23
|
-
rootPath: string;
|
|
24
|
-
repoConfig: Pick<GithubManagerInit, 'owner' | 'ref' | 'repo'>;
|
|
25
|
-
appOctoKit: Octokit;
|
|
26
|
-
clear(): Promise<void>;
|
|
27
|
-
print(): Promise<void>;
|
|
28
|
-
constructor({ rootPath, accessToken, owner, repo, ref }: GithubManagerInit);
|
|
29
|
-
query(queryStrings: string[]): Promise<object[]>;
|
|
30
|
-
supportsSeeding(): boolean;
|
|
31
|
-
seed(): Promise<void>;
|
|
32
|
-
private readDir;
|
|
33
|
-
glob(pattern: string, callback: any): Promise<any[]>;
|
|
34
|
-
get(filepath: string): Promise<never>;
|
|
35
|
-
supportsIndexing(): boolean;
|
|
36
|
-
put(filepath: string, data: object): Promise<void>;
|
|
37
|
-
}
|