houdini-svelte 1.2.0-react.1 → 1.2.1

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.
Files changed (51) hide show
  1. package/README.md +1 -1
  2. package/build/plugin/artifactData.d.ts +1 -0
  3. package/build/plugin/extract.d.ts +8 -5
  4. package/build/plugin/index.d.ts +4 -0
  5. package/build/plugin/kit.d.ts +1 -1
  6. package/build/plugin/validate.d.ts +1 -1
  7. package/build/plugin-cjs/index.js +2931 -2735
  8. package/build/plugin-esm/index.js +2931 -2735
  9. package/build/preprocess-cjs/index.js +2814 -2665
  10. package/build/preprocess-esm/index.js +2814 -2665
  11. package/build/runtime/fragments.d.ts +3 -3
  12. package/build/runtime/index.d.ts +1 -1
  13. package/build/runtime/stores/base.d.ts +5 -3
  14. package/build/runtime/stores/fragment.d.ts +2 -2
  15. package/build/runtime/stores/mutation.d.ts +2 -2
  16. package/build/runtime/stores/pagination/fragment.d.ts +4 -5
  17. package/build/runtime/stores/pagination/query.d.ts +5 -5
  18. package/build/runtime/stores/query.d.ts +2 -2
  19. package/build/runtime/stores/subscription.d.ts +2 -2
  20. package/build/runtime-cjs/fragments.d.ts +3 -3
  21. package/build/runtime-cjs/index.d.ts +1 -1
  22. package/build/runtime-cjs/stores/base.d.ts +5 -3
  23. package/build/runtime-cjs/stores/base.js +4 -1
  24. package/build/runtime-cjs/stores/fragment.d.ts +2 -2
  25. package/build/runtime-cjs/stores/fragment.js +7 -5
  26. package/build/runtime-cjs/stores/mutation.d.ts +2 -2
  27. package/build/runtime-cjs/stores/pagination/fragment.d.ts +4 -5
  28. package/build/runtime-cjs/stores/pagination/fragment.js +1 -2
  29. package/build/runtime-cjs/stores/pagination/query.d.ts +5 -5
  30. package/build/runtime-cjs/stores/pagination/query.js +3 -4
  31. package/build/runtime-cjs/stores/query.d.ts +2 -2
  32. package/build/runtime-cjs/stores/query.js +38 -3
  33. package/build/runtime-cjs/stores/subscription.d.ts +2 -2
  34. package/build/runtime-esm/fragments.d.ts +3 -3
  35. package/build/runtime-esm/index.d.ts +1 -1
  36. package/build/runtime-esm/stores/base.d.ts +5 -3
  37. package/build/runtime-esm/stores/base.js +4 -1
  38. package/build/runtime-esm/stores/fragment.d.ts +2 -2
  39. package/build/runtime-esm/stores/fragment.js +7 -5
  40. package/build/runtime-esm/stores/mutation.d.ts +2 -2
  41. package/build/runtime-esm/stores/pagination/fragment.d.ts +4 -5
  42. package/build/runtime-esm/stores/pagination/fragment.js +1 -2
  43. package/build/runtime-esm/stores/pagination/query.d.ts +5 -5
  44. package/build/runtime-esm/stores/pagination/query.js +0 -1
  45. package/build/runtime-esm/stores/query.d.ts +2 -2
  46. package/build/runtime-esm/stores/query.js +38 -3
  47. package/build/runtime-esm/stores/subscription.d.ts +2 -2
  48. package/build/test/index.d.ts +1 -1
  49. package/build/test-cjs/index.js +6238 -5272
  50. package/build/test-esm/index.js +6238 -5272
  51. package/package.json +5 -2
@@ -2,13 +2,13 @@ import type { Fragment, FragmentArtifact } from '$houdini/runtime/lib/types';
2
2
  import type { Readable } from 'svelte/store';
3
3
  import type { FragmentStore } from './stores';
4
4
  import type { FragmentStorePaginated } from './stores/pagination/fragment';
