@fluidframework/local-driver 2.0.0-dev.2.3.0.115467 → 2.0.0-dev.4.1.0.148229

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 (91) hide show
  1. package/.eslintrc.js +19 -22
  2. package/.mocharc.js +2 -2
  3. package/api-extractor.json +4 -0
  4. package/dist/auth.d.ts.map +1 -1
  5. package/dist/auth.js +2 -2
  6. package/dist/auth.js.map +1 -1
  7. package/dist/localCreateDocument.d.ts +8 -0
  8. package/dist/localCreateDocument.d.ts.map +1 -0
  9. package/dist/localCreateDocument.js +29 -0
  10. package/dist/localCreateDocument.js.map +1 -0
  11. package/dist/localDeltaStorageService.d.ts.map +1 -1
  12. package/dist/localDeltaStorageService.js.map +1 -1
  13. package/dist/localDocumentDeltaConnection.d.ts.map +1 -1
  14. package/dist/localDocumentDeltaConnection.js.map +1 -1
  15. package/dist/localDocumentService.d.ts.map +1 -1
  16. package/dist/localDocumentService.js +4 -1
  17. package/dist/localDocumentService.js.map +1 -1
  18. package/dist/localDocumentServiceFactory.d.ts +0 -1
  19. package/dist/localDocumentServiceFactory.d.ts.map +1 -1
  20. package/dist/localDocumentServiceFactory.js +4 -20
  21. package/dist/localDocumentServiceFactory.js.map +1 -1
  22. package/dist/localDocumentStorageService.d.ts +5 -2
  23. package/dist/localDocumentStorageService.d.ts.map +1 -1
  24. package/dist/localDocumentStorageService.js +18 -4
  25. package/dist/localDocumentStorageService.js.map +1 -1
  26. package/dist/localResolver.d.ts.map +1 -1
  27. package/dist/localResolver.js.map +1 -1
  28. package/dist/localSessionStorageDb.d.ts.map +1 -1
  29. package/dist/localSessionStorageDb.js +3 -2
  30. package/dist/localSessionStorageDb.js.map +1 -1
  31. package/dist/packageVersion.d.ts +1 -1
  32. package/dist/packageVersion.js +1 -1
  33. package/dist/packageVersion.js.map +1 -1
  34. package/lib/auth.d.ts +12 -0
  35. package/lib/auth.d.ts.map +1 -0
  36. package/lib/auth.js +38 -0
  37. package/lib/auth.js.map +1 -0
  38. package/lib/index.d.ts +12 -0
  39. package/lib/index.d.ts.map +1 -0
  40. package/lib/index.js +12 -0
  41. package/lib/index.js.map +1 -0
  42. package/lib/localCreateDocument.d.ts +8 -0
  43. package/lib/localCreateDocument.d.ts.map +1 -0
  44. package/lib/localCreateDocument.js +25 -0
  45. package/lib/localCreateDocument.js.map +1 -0
  46. package/lib/localDeltaStorageService.d.ts +19 -0
  47. package/lib/localDeltaStorageService.d.ts.map +1 -0
  48. package/lib/localDeltaStorageService.js +31 -0
  49. package/lib/localDeltaStorageService.js.map +1 -0
  50. package/lib/localDocumentDeltaConnection.d.ts +47 -0
  51. package/lib/localDocumentDeltaConnection.d.ts.map +1 -0
  52. package/lib/localDocumentDeltaConnection.js +88 -0
  53. package/lib/localDocumentDeltaConnection.js.map +1 -0
  54. package/lib/localDocumentService.d.ts +52 -0
  55. package/lib/localDocumentService.d.ts.map +1 -0
  56. package/lib/localDocumentService.js +80 -0
  57. package/lib/localDocumentService.js.map +1 -0
  58. package/lib/localDocumentServiceFactory.d.ts +43 -0
  59. package/lib/localDocumentServiceFactory.d.ts.map +1 -0
  60. package/lib/localDocumentServiceFactory.js +81 -0
  61. package/lib/localDocumentServiceFactory.js.map +1 -0
  62. package/lib/localDocumentStorageService.d.ts +27 -0
  63. package/lib/localDocumentStorageService.d.ts.map +1 -0
  64. package/lib/localDocumentStorageService.js +85 -0
  65. package/lib/localDocumentStorageService.js.map +1 -0
  66. package/lib/localResolver.d.ts +26 -0
  67. package/lib/localResolver.d.ts.map +1 -0
  68. package/lib/localResolver.js +70 -0
  69. package/lib/localResolver.js.map +1 -0
  70. package/lib/localSessionStorageDb.d.ts +10 -0
  71. package/lib/localSessionStorageDb.d.ts.map +1 -0
  72. package/lib/localSessionStorageDb.js +295 -0
  73. package/lib/localSessionStorageDb.js.map +1 -0
  74. package/lib/packageVersion.d.ts +9 -0
  75. package/lib/packageVersion.d.ts.map +1 -0
  76. package/lib/packageVersion.js +9 -0
  77. package/lib/packageVersion.js.map +1 -0
  78. package/package.json +59 -49
  79. package/prettier.config.cjs +1 -1
  80. package/src/auth.ts +35 -29
  81. package/src/localCreateDocument.ts +48 -0
  82. package/src/localDeltaStorageService.ts +26 -29
  83. package/src/localDocumentDeltaConnection.ts +89 -85
  84. package/src/localDocumentService.ts +108 -95
  85. package/src/localDocumentServiceFactory.ts +94 -122
  86. package/src/localDocumentStorageService.ts +35 -11
  87. package/src/localResolver.ts +55 -55
  88. package/src/localSessionStorageDb.ts +270 -263
  89. package/src/packageVersion.ts +1 -1
  90. package/tsconfig.esnext.json +7 -0
  91. package/tsconfig.json +9 -13
