@fluidframework/azure-client 0.59.3000 → 1.0.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.
Files changed (46) hide show
  1. package/.eslintrc.js +1 -1
  2. package/README.md +7 -8
  3. package/dist/AzureClient.d.ts +22 -5
  4. package/dist/AzureClient.d.ts.map +1 -1
  5. package/dist/AzureClient.js +87 -20
  6. package/dist/AzureClient.js.map +1 -1
  7. package/dist/AzureUrlResolver.d.ts +1 -1
  8. package/dist/AzureUrlResolver.d.ts.map +1 -1
  9. package/dist/AzureUrlResolver.js +3 -3
  10. package/dist/AzureUrlResolver.js.map +1 -1
  11. package/dist/interfaces.d.ts +56 -9
  12. package/dist/interfaces.d.ts.map +1 -1
  13. package/dist/interfaces.js.map +1 -1
  14. package/dist/packageVersion.d.ts +1 -1
  15. package/dist/packageVersion.d.ts.map +1 -1
  16. package/dist/packageVersion.js +1 -1
  17. package/dist/packageVersion.js.map +1 -1
  18. package/dist/utils.d.ts +14 -0
  19. package/dist/utils.d.ts.map +1 -0
  20. package/dist/utils.js +18 -0
  21. package/dist/utils.js.map +1 -0
  22. package/lib/AzureClient.d.ts +22 -5
  23. package/lib/AzureClient.d.ts.map +1 -1
  24. package/lib/AzureClient.js +86 -19
  25. package/lib/AzureClient.js.map +1 -1
  26. package/lib/AzureUrlResolver.d.ts +1 -1
  27. package/lib/AzureUrlResolver.d.ts.map +1 -1
  28. package/lib/AzureUrlResolver.js +3 -3
  29. package/lib/AzureUrlResolver.js.map +1 -1
  30. package/lib/interfaces.d.ts +56 -9
  31. package/lib/interfaces.d.ts.map +1 -1
  32. package/lib/interfaces.js.map +1 -1
  33. package/lib/packageVersion.d.ts +1 -1
  34. package/lib/packageVersion.d.ts.map +1 -1
  35. package/lib/packageVersion.js +1 -1
  36. package/lib/packageVersion.js.map +1 -1
  37. package/lib/utils.d.ts +14 -0
  38. package/lib/utils.d.ts.map +1 -0
  39. package/lib/utils.js +13 -0
  40. package/lib/utils.js.map +1 -0
  41. package/package.json +35 -19
  42. package/src/AzureClient.ts +142 -27
  43. package/src/AzureUrlResolver.ts +4 -5
  44. package/src/interfaces.ts +62 -9
  45. package/src/packageVersion.ts +1 -1
  46. package/src/utils.ts +21 -0
