@fluidframework/azure-service-utils 2.0.0-rc.2.0.2 → 2.0.0-rc.3.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @fluidframework/azure-service-utils
2
2
 
3
+ ## 2.0.0-rc.3.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - Packages now use package.json "exports" and require modern module resolution [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
8
+
9
+ Fluid Framework packages have been updated to use the [package.json "exports"
10
+ field](https://nodejs.org/docs/latest-v18.x/api/packages.html#exports) to define explicit entry points for both
11
+ TypeScript types and implementation code.
12
+
13
+ This means that using Fluid Framework packages require the following TypeScript settings in tsconfig.json:
14
+
15
+ - `"moduleResolution": "Node16"` with `"module": "Node16"`
16
+ - `"moduleResolution": "Bundler"` with `"module": "ESNext"`
17
+
18
+ We recommend using Node16/Node16 unless absolutely necessary. That will produce transpiled JavaScript that is suitable
19
+ for use with modern versions of Node.js _and_ Bundlers.
20
+ [See the TypeScript documentation](https://www.typescriptlang.org/tsconfig#moduleResolution) for more information
21
+ regarding the module and moduleResolution options.
22
+
23
+ **Node10 moduleResolution is not supported; it does not support Fluid Framework's API structuring pattern that is used
24
+ to distinguish stable APIs from those that are in development.**
25
+
3
26
  ## 2.0.0-rc.2.0.0
4
27
 
5
28
  Dependency updates only.
@@ -1,3 +1,7 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
1
5
  import type { IUser, ScopeType } from "@fluidframework/protocol-definitions";
2
6
  /**
3
7
  * IMPORTANT: This function is duplicated in ./packages/runtime/test-runtime-utils/src/generateToken.ts. There is no
@@ -1 +1 @@
1
- {"version":3,"file":"generateToken.d.ts","sourceRoot":"","sources":["../src/generateToken.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAgB,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAE3F;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,aAAa,CAC5B,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,SAAS,EAAE,EACnB,UAAU,CAAC,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,KAAK,EACZ,QAAQ,GAAE,MAAgB,EAG1B,GAAG,GAAE,MAAc,GACjB,MAAM,CA8BR;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,KAAK,CAOpC"}
1
+ {"version":3,"file":"generateToken.d.ts","sourceRoot":"","sources":["../src/generateToken.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAgB,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAI3F;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,aAAa,CAC5B,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,SAAS,EAAE,EACnB,UAAU,CAAC,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,KAAK,EACZ,QAAQ,GAAE,MAAgB,EAG1B,GAAG,GAAE,MAAc,GACjB,MAAM,CA8BR;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,KAAK,CAOpC"}
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateUser = exports.generateToken = void 0;
4
2
  /*!
5
3
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
6
4
  * Licensed under the MIT License.
7
5
  */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.generateUser = exports.generateToken = void 0;
8
8
  const jsrsasign_1 = require("jsrsasign");
9
9
  const uuid_1 = require("uuid");
10
10
  /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C3B,MAAM,UAAU,GAAG;QAClB,EAAE,EAAE,IAAA,SAAI,GAAE;QACV,IAAI,EAAE,IAAA,SAAI,GAAE;KACZ,CAAC;IAEF,OAAO,UAAU,CAAC;AACnB,CAAC;AAPD,oCAOC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { KJUR as jsrsasign } from \"jsrsasign\";\nimport { v4 as uuid } from \"uuid\";\n\nimport type { ITokenClaims, IUser, ScopeType } from \"@fluidframework/protocol-definitions\";\n\n/**\n * IMPORTANT: This function is duplicated in ./packages/runtime/test-runtime-utils/src/generateToken.ts. There is no\n * need for different implementations, so they should be kept in sync if changes are needed.\n *\n * The reason they are duplicated is because we don't want the core Fluid libraries depending on the Azure libraries\n * (enforced by layer-check), but both need to expose this function. The test-runtime-utils library is a test lib, which\n * layer-check (correctly) reuires only be used as a dev dependency. But in the azure case, we want the function\n * exported, so it needs to be sourced from either the package itself or a non-dev dependency.\n *\n * The previous solution to this was to import the function from azure-service-utils into test-runtime-utils, but that\n * no longer works because the azure packages are in a separate release group.\n *\n * If a token needs to be generated on the client side, you should re-use this function. If you need service-side token\n * generation, you should use the function available in the server-services-client package in order to avoid\n * interdependencies between service and client packages.\n */\n\n/**\n * Generates a {@link https://en.wikipedia.org/wiki/JSON_Web_Token | JSON Web Token} (JWT)\n * to authorize access to a Routerlicious-based Fluid service.\n *\n * @remarks Note: this function uses a browser friendly auth library\n * ({@link https://www.npmjs.com/package/jsrsasign | jsrsasign}) and may only be used in client (browser) context.\n * It is **not** Node.js-compatible.\n *\n * @param tenantId - See {@link @fluidframework/protocol-definitions#ITokenClaims.tenantId}\n * @param key - API key to authenticate user. Must be {@link https://en.wikipedia.org/wiki/UTF-8 | UTF-8}-encoded.\n * @param scopes - See {@link @fluidframework/protocol-definitions#ITokenClaims.scopes}\n * @param documentId - See {@link @fluidframework/protocol-definitions#ITokenClaims.documentId}.\n * If not specified, the token will not be associated with a document, and an empty string will be used.\n * @param user - User with whom generated tokens will be associated.\n * If not specified, the token will not be associated with a user, and a randomly generated mock user will be\n * used instead.\n * See {@link @fluidframework/protocol-definitions#ITokenClaims.user}\n * @param lifetime - Used to generate the {@link @fluidframework/protocol-definitions#ITokenClaims.exp | expiration}.\n * Expiration = now + lifetime.\n * Expressed in seconds.\n * Default: 3600 (1 hour).\n * @param ver - See {@link @fluidframework/protocol-definitions#ITokenClaims.ver}.\n * Default: `1.0`.\n *\n * @alpha\n */\nexport function generateToken(\n\ttenantId: string,\n\tkey: string,\n\tscopes: ScopeType[],\n\tdocumentId?: string,\n\tuser?: IUser,\n\tlifetime: number = 60 * 60,\n\t// Naming intended to match `ITokenClaims.ver`\n\t// eslint-disable-next-line unicorn/prevent-abbreviations\n\tver: string = \"1.0\",\n): string {\n\tlet userClaim = user ?? generateUser();\n\tif (userClaim.id === \"\" || userClaim.id === undefined) {\n\t\tuserClaim = generateUser();\n\t}\n\n\t// Current time in seconds\n\tconst now = Math.round(Date.now() / 1000);\n\n\tconst claims: ITokenClaims & { jti: string } = {\n\t\tdocumentId: documentId ?? \"\",\n\t\tscopes,\n\t\ttenantId,\n\t\tuser: userClaim,\n\t\tiat: now,\n\t\texp: now + lifetime,\n\t\tver,\n\t\tjti: uuid(),\n\t};\n\n\tconst utf8Key = { utf8: key };\n\n\treturn jsrsasign.jws.JWS.sign(\n\t\t// External API uses null\n\t\t// eslint-disable-next-line unicorn/no-null\n\t\tnull,\n\t\tJSON.stringify({ alg: \"HS256\", typ: \"JWT\" }),\n\t\tclaims,\n\t\tutf8Key,\n\t);\n}\n\n/**\n * Generates an arbitrary (\"random\") {@link @fluidframework/protocol-definitions#IUser} by generating a\n * random UUID for its {@link @fluidframework/protocol-definitions#IUser.id} and `name` properties.\n */\nexport function generateUser(): IUser {\n\tconst randomUser = {\n\t\tid: uuid(),\n\t\tname: uuid(),\n\t};\n\n\treturn randomUser;\n}\n"]}
