From b0c1905838b87b0cf678767ce4f3c9d4325d5585 Mon Sep 17 00:00:00 2001 From: sdeshpande3 Date: Mon, 28 Mar 2022 14:53:03 -0700 Subject: [PATCH 01/13] checking branch --- common/lib/container-definitions/src/runtime.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/lib/container-definitions/src/runtime.ts b/common/lib/container-definitions/src/runtime.ts index e6288b5bd2fb..e3eeb8238fb0 100644 --- a/common/lib/container-definitions/src/runtime.ts +++ b/common/lib/container-definitions/src/runtime.ts @@ -6,7 +6,6 @@ import { ITelemetryBaseLogger, IDisposable } from "@fluidframework/common-definitions"; import { FluidObject, - IFluidCodeDetails, IFluidObject, IRequest, IResponse, @@ -27,6 +26,7 @@ import { IAudience } from "./audience"; import { IDeltaManager } from "./deltas"; import { ICriticalContainerError, ContainerWarning } from "./error"; import { ILoader, ILoaderOptions } from "./loader"; +import { IFluidCodeDetails } from "./fluidPackage"; /** * The attachment state of some Fluid data (e.g. a container or data store), denoting whether it is uploaded to the From 97aa4ebc5eac8af4815e325ea66f6883d90abfa0 Mon Sep 17 00:00:00 2001 From: sdeshpande3 Date: Mon, 28 Mar 2022 15:46:53 -0700 Subject: [PATCH 02/13] import fluidPackage from container-definitions --- BREAKING.md | 14 ++++++- api-report/container-loader.api.md | 4 +- api-report/test-utils.api.md | 4 +- api-report/web-code-loader.api.md | 6 +-- .../api-report/container-definitions.api.md | 39 +++++++++---------- .../src/browserPackage.ts | 2 +- .../lib/container-definitions/src/loader.ts | 8 ++-- .../lib/driver-definitions/src/urlResolver.ts | 1 + .../src/documentFactory.ts | 2 +- .../hosts-sample/src/codeDetailsLoader.ts | 2 +- .../hosts/hosts-sample/src/codeDetailsView.ts | 3 +- examples/hosts/hosts-sample/src/utils.ts | 4 +- examples/hosts/node-host/src/index.ts | 2 +- .../src/test/propertyTree.spec.ts | 3 +- .../property-dds/src/test/rebasing.spec.ts | 3 +- experimental/dds/tree/api/tree.api.md | 4 +- .../iframe-driver/src/innerUrlResolver.ts | 1 + .../iframe-driver/src/outerUrlResolver.ts | 1 + .../odsp-driver/src/odspDriverUrlResolver.ts | 1 + .../src/odspDriverUrlResolverForShareLink.ts | 1 + .../src/test/odspDriverResolverTest.spec.ts | 1 + .../loader/container-loader/src/container.ts | 4 +- .../container-loader/src/containerContext.ts | 6 +-- .../loader/container-loader/src/loader.ts | 4 +- .../src/test/containerContext.spec.ts | 2 +- .../src/semVerCdnCodeResolver.ts | 3 +- packages/loader/web-code-loader/src/utils.ts | 2 +- .../loader/web-code-loader/src/webLoader.ts | 2 +- .../src/test/connectionMode.spec.ts | 4 +- .../src/test/documentDirty.spec.ts | 4 +- .../src/test/localTestServer.spec.ts | 3 +- .../src/test/noDeltaStream.spec.ts | 3 +- .../src/test/opsOnReconnect.spec.ts | 4 +- .../snapshots/src/test/serialized.spec.ts | 2 +- .../test/attachRegisterLocalApiTests.spec.ts | 4 +- .../src/test/codePropsal.spec.ts | 4 +- .../src/test/container.spec.ts | 3 +- .../test/deRehydrateContainerTests.spec.ts | 4 +- .../src/test/localLoader.spec.ts | 4 +- packages/test/test-service-load/src/utils.ts | 3 +- .../test/test-utils/src/localCodeLoader.ts | 4 +- packages/test/test-utils/src/localLoader.ts | 3 +- .../test/test-utils/src/testObjectProvider.ts | 4 +- .../replay-tool/src/replayLoaderObject.ts | 10 ++++- .../tools/webpack-fluid-loader/src/loader.ts | 4 +- .../tools/webpack-fluid-loader/src/routes.ts | 2 +- 46 files changed, 109 insertions(+), 89 deletions(-) diff --git a/BREAKING.md b/BREAKING.md index 8a5c20ef2483..7618e3d5c29e 100644 --- a/BREAKING.md +++ b/BREAKING.md @@ -20,12 +20,24 @@ There are a few steps you can take to write a good change note and avoid needing ## 0.59 Breaking changes - [Removing Commit from TreeEntry and commits from SnapShotTree](#Removing-Commit-from-TreeEntry-and-commits-from-SnapShotTree) - +- [Remove `@fluidframework/core-interface#fluidPackage.ts`](#Remove-fluidframeworkcore-interfacefluidPackagets) ### Removing Commit from TreeEntry and commits from SnapShotTree Cleaning up properties that are not being used in the codebase: `TreeEntry.Commit` and `ISnapshotTree.commits`. These should not be used and there is no replacement provided. +### Remove `@fluidframework/core-interface#fluidPackage.ts` +All the interfaces and const from `fluidPackage.ts` were moved to `@fluidframework/container-definitions` in previous release. Please refer to: [Moved `@fluidframework/core-interface#fluidPackage.ts` to `@fluidframework/container-definition#fluidPackage.ts`](#Moved-fluidframeworkcore-interfacefluidPackagets-to-fluidframeworkcontainer-definitionfluidPackagets). It is now removed from `@fluidframework/core-interface#fluidPackage.ts`. Import the following interfaces and const from `@fluidframework/container-definitions`: +- `IFluidPackageEnvironment` +- `IFluidPackage` +- `isFluidPackage` +- `IFluidCodeDetailsConfig` +- `IFluidCodeDetailsConfig` +- `IFluidCodeDetails` +- `IFluidCodeDetailsComparer` +- `IProvideFluidCodeDetailsComparer` +- `IFluidCodeDetailsComparer` + # 0.58 diff --git a/api-report/container-loader.api.md b/api-report/container-loader.api.md index f574f82b5a80..f46f1e7e73f7 100644 --- a/api-report/container-loader.api.md +++ b/api-report/container-loader.api.md @@ -21,14 +21,14 @@ import { IDeltaManager } from '@fluidframework/container-definitions'; import { IDocumentMessage } from '@fluidframework/protocol-definitions'; import { IDocumentServiceFactory } from '@fluidframework/driver-definitions'; import { IDocumentStorageService } from '@fluidframework/driver-definitions'; -import { IFluidCodeDetails } from '@fluidframework/core-interfaces'; +import { IFluidCodeDetails } from '@fluidframework/container-definitions'; import { IFluidModule } from '@fluidframework/container-definitions'; import { IFluidResolvedUrl } from '@fluidframework/driver-definitions'; import { IFluidRouter } from '@fluidframework/core-interfaces'; import { IHostLoader } from '@fluidframework/container-definitions'; import { ILoader } from '@fluidframework/container-definitions'; import { ILoaderOptions as ILoaderOptions_2 } from '@fluidframework/container-definitions'; -import { IProvideFluidCodeDetailsComparer } from '@fluidframework/core-interfaces'; +import { IProvideFluidCodeDetailsComparer } from '@fluidframework/container-definitions'; import { IProxyLoaderFactory } from '@fluidframework/container-definitions'; import { IQuorumClients } from '@fluidframework/protocol-definitions'; import { IRequest } from '@fluidframework/core-interfaces'; diff --git a/api-report/test-utils.api.md b/api-report/test-utils.api.md index d5254e530b25..2ad54529dc14 100644 --- a/api-report/test-utils.api.md +++ b/api-report/test-utils.api.md @@ -13,7 +13,7 @@ import { IContainerContext } from '@fluidframework/container-definitions'; import { IContainerRuntime } from '@fluidframework/container-runtime-definitions'; import { IContainerRuntimeOptions } from '@fluidframework/container-runtime'; import { IDocumentServiceFactory } from '@fluidframework/driver-definitions'; -import { IFluidCodeDetails } from '@fluidframework/core-interfaces'; +import { IFluidCodeDetails } from '@fluidframework/container-definitions'; import { IFluidDataStoreChannel } from '@fluidframework/runtime-definitions'; import { IFluidDataStoreContext } from '@fluidframework/runtime-definitions'; import { IFluidDataStoreFactory } from '@fluidframework/runtime-definitions'; @@ -24,7 +24,7 @@ import { IFluidModule } from '@fluidframework/container-definitions'; import { IHostLoader } from '@fluidframework/container-definitions'; import { ILoaderOptions } from '@fluidframework/container-definitions'; import { ILoaderProps } from '@fluidframework/container-loader'; -import { IProvideFluidCodeDetailsComparer } from '@fluidframework/core-interfaces'; +import { IProvideFluidCodeDetailsComparer } from '@fluidframework/container-definitions'; import { IProvideFluidDataStoreFactory } from '@fluidframework/runtime-definitions'; import { IProvideFluidDataStoreRegistry } from '@fluidframework/runtime-definitions'; import { IProvideRuntimeFactory } from '@fluidframework/container-definitions'; diff --git a/api-report/web-code-loader.api.md b/api-report/web-code-loader.api.md index b8d38c316e28..d29aea162a62 100644 --- a/api-report/web-code-loader.api.md +++ b/api-report/web-code-loader.api.md @@ -6,11 +6,11 @@ import { ICodeAllowList } from '@fluidframework/container-definitions'; import { ICodeLoader } from '@fluidframework/container-definitions'; -import { IFluidCodeDetails } from '@fluidframework/core-interfaces'; +import { IFluidCodeDetails } from '@fluidframework/container-definitions'; import { IFluidCodeResolver } from '@fluidframework/container-definitions'; import { IFluidModule } from '@fluidframework/container-definitions'; -import { IFluidPackage } from '@fluidframework/core-interfaces'; -import { IFluidPackageEnvironment } from '@fluidframework/core-interfaces'; +import { IFluidPackage } from '@fluidframework/container-definitions'; +import { IFluidPackageEnvironment } from '@fluidframework/container-definitions'; import { IResolvedFluidCodeDetails } from '@fluidframework/container-definitions'; // @public diff --git a/common/lib/container-definitions/api-report/container-definitions.api.md b/common/lib/container-definitions/api-report/container-definitions.api.md index db89125d6997..18e417d32c50 100644 --- a/common/lib/container-definitions/api-report/container-definitions.api.md +++ b/common/lib/container-definitions/api-report/container-definitions.api.md @@ -16,10 +16,7 @@ import { IDocumentStorageService } from '@fluidframework/driver-definitions'; import { IErrorEvent } from '@fluidframework/common-definitions'; import { IEvent } from '@fluidframework/common-definitions'; import { IEventProvider } from '@fluidframework/common-definitions'; -import { IFluidCodeDetails as IFluidCodeDetails_2 } from '@fluidframework/core-interfaces'; import { IFluidObject } from '@fluidframework/core-interfaces'; -import { IFluidPackage as IFluidPackage_2 } from '@fluidframework/core-interfaces'; -import { IFluidPackageEnvironment as IFluidPackageEnvironment_2 } from '@fluidframework/core-interfaces'; import { IFluidResolvedUrl } from '@fluidframework/driver-definitions'; import { IFluidRouter } from '@fluidframework/core-interfaces'; import { IProvideFluidCodeDetailsComparer as IProvideFluidCodeDetailsComparer_2 } from '@fluidframework/core-interfaces'; @@ -96,13 +93,13 @@ export interface ICodeAllowList { } // @public -export interface ICodeDetailsLoader extends Partial { - load(source: IFluidCodeDetails_2): Promise; +export interface ICodeDetailsLoader extends Partial { + load(source: IFluidCodeDetails): Promise; } // @public @deprecated -export interface ICodeLoader extends Partial { - load(source: IFluidCodeDetails_2): Promise; +export interface ICodeLoader extends Partial { + load(source: IFluidCodeDetails): Promise; } // @public @@ -140,11 +137,11 @@ export interface IContainer extends IEventProvider, IFluidRout // @alpha forceReadonly?(readonly: boolean): any; getAbsoluteUrl(relativeUrl: string): Promise; - getLoadedCodeDetails(): IFluidCodeDetails_2 | undefined; + getLoadedCodeDetails(): IFluidCodeDetails | undefined; getQuorum(): IQuorumClients; - getSpecifiedCodeDetails(): IFluidCodeDetails_2 | undefined; + getSpecifiedCodeDetails(): IFluidCodeDetails | undefined; readonly isDirty: boolean; - proposeCodeDetails(codeDetails: IFluidCodeDetails_2): Promise; + proposeCodeDetails(codeDetails: IFluidCodeDetails): Promise; readonly readOnlyInfo: ReadOnlyInfo; request(request: IRequest): Promise; resolvedUrl: IResolvedUrl | undefined; @@ -178,7 +175,7 @@ export interface IContainerContext extends IDisposable { // (undocumented) getLoadedFromVersion(): IVersion | undefined; // @deprecated (undocumented) - getSpecifiedCodeDetails?(): IFluidCodeDetails_2 | undefined; + getSpecifiedCodeDetails?(): IFluidCodeDetails | undefined; // (undocumented) readonly loader: ILoader; // (undocumented) @@ -211,9 +208,9 @@ export interface IContainerEvents extends IEvent { // (undocumented) (event: "connected", listener: (clientId: string) => void): any; // (undocumented) - (event: "codeDetailsProposed", listener: (codeDetails: IFluidCodeDetails_2, proposal: ISequencedProposal) => void): any; + (event: "codeDetailsProposed", listener: (codeDetails: IFluidCodeDetails, proposal: ISequencedProposal) => void): any; // (undocumented) - (event: "contextChanged", listener: (codeDetails: IFluidCodeDetails_2) => void): any; + (event: "contextChanged", listener: (codeDetails: IFluidCodeDetails) => void): any; // (undocumented) (event: "disconnected" | "attached", listener: () => void): any; // (undocumented) @@ -324,16 +321,16 @@ export interface IErrorBase extends Partial { } // @public -export interface IFluidBrowserPackage extends IFluidPackage_2 { +export interface IFluidBrowserPackage extends IFluidPackage { // (undocumented) fluid: { browser: IFluidBrowserPackageEnvironment; - [environment: string]: IFluidPackageEnvironment_2; + [environment: string]: IFluidPackageEnvironment; }; } // @public -export interface IFluidBrowserPackageEnvironment extends IFluidPackageEnvironment_2 { +export interface IFluidBrowserPackageEnvironment extends IFluidPackageEnvironment { umd: { files: string[]; library: string; @@ -363,7 +360,7 @@ export interface IFluidCodeDetailsConfig { // @public export interface IFluidCodeResolver { - resolveCodeDetails(details: IFluidCodeDetails_2): Promise; + resolveCodeDetails(details: IFluidCodeDetails): Promise; } // @public (undocumented) @@ -374,7 +371,7 @@ export interface IFluidModule { // @public export interface IFluidModuleWithDetails { - details: IFluidCodeDetails_2; + details: IFluidCodeDetails; module: IFluidModule; } @@ -416,7 +413,7 @@ export interface IGenericError extends IErrorBase { // @public export interface IHostLoader extends ILoader { - createDetachedContainer(codeDetails: IFluidCodeDetails_2): Promise; + createDetachedContainer(codeDetails: IFluidCodeDetails): Promise; rehydrateDetachedContainerFromSnapshot(snapshot: string): Promise; } @@ -497,8 +494,8 @@ export interface IProxyLoaderFactory { } // @public -export interface IResolvedFluidCodeDetails extends IFluidCodeDetails_2 { - readonly resolvedPackage: Readonly; +export interface IResolvedFluidCodeDetails extends IFluidCodeDetails { + readonly resolvedPackage: Readonly; readonly resolvedPackageCacheId: string | undefined; } diff --git a/common/lib/container-definitions/src/browserPackage.ts b/common/lib/container-definitions/src/browserPackage.ts index 11a1d7b6814c..2aa19cc723cd 100644 --- a/common/lib/container-definitions/src/browserPackage.ts +++ b/common/lib/container-definitions/src/browserPackage.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. */ -import { IFluidPackage, isFluidPackage, IFluidPackageEnvironment } from "@fluidframework/core-interfaces"; +import { IFluidPackage, isFluidPackage, IFluidPackageEnvironment } from "./fluidPackage"; /** * A specific Fluid package environment for browsers diff --git a/common/lib/container-definitions/src/loader.ts b/common/lib/container-definitions/src/loader.ts index 932122c2b66b..1de9174eb272 100644 --- a/common/lib/container-definitions/src/loader.ts +++ b/common/lib/container-definitions/src/loader.ts @@ -7,9 +7,6 @@ import { IRequest, IResponse, IFluidRouter, - IFluidCodeDetails, - IFluidPackage, - IProvideFluidCodeDetailsComparer, } from "@fluidframework/core-interfaces"; import { IClientDetails, @@ -25,6 +22,11 @@ import { IDeltaManager, ReadOnlyInfo } from "./deltas"; import { ICriticalContainerError, ContainerWarning } from "./error"; import { IFluidModule } from "./fluidModule"; import { AttachState } from "./runtime"; +import { + IFluidCodeDetails, + IFluidPackage, + IProvideFluidCodeDetailsComparer, +} from "./fluidPackage"; /** * Code loading interface diff --git a/common/lib/driver-definitions/src/urlResolver.ts b/common/lib/driver-definitions/src/urlResolver.ts index 927a1fc88f79..cef07089613a 100644 --- a/common/lib/driver-definitions/src/urlResolver.ts +++ b/common/lib/driver-definitions/src/urlResolver.ts @@ -3,6 +3,7 @@ * Licensed under the MIT License. */ +// Remove IFluidCodeDetails from driver layer import { IRequest, IFluidCodeDetails } from "@fluidframework/core-interfaces"; export type IResolvedUrl = IWebResolvedUrl | IFluidResolvedUrl; diff --git a/examples/hosts/host-service-interfaces/src/documentFactory.ts b/examples/hosts/host-service-interfaces/src/documentFactory.ts index 68058648fb50..efda1a1a98bd 100644 --- a/examples/hosts/host-service-interfaces/src/documentFactory.ts +++ b/examples/hosts/host-service-interfaces/src/documentFactory.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. */ -import { IFluidCodeDetails } from "@fluidframework/core-interfaces"; +import { IFluidCodeDetails } from "@fluidframework/container-definitions"; export const IDocumentFactory: keyof IProvideDocumentFactory = "IDocumentFactory"; diff --git a/examples/hosts/hosts-sample/src/codeDetailsLoader.ts b/examples/hosts/hosts-sample/src/codeDetailsLoader.ts index f78e1d351556..93f7bda3010a 100644 --- a/examples/hosts/hosts-sample/src/codeDetailsLoader.ts +++ b/examples/hosts/hosts-sample/src/codeDetailsLoader.ts @@ -6,7 +6,7 @@ import * as semver from "semver"; import { IFluidCodeDetails, IFluidCodeDetailsComparer, -} from "@fluidframework/core-interfaces"; +} from "@fluidframework/container-definitions"; import { ICodeDetailsLoader, IFluidModuleWithDetails, diff --git a/examples/hosts/hosts-sample/src/codeDetailsView.ts b/examples/hosts/hosts-sample/src/codeDetailsView.ts index 7f4f30f0a9f8..9e0ee109c424 100644 --- a/examples/hosts/hosts-sample/src/codeDetailsView.ts +++ b/examples/hosts/hosts-sample/src/codeDetailsView.ts @@ -2,8 +2,7 @@ * Copyright (c) Microsoft Corporation and contributors. All rights reserved. * Licensed under the MIT License. */ -import { IFluidCodeDetails } from "@fluidframework/core-interfaces"; -import { IContainer } from "@fluidframework/container-definitions"; +import { IContainer, IFluidCodeDetails } from "@fluidframework/container-definitions"; import { getCodeDetailsFromQuorum, parsePackageDetails } from "./utils"; /** diff --git a/examples/hosts/hosts-sample/src/utils.ts b/examples/hosts/hosts-sample/src/utils.ts index f1788617402c..972d68605972 100644 --- a/examples/hosts/hosts-sample/src/utils.ts +++ b/examples/hosts/hosts-sample/src/utils.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. */ -import { IFluidCodeDetails, FluidObject, IFluidPackage } from "@fluidframework/core-interfaces"; -import { IContainer } from "@fluidframework/container-definitions"; +import { FluidObject } from "@fluidframework/core-interfaces"; +import { IContainer, IFluidPackage, IFluidCodeDetails } from "@fluidframework/container-definitions"; import { Loader } from "@fluidframework/container-loader"; import { IFluidMountableView } from "@fluidframework/view-interfaces"; import { extractPackageIdentifierDetails } from "@fluidframework/web-code-loader"; diff --git a/examples/hosts/node-host/src/index.ts b/examples/hosts/node-host/src/index.ts index 1c5fbd18718a..a9284b331c59 100644 --- a/examples/hosts/node-host/src/index.ts +++ b/examples/hosts/node-host/src/index.ts @@ -4,7 +4,7 @@ */ import * as url from "url"; -import { IFluidCodeDetails } from "@fluidframework/core-interfaces"; +import { IFluidCodeDetails } from "@fluidframework/container-definitions"; import { Loader } from "@fluidframework/container-loader"; import { IFluidResolvedUrl } from "@fluidframework/driver-definitions"; import { ITokenClaims, IUser } from "@fluidframework/protocol-definitions"; diff --git a/experimental/PropertyDDS/packages/property-dds/src/test/propertyTree.spec.ts b/experimental/PropertyDDS/packages/property-dds/src/test/propertyTree.spec.ts index e84031ceac27..34bcfaef955e 100644 --- a/experimental/PropertyDDS/packages/property-dds/src/test/propertyTree.spec.ts +++ b/experimental/PropertyDDS/packages/property-dds/src/test/propertyTree.spec.ts @@ -6,8 +6,7 @@ import _ from "lodash"; import { expect } from "chai"; -import { IContainer, IHostLoader, ILoaderOptions } from "@fluidframework/container-definitions"; -import { IFluidCodeDetails } from "@fluidframework/core-interfaces"; +import { IContainer, IHostLoader, ILoaderOptions, IFluidCodeDetails } from "@fluidframework/container-definitions"; import { LocalResolver, LocalDocumentServiceFactory } from "@fluidframework/local-driver"; import { requestFluidObject } from "@fluidframework/runtime-utils"; import { LocalDeltaConnectionServer, ILocalDeltaConnectionServer } from "@fluidframework/server-local-server"; diff --git a/experimental/PropertyDDS/packages/property-dds/src/test/rebasing.spec.ts b/experimental/PropertyDDS/packages/property-dds/src/test/rebasing.spec.ts index 3af413657852..99022cf0f19b 100644 --- a/experimental/PropertyDDS/packages/property-dds/src/test/rebasing.spec.ts +++ b/experimental/PropertyDDS/packages/property-dds/src/test/rebasing.spec.ts @@ -6,8 +6,7 @@ /* eslint-disable @typescript-eslint/no-unused-expressions */ import * as crypto from "crypto"; import { expect } from "chai"; -import { IContainer, IHostLoader, ILoaderOptions } from "@fluidframework/container-definitions"; -import { IFluidCodeDetails } from "@fluidframework/core-interfaces"; +import { IContainer, IHostLoader, ILoaderOptions, IFluidCodeDetails } from "@fluidframework/container-definitions"; import { LocalResolver, LocalDocumentServiceFactory } from "@fluidframework/local-driver"; import { requestFluidObject } from "@fluidframework/runtime-utils"; import { IUrlResolver } from "@fluidframework/driver-definitions"; diff --git a/experimental/dds/tree/api/tree.api.md b/experimental/dds/tree/api/tree.api.md index 6ec7bbfa3ebb..021b5c9263d1 100644 --- a/experimental/dds/tree/api/tree.api.md +++ b/experimental/dds/tree/api/tree.api.md @@ -269,8 +269,6 @@ export abstract class GenericSharedTree extends SharedObject): void; - // (undocumented) - protected registerCore(): void; // @internal saveSerializedSummary(options?: { serializer?: IFluidSerializer; @@ -279,7 +277,7 @@ export abstract class GenericSharedTree extends SharedObject Date: Mon, 28 Mar 2022 16:09:59 -0700 Subject: [PATCH 03/13] import fluidPackage in driver-definitions --- .../api-report/driver-definitions.api.md | 3 +-- common/lib/driver-definitions/package.json | 24 +++++++++++++++++++ .../src/test/types/validate0.39.8.ts | 2 ++ .../src/test/types/validate0.40.0.ts | 2 ++ .../src/test/types/validate0.41.0.ts | 2 ++ .../src/test/types/validate0.42.0.ts | 2 ++ .../src/test/types/validate0.43.0.ts | 2 ++ .../src/test/types/validate0.44.0.ts | 2 ++ .../lib/driver-definitions/src/urlResolver.ts | 4 ++-- .../iframe-driver/src/innerUrlResolver.ts | 4 ++-- .../iframe-driver/src/outerUrlResolver.ts | 6 ++--- .../src/test/odspDriverResolverTest.spec.ts | 10 +++----- 12 files changed, 47 insertions(+), 16 deletions(-) diff --git a/common/lib/driver-definitions/api-report/driver-definitions.api.md b/common/lib/driver-definitions/api-report/driver-definitions.api.md index dc6216758420..ba0147afe129 100644 --- a/common/lib/driver-definitions/api-report/driver-definitions.api.md +++ b/common/lib/driver-definitions/api-report/driver-definitions.api.md @@ -12,7 +12,6 @@ import { IDisposable } from '@fluidframework/common-definitions'; import { IDocumentMessage } from '@fluidframework/protocol-definitions'; import { IErrorEvent } from '@fluidframework/common-definitions'; import { IEventProvider } from '@fluidframework/common-definitions'; -import { IFluidCodeDetails } from '@fluidframework/core-interfaces'; import { INack } from '@fluidframework/protocol-definitions'; import { IRequest } from '@fluidframework/core-interfaces'; import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions'; @@ -263,7 +262,7 @@ export interface IThrottlingWarning extends IDriverErrorBase { // @public (undocumented) export interface IUrlResolver { // (undocumented) - getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string, packageInfoSource?: IFluidCodeDetails | IContainerPackageInfo): Promise; + getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string, packageInfoSource?: IContainerPackageInfo): Promise; // (undocumented) resolve(request: IRequest): Promise; } diff --git a/common/lib/driver-definitions/package.json b/common/lib/driver-definitions/package.json index 897ac0c3abe3..67cd2b857a91 100644 --- a/common/lib/driver-definitions/package.json +++ b/common/lib/driver-definitions/package.json @@ -115,6 +115,10 @@ }, "InterfaceDeclaration_IDocumentStorageService": { "backCompat": false + }, + "InterfaceDeclaration_IUrlResolver": { + "backCompat": false, + "forwardCompat": false } }, "0.40.0": { @@ -135,6 +139,10 @@ }, "InterfaceDeclaration_IDocumentStorageService": { "backCompat": false + }, + "InterfaceDeclaration_IUrlResolver": { + "backCompat": false, + "forwardCompat": false } }, "0.41.0": { @@ -155,6 +163,10 @@ }, "InterfaceDeclaration_IDocumentStorageService": { "backCompat": false + }, + "InterfaceDeclaration_IUrlResolver": { + "backCompat": false, + "forwardCompat": false } }, "0.42.0": { @@ -172,6 +184,10 @@ }, "InterfaceDeclaration_IDocumentStorageService": { "backCompat": false + }, + "InterfaceDeclaration_IUrlResolver": { + "backCompat": false, + "forwardCompat": false } }, "0.43.0": { @@ -186,6 +202,10 @@ }, "InterfaceDeclaration_IDocumentStorageService": { "backCompat": false + }, + "InterfaceDeclaration_IUrlResolver": { + "backCompat": false, + "forwardCompat": false } }, "0.44.0": { @@ -197,6 +217,10 @@ }, "InterfaceDeclaration_IDocumentStorageService": { "backCompat": false + }, + "InterfaceDeclaration_IUrlResolver": { + "backCompat": false, + "forwardCompat": false } }, "0.45.1000": { diff --git a/common/lib/driver-definitions/src/test/types/validate0.39.8.ts b/common/lib/driver-definitions/src/test/types/validate0.39.8.ts index e653e193bce5..295053002033 100644 --- a/common/lib/driver-definitions/src/test/types/validate0.39.8.ts +++ b/common/lib/driver-definitions/src/test/types/validate0.39.8.ts @@ -658,6 +658,7 @@ declare function get_old_InterfaceDeclaration_IUrlResolver(): declare function use_current_InterfaceDeclaration_IUrlResolver( use: current.IUrlResolver); use_current_InterfaceDeclaration_IUrlResolver( + // @ts-expect-error compatibility expected to be broken get_old_InterfaceDeclaration_IUrlResolver()); /* @@ -670,6 +671,7 @@ declare function get_current_InterfaceDeclaration_IUrlResolver(): declare function use_old_InterfaceDeclaration_IUrlResolver( use: old.IUrlResolver); use_old_InterfaceDeclaration_IUrlResolver( + // @ts-expect-error compatibility expected to be broken get_current_InterfaceDeclaration_IUrlResolver()); /* diff --git a/common/lib/driver-definitions/src/test/types/validate0.40.0.ts b/common/lib/driver-definitions/src/test/types/validate0.40.0.ts index 4404b6dab448..175f5c43a03b 100644 --- a/common/lib/driver-definitions/src/test/types/validate0.40.0.ts +++ b/common/lib/driver-definitions/src/test/types/validate0.40.0.ts @@ -648,6 +648,7 @@ declare function get_old_InterfaceDeclaration_IUrlResolver(): declare function use_current_InterfaceDeclaration_IUrlResolver( use: current.IUrlResolver); use_current_InterfaceDeclaration_IUrlResolver( + // @ts-expect-error compatibility expected to be broken get_old_InterfaceDeclaration_IUrlResolver()); /* @@ -660,6 +661,7 @@ declare function get_current_InterfaceDeclaration_IUrlResolver(): declare function use_old_InterfaceDeclaration_IUrlResolver( use: old.IUrlResolver); use_old_InterfaceDeclaration_IUrlResolver( + // @ts-expect-error compatibility expected to be broken get_current_InterfaceDeclaration_IUrlResolver()); /* diff --git a/common/lib/driver-definitions/src/test/types/validate0.41.0.ts b/common/lib/driver-definitions/src/test/types/validate0.41.0.ts index 66289c7ec37f..ece8390be36e 100644 --- a/common/lib/driver-definitions/src/test/types/validate0.41.0.ts +++ b/common/lib/driver-definitions/src/test/types/validate0.41.0.ts @@ -648,6 +648,7 @@ declare function get_old_InterfaceDeclaration_IUrlResolver(): declare function use_current_InterfaceDeclaration_IUrlResolver( use: current.IUrlResolver); use_current_InterfaceDeclaration_IUrlResolver( + // @ts-expect-error compatibility expected to be broken get_old_InterfaceDeclaration_IUrlResolver()); /* @@ -660,6 +661,7 @@ declare function get_current_InterfaceDeclaration_IUrlResolver(): declare function use_old_InterfaceDeclaration_IUrlResolver( use: old.IUrlResolver); use_old_InterfaceDeclaration_IUrlResolver( + // @ts-expect-error compatibility expected to be broken get_current_InterfaceDeclaration_IUrlResolver()); /* diff --git a/common/lib/driver-definitions/src/test/types/validate0.42.0.ts b/common/lib/driver-definitions/src/test/types/validate0.42.0.ts index 3c1d390b9304..832d9fc714d7 100644 --- a/common/lib/driver-definitions/src/test/types/validate0.42.0.ts +++ b/common/lib/driver-definitions/src/test/types/validate0.42.0.ts @@ -648,6 +648,7 @@ declare function get_old_InterfaceDeclaration_IUrlResolver(): declare function use_current_InterfaceDeclaration_IUrlResolver( use: current.IUrlResolver); use_current_InterfaceDeclaration_IUrlResolver( + // @ts-expect-error compatibility expected to be broken get_old_InterfaceDeclaration_IUrlResolver()); /* @@ -660,6 +661,7 @@ declare function get_current_InterfaceDeclaration_IUrlResolver(): declare function use_old_InterfaceDeclaration_IUrlResolver( use: old.IUrlResolver); use_old_InterfaceDeclaration_IUrlResolver( + // @ts-expect-error compatibility expected to be broken get_current_InterfaceDeclaration_IUrlResolver()); /* diff --git a/common/lib/driver-definitions/src/test/types/validate0.43.0.ts b/common/lib/driver-definitions/src/test/types/validate0.43.0.ts index c8dc275a7934..205b75edd1c1 100644 --- a/common/lib/driver-definitions/src/test/types/validate0.43.0.ts +++ b/common/lib/driver-definitions/src/test/types/validate0.43.0.ts @@ -647,6 +647,7 @@ declare function get_old_InterfaceDeclaration_IUrlResolver(): declare function use_current_InterfaceDeclaration_IUrlResolver( use: current.IUrlResolver); use_current_InterfaceDeclaration_IUrlResolver( + // @ts-expect-error compatibility expected to be broken get_old_InterfaceDeclaration_IUrlResolver()); /* @@ -659,6 +660,7 @@ declare function get_current_InterfaceDeclaration_IUrlResolver(): declare function use_old_InterfaceDeclaration_IUrlResolver( use: old.IUrlResolver); use_old_InterfaceDeclaration_IUrlResolver( + // @ts-expect-error compatibility expected to be broken get_current_InterfaceDeclaration_IUrlResolver()); /* diff --git a/common/lib/driver-definitions/src/test/types/validate0.44.0.ts b/common/lib/driver-definitions/src/test/types/validate0.44.0.ts index 5ad3eec04425..445fd6df18aa 100644 --- a/common/lib/driver-definitions/src/test/types/validate0.44.0.ts +++ b/common/lib/driver-definitions/src/test/types/validate0.44.0.ts @@ -646,6 +646,7 @@ declare function get_old_InterfaceDeclaration_IUrlResolver(): declare function use_current_InterfaceDeclaration_IUrlResolver( use: current.IUrlResolver); use_current_InterfaceDeclaration_IUrlResolver( + // @ts-expect-error compatibility expected to be broken get_old_InterfaceDeclaration_IUrlResolver()); /* @@ -658,6 +659,7 @@ declare function get_current_InterfaceDeclaration_IUrlResolver(): declare function use_old_InterfaceDeclaration_IUrlResolver( use: old.IUrlResolver); use_old_InterfaceDeclaration_IUrlResolver( + // @ts-expect-error compatibility expected to be broken get_current_InterfaceDeclaration_IUrlResolver()); /* diff --git a/common/lib/driver-definitions/src/urlResolver.ts b/common/lib/driver-definitions/src/urlResolver.ts index cef07089613a..a32b25044191 100644 --- a/common/lib/driver-definitions/src/urlResolver.ts +++ b/common/lib/driver-definitions/src/urlResolver.ts @@ -4,7 +4,7 @@ */ // Remove IFluidCodeDetails from driver layer -import { IRequest, IFluidCodeDetails } from "@fluidframework/core-interfaces"; +import { IRequest } from "@fluidframework/core-interfaces"; export type IResolvedUrl = IWebResolvedUrl | IFluidResolvedUrl; @@ -49,7 +49,7 @@ export interface IUrlResolver { getAbsoluteUrl( resolvedUrl: IResolvedUrl, relativeUrl: string, - packageInfoSource?: IFluidCodeDetails | IContainerPackageInfo, + packageInfoSource?: IContainerPackageInfo, ): Promise; } diff --git a/packages/drivers/iframe-driver/src/innerUrlResolver.ts b/packages/drivers/iframe-driver/src/innerUrlResolver.ts index 3197dfa6ed03..72fdfd08e540 100644 --- a/packages/drivers/iframe-driver/src/innerUrlResolver.ts +++ b/packages/drivers/iframe-driver/src/innerUrlResolver.ts @@ -6,7 +6,7 @@ // Remove IFluidCodeDetails from driver layer import * as Comlink from "comlink"; import { assert } from "@fluidframework/common-utils"; -import { IRequest, IFluidCodeDetails } from "@fluidframework/core-interfaces"; +import { IRequest } from "@fluidframework/core-interfaces"; import { IContainerPackageInfo, IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions"; import { IUrlResolverProxy, IUrlResolverProxyKey } from "./outerUrlResolver"; import { MakeThinProxy } from "./proxyUtils"; @@ -34,7 +34,7 @@ export class InnerUrlResolver implements IUrlResolver { public async getAbsoluteUrl( resolvedUrl: IResolvedUrl, relativeUrl: string, - packageInfoSource?: IContainerPackageInfo | IFluidCodeDetails, + packageInfoSource?: IContainerPackageInfo, ): Promise { return this.outerProxy.getAbsoluteUrl( MakeThinProxy(resolvedUrl), diff --git a/packages/drivers/iframe-driver/src/outerUrlResolver.ts b/packages/drivers/iframe-driver/src/outerUrlResolver.ts index f89d4fb9eb32..95d023c12f6b 100644 --- a/packages/drivers/iframe-driver/src/outerUrlResolver.ts +++ b/packages/drivers/iframe-driver/src/outerUrlResolver.ts @@ -5,7 +5,7 @@ // Remove IFluidCodeDetails from driver layer import * as Comlink from "comlink"; -import { IRequest, IFluidCodeDetails } from "@fluidframework/core-interfaces"; +import { IRequest } from "@fluidframework/core-interfaces"; import { IContainerPackageInfo, IUrlResolver, IResolvedUrl } from "@fluidframework/driver-definitions"; import { MakeThinProxy } from "./proxyUtils"; @@ -17,7 +17,7 @@ export interface IUrlResolverProxy { getAbsoluteUrl( resolvedUrlFn: () => Promise, relativeUrl: string, - packageInfoFn: () => Promise, + packageInfoFn: () => Promise, ): Promise, } @@ -52,7 +52,7 @@ export class OuterUrlResolver { public async getAbsoluteUrl( resolvedUrlFn: () => Promise, relativeUrl: string, - packageInfoFn: () => Promise, + packageInfoFn: () => Promise, ): Promise { const resolvedUrl = await resolvedUrlFn(); const packageInfo = await packageInfoFn(); diff --git a/packages/drivers/odsp-driver/src/test/odspDriverResolverTest.spec.ts b/packages/drivers/odsp-driver/src/test/odspDriverResolverTest.spec.ts index 5bcf503ed5be..03a94a886a95 100644 --- a/packages/drivers/odsp-driver/src/test/odspDriverResolverTest.spec.ts +++ b/packages/drivers/odsp-driver/src/test/odspDriverResolverTest.spec.ts @@ -7,7 +7,7 @@ import { strict as assert } from "assert"; import { DriverHeader } from "@fluidframework/driver-definitions"; import { ensureFluidResolvedUrl } from "@fluidframework/driver-utils"; -import { IFluidPackage, IRequest } from "@fluidframework/core-interfaces"; +import { IRequest } from "@fluidframework/core-interfaces"; import { IOdspResolvedUrl } from "@fluidframework/odsp-driver-definitions"; import { OdspDriverUrlResolver } from "../odspDriverUrlResolver"; import { getHashedDocumentId } from "../odspPublicUtils"; @@ -106,7 +106,7 @@ describe("Odsp Driver Resolver", () => { it("Should resolve url with a string in the codeDetails package", async () => { const resolvedUrl = await resolver.resolve(request); - const codeDetails = { package: packageName }; + const codeDetails = { name: packageName }; const response = await resolver.getAbsoluteUrl(resolvedUrl, "/datastore", codeDetails); const [url, queryString] = response?.split("?") ?? []; @@ -133,11 +133,7 @@ describe("Odsp Driver Resolver", () => { it("Should resolve url with a IFluidPackage in the codeDetails package", async () => { const resolvedUrl = await resolver.resolve(request); - const fluidPackage: IFluidPackage = { - name: packageName, - fluid: {}, - }; - const codeDetails = { package: fluidPackage }; + const codeDetails = { name: packageName }; const response = await resolver.getAbsoluteUrl(resolvedUrl, "/datastore", codeDetails); const [url, queryString] = response?.split("?") ?? []; From be4f850308595d2079cf9b69f043b0b75baaea0c Mon Sep 17 00:00:00 2001 From: sdeshpande3 Date: Mon, 28 Mar 2022 16:20:53 -0700 Subject: [PATCH 04/13] nits --- common/lib/driver-definitions/src/urlResolver.ts | 2 -- packages/drivers/iframe-driver/src/innerUrlResolver.ts | 2 -- packages/drivers/iframe-driver/src/outerUrlResolver.ts | 2 -- .../drivers/odsp-driver/src/test/odspDriverResolverTest.spec.ts | 2 -- 4 files changed, 8 deletions(-) diff --git a/common/lib/driver-definitions/src/urlResolver.ts b/common/lib/driver-definitions/src/urlResolver.ts index a32b25044191..b7a6e5691d88 100644 --- a/common/lib/driver-definitions/src/urlResolver.ts +++ b/common/lib/driver-definitions/src/urlResolver.ts @@ -2,8 +2,6 @@ * Copyright (c) Microsoft Corporation and contributors. All rights reserved. * Licensed under the MIT License. */ - -// Remove IFluidCodeDetails from driver layer import { IRequest } from "@fluidframework/core-interfaces"; export type IResolvedUrl = IWebResolvedUrl | IFluidResolvedUrl; diff --git a/packages/drivers/iframe-driver/src/innerUrlResolver.ts b/packages/drivers/iframe-driver/src/innerUrlResolver.ts index 72fdfd08e540..3258881487dc 100644 --- a/packages/drivers/iframe-driver/src/innerUrlResolver.ts +++ b/packages/drivers/iframe-driver/src/innerUrlResolver.ts @@ -2,8 +2,6 @@ * Copyright (c) Microsoft Corporation and contributors. All rights reserved. * Licensed under the MIT License. */ - -// Remove IFluidCodeDetails from driver layer import * as Comlink from "comlink"; import { assert } from "@fluidframework/common-utils"; import { IRequest } from "@fluidframework/core-interfaces"; diff --git a/packages/drivers/iframe-driver/src/outerUrlResolver.ts b/packages/drivers/iframe-driver/src/outerUrlResolver.ts index 95d023c12f6b..98e5ef166b4c 100644 --- a/packages/drivers/iframe-driver/src/outerUrlResolver.ts +++ b/packages/drivers/iframe-driver/src/outerUrlResolver.ts @@ -2,8 +2,6 @@ * Copyright (c) Microsoft Corporation and contributors. All rights reserved. * Licensed under the MIT License. */ - -// Remove IFluidCodeDetails from driver layer import * as Comlink from "comlink"; import { IRequest } from "@fluidframework/core-interfaces"; import { IContainerPackageInfo, IUrlResolver, IResolvedUrl } from "@fluidframework/driver-definitions"; diff --git a/packages/drivers/odsp-driver/src/test/odspDriverResolverTest.spec.ts b/packages/drivers/odsp-driver/src/test/odspDriverResolverTest.spec.ts index 03a94a886a95..d49eb645e4e0 100644 --- a/packages/drivers/odsp-driver/src/test/odspDriverResolverTest.spec.ts +++ b/packages/drivers/odsp-driver/src/test/odspDriverResolverTest.spec.ts @@ -2,8 +2,6 @@ * Copyright (c) Microsoft Corporation and contributors. All rights reserved. * Licensed under the MIT License. */ - -// Remove IFluidCodeDetails from driver layer import { strict as assert } from "assert"; import { DriverHeader } from "@fluidframework/driver-definitions"; import { ensureFluidResolvedUrl } from "@fluidframework/driver-utils"; From 25ec627267b9fb5aa4bf087cd99f65f1531f9f52 Mon Sep 17 00:00:00 2001 From: sdeshpande3 Date: Mon, 28 Mar 2022 19:47:26 -0700 Subject: [PATCH 05/13] Remove IFluidCodeDetails from driver layer --- api-report/iframe-driver.api.md | 7 +++---- api-report/odsp-driver.api.md | 5 ++--- .../odsp-driver/src/odspDriverUrlResolver.ts | 15 +++------------ .../src/odspDriverUrlResolverForShareLink.ts | 15 +++------------ packages/loader/container-loader/src/container.ts | 13 ++++++++++++- 5 files changed, 23 insertions(+), 32 deletions(-) diff --git a/api-report/iframe-driver.api.md b/api-report/iframe-driver.api.md index 3839786c33a2..e957db02c4c2 100644 --- a/api-report/iframe-driver.api.md +++ b/api-report/iframe-driver.api.md @@ -19,7 +19,6 @@ import { IDocumentMessage } from '@fluidframework/protocol-definitions'; import { IDocumentService } from '@fluidframework/driver-definitions'; import { IDocumentServiceFactory } from '@fluidframework/driver-definitions'; import { IDocumentStorageService } from '@fluidframework/driver-definitions'; -import { IFluidCodeDetails } from '@fluidframework/core-interfaces'; import { IRequest } from '@fluidframework/core-interfaces'; import { IResolvedUrl } from '@fluidframework/driver-definitions'; import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions'; @@ -140,7 +139,7 @@ export class InnerUrlResolver implements IUrlResolver { // (undocumented) static create(outerPort: MessagePort): Promise; // (undocumented) - getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string, packageInfoSource?: IContainerPackageInfo | IFluidCodeDetails): Promise; + getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string, packageInfoSource?: IContainerPackageInfo): Promise; // (undocumented) resolve(request: IRequest): Promise; } @@ -162,7 +161,7 @@ export interface IUrlResolverProxy { // (undocumented) connected(): Promise; // (undocumented) - getAbsoluteUrl(resolvedUrlFn: () => Promise, relativeUrl: string, packageInfoFn: () => Promise): Promise; + getAbsoluteUrl(resolvedUrlFn: () => Promise, relativeUrl: string, packageInfoFn: () => Promise): Promise; // (undocumented) resolve(request: IRequest): Promise<() => Promise>; } @@ -178,7 +177,7 @@ export class OuterUrlResolver { // (undocumented) createProxy(): IUrlResolverProxy; // (undocumented) - getAbsoluteUrl(resolvedUrlFn: () => Promise, relativeUrl: string, packageInfoFn: () => Promise): Promise; + getAbsoluteUrl(resolvedUrlFn: () => Promise, relativeUrl: string, packageInfoFn: () => Promise): Promise; // (undocumented) resolve(request: IRequest): Promise<() => Promise>; } diff --git a/api-report/odsp-driver.api.md b/api-report/odsp-driver.api.md index 82c9bfcc37b2..4d8b320144a4 100644 --- a/api-report/odsp-driver.api.md +++ b/api-report/odsp-driver.api.md @@ -10,7 +10,6 @@ import { IContainerPackageInfo } from '@fluidframework/driver-definitions'; import { IdentityType } from '@fluidframework/odsp-driver-definitions'; import { IDocumentService } from '@fluidframework/driver-definitions'; import { IDocumentServiceFactory } from '@fluidframework/driver-definitions'; -import { IFluidCodeDetails } from '@fluidframework/core-interfaces'; import type { io } from 'socket.io-client'; import { IOdspResolvedUrl } from '@fluidframework/odsp-driver-definitions'; import { IOdspUrlParts } from '@fluidframework/odsp-driver-definitions'; @@ -112,7 +111,7 @@ export class OdspDocumentServiceFactoryWithCodeSplit extends OdspDocumentService export class OdspDriverUrlResolver implements IUrlResolver { constructor(); // (undocumented) - getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string, packageInfoSource?: IContainerPackageInfo | IFluidCodeDetails): Promise; + getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string, packageInfoSource?: IContainerPackageInfo): Promise; // (undocumented) resolve(request: IRequest): Promise; } @@ -123,7 +122,7 @@ export class OdspDriverUrlResolverForShareLink implements IUrlResolver { appendDataStorePath(requestUrl: URL, pathToAppend: string): string | undefined; static createDocumentUrl(baseUrl: string, driverInfo: OdspFluidDataStoreLocator): string; static createNavParam(locator: OdspFluidDataStoreLocator): string; - getAbsoluteUrl(resolvedUrl: IResolvedUrl, dataStorePath: string, packageInfoSource?: IContainerPackageInfo | IFluidCodeDetails): Promise; + getAbsoluteUrl(resolvedUrl: IResolvedUrl, dataStorePath: string, packageInfoSource?: IContainerPackageInfo): Promise; resolve(request: IRequest): Promise; } diff --git a/packages/drivers/odsp-driver/src/odspDriverUrlResolver.ts b/packages/drivers/odsp-driver/src/odspDriverUrlResolver.ts index 3effd3e4f4f2..7d243e7ecbe3 100644 --- a/packages/drivers/odsp-driver/src/odspDriverUrlResolver.ts +++ b/packages/drivers/odsp-driver/src/odspDriverUrlResolver.ts @@ -5,7 +5,7 @@ // Remove IFluidCodeDetails from driver layer import { assert } from "@fluidframework/common-utils"; -import { IFluidCodeDetails, IRequest, isFluidPackage } from "@fluidframework/core-interfaces"; +import { IRequest } from "@fluidframework/core-interfaces"; import { DriverHeader, IContainerPackageInfo, @@ -157,23 +157,14 @@ export class OdspDriverUrlResolver implements IUrlResolver { public async getAbsoluteUrl( resolvedUrl: IResolvedUrl, relativeUrl: string, - packageInfoSource?: IContainerPackageInfo | IFluidCodeDetails, + packageInfoSource?: IContainerPackageInfo, ): Promise { let dataStorePath = relativeUrl; if (dataStorePath.startsWith("/")) { dataStorePath = dataStorePath.substr(1); } const odspResolvedUrl = getOdspResolvedUrl(resolvedUrl); - - // back-compat: IFluidCodeDetails usage to be removed in 0.58.0 - let containerPackageName; - if (packageInfoSource && "name" in packageInfoSource) { - containerPackageName = packageInfoSource.name; - } else if (isFluidPackage(packageInfoSource?.package)) { - containerPackageName = packageInfoSource?.package.name; - } else { - containerPackageName = packageInfoSource?.package; - } + let containerPackageName = packageInfoSource?.name; containerPackageName = containerPackageName ?? odspResolvedUrl.codeHint?.containerPackageName; return createOdspUrl({ diff --git a/packages/drivers/odsp-driver/src/odspDriverUrlResolverForShareLink.ts b/packages/drivers/odsp-driver/src/odspDriverUrlResolverForShareLink.ts index a847a0f1697f..cdd92449b405 100644 --- a/packages/drivers/odsp-driver/src/odspDriverUrlResolverForShareLink.ts +++ b/packages/drivers/odsp-driver/src/odspDriverUrlResolverForShareLink.ts @@ -5,7 +5,7 @@ // Remove IFluidCodeDetails from driver layer import { PromiseCache } from "@fluidframework/common-utils"; -import { IFluidCodeDetails, IRequest, isFluidPackage } from "@fluidframework/core-interfaces"; +import { IRequest } from "@fluidframework/core-interfaces"; import { IContainerPackageInfo, IResolvedUrl, @@ -192,21 +192,12 @@ export class OdspDriverUrlResolverForShareLink implements IUrlResolver { public async getAbsoluteUrl( resolvedUrl: IResolvedUrl, dataStorePath: string, - packageInfoSource?: IContainerPackageInfo | IFluidCodeDetails, + packageInfoSource?: IContainerPackageInfo, ): Promise { const odspResolvedUrl = getOdspResolvedUrl(resolvedUrl); const shareLink = await this.getShareLinkPromise(odspResolvedUrl); const shareLinkUrl = new URL(shareLink); - - // back-compat: IFluidCodeDetails usage to be removed in 0.58.0 - let containerPackageName; - if (packageInfoSource && "name" in packageInfoSource) { - containerPackageName = packageInfoSource.name; - } else if (isFluidPackage(packageInfoSource?.package)) { - containerPackageName = packageInfoSource?.package.name; - } else { - containerPackageName = packageInfoSource?.package; - } + let containerPackageName = packageInfoSource?.name; containerPackageName = containerPackageName ?? odspResolvedUrl.codeHint?.containerPackageName; storeLocatorInOdspUrl(shareLinkUrl, { diff --git a/packages/loader/container-loader/src/container.ts b/packages/loader/container-loader/src/container.ts index 34aa5c67ee86..0cfde0bf2e41 100644 --- a/packages/loader/container-loader/src/container.ts +++ b/packages/loader/container-loader/src/container.ts @@ -30,6 +30,7 @@ import { IContainerLoadMode, IFluidCodeDetails, isFluidCodeDetails, + isFluidPackage, } from "@fluidframework/container-definitions"; import { DataCorruptionError, @@ -983,10 +984,20 @@ export class Container extends EventEmitterWithErrorHandling i return undefined; } + let containerPackageName; + let codeDetails = this._context?.codeDetails; + if (codeDetails && "name" in codeDetails) { + containerPackageName = codeDetails; + } else if (isFluidPackage(codeDetails?.package)) { + containerPackageName = codeDetails?.package.name; + } else { + containerPackageName = codeDetails?.package; + } + return this.urlResolver.getAbsoluteUrl( this.resolvedUrl, relativeUrl, - this._context?.codeDetails); + { name: containerPackageName }); } public async proposeCodeDetails(codeDetails: IFluidCodeDetails) { From a537ba89d579c8b64d981316cfce0c4f2e252d1e Mon Sep 17 00:00:00 2001 From: sdeshpande3 Date: Mon, 28 Mar 2022 19:48:08 -0700 Subject: [PATCH 06/13] nits --- packages/drivers/odsp-driver/src/odspDriverUrlResolver.ts | 2 -- .../odsp-driver/src/odspDriverUrlResolverForShareLink.ts | 2 -- 2 files changed, 4 deletions(-) diff --git a/packages/drivers/odsp-driver/src/odspDriverUrlResolver.ts b/packages/drivers/odsp-driver/src/odspDriverUrlResolver.ts index 7d243e7ecbe3..0f6a33aa5404 100644 --- a/packages/drivers/odsp-driver/src/odspDriverUrlResolver.ts +++ b/packages/drivers/odsp-driver/src/odspDriverUrlResolver.ts @@ -2,8 +2,6 @@ * Copyright (c) Microsoft Corporation and contributors. All rights reserved. * Licensed under the MIT License. */ - -// Remove IFluidCodeDetails from driver layer import { assert } from "@fluidframework/common-utils"; import { IRequest } from "@fluidframework/core-interfaces"; import { diff --git a/packages/drivers/odsp-driver/src/odspDriverUrlResolverForShareLink.ts b/packages/drivers/odsp-driver/src/odspDriverUrlResolverForShareLink.ts index cdd92449b405..eefafb903afd 100644 --- a/packages/drivers/odsp-driver/src/odspDriverUrlResolverForShareLink.ts +++ b/packages/drivers/odsp-driver/src/odspDriverUrlResolverForShareLink.ts @@ -2,8 +2,6 @@ * Copyright (c) Microsoft Corporation and contributors. All rights reserved. * Licensed under the MIT License. */ - -// Remove IFluidCodeDetails from driver layer import { PromiseCache } from "@fluidframework/common-utils"; import { IRequest } from "@fluidframework/core-interfaces"; import { From 8b708c98acad01e16512f3d7e2dd8bf9eb3e1d2e Mon Sep 17 00:00:00 2001 From: sdeshpande3 Date: Mon, 28 Mar 2022 19:56:32 -0700 Subject: [PATCH 07/13] update breaking.md with getAbsoluteUrl() info --- BREAKING.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/BREAKING.md b/BREAKING.md index 7618e3d5c29e..9b0c1a03092d 100644 --- a/BREAKING.md +++ b/BREAKING.md @@ -21,6 +21,7 @@ There are a few steps you can take to write a good change note and avoid needing ## 0.59 Breaking changes - [Removing Commit from TreeEntry and commits from SnapShotTree](#Removing-Commit-from-TreeEntry-and-commits-from-SnapShotTree) - [Remove `@fluidframework/core-interface#fluidPackage.ts`](#Remove-fluidframeworkcore-interfacefluidPackagets) +- [getAbsoluteUrl() argument type changed](#getAbsoluteUrl-argument-type-changed) ### Removing Commit from TreeEntry and commits from SnapShotTree Cleaning up properties that are not being used in the codebase: `TreeEntry.Commit` and `ISnapshotTree.commits`. @@ -38,6 +39,29 @@ All the interfaces and const from `fluidPackage.ts` were moved to `@fluidframewo - `IProvideFluidCodeDetailsComparer` - `IFluidCodeDetailsComparer` +### `getAbsoluteUrl()` argument type changed +`packageInfoSource` argument is typed to `IContainerPackageInfo` interface. + +```diff +- getAbsoluteUrl( +- resolvedUrl: IResolvedUrl, +- relativeUrl: string, +- packageInfoSource?: IFluidCodeDetails | IContainerPackageInfo, +- ): Promise; + ++ interface IContainerPackageInfo { ++ /** ++ * Container package name. ++ */ ++ name: string; ++ } + ++ getAbsoluteUrl( ++ resolvedUrl: IResolvedUrl, ++ relativeUrl: string, ++ packageInfoSource?: IContainerPackageInfo, ++ ): Promise; +``` # 0.58 From 1d48804ec94d145ede959e2e1239b6008a81bca5 Mon Sep 17 00:00:00 2001 From: sdeshpande3 Date: Tue, 29 Mar 2022 09:03:22 -0700 Subject: [PATCH 08/13] breaking change nits --- BREAKING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BREAKING.md b/BREAKING.md index 9b0c1a03092d..71632d4c2884 100644 --- a/BREAKING.md +++ b/BREAKING.md @@ -40,7 +40,7 @@ All the interfaces and const from `fluidPackage.ts` were moved to `@fluidframewo - `IFluidCodeDetailsComparer` ### `getAbsoluteUrl()` argument type changed -`packageInfoSource` argument is typed to `IContainerPackageInfo` interface. +The `packageInfoSource` argument in `getAbsoluteUrl()` on `@fluidframework/odsp-driver`, `@fluidframework/iframe-driver`, and `@fluidframework/driver-definitions` is typed to `IContainerPackageInfo` interface only. ```diff - getAbsoluteUrl( From 78c7521a4d144feac9b3775e6673fcdb177e9731 Mon Sep 17 00:00:00 2001 From: sdeshpande3 Date: Tue, 29 Mar 2022 15:37:36 -0700 Subject: [PATCH 09/13] back-compat code --- api-report/container-loader.api.md | 3 ++ .../odsp-driver/src/odspDriverUrlResolver.ts | 15 +++++++++- .../src/odspDriverUrlResolverForShareLink.ts | 14 +++++++++- .../src/test/odspDriverResolverTest.spec.ts | 28 ------------------- .../loader/container-loader/src/container.ts | 17 ++++++----- 5 files changed, 40 insertions(+), 37 deletions(-) diff --git a/api-report/container-loader.api.md b/api-report/container-loader.api.md index f46f1e7e73f7..d16f84be98e3 100644 --- a/api-report/container-loader.api.md +++ b/api-report/container-loader.api.md @@ -16,6 +16,7 @@ import { IConfigProviderBase } from '@fluidframework/telemetry-utils'; import { IContainer } from '@fluidframework/container-definitions'; import { IContainerEvents } from '@fluidframework/container-definitions'; import { IContainerLoadMode } from '@fluidframework/container-definitions'; +import { IContainerPackageInfo } from '@fluidframework/driver-definitions'; import { ICriticalContainerError } from '@fluidframework/container-definitions'; import { IDeltaManager } from '@fluidframework/container-definitions'; import { IDocumentMessage } from '@fluidframework/protocol-definitions'; @@ -77,6 +78,8 @@ export class Container extends EventEmitterWithErrorHandling i // (undocumented) getAbsoluteUrl(relativeUrl: string): Promise; getLoadedCodeDetails(): IFluidCodeDetails | undefined; + // (undocumented) + getPackageName(codeDetails: IFluidCodeDetails | undefined): IContainerPackageInfo; getQuorum(): IQuorumClients; getSpecifiedCodeDetails(): IFluidCodeDetails | undefined; // (undocumented) diff --git a/packages/drivers/odsp-driver/src/odspDriverUrlResolver.ts b/packages/drivers/odsp-driver/src/odspDriverUrlResolver.ts index 0f6a33aa5404..e85cfd7f6e9b 100644 --- a/packages/drivers/odsp-driver/src/odspDriverUrlResolver.ts +++ b/packages/drivers/odsp-driver/src/odspDriverUrlResolver.ts @@ -162,7 +162,20 @@ export class OdspDriverUrlResolver implements IUrlResolver { dataStorePath = dataStorePath.substr(1); } const odspResolvedUrl = getOdspResolvedUrl(resolvedUrl); - let containerPackageName = packageInfoSource?.name; + // back-compat: GitHub #9653 + const isFluidPackage = (pkg: any) => + typeof pkg === "object" + && typeof pkg?.name === "string" + && typeof pkg?.fluid === "object"; + // back-compat: IFluidCodeDetails usage to be removed in 0.58.0 + let containerPackageName; + if (packageInfoSource && "name" in packageInfoSource) { + containerPackageName = packageInfoSource.name; + } else if (isFluidPackage((packageInfoSource as any)?.package)) { + containerPackageName = (packageInfoSource as any)?.package.name; + } else { + containerPackageName = (packageInfoSource as any)?.package; + } containerPackageName = containerPackageName ?? odspResolvedUrl.codeHint?.containerPackageName; return createOdspUrl({ diff --git a/packages/drivers/odsp-driver/src/odspDriverUrlResolverForShareLink.ts b/packages/drivers/odsp-driver/src/odspDriverUrlResolverForShareLink.ts index eefafb903afd..53776c9bd118 100644 --- a/packages/drivers/odsp-driver/src/odspDriverUrlResolverForShareLink.ts +++ b/packages/drivers/odsp-driver/src/odspDriverUrlResolverForShareLink.ts @@ -195,7 +195,19 @@ export class OdspDriverUrlResolverForShareLink implements IUrlResolver { const odspResolvedUrl = getOdspResolvedUrl(resolvedUrl); const shareLink = await this.getShareLinkPromise(odspResolvedUrl); const shareLinkUrl = new URL(shareLink); - let containerPackageName = packageInfoSource?.name; + // back-compat: GitHub #9653 + const isFluidPackage = (pkg: any) => + typeof pkg === "object" + && typeof pkg?.name === "string" + && typeof pkg?.fluid === "object"; + let containerPackageName; + if (packageInfoSource && "name" in packageInfoSource) { + containerPackageName = packageInfoSource.name; + } else if (isFluidPackage((packageInfoSource as any)?.package)) { + containerPackageName = (packageInfoSource as any)?.package.name; + } else { + containerPackageName = (packageInfoSource as any)?.package; + } containerPackageName = containerPackageName ?? odspResolvedUrl.codeHint?.containerPackageName; storeLocatorInOdspUrl(shareLinkUrl, { diff --git a/packages/drivers/odsp-driver/src/test/odspDriverResolverTest.spec.ts b/packages/drivers/odsp-driver/src/test/odspDriverResolverTest.spec.ts index d49eb645e4e0..8b0785e449fc 100644 --- a/packages/drivers/odsp-driver/src/test/odspDriverResolverTest.spec.ts +++ b/packages/drivers/odsp-driver/src/test/odspDriverResolverTest.spec.ts @@ -102,20 +102,6 @@ describe("Odsp Driver Resolver", () => { assert.strictEqual(resolvedUrl.shareLinkInfo.createLink.type, createLinkType); }); - it("Should resolve url with a string in the codeDetails package", async () => { - const resolvedUrl = await resolver.resolve(request); - const codeDetails = { name: packageName }; - const response = await resolver.getAbsoluteUrl(resolvedUrl, "/datastore", codeDetails); - - const [url, queryString] = response?.split("?") ?? []; - const searchParams = new URLSearchParams(queryString); - assert.strictEqual(searchParams.get("itemId"), resolvedUrl.itemId, "Item id should match"); - assert.strictEqual(searchParams.get("driveId"), driveId, "Drive Id should match"); - assert.strictEqual(searchParams.get("path"), "datastore", "Path should match"); - assert.strictEqual(searchParams.get("containerPackageName"), packageName, "ContainerPackageName should match"); - assert.strictEqual(url, `${siteUrl}`, "Url should match"); - }); - it("Should resolve url given container package info", async () => { const resolvedUrl = await resolver.resolve(request); const response = await resolver.getAbsoluteUrl(resolvedUrl, "/datastore", {name: packageName}); @@ -129,20 +115,6 @@ describe("Odsp Driver Resolver", () => { assert.strictEqual(url, `${siteUrl}`, "Url should match"); }); - it("Should resolve url with a IFluidPackage in the codeDetails package", async () => { - const resolvedUrl = await resolver.resolve(request); - const codeDetails = { name: packageName }; - const response = await resolver.getAbsoluteUrl(resolvedUrl, "/datastore", codeDetails); - - const [url, queryString] = response?.split("?") ?? []; - const searchParams = new URLSearchParams(queryString); - assert.strictEqual(searchParams.get("itemId"), resolvedUrl.itemId, "Item id should match"); - assert.strictEqual(searchParams.get("driveId"), driveId, "Drive Id should match"); - assert.strictEqual(searchParams.get("path"), "datastore", "Path should match"); - assert.strictEqual(searchParams.get("containerPackageName"), packageName, "ContainerPackageName should match"); - assert.strictEqual(url, `${siteUrl}`, "Url should match"); - }); - it("Should resolve url with a codeHint in the resolved url", async () => { const newRequest = request; newRequest.url += `&containerPackageName=${encodeURIComponent(packageName)}`; diff --git a/packages/loader/container-loader/src/container.ts b/packages/loader/container-loader/src/container.ts index 0cfde0bf2e41..ec95530e0870 100644 --- a/packages/loader/container-loader/src/container.ts +++ b/packages/loader/container-loader/src/container.ts @@ -39,6 +39,7 @@ import { UsageError, } from "@fluidframework/container-utils"; import { + IContainerPackageInfo, IDocumentService, IDocumentStorageService, IFluidResolvedUrl, @@ -979,13 +980,8 @@ export class Container extends EventEmitterWithErrorHandling i this.emit("warning", warning); } - public async getAbsoluteUrl(relativeUrl: string): Promise { - if (this.resolvedUrl === undefined) { - return undefined; - } - + public getPackageName(codeDetails: IFluidCodeDetails | undefined): IContainerPackageInfo { let containerPackageName; - let codeDetails = this._context?.codeDetails; if (codeDetails && "name" in codeDetails) { containerPackageName = codeDetails; } else if (isFluidPackage(codeDetails?.package)) { @@ -993,11 +989,18 @@ export class Container extends EventEmitterWithErrorHandling i } else { containerPackageName = codeDetails?.package; } + return { name: containerPackageName }; + } + + public async getAbsoluteUrl(relativeUrl: string): Promise { + if (this.resolvedUrl === undefined) { + return undefined; + } return this.urlResolver.getAbsoluteUrl( this.resolvedUrl, relativeUrl, - { name: containerPackageName }); + this.getPackageName(this._context?.codeDetails)); } public async proposeCodeDetails(codeDetails: IFluidCodeDetails) { From 6019f7e9f6947a034c9bf6e90598e696584d5897 Mon Sep 17 00:00:00 2001 From: sdeshpande3 Date: Tue, 29 Mar 2022 16:26:18 -0700 Subject: [PATCH 10/13] few more nits --- .../odsp-driver/src/odspDriverUrlResolver.ts | 2 +- .../src/odspDriverUrlResolverForShareLink.ts | 1 + .../src/test/odspDriverResolverTest.spec.ts | 28 +++++++++++++++++++ .../loader/container-loader/src/container.ts | 2 +- 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/packages/drivers/odsp-driver/src/odspDriverUrlResolver.ts b/packages/drivers/odsp-driver/src/odspDriverUrlResolver.ts index e85cfd7f6e9b..5cb8aced72c6 100644 --- a/packages/drivers/odsp-driver/src/odspDriverUrlResolver.ts +++ b/packages/drivers/odsp-driver/src/odspDriverUrlResolver.ts @@ -167,10 +167,10 @@ export class OdspDriverUrlResolver implements IUrlResolver { typeof pkg === "object" && typeof pkg?.name === "string" && typeof pkg?.fluid === "object"; - // back-compat: IFluidCodeDetails usage to be removed in 0.58.0 let containerPackageName; if (packageInfoSource && "name" in packageInfoSource) { containerPackageName = packageInfoSource.name; + // packageInfoSource is cast to any as it is typed to IContainerPackageInfo instead of IFluidCodeDetails } else if (isFluidPackage((packageInfoSource as any)?.package)) { containerPackageName = (packageInfoSource as any)?.package.name; } else { diff --git a/packages/drivers/odsp-driver/src/odspDriverUrlResolverForShareLink.ts b/packages/drivers/odsp-driver/src/odspDriverUrlResolverForShareLink.ts index 53776c9bd118..b63a2a539c14 100644 --- a/packages/drivers/odsp-driver/src/odspDriverUrlResolverForShareLink.ts +++ b/packages/drivers/odsp-driver/src/odspDriverUrlResolverForShareLink.ts @@ -203,6 +203,7 @@ export class OdspDriverUrlResolverForShareLink implements IUrlResolver { let containerPackageName; if (packageInfoSource && "name" in packageInfoSource) { containerPackageName = packageInfoSource.name; + // packageInfoSource is cast to any as it is typed to IContainerPackageInfo instead of IFluidCodeDetails } else if (isFluidPackage((packageInfoSource as any)?.package)) { containerPackageName = (packageInfoSource as any)?.package.name; } else { diff --git a/packages/drivers/odsp-driver/src/test/odspDriverResolverTest.spec.ts b/packages/drivers/odsp-driver/src/test/odspDriverResolverTest.spec.ts index 8b0785e449fc..d49eb645e4e0 100644 --- a/packages/drivers/odsp-driver/src/test/odspDriverResolverTest.spec.ts +++ b/packages/drivers/odsp-driver/src/test/odspDriverResolverTest.spec.ts @@ -102,6 +102,20 @@ describe("Odsp Driver Resolver", () => { assert.strictEqual(resolvedUrl.shareLinkInfo.createLink.type, createLinkType); }); + it("Should resolve url with a string in the codeDetails package", async () => { + const resolvedUrl = await resolver.resolve(request); + const codeDetails = { name: packageName }; + const response = await resolver.getAbsoluteUrl(resolvedUrl, "/datastore", codeDetails); + + const [url, queryString] = response?.split("?") ?? []; + const searchParams = new URLSearchParams(queryString); + assert.strictEqual(searchParams.get("itemId"), resolvedUrl.itemId, "Item id should match"); + assert.strictEqual(searchParams.get("driveId"), driveId, "Drive Id should match"); + assert.strictEqual(searchParams.get("path"), "datastore", "Path should match"); + assert.strictEqual(searchParams.get("containerPackageName"), packageName, "ContainerPackageName should match"); + assert.strictEqual(url, `${siteUrl}`, "Url should match"); + }); + it("Should resolve url given container package info", async () => { const resolvedUrl = await resolver.resolve(request); const response = await resolver.getAbsoluteUrl(resolvedUrl, "/datastore", {name: packageName}); @@ -115,6 +129,20 @@ describe("Odsp Driver Resolver", () => { assert.strictEqual(url, `${siteUrl}`, "Url should match"); }); + it("Should resolve url with a IFluidPackage in the codeDetails package", async () => { + const resolvedUrl = await resolver.resolve(request); + const codeDetails = { name: packageName }; + const response = await resolver.getAbsoluteUrl(resolvedUrl, "/datastore", codeDetails); + + const [url, queryString] = response?.split("?") ?? []; + const searchParams = new URLSearchParams(queryString); + assert.strictEqual(searchParams.get("itemId"), resolvedUrl.itemId, "Item id should match"); + assert.strictEqual(searchParams.get("driveId"), driveId, "Drive Id should match"); + assert.strictEqual(searchParams.get("path"), "datastore", "Path should match"); + assert.strictEqual(searchParams.get("containerPackageName"), packageName, "ContainerPackageName should match"); + assert.strictEqual(url, `${siteUrl}`, "Url should match"); + }); + it("Should resolve url with a codeHint in the resolved url", async () => { const newRequest = request; newRequest.url += `&containerPackageName=${encodeURIComponent(packageName)}`; diff --git a/packages/loader/container-loader/src/container.ts b/packages/loader/container-loader/src/container.ts index ec95530e0870..fa14d22d4650 100644 --- a/packages/loader/container-loader/src/container.ts +++ b/packages/loader/container-loader/src/container.ts @@ -980,7 +980,7 @@ export class Container extends EventEmitterWithErrorHandling i this.emit("warning", warning); } - public getPackageName(codeDetails: IFluidCodeDetails | undefined): IContainerPackageInfo { + private getPackageName(codeDetails: IFluidCodeDetails | undefined): IContainerPackageInfo { let containerPackageName; if (codeDetails && "name" in codeDetails) { containerPackageName = codeDetails; From 29091aa9f511c30b5cd900dca3cc1f36fe5f6462 Mon Sep 17 00:00:00 2001 From: sdeshpande3 Date: Wed, 30 Mar 2022 09:43:15 -0700 Subject: [PATCH 11/13] move getPackageName to contracts.ts#container-loader --- api-report/container-loader.api.md | 3 --- .../loader/container-loader/src/container.ts | 18 ++--------------- .../loader/container-loader/src/contracts.ts | 20 +++++++++++++++++++ 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/api-report/container-loader.api.md b/api-report/container-loader.api.md index d16f84be98e3..f46f1e7e73f7 100644 --- a/api-report/container-loader.api.md +++ b/api-report/container-loader.api.md @@ -16,7 +16,6 @@ import { IConfigProviderBase } from '@fluidframework/telemetry-utils'; import { IContainer } from '@fluidframework/container-definitions'; import { IContainerEvents } from '@fluidframework/container-definitions'; import { IContainerLoadMode } from '@fluidframework/container-definitions'; -import { IContainerPackageInfo } from '@fluidframework/driver-definitions'; import { ICriticalContainerError } from '@fluidframework/container-definitions'; import { IDeltaManager } from '@fluidframework/container-definitions'; import { IDocumentMessage } from '@fluidframework/protocol-definitions'; @@ -78,8 +77,6 @@ export class Container extends EventEmitterWithErrorHandling i // (undocumented) getAbsoluteUrl(relativeUrl: string): Promise; getLoadedCodeDetails(): IFluidCodeDetails | undefined; - // (undocumented) - getPackageName(codeDetails: IFluidCodeDetails | undefined): IContainerPackageInfo; getQuorum(): IQuorumClients; getSpecifiedCodeDetails(): IFluidCodeDetails | undefined; // (undocumented) diff --git a/packages/loader/container-loader/src/container.ts b/packages/loader/container-loader/src/container.ts index fa14d22d4650..dba8fd77da1b 100644 --- a/packages/loader/container-loader/src/container.ts +++ b/packages/loader/container-loader/src/container.ts @@ -30,7 +30,6 @@ import { IContainerLoadMode, IFluidCodeDetails, isFluidCodeDetails, - isFluidPackage, } from "@fluidframework/container-definitions"; import { DataCorruptionError, @@ -39,7 +38,6 @@ import { UsageError, } from "@fluidframework/container-utils"; import { - IContainerPackageInfo, IDocumentService, IDocumentStorageService, IFluidResolvedUrl, @@ -94,7 +92,7 @@ import { } from "@fluidframework/telemetry-utils"; import { Audience } from "./audience"; import { ContainerContext } from "./containerContext"; -import { ReconnectMode, IConnectionManagerFactoryArgs } from "./contracts"; +import { ReconnectMode, IConnectionManagerFactoryArgs, getPackageName } from "./contracts"; import { DeltaManager, IConnectionArgs } from "./deltaManager"; import { DeltaManagerProxy } from "./deltaManagerProxy"; import { ILoaderOptions, Loader, RelativeLoader } from "./loader"; @@ -980,18 +978,6 @@ export class Container extends EventEmitterWithErrorHandling i this.emit("warning", warning); } - private getPackageName(codeDetails: IFluidCodeDetails | undefined): IContainerPackageInfo { - let containerPackageName; - if (codeDetails && "name" in codeDetails) { - containerPackageName = codeDetails; - } else if (isFluidPackage(codeDetails?.package)) { - containerPackageName = codeDetails?.package.name; - } else { - containerPackageName = codeDetails?.package; - } - return { name: containerPackageName }; - } - public async getAbsoluteUrl(relativeUrl: string): Promise { if (this.resolvedUrl === undefined) { return undefined; @@ -1000,7 +986,7 @@ export class Container extends EventEmitterWithErrorHandling i return this.urlResolver.getAbsoluteUrl( this.resolvedUrl, relativeUrl, - this.getPackageName(this._context?.codeDetails)); + getPackageName(this._context?.codeDetails)); } public async proposeCodeDetails(codeDetails: IFluidCodeDetails) { diff --git a/packages/loader/container-loader/src/contracts.ts b/packages/loader/container-loader/src/contracts.ts index 80a4506b5903..a6f2378bfd25 100644 --- a/packages/loader/container-loader/src/contracts.ts +++ b/packages/loader/container-loader/src/contracts.ts @@ -11,6 +11,8 @@ import { ReadOnlyInfo, IConnectionDetails, ICriticalContainerError, + IFluidCodeDetails, + isFluidPackage, } from "@fluidframework/container-definitions"; import { ConnectionMode, @@ -20,6 +22,7 @@ import { IClientDetails, ISignalMessage, } from "@fluidframework/protocol-definitions"; +import { IContainerPackageInfo } from "@fluidframework/driver-definitions"; export enum ReconnectMode { Never = "Never", @@ -155,3 +158,20 @@ export interface IConnectionManagerFactoryArgs { */ readonly readonlyChangeHandler: (readonly?: boolean) => void, } + +/** + * + * @param codeDetails- Data structure used to describe the code to load on the Fluid document + * @returns The name of the Fluid package + */ +export const getPackageName = (codeDetails: IFluidCodeDetails | undefined): IContainerPackageInfo => { + let containerPackageName; + if (codeDetails && "name" in codeDetails) { + containerPackageName = codeDetails; + } else if (isFluidPackage(codeDetails?.package)) { + containerPackageName = codeDetails?.package.name; + } else { + containerPackageName = codeDetails?.package; + } + return { name: containerPackageName }; +}; From b55a30b59b18acab5f8d3e66ba1eb437c8bec64a Mon Sep 17 00:00:00 2001 From: sdeshpande3 Date: Wed, 30 Mar 2022 14:31:54 -0700 Subject: [PATCH 12/13] restore odsp-driver test to original state --- .../src/test/odspDriverResolverTest.spec.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/drivers/odsp-driver/src/test/odspDriverResolverTest.spec.ts b/packages/drivers/odsp-driver/src/test/odspDriverResolverTest.spec.ts index d49eb645e4e0..e19cbf381603 100644 --- a/packages/drivers/odsp-driver/src/test/odspDriverResolverTest.spec.ts +++ b/packages/drivers/odsp-driver/src/test/odspDriverResolverTest.spec.ts @@ -104,8 +104,8 @@ describe("Odsp Driver Resolver", () => { it("Should resolve url with a string in the codeDetails package", async () => { const resolvedUrl = await resolver.resolve(request); - const codeDetails = { name: packageName }; - const response = await resolver.getAbsoluteUrl(resolvedUrl, "/datastore", codeDetails); + const codeDetails = { package: packageName }; + const response = await resolver.getAbsoluteUrl(resolvedUrl, "/datastore", codeDetails as any); const [url, queryString] = response?.split("?") ?? []; const searchParams = new URLSearchParams(queryString); @@ -131,8 +131,12 @@ describe("Odsp Driver Resolver", () => { it("Should resolve url with a IFluidPackage in the codeDetails package", async () => { const resolvedUrl = await resolver.resolve(request); - const codeDetails = { name: packageName }; - const response = await resolver.getAbsoluteUrl(resolvedUrl, "/datastore", codeDetails); + const fluidPackage: any = { + name: packageName, + fluid: {}, + }; + const codeDetails = { package: fluidPackage }; + const response = await resolver.getAbsoluteUrl(resolvedUrl, "/datastore", codeDetails as any); const [url, queryString] = response?.split("?") ?? []; const searchParams = new URLSearchParams(queryString); From 8bac08fef218f93c3615f508720a26adf8cc7bd0 Mon Sep 17 00:00:00 2001 From: sdeshpande3 Date: Wed, 30 Mar 2022 14:33:47 -0700 Subject: [PATCH 13/13] few nits --- .../drivers/odsp-driver/src/test/odspDriverResolverTest.spec.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/drivers/odsp-driver/src/test/odspDriverResolverTest.spec.ts b/packages/drivers/odsp-driver/src/test/odspDriverResolverTest.spec.ts index e19cbf381603..372e7bfcf18c 100644 --- a/packages/drivers/odsp-driver/src/test/odspDriverResolverTest.spec.ts +++ b/packages/drivers/odsp-driver/src/test/odspDriverResolverTest.spec.ts @@ -105,6 +105,7 @@ describe("Odsp Driver Resolver", () => { it("Should resolve url with a string in the codeDetails package", async () => { const resolvedUrl = await resolver.resolve(request); const codeDetails = { package: packageName }; + // codeDetails is cast to any for testing the IFluidCodeDetails approach const response = await resolver.getAbsoluteUrl(resolvedUrl, "/datastore", codeDetails as any); const [url, queryString] = response?.split("?") ?? []; @@ -136,6 +137,7 @@ describe("Odsp Driver Resolver", () => { fluid: {}, }; const codeDetails = { package: fluidPackage }; + // codeDetails is cast to any for testing the IFluidCodeDetails approach const response = await resolver.getAbsoluteUrl(resolvedUrl, "/datastore", codeDetails as any); const [url, queryString] = response?.split("?") ?? [];