Skip to content

Remove containerPackageInfo parameter in createOdspCreateContainerRequest #23872

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/wicked-eagles-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@fluidframework/odsp-driver": minor
---
---
"section": deprecation
---

createOdspCreateContainerRequest().containerPackageInfo is now deprecated

The parameter `containerPackageInfo` in `createOdspCreateContainerRequest()` is deprecated and will be removed in version 2.40. This will mean that the name of the containerPackage can no longer be sent through the request. Instead it can be added in the constructor of `OdspDriverUrlResolverForShareLink`.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function checkUrl(documentUrl: URL): DriverPreCheckInfo | undefined;
export function createLocalOdspDocumentServiceFactory(localSnapshot: Uint8Array | string): IDocumentServiceFactory;

// @alpha
export function createOdspCreateContainerRequest(siteUrl: string, driveId: string, filePath: string, fileName: string, createShareLinkType?: ISharingLinkKind, containerPackageInfo?: IContainerPackageInfo | undefined): IRequest;
export function createOdspCreateContainerRequest(siteUrl: string, driveId: string, filePath: string, fileName: string, createShareLinkType?: ISharingLinkKind): IRequest;

// @alpha
export function createOdspUrl(l: OdspFluidDataStoreLocator): string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@
*/

import { IRequest } from "@fluidframework/core-interfaces";
import {
DriverHeader,
type IContainerPackageInfo,
} from "@fluidframework/driver-definitions/internal";
import { DriverHeader } from "@fluidframework/driver-definitions/internal";
import { ISharingLinkKind } from "@fluidframework/odsp-driver-definitions/internal";

import { buildOdspShareLinkReqParams, getContainerPackageName } from "./odspUtils.js";
import { buildOdspShareLinkReqParams } from "./odspUtils.js";

/**
* Create the request object with url and headers for creating a new file on OneDrive Sharepoint
Expand All @@ -20,7 +17,6 @@ import { buildOdspShareLinkReqParams, getContainerPackageName } from "./odspUtil
* @param fileName - name of the new file to be created
* @param createShareLinkType - type of sharing link you would like to create for this file. ShareLinkTypes
* will be deprecated soon, so for any new implementation please provide createShareLinkType of type ShareLink
* @param containerPackageInfo - container package information which will be used to extract the container package name.
* If not given that means that the container package does not have a name.
* @legacy
* @alpha
Expand All @@ -31,13 +27,12 @@ export function createOdspCreateContainerRequest(
filePath: string,
fileName: string,
createShareLinkType?: ISharingLinkKind,
containerPackageInfo?: IContainerPackageInfo | undefined,
): IRequest {
const shareLinkRequestParams = buildOdspShareLinkReqParams(createShareLinkType);
const createNewRequest: IRequest = {
url: `${siteUrl}?driveId=${encodeURIComponent(driveId)}&path=${encodeURIComponent(
filePath,
)}${containerPackageInfo ? `&containerPackageName=${getContainerPackageName(containerPackageInfo)}` : ""}${shareLinkRequestParams ? `&${shareLinkRequestParams}` : ""}`,
)}${shareLinkRequestParams ? `&${shareLinkRequestParams}` : ""}`,
Comment on lines -40 to +35
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking behavioral change. Is there a deprecation PR planned before this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes there is, I'm working on one but I'm having trouble making the deprecation. I'm not sure how to deprecate the parameter within the function.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't deprecate the parameter, but you can deprecate calling the function with that form. Example:

interface Test {
  /** @deprecated */
  fn(a: string, b: boolean): void;
  fn(a: string): void;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created deprecation PR: #23919

headers: {
[DriverHeader.createNew]: {
fileName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,20 +457,4 @@ describe("Odsp Driver Resolver", () => {
`https://placeholder/placeholder/${resolvedUrl.hashedDocumentId}/` + `${testFilePath}`;
assert.strictEqual(resolvedUrl.url, expectedResolvedUrl, "resolved url is wrong");
});
it("Should create request with containerPackageName and resolve it", async () => {
request = createOdspCreateContainerRequest(
siteUrl,
driveId,
filePath,
fileName,
undefined,
{ name: "testContainerPackageName" }, // Container package info variable,
);
const resolvedUrl = await resolver.resolve(request);
assert.strictEqual(
resolvedUrl.codeHint?.containerPackageName,
"testContainerPackageName",
"containerPackageName should match",
);
});
});
Loading