1
+ {"version":3,"file":"generateToken.js","sourceRoot":"","sources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AAE;QACV,IAAI,EAAE,IAAA,SAAI,GAAE;KACZ,CAAC;IAEF,OAAO,UAAU,CAAC;AACnB,CAAC;AAPD,oCAOC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITokenClaims, IUser, ScopeType } from \"@fluidframework/protocol-definitions\";\nimport { KJUR as jsrsasign } from \"jsrsasign\";\nimport { v4 as uuid } from \"uuid\";\n\n/**\n * IMPORTANT: This function is duplicated in ./packages/runtime/test-runtime-utils/src/generateToken.ts. There is no\n * need for different implementations, so they should be kept in sync if changes are needed.\n *\n * The reason they are duplicated is because we don't want the core Fluid libraries depending on the Azure libraries\n * (enforced by layer-check), but both need to expose this function. The test-runtime-utils library is a test lib, which\n * layer-check (correctly) reuires only be used as a dev dependency. But in the azure case, we want the function\n * exported, so it needs to be sourced from either the package itself or a non-dev dependency.\n *\n * The previous solution to this was to import the function from azure-service-utils into test-runtime-utils, but that\n * no longer works because the azure packages are in a separate release group.\n *\n * If a token needs to be generated on the client side, you should re-use this function. If you need service-side token\n * generation, you should use the function available in the server-services-client package in order to avoid\n * interdependencies between service and client packages.\n */\n\n/**\n * Generates a {@link https://en.wikipedia.org/wiki/JSON_Web_Token | JSON Web Token} (JWT)\n * to authorize access to a Routerlicious-based Fluid service.\n *\n * @remarks Note: this function uses a browser friendly auth library\n * ({@link https://www.npmjs.com/package/jsrsasign | jsrsasign}) and may only be used in client (browser) context.\n * It is **not** Node.js-compatible.\n *\n * @param tenantId - See {@link @fluidframework/protocol-definitions#ITokenClaims.tenantId}\n * @param key - API key to authenticate user. Must be {@link https://en.wikipedia.org/wiki/UTF-8 | UTF-8}-encoded.\n * @param scopes - See {@link @fluidframework/protocol-definitions#ITokenClaims.scopes}\n * @param documentId - See {@link @fluidframework/protocol-definitions#ITokenClaims.documentId}.\n * If not specified, the token will not be associated with a document, and an empty string will be used.\n * @param user - User with whom generated tokens will be associated.\n * If not specified, the token will not be associated with a user, and a randomly generated mock user will be\n * used instead.\n * See {@link @fluidframework/protocol-definitions#ITokenClaims.user}\n * @param lifetime - Used to generate the {@link @fluidframework/protocol-definitions#ITokenClaims.exp | expiration}.\n * Expiration = now + lifetime.\n * Expressed in seconds.\n * Default: 3600 (1 hour).\n * @param ver - See {@link @fluidframework/protocol-definitions#ITokenClaims.ver}.\n * Default: `1.0`.\n *\n * @alpha\n */\nexport function generateToken(\n\ttenantId: string,\n\tkey: string,\n\tscopes: ScopeType[],\n\tdocumentId?: string,\n\tuser?: IUser,\n\tlifetime: number = 60 * 60,\n\t// Naming intended to match `ITokenClaims.ver`\n\t// eslint-disable-next-line unicorn/prevent-abbreviations\n\tver: string = \"1.0\",\n): string {\n\tlet userClaim = user ?? generateUser();\n\tif (userClaim.id === \"\" || userClaim.id === undefined) {\n\t\tuserClaim = generateUser();\n\t}\n\n\t// Current time in seconds\n\tconst now = Math.round(Date.now() / 1000);\n\n\tconst claims: ITokenClaims & { jti: string } = {\n\t\tdocumentId: documentId ?? \"\",\n\t\tscopes,\n\t\ttenantId,\n\t\tuser: userClaim,\n\t\tiat: now,\n\t\texp: now + lifetime,\n\t\tver,\n\t\tjti: uuid(),\n\t};\n\n\tconst utf8Key = { utf8: key };\n\n\treturn jsrsasign.jws.JWS.sign(\n\t\t// External API uses null\n\t\t// eslint-disable-next-line unicorn/no-null\n\t\tnull,\n\t\tJSON.stringify({ alg: \"HS256\", typ: \"JWT\" }),\n\t\tclaims,\n\t\tutf8Key,\n\t);\n}\n\n/**\n * Generates an arbitrary (\"random\") {@link @fluidframework/protocol-definitions#IUser} by generating a\n * random UUID for its {@link @fluidframework/protocol-definitions#IUser.id} and `name` properties.\n */\nexport function generateUser(): IUser {\n\tconst randomUser = {\n\t\tid: uuid(),\n\t\tname: uuid(),\n\t};\n\n\treturn randomUser;\n}\n"]}
@@ -0,0 +1,18 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ /*
7
+ * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
8
+ * Generated by "flub generate entrypoints" in @fluidframework/build-tools.
9
+ */
10
+
11
+ export {
12
+ // public APIs
13
+ IUser,
14
+
15
+ // alpha APIs
16
+ ScopeType,
17
+ generateToken
18
+ } from "./index.js";
@@ -0,0 +1,14 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ /*
7
+ * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
8
+ * Generated by "flub generate entrypoints" in @fluidframework/build-tools.
9
+ */
10
+
11
+ export {
12
+ // public APIs
13
+ IUser
14
+ } from "./index.js";
package/internal.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ /*
7
+ * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
8
+ * Generated by "flub generate entrypoints" in @fluidframework/build-tools.
9
+ */
10
+
11
+ export * from "./lib/index.js";
package/legacy.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ /*
7
+ * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
8
+ * Generated by "flub generate entrypoints" in @fluidframework/build-tools.
9
+ */
10
+
11
+ export * from "./lib/legacy.js";
@@ -1,3 +1,7 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
1
5
  import type { IUser, ScopeType } from "@fluidframework/protocol-definitions";
