@tinacms/graphql 2.1.4 → 2.2.0

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.
@@ -19,6 +19,7 @@ export interface DatabaseArgs {
19
19
  indexStatusCallback?: IndexStatusCallback;
20
20
  version?: boolean;
21
21
  namespace?: string;
22
+ levelBatchSize?: number;
22
23
  }
23
24
  export interface GitProvider {
24
25
  onPut: (key: string, value: string) => Promise<void>;
@@ -69,6 +70,7 @@ export declare class Database {
69
70
  indexStatusCallback: IndexStatusCallback | undefined;
70
71
  private readonly onPut;
71
72
  private readonly onDelete;
73
+ private readonly levelBatchSize;
72
74
  private tinaSchema;
73
75
  private contentNamespace;
74
76
  private collectionIndexDefinitions;
package/dist/index.js CHANGED
@@ -3026,7 +3026,7 @@ var validateField = async (field) => {
3026
3026
  var package_default = {
3027
3027
  name: "@tinacms/graphql",
3028
3028
  type: "module",
3029
- version: "2.1.4",
3029
+ version: "2.2.0",
3030
3030
  main: "dist/index.js",
3031
3031
  module: "./dist/index.js",
3032
3032
  files: [
@@ -6598,6 +6598,7 @@ var createDatabaseInternal = (config) => {
6598
6598
  });
6599
6599
  };
6600
6600
  var SYSTEM_FILES = ["_schema", "_graphql", "_lookup"];
6601
+ var DEFAULT_LEVEL_BATCH_SIZE = 25;
6601
6602
  var defaultStatusCallback = () => Promise.resolve();
6602
6603
  var defaultOnPut = () => Promise.resolve();
6603
6604
  var defaultOnDelete = () => Promise.resolve();
@@ -6610,6 +6611,7 @@ var Database = class {
6610
6611
  this.indexStatusCallback = config.indexStatusCallback || defaultStatusCallback;
6611
6612
  this.onPut = config.onPut || defaultOnPut;
6612
6613
  this.onDelete = config.onDelete || defaultOnDelete;
6614
+ this.levelBatchSize = config.levelBatchSize ?? DEFAULT_LEVEL_BATCH_SIZE;
6613
6615
  this.contentNamespace = config.namespace;
6614
6616
  }
6615
6617
  bridge;
@@ -6620,6 +6622,7 @@ var Database = class {
6620
6622
  indexStatusCallback;
6621
6623
  onPut;
6622
6624
  onDelete;
6625
+ levelBatchSize;
6623
6626
  tinaSchema;
6624
6627
  contentNamespace;
6625
6628
  collectionIndexDefinitions;
@@ -7484,8 +7487,10 @@ var Database = class {
7484
7487
  const operations = [];
7485
7488
  const enqueueOps = async (ops) => {
7486
7489
  operations.push(...ops);
7487
- while (operations.length >= 25) {
7488
- await this.contentLevel.batch(operations.splice(0, 25));
7490
+ while (operations.length >= this.levelBatchSize) {
7491
+ await this.contentLevel.batch(
7492
+ operations.splice(0, this.levelBatchSize)
7493
+ );
7489
7494
  }
7490
7495
  };
7491
7496
  const tinaSchema = await this.getSchema(this.contentLevel);
@@ -7504,7 +7509,7 @@ var Database = class {
7504
7509
  }
7505
7510
  });
7506
7511
  while (operations.length) {
7507
- await this.contentLevel.batch(operations.splice(0, 25));
7512
+ await this.contentLevel.batch(operations.splice(0, this.levelBatchSize));
7508
7513
  }
7509
7514
  };
7510
7515
  indexContentByPaths = async (documentPaths) => {
@@ -7512,8 +7517,10 @@ var Database = class {
7512
7517
  const operations = [];
7513
7518
  const enqueueOps = async (ops) => {
7514
7519
  operations.push(...ops);
7515
- while (operations.length >= 25) {
7516
- await this.contentLevel.batch(operations.splice(0, 25));
7520
+ while (operations.length >= this.levelBatchSize) {
7521
+ await this.contentLevel.batch(
7522
+ operations.splice(0, this.levelBatchSize)
7523
+ );
7517
7524
  }
7518
7525
  };
7519
7526
  const tinaSchema = await this.getSchema(this.contentLevel);
@@ -7536,7 +7543,7 @@ var Database = class {
7536
7543
  );
7537
7544
  });
7538
7545
  while (operations.length) {
7539
- await this.contentLevel.batch(operations.splice(0, 25));
7546
+ await this.contentLevel.batch(operations.splice(0, this.levelBatchSize));
7540
7547
  }
7541
7548
  };
7542
7549
  delete = async (filepath) => {
@@ -7620,8 +7627,8 @@ var Database = class {
7620
7627
  const operations = [];
7621
7628
  const enqueueOps = async (ops) => {
7622
7629
  operations.push(...ops);
7623
- while (operations.length >= 25) {
7624
- const batchOps = operations.splice(0, 25);
7630
+ while (operations.length >= this.levelBatchSize) {
7631
+ const batchOps = operations.splice(0, this.levelBatchSize);
7625
7632
  await level.batch(batchOps);
7626
7633
  }
7627
7634
  };
@@ -7661,7 +7668,7 @@ var Database = class {
7661
7668
  }
7662
7669
  );
7663
7670
  while (operations.length) {
7664
- await level.batch(operations.splice(0, 25));
7671
+ await level.batch(operations.splice(0, this.levelBatchSize));
7665
7672
  }
7666
7673
  return { warnings };
7667
7674
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tinacms/graphql",
3
3
  "type": "module",
4
- "version": "2.1.4",
4
+ "version": "2.2.0",
5
5
  "main": "dist/index.js",
6
6
  "module": "./dist/index.js",
7
7
  "files": [