houdini 1.2.6-next.0 → 1.2.7
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 +110 -74
- package/build/cmd-esm/index.js +110 -74
- package/build/codegen/generators/artifacts/index.d.ts +2 -0
- package/build/codegen-cjs/index.js +101 -69
- package/build/codegen-esm/index.js +101 -69
- package/build/lib/config.d.ts +1 -1
- package/build/lib/graphql.d.ts +5 -3
- package/build/lib-cjs/index.js +48 -31
- package/build/lib-esm/index.js +46 -30
- package/build/runtime/cache/cache.d.ts +1 -0
- package/build/runtime/client/documentStore.d.ts +1 -0
- package/build/runtime/client/plugins/subscription.d.ts +3 -2
- package/build/runtime/lib/config.d.ts +4 -0
- package/build/runtime-cjs/cache/cache.d.ts +1 -0
- package/build/runtime-cjs/cache/cache.js +6 -8
- package/build/runtime-cjs/client/documentStore.d.ts +1 -0
- package/build/runtime-cjs/client/documentStore.js +1 -0
- package/build/runtime-cjs/client/plugins/fetch.js +14 -5
- package/build/runtime-cjs/client/plugins/fetchParams.js +2 -2
- package/build/runtime-cjs/client/plugins/subscription.d.ts +3 -2
- package/build/runtime-cjs/client/plugins/subscription.js +3 -3
- package/build/runtime-cjs/lib/config.d.ts +4 -0
- package/build/runtime-esm/cache/cache.d.ts +1 -0
- package/build/runtime-esm/cache/cache.js +6 -8
- package/build/runtime-esm/client/documentStore.d.ts +1 -0
- package/build/runtime-esm/client/documentStore.js +1 -0
- package/build/runtime-esm/client/plugins/fetch.js +14 -5
- package/build/runtime-esm/client/plugins/fetchParams.js +2 -2
- package/build/runtime-esm/client/plugins/subscription.d.ts +3 -2
- package/build/runtime-esm/client/plugins/subscription.js +3 -3
- package/build/runtime-esm/lib/config.d.ts +4 -0
- package/build/test-cjs/index.js +107 -71
- package/build/test-esm/index.js +107 -71
- package/build/vite-cjs/index.js +107 -71
- package/build/vite-esm/index.js +107 -71
- package/package.json +1 -1
|
@@ -56174,12 +56174,9 @@ var CacheInternal = class {
|
|
|
56174
56174
|
);
|
|
56175
56175
|
}
|
|
56176
56176
|
}
|
|
56177
|
-
const embedded = this.idFields(linkedType)?.filter(
|
|
56178
|
-
(field2) => typeof value[field2] === "undefined"
|
|
56179
|
-
).length > 0;
|
|
56180
56177
|
let linkedID = null;
|
|
56181
56178
|
if (value !== null) {
|
|
56182
|
-
linkedID = !
|
|
56179
|
+
linkedID = !this.isEmbedded(linkedType, value) ? this.id(linkedType, value) : `${parent2}.${key}`;
|
|
56183
56180
|
}
|
|
56184
56181
|
let linkChange = linkedID !== previousValue;
|
|
56185
56182
|
layer.writeLink(parent2, key, linkedID);
|
|
@@ -56551,6 +56548,10 @@ var CacheInternal = class {
|
|
|
56551
56548
|
computeID(type, data) {
|
|
56552
56549
|
return computeID(this.config, type, data);
|
|
56553
56550
|
}
|
|
56551
|
+
isEmbedded(linkedType, value) {
|
|
56552
|
+
const idFields = this.idFields(linkedType);
|
|
56553
|
+
return idFields.length === 0 || idFields.filter((field) => typeof value[field] === "undefined").length > 0;
|
|
56554
|
+
}
|
|
56554
56555
|
hydrateNestedList({
|
|
56555
56556
|
fields,
|
|
56556
56557
|
variables,
|
|
@@ -56658,9 +56659,6 @@ var CacheInternal = class {
|
|
|
56658
56659
|
}
|
|
56659
56660
|
const entryObj = entry;
|
|
56660
56661
|
let linkedID = `${recordID}.${key}[${this.storage.nextRank}]`;
|
|
56661
|
-
const embedded = this.idFields(linkedType)?.filter(
|
|
56662
|
-
(field) => typeof entry[field] === "undefined"
|
|
56663
|
-
).length > 0;
|
|
56664
56662
|
let innerType = linkedType;
|
|
56665
56663
|
const typename = entryObj.__typename;
|
|
56666
56664
|
if (typename) {
|
|
@@ -56668,7 +56666,7 @@ var CacheInternal = class {
|
|
|
56668
56666
|
} else if (abstract) {
|
|
56669
56667
|
throw new Error("Encountered interface type without __typename in the payload");
|
|
56670
56668
|
}
|
|
56671
|
-
if (!
|
|
56669
|
+
if (!this.isEmbedded(linkedType, entry)) {
|
|
56672
56670
|
const id = this.id(innerType, entry);
|
|
56673
56671
|
if (id) {
|
|
56674
56672
|
linkedID = id;
|
|
@@ -56961,11 +56959,14 @@ function getRootType(type) {
|
|
|
56961
56959
|
}
|
|
56962
56960
|
return type;
|
|
56963
56961
|
}
|
|
56964
|
-
function
|
|
56965
|
-
document
|
|
56966
|
-
}
|
|
56967
|
-
|
|
56968
|
-
return
|
|
56962
|
+
function hashOriginal({ document }) {
|
|
56963
|
+
return hashDocument(document.originalString);
|
|
56964
|
+
}
|
|
56965
|
+
function hashRaw({ document }) {
|
|
56966
|
+
return hashDocument(document.artifact?.raw);
|
|
56967
|
+
}
|
|
56968
|
+
function hashDocument(str) {
|
|
56969
|
+
return crypto.createHash("sha256").update(str || "").digest("hex");
|
|
56969
56970
|
}
|
|
56970
56971
|
function parentField(ancestors) {
|
|
56971
56972
|
return walkParentField([...ancestors].sort(() => -1));
|
|
@@ -58033,6 +58034,42 @@ function inlineFragmentArgs({
|
|
|
58033
58034
|
filepath,
|
|
58034
58035
|
document
|
|
58035
58036
|
).reduce((acc, arg) => ({ ...acc, [arg.name]: arg }), {});
|
|
58037
|
+
const modifyValue = (node) => {
|
|
58038
|
+
if (node.kind == "ObjectValue") {
|
|
58039
|
+
return {
|
|
58040
|
+
...node,
|
|
58041
|
+
fields: node.fields.map((field) => {
|
|
58042
|
+
const modifiedValue = modifyValue(field.value);
|
|
58043
|
+
if (!modifiedValue)
|
|
58044
|
+
return null;
|
|
58045
|
+
return {
|
|
58046
|
+
...field,
|
|
58047
|
+
value: modifyValue(field.value)
|
|
58048
|
+
};
|
|
58049
|
+
})
|
|
58050
|
+
};
|
|
58051
|
+
}
|
|
58052
|
+
if (node.kind !== "Variable") {
|
|
58053
|
+
return node;
|
|
58054
|
+
}
|
|
58055
|
+
if (!scope) {
|
|
58056
|
+
throw new HoudiniError({
|
|
58057
|
+
filepath,
|
|
58058
|
+
message: node.name.value + " is not defined in the current scope: " + JSON.stringify(scope)
|
|
58059
|
+
});
|
|
58060
|
+
}
|
|
58061
|
+
const newValue = scope[node.name.value];
|
|
58062
|
+
if (newValue) {
|
|
58063
|
+
return newValue;
|
|
58064
|
+
}
|
|
58065
|
+
if (definitionArgs[node.name.value] && definitionArgs[node.name.value].required) {
|
|
58066
|
+
throw new HoudiniError({
|
|
58067
|
+
filepath,
|
|
58068
|
+
message: "Missing value for required arg: " + node.name.value
|
|
58069
|
+
});
|
|
58070
|
+
}
|
|
58071
|
+
return null;
|
|
58072
|
+
};
|
|
58036
58073
|
const result = esm_default(
|
|
58037
58074
|
graphql4.visit(document, {
|
|
58038
58075
|
FragmentSpread(node) {
|
|
@@ -58106,29 +58143,14 @@ function inlineFragmentArgs({
|
|
|
58106
58143
|
}
|
|
58107
58144
|
},
|
|
58108
58145
|
Argument(node) {
|
|
58109
|
-
|
|
58110
|
-
|
|
58111
|
-
return;
|
|
58112
|
-
}
|
|
58113
|
-
if (!scope) {
|
|
58114
|
-
throw new HoudiniError({
|
|
58115
|
-
filepath,
|
|
58116
|
-
message: node.name.value + " is not defined in the current scope: " + JSON.stringify(scope)
|
|
58117
|
-
});
|
|
58118
|
-
}
|
|
58119
|
-
const newValue = scope[value.name.value];
|
|
58146
|
+
let value = node.value;
|
|
58147
|
+
const newValue = modifyValue(value);
|
|
58120
58148
|
if (newValue) {
|
|
58121
58149
|
return {
|
|
58122
58150
|
...node,
|
|
58123
58151
|
value: newValue
|
|
58124
58152
|
};
|
|
58125
58153
|
}
|
|
58126
|
-
if (definitionArgs[value.name.value] && definitionArgs[value.name.value].required) {
|
|
58127
|
-
throw new HoudiniError({
|
|
58128
|
-
filepath,
|
|
58129
|
-
message: "Missing value for required arg: " + value.name.value
|
|
58130
|
-
});
|
|
58131
|
-
}
|
|
58132
58154
|
return null;
|
|
58133
58155
|
}
|
|
58134
58156
|
})
|
|
@@ -59952,13 +59974,13 @@ function artifactGenerator(stats) {
|
|
|
59952
59974
|
});
|
|
59953
59975
|
}
|
|
59954
59976
|
const listOfArtifacts = [];
|
|
59955
|
-
const
|
|
59977
|
+
const hashPluginBaseRaw = config2.plugins?.find((plugin2) => plugin2.hash)?.hash ?? hashRaw;
|
|
59956
59978
|
await Promise.all(
|
|
59957
59979
|
[
|
|
59958
59980
|
writeIndexFile(config2, docs)
|
|
59959
59981
|
].concat(
|
|
59960
59982
|
docs.map(async (doc) => {
|
|
59961
|
-
const { document, name, generateArtifact, originalParsed
|
|
59983
|
+
const { document, name, generateArtifact, originalParsed } = doc;
|
|
59962
59984
|
if (!generateArtifact) {
|
|
59963
59985
|
return;
|
|
59964
59986
|
}
|
|
@@ -60065,7 +60087,7 @@ function artifactGenerator(stats) {
|
|
|
60065
60087
|
let artifact = {
|
|
60066
60088
|
name,
|
|
60067
60089
|
kind: docKind,
|
|
60068
|
-
hash:
|
|
60090
|
+
hash: "NOT_YET",
|
|
60069
60091
|
refetch: doc.refetch,
|
|
60070
60092
|
raw: rawString,
|
|
60071
60093
|
rootType,
|
|
@@ -60092,6 +60114,8 @@ function artifactGenerator(stats) {
|
|
|
60092
60114
|
}),
|
|
60093
60115
|
pluginData: {}
|
|
60094
60116
|
};
|
|
60117
|
+
const hash_value = hashPluginBaseRaw({ config: config2, document: { ...doc, artifact } });
|
|
60118
|
+
artifact.hash = hash_value;
|
|
60095
60119
|
applyMask(
|
|
60096
60120
|
config2,
|
|
60097
60121
|
artifact.selection,
|
|
@@ -60166,11 +60190,10 @@ function artifactGenerator(stats) {
|
|
|
60166
60190
|
}
|
|
60167
60191
|
plugin2.artifactEnd({ config: config2, document: doc });
|
|
60168
60192
|
}
|
|
60193
|
+
const _houdiniHash = hashOriginal({ document: doc });
|
|
60169
60194
|
const file = AST5.program([
|
|
60170
60195
|
moduleExport(config2, "default", serializeValue(artifact)),
|
|
60171
|
-
AST5.expressionStatement(
|
|
60172
|
-
AST5.stringLiteral(`HoudiniHash=${hash({ config: config2, document: doc })}`)
|
|
60173
|
-
)
|
|
60196
|
+
AST5.expressionStatement(AST5.stringLiteral(`HoudiniHash=${_houdiniHash}`))
|
|
60174
60197
|
]);
|
|
60175
60198
|
const artifactPath = config2.artifactPath(document);
|
|
60176
60199
|
const countDocument = doc.generateStore;
|
|
@@ -60187,10 +60210,12 @@ function artifactGenerator(stats) {
|
|
|
60187
60210
|
return;
|
|
60188
60211
|
}
|
|
60189
60212
|
const match = existingArtifact && existingArtifact.match(/"HoudiniHash=(\w+)"/);
|
|
60190
|
-
if (match && match[1] !==
|
|
60213
|
+
if (match && match[1] !== _houdiniHash) {
|
|
60191
60214
|
stats.changed.push(artifact.name);
|
|
60192
60215
|
}
|
|
60193
60216
|
stats.total.push(artifact.name);
|
|
60217
|
+
stats.hashSize.push(artifact.hash.length);
|
|
60218
|
+
stats.querySize.push(artifact.raw.length);
|
|
60194
60219
|
})
|
|
60195
60220
|
)
|
|
60196
60221
|
);
|
|
@@ -61795,39 +61820,36 @@ async function typescriptGenerator(config2, docs) {
|
|
|
61795
61820
|
// src/codegen/generators/persistedQueries/index.ts
|
|
61796
61821
|
var graphql19 = __toESM(require_graphql2(), 1);
|
|
61797
61822
|
async function persistOutputGenerator(config2, docs) {
|
|
61798
|
-
if (
|
|
61799
|
-
|
|
61800
|
-
if (!config2.persistedQueryPath.endsWith(".json")) {
|
|
61801
|
-
console.log("Can only write the queryMap to a json file");
|
|
61802
|
-
return;
|
|
61823
|
+
if (!config2.persistedQueriesPath.endsWith(".json")) {
|
|
61824
|
+
throw new Error('Can write Persisted Queries only in a ".json" file.');
|
|
61803
61825
|
}
|
|
61804
|
-
const queryMap = docs.reduce(
|
|
61805
|
-
|
|
61806
|
-
|
|
61807
|
-
|
|
61808
|
-
|
|
61809
|
-
|
|
61810
|
-
|
|
61811
|
-
|
|
61812
|
-
|
|
61813
|
-
|
|
61814
|
-
}
|
|
61826
|
+
const queryMap = docs.reduce((acc, doc) => {
|
|
61827
|
+
const { document, generateArtifact, artifact } = doc;
|
|
61828
|
+
if (!generateArtifact) {
|
|
61829
|
+
return acc;
|
|
61830
|
+
}
|
|
61831
|
+
let rawString = graphql19.print(
|
|
61832
|
+
graphql19.visit(document, {
|
|
61833
|
+
Directive(node) {
|
|
61834
|
+
if (config2.isInternalDirective(node.name.value)) {
|
|
61835
|
+
return null;
|
|
61815
61836
|
}
|
|
61816
|
-
}
|
|
61817
|
-
)
|
|
61818
|
-
|
|
61819
|
-
|
|
61820
|
-
)
|
|
61821
|
-
|
|
61822
|
-
|
|
61837
|
+
}
|
|
61838
|
+
})
|
|
61839
|
+
);
|
|
61840
|
+
const operations = document.definitions.filter(
|
|
61841
|
+
({ kind }) => kind === graphql19.Kind.OPERATION_DEFINITION
|
|
61842
|
+
);
|
|
61843
|
+
if (operations.length > 0 && operations[0].kind === "OperationDefinition") {
|
|
61844
|
+
if (artifact) {
|
|
61845
|
+
acc[artifact.hash] = rawString;
|
|
61823
61846
|
}
|
|
61824
|
-
|
|
61825
|
-
|
|
61826
|
-
|
|
61827
|
-
);
|
|
61847
|
+
}
|
|
61848
|
+
return acc;
|
|
61849
|
+
}, {});
|
|
61828
61850
|
if (Object.keys(queryMap).length === 0)
|
|
61829
61851
|
return;
|
|
61830
|
-
await fs_exports.writeFile(config2.
|
|
61852
|
+
await fs_exports.writeFile(config2.persistedQueriesPath, JSON.stringify(queryMap, null, 4));
|
|
61831
61853
|
}
|
|
61832
61854
|
|
|
61833
61855
|
// src/codegen/generators/definitions/enums.ts
|
|
@@ -63149,7 +63171,9 @@ async function runPipeline2(config2, docs) {
|
|
|
63149
63171
|
total: [],
|
|
63150
63172
|
changed: [],
|
|
63151
63173
|
new: [],
|
|
63152
|
-
deleted: []
|
|
63174
|
+
deleted: [],
|
|
63175
|
+
hashSize: [],
|
|
63176
|
+
querySize: []
|
|
63153
63177
|
};
|
|
63154
63178
|
const generatePlugins = config2.plugins.filter((plugin2) => plugin2.generate);
|
|
63155
63179
|
const afterValidate = config2.plugins.filter((plugin2) => plugin2.afterValidate).map((plugin2) => plugin2.afterValidate);
|
|
@@ -63162,6 +63186,9 @@ async function runPipeline2(config2, docs) {
|
|
|
63162
63186
|
documents: docs2
|
|
63163
63187
|
})
|
|
63164
63188
|
);
|
|
63189
|
+
if (!config2.pluginMode && process.env.HOUDINI_TEST !== "true") {
|
|
63190
|
+
console.log("\u{1F3A9} Generating runtime...");
|
|
63191
|
+
}
|
|
63165
63192
|
let error = null;
|
|
63166
63193
|
try {
|
|
63167
63194
|
await runPipeline(
|
|
@@ -63208,9 +63235,6 @@ async function runPipeline2(config2, docs) {
|
|
|
63208
63235
|
}
|
|
63209
63236
|
return;
|
|
63210
63237
|
}
|
|
63211
|
-
if (!config2.pluginMode) {
|
|
63212
|
-
console.log("\u{1F3A9} Generating runtime...");
|
|
63213
|
-
}
|
|
63214
63238
|
if (error) {
|
|
63215
63239
|
throw error;
|
|
63216
63240
|
}
|
|
@@ -63235,6 +63259,14 @@ async function runPipeline2(config2, docs) {
|
|
|
63235
63259
|
}
|
|
63236
63260
|
console.log(`${emoji} ${artifact}`);
|
|
63237
63261
|
}
|
|
63262
|
+
console.log(``);
|
|
63263
|
+
console.log(`\u{1FA84} Total: ${artifactStats.total.length}`);
|
|
63264
|
+
const format = (val) => {
|
|
63265
|
+
return `${(val / 1024).toFixed(1)} kb`;
|
|
63266
|
+
};
|
|
63267
|
+
const hashSize = format(artifactStats.hashSize.reduce((acc, val) => acc + val, 0));
|
|
63268
|
+
const querySize = format(artifactStats.querySize.reduce((acc, val) => acc + val, 0));
|
|
63269
|
+
console.log(`\u{1FAB6} Network request size: ${querySize} (pesisted: ${hashSize})`);
|
|
63238
63270
|
}
|
|
63239
63271
|
}
|
|
63240
63272
|
async function collectDocuments(config2) {
|
package/build/lib/config.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare class Config {
|
|
|
12
12
|
projectRoot: string;
|
|
13
13
|
schema: graphql.GraphQLSchema;
|
|
14
14
|
schemaPath?: string;
|
|
15
|
-
|
|
15
|
+
persistedQueriesPath: string;
|
|
16
16
|
exclude: string[];
|
|
17
17
|
scalars?: ConfigFile['scalars'];
|
|
18
18
|
module: 'commonjs' | 'esm';
|
package/build/lib/graphql.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as graphql from 'graphql';
|
|
2
2
|
import type { Document, Config } from '.';
|
|
3
3
|
export declare function getRootType(type: graphql.GraphQLType): graphql.GraphQLType;
|
|
4
|
-
export declare function
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export declare function hashOriginal({ document }: {
|
|
5
|
+
document: Document;
|
|
6
|
+
}): string;
|
|
7
|
+
export declare function hashRaw({ document }: {
|
|
8
|
+
document: Document;
|
|
7
9
|
}): string;
|
|
8
10
|
type GraphQLParentType = graphql.GraphQLObjectType | graphql.GraphQLInputObjectType | graphql.GraphQLInterfaceType;
|
|
9
11
|
export declare function parentField(ancestors: readonly any[]): graphql.FieldNode | graphql.InlineFragmentNode | graphql.OperationDefinitionNode | graphql.FragmentDefinitionNode | null;
|
package/build/lib-cjs/index.js
CHANGED
|
@@ -53964,11 +53964,11 @@ var require_esprima2 = __commonJS({
|
|
|
53964
53964
|
case "}":
|
|
53965
53965
|
regex = false;
|
|
53966
53966
|
if (this.values[this.curly - 3] === "function") {
|
|
53967
|
-
var
|
|
53968
|
-
regex =
|
|
53967
|
+
var check = this.values[this.curly - 4];
|
|
53968
|
+
regex = check ? !this.beforeFunctionExpression(check) : false;
|
|
53969
53969
|
} else if (this.values[this.curly - 4] === "function") {
|
|
53970
|
-
var
|
|
53971
|
-
regex =
|
|
53970
|
+
var check = this.values[this.curly - 5];
|
|
53971
|
+
regex = check ? !this.beforeFunctionExpression(check) : true;
|
|
53972
53972
|
}
|
|
53973
53973
|
break;
|
|
53974
53974
|
default:
|
|
@@ -58493,7 +58493,8 @@ __export(lib_exports, {
|
|
|
58493
58493
|
getCurrentConfig: () => getCurrentConfig,
|
|
58494
58494
|
getMockConfig: () => getMockConfig,
|
|
58495
58495
|
getRootType: () => getRootType,
|
|
58496
|
-
|
|
58496
|
+
hashOriginal: () => hashOriginal,
|
|
58497
|
+
hashRaw: () => hashRaw,
|
|
58497
58498
|
houdini_mode: () => houdini_mode,
|
|
58498
58499
|
isPending: () => isPending,
|
|
58499
58500
|
keyFieldsForType: () => keyFieldsForType,
|
|
@@ -63559,7 +63560,7 @@ var fetch2 = (target) => {
|
|
|
63559
63560
|
}
|
|
63560
63561
|
const fetch3 = ctx.fetch ?? globalThis.fetch;
|
|
63561
63562
|
const fetchParams2 = {
|
|
63562
|
-
name: ctx.
|
|
63563
|
+
name: ctx.name,
|
|
63563
63564
|
text: ctx.text,
|
|
63564
63565
|
hash: ctx.hash,
|
|
63565
63566
|
variables: marshalVariables2(ctx)
|
|
@@ -63615,8 +63616,7 @@ var defaultFetch = (url, params) => {
|
|
|
63615
63616
|
};
|
|
63616
63617
|
};
|
|
63617
63618
|
function handleMultipart(params, args) {
|
|
63618
|
-
const {
|
|
63619
|
-
query: params.text,
|
|
63619
|
+
const { files } = extractFiles({
|
|
63620
63620
|
variables: params.variables
|
|
63621
63621
|
});
|
|
63622
63622
|
if (files.size) {
|
|
@@ -63629,8 +63629,18 @@ function handleMultipart(params, args) {
|
|
|
63629
63629
|
headers = Object.fromEntries(filtered);
|
|
63630
63630
|
}
|
|
63631
63631
|
const form = new FormData();
|
|
63632
|
-
|
|
63633
|
-
|
|
63632
|
+
if (args && args?.body) {
|
|
63633
|
+
form.set("operations", args?.body);
|
|
63634
|
+
} else {
|
|
63635
|
+
form.set(
|
|
63636
|
+
"operations",
|
|
63637
|
+
JSON.stringify({
|
|
63638
|
+
operationName: params.name,
|
|
63639
|
+
query: params.text,
|
|
63640
|
+
variables: params.variables
|
|
63641
|
+
})
|
|
63642
|
+
);
|
|
63643
|
+
}
|
|
63634
63644
|
const map = {};
|
|
63635
63645
|
let i2 = 0;
|
|
63636
63646
|
files.forEach((paths) => {
|
|
@@ -65208,12 +65218,9 @@ var CacheInternal = class {
|
|
|
65208
65218
|
);
|
|
65209
65219
|
}
|
|
65210
65220
|
}
|
|
65211
|
-
const embedded = this.idFields(linkedType)?.filter(
|
|
65212
|
-
(field2) => typeof value[field2] === "undefined"
|
|
65213
|
-
).length > 0;
|
|
65214
65221
|
let linkedID = null;
|
|
65215
65222
|
if (value !== null) {
|
|
65216
|
-
linkedID = !
|
|
65223
|
+
linkedID = !this.isEmbedded(linkedType, value) ? this.id(linkedType, value) : `${parent}.${key}`;
|
|
65217
65224
|
}
|
|
65218
65225
|
let linkChange = linkedID !== previousValue;
|
|
65219
65226
|
layer.writeLink(parent, key, linkedID);
|
|
@@ -65585,6 +65592,10 @@ var CacheInternal = class {
|
|
|
65585
65592
|
computeID(type, data) {
|
|
65586
65593
|
return computeID(this.config, type, data);
|
|
65587
65594
|
}
|
|
65595
|
+
isEmbedded(linkedType, value) {
|
|
65596
|
+
const idFields = this.idFields(linkedType);
|
|
65597
|
+
return idFields.length === 0 || idFields.filter((field) => typeof value[field] === "undefined").length > 0;
|
|
65598
|
+
}
|
|
65588
65599
|
hydrateNestedList({
|
|
65589
65600
|
fields,
|
|
65590
65601
|
variables,
|
|
@@ -65692,9 +65703,6 @@ var CacheInternal = class {
|
|
|
65692
65703
|
}
|
|
65693
65704
|
const entryObj = entry;
|
|
65694
65705
|
let linkedID = `${recordID}.${key}[${this.storage.nextRank}]`;
|
|
65695
|
-
const embedded = this.idFields(linkedType)?.filter(
|
|
65696
|
-
(field) => typeof entry[field] === "undefined"
|
|
65697
|
-
).length > 0;
|
|
65698
65706
|
let innerType = linkedType;
|
|
65699
65707
|
const typename = entryObj.__typename;
|
|
65700
65708
|
if (typename) {
|
|
@@ -65702,7 +65710,7 @@ var CacheInternal = class {
|
|
|
65702
65710
|
} else if (abstract) {
|
|
65703
65711
|
throw new Error("Encountered interface type without __typename in the payload");
|
|
65704
65712
|
}
|
|
65705
|
-
if (!
|
|
65713
|
+
if (!this.isEmbedded(linkedType, entry)) {
|
|
65706
65714
|
const id = this.id(innerType, entry);
|
|
65707
65715
|
if (id) {
|
|
65708
65716
|
linkedID = id;
|
|
@@ -66064,10 +66072,10 @@ var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
|
66064
66072
|
});
|
|
66065
66073
|
|
|
66066
66074
|
// src/runtime/client/plugins/subscription.ts
|
|
66067
|
-
var check = null;
|
|
66068
66075
|
function subscription(factory) {
|
|
66069
66076
|
return documentPlugin(ArtifactKind.Subscription, () => {
|
|
66070
66077
|
let clearSubscription = null;
|
|
66078
|
+
let check = null;
|
|
66071
66079
|
return {
|
|
66072
66080
|
start(ctx, { resolve: resolve2, next, initialValue }) {
|
|
66073
66081
|
if (typeof globalThis.window === "undefined") {
|
|
@@ -66095,8 +66103,8 @@ function subscription(factory) {
|
|
|
66095
66103
|
clearSubscription?.();
|
|
66096
66104
|
clearSubscription = client.subscribe(
|
|
66097
66105
|
{
|
|
66098
|
-
operationName: ctx.
|
|
66099
|
-
query: ctx.
|
|
66106
|
+
operationName: ctx.name,
|
|
66107
|
+
query: ctx.text,
|
|
66100
66108
|
variables: marshalVariables2(ctx)
|
|
66101
66109
|
},
|
|
66102
66110
|
{
|
|
@@ -66183,8 +66191,8 @@ var fetchParams = (fn = () => ({})) => () => ({
|
|
|
66183
66191
|
stuff: ctx.stuff,
|
|
66184
66192
|
document: ctx.artifact,
|
|
66185
66193
|
variables: marshalVariables2(ctx),
|
|
66186
|
-
text: ctx.
|
|
66187
|
-
hash: ctx.
|
|
66194
|
+
text: ctx.text,
|
|
66195
|
+
hash: ctx.hash
|
|
66188
66196
|
})
|
|
66189
66197
|
});
|
|
66190
66198
|
}
|
|
@@ -66265,6 +66273,7 @@ var DocumentStore = class extends Writable {
|
|
|
66265
66273
|
} = {}) {
|
|
66266
66274
|
let context = new ClientPluginContextWrapper({
|
|
66267
66275
|
config: this.#configFile,
|
|
66276
|
+
name: this.artifact.name,
|
|
66268
66277
|
text: this.artifact.raw,
|
|
66269
66278
|
hash: this.artifact.hash,
|
|
66270
66279
|
policy: policy ?? this.artifact.policy,
|
|
@@ -66629,7 +66638,7 @@ var Config = class {
|
|
|
66629
66638
|
projectRoot;
|
|
66630
66639
|
schema;
|
|
66631
66640
|
schemaPath;
|
|
66632
|
-
|
|
66641
|
+
persistedQueriesPath = "./$houdini/persisted_queries.json";
|
|
66633
66642
|
exclude;
|
|
66634
66643
|
scalars;
|
|
66635
66644
|
module = "esm";
|
|
@@ -66681,7 +66690,8 @@ var Config = class {
|
|
|
66681
66690
|
logLevel,
|
|
66682
66691
|
defaultFragmentMasking = "enable",
|
|
66683
66692
|
watchSchema,
|
|
66684
|
-
projectDir
|
|
66693
|
+
projectDir,
|
|
66694
|
+
persistedQueriesPath
|
|
66685
66695
|
} = this.configFile;
|
|
66686
66696
|
if (typeof schema === "string") {
|
|
66687
66697
|
this.schema = graphql2.buildSchema(schema);
|
|
@@ -66718,6 +66728,9 @@ var Config = class {
|
|
|
66718
66728
|
this.schemaPollHeaders = watchSchema?.headers ?? {};
|
|
66719
66729
|
this.rootDir = join2(this.projectRoot, "$houdini");
|
|
66720
66730
|
this.#fragmentVariableMaps = {};
|
|
66731
|
+
if (persistedQueriesPath) {
|
|
66732
|
+
this.persistedQueriesPath = persistedQueriesPath;
|
|
66733
|
+
}
|
|
66721
66734
|
if (defaultKeys) {
|
|
66722
66735
|
this.defaultKeys = defaultKeys;
|
|
66723
66736
|
}
|
|
@@ -67432,11 +67445,14 @@ function getRootType(type) {
|
|
|
67432
67445
|
}
|
|
67433
67446
|
return type;
|
|
67434
67447
|
}
|
|
67435
|
-
function
|
|
67436
|
-
document
|
|
67437
|
-
}
|
|
67438
|
-
|
|
67439
|
-
return
|
|
67448
|
+
function hashOriginal({ document }) {
|
|
67449
|
+
return hashDocument(document.originalString);
|
|
67450
|
+
}
|
|
67451
|
+
function hashRaw({ document }) {
|
|
67452
|
+
return hashDocument(document.artifact?.raw);
|
|
67453
|
+
}
|
|
67454
|
+
function hashDocument(str) {
|
|
67455
|
+
return import_node_crypto.default.createHash("sha256").update(str || "").digest("hex");
|
|
67440
67456
|
}
|
|
67441
67457
|
function parentField(ancestors) {
|
|
67442
67458
|
return walkParentField([...ancestors].sort(() => -1));
|
|
@@ -67976,7 +67992,8 @@ async function find_graphql(config, parsedScript, walker) {
|
|
|
67976
67992
|
getCurrentConfig,
|
|
67977
67993
|
getMockConfig,
|
|
67978
67994
|
getRootType,
|
|
67979
|
-
|
|
67995
|
+
hashOriginal,
|
|
67996
|
+
hashRaw,
|
|
67980
67997
|
houdini_mode,
|
|
67981
67998
|
isPending,
|
|
67982
67999
|
keyFieldsForType,
|