2
6
  /**
3
7
  * IMPORTANT: This function is duplicated in ./packages/runtime/test-runtime-utils/src/generateToken.ts. There is no
@@ -1 +1 @@
1
- {"version":3,"file":"generateToken.d.ts","sourceRoot":"","sources":["../src/generateToken.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAgB,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAE3F;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,aAAa,CAC5B,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,SAAS,EAAE,EACnB,UAAU,CAAC,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,KAAK,EACZ,QAAQ,GAAE,MAAgB,EAG1B,GAAG,GAAE,MAAc,GACjB,MAAM,CA8BR;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,KAAK,CAOpC"}
1
+ {"version":3,"file":"generateToken.d.ts","sourceRoot":"","sources":["../src/generateToken.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAgB,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAI3F;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,aAAa,CAC5B,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,SAAS,EAAE,EACnB,UAAU,CAAC,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,KAAK,EACZ,QAAQ,GAAE,MAAgB,EAG1B,GAAG,GAAE,MAAc,GACjB,MAAM,CA8BR;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,KAAK,CAOpC"}
@@ -1 +1 @@
1
- {"version":3,"file":"generateToken.js","sourceRoot":"","sources":["../src/generateToken.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CA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/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { KJUR as jsrsasign } from \"jsrsasign\";\nimport { v4 as uuid } from \"uuid\";\n\nimport type { ITokenClaims, IUser, ScopeType } from \"@fluidframework/protocol-definitions\";\n\n/**\n * IMPORTANT: This function is duplicated in ./packages/runtime/test-runtime-utils/src/generateToken.ts. There is no\n * need for different implementations, so they should be kept in sync if changes are needed.\n *\n * The reason they are duplicated is because we don't want the core Fluid libraries depending on the Azure libraries\n * (enforced by layer-check), but both need to expose this function. The test-runtime-utils library is a test lib, which\n * layer-check (correctly) reuires only be used as a dev dependency. But in the azure case, we want the function\n * exported, so it needs to be sourced from either the package itself or a non-dev dependency.\n *\n * The previous solution to this was to import the function from azure-service-utils into test-runtime-utils, but that\n * no longer works because the azure packages are in a separate release group.\n *\n * If a token needs to be generated on the client side, you should re-use this function. If you need service-side token\n * generation, you should use the function available in the server-services-client package in order to avoid\n * interdependencies between service and client packages.\n */\n\n/**\n * Generates a {@link https://en.wikipedia.org/wiki/JSON_Web_Token | JSON Web Token} (JWT)\n * to authorize access to a Routerlicious-based Fluid service.\n *\n * @remarks Note: this function uses a browser friendly auth library\n * ({@link https://www.npmjs.com/package/jsrsasign | jsrsasign}) and may only be used in client (browser) context.\n * It is **not** Node.js-compatible.\n *\n * @param tenantId - See {@link @fluidframework/protocol-definitions#ITokenClaims.tenantId}\n * @param key - API key to authenticate user. Must be {@link https://en.wikipedia.org/wiki/UTF-8 | UTF-8}-encoded.\n * @param scopes - See {@link @fluidframework/protocol-definitions#ITokenClaims.scopes}\n * @param documentId - See {@link @fluidframework/protocol-definitions#ITokenClaims.documentId}.\n * If not specified, the token will not be associated with a document, and an empty string will be used.\n * @param user - User with whom generated tokens will be associated.\n * If not specified, the token will not be associated with a user, and a randomly generated mock user will be\n * used instead.\n * See {@link @fluidframework/protocol-definitions#ITokenClaims.user}\n * @param lifetime - Used to generate the {@link @fluidframework/protocol-definitions#ITokenClaims.exp | expiration}.\n * Expiration = now + lifetime.\n * Expressed in seconds.\n * Default: 3600 (1 hour).\n * @param ver - See {@link @fluidframework/protocol-definitions#ITokenClaims.ver}.\n * Default: `1.0`.\n *\n * @alpha\n */\nexport function generateToken(\n\ttenantId: string,\n\tkey: string,\n\tscopes: ScopeType[],\n\tdocumentId?: string,\n\tuser?: IUser,\n\tlifetime: number = 60 * 60,\n\t// Naming intended to match `ITokenClaims.ver`\n\t// eslint-disable-next-line unicorn/prevent-abbreviations\n\tver: string = \"1.0\",\n): string {\n\tlet userClaim = user ?? generateUser();\n\tif (userClaim.id === \"\" || userClaim.id === undefined) {\n\t\tuserClaim = generateUser();\n\t}\n\n\t// Current time in seconds\n\tconst now = Math.round(Date.now() / 1000);\n\n\tconst claims: ITokenClaims & { jti: string } = {\n\t\tdocumentId: documentId ?? \"\",\n\t\tscopes,\n\t\ttenantId,\n\t\tuser: userClaim,\n\t\tiat: now,\n\t\texp: now + lifetime,\n\t\tver,\n\t\tjti: uuid(),\n\t};\n\n\tconst utf8Key = { utf8: key };\n\n\treturn jsrsasign.jws.JWS.sign(\n\t\t// External API uses null\n\t\t// eslint-disable-next-line unicorn/no-null\n\t\tnull,\n\t\tJSON.stringify({ alg: \"HS256\", typ: \"JWT\" }),\n\t\tclaims,\n\t\tutf8Key,\n\t);\n}\n\n/**\n * Generates an arbitrary (\"random\") {@link @fluidframework/protocol-definitions#IUser} by generating a\n * random UUID for its {@link @fluidframework/protocol-definitions#IUser.id} and `name` properties.\n */\nexport function generateUser(): IUser {\n\tconst randomUser = {\n\t\tid: uuid(),\n\t\tname: uuid(),\n\t};\n\n\treturn randomUser;\n}\n"]}
1
+ {"version":3,"file":"generateToken.js","sourceRoot":"","sources":["../src/generateToken.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC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\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITokenClaims, IUser, ScopeType } from \"@fluidframework/protocol-definitions\";\nimport { KJUR as jsrsasign } from \"jsrsasign\";\nimport { v4 as uuid } from \"uuid\";\n\n/**\n * IMPORTANT: This function is duplicated in ./packages/runtime/test-runtime-utils/src/generateToken.ts. There is no\n * need for different implementations, so they should be kept in sync if changes are needed.\n *\n * The reason they are duplicated is because we don't want the core Fluid libraries depending on the Azure libraries\n * (enforced by layer-check), but both need to expose this function. The test-runtime-utils library is a test lib, which\n * layer-check (correctly) reuires only be used as a dev dependency. But in the azure case, we want the function\n * exported, so it needs to be sourced from either the package itself or a non-dev dependency.\n *\n * The previous solution to this was to import the function from azure-service-utils into test-runtime-utils, but that\n * no longer works because the azure packages are in a separate release group.\n *\n * If a token needs to be generated on the client side, you should re-use this function. If you need service-side token\n * generation, you should use the function available in the server-services-client package in order to avoid\n * interdependencies between service and client packages.\n */\n\n/**\n * Generates a {@link https://en.wikipedia.org/wiki/JSON_Web_Token | JSON Web Token} (JWT)\n * to authorize access to a Routerlicious-based Fluid service.\n *\n * @remarks Note: this function uses a browser friendly auth library\n * ({@link https://www.npmjs.com/package/jsrsasign | jsrsasign}) and may only be used in client (browser) context.\n * It is **not** Node.js-compatible.\n *\n * @param tenantId - See {@link @fluidframework/protocol-definitions#ITokenClaims.tenantId}\n * @param key - API key to authenticate user. Must be {@link https://en.wikipedia.org/wiki/UTF-8 | UTF-8}-encoded.\n * @param scopes - See {@link @fluidframework/protocol-definitions#ITokenClaims.scopes}\n * @param documentId - See {@link @fluidframework/protocol-definitions#ITokenClaims.documentId}.\n * If not specified, the token will not be associated with a document, and an empty string will be used.\n * @param user - User with whom generated tokens will be associated.\n * If not specified, the token will not be associated with a user, and a randomly generated mock user will be\n * used instead.\n * See {@link @fluidframework/protocol-definitions#ITokenClaims.user}\n * @param lifetime - Used to generate the {@link @fluidframework/protocol-definitions#ITokenClaims.exp | expiration}.\n * Expiration = now + lifetime.\n * Expressed in seconds.\n * Default: 3600 (1 hour).\n * @param ver - See {@link @fluidframework/protocol-definitions#ITokenClaims.ver}.\n * Default: `1.0`.\n *\n * @alpha\n */\nexport function generateToken(\n\ttenantId: string,\n\tkey: string,\n\tscopes: ScopeType[],\n\tdocumentId?: string,\n\tuser?: IUser,\n\tlifetime: number = 60 * 60,\n\t// Naming intended to match `ITokenClaims.ver`\n\t// eslint-disable-next-line unicorn/prevent-abbreviations\n\tver: string = \"1.0\",\n): string {\n\tlet userClaim = user ?? generateUser();\n\tif (userClaim.id === \"\" || userClaim.id === undefined) {\n\t\tuserClaim = generateUser();\n\t}\n\n\t// Current time in seconds\n\tconst now = Math.round(Date.now() / 1000);\n\n\tconst claims: ITokenClaims & { jti: string } = {\n\t\tdocumentId: documentId ?? \"\",\n\t\tscopes,\n\t\ttenantId,\n\t\tuser: userClaim,\n\t\tiat: now,\n\t\texp: now + lifetime,\n\t\tver,\n\t\tjti: uuid(),\n\t};\n\n\tconst utf8Key = { utf8: key };\n\n\treturn jsrsasign.jws.JWS.sign(\n\t\t// External API uses null\n\t\t// eslint-disable-next-line unicorn/no-null\n\t\tnull,\n\t\tJSON.stringify({ alg: \"HS256\", typ: \"JWT\" }),\n\t\tclaims,\n\t\tutf8Key,\n\t);\n}\n\n/**\n * Generates an arbitrary (\"random\") {@link @fluidframework/protocol-definitions#IUser} by generating a\n * random UUID for its {@link @fluidframework/protocol-definitions#IUser.id} and `name` properties.\n */\nexport function generateUser(): IUser {\n\tconst randomUser = {\n\t\tid: uuid(),\n\t\tname: uuid(),\n\t};\n\n\treturn randomUser;\n}\n"]}
@@ -0,0 +1,18 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ /*
7
+ * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
8
+ * Generated by "flub generate entrypoints" in @fluidframework/build-tools.
9
+ */
10
+
11
+ export {
12
+ // public APIs
13
+ IUser,
14
+
15
+ // alpha APIs
16
+ ScopeType,
17
+ generateToken
18
+ } from "./index.js";
@@ -0,0 +1,14 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ /*
7
+ * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
8
+ * Generated by "flub generate entrypoints" in @fluidframework/build-tools.
9
+ */
10
+
11
+ export {
12
+ // public APIs
13
+ IUser
14
+ } from "./index.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/azure-service-utils",
3
- "version": "2.0.0-rc.2.0.2",
3
+ "version": "2.0.0-rc.3.0.0",
4
4
  "description": "Helper service-side utilities for connecting to Azure Fluid Relay service",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -15,21 +15,21 @@
15
15
  "exports": {
16
16
  ".": {
17
17
  "import": {
18
- "types": "./lib/azure-service-utils-public.d.ts",
18
+ "types": "./lib/public.d.ts",
19
19
  "default": "./lib/index.js"
20
20
  },
21
21
  "require": {
22
- "types": "./dist/azure-service-utils-public.d.ts",
22
+ "types": "./dist/public.d.ts",
23
23
  "default": "./dist/index.js"
24
24
  }
25
25
  },
26
- "./alpha": {
26
+ "./legacy": {
27
27
  "import": {
28
- "types": "./lib/azure-service-utils-alpha.d.ts",
28
+ "types": "./lib/legacy.d.ts",
29
29
  "default": "./lib/index.js"
30
30
  },
31
31
  "require": {
32
- "types": "./dist/azure-service-utils-alpha.d.ts",
32
+ "types": "./dist/legacy.d.ts",
33
33
  "default": "./dist/index.js"
34
34
  }
35
35
  },
@@ -44,20 +44,21 @@
44
44
  }
45
45
  }
46
46
  },
