houdini 1.0.0-next.7 → 1.0.0-next.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 +45 -46
- package/build/cmd-esm/index.js +18 -19
- package/build/codegen-cjs/index.js +19 -19
- package/build/codegen-esm/index.js +6 -6
- 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 +5 -4
- package/build/runtime/client/plugins/injectedPlugins.d.ts +2 -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 +1 -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 +3 -3
- package/build/runtime-cjs/client/index.d.ts +5 -4
- package/build/runtime-cjs/client/index.js +37 -11
- package/build/runtime-cjs/client/plugins/injectedPlugins.d.ts +2 -1
- 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 +1 -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 +3 -3
- package/build/runtime-esm/client/index.d.ts +5 -4
- package/build/runtime-esm/client/index.js +36 -11
- package/build/runtime-esm/client/plugins/injectedPlugins.d.ts +2 -1
- 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 +1 -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 +19 -19
- package/build/test-esm/index.js +6 -6
- package/build/vite-cjs/index.js +42 -38
- package/build/vite-esm/index.js +16 -12
- package/package.json +4 -4
package/build/lib-cjs/index.js
CHANGED
|
@@ -61562,7 +61562,7 @@ function mergeSchemas(config) {
|
|
|
61562
61562
|
// src/lib/config.ts
|
|
61563
61563
|
var graphql2 = __toESM(require_graphql2(), 1);
|
|
61564
61564
|
var import_minimatch = __toESM(require_minimatch(), 1);
|
|
61565
|
-
var
|
|
61565
|
+
var import_node_url2 = require("node:url");
|
|
61566
61566
|
|
|
61567
61567
|
// src/runtime/imports/config.ts
|
|
61568
61568
|
var config_default = {};
|
|
@@ -61708,10 +61708,10 @@ __export(fs_exports, {
|
|
|
61708
61708
|
writeFile: () => writeFile
|
|
61709
61709
|
});
|
|
61710
61710
|
var import_fs_extra = __toESM(require_lib(), 1);
|
|
61711
|
-
var import_promises = __toESM(require("fs/promises"), 1);
|
|
61712
61711
|
var import_glob = __toESM(require_glob(), 1);
|
|
61713
61712
|
var import_memfs = __toESM(require_lib2(), 1);
|
|
61714
|
-
var
|
|
61713
|
+
var import_promises = __toESM(require("node:fs/promises"), 1);
|
|
61714
|
+
var import_node_util = require("node:util");
|
|
61715
61715
|
|
|
61716
61716
|
// src/lib/path.ts
|
|
61717
61717
|
var path_exports = {};
|
|
@@ -61728,36 +61728,36 @@ __export(path_exports, {
|
|
|
61728
61728
|
resolve: () => resolve,
|
|
61729
61729
|
sep: () => sep
|
|
61730
61730
|
});
|
|
61731
|
-
var
|
|
61732
|
-
var
|
|
61731
|
+
var import_node_os = __toESM(require("node:os"), 1);
|
|
61732
|
+
var import_node_path = __toESM(require("node:path"), 1);
|
|
61733
61733
|
var sep = "/";
|
|
61734
61734
|
function resolve(...parts) {
|
|
61735
|
-
return posixify(
|
|
61735
|
+
return posixify(import_node_path.default.resolve(...parts));
|
|
61736
61736
|
}
|
|
61737
61737
|
function join2(...parts) {
|
|
61738
|
-
return posixify(
|
|
61738
|
+
return posixify(import_node_path.default.join(...parts));
|
|
61739
61739
|
}
|
|
61740
61740
|
function extname(target) {
|
|
61741
|
-
return
|
|
61741
|
+
return import_node_path.default.extname(target);
|
|
61742
61742
|
}
|
|
61743
61743
|
function relative(from, to) {
|
|
61744
|
-
return posixify(
|
|
61744
|
+
return posixify(import_node_path.default.relative(from, to));
|
|
61745
61745
|
}
|
|
61746
61746
|
function basename(target) {
|
|
61747
|
-
return
|
|
61747
|
+
return import_node_path.default.basename(target);
|
|
61748
61748
|
}
|
|
61749
61749
|
function dirname(target) {
|
|
61750
|
-
return
|
|
61750
|
+
return import_node_path.default.dirname(target);
|
|
61751
61751
|
}
|
|
61752
61752
|
function isAbsolute(target) {
|
|
61753
|
-
return
|
|
61753
|
+
return import_node_path.default.isAbsolute(target);
|
|
61754
61754
|
}
|
|
61755
61755
|
function parse2(target) {
|
|
61756
|
-
return
|
|
61756
|
+
return import_node_path.default.parse(target);
|
|
61757
61757
|
}
|
|
61758
61758
|
var posixify = (str) => str.replace(/\\/g, "/");
|
|
61759
61759
|
function importPath(target) {
|
|
61760
|
-
return ["win32", "win64"].includes(
|
|
61760
|
+
return ["win32", "win64"].includes(import_node_os.default.platform()) ? "file:///" + target : target;
|
|
61761
61761
|
}
|
|
61762
61762
|
|
|
61763
61763
|
// src/lib/fs.ts
|
|
@@ -61881,7 +61881,7 @@ async function rmdir(filepath) {
|
|
|
61881
61881
|
recursive: true
|
|
61882
61882
|
});
|
|
61883
61883
|
}
|
|
61884
|
-
return await (0,
|
|
61884
|
+
return await (0, import_node_util.promisify)(import_memfs.fs.rmdir)(filepath);
|
|
61885
61885
|
}
|
|
61886
61886
|
async function stat(filepath) {
|
|
61887
61887
|
if (!houdini_mode.is_testing) {
|
|
@@ -61959,7 +61959,7 @@ async function recursiveCopy(source, target, transforms, notRoot) {
|
|
|
61959
61959
|
}
|
|
61960
61960
|
}
|
|
61961
61961
|
async function glob(pattern) {
|
|
61962
|
-
return await (0,
|
|
61962
|
+
return await (0, import_node_util.promisify)(import_glob.glob)(posixify(pattern));
|
|
61963
61963
|
}
|
|
61964
61964
|
glob.hasMagic = import_glob.glob.hasMagic;
|
|
61965
61965
|
|
|
@@ -62014,7 +62014,7 @@ var dist_default = dataUriToBuffer;
|
|
|
62014
62014
|
|
|
62015
62015
|
// ../../node_modules/.pnpm/node-fetch@3.3.0/node_modules/node-fetch/src/body.js
|
|
62016
62016
|
var import_node_stream = __toESM(require("node:stream"), 1);
|
|
62017
|
-
var
|
|
62017
|
+
var import_node_util2 = require("node:util");
|
|
62018
62018
|
var import_node_buffer = require("node:buffer");
|
|
62019
62019
|
init_fetch_blob();
|
|
62020
62020
|
init_esm_min();
|
|
@@ -62068,7 +62068,7 @@ var isSameProtocol = (destination, original) => {
|
|
|
62068
62068
|
};
|
|
62069
62069
|
|
|
62070
62070
|
// ../../node_modules/.pnpm/node-fetch@3.3.0/node_modules/node-fetch/src/body.js
|
|
62071
|
-
var pipeline = (0,
|
|
62071
|
+
var pipeline = (0, import_node_util2.promisify)(import_node_stream.default.pipeline);
|
|
62072
62072
|
var INTERNALS = Symbol("Body internals");
|
|
62073
62073
|
var Body = class {
|
|
62074
62074
|
constructor(body, {
|
|
@@ -62081,7 +62081,7 @@ var Body = class {
|
|
|
62081
62081
|
body = import_node_buffer.Buffer.from(body.toString());
|
|
62082
62082
|
} else if (isBlob(body)) {
|
|
62083
62083
|
} else if (import_node_buffer.Buffer.isBuffer(body)) {
|
|
62084
|
-
} else if (
|
|
62084
|
+
} else if (import_node_util2.types.isAnyArrayBuffer(body)) {
|
|
62085
62085
|
body = import_node_buffer.Buffer.from(body);
|
|
62086
62086
|
} else if (ArrayBuffer.isView(body)) {
|
|
62087
62087
|
body = import_node_buffer.Buffer.from(body.buffer, body.byteOffset, body.byteLength);
|
|
@@ -62155,7 +62155,7 @@ var Body = class {
|
|
|
62155
62155
|
return consumeBody(this);
|
|
62156
62156
|
}
|
|
62157
62157
|
};
|
|
62158
|
-
Body.prototype.buffer = (0,
|
|
62158
|
+
Body.prototype.buffer = (0, import_node_util2.deprecate)(Body.prototype.buffer, "Please use 'response.arrayBuffer()' instead of 'response.buffer()'", "node-fetch#buffer");
|
|
62159
62159
|
Object.defineProperties(Body.prototype, {
|
|
62160
62160
|
body: { enumerable: true },
|
|
62161
62161
|
bodyUsed: { enumerable: true },
|
|
@@ -62163,7 +62163,7 @@ Object.defineProperties(Body.prototype, {
|
|
|
62163
62163
|
blob: { enumerable: true },
|
|
62164
62164
|
json: { enumerable: true },
|
|
62165
62165
|
text: { enumerable: true },
|
|
62166
|
-
data: { get: (0,
|
|
62166
|
+
data: { get: (0, import_node_util2.deprecate)(
|
|
62167
62167
|
() => {
|
|
62168
62168
|
},
|
|
62169
62169
|
"data doesn't exist, use json(), text(), arrayBuffer(), or body instead",
|
|
@@ -62231,7 +62231,7 @@ var clone = (instance, highWaterMark) => {
|
|
|
62231
62231
|
}
|
|
62232
62232
|
return body;
|
|
62233
62233
|
};
|
|
62234
|
-
var getNonSpecFormDataBoundary = (0,
|
|
62234
|
+
var getNonSpecFormDataBoundary = (0, import_node_util2.deprecate)(
|
|
62235
62235
|
(body) => body.getBoundary(),
|
|
62236
62236
|
"form-data doesn't follow the spec and requires special treatment. Use alternative package",
|
|
62237
62237
|
"https://github.com/node-fetch/node-fetch/issues/1167"
|
|
@@ -62249,7 +62249,7 @@ var extractContentType = (body, request) => {
|
|
|
62249
62249
|
if (isBlob(body)) {
|
|
62250
62250
|
return body.type || null;
|
|
62251
62251
|
}
|
|
62252
|
-
if (import_node_buffer.Buffer.isBuffer(body) ||
|
|
62252
|
+
if (import_node_buffer.Buffer.isBuffer(body) || import_node_util2.types.isAnyArrayBuffer(body) || ArrayBuffer.isView(body)) {
|
|
62253
62253
|
return null;
|
|
62254
62254
|
}
|
|
62255
62255
|
if (body instanceof FormData) {
|
|
@@ -62288,7 +62288,7 @@ var writeToStream = async (dest, { body }) => {
|
|
|
62288
62288
|
};
|
|
62289
62289
|
|
|
62290
62290
|
// ../../node_modules/.pnpm/node-fetch@3.3.0/node_modules/node-fetch/src/headers.js
|
|
62291
|
-
var
|
|
62291
|
+
var import_node_util3 = require("node:util");
|
|
62292
62292
|
var import_node_http = __toESM(require("node:http"), 1);
|
|
62293
62293
|
var validateHeaderName = typeof import_node_http.default.validateHeaderName === "function" ? import_node_http.default.validateHeaderName : (name) => {
|
|
62294
62294
|
if (!/^[\^`\-\w!#$%&'*+.|~]+$/.test(name)) {
|
|
@@ -62313,7 +62313,7 @@ var Headers = class extends URLSearchParams {
|
|
|
62313
62313
|
result.push(...values.map((value) => [name, value]));
|
|
62314
62314
|
}
|
|
62315
62315
|
} else if (init == null) {
|
|
62316
|
-
} else if (typeof init === "object" && !
|
|
62316
|
+
} else if (typeof init === "object" && !import_node_util3.types.isBoxedPrimitive(init)) {
|
|
62317
62317
|
const method = init[Symbol.iterator];
|
|
62318
62318
|
if (method == null) {
|
|
62319
62319
|
result.push(...Object.entries(init));
|
|
@@ -62322,7 +62322,7 @@ var Headers = class extends URLSearchParams {
|
|
|
62322
62322
|
throw new TypeError("Header pairs must be iterable");
|
|
62323
62323
|
}
|
|
62324
62324
|
result = [...init].map((pair) => {
|
|
62325
|
-
if (typeof pair !== "object" ||
|
|
62325
|
+
if (typeof pair !== "object" || import_node_util3.types.isBoxedPrimitive(pair)) {
|
|
62326
62326
|
throw new TypeError("Each header pair must be an iterable object");
|
|
62327
62327
|
}
|
|
62328
62328
|
return [...pair];
|
|
@@ -62569,7 +62569,7 @@ Object.defineProperties(Response.prototype, {
|
|
|
62569
62569
|
|
|
62570
62570
|
// ../../node_modules/.pnpm/node-fetch@3.3.0/node_modules/node-fetch/src/request.js
|
|
62571
62571
|
var import_node_url = require("node:url");
|
|
62572
|
-
var
|
|
62572
|
+
var import_node_util4 = require("node:util");
|
|
62573
62573
|
|
|
62574
62574
|
// ../../node_modules/.pnpm/node-fetch@3.3.0/node_modules/node-fetch/src/utils/get-search.js
|
|
62575
62575
|
var getSearch = (parsedURL) => {
|
|
@@ -62726,7 +62726,7 @@ var INTERNALS3 = Symbol("Request internals");
|
|
|
62726
62726
|
var isRequest = (object) => {
|
|
62727
62727
|
return typeof object === "object" && typeof object[INTERNALS3] === "object";
|
|
62728
62728
|
};
|
|
62729
|
-
var doBadDataWarn = (0,
|
|
62729
|
+
var doBadDataWarn = (0, import_node_util4.deprecate)(
|
|
62730
62730
|
() => {
|
|
62731
62731
|
},
|
|
62732
62732
|
".data is not a valid RequestInit property, use .body instead",
|
|
@@ -63230,7 +63230,7 @@ var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
|
|
|
63230
63230
|
|
|
63231
63231
|
// src/lib/config.ts
|
|
63232
63232
|
var import_meta = {};
|
|
63233
|
-
var currentDir = global.__dirname || dirname((0,
|
|
63233
|
+
var currentDir = global.__dirname || dirname((0, import_node_url2.fileURLToPath)(import_meta.url));
|
|
63234
63234
|
var Config = class {
|
|
63235
63235
|
filepath;
|
|
63236
63236
|
rootDir;
|
|
@@ -63721,13 +63721,16 @@ var pendingConfigPromise = null;
|
|
|
63721
63721
|
async function getConfig({
|
|
63722
63722
|
configPath = DEFAULT_CONFIG_PATH,
|
|
63723
63723
|
noSchema,
|
|
63724
|
+
forceReload,
|
|
63724
63725
|
...extraConfig
|
|
63725
63726
|
} = {}) {
|
|
63726
|
-
if (
|
|
63727
|
-
|
|
63728
|
-
|
|
63729
|
-
|
|
63730
|
-
|
|
63727
|
+
if (!forceReload) {
|
|
63728
|
+
if (_config) {
|
|
63729
|
+
return _config;
|
|
63730
|
+
}
|
|
63731
|
+
if (pendingConfigPromise) {
|
|
63732
|
+
return await pendingConfigPromise;
|
|
63733
|
+
}
|
|
63731
63734
|
}
|
|
63732
63735
|
let resolve2 = () => {
|
|
63733
63736
|
};
|
|
@@ -63745,7 +63748,7 @@ async function getConfig({
|
|
|
63745
63748
|
if (!pluginName.startsWith(".")) {
|
|
63746
63749
|
pluginFile = await pluginPath(pluginName, configPath);
|
|
63747
63750
|
}
|
|
63748
|
-
const { default: pluginInit } = await import((0,
|
|
63751
|
+
const { default: pluginInit } = await import((0, import_node_url2.pathToFileURL)(pluginFile).toString());
|
|
63749
63752
|
if (!pluginInit.plugin || !pluginInit.name) {
|
|
63750
63753
|
throw new HoudiniError({
|
|
63751
63754
|
filepath: pluginFile,
|
|
@@ -63922,8 +63925,8 @@ async function loadSchemaFile(schemaPath) {
|
|
|
63922
63925
|
}
|
|
63923
63926
|
|
|
63924
63927
|
// src/lib/graphql.ts
|
|
63925
|
-
var import_crypto = __toESM(require("crypto"), 1);
|
|
63926
63928
|
var graphql3 = __toESM(require_graphql2(), 1);
|
|
63929
|
+
var import_node_crypto = __toESM(require("node:crypto"), 1);
|
|
63927
63930
|
function getRootType(type) {
|
|
63928
63931
|
if (graphql3.isNonNullType(type)) {
|
|
63929
63932
|
return getRootType(type.ofType);
|
|
@@ -63937,7 +63940,7 @@ function hashDocument({
|
|
|
63937
63940
|
document
|
|
63938
63941
|
}) {
|
|
63939
63942
|
const docString = typeof document === "string" ? document : document.artifact?.raw;
|
|
63940
|
-
return
|
|
63943
|
+
return import_node_crypto.default.createHash("sha256").update(docString ?? "").digest("hex");
|
|
63941
63944
|
}
|
|
63942
63945
|
function parentTypeFromAncestors(schema, filepath, ancestors) {
|
|
63943
63946
|
const parents = [...ancestors];
|
package/build/lib-esm/index.js
CHANGED
|
@@ -61518,7 +61518,7 @@ function mergeSchemas(config) {
|
|
|
61518
61518
|
// src/lib/config.ts
|
|
61519
61519
|
var graphql2 = __toESM(require_graphql2(), 1);
|
|
61520
61520
|
var import_minimatch = __toESM(require_minimatch(), 1);
|
|
61521
|
-
import { fileURLToPath, pathToFileURL } from "url";
|
|
61521
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
61522
61522
|
|
|
61523
61523
|
// src/runtime/imports/config.ts
|
|
61524
61524
|
var config_default = {};
|
|
@@ -61666,8 +61666,8 @@ __export(fs_exports, {
|
|
|
61666
61666
|
var import_fs_extra = __toESM(require_lib(), 1);
|
|
61667
61667
|
var import_glob = __toESM(require_glob(), 1);
|
|
61668
61668
|
var import_memfs = __toESM(require_lib2(), 1);
|
|
61669
|
-
import fs from "fs/promises";
|
|
61670
|
-
import { promisify } from "util";
|
|
61669
|
+
import fs from "node:fs/promises";
|
|
61670
|
+
import { promisify } from "node:util";
|
|
61671
61671
|
|
|
61672
61672
|
// src/lib/path.ts
|
|
61673
61673
|
var path_exports = {};
|
|
@@ -61684,8 +61684,8 @@ __export(path_exports, {
|
|
|
61684
61684
|
resolve: () => resolve,
|
|
61685
61685
|
sep: () => sep
|
|
61686
61686
|
});
|
|
61687
|
-
import os from "os";
|
|
61688
|
-
import path from "path";
|
|
61687
|
+
import os from "node:os";
|
|
61688
|
+
import path from "node:path";
|
|
61689
61689
|
var sep = "/";
|
|
61690
61690
|
function resolve(...parts) {
|
|
61691
61691
|
return posixify(path.resolve(...parts));
|
|
@@ -63676,13 +63676,16 @@ var pendingConfigPromise = null;
|
|
|
63676
63676
|
async function getConfig({
|
|
63677
63677
|
configPath = DEFAULT_CONFIG_PATH,
|
|
63678
63678
|
noSchema,
|
|
63679
|
+
forceReload,
|
|
63679
63680
|
...extraConfig
|
|
63680
63681
|
} = {}) {
|
|
63681
|
-
if (
|
|
63682
|
-
|
|
63683
|
-
|
|
63684
|
-
|
|
63685
|
-
|
|
63682
|
+
if (!forceReload) {
|
|
63683
|
+
if (_config) {
|
|
63684
|
+
return _config;
|
|
63685
|
+
}
|
|
63686
|
+
if (pendingConfigPromise) {
|
|
63687
|
+
return await pendingConfigPromise;
|
|
63688
|
+
}
|
|
63686
63689
|
}
|
|
63687
63690
|
let resolve2 = () => {
|
|
63688
63691
|
};
|
|
@@ -63878,7 +63881,7 @@ async function loadSchemaFile(schemaPath) {
|
|
|
63878
63881
|
|
|
63879
63882
|
// src/lib/graphql.ts
|
|
63880
63883
|
var graphql3 = __toESM(require_graphql2(), 1);
|
|
63881
|
-
import crypto from "crypto";
|
|
63884
|
+
import crypto from "node:crypto";
|
|
63882
63885
|
function getRootType(type) {
|
|
63883
63886
|
if (graphql3.isNonNullType(type)) {
|
|
63884
63887
|
return getRootType(type.ofType);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ConfigFile } from '../lib/config';
|
|
2
|
-
import type { GraphQLObject, GraphQLValue, SubscriptionSelection, SubscriptionSpec } from '../lib/types';
|
|
2
|
+
import type { GraphQLObject, GraphQLValue, NestedList, SubscriptionSelection, SubscriptionSpec } from '../lib/types';
|
|
3
3
|
import { GarbageCollector } from './gc';
|
|
4
4
|
import type { ListCollection } from './lists';
|
|
5
5
|
import { ListManager } from './lists';
|
|
@@ -34,7 +34,8 @@ export declare class Cache {
|
|
|
34
34
|
list(name: string, parentID?: string, allLists?: boolean): ListCollection;
|
|
35
35
|
delete(id: string): void;
|
|
36
36
|
setConfig(config: ConfigFile): void;
|
|
37
|
-
markTypeStale(
|
|
37
|
+
markTypeStale(options?: {
|
|
38
|
+
type: string;
|
|
38
39
|
field?: string;
|
|
39
40
|
when?: {};
|
|
40
41
|
}): void;
|
|
@@ -98,10 +99,10 @@ declare class CacheInternal {
|
|
|
98
99
|
hydrateNestedList({ fields, variables, linkedList, stepsFromConnection, }: {
|
|
99
100
|
fields: SubscriptionSelection;
|
|
100
101
|
variables?: {};
|
|
101
|
-
linkedList:
|
|
102
|
+
linkedList: NestedList;
|
|
102
103
|
stepsFromConnection: number | null;
|
|
103
104
|
}): {
|
|
104
|
-
data:
|
|
105
|
+
data: NestedList<GraphQLValue>;
|
|
105
106
|
partial: boolean;
|
|
106
107
|
stale: boolean;
|
|
107
108
|
hasData: boolean;
|
|
@@ -119,11 +120,10 @@ declare class CacheInternal {
|
|
|
119
120
|
layer: Layer;
|
|
120
121
|
forceNotify?: boolean;
|
|
121
122
|
}): {
|
|
122
|
-
nestedIDs:
|
|
123
|
+
nestedIDs: NestedList;
|
|
123
124
|
newIDs: (string | null)[];
|
|
124
125
|
};
|
|
125
126
|
collectGarbage(): void;
|
|
126
127
|
}
|
|
127
128
|
export declare const rootID = "_ROOT_";
|
|
128
|
-
export type LinkedList<_Result = string> = (_Result | null | LinkedList<_Result>)[];
|
|
129
129
|
export {};
|
|
@@ -21,7 +21,7 @@ export declare class InMemoryStorage {
|
|
|
21
21
|
kind: 'link' | 'scalar' | 'unknown';
|
|
22
22
|
displayLayers: number[];
|
|
23
23
|
};
|
|
24
|
-
writeLink(id: string, field: string, value: string |
|
|
24
|
+
writeLink(id: string, field: string, value: string | NestedList): number;
|
|
25
25
|
writeField(id: string, field: string, value: GraphQLValue): number;
|
|
26
26
|
resolveLayer(id: number): void;
|
|
27
27
|
get topLayer(): Layer;
|
|
@@ -37,7 +37,7 @@ export declare class Layer {
|
|
|
37
37
|
get(id: string, field: string): [GraphQLField, 'link' | 'scalar'];
|
|
38
38
|
getOperations(id: string, field: string): Operation[] | undefined;
|
|
39
39
|
writeField(id: string, field: string, value: GraphQLField): LayerID;
|
|
40
|
-
writeLink(id: string, field: string, value: null | string |
|
|
40
|
+
writeLink(id: string, field: string, value: null | string | NestedList): LayerID;
|
|
41
41
|
isDisplayLayer(displayLayers: number[]): boolean;
|
|
42
42
|
clear(): void;
|
|
43
43
|
replaceID({ from, to }: {
|
|
@@ -52,14 +52,14 @@ export declare class Layer {
|
|
|
52
52
|
writeLayer(layer: Layer): void;
|
|
53
53
|
private addFieldOperation;
|
|
54
54
|
}
|
|
55
|
-
type GraphQLField = GraphQLValue |
|
|
55
|
+
type GraphQLField = GraphQLValue | NestedList;
|
|
56
56
|
type EntityMap<_Value> = {
|
|
57
57
|
[id: string]: {
|
|
58
58
|
[field: string]: _Value;
|
|
59
59
|
};
|
|
60
60
|
};
|
|
61
61
|
type EntityFieldMap = EntityMap<GraphQLField>;
|
|
62
|
-
type LinkMap = EntityMap<string | null |
|
|
62
|
+
type LinkMap = EntityMap<string | null | NestedList>;
|
|
63
63
|
type OperationMap = {
|
|
64
64
|
[id: string]: {
|
|
65
65
|
deleted?: boolean;
|
|
@@ -69,7 +69,7 @@ type OperationMap = {
|
|
|
69
69
|
};
|
|
70
70
|
};
|
|
71
71
|
};
|
|
72
|
-
type
|
|
72
|
+
type NestedList<_Result = string> = (_Result | null | NestedList<_Result>)[];
|
|
73
73
|
type InsertOperation = {
|
|
74
74
|
kind: OperationKind.insert;
|
|
75
75
|
location: OperationLocation;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { GraphQLValue } from '../lib/types';
|
|
2
|
-
import type { LinkedList } from './cache';
|
|
3
|
-
export declare function flattenList<T>(source: LinkedList<T>): T[];
|
|
4
2
|
export declare function evaluateKey(key: string, variables?: {
|
|
5
3
|
[key: string]: GraphQLValue;
|
|
6
4
|
}): string;
|
|
@@ -7,8 +7,8 @@ export declare class DocumentStore<_Data extends GraphQLObject, _Input extends R
|
|
|
7
7
|
#private;
|
|
8
8
|
constructor({ artifact, plugins, pipeline, client, cache, initialValue, fetching, }: {
|
|
9
9
|
artifact: DocumentArtifact;
|
|
10
|
-
plugins?:
|
|
11
|
-
pipeline?:
|
|
10
|
+
plugins?: ClientHooks[];
|
|
11
|
+
pipeline?: ClientHooks[];
|
|
12
12
|
client: HoudiniClient | null;
|
|
13
13
|
cache?: boolean;
|
|
14
14
|
initialValue?: _Data | null;
|
|
@@ -26,7 +26,8 @@ export declare class DocumentStore<_Data extends GraphQLObject, _Input extends R
|
|
|
26
26
|
}): Promise<QueryResult<_Data, _Input>>;
|
|
27
27
|
}
|
|
28
28
|
declare function marshalVariables<_Data extends GraphQLObject, _Input extends {}>(ctx: ClientPluginContext): Record<string, any>;
|
|
29
|
-
export type ClientPlugin = () =>
|
|
29
|
+
export type ClientPlugin = () => ClientHooks | null | (ClientHooks | ClientPlugin | null)[];
|
|
30
|
+
export type ClientHooks = {
|
|
30
31
|
start?: ClientPluginEnterPhase;
|
|
31
32
|
beforeNetwork?: ClientPluginEnterPhase;
|
|
32
33
|
network?: ClientPluginEnterPhase;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference path="../../../../../houdini.d.ts" />
|
|
2
|
-
import type { DocumentArtifact, GraphQLObject } from '../lib/types';
|
|
3
|
-
import type { ClientPlugin } from './documentStore';
|
|
2
|
+
import type { DocumentArtifact, GraphQLObject, NestedList } from '../lib/types';
|
|
3
|
+
import type { ClientPlugin, ClientHooks } from './documentStore';
|
|
4
4
|
import { DocumentStore } from './documentStore';
|
|
5
5
|
import { type FetchParamFn, type ThrowOnErrorParams } from './plugins';
|
|
6
6
|
export { DocumentStore, type ClientPlugin } from './documentStore';
|
|
@@ -8,8 +8,8 @@ export { fetchPlugin, mutationPlugin, queryPlugin, subscriptionPlugin } from './
|
|
|
8
8
|
type ConstructorArgs = {
|
|
9
9
|
url: string;
|
|
10
10
|
fetchParams?: FetchParamFn;
|
|
11
|
-
plugins?: ClientPlugin
|
|
12
|
-
pipeline?: ClientPlugin
|
|
11
|
+
plugins?: NestedList<ClientPlugin>;
|
|
12
|
+
pipeline?: NestedList<ClientPlugin>;
|
|
13
13
|
throwOnError?: ThrowOnErrorParams;
|
|
14
14
|
};
|
|
15
15
|
export type ObserveParams<_Data extends GraphQLObject, _Artifact extends DocumentArtifact = DocumentArtifact> = {
|
|
@@ -24,3 +24,4 @@ export declare class HoudiniClient {
|
|
|
24
24
|
constructor({ url, fetchParams, plugins, pipeline, throwOnError }: ConstructorArgs);
|
|
25
25
|
observe<_Data extends GraphQLObject, _Input extends Record<string, any>>({ artifact, cache, initialValue, fetching, }: ObserveParams<_Data>): DocumentStore<_Data, _Input>;
|
|
26
26
|
}
|
|
27
|
+
export declare function createPluginHooks(plugins: ClientPlugin[]): ClientHooks[];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ArtifactKind } from '../../lib/types';
|
|
2
|
-
import type { ClientPlugin } from '../documentStore';
|
|
3
|
-
export declare const documentPlugin: (kind: ArtifactKind, source:
|
|
2
|
+
import type { ClientPlugin, ClientHooks } from '../documentStore';
|
|
3
|
+
export declare const documentPlugin: (kind: ArtifactKind, source: () => ClientHooks) => ClientPlugin;
|
|
@@ -34,8 +34,7 @@ export declare class Record<Def extends CacheTypeDef, Type extends ValidTypes<De
|
|
|
34
34
|
* @param field
|
|
35
35
|
* @param when
|
|
36
36
|
*/
|
|
37
|
-
markStale<Field extends TypeFieldNames<Def, Type>>(
|
|
38
|
-
field?: Field;
|
|
37
|
+
markStale<Field extends TypeFieldNames<Def, Type>>(field?: Field, { when, }?: {
|
|
39
38
|
when?: ArgType<Def, Type, Field>;
|
|
40
39
|
}): void;
|
|
41
40
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ConfigFile } from '../lib/config';
|
|
2
|
-
import type { GraphQLObject, GraphQLValue, SubscriptionSelection, SubscriptionSpec } from '../lib/types';
|
|
2
|
+
import type { GraphQLObject, GraphQLValue, NestedList, SubscriptionSelection, SubscriptionSpec } from '../lib/types';
|
|
3
3
|
import { GarbageCollector } from './gc';
|
|
4
4
|
import type { ListCollection } from './lists';
|
|
5
5
|
import { ListManager } from './lists';
|
|
@@ -34,7 +34,8 @@ export declare class Cache {
|
|
|
34
34
|
list(name: string, parentID?: string, allLists?: boolean): ListCollection;
|
|
35
35
|
delete(id: string): void;
|
|
36
36
|
setConfig(config: ConfigFile): void;
|
|
37
|
-
markTypeStale(
|
|
37
|
+
markTypeStale(options?: {
|
|
38
|
+
type: string;
|
|
38
39
|
field?: string;
|
|
39
40
|
when?: {};
|
|
40
41
|
}): void;
|
|
@@ -98,10 +99,10 @@ declare class CacheInternal {
|
|
|
98
99
|
hydrateNestedList({ fields, variables, linkedList, stepsFromConnection, }: {
|
|
99
100
|
fields: SubscriptionSelection;
|
|
100
101
|
variables?: {};
|
|
101
|
-
linkedList:
|
|
102
|
+
linkedList: NestedList;
|
|
102
103
|
stepsFromConnection: number | null;
|
|
103
104
|
}): {
|
|
104
|
-
data:
|
|
105
|
+
data: NestedList<GraphQLValue>;
|
|
105
106
|
partial: boolean;
|
|
106
107
|
stale: boolean;
|
|
107
108
|
hasData: boolean;
|
|
@@ -119,11 +120,10 @@ declare class CacheInternal {
|
|
|
119
120
|
layer: Layer;
|
|
120
121
|
forceNotify?: boolean;
|
|
121
122
|
}): {
|
|
122
|
-
nestedIDs:
|
|
123
|
+
nestedIDs: NestedList;
|
|
123
124
|
newIDs: (string | null)[];
|
|
124
125
|
};
|
|
125
126
|
collectGarbage(): void;
|
|
126
127
|
}
|
|
127
128
|
export declare const rootID = "_ROOT_";
|
|
128
|
-
export type LinkedList<_Result = string> = (_Result | null | LinkedList<_Result>)[];
|
|
129
129
|
export {};
|
|
@@ -25,6 +25,7 @@ module.exports = __toCommonJS(cache_exports);
|
|
|
25
25
|
var import_lib = require("../lib");
|
|
26
26
|
var import_config = require("../lib/config");
|
|
27
27
|
var import_deepEquals = require("../lib/deepEquals");
|
|
28
|
+
var import_flatten = require("../lib/flatten");
|
|
28
29
|
var import_selection = require("../lib/selection");
|
|
29
30
|
var import_gc = require("./gc");
|
|
30
31
|
var import_lists = require("./lists");
|
|
@@ -115,14 +116,14 @@ class Cache {
|
|
|
115
116
|
setConfig(config) {
|
|
116
117
|
this._internal_unstable.setConfig(config);
|
|
117
118
|
}
|
|
118
|
-
markTypeStale(
|
|
119
|
-
if (!
|
|
119
|
+
markTypeStale(options) {
|
|
120
|
+
if (!options) {
|
|
120
121
|
this._internal_unstable.staleManager.markAllStale();
|
|
121
122
|
} else if (!options.field) {
|
|
122
|
-
this._internal_unstable.staleManager.markTypeStale(type);
|
|
123
|
+
this._internal_unstable.staleManager.markTypeStale(options.type);
|
|
123
124
|
} else {
|
|
124
125
|
this._internal_unstable.staleManager.markTypeFieldStale(
|
|
125
|
-
type,
|
|
126
|
+
options.type,
|
|
126
127
|
options.field,
|
|
127
128
|
options.when
|
|
128
129
|
);
|
|
@@ -261,7 +262,7 @@ class CacheInternal {
|
|
|
261
262
|
if (previousValue === null) {
|
|
262
263
|
continue;
|
|
263
264
|
}
|
|
264
|
-
const previousLinks = (0,
|
|
265
|
+
const previousLinks = (0, import_flatten.flatten)([previousValue]);
|
|
265
266
|
for (const link of previousLinks) {
|
|
266
267
|
this.subscriptions.remove(link, fieldSelection, specs, variables);
|
|
267
268
|
}
|
|
@@ -23,8 +23,8 @@ __export(lists_exports, {
|
|
|
23
23
|
ListManager: () => ListManager
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(lists_exports);
|
|
26
|
+
var import_flatten = require("../lib/flatten");
|
|
26
27
|
var import_cache = require("./cache");
|
|
27
|
-
var import_stuff = require("./stuff");
|
|
28
28
|
class ListManager {
|
|
29
29
|
rootID;
|
|
30
30
|
cache;
|
|
@@ -258,7 +258,7 @@ class List {
|
|
|
258
258
|
embeddedConnectionID,
|
|
259
259
|
"edges"
|
|
260
260
|
);
|
|
261
|
-
for (const edge of (0,
|
|
261
|
+
for (const edge of (0, import_flatten.flatten)(edges) || []) {
|
|
262
262
|
if (!edge) {
|
|
263
263
|
continue;
|
|
264
264
|
}
|
|
@@ -336,7 +336,7 @@ class List {
|
|
|
336
336
|
let entries = [];
|
|
337
337
|
let value = this.cache._internal_unstable.storage.get(this.recordID, this.key).value;
|
|
338
338
|
if (!this.connection) {
|
|
339
|
-
entries = (0,
|
|
339
|
+
entries = (0, import_flatten.flatten)(value);
|
|
340
340
|
} else {
|
|
341
341
|
entries = this.cache._internal_unstable.storage.get(value, "edges").value;
|
|
342
342
|
}
|
|
@@ -21,7 +21,7 @@ export declare class InMemoryStorage {
|
|
|
21
21
|
kind: 'link' | 'scalar' | 'unknown';
|
|
22
22
|
displayLayers: number[];
|
|
23
23
|
};
|
|
24
|
-
writeLink(id: string, field: string, value: string |
|
|
24
|
+
writeLink(id: string, field: string, value: string | NestedList): number;
|
|
25
25
|
writeField(id: string, field: string, value: GraphQLValue): number;
|
|
26
26
|
resolveLayer(id: number): void;
|
|
27
27
|
get topLayer(): Layer;
|
|
@@ -37,7 +37,7 @@ export declare class Layer {
|
|
|
37
37
|
get(id: string, field: string): [GraphQLField, 'link' | 'scalar'];
|
|
38
38
|
getOperations(id: string, field: string): Operation[] | undefined;
|
|
39
39
|
writeField(id: string, field: string, value: GraphQLField): LayerID;
|
|
40
|
-
writeLink(id: string, field: string, value: null | string |
|
|
40
|
+
writeLink(id: string, field: string, value: null | string | NestedList): LayerID;
|
|
41
41
|
isDisplayLayer(displayLayers: number[]): boolean;
|
|
42
42
|
clear(): void;
|
|
43
43
|
replaceID({ from, to }: {
|
|
@@ -52,14 +52,14 @@ export declare class Layer {
|
|
|
52
52
|
writeLayer(layer: Layer): void;
|
|
53
53
|
private addFieldOperation;
|
|
54
54
|
}
|
|
55
|
-
type GraphQLField = GraphQLValue |
|
|
55
|
+
type GraphQLField = GraphQLValue | NestedList;
|
|
56
56
|
type EntityMap<_Value> = {
|
|
57
57
|
[id: string]: {
|
|
58
58
|
[field: string]: _Value;
|
|
59
59
|
};
|
|
60
60
|
};
|
|
61
61
|
type EntityFieldMap = EntityMap<GraphQLField>;
|
|
62
|
-
type LinkMap = EntityMap<string | null |
|
|
62
|
+
type LinkMap = EntityMap<string | null | NestedList>;
|
|
63
63
|
type OperationMap = {
|
|
64
64
|
[id: string]: {
|
|
65
65
|
deleted?: boolean;
|
|
@@ -69,7 +69,7 @@ type OperationMap = {
|
|
|
69
69
|
};
|
|
70
70
|
};
|
|
71
71
|
};
|
|
72
|
-
type
|
|
72
|
+
type NestedList<_Result = string> = (_Result | null | NestedList<_Result>)[];
|
|
73
73
|
type InsertOperation = {
|
|
74
74
|
kind: OperationKind.insert;
|
|
75
75
|
location: OperationLocation;
|
|
@@ -24,7 +24,7 @@ __export(storage_exports, {
|
|
|
24
24
|
OperationLocation: () => OperationLocation
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(storage_exports);
|
|
27
|
-
var
|
|
27
|
+
var import_flatten = require("../lib/flatten");
|
|
28
28
|
class InMemoryStorage {
|
|
29
29
|
data;
|
|
30
30
|
idCount = 0;
|
|
@@ -224,7 +224,7 @@ class Layer {
|
|
|
224
224
|
}
|
|
225
225
|
writeLink(id, field, value) {
|
|
226
226
|
const valueList = Array.isArray(value) ? value : [value];
|
|
227
|
-
for (const value2 of (0,
|
|
227
|
+
for (const value2 of (0, import_flatten.flatten)(valueList)) {
|
|
228
228
|
if (!value2) {
|
|
229
229
|
continue;
|
|
230
230
|
}
|