@fluidframework/local-driver 2.0.0-internal.3.2.2 → 2.0.0-internal.3.3.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.
Files changed (56) hide show
  1. package/api-extractor.json +4 -0
  2. package/dist/localDocumentServiceFactory.d.ts +3 -0
  3. package/dist/localDocumentServiceFactory.d.ts.map +1 -1
  4. package/dist/localDocumentServiceFactory.js +3 -0
  5. package/dist/localDocumentServiceFactory.js.map +1 -1
  6. package/dist/localSessionStorageDb.d.ts.map +1 -1
  7. package/dist/localSessionStorageDb.js +3 -0
  8. package/dist/localSessionStorageDb.js.map +1 -1
  9. package/dist/packageVersion.d.ts +1 -1
  10. package/dist/packageVersion.js +1 -1
  11. package/dist/packageVersion.js.map +1 -1
  12. package/lib/auth.d.ts +12 -0
  13. package/lib/auth.d.ts.map +1 -0
  14. package/lib/auth.js +38 -0
  15. package/lib/auth.js.map +1 -0
  16. package/lib/index.d.ts +12 -0
  17. package/lib/index.d.ts.map +1 -0
  18. package/lib/index.js +12 -0
  19. package/lib/index.js.map +1 -0
  20. package/lib/localDeltaStorageService.d.ts +19 -0
  21. package/lib/localDeltaStorageService.d.ts.map +1 -0
  22. package/lib/localDeltaStorageService.js +31 -0
  23. package/lib/localDeltaStorageService.js.map +1 -0
  24. package/lib/localDocumentDeltaConnection.d.ts +47 -0
  25. package/lib/localDocumentDeltaConnection.d.ts.map +1 -0
  26. package/lib/localDocumentDeltaConnection.js +88 -0
  27. package/lib/localDocumentDeltaConnection.js.map +1 -0
  28. package/lib/localDocumentService.d.ts +52 -0
  29. package/lib/localDocumentService.d.ts.map +1 -0
  30. package/lib/localDocumentService.js +80 -0
  31. package/lib/localDocumentService.js.map +1 -0
  32. package/lib/localDocumentServiceFactory.d.ts +47 -0
  33. package/lib/localDocumentServiceFactory.d.ts.map +1 -0
  34. package/lib/localDocumentServiceFactory.js +101 -0
  35. package/lib/localDocumentServiceFactory.js.map +1 -0
  36. package/lib/localDocumentStorageService.d.ts +24 -0
  37. package/lib/localDocumentStorageService.d.ts.map +1 -0
  38. package/lib/localDocumentStorageService.js +72 -0
  39. package/lib/localDocumentStorageService.js.map +1 -0
  40. package/lib/localResolver.d.ts +26 -0
  41. package/lib/localResolver.d.ts.map +1 -0
  42. package/lib/localResolver.js +70 -0
  43. package/lib/localResolver.js.map +1 -0
  44. package/lib/localSessionStorageDb.d.ts +10 -0
  45. package/lib/localSessionStorageDb.d.ts.map +1 -0
  46. package/lib/localSessionStorageDb.js +295 -0
  47. package/lib/localSessionStorageDb.js.map +1 -0
  48. package/lib/packageVersion.d.ts +9 -0
  49. package/lib/packageVersion.d.ts.map +1 -0
  50. package/lib/packageVersion.js +9 -0
  51. package/lib/packageVersion.js.map +1 -0
  52. package/package.json +26 -22
  53. package/src/localDocumentServiceFactory.ts +3 -0
  54. package/src/localSessionStorageDb.ts +3 -0
  55. package/src/packageVersion.ts +1 -1
  56. package/tsconfig.esnext.json +7 -0
