@fluidframework/test-runtime-utils 2.80.0 → 2.81.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 +4 -0
- package/dist/assertionShortCodesMap.d.ts +30 -4
- package/dist/assertionShortCodesMap.d.ts.map +1 -1
- package/dist/assertionShortCodesMap.js +31 -5
- package/dist/assertionShortCodesMap.js.map +1 -1
- package/dist/generateToken.d.ts.map +1 -1
- package/dist/generateToken.js +1 -0
- package/dist/generateToken.js.map +1 -1
- package/eslint.config.mts +4 -4
- package/lib/assertionShortCodesMap.d.ts +30 -4
- package/lib/assertionShortCodesMap.d.ts.map +1 -1
- package/lib/assertionShortCodesMap.js +31 -5
- package/lib/assertionShortCodesMap.js.map +1 -1
- package/lib/generateToken.d.ts.map +1 -1
- package/lib/generateToken.js +1 -0
- package/lib/generateToken.js.map +1 -1
- package/package.json +19 -19
- package/src/assertionShortCodesMap.ts +31 -5
- package/src/generateToken.ts +1 -0
- package/.eslintrc.cjs +0 -32
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateToken.d.ts","sourceRoot":"","sources":["../src/generateToken.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAgB,SAAS,EAAE,MAAM,6CAA6C,CAAC;AAI3F,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;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,aAAa,EACpB,QAAQ,GAAE,MAAgB,EAC1B,GAAG,GAAE,MAAc,GACjB,MAAM,
|
|
1
|
+
{"version":3,"file":"generateToken.d.ts","sourceRoot":"","sources":["../src/generateToken.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAgB,SAAS,EAAE,MAAM,6CAA6C,CAAC;AAI3F,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;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,aAAa,EACpB,QAAQ,GAAE,MAAgB,EAC1B,GAAG,GAAE,MAAc,GACjB,MAAM,CA6BR;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,aAAa,CAO5C"}
|
package/lib/generateToken.js
CHANGED
|
@@ -45,6 +45,7 @@ import { v4 as uuid } from "uuid";
|
|
|
45
45
|
* Default: `1.0`.
|
|
46
46
|
*/
|
|
47
47
|
export function generateToken(tenantId, key, scopes, documentId, user, lifetime = 60 * 60, ver = "1.0") {
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- using ?? could change behavior for falsy values
|
|
48
49
|
let userClaim = user ? user : generateUser();
|
|
49
50
|
if (userClaim.id === "" || userClaim.id === undefined) {
|
|
50
51
|
userClaim = generateUser();
|
package/lib/generateToken.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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;AAIlC;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,aAAa,CAC5B,QAAgB,EAChB,GAAW,EACX,MAAmB,EACnB,UAAmB,EACnB,IAAoB,EACpB,WAAmB,EAAE,GAAG,EAAE,EAC1B,MAAc,KAAK;IAEnB,IAAI,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC;IAC7C,IAAI,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,SAAS,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;QACvD,SAAS,GAAG,YAAY,EAAE,CAAC;IAC5B,CAAC;IAED,0BAA0B;IAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IAC1C,MAAM,KAAK,GAAG,UAAU,IAAI,EAAE,CAAC;IAE/B,MAAM,MAAM,GAAmC;QAC9C,UAAU,EAAE,KAAK;QACjB,MAAM;QACN,QAAQ;QACR,IAAI,EAAE,SAAS;QACf,GAAG,EAAE,GAAG;QACR,GAAG,EAAE,GAAG,GAAG,QAAQ;QACnB,GAAG;QACH,GAAG,EAAE,IAAI,EAAE;KACX,CAAC;IAEF,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;IAC9B,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAC5B,IAAI,EACJ,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAC5C,MAAM,EACN,OAAO,CACP,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY;IAC3B,MAAM,UAAU,GAAG;QAClB,EAAE,EAAE,IAAI,EAAE;QACV,IAAI,EAAE,IAAI,EAAE;KACZ,CAAC;IAEF,OAAO,UAAU,CAAC;AACnB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITokenClaims, ScopeType } from \"@fluidframework/driver-definitions/internal\";\nimport { KJUR as jsrsasign } from \"jsrsasign\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { IInsecureUser } from \"./insecureUsers.js\";\n\n/**\n * IMPORTANT: This function is duplicated in ./azure/packages/azure-service-utils/src/generateToken.ts. There is no need\n * 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 */\nexport function generateToken(\n\ttenantId: string,\n\tkey: string,\n\tscopes: ScopeType[],\n\tdocumentId?: string,\n\tuser?: IInsecureUser,\n\tlifetime: number = 60 * 60,\n\tver: string = \"1.0\",\n): string {\n\tlet userClaim = user ? 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\tconst docId = documentId ?? \"\";\n\n\tconst claims: ITokenClaims & { jti: string } = {\n\t\tdocumentId: docId,\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\treturn jsrsasign.jws.JWS.sign(\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 IInsecureUser} by generating a\n * random UUID for its {@link @fluidframework/protocol-definitions#IUser.id | id} and {@link IInsecureUser.name | name} properties.\n */\nexport function generateUser(): IInsecureUser {\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;AAIlC;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,aAAa,CAC5B,QAAgB,EAChB,GAAW,EACX,MAAmB,EACnB,UAAmB,EACnB,IAAoB,EACpB,WAAmB,EAAE,GAAG,EAAE,EAC1B,MAAc,KAAK;IAEnB,2HAA2H;IAC3H,IAAI,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC;IAC7C,IAAI,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,SAAS,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;QACvD,SAAS,GAAG,YAAY,EAAE,CAAC;IAC5B,CAAC;IAED,0BAA0B;IAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IAC1C,MAAM,KAAK,GAAG,UAAU,IAAI,EAAE,CAAC;IAE/B,MAAM,MAAM,GAAmC;QAC9C,UAAU,EAAE,KAAK;QACjB,MAAM;QACN,QAAQ;QACR,IAAI,EAAE,SAAS;QACf,GAAG,EAAE,GAAG;QACR,GAAG,EAAE,GAAG,GAAG,QAAQ;QACnB,GAAG;QACH,GAAG,EAAE,IAAI,EAAE;KACX,CAAC;IAEF,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;IAC9B,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAC5B,IAAI,EACJ,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAC5C,MAAM,EACN,OAAO,CACP,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY;IAC3B,MAAM,UAAU,GAAG;QAClB,EAAE,EAAE,IAAI,EAAE;QACV,IAAI,EAAE,IAAI,EAAE;KACZ,CAAC;IAEF,OAAO,UAAU,CAAC;AACnB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITokenClaims, ScopeType } from \"@fluidframework/driver-definitions/internal\";\nimport { KJUR as jsrsasign } from \"jsrsasign\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { IInsecureUser } from \"./insecureUsers.js\";\n\n/**\n * IMPORTANT: This function is duplicated in ./azure/packages/azure-service-utils/src/generateToken.ts. There is no need\n * 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 */\nexport function generateToken(\n\ttenantId: string,\n\tkey: string,\n\tscopes: ScopeType[],\n\tdocumentId?: string,\n\tuser?: IInsecureUser,\n\tlifetime: number = 60 * 60,\n\tver: string = \"1.0\",\n): string {\n\t// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- using ?? could change behavior for falsy values\n\tlet userClaim = user ? 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\tconst docId = documentId ?? \"\";\n\n\tconst claims: ITokenClaims & { jti: string } = {\n\t\tdocumentId: docId,\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\treturn jsrsasign.jws.JWS.sign(\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 IInsecureUser} by generating a\n * random UUID for its {@link @fluidframework/protocol-definitions#IUser.id | id} and {@link IInsecureUser.name | name} properties.\n */\nexport function generateUser(): IInsecureUser {\n\tconst randomUser = {\n\t\tid: uuid(),\n\t\tname: uuid(),\n\t};\n\n\treturn randomUser;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/test-runtime-utils",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.81.0",
|
|
4
4
|
"description": "Fluid runtime test utilities",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -69,31 +69,31 @@
|
|
|
69
69
|
"temp-directory": "nyc/.nyc_output"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@fluid-internal/client-utils": "~2.
|
|
73
|
-
"@fluidframework/container-definitions": "~2.
|
|
74
|
-
"@fluidframework/container-runtime-definitions": "~2.
|
|
75
|
-
"@fluidframework/core-interfaces": "~2.
|
|
76
|
-
"@fluidframework/core-utils": "~2.
|
|
77
|
-
"@fluidframework/datastore-definitions": "~2.
|
|
78
|
-
"@fluidframework/driver-definitions": "~2.
|
|
79
|
-
"@fluidframework/driver-utils": "~2.
|
|
80
|
-
"@fluidframework/id-compressor": "~2.
|
|
81
|
-
"@fluidframework/routerlicious-driver": "~2.
|
|
82
|
-
"@fluidframework/runtime-definitions": "~2.
|
|
83
|
-
"@fluidframework/runtime-utils": "~2.
|
|
84
|
-
"@fluidframework/telemetry-utils": "~2.
|
|
72
|
+
"@fluid-internal/client-utils": "~2.81.0",
|
|
73
|
+
"@fluidframework/container-definitions": "~2.81.0",
|
|
74
|
+
"@fluidframework/container-runtime-definitions": "~2.81.0",
|
|
75
|
+
"@fluidframework/core-interfaces": "~2.81.0",
|
|
76
|
+
"@fluidframework/core-utils": "~2.81.0",
|
|
77
|
+
"@fluidframework/datastore-definitions": "~2.81.0",
|
|
78
|
+
"@fluidframework/driver-definitions": "~2.81.0",
|
|
79
|
+
"@fluidframework/driver-utils": "~2.81.0",
|
|
80
|
+
"@fluidframework/id-compressor": "~2.81.0",
|
|
81
|
+
"@fluidframework/routerlicious-driver": "~2.81.0",
|
|
82
|
+
"@fluidframework/runtime-definitions": "~2.81.0",
|
|
83
|
+
"@fluidframework/runtime-utils": "~2.81.0",
|
|
84
|
+
"@fluidframework/telemetry-utils": "~2.81.0",
|
|
85
85
|
"jsrsasign": "^11.0.0",
|
|
86
86
|
"uuid": "^11.1.0"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
89
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
90
90
|
"@biomejs/biome": "~1.9.3",
|
|
91
|
-
"@fluid-internal/mocha-test-setup": "~2.
|
|
92
|
-
"@fluid-tools/build-cli": "^0.
|
|
91
|
+
"@fluid-internal/mocha-test-setup": "~2.81.0",
|
|
92
|
+
"@fluid-tools/build-cli": "^0.63.0",
|
|
93
93
|
"@fluidframework/build-common": "^2.0.3",
|
|
94
|
-
"@fluidframework/build-tools": "^0.
|
|
95
|
-
"@fluidframework/eslint-config-fluid": "~2.
|
|
96
|
-
"@fluidframework/test-runtime-utils-previous": "npm:@fluidframework/test-runtime-utils@2.
|
|
94
|
+
"@fluidframework/build-tools": "^0.63.0",
|
|
95
|
+
"@fluidframework/eslint-config-fluid": "~2.81.0",
|
|
96
|
+
"@fluidframework/test-runtime-utils-previous": "npm:@fluidframework/test-runtime-utils@2.80.0",
|
|
97
97
|
"@microsoft/api-extractor": "7.52.11",
|
|
98
98
|
"@types/jsrsasign": "^10.5.12",
|
|
99
99
|
"@types/mocha": "^10.0.10",
|
|
@@ -739,6 +739,7 @@ export const shortCodeMap = {
|
|
|
739
739
|
"0x583": "unexpected field length",
|
|
740
740
|
"0x584": "response should contain epoch",
|
|
741
741
|
"0x585": "prefetched snapshot should have a valid epoch",
|
|
742
|
+
"0x587": "Unreachable unless manually accumulating a batch",
|
|
742
743
|
"0x58a": "Batch must have a reference sequence number if non-empty",
|
|
743
744
|
"0x58b": "Content offset within bounds",
|
|
744
745
|
"0x58c": "Content offset equal or larger than content length",
|
|
@@ -1259,9 +1260,6 @@ export const shortCodeMap = {
|
|
|
1259
1260
|
"0x97d": "seq#",
|
|
1260
1261
|
"0x97e": "received context must have a get function",
|
|
1261
1262
|
"0x980": "Unknown commit",
|
|
1262
|
-
"0x985": "No transaction to commit",
|
|
1263
|
-
"0x986": "No transaction to abort",
|
|
1264
|
-
"0x987": "No transaction to add a step to",
|
|
1265
1263
|
"0x98a": "expected class based schema",
|
|
1266
1264
|
"0x995": "missing visitor cursor while editing",
|
|
1267
1265
|
"0x996": "Implicit revision should be provided",
|
|
@@ -1375,6 +1373,8 @@ export const shortCodeMap = {
|
|
|
1375
1373
|
"0xa33": "clientId (from stateHandler) could only be undefined if we've never connected, but we have a CSN so we know that's not the case",
|
|
1376
1374
|
"0xa34": "Should have found the batchId in batchIdBySeqNum map",
|
|
1377
1375
|
"0xa35": "batchIdsAll and batchIdsBySeqNum should be in sync",
|
|
1376
|
+
"0xa3a": "Presence received signal without clientId",
|
|
1377
|
+
"0xa3c": "Already have entry for key in map",
|
|
1378
1378
|
"0xa3d": "Partial batch should have exactly one message",
|
|
1379
1379
|
"0xa3e": "Empty batch is always considered a full batch",
|
|
1380
1380
|
"0xa3f": "segments cannot be undefined",
|
|
@@ -1397,6 +1397,8 @@ export const shortCodeMap = {
|
|
|
1397
1397
|
"0xa54": "out of schema: unexpected value",
|
|
1398
1398
|
"0xa55": "missing simple tree context",
|
|
1399
1399
|
"0xa57": "Expected EagerMapTree required field to have a value",
|
|
1400
|
+
"0xa59": "Client connected without clientId",
|
|
1401
|
+
"0xa5a": "Mismatched SessionId",
|
|
1400
1402
|
"0xa5b": "must have exactly 1 field in batch",
|
|
1401
1403
|
"0xa5c": "Unexpected view implementation",
|
|
1402
1404
|
"0xa5d": "Shared branches cannot be rebased onto another branch.",
|
|
@@ -1434,7 +1436,6 @@ export const shortCodeMap = {
|
|
|
1434
1436
|
"0xa93": "Cannot encode a handle without a bind context",
|
|
1435
1437
|
"0xa94": "invalid forbidden field",
|
|
1436
1438
|
"0xa95": "Invalid map schema",
|
|
1437
|
-
"0xa97": "Not in transaction",
|
|
1438
1439
|
"0xa99": "must have a parent",
|
|
1439
1440
|
"0xa9a": "must have a parent",
|
|
1440
1441
|
"0xa9b": "attach should happen in a node",
|
|
@@ -1453,6 +1454,7 @@ export const shortCodeMap = {
|
|
|
1453
1454
|
"0xaaa": "All local changes should be applied to the trunk before loading from summary",
|
|
1454
1455
|
"0xaab": "must be segment leaf",
|
|
1455
1456
|
"0xaac": "must have removedClient ids",
|
|
1457
|
+
"0xaad": "Local client should be 'Disconnected' before adding new connection.",
|
|
1456
1458
|
"0xaae": "Maps should have the same behavior",
|
|
1457
1459
|
"0xaaf": "Unexpected undefined code point",
|
|
1458
1460
|
"0xab1": "Debug asserts cannot be configured since they have been optimized out.",
|
|
@@ -1893,5 +1895,29 @@ export const shortCodeMap = {
|
|
|
1893
1895
|
"0xcac": "Unexpected branch implementation",
|
|
1894
1896
|
"0xcad": "Unexpected branch implementation",
|
|
1895
1897
|
"0xcae": "The outer transaction should be ending",
|
|
1896
|
-
"0xcaf": "Unexpected commit in transaction"
|
|
1898
|
+
"0xcaf": "Unexpected commit in transaction",
|
|
1899
|
+
"0xcb0": "must initializeData first",
|
|
1900
|
+
"0xcb1": "Presence is only expected to be accessed with a single version.",
|
|
1901
|
+
"0xcb2": "Presence is only expected to be accessed with a single version.",
|
|
1902
|
+
"0xcb3": "Node cannot be raw.",
|
|
1903
|
+
"0xcb4": "Unexpected node kind",
|
|
1904
|
+
"0xcb5": "Node cannot be raw.",
|
|
1905
|
+
"0xcb6": "Expected node to be on new fork.",
|
|
1906
|
+
"0xcb7": "Unexpected node schema",
|
|
1907
|
+
"0xcb8": "No config map entry for version",
|
|
1908
|
+
"0xcb9": "Invalid package version",
|
|
1909
|
+
"0xcba": "Self is not in audience and no alternateProvider given",
|
|
1910
|
+
"0xcbb": "Client connection update missing",
|
|
1911
|
+
"0xcbc": "Unrecognized message type in critical message",
|
|
1912
|
+
"0xcbd": "Received signal without clientId",
|
|
1913
|
+
"0xcbe": "Acknowledgment message was requested while targeted signal capability is not supported",
|
|
1914
|
+
"0xcbf": "Received signal without clientId",
|
|
1915
|
+
"0xcc0": "Local client must be in audience for presence to handle added connection.",
|
|
1916
|
+
"0xcc1": "New commits must have a parent.",
|
|
1917
|
+
"0xcc2": "Missing enriched commit.",
|
|
1918
|
+
"0xcc3": "New commits must have a parent.",
|
|
1919
|
+
"0xcc4": "Missing enriched commit.",
|
|
1920
|
+
"0xcc5": "Unsupported modular change codec version",
|
|
1921
|
+
"0xcc6": "updatableError should only be called in test mode",
|
|
1922
|
+
"0xcc7": "expected compatibility errors for missing min collab version snapshot"
|
|
1897
1923
|
};
|
package/src/generateToken.ts
CHANGED
|
@@ -59,6 +59,7 @@ export function generateToken(
|
|
|
59
59
|
lifetime: number = 60 * 60,
|
|
60
60
|
ver: string = "1.0",
|
|
61
61
|
): string {
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- using ?? could change behavior for falsy values
|
|
62
63
|
let userClaim = user ? user : generateUser();
|
|
63
64
|
if (userClaim.id === "" || userClaim.id === undefined) {
|
|
64
65
|
userClaim = generateUser();
|
package/.eslintrc.cjs
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
7
|
-
extends: [
|
|
8
|
-
require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"),
|
|
9
|
-
"prettier",
|
|
10
|
-
],
|
|
11
|
-
parserOptions: {
|
|
12
|
-
project: ["./tsconfig.json", "./src/test/tsconfig.json"],
|
|
13
|
-
},
|
|
14
|
-
rules: {
|
|
15
|
-
"@typescript-eslint/strict-boolean-expressions": "off",
|
|
16
|
-
},
|
|
17
|
-
overrides: [
|
|
18
|
-
{
|
|
19
|
-
// The assertion shortcode map file is auto-generated, so disable some rules.
|
|
20
|
-
files: ["src/assertionShortCodesMap.ts"],
|
|
21
|
-
rules: {
|
|
22
|
-
"@typescript-eslint/comma-dangle": "off",
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
files: ["src/test/**"],
|
|
27
|
-
rules: {
|
|
28
|
-
"import-x/no-nodejs-modules": "off",
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
};
|