houdini 1.0.0-next.7 → 1.0.0-next.9
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/build/cmd-cjs/index.js +93 -66
- package/build/cmd-esm/index.js +66 -39
- package/build/codegen/generators/typescript/typeReference.d.ts +4 -2
- package/build/codegen/generators/typescript/types.d.ts +0 -1
- package/build/codegen-cjs/index.js +67 -39
- package/build/codegen-esm/index.js +54 -26
- package/build/lib/config.d.ts +2 -1
- package/build/lib/path.d.ts +1 -1
- package/build/lib-cjs/index.js +40 -37
- package/build/lib-esm/index.js +14 -11
- package/build/runtime/cache/cache.d.ts +6 -6
- package/build/runtime/cache/storage.d.ts +5 -5
- package/build/runtime/cache/stuff.d.ts +0 -2
- package/build/runtime/client/documentStore.d.ts +4 -3
- package/build/runtime/client/index.d.ts +6 -5
- package/build/runtime/client/plugins/cache.d.ts +1 -1
- package/build/runtime/client/plugins/fetch.d.ts +1 -1
- package/build/runtime/client/plugins/fetchParams.d.ts +1 -1
- package/build/runtime/client/plugins/injectedPlugins.d.ts +2 -1
- package/build/runtime/client/plugins/mutation.d.ts +1 -1
- package/build/runtime/client/plugins/query.d.ts +1 -1
- package/build/runtime/client/plugins/subscription.d.ts +1 -1
- package/build/runtime/client/plugins/throwOnError.d.ts +1 -1
- package/build/runtime/client/utils/documentPlugins.d.ts +2 -2
- package/build/runtime/lib/flatten.d.ts +2 -0
- package/build/runtime/lib/types.d.ts +2 -0
- package/build/runtime/public/record.d.ts +1 -2
- package/build/runtime-cjs/cache/cache.d.ts +6 -6
- package/build/runtime-cjs/cache/cache.js +6 -5
- package/build/runtime-cjs/cache/lists.js +3 -3
- package/build/runtime-cjs/cache/storage.d.ts +5 -5
- package/build/runtime-cjs/cache/storage.js +2 -2
- package/build/runtime-cjs/cache/stuff.d.ts +0 -2
- package/build/runtime-cjs/cache/stuff.js +2 -19
- package/build/runtime-cjs/cache/subscription.js +5 -4
- package/build/runtime-cjs/client/documentStore.d.ts +4 -3
- package/build/runtime-cjs/client/documentStore.js +4 -4
- package/build/runtime-cjs/client/index.d.ts +6 -5
- package/build/runtime-cjs/client/index.js +45 -19
- package/build/runtime-cjs/client/plugins/cache.d.ts +1 -1
- package/build/runtime-cjs/client/plugins/cache.js +3 -3
- package/build/runtime-cjs/client/plugins/fetch.d.ts +1 -1
- package/build/runtime-cjs/client/plugins/fetch.js +7 -7
- package/build/runtime-cjs/client/plugins/fetchParams.d.ts +1 -1
- package/build/runtime-cjs/client/plugins/fetchParams.js +3 -3
- package/build/runtime-cjs/client/plugins/injectedPlugins.d.ts +2 -1
- package/build/runtime-cjs/client/plugins/mutation.d.ts +1 -1
- package/build/runtime-cjs/client/plugins/mutation.js +3 -3
- package/build/runtime-cjs/client/plugins/query.d.ts +1 -1
- package/build/runtime-cjs/client/plugins/query.js +3 -3
- package/build/runtime-cjs/client/plugins/subscription.d.ts +1 -1
- package/build/runtime-cjs/client/plugins/subscription.js +3 -3
- package/build/runtime-cjs/client/plugins/throwOnError.d.ts +1 -1
- package/build/runtime-cjs/client/plugins/throwOnError.js +3 -3
- package/build/runtime-cjs/client/utils/documentPlugins.d.ts +2 -2
- package/build/runtime-cjs/lib/flatten.d.ts +2 -0
- package/build/runtime-cjs/lib/flatten.js +41 -0
- package/build/runtime-cjs/lib/types.d.ts +2 -0
- package/build/runtime-cjs/public/cache.js +2 -2
- package/build/runtime-cjs/public/record.d.ts +1 -2
- package/build/runtime-cjs/public/record.js +1 -2
- package/build/runtime-esm/cache/cache.d.ts +6 -6
- package/build/runtime-esm/cache/cache.js +7 -6
- package/build/runtime-esm/cache/lists.js +3 -3
- package/build/runtime-esm/cache/storage.d.ts +5 -5
- package/build/runtime-esm/cache/storage.js +2 -2
- package/build/runtime-esm/cache/stuff.d.ts +0 -2
- package/build/runtime-esm/cache/stuff.js +1 -17
- package/build/runtime-esm/cache/subscription.js +6 -5
- package/build/runtime-esm/client/documentStore.d.ts +4 -3
- package/build/runtime-esm/client/documentStore.js +5 -5
- package/build/runtime-esm/client/index.d.ts +6 -5
- package/build/runtime-esm/client/index.js +46 -21
- package/build/runtime-esm/client/plugins/cache.d.ts +1 -1
- package/build/runtime-esm/client/plugins/cache.js +2 -2
- package/build/runtime-esm/client/plugins/fetch.d.ts +1 -1
- package/build/runtime-esm/client/plugins/fetch.js +6 -6
- package/build/runtime-esm/client/plugins/fetchParams.d.ts +1 -1
- package/build/runtime-esm/client/plugins/fetchParams.js +2 -2
- package/build/runtime-esm/client/plugins/injectedPlugins.d.ts +2 -1
- package/build/runtime-esm/client/plugins/mutation.d.ts +1 -1
- package/build/runtime-esm/client/plugins/mutation.js +2 -2
- package/build/runtime-esm/client/plugins/query.d.ts +1 -1
- package/build/runtime-esm/client/plugins/query.js +2 -2
- package/build/runtime-esm/client/plugins/subscription.d.ts +1 -1
- package/build/runtime-esm/client/plugins/subscription.js +2 -2
- package/build/runtime-esm/client/plugins/throwOnError.d.ts +1 -1
- package/build/runtime-esm/client/plugins/throwOnError.js +2 -2
- package/build/runtime-esm/client/utils/documentPlugins.d.ts +2 -2
- package/build/runtime-esm/lib/flatten.d.ts +2 -0
- package/build/runtime-esm/lib/flatten.js +17 -0
- package/build/runtime-esm/lib/types.d.ts +2 -0
- package/build/runtime-esm/public/cache.js +2 -2
- package/build/runtime-esm/public/record.d.ts +1 -2
- package/build/runtime-esm/public/record.js +1 -2
- package/build/test-cjs/index.js +67 -39
- package/build/test-esm/index.js +54 -26
- package/build/vite-cjs/index.js +90 -58
- package/build/vite-esm/index.js +64 -32
- package/package.json +4 -4
package/build/test-cjs/index.js
CHANGED
|
@@ -3347,7 +3347,7 @@ var require_definition = __commonJS({
|
|
|
3347
3347
|
exports.assertInterfaceType = assertInterfaceType;
|
|
3348
3348
|
exports.isUnionType = isUnionType7;
|
|
3349
3349
|
exports.assertUnionType = assertUnionType;
|
|
3350
|
-
exports.isEnumType =
|
|
3350
|
+
exports.isEnumType = isEnumType6;
|
|
3351
3351
|
exports.assertEnumType = assertEnumType;
|
|
3352
3352
|
exports.isInputObjectType = isInputObjectType2;
|
|
3353
3353
|
exports.assertInputObjectType = assertInputObjectType;
|
|
@@ -3418,7 +3418,7 @@ var require_definition = __commonJS({
|
|
|
3418
3418
|
return Constructor;
|
|
3419
3419
|
}
|
|
3420
3420
|
function isType(type) {
|
|
3421
|
-
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) ||
|
|
3421
|
+
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType6(type) || isInputObjectType2(type) || isListType3(type) || isNonNullType6(type);
|
|
3422
3422
|
}
|
|
3423
3423
|
function assertType(type) {
|
|
3424
3424
|
if (!isType(type)) {
|
|
@@ -3462,11 +3462,11 @@ var require_definition = __commonJS({
|
|
|
3462
3462
|
}
|
|
3463
3463
|
return type;
|
|
3464
3464
|
}
|
|
3465
|
-
function
|
|
3465
|
+
function isEnumType6(type) {
|
|
3466
3466
|
return (0, _instanceOf.default)(type, GraphQLEnumType);
|
|
3467
3467
|
}
|
|
3468
3468
|
function assertEnumType(type) {
|
|
3469
|
-
if (!
|
|
3469
|
+
if (!isEnumType6(type)) {
|
|
3470
3470
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Enum type."));
|
|
3471
3471
|
}
|
|
3472
3472
|
return type;
|
|
@@ -3499,7 +3499,7 @@ var require_definition = __commonJS({
|
|
|
3499
3499
|
return type;
|
|
3500
3500
|
}
|
|
3501
3501
|
function isInputType(type) {
|
|
3502
|
-
return isScalarType7(type) ||
|
|
3502
|
+
return isScalarType7(type) || isEnumType6(type) || isInputObjectType2(type) || isWrappingType(type) && isInputType(type.ofType);
|
|
3503
3503
|
}
|
|
3504
3504
|
function assertInputType(type) {
|
|
3505
3505
|
if (!isInputType(type)) {
|
|
@@ -3508,7 +3508,7 @@ var require_definition = __commonJS({
|
|
|
3508
3508
|
return type;
|
|
3509
3509
|
}
|
|
3510
3510
|
function isOutputType(type) {
|
|
3511
|
-
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) ||
|
|
3511
|
+
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType6(type) || isWrappingType(type) && isOutputType(type.ofType);
|
|
3512
3512
|
}
|
|
3513
3513
|
function assertOutputType(type) {
|
|
3514
3514
|
if (!isOutputType(type)) {
|
|
@@ -3517,7 +3517,7 @@ var require_definition = __commonJS({
|
|
|
3517
3517
|
return type;
|
|
3518
3518
|
}
|
|
3519
3519
|
function isLeafType(type) {
|
|
3520
|
-
return isScalarType7(type) ||
|
|
3520
|
+
return isScalarType7(type) || isEnumType6(type);
|
|
3521
3521
|
}
|
|
3522
3522
|
function assertLeafType(type) {
|
|
3523
3523
|
if (!isLeafType(type)) {
|
|
@@ -3605,7 +3605,7 @@ var require_definition = __commonJS({
|
|
|
3605
3605
|
}
|
|
3606
3606
|
}
|
|
3607
3607
|
function isNamedType(type) {
|
|
3608
|
-
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) ||
|
|
3608
|
+
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType6(type) || isInputObjectType2(type);
|
|
3609
3609
|
}
|
|
3610
3610
|
function assertNamedType(type) {
|
|
3611
3611
|
if (!isNamedType(type)) {
|
|
@@ -54058,7 +54058,7 @@ async function runPipeline(config2, pipeline, target) {
|
|
|
54058
54058
|
// src/lib/config.ts
|
|
54059
54059
|
var graphql = __toESM(require_graphql2(), 1);
|
|
54060
54060
|
var import_minimatch = __toESM(require_minimatch(), 1);
|
|
54061
|
-
var
|
|
54061
|
+
var import_node_url = require("node:url");
|
|
54062
54062
|
|
|
54063
54063
|
// src/runtime/lib/config.ts
|
|
54064
54064
|
function defaultConfigValues(file) {
|
|
@@ -54155,10 +54155,10 @@ __export(fs_exports, {
|
|
|
54155
54155
|
writeFile: () => writeFile
|
|
54156
54156
|
});
|
|
54157
54157
|
var import_fs_extra = __toESM(require_lib2(), 1);
|
|
54158
|
-
var import_promises = __toESM(require("fs/promises"), 1);
|
|
54159
54158
|
var import_glob = __toESM(require_glob(), 1);
|
|
54160
54159
|
var import_memfs = __toESM(require_lib(), 1);
|
|
54161
|
-
var
|
|
54160
|
+
var import_promises = __toESM(require("node:fs/promises"), 1);
|
|
54161
|
+
var import_node_util = require("node:util");
|
|
54162
54162
|
|
|
54163
54163
|
// src/lib/path.ts
|
|
54164
54164
|
var path_exports = {};
|
|
@@ -54175,36 +54175,36 @@ __export(path_exports, {
|
|
|
54175
54175
|
resolve: () => resolve,
|
|
54176
54176
|
sep: () => sep
|
|
54177
54177
|
});
|
|
54178
|
-
var
|
|
54179
|
-
var
|
|
54178
|
+
var import_node_os = __toESM(require("node:os"), 1);
|
|
54179
|
+
var import_node_path = __toESM(require("node:path"), 1);
|
|
54180
54180
|
var sep = "/";
|
|
54181
54181
|
function resolve(...parts) {
|
|
54182
|
-
return posixify(
|
|
54182
|
+
return posixify(import_node_path.default.resolve(...parts));
|
|
54183
54183
|
}
|
|
54184
54184
|
function join(...parts) {
|
|
54185
|
-
return posixify(
|
|
54185
|
+
return posixify(import_node_path.default.join(...parts));
|
|
54186
54186
|
}
|
|
54187
54187
|
function extname(target) {
|
|
54188
|
-
return
|
|
54188
|
+
return import_node_path.default.extname(target);
|
|
54189
54189
|
}
|
|
54190
54190
|
function relative(from, to) {
|
|
54191
|
-
return posixify(
|
|
54191
|
+
return posixify(import_node_path.default.relative(from, to));
|
|
54192
54192
|
}
|
|
54193
54193
|
function basename(target) {
|
|
54194
|
-
return
|
|
54194
|
+
return import_node_path.default.basename(target);
|
|
54195
54195
|
}
|
|
54196
54196
|
function dirname(target) {
|
|
54197
|
-
return
|
|
54197
|
+
return import_node_path.default.dirname(target);
|
|
54198
54198
|
}
|
|
54199
54199
|
function isAbsolute(target) {
|
|
54200
|
-
return
|
|
54200
|
+
return import_node_path.default.isAbsolute(target);
|
|
54201
54201
|
}
|
|
54202
54202
|
function parse(target) {
|
|
54203
|
-
return
|
|
54203
|
+
return import_node_path.default.parse(target);
|
|
54204
54204
|
}
|
|
54205
54205
|
var posixify = (str) => str.replace(/\\/g, "/");
|
|
54206
54206
|
function importPath(target) {
|
|
54207
|
-
return ["win32", "win64"].includes(
|
|
54207
|
+
return ["win32", "win64"].includes(import_node_os.default.platform()) ? "file:///" + target : target;
|
|
54208
54208
|
}
|
|
54209
54209
|
|
|
54210
54210
|
// src/lib/fs.ts
|
|
@@ -54328,7 +54328,7 @@ async function rmdir(filepath) {
|
|
|
54328
54328
|
recursive: true
|
|
54329
54329
|
});
|
|
54330
54330
|
}
|
|
54331
|
-
return await (0,
|
|
54331
|
+
return await (0, import_node_util.promisify)(import_memfs.fs.rmdir)(filepath);
|
|
54332
54332
|
}
|
|
54333
54333
|
async function stat(filepath) {
|
|
54334
54334
|
if (!houdini_mode.is_testing) {
|
|
@@ -54406,7 +54406,7 @@ async function recursiveCopy(source, target, transforms, notRoot) {
|
|
|
54406
54406
|
}
|
|
54407
54407
|
}
|
|
54408
54408
|
async function glob(pattern) {
|
|
54409
|
-
return await (0,
|
|
54409
|
+
return await (0, import_node_util.promisify)(import_glob.glob)(posixify(pattern));
|
|
54410
54410
|
}
|
|
54411
54411
|
glob.hasMagic = import_glob.glob.hasMagic;
|
|
54412
54412
|
|
|
@@ -54421,7 +54421,7 @@ var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
|
|
|
54421
54421
|
|
|
54422
54422
|
// src/lib/config.ts
|
|
54423
54423
|
var import_meta = {};
|
|
54424
|
-
var currentDir = global.__dirname || dirname((0,
|
|
54424
|
+
var currentDir = global.__dirname || dirname((0, import_node_url.fileURLToPath)(import_meta.url));
|
|
54425
54425
|
var Config = class {
|
|
54426
54426
|
filepath;
|
|
54427
54427
|
rootDir;
|
|
@@ -54924,8 +54924,8 @@ function findModule(pkg = "houdini", currentLocation) {
|
|
|
54924
54924
|
}
|
|
54925
54925
|
|
|
54926
54926
|
// src/lib/graphql.ts
|
|
54927
|
-
var import_crypto = __toESM(require("crypto"), 1);
|
|
54928
54927
|
var graphql2 = __toESM(require_graphql2(), 1);
|
|
54928
|
+
var import_node_crypto = __toESM(require("node:crypto"), 1);
|
|
54929
54929
|
function getRootType(type) {
|
|
54930
54930
|
if (graphql2.isNonNullType(type)) {
|
|
54931
54931
|
return getRootType(type.ofType);
|
|
@@ -54939,7 +54939,7 @@ function hashDocument({
|
|
|
54939
54939
|
document
|
|
54940
54940
|
}) {
|
|
54941
54941
|
const docString = typeof document === "string" ? document : document.artifact?.raw;
|
|
54942
|
-
return
|
|
54942
|
+
return import_node_crypto.default.createHash("sha256").update(docString ?? "").digest("hex");
|
|
54943
54943
|
}
|
|
54944
54944
|
function parentTypeFromAncestors(schema, filepath, ancestors) {
|
|
54945
54945
|
const parents = [...ancestors];
|
|
@@ -57678,11 +57678,13 @@ function scalarPropertyValue(config2, missingScalars, target) {
|
|
|
57678
57678
|
|
|
57679
57679
|
// src/codegen/generators/typescript/typeReference.ts
|
|
57680
57680
|
var AST8 = recast8.types.builders;
|
|
57681
|
-
function tsTypeReference(config2, missingScalars, definition) {
|
|
57681
|
+
function tsTypeReference(config2, missingScalars, definition, body) {
|
|
57682
57682
|
const { type, wrappers } = unwrapType(config2, definition.type);
|
|
57683
57683
|
let result;
|
|
57684
57684
|
if (graphql14.isScalarType(type)) {
|
|
57685
57685
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
57686
|
+
} else if (graphql14.isEnumType(type)) {
|
|
57687
|
+
result = enumReference(config2, body, type.name);
|
|
57686
57688
|
} else {
|
|
57687
57689
|
result = AST8.tsTypeReference(AST8.identifier(type.name));
|
|
57688
57690
|
}
|
|
@@ -57697,6 +57699,19 @@ function tsTypeReference(config2, missingScalars, definition) {
|
|
|
57697
57699
|
}
|
|
57698
57700
|
return result;
|
|
57699
57701
|
}
|
|
57702
|
+
function enumReference(config2, body, name) {
|
|
57703
|
+
ensureImports({
|
|
57704
|
+
config: config2,
|
|
57705
|
+
body,
|
|
57706
|
+
import: ["ValueOf"],
|
|
57707
|
+
importKind: "type",
|
|
57708
|
+
sourceModule: "$houdini/runtime/lib/types"
|
|
57709
|
+
});
|
|
57710
|
+
return AST8.tsTypeReference(
|
|
57711
|
+
AST8.identifier("ValueOf"),
|
|
57712
|
+
AST8.tsTypeParameterInstantiation([AST8.tsTypeQuery(AST8.identifier(name))])
|
|
57713
|
+
);
|
|
57714
|
+
}
|
|
57700
57715
|
|
|
57701
57716
|
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
57702
57717
|
var AST9 = recast9.types.builders;
|
|
@@ -57728,7 +57743,7 @@ function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingS
|
|
|
57728
57743
|
members.push(
|
|
57729
57744
|
AST9.tsPropertySignature(
|
|
57730
57745
|
AST9.identifier(field.name),
|
|
57731
|
-
AST9.tsTypeAnnotation(tsTypeReference(config2, missingScalars, field)),
|
|
57746
|
+
AST9.tsTypeAnnotation(tsTypeReference(config2, missingScalars, field, body)),
|
|
57732
57747
|
graphql15.isNullableType(field.type)
|
|
57733
57748
|
)
|
|
57734
57749
|
);
|
|
@@ -57759,6 +57774,13 @@ function inlineType({
|
|
|
57759
57774
|
if (graphql16.isScalarType(type)) {
|
|
57760
57775
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
57761
57776
|
} else if (graphql16.isEnumType(type)) {
|
|
57777
|
+
ensureImports({
|
|
57778
|
+
config: config2,
|
|
57779
|
+
body,
|
|
57780
|
+
importKind: "type",
|
|
57781
|
+
import: ["ValueOf"],
|
|
57782
|
+
sourceModule: "$houdini/runtime/lib/types"
|
|
57783
|
+
});
|
|
57762
57784
|
if (!visitedTypes.has(type.name)) {
|
|
57763
57785
|
ensureImports({
|
|
57764
57786
|
config: config2,
|
|
@@ -57768,7 +57790,7 @@ function inlineType({
|
|
|
57768
57790
|
});
|
|
57769
57791
|
visitedTypes.add(type.name);
|
|
57770
57792
|
}
|
|
57771
|
-
result =
|
|
57793
|
+
result = enumReference(config2, body, type.name);
|
|
57772
57794
|
} else if (selections) {
|
|
57773
57795
|
const rootObj = type;
|
|
57774
57796
|
const inlineFragments = {};
|
|
@@ -58201,7 +58223,7 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
58201
58223
|
return AST11.tsPropertySignature(
|
|
58202
58224
|
AST11.identifier(definition2.variable.name.value),
|
|
58203
58225
|
AST11.tsTypeAnnotation(
|
|
58204
|
-
tsTypeReference(config2, missingScalars, definition2)
|
|
58226
|
+
tsTypeReference(config2, missingScalars, definition2, body)
|
|
58205
58227
|
),
|
|
58206
58228
|
definition2.type.kind !== "NonNullType"
|
|
58207
58229
|
);
|
|
@@ -58268,7 +58290,12 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
58268
58290
|
return AST11.tsPropertySignature(
|
|
58269
58291
|
AST11.identifier(definition2.variable.name.value),
|
|
58270
58292
|
AST11.tsTypeAnnotation(
|
|
58271
|
-
tsTypeReference(
|
|
58293
|
+
tsTypeReference(
|
|
58294
|
+
config2,
|
|
58295
|
+
missingScalars,
|
|
58296
|
+
definition2,
|
|
58297
|
+
body
|
|
58298
|
+
)
|
|
58272
58299
|
),
|
|
58273
58300
|
definition2.type.kind !== "NonNullType"
|
|
58274
58301
|
);
|
|
@@ -58361,7 +58388,7 @@ async function imperativeCacheTypef(config2, docs) {
|
|
|
58361
58388
|
),
|
|
58362
58389
|
AST12.tsPropertySignature(
|
|
58363
58390
|
AST12.identifier("lists"),
|
|
58364
|
-
AST12.tsTypeAnnotation(listDefinitions(config2, docs))
|
|
58391
|
+
AST12.tsTypeAnnotation(listDefinitions(config2, body, docs))
|
|
58365
58392
|
),
|
|
58366
58393
|
AST12.tsPropertySignature(
|
|
58367
58394
|
AST12.identifier("queries"),
|
|
@@ -58470,7 +58497,7 @@ function typeDefinitions(config2, body, docs, returnType) {
|
|
|
58470
58497
|
const prop = AST12.tsPropertySignature(
|
|
58471
58498
|
AST12.identifier(arg.name),
|
|
58472
58499
|
AST12.tsTypeAnnotation(
|
|
58473
|
-
tsTypeReference(config2, /* @__PURE__ */ new Set(), arg)
|
|
58500
|
+
tsTypeReference(config2, /* @__PURE__ */ new Set(), arg, body)
|
|
58474
58501
|
)
|
|
58475
58502
|
);
|
|
58476
58503
|
const unwrapped2 = unwrapType(config2, arg.type);
|
|
@@ -58520,7 +58547,7 @@ function typeDefinitions(config2, body, docs, returnType) {
|
|
|
58520
58547
|
})
|
|
58521
58548
|
);
|
|
58522
58549
|
}
|
|
58523
|
-
function listDefinitions(config2, docs) {
|
|
58550
|
+
function listDefinitions(config2, body, docs) {
|
|
58524
58551
|
const lists = [];
|
|
58525
58552
|
const visitedLists = /* @__PURE__ */ new Set();
|
|
58526
58553
|
for (const doc of docs) {
|
|
@@ -58577,7 +58604,8 @@ function listDefinitions(config2, docs) {
|
|
|
58577
58604
|
tsTypeReference(
|
|
58578
58605
|
config2,
|
|
58579
58606
|
/* @__PURE__ */ new Set(),
|
|
58580
|
-
arg
|
|
58607
|
+
arg,
|
|
58608
|
+
body
|
|
58581
58609
|
)
|
|
58582
58610
|
)
|
|
58583
58611
|
);
|
|
@@ -58771,9 +58799,9 @@ async function definitionsGenerator(config2) {
|
|
|
58771
58799
|
).code;
|
|
58772
58800
|
const typeDefinitions2 = enums.sort((a, b) => a.name.value.localeCompare(b.name.value)).map(
|
|
58773
58801
|
(definition) => `
|
|
58774
|
-
export
|
|
58775
|
-
${definition.values?.map((value) => ` ${value.name.value}
|
|
58776
|
-
}
|
|
58802
|
+
export const ${definition.name.value} = {
|
|
58803
|
+
${definition.values?.map((value) => ` ${value.name.value}: "${value.name.value}"`).join(",\n")}
|
|
58804
|
+
} as const
|
|
58777
58805
|
`
|
|
58778
58806
|
).join("");
|
|
58779
58807
|
const definitionsIndex = `
|
package/build/test-esm/index.js
CHANGED
|
@@ -3352,7 +3352,7 @@ var require_definition = __commonJS({
|
|
|
3352
3352
|
exports.assertInterfaceType = assertInterfaceType;
|
|
3353
3353
|
exports.isUnionType = isUnionType7;
|
|
3354
3354
|
exports.assertUnionType = assertUnionType;
|
|
3355
|
-
exports.isEnumType =
|
|
3355
|
+
exports.isEnumType = isEnumType6;
|
|
3356
3356
|
exports.assertEnumType = assertEnumType;
|
|
3357
3357
|
exports.isInputObjectType = isInputObjectType2;
|
|
3358
3358
|
exports.assertInputObjectType = assertInputObjectType;
|
|
@@ -3423,7 +3423,7 @@ var require_definition = __commonJS({
|
|
|
3423
3423
|
return Constructor;
|
|
3424
3424
|
}
|
|
3425
3425
|
function isType(type) {
|
|
3426
|
-
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) ||
|
|
3426
|
+
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType6(type) || isInputObjectType2(type) || isListType3(type) || isNonNullType6(type);
|
|
3427
3427
|
}
|
|
3428
3428
|
function assertType(type) {
|
|
3429
3429
|
if (!isType(type)) {
|
|
@@ -3467,11 +3467,11 @@ var require_definition = __commonJS({
|
|
|
3467
3467
|
}
|
|
3468
3468
|
return type;
|
|
3469
3469
|
}
|
|
3470
|
-
function
|
|
3470
|
+
function isEnumType6(type) {
|
|
3471
3471
|
return (0, _instanceOf.default)(type, GraphQLEnumType);
|
|
3472
3472
|
}
|
|
3473
3473
|
function assertEnumType(type) {
|
|
3474
|
-
if (!
|
|
3474
|
+
if (!isEnumType6(type)) {
|
|
3475
3475
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Enum type."));
|
|
3476
3476
|
}
|
|
3477
3477
|
return type;
|
|
@@ -3504,7 +3504,7 @@ var require_definition = __commonJS({
|
|
|
3504
3504
|
return type;
|
|
3505
3505
|
}
|
|
3506
3506
|
function isInputType(type) {
|
|
3507
|
-
return isScalarType7(type) ||
|
|
3507
|
+
return isScalarType7(type) || isEnumType6(type) || isInputObjectType2(type) || isWrappingType(type) && isInputType(type.ofType);
|
|
3508
3508
|
}
|
|
3509
3509
|
function assertInputType(type) {
|
|
3510
3510
|
if (!isInputType(type)) {
|
|
@@ -3513,7 +3513,7 @@ var require_definition = __commonJS({
|
|
|
3513
3513
|
return type;
|
|
3514
3514
|
}
|
|
3515
3515
|
function isOutputType(type) {
|
|
3516
|
-
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) ||
|
|
3516
|
+
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType6(type) || isWrappingType(type) && isOutputType(type.ofType);
|
|
3517
3517
|
}
|
|
3518
3518
|
function assertOutputType(type) {
|
|
3519
3519
|
if (!isOutputType(type)) {
|
|
@@ -3522,7 +3522,7 @@ var require_definition = __commonJS({
|
|
|
3522
3522
|
return type;
|
|
3523
3523
|
}
|
|
3524
3524
|
function isLeafType(type) {
|
|
3525
|
-
return isScalarType7(type) ||
|
|
3525
|
+
return isScalarType7(type) || isEnumType6(type);
|
|
3526
3526
|
}
|
|
3527
3527
|
function assertLeafType(type) {
|
|
3528
3528
|
if (!isLeafType(type)) {
|
|
@@ -3610,7 +3610,7 @@ var require_definition = __commonJS({
|
|
|
3610
3610
|
}
|
|
3611
3611
|
}
|
|
3612
3612
|
function isNamedType(type) {
|
|
3613
|
-
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) ||
|
|
3613
|
+
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType6(type) || isInputObjectType2(type);
|
|
3614
3614
|
}
|
|
3615
3615
|
function assertNamedType(type) {
|
|
3616
3616
|
if (!isNamedType(type)) {
|
|
@@ -54054,7 +54054,7 @@ async function runPipeline(config2, pipeline, target) {
|
|
|
54054
54054
|
// src/lib/config.ts
|
|
54055
54055
|
var graphql = __toESM(require_graphql2(), 1);
|
|
54056
54056
|
var import_minimatch = __toESM(require_minimatch(), 1);
|
|
54057
|
-
import { fileURLToPath, pathToFileURL } from "url";
|
|
54057
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
54058
54058
|
|
|
54059
54059
|
// src/runtime/lib/config.ts
|
|
54060
54060
|
function defaultConfigValues(file) {
|
|
@@ -54153,8 +54153,8 @@ __export(fs_exports, {
|
|
|
54153
54153
|
var import_fs_extra = __toESM(require_lib2(), 1);
|
|
54154
54154
|
var import_glob = __toESM(require_glob(), 1);
|
|
54155
54155
|
var import_memfs = __toESM(require_lib(), 1);
|
|
54156
|
-
import fs from "fs/promises";
|
|
54157
|
-
import { promisify } from "util";
|
|
54156
|
+
import fs from "node:fs/promises";
|
|
54157
|
+
import { promisify } from "node:util";
|
|
54158
54158
|
|
|
54159
54159
|
// src/lib/path.ts
|
|
54160
54160
|
var path_exports = {};
|
|
@@ -54171,8 +54171,8 @@ __export(path_exports, {
|
|
|
54171
54171
|
resolve: () => resolve,
|
|
54172
54172
|
sep: () => sep
|
|
54173
54173
|
});
|
|
54174
|
-
import os from "os";
|
|
54175
|
-
import path from "path";
|
|
54174
|
+
import os from "node:os";
|
|
54175
|
+
import path from "node:path";
|
|
54176
54176
|
var sep = "/";
|
|
54177
54177
|
function resolve(...parts) {
|
|
54178
54178
|
return posixify(path.resolve(...parts));
|
|
@@ -54920,7 +54920,7 @@ function findModule(pkg = "houdini", currentLocation) {
|
|
|
54920
54920
|
|
|
54921
54921
|
// src/lib/graphql.ts
|
|
54922
54922
|
var graphql2 = __toESM(require_graphql2(), 1);
|
|
54923
|
-
import crypto from "crypto";
|
|
54923
|
+
import crypto from "node:crypto";
|
|
54924
54924
|
function getRootType(type) {
|
|
54925
54925
|
if (graphql2.isNonNullType(type)) {
|
|
54926
54926
|
return getRootType(type.ofType);
|
|
@@ -57673,11 +57673,13 @@ function scalarPropertyValue(config2, missingScalars, target) {
|
|
|
57673
57673
|
|
|
57674
57674
|
// src/codegen/generators/typescript/typeReference.ts
|
|
57675
57675
|
var AST8 = recast8.types.builders;
|
|
57676
|
-
function tsTypeReference(config2, missingScalars, definition) {
|
|
57676
|
+
function tsTypeReference(config2, missingScalars, definition, body) {
|
|
57677
57677
|
const { type, wrappers } = unwrapType(config2, definition.type);
|
|
57678
57678
|
let result;
|
|
57679
57679
|
if (graphql14.isScalarType(type)) {
|
|
57680
57680
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
57681
|
+
} else if (graphql14.isEnumType(type)) {
|
|
57682
|
+
result = enumReference(config2, body, type.name);
|
|
57681
57683
|
} else {
|
|
57682
57684
|
result = AST8.tsTypeReference(AST8.identifier(type.name));
|
|
57683
57685
|
}
|
|
@@ -57692,6 +57694,19 @@ function tsTypeReference(config2, missingScalars, definition) {
|
|
|
57692
57694
|
}
|
|
57693
57695
|
return result;
|
|
57694
57696
|
}
|
|
57697
|
+
function enumReference(config2, body, name) {
|
|
57698
|
+
ensureImports({
|
|
57699
|
+
config: config2,
|
|
57700
|
+
body,
|
|
57701
|
+
import: ["ValueOf"],
|
|
57702
|
+
importKind: "type",
|
|
57703
|
+
sourceModule: "$houdini/runtime/lib/types"
|
|
57704
|
+
});
|
|
57705
|
+
return AST8.tsTypeReference(
|
|
57706
|
+
AST8.identifier("ValueOf"),
|
|
57707
|
+
AST8.tsTypeParameterInstantiation([AST8.tsTypeQuery(AST8.identifier(name))])
|
|
57708
|
+
);
|
|
57709
|
+
}
|
|
57695
57710
|
|
|
57696
57711
|
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
57697
57712
|
var AST9 = recast9.types.builders;
|
|
@@ -57723,7 +57738,7 @@ function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingS
|
|
|
57723
57738
|
members.push(
|
|
57724
57739
|
AST9.tsPropertySignature(
|
|
57725
57740
|
AST9.identifier(field.name),
|
|
57726
|
-
AST9.tsTypeAnnotation(tsTypeReference(config2, missingScalars, field)),
|
|
57741
|
+
AST9.tsTypeAnnotation(tsTypeReference(config2, missingScalars, field, body)),
|
|
57727
57742
|
graphql15.isNullableType(field.type)
|
|
57728
57743
|
)
|
|
57729
57744
|
);
|
|
@@ -57754,6 +57769,13 @@ function inlineType({
|
|
|
57754
57769
|
if (graphql16.isScalarType(type)) {
|
|
57755
57770
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
57756
57771
|
} else if (graphql16.isEnumType(type)) {
|
|
57772
|
+
ensureImports({
|
|
57773
|
+
config: config2,
|
|
57774
|
+
body,
|
|
57775
|
+
importKind: "type",
|
|
57776
|
+
import: ["ValueOf"],
|
|
57777
|
+
sourceModule: "$houdini/runtime/lib/types"
|
|
57778
|
+
});
|
|
57757
57779
|
if (!visitedTypes.has(type.name)) {
|
|
57758
57780
|
ensureImports({
|
|
57759
57781
|
config: config2,
|
|
@@ -57763,7 +57785,7 @@ function inlineType({
|
|
|
57763
57785
|
});
|
|
57764
57786
|
visitedTypes.add(type.name);
|
|
57765
57787
|
}
|
|
57766
|
-
result =
|
|
57788
|
+
result = enumReference(config2, body, type.name);
|
|
57767
57789
|
} else if (selections) {
|
|
57768
57790
|
const rootObj = type;
|
|
57769
57791
|
const inlineFragments = {};
|
|
@@ -58196,7 +58218,7 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
|
|
|
58196
58218
|
return AST11.tsPropertySignature(
|
|
58197
58219
|
AST11.identifier(definition2.variable.name.value),
|
|
58198
58220
|
AST11.tsTypeAnnotation(
|
|
58199
|
-
tsTypeReference(config2, missingScalars, definition2)
|
|
58221
|
+
tsTypeReference(config2, missingScalars, definition2, body)
|
|
58200
58222
|
),
|
|
58201
58223
|
definition2.type.kind !== "NonNullType"
|
|
58202
58224
|
);
|
|
@@ -58263,7 +58285,12 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
58263
58285
|
return AST11.tsPropertySignature(
|
|
58264
58286
|
AST11.identifier(definition2.variable.name.value),
|
|
58265
58287
|
AST11.tsTypeAnnotation(
|
|
58266
|
-
tsTypeReference(
|
|
58288
|
+
tsTypeReference(
|
|
58289
|
+
config2,
|
|
58290
|
+
missingScalars,
|
|
58291
|
+
definition2,
|
|
58292
|
+
body
|
|
58293
|
+
)
|
|
58267
58294
|
),
|
|
58268
58295
|
definition2.type.kind !== "NonNullType"
|
|
58269
58296
|
);
|
|
@@ -58356,7 +58383,7 @@ async function imperativeCacheTypef(config2, docs) {
|
|
|
58356
58383
|
),
|
|
58357
58384
|
AST12.tsPropertySignature(
|
|
58358
58385
|
AST12.identifier("lists"),
|
|
58359
|
-
AST12.tsTypeAnnotation(listDefinitions(config2, docs))
|
|
58386
|
+
AST12.tsTypeAnnotation(listDefinitions(config2, body, docs))
|
|
58360
58387
|
),
|
|
58361
58388
|
AST12.tsPropertySignature(
|
|
58362
58389
|
AST12.identifier("queries"),
|
|
@@ -58465,7 +58492,7 @@ function typeDefinitions(config2, body, docs, returnType) {
|
|
|
58465
58492
|
const prop = AST12.tsPropertySignature(
|
|
58466
58493
|
AST12.identifier(arg.name),
|
|
58467
58494
|
AST12.tsTypeAnnotation(
|
|
58468
|
-
tsTypeReference(config2, /* @__PURE__ */ new Set(), arg)
|
|
58495
|
+
tsTypeReference(config2, /* @__PURE__ */ new Set(), arg, body)
|
|
58469
58496
|
)
|
|
58470
58497
|
);
|
|
58471
58498
|
const unwrapped2 = unwrapType(config2, arg.type);
|
|
@@ -58515,7 +58542,7 @@ function typeDefinitions(config2, body, docs, returnType) {
|
|
|
58515
58542
|
})
|
|
58516
58543
|
);
|
|
58517
58544
|
}
|
|
58518
|
-
function listDefinitions(config2, docs) {
|
|
58545
|
+
function listDefinitions(config2, body, docs) {
|
|
58519
58546
|
const lists = [];
|
|
58520
58547
|
const visitedLists = /* @__PURE__ */ new Set();
|
|
58521
58548
|
for (const doc of docs) {
|
|
@@ -58572,7 +58599,8 @@ function listDefinitions(config2, docs) {
|
|
|
58572
58599
|
tsTypeReference(
|
|
58573
58600
|
config2,
|
|
58574
58601
|
/* @__PURE__ */ new Set(),
|
|
58575
|
-
arg
|
|
58602
|
+
arg,
|
|
58603
|
+
body
|
|
58576
58604
|
)
|
|
58577
58605
|
)
|
|
58578
58606
|
);
|
|
@@ -58766,9 +58794,9 @@ async function definitionsGenerator(config2) {
|
|
|
58766
58794
|
).code;
|
|
58767
58795
|
const typeDefinitions2 = enums.sort((a, b) => a.name.value.localeCompare(b.name.value)).map(
|
|
58768
58796
|
(definition) => `
|
|
58769
|
-
export
|
|
58770
|
-
${definition.values?.map((value) => ` ${value.name.value}
|
|
58771
|
-
}
|
|
58797
|
+
export const ${definition.name.value} = {
|
|
58798
|
+
${definition.values?.map((value) => ` ${value.name.value}: "${value.name.value}"`).join(",\n")}
|
|
58799
|
+
} as const
|
|
58772
58800
|
`
|
|
58773
58801
|
).join("");
|
|
58774
58802
|
const definitionsIndex = `
|