@luvio/environments 0.73.6 → 0.75.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.
@@ -60,70 +60,6 @@ function deepFreeze(value) {
60
60
  freeze(value);
61
61
  }
62
62
 
63
- const SELECTOR_PAGINATION_TOKEN = 'tokenDataKey';
64
- function isFragmentUnionSelection(sel) {
65
- return sel.union === true;
66
- }
67
- function getSelections(selections) {
68
- if (selections === undefined) {
69
- return [];
70
- }
71
- let nestedSelections = [];
72
- let nonNestedSelections = [];
73
- // get nested selections first
74
- for (let i = 0, len = selections.length; i < len; i++) {
75
- const selection = selections[i];
76
- if (selection.kind === 'Object') {
77
- nestedSelections = [
78
- ...nestedSelections,
79
- ...getSelections(selection.selections),
80
- ];
81
- }
82
- else if (selection.kind === 'Link') {
83
- nestedSelections = [
84
- ...nestedSelections,
85
- ...getSelectionsFromFragment(selection.fragment),
86
- ];
87
- }
88
- else {
89
- nonNestedSelections.push(selection);
90
- }
91
- }
92
- return [...nestedSelections, ...nonNestedSelections];
93
- }
94
- function getSelectionsFromFragment(fragment) {
95
- let selections = [];
96
- // if union fragment then get selections from all unions
97
- if (isFragmentUnionSelection(fragment)) {
98
- const { unionSelections } = fragment;
99
- const unionKeys = keys(unionSelections);
100
- for (let i = 0, len = unionKeys.length; i < len; i++) {
101
- const key = unionKeys[i];
102
- selections = [...selections, ...unionSelections[key].selections];
103
- }
104
- }
105
- // if fragment has selections properties then get them
106
- const { selections: fragmentSelections } = fragment;
107
- if (fragmentSelections !== undefined) {
108
- selections = getSelections(fragmentSelections);
109
- }
110
- return selections;
111
- }
112
- function readPaginationKeysFromSelector(select) {
113
- if (select === undefined) {
114
- return [];
115
- }
116
- const selections = getSelectionsFromFragment(select.node);
117
- const keys$1 = create(null);
118
- for (let i = 0; i < selections.length; i++) {
119
- const paginationKey = selections[i][SELECTOR_PAGINATION_TOKEN];
120
- if (paginationKey) {
121
- keys$1[paginationKey] = true;
122
- }
123
- }
124
- return keys(keys$1);
125
- }
126
-
127
63
  function isStoreEntryError(storeRecord) {
128
64
  return storeRecord.__type === 'error';
129
65
  }