@@ -0,0 +1,295 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { EventEmitter } from "events";
6
+ import { v4 as uuid } from "uuid";
7
+ /**
8
+ * A collection for local session storage, where data is stored in the browser
9
+ * Functions include database operations such as queries, insertion and update.
10
+ */
11
+ class LocalSessionStorageCollection {
12
+ /**
13
+ * @param collectionName - data type of the collection, e.g. blobs, deltas, trees, etc.
14
+ */
15
+ constructor(collectionName) {
16
+ this.collectionName = collectionName;
17
+ }
18
+ aggregate(pipeline, options) {
19
+ throw new Error("Method Not Implemented");
20
+ }
21
+ async updateMany(filter, set, addToSet) {
22
+ throw new Error("Method Not Implemented");
23
+ }
24
+ async distinct(key, query) {
25
+ throw new Error("Method Not Implemented");
26
+ }
27
+ async findAndUpdate(query, value) {
28
+ throw new Error("Method not implemented.");
29
+ }
30
+ /**
31
+ * {@inheritDoc @fluidframework/server-services-core#ICollection.find}
32
+ */
33
+ /*
34
+ * Each query key consists of several keys separated by '.' e.g: "operation.sequenceNumber".
35
+ * The hierarchical syntax allows finding nested key patterns.
36
+ */
37
+ async find(query, sort) {
38
+ // split the keys and get the corresponding value
39
+ function getValueByKey(propertyBag, key) {
40
+ const keys = key.split(".");
41
+ let value = propertyBag;
42
+ keys.forEach((splitKey) => {
43
+ value = value[splitKey];
44
+ });
45
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
46
+ return value;
47
+ }
48
+ // getting keys of the query we are trying to find
49
+ const queryKeys = Object.keys(query);
50
+ let filteredCollection = this.getAllInternal();
51
+ queryKeys.forEach((key) => {
52
+ if (!query[key]) {
53
+ return;
54
+ }
55
+ if (query[key].$gt > 0 || query[key].$lt > 0) {
56
+ if (query[key].$gt > 0) {
57
+ filteredCollection = filteredCollection.filter((value) => getValueByKey(value, key) > query[key].$gt);
58
+ }
59
+ if (query[key].$lt > 0) {
60
+ filteredCollection = filteredCollection.filter((value) => getValueByKey(value, key) < query[key].$lt);
61
+ }
62
+ }
63
+ else {
64
+ filteredCollection = filteredCollection.filter((value) => getValueByKey(value, key) === query[key]);
65
+ }
66
+ });
67
+ if (sort && Object.keys(sort).length === 1) {
68
+ // eslint-disable-next-line no-inner-declarations
69
+ function compare(a, b) {
70
+ const sortKey = Object.keys(sort)[0];
71
+ return sort[sortKey] === 1
72
+ ? getValueByKey(a, sortKey) - getValueByKey(b, sortKey)
73
+ : getValueByKey(b, sortKey) - getValueByKey(a, sortKey);
74
+ }
75
+ filteredCollection = filteredCollection.sort(compare);
76
+ }
77
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
78
+ return filteredCollection;
79
+ }
80
+ /**
81
+ * {@inheritDoc @fluidframework/server-services-core#ICollection.findAll}
82
+ */
83
+ async findAll() {
84
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
85
+ return this.getAllInternal();
86
+ }
87
+ /**
88
+ * {@inheritDoc @fluidframework/server-services-core#ICollection.findOne}
89
+ */
90
+ /*
91
+ * Query is expected to have a member "_id" which is a string used to find value in the database.
92
+ */
93
+ async findOne(query) {
94
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
95
+ return this.findOneInternal(query);
96
+ }
97
+ /**
98
+ * {@inheritDoc @fluidframework/server-services-core#ICollection.update}
99
+ */
100
+ /*
101
+ * Query is expected to have a member "_id" which is a string used to find value in the database.
102
+ */
103
+ async update(query, set, addToSet) {
104
+ const value = this.findOneInternal(query);
105
+ if (!value) {
106
+ throw new Error("Not found");
107
+ }
108
+ else {
109
+ for (const key of Object.keys(set)) {
110
+ value[key] = set[key];
111
+ }
112
+ this.insertInternal(value);
113
+ }
114
+ }
115
+ /**
116
+ * {@inheritDoc @fluidframework/server-services-core#ICollection.upsert}
117
+ */
118
+ /*
119
+ * Query is expected to have a member "_id" which is a string used to find value in the database.
120
+ */
121
+ async upsert(query, set, addToSet) {
122
+ const value = this.findOneInternal(query);
123
+ if (!value) {
124
+ this.insertInternal(set);
125
+ }
126
+ else {
127
+ for (const key of Object.keys(set)) {
128
+ value[key] = set[key];
129
+ }
130
+ this.insertInternal(value);
131
+ }
132
+ }
133
+ /**
134
+ * {@inheritDoc @fluidframework/server-services-core#ICollection.insertOne}
135
+ */
136
+ /*
137
+ * Value is expected to have a member "_id" which is a string used to search in the database.
138
+ */
139
+ async insertOne(value) {
140
+ const presentVal = this.findOneInternal(value);
141
+ // Only raise error when the object is present and the value is not equal.
142
+ if (presentVal) {
143
+ if (JSON.stringify(presentVal) === JSON.stringify(value)) {
144
+ return;
145
+ }
146
+ throw new Error("Existing Object!!");
147
+ }
148
+ return this.insertInternal(value);
149
+ }
150
+ /**
151
+ * {@inheritDoc @fluidframework/server-services-core#ICollection.findOrCreate}
152
+ */
153
+ /*
154
+ * Value and query are expected to have a member "_id" which is a string used to search or insert in the database.
155
+ */
156
+ async findOrCreate(query, value) {
157
+ const existing = this.findOneInternal(query);
158
+ if (existing) {
159
+ return { value: existing, existing: true };
160
+ }
161
+ this.insertInternal(value);
162
+ return { value, existing: false };
163
+ }
164
+ /**
165
+ * {@inheritDoc @fluidframework/server-services-core#ICollection.insertMany}
166
+ */
167
+ /*
168
+ * Each element in values is expected to have a member "_id" which is a string used to insert in the database.
169
+ */
170
+ async insertMany(values, ordered) {
171
+ this.insertInternal(...values);
172
+ }
173
+ /**
174
+ * {@inheritDoc @fluidframework/server-services-core#ICollection.deleteOne}
175
+ */
176
+ async deleteOne(query) {
177
+ throw new Error("Method not implemented.");
178
+ }
179
+ /**
180
+ * {@inheritDoc @fluidframework/server-services-core#ICollection.deleteMany}
181
+ */
182
+ async deleteMany(query) {
183
+ throw new Error("Method not implemented.");
184
+ }
185
+ /**
186
+ * {@inheritDoc @fluidframework/server-services-core#ICollection.createIndex}
187
+ */
188
+ async createIndex(index, unique) {
189
+ throw new Error("Method not implemented.");
190
+ }
191
+ /**
192
+ * Return all values in the database
193
+ */
194
+ getAllInternal() {
195
+ const values = [];
196
+ for (let i = 0; i < sessionStorage.length; i++) {
197
+ const key = sessionStorage.key(i);
198
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
199
+ if (key.startsWith(this.collectionName)) {
200
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
201
+ values.push(JSON.parse(sessionStorage.getItem(key)));
202
+ }
203
+ }
204
+ return values;
205
+ }
206
+ /**
207
+ * Inserts values into the session storge.
208
+ * Values are expected to have a member "_id" which is a unique id, otherwise will be assigned one
209
+ *
210
+ * @param values - data to insert to the database
211
+ */
212
+ insertInternal(...values) {
213
+ for (const value of values) {
214
+ if (value) {
215
+ if (!value._id) {
216
+ value._id = uuid();
217
+ }
218
+ sessionStorage.setItem(`${this.collectionName}-${value._id}`, JSON.stringify(value));
219
+ }
220
+ }
221
+ }
222
+ /**
223
+ * Finds the query in session storage and returns its value.
224
+ * Returns null if query is not found.
225
+ * Query is expected to have a member "_id" which is a unique id.
226
+ *
227
+ * @param query - what to find in the database
228
+ */
229
+ findOneInternal(query) {
230
+ if (query._id) {
231
+ const json = sessionStorage.getItem(`${this.collectionName}-${query._id}`);
232
+ if (json) {
233
+ return JSON.parse(json);
234
+ }
235
+ }
236
+ else {
237
+ const queryKeys = Object.keys(query);
238
+ for (let i = 0; i < sessionStorage.length; i++) {
239
+ const ssKey = sessionStorage.key(i);
240
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
241
+ if (!ssKey.startsWith(this.collectionName)) {
242
+ continue;
243
+ }
244
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
245
+ const value = JSON.parse(sessionStorage.getItem(ssKey));
246
+ let foundMismatch = false;
247
+ for (const qk of queryKeys) {
248
+ if (value[qk] !== query[qk]) {
249
+ foundMismatch = true;
250
+ break;
251
+ }
252
+ }
253
+ if (!foundMismatch) {
254
+ return value;
255
+ }
256
+ }
257
+ }
258
+ return null;
259
+ }
260
+ }
261
+ /**
262
+ * A database for testing that stores data in the browsers session storage
263
+ */
264
+ class LocalSessionStorageDb extends EventEmitter {
265
+ constructor() {
266
+ super(...arguments);
267
+ this.collections = new Map();
268
+ }
269
+ async close() { }
270
+ collection(name) {
271
+ if (!this.collections.has(name)) {
272
+ this.collections.set(name, new LocalSessionStorageCollection(name));
273
+ }
274
+ return this.collections.get(name);
275
+ }
276
+ async dropCollection(name) {
277
+ if (!this.collections.has(name)) {
278
+ return true;
279
+ }
280
+ this.collections.delete(name);
281
+ return true;
282
+ }
283
+ }
284
+ /**
285
+ * A database factory for testing that stores data in the browsers session storage
286
+ */
287
+ export class LocalSessionStorageDbFactory {
288
+ constructor() {
289
+ this.testDatabase = new LocalSessionStorageDb();
290
+ }
291
+ async connect() {
292
+ return this.testDatabase;
293
+ }
294
+ }
295
+ //# sourceMappingURL=localSessionStorageDb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"localSessionStorageDb.js","sourceRoot":"","sources":["../src/localSessionStorageDb.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAGtC,OAAO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AAC,GAAG,CAAC,IAAI,CAAqC,CAAC;IACvE,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,IAAY;QACvC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAChC,OAAO,IAAI,CAAC;SACZ;QACD,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC9B,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AAED;;GAEG;AACH,MAAM,OAAO,4BAA4B;IAAzC;QACiB,iBAAY,GAAQ,IAAI,qBAAqB,EAAE,CAAC;IAIjE,CAAC;IAHO,KAAK,CAAC,OAAO;QACnB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC1B,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { EventEmitter } from \"events\";\nimport { ICollection, IDb } from \"@fluidframework/server-services-core\";\nimport { ITestDbFactory } from \"@fluidframework/server-test-utils\";\nimport { v4 as uuid } from \"uuid\";\n\n/**\n * A collection for local session storage, where data is stored in the browser\n * Functions include database operations such as queries, insertion and update.\n */\nclass LocalSessionStorageCollection<T> implements ICollection<T> {\n\t/**\n\t * @param collectionName - data type of the collection, e.g. blobs, deltas, trees, etc.\n\t */\n\tconstructor(private readonly collectionName: string) {}\n\n\tpublic aggregate(pipeline: any, options?: any): any {\n\t\tthrow new Error(\"Method Not Implemented\");\n\t}\n\n\tpublic async updateMany(filter: any, set: any, addToSet: any): Promise<void> {\n\t\tthrow new Error(\"Method Not Implemented\");\n\t}\n\tpublic async distinct(key: any, query: any): Promise<any> {\n\t\tthrow new Error(\"Method Not Implemented\");\n\t}\n\tpublic async findAndUpdate(query: any, value: T): Promise<{ value: T; existing: boolean }> {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/server-services-core#ICollection.find}\n\t */\n\t/*\n\t * Each query key consists of several keys separated by '.' e.g: \"operation.sequenceNumber\".\n\t * The hierarchical syntax allows finding nested key patterns.\n\t */\n\tpublic async find(query: any, sort: any): Promise<any[]> {\n\t\t// split the keys and get the corresponding value\n\t\tfunction getValueByKey(propertyBag, key: string) {\n\t\t\tconst keys = key.split(\".\");\n\t\t\tlet value = propertyBag;\n\t\t\tkeys.forEach((splitKey) => {\n\t\t\t\tvalue = value[splitKey];\n\t\t\t});\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\treturn value;\n\t\t}\n\n\t\t// getting keys of the query we are trying to find\n\t\tconst queryKeys = Object.keys(query);\n\t\tlet filteredCollection = this.getAllInternal();\n\t\tqueryKeys.forEach((key) => {\n\t\t\tif (!query[key]) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (query[key].$gt > 0 || query[key].$lt > 0) {\n\t\t\t\tif (query[key].$gt > 0) {\n\t\t\t\t\tfilteredCollection = filteredCollection.filter(\n\t\t\t\t\t\t(value) => getValueByKey(value, key) > query[key].$gt,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (query[key].$lt > 0) {\n\t\t\t\t\tfilteredCollection = filteredCollection.filter(\n\t\t\t\t\t\t(value) => getValueByKey(value, key) < query[key].$lt,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfilteredCollection = filteredCollection.filter(\n\t\t\t\t\t(value) => getValueByKey(value, key) === query[key],\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\n\t\tif (sort && Object.keys(sort).length === 1) {\n\t\t\t// eslint-disable-next-line no-inner-declarations\n\t\t\tfunction compare(a, b) {\n\t\t\t\tconst sortKey = Object.keys(sort)[0];\n\t\t\t\treturn sort[sortKey] === 1\n\t\t\t\t\t? getValueByKey(a, sortKey) - getValueByKey(b, sortKey)\n\t\t\t\t\t: getValueByKey(b, sortKey) - getValueByKey(a, sortKey);\n\t\t\t}\n\n\t\t\tfilteredCollection = filteredCollection.sort(compare);\n\t\t}\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\treturn filteredCollection;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/server-services-core#ICollection.findAll}\n\t */\n\tpublic async findAll(): Promise<any[]> {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\treturn this.getAllInternal();\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/server-services-core#ICollection.findOne}\n\t */\n\t/*\n\t * Query is expected to have a member \"_id\" which is a string used to find value in the database.\n\t */\n\tpublic async findOne(query: any): Promise<any> {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\treturn this.findOneInternal(query);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/server-services-core#ICollection.update}\n\t */\n\t/*\n\t * Query is expected to have a member \"_id\" which is a string used to find value in the database.\n\t */\n\tpublic async update(query: any, set: any, addToSet: any): Promise<void> {\n\t\tconst value = this.findOneInternal(query);\n\t\tif (!value) {\n\t\t\tthrow new Error(\"Not found\");\n\t\t} else {\n\t\t\tfor (const key of Object.keys(set)) {\n\t\t\t\tvalue[key] = set[key];\n\t\t\t}\n\t\t\tthis.insertInternal(value);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/server-services-core#ICollection.upsert}\n\t */\n\t/*\n\t * Query is expected to have a member \"_id\" which is a string used to find value in the database.\n\t */\n\tpublic async upsert(query: any, set: any, addToSet: any): Promise<void> {\n\t\tconst value = this.findOneInternal(query);\n\t\tif (!value) {\n\t\t\tthis.insertInternal(set);\n\t\t} else {\n\t\t\tfor (const key of Object.keys(set)) {\n\t\t\t\tvalue[key] = set[key];\n\t\t\t}\n\t\t\tthis.insertInternal(value);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/server-services-core#ICollection.insertOne}\n\t */\n\t/*\n\t * Value is expected to have a member \"_id\" which is a string used to search in the database.\n\t */\n\tpublic async insertOne(value: any): Promise<any> {\n\t\tconst presentVal = this.findOneInternal(value);\n\t\t// Only raise error when the object is present and the value is not equal.\n\t\tif (presentVal) {\n\t\t\tif (JSON.stringify(presentVal) === JSON.stringify(value)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthrow new Error(\"Existing Object!!\");\n\t\t}\n\n\t\treturn this.insertInternal(value);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/server-services-core#ICollection.findOrCreate}\n\t */\n\t/*\n\t * Value and query are expected to have a member \"_id\" which is a string used to search or insert in the database.\n\t */\n\tpublic async findOrCreate(query: any, value: any): Promise<{ value: any; existing: boolean }> {\n\t\tconst existing = this.findOneInternal(query);\n\t\tif (existing) {\n\t\t\treturn { value: existing, existing: true };\n\t\t}\n\t\tthis.insertInternal(value);\n\t\treturn { value, existing: false };\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/server-services-core#ICollection.insertMany}\n\t */\n\t/*\n\t * Each element in values is expected to have a member \"_id\" which is a string used to insert in the database.\n\t */\n\tpublic async insertMany(values: any[], ordered: boolean): Promise<void> {\n\t\tthis.insertInternal(...values);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/server-services-core#ICollection.deleteOne}\n\t */\n\tpublic async deleteOne(query: any): Promise<any> {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/server-services-core#ICollection.deleteMany}\n\t */\n\tpublic async deleteMany(query: any): Promise<any> {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/server-services-core#ICollection.createIndex}\n\t */\n\tpublic async createIndex(index: any, unique: boolean): Promise<void> {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\t/**\n\t * Return all values in the database\n\t */\n\tprivate getAllInternal(): any[] {\n\t\tconst values: string[] = [];\n\t\tfor (let i = 0; i < sessionStorage.length; i++) {\n\t\t\tconst key = sessionStorage.key(i);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tif (key!.startsWith(this.collectionName)) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tvalues.push(JSON.parse(sessionStorage.getItem(key!)!));\n\t\t\t}\n\t\t}\n\t\treturn values;\n\t}\n\n\t/**\n\t * Inserts values into the session storge.\n\t * Values are expected to have a member \"_id\" which is a unique id, otherwise will be assigned one\n\t *\n\t * @param values - data to insert to the database\n\t */\n\tprivate insertInternal(...values: any[]) {\n\t\tfor (const value of values) {\n\t\t\tif (value) {\n\t\t\t\tif (!value._id) {\n\t\t\t\t\tvalue._id = uuid();\n\t\t\t\t}\n\t\t\t\tsessionStorage.setItem(\n\t\t\t\t\t`${this.collectionName}-${value._id}`,\n\t\t\t\t\tJSON.stringify(value),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Finds the query in session storage and returns its value.\n\t * Returns null if query is not found.\n\t * Query is expected to have a member \"_id\" which is a unique id.\n\t *\n\t * @param query - what to find in the database\n\t */\n\tprivate findOneInternal(query: any): any {\n\t\tif (query._id) {\n\t\t\tconst json = sessionStorage.getItem(`${this.collectionName}-${query._id}`);\n\t\t\tif (json) {\n\t\t\t\treturn JSON.parse(json);\n\t\t\t}\n\t\t} else {\n\t\t\tconst queryKeys = Object.keys(query);\n\t\t\tfor (let i = 0; i < sessionStorage.length; i++) {\n\t\t\t\tconst ssKey = sessionStorage.key(i);\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tif (!ssKey!.startsWith(this.collectionName)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tconst value = JSON.parse(sessionStorage.getItem(ssKey!)!);\n\t\t\t\tlet foundMismatch = false;\n\t\t\t\tfor (const qk of queryKeys) {\n\t\t\t\t\tif (value[qk] !== query[qk]) {\n\t\t\t\t\t\tfoundMismatch = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (!foundMismatch) {\n\t\t\t\t\treturn value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n}\n\n/**\n * A database for testing that stores data in the browsers session storage\n */\nclass LocalSessionStorageDb extends EventEmitter implements IDb {\n\tprivate readonly collections = new Map<string, LocalSessionStorageCollection<any>>();\n\tpublic async close(): Promise<void> {}\n\tpublic collection<T>(name: string): ICollection<T> {\n\t\tif (!this.collections.has(name)) {\n\t\t\tthis.collections.set(name, new LocalSessionStorageCollection<T>(name));\n\t\t}\n\t\treturn this.collections.get(name) as LocalSessionStorageCollection<T>;\n\t}\n\n\tpublic async dropCollection(name: string): Promise<boolean> {\n\t\tif (!this.collections.has(name)) {\n\t\t\treturn true;\n\t\t}\n\t\tthis.collections.delete(name);\n\t\treturn true;\n\t}\n}\n\n/**\n * A database factory for testing that stores data in the browsers session storage\n */\nexport class LocalSessionStorageDbFactory implements ITestDbFactory {\n\tpublic readonly testDatabase: IDb = new LocalSessionStorageDb();\n\tpublic async connect(): Promise<IDb> {\n\t\treturn this.testDatabase;\n\t}\n}\n"]}
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ *
5
+ * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
+ */
7
+ export declare const pkgName = "@fluidframework/local-driver";
8
+ export declare const pkgVersion = "2.0.0-internal.3.3.0";
9
+ //# sourceMappingURL=packageVersion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,iCAAiC,CAAC;AACtD,eAAO,MAAM,UAAU,yBAAyB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ *
5
+ * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
+ */
7
+ export const pkgName = "@fluidframework/local-driver";
8
+ export const pkgVersion = "2.0.0-internal.3.3.0";
9
+ //# sourceMappingURL=packageVersion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,8BAA8B,CAAC;AACtD,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/local-driver\";\nexport const pkgVersion = \"2.0.0-internal.3.3.0\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/local-driver",
3
- "version": "2.0.0-internal.3.2.2",
3
+ "version": "2.0.0-internal.3.3.0",
4
4
  "description": "Fluid local driver",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -38,29 +38,31 @@
