Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
},
"dependencies": {
"@azure/msal-browser": "^2.34.0",
"@fluidframework/core-utils": "workspace:~",
"@fluidframework/odsp-client": "workspace:~",
"@fluidframework/odsp-doclib-utils": "workspace:~",
"css-loader": "^6.11.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
* Licensed under the MIT License.
*/

import { OdspClientProps, OdspConnectionConfig } from "@fluidframework/odsp-client/beta";
// eslint-disable-next-line import/no-internal-modules
import { OdspClientProps, OdspConnectionConfig } from "@fluidframework/odsp-client/internal";

import { OdspTestTokenProvider } from "./tokenProvider.js";

Expand All @@ -23,7 +24,6 @@ const connectionConfig: OdspConnectionConfig = {
tokenProvider: new OdspTestTokenProvider(props.clientId),
siteUrl: props.siteUrl,
driveId: props.driveId,
filePath: "",
};

export const clientProps: OdspClientProps = {
Expand Down
20 changes: 11 additions & 9 deletions examples/service-clients/odsp-client/shared-tree-demo/src/fluid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@
* Licensed under the MIT License.
*/

import { OdspClient, OdspContainerServices } from "@fluidframework/odsp-client/beta";
import { ContainerSchema, IFluidContainer, SharedTree } from "fluid-framework";
import {
createOdspClient,
OdspContainerServices,
OdspContainerAttachFunctor,
// eslint-disable-next-line import/no-internal-modules
} from "@fluidframework/odsp-client/internal";
import { ContainerSchema, SharedTree, IFluidContainer } from "fluid-framework";

import { clientProps } from "./clientProps.js";

const client = new OdspClient(clientProps);
const client = createOdspClient(clientProps);

/**
* This function will create a container if no item Id is passed on the hash portion of the URL.
Expand Down Expand Up @@ -37,16 +42,13 @@ export const createFluidData = async (
): Promise<{
services: OdspContainerServices;
container: IFluidContainer;
createFn: OdspContainerAttachFunctor;
}> => {
// The client will create a new detached container using the schema
// A detached container will enable the app to modify the container before attaching it to the client
const {
container,
services,
}: { container: IFluidContainer; services: OdspContainerServices } =
await client.createContainer(schema);
const { container, services, createFn } = await client.createContainer(schema);

return { services, container };
return { services, container, createFn };
};

export const containerSchema: ContainerSchema = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
* Licensed under the MIT License.
*/

import { IFluidContainer, ITree } from "fluid-framework";
// eslint-disable-next-line import/no-internal-modules
import { assert } from "@fluidframework/core-utils/internal";
// eslint-disable-next-line import/no-internal-modules
import { OdspContainerAttachFunctor } from "@fluidframework/odsp-client/internal";
import { ITree, IFluidContainer } from "fluid-framework";
import React from "react";
import ReactDOM from "react-dom";

Expand All @@ -24,9 +28,10 @@ async function start(): Promise<void> {
let itemId: string = location.hash.slice(1);
const createNew = itemId.length === 0;
let container: IFluidContainer;
let createFn: OdspContainerAttachFunctor | undefined;

if (createNew) {
({ container } = await createFluidData(containerSchema));
({ container, createFn } = await createFluidData(containerSchema));
} else {
({ container } = await loadFluidData(itemId, containerSchema));
}
Expand Down Expand Up @@ -95,7 +100,9 @@ async function start(): Promise<void> {

// If the app is in a `createNew` state - no itemId, and the container is detached, we attach the container.
// This uploads the container to the service and connects to the collaboration session.
itemId = await container.attach({ filePath: "foo/bar", fileName: "shared-tree-demo" });
assert(createFn !== undefined, "createFn is undefined");
const res = await createFn({ filePath: "foo/bar", fileName: "shared-tree-demo" });
itemId = res.itemId;

// The newly attached container is given a unique ID that can be used to access the container in another session
// eslint-disable-next-line require-atomic-updates
Expand Down
4 changes: 2 additions & 2 deletions examples/utils/bundle-size-tests/src/odspClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Licensed under the MIT License.
*/

import { OdspClient } from "@fluidframework/odsp-client/internal";
import { createOdspClient } from "@fluidframework/odsp-client/internal";

export function apisToBundle() {
new OdspClient({} as any);
createOdspClient({} as any);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// @alpha (undocumented)
export type CacheContentType = "snapshot" | "ops" | "snapshotWithLoadingGroupId";

// @alpha (undocumented)
// @alpha
export interface HostStoragePolicy {
avoidPrefetchSnapshotCache?: boolean;
cacheCreateNewSummary?: boolean;
Expand Down Expand Up @@ -58,6 +58,19 @@ export interface IFileEntry {
resolvedUrl: IResolvedUrl;
}

// @alpha
export type IOdspCreateArgs = {
siteUrl: string;
driveId: string;
isClpCompliantApp?: boolean;
} & ({
itemId: string;
} | {
filePath?: string;
fileName: string;
createShareLinkType?: ISharingLinkKind;
});

// @alpha
export interface IOdspError extends Omit<IDriverErrorBase, "errorType">, IOdspErrorAugmentations {
// (undocumented)
Expand All @@ -71,15 +84,24 @@ export interface IOdspErrorAugmentations {
serverEpoch?: string;
}

// @alpha
export interface IOdspOpenArgs {
driveId: string;
fileVersion: string | undefined;
isClpCompliantApp?: boolean;
itemId: string;
sharingLinkToRedeem?: string;
siteUrl: string;
summarizer: boolean;
}

// @alpha (undocumented)
export interface IOdspResolvedUrl extends IResolvedUrl, IOdspUrlParts {
// (undocumented)
codeHint?: {
containerPackageName?: string;
};
// (undocumented)
dataStorePath?: string;
// (undocumented)
endpoints: {
snapshotStorageUrl: string;
attachmentPOSTStorageUrl: string;
Expand All @@ -88,32 +110,25 @@ export interface IOdspResolvedUrl extends IResolvedUrl, IOdspUrlParts {
};
// (undocumented)
fileName: string;
// (undocumented)
filePath?: string;
fileVersion: string | undefined;
// (undocumented)
hashedDocumentId: string;
// (undocumented)
isClpCompliantApp?: boolean;
// (undocumented)
odspResolvedUrl: true;
shareLinkInfo?: ShareLinkInfoType;
// (undocumented)
summarizer: boolean;
// (undocumented)
tokens: {};
// (undocumented)
type: "fluid";
// (undocumented)
url: string;
}

// @alpha (undocumented)
// @alpha
export interface IOdspUrlParts {
// (undocumented)
driveId: string;
// (undocumented)
itemId: string;
// (undocumented)
siteUrl: string;
}

Expand Down Expand Up @@ -233,6 +248,7 @@ export interface OdspResourceTokenFetchOptions extends TokenFetchOptions {
// @alpha
export interface ShareLinkInfoType {
createLink?: {
createKind: ISharingLinkKind;
link?: ISharingLink;
error?: any;
shareId?: string;
Expand Down
9 changes: 8 additions & 1 deletion packages/drivers/odsp-driver-definitions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@
"typescript": "~5.4.5"
},
"typeValidation": {
"broken": {}
"broken": {
"Interface_ShareLinkInfoType": {
"forwardCompat": false
},
"Interface_IOdspResolvedUrl": {
"forwardCompat": false
}
}
}
}
1 change: 1 addition & 0 deletions packages/drivers/odsp-driver-definitions/src/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export interface ICollabSessionOptions {
}

/**
* Various policies controlling behavior of ODSP driver
* @legacy
* @alpha
*/
Expand Down
2 changes: 2 additions & 0 deletions packages/drivers/odsp-driver-definitions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export {
} from "./odspCache.js";
export {
IOdspResolvedUrl,
IOdspOpenArgs,
IOdspCreateArgs,
IOdspUrlParts,
ISharingLink,
ISharingLinkKind,
Expand Down
Loading