houdini-svelte 1.2.48 → 1.2.49

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.
@@ -77467,7 +77467,13 @@ var CacheInternal = class {
77467
77467
  } else if (!fieldSelection) {
77468
77468
  const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
77469
77469
  if (fnUnmarshal) {
77470
- fieldTarget[attributeName] = fnUnmarshal(value2);
77470
+ if (Array.isArray(value2)) {
77471
+ fieldTarget[attributeName] = value2.map(
77472
+ (v) => fnUnmarshal(v)
77473
+ );
77474
+ } else {
77475
+ fieldTarget[attributeName] = fnUnmarshal(value2);
77476
+ }
77471
77477
  } else {
77472
77478
  fieldTarget[attributeName] = value2;
77473
77479
  }
@@ -142422,7 +142428,13 @@ var CacheInternal2 = class {
142422
142428
  } else if (!fieldSelection) {
142423
142429
  const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
142424
142430
  if (fnUnmarshal) {
142425
- fieldTarget[attributeName] = fnUnmarshal(value2);
142431
+ if (Array.isArray(value2)) {
142432
+ fieldTarget[attributeName] = value2.map(
142433
+ (v) => fnUnmarshal(v)
142434
+ );
142435
+ } else {
142436
+ fieldTarget[attributeName] = fnUnmarshal(value2);
142437
+ }
142426
142438
  } else {
142427
142439
  fieldTarget[attributeName] = value2;
142428
142440
  }
@@ -77462,7 +77462,13 @@ var CacheInternal = class {
77462
77462
  } else if (!fieldSelection) {
77463
77463
  const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
77464
77464
  if (fnUnmarshal) {
77465
- fieldTarget[attributeName] = fnUnmarshal(value2);
77465
+ if (Array.isArray(value2)) {
77466
+ fieldTarget[attributeName] = value2.map(
77467
+ (v) => fnUnmarshal(v)
77468
+ );
77469
+ } else {
77470
+ fieldTarget[attributeName] = fnUnmarshal(value2);
77471
+ }
77466
77472
  } else {
77467
77473
  fieldTarget[attributeName] = value2;
77468
77474
  }
@@ -142416,7 +142422,13 @@ var CacheInternal2 = class {
142416
142422
  } else if (!fieldSelection) {
142417
142423
  const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
142418
142424
  if (fnUnmarshal) {
142419
- fieldTarget[attributeName] = fnUnmarshal(value2);
142425
+ if (Array.isArray(value2)) {
142426
+ fieldTarget[attributeName] = value2.map(
142427
+ (v) => fnUnmarshal(v)
142428
+ );
142429
+ } else {
142430
+ fieldTarget[attributeName] = fnUnmarshal(value2);
142431
+ }
142420
142432
  } else {
142421
142433
  fieldTarget[attributeName] = value2;
142422
142434
  }
@@ -78908,10 +78908,29 @@ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
78908
78908
  });
78909
78909
  });
78910
78910
  }