@@ -201,11 +137,6 @@ unavailableSnapshot, durableStoreErrorHandler, buildL1Snapshot) {
201
137
  // we attempt to read all keys from L2 - so combine recordId with any seenRecords
202
138
  const keysToReviveSet = assign({ [recordId]: true }, seenRecords);
203
139
  const keysToRevive = keys(keysToReviveSet);
204
- const paginationKeys = readPaginationKeysFromSelector(select);
205
- for (let i = 0, len = paginationKeys.length; i < len; i++) {
206
- const paginationKey = paginationKeys[i];
207
- keysToRevive.push(paginationKey);
208
- }
209
140
  const canonicalKeys = keysToRevive.map((x) => baseEnvironment.storeGetCanonicalKey(x));
210
141
  return durableStore.getEntries(canonicalKeys, DefaultDurableSegment).then((durableRecords) => {
211
142
  const { revivedKeys, hadUnexpectedShape } = publishDurableStoreEntries(durableRecords,
@@ -723,7 +654,10 @@ function makeDurable(environment, { durableStore, instrumentation }) {
723
654
  return entries;
724
655
  });
725
656
  };
726
- environment.defaultCachePolicy = buildStaleWhileRevalidateImplementation(Number.MAX_SAFE_INTEGER);
657
+ environment.defaultCachePolicy = {
658
+ type: 'stale-while-revalidate',
659
+ implementation: buildStaleWhileRevalidateImplementation(Number.MAX_SAFE_INTEGER),
660
+ };
727
661
  return create(environment, {
728
662
  publishStoreMetadata: { value: publishStoreMetadata },
729
663
  storeIngest: { value: storeIngest },
@@ -64,70 +64,6 @@
64
64
  freeze(value);
65
65
  }
66
66
 
67
- const SELECTOR_PAGINATION_TOKEN = 'tokenDataKey';
68
- function isFragmentUnionSelection(sel) {
69
- return sel.union === true;
70
- }
71
- function getSelections(selections) {
72
- if (selections === undefined) {
73
- return [];
74
- }
75
- let nestedSelections = [];
76
- let nonNestedSelections = [];
77
- // get nested selections first
78
- for (let i = 0, len = selections.length; i < len; i++) {
79
- const selection = selections[i];
80
- if (selection.kind === 'Object') {
81
- nestedSelections = [
82
- ...nestedSelections,
83
- ...getSelections(selection.selections),
84
- ];
85
- }
86
- else if (selection.kind === 'Link') {
87
- nestedSelections = [
88
- ...nestedSelections,
89
- ...getSelectionsFromFragment(selection.fragment),
90
- ];
91
- }
92
- else {
93
- nonNestedSelections.push(selection);
94
- }
95
- }
96
- return [...nestedSelections, ...nonNestedSelections];
97
- }
98
- function getSelectionsFromFragment(fragment) {
99
- let selections = [];
100
- // if union fragment then get selections from all unions
101
- if (isFragmentUnionSelection(fragment)) {
102
- const { unionSelections } = fragment;
103
- const unionKeys = keys(unionSelections);
104
- for (let i = 0, len = unionKeys.length; i < len; i++) {
105
- const key = unionKeys[i];
106
- selections = [...selections, ...unionSelections[key].selections];
107
- }
108
- }
109
- // if fragment has selections properties then get them
110
- const { selections: fragmentSelections } = fragment;
111
- if (fragmentSelections !== undefined) {
112
- selections = getSelections(fragmentSelections);
113
- }
114
- return selections;
115
- }
116
- function readPaginationKeysFromSelector(select) {
117
- if (select === undefined) {
118
- return [];
119
- }
120
- const selections = getSelectionsFromFragment(select.node);
121
- const keys$1 = create(null);
122
- for (let i = 0; i < selections.length; i++) {
123
- const paginationKey = selections[i][SELECTOR_PAGINATION_TOKEN];
124
- if (paginationKey) {
125
- keys$1[paginationKey] = true;
126
- }
127
- }
128
- return keys(keys$1);
129
- }
130
-
131
67
  function isStoreEntryError(storeRecord) {
132
68
  return storeRecord.__type === 'error';
133
69
  }
@@ -205,11 +141,6 @@
205
141
  // we attempt to read all keys from L2 - so combine recordId with any seenRecords
206
142
  const keysToReviveSet = assign({ [recordId]: true }, seenRecords);
207
143
  const keysToRevive = keys(keysToReviveSet);
208
- const paginationKeys = readPaginationKeysFromSelector(select);
209
- for (let i = 0, len = paginationKeys.length; i < len; i++) {
210
- const paginationKey = paginationKeys[i];
211
- keysToRevive.push(paginationKey);
212
- }
213
144
  const canonicalKeys = keysToRevive.map((x) => baseEnvironment.storeGetCanonicalKey(x));
214
145
  return durableStore.getEntries(canonicalKeys, DefaultDurableSegment).then((durableRecords) => {
215
146
  const { revivedKeys, hadUnexpectedShape } = publishDurableStoreEntries(durableRecords,
@@ -727,7 +658,10 @@
727
658
  return entries;
728
659
  });
729
660
  };
730
- environment.defaultCachePolicy = engine.buildStaleWhileRevalidateImplementation(Number.MAX_SAFE_INTEGER);
661
+ environment.defaultCachePolicy = {
662
+ type: 'stale-while-revalidate',
663
+ implementation: engine.buildStaleWhileRevalidateImplementation(Number.MAX_SAFE_INTEGER),
664
+ };
731
665
  return create(environment, {
732
666
  publishStoreMetadata: { value: publishStoreMetadata },
733
667
  storeIngest: { value: storeIngest },
@@ -101,64 +101,6 @@
101
101
  freeze(value);
102
102
  }
103
103
 
104
- var SELECTOR_PAGINATION_TOKEN = 'tokenDataKey';
105
- function isFragmentUnionSelection(sel) {
106
- return sel.union === true;
107
- }
108
- function getSelections(selections) {
109
- if (selections === undefined) {
110
- return [];
111
- }
112
- var nestedSelections = [];
113
- var nonNestedSelections = [];
114
- // get nested selections first
115
- for (var i = 0, len = selections.length; i < len; i++) {
116
- var selection = selections[i];
117
- if (selection.kind === 'Object') {
118
- nestedSelections = __spreadArray(__spreadArray([], nestedSelections, true), getSelections(selection.selections), true);
119
- }
120
- else if (selection.kind === 'Link') {
121
- nestedSelections = __spreadArray(__spreadArray([], nestedSelections, true), getSelectionsFromFragment(selection.fragment), true);
122
- }
123
- else {
124
- nonNestedSelections.push(selection);
125
- }
126
- }
127
- return __spreadArray(__spreadArray([], nestedSelections, true), nonNestedSelections, true);
128
- }
129
- function getSelectionsFromFragment(fragment) {
130
- var selections = [];
131
- // if union fragment then get selections from all unions
132
- if (isFragmentUnionSelection(fragment)) {
133
- var unionSelections = fragment.unionSelections;
134
- var unionKeys = keys(unionSelections);
135
- for (var i = 0, len = unionKeys.length; i < len; i++) {
136
- var key = unionKeys[i];
137
- selections = __spreadArray(__spreadArray([], selections, true), unionSelections[key].selections, true);
138
- }
139
- }
140
- // if fragment has selections properties then get them
141
- var fragmentSelections = fragment.selections;
142
- if (fragmentSelections !== undefined) {
143
- selections = getSelections(fragmentSelections);
144
- }
145
- return selections;
146
- }
147
- function readPaginationKeysFromSelector(select) {
148
- if (select === undefined) {
149
- return [];
150
- }
151
- var selections = getSelectionsFromFragment(select.node);
152
- var keys$1 = create(null);
153
- for (var i = 0; i < selections.length; i++) {
154
- var paginationKey = selections[i][SELECTOR_PAGINATION_TOKEN];
155
- if (paginationKey) {
156
- keys$1[paginationKey] = true;
157
- }
158
- }
159
- return keys(keys$1);
160
- }
161
-
162
104
  function isStoreEntryError(storeRecord) {
163
105
  return storeRecord.__type === 'error';
164
106
  }
@@ -237,11 +179,6 @@
237
179
  // we attempt to read all keys from L2 - so combine recordId with any seenRecords
238
180
  var keysToReviveSet = assign((_a = {}, _a[recordId] = true, _a), seenRecords);
239
181
  var keysToRevive = keys(keysToReviveSet);
240
- var paginationKeys = readPaginationKeysFromSelector(select);
241
- for (var i = 0, len = paginationKeys.length; i < len; i++) {
242
- var paginationKey = paginationKeys[i];
243
- keysToRevive.push(paginationKey);
244
- }
245
182
  var canonicalKeys = keysToRevive.map(function (x) { return baseEnvironment.storeGetCanonicalKey(x); });
246
183
  return durableStore.getEntries(canonicalKeys, DefaultDurableSegment).then(function (durableRecords) {
247
184
  var _a;
@@ -766,7 +703,10 @@
766
703
  return entries;
767
704
  });
768
705
  };
769
- environment.defaultCachePolicy = engine.buildStaleWhileRevalidateImplementation(Number.MAX_SAFE_INTEGER);
706
+ environment.defaultCachePolicy = {
707
+ type: 'stale-while-revalidate',
708
+ implementation: engine.buildStaleWhileRevalidateImplementation(Number.MAX_SAFE_INTEGER),
709
+ };
770
710
  return create(environment, {
771
711
  publishStoreMetadata: { value: publishStoreMetadata },
772
712
  storeIngest: { value: storeIngest },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luvio/environments",
3
- "version": "0.73.6",
3
+ "version": "0.75.0",
4
4
  "description": "Luvio Environments",
5
5
  "main": "dist/umd/es2018/environments.js",
6
6
  "module": "dist/es/es2018/environments.js",
@@ -27,7 +27,7 @@
27
27
  "dist/"
28
28
  ],
29
29
  "dependencies": {
30
- "@luvio/engine": "0.73.6"
30
+ "@luvio/engine": "0.75.0"
31
31
  },
32
32
  "bundlesize": [
33
33
  {
@@ -1,2 +0,0 @@
1
- import type { Selector } from '@luvio/engine';
2
- export declare function readPaginationKeysFromSelector(select?: Selector<unknown>): string[];
@@ -1,2 +0,0 @@
1
- import type { Selector } from '@luvio/engine';
2
- export declare function readPaginationKeysFromSelector(select?: Selector<unknown>): string[];
@@ -1,2 +0,0 @@
1
- import type { Selector } from '@luvio/engine';
2
- export declare function readPaginationKeysFromSelector(select?: Selector<unknown>): string[];