houdini-svelte 2.1.8 → 2.1.9
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 +0 -2
- package/build/plugin-esm/index.js +0 -2
- package/build/runtime/client.d.ts +0 -1
- package/build/runtime-cjs/client.d.ts +0 -1
- package/build/runtime-cjs/client.js +5 -14
- package/build/runtime-cjs/stores/base.js +0 -5
- package/build/runtime-cjs/stores/mutation.js +0 -2
- package/build/runtime-cjs/stores/pagination/fragment.js +0 -3
- package/build/runtime-cjs/stores/pagination/query.js +0 -3
- package/build/runtime-cjs/stores/query.js +1 -1
- package/build/runtime-cjs/stores/subscription.js +0 -3
- package/build/runtime-esm/client.d.ts +0 -1
- package/build/runtime-esm/client.js +2 -10
- package/build/runtime-esm/stores/base.js +1 -6
- package/build/runtime-esm/stores/mutation.js +0 -2
- package/build/runtime-esm/stores/pagination/fragment.js +1 -4
- package/build/runtime-esm/stores/pagination/query.js +1 -4
- package/build/runtime-esm/stores/query.js +2 -2
- package/build/runtime-esm/stores/subscription.js +0 -3
- package/build/test-cjs/index.js +0 -2
- package/build/test-esm/index.js +0 -2
- package/package.json +1 -1
|
@@ -152853,7 +152853,6 @@ async function queryStore({ config, pluginRoot }, doc) {
|
|
|
152853
152853
|
const { store_class, statement } = store_import2(config, which);
|
|
152854
152854
|
const storeData = `${statement}
|
|
152855
152855
|
import artifact from '$houdini/artifacts/${artifactName}'
|
|
152856
|
-
import { initClient } from '$houdini/plugins/houdini-svelte/runtime/client'
|
|
152857
152856
|
|
|
152858
152857
|
export class ${storeName} extends ${store_class} {
|
|
152859
152858
|
constructor() {
|
|
@@ -152866,7 +152865,6 @@ export class ${storeName} extends ${store_class} {
|
|
|
152866
152865
|
}
|
|
152867
152866
|
|
|
152868
152867
|
export async function load_${artifactName}(params) {
|
|
152869
|
-
await initClient()
|
|
152870
152868
|
|
|
152871
152869
|
const store = new ${storeName}()
|
|
152872
152870
|
|
|
@@ -152848,7 +152848,6 @@ async function queryStore({ config, pluginRoot }, doc) {
|
|
|
152848
152848
|
const { store_class, statement } = store_import2(config, which);
|
|
152849
152849
|
const storeData = `${statement}
|
|
152850
152850
|
import artifact from '$houdini/artifacts/${artifactName}'
|
|
152851
|
-
import { initClient } from '$houdini/plugins/houdini-svelte/runtime/client'
|
|
152852
152851
|
|
|
152853
152852
|
export class ${storeName} extends ${store_class} {
|
|
152854
152853
|
constructor() {
|
|
@@ -152861,7 +152860,6 @@ export class ${storeName} extends ${store_class} {
|
|
|
152861
152860
|
}
|
|
152862
152861
|
|
|
152863
152862
|
export async function load_${artifactName}(params) {
|
|
152864
|
-
await initClient()
|
|
152865
152863
|
|
|
152866
152864
|
const store = new ${storeName}()
|
|
152867
152865
|
|
|
@@ -24,26 +24,17 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
25
|
var client_exports = {};
|
|
26
26
|
__export(client_exports, {
|
|
27
|
-
getClient: () => getClient
|
|
28
|
-
initClient: () => initClient
|
|
27
|
+
getClient: () => getClient
|
|
29
28
|
});
|
|
30
29
|
module.exports = __toCommonJS(client_exports);
|
|
31
|
-
|
|
32
|
-
async function initClient() {
|
|
33
|
-
if (client) {
|
|
34
|
-
return client;
|
|
35
|
-
}
|
|
36
|
-
client = (await import("HOUDINI_CLIENT_PATH")).default;
|
|
37
|
-
return client;
|
|
38
|
-
}
|
|
30
|
+
var import_HOUDINI_CLIENT_PATH = __toESM(require("HOUDINI_CLIENT_PATH"), 1);
|
|
39
31
|
function getClient() {
|
|
40
|
-
if (!
|
|
32
|
+
if (!import_HOUDINI_CLIENT_PATH.default) {
|
|
41
33
|
throw new Error("client hasn't been initialized");
|
|
42
34
|
}
|
|
43
|
-
return
|
|
35
|
+
return import_HOUDINI_CLIENT_PATH.default;
|
|
44
36
|
}
|
|
45
37
|
// Annotate the CommonJS export names for ESM import in node:
|
|
46
38
|
0 && (module.exports = {
|
|
47
|
-
getClient
|
|
48
|
-
initClient
|
|
39
|
+
getClient
|
|
49
40
|
});
|
|
@@ -73,11 +73,6 @@ class BaseStore {
|
|
|
73
73
|
#subscriberCount = 0;
|
|
74
74
|
setup(init = true) {
|
|
75
75
|
let initPromise = Promise.resolve();
|
|
76
|
-
try {
|
|
77
|
-
(0, import_client2.getClient)();
|
|
78
|
-
} catch {
|
|
79
|
-
initPromise = (0, import_client2.initClient)();
|
|
80
|
-
}
|
|
81
76
|
initPromise.then(() => {
|
|
82
77
|
if (this.#unsubscribe) {
|
|
83
78
|
return;
|
|
@@ -21,7 +21,6 @@ __export(mutation_exports, {
|
|
|
21
21
|
MutationStore: () => MutationStore
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(mutation_exports);
|
|
24
|
-
var import_client = require("../client");
|
|
25
24
|
var import_base = require("./base");
|
|
26
25
|
var import_query = require("./query");
|
|
27
26
|
class MutationStore extends import_base.BaseStore {
|
|
@@ -33,7 +32,6 @@ class MutationStore extends import_base.BaseStore {
|
|
|
33
32
|
abortController,
|
|
34
33
|
...mutationConfig
|
|
35
34
|
} = {}) {
|
|
36
|
-
await (0, import_client.initClient)();
|
|
37
35
|
const { context } = await (0, import_query.fetchParams)(this.artifact, this.artifact.name, {
|
|
38
36
|
fetch,
|
|
39
37
|
metadata,
|
|
@@ -105,7 +105,6 @@ class FragmentStoreCursor extends BasePaginatedFragmentStore {
|
|
|
105
105
|
getVariables,
|
|
106
106
|
artifact: this.paginationArtifact,
|
|
107
107
|
fetchUpdate: async (args, updates) => {
|
|
108
|
-
await (0, import_client.initClient)();
|
|
109
108
|
return observer.send({
|
|
110
109
|
session: await (0, import_session.getSession)(),
|
|
111
110
|
...args,
|
|
@@ -120,7 +119,6 @@ class FragmentStoreCursor extends BasePaginatedFragmentStore {
|
|
|
120
119
|
});
|
|
121
120
|
},
|
|
122
121
|
fetch: async (args) => {
|
|
123
|
-
await (0, import_client.initClient)();
|
|
124
122
|
return await observer.send({
|
|
125
123
|
session: await (0, import_session.getSession)(),
|
|
126
124
|
...args,
|
|
@@ -167,7 +165,6 @@ class FragmentStoreOffset extends BasePaginatedFragmentStore {
|
|
|
167
165
|
});
|
|
168
166
|
},
|
|
169
167
|
fetchUpdate: async (args) => {
|
|
170
|
-
await (0, import_client.initClient)();
|
|
171
168
|
return paginationStore.send({
|
|
172
169
|
session: await (0, import_session.getSession)(),
|
|
173
170
|
...args,
|
|
@@ -38,7 +38,6 @@ class QueryStoreCursor extends import_query.QueryStore {
|
|
|
38
38
|
if (this.#_handlers) {
|
|
39
39
|
return this.#_handlers;
|
|
40
40
|
}
|
|
41
|
-
await (0, import_client.initClient)();
|
|
42
41
|
const paginationObserver = (0, import_client.getClient)().observe({
|
|
43
42
|
artifact: this.artifact
|
|
44
43
|
});
|
|
@@ -116,7 +115,6 @@ class QueryStoreOffset extends import_query.QueryStore {
|
|
|
116
115
|
if (this.#_handlers) {
|
|
117
116
|
return this.#_handlers;
|
|
118
117
|
}
|
|
119
|
-
await (0, import_client.initClient)();
|
|
120
118
|
const paginationObserver = (0, import_client.getClient)().observe({
|
|
121
119
|
artifact: this.artifact
|
|
122
120
|
});
|
|
@@ -128,7 +126,6 @@ class QueryStoreOffset extends import_query.QueryStore {
|
|
|
128
126
|
getVariables: () => (0, import_store.get)(this.observer).variables,
|
|
129
127
|
getSession: import_session.getSession,
|
|
130
128
|
fetchUpdate: async (args) => {
|
|
131
|
-
await (0, import_client.initClient)();
|
|
132
129
|
return paginationObserver.send({
|
|
133
130
|
...args,
|
|
134
131
|
variables: {
|
|
@@ -52,7 +52,7 @@ class QueryStore extends import_base.BaseStore {
|
|
|
52
52
|
this.variables = variables;
|
|
53
53
|
}
|
|
54
54
|
async fetch(args) {
|
|
55
|
-
const client =
|
|
55
|
+
const client = (0, import_client.getClient)();
|
|
56
56
|
this.setup(false);
|
|
57
57
|
const { policy, params, context } = await fetchParams(this.artifact, this.storeName, args);
|
|
58
58
|
if (!import_adapter.isBrowser && !(params && "fetch" in params) && (!params || !("event" in params))) {
|
|
@@ -23,7 +23,6 @@ __export(subscription_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(subscription_exports);
|
|
24
24
|
var import_types = require("$houdini/runtime/lib/types");
|
|
25
25
|
var import_store = require("svelte/store");
|
|
26
|
-
var import_client = require("../client");
|
|
27
26
|
var import_session = require("../session");
|
|
28
27
|
var import_base = require("./base");
|
|
29
28
|
class SubscriptionStore extends import_base.BaseStore {
|
|
@@ -35,7 +34,6 @@ class SubscriptionStore extends import_base.BaseStore {
|
|
|
35
34
|
}
|
|
36
35
|
async listen(variables, args) {
|
|
37
36
|
this.fetchingStore.set(true);
|
|
38
|
-
await (0, import_client.initClient)();
|
|
39
37
|
this.observer.send({
|
|
40
38
|
variables,
|
|
41
39
|
session: await (0, import_session.getSession)(),
|
|
@@ -44,7 +42,6 @@ class SubscriptionStore extends import_base.BaseStore {
|
|
|
44
42
|
}
|
|
45
43
|
async unlisten() {
|
|
46
44
|
this.fetchingStore.set(false);
|
|
47
|
-
await (0, import_client.initClient)();
|
|
48
45
|
await this.observer.cleanup();
|
|
49
46
|
}
|
|
50
47
|
subscribe(run, invalidate) {
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
async function initClient() {
|
|
3
|
-
if (client) {
|
|
4
|
-
return client;
|
|
5
|
-
}
|
|
6
|
-
client = (await import("HOUDINI_CLIENT_PATH")).default;
|
|
7
|
-
return client;
|
|
8
|
-
}
|
|
1
|
+
import client from "HOUDINI_CLIENT_PATH";
|
|
9
2
|
function getClient() {
|
|
10
3
|
if (!client) {
|
|
11
4
|
throw new Error("client hasn't been initialized");
|
|
@@ -13,6 +6,5 @@ function getClient() {
|
|
|
13
6
|
return client;
|
|
14
7
|
}
|
|
15
8
|
export {
|
|
16
|
-
getClient
|
|
17
|
-
initClient
|
|
9
|
+
getClient
|
|
18
10
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DocumentStore } from "$houdini/runtime/client";
|
|
2
2
|
import { get } from "svelte/store";
|
|
3
3
|
import { isBrowser } from "../adapter";
|
|
4
|
-
import { getClient
|
|
4
|
+
import { getClient } from "../client";
|
|
5
5
|
class BaseStore {
|
|
6
6
|
#params;
|
|
7
7
|
get artifact() {
|
|
@@ -50,11 +50,6 @@ class BaseStore {
|
|
|
50
50
|
#subscriberCount = 0;
|
|
51
51
|
setup(init = true) {
|
|
52
52
|
let initPromise = Promise.resolve();
|
|
53
|
-
try {
|
|
54
|
-
getClient();
|
|
55
|
-
} catch {
|
|
56
|
-
initPromise = initClient();
|
|
57
|
-
}
|
|
58
53
|
initPromise.then(() => {
|
|
59
54
|
if (this.#unsubscribe) {
|
|
60
55
|
return;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { initClient } from "../client";
|
|
2
1
|
import { BaseStore } from "./base";
|
|
3
2
|
import { fetchParams } from "./query";
|
|
4
3
|
class MutationStore extends BaseStore {
|
|
@@ -10,7 +9,6 @@ class MutationStore extends BaseStore {
|
|
|
10
9
|
abortController,
|
|
11
10
|
...mutationConfig
|
|
12
11
|
} = {}) {
|
|
13
|
-
await initClient();
|
|
14
12
|
const { context } = await fetchParams(this.artifact, this.artifact.name, {
|
|
15
13
|
fetch,
|
|
16
14
|
metadata,
|
|
@@ -4,7 +4,7 @@ import { extractPageInfo } from "$houdini/runtime/lib/pageInfo";
|
|
|
4
4
|
import { cursorHandlers, offsetHandlers } from "$houdini/runtime/lib/pagination";
|
|
5
5
|
import { CompiledFragmentKind } from "$houdini/runtime/lib/types";
|
|
6
6
|
import { derived, get } from "svelte/store";
|
|
7
|
-
import { getClient
|
|
7
|
+
import { getClient } from "../../client";
|
|
8
8
|
import { getSession } from "../../session";
|
|
9
9
|
import { FragmentStore } from "../fragment";
|
|
10
10
|
class BasePaginatedFragmentStore {
|
|
@@ -81,7 +81,6 @@ class FragmentStoreCursor extends BasePaginatedFragmentStore {
|
|
|
81
81
|
getVariables,
|
|
82
82
|
artifact: this.paginationArtifact,
|
|
83
83
|
fetchUpdate: async (args, updates) => {
|
|
84
|
-
await initClient();
|
|
85
84
|
return observer.send({
|
|
86
85
|
session: await getSession(),
|
|
87
86
|
...args,
|
|
@@ -96,7 +95,6 @@ class FragmentStoreCursor extends BasePaginatedFragmentStore {
|
|
|
96
95
|
});
|
|
97
96
|
},
|
|
98
97
|
fetch: async (args) => {
|
|
99
|
-
await initClient();
|
|
100
98
|
return await observer.send({
|
|
101
99
|
session: await getSession(),
|
|
102
100
|
...args,
|
|
@@ -143,7 +141,6 @@ class FragmentStoreOffset extends BasePaginatedFragmentStore {
|
|
|
143
141
|
});
|
|
144
142
|
},
|
|
145
143
|
fetchUpdate: async (args) => {
|
|
146
|
-
await initClient();
|
|
147
144
|
return paginationStore.send({
|
|
148
145
|
session: await getSession(),
|
|
149
146
|
...args,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { extractPageInfo } from "$houdini/runtime/lib/pageInfo";
|
|
2
2
|
import { cursorHandlers, offsetHandlers } from "$houdini/runtime/lib/pagination";
|
|
3
3
|
import { get, derived } from "svelte/store";
|
|
4
|
-
import { getClient
|
|
4
|
+
import { getClient } from "../../client";
|
|
5
5
|
import { getSession } from "../../session";
|
|
6
6
|
import { QueryStore } from "../query";
|
|
7
7
|
class QueryStoreCursor extends QueryStore {
|
|
@@ -14,7 +14,6 @@ class QueryStoreCursor extends QueryStore {
|
|
|
14
14
|
if (this.#_handlers) {
|
|
15
15
|
return this.#_handlers;
|
|
16
16
|
}
|
|
17
|
-
await initClient();
|
|
18
17
|
const paginationObserver = getClient().observe({
|
|
19
18
|
artifact: this.artifact
|
|
20
19
|
});
|
|
@@ -92,7 +91,6 @@ class QueryStoreOffset extends QueryStore {
|
|
|
92
91
|
if (this.#_handlers) {
|
|
93
92
|
return this.#_handlers;
|
|
94
93
|
}
|
|
95
|
-
await initClient();
|
|
96
94
|
const paginationObserver = getClient().observe({
|
|
97
95
|
artifact: this.artifact
|
|
98
96
|
});
|
|
@@ -104,7 +102,6 @@ class QueryStoreOffset extends QueryStore {
|
|
|
104
102
|
getVariables: () => get(this.observer).variables,
|
|
105
103
|
getSession,
|
|
106
104
|
fetchUpdate: async (args) => {
|
|
107
|
-
await initClient();
|
|
108
105
|
return paginationObserver.send({
|
|
109
106
|
...args,
|
|
110
107
|
variables: {
|
|
@@ -3,7 +3,7 @@ import * as log from "$houdini/runtime/lib/log";
|
|
|
3
3
|
import { ArtifactKind, CachePolicy, CompiledQueryKind } from "$houdini/runtime/lib/types";
|
|
4
4
|
import { get } from "svelte/store";
|
|
5
5
|
import { clientStarted, isBrowser } from "../adapter";
|
|
6
|
-
import {
|
|
6
|
+
import { getClient } from "../client";
|
|
7
7
|
import { getSession } from "../session";
|
|
8
8
|
import { BaseStore } from "./base";
|
|
9
9
|
class QueryStore extends BaseStore {
|
|
@@ -22,7 +22,7 @@ class QueryStore extends BaseStore {
|
|
|
22
22
|
this.variables = variables;
|
|
23
23
|
}
|
|
24
24
|
async fetch(args) {
|
|
25
|
-
const client =
|
|
25
|
+
const client = getClient();
|
|
26
26
|
this.setup(false);
|
|
27
27
|
const { policy, params, context } = await fetchParams(this.artifact, this.storeName, args);
|
|
28
28
|
if (!isBrowser && !(params && "fetch" in params) && (!params || !("event" in params))) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CompiledSubscriptionKind } from "$houdini/runtime/lib/types";
|
|
2
2
|
import { derived, writable } from "svelte/store";
|
|
3
|
-
import { initClient } from "../client";
|
|
4
3
|
import { getSession } from "../session";
|
|
5
4
|
import { BaseStore } from "./base";
|
|
6
5
|
class SubscriptionStore extends BaseStore {
|
|
@@ -12,7 +11,6 @@ class SubscriptionStore extends BaseStore {
|
|
|
12
11
|
}
|
|
13
12
|
async listen(variables, args) {
|
|
14
13
|
this.fetchingStore.set(true);
|
|
15
|
-
await initClient();
|
|
16
14
|
this.observer.send({
|
|
17
15
|
variables,
|
|
18
16
|
session: await getSession(),
|
|
@@ -21,7 +19,6 @@ class SubscriptionStore extends BaseStore {
|
|
|
21
19
|
}
|
|
22
20
|
async unlisten() {
|
|
23
21
|
this.fetchingStore.set(false);
|
|
24
|
-
await initClient();
|
|
25
22
|
await this.observer.cleanup();
|
|
26
23
|
}
|
|
27
24
|
subscribe(run, invalidate) {
|
package/build/test-cjs/index.js
CHANGED
|
@@ -282710,7 +282710,6 @@ async function queryStore({ config, pluginRoot }, doc) {
|
|
|
282710
282710
|
const { store_class, statement } = store_import2(config, which);
|
|
282711
282711
|
const storeData = `${statement}
|
|
282712
282712
|
import artifact from '$houdini/artifacts/${artifactName}'
|
|
282713
|
-
import { initClient } from '$houdini/plugins/houdini-svelte/runtime/client'
|
|
282714
282713
|
|
|
282715
282714
|
export class ${storeName} extends ${store_class} {
|
|
282716
282715
|
constructor() {
|
|
@@ -282723,7 +282722,6 @@ export class ${storeName} extends ${store_class} {
|
|
|
282723
282722
|
}
|
|
282724
282723
|
|
|
282725
282724
|
export async function load_${artifactName}(params) {
|
|
282726
|
-
await initClient()
|
|
282727
282725
|
|
|
282728
282726
|
const store = new ${storeName}()
|
|
282729
282727
|
|
package/build/test-esm/index.js
CHANGED
|
@@ -282699,7 +282699,6 @@ async function queryStore({ config, pluginRoot }, doc) {
|
|
|
282699
282699
|
const { store_class, statement } = store_import2(config, which);
|
|
282700
282700
|
const storeData = `${statement}
|
|
282701
282701
|
import artifact from '$houdini/artifacts/${artifactName}'
|
|
282702
|
-
import { initClient } from '$houdini/plugins/houdini-svelte/runtime/client'
|
|
282703
282702
|
|
|
282704
282703
|
export class ${storeName} extends ${store_class} {
|
|
282705
282704
|
constructor() {
|
|
@@ -282712,7 +282711,6 @@ export class ${storeName} extends ${store_class} {
|
|
|
282712
282711
|
}
|
|
282713
282712
|
|
|
282714
282713
|
export async function load_${artifactName}(params) {
|
|
282715
|
-
await initClient()
|
|
282716
282714
|
|
|
282717
282715
|
const store = new ${storeName}()
|
|
282718
282716
|
|