package/.eslintrc.js CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  module.exports = {
7
7
  "extends": [
8
- "@fluidframework/eslint-config-fluid"
8
+ require.resolve("@fluidframework/eslint-config-fluid")
9
9
  ],
10
10
  "parserOptions": {
11
11
  "project": ["./tsconfig.json", "./src/test/tsconfig.json"]
package/README.md CHANGED
@@ -16,7 +16,7 @@ Fluid requires a backing service to enable collaborative communication. The `Azu
16
16
 
17
17
  NOTE: You can use one instance of the `AzureClient` to create/fetch multiple containers from the same Azure Fluid Relay service instance.
18
18
 
19
- In the example below we will walk through both connecting to a a live Azure Fluid Relay service instance by providing the tenant ID and key that is uniquely generated for us when onboarding to the service, as well as using a tenant ID of "local" for development purposes to run our application against the local service. We make use of `AzureFunctionTokenProvider` for token generation while running against a live Azure Fluid Relay instance and `InsecureTokenProvider`, from the `@fluidframework/test-client-utils` package, to authenticate a given user for access to the service locally. The `AzureFunctionTokenProvider` is an implementation that fulfills the `ITokenProvider` interface without exposing the tenant key secret in client-side code.
19
+ In the example below we will walk through both connecting to a a live Azure Fluid Relay service instance by providing the tenant ID and key that is uniquely generated for us when onboarding to the service, as well as an example of running our application against the local service. We make use of `AzureFunctionTokenProvider` for token generation while running against a live Azure Fluid Relay instance and `InsecureTokenProvider`, from the `@fluidframework/test-client-utils` package, to authenticate a given user for access to the service locally. The `AzureFunctionTokenProvider` is an implementation that fulfills the `ITokenProvider` interface without exposing the tenant key secret in client-side code.
20
20
 
21
21
  ### Backed Locally
22
22
 
@@ -26,18 +26,17 @@ To run the local Azure Fluid Relay service with the default values of `localhost
26
26
  npx @fluidframework/azure-local-service@latest
27
27
  ```
28
28
 
29
- Now, with our local service running in the background, we need to connect the application to it. For this, we first need to create our `ITokenProvider` instance to authenticate the current user to the service. For this, we can use the `InsecureTokenProvider` where we can pass anything into the key (since we are running locally) and an object identifying the current user. Both our orderer and storage URLs will point to the domain and port that our local Azure Fluid Relay service instance is running at. Lastly, to differentiate local mode from remote mode, we are passing in `LOCAL_MODE_TENANT_ID` as tenant ID.
29
+ Now, with our local service running in the background, we need to connect the application to it. For this, we first need to create our `ITokenProvider` instance to authenticate the current user to the service. For this, we can use the `InsecureTokenProvider` where we can pass anything into the key (since we are running locally) and an object identifying the current user. Our endpoint URL will point to the domain and port that our local Azure Fluid Relay service instance is running at. Lastly, to differentiate local mode from remote mode, we set the `type` to `"local"` or `"remote"` respectively.
30
30
 
31
31
  ```typescript
32
- import { AzureClient, AzureConnectionConfig, LOCAL_MODE_TENANT_ID } from "@fluidframework/azure-client";
32
+ import { AzureClient, AzureConnectionConfig } from "@fluidframework/azure-client";
33
33
  import { InsecureTokenProvider } from "@fluidframework/test-client-utils";
34
34
 
35
35
  const clientProps = {
36
36
  connection: {
37
- tenantId: LOCAL_MODE_TENANT_ID,
37
+ type: "local",
38
38
  tokenProvider: new InsecureTokenProvider("fooBar", { id: "123", name: "Test User" }),
39
- orderer: "http://localhost:7070",
40
- storage: "http://localhost:7070",
39
+ endpoint: "http://localhost:7070",
41
40
  },
42
41
  };
43
42
  const azureClient = new AzureClient(clientProps);
@@ -52,13 +51,13 @@ import { AzureClient, AzureConnectionConfig } from "@fluidframework/azure-client
52
51
 
53
52
  const clientProps = {
54
53
  connection: {
54
+ type: "remote",
55
55
  tenantId: "YOUR-TENANT-ID-HERE",
56
56
  tokenProvider: new AzureFunctionTokenProvider(
57
57
  "AZURE-FUNCTION-URL"+"/api/GetAzureToken",
58
58
  { userId: "test-user",userName: "Test User" }
59
59
  ),
60
- orderer: "ENTER-ORDERER-URL-HERE",
61
- storage: "ENTER-STORAGE-URL-HERE",
60
+ endpoint: "ENTER-SERVICE-DISCOVERY-URL-HERE",
62
61
  },
63
62
  };
64
63
  const azureClient = new AzureClient(clientProps);
@@ -1,9 +1,5 @@
1
1
  import { ContainerSchema, IFluidContainer } from "@fluidframework/fluid-static";
2
- import { AzureClientProps, AzureContainerServices } from "./interfaces";
3
- /**
4
- * Strongly typed id for connecting to a local Azure Fluid Relay.
5
- */
6
- export declare const LOCAL_MODE_TENANT_ID = "local";
2
+ import { AzureClientProps, AzureContainerServices, AzureContainerVersion, AzureGetVersionsOptions } from "./interfaces";
7
3
  /**
8
4
  * AzureClient provides the ability to have a Fluid object backed by the Azure Fluid Relay or,
9
5
  * when running with local tenantId, have it be backed by a local Azure Fluid Relay instance.
@@ -26,6 +22,18 @@ export declare class AzureClient {
26
22
  container: IFluidContainer;
27
23
  services: AzureContainerServices;
28
24
  }>;
25
+ /**
26
+ * Creates new detached container out of specific version of another container.
27
+ * @param id - Unique ID of the source container in Azure Fluid Relay.
28
+ * @param containerSchema - Container schema used to access data objects in the container.
29
+ * @param version - Unique version of the source container in Azure Fluid Relay.
30
+ * It defaults to latest version if parameter not provided.
31
+ * @returns New detached container instance along with associated services.
32
+ */
33
+ copyContainer(id: string, containerSchema: ContainerSchema, version?: AzureContainerVersion): Promise<{
34
+ container: IFluidContainer;
35
+ services: AzureContainerServices;
36
+ }>;
29
37
  /**
30
38
  * Accesses the existing container given its unique ID in the Azure Fluid Relay.
31
39
  * @param id - Unique ID of the container in Azure Fluid Relay.
@@ -36,7 +44,16 @@ export declare class AzureClient {
36
44
  container: IFluidContainer;
37
45
  services: AzureContainerServices;
38
46
  }>;
47
+ /**
48
+ * Get the list of versions for specific container.
49
+ * @param id - Unique ID of the source container in Azure Fluid Relay.
50
+ * @param options - "Get" options. If options are not provided, API
51
+ * will assume maxCount of versions to retreive to be 5.
52
+ * @returns Array of available container versions.
53
+ */
54
+ getContainerVersions(id: string, options?: AzureGetVersionsOptions): Promise<AzureContainerVersion[]>;
39
55
  private getContainerServices;
40
56
  private createLoader;
57
+ private createFluidContainer;
41
58
  }
42
59
  //# sourceMappingURL=AzureClient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AzureClient.d.ts","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":"AAiBA,OAAO,EACH,eAAe,EAGf,eAAe,EAElB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAOxE;;GAEG;AACH,eAAO,MAAM,oBAAoB,UAAU,CAAC;AAE5C;;;GAGG;AACH,qBAAa,WAAW;IAQR,OAAO,CAAC,QAAQ,CAAC,KAAK;IAPlC,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAA0B;IACjE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAe;IAE3C;;;OAGG;gBAC0B,KAAK,EAAE,gBAAgB;IAYpD;;;;OAIG;IACU,eAAe,CACxB,eAAe,EAAE,eAAe,GACjC,OAAO,CAAC;QACP,SAAS,EAAE,eAAe,CAAC;QAC3B,QAAQ,EAAE,sBAAsB,CAAC;KACpC,CAAC;IAmCF;;;;;OAKG;IACU,YAAY,CACrB,EAAE,EAAE,MAAM,EACV,eAAe,EAAE,eAAe,GACjC,OAAO,CAAC;QACP,SAAS,EAAE,eAAe,CAAC;QAC3B,QAAQ,EAAE,sBAAsB,CAAC;KACpC,CAAC;IAgBF,OAAO,CAAC,oBAAoB;IAM5B,OAAO,CAAC,YAAY;CAmBvB"}
1
+ {"version":3,"file":"AzureClient.d.ts","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":"AAiBA,OAAO,EACH,eAAe,EAGf,eAAe,EAElB,MAAM,8BAA8B,CAAC;AAMtC,OAAO,EACH,gBAAgB,EAEhB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EAC1B,MAAM,cAAc,CAAC;AAkBtB;;;GAGG;AACH,qBAAa,WAAW;IAQR,OAAO,CAAC,QAAQ,CAAC,KAAK;IAPlC,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAA0B;IACjE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAe;IAE3C;;;OAGG;gBAC0B,KAAK,EAAE,gBAAgB;IAapD;;;;OAIG;IACU,eAAe,CACxB,eAAe,EAAE,eAAe,GACjC,OAAO,CAAC;QACP,SAAS,EAAE,eAAe,CAAC;QAC3B,QAAQ,EAAE,sBAAsB,CAAC;KACpC,CAAC;IAgBF;;;;;;;OAOG;IACU,aAAa,CACtB,EAAE,EAAE,MAAM,EACV,eAAe,EAAE,eAAe,EAChC,OAAO,CAAC,EAAE,qBAAqB,GAChC,OAAO,CAAC;QACP,SAAS,EAAE,eAAe,CAAC;QAC3B,QAAQ,EAAE,sBAAsB,CAAC;KACpC,CAAC;IAmCF;;;;;OAKG;IACU,YAAY,CACrB,EAAE,EAAE,MAAM,EACV,eAAe,EAAE,eAAe,GACjC,OAAO,CAAC;QACP,SAAS,EAAE,eAAe,CAAC;QAC3B,QAAQ,EAAE,sBAAsB,CAAC;KACpC,CAAC;IAgBF;;;;;;OAMG;IACU,oBAAoB,CAC7B,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,uBAAuB,GAClC,OAAO,CAAC,qBAAqB,EAAE,CAAC;IA4BnC,OAAO,CAAC,oBAAoB;IAM5B,OAAO,CAAC,YAAY;YAoBN,oBAAoB;CA4BrC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AzureClient = exports.LOCAL_MODE_TENANT_ID = void 0;
3
+ exports.AzureClient = void 0;
4
4
  /*!
5
5
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
6
6
  * Licensed under the MIT License.
@@ -11,12 +11,18 @@ const routerlicious_driver_1 = require("@fluidframework/routerlicious-driver");
11
11
  const runtime_utils_1 = require("@fluidframework/runtime-utils");
12
12
  const driver_utils_1 = require("@fluidframework/driver-utils");
13
13
  const fluid_static_1 = require("@fluidframework/fluid-static");
14
+ const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
15
+ const utils_1 = require("./utils");
14
16
  const AzureAudience_1 = require("./AzureAudience");
15
17
  const AzureUrlResolver_1 = require("./AzureUrlResolver");
16
18
  /**
17
19
  * Strongly typed id for connecting to a local Azure Fluid Relay.
18
20
  */
19
- exports.LOCAL_MODE_TENANT_ID = "local";
21
+ const LOCAL_MODE_TENANT_ID = "local";
22
+ const getTenantId = (connectionProps) => {
23
+ return (0, utils_1.isAzureRemoteConnectionConfig)(connectionProps) ? connectionProps.tenantId : LOCAL_MODE_TENANT_ID;
24
+ };
25
+ const MAX_VERSION_COUNT = 5;
20
26
  /**
21
27
  * AzureClient provides the ability to have a Fluid object backed by the Azure Fluid Relay or,
22
28
  * when running with local tenantId, have it be backed by a local Azure Fluid Relay instance.
@@ -28,11 +34,13 @@ class AzureClient {
28
34
  */
29
35
  constructor(props) {
30
36
  this.props = props;
37
+ // remove trailing slash from URL if any
38
+ props.connection.endpoint = props.connection.endpoint.replace(/\/$/, "");
31
39
  this.urlResolver = new AzureUrlResolver_1.AzureUrlResolver();
32
40
  // The local service implementation differs from the Azure Fluid Relay in blob
33
41
  // storage format. Azure Fluid Relay supports whole summary upload. Local currently does not.
34
- const enableWholeSummaryUpload = this.props.connection.tenantId !== exports.LOCAL_MODE_TENANT_ID;
35
- this.documentServiceFactory = new routerlicious_driver_1.RouterliciousDocumentServiceFactory(this.props.connection.tokenProvider, { enableWholeSummaryUpload });
42
+ const enableWholeSummaryUpload = (0, utils_1.isAzureRemoteConnectionConfig)(this.props.connection);
43
+ this.documentServiceFactory = new routerlicious_driver_1.RouterliciousDocumentServiceFactory(this.props.connection.tokenProvider, { enableWholeSummaryUpload, enableDiscovery: true });
36
44
  }
37
45
  /**
38
46
  * Creates a new detached container instance in the Azure Fluid Relay.
@@ -45,19 +53,39 @@ class AzureClient {
45
53
  package: "no-dynamic-package",
46
54
  config: {},
47
55
  });
48
- const rootDataObject = await (0, runtime_utils_1.requestFluidObject)(container, "/");
49
- const createNewRequest = (0, AzureUrlResolver_1.createAzureCreateNewRequest)(this.props.connection.orderer, this.props.connection.storage, this.props.connection.tenantId);
50
- const fluidContainer = new (class extends fluid_static_1.FluidContainer {
51
- async attach() {
52
- if (this.attachState !== container_definitions_1.AttachState.Detached) {
53
- throw new Error("Cannot attach container. Container is not in detached state");
54
- }
55
- await container.attach(createNewRequest);
56
- const resolved = container.resolvedUrl;
57
- (0, driver_utils_1.ensureFluidResolvedUrl)(resolved);
58
- return resolved.id;
59
- }
60
- })(container, rootDataObject);
56
+ const fluidContainer = await this.createFluidContainer(container, this.props.connection);
57
+ const services = this.getContainerServices(container);
58
+ return { container: fluidContainer, services };
59
+ }
60
+ /**
61
+ * Creates new detached container out of specific version of another container.
62
+ * @param id - Unique ID of the source container in Azure Fluid Relay.
63
+ * @param containerSchema - Container schema used to access data objects in the container.
64
+ * @param version - Unique version of the source container in Azure Fluid Relay.
65
+ * It defaults to latest version if parameter not provided.
66
+ * @returns New detached container instance along with associated services.
67
+ */
68
+ async copyContainer(id, containerSchema, version) {
69
+ var _a;
70
+ const loader = this.createLoader(containerSchema);
71
+ const url = new URL(this.props.connection.endpoint);
72
+ url.searchParams.append("storage", encodeURIComponent(this.props.connection.endpoint));
73
+ url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.props.connection)));
74
+ url.searchParams.append("containerId", encodeURIComponent(id));
75
+ const sourceContainer = await loader.resolve({ url: url.href });
76
+ if (sourceContainer.resolvedUrl === undefined) {
77
+ throw new Error("Source container cannot resolve URL.");
78
+ }
79
+ const documentService = await this.documentServiceFactory.createDocumentService(sourceContainer.resolvedUrl);
80
+ const storage = await documentService.connectToStorage();
81
+ const handle = {
82
+ type: protocol_definitions_1.SummaryType.Handle,
83
+ handleType: protocol_definitions_1.SummaryType.Tree,
84
+ handle: (_a = version === null || version === void 0 ? void 0 : version.id) !== null && _a !== void 0 ? _a : "latest",
85
+ };
86
+ const tree = await storage.downloadSummary(handle);
87
+ const container = await loader.rehydrateDetachedContainerFromSnapshot(JSON.stringify(tree));
88
+ const fluidContainer = await this.createFluidContainer(container, this.props.connection);
61
89
  const services = this.getContainerServices(container);
