houdini-react 0.0.0-20240309024236 → 0.0.0-20240309041323

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.
@@ -74579,55 +74579,8 @@ var CompiledFragmentKind = ArtifactKind.Fragment;
74579
74579
  var CompiledMutationKind = ArtifactKind.Mutation;
74580
74580
  var CompiledQueryKind = ArtifactKind.Query;
74581
74581
  var CompiledSubscriptionKind = ArtifactKind.Subscription;
74582
- var DataSource = {
74583
- Cache: "cache",
74584
- Network: "network",
74585
- Ssr: "ssr"
74586
- };
74587
74582
  var fragmentKey = " $fragments";
74588
74583
  var PendingValue = Symbol("houdini_loading");
74589
- async function marshalSelection({
74590
- selection,
74591
- data
74592
- }) {
74593
- const config = getCurrentConfig();
74594
- if (data === null || typeof data === "undefined") {
74595
- return data;
74596
- }
74597
- if (Array.isArray(data)) {
74598
- return await Promise.all(data.map((val) => marshalSelection({ selection, data: val })));
74599
- }
74600
- const targetSelection = getFieldsForType(selection, data["__typename"], false);
74601
- return Object.fromEntries(
74602
- await Promise.all(
74603
- Object.entries(data).map(async ([fieldName, value]) => {
74604
- if (fieldName === fragmentKey) {
74605
- return [fieldName, value];
74606
- }
74607
- const { type, selection: selection2 } = targetSelection[fieldName];
74608
- if (!type) {
74609
- return [fieldName, value];
74610
- }
74611
- if (selection2) {
74612
- return [fieldName, await marshalSelection({ selection: selection2, data: value })];
74613
- }
74614
- if (config.scalars?.[type]) {
74615
- const marshalFn = config.scalars[type].marshal;
74616
- if (!marshalFn) {
74617
- throw new Error(
74618
- `scalar type ${type} is missing a \`marshal\` function. see https://github.com/AlecAivazis/houdini#%EF%B8%8Fcustom-scalars`
74619
- );
74620
- }
74621
- if (Array.isArray(value)) {
74622
- return [fieldName, value.map(marshalFn)];
74623
- }
74624
- return [fieldName, marshalFn(value)];
74625
- }
74626
- return [fieldName, value];
74627
- })
74628
- )
74629
- );
74630
- }
74631
74584
  var computeKey = ({ field, args }) => {
74632
74585
  const keys = Object.keys(args ?? {});
74633
74586
  keys.sort();
@@ -77816,194 +77769,6 @@ function defaultComponentField({
77816
77769
  }
77817
77770
  var cache_default = new Cache();
77818
77771
  var serverSide = typeof globalThis.window === "undefined";
77819
- var documentPlugin = (kind, source) => {
77820
- return () => {
77821
- const sourceHandlers = source();
77822
- const enterWrapper = (handler) => {
77823
- return !handler ? void 0 : (ctx, handlers) => {
77824
- if (ctx.artifact.kind !== kind) {
77825
- return handlers.next(ctx);
77826
- }
77827
- return handler(ctx, handlers);
77828
- };
77829
- };
77830
- const exitWrapper = (handler) => {
77831
- return !handler ? void 0 : (ctx, handlers) => {
77832
- if (ctx.artifact.kind !== kind) {
77833
- return handlers.resolve(ctx);
77834
- }
77835
- return handler(ctx, handlers);
77836
- };
77837
- };
77838
- return {
77839
- start: enterWrapper(sourceHandlers.start),
77840
- network: enterWrapper(sourceHandlers.network),
77841
- afterNetwork: exitWrapper(sourceHandlers.afterNetwork),
77842
- end: exitWrapper(sourceHandlers.end),
77843
- catch: sourceHandlers.catch ? (ctx, handlers) => sourceHandlers.catch(ctx, handlers) : void 0,
77844
- cleanup: (...args) => sourceHandlers.cleanup?.(...args)
77845
- };
77846
- };
77847
- };
77848
- var query = documentPlugin(ArtifactKind.Query, function() {
77849
- let subscriptionSpec = null;
77850
- let lastVariables = null;
77851
- return {
77852
- start(ctx, { next }) {
77853
- const runtimeScalarPayload = {
77854
- session: ctx.session
77855
- };
77856
- ctx.variables = {
77857
- ...lastVariables,
77858
- ...Object.fromEntries(
77859
- Object.entries(ctx.artifact.input?.runtimeScalars ?? {}).map(
77860
- ([field, type]) => {
77861
- const runtimeScalar = ctx.config.features?.runtimeScalars?.[type];
77862
- if (!runtimeScalar) {
77863
- return [field, type];
77864
- }
77865
- return [field, runtimeScalar.resolve(runtimeScalarPayload)];
77866
- }
77867
- )
77868
- ),
77869
- ...ctx.variables
77870
- };
77871
- next(ctx);
77872
- },
77873
- end(ctx, { resolve: resolve2, marshalVariables: marshalVariables2, variablesChanged: variablesChanged2 }) {
77874
- if (variablesChanged2(ctx) && !ctx.cacheParams?.disableSubscriptions) {
77875
- if (subscriptionSpec) {
77876
- cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
77877
- }
77878
- lastVariables = { ...marshalVariables2(ctx) };
77879
- const variables = lastVariables;
77880
- subscriptionSpec = {
77881
- rootType: ctx.artifact.rootType,
77882
- selection: ctx.artifact.selection,
77883
- variables: () => variables,
77884
- set: (newValue) => {
77885
- resolve2(ctx, {
77886
- data: newValue,
77887
- errors: null,
77888
- fetching: false,
77889
- partial: false,
77890
- stale: false,
77891
- source: DataSource.Cache,
77892
- variables: ctx.variables ?? {}
77893
- });
77894
- }
77895
- };
77896
- cache_default.subscribe(subscriptionSpec, lastVariables);
77897
- }
77898
- resolve2(ctx);
77899
- },
77900
- cleanup() {
77901
- if (subscriptionSpec) {
77902
- cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.());
77903
- lastVariables = null;
77904
- }
77905
- }
77906
- };
77907
- });
77908
- var fragment = documentPlugin(ArtifactKind.Fragment, function() {
77909
- let subscriptionSpec = null;
77910
- let lastReference = null;
77911
- return {
77912
- start(ctx, { next, resolve: resolve2, variablesChanged: variablesChanged2, marshalVariables: marshalVariables2 }) {
77913
- if (!ctx.stuff.parentID) {
77914
- return next(ctx);
77915
- }
77916
- const currentReference = {
77917
- parent: ctx.stuff.parentID,
77918
- variables: marshalVariables2(ctx)
77919
- };
77920
- if (!ctx.cacheParams?.disableSubscriptions && (!deepEquals(lastReference, currentReference) || variablesChanged2(ctx))) {
77921
- if (subscriptionSpec) {
77922
- cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
77923
- }
77924
- const variables = marshalVariables2(ctx);
77925
- subscriptionSpec = {
77926
- rootType: ctx.artifact.rootType,
77927
- selection: ctx.artifact.selection,
77928
- variables: () => variables,
77929
- parentID: ctx.stuff.parentID,
77930
- set: (newValue) => {
77931
- resolve2(ctx, {
77932
- data: newValue,
77933
- errors: null,
77934
- fetching: false,
77935
- partial: false,
77936
- stale: false,
77937
- source: DataSource.Cache,
77938
- variables
77939
- });
77940
- }
77941
- };
77942
- cache_default.subscribe(subscriptionSpec, variables);
77943
- lastReference = currentReference;
77944
- }
77945
- next(ctx);
77946
- },
77947
- cleanup() {
77948
- if (subscriptionSpec) {
77949
- cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.());
77950
- }
77951
- }
77952
- };
77953
- });
77954
- var mutation = documentPlugin(ArtifactKind.Mutation, () => {
77955
- return {
77956
- async start(ctx, { next, marshalVariables: marshalVariables2 }) {
77957
- const layerOptimistic = cache_default._internal_unstable.storage.createLayer(true);
77958
- const optimisticResponse = ctx.stuff.optimisticResponse;
77959
- let toNotify = [];
77960
- if (optimisticResponse) {
77961
- toNotify = cache_default.write({
77962
- selection: ctx.artifact.selection,
77963
- data: await marshalSelection({
77964
- selection: ctx.artifact.selection,
77965
- data: optimisticResponse
77966
- }),
77967
- variables: marshalVariables2(ctx),
77968
- layer: layerOptimistic.id
77969
- });
77970
- }
77971
- ctx.cacheParams = {
77972
- ...ctx.cacheParams,
77973
- layer: layerOptimistic,
77974
- notifySubscribers: toNotify,
77975
- forceNotify: true
77976
- };
77977
- next(ctx);
77978
- },
77979
- afterNetwork(ctx, { resolve: resolve2 }) {
77980
- if (ctx.cacheParams?.layer) {
77981
- cache_default.clearLayer(ctx.cacheParams.layer.id);
77982
- }
77983
- resolve2(ctx);
77984
- },
77985
- end(ctx, { resolve: resolve2, value }) {
77986
- const hasErrors = value.errors && value.errors.length > 0;
77987
- if (hasErrors) {
77988
- if (ctx.cacheParams?.layer) {
77989
- cache_default.clearLayer(ctx.cacheParams.layer.id);
77990
- }
77991
- }
77992
- if (ctx.cacheParams?.layer) {
77993
- cache_default._internal_unstable.storage.resolveLayer(ctx.cacheParams.layer.id);
77994
- }
77995
- resolve2(ctx);
77996
- },
77997
- catch(ctx, { error }) {
77998
- if (ctx.cacheParams?.layer) {
77999
- const { layer } = ctx.cacheParams;
78000
- cache_default.clearLayer(layer.id);
78001
- cache_default._internal_unstable.storage.resolveLayer(layer.id);
78002
- }
78003
- throw error;
78004
- }
78005
- };
78006
- });
78007
77772
  var currentDir = dirname((0, import_node_url.fileURLToPath)(import_meta.url));
