@fluidframework/fluid-static 2.0.0-internal.1.0.0.83139 → 2.0.0-internal.1.0.1
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.
- package/dist/utils.d.ts +1 -4
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +10 -10
- package/dist/utils.js.map +1 -1
- package/lib/utils.d.ts +1 -4
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +10 -10
- package/lib/utils.js.map +1 -1
- package/package.json +23 -14
- package/src/utils.ts +18 -15
package/dist/utils.d.ts
CHANGED
|
@@ -18,8 +18,5 @@ export declare const isSharedObjectClass: (obj: any) => obj is SharedObjectClass
|
|
|
18
18
|
* of both SharedObject or DataObject. This function seperates the two and returns a registery
|
|
19
19
|
* of DataObject types and an array of SharedObjects.
|
|
20
20
|
*/
|
|
21
|
-
export declare const parseDataObjectsFromSharedObjects: (schema: ContainerSchema) => [
|
|
22
|
-
NamedFluidDataStoreRegistryEntry[],
|
|
23
|
-
IChannelFactory[]
|
|
24
|
-
];
|
|
21
|
+
export declare const parseDataObjectsFromSharedObjects: (schema: ContainerSchema) => [NamedFluidDataStoreRegistryEntry[], IChannelFactory[]];
|
|
25
22
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,gCAAgC,EAAE,MAAM,qCAAqC,CAAC;AACvF,OAAO,EACH,eAAe,EACf,eAAe,EAEf,iBAAiB,EACpB,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,eAAO,MAAM,iBAAiB,QAAS,GAAG,gCAEzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,gCAAgC,EAAE,MAAM,qCAAqC,CAAC;AACvF,OAAO,EACH,eAAe,EACf,eAAe,EAEf,iBAAiB,EACpB,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,eAAO,MAAM,iBAAiB,QAAS,GAAG,gCAEzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,QACvB,GAAG,kCAGX,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,WAClC,eAAe,KACxB,CAAC,gCAAgC,EAAE,EAAE,eAAe,EAAE,CA+BxD,CAAC"}
|
package/dist/utils.js
CHANGED
|
@@ -25,6 +25,7 @@ exports.isSharedObjectClass = isSharedObjectClass;
|
|
|
25
25
|
* of DataObject types and an array of SharedObjects.
|
|
26
26
|
*/
|
|
27
27
|
const parseDataObjectsFromSharedObjects = (schema) => {
|
|
28
|
+
var _a;
|
|
28
29
|
const registryEntries = new Set();
|
|
29
30
|
const sharedObjects = new Set();
|
|
30
31
|
const tryAddObject = (obj) => {
|
|
@@ -32,22 +33,21 @@ const parseDataObjectsFromSharedObjects = (schema) => {
|
|
|
32
33
|
sharedObjects.add(obj.getFactory());
|
|
33
34
|
}
|
|
34
35
|
else if ((0, exports.isDataObjectClass)(obj)) {
|
|
35
|
-
registryEntries.add([
|
|
36
|
+
registryEntries.add([
|
|
37
|
+
obj.factory.type,
|
|
38
|
+
Promise.resolve(obj.factory),
|
|
39
|
+
]);
|
|
36
40
|
}
|
|
37
41
|
else {
|
|
38
42
|
throw new Error(`Entry is neither a DataObject or a SharedObject`);
|
|
39
43
|
}
|
|
40
44
|
};
|
|
41
45
|
// Add the object types that will be initialized
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
for (const obj of schema.dynamicObjectTypes) {
|
|
48
|
-
tryAddObject(obj);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
46
|
+
const dedupedObjects = new Set([
|
|
47
|
+
...Object.values(schema.initialObjects),
|
|
48
|
+
...((_a = schema.dynamicObjectTypes) !== null && _a !== void 0 ? _a : []),
|
|
49
|
+
]);
|
|
50
|
+
dedupedObjects.forEach(tryAddObject);
|
|
51
51
|
if (registryEntries.size === 0 && sharedObjects.size === 0) {
|
|
52
52
|
throw new Error("Container cannot be initialized without any DataTypes");
|
|
53
53
|
}
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAWH;;GAEG;AACI,MAAM,iBAAiB,GAAG,CAAC,GAAQ,EAA+B,EAAE;IACvE,OAAO,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,MAAK,SAAS,CAAC;AACtC,CAAC,CAAC;AAFW,QAAA,iBAAiB,qBAE5B;AAEF;;GAEG;AACI,MAAM,mBAAmB,GAAG,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAWH;;GAEG;AACI,MAAM,iBAAiB,GAAG,CAAC,GAAQ,EAA+B,EAAE;IACvE,OAAO,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,MAAK,SAAS,CAAC;AACtC,CAAC,CAAC;AAFW,QAAA,iBAAiB,qBAE5B;AAEF;;GAEG;AACI,MAAM,mBAAmB,GAAG,CAC/B,GAAQ,EACqB,EAAE;IAC/B,OAAO,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,UAAU,MAAK,SAAS,CAAC;AACzC,CAAC,CAAC;AAJW,QAAA,mBAAmB,uBAI9B;AAEF;;;;GAIG;AACI,MAAM,iCAAiC,GAAG,CAC7C,MAAuB,EACgC,EAAE;;IACzD,MAAM,eAAe,GAA0C,IAAI,GAAG,EAAE,CAAC;IACzE,MAAM,aAAa,GAAyB,IAAI,GAAG,EAAE,CAAC;IAEtD,MAAM,YAAY,GAAG,CAAC,GAA6B,EAAE,EAAE;QACnD,IAAI,IAAA,2BAAmB,EAAC,GAAG,CAAC,EAAE;YAC1B,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;SACvC;aAAM,IAAI,IAAA,yBAAiB,EAAC,GAAG,CAAC,EAAE;YAC/B,eAAe,CAAC,GAAG,CAAC;gBAChB,GAAG,CAAC,OAAO,CAAC,IAAI;gBAChB,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;aAC/B,CAAC,CAAC;SACN;aAAM;YACH,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;SACtE;IACL,CAAC,CAAC;IAEF,gDAAgD;IAChD,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;QAC3B,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC;QACvC,GAAG,CAAC,MAAA,MAAM,CAAC,kBAAkB,mCAAI,EAAE,CAAC;KACvC,CAAC,CAAC;IACH,cAAc,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAErC,IAAI,eAAe,CAAC,IAAI,KAAK,CAAC,IAAI,aAAa,CAAC,IAAI,KAAK,CAAC,EAAE;QACxD,MAAM,IAAI,KAAK,CACX,uDAAuD,CAC1D,CAAC;KACL;IAED,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;AACpE,CAAC,CAAC;AAjCW,QAAA,iCAAiC,qCAiC5C","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IChannelFactory } from \"@fluidframework/datastore-definitions\";\nimport { NamedFluidDataStoreRegistryEntry } from \"@fluidframework/runtime-definitions\";\nimport {\n ContainerSchema,\n DataObjectClass,\n LoadableObjectClass,\n SharedObjectClass,\n} from \"./types\";\n\n/**\n * Runtime check to determine if a class is a DataObject type\n */\nexport const isDataObjectClass = (obj: any): obj is DataObjectClass<any> => {\n return obj?.factory !== undefined;\n};\n\n/**\n * Runtime check to determine if a class is a SharedObject type\n */\nexport const isSharedObjectClass = (\n obj: any,\n): obj is SharedObjectClass<any> => {\n return obj?.getFactory !== undefined;\n};\n\n/**\n * The ContainerSchema consists of initialObjects and dynamicObjectTypes. These types can be\n * of both SharedObject or DataObject. This function seperates the two and returns a registery\n * of DataObject types and an array of SharedObjects.\n */\nexport const parseDataObjectsFromSharedObjects = (\n schema: ContainerSchema,\n): [NamedFluidDataStoreRegistryEntry[], IChannelFactory[]] => {\n const registryEntries: Set<NamedFluidDataStoreRegistryEntry> = new Set();\n const sharedObjects: Set<IChannelFactory> = new Set();\n\n const tryAddObject = (obj: LoadableObjectClass<any>) => {\n if (isSharedObjectClass(obj)) {\n sharedObjects.add(obj.getFactory());\n } else if (isDataObjectClass(obj)) {\n registryEntries.add([\n obj.factory.type,\n Promise.resolve(obj.factory),\n ]);\n } else {\n throw new Error(`Entry is neither a DataObject or a SharedObject`);\n }\n };\n\n // Add the object types that will be initialized\n const dedupedObjects = new Set([\n ...Object.values(schema.initialObjects),\n ...(schema.dynamicObjectTypes ?? []),\n ]);\n dedupedObjects.forEach(tryAddObject);\n\n if (registryEntries.size === 0 && sharedObjects.size === 0) {\n throw new Error(\n \"Container cannot be initialized without any DataTypes\",\n );\n }\n\n return [Array.from(registryEntries), Array.from(sharedObjects)];\n};\n"]}
|
package/lib/utils.d.ts
CHANGED
|
@@ -18,8 +18,5 @@ export declare const isSharedObjectClass: (obj: any) => obj is SharedObjectClass
|
|
|
18
18
|
* of both SharedObject or DataObject. This function seperates the two and returns a registery
|
|
19
19
|
* of DataObject types and an array of SharedObjects.
|
|
20
20
|
*/
|
|
21
|
-
export declare const parseDataObjectsFromSharedObjects: (schema: ContainerSchema) => [
|
|
22
|
-
NamedFluidDataStoreRegistryEntry[],
|
|
23
|
-
IChannelFactory[]
|
|
24
|
-
];
|
|
21
|
+
export declare const parseDataObjectsFromSharedObjects: (schema: ContainerSchema) => [NamedFluidDataStoreRegistryEntry[], IChannelFactory[]];
|
|
25
22
|
//# sourceMappingURL=utils.d.ts.map
|
package/lib/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,gCAAgC,EAAE,MAAM,qCAAqC,CAAC;AACvF,OAAO,EACH,eAAe,EACf,eAAe,EAEf,iBAAiB,EACpB,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,eAAO,MAAM,iBAAiB,QAAS,GAAG,gCAEzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,gCAAgC,EAAE,MAAM,qCAAqC,CAAC;AACvF,OAAO,EACH,eAAe,EACf,eAAe,EAEf,iBAAiB,EACpB,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,eAAO,MAAM,iBAAiB,QAAS,GAAG,gCAEzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,QACvB,GAAG,kCAGX,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,WAClC,eAAe,KACxB,CAAC,gCAAgC,EAAE,EAAE,eAAe,EAAE,CA+BxD,CAAC"}
|
package/lib/utils.js
CHANGED
|
@@ -20,6 +20,7 @@ export const isSharedObjectClass = (obj) => {
|
|
|
20
20
|
* of DataObject types and an array of SharedObjects.
|
|
21
21
|
*/
|
|
22
22
|
export const parseDataObjectsFromSharedObjects = (schema) => {
|
|
23
|
+
var _a;
|
|
23
24
|
const registryEntries = new Set();
|
|
24
25
|
const sharedObjects = new Set();
|
|
25
26
|
const tryAddObject = (obj) => {
|
|
@@ -27,22 +28,21 @@ export const parseDataObjectsFromSharedObjects = (schema) => {
|
|
|
27
28
|
sharedObjects.add(obj.getFactory());
|
|
28
29
|
}
|
|
29
30
|
else if (isDataObjectClass(obj)) {
|
|
30
|
-
registryEntries.add([
|
|
31
|
+
registryEntries.add([
|
|
32
|
+
obj.factory.type,
|
|
33
|
+
Promise.resolve(obj.factory),
|
|
34
|
+
]);
|
|
31
35
|
}
|
|
32
36
|
else {
|
|
33
37
|
throw new Error(`Entry is neither a DataObject or a SharedObject`);
|
|
34
38
|
}
|
|
35
39
|
};
|
|
36
40
|
// Add the object types that will be initialized
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
for (const obj of schema.dynamicObjectTypes) {
|
|
43
|
-
tryAddObject(obj);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
41
|
+
const dedupedObjects = new Set([
|
|
42
|
+
...Object.values(schema.initialObjects),
|
|
43
|
+
...((_a = schema.dynamicObjectTypes) !== null && _a !== void 0 ? _a : []),
|
|
44
|
+
]);
|
|
45
|
+
dedupedObjects.forEach(tryAddObject);
|
|
46
46
|
if (registryEntries.size === 0 && sharedObjects.size === 0) {
|
|
47
47
|
throw new Error("Container cannot be initialized without any DataTypes");
|
|
48
48
|
}
|
package/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAQ,EAA+B,EAAE;IACvE,OAAO,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,MAAK,SAAS,CAAC;AACtC,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAQ,EAA+B,EAAE;IACvE,OAAO,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,MAAK,SAAS,CAAC;AACtC,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAC/B,GAAQ,EACqB,EAAE;IAC/B,OAAO,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,UAAU,MAAK,SAAS,CAAC;AACzC,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAC7C,MAAuB,EACgC,EAAE;;IACzD,MAAM,eAAe,GAA0C,IAAI,GAAG,EAAE,CAAC;IACzE,MAAM,aAAa,GAAyB,IAAI,GAAG,EAAE,CAAC;IAEtD,MAAM,YAAY,GAAG,CAAC,GAA6B,EAAE,EAAE;QACnD,IAAI,mBAAmB,CAAC,GAAG,CAAC,EAAE;YAC1B,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;SACvC;aAAM,IAAI,iBAAiB,CAAC,GAAG,CAAC,EAAE;YAC/B,eAAe,CAAC,GAAG,CAAC;gBAChB,GAAG,CAAC,OAAO,CAAC,IAAI;gBAChB,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;aAC/B,CAAC,CAAC;SACN;aAAM;YACH,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;SACtE;IACL,CAAC,CAAC;IAEF,gDAAgD;IAChD,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;QAC3B,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC;QACvC,GAAG,CAAC,MAAA,MAAM,CAAC,kBAAkB,mCAAI,EAAE,CAAC;KACvC,CAAC,CAAC;IACH,cAAc,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAErC,IAAI,eAAe,CAAC,IAAI,KAAK,CAAC,IAAI,aAAa,CAAC,IAAI,KAAK,CAAC,EAAE;QACxD,MAAM,IAAI,KAAK,CACX,uDAAuD,CAC1D,CAAC;KACL;IAED,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;AACpE,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IChannelFactory } from \"@fluidframework/datastore-definitions\";\nimport { NamedFluidDataStoreRegistryEntry } from \"@fluidframework/runtime-definitions\";\nimport {\n ContainerSchema,\n DataObjectClass,\n LoadableObjectClass,\n SharedObjectClass,\n} from \"./types\";\n\n/**\n * Runtime check to determine if a class is a DataObject type\n */\nexport const isDataObjectClass = (obj: any): obj is DataObjectClass<any> => {\n return obj?.factory !== undefined;\n};\n\n/**\n * Runtime check to determine if a class is a SharedObject type\n */\nexport const isSharedObjectClass = (\n obj: any,\n): obj is SharedObjectClass<any> => {\n return obj?.getFactory !== undefined;\n};\n\n/**\n * The ContainerSchema consists of initialObjects and dynamicObjectTypes. These types can be\n * of both SharedObject or DataObject. This function seperates the two and returns a registery\n * of DataObject types and an array of SharedObjects.\n */\nexport const parseDataObjectsFromSharedObjects = (\n schema: ContainerSchema,\n): [NamedFluidDataStoreRegistryEntry[], IChannelFactory[]] => {\n const registryEntries: Set<NamedFluidDataStoreRegistryEntry> = new Set();\n const sharedObjects: Set<IChannelFactory> = new Set();\n\n const tryAddObject = (obj: LoadableObjectClass<any>) => {\n if (isSharedObjectClass(obj)) {\n sharedObjects.add(obj.getFactory());\n } else if (isDataObjectClass(obj)) {\n registryEntries.add([\n obj.factory.type,\n Promise.resolve(obj.factory),\n ]);\n } else {\n throw new Error(`Entry is neither a DataObject or a SharedObject`);\n }\n };\n\n // Add the object types that will be initialized\n const dedupedObjects = new Set([\n ...Object.values(schema.initialObjects),\n ...(schema.dynamicObjectTypes ?? []),\n ]);\n dedupedObjects.forEach(tryAddObject);\n\n if (registryEntries.size === 0 && sharedObjects.size === 0) {\n throw new Error(\n \"Container cannot be initialized without any DataTypes\",\n );\n }\n\n return [Array.from(registryEntries), Array.from(sharedObjects)];\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/fluid-static",
|
|
3
|
-
"version": "2.0.0-internal.1.0.
|
|
3
|
+
"version": "2.0.0-internal.1.0.1",
|
|
4
4
|
"description": "A tool to enable consumption of Fluid Data Objects without requiring custom container code.",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -29,38 +29,47 @@
|
|
|
29
29
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
30
30
|
"lint": "npm run eslint",
|
|
31
31
|
"lint:fix": "npm run eslint:fix",
|
|
32
|
+
"test": "npm run test:mocha",
|
|
33
|
+
"test:coverage": "nyc npm test -- --reporter xunit --reporter-option output=nyc/junit-report.xml",
|
|
34
|
+
"test:mocha": "mocha --recursive dist/test/**/*.spec.js -r node_modules/@fluidframework/mocha-test-setup --unhandled-rejections=strict",
|
|
35
|
+
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
32
36
|
"tsc": "tsc",
|
|
33
37
|
"tsfmt": "tsfmt --verify",
|
|
34
38
|
"tsfmt:fix": "tsfmt --replace",
|
|
35
39
|
"typetests:gen": "fluid-type-validator -g -d ."
|
|
36
40
|
},
|
|
37
41
|
"dependencies": {
|
|
38
|
-
"@fluidframework/aqueduct": "2.0.0-internal.1.0.
|
|
42
|
+
"@fluidframework/aqueduct": "^2.0.0-internal.1.0.1",
|
|
39
43
|
"@fluidframework/common-definitions": "^0.20.1",
|
|
40
|
-
"@fluidframework/common-utils": "^0.
|
|
41
|
-
"@fluidframework/container-definitions": "2.0.0-internal.1.0.
|
|
42
|
-
"@fluidframework/container-loader": "2.0.0-internal.1.0.
|
|
43
|
-
"@fluidframework/container-runtime-definitions": "2.0.0-internal.1.0.
|
|
44
|
-
"@fluidframework/core-interfaces": "2.0.0-internal.1.0.
|
|
45
|
-
"@fluidframework/datastore-definitions": "2.0.0-internal.1.0.
|
|
46
|
-
"@fluidframework/protocol-definitions": "^0.
|
|
47
|
-
"@fluidframework/request-handler": "2.0.0-internal.1.0.
|
|
48
|
-
"@fluidframework/runtime-definitions": "2.0.0-internal.1.0.
|
|
49
|
-
"@fluidframework/runtime-utils": "2.0.0-internal.1.0.
|
|
44
|
+
"@fluidframework/common-utils": "^1.0.0",
|
|
45
|
+
"@fluidframework/container-definitions": "^2.0.0-internal.1.0.1",
|
|
46
|
+
"@fluidframework/container-loader": "^2.0.0-internal.1.0.1",
|
|
47
|
+
"@fluidframework/container-runtime-definitions": "^2.0.0-internal.1.0.1",
|
|
48
|
+
"@fluidframework/core-interfaces": "^2.0.0-internal.1.0.1",
|
|
49
|
+
"@fluidframework/datastore-definitions": "^2.0.0-internal.1.0.1",
|
|
50
|
+
"@fluidframework/protocol-definitions": "^1.0.0",
|
|
51
|
+
"@fluidframework/request-handler": "^2.0.0-internal.1.0.1",
|
|
52
|
+
"@fluidframework/runtime-definitions": "^2.0.0-internal.1.0.1",
|
|
53
|
+
"@fluidframework/runtime-utils": "^2.0.0-internal.1.0.1"
|
|
50
54
|
},
|
|
51
55
|
"devDependencies": {
|
|
52
|
-
"@fluid-experimental/get-container": "2.0.0-internal.1.0.
|
|
56
|
+
"@fluid-experimental/get-container": "^2.0.0-internal.1.0.1",
|
|
53
57
|
"@fluidframework/build-common": "^0.24.0",
|
|
54
|
-
"@fluidframework/build-tools": "^0.3.
|
|
58
|
+
"@fluidframework/build-tools": "^0.3.1000",
|
|
55
59
|
"@fluidframework/eslint-config-fluid": "^0.28.2000",
|
|
56
60
|
"@fluidframework/fluid-static-previous": "npm:@fluidframework/fluid-static@^1.0.0",
|
|
61
|
+
"@fluidframework/map": "^2.0.0-internal.1.0.1",
|
|
62
|
+
"@fluidframework/mocha-test-setup": "^2.0.0-internal.1.0.1",
|
|
63
|
+
"@fluidframework/sequence": "^2.0.0-internal.1.0.1",
|
|
57
64
|
"@microsoft/api-extractor": "^7.22.2",
|
|
58
65
|
"@rushstack/eslint-config": "^2.5.1",
|
|
66
|
+
"@types/mocha": "^9.1.1",
|
|
59
67
|
"@types/node": "^14.18.0",
|
|
60
68
|
"concurrently": "^6.2.0",
|
|
61
69
|
"copyfiles": "^2.1.0",
|
|
62
70
|
"cross-env": "^7.0.2",
|
|
63
71
|
"eslint": "~8.6.0",
|
|
72
|
+
"mocha": "^10.0.0",
|
|
64
73
|
"rimraf": "^2.6.2",
|
|
65
74
|
"typescript": "~4.5.5",
|
|
66
75
|
"typescript-formatter": "7.1.0"
|
package/src/utils.ts
CHANGED
|
@@ -22,7 +22,9 @@ export const isDataObjectClass = (obj: any): obj is DataObjectClass<any> => {
|
|
|
22
22
|
/**
|
|
23
23
|
* Runtime check to determine if a class is a SharedObject type
|
|
24
24
|
*/
|
|
25
|
-
export const isSharedObjectClass = (
|
|
25
|
+
export const isSharedObjectClass = (
|
|
26
|
+
obj: any,
|
|
27
|
+
): obj is SharedObjectClass<any> => {
|
|
26
28
|
return obj?.getFactory !== undefined;
|
|
27
29
|
};
|
|
28
30
|
|
|
@@ -31,8 +33,9 @@ export const isSharedObjectClass = (obj: any): obj is SharedObjectClass<any> =>
|
|
|
31
33
|
* of both SharedObject or DataObject. This function seperates the two and returns a registery
|
|
32
34
|
* of DataObject types and an array of SharedObjects.
|
|
33
35
|
*/
|
|
34
|
-
export const parseDataObjectsFromSharedObjects = (
|
|
35
|
-
|
|
36
|
+
export const parseDataObjectsFromSharedObjects = (
|
|
37
|
+
schema: ContainerSchema,
|
|
38
|
+
): [NamedFluidDataStoreRegistryEntry[], IChannelFactory[]] => {
|
|
36
39
|
const registryEntries: Set<NamedFluidDataStoreRegistryEntry> = new Set();
|
|
37
40
|
const sharedObjects: Set<IChannelFactory> = new Set();
|
|
38
41
|
|
|
@@ -40,26 +43,26 @@ export const parseDataObjectsFromSharedObjects = (schema: ContainerSchema):
|
|
|
40
43
|
if (isSharedObjectClass(obj)) {
|
|
41
44
|
sharedObjects.add(obj.getFactory());
|
|
42
45
|
} else if (isDataObjectClass(obj)) {
|
|
43
|
-
registryEntries.add([
|
|
46
|
+
registryEntries.add([
|
|
47
|
+
obj.factory.type,
|
|
48
|
+
Promise.resolve(obj.factory),
|
|
49
|
+
]);
|
|
44
50
|
} else {
|
|
45
51
|
throw new Error(`Entry is neither a DataObject or a SharedObject`);
|
|
46
52
|
}
|
|
47
53
|
};
|
|
48
54
|
|
|
49
55
|
// Add the object types that will be initialized
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (schema.dynamicObjectTypes) {
|
|
56
|
-
for (const obj of schema.dynamicObjectTypes) {
|
|
57
|
-
tryAddObject(obj);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
56
|
+
const dedupedObjects = new Set([
|
|
57
|
+
...Object.values(schema.initialObjects),
|
|
58
|
+
...(schema.dynamicObjectTypes ?? []),
|
|
59
|
+
]);
|
|
60
|
+
dedupedObjects.forEach(tryAddObject);
|
|
60
61
|
|
|
61
62
|
if (registryEntries.size === 0 && sharedObjects.size === 0) {
|
|
62
|
-
throw new Error(
|
|
63
|
+
throw new Error(
|
|
64
|
+
"Container cannot be initialized without any DataTypes",
|
|
65
|
+
);
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
return [Array.from(registryEntries), Array.from(sharedObjects)];
|