houdini 1.0.2 → 1.0.4

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.
@@ -15475,109 +15475,6 @@ var require_minimatch = __commonJS({
15475
15475
  }
15476
15476
  });
15477
15477
 
15478
- // ../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js
15479
- var require_cjs = __commonJS({
15480
- "../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js"(exports, module2) {
15481
- "use strict";
15482
- var isMergeableObject = function isMergeableObject2(value) {
15483
- return isNonNullObject(value) && !isSpecial(value);
15484
- };
15485
- function isNonNullObject(value) {
15486
- return !!value && typeof value === "object";
15487
- }
15488
- function isSpecial(value) {
15489
- var stringValue = Object.prototype.toString.call(value);
15490
- return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
15491
- }
15492
- var canUseSymbol = typeof Symbol === "function" && Symbol.for;
15493
- var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
15494
- function isReactElement(value) {
15495
- return value.$$typeof === REACT_ELEMENT_TYPE;
15496
- }
15497
- function emptyTarget(val) {
15498
- return Array.isArray(val) ? [] : {};
15499
- }
15500
- function cloneUnlessOtherwiseSpecified(value, options) {
15501
- return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
15502
- }
15503
- function defaultArrayMerge(target, source, options) {
15504
- return target.concat(source).map(function(element) {
15505
- return cloneUnlessOtherwiseSpecified(element, options);
15506
- });
15507
- }
15508
- function getMergeFunction(key, options) {
15509
- if (!options.customMerge) {
15510
- return deepmerge;
15511
- }
15512
- var customMerge = options.customMerge(key);
15513
- return typeof customMerge === "function" ? customMerge : deepmerge;
15514
- }
15515
- function getEnumerableOwnPropertySymbols(target) {
15516
- return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
15517
- return target.propertyIsEnumerable(symbol);
15518
- }) : [];
15519
- }
15520
- function getKeys(target) {
15521
- return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
15522
- }
15523
- function propertyIsOnObject(object, property) {
15524
- try {
15525
- return property in object;
15526
- } catch (_) {
15527
- return false;
15528
- }
15529
- }
15530
- function propertyIsUnsafe(target, key) {
15531
- return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
15532
- }
15533
- function mergeObject(target, source, options) {
15534
- var destination = {};
15535
- if (options.isMergeableObject(target)) {
15536
- getKeys(target).forEach(function(key) {
15537
- destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
15538
- });
15539
- }
15540
- getKeys(source).forEach(function(key) {
15541
- if (propertyIsUnsafe(target, key)) {
15542
- return;
15543
- }
15544
- if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
15545
- destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
15546
- } else {
15547
- destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
15548
- }
15549
- });
15550
- return destination;
15551
- }
15552
- function deepmerge(target, source, options) {
15553
- options = options || {};
15554
- options.arrayMerge = options.arrayMerge || defaultArrayMerge;
15555
- options.isMergeableObject = options.isMergeableObject || isMergeableObject;
15556
- options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
15557
- var sourceIsArray = Array.isArray(source);
15558
- var targetIsArray = Array.isArray(target);
15559
- var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
15560
- if (!sourceAndTargetTypesMatch) {
15561
- return cloneUnlessOtherwiseSpecified(source, options);
15562
- } else if (sourceIsArray) {
15563
- return options.arrayMerge(target, source, options);
15564
- } else {
15565
- return mergeObject(target, source, options);
15566
- }
15567
- }
15568
- deepmerge.all = function deepmergeAll(array, options) {
15569
- if (!Array.isArray(array)) {
15570
- throw new Error("first argument should be an array");
15571
- }
15572
- return array.reduce(function(prev, next) {
15573
- return deepmerge(prev, next, options);
15574
- }, {});
15575
- };
15576
- var deepmerge_1 = deepmerge;
15577
- module2.exports = deepmerge_1;
15578
- }
15579
- });
15580
-
15581
15478
  // ../../node_modules/.pnpm/universalify@2.0.0/node_modules/universalify/index.js
