@fluidframework/fluid-static 2.0.0-dev-rc.1.0.0.232845 → 2.0.0-dev-rc.2.0.0.245554

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 (88) hide show
  1. package/{.mocharc.js → .mocharc.cjs} +1 -1
  2. package/CHANGELOG.md +10 -0
  3. package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -1
  4. package/api-extractor.json +1 -1
  5. package/api-report/fluid-static.api.md +7 -7
  6. package/dist/fluid-static-alpha.d.ts +18 -9
  7. package/dist/fluid-static-beta.d.ts +18 -9
  8. package/dist/fluid-static-public.d.ts +18 -9
  9. package/dist/fluid-static-untrimmed.d.ts +18 -9
  10. package/dist/fluidContainer.d.ts +1 -1
  11. package/dist/fluidContainer.d.ts.map +1 -1
  12. package/dist/fluidContainer.js.map +1 -1
  13. package/dist/index.d.ts +4 -4
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +6 -6
  16. package/dist/index.js.map +1 -1
  17. package/dist/package.json +3 -0
  18. package/dist/rootDataObject.d.ts +1 -1
  19. package/dist/rootDataObject.d.ts.map +1 -1
  20. package/dist/rootDataObject.js +5 -5
  21. package/dist/rootDataObject.js.map +1 -1
  22. package/dist/serviceAudience.d.ts +1 -1
  23. package/dist/serviceAudience.d.ts.map +1 -1
  24. package/dist/serviceAudience.js.map +1 -1
  25. package/dist/tsdoc-metadata.json +1 -1
  26. package/dist/types.d.ts +18 -9
  27. package/dist/types.d.ts.map +1 -1
  28. package/dist/types.js.map +1 -1
  29. package/dist/utils.d.ts +9 -5
  30. package/dist/utils.d.ts.map +1 -1
  31. package/dist/utils.js +5 -5
  32. package/dist/utils.js.map +1 -1
  33. package/lib/{fluid-static-alpha.d.mts → fluid-static-alpha.d.ts} +24 -9
  34. package/lib/{fluid-static-public.d.mts → fluid-static-beta.d.ts} +24 -9
  35. package/lib/{fluid-static-beta.d.mts → fluid-static-public.d.ts} +24 -9
  36. package/lib/{fluid-static-untrimmed.d.mts → fluid-static-untrimmed.d.ts} +24 -9
  37. package/lib/{fluidContainer.d.mts → fluidContainer.d.ts} +2 -2
  38. package/lib/fluidContainer.d.ts.map +1 -0
  39. package/lib/{fluidContainer.mjs → fluidContainer.js} +5 -1
  40. package/lib/fluidContainer.js.map +1 -0
  41. package/lib/{index.d.mts → index.d.ts} +10 -5
  42. package/lib/index.d.ts.map +1 -0
  43. package/lib/index.js +13 -0
  44. package/lib/index.js.map +1 -0
  45. package/lib/{rootDataObject.d.mts → rootDataObject.d.ts} +2 -2
  46. package/lib/rootDataObject.d.ts.map +1 -0
  47. package/lib/{rootDataObject.mjs → rootDataObject.js} +7 -3
  48. package/lib/rootDataObject.js.map +1 -0
  49. package/lib/{serviceAudience.d.mts → serviceAudience.d.ts} +2 -2
  50. package/lib/serviceAudience.d.ts.map +1 -0
  51. package/lib/{serviceAudience.mjs → serviceAudience.js} +1 -1
  52. package/lib/serviceAudience.js.map +1 -0
  53. package/lib/test/fluidContainer.spec.js +21 -0
  54. package/lib/test/fluidContainer.spec.js.map +1 -0
  55. package/lib/test/types/validateFluidStaticPrevious.generated.js +46 -0
  56. package/lib/test/types/validateFluidStaticPrevious.generated.js.map +1 -0
  57. package/lib/test/utils.spec.js +86 -0
  58. package/lib/test/utils.spec.js.map +1 -0
  59. package/lib/{types.d.mts → types.d.ts} +19 -10
  60. package/lib/types.d.ts.map +1 -0
  61. package/lib/{types.mjs → types.js} +1 -1
  62. package/lib/types.js.map +1 -0
  63. package/lib/{utils.d.mts → utils.d.ts} +10 -6
  64. package/lib/utils.d.ts.map +1 -0
  65. package/lib/{utils.mjs → utils.js} +5 -5
  66. package/lib/utils.js.map +1 -0
  67. package/package.json +45 -58
  68. package/src/fluidContainer.ts +2 -2
  69. package/src/index.ts +4 -4
  70. package/src/rootDataObject.ts +3 -3
  71. package/src/serviceAudience.ts +1 -1
  72. package/src/types.ts +20 -13
  73. package/src/utils.ts +23 -6
  74. package/tsconfig.cjs.json +7 -0
  75. package/tsconfig.json +4 -8
  76. package/lib/fluidContainer.d.mts.map +0 -1
  77. package/lib/fluidContainer.mjs.map +0 -1
  78. package/lib/index.d.mts.map +0 -1
  79. package/lib/index.mjs +0 -8
  80. package/lib/index.mjs.map +0 -1
  81. package/lib/rootDataObject.d.mts.map +0 -1
  82. package/lib/rootDataObject.mjs.map +0 -1
  83. package/lib/serviceAudience.d.mts.map +0 -1
  84. package/lib/serviceAudience.mjs.map +0 -1
  85. package/lib/types.d.mts.map +0 -1
  86. package/lib/types.mjs.map +0 -1
  87. package/lib/utils.d.mts.map +0 -1
  88. package/lib/utils.mjs.map +0 -1
@@ -5,26 +5,30 @@
5
5
  import { type IChannelFactory } from "@fluidframework/datastore-definitions";
6
6
  import { type IFluidDataStoreFactory, type NamedFluidDataStoreRegistryEntry } from "@fluidframework/runtime-definitions";
7
7
  import { type IFluidLoadable } from "@fluidframework/core-interfaces";
8
- import { type ContainerSchema, type DataObjectClass, type SharedObjectClass } from "./types.mjs";
8
+ import { type ContainerSchema, type DataObjectClass, type LoadableObjectClass, type SharedObjectClass } from "./types.js";
9
9
  /**
10
10
  * An internal type used by the internal type guard isDataObjectClass to cast a
11
11
  * DataObjectClass to a type that is strongly coupled to IFluidDataStoreFactory.
12
- * Unlike the external and exported type DataObjectClass which is
12
+ * Unlike the external and exported type DataObjectClass which is
13
13
  * weakly coupled to the IFluidDataStoreFactory to prevent leaking internals.
14
14
  */
15
15
  export type InternalDataObjectClass<T extends IFluidLoadable> = DataObjectClass<T> & Record<"factory", IFluidDataStoreFactory>;
16
16
  /**
17
- * Runtime check to determine if a class is a DataObject type
17
+ * Runtime check to determine if a class is a DataObject type.
18
18
  */
19
- export declare const isDataObjectClass: (obj: unknown) => obj is InternalDataObjectClass<IFluidLoadable>;
19
+ export declare function isDataObjectClass<T extends IFluidLoadable>(obj: LoadableObjectClass<T>): obj is InternalDataObjectClass<T>;
20
+ /**
21
+ * Runtime check to determine if a class is a DataObject type.
22
+ */
23
+ export declare function isDataObjectClass(obj: unknown): obj is InternalDataObjectClass<IFluidLoadable>;
20
24
  /**
21
25
  * Runtime check to determine if a class is a SharedObject type
22
26
  */
23
27
  export declare const isSharedObjectClass: (obj: unknown) => obj is SharedObjectClass<IFluidLoadable>;
24
28
  /**
25
29
  * The ContainerSchema consists of initialObjects and dynamicObjectTypes. These types can be
26
- * of both SharedObject or DataObject. This function seperates the two and returns a registery
30
+ * of both SharedObject or DataObject. This function separates the two and returns a registry
27
31
  * of DataObject types and an array of SharedObjects.
28
32
  */
29
33
  export declare const parseDataObjectsFromSharedObjects: (schema: ContainerSchema) => [NamedFluidDataStoreRegistryEntry[], IChannelFactory[]];