62
90
  return { container: fluidContainer, services };
63
91
  }
@@ -69,9 +97,9 @@ class AzureClient {
69
97
  */
70
98
  async getContainer(id, containerSchema) {
71
99
  const loader = this.createLoader(containerSchema);
72
- const url = new URL(this.props.connection.orderer);
73
- url.searchParams.append("storage", encodeURIComponent(this.props.connection.storage));
74
- url.searchParams.append("tenantId", encodeURIComponent(this.props.connection.tenantId));
100
+ const url = new URL(this.props.connection.endpoint);
101
+ url.searchParams.append("storage", encodeURIComponent(this.props.connection.endpoint));
102
+ url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.props.connection)));
75
103
  url.searchParams.append("containerId", encodeURIComponent(id));
76
104
  const container = await loader.resolve({ url: url.href });
77
105
  const rootDataObject = await (0, runtime_utils_1.requestFluidObject)(container, "/");
@@ -79,6 +107,30 @@ class AzureClient {
79
107
  const services = this.getContainerServices(container);
80
108
  return { container: fluidContainer, services };
81
109
  }
110
+ /**
111
+ * Get the list of versions for specific container.
112
+ * @param id - Unique ID of the source container in Azure Fluid Relay.
113
+ * @param options - "Get" options. If options are not provided, API
114
+ * will assume maxCount of versions to retreive to be 5.
115
+ * @returns Array of available container versions.
116
+ */
117
+ async getContainerVersions(id, options) {
118
+ var _a;
119
+ const url = new URL(this.props.connection.endpoint);
120
+ url.searchParams.append("storage", encodeURIComponent(this.props.connection.endpoint));
121
+ url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.props.connection)));
122
+ url.searchParams.append("containerId", encodeURIComponent(id));
123
+ const resolvedUrl = await this.urlResolver.resolve({ url: url.href });
124
+ if (!resolvedUrl) {
125
+ throw new Error("Unable to resolved URL");
126
+ }
127
+ const documentService = await this.documentServiceFactory.createDocumentService(resolvedUrl);
128
+ const storage = await documentService.connectToStorage();
129
+ const versions = await storage.getVersions(null, (_a = options === null || options === void 0 ? void 0 : options.maxCount) !== null && _a !== void 0 ? _a : MAX_VERSION_COUNT);
130
+ return versions.map((item) => {
131
+ return { id: item.id, date: item.date };
132
+ });
133
+ }
82
134
  getContainerServices(container) {
83
135
  return {
84
136
  audience: new AzureAudience_1.AzureAudience(container),
@@ -100,6 +152,21 @@ class AzureClient {
100
152
  logger: this.props.logger,
101
153
  });
102
154
  }
155
+ async createFluidContainer(container, connection) {
156
+ const createNewRequest = (0, AzureUrlResolver_1.createAzureCreateNewRequest)(connection.endpoint, getTenantId(connection));
157
+ const rootDataObject = await (0, runtime_utils_1.requestFluidObject)(container, "/");
158
+ return new (class extends fluid_static_1.FluidContainer {
159
+ async attach() {
160
+ if (this.attachState !== container_definitions_1.AttachState.Detached) {
161
+ throw new Error("Cannot attach container. Container is not in detached state");
162
+ }
163
+ await container.attach(createNewRequest);
164
+ const resolved = container.resolvedUrl;
165
+ (0, driver_utils_1.ensureFluidResolvedUrl)(resolved);
166
+ return resolved.id;
167
+ }
168
+ })(container, rootDataObject);
169
+ }
103
170
  }
104
171
  exports.AzureClient = AzureClient;