78008
77773
  var DEFAULT_CONFIG_PATH = join2(process.cwd(), "houdini.config.js");
78009
77774
  var emptySchema = graphql2.buildSchema("type Query { hello: String }");
@@ -78928,12 +78693,12 @@ async function generate_query_wrapper(args) {
78928
78693
  ];
78929
78694
  source.push(`export default ({ children }) => {
78930
78695
  ${""}
78931
- ${page.queries.map((query2) => `const [${query2}$data, ${query2}$handle] = useQueryResult("${query2}")`).join("\n")}
78696
+ ${page.queries.map((query) => `const [${query}$data, ${query}$handle] = useQueryResult("${query}")`).join("\n")}
78932
78697
 
78933
78698
  return (
78934
78699
  <${component_name}
78935
78700
  ${page.queries.map(
78936
- (query2) => [`${query2}={${query2}$data}`, `${query2}$handle={${query2}$handle}`].join(" ")
78701
+ (query) => [`${query}={${query}$data}`, `${query}$handle={${query}$handle}`].join(" ")
78937
78702
  ).join("\n")}
78938
78703
  >
78939
78704
  {children}
@@ -79010,7 +78775,7 @@ async function generate_fallbacks({
79010
78775
  project
79011
78776
  }) {
79012
78777
  const query_map = Object.values(project.layout_queries).concat(Object.values(project.page_queries)).reduce(
79013
- (prev, query2) => ({ ...prev, [query2.name]: query2 }),
78778
+ (prev, query) => ({ ...prev, [query.name]: query }),
79014
78779
  {}
79015
78780
  );
79016
78781
  for (const [id, page] of Object.entries(project.layouts).concat(
@@ -79019,11 +78784,11 @@ async function generate_fallbacks({
79019
78784
  const layout = conventions_exports.is_layout(page.path);
79020
78785
  const which = layout ? "layout" : "page";
79021
78786
  const { required_queries, loading_queries } = page.queries.reduce(
79022
- (prev, query2) => {
79023
- if (query_map[query2].loading) {
79024
- prev.loading_queries.push(query2);
78787
+ (prev, query) => {
78788
+ if (query_map[query].loading) {
78789
+ prev.loading_queries.push(query);
79025
78790
  } else {
79026
- prev.required_queries.push(query2);
78791
+ prev.required_queries.push(query);
79027
78792
  }
79028
78793
  return prev;
79029
78794
  },
@@ -79052,11 +78817,11 @@ async function generate_fallbacks({
79052
78817
  const { artifact_cache } = useRouterContext()
79053
78818
 
79054
78819
  ${""}
79055
- ${page.queries.map((query2) => `const ${query2}_artifact = artifact_cache.get("${query2}")`).join("\n")}
78820
+ ${page.queries.map((query) => `const ${query}_artifact = artifact_cache.get("${query}")`).join("\n")}
79056
78821
 
79057
78822
  ${""}
79058
78823
  ${required_queries.map(
79059
- (query2) => `const [${query2}_data, ${query2}_handle] = useQueryResult("${query2}")`
78824
+ (query) => `const [${query}_data, ${query}_handle] = useQueryResult("${query}")`
79060
78825
  ).join("\n")}
79061
78826
 
79062
78827
  return (
@@ -79416,8 +79181,8 @@ import { DocumentHandle } from '${relative2}/plugins/houdini-react/runtime'
79416
79181
  import React from 'react'
79417
79182
 
79418
79183
  ${all_queries.map(
79419
- (query2) => dedent(`
79420
- import type { ${query2}$result, ${query2}$artifact, ${query2}$input } from '${config.artifactImportPath(query2).replace("$houdini", relative2)}'
79184
+ (query) => dedent(`
79185
+ import type { ${query}$result, ${query}$artifact, ${query}$input } from '${config.artifactImportPath(query).replace("$houdini", relative2)}'
79421
79186
 
79422
79187
  `)
79423
79188
  ).join("\n")}
