houdini-svelte 1.1.0 → 1.1.1-next.0
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/runtime/stores/subscription.d.ts +4 -1
- package/build/runtime-cjs/stores/subscription.d.ts +4 -1
- package/build/runtime-cjs/stores/subscription.js +14 -0
- package/build/runtime-esm/stores/subscription.d.ts +4 -1
- package/build/runtime-esm/stores/subscription.js +14 -0
- package/build/test-cjs/index.js +23 -8
- package/build/test-esm/index.js +23 -8
- package/package.json +2 -2
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type { SubscriptionArtifact } from '$houdini/runtime/lib/types';
|
|
1
|
+
import type { QueryResult, SubscriptionArtifact } from '$houdini/runtime/lib/types';
|
|
2
2
|
import type { GraphQLObject } from 'houdini';
|
|
3
|
+
import { type Subscriber, type Writable } from 'svelte/store';
|
|
3
4
|
import { BaseStore } from './base';
|
|
4
5
|
export declare class SubscriptionStore<_Data extends GraphQLObject, _Input extends {}> extends BaseStore<_Data, _Input, SubscriptionArtifact> {
|
|
5
6
|
kind: "HoudiniSubscription";
|
|
7
|
+
fetchingStore: Writable<boolean>;
|
|
6
8
|
constructor({ artifact }: {
|
|
7
9
|
artifact: SubscriptionArtifact;
|
|
8
10
|
});
|
|
@@ -10,4 +12,5 @@ export declare class SubscriptionStore<_Data extends GraphQLObject, _Input exten
|
|
|
10
12
|
metadata: App.Metadata;
|
|
11
13
|
}): Promise<void>;
|
|
12
14
|
unlisten(): Promise<void>;
|
|
15
|
+
subscribe(run: Subscriber<QueryResult<_Data, _Input>>, invalidate?: ((value?: QueryResult<_Data, _Input> | undefined) => void) | undefined): () => void;
|
|
13
16
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type { SubscriptionArtifact } from '$houdini/runtime/lib/types';
|
|
1
|
+
import type { QueryResult, SubscriptionArtifact } from '$houdini/runtime/lib/types';
|
|
2
2
|
import type { GraphQLObject } from 'houdini';
|
|
3
|
+
import { type Subscriber, type Writable } from 'svelte/store';
|
|
3
4
|
import { BaseStore } from './base';
|
|
4
5
|
export declare class SubscriptionStore<_Data extends GraphQLObject, _Input extends {}> extends BaseStore<_Data, _Input, SubscriptionArtifact> {
|
|
5
6
|
kind: "HoudiniSubscription";
|
|
7
|
+
fetchingStore: Writable<boolean>;
|
|
6
8
|
constructor({ artifact }: {
|
|
7
9
|
artifact: SubscriptionArtifact;
|
|
8
10
|
});
|
|
@@ -10,4 +12,5 @@ export declare class SubscriptionStore<_Data extends GraphQLObject, _Input exten
|
|
|
10
12
|
metadata: App.Metadata;
|
|
11
13
|
}): Promise<void>;
|
|
12
14
|
unlisten(): Promise<void>;
|
|
15
|
+
subscribe(run: Subscriber<QueryResult<_Data, _Input>>, invalidate?: ((value?: QueryResult<_Data, _Input> | undefined) => void) | undefined): () => void;
|
|
13
16
|
}
|
|
@@ -22,15 +22,19 @@ __export(subscription_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(subscription_exports);
|
|
24
24
|
var import_types = require("$houdini/runtime/lib/types");
|
|
25
|
+
var import_store = require("svelte/store");
|
|
25
26
|
var import_client = require("../client");
|
|
26
27
|
var import_session = require("../session");
|
|
27
28
|
var import_base = require("./base");
|
|
28
29
|
class SubscriptionStore extends import_base.BaseStore {
|
|
29
30
|
kind = import_types.CompiledSubscriptionKind;
|
|
31
|
+
fetchingStore;
|
|
30
32
|
constructor({ artifact }) {
|
|
31
33
|
super({ artifact });
|
|
34
|
+
this.fetchingStore = (0, import_store.writable)(false);
|
|
32
35
|
}
|
|
33
36
|
async listen(variables, args) {
|
|
37
|
+
this.fetchingStore.set(true);
|
|
34
38
|
await (0, import_client.initClient)();
|
|
35
39
|
this.observer.send({
|
|
36
40
|
variables,
|
|
@@ -39,9 +43,19 @@ class SubscriptionStore extends import_base.BaseStore {
|
|
|
39
43
|
});
|
|
40
44
|
}
|
|
41
45
|
async unlisten() {
|
|
46
|
+
this.fetchingStore.set(false);
|
|
42
47
|
await (0, import_client.initClient)();
|
|
43
48
|
await this.observer.cleanup();
|
|
44
49
|
}
|
|
50
|
+
subscribe(run, invalidate) {
|
|
51
|
+
return (0, import_store.derived)(
|
|
52
|
+
[{ subscribe: super.subscribe.bind(this) }, this.fetchingStore],
|
|
53
|
+
([$parent, $fetching]) => ({
|
|
54
|
+
...$parent,
|
|
55
|
+
fetching: $fetching
|
|
56
|
+
})
|
|
57
|
+
).subscribe(run, invalidate);
|
|
58
|
+
}
|
|
45
59
|
}
|
|
46
60
|
// Annotate the CommonJS export names for ESM import in node:
|
|
47
61
|
0 && (module.exports = {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type { SubscriptionArtifact } from '$houdini/runtime/lib/types';
|
|
1
|
+
import type { QueryResult, SubscriptionArtifact } from '$houdini/runtime/lib/types';
|
|
2
2
|
import type { GraphQLObject } from 'houdini';
|
|
3
|
+
import { type Subscriber, type Writable } from 'svelte/store';
|
|
3
4
|
import { BaseStore } from './base';
|
|
4
5
|
export declare class SubscriptionStore<_Data extends GraphQLObject, _Input extends {}> extends BaseStore<_Data, _Input, SubscriptionArtifact> {
|
|
5
6
|
kind: "HoudiniSubscription";
|
|
7
|
+
fetchingStore: Writable<boolean>;
|
|
6
8
|
constructor({ artifact }: {
|
|
7
9
|
artifact: SubscriptionArtifact;
|
|
8
10
|
});
|
|
@@ -10,4 +12,5 @@ export declare class SubscriptionStore<_Data extends GraphQLObject, _Input exten
|
|
|
10
12
|
metadata: App.Metadata;
|
|
11
13
|
}): Promise<void>;
|
|
12
14
|
unlisten(): Promise<void>;
|
|
15
|
+
subscribe(run: Subscriber<QueryResult<_Data, _Input>>, invalidate?: ((value?: QueryResult<_Data, _Input> | undefined) => void) | undefined): () => void;
|
|
13
16
|
}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { CompiledSubscriptionKind } from "$houdini/runtime/lib/types";
|
|
2
|
+
import { derived, writable } from "svelte/store";
|
|
2
3
|
import { initClient } from "../client";
|
|
3
4
|
import { getSession } from "../session";
|
|
4
5
|
import { BaseStore } from "./base";
|
|
5
6
|
class SubscriptionStore extends BaseStore {
|
|
6
7
|
kind = CompiledSubscriptionKind;
|
|
8
|
+
fetchingStore;
|
|
7
9
|
constructor({ artifact }) {
|
|
8
10
|
super({ artifact });
|
|
11
|
+
this.fetchingStore = writable(false);
|
|
9
12
|
}
|
|
10
13
|
async listen(variables, args) {
|
|
14
|
+
this.fetchingStore.set(true);
|
|
11
15
|
await initClient();
|
|
12
16
|
this.observer.send({
|
|
13
17
|
variables,
|
|
@@ -16,9 +20,19 @@ class SubscriptionStore extends BaseStore {
|
|
|
16
20
|
});
|
|
17
21
|
}
|
|
18
22
|
async unlisten() {
|
|
23
|
+
this.fetchingStore.set(false);
|
|
19
24
|
await initClient();
|
|
20
25
|
await this.observer.cleanup();
|
|
21
26
|
}
|
|
27
|
+
subscribe(run, invalidate) {
|
|
28
|
+
return derived(
|
|
29
|
+
[{ subscribe: super.subscribe.bind(this) }, this.fetchingStore],
|
|
30
|
+
([$parent, $fetching]) => ({
|
|
31
|
+
...$parent,
|
|
32
|
+
fetching: $fetching
|
|
33
|
+
})
|
|
34
|
+
).subscribe(run, invalidate);
|
|
35
|
+
}
|
|
22
36
|
}
|
|
23
37
|
export {
|
|
24
38
|
SubscriptionStore
|
package/build/test-cjs/index.js
CHANGED
|
@@ -149285,9 +149285,10 @@ var FieldCollection = class {
|
|
|
149285
149285
|
for (const subselect of selection.selectionSet?.selections || []) {
|
|
149286
149286
|
this.fields[key].selection.add(subselect);
|
|
149287
149287
|
}
|
|
149288
|
-
this.fields[key].selection.fragmentSpreads =
|
|
149289
|
-
selection.selectionSet?.selections ?? []
|
|
149290
|
-
|
|
149288
|
+
this.fields[key].selection.fragmentSpreads = {
|
|
149289
|
+
...this.collectFragmentSpreads(selection.selectionSet?.selections ?? []),
|
|
149290
|
+
...this.fields[key].selection.fragmentSpreads
|
|
149291
|
+
};
|
|
149291
149292
|
return;
|
|
149292
149293
|
}
|
|
149293
149294
|
if (selection.kind === "InlineFragment" && !selection.typeCondition) {
|
|
@@ -149376,12 +149377,26 @@ var FieldCollection = class {
|
|
|
149376
149377
|
return [fragment22.astNode];
|
|
149377
149378
|
}).concat(
|
|
149378
149379
|
Object.values(this.fields).map((field) => {
|
|
149379
|
-
|
|
149380
|
-
field.astNode
|
|
149381
|
-
|
|
149382
|
-
|
|
149380
|
+
return {
|
|
149381
|
+
...field.astNode,
|
|
149382
|
+
selectionSet: field.astNode.selectionSet ? {
|
|
149383
|
+
kind: "SelectionSet",
|
|
149384
|
+
selections: field.selection.toSelectionSet()
|
|
149385
|
+
} : void 0
|
|
149386
|
+
};
|
|
149383
149387
|
})
|
|
149384
|
-
).concat(
|
|
149388
|
+
).concat(
|
|
149389
|
+
Object.values(this.fragmentSpreads).map((spread) => {
|
|
149390
|
+
return {
|
|
149391
|
+
kind: "FragmentSpread",
|
|
149392
|
+
name: {
|
|
149393
|
+
kind: "Name",
|
|
149394
|
+
value: spread.name.value
|
|
149395
|
+
},
|
|
149396
|
+
directives: spread.directives
|
|
149397
|
+
};
|
|
149398
|
+
})
|
|
149399
|
+
);
|
|
149385
149400
|
}
|
|
149386
149401
|
walkInlineFragment(selection) {
|
|
149387
149402
|
const key = selection.typeCondition.name.value;
|
package/build/test-esm/index.js
CHANGED
|
@@ -149272,9 +149272,10 @@ var FieldCollection = class {
|
|
|
149272
149272
|
for (const subselect of selection.selectionSet?.selections || []) {
|
|
149273
149273
|
this.fields[key].selection.add(subselect);
|
|
149274
149274
|
}
|
|
149275
|
-
this.fields[key].selection.fragmentSpreads =
|
|
149276
|
-
selection.selectionSet?.selections ?? []
|
|
149277
|
-
|
|
149275
|
+
this.fields[key].selection.fragmentSpreads = {
|
|
149276
|
+
...this.collectFragmentSpreads(selection.selectionSet?.selections ?? []),
|
|
149277
|
+
...this.fields[key].selection.fragmentSpreads
|
|
149278
|
+
};
|
|
149278
149279
|
return;
|
|
149279
149280
|
}
|
|
149280
149281
|
if (selection.kind === "InlineFragment" && !selection.typeCondition) {
|
|
@@ -149363,12 +149364,26 @@ var FieldCollection = class {
|
|
|
149363
149364
|
return [fragment22.astNode];
|
|
149364
149365
|
}).concat(
|
|
149365
149366
|
Object.values(this.fields).map((field) => {
|
|
149366
|
-
|
|
149367
|
-
field.astNode
|
|
149368
|
-
|
|
149369
|
-
|
|
149367
|
+
return {
|
|
149368
|
+
...field.astNode,
|
|
149369
|
+
selectionSet: field.astNode.selectionSet ? {
|
|
149370
|
+
kind: "SelectionSet",
|
|
149371
|
+
selections: field.selection.toSelectionSet()
|
|
149372
|
+
} : void 0
|
|
149373
|
+
};
|
|
149370
149374
|
})
|
|
149371
|
-
).concat(
|
|
149375
|
+
).concat(
|
|
149376
|
+
Object.values(this.fragmentSpreads).map((spread) => {
|
|
149377
|
+
return {
|
|
149378
|
+
kind: "FragmentSpread",
|
|
149379
|
+
name: {
|
|
149380
|
+
kind: "Name",
|
|
149381
|
+
value: spread.name.value
|
|
149382
|
+
},
|
|
149383
|
+
directives: spread.directives
|
|
149384
|
+
};
|
|
149385
|
+
})
|
|
149386
|
+
);
|
|
149372
149387
|
}
|
|
149373
149388
|
walkInlineFragment(selection) {
|
|
149374
149389
|
const key = selection.typeCondition.name.value;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "houdini-svelte",
|
|
3
|
-
"version": "1.1.0",
|
|
3
|
+
"version": "1.1.1-next.0",
|
|
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.1.0"
|
|
35
|
+
"houdini": "^1.1.1-next.0"
|
|
36
36
|
},
|
|
37
37
|
"files": [
|
|
38
38
|
"build"
|