houdini 1.0.0-next.18 → 1.0.0-next.19
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 +55 -39
- package/build/cmd-esm/index.js +55 -39
- package/build/codegen-cjs/index.js +52 -27
- package/build/codegen-esm/index.js +52 -27
- package/build/lib/config.d.ts +4 -6
- package/build/lib/types.d.ts +11 -10
- package/build/lib-cjs/index.js +35 -40
- package/build/lib-esm/index.js +35 -40
- package/build/runtime/cache/storage.d.ts +18 -15
- package/build/runtime/client/documentStore.d.ts +3 -3
- package/build/runtime/client/utils/documentPlugins.d.ts +2 -2
- package/build/runtime/lib/config.d.ts +2 -2
- package/build/runtime/lib/types.d.ts +40 -41
- package/build/runtime-cjs/cache/storage.d.ts +18 -15
- package/build/runtime-cjs/cache/storage.js +9 -11
- package/build/runtime-cjs/client/documentStore.d.ts +3 -3
- package/build/runtime-cjs/client/utils/documentPlugins.d.ts +2 -2
- package/build/runtime-cjs/lib/config.d.ts +2 -2
- package/build/runtime-cjs/lib/types.d.ts +40 -41
- package/build/runtime-cjs/lib/types.js +26 -30
- package/build/runtime-esm/cache/storage.d.ts +18 -15
- package/build/runtime-esm/cache/storage.js +9 -11
- package/build/runtime-esm/client/documentStore.d.ts +3 -3
- package/build/runtime-esm/client/utils/documentPlugins.d.ts +2 -2
- package/build/runtime-esm/lib/config.d.ts +2 -2
- package/build/runtime-esm/lib/types.d.ts +40 -41
- package/build/runtime-esm/lib/types.js +26 -30
- package/build/test-cjs/index.js +55 -33
- package/build/test-esm/index.js +55 -33
- package/build/vite-cjs/index.js +53 -37
- package/build/vite-esm/index.js +53 -37
- package/package.json +1 -1
package/build/vite-esm/index.js
CHANGED
|
@@ -65212,10 +65212,27 @@ function computeID(configFile, type, data) {
|
|
|
65212
65212
|
}
|
|
65213
65213
|
|
|
65214
65214
|
// src/runtime/lib/types.ts
|
|
65215
|
-
var
|
|
65216
|
-
|
|
65217
|
-
|
|
65218
|
-
|
|
65215
|
+
var CachePolicy = {
|
|
65216
|
+
CacheOrNetwork: "CacheOrNetwork",
|
|
65217
|
+
CacheOnly: "CacheOnly",
|
|
65218
|
+
NetworkOnly: "NetworkOnly",
|
|
65219
|
+
CacheAndNetwork: "CacheAndNetwork"
|
|
65220
|
+
};
|
|
65221
|
+
var ArtifactKind = {
|
|
65222
|
+
Query: "HoudiniQuery",
|
|
65223
|
+
Subscription: "HoudiniSubscription",
|
|
65224
|
+
Mutation: "HoudiniMutation",
|
|
65225
|
+
Fragment: "HoudiniFragment"
|
|
65226
|
+
};
|
|
65227
|
+
var CompiledFragmentKind = ArtifactKind.Fragment;
|
|
65228
|
+
var CompiledMutationKind = ArtifactKind.Mutation;
|
|
65229
|
+
var CompiledQueryKind = ArtifactKind.Query;
|
|
65230
|
+
var CompiledSubscriptionKind = ArtifactKind.Subscription;
|
|
65231
|
+
var RefetchUpdateMode = {
|
|
65232
|
+
append: "append",
|
|
65233
|
+
prepend: "prepend",
|
|
65234
|
+
replace: "replace"
|
|
65235
|
+
};
|
|
65219
65236
|
|
|
65220
65237
|
// src/lib/constants.ts
|
|
65221
65238
|
var siteURL = "https://houdinigraphql.com";
|
|
@@ -66795,13 +66812,12 @@ function plugin(name, hooks) {
|
|
|
66795
66812
|
}
|
|
66796
66813
|
|
|
66797
66814
|
// src/lib/types.ts
|
|
66798
|
-
var LogLevel =
|
|
66799
|
-
|
|
66800
|
-
|
|
66801
|
-
|
|
66802
|
-
|
|
66803
|
-
|
|
66804
|
-
})(LogLevel || {});
|
|
66815
|
+
var LogLevel = {
|
|
66816
|
+
Full: "full",
|
|
66817
|
+
Summary: "summary",
|
|
66818
|
+
ShortSummary: "short-summary",
|
|
66819
|
+
Quiet: "quiet"
|
|
66820
|
+
};
|
|
66805
66821
|
|
|
66806
66822
|
// src/lib/config.ts
|
|
66807
66823
|
var currentDir = global.__dirname || dirname(fileURLToPath(import.meta.url));
|
|
@@ -66852,7 +66868,7 @@ var Config = class {
|
|
|
66852
66868
|
scalars,
|
|
66853
66869
|
cacheBufferSize,
|
|
66854
66870
|
definitionsPath,
|
|
66855
|
-
defaultCachePolicy =
|
|
66871
|
+
defaultCachePolicy = CachePolicy.CacheOrNetwork,
|
|
66856
66872
|
defaultPartial = false,
|
|
66857
66873
|
defaultListPosition = "append",
|
|
66858
66874
|
defaultListTarget = null,
|
|
@@ -66874,7 +66890,7 @@ var Config = class {
|
|
|
66874
66890
|
Object.values(LogLevel)
|
|
66875
66891
|
)}`
|
|
66876
66892
|
);
|
|
66877
|
-
logLevel =
|
|
66893
|
+
logLevel = LogLevel.Summary;
|
|
66878
66894
|
}
|
|
66879
66895
|
this.schemaPath = schemaPath;
|
|
66880
66896
|
this.filepath = filepath;
|
|
@@ -66890,7 +66906,7 @@ var Config = class {
|
|
|
66890
66906
|
this.internalListPosition = defaultListPosition === "append" ? "last" : "first";
|
|
66891
66907
|
this.defaultListTarget = defaultListTarget;
|
|
66892
66908
|
this.definitionsFolder = definitionsPath;
|
|
66893
|
-
this.logLevel = (logLevel ||
|
|
66909
|
+
this.logLevel = (logLevel || LogLevel.Summary).toLowerCase();
|
|
66894
66910
|
this.defaultFragmentMasking = defaultFragmentMasking;
|
|
66895
66911
|
this.routesDir = join2(this.projectRoot, "src", "routes");
|
|
66896
66912
|
this.schemaPollInterval = watchSchema?.interval ?? 2e3;
|
|
@@ -68283,7 +68299,7 @@ async function fragmentVariables(config4, documents) {
|
|
|
68283
68299
|
};
|
|
68284
68300
|
documents.push({
|
|
68285
68301
|
name: "generated::fragmentVariables",
|
|
68286
|
-
kind:
|
|
68302
|
+
kind: ArtifactKind.Fragment,
|
|
68287
68303
|
document: doc,
|
|
68288
68304
|
originalParsed: doc,
|
|
68289
68305
|
generateStore: false,
|
|
@@ -69210,7 +69226,7 @@ async function paginate(config4, documents) {
|
|
|
69210
69226
|
]
|
|
69211
69227
|
};
|
|
69212
69228
|
newDocs.push({
|
|
69213
|
-
kind:
|
|
69229
|
+
kind: ArtifactKind.Query,
|
|
69214
69230
|
filename: doc.filename,
|
|
69215
69231
|
name: refetchQueryName,
|
|
69216
69232
|
document: queryDoc,
|
|
@@ -69630,7 +69646,7 @@ async function addListFragments(config4, documents) {
|
|
|
69630
69646
|
config4.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(graphql11.print).join("\n\n");
|
|
69631
69647
|
documents.push({
|
|
69632
69648
|
name: "generated::lists",
|
|
69633
|
-
kind:
|
|
69649
|
+
kind: ArtifactKind.Fragment,
|
|
69634
69650
|
generateArtifact: false,
|
|
69635
69651
|
generateStore: false,
|
|
69636
69652
|
document: generatedDoc,
|
|
@@ -69897,7 +69913,7 @@ function selection({
|
|
|
69897
69913
|
(directive) => directive.name.value === config4.paginateDirective
|
|
69898
69914
|
);
|
|
69899
69915
|
if (paginated && document.refetch && document.refetch.method === "offset") {
|
|
69900
|
-
fieldObj.updates = [
|
|
69916
|
+
fieldObj.updates = [RefetchUpdateMode.append];
|
|
69901
69917
|
}
|
|
69902
69918
|
let continueConnection = inConnection;
|
|
69903
69919
|
if ([
|
|
@@ -69907,7 +69923,7 @@ function selection({
|
|
|
69907
69923
|
"hasNextPage",
|
|
69908
69924
|
"hasPreviousPage"
|
|
69909
69925
|
].includes(attributeName) && inConnection && document.refetch) {
|
|
69910
|
-
fieldObj.updates = [
|
|
69926
|
+
fieldObj.updates = [RefetchUpdateMode.append, RefetchUpdateMode.prepend];
|
|
69911
69927
|
}
|
|
69912
69928
|
if (attributeName === "node" && inConnection) {
|
|
69913
69929
|
continueConnection = false;
|
|
@@ -70086,7 +70102,7 @@ function artifactGenerator(stats) {
|
|
|
70086
70102
|
);
|
|
70087
70103
|
let rootType = "";
|
|
70088
70104
|
let selectionSet;
|
|
70089
|
-
if (docKind !==
|
|
70105
|
+
if (docKind !== ArtifactKind.Fragment) {
|
|
70090
70106
|
const operation = operations[0];
|
|
70091
70107
|
if (operation.operation === "query") {
|
|
70092
70108
|
rootType = config4.schema.getQueryType()?.name;
|
|
@@ -70119,7 +70135,7 @@ function artifactGenerator(stats) {
|
|
|
70119
70135
|
let directive = fragments[0]?.directives?.find(
|
|
70120
70136
|
(directive2) => directive2.name.value === config4.argumentsDirective
|
|
70121
70137
|
);
|
|
70122
|
-
if (docKind ===
|
|
70138
|
+
if (docKind === ArtifactKind.Fragment && directive) {
|
|
70123
70139
|
inputs = fragmentArgumentsDefinitions(config4, doc.filename, fragments[0]);
|
|
70124
70140
|
}
|
|
70125
70141
|
const mergedSelection = flattenSelections({
|
|
@@ -70167,7 +70183,7 @@ function artifactGenerator(stats) {
|
|
|
70167
70183
|
}
|
|
70168
70184
|
const result = { ...prev };
|
|
70169
70185
|
const dataToAdd = plugin2.artifactData({ config: config4, document: doc }) ?? {};
|
|
70170
|
-
if (Object.keys(dataToAdd)
|
|
70186
|
+
if (Object.keys(dataToAdd)) {
|
|
70171
70187
|
result[plugin2.name] = dataToAdd;
|
|
70172
70188
|
}
|
|
70173
70189
|
return result;
|
|
@@ -71416,7 +71432,7 @@ function listDefinitions(config4, body, docs) {
|
|
|
71416
71432
|
function queryDefinitions(config4, body, docs, returnType) {
|
|
71417
71433
|
return AST12.tsTupleType(
|
|
71418
71434
|
docs.reduce((prev, doc) => {
|
|
71419
|
-
if (doc.kind !==
|
|
71435
|
+
if (doc.kind !== ArtifactKind.Query || !doc.generateStore) {
|
|
71420
71436
|
return prev;
|
|
71421
71437
|
}
|
|
71422
71438
|
const definition = doc.document.definitions.find(
|
|
@@ -71447,7 +71463,7 @@ function queryDefinitions(config4, body, docs, returnType) {
|
|
|
71447
71463
|
}
|
|
71448
71464
|
function fragmentListMap(config4, concreteTypes, body, docs, return_type) {
|
|
71449
71465
|
return docs.reduce((prev, doc) => {
|
|
71450
|
-
if (doc.kind !==
|
|
71466
|
+
if (doc.kind !== ArtifactKind.Fragment) {
|
|
71451
71467
|
return prev;
|
|
71452
71468
|
}
|
|
71453
71469
|
const definition = doc.document.definitions.find(
|
|
@@ -71658,10 +71674,10 @@ var graphql22 = __toESM(require_graphql2(), 1);
|
|
|
71658
71674
|
async function graphqlExtensions(config4, documents) {
|
|
71659
71675
|
let internalSchema = `
|
|
71660
71676
|
enum CachePolicy {
|
|
71661
|
-
${
|
|
71662
|
-
${
|
|
71663
|
-
${
|
|
71664
|
-
${
|
|
71677
|
+
${CachePolicy.CacheAndNetwork}
|
|
71678
|
+
${CachePolicy.CacheOnly}
|
|
71679
|
+
${CachePolicy.CacheOrNetwork}
|
|
71680
|
+
${CachePolicy.NetworkOnly}
|
|
71665
71681
|
}
|
|
71666
71682
|
|
|
71667
71683
|
"""
|
|
@@ -72577,7 +72593,7 @@ function getAndVerifyNodeInterface(config4) {
|
|
|
72577
72593
|
var nbInvalidNodeFieldMessageDisplayed = 0;
|
|
72578
72594
|
function displayInvalidNodeFieldMessage(logLevel) {
|
|
72579
72595
|
if (nbInvalidNodeFieldMessageDisplayed === 0) {
|
|
72580
|
-
if (logLevel ===
|
|
72596
|
+
if (logLevel === LogLevel.Full) {
|
|
72581
72597
|
console.warn(invalidNodeFieldMessage);
|
|
72582
72598
|
} else {
|
|
72583
72599
|
console.warn(invalidNodeFieldMessageLight);
|
|
@@ -72745,7 +72761,7 @@ async function runPipeline2(config4, docs) {
|
|
|
72745
72761
|
}
|
|
72746
72762
|
const unchanged = artifactStats.total.length - artifactStats.changed.length - artifactStats.new.length - artifactStats.deleted.length;
|
|
72747
72763
|
const printMessage = !config4.pluginMode || unchanged !== artifactStats.total.length;
|
|
72748
|
-
if (!printMessage || config4.logLevel ===
|
|
72764
|
+
if (!printMessage || config4.logLevel === LogLevel.Quiet) {
|
|
72749
72765
|
if (error) {
|
|
72750
72766
|
throw error;
|
|
72751
72767
|
}
|
|
@@ -72759,14 +72775,14 @@ async function runPipeline2(config4, docs) {
|
|
|
72759
72775
|
}
|
|
72760
72776
|
if (artifactStats.total.length === 0) {
|
|
72761
72777
|
console.log(`\u{1F4A1} No operation found. If that's unexpected, please check your config.`);
|
|
72762
|
-
} else if (
|
|
72778
|
+
} else if (config4.logLevel == LogLevel.Summary || config4.logLevel == LogLevel.ShortSummary) {
|
|
72763
72779
|
if (unchanged > 0 && printMessage && !config4.pluginMode) {
|
|
72764
72780
|
console.log(`\u{1F4C3} Unchanged: ${unchanged}`);
|
|
72765
72781
|
}
|
|
72766
72782
|
logStyled("CREATED", artifactStats.new, config4.logLevel, config4.pluginMode);
|
|
72767
72783
|
logStyled("UPDATED", artifactStats.changed, config4.logLevel, config4.pluginMode);
|
|
72768
72784
|
logStyled("DELETED", artifactStats.deleted, config4.logLevel, config4.pluginMode);
|
|
72769
|
-
} else if (config4.logLevel ===
|
|
72785
|
+
} else if (config4.logLevel === LogLevel.Full) {
|
|
72770
72786
|
for (const artifact of artifactStats.total) {
|
|
72771
72787
|
let emoji = "\u{1F4C3}";
|
|
72772
72788
|
if (artifactStats.changed.includes(artifact)) {
|
|
@@ -72876,14 +72892,14 @@ async function processGraphQLDocument(config4, filepath, document) {
|
|
|
72876
72892
|
});
|
|
72877
72893
|
}
|
|
72878
72894
|
}
|
|
72879
|
-
let kind =
|
|
72895
|
+
let kind = ArtifactKind.Fragment;
|
|
72880
72896
|
if (operations.length === 1) {
|
|
72881
72897
|
if (operations[0].kind === "OperationDefinition" && operations[0].operation === "query") {
|
|
72882
|
-
kind =
|
|
72898
|
+
kind = ArtifactKind.Query;
|
|
72883
72899
|
} else if (operations[0].kind === "OperationDefinition" && operations[0].operation === "mutation") {
|
|
72884
|
-
kind =
|
|
72900
|
+
kind = ArtifactKind.Mutation;
|
|
72885
72901
|
} else if (operations[0].kind === "OperationDefinition" && operations[0].operation === "subscription") {
|
|
72886
|
-
kind =
|
|
72902
|
+
kind = ArtifactKind.Subscription;
|
|
72887
72903
|
}
|
|
72888
72904
|
}
|
|
72889
72905
|
return {
|
|
@@ -72928,7 +72944,7 @@ function logStyled(kind, stat3, logLevel, plugin2) {
|
|
|
72928
72944
|
}
|
|
72929
72945
|
}
|
|
72930
72946
|
console.log(msg.join(""));
|
|
72931
|
-
if (!plugin2 && logLevel ===
|
|
72947
|
+
if (!plugin2 && logLevel === LogLevel.Summary) {
|
|
72932
72948
|
for (const artifact of stat3.slice(0, nbToDisplay)) {
|
|
72933
72949
|
console.log(` ${artifact}`);
|
|
72934
72950
|
}
|