@fluidframework/odsp-client 2.70.0 → 2.71.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @fluid-experimental/odsp-client
2
2
 
3
+ ## 2.71.0
4
+
5
+ Dependency updates only.
6
+
3
7
  ## 2.70.0
4
8
 
5
9
  Dependency updates only.
@@ -7,6 +7,11 @@
7
7
  // @beta
8
8
  export type IOdspAudience = IServiceAudience<OdspMember>;
9
9
 
10
+ // @beta
11
+ export interface IOdspFluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema> extends IFluidContainer<TContainerSchema> {
12
+ attach(props?: ContainerAttachProps<OdspContainerAttachProps>): Promise<string>;
13
+ }
14
+
10
15
  // @beta
11
16
  export interface IOdspTokenProvider {
12
17
  fetchStorageToken(siteUrl: string, refresh: boolean): Promise<TokenResponse>;
@@ -18,12 +23,12 @@ export class OdspClient {
18
23
  constructor(properties: OdspClientProps);
19
24
  // (undocumented)
20
25
  createContainer<T extends ContainerSchema>(containerSchema: T): Promise<{
21
- container: IFluidContainer<T>;
26
+ container: IOdspFluidContainer<T>;
22
27
  services: OdspContainerServices;
23
28
  }>;
24
29
  // (undocumented)
25
30
  getContainer<T extends ContainerSchema>(id: string, containerSchema: T): Promise<{
26
- container: IFluidContainer<T>;
31
+ container: IOdspFluidContainer<T>;
27
32
  services: OdspContainerServices;
28
33
  }>;
29
34
  }
@@ -43,6 +48,12 @@ export interface OdspConnectionConfig {
43
48
  tokenProvider: IOdspTokenProvider;
44
49
  }
45
50
 
51
+ // @beta (undocumented)
52
+ export interface OdspContainerAttachProps {
53
+ fileName: string | undefined;
54
+ filePath: string | undefined;
55
+ }
56
+
46
57
  // @beta
47
58
  export interface OdspContainerServices {
48
59
  audience: IOdspAudience;
@@ -7,6 +7,11 @@
7
7
  // @beta
8
8
  export type IOdspAudience = IServiceAudience<OdspMember>;
9
9
 
10
+ // @beta
11
+ export interface IOdspFluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema> extends IFluidContainer<TContainerSchema> {
12
+ attach(props?: ContainerAttachProps<OdspContainerAttachProps>): Promise<string>;
13
+ }
14
+
10
15
  // @beta
11
16
  export interface IOdspTokenProvider {
12
17
  fetchStorageToken(siteUrl: string, refresh: boolean): Promise<TokenResponse>;
@@ -18,12 +23,12 @@ export class OdspClient {
18
23
  constructor(properties: OdspClientProps);
19
24
  // (undocumented)
20
25
  createContainer<T extends ContainerSchema>(containerSchema: T): Promise<{
21
- container: IFluidContainer<T>;
26
+ container: IOdspFluidContainer<T>;
22
27
  services: OdspContainerServices;
23
28
  }>;
24
29
  // (undocumented)
25
30
  getContainer<T extends ContainerSchema>(id: string, containerSchema: T): Promise<{
26
- container: IFluidContainer<T>;
31
+ container: IOdspFluidContainer<T>;
27
32
  services: OdspContainerServices;
28
33
  }>;
29
34
  }
@@ -43,6 +48,12 @@ export interface OdspConnectionConfig {
43
48
  tokenProvider: IOdspTokenProvider;
44
49
  }
45
50
 
51
+ // @beta (undocumented)
52
+ export interface OdspContainerAttachProps {
53
+ fileName: string | undefined;
54
+ filePath: string | undefined;
55
+ }
56
+
46
57
  // @beta
47
58
  export interface OdspContainerServices {
48
59
  audience: IOdspAudience;
package/dist/beta.d.ts CHANGED
@@ -21,10 +21,12 @@
21
21
  export {
22
22
  // #region @beta APIs
23
23
  IOdspAudience,
24
+ IOdspFluidContainer,
24
25
  IOdspTokenProvider,
25
26
  OdspClient,
26
27
  OdspClientProps,
27
28
  OdspConnectionConfig,
29
+ OdspContainerAttachProps,
28
30
  OdspContainerServices,
29
31
  OdspMember,
30
32
  TokenResponse
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@
11
11
  *
12
12
  * @packageDocumentation
13
13
  */
14
- export type { OdspConnectionConfig, OdspClientProps, OdspContainerServices, IOdspAudience, OdspMember, TokenResponse, } from "./interfaces.js";
14
+ export type { IOdspAudience, IOdspFluidContainer, OdspClientProps, OdspConnectionConfig, OdspContainerAttachProps, OdspContainerServices, OdspMember, TokenResponse, } from "./interfaces.js";
15
15
  export { OdspClient } from "./odspClient.js";
16
16
  export { type IOdspTokenProvider } from "./token.js";
17
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAEH,YAAY,EACX,oBAAoB,EACpB,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,UAAU,EACV,aAAa,GACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAEH,YAAY,EACX,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACpB,wBAAwB,EACxB,qBAAqB,EACrB,UAAU,EACV,aAAa,GACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAoBH,iDAA6C;AAApC,2GAAA,UAAU,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * The odsp-client package provides a simple and powerful way to consume collaborative Fluid data with OneDrive/SharePoint (ODSP) storage.\n *\n * @remarks\n * Please note that odsp-client is currently an experimental package.\n * We'd love for you to try it out and provide feedback but it is not yet recommended or supported for production scenarios.\n *\n * @packageDocumentation\n */\n\nexport type {\n\tOdspConnectionConfig,\n\tOdspClientProps,\n\tOdspContainerServices,\n\tIOdspAudience,\n\tOdspMember,\n\tTokenResponse,\n} from \"./interfaces.js\";\nexport { OdspClient } from \"./odspClient.js\";\nexport { type IOdspTokenProvider } from \"./token.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAsBH,iDAA6C;AAApC,2GAAA,UAAU,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * The odsp-client package provides a simple and powerful way to consume collaborative Fluid data with OneDrive/SharePoint (ODSP) storage.\n *\n * @remarks\n * Please note that odsp-client is currently an experimental package.\n * We'd love for you to try it out and provide feedback but it is not yet recommended or supported for production scenarios.\n *\n * @packageDocumentation\n */\n\nexport type {\n\tIOdspAudience,\n\tIOdspFluidContainer,\n\tOdspClientProps,\n\tOdspConnectionConfig,\n\tOdspContainerAttachProps,\n\tOdspContainerServices,\n\tOdspMember,\n\tTokenResponse,\n} from \"./interfaces.js\";\nexport { OdspClient } from \"./odspClient.js\";\nexport { type IOdspTokenProvider } from \"./token.js\";\n"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { IConfigProviderBase, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
6
- import type { IMember, IServiceAudience } from "@fluidframework/fluid-static";
6
+ import type { ContainerAttachProps, ContainerSchema, IFluidContainer, IMember, IServiceAudience } from "@fluidframework/fluid-static";
7
7
  import type { IOdspTokenProvider } from "./token.js";
8
8
  /**
9
9
  * Defines the necessary properties that will be applied to all containers
@@ -47,7 +47,6 @@ export interface OdspClientProps {
47
47
  readonly configProvider?: IConfigProviderBase;
48
48
  }
49
49
  /**
50
- * @legacy
51
50
  * @beta
52
51
  */
53
52
  export interface OdspContainerAttachProps {
@@ -60,6 +59,23 @@ export interface OdspContainerAttachProps {
60
59
  */
61
60
  fileName: string | undefined;
62
61
  }
62
+ /**
63
+ * ODSP version of the IFluidContainer interface.
64
+ * @beta
65
+ */
66
+ export interface IOdspFluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema> extends IFluidContainer<TContainerSchema> {
67
+ /**
68
+ * A newly created container starts detached from the collaborative service.
69
+ * Calling `attach()` uploads the new container to the service and connects to the collaborative service.
70
+ *
71
+ * This function is the same as the IFluidContainer.attach function, but has ODSP specific function signatures.
72
+ *
73
+ * @param props - Optional properties to pass to the attach function.
74
+ *
75
+ * @returns A promise which resolves when the attach is complete, with the string identifier of the container.
76
+ */
77
+ attach(props?: ContainerAttachProps<OdspContainerAttachProps>): Promise<string>;
78
+ }
63
79
  /**
64
80
  * OdspContainerServices is returned by the OdspClient alongside a FluidContainer. It holds the
65
81
  * functionality specifically tied to the ODSP service, and how the data stored in the
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,mBAAmB,EACnB,oBAAoB,EACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAE9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACpC;;OAEG;IACH,aAAa,EAAE,kBAAkB,CAAC;IAElC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CACjB;AACD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,oBAAoB,CAAC;IAE1C;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,oBAAoB,CAA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":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIConfigProviderBase,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport type { IMember, IServiceAudience } from \"@fluidframework/fluid-static\";\n\nimport type { IOdspTokenProvider } from \"./token.js\";\n\n/**\n * Defines the necessary properties that will be applied to all containers\n * created by an OdspClient instance. This includes callbacks for the authentication tokens\n * required for ODSP.\n * @beta\n */\nexport interface OdspConnectionConfig {\n\t/**\n\t * Instance that provides AAD endpoint tokens for Push and SharePoint\n\t */\n\ttokenProvider: IOdspTokenProvider;\n\n\t/**\n\t * Site url representing ODSP resource location. It points to the specific SharePoint site where you can store and access the containers you create.\n\t */\n\tsiteUrl: string;\n\n\t/**\n\t * SharePoint Embedded Container Id of the tenant where Fluid containers are created\n\t */\n\tdriveId: string;\n\n\t/**\n\t * Specifies the file path where Fluid files are created. If passed an empty string, the Fluid files will be created at the root level.\n\t */\n\tfilePath: string;\n}\n/**\n * @beta\n */\nexport interface OdspClientProps {\n\t/**\n\t * Configuration for establishing a connection with the ODSP Fluid Service (Push).\n\t */\n\treadonly connection: OdspConnectionConfig;\n\n\t/**\n\t * Optional. A logger instance to receive diagnostic messages.\n\t */\n\treadonly logger?: ITelemetryBaseLogger;\n\n\t/**\n\t * Base interface for providing configurations to control experimental features. If unsure, leave this undefined.\n\t */\n\treadonly configProvider?: IConfigProviderBase;\n}\n\n/**\n * @legacy\n * @beta\n */\nexport interface OdspContainerAttachProps {\n\t/**\n\t * The file path where Fluid containers are created. If undefined, the file is created at the root.\n\t */\n\tfilePath: string | undefined;\n\n\t/**\n\t * The file name of the Fluid file. If undefined, the file is named with a GUID.\n\t */\n\tfileName: string | undefined;\n}\n\n/**\n * OdspContainerServices is returned by the OdspClient alongside a FluidContainer. It holds the\n * functionality specifically tied to the ODSP service, and how the data stored in the\n * FluidContainer is persisted in the backend and consumed by users. Any functionality regarding\n * how the data is handled within the FluidContainer itself, i.e. which data objects or DDSes to\n * use, will not be included here but rather on the FluidContainer class itself.\n * @beta\n */\nexport interface OdspContainerServices {\n\t/**\n\t * Provides an object that facilitates obtaining information about users present in the Fluid session, as well as listeners for roster changes triggered by users joining or leaving the session.\n\t */\n\taudience: IOdspAudience;\n}\n\n/**\n * Since ODSP provides user names and email for all of its members, we extend the\n * {@link @fluidframework/fluid-static#IMember} interface to include this service-specific value.\n * It will be returned for all audience members connected.\n * @beta\n */\nexport interface OdspMember extends IMember {\n\t/**\n\t * The object ID (oid) for the user, unique among each individual user connecting to the session.\n\t */\n\tid: string;\n\t/**\n\t * The user's name\n\t */\n\tname: string;\n\t/**\n\t * The user's email\n\t */\n\temail: string;\n}\n\n/**\n * Audience object for ODSP containers\n * @beta\n */\nexport type IOdspAudience = IServiceAudience<OdspMember>;\n\n/**\n * Represents token response\n * @beta\n */\nexport interface TokenResponse {\n\t/**\n\t * Token value\n\t */\n\ttoken: string;\n\n\t/**\n\t * Whether or not the token was obtained from local cache.\n\t * @remarks `undefined` indicates that it could not be determined whether or not the token was obtained this way.\n\t */\n\tfromCache?: boolean;\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIConfigProviderBase,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport type {\n\tContainerAttachProps,\n\tContainerSchema,\n\tIFluidContainer,\n\tIMember,\n\tIServiceAudience,\n} from \"@fluidframework/fluid-static\";\n\nimport type { IOdspTokenProvider } from \"./token.js\";\n\n/**\n * Defines the necessary properties that will be applied to all containers\n * created by an OdspClient instance. This includes callbacks for the authentication tokens\n * required for ODSP.\n * @beta\n */\nexport interface OdspConnectionConfig {\n\t/**\n\t * Instance that provides AAD endpoint tokens for Push and SharePoint\n\t */\n\ttokenProvider: IOdspTokenProvider;\n\n\t/**\n\t * Site url representing ODSP resource location. It points to the specific SharePoint site where you can store and access the containers you create.\n\t */\n\tsiteUrl: string;\n\n\t/**\n\t * SharePoint Embedded Container Id of the tenant where Fluid containers are created\n\t */\n\tdriveId: string;\n\n\t/**\n\t * Specifies the file path where Fluid files are created. If passed an empty string, the Fluid files will be created at the root level.\n\t */\n\tfilePath: string;\n}\n/**\n * @beta\n */\nexport interface OdspClientProps {\n\t/**\n\t * Configuration for establishing a connection with the ODSP Fluid Service (Push).\n\t */\n\treadonly connection: OdspConnectionConfig;\n\n\t/**\n\t * Optional. A logger instance to receive diagnostic messages.\n\t */\n\treadonly logger?: ITelemetryBaseLogger;\n\n\t/**\n\t * Base interface for providing configurations to control experimental features. If unsure, leave this undefined.\n\t */\n\treadonly configProvider?: IConfigProviderBase;\n}\n\n/**\n * @beta\n */\nexport interface OdspContainerAttachProps {\n\t/**\n\t * The file path where Fluid containers are created. If undefined, the file is created at the root.\n\t */\n\tfilePath: string | undefined;\n\n\t/**\n\t * The file name of the Fluid file. If undefined, the file is named with a GUID.\n\t */\n\tfileName: string | undefined;\n}\n\n/**\n * ODSP version of the IFluidContainer interface.\n * @beta\n */\nexport interface IOdspFluidContainer<\n\tTContainerSchema extends ContainerSchema = ContainerSchema,\n> extends IFluidContainer<TContainerSchema> {\n\t/**\n\t * A newly created container starts detached from the collaborative service.\n\t * Calling `attach()` uploads the new container to the service and connects to the collaborative service.\n\t *\n\t * This function is the same as the IFluidContainer.attach function, but has ODSP specific function signatures.\n\t *\n\t * @param props - Optional properties to pass to the attach function.\n\t *\n\t * @returns A promise which resolves when the attach is complete, with the string identifier of the container.\n\t */\n\tattach(props?: ContainerAttachProps<OdspContainerAttachProps>): Promise<string>;\n}\n\n/**\n * OdspContainerServices is returned by the OdspClient alongside a FluidContainer. It holds the\n * functionality specifically tied to the ODSP service, and how the data stored in the\n * FluidContainer is persisted in the backend and consumed by users. Any functionality regarding\n * how the data is handled within the FluidContainer itself, i.e. which data objects or DDSes to\n * use, will not be included here but rather on the FluidContainer class itself.\n * @beta\n */\nexport interface OdspContainerServices {\n\t/**\n\t * Provides an object that facilitates obtaining information about users present in the Fluid session, as well as listeners for roster changes triggered by users joining or leaving the session.\n\t */\n\taudience: IOdspAudience;\n}\n\n/**\n * Since ODSP provides user names and email for all of its members, we extend the\n * {@link @fluidframework/fluid-static#IMember} interface to include this service-specific value.\n * It will be returned for all audience members connected.\n * @beta\n */\nexport interface OdspMember extends IMember {\n\t/**\n\t * The object ID (oid) for the user, unique among each individual user connecting to the session.\n\t */\n\tid: string;\n\t/**\n\t * The user's name\n\t */\n\tname: string;\n\t/**\n\t * The user's email\n\t */\n\temail: string;\n}\n\n/**\n * Audience object for ODSP containers\n * @beta\n */\nexport type IOdspAudience = IServiceAudience<OdspMember>;\n\n/**\n * Represents token response\n * @beta\n */\nexport interface TokenResponse {\n\t/**\n\t * Token value\n\t */\n\ttoken: string;\n\n\t/**\n\t * Whether or not the token was obtained from local cache.\n\t * @remarks `undefined` indicates that it could not be determined whether or not the token was obtained this way.\n\t */\n\tfromCache?: boolean;\n}\n"]}
@@ -2,8 +2,8 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import type { ContainerSchema, IFluidContainer } from "@fluidframework/fluid-static";
6
- import type { OdspClientProps, OdspContainerServices as IOdspContainerServices } from "./interfaces.js";
5
+ import type { ContainerSchema } from "@fluidframework/fluid-static";
6
+ import type { OdspClientProps, OdspContainerServices as IOdspContainerServices, IOdspFluidContainer } from "./interfaces.js";
7
7
  /**
8
8
  * OdspClient provides the ability to have a Fluid object backed by the ODSP service within the context of Microsoft 365 (M365) tenants.
9
9
  * @sealed
@@ -17,11 +17,11 @@ export declare class OdspClient {
17
17
  private readonly logger;
18
18
  constructor(properties: OdspClientProps);
19
19
  createContainer<T extends ContainerSchema>(containerSchema: T): Promise<{
20
- container: IFluidContainer<T>;
20
+ container: IOdspFluidContainer<T>;
21
21
  services: IOdspContainerServices;
22
22
  }>;
23
23
  getContainer<T extends ContainerSchema>(id: string, containerSchema: T): Promise<{
24
- container: IFluidContainer<T>;
24
+ container: IOdspFluidContainer<T>;
25
25
  services: IOdspContainerServices;
26
26
  }>;
27
27
  private getLoaderProps;
@@ -1 +1 @@
1
- {"version":3,"file":"odspClient.d.ts","sourceRoot":"","sources":["../src/odspClient.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAmBH,OAAO,KAAK,EAEX,eAAe,EACf,eAAe,EACf,MAAM,8BAA8B,CAAC;AAgBtC,OAAO,KAAK,EAEX,eAAe,EAGf,qBAAqB,IAAI,sBAAsB,EAC/C,MAAM,iBAAiB,CAAC;AA2CzB;;;;GAIG;AACH,qBAAa,UAAU;IACtB,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAA0B;IACjE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAwB;IACpD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAkC;IACjE,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAuB;IACxD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmC;gBAEvC,UAAU,EAAE,eAAe;IAYjC,eAAe,CAAC,CAAC,SAAS,eAAe,EACrD,eAAe,EAAE,CAAC,GAChB,OAAO,CAAC;QACV,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;QAC9B,QAAQ,EAAE,sBAAsB,CAAC;KACjC,CAAC;IAkBW,YAAY,CAAC,CAAC,SAAS,eAAe,EAClD,EAAE,EAAE,MAAM,EACV,eAAe,EAAE,CAAC,GAChB,OAAO,CAAC;QACV,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;QAC9B,QAAQ,EAAE,sBAAsB,CAAC;KACjC,CAAC;IAiBF,OAAO,CAAC,cAAc;YAiCR,oBAAoB;YAuCpB,oBAAoB;CAGlC"}
1
+ {"version":3,"file":"odspClient.d.ts","sourceRoot":"","sources":["../src/odspClient.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAmBH,OAAO,KAAK,EAAwB,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAgB1F,OAAO,KAAK,EAEX,eAAe,EAGf,qBAAqB,IAAI,sBAAsB,EAC/C,mBAAmB,EACnB,MAAM,iBAAiB,CAAC;AA2CzB;;;;GAIG;AACH,qBAAa,UAAU;IACtB,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAA0B;IACjE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAwB;IACpD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAkC;IACjE,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAuB;IACxD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmC;gBAEvC,UAAU,EAAE,eAAe;IAYjC,eAAe,CAAC,CAAC,SAAS,eAAe,EACrD,eAAe,EAAE,CAAC,GAChB,OAAO,CAAC;QACV,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC;QAClC,QAAQ,EAAE,sBAAsB,CAAC;KACjC,CAAC;IAqBW,YAAY,CAAC,CAAC,SAAS,eAAe,EAClD,EAAE,EAAE,MAAM,EACV,eAAe,EAAE,CAAC,GAChB,OAAO,CAAC;QACV,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC;QAClC,QAAQ,EAAE,sBAAsB,CAAC;KACjC,CAAC;IAiBF,OAAO,CAAC,cAAc;YAiCR,oBAAoB;YAuCpB,oBAAoB;CAGlC"}
@@ -1 +1 @@
1
- {"version":3,"file":"odspClient.js","sourceRoot":"","sources":["../src/odspClient.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iFAAoE;AAKpE,wEAImD;AAanD,oEAG+C;AAC/C,mEAM8C;AAE9C,uEAA0F;AAC1F,+BAAkC;AASlC,yEAAmE;AAGnE,KAAK,UAAU,eAAe,CAC7B,OAAsC,EACtC,aAAiC;IAEjC,MAAM,aAAa,GAAkB,MAAM,a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SAAS,IAAI,CAAC,IAAA,4BAAiB,EAAC,WAAW,CAAC,EAAE,CAAC;gBAClE,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;YACrE,CAAC;YAED;;;;eAIG;YACH,OAAO,WAAW,CAAC,MAAM,CAAC;QAC3B,CAAC,CAAC;QACF,MAAM,cAAc,GAAG,MAAM,IAAA,+BAAoB,EAAC,EAAE,SAAS,EAAE,CAAC,CAAC;QACjE,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC;QAC/B,OAAO,cAAc,CAAC;IACvB,CAAC;IAEO,KAAK,CAAC,oBAAoB,CAAC,SAAqB;QACvD,OAAO,IAAI,gDAAqB,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC;CACD;AA5ID,gCA4IC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport type {\n\tIContainer,\n\tIFluidModuleWithDetails,\n} from \"@fluidframework/container-definitions/internal\";\nimport {\n\tcreateDetachedContainer,\n\tloadExistingContainer,\n\ttype ILoaderProps,\n} from \"@fluidframework/container-loader/internal\";\nimport type {\n\tIConfigProviderBase,\n\tIRequest,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport type { IClient } from \"@fluidframework/driver-definitions\";\nimport type { IDocumentServiceFactory } from \"@fluidframework/driver-definitions/internal\";\nimport type {\n\tContainerAttachProps,\n\tContainerSchema,\n\tIFluidContainer,\n} from \"@fluidframework/fluid-static\";\nimport {\n\tcreateDOProviderContainerRuntimeFactory,\n\tcreateFluidContainer,\n} from \"@fluidframework/fluid-static/internal\";\nimport {\n\tOdspDocumentServiceFactory,\n\tOdspDriverUrlResolver,\n\tcreateOdspCreateContainerRequest,\n\tcreateOdspUrl,\n\tisOdspResolvedUrl,\n} from \"@fluidframework/odsp-driver/internal\";\nimport type { OdspResourceTokenFetchOptions } from \"@fluidframework/odsp-driver-definitions/internal\";\nimport { wrapConfigProviderWithDefaults } from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport type {\n\tTokenResponse,\n\tOdspClientProps,\n\tOdspConnectionConfig,\n\tOdspContainerAttachProps,\n\tOdspContainerServices as IOdspContainerServices,\n} from \"./interfaces.js\";\nimport { OdspContainerServices } from \"./odspContainerServices.js\";\nimport type { IOdspTokenProvider } from \"./token.js\";\n\nasync function getStorageToken(\n\toptions: OdspResourceTokenFetchOptions,\n\ttokenProvider: IOdspTokenProvider,\n): Promise<TokenResponse> {\n\tconst tokenResponse: TokenResponse = await tokenProvider.fetchStorageToken(\n\t\toptions.siteUrl,\n\t\toptions.refresh,\n\t);\n\treturn tokenResponse;\n}\n\nasync function getWebsocketToken(\n\toptions: OdspResourceTokenFetchOptions,\n\ttokenProvider: IOdspTokenProvider,\n): Promise<TokenResponse> {\n\tconst tokenResponse: TokenResponse = await tokenProvider.fetchWebsocketToken(\n\t\toptions.siteUrl,\n\t\toptions.refresh,\n\t);\n\treturn tokenResponse;\n}\n\n/**\n * Default feature gates.\n * These values will only be used if the feature gate is not already set by the supplied config provider.\n */\nconst odspClientFeatureGates = {\n\t// None yet\n};\n\n/**\n * Wrap the config provider to fall back on the appropriate defaults for ODSP Client.\n * @param baseConfigProvider - The base config provider to wrap\n * @returns A new config provider with the appropriate defaults applied underneath the given provider\n */\nfunction wrapConfigProvider(baseConfigProvider?: IConfigProviderBase): IConfigProviderBase {\n\treturn wrapConfigProviderWithDefaults(baseConfigProvider, odspClientFeatureGates);\n}\n\n/**\n * OdspClient provides the ability to have a Fluid object backed by the ODSP service within the context of Microsoft 365 (M365) tenants.\n * @sealed\n * @beta\n */\nexport class OdspClient {\n\tprivate readonly documentServiceFactory: IDocumentServiceFactory;\n\tprivate readonly urlResolver: OdspDriverUrlResolver;\n\tprivate readonly configProvider: IConfigProviderBase | undefined;\n\tprivate readonly connectionConfig: OdspConnectionConfig;\n\tprivate readonly logger: ITelemetryBaseLogger | undefined;\n\n\tpublic constructor(properties: OdspClientProps) {\n\t\tthis.connectionConfig = properties.connection;\n\t\tthis.logger = properties.logger;\n\t\tthis.documentServiceFactory = new OdspDocumentServiceFactory(\n\t\t\tasync (options) => getStorageToken(options, this.connectionConfig.tokenProvider),\n\t\t\tasync (options) => getWebsocketToken(options, this.connectionConfig.tokenProvider),\n\t\t);\n\n\t\tthis.urlResolver = new OdspDriverUrlResolver();\n\t\tthis.configProvider = wrapConfigProvider(properties.configProvider);\n\t}\n\n\tpublic async createContainer<T extends ContainerSchema>(\n\t\tcontainerSchema: T,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<T>;\n\t\tservices: IOdspContainerServices;\n\t}> {\n\t\tconst loaderProps = this.getLoaderProps(containerSchema);\n\n\t\tconst container = await createDetachedContainer({\n\t\t\t...loaderProps,\n\t\t\tcodeDetails: {\n\t\t\t\tpackage: \"no-dynamic-package\",\n\t\t\t\tconfig: {},\n\t\t\t},\n\t\t});\n\n\t\tconst fluidContainer = await this.createFluidContainer(container, this.connectionConfig);\n\n\t\tconst services = await this.getContainerServices(container);\n\n\t\treturn { container: fluidContainer as IFluidContainer<T>, services };\n\t}\n\n\tpublic async getContainer<T extends ContainerSchema>(\n\t\tid: string,\n\t\tcontainerSchema: T,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<T>;\n\t\tservices: IOdspContainerServices;\n\t}> {\n\t\tconst loaderProps = this.getLoaderProps(containerSchema);\n\t\tconst url = createOdspUrl({\n\t\t\tsiteUrl: this.connectionConfig.siteUrl,\n\t\t\tdriveId: this.connectionConfig.driveId,\n\t\t\titemId: id,\n\t\t\tdataStorePath: \"\",\n\t\t});\n\t\tconst container = await loadExistingContainer({ ...loaderProps, request: { url } });\n\n\t\tconst fluidContainer = await createFluidContainer({\n\t\t\tcontainer,\n\t\t});\n\t\tconst services = await this.getContainerServices(container);\n\t\treturn { container: fluidContainer as IFluidContainer<T>, services };\n\t}\n\n\tprivate getLoaderProps(schema: ContainerSchema): ILoaderProps {\n\t\tconst runtimeFactory = createDOProviderContainerRuntimeFactory({\n\t\t\tschema,\n\t\t\tcompatibilityMode: \"2\",\n\t\t});\n\t\tconst load = async (): Promise<IFluidModuleWithDetails> => {\n\t\t\treturn {\n\t\t\t\tmodule: { fluidExport: runtimeFactory },\n\t\t\t\tdetails: { package: \"no-dynamic-package\", config: {} },\n\t\t\t};\n\t\t};\n\n\t\tconst codeLoader = { load };\n\t\tconst client: IClient = {\n\t\t\tdetails: {\n\t\t\t\tcapabilities: { interactive: true },\n\t\t\t},\n\t\t\tpermission: [],\n\t\t\tscopes: [],\n\t\t\tuser: { id: \"\" },\n\t\t\tmode: \"write\",\n\t\t};\n\n\t\treturn {\n\t\t\turlResolver: this.urlResolver,\n\t\t\tdocumentServiceFactory: this.documentServiceFactory,\n\t\t\tcodeLoader,\n\t\t\tlogger: this.logger,\n\t\t\toptions: { client },\n\t\t\tconfigProvider: this.configProvider,\n\t\t};\n\t}\n\n\tprivate async createFluidContainer(\n\t\tcontainer: IContainer,\n\t\tconnection: OdspConnectionConfig,\n\t): Promise<IFluidContainer> {\n\t\t/**\n\t\t * See {@link FluidContainer.attach}\n\t\t */\n\t\tconst attach = async (\n\t\t\todspProps?: ContainerAttachProps<OdspContainerAttachProps>,\n\t\t): Promise<string> => {\n\t\t\tconst createNewRequest: IRequest = createOdspCreateContainerRequest(\n\t\t\t\tconnection.siteUrl,\n\t\t\t\tconnection.driveId,\n\t\t\t\todspProps?.filePath ?? \"\",\n\t\t\t\todspProps?.fileName ?? uuid(),\n\t\t\t);\n\t\t\tif (container.attachState !== AttachState.Detached) {\n\t\t\t\tthrow new Error(\"Cannot attach container. Container is not in detached state\");\n\t\t\t}\n\t\t\tawait container.attach(createNewRequest);\n\n\t\t\tconst resolvedUrl = container.resolvedUrl;\n\n\t\t\tif (resolvedUrl === undefined || !isOdspResolvedUrl(resolvedUrl)) {\n\t\t\t\tthrow new Error(\"Resolved Url not available on attached container\");\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * A unique identifier for the file within the provided SharePoint Embedded container ID. When you attach a container,\n\t\t\t * a new `itemId` is created in the user's drive, which developers can use for various operations\n\t\t\t * like updating, renaming, moving the Fluid file, changing permissions, and more. `itemId` is used to load the container.\n\t\t\t */\n\t\t\treturn resolvedUrl.itemId;\n\t\t};\n\t\tconst fluidContainer = await createFluidContainer({ container });\n\t\tfluidContainer.attach = attach;\n\t\treturn fluidContainer;\n\t}\n\n\tprivate async getContainerServices(container: IContainer): Promise<IOdspContainerServices> {\n\t\treturn new OdspContainerServices(container);\n\t}\n}\n"]}
1
+ {"version":3,"file":"odspClient.js","sourceRoot":"","sources":["../src/odspClient.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iFAAoE;AAKpE,wEAImD;AASnD,oEAG+C;AAC/C,mEAM8C;AAE9C,uEAA0F;AAC1F,+BAAkC;AAUlC,yEAAmE;AAGnE,KAAK,UAAU,eAAe,CAC7B,OAAsC,EACtC,aAAiC;IAEjC,MAAM,aAAa,GAAkB,MAAM,aAAa,CAAC,iBAAiB,CACzE,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,OAAO,CACf,CAAC;IACF,OAAO,aAAa,CAAC;AACtB,CAAC;AAED,KAAK,UAAU,iBAAiB,CAC/B,OAAsC,EACtC,aAAiC;IAEjC,MAAM,aAAa,GAAkB,MAAM,aAAa,CAAC,mBAAmB,CAC3E,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,OAAO,CACf,CAAC;IACF,OAAO,aAAa,CAAC;AACtB,CAAC;AAED;;;GAGG;AACH,MAAM,sBAAsB,GAAG;AAC9B,WAAW;CACX,CAAC;AAEF;;;;GAIG;AACH,SAAS,kBAAkB,CAAC,kBAAwC;IACnE,OAAO,IAAA,yCAA8B,EAAC,kBAAkB,EAAE,sBAAsB,CAAC,CAAC;AACnF,CAAC;AAED;;;;GAIG;AACH,MAAa,UAAU;IAOtB,YAAmB,UAA2B;QAC7C,IAAI,CAAC,gBAAg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AE,MAAM,EAAE;YACnB,cAAc,EAAE,IAAI,CAAC,cAAc;SACnC,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,oBAAoB,CACjC,SAAqB,EACrB,UAAgC;QAEhC;;WAEG;QACH,MAAM,MAAM,GAAG,KAAK,EACnB,SAA0D,EACxC,EAAE;YACpB,MAAM,gBAAgB,GAAa,IAAA,2CAAgC,EAClE,UAAU,CAAC,OAAO,EAClB,UAAU,CAAC,OAAO,EAClB,SAAS,EAAE,QAAQ,IAAI,EAAE,EACzB,SAAS,EAAE,QAAQ,IAAI,IAAA,SAAI,GAAE,CAC7B,CAAC;YACF,IAAI,SAAS,CAAC,WAAW,KAAK,mCAAW,CAAC,QAAQ,EAAE,CAAC;gBACpD,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;YAChF,CAAC;YACD,MAAM,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;YAEzC,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;YAE1C,IAAI,WAAW,KAAK,SAAS,IAAI,CAAC,IAAA,4BAAiB,EAAC,WAAW,CAAC,EAAE,CAAC;gBAClE,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;YACrE,CAAC;YAED;;;;eAIG;YACH,OAAO,WAAW,CAAC,MAAM,CAAC;QAC3B,CAAC,CAAC;QACF,MAAM,cAAc,GAAG,MAAM,IAAA,+BAAoB,EAAI,EAAE,SAAS,EAAE,CAAC,CAAC;QACpE,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC;QAC/B,OAAO,cAAc,CAAC;IACvB,CAAC;IAEO,KAAK,CAAC,oBAAoB,CAAC,SAAqB;QACvD,OAAO,IAAI,gDAAqB,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC;CACD;AA/ID,gCA+IC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport type {\n\tIContainer,\n\tIFluidModuleWithDetails,\n} from \"@fluidframework/container-definitions/internal\";\nimport {\n\tcreateDetachedContainer,\n\tloadExistingContainer,\n\ttype ILoaderProps,\n} from \"@fluidframework/container-loader/internal\";\nimport type {\n\tIConfigProviderBase,\n\tIRequest,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport type { IClient } from \"@fluidframework/driver-definitions\";\nimport type { IDocumentServiceFactory } from \"@fluidframework/driver-definitions/internal\";\nimport type { ContainerAttachProps, ContainerSchema } from \"@fluidframework/fluid-static\";\nimport {\n\tcreateDOProviderContainerRuntimeFactory,\n\tcreateFluidContainer,\n} from \"@fluidframework/fluid-static/internal\";\nimport {\n\tOdspDocumentServiceFactory,\n\tOdspDriverUrlResolver,\n\tcreateOdspCreateContainerRequest,\n\tcreateOdspUrl,\n\tisOdspResolvedUrl,\n} from \"@fluidframework/odsp-driver/internal\";\nimport type { OdspResourceTokenFetchOptions } from \"@fluidframework/odsp-driver-definitions/internal\";\nimport { wrapConfigProviderWithDefaults } from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport type {\n\tTokenResponse,\n\tOdspClientProps,\n\tOdspConnectionConfig,\n\tOdspContainerAttachProps,\n\tOdspContainerServices as IOdspContainerServices,\n\tIOdspFluidContainer,\n} from \"./interfaces.js\";\nimport { OdspContainerServices } from \"./odspContainerServices.js\";\nimport type { IOdspTokenProvider } from \"./token.js\";\n\nasync function getStorageToken(\n\toptions: OdspResourceTokenFetchOptions,\n\ttokenProvider: IOdspTokenProvider,\n): Promise<TokenResponse> {\n\tconst tokenResponse: TokenResponse = await tokenProvider.fetchStorageToken(\n\t\toptions.siteUrl,\n\t\toptions.refresh,\n\t);\n\treturn tokenResponse;\n}\n\nasync function getWebsocketToken(\n\toptions: OdspResourceTokenFetchOptions,\n\ttokenProvider: IOdspTokenProvider,\n): Promise<TokenResponse> {\n\tconst tokenResponse: TokenResponse = await tokenProvider.fetchWebsocketToken(\n\t\toptions.siteUrl,\n\t\toptions.refresh,\n\t);\n\treturn tokenResponse;\n}\n\n/**\n * Default feature gates.\n * These values will only be used if the feature gate is not already set by the supplied config provider.\n */\nconst odspClientFeatureGates = {\n\t// None yet\n};\n\n/**\n * Wrap the config provider to fall back on the appropriate defaults for ODSP Client.\n * @param baseConfigProvider - The base config provider to wrap\n * @returns A new config provider with the appropriate defaults applied underneath the given provider\n */\nfunction wrapConfigProvider(baseConfigProvider?: IConfigProviderBase): IConfigProviderBase {\n\treturn wrapConfigProviderWithDefaults(baseConfigProvider, odspClientFeatureGates);\n}\n\n/**\n * OdspClient provides the ability to have a Fluid object backed by the ODSP service within the context of Microsoft 365 (M365) tenants.\n * @sealed\n * @beta\n */\nexport class OdspClient {\n\tprivate readonly documentServiceFactory: IDocumentServiceFactory;\n\tprivate readonly urlResolver: OdspDriverUrlResolver;\n\tprivate readonly configProvider: IConfigProviderBase | undefined;\n\tprivate readonly connectionConfig: OdspConnectionConfig;\n\tprivate readonly logger: ITelemetryBaseLogger | undefined;\n\n\tpublic constructor(properties: OdspClientProps) {\n\t\tthis.connectionConfig = properties.connection;\n\t\tthis.logger = properties.logger;\n\t\tthis.documentServiceFactory = new OdspDocumentServiceFactory(\n\t\t\tasync (options) => getStorageToken(options, this.connectionConfig.tokenProvider),\n\t\t\tasync (options) => getWebsocketToken(options, this.connectionConfig.tokenProvider),\n\t\t);\n\n\t\tthis.urlResolver = new OdspDriverUrlResolver();\n\t\tthis.configProvider = wrapConfigProvider(properties.configProvider);\n\t}\n\n\tpublic async createContainer<T extends ContainerSchema>(\n\t\tcontainerSchema: T,\n\t): Promise<{\n\t\tcontainer: IOdspFluidContainer<T>;\n\t\tservices: IOdspContainerServices;\n\t}> {\n\t\tconst loaderProps = this.getLoaderProps(containerSchema);\n\n\t\tconst container = await createDetachedContainer({\n\t\t\t...loaderProps,\n\t\t\tcodeDetails: {\n\t\t\t\tpackage: \"no-dynamic-package\",\n\t\t\t\tconfig: {},\n\t\t\t},\n\t\t});\n\n\t\tconst fluidContainer = await this.createFluidContainer<T>(\n\t\t\tcontainer,\n\t\t\tthis.connectionConfig,\n\t\t);\n\n\t\tconst services = await this.getContainerServices(container);\n\n\t\treturn { container: fluidContainer, services };\n\t}\n\n\tpublic async getContainer<T extends ContainerSchema>(\n\t\tid: string,\n\t\tcontainerSchema: T,\n\t): Promise<{\n\t\tcontainer: IOdspFluidContainer<T>;\n\t\tservices: IOdspContainerServices;\n\t}> {\n\t\tconst loaderProps = this.getLoaderProps(containerSchema);\n\t\tconst url = createOdspUrl({\n\t\t\tsiteUrl: this.connectionConfig.siteUrl,\n\t\t\tdriveId: this.connectionConfig.driveId,\n\t\t\titemId: id,\n\t\t\tdataStorePath: \"\",\n\t\t});\n\t\tconst container = await loadExistingContainer({ ...loaderProps, request: { url } });\n\n\t\tconst fluidContainer = await createFluidContainer<T>({\n\t\t\tcontainer,\n\t\t});\n\t\tconst services = await this.getContainerServices(container);\n\t\treturn { container: fluidContainer, services };\n\t}\n\n\tprivate getLoaderProps(schema: ContainerSchema): ILoaderProps {\n\t\tconst runtimeFactory = createDOProviderContainerRuntimeFactory({\n\t\t\tschema,\n\t\t\tcompatibilityMode: \"2\",\n\t\t});\n\t\tconst load = async (): Promise<IFluidModuleWithDetails> => {\n\t\t\treturn {\n\t\t\t\tmodule: { fluidExport: runtimeFactory },\n\t\t\t\tdetails: { package: \"no-dynamic-package\", config: {} },\n\t\t\t};\n\t\t};\n\n\t\tconst codeLoader = { load };\n\t\tconst client: IClient = {\n\t\t\tdetails: {\n\t\t\t\tcapabilities: { interactive: true },\n\t\t\t},\n\t\t\tpermission: [],\n\t\t\tscopes: [],\n\t\t\tuser: { id: \"\" },\n\t\t\tmode: \"write\",\n\t\t};\n\n\t\treturn {\n\t\t\turlResolver: this.urlResolver,\n\t\t\tdocumentServiceFactory: this.documentServiceFactory,\n\t\t\tcodeLoader,\n\t\t\tlogger: this.logger,\n\t\t\toptions: { client },\n\t\t\tconfigProvider: this.configProvider,\n\t\t};\n\t}\n\n\tprivate async createFluidContainer<T extends ContainerSchema>(\n\t\tcontainer: IContainer,\n\t\tconnection: OdspConnectionConfig,\n\t): Promise<IOdspFluidContainer<T>> {\n\t\t/**\n\t\t * See {@link FluidContainer.attach}\n\t\t */\n\t\tconst attach = async (\n\t\t\todspProps?: ContainerAttachProps<OdspContainerAttachProps>,\n\t\t): Promise<string> => {\n\t\t\tconst createNewRequest: IRequest = createOdspCreateContainerRequest(\n\t\t\t\tconnection.siteUrl,\n\t\t\t\tconnection.driveId,\n\t\t\t\todspProps?.filePath ?? \"\",\n\t\t\t\todspProps?.fileName ?? uuid(),\n\t\t\t);\n\t\t\tif (container.attachState !== AttachState.Detached) {\n\t\t\t\tthrow new Error(\"Cannot attach container. Container is not in detached state\");\n\t\t\t}\n\t\t\tawait container.attach(createNewRequest);\n\n\t\t\tconst resolvedUrl = container.resolvedUrl;\n\n\t\t\tif (resolvedUrl === undefined || !isOdspResolvedUrl(resolvedUrl)) {\n\t\t\t\tthrow new Error(\"Resolved Url not available on attached container\");\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * A unique identifier for the file within the provided SharePoint Embedded container ID. When you attach a container,\n\t\t\t * a new `itemId` is created in the user's drive, which developers can use for various operations\n\t\t\t * like updating, renaming, moving the Fluid file, changing permissions, and more. `itemId` is used to load the container.\n\t\t\t */\n\t\t\treturn resolvedUrl.itemId;\n\t\t};\n\t\tconst fluidContainer = await createFluidContainer<T>({ container });\n\t\tfluidContainer.attach = attach;\n\t\treturn fluidContainer;\n\t}\n\n\tprivate async getContainerServices(container: IContainer): Promise<IOdspContainerServices> {\n\t\treturn new OdspContainerServices(container);\n\t}\n}\n"]}
package/lib/beta.d.ts CHANGED
@@ -21,10 +21,12 @@
21
21
  export {
22
22
  // #region @beta APIs
23
23
  IOdspAudience,
24
+ IOdspFluidContainer,
24
25
  IOdspTokenProvider,
25
26
  OdspClient,
26
27
  OdspClientProps,
27
28
  OdspConnectionConfig,
29
+ OdspContainerAttachProps,
28
30
  OdspContainerServices,
29
31
  OdspMember,
30
32
  TokenResponse
package/lib/index.d.ts CHANGED
@@ -11,7 +11,7 @@
11
11
  *
12
12
  * @packageDocumentation
13
13
  */
14
- export type { OdspConnectionConfig, OdspClientProps, OdspContainerServices, IOdspAudience, OdspMember, TokenResponse, } from "./interfaces.js";
14
+ export type { IOdspAudience, IOdspFluidContainer, OdspClientProps, OdspConnectionConfig, OdspContainerAttachProps, OdspContainerServices, OdspMember, TokenResponse, } from "./interfaces.js";
15
15
  export { OdspClient } from "./odspClient.js";
16
16
  export { type IOdspTokenProvider } from "./token.js";
17
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAEH,YAAY,EACX,oBAAoB,EACpB,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,UAAU,EACV,aAAa,GACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAEH,YAAY,EACX,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACpB,wBAAwB,EACxB,qBAAqB,EACrB,UAAU,EACV,aAAa,GACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAoBH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * The odsp-client package provides a simple and powerful way to consume collaborative Fluid data with OneDrive/SharePoint (ODSP) storage.\n *\n * @remarks\n * Please note that odsp-client is currently an experimental package.\n * We'd love for you to try it out and provide feedback but it is not yet recommended or supported for production scenarios.\n *\n * @packageDocumentation\n */\n\nexport type {\n\tOdspConnectionConfig,\n\tOdspClientProps,\n\tOdspContainerServices,\n\tIOdspAudience,\n\tOdspMember,\n\tTokenResponse,\n} from \"./interfaces.js\";\nexport { OdspClient } from \"./odspClient.js\";\nexport { type IOdspTokenProvider } from \"./token.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsBH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * The odsp-client package provides a simple and powerful way to consume collaborative Fluid data with OneDrive/SharePoint (ODSP) storage.\n *\n * @remarks\n * Please note that odsp-client is currently an experimental package.\n * We'd love for you to try it out and provide feedback but it is not yet recommended or supported for production scenarios.\n *\n * @packageDocumentation\n */\n\nexport type {\n\tIOdspAudience,\n\tIOdspFluidContainer,\n\tOdspClientProps,\n\tOdspConnectionConfig,\n\tOdspContainerAttachProps,\n\tOdspContainerServices,\n\tOdspMember,\n\tTokenResponse,\n} from \"./interfaces.js\";\nexport { OdspClient } from \"./odspClient.js\";\nexport { type IOdspTokenProvider } from \"./token.js\";\n"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { IConfigProviderBase, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
6
- import type { IMember, IServiceAudience } from "@fluidframework/fluid-static";
6
+ import type { ContainerAttachProps, ContainerSchema, IFluidContainer, IMember, IServiceAudience } from "@fluidframework/fluid-static";
7
7
  import type { IOdspTokenProvider } from "./token.js";
8
8
  /**
9
9
  * Defines the necessary properties that will be applied to all containers
@@ -47,7 +47,6 @@ export interface OdspClientProps {
47
47
  readonly configProvider?: IConfigProviderBase;
48
48
  }
49
49
  /**
50
- * @legacy
51
50
  * @beta
52
51
  */
53
52
  export interface OdspContainerAttachProps {
@@ -60,6 +59,23 @@ export interface OdspContainerAttachProps {
60
59
  */
61
60
  fileName: string | undefined;
62
61
  }
62
+ /**
63
+ * ODSP version of the IFluidContainer interface.
64
+ * @beta
65
+ */
66
+ export interface IOdspFluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema> extends IFluidContainer<TContainerSchema> {
67
+ /**
68
+ * A newly created container starts detached from the collaborative service.
69
+ * Calling `attach()` uploads the new container to the service and connects to the collaborative service.
70
+ *
71
+ * This function is the same as the IFluidContainer.attach function, but has ODSP specific function signatures.
72
+ *
73
+ * @param props - Optional properties to pass to the attach function.
74
+ *
75
+ * @returns A promise which resolves when the attach is complete, with the string identifier of the container.
76
+ */
77
+ attach(props?: ContainerAttachProps<OdspContainerAttachProps>): Promise<string>;
78
+ }
63
79
  /**
64
80
  * OdspContainerServices is returned by the OdspClient alongside a FluidContainer. It holds the
65
81
  * functionality specifically tied to the ODSP service, and how the data stored in the
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,mBAAmB,EACnB,oBAAoB,EACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAE9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACpC;;OAEG;IACH,aAAa,EAAE,kBAAkB,CAAC;IAElC;;OAEG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AACH,MAAM,MAAM,aAAa,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;AAEzD;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC7B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIConfigProviderBase,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport type { IMember, IServiceAudience } from \"@fluidframework/fluid-static\";\n\nimport type { IOdspTokenProvider } from \"./token.js\";\n\n/**\n * Defines the necessary properties that will be applied to all containers\n * created by an OdspClient instance. This includes callbacks for the authentication tokens\n * required for ODSP.\n * @beta\n */\nexport interface OdspConnectionConfig {\n\t/**\n\t * Instance that provides AAD endpoint tokens for Push and SharePoint\n\t */\n\ttokenProvider: IOdspTokenProvider;\n\n\t/**\n\t * Site url representing ODSP resource location. It points to the specific SharePoint site where you can store and access the containers you create.\n\t */\n\tsiteUrl: string;\n\n\t/**\n\t * SharePoint Embedded Container Id of the tenant where Fluid containers are created\n\t */\n\tdriveId: string;\n\n\t/**\n\t * Specifies the file path where Fluid files are created. If passed an empty string, the Fluid files will be created at the root level.\n\t */\n\tfilePath: string;\n}\n/**\n * @beta\n */\nexport interface OdspClientProps {\n\t/**\n\t * Configuration for establishing a connection with the ODSP Fluid Service (Push).\n\t */\n\treadonly connection: OdspConnectionConfig;\n\n\t/**\n\t * Optional. A logger instance to receive diagnostic messages.\n\t */\n\treadonly logger?: ITelemetryBaseLogger;\n\n\t/**\n\t * Base interface for providing configurations to control experimental features. If unsure, leave this undefined.\n\t */\n\treadonly configProvider?: IConfigProviderBase;\n}\n\n/**\n * @legacy\n * @beta\n */\nexport interface OdspContainerAttachProps {\n\t/**\n\t * The file path where Fluid containers are created. If undefined, the file is created at the root.\n\t */\n\tfilePath: string | undefined;\n\n\t/**\n\t * The file name of the Fluid file. If undefined, the file is named with a GUID.\n\t */\n\tfileName: string | undefined;\n}\n\n/**\n * OdspContainerServices is returned by the OdspClient alongside a FluidContainer. It holds the\n * functionality specifically tied to the ODSP service, and how the data stored in the\n * FluidContainer is persisted in the backend and consumed by users. Any functionality regarding\n * how the data is handled within the FluidContainer itself, i.e. which data objects or DDSes to\n * use, will not be included here but rather on the FluidContainer class itself.\n * @beta\n */\nexport interface OdspContainerServices {\n\t/**\n\t * Provides an object that facilitates obtaining information about users present in the Fluid session, as well as listeners for roster changes triggered by users joining or leaving the session.\n\t */\n\taudience: IOdspAudience;\n}\n\n/**\n * Since ODSP provides user names and email for all of its members, we extend the\n * {@link @fluidframework/fluid-static#IMember} interface to include this service-specific value.\n * It will be returned for all audience members connected.\n * @beta\n */\nexport interface OdspMember extends IMember {\n\t/**\n\t * The object ID (oid) for the user, unique among each individual user connecting to the session.\n\t */\n\tid: string;\n\t/**\n\t * The user's name\n\t */\n\tname: string;\n\t/**\n\t * The user's email\n\t */\n\temail: string;\n}\n\n/**\n * Audience object for ODSP containers\n * @beta\n */\nexport type IOdspAudience = IServiceAudience<OdspMember>;\n\n/**\n * Represents token response\n * @beta\n */\nexport interface TokenResponse {\n\t/**\n\t * Token value\n\t */\n\ttoken: string;\n\n\t/**\n\t * Whether or not the token was obtained from local cache.\n\t * @remarks `undefined` indicates that it could not be determined whether or not the token was obtained this way.\n\t */\n\tfromCache?: boolean;\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIConfigProviderBase,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport type {\n\tContainerAttachProps,\n\tContainerSchema,\n\tIFluidContainer,\n\tIMember,\n\tIServiceAudience,\n} from \"@fluidframework/fluid-static\";\n\nimport type { IOdspTokenProvider } from \"./token.js\";\n\n/**\n * Defines the necessary properties that will be applied to all containers\n * created by an OdspClient instance. This includes callbacks for the authentication tokens\n * required for ODSP.\n * @beta\n */\nexport interface OdspConnectionConfig {\n\t/**\n\t * Instance that provides AAD endpoint tokens for Push and SharePoint\n\t */\n\ttokenProvider: IOdspTokenProvider;\n\n\t/**\n\t * Site url representing ODSP resource location. It points to the specific SharePoint site where you can store and access the containers you create.\n\t */\n\tsiteUrl: string;\n\n\t/**\n\t * SharePoint Embedded Container Id of the tenant where Fluid containers are created\n\t */\n\tdriveId: string;\n\n\t/**\n\t * Specifies the file path where Fluid files are created. If passed an empty string, the Fluid files will be created at the root level.\n\t */\n\tfilePath: string;\n}\n/**\n * @beta\n */\nexport interface OdspClientProps {\n\t/**\n\t * Configuration for establishing a connection with the ODSP Fluid Service (Push).\n\t */\n\treadonly connection: OdspConnectionConfig;\n\n\t/**\n\t * Optional. A logger instance to receive diagnostic messages.\n\t */\n\treadonly logger?: ITelemetryBaseLogger;\n\n\t/**\n\t * Base interface for providing configurations to control experimental features. If unsure, leave this undefined.\n\t */\n\treadonly configProvider?: IConfigProviderBase;\n}\n\n/**\n * @beta\n */\nexport interface OdspContainerAttachProps {\n\t/**\n\t * The file path where Fluid containers are created. If undefined, the file is created at the root.\n\t */\n\tfilePath: string | undefined;\n\n\t/**\n\t * The file name of the Fluid file. If undefined, the file is named with a GUID.\n\t */\n\tfileName: string | undefined;\n}\n\n/**\n * ODSP version of the IFluidContainer interface.\n * @beta\n */\nexport interface IOdspFluidContainer<\n\tTContainerSchema extends ContainerSchema = ContainerSchema,\n> extends IFluidContainer<TContainerSchema> {\n\t/**\n\t * A newly created container starts detached from the collaborative service.\n\t * Calling `attach()` uploads the new container to the service and connects to the collaborative service.\n\t *\n\t * This function is the same as the IFluidContainer.attach function, but has ODSP specific function signatures.\n\t *\n\t * @param props - Optional properties to pass to the attach function.\n\t *\n\t * @returns A promise which resolves when the attach is complete, with the string identifier of the container.\n\t */\n\tattach(props?: ContainerAttachProps<OdspContainerAttachProps>): Promise<string>;\n}\n\n/**\n * OdspContainerServices is returned by the OdspClient alongside a FluidContainer. It holds the\n * functionality specifically tied to the ODSP service, and how the data stored in the\n * FluidContainer is persisted in the backend and consumed by users. Any functionality regarding\n * how the data is handled within the FluidContainer itself, i.e. which data objects or DDSes to\n * use, will not be included here but rather on the FluidContainer class itself.\n * @beta\n */\nexport interface OdspContainerServices {\n\t/**\n\t * Provides an object that facilitates obtaining information about users present in the Fluid session, as well as listeners for roster changes triggered by users joining or leaving the session.\n\t */\n\taudience: IOdspAudience;\n}\n\n/**\n * Since ODSP provides user names and email for all of its members, we extend the\n * {@link @fluidframework/fluid-static#IMember} interface to include this service-specific value.\n * It will be returned for all audience members connected.\n * @beta\n */\nexport interface OdspMember extends IMember {\n\t/**\n\t * The object ID (oid) for the user, unique among each individual user connecting to the session.\n\t */\n\tid: string;\n\t/**\n\t * The user's name\n\t */\n\tname: string;\n\t/**\n\t * The user's email\n\t */\n\temail: string;\n}\n\n/**\n * Audience object for ODSP containers\n * @beta\n */\nexport type IOdspAudience = IServiceAudience<OdspMember>;\n\n/**\n * Represents token response\n * @beta\n */\nexport interface TokenResponse {\n\t/**\n\t * Token value\n\t */\n\ttoken: string;\n\n\t/**\n\t * Whether or not the token was obtained from local cache.\n\t * @remarks `undefined` indicates that it could not be determined whether or not the token was obtained this way.\n\t */\n\tfromCache?: boolean;\n}\n"]}
@@ -2,8 +2,8 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import type { ContainerSchema, IFluidContainer } from "@fluidframework/fluid-static";
6
- import type { OdspClientProps, OdspContainerServices as IOdspContainerServices } from "./interfaces.js";
5
+ import type { ContainerSchema } from "@fluidframework/fluid-static";
6
+ import type { OdspClientProps, OdspContainerServices as IOdspContainerServices, IOdspFluidContainer } from "./interfaces.js";
7
7
  /**
8
8
  * OdspClient provides the ability to have a Fluid object backed by the ODSP service within the context of Microsoft 365 (M365) tenants.
9
9
  * @sealed
@@ -17,11 +17,11 @@ export declare class OdspClient {
17
17
  private readonly logger;
18
18
  constructor(properties: OdspClientProps);
19
19
  createContainer<T extends ContainerSchema>(containerSchema: T): Promise<{
20
- container: IFluidContainer<T>;
20
+ container: IOdspFluidContainer<T>;
21
21
  services: IOdspContainerServices;
22
22
  }>;
23
23
  getContainer<T extends ContainerSchema>(id: string, containerSchema: T): Promise<{
24
- container: IFluidContainer<T>;
24
+ container: IOdspFluidContainer<T>;
25
25
  services: IOdspContainerServices;
26
26
  }>;
27
27
  private getLoaderProps;
@@ -1 +1 @@
1
- {"version":3,"file":"odspClient.d.ts","sourceRoot":"","sources":["../src/odspClient.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAmBH,OAAO,KAAK,EAEX,eAAe,EACf,eAAe,EACf,MAAM,8BAA8B,CAAC;AAgBtC,OAAO,KAAK,EAEX,eAAe,EAGf,qBAAqB,IAAI,sBAAsB,EAC/C,MAAM,iBAAiB,CAAC;AA2CzB;;;;GAIG;AACH,qBAAa,UAAU;IACtB,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAA0B;IACjE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAwB;IACpD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAkC;IACjE,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAuB;IACxD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmC;gBAEvC,UAAU,EAAE,eAAe;IAYjC,eAAe,CAAC,CAAC,SAAS,eAAe,EACrD,eAAe,EAAE,CAAC,GAChB,OAAO,CAAC;QACV,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;QAC9B,QAAQ,EAAE,sBAAsB,CAAC;KACjC,CAAC;IAkBW,YAAY,CAAC,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C,cAAc;SACnC,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,oBAAoB,CACjC,SAAqB,EACrB,UAAgC;QAEhC;;WAEG;QACH,MAAM,MAAM,GAAG,KAAK,EACnB,SAA0D,EACxC,EAAE;YACpB,MAAM,gBAAgB,GAAa,gCAAgC,CAClE,UAAU,CAAC,OAAO,EAClB,UAAU,CAAC,OAAO,EAClB,SAAS,EAAE,QAAQ,IAAI,EAAE,EACzB,SAAS,EAAE,QAAQ,IAAI,IAAI,EAAE,CAC7B,CAAC;YACF,IAAI,SAAS,CAAC,WAAW,KAAK,WAAW,CAAC,QAAQ,EAAE,CAAC;gBACpD,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;YAChF,CAAC;YACD,MAAM,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;YAEzC,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;YAE1C,IAAI,WAAW,KAAK,SAAS,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE,CAAC;gBAClE,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;YACrE,CAAC;YAED;;;;eAIG;YACH,OAAO,WAAW,CAAC,MAAM,CAAC;QAC3B,CAAC,CAAC;QACF,MAAM,cAAc,GAAG,MAAM,oBAAoB,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;QACjE,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC;QAC/B,OAAO,cAAc,CAAC;IACvB,CAAC;IAEO,KAAK,CAAC,oBAAoB,CAAC,SAAqB;QACvD,OAAO,IAAI,qBAAqB,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport type {\n\tIContainer,\n\tIFluidModuleWithDetails,\n} from \"@fluidframework/container-definitions/internal\";\nimport {\n\tcreateDetachedContainer,\n\tloadExistingContainer,\n\ttype ILoaderProps,\n} from \"@fluidframework/container-loader/internal\";\nimport type {\n\tIConfigProviderBase,\n\tIRequest,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport type { IClient } from \"@fluidframework/driver-definitions\";\nimport type { IDocumentServiceFactory } from \"@fluidframework/driver-definitions/internal\";\nimport type {\n\tContainerAttachProps,\n\tContainerSchema,\n\tIFluidContainer,\n} from \"@fluidframework/fluid-static\";\nimport {\n\tcreateDOProviderContainerRuntimeFactory,\n\tcreateFluidContainer,\n} from \"@fluidframework/fluid-static/internal\";\nimport {\n\tOdspDocumentServiceFactory,\n\tOdspDriverUrlResolver,\n\tcreateOdspCreateContainerRequest,\n\tcreateOdspUrl,\n\tisOdspResolvedUrl,\n} from \"@fluidframework/odsp-driver/internal\";\nimport type { OdspResourceTokenFetchOptions } from \"@fluidframework/odsp-driver-definitions/internal\";\nimport { wrapConfigProviderWithDefaults } from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport type {\n\tTokenResponse,\n\tOdspClientProps,\n\tOdspConnectionConfig,\n\tOdspContainerAttachProps,\n\tOdspContainerServices as IOdspContainerServices,\n} from \"./interfaces.js\";\nimport { OdspContainerServices } from \"./odspContainerServices.js\";\nimport type { IOdspTokenProvider } from \"./token.js\";\n\nasync function getStorageToken(\n\toptions: OdspResourceTokenFetchOptions,\n\ttokenProvider: IOdspTokenProvider,\n): Promise<TokenResponse> {\n\tconst tokenResponse: TokenResponse = await tokenProvider.fetchStorageToken(\n\t\toptions.siteUrl,\n\t\toptions.refresh,\n\t);\n\treturn tokenResponse;\n}\n\nasync function getWebsocketToken(\n\toptions: OdspResourceTokenFetchOptions,\n\ttokenProvider: IOdspTokenProvider,\n): Promise<TokenResponse> {\n\tconst tokenResponse: TokenResponse = await tokenProvider.fetchWebsocketToken(\n\t\toptions.siteUrl,\n\t\toptions.refresh,\n\t);\n\treturn tokenResponse;\n}\n\n/**\n * Default feature gates.\n * These values will only be used if the feature gate is not already set by the supplied config provider.\n */\nconst odspClientFeatureGates = {\n\t// None yet\n};\n\n/**\n * Wrap the config provider to fall back on the appropriate defaults for ODSP Client.\n * @param baseConfigProvider - The base config provider to wrap\n * @returns A new config provider with the appropriate defaults applied underneath the given provider\n */\nfunction wrapConfigProvider(baseConfigProvider?: IConfigProviderBase): IConfigProviderBase {\n\treturn wrapConfigProviderWithDefaults(baseConfigProvider, odspClientFeatureGates);\n}\n\n/**\n * OdspClient provides the ability to have a Fluid object backed by the ODSP service within the context of Microsoft 365 (M365) tenants.\n * @sealed\n * @beta\n */\nexport class OdspClient {\n\tprivate readonly documentServiceFactory: IDocumentServiceFactory;\n\tprivate readonly urlResolver: OdspDriverUrlResolver;\n\tprivate readonly configProvider: IConfigProviderBase | undefined;\n\tprivate readonly connectionConfig: OdspConnectionConfig;\n\tprivate readonly logger: ITelemetryBaseLogger | undefined;\n\n\tpublic constructor(properties: OdspClientProps) {\n\t\tthis.connectionConfig = properties.connection;\n\t\tthis.logger = properties.logger;\n\t\tthis.documentServiceFactory = new OdspDocumentServiceFactory(\n\t\t\tasync (options) => getStorageToken(options, this.connectionConfig.tokenProvider),\n\t\t\tasync (options) => getWebsocketToken(options, this.connectionConfig.tokenProvider),\n\t\t);\n\n\t\tthis.urlResolver = new OdspDriverUrlResolver();\n\t\tthis.configProvider = wrapConfigProvider(properties.configProvider);\n\t}\n\n\tpublic async createContainer<T extends ContainerSchema>(\n\t\tcontainerSchema: T,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<T>;\n\t\tservices: IOdspContainerServices;\n\t}> {\n\t\tconst loaderProps = this.getLoaderProps(containerSchema);\n\n\t\tconst container = await createDetachedContainer({\n\t\t\t...loaderProps,\n\t\t\tcodeDetails: {\n\t\t\t\tpackage: \"no-dynamic-package\",\n\t\t\t\tconfig: {},\n\t\t\t},\n\t\t});\n\n\t\tconst fluidContainer = await this.createFluidContainer(container, this.connectionConfig);\n\n\t\tconst services = await this.getContainerServices(container);\n\n\t\treturn { container: fluidContainer as IFluidContainer<T>, services };\n\t}\n\n\tpublic async getContainer<T extends ContainerSchema>(\n\t\tid: string,\n\t\tcontainerSchema: T,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<T>;\n\t\tservices: IOdspContainerServices;\n\t}> {\n\t\tconst loaderProps = this.getLoaderProps(containerSchema);\n\t\tconst url = createOdspUrl({\n\t\t\tsiteUrl: this.connectionConfig.siteUrl,\n\t\t\tdriveId: this.connectionConfig.driveId,\n\t\t\titemId: id,\n\t\t\tdataStorePath: \"\",\n\t\t});\n\t\tconst container = await loadExistingContainer({ ...loaderProps, request: { url } });\n\n\t\tconst fluidContainer = await createFluidContainer({\n\t\t\tcontainer,\n\t\t});\n\t\tconst services = await this.getContainerServices(container);\n\t\treturn { container: fluidContainer as IFluidContainer<T>, services };\n\t}\n\n\tprivate getLoaderProps(schema: ContainerSchema): ILoaderProps {\n\t\tconst runtimeFactory = createDOProviderContainerRuntimeFactory({\n\t\t\tschema,\n\t\t\tcompatibilityMode: \"2\",\n\t\t});\n\t\tconst load = async (): Promise<IFluidModuleWithDetails> => {\n\t\t\treturn {\n\t\t\t\tmodule: { fluidExport: runtimeFactory },\n\t\t\t\tdetails: { package: \"no-dynamic-package\", config: {} },\n\t\t\t};\n\t\t};\n\n\t\tconst codeLoader = { load };\n\t\tconst client: IClient = {\n\t\t\tdetails: {\n\t\t\t\tcapabilities: { interactive: true },\n\t\t\t},\n\t\t\tpermission: [],\n\t\t\tscopes: [],\n\t\t\tuser: { id: \"\" },\n\t\t\tmode: \"write\",\n\t\t};\n\n\t\treturn {\n\t\t\turlResolver: this.urlResolver,\n\t\t\tdocumentServiceFactory: this.documentServiceFactory,\n\t\t\tcodeLoader,\n\t\t\tlogger: this.logger,\n\t\t\toptions: { client },\n\t\t\tconfigProvider: this.configProvider,\n\t\t};\n\t}\n\n\tprivate async createFluidContainer(\n\t\tcontainer: IContainer,\n\t\tconnection: OdspConnectionConfig,\n\t): Promise<IFluidContainer> {\n\t\t/**\n\t\t * See {@link FluidContainer.attach}\n\t\t */\n\t\tconst attach = async (\n\t\t\todspProps?: ContainerAttachProps<OdspContainerAttachProps>,\n\t\t): Promise<string> => {\n\t\t\tconst createNewRequest: IRequest = createOdspCreateContainerRequest(\n\t\t\t\tconnection.siteUrl,\n\t\t\t\tconnection.driveId,\n\t\t\t\todspProps?.filePath ?? \"\",\n\t\t\t\todspProps?.fileName ?? uuid(),\n\t\t\t);\n\t\t\tif (container.attachState !== AttachState.Detached) {\n\t\t\t\tthrow new Error(\"Cannot attach container. Container is not in detached state\");\n\t\t\t}\n\t\t\tawait container.attach(createNewRequest);\n\n\t\t\tconst resolvedUrl = container.resolvedUrl;\n\n\t\t\tif (resolvedUrl === undefined || !isOdspResolvedUrl(resolvedUrl)) {\n\t\t\t\tthrow new Error(\"Resolved Url not available on attached container\");\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * A unique identifier for the file within the provided SharePoint Embedded container ID. When you attach a container,\n\t\t\t * a new `itemId` is created in the user's drive, which developers can use for various operations\n\t\t\t * like updating, renaming, moving the Fluid file, changing permissions, and more. `itemId` is used to load the container.\n\t\t\t */\n\t\t\treturn resolvedUrl.itemId;\n\t\t};\n\t\tconst fluidContainer = await createFluidContainer({ container });\n\t\tfluidContainer.attach = attach;\n\t\treturn fluidContainer;\n\t}\n\n\tprivate async getContainerServices(container: IContainer): Promise<IOdspContainerServices> {\n\t\treturn new OdspContainerServices(container);\n\t}\n}\n"]}
1
+ {"version":3,"file":"odspClient.js","sourceRoot":"","sources":["../src/odspClient.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAKpE,OAAO,EACN,uBAAuB,EACvB,qBAAqB,GAErB,MAAM,2CAA2C,CAAC;AASnD,OAAO,EACN,uCAAuC,EACvC,oBAAoB,GACpB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,0BAA0B,EAC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IAAI,EAAE,CAC7B,CAAC;YACF,IAAI,SAAS,CAAC,WAAW,KAAK,WAAW,CAAC,QAAQ,EAAE,CAAC;gBACpD,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;YAChF,CAAC;YACD,MAAM,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;YAEzC,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;YAE1C,IAAI,WAAW,KAAK,SAAS,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE,CAAC;gBAClE,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;YACrE,CAAC;YAED;;;;eAIG;YACH,OAAO,WAAW,CAAC,MAAM,CAAC;QAC3B,CAAC,CAAC;QACF,MAAM,cAAc,GAAG,MAAM,oBAAoB,CAAI,EAAE,SAAS,EAAE,CAAC,CAAC;QACpE,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC;QAC/B,OAAO,cAAc,CAAC;IACvB,CAAC;IAEO,KAAK,CAAC,oBAAoB,CAAC,SAAqB;QACvD,OAAO,IAAI,qBAAqB,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport type {\n\tIContainer,\n\tIFluidModuleWithDetails,\n} from \"@fluidframework/container-definitions/internal\";\nimport {\n\tcreateDetachedContainer,\n\tloadExistingContainer,\n\ttype ILoaderProps,\n} from \"@fluidframework/container-loader/internal\";\nimport type {\n\tIConfigProviderBase,\n\tIRequest,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport type { IClient } from \"@fluidframework/driver-definitions\";\nimport type { IDocumentServiceFactory } from \"@fluidframework/driver-definitions/internal\";\nimport type { ContainerAttachProps, ContainerSchema } from \"@fluidframework/fluid-static\";\nimport {\n\tcreateDOProviderContainerRuntimeFactory,\n\tcreateFluidContainer,\n} from \"@fluidframework/fluid-static/internal\";\nimport {\n\tOdspDocumentServiceFactory,\n\tOdspDriverUrlResolver,\n\tcreateOdspCreateContainerRequest,\n\tcreateOdspUrl,\n\tisOdspResolvedUrl,\n} from \"@fluidframework/odsp-driver/internal\";\nimport type { OdspResourceTokenFetchOptions } from \"@fluidframework/odsp-driver-definitions/internal\";\nimport { wrapConfigProviderWithDefaults } from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport type {\n\tTokenResponse,\n\tOdspClientProps,\n\tOdspConnectionConfig,\n\tOdspContainerAttachProps,\n\tOdspContainerServices as IOdspContainerServices,\n\tIOdspFluidContainer,\n} from \"./interfaces.js\";\nimport { OdspContainerServices } from \"./odspContainerServices.js\";\nimport type { IOdspTokenProvider } from \"./token.js\";\n\nasync function getStorageToken(\n\toptions: OdspResourceTokenFetchOptions,\n\ttokenProvider: IOdspTokenProvider,\n): Promise<TokenResponse> {\n\tconst tokenResponse: TokenResponse = await tokenProvider.fetchStorageToken(\n\t\toptions.siteUrl,\n\t\toptions.refresh,\n\t);\n\treturn tokenResponse;\n}\n\nasync function getWebsocketToken(\n\toptions: OdspResourceTokenFetchOptions,\n\ttokenProvider: IOdspTokenProvider,\n): Promise<TokenResponse> {\n\tconst tokenResponse: TokenResponse = await tokenProvider.fetchWebsocketToken(\n\t\toptions.siteUrl,\n\t\toptions.refresh,\n\t);\n\treturn tokenResponse;\n}\n\n/**\n * Default feature gates.\n * These values will only be used if the feature gate is not already set by the supplied config provider.\n */\nconst odspClientFeatureGates = {\n\t// None yet\n};\n\n/**\n * Wrap the config provider to fall back on the appropriate defaults for ODSP Client.\n * @param baseConfigProvider - The base config provider to wrap\n * @returns A new config provider with the appropriate defaults applied underneath the given provider\n */\nfunction wrapConfigProvider(baseConfigProvider?: IConfigProviderBase): IConfigProviderBase {\n\treturn wrapConfigProviderWithDefaults(baseConfigProvider, odspClientFeatureGates);\n}\n\n/**\n * OdspClient provides the ability to have a Fluid object backed by the ODSP service within the context of Microsoft 365 (M365) tenants.\n * @sealed\n * @beta\n */\nexport class OdspClient {\n\tprivate readonly documentServiceFactory: IDocumentServiceFactory;\n\tprivate readonly urlResolver: OdspDriverUrlResolver;\n\tprivate readonly configProvider: IConfigProviderBase | undefined;\n\tprivate readonly connectionConfig: OdspConnectionConfig;\n\tprivate readonly logger: ITelemetryBaseLogger | undefined;\n\n\tpublic constructor(properties: OdspClientProps) {\n\t\tthis.connectionConfig = properties.connection;\n\t\tthis.logger = properties.logger;\n\t\tthis.documentServiceFactory = new OdspDocumentServiceFactory(\n\t\t\tasync (options) => getStorageToken(options, this.connectionConfig.tokenProvider),\n\t\t\tasync (options) => getWebsocketToken(options, this.connectionConfig.tokenProvider),\n\t\t);\n\n\t\tthis.urlResolver = new OdspDriverUrlResolver();\n\t\tthis.configProvider = wrapConfigProvider(properties.configProvider);\n\t}\n\n\tpublic async createContainer<T extends ContainerSchema>(\n\t\tcontainerSchema: T,\n\t): Promise<{\n\t\tcontainer: IOdspFluidContainer<T>;\n\t\tservices: IOdspContainerServices;\n\t}> {\n\t\tconst loaderProps = this.getLoaderProps(containerSchema);\n\n\t\tconst container = await createDetachedContainer({\n\t\t\t...loaderProps,\n\t\t\tcodeDetails: {\n\t\t\t\tpackage: \"no-dynamic-package\",\n\t\t\t\tconfig: {},\n\t\t\t},\n\t\t});\n\n\t\tconst fluidContainer = await this.createFluidContainer<T>(\n\t\t\tcontainer,\n\t\t\tthis.connectionConfig,\n\t\t);\n\n\t\tconst services = await this.getContainerServices(container);\n\n\t\treturn { container: fluidContainer, services };\n\t}\n\n\tpublic async getContainer<T extends ContainerSchema>(\n\t\tid: string,\n\t\tcontainerSchema: T,\n\t): Promise<{\n\t\tcontainer: IOdspFluidContainer<T>;\n\t\tservices: IOdspContainerServices;\n\t}> {\n\t\tconst loaderProps = this.getLoaderProps(containerSchema);\n\t\tconst url = createOdspUrl({\n\t\t\tsiteUrl: this.connectionConfig.siteUrl,\n\t\t\tdriveId: this.connectionConfig.driveId,\n\t\t\titemId: id,\n\t\t\tdataStorePath: \"\",\n\t\t});\n\t\tconst container = await loadExistingContainer({ ...loaderProps, request: { url } });\n\n\t\tconst fluidContainer = await createFluidContainer<T>({\n\t\t\tcontainer,\n\t\t});\n\t\tconst services = await this.getContainerServices(container);\n\t\treturn { container: fluidContainer, services };\n\t}\n\n\tprivate getLoaderProps(schema: ContainerSchema): ILoaderProps {\n\t\tconst runtimeFactory = createDOProviderContainerRuntimeFactory({\n\t\t\tschema,\n\t\t\tcompatibilityMode: \"2\",\n\t\t});\n\t\tconst load = async (): Promise<IFluidModuleWithDetails> => {\n\t\t\treturn {\n\t\t\t\tmodule: { fluidExport: runtimeFactory },\n\t\t\t\tdetails: { package: \"no-dynamic-package\", config: {} },\n\t\t\t};\n\t\t};\n\n\t\tconst codeLoader = { load };\n\t\tconst client: IClient = {\n\t\t\tdetails: {\n\t\t\t\tcapabilities: { interactive: true },\n\t\t\t},\n\t\t\tpermission: [],\n\t\t\tscopes: [],\n\t\t\tuser: { id: \"\" },\n\t\t\tmode: \"write\",\n\t\t};\n\n\t\treturn {\n\t\t\turlResolver: this.urlResolver,\n\t\t\tdocumentServiceFactory: this.documentServiceFactory,\n\t\t\tcodeLoader,\n\t\t\tlogger: this.logger,\n\t\t\toptions: { client },\n\t\t\tconfigProvider: this.configProvider,\n\t\t};\n\t}\n\n\tprivate async createFluidContainer<T extends ContainerSchema>(\n\t\tcontainer: IContainer,\n\t\tconnection: OdspConnectionConfig,\n\t): Promise<IOdspFluidContainer<T>> {\n\t\t/**\n\t\t * See {@link FluidContainer.attach}\n\t\t */\n\t\tconst attach = async (\n\t\t\todspProps?: ContainerAttachProps<OdspContainerAttachProps>,\n\t\t): Promise<string> => {\n\t\t\tconst createNewRequest: IRequest = createOdspCreateContainerRequest(\n\t\t\t\tconnection.siteUrl,\n\t\t\t\tconnection.driveId,\n\t\t\t\todspProps?.filePath ?? \"\",\n\t\t\t\todspProps?.fileName ?? uuid(),\n\t\t\t);\n\t\t\tif (container.attachState !== AttachState.Detached) {\n\t\t\t\tthrow new Error(\"Cannot attach container. Container is not in detached state\");\n\t\t\t}\n\t\t\tawait container.attach(createNewRequest);\n\n\t\t\tconst resolvedUrl = container.resolvedUrl;\n\n\t\t\tif (resolvedUrl === undefined || !isOdspResolvedUrl(resolvedUrl)) {\n\t\t\t\tthrow new Error(\"Resolved Url not available on attached container\");\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * A unique identifier for the file within the provided SharePoint Embedded container ID. When you attach a container,\n\t\t\t * a new `itemId` is created in the user's drive, which developers can use for various operations\n\t\t\t * like updating, renaming, moving the Fluid file, changing permissions, and more. `itemId` is used to load the container.\n\t\t\t */\n\t\t\treturn resolvedUrl.itemId;\n\t\t};\n\t\tconst fluidContainer = await createFluidContainer<T>({ container });\n\t\tfluidContainer.attach = attach;\n\t\treturn fluidContainer;\n\t}\n\n\tprivate async getContainerServices(container: IContainer): Promise<IOdspContainerServices> {\n\t\treturn new OdspContainerServices(container);\n\t}\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/odsp-client",
3
- "version": "2.70.0",
3
+ "version": "2.71.0",
4
4
  "description": "A tool to enable creation and loading of Fluid containers using the ODSP service",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -69,28 +69,28 @@
69
69
  "temp-directory": "nyc/.nyc_output"
70
70
  },
71
71
  "dependencies": {
72
- "@fluidframework/container-definitions": "~2.70.0",
73
- "@fluidframework/container-loader": "~2.70.0",
74
- "@fluidframework/core-interfaces": "~2.70.0",
75
- "@fluidframework/core-utils": "~2.70.0",
76
- "@fluidframework/driver-definitions": "~2.70.0",
77
- "@fluidframework/fluid-static": "~2.70.0",
78
- "@fluidframework/map": "~2.70.0",
79
- "@fluidframework/odsp-doclib-utils": "~2.70.0",
80
- "@fluidframework/odsp-driver": "~2.70.0",
81
- "@fluidframework/odsp-driver-definitions": "~2.70.0",
82
- "@fluidframework/telemetry-utils": "~2.70.0",
72
+ "@fluidframework/container-definitions": "~2.71.0",
73
+ "@fluidframework/container-loader": "~2.71.0",
74
+ "@fluidframework/core-interfaces": "~2.71.0",
75
+ "@fluidframework/core-utils": "~2.71.0",
76
+ "@fluidframework/driver-definitions": "~2.71.0",
77
+ "@fluidframework/fluid-static": "~2.71.0",
78
+ "@fluidframework/map": "~2.71.0",
79
+ "@fluidframework/odsp-doclib-utils": "~2.71.0",
80
+ "@fluidframework/odsp-driver": "~2.71.0",
81
+ "@fluidframework/odsp-driver-definitions": "~2.71.0",
82
+ "@fluidframework/telemetry-utils": "~2.71.0",
83
83
  "uuid": "^11.1.0"
84
84
  },
85
85
  "devDependencies": {
86
86
  "@arethetypeswrong/cli": "^0.17.1",
87
87
  "@biomejs/biome": "~1.9.3",
88
- "@fluid-internal/mocha-test-setup": "~2.70.0",
88
+ "@fluid-internal/mocha-test-setup": "~2.71.0",
89
89
  "@fluid-tools/build-cli": "^0.58.3",
90
90
  "@fluidframework/build-common": "^2.0.3",
91
91
  "@fluidframework/build-tools": "^0.58.3",
92
- "@fluidframework/eslint-config-fluid": "^6.1.0",
93
- "@fluidframework/test-utils": "~2.70.0",
92
+ "@fluidframework/eslint-config-fluid": "^7.0.0",
93
+ "@fluidframework/test-utils": "~2.71.0",
94
94
  "@microsoft/api-extractor": "7.52.11",
95
95
  "@types/mocha": "^10.0.10",
96
96
  "@types/node": "^18.19.0",
@@ -129,8 +129,8 @@
129
129
  "check:format": "npm run check:biome",
130
130
  "ci:build:docs": "api-extractor run",
131
131
  "clean": "rimraf --glob dist lib {alpha,beta,internal,legacy}.d.ts \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
132
- "eslint": "eslint --format stylish src",
133
- "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
132
+ "eslint": "eslint --quiet --format stylish src",
133
+ "eslint:fix": "eslint --quiet --format stylish src --fix --fix-type problem,suggestion,layout",
134
134
  "format": "npm run format:biome",
135
135
  "format:biome": "biome check . --write",
136
136
  "lint": "fluid-build . --task lint",
package/src/index.ts CHANGED
@@ -14,10 +14,12 @@
14
14
  */
15
15
 
16
16
  export type {
17
- OdspConnectionConfig,
17
+ IOdspAudience,
18
+ IOdspFluidContainer,
18
19
  OdspClientProps,
20
+ OdspConnectionConfig,
21
+ OdspContainerAttachProps,
19
22
  OdspContainerServices,
20
- IOdspAudience,
21
23
  OdspMember,
22
24
  TokenResponse,
23
25
  } from "./interfaces.js";
package/src/interfaces.ts CHANGED
@@ -7,7 +7,13 @@ import type {
7
7
  IConfigProviderBase,
8
8
  ITelemetryBaseLogger,
9
9
  } from "@fluidframework/core-interfaces";
10
- import type { IMember, IServiceAudience } from "@fluidframework/fluid-static";
10
+ import type {
11
+ ContainerAttachProps,
12
+ ContainerSchema,
13
+ IFluidContainer,
14
+ IMember,
15
+ IServiceAudience,
16
+ } from "@fluidframework/fluid-static";
11
17
 
12
18
  import type { IOdspTokenProvider } from "./token.js";
13
19
 
@@ -59,7 +65,6 @@ export interface OdspClientProps {
59
65
  }
60
66
 
61
67
  /**
62
- * @legacy
63
68
  * @beta
64
69
  */
65
70
  export interface OdspContainerAttachProps {
@@ -74,6 +79,26 @@ export interface OdspContainerAttachProps {
74
79
  fileName: string | undefined;
75
80
  }
76
81
 
82
+ /**
83
+ * ODSP version of the IFluidContainer interface.
84
+ * @beta
85
+ */
86
+ export interface IOdspFluidContainer<
87
+ TContainerSchema extends ContainerSchema = ContainerSchema,
88
+ > extends IFluidContainer<TContainerSchema> {
89
+ /**
90
+ * A newly created container starts detached from the collaborative service.
91
+ * Calling `attach()` uploads the new container to the service and connects to the collaborative service.
92
+ *
93
+ * This function is the same as the IFluidContainer.attach function, but has ODSP specific function signatures.
94
+ *
95
+ * @param props - Optional properties to pass to the attach function.
96
+ *
97
+ * @returns A promise which resolves when the attach is complete, with the string identifier of the container.
98
+ */
99
+ attach(props?: ContainerAttachProps<OdspContainerAttachProps>): Promise<string>;
100
+ }
101
+
77
102
  /**
78
103
  * OdspContainerServices is returned by the OdspClient alongside a FluidContainer. It holds the
79
104
  * functionality specifically tied to the ODSP service, and how the data stored in the
package/src/odspClient.ts CHANGED
@@ -20,11 +20,7 @@ import type {
20
20
  } from "@fluidframework/core-interfaces";
21
21
  import type { IClient } from "@fluidframework/driver-definitions";
22
22
  import type { IDocumentServiceFactory } from "@fluidframework/driver-definitions/internal";
23
- import type {
24
- ContainerAttachProps,
25
- ContainerSchema,
26
- IFluidContainer,
27
- } from "@fluidframework/fluid-static";
23
+ import type { ContainerAttachProps, ContainerSchema } from "@fluidframework/fluid-static";
28
24
  import {
29
25
  createDOProviderContainerRuntimeFactory,
30
26
  createFluidContainer,
@@ -46,6 +42,7 @@ import type {
46
42
  OdspConnectionConfig,
47
43
  OdspContainerAttachProps,
48
44
  OdspContainerServices as IOdspContainerServices,
45
+ IOdspFluidContainer,
49
46
  } from "./interfaces.js";
50
47
  import { OdspContainerServices } from "./odspContainerServices.js";
51
48
  import type { IOdspTokenProvider } from "./token.js";
@@ -116,7 +113,7 @@ export class OdspClient {
116
113
  public async createContainer<T extends ContainerSchema>(
117
114
  containerSchema: T,
118
115
  ): Promise<{
119
- container: IFluidContainer<T>;
116
+ container: IOdspFluidContainer<T>;
120
117
  services: IOdspContainerServices;
121
118
  }> {
122
119
  const loaderProps = this.getLoaderProps(containerSchema);
@@ -129,18 +126,21 @@ export class OdspClient {
129
126
  },
130
127
  });
131
128
 
132
- const fluidContainer = await this.createFluidContainer(container, this.connectionConfig);
129
+ const fluidContainer = await this.createFluidContainer<T>(
130
+ container,
131
+ this.connectionConfig,
132
+ );
133
133
 
134
134
  const services = await this.getContainerServices(container);
135
135
 
136
- return { container: fluidContainer as IFluidContainer<T>, services };
136
+ return { container: fluidContainer, services };
137
137
  }
138
138
 
139
139
  public async getContainer<T extends ContainerSchema>(
140
140
  id: string,
141
141
  containerSchema: T,
142
142
  ): Promise<{
143
- container: IFluidContainer<T>;
143
+ container: IOdspFluidContainer<T>;
144
144
  services: IOdspContainerServices;
145
145
  }> {
146
146
  const loaderProps = this.getLoaderProps(containerSchema);
@@ -152,11 +152,11 @@ export class OdspClient {
152
152
  });
153
153
  const container = await loadExistingContainer({ ...loaderProps, request: { url } });
154
154
 
155
- const fluidContainer = await createFluidContainer({
155
+ const fluidContainer = await createFluidContainer<T>({
156
156
  container,
157
157
  });
158
158
  const services = await this.getContainerServices(container);
159
- return { container: fluidContainer as IFluidContainer<T>, services };
159
+ return { container: fluidContainer, services };
160
160
  }
161
161
 
162
162
  private getLoaderProps(schema: ContainerSchema): ILoaderProps {
@@ -192,10 +192,10 @@ export class OdspClient {
192
192
  };
193
193
  }
194
194
 
195
- private async createFluidContainer(
195
+ private async createFluidContainer<T extends ContainerSchema>(
196
196
  container: IContainer,
197
197
  connection: OdspConnectionConfig,
198
- ): Promise<IFluidContainer> {
198
+ ): Promise<IOdspFluidContainer<T>> {
199
199
  /**
200
200
  * See {@link FluidContainer.attach}
201
201
  */
@@ -226,7 +226,7 @@ export class OdspClient {
226
226
  */
227
227
  return resolvedUrl.itemId;
228
228
  };
229
- const fluidContainer = await createFluidContainer({ container });
229
+ const fluidContainer = await createFluidContainer<T>({ container });
230
230
  fluidContainer.attach = attach;
231
231
  return fluidContainer;
232
232
  }