@fluidframework/fluid-static 2.0.0-rc.1.0.3 → 2.0.0-rc.2.0.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.
- package/{.eslintrc.js → .eslintrc.cjs} +1 -1
- package/{.mocharc.js → .mocharc.cjs} +1 -1
- package/CHANGELOG.md +10 -0
- package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -1
- package/api-extractor.json +1 -1
- package/api-report/fluid-static.api.md +17 -14
- package/dist/fluid-static-alpha.d.ts +29 -13
- package/dist/fluid-static-beta.d.ts +29 -13
- package/dist/fluid-static-public.d.ts +29 -13
- package/dist/fluid-static-untrimmed.d.ts +44 -16
- package/dist/fluidContainer.d.ts +9 -6
- package/dist/fluidContainer.d.ts.map +1 -1
- package/dist/fluidContainer.js +3 -1
- package/dist/fluidContainer.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/package.json +3 -0
- package/dist/rootDataObject.d.ts +5 -2
- package/dist/rootDataObject.d.ts.map +1 -1
- package/dist/rootDataObject.js +12 -8
- package/dist/rootDataObject.js.map +1 -1
- package/dist/serviceAudience.d.ts +13 -6
- package/dist/serviceAudience.d.ts.map +1 -1
- package/dist/serviceAudience.js +12 -4
- package/dist/serviceAudience.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/types.d.ts +26 -12
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +13 -9
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +11 -8
- package/dist/utils.js.map +1 -1
- package/lib/{fluid-static-alpha.d.mts → fluid-static-alpha.d.ts} +35 -13
- package/lib/{fluid-static-beta.d.mts → fluid-static-beta.d.ts} +35 -13
- package/lib/{fluid-static-public.d.mts → fluid-static-public.d.ts} +35 -13
- package/lib/{fluid-static-untrimmed.d.mts → fluid-static-untrimmed.d.ts} +50 -16
- package/lib/{fluidContainer.d.mts → fluidContainer.d.ts} +10 -7
- package/lib/fluidContainer.d.ts.map +1 -0
- package/lib/{fluidContainer.mjs → fluidContainer.js} +8 -2
- package/lib/fluidContainer.js.map +1 -0
- package/lib/index.d.ts +14 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +13 -0
- package/lib/index.js.map +1 -0
- package/lib/{rootDataObject.d.mts → rootDataObject.d.ts} +6 -3
- package/lib/rootDataObject.d.ts.map +1 -0
- package/lib/{rootDataObject.mjs → rootDataObject.js} +14 -6
- package/lib/rootDataObject.js.map +1 -0
- package/lib/serviceAudience.d.ts +22 -0
- package/lib/serviceAudience.d.ts.map +1 -0
- package/lib/{serviceAudience.mjs → serviceAudience.js} +13 -5
- package/lib/serviceAudience.js.map +1 -0
- package/lib/test/fluidContainer.spec.js +21 -0
- package/lib/test/fluidContainer.spec.js.map +1 -0
- package/lib/test/types/validateFluidStaticPrevious.generated.js +46 -0
- package/lib/test/types/validateFluidStaticPrevious.generated.js.map +1 -0
- package/lib/test/utils.spec.js +86 -0
- package/lib/test/utils.spec.js.map +1 -0
- package/lib/{types.d.mts → types.d.ts} +27 -13
- package/lib/types.d.ts.map +1 -0
- package/lib/{types.mjs → types.js} +1 -1
- package/lib/types.js.map +1 -0
- package/lib/utils.d.ts +34 -0
- package/lib/utils.d.ts.map +1 -0
- package/lib/{utils.mjs → utils.js} +11 -8
- package/lib/utils.js.map +1 -0
- package/package.json +45 -58
- package/src/fluidContainer.ts +29 -17
- package/src/index.ts +23 -22
- package/src/rootDataObject.ts +48 -29
- package/src/serviceAudience.ts +35 -22
- package/src/types.ts +34 -14
- package/src/utils.ts +36 -16
- package/tsconfig.cjs.json +7 -0
- package/tsconfig.json +4 -8
- package/lib/fluidContainer.d.mts.map +0 -1
- package/lib/fluidContainer.mjs.map +0 -1
- package/lib/index.d.mts +0 -9
- package/lib/index.d.mts.map +0 -1
- package/lib/index.mjs +0 -8
- package/lib/index.mjs.map +0 -1
- package/lib/rootDataObject.d.mts.map +0 -1
- package/lib/rootDataObject.mjs.map +0 -1
- package/lib/serviceAudience.d.mts +0 -15
- package/lib/serviceAudience.d.mts.map +0 -1
- package/lib/serviceAudience.mjs.map +0 -1
- package/lib/types.d.mts.map +0 -1
- package/lib/types.mjs.map +0 -1
- package/lib/utils.d.mts +0 -30
- package/lib/utils.d.mts.map +0 -1
- package/lib/utils.mjs.map +0 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
use_current_InterfaceDeclaration_ContainerSchema(get_old_InterfaceDeclaration_ContainerSchema());
|
|
2
|
+
use_old_InterfaceDeclaration_ContainerSchema(
|
|
3
|
+
// @ts-expect-error compatibility expected to be broken
|
|
4
|
+
get_current_InterfaceDeclaration_ContainerSchema());
|
|
5
|
+
use_current_TypeAliasDeclaration_DataObjectClass(get_old_TypeAliasDeclaration_DataObjectClass());
|
|
6
|
+
use_old_TypeAliasDeclaration_DataObjectClass(get_current_TypeAliasDeclaration_DataObjectClass());
|
|
7
|
+
use_current_InterfaceDeclaration_IConnection(get_old_InterfaceDeclaration_IConnection());
|
|
8
|
+
use_old_InterfaceDeclaration_IConnection(get_current_InterfaceDeclaration_IConnection());
|
|
9
|
+
use_current_InterfaceDeclaration_IFluidContainer(get_old_InterfaceDeclaration_IFluidContainer());
|
|
10
|
+
use_old_InterfaceDeclaration_IFluidContainer(get_current_InterfaceDeclaration_IFluidContainer());
|
|
11
|
+
use_current_InterfaceDeclaration_IFluidContainerEvents(get_old_InterfaceDeclaration_IFluidContainerEvents());
|
|
12
|
+
use_old_InterfaceDeclaration_IFluidContainerEvents(get_current_InterfaceDeclaration_IFluidContainerEvents());
|
|
13
|
+
use_current_InterfaceDeclaration_IMember(get_old_InterfaceDeclaration_IMember());
|
|
14
|
+
use_old_InterfaceDeclaration_IMember(get_current_InterfaceDeclaration_IMember());
|
|
15
|
+
use_current_InterfaceDeclaration_IProvideRootDataObject(get_old_InterfaceDeclaration_IProvideRootDataObject());
|
|
16
|
+
use_old_InterfaceDeclaration_IProvideRootDataObject(get_current_InterfaceDeclaration_IProvideRootDataObject());
|
|
17
|
+
use_current_InterfaceDeclaration_IRootDataObject(get_old_InterfaceDeclaration_IRootDataObject());
|
|
18
|
+
use_old_InterfaceDeclaration_IRootDataObject(get_current_InterfaceDeclaration_IRootDataObject());
|
|
19
|
+
use_current_InterfaceDeclaration_IServiceAudience(get_old_InterfaceDeclaration_IServiceAudience());
|
|
20
|
+
use_old_InterfaceDeclaration_IServiceAudience(get_current_InterfaceDeclaration_IServiceAudience());
|
|
21
|
+
use_current_InterfaceDeclaration_IServiceAudienceEvents(get_old_InterfaceDeclaration_IServiceAudienceEvents());
|
|
22
|
+
use_old_InterfaceDeclaration_IServiceAudienceEvents(get_current_InterfaceDeclaration_IServiceAudienceEvents());
|
|
23
|
+
use_current_TypeAliasDeclaration_InitialObjects(get_old_TypeAliasDeclaration_InitialObjects());
|
|
24
|
+
use_old_TypeAliasDeclaration_InitialObjects(get_current_TypeAliasDeclaration_InitialObjects());
|
|
25
|
+
use_current_TypeAliasDeclaration_LoadableObjectClass(get_old_TypeAliasDeclaration_LoadableObjectClass());
|
|
26
|
+
use_old_TypeAliasDeclaration_LoadableObjectClass(get_current_TypeAliasDeclaration_LoadableObjectClass());
|
|
27
|
+
use_current_TypeAliasDeclaration_LoadableObjectClassRecord(get_old_TypeAliasDeclaration_LoadableObjectClassRecord());
|
|
28
|
+
use_old_TypeAliasDeclaration_LoadableObjectClassRecord(get_current_TypeAliasDeclaration_LoadableObjectClassRecord());
|
|
29
|
+
use_current_TypeAliasDeclaration_LoadableObjectCtor(get_old_TypeAliasDeclaration_LoadableObjectCtor());
|
|
30
|
+
use_old_TypeAliasDeclaration_LoadableObjectCtor(get_current_TypeAliasDeclaration_LoadableObjectCtor());
|
|
31
|
+
use_current_TypeAliasDeclaration_LoadableObjectRecord(get_old_TypeAliasDeclaration_LoadableObjectRecord());
|
|
32
|
+
use_old_TypeAliasDeclaration_LoadableObjectRecord(get_current_TypeAliasDeclaration_LoadableObjectRecord());
|
|
33
|
+
use_current_TypeAliasDeclaration_MemberChangedListener(get_old_TypeAliasDeclaration_MemberChangedListener());
|
|
34
|
+
use_old_TypeAliasDeclaration_MemberChangedListener(get_current_TypeAliasDeclaration_MemberChangedListener());
|
|
35
|
+
use_current_TypeAliasDeclaration_Myself(get_old_TypeAliasDeclaration_Myself());
|
|
36
|
+
use_old_TypeAliasDeclaration_Myself(get_current_TypeAliasDeclaration_Myself());
|
|
37
|
+
use_current_RemovedTypeAliasDeclaration_SharedObjectClass(get_old_TypeAliasDeclaration_SharedObjectClass());
|
|
38
|
+
use_old_TypeAliasDeclaration_SharedObjectClass(get_current_RemovedTypeAliasDeclaration_SharedObjectClass());
|
|
39
|
+
use_current_FunctionDeclaration_createDOProviderContainerRuntimeFactory(get_old_FunctionDeclaration_createDOProviderContainerRuntimeFactory());
|
|
40
|
+
use_old_FunctionDeclaration_createDOProviderContainerRuntimeFactory(get_current_FunctionDeclaration_createDOProviderContainerRuntimeFactory());
|
|
41
|
+
use_current_FunctionDeclaration_createFluidContainer(get_old_FunctionDeclaration_createFluidContainer());
|
|
42
|
+
use_old_FunctionDeclaration_createFluidContainer(get_current_FunctionDeclaration_createFluidContainer());
|
|
43
|
+
use_current_FunctionDeclaration_createServiceAudience(get_old_FunctionDeclaration_createServiceAudience());
|
|
44
|
+
use_old_FunctionDeclaration_createServiceAudience(get_current_FunctionDeclaration_createServiceAudience());
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=validateFluidStaticPrevious.generated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateFluidStaticPrevious.generated.js","sourceRoot":"","sources":["../../../src/test/types/validateFluidStaticPrevious.generated.ts"],"names":[],"mappings":"AAgCA,gDAAgD,CAC5C,4CAA4C,EAAE,CAAC,CAAC;AAWpD,4CAA4C;AACxC,uDAAuD;AACvD,gDAAgD,EAAE,CAAC,CAAC;AAW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C,mDAAmD,EAAE,CAAC,CAAC;AAW3D,qDAAqD,CACjD,iDAAiD,EAAE,CAAC,CAAC;AAWzD,iDAAiD,CAC7C,qDAAqD,EAAE,CAAC,CAAC;AAW7D,sDAAsD,CAClD,kDAAkD,EAAE,CAAC,CAAC;AAW1D,kDAAkD,CAC9C,sDAAsD,EAAE,CAAC,CAAC;AAW9D,uCAAuC,CACnC,mCAAmC,EAAE,CAAC,CAAC;AAW3C,mCAAmC,CAC/B,uCAAuC,EAAE,CAAC,CAAC;AAW/C,yDAAyD,CACrD,8CAA8C,EAAE,CAAC,CAAC;AAWtD,8CAA8C,CAC1C,yDAAyD,EAAE,CAAC,CAAC;AAWjE,uEAAuE,CACnE,mEAAmE,EAAE,CAAC,CAAC;AAW3E,mEAAmE,CAC/D,uEAAuE,EAAE,CAAC,CAAC;AAW/E,oDAAoD,CAChD,gDAAgD,EAAE,CAAC,CAAC;AAWxD,gDAAgD,CAC5C,oDAAoD,EAAE,CAAC,CAAC;AAW5D,qDAAqD,CACjD,iDAAiD,EAAE,CAAC,CAAC;AAWzD,iDAAiD,CAC7C,qDAAqD,EAAE,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/*\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.\n * Generated by fluid-type-test-generator in @fluidframework/build-tools.\n */\nimport type * as old from \"@fluidframework/fluid-static-previous\";\nimport type * as current from \"../../index.js\";\n\n\n// See 'build-tools/src/type-test-generator/compatibility.ts' for more information.\ntype TypeOnly<T> = T extends number\n\t? number\n\t: T extends string\n\t? string\n\t: T extends boolean | bigint | symbol\n\t? T\n\t: {\n\t\t\t[P in keyof T]: TypeOnly<T[P]>;\n\t };\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_ContainerSchema\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_ContainerSchema():\n TypeOnly<old.ContainerSchema>;\ndeclare function use_current_InterfaceDeclaration_ContainerSchema(\n use: TypeOnly<current.ContainerSchema>): void;\nuse_current_InterfaceDeclaration_ContainerSchema(\n get_old_InterfaceDeclaration_ContainerSchema());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_ContainerSchema\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_ContainerSchema():\n TypeOnly<current.ContainerSchema>;\ndeclare function use_old_InterfaceDeclaration_ContainerSchema(\n use: TypeOnly<old.ContainerSchema>): void;\nuse_old_InterfaceDeclaration_ContainerSchema(\n // @ts-expect-error compatibility expected to be broken\n get_current_InterfaceDeclaration_ContainerSchema());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"TypeAliasDeclaration_DataObjectClass\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_TypeAliasDeclaration_DataObjectClass():\n TypeOnly<old.DataObjectClass<any>>;\ndeclare function use_current_TypeAliasDeclaration_DataObjectClass(\n use: TypeOnly<current.DataObjectClass<any>>): void;\nuse_current_TypeAliasDeclaration_DataObjectClass(\n get_old_TypeAliasDeclaration_DataObjectClass());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"TypeAliasDeclaration_DataObjectClass\": {\"backCompat\": false}\n*/\ndeclare function get_current_TypeAliasDeclaration_DataObjectClass():\n TypeOnly<current.DataObjectClass<any>>;\ndeclare function use_old_TypeAliasDeclaration_DataObjectClass(\n use: TypeOnly<old.DataObjectClass<any>>): void;\nuse_old_TypeAliasDeclaration_DataObjectClass(\n get_current_TypeAliasDeclaration_DataObjectClass());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IConnection\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_IConnection():\n TypeOnly<old.IConnection>;\ndeclare function use_current_InterfaceDeclaration_IConnection(\n use: TypeOnly<current.IConnection>): void;\nuse_current_InterfaceDeclaration_IConnection(\n get_old_InterfaceDeclaration_IConnection());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IConnection\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_IConnection():\n TypeOnly<current.IConnection>;\ndeclare function use_old_InterfaceDeclaration_IConnection(\n use: TypeOnly<old.IConnection>): void;\nuse_old_InterfaceDeclaration_IConnection(\n get_current_InterfaceDeclaration_IConnection());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IFluidContainer\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_IFluidContainer():\n TypeOnly<old.IFluidContainer>;\ndeclare function use_current_InterfaceDeclaration_IFluidContainer(\n use: TypeOnly<current.IFluidContainer>): void;\nuse_current_InterfaceDeclaration_IFluidContainer(\n get_old_InterfaceDeclaration_IFluidContainer());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IFluidContainer\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_IFluidContainer():\n TypeOnly<current.IFluidContainer>;\ndeclare function use_old_InterfaceDeclaration_IFluidContainer(\n use: TypeOnly<old.IFluidContainer>): void;\nuse_old_InterfaceDeclaration_IFluidContainer(\n get_current_InterfaceDeclaration_IFluidContainer());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IFluidContainerEvents\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_IFluidContainerEvents():\n TypeOnly<old.IFluidContainerEvents>;\ndeclare function use_current_InterfaceDeclaration_IFluidContainerEvents(\n use: TypeOnly<current.IFluidContainerEvents>): void;\nuse_current_InterfaceDeclaration_IFluidContainerEvents(\n get_old_InterfaceDeclaration_IFluidContainerEvents());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IFluidContainerEvents\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_IFluidContainerEvents():\n TypeOnly<current.IFluidContainerEvents>;\ndeclare function use_old_InterfaceDeclaration_IFluidContainerEvents(\n use: TypeOnly<old.IFluidContainerEvents>): void;\nuse_old_InterfaceDeclaration_IFluidContainerEvents(\n get_current_InterfaceDeclaration_IFluidContainerEvents());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IMember\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_IMember():\n TypeOnly<old.IMember>;\ndeclare function use_current_InterfaceDeclaration_IMember(\n use: TypeOnly<current.IMember>): void;\nuse_current_InterfaceDeclaration_IMember(\n get_old_InterfaceDeclaration_IMember());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IMember\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_IMember():\n TypeOnly<current.IMember>;\ndeclare function use_old_InterfaceDeclaration_IMember(\n use: TypeOnly<old.IMember>): void;\nuse_old_InterfaceDeclaration_IMember(\n get_current_InterfaceDeclaration_IMember());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IProvideRootDataObject\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_IProvideRootDataObject():\n TypeOnly<old.IProvideRootDataObject>;\ndeclare function use_current_InterfaceDeclaration_IProvideRootDataObject(\n use: TypeOnly<current.IProvideRootDataObject>): void;\nuse_current_InterfaceDeclaration_IProvideRootDataObject(\n get_old_InterfaceDeclaration_IProvideRootDataObject());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IProvideRootDataObject\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_IProvideRootDataObject():\n TypeOnly<current.IProvideRootDataObject>;\ndeclare function use_old_InterfaceDeclaration_IProvideRootDataObject(\n use: TypeOnly<old.IProvideRootDataObject>): void;\nuse_old_InterfaceDeclaration_IProvideRootDataObject(\n get_current_InterfaceDeclaration_IProvideRootDataObject());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IRootDataObject\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_IRootDataObject():\n TypeOnly<old.IRootDataObject>;\ndeclare function use_current_InterfaceDeclaration_IRootDataObject(\n use: TypeOnly<current.IRootDataObject>): void;\nuse_current_InterfaceDeclaration_IRootDataObject(\n get_old_InterfaceDeclaration_IRootDataObject());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IRootDataObject\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_IRootDataObject():\n TypeOnly<current.IRootDataObject>;\ndeclare function use_old_InterfaceDeclaration_IRootDataObject(\n use: TypeOnly<old.IRootDataObject>): void;\nuse_old_InterfaceDeclaration_IRootDataObject(\n get_current_InterfaceDeclaration_IRootDataObject());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IServiceAudience\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_IServiceAudience():\n TypeOnly<old.IServiceAudience<any>>;\ndeclare function use_current_InterfaceDeclaration_IServiceAudience(\n use: TypeOnly<current.IServiceAudience<any>>): void;\nuse_current_InterfaceDeclaration_IServiceAudience(\n get_old_InterfaceDeclaration_IServiceAudience());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IServiceAudience\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_IServiceAudience():\n TypeOnly<current.IServiceAudience<any>>;\ndeclare function use_old_InterfaceDeclaration_IServiceAudience(\n use: TypeOnly<old.IServiceAudience<any>>): void;\nuse_old_InterfaceDeclaration_IServiceAudience(\n get_current_InterfaceDeclaration_IServiceAudience());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IServiceAudienceEvents\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_IServiceAudienceEvents():\n TypeOnly<old.IServiceAudienceEvents<any>>;\ndeclare function use_current_InterfaceDeclaration_IServiceAudienceEvents(\n use: TypeOnly<current.IServiceAudienceEvents<any>>): void;\nuse_current_InterfaceDeclaration_IServiceAudienceEvents(\n get_old_InterfaceDeclaration_IServiceAudienceEvents());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IServiceAudienceEvents\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_IServiceAudienceEvents():\n TypeOnly<current.IServiceAudienceEvents<any>>;\ndeclare function use_old_InterfaceDeclaration_IServiceAudienceEvents(\n use: TypeOnly<old.IServiceAudienceEvents<any>>): void;\nuse_old_InterfaceDeclaration_IServiceAudienceEvents(\n get_current_InterfaceDeclaration_IServiceAudienceEvents());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"TypeAliasDeclaration_InitialObjects\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_TypeAliasDeclaration_InitialObjects():\n TypeOnly<old.InitialObjects<any>>;\ndeclare function use_current_TypeAliasDeclaration_InitialObjects(\n use: TypeOnly<current.InitialObjects<any>>): void;\nuse_current_TypeAliasDeclaration_InitialObjects(\n get_old_TypeAliasDeclaration_InitialObjects());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"TypeAliasDeclaration_InitialObjects\": {\"backCompat\": false}\n*/\ndeclare function get_current_TypeAliasDeclaration_InitialObjects():\n TypeOnly<current.InitialObjects<any>>;\ndeclare function use_old_TypeAliasDeclaration_InitialObjects(\n use: TypeOnly<old.InitialObjects<any>>): void;\nuse_old_TypeAliasDeclaration_InitialObjects(\n get_current_TypeAliasDeclaration_InitialObjects());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"TypeAliasDeclaration_LoadableObjectClass\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_TypeAliasDeclaration_LoadableObjectClass():\n TypeOnly<old.LoadableObjectClass<any>>;\ndeclare function use_current_TypeAliasDeclaration_LoadableObjectClass(\n use: TypeOnly<current.LoadableObjectClass>): void;\nuse_current_TypeAliasDeclaration_LoadableObjectClass(\n get_old_TypeAliasDeclaration_LoadableObjectClass());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"TypeAliasDeclaration_LoadableObjectClass\": {\"backCompat\": false}\n*/\ndeclare function get_current_TypeAliasDeclaration_LoadableObjectClass():\n TypeOnly<current.LoadableObjectClass>;\ndeclare function use_old_TypeAliasDeclaration_LoadableObjectClass(\n use: TypeOnly<old.LoadableObjectClass<any>>): void;\nuse_old_TypeAliasDeclaration_LoadableObjectClass(\n get_current_TypeAliasDeclaration_LoadableObjectClass());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"TypeAliasDeclaration_LoadableObjectClassRecord\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_TypeAliasDeclaration_LoadableObjectClassRecord():\n TypeOnly<old.LoadableObjectClassRecord>;\ndeclare function use_current_TypeAliasDeclaration_LoadableObjectClassRecord(\n use: TypeOnly<current.LoadableObjectClassRecord>): void;\nuse_current_TypeAliasDeclaration_LoadableObjectClassRecord(\n get_old_TypeAliasDeclaration_LoadableObjectClassRecord());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"TypeAliasDeclaration_LoadableObjectClassRecord\": {\"backCompat\": false}\n*/\ndeclare function get_current_TypeAliasDeclaration_LoadableObjectClassRecord():\n TypeOnly<current.LoadableObjectClassRecord>;\ndeclare function use_old_TypeAliasDeclaration_LoadableObjectClassRecord(\n use: TypeOnly<old.LoadableObjectClassRecord>): void;\nuse_old_TypeAliasDeclaration_LoadableObjectClassRecord(\n get_current_TypeAliasDeclaration_LoadableObjectClassRecord());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"TypeAliasDeclaration_LoadableObjectCtor\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_TypeAliasDeclaration_LoadableObjectCtor():\n TypeOnly<old.LoadableObjectCtor<any>>;\ndeclare function use_current_TypeAliasDeclaration_LoadableObjectCtor(\n use: TypeOnly<current.LoadableObjectCtor<any>>): void;\nuse_current_TypeAliasDeclaration_LoadableObjectCtor(\n get_old_TypeAliasDeclaration_LoadableObjectCtor());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"TypeAliasDeclaration_LoadableObjectCtor\": {\"backCompat\": false}\n*/\ndeclare function get_current_TypeAliasDeclaration_LoadableObjectCtor():\n TypeOnly<current.LoadableObjectCtor<any>>;\ndeclare function use_old_TypeAliasDeclaration_LoadableObjectCtor(\n use: TypeOnly<old.LoadableObjectCtor<any>>): void;\nuse_old_TypeAliasDeclaration_LoadableObjectCtor(\n get_current_TypeAliasDeclaration_LoadableObjectCtor());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"TypeAliasDeclaration_LoadableObjectRecord\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_TypeAliasDeclaration_LoadableObjectRecord():\n TypeOnly<old.LoadableObjectRecord>;\ndeclare function use_current_TypeAliasDeclaration_LoadableObjectRecord(\n use: TypeOnly<current.LoadableObjectRecord>): void;\nuse_current_TypeAliasDeclaration_LoadableObjectRecord(\n get_old_TypeAliasDeclaration_LoadableObjectRecord());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"TypeAliasDeclaration_LoadableObjectRecord\": {\"backCompat\": false}\n*/\ndeclare function get_current_TypeAliasDeclaration_LoadableObjectRecord():\n TypeOnly<current.LoadableObjectRecord>;\ndeclare function use_old_TypeAliasDeclaration_LoadableObjectRecord(\n use: TypeOnly<old.LoadableObjectRecord>): void;\nuse_old_TypeAliasDeclaration_LoadableObjectRecord(\n get_current_TypeAliasDeclaration_LoadableObjectRecord());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"TypeAliasDeclaration_MemberChangedListener\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_TypeAliasDeclaration_MemberChangedListener():\n TypeOnly<old.MemberChangedListener<any>>;\ndeclare function use_current_TypeAliasDeclaration_MemberChangedListener(\n use: TypeOnly<current.MemberChangedListener<any>>): void;\nuse_current_TypeAliasDeclaration_MemberChangedListener(\n get_old_TypeAliasDeclaration_MemberChangedListener());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"TypeAliasDeclaration_MemberChangedListener\": {\"backCompat\": false}\n*/\ndeclare function get_current_TypeAliasDeclaration_MemberChangedListener():\n TypeOnly<current.MemberChangedListener<any>>;\ndeclare function use_old_TypeAliasDeclaration_MemberChangedListener(\n use: TypeOnly<old.MemberChangedListener<any>>): void;\nuse_old_TypeAliasDeclaration_MemberChangedListener(\n get_current_TypeAliasDeclaration_MemberChangedListener());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"TypeAliasDeclaration_Myself\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_TypeAliasDeclaration_Myself():\n TypeOnly<old.Myself>;\ndeclare function use_current_TypeAliasDeclaration_Myself(\n use: TypeOnly<current.Myself>): void;\nuse_current_TypeAliasDeclaration_Myself(\n get_old_TypeAliasDeclaration_Myself());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"TypeAliasDeclaration_Myself\": {\"backCompat\": false}\n*/\ndeclare function get_current_TypeAliasDeclaration_Myself():\n TypeOnly<current.Myself>;\ndeclare function use_old_TypeAliasDeclaration_Myself(\n use: TypeOnly<old.Myself>): void;\nuse_old_TypeAliasDeclaration_Myself(\n get_current_TypeAliasDeclaration_Myself());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"RemovedTypeAliasDeclaration_SharedObjectClass\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_TypeAliasDeclaration_SharedObjectClass():\n TypeOnly<old.SharedObjectClass<any>>;\ndeclare function use_current_RemovedTypeAliasDeclaration_SharedObjectClass(\n use: TypeOnly<current.SharedObjectClass<any>>): void;\nuse_current_RemovedTypeAliasDeclaration_SharedObjectClass(\n get_old_TypeAliasDeclaration_SharedObjectClass());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"RemovedTypeAliasDeclaration_SharedObjectClass\": {\"backCompat\": false}\n*/\ndeclare function get_current_RemovedTypeAliasDeclaration_SharedObjectClass():\n TypeOnly<current.SharedObjectClass<any>>;\ndeclare function use_old_TypeAliasDeclaration_SharedObjectClass(\n use: TypeOnly<old.SharedObjectClass<any>>): void;\nuse_old_TypeAliasDeclaration_SharedObjectClass(\n get_current_RemovedTypeAliasDeclaration_SharedObjectClass());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_createDOProviderContainerRuntimeFactory\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_FunctionDeclaration_createDOProviderContainerRuntimeFactory():\n TypeOnly<typeof old.createDOProviderContainerRuntimeFactory>;\ndeclare function use_current_FunctionDeclaration_createDOProviderContainerRuntimeFactory(\n use: TypeOnly<typeof current.createDOProviderContainerRuntimeFactory>): void;\nuse_current_FunctionDeclaration_createDOProviderContainerRuntimeFactory(\n get_old_FunctionDeclaration_createDOProviderContainerRuntimeFactory());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_createDOProviderContainerRuntimeFactory\": {\"backCompat\": false}\n*/\ndeclare function get_current_FunctionDeclaration_createDOProviderContainerRuntimeFactory():\n TypeOnly<typeof current.createDOProviderContainerRuntimeFactory>;\ndeclare function use_old_FunctionDeclaration_createDOProviderContainerRuntimeFactory(\n use: TypeOnly<typeof old.createDOProviderContainerRuntimeFactory>): void;\nuse_old_FunctionDeclaration_createDOProviderContainerRuntimeFactory(\n get_current_FunctionDeclaration_createDOProviderContainerRuntimeFactory());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_createFluidContainer\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_FunctionDeclaration_createFluidContainer():\n TypeOnly<typeof old.createFluidContainer>;\ndeclare function use_current_FunctionDeclaration_createFluidContainer(\n use: TypeOnly<typeof current.createFluidContainer>): void;\nuse_current_FunctionDeclaration_createFluidContainer(\n get_old_FunctionDeclaration_createFluidContainer());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_createFluidContainer\": {\"backCompat\": false}\n*/\ndeclare function get_current_FunctionDeclaration_createFluidContainer():\n TypeOnly<typeof current.createFluidContainer>;\ndeclare function use_old_FunctionDeclaration_createFluidContainer(\n use: TypeOnly<typeof old.createFluidContainer>): void;\nuse_old_FunctionDeclaration_createFluidContainer(\n get_current_FunctionDeclaration_createFluidContainer());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_createServiceAudience\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_FunctionDeclaration_createServiceAudience():\n TypeOnly<typeof old.createServiceAudience>;\ndeclare function use_current_FunctionDeclaration_createServiceAudience(\n use: TypeOnly<typeof current.createServiceAudience>): void;\nuse_current_FunctionDeclaration_createServiceAudience(\n get_old_FunctionDeclaration_createServiceAudience());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_createServiceAudience\": {\"backCompat\": false}\n*/\ndeclare function get_current_FunctionDeclaration_createServiceAudience():\n TypeOnly<typeof current.createServiceAudience>;\ndeclare function use_old_FunctionDeclaration_createServiceAudience(\n use: TypeOnly<typeof old.createServiceAudience>): void;\nuse_old_FunctionDeclaration_createServiceAudience(\n get_current_FunctionDeclaration_createServiceAudience());\n"]}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { strict as assert } from "node:assert";
|
|
6
|
+
import { DataObject, DataObjectFactory } from "@fluidframework/aqueduct";
|
|
7
|
+
import { MapFactory, SharedMap } from "@fluidframework/map";
|
|
8
|
+
import { SharedString, SharedStringFactory } from "@fluidframework/sequence";
|
|
9
|
+
import { parseDataObjectsFromSharedObjects } from "../utils.js";
|
|
10
|
+
class TestDataObject extends DataObject {
|
|
11
|
+
}
|
|
12
|
+
TestDataObject.Name = "@fluid-example/test-data-object";
|
|
13
|
+
TestDataObject.factory = new DataObjectFactory(TestDataObject.Name, TestDataObject, [], {});
|
|
14
|
+
describe("parseDataObjectsFromSharedObjects", () => {
|
|
15
|
+
it("should be able to handle basic DDS types", () => {
|
|
16
|
+
const schema = {
|
|
17
|
+
initialObjects: {
|
|
18
|
+
map: SharedMap,
|
|
19
|
+
text: SharedString,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
const [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(schema);
|
|
23
|
+
assert.strictEqual(registryEntries.length, 0, "We should have no registry entries");
|
|
24
|
+
assert.strictEqual(sharedObjects.length, 2, "We should have 2 shared objects");
|
|
25
|
+
const types = sharedObjects.map((item) => item.type);
|
|
26
|
+
assert.strictEqual(types[0], MapFactory.Type, "SharedMap should be included");
|
|
27
|
+
assert.strictEqual(types[1], SharedStringFactory.Type, "SharedString should be included");
|
|
28
|
+
});
|
|
29
|
+
it("should be able to handle dup DDS types", () => {
|
|
30
|
+
const schema = {
|
|
31
|
+
initialObjects: {
|
|
32
|
+
map: SharedMap,
|
|
33
|
+
text: SharedString,
|
|
34
|
+
text2: SharedString,
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
const [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(schema);
|
|
38
|
+
assert.strictEqual(registryEntries.length, 0, "We should have no registry entries");
|
|
39
|
+
assert.strictEqual(sharedObjects.length, 2, "We should have 2 shared objects");
|
|
40
|
+
const types = sharedObjects.map((item) => item.type);
|
|
41
|
+
assert.strictEqual(types[0], MapFactory.Type, "SharedMap should be included");
|
|
42
|
+
assert.strictEqual(types[1], SharedStringFactory.Type, "SharedString should be included");
|
|
43
|
+
});
|
|
44
|
+
it("should be able to handle Data Objects", () => {
|
|
45
|
+
const schema = {
|
|
46
|
+
initialObjects: {
|
|
47
|
+
map: SharedMap,
|
|
48
|
+
do: TestDataObject,
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
const [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(schema);
|
|
52
|
+
assert.strictEqual(registryEntries.length, 1, "We should have one registry entry");
|
|
53
|
+
assert.strictEqual(sharedObjects.length, 1, "We should have 1 shared object");
|
|
54
|
+
const types = registryEntries.map((item) => item[0]);
|
|
55
|
+
assert.strictEqual(types[0], TestDataObject.Name, "TestDataObject should be included");
|
|
56
|
+
});
|
|
57
|
+
it("should be able to dedup Data Objects", () => {
|
|
58
|
+
const schema = {
|
|
59
|
+
initialObjects: {
|
|
60
|
+
map: SharedMap,
|
|
61
|
+
do: TestDataObject,
|
|
62
|
+
do2: TestDataObject,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
const [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(schema);
|
|
66
|
+
assert.strictEqual(registryEntries.length, 1, "We should have one registry entry");
|
|
67
|
+
assert.strictEqual(sharedObjects.length, 1, "We should have 1 shared object");
|
|
68
|
+
const types = registryEntries.map((item) => item[0]);
|
|
69
|
+
assert.strictEqual(types[0], TestDataObject.Name, "TestDataObject should be included");
|
|
70
|
+
});
|
|
71
|
+
it("should be able to dedup Data Objects even if passed as dynamic types", () => {
|
|
72
|
+
const schema = {
|
|
73
|
+
initialObjects: {
|
|
74
|
+
map: SharedMap,
|
|
75
|
+
do: TestDataObject,
|
|
76
|
+
},
|
|
77
|
+
dynamicObjectTypes: [SharedString, TestDataObject],
|
|
78
|
+
};
|
|
79
|
+
const [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(schema);
|
|
80
|
+
assert.strictEqual(registryEntries.length, 1, "We should have one registry entry");
|
|
81
|
+
assert.strictEqual(sharedObjects.length, 2, "We should have 2 shared object");
|
|
82
|
+
const types = registryEntries.map((item) => item[0]);
|
|
83
|
+
assert.strictEqual(types[0], TestDataObject.Name, "TestDataObject should be included");
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
//# sourceMappingURL=utils.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.spec.js","sourceRoot":"","sources":["../../src/test/utils.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EA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AAM,CAAC,WAAW,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,gCAAgC,CAAC,CAAC;QAE9E,MAAM,KAAK,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACrD,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC,IAAI,EAAE,mCAAmC,CAAC,CAAC;IACxF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"node:assert\";\nimport { DataObject, DataObjectFactory } from \"@fluidframework/aqueduct\";\nimport { MapFactory, SharedMap } from \"@fluidframework/map\";\nimport { SharedString, SharedStringFactory } from \"@fluidframework/sequence\";\nimport { parseDataObjectsFromSharedObjects } from \"../utils.js\";\nimport { type ContainerSchema } from \"../types.js\";\n\nclass TestDataObject extends DataObject {\n\tpublic static readonly Name = \"@fluid-example/test-data-object\";\n\n\tpublic static readonly factory = new DataObjectFactory(\n\t\tTestDataObject.Name,\n\t\tTestDataObject,\n\t\t[],\n\t\t{},\n\t);\n}\n\ndescribe(\"parseDataObjectsFromSharedObjects\", () => {\n\tit(\"should be able to handle basic DDS types\", () => {\n\t\tconst schema = {\n\t\t\tinitialObjects: {\n\t\t\t\tmap: SharedMap,\n\t\t\t\ttext: SharedString,\n\t\t\t},\n\t\t} satisfies ContainerSchema;\n\t\tconst [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(schema);\n\n\t\tassert.strictEqual(registryEntries.length, 0, \"We should have no registry entries\");\n\t\tassert.strictEqual(sharedObjects.length, 2, \"We should have 2 shared objects\");\n\n\t\tconst types = sharedObjects.map((item) => item.type);\n\t\tassert.strictEqual(types[0], MapFactory.Type, \"SharedMap should be included\");\n\t\tassert.strictEqual(types[1], SharedStringFactory.Type, \"SharedString should be included\");\n\t});\n\n\tit(\"should be able to handle dup DDS types\", () => {\n\t\tconst schema = {\n\t\t\tinitialObjects: {\n\t\t\t\tmap: SharedMap,\n\t\t\t\ttext: SharedString,\n\t\t\t\ttext2: SharedString,\n\t\t\t},\n\t\t} satisfies ContainerSchema;\n\t\tconst [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(schema);\n\n\t\tassert.strictEqual(registryEntries.length, 0, \"We should have no registry entries\");\n\t\tassert.strictEqual(sharedObjects.length, 2, \"We should have 2 shared objects\");\n\n\t\tconst types = sharedObjects.map((item) => item.type);\n\t\tassert.strictEqual(types[0], MapFactory.Type, \"SharedMap should be included\");\n\t\tassert.strictEqual(types[1], SharedStringFactory.Type, \"SharedString should be included\");\n\t});\n\n\tit(\"should be able to handle Data Objects\", () => {\n\t\tconst schema = {\n\t\t\tinitialObjects: {\n\t\t\t\tmap: SharedMap,\n\t\t\t\tdo: TestDataObject,\n\t\t\t},\n\t\t} satisfies ContainerSchema;\n\t\tconst [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(schema);\n\n\t\tassert.strictEqual(registryEntries.length, 1, \"We should have one registry entry\");\n\t\tassert.strictEqual(sharedObjects.length, 1, \"We should have 1 shared object\");\n\n\t\tconst types = registryEntries.map((item) => item[0]);\n\t\tassert.strictEqual(types[0], TestDataObject.Name, \"TestDataObject should be included\");\n\t});\n\n\tit(\"should be able to dedup Data Objects\", () => {\n\t\tconst schema = {\n\t\t\tinitialObjects: {\n\t\t\t\tmap: SharedMap,\n\t\t\t\tdo: TestDataObject,\n\t\t\t\tdo2: TestDataObject,\n\t\t\t},\n\t\t} satisfies ContainerSchema;\n\t\tconst [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(schema);\n\n\t\tassert.strictEqual(registryEntries.length, 1, \"We should have one registry entry\");\n\t\tassert.strictEqual(sharedObjects.length, 1, \"We should have 1 shared object\");\n\n\t\tconst types = registryEntries.map((item) => item[0]);\n\t\tassert.strictEqual(types[0], TestDataObject.Name, \"TestDataObject should be included\");\n\t});\n\n\tit(\"should be able to dedup Data Objects even if passed as dynamic types\", () => {\n\t\tconst schema: ContainerSchema = {\n\t\t\tinitialObjects: {\n\t\t\t\tmap: SharedMap,\n\t\t\t\tdo: TestDataObject,\n\t\t\t},\n\t\t\tdynamicObjectTypes: [SharedString, TestDataObject],\n\t\t} satisfies ContainerSchema;\n\t\tconst [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(schema);\n\n\t\tassert.strictEqual(registryEntries.length, 1, \"We should have one registry entry\");\n\t\tassert.strictEqual(sharedObjects.length, 2, \"We should have 2 shared object\");\n\n\t\tconst types = registryEntries.map((item) => item[0]);\n\t\tassert.strictEqual(types[0], TestDataObject.Name, \"TestDataObject should be included\");\n\t});\n});\n"]}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IEvent, IEventProvider, IFluidLoadable } from "@fluidframework/core-interfaces";
|
|
6
|
-
import { IChannelFactory } from "@fluidframework/datastore-definitions";
|
|
5
|
+
import { type IEvent, type IEventProvider, type IFluidLoadable } from "@fluidframework/core-interfaces";
|
|
6
|
+
import { type IChannelFactory } from "@fluidframework/datastore-definitions";
|
|
7
7
|
/**
|
|
8
8
|
* A mapping of string identifiers to instantiated `DataObject`s or `SharedObject`s.
|
|
9
9
|
* @internal
|
|
@@ -11,17 +11,24 @@ import { IChannelFactory } from "@fluidframework/datastore-definitions";
|
|
|
11
11
|
export type LoadableObjectRecord = Record<string, IFluidLoadable>;
|
|
12
12
|
/**
|
|
13
13
|
* A mapping of string identifiers to classes that will later be used to instantiate a corresponding `DataObject`
|
|
14
|
-
* or `SharedObject
|
|
14
|
+
* or `SharedObject`.
|
|
15
15
|
* @public
|
|
16
16
|
*/
|
|
17
|
-
export type LoadableObjectClassRecord = Record<string, LoadableObjectClass
|
|
17
|
+
export type LoadableObjectClassRecord = Record<string, LoadableObjectClass>;
|
|
18
18
|
/**
|
|
19
19
|
* A class object of `DataObject` or `SharedObject`.
|
|
20
20
|
*
|
|
21
21
|
* @typeParam T - The class of the `DataObject` or `SharedObject`.
|
|
22
22
|
* @public
|
|
23
|
+
*
|
|
24
|
+
* @privateRemarks
|
|
25
|
+
* There are some edge cases in TypeScript where the order of the members in a union matter.
|
|
26
|
+
* Once such edge case is when multiple members of a generic union partially match, and the type parameter is being inferred.
|
|
27
|
+
* In this case, its better to have the desired match and/or the simpler type first.
|
|
28
|
+
* 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.
|
|
29
|
+
* This is likely (a bug in TypeScript)[https://github.com/microsoft/TypeScript/issues/45809].
|
|
23
30
|
*/
|
|
24
|
-
export type LoadableObjectClass<T extends IFluidLoadable> =
|
|
31
|
+
export type LoadableObjectClass<T extends IFluidLoadable = IFluidLoadable> = SharedObjectClass<T> | DataObjectClass<T>;
|
|
25
32
|
/**
|
|
26
33
|
* A class that has a factory that can create a `DataObject` and a
|
|
27
34
|
* constructor that will return the type of the `DataObject`.
|
|
@@ -35,15 +42,17 @@ export type DataObjectClass<T extends IFluidLoadable> = {
|
|
|
35
42
|
};
|
|
36
43
|
} & LoadableObjectCtor<T>;
|
|
37
44
|
/**
|
|
38
|
-
* A
|
|
39
|
-
* constructor that will return the type of the `DataObject`.
|
|
45
|
+
* A factory that produces a factory that can create a DDSes (`SharedObject`s).
|
|
40
46
|
*
|
|
41
47
|
* @typeParam T - The class of the `SharedObject`.
|
|
42
48
|
* @public
|
|
43
49
|
*/
|
|
44
|
-
export
|
|
45
|
-
|
|
46
|
-
|
|
50
|
+
export interface SharedObjectClass<T extends IFluidLoadable> {
|
|
51
|
+
/**
|
|
52
|
+
* Gets the factory this factory is a wrapper for.
|
|
53
|
+
*/
|
|
54
|
+
readonly getFactory: () => IChannelFactory<T>;
|
|
55
|
+
}
|
|
47
56
|
/**
|
|
48
57
|
* An object with a constructor that will return an {@link @fluidframework/core-interfaces#IFluidLoadable}.
|
|
49
58
|
*
|
|
@@ -51,6 +60,11 @@ export type SharedObjectClass<T extends IFluidLoadable> = {
|
|
|
51
60
|
* @public
|
|
52
61
|
*/
|
|
53
62
|
export type LoadableObjectCtor<T extends IFluidLoadable> = new (...args: any[]) => T;
|
|
63
|
+
/**
|
|
64
|
+
* Represents properties that can be attached to a container.
|
|
65
|
+
* @public
|
|
66
|
+
*/
|
|
67
|
+
export type ContainerAttachProps<T = unknown> = T;
|
|
54
68
|
/**
|
|
55
69
|
* Declares the Fluid objects that will be available in the {@link IFluidContainer | Container}.
|
|
56
70
|
*
|
|
@@ -79,7 +93,7 @@ export interface ContainerSchema {
|
|
|
79
93
|
* }
|
|
80
94
|
* ```
|
|
81
95
|
*/
|
|
82
|
-
initialObjects: LoadableObjectClassRecord;
|
|
96
|
+
readonly initialObjects: LoadableObjectClassRecord;
|
|
83
97
|
/**
|
|
84
98
|
* Loadable objects that can be created after the initial {@link IFluidContainer | Container} creation.
|
|
85
99
|
*
|
|
@@ -90,7 +104,7 @@ export interface ContainerSchema {
|
|
|
90
104
|
* For best practice it's recommended to define all the dynamic types you create even if they are
|
|
91
105
|
* included via initialObjects.
|
|
92
106
|
*/
|
|
93
|
-
dynamicObjectTypes?: LoadableObjectClass
|
|
107
|
+
readonly dynamicObjectTypes?: readonly LoadableObjectClass[];
|
|
94
108
|
}
|
|
95
109
|
/**
|
|
96
110
|
* @internal
|
|
@@ -220,4 +234,4 @@ export interface IMember {
|
|
|
220
234
|
export type Myself<M extends IMember = IMember> = M & {
|
|
221
235
|
currentConnection: string;
|
|
222
236
|
};
|
|
223
|
-
//# sourceMappingURL=types.d.
|
|
237
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAC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;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC3B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,MAAM,WAAW,OAAO;IACvB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,WAAW,EAAE,WAAW,EAAE,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,IAAI,CAAC,GAAG;IAAE,iBAAiB,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
package/lib/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype IEvent,\n\ttype IEventProvider,\n\ttype IFluidLoadable,\n} from \"@fluidframework/core-interfaces\";\nimport { type IChannelFactory } from \"@fluidframework/datastore-definitions\";\n\n/**\n * A mapping of string identifiers to instantiated `DataObject`s or `SharedObject`s.\n * @internal\n */\nexport type LoadableObjectRecord = Record<string, IFluidLoadable>;\n\n/**\n * A mapping of string identifiers to classes that will later be used to instantiate a corresponding `DataObject`\n * or `SharedObject`.\n * @public\n */\nexport type LoadableObjectClassRecord = Record<string, LoadableObjectClass>;\n\n/**\n * A class object of `DataObject` or `SharedObject`.\n *\n * @typeParam T - The class of the `DataObject` or `SharedObject`.\n * @public\n *\n * @privateRemarks\n * There are some edge cases in TypeScript where the order of the members in a union matter.\n * Once such edge case is when multiple members of a generic union partially match, and the type parameter is being inferred.\n * In this case, its better to have the desired match and/or the simpler type first.\n * 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.\n * This is likely (a bug in TypeScript)[https://github.com/microsoft/TypeScript/issues/45809].\n */\nexport type LoadableObjectClass<T extends IFluidLoadable = IFluidLoadable> =\n\t| SharedObjectClass<T>\n\t| DataObjectClass<T>;\n\n/**\n * A class that has a factory that can create a `DataObject` and a\n * constructor that will return the type of the `DataObject`.\n *\n * @typeParam T - The class of the `DataObject`.\n * @public\n */\nexport type DataObjectClass<T extends IFluidLoadable> = {\n\treadonly factory: { IFluidDataStoreFactory: DataObjectClass<T>[\"factory\"] };\n} & LoadableObjectCtor<T>;\n\n/**\n * A factory that produces a factory that can create a DDSes (`SharedObject`s).\n *\n * @typeParam T - The class of the `SharedObject`.\n * @public\n */\nexport interface SharedObjectClass<T extends IFluidLoadable> {\n\t/**\n\t * Gets the factory this factory is a wrapper for.\n\t */\n\treadonly getFactory: () => IChannelFactory<T>;\n}\n\n/**\n * An object with a constructor that will return an {@link @fluidframework/core-interfaces#IFluidLoadable}.\n *\n * @typeParam T - The class of the loadable object.\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type LoadableObjectCtor<T extends IFluidLoadable> = new (...args: any[]) => T;\n\n/**\n * Represents properties that can be attached to a container.\n * @public\n */\nexport type ContainerAttachProps<T = unknown> = T;\n\n/**\n * Declares the Fluid objects that will be available in the {@link IFluidContainer | Container}.\n *\n * @remarks\n *\n * It includes both the instances of objects that are initially available upon `Container` creation, as well\n * as the types of objects that may be dynamically created throughout the lifetime of the `Container`.\n * @public\n */\nexport interface ContainerSchema {\n\t/**\n\t * Defines loadable objects that will be created when the {@link IFluidContainer | Container} is first created.\n\t *\n\t * @remarks It uses the key as the id and the value as the loadable object to create.\n\t *\n\t * @example\n\t *\n\t * In the example below two objects will be created when the `Container` is first\n\t * created. One with id \"map1\" that will return a `SharedMap` and the other with\n\t * id \"pair1\" that will return a `KeyValueDataObject`.\n\t *\n\t * ```typescript\n\t * {\n\t * map1: SharedMap,\n\t * pair1: KeyValueDataObject,\n\t * }\n\t * ```\n\t */\n\treadonly initialObjects: LoadableObjectClassRecord;\n\n\t/**\n\t * Loadable objects that can be created after the initial {@link IFluidContainer | Container} creation.\n\t *\n\t * @remarks\n\t *\n\t * Types defined in `initialObjects` will always be available and are not required to be provided here.\n\t *\n\t * For best practice it's recommended to define all the dynamic types you create even if they are\n\t * included via initialObjects.\n\t */\n\treadonly dynamicObjectTypes?: readonly LoadableObjectClass[];\n}\n\n/**\n * @internal\n */\nexport interface IProvideRootDataObject {\n\treadonly IRootDataObject: IRootDataObject;\n}\n\n/**\n * Holds the collection of objects that the container was initially created with, as well as provides the ability\n * to dynamically create further objects during usage.\n * @internal\n */\nexport interface IRootDataObject extends IProvideRootDataObject {\n\t/**\n\t * Provides a record of the initial objects defined on creation.\n\t */\n\treadonly initialObjects: LoadableObjectRecord;\n\n\t/**\n\t * Dynamically creates a new detached collaborative object (DDS/DataObject).\n\t *\n\t * @param objectClass - Type of the collaborative object to be created.\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\n/**\n * Signature for {@link IMember} change events.\n *\n * @param clientId - A unique identifier for the client.\n * @param member - The service-specific member object for the client.\n *\n * @see See {@link IServiceAudienceEvents} for usage details.\n * @public\n */\nexport type MemberChangedListener<M extends IMember> = (clientId: string, member: M) => void;\n\n/**\n * Events that trigger when the roster of members in the Fluid session change.\n *\n * @remarks\n *\n * Only changes that would be reflected in the returned map of {@link IServiceAudience}'s\n * {@link IServiceAudience.getMembers} method will emit events.\n *\n * @typeParam M - A service-specific {@link IMember} implementation.\n * @public\n */\nexport interface IServiceAudienceEvents<M extends IMember> extends IEvent {\n\t/**\n\t * Emitted when a {@link IMember | member}(s) are either added or removed.\n\t *\n\t * @eventProperty\n\t */\n\t(event: \"membersChanged\", listener: () => void): void;\n\n\t/**\n\t * Emitted when a {@link IMember | member} joins the audience.\n\t *\n\t * @eventProperty\n\t */\n\t(event: \"memberAdded\", listener: MemberChangedListener<M>): void;\n\n\t/**\n\t * Emitted when a {@link IMember | member} leaves the audience.\n\t *\n\t * @eventProperty\n\t */\n\t(event: \"memberRemoved\", listener: MemberChangedListener<M>): void;\n}\n\n/**\n * Base interface to be implemented to fetch each service's audience.\n *\n * @remarks\n *\n * The type parameter `M` allows consumers to further extend the client object with service-specific\n * details about the connecting client, such as device information, environment, or a username.\n *\n * @typeParam M - A service-specific {@link IMember} type.\n * @public\n */\nexport interface IServiceAudience<M extends IMember>\n\textends IEventProvider<IServiceAudienceEvents<M>> {\n\t/**\n\t * Returns an map of all users currently in the Fluid session where key is the userId and the value is the\n\t * member object. The implementation may choose to exclude certain connections from the returned map.\n\t * E.g. ServiceAudience excludes non-interactive connections to represent only the roster of live users.\n\t */\n\tgetMembers(): Map<string, M>;\n\n\t/**\n\t * Returns the current active user on this client once they are connected. Otherwise, returns undefined.\n\t */\n\tgetMyself(): Myself<M> | undefined;\n}\n\n/**\n * Base interface for information for each connection made to the Fluid session.\n *\n * @remarks This interface can be extended to provide additional information specific to each service.\n * @public\n */\nexport interface IConnection {\n\t/**\n\t * A unique ID for the connection. A single user may have multiple connections, each with a different ID.\n\t */\n\tid: string;\n\n\t/**\n\t * Whether the connection is in read or read/write mode.\n\t */\n\tmode: \"write\" | \"read\";\n}\n\n/**\n * Base interface to be implemented to fetch each service's member.\n *\n * @remarks This interface can be extended by each service to provide additional service-specific user metadata.\n * @public\n */\nexport interface IMember {\n\t/**\n\t * An ID for the user, unique among each individual user connecting to the session.\n\t */\n\tuserId: string;\n\n\t/**\n\t * The set of connections the user has made, e.g. from multiple tabs or devices.\n\t */\n\tconnections: IConnection[];\n}\n\n/**\n * An extended member object that includes currentConnection\n * @public\n */\nexport type Myself<M extends IMember = IMember> = M & { currentConnection: string };\n"]}
|
package/lib/utils.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { type IChannelFactory } from "@fluidframework/datastore-definitions";
|
|
6
|
+
import { type IFluidDataStoreFactory, type NamedFluidDataStoreRegistryEntry } from "@fluidframework/runtime-definitions";
|
|
7
|
+
import { type IFluidLoadable } from "@fluidframework/core-interfaces";
|
|
8
|
+
import { type ContainerSchema, type DataObjectClass, type LoadableObjectClass, type SharedObjectClass } from "./types.js";
|
|
9
|
+
/**
|
|
10
|
+
* An internal type used by the internal type guard isDataObjectClass to cast a
|
|
11
|
+
* DataObjectClass to a type that is strongly coupled to IFluidDataStoreFactory.
|
|
12
|
+
* Unlike the external and exported type DataObjectClass which is
|
|
13
|
+
* weakly coupled to the IFluidDataStoreFactory to prevent leaking internals.
|
|
14
|
+
*/
|
|
15
|
+
export type InternalDataObjectClass<T extends IFluidLoadable> = DataObjectClass<T> & Record<"factory", IFluidDataStoreFactory>;
|
|
16
|
+
/**
|
|
17
|
+
* Runtime check to determine if a class is a DataObject type.
|
|
18
|
+
*/
|
|
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>;
|
|
24
|
+
/**
|
|
25
|
+
* Runtime check to determine if a class is a SharedObject type
|
|
26
|
+
*/
|
|
27
|
+
export declare const isSharedObjectClass: (obj: unknown) => obj is SharedObjectClass<IFluidLoadable>;
|
|
28
|
+
/**
|
|
29
|
+
* The ContainerSchema consists of initialObjects and dynamicObjectTypes. These types can be
|
|
30
|
+
* of both SharedObject or DataObject. This function separates the two and returns a registry
|
|
31
|
+
* of DataObject types and an array of SharedObjects.
|
|
32
|
+
*/
|
|
33
|
+
export declare const parseDataObjectsFromSharedObjects: (schema: ContainerSchema) => [NamedFluidDataStoreRegistryEntry[], IChannelFactory[]];
|
|
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,22 +3,23 @@
|
|
|
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
|
|
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
|
*/
|
|
16
16
|
export const isSharedObjectClass = (obj) => {
|
|
17
|
-
|
|
17
|
+
const maybe = obj;
|
|
18
|
+
return maybe?.getFactory !== undefined;
|
|
18
19
|
};
|
|
19
20
|
/**
|
|
20
21
|
* The ContainerSchema consists of initialObjects and dynamicObjectTypes. These types can be
|
|
21
|
-
* of both SharedObject or DataObject. This function
|
|
22
|
+
* of both SharedObject or DataObject. This function separates the two and returns a registry
|
|
22
23
|
* of DataObject types and an array of SharedObjects.
|
|
23
24
|
*/
|
|
24
25
|
export const parseDataObjectsFromSharedObjects = (schema) => {
|
|
@@ -40,10 +41,12 @@ export const parseDataObjectsFromSharedObjects = (schema) => {
|
|
|
40
41
|
...Object.values(schema.initialObjects),
|
|
41
42
|
...(schema.dynamicObjectTypes ?? []),
|
|
42
43
|
]);
|
|
43
|
-
dedupedObjects
|
|
44
|
+
for (const obj of dedupedObjects) {
|
|
45
|
+
tryAddObject(obj);
|
|
46
|
+
}
|
|
44
47
|
if (registryEntries.size === 0 && sharedObjects.size === 0) {
|
|
45
48
|
throw new Error("Container cannot be initialized without any DataTypes");
|
|
46
49
|
}
|
|
47
|
-
return [
|
|
50
|
+
return [[...registryEntries], [...sharedObjects]];
|
|
48
51
|
};
|
|
49
|
-
//# sourceMappingURL=utils.
|
|
52
|
+
//# sourceMappingURL=utils.js.map
|
package/lib/utils.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAoCH;;GAEG;AACH,M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,cAAc,EAAE;QACjC,YAAY,CAAC,GAAG,CAAC,CAAC;KAClB;IAED,IAAI,eAAe,CAAC,IAAI,KAAK,CAAC,IAAI,aAAa,CAAC,IAAI,KAAK,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"]}
|