@tinacms/datalayer 0.2.2 → 0.2.3

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.
Files changed (2) hide show
  1. package/dist/index.js +19 -9
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -127,6 +127,7 @@ var import_fs_extra2 = __toModule(require("fs-extra"));
127
127
  var import_glob_parent = __toModule(require("glob-parent"));
128
128
  var import_normalize_path2 = __toModule(require("normalize-path"));
129
129
  var import_graphql = __toModule(require("graphql"));
130
+ var import_path2 = __toModule(require("path"));
130
131
  var flat = typeof Array.prototype.flat === "undefined" ? (entries) => entries.reduce((acc, x) => acc.concat(x), []) : (entries) => entries.flat();
131
132
  var toUint8Array = (buf) => {
132
133
  const ab = new ArrayBuffer(buf.length);
@@ -215,9 +216,18 @@ var IsomorphicBridge = class {
215
216
  let pathParts = path4.split("/");
216
217
  const result = await import_isomorphic_git.default.walk(__spreadProps(__spreadValues({}, this.isomorphicConfig), {
217
218
  map: async (filepath, [head]) => {
218
- if (head._fullpath === "." || path4.startsWith(filepath)) {
219
+ if (head._fullpath === ".") {
219
220
  return head;
220
221
  }
222
+ if (path4.startsWith(filepath)) {
223
+ if ((0, import_path2.dirname)(path4) === (0, import_path2.dirname)(filepath)) {
224
+ if (path4 === filepath) {
225
+ return head;
226
+ }
227
+ } else {
228
+ return head;
229
+ }
230
+ }
221
231
  },
222
232
  cache: this.cache,
223
233
  trees: [import_isomorphic_git.default.TREE({ ref })]
@@ -441,7 +451,7 @@ var IsomorphicBridge = class {
441
451
  // src/database/store/filesystem.ts
442
452
  var import_fs_extra3 = __toModule(require("fs-extra"));
443
453
  var import_fast_glob2 = __toModule(require("fast-glob"));
444
- var import_path2 = __toModule(require("path"));
454
+ var import_path3 = __toModule(require("path"));
445
455
  var import_normalize_path3 = __toModule(require("normalize-path"));
446
456
 
447
457
  // src/database/util.ts
@@ -557,7 +567,7 @@ var FilesystemStore = class {
557
567
  throw new Error(`Seeding data is not possible for Filesystem store`);
558
568
  }
559
569
  async get(filepath) {
560
- return parseFile(await import_fs_extra3.default.readFileSync(import_path2.default.join(this.rootPath, filepath)).toString(), import_path2.default.extname(filepath), (yup2) => yup2.object());
570
+ return parseFile(await import_fs_extra3.default.readFileSync(import_path3.default.join(this.rootPath, filepath)).toString(), import_path3.default.extname(filepath), (yup2) => yup2.object());
561
571
  }
562
572
  supportsSeeding() {
563
573
  return false;
@@ -566,8 +576,8 @@ var FilesystemStore = class {
566
576
  return false;
567
577
  }
568
578
  async glob(pattern, callback, extension) {
569
- const basePath = import_path2.default.join(this.rootPath, ...pattern.split("/"));
570
- const itemsRaw = await (0, import_fast_glob2.default)(import_path2.default.join(basePath, "**", `/*${extension}`).replace(/\\/g, "/"), {
579
+ const basePath = import_path3.default.join(this.rootPath, ...pattern.split("/"));
580
+ const itemsRaw = await (0, import_fast_glob2.default)(import_path3.default.join(basePath, "**", `/*${extension}`).replace(/\\/g, "/"), {
571
581
  dot: true
572
582
  });
573
583
  const posixRootPath = (0, import_normalize_path3.default)(this.rootPath);
@@ -583,14 +593,14 @@ var FilesystemStore = class {
583
593
  }
584
594
  }
585
595
  async put(filepath, data, options) {
586
- await import_fs_extra3.default.outputFileSync(import_path2.default.join(this.rootPath, filepath), stringifyFile(data, import_path2.default.extname(filepath), options.keepTemplateKey));
596
+ await import_fs_extra3.default.outputFileSync(import_path3.default.join(this.rootPath, filepath), stringifyFile(data, import_path3.default.extname(filepath), options.keepTemplateKey));
587
597
  }
588
598
  async open() {
589
599
  }
590
600
  async close() {
591
601
  }
592
602
  async delete(filepath) {
593
- await import_fs_extra3.default.remove(import_path2.default.join(this.rootPath, filepath));
603
+ await import_fs_extra3.default.remove(import_path3.default.join(this.rootPath, filepath));
594
604
  }
595
605
  };
596
606
  var AuditFilesystemStore = class extends FilesystemStore {
@@ -943,7 +953,7 @@ var makeKeyForField = (definition, data, stringEscaper, maxStringLength = 100) =
943
953
  };
944
954
 
945
955
  // src/database/store/level.ts
946
- var import_path3 = __toModule(require("path"));
956
+ var import_path4 = __toModule(require("path"));
947
957
  var import_level = __toModule(require("level"));
948
958
  var import_levelup = __toModule(require("levelup"));
949
959
  var import_memdown = __toModule(require("memdown"));
@@ -957,7 +967,7 @@ var LevelStore = class {
957
967
  if (useMemory) {
958
968
  this.db = (0, import_levelup.default)((0, import_encoding_down.default)((0, import_memdown.default)(), { valueEncoding: "json" }));
959
969
  } else {
960
- this.db = (0, import_level.default)(import_path3.default.join(rootPath, ".tina/__generated__/db"), {
970
+ this.db = (0, import_level.default)(import_path4.default.join(rootPath, ".tina/__generated__/db"), {
961
971
  valueEncoding: "json"
962
972
  });
963
973
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/datalayer",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "files": [
@@ -47,7 +47,7 @@
47
47
  "directory": "packages/@tinacms/datalayer"
48
48
  },
49
49
  "devDependencies": {
50
- "@tinacms/scripts": "0.50.9",
50
+ "@tinacms/scripts": "0.51.1",
51
51
  "@types/fs-extra": "^9.0.2",
52
52
  "@types/jest": "^27.4.1",
53
53
  "@types/js-yaml": "^3.12.5",