38
38
  "dependencies": {
39
39
  "@fluidframework/common-definitions": "^0.20.1",
40
40
  "@fluidframework/common-utils": "^1.1.1",
41
- "@fluidframework/core-interfaces": ">=2.0.0-internal.3.2.2 <2.0.0-internal.4.0.0",
42
- "@fluidframework/driver-base": ">=2.0.0-internal.3.2.2 <2.0.0-internal.4.0.0",
43
- "@fluidframework/driver-definitions": ">=2.0.0-internal.3.2.2 <2.0.0-internal.4.0.0",
44
- "@fluidframework/driver-utils": ">=2.0.0-internal.3.2.2 <2.0.0-internal.4.0.0",
45
- "@fluidframework/protocol-base": "^0.1038.2000",
41
+ "@fluidframework/core-interfaces": ">=2.0.0-internal.3.3.0 <2.0.0-internal.4.0.0",
42
+ "@fluidframework/driver-base": ">=2.0.0-internal.3.3.0 <2.0.0-internal.4.0.0",
43
+ "@fluidframework/driver-definitions": ">=2.0.0-internal.3.3.0 <2.0.0-internal.4.0.0",
44
+ "@fluidframework/driver-utils": ">=2.0.0-internal.3.3.0 <2.0.0-internal.4.0.0",
45
+ "@fluidframework/protocol-base": "^0.1038.3000",
46
46
  "@fluidframework/protocol-definitions": "^1.1.0",
47
- "@fluidframework/routerlicious-driver": ">=2.0.0-internal.3.2.2 <2.0.0-internal.4.0.0",
48
- "@fluidframework/server-local-server": "^0.1038.2000",
49
- "@fluidframework/server-services-client": "^0.1038.2000",
50
- "@fluidframework/server-services-core": "^0.1038.2000",
51
- "@fluidframework/server-test-utils": "^0.1038.2000",
52
- "@fluidframework/telemetry-utils": ">=2.0.0-internal.3.2.2 <2.0.0-internal.4.0.0",
47
+ "@fluidframework/routerlicious-driver": ">=2.0.0-internal.3.3.0 <2.0.0-internal.4.0.0",
48
+ "@fluidframework/server-local-server": "^0.1038.3000",
49
+ "@fluidframework/server-services-client": "^0.1038.3000",
50
+ "@fluidframework/server-services-core": "^0.1038.3000",
51
+ "@fluidframework/server-test-utils": "^0.1038.3000",
52
+ "@fluidframework/telemetry-utils": ">=2.0.0-internal.3.3.0 <2.0.0-internal.4.0.0",
53
53
  "events": "^3.1.0",
54
54
  "jsrsasign": "^10.5.25",
55
55
  "url": "^0.11.0",
56
56
  "uuid": "^8.3.1"
57
57
  },