30
- //# sourceMappingURL=utils.d.mts.map
34
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EACN,KAAK,sBAAsB,EAC3B,KAAK,gCAAgC,EACrC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,MAAM,YAAY,CAAC;AAEpB;;;;;GAKG;AACH,MAAM,MAAM,uBAAuB,CAAC,CAAC,SAAS,cAAc,IAAI,eAAe,CAAC,CAAC,CAAC,GACjF,MAAM,CAAC,SAAS,EAAE,sBAAsB,CAAC,CAAC;AAE3C;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,cAAc,EACzD,GAAG,EAAE,mBAAmB,CAAC,CAAC,CAAC,GACzB,GAAG,IAAI,uBAAuB,CAAC,CAAC,CAAC,CAAC;AAErC;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,uBAAuB,CAAC,cAAc,CAAC,CAAC;AAahG;;GAEG;AACH,eAAO,MAAM,mBAAmB,QAAS,OAAO,6CAG/C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,WACrC,eAAe,KACrB,CAAC,gCAAgC,EAAE,EAAE,eAAe,EAAE,CA4BxD,CAAC"}
@@ -3,13 +3,13 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  /**
6
- * Runtime check to determine if a class is a DataObject type
6
+ * Runtime check to determine if a class is a DataObject type.
7
7
  */
8
- export const isDataObjectClass = (obj) => {
8
+ export function isDataObjectClass(obj) {
9
9
  const maybe = obj;
10
10
  return (maybe?.factory?.IFluidDataStoreFactory !== undefined &&
11
11
  maybe?.factory?.IFluidDataStoreFactory === maybe?.factory);
12
- };
12
+ }
13
13
  /**
14
14
  * Runtime check to determine if a class is a SharedObject type
15
15
  */
@@ -19,7 +19,7 @@ export const isSharedObjectClass = (obj) => {
19
19
  };
20
20
  /**
21
21
  * The ContainerSchema consists of initialObjects and dynamicObjectTypes. These types can be
22
- * of both SharedObject or DataObject. This function seperates the two and returns a registery
22
+ * of both SharedObject or DataObject. This function separates the two and returns a registry
23
23
  * of DataObject types and an array of SharedObjects.
24
24
  */
25
25
  export const parseDataObjectsFromSharedObjects = (schema) => {
@@ -49,4 +49,4 @@ export const parseDataObjectsFromSharedObjects = (schema) => {
49
49
  }
50
50
  return [[...registryEntries], [...sharedObjects]];
51
51
  };
52
- //# sourceMappingURL=utils.mjs.map
52
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAoCH;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAY;IAC7C,MAAM,KAAK,GAAG,GAAmE,CAAC;IAClF,OAAO,CACN,KAAK,EAAE,OAAO,EAAE,sBAAsB,KA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AAK,CAAC,EAAE;QAC3D,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;KACzE;IAED,OAAO,CAAC,CAAC,GAAG,eAAe,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC;AACnD,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type IChannelFactory } from \"@fluidframework/datastore-definitions\";\nimport {\n\ttype IFluidDataStoreFactory,\n\ttype NamedFluidDataStoreRegistryEntry,\n} from \"@fluidframework/runtime-definitions\";\nimport { type IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport {\n\ttype ContainerSchema,\n\ttype DataObjectClass,\n\ttype LoadableObjectClass,\n\ttype SharedObjectClass,\n} from \"./types.js\";\n\n/**\n * An internal type used by the internal type guard isDataObjectClass to cast a\n * DataObjectClass to a type that is strongly coupled to IFluidDataStoreFactory.\n * Unlike the external and exported type DataObjectClass which is\n * weakly coupled to the IFluidDataStoreFactory to prevent leaking internals.\n */\nexport type InternalDataObjectClass<T extends IFluidLoadable> = DataObjectClass<T> &\n\tRecord<\"factory\", IFluidDataStoreFactory>;\n\n/**\n * Runtime check to determine if a class is a DataObject type.\n */\nexport function isDataObjectClass<T extends IFluidLoadable>(\n\tobj: LoadableObjectClass<T>,\n): obj is InternalDataObjectClass<T>;\n\n/**\n * Runtime check to determine if a class is a DataObject type.\n */\nexport function isDataObjectClass(obj: unknown): obj is InternalDataObjectClass<IFluidLoadable>;\n\n/**\n * Runtime check to determine if a class is a DataObject type.\n */\nexport function isDataObjectClass(obj: unknown): obj is InternalDataObjectClass<IFluidLoadable> {\n\tconst maybe = obj as Partial<InternalDataObjectClass<IFluidLoadable>> | undefined;\n\treturn (\n\t\tmaybe?.factory?.IFluidDataStoreFactory !== undefined &&\n\t\tmaybe?.factory?.IFluidDataStoreFactory === maybe?.factory\n\t);\n}\n\n/**\n * Runtime check to determine if a class is a SharedObject type\n */\nexport const isSharedObjectClass = (obj: unknown): obj is SharedObjectClass<IFluidLoadable> => {\n\tconst maybe = obj as Partial<SharedObjectClass<IFluidLoadable>> | undefined;\n\treturn maybe?.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 separates the two and returns a registry\n * of DataObject types and an array of SharedObjects.\n */\nexport const parseDataObjectsFromSharedObjects = (\n\tschema: ContainerSchema,\n): [NamedFluidDataStoreRegistryEntry[], IChannelFactory[]] => {\n\tconst registryEntries = new Set<NamedFluidDataStoreRegistryEntry>();\n\tconst sharedObjects = new Set<IChannelFactory>();\n\n\tconst tryAddObject = (obj: unknown): void => {\n\t\tif (isSharedObjectClass(obj)) {\n\t\t\tsharedObjects.add(obj.getFactory());\n\t\t} else if (isDataObjectClass(obj)) {\n\t\t\tregistryEntries.add([obj.factory.type, Promise.resolve(obj.factory)]);\n\t\t} else {\n\t\t\tthrow new Error(`Entry is neither a DataObject or a SharedObject`);\n\t\t}\n\t};\n\n\t// Add the object types that will be initialized\n\tconst dedupedObjects = new Set([\n\t\t...Object.values(schema.initialObjects),\n\t\t...(schema.dynamicObjectTypes ?? []),\n\t]);\n\tfor (const obj of dedupedObjects) {\n\t\ttryAddObject(obj);\n\t}\n\n\tif (registryEntries.size === 0 && sharedObjects.size === 0) {\n\t\tthrow new Error(\"Container cannot be initialized without any DataTypes\");\n\t}\n\n\treturn [[...registryEntries], [...sharedObjects]];\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/fluid-static",
3
- "version": "2.0.0-dev-rc.1.0.0.232845",
3
+ "version": "2.0.0-dev-rc.2.0.0.245554",
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": {
@@ -11,60 +11,40 @@
11
11
  "license": "MIT",
12
12
  "author": "Microsoft and contributors",
13
13
  "sideEffects": false,
