@tinacms/graphql 2.1.4 → 2.2.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/database/index.d.ts +2 -0
- package/dist/index.js +19 -11
- package/package.json +5 -4
package/dist/database/index.d.ts
CHANGED
|
@@ -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
|
|
3029
|
+
version: "2.2.1",
|
|
3030
3030
|
main: "dist/index.js",
|
|
3031
3031
|
module: "./dist/index.js",
|
|
3032
3032
|
files: [
|
|
@@ -3053,7 +3053,7 @@ var package_default = {
|
|
|
3053
3053
|
types: "pnpm tsc",
|
|
3054
3054
|
build: "tinacms-scripts build",
|
|
3055
3055
|
docs: "pnpm typedoc",
|
|
3056
|
-
test: "vitest run",
|
|
3056
|
+
test: "vitest run --coverage.enabled",
|
|
3057
3057
|
"test-watch": "vitest"
|
|
3058
3058
|
},
|
|
3059
3059
|
dependencies: {
|
|
@@ -3099,6 +3099,7 @@ var package_default = {
|
|
|
3099
3099
|
"@types/node": "^22.13.1",
|
|
3100
3100
|
"@types/normalize-path": "catalog:",
|
|
3101
3101
|
"@types/ws": "catalog:",
|
|
3102
|
+
"@vitest/coverage-v8": "0.32.4",
|
|
3102
3103
|
"jest-file-snapshot": "^0.5.0",
|
|
3103
3104
|
"memory-level": "catalog:",
|
|
3104
3105
|
typescript: "^5.7.3",
|
|
@@ -6598,6 +6599,7 @@ var createDatabaseInternal = (config) => {
|
|
|
6598
6599
|
});
|
|
6599
6600
|
};
|
|
6600
6601
|
var SYSTEM_FILES = ["_schema", "_graphql", "_lookup"];
|
|
6602
|
+
var DEFAULT_LEVEL_BATCH_SIZE = 25;
|
|
6601
6603
|
var defaultStatusCallback = () => Promise.resolve();
|
|
6602
6604
|
var defaultOnPut = () => Promise.resolve();
|
|
6603
6605
|
var defaultOnDelete = () => Promise.resolve();
|
|
@@ -6610,6 +6612,7 @@ var Database = class {
|
|
|
6610
6612
|
this.indexStatusCallback = config.indexStatusCallback || defaultStatusCallback;
|
|
6611
6613
|
this.onPut = config.onPut || defaultOnPut;
|
|
6612
6614
|
this.onDelete = config.onDelete || defaultOnDelete;
|
|
6615
|
+
this.levelBatchSize = config.levelBatchSize ?? DEFAULT_LEVEL_BATCH_SIZE;
|
|
6613
6616
|
this.contentNamespace = config.namespace;
|
|
6614
6617
|
}
|
|
6615
6618
|
bridge;
|
|
@@ -6620,6 +6623,7 @@ var Database = class {
|
|
|
6620
6623
|
indexStatusCallback;
|
|
6621
6624
|
onPut;
|
|
6622
6625
|
onDelete;
|
|
6626
|
+
levelBatchSize;
|
|
6623
6627
|
tinaSchema;
|
|
6624
6628
|
contentNamespace;
|
|
6625
6629
|
collectionIndexDefinitions;
|
|
@@ -7484,8 +7488,10 @@ var Database = class {
|
|
|
7484
7488
|
const operations = [];
|
|
7485
7489
|
const enqueueOps = async (ops) => {
|
|
7486
7490
|
operations.push(...ops);
|
|
7487
|
-
while (operations.length >=
|
|
7488
|
-
await this.contentLevel.batch(
|
|
7491
|
+
while (operations.length >= this.levelBatchSize) {
|
|
7492
|
+
await this.contentLevel.batch(
|
|
7493
|
+
operations.splice(0, this.levelBatchSize)
|
|
7494
|
+
);
|
|
7489
7495
|
}
|
|
7490
7496
|
};
|
|
7491
7497
|
const tinaSchema = await this.getSchema(this.contentLevel);
|
|
@@ -7504,7 +7510,7 @@ var Database = class {
|
|
|
7504
7510
|
}
|
|
7505
7511
|
});
|
|
7506
7512
|
while (operations.length) {
|
|
7507
|
-
await this.contentLevel.batch(operations.splice(0,
|
|
7513
|
+
await this.contentLevel.batch(operations.splice(0, this.levelBatchSize));
|
|
7508
7514
|
}
|
|
7509
7515
|
};
|
|
7510
7516
|
indexContentByPaths = async (documentPaths) => {
|
|
@@ -7512,8 +7518,10 @@ var Database = class {
|
|
|
7512
7518
|
const operations = [];
|
|
7513
7519
|
const enqueueOps = async (ops) => {
|
|
7514
7520
|
operations.push(...ops);
|
|
7515
|
-
while (operations.length >=
|
|
7516
|
-
await this.contentLevel.batch(
|
|
7521
|
+
while (operations.length >= this.levelBatchSize) {
|
|
7522
|
+
await this.contentLevel.batch(
|
|
7523
|
+
operations.splice(0, this.levelBatchSize)
|
|
7524
|
+
);
|
|
7517
7525
|
}
|
|
7518
7526
|
};
|
|
7519
7527
|
const tinaSchema = await this.getSchema(this.contentLevel);
|
|
@@ -7536,7 +7544,7 @@ var Database = class {
|
|
|
7536
7544
|
);
|
|
7537
7545
|
});
|
|
7538
7546
|
while (operations.length) {
|
|
7539
|
-
await this.contentLevel.batch(operations.splice(0,
|
|
7547
|
+
await this.contentLevel.batch(operations.splice(0, this.levelBatchSize));
|
|
7540
7548
|
}
|
|
7541
7549
|
};
|
|
7542
7550
|
delete = async (filepath) => {
|
|
@@ -7620,8 +7628,8 @@ var Database = class {
|
|
|
7620
7628
|
const operations = [];
|
|
7621
7629
|
const enqueueOps = async (ops) => {
|
|
7622
7630
|
operations.push(...ops);
|
|
7623
|
-
while (operations.length >=
|
|
7624
|
-
const batchOps = operations.splice(0,
|
|
7631
|
+
while (operations.length >= this.levelBatchSize) {
|
|
7632
|
+
const batchOps = operations.splice(0, this.levelBatchSize);
|
|
7625
7633
|
await level.batch(batchOps);
|
|
7626
7634
|
}
|
|
7627
7635
|
};
|
|
@@ -7661,7 +7669,7 @@ var Database = class {
|
|
|
7661
7669
|
}
|
|
7662
7670
|
);
|
|
7663
7671
|
while (operations.length) {
|
|
7664
|
-
await level.batch(operations.splice(0,
|
|
7672
|
+
await level.batch(operations.splice(0, this.levelBatchSize));
|
|
7665
7673
|
}
|
|
7666
7674
|
return { warnings };
|
|
7667
7675
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/graphql",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.1
|
|
4
|
+
"version": "2.2.1",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
7
7
|
"files": [
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"normalize-path": "^3.0.0",
|
|
44
44
|
"readable-stream": "^4.7.0",
|
|
45
45
|
"yup": "^1.6.1",
|
|
46
|
-
"@tinacms/mdx": "2.0
|
|
46
|
+
"@tinacms/mdx": "2.1.0",
|
|
47
47
|
"@tinacms/schema-tools": "2.7.0"
|
|
48
48
|
},
|
|
49
49
|
"publishConfig": {
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
"@types/node": "^22.13.1",
|
|
66
66
|
"@types/normalize-path": "^3.0.2",
|
|
67
67
|
"@types/ws": "^7.4.7",
|
|
68
|
+
"@vitest/coverage-v8": "0.32.4",
|
|
68
69
|
"jest-file-snapshot": "^0.5.0",
|
|
69
70
|
"memory-level": "^1.0.0",
|
|
70
71
|
"typescript": "^5.7.3",
|
|
@@ -72,13 +73,13 @@
|
|
|
72
73
|
"vitest": "^0.32.4",
|
|
73
74
|
"zod": "^3.24.2",
|
|
74
75
|
"@tinacms/schema-tools": "2.7.0",
|
|
75
|
-
"@tinacms/scripts": "1.
|
|
76
|
+
"@tinacms/scripts": "1.6.0"
|
|
76
77
|
},
|
|
77
78
|
"scripts": {
|
|
78
79
|
"types": "pnpm tsc",
|
|
79
80
|
"build": "tinacms-scripts build",
|
|
80
81
|
"docs": "pnpm typedoc",
|
|
81
|
-
"test": "vitest run",
|
|
82
|
+
"test": "vitest run --coverage.enabled",
|
|
82
83
|
"test-watch": "vitest"
|
|
83
84
|
}
|
|
84
85
|
}
|