@@ -79425,8 +79190,8 @@ ${all_queries.map(
79425
79190
  ${`
79426
79191
  export type PageProps = {
79427
79192
  ${!page ? "" : page.query_options.map(
79428
- (query2) => ` ${query2}: ${query2}$result,
79429
- ${query2}$handle: DocumentHandle<${query2}$artifact, ${query2}$result, ${query2}$input>,`
79193
+ (query) => ` ${query}: ${query}$result,
79194
+ ${query}$handle: DocumentHandle<${query}$artifact, ${query}$result, ${query}$input>,`
79430
79195
  ).join("\n")}
79431
79196
  }
79432
79197
  `}
@@ -79435,8 +79200,8 @@ ${`
79435
79200
  export type LayoutProps = {
79436
79201
  children: React.ReactNode,
79437
79202
  ${!layout ? "" : layout.query_options.map(
79438
- (query2) => ` ${query2}: ${query2}$result,
79439
- ${query2}$handle: DocumentHandle<${query2}$artifact, ${query2}$result, ${query2}$input>,`
79203
+ (query) => ` ${query}: ${query}$result,
79204
+ ${query}$handle: DocumentHandle<${query}$artifact, ${query}$result, ${query}$input>,`
79440
79205
  ).join("\n")}
79441
79206
  }
79442
79207
  `}
@@ -79576,12 +79341,12 @@ ${Object.entries(manifest3.pages).map(([id, page]) => {
79576
79341
 
79577
79342
  ${""}
79578
79343
  documents: {
79579
- ${queries.map((query2) => {
79580
- const artifact_path = config.artifactImportPath(query2);
79581
- return `${query2}: {
79344
+ ${queries.map((query) => {
79345
+ const artifact_path = config.artifactImportPath(query);
79346
+ return `${query}: {
79582
79347
  artifact: () => import("${path_exports.relative(from, artifact_path)}"),
79583
- loading: ${JSON.stringify(query_name_map[query2]?.loading)},
79584
- variables: ${JSON.stringify(query_name_map[query2]?.variables)}
79348
+ loading: ${JSON.stringify(query_name_map[query]?.loading)},
79349
+ variables: ${JSON.stringify(query_name_map[query]?.variables)}
79585
79350
  }`;
79586
79351
  }).join(",\n ")}
79587
79352
  },
@@ -79805,12 +79570,12 @@ var vite_default = {
79805
79570
  const queryName = parsedPath.name;
79806
79571
  if (which === "pages") {
79807
79572
  const page = manifest.pages[queryName];
79808
- const pendingQueries = page.queries.filter((query2) => {
79809
- const page2 = Object.values(manifest.page_queries).find((q) => q.name === query2);
79573
+ const pendingQueries = page.queries.filter((query) => {
79574
+ const page2 = Object.values(manifest.page_queries).find((q) => q.name === query);
79810
79575
  if (page2) {
79811
79576
  return page2.loading;
79812
79577
  }
79813
- const layout = Object.values(manifest.layout_queries).find((q) => q.name === query2);
79578
+ const layout = Object.values(manifest.layout_queries).find((q) => q.name === query);
79814
79579
  return layout?.loading;
79815
79580
  });
79816
79581
  return `
@@ -74569,55 +74569,8 @@ var CompiledFragmentKind = ArtifactKind.Fragment;
74569
74569
  var CompiledMutationKind = ArtifactKind.Mutation;
74570
74570
  var CompiledQueryKind = ArtifactKind.Query;
74571
74571
  var CompiledSubscriptionKind = ArtifactKind.Subscription;
74572
- var DataSource = {
74573
- Cache: "cache",
74574
- Network: "network",
74575
- Ssr: "ssr"
74576
- };
74577
74572
  var fragmentKey = " $fragments";
74578
74573
  var PendingValue = Symbol("houdini_loading");
74579
- async function marshalSelection({
74580
- selection,
74581
- data
74582
- }) {
74583
- const config = getCurrentConfig();
74584
- if (data === null || typeof data === "undefined") {
74585
- return data;
74586
- }
74587
- if (Array.isArray(data)) {
74588
- return await Promise.all(data.map((val) => marshalSelection({ selection, data: val })));
74589
- }
74590
- const targetSelection = getFieldsForType(selection, data["__typename"], false);
74591
- return Object.fromEntries(
74592
- await Promise.all(
74593
- Object.entries(data).map(async ([fieldName, value]) => {
74594
- if (fieldName === fragmentKey) {
74595
- return [fieldName, value];
74596
- }
74597
- const { type, selection: selection2 } = targetSelection[fieldName];
74598
- if (!type) {
74599
- return [fieldName, value];
74600
- }
74601
- if (selection2) {
74602
- return [fieldName, await marshalSelection({ selection: selection2, data: value })];
74603
- }
74604
- if (config.scalars?.[type]) {
74605
- const marshalFn = config.scalars[type].marshal;
74606
- if (!marshalFn) {
74607
- throw new Error(
74608
- `scalar type ${type} is missing a \`marshal\` function. see https://github.com/AlecAivazis/houdini#%EF%B8%8Fcustom-scalars`
74609
- );
74610
- }
74611
- if (Array.isArray(value)) {
74612
- return [fieldName, value.map(marshalFn)];
74613
- }
74614
- return [fieldName, marshalFn(value)];
74615
- }
74616
- return [fieldName, value];
74617
- })
74618
- )
74619
- );
74620
- }
74621
74574
  var computeKey = ({ field, args }) => {
74622
74575
  const keys = Object.keys(args ?? {});
74623
74576
  keys.sort();
@@ -77806,194 +77759,6 @@ function defaultComponentField({
77806
77759
  }
77807
77760
  var cache_default = new Cache();
77808
77761
  var serverSide = typeof globalThis.window === "undefined";
77809
- var documentPlugin = (kind, source) => {
77810
- return () => {
77811
- const sourceHandlers = source();
77812
- const enterWrapper = (handler) => {
77813
- return !handler ? void 0 : (ctx, handlers) => {
77814
- if (ctx.artifact.kind !== kind) {
77815
- return handlers.next(ctx);
77816
- }
77817
- return handler(ctx, handlers);
77818
- };
77819
- };
77820
- const exitWrapper = (handler) => {
77821
- return !handler ? void 0 : (ctx, handlers) => {
77822
- if (ctx.artifact.kind !== kind) {
77823
- return handlers.resolve(ctx);
77824
- }
77825
- return handler(ctx, handlers);
77826
- };
77827
- };
77828
- return {
77829
- start: enterWrapper(sourceHandlers.start),
77830
- network: enterWrapper(sourceHandlers.network),
77831
- afterNetwork: exitWrapper(sourceHandlers.afterNetwork),
77832
- end: exitWrapper(sourceHandlers.end),
77833
- catch: sourceHandlers.catch ? (ctx, handlers) => sourceHandlers.catch(ctx, handlers) : void 0,
77834
- cleanup: (...args) => sourceHandlers.cleanup?.(...args)
77835
- };
77836
- };
77837
- };
77838
- var query = documentPlugin(ArtifactKind.Query, function() {
77839
- let subscriptionSpec = null;
77840
- let lastVariables = null;
77841
- return {
77842
- start(ctx, { next }) {
77843
- const runtimeScalarPayload = {
77844
- session: ctx.session
77845
- };
77846
- ctx.variables = {
77847
- ...lastVariables,
77848
- ...Object.fromEntries(
77849
- Object.entries(ctx.artifact.input?.runtimeScalars ?? {}).map(
77850
- ([field, type]) => {
77851
- const runtimeScalar = ctx.config.features?.runtimeScalars?.[type];
77852
- if (!runtimeScalar) {
77853
- return [field, type];
77854
- }
77855
- return [field, runtimeScalar.resolve(runtimeScalarPayload)];
77856
- }
77857
- )
77858
- ),
77859
- ...ctx.variables
77860
- };
77861
- next(ctx);
77862
- },
77863
- end(ctx, { resolve: resolve2, marshalVariables: marshalVariables2, variablesChanged: variablesChanged2 }) {
77864
- if (variablesChanged2(ctx) && !ctx.cacheParams?.disableSubscriptions) {
77865
- if (subscriptionSpec) {
77866
- cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
77867
- }
77868
- lastVariables = { ...marshalVariables2(ctx) };
77869
- const variables = lastVariables;
77870
- subscriptionSpec = {
77871
- rootType: ctx.artifact.rootType,
77872
- selection: ctx.artifact.selection,
77873
- variables: () => variables,
77874
- set: (newValue) => {
77875
- resolve2(ctx, {
77876
- data: newValue,
77877
- errors: null,
77878
- fetching: false,
77879
- partial: false,
77880
- stale: false,
77881
- source: DataSource.Cache,
77882
- variables: ctx.variables ?? {}
77883
- });
77884
- }
77885
- };
77886
- cache_default.subscribe(subscriptionSpec, lastVariables);
77887
- }
77888
- resolve2(ctx);
77889
- },
77890
- cleanup() {
77891
- if (subscriptionSpec) {
77892
- cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.());
77893
- lastVariables = null;
77894
- }
77895
- }
77896
- };
77897
- });
77898
- var fragment = documentPlugin(ArtifactKind.Fragment, function() {
77899
- let subscriptionSpec = null;
77900
- let lastReference = null;
77901
- return {
77902
- start(ctx, { next, resolve: resolve2, variablesChanged: variablesChanged2, marshalVariables: marshalVariables2 }) {
77903
- if (!ctx.stuff.parentID) {
77904
- return next(ctx);
77905
- }
77906
- const currentReference = {
77907
- parent: ctx.stuff.parentID,
77908
- variables: marshalVariables2(ctx)
77909
- };
77910
- if (!ctx.cacheParams?.disableSubscriptions && (!deepEquals(lastReference, currentReference) || variablesChanged2(ctx))) {
77911
- if (subscriptionSpec) {
77912
- cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
77913
- }
77914
- const variables = marshalVariables2(ctx);
77915
- subscriptionSpec = {
77916
- rootType: ctx.artifact.rootType,
77917
- selection: ctx.artifact.selection,
77918
- variables: () => variables,
77919
- parentID: ctx.stuff.parentID,
77920
- set: (newValue) => {
77921
- resolve2(ctx, {
77922
- data: newValue,
77923
- errors: null,
77924
- fetching: false,
77925
- partial: false,
77926
- stale: false,
77927
- source: DataSource.Cache,
77928
- variables
77929
- });
77930
- }
77931
- };
77932
- cache_default.subscribe(subscriptionSpec, variables);
77933
- lastReference = currentReference;
77934
- }
77935
- next(ctx);
77936
- },
77937
- cleanup() {
77938
- if (subscriptionSpec) {
77939
- cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.());
77940
- }
77941
- }
77942
- };
77943
- });
77944
- var mutation = documentPlugin(ArtifactKind.Mutation, () => {
77945
- return {
77946
- async start(ctx, { next, marshalVariables: marshalVariables2 }) {
77947
- const layerOptimistic = cache_default._internal_unstable.storage.createLayer(true);
77948
- const optimisticResponse = ctx.stuff.optimisticResponse;
77949
- let toNotify = [];
77950
- if (optimisticResponse) {
77951
- toNotify = cache_default.write({
77952
- selection: ctx.artifact.selection,
77953
- data: await marshalSelection({
77954
- selection: ctx.artifact.selection,
77955
- data: optimisticResponse
77956
- }),
77957
- variables: marshalVariables2(ctx),
77958
- layer: layerOptimistic.id
77959
- });
77960
- }
77961
- ctx.cacheParams = {
77962
- ...ctx.cacheParams,
77963
- layer: layerOptimistic,
77964
- notifySubscribers: toNotify,
77965
- forceNotify: true
77966
- };
77967
- next(ctx);
77968
- },
77969
- afterNetwork(ctx, { resolve: resolve2 }) {
77970
- if (ctx.cacheParams?.layer) {
77971
- cache_default.clearLayer(ctx.cacheParams.layer.id);
77972
- }
77973
- resolve2(ctx);
77974
- },
77975
- end(ctx, { resolve: resolve2, value }) {
77976
- const hasErrors = value.errors && value.errors.length > 0;
77977
- if (hasErrors) {
77978
- if (ctx.cacheParams?.layer) {
77979
- cache_default.clearLayer(ctx.cacheParams.layer.id);
77980
- }
77981
- }
77982
- if (ctx.cacheParams?.layer) {
77983
- cache_default._internal_unstable.storage.resolveLayer(ctx.cacheParams.layer.id);
77984
- }
77985
- resolve2(ctx);
77986
- },
77987
- catch(ctx, { error }) {
77988
- if (ctx.cacheParams?.layer) {
77989
- const { layer } = ctx.cacheParams;
77990
- cache_default.clearLayer(layer.id);
77991
- cache_default._internal_unstable.storage.resolveLayer(layer.id);
77992
- }
77993
- throw error;
77994
- }
77995
- };
77996
- });
77997
77762
  var currentDir = dirname(fileURLToPath(import.meta.url));
77998
77763
  var DEFAULT_CONFIG_PATH = join2(process.cwd(), "houdini.config.js");
77999
77764
  var emptySchema = graphql2.buildSchema("type Query { hello: String }");
@@ -78918,12 +78683,12 @@ async function generate_query_wrapper(args) {
78918
78683
  ];
78919
78684
  source.push(`export default ({ children }) => {
78920
78685
  ${""}
78921
- ${page.queries.map((query2) => `const [${query2}$data, ${query2}$handle] = useQueryResult("${query2}")`).join("\n")}
78686
+ ${page.queries.map((query) => `const [${query}$data, ${query}$handle] = useQueryResult("${query}")`).join("\n")}
78922
78687
 
78923
78688
  return (
78924
78689
  <${component_name}
78925
78690
  ${page.queries.map(
78926
- (query2) => [`${query2}={${query2}$data}`, `${query2}$handle={${query2}$handle}`].join(" ")
78691
+ (query) => [`${query}={${query}$data}`, `${query}$handle={${query}$handle}`].join(" ")
78927
78692
  ).join("\n")}
78928
78693
  >
78929
78694
  {children}
@@ -79000,7 +78765,7 @@ async function generate_fallbacks({
79000
78765
  project
79001
78766
  }) {
79002
78767
  const query_map = Object.values(project.layout_queries).concat(Object.values(project.page_queries)).reduce(
79003
- (prev, query2) => ({ ...prev, [query2.name]: query2 }),
78768
+ (prev, query) => ({ ...prev, [query.name]: query }),
79004
78769
  {}
79005
78770
  );
79006
78771
  for (const [id, page] of Object.entries(project.layouts).concat(
@@ -79009,11 +78774,11 @@ async function generate_fallbacks({
79009
78774
  const layout = conventions_exports.is_layout(page.path);
79010
78775
  const which = layout ? "layout" : "page";
79011
78776
  const { required_queries, loading_queries } = page.queries.reduce(
79012
- (prev, query2) => {
79013
- if (query_map[query2].loading) {
79014
- prev.loading_queries.push(query2);
78777
+ (prev, query) => {
78778
+ if (query_map[query].loading) {
78779
+ prev.loading_queries.push(query);
79015
78780
  } else {
79016
- prev.required_queries.push(query2);
78781
+ prev.required_queries.push(query);
79017
78782
  }
79018
78783
  return prev;
79019
78784
  },
@@ -79042,11 +78807,11 @@ async function generate_fallbacks({
79042
78807
  const { artifact_cache } = useRouterContext()
79043
78808
 
79044
78809
  ${""}
79045
- ${page.queries.map((query2) => `const ${query2}_artifact = artifact_cache.get("${query2}")`).join("\n")}
78810
+ ${page.queries.map((query) => `const ${query}_artifact = artifact_cache.get("${query}")`).join("\n")}
79046
78811
 
79047
78812
  ${""}
79048
78813
  ${required_queries.map(
79049
- (query2) => `const [${query2}_data, ${query2}_handle] = useQueryResult("${query2}")`
78814
+ (query) => `const [${query}_data, ${query}_handle] = useQueryResult("${query}")`
79050
78815
  ).join("\n")}
79051
78816
 
79052
78817
  return (
@@ -79406,8 +79171,8 @@ import { DocumentHandle } from '${relative2}/plugins/houdini-react/runtime'
79406
79171
  import React from 'react'
79407
79172
 
79408
79173
  ${all_queries.map(
79409
- (query2) => dedent(`
79410
- import type { ${query2}$result, ${query2}$artifact, ${query2}$input } from '${config.artifactImportPath(query2).replace("$houdini", relative2)}'
79174
+ (query) => dedent(`
79175
+ import type { ${query}$result, ${query}$artifact, ${query}$input } from '${config.artifactImportPath(query).replace("$houdini", relative2)}'
79411
79176
 
79412
79177
  `)
79413
79178
  ).join("\n")}
@@ -79415,8 +79180,8 @@ ${all_queries.map(
79415
79180
  ${`
79416
79181
  export type PageProps = {
79417
79182
  ${!page ? "" : page.query_options.map(
79418
- (query2) => ` ${query2}: ${query2}$result,
79419
- ${query2}$handle: DocumentHandle<${query2}$artifact, ${query2}$result, ${query2}$input>,`
79183
+ (query) => ` ${query}: ${query}$result,
79184
+ ${query}$handle: DocumentHandle<${query}$artifact, ${query}$result, ${query}$input>,`
79420
79185
  ).join("\n")}
79421
79186
  }
79422
79187
  `}
@@ -79425,8 +79190,8 @@ ${`
79425
79190
  export type LayoutProps = {
79426
79191
  children: React.ReactNode,
79427
79192
  ${!layout ? "" : layout.query_options.map(
79428
- (query2) => ` ${query2}: ${query2}$result,
79429
- ${query2}$handle: DocumentHandle<${query2}$artifact, ${query2}$result, ${query2}$input>,`
79193
+ (query) => ` ${query}: ${query}$result,
79194
+ ${query}$handle: DocumentHandle<${query}$artifact, ${query}$result, ${query}$input>,`
79430
79195
  ).join("\n")}
79431
79196
  }
79432
79197
  `}
@@ -79566,12 +79331,12 @@ ${Object.entries(manifest3.pages).map(([id, page]) => {
79566
79331
 
79567
79332
  ${""}
79568
79333
  documents: {
79569
- ${queries.map((query2) => {
79570
- const artifact_path = config.artifactImportPath(query2);
79571
- return `${query2}: {
79334
+ ${queries.map((query) => {
79335
+ const artifact_path = config.artifactImportPath(query);
79336
+ return `${query}: {
79572
79337
  artifact: () => import("${path_exports.relative(from, artifact_path)}"),
79573
- loading: ${JSON.stringify(query_name_map[query2]?.loading)},
79574
- variables: ${JSON.stringify(query_name_map[query2]?.variables)}
79338
+ loading: ${JSON.stringify(query_name_map[query]?.loading)},
79339
+ variables: ${JSON.stringify(query_name_map[query]?.variables)}
79575
79340
  }`;
79576
79341
  }).join(",\n ")}
79577
79342
  },
@@ -79795,12 +79560,12 @@ var vite_default = {
79795
79560
  const queryName = parsedPath.name;
79796
79561
  if (which === "pages") {
79797
79562
  const page = manifest.pages[queryName];
79798
- const pendingQueries = page.queries.filter((query2) => {
79799
- const page2 = Object.values(manifest.page_queries).find((q) => q.name === query2);
79563
+ const pendingQueries = page.queries.filter((query) => {
79564
+ const page2 = Object.values(manifest.page_queries).find((q) => q.name === query);
79800
79565
  if (page2) {
79801
79566
  return page2.loading;
79802
79567
  }
79803
- const layout = Object.values(manifest.layout_queries).find((q) => q.name === query2);
79568
+ const layout = Object.values(manifest.layout_queries).find((q) => q.name === query);
79804
79569
  return layout?.loading;
79805
79570
  });
79806
79571
  return `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "houdini-react",
3
- "version": "0.0.0-20240309024236",
3
+ "version": "0.0.0-20240309041323",
4
4
  "description": "The React plugin for houdini",
5
5
  "keywords": [
6
6
  "typescript",
@@ -43,7 +43,7 @@
43
43
  "recast": "^0.23.1",
44
44
  "rollup": "^3.7.4",
45
45
  "use-deep-compare-effect": "^1.8.1",
46
- "houdini": "^0.0.0-20240309024236"
46
+ "houdini": "^0.0.0-20240309041323"
47
47
  },
48
48
  "files": [
49
49
  "build"