14
+ "type": "module",
14
15
  "exports": {
15
16
  ".": {
16
17
  "import": {
17
- "types": "./lib/index.d.mts",
18
- "default": "./lib/index.mjs"
18
+ "types": "./lib/index.d.ts",
19
+ "default": "./lib/index.js"
19
20
  },
20
21
  "require": {
21
22
  "types": "./dist/index.d.ts",
22
23
  "default": "./dist/index.js"
23
24
  }
24
25
  },
25
- "./alpha": {
26
- "import": {
27
- "types": "./lib/fluid-static-alpha.d.mts",
28
- "default": "./lib/index.mjs"
29
- },
30
- "require": {
31
- "types": "./dist/fluid-static-alpha.d.ts",
32
- "default": "./dist/index.js"
33
- }
34
- },
35
- "./beta": {
26
+ "./public": {
36
27
  "import": {
37
- "types": "./lib/fluid-static-beta.d.mts",
38
- "default": "./lib/index.mjs"
28
+ "types": "./lib/fluid-static-public.d.ts",
29
+ "default": "./lib/index.js"
39
30
  },
40
31
  "require": {
41
- "types": "./dist/fluid-static-beta.d.ts",
32
+ "types": "./dist/fluid-static-public.d.ts",
42
33
  "default": "./dist/index.js"
43
34
  }
44
35
  },
45
36
  "./internal": {
46
37
  "import": {
47
- "types": "./lib/index.d.mts",
48
- "default": "./lib/index.mjs"
38
+ "types": "./lib/index.d.ts",
39
+ "default": "./lib/index.js"
49
40
  },
50
41
  "require": {
51
42
  "types": "./dist/index.d.ts",
52
43
  "default": "./dist/index.js"
53
44
  }
54
- },
55
- "./public": {
56
- "import": {
57
- "types": "./lib/fluid-static-public.d.mts",
58
- "default": "./lib/index.mjs"
59
- },
60
- "require": {
61
- "types": "./dist/fluid-static-public.d.ts",
62
- "default": "./dist/index.js"
63
- }
64
45
  }
65
46
  },
66
47
  "main": "dist/index.js",
67
- "module": "lib/index.mjs",
68
48
  "types": "dist/index.d.ts",
69
49
  "c8": {
70
50
  "all": true,
@@ -87,43 +67,42 @@
87
67
  "temp-directory": "nyc/.nyc_output"
88
68
  },
89
69
  "dependencies": {
90
- "@fluid-internal/client-utils": "2.0.0-dev-rc.1.0.0.232845",
91
- "@fluidframework/aqueduct": "2.0.0-dev-rc.1.0.0.232845",
92
- "@fluidframework/container-definitions": "2.0.0-dev-rc.1.0.0.232845",
93
- "@fluidframework/container-loader": "2.0.0-dev-rc.1.0.0.232845",
94
- "@fluidframework/container-runtime": "2.0.0-dev-rc.1.0.0.232845",
95
- "@fluidframework/container-runtime-definitions": "2.0.0-dev-rc.1.0.0.232845",
96
- "@fluidframework/core-interfaces": "2.0.0-dev-rc.1.0.0.232845",
97
- "@fluidframework/datastore-definitions": "2.0.0-dev-rc.1.0.0.232845",
98
- "@fluidframework/protocol-definitions": "^3.2.0-231454",
99
- "@fluidframework/request-handler": "2.0.0-dev-rc.1.0.0.232845",
100
- "@fluidframework/runtime-definitions": "2.0.0-dev-rc.1.0.0.232845",
101
- "@fluidframework/runtime-utils": "2.0.0-dev-rc.1.0.0.232845"
70
+ "@fluid-internal/client-utils": "2.0.0-dev-rc.2.0.0.245554",
71
+ "@fluidframework/aqueduct": "2.0.0-dev-rc.2.0.0.245554",
72
+ "@fluidframework/container-definitions": "2.0.0-dev-rc.2.0.0.245554",
73
+ "@fluidframework/container-loader": "2.0.0-dev-rc.2.0.0.245554",
74
+ "@fluidframework/container-runtime": "2.0.0-dev-rc.2.0.0.245554",
75
+ "@fluidframework/container-runtime-definitions": "2.0.0-dev-rc.2.0.0.245554",
76
+ "@fluidframework/core-interfaces": "2.0.0-dev-rc.2.0.0.245554",
77
+ "@fluidframework/datastore-definitions": "2.0.0-dev-rc.2.0.0.245554",
78
+ "@fluidframework/protocol-definitions": "^3.2.0",
79
+ "@fluidframework/request-handler": "2.0.0-dev-rc.2.0.0.245554",
80
+ "@fluidframework/runtime-definitions": "2.0.0-dev-rc.2.0.0.245554",
81
+ "@fluidframework/runtime-utils": "2.0.0-dev-rc.2.0.0.245554"
102
82
  },
103
83
  "devDependencies": {
104
84
  "@arethetypeswrong/cli": "^0.13.3",
105
- "@fluid-tools/build-cli": "^0.29.0",
85
+ "@fluid-internal/mocha-test-setup": "2.0.0-dev-rc.2.0.0.245554",
86
+ "@fluid-tools/build-cli": "^0.34.0",
106
87
  "@fluidframework/build-common": "^2.0.3",
107
- "@fluidframework/build-tools": "^0.29.0",
108
- "@fluidframework/eslint-config-fluid": "^3.3.0",
88
+ "@fluidframework/build-tools": "^0.34.0",
89
+ "@fluidframework/eslint-config-fluid": "^5.1.0",
109
90
  "@fluidframework/fluid-static-previous": "npm:@fluidframework/fluid-static@2.0.0-internal.8.0.0",
110
- "@fluidframework/map": "2.0.0-dev-rc.1.0.0.232845",
111
- "@fluidframework/mocha-test-setup": "2.0.0-dev-rc.1.0.0.232845",
112
- "@fluidframework/sequence": "2.0.0-dev-rc.1.0.0.232845",
113
- "@microsoft/api-extractor": "^7.39.1",
91
+ "@fluidframework/map": "2.0.0-dev-rc.2.0.0.245554",
92
+ "@fluidframework/sequence": "2.0.0-dev-rc.2.0.0.245554",
93
+ "@microsoft/api-extractor": "^7.42.3",
114
94
  "@types/mocha": "^9.1.1",
115
95
  "@types/node": "^18.19.0",
116
96
  "c8": "^8.0.1",
117
97
  "copyfiles": "^2.4.1",
118
98
  "cross-env": "^7.0.3",
119
- "eslint": "~8.50.0",
99
+ "eslint": "~8.55.0",
120
100
  "mocha": "^10.2.0",
121
101
  "mocha-json-output-reporter": "^2.0.1",
122
102
  "mocha-multi-reporters": "^1.5.1",
123
103
  "moment": "^2.21.0",
124
104
  "prettier": "~3.0.3",
125
105
  "rimraf": "^4.4.0",
126
- "tsc-multi": "^1.1.0",
127
106
  "typescript": "~5.1.6"
128
107
  },
129
108
  "fluidBuild": {
@@ -139,18 +118,24 @@
139
118
  }
140
119
  },
141
120
  "typeValidation": {
142
- "broken": {}
121
+ "broken": {
122
+ "InterfaceDeclaration_ContainerSchema": {
123
+ "backCompat": false
124
+ }
125
+ }
143
126
  },
144
127
  "scripts": {
145
128
  "api": "fluid-build . --task api",
146
- "api-extractor:commonjs": "api-extractor run --local",
147
- "api-extractor:esnext": "api-extractor run --config ./api-extractor-esm.json",
129
+ "api-extractor:commonjs": "api-extractor run --config ./api-extractor-cjs.json",
130
+ "api-extractor:esnext": "api-extractor run --local",
148
131
  "build": "fluid-build . --task build",
149
132
  "build:commonjs": "fluid-build . --task commonjs",
150
133
  "build:compile": "fluid-build . --task compile",
151
134
  "build:docs": "fluid-build . --task api",
152
- "build:esnext": "tsc-multi --config ../../../common/build/build-common/tsc-multi.esm.json",
153
- "build:test": "tsc --project ./src/test/tsconfig.json",
135
+ "build:esnext": "tsc --project ./tsconfig.json",
136
+ "build:test": "npm run build:test:esm && npm run build:test:cjs",
137
+ "build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
138
+ "build:test:esm": "tsc --project ./src/test/tsconfig.json",
154
139
  "check:are-the-types-wrong": "attw --pack . --entrypoints .",
155
140
  "check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
156
141
  "ci:build:docs": "api-extractor run",
@@ -164,9 +149,11 @@
164
149
  "prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
165
150
  "test": "npm run test:mocha",
166
151
  "test:coverage": "c8 npm test",
167
- "test:mocha": "mocha --recursive \"dist/test/**/*.spec.*js\" -r node_modules/@fluidframework/mocha-test-setup",
152
+ "test:mocha": "npm run test:mocha:esm && echo skipping cjs to avoid overhead - npm run test:mocha:cjs",
153
+ "test:mocha:cjs": "mocha --recursive \"dist/test/**/*.spec.*js\" --exit -r node_modules/@fluid-internal/mocha-test-setup",
154
+ "test:mocha:esm": "mocha --recursive \"lib/test/**/*.spec.*js\" --exit -r node_modules/@fluid-internal/mocha-test-setup",
168
155
  "test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
169
- "tsc": "tsc",
156
+ "tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
170
157
  "typetests:gen": "fluid-type-test-generator",
171
158
  "typetests:prepare": "flub typetests --dir . --reset --previous --normalize"
172
159
  }