@@ -12,301 +12,308 @@ import { v4 as uuid } from "uuid";
12
12
  * Functions include database operations such as queries, insertion and update.
13
13
  */
14
14
  class LocalSessionStorageCollection<T> implements ICollection<T> {
15
- /**
16
- * @param collectionName - data type of the collection, e.g. blobs, deltas, trees, etc.
17
- */
18
- constructor(private readonly collectionName: string) { }
15
+ /**
16
+ * @param collectionName - data type of the collection, e.g. blobs, deltas, trees, etc.
17
+ */
18
+ constructor(private readonly collectionName: string) {}
19
19
 
20
- public aggregate(pipeline: any, options?: any): any {
21
- throw new Error("Method Not Implemented");
22
- }
20
+ public aggregate(pipeline: any, options?: any): any {
21
+ throw new Error("Method Not Implemented");
22
+ }
23
23
 
24
- public async updateMany(filter: any, set: any, addToSet: any): Promise<void> {
25
- throw new Error("Method Not Implemented");
26
- }
27
- public async distinct(key: any, query: any): Promise<any> {
28
- throw new Error("Method Not Implemented");
29
- }
24
+ public async updateMany(filter: any, set: any, addToSet: any): Promise<void> {
25
+ throw new Error("Method Not Implemented");
26
+ }
27
+ public async distinct(key: any, query: any): Promise<any> {
28
+ throw new Error("Method Not Implemented");
29
+ }
30
+ public async findAndUpdate(query: any, value: T): Promise<{ value: T; existing: boolean }> {
31
+ throw new Error("Method not implemented.");
32
+ }
30
33
 
31
- /**
32
- * {@inheritDoc @fluidframework/server-services-core#ICollection.find}
33
- */
34
- /*
35
- * Each query key consists of several keys separated by '.' e.g: "operation.sequenceNumber".
36
- * The hierarchical syntax allows finding nested key patterns.
37
- */
38
- public async find(query: any, sort: any): Promise<any[]> {
39
- // split the keys and get the corresponding value
40
- function getValueByKey(propertyBag, key: string) {
41
- const keys = key.split(".");
42
- let value = propertyBag;
43
- keys.forEach((splitKey) => {
44
- value = value[splitKey];
45
- });
46
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
47
- return value;
48
- }
34
+ /**
35
+ * {@inheritDoc @fluidframework/server-services-core#ICollection.find}
36
+ */
37
+ /*
38
+ * Each query key consists of several keys separated by '.' e.g: "operation.sequenceNumber".
39
+ * The hierarchical syntax allows finding nested key patterns.
40
+ */
41
+ public async find(query: any, sort: any): Promise<any[]> {
42
+ // split the keys and get the corresponding value
43
+ function getValueByKey(propertyBag, key: string) {
44
+ const keys = key.split(".");
45
+ let value = propertyBag;
46
+ keys.forEach((splitKey) => {
47
+ value = value[splitKey];
48
+ });
49
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
50
+ return value;
51
+ }
49
52
 
50
- // getting keys of the query we are trying to find
51
- const queryKeys = Object.keys(query);
52
- let filteredCollection = this.getAllInternal();
53
- queryKeys.forEach((key) => {
54
- if (!query[key]) {
55
- return;
56
- }
57
- if (query[key].$gt > 0 || query[key].$lt > 0) {
58
- if (query[key].$gt > 0) {
59
- filteredCollection = filteredCollection.filter(
60
- (value) => getValueByKey(value, key) > query[key].$gt);
61
- }
62
- if (query[key].$lt > 0) {
63
- filteredCollection = filteredCollection.filter(
64
- (value) => getValueByKey(value, key) < query[key].$lt);
65
- }
66
- } else {
67
- filteredCollection = filteredCollection.filter(
68
- (value) => getValueByKey(value, key) === query[key]);
69
- }
70
- });
53
+ // getting keys of the query we are trying to find
54
+ const queryKeys = Object.keys(query);
55
+ let filteredCollection = this.getAllInternal();
56
+ queryKeys.forEach((key) => {
57
+ if (!query[key]) {
58
+ return;
59
+ }
60
+ if (query[key].$gt > 0 || query[key].$lt > 0) {
61
+ if (query[key].$gt > 0) {
62
+ filteredCollection = filteredCollection.filter(
63
+ (value) => getValueByKey(value, key) > query[key].$gt,
64
+ );
65
+ }
66
+ if (query[key].$lt > 0) {
67
+ filteredCollection = filteredCollection.filter(
68
+ (value) => getValueByKey(value, key) < query[key].$lt,
69
+ );
70
+ }
71
+ } else {
72
+ filteredCollection = filteredCollection.filter(
73
+ (value) => getValueByKey(value, key) === query[key],
74
+ );
75
+ }
76
+ });
71
77
 
72
- if (sort && Object.keys(sort).length === 1) {
73
- // eslint-disable-next-line no-inner-declarations
74
- function compare(a, b) {
75
- const sortKey = Object.keys(sort)[0];
76
- return sort[sortKey] === 1
77
- ? getValueByKey(a, sortKey) - getValueByKey(b, sortKey)
78
- : getValueByKey(b, sortKey) - getValueByKey(a, sortKey);
79
- }
78
+ if (sort && Object.keys(sort).length === 1) {
79
+ // eslint-disable-next-line no-inner-declarations
80
+ function compare(a, b) {
81
+ const sortKey = Object.keys(sort)[0];
82
+ return sort[sortKey] === 1
83
+ ? getValueByKey(a, sortKey) - getValueByKey(b, sortKey)
84
+ : getValueByKey(b, sortKey) - getValueByKey(a, sortKey);
85
+ }
80
86
 
81
- filteredCollection = filteredCollection.sort(compare);
82
- }
83
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
84
- return filteredCollection;
85
- }
87
+ filteredCollection = filteredCollection.sort(compare);
88
+ }
89
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
90
+ return filteredCollection;
91
+ }
86
92
 
87
- /**
88
- * {@inheritDoc @fluidframework/server-services-core#ICollection.findAll}
89
- */
90
- public async findAll(): Promise<any[]> {
91
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
92
- return this.getAllInternal();
93
- }
93
+ /**
94
+ * {@inheritDoc @fluidframework/server-services-core#ICollection.findAll}
95
+ */
96
+ public async findAll(): Promise<any[]> {
97
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
98
+ return this.getAllInternal();
99
+ }
94
100
 
95
- /**
96
- * {@inheritDoc @fluidframework/server-services-core#ICollection.findOne}
97
- */
98
- /*
99
- * Query is expected to have a member "_id" which is a string used to find value in the database.
100
- */
101
- public async findOne(query: any): Promise<any> {
102
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
103
- return this.findOneInternal(query);
104
- }
101
+ /**
102
+ * {@inheritDoc @fluidframework/server-services-core#ICollection.findOne}
103
+ */
104
+ /*
105
+ * Query is expected to have a member "_id" which is a string used to find value in the database.
106
+ */
107
+ public async findOne(query: any): Promise<any> {
108
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
109
+ return this.findOneInternal(query);
110
+ }
105
111
 
106
- /**
107
- * {@inheritDoc @fluidframework/server-services-core#ICollection.update}
108
- */
109
- /*
110
- * Query is expected to have a member "_id" which is a string used to find value in the database.
111
- */
112
- public async update(query: any, set: any, addToSet: any): Promise<void> {
113
- const value = this.findOneInternal(query);
114
- if (!value) {
115
- throw new Error("Not found");
116
- } else {
117
- for (const key of Object.keys(set)) {
118
- value[key] = set[key];
119
- }
120
- this.insertInternal(value);
121
- }
122
- }
112
+ /**
113
+ * {@inheritDoc @fluidframework/server-services-core#ICollection.update}
114
+ */
115
+ /*
116
+ * Query is expected to have a member "_id" which is a string used to find value in the database.
117
+ */
118
+ public async update(query: any, set: any, addToSet: any): Promise<void> {
119
+ const value = this.findOneInternal(query);
120
+ if (!value) {
121
+ throw new Error("Not found");
122
+ } else {
123
+ for (const key of Object.keys(set)) {
124
+ value[key] = set[key];
125
+ }
126
+ this.insertInternal(value);
127
+ }
128
+ }
123
129
 
124
- /**
125
- * {@inheritDoc @fluidframework/server-services-core#ICollection.upsert}
126
- */
127
- /*
128
- * Query is expected to have a member "_id" which is a string used to find value in the database.
129
- */
130
- public async upsert(query: any, set: any, addToSet: any): Promise<void> {
131
- const value = this.findOneInternal(query);
132
- if (!value) {
133
- this.insertInternal(set);
134
- } else {
135
- for (const key of Object.keys(set)) {
136
- value[key] = set[key];
137
- }
138
- this.insertInternal(value);
139
- }
140
- }
130
+ /**
131
+ * {@inheritDoc @fluidframework/server-services-core#ICollection.upsert}
132
+ */
133
+ /*
134
+ * Query is expected to have a member "_id" which is a string used to find value in the database.
135
+ */
136
+ public async upsert(query: any, set: any, addToSet: any): Promise<void> {
137
+ const value = this.findOneInternal(query);
138
+ if (!value) {
139
+ this.insertInternal(set);
140
+ } else {
141
+ for (const key of Object.keys(set)) {
142
+ value[key] = set[key];
143
+ }
144
+ this.insertInternal(value);
145
+ }
146
+ }
141
147
 
142
- /**
143
- * {@inheritDoc @fluidframework/server-services-core#ICollection.insertOne}
144
- */
145
- /*
146
- * Value is expected to have a member "_id" which is a string used to search in the database.
147
- */
148
- public async insertOne(value: any): Promise<any> {
149
- const presentVal = this.findOneInternal(value);
150
- // Only raise error when the object is present and the value is not equal.
151
- if (presentVal) {
152
- if (JSON.stringify(presentVal) === JSON.stringify(value)) {
153
- return;
154
- }
155
- throw new Error("Existing Object!!");
156
- }
148
+ /**
149
+ * {@inheritDoc @fluidframework/server-services-core#ICollection.insertOne}
150
+ */
151
+ /*
152
+ * Value is expected to have a member "_id" which is a string used to search in the database.
153
+ */
154
+ public async insertOne(value: any): Promise<any> {
155
+ const presentVal = this.findOneInternal(value);
156
+ // Only raise error when the object is present and the value is not equal.
157
+ if (presentVal) {
158
+ if (JSON.stringify(presentVal) === JSON.stringify(value)) {
159
+ return;
160
+ }
161
+ throw new Error("Existing Object!!");
162
+ }
157
163
 
158
- return this.insertInternal(value);
159
- }
164
+ return this.insertInternal(value);
165
+ }
160
166
 
161
- /**
162
- * {@inheritDoc @fluidframework/server-services-core#ICollection.findOrCreate}
163
- */
164
- /*
165
- * Value and query are expected to have a member "_id" which is a string used to search or insert in the database.
166
- */
167
- public async findOrCreate(query: any, value: any): Promise<{ value: any; existing: boolean; }> {
168
- const existing = this.findOneInternal(query);
169
- if (existing) {
170
- return { value: existing, existing: true };
171
- }
172
- this.insertInternal(value);
173
- return { value, existing: false };
174
- }
167
+ /**
168
+ * {@inheritDoc @fluidframework/server-services-core#ICollection.findOrCreate}
169
+ */
170
+ /*
171
+ * Value and query are expected to have a member "_id" which is a string used to search or insert in the database.
172
+ */
173
+ public async findOrCreate(query: any, value: any): Promise<{ value: any; existing: boolean }> {
174
+ const existing = this.findOneInternal(query);
175
+ if (existing) {
176
+ return { value: existing, existing: true };
177
+ }
178
+ this.insertInternal(value);
179
+ return { value, existing: false };
180
+ }
175
181
 
176
- /**
177
- * {@inheritDoc @fluidframework/server-services-core#ICollection.insertMany}
178
- */
179
- /*
180
- * Each element in values is expected to have a member "_id" which is a string used to insert in the database.
181
- */
182
- public async insertMany(values: any[], ordered: boolean): Promise<void> {
183
- this.insertInternal(...values);
184
- }
182
+ /**
183
+ * {@inheritDoc @fluidframework/server-services-core#ICollection.insertMany}
184
+ */
185
+ /*
186
+ * Each element in values is expected to have a member "_id" which is a string used to insert in the database.
187
+ */
188
+ public async insertMany(values: any[], ordered: boolean): Promise<void> {
189
+ this.insertInternal(...values);
190
+ }
185
191
 
186
- /**
187
- * {@inheritDoc @fluidframework/server-services-core#ICollection.deleteOne}
188
- */
189
- public async deleteOne(query: any): Promise<any> {
190
- throw new Error("Method not implemented.");
191
- }
192
+ /**
193
+ * {@inheritDoc @fluidframework/server-services-core#ICollection.deleteOne}
194
+ */
195
+ public async deleteOne(query: any): Promise<any> {
196
+ throw new Error("Method not implemented.");
197
+ }
192
198
 
193
- /**
194
- * {@inheritDoc @fluidframework/server-services-core#ICollection.deleteMany}
195
- */
196
- public async deleteMany(query: any): Promise<any> {
197
- throw new Error("Method not implemented.");
198
- }
199
+ /**
200
+ * {@inheritDoc @fluidframework/server-services-core#ICollection.deleteMany}
201
+ */
202
+ public async deleteMany(query: any): Promise<any> {
203
+ throw new Error("Method not implemented.");
204
+ }
199
205
 
200
- /**
201
- * {@inheritDoc @fluidframework/server-services-core#ICollection.createIndex}
202
- */
203
- public async createIndex(index: any, unique: boolean): Promise<void> {
204
- throw new Error("Method not implemented.");
205
- }
206
+ /**
207
+ * {@inheritDoc @fluidframework/server-services-core#ICollection.createIndex}
208
+ */
209
+ public async createIndex(index: any, unique: boolean): Promise<void> {
210
+ throw new Error("Method not implemented.");
211
+ }
206
212
 
207
- /**
208
- * Return all values in the database
209
- */
210
- private getAllInternal(): any[] {
211
- const values: string[] = [];
212
- for (let i = 0; i < sessionStorage.length; i++) {
213
- const key = sessionStorage.key(i);
214
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
215
- if (key!.startsWith(this.collectionName)) {
216
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
217
- values.push(JSON.parse(sessionStorage.getItem(key!)!));
218
- }
219
- }
220
- return values;
221
- }
213
+ /**
214
+ * Return all values in the database
215
+ */
216
+ private getAllInternal(): any[] {
217
+ const values: string[] = [];
218
+ for (let i = 0; i < sessionStorage.length; i++) {
219
+ const key = sessionStorage.key(i);
220
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
221
+ if (key!.startsWith(this.collectionName)) {
222
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
223
+ values.push(JSON.parse(sessionStorage.getItem(key!)!));
224
+ }
225
+ }
226
+ return values;
227
+ }
222
228
 
223
- /**
224
- * Inserts values into the session storge.
225
- * Values are expected to have a member "_id" which is a unique id, otherwise will be assigned one
226
- *
227
- * @param values - data to insert to the database
228
- */
229
- private insertInternal(...values: any[]) {
230
- for (const value of values) {
231
- if (value) {
232
- if (!value._id) {
233
- value._id = uuid();
234
- }
235
- sessionStorage.setItem(`${this.collectionName}-${value._id}`, JSON.stringify(value));
236
- }
237
- }
238
- }
229
+ /**
230
+ * Inserts values into the session storge.
231
+ * Values are expected to have a member "_id" which is a unique id, otherwise will be assigned one
232
+ *
233
+ * @param values - data to insert to the database
234
+ */
235
+ private insertInternal(...values: any[]) {
236
+ for (const value of values) {
237
+ if (value) {
238
+ if (!value._id) {
239
+ value._id = uuid();
240
+ }
241
+ sessionStorage.setItem(
242
+ `${this.collectionName}-${value._id}`,
243
+ JSON.stringify(value),
244
+ );
245
+ }
246
+ }
247
+ }
239
248
 
240
- /**
241
- * Finds the query in session storage and returns its value.
242
- * Returns null if query is not found.
243
- * Query is expected to have a member "_id" which is a unique id.
244
- *
245
- * @param query - what to find in the database
246
- */
247
- private findOneInternal(query: any): any {
248
- if (query._id) {
249
- const json = sessionStorage.getItem(`${this.collectionName}-${query._id}`);
250
- if (json) {
251
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
252
- return JSON.parse(json);
253
- }
254
- } else {
255
- const queryKeys = Object.keys(query);
256
- for (let i = 0; i < sessionStorage.length; i++) {
257
- const ssKey = sessionStorage.key(i);
258
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
259
- if (!ssKey!.startsWith(this.collectionName)) {
260
- continue;
261
- }
262
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
263
- const value = JSON.parse(sessionStorage.getItem(ssKey!)!);
264
- let foundMismatch = false;
265
- for (const qk of queryKeys) {
266
- if (value[qk] !== query[qk]) {
267
- foundMismatch = true;
268
- break;
269
- }
270
- }
249
+ /**
250
+ * Finds the query in session storage and returns its value.
251
+ * Returns null if query is not found.
252
+ * Query is expected to have a member "_id" which is a unique id.
253
+ *
254
+ * @param query - what to find in the database
255
+ */
256
+ private findOneInternal(query: any): any {
257
+ if (query._id) {
258
+ const json = sessionStorage.getItem(`${this.collectionName}-${query._id}`);
259
+ if (json) {
260
+ return JSON.parse(json);
261
+ }
262
+ } else {
263
+ const queryKeys = Object.keys(query);
264
+ for (let i = 0; i < sessionStorage.length; i++) {
265
+ const ssKey = sessionStorage.key(i);
266
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
267
+ if (!ssKey!.startsWith(this.collectionName)) {
268
+ continue;
269
+ }
270
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
271
+ const value = JSON.parse(sessionStorage.getItem(ssKey!)!);
272
+ let foundMismatch = false;
273
+ for (const qk of queryKeys) {
274
+ if (value[qk] !== query[qk]) {
275
+ foundMismatch = true;
276
+ break;
277
+ }
278
+ }
271
279
 
272
- if (!foundMismatch) {
273
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
274
- return value;
275
- }
276
- }
277
- }
278
- return null;
279
- }
280
+ if (!foundMismatch) {
281
+ return value;
282
+ }
283
+ }
284
+ }
285
+ return null;
286
+ }
280
287
  }
