houdini 1.0.6 → 1.0.8
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 +220 -94
- package/build/cmd-esm/index.js +220 -94
- package/build/codegen-cjs/index.js +130 -16
- package/build/codegen-esm/index.js +130 -16
- package/build/lib/config.d.ts +4 -3
- package/build/lib/detectTools.d.ts +11 -0
- package/build/lib/index.d.ts +1 -0
- package/build/lib-cjs/index.js +139 -8
- package/build/lib-esm/index.js +136 -8
- package/build/runtime/client/plugins/throwOnError.d.ts +2 -2
- package/build/runtime/lib/config.d.ts +5 -1
- package/build/runtime/lib/types.d.ts +7 -1
- package/build/runtime-cjs/client/plugins/throwOnError.d.ts +2 -2
- package/build/runtime-cjs/client/plugins/throwOnError.js +1 -1
- package/build/runtime-cjs/lib/config.d.ts +5 -1
- package/build/runtime-cjs/lib/types.d.ts +7 -1
- package/build/runtime-cjs/lib/types.js +6 -0
- package/build/runtime-esm/client/plugins/throwOnError.d.ts +2 -2
- package/build/runtime-esm/client/plugins/throwOnError.js +1 -1
- package/build/runtime-esm/lib/config.d.ts +5 -1
- package/build/runtime-esm/lib/types.d.ts +7 -1
- package/build/runtime-esm/lib/types.js +5 -0
- package/build/test-cjs/index.js +137 -20
- package/build/test-esm/index.js +137 -20
- package/build/vite-cjs/index.js +137 -20
- package/build/vite-esm/index.js +137 -20
- package/package.json +1 -2
package/build/lib-cjs/index.js
CHANGED
|
@@ -42019,14 +42019,18 @@ var require_lib3 = __commonJS({
|
|
|
42019
42019
|
}
|
|
42020
42020
|
});
|
|
42021
42021
|
|
|
42022
|
-
// ../../node_modules/.pnpm/tslib@2.
|
|
42022
|
+
// ../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js
|
|
42023
42023
|
var require_tslib = __commonJS({
|
|
42024
|
-
"../../node_modules/.pnpm/tslib@2.
|
|
42024
|
+
"../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js"(exports, module2) {
|
|
42025
42025
|
var __extends;
|
|
42026
42026
|
var __assign;
|
|
42027
42027
|
var __rest;
|
|
42028
42028
|
var __decorate;
|
|
42029
42029
|
var __param;
|
|
42030
|
+
var __esDecorate;
|
|
42031
|
+
var __runInitializers;
|
|
42032
|
+
var __propKey;
|
|
42033
|
+
var __setFunctionName;
|
|
42030
42034
|
var __metadata;
|
|
42031
42035
|
var __awaiter;
|
|
42032
42036
|
var __generator;
|
|
@@ -42123,6 +42127,65 @@ var require_tslib = __commonJS({
|
|
|
42123
42127
|
decorator(target, key, paramIndex);
|
|
42124
42128
|
};
|
|
42125
42129
|
};
|
|
42130
|
+
__esDecorate = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
42131
|
+
function accept(f3) {
|
|
42132
|
+
if (f3 !== void 0 && typeof f3 !== "function")
|
|
42133
|
+
throw new TypeError("Function expected");
|
|
42134
|
+
return f3;
|
|
42135
|
+
}
|
|
42136
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
42137
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
42138
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
42139
|
+
var _, done = false;
|
|
42140
|
+
for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
|
|
42141
|
+
var context = {};
|
|
42142
|
+
for (var p in contextIn)
|
|
42143
|
+
context[p] = p === "access" ? {} : contextIn[p];
|
|
42144
|
+
for (var p in contextIn.access)
|
|
42145
|
+
context.access[p] = contextIn.access[p];
|
|
42146
|
+
context.addInitializer = function(f3) {
|
|
42147
|
+
if (done)
|
|
42148
|
+
throw new TypeError("Cannot add initializers after decoration has completed");
|
|
42149
|
+
extraInitializers.push(accept(f3 || null));
|
|
42150
|
+
};
|
|
42151
|
+
var result = (0, decorators[i2])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
42152
|
+
if (kind === "accessor") {
|
|
42153
|
+
if (result === void 0)
|
|
42154
|
+
continue;
|
|
42155
|
+
if (result === null || typeof result !== "object")
|
|
42156
|
+
throw new TypeError("Object expected");
|
|
42157
|
+
if (_ = accept(result.get))
|
|
42158
|
+
descriptor.get = _;
|
|
42159
|
+
if (_ = accept(result.set))
|
|
42160
|
+
descriptor.set = _;
|
|
42161
|
+
if (_ = accept(result.init))
|
|
42162
|
+
initializers.push(_);
|
|
42163
|
+
} else if (_ = accept(result)) {
|
|
42164
|
+
if (kind === "field")
|
|
42165
|
+
initializers.push(_);
|
|
42166
|
+
else
|
|
42167
|
+
descriptor[key] = _;
|
|
42168
|
+
}
|
|
42169
|
+
}
|
|
42170
|
+
if (target)
|
|
42171
|
+
Object.defineProperty(target, contextIn.name, descriptor);
|
|
42172
|
+
done = true;
|
|
42173
|
+
};
|
|
42174
|
+
__runInitializers = function(thisArg, initializers, value) {
|
|
42175
|
+
var useValue = arguments.length > 2;
|
|
42176
|
+
for (var i2 = 0; i2 < initializers.length; i2++) {
|
|
42177
|
+
value = useValue ? initializers[i2].call(thisArg, value) : initializers[i2].call(thisArg);
|
|
42178
|
+
}
|
|
42179
|
+
return useValue ? value : void 0;
|
|
42180
|
+
};
|
|
42181
|
+
__propKey = function(x2) {
|
|
42182
|
+
return typeof x2 === "symbol" ? x2 : "".concat(x2);
|
|
42183
|
+
};
|
|
42184
|
+
__setFunctionName = function(f3, name, prefix) {
|
|
42185
|
+
if (typeof name === "symbol")
|
|
42186
|
+
name = name.description ? "[".concat(name.description, "]") : "";
|
|
42187
|
+
return Object.defineProperty(f3, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
42188
|
+
};
|
|
42126
42189
|
__metadata = function(metadataKey, metadataValue) {
|
|
42127
42190
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
42128
42191
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
@@ -42357,7 +42420,7 @@ var require_tslib = __commonJS({
|
|
|
42357
42420
|
}, i2;
|
|
42358
42421
|
function verb(n, f3) {
|
|
42359
42422
|
i2[n] = o[n] ? function(v) {
|
|
42360
|
-
return (p = !p) ? { value: __await(o[n](v)), done:
|
|
42423
|
+
return (p = !p) ? { value: __await(o[n](v)), done: false } : f3 ? f3(v) : v;
|
|
42361
42424
|
} : f3;
|
|
42362
42425
|
}
|
|
42363
42426
|
};
|
|
@@ -42435,6 +42498,10 @@ var require_tslib = __commonJS({
|
|
|
42435
42498
|
exporter("__rest", __rest);
|
|
42436
42499
|
exporter("__decorate", __decorate);
|
|
42437
42500
|
exporter("__param", __param);
|
|
42501
|
+
exporter("__esDecorate", __esDecorate);
|
|
42502
|
+
exporter("__runInitializers", __runInitializers);
|
|
42503
|
+
exporter("__propKey", __propKey);
|
|
42504
|
+
exporter("__setFunctionName", __setFunctionName);
|
|
42438
42505
|
exporter("__metadata", __metadata);
|
|
42439
42506
|
exporter("__awaiter", __awaiter);
|
|
42440
42507
|
exporter("__generator", __generator);
|
|
@@ -58402,6 +58469,7 @@ __export(lib_exports, {
|
|
|
58402
58469
|
HoudiniClient: () => HoudiniClient,
|
|
58403
58470
|
HoudiniError: () => HoudiniError,
|
|
58404
58471
|
LogLevel: () => LogLevel,
|
|
58472
|
+
PaginateMode: () => PaginateMode,
|
|
58405
58473
|
RefetchUpdateMode: () => RefetchUpdateMode,
|
|
58406
58474
|
TypeWrapper: () => TypeWrapper,
|
|
58407
58475
|
cleanupFiles: () => cleanupFiles,
|
|
@@ -58410,6 +58478,8 @@ __export(lib_exports, {
|
|
|
58410
58478
|
deepMerge: () => deepMerge,
|
|
58411
58479
|
defaultConfigValues: () => defaultConfigValues,
|
|
58412
58480
|
definitionFromAncestors: () => definitionFromAncestors,
|
|
58481
|
+
detectFromPackageJSON: () => detectFromPackageJSON,
|
|
58482
|
+
detectTools: () => detectTools,
|
|
58413
58483
|
ensureArtifactImport: () => ensureArtifactImport,
|
|
58414
58484
|
ensureImports: () => ensureImports,
|
|
58415
58485
|
fetch: () => fetch2,
|
|
@@ -61799,6 +61869,10 @@ var CachePolicy = {
|
|
|
61799
61869
|
NetworkOnly: "NetworkOnly",
|
|
61800
61870
|
CacheAndNetwork: "CacheAndNetwork"
|
|
61801
61871
|
};
|
|
61872
|
+
var PaginateMode = {
|
|
61873
|
+
Infinite: "Infinite",
|
|
61874
|
+
SinglePage: "SinglePage"
|
|
61875
|
+
};
|
|
61802
61876
|
var ArtifactKind = {
|
|
61803
61877
|
Query: "HoudiniQuery",
|
|
61804
61878
|
Subscription: "HoudiniSubscription",
|
|
@@ -65752,7 +65826,7 @@ var throwOnError = ({ operations, error }) => () => {
|
|
|
65752
65826
|
return {
|
|
65753
65827
|
async end(ctx, { value, resolve: resolve2 }) {
|
|
65754
65828
|
if (value.errors && value.errors.length > 0 && throwOnKind(ctx.artifact.kind)) {
|
|
65755
|
-
const result = await (error ?? defaultErrorFn)(value.errors);
|
|
65829
|
+
const result = await (error ?? defaultErrorFn)(value.errors, ctx);
|
|
65756
65830
|
throw result;
|
|
65757
65831
|
}
|
|
65758
65832
|
resolve2(ctx);
|
|
@@ -66214,6 +66288,7 @@ var Config = class {
|
|
|
66214
66288
|
defaultPartial;
|
|
66215
66289
|
internalListPosition;
|
|
66216
66290
|
defaultListTarget = null;
|
|
66291
|
+
defaultPaginateMode;
|
|
66217
66292
|
definitionsFolder;
|
|
66218
66293
|
newDocuments = "";
|
|
66219
66294
|
defaultKeys = ["id"];
|
|
@@ -66250,6 +66325,7 @@ var Config = class {
|
|
|
66250
66325
|
defaultPartial = false,
|
|
66251
66326
|
defaultListPosition = "append",
|
|
66252
66327
|
defaultListTarget = null,
|
|
66328
|
+
defaultPaginateMode = PaginateMode.Infinite,
|
|
66253
66329
|
defaultKeys,
|
|
66254
66330
|
types: types4 = {},
|
|
66255
66331
|
logLevel,
|
|
@@ -66283,6 +66359,7 @@ var Config = class {
|
|
|
66283
66359
|
this.defaultPartial = defaultPartial;
|
|
66284
66360
|
this.internalListPosition = defaultListPosition === "append" ? "last" : "first";
|
|
66285
66361
|
this.defaultListTarget = defaultListTarget;
|
|
66362
|
+
this.defaultPaginateMode = defaultPaginateMode;
|
|
66286
66363
|
this.definitionsFolder = definitionsPath;
|
|
66287
66364
|
this.logLevel = (logLevel || LogLevel.Summary).toLowerCase();
|
|
66288
66365
|
this.defaultFragmentMasking = defaultFragmentMasking;
|
|
@@ -66546,7 +66623,7 @@ var Config = class {
|
|
|
66546
66623
|
get listAllListsDirective() {
|
|
66547
66624
|
return "allLists";
|
|
66548
66625
|
}
|
|
66549
|
-
get
|
|
66626
|
+
get listOrPaginateNameArg() {
|
|
66550
66627
|
return "name";
|
|
66551
66628
|
}
|
|
66552
66629
|
get insertFragmentSuffix() {
|
|
@@ -66579,8 +66656,8 @@ var Config = class {
|
|
|
66579
66656
|
get paginateDirective() {
|
|
66580
66657
|
return "paginate";
|
|
66581
66658
|
}
|
|
66582
|
-
get
|
|
66583
|
-
return "
|
|
66659
|
+
get paginateModeArg() {
|
|
66660
|
+
return "mode";
|
|
66584
66661
|
}
|
|
66585
66662
|
get cacheDirective() {
|
|
66586
66663
|
return "cache";
|
|
@@ -66622,7 +66699,7 @@ var Config = class {
|
|
|
66622
66699
|
return name + this.removeFragmentSuffix;
|
|
66623
66700
|
}
|
|
66624
66701
|
isInternalEnum(node) {
|
|
66625
|
-
return node.name.value === "CachePolicy";
|
|
66702
|
+
return node.name.value === "CachePolicy" || node.name.value === "PaginateMode";
|
|
66626
66703
|
}
|
|
66627
66704
|
isInternalDirective(name) {
|
|
66628
66705
|
const internalDirectives = this.#newSchemaInstance?.getDirectives().reduce((list, directive) => {
|
|
@@ -67164,6 +67241,57 @@ function deepMerge(filepath, ...targets) {
|
|
|
67164
67241
|
}
|
|
67165
67242
|
}
|
|
67166
67243
|
|
|
67244
|
+
// src/lib/detectTools.ts
|
|
67245
|
+
async function detectFromPackageJSON(cwd) {
|
|
67246
|
+
try {
|
|
67247
|
+
const packageJSONFile = await fs_exports.readFile(path_exports.join(cwd, "package.json"));
|
|
67248
|
+
if (packageJSONFile) {
|
|
67249
|
+
var packageJSON = JSON.parse(packageJSONFile);
|
|
67250
|
+
} else {
|
|
67251
|
+
throw new Error("not found");
|
|
67252
|
+
}
|
|
67253
|
+
} catch {
|
|
67254
|
+
throw new Error(
|
|
67255
|
+
"\u274C houdini init must target an existing node project (with a package.json)"
|
|
67256
|
+
);
|
|
67257
|
+
}
|
|
67258
|
+
const { devDependencies, dependencies } = packageJSON;
|
|
67259
|
+
const hasDependency = (dep) => Boolean(devDependencies?.[dep] || dependencies?.[dep]);
|
|
67260
|
+
let framework = "svelte";
|
|
67261
|
+
if (hasDependency("@sveltejs/kit")) {
|
|
67262
|
+
framework = "kit";
|
|
67263
|
+
}
|
|
67264
|
+
return {
|
|
67265
|
+
framework,
|
|
67266
|
+
module: packageJSON["type"] === "module" ? "esm" : "commonjs"
|
|
67267
|
+
};
|
|
67268
|
+
}
|
|
67269
|
+
async function detectTools(cwd) {
|
|
67270
|
+
let typescript = false;
|
|
67271
|
+
try {
|
|
67272
|
+
await fs_exports.stat(path_exports.join(cwd, "tsconfig.json"));
|
|
67273
|
+
typescript = true;
|
|
67274
|
+
} catch {
|
|
67275
|
+
}
|
|
67276
|
+
let package_manager = "npm";
|
|
67277
|
+
let dir = cwd;
|
|
67278
|
+
do {
|
|
67279
|
+
if (fs_exports.existsSync(path_exports.join(dir, "pnpm-lock.yaml"))) {
|
|
67280
|
+
package_manager = "pnpm";
|
|
67281
|
+
break;
|
|
67282
|
+
}
|
|
67283
|
+
if (fs_exports.existsSync(path_exports.join(dir, "yarn.lock"))) {
|
|
67284
|
+
package_manager = "yarn";
|
|
67285
|
+
break;
|
|
67286
|
+
}
|
|
67287
|
+
} while (dir !== (dir = path_exports.dirname(dir)));
|
|
67288
|
+
return {
|
|
67289
|
+
typescript,
|
|
67290
|
+
package_manager,
|
|
67291
|
+
...await detectFromPackageJSON(cwd)
|
|
67292
|
+
};
|
|
67293
|
+
}
|
|
67294
|
+
|
|
67167
67295
|
// ../../node_modules/.pnpm/estree-walker@3.0.1/node_modules/estree-walker/src/walker.js
|
|
67168
67296
|
var WalkerBase = class {
|
|
67169
67297
|
constructor() {
|
|
@@ -67361,6 +67489,7 @@ async function find_graphql(config, parsedScript, walker) {
|
|
|
67361
67489
|
HoudiniClient,
|
|
67362
67490
|
HoudiniError,
|
|
67363
67491
|
LogLevel,
|
|
67492
|
+
PaginateMode,
|
|
67364
67493
|
RefetchUpdateMode,
|
|
67365
67494
|
TypeWrapper,
|
|
67366
67495
|
cleanupFiles,
|
|
@@ -67369,6 +67498,8 @@ async function find_graphql(config, parsedScript, walker) {
|
|
|
67369
67498
|
deepMerge,
|
|
67370
67499
|
defaultConfigValues,
|
|
67371
67500
|
definitionFromAncestors,
|
|
67501
|
+
detectFromPackageJSON,
|
|
67502
|
+
detectTools,
|
|
67372
67503
|
ensureArtifactImport,
|
|
67373
67504
|
ensureImports,
|
|
67374
67505
|
fetch,
|
package/build/lib-esm/index.js
CHANGED
|
@@ -42024,14 +42024,18 @@ var require_lib3 = __commonJS({
|
|
|
42024
42024
|
}
|
|
42025
42025
|
});
|
|
42026
42026
|
|
|
42027
|
-
// ../../node_modules/.pnpm/tslib@2.
|
|
42027
|
+
// ../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js
|
|
42028
42028
|
var require_tslib = __commonJS({
|
|
42029
|
-
"../../node_modules/.pnpm/tslib@2.
|
|
42029
|
+
"../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js"(exports, module) {
|
|
42030
42030
|
var __extends;
|
|
42031
42031
|
var __assign;
|
|
42032
42032
|
var __rest;
|
|
42033
42033
|
var __decorate;
|
|
42034
42034
|
var __param;
|
|
42035
|
+
var __esDecorate;
|
|
42036
|
+
var __runInitializers;
|
|
42037
|
+
var __propKey;
|
|
42038
|
+
var __setFunctionName;
|
|
42035
42039
|
var __metadata;
|
|
42036
42040
|
var __awaiter;
|
|
42037
42041
|
var __generator;
|
|
@@ -42128,6 +42132,65 @@ var require_tslib = __commonJS({
|
|
|
42128
42132
|
decorator(target, key, paramIndex);
|
|
42129
42133
|
};
|
|
42130
42134
|
};
|
|
42135
|
+
__esDecorate = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
42136
|
+
function accept(f3) {
|
|
42137
|
+
if (f3 !== void 0 && typeof f3 !== "function")
|
|
42138
|
+
throw new TypeError("Function expected");
|
|
42139
|
+
return f3;
|
|
42140
|
+
}
|
|
42141
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
42142
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
42143
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
42144
|
+
var _, done = false;
|
|
42145
|
+
for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
|
|
42146
|
+
var context = {};
|
|
42147
|
+
for (var p in contextIn)
|
|
42148
|
+
context[p] = p === "access" ? {} : contextIn[p];
|
|
42149
|
+
for (var p in contextIn.access)
|
|
42150
|
+
context.access[p] = contextIn.access[p];
|
|
42151
|
+
context.addInitializer = function(f3) {
|
|
42152
|
+
if (done)
|
|
42153
|
+
throw new TypeError("Cannot add initializers after decoration has completed");
|
|
42154
|
+
extraInitializers.push(accept(f3 || null));
|
|
42155
|
+
};
|
|
42156
|
+
var result = (0, decorators[i2])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
42157
|
+
if (kind === "accessor") {
|
|
42158
|
+
if (result === void 0)
|
|
42159
|
+
continue;
|
|
42160
|
+
if (result === null || typeof result !== "object")
|
|
42161
|
+
throw new TypeError("Object expected");
|
|
42162
|
+
if (_ = accept(result.get))
|
|
42163
|
+
descriptor.get = _;
|
|
42164
|
+
if (_ = accept(result.set))
|
|
42165
|
+
descriptor.set = _;
|
|
42166
|
+
if (_ = accept(result.init))
|
|
42167
|
+
initializers.push(_);
|
|
42168
|
+
} else if (_ = accept(result)) {
|
|
42169
|
+
if (kind === "field")
|
|
42170
|
+
initializers.push(_);
|
|
42171
|
+
else
|
|
42172
|
+
descriptor[key] = _;
|
|
42173
|
+
}
|
|
42174
|
+
}
|
|
42175
|
+
if (target)
|
|
42176
|
+
Object.defineProperty(target, contextIn.name, descriptor);
|
|
42177
|
+
done = true;
|
|
42178
|
+
};
|
|
42179
|
+
__runInitializers = function(thisArg, initializers, value) {
|
|
42180
|
+
var useValue = arguments.length > 2;
|
|
42181
|
+
for (var i2 = 0; i2 < initializers.length; i2++) {
|
|
42182
|
+
value = useValue ? initializers[i2].call(thisArg, value) : initializers[i2].call(thisArg);
|
|
42183
|
+
}
|
|
42184
|
+
return useValue ? value : void 0;
|
|
42185
|
+
};
|
|
42186
|
+
__propKey = function(x2) {
|
|
42187
|
+
return typeof x2 === "symbol" ? x2 : "".concat(x2);
|
|
42188
|
+
};
|
|
42189
|
+
__setFunctionName = function(f3, name, prefix) {
|
|
42190
|
+
if (typeof name === "symbol")
|
|
42191
|
+
name = name.description ? "[".concat(name.description, "]") : "";
|
|
42192
|
+
return Object.defineProperty(f3, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
42193
|
+
};
|
|
42131
42194
|
__metadata = function(metadataKey, metadataValue) {
|
|
42132
42195
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
42133
42196
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
@@ -42362,7 +42425,7 @@ var require_tslib = __commonJS({
|
|
|
42362
42425
|
}, i2;
|
|
42363
42426
|
function verb(n, f3) {
|
|
42364
42427
|
i2[n] = o[n] ? function(v) {
|
|
42365
|
-
return (p = !p) ? { value: __await(o[n](v)), done:
|
|
42428
|
+
return (p = !p) ? { value: __await(o[n](v)), done: false } : f3 ? f3(v) : v;
|
|
42366
42429
|
} : f3;
|
|
42367
42430
|
}
|
|
42368
42431
|
};
|
|
@@ -42440,6 +42503,10 @@ var require_tslib = __commonJS({
|
|
|
42440
42503
|
exporter("__rest", __rest);
|
|
42441
42504
|
exporter("__decorate", __decorate);
|
|
42442
42505
|
exporter("__param", __param);
|
|
42506
|
+
exporter("__esDecorate", __esDecorate);
|
|
42507
|
+
exporter("__runInitializers", __runInitializers);
|
|
42508
|
+
exporter("__propKey", __propKey);
|
|
42509
|
+
exporter("__setFunctionName", __setFunctionName);
|
|
42443
42510
|
exporter("__metadata", __metadata);
|
|
42444
42511
|
exporter("__awaiter", __awaiter);
|
|
42445
42512
|
exporter("__generator", __generator);
|
|
@@ -61748,6 +61815,10 @@ var CachePolicy = {
|
|
|
61748
61815
|
NetworkOnly: "NetworkOnly",
|
|
61749
61816
|
CacheAndNetwork: "CacheAndNetwork"
|
|
61750
61817
|
};
|
|
61818
|
+
var PaginateMode = {
|
|
61819
|
+
Infinite: "Infinite",
|
|
61820
|
+
SinglePage: "SinglePage"
|
|
61821
|
+
};
|
|
61751
61822
|
var ArtifactKind = {
|
|
61752
61823
|
Query: "HoudiniQuery",
|
|
61753
61824
|
Subscription: "HoudiniSubscription",
|
|
@@ -65701,7 +65772,7 @@ var throwOnError = ({ operations, error }) => () => {
|
|
|
65701
65772
|
return {
|
|
65702
65773
|
async end(ctx, { value, resolve: resolve2 }) {
|
|
65703
65774
|
if (value.errors && value.errors.length > 0 && throwOnKind(ctx.artifact.kind)) {
|
|
65704
|
-
const result = await (error ?? defaultErrorFn)(value.errors);
|
|
65775
|
+
const result = await (error ?? defaultErrorFn)(value.errors, ctx);
|
|
65705
65776
|
throw result;
|
|
65706
65777
|
}
|
|
65707
65778
|
resolve2(ctx);
|
|
@@ -66162,6 +66233,7 @@ var Config = class {
|
|
|
66162
66233
|
defaultPartial;
|
|
66163
66234
|
internalListPosition;
|
|
66164
66235
|
defaultListTarget = null;
|
|
66236
|
+
defaultPaginateMode;
|
|
66165
66237
|
definitionsFolder;
|
|
66166
66238
|
newDocuments = "";
|
|
66167
66239
|
defaultKeys = ["id"];
|
|
@@ -66198,6 +66270,7 @@ var Config = class {
|
|
|
66198
66270
|
defaultPartial = false,
|
|
66199
66271
|
defaultListPosition = "append",
|
|
66200
66272
|
defaultListTarget = null,
|
|
66273
|
+
defaultPaginateMode = PaginateMode.Infinite,
|
|
66201
66274
|
defaultKeys,
|
|
66202
66275
|
types: types4 = {},
|
|
66203
66276
|
logLevel,
|
|
@@ -66231,6 +66304,7 @@ var Config = class {
|
|
|
66231
66304
|
this.defaultPartial = defaultPartial;
|
|
66232
66305
|
this.internalListPosition = defaultListPosition === "append" ? "last" : "first";
|
|
66233
66306
|
this.defaultListTarget = defaultListTarget;
|
|
66307
|
+
this.defaultPaginateMode = defaultPaginateMode;
|
|
66234
66308
|
this.definitionsFolder = definitionsPath;
|
|
66235
66309
|
this.logLevel = (logLevel || LogLevel.Summary).toLowerCase();
|
|
66236
66310
|
this.defaultFragmentMasking = defaultFragmentMasking;
|
|
@@ -66494,7 +66568,7 @@ var Config = class {
|
|
|
66494
66568
|
get listAllListsDirective() {
|
|
66495
66569
|
return "allLists";
|
|
66496
66570
|
}
|
|
66497
|
-
get
|
|
66571
|
+
get listOrPaginateNameArg() {
|
|
66498
66572
|
return "name";
|
|
66499
66573
|
}
|
|
66500
66574
|
get insertFragmentSuffix() {
|
|
@@ -66527,8 +66601,8 @@ var Config = class {
|
|
|
66527
66601
|
get paginateDirective() {
|
|
66528
66602
|
return "paginate";
|
|
66529
66603
|
}
|
|
66530
|
-
get
|
|
66531
|
-
return "
|
|
66604
|
+
get paginateModeArg() {
|
|
66605
|
+
return "mode";
|
|
66532
66606
|
}
|
|
66533
66607
|
get cacheDirective() {
|
|
66534
66608
|
return "cache";
|
|
@@ -66570,7 +66644,7 @@ var Config = class {
|
|
|
66570
66644
|
return name + this.removeFragmentSuffix;
|
|
66571
66645
|
}
|
|
66572
66646
|
isInternalEnum(node) {
|
|
66573
|
-
return node.name.value === "CachePolicy";
|
|
66647
|
+
return node.name.value === "CachePolicy" || node.name.value === "PaginateMode";
|
|
66574
66648
|
}
|
|
66575
66649
|
isInternalDirective(name) {
|
|
66576
66650
|
const internalDirectives = this.#newSchemaInstance?.getDirectives().reduce((list, directive) => {
|
|
@@ -67112,6 +67186,57 @@ function deepMerge(filepath, ...targets) {
|
|
|
67112
67186
|
}
|
|
67113
67187
|
}
|
|
67114
67188
|
|
|
67189
|
+
// src/lib/detectTools.ts
|
|
67190
|
+
async function detectFromPackageJSON(cwd) {
|
|
67191
|
+
try {
|
|
67192
|
+
const packageJSONFile = await fs_exports.readFile(path_exports.join(cwd, "package.json"));
|
|
67193
|
+
if (packageJSONFile) {
|
|
67194
|
+
var packageJSON = JSON.parse(packageJSONFile);
|
|
67195
|
+
} else {
|
|
67196
|
+
throw new Error("not found");
|
|
67197
|
+
}
|
|
67198
|
+
} catch {
|
|
67199
|
+
throw new Error(
|
|
67200
|
+
"\u274C houdini init must target an existing node project (with a package.json)"
|
|
67201
|
+
);
|
|
67202
|
+
}
|
|
67203
|
+
const { devDependencies, dependencies } = packageJSON;
|
|
67204
|
+
const hasDependency = (dep) => Boolean(devDependencies?.[dep] || dependencies?.[dep]);
|
|
67205
|
+
let framework = "svelte";
|
|
67206
|
+
if (hasDependency("@sveltejs/kit")) {
|
|
67207
|
+
framework = "kit";
|
|
67208
|
+
}
|
|
67209
|
+
return {
|
|
67210
|
+
framework,
|
|
67211
|
+
module: packageJSON["type"] === "module" ? "esm" : "commonjs"
|
|
67212
|
+
};
|
|
67213
|
+
}
|
|
67214
|
+
async function detectTools(cwd) {
|
|
67215
|
+
let typescript = false;
|
|
67216
|
+
try {
|
|
67217
|
+
await fs_exports.stat(path_exports.join(cwd, "tsconfig.json"));
|
|
67218
|
+
typescript = true;
|
|
67219
|
+
} catch {
|
|
67220
|
+
}
|
|
67221
|
+
let package_manager = "npm";
|
|
67222
|
+
let dir = cwd;
|
|
67223
|
+
do {
|
|
67224
|
+
if (fs_exports.existsSync(path_exports.join(dir, "pnpm-lock.yaml"))) {
|
|
67225
|
+
package_manager = "pnpm";
|
|
67226
|
+
break;
|
|
67227
|
+
}
|
|
67228
|
+
if (fs_exports.existsSync(path_exports.join(dir, "yarn.lock"))) {
|
|
67229
|
+
package_manager = "yarn";
|
|
67230
|
+
break;
|
|
67231
|
+
}
|
|
67232
|
+
} while (dir !== (dir = path_exports.dirname(dir)));
|
|
67233
|
+
return {
|
|
67234
|
+
typescript,
|
|
67235
|
+
package_manager,
|
|
67236
|
+
...await detectFromPackageJSON(cwd)
|
|
67237
|
+
};
|
|
67238
|
+
}
|
|
67239
|
+
|
|
67115
67240
|
// ../../node_modules/.pnpm/estree-walker@3.0.1/node_modules/estree-walker/src/walker.js
|
|
67116
67241
|
var WalkerBase = class {
|
|
67117
67242
|
constructor() {
|
|
@@ -67308,6 +67433,7 @@ export {
|
|
|
67308
67433
|
HoudiniClient,
|
|
67309
67434
|
HoudiniError,
|
|
67310
67435
|
LogLevel,
|
|
67436
|
+
PaginateMode,
|
|
67311
67437
|
RefetchUpdateMode,
|
|
67312
67438
|
TypeWrapper,
|
|
67313
67439
|
cleanupFiles,
|
|
@@ -67316,6 +67442,8 @@ export {
|
|
|
67316
67442
|
deepMerge,
|
|
67317
67443
|
defaultConfigValues,
|
|
67318
67444
|
definitionFromAncestors,
|
|
67445
|
+
detectFromPackageJSON,
|
|
67446
|
+
detectTools,
|
|
67319
67447
|
ensureArtifactImport,
|
|
67320
67448
|
ensureImports,
|
|
67321
67449
|
fetch2 as fetch,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { QueryResult } from '../../lib';
|
|
2
|
-
import type { ClientPlugin } from '../documentStore';
|
|
2
|
+
import type { ClientPlugin, ClientPluginContext } from '../documentStore';
|
|
3
3
|
export type ThrowOnErrorParams = {
|
|
4
4
|
operations: ('all' | 'query' | 'mutation' | 'subscription')[];
|
|
5
|
-
error?: (errors: NonNullable<QueryResult<any, any>['errors']
|
|
5
|
+
error?: (errors: NonNullable<QueryResult<any, any>['errors']>, ctx: ClientPluginContext) => unknown;
|
|
6
6
|
};
|
|
7
7
|
export declare const throwOnError: ({ operations, error }: ThrowOnErrorParams) => ClientPlugin;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GraphQLSchema } from 'graphql';
|
|
2
|
-
import type { CachePolicies } from './types';
|
|
2
|
+
import type { CachePolicies, PaginateModes } from './types';
|
|
3
3
|
export declare function getMockConfig(): ConfigFile | null;
|
|
4
4
|
export declare function setMockConfig(config: ConfigFile | null): void;
|
|
5
5
|
export declare function defaultConfigValues(file: ConfigFile): ConfigFile;
|
|
@@ -67,6 +67,10 @@ export type ConfigFile = {
|
|
|
67
67
|
* Specifies whether mutation should apply a specific target list. When you set `all`, it's like adding the directive `@allLists` to all _insert fragment (default: `null`)
|
|
68
68
|
*/
|
|
69
69
|
defaultListTarget?: 'all' | null;
|
|
70
|
+
/**
|
|
71
|
+
* Specifies whether the default paginate mode is Infinite or SinglePage. (default: `Infinite`)
|
|
72
|
+
*/
|
|
73
|
+
defaultPaginateMode?: PaginateModes;
|
|
70
74
|
/**
|
|
71
75
|
* A list of fields to use when computing a record’s id. The default value is ['id']. For more information: https://www.houdinigraphql.com/guides/caching-data#custom-ids
|
|
72
76
|
*/
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
type ValuesOf<Target> = Target[keyof Target];
|
|
1
2
|
export declare const CachePolicy: {
|
|
2
3
|
readonly CacheOrNetwork: "CacheOrNetwork";
|
|
3
4
|
readonly CacheOnly: "CacheOnly";
|
|
4
5
|
readonly NetworkOnly: "NetworkOnly";
|
|
5
6
|
readonly CacheAndNetwork: "CacheAndNetwork";
|
|
6
7
|
};
|
|
7
|
-
type ValuesOf<Target> = Target[keyof Target];
|
|
8
8
|
export type CachePolicies = ValuesOf<typeof CachePolicy>;
|
|
9
|
+
export declare const PaginateMode: {
|
|
10
|
+
readonly Infinite: "Infinite";
|
|
11
|
+
readonly SinglePage: "SinglePage";
|
|
12
|
+
};
|
|
13
|
+
export type PaginateModes = ValuesOf<typeof PaginateMode>;
|
|
9
14
|
declare global {
|
|
10
15
|
namespace App {
|
|
11
16
|
interface Session {
|
|
@@ -77,6 +82,7 @@ export type BaseCompiledDocument<_Kind extends ArtifactKinds> = {
|
|
|
77
82
|
targetType: string;
|
|
78
83
|
paginated: boolean;
|
|
79
84
|
direction: 'forward' | 'backward' | 'both';
|
|
85
|
+
mode: PaginateModes;
|
|
80
86
|
};
|
|
81
87
|
pluginData?: Record<string, any>;
|
|
82
88
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { QueryResult } from '../../lib';
|
|
2
|
-
import type { ClientPlugin } from '../documentStore';
|
|
2
|
+
import type { ClientPlugin, ClientPluginContext } from '../documentStore';
|
|
3
3
|
export type ThrowOnErrorParams = {
|
|
4
4
|
operations: ('all' | 'query' | 'mutation' | 'subscription')[];
|
|
5
|
-
error?: (errors: NonNullable<QueryResult<any, any>['errors']
|
|
5
|
+
error?: (errors: NonNullable<QueryResult<any, any>['errors']>, ctx: ClientPluginContext) => unknown;
|
|
6
6
|
};
|
|
7
7
|
export declare const throwOnError: ({ operations, error }: ThrowOnErrorParams) => ClientPlugin;
|
|
@@ -33,7 +33,7 @@ const throwOnError = ({ operations, error }) => () => {
|
|
|
33
33
|
return {
|
|
34
34
|
async end(ctx, { value, resolve }) {
|
|
35
35
|
if (value.errors && value.errors.length > 0 && throwOnKind(ctx.artifact.kind)) {
|
|
36
|
-
const result = await (error ?? defaultErrorFn)(value.errors);
|
|
36
|
+
const result = await (error ?? defaultErrorFn)(value.errors, ctx);
|
|
37
37
|
throw result;
|
|
38
38
|
}
|
|
39
39
|
resolve(ctx);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GraphQLSchema } from 'graphql';
|
|
2
|
-
import type { CachePolicies } from './types';
|
|
2
|
+
import type { CachePolicies, PaginateModes } from './types';
|
|
3
3
|
export declare function getMockConfig(): ConfigFile | null;
|
|
4
4
|
export declare function setMockConfig(config: ConfigFile | null): void;
|
|
5
5
|
export declare function defaultConfigValues(file: ConfigFile): ConfigFile;
|
|
@@ -67,6 +67,10 @@ export type ConfigFile = {
|
|
|
67
67
|
* Specifies whether mutation should apply a specific target list. When you set `all`, it's like adding the directive `@allLists` to all _insert fragment (default: `null`)
|
|
68
68
|
*/
|
|
69
69
|
defaultListTarget?: 'all' | null;
|
|
70
|
+
/**
|
|
71
|
+
* Specifies whether the default paginate mode is Infinite or SinglePage. (default: `Infinite`)
|
|
72
|
+
*/
|
|
73
|
+
defaultPaginateMode?: PaginateModes;
|
|
70
74
|
/**
|
|
71
75
|
* A list of fields to use when computing a record’s id. The default value is ['id']. For more information: https://www.houdinigraphql.com/guides/caching-data#custom-ids
|
|
72
76
|
*/
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
type ValuesOf<Target> = Target[keyof Target];
|
|
1
2
|
export declare const CachePolicy: {
|
|
2
3
|
readonly CacheOrNetwork: "CacheOrNetwork";
|
|
3
4
|
readonly CacheOnly: "CacheOnly";
|
|
4
5
|
readonly NetworkOnly: "NetworkOnly";
|
|
5
6
|
readonly CacheAndNetwork: "CacheAndNetwork";
|
|
6
7
|
};
|
|
7
|
-
type ValuesOf<Target> = Target[keyof Target];
|
|
8
8
|
export type CachePolicies = ValuesOf<typeof CachePolicy>;
|
|
9
|
+
export declare const PaginateMode: {
|
|
10
|
+
readonly Infinite: "Infinite";
|
|
11
|
+
readonly SinglePage: "SinglePage";
|
|
12
|
+
};
|
|
13
|
+
export type PaginateModes = ValuesOf<typeof PaginateMode>;
|
|
9
14
|
declare global {
|
|
10
15
|
namespace App {
|
|
11
16
|
interface Session {
|
|
@@ -77,6 +82,7 @@ export type BaseCompiledDocument<_Kind extends ArtifactKinds> = {
|
|
|
77
82
|
targetType: string;
|
|
78
83
|
paginated: boolean;
|
|
79
84
|
direction: 'forward' | 'backward' | 'both';
|
|
85
|
+
mode: PaginateModes;
|
|
80
86
|
};
|
|
81
87
|
pluginData?: Record<string, any>;
|
|
82
88
|
};
|
|
@@ -25,6 +25,7 @@ __export(types_exports, {
|
|
|
25
25
|
CompiledQueryKind: () => CompiledQueryKind,
|
|
26
26
|
CompiledSubscriptionKind: () => CompiledSubscriptionKind,
|
|
27
27
|
DataSource: () => DataSource,
|
|
28
|
+
PaginateMode: () => PaginateMode,
|
|
28
29
|
RefetchUpdateMode: () => RefetchUpdateMode
|
|
29
30
|
});
|
|
30
31
|
module.exports = __toCommonJS(types_exports);
|
|
@@ -34,6 +35,10 @@ const CachePolicy = {
|
|
|
34
35
|
NetworkOnly: "NetworkOnly",
|
|
35
36
|
CacheAndNetwork: "CacheAndNetwork"
|
|
36
37
|
};
|
|
38
|
+
const PaginateMode = {
|
|
39
|
+
Infinite: "Infinite",
|
|
40
|
+
SinglePage: "SinglePage"
|
|
41
|
+
};
|
|
37
42
|
const ArtifactKind = {
|
|
38
43
|
Query: "HoudiniQuery",
|
|
39
44
|
Subscription: "HoudiniSubscription",
|
|
@@ -63,5 +68,6 @@ const DataSource = {
|
|
|
63
68
|
CompiledQueryKind,
|
|
64
69
|
CompiledSubscriptionKind,
|
|
65
70
|
DataSource,
|
|
71
|
+
PaginateMode,
|
|
66
72
|
RefetchUpdateMode
|
|
67
73
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { QueryResult } from '../../lib';
|
|
2
|
-
import type { ClientPlugin } from '../documentStore';
|
|
2
|
+
import type { ClientPlugin, ClientPluginContext } from '../documentStore';
|
|
3
3
|
export type ThrowOnErrorParams = {
|
|
4
4
|
operations: ('all' | 'query' | 'mutation' | 'subscription')[];
|
|
5
|
-
error?: (errors: NonNullable<QueryResult<any, any>['errors']
|
|
5
|
+
error?: (errors: NonNullable<QueryResult<any, any>['errors']>, ctx: ClientPluginContext) => unknown;
|
|
6
6
|
};
|
|
7
7
|
export declare const throwOnError: ({ operations, error }: ThrowOnErrorParams) => ClientPlugin;
|