105
172
  //# sourceMappingURL=AzureClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AzureClient.js","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,uEAA0D;AAK1D,iFAI+C;AAC/C,+EAA2F;AAC3F,iEAAmE;AACnE,+DAAsE;AACtE,+DAMsC;AAGtC,mDAAgD;AAChD,yDAG4B;AAE5B;;GAEG;AACU,QAAA,oBAAoB,GAAG,OAAO,CAAC;AAE5C;;;GAGG;AACH,MAAa,WAAW;IAIpB;;;OAGG;IACH,YAA6B,KAAuB;QAAvB,UAAK,GAAL,KAAK,CAAkB;QAChD,IAAI,CAAC,WAAW,GAAG,IAAI,mCAAgB,EAAE,CAAC;QAC1C,8EAA8E;QAC9E,6FAA6F;QAC7F,MAAM,wBAAwB,GAC1B,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,KAAK,4BAAoB,CAAC;QAC5D,IAAI,CAAC,sBAAsB,GAAG,IAAI,0DAAmC,CAC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,EAAE,EAAE,WAAW,EAAE,cAAc,EAAE;gBACvC,OAAO,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,EAAE,EAAE;aACzD,CAAC;QACN,CAAC,CAAC;QAEF,MAAM,UAAU,GAAG,EAAE,IAAI,EAAE,CAAC;QAC5B,OAAO,IAAI,yBAAM,CAAC;YACd,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,sBAAsB,EAAE,IAAI,CAAC,sBAAsB;YACnD,UAAU;YACV,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;SAC5B,CAAC,CAAC;IACP,CAAC;CACJ;AAtHD,kCAsHC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { Loader } from \"@fluidframework/container-loader\";\nimport {\n IDocumentServiceFactory,\n IUrlResolver,\n} from \"@fluidframework/driver-definitions\";\nimport {\n AttachState,\n IContainer,\n IFluidModuleWithDetails,\n} from \"@fluidframework/container-definitions\";\nimport { RouterliciousDocumentServiceFactory } from \"@fluidframework/routerlicious-driver\";\nimport { requestFluidObject } from \"@fluidframework/runtime-utils\";\nimport { ensureFluidResolvedUrl } from \"@fluidframework/driver-utils\";\nimport {\n ContainerSchema,\n DOProviderContainerRuntimeFactory,\n FluidContainer,\n IFluidContainer,\n RootDataObject,\n} from \"@fluidframework/fluid-static\";\n\nimport { AzureClientProps, AzureContainerServices } from \"./interfaces\";\nimport { AzureAudience } from \"./AzureAudience\";\nimport {\n AzureUrlResolver,\n createAzureCreateNewRequest,\n} from \"./AzureUrlResolver\";\n\n/**\n * Strongly typed id for connecting to a local Azure Fluid Relay.\n */\nexport const LOCAL_MODE_TENANT_ID = \"local\";\n\n/**\n * AzureClient provides the ability to have a Fluid object backed by the Azure Fluid Relay or,\n * when running with local tenantId, have it be backed by a local Azure Fluid Relay instance.\n */\nexport class AzureClient {\n private readonly documentServiceFactory: IDocumentServiceFactory;\n private readonly urlResolver: IUrlResolver;\n\n /**\n * Creates a new client instance using configuration parameters.\n * @param props - Properties for initializing a new AzureClient instance\n */\n constructor(private readonly props: AzureClientProps) {\n this.urlResolver = new AzureUrlResolver();\n // The local service implementation differs from the Azure Fluid Relay in blob\n // storage format. Azure Fluid Relay supports whole summary upload. Local currently does not.\n const enableWholeSummaryUpload =\n this.props.connection.tenantId !== LOCAL_MODE_TENANT_ID;\n this.documentServiceFactory = new RouterliciousDocumentServiceFactory(\n this.props.connection.tokenProvider,\n { enableWholeSummaryUpload },\n );\n }\n\n /**\n * Creates a new detached container instance in the Azure Fluid Relay.\n * @param containerSchema - Container schema for the new container.\n * @returns New detached container instance along with associated services.\n */\n public async createContainer(\n containerSchema: ContainerSchema,\n ): Promise<{\n container: IFluidContainer;\n services: AzureContainerServices;\n }> {\n const loader = this.createLoader(containerSchema);\n\n const container = await loader.createDetachedContainer({\n package: \"no-dynamic-package\",\n config: {},\n });\n\n const rootDataObject = await requestFluidObject<RootDataObject>(\n container,\n \"/\",\n );\n const createNewRequest = createAzureCreateNewRequest(\n this.props.connection.orderer,\n this.props.connection.storage,\n this.props.connection.tenantId,\n );\n const fluidContainer = new (class extends FluidContainer {\n async attach() {\n if (this.attachState !== AttachState.Detached) {\n throw new Error(\n \"Cannot attach container. Container is not in detached state\",\n );\n }\n await container.attach(createNewRequest);\n const resolved = container.resolvedUrl;\n ensureFluidResolvedUrl(resolved);\n return resolved.id;\n }\n })(container, rootDataObject);\n\n const services = this.getContainerServices(container);\n return { container: fluidContainer, services };\n }\n\n /**\n * Accesses the existing container given its unique ID in the Azure Fluid Relay.\n * @param id - Unique ID of the container in Azure Fluid Relay.\n * @param containerSchema - Container schema used to access data objects in the container.\n * @returns Existing container instance along with associated services.\n */\n public async getContainer(\n id: string,\n containerSchema: ContainerSchema,\n ): Promise<{\n container: IFluidContainer;\n services: AzureContainerServices;\n }> {\n const loader = this.createLoader(containerSchema);\n const url = new URL(this.props.connection.orderer);\n url.searchParams.append(\"storage\", encodeURIComponent(this.props.connection.storage));\n url.searchParams.append(\"tenantId\", encodeURIComponent(this.props.connection.tenantId));\n url.searchParams.append(\"containerId\", encodeURIComponent(id));\n const container = await loader.resolve({ url: url.href });\n const rootDataObject = await requestFluidObject<RootDataObject>(\n container,\n \"/\",\n );\n const fluidContainer = new FluidContainer(container, rootDataObject);\n const services = this.getContainerServices(container);\n return { container: fluidContainer, services };\n }\n\n private getContainerServices(container: IContainer): AzureContainerServices {\n return {\n audience: new AzureAudience(container),\n };\n }\n\n private createLoader(containerSchema: ContainerSchema): Loader {\n const runtimeFactory = new DOProviderContainerRuntimeFactory(\n containerSchema,\n );\n const load = async (): Promise<IFluidModuleWithDetails> => {\n return {\n module: { fluidExport: runtimeFactory },\n details: { package: \"no-dynamic-package\", config: {} },\n };\n };\n\n const codeLoader = { load };\n return new Loader({\n urlResolver: this.urlResolver,\n documentServiceFactory: this.documentServiceFactory,\n codeLoader,\n logger: this.props.logger,\n });\n }\n}\n"]}