@@ -19,7 +19,7 @@ import type {
19
19
  ContainerAttachProps,
20
20
  IRootDataObject,
21
21
  LoadableObjectClass,
22
- } from "./types";
22
+ } from "./types.js";
23
23
 
24
24
  /**
25
25
  * Extract the type of 'initialObjects' from the given {@link ContainerSchema} type.
@@ -27,7 +27,7 @@ import type {
27
27
  */
28
28
  export type InitialObjects<T extends ContainerSchema> = {
29
29
  // Construct a LoadableObjectRecord type by enumerating the keys of
30
- // 'ContainerSchema.initialObjects' and infering the value type of each key.
30
+ // 'ContainerSchema.initialObjects' and inferring the value type of each key.
31
31
  //
32
32
  // The '? TChannel : never' is required because infer can only be used in
33
33
  // a conditional 'extends' expression.
package/src/index.ts CHANGED
@@ -14,9 +14,9 @@ export {
14
14
  type IFluidContainer,
15
15
  type IFluidContainerEvents,
16
16
  type InitialObjects,
17
- } from "./fluidContainer";
18
- export { createDOProviderContainerRuntimeFactory } from "./rootDataObject";
19
- export { createServiceAudience } from "./serviceAudience";
17
+ } from "./fluidContainer.js";
18
+ export { createDOProviderContainerRuntimeFactory } from "./rootDataObject.js";
19
+ export { createServiceAudience } from "./serviceAudience.js";
20
20
  export {
21
21
  type ContainerSchema,
22
22
  type ContainerAttachProps,
@@ -34,4 +34,4 @@ export {
34
34
  type Myself,
35
35
  type SharedObjectClass,
36
36
  type IProvideRootDataObject,
37
- } from "./types";
37
+ } from "./types.js";
@@ -27,13 +27,13 @@ import {
27
27
  type LoadableObjectClassRecord,
28
28
  type LoadableObjectRecord,
29
29
  type SharedObjectClass,
30
- } from "./types";
30
+ } from "./types.js";
31
31
  import {
32
32
  type InternalDataObjectClass,
33
33
  isDataObjectClass,
34
34
  isSharedObjectClass,
35
35
  parseDataObjectsFromSharedObjects,
36
- } from "./utils";
36
+ } from "./utils.js";
37
37
 
38
38
  /**
39
39
  * Input props for {@link RootDataObject.initializingFirstTime}.
@@ -231,7 +231,7 @@ class DOProviderContainerRuntimeFactory extends BaseContainerRuntimeFactory {
231
231
  // resolution progress is tracked by the Feature 465 work item in AzDO
232
232
  flushMode: FlushMode.Immediate,
233
233
  // The runtime compressor is required to be on to use @fluidframework/tree.
234
- enableRuntimeIdCompressor: true,
234
+ enableRuntimeIdCompressor: "on",
235
235
  },
236
236
  provideEntryPoint,
237
237
  });
@@ -11,7 +11,7 @@ import {
11
11
  type IServiceAudienceEvents,
12
12
  type IMember,
13
13
  type Myself,
14
- } from "./types";
14
+ } from "./types.js";
15
15
 
16
16
  /**
17
17
  * Creates a service audience for the provided container.
package/src/types.ts CHANGED
@@ -21,18 +21,24 @@ export type LoadableObjectRecord = Record<string, IFluidLoadable>;
21
21
  * or `SharedObject`.
22
22
  * @public
23
23
  */
24
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
- export type LoadableObjectClassRecord = Record<string, LoadableObjectClass<any>>;
24
+ export type LoadableObjectClassRecord = Record<string, LoadableObjectClass>;
26
25
 
27
26
  /**
28
27
  * A class object of `DataObject` or `SharedObject`.
29
28
  *
30
29
  * @typeParam T - The class of the `DataObject` or `SharedObject`.
31
30
  * @public
31
+ *
32
+ * @privateRemarks
33
+ * There are some edge cases in TypeScript where the order of the members in a union matter.
34
+ * Once such edge case is when multiple members of a generic union partially match, and the type parameter is being inferred.
35
+ * In this case, its better to have the desired match and/or the simpler type first.
36
+ * In this case placing SharedObjectClass fixed one usage and didn't break anything, and generally seems more likely to work than the reverse, so this is the order being used.
37
+ * This is likely (a bug in TypeScript)[https://github.com/microsoft/TypeScript/issues/45809].
32
38
  */
33
- export type LoadableObjectClass<T extends IFluidLoadable> =
34
- | DataObjectClass<T>
35
- | SharedObjectClass<T>;
39
+ export type LoadableObjectClass<T extends IFluidLoadable = IFluidLoadable> =
40
+ | SharedObjectClass<T>
41
+ | DataObjectClass<T>;
36
42
 
37
43
  /**
38
44
  * A class that has a factory that can create a `DataObject` and a
@@ -46,15 +52,17 @@ export type DataObjectClass<T extends IFluidLoadable> = {
46
52
  } & LoadableObjectCtor<T>;
47
53
 
48
54
  /**
49
- * A class that has a factory that can create a DDSes (`SharedObject`s) and a
50
- * constructor that will return the type of the `DataObject`.
55
+ * A factory that produces a factory that can create a DDSes (`SharedObject`s).
51
56
  *
52
57
  * @typeParam T - The class of the `SharedObject`.
53
58
  * @public
54
59
  */
55
- export type SharedObjectClass<T extends IFluidLoadable> = {
56
- readonly getFactory: () => IChannelFactory;
57
- } & LoadableObjectCtor<T>;
60
+ export interface SharedObjectClass<T extends IFluidLoadable> {
61
+ /**
62
+ * Gets the factory this factory is a wrapper for.
63
+ */
64
+ readonly getFactory: () => IChannelFactory<T>;
65
+ }
58
66
 
59
67
  /**
60
68
  * An object with a constructor that will return an {@link @fluidframework/core-interfaces#IFluidLoadable}.
@@ -99,7 +107,7 @@ export interface ContainerSchema {
99
107
  * }
100
108
  * ```
101
109
  */
102
- initialObjects: LoadableObjectClassRecord;
110
+ readonly initialObjects: LoadableObjectClassRecord;
103
111
 
104
112
  /**
105
113
  * Loadable objects that can be created after the initial {@link IFluidContainer | Container} creation.
@@ -111,8 +119,7 @@ export interface ContainerSchema {
111
119
  * For best practice it's recommended to define all the dynamic types you create even if they are
112
120
  * included via initialObjects.
113
121
  */
114
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
115
- dynamicObjectTypes?: LoadableObjectClass<any>[];
122
+ readonly dynamicObjectTypes?: readonly LoadableObjectClass[];
116
123
  }
117
124
 
118
125
  /**
package/src/utils.ts CHANGED
@@ -9,27 +9,44 @@ import {
9
9
  type NamedFluidDataStoreRegistryEntry,
10
10
  } from "@fluidframework/runtime-definitions";
11
11
  import { type IFluidLoadable } from "@fluidframework/core-interfaces";
12
- import { type ContainerSchema, type DataObjectClass, type SharedObjectClass } from "./types";
12
+ import {
13
+ type ContainerSchema,
14
+ type DataObjectClass,
15
+ type LoadableObjectClass,
16
+ type SharedObjectClass,
17
+ } from "./types.js";
13
18
 
14
19
  /**
15
20
  * An internal type used by the internal type guard isDataObjectClass to cast a
16
21
  * DataObjectClass to a type that is strongly coupled to IFluidDataStoreFactory.
17
- * Unlike the external and exported type DataObjectClass which is
22
+ * Unlike the external and exported type DataObjectClass which is
18
23
  * weakly coupled to the IFluidDataStoreFactory to prevent leaking internals.
19
24
  */
20
25
  export type InternalDataObjectClass<T extends IFluidLoadable> = DataObjectClass<T> &
