@tinacms/graphql 0.0.0-20230821165821 → 0.0.0-20230822012155
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 +29 -3
- package/dist/index.d.ts +3 -2
- package/dist/index.js +74 -61
- package/dist/index.mjs +71 -61
- package/dist/resolver/index.d.ts +3 -1
- package/package.json +7 -7
package/dist/database/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ declare type IndexStatusEvent = {
|
|
|
10
10
|
declare type IndexStatusCallback = (event: IndexStatusEvent) => Promise<void>;
|
|
11
11
|
export declare type OnPutCallback = (key: string, value: any) => Promise<void>;
|
|
12
12
|
export declare type OnDeleteCallback = (key: string) => Promise<void>;
|
|
13
|
-
export
|
|
13
|
+
export interface DatabaseArgs {
|
|
14
14
|
bridge?: Bridge;
|
|
15
15
|
level: Level;
|
|
16
16
|
onPut?: (key: string, value: any) => Promise<void>;
|
|
@@ -18,8 +18,34 @@ export declare type CreateDatabase = {
|
|
|
18
18
|
tinaDirectory?: string;
|
|
19
19
|
indexStatusCallback?: IndexStatusCallback;
|
|
20
20
|
version?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface GitProvider {
|
|
23
|
+
onPut: (key: string, value: string) => Promise<void>;
|
|
24
|
+
onDelete: (key: string) => Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
export declare type CreateDatabase = Omit<DatabaseArgs, 'level' | 'onPut' | 'onDelete'> & {
|
|
27
|
+
databaseAdapter: Level;
|
|
28
|
+
gitProvider: GitProvider;
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated Use databaseAdapter instead
|
|
31
|
+
*/
|
|
32
|
+
level?: Level;
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated Use gitProvider instead
|
|
35
|
+
*/
|
|
36
|
+
onPut?: OnPutCallback;
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated Use gitProvider instead
|
|
39
|
+
*/
|
|
40
|
+
onDelete?: OnDeleteCallback;
|
|
41
|
+
};
|
|
42
|
+
export declare type CreateLocalDatabaseArgs = Omit<DatabaseArgs, 'level'> & {
|
|
43
|
+
port?: number;
|
|
44
|
+
rootPath?: string;
|
|
21
45
|
};
|
|
46
|
+
export declare const createLocalDatabase: (config?: CreateLocalDatabaseArgs) => Database;
|
|
22
47
|
export declare const createDatabase: (config: CreateDatabase) => Database;
|
|
48
|
+
export declare const createDatabaseInternal: (config: DatabaseArgs) => Database;
|
|
23
49
|
/** Options for {@link Database.query} **/
|
|
24
50
|
export declare type QueryOptions = {
|
|
25
51
|
fileExtension?: string;
|
|
@@ -33,7 +59,7 @@ export declare type QueryOptions = {
|
|
|
33
59
|
folder?: string;
|
|
34
60
|
};
|
|
35
61
|
export declare class Database {
|
|
36
|
-
config:
|
|
62
|
+
config: DatabaseArgs;
|
|
37
63
|
bridge?: Bridge;
|
|
38
64
|
rootLevel: Level;
|
|
39
65
|
level: Level | undefined;
|
|
@@ -44,7 +70,7 @@ export declare class Database {
|
|
|
44
70
|
private tinaSchema;
|
|
45
71
|
private collectionIndexDefinitions;
|
|
46
72
|
private _lookup;
|
|
47
|
-
constructor(config:
|
|
73
|
+
constructor(config: DatabaseArgs);
|
|
48
74
|
private collectionForPath;
|
|
49
75
|
private getGeneratedFolder;
|
|
50
76
|
private updateDatabaseVersion;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,9 +3,10 @@ import { buildDotTinaFiles } from './build';
|
|
|
3
3
|
export { resolve } from './resolve';
|
|
4
4
|
export { transformDocumentIntoPayload } from './resolver';
|
|
5
5
|
export * from './resolver/error';
|
|
6
|
-
export { createDatabase } from './database';
|
|
7
6
|
export { TinaLevelClient } from './level/tinaLevel';
|
|
8
|
-
export type {
|
|
7
|
+
export type { Level } from './database/level';
|
|
8
|
+
export type { QueryOptions, OnDeleteCallback, OnPutCallback, DatabaseArgs, GitProvider, CreateDatabase, } from './database';
|
|
9
|
+
export { Database, createDatabaseInternal, createDatabase, createLocalDatabase, } from './database';
|
|
9
10
|
import type { Config } from '@tinacms/schema-tools';
|
|
10
11
|
export { getChangedFiles, getSha } from './git';
|
|
11
12
|
export { sequential, assertShape } from './util';
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
26
26
|
var src_exports = {};
|
|
27
27
|
__export(src_exports, {
|
|
28
28
|
AuditFileSystemBridge: () => AuditFileSystemBridge,
|
|
29
|
+
Database: () => Database,
|
|
29
30
|
FilesystemBridge: () => FilesystemBridge,
|
|
30
31
|
IsomorphicBridge: () => IsomorphicBridge,
|
|
31
32
|
TinaFetchError: () => TinaFetchError,
|
|
@@ -37,6 +38,8 @@ __export(src_exports, {
|
|
|
37
38
|
buildDotTinaFiles: () => buildDotTinaFiles,
|
|
38
39
|
buildSchema: () => buildSchema,
|
|
39
40
|
createDatabase: () => createDatabase,
|
|
41
|
+
createDatabaseInternal: () => createDatabaseInternal,
|
|
42
|
+
createLocalDatabase: () => createLocalDatabase,
|
|
40
43
|
createSchema: () => createSchema,
|
|
41
44
|
getChangedFiles: () => getChangedFiles,
|
|
42
45
|
getSha: () => getSha,
|
|
@@ -2585,7 +2588,7 @@ var validateField = async (field) => {
|
|
|
2585
2588
|
// package.json
|
|
2586
2589
|
var package_default = {
|
|
2587
2590
|
name: "@tinacms/graphql",
|
|
2588
|
-
version: "1.4.
|
|
2591
|
+
version: "1.4.23",
|
|
2589
2592
|
main: "dist/index.js",
|
|
2590
2593
|
module: "dist/index.mjs",
|
|
2591
2594
|
typings: "dist/index.d.ts",
|
|
@@ -5059,12 +5062,76 @@ var resolve = async ({
|
|
|
5059
5062
|
}
|
|
5060
5063
|
};
|
|
5061
5064
|
|
|
5065
|
+
// src/level/tinaLevel.ts
|
|
5066
|
+
var import_many_level = require("many-level");
|
|
5067
|
+
var import_readable_stream = require("readable-stream");
|
|
5068
|
+
var import_net = require("net");
|
|
5069
|
+
var TinaLevelClient = class extends import_many_level.ManyLevelGuest {
|
|
5070
|
+
constructor(port) {
|
|
5071
|
+
super();
|
|
5072
|
+
this._connected = false;
|
|
5073
|
+
this.port = port || 9e3;
|
|
5074
|
+
}
|
|
5075
|
+
openConnection() {
|
|
5076
|
+
if (this._connected)
|
|
5077
|
+
return;
|
|
5078
|
+
const socket = (0, import_net.connect)(this.port);
|
|
5079
|
+
(0, import_readable_stream.pipeline)(socket, this.createRpcStream(), socket, () => {
|
|
5080
|
+
this._connected = false;
|
|
5081
|
+
});
|
|
5082
|
+
this._connected = true;
|
|
5083
|
+
}
|
|
5084
|
+
};
|
|
5085
|
+
|
|
5062
5086
|
// src/database/index.ts
|
|
5063
5087
|
var import_path4 = __toESM(require("path"));
|
|
5064
5088
|
var import_graphql5 = require("graphql");
|
|
5065
5089
|
var import_micromatch2 = __toESM(require("micromatch"));
|
|
5066
5090
|
var import_js_sha12 = __toESM(require("js-sha1"));
|
|
5091
|
+
var createLocalDatabase = (config) => {
|
|
5092
|
+
const level = new TinaLevelClient(config == null ? void 0 : config.port);
|
|
5093
|
+
level.openConnection();
|
|
5094
|
+
const fsBridge = new FilesystemBridge((config == null ? void 0 : config.rootPath) || process.cwd());
|
|
5095
|
+
return new Database({
|
|
5096
|
+
bridge: fsBridge,
|
|
5097
|
+
...config || {},
|
|
5098
|
+
level
|
|
5099
|
+
});
|
|
5100
|
+
};
|
|
5067
5101
|
var createDatabase = (config) => {
|
|
5102
|
+
if (config.onPut && config.onDelete) {
|
|
5103
|
+
console.warn(
|
|
5104
|
+
"onPut and onDelete are deprecated. Please use gitProvider.onPut and gitProvider.onDelete instead."
|
|
5105
|
+
);
|
|
5106
|
+
}
|
|
5107
|
+
if (config.level) {
|
|
5108
|
+
console.warn("level is deprecated. Please use databaseAdapter instead.");
|
|
5109
|
+
}
|
|
5110
|
+
if (config.onPut && config.onDelete && config.level && !config.databaseAdapter && !config.gitProvider) {
|
|
5111
|
+
return new Database({
|
|
5112
|
+
...config,
|
|
5113
|
+
level: config.level
|
|
5114
|
+
});
|
|
5115
|
+
}
|
|
5116
|
+
if (!config.gitProvider) {
|
|
5117
|
+
throw new Error(
|
|
5118
|
+
"createDatabase requires a gitProvider. Please provide a gitProvider."
|
|
5119
|
+
);
|
|
5120
|
+
}
|
|
5121
|
+
if (!config.databaseAdapter) {
|
|
5122
|
+
throw new Error(
|
|
5123
|
+
"createDatabase requires a databaseAdapter. Please provide a databaseAdapter."
|
|
5124
|
+
);
|
|
5125
|
+
}
|
|
5126
|
+
return new Database({
|
|
5127
|
+
...config,
|
|
5128
|
+
bridge: config.bridge,
|
|
5129
|
+
level: config.databaseAdapter,
|
|
5130
|
+
onPut: config.gitProvider.onPut.bind(config.gitProvider),
|
|
5131
|
+
onDelete: config.gitProvider.onDelete.bind(config.gitProvider)
|
|
5132
|
+
});
|
|
5133
|
+
};
|
|
5134
|
+
var createDatabaseInternal = (config) => {
|
|
5068
5135
|
return new Database({
|
|
5069
5136
|
...config,
|
|
5070
5137
|
bridge: config.bridge,
|
|
@@ -5134,18 +5201,7 @@ var Database = class {
|
|
|
5134
5201
|
if (this.bridge) {
|
|
5135
5202
|
await this.bridge.put(normalizedPath, stringifiedFile);
|
|
5136
5203
|
}
|
|
5137
|
-
|
|
5138
|
-
await this.onPut(normalizedPath, stringifiedFile);
|
|
5139
|
-
} catch (e) {
|
|
5140
|
-
throw new import_graphql5.GraphQLError(
|
|
5141
|
-
`Error running onPut hook for ${filepath}: ${e}`,
|
|
5142
|
-
null,
|
|
5143
|
-
null,
|
|
5144
|
-
null,
|
|
5145
|
-
null,
|
|
5146
|
-
e
|
|
5147
|
-
);
|
|
5148
|
-
}
|
|
5204
|
+
await this.onPut(normalizedPath, stringifiedFile);
|
|
5149
5205
|
const folderTreeBuilder = new FolderTreeBuilder();
|
|
5150
5206
|
const folderKey = folderTreeBuilder.update(filepath, collection.path || "");
|
|
5151
5207
|
const putOps = [
|
|
@@ -5240,18 +5296,7 @@ var Database = class {
|
|
|
5240
5296
|
if (this.bridge) {
|
|
5241
5297
|
await this.bridge.put(normalizedPath, stringifiedFile);
|
|
5242
5298
|
}
|
|
5243
|
-
|
|
5244
|
-
await this.onPut(normalizedPath, stringifiedFile);
|
|
5245
|
-
} catch (e) {
|
|
5246
|
-
throw new import_graphql5.GraphQLError(
|
|
5247
|
-
`Error running onPut hook for ${filepath}: ${e}`,
|
|
5248
|
-
null,
|
|
5249
|
-
null,
|
|
5250
|
-
null,
|
|
5251
|
-
null,
|
|
5252
|
-
e
|
|
5253
|
-
);
|
|
5254
|
-
}
|
|
5299
|
+
await this.onPut(normalizedPath, stringifiedFile);
|
|
5255
5300
|
const folderTreeBuilder = new FolderTreeBuilder();
|
|
5256
5301
|
const folderKey = folderTreeBuilder.update(
|
|
5257
5302
|
filepath,
|
|
@@ -5314,9 +5359,6 @@ var Database = class {
|
|
|
5314
5359
|
}
|
|
5315
5360
|
return true;
|
|
5316
5361
|
} catch (error) {
|
|
5317
|
-
if (error instanceof import_graphql5.GraphQLError) {
|
|
5318
|
-
throw error;
|
|
5319
|
-
}
|
|
5320
5362
|
throw new TinaFetchError(`Error in PUT for ${filepath}`, {
|
|
5321
5363
|
originalError: error,
|
|
5322
5364
|
file: filepath,
|
|
@@ -5819,18 +5861,7 @@ var Database = class {
|
|
|
5819
5861
|
if (this.bridge) {
|
|
5820
5862
|
await this.bridge.delete((0, import_schema_tools3.normalizePath)(filepath));
|
|
5821
5863
|
}
|
|
5822
|
-
|
|
5823
|
-
await this.onDelete((0, import_schema_tools3.normalizePath)(filepath));
|
|
5824
|
-
} catch (e) {
|
|
5825
|
-
throw new import_graphql5.GraphQLError(
|
|
5826
|
-
`Error running onDelete hook for ${filepath}: ${e}`,
|
|
5827
|
-
null,
|
|
5828
|
-
null,
|
|
5829
|
-
null,
|
|
5830
|
-
null,
|
|
5831
|
-
e
|
|
5832
|
-
);
|
|
5833
|
-
}
|
|
5864
|
+
await this.onDelete((0, import_schema_tools3.normalizePath)(filepath));
|
|
5834
5865
|
};
|
|
5835
5866
|
this._indexAllContent = async (level, schema) => {
|
|
5836
5867
|
const tinaSchema = await this.getSchema(level, schema);
|
|
@@ -6085,27 +6116,6 @@ var _deleteIndexContent = async (database, documentPaths, enqueueOps, collection
|
|
|
6085
6116
|
}
|
|
6086
6117
|
};
|
|
6087
6118
|
|
|
6088
|
-
// src/level/tinaLevel.ts
|
|
6089
|
-
var import_many_level = require("many-level");
|
|
6090
|
-
var import_readable_stream = require("readable-stream");
|
|
6091
|
-
var import_net = require("net");
|
|
6092
|
-
var TinaLevelClient = class extends import_many_level.ManyLevelGuest {
|
|
6093
|
-
constructor(port) {
|
|
6094
|
-
super();
|
|
6095
|
-
this._connected = false;
|
|
6096
|
-
this.port = port || 9e3;
|
|
6097
|
-
}
|
|
6098
|
-
openConnection() {
|
|
6099
|
-
if (this._connected)
|
|
6100
|
-
return;
|
|
6101
|
-
const socket = (0, import_net.connect)(this.port);
|
|
6102
|
-
(0, import_readable_stream.pipeline)(socket, this.createRpcStream(), socket, () => {
|
|
6103
|
-
this._connected = false;
|
|
6104
|
-
});
|
|
6105
|
-
this._connected = true;
|
|
6106
|
-
}
|
|
6107
|
-
};
|
|
6108
|
-
|
|
6109
6119
|
// src/git/index.ts
|
|
6110
6120
|
var import_isomorphic_git = __toESM(require("isomorphic-git"));
|
|
6111
6121
|
var import_fs_extra = __toESM(require("fs-extra"));
|
|
@@ -6637,6 +6647,7 @@ var buildSchema = async (config, flags) => {
|
|
|
6637
6647
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6638
6648
|
0 && (module.exports = {
|
|
6639
6649
|
AuditFileSystemBridge,
|
|
6650
|
+
Database,
|
|
6640
6651
|
FilesystemBridge,
|
|
6641
6652
|
IsomorphicBridge,
|
|
6642
6653
|
TinaFetchError,
|
|
@@ -6648,6 +6659,8 @@ var buildSchema = async (config, flags) => {
|
|
|
6648
6659
|
buildDotTinaFiles,
|
|
6649
6660
|
buildSchema,
|
|
6650
6661
|
createDatabase,
|
|
6662
|
+
createDatabaseInternal,
|
|
6663
|
+
createLocalDatabase,
|
|
6651
6664
|
createSchema,
|
|
6652
6665
|
getChangedFiles,
|
|
6653
6666
|
getSha,
|
package/dist/index.mjs
CHANGED
|
@@ -2526,7 +2526,7 @@ var validateField = async (field) => {
|
|
|
2526
2526
|
// package.json
|
|
2527
2527
|
var package_default = {
|
|
2528
2528
|
name: "@tinacms/graphql",
|
|
2529
|
-
version: "1.4.
|
|
2529
|
+
version: "1.4.23",
|
|
2530
2530
|
main: "dist/index.js",
|
|
2531
2531
|
module: "dist/index.mjs",
|
|
2532
2532
|
typings: "dist/index.d.ts",
|
|
@@ -4991,12 +4991,76 @@ var resolve = async ({
|
|
|
4991
4991
|
}
|
|
4992
4992
|
};
|
|
4993
4993
|
|
|
4994
|
+
// src/level/tinaLevel.ts
|
|
4995
|
+
import { ManyLevelGuest } from "many-level";
|
|
4996
|
+
import { pipeline } from "readable-stream";
|
|
4997
|
+
import { connect } from "net";
|
|
4998
|
+
var TinaLevelClient = class extends ManyLevelGuest {
|
|
4999
|
+
constructor(port) {
|
|
5000
|
+
super();
|
|
5001
|
+
this._connected = false;
|
|
5002
|
+
this.port = port || 9e3;
|
|
5003
|
+
}
|
|
5004
|
+
openConnection() {
|
|
5005
|
+
if (this._connected)
|
|
5006
|
+
return;
|
|
5007
|
+
const socket = connect(this.port);
|
|
5008
|
+
pipeline(socket, this.createRpcStream(), socket, () => {
|
|
5009
|
+
this._connected = false;
|
|
5010
|
+
});
|
|
5011
|
+
this._connected = true;
|
|
5012
|
+
}
|
|
5013
|
+
};
|
|
5014
|
+
|
|
4994
5015
|
// src/database/index.ts
|
|
4995
5016
|
import path4 from "path";
|
|
4996
5017
|
import { GraphQLError as GraphQLError4 } from "graphql";
|
|
4997
5018
|
import micromatch2 from "micromatch";
|
|
4998
5019
|
import sha2 from "js-sha1";
|
|
5020
|
+
var createLocalDatabase = (config) => {
|
|
5021
|
+
const level = new TinaLevelClient(config?.port);
|
|
5022
|
+
level.openConnection();
|
|
5023
|
+
const fsBridge = new FilesystemBridge(config?.rootPath || process.cwd());
|
|
5024
|
+
return new Database({
|
|
5025
|
+
bridge: fsBridge,
|
|
5026
|
+
...config || {},
|
|
5027
|
+
level
|
|
5028
|
+
});
|
|
5029
|
+
};
|
|
4999
5030
|
var createDatabase = (config) => {
|
|
5031
|
+
if (config.onPut && config.onDelete) {
|
|
5032
|
+
console.warn(
|
|
5033
|
+
"onPut and onDelete are deprecated. Please use gitProvider.onPut and gitProvider.onDelete instead."
|
|
5034
|
+
);
|
|
5035
|
+
}
|
|
5036
|
+
if (config.level) {
|
|
5037
|
+
console.warn("level is deprecated. Please use databaseAdapter instead.");
|
|
5038
|
+
}
|
|
5039
|
+
if (config.onPut && config.onDelete && config.level && !config.databaseAdapter && !config.gitProvider) {
|
|
5040
|
+
return new Database({
|
|
5041
|
+
...config,
|
|
5042
|
+
level: config.level
|
|
5043
|
+
});
|
|
5044
|
+
}
|
|
5045
|
+
if (!config.gitProvider) {
|
|
5046
|
+
throw new Error(
|
|
5047
|
+
"createDatabase requires a gitProvider. Please provide a gitProvider."
|
|
5048
|
+
);
|
|
5049
|
+
}
|
|
5050
|
+
if (!config.databaseAdapter) {
|
|
5051
|
+
throw new Error(
|
|
5052
|
+
"createDatabase requires a databaseAdapter. Please provide a databaseAdapter."
|
|
5053
|
+
);
|
|
5054
|
+
}
|
|
5055
|
+
return new Database({
|
|
5056
|
+
...config,
|
|
5057
|
+
bridge: config.bridge,
|
|
5058
|
+
level: config.databaseAdapter,
|
|
5059
|
+
onPut: config.gitProvider.onPut.bind(config.gitProvider),
|
|
5060
|
+
onDelete: config.gitProvider.onDelete.bind(config.gitProvider)
|
|
5061
|
+
});
|
|
5062
|
+
};
|
|
5063
|
+
var createDatabaseInternal = (config) => {
|
|
5000
5064
|
return new Database({
|
|
5001
5065
|
...config,
|
|
5002
5066
|
bridge: config.bridge,
|
|
@@ -5066,18 +5130,7 @@ var Database = class {
|
|
|
5066
5130
|
if (this.bridge) {
|
|
5067
5131
|
await this.bridge.put(normalizedPath, stringifiedFile);
|
|
5068
5132
|
}
|
|
5069
|
-
|
|
5070
|
-
await this.onPut(normalizedPath, stringifiedFile);
|
|
5071
|
-
} catch (e) {
|
|
5072
|
-
throw new GraphQLError4(
|
|
5073
|
-
`Error running onPut hook for ${filepath}: ${e}`,
|
|
5074
|
-
null,
|
|
5075
|
-
null,
|
|
5076
|
-
null,
|
|
5077
|
-
null,
|
|
5078
|
-
e
|
|
5079
|
-
);
|
|
5080
|
-
}
|
|
5133
|
+
await this.onPut(normalizedPath, stringifiedFile);
|
|
5081
5134
|
const folderTreeBuilder = new FolderTreeBuilder();
|
|
5082
5135
|
const folderKey = folderTreeBuilder.update(filepath, collection.path || "");
|
|
5083
5136
|
const putOps = [
|
|
@@ -5171,18 +5224,7 @@ var Database = class {
|
|
|
5171
5224
|
if (this.bridge) {
|
|
5172
5225
|
await this.bridge.put(normalizedPath, stringifiedFile);
|
|
5173
5226
|
}
|
|
5174
|
-
|
|
5175
|
-
await this.onPut(normalizedPath, stringifiedFile);
|
|
5176
|
-
} catch (e) {
|
|
5177
|
-
throw new GraphQLError4(
|
|
5178
|
-
`Error running onPut hook for ${filepath}: ${e}`,
|
|
5179
|
-
null,
|
|
5180
|
-
null,
|
|
5181
|
-
null,
|
|
5182
|
-
null,
|
|
5183
|
-
e
|
|
5184
|
-
);
|
|
5185
|
-
}
|
|
5227
|
+
await this.onPut(normalizedPath, stringifiedFile);
|
|
5186
5228
|
const folderTreeBuilder = new FolderTreeBuilder();
|
|
5187
5229
|
const folderKey = folderTreeBuilder.update(
|
|
5188
5230
|
filepath,
|
|
@@ -5245,9 +5287,6 @@ var Database = class {
|
|
|
5245
5287
|
}
|
|
5246
5288
|
return true;
|
|
5247
5289
|
} catch (error) {
|
|
5248
|
-
if (error instanceof GraphQLError4) {
|
|
5249
|
-
throw error;
|
|
5250
|
-
}
|
|
5251
5290
|
throw new TinaFetchError(`Error in PUT for ${filepath}`, {
|
|
5252
5291
|
originalError: error,
|
|
5253
5292
|
file: filepath,
|
|
@@ -5749,18 +5788,7 @@ var Database = class {
|
|
|
5749
5788
|
if (this.bridge) {
|
|
5750
5789
|
await this.bridge.delete(normalizePath(filepath));
|
|
5751
5790
|
}
|
|
5752
|
-
|
|
5753
|
-
await this.onDelete(normalizePath(filepath));
|
|
5754
|
-
} catch (e) {
|
|
5755
|
-
throw new GraphQLError4(
|
|
5756
|
-
`Error running onDelete hook for ${filepath}: ${e}`,
|
|
5757
|
-
null,
|
|
5758
|
-
null,
|
|
5759
|
-
null,
|
|
5760
|
-
null,
|
|
5761
|
-
e
|
|
5762
|
-
);
|
|
5763
|
-
}
|
|
5791
|
+
await this.onDelete(normalizePath(filepath));
|
|
5764
5792
|
};
|
|
5765
5793
|
this._indexAllContent = async (level, schema) => {
|
|
5766
5794
|
const tinaSchema = await this.getSchema(level, schema);
|
|
@@ -6015,27 +6043,6 @@ var _deleteIndexContent = async (database, documentPaths, enqueueOps, collection
|
|
|
6015
6043
|
}
|
|
6016
6044
|
};
|
|
6017
6045
|
|
|
6018
|
-
// src/level/tinaLevel.ts
|
|
6019
|
-
import { ManyLevelGuest } from "many-level";
|
|
6020
|
-
import { pipeline } from "readable-stream";
|
|
6021
|
-
import { connect } from "net";
|
|
6022
|
-
var TinaLevelClient = class extends ManyLevelGuest {
|
|
6023
|
-
constructor(port) {
|
|
6024
|
-
super();
|
|
6025
|
-
this._connected = false;
|
|
6026
|
-
this.port = port || 9e3;
|
|
6027
|
-
}
|
|
6028
|
-
openConnection() {
|
|
6029
|
-
if (this._connected)
|
|
6030
|
-
return;
|
|
6031
|
-
const socket = connect(this.port);
|
|
6032
|
-
pipeline(socket, this.createRpcStream(), socket, () => {
|
|
6033
|
-
this._connected = false;
|
|
6034
|
-
});
|
|
6035
|
-
this._connected = true;
|
|
6036
|
-
}
|
|
6037
|
-
};
|
|
6038
|
-
|
|
6039
6046
|
// src/git/index.ts
|
|
6040
6047
|
import git from "isomorphic-git";
|
|
6041
6048
|
import fs from "fs-extra";
|
|
@@ -6566,6 +6573,7 @@ var buildSchema = async (config, flags) => {
|
|
|
6566
6573
|
};
|
|
6567
6574
|
export {
|
|
6568
6575
|
AuditFileSystemBridge,
|
|
6576
|
+
Database,
|
|
6569
6577
|
FilesystemBridge,
|
|
6570
6578
|
IsomorphicBridge,
|
|
6571
6579
|
TinaFetchError,
|
|
@@ -6577,6 +6585,8 @@ export {
|
|
|
6577
6585
|
buildDotTinaFiles,
|
|
6578
6586
|
buildSchema,
|
|
6579
6587
|
createDatabase,
|
|
6588
|
+
createDatabaseInternal,
|
|
6589
|
+
createLocalDatabase,
|
|
6580
6590
|
createSchema,
|
|
6581
6591
|
getChangedFiles,
|
|
6582
6592
|
getSha,
|
package/dist/resolver/index.d.ts
CHANGED
|
@@ -52,7 +52,9 @@ export declare class Resolver {
|
|
|
52
52
|
constructor(init: ResolverConfig);
|
|
53
53
|
resolveCollection: (args: any, collectionName: string, hasDocuments?: boolean) => Promise<{
|
|
54
54
|
fields: TinaField<true>[];
|
|
55
|
-
templates?: undefined;
|
|
55
|
+
templates?: undefined; /**
|
|
56
|
+
* updateDocument, update<Collection>Document
|
|
57
|
+
*/
|
|
56
58
|
label?: string;
|
|
57
59
|
name: string;
|
|
58
60
|
path: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/graphql",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-20230822012155",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -24,8 +24,6 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@iarna/toml": "^2.2.5",
|
|
27
|
-
"@tinacms/mdx": "0.0.0-20230821165821",
|
|
28
|
-
"@tinacms/schema-tools": "0.0.0-20230821165821",
|
|
29
27
|
"abstract-level": "^1.0.3",
|
|
30
28
|
"body-parser": "^1.19.0",
|
|
31
29
|
"cors": "^2.8.5",
|
|
@@ -47,7 +45,9 @@
|
|
|
47
45
|
"micromatch": "4.0.5",
|
|
48
46
|
"normalize-path": "^3.0.0",
|
|
49
47
|
"readable-stream": "^4.3.0",
|
|
50
|
-
"yup": "^0.32.9"
|
|
48
|
+
"yup": "^0.32.9",
|
|
49
|
+
"@tinacms/mdx": "1.3.16",
|
|
50
|
+
"@tinacms/schema-tools": "1.4.10"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"registry": "https://registry.npmjs.org"
|
|
@@ -57,8 +57,6 @@
|
|
|
57
57
|
"directory": "packages/tina-graphql"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@tinacms/schema-tools": "0.0.0-20230821165821",
|
|
61
|
-
"@tinacms/scripts": "1.1.2",
|
|
62
60
|
"@types/cors": "^2.8.7",
|
|
63
61
|
"@types/estree": "^0.0.50",
|
|
64
62
|
"@types/express": "^4.17.8",
|
|
@@ -81,7 +79,9 @@
|
|
|
81
79
|
"jest-matcher-utils": "^29.5.0",
|
|
82
80
|
"memory-level": "^1.0.0",
|
|
83
81
|
"nodemon": "2.0.19",
|
|
84
|
-
"typescript": "4.3.5"
|
|
82
|
+
"typescript": "4.3.5",
|
|
83
|
+
"@tinacms/schema-tools": "1.4.10",
|
|
84
|
+
"@tinacms/scripts": "1.1.2"
|
|
85
85
|
},
|
|
86
86
|
"scripts": {
|
|
87
87
|
"types": "pnpm tsc",
|