1
+ {"version":3,"file":"AzureClient.js","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,uEAA0D;AAK1D,iFAI+C;AAC/C,+EAA2F;AAC3F,iEAAmE;AACnE,+DAAsE;AACtE,+DAMsC;AAEtC,+EAE8C;AAS9C,mCAAwD;AACxD,mDAAgD;AAChD,yDAG4B;AAE5B;;GAEG;AACH,MAAM,oBAAoB,GAAG,OAAO,CAAC;AACrC,MAAM,WAAW,GAAG,CAAC,eAAsC,EAAU,EAAE;IACnE,OAAO,IAAA,qCAA6B,EAAC,eAAe,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,oBAAoB,CAAC;AAC5G,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAE5B;;;GAGG;AACH,MAAa,WAAW;IAIpB;;;OAGG;IACH,YAA6B,KAAuB;QAAvB,UAAK,GAAL,KAAK,CAAkB;QAChD,wCAAwC;QACxC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yright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { Loader } from \"@fluidframework/container-loader\";\nimport {\n IDocumentServiceFactory,\n IUrlResolver,\n} from \"@fluidframework/driver-definitions\";\nimport {\n AttachState,\n IContainer,\n IFluidModuleWithDetails,\n} from \"@fluidframework/container-definitions\";\nimport { RouterliciousDocumentServiceFactory } from \"@fluidframework/routerlicious-driver\";\nimport { requestFluidObject } from \"@fluidframework/runtime-utils\";\nimport { ensureFluidResolvedUrl } from \"@fluidframework/driver-utils\";\nimport {\n ContainerSchema,\n DOProviderContainerRuntimeFactory,\n FluidContainer,\n IFluidContainer,\n RootDataObject,\n} from \"@fluidframework/fluid-static\";\n\nimport {\n SummaryType,\n} from \"@fluidframework/protocol-definitions\";\n\nimport {\n AzureClientProps,\n AzureConnectionConfig,\n AzureContainerServices,\n AzureContainerVersion,\n AzureGetVersionsOptions,\n} from \"./interfaces\";\nimport { isAzureRemoteConnectionConfig } from \"./utils\";\nimport { AzureAudience } from \"./AzureAudience\";\nimport {\n AzureUrlResolver,\n createAzureCreateNewRequest,\n} from \"./AzureUrlResolver\";\n\n/**\n * Strongly typed id for connecting to a local Azure Fluid Relay.\n */\nconst LOCAL_MODE_TENANT_ID = \"local\";\nconst getTenantId = (connectionProps: AzureConnectionConfig): string => {\n return isAzureRemoteConnectionConfig(connectionProps) ? connectionProps.tenantId : LOCAL_MODE_TENANT_ID;\n};\n\nconst MAX_VERSION_COUNT = 5;\n\n/**\n * AzureClient provides the ability to have a Fluid object backed by the Azure Fluid Relay or,\n * when running with local tenantId, have it be backed by a local Azure Fluid Relay instance.\n */\nexport class AzureClient {\n private readonly documentServiceFactory: IDocumentServiceFactory;\n private readonly urlResolver: IUrlResolver;\n\n /**\n * Creates a new client instance using configuration parameters.\n * @param props - Properties for initializing a new AzureClient instance\n */\n constructor(private readonly props: AzureClientProps) {\n // remove trailing slash from URL if any\n props.connection.endpoint = props.connection.endpoint.replace(/\\/$/, \"\");\n this.urlResolver = new AzureUrlResolver();\n // The local service implementation differs from the Azure Fluid Relay in blob\n // storage format. Azure Fluid Relay supports whole summary upload. Local currently does not.\n const enableWholeSummaryUpload = isAzureRemoteConnectionConfig(this.props.connection);\n this.documentServiceFactory = new RouterliciousDocumentServiceFactory(\n this.props.connection.tokenProvider,\n { enableWholeSummaryUpload, enableDiscovery: true },\n );\n }\n\n /**\n * Creates a new detached container instance in the Azure Fluid Relay.\n * @param containerSchema - Container schema for the new container.\n * @returns New detached container instance along with associated services.\n */\n public async createContainer(\n containerSchema: ContainerSchema,\n ): Promise<{\n container: IFluidContainer;\n services: AzureContainerServices;\n }> {\n const loader = this.createLoader(containerSchema);\n\n const container = await loader.createDetachedContainer({\n package: \"no-dynamic-package\",\n config: {},\n });\n\n const fluidContainer = await this.createFluidContainer(\n container,\n this.props.connection,\n );\n const services = this.getContainerServices(container);\n return { container: fluidContainer, services };\n }\n\n /**\n * Creates new detached container out of specific version of another container.\n * @param id - Unique ID of the source container in Azure Fluid Relay.\n * @param containerSchema - Container schema used to access data objects in the container.\n * @param version - Unique version of the source container in Azure Fluid Relay.\n * It defaults to latest version if parameter not provided.\n * @returns New detached container instance along with associated services.\n */\n public async copyContainer(\n id: string,\n containerSchema: ContainerSchema,\n version?: AzureContainerVersion,\n ): Promise<{\n container: IFluidContainer;\n services: AzureContainerServices;\n }> {\n const loader = this.createLoader(containerSchema);\n const url = new URL(this.props.connection.endpoint);\n url.searchParams.append(\"storage\", encodeURIComponent(this.props.connection.endpoint));\n url.searchParams.append(\"tenantId\", encodeURIComponent(getTenantId(this.props.connection)));\n url.searchParams.append(\"containerId\", encodeURIComponent(id));\n const sourceContainer = await loader.resolve({ url: url.href });\n\n if (sourceContainer.resolvedUrl === undefined) {\n throw new Error(\n \"Source container cannot resolve URL.\",\n );\n }\n\n const documentService = await this.documentServiceFactory.createDocumentService(sourceContainer.resolvedUrl);\n const storage = await documentService.connectToStorage();\n const handle = {\n type: SummaryType.Handle,\n handleType: SummaryType.Tree,\n handle: version?.id ?? \"latest\",\n };\n const tree = await storage.downloadSummary(handle);\n\n const container = await loader.rehydrateDetachedContainerFromSnapshot(\n JSON.stringify(tree),\n );\n\n const fluidContainer = await this.createFluidContainer(\n container,\n this.props.connection,\n );\n const services = this.getContainerServices(container);\n return { container: fluidContainer, services };\n }\n\n /**\n * Accesses the existing container given its unique ID in the Azure Fluid Relay.\n * @param id - Unique ID of the container in Azure Fluid Relay.\n * @param containerSchema - Container schema used to access data objects in the container.\n * @returns Existing container instance along with associated services.\n */\n public async getContainer(\n id: string,\n containerSchema: ContainerSchema,\n ): Promise<{\n container: IFluidContainer;\n services: AzureContainerServices;\n }> {\n const loader = this.createLoader(containerSchema);\n const url = new URL(this.props.connection.endpoint);\n url.searchParams.append(\"storage\", encodeURIComponent(this.props.connection.endpoint));\n url.searchParams.append(\"tenantId\", encodeURIComponent(getTenantId(this.props.connection)));\n url.searchParams.append(\"containerId\", encodeURIComponent(id));\n const container = await loader.resolve({ url: url.href });\n const rootDataObject = await requestFluidObject<RootDataObject>(\n container,\n \"/\",\n );\n const fluidContainer = new FluidContainer(container, rootDataObject);\n const services = this.getContainerServices(container);\n return { container: fluidContainer, services };\n }\n\n /**\n * Get the list of versions for specific container.\n * @param id - Unique ID of the source container in Azure Fluid Relay.\n * @param options - \"Get\" options. If options are not provided, API\n * will assume maxCount of versions to retreive to be 5.\n * @returns Array of available container versions.\n */\n public async getContainerVersions(\n id: string,\n options?: AzureGetVersionsOptions,\n ): Promise<AzureContainerVersion[]> {\n const url = new URL(this.props.connection.endpoint);\n url.searchParams.append(\n \"storage\",\n encodeURIComponent(this.props.connection.endpoint),\n );\n url.searchParams.append(\n \"tenantId\",\n encodeURIComponent(getTenantId(this.props.connection)),\n );\n url.searchParams.append(\"containerId\", encodeURIComponent(id));\n\n const resolvedUrl = await this.urlResolver.resolve({ url: url.href });\n if (!resolvedUrl) {\n throw new Error(\"Unable to resolved URL\");\n }\n const documentService =\n await this.documentServiceFactory.createDocumentService(\n resolvedUrl,\n );\n const storage = await documentService.connectToStorage();\n const versions = await storage.getVersions(null, options?.maxCount ?? MAX_VERSION_COUNT);\n\n return versions.map((item) => {\n return { id: item.id, date: item.date };\n });\n }\n\n private getContainerServices(container: IContainer): AzureContainerServices {\n return {\n audience: new AzureAudience(container),\n };\n }\n\n private createLoader(containerSchema: ContainerSchema): Loader {\n const runtimeFactory = new DOProviderContainerRuntimeFactory(\n containerSchema,\n );\n const load = async (): Promise<IFluidModuleWithDetails> => {\n return {\n module: { fluidExport: runtimeFactory },\n details: { package: \"no-dynamic-package\", config: {} },\n };\n };\n\n const codeLoader = { load };\n return new Loader({\n urlResolver: this.urlResolver,\n documentServiceFactory: this.documentServiceFactory,\n codeLoader,\n logger: this.props.logger,\n });\n }\n\n private async createFluidContainer(\n container: IContainer,\n connection: AzureConnectionConfig,\n ): Promise<FluidContainer> {\n const createNewRequest = createAzureCreateNewRequest(\n connection.endpoint,\n getTenantId(connection),\n );\n\n const rootDataObject = await requestFluidObject<RootDataObject>(\n container,\n \"/\",\n );\n return new (class extends FluidContainer {\n async attach() {\n if (this.attachState !== AttachState.Detached) {\n throw new Error(\n \"Cannot attach container. Container is not in detached state\",\n );\n }\n await container.attach(createNewRequest);\n const resolved = container.resolvedUrl;\n ensureFluidResolvedUrl(resolved);\n return resolved.id;\n }\n })(container, rootDataObject);\n }\n // #endregion\n}\n"]}
@@ -9,5 +9,5 @@ export declare class AzureUrlResolver implements IUrlResolver {
9
9
  resolve(request: IRequest): Promise<IFluidResolvedUrl>;
10
10
  getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string>;
11
11
  }
12
- export declare const createAzureCreateNewRequest: (ordererUrl: string, storageUrl: string, tenantId: string) => IRequest;
12
+ export declare const createAzureCreateNewRequest: (endpointUrl: string, tenantId: string) => IRequest;
13
13
  //# sourceMappingURL=AzureUrlResolver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AzureUrlResolver.d.ts","sourceRoot":"","sources":["../src/AzureUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAEH,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACf,MAAM,oCAAoC,CAAC;AAM5C,qBAAa,gBAAiB,YAAW,YAAY;;IAGpC,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAyCtD,cAAc,CACvB,WAAW,EAAE,YAAY,EACzB,WAAW,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,CAAC;CAMrB;AA+BD,eAAO,MAAM,2BAA2B,eACxB,MAAM,cACN,MAAM,YACR,MAAM,KACjB,QAUF,CAAC"}
1
+ {"version":3,"file":"AzureUrlResolver.d.ts","sourceRoot":"","sources":["../src/AzureUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAEH,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACf,MAAM,oCAAoC,CAAC;AAM5C,qBAAa,gBAAiB,YAAW,YAAY;;IAGpC,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAyCtD,cAAc,CACvB,WAAW,EAAE,YAAY,EACzB,WAAW,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,CAAC;CAMrB;AA+BD,eAAO,MAAM,2BAA2B,gBACvB,MAAM,YACT,MAAM,KACjB,QAUF,CAAC"}
@@ -79,9 +79,9 @@ function decodeAzureUrl(urlString) {
79
79
  containerId: containerIdDecoded,
80
80
  };
81
81
  }
