@fluidframework/synthesize 0.58.2002 → 0.59.1000
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dependencyContainer.js +1 -1
- package/dist/dependencyContainer.js.map +1 -1
- package/dist/test/tsconfig.tsbuildinfo +107 -39
- package/dist/test/types/validateSynthesizePrevious.js +21 -0
- package/dist/test/types/validateSynthesizePrevious.js.map +1 -0
- package/dist/types.d.ts +3 -3
- package/dist/types.js.map +1 -1
- package/lib/dependencyContainer.js +1 -1
- package/lib/dependencyContainer.js.map +1 -1
- package/lib/types.js.map +1 -1
- package/package.json +11 -6
|
@@ -65,7 +65,7 @@ class DependencyContainer {
|
|
|
65
65
|
*/
|
|
66
66
|
getProvider(provider) {
|
|
67
67
|
// this was removed, but some partners have trouble with back compat where they
|
|
68
|
-
// use invalid patterns with
|
|
68
|
+
// use invalid patterns with FluidObject and IFluidDependencySynthesizer
|
|
69
69
|
// this is just for back compat until those are removed
|
|
70
70
|
if (this.has(provider)) {
|
|
71
71
|
if (this.providers.has(provider)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencyContainer.js","sourceRoot":"","sources":["../src/dependencyContainer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH,+EAEuC;AAEvC;;;GAGG;AACH,MAAa,mBAAmB;IAK5B,YAAmB,GAAI,OAAoD;QAJ1D,cAAS,GAAG,IAAI,GAAG,EAAwC,CAAC;QAKzE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAoC,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;IAC5F,CAAC;IAJD,IAAW,2BAA2B,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC;IAMzD;;;;;OAKG;IACI,QAAQ,CAAoC,IAAO,EAAE,QAA4C;QACpG,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAC1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OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;wBACxC,IAAI,CAAC,EAAE;4BACH,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;yBACf;oBACL,CAAC,CAAC,CAAC;iBACN;YACL,CAAC;SACJ,CAAC;IACV,CAAC;CACJ;AAnKD,kDAmKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n AsyncFluidObjectProvider,\n FluidObjectSymbolProvider,\n FluidObjectProvider,\n AsyncOptionalFluidObjectProvider,\n AsyncRequiredFluidObjectProvider,\n} from \"./types\";\nimport {\n IFluidDependencySynthesizer,\n} from \"./IFluidDependencySynthesizer\";\n\n/**\n * DependencyContainer is similar to a IoC Container. It takes providers and will\n * synthesize an object based on them when requested.\n */\nexport class DependencyContainer<TMap> implements IFluidDependencySynthesizer {\n private readonly providers = new Map<keyof TMap, FluidObjectProvider<any>>();\n private readonly parents: IFluidDependencySynthesizer[];\n public get IFluidDependencySynthesizer() { return this; }\n\n public constructor(... parents: (IFluidDependencySynthesizer | undefined)[]) {\n this.parents = parents.filter((v): v is IFluidDependencySynthesizer => v !== undefined);\n }\n\n /**\n * Add a new provider\n * @param type - Name of the Type T being provided\n * @param provider - A provider that will resolve the T correctly when asked\n * @throws - If passing a type that's already registered\n */\n public register<T extends keyof TMap = keyof TMap>(type: T, provider: FluidObjectProvider<Pick<TMap, T>>): void {\n if (this.providers.has(type)) {\n throw new Error(`Attempting to register a provider of type ${type} that already exists`);\n }\n\n this.providers.set(type, provider);\n }\n\n /**\n * Remove a provider\n * @param type - Name of the provider to remove\n */\n public unregister(type: keyof TMap): void {\n if (this.providers.has(type)) {\n this.providers.delete(type);\n }\n }\n\n /**\n * {@inheritDoc (IFluidDependencySynthesizer:interface).synthesize}\n */\n public synthesize<O, R = undefined | Record<string, never>>(\n optionalTypes: FluidObjectSymbolProvider<O>,\n requiredTypes: Required<FluidObjectSymbolProvider<R>>,\n ): AsyncFluidObjectProvider<O, R> {\n const base: AsyncFluidObjectProvider<O, R> = {} as any;\n this.generateRequired<R>(base, requiredTypes);\n this.generateOptional<O>(base, optionalTypes);\n Object.defineProperty(base, IFluidDependencySynthesizer, { get: () => this });\n return base;\n }\n\n /**\n * {@inheritDoc (IFluidDependencySynthesizer:interface).has}\n * @param excludeParents - If true, exclude checking parent registries\n */\n public has(type: string, excludeParents?: boolean): boolean {\n if (this.providers.has(type as keyof TMap)) {\n return true;\n }\n if (excludeParents !== true) {\n return this.parents.some((p: IFluidDependencySynthesizer) => p.has(type));\n }\n return false;\n }\n /**\n * @deprecated - Needed for back compat\n */\n private getProvider(provider: string & keyof TMap) {\n // this was removed, but some partners have trouble with back compat where they\n // use invalid patterns with IFluidObject and IFluidDependencySynthesizer\n // this is just for back compat until those are removed\n if(this.has(provider)) {\n if(this.providers.has(provider)) {\n return this.providers.get(provider);\n }\n for(const parent of this.parents) {\n if(parent instanceof DependencyContainer) {\n return parent.getProvider(provider);\n }else{\n // older implementations of the IFluidDependencySynthesizer exposed getProvider\n const maybeGetProvider: {getProvider?(provider: string & keyof TMap)} = parent as any;\n if(maybeGetProvider?.getProvider !== undefined) {\n return maybeGetProvider.getProvider(provider);\n }\n }\n }\n }\n }\n\n private generateRequired<T>(\n base: AsyncRequiredFluidObjectProvider<T>,\n types: Required<FluidObjectSymbolProvider<T>>,\n ) {\n if (types === undefined) { return; }\n for (const key of Object.keys(types) as unknown as (keyof TMap)[]) {\n const provider = this.resolveProvider(key);\n if(provider === undefined) {\n throw new Error(`Object attempted to be created without registered required provider ${key}`);\n }\n Object.defineProperty(\n base,\n key,\n provider,\n );\n }\n }\n\n private generateOptional<T>(\n base: AsyncOptionalFluidObjectProvider<T>,\n types: FluidObjectSymbolProvider<T>,\n ) {\n if (types === undefined) { return; }\n for (const key of Object.keys(types) as unknown as (keyof TMap)[]) {\n // back-compat: in 0.56 we allow undefined in the types, but we didn't before\n // this will keep runtime back compat, eventually we should support undefined properties\n // rather than properties that return promises that resolve to undefined\n const provider = this.resolveProvider(key) ?? { get: async () => undefined };\n Object.defineProperty(\n base,\n key,\n provider,\n );\n }\n }\n\n private resolveProvider<T extends keyof TMap>(t: T): PropertyDescriptor | undefined {\n // If we have the provider return it\n const provider = this.providers.get(t);\n if (provider === undefined) {\n for (const parent of this.parents) {\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n const sp = { [t]: t } as FluidObjectSymbolProvider<Pick<TMap, T>>;\n const syn = parent.synthesize<Pick<TMap, T>,{}>(\n sp,\n {});\n const descriptor = Object.getOwnPropertyDescriptor(syn, t);\n if (descriptor !== undefined) {\n return descriptor;\n }\n }\n return undefined;\n }\n\n // The double nested gets are required for lazy loading the provider resolution\n if (typeof provider === \"function\") {\n return {\n get() {\n if (provider && typeof provider === \"function\") {\n return Promise.resolve(this[IFluidDependencySynthesizer])\n .then(async (fds): Promise<any> => provider(fds))\n .then((p) => p?.[t]);\n }\n },\n };\n }\n return {\n get() {\n if (provider) {\n return Promise.resolve(provider).then((p) => {\n if (p) {\n return p[t];\n }\n });\n }\n },\n };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dependencyContainer.js","sourceRoot":"","sources":["../src/dependencyContainer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH,+EAEuC;AAEvC;;;GAGG;AACH,MAAa,mBAAmB;IAK5B,YAAmB,GAAI,OAAoD;QAJ1D,cAAS,GAAG,IAAI,GAAG,EAAwC,CAAC;QAKzE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAoC,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;IAC5F,CAAC;IAJD,IAAW,2BAA2B,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC;IAMzD;;;;;OAKG;IACI,QAAQ,CAAoC,IAAO,EAAE,QAA4C;QACpG,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAA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,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;wBACxC,IAAI,CAAC,EAAE;4BACH,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;yBACf;oBACL,CAAC,CAAC,CAAC;iBACN;YACL,CAAC;SACJ,CAAC;IACV,CAAC;CACJ;AAnKD,kDAmKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n AsyncFluidObjectProvider,\n FluidObjectSymbolProvider,\n FluidObjectProvider,\n AsyncOptionalFluidObjectProvider,\n AsyncRequiredFluidObjectProvider,\n} from \"./types\";\nimport {\n IFluidDependencySynthesizer,\n} from \"./IFluidDependencySynthesizer\";\n\n/**\n * DependencyContainer is similar to a IoC Container. It takes providers and will\n * synthesize an object based on them when requested.\n */\nexport class DependencyContainer<TMap> implements IFluidDependencySynthesizer {\n private readonly providers = new Map<keyof TMap, FluidObjectProvider<any>>();\n private readonly parents: IFluidDependencySynthesizer[];\n public get IFluidDependencySynthesizer() { return this; }\n\n public constructor(... parents: (IFluidDependencySynthesizer | undefined)[]) {\n this.parents = parents.filter((v): v is IFluidDependencySynthesizer => v !== undefined);\n }\n\n /**\n * Add a new provider\n * @param type - Name of the Type T being provided\n * @param provider - A provider that will resolve the T correctly when asked\n * @throws - If passing a type that's already registered\n */\n public register<T extends keyof TMap = keyof TMap>(type: T, provider: FluidObjectProvider<Pick<TMap, T>>): void {\n if (this.providers.has(type)) {\n throw new Error(`Attempting to register a provider of type ${type} that already exists`);\n }\n\n this.providers.set(type, provider);\n }\n\n /**\n * Remove a provider\n * @param type - Name of the provider to remove\n */\n public unregister(type: keyof TMap): void {\n if (this.providers.has(type)) {\n this.providers.delete(type);\n }\n }\n\n /**\n * {@inheritDoc (IFluidDependencySynthesizer:interface).synthesize}\n */\n public synthesize<O, R = undefined | Record<string, never>>(\n optionalTypes: FluidObjectSymbolProvider<O>,\n requiredTypes: Required<FluidObjectSymbolProvider<R>>,\n ): AsyncFluidObjectProvider<O, R> {\n const base: AsyncFluidObjectProvider<O, R> = {} as any;\n this.generateRequired<R>(base, requiredTypes);\n this.generateOptional<O>(base, optionalTypes);\n Object.defineProperty(base, IFluidDependencySynthesizer, { get: () => this });\n return base;\n }\n\n /**\n * {@inheritDoc (IFluidDependencySynthesizer:interface).has}\n * @param excludeParents - If true, exclude checking parent registries\n */\n public has(type: string, excludeParents?: boolean): boolean {\n if (this.providers.has(type as keyof TMap)) {\n return true;\n }\n if (excludeParents !== true) {\n return this.parents.some((p: IFluidDependencySynthesizer) => p.has(type));\n }\n return false;\n }\n /**\n * @deprecated - Needed for back compat\n */\n private getProvider(provider: string & keyof TMap) {\n // this was removed, but some partners have trouble with back compat where they\n // use invalid patterns with FluidObject and IFluidDependencySynthesizer\n // this is just for back compat until those are removed\n if(this.has(provider)) {\n if(this.providers.has(provider)) {\n return this.providers.get(provider);\n }\n for(const parent of this.parents) {\n if(parent instanceof DependencyContainer) {\n return parent.getProvider(provider);\n }else{\n // older implementations of the IFluidDependencySynthesizer exposed getProvider\n const maybeGetProvider: {getProvider?(provider: string & keyof TMap)} = parent as any;\n if(maybeGetProvider?.getProvider !== undefined) {\n return maybeGetProvider.getProvider(provider);\n }\n }\n }\n }\n }\n\n private generateRequired<T>(\n base: AsyncRequiredFluidObjectProvider<T>,\n types: Required<FluidObjectSymbolProvider<T>>,\n ) {\n if (types === undefined) { return; }\n for (const key of Object.keys(types) as unknown as (keyof TMap)[]) {\n const provider = this.resolveProvider(key);\n if(provider === undefined) {\n throw new Error(`Object attempted to be created without registered required provider ${key}`);\n }\n Object.defineProperty(\n base,\n key,\n provider,\n );\n }\n }\n\n private generateOptional<T>(\n base: AsyncOptionalFluidObjectProvider<T>,\n types: FluidObjectSymbolProvider<T>,\n ) {\n if (types === undefined) { return; }\n for (const key of Object.keys(types) as unknown as (keyof TMap)[]) {\n // back-compat: in 0.56 we allow undefined in the types, but we didn't before\n // this will keep runtime back compat, eventually we should support undefined properties\n // rather than properties that return promises that resolve to undefined\n const provider = this.resolveProvider(key) ?? { get: async () => undefined };\n Object.defineProperty(\n base,\n key,\n provider,\n );\n }\n }\n\n private resolveProvider<T extends keyof TMap>(t: T): PropertyDescriptor | undefined {\n // If we have the provider return it\n const provider = this.providers.get(t);\n if (provider === undefined) {\n for (const parent of this.parents) {\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n const sp = { [t]: t } as FluidObjectSymbolProvider<Pick<TMap, T>>;\n const syn = parent.synthesize<Pick<TMap, T>, Record<string, unknown>>(\n sp,\n {});\n const descriptor = Object.getOwnPropertyDescriptor(syn, t);\n if (descriptor !== undefined) {\n return descriptor;\n }\n }\n return undefined;\n }\n\n // The double nested gets are required for lazy loading the provider resolution\n if (typeof provider === \"function\") {\n return {\n get() {\n if (provider && typeof provider === \"function\") {\n return Promise.resolve(this[IFluidDependencySynthesizer])\n .then(async (fds): Promise<any> => provider(fds))\n .then((p) => p?.[t]);\n }\n },\n };\n }\n return {\n get() {\n if (provider) {\n return Promise.resolve(provider).then((p) => {\n if (p) {\n return p[t];\n }\n });\n }\n },\n };\n }\n}\n"]}
|
|
@@ -152,18 +152,18 @@
|
|
|
152
152
|
"affectsGlobalScope": false
|
|
153
153
|
},
|
|
154
154
|
"../../../../../node_modules/@fluidframework/core-interfaces/dist/provider.d.ts": {
|
|
155
|
-
"version": "
|
|
156
|
-
"signature": "
|
|
155
|
+
"version": "ffe2fe2824ad18643c67bdea603c0b13ce0b8e03fcedd7e830c3621e7495b8e4",
|
|
156
|
+
"signature": "ffe2fe2824ad18643c67bdea603c0b13ce0b8e03fcedd7e830c3621e7495b8e4",
|
|
157
157
|
"affectsGlobalScope": false
|
|
158
158
|
},
|
|
159
159
|
"../../../../../node_modules/@fluidframework/core-interfaces/dist/handles.d.ts": {
|
|
160
|
-
"version": "
|
|
161
|
-
"signature": "
|
|
160
|
+
"version": "008b0f774aa53fadf66f518d63e53df8a1bb6389908ac361895f3acae06159df",
|
|
161
|
+
"signature": "008b0f774aa53fadf66f518d63e53df8a1bb6389908ac361895f3acae06159df",
|
|
162
162
|
"affectsGlobalScope": false
|
|
163
163
|
},
|
|
164
164
|
"../../../../../node_modules/@fluidframework/core-interfaces/dist/fluidLoadable.d.ts": {
|
|
165
|
-
"version": "
|
|
166
|
-
"signature": "
|
|
165
|
+
"version": "8692a1ed3a979fa000b62e01f8d33cf940e030b7af50945176428f9cdd4dca80",
|
|
166
|
+
"signature": "8692a1ed3a979fa000b62e01f8d33cf940e030b7af50945176428f9cdd4dca80",
|
|
167
167
|
"affectsGlobalScope": false
|
|
168
168
|
},
|
|
169
169
|
"../../../../../node_modules/@fluidframework/core-interfaces/dist/serializer.d.ts": {
|
|
@@ -172,8 +172,8 @@
|
|
|
172
172
|
"affectsGlobalScope": false
|
|
173
173
|
},
|
|
174
174
|
"../../../../../node_modules/@fluidframework/core-interfaces/dist/fluidObject.d.ts": {
|
|
175
|
-
"version": "
|
|
176
|
-
"signature": "
|
|
175
|
+
"version": "4de717c31e6a926ab75d60b15881fcb86eedfe4c86a10ecc7bcbb132b704ec25",
|
|
176
|
+
"signature": "4de717c31e6a926ab75d60b15881fcb86eedfe4c86a10ecc7bcbb132b704ec25",
|
|
177
177
|
"affectsGlobalScope": false
|
|
178
178
|
},
|
|
179
179
|
"../../../../../node_modules/@fluidframework/core-interfaces/dist/fluidPackage.d.ts": {
|
|
@@ -457,8 +457,8 @@
|
|
|
457
457
|
"affectsGlobalScope": false
|
|
458
458
|
},
|
|
459
459
|
"../../../../../node_modules/@fluidframework/protocol-definitions/dist/storage.d.ts": {
|
|
460
|
-
"version": "
|
|
461
|
-
"signature": "
|
|
460
|
+
"version": "400b71c3fd22577b532c14206b3e39f1cd13d7222e12a23f18253b1a8a573efc",
|
|
461
|
+
"signature": "400b71c3fd22577b532c14206b3e39f1cd13d7222e12a23f18253b1a8a573efc",
|
|
462
462
|
"affectsGlobalScope": false
|
|
463
463
|
},
|
|
464
464
|
"../../../../../node_modules/@fluidframework/protocol-definitions/dist/summary.d.ts": {
|
|
@@ -491,9 +491,14 @@
|
|
|
491
491
|
"signature": "383dced3ebba2967eeab64d0b7facd4529fe3ed2c352744f3f6c1988482206d4",
|
|
492
492
|
"affectsGlobalScope": false
|
|
493
493
|
},
|
|
494
|
+
"../../../../../node_modules/@fluidframework/container-definitions/dist/fluidPackage.d.ts": {
|
|
495
|
+
"version": "29af84fd868f666a8d2b0766b188faed869babeb3da5c556fc1151cc4e1e5153",
|
|
496
|
+
"signature": "29af84fd868f666a8d2b0766b188faed869babeb3da5c556fc1151cc4e1e5153",
|
|
497
|
+
"affectsGlobalScope": false
|
|
498
|
+
},
|
|
494
499
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/browserPackage.d.ts": {
|
|
495
|
-
"version": "
|
|
496
|
-
"signature": "
|
|
500
|
+
"version": "5a6da0fe8e8896c8f05057396d825d36506a1527de189150cf4d8dea3e794239",
|
|
501
|
+
"signature": "5a6da0fe8e8896c8f05057396d825d36506a1527de189150cf4d8dea3e794239",
|
|
497
502
|
"affectsGlobalScope": false
|
|
498
503
|
},
|
|
499
504
|
"../../../../../node_modules/@fluidframework/driver-definitions/dist/driverError.d.ts": {
|
|
@@ -502,13 +507,13 @@
|
|
|
502
507
|
"affectsGlobalScope": false
|
|
503
508
|
},
|
|
504
509
|
"../../../../../node_modules/@fluidframework/driver-definitions/dist/urlResolver.d.ts": {
|
|
505
|
-
"version": "
|
|
506
|
-
"signature": "
|
|
510
|
+
"version": "f46c512d895fa0c08acafd325c94189005255d382e4375b15d0274a107526b7f",
|
|
511
|
+
"signature": "f46c512d895fa0c08acafd325c94189005255d382e4375b15d0274a107526b7f",
|
|
507
512
|
"affectsGlobalScope": false
|
|
508
513
|
},
|
|
509
514
|
"../../../../../node_modules/@fluidframework/driver-definitions/dist/storage.d.ts": {
|
|
510
|
-
"version": "
|
|
511
|
-
"signature": "
|
|
515
|
+
"version": "23333bf4703c216fc9707c31b1c80d913f0dcbb66b2603011a399c5bc517cc84",
|
|
516
|
+
"signature": "23333bf4703c216fc9707c31b1c80d913f0dcbb66b2603011a399c5bc517cc84",
|
|
512
517
|
"affectsGlobalScope": false
|
|
513
518
|
},
|
|
514
519
|
"../../../../../node_modules/@fluidframework/driver-definitions/dist/index.d.ts": {
|
|
@@ -527,18 +532,18 @@
|
|
|
527
532
|
"affectsGlobalScope": false
|
|
528
533
|
},
|
|
529
534
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/fluidModule.d.ts": {
|
|
530
|
-
"version": "
|
|
531
|
-
"signature": "
|
|
535
|
+
"version": "8023ac345236d4f16563d8dee36b7db6a3b58d2d478c2de674cbd70ce0249737",
|
|
536
|
+
"signature": "8023ac345236d4f16563d8dee36b7db6a3b58d2d478c2de674cbd70ce0249737",
|
|
532
537
|
"affectsGlobalScope": false
|
|
533
538
|
},
|
|
534
539
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/loader.d.ts": {
|
|
535
|
-
"version": "
|
|
536
|
-
"signature": "
|
|
540
|
+
"version": "dbf77f0154be728232944a67288f6908c748de6fe160e074b048e0579f3d4900",
|
|
541
|
+
"signature": "dbf77f0154be728232944a67288f6908c748de6fe160e074b048e0579f3d4900",
|
|
537
542
|
"affectsGlobalScope": false
|
|
538
543
|
},
|
|
539
544
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/runtime.d.ts": {
|
|
540
|
-
"version": "
|
|
541
|
-
"signature": "
|
|
545
|
+
"version": "597fef4eabc67556e36afaefae4d924153cd3dace784f44529891dffda5abe7e",
|
|
546
|
+
"signature": "597fef4eabc67556e36afaefae4d924153cd3dace784f44529891dffda5abe7e",
|
|
542
547
|
"affectsGlobalScope": false
|
|
543
548
|
},
|
|
544
549
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/legacy/index.d.ts": {
|
|
@@ -546,11 +551,6 @@
|
|
|
546
551
|
"signature": "419d3554e67aed44fbad75878a168ec530032ea11a2572c769e98d15b91cad81",
|
|
547
552
|
"affectsGlobalScope": false
|
|
548
553
|
},
|
|
549
|
-
"../../../../../node_modules/@fluidframework/container-definitions/dist/fluidPackage.d.ts": {
|
|
550
|
-
"version": "29af84fd868f666a8d2b0766b188faed869babeb3da5c556fc1151cc4e1e5153",
|
|
551
|
-
"signature": "29af84fd868f666a8d2b0766b188faed869babeb3da5c556fc1151cc4e1e5153",
|
|
552
|
-
"affectsGlobalScope": false
|
|
553
|
-
},
|
|
554
554
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/proxyLoader.d.ts": {
|
|
555
555
|
"version": "0ee40e5e446be73c62334a574d628dac014b292699bca2527d2abb99b8e31bf9",
|
|
556
556
|
"signature": "0ee40e5e446be73c62334a574d628dac014b292699bca2527d2abb99b8e31bf9",
|
|
@@ -707,8 +707,8 @@
|
|
|
707
707
|
"affectsGlobalScope": false
|
|
708
708
|
},
|
|
709
709
|
"../../../../runtime/runtime-definitions/dist/dataStoreContext.d.ts": {
|
|
710
|
-
"version": "
|
|
711
|
-
"signature": "
|
|
710
|
+
"version": "2137a49910486c5f9a6a028bc19d2afbbfc147885e46ebcb434d1ecb24983821",
|
|
711
|
+
"signature": "2137a49910486c5f9a6a028bc19d2afbbfc147885e46ebcb434d1ecb24983821",
|
|
712
712
|
"affectsGlobalScope": false
|
|
713
713
|
},
|
|
714
714
|
"../../../../runtime/runtime-definitions/dist/dataStoreFactory.d.ts": {
|
|
@@ -752,13 +752,13 @@
|
|
|
752
752
|
"affectsGlobalScope": false
|
|
753
753
|
},
|
|
754
754
|
"../../../../runtime/datastore/dist/dataStoreRuntime.d.ts": {
|
|
755
|
-
"version": "
|
|
756
|
-
"signature": "
|
|
755
|
+
"version": "0161b59129dab096029007e9bb4eb287d6aafe5131943bd99ffbe942df0cb312",
|
|
756
|
+
"signature": "0161b59129dab096029007e9bb4eb287d6aafe5131943bd99ffbe942df0cb312",
|
|
757
757
|
"affectsGlobalScope": false
|
|
758
758
|
},
|
|
759
759
|
"../../../../runtime/datastore/dist/fluidHandle.d.ts": {
|
|
760
|
-
"version": "
|
|
761
|
-
"signature": "
|
|
760
|
+
"version": "fa2391e2793c9deed82cbdc69ca6ec910498b73d02aefd1fbce7080a69ec3eef",
|
|
761
|
+
"signature": "fa2391e2793c9deed82cbdc69ca6ec910498b73d02aefd1fbce7080a69ec3eef",
|
|
762
762
|
"affectsGlobalScope": false
|
|
763
763
|
},
|
|
764
764
|
"../../../../runtime/datastore/dist/index.d.ts": {
|
|
@@ -767,8 +767,8 @@
|
|
|
767
767
|
"affectsGlobalScope": false
|
|
768
768
|
},
|
|
769
769
|
"../types.d.ts": {
|
|
770
|
-
"version": "
|
|
771
|
-
"signature": "
|
|
770
|
+
"version": "0019f06f88e66fa5371d8eebb0e81dc749e54a8f65f8ec9b59760c77e759e46e",
|
|
771
|
+
"signature": "0019f06f88e66fa5371d8eebb0e81dc749e54a8f65f8ec9b59760c77e759e46e",
|
|
772
772
|
"affectsGlobalScope": false
|
|
773
773
|
},
|
|
774
774
|
"../IFluidDependencySynthesizer.d.ts": {
|
|
@@ -791,6 +791,31 @@
|
|
|
791
791
|
"signature": "abc949a48872f03572ff3108a999c28e5e394296186194fa9e4ad357fa3cfcd7",
|
|
792
792
|
"affectsGlobalScope": false
|
|
793
793
|
},
|
|
794
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/types.d.ts": {
|
|
795
|
+
"version": "461180d6ff91eb3902b1a5fa34185327d785e059fdc52ad2fe2b0a16c0960489",
|
|
796
|
+
"signature": "461180d6ff91eb3902b1a5fa34185327d785e059fdc52ad2fe2b0a16c0960489",
|
|
797
|
+
"affectsGlobalScope": false
|
|
798
|
+
},
|
|
799
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/IFluidDependencySynthesizer.d.ts": {
|
|
800
|
+
"version": "a15809b8be1e3dd5a4f89df2886c9609eff56afa7b5e262adae346dc81d80a19",
|
|
801
|
+
"signature": "a15809b8be1e3dd5a4f89df2886c9609eff56afa7b5e262adae346dc81d80a19",
|
|
802
|
+
"affectsGlobalScope": false
|
|
803
|
+
},
|
|
804
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/dependencyContainer.d.ts": {
|
|
805
|
+
"version": "abbf5a289e8fbe488cf30a8024ebb89cafa6ab47277ffe735ce2dd18fe1ca107",
|
|
806
|
+
"signature": "abbf5a289e8fbe488cf30a8024ebb89cafa6ab47277ffe735ce2dd18fe1ca107",
|
|
807
|
+
"affectsGlobalScope": false
|
|
808
|
+
},
|
|
809
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/index.d.ts": {
|
|
810
|
+
"version": "48010a1e04aff055895b4d95949566d9cd43f356bf1d989548dcbe34b07e0702",
|
|
811
|
+
"signature": "48010a1e04aff055895b4d95949566d9cd43f356bf1d989548dcbe34b07e0702",
|
|
812
|
+
"affectsGlobalScope": false
|
|
813
|
+
},
|
|
814
|
+
"../../src/test/types/validateSynthesizePrevious.ts": {
|
|
815
|
+
"version": "a468afb6b7ceb12b0f43c2c7ec6b299188f150e68e1c3f9f24dacf7418502bf6",
|
|
816
|
+
"signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881",
|
|
817
|
+
"affectsGlobalScope": false
|
|
818
|
+
},
|
|
794
819
|
"../../../../../node_modules/@types/mocha/index.d.ts": {
|
|
795
820
|
"version": "5f186a758a616c107c70e8918db4630d063bd782f22e6e0b17573b125765b40b",
|
|
796
821
|
"signature": "5f186a758a616c107c70e8918db4630d063bd782f22e6e0b17573b125765b40b",
|
|
@@ -887,7 +912,7 @@
|
|
|
887
912
|
"../../../../../node_modules/@types/node/index.d.ts"
|
|
888
913
|
],
|
|
889
914
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/browserPackage.d.ts": [
|
|
890
|
-
"../../../../../node_modules/@fluidframework/
|
|
915
|
+
"../../../../../node_modules/@fluidframework/container-definitions/dist/fluidPackage.d.ts"
|
|
891
916
|
],
|
|
892
917
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/deltas.d.ts": [
|
|
893
918
|
"../../../../../node_modules/@fluidframework/common-definitions/dist/index.d.ts",
|
|
@@ -901,6 +926,7 @@
|
|
|
901
926
|
"../../../../../node_modules/@fluidframework/common-definitions/dist/index.d.ts"
|
|
902
927
|
],
|
|
903
928
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/fluidModule.d.ts": [
|
|
929
|
+
"../../../../../node_modules/@fluidframework/container-definitions/dist/fluidPackage.d.ts",
|
|
904
930
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/runtime.d.ts",
|
|
905
931
|
"../../../../../node_modules/@fluidframework/core-interfaces/dist/index.d.ts"
|
|
906
932
|
],
|
|
@@ -929,6 +955,7 @@
|
|
|
929
955
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/deltas.d.ts",
|
|
930
956
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/error.d.ts",
|
|
931
957
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/fluidModule.d.ts",
|
|
958
|
+
"../../../../../node_modules/@fluidframework/container-definitions/dist/fluidPackage.d.ts",
|
|
932
959
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/legacy/index.d.ts",
|
|
933
960
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/runtime.d.ts",
|
|
934
961
|
"../../../../../node_modules/@fluidframework/core-interfaces/dist/index.d.ts",
|
|
@@ -945,6 +972,7 @@
|
|
|
945
972
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/audience.d.ts",
|
|
946
973
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/deltas.d.ts",
|
|
947
974
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/error.d.ts",
|
|
975
|
+
"../../../../../node_modules/@fluidframework/container-definitions/dist/fluidPackage.d.ts",
|
|
948
976
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/loader.d.ts",
|
|
949
977
|
"../../../../../node_modules/@fluidframework/core-interfaces/dist/index.d.ts",
|
|
950
978
|
"../../../../../node_modules/@fluidframework/driver-definitions/dist/index.d.ts",
|
|
@@ -961,7 +989,6 @@
|
|
|
961
989
|
],
|
|
962
990
|
"../../../../../node_modules/@fluidframework/core-interfaces/dist/handles.d.ts": [
|
|
963
991
|
"../../../../../node_modules/@fluidframework/core-interfaces/dist/fluidLoadable.d.ts",
|
|
964
|
-
"../../../../../node_modules/@fluidframework/core-interfaces/dist/fluidObject.d.ts",
|
|
965
992
|
"../../../../../node_modules/@fluidframework/core-interfaces/dist/fluidRouter.d.ts",
|
|
966
993
|
"../../../../../node_modules/@fluidframework/core-interfaces/dist/provider.d.ts"
|
|
967
994
|
],
|
|
@@ -1021,6 +1048,21 @@
|
|
|
1021
1048
|
"../../../../../node_modules/@fluidframework/protocol-definitions/dist/tokens.d.ts": [
|
|
1022
1049
|
"../../../../../node_modules/@fluidframework/protocol-definitions/dist/users.d.ts"
|
|
1023
1050
|
],
|
|
1051
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/IFluidDependencySynthesizer.d.ts": [
|
|
1052
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/types.d.ts"
|
|
1053
|
+
],
|
|
1054
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/dependencyContainer.d.ts": [
|
|
1055
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/IFluidDependencySynthesizer.d.ts",
|
|
1056
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/types.d.ts"
|
|
1057
|
+
],
|
|
1058
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/index.d.ts": [
|
|
1059
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/IFluidDependencySynthesizer.d.ts",
|
|
1060
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/dependencyContainer.d.ts",
|
|
1061
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/types.d.ts"
|
|
1062
|
+
],
|
|
1063
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/types.d.ts": [
|
|
1064
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/index.d.ts"
|
|
1065
|
+
],
|
|
1024
1066
|
"../../../../../node_modules/@types/node/assert.d.ts": [
|
|
1025
1067
|
"../../../../../node_modules/@types/node/assert.d.ts"
|
|
1026
1068
|
],
|
|
@@ -1269,6 +1311,10 @@
|
|
|
1269
1311
|
"../index.d.ts",
|
|
1270
1312
|
"../types.d.ts"
|
|
1271
1313
|
],
|
|
1314
|
+
"../../src/test/types/validateSynthesizePrevious.ts": [
|
|
1315
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/index.d.ts",
|
|
1316
|
+
"../index.d.ts"
|
|
1317
|
+
],
|
|
1272
1318
|
"../../../../runtime/datastore-definitions/dist/channel.d.ts": [
|
|
1273
1319
|
"../../../../../node_modules/@fluidframework/core-interfaces/dist/index.d.ts",
|
|
1274
1320
|
"../../../../../node_modules/@fluidframework/protocol-definitions/dist/index.d.ts",
|
|
@@ -1406,7 +1452,7 @@
|
|
|
1406
1452
|
"../../../../../node_modules/@types/node/index.d.ts"
|
|
1407
1453
|
],
|
|
1408
1454
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/browserPackage.d.ts": [
|
|
1409
|
-
"../../../../../node_modules/@fluidframework/
|
|
1455
|
+
"../../../../../node_modules/@fluidframework/container-definitions/dist/fluidPackage.d.ts"
|
|
1410
1456
|
],
|
|
1411
1457
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/deltas.d.ts": [
|
|
1412
1458
|
"../../../../../node_modules/@fluidframework/common-definitions/dist/index.d.ts",
|
|
@@ -1420,6 +1466,7 @@
|
|
|
1420
1466
|
"../../../../../node_modules/@fluidframework/common-definitions/dist/index.d.ts"
|
|
1421
1467
|
],
|
|
1422
1468
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/fluidModule.d.ts": [
|
|
1469
|
+
"../../../../../node_modules/@fluidframework/container-definitions/dist/fluidPackage.d.ts",
|
|
1423
1470
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/runtime.d.ts",
|
|
1424
1471
|
"../../../../../node_modules/@fluidframework/core-interfaces/dist/index.d.ts"
|
|
1425
1472
|
],
|
|
@@ -1448,6 +1495,7 @@
|
|
|
1448
1495
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/deltas.d.ts",
|
|
1449
1496
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/error.d.ts",
|
|
1450
1497
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/fluidModule.d.ts",
|
|
1498
|
+
"../../../../../node_modules/@fluidframework/container-definitions/dist/fluidPackage.d.ts",
|
|
1451
1499
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/legacy/index.d.ts",
|
|
1452
1500
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/runtime.d.ts",
|
|
1453
1501
|
"../../../../../node_modules/@fluidframework/core-interfaces/dist/index.d.ts",
|
|
@@ -1464,6 +1512,7 @@
|
|
|
1464
1512
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/audience.d.ts",
|
|
1465
1513
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/deltas.d.ts",
|
|
1466
1514
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/error.d.ts",
|
|
1515
|
+
"../../../../../node_modules/@fluidframework/container-definitions/dist/fluidPackage.d.ts",
|
|
1467
1516
|
"../../../../../node_modules/@fluidframework/container-definitions/dist/loader.d.ts",
|
|
1468
1517
|
"../../../../../node_modules/@fluidframework/core-interfaces/dist/index.d.ts",
|
|
1469
1518
|
"../../../../../node_modules/@fluidframework/driver-definitions/dist/index.d.ts",
|
|
@@ -1480,7 +1529,6 @@
|
|
|
1480
1529
|
],
|
|
1481
1530
|
"../../../../../node_modules/@fluidframework/core-interfaces/dist/handles.d.ts": [
|
|
1482
1531
|
"../../../../../node_modules/@fluidframework/core-interfaces/dist/fluidLoadable.d.ts",
|
|
1483
|
-
"../../../../../node_modules/@fluidframework/core-interfaces/dist/fluidObject.d.ts",
|
|
1484
1532
|
"../../../../../node_modules/@fluidframework/core-interfaces/dist/fluidRouter.d.ts",
|
|
1485
1533
|
"../../../../../node_modules/@fluidframework/core-interfaces/dist/provider.d.ts"
|
|
1486
1534
|
],
|
|
@@ -1540,6 +1588,21 @@
|
|
|
1540
1588
|
"../../../../../node_modules/@fluidframework/protocol-definitions/dist/tokens.d.ts": [
|
|
1541
1589
|
"../../../../../node_modules/@fluidframework/protocol-definitions/dist/users.d.ts"
|
|
1542
1590
|
],
|
|
1591
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/IFluidDependencySynthesizer.d.ts": [
|
|
1592
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/types.d.ts"
|
|
1593
|
+
],
|
|
1594
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/dependencyContainer.d.ts": [
|
|
1595
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/IFluidDependencySynthesizer.d.ts",
|
|
1596
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/types.d.ts"
|
|
1597
|
+
],
|
|
1598
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/index.d.ts": [
|
|
1599
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/IFluidDependencySynthesizer.d.ts",
|
|
1600
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/dependencyContainer.d.ts",
|
|
1601
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/types.d.ts"
|
|
1602
|
+
],
|
|
1603
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/types.d.ts": [
|
|
1604
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/index.d.ts"
|
|
1605
|
+
],
|
|
1543
1606
|
"../../../../../node_modules/@types/node/assert.d.ts": [
|
|
1544
1607
|
"../../../../../node_modules/@types/node/assert.d.ts"
|
|
1545
1608
|
],
|
|
@@ -1920,6 +1983,10 @@
|
|
|
1920
1983
|
"../../../../../node_modules/@fluidframework/protocol-definitions/dist/summary.d.ts",
|
|
1921
1984
|
"../../../../../node_modules/@fluidframework/protocol-definitions/dist/tokens.d.ts",
|
|
1922
1985
|
"../../../../../node_modules/@fluidframework/protocol-definitions/dist/users.d.ts",
|
|
1986
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/IFluidDependencySynthesizer.d.ts",
|
|
1987
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/dependencyContainer.d.ts",
|
|
1988
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/index.d.ts",
|
|
1989
|
+
"../../../../../node_modules/@fluidframework/synthesize-previous/dist/types.d.ts",
|
|
1923
1990
|
"../../../../../node_modules/@types/events/index.d.ts",
|
|
1924
1991
|
"../../../../../node_modules/@types/mocha/index.d.ts",
|
|
1925
1992
|
"../../../../../node_modules/@types/node/assert.d.ts",
|
|
@@ -2000,6 +2067,7 @@
|
|
|
2000
2067
|
"../index.d.ts",
|
|
2001
2068
|
"../types.d.ts",
|
|
2002
2069
|
"../../src/test/dependencyContainer.spec.ts",
|
|
2070
|
+
"../../src/test/types/validateSynthesizePrevious.ts",
|
|
2003
2071
|
"../../../../runtime/datastore-definitions/dist/channel.d.ts",
|
|
2004
2072
|
"../../../../runtime/datastore-definitions/dist/dataStoreRuntime.d.ts",
|
|
2005
2073
|
"../../../../runtime/datastore-definitions/dist/index.d.ts",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
use_current_TypeAliasDeclaration_AsyncFluidObjectProvider(get_old_TypeAliasDeclaration_AsyncFluidObjectProvider());
|
|
4
|
+
use_old_TypeAliasDeclaration_AsyncFluidObjectProvider(get_current_TypeAliasDeclaration_AsyncFluidObjectProvider());
|
|
5
|
+
use_current_TypeAliasDeclaration_AsyncOptionalFluidObjectProvider(get_old_TypeAliasDeclaration_AsyncOptionalFluidObjectProvider());
|
|
6
|
+
use_old_TypeAliasDeclaration_AsyncOptionalFluidObjectProvider(get_current_TypeAliasDeclaration_AsyncOptionalFluidObjectProvider());
|
|
7
|
+
use_current_TypeAliasDeclaration_AsyncRequiredFluidObjectProvider(get_old_TypeAliasDeclaration_AsyncRequiredFluidObjectProvider());
|
|
8
|
+
use_old_TypeAliasDeclaration_AsyncRequiredFluidObjectProvider(get_current_TypeAliasDeclaration_AsyncRequiredFluidObjectProvider());
|
|
9
|
+
use_current_ClassDeclaration_DependencyContainer(get_old_ClassDeclaration_DependencyContainer());
|
|
10
|
+
use_old_ClassDeclaration_DependencyContainer(get_current_ClassDeclaration_DependencyContainer());
|
|
11
|
+
use_current_TypeAliasDeclaration_FluidObjectProvider(get_old_TypeAliasDeclaration_FluidObjectProvider());
|
|
12
|
+
use_old_TypeAliasDeclaration_FluidObjectProvider(get_current_TypeAliasDeclaration_FluidObjectProvider());
|
|
13
|
+
use_current_TypeAliasDeclaration_FluidObjectSymbolProvider(get_old_TypeAliasDeclaration_FluidObjectSymbolProvider());
|
|
14
|
+
use_old_TypeAliasDeclaration_FluidObjectSymbolProvider(get_current_TypeAliasDeclaration_FluidObjectSymbolProvider());
|
|
15
|
+
use_current_VariableDeclaration_IFluidDependencySynthesizer(get_old_VariableDeclaration_IFluidDependencySynthesizer());
|
|
16
|
+
use_old_VariableDeclaration_IFluidDependencySynthesizer(get_current_VariableDeclaration_IFluidDependencySynthesizer());
|
|
17
|
+
use_current_InterfaceDeclaration_IFluidDependencySynthesizer(get_old_InterfaceDeclaration_IFluidDependencySynthesizer());
|
|
18
|
+
use_old_InterfaceDeclaration_IFluidDependencySynthesizer(get_current_InterfaceDeclaration_IFluidDependencySynthesizer());
|
|
19
|
+
use_current_InterfaceDeclaration_IProvideFluidDependencySynthesizer(get_old_InterfaceDeclaration_IProvideFluidDependencySynthesizer());
|
|
20
|
+
use_old_InterfaceDeclaration_IProvideFluidDependencySynthesizer(get_current_InterfaceDeclaration_IProvideFluidDependencySynthesizer());
|
|
21
|
+
//# sourceMappingURL=validateSynthesizePrevious.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateSynthesizePrevious.js","sourceRoot":"","sources":["../../../src/test/types/validateSynthesizePrevious.ts"],"names":[],"mappings":";;AAyBA,yDAAyD,CACrD,qDAAqD,EAAE,CAAC,CAAC;AAW7D,qDAAqD,CACjD,yDAAyD,EAAE,CAAC,CAAC;AAWjE,iEAAiE,CAC7D,6DAA6D,EAAE,CAAC,CAAC;AAWrE,6DAA6D,CACzD,iEAAiE,EAAE,CAAC,CAAC;AAWzE,iEAAiE,CAC7D,6DAA6D,EAAE,CAAC,CAAC;AAWrE,6DAA6D,CACzD,iEAAiE,EAAE,CAAC,CAAC;AAWzE,gDAAgD,CAC5C,4CAA4C,EAAE,CAAC,CAAC;AAWpD,4CAA4C,CACxC,gDAAgD,EAAE,CAAC,CAAC;AAWxD,oDAAoD,CAChD,gDAAgD,EAAE,CAAC,CAAC;AAWxD,gDAAgD,CAC5C,oDAAoD,EAAE,CAAC,CAAC;AAW5D,0DAA0D,CACtD,sDAAsD,EAAE,CAAC,CAAC;AAW9D,sDAAsD,CAClD,0DAA0D,EAAE,CAAC,CAAC;AAWlE,2DAA2D,CACvD,uDAAuD,EAAE,CAAC,CAAC;AAW/D,uDAAuD,CACnD,2DAA2D,EAAE,CAAC,CAAC;AAWnE,4DAA4D,CACxD,wDAAwD,EAAE,CAAC,CAAC;AAWhE,wDAAwD,CACpD,4DAA4D,EAAE,CAAC,CAAC;AAWpE,mEAAmE,CAC/D,+DAA+D,EAAE,CAAC,CAAC;AAWvE,+DAA+D,CAC3D,mEAAmE,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-validator in @fluidframework/build-tools.\n */\n/* eslint-disable max-lines */\nimport * as old from \"@fluidframework/synthesize-previous\";\nimport * as current from \"../../index\";\n\ntype TypeOnly<T> = {\n [P in keyof T]: TypeOnly<T[P]>;\n};\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.0.58.2002:\n* \"TypeAliasDeclaration_AsyncFluidObjectProvider\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_TypeAliasDeclaration_AsyncFluidObjectProvider():\n TypeOnly<old.AsyncFluidObjectProvider<any,any>>;\ndeclare function use_current_TypeAliasDeclaration_AsyncFluidObjectProvider(\n use: TypeOnly<current.AsyncFluidObjectProvider<any,any>>);\nuse_current_TypeAliasDeclaration_AsyncFluidObjectProvider(\n get_old_TypeAliasDeclaration_AsyncFluidObjectProvider());\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.0.58.2002:\n* \"TypeAliasDeclaration_AsyncFluidObjectProvider\": {\"backCompat\": false}\n*/\ndeclare function get_current_TypeAliasDeclaration_AsyncFluidObjectProvider():\n TypeOnly<current.AsyncFluidObjectProvider<any,any>>;\ndeclare function use_old_TypeAliasDeclaration_AsyncFluidObjectProvider(\n use: TypeOnly<old.AsyncFluidObjectProvider<any,any>>);\nuse_old_TypeAliasDeclaration_AsyncFluidObjectProvider(\n get_current_TypeAliasDeclaration_AsyncFluidObjectProvider());\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.0.58.2002:\n* \"TypeAliasDeclaration_AsyncOptionalFluidObjectProvider\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_TypeAliasDeclaration_AsyncOptionalFluidObjectProvider():\n TypeOnly<old.AsyncOptionalFluidObjectProvider<any>>;\ndeclare function use_current_TypeAliasDeclaration_AsyncOptionalFluidObjectProvider(\n use: TypeOnly<current.AsyncOptionalFluidObjectProvider<any>>);\nuse_current_TypeAliasDeclaration_AsyncOptionalFluidObjectProvider(\n get_old_TypeAliasDeclaration_AsyncOptionalFluidObjectProvider());\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.0.58.2002:\n* \"TypeAliasDeclaration_AsyncOptionalFluidObjectProvider\": {\"backCompat\": false}\n*/\ndeclare function get_current_TypeAliasDeclaration_AsyncOptionalFluidObjectProvider():\n TypeOnly<current.AsyncOptionalFluidObjectProvider<any>>;\ndeclare function use_old_TypeAliasDeclaration_AsyncOptionalFluidObjectProvider(\n use: TypeOnly<old.AsyncOptionalFluidObjectProvider<any>>);\nuse_old_TypeAliasDeclaration_AsyncOptionalFluidObjectProvider(\n get_current_TypeAliasDeclaration_AsyncOptionalFluidObjectProvider());\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.0.58.2002:\n* \"TypeAliasDeclaration_AsyncRequiredFluidObjectProvider\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_TypeAliasDeclaration_AsyncRequiredFluidObjectProvider():\n TypeOnly<old.AsyncRequiredFluidObjectProvider<any>>;\ndeclare function use_current_TypeAliasDeclaration_AsyncRequiredFluidObjectProvider(\n use: TypeOnly<current.AsyncRequiredFluidObjectProvider<any>>);\nuse_current_TypeAliasDeclaration_AsyncRequiredFluidObjectProvider(\n get_old_TypeAliasDeclaration_AsyncRequiredFluidObjectProvider());\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.0.58.2002:\n* \"TypeAliasDeclaration_AsyncRequiredFluidObjectProvider\": {\"backCompat\": false}\n*/\ndeclare function get_current_TypeAliasDeclaration_AsyncRequiredFluidObjectProvider():\n TypeOnly<current.AsyncRequiredFluidObjectProvider<any>>;\ndeclare function use_old_TypeAliasDeclaration_AsyncRequiredFluidObjectProvider(\n use: TypeOnly<old.AsyncRequiredFluidObjectProvider<any>>);\nuse_old_TypeAliasDeclaration_AsyncRequiredFluidObjectProvider(\n get_current_TypeAliasDeclaration_AsyncRequiredFluidObjectProvider());\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.0.58.2002:\n* \"ClassDeclaration_DependencyContainer\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_ClassDeclaration_DependencyContainer():\n TypeOnly<old.DependencyContainer<any>>;\ndeclare function use_current_ClassDeclaration_DependencyContainer(\n use: TypeOnly<current.DependencyContainer<any>>);\nuse_current_ClassDeclaration_DependencyContainer(\n get_old_ClassDeclaration_DependencyContainer());\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.0.58.2002:\n* \"ClassDeclaration_DependencyContainer\": {\"backCompat\": false}\n*/\ndeclare function get_current_ClassDeclaration_DependencyContainer():\n TypeOnly<current.DependencyContainer<any>>;\ndeclare function use_old_ClassDeclaration_DependencyContainer(\n use: TypeOnly<old.DependencyContainer<any>>);\nuse_old_ClassDeclaration_DependencyContainer(\n get_current_ClassDeclaration_DependencyContainer());\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.0.58.2002:\n* \"TypeAliasDeclaration_FluidObjectProvider\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_TypeAliasDeclaration_FluidObjectProvider():\n TypeOnly<old.FluidObjectProvider<any>>;\ndeclare function use_current_TypeAliasDeclaration_FluidObjectProvider(\n use: TypeOnly<current.FluidObjectProvider<any>>);\nuse_current_TypeAliasDeclaration_FluidObjectProvider(\n get_old_TypeAliasDeclaration_FluidObjectProvider());\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.0.58.2002:\n* \"TypeAliasDeclaration_FluidObjectProvider\": {\"backCompat\": false}\n*/\ndeclare function get_current_TypeAliasDeclaration_FluidObjectProvider():\n TypeOnly<current.FluidObjectProvider<any>>;\ndeclare function use_old_TypeAliasDeclaration_FluidObjectProvider(\n use: TypeOnly<old.FluidObjectProvider<any>>);\nuse_old_TypeAliasDeclaration_FluidObjectProvider(\n get_current_TypeAliasDeclaration_FluidObjectProvider());\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.0.58.2002:\n* \"TypeAliasDeclaration_FluidObjectSymbolProvider\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_TypeAliasDeclaration_FluidObjectSymbolProvider():\n TypeOnly<old.FluidObjectSymbolProvider<any>>;\ndeclare function use_current_TypeAliasDeclaration_FluidObjectSymbolProvider(\n use: TypeOnly<current.FluidObjectSymbolProvider<any>>);\nuse_current_TypeAliasDeclaration_FluidObjectSymbolProvider(\n get_old_TypeAliasDeclaration_FluidObjectSymbolProvider());\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.0.58.2002:\n* \"TypeAliasDeclaration_FluidObjectSymbolProvider\": {\"backCompat\": false}\n*/\ndeclare function get_current_TypeAliasDeclaration_FluidObjectSymbolProvider():\n TypeOnly<current.FluidObjectSymbolProvider<any>>;\ndeclare function use_old_TypeAliasDeclaration_FluidObjectSymbolProvider(\n use: TypeOnly<old.FluidObjectSymbolProvider<any>>);\nuse_old_TypeAliasDeclaration_FluidObjectSymbolProvider(\n get_current_TypeAliasDeclaration_FluidObjectSymbolProvider());\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.0.58.2002:\n* \"VariableDeclaration_IFluidDependencySynthesizer\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_VariableDeclaration_IFluidDependencySynthesizer():\n TypeOnly<typeof old.IFluidDependencySynthesizer>;\ndeclare function use_current_VariableDeclaration_IFluidDependencySynthesizer(\n use: TypeOnly<typeof current.IFluidDependencySynthesizer>);\nuse_current_VariableDeclaration_IFluidDependencySynthesizer(\n get_old_VariableDeclaration_IFluidDependencySynthesizer());\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.0.58.2002:\n* \"VariableDeclaration_IFluidDependencySynthesizer\": {\"backCompat\": false}\n*/\ndeclare function get_current_VariableDeclaration_IFluidDependencySynthesizer():\n TypeOnly<typeof current.IFluidDependencySynthesizer>;\ndeclare function use_old_VariableDeclaration_IFluidDependencySynthesizer(\n use: TypeOnly<typeof old.IFluidDependencySynthesizer>);\nuse_old_VariableDeclaration_IFluidDependencySynthesizer(\n get_current_VariableDeclaration_IFluidDependencySynthesizer());\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.0.58.2002:\n* \"InterfaceDeclaration_IFluidDependencySynthesizer\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_IFluidDependencySynthesizer():\n TypeOnly<old.IFluidDependencySynthesizer>;\ndeclare function use_current_InterfaceDeclaration_IFluidDependencySynthesizer(\n use: TypeOnly<current.IFluidDependencySynthesizer>);\nuse_current_InterfaceDeclaration_IFluidDependencySynthesizer(\n get_old_InterfaceDeclaration_IFluidDependencySynthesizer());\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.0.58.2002:\n* \"InterfaceDeclaration_IFluidDependencySynthesizer\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_IFluidDependencySynthesizer():\n TypeOnly<current.IFluidDependencySynthesizer>;\ndeclare function use_old_InterfaceDeclaration_IFluidDependencySynthesizer(\n use: TypeOnly<old.IFluidDependencySynthesizer>);\nuse_old_InterfaceDeclaration_IFluidDependencySynthesizer(\n get_current_InterfaceDeclaration_IFluidDependencySynthesizer());\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.0.58.2002:\n* \"InterfaceDeclaration_IProvideFluidDependencySynthesizer\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_IProvideFluidDependencySynthesizer():\n TypeOnly<old.IProvideFluidDependencySynthesizer>;\ndeclare function use_current_InterfaceDeclaration_IProvideFluidDependencySynthesizer(\n use: TypeOnly<current.IProvideFluidDependencySynthesizer>);\nuse_current_InterfaceDeclaration_IProvideFluidDependencySynthesizer(\n get_old_InterfaceDeclaration_IProvideFluidDependencySynthesizer());\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.0.58.2002:\n* \"InterfaceDeclaration_IProvideFluidDependencySynthesizer\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_IProvideFluidDependencySynthesizer():\n TypeOnly<current.IProvideFluidDependencySynthesizer>;\ndeclare function use_old_InterfaceDeclaration_IProvideFluidDependencySynthesizer(\n use: TypeOnly<old.IProvideFluidDependencySynthesizer>);\nuse_old_InterfaceDeclaration_IProvideFluidDependencySynthesizer(\n get_current_InterfaceDeclaration_IProvideFluidDependencySynthesizer());\n"]}
|
package/dist/types.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { IFluidDependencySynthesizer } from ".";
|
|
6
6
|
/**
|
|
7
7
|
* This is a condensed version of Record that requires the object has all
|
|
8
|
-
* the
|
|
8
|
+
* the FluidObject properties as its type mapped to a string representation
|
|
9
9
|
* of that property.
|
|
10
10
|
*
|
|
11
11
|
* @example - \{ IFoo: "IFoo" \}
|
|
@@ -15,7 +15,7 @@ export declare type FluidObjectSymbolProvider<T> = {
|
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
17
|
* This is a condensed version of Record that requires the object has all
|
|
18
|
-
* the
|
|
18
|
+
* the FluidObject properties as its type mapped to an object that implements
|
|
19
19
|
* the property.
|
|
20
20
|
*/
|
|
21
21
|
export declare type AsyncRequiredFluidObjectProvider<T> = T extends undefined ? Record<string, never> : {
|
|
@@ -23,7 +23,7 @@ export declare type AsyncRequiredFluidObjectProvider<T> = T extends undefined ?
|
|
|
23
23
|
};
|
|
24
24
|
/**
|
|
25
25
|
* This is a condensed version of Record that requires the object has all
|
|
26
|
-
* the
|
|
26
|
+
* the FluidObject properties as its type, mapped to an object that implements
|
|
27
27
|
* the property or undefined.
|
|
28
28
|
*/
|
|
29
29
|
export declare type AsyncOptionalFluidObjectProvider<T> = T extends undefined ? Record<string, never> : {
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { IFluidDependencySynthesizer } from \".\";\n/**\n * This is a condensed version of Record that requires the object has all\n * the
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { IFluidDependencySynthesizer } from \".\";\n/**\n * This is a condensed version of Record that requires the object has all\n * the FluidObject properties as its type mapped to a string representation\n * of that property.\n *\n * @example - \\{ IFoo: \"IFoo\" \\}\n */\nexport type FluidObjectSymbolProvider<T> = {\n [P in keyof T]?: P;\n};\n\n/**\n * This is a condensed version of Record that requires the object has all\n * the FluidObject properties as its type mapped to an object that implements\n * the property.\n */\nexport type AsyncRequiredFluidObjectProvider<T> = T extends undefined ? Record<string, never> : {\n [P in keyof T]: Promise<NonNullable<Exclude<T[P], undefined | null>>>\n};\n\n/**\n * This is a condensed version of Record that requires the object has all\n * the FluidObject properties as its type, mapped to an object that implements\n * the property or undefined.\n */\nexport type AsyncOptionalFluidObjectProvider<T> = T extends undefined\n ? Record<string, never>\n : {\n [P in keyof T]?: Promise<T[P] | undefined>;\n };\n\n/**\n * Combined type for Optional and Required Async Fluid object Providers\n */\nexport type AsyncFluidObjectProvider<O, R = undefined>\n = AsyncOptionalFluidObjectProvider<O> & AsyncRequiredFluidObjectProvider<R>;\n\n/**\n * Multiple ways to provide a Fluid object.\n */\nexport type FluidObjectProvider<T> =\n NonNullable<T>\n | Promise<NonNullable<T>>\n | ((dependencyContainer: IFluidDependencySynthesizer) => NonNullable<T>)\n | ((dependencyContainer: IFluidDependencySynthesizer) => Promise<NonNullable<T>>);\n"]}
|
|
@@ -62,7 +62,7 @@ export class DependencyContainer {
|
|
|
62
62
|
*/
|
|
63
63
|
getProvider(provider) {
|
|
64
64
|
// this was removed, but some partners have trouble with back compat where they
|
|
65
|
-
// use invalid patterns with
|
|
65
|
+
// use invalid patterns with FluidObject and IFluidDependencySynthesizer
|
|
66
66
|
// this is just for back compat until those are removed
|
|
67
67
|
if (this.has(provider)) {
|
|
68
68
|
if (this.providers.has(provider)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencyContainer.js","sourceRoot":"","sources":["../src/dependencyContainer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EACH,2BAA2B,GAC9B,MAAM,+BAA+B,CAAC;AAEvC;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IAK5B,YAAmB,GAAI,OAAoD;QAJ1D,cAAS,GAAG,IAAI,GAAG,EAAwC,CAAC;QAKzE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAoC,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;IAC5F,CAAC;IAJD,IAAW,2BAA2B,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC;IAMzD;;;;;OAKG;IACI,QAAQ,CAAoC,IAAO,EAAE,QAA4C;QACpG,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,6CAA6C,IAAI,sBAAsB,CAAC,CAAC;SAC5F;QAED,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACvC,CAAC;IAED;;;OAGG;IACI,UAAU,CAAC,IAAgB;QAC9B,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAC1B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;SAC/B;IACL,CAAC;IAED;;OAEG;IACI,UAAU,CACb,aAA2C,EAC3C,aAAq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AAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAA8C,CAAC;gBAClE,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,CACzB,EAAE,EACF,EAAE,CAAC,CAAC;gBACR,MAAM,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;gBAC3D,IAAI,UAAU,KAAK,SAAS,EAAE;oBAC1B,OAAO,UAAU,CAAC;iBACrB;aACJ;YACD,OAAO,SAAS,CAAC;SACpB;QAED,+EAA+E;QAC/E,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;YAChC,OAAO;gBACH,GAAG;oBACC,IAAI,QAAQ,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;wBAC5C,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;6BACpD,IAAI,CAAC,KAAK,EAAE,GAAG,EAAgB,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;6BAChD,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAG,CAAC,CAAC,CAAC,CAAC;qBAC5B;gBACL,CAAC;aACJ,CAAC;SACL;QACD,OAAO;YACC,GAAG;gBACC,IAAI,QAAQ,EAAE;oBACV,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;wBACxC,IAAI,CAAC,EAAE;4BACH,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;yBACf;oBACL,CAAC,CAAC,CAAC;iBACN;YACL,CAAC;SACJ,CAAC;IACV,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n AsyncFluidObjectProvider,\n FluidObjectSymbolProvider,\n FluidObjectProvider,\n AsyncOptionalFluidObjectProvider,\n AsyncRequiredFluidObjectProvider,\n} from \"./types\";\nimport {\n IFluidDependencySynthesizer,\n} from \"./IFluidDependencySynthesizer\";\n\n/**\n * DependencyContainer is similar to a IoC Container. It takes providers and will\n * synthesize an object based on them when requested.\n */\nexport class DependencyContainer<TMap> implements IFluidDependencySynthesizer {\n private readonly providers = new Map<keyof TMap, FluidObjectProvider<any>>();\n private readonly parents: IFluidDependencySynthesizer[];\n public get IFluidDependencySynthesizer() { return this; }\n\n public constructor(... parents: (IFluidDependencySynthesizer | undefined)[]) {\n this.parents = parents.filter((v): v is IFluidDependencySynthesizer => v !== undefined);\n }\n\n /**\n * Add a new provider\n * @param type - Name of the Type T being provided\n * @param provider - A provider that will resolve the T correctly when asked\n * @throws - If passing a type that's already registered\n */\n public register<T extends keyof TMap = keyof TMap>(type: T, provider: FluidObjectProvider<Pick<TMap, T>>): void {\n if (this.providers.has(type)) {\n throw new Error(`Attempting to register a provider of type ${type} that already exists`);\n }\n\n this.providers.set(type, provider);\n }\n\n /**\n * Remove a provider\n * @param type - Name of the provider to remove\n */\n public unregister(type: keyof TMap): void {\n if (this.providers.has(type)) {\n this.providers.delete(type);\n }\n }\n\n /**\n * {@inheritDoc (IFluidDependencySynthesizer:interface).synthesize}\n */\n public synthesize<O, R = undefined | Record<string, never>>(\n optionalTypes: FluidObjectSymbolProvider<O>,\n requiredTypes: Required<FluidObjectSymbolProvider<R>>,\n ): AsyncFluidObjectProvider<O, R> {\n const base: AsyncFluidObjectProvider<O, R> = {} as any;\n this.generateRequired<R>(base, requiredTypes);\n this.generateOptional<O>(base, optionalTypes);\n Object.defineProperty(base, IFluidDependencySynthesizer, { get: () => this });\n return base;\n }\n\n /**\n * {@inheritDoc (IFluidDependencySynthesizer:interface).has}\n * @param excludeParents - If true, exclude checking parent registries\n */\n public has(type: string, excludeParents?: boolean): boolean {\n if (this.providers.has(type as keyof TMap)) {\n return true;\n }\n if (excludeParents !== true) {\n return this.parents.some((p: IFluidDependencySynthesizer) => p.has(type));\n }\n return false;\n }\n /**\n * @deprecated - Needed for back compat\n */\n private getProvider(provider: string & keyof TMap) {\n // this was removed, but some partners have trouble with back compat where they\n // use invalid patterns with IFluidObject and IFluidDependencySynthesizer\n // this is just for back compat until those are removed\n if(this.has(provider)) {\n if(this.providers.has(provider)) {\n return this.providers.get(provider);\n }\n for(const parent of this.parents) {\n if(parent instanceof DependencyContainer) {\n return parent.getProvider(provider);\n }else{\n // older implementations of the IFluidDependencySynthesizer exposed getProvider\n const maybeGetProvider: {getProvider?(provider: string & keyof TMap)} = parent as any;\n if(maybeGetProvider?.getProvider !== undefined) {\n return maybeGetProvider.getProvider(provider);\n }\n }\n }\n }\n }\n\n private generateRequired<T>(\n base: AsyncRequiredFluidObjectProvider<T>,\n types: Required<FluidObjectSymbolProvider<T>>,\n ) {\n if (types === undefined) { return; }\n for (const key of Object.keys(types) as unknown as (keyof TMap)[]) {\n const provider = this.resolveProvider(key);\n if(provider === undefined) {\n throw new Error(`Object attempted to be created without registered required provider ${key}`);\n }\n Object.defineProperty(\n base,\n key,\n provider,\n );\n }\n }\n\n private generateOptional<T>(\n base: AsyncOptionalFluidObjectProvider<T>,\n types: FluidObjectSymbolProvider<T>,\n ) {\n if (types === undefined) { return; }\n for (const key of Object.keys(types) as unknown as (keyof TMap)[]) {\n // back-compat: in 0.56 we allow undefined in the types, but we didn't before\n // this will keep runtime back compat, eventually we should support undefined properties\n // rather than properties that return promises that resolve to undefined\n const provider = this.resolveProvider(key) ?? { get: async () => undefined };\n Object.defineProperty(\n base,\n key,\n provider,\n );\n }\n }\n\n private resolveProvider<T extends keyof TMap>(t: T): PropertyDescriptor | undefined {\n // If we have the provider return it\n const provider = this.providers.get(t);\n if (provider === undefined) {\n for (const parent of this.parents) {\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n const sp = { [t]: t } as FluidObjectSymbolProvider<Pick<TMap, T>>;\n const syn = parent.synthesize<Pick<TMap, T>,{}>(\n sp,\n {});\n const descriptor = Object.getOwnPropertyDescriptor(syn, t);\n if (descriptor !== undefined) {\n return descriptor;\n }\n }\n return undefined;\n }\n\n // The double nested gets are required for lazy loading the provider resolution\n if (typeof provider === \"function\") {\n return {\n get() {\n if (provider && typeof provider === \"function\") {\n return Promise.resolve(this[IFluidDependencySynthesizer])\n .then(async (fds): Promise<any> => provider(fds))\n .then((p) => p?.[t]);\n }\n },\n };\n }\n return {\n get() {\n if (provider) {\n return Promise.resolve(provider).then((p) => {\n if (p) {\n return p[t];\n }\n });\n }\n },\n };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dependencyContainer.js","sourceRoot":"","sources":["../src/dependencyContainer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EACH,2BAA2B,GAC9B,MAAM,+BAA+B,CAAC;AAEvC;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IAK5B,YAAmB,GAAI,OAAoD;QAJ1D,cAAS,GAAG,IAAI,GAAG,EAAwC,CAAC;QAKzE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAoC,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;IAC5F,CAAC;IAJD,IAAW,2BAA2B,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC;IAMzD;;;;;OAKG;IACI,QAAQ,CAAoC,IAAO,EAAE,QAA4C;QACpG,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,6CAA6C,IAAI,sBAAsB,CAAC,CAAC;SAC5F;QAED,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACvC,CAAC;IAED;;;OAGG;IACI,UAAU,CAAC,IAAgB;QAC9B,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAC1B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;SAC/B;IACL,CAAC;I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I,CAAC,OAAO,EAAE;gBAC/B,yEAAyE;gBACzE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAA8C,CAAC;gBAClE,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,CACzB,EAAE,EACF,EAAE,CAAC,CAAC;gBACR,MAAM,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;gBAC3D,IAAI,UAAU,KAAK,SAAS,EAAE;oBAC1B,OAAO,UAAU,CAAC;iBACrB;aACJ;YACD,OAAO,SAAS,CAAC;SACpB;QAED,+EAA+E;QAC/E,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;YAChC,OAAO;gBACH,GAAG;oBACC,IAAI,QAAQ,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;wBAC5C,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;6BACpD,IAAI,CAAC,KAAK,EAAE,GAAG,EAAgB,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;6BAChD,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAG,CAAC,CAAC,CAAC,CAAC;qBAC5B;gBACL,CAAC;aACJ,CAAC;SACL;QACD,OAAO;YACC,GAAG;gBACC,IAAI,QAAQ,EAAE;oBACV,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;wBACxC,IAAI,CAAC,EAAE;4BACH,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;yBACf;oBACL,CAAC,CAAC,CAAC;iBACN;YACL,CAAC;SACJ,CAAC;IACV,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n AsyncFluidObjectProvider,\n FluidObjectSymbolProvider,\n FluidObjectProvider,\n AsyncOptionalFluidObjectProvider,\n AsyncRequiredFluidObjectProvider,\n} from \"./types\";\nimport {\n IFluidDependencySynthesizer,\n} from \"./IFluidDependencySynthesizer\";\n\n/**\n * DependencyContainer is similar to a IoC Container. It takes providers and will\n * synthesize an object based on them when requested.\n */\nexport class DependencyContainer<TMap> implements IFluidDependencySynthesizer {\n private readonly providers = new Map<keyof TMap, FluidObjectProvider<any>>();\n private readonly parents: IFluidDependencySynthesizer[];\n public get IFluidDependencySynthesizer() { return this; }\n\n public constructor(... parents: (IFluidDependencySynthesizer | undefined)[]) {\n this.parents = parents.filter((v): v is IFluidDependencySynthesizer => v !== undefined);\n }\n\n /**\n * Add a new provider\n * @param type - Name of the Type T being provided\n * @param provider - A provider that will resolve the T correctly when asked\n * @throws - If passing a type that's already registered\n */\n public register<T extends keyof TMap = keyof TMap>(type: T, provider: FluidObjectProvider<Pick<TMap, T>>): void {\n if (this.providers.has(type)) {\n throw new Error(`Attempting to register a provider of type ${type} that already exists`);\n }\n\n this.providers.set(type, provider);\n }\n\n /**\n * Remove a provider\n * @param type - Name of the provider to remove\n */\n public unregister(type: keyof TMap): void {\n if (this.providers.has(type)) {\n this.providers.delete(type);\n }\n }\n\n /**\n * {@inheritDoc (IFluidDependencySynthesizer:interface).synthesize}\n */\n public synthesize<O, R = undefined | Record<string, never>>(\n optionalTypes: FluidObjectSymbolProvider<O>,\n requiredTypes: Required<FluidObjectSymbolProvider<R>>,\n ): AsyncFluidObjectProvider<O, R> {\n const base: AsyncFluidObjectProvider<O, R> = {} as any;\n this.generateRequired<R>(base, requiredTypes);\n this.generateOptional<O>(base, optionalTypes);\n Object.defineProperty(base, IFluidDependencySynthesizer, { get: () => this });\n return base;\n }\n\n /**\n * {@inheritDoc (IFluidDependencySynthesizer:interface).has}\n * @param excludeParents - If true, exclude checking parent registries\n */\n public has(type: string, excludeParents?: boolean): boolean {\n if (this.providers.has(type as keyof TMap)) {\n return true;\n }\n if (excludeParents !== true) {\n return this.parents.some((p: IFluidDependencySynthesizer) => p.has(type));\n }\n return false;\n }\n /**\n * @deprecated - Needed for back compat\n */\n private getProvider(provider: string & keyof TMap) {\n // this was removed, but some partners have trouble with back compat where they\n // use invalid patterns with FluidObject and IFluidDependencySynthesizer\n // this is just for back compat until those are removed\n if(this.has(provider)) {\n if(this.providers.has(provider)) {\n return this.providers.get(provider);\n }\n for(const parent of this.parents) {\n if(parent instanceof DependencyContainer) {\n return parent.getProvider(provider);\n }else{\n // older implementations of the IFluidDependencySynthesizer exposed getProvider\n const maybeGetProvider: {getProvider?(provider: string & keyof TMap)} = parent as any;\n if(maybeGetProvider?.getProvider !== undefined) {\n return maybeGetProvider.getProvider(provider);\n }\n }\n }\n }\n }\n\n private generateRequired<T>(\n base: AsyncRequiredFluidObjectProvider<T>,\n types: Required<FluidObjectSymbolProvider<T>>,\n ) {\n if (types === undefined) { return; }\n for (const key of Object.keys(types) as unknown as (keyof TMap)[]) {\n const provider = this.resolveProvider(key);\n if(provider === undefined) {\n throw new Error(`Object attempted to be created without registered required provider ${key}`);\n }\n Object.defineProperty(\n base,\n key,\n provider,\n );\n }\n }\n\n private generateOptional<T>(\n base: AsyncOptionalFluidObjectProvider<T>,\n types: FluidObjectSymbolProvider<T>,\n ) {\n if (types === undefined) { return; }\n for (const key of Object.keys(types) as unknown as (keyof TMap)[]) {\n // back-compat: in 0.56 we allow undefined in the types, but we didn't before\n // this will keep runtime back compat, eventually we should support undefined properties\n // rather than properties that return promises that resolve to undefined\n const provider = this.resolveProvider(key) ?? { get: async () => undefined };\n Object.defineProperty(\n base,\n key,\n provider,\n );\n }\n }\n\n private resolveProvider<T extends keyof TMap>(t: T): PropertyDescriptor | undefined {\n // If we have the provider return it\n const provider = this.providers.get(t);\n if (provider === undefined) {\n for (const parent of this.parents) {\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n const sp = { [t]: t } as FluidObjectSymbolProvider<Pick<TMap, T>>;\n const syn = parent.synthesize<Pick<TMap, T>, Record<string, unknown>>(\n sp,\n {});\n const descriptor = Object.getOwnPropertyDescriptor(syn, t);\n if (descriptor !== undefined) {\n return descriptor;\n }\n }\n return undefined;\n }\n\n // The double nested gets are required for lazy loading the provider resolution\n if (typeof provider === \"function\") {\n return {\n get() {\n if (provider && typeof provider === \"function\") {\n return Promise.resolve(this[IFluidDependencySynthesizer])\n .then(async (fds): Promise<any> => provider(fds))\n .then((p) => p?.[t]);\n }\n },\n };\n }\n return {\n get() {\n if (provider) {\n return Promise.resolve(provider).then((p) => {\n if (p) {\n return p[t];\n }\n });\n }\n },\n };\n }\n}\n"]}
|
package/lib/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { IFluidDependencySynthesizer } from \".\";\n/**\n * This is a condensed version of Record that requires the object has all\n * the
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { IFluidDependencySynthesizer } from \".\";\n/**\n * This is a condensed version of Record that requires the object has all\n * the FluidObject properties as its type mapped to a string representation\n * of that property.\n *\n * @example - \\{ IFoo: \"IFoo\" \\}\n */\nexport type FluidObjectSymbolProvider<T> = {\n [P in keyof T]?: P;\n};\n\n/**\n * This is a condensed version of Record that requires the object has all\n * the FluidObject properties as its type mapped to an object that implements\n * the property.\n */\nexport type AsyncRequiredFluidObjectProvider<T> = T extends undefined ? Record<string, never> : {\n [P in keyof T]: Promise<NonNullable<Exclude<T[P], undefined | null>>>\n};\n\n/**\n * This is a condensed version of Record that requires the object has all\n * the FluidObject properties as its type, mapped to an object that implements\n * the property or undefined.\n */\nexport type AsyncOptionalFluidObjectProvider<T> = T extends undefined\n ? Record<string, never>\n : {\n [P in keyof T]?: Promise<T[P] | undefined>;\n };\n\n/**\n * Combined type for Optional and Required Async Fluid object Providers\n */\nexport type AsyncFluidObjectProvider<O, R = undefined>\n = AsyncOptionalFluidObjectProvider<O> & AsyncRequiredFluidObjectProvider<R>;\n\n/**\n * Multiple ways to provide a Fluid object.\n */\nexport type FluidObjectProvider<T> =\n NonNullable<T>\n | Promise<NonNullable<T>>\n | ((dependencyContainer: IFluidDependencySynthesizer) => NonNullable<T>)\n | ((dependencyContainer: IFluidDependencySynthesizer) => Promise<NonNullable<T>>);\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/synthesize",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.59.1000",
|
|
4
4
|
"description": "A library for synthesizing scope objects.",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"lint:fix": "npm run eslint:fix",
|
|
36
36
|
"test": "npm run test:mocha",
|
|
37
37
|
"test:coverage": "nyc npm test -- --reporter xunit --reporter-option output=nyc/junit-report.xml",
|
|
38
|
-
"test:mocha": "mocha --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup --unhandled-rejections=strict",
|
|
38
|
+
"test:mocha": "mocha --ignore 'dist/test/types/*' --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup --unhandled-rejections=strict",
|
|
39
39
|
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
40
40
|
"tsc": "tsc",
|
|
41
41
|
"tsfmt": "tsfmt --verify",
|
|
@@ -63,10 +63,11 @@
|
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@fluidframework/build-common": "^0.23.0",
|
|
66
|
-
"@fluidframework/core-interfaces": "^0.
|
|
67
|
-
"@fluidframework/datastore": "^0.
|
|
68
|
-
"@fluidframework/eslint-config-fluid": "^0.
|
|
69
|
-
"@fluidframework/mocha-test-setup": "^0.
|
|
66
|
+
"@fluidframework/core-interfaces": "^0.43.1000",
|
|
67
|
+
"@fluidframework/datastore": "^0.59.1000",
|
|
68
|
+
"@fluidframework/eslint-config-fluid": "^0.28.1000",
|
|
69
|
+
"@fluidframework/mocha-test-setup": "^0.59.1000",
|
|
70
|
+
"@fluidframework/synthesize-previous": "npm:@fluidframework/synthesize@^0.58.0",
|
|
70
71
|
"@microsoft/api-extractor": "^7.16.1",
|
|
71
72
|
"@rushstack/eslint-config": "^2.5.1",
|
|
72
73
|
"@types/mocha": "^8.2.2",
|
|
@@ -88,5 +89,9 @@
|
|
|
88
89
|
"rimraf": "^2.6.2",
|
|
89
90
|
"typescript": "~4.1.3",
|
|
90
91
|
"typescript-formatter": "7.1.0"
|
|
92
|
+
},
|
|
93
|
+
"typeValidation": {
|
|
94
|
+
"version": "0.59.1000",
|
|
95
|
+
"broken": {}
|
|
91
96
|
}
|
|
92
97
|
}
|