281
288
 
282
289
  /**
283
290
  * A database for testing that stores data in the browsers session storage
284
291
  */
285
292
  class LocalSessionStorageDb extends EventEmitter implements IDb {
286
- private readonly collections = new Map<string, LocalSessionStorageCollection<any>>();
287
- public async close(): Promise<void> { }
288
- public collection<T>(name: string): ICollection<T> {
289
- if (!this.collections.has(name)) {
290
- this.collections.set(name, new LocalSessionStorageCollection<T>(name));
291
- }
292
- return this.collections.get(name) as LocalSessionStorageCollection<T>;
293
- }
293
+ private readonly collections = new Map<string, LocalSessionStorageCollection<any>>();
294
+ public async close(): Promise<void> {}
295
+ public collection<T>(name: string): ICollection<T> {
296
+ if (!this.collections.has(name)) {
297
+ this.collections.set(name, new LocalSessionStorageCollection<T>(name));
298
+ }
299
+ return this.collections.get(name) as LocalSessionStorageCollection<T>;
300
+ }
294
301
 
295
- public async dropCollection(name: string): Promise<boolean> {
296
- if (!this.collections.has(name)) {
297
- return true;
298
- }
299
- this.collections.delete(name);
300
- return true;
301
- }
302
+ public async dropCollection(name: string): Promise<boolean> {
303
+ if (!this.collections.has(name)) {
304
+ return true;
305
+ }
306
+ this.collections.delete(name);
307
+ return true;
308
+ }
302
309
  }