15582
15479
  var require_universalify = __commonJS({
15583
15480
  "../../node_modules/.pnpm/universalify@2.0.0/node_modules/universalify/index.js"(exports) {
@@ -54000,11 +53897,11 @@ var require_esprima2 = __commonJS({
54000
53897
  case "}":
54001
53898
  regex = false;
54002
53899
  if (this.values[this.curly - 3] === "function") {
54003
- var check = this.values[this.curly - 4];
54004
- regex = check ? !this.beforeFunctionExpression(check) : false;
53900
+ var check2 = this.values[this.curly - 4];
53901
+ regex = check2 ? !this.beforeFunctionExpression(check2) : false;
54005
53902
  } else if (this.values[this.curly - 4] === "function") {
54006
- var check = this.values[this.curly - 5];
54007
- regex = check ? !this.beforeFunctionExpression(check) : true;
53903
+ var check2 = this.values[this.curly - 5];
53904
+ regex = check2 ? !this.beforeFunctionExpression(check2) : true;
54008
53905
  }
54009
53906
  break;
54010
53907
  default:
@@ -58387,6 +58284,109 @@ var require_main2 = __commonJS({
58387
58284
  }
58388
58285
  });
58389
58286
 
58287
+ // ../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js
58288
+ var require_cjs = __commonJS({
58289
+ "../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js"(exports, module2) {
58290
+ "use strict";
58291
+ var isMergeableObject = function isMergeableObject2(value) {
58292
+ return isNonNullObject(value) && !isSpecial(value);
58293
+ };
58294
+ function isNonNullObject(value) {
58295
+ return !!value && typeof value === "object";
58296
+ }
58297
+ function isSpecial(value) {
58298
+ var stringValue = Object.prototype.toString.call(value);
58299
+ return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
58300
+ }
58301
+ var canUseSymbol = typeof Symbol === "function" && Symbol.for;
58302
+ var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
58303
+ function isReactElement(value) {
58304
+ return value.$$typeof === REACT_ELEMENT_TYPE;
58305
+ }
58306
+ function emptyTarget(val) {
58307
+ return Array.isArray(val) ? [] : {};
58308
+ }
58309
+ function cloneUnlessOtherwiseSpecified(value, options) {
58310
+ return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
58311
+ }
58312
+ function defaultArrayMerge(target, source, options) {
58313
+ return target.concat(source).map(function(element) {
58314
+ return cloneUnlessOtherwiseSpecified(element, options);
58315
+ });
58316
+ }
58317
+ function getMergeFunction(key, options) {
58318
+ if (!options.customMerge) {
58319
+ return deepmerge;
58320
+ }
58321
+ var customMerge = options.customMerge(key);
58322
+ return typeof customMerge === "function" ? customMerge : deepmerge;
58323
+ }
58324
+ function getEnumerableOwnPropertySymbols(target) {
58325
+ return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
58326
+ return target.propertyIsEnumerable(symbol);
58327
+ }) : [];
58328
+ }
58329
+ function getKeys(target) {
58330
+ return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
58331
+ }
58332
+ function propertyIsOnObject(object, property) {
58333
+ try {
58334
+ return property in object;
58335
+ } catch (_) {
58336
+ return false;
58337
+ }
58338
+ }
58339
+ function propertyIsUnsafe(target, key) {
58340
+ return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
58341
+ }
58342
+ function mergeObject(target, source, options) {
58343
+ var destination = {};
58344
+ if (options.isMergeableObject(target)) {
58345
+ getKeys(target).forEach(function(key) {
58346
+ destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
58347
+ });
58348
+ }
58349
+ getKeys(source).forEach(function(key) {
58350
+ if (propertyIsUnsafe(target, key)) {
58351
+ return;
58352
+ }
58353
+ if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
58354
+ destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
58355
+ } else {
58356
+ destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
58357
+ }
58358
+ });
58359
+ return destination;
58360
+ }
58361
+ function deepmerge(target, source, options) {
58362
+ options = options || {};
58363
+ options.arrayMerge = options.arrayMerge || defaultArrayMerge;
58364
+ options.isMergeableObject = options.isMergeableObject || isMergeableObject;
58365
+ options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
58366
+ var sourceIsArray = Array.isArray(source);
58367
+ var targetIsArray = Array.isArray(target);
58368
+ var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
58369
+ if (!sourceAndTargetTypesMatch) {
58370
+ return cloneUnlessOtherwiseSpecified(source, options);
58371
+ } else if (sourceIsArray) {
58372
+ return options.arrayMerge(target, source, options);
58373
+ } else {
58374
+ return mergeObject(target, source, options);
58375
+ }
58376
+ }
58377
+ deepmerge.all = function deepmergeAll(array, options) {
58378
+ if (!Array.isArray(array)) {
58379
+ throw new Error("first argument should be an array");
58380
+ }
58381
+ return array.reduce(function(prev, next) {
58382
+ return deepmerge(prev, next, options);
58383
+ }, {});
58384
+ };
58385
+ var deepmerge_1 = deepmerge;
58386
+ module2.exports = deepmerge_1;
58387
+ }
58388
+ });
58389
+
58390
58390
  // src/lib/index.ts
58391
58391
  var lib_exports = {};
58392
58392
  __export(lib_exports, {
@@ -61900,9 +61900,6 @@ var houdini_mode = {
61900
61900
  }
61901
61901
  };
61902
61902
 
61903
- // src/lib/deepMerge.ts
61904
- var import_deepmerge = __toESM(require_cjs(), 1);
61905
-
61906
61903
  // src/lib/error.ts
61907
61904
  var HoudiniError = class extends Error {
61908
61905
  filepath = null;
@@ -61922,20 +61919,6 @@ var HoudiniError = class extends Error {
61922
61919
  }
61923
61920
  };
61924
61921
 
61925
- // src/lib/deepMerge.ts
61926
- function deepMerge(filepath, ...targets) {
61927
- try {
61928
- if (targets.length === 1) {
61929
- return targets[0];
61930
- } else if (targets.length === 2) {
61931
- return (0, import_deepmerge.default)(targets[0], targets[1]);
61932
- }
61933
- return deepMerge(filepath, targets[0], deepMerge(filepath, ...targets.slice(1)));
61934
- } catch (e2) {
61935
- throw new HoudiniError({ filepath, message: "could not merge: " + targets });
61936
- }
61937
- }
61938
-
61939
61922
  // src/lib/fs.ts
61940
61923
  var fs_exports = {};
61941
61924
  __export(fs_exports, {
@@ -63489,14 +63472,14 @@ function flatten(source) {
63489
63472
  var fetch2 = (target) => {
63490
63473
  return () => {
63491
63474
  return {
63492
- async network(ctx, { client, resolve: resolve2, marshalVariables: marshalVariables2 }) {
63475
+ async network(ctx, { client: client2, resolve: resolve2, marshalVariables: marshalVariables2 }) {
63493
63476
  const fetch3 = ctx.fetch ?? globalThis.fetch;
63494
63477
  const fetchParams2 = {
63495
63478
  text: ctx.text,
63496
63479
  hash: ctx.hash,
63497
63480
  variables: marshalVariables2(ctx)
63498
63481
  };
63499
- let fetchFn = defaultFetch(client.url, ctx.fetchParams);
63482
+ let fetchFn = defaultFetch(client2.url, ctx.fetchParams);
63500
63483
  if (target) {
63501
63484
  if (typeof target === "string") {
63502
63485
  fetchFn = defaultFetch(target, ctx.fetchParams);
@@ -65675,11 +65658,10 @@ var mutation = documentPlugin(ArtifactKind.Mutation, () => {
65675
65658
  });
65676
65659
 
65677
65660
  // src/runtime/client/plugins/subscription.ts
65661
+ var check = null;
65678
65662
  function subscription(factory) {
65679
65663
  return documentPlugin(ArtifactKind.Subscription, () => {
65680
65664
  let clearSubscription = null;
65681
- let socketClient = null;
65682
- let check = null;
65683
65665
  return {
65684
65666
  start(ctx, { resolve: resolve2, next, initialValue }) {
65685
65667
  if (typeof globalThis.window === "undefined") {
@@ -65688,7 +65670,7 @@ function subscription(factory) {
65688
65670
  }
65689
65671
  next(ctx);
65690
65672
  },
65691
- network(ctx, { resolve: resolve2, initialValue, variablesChanged: variablesChanged2, marshalVariables: marshalVariables2 }) {
65673
+ async network(ctx, { resolve: resolve2, initialValue, variablesChanged: variablesChanged2, marshalVariables: marshalVariables2 }) {
65692
65674
  const checkValue = {
65693
65675
  fetchParams: ctx.fetchParams ?? {},
65694
65676
  session: ctx.session ?? {},
@@ -65701,11 +65683,11 @@ function subscription(factory) {
65701
65683
  return;
65702
65684
  }
65703
65685
  check = checkValue;
65704
- clearSubscription?.();
65705
- if (!socketClient || sessionChange) {
65706
- socketClient = factory(ctx);
65686
+ if (sessionChange) {
65687
+ await loadClient(ctx, factory);
65707
65688
  }
65708
- clearSubscription = socketClient.subscribe(
65689
+ clearSubscription?.();
65690
+ clearSubscription = client.subscribe(
65709
65691
  {
65710
65692
  query: ctx.artifact.raw,
65711
65693
  variables: marshalVariables2(ctx)
@@ -65745,6 +65727,19 @@ function subscription(factory) {
65745
65727
  };
65746
65728
  });
65747
65729
  }
65730
+ var pendingCreate = null;
65731
+ var client;
65732
+ function loadClient(ctx, factory) {
65733
+ if (pendingCreate) {
65734
+ return pendingCreate;
65735
+ }
65736
+ pendingCreate = new Promise((resolve2) => {
65737
+ client = factory(ctx);
65738
+ resolve2();
65739
+ pendingCreate = null;
65740
+ });
65741
+ return pendingCreate;
65742
+ }
65748
65743
 
65749
65744
  // src/runtime/client/plugins/throwOnError.ts
65750
65745
  var throwOnError = ({ operations, error }) => () => {
@@ -65803,7 +65798,7 @@ var DocumentStore = class extends Writable {
65803
65798
  artifact,
65804
65799
  plugins: plugins2,
65805
65800
  pipeline: pipeline2,
65806
- client,
65801
+ client: client2,
65807
65802
  cache = true,
65808
65803
  initialValue,
65809
65804
  fetching
@@ -65821,13 +65816,11 @@ var DocumentStore = class extends Writable {
65821
65816
  super(initialState, () => {
65822
65817
  return () => {
65823
65818
  this.#lastVariables = null;
65824
- for (const plugin2 of this.#plugins) {
65825
- plugin2.cleanup?.(this.#lastContext);
65826
- }
65819
+ this.cleanup();
65827
65820
  };
65828
65821
  });
65829
65822
  this.#artifact = artifact;
65830
- this.#client = client;
65823
+ this.#client = client2;
65831
65824
  this.#lastVariables = null;
65832
65825
  this.#configFile = getCurrentConfig();
65833
65826
  this.#plugins = pipeline2 ?? [
@@ -65889,6 +65882,11 @@ var DocumentStore = class extends Writable {
65889
65882
  this.#step("forward", state);
65890
65883
  });
65891
65884
  }
65885
+ async cleanup() {
65886
+ for (const plugin2 of this.#plugins) {
65887
+ plugin2.cleanup?.(this.#lastContext);
65888
+ }
65889
+ }
65892
65890
  #step(direction, ctx, value) {
65893
65891
  const hook = direction === "error" ? "catch" : steps[direction][ctx.currentStep];
65894
65892
  let valid = (i2) => i2 <= this.#plugins.length;
@@ -66739,11 +66737,12 @@ async function getConfig({
66739
66737
  for (const plugin2 of plugins2) {
66740
66738
  if (plugin2.config) {
66741
66739
  try {
66742
- const configFactory = await import(plugin2.config);
66743
- const newValue = typeof configFactory === "function" ? configFactory(configFile) : configFactory;
66744
- configFile = deepMerge(configPath, configFile, newValue);
66740
+ const configFactory = (await import(plugin2.config)).default;
66741
+ if (configFactory) {
66742
+ configFile = typeof configFactory === "function" ? configFactory(configFile) : configFactory;
66743
+ }
66745
66744
  } catch {
66746
- console.log("could not load config file" + plugin2.config);
66745
+ console.log("could not load config file " + plugin2.config);
66747
66746
  }
66748
66747
  }
66749
66748
  }
@@ -67151,6 +67150,21 @@ async function cleanupFiles(pathFolder, listOfObj) {
67151
67150
  return allFilesNotInList;
67152
67151
  }
67153
67152
 
67153
+ // src/lib/deepMerge.ts
67154
+ var import_deepmerge = __toESM(require_cjs(), 1);
67155
+ function deepMerge(filepath, ...targets) {
67156
+ try {
67157
+ if (targets.length === 1) {
67158
+ return targets[0];
67159
+ } else if (targets.length === 2) {
67160
+ return (0, import_deepmerge.default)(targets[0], targets[1]);
67161
+ }
67162
+ return deepMerge(filepath, targets[0], deepMerge(filepath, ...targets.slice(1)));
67163
+ } catch (e2) {
67164
+ throw new HoudiniError({ filepath, message: "could not merge: " + targets });
67165
+ }
67166
+ }
67167
+
67154
67168
  // ../../node_modules/.pnpm/estree-walker@3.0.1/node_modules/estree-walker/src/walker.js
67155
67169
  var WalkerBase = class {
67156
67170
  constructor() {