58
58
  "devDependencies": {
59
- "@fluid-tools/build-cli": "^0.10.0",
59
+ "@fluid-tools/build-cli": "^0.12.0",
60
60
  "@fluidframework/build-common": "^1.1.0",
61
+ "@fluidframework/build-tools": "^0.12.0",
61
62
  "@fluidframework/eslint-config-fluid": "^2.0.0",
62
- "@fluidframework/local-driver-previous": "npm:@fluidframework/local-driver@2.0.0-internal.3.1.0",
63
- "@fluidframework/mocha-test-setup": ">=2.0.0-internal.3.2.2 <2.0.0-internal.4.0.0",
63
+ "@fluidframework/local-driver-previous": "npm:@fluidframework/local-driver@2.0.0-internal.3.2.0",
64
+ "@fluidframework/mocha-test-setup": ">=2.0.0-internal.3.3.0 <2.0.0-internal.4.0.0",
65
+ "@microsoft/api-extractor": "^7.22.2",
64
66
  "@rushstack/eslint-config": "^2.5.1",
65
67
  "@types/jsrsasign": "^8.0.8",
66
68
  "@types/mocha": "^9.1.1",
@@ -76,19 +78,19 @@
76
78
  "typescript": "~4.5.5"
77
79
  },
78
80
  "typeValidation": {
79
- "version": "2.0.0-internal.3.2.0",
80
- "previousVersionStyle": "~previousMinor",
81
- "baselineRange": ">=2.0.0-internal.3.1.0 <2.0.0-internal.3.2.0",
82
- "baselineVersion": "2.0.0-internal.3.1.0",
83
81
  "broken": {}
84
82
  },
