@pothos/plugin-drizzle 0.17.4 → 0.17.5
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/CHANGELOG.md +8 -0
- package/dts/connection-helpers.d.ts +3 -3
- package/dts/connection-helpers.d.ts.map +1 -1
- package/dts/drizzle-field-builder.d.ts +2 -2
- package/dts/drizzle-field-builder.d.ts.map +1 -1
- package/dts/global-types.d.ts +6 -6
- package/dts/global-types.d.ts.map +1 -1
- package/dts/index.d.ts +8 -8
- package/dts/index.d.ts.map +1 -1
- package/dts/interface-ref.d.ts +2 -2
- package/dts/interface-ref.d.ts.map +1 -1
- package/dts/model-loader.d.ts +2 -2
- package/dts/model-loader.d.ts.map +1 -1
- package/dts/node-ref.d.ts +1 -1
- package/dts/node-ref.d.ts.map +1 -1
- package/dts/object-ref.d.ts +1 -1
- package/dts/object-ref.d.ts.map +1 -1
- package/dts/types.d.ts +5 -5
- package/dts/types.d.ts.map +1 -1
- package/dts/utils/cursors.d.ts +4 -4
- package/dts/utils/cursors.d.ts.map +1 -1
- package/dts/utils/map-query.d.ts +3 -3
- package/dts/utils/map-query.d.ts.map +1 -1
- package/dts/utils/refs.d.ts +1 -1
- package/dts/utils/refs.d.ts.map +1 -1
- package/dts/utils/selections.d.ts +2 -2
- package/dts/utils/selections.d.ts.map +1 -1
- package/esm/connection-helpers.d.ts +14 -16
- package/esm/connection-helpers.d.ts.map +1 -1
- package/esm/connection-helpers.js +25 -24
- package/esm/connection-helpers.js.map +1 -1
- package/esm/drizzle-field-builder.d.ts +60 -172
- package/esm/drizzle-field-builder.d.ts.map +1 -1
- package/esm/drizzle-field-builder.js +48 -48
- package/esm/drizzle-field-builder.js.map +1 -1
- package/esm/field-builder.d.ts +1 -1
- package/esm/field-builder.js +29 -28
- package/esm/field-builder.js.map +1 -1
- package/esm/global-types.d.ts +32 -60
- package/esm/global-types.d.ts.map +1 -1
- package/esm/global-types.js +3 -2
- package/esm/global-types.js.map +1 -1
- package/esm/index.d.ts +2 -2
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +15 -14
- package/esm/index.js.map +1 -1
- package/esm/interface-ref.d.ts +4 -4
- package/esm/interface-ref.d.ts.map +1 -1
- package/esm/interface-ref.js +4 -4
- package/esm/interface-ref.js.map +1 -1
- package/esm/model-loader.d.ts +2 -3
- package/esm/model-loader.d.ts.map +1 -1
- package/esm/model-loader.js +24 -25
- package/esm/model-loader.js.map +1 -1
- package/esm/node-ref.d.ts +2 -2
- package/esm/node-ref.d.ts.map +1 -1
- package/esm/node-ref.js +5 -5
- package/esm/node-ref.js.map +1 -1
- package/esm/object-ref.d.ts +3 -3
- package/esm/object-ref.d.ts.map +1 -1
- package/esm/object-ref.js +7 -7
- package/esm/schema-builder.d.ts +1 -1
- package/esm/schema-builder.js +133 -132
- package/esm/schema-builder.js.map +1 -1
- package/esm/types.d.ts +69 -83
- package/esm/types.d.ts.map +1 -1
- package/esm/types.js +3 -2
- package/esm/types.js.map +1 -1
- package/esm/utils/config.d.ts +2 -4
- package/esm/utils/config.js +14 -14
- package/esm/utils/cursors.d.ts +3 -3
- package/esm/utils/cursors.d.ts.map +1 -1
- package/esm/utils/cursors.js +85 -90
- package/esm/utils/cursors.js.map +1 -1
- package/esm/utils/deep-equal.d.ts +1 -1
- package/esm/utils/deep-equal.js +6 -5
- package/esm/utils/drizzle-graphql.d.ts +1 -1
- package/esm/utils/drizzle-graphql.js +232 -231
- package/esm/utils/loader-map.d.ts +3 -3
- package/esm/utils/loader-map.js +8 -7
- package/esm/utils/map-query.d.ts +2 -2
- package/esm/utils/map-query.d.ts.map +1 -1
- package/esm/utils/map-query.js +39 -43
- package/esm/utils/map-query.js.map +1 -1
- package/esm/utils/refs.d.ts +2 -2
- package/esm/utils/refs.d.ts.map +1 -1
- package/esm/utils/refs.js +5 -4
- package/esm/utils/refs.js.map +1 -1
- package/esm/utils/selections.d.ts +3 -3
- package/esm/utils/selections.d.ts.map +1 -1
- package/esm/utils/selections.js +20 -22
- package/esm/utils/selections.js.map +1 -1
- package/esm/utils/usage.d.ts +1 -1
- package/esm/utils/usage.js +9 -8
- package/lib/connection-helpers.js +5 -5
- package/lib/drizzle-field-builder.js +3 -3
- package/lib/field-builder.js +4 -4
- package/lib/index.js +8 -8
- package/lib/interface-ref.js +1 -1
- package/lib/model-loader.js +4 -4
- package/lib/node-ref.js +1 -1
- package/lib/schema-builder.js +8 -8
- package/lib/types.js +1 -1
- package/lib/utils/cursors.js +1 -1
- package/lib/utils/map-query.js +3 -3
- package/lib/utils/refs.js +2 -2
- package/lib/utils/selections.js +1 -1
- package/package.json +12 -13
- package/src/connection-helpers.ts +7 -7
- package/src/drizzle-field-builder.ts +6 -6
- package/src/field-builder.ts +7 -7
- package/src/global-types.ts +6 -6
- package/src/index.ts +11 -11
- package/src/interface-ref.ts +2 -2
- package/src/model-loader.ts +4 -4
- package/src/node-ref.ts +1 -1
- package/src/object-ref.ts +1 -1
- package/src/schema-builder.ts +9 -9
- package/src/types.ts +5 -5
- package/src/utils/config.ts +1 -1
- package/src/utils/cursors.ts +4 -4
- package/src/utils/map-query.ts +5 -5
- package/src/utils/refs.ts +2 -2
- package/src/utils/selections.ts +3 -3
package/lib/field-builder.js
CHANGED
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
const _core = require("@pothos/core");
|
|
6
6
|
const _graphql = require("graphql");
|
|
7
|
-
const _config = require("./utils/config");
|
|
8
|
-
const _cursors = require("./utils/cursors");
|
|
9
|
-
const _mapquery = require("./utils/map-query");
|
|
10
|
-
const _refs = require("./utils/refs");
|
|
7
|
+
const _config = require("./utils/config.js");
|
|
8
|
+
const _cursors = require("./utils/cursors.js");
|
|
9
|
+
const _mapquery = require("./utils/map-query.js");
|
|
10
|
+
const _refs = require("./utils/refs.js");
|
|
11
11
|
var _this_builder_options_drizzle, _this_builder_options_drizzle1;
|
|
12
12
|
const fieldBuilderProto = _core.RootFieldBuilder.prototype;
|
|
13
13
|
fieldBuilderProto.drizzleField = function drizzleField({ type, resolve, ...options }) {
|
package/lib/index.js
CHANGED
|
@@ -28,15 +28,15 @@ _export(exports, {
|
|
|
28
28
|
return _types.drizzleTableName;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
-
require("./global-types");
|
|
32
|
-
require("./field-builder");
|
|
33
|
-
require("./schema-builder");
|
|
31
|
+
require("./global-types.js");
|
|
32
|
+
require("./field-builder.js");
|
|
33
|
+
require("./schema-builder.js");
|
|
34
34
|
const _core = /*#__PURE__*/ _interop_require_wildcard(require("@pothos/core"));
|
|
35
|
-
const _loadermap = require("./utils/loader-map");
|
|
36
|
-
const _connectionhelpers = require("./connection-helpers");
|
|
37
|
-
const _drizzlefieldbuilder = require("./drizzle-field-builder");
|
|
38
|
-
const _types = _export_star(require("./types"), exports);
|
|
39
|
-
const _config = require("./utils/config");
|
|
35
|
+
const _loadermap = require("./utils/loader-map.js");
|
|
36
|
+
const _connectionhelpers = require("./connection-helpers.js");
|
|
37
|
+
const _drizzlefieldbuilder = require("./drizzle-field-builder.js");
|
|
38
|
+
const _types = _export_star(require("./types.js"), exports);
|
|
39
|
+
const _config = require("./utils/config.js");
|
|
40
40
|
function _export_star(from, to) {
|
|
41
41
|
Object.keys(from).forEach(function(k) {
|
|
42
42
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
package/lib/interface-ref.js
CHANGED
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "DrizzleInterfaceRef", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _core = require("@pothos/core");
|
|
12
|
-
const _objectref = require("./object-ref");
|
|
12
|
+
const _objectref = require("./object-ref.js");
|
|
13
13
|
function _define_property(obj, key, value) {
|
|
14
14
|
if (key in obj) {
|
|
15
15
|
Object.defineProperty(obj, key, {
|
package/lib/model-loader.js
CHANGED
|
@@ -10,10 +10,10 @@ Object.defineProperty(exports, "ModelLoader", {
|
|
|
10
10
|
});
|
|
11
11
|
const _core = require("@pothos/core");
|
|
12
12
|
const _drizzleorm = require("drizzle-orm");
|
|
13
|
-
const _config = require("./utils/config");
|
|
14
|
-
const _loadermap = require("./utils/loader-map");
|
|
15
|
-
const _mapquery = require("./utils/map-query");
|
|
16
|
-
const _selections = require("./utils/selections");
|
|
13
|
+
const _config = require("./utils/config.js");
|
|
14
|
+
const _loadermap = require("./utils/loader-map.js");
|
|
15
|
+
const _mapquery = require("./utils/map-query.js");
|
|
16
|
+
const _selections = require("./utils/selections.js");
|
|
17
17
|
function _define_property(obj, key, value) {
|
|
18
18
|
if (key in obj) {
|
|
19
19
|
Object.defineProperty(obj, key, {
|
package/lib/node-ref.js
CHANGED
|
@@ -16,7 +16,7 @@ _export(exports, {
|
|
|
16
16
|
return relayIDShapeKey;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
const _objectref = require("./object-ref");
|
|
19
|
+
const _objectref = require("./object-ref.js");
|
|
20
20
|
function _define_property(obj, key, value) {
|
|
21
21
|
if (key in obj) {
|
|
22
22
|
Object.defineProperty(obj, key, {
|
package/lib/schema-builder.js
CHANGED
|
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
const _core = /*#__PURE__*/ _interop_require_wildcard(require("@pothos/core"));
|
|
6
|
-
const _drizzlefieldbuilder = require("./drizzle-field-builder");
|
|
7
|
-
const _interfaceref = require("./interface-ref");
|
|
8
|
-
const _modelloader = require("./model-loader");
|
|
9
|
-
const _noderef = require("./node-ref");
|
|
10
|
-
const _objectref = require("./object-ref");
|
|
11
|
-
const _config = require("./utils/config");
|
|
12
|
-
const _cursors = require("./utils/cursors");
|
|
13
|
-
const _refs = require("./utils/refs");
|
|
6
|
+
const _drizzlefieldbuilder = require("./drizzle-field-builder.js");
|
|
7
|
+
const _interfaceref = require("./interface-ref.js");
|
|
8
|
+
const _modelloader = require("./model-loader.js");
|
|
9
|
+
const _noderef = require("./node-ref.js");
|
|
10
|
+
const _objectref = require("./object-ref.js");
|
|
11
|
+
const _config = require("./utils/config.js");
|
|
12
|
+
const _cursors = require("./utils/cursors.js");
|
|
13
|
+
const _refs = require("./utils/refs.js");
|
|
14
14
|
function _getRequireWildcardCache(nodeInterop) {
|
|
15
15
|
if (typeof WeakMap !== "function") return null;
|
|
16
16
|
var cacheBabelInterop = new WeakMap();
|
package/lib/types.js
CHANGED
|
@@ -16,7 +16,7 @@ _export(exports, {
|
|
|
16
16
|
return drizzleTableName;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
const _objectref = require("./object-ref");
|
|
19
|
+
const _objectref = require("./object-ref.js");
|
|
20
20
|
const drizzleTableName = Symbol.for('Pothos.drizzleTableName');
|
|
21
21
|
|
|
22
22
|
//# sourceMappingURL=types.js.map
|
package/lib/utils/cursors.js
CHANGED
|
@@ -57,7 +57,7 @@ _export(exports, {
|
|
|
57
57
|
});
|
|
58
58
|
const _core = require("@pothos/core");
|
|
59
59
|
const _drizzleorm = require("drizzle-orm");
|
|
60
|
-
const _mapquery = require("./map-query");
|
|
60
|
+
const _mapquery = require("./map-query.js");
|
|
61
61
|
const DEFAULT_MAX_SIZE = 100;
|
|
62
62
|
const DEFAULT_SIZE = 20;
|
|
63
63
|
function formatCursorChunk(value) {
|
package/lib/utils/map-query.js
CHANGED
|
@@ -27,9 +27,9 @@ _export(exports, {
|
|
|
27
27
|
});
|
|
28
28
|
const _core = require("@pothos/core");
|
|
29
29
|
const _graphql = require("graphql");
|
|
30
|
-
const _loadermap = require("./loader-map");
|
|
31
|
-
const _selections = require("./selections");
|
|
32
|
-
const _usage = require("./usage");
|
|
30
|
+
const _loadermap = require("./loader-map.js");
|
|
31
|
+
const _selections = require("./selections.js");
|
|
32
|
+
const _usage = require("./usage.js");
|
|
33
33
|
function addTypeSelectionsForField(config, type, context, info, state, selection, indirectPath, deferred, segments = []) {
|
|
34
34
|
var _type_extensions;
|
|
35
35
|
if (selection.name.value.startsWith('__')) {
|
package/lib/utils/refs.js
CHANGED
|
@@ -17,8 +17,8 @@ _export(exports, {
|
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
const _core = require("@pothos/core");
|
|
20
|
-
const _interfaceref = require("../interface-ref");
|
|
21
|
-
const _objectref = require("../object-ref");
|
|
20
|
+
const _interfaceref = require("../interface-ref.js");
|
|
21
|
+
const _objectref = require("../object-ref.js");
|
|
22
22
|
const refMap = new WeakMap();
|
|
23
23
|
function getRefFromModel(name, builder, type = 'object') {
|
|
24
24
|
if (!refMap.has(builder)) {
|
package/lib/utils/selections.js
CHANGED
|
@@ -29,7 +29,7 @@ _export(exports, {
|
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
const _core = require("@pothos/core");
|
|
32
|
-
const _deepequal = require("./deep-equal");
|
|
32
|
+
const _deepequal = require("./deep-equal.js");
|
|
33
33
|
function selectionCompatible(state, selectionMap, ignoreQuery = false) {
|
|
34
34
|
if (typeof selectionMap === 'boolean') {
|
|
35
35
|
return ignoreQuery || !selectionMap || Object.keys(state.query).length === 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pothos/plugin-drizzle",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.5",
|
|
4
4
|
"description": "A Pothos plugin for drizzle",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./dts/index.d.ts",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@pothos/core": "*",
|
|
38
38
|
"drizzle-orm": ">=1.0.0-beta.2",
|
|
39
|
-
"graphql": "^16.10.0"
|
|
39
|
+
"graphql": "^16.10.0 || ^17.0.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@libsql/client": "^0.17.2",
|
|
@@ -46,22 +46,21 @@
|
|
|
46
46
|
"graphql-scalars": "^1.25.0",
|
|
47
47
|
"graphql-tag": "^2.12.6",
|
|
48
48
|
"postgres": "^3.4.9",
|
|
49
|
-
"@pothos/core": "4.
|
|
50
|
-
"@pothos/plugin-add-graphql": "4.3.
|
|
51
|
-
"@pothos/plugin-errors": "4.9.
|
|
52
|
-
"@pothos/plugin-relay": "4.7.
|
|
53
|
-
"@pothos/plugin-scope-auth": "4.1.
|
|
54
|
-
"@pothos/plugin-with-input": "4.1.
|
|
55
|
-
"@pothos/test-utils": "2.1
|
|
49
|
+
"@pothos/core": "4.13.1",
|
|
50
|
+
"@pothos/plugin-add-graphql": "4.3.1",
|
|
51
|
+
"@pothos/plugin-errors": "4.9.1",
|
|
52
|
+
"@pothos/plugin-relay": "4.7.1",
|
|
53
|
+
"@pothos/plugin-scope-auth": "4.1.7",
|
|
54
|
+
"@pothos/plugin-with-input": "4.1.5",
|
|
55
|
+
"@pothos/test-utils": "2.2.1"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
|
-
"type": "
|
|
58
|
+
"type": "tsc --project tsconfig.type.json",
|
|
59
59
|
"build": "pnpm build:clean && pnpm build:cjs && pnpm build:dts && pnpm build:esm",
|
|
60
60
|
"build:clean": "git clean -dfX esm lib",
|
|
61
61
|
"build:cjs": "swc src -d lib --config-file ../../.swcrc -C module.type=commonjs --strip-leading-paths",
|
|
62
|
-
"build:esm": "cp -r dts/* esm/ && swc src -d esm --config-file ../../.swcrc -C module.type=es6 --strip-leading-paths
|
|
63
|
-
"build:dts": "
|
|
64
|
-
"esm:extensions": "TS_NODE_PROJECT=../../tsconfig.json node -r @swc-node/register ../../scripts/esm-transformer.ts",
|
|
62
|
+
"build:esm": "cp -r dts/* esm/ && swc src -d esm --config-file ../../.swcrc -C module.type=es6 --strip-leading-paths",
|
|
63
|
+
"build:dts": "tsc",
|
|
65
64
|
"test": "pnpm vitest --run"
|
|
66
65
|
}
|
|
67
66
|
}
|
|
@@ -6,17 +6,17 @@ import type {
|
|
|
6
6
|
TableRelationalConfig,
|
|
7
7
|
} from 'drizzle-orm';
|
|
8
8
|
import type { GraphQLResolveInfo } from 'graphql';
|
|
9
|
-
import type { DrizzleRef } from './interface-ref';
|
|
10
|
-
import type { QueryForDrizzleConnection } from './types';
|
|
11
|
-
import { getSchemaConfig } from './utils/config';
|
|
9
|
+
import type { DrizzleRef } from './interface-ref.js';
|
|
10
|
+
import type { QueryForDrizzleConnection } from './types.js';
|
|
11
|
+
import { getSchemaConfig } from './utils/config.js';
|
|
12
12
|
import {
|
|
13
13
|
drizzleCursorConnectionQuery,
|
|
14
14
|
getCursorFormatter,
|
|
15
15
|
wrapConnectionResult,
|
|
16
|
-
} from './utils/cursors';
|
|
17
|
-
import { queryFromInfo } from './utils/map-query';
|
|
18
|
-
import { getRefFromModel } from './utils/refs';
|
|
19
|
-
import { createState, mergeSelection, selectionToQuery } from './utils/selections';
|
|
16
|
+
} from './utils/cursors.js';
|
|
17
|
+
import { queryFromInfo } from './utils/map-query.js';
|
|
18
|
+
import { getRefFromModel } from './utils/refs.js';
|
|
19
|
+
import { createState, mergeSelection, selectionToQuery } from './utils/selections.js';
|
|
20
20
|
|
|
21
21
|
export function drizzleConnectionHelpers<
|
|
22
22
|
Types extends SchemaTypes,
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
isInterfaceType,
|
|
38
38
|
isObjectType,
|
|
39
39
|
} from 'graphql';
|
|
40
|
-
import type { DrizzleRef } from './interface-ref';
|
|
40
|
+
import type { DrizzleRef } from './interface-ref.js';
|
|
41
41
|
import type {
|
|
42
42
|
DrizzleConnectionShape,
|
|
43
43
|
ListRelation,
|
|
@@ -48,15 +48,15 @@ import type {
|
|
|
48
48
|
ShapeFromConnection,
|
|
49
49
|
TypesForRelation,
|
|
50
50
|
VariantFieldOptions,
|
|
51
|
-
} from './types';
|
|
52
|
-
import { getClient, getSchemaConfig } from './utils/config';
|
|
51
|
+
} from './types.js';
|
|
52
|
+
import { getClient, getSchemaConfig } from './utils/config.js';
|
|
53
53
|
import {
|
|
54
54
|
drizzleCursorConnectionQuery,
|
|
55
55
|
getCursorFormatter,
|
|
56
56
|
wrapConnectionResult,
|
|
57
|
-
} from './utils/cursors';
|
|
58
|
-
import { getRefFromModel } from './utils/refs';
|
|
59
|
-
import type { SelectionMap } from './utils/selections';
|
|
57
|
+
} from './utils/cursors.js';
|
|
58
|
+
import { getRefFromModel } from './utils/refs.js';
|
|
59
|
+
import type { SelectionMap } from './utils/selections.js';
|
|
60
60
|
|
|
61
61
|
// Workaround for FieldKind not being extended on Builder classes
|
|
62
62
|
const RootBuilder: {
|
package/src/field-builder.ts
CHANGED
|
@@ -3,13 +3,13 @@ import { type FieldKind, ObjectRef, RootFieldBuilder, type SchemaTypes } from '@
|
|
|
3
3
|
import type { TableRelationalConfig } from 'drizzle-orm';
|
|
4
4
|
import type { GraphQLResolveInfo } from 'graphql';
|
|
5
5
|
import { isInterfaceType, isObjectType, Kind } from 'graphql';
|
|
6
|
-
import type { DrizzleRef } from './interface-ref';
|
|
7
|
-
import type { DrizzleConnectionFieldOptions } from './types';
|
|
8
|
-
import { getSchemaConfig } from './utils/config';
|
|
9
|
-
import { resolveDrizzleCursorConnection } from './utils/cursors';
|
|
10
|
-
import { queryFromInfo } from './utils/map-query';
|
|
11
|
-
import { getRefFromModel } from './utils/refs';
|
|
12
|
-
import type { SelectionMap } from './utils/selections';
|
|
6
|
+
import type { DrizzleRef } from './interface-ref.js';
|
|
7
|
+
import type { DrizzleConnectionFieldOptions } from './types.js';
|
|
8
|
+
import { getSchemaConfig } from './utils/config.js';
|
|
9
|
+
import { resolveDrizzleCursorConnection } from './utils/cursors.js';
|
|
10
|
+
import { queryFromInfo } from './utils/map-query.js';
|
|
11
|
+
import { getRefFromModel } from './utils/refs.js';
|
|
12
|
+
import type { SelectionMap } from './utils/selections.js';
|
|
13
13
|
|
|
14
14
|
const fieldBuilderProto = RootFieldBuilder.prototype as PothosSchemaTypes.RootFieldBuilder<
|
|
15
15
|
SchemaTypes,
|
package/src/global-types.ts
CHANGED
|
@@ -17,11 +17,11 @@ import type {
|
|
|
17
17
|
TableRelationalConfig,
|
|
18
18
|
TablesRelationalConfig,
|
|
19
19
|
} from 'drizzle-orm';
|
|
20
|
-
import type {
|
|
21
|
-
import type {
|
|
22
|
-
import type { DrizzleInterfaceRef, DrizzleRef } from './interface-ref';
|
|
23
|
-
import type { DrizzleNodeRef } from './node-ref';
|
|
24
|
-
import type { DrizzleObjectRef, drizzleTableKey } from './object-ref';
|
|
20
|
+
import type { DrizzleObjectFieldBuilder } from './drizzle-field-builder.js';
|
|
21
|
+
import type { PothosDrizzlePlugin } from './index.js';
|
|
22
|
+
import type { DrizzleInterfaceRef, DrizzleRef } from './interface-ref.js';
|
|
23
|
+
import type { DrizzleNodeRef } from './node-ref.js';
|
|
24
|
+
import type { DrizzleObjectRef, drizzleTableKey } from './object-ref.js';
|
|
25
25
|
import type {
|
|
26
26
|
DrizzleConnectionFieldOptions,
|
|
27
27
|
DrizzleConnectionShape,
|
|
@@ -35,7 +35,7 @@ import type {
|
|
|
35
35
|
drizzleTableName,
|
|
36
36
|
ShapeFromConnection,
|
|
37
37
|
ShapeFromIdColumns,
|
|
38
|
-
} from './types';
|
|
38
|
+
} from './types.js';
|
|
39
39
|
|
|
40
40
|
declare global {
|
|
41
41
|
export namespace PothosSchemaTypes {
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import './global-types';
|
|
2
|
-
import './field-builder';
|
|
3
|
-
import './schema-builder';
|
|
1
|
+
import './global-types.js';
|
|
2
|
+
import './field-builder.js';
|
|
3
|
+
import './schema-builder.js';
|
|
4
4
|
import SchemaBuilder, {
|
|
5
5
|
BasePlugin,
|
|
6
6
|
type PothosOutputFieldConfig,
|
|
@@ -9,14 +9,14 @@ import SchemaBuilder, {
|
|
|
9
9
|
type SchemaTypes,
|
|
10
10
|
} from '@pothos/core';
|
|
11
11
|
import type { GraphQLFieldResolver } from 'graphql';
|
|
12
|
-
import type { ModelLoader } from './model-loader';
|
|
13
|
-
import { getLoaderMapping, setLoaderMappings } from './utils/loader-map';
|
|
14
|
-
|
|
15
|
-
export { drizzleConnectionHelpers } from './connection-helpers';
|
|
16
|
-
export { DrizzleObjectFieldBuilder } from './drizzle-field-builder';
|
|
17
|
-
export * from './types';
|
|
18
|
-
export { drizzleTableName } from './types';
|
|
19
|
-
export { drizzleClientCache } from './utils/config';
|
|
12
|
+
import type { ModelLoader } from './model-loader.js';
|
|
13
|
+
import { getLoaderMapping, setLoaderMappings } from './utils/loader-map.js';
|
|
14
|
+
|
|
15
|
+
export { drizzleConnectionHelpers } from './connection-helpers.js';
|
|
16
|
+
export { DrizzleObjectFieldBuilder } from './drizzle-field-builder.js';
|
|
17
|
+
export * from './types.js';
|
|
18
|
+
export { drizzleTableName } from './types.js';
|
|
19
|
+
export { drizzleClientCache } from './utils/config.js';
|
|
20
20
|
|
|
21
21
|
const pluginName = 'drizzle';
|
|
22
22
|
|
package/src/interface-ref.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InterfaceRef, type SchemaTypes } from '@pothos/core';
|
|
2
|
-
import type { DrizzleNodeRef } from './node-ref';
|
|
3
|
-
import { type DrizzleObjectRef, drizzleTableKey } from './object-ref';
|
|
2
|
+
import type { DrizzleNodeRef } from './node-ref.js';
|
|
3
|
+
import { type DrizzleObjectRef, drizzleTableKey } from './object-ref.js';
|
|
4
4
|
|
|
5
5
|
export type DrizzleRef<
|
|
6
6
|
Types extends SchemaTypes,
|
package/src/model-loader.ts
CHANGED
|
@@ -9,16 +9,16 @@ import {
|
|
|
9
9
|
type TableRelationalConfig,
|
|
10
10
|
} from 'drizzle-orm';
|
|
11
11
|
import type { GraphQLResolveInfo } from 'graphql';
|
|
12
|
-
import { getClient, getSchemaConfig, type PothosDrizzleSchemaConfig } from './utils/config';
|
|
13
|
-
import { cacheKey, setLoaderMappings } from './utils/loader-map';
|
|
14
|
-
import { selectionStateFromInfo, stateFromInfo } from './utils/map-query';
|
|
12
|
+
import { getClient, getSchemaConfig, type PothosDrizzleSchemaConfig } from './utils/config.js';
|
|
13
|
+
import { cacheKey, setLoaderMappings } from './utils/loader-map.js';
|
|
14
|
+
import { selectionStateFromInfo, stateFromInfo } from './utils/map-query.js';
|
|
15
15
|
import {
|
|
16
16
|
mergeSelection,
|
|
17
17
|
type SelectionMap,
|
|
18
18
|
type SelectionState,
|
|
19
19
|
selectionCompatible,
|
|
20
20
|
selectionToQuery,
|
|
21
|
-
} from './utils/selections';
|
|
21
|
+
} from './utils/selections.js';
|
|
22
22
|
|
|
23
23
|
interface ResolvablePromise<T> {
|
|
24
24
|
promise: Promise<T>;
|
package/src/node-ref.ts
CHANGED
package/src/object-ref.ts
CHANGED
package/src/schema-builder.ts
CHANGED
|
@@ -10,15 +10,15 @@ import SchemaBuilder, {
|
|
|
10
10
|
} from '@pothos/core';
|
|
11
11
|
import type { Column } from 'drizzle-orm';
|
|
12
12
|
import type { GraphQLResolveInfo } from 'graphql';
|
|
13
|
-
import { DrizzleObjectFieldBuilder } from './drizzle-field-builder';
|
|
14
|
-
import { DrizzleInterfaceRef } from './interface-ref';
|
|
15
|
-
import { ModelLoader } from './model-loader';
|
|
16
|
-
import { DrizzleNodeRef } from './node-ref';
|
|
17
|
-
import { DrizzleObjectRef } from './object-ref';
|
|
18
|
-
import type { DrizzleNodeOptions } from './types';
|
|
19
|
-
import { getSchemaConfig } from './utils/config';
|
|
20
|
-
import { getIDParser, getIDSerializer } from './utils/cursors';
|
|
21
|
-
import { getRefFromModel } from './utils/refs';
|
|
13
|
+
import { DrizzleObjectFieldBuilder } from './drizzle-field-builder.js';
|
|
14
|
+
import { DrizzleInterfaceRef } from './interface-ref.js';
|
|
15
|
+
import { ModelLoader } from './model-loader.js';
|
|
16
|
+
import { DrizzleNodeRef } from './node-ref.js';
|
|
17
|
+
import { DrizzleObjectRef } from './object-ref.js';
|
|
18
|
+
import type { DrizzleNodeOptions } from './types.js';
|
|
19
|
+
import { getSchemaConfig } from './utils/config.js';
|
|
20
|
+
import { getIDParser, getIDSerializer } from './utils/cursors.js';
|
|
21
|
+
import { getRefFromModel } from './utils/refs.js';
|
|
22
22
|
|
|
23
23
|
const schemaBuilderProto = SchemaBuilder.prototype as PothosSchemaTypes.SchemaBuilder<SchemaTypes>;
|
|
24
24
|
|
package/src/types.ts
CHANGED
|
@@ -39,10 +39,10 @@ import type {
|
|
|
39
39
|
TableRelationalConfig,
|
|
40
40
|
} from 'drizzle-orm';
|
|
41
41
|
import type { FieldNode, GraphQLResolveInfo } from 'graphql';
|
|
42
|
-
import type { DrizzleObjectFieldBuilder } from './drizzle-field-builder';
|
|
43
|
-
import type { DrizzleRef } from './interface-ref';
|
|
44
|
-
import type { IndirectInclude } from './utils/map-query';
|
|
45
|
-
import type { SelectionMap } from './utils/selections';
|
|
42
|
+
import type { DrizzleObjectFieldBuilder } from './drizzle-field-builder.js';
|
|
43
|
+
import type { DrizzleRef } from './interface-ref.js';
|
|
44
|
+
import type { IndirectInclude } from './utils/map-query.js';
|
|
45
|
+
import type { SelectionMap } from './utils/selections.js';
|
|
46
46
|
|
|
47
47
|
export interface FieldPathInfo {
|
|
48
48
|
field: string;
|
|
@@ -736,4 +736,4 @@ export interface DrizzleGraphQLInputExtensions {
|
|
|
736
736
|
inputType: 'insert' | 'filters' | 'orderBy' | 'update';
|
|
737
737
|
}
|
|
738
738
|
|
|
739
|
-
export { DrizzleObjectRef } from './object-ref';
|
|
739
|
+
export { DrizzleObjectRef } from './object-ref.js';
|
package/src/utils/config.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createContextCache, type SchemaTypes } from '@pothos/core';
|
|
2
2
|
import { type AnyRelations, type Column, getColumns, isTable, type Table } from 'drizzle-orm';
|
|
3
|
-
import type { DrizzleClient } from '../types';
|
|
3
|
+
import type { DrizzleClient } from '../types.js';
|
|
4
4
|
|
|
5
5
|
export interface PothosDrizzleSchemaConfig {
|
|
6
6
|
skipDeferredFragments: boolean;
|
package/src/utils/cursors.ts
CHANGED
|
@@ -14,10 +14,10 @@ import {
|
|
|
14
14
|
type TableRelationalConfig,
|
|
15
15
|
} from 'drizzle-orm';
|
|
16
16
|
import type { GraphQLResolveInfo } from 'graphql';
|
|
17
|
-
import type { ConnectionOrderBy, QueryForDrizzleConnection } from '../types';
|
|
18
|
-
import type { PothosDrizzleSchemaConfig } from './config';
|
|
19
|
-
import { queryFromInfo } from './map-query';
|
|
20
|
-
import type { SelectionMap } from './selections';
|
|
17
|
+
import type { ConnectionOrderBy, QueryForDrizzleConnection } from '../types.js';
|
|
18
|
+
import type { PothosDrizzleSchemaConfig } from './config.js';
|
|
19
|
+
import { queryFromInfo } from './map-query.js';
|
|
20
|
+
import type { SelectionMap } from './selections.js';
|
|
21
21
|
|
|
22
22
|
const DEFAULT_MAX_SIZE = 100;
|
|
23
23
|
const DEFAULT_SIZE = 20;
|
package/src/utils/map-query.ts
CHANGED
|
@@ -20,9 +20,9 @@ import {
|
|
|
20
20
|
Kind,
|
|
21
21
|
type SelectionSetNode,
|
|
22
22
|
} from 'graphql';
|
|
23
|
-
import type { DrizzleFieldSelection, FieldPathInfo, PathInfo } from '../types';
|
|
24
|
-
import type { PothosDrizzleSchemaConfig } from './config';
|
|
25
|
-
import { type LoaderMappings, setLoaderMappings } from './loader-map';
|
|
23
|
+
import type { DrizzleFieldSelection, FieldPathInfo, PathInfo } from '../types.js';
|
|
24
|
+
import type { PothosDrizzleSchemaConfig } from './config.js';
|
|
25
|
+
import { type LoaderMappings, setLoaderMappings } from './loader-map.js';
|
|
26
26
|
import {
|
|
27
27
|
createState,
|
|
28
28
|
mergeSelection,
|
|
@@ -30,8 +30,8 @@ import {
|
|
|
30
30
|
type SelectionState,
|
|
31
31
|
selectionCompatible,
|
|
32
32
|
selectionToQuery,
|
|
33
|
-
} from './selections';
|
|
34
|
-
import { wrapWithUsageCheck } from './usage';
|
|
33
|
+
} from './selections.js';
|
|
34
|
+
import { wrapWithUsageCheck } from './usage.js';
|
|
35
35
|
|
|
36
36
|
export interface IndirectInclude {
|
|
37
37
|
getType: () => string;
|
package/src/utils/refs.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PothosSchemaError, type SchemaTypes } from '@pothos/core';
|
|
2
|
-
import { DrizzleInterfaceRef, type DrizzleRef } from '../interface-ref';
|
|
3
|
-
import { DrizzleObjectRef } from '../object-ref';
|
|
2
|
+
import { DrizzleInterfaceRef, type DrizzleRef } from '../interface-ref.js';
|
|
3
|
+
import { DrizzleObjectRef } from '../object-ref.js';
|
|
4
4
|
|
|
5
5
|
export const refMap = new WeakMap<object, Map<string, DrizzleRef<never>>>();
|
|
6
6
|
|
package/src/utils/selections.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PothosValidationError } from '@pothos/core';
|
|
2
2
|
import type { DBQueryConfig, TableRelationalConfig } from 'drizzle-orm';
|
|
3
|
-
import type { PothosDrizzleSchemaConfig } from './config';
|
|
4
|
-
import { deepEqual } from './deep-equal';
|
|
5
|
-
import type { LoaderMappings } from './loader-map';
|
|
3
|
+
import type { PothosDrizzleSchemaConfig } from './config.js';
|
|
4
|
+
import { deepEqual } from './deep-equal.js';
|
|
5
|
+
import type { LoaderMappings } from './loader-map.js';
|
|
6
6
|
|
|
7
7
|
export interface SelectionState {
|
|
8
8
|
table: TableRelationalConfig;
|