82
- const createAzureCreateNewRequest = (ordererUrl, storageUrl, tenantId) => {
83
- const url = new URL(ordererUrl);
84
- url.searchParams.append("storage", encodeURIComponent(storageUrl));
82
+ const createAzureCreateNewRequest = (endpointUrl, tenantId) => {
83
+ const url = new URL(endpointUrl);
84
+ url.searchParams.append("storage", encodeURIComponent(endpointUrl));
85
85
  url.searchParams.append("tenantId", encodeURIComponent(tenantId));
86
86
  return {
87
87
  url: url.href,
@@ -1 +1 @@
1
- {"version":3,"file":"AzureUrlResolver.js","sourceRoot":"","sources":["../src/AzureUrlResolver.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,2EAK4C;AAE5C,2FAA2F;AAC3F,sFAAsF;AACtF,8FAA8F;AAC9F,2BAA2B;AAC3B,MAAa,gBAAgB;IACzB,gBAAe,CAAC;IAET,KAAK,CAAC,OAAO,CAAC,OAAiB;QAClC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,cAAc,CACpE,OAAO,CAAC,GAAG,CACd,CAAC;QACF,oEAAoE;QACpE,uFAAuF;QACvF,IACI,OAAO,CAAC,OAAO;YACf,OAAO,CAAC,OAAO,CAAC,iCAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAClD;YACE,OAAO;gBACH,SAAS,EAAE;oBACP,eAAe,EAAE,GAAG,UAAU,WAAW,QAAQ,MAAM;oBACvD,UAAU;oBACV,UAAU,EAAE,GAAG,UAAU,UAAU,QAAQ,EAAE;iBAChD;gBACD,0FAA0F;gBAC1F,EAAE,EAAE,EAAE;gBACN,+EAA+E;gBAC/E,MAAM,EAAE,EAAE;gBACV,IAAI,EAAE,OAAO;gBACb,GAAG,EAAE,GAAG,UAAU,IAAI,QAAQ,MAAM;aACvC,CAAC;SACL;QACD,IAAI,WAAW,KAAK,SAAS,EAAE;YAC3B,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;SAC5D;QACD,MAAM,WAAW,GAAG,GAAG,UAAU,IAAI,QAAQ,IAAI,WAAW,EAAE,CAAC;QAC/D,OAAO,OAAO,CAAC,OAAO,CAAC;YACnB,SAAS,EAAE;gBACP,eAAe,EAAE,GAAG,UAAU,WAAW,QAAQ,IAAI,WAAW,EAAE;gBAClE,UAAU;gBACV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C9F,OAAO;QACH,UAAU;QACV,UAAU,EAAE,iBAAiB;QAC7B,QAAQ,EAAE,eAAe;QACzB,WAAW,EAAE,kBAAkB;KAClC,CAAC;AACN,CAAC;AAEM,MAAM,2BAA2B,GAAG,CACvC,UAAkB,EAClB,UAAkB,EAClB,QAAgB,EACR,EAAE;IACV,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;IAChC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC;IACnE,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClE,OAAO;QACH,GAAG,EAAE,GAAG,CAAC,IAAI;QACb,OAAO,EAAE;YACL,CAAC,iCAAY,CAAC,SAAS,CAAC,EAAE,IAAI;SACjC;KACJ,CAAC;AACN,CAAC,CAAC;AAdW,QAAA,2BAA2B,+BActC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport {\n DriverHeader,\n IFluidResolvedUrl,\n IResolvedUrl,\n IUrlResolver,\n} from \"@fluidframework/driver-definitions\";\n\n// Implementation of a URL resolver to resolve documents stored using the Azure Fluid Relay\n// based off of the orderer and storage URLs provide. The token provider here can be a\n// InsecureTokenProvider for basic scenarios or more robust, secure providers that fulfill the\n// ITokenProvider interface\nexport class AzureUrlResolver implements IUrlResolver {\n constructor() {}\n\n public async resolve(request: IRequest): Promise<IFluidResolvedUrl> {\n const { ordererUrl, storageUrl, tenantId, containerId } = decodeAzureUrl(\n request.url,\n );\n // determine whether the request is for creating of a new container.\n // such request has the `createNew` header set to true and doesn't have a container ID.\n if (\n request.headers &&\n request.headers[DriverHeader.createNew] === true\n ) {\n return {\n endpoints: {\n deltaStorageUrl: `${ordererUrl}/deltas/${tenantId}/new`,\n ordererUrl,\n storageUrl: `${storageUrl}/repos/${tenantId}`,\n },\n // id is a mandatory attribute, but it's ignored by the driver for new container requests.\n id: \"\",\n // tokens attribute is redundant as all tokens are generated via ITokenProvider\n tokens: {},\n type: \"fluid\",\n url: `${ordererUrl}/${tenantId}/new`,\n };\n }\n if (containerId === undefined) {\n throw new Error(\"Azure URL did not contain containerId\");\n }\n const documentUrl = `${ordererUrl}/${tenantId}/${containerId}`;\n return Promise.resolve({\n endpoints: {\n deltaStorageUrl: `${ordererUrl}/deltas/${tenantId}/${containerId}`,\n ordererUrl,\n storageUrl: `${storageUrl}/repos/${tenantId}`,\n },\n id: containerId,\n tokens: {},\n type: \"fluid\",\n url: documentUrl,\n });\n }\n\n public async getAbsoluteUrl(\n resolvedUrl: IResolvedUrl,\n relativeUrl: string,\n ): Promise<string> {\n if (resolvedUrl.type !== \"fluid\") {\n throw Error(\"Invalid Resolved Url\");\n }\n return `${resolvedUrl.url}/${relativeUrl}`;\n }\n}\n\nfunction decodeAzureUrl(urlString: string): {\n ordererUrl: string;\n storageUrl: string;\n tenantId: string;\n containerId?: string;\n} {\n const url = new URL(urlString);\n const ordererUrl = url.origin;\n const searchParams = url.searchParams;\n const storageUrl = searchParams.get(\"storage\");\n if (storageUrl === null) {\n throw new Error(\"Azure URL did not contain a storage URL\");\n }\n const tenantId = searchParams.get(\"tenantId\");\n if (tenantId === null) {\n throw new Error(\"Azure URL did not contain a tenant ID\");\n }\n const storageUrlDecoded = decodeURIComponent(storageUrl);\n const tenantIdDecoded = decodeURIComponent(tenantId);\n const containerId = searchParams.get(\"containerId\");\n const containerIdDecoded = containerId !== null ? decodeURIComponent(containerId) : undefined;\n return {\n ordererUrl,\n storageUrl: storageUrlDecoded,\n tenantId: tenantIdDecoded,\n containerId: containerIdDecoded,\n };\n}\n\nexport const createAzureCreateNewRequest = (\n ordererUrl: string,\n storageUrl: string,\n tenantId: string,\n): IRequest => {\n const url = new URL(ordererUrl);\n url.searchParams.append(\"storage\", encodeURIComponent(storageUrl));\n url.searchParams.append(\"tenantId\", encodeURIComponent(tenantId));\n return {\n url: url.href,\n headers: {\n [DriverHeader.createNew]: true,\n },\n };\n};\n"]}
1
+ {"version":3,"file":"AzureUrlResolver.js","sourceRoot":"","sources":["../src/AzureUrlResolver.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,2EAK4C;AAE5C,2FAA2F;AAC3F,sFAAsF;AACtF,8FAA8F;AAC9F,2BAA2B;AAC3B,MAAa,gBAAgB;IACzB,gBAAgB,CAAC;IAEV,KAAK,CAAC,OAAO,CAAC,OAAiB;QAClC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,cAAc,CACpE,OAAO,CAAC,GAAG,CACd,CAAC;QACF,oEAAoE;QACpE,uFAAuF;QACvF,IACI,OAAO,CAAC,OAAO;YACf,OAAO,CAAC,OAAO,CAAC,iCAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAClD;YACE,OAAO;gBACH,SAAS,EAAE;oBACP,eAAe,EAAE,GAAG,UAAU,WAAW,QAAQ,MAAM;oBACvD,UAAU;oBACV,UAAU,EAAE,GAAG,UAAU,UAAU,QAAQ,EAAE;iBAChD;gBACD,0FAA0F;gBAC1F,EAAE,EAAE,EAAE;gBACN,+EAA+E;gBAC/E,MAAM,EAAE,EAAE;gBACV,IAAI,EAAE,OAAO;gBACb,GAAG,EAAE,GAAG,UAAU,IAAI,QAAQ,MAAM;aACvC,CAAC;SACL;QACD,IAAI,WAAW,KAAK,SAAS,EAAE;YAC3B,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;SAC5D;QACD,MAAM,WAAW,GAAG,GAAG,UAAU,IAAI,QAAQ,IAAI,WAAW,EAAE,CAAC;QAC/D,OAAO,OAAO,CAAC,OAAO,CAAC;YACnB,SAAS,EAAE;gBACP,eAAe,EAAE,GAAG,UAAU,WAAW,QAAQ,IAAI,WAAW,EAAE;gBAClE,UAAU;gB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IAC9F,OAAO;QACH,UAAU;QACV,UAAU,EAAE,iBAAiB;QAC7B,QAAQ,EAAE,eAAe;QACzB,WAAW,EAAE,kBAAkB;KAClC,CAAC;AACN,CAAC;AAEM,MAAM,2BAA2B,GAAG,CACvC,WAAmB,EACnB,QAAgB,EACR,EAAE;IACV,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC;IACjC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC,CAAC;IACpE,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClE,OAAO;QACH,GAAG,EAAE,GAAG,CAAC,IAAI;QACb,OAAO,EAAE;YACL,CAAC,iCAAY,CAAC,SAAS,CAAC,EAAE,IAAI;SACjC;KACJ,CAAC;AACN,CAAC,CAAC;AAbW,QAAA,2BAA2B,+BAatC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport {\n DriverHeader,\n IFluidResolvedUrl,\n IResolvedUrl,\n IUrlResolver,\n} from \"@fluidframework/driver-definitions\";\n\n// Implementation of a URL resolver to resolve documents stored using the Azure Fluid Relay\n// based off of the orderer and storage URLs provide. The token provider here can be a\n// InsecureTokenProvider for basic scenarios or more robust, secure providers that fulfill the\n// ITokenProvider interface\nexport class AzureUrlResolver implements IUrlResolver {\n constructor() { }\n\n public async resolve(request: IRequest): Promise<IFluidResolvedUrl> {\n const { ordererUrl, storageUrl, tenantId, containerId } = decodeAzureUrl(\n request.url,\n );\n // determine whether the request is for creating of a new container.\n // such request has the `createNew` header set to true and doesn't have a container ID.\n if (\n request.headers &&\n request.headers[DriverHeader.createNew] === true\n ) {\n return {\n endpoints: {\n deltaStorageUrl: `${ordererUrl}/deltas/${tenantId}/new`,\n ordererUrl,\n storageUrl: `${storageUrl}/repos/${tenantId}`,\n },\n // id is a mandatory attribute, but it's ignored by the driver for new container requests.\n id: \"\",\n // tokens attribute is redundant as all tokens are generated via ITokenProvider\n tokens: {},\n type: \"fluid\",\n url: `${ordererUrl}/${tenantId}/new`,\n };\n }\n if (containerId === undefined) {\n throw new Error(\"Azure URL did not contain containerId\");\n }\n const documentUrl = `${ordererUrl}/${tenantId}/${containerId}`;\n return Promise.resolve({\n endpoints: {\n deltaStorageUrl: `${ordererUrl}/deltas/${tenantId}/${containerId}`,\n ordererUrl,\n storageUrl: `${storageUrl}/repos/${tenantId}`,\n },\n id: containerId,\n tokens: {},\n type: \"fluid\",\n url: documentUrl,\n });\n }\n\n public async getAbsoluteUrl(\n resolvedUrl: IResolvedUrl,\n relativeUrl: string,\n ): Promise<string> {\n if (resolvedUrl.type !== \"fluid\") {\n throw Error(\"Invalid Resolved Url\");\n }\n return `${resolvedUrl.url}/${relativeUrl}`;\n }\n}\n\nfunction decodeAzureUrl(urlString: string): {\n ordererUrl: string;\n storageUrl: string;\n tenantId: string;\n containerId?: string;\n} {\n const url = new URL(urlString);\n const ordererUrl = url.origin;\n const searchParams = url.searchParams;\n const storageUrl = searchParams.get(\"storage\");\n if (storageUrl === null) {\n throw new Error(\"Azure URL did not contain a storage URL\");\n }\n const tenantId = searchParams.get(\"tenantId\");\n if (tenantId === null) {\n throw new Error(\"Azure URL did not contain a tenant ID\");\n }\n const storageUrlDecoded = decodeURIComponent(storageUrl);\n const tenantIdDecoded = decodeURIComponent(tenantId);\n const containerId = searchParams.get(\"containerId\");\n const containerIdDecoded = containerId !== null ? decodeURIComponent(containerId) : undefined;\n return {\n ordererUrl,\n storageUrl: storageUrlDecoded,\n tenantId: tenantIdDecoded,\n containerId: containerIdDecoded,\n };\n}\n\nexport const createAzureCreateNewRequest = (\n endpointUrl: string,\n tenantId: string,\n): IRequest => {\n const url = new URL(endpointUrl);\n url.searchParams.append(\"storage\", encodeURIComponent(endpointUrl));\n url.searchParams.append(\"tenantId\", encodeURIComponent(tenantId));\n return {\n url: url.href,\n headers: {\n [DriverHeader.createNew]: true,\n },\n };\n};\n"]}
@@ -19,27 +19,74 @@ export interface AzureClientProps {
19
19
  */
20
20
  readonly logger?: ITelemetryBaseLogger;
21
21
  }
22
+ /**
23
+ * Container version metadata.
24
+ */
25
+ export interface AzureContainerVersion {
26
+ /**
27
+ * Version ID
28
+ */
29
+ id: string;
30
+ /**
31
+ * Time when version was generated.
32
+ * ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ
33
+ */
34
+ date?: string;
35
+ }
36
+ /**
37
+ * Options for "Get Container Versions" API.
38
+ */
39
+ export interface AzureGetVersionsOptions {
40
+ /**
41
+ * Max number of versions
42
+ */
43
+ maxCount: number;
44
+ }
45
+ /**
46
+ * The type of connection.
47
+ * - "local" for local connections to a Fluid relay instance running on the localhost
48
+ * - "remote" for client connections to the Azure Fluid Relay service
49
+ */
50
+ export declare type AzureConnectionConfigType = "local" | "remote";
22
51
  /**
23
52
  * Parameters for establishing a connection with the Azure Fluid Relay.
24
53
  */
25
54
  export interface AzureConnectionConfig {
26
55
  /**
27
- * URI to the Azure Fluid Relay orderer endpoint
56
+ * The type of connection. Whether we're connecting to a remote Fluid relay server or a local instance.
28
57
  */
29
- orderer: string;
58
+ type: AzureConnectionConfigType;
30
59
  /**
31
- * URI to the Azure Fluid Relay storage endpoint
60
+ * URI to the Azure Fluid Relay service discovery endpoint.
32
61
  */
33
- storage: string;
62
+ endpoint: string;
34
63
  /**
35
- * Unique tenant identifier
36
- */
37
- tenantId: "local" | string;
38
- /**
39
- * Instance that provides Azure Fluid Relay endpoint tokens
64
+ * Instance that provides Azure Fluid Relay endpoint tokens.
40
65
  */
41
66
  tokenProvider: ITokenProvider;
42
67
  }
68
+ /**
69
+ * Parameters for establishing a remote connection with the Azure Fluid Relay.
70
+ */
71
+ export interface AzureRemoteConnectionConfig extends AzureConnectionConfig {
72
+ /**
73
+ * The type of connection. Set to a remote connection.
74
+ */
75
+ type: "remote";
76
+ /**
77
+ * Unique tenant identifier.
78
+ */
79
+ tenantId: string;
80
+ }
81
+ /**
82
+ * Parameters for establishing a local connection with a local instance of the Azure Fluid Relay.
83
+ */
84
+ export interface AzureLocalConnectionConfig extends AzureConnectionConfig {
85
+ /**
86
+ * The type of connection. Set to a remote connection.
87
+ */
88
+ type: "local";
89
+ }
43
90
  /**
44
91
  * AzureContainerServices is returned by the AzureClient alongside a FluidContainer.
45
92
  * It holds the functionality specifically tied to the Azure Fluid Relay, and how the data stored in
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EACH,OAAO,EACP,gBAAgB,EACnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAGtE,OAAO,EACH,mBAAmB,EACnB,oBAAoB,GACvB,MAAM,oCAAoC,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,qBAAqB,CAAC;IAC3C;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,oBAAoB,CAAC;CAC1C;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IAClC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;MAEE;IACF,QAAQ,EAAE,OAAO,GAAG,MAAM,CAAC;IAC3B;;OAEG;IACH,aAAa,EAAE,cAAc,CAAC;CACjC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACnC;;;OAGG;IACH,QAAQ,EAAE,cAAc,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,GAAG,CAAE,SA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,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA2B,SAAQ,qBAAqB;IACrE;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACnC;;;OAGG;IACH,QAAQ,EAAE,cAAc,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,OAAO;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,CAAC,CAAC;CACzB;AAED;;GAEG;AACH,oBAAY,cAAc,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC"}
@@ -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 { ITelemetryBaseLogger } from \"@fluidframework/common-definitions\";\nimport {\n IMember,\n IServiceAudience,\n} from \"@fluidframework/fluid-static\";\nimport { ITokenProvider } from \"@fluidframework/routerlicious-driver\";\n\n// Re-export so developers can build loggers without pulling in common-definitions\nexport {\n ITelemetryBaseEvent,\n ITelemetryBaseLogger,\n} from \"@fluidframework/common-definitions\";\n\n/**\n * Props for initializing a new AzureClient instance\n */\nexport interface AzureClientProps {\n /**\n * Configuration for establishing a connection with the Azure Fluid Relay.\n */\n readonly connection: AzureConnectionConfig;\n /**\n * Optional. A logger instance to receive diagnostic messages.\n */\n readonly logger?: ITelemetryBaseLogger;\n}\n\n/**\n * Parameters for establishing a connection with the Azure Fluid Relay.\n */\nexport interface AzureConnectionConfig {\n /**\n * URI to the Azure Fluid Relay orderer endpoint\n */\n orderer: string;\n /**\n * URI to the Azure Fluid Relay storage endpoint\n */\n storage: string;\n /**\n * Unique tenant identifier\n */\n tenantId: \"local\" | string;\n /**\n * Instance that provides Azure Fluid Relay endpoint tokens\n */\n tokenProvider: ITokenProvider;\n}\n\n/**\n * AzureContainerServices is returned by the AzureClient alongside a FluidContainer.\n * It holds the functionality specifically tied to the Azure Fluid Relay, and how the data stored in\n * the 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 use,\n * will not be included here but rather on the FluidContainer class itself.\n */\nexport interface AzureContainerServices {\n /**\n * Provides an object that can be used to get the users that are present in this Fluid session and\n * listeners for when the roster has any changes from users joining/leaving the session\n */\n audience: IAzureAudience;\n}\n\n/**\n * Since Azure provides user names for all of its members, we extend the IMember interface to include\n * this service-specific value. It will be returned for all audience members connected to Azure.\n */\nexport interface AzureMember<T = any> extends IMember {\n userName: string;\n additionalDetails?: T;\n}\n\n/**\n * Audience object for Azure Fluid Relay containers\n */\nexport type IAzureAudience = IServiceAudience<AzureMember>;\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 { ITelemetryBaseLogger } from \"@fluidframework/common-definitions\";\nimport {\n IMember,\n IServiceAudience,\n} from \"@fluidframework/fluid-static\";\nimport { ITokenProvider } from \"@fluidframework/routerlicious-driver\";\n\n// Re-export so developers can build loggers without pulling in common-definitions\nexport {\n ITelemetryBaseEvent,\n ITelemetryBaseLogger,\n} from \"@fluidframework/common-definitions\";\n\n/**\n * Props for initializing a new AzureClient instance\n */\nexport interface AzureClientProps {\n /**\n * Configuration for establishing a connection with the Azure Fluid Relay.\n */\n readonly connection: AzureConnectionConfig;\n /**\n * Optional. A logger instance to receive diagnostic messages.\n */\n readonly logger?: ITelemetryBaseLogger;\n}\n\n/**\n * Container version metadata.\n */\nexport interface AzureContainerVersion {\n /**\n * Version ID\n */\n id: string;\n\n /**\n * Time when version was generated.\n * ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ\n */\n date?: string;\n}\n\n/**\n * Options for \"Get Container Versions\" API.\n */\nexport interface AzureGetVersionsOptions {\n /**\n * Max number of versions\n */\n maxCount: number;\n}\n\n/**\n * The type of connection.\n * - \"local\" for local connections to a Fluid relay instance running on the localhost\n * - \"remote\" for client connections to the Azure Fluid Relay service\n */\nexport type AzureConnectionConfigType = \"local\" | \"remote\";\n\n/**\n * Parameters for establishing a connection with the Azure Fluid Relay.\n */\nexport interface AzureConnectionConfig {\n /**\n * The type of connection. Whether we're connecting to a remote Fluid relay server or a local instance.\n */\n type: AzureConnectionConfigType;\n /**\n * URI to the Azure Fluid Relay service discovery endpoint.\n */\n endpoint: string;\n /**\n * Instance that provides Azure Fluid Relay endpoint tokens.\n */\n tokenProvider: ITokenProvider;\n}\n\n/**\n * Parameters for establishing a remote connection with the Azure Fluid Relay.\n */\nexport interface AzureRemoteConnectionConfig extends AzureConnectionConfig {\n /**\n * The type of connection. Set to a remote connection.\n */\n type: \"remote\";\n /**\n * Unique tenant identifier.\n */\n tenantId: string;\n}\n\n/**\n * Parameters for establishing a local connection with a local instance of the Azure Fluid Relay.\n */\nexport interface AzureLocalConnectionConfig extends AzureConnectionConfig {\n /**\n * The type of connection. Set to a remote connection.\n */\n type: \"local\";\n}\n\n/**\n * AzureContainerServices is returned by the AzureClient alongside a FluidContainer.\n * It holds the functionality specifically tied to the Azure Fluid Relay, and how the data stored in\n * the 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 use,\n * will not be included here but rather on the FluidContainer class itself.\n */\nexport interface AzureContainerServices {\n /**\n * Provides an object that can be used to get the users that are present in this Fluid session and\n * listeners for when the roster has any changes from users joining/leaving the session\n */\n audience: IAzureAudience;\n}\n\n/**\n * Since Azure provides user names for all of its members, we extend the IMember interface to include\n * this service-specific value. It will be returned for all audience members connected to Azure.\n */\nexport interface AzureMember<T = any> extends IMember {\n userName: string;\n additionalDetails?: T;\n}\n\n/**\n * Audience object for Azure Fluid Relay containers\n */\nexport type IAzureAudience = IServiceAudience<AzureMember>;\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/azure-client";
8
- export declare const pkgVersion = "0.59.3000";
8
+ export declare const pkgVersion = "1.0.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,iCAAiC,CAAC;AACtD,eAAO,MAAM,UAAU,cAAc,CAAC"}
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,iCAAiC,CAAC;AACtD,eAAO,MAAM,UAAU,UAAU,CAAC"}
@@ -8,5 +8,5 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.pkgVersion = exports.pkgName = void 0;
10
10
  exports.pkgName = "@fluidframework/azure-client";
11
- exports.pkgVersion = "0.59.3000";
11
+ exports.pkgVersion = "1.0.0";
12
12
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,8BAA8B,CAAC;AACzC,QAAA,UAAU,GAAG,WAAW,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/azure-client\";\nexport const pkgVersion = \"0.59.3000\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,8BAA8B,CAAC;AACzC,QAAA,UAAU,GAAG,OAAO,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/azure-client\";\nexport const pkgVersion = \"1.0.0\";\n"]}
@@ -0,0 +1,14 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { AzureRemoteConnectionConfig, AzureLocalConnectionConfig, AzureConnectionConfig } from "./interfaces";
6
+ /**
7
+ * Type guard for validating a given AzureConnectionConfig is a remote connection type (AzureRemoteConnectionConfig)
8
+ */
9
+ export declare function isAzureRemoteConnectionConfig(connectionConfig: AzureConnectionConfig): connectionConfig is AzureRemoteConnectionConfig;
10
+ /**
11
+ * Type guard for validating a given AzureConnectionConfig is a local connection type (AzureLocalConnectionConfig)
12
+ */
13
+ export declare function isAzureLocalConnectionConfig(connectionConfig: AzureConnectionConfig): connectionConfig is AzureLocalConnectionConfig;
14
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,2BAA2B,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE9G;;GAEG;AACH,wBAAgB,6BAA6B,CACzC,gBAAgB,EAAE,qBAAqB,GAAG,gBAAgB,IAAI,2BAA2B,CAE5F;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CACxC,gBAAgB,EAAE,qBAAqB,GAAG,gBAAgB,IAAI,0BAA0B,CAE3F"}
package/dist/utils.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isAzureLocalConnectionConfig = exports.isAzureRemoteConnectionConfig = void 0;
4
+ /**
5
+ * Type guard for validating a given AzureConnectionConfig is a remote connection type (AzureRemoteConnectionConfig)
6
+ */
7
+ function isAzureRemoteConnectionConfig(connectionConfig) {
8
+ return connectionConfig.type === "remote";
9
+ }
10
+ exports.isAzureRemoteConnectionConfig = isAzureRemoteConnectionConfig;
11
+ /**
12
+ * Type guard for validating a given AzureConnectionConfig is a local connection type (AzureLocalConnectionConfig)
13
+ */
14
+ function isAzureLocalConnectionConfig(connectionConfig) {
15
+ return connectionConfig.type === "local";
16
+ }
17
+ exports.isAzureLocalConnectionConfig = isAzureLocalConnectionConfig;
18
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAMA;;GAEG;AACH,SAAgB,6BAA6B,CACzC,gBAAuC;IACvC,OAAO,gBAAgB,CAAC,IAAI,KAAK,QAAQ,CAAC;AAC9C,CAAC;AAHD,sEAGC;AAED;;GAEG;AACH,SAAgB,4BAA4B,CACxC,gBAAuC;IACvC,OAAO,gBAAgB,CAAC,IAAI,KAAK,OAAO,CAAC;AAC7C,CAAC;AAHD,oEAGC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { AzureRemoteConnectionConfig, AzureLocalConnectionConfig, AzureConnectionConfig } from \"./interfaces\";\n\n/**\n * Type guard for validating a given AzureConnectionConfig is a remote connection type (AzureRemoteConnectionConfig)\n */\nexport function isAzureRemoteConnectionConfig(\n connectionConfig: AzureConnectionConfig): connectionConfig is AzureRemoteConnectionConfig {\n return connectionConfig.type === \"remote\";\n}\n\n/**\n * Type guard for validating a given AzureConnectionConfig is a local connection type (AzureLocalConnectionConfig)\n */\nexport function isAzureLocalConnectionConfig(\n connectionConfig: AzureConnectionConfig): connectionConfig is AzureLocalConnectionConfig {\n return connectionConfig.type === \"local\";\n}\n"]}