47
- "main": "./dist/index.js",
48
- "types": "./dist/azure-service-utils-public.d.ts",
47
+ "main": "lib/index.js",
48
+ "types": "lib/public.d.ts",
49
49
  "dependencies": {
50
50
  "@fluidframework/protocol-definitions": "^3.2.0",
51
51
  "jsrsasign": "^11.0.0",
52
52
  "uuid": "^9.0.0"
53
53
  },
54
54
  "devDependencies": {
55
- "@arethetypeswrong/cli": "^0.13.3",
56
- "@fluid-tools/build-cli": "^0.34.0",
55
+ "@arethetypeswrong/cli": "^0.15.2",
56
+ "@biomejs/biome": "^1.6.2",
57
+ "@fluid-tools/build-cli": "^0.37.0",
57
58
  "@fluidframework/azure-service-utils-previous": "npm:@fluidframework/azure-service-utils@2.0.0-internal.8.0.0",
58
59
  "@fluidframework/build-common": "^2.0.3",
59
- "@fluidframework/build-tools": "^0.34.0",
60
- "@fluidframework/eslint-config-fluid": "^4.0.0",
60
+ "@fluidframework/build-tools": "^0.37.0",
61
+ "@fluidframework/eslint-config-fluid": "^5.1.0",
61
62
  "@microsoft/api-extractor": "^7.42.3",
62
63
  "@types/jsrsasign": "^10.5.12",
63
64
  "@types/uuid": "^9.0.2",
@@ -68,44 +69,32 @@
68
69
  "rimraf": "^4.4.0",
69
70
  "typescript": "~5.1.6"
70
71
  },
