@fluidframework/routerlicious-urlresolver 2.0.0-internal.7.3.0 → 2.0.0-internal.8.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 +8 -0
- package/api-extractor-lint.json +13 -0
- package/api-extractor.json +12 -0
- package/api-report/routerlicious-urlresolver.api.md +47 -0
- package/dist/routerlicious-urlresolver-alpha.d.ts +13 -0
- package/dist/routerlicious-urlresolver-beta.d.ts +19 -0
- package/dist/routerlicious-urlresolver-public.d.ts +19 -0
- package/dist/routerlicious-urlresolver-untrimmed.d.ts +44 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/urlResolver.cjs +3 -0
- package/dist/urlResolver.cjs.map +1 -1
- package/dist/urlResolver.d.ts +9 -0
- package/dist/urlResolver.d.ts.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/routerlicious-urlresolver-alpha.d.ts +13 -0
- package/lib/routerlicious-urlresolver-beta.d.ts +19 -0
- package/lib/routerlicious-urlresolver-public.d.ts +19 -0
- package/lib/routerlicious-urlresolver-untrimmed.d.ts +44 -0
- package/lib/urlResolver.d.ts +9 -0
- package/lib/urlResolver.d.ts.map +1 -1
- package/lib/urlResolver.mjs +3 -0
- package/lib/urlResolver.mjs.map +1 -1
- package/package.json +32 -22
- package/src/urlResolver.ts +9 -0
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"extends": "../../../common/build/build-common/api-extractor-lint.json",
|
|
4
|
+
"messages": {
|
|
5
|
+
"extractorMessageReporting": {
|
|
6
|
+
// TODO: remove once base config has this enabled as an error
|
|
7
|
+
"ae-incompatible-release-tags": {
|
|
8
|
+
"logLevel": "error",
|
|
9
|
+
"addToApiReportFile": false
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
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.json",
|
|
4
|
+
"messages": {
|
|
5
|
+
"extractorMessageReporting": {
|
|
6
|
+
// TODO: Add missing documentation and remove this rule override
|
|
7
|
+
"ae-undocumented": {
|
|
8
|
+
"logLevel": "none"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
## API Report File for "@fluidframework/routerlicious-urlresolver"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
import { IRequest } from '@fluidframework/core-interfaces';
|
|
8
|
+
import { IResolvedUrl } from '@fluidframework/driver-definitions';
|
|
9
|
+
import { IUrlResolver } from '@fluidframework/driver-definitions';
|
|
10
|
+
import { IUser } from '@fluidframework/protocol-definitions';
|
|
11
|
+
import { Provider } from 'nconf';
|
|
12
|
+
|
|
13
|
+
// @internal (undocumented)
|
|
14
|
+
export interface IAlfredUser extends IUser {
|
|
15
|
+
// (undocumented)
|
|
16
|
+
displayName: string;
|
|
17
|
+
// (undocumented)
|
|
18
|
+
name: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// @internal (undocumented)
|
|
22
|
+
export interface IConfig {
|
|
23
|
+
// (undocumented)
|
|
24
|
+
blobStorageUrl: string;
|
|
25
|
+
// (undocumented)
|
|
26
|
+
documentId: string;
|
|
27
|
+
// (undocumented)
|
|
28
|
+
serverUrl: string;
|
|
29
|
+
// (undocumented)
|
|
30
|
+
tenantId: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// @internal (undocumented)
|
|
34
|
+
export class RouterliciousUrlResolver implements IUrlResolver {
|
|
35
|
+
constructor(config: {
|
|
36
|
+
provider: Provider;
|
|
37
|
+
tenantId: string;
|
|
38
|
+
documentId: string;
|
|
39
|
+
} | undefined, getToken: () => Promise<string>, hostUrl: string);
|
|
40
|
+
// (undocumented)
|
|
41
|
+
getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string>;
|
|
42
|
+
resolve(request: IRequest): Promise<IResolvedUrl | undefined>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// (No @packageDocumentation comment for this package)
|
|
46
|
+
|
|
47
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IRequest } from '@fluidframework/core-interfaces';
|
|
2
|
+
import { IResolvedUrl } from '@fluidframework/driver-definitions';
|
|
3
|
+
import { IUrlResolver } from '@fluidframework/driver-definitions';
|
|
4
|
+
import { IUser } from '@fluidframework/protocol-definitions';
|
|
5
|
+
import { Provider } from 'nconf';
|
|
6
|
+
|
|
7
|
+
/* Excluded from this release type: IAlfredUser */
|
|
8
|
+
|
|
9
|
+
/* Excluded from this release type: IConfig */
|
|
10
|
+
|
|
11
|
+
/* Excluded from this release type: RouterliciousUrlResolver */
|
|
12
|
+
|
|
13
|
+
export { }
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IRequest } from '@fluidframework/core-interfaces';
|
|
2
|
+
import { IResolvedUrl } from '@fluidframework/driver-definitions';
|
|
3
|
+
import { IUrlResolver } from '@fluidframework/driver-definitions';
|
|
4
|
+
import { IUser } from '@fluidframework/protocol-definitions';
|
|
5
|
+
import { Provider } from 'nconf';
|
|
6
|
+
|
|
7
|
+
/* Excluded from this release type: IAlfredUser */
|
|
8
|
+
|
|
9
|
+
/* Excluded from this release type: IConfig */
|
|
10
|
+
|
|
11
|
+
/* Excluded from this release type: IRequest */
|
|
12
|
+
|
|
13
|
+
/* Excluded from this release type: IResolvedUrl */
|
|
14
|
+
|
|
15
|
+
/* Excluded from this release type: IUrlResolver */
|
|
16
|
+
|
|
17
|
+
/* Excluded from this release type: RouterliciousUrlResolver */
|
|
18
|
+
|
|
19
|
+
export { }
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IRequest } from '@fluidframework/core-interfaces';
|
|
2
|
+
import { IResolvedUrl } from '@fluidframework/driver-definitions';
|
|
3
|
+
import { IUrlResolver } from '@fluidframework/driver-definitions';
|
|
4
|
+
import { IUser } from '@fluidframework/protocol-definitions';
|
|
5
|
+
import { Provider } from 'nconf';
|
|
6
|
+
|
|
7
|
+
/* Excluded from this release type: IAlfredUser */
|
|
8
|
+
|
|
9
|
+
/* Excluded from this release type: IConfig */
|
|
10
|
+
|
|
11
|
+
/* Excluded from this release type: IRequest */
|
|
12
|
+
|
|
13
|
+
/* Excluded from this release type: IResolvedUrl */
|
|
14
|
+
|
|
15
|
+
/* Excluded from this release type: IUrlResolver */
|
|
16
|
+
|
|
17
|
+
/* Excluded from this release type: RouterliciousUrlResolver */
|
|
18
|
+
|
|
19
|
+
export { }
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { IRequest } from '@fluidframework/core-interfaces';
|
|
2
|
+
import { IResolvedUrl } from '@fluidframework/driver-definitions';
|
|
3
|
+
import { IUrlResolver } from '@fluidframework/driver-definitions';
|
|
4
|
+
import { IUser } from '@fluidframework/protocol-definitions';
|
|
5
|
+
import { Provider } from 'nconf';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare interface IAlfredUser extends IUser {
|
|
11
|
+
displayName: string;
|
|
12
|
+
name: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export declare interface IConfig {
|
|
19
|
+
serverUrl: string;
|
|
20
|
+
blobStorageUrl: string;
|
|
21
|
+
tenantId: string;
|
|
22
|
+
documentId: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export declare class RouterliciousUrlResolver implements IUrlResolver {
|
|
29
|
+
private readonly config;
|
|
30
|
+
private readonly getToken;
|
|
31
|
+
private readonly hostUrl;
|
|
32
|
+
constructor(config: {
|
|
33
|
+
provider: Provider;
|
|
34
|
+
tenantId: string;
|
|
35
|
+
documentId: string;
|
|
36
|
+
} | undefined, getToken: () => Promise<string>, hostUrl: string);
|
|
37
|
+
/**
|
|
38
|
+
* Handles a request and returns the relevant endpoints for the environment
|
|
39
|
+
*/
|
|
40
|
+
resolve(request: IRequest): Promise<IResolvedUrl | undefined>;
|
|
41
|
+
getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { }
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.38.3"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
package/dist/urlResolver.cjs
CHANGED
package/dist/urlResolver.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"urlResolver.cjs","sourceRoot":"","sources":["../src/urlResolver.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6BAA4B;AAC5B,2DAAoD;AAMpD,MAAM,WAAW,GAAG;IACnB,mCAAmC;IACnC,+BAA+B;IAC/B,8BAA8B;CAC9B,CAAC;AAEF,MAAa,wBAAwB;IACpC,YACkB,MAEL,EACK,QAA+B,EAC/B,OAAe;QAJf,WAAM,GAAN,MAAM,CAEX;QACK,aAAQ,GAAR,QAAQ,CAAuB;QAC/B,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C;QAClE,MAAM,CAAC,EAAE,QAAQ,EAAE,UAAU,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC/D,IAAA,mBAAM,EAAC,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,8BAA8B,CAAC,CAAC;QACzD,IAAA,mBAAM,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;YACxB,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SACpB;QAED,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,kBAAkB,CAAC,QAAQ,CAAC,IAAI,kBAAkB,CAC3E,UAAU,CACV,IAAI,GAAG,EAAE,CAAC;IACZ,CAAC;CACD;AA1ID,4DA0IC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { parse } from \"url\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { IResolvedUrl, IUrlResolver } from \"@fluidframework/driver-definitions\";\nimport { IUser } from \"@fluidframework/protocol-definitions\";\nimport { Provider } from \"nconf\";\n\nconst r11sServers = [\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\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.includes(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.substring(4);\n\n\t\tlet fluidUrl =\n\t\t\t\"fluid://\" +\n\t\t\t`${\n\t\t\t\tthis.config\n\t\t\t\t\t? parse(this.config.provider.get(\"worker:serverUrl\")).host\n\t\t\t\t\t: 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(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string> {\n\t\tconst parsedUrl = parse(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.substr(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\nexport interface IAlfredUser extends IUser {\n\tdisplayName: string;\n\tname: string;\n}\n\nexport interface IConfig {\n\tserverUrl: string;\n\tblobStorageUrl: string;\n\ttenantId: string;\n\tdocumentId: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"urlResolver.cjs","sourceRoot":"","sources":["../src/urlResolver.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6BAA4B;AAC5B,2DAAoD;AAMpD,MAAM,WAAW,GAAG;IACnB,mCAAmC;IACnC,+BAA+B;IAC/B,8BAA8B;CAC9B,CAAC;AAEF;;GAEG;AACH,MAAa,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;QACrC,IAAI,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC;QAE/B,gDAAgD;QAChD,IAAI,IAAI,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;YAC/C,YAAY,GAAG,oBAAoB,OAAO,CAAC,GAAG,EAAE,CAAC;SACjD;QAED,MAAM,MAAM,GAA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,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;YACxB,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SACpB;QAED,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,kBAAkB,CAAC,QAAQ,CAAC,IAAI,kBAAkB,CAC3E,UAAU,CACV,IAAI,GAAG,EAAE,CAAC;IACZ,CAAC;CACD;AA1ID,4DA0IC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { parse } from \"url\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { IResolvedUrl, IUrlResolver } from \"@fluidframework/driver-definitions\";\nimport { IUser } from \"@fluidframework/protocol-definitions\";\nimport { Provider } from \"nconf\";\n\nconst r11sServers = [\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.includes(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.substring(4);\n\n\t\tlet fluidUrl =\n\t\t\t\"fluid://\" +\n\t\t\t`${\n\t\t\t\tthis.config\n\t\t\t\t\t? parse(this.config.provider.get(\"worker:serverUrl\")).host\n\t\t\t\t\t: 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(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string> {\n\t\tconst parsedUrl = parse(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.substr(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/dist/urlResolver.d.ts
CHANGED
|
@@ -6,6 +6,9 @@ import { IRequest } from "@fluidframework/core-interfaces";
|
|
|
6
6
|
import { IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions";
|
|
7
7
|
import { IUser } from "@fluidframework/protocol-definitions";
|
|
8
8
|
import { Provider } from "nconf";
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
9
12
|
export declare class RouterliciousUrlResolver implements IUrlResolver {
|
|
10
13
|
private readonly config;
|
|
11
14
|
private readonly getToken;
|
|
@@ -21,10 +24,16 @@ export declare class RouterliciousUrlResolver implements IUrlResolver {
|
|
|
21
24
|
resolve(request: IRequest): Promise<IResolvedUrl | undefined>;
|
|
22
25
|
getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string>;
|
|
23
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
24
30
|
export interface IAlfredUser extends IUser {
|
|
25
31
|
displayName: string;
|
|
26
32
|
name: string;
|
|
27
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
28
37
|
export interface IConfig {
|
|
29
38
|
serverUrl: string;
|
|
30
39
|
blobStorageUrl: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"urlResolver.d.ts","sourceRoot":"","sources":["../src/urlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,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AAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAQjC;;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;IA8G7D,cAAc,CAAC,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAgB5F;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/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";
|
|
5
|
+
export { IAlfredUser, IConfig, RouterliciousUrlResolver } from "./urlResolver.mjs";
|
|
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;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,WAAW,EAAE,OAAO,EAAE,wBAAwB,EAAE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IRequest } from '@fluidframework/core-interfaces';
|
|
2
|
+
import { IResolvedUrl } from '@fluidframework/driver-definitions';
|
|
3
|
+
import { IUrlResolver } from '@fluidframework/driver-definitions';
|
|
4
|
+
import { IUser } from '@fluidframework/protocol-definitions';
|
|
5
|
+
import { Provider } from 'nconf';
|
|
6
|
+
|
|
7
|
+
/* Excluded from this release type: IAlfredUser */
|
|
8
|
+
|
|
9
|
+
/* Excluded from this release type: IConfig */
|
|
10
|
+
|
|
11
|
+
/* Excluded from this release type: RouterliciousUrlResolver */
|
|
12
|
+
|
|
13
|
+
export { }
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IRequest } from '@fluidframework/core-interfaces';
|
|
2
|
+
import { IResolvedUrl } from '@fluidframework/driver-definitions';
|
|
3
|
+
import { IUrlResolver } from '@fluidframework/driver-definitions';
|
|
4
|
+
import { IUser } from '@fluidframework/protocol-definitions';
|
|
5
|
+
import { Provider } from 'nconf';
|
|
6
|
+
|
|
7
|
+
/* Excluded from this release type: IAlfredUser */
|
|
8
|
+
|
|
9
|
+
/* Excluded from this release type: IConfig */
|
|
10
|
+
|
|
11
|
+
/* Excluded from this release type: IRequest */
|
|
12
|
+
|
|
13
|
+
/* Excluded from this release type: IResolvedUrl */
|
|
14
|
+
|
|
15
|
+
/* Excluded from this release type: IUrlResolver */
|
|
16
|
+
|
|
17
|
+
/* Excluded from this release type: RouterliciousUrlResolver */
|
|
18
|
+
|
|
19
|
+
export { }
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IRequest } from '@fluidframework/core-interfaces';
|
|
2
|
+
import { IResolvedUrl } from '@fluidframework/driver-definitions';
|
|
3
|
+
import { IUrlResolver } from '@fluidframework/driver-definitions';
|
|
4
|
+
import { IUser } from '@fluidframework/protocol-definitions';
|
|
5
|
+
import { Provider } from 'nconf';
|
|
6
|
+
|
|
7
|
+
/* Excluded from this release type: IAlfredUser */
|
|
8
|
+
|
|
9
|
+
/* Excluded from this release type: IConfig */
|
|
10
|
+
|
|
11
|
+
/* Excluded from this release type: IRequest */
|
|
12
|
+
|
|
13
|
+
/* Excluded from this release type: IResolvedUrl */
|
|
14
|
+
|
|
15
|
+
/* Excluded from this release type: IUrlResolver */
|
|
16
|
+
|
|
17
|
+
/* Excluded from this release type: RouterliciousUrlResolver */
|
|
18
|
+
|
|
19
|
+
export { }
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { IRequest } from '@fluidframework/core-interfaces';
|
|
2
|
+
import { IResolvedUrl } from '@fluidframework/driver-definitions';
|
|
3
|
+
import { IUrlResolver } from '@fluidframework/driver-definitions';
|
|
4
|
+
import { IUser } from '@fluidframework/protocol-definitions';
|
|
5
|
+
import { Provider } from 'nconf';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare interface IAlfredUser extends IUser {
|
|
11
|
+
displayName: string;
|
|
12
|
+
name: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export declare interface IConfig {
|
|
19
|
+
serverUrl: string;
|
|
20
|
+
blobStorageUrl: string;
|
|
21
|
+
tenantId: string;
|
|
22
|
+
documentId: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export declare class RouterliciousUrlResolver implements IUrlResolver {
|
|
29
|
+
private readonly config;
|
|
30
|
+
private readonly getToken;
|
|
31
|
+
private readonly hostUrl;
|
|
32
|
+
constructor(config: {
|
|
33
|
+
provider: Provider;
|
|
34
|
+
tenantId: string;
|
|
35
|
+
documentId: string;
|
|
36
|
+
} | undefined, getToken: () => Promise<string>, hostUrl: string);
|
|
37
|
+
/**
|
|
38
|
+
* Handles a request and returns the relevant endpoints for the environment
|
|
39
|
+
*/
|
|
40
|
+
resolve(request: IRequest): Promise<IResolvedUrl | undefined>;
|
|
41
|
+
getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { }
|
package/lib/urlResolver.d.ts
CHANGED
|
@@ -6,6 +6,9 @@ import { IRequest } from "@fluidframework/core-interfaces";
|
|
|
6
6
|
import { IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions";
|
|
7
7
|
import { IUser } from "@fluidframework/protocol-definitions";
|
|
8
8
|
import { Provider } from "nconf";
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
9
12
|
export declare class RouterliciousUrlResolver implements IUrlResolver {
|
|
10
13
|
private readonly config;
|
|
11
14
|
private readonly getToken;
|
|
@@ -21,10 +24,16 @@ export declare class RouterliciousUrlResolver implements IUrlResolver {
|
|
|
21
24
|
resolve(request: IRequest): Promise<IResolvedUrl | undefined>;
|
|
22
25
|
getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string>;
|
|
23
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
24
30
|
export interface IAlfredUser extends IUser {
|
|
25
31
|
displayName: string;
|
|
26
32
|
name: string;
|
|
27
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
28
37
|
export interface IConfig {
|
|
29
38
|
serverUrl: string;
|
|
30
39
|
blobStorageUrl: string;
|
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;
|
|
1
|
+
{"version":3,"file":"urlResolver.d.ts","sourceRoot":"","sources":["../src/urlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAII,EAAE,QAAQ,EAAE,MAAM,iCAAiC;OACnD,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oCAAoC;OACxE,EAAE,KAAK,EAAE,MAAM,sCAAsC;OACrD,EAAE,QAAQ,EAAE,MAAM,OAAO;AAQhC;;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;IA8G7D,cAAc,CAAC,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAgB5F;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.mjs
CHANGED
package/lib/urlResolver.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|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V;YACD,EAAE,EAAE,UAAU;YACd,MAAM,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE;YACtB,IAAI,EAAE,OAAO;YACb,GAAG,EAAE,QAAQ;SACb,CAAC;QACF,OAAO,QAAQ,CAAC;IACjB,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,WAAyB,EAAE,WAAmB;QACzE,MAAM,SAAS,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACzC,MAAM,CAAC,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,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;YACxB,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SACpB;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 { parse } from \"url\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { IResolvedUrl, IUrlResolver } from \"@fluidframework/driver-definitions\";\nimport { IUser } from \"@fluidframework/protocol-definitions\";\nimport { Provider } from \"nconf\";\n\nconst r11sServers = [\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\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.includes(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.substring(4);\n\n\t\tlet fluidUrl =\n\t\t\t\"fluid://\" +\n\t\t\t`${\n\t\t\t\tthis.config\n\t\t\t\t\t? parse(this.config.provider.get(\"worker:serverUrl\")).host\n\t\t\t\t\t: 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(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string> {\n\t\tconst parsedUrl = parse(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.substr(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\nexport interface IAlfredUser extends IUser {\n\tdisplayName: string;\n\tname: string;\n}\n\nexport interface IConfig {\n\tserverUrl: string;\n\tblobStorageUrl: string;\n\ttenantId: string;\n\tdocumentId: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"urlResolver.mjs","sourceRoot":"","sources":["../src/urlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,KAAK,EAAE,MAAM,KAAK;OACpB,EAAE,MAAM,EAAE,MAAM,4BAA4B;AAMnD,MAAM,WAAW,GAAG;IACnB,mCAAmC;IACnC,+BAA+B;IAC/B,8BAA8B;CAC9B,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,wBAAwB;IACpC,YACkB,MAEL,EACK,QAA+B,EAC/B,OAAe;QAJf,WAA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AQ,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;YACxB,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SACpB;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 { parse } from \"url\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { IResolvedUrl, IUrlResolver } from \"@fluidframework/driver-definitions\";\nimport { IUser } from \"@fluidframework/protocol-definitions\";\nimport { Provider } from \"nconf\";\n\nconst r11sServers = [\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.includes(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.substring(4);\n\n\t\tlet fluidUrl =\n\t\t\t\"fluid://\" +\n\t\t\t`${\n\t\t\t\tthis.config\n\t\t\t\t\t? parse(this.config.provider.get(\"worker:serverUrl\")).host\n\t\t\t\t\t: 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(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string> {\n\t\tconst parsedUrl = parse(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.substr(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.0.0-internal.
|
|
3
|
+
"version": "2.0.0-internal.8.0.0",
|
|
4
4
|
"description": "Url Resolver for routerlicious urls.",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -11,40 +11,31 @@
|
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"author": "Microsoft and contributors",
|
|
13
13
|
"sideEffects": false,
|
|
14
|
-
"exports": {
|
|
15
|
-
".": {
|
|
16
|
-
"import": {
|
|
17
|
-
"types": "./lib/index.d.ts",
|
|
18
|
-
"default": "./lib/index.mjs"
|
|
19
|
-
},
|
|
20
|
-
"require": {
|
|
21
|
-
"types": "./dist/index.d.ts",
|
|
22
|
-
"default": "./dist/index.cjs"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
14
|
"main": "dist/index.cjs",
|
|
27
15
|
"module": "lib/index.mjs",
|
|
28
16
|
"types": "dist/index.d.ts",
|
|
29
17
|
"dependencies": {
|
|
30
|
-
"@fluidframework/core-interfaces": ">=2.0.0-internal.
|
|
31
|
-
"@fluidframework/core-utils": ">=2.0.0-internal.
|
|
32
|
-
"@fluidframework/driver-definitions": ">=2.0.0-internal.
|
|
18
|
+
"@fluidframework/core-interfaces": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
|
|
19
|
+
"@fluidframework/core-utils": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
|
|
20
|
+
"@fluidframework/driver-definitions": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
|
|
33
21
|
"@fluidframework/protocol-definitions": "^3.0.0",
|
|
34
22
|
"nconf": "^0.12.0",
|
|
35
23
|
"url": "^0.11.0"
|
|
36
24
|
},
|
|
37
25
|
"devDependencies": {
|
|
26
|
+
"@arethetypeswrong/cli": "^0.13.3",
|
|
38
27
|
"@fluid-tools/build-cli": "^0.28.0",
|
|
39
28
|
"@fluidframework/build-common": "^2.0.3",
|
|
40
29
|
"@fluidframework/build-tools": "^0.28.0",
|
|
41
30
|
"@fluidframework/eslint-config-fluid": "^3.1.0",
|
|
42
|
-
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.
|
|
31
|
+
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
|
|
43
32
|
"@fluidframework/routerlicious-urlresolver-previous": "npm:@fluidframework/routerlicious-urlresolver@2.0.0-internal.7.2.0",
|
|
33
|
+
"@microsoft/api-extractor": "^7.38.3",
|
|
44
34
|
"@types/mocha": "^9.1.1",
|
|
45
35
|
"@types/nconf": "^0.10.0",
|
|
46
|
-
"@types/node": "^
|
|
36
|
+
"@types/node": "^18.19.0",
|
|
47
37
|
"assert": "^2.0.0",
|
|
38
|
+
"copyfiles": "^2.4.1",
|
|
48
39
|
"cross-env": "^7.0.3",
|
|
49
40
|
"eslint": "~8.50.0",
|
|
50
41
|
"mocha": "^10.2.0",
|
|
@@ -56,23 +47,42 @@
|
|
|
56
47
|
"tsc-multi": "^1.1.0",
|
|
57
48
|
"typescript": "~5.1.6"
|
|
58
49
|
},
|
|
50
|
+
"fluidBuild": {
|
|
51
|
+
"tasks": {
|
|
52
|
+
"build:docs": {
|
|
53
|
+
"dependsOn": [
|
|
54
|
+
"...",
|
|
55
|
+
"api-extractor:commonjs",
|
|
56
|
+
"api-extractor:esnext"
|
|
57
|
+
],
|
|
58
|
+
"script": false
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
59
62
|
"typeValidation": {
|
|
60
63
|
"broken": {}
|
|
61
64
|
},
|
|
62
65
|
"scripts": {
|
|
66
|
+
"api": "fluid-build . --task api",
|
|
67
|
+
"api-extractor:commonjs": "api-extractor run --local",
|
|
68
|
+
"api-extractor:esnext": "copyfiles -u 1 \"dist/**/*-@(alpha|beta|public|untrimmed).d.ts\" lib",
|
|
63
69
|
"build": "fluid-build . --task build",
|
|
64
70
|
"build:commonjs": "fluid-build . --task commonjs",
|
|
65
71
|
"build:compile": "fluid-build . --task compile",
|
|
72
|
+
"build:docs": "fluid-build . --task api",
|
|
66
73
|
"build:esnext": "tsc-multi --config ../../../common/build/build-common/tsc-multi.esm.json",
|
|
67
74
|
"build:test": "tsc-multi --config ./tsc-multi.test.json",
|
|
68
|
-
"
|
|
75
|
+
"check:are-the-types-wrong": "attw --pack",
|
|
76
|
+
"check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
|
|
77
|
+
"ci:build:docs": "api-extractor run",
|
|
78
|
+
"clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
|
|
69
79
|
"eslint": "eslint --format stylish src",
|
|
70
80
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
71
81
|
"format": "npm run prettier:fix",
|
|
72
|
-
"lint": "npm run prettier && npm run eslint",
|
|
82
|
+
"lint": "npm run prettier && npm run check:release-tags && npm run eslint",
|
|
73
83
|
"lint:fix": "npm run prettier:fix && npm run eslint:fix",
|
|
74
|
-
"prettier": "prettier --check . --ignore-path ../../../.prettierignore",
|
|
75
|
-
"prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
|
|
84
|
+
"prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
|
|
85
|
+
"prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
|
|
76
86
|
"test": "npm run test:mocha",
|
|
77
87
|
"test:mocha": "mocha --ignore \"dist/test/types/*\" --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup",
|
|
78
88
|
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
package/src/urlResolver.ts
CHANGED
|
@@ -16,6 +16,9 @@ const r11sServers = [
|
|
|
16
16
|
"www.eu.prague.office-int.com",
|
|
17
17
|
];
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
19
22
|
export class RouterliciousUrlResolver implements IUrlResolver {
|
|
20
23
|
constructor(
|
|
21
24
|
private readonly config:
|
|
@@ -156,11 +159,17 @@ export class RouterliciousUrlResolver implements IUrlResolver {
|
|
|
156
159
|
}
|
|
157
160
|
}
|
|
158
161
|
|
|
162
|
+
/**
|
|
163
|
+
* @internal
|
|
164
|
+
*/
|
|
159
165
|
export interface IAlfredUser extends IUser {
|
|
160
166
|
displayName: string;
|
|
161
167
|
name: string;
|
|
162
168
|
}
|
|
163
169
|
|
|
170
|
+
/**
|
|
171
|
+
* @internal
|
|
172
|
+
*/
|
|
164
173
|
export interface IConfig {
|
|
165
174
|
serverUrl: string;
|
|
166
175
|
blobStorageUrl: string;
|