303
310
 
304
311
  /**
305
312
  * A database factory for testing that stores data in the browsers session storage
306
313
  */
307
314
  export class LocalSessionStorageDbFactory implements ITestDbFactory {
308
- public readonly testDatabase: IDb = new LocalSessionStorageDb();
309
- public async connect(): Promise<IDb> {
310
- return this.testDatabase;
311
- }
315
+ public readonly testDatabase: IDb = new LocalSessionStorageDb();
316
+ public async connect(): Promise<IDb> {
317
+ return this.testDatabase;
318
+ }
312
319
  }
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/local-driver";
9
- export const pkgVersion = "2.0.0-dev.2.3.0.115467";
9
+ export const pkgVersion = "2.0.0-dev.4.1.0.148229";
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./lib",
5
+ "module": "esnext",
6
+ },
7
+ }
package/tsconfig.json CHANGED
@@ -1,14 +1,10 @@
1
1
  {
2
- "extends": "@fluidframework/build-common/ts-common-config.json",
3
- "exclude": [
4
- "src/test/**/*"
5
- ],
6
- "compilerOptions": {
7
- "rootDir": "./src",
8
- "outDir": "./dist",
9
- "composite": true
10
- },
11
- "include": [
12
- "src/**/*"
13
- ]
14
- }
2
+ "extends": "@fluidframework/build-common/ts-common-config.json",
3
+ "exclude": ["src/test/**/*"],
4
+ "compilerOptions": {
5
+ "rootDir": "./src",
6
+ "outDir": "./dist",
7
+ "composite": true,
8
+ },
9
+ "include": ["src/**/*"],
10
+ }