71
- "fluidBuild": {
72
- "tasks": {
73
- "build:docs": {
74
- "dependsOn": [
75
- "...",
76
- "api-extractor:commonjs",
77
- "api-extractor:esnext"
78
- ],
79
- "script": false
80
- }
81
- }
82
- },
83
72
  "typeValidation": {
84
73
  "broken": {}
85
74
  },
86
75
  "scripts": {
87
76
  "api": "fluid-build . --task api",
88
- "api-extractor:commonjs": "api-extractor run --config ./api-extractor-cjs.json",
89
- "api-extractor:esnext": "api-extractor run --local",
77
+ "api-extractor:commonjs": "flub generate entrypoints --outFileAlpha legacy --outDir ./dist",
78
+ "api-extractor:esnext": "flub generate entrypoints --outFileAlpha legacy --outDir ./lib --node10TypeCompat",
90
79
  "build": "fluid-build . --task build",
91
80
  "build:commonjs": "fluid-build . --task commonjs",
92
81
  "build:compile": "fluid-build . --task compile",
93
- "build:docs": "fluid-build . --task api",
82
+ "build:docs": "api-extractor run --local",
94
83
  "build:esnext": "tsc --project ./tsconfig.json",
95
- "build:test": "npm run build:test:cjs && npm run build:test:esm",
84
+ "build:test": "npm run build:test:esm && npm run build:test:cjs",
96
85
  "build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
97
86
  "build:test:esm": "tsc --project ./src/test/tsconfig.json",
98
- "check:are-the-types-wrong": "attw --pack . --entrypoints .",
87
+ "check:are-the-types-wrong": "attw --pack .",
88
+ "check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
99
89
  "check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
100
90
  "ci:build:docs": "api-extractor run",
101
- "clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp",
91
+ "clean": "rimraf --glob dist lib \"*.d.ts\" \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp",
102
92
  "eslint": "eslint --format stylish src",
103
93
  "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
104
- "format": "npm run prettier:fix",
105
- "lint": "npm run prettier && npm run check:release-tags && npm run eslint",
106
- "lint:fix": "npm run prettier:fix && npm run eslint:fix",
107
- "prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
108
- "prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
94
+ "format": "fluid-build --task format .",
95
+ "format:prettier": "prettier --write . --cache --ignore-path ../../../.prettierignore",
96
+ "lint": "fluid-build . --task lint",
97
+ "lint:fix": "fluid-build . --task eslint:fix --task format",
109
98
  "test": "echo \"Error: no test specified\" && exit 1",
110
99
  "tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
111
100
  "typetests:gen": "fluid-type-test-generator",
@@ -2,10 +2,10 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { KJUR as jsrsasign } from "jsrsasign";
6
- import { v4 as uuid } from "uuid";
7
5
 
8
6
  import type { ITokenClaims, IUser, ScopeType } from "@fluidframework/protocol-definitions";
7
+ import { KJUR as jsrsasign } from "jsrsasign";
8
+ import { v4 as uuid } from "uuid";
9
9
 
10
10
  /**
11
11
  * IMPORTANT: This function is duplicated in ./packages/runtime/test-runtime-utils/src/generateToken.ts. There is no
@@ -1,8 +0,0 @@
1
- {
2
- "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "../../../common/build/build-common/api-extractor-base.cjs.primary.json",
4
- // CJS is actually secondary; so, no report.
5
- "apiReport": {
6
- "enabled": false
7
- }
8
- }
@@ -1,4 +0,0 @@
1
- {
2
- "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "../../../common/build/build-common/api-extractor-base-esm.json"
4
- }
@@ -1,64 +0,0 @@
1
- /**
2
- * A set of helper utilities for building backend APIs for use with
3
- * {@link https://docs.microsoft.com/en-us/azure/azure-fluid-relay/overview/overview | Azure Fluid Relay}.
4
- *
5
- * @remarks
6
- * Note that this library's primary entry-point ({@link generateToken}) is only intended
7
- * to be run in a browser context.
8
- * It is **not** Node.js-compatible.
9
- *
10
- * @packageDocumentation
11
- */
12
-
13
- import { IUser } from '@fluidframework/protocol-definitions';
14
- import { ScopeType } from '@fluidframework/protocol-definitions';
15
-
16
- /**
17
- * IMPORTANT: This function is duplicated in ./packages/runtime/test-runtime-utils/src/generateToken.ts. There is no
18
- * need for different implementations, so they should be kept in sync if changes are needed.
19
- *
20
- * The reason they are duplicated is because we don't want the core Fluid libraries depending on the Azure libraries
21
- * (enforced by layer-check), but both need to expose this function. The test-runtime-utils library is a test lib, which
22
- * layer-check (correctly) reuires only be used as a dev dependency. But in the azure case, we want the function
23
- * exported, so it needs to be sourced from either the package itself or a non-dev dependency.
24
- *
25
- * The previous solution to this was to import the function from azure-service-utils into test-runtime-utils, but that
26
- * no longer works because the azure packages are in a separate release group.
27
- *
28
- * If a token needs to be generated on the client side, you should re-use this function. If you need service-side token
29
- * generation, you should use the function available in the server-services-client package in order to avoid
30
- * interdependencies between service and client packages.
31
- */
32
- /**
33
- * Generates a {@link https://en.wikipedia.org/wiki/JSON_Web_Token | JSON Web Token} (JWT)
34
- * to authorize access to a Routerlicious-based Fluid service.
35
- *
36
- * @remarks Note: this function uses a browser friendly auth library
37
- * ({@link https://www.npmjs.com/package/jsrsasign | jsrsasign}) and may only be used in client (browser) context.
38
- * It is **not** Node.js-compatible.
39
- *
40
- * @param tenantId - See {@link @fluidframework/protocol-definitions#ITokenClaims.tenantId}
41
- * @param key - API key to authenticate user. Must be {@link https://en.wikipedia.org/wiki/UTF-8 | UTF-8}-encoded.
42
- * @param scopes - See {@link @fluidframework/protocol-definitions#ITokenClaims.scopes}
43
- * @param documentId - See {@link @fluidframework/protocol-definitions#ITokenClaims.documentId}.
44
- * If not specified, the token will not be associated with a document, and an empty string will be used.
45
- * @param user - User with whom generated tokens will be associated.
46
- * If not specified, the token will not be associated with a user, and a randomly generated mock user will be
47
- * used instead.
48
- * See {@link @fluidframework/protocol-definitions#ITokenClaims.user}
49
- * @param lifetime - Used to generate the {@link @fluidframework/protocol-definitions#ITokenClaims.exp | expiration}.
50
- * Expiration = now + lifetime.
51
- * Expressed in seconds.
52
- * Default: 3600 (1 hour).
53
- * @param ver - See {@link @fluidframework/protocol-definitions#ITokenClaims.ver}.
54
- * Default: `1.0`.
55
- *
56
- * @alpha
57
- */
58
- export declare function generateToken(tenantId: string, key: string, scopes: ScopeType[], documentId?: string, user?: IUser, lifetime?: number, ver?: string): string;
59
-
60
- export { IUser }
61
-
62
- export { ScopeType }
63
-
64
- export { }
@@ -1,21 +0,0 @@
1
- /**
2
- * A set of helper utilities for building backend APIs for use with
3
- * {@link https://docs.microsoft.com/en-us/azure/azure-fluid-relay/overview/overview | Azure Fluid Relay}.
4
- *
5
- * @remarks
6
- * Note that this library's primary entry-point ({@link generateToken}) is only intended
7
- * to be run in a browser context.
8
- * It is **not** Node.js-compatible.
9
- *
10
- * @packageDocumentation
11
- */
12
-
13
- import { IUser } from '@fluidframework/protocol-definitions';
14
- import { ScopeType } from '@fluidframework/protocol-definitions';
15
-
16
- /* Excluded from this release type: generateToken */
17
- export { IUser }
18
-
19
- export { ScopeType }
20
-
21
- export { }
@@ -1,21 +0,0 @@
1
- /**
2
- * A set of helper utilities for building backend APIs for use with
3
- * {@link https://docs.microsoft.com/en-us/azure/azure-fluid-relay/overview/overview | Azure Fluid Relay}.
4
- *
5
- * @remarks
6
- * Note that this library's primary entry-point ({@link generateToken}) is only intended
7
- * to be run in a browser context.
8
- * It is **not** Node.js-compatible.
9
- *
10
- * @packageDocumentation
11
- */
12
-
13
- import { IUser } from '@fluidframework/protocol-definitions';
14
- import { ScopeType } from '@fluidframework/protocol-definitions';
15
-
16
- /* Excluded from this release type: generateToken */
17
- export { IUser }
18
-
19
- export { ScopeType }
20
-
21
- export { }
@@ -1,64 +0,0 @@
1
- /**
2
- * A set of helper utilities for building backend APIs for use with
3
- * {@link https://docs.microsoft.com/en-us/azure/azure-fluid-relay/overview/overview | Azure Fluid Relay}.
4
- *
5
- * @remarks
6
- * Note that this library's primary entry-point ({@link generateToken}) is only intended
7
- * to be run in a browser context.
8
- * It is **not** Node.js-compatible.
9
- *
10
- * @packageDocumentation
11
- */
12
-
13
- import { IUser } from '@fluidframework/protocol-definitions';
14
- import { ScopeType } from '@fluidframework/protocol-definitions';
15
-
16
- /**
17
- * IMPORTANT: This function is duplicated in ./packages/runtime/test-runtime-utils/src/generateToken.ts. There is no
18
- * need for different implementations, so they should be kept in sync if changes are needed.
19
- *
20
- * The reason they are duplicated is because we don't want the core Fluid libraries depending on the Azure libraries
21
- * (enforced by layer-check), but both need to expose this function. The test-runtime-utils library is a test lib, which
22
- * layer-check (correctly) reuires only be used as a dev dependency. But in the azure case, we want the function
23
- * exported, so it needs to be sourced from either the package itself or a non-dev dependency.
24
- *
25
- * The previous solution to this was to import the function from azure-service-utils into test-runtime-utils, but that
26
- * no longer works because the azure packages are in a separate release group.
27
- *
28
- * If a token needs to be generated on the client side, you should re-use this function. If you need service-side token
29
- * generation, you should use the function available in the server-services-client package in order to avoid
30
- * interdependencies between service and client packages.
31
- */
32
- /**
33
- * Generates a {@link https://en.wikipedia.org/wiki/JSON_Web_Token | JSON Web Token} (JWT)
34
- * to authorize access to a Routerlicious-based Fluid service.
35
- *
36
- * @remarks Note: this function uses a browser friendly auth library
37
- * ({@link https://www.npmjs.com/package/jsrsasign | jsrsasign}) and may only be used in client (browser) context.
38
- * It is **not** Node.js-compatible.
39
- *
40
- * @param tenantId - See {@link @fluidframework/protocol-definitions#ITokenClaims.tenantId}
41
- * @param key - API key to authenticate user. Must be {@link https://en.wikipedia.org/wiki/UTF-8 | UTF-8}-encoded.
42
- * @param scopes - See {@link @fluidframework/protocol-definitions#ITokenClaims.scopes}
43
- * @param documentId - See {@link @fluidframework/protocol-definitions#ITokenClaims.documentId}.
44
- * If not specified, the token will not be associated with a document, and an empty string will be used.
45
- * @param user - User with whom generated tokens will be associated.
46
- * If not specified, the token will not be associated with a user, and a randomly generated mock user will be
47
- * used instead.
48
- * See {@link @fluidframework/protocol-definitions#ITokenClaims.user}
49
- * @param lifetime - Used to generate the {@link @fluidframework/protocol-definitions#ITokenClaims.exp | expiration}.
50
- * Expiration = now + lifetime.
51
- * Expressed in seconds.
52
- * Default: 3600 (1 hour).
53
- * @param ver - See {@link @fluidframework/protocol-definitions#ITokenClaims.ver}.
54
- * Default: `1.0`.
55
- *
56
- * @alpha
57
- */
58
- export declare function generateToken(tenantId: string, key: string, scopes: ScopeType[], documentId?: string, user?: IUser, lifetime?: number, ver?: string): string;
59
-
60
- export { IUser }
61
-
62
- export { ScopeType }
63
-
64
- export { }
@@ -1,64 +0,0 @@
1
- /**
2
- * A set of helper utilities for building backend APIs for use with
3
- * {@link https://docs.microsoft.com/en-us/azure/azure-fluid-relay/overview/overview | Azure Fluid Relay}.
4
- *
5
- * @remarks
6
- * Note that this library's primary entry-point ({@link generateToken}) is only intended
7
- * to be run in a browser context.
8
- * It is **not** Node.js-compatible.
9
- *
10
- * @packageDocumentation
11
- */
12
-
13
- import { IUser } from '@fluidframework/protocol-definitions';
14
- import { ScopeType } from '@fluidframework/protocol-definitions';
15
-
16
- /**
17
- * IMPORTANT: This function is duplicated in ./packages/runtime/test-runtime-utils/src/generateToken.ts. There is no
18
- * need for different implementations, so they should be kept in sync if changes are needed.
19
- *
20
- * The reason they are duplicated is because we don't want the core Fluid libraries depending on the Azure libraries
21
- * (enforced by layer-check), but both need to expose this function. The test-runtime-utils library is a test lib, which
22
- * layer-check (correctly) reuires only be used as a dev dependency. But in the azure case, we want the function
23
- * exported, so it needs to be sourced from either the package itself or a non-dev dependency.
24
- *
25
- * The previous solution to this was to import the function from azure-service-utils into test-runtime-utils, but that
26
- * no longer works because the azure packages are in a separate release group.
27
- *
28
- * If a token needs to be generated on the client side, you should re-use this function. If you need service-side token
29
- * generation, you should use the function available in the server-services-client package in order to avoid
30
- * interdependencies between service and client packages.
31
- */
32
- /**
33
- * Generates a {@link https://en.wikipedia.org/wiki/JSON_Web_Token | JSON Web Token} (JWT)
34
- * to authorize access to a Routerlicious-based Fluid service.
35
- *
36
- * @remarks Note: this function uses a browser friendly auth library
37
- * ({@link https://www.npmjs.com/package/jsrsasign | jsrsasign}) and may only be used in client (browser) context.
38
- * It is **not** Node.js-compatible.
39
- *
40
- * @param tenantId - See {@link @fluidframework/protocol-definitions#ITokenClaims.tenantId}
41
- * @param key - API key to authenticate user. Must be {@link https://en.wikipedia.org/wiki/UTF-8 | UTF-8}-encoded.
42
- * @param scopes - See {@link @fluidframework/protocol-definitions#ITokenClaims.scopes}
43
- * @param documentId - See {@link @fluidframework/protocol-definitions#ITokenClaims.documentId}.
44
- * If not specified, the token will not be associated with a document, and an empty string will be used.
45
- * @param user - User with whom generated tokens will be associated.
46
- * If not specified, the token will not be associated with a user, and a randomly generated mock user will be
47
- * used instead.
48
- * See {@link @fluidframework/protocol-definitions#ITokenClaims.user}
49
- * @param lifetime - Used to generate the {@link @fluidframework/protocol-definitions#ITokenClaims.exp | expiration}.
50
- * Expiration = now + lifetime.
51
- * Expressed in seconds.
52
- * Default: 3600 (1 hour).
53
- * @param ver - See {@link @fluidframework/protocol-definitions#ITokenClaims.ver}.
54
- * Default: `1.0`.
55
- *
56
- * @alpha
57
- */
58
- export declare function generateToken(tenantId: string, key: string, scopes: ScopeType[], documentId?: string, user?: IUser, lifetime?: number, ver?: string): string;
59
-
60
- export { IUser }
61
-
62
- export { ScopeType }
63
-
64
- export { }
@@ -1,21 +0,0 @@
1
- /**
2
- * A set of helper utilities for building backend APIs for use with
3
- * {@link https://docs.microsoft.com/en-us/azure/azure-fluid-relay/overview/overview | Azure Fluid Relay}.
4
- *
5
- * @remarks
6
- * Note that this library's primary entry-point ({@link generateToken}) is only intended
7
- * to be run in a browser context.
8
- * It is **not** Node.js-compatible.
9
- *
10
- * @packageDocumentation
11
- */
12
-
13
- import { IUser } from '@fluidframework/protocol-definitions';
14
- import { ScopeType } from '@fluidframework/protocol-definitions';
15
-
16
- /* Excluded from this release type: generateToken */
17
- export { IUser }
18
-
19
- export { ScopeType }
20
-
21
- export { }
@@ -1,21 +0,0 @@
1
- /**
2
- * A set of helper utilities for building backend APIs for use with
3
- * {@link https://docs.microsoft.com/en-us/azure/azure-fluid-relay/overview/overview | Azure Fluid Relay}.
4
- *
5
- * @remarks
6
- * Note that this library's primary entry-point ({@link generateToken}) is only intended
7
- * to be run in a browser context.
8
- * It is **not** Node.js-compatible.
9
- *
10
- * @packageDocumentation
11
- */
12
-
13
- import { IUser } from '@fluidframework/protocol-definitions';
14
- import { ScopeType } from '@fluidframework/protocol-definitions';
15
-
16
- /* Excluded from this release type: generateToken */
17
- export { IUser }
18
-
19
- export { ScopeType }
20
-
21
- export { }
@@ -1,64 +0,0 @@
1
- /**
2
- * A set of helper utilities for building backend APIs for use with
3
- * {@link https://docs.microsoft.com/en-us/azure/azure-fluid-relay/overview/overview | Azure Fluid Relay}.
4
- *
5
- * @remarks
6
- * Note that this library's primary entry-point ({@link generateToken}) is only intended
7
- * to be run in a browser context.
8
- * It is **not** Node.js-compatible.
9
- *
10
- * @packageDocumentation
11
- */
12
-
13
- import { IUser } from '@fluidframework/protocol-definitions';
14
- import { ScopeType } from '@fluidframework/protocol-definitions';
15
-
16
- /**
17
- * IMPORTANT: This function is duplicated in ./packages/runtime/test-runtime-utils/src/generateToken.ts. There is no
18
- * need for different implementations, so they should be kept in sync if changes are needed.
19
- *
20
- * The reason they are duplicated is because we don't want the core Fluid libraries depending on the Azure libraries
21
- * (enforced by layer-check), but both need to expose this function. The test-runtime-utils library is a test lib, which
22
- * layer-check (correctly) reuires only be used as a dev dependency. But in the azure case, we want the function
23
- * exported, so it needs to be sourced from either the package itself or a non-dev dependency.
24
- *
25
- * The previous solution to this was to import the function from azure-service-utils into test-runtime-utils, but that
26
- * no longer works because the azure packages are in a separate release group.
27
- *
28
- * If a token needs to be generated on the client side, you should re-use this function. If you need service-side token
29
- * generation, you should use the function available in the server-services-client package in order to avoid
30
- * interdependencies between service and client packages.
31
- */
32
- /**
33
- * Generates a {@link https://en.wikipedia.org/wiki/JSON_Web_Token | JSON Web Token} (JWT)
34
- * to authorize access to a Routerlicious-based Fluid service.
35
- *
36
- * @remarks Note: this function uses a browser friendly auth library
37
- * ({@link https://www.npmjs.com/package/jsrsasign | jsrsasign}) and may only be used in client (browser) context.
38
- * It is **not** Node.js-compatible.
39
- *
40
- * @param tenantId - See {@link @fluidframework/protocol-definitions#ITokenClaims.tenantId}
41
- * @param key - API key to authenticate user. Must be {@link https://en.wikipedia.org/wiki/UTF-8 | UTF-8}-encoded.
42
- * @param scopes - See {@link @fluidframework/protocol-definitions#ITokenClaims.scopes}
43
- * @param documentId - See {@link @fluidframework/protocol-definitions#ITokenClaims.documentId}.
44
- * If not specified, the token will not be associated with a document, and an empty string will be used.
45
- * @param user - User with whom generated tokens will be associated.
46
- * If not specified, the token will not be associated with a user, and a randomly generated mock user will be
47
- * used instead.
48
- * See {@link @fluidframework/protocol-definitions#ITokenClaims.user}
49
- * @param lifetime - Used to generate the {@link @fluidframework/protocol-definitions#ITokenClaims.exp | expiration}.
50
- * Expiration = now + lifetime.
51
- * Expressed in seconds.
52
- * Default: 3600 (1 hour).
53
- * @param ver - See {@link @fluidframework/protocol-definitions#ITokenClaims.ver}.
54
- * Default: `1.0`.
55
- *
56
- * @alpha
57
- */
58
- export declare function generateToken(tenantId: string, key: string, scopes: ScopeType[], documentId?: string, user?: IUser, lifetime?: number, ver?: string): string;
59
-
60
- export { IUser }
61
-
62
- export { ScopeType }
63
-
64
- export { }
@@ -1,8 +0,0 @@
1
- use_current_InterfaceDeclaration_IUser(get_old_InterfaceDeclaration_IUser());
2
- use_old_InterfaceDeclaration_IUser(get_current_InterfaceDeclaration_IUser());
3
- use_current_EnumDeclaration_ScopeType(get_old_EnumDeclaration_ScopeType());
4
- use_old_EnumDeclaration_ScopeType(get_current_EnumDeclaration_ScopeType());
5
- use_current_FunctionDeclaration_generateToken(get_old_FunctionDeclaration_generateToken());
6
- use_old_FunctionDeclaration_generateToken(get_current_FunctionDeclaration_generateToken());
7
- export {};
8
- //# sourceMappingURL=validateAzureServiceUtilsPrevious.generated.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validateAzureServiceUtilsPrevious.generated.js","sourceRoot":"","sources":["../../../src/test/types/validateAzureServiceUtilsPrevious.generated.ts"],"names":[],"mappings":"AAgCA,sCAAsC,CAClC,kCAAkC,EAAE,CAAC,CAAC;AAW1C,kCAAkC,CAC9B,sCAAsC,EAAE,CAAC,CAAC;AAW9C,qCAAqC,CACjC,iCAAiC,EAAE,CAAC,CAAC;AAWzC,iCAAiC,CAC7B,qCAAqC,EAAE,CAAC,CAAC;AAW7C,6CAA6C,CACzC,yCAAyC,EAAE,CAAC,CAAC;AAWjD,yCAAyC,CACrC,6CAA6C,EAAE,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/*\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.\n * Generated by fluid-type-test-generator in @fluidframework/build-tools.\n */\nimport type * as old from \"@fluidframework/azure-service-utils-previous\";\nimport type * as current from \"../../index.js\";\n\n\n// See 'build-tools/src/type-test-generator/compatibility.ts' for more information.\ntype TypeOnly<T> = T extends number\n\t? number\n\t: T extends string\n\t? string\n\t: T extends boolean | bigint | symbol\n\t? T\n\t: {\n\t\t\t[P in keyof T]: TypeOnly<T[P]>;\n\t };\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IUser\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_IUser():\n TypeOnly<old.IUser>;\ndeclare function use_current_InterfaceDeclaration_IUser(\n use: TypeOnly<current.IUser>): void;\nuse_current_InterfaceDeclaration_IUser(\n get_old_InterfaceDeclaration_IUser());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IUser\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_IUser():\n TypeOnly<current.IUser>;\ndeclare function use_old_InterfaceDeclaration_IUser(\n use: TypeOnly<old.IUser>): void;\nuse_old_InterfaceDeclaration_IUser(\n get_current_InterfaceDeclaration_IUser());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"EnumDeclaration_ScopeType\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_EnumDeclaration_ScopeType():\n TypeOnly<old.ScopeType>;\ndeclare function use_current_EnumDeclaration_ScopeType(\n use: TypeOnly<current.ScopeType>): void;\nuse_current_EnumDeclaration_ScopeType(\n get_old_EnumDeclaration_ScopeType());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"EnumDeclaration_ScopeType\": {\"backCompat\": false}\n*/\ndeclare function get_current_EnumDeclaration_ScopeType():\n TypeOnly<current.ScopeType>;\ndeclare function use_old_EnumDeclaration_ScopeType(\n use: TypeOnly<old.ScopeType>): void;\nuse_old_EnumDeclaration_ScopeType(\n get_current_EnumDeclaration_ScopeType());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_generateToken\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_FunctionDeclaration_generateToken():\n TypeOnly<typeof old.generateToken>;\ndeclare function use_current_FunctionDeclaration_generateToken(\n use: TypeOnly<typeof current.generateToken>): void;\nuse_current_FunctionDeclaration_generateToken(\n get_old_FunctionDeclaration_generateToken());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_generateToken\": {\"backCompat\": false}\n*/\ndeclare function get_current_FunctionDeclaration_generateToken():\n TypeOnly<typeof current.generateToken>;\ndeclare function use_old_FunctionDeclaration_generateToken(\n use: TypeOnly<typeof old.generateToken>): void;\nuse_old_FunctionDeclaration_generateToken(\n get_current_FunctionDeclaration_generateToken());\n"]}
File without changes