convex 1.14.3 → 1.14.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.
Files changed (36) hide show
  1. package/browser/node_modules/.modules.yaml +19 -0
  2. package/dist/browser.bundle.js +28 -40
  3. package/dist/browser.bundle.js.map +2 -2
  4. package/dist/cjs/browser/sync/client.js +1 -4
  5. package/dist/cjs/browser/sync/client.js.map +2 -2
  6. package/dist/cjs/browser/sync/local_state.js +26 -35
  7. package/dist/cjs/browser/sync/local_state.js.map +2 -2
  8. package/dist/cjs/index.js +1 -1
  9. package/dist/cjs/index.js.map +1 -1
  10. package/dist/cjs-types/browser/sync/client.d.ts.map +1 -1
  11. package/dist/cjs-types/browser/sync/local_state.d.ts +3 -1
  12. package/dist/cjs-types/browser/sync/local_state.d.ts.map +1 -1
  13. package/dist/cjs-types/index.d.ts +1 -1
  14. package/dist/cli.bundle.cjs +28 -40
  15. package/dist/cli.bundle.cjs.map +2 -2
  16. package/dist/esm/browser/sync/client.js +1 -4
  17. package/dist/esm/browser/sync/client.js.map +2 -2
  18. package/dist/esm/browser/sync/local_state.js +26 -35
  19. package/dist/esm/browser/sync/local_state.js.map +2 -2
  20. package/dist/esm/index.js +1 -1
  21. package/dist/esm/index.js.map +1 -1
  22. package/dist/esm-types/browser/sync/client.d.ts.map +1 -1
  23. package/dist/esm-types/browser/sync/local_state.d.ts +3 -1
  24. package/dist/esm-types/browser/sync/local_state.d.ts.map +1 -1
  25. package/dist/esm-types/index.d.ts +1 -1
  26. package/dist/react.bundle.js +28 -40
  27. package/dist/react.bundle.js.map +2 -2
  28. package/package.json +1 -1
  29. package/react/node_modules/.modules.yaml +19 -0
  30. package/react-auth0/node_modules/.modules.yaml +19 -0
  31. package/react-clerk/node_modules/.modules.yaml +19 -0
  32. package/server/node_modules/.modules.yaml +19 -0
  33. package/src/browser/sync/client.ts +1 -5
  34. package/src/browser/sync/local_state.ts +37 -41
  35. package/src/index.ts +1 -1
  36. package/values/node_modules/.modules.yaml +19 -0
@@ -0,0 +1,19 @@
1
+ hoistPattern:
2
+ - '*'
3
+ hoistedDependencies: {}
4
+ included:
5
+ dependencies: true
6
+ devDependencies: true
7
+ optionalDependencies: true
8
+ layoutVersion: 5
9
+ packageManager: pnpm@7.32.0
10
+ pendingBuilds: []
11
+ prunedAt: Sat, 16 Dec 2023 00:48:00 GMT
12
+ publicHoistPattern:
13
+ - '*eslint*'
14
+ - '*prettier*'
15
+ registries:
16
+ default: https://registry.npmjs.org/
17
+ skipped: []
18
+ storeDir: /Users/tomb/convex/npm-packages/common/temp/pnpm-store/v3
19
+ virtualStoreDir: .pnpm
@@ -28,7 +28,7 @@ var convex = (() => {
28
28
  });
29
29
 
30
30
  // src/index.ts
31
- var version = "1.14.3";
31
+ var version = "1.14.4";
32
32
 
33
33
  // src/values/base64.ts
34
34
  var base64_exports = {};
