@tinacms/graphql 1.4.7 → 1.4.9

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/dist/index.js CHANGED
@@ -506,6 +506,7 @@ var astBuilder = {
506
506
  },
507
507
  MultiCollectionDocument: "DocumentNode",
508
508
  CollectionDocumentUnion: "DocumentUnion",
509
+ Folder: "Folder",
509
510
  String: "String",
510
511
  Reference: "Reference",
511
512
  Collection: "Collection",
@@ -1274,6 +1275,21 @@ var scalarDefinitions = [
1274
1275
  })
1275
1276
  ]
1276
1277
  }),
1278
+ astBuilder.ObjectTypeDefinition({
1279
+ name: astBuilder.TYPES.Folder,
1280
+ fields: [
1281
+ astBuilder.FieldDefinition({
1282
+ name: "name",
1283
+ required: true,
1284
+ type: astBuilder.TYPES.String
1285
+ }),
1286
+ astBuilder.FieldDefinition({
1287
+ name: "path",
1288
+ required: true,
1289
+ type: astBuilder.TYPES.String
1290
+ })
1291
+ ]
1292
+ }),
1277
1293
  astBuilder.ObjectTypeDefinition({
1278
1294
  name: "PageInfo",
1279
1295
  fields: [
@@ -1326,7 +1342,8 @@ var Builder = class {
1326
1342
  namespace: ["document"],
1327
1343
  nodeType: astBuilder.TYPES.MultiCollectionDocument,
1328
1344
  collections,
1329
- connectionNamespace: ["document"]
1345
+ connectionNamespace: ["document"],
1346
+ includeFolderFilter: true
1330
1347
  });
1331
1348
  const type = astBuilder.ObjectTypeDefinition({
1332
1349
  name: typeName,
@@ -1425,7 +1442,8 @@ var Builder = class {
1425
1442
  ];
1426
1443
  const type = await this._buildMultiCollectionDocumentDefinition({
1427
1444
  fieldName: astBuilder.TYPES.MultiCollectionDocument,
1428
- collections
1445
+ collections,
1446
+ includeFolderType: true
1429
1447
  });
1430
1448
  return astBuilder.FieldDefinition({
1431
1449
  name,
@@ -1856,7 +1874,8 @@ var Builder = class {
1856
1874
  };
1857
1875
  this._buildMultiCollectionDocumentDefinition = async ({
1858
1876
  fieldName,
1859
- collections
1877
+ collections,
1878
+ includeFolderType
1860
1879
  }) => {
1861
1880
  const types = [];
1862
1881
  collections.forEach((collection) => {
@@ -1866,14 +1885,14 @@ var Builder = class {
1866
1885
  }
1867
1886
  if (collection.templates) {
1868
1887
  collection.templates.forEach((template) => {
1869
- if (typeof template === "string") {
1870
- throw new Error("Global templates not yet supported");
1871
- }
1872
1888
  const typeName = NAMER.documentTypeName(template.namespace);
1873
1889
  types.push(typeName);
1874
1890
  });
1875
1891
  }
1876
1892
  });
1893
+ if (includeFolderType) {
1894
+ types.push(astBuilder.TYPES.Folder);
1895
+ }
1877
1896
  const type = astBuilder.UnionTypeDefinition({
1878
1897
  name: fieldName,
1879
1898
  types
@@ -1891,7 +1910,8 @@ var Builder = class {
1891
1910
  namespace,
1892
1911
  nodeType,
1893
1912
  collections,
1894
- connectionNamespace
1913
+ connectionNamespace,
1914
+ includeFolderFilter
1895
1915
  }) => {
1896
1916
  const connectionName = NAMER.referenceConnectionType(namespace);
1897
1917
  await this.database.addToLookupMap({
@@ -1904,7 +1924,8 @@ var Builder = class {
1904
1924
  namespace: connectionNamespace,
1905
1925
  connectionName,
1906
1926
  nodeType,
1907
- collections
1927
+ collections,
1928
+ includeFolderFilter
1908
1929
  });
1909
1930
  };
1910
1931
  this._buildFieldFilter = async (field) => {
@@ -2211,7 +2232,8 @@ var Builder = class {
2211
2232
  connectionName,
2212
2233
  nodeType,
2213
2234
  collection,
2214
- collections
2235
+ collections,
2236
+ includeFolderFilter
2215
2237
  }) => {
2216
2238
  const extra = [
2217
2239
  await this._connectionFilterBuilder({
@@ -2221,6 +2243,14 @@ var Builder = class {
2221
2243
  collections
2222
2244
  })
2223
2245
  ];
2246
+ if (includeFolderFilter) {
2247
+ extra.push(
2248
+ astBuilder.InputValueDefinition({
2249
+ name: "folder",
2250
+ type: astBuilder.TYPES.String
2251
+ })
2252
+ );
2253
+ }
2224
2254
  return astBuilder.FieldDefinition({
2225
2255
  name: fieldName,
2226
2256
  required: true,
@@ -2487,7 +2517,12 @@ var validateCollection = async (collection) => {
2487
2517
  name: yup2.string().matches(/^[a-zA-Z0-9_]*$/, {
2488
2518
  message: (obj) => `Collection's "name" must match ${obj.regex} at ${messageName}`
2489
2519
  }).required(),
2490
- path: yup2.string().required().transform((value) => {
2520
+ path: yup2.string().test("is-required", "path is a required field", (value) => {
2521
+ if (value === "") {
2522
+ return true;
2523
+ }
2524
+ return yup2.string().required().isValidSync(value);
2525
+ }).transform((value) => {
2491
2526
  return value.replace(/^\/|\/$/g, "");
2492
2527
  })
2493
2528
  });
@@ -2542,7 +2577,7 @@ var validateField = async (field) => {
2542
2577
  // package.json
2543
2578
  var package_default = {
2544
2579
  name: "@tinacms/graphql",
2545
- version: "1.4.7",
2580
+ version: "1.4.9",
2546
2581
  main: "dist/index.js",
2547
2582
  module: "dist/index.es.js",
2548
2583
  typings: "dist/index.d.ts",
@@ -2594,6 +2629,7 @@ var package_default = {
2594
2629
  "graphql-type-json": "^0.3.2",
2595
2630
  "gray-matter": "^4.0.2",
2596
2631
  "isomorphic-git": "^1.21.0",
2632
+ "js-sha1": "^0.6.0",
2597
2633
  "js-yaml": "^3.14.1",
2598
2634
  "jsonpath-plus": "^6.0.1",
2599
2635
  leveldown: "^6.1.0",
@@ -2857,7 +2893,7 @@ var _buildSchema = async (builder, tinaSchema) => {
2857
2893
  var import_graphql4 = require("graphql");
2858
2894
 
2859
2895
  // src/resolver/index.ts
2860
- var import_path = __toESM(require("path"));
2896
+ var import_path2 = __toESM(require("path"));
2861
2897
  var import_isValid = __toESM(require("date-fns/isValid"));
2862
2898
 
2863
2899
  // src/mdx/index.ts
@@ -3088,9 +3124,9 @@ var resolveMediaRelativeToCloud = (value, config = { useRelativeMedia: true }, s
3088
3124
  return value;
3089
3125
  }
3090
3126
  };
3091
- var cleanUpSlashes = (path4) => {
3092
- if (path4) {
3093
- return `/${path4.replace(/^\/+|\/+$/gm, "")}`;
3127
+ var cleanUpSlashes = (path5) => {
3128
+ if (path5) {
3129
+ return `/${path5.replace(/^\/+|\/+$/gm, "")}`;
3094
3130
  }
3095
3131
  return "";
3096
3132
  };
@@ -3107,6 +3143,7 @@ var import_graphql3 = require("graphql");
3107
3143
 
3108
3144
  // src/database/datalayer.ts
3109
3145
  var import_jsonpath_plus = require("jsonpath-plus");
3146
+ var import_js_sha1 = __toESM(require("js-sha1"));
3110
3147
 
3111
3148
  // src/database/level.ts
3112
3149
  var INDEX_KEY_FIELD_SEPARATOR = "";
@@ -3154,6 +3191,7 @@ var LevelProxy = class {
3154
3191
  };
3155
3192
 
3156
3193
  // src/database/datalayer.ts
3194
+ var import_path = __toESM(require("path"));
3157
3195
  var DEFAULT_COLLECTION_SORT_KEY = "__filepath__";
3158
3196
  var DEFAULT_NUMERIC_LPAD = 4;
3159
3197
  var applyPadding = (input, pad) => {
@@ -3520,6 +3558,107 @@ var makeFilterSuffixes = (filterChain, index) => {
3520
3558
  return {};
3521
3559
  }
3522
3560
  };
3561
+ var FOLDER_ROOT = "~";
3562
+ var stripCollectionFromPath = (collectionPath, path5) => {
3563
+ const collectionPathParts = collectionPath.split("/");
3564
+ const pathParts = path5.split("/");
3565
+ const strippedPathParts = pathParts.slice(collectionPathParts.length);
3566
+ return strippedPathParts.join("/");
3567
+ };
3568
+ var FolderTreeBuilder = class {
3569
+ constructor() {
3570
+ this._tree = {
3571
+ [FOLDER_ROOT]: /* @__PURE__ */ new Set()
3572
+ };
3573
+ }
3574
+ get tree() {
3575
+ return this._tree;
3576
+ }
3577
+ update(documentPath, collectionPath) {
3578
+ let folderPath = import_path.default.dirname(documentPath);
3579
+ if (collectionPath) {
3580
+ folderPath = stripCollectionFromPath(collectionPath, folderPath);
3581
+ }
3582
+ const parent = [FOLDER_ROOT];
3583
+ folderPath.split("/").filter((part) => part.length).forEach((part) => {
3584
+ const current2 = parent.join("/");
3585
+ if (!this._tree[current2]) {
3586
+ this._tree[current2] = /* @__PURE__ */ new Set();
3587
+ }
3588
+ this._tree[current2].add(import_path.default.join(current2, part));
3589
+ parent.push(part);
3590
+ });
3591
+ const current = parent.join("/");
3592
+ if (!this._tree[current]) {
3593
+ this._tree[current] = /* @__PURE__ */ new Set();
3594
+ }
3595
+ return current === FOLDER_ROOT ? FOLDER_ROOT : import_js_sha1.default.hex(current);
3596
+ }
3597
+ };
3598
+ var makeFolderOpsForCollection = (folderTree, collection, indexDefinitions, opType, level, escapeStr = stringEscaper) => {
3599
+ const result = [];
3600
+ const data = {};
3601
+ const indexedValues = {};
3602
+ for (const [sort, indexDefinition] of Object.entries(indexDefinitions)) {
3603
+ for (const field of indexDefinition.fields) {
3604
+ data[field.name] = "";
3605
+ }
3606
+ indexedValues[sort] = makeKeyForField(indexDefinition, data, escapeStr);
3607
+ }
3608
+ const baseCharacter = "a".charCodeAt(0);
3609
+ for (const [folderName, folder] of Object.entries(folderTree)) {
3610
+ const parentFolderKey = folderName === FOLDER_ROOT ? FOLDER_ROOT : import_js_sha1.default.hex(folderName);
3611
+ const folderCollectionSublevel = level.sublevel(
3612
+ `${collection.name}_${parentFolderKey}`,
3613
+ SUBLEVEL_OPTIONS
3614
+ );
3615
+ let folderSortingIdx = 0;
3616
+ for (const path5 of Array.from(folder).sort()) {
3617
+ for (const [sort] of Object.entries(indexDefinitions)) {
3618
+ const indexSublevel = folderCollectionSublevel.sublevel(
3619
+ sort,
3620
+ SUBLEVEL_OPTIONS
3621
+ );
3622
+ const subFolderKey = import_js_sha1.default.hex(path5);
3623
+ if (sort === DEFAULT_COLLECTION_SORT_KEY) {
3624
+ result.push({
3625
+ type: opType,
3626
+ key: `${collection.path}/${subFolderKey}.${collection.format}`,
3627
+ sublevel: indexSublevel,
3628
+ value: {}
3629
+ });
3630
+ } else {
3631
+ const indexValue = `${String.fromCharCode(
3632
+ baseCharacter + folderSortingIdx
3633
+ )}${indexedValues[sort].substring(1)}`;
3634
+ result.push({
3635
+ type: opType,
3636
+ key: `${indexValue}${INDEX_KEY_FIELD_SEPARATOR}${collection.path}/${subFolderKey}.${collection.format}`,
3637
+ sublevel: indexSublevel,
3638
+ value: {}
3639
+ });
3640
+ }
3641
+ }
3642
+ folderSortingIdx++;
3643
+ }
3644
+ if (folderName !== FOLDER_ROOT) {
3645
+ result.push({
3646
+ type: "put",
3647
+ key: `${collection.path}/${parentFolderKey}.${collection.format}`,
3648
+ value: {
3649
+ __collection: collection.name,
3650
+ __folderBasename: import_path.default.basename(folderName),
3651
+ __folderPath: folderName
3652
+ },
3653
+ sublevel: level.sublevel(
3654
+ CONTENT_ROOT_PREFIX,
3655
+ SUBLEVEL_OPTIONS
3656
+ )
3657
+ });
3658
+ }
3659
+ }
3660
+ return result;
3661
+ };
3523
3662
  var makeIndexOpsForDocument = (filepath, collection, indexDefinitions, data, opType, level, escapeStr = stringEscaper) => {
3524
3663
  const result = [];
3525
3664
  if (collection) {
@@ -3584,11 +3723,37 @@ var Resolver = class {
3584
3723
  ...extraFields
3585
3724
  };
3586
3725
  };
3726
+ this.getRaw = async (fullPath) => {
3727
+ if (typeof fullPath !== "string") {
3728
+ throw new Error(`fullPath must be of type string for getDocument request`);
3729
+ }
3730
+ return this.database.get(fullPath);
3731
+ };
3732
+ this.getDocumentOrDirectory = async (fullPath) => {
3733
+ if (typeof fullPath !== "string") {
3734
+ throw new Error(
3735
+ `fullPath must be of type string for getDocumentOrDirectory request`
3736
+ );
3737
+ }
3738
+ const rawData = await this.getRaw(fullPath);
3739
+ if (rawData["__folderBasename"]) {
3740
+ return {
3741
+ __typename: "Folder",
3742
+ name: rawData["__folderBasename"],
3743
+ path: rawData["__folderPath"]
3744
+ };
3745
+ } else {
3746
+ return this.transformDocumentIntoPayload(fullPath, rawData);
3747
+ }
3748
+ };
3587
3749
  this.getDocument = async (fullPath) => {
3588
3750
  if (typeof fullPath !== "string") {
3589
3751
  throw new Error(`fullPath must be of type string for getDocument request`);
3590
3752
  }
3591
- const rawData = await this.database.get(fullPath);
3753
+ const rawData = await this.getRaw(fullPath);
3754
+ return this.transformDocumentIntoPayload(fullPath, rawData);
3755
+ };
3756
+ this.transformDocumentIntoPayload = async (fullPath, rawData) => {
3592
3757
  const collection = this.tinaSchema.getCollection(rawData._collection);
3593
3758
  try {
3594
3759
  const template = await this.tinaSchema.getTemplateForData({
@@ -3599,7 +3764,7 @@ var Resolver = class {
3599
3764
  base: basename,
3600
3765
  ext: extension,
3601
3766
  name: filename
3602
- } = import_path.default.parse(fullPath);
3767
+ } = import_path2.default.parse(fullPath);
3603
3768
  const relativePath = fullPath.replace(/\\/g, "/").replace(collection.path, "").replace(/^\/|\/$/g, "");
3604
3769
  const breadcrumbs = relativePath.replace(extension, "").split("/");
3605
3770
  const data = {
@@ -3631,7 +3796,7 @@ var Resolver = class {
3631
3796
  id: fullPath,
3632
3797
  ...data,
3633
3798
  _sys: {
3634
- title,
3799
+ title: title || "",
3635
3800
  basename,
3636
3801
  filename,
3637
3802
  extension,
@@ -3842,7 +4007,7 @@ var Resolver = class {
3842
4007
  (yup3) => yup3.object({ relativePath: yup3.string().required() })
3843
4008
  );
3844
4009
  const collection = await this.tinaSchema.getCollection(collectionLookup);
3845
- const realPath = import_path.default.join(collection == null ? void 0 : collection.path, args.relativePath);
4010
+ const realPath = import_path2.default.join(collection == null ? void 0 : collection.path, args.relativePath);
3846
4011
  const alreadyExists = await this.database.documentExists(realPath);
3847
4012
  if (isMutation) {
3848
4013
  if (isCreation) {
@@ -3883,7 +4048,7 @@ var Resolver = class {
3883
4048
  (yup3) => yup3.object({ relativePath: yup3.string().required() })
3884
4049
  );
3885
4050
  const doc = await this.getDocument(realPath);
3886
- const newRealPath = import_path.default.join(
4051
+ const newRealPath = import_path2.default.join(
3887
4052
  collection == null ? void 0 : collection.path,
3888
4053
  args.params.relativePath
3889
4054
  );
@@ -3938,7 +4103,7 @@ var Resolver = class {
3938
4103
  first: -1
3939
4104
  },
3940
4105
  collection: referencedCollection,
3941
- hydrator: (path4) => path4
4106
+ hydrator: (path5) => path5
3942
4107
  }
3943
4108
  );
3944
4109
  const { edges } = resolvedCollectionConnection;
@@ -3986,11 +4151,12 @@ var Resolver = class {
3986
4151
  first: args.first,
3987
4152
  last: args.last,
3988
4153
  before: args.before,
3989
- after: args.after
4154
+ after: args.after,
4155
+ folder: args.folder
3990
4156
  };
3991
4157
  const result = await this.database.query(
3992
4158
  queryOptions,
3993
- hydrator ? hydrator : this.getDocument
4159
+ hydrator ? hydrator : this.getDocumentOrDirectory
3994
4160
  );
3995
4161
  const edges = result.edges;
3996
4162
  const pageInfo = result.pageInfo;
@@ -4472,7 +4638,7 @@ var resolve = async ({
4472
4638
  };
4473
4639
 
4474
4640
  // src/database/index.ts
4475
- var import_path2 = __toESM(require("path"));
4641
+ var import_path3 = __toESM(require("path"));
4476
4642
  var import_graphql5 = require("graphql");
4477
4643
  var import_micromatch = __toESM(require("micromatch"));
4478
4644
 
@@ -4682,6 +4848,7 @@ var _applyNameOverrides = (fields, obj) => {
4682
4848
  };
4683
4849
 
4684
4850
  // src/database/index.ts
4851
+ var import_js_sha12 = __toESM(require("js-sha1"));
4685
4852
  var createDatabase = (config) => {
4686
4853
  return new Database({
4687
4854
  ...config,
@@ -4700,14 +4867,14 @@ var Database = class {
4700
4867
  const tinaSchema = await this.getSchema(this.level);
4701
4868
  return tinaSchema.getCollectionByFullPath(filepath);
4702
4869
  };
4703
- this.getGeneratedFolder = () => import_path2.default.join(this.tinaDirectory, "__generated__");
4870
+ this.getGeneratedFolder = () => import_path3.default.join(this.tinaDirectory, "__generated__");
4704
4871
  this.get = async (filepath) => {
4705
4872
  await this.initLevel();
4706
4873
  if (SYSTEM_FILES.includes(filepath)) {
4707
4874
  throw new Error(`Unexpected get for config file ${filepath}`);
4708
4875
  } else {
4709
4876
  const tinaSchema = await this.getSchema(this.level);
4710
- const extension = import_path2.default.extname(filepath);
4877
+ const extension = import_path3.default.extname(filepath);
4711
4878
  const contentObject = await this.level.sublevel(
4712
4879
  CONTENT_ROOT_PREFIX,
4713
4880
  SUBLEVEL_OPTIONS
@@ -4716,8 +4883,16 @@ var Database = class {
4716
4883
  throw new import_graphql5.GraphQLError(`Unable to find record ${filepath}`);
4717
4884
  }
4718
4885
  const templateName = hasOwnProperty(contentObject, "_template") && typeof contentObject._template === "string" ? contentObject._template : void 0;
4719
- const { collection, template } = tinaSchema.getCollectionAndTemplateByFullPath(filepath, templateName);
4720
- const field = template.fields.find((field2) => {
4886
+ const { collection, template } = hasOwnProperty(
4887
+ contentObject,
4888
+ "__collection"
4889
+ ) ? {
4890
+ collection: tinaSchema.getCollection(
4891
+ contentObject["__collection"]
4892
+ ),
4893
+ template: void 0
4894
+ } : tinaSchema.getCollectionAndTemplateByFullPath(filepath, templateName);
4895
+ const field = template == null ? void 0 : template.fields.find((field2) => {
4721
4896
  if (field2.type === "string" || field2.type === "rich-text") {
4722
4897
  if (field2.isBody) {
4723
4898
  return true;
@@ -4737,7 +4912,7 @@ var Database = class {
4737
4912
  ...data,
4738
4913
  _collection: collection.name,
4739
4914
  _keepTemplateKey: !!collection.templates,
4740
- _template: lastItem(template.namespace),
4915
+ _template: (template == null ? void 0 : template.namespace) ? lastItem(template == null ? void 0 : template.namespace) : void 0,
4741
4916
  _relativePath: filepath.replace(collection.path, "").replace(/^\/|\/$/g, ""),
4742
4917
  _id: filepath
4743
4918
  };
@@ -4762,26 +4937,48 @@ var Database = class {
4762
4937
  await this.bridge.put(normalizedPath, stringifiedFile);
4763
4938
  }
4764
4939
  await this.onPut(normalizedPath, stringifiedFile);
4765
- const putOps = makeIndexOpsForDocument(
4766
- normalizedPath,
4767
- collection == null ? void 0 : collection.name,
4768
- collectionIndexDefinitions,
4769
- dataFields,
4770
- "put",
4771
- this.level
4772
- );
4940
+ const folderTreeBuilder = new FolderTreeBuilder();
4941
+ const folderKey = folderTreeBuilder.update(filepath, collection.path || "");
4942
+ const putOps = [
4943
+ ...makeIndexOpsForDocument(
4944
+ normalizedPath,
4945
+ collection == null ? void 0 : collection.name,
4946
+ collectionIndexDefinitions,
4947
+ dataFields,
4948
+ "put",
4949
+ this.level
4950
+ ),
4951
+ ...makeIndexOpsForDocument(
4952
+ normalizedPath,
4953
+ `${collection == null ? void 0 : collection.name}_${folderKey}`,
4954
+ collectionIndexDefinitions,
4955
+ dataFields,
4956
+ "put",
4957
+ this.level
4958
+ )
4959
+ ];
4773
4960
  const existingItem = await this.level.sublevel(
4774
4961
  CONTENT_ROOT_PREFIX,
4775
4962
  SUBLEVEL_OPTIONS
4776
4963
  ).get(normalizedPath);
4777
- const delOps = existingItem ? makeIndexOpsForDocument(
4778
- normalizedPath,
4779
- collection == null ? void 0 : collection.name,
4780
- collectionIndexDefinitions,
4781
- existingItem,
4782
- "del",
4783
- this.level
4784
- ) : [];
4964
+ const delOps = existingItem ? [
4965
+ ...makeIndexOpsForDocument(
4966
+ normalizedPath,
4967
+ collection == null ? void 0 : collection.name,
4968
+ collectionIndexDefinitions,
4969
+ existingItem,
4970
+ "del",
4971
+ this.level
4972
+ ),
4973
+ ...makeIndexOpsForDocument(
4974
+ normalizedPath,
4975
+ `${collection == null ? void 0 : collection.name}_${folderKey}`,
4976
+ collectionIndexDefinitions,
4977
+ existingItem,
4978
+ "del",
4979
+ this.level
4980
+ )
4981
+ ] : [];
4785
4982
  const ops = [
4786
4983
  ...delOps,
4787
4984
  ...putOps,
@@ -4832,26 +5029,51 @@ var Database = class {
4832
5029
  await this.bridge.put(normalizedPath, stringifiedFile);
4833
5030
  }
4834
5031
  await this.onPut(normalizedPath, stringifiedFile);
4835
- const putOps = makeIndexOpsForDocument(
4836
- normalizedPath,
4837
- collectionName,
4838
- collectionIndexDefinitions,
4839
- dataFields,
4840
- "put",
4841
- this.level
5032
+ const folderTreeBuilder = new FolderTreeBuilder();
5033
+ const folderKey = folderTreeBuilder.update(
5034
+ filepath,
5035
+ collection.path || ""
4842
5036
  );
5037
+ const putOps = [
5038
+ ...makeIndexOpsForDocument(
5039
+ normalizedPath,
5040
+ collectionName,
5041
+ collectionIndexDefinitions,
5042
+ dataFields,
5043
+ "put",
5044
+ this.level
5045
+ ),
5046
+ ...makeIndexOpsForDocument(
5047
+ normalizedPath,
5048
+ `${collection == null ? void 0 : collection.name}_${folderKey}`,
5049
+ collectionIndexDefinitions,
5050
+ dataFields,
5051
+ "put",
5052
+ this.level
5053
+ )
5054
+ ];
4843
5055
  const existingItem = await this.level.sublevel(
4844
5056
  CONTENT_ROOT_PREFIX,
4845
5057
  SUBLEVEL_OPTIONS
4846
5058
  ).get(normalizedPath);
4847
- const delOps = existingItem ? makeIndexOpsForDocument(
4848
- normalizedPath,
4849
- collectionName,
4850
- collectionIndexDefinitions,
4851
- existingItem,
4852
- "del",
4853
- this.level
4854
- ) : [];
5059
+ const delOps = existingItem ? [
5060
+ ...makeIndexOpsForDocument(
5061
+ normalizedPath,
5062
+ collectionName,
5063
+ collectionIndexDefinitions,
5064
+ existingItem,
5065
+ "del",
5066
+ this.level
5067
+ ),
5068
+ ...makeIndexOpsForDocument(
5069
+ normalizedPath,
5070
+ `${collection == null ? void 0 : collection.name}_${folderKey}`,
5071
+ collectionIndexDefinitions,
5072
+ existingItem,
5073
+ "del",
5074
+ this.level
5075
+ )
5076
+ ] : [];
4855
5077
  const ops = [
4856
5078
  ...delOps,
4857
5079
  ...putOps,
@@ -4909,7 +5131,7 @@ var Database = class {
4909
5131
  );
4910
5132
  const writeTemplateKey = templateDetails.info.type === "union";
4911
5133
  const aliasedData = applyNameOverrides(templateDetails.template, payload);
4912
- const extension = import_path2.default.extname(filepath);
5134
+ const extension = import_path3.default.extname(filepath);
4913
5135
  const stringifiedFile = stringifyFile(
4914
5136
  aliasedData,
4915
5137
  extension,
@@ -4935,7 +5157,7 @@ var Database = class {
4935
5157
  this.getLookup = async (returnType) => {
4936
5158
  await this.initLevel();
4937
5159
  const lookupPath = (0, import_schema_tools3.normalizePath)(
4938
- import_path2.default.join(this.getGeneratedFolder(), `_lookup.json`)
5160
+ import_path3.default.join(this.getGeneratedFolder(), `_lookup.json`)
4939
5161
  );
4940
5162
  if (!this._lookup) {
4941
5163
  const _lookup = await this.level.sublevel(
@@ -4949,7 +5171,7 @@ var Database = class {
4949
5171
  this.getGraphQLSchema = async () => {
4950
5172
  await this.initLevel();
4951
5173
  const graphqlPath = (0, import_schema_tools3.normalizePath)(
4952
- import_path2.default.join(this.getGeneratedFolder(), `_graphql.json`)
5174
+ import_path3.default.join(this.getGeneratedFolder(), `_graphql.json`)
4953
5175
  );
4954
5176
  return await this.level.sublevel(
4955
5177
  CONTENT_ROOT_PREFIX,
@@ -4961,7 +5183,7 @@ var Database = class {
4961
5183
  throw new Error(`No bridge configured`);
4962
5184
  }
4963
5185
  const graphqlPath = (0, import_schema_tools3.normalizePath)(
4964
- import_path2.default.join(this.getGeneratedFolder(), `_graphql.json`)
5186
+ import_path3.default.join(this.getGeneratedFolder(), `_graphql.json`)
4965
5187
  );
4966
5188
  const _graphql = await this.bridge.get(graphqlPath);
4967
5189
  return JSON.parse(_graphql);
@@ -4969,7 +5191,7 @@ var Database = class {
4969
5191
  this.getTinaSchema = async (level) => {
4970
5192
  await this.initLevel();
4971
5193
  const schemaPath = (0, import_schema_tools3.normalizePath)(
4972
- import_path2.default.join(this.getGeneratedFolder(), `_schema.json`)
5194
+ import_path3.default.join(this.getGeneratedFolder(), `_schema.json`)
4973
5195
  );
4974
5196
  return await (level || this.level).sublevel(
4975
5197
  CONTENT_ROOT_PREFIX,
@@ -4985,7 +5207,7 @@ var Database = class {
4985
5207
  if (!schema) {
4986
5208
  throw new Error(
4987
5209
  `Unable to get schema from level db: ${(0, import_schema_tools3.normalizePath)(
4988
- import_path2.default.join(this.getGeneratedFolder(), `_schema.json`)
5210
+ import_path3.default.join(this.getGeneratedFolder(), `_schema.json`)
4989
5211
  )}`
4990
5212
  );
4991
5213
  }
@@ -5063,7 +5285,8 @@ var Database = class {
5063
5285
  before,
5064
5286
  sort = DEFAULT_COLLECTION_SORT_KEY,
5065
5287
  collection,
5066
- filterChain: rawFilterChain
5288
+ filterChain: rawFilterChain,
5289
+ folder
5067
5290
  } = queryOptions;
5068
5291
  let limit = 50;
5069
5292
  if (first) {
@@ -5091,12 +5314,15 @@ var Database = class {
5091
5314
  CONTENT_ROOT_PREFIX,
5092
5315
  SUBLEVEL_OPTIONS
5093
5316
  );
5094
- const sublevel = indexDefinition ? this.level.sublevel(collection, SUBLEVEL_OPTIONS).sublevel(sort, SUBLEVEL_OPTIONS) : rootLevel;
5317
+ const sublevel = indexDefinition ? this.level.sublevel(
5318
+ `${collection}${folder ? `_${folder === FOLDER_ROOT ? folder : import_js_sha12.default.hex(folder)}` : ""}`,
5319
+ SUBLEVEL_OPTIONS
5320
+ ).sublevel(sort, SUBLEVEL_OPTIONS) : rootLevel;
5095
5321
  if (!query.gt && !query.gte) {
5096
5322
  query.gte = (filterSuffixes == null ? void 0 : filterSuffixes.left) ? filterSuffixes.left : "";
5097
5323
  }
5098
5324
  if (!query.lt && !query.lte) {
5099
- query.lte = (filterSuffixes == null ? void 0 : filterSuffixes.right) ? `${filterSuffixes.right}\xFF` : "\xFF";
5325
+ query.lte = (filterSuffixes == null ? void 0 : filterSuffixes.right) ? `${filterSuffixes.right}\uFFFF` : "\uFFFF";
5100
5326
  }
5101
5327
  let edges = [];
5102
5328
  let startKey = "";
@@ -5139,6 +5365,7 @@ var Database = class {
5139
5365
  cursor: btoa(edge.cursor)
5140
5366
  };
5141
5367
  } catch (error) {
5368
+ console.log(error);
5142
5369
  if (error instanceof Error && (!edge.path.includes(".tina/__generated__/_graphql.json") || !edge.path.includes("tina/__generated__/_graphql.json"))) {
5143
5370
  throw new TinaQueryError({
5144
5371
  originalError: error,
@@ -5165,11 +5392,11 @@ var Database = class {
5165
5392
  }) => {
5166
5393
  if (this.bridge && this.bridge.supportsBuilding()) {
5167
5394
  await this.bridge.putConfig(
5168
- (0, import_schema_tools3.normalizePath)(import_path2.default.join(this.getGeneratedFolder(), `_graphql.json`)),
5395
+ (0, import_schema_tools3.normalizePath)(import_path3.default.join(this.getGeneratedFolder(), `_graphql.json`)),
5169
5396
  JSON.stringify(graphQLSchema)
5170
5397
  );
5171
5398
  await this.bridge.putConfig(
5172
- (0, import_schema_tools3.normalizePath)(import_path2.default.join(this.getGeneratedFolder(), `_schema.json`)),
5399
+ (0, import_schema_tools3.normalizePath)(import_path3.default.join(this.getGeneratedFolder(), `_schema.json`)),
5173
5400
  JSON.stringify(tinaSchema.schema)
5174
5401
  );
5175
5402
  }
@@ -5189,7 +5416,7 @@ var Database = class {
5189
5416
  const lookup = lookupFromLockFile || JSON.parse(
5190
5417
  await this.bridge.get(
5191
5418
  (0, import_schema_tools3.normalizePath)(
5192
- import_path2.default.join(this.getGeneratedFolder(), "_lookup.json")
5419
+ import_path3.default.join(this.getGeneratedFolder(), "_lookup.json")
5193
5420
  )
5194
5421
  )
5195
5422
  );
@@ -5204,15 +5431,15 @@ var Database = class {
5204
5431
  }
5205
5432
  const contentRootLevel = nextLevel.sublevel(CONTENT_ROOT_PREFIX, SUBLEVEL_OPTIONS);
5206
5433
  await contentRootLevel.put(
5207
- (0, import_schema_tools3.normalizePath)(import_path2.default.join(this.getGeneratedFolder(), "_graphql.json")),
5434
+ (0, import_schema_tools3.normalizePath)(import_path3.default.join(this.getGeneratedFolder(), "_graphql.json")),
5208
5435
  graphQLSchema
5209
5436
  );
5210
5437
  await contentRootLevel.put(
5211
- (0, import_schema_tools3.normalizePath)(import_path2.default.join(this.getGeneratedFolder(), "_schema.json")),
5438
+ (0, import_schema_tools3.normalizePath)(import_path3.default.join(this.getGeneratedFolder(), "_schema.json")),
5212
5439
  tinaSchema.schema
5213
5440
  );
5214
5441
  await contentRootLevel.put(
5215
- (0, import_schema_tools3.normalizePath)(import_path2.default.join(this.getGeneratedFolder(), "_lookup.json")),
5442
+ (0, import_schema_tools3.normalizePath)(import_path3.default.join(this.getGeneratedFolder(), "_lookup.json")),
5216
5443
  lookup
5217
5444
  );
5218
5445
  const result = await this._indexAllContent(
@@ -5253,7 +5480,9 @@ var Database = class {
5253
5480
  collections[collection]
5254
5481
  );
5255
5482
  }
5256
- await _deleteIndexContent(this, nonCollectionPaths, enqueueOps, null);
5483
+ if (nonCollectionPaths.length) {
5484
+ await _deleteIndexContent(this, nonCollectionPaths, enqueueOps, null);
5485
+ }
5257
5486
  });
5258
5487
  while (operations.length) {
5259
5488
  await this.level.batch(operations.splice(0, 25));
@@ -5304,6 +5533,11 @@ var Database = class {
5304
5533
  );
5305
5534
  const item = await rootSublevel.get(itemKey);
5306
5535
  if (item) {
5536
+ const folderTreeBuilder = new FolderTreeBuilder();
5537
+ const folderKey = folderTreeBuilder.update(
5538
+ filepath,
5539
+ collection.path || ""
5540
+ );
5307
5541
  await this.level.batch([
5308
5542
  ...makeIndexOpsForDocument(
5309
5543
  filepath,
@@ -5313,6 +5547,14 @@ var Database = class {
5313
5547
  "del",
5314
5548
  this.level
5315
5549
  ),
5550
+ ...makeIndexOpsForDocument(
5551
+ filepath,
5552
+ `${collection.name}_${folderKey}`,
5553
+ collectionIndexDefinitions,
5554
+ item,
5555
+ "del",
5556
+ this.level
5557
+ ),
5316
5558
  {
5317
5559
  type: "del",
5318
5560
  key: itemKey,
@@ -5344,17 +5586,17 @@ var Database = class {
5344
5586
  const documentPaths = await this.bridge.glob(normalPath, format);
5345
5587
  const matches = this.tinaSchema.getMatches({ collection });
5346
5588
  const filteredPaths = matches.length > 0 ? (0, import_micromatch.default)(documentPaths, matches) : documentPaths;
5347
- filteredPaths.forEach((path4) => {
5348
- if (filesSeen.has(path4)) {
5349
- filesSeen.get(path4).push(collection.name);
5350
- duplicateFiles.add(path4);
5589
+ filteredPaths.forEach((path5) => {
5590
+ if (filesSeen.has(path5)) {
5591
+ filesSeen.get(path5).push(collection.name);
5592
+ duplicateFiles.add(path5);
5351
5593
  } else {
5352
- filesSeen.set(path4, [collection.name]);
5594
+ filesSeen.set(path5, [collection.name]);
5353
5595
  }
5354
5596
  });
5355
- duplicateFiles.forEach((path4) => {
5597
+ duplicateFiles.forEach((path5) => {
5356
5598
  warnings.push(
5357
- `"${path4}" Found in multiple collections: ${filesSeen.get(path4).map((collection2) => `"${collection2}"`).join(
5599
+ `"${path5}" Found in multiple collections: ${filesSeen.get(path5).map((collection2) => `"${collection2}"`).join(
5358
5600
  ", "
5359
5601
  )}. This can cause unexpected behavior. We recommend updating the \`match\` property of those collections so that each file is in only one collection.
5360
5602
  This will be an error in the future. See https://tina.io/docs/errors/file-in-mutpliple-collections/
@@ -5372,7 +5614,7 @@ This will be an error in the future. See https://tina.io/docs/errors/file-in-mut
5372
5614
  if (!this.bridge) {
5373
5615
  throw new Error("No bridge configured");
5374
5616
  }
5375
- const lookupPath = import_path2.default.join(this.getGeneratedFolder(), `_lookup.json`);
5617
+ const lookupPath = import_path3.default.join(this.getGeneratedFolder(), `_lookup.json`);
5376
5618
  let lookupMap;
5377
5619
  try {
5378
5620
  lookupMap = JSON.parse(await this.bridge.get((0, import_schema_tools3.normalizePath)(lookupPath)));
@@ -5490,24 +5732,27 @@ function hasOwnProperty(obj, prop) {
5490
5732
  }
5491
5733
  var _indexContent = async (database, level, documentPaths, enqueueOps, collection) => {
5492
5734
  let collectionIndexDefinitions;
5735
+ let collectionPath;
5493
5736
  if (collection) {
5494
5737
  const indexDefinitions = await database.getIndexDefinitions(level);
5495
5738
  collectionIndexDefinitions = indexDefinitions == null ? void 0 : indexDefinitions[collection.name];
5496
5739
  if (!collectionIndexDefinitions) {
5497
5740
  throw new Error(`No indexDefinitions for collection ${collection.name}`);
5498
5741
  }
5742
+ collectionPath = collection.path;
5499
5743
  }
5500
5744
  const tinaSchema = await database.getSchema();
5501
5745
  let templateInfo = null;
5502
5746
  if (collection) {
5503
5747
  templateInfo = await tinaSchema.getTemplatesForCollectable(collection);
5504
5748
  }
5749
+ const folderTreeBuilder = new FolderTreeBuilder();
5505
5750
  await sequential(documentPaths, async (filepath) => {
5506
5751
  try {
5507
5752
  const dataString = await database.bridge.get((0, import_schema_tools3.normalizePath)(filepath));
5508
5753
  const data = parseFile(
5509
5754
  dataString,
5510
- import_path2.default.extname(filepath),
5755
+ import_path3.default.extname(filepath),
5511
5756
  (yup3) => yup3.object({}),
5512
5757
  {
5513
5758
  frontmatterDelimiters: collection == null ? void 0 : collection.frontmatterDelimiters,
@@ -5522,6 +5767,10 @@ var _indexContent = async (database, level, documentPaths, enqueueOps, collectio
5522
5767
  return;
5523
5768
  }
5524
5769
  const normalizedPath = (0, import_schema_tools3.normalizePath)(filepath);
5770
+ const folderKey = folderTreeBuilder.update(
5771
+ normalizedPath,
5772
+ collectionPath || ""
5773
+ );
5525
5774
  const aliasedData = templateInfo ? replaceNameOverrides(template, data) : data;
5526
5775
  await enqueueOps([
5527
5776
  ...makeIndexOpsForDocument(
@@ -5532,6 +5781,14 @@ var _indexContent = async (database, level, documentPaths, enqueueOps, collectio
5532
5781
  "put",
5533
5782
  level
5534
5783
  ),
5784
+ ...makeIndexOpsForDocument(
5785
+ normalizedPath,
5786
+ `${collection == null ? void 0 : collection.name}_${folderKey}`,
5787
+ collectionIndexDefinitions,
5788
+ aliasedData,
5789
+ "put",
5790
+ level
5791
+ ),
5535
5792
  {
5536
5793
  type: "put",
5537
5794
  key: normalizedPath,
@@ -5551,8 +5808,22 @@ var _indexContent = async (database, level, documentPaths, enqueueOps, collectio
5551
5808
  });
5552
5809
  }
5553
5810
  });
5811
+ if (collection) {
5812
+ await enqueueOps(
5813
+ makeFolderOpsForCollection(
5814
+ folderTreeBuilder.tree,
5815
+ collection,
5816
+ collectionIndexDefinitions,
5817
+ "put",
5818
+ level
5819
+ )
5820
+ );
5821
+ }
5554
5822
  };
5555
- var _deleteIndexContent = async (database, documentPaths, enequeueOps, collection) => {
5823
+ var _deleteIndexContent = async (database, documentPaths, enqueueOps, collection) => {
5824
+ if (!documentPaths.length) {
5825
+ return;
5826
+ }
5556
5827
  let collectionIndexDefinitions;
5557
5828
  if (collection) {
5558
5829
  const indexDefinitions = await database.getIndexDefinitions(database.level);
@@ -5561,20 +5832,42 @@ var _deleteIndexContent = async (database, documentPaths, enequeueOps, collectio
5561
5832
  throw new Error(`No indexDefinitions for collection ${collection.name}`);
5562
5833
  }
5563
5834
  }
5835
+ const tinaSchema = await database.getSchema();
5836
+ let templateInfo = null;
5837
+ if (collection) {
5838
+ templateInfo = await tinaSchema.getTemplatesForCollectable(collection);
5839
+ }
5564
5840
  const rootLevel = database.level.sublevel(
5565
5841
  CONTENT_ROOT_PREFIX,
5566
5842
  SUBLEVEL_OPTIONS
5567
5843
  );
5844
+ const folderTreeBuilder = new FolderTreeBuilder();
5568
5845
  await sequential(documentPaths, async (filepath) => {
5569
5846
  const itemKey = (0, import_schema_tools3.normalizePath)(filepath);
5570
5847
  const item = await rootLevel.get(itemKey);
5571
5848
  if (item) {
5572
- await enequeueOps([
5849
+ const folderKey = folderTreeBuilder.update(
5850
+ itemKey,
5851
+ (collection == null ? void 0 : collection.path) || ""
5852
+ );
5853
+ const aliasedData = templateInfo ? replaceNameOverrides(
5854
+ getTemplateForFile(templateInfo, item),
5855
+ item
5856
+ ) : item;
5857
+ await enqueueOps([
5573
5858
  ...makeIndexOpsForDocument(
5574
5859
  itemKey,
5575
5860
  collection.name,
5576
5861
  collectionIndexDefinitions,
5577
- item,
5862
+ aliasedData,
5863
+ "del",
5864
+ database.level
5865
+ ),
5866
+ ...makeIndexOpsForDocument(
5867
+ itemKey,
5868
+ `${collection == null ? void 0 : collection.name}_${folderKey}`,
5869
+ collectionIndexDefinitions,
5870
+ aliasedData,
5578
5871
  "del",
5579
5872
  database.level
5580
5873
  ),
@@ -5582,6 +5875,17 @@ var _deleteIndexContent = async (database, documentPaths, enequeueOps, collectio
5582
5875
  ]);
5583
5876
  }
5584
5877
  });
5878
+ if (collectionIndexDefinitions) {
5879
+ await enqueueOps(
5880
+ makeFolderOpsForCollection(
5881
+ folderTreeBuilder.tree,
5882
+ collection,
5883
+ collectionIndexDefinitions,
5884
+ "del",
5885
+ database.level
5886
+ )
5887
+ );
5888
+ }
5585
5889
  };
5586
5890
  var getTemplateForFile = (templateInfo, data) => {
5587
5891
  if (templateInfo.type === "object") {
@@ -5629,7 +5933,7 @@ var TinaLevelClient = class extends import_many_level.ManyLevelGuest {
5629
5933
  // src/database/bridge/filesystem.ts
5630
5934
  var import_fs_extra = __toESM(require("fs-extra"));
5631
5935
  var import_fast_glob = __toESM(require("fast-glob"));
5632
- var import_path3 = __toESM(require("path"));
5936
+ var import_path4 = __toESM(require("path"));
5633
5937
  var import_normalize_path = __toESM(require("normalize-path"));
5634
5938
  var FilesystemBridge = class {
5635
5939
  constructor(rootPath, outputPath) {
@@ -5637,9 +5941,9 @@ var FilesystemBridge = class {
5637
5941
  this.outputPath = outputPath || rootPath;
5638
5942
  }
5639
5943
  async glob(pattern, extension) {
5640
- const basePath = import_path3.default.join(this.outputPath, ...pattern.split("/"));
5944
+ const basePath = import_path4.default.join(this.outputPath, ...pattern.split("/"));
5641
5945
  const items = await (0, import_fast_glob.default)(
5642
- import_path3.default.join(basePath, "**", `/*${extension}`).replace(/\\/g, "/"),
5946
+ import_path4.default.join(basePath, "**", `/*${extension}`).replace(/\\/g, "/"),
5643
5947
  {
5644
5948
  dot: true
5645
5949
  }
@@ -5653,10 +5957,10 @@ var FilesystemBridge = class {
5653
5957
  return true;
5654
5958
  }
5655
5959
  async delete(filepath) {
5656
- await import_fs_extra.default.remove(import_path3.default.join(this.outputPath, filepath));
5960
+ await import_fs_extra.default.remove(import_path4.default.join(this.outputPath, filepath));
5657
5961
  }
5658
5962
  async get(filepath) {
5659
- return import_fs_extra.default.readFileSync(import_path3.default.join(this.outputPath, filepath)).toString();
5963
+ return import_fs_extra.default.readFileSync(import_path4.default.join(this.outputPath, filepath)).toString();
5660
5964
  }
5661
5965
  async putConfig(filepath, data) {
5662
5966
  if (this.rootPath !== this.outputPath) {
@@ -5668,7 +5972,7 @@ var FilesystemBridge = class {
5668
5972
  }
5669
5973
  async put(filepath, data, basePathOverride) {
5670
5974
  const basePath = basePathOverride || this.outputPath;
5671
- await import_fs_extra.default.outputFileSync(import_path3.default.join(basePath, filepath), data);
5975
+ await import_fs_extra.default.outputFileSync(import_path4.default.join(basePath, filepath), data);
5672
5976
  }
5673
5977
  };
5674
5978
  var AuditFileSystemBridge = class extends FilesystemBridge {
@@ -5690,7 +5994,7 @@ var import_fs_extra2 = __toESM(require("fs-extra"));
5690
5994
  var import_glob_parent = __toESM(require("glob-parent"));
5691
5995
  var import_normalize_path2 = __toESM(require("normalize-path"));
5692
5996
  var import_graphql6 = require("graphql");
5693
- var import_path4 = require("path");
5997
+ var import_path5 = require("path");
5694
5998
  var flat = typeof Array.prototype.flat === "undefined" ? (entries) => entries.reduce((acc, x) => acc.concat(x), []) : (entries) => entries.flat();
5695
5999
  var toUint8Array = (buf) => {
5696
6000
  const ab = new ArrayBuffer(buf.length);
@@ -5749,7 +6053,7 @@ var IsomorphicBridge = class {
5749
6053
  async listEntries({
5750
6054
  pattern,
5751
6055
  entry,
5752
- path: path4,
6056
+ path: path5,
5753
6057
  results
5754
6058
  }) {
5755
6059
  const treeResult = await import_isomorphic_git.default.readTree({
@@ -5759,7 +6063,7 @@ var IsomorphicBridge = class {
5759
6063
  });
5760
6064
  const children = [];
5761
6065
  for (const childEntry of treeResult.tree) {
5762
- const childPath = path4 ? `${path4}/${childEntry.path}` : childEntry.path;
6066
+ const childPath = path5 ? `${path5}/${childEntry.path}` : childEntry.path;
5763
6067
  if (childEntry.type === "tree") {
5764
6068
  children.push(childEntry);
5765
6069
  } else {
@@ -5769,7 +6073,7 @@ var IsomorphicBridge = class {
5769
6073
  }
5770
6074
  }
5771
6075
  for (const childEntry of children) {
5772
- const childPath = path4 ? `${path4}/${childEntry.path}` : childEntry.path;
6076
+ const childPath = path5 ? `${path5}/${childEntry.path}` : childEntry.path;
5773
6077
  await this.listEntries({
5774
6078
  pattern,
5775
6079
  entry: childEntry,
@@ -5778,17 +6082,17 @@ var IsomorphicBridge = class {
5778
6082
  });
5779
6083
  }
5780
6084
  }
5781
- async resolvePathEntries(path4, ref) {
5782
- let pathParts = path4.split("/");
6085
+ async resolvePathEntries(path5, ref) {
6086
+ let pathParts = path5.split("/");
5783
6087
  const result = await import_isomorphic_git.default.walk({
5784
6088
  ...this.isomorphicConfig,
5785
6089
  map: async (filepath, [head]) => {
5786
6090
  if (head._fullpath === ".") {
5787
6091
  return head;
5788
6092
  }
5789
- if (path4.startsWith(filepath)) {
5790
- if ((0, import_path4.dirname)(path4) === (0, import_path4.dirname)(filepath)) {
5791
- if (path4 === filepath) {
6093
+ if (path5.startsWith(filepath)) {
6094
+ if ((0, import_path5.dirname)(path5) === (0, import_path5.dirname)(filepath)) {
6095
+ if (path5 === filepath) {
5792
6096
  return head;
5793
6097
  }
5794
6098
  } else {
@@ -5808,7 +6112,7 @@ var IsomorphicBridge = class {
5808
6112
  }
5809
6113
  return { pathParts, pathEntries };
5810
6114
  }
5811
- async updateTreeHierarchy(existingOid, updatedOid, path4, type, pathEntries, pathParts) {
6115
+ async updateTreeHierarchy(existingOid, updatedOid, path5, type, pathEntries, pathParts) {
5812
6116
  const lastIdx = pathEntries.length - 1;
5813
6117
  const parentEntry = pathEntries[lastIdx];
5814
6118
  const parentPath = pathParts[lastIdx];
@@ -5823,7 +6127,7 @@ var IsomorphicBridge = class {
5823
6127
  cache: this.cache
5824
6128
  });
5825
6129
  tree = existingOid ? treeResult.tree.map((entry) => {
5826
- if (entry.path === path4) {
6130
+ if (entry.path === path5) {
5827
6131
  entry.oid = updatedOid;
5828
6132
  }
5829
6133
  return entry;
@@ -5832,7 +6136,7 @@ var IsomorphicBridge = class {
5832
6136
  {
5833
6137
  oid: updatedOid,
5834
6138
  type,
5835
- path: path4,
6139
+ path: path5,
5836
6140
  mode
5837
6141
  }
5838
6142
  ];
@@ -5841,7 +6145,7 @@ var IsomorphicBridge = class {
5841
6145
  {
5842
6146
  oid: updatedOid,
5843
6147
  type,
5844
- path: path4,
6148
+ path: path5,
5845
6149
  mode
5846
6150
  }
5847
6151
  ];
@@ -5942,7 +6246,7 @@ var IsomorphicBridge = class {
5942
6246
  path: parentPath,
5943
6247
  results
5944
6248
  });
5945
- return results.map((path4) => this.unqualifyPath(path4)).filter((path4) => path4.endsWith(extension));
6249
+ return results.map((path5) => this.unqualifyPath(path5)).filter((path5) => path5.endsWith(extension));
5946
6250
  }
5947
6251
  supportsBuilding() {
5948
6252
  return true;