5
- export declare function fragment<_Fragment extends Fragment<any>>(ref: _Fragment, fragment: FragmentStore<_Fragment['shape'], {}>): Readable<NonNullable<_Fragment['shape']>> & {
5
+ export declare function fragment<_Fragment extends Fragment<any>>(ref: _Fragment, fragment: FragmentStore<_Fragment['shape'], {}>): Readable<Exclude<_Fragment['shape'], undefined>> & {
6
6
  data: Readable<_Fragment>;
7
7
  artifact: FragmentArtifact;
8
8
  };
9
- export declare function fragment<_Fragment extends Fragment<any>>(ref: _Fragment | null, fragment: FragmentStore<_Fragment['shape'], {}>): Readable<NonNullable<_Fragment['shape']> | null> & {
9
+ export declare function fragment<_Fragment extends Fragment<any>>(ref: _Fragment | null | undefined, fragment: FragmentStore<_Fragment['shape'], {}>): Readable<Exclude<_Fragment['shape'], undefined> | null> & {
10
10
  data: Readable<_Fragment | null>;
11
11
  artifact: FragmentArtifact;
12
12
  };
13
- export declare function paginatedFragment<_Fragment extends Fragment<any>>(initialValue: _Fragment | null, document: FragmentStore<_Fragment['shape'], {}>): FragmentStorePaginated<_Fragment['shape'], {}>;
13
+ export declare function paginatedFragment<_Fragment extends Fragment<any>>(initialValue: _Fragment | null | undefined, document: FragmentStore<_Fragment['shape'], {}>): FragmentStorePaginated<_Fragment['shape'], {}>;
14
14
  export declare function paginatedFragment<_Fragment extends Fragment<any>>(initialValue: _Fragment, document: FragmentStore<_Fragment['shape'], {}>): FragmentStorePaginated<_Fragment['shape'], {}>;
@@ -1,4 +1,4 @@
1
- import { QueryStore } from './stores';
1
+ import type { QueryStore } from './stores';
2
2
  export * from './adapter';
3
3
  export * from './stores';
4
4
  export * from './fragments';
@@ -1,11 +1,13 @@
1
1
  import { DocumentStore, type ObserveParams } from '$houdini/runtime/client';
2
- import type { GraphQLObject, DocumentArtifact, QueryResult } from '$houdini/runtime/lib/types';
2
+ import type { GraphQLObject, DocumentArtifact, QueryResult, GraphQLVariables } from '$houdini/runtime/lib/types';
3
3
  import type { Readable } from 'svelte/store';
4
- export declare class BaseStore<_Data extends GraphQLObject, _Input extends {}, _Artifact extends DocumentArtifact = DocumentArtifact> {
4
+ export declare class BaseStore<_Data extends GraphQLObject, _Input extends GraphQLVariables, _Artifact extends DocumentArtifact = DocumentArtifact> {
5
5
  #private;
6
6
  get artifact(): _Artifact;
7
7
  get name(): string;
8
- constructor(params: ObserveParams<_Data, _Artifact>);
8
+ constructor(params: ObserveParams<_Data, _Artifact> & {
9
+ initialize?: boolean;
10
+ });
9
11
  get observer(): DocumentStore<_Data, _Input>;
10
12
  subscribe(...args: Parameters<Readable<QueryResult<_Data, _Input>>['subscribe']>): () => void;
11
13
  setup(init?: boolean): void;
@@ -1,7 +1,7 @@
1
- import type { GraphQLObject, FragmentArtifact, HoudiniFetchContext } from '$houdini/runtime/lib/types';
1
+ import type { GraphQLObject, FragmentArtifact, HoudiniFetchContext, GraphQLVariables } from '$houdini/runtime/lib/types';
2
2
  import { fragmentKey } from '$houdini/runtime/lib/types';
3
3
  import type { FragmentStoreInstance } from '../types';
4
- export declare class FragmentStore<_Data extends GraphQLObject, _ReferenceType extends {}, _Input extends {} = {}> {
4
+ export declare class FragmentStore<_Data extends GraphQLObject, _ReferenceType extends {}, _Input extends GraphQLVariables = GraphQLVariables> {
5
5
  artifact: FragmentArtifact;
6
6
  name: string;
7
7
  kind: "HoudiniFragment";
@@ -1,7 +1,7 @@
1
- import type { MutationArtifact, GraphQLObject, QueryResult } from '$houdini/runtime/lib/types';
1
+ import type { MutationArtifact, GraphQLObject, QueryResult, GraphQLVariables } from '$houdini/runtime/lib/types';
2
2
  import type { RequestEvent } from '@sveltejs/kit';
3
3
  import { BaseStore } from './base';
4
- export declare class MutationStore<_Data extends GraphQLObject, _Input extends {}, _Optimistic extends GraphQLObject> extends BaseStore<_Data, _Input, MutationArtifact> {
4
+ export declare class MutationStore<_Data extends GraphQLObject, _Input extends GraphQLVariables, _Optimistic extends GraphQLObject> extends BaseStore<_Data, _Input, MutationArtifact> {
5
5
  kind: "HoudiniMutation";
6
6
  mutate(variables: _Input, { metadata, fetch, event, ...mutationConfig }?: {
7
7
  metadata?: App.Metadata;
@@ -1,6 +1,5 @@
1
1
  import type { DocumentStore } from '$houdini/runtime/client';
2
- import type { FragmentArtifact, GraphQLObject, HoudiniFetchContext, QueryArtifact, PageInfo } from '$houdini/runtime/lib/types';
3
- import { CursorHandlers } from '$houdini/runtime/lib/types';
2
+ import type { FragmentArtifact, GraphQLObject, HoudiniFetchContext, QueryArtifact, PageInfo, CursorHandlers, GraphQLVariables } from '$houdini/runtime/lib/types';
4
3
  import type { Readable, Subscriber } from 'svelte/store';
5
4
  import type { OffsetFragmentStoreInstance } from '../../types';
6
5
  import type { StoreConfig } from '../query';
@@ -16,7 +15,7 @@ declare class BasePaginatedFragmentStore<_Data extends GraphQLObject, _Input> {
16
15
  constructor(config: FragmentStoreConfig<_Data, _Input>);
17
16
  protected queryVariables(getState: () => _Data | null): _Input;
18
17
  }
19
- export declare class FragmentStoreCursor<_Data extends GraphQLObject, _Input extends Record<string, any>> extends BasePaginatedFragmentStore<_Data, _Input> {
18
+ export declare class FragmentStoreCursor<_Data extends GraphQLObject, _Input extends GraphQLVariables> extends BasePaginatedFragmentStore<_Data, _Input> {
20
19
  get(initialValue: _Data | null): {
21
20
  kind: "HoudiniFragment";
22
21
  subscribe: (run: Subscriber<FragmentPaginatedResult<_Data, {
@@ -38,9 +37,9 @@ export declare class FragmentStoreCursor<_Data extends GraphQLObject, _Input ext
38
37
  metadata?: {} | undefined;
39
38
  } | undefined) => Promise<void>;
40
39
  };
41
- protected storeHandlers(observer: DocumentStore<_Data, _Input>, initialValue: _Data | null, getState: () => _Data | null, getVariables: () => _Input): CursorHandlers<_Data, _Input>;
40
+ protected storeHandlers(observer: DocumentStore<_Data, _Input>, initialValue: _Data | null, getState: () => _Data | null, getVariables: () => NonNullable<_Input>): CursorHandlers<_Data, _Input>;
42
41
  }
43
- export declare class FragmentStoreOffset<_Data extends GraphQLObject, _Input extends Record<string, any>> extends BasePaginatedFragmentStore<_Data, _Input> {
42
+ export declare class FragmentStoreOffset<_Data extends GraphQLObject, _Input extends GraphQLVariables> extends BasePaginatedFragmentStore<_Data, _Input> {
44
43
  get(initialValue: _Data | null): OffsetFragmentStoreInstance<_Data, _Input>;
45
44
  }
46
45
  export type FragmentStorePaginated<_Data extends GraphQLObject, _Input> = Readable<{
@@ -1,12 +1,12 @@
1
- import type { GraphQLObject, QueryArtifact, QueryResult, CursorHandlers, OffsetHandlers, PageInfo } from '$houdini/runtime/lib/types';
1
+ import type { GraphQLObject, QueryArtifact, QueryResult, CursorHandlers, OffsetHandlers, PageInfo, GraphQLVariables } from '$houdini/runtime/lib/types';
2
2
  import type { Subscriber } from 'svelte/store';
3
3
  import type { ClientFetchParams, LoadEventFetchParams, QueryStoreFetchParams, RequestEventFetchParams } from '../../types';
4
- import { StoreConfig } from '../query';
4
+ import type { StoreConfig } from '../query';
5
5
  import { QueryStore } from '../query';
6
- export type CursorStoreResult<_Data extends GraphQLObject, _Input extends {}> = QueryResult<_Data, _Input> & {
6
+ export type CursorStoreResult<_Data extends GraphQLObject, _Input extends GraphQLVariables> = QueryResult<_Data, _Input> & {
7
7
  pageInfo: PageInfo;
8
8
  };
9
- export declare class QueryStoreCursor<_Data extends GraphQLObject, _Input extends {}> extends QueryStore<_Data, _Input> {
9
+ export declare class QueryStoreCursor<_Data extends GraphQLObject, _Input extends GraphQLVariables> extends QueryStore<_Data, _Input> {
10
10
  #private;
11
11
  paginated: boolean;
12
12
  constructor(config: StoreConfig<_Data, _Input, QueryArtifact>);
@@ -18,7 +18,7 @@ export declare class QueryStoreCursor<_Data extends GraphQLObject, _Input extend
18
18
  loadNextPage(args?: Parameters<CursorHandlers<_Data, _Input>['loadNextPage']>[0]): Promise<void>;
19
19
  subscribe(run: Subscriber<CursorStoreResult<_Data, _Input>>, invalidate?: ((value?: CursorStoreResult<_Data, _Input> | undefined) => void) | undefined): () => void;
20
20
  }
21
- export declare class QueryStoreOffset<_Data extends GraphQLObject, _Input extends {}> extends QueryStore<_Data, _Input> {
21
+ export declare class QueryStoreOffset<_Data extends GraphQLObject, _Input extends GraphQLVariables> extends QueryStore<_Data, _Input> {
22
22
  #private;
23
23
  paginated: boolean;
24
24
  loadNextPage(args?: Parameters<OffsetHandlers<_Data, _Input>['loadNextPage']>[0]): Promise<void>;
@@ -1,9 +1,9 @@
1
1
  import type { FetchContext } from '$houdini/runtime/client/plugins/fetch';
2
- import type { GraphQLObject, MutationArtifact, QueryArtifact, QueryResult, CachePolicies } from '$houdini/runtime/lib/types';
2
+ import type { CachePolicies, GraphQLVariables, GraphQLObject, MutationArtifact, QueryArtifact, QueryResult } from '$houdini/runtime/lib/types';
3
3
  import type { PluginArtifactData } from '../../plugin/artifactData';
4
4
  import type { ClientFetchParams, LoadEventFetchParams, QueryStoreFetchParams, RequestEventFetchParams } from '../types';
5
5
  import { BaseStore } from './base';
6
- export declare class QueryStore<_Data extends GraphQLObject, _Input extends {}> extends BaseStore<_Data, _Input, QueryArtifact> {
6
+ export declare class QueryStore<_Data extends GraphQLObject, _Input extends GraphQLVariables> extends BaseStore<_Data, _Input, QueryArtifact> {
7
7
  variables: boolean;
8
8
  kind: "HoudiniQuery";
9
9
  protected loadPending: boolean;
@@ -1,8 +1,8 @@
1
- import type { QueryResult, SubscriptionArtifact } from '$houdini/runtime/lib/types';
1
+ import type { GraphQLVariables, QueryResult, SubscriptionArtifact } from '$houdini/runtime/lib/types';
2
2
  import type { GraphQLObject } from 'houdini';
3
3
  import { type Subscriber, type Writable } from 'svelte/store';
4
4
  import { BaseStore } from './base';
5
- export declare class SubscriptionStore<_Data extends GraphQLObject, _Input extends {}> extends BaseStore<_Data, _Input, SubscriptionArtifact> {
5
+ export declare class SubscriptionStore<_Data extends GraphQLObject, _Input extends GraphQLVariables> extends BaseStore<_Data, _Input, SubscriptionArtifact> {
6
6
  kind: "HoudiniSubscription";
7
7
  fetchingStore: Writable<boolean>;
8
8
  constructor({ artifact }: {
@@ -2,13 +2,13 @@ import type { Fragment, FragmentArtifact } from '$houdini/runtime/lib/types';
2
2
  import type { Readable } from 'svelte/store';
3
3
  import type { FragmentStore } from './stores';
4
4
  import type { FragmentStorePaginated } from './stores/pagination/fragment';
5
- export declare function fragment<_Fragment extends Fragment<any>>(ref: _Fragment, fragment: FragmentStore<_Fragment['shape'], {}>): Readable<NonNullable<_Fragment['shape']>> & {
5
+ export declare function fragment<_Fragment extends Fragment<any>>(ref: _Fragment, fragment: FragmentStore<_Fragment['shape'], {}>): Readable<Exclude<_Fragment['shape'], undefined>> & {
6
6
  data: Readable<_Fragment>;
7
7
  artifact: FragmentArtifact;
8
8
  };
9
- export declare function fragment<_Fragment extends Fragment<any>>(ref: _Fragment | null, fragment: FragmentStore<_Fragment['shape'], {}>): Readable<NonNullable<_Fragment['shape']> | null> & {
9
+ export declare function fragment<_Fragment extends Fragment<any>>(ref: _Fragment | null | undefined, fragment: FragmentStore<_Fragment['shape'], {}>): Readable<Exclude<_Fragment['shape'], undefined> | null> & {
10
10
  data: Readable<_Fragment | null>;
11
11
  artifact: FragmentArtifact;
12
12
  };
13
- export declare function paginatedFragment<_Fragment extends Fragment<any>>(initialValue: _Fragment | null, document: FragmentStore<_Fragment['shape'], {}>): FragmentStorePaginated<_Fragment['shape'], {}>;
13
+ export declare function paginatedFragment<_Fragment extends Fragment<any>>(initialValue: _Fragment | null | undefined, document: FragmentStore<_Fragment['shape'], {}>): FragmentStorePaginated<_Fragment['shape'], {}>;
14
14
  export declare function paginatedFragment<_Fragment extends Fragment<any>>(initialValue: _Fragment, document: FragmentStore<_Fragment['shape'], {}>): FragmentStorePaginated<_Fragment['shape'], {}>;
@@ -1,4 +1,4 @@
1
- import { QueryStore } from './stores';
1
+ import type { QueryStore } from './stores';
2
2
  export * from './adapter';
3
3
  export * from './stores';
4
4
  export * from './fragments';
@@ -1,11 +1,13 @@
1
1
  import { DocumentStore, type ObserveParams } from '$houdini/runtime/client';
2
- import type { GraphQLObject, DocumentArtifact, QueryResult } from '$houdini/runtime/lib/types';
2
+ import type { GraphQLObject, DocumentArtifact, QueryResult, GraphQLVariables } from '$houdini/runtime/lib/types';
3
3
  import type { Readable } from 'svelte/store';
4
- export declare class BaseStore<_Data extends GraphQLObject, _Input extends {}, _Artifact extends DocumentArtifact = DocumentArtifact> {
4
+ export declare class BaseStore<_Data extends GraphQLObject, _Input extends GraphQLVariables, _Artifact extends DocumentArtifact = DocumentArtifact> {
5
5
  #private;
6
6
  get artifact(): _Artifact;
7
7
  get name(): string;
8
- constructor(params: ObserveParams<_Data, _Artifact>);
8
+ constructor(params: ObserveParams<_Data, _Artifact> & {
9
+ initialize?: boolean;
10
+ });
9
11
  get observer(): DocumentStore<_Data, _Input>;
10
12
  subscribe(...args: Parameters<Readable<QueryResult<_Data, _Input>>['subscribe']>): () => void;
11
13
  setup(init?: boolean): void;
@@ -36,6 +36,9 @@ class BaseStore {
36
36
  #store;
37
37
  #unsubscribe = null;
38
38
  constructor(params) {
39
+ if (typeof params.initialize === "undefined") {
40
+ params.initialize = true;
41
+ }
39
42
  this.#store = new import_client.DocumentStore({
40
43
  artifact: params.artifact,
41
44
  client: null,
@@ -82,7 +85,7 @@ class BaseStore {
82
85
  this.#unsubscribe = this.observer.subscribe((value) => {
83
86
  this.#store.set(value);
84
87
  });
85
- if (init) {
88
+ if (init && this.#params.initialize) {
86
89
  return this.observer.send({
87
90
  setup: true,
88
91
  variables: (0, import_store.get)(this.observer).variables
@@ -1,7 +1,7 @@
1
- import type { GraphQLObject, FragmentArtifact, HoudiniFetchContext } from '$houdini/runtime/lib/types';
1
+ import type { GraphQLObject, FragmentArtifact, HoudiniFetchContext, GraphQLVariables } from '$houdini/runtime/lib/types';
2
2
  import { fragmentKey } from '$houdini/runtime/lib/types';
3
3
  import type { FragmentStoreInstance } from '../types';
4
- export declare class FragmentStore<_Data extends GraphQLObject, _ReferenceType extends {}, _Input extends {} = {}> {
4
+ export declare class FragmentStore<_Data extends GraphQLObject, _ReferenceType extends {}, _Input extends GraphQLVariables = GraphQLVariables> {
5
5
  artifact: FragmentArtifact;
6
6
  name: string;
7
7
  kind: "HoudiniFragment";
@@ -44,26 +44,28 @@ class FragmentStore {
44
44
  this.name = storeName;
45
45
  }
46
46
  get(initialValue) {
47
- const { variables, parent } = initialValue?.[import_types.fragmentKey]?.[this.artifact.name] ?? {};
48
- if (initialValue && import_types.fragmentKey in initialValue && (!variables || !parent) && import_adapter.isBrowser) {
47
+ const { variables, parent } = initialValue?.[import_types.fragmentKey]?.values?.[this.artifact.name] ?? {};
48
+ const { loading } = initialValue?.[import_types.fragmentKey] ?? {};
49
+ if (!loading && initialValue && import_types.fragmentKey in initialValue && (!variables || !parent) && import_adapter.isBrowser) {
49
50
  console.warn(
50
51
  `\u26A0\uFE0F Parent does not contain the information for this fragment. Something is wrong.
51
52
  Please ensure that you have passed a record that has ${this.artifact.name} mixed into it.`
52
53
  );
53
54
  }
54
55
  let data = initialValue;
55
- if (initialValue && parent && import_adapter.isBrowser) {
56
+ if (loading || initialValue && parent && import_adapter.isBrowser) {
56
57
  data = import_cache.default.read({
57
58
  selection: this.artifact.selection,
58
59
  parent,
59
- variables
60
+ variables,
61
+ loading
60
62
  }).data;
61
63
  }
62
64
  const store = new import_base.BaseStore({
63
65
  artifact: this.artifact,
64
66
  initialValue: data
65
67
  });
66
- if (parent) {
68
+ if (!loading && parent) {
67
69
  store.observer.send({ variables, setup: true, stuff: { parentID: parent } });
68
70
  }
69
71
  return {
@@ -1,7 +1,7 @@
1
- import type { MutationArtifact, GraphQLObject, QueryResult } from '$houdini/runtime/lib/types';
1
+ import type { MutationArtifact, GraphQLObject, QueryResult, GraphQLVariables } from '$houdini/runtime/lib/types';
2
2
  import type { RequestEvent } from '@sveltejs/kit';
3
3
  import { BaseStore } from './base';
4
- export declare class MutationStore<_Data extends GraphQLObject, _Input extends {}, _Optimistic extends GraphQLObject> extends BaseStore<_Data, _Input, MutationArtifact> {
4
+ export declare class MutationStore<_Data extends GraphQLObject, _Input extends GraphQLVariables, _Optimistic extends GraphQLObject> extends BaseStore<_Data, _Input, MutationArtifact> {
5
5
  kind: "HoudiniMutation";
6
6
  mutate(variables: _Input, { metadata, fetch, event, ...mutationConfig }?: {
7
7
  metadata?: App.Metadata;
@@ -1,6 +1,5 @@
1
1
  import type { DocumentStore } from '$houdini/runtime/client';
2
- import type { FragmentArtifact, GraphQLObject, HoudiniFetchContext, QueryArtifact, PageInfo } from '$houdini/runtime/lib/types';
3
- import { CursorHandlers } from '$houdini/runtime/lib/types';
2
+ import type { FragmentArtifact, GraphQLObject, HoudiniFetchContext, QueryArtifact, PageInfo, CursorHandlers, GraphQLVariables } from '$houdini/runtime/lib/types';
4
3
  import type { Readable, Subscriber } from 'svelte/store';
5
4
  import type { OffsetFragmentStoreInstance } from '../../types';
6
5
  import type { StoreConfig } from '../query';
@@ -16,7 +15,7 @@ declare class BasePaginatedFragmentStore<_Data extends GraphQLObject, _Input> {
16
15
  constructor(config: FragmentStoreConfig<_Data, _Input>);
17
16
  protected queryVariables(getState: () => _Data | null): _Input;
18
17
  }
19
- export declare class FragmentStoreCursor<_Data extends GraphQLObject, _Input extends Record<string, any>> extends BasePaginatedFragmentStore<_Data, _Input> {
18
+ export declare class FragmentStoreCursor<_Data extends GraphQLObject, _Input extends GraphQLVariables> extends BasePaginatedFragmentStore<_Data, _Input> {
20
19
  get(initialValue: _Data | null): {
21
20
  kind: "HoudiniFragment";
22
21
  subscribe: (run: Subscriber<FragmentPaginatedResult<_Data, {
@@ -38,9 +37,9 @@ export declare class FragmentStoreCursor<_Data extends GraphQLObject, _Input ext
38
37
  metadata?: {} | undefined;
39
38
  } | undefined) => Promise<void>;
40
39
  };
41
- protected storeHandlers(observer: DocumentStore<_Data, _Input>, initialValue: _Data | null, getState: () => _Data | null, getVariables: () => _Input): CursorHandlers<_Data, _Input>;
40
+ protected storeHandlers(observer: DocumentStore<_Data, _Input>, initialValue: _Data | null, getState: () => _Data | null, getVariables: () => NonNullable<_Input>): CursorHandlers<_Data, _Input>;
42
41
  }
43
- export declare class FragmentStoreOffset<_Data extends GraphQLObject, _Input extends Record<string, any>> extends BasePaginatedFragmentStore<_Data, _Input> {
42
+ export declare class FragmentStoreOffset<_Data extends GraphQLObject, _Input extends GraphQLVariables> extends BasePaginatedFragmentStore<_Data, _Input> {
44
43
  get(initialValue: _Data | null): OffsetFragmentStoreInstance<_Data, _Input>;
45
44
  }
46
45
  export type FragmentStorePaginated<_Data extends GraphQLObject, _Input> = Readable<{
@@ -133,8 +133,7 @@ class FragmentStoreCursor extends BasePaginatedFragmentStore {
133
133
  }
134
134
  });
135
135
  },
136
- getSession: import_session.getSession,
137
- storeName: this.name
136
+ getSession: import_session.getSession
138
137
  });
139
138
  }
140
139
  }
@@ -1,12 +1,12 @@
1
- import type { GraphQLObject, QueryArtifact, QueryResult, CursorHandlers, OffsetHandlers, PageInfo } from '$houdini/runtime/lib/types';
1
+ import type { GraphQLObject, QueryArtifact, QueryResult, CursorHandlers, OffsetHandlers, PageInfo, GraphQLVariables } from '$houdini/runtime/lib/types';
2
2
  import type { Subscriber } from 'svelte/store';
3
3
  import type { ClientFetchParams, LoadEventFetchParams, QueryStoreFetchParams, RequestEventFetchParams } from '../../types';
4
- import { StoreConfig } from '../query';
4
+ import type { StoreConfig } from '../query';
5
5
  import { QueryStore } from '../query';
6
- export type CursorStoreResult<_Data extends GraphQLObject, _Input extends {}> = QueryResult<_Data, _Input> & {
6
+ export type CursorStoreResult<_Data extends GraphQLObject, _Input extends GraphQLVariables> = QueryResult<_Data, _Input> & {
7
7
  pageInfo: PageInfo;
8
8
  };
9
- export declare class QueryStoreCursor<_Data extends GraphQLObject, _Input extends {}> extends QueryStore<_Data, _Input> {
9
+ export declare class QueryStoreCursor<_Data extends GraphQLObject, _Input extends GraphQLVariables> extends QueryStore<_Data, _Input> {
10
10
  #private;
11
11
  paginated: boolean;
12
12
  constructor(config: StoreConfig<_Data, _Input, QueryArtifact>);
@@ -18,7 +18,7 @@ export declare class QueryStoreCursor<_Data extends GraphQLObject, _Input extend
18
18
  loadNextPage(args?: Parameters<CursorHandlers<_Data, _Input>['loadNextPage']>[0]): Promise<void>;
19
19
  subscribe(run: Subscriber<CursorStoreResult<_Data, _Input>>, invalidate?: ((value?: CursorStoreResult<_Data, _Input> | undefined) => void) | undefined): () => void;
20
20
  }
21
- export declare class QueryStoreOffset<_Data extends GraphQLObject, _Input extends {}> extends QueryStore<_Data, _Input> {
21
+ export declare class QueryStoreOffset<_Data extends GraphQLObject, _Input extends GraphQLVariables> extends QueryStore<_Data, _Input> {
22
22
  #private;
23
23
  paginated: boolean;
24
24
  loadNextPage(args?: Parameters<OffsetHandlers<_Data, _Input>['loadNextPage']>[0]): Promise<void>;
@@ -27,8 +27,8 @@ var import_pagination = require("$houdini/runtime/lib/pagination");
27
27
  var import_store = require("svelte/store");
28
28
  var import_client = require("../../client");
29
29
  var import_session = require("../../session");
30
- var import_query2 = require("../query");
31
- class QueryStoreCursor extends import_query2.QueryStore {
30
+ var import_query = require("../query");
31
+ class QueryStoreCursor extends import_query.QueryStore {
32
32
  paginated = true;
33
33
  constructor(config) {
34
34
  super(config);
@@ -46,7 +46,6 @@ class QueryStoreCursor extends import_query2.QueryStore {
46
46
  artifact: this.artifact,
47
47
  getState: () => (0, import_store.get)(this.observer).data,
48
48
  getVariables: () => (0, import_store.get)(this.observer).variables,
49
- storeName: this.name,
50
49
  fetch: super.fetch.bind(this),
51
50
  getSession: import_session.getSession,
52
51
  fetchUpdate: async (args, updates) => {
@@ -84,7 +83,7 @@ class QueryStoreCursor extends import_query2.QueryStore {
84
83
  return combined.subscribe(run, invalidate);
85
84
  }
86
85
  }
87
- class QueryStoreOffset extends import_query2.QueryStore {
86
+ class QueryStoreOffset extends import_query.QueryStore {
88
87
  paginated = true;
89
88
  async loadNextPage(args) {
90
89
  const handlers = await this.#handlers();
@@ -1,9 +1,9 @@
1
1
  import type { FetchContext } from '$houdini/runtime/client/plugins/fetch';
2
- import type { GraphQLObject, MutationArtifact, QueryArtifact, QueryResult, CachePolicies } from '$houdini/runtime/lib/types';
2
+ import type { CachePolicies, GraphQLVariables, GraphQLObject, MutationArtifact, QueryArtifact, QueryResult } from '$houdini/runtime/lib/types';
3
3
  import type { PluginArtifactData } from '../../plugin/artifactData';
4
4
  import type { ClientFetchParams, LoadEventFetchParams, QueryStoreFetchParams, RequestEventFetchParams } from '../types';
5
5
  import { BaseStore } from './base';
6
- export declare class QueryStore<_Data extends GraphQLObject, _Input extends {}> extends BaseStore<_Data, _Input, QueryArtifact> {
6
+ export declare class QueryStore<_Data extends GraphQLObject, _Input extends GraphQLVariables> extends BaseStore<_Data, _Input, QueryArtifact> {
7
7
  variables: boolean;
8
8
  kind: "HoudiniQuery";
9
9
  protected loadPending: boolean;
@@ -28,6 +28,7 @@ __export(query_exports, {
28
28
  fetchParams: () => fetchParams
29
29
  });
30
30
  module.exports = __toCommonJS(query_exports);
31
+ var import_config = require("$houdini/runtime/lib/config");
31
32
  var log = __toESM(require("$houdini/runtime/lib/log"), 1);
32
33
  var import_types = require("$houdini/runtime/lib/types");
33
34
  var import_store = require("svelte/store");
@@ -42,12 +43,16 @@ class QueryStore extends import_base.BaseStore {
42
43
  storeName;
43
44
  constructor({ artifact, storeName, variables }) {
44
45
  const fetching = artifact.pluginData["houdini-svelte"]?.isManualLoad !== true;
45
- super({ artifact, fetching });
46
+ super({
47
+ artifact,
48
+ fetching,
49
+ initialize: !artifact.pluginData["houdini-svelte"].isManualLoad
50
+ });
46
51
  this.storeName = storeName;
47
52
  this.variables = variables;
48
53
  }
49
54
  async fetch(args) {
50
- await (0, import_client.initClient)();
55
+ const client = await (0, import_client.initClient)();
51
56
  this.setup(false);
52
57
  const { policy, params, context } = await fetchParams(this.artifact, this.storeName, args);
53
58
  if (!import_adapter.isBrowser && !(params && "fetch" in params) && (!params || !("event" in params))) {
@@ -64,10 +69,40 @@ This will result in duplicate queries. If you are trying to ensure there is alwa
64
69
  if (isComponentFetch) {
65
70
  params.blocking = true;
66
71
  }
72
+ const config = (0, import_config.getCurrentConfig)();
73
+ const config_svelte = config.plugins["houdini-svelte"];
74
+ const pluginArtifact = this.artifact.pluginData["houdini-svelte"];
75
+ let need_to_block = false;
76
+ if (client.throwOnError_operations.includes("all") || client.throwOnError_operations.includes("query")) {
77
+ if (config_svelte.defaultRouteBlocking === false) {
78
+ log.info(
79
+ '[Houdini] \u26A0\uFE0F throwOnError with operation "all" or "query", is not compatible with defaultRouteBlocking set to "false"'
80
+ );
81
+ }
82
+ }
83
+ if (config_svelte.defaultRouteBlocking === true) {
84
+ need_to_block = true;
85
+ }
86
+ if (client.throwOnError_operations.includes("all") || client.throwOnError_operations.includes("query")) {
87
+ need_to_block = true;
88
+ }
89
+ if (pluginArtifact?.set_blocking === true) {
90
+ need_to_block = true;
91
+ } else if (pluginArtifact?.set_blocking === false) {
92
+ need_to_block = false;
93
+ }
94
+ if (params?.blocking === true) {
95
+ need_to_block = true;
96
+ } else if (params?.blocking === false) {
97
+ need_to_block = false;
98
+ }
67
99
  if (isLoadFetch) {
68
100
  this.loadPending = true;
69
101
  }
70
- const fakeAwait = import_adapter.clientStarted && import_adapter.isBrowser && !params?.blocking;
102
+ if (import_adapter.isBrowser && this.artifact.enableLoadingState) {
103
+ need_to_block = false;
104
+ }
105
+ const fakeAwait = import_adapter.clientStarted && import_adapter.isBrowser && !need_to_block;
71
106
  if (policy !== import_types.CachePolicy.NetworkOnly && fakeAwait) {
72
107
  await this.observer.send({
73
108
  fetch: context.fetch,
@@ -1,8 +1,8 @@
1
- import type { QueryResult, SubscriptionArtifact } from '$houdini/runtime/lib/types';
1
+ import type { GraphQLVariables, QueryResult, SubscriptionArtifact } from '$houdini/runtime/lib/types';
2
2
  import type { GraphQLObject } from 'houdini';
3
3
  import { type Subscriber, type Writable } from 'svelte/store';
4
4
  import { BaseStore } from './base';
5
- export declare class SubscriptionStore<_Data extends GraphQLObject, _Input extends {}> extends BaseStore<_Data, _Input, SubscriptionArtifact> {
5
+ export declare class SubscriptionStore<_Data extends GraphQLObject, _Input extends GraphQLVariables> extends BaseStore<_Data, _Input, SubscriptionArtifact> {
6
6
  kind: "HoudiniSubscription";
7
7
  fetchingStore: Writable<boolean>;
8
8
  constructor({ artifact }: {
@@ -2,13 +2,13 @@ import type { Fragment, FragmentArtifact } from '$houdini/runtime/lib/types';
2
2
  import type { Readable } from 'svelte/store';
3
3
  import type { FragmentStore } from './stores';
4
4
  import type { FragmentStorePaginated } from './stores/pagination/fragment';
5
- export declare function fragment<_Fragment extends Fragment<any>>(ref: _Fragment, fragment: FragmentStore<_Fragment['shape'], {}>): Readable<NonNullable<_Fragment['shape']>> & {
5
+ export declare function fragment<_Fragment extends Fragment<any>>(ref: _Fragment, fragment: FragmentStore<_Fragment['shape'], {}>): Readable<Exclude<_Fragment['shape'], undefined>> & {
6
6
  data: Readable<_Fragment>;
7
7
  artifact: FragmentArtifact;
8
8
  };
9
- export declare function fragment<_Fragment extends Fragment<any>>(ref: _Fragment | null, fragment: FragmentStore<_Fragment['shape'], {}>): Readable<NonNullable<_Fragment['shape']> | null> & {
9
+ export declare function fragment<_Fragment extends Fragment<any>>(ref: _Fragment | null | undefined, fragment: FragmentStore<_Fragment['shape'], {}>): Readable<Exclude<_Fragment['shape'], undefined> | null> & {
10
10
  data: Readable<_Fragment | null>;
11
11
  artifact: FragmentArtifact;
12
12
  };
13
- export declare function paginatedFragment<_Fragment extends Fragment<any>>(initialValue: _Fragment | null, document: FragmentStore<_Fragment['shape'], {}>): FragmentStorePaginated<_Fragment['shape'], {}>;
13
+ export declare function paginatedFragment<_Fragment extends Fragment<any>>(initialValue: _Fragment | null | undefined, document: FragmentStore<_Fragment['shape'], {}>): FragmentStorePaginated<_Fragment['shape'], {}>;
14
14
  export declare function paginatedFragment<_Fragment extends Fragment<any>>(initialValue: _Fragment, document: FragmentStore<_Fragment['shape'], {}>): FragmentStorePaginated<_Fragment['shape'], {}>;
@@ -1,4 +1,4 @@
1
- import { QueryStore } from './stores';
1
+ import type { QueryStore } from './stores';
2
2
  export * from './adapter';
3
3
  export * from './stores';
4
4
  export * from './fragments';
@@ -1,11 +1,13 @@
1
1
  import { DocumentStore, type ObserveParams } from '$houdini/runtime/client';
2
- import type { GraphQLObject, DocumentArtifact, QueryResult } from '$houdini/runtime/lib/types';
2
+ import type { GraphQLObject, DocumentArtifact, QueryResult, GraphQLVariables } from '$houdini/runtime/lib/types';
3
3
  import type { Readable } from 'svelte/store';
4
- export declare class BaseStore<_Data extends GraphQLObject, _Input extends {}, _Artifact extends DocumentArtifact = DocumentArtifact> {
4
+ export declare class BaseStore<_Data extends GraphQLObject, _Input extends GraphQLVariables, _Artifact extends DocumentArtifact = DocumentArtifact> {
5
5
  #private;
6
6
  get artifact(): _Artifact;
7
7
  get name(): string;
8
- constructor(params: ObserveParams<_Data, _Artifact>);
8
+ constructor(params: ObserveParams<_Data, _Artifact> & {
9
+ initialize?: boolean;
10
+ });
9
11
  get observer(): DocumentStore<_Data, _Input>;
10
12
  subscribe(...args: Parameters<Readable<QueryResult<_Data, _Input>>['subscribe']>): () => void;
11
13
  setup(init?: boolean): void;
@@ -13,6 +13,9 @@ class BaseStore {
13
13
  #store;
14
14
  #unsubscribe = null;
15
15
  constructor(params) {
16
+ if (typeof params.initialize === "undefined") {
17
+ params.initialize = true;
18
+ }
16
19
  this.#store = new DocumentStore({
17
20
  artifact: params.artifact,
18
21
  client: null,
@@ -59,7 +62,7 @@ class BaseStore {
59
62
  this.#unsubscribe = this.observer.subscribe((value) => {
60
63
  this.#store.set(value);
61
64
  });
62
- if (init) {
65
+ if (init && this.#params.initialize) {
63
66
  return this.observer.send({
64
67
  setup: true,
65
68
  variables: get(this.observer).variables
@@ -1,7 +1,7 @@
1
- import type { GraphQLObject, FragmentArtifact, HoudiniFetchContext } from '$houdini/runtime/lib/types';
1
+ import type { GraphQLObject, FragmentArtifact, HoudiniFetchContext, GraphQLVariables } from '$houdini/runtime/lib/types';
2
2
  import { fragmentKey } from '$houdini/runtime/lib/types';
3
3
  import type { FragmentStoreInstance } from '../types';
4
- export declare class FragmentStore<_Data extends GraphQLObject, _ReferenceType extends {}, _Input extends {} = {}> {
4
+ export declare class FragmentStore<_Data extends GraphQLObject, _ReferenceType extends {}, _Input extends GraphQLVariables = GraphQLVariables> {
5
5
  artifact: FragmentArtifact;
6
6
  name: string;
7
7
  kind: "HoudiniFragment";
@@ -15,26 +15,28 @@ class FragmentStore {
15
15
  this.name = storeName;
16
16
  }
17
17
  get(initialValue) {
18
- const { variables, parent } = initialValue?.[fragmentKey]?.[this.artifact.name] ?? {};
19
- if (initialValue && fragmentKey in initialValue && (!variables || !parent) && isBrowser) {
18
+ const { variables, parent } = initialValue?.[fragmentKey]?.values?.[this.artifact.name] ?? {};
19
+ const { loading } = initialValue?.[fragmentKey] ?? {};
20
+ if (!loading && initialValue && fragmentKey in initialValue && (!variables || !parent) && isBrowser) {
20
21
  console.warn(
21
22
  `\u26A0\uFE0F Parent does not contain the information for this fragment. Something is wrong.
22
23
  Please ensure that you have passed a record that has ${this.artifact.name} mixed into it.`
23
24
  );
24
25
  }
25
26
  let data = initialValue;
26
- if (initialValue && parent && isBrowser) {
27
+ if (loading || initialValue && parent && isBrowser) {
27
28
  data = cache.read({
28
29
  selection: this.artifact.selection,
29
30
  parent,
30
- variables
31
+ variables,
32
+ loading
31
33
  }).data;
32
34
  }
33
35
  const store = new BaseStore({
34
36
  artifact: this.artifact,
35
37
  initialValue: data
36
38
  });
37
- if (parent) {
39
+ if (!loading && parent) {
38
40
  store.observer.send({ variables, setup: true, stuff: { parentID: parent } });
39
41
  }
40
42
  return {
@@ -1,7 +1,7 @@
1
- import type { MutationArtifact, GraphQLObject, QueryResult } from '$houdini/runtime/lib/types';
1
+ import type { MutationArtifact, GraphQLObject, QueryResult, GraphQLVariables } from '$houdini/runtime/lib/types';
2
2
  import type { RequestEvent } from '@sveltejs/kit';
3
3
  import { BaseStore } from './base';
4
- export declare class MutationStore<_Data extends GraphQLObject, _Input extends {}, _Optimistic extends GraphQLObject> extends BaseStore<_Data, _Input, MutationArtifact> {
4
+ export declare class MutationStore<_Data extends GraphQLObject, _Input extends GraphQLVariables, _Optimistic extends GraphQLObject> extends BaseStore<_Data, _Input, MutationArtifact> {
5
5
  kind: "HoudiniMutation";
6
6
  mutate(variables: _Input, { metadata, fetch, event, ...mutationConfig }?: {
7
7
  metadata?: App.Metadata;
@@ -1,6 +1,5 @@
1
1
  import type { DocumentStore } from '$houdini/runtime/client';
2
- import type { FragmentArtifact, GraphQLObject, HoudiniFetchContext, QueryArtifact, PageInfo } from '$houdini/runtime/lib/types';
3
- import { CursorHandlers } from '$houdini/runtime/lib/types';
2
+ import type { FragmentArtifact, GraphQLObject, HoudiniFetchContext, QueryArtifact, PageInfo, CursorHandlers, GraphQLVariables } from '$houdini/runtime/lib/types';
4
3
  import type { Readable, Subscriber } from 'svelte/store';
5
4
  import type { OffsetFragmentStoreInstance } from '../../types';
6
5
  import type { StoreConfig } from '../query';
@@ -16,7 +15,7 @@ declare class BasePaginatedFragmentStore<_Data extends GraphQLObject, _Input> {
16
15
  constructor(config: FragmentStoreConfig<_Data, _Input>);
17
16
  protected queryVariables(getState: () => _Data | null): _Input;
18
17
  }
19
- export declare class FragmentStoreCursor<_Data extends GraphQLObject, _Input extends Record<string, any>> extends BasePaginatedFragmentStore<_Data, _Input> {
18
+ export declare class FragmentStoreCursor<_Data extends GraphQLObject, _Input extends GraphQLVariables> extends BasePaginatedFragmentStore<_Data, _Input> {
20
19
  get(initialValue: _Data | null): {
21
20
  kind: "HoudiniFragment";
22
21
  subscribe: (run: Subscriber<FragmentPaginatedResult<_Data, {
@@ -38,9 +37,9 @@ export declare class FragmentStoreCursor<_Data extends GraphQLObject, _Input ext
38
37
  metadata?: {} | undefined;
39
38
  } | undefined) => Promise<void>;
40
39
  };
41
- protected storeHandlers(observer: DocumentStore<_Data, _Input>, initialValue: _Data | null, getState: () => _Data | null, getVariables: () => _Input): CursorHandlers<_Data, _Input>;
40
+ protected storeHandlers(observer: DocumentStore<_Data, _Input>, initialValue: _Data | null, getState: () => _Data | null, getVariables: () => NonNullable<_Input>): CursorHandlers<_Data, _Input>;
42
41
  }
43
- export declare class FragmentStoreOffset<_Data extends GraphQLObject, _Input extends Record<string, any>> extends BasePaginatedFragmentStore<_Data, _Input> {
42
+ export declare class FragmentStoreOffset<_Data extends GraphQLObject, _Input extends GraphQLVariables> extends BasePaginatedFragmentStore<_Data, _Input> {
44
43
  get(initialValue: _Data | null): OffsetFragmentStoreInstance<_Data, _Input>;
45
44
  }
46
45
  export type FragmentStorePaginated<_Data extends GraphQLObject, _Input> = Readable<{