@tinacms/graphql 1.4.40 → 1.5.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.
package/dist/index.js CHANGED
@@ -61,11 +61,8 @@ __export(src_exports, {
61
61
  module.exports = __toCommonJS(src_exports);
62
62
 
63
63
  // src/build.ts
64
- var import_lodash3 = __toESM(require("lodash"));
65
64
  var import_graphql2 = require("graphql");
66
-
67
- // src/ast-builder/index.ts
68
- var import_lodash = __toESM(require("lodash"));
65
+ var import_lodash3 = __toESM(require("lodash.uniqby"));
69
66
 
70
67
  // src/util.ts
71
68
  var yup = __toESM(require("yup"));
@@ -108,8 +105,20 @@ var btoa = (string2) => {
108
105
  var lastItem = (arr) => {
109
106
  return arr[arr.length - 1];
110
107
  };
108
+ var get = (obj, path7, defaultValue = void 0) => {
109
+ const travel = (regexp) => String.prototype.split.call(path7, regexp).filter(Boolean).reduce(
110
+ (res, key) => res !== null && res !== void 0 ? res[key] : res,
111
+ obj
112
+ );
113
+ const result = travel(/[,[\]]+?/) || travel(/[,[\].]+?/);
114
+ return result === void 0 || result === obj ? defaultValue : result;
115
+ };
116
+ var flattenDeep = (arr) => arr.flatMap(
117
+ (subArray, index) => Array.isArray(subArray) ? flattenDeep(subArray) : subArray
118
+ );
111
119
 
112
120
  // src/ast-builder/index.ts
121
+ var import_lodash = __toESM(require("lodash.uniqby"));
113
122
  var SysFieldDefinition = {
114
123
  kind: "Field",
115
124
  name: {
@@ -995,7 +1004,7 @@ var astBuilder = {
995
1004
  };
996
1005
  },
997
1006
  toGraphQLAst: (ast) => {
998
- const definitions = import_lodash.default.uniqBy(
1007
+ const definitions = (0, import_lodash.default)(
999
1008
  [
1000
1009
  ...extractInlineTypes(ast.query),
1001
1010
  ...extractInlineTypes(ast.globalTemplates),
@@ -1016,25 +1025,24 @@ var capitalize = (s) => {
1016
1025
  };
1017
1026
  var extractInlineTypes = (item) => {
1018
1027
  if (Array.isArray(item)) {
1019
- const accumulator = item.map((i) => {
1028
+ const accumulator2 = item.map((i) => {
1020
1029
  return extractInlineTypes(i);
1021
1030
  });
1022
- return import_lodash.default.flattenDeep(accumulator);
1023
- } else {
1024
- const accumulator = [item];
1025
- for (const node of walk(item)) {
1026
- if (node.kind === "UnionTypeDefinition") {
1027
- node.types = import_lodash.default.uniqBy(node.types, (type) => type.name.value);
1028
- }
1029
- if (node.kind === "NamedType") {
1030
- if (typeof node.name.value !== "string") {
1031
- accumulator.push(node.name.value);
1032
- node.name.value = node.name.value.name.value;
1033
- }
1031
+ return flattenDeep(accumulator2);
1032
+ }
1033
+ const accumulator = [item];
1034
+ for (const node of walk(item)) {
1035
+ if (node.kind === "UnionTypeDefinition") {
1036
+ node.types = (0, import_lodash.default)(node.types, (type) => type.name.value);
1037
+ }
1038
+ if (node.kind === "NamedType") {
1039
+ if (typeof node.name.value !== "string") {
1040
+ accumulator.push(node.name.value);
1041
+ node.name.value = node.name.value.name.value;
1034
1042
  }
1035
1043
  }
1036
- return accumulator;
1037
1044
  }
1045
+ return accumulator;
1038
1046
  };
1039
1047
  function* walk(maybeNode, visited = /* @__PURE__ */ new WeakSet()) {
1040
1048
  if (typeof maybeNode === "string") {
@@ -2719,7 +2727,7 @@ var filterSelections = (arr) => {
2719
2727
  var import_schema_tools2 = require("@tinacms/schema-tools");
2720
2728
 
2721
2729
  // src/schema/validate.ts
2722
- var import_lodash2 = __toESM(require("lodash"));
2730
+ var import_lodash2 = __toESM(require("lodash.clonedeep"));
2723
2731
  var yup2 = __toESM(require("yup"));
2724
2732
  var import_schema_tools = require("@tinacms/schema-tools");
2725
2733
  var FIELD_TYPES = [
@@ -2735,7 +2743,7 @@ var FIELD_TYPES = [
2735
2743
  ];
2736
2744
  var validateSchema = async (schema) => {
2737
2745
  const schema2 = addNamespaceToSchema(
2738
- import_lodash2.default.cloneDeep(schema)
2746
+ (0, import_lodash2.default)(schema)
2739
2747
  );
2740
2748
  const collections = await sequential(
2741
2749
  schema2.collections,
@@ -2843,7 +2851,7 @@ var validateCollection = async (collection) => {
2843
2851
  }
2844
2852
  if (validCollection.fields) {
2845
2853
  if (typeof validCollection.fields === "string") {
2846
- throw new Error(`Global templates are not yet supported`);
2854
+ throw new Error("Global templates are not yet supported");
2847
2855
  }
2848
2856
  fields = await sequential(validCollection.fields, async (field) => {
2849
2857
  return validateField(field);
@@ -2874,7 +2882,7 @@ var validateField = async (field) => {
2874
2882
  // package.json
2875
2883
  var package_default = {
2876
2884
  name: "@tinacms/graphql",
2877
- version: "1.4.40",
2885
+ version: "1.5.1",
2878
2886
  main: "dist/index.js",
2879
2887
  module: "dist/index.mjs",
2880
2888
  typings: "dist/index.d.ts",
@@ -2908,24 +2916,26 @@ var package_default = {
2908
2916
  "@iarna/toml": "^2.2.5",
2909
2917
  "@tinacms/mdx": "workspace:*",
2910
2918
  "@tinacms/schema-tools": "workspace:*",
2911
- "abstract-level": "^1.0.3",
2912
- "date-fns": "^2.21.1",
2913
- "fast-glob": "^3.2.5",
2914
- "fs-extra": "^9.0.1",
2919
+ "abstract-level": "^1.0.4",
2920
+ "date-fns": "^2.30.0",
2921
+ "fast-glob": "^3.3.2",
2922
+ "fs-extra": "^9.1.0",
2915
2923
  "glob-parent": "^6.0.2",
2916
2924
  graphql: "15.8.0",
2917
- "gray-matter": "^4.0.2",
2918
- "isomorphic-git": "^1.21.0",
2925
+ "gray-matter": "^4.0.3",
2926
+ "isomorphic-git": "^1.27.1",
2919
2927
  "js-sha1": "^0.6.0",
2920
2928
  "js-yaml": "^3.14.1",
2921
2929
  "jsonpath-plus": "^6.0.1",
2922
- lodash: "4.17.20",
2930
+ "lodash.clonedeep": "^4.5.0",
2931
+ "lodash.set": "^4.3.2",
2932
+ "lodash.uniqby": "^4.7.0",
2923
2933
  "many-level": "^2.0.0",
2924
2934
  micromatch: "4.0.5",
2925
2935
  "normalize-path": "^3.0.0",
2926
- "readable-stream": "^4.3.0",
2936
+ "readable-stream": "^4.5.2",
2927
2937
  scmp: "^2.1.0",
2928
- yup: "^0.32.9"
2938
+ yup: "^0.32.11"
2929
2939
  },
2930
2940
  publishConfig: {
2931
2941
  registry: "https://registry.npmjs.org"
@@ -2937,29 +2947,28 @@ var package_default = {
2937
2947
  devDependencies: {
2938
2948
  "@tinacms/schema-tools": "workspace:*",
2939
2949
  "@tinacms/scripts": "workspace:*",
2940
- "@types/cors": "^2.8.7",
2950
+ "@types/cors": "^2.8.17",
2941
2951
  "@types/estree": "^0.0.50",
2942
- "@types/express": "^4.17.8",
2943
- "@types/fs-extra": "^9.0.2",
2944
- "@types/jest": "^26.0.4",
2945
- "@types/js-yaml": "^3.12.5",
2946
- "@types/lodash": "4.14.190",
2947
- "@types/lodash.camelcase": "^4.3.6",
2948
- "@types/lodash.upperfirst": "^4.3.6",
2949
- "@types/lru-cache": "^5.1.0",
2950
- "@types/mdast": "^3.0.10",
2951
- "@types/micromatch": "^4.0.2",
2952
- "@types/node": "^14.17.34",
2953
- "@types/normalize-path": "^3.0.0",
2954
- "@types/ws": "^7.2.6",
2955
- "@types/yup": "^0.29.7",
2956
- jest: "^29.5.0",
2957
- "jest-diff": "^29.5.0",
2952
+ "@types/express": "^4.17.21",
2953
+ "@types/fs-extra": "^9.0.13",
2954
+ "@types/jest": "^26.0.24",
2955
+ "@types/js-yaml": "^3.12.10",
2956
+ "@types/lodash.camelcase": "^4.3.9",
2957
+ "@types/lodash.upperfirst": "^4.3.9",
2958
+ "@types/lru-cache": "^5.1.1",
2959
+ "@types/mdast": "^3.0.15",
2960
+ "@types/micromatch": "^4.0.9",
2961
+ "@types/node": "^14.18.63",
2962
+ "@types/normalize-path": "^3.0.2",
2963
+ "@types/ws": "^7.4.7",
2964
+ "@types/yup": "^0.29.14",
2965
+ jest: "^29.7.0",
2966
+ "jest-diff": "^29.7.0",
2958
2967
  "jest-file-snapshot": "^0.5.0",
2959
- "jest-matcher-utils": "^29.5.0",
2968
+ "jest-matcher-utils": "^29.7.0",
2960
2969
  "memory-level": "^1.0.0",
2961
2970
  nodemon: "2.0.19",
2962
- typescript: "4.7.4"
2971
+ typescript: "^5.5.4"
2963
2972
  }
2964
2973
  };
2965
2974
 
@@ -3029,7 +3038,7 @@ var _buildFragments = async (builder, tinaSchema) => {
3029
3038
  });
3030
3039
  const fragDoc = {
3031
3040
  kind: "Document",
3032
- definitions: import_lodash3.default.uniqBy(
3041
+ definitions: (0, import_lodash3.default)(
3033
3042
  extractInlineTypes(fragmentDefinitionsFields),
3034
3043
  (node) => node.name.value
3035
3044
  )
@@ -3061,7 +3070,7 @@ var _buildQueries = async (builder, tinaSchema) => {
3061
3070
  });
3062
3071
  const queryDoc = {
3063
3072
  kind: "Document",
3064
- definitions: import_lodash3.default.uniqBy(
3073
+ definitions: (0, import_lodash3.default)(
3065
3074
  extractInlineTypes(operationsDefinitions),
3066
3075
  (node) => node.name.value
3067
3076
  )
@@ -3149,7 +3158,7 @@ var _buildSchema = async (builder, tinaSchema) => {
3149
3158
  );
3150
3159
  return {
3151
3160
  kind: "Document",
3152
- definitions: import_lodash3.default.uniqBy(
3161
+ definitions: (0, import_lodash3.default)(
3153
3162
  extractInlineTypes(definitions),
3154
3163
  (node) => node.name.value
3155
3164
  )
@@ -5250,7 +5259,7 @@ var resolveDateInput = (value) => {
5250
5259
  };
5251
5260
 
5252
5261
  // src/resolve.ts
5253
- var import_lodash4 = __toESM(require("lodash"));
5262
+ var import_lodash4 = __toESM(require("lodash.set"));
5254
5263
 
5255
5264
  // src/error.ts
5256
5265
  var import_graphql4 = require("graphql");
@@ -5277,7 +5286,7 @@ var resolve = async ({
5277
5286
  const verboseValue = verbose != null ? verbose : true;
5278
5287
  const graphQLSchemaAst = await database.getGraphQLSchema();
5279
5288
  if (!graphQLSchemaAst) {
5280
- throw new import_graphql5.GraphQLError(`GraphQL schema not found`);
5289
+ throw new import_graphql5.GraphQLError("GraphQL schema not found");
5281
5290
  }
5282
5291
  const graphQLSchema = (0, import_graphql5.buildASTSchema)(graphQLSchemaAst);
5283
5292
  const tinaConfig = await database.getTinaSchema();
@@ -5305,9 +5314,8 @@ var resolve = async ({
5305
5314
  const lookup = await database.getLookup(namedType);
5306
5315
  if (lookup.resolveType === "unionData") {
5307
5316
  return lookup.typeMap[source._template];
5308
- } else {
5309
- throw new Error(`Unable to find lookup key for ${namedType}`);
5310
5317
  }
5318
+ throw new Error(`Unable to find lookup key for ${namedType}`);
5311
5319
  },
5312
5320
  fieldResolver: async (source = {}, _args = {}, _context, info) => {
5313
5321
  var _a2, _b, _c, _d;
@@ -5367,7 +5375,7 @@ var resolve = async ({
5367
5375
  const sub = args.sub || (ctxUser == null ? void 0 : ctxUser.sub);
5368
5376
  const collection = tinaSchema.getCollections().find((c) => c.isAuthCollection);
5369
5377
  if (!collection) {
5370
- throw new Error(`Auth collection not found`);
5378
+ throw new Error("Auth collection not found");
5371
5379
  }
5372
5380
  const userFields = mapUserFields(collection, ["_rawData"]);
5373
5381
  if (!userFields.length) {
@@ -5383,7 +5391,7 @@ var resolve = async ({
5383
5391
  const userField = userFields[0];
5384
5392
  const realPath = `${collection.path}/index.json`;
5385
5393
  const userDoc = await resolver.getDocument(realPath);
5386
- const users = import_lodash4.default.get(userDoc, userField.path);
5394
+ const users = get(userDoc, userField.path);
5387
5395
  if (!users) {
5388
5396
  throw new Error("No users found");
5389
5397
  }
@@ -5396,7 +5404,7 @@ var resolve = async ({
5396
5404
  return null;
5397
5405
  }
5398
5406
  if (info.fieldName === "authenticate") {
5399
- const saltedHash = import_lodash4.default.get(user, [passwordFieldName || "", "value"]);
5407
+ const saltedHash = get(user, [passwordFieldName || "", "value"]);
5400
5408
  if (!saltedHash) {
5401
5409
  throw new Error("No password field found on user field");
5402
5410
  }
@@ -5406,12 +5414,10 @@ var resolve = async ({
5406
5414
  });
5407
5415
  if (matches) {
5408
5416
  return user;
5409
- } else {
5410
- return null;
5411
5417
  }
5412
- } else {
5413
- return user;
5418
+ return null;
5414
5419
  }
5420
+ return user;
5415
5421
  }
5416
5422
  if (info.fieldName === "updatePassword") {
5417
5423
  if (!(ctxUser == null ? void 0 : ctxUser.sub)) {
@@ -5422,7 +5428,7 @@ var resolve = async ({
5422
5428
  }
5423
5429
  const collection = tinaSchema.getCollections().find((c) => c.isAuthCollection);
5424
5430
  if (!collection) {
5425
- throw new Error(`Auth collection not found`);
5431
+ throw new Error("Auth collection not found");
5426
5432
  }
5427
5433
  const userFields = mapUserFields(collection, ["_rawData"]);
5428
5434
  if (!userFields.length) {
@@ -5438,7 +5444,7 @@ var resolve = async ({
5438
5444
  const userField = userFields[0];
5439
5445
  const realPath = `${collection.path}/index.json`;
5440
5446
  const userDoc = await resolver.getDocument(realPath);
5441
- const users = import_lodash4.default.get(userDoc, userField.path);
5447
+ const users = get(userDoc, userField.path);
5442
5448
  if (!users) {
5443
5449
  throw new Error("No users found");
5444
5450
  }
@@ -5452,21 +5458,20 @@ var resolve = async ({
5452
5458
  passwordChangeRequired: false
5453
5459
  };
5454
5460
  const params = {};
5455
- import_lodash4.default.set(
5461
+ (0, import_lodash4.default)(
5456
5462
  params,
5457
5463
  userField.path.slice(1),
5458
5464
  users.map((u) => {
5459
5465
  if (user[idFieldName] === u[idFieldName]) {
5460
5466
  return user;
5461
- } else {
5462
- return {
5463
- ...u,
5464
- [passwordFieldName]: {
5465
- ...u[passwordFieldName],
5466
- value: ""
5467
- }
5468
- };
5469
5467
  }
5468
+ return {
5469
+ ...u,
5470
+ [passwordFieldName]: {
5471
+ ...u[passwordFieldName],
5472
+ value: ""
5473
+ }
5474
+ };
5470
5475
  })
5471
5476
  );
5472
5477
  await resolver.updateResolveDocument({
@@ -5493,7 +5498,7 @@ var resolve = async ({
5493
5498
  if (typeof value === "string" && value !== "") {
5494
5499
  return resolver.getDocument(value);
5495
5500
  }
5496
- if (args && args.collection && info.fieldName === "addPendingDocument") {
5501
+ if ((args == null ? void 0 : args.collection) && info.fieldName === "addPendingDocument") {
5497
5502
  return resolver.resolveDocument({
5498
5503
  args: { ...args, params: {} },
5499
5504
  collection: args.collection,
@@ -5509,7 +5514,7 @@ var resolve = async ({
5509
5514
  "deleteDocument",
5510
5515
  "createFolder"
5511
5516
  ].includes(info.fieldName)) {
5512
- const result2 = await resolver.resolveDocument({
5517
+ const result = await resolver.resolveDocument({
5513
5518
  args,
5514
5519
  collection: args.collection,
5515
5520
  isMutation,
@@ -5520,7 +5525,7 @@ var resolve = async ({
5520
5525
  isAddPendingDocument: false,
5521
5526
  isCollectionSpecific: false
5522
5527
  });
5523
- return result2;
5528
+ return result;
5524
5529
  }
5525
5530
  return value;
5526
5531
  case "multiCollectionDocumentList":
@@ -5531,7 +5536,8 @@ var resolve = async ({
5531
5536
  return { node: document };
5532
5537
  })
5533
5538
  };
5534
- } else if (info.fieldName === "documents" && (value == null ? void 0 : value.collection) && (value == null ? void 0 : value.hasDocuments)) {
5539
+ }
5540
+ if (info.fieldName === "documents" && (value == null ? void 0 : value.collection) && (value == null ? void 0 : value.hasDocuments)) {
5535
5541
  let filter = args.filter;
5536
5542
  if (typeof (args == null ? void 0 : args.filter) !== "undefined" && (args == null ? void 0 : args.filter) !== null && typeof ((_b = value == null ? void 0 : value.collection) == null ? void 0 : _b.name) === "string" && Object.keys(args.filter).includes((_c = value == null ? void 0 : value.collection) == null ? void 0 : _c.name) && typeof args.filter[(_d = value == null ? void 0 : value.collection) == null ? void 0 : _d.name] !== "undefined") {
5537
5543
  filter = args.filter[value.collection.name];
@@ -5543,12 +5549,11 @@ var resolve = async ({
5543
5549
  },
5544
5550
  collection: value.collection
5545
5551
  });
5546
- } else {
5547
- throw new Error(
5548
- `Expected an array for result of ${info.fieldName} at ${info.path}`
5549
- );
5550
5552
  }
5551
- case "collectionDocument":
5553
+ throw new Error(
5554
+ `Expected an array for result of ${info.fieldName} at ${info.path}`
5555
+ );
5556
+ case "collectionDocument": {
5552
5557
  if (value) {
5553
5558
  return value;
5554
5559
  }
@@ -5561,6 +5566,7 @@ var resolve = async ({
5561
5566
  isCollectionSpecific: true
5562
5567
  });
5563
5568
  return result;
5569
+ }
5564
5570
  case "collectionDocumentList":
5565
5571
  return resolver.resolveCollectionConnection({
5566
5572
  args,
@@ -5569,7 +5575,7 @@ var resolve = async ({
5569
5575
  case "unionData":
5570
5576
  if (!value) {
5571
5577
  if (args.relativePath) {
5572
- const result2 = await resolver.resolveDocument({
5578
+ const result = await resolver.resolveDocument({
5573
5579
  args,
5574
5580
  collection: lookup.collection,
5575
5581
  isMutation,
@@ -5577,13 +5583,13 @@ var resolve = async ({
5577
5583
  isAddPendingDocument: false,
5578
5584
  isCollectionSpecific: true
5579
5585
  });
5580
- return result2;
5586
+ return result;
5581
5587
  }
5582
5588
  }
5583
5589
  return value;
5584
5590
  default:
5585
5591
  console.error(lookup);
5586
- throw new Error(`Unexpected resolve type`);
5592
+ throw new Error("Unexpected resolve type");
5587
5593
  }
5588
5594
  } catch (e) {
5589
5595
  handleFetchErrorError(e, verboseValue);
@@ -5614,9 +5620,8 @@ var resolve = async ({
5614
5620
  return {
5615
5621
  errors: [e]
5616
5622
  };
5617
- } else {
5618
- throw e;
5619
5623
  }
5624
+ throw e;
5620
5625
  }
5621
5626
  };
5622
5627
 
@@ -5642,11 +5647,11 @@ var TinaLevelClient = class extends import_many_level.ManyLevelGuest {
5642
5647
  };
5643
5648
 
5644
5649
  // src/database/index.ts
5645
- var import_path4 = __toESM(require("path"));
5650
+ var import_node_path = __toESM(require("path"));
5646
5651
  var import_graphql6 = require("graphql");
5647
5652
  var import_micromatch2 = __toESM(require("micromatch"));
5648
5653
  var import_js_sha12 = __toESM(require("js-sha1"));
5649
- var import_lodash5 = __toESM(require("lodash"));
5654
+ var import_lodash5 = __toESM(require("lodash.set"));
5650
5655
  var createLocalDatabase = (config) => {
5651
5656
  const level = new TinaLevelClient(config == null ? void 0 : config.port);
5652
5657
  level.openConnection();
@@ -5712,7 +5717,7 @@ var Database = class {
5712
5717
  } catch (e) {
5713
5718
  }
5714
5719
  };
5715
- this.getGeneratedFolder = () => import_path4.default.join(this.tinaDirectory, "__generated__");
5720
+ this.getGeneratedFolder = () => import_node_path.default.join(this.tinaDirectory, "__generated__");
5716
5721
  this.getMetadata = async (key) => {
5717
5722
  await this.initLevel();
5718
5723
  let metadataLevel = this.rootLevel.sublevel("_metadata", SUBLEVEL_OPTIONS);
@@ -6023,7 +6028,7 @@ var Database = class {
6023
6028
  );
6024
6029
  const writeTemplateKey = templateDetails.info.type === "union";
6025
6030
  const aliasedData = applyNameOverrides(templateDetails.template, payload);
6026
- const extension = import_path4.default.extname(filepath);
6031
+ const extension = import_node_path.default.extname(filepath);
6027
6032
  return stringifyFile(
6028
6033
  aliasedData,
6029
6034
  extension,
@@ -6046,7 +6051,7 @@ var Database = class {
6046
6051
  this.getLookup = async (returnType) => {
6047
6052
  await this.initLevel();
6048
6053
  const lookupPath = (0, import_schema_tools3.normalizePath)(
6049
- import_path4.default.join(this.getGeneratedFolder(), `_lookup.json`)
6054
+ import_node_path.default.join(this.getGeneratedFolder(), `_lookup.json`)
6050
6055
  );
6051
6056
  if (!this._lookup) {
6052
6057
  this._lookup = await this.contentLevel.sublevel(
@@ -6059,7 +6064,7 @@ var Database = class {
6059
6064
  this.getGraphQLSchema = async () => {
6060
6065
  await this.initLevel();
6061
6066
  const graphqlPath = (0, import_schema_tools3.normalizePath)(
6062
- import_path4.default.join(this.getGeneratedFolder(), `_graphql.json`)
6067
+ import_node_path.default.join(this.getGeneratedFolder(), `_graphql.json`)
6063
6068
  );
6064
6069
  return await this.contentLevel.sublevel(
6065
6070
  CONTENT_ROOT_PREFIX,
@@ -6071,7 +6076,7 @@ var Database = class {
6071
6076
  throw new Error(`No bridge configured`);
6072
6077
  }
6073
6078
  const graphqlPath = (0, import_schema_tools3.normalizePath)(
6074
- import_path4.default.join(this.getGeneratedFolder(), `_graphql.json`)
6079
+ import_node_path.default.join(this.getGeneratedFolder(), `_graphql.json`)
6075
6080
  );
6076
6081
  const _graphql = await this.bridge.get(graphqlPath);
6077
6082
  return JSON.parse(_graphql);
@@ -6079,7 +6084,7 @@ var Database = class {
6079
6084
  this.getTinaSchema = async (level) => {
6080
6085
  await this.initLevel();
6081
6086
  const schemaPath = (0, import_schema_tools3.normalizePath)(
6082
- import_path4.default.join(this.getGeneratedFolder(), `_schema.json`)
6087
+ import_node_path.default.join(this.getGeneratedFolder(), `_schema.json`)
6083
6088
  );
6084
6089
  return await (level || this.contentLevel).sublevel(
6085
6090
  CONTENT_ROOT_PREFIX,
@@ -6095,7 +6100,7 @@ var Database = class {
6095
6100
  if (!schema) {
6096
6101
  throw new Error(
6097
6102
  `Unable to get schema from level db: ${(0, import_schema_tools3.normalizePath)(
6098
- import_path4.default.join(this.getGeneratedFolder(), `_schema.json`)
6103
+ import_node_path.default.join(this.getGeneratedFolder(), `_schema.json`)
6099
6104
  )}`
6100
6105
  );
6101
6106
  }
@@ -6282,9 +6287,8 @@ var Database = class {
6282
6287
  collection: collection.name,
6283
6288
  stack: error.stack
6284
6289
  });
6285
- } else {
6286
- throw error;
6287
6290
  }
6291
+ throw error;
6288
6292
  }
6289
6293
  }),
6290
6294
  pageInfo: {
@@ -6312,7 +6316,7 @@ var Database = class {
6312
6316
  lookup = lookupFromLockFile || JSON.parse(
6313
6317
  await this.bridge.get(
6314
6318
  (0, import_schema_tools3.normalizePath)(
6315
- import_path4.default.join(this.getGeneratedFolder(), "_lookup.json")
6319
+ import_node_path.default.join(this.getGeneratedFolder(), "_lookup.json")
6316
6320
  )
6317
6321
  )
6318
6322
  );
@@ -6336,15 +6340,15 @@ var Database = class {
6336
6340
  }
6337
6341
  const contentRootLevel = nextLevel.sublevel(CONTENT_ROOT_PREFIX, SUBLEVEL_OPTIONS);
6338
6342
  await contentRootLevel.put(
6339
- (0, import_schema_tools3.normalizePath)(import_path4.default.join(this.getGeneratedFolder(), "_graphql.json")),
6343
+ (0, import_schema_tools3.normalizePath)(import_node_path.default.join(this.getGeneratedFolder(), "_graphql.json")),
6340
6344
  graphQLSchema
6341
6345
  );
6342
6346
  await contentRootLevel.put(
6343
- (0, import_schema_tools3.normalizePath)(import_path4.default.join(this.getGeneratedFolder(), "_schema.json")),
6347
+ (0, import_schema_tools3.normalizePath)(import_node_path.default.join(this.getGeneratedFolder(), "_schema.json")),
6344
6348
  tinaSchema.schema
6345
6349
  );
6346
6350
  await contentRootLevel.put(
6347
- (0, import_schema_tools3.normalizePath)(import_path4.default.join(this.getGeneratedFolder(), "_lookup.json")),
6351
+ (0, import_schema_tools3.normalizePath)(import_node_path.default.join(this.getGeneratedFolder(), "_lookup.json")),
6348
6352
  lookup
6349
6353
  );
6350
6354
  const result = await this._indexAllContent(
@@ -6634,9 +6638,9 @@ var Database = class {
6634
6638
  };
6635
6639
  var hashPasswordVisitor = async (node, path7) => {
6636
6640
  const passwordValuePath = [...path7, "value"];
6637
- const plaintextPassword = import_lodash5.default.get(node, passwordValuePath);
6641
+ const plaintextPassword = get(node, passwordValuePath);
6638
6642
  if (plaintextPassword) {
6639
- import_lodash5.default.set(
6643
+ (0, import_lodash5.default)(
6640
6644
  node,
6641
6645
  passwordValuePath,
6642
6646
  await generatePasswordHash({ password: plaintextPassword })
@@ -6821,13 +6825,13 @@ var _deleteIndexContent = async (database, documentPaths, enqueueOps, collection
6821
6825
  // src/git/index.ts
6822
6826
  var import_isomorphic_git = __toESM(require("isomorphic-git"));
6823
6827
  var import_fs_extra = __toESM(require("fs-extra"));
6824
- var import_path5 = __toESM(require("path"));
6828
+ var import_path4 = __toESM(require("path"));
6825
6829
  var import_micromatch3 = __toESM(require("micromatch"));
6826
6830
  var findGitRoot = async (dir) => {
6827
- if (await import_fs_extra.default.pathExists(import_path5.default.join(dir, ".git"))) {
6831
+ if (await import_fs_extra.default.pathExists(import_path4.default.join(dir, ".git"))) {
6828
6832
  return dir;
6829
6833
  }
6830
- const parentDir = import_path5.default.dirname(dir);
6834
+ const parentDir = import_path4.default.dirname(dir);
6831
6835
  if (parentDir === dir) {
6832
6836
  throw new Error("Could not find .git directory");
6833
6837
  }
@@ -6909,7 +6913,7 @@ var shaExists = async ({
6909
6913
  // src/database/bridge/filesystem.ts
6910
6914
  var import_fs_extra2 = __toESM(require("fs-extra"));
6911
6915
  var import_fast_glob = __toESM(require("fast-glob"));
6912
- var import_path6 = __toESM(require("path"));
6916
+ var import_path5 = __toESM(require("path"));
6913
6917
  var import_normalize_path = __toESM(require("normalize-path"));
6914
6918
  var FilesystemBridge = class {
6915
6919
  constructor(rootPath, outputPath) {
@@ -6917,9 +6921,9 @@ var FilesystemBridge = class {
6917
6921
  this.outputPath = outputPath || rootPath;
6918
6922
  }
6919
6923
  async glob(pattern, extension) {
6920
- const basePath = import_path6.default.join(this.outputPath, ...pattern.split("/"));
6924
+ const basePath = import_path5.default.join(this.outputPath, ...pattern.split("/"));
6921
6925
  const items = await (0, import_fast_glob.default)(
6922
- import_path6.default.join(basePath, "**", `/*.${extension}`).replace(/\\/g, "/"),
6926
+ import_path5.default.join(basePath, "**", `/*.${extension}`).replace(/\\/g, "/"),
6923
6927
  {
6924
6928
  dot: true,
6925
6929
  ignore: ["**/node_modules/**"]
@@ -6931,14 +6935,14 @@ var FilesystemBridge = class {
6931
6935
  });
6932
6936
  }
6933
6937
  async delete(filepath) {
6934
- await import_fs_extra2.default.remove(import_path6.default.join(this.outputPath, filepath));
6938
+ await import_fs_extra2.default.remove(import_path5.default.join(this.outputPath, filepath));
6935
6939
  }
6936
6940
  async get(filepath) {
6937
- return import_fs_extra2.default.readFileSync(import_path6.default.join(this.outputPath, filepath)).toString();
6941
+ return import_fs_extra2.default.readFileSync(import_path5.default.join(this.outputPath, filepath)).toString();
6938
6942
  }
6939
6943
  async put(filepath, data, basePathOverride) {
6940
6944
  const basePath = basePathOverride || this.outputPath;
6941
- await import_fs_extra2.default.outputFileSync(import_path6.default.join(basePath, filepath), data);
6945
+ await import_fs_extra2.default.outputFileSync(import_path5.default.join(basePath, filepath), data);
6942
6946
  }
6943
6947
  };
6944
6948
  var AuditFileSystemBridge = class extends FilesystemBridge {
@@ -6963,7 +6967,7 @@ var import_fs_extra3 = __toESM(require("fs-extra"));
6963
6967
  var import_glob_parent = __toESM(require("glob-parent"));
6964
6968
  var import_normalize_path2 = __toESM(require("normalize-path"));
6965
6969
  var import_graphql7 = require("graphql");
6966
- var import_path7 = require("path");
6970
+ var import_path6 = require("path");
6967
6971
  var flat = typeof Array.prototype.flat === "undefined" ? (entries) => entries.reduce((acc, x) => acc.concat(x), []) : (entries) => entries.flat();
6968
6972
  var toUint8Array = (buf) => {
6969
6973
  const ab = new ArrayBuffer(buf.length);
@@ -7060,7 +7064,7 @@ var IsomorphicBridge = class {
7060
7064
  return head;
7061
7065
  }
7062
7066
  if (path7.startsWith(filepath)) {
7063
- if ((0, import_path7.dirname)(path7) === (0, import_path7.dirname)(filepath)) {
7067
+ if ((0, import_path6.dirname)(path7) === (0, import_path6.dirname)(filepath)) {
7064
7068
  if (path7 === filepath) {
7065
7069
  return head;
7066
7070
  }
@@ -7386,3 +7390,5 @@ var buildSchema = async (config, flags) => {
7386
7390
  transformDocument,
7387
7391
  transformDocumentIntoPayload
7388
7392
  });
7393
+ //! Replaces _.flattenDeep()
7394
+ //! Replaces _.get()