@@ -558,6 +558,7 @@ var convex = (() => {
558
558
  this.outstandingQueriesOlderThanRestart = /* @__PURE__ */ new Set();
559
559
  this.outstandingAuthOlderThanRestart = false;
560
560
  this.paused = false;
561
+ this.pendingQuerySetModifications = /* @__PURE__ */ new Map();
561
562
  }
562
563
  hasSyncedPastLastReconnect() {
563
564
  return this.outstandingQueriesOlderThanRestart.size === 0 && !this.outstandingAuthOlderThanRestart;
@@ -589,9 +590,6 @@ var convex = (() => {
589
590
  this.queryIdToToken.set(queryId, queryToken);
590
591
  const baseVersion = this.querySetVersion;
591
592
  const newVersion = this.querySetVersion + 1;
592
- if (!this.paused) {
593
- this.querySetVersion = newVersion;
594
- }
595
593
  const add = {
596
594
  type: "Add",
597
595
  queryId,
@@ -600,6 +598,11 @@ var convex = (() => {
600
598
  journal,
601
599
  componentPath
602
600
  };
601
+ if (this.paused) {
602
+ this.pendingQuerySetModifications.set(queryId, add);
603
+ } else {
604
+ this.querySetVersion = newVersion;
605
+ }
603
606
  const modification = {
604
607
  type: "ModifyQuerySet",
605
608
  baseVersion,
@@ -723,7 +726,7 @@ var convex = (() => {
723
726
  return this.querySet.get(queryToken)?.journal;
724
727
  }
725
728
  restart(oldRemoteQueryResults) {
726
- this.paused = false;
729
+ this.unpause();
727
730
  this.outstandingQueriesOlderThanRestart.clear();
728
731
  const modifications = [];
729
732
  for (const localQuery of this.querySet.values()) {
@@ -762,45 +765,27 @@ var convex = (() => {
762
765
  pause() {
763
766
  this.paused = true;
764
767
  }
765
- resume(remoteQueryResults) {
766
- this.paused = false;
767
- const localQueryIds = /* @__PURE__ */ new Set();
768
- const modifications = [];
769
- for (const localQuery of this.querySet.values()) {
770
- localQueryIds.add(localQuery.id);
771
- if (!remoteQueryResults.has(localQuery.id)) {
772
- const add = {
773
- type: "Add",
774
- queryId: localQuery.id,
775
- udfPath: localQuery.canonicalizedUdfPath,
776
- args: [convexToJson(localQuery.args)],
777
- journal: localQuery.journal
778
- };
779
- modifications.push(add);
780
- }
781
- }
782
- for (const remoteQueryId of remoteQueryResults) {
783
- if (!localQueryIds.has(remoteQueryId)) {
784
- const remove = {
785
- type: "Remove",
786
- queryId: remoteQueryId
787
- };
788
- modifications.push(remove);
789
- }
790
- }
791
- const querySet = modifications.length > 0 ? {
768
+ resume() {
769
+ const querySet = this.pendingQuerySetModifications.size > 0 ? {
792
770
  type: "ModifyQuerySet",
793
771
  baseVersion: this.querySetVersion,
794
772
  newVersion: ++this.querySetVersion,
795
- modifications
773
+ modifications: Array.from(
774
+ this.pendingQuerySetModifications.values()
775
+ )
796
776
  } : void 0;
797
777
  const authenticate = this.auth !== void 0 ? {
798
778
  type: "Authenticate",
799
779
  baseVersion: this.identityVersion++,
800
780
  ...this.auth
801
781
  } : void 0;
782
+ this.unpause();
802
783
  return [querySet, authenticate];
803
784
  }
785
+ unpause() {
786
+ this.paused = false;
787
+ this.pendingQuerySetModifications.clear();
788
+ }
804
789
  removeSubscriber(queryToken) {
805
790
  const localQuery = this.querySet.get(queryToken);
806
791
  if (localQuery.numSubscribers > 1) {
@@ -812,13 +797,19 @@ var convex = (() => {
812
797
  this.outstandingQueriesOlderThanRestart.delete(localQuery.id);
813
798
  const baseVersion = this.querySetVersion;
814
799
  const newVersion = this.querySetVersion + 1;
815
- if (!this.paused) {
816
- this.querySetVersion = newVersion;
817
- }
818
800
  const remove = {
819
801
  type: "Remove",
820
802
  queryId: localQuery.id
821
803
  };
804
+ if (this.paused) {
805
+ if (this.pendingQuerySetModifications.has(localQuery.id)) {
806
+ this.pendingQuerySetModifications.delete(localQuery.id);
807
+ } else {
808
+ this.pendingQuerySetModifications.set(localQuery.id, remove);
809
+ }
810
+ } else {
811
+ this.querySetVersion = newVersion;
812
+ }
822
813
  return {
823
814
  type: "ModifyQuerySet",
824
815
  baseVersion,
@@ -2191,10 +2182,7 @@ var convex = (() => {
2191
2182
  }
2192
2183
  },
2193
2184
  onResume: () => {
2194
- const remoteQueryResults = new Set(
2195
- this.remoteQuerySet.remoteQueryResults().keys()
2196
- );
2197
- const [querySetModification, authModification] = this.state.resume(remoteQueryResults);
2185
+ const [querySetModification, authModification] = this.state.resume();
2198
2186
  if (authModification) {
2199
2187
  this.webSocketManager.sendMessage(authModification);
2200
2188
  }