houdini-svelte 1.0.1 → 1.0.2
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/plugin-cjs/index.js +45 -12
- package/build/plugin-esm/index.js +45 -12
- package/build/runtime/stores/fragment.d.ts +2 -5
- package/build/runtime/stores/pagination/cursor.d.ts +2 -20
- package/build/runtime/stores/pagination/fragment.d.ts +2 -14
- package/build/runtime/stores/pagination/offset.d.ts +0 -9
- package/build/runtime/stores/pagination/query.d.ts +2 -3
- package/build/runtime/types.d.ts +51 -1
- package/build/runtime-cjs/stores/fragment.d.ts +2 -5
- package/build/runtime-cjs/stores/pagination/cursor.d.ts +2 -20
- package/build/runtime-cjs/stores/pagination/cursor.js +1 -1
- package/build/runtime-cjs/stores/pagination/fragment.d.ts +2 -14
- package/build/runtime-cjs/stores/pagination/offset.d.ts +0 -9
- package/build/runtime-cjs/stores/pagination/query.d.ts +2 -3
- package/build/runtime-cjs/types.d.ts +51 -1
- package/build/runtime-esm/stores/fragment.d.ts +2 -5
- package/build/runtime-esm/stores/pagination/cursor.d.ts +2 -20
- package/build/runtime-esm/stores/pagination/cursor.js +1 -1
- package/build/runtime-esm/stores/pagination/fragment.d.ts +2 -14
- package/build/runtime-esm/stores/pagination/offset.d.ts +0 -9
- package/build/runtime-esm/stores/pagination/query.d.ts +2 -3
- package/build/runtime-esm/types.d.ts +51 -1
- package/build/test-cjs/index.js +49 -15
- package/build/test-esm/index.js +49 -15
- package/package.json +2 -2
|
@@ -186275,21 +186275,56 @@ async function fragmentTypedefs(input) {
|
|
|
186275
186275
|
document_input.typeAnnotation = AST15.tsTypeAnnotation(
|
|
186276
186276
|
AST15.tsTypeReference(AST15.identifier(store))
|
|
186277
186277
|
);
|
|
186278
|
-
|
|
186279
|
-
|
|
186280
|
-
|
|
186281
|
-
|
|
186282
|
-
|
|
186283
|
-
|
|
186284
|
-
|
|
186285
|
-
|
|
186286
|
-
|
|
186278
|
+
let store_type = "FragmentStoreInstance";
|
|
186279
|
+
if (doc.refetch?.paginated) {
|
|
186280
|
+
if (doc.refetch.method === "cursor") {
|
|
186281
|
+
store_type = "CursorFragmentStoreInstance";
|
|
186282
|
+
} else {
|
|
186283
|
+
store_type = "OffsetFragmentStoreInstance";
|
|
186284
|
+
}
|
|
186285
|
+
}
|
|
186286
|
+
ensureImports({
|
|
186287
|
+
config: input.config,
|
|
186288
|
+
body: contents.script.body,
|
|
186289
|
+
sourceModule: "./types",
|
|
186290
|
+
import: [store_type],
|
|
186291
|
+
importKind: "type"
|
|
186292
|
+
});
|
|
186287
186293
|
ensureImports({
|
|
186288
186294
|
config: input.config,
|
|
186289
186295
|
body: contents.script.body,
|
|
186290
186296
|
sourceModule: import_path,
|
|
186291
186297
|
import: [store]
|
|
186292
186298
|
});
|
|
186299
|
+
const shapeID = `${doc.name}$data`;
|
|
186300
|
+
const inputID = `${doc.name}$input`;
|
|
186301
|
+
ensureImports({
|
|
186302
|
+
config: input.config,
|
|
186303
|
+
body: contents.script.body,
|
|
186304
|
+
sourceModule: "../../../artifacts/" + doc.name,
|
|
186305
|
+
import: [inputID, shapeID]
|
|
186306
|
+
});
|
|
186307
|
+
const typeParams = [];
|
|
186308
|
+
if (doc.refetch?.paginated) {
|
|
186309
|
+
typeParams.push(AST15.tsTypeReference(AST15.identifier(inputID)));
|
|
186310
|
+
}
|
|
186311
|
+
const return_value = AST15.tsTypeReference(
|
|
186312
|
+
AST15.identifier(store_type),
|
|
186313
|
+
AST15.tsTypeParameterInstantiation([
|
|
186314
|
+
AST15.tsTypeReference(AST15.identifier(shapeID)),
|
|
186315
|
+
...typeParams
|
|
186316
|
+
])
|
|
186317
|
+
);
|
|
186318
|
+
const null_return_value = AST15.tsTypeReference(
|
|
186319
|
+
AST15.identifier(store_type),
|
|
186320
|
+
AST15.tsTypeParameterInstantiation([
|
|
186321
|
+
AST15.tsUnionType([
|
|
186322
|
+
AST15.tsTypeReference(AST15.identifier(shapeID)),
|
|
186323
|
+
AST15.tsNullKeyword()
|
|
186324
|
+
]),
|
|
186325
|
+
...typeParams
|
|
186326
|
+
])
|
|
186327
|
+
);
|
|
186293
186328
|
return [
|
|
186294
186329
|
AST15.exportNamedDeclaration(
|
|
186295
186330
|
AST15.tsDeclareFunction(
|
|
@@ -186302,9 +186337,7 @@ async function fragmentTypedefs(input) {
|
|
|
186302
186337
|
AST15.tsDeclareFunction(
|
|
186303
186338
|
AST15.identifier(which),
|
|
186304
186339
|
[initial_value_or_null_input, document_input],
|
|
186305
|
-
AST15.tsTypeAnnotation(
|
|
186306
|
-
AST15.tsUnionType([return_value, AST15.tsNullKeyword()])
|
|
186307
|
-
)
|
|
186340
|
+
AST15.tsTypeAnnotation(null_return_value)
|
|
186308
186341
|
)
|
|
186309
186342
|
)
|
|
186310
186343
|
];
|
|
@@ -186269,21 +186269,56 @@ async function fragmentTypedefs(input) {
|
|
|
186269
186269
|
document_input.typeAnnotation = AST15.tsTypeAnnotation(
|
|
186270
186270
|
AST15.tsTypeReference(AST15.identifier(store))
|
|
186271
186271
|
);
|
|
186272
|
-
|
|
186273
|
-
|
|
186274
|
-
|
|
186275
|
-
|
|
186276
|
-
|
|
186277
|
-
|
|
186278
|
-
|
|
186279
|
-
|
|
186280
|
-
|
|
186272
|
+
let store_type = "FragmentStoreInstance";
|
|
186273
|
+
if (doc.refetch?.paginated) {
|
|
186274
|
+
if (doc.refetch.method === "cursor") {
|
|
186275
|
+
store_type = "CursorFragmentStoreInstance";
|
|
186276
|
+
} else {
|
|
186277
|
+
store_type = "OffsetFragmentStoreInstance";
|
|
186278
|
+
}
|
|
186279
|
+
}
|
|
186280
|
+
ensureImports({
|
|
186281
|
+
config: input.config,
|
|
186282
|
+
body: contents.script.body,
|
|
186283
|
+
sourceModule: "./types",
|
|
186284
|
+
import: [store_type],
|
|
186285
|
+
importKind: "type"
|
|
186286
|
+
});
|
|
186281
186287
|
ensureImports({
|
|
186282
186288
|
config: input.config,
|
|
186283
186289
|
body: contents.script.body,
|
|
186284
186290
|
sourceModule: import_path,
|
|
186285
186291
|
import: [store]
|
|
186286
186292
|
});
|
|
186293
|
+
const shapeID = `${doc.name}$data`;
|
|
186294
|
+
const inputID = `${doc.name}$input`;
|
|
186295
|
+
ensureImports({
|
|
186296
|
+
config: input.config,
|
|
186297
|
+
body: contents.script.body,
|
|
186298
|
+
sourceModule: "../../../artifacts/" + doc.name,
|
|
186299
|
+
import: [inputID, shapeID]
|
|
186300
|
+
});
|
|
186301
|
+
const typeParams = [];
|
|
186302
|
+
if (doc.refetch?.paginated) {
|
|
186303
|
+
typeParams.push(AST15.tsTypeReference(AST15.identifier(inputID)));
|
|
186304
|
+
}
|
|
186305
|
+
const return_value = AST15.tsTypeReference(
|
|
186306
|
+
AST15.identifier(store_type),
|
|
186307
|
+
AST15.tsTypeParameterInstantiation([
|
|
186308
|
+
AST15.tsTypeReference(AST15.identifier(shapeID)),
|
|
186309
|
+
...typeParams
|
|
186310
|
+
])
|
|
186311
|
+
);
|
|
186312
|
+
const null_return_value = AST15.tsTypeReference(
|
|
186313
|
+
AST15.identifier(store_type),
|
|
186314
|
+
AST15.tsTypeParameterInstantiation([
|
|
186315
|
+
AST15.tsUnionType([
|
|
186316
|
+
AST15.tsTypeReference(AST15.identifier(shapeID)),
|
|
186317
|
+
AST15.tsNullKeyword()
|
|
186318
|
+
]),
|
|
186319
|
+
...typeParams
|
|
186320
|
+
])
|
|
186321
|
+
);
|
|
186287
186322
|
return [
|
|
186288
186323
|
AST15.exportNamedDeclaration(
|
|
186289
186324
|
AST15.tsDeclareFunction(
|
|
@@ -186296,9 +186331,7 @@ async function fragmentTypedefs(input) {
|
|
|
186296
186331
|
AST15.tsDeclareFunction(
|
|
186297
186332
|
AST15.identifier(which),
|
|
186298
186333
|
[initial_value_or_null_input, document_input],
|
|
186299
|
-
AST15.tsTypeAnnotation(
|
|
186300
|
-
AST15.tsUnionType([return_value, AST15.tsNullKeyword()])
|
|
186301
|
-
)
|
|
186334
|
+
AST15.tsTypeAnnotation(null_return_value)
|
|
186302
186335
|
)
|
|
186303
186336
|
)
|
|
186304
186337
|
];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { GraphQLObject, FragmentArtifact, HoudiniFetchContext } from '$houdini/runtime/lib/types';
|
|
2
|
+
import type { FragmentStoreInstance } from '../types';
|
|
2
3
|
export declare class FragmentStore<_Data extends GraphQLObject, _Input = {}> {
|
|
3
4
|
artifact: FragmentArtifact;
|
|
4
5
|
name: string;
|
|
@@ -8,9 +9,5 @@ export declare class FragmentStore<_Data extends GraphQLObject, _Input = {}> {
|
|
|
8
9
|
artifact: FragmentArtifact;
|
|
9
10
|
storeName: string;
|
|
10
11
|
});
|
|
11
|
-
get(initialValue: _Data | null):
|
|
12
|
-
kind: "HoudiniFragment";
|
|
13
|
-
subscribe: (run: import("svelte/store").Subscriber<_Data | null>, invalidate?: ((value?: _Data | null | undefined) => void) | undefined) => import("svelte/store").Unsubscriber;
|
|
14
|
-
update: (val: _Data | null) => void;
|
|
15
|
-
};
|
|
12
|
+
get(initialValue: _Data | null): FragmentStoreInstance<_Data | null>;
|
|
16
13
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import type { DocumentStore } from '$houdini/runtime/client';
|
|
2
2
|
import type { SendParams } from '$houdini/runtime/client/documentStore';
|
|
3
|
-
import type { GraphQLObject, QueryArtifact
|
|
4
|
-
import type {
|
|
5
|
-
import type { QueryStoreFetchParams } from '../query';
|
|
3
|
+
import type { GraphQLObject, QueryArtifact } from '$houdini/runtime/lib/types';
|
|
4
|
+
import type { CursorHandlers } from '../../types';
|
|
6
5
|
import type { FetchFn } from './fetch';
|
|
7
|
-
import type { PageInfo } from './pageInfo';
|
|
8
6
|
export declare function cursorHandlers<_Data extends GraphQLObject, _Input extends Record<string, any>>({ artifact, storeName, observer, fetchUpdate: parentFetchUpdate, fetch: parentFetch, }: {
|
|
9
7
|
artifact: QueryArtifact;
|
|
10
8
|
storeName: string;
|
|
@@ -12,19 +10,3 @@ export declare function cursorHandlers<_Data extends GraphQLObject, _Input exten
|
|
|
12
10
|
fetch: FetchFn<_Data, _Input>;
|
|
13
11
|
fetchUpdate: (arg: SendParams, updates: string[]) => ReturnType<FetchFn<_Data, _Input>>;
|
|
14
12
|
}): CursorHandlers<_Data, _Input>;
|
|
15
|
-
export type CursorHandlers<_Data extends GraphQLObject, _Input> = {
|
|
16
|
-
loadNextPage: (args?: {
|
|
17
|
-
first?: number;
|
|
18
|
-
after?: string;
|
|
19
|
-
fetch?: typeof globalThis.fetch;
|
|
20
|
-
metadata: {};
|
|
21
|
-
}) => Promise<void>;
|
|
22
|
-
loadPreviousPage: (args?: {
|
|
23
|
-
last?: number;
|
|
24
|
-
before?: string;
|
|
25
|
-
fetch?: typeof globalThis.fetch;
|
|
26
|
-
metadata?: {};
|
|
27
|
-
}) => Promise<void>;
|
|
28
|
-
pageInfo: Writable<PageInfo>;
|
|
29
|
-
fetch(args?: QueryStoreFetchParams<_Data, _Input> | undefined): Promise<QueryResult<_Data, _Input>>;
|
|
30
|
-
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { DocumentStore } from '$houdini/runtime/client';
|
|
2
2
|
import type { FragmentArtifact, GraphQLObject, HoudiniFetchContext, QueryArtifact } from '$houdini/runtime/lib/types';
|
|
3
3
|
import type { Readable, Subscriber } from 'svelte/store';
|
|
4
|
+
import type { CursorHandlers, OffsetFragmentStoreInstance } from '../../types';
|
|
4
5
|
import type { StoreConfig } from '../query';
|
|
5
|
-
import type { CursorHandlers } from './cursor';
|
|
6
6
|
import { type PageInfo } from './pageInfo';
|
|
7
7
|
type FragmentStoreConfig<_Data extends GraphQLObject, _Input> = StoreConfig<_Data, _Input, FragmentArtifact> & {
|
|
8
8
|
paginationArtifact: QueryArtifact;
|
|
@@ -43,19 +43,7 @@ export declare class FragmentStoreCursor<_Data extends GraphQLObject, _Input ext
|
|
|
43
43
|
protected storeHandlers(observer: DocumentStore<_Data, _Input>): CursorHandlers<_Data, _Input>;
|
|
44
44
|
}
|
|
45
45
|
export declare class FragmentStoreOffset<_Data extends GraphQLObject, _Input extends Record<string, any>> extends BasePaginatedFragmentStore<_Data, _Input> {
|
|
46
|
-
get(initialValue: _Data | null):
|
|
47
|
-
kind: "HoudiniFragment";
|
|
48
|
-
data: Readable<_Data | null>;
|
|
49
|
-
subscribe: (run: import("$houdini/runtime/lib").Subscriber<import("$houdini/runtime/lib/types").QueryResult<_Data, _Input>>, invalidate?: (value?: import("$houdini/runtime/lib/types").QueryResult<_Data, _Input> | undefined) => void) => import("$houdini/runtime/lib").Unsubscriber;
|
|
50
|
-
fetch: (args?: import("../query").QueryStoreFetchParams<_Data, _Input> | undefined) => Promise<import("$houdini/runtime/lib/types").QueryResult<_Data, _Input>>;
|
|
51
|
-
loadNextPage: ({ limit, offset, fetch, metadata, }?: {
|
|
52
|
-
limit?: number | undefined;
|
|
53
|
-
offset?: number | undefined;
|
|
54
|
-
fetch?: typeof fetch | undefined;
|
|
55
|
-
metadata?: {} | undefined;
|
|
56
|
-
}) => Promise<void>;
|
|
57
|
-
fetching: Readable<boolean>;
|
|
58
|
-
};
|
|
46
|
+
get(initialValue: _Data | null): OffsetFragmentStoreInstance<_Data, _Input>;
|
|
59
47
|
}
|
|
60
48
|
export type FragmentStorePaginated<_Data extends GraphQLObject, _Input> = Readable<{
|
|
61
49
|
data: _Data;
|
|
@@ -18,12 +18,3 @@ export declare function offsetHandlers<_Data extends GraphQLObject, _Input exten
|
|
|
18
18
|
}) => Promise<void>;
|
|
19
19
|
fetch(args?: QueryStoreFetchParams<_Data, _Input>): Promise<QueryResult<_Data, _Input>>;
|
|
20
20
|
};
|
|
21
|
-
export type OffsetHandlers<_Data extends GraphQLObject, _Input, _ReturnType> = {
|
|
22
|
-
loadNextPage: (args?: {
|
|
23
|
-
limit?: number;
|
|
24
|
-
offset?: number;
|
|
25
|
-
metadata?: {};
|
|
26
|
-
fetch?: typeof globalThis.fetch;
|
|
27
|
-
}) => Promise<void>;
|
|
28
|
-
fetch(args?: QueryStoreFetchParams<_Data, _Input> | undefined): Promise<_ReturnType>;
|
|
29
|
-
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { GraphQLObject, QueryArtifact, QueryResult } from '$houdini/runtime/lib/types';
|
|
2
2
|
import type { Subscriber } from 'svelte/store';
|
|
3
|
+
import type { CursorHandlers, OffsetHandlers } from '../../types';
|
|
3
4
|
import type { ClientFetchParams, LoadEventFetchParams, QueryStoreFetchParams, RequestEventFetchParams, StoreConfig } from '../query';
|
|
4
5
|
import { QueryStore } from '../query';
|
|
5
|
-
import type { CursorHandlers } from './cursor';
|
|
6
|
-
import type { OffsetHandlers } from './offset';
|
|
7
6
|
import { type PageInfo } from './pageInfo';
|
|
8
7
|
export type CursorStoreResult<_Data extends GraphQLObject, _Input extends {}> = QueryResult<_Data, _Input> & {
|
|
9
8
|
pageInfo: PageInfo;
|
|
@@ -23,7 +22,7 @@ export declare class QueryStoreCursor<_Data extends GraphQLObject, _Input extend
|
|
|
23
22
|
export declare class QueryStoreOffset<_Data extends GraphQLObject, _Input extends {}> extends QueryStore<_Data, _Input> {
|
|
24
23
|
#private;
|
|
25
24
|
paginated: boolean;
|
|
26
|
-
loadNextPage(args?: Parameters<OffsetHandlers<_Data, _Input
|
|
25
|
+
loadNextPage(args?: Parameters<OffsetHandlers<_Data, _Input>['loadNextPage']>[0]): Promise<void>;
|
|
27
26
|
fetch(params?: RequestEventFetchParams<_Data, _Input>): Promise<QueryResult<_Data, _Input>>;
|
|
28
27
|
fetch(params?: LoadEventFetchParams<_Data, _Input>): Promise<QueryResult<_Data, _Input>>;
|
|
29
28
|
fetch(params?: ClientFetchParams<_Data, _Input>): Promise<QueryResult<_Data, _Input>>;
|
package/build/runtime/types.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import type { FetchQueryResult } from '$houdini/runtime/lib/types';
|
|
1
|
+
import type { FetchQueryResult, CompiledFragmentKind, QueryResult, GraphQLObject } from '$houdini/runtime/lib/types';
|
|
2
2
|
import type { LoadEvent } from '@sveltejs/kit';
|
|
3
|
+
import type { Readable, Writable } from 'svelte/store';
|
|
4
|
+
import type { QueryStoreFetchParams } from './stores';
|
|
5
|
+
import type { PageInfo } from './stores/pagination/pageInfo';
|
|
3
6
|
export type QueryInputs<_Data> = FetchQueryResult<_Data> & {
|
|
4
7
|
variables: {
|
|
5
8
|
[key: string]: any;
|
|
@@ -30,3 +33,50 @@ export type KitLoadResponse = {
|
|
|
30
33
|
context?: Record<string, any>;
|
|
31
34
|
maxage?: number;
|
|
32
35
|
};
|
|
36
|
+
export type FragmentStoreInstance<_Data> = Readable<_Data> & {
|
|
37
|
+
kind: typeof CompiledFragmentKind;
|
|
38
|
+
update: Writable<_Data>['set'];
|
|
39
|
+
};
|
|
40
|
+
type Reshape<_Data, _Input> = Omit<QueryResult<_Data, _Input>, 'data'> & {
|
|
41
|
+
data: _Data;
|
|
42
|
+
};
|
|
43
|
+
export type CursorFragmentStoreInstance<_Data extends GraphQLObject, _Input> = {
|
|
44
|
+
kind: typeof CompiledFragmentKind;
|
|
45
|
+
data: Readable<_Data>;
|
|
46
|
+
subscribe: Readable<Reshape<_Data, _Input> & {
|
|
47
|
+
pageInfo: PageInfo;
|
|
48
|
+
}>['subscribe'];
|
|
49
|
+
fetching: Readable<boolean>;
|
|
50
|
+
} & CursorHandlers<_Data, _Input>;
|
|
51
|
+
export type OffsetFragmentStoreInstance<_Data extends GraphQLObject, _Input> = {
|
|
52
|
+
kind: typeof CompiledFragmentKind;
|
|
53
|
+
data: Readable<_Data>;
|
|
54
|
+
subscribe: Readable<Reshape<_Data, _Input>>['subscribe'];
|
|
55
|
+
fetching: Readable<boolean>;
|
|
56
|
+
} & OffsetHandlers<_Data, _Input>;
|
|
57
|
+
export type CursorHandlers<_Data extends GraphQLObject, _Input> = {
|
|
58
|
+
loadNextPage: (args?: {
|
|
59
|
+
first?: number;
|
|
60
|
+
after?: string;
|
|
61
|
+
fetch?: typeof globalThis.fetch;
|
|
62
|
+
metadata: {};
|
|
63
|
+
}) => Promise<void>;
|
|
64
|
+
loadPreviousPage: (args?: {
|
|
65
|
+
last?: number;
|
|
66
|
+
before?: string;
|
|
67
|
+
fetch?: typeof globalThis.fetch;
|
|
68
|
+
metadata?: {};
|
|
69
|
+
}) => Promise<void>;
|
|
70
|
+
pageInfo: Writable<PageInfo>;
|
|
71
|
+
fetch(args?: QueryStoreFetchParams<_Data, _Input> | undefined): Promise<QueryResult<_Data, _Input>>;
|
|
72
|
+
};
|
|
73
|
+
export type OffsetHandlers<_Data extends GraphQLObject, _Input> = {
|
|
74
|
+
loadNextPage: (args?: {
|
|
75
|
+
limit?: number;
|
|
76
|
+
offset?: number;
|
|
77
|
+
metadata?: {};
|
|
78
|
+
fetch?: typeof globalThis.fetch;
|
|
79
|
+
}) => Promise<void>;
|
|
80
|
+
fetch(args?: QueryStoreFetchParams<_Data, _Input> | undefined): Promise<QueryResult<_Data, _Input>>;
|
|
81
|
+
};
|
|
82
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { GraphQLObject, FragmentArtifact, HoudiniFetchContext } from '$houdini/runtime/lib/types';
|
|
2
|
+
import type { FragmentStoreInstance } from '../types';
|
|
2
3
|
export declare class FragmentStore<_Data extends GraphQLObject, _Input = {}> {
|
|
3
4
|
artifact: FragmentArtifact;
|
|
4
5
|
name: string;
|
|
@@ -8,9 +9,5 @@ export declare class FragmentStore<_Data extends GraphQLObject, _Input = {}> {
|
|
|
8
9
|
artifact: FragmentArtifact;
|
|
9
10
|
storeName: string;
|
|
10
11
|
});
|
|
11
|
-
get(initialValue: _Data | null):
|
|
12
|
-
kind: "HoudiniFragment";
|
|
13
|
-
subscribe: (run: import("svelte/store").Subscriber<_Data | null>, invalidate?: ((value?: _Data | null | undefined) => void) | undefined) => import("svelte/store").Unsubscriber;
|
|
14
|
-
update: (val: _Data | null) => void;
|
|
15
|
-
};
|
|
12
|
+
get(initialValue: _Data | null): FragmentStoreInstance<_Data | null>;
|
|
16
13
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import type { DocumentStore } from '$houdini/runtime/client';
|
|
2
2
|
import type { SendParams } from '$houdini/runtime/client/documentStore';
|
|
3
|
-
import type { GraphQLObject, QueryArtifact
|
|
4
|
-
import type {
|
|
5
|
-
import type { QueryStoreFetchParams } from '../query';
|
|
3
|
+
import type { GraphQLObject, QueryArtifact } from '$houdini/runtime/lib/types';
|
|
4
|
+
import type { CursorHandlers } from '../../types';
|
|
6
5
|
import type { FetchFn } from './fetch';
|
|
7
|
-
import type { PageInfo } from './pageInfo';
|
|
8
6
|
export declare function cursorHandlers<_Data extends GraphQLObject, _Input extends Record<string, any>>({ artifact, storeName, observer, fetchUpdate: parentFetchUpdate, fetch: parentFetch, }: {
|
|
9
7
|
artifact: QueryArtifact;
|
|
10
8
|
storeName: string;
|
|
@@ -12,19 +10,3 @@ export declare function cursorHandlers<_Data extends GraphQLObject, _Input exten
|
|
|
12
10
|
fetch: FetchFn<_Data, _Input>;
|
|
13
11
|
fetchUpdate: (arg: SendParams, updates: string[]) => ReturnType<FetchFn<_Data, _Input>>;
|
|
14
12
|
}): CursorHandlers<_Data, _Input>;
|
|
15
|
-
export type CursorHandlers<_Data extends GraphQLObject, _Input> = {
|
|
16
|
-
loadNextPage: (args?: {
|
|
17
|
-
first?: number;
|
|
18
|
-
after?: string;
|
|
19
|
-
fetch?: typeof globalThis.fetch;
|
|
20
|
-
metadata: {};
|
|
21
|
-
}) => Promise<void>;
|
|
22
|
-
loadPreviousPage: (args?: {
|
|
23
|
-
last?: number;
|
|
24
|
-
before?: string;
|
|
25
|
-
fetch?: typeof globalThis.fetch;
|
|
26
|
-
metadata?: {};
|
|
27
|
-
}) => Promise<void>;
|
|
28
|
-
pageInfo: Writable<PageInfo>;
|
|
29
|
-
fetch(args?: QueryStoreFetchParams<_Data, _Input> | undefined): Promise<QueryResult<_Data, _Input>>;
|
|
30
|
-
};
|
|
@@ -154,7 +154,7 @@ If you think this is an error, please open an issue on GitHub`);
|
|
|
154
154
|
if (count && count > artifact.refetch.pageSize) {
|
|
155
155
|
if (currentPageInfo.hasPreviousPage && currentPageInfo.hasNextPage && !(variables?.["first"] && variables?.["after"] || variables?.["last"] && variables?.["before"])) {
|
|
156
156
|
console.warn(`\u26A0\uFE0F Encountered a fetch() in the middle of the connection.
|
|
157
|
-
Make sure to pass a cursor value by hand that includes the current set (ie the entry before startCursor)
|
|
157
|
+
Make sure to pass a cursor value by hand that includes the current set (ie the entry before startCursor)
|
|
158
158
|
`);
|
|
159
159
|
return observer.state;
|
|
160
160
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { DocumentStore } from '$houdini/runtime/client';
|
|
2
2
|
import type { FragmentArtifact, GraphQLObject, HoudiniFetchContext, QueryArtifact } from '$houdini/runtime/lib/types';
|
|
3
3
|
import type { Readable, Subscriber } from 'svelte/store';
|
|
4
|
+
import type { CursorHandlers, OffsetFragmentStoreInstance } from '../../types';
|
|
4
5
|
import type { StoreConfig } from '../query';
|
|
5
|
-
import type { CursorHandlers } from './cursor';
|
|
6
6
|
import { type PageInfo } from './pageInfo';
|
|
7
7
|
type FragmentStoreConfig<_Data extends GraphQLObject, _Input> = StoreConfig<_Data, _Input, FragmentArtifact> & {
|
|
8
8
|
paginationArtifact: QueryArtifact;
|
|
@@ -43,19 +43,7 @@ export declare class FragmentStoreCursor<_Data extends GraphQLObject, _Input ext
|
|
|
43
43
|
protected storeHandlers(observer: DocumentStore<_Data, _Input>): CursorHandlers<_Data, _Input>;
|
|
44
44
|
}
|
|
45
45
|
export declare class FragmentStoreOffset<_Data extends GraphQLObject, _Input extends Record<string, any>> extends BasePaginatedFragmentStore<_Data, _Input> {
|
|
46
|
-
get(initialValue: _Data | null):
|
|
47
|
-
kind: "HoudiniFragment";
|
|
48
|
-
data: Readable<_Data | null>;
|
|
49
|
-
subscribe: (run: import("$houdini/runtime/lib").Subscriber<import("$houdini/runtime/lib/types").QueryResult<_Data, _Input>>, invalidate?: (value?: import("$houdini/runtime/lib/types").QueryResult<_Data, _Input> | undefined) => void) => import("$houdini/runtime/lib").Unsubscriber;
|
|
50
|
-
fetch: (args?: import("../query").QueryStoreFetchParams<_Data, _Input> | undefined) => Promise<import("$houdini/runtime/lib/types").QueryResult<_Data, _Input>>;
|
|
51
|
-
loadNextPage: ({ limit, offset, fetch, metadata, }?: {
|
|
52
|
-
limit?: number | undefined;
|
|
53
|
-
offset?: number | undefined;
|
|
54
|
-
fetch?: typeof fetch | undefined;
|
|
55
|
-
metadata?: {} | undefined;
|
|
56
|
-
}) => Promise<void>;
|
|
57
|
-
fetching: Readable<boolean>;
|
|
58
|
-
};
|
|
46
|
+
get(initialValue: _Data | null): OffsetFragmentStoreInstance<_Data, _Input>;
|
|
59
47
|
}
|
|
60
48
|
export type FragmentStorePaginated<_Data extends GraphQLObject, _Input> = Readable<{
|
|
61
49
|
data: _Data;
|
|
@@ -18,12 +18,3 @@ export declare function offsetHandlers<_Data extends GraphQLObject, _Input exten
|
|
|
18
18
|
}) => Promise<void>;
|
|
19
19
|
fetch(args?: QueryStoreFetchParams<_Data, _Input>): Promise<QueryResult<_Data, _Input>>;
|
|
20
20
|
};
|
|
21
|
-
export type OffsetHandlers<_Data extends GraphQLObject, _Input, _ReturnType> = {
|
|
22
|
-
loadNextPage: (args?: {
|
|
23
|
-
limit?: number;
|
|
24
|
-
offset?: number;
|
|
25
|
-
metadata?: {};
|
|
26
|
-
fetch?: typeof globalThis.fetch;
|
|
27
|
-
}) => Promise<void>;
|
|
28
|
-
fetch(args?: QueryStoreFetchParams<_Data, _Input> | undefined): Promise<_ReturnType>;
|
|
29
|
-
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { GraphQLObject, QueryArtifact, QueryResult } from '$houdini/runtime/lib/types';
|
|
2
2
|
import type { Subscriber } from 'svelte/store';
|
|
3
|
+
import type { CursorHandlers, OffsetHandlers } from '../../types';
|
|
3
4
|
import type { ClientFetchParams, LoadEventFetchParams, QueryStoreFetchParams, RequestEventFetchParams, StoreConfig } from '../query';
|
|
4
5
|
import { QueryStore } from '../query';
|
|
5
|
-
import type { CursorHandlers } from './cursor';
|
|
6
|
-
import type { OffsetHandlers } from './offset';
|
|
7
6
|
import { type PageInfo } from './pageInfo';
|
|
8
7
|
export type CursorStoreResult<_Data extends GraphQLObject, _Input extends {}> = QueryResult<_Data, _Input> & {
|
|
9
8
|
pageInfo: PageInfo;
|
|
@@ -23,7 +22,7 @@ export declare class QueryStoreCursor<_Data extends GraphQLObject, _Input extend
|
|
|
23
22
|
export declare class QueryStoreOffset<_Data extends GraphQLObject, _Input extends {}> extends QueryStore<_Data, _Input> {
|
|
24
23
|
#private;
|
|
25
24
|
paginated: boolean;
|
|
26
|
-
loadNextPage(args?: Parameters<OffsetHandlers<_Data, _Input
|
|
25
|
+
loadNextPage(args?: Parameters<OffsetHandlers<_Data, _Input>['loadNextPage']>[0]): Promise<void>;
|
|
27
26
|
fetch(params?: RequestEventFetchParams<_Data, _Input>): Promise<QueryResult<_Data, _Input>>;
|
|
28
27
|
fetch(params?: LoadEventFetchParams<_Data, _Input>): Promise<QueryResult<_Data, _Input>>;
|
|
29
28
|
fetch(params?: ClientFetchParams<_Data, _Input>): Promise<QueryResult<_Data, _Input>>;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import type { FetchQueryResult } from '$houdini/runtime/lib/types';
|
|
1
|
+
import type { FetchQueryResult, CompiledFragmentKind, QueryResult, GraphQLObject } from '$houdini/runtime/lib/types';
|
|
2
2
|
import type { LoadEvent } from '@sveltejs/kit';
|
|
3
|
+
import type { Readable, Writable } from 'svelte/store';
|
|
4
|
+
import type { QueryStoreFetchParams } from './stores';
|
|
5
|
+
import type { PageInfo } from './stores/pagination/pageInfo';
|
|
3
6
|
export type QueryInputs<_Data> = FetchQueryResult<_Data> & {
|
|
4
7
|
variables: {
|
|
5
8
|
[key: string]: any;
|
|
@@ -30,3 +33,50 @@ export type KitLoadResponse = {
|
|
|
30
33
|
context?: Record<string, any>;
|
|
31
34
|
maxage?: number;
|
|
32
35
|
};
|
|
36
|
+
export type FragmentStoreInstance<_Data> = Readable<_Data> & {
|
|
37
|
+
kind: typeof CompiledFragmentKind;
|
|
38
|
+
update: Writable<_Data>['set'];
|
|
39
|
+
};
|
|
40
|
+
type Reshape<_Data, _Input> = Omit<QueryResult<_Data, _Input>, 'data'> & {
|
|
41
|
+
data: _Data;
|
|
42
|
+
};
|
|
43
|
+
export type CursorFragmentStoreInstance<_Data extends GraphQLObject, _Input> = {
|
|
44
|
+
kind: typeof CompiledFragmentKind;
|
|
45
|
+
data: Readable<_Data>;
|
|
46
|
+
subscribe: Readable<Reshape<_Data, _Input> & {
|
|
47
|
+
pageInfo: PageInfo;
|
|
48
|
+
}>['subscribe'];
|
|
49
|
+
fetching: Readable<boolean>;
|
|
50
|
+
} & CursorHandlers<_Data, _Input>;
|
|
51
|
+
export type OffsetFragmentStoreInstance<_Data extends GraphQLObject, _Input> = {
|
|
52
|
+
kind: typeof CompiledFragmentKind;
|
|
53
|
+
data: Readable<_Data>;
|
|
54
|
+
subscribe: Readable<Reshape<_Data, _Input>>['subscribe'];
|
|
55
|
+
fetching: Readable<boolean>;
|
|
56
|
+
} & OffsetHandlers<_Data, _Input>;
|
|
57
|
+
export type CursorHandlers<_Data extends GraphQLObject, _Input> = {
|
|
58
|
+
loadNextPage: (args?: {
|
|
59
|
+
first?: number;
|
|
60
|
+
after?: string;
|
|
61
|
+
fetch?: typeof globalThis.fetch;
|
|
62
|
+
metadata: {};
|
|
63
|
+
}) => Promise<void>;
|
|
64
|
+
loadPreviousPage: (args?: {
|
|
65
|
+
last?: number;
|
|
66
|
+
before?: string;
|
|
67
|
+
fetch?: typeof globalThis.fetch;
|
|
68
|
+
metadata?: {};
|
|
69
|
+
}) => Promise<void>;
|
|
70
|
+
pageInfo: Writable<PageInfo>;
|
|
71
|
+
fetch(args?: QueryStoreFetchParams<_Data, _Input> | undefined): Promise<QueryResult<_Data, _Input>>;
|
|
72
|
+
};
|
|
73
|
+
export type OffsetHandlers<_Data extends GraphQLObject, _Input> = {
|
|
74
|
+
loadNextPage: (args?: {
|
|
75
|
+
limit?: number;
|
|
76
|
+
offset?: number;
|
|
77
|
+
metadata?: {};
|
|
78
|
+
fetch?: typeof globalThis.fetch;
|
|
79
|
+
}) => Promise<void>;
|
|
80
|
+
fetch(args?: QueryStoreFetchParams<_Data, _Input> | undefined): Promise<QueryResult<_Data, _Input>>;
|
|
81
|
+
};
|
|
82
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { GraphQLObject, FragmentArtifact, HoudiniFetchContext } from '$houdini/runtime/lib/types';
|
|
2
|
+
import type { FragmentStoreInstance } from '../types';
|
|
2
3
|
export declare class FragmentStore<_Data extends GraphQLObject, _Input = {}> {
|
|
3
4
|
artifact: FragmentArtifact;
|
|
4
5
|
name: string;
|
|
@@ -8,9 +9,5 @@ export declare class FragmentStore<_Data extends GraphQLObject, _Input = {}> {
|
|
|
8
9
|
artifact: FragmentArtifact;
|
|
9
10
|
storeName: string;
|
|
10
11
|
});
|
|
11
|
-
get(initialValue: _Data | null):
|
|
12
|
-
kind: "HoudiniFragment";
|
|
13
|
-
subscribe: (run: import("svelte/store").Subscriber<_Data | null>, invalidate?: ((value?: _Data | null | undefined) => void) | undefined) => import("svelte/store").Unsubscriber;
|
|
14
|
-
update: (val: _Data | null) => void;
|
|
15
|
-
};
|
|
12
|
+
get(initialValue: _Data | null): FragmentStoreInstance<_Data | null>;
|
|
16
13
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import type { DocumentStore } from '$houdini/runtime/client';
|
|
2
2
|
import type { SendParams } from '$houdini/runtime/client/documentStore';
|
|
3
|
-
import type { GraphQLObject, QueryArtifact
|
|
4
|
-
import type {
|
|
5
|
-
import type { QueryStoreFetchParams } from '../query';
|
|
3
|
+
import type { GraphQLObject, QueryArtifact } from '$houdini/runtime/lib/types';
|
|
4
|
+
import type { CursorHandlers } from '../../types';
|
|
6
5
|
import type { FetchFn } from './fetch';
|
|
7
|
-
import type { PageInfo } from './pageInfo';
|
|
8
6
|
export declare function cursorHandlers<_Data extends GraphQLObject, _Input extends Record<string, any>>({ artifact, storeName, observer, fetchUpdate: parentFetchUpdate, fetch: parentFetch, }: {
|
|
9
7
|
artifact: QueryArtifact;
|
|
10
8
|
storeName: string;
|
|
@@ -12,19 +10,3 @@ export declare function cursorHandlers<_Data extends GraphQLObject, _Input exten
|
|
|
12
10
|
fetch: FetchFn<_Data, _Input>;
|
|
13
11
|
fetchUpdate: (arg: SendParams, updates: string[]) => ReturnType<FetchFn<_Data, _Input>>;
|
|
14
12
|
}): CursorHandlers<_Data, _Input>;
|
|
15
|
-
export type CursorHandlers<_Data extends GraphQLObject, _Input> = {
|
|
16
|
-
loadNextPage: (args?: {
|
|
17
|
-
first?: number;
|
|
18
|
-
after?: string;
|
|
19
|
-
fetch?: typeof globalThis.fetch;
|
|
20
|
-
metadata: {};
|
|
21
|
-
}) => Promise<void>;
|
|
22
|
-
loadPreviousPage: (args?: {
|
|
23
|
-
last?: number;
|
|
24
|
-
before?: string;
|
|
25
|
-
fetch?: typeof globalThis.fetch;
|
|
26
|
-
metadata?: {};
|
|
27
|
-
}) => Promise<void>;
|
|
28
|
-
pageInfo: Writable<PageInfo>;
|
|
29
|
-
fetch(args?: QueryStoreFetchParams<_Data, _Input> | undefined): Promise<QueryResult<_Data, _Input>>;
|
|
30
|
-
};
|
|
@@ -131,7 +131,7 @@ If you think this is an error, please open an issue on GitHub`);
|
|
|
131
131
|
if (count && count > artifact.refetch.pageSize) {
|
|
132
132
|
if (currentPageInfo.hasPreviousPage && currentPageInfo.hasNextPage && !(variables?.["first"] && variables?.["after"] || variables?.["last"] && variables?.["before"])) {
|
|
133
133
|
console.warn(`\u26A0\uFE0F Encountered a fetch() in the middle of the connection.
|
|
134
|
-
Make sure to pass a cursor value by hand that includes the current set (ie the entry before startCursor)
|
|
134
|
+
Make sure to pass a cursor value by hand that includes the current set (ie the entry before startCursor)
|
|
135
135
|
`);
|
|
136
136
|
return observer.state;
|
|
137
137
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { DocumentStore } from '$houdini/runtime/client';
|
|
2
2
|
import type { FragmentArtifact, GraphQLObject, HoudiniFetchContext, QueryArtifact } from '$houdini/runtime/lib/types';
|
|
3
3
|
import type { Readable, Subscriber } from 'svelte/store';
|
|
4
|
+
import type { CursorHandlers, OffsetFragmentStoreInstance } from '../../types';
|
|
4
5
|
import type { StoreConfig } from '../query';
|
|
5
|
-
import type { CursorHandlers } from './cursor';
|
|
6
6
|
import { type PageInfo } from './pageInfo';
|
|
7
7
|
type FragmentStoreConfig<_Data extends GraphQLObject, _Input> = StoreConfig<_Data, _Input, FragmentArtifact> & {
|
|
8
8
|
paginationArtifact: QueryArtifact;
|
|
@@ -43,19 +43,7 @@ export declare class FragmentStoreCursor<_Data extends GraphQLObject, _Input ext
|
|
|
43
43
|
protected storeHandlers(observer: DocumentStore<_Data, _Input>): CursorHandlers<_Data, _Input>;
|
|
44
44
|
}
|
|
45
45
|
export declare class FragmentStoreOffset<_Data extends GraphQLObject, _Input extends Record<string, any>> extends BasePaginatedFragmentStore<_Data, _Input> {
|
|
46
|
-
get(initialValue: _Data | null):
|
|
47
|
-
kind: "HoudiniFragment";
|
|
48
|
-
data: Readable<_Data | null>;
|
|
49
|
-
subscribe: (run: import("$houdini/runtime/lib").Subscriber<import("$houdini/runtime/lib/types").QueryResult<_Data, _Input>>, invalidate?: (value?: import("$houdini/runtime/lib/types").QueryResult<_Data, _Input> | undefined) => void) => import("$houdini/runtime/lib").Unsubscriber;
|
|
50
|
-
fetch: (args?: import("../query").QueryStoreFetchParams<_Data, _Input> | undefined) => Promise<import("$houdini/runtime/lib/types").QueryResult<_Data, _Input>>;
|
|
51
|
-
loadNextPage: ({ limit, offset, fetch, metadata, }?: {
|
|
52
|
-
limit?: number | undefined;
|
|
53
|
-
offset?: number | undefined;
|
|
54
|
-
fetch?: typeof fetch | undefined;
|
|
55
|
-
metadata?: {} | undefined;
|
|
56
|
-
}) => Promise<void>;
|
|
57
|
-
fetching: Readable<boolean>;
|
|
58
|
-
};
|
|
46
|
+
get(initialValue: _Data | null): OffsetFragmentStoreInstance<_Data, _Input>;
|
|
59
47
|
}
|
|
60
48
|
export type FragmentStorePaginated<_Data extends GraphQLObject, _Input> = Readable<{
|
|
61
49
|
data: _Data;
|
|
@@ -18,12 +18,3 @@ export declare function offsetHandlers<_Data extends GraphQLObject, _Input exten
|
|
|
18
18
|
}) => Promise<void>;
|
|
19
19
|
fetch(args?: QueryStoreFetchParams<_Data, _Input>): Promise<QueryResult<_Data, _Input>>;
|
|
20
20
|
};
|
|
21
|
-
export type OffsetHandlers<_Data extends GraphQLObject, _Input, _ReturnType> = {
|
|
22
|
-
loadNextPage: (args?: {
|
|
23
|
-
limit?: number;
|
|
24
|
-
offset?: number;
|
|
25
|
-
metadata?: {};
|
|
26
|
-
fetch?: typeof globalThis.fetch;
|
|
27
|
-
}) => Promise<void>;
|
|
28
|
-
fetch(args?: QueryStoreFetchParams<_Data, _Input> | undefined): Promise<_ReturnType>;
|
|
29
|
-
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { GraphQLObject, QueryArtifact, QueryResult } from '$houdini/runtime/lib/types';
|
|
2
2
|
import type { Subscriber } from 'svelte/store';
|
|
3
|
+
import type { CursorHandlers, OffsetHandlers } from '../../types';
|
|
3
4
|
import type { ClientFetchParams, LoadEventFetchParams, QueryStoreFetchParams, RequestEventFetchParams, StoreConfig } from '../query';
|
|
4
5
|
import { QueryStore } from '../query';
|
|
5
|
-
import type { CursorHandlers } from './cursor';
|
|
6
|
-
import type { OffsetHandlers } from './offset';
|
|
7
6
|
import { type PageInfo } from './pageInfo';
|
|
8
7
|
export type CursorStoreResult<_Data extends GraphQLObject, _Input extends {}> = QueryResult<_Data, _Input> & {
|
|
9
8
|
pageInfo: PageInfo;
|
|
@@ -23,7 +22,7 @@ export declare class QueryStoreCursor<_Data extends GraphQLObject, _Input extend
|
|
|
23
22
|
export declare class QueryStoreOffset<_Data extends GraphQLObject, _Input extends {}> extends QueryStore<_Data, _Input> {
|
|
24
23
|
#private;
|
|
25
24
|
paginated: boolean;
|
|
26
|
-
loadNextPage(args?: Parameters<OffsetHandlers<_Data, _Input
|
|
25
|
+
loadNextPage(args?: Parameters<OffsetHandlers<_Data, _Input>['loadNextPage']>[0]): Promise<void>;
|
|
27
26
|
fetch(params?: RequestEventFetchParams<_Data, _Input>): Promise<QueryResult<_Data, _Input>>;
|
|
28
27
|
fetch(params?: LoadEventFetchParams<_Data, _Input>): Promise<QueryResult<_Data, _Input>>;
|
|
29
28
|
fetch(params?: ClientFetchParams<_Data, _Input>): Promise<QueryResult<_Data, _Input>>;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import type { FetchQueryResult } from '$houdini/runtime/lib/types';
|
|
1
|
+
import type { FetchQueryResult, CompiledFragmentKind, QueryResult, GraphQLObject } from '$houdini/runtime/lib/types';
|
|
2
2
|
import type { LoadEvent } from '@sveltejs/kit';
|
|
3
|
+
import type { Readable, Writable } from 'svelte/store';
|
|
4
|
+
import type { QueryStoreFetchParams } from './stores';
|
|
5
|
+
import type { PageInfo } from './stores/pagination/pageInfo';
|
|
3
6
|
export type QueryInputs<_Data> = FetchQueryResult<_Data> & {
|
|
4
7
|
variables: {
|
|
5
8
|
[key: string]: any;
|
|
@@ -30,3 +33,50 @@ export type KitLoadResponse = {
|
|
|
30
33
|
context?: Record<string, any>;
|
|
31
34
|
maxage?: number;
|
|
32
35
|
};
|
|
36
|
+
export type FragmentStoreInstance<_Data> = Readable<_Data> & {
|
|
37
|
+
kind: typeof CompiledFragmentKind;
|
|
38
|
+
update: Writable<_Data>['set'];
|
|
39
|
+
};
|
|
40
|
+
type Reshape<_Data, _Input> = Omit<QueryResult<_Data, _Input>, 'data'> & {
|
|
41
|
+
data: _Data;
|
|
42
|
+
};
|
|
43
|
+
export type CursorFragmentStoreInstance<_Data extends GraphQLObject, _Input> = {
|
|
44
|
+
kind: typeof CompiledFragmentKind;
|
|
45
|
+
data: Readable<_Data>;
|
|
46
|
+
subscribe: Readable<Reshape<_Data, _Input> & {
|
|
47
|
+
pageInfo: PageInfo;
|
|
48
|
+
}>['subscribe'];
|
|
49
|
+
fetching: Readable<boolean>;
|
|
50
|
+
} & CursorHandlers<_Data, _Input>;
|
|
51
|
+
export type OffsetFragmentStoreInstance<_Data extends GraphQLObject, _Input> = {
|
|
52
|
+
kind: typeof CompiledFragmentKind;
|
|
53
|
+
data: Readable<_Data>;
|
|
54
|
+
subscribe: Readable<Reshape<_Data, _Input>>['subscribe'];
|
|
55
|
+
fetching: Readable<boolean>;
|
|
56
|
+
} & OffsetHandlers<_Data, _Input>;
|
|
57
|
+
export type CursorHandlers<_Data extends GraphQLObject, _Input> = {
|
|
58
|
+
loadNextPage: (args?: {
|
|
59
|
+
first?: number;
|
|
60
|
+
after?: string;
|
|
61
|
+
fetch?: typeof globalThis.fetch;
|
|
62
|
+
metadata: {};
|
|
63
|
+
}) => Promise<void>;
|
|
64
|
+
loadPreviousPage: (args?: {
|
|
65
|
+
last?: number;
|
|
66
|
+
before?: string;
|
|
67
|
+
fetch?: typeof globalThis.fetch;
|
|
68
|
+
metadata?: {};
|
|
69
|
+
}) => Promise<void>;
|
|
70
|
+
pageInfo: Writable<PageInfo>;
|
|
71
|
+
fetch(args?: QueryStoreFetchParams<_Data, _Input> | undefined): Promise<QueryResult<_Data, _Input>>;
|
|
72
|
+
};
|
|
73
|
+
export type OffsetHandlers<_Data extends GraphQLObject, _Input> = {
|
|
74
|
+
loadNextPage: (args?: {
|
|
75
|
+
limit?: number;
|
|
76
|
+
offset?: number;
|
|
77
|
+
metadata?: {};
|
|
78
|
+
fetch?: typeof globalThis.fetch;
|
|
79
|
+
}) => Promise<void>;
|
|
80
|
+
fetch(args?: QueryStoreFetchParams<_Data, _Input> | undefined): Promise<QueryResult<_Data, _Input>>;
|
|
81
|
+
};
|
|
82
|
+
export {};
|
package/build/test-cjs/index.js
CHANGED
|
@@ -210595,7 +210595,7 @@ function testConfig(config22 = {}) {
|
|
|
210595
210595
|
...testConfigFile(config22)
|
|
210596
210596
|
});
|
|
210597
210597
|
}
|
|
210598
|
-
function mockCollectedDoc(query22) {
|
|
210598
|
+
function mockCollectedDoc(query22, data2) {
|
|
210599
210599
|
const parsed = graphql252.parse(query22);
|
|
210600
210600
|
const name = parsed.definitions[0].name.value;
|
|
210601
210601
|
const operations = parsed.definitions;
|
|
@@ -210618,7 +210618,8 @@ function mockCollectedDoc(query22) {
|
|
|
210618
210618
|
generateArtifact: true,
|
|
210619
210619
|
generateStore: true,
|
|
210620
210620
|
originalString: query22,
|
|
210621
|
-
artifact: null
|
|
210621
|
+
artifact: null,
|
|
210622
|
+
...data2
|
|
210622
210623
|
};
|
|
210623
210624
|
}
|
|
210624
210625
|
|
|
@@ -304257,21 +304258,56 @@ async function fragmentTypedefs(input) {
|
|
|
304257
304258
|
document_input.typeAnnotation = AST16.tsTypeAnnotation(
|
|
304258
304259
|
AST16.tsTypeReference(AST16.identifier(store))
|
|
304259
304260
|
);
|
|
304260
|
-
|
|
304261
|
-
|
|
304262
|
-
|
|
304263
|
-
|
|
304264
|
-
|
|
304265
|
-
|
|
304266
|
-
|
|
304267
|
-
|
|
304268
|
-
|
|
304261
|
+
let store_type = "FragmentStoreInstance";
|
|
304262
|
+
if (doc.refetch?.paginated) {
|
|
304263
|
+
if (doc.refetch.method === "cursor") {
|
|
304264
|
+
store_type = "CursorFragmentStoreInstance";
|
|
304265
|
+
} else {
|
|
304266
|
+
store_type = "OffsetFragmentStoreInstance";
|
|
304267
|
+
}
|
|
304268
|
+
}
|
|
304269
|
+
ensureImports({
|
|
304270
|
+
config: input.config,
|
|
304271
|
+
body: contents.script.body,
|
|
304272
|
+
sourceModule: "./types",
|
|
304273
|
+
import: [store_type],
|
|
304274
|
+
importKind: "type"
|
|
304275
|
+
});
|
|
304269
304276
|
ensureImports({
|
|
304270
304277
|
config: input.config,
|
|
304271
304278
|
body: contents.script.body,
|
|
304272
304279
|
sourceModule: import_path,
|
|
304273
304280
|
import: [store]
|
|
304274
304281
|
});
|
|
304282
|
+
const shapeID = `${doc.name}$data`;
|
|
304283
|
+
const inputID = `${doc.name}$input`;
|
|
304284
|
+
ensureImports({
|
|
304285
|
+
config: input.config,
|
|
304286
|
+
body: contents.script.body,
|
|
304287
|
+
sourceModule: "../../../artifacts/" + doc.name,
|
|
304288
|
+
import: [inputID, shapeID]
|
|
304289
|
+
});
|
|
304290
|
+
const typeParams = [];
|
|
304291
|
+
if (doc.refetch?.paginated) {
|
|
304292
|
+
typeParams.push(AST16.tsTypeReference(AST16.identifier(inputID)));
|
|
304293
|
+
}
|
|
304294
|
+
const return_value = AST16.tsTypeReference(
|
|
304295
|
+
AST16.identifier(store_type),
|
|
304296
|
+
AST16.tsTypeParameterInstantiation([
|
|
304297
|
+
AST16.tsTypeReference(AST16.identifier(shapeID)),
|
|
304298
|
+
...typeParams
|
|
304299
|
+
])
|
|
304300
|
+
);
|
|
304301
|
+
const null_return_value = AST16.tsTypeReference(
|
|
304302
|
+
AST16.identifier(store_type),
|
|
304303
|
+
AST16.tsTypeParameterInstantiation([
|
|
304304
|
+
AST16.tsUnionType([
|
|
304305
|
+
AST16.tsTypeReference(AST16.identifier(shapeID)),
|
|
304306
|
+
AST16.tsNullKeyword()
|
|
304307
|
+
]),
|
|
304308
|
+
...typeParams
|
|
304309
|
+
])
|
|
304310
|
+
);
|
|
304275
304311
|
return [
|
|
304276
304312
|
AST16.exportNamedDeclaration(
|
|
304277
304313
|
AST16.tsDeclareFunction(
|
|
@@ -304284,9 +304320,7 @@ async function fragmentTypedefs(input) {
|
|
|
304284
304320
|
AST16.tsDeclareFunction(
|
|
304285
304321
|
AST16.identifier(which),
|
|
304286
304322
|
[initial_value_or_null_input, document_input],
|
|
304287
|
-
AST16.tsTypeAnnotation(
|
|
304288
|
-
AST16.tsUnionType([return_value, AST16.tsNullKeyword()])
|
|
304289
|
-
)
|
|
304323
|
+
AST16.tsTypeAnnotation(null_return_value)
|
|
304290
304324
|
)
|
|
304291
304325
|
)
|
|
304292
304326
|
];
|
|
@@ -306117,7 +306151,7 @@ async function test_config(extraConfig = {}) {
|
|
|
306117
306151
|
}
|
|
306118
306152
|
async function pipeline_test(documents, extra_config) {
|
|
306119
306153
|
const config5 = await test_config(extra_config);
|
|
306120
|
-
const docs = documents.map(mockCollectedDoc);
|
|
306154
|
+
const docs = documents.map((doc) => mockCollectedDoc(doc));
|
|
306121
306155
|
await runPipeline22(config5, docs);
|
|
306122
306156
|
return {
|
|
306123
306157
|
pluginRoot: config5.pluginDirectory("houdini-svelte"),
|
package/build/test-esm/index.js
CHANGED
|
@@ -210585,7 +210585,7 @@ function testConfig(config22 = {}) {
|
|
|
210585
210585
|
...testConfigFile(config22)
|
|
210586
210586
|
});
|
|
210587
210587
|
}
|
|
210588
|
-
function mockCollectedDoc(query22) {
|
|
210588
|
+
function mockCollectedDoc(query22, data2) {
|
|
210589
210589
|
const parsed = graphql252.parse(query22);
|
|
210590
210590
|
const name = parsed.definitions[0].name.value;
|
|
210591
210591
|
const operations = parsed.definitions;
|
|
@@ -210608,7 +210608,8 @@ function mockCollectedDoc(query22) {
|
|
|
210608
210608
|
generateArtifact: true,
|
|
210609
210609
|
generateStore: true,
|
|
210610
210610
|
originalString: query22,
|
|
210611
|
-
artifact: null
|
|
210611
|
+
artifact: null,
|
|
210612
|
+
...data2
|
|
210612
210613
|
};
|
|
210613
210614
|
}
|
|
210614
210615
|
|
|
@@ -304246,21 +304247,56 @@ async function fragmentTypedefs(input) {
|
|
|
304246
304247
|
document_input.typeAnnotation = AST16.tsTypeAnnotation(
|
|
304247
304248
|
AST16.tsTypeReference(AST16.identifier(store))
|
|
304248
304249
|
);
|
|
304249
|
-
|
|
304250
|
-
|
|
304251
|
-
|
|
304252
|
-
|
|
304253
|
-
|
|
304254
|
-
|
|
304255
|
-
|
|
304256
|
-
|
|
304257
|
-
|
|
304250
|
+
let store_type = "FragmentStoreInstance";
|
|
304251
|
+
if (doc.refetch?.paginated) {
|
|
304252
|
+
if (doc.refetch.method === "cursor") {
|
|
304253
|
+
store_type = "CursorFragmentStoreInstance";
|
|
304254
|
+
} else {
|
|
304255
|
+
store_type = "OffsetFragmentStoreInstance";
|
|
304256
|
+
}
|
|
304257
|
+
}
|
|
304258
|
+
ensureImports({
|
|
304259
|
+
config: input.config,
|
|
304260
|
+
body: contents.script.body,
|
|
304261
|
+
sourceModule: "./types",
|
|
304262
|
+
import: [store_type],
|
|
304263
|
+
importKind: "type"
|
|
304264
|
+
});
|
|
304258
304265
|
ensureImports({
|
|
304259
304266
|
config: input.config,
|
|
304260
304267
|
body: contents.script.body,
|
|
304261
304268
|
sourceModule: import_path,
|
|
304262
304269
|
import: [store]
|
|
304263
304270
|
});
|
|
304271
|
+
const shapeID = `${doc.name}$data`;
|
|
304272
|
+
const inputID = `${doc.name}$input`;
|
|
304273
|
+
ensureImports({
|
|
304274
|
+
config: input.config,
|
|
304275
|
+
body: contents.script.body,
|
|
304276
|
+
sourceModule: "../../../artifacts/" + doc.name,
|
|
304277
|
+
import: [inputID, shapeID]
|
|
304278
|
+
});
|
|
304279
|
+
const typeParams = [];
|
|
304280
|
+
if (doc.refetch?.paginated) {
|
|
304281
|
+
typeParams.push(AST16.tsTypeReference(AST16.identifier(inputID)));
|
|
304282
|
+
}
|
|
304283
|
+
const return_value = AST16.tsTypeReference(
|
|
304284
|
+
AST16.identifier(store_type),
|
|
304285
|
+
AST16.tsTypeParameterInstantiation([
|
|
304286
|
+
AST16.tsTypeReference(AST16.identifier(shapeID)),
|
|
304287
|
+
...typeParams
|
|
304288
|
+
])
|
|
304289
|
+
);
|
|
304290
|
+
const null_return_value = AST16.tsTypeReference(
|
|
304291
|
+
AST16.identifier(store_type),
|
|
304292
|
+
AST16.tsTypeParameterInstantiation([
|
|
304293
|
+
AST16.tsUnionType([
|
|
304294
|
+
AST16.tsTypeReference(AST16.identifier(shapeID)),
|
|
304295
|
+
AST16.tsNullKeyword()
|
|
304296
|
+
]),
|
|
304297
|
+
...typeParams
|
|
304298
|
+
])
|
|
304299
|
+
);
|
|
304264
304300
|
return [
|
|
304265
304301
|
AST16.exportNamedDeclaration(
|
|
304266
304302
|
AST16.tsDeclareFunction(
|
|
@@ -304273,9 +304309,7 @@ async function fragmentTypedefs(input) {
|
|
|
304273
304309
|
AST16.tsDeclareFunction(
|
|
304274
304310
|
AST16.identifier(which),
|
|
304275
304311
|
[initial_value_or_null_input, document_input],
|
|
304276
|
-
AST16.tsTypeAnnotation(
|
|
304277
|
-
AST16.tsUnionType([return_value, AST16.tsNullKeyword()])
|
|
304278
|
-
)
|
|
304312
|
+
AST16.tsTypeAnnotation(null_return_value)
|
|
304279
304313
|
)
|
|
304280
304314
|
)
|
|
304281
304315
|
];
|
|
@@ -306106,7 +306140,7 @@ async function test_config(extraConfig = {}) {
|
|
|
306106
306140
|
}
|
|
306107
306141
|
async function pipeline_test(documents, extra_config) {
|
|
306108
306142
|
const config5 = await test_config(extra_config);
|
|
306109
|
-
const docs = documents.map(mockCollectedDoc);
|
|
306143
|
+
const docs = documents.map((doc) => mockCollectedDoc(doc));
|
|
306110
306144
|
await runPipeline22(config5, docs);
|
|
306111
306145
|
return {
|
|
306112
306146
|
pluginRoot: config5.pluginDirectory("houdini-svelte"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "houdini-svelte",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "The svelte plugin for houdini",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"rollup": "^3.7.4",
|
|
33
33
|
"svelte": "^3.55.1",
|
|
34
34
|
"vite": "^4.1.1",
|
|
35
|
-
"houdini": "^1.0.
|
|
35
|
+
"houdini": "^1.0.2"
|
|
36
36
|
},
|
|
37
37
|
"files": [
|
|
38
38
|
"build"
|