@fluidframework/routerlicious-urlresolver 2.91.0 → 2.92.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/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/nconf.cjs +1 -1
- package/dist/nconf.cjs.map +1 -1
- package/dist/nconf.d.cts +1 -2
- package/dist/nconf.d.cts.map +1 -1
- package/dist/public.d.ts +1 -1
- package/dist/urlResolver.d.ts +4 -4
- package/dist/urlResolver.d.ts.map +1 -1
- package/dist/urlResolver.js +5 -5
- package/dist/urlResolver.js.map +1 -1
- package/eslint.config.mts +8 -4
- package/internal.d.ts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/nconf.cjs +1 -1
- package/lib/nconf.cjs.map +1 -1
- package/lib/nconf.d.cts +1 -2
- package/lib/nconf.d.cts.map +1 -1
- package/lib/public.d.ts +1 -1
- package/lib/urlResolver.d.ts +4 -4
- package/lib/urlResolver.d.ts.map +1 -1
- package/lib/urlResolver.js +5 -5
- package/lib/urlResolver.js.map +1 -1
- package/package.json +10 -10
- package/src/index.ts +1 -1
- package/src/nconf.cts +1 -3
- package/src/urlResolver.ts +9 -9
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export { IAlfredUser, IConfig, RouterliciousUrlResolver } from "./urlResolver.js";
|
|
5
|
+
export { type IAlfredUser, type IConfig, RouterliciousUrlResolver } from "./urlResolver.js";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,mDAA4F;AAAnD,0HAAA,wBAAwB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { type IAlfredUser, type IConfig, RouterliciousUrlResolver } from \"./urlResolver.js\";\n"]}
|
package/dist/nconf.cjs
CHANGED
|
@@ -8,6 +8,6 @@ exports.Provider = void 0;
|
|
|
8
8
|
// This file serves as an intermediary module to export the 'Provider' named export from the 'nconf' module.
|
|
9
9
|
// It is written using ESM module syntax, making it compatible with both ESM and CJS module.
|
|
10
10
|
// This compatibility allows for flexible usage of the 'Provider' named export from the 'nconf' module across different module systems without modification.
|
|
11
|
-
|
|
11
|
+
var nconf_1 = require("nconf");
|
|
12
12
|
Object.defineProperty(exports, "Provider", { enumerable: true, get: function () { return nconf_1.Provider; } });
|
|
13
13
|
//# sourceMappingURL=nconf.cjs.map
|
package/dist/nconf.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nconf.cjs","sourceRoot":"","sources":["../src/nconf.cts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,4GAA4G;AAC5G,4FAA4F;AAC5F,4JAA4J;AAE5J
|
|
1
|
+
{"version":3,"file":"nconf.cjs","sourceRoot":"","sources":["../src/nconf.cts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,4GAA4G;AAC5G,4FAA4F;AAC5F,4JAA4J;AAE5J,+BAAiC;AAAxB,iGAAA,QAAQ,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// This file serves as an intermediary module to export the 'Provider' named export from the 'nconf' module.\n// It is written using ESM module syntax, making it compatible with both ESM and CJS module.\n// This compatibility allows for flexible usage of the 'Provider' named export from the 'nconf' module across different module systems without modification.\n\nexport { Provider } from \"nconf\";\n"]}
|
package/dist/nconf.d.cts
CHANGED
package/dist/nconf.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nconf.d.cts","sourceRoot":"","sources":["../src/nconf.cts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC
|
|
1
|
+
{"version":3,"file":"nconf.d.cts","sourceRoot":"","sources":["../src/nconf.cts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC"}
|
package/dist/public.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
|
-
* Generated by "flub generate entrypoints" in @fluid-tools/build-cli.
|
|
8
|
+
* Generated by "flub generate entrypoints --resolutionConditions require --outFileLegacyBeta legacy --outDir ./dist" in @fluid-tools/build-cli.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
export {}
|
package/dist/urlResolver.d.ts
CHANGED
|
@@ -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 { IRequest } from "@fluidframework/core-interfaces";
|
|
6
|
-
import { IUser } from "@fluidframework/driver-definitions";
|
|
7
|
-
import { IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions/internal";
|
|
8
|
-
import { Provider } from "./nconf.cjs";
|
|
5
|
+
import type { IRequest } from "@fluidframework/core-interfaces";
|
|
6
|
+
import type { IUser } from "@fluidframework/driver-definitions";
|
|
7
|
+
import type { IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions/internal";
|
|
8
|
+
import type { Provider } from "./nconf.cjs";
|
|
9
9
|
/**
|
|
10
10
|
* @internal
|
|
11
11
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"urlResolver.d.ts","sourceRoot":"","sources":["../src/urlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"urlResolver.d.ts","sourceRoot":"","sources":["../src/urlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAEhE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAE9F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAQ5C;;GAEG;AACH,qBAAa,wBAAyB,YAAW,YAAY;IAE3D,OAAO,CAAC,QAAQ,CAAC,MAAM;IAGvB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAJP,MAAM,EACpB;QAAE,QAAQ,EAAE,QAAQ,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,GAC5D,SAAS,EACK,QAAQ,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EAC/B,OAAO,EAAE,MAAM;IAGjC;;OAEG;IACU,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC;IA4G7D,cAAc,CAC1B,WAAW,EAAE,YAAY,EACzB,WAAW,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC;CAgBlB;AAED;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,KAAK;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACnB"}
|
package/dist/urlResolver.js
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.RouterliciousUrlResolver = void 0;
|
|
8
8
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
9
|
-
const r11sServers = [
|
|
9
|
+
const r11sServers = new Set([
|
|
10
10
|
"www.wu2-ppe.prague.office-int.com",
|
|
11
11
|
"www.wu2.prague.office-int.com",
|
|
12
12
|
"www.eu.prague.office-int.com",
|
|
13
|
-
];
|
|
13
|
+
]);
|
|
14
14
|
/**
|
|
15
15
|
* @internal
|
|
16
16
|
*/
|
|
@@ -32,7 +32,7 @@ class RouterliciousUrlResolver {
|
|
|
32
32
|
const reqUrl = new URL(requestedUrl);
|
|
33
33
|
const server = reqUrl.hostname.toLowerCase();
|
|
34
34
|
// If we don't have a valid server or a prescriptive config, we cannot resolve the URL
|
|
35
|
-
if (!(r11sServers.
|
|
35
|
+
if (!(r11sServers.has(server) ||
|
|
36
36
|
(server === "localhost" && reqUrl.port === "3000") ||
|
|
37
37
|
this.config)) {
|
|
38
38
|
return undefined;
|
|
@@ -57,7 +57,7 @@ class RouterliciousUrlResolver {
|
|
|
57
57
|
const token = await this.getToken();
|
|
58
58
|
const isLocalHost = server === "localhost";
|
|
59
59
|
const isInternalRequest = server.includes("gateway"); // e.g. gateway:3000 || fierce-dog-gateway:3000
|
|
60
|
-
const serverSuffix = isLocalHost ? `${server}:3003` : server.
|
|
60
|
+
const serverSuffix = isLocalHost ? `${server}:3003` : server.slice(4);
|
|
61
61
|
let fluidUrl = "https://" +
|
|
62
62
|
`${this.config ? new URL(this.config.provider.get("worker:serverUrl")).host : serverSuffix}/` +
|
|
63
63
|
`${encodeURIComponent(tenantId)}/` +
|
|
@@ -119,7 +119,7 @@ class RouterliciousUrlResolver {
|
|
|
119
119
|
(0, internal_1.assert)(!!documentId, 0x0bb /* "Document id should exist" */);
|
|
120
120
|
let url = relativeUrl;
|
|
121
121
|
if (url.startsWith("/")) {
|
|
122
|
-
url = url.
|
|
122
|
+
url = url.slice(1);
|
|
123
123
|
}
|
|
124
124
|
return `${this.hostUrl}/${encodeURIComponent(tenantId)}/${encodeURIComponent(documentId)}/${url}`;
|
|
125
125
|
}
|
package/dist/urlResolver.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"urlResolver.js","sourceRoot":"","sources":["../src/urlResolver.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAA6D;AAM7D,MAAM,WAAW,GAAG;
|
|
1
|
+
{"version":3,"file":"urlResolver.js","sourceRoot":"","sources":["../src/urlResolver.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAA6D;AAM7D,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAC3B,mCAAmC;IACnC,+BAA+B;IAC/B,8BAA8B;CAC9B,CAAC,CAAC;AAEH;;GAEG;AACH,MAAa,wBAAwB;IACpC,YACkB,MAEL,EACK,QAA+B,EAC/B,OAAe;QAJf,WAAM,GA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WAAyB,EACzB,WAAmB;QAEnB,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAC3C,IAAA,iBAAM,EAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAClE,MAAM,CAAC,EAAE,QAAQ,EAAE,UAAU,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC/D,IAAA,iBAAM,EAAC,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,8BAA8B,CAAC,CAAC;QACzD,IAAA,iBAAM,EAAC,CAAC,CAAC,UAAU,EAAE,KAAK,CAAC,gCAAgC,CAAC,CAAC;QAE7D,IAAI,GAAG,GAAG,WAAW,CAAC;QACtB,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACzB,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;QAED,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,kBAAkB,CAAC,QAAQ,CAAC,IAAI,kBAAkB,CAC3E,UAAU,CACV,IAAI,GAAG,EAAE,CAAC;IACZ,CAAC;CACD;AA3ID,4DA2IC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IRequest } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IUser } from \"@fluidframework/driver-definitions\";\nimport type { IResolvedUrl, IUrlResolver } from \"@fluidframework/driver-definitions/internal\";\n\nimport type { Provider } from \"./nconf.cjs\";\n\nconst r11sServers = new Set([\n\t\"www.wu2-ppe.prague.office-int.com\",\n\t\"www.wu2.prague.office-int.com\",\n\t\"www.eu.prague.office-int.com\",\n]);\n\n/**\n * @internal\n */\nexport class RouterliciousUrlResolver implements IUrlResolver {\n\tconstructor(\n\t\tprivate readonly config:\n\t\t\t| { provider: Provider; tenantId: string; documentId: string }\n\t\t\t| undefined,\n\t\tprivate readonly getToken: () => Promise<string>,\n\t\tprivate readonly hostUrl: string,\n\t) {}\n\n\t/**\n\t * Handles a request and returns the relevant endpoints for the environment\n\t */\n\tpublic async resolve(request: IRequest): Promise<IResolvedUrl | undefined> {\n\t\tlet requestedUrl = request.url;\n\n\t\t// If we know the original hostname, reinsert it\n\t\tif (this.config && request.url.startsWith(\"/\")) {\n\t\t\trequestedUrl = `http://dummy:3000${request.url}`;\n\t\t}\n\n\t\tconst reqUrl = new URL(requestedUrl);\n\t\tconst server = reqUrl.hostname.toLowerCase();\n\n\t\t// If we don't have a valid server or a prescriptive config, we cannot resolve the URL\n\t\tif (\n\t\t\t!(\n\t\t\t\tr11sServers.has(server) ||\n\t\t\t\t(server === \"localhost\" && reqUrl.port === \"3000\") ||\n\t\t\t\tthis.config\n\t\t\t)\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst path = reqUrl.pathname.split(\"/\");\n\t\tlet tenantId: string;\n\t\tlet documentId: string;\n\t\tlet provider: Provider | undefined;\n\t\tif (this.config) {\n\t\t\ttenantId = this.config.tenantId;\n\t\t\tdocumentId = this.config.documentId;\n\t\t\tprovider = this.config.provider;\n\t\t} else if (path.length >= 4) {\n\t\t\ttenantId = path[2];\n\t\t\tdocumentId = path[3];\n\t\t} else {\n\t\t\ttenantId = \"fluid\";\n\t\t\tdocumentId = path[2];\n\t\t}\n\n\t\tconst token = await this.getToken();\n\n\t\tconst isLocalHost = server === \"localhost\";\n\t\tconst isInternalRequest = server.includes(\"gateway\"); // e.g. gateway:3000 || fierce-dog-gateway:3000\n\n\t\tconst serverSuffix = isLocalHost ? `${server}:3003` : server.slice(4);\n\n\t\tlet fluidUrl =\n\t\t\t\"https://\" +\n\t\t\t`${\n\t\t\t\tthis.config ? new URL(this.config.provider.get(\"worker:serverUrl\")).host : serverSuffix\n\t\t\t}/` +\n\t\t\t`${encodeURIComponent(tenantId)}/` +\n\t\t\t`${encodeURIComponent(documentId)}`;\n\n\t\t// In case of any additional parameters add them back to the url\n\t\tif (reqUrl.search) {\n\t\t\tconst searchParams = reqUrl.search;\n\t\t\tif (searchParams) {\n\t\t\t\tfluidUrl += searchParams;\n\t\t\t}\n\t\t}\n\n\t\tlet storageUrl = \"\";\n\t\tlet ordererUrl = \"\";\n\t\tlet deltaStorageUrl = \"\";\n\n\t\t// There is no provider when using debugging tooling\n\t\tif (provider && isInternalRequest) {\n\t\t\tstorageUrl = provider.get(\"worker:internalBlobStorageUrl\");\n\t\t\tordererUrl = provider.get(\"worker:alfredUrl\");\n\t\t\tdeltaStorageUrl = `${provider.get(\"worker:alfredUrl\")}/deltas/${encodeURIComponent(\n\t\t\t\ttenantId,\n\t\t\t)}/${encodeURIComponent(documentId)}`;\n\t\t} else if (provider) {\n\t\t\tstorageUrl = provider\n\t\t\t\t.get(\"worker:blobStorageUrl\")\n\t\t\t\t.replace(\"historian:3000\", \"localhost:3001\");\n\t\t\tordererUrl = provider.get(\"worker:serverUrl\");\n\t\t\tdeltaStorageUrl = `${ordererUrl}/deltas/${encodeURIComponent(\n\t\t\t\ttenantId,\n\t\t\t)}/${encodeURIComponent(documentId)}`;\n\t\t} else if (isLocalHost) {\n\t\t\tstorageUrl = `http://localhost:3001`;\n\t\t\tordererUrl = `http://localhost:3003`;\n\t\t\tdeltaStorageUrl = `http://localhost:3003/deltas/${tenantId}/${documentId}`;\n\t\t} else {\n\t\t\tstorageUrl = `https://historian.${serverSuffix}`;\n\t\t\tordererUrl = `https://alfred.${serverSuffix}`;\n\t\t\tdeltaStorageUrl = `https://alfred.${serverSuffix}/deltas/${tenantId}/${documentId}`;\n\t\t}\n\n\t\tstorageUrl += `/repos/${tenantId}`;\n\t\tordererUrl += ``;\n\t\tdeltaStorageUrl += ``;\n\n\t\tconst resolved: IResolvedUrl = {\n\t\t\tendpoints: {\n\t\t\t\tstorageUrl,\n\t\t\t\tdeltaStorageUrl,\n\t\t\t\tordererUrl,\n\t\t\t},\n\t\t\tid: documentId,\n\t\t\ttokens: { jwt: token },\n\t\t\ttype: \"fluid\",\n\t\t\turl: fluidUrl,\n\t\t};\n\t\treturn resolved;\n\t}\n\n\tpublic async getAbsoluteUrl(\n\t\tresolvedUrl: IResolvedUrl,\n\t\trelativeUrl: string,\n\t): Promise<string> {\n\t\tconst parsedUrl = new URL(resolvedUrl.url);\n\t\tassert(!!parsedUrl.pathname, 0x0b9 /* \"PathName should exist\" */);\n\t\tconst [, tenantId, documentId] = parsedUrl.pathname.split(\"/\");\n\t\tassert(!!tenantId, 0x0ba /* \"Tenant id should exist\" */);\n\t\tassert(!!documentId, 0x0bb /* \"Document id should exist\" */);\n\n\t\tlet url = relativeUrl;\n\t\tif (url.startsWith(\"/\")) {\n\t\t\turl = url.slice(1);\n\t\t}\n\n\t\treturn `${this.hostUrl}/${encodeURIComponent(tenantId)}/${encodeURIComponent(\n\t\t\tdocumentId,\n\t\t)}/${url}`;\n\t}\n}\n\n/**\n * @internal\n */\nexport interface IAlfredUser extends IUser {\n\tdisplayName: string;\n\tname: string;\n}\n\n/**\n * @internal\n */\nexport interface IConfig {\n\tserverUrl: string;\n\tblobStorageUrl: string;\n\ttenantId: string;\n\tdocumentId: string;\n}\n"]}
|
package/eslint.config.mts
CHANGED
|
@@ -4,13 +4,17 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { Linter } from "eslint";
|
|
7
|
-
import {
|
|
7
|
+
import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts";
|
|
8
8
|
|
|
9
9
|
const config: Linter.Config[] = [
|
|
10
|
-
...
|
|
10
|
+
...recommended,
|
|
11
11
|
{
|
|
12
12
|
rules: {
|
|
13
|
-
"@typescript-eslint/
|
|
13
|
+
"@typescript-eslint/no-unsafe-argument": "off",
|
|
14
|
+
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
15
|
+
"@typescript-eslint/no-unsafe-call": "off",
|
|
16
|
+
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
17
|
+
"import-x/no-nodejs-modules": ["error"],
|
|
14
18
|
"unicorn/filename-case": [
|
|
15
19
|
"error",
|
|
16
20
|
{
|
|
@@ -21,7 +25,7 @@ const config: Linter.Config[] = [
|
|
|
21
25
|
"ignore": [{}],
|
|
22
26
|
},
|
|
23
27
|
],
|
|
24
|
-
"
|
|
28
|
+
"unicorn/prefer-node-protocol": "off",
|
|
25
29
|
},
|
|
26
30
|
},
|
|
27
31
|
{
|
package/internal.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
|
-
* Generated by "flub generate entrypoints" in @fluid-tools/build-cli.
|
|
8
|
+
* Generated by "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./lib --node10TypeCompat" in @fluid-tools/build-cli.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
export * from "./lib/index.js";
|
package/lib/index.d.ts
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export { IAlfredUser, IConfig, RouterliciousUrlResolver } from "./urlResolver.js";
|
|
5
|
+
export { type IAlfredUser, type IConfig, RouterliciousUrlResolver } from "./urlResolver.js";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC"}
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAkC,wBAAwB,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { type IAlfredUser, type IConfig, RouterliciousUrlResolver } from \"./urlResolver.js\";\n"]}
|
package/lib/nconf.cjs
CHANGED
|
@@ -8,6 +8,6 @@ exports.Provider = void 0;
|
|
|
8
8
|
// This file serves as an intermediary module to export the 'Provider' named export from the 'nconf' module.
|
|
9
9
|
// It is written using ESM module syntax, making it compatible with both ESM and CJS module.
|
|
10
10
|
// This compatibility allows for flexible usage of the 'Provider' named export from the 'nconf' module across different module systems without modification.
|
|
11
|
-
|
|
11
|
+
var nconf_1 = require("nconf");
|
|
12
12
|
Object.defineProperty(exports, "Provider", { enumerable: true, get: function () { return nconf_1.Provider; } });
|
|
13
13
|
//# sourceMappingURL=nconf.cjs.map
|
package/lib/nconf.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nconf.cjs","sourceRoot":"","sources":["../src/nconf.cts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,4GAA4G;AAC5G,4FAA4F;AAC5F,4JAA4J;AAE5J
|
|
1
|
+
{"version":3,"file":"nconf.cjs","sourceRoot":"","sources":["../src/nconf.cts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,4GAA4G;AAC5G,4FAA4F;AAC5F,4JAA4J;AAE5J,+BAAiC;AAAxB,iGAAA,QAAQ,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// This file serves as an intermediary module to export the 'Provider' named export from the 'nconf' module.\n// It is written using ESM module syntax, making it compatible with both ESM and CJS module.\n// This compatibility allows for flexible usage of the 'Provider' named export from the 'nconf' module across different module systems without modification.\n\nexport { Provider } from \"nconf\";\n"]}
|
package/lib/nconf.d.cts
CHANGED
package/lib/nconf.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nconf.d.cts","sourceRoot":"","sources":["../src/nconf.cts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC
|
|
1
|
+
{"version":3,"file":"nconf.d.cts","sourceRoot":"","sources":["../src/nconf.cts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC"}
|
package/lib/public.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
|
-
* Generated by "flub generate entrypoints" in @fluid-tools/build-cli.
|
|
8
|
+
* Generated by "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./lib --node10TypeCompat" in @fluid-tools/build-cli.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
export {}
|
package/lib/urlResolver.d.ts
CHANGED
|
@@ -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 { IRequest } from "@fluidframework/core-interfaces";
|
|
6
|
-
import { IUser } from "@fluidframework/driver-definitions";
|
|
7
|
-
import { IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions/internal";
|
|
8
|
-
import { Provider } from "./nconf.cjs";
|
|
5
|
+
import type { IRequest } from "@fluidframework/core-interfaces";
|
|
6
|
+
import type { IUser } from "@fluidframework/driver-definitions";
|
|
7
|
+
import type { IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions/internal";
|
|
8
|
+
import type { Provider } from "./nconf.cjs";
|
|
9
9
|
/**
|
|
10
10
|
* @internal
|
|
11
11
|
*/
|
package/lib/urlResolver.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"urlResolver.d.ts","sourceRoot":"","sources":["../src/urlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"urlResolver.d.ts","sourceRoot":"","sources":["../src/urlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAEhE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAE9F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAQ5C;;GAEG;AACH,qBAAa,wBAAyB,YAAW,YAAY;IAE3D,OAAO,CAAC,QAAQ,CAAC,MAAM;IAGvB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAJP,MAAM,EACpB;QAAE,QAAQ,EAAE,QAAQ,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,GAC5D,SAAS,EACK,QAAQ,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EAC/B,OAAO,EAAE,MAAM;IAGjC;;OAEG;IACU,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC;IA4G7D,cAAc,CAC1B,WAAW,EAAE,YAAY,EACzB,WAAW,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC;CAgBlB;AAED;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,KAAK;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACnB"}
|
package/lib/urlResolver.js
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
6
|
-
const r11sServers = [
|
|
6
|
+
const r11sServers = new Set([
|
|
7
7
|
"www.wu2-ppe.prague.office-int.com",
|
|
8
8
|
"www.wu2.prague.office-int.com",
|
|
9
9
|
"www.eu.prague.office-int.com",
|
|
10
|
-
];
|
|
10
|
+
]);
|
|
11
11
|
/**
|
|
12
12
|
* @internal
|
|
13
13
|
*/
|
|
@@ -29,7 +29,7 @@ export class RouterliciousUrlResolver {
|
|
|
29
29
|
const reqUrl = new URL(requestedUrl);
|
|
30
30
|
const server = reqUrl.hostname.toLowerCase();
|
|
31
31
|
// If we don't have a valid server or a prescriptive config, we cannot resolve the URL
|
|
32
|
-
if (!(r11sServers.
|
|
32
|
+
if (!(r11sServers.has(server) ||
|
|
33
33
|
(server === "localhost" && reqUrl.port === "3000") ||
|
|
34
34
|
this.config)) {
|
|
35
35
|
return undefined;
|
|
@@ -54,7 +54,7 @@ export class RouterliciousUrlResolver {
|
|
|
54
54
|
const token = await this.getToken();
|
|
55
55
|
const isLocalHost = server === "localhost";
|
|
56
56
|
const isInternalRequest = server.includes("gateway"); // e.g. gateway:3000 || fierce-dog-gateway:3000
|
|
57
|
-
const serverSuffix = isLocalHost ? `${server}:3003` : server.
|
|
57
|
+
const serverSuffix = isLocalHost ? `${server}:3003` : server.slice(4);
|
|
58
58
|
let fluidUrl = "https://" +
|
|
59
59
|
`${this.config ? new URL(this.config.provider.get("worker:serverUrl")).host : serverSuffix}/` +
|
|
60
60
|
`${encodeURIComponent(tenantId)}/` +
|
|
@@ -116,7 +116,7 @@ export class RouterliciousUrlResolver {
|
|
|
116
116
|
assert(!!documentId, 0x0bb /* "Document id should exist" */);
|
|
117
117
|
let url = relativeUrl;
|
|
118
118
|
if (url.startsWith("/")) {
|
|
119
|
-
url = url.
|
|
119
|
+
url = url.slice(1);
|
|
120
120
|
}
|
|
121
121
|
return `${this.hostUrl}/${encodeURIComponent(tenantId)}/${encodeURIComponent(documentId)}/${url}`;
|
|
122
122
|
}
|
package/lib/urlResolver.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"urlResolver.js","sourceRoot":"","sources":["../src/urlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAM7D,MAAM,WAAW,GAAG;
|
|
1
|
+
{"version":3,"file":"urlResolver.js","sourceRoot":"","sources":["../src/urlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAM7D,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAC3B,mCAAmC;IACnC,+BAA+B;IAC/B,8BAA8B;CAC9B,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,OAAO,wBAAwB;IACpC,YACkB,MAEL,EACK,QAA+B,EAC/B,OAAe;QAJf,WAAM,GAAN,MAAM,CAEX;QACK,aAAQ,GAAR,QAAQ,CAAuB;QAC/B,YAAO,GAAP,OAAO,CAAQ;IAC9B,CAAC;IAEJ;;OAEG;IACI,KAAK,CAAC,OAAO,CAAC,OAAiB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,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAClE,MAAM,CAAC,EAAE,QAAQ,EAAE,UAAU,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC/D,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,8BAA8B,CAAC,CAAC;QACzD,MAAM,CAAC,CAAC,CAAC,UAAU,EAAE,KAAK,CAAC,gCAAgC,CAAC,CAAC;QAE7D,IAAI,GAAG,GAAG,WAAW,CAAC;QACtB,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACzB,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;QAED,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,kBAAkB,CAAC,QAAQ,CAAC,IAAI,kBAAkB,CAC3E,UAAU,CACV,IAAI,GAAG,EAAE,CAAC;IACZ,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IRequest } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IUser } from \"@fluidframework/driver-definitions\";\nimport type { IResolvedUrl, IUrlResolver } from \"@fluidframework/driver-definitions/internal\";\n\nimport type { Provider } from \"./nconf.cjs\";\n\nconst r11sServers = new Set([\n\t\"www.wu2-ppe.prague.office-int.com\",\n\t\"www.wu2.prague.office-int.com\",\n\t\"www.eu.prague.office-int.com\",\n]);\n\n/**\n * @internal\n */\nexport class RouterliciousUrlResolver implements IUrlResolver {\n\tconstructor(\n\t\tprivate readonly config:\n\t\t\t| { provider: Provider; tenantId: string; documentId: string }\n\t\t\t| undefined,\n\t\tprivate readonly getToken: () => Promise<string>,\n\t\tprivate readonly hostUrl: string,\n\t) {}\n\n\t/**\n\t * Handles a request and returns the relevant endpoints for the environment\n\t */\n\tpublic async resolve(request: IRequest): Promise<IResolvedUrl | undefined> {\n\t\tlet requestedUrl = request.url;\n\n\t\t// If we know the original hostname, reinsert it\n\t\tif (this.config && request.url.startsWith(\"/\")) {\n\t\t\trequestedUrl = `http://dummy:3000${request.url}`;\n\t\t}\n\n\t\tconst reqUrl = new URL(requestedUrl);\n\t\tconst server = reqUrl.hostname.toLowerCase();\n\n\t\t// If we don't have a valid server or a prescriptive config, we cannot resolve the URL\n\t\tif (\n\t\t\t!(\n\t\t\t\tr11sServers.has(server) ||\n\t\t\t\t(server === \"localhost\" && reqUrl.port === \"3000\") ||\n\t\t\t\tthis.config\n\t\t\t)\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst path = reqUrl.pathname.split(\"/\");\n\t\tlet tenantId: string;\n\t\tlet documentId: string;\n\t\tlet provider: Provider | undefined;\n\t\tif (this.config) {\n\t\t\ttenantId = this.config.tenantId;\n\t\t\tdocumentId = this.config.documentId;\n\t\t\tprovider = this.config.provider;\n\t\t} else if (path.length >= 4) {\n\t\t\ttenantId = path[2];\n\t\t\tdocumentId = path[3];\n\t\t} else {\n\t\t\ttenantId = \"fluid\";\n\t\t\tdocumentId = path[2];\n\t\t}\n\n\t\tconst token = await this.getToken();\n\n\t\tconst isLocalHost = server === \"localhost\";\n\t\tconst isInternalRequest = server.includes(\"gateway\"); // e.g. gateway:3000 || fierce-dog-gateway:3000\n\n\t\tconst serverSuffix = isLocalHost ? `${server}:3003` : server.slice(4);\n\n\t\tlet fluidUrl =\n\t\t\t\"https://\" +\n\t\t\t`${\n\t\t\t\tthis.config ? new URL(this.config.provider.get(\"worker:serverUrl\")).host : serverSuffix\n\t\t\t}/` +\n\t\t\t`${encodeURIComponent(tenantId)}/` +\n\t\t\t`${encodeURIComponent(documentId)}`;\n\n\t\t// In case of any additional parameters add them back to the url\n\t\tif (reqUrl.search) {\n\t\t\tconst searchParams = reqUrl.search;\n\t\t\tif (searchParams) {\n\t\t\t\tfluidUrl += searchParams;\n\t\t\t}\n\t\t}\n\n\t\tlet storageUrl = \"\";\n\t\tlet ordererUrl = \"\";\n\t\tlet deltaStorageUrl = \"\";\n\n\t\t// There is no provider when using debugging tooling\n\t\tif (provider && isInternalRequest) {\n\t\t\tstorageUrl = provider.get(\"worker:internalBlobStorageUrl\");\n\t\t\tordererUrl = provider.get(\"worker:alfredUrl\");\n\t\t\tdeltaStorageUrl = `${provider.get(\"worker:alfredUrl\")}/deltas/${encodeURIComponent(\n\t\t\t\ttenantId,\n\t\t\t)}/${encodeURIComponent(documentId)}`;\n\t\t} else if (provider) {\n\t\t\tstorageUrl = provider\n\t\t\t\t.get(\"worker:blobStorageUrl\")\n\t\t\t\t.replace(\"historian:3000\", \"localhost:3001\");\n\t\t\tordererUrl = provider.get(\"worker:serverUrl\");\n\t\t\tdeltaStorageUrl = `${ordererUrl}/deltas/${encodeURIComponent(\n\t\t\t\ttenantId,\n\t\t\t)}/${encodeURIComponent(documentId)}`;\n\t\t} else if (isLocalHost) {\n\t\t\tstorageUrl = `http://localhost:3001`;\n\t\t\tordererUrl = `http://localhost:3003`;\n\t\t\tdeltaStorageUrl = `http://localhost:3003/deltas/${tenantId}/${documentId}`;\n\t\t} else {\n\t\t\tstorageUrl = `https://historian.${serverSuffix}`;\n\t\t\tordererUrl = `https://alfred.${serverSuffix}`;\n\t\t\tdeltaStorageUrl = `https://alfred.${serverSuffix}/deltas/${tenantId}/${documentId}`;\n\t\t}\n\n\t\tstorageUrl += `/repos/${tenantId}`;\n\t\tordererUrl += ``;\n\t\tdeltaStorageUrl += ``;\n\n\t\tconst resolved: IResolvedUrl = {\n\t\t\tendpoints: {\n\t\t\t\tstorageUrl,\n\t\t\t\tdeltaStorageUrl,\n\t\t\t\tordererUrl,\n\t\t\t},\n\t\t\tid: documentId,\n\t\t\ttokens: { jwt: token },\n\t\t\ttype: \"fluid\",\n\t\t\turl: fluidUrl,\n\t\t};\n\t\treturn resolved;\n\t}\n\n\tpublic async getAbsoluteUrl(\n\t\tresolvedUrl: IResolvedUrl,\n\t\trelativeUrl: string,\n\t): Promise<string> {\n\t\tconst parsedUrl = new URL(resolvedUrl.url);\n\t\tassert(!!parsedUrl.pathname, 0x0b9 /* \"PathName should exist\" */);\n\t\tconst [, tenantId, documentId] = parsedUrl.pathname.split(\"/\");\n\t\tassert(!!tenantId, 0x0ba /* \"Tenant id should exist\" */);\n\t\tassert(!!documentId, 0x0bb /* \"Document id should exist\" */);\n\n\t\tlet url = relativeUrl;\n\t\tif (url.startsWith(\"/\")) {\n\t\t\turl = url.slice(1);\n\t\t}\n\n\t\treturn `${this.hostUrl}/${encodeURIComponent(tenantId)}/${encodeURIComponent(\n\t\t\tdocumentId,\n\t\t)}/${url}`;\n\t}\n}\n\n/**\n * @internal\n */\nexport interface IAlfredUser extends IUser {\n\tdisplayName: string;\n\tname: string;\n}\n\n/**\n * @internal\n */\nexport interface IConfig {\n\tserverUrl: string;\n\tblobStorageUrl: string;\n\ttenantId: string;\n\tdocumentId: string;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/routerlicious-urlresolver",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.92.0",
|
|
4
4
|
"description": "Url Resolver for routerlicious urls.",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -37,20 +37,20 @@
|
|
|
37
37
|
"main": "lib/index.js",
|
|
38
38
|
"types": "lib/public.d.ts",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@fluidframework/core-interfaces": "~2.
|
|
41
|
-
"@fluidframework/core-utils": "~2.
|
|
42
|
-
"@fluidframework/driver-definitions": "~2.
|
|
40
|
+
"@fluidframework/core-interfaces": "~2.92.0",
|
|
41
|
+
"@fluidframework/core-utils": "~2.92.0",
|
|
42
|
+
"@fluidframework/driver-definitions": "~2.92.0",
|
|
43
43
|
"nconf": "^0.12.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
47
47
|
"@biomejs/biome": "~2.4.5",
|
|
48
|
-
"@fluid-internal/mocha-test-setup": "~2.
|
|
49
|
-
"@fluid-tools/build-cli": "^0.
|
|
48
|
+
"@fluid-internal/mocha-test-setup": "~2.92.0",
|
|
49
|
+
"@fluid-tools/build-cli": "^0.64.0",
|
|
50
50
|
"@fluidframework/build-common": "^2.0.3",
|
|
51
|
-
"@fluidframework/build-tools": "^0.
|
|
52
|
-
"@fluidframework/eslint-config-fluid": "
|
|
53
|
-
"@fluidframework/routerlicious-urlresolver-previous": "npm:@fluidframework/routerlicious-urlresolver@2.
|
|
51
|
+
"@fluidframework/build-tools": "^0.64.0",
|
|
52
|
+
"@fluidframework/eslint-config-fluid": "^9.0.0",
|
|
53
|
+
"@fluidframework/routerlicious-urlresolver-previous": "npm:@fluidframework/routerlicious-urlresolver@2.91.0",
|
|
54
54
|
"@microsoft/api-extractor": "7.52.11",
|
|
55
55
|
"@types/mocha": "^10.0.10",
|
|
56
56
|
"@types/nconf": "^0.10.0",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
},
|
|
73
73
|
"scripts": {
|
|
74
74
|
"api": "fluid-build . --task api",
|
|
75
|
-
"api-extractor:commonjs": "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./dist",
|
|
75
|
+
"api-extractor:commonjs": "flub generate entrypoints --resolutionConditions require --outFileLegacyBeta legacy --outDir ./dist",
|
|
76
76
|
"api-extractor:esnext": "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./lib --node10TypeCompat",
|
|
77
77
|
"build": "fluid-build . --task build",
|
|
78
78
|
"build:commonjs": "fluid-build . --task commonjs",
|
package/src/index.ts
CHANGED
package/src/nconf.cts
CHANGED
|
@@ -7,6 +7,4 @@
|
|
|
7
7
|
// It is written using ESM module syntax, making it compatible with both ESM and CJS module.
|
|
8
8
|
// This compatibility allows for flexible usage of the 'Provider' named export from the 'nconf' module across different module systems without modification.
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export { Provider };
|
|
10
|
+
export { Provider } from "nconf";
|
package/src/urlResolver.ts
CHANGED
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { IRequest } from "@fluidframework/core-interfaces";
|
|
6
|
+
import type { IRequest } from "@fluidframework/core-interfaces";
|
|
7
7
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
8
|
-
import { IUser } from "@fluidframework/driver-definitions";
|
|
9
|
-
import { IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions/internal";
|
|
8
|
+
import type { IUser } from "@fluidframework/driver-definitions";
|
|
9
|
+
import type { IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions/internal";
|
|
10
10
|
|
|
11
|
-
import { Provider } from "./nconf.cjs";
|
|
11
|
+
import type { Provider } from "./nconf.cjs";
|
|
12
12
|
|
|
13
|
-
const r11sServers = [
|
|
13
|
+
const r11sServers = new Set([
|
|
14
14
|
"www.wu2-ppe.prague.office-int.com",
|
|
15
15
|
"www.wu2.prague.office-int.com",
|
|
16
16
|
"www.eu.prague.office-int.com",
|
|
17
|
-
];
|
|
17
|
+
]);
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* @internal
|
|
@@ -45,7 +45,7 @@ export class RouterliciousUrlResolver implements IUrlResolver {
|
|
|
45
45
|
// If we don't have a valid server or a prescriptive config, we cannot resolve the URL
|
|
46
46
|
if (
|
|
47
47
|
!(
|
|
48
|
-
r11sServers.
|
|
48
|
+
r11sServers.has(server) ||
|
|
49
49
|
(server === "localhost" && reqUrl.port === "3000") ||
|
|
50
50
|
this.config
|
|
51
51
|
)
|
|
@@ -74,7 +74,7 @@ export class RouterliciousUrlResolver implements IUrlResolver {
|
|
|
74
74
|
const isLocalHost = server === "localhost";
|
|
75
75
|
const isInternalRequest = server.includes("gateway"); // e.g. gateway:3000 || fierce-dog-gateway:3000
|
|
76
76
|
|
|
77
|
-
const serverSuffix = isLocalHost ? `${server}:3003` : server.
|
|
77
|
+
const serverSuffix = isLocalHost ? `${server}:3003` : server.slice(4);
|
|
78
78
|
|
|
79
79
|
let fluidUrl =
|
|
80
80
|
"https://" +
|
|
@@ -151,7 +151,7 @@ export class RouterliciousUrlResolver implements IUrlResolver {
|
|
|
151
151
|
|
|
152
152
|
let url = relativeUrl;
|
|
153
153
|
if (url.startsWith("/")) {
|
|
154
|
-
url = url.
|
|
154
|
+
url = url.slice(1);
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
return `${this.hostUrl}/${encodeURIComponent(tenantId)}/${encodeURIComponent(
|