85
83
  "scripts": {
86
- "build": "npm run build:genver && concurrently npm:build:compile npm:lint",
87
- "build:compile": "npm run tsc && npm run build:test",
84
+ "build": "npm run build:genver && concurrently npm:build:compile npm:lint && npm run build:docs",
85
+ "build:commonjs": "npm run tsc && npm run typetests:gen && npm run build:test",
86
+ "build:compile": "concurrently npm:build:commonjs npm:build:esnext",
87
+ "build:docs": "api-extractor run --local --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/doc-models/* ../../../_api-extractor-temp/",
88
+ "build:esnext": "tsc --project ./tsconfig.esnext.json",
88
89
  "build:full": "npm run build",
89
90
  "build:full:compile": "npm run build:compile",
90
91
  "build:genver": "gen-version",
91
92
  "build:test": "tsc --project ./src/test/tsconfig.json",
93
+ "ci:build:docs": "api-extractor run --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/* ../../../_api-extractor-temp/",
92
94
  "clean": "rimraf dist lib *.tsbuildinfo *.build.log",
93
95
  "eslint": "eslint --format stylish src",
94
96
  "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
@@ -101,6 +103,8 @@
101
103
  "test:coverage": "nyc npm test -- --reporter xunit --reporter-option output=nyc/junit-report.xml",
102
104
  "test:mocha": "mocha --ignore 'dist/test/types/*' --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup --unhandled-rejections=strict",
103
105
  "test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
104
- "tsc": "tsc"
106
+ "tsc": "tsc",
107
+ "typetests:gen": "fluid-type-test-generator",
108
+ "typetests:prepare": "flub generate typetests --prepare --dir . --pin"
105
109
  }
106
110
  }
@@ -30,6 +30,9 @@ import { createLocalDocumentService } from "./localDocumentService";
30
30
  * Implementation of document service factory for local use.
31
31
  */
32
32
  export class LocalDocumentServiceFactory implements IDocumentServiceFactory {
33
+ /**
34
+ * @deprecated 2.0.0-internal.3.3.0 Document service factories should not be distinguished by unique non-standard protocols. To be removed in an upcoming release.
35
+ */
33
36
  public readonly protocolName = "fluid-test:";
34
37
 
35
38
  // A map of clientId to LocalDocumentService.
@@ -27,6 +27,9 @@ class LocalSessionStorageCollection<T> implements ICollection<T> {
27
27
  public async distinct(key: any, query: any): Promise<any> {
28
28
  throw new Error("Method Not Implemented");
29
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
34
  /**
32
35
  * {@inheritDoc @fluidframework/server-services-core#ICollection.find}
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/local-driver";
9
- export const pkgVersion = "2.0.0-internal.3.2.2";
9
+ export const pkgVersion = "2.0.0-internal.3.3.0";
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./lib",
5
+ "module": "esnext",
6
+ },
7
+ }