78911
- async function pullSchema(url, schemaPath, headers, skipWriting) {
78911
+ async function pullSchema(url, fetchTimeout, schemaPath, headers, skipWriting) {
78912
78912
  let content = "";
78913
78913
  try {
78914
- const resp = await fetch(url, {
78914
+ const fetchWithTimeout = (url2, timeoutMs, options) => {
78915
+ const controller = new AbortController();
78916
+ const promise = fetch(url2, {
78917
+ signal: controller.signal,
78918
+ ...options
78919
+ });
78920
+ const timeout = setTimeout(() => {
78921
+ controller.abort();
78922
+ }, timeoutMs);
78923
+ return promise.catch((err) => {
78924
+ if (err.type === "aborted") {
78925
+ throw Error(
78926
+ `reached timeout of ${timeoutMs}ms. Make sure the API is available and tweak this timeout in your config if your API is slow to respond.`
78927
+ );
78928
+ } else {
78929
+ return err;
78930
+ }
78931
+ }).finally(() => clearTimeout(timeout));
78932
+ };
78933
+ const resp = await fetchWithTimeout(url, fetchTimeout, {
78915
78934
  method: "POST",
78916
78935
  body: JSON.stringify({
78917
78936
  query: graphql.getIntrospectionQuery()
@@ -80802,7 +80821,13 @@ var CacheInternal = class {
80802
80821
  } else if (!fieldSelection) {
80803
80822
  const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
80804
80823
  if (fnUnmarshal) {
80805
- fieldTarget[attributeName] = fnUnmarshal(value2);
80824
+ if (Array.isArray(value2)) {
80825
+ fieldTarget[attributeName] = value2.map(
80826
+ (v) => fnUnmarshal(v)
80827
+ );
80828
+ } else {
80829
+ fieldTarget[attributeName] = fnUnmarshal(value2);
80830
+ }
80806
80831
  } else {
80807
80832
  fieldTarget[attributeName] = value2;
80808
80833
  }
@@ -81161,6 +81186,7 @@ var Config = class {
81161
81186
  configIsRoute = null;
81162
81187
  routesDir;
81163
81188
  schemaPollInterval;
81189
+ schemaPollTimeout;
81164
81190
  schemaPollHeaders;
81165
81191
  pluginMode = false;
81166
81192
  plugins = [];
@@ -81230,6 +81256,7 @@ var Config = class {
81230
81256
  this.defaultFragmentMasking = defaultFragmentMasking;
81231
81257
  this.routesDir = join2(this.projectRoot, "src", "routes");
81232
81258
  this.schemaPollInterval = watchSchema?.interval === void 0 ? 2e3 : watchSchema.interval;
81259
+ this.schemaPollTimeout = watchSchema?.timeout ?? 3e4;
81233
81260
  this.schemaPollHeaders = watchSchema?.headers ?? {};
81234
81261
  this.rootDir = join2(this.projectRoot, "$houdini");
81235
81262
  this.#fragmentVariableMaps = {};
@@ -81868,7 +81895,11 @@ async function getConfig({
81868
81895
  );
81869
81896
  } else if (!await readFile(_config.schemaPath)) {
81870
81897
  console.log("\u231B Pulling schema from api");
81871
- schemaOk = await pullSchema(apiURL, _config.schemaPath) !== null;
81898
+ schemaOk = await pullSchema(
81899
+ apiURL,
81900
+ _config.schemaPollTimeout,
81901
+ _config.schemaPath
81902
+ ) !== null;
81872
81903
  }
81873
81904
  }
81874
81905
  if (schemaOk && !noSchema) {
@@ -174234,7 +174265,13 @@ var CacheInternal2 = class {
174234
174265
  } else if (!fieldSelection) {
174235
174266
  const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
174236
174267
  if (fnUnmarshal) {
174237
- fieldTarget[attributeName] = fnUnmarshal(value2);
174268
+ if (Array.isArray(value2)) {
174269
+ fieldTarget[attributeName] = value2.map(
174270
+ (v) => fnUnmarshal(v)
174271
+ );
174272
+ } else {
174273
+ fieldTarget[attributeName] = fnUnmarshal(value2);
174274
+ }
174238
174275
  } else {
174239
174276
  fieldTarget[attributeName] = value2;
174240
174277
  }
@@ -78905,10 +78905,29 @@ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
78905
78905
  });
78906
78906
  });
78907
78907
  }
78908
- async function pullSchema(url, schemaPath, headers, skipWriting) {
78908
+ async function pullSchema(url, fetchTimeout, schemaPath, headers, skipWriting) {
78909
78909
  let content = "";
78910
78910
  try {
78911
- const resp = await fetch(url, {
78911
+ const fetchWithTimeout = (url2, timeoutMs, options) => {
78912
+ const controller = new AbortController();
78913
+ const promise = fetch(url2, {
78914
+ signal: controller.signal,
78915
+ ...options
78916
+ });
78917
+ const timeout = setTimeout(() => {
78918
+ controller.abort();
78919
+ }, timeoutMs);
78920
+ return promise.catch((err) => {
78921
+ if (err.type === "aborted") {
78922
+ throw Error(
78923
+ `reached timeout of ${timeoutMs}ms. Make sure the API is available and tweak this timeout in your config if your API is slow to respond.`
78924
+ );
78925
+ } else {
78926
+ return err;
78927
+ }
78928
+ }).finally(() => clearTimeout(timeout));
78929
+ };
78930
+ const resp = await fetchWithTimeout(url, fetchTimeout, {
78912
78931
  method: "POST",
78913
78932
  body: JSON.stringify({
78914
78933
  query: graphql.getIntrospectionQuery()
@@ -80799,7 +80818,13 @@ var CacheInternal = class {
80799
80818
  } else if (!fieldSelection) {
80800
80819
  const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
80801
80820
  if (fnUnmarshal) {
80802
- fieldTarget[attributeName] = fnUnmarshal(value2);
80821
+ if (Array.isArray(value2)) {
80822
+ fieldTarget[attributeName] = value2.map(
80823
+ (v) => fnUnmarshal(v)
80824
+ );
80825
+ } else {
80826
+ fieldTarget[attributeName] = fnUnmarshal(value2);
80827
+ }
80803
80828
  } else {
80804
80829
  fieldTarget[attributeName] = value2;
80805
80830
  }
@@ -81158,6 +81183,7 @@ var Config = class {
81158
81183
  configIsRoute = null;
81159
81184
  routesDir;
81160
81185
  schemaPollInterval;
81186
+ schemaPollTimeout;
81161
81187
  schemaPollHeaders;
81162
81188
  pluginMode = false;
81163
81189
  plugins = [];
@@ -81227,6 +81253,7 @@ var Config = class {
81227
81253
  this.defaultFragmentMasking = defaultFragmentMasking;
81228
81254
  this.routesDir = join2(this.projectRoot, "src", "routes");
81229
81255
  this.schemaPollInterval = watchSchema?.interval === void 0 ? 2e3 : watchSchema.interval;
81256
+ this.schemaPollTimeout = watchSchema?.timeout ?? 3e4;
81230
81257
  this.schemaPollHeaders = watchSchema?.headers ?? {};
81231
81258
  this.rootDir = join2(this.projectRoot, "$houdini");
81232
81259
  this.#fragmentVariableMaps = {};
@@ -81865,7 +81892,11 @@ async function getConfig({
81865
81892
  );
81866
81893
  } else if (!await readFile(_config.schemaPath)) {
81867
81894
  console.log("\u231B Pulling schema from api");
81868
- schemaOk = await pullSchema(apiURL, _config.schemaPath) !== null;
81895
+ schemaOk = await pullSchema(
81896
+ apiURL,
81897
+ _config.schemaPollTimeout,
81898
+ _config.schemaPath
81899
+ ) !== null;
81869
81900
  }
81870
81901
  }
81871
81902
  if (schemaOk && !noSchema) {
@@ -174230,7 +174261,13 @@ var CacheInternal2 = class {
174230
174261
  } else if (!fieldSelection) {
174231
174262
  const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
174232
174263
  if (fnUnmarshal) {
174233
- fieldTarget[attributeName] = fnUnmarshal(value2);
174264
+ if (Array.isArray(value2)) {
174265
+ fieldTarget[attributeName] = value2.map(
174266
+ (v) => fnUnmarshal(v)
174267
+ );
174268
+ } else {
174269
+ fieldTarget[attributeName] = fnUnmarshal(value2);
174270
+ }
174234
174271
  } else {
174235
174272
  fieldTarget[attributeName] = value2;
174236
174273
  }
@@ -77470,7 +77470,13 @@ var CacheInternal = class {
77470
77470
  } else if (!fieldSelection) {
77471
77471
  const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
77472
77472
  if (fnUnmarshal) {
77473
- fieldTarget[attributeName] = fnUnmarshal(value2);
77473
+ if (Array.isArray(value2)) {
77474
+ fieldTarget[attributeName] = value2.map(
77475
+ (v) => fnUnmarshal(v)
77476
+ );
77477
+ } else {
77478
+ fieldTarget[attributeName] = fnUnmarshal(value2);
77479
+ }
77474
77480
  } else {
77475
77481
  fieldTarget[attributeName] = value2;
77476
77482
  }
@@ -134306,7 +134312,13 @@ var CacheInternal2 = class {
134306
134312
  } else if (!fieldSelection) {
134307
134313
  const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
134308
134314
  if (fnUnmarshal) {
134309
- fieldTarget[attributeName] = fnUnmarshal(value2);
134315
+ if (Array.isArray(value2)) {
134316
+ fieldTarget[attributeName] = value2.map(
134317
+ (v) => fnUnmarshal(v)
134318
+ );
134319
+ } else {
134320
+ fieldTarget[attributeName] = fnUnmarshal(value2);
134321
+ }
134310
134322
  } else {
134311
134323
  fieldTarget[attributeName] = value2;
134312
134324
  }
@@ -198573,7 +198585,13 @@ var CacheInternal3 = class {
198573
198585
  } else if (!fieldSelection) {
198574
198586
  const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
198575
198587
  if (fnUnmarshal) {
198576
- fieldTarget[attributeName] = fnUnmarshal(value2);
198588
+ if (Array.isArray(value2)) {
198589
+ fieldTarget[attributeName] = value2.map(
198590
+ (v) => fnUnmarshal(v)
198591
+ );
198592
+ } else {
198593
+ fieldTarget[attributeName] = fnUnmarshal(value2);
198594
+ }
198577
198595
  } else {
198578
198596
  fieldTarget[attributeName] = value2;
198579
198597
  }
@@ -198932,6 +198950,7 @@ var Config = class {
198932
198950
  configIsRoute = null;
198933
198951
  routesDir;
198934
198952
  schemaPollInterval;
198953
+ schemaPollTimeout;
198935
198954
  schemaPollHeaders;
198936
198955
  pluginMode = false;
198937
198956
  plugins = [];
@@ -199001,6 +199020,7 @@ var Config = class {
199001
199020
  this.defaultFragmentMasking = defaultFragmentMasking;
199002
199021
  this.routesDir = join4(this.projectRoot, "src", "routes");
199003
199022
  this.schemaPollInterval = watchSchema?.interval === void 0 ? 2e3 : watchSchema.interval;
199023
+ this.schemaPollTimeout = watchSchema?.timeout ?? 3e4;
199004
199024
  this.schemaPollHeaders = watchSchema?.headers ?? {};
199005
199025
  this.rootDir = join4(this.projectRoot, "$houdini");
199006
199026
  this.#fragmentVariableMaps = {};
@@ -264282,7 +264302,13 @@ var CacheInternal4 = class {
264282
264302
  } else if (!fieldSelection) {
264283
264303
  const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
264284
264304
  if (fnUnmarshal) {
264285
- fieldTarget[attributeName] = fnUnmarshal(value2);
264305
+ if (Array.isArray(value2)) {
264306
+ fieldTarget[attributeName] = value2.map(
264307
+ (v) => fnUnmarshal(v)
264308
+ );
264309
+ } else {
264310
+ fieldTarget[attributeName] = fnUnmarshal(value2);
264311
+ }
264286
264312
  } else {
264287
264313
  fieldTarget[attributeName] = value2;
264288
264314
  }
@@ -77462,7 +77462,13 @@ var CacheInternal = class {
77462
77462
  } else if (!fieldSelection) {
77463
77463
  const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
77464
77464
  if (fnUnmarshal) {
77465
- fieldTarget[attributeName] = fnUnmarshal(value2);
77465
+ if (Array.isArray(value2)) {
77466
+ fieldTarget[attributeName] = value2.map(
77467
+ (v) => fnUnmarshal(v)
77468
+ );
77469
+ } else {
77470
+ fieldTarget[attributeName] = fnUnmarshal(value2);
77471
+ }
77466
77472
  } else {
77467
77473
  fieldTarget[attributeName] = value2;
77468
77474
  }
@@ -134297,7 +134303,13 @@ var CacheInternal2 = class {
134297
134303
  } else if (!fieldSelection) {
134298
134304
  const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
134299
134305
  if (fnUnmarshal) {
134300
- fieldTarget[attributeName] = fnUnmarshal(value2);
134306
+ if (Array.isArray(value2)) {
134307
+ fieldTarget[attributeName] = value2.map(
134308
+ (v) => fnUnmarshal(v)
134309
+ );
134310
+ } else {
134311
+ fieldTarget[attributeName] = fnUnmarshal(value2);
134312
+ }
134301
134313
  } else {
134302
134314
  fieldTarget[attributeName] = value2;
134303
134315
  }
@@ -198563,7 +198575,13 @@ var CacheInternal3 = class {
198563
198575
  } else if (!fieldSelection) {
198564
198576
  const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
198565
198577
  if (fnUnmarshal) {
198566
- fieldTarget[attributeName] = fnUnmarshal(value2);
198578
+ if (Array.isArray(value2)) {
198579
+ fieldTarget[attributeName] = value2.map(
198580
+ (v) => fnUnmarshal(v)
198581
+ );
198582
+ } else {
198583
+ fieldTarget[attributeName] = fnUnmarshal(value2);
198584
+ }
198567
198585
  } else {
198568
198586
  fieldTarget[attributeName] = value2;
198569
198587
  }
@@ -198922,6 +198940,7 @@ var Config = class {
198922
198940
  configIsRoute = null;
198923
198941
  routesDir;
198924
198942
  schemaPollInterval;
198943
+ schemaPollTimeout;
198925
198944
  schemaPollHeaders;
198926
198945
  pluginMode = false;
198927
198946
  plugins = [];
@@ -198991,6 +199010,7 @@ var Config = class {
198991
199010
  this.defaultFragmentMasking = defaultFragmentMasking;
198992
199011
  this.routesDir = join4(this.projectRoot, "src", "routes");
198993
199012
  this.schemaPollInterval = watchSchema?.interval === void 0 ? 2e3 : watchSchema.interval;
199013
+ this.schemaPollTimeout = watchSchema?.timeout ?? 3e4;
198994
199014
  this.schemaPollHeaders = watchSchema?.headers ?? {};
198995
199015
  this.rootDir = join4(this.projectRoot, "$houdini");
198996
199016
  this.#fragmentVariableMaps = {};
@@ -264271,7 +264291,13 @@ var CacheInternal4 = class {
264271
264291
  } else if (!fieldSelection) {
264272
264292
  const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
264273
264293
  if (fnUnmarshal) {
264274
- fieldTarget[attributeName] = fnUnmarshal(value2);
264294
+ if (Array.isArray(value2)) {
264295
+ fieldTarget[attributeName] = value2.map(
264296
+ (v) => fnUnmarshal(v)
264297
+ );
264298
+ } else {
264299
+ fieldTarget[attributeName] = fnUnmarshal(value2);
264300
+ }
264275
264301
  } else {
264276
264302
  fieldTarget[attributeName] = value2;
264277
264303
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "houdini-svelte",
3
- "version": "1.2.48",
3
+ "version": "1.2.49",
4
4
  "description": "The svelte plugin for houdini",
5
5
  "keywords": [
6
6
  "typescript",
@@ -33,7 +33,7 @@
33
33
  "rollup": "^3.7.4",
34
34
  "svelte": "^3.57.0",
35
35
  "vite": "^4.1.1",
36
- "houdini": "^1.2.48"
36
+ "houdini": "^1.2.49"
37
37
  },
38
38
  "files": [
39
39
  "build"