21
26
  Record<"factory", IFluidDataStoreFactory>;
22
27
 
23
28
  /**
24
- * Runtime check to determine if a class is a DataObject type
29
+ * Runtime check to determine if a class is a DataObject type.
30
+ */
31
+ export function isDataObjectClass<T extends IFluidLoadable>(
32
+ obj: LoadableObjectClass<T>,
33
+ ): obj is InternalDataObjectClass<T>;
34
+
35
+ /**
36
+ * Runtime check to determine if a class is a DataObject type.
25
37
  */
26
- export const isDataObjectClass = (obj: unknown): obj is InternalDataObjectClass<IFluidLoadable> => {
38
+ export function isDataObjectClass(obj: unknown): obj is InternalDataObjectClass<IFluidLoadable>;
39
+
40
+ /**
41
+ * Runtime check to determine if a class is a DataObject type.
42
+ */
43
+ export function isDataObjectClass(obj: unknown): obj is InternalDataObjectClass<IFluidLoadable> {
27
44
  const maybe = obj as Partial<InternalDataObjectClass<IFluidLoadable>> | undefined;
28
45
  return (
29
46
  maybe?.factory?.IFluidDataStoreFactory !== undefined &&
30
47
  maybe?.factory?.IFluidDataStoreFactory === maybe?.factory
31
48
  );
32
- };
49
+ }
33
50
 
34
51
  /**
35
52
  * Runtime check to determine if a class is a SharedObject type
@@ -41,7 +58,7 @@ export const isSharedObjectClass = (obj: unknown): obj is SharedObjectClass<IFlu
41
58
 
42
59
  /**
43
60
  * The ContainerSchema consists of initialObjects and dynamicObjectTypes. These types can be
44
- * of both SharedObject or DataObject. This function seperates the two and returns a registery
61
+ * of both SharedObject or DataObject. This function separates the two and returns a registry
45
62
  * of DataObject types and an array of SharedObjects.
46
63
  */
47
64
  export const parseDataObjectsFromSharedObjects = (
@@ -0,0 +1,7 @@
1
+ {
2
+ // This config must be used in a "type": "commonjs" environment. (Use fluid-tsc commonjs.)
3
+ "extends": "./tsconfig.json",
4
+ "compilerOptions": {
5
+ "outDir": "./dist",
6
+ },
7
+ }
package/tsconfig.json CHANGED
@@ -1,13 +1,9 @@
1
1
  {
2
- "extends": [
3
- "../../../common/build/build-common/tsconfig.base.json",
4
- "../../../common/build/build-common/tsconfig.cjs.json",
5
- ],
6
- "include": ["src/**/*"],
7
- "exclude": ["src/test/**/*"],
2
+ "extends": "../../../common/build/build-common/tsconfig.node16.json",
8
3
  "compilerOptions": {
9
4
  "rootDir": "./src",
10
- "outDir": "./dist",
11
- "types": ["node"],
5
+ "outDir": "./lib",
12
6
  },
7
+ "include": ["src/**/*"],
8
+ "exclude": ["src/test/**/*"],
13
9
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"fluidContainer.d.mts","sourceRoot":"","sources":["../src/fluidContainer.ts"],"names":[],"mappings":"OAKO,EACN,KAAK,MAAM,EACX,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,MAAM,iCAAiC;OACjC,EACN,WAAW,EACX,KAAK,UAAU,EACf,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,MAAM,uCAAuC;OACvC,KAAK,EACX,eAAe,EACf,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACnB;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,eAAe,IAAI;KAMtD,CAAC,IAAI,MAAM,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,SAAS,mBAAmB,CACnF,MAAM,QAAQ,CACd,GACE,QAAQ,GACR,KAAK;CACR,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,qBAAsB,SAAQ,MAAM;IACpD;;;;;;;;;;OAUG;IACH,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IAEjD;;;;;;;;;;OAUG;IACH,CAAC,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IAEpD;;;;;;OAMG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,KAAK,CAAC,MAAM,CAA2B,WAAmC;QAChF,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACI,OAAO;QACb,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QACvB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACvD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QACnD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAC7D,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC/C,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAChD,CAAC;CAaD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport {\n\ttype IEvent,\n\ttype IEventProvider,\n\ttype IFluidLoadable,\n} from \"@fluidframework/core-interfaces\";\nimport {\n\tAttachState,\n\ttype IContainer,\n\ttype ICriticalContainerError,\n\ttype ConnectionState,\n} from \"@fluidframework/container-definitions\";\nimport type {\n\tContainerSchema,\n\tContainerAttachProps,\n\tIRootDataObject,\n\tLoadableObjectClass,\n} from \"./types\";\n\n/**\n * Extract the type of 'initialObjects' from the given {@link ContainerSchema} type.\n * @public\n */\nexport type InitialObjects<T extends ContainerSchema> = {\n\t// Construct a LoadableObjectRecord type by enumerating the keys of\n\t// 'ContainerSchema.initialObjects' and infering the value type of each key.\n\t//\n\t// The '? TChannel : never' is required because infer can only be used in\n\t// a conditional 'extends' expression.\n\t[K in keyof T[\"initialObjects\"]]: T[\"initialObjects\"][K] extends LoadableObjectClass<\n\t\tinfer TChannel\n\t>\n\t\t? TChannel\n\t\t: never;\n};\n\n/**\n * Events emitted from {@link IFluidContainer}.\n *\n * @remarks Note: external implementations of this interface are not supported.\n * @sealed\n * @public\n */\nexport interface IFluidContainerEvents extends IEvent {\n\t/**\n\t * Emitted when the {@link IFluidContainer} completes connecting to the Fluid service.\n\t *\n\t * @remarks Reflects connection state changes against the (delta) service acknowledging ops/edits.\n\t *\n\t * @see\n\t *\n\t * - {@link IFluidContainer.connectionState}\n\t *\n\t * - {@link IFluidContainer.connect}\n\t */\n\t(event: \"connected\", listener: () => void): void;\n\n\t/**\n\t * Emitted when the {@link IFluidContainer} becomes disconnected from the Fluid service.\n\t *\n\t * @remarks Reflects connection state changes against the (delta) service acknowledging ops/edits.\n\t *\n\t * @see\n\t *\n\t * - {@link IFluidContainer.connectionState}\n\t *\n\t * - {@link IFluidContainer.disconnect}\n\t */\n\t(event: \"disconnected\", listener: () => void): void;\n\n\t/**\n\t * Emitted when all local changes/edits have been acknowledged by the service.\n\t *\n\t * @remarks \"dirty\" event will be emitted when the next local change has been made.\n\t *\n\t * @see {@link IFluidContainer.isDirty}\n\t */\n\t(event: \"saved\", listener: () => void): void;\n\n\t/**\n\t * Emitted when the first local change has been made, following a \"saved\" event.\n\t *\n\t * @remarks \"saved\" event will be emitted once all local changes have been acknowledged by the service.\n\t *\n\t * @see {@link IFluidContainer.isDirty}\n\t */\n\t(event: \"dirty\", listener: () => void): void;\n\n\t/**\n\t * Emitted when the {@link IFluidContainer} is closed, which permanently disables it.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `error`: If the container was closed due to error (as opposed to an explicit call to\n\t * {@link IFluidContainer.dispose}), this will contain details about the error that caused it.\n\t */\n\t(event: \"disposed\", listener: (error?: ICriticalContainerError) => void);\n}\n\n/**\n * Provides an entrypoint into the client side of collaborative Fluid data.\n * Provides access to the data as well as status on the collaboration session.\n *\n * @typeparam TContainerSchema - Used to determine the type of 'initialObjects'.\n *\n * @remarks Note: external implementations of this interface are not supported.\n *\n * @sealed\n * @public\n */\nexport interface IFluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema>\n\textends IEventProvider<IFluidContainerEvents> {\n\t/**\n\t * Provides the current connected state of the container\n\t */\n\treadonly connectionState: ConnectionState;\n\n\t/**\n\t * A container is considered **dirty** if it has local changes that have not yet been acknowledged by the service.\n\t *\n\t * @remarks\n\t *\n\t * You should always check the `isDirty` flag before closing the container or navigating away from the page.\n\t * Closing the container while `isDirty === true` may result in the loss of operations that have not yet been\n\t * acknowledged by the service.\n\t *\n\t * A container is considered dirty in the following cases:\n\t *\n\t * 1. The container has been created in the detached state, and either it has not been attached yet or it is\n\t * in the process of being attached (container is in `attaching` state). If container is closed prior to being\n\t * attached, host may never know if the file was created or not.\n\t *\n\t * 2. The container was attached, but it has local changes that have not yet been saved to service endpoint.\n\t * This occurs as part of normal op flow where pending operation (changes) are awaiting acknowledgement from the\n\t * service. In some cases this can be due to lack of network connection. If the network connection is down,\n\t * it needs to be restored for the pending changes to be acknowledged.\n\t */\n\treadonly isDirty: boolean;\n\n\t/**\n\t * Whether or not the container is disposed, which permanently disables it.\n\t */\n\treadonly disposed: boolean;\n\n\t/**\n\t * The collection of data objects and Distributed Data Stores (DDSes) that were specified by the schema.\n\t *\n\t * @remarks These data objects and DDSes exist for the lifetime of the container.\n\t */\n\treadonly initialObjects: InitialObjects<TContainerSchema>;\n\n\t/**\n\t * The current attachment state of the container.\n\t *\n\t * @remarks\n\t *\n\t * Once a container has been attached, it remains attached.\n\t * When loading an existing container, it will already be attached.\n\t */\n\treadonly attachState: AttachState;\n\n\t/**\n\t * A newly created container starts detached from the collaborative service.\n\t * Calling `attach()` uploads the new container to the service and connects to the collaborative service.\n\t *\n\t * @remarks\n\t *\n\t * This should only be called when the container is in the\n\t * {@link @fluidframework/container-definitions#AttachState.Detatched} state.\n\t *\n\t * This can be determined by observing {@link IFluidContainer.attachState}.\n\t *\n\t * @returns A promise which resolves when the attach is complete, with the string identifier of the container.\n\t */\n\tattach(props?: ContainerAttachProps): Promise<string>;\n\n\t/**\n\t * Attempts to connect the container to the delta stream and process operations.\n\t *\n\t * @throws Will throw an error if connection is unsuccessful.\n\t *\n\t * @remarks\n\t *\n\t * This should only be called when the container is in the\n\t * {@link @fluidframework/container-definitions#(ConnectionState:namespace).Disconnected} state.\n\t *\n\t * This can be determined by observing {@link IFluidContainer.connectionState}.\n\t */\n\tconnect(): void;\n\n\t/**\n\t * Disconnects the container from the delta stream and stops processing operations.\n\t *\n\t * @remarks\n\t *\n\t * This should only be called when the container is in the\n\t * {@link @fluidframework/container-definitions#(ConnectionState:namespace).Connected} state.\n\t *\n\t * This can be determined by observing {@link IFluidContainer.connectionState}.\n\t */\n\tdisconnect(): void;\n\n\t/**\n\t * Create a new data object or Distributed Data Store (DDS) of the specified type.\n\t *\n\t * @remarks\n\t *\n\t * In order to share the data object or DDS with other\n\t * collaborators and retrieve it later, store its handle in a collection like a SharedDirectory from your\n\t * initialObjects.\n\t *\n\t * @param objectClass - The class of the `DataObject` or `SharedObject` to create.\n\t *\n\t * @typeParam T - The class of the `DataObject` or `SharedObject`.\n\t */\n\tcreate<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T>;\n\n\t/**\n\t * Dispose of the container instance, permanently disabling it.\n\t */\n\tdispose(): void;\n}\n\n/**\n * Creates an {@link IFluidContainer} from the provided `container` and `rootDataObject`.\n *\n * @internal\n */\nexport function createFluidContainer<\n\tTContainerSchema extends ContainerSchema = ContainerSchema,\n>(props: {\n\tcontainer: IContainer;\n\trootDataObject: IRootDataObject;\n}): IFluidContainer<TContainerSchema> {\n\treturn new FluidContainer<TContainerSchema>(props.container, props.rootDataObject);\n}\n\n/**\n * Base {@link IFluidContainer} implementation.\n *\n * @typeparam TContainerSchema - Used to determine the type of 'initialObjects'.\n * @remarks\n *\n * Note: this implementation is not complete. Consumers who rely on {@link IFluidContainer.attach}\n * will need to utilize or provide a service-specific implementation of this type that implements that method.\n * @deprecated use {@link createFluidContainer} and {@link IFluidContainer} instead\n * @internal\n */\nclass FluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema>\n\textends TypedEventEmitter<IFluidContainerEvents>\n\timplements IFluidContainer<TContainerSchema>\n{\n\tprivate readonly connectedHandler = (): boolean => this.emit(\"connected\");\n\tprivate readonly disconnectedHandler = (): boolean => this.emit(\"disconnected\");\n\tprivate readonly disposedHandler = (error?: ICriticalContainerError): boolean =>\n\t\tthis.emit(\"disposed\", error);\n\tprivate readonly savedHandler = (): boolean => this.emit(\"saved\");\n\tprivate readonly dirtyHandler = (): boolean => this.emit(\"dirty\");\n\n\tpublic constructor(\n\t\tprivate readonly container: IContainer,\n\t\tprivate readonly rootDataObject: IRootDataObject,\n\t) {\n\t\tsuper();\n\t\tcontainer.on(\"connected\", this.connectedHandler);\n\t\tcontainer.on(\"closed\", this.disposedHandler);\n\t\tcontainer.on(\"disconnected\", this.disconnectedHandler);\n\t\tcontainer.on(\"saved\", this.savedHandler);\n\t\tcontainer.on(\"dirty\", this.dirtyHandler);\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.isDirty}\n\t */\n\tpublic get isDirty(): boolean {\n\t\treturn this.container.isDirty;\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.attachState}\n\t */\n\tpublic get attachState(): AttachState {\n\t\treturn this.container.attachState;\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.disposed}\n\t */\n\tpublic get disposed(): boolean {\n\t\treturn this.container.closed;\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.connectionState}\n\t */\n\tpublic get connectionState(): ConnectionState {\n\t\treturn this.container.connectionState;\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.initialObjects}\n\t */\n\tpublic get initialObjects(): InitialObjects<TContainerSchema> {\n\t\treturn this.rootDataObject.initialObjects as InitialObjects<TContainerSchema>;\n\t}\n\n\t/**\n\t * Incomplete base implementation of {@link IFluidContainer.attach}.\n\t *\n\t * @remarks\n\t *\n\t * Note: this implementation will unconditionally throw.\n\t * Consumers who rely on this will need to utilize or provide a service specific implementation of this base type\n\t * that provides an implementation of this method.\n\t *\n\t * The reason is because externally we are presenting a separation between the service and the `FluidContainer`,\n\t * but internally this separation is not there.\n\t */\n\tpublic async attach(props?: ContainerAttachProps): Promise<string> {\n\t\tif (this.container.attachState !== AttachState.Detached) {\n\t\t\tthrow new Error(\"Cannot attach container. Container is not in detached state.\");\n\t\t}\n\t\tthrow new Error(\"Cannot attach container. Attach method not provided.\");\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.connect}\n\t */\n\tpublic async connect(): Promise<void> {\n\t\tthis.container.connect?.();\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.connect}\n\t */\n\tpublic async disconnect(): Promise<void> {\n\t\tthis.container.disconnect?.();\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.create}\n\t */\n\tpublic async create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T> {\n\t\treturn this.rootDataObject.create(objectClass);\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.dispose}\n\t */\n\tpublic dispose(): void {\n\t\tthis.container.close();\n\t\tthis.container.off(\"connected\", this.connectedHandler);\n\t\tthis.container.off(\"closed\", this.disposedHandler);\n\t\tthis.container.off(\"disconnected\", this.disconnectedHandler);\n\t\tthis.container.off(\"saved\", this.savedHandler);\n\t\tthis.container.off(\"dirty\", this.dirtyHandler);\n\t}\n\n\t/**\n\t * FOR INTERNAL USE ONLY. NOT FOR EXTERNAL USE.\n\t * We make no stability guarantees here whatsoever.\n\t *\n\t * Gets the underlying {@link @fluidframework/container-definitions#IContainer}.\n\t *\n\t * @remarks Used to power debug tooling.\n\t */\n\tpublic readonly INTERNAL_CONTAINER_DO_NOT_USE?: () => IContainer = () => {\n\t\treturn this.container;\n\t};\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAQI,EACN,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,cAAc,GACnB;OACM,EAAE,uCAAuC,EAAE;OAC3C,EAAE,qBAAqB,EAAE;OACzB,EACN,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,MAAM,EACX,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,GAC3B"}
package/lib/index.mjs DELETED
@@ -1,8 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- export { createFluidContainer, } from "./fluidContainer.mjs";
6
- export { createDOProviderContainerRuntimeFactory } from "./rootDataObject.mjs";
7
- export { createServiceAudience } from "./serviceAudience.mjs";
8
- //# sourceMappingURL=index.mjs.map
package/lib/index.mjs.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAQI,EACN,oBAAoB,GAIpB;OACM,EAAE,uCAAuC,EAAE;OAC3C,EAAE,qBAAqB,EAAE","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Provides a simple and powerful way to consume collaborative Fluid data.\n *\n * @packageDocumentation\n */\n\nexport {\n\tcreateFluidContainer,\n\ttype IFluidContainer,\n\ttype IFluidContainerEvents,\n\ttype InitialObjects,\n} from \"./fluidContainer\";\nexport { createDOProviderContainerRuntimeFactory } from \"./rootDataObject\";\nexport { createServiceAudience } from \"./serviceAudience\";\nexport {\n\ttype ContainerSchema,\n\ttype ContainerAttachProps,\n\ttype DataObjectClass,\n\ttype IConnection,\n\ttype IMember,\n\ttype IRootDataObject,\n\ttype IServiceAudience,\n\ttype IServiceAudienceEvents,\n\ttype LoadableObjectClass,\n\ttype LoadableObjectClassRecord,\n\ttype LoadableObjectCtor,\n\ttype LoadableObjectRecord,\n\ttype MemberChangedListener,\n\ttype Myself,\n\ttype SharedObjectClass,\n\ttype IProvideRootDataObject,\n} from \"./types\";\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"rootDataObject.d.mts","sourceRoot":"","sources":["../src/rootDataObject.ts"],"names":[],"mappings":"OAiBO,EAAE,KAAK,eAAe,EAAE,MAAM,uCAAuC;OAKrE,EACN,KAAK,eAAe,EAGpB,KAAK,yBAAyB,EAG9B;AAQD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC;;;;OAIG;IACH,cAAc,EAAE,yBAAyB,CAAC;CAC1C;AA+GD;;;;;GAKG;AACH,wBAAgB,uCAAuC,CAAC,KAAK,EAAE;IAC9D,MAAM,EAAE,eAAe,CAAC;CACxB,GAAG,eAAe,CAElB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"rootDataObject.mjs","sourceRoot":"","sources":["../src/rootDataObject.ts"],"names":[],"mappings":"OAIO,EACN,2BAA2B,EAC3B,UAAU,EACV,iBAAiB,GACjB,MAAM,0BAA0B;OAQ1B,EAAE,SAAS,EAAE,MAAM,qCAAqC;OAExD,EAAE,aAAa,EAAE,MAAM,+BAA+B;OAYtD,EAEN,iBAAiB,EACjB,mBAAmB,EACnB,iCAAiC,GACjC;AAcD;;;GAGG;AACH,MAAM,cACL,SAAQ,UAAiD;IAD1D;;QAIkB,yBAAoB,GAAG,qBAAqB,CAAC;QAC7C,oBAAe,GAAyB,EAAE,CAAC;IAgG7D,CAAC;IA9FA,IAAW,eAAe;QACzB,OAAO,IAAI,CAAC;IACb,CAAC;IAED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AAO,EAAE,OAAO,CAAC,OAAO;iBACxB,CAAC,CAAC;aACH;YACD,OAAO,SAAS,CAAC,CAAC,kBAAkB;QACrC,CAAC,CAAC;QACF,KAAK,CAAC;YACL,eAAe,EAAE,CAAC,qBAAqB,CAAC,aAAa,CAAC;YACtD,eAAe,EAAE,CAAC,gBAAgB,CAAC;YACnC,cAAc,EAAE;gBACf,kGAAkG;gBAClG,sEAAsE;gBACtE,SAAS,EAAE,SAAS,CAAC,SAAS;gBAC9B,2EAA2E;gBAC3E,yBAAyB,EAAE,IAAI;aAC/B;YACD,iBAAiB;SACjB,CAAC,CAAC;QACH,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;QACnD,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;IAC7C,CAAC;IAED;;OAEG;IACO,KAAK,CAAC,8BAA8B,CAAC,OAA0B;QACxE,sEAAsE;QACtE,MAAM,IAAI,CAAC,qBAAqB,CAAC,kBAAkB,CAAC,eAAe,EAAE,OAAO,EAAE;YAC7E,cAAc,EAAE,IAAI,CAAC,cAAc;SACnC,CAAC,CAAC;IACJ,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport {\n\tBaseContainerRuntimeFactory,\n\tDataObject,\n\tDataObjectFactory,\n} from \"@fluidframework/aqueduct\";\nimport { type IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport {\n\ttype FluidObject,\n\ttype IFluidLoadable,\n\ttype IRequest,\n\ttype IResponse,\n} from \"@fluidframework/core-interfaces\";\nimport { FlushMode } from \"@fluidframework/runtime-definitions\";\nimport { type IRuntimeFactory } from \"@fluidframework/container-definitions\";\nimport { RequestParser } from \"@fluidframework/runtime-utils\";\nimport { type ContainerRuntime } from \"@fluidframework/container-runtime\";\nimport { type IDirectory } from \"@fluidframework/map\";\n\nimport {\n\ttype ContainerSchema,\n\ttype IRootDataObject,\n\ttype LoadableObjectClass,\n\ttype LoadableObjectClassRecord,\n\ttype LoadableObjectRecord,\n\ttype SharedObjectClass,\n} from \"./types\";\nimport {\n\ttype InternalDataObjectClass,\n\tisDataObjectClass,\n\tisSharedObjectClass,\n\tparseDataObjectsFromSharedObjects,\n} from \"./utils\";\n\n/**\n * Input props for {@link RootDataObject.initializingFirstTime}.\n */\nexport interface RootDataObjectProps {\n\t/**\n\t * Initial object structure with which the {@link RootDataObject} will be first-time initialized.\n\t *\n\t * @see {@link RootDataObject.initializingFirstTime}\n\t */\n\tinitialObjects: LoadableObjectClassRecord;\n}\n\n/**\n * The entry-point/root collaborative object of the {@link IFluidContainer | Fluid Container}.\n * Abstracts the dynamic code required to build a Fluid Container into a static representation for end customers.\n */\nclass RootDataObject\n\textends DataObject<{ InitialState: RootDataObjectProps }>\n\timplements IRootDataObject\n{\n\tprivate readonly initialObjectsDirKey = \"initial-objects-key\";\n\tprivate readonly _initialObjects: LoadableObjectRecord = {};\n\n\tpublic get IRootDataObject(): IRootDataObject {\n\t\treturn this;\n\t}\n\n\tprivate get initialObjectsDir(): IDirectory {\n\t\tconst dir = this.root.getSubDirectory(this.initialObjectsDirKey);\n\t\tif (dir === undefined) {\n\t\t\tthrow new Error(\"InitialObjects sub-directory was not initialized\");\n\t\t}\n\t\treturn dir;\n\t}\n\n\t/**\n\t * The first time this object is initialized, creates each object identified in\n\t * {@link RootDataObjectProps.initialObjects} and stores them as unique values in the root directory.\n\t *\n\t * @see {@link @fluidframework/aqueduct#PureDataObject.initializingFirstTime}\n\t */\n\tprotected async initializingFirstTime(props: RootDataObjectProps): Promise<void> {\n\t\tthis.root.createSubDirectory(this.initialObjectsDirKey);\n\n\t\t// Create initial objects provided by the developer\n\t\tconst initialObjectsP: Promise<void>[] = [];\n\t\tfor (const [id, objectClass] of Object.entries(props.initialObjects)) {\n\t\t\tconst createObject = async (): Promise<void> => {\n\t\t\t\tconst obj = await this.create<IFluidLoadable>(objectClass);\n\t\t\t\tthis.initialObjectsDir.set(id, obj.handle);\n\t\t\t};\n\t\t\tinitialObjectsP.push(createObject());\n\t\t}\n\n\t\tawait Promise.all(initialObjectsP);\n\t}\n\n\t/**\n\t * Every time an instance is initialized, loads all of the initial objects in the root directory so they can be\n\t * accessed immediately.\n\t *\n\t * @see {@link @fluidframework/aqueduct#PureDataObject.hasInitialized}\n\t */\n\tprotected async hasInitialized(): Promise<void> {\n\t\t// We will always load the initial objects so they are available to the developer\n\t\tconst loadInitialObjectsP: Promise<void>[] = [];\n\t\tfor (const [key, value] of this.initialObjectsDir.entries()) {\n\t\t\tconst loadDir = async (): Promise<void> => {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n\t\t\t\tconst obj: unknown = await value.get();\n\t\t\t\tObject.assign(this._initialObjects, { [key]: obj });\n\t\t\t};\n\t\t\tloadInitialObjectsP.push(loadDir());\n\t\t}\n\n\t\tawait Promise.all(loadInitialObjectsP);\n\t}\n\n\t/**\n\t * {@inheritDoc IRootDataObject.initialObjects}\n\t */\n\tpublic get initialObjects(): LoadableObjectRecord {\n\t\tif (Object.keys(this._initialObjects).length === 0) {\n\t\t\tthrow new Error(\"Initial Objects were not correctly initialized\");\n\t\t}\n\t\treturn this._initialObjects;\n\t}\n\n\t/**\n\t * {@inheritDoc IRootDataObject.create}\n\t */\n\tpublic async create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T> {\n\t\tif (isDataObjectClass(objectClass)) {\n\t\t\treturn this.createDataObject<T>(objectClass);\n\t\t} else if (isSharedObjectClass(objectClass)) {\n\t\t\treturn this.createSharedObject<T>(objectClass);\n\t\t}\n\t\tthrow new Error(\"Could not create new Fluid object because an unknown object was passed\");\n\t}\n\n\tprivate async createDataObject<T extends IFluidLoadable>(\n\t\tdataObjectClass: InternalDataObjectClass<T>,\n\t): Promise<T> {\n\t\tconst factory = dataObjectClass.factory;\n\t\tconst packagePath = [...this.context.packagePath, factory.type];\n\t\tconst dataStore = await this.context.containerRuntime.createDataStore(packagePath);\n\t\tconst entryPoint = await dataStore.entryPoint.get();\n\t\treturn entryPoint as unknown as T;\n\t}\n\n\tprivate createSharedObject<T extends IFluidLoadable>(\n\t\tsharedObjectClass: SharedObjectClass<T>,\n\t): T {\n\t\tconst factory = sharedObjectClass.getFactory();\n\t\tconst obj = this.runtime.createChannel(undefined, factory.type);\n\t\treturn obj as unknown as T;\n\t}\n}\n\nconst rootDataStoreId = \"rootDOId\";\n\n/**\n * Creates an {@link @fluidframework/aqueduct#BaseContainerRuntimeFactory} for a container with a single\n * {@link IRootDataObject}, which is constructed from the provided schema.\n *\n * @internal\n */\nexport function createDOProviderContainerRuntimeFactory(props: {\n\tschema: ContainerSchema;\n}): IRuntimeFactory {\n\treturn new DOProviderContainerRuntimeFactory(props.schema);\n}\n\n/**\n * Container code that provides a single {@link IRootDataObject}.\n *\n * @remarks\n *\n * This data object is dynamically customized (registry and initial objects) based on the schema provided.\n * to the container runtime factory.\n *\n * @internal\n */\nclass DOProviderContainerRuntimeFactory extends BaseContainerRuntimeFactory {\n\tprivate readonly rootDataObjectFactory: DataObjectFactory<\n\t\tRootDataObject,\n\t\t{\n\t\t\tInitialState: RootDataObjectProps;\n\t\t}\n\t>;\n\n\tprivate readonly initialObjects: LoadableObjectClassRecord;\n\n\tpublic constructor(schema: ContainerSchema) {\n\t\tconst [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(schema);\n\t\tconst rootDataObjectFactory = new DataObjectFactory(\n\t\t\t\"rootDO\",\n\t\t\tRootDataObject,\n\t\t\tsharedObjects,\n\t\t\t{},\n\t\t\tregistryEntries,\n\t\t);\n\t\tconst provideEntryPoint = async (\n\t\t\tcontainerRuntime: IContainerRuntime,\n\t\t\t// eslint-disable-next-line unicorn/consistent-function-scoping\n\t\t): Promise<FluidObject> => {\n\t\t\tconst entryPoint =\n\t\t\t\tawait containerRuntime.getAliasedDataStoreEntryPoint(rootDataStoreId);\n\t\t\tif (entryPoint === undefined) {\n\t\t\t\tthrow new Error(`default dataStore [${rootDataStoreId}] must exist`);\n\t\t\t}\n\t\t\treturn entryPoint.get();\n\t\t};\n\t\tconst getDefaultObject = async (\n\t\t\trequest: IRequest,\n\t\t\truntime: IContainerRuntime,\n\t\t\t// eslint-disable-next-line unicorn/consistent-function-scoping\n\t\t): Promise<IResponse | undefined> => {\n\t\t\tconst parser = RequestParser.create(request);\n\t\t\tif (parser.pathParts.length === 0) {\n\t\t\t\t// This cast is safe as ContainerRuntime.loadRuntime is called in the base class\n\t\t\t\treturn (runtime as ContainerRuntime).resolveHandle({\n\t\t\t\t\turl: `/${rootDataStoreId}${parser.query}`,\n\t\t\t\t\theaders: request.headers,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn undefined; // continue search\n\t\t};\n\t\tsuper({\n\t\t\tregistryEntries: [rootDataObjectFactory.registryEntry],\n\t\t\trequestHandlers: [getDefaultObject],\n\t\t\truntimeOptions: {\n\t\t\t\t// temporary workaround to disable message batching until the message batch size issue is resolved\n\t\t\t\t// resolution progress is tracked by the Feature 465 work item in AzDO\n\t\t\t\tflushMode: FlushMode.Immediate,\n\t\t\t\t// The runtime compressor is required to be on to use @fluidframework/tree.\n\t\t\t\tenableRuntimeIdCompressor: true,\n\t\t\t},\n\t\t\tprovideEntryPoint,\n\t\t});\n\t\tthis.rootDataObjectFactory = rootDataObjectFactory;\n\t\tthis.initialObjects = schema.initialObjects;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/aqueduct#BaseContainerRuntimeFactory.containerInitializingFirstTime}\n\t */\n\tprotected async containerInitializingFirstTime(runtime: IContainerRuntime): Promise<void> {\n\t\t// The first time we create the container we create the RootDataObject\n\t\tawait this.rootDataObjectFactory.createRootInstance(rootDataStoreId, runtime, {\n\t\t\tinitialObjects: this.initialObjects,\n\t\t});\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"serviceAudience.d.mts","sourceRoot":"","sources":["../src/serviceAudience.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EAAkB,KAAK,UAAU,EAAE,MAAM,uCAAuC;OAChF,EAAE,KAAK,OAAO,EAAE,MAAM,sCAAsC;OAC5D,EACN,KAAK,gBAAgB,EAErB,KAAK,OAAO,EAEZ;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,SAAS,OAAO,GAAG,OAAO,EAAE,KAAK,EAAE;IAC/E,SAAS,EAAE,UAAU,CAAC;IACtB,mBAAmB,EAAE,CAAC,cAAc,EAAE,OAAO,KAAK,OAAO,CAAC;CAC1D,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAE5B"}