@fluidframework/local-driver 2.1.0-274160 → 2.1.0-276985
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/README.md +3 -1
- package/dist/legacy.d.ts +1 -1
- package/dist/localDocumentServiceFactory.d.ts +1 -0
- package/dist/localDocumentServiceFactory.d.ts.map +1 -1
- package/dist/localDocumentServiceFactory.js +1 -0
- package/dist/localDocumentServiceFactory.js.map +1 -1
- package/dist/localResolver.d.ts +2 -0
- package/dist/localResolver.d.ts.map +1 -1
- package/dist/localResolver.js +2 -0
- package/dist/localResolver.js.map +1 -1
- package/lib/legacy.d.ts +1 -1
- package/lib/localDocumentServiceFactory.d.ts +1 -0
- package/lib/localDocumentServiceFactory.d.ts.map +1 -1
- package/lib/localDocumentServiceFactory.js +1 -0
- package/lib/localDocumentServiceFactory.js.map +1 -1
- package/lib/localResolver.d.ts +2 -0
- package/lib/localResolver.d.ts.map +1 -1
- package/lib/localResolver.js +2 -0
- package/lib/localResolver.js.map +1 -1
- package/package.json +12 -12
- package/src/localDocumentServiceFactory.ts +1 -0
- package/src/localResolver.ts +2 -0
- /package/api-report/{local-driver.alpha.api.md → local-driver.legacy.alpha.api.md} +0 -0
package/README.md
CHANGED
|
@@ -7,10 +7,12 @@
|
|
|
7
7
|
|
|
8
8
|
## Using Fluid Framework libraries
|
|
9
9
|
|
|
10
|
-
When taking a dependency on a Fluid Framework library, we recommend using a `^` (caret) version range, such as `^1.3.4`.
|
|
10
|
+
When taking a dependency on a Fluid Framework library's public APIs, we recommend using a `^` (caret) version range, such as `^1.3.4`.
|
|
11
11
|
While Fluid Framework libraries may use different ranges with interdependencies between other Fluid Framework libraries,
|
|
12
12
|
library consumers should always prefer `^`.
|
|
13
13
|
|
|
14
|
+
If using any of Fluid Framework's unstable APIs (for example, its `beta` APIs), we recommend using a more constrained version range, such as `~`.
|
|
15
|
+
|
|
14
16
|
<!-- prettier-ignore-end -->
|
|
15
17
|
|
|
16
18
|
<!-- AUTO-GENERATED-CONTENT:END -->
|
package/dist/legacy.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { IDocumentService, IDocumentServiceFactory, IDocumentServicePolicies, IR
|
|
|
8
8
|
import { ILocalDeltaConnectionServer } from "@fluidframework/server-local-server";
|
|
9
9
|
/**
|
|
10
10
|
* Implementation of document service factory for local use.
|
|
11
|
+
* @legacy
|
|
11
12
|
* @alpha
|
|
12
13
|
*/
|
|
13
14
|
export declare class LocalDocumentServiceFactory implements IDocumentServiceFactory {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localDocumentServiceFactory.d.ts","sourceRoot":"","sources":["../src/localDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EACN,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,YAAY,EACZ,aAAa,EACb,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAMlF
|
|
1
|
+
{"version":3,"file":"localDocumentServiceFactory.d.ts","sourceRoot":"","sources":["../src/localDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EACN,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,YAAY,EACZ,aAAa,EACb,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAMlF;;;;GAIG;AACH,qBAAa,2BAA4B,YAAW,uBAAuB;IASzE,OAAO,CAAC,QAAQ,CAAC,0BAA0B;IAC3C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;IAC1B,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAC;IATvC,OAAO,CAAC,QAAQ,CAAC,2BAA2B,CACjC;IAEX;;OAEG;gBAEe,0BAA0B,EAAE,2BAA2B,EACvD,QAAQ,CAAC,sCAA0B,EACnC,oBAAoB,CAAC,8BAAkB;IAG5C,eAAe,CAC3B,gBAAgB,EAAE,YAAY,GAAG,SAAS,EAC1C,WAAW,EAAE,YAAY,EACzB,MAAM,CAAC,EAAE,oBAAoB,EAC7B,kBAAkB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC,gBAAgB,CAAC;IAU5B;;;;OAIG;IACU,qBAAqB,CACjC,WAAW,EAAE,YAAY,EACzB,MAAM,CAAC,EAAE,oBAAoB,EAC7B,kBAAkB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC,gBAAgB,CAAC;IA8B5B;;;;OAIG;IACI,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM;IAQlE;;;;;;OAMG;IACI,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,GAAG;CAOtF"}
|
|
@@ -10,6 +10,7 @@ const localCreateDocument_js_1 = require("./localCreateDocument.js");
|
|
|
10
10
|
const localDocumentService_js_1 = require("./localDocumentService.js");
|
|
11
11
|
/**
|
|
12
12
|
* Implementation of document service factory for local use.
|
|
13
|
+
* @legacy
|
|
13
14
|
* @alpha
|
|
14
15
|
*/
|
|
15
16
|
class LocalDocumentServiceFactory {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localDocumentServiceFactory.js","sourceRoot":"","sources":["../src/localDocumentServiceFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAWH,4EAAqF;AAGrF,qEAA0D;AAE1D,uEAAuE;AAEvE
|
|
1
|
+
{"version":3,"file":"localDocumentServiceFactory.js","source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IACzD,CAAC;CACD;AA/FD,kEA+FC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport {\n\tIDocumentService,\n\tIDocumentServiceFactory,\n\tIDocumentServicePolicies,\n\tIResolvedUrl,\n\tNackErrorType,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { DefaultTokenProvider } from \"@fluidframework/routerlicious-driver/internal\";\nimport { ILocalDeltaConnectionServer } from \"@fluidframework/server-local-server\";\n\nimport { createDocument } from \"./localCreateDocument.js\";\nimport { LocalDocumentDeltaConnection } from \"./localDocumentDeltaConnection.js\";\nimport { createLocalDocumentService } from \"./localDocumentService.js\";\n\n/**\n * Implementation of document service factory for local use.\n * @legacy\n * @alpha\n */\nexport class LocalDocumentServiceFactory implements IDocumentServiceFactory {\n\t// A map of clientId to LocalDocumentService.\n\tprivate readonly documentDeltaConnectionsMap: Map<string, LocalDocumentDeltaConnection> =\n\t\tnew Map();\n\n\t/**\n\t * @param localDeltaConnectionServer - delta connection server for ops\n\t */\n\tconstructor(\n\t\tprivate readonly localDeltaConnectionServer: ILocalDeltaConnectionServer,\n\t\tprivate readonly policies?: IDocumentServicePolicies,\n\t\tprivate readonly innerDocumentService?: IDocumentService,\n\t) {}\n\n\tpublic async createContainer(\n\t\tcreateNewSummary: ISummaryTree | undefined,\n\t\tresolvedUrl: IResolvedUrl,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\tif (!this.localDeltaConnectionServer) {\n\t\t\tthrow new Error(\"Provide the localDeltaConnectionServer!!\");\n\t\t}\n\t\tif (createNewSummary !== undefined) {\n\t\t\tawait createDocument(this.localDeltaConnectionServer, resolvedUrl, createNewSummary);\n\t\t}\n\t\treturn this.createDocumentService(resolvedUrl, logger, clientIsSummarizer);\n\t}\n\n\t/**\n\t * Creates and returns a document service for testing using the given resolved\n\t * URL for the tenant ID, document ID, and token.\n\t * @param resolvedUrl - resolved URL of document\n\t */\n\tpublic async createDocumentService(\n\t\tresolvedUrl: IResolvedUrl,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\tconst parsedUrl = new URL(resolvedUrl.url);\n\t\tconst [, tenantId, documentId] = parsedUrl.pathname ? parsedUrl.pathname.split(\"/\") : [];\n\t\tif (!documentId || !tenantId) {\n\t\t\tthrow new Error(\n\t\t\t\t`Couldn't parse resolved url. [documentId:${documentId}][tenantId:${tenantId}]`,\n\t\t\t);\n\t\t}\n\n\t\tconst fluidResolvedUrl = resolvedUrl;\n\t\tconst jwtToken = fluidResolvedUrl.tokens.jwt;\n\t\tif (!jwtToken) {\n\t\t\tthrow new Error(`Token was not provided.`);\n\t\t}\n\n\t\tconst tokenProvider = new DefaultTokenProvider(jwtToken);\n\n\t\treturn createLocalDocumentService(\n\t\t\tresolvedUrl,\n\t\t\tthis.localDeltaConnectionServer,\n\t\t\ttokenProvider,\n\t\t\ttenantId,\n\t\t\tdocumentId,\n\t\t\tthis.documentDeltaConnectionsMap,\n\t\t\tthis.policies,\n\t\t\tthis.innerDocumentService,\n\t\t\tlogger,\n\t\t);\n\t}\n\n\t/**\n\t * Gets the document delta connection for the clientId and asks it to disconnect the client.\n\t * @param clientId - The ID of the client to be disconnected.\n\t * @param disconnectReason - The reason of the disconnection.\n\t */\n\tpublic disconnectClient(clientId: string, disconnectReason: string) {\n\t\tconst documentDeltaConnection = this.documentDeltaConnectionsMap.get(clientId);\n\t\tif (documentDeltaConnection === undefined) {\n\t\t\tthrow new Error(`No client with the id: ${clientId}`);\n\t\t}\n\t\tdocumentDeltaConnection.disconnectClient(disconnectReason);\n\t}\n\n\t/**\n\t * Gets the document delta connection for the clientId and asks it to nack the client.\n\t * @param clientId - The ID of the client to be Nack'd.\n\t * @param code - An error code number that represents the error. It will be a valid HTTP error code.\n\t * @param type - Type of the Nack.\n\t * @param message - A message about the nack for debugging/logging/telemetry purposes.\n\t */\n\tpublic nackClient(clientId: string, code?: number, type?: NackErrorType, message?: any) {\n\t\tconst documentDeltaConnection = this.documentDeltaConnectionsMap.get(clientId);\n\t\tif (documentDeltaConnection === undefined) {\n\t\t\tthrow new Error(`No client with the id: ${clientId}`);\n\t\t}\n\t\tdocumentDeltaConnection.nackClient(code, type, message);\n\t}\n}\n"]}
|
package/dist/localResolver.d.ts
CHANGED
|
@@ -5,12 +5,14 @@
|
|
|
5
5
|
import { IRequest } from "@fluidframework/core-interfaces";
|
|
6
6
|
import { IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions/internal";
|
|
7
7
|
/**
|
|
8
|
+
* @legacy
|
|
8
9
|
* @alpha
|
|
9
10
|
*/
|
|
10
11
|
export declare function createLocalResolverCreateNewRequest(documentId: string): IRequest;
|
|
11
12
|
/**
|
|
12
13
|
* Resolves URLs by providing fake URLs which succeed with the other
|
|
13
14
|
* related local classes.
|
|
15
|
+
* @legacy
|
|
14
16
|
* @alpha
|
|
15
17
|
*/
|
|
16
18
|
export declare class LocalResolver implements IUrlResolver {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localResolver.d.ts","sourceRoot":"","sources":["../src/localResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAE3D,OAAO,EAEN,YAAY,EACZ,YAAY,EAEZ,MAAM,6CAA6C,CAAC;AAIrD
|
|
1
|
+
{"version":3,"file":"localResolver.d.ts","sourceRoot":"","sources":["../src/localResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAE3D,OAAO,EAEN,YAAY,EACZ,YAAY,EAEZ,MAAM,6CAA6C,CAAC;AAIrD;;;GAGG;AACH,wBAAgB,mCAAmC,CAAC,UAAU,EAAE,MAAM,GAAG,QAAQ,CAQhF;AAED;;;;;GAKG;AACH,qBAAa,aAAc,YAAW,YAAY;IACjD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAc;IACvC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAc;;IAIvC;;;;;OAKG;IACU,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC;IAoBjD,cAAc,CAC1B,WAAW,EAAE,YAAY,EACzB,WAAW,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC;IAkBX,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,QAAQ;CAG3D"}
|
package/dist/localResolver.js
CHANGED
|
@@ -9,6 +9,7 @@ const internal_1 = require("@fluidframework/core-utils/internal");
|
|
|
9
9
|
const internal_2 = require("@fluidframework/driver-definitions/internal");
|
|
10
10
|
const auth_js_1 = require("./auth.js");
|
|
11
11
|
/**
|
|
12
|
+
* @legacy
|
|
12
13
|
* @alpha
|
|
13
14
|
*/
|
|
14
15
|
function createLocalResolverCreateNewRequest(documentId) {
|
|
@@ -24,6 +25,7 @@ exports.createLocalResolverCreateNewRequest = createLocalResolverCreateNewReques
|
|
|
24
25
|
/**
|
|
25
26
|
* Resolves URLs by providing fake URLs which succeed with the other
|
|
26
27
|
* related local classes.
|
|
28
|
+
* @legacy
|
|
27
29
|
* @alpha
|
|
28
30
|
*/
|
|
29
31
|
class LocalResolver {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localResolver.js","sourceRoot":"","sources":["../src/localResolver.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAA6D;AAC7D,0EAKqD;AAErD,uCAA0C;AAE1C
|
|
1
|
+
{"version":3,"file":"localResolver.js","sourceRoot":"","sources":["../src/localResolver.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAA6D;AAC7D,0EAKqD;AAErD,uCAA0C;AAE1C;;;GA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,EAAE;SAC1D,CAAC;QAEF,OAAO,QAAQ,CAAC;IACjB,CAAC;IAEM,KAAK,CAAC,cAAc,CAC1B,WAAyB,EACzB,WAAmB;QAEnB,IAAI,GAAG,GAAG,WAAW,CAAC;QACtB,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACzB,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACrB,CAAC;QACD,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAC3C,IAAI,SAAS,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC1D,CAAC;QACD,MAAM,CAAC,EAAE,AAAD,EAAG,UAAU,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACvD,IAAA,iBAAM,EACL,CAAC,CAAC,UAAU,EACZ,KAAK,CAAC,+DAA+D,CACrE,CAAC;QAEF,OAAO,yBAAyB,UAAU,IAAI,GAAG,EAAE,CAAC;IACrD,CAAC;IAEM,sBAAsB,CAAC,UAAkB;QAC/C,OAAO,mCAAmC,CAAC,UAAU,CAAC,CAAC;IACxD,CAAC;CACD;AAxDD,sCAwDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tDriverHeader,\n\tIResolvedUrl,\n\tIUrlResolver,\n\tScopeType,\n} from \"@fluidframework/driver-definitions/internal\";\n\nimport { generateToken } from \"./auth.js\";\n\n/**\n * @legacy\n * @alpha\n */\nexport function createLocalResolverCreateNewRequest(documentId: string): IRequest {\n\tconst createNewRequest: IRequest = {\n\t\turl: `http://localhost:3000/${documentId}`,\n\t\theaders: {\n\t\t\t[DriverHeader.createNew]: true,\n\t\t},\n\t};\n\treturn createNewRequest;\n}\n\n/**\n * Resolves URLs by providing fake URLs which succeed with the other\n * related local classes.\n * @legacy\n * @alpha\n */\nexport class LocalResolver implements IUrlResolver {\n\tprivate readonly tenantId = \"tenantId\";\n\tprivate readonly tokenKey = \"tokenKey\";\n\n\tconstructor() {}\n\n\t/**\n\t * Resolves URL requests by providing fake URLs with an actually generated\n\t * token from constant test strings. The root of the URL is fake, but the\n\t * remaining relative URL can still be parsed.\n\t * @param request - request to handle\n\t */\n\tpublic async resolve(request: IRequest): Promise<IResolvedUrl> {\n\t\tconst parsedUrl = new URL(request.url);\n\t\tconst fullPath = `${parsedUrl.pathname.substr(1)}${parsedUrl.search}`;\n\t\tconst documentId = fullPath.split(\"/\")[0];\n\t\tconst scopes = [ScopeType.DocRead, ScopeType.DocWrite, ScopeType.SummaryWrite];\n\t\tconst resolved: IResolvedUrl = {\n\t\t\tendpoints: {\n\t\t\t\tdeltaStorageUrl: `http://localhost:3000/deltas/${this.tenantId}/${documentId}`,\n\t\t\t\tordererUrl: \"http://localhost:3000\",\n\t\t\t\tstorageUrl: `http://localhost:3000/repos/${this.tenantId}`,\n\t\t\t},\n\t\t\tid: documentId,\n\t\t\ttokens: { jwt: generateToken(this.tenantId, documentId, this.tokenKey, scopes) },\n\t\t\ttype: \"fluid\",\n\t\t\turl: `https://localhost:3000/${this.tenantId}/${fullPath}`,\n\t\t};\n\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\tlet url = relativeUrl;\n\t\tif (url.startsWith(\"/\")) {\n\t\t\turl = url.substr(1);\n\t\t}\n\t\tconst parsedUrl = new URL(resolvedUrl.url);\n\t\tif (parsedUrl.pathname === null) {\n\t\t\tthrow new Error(\"Url should contain tenant and docId!!\");\n\t\t}\n\t\tconst [, , documentId] = parsedUrl.pathname.split(\"/\");\n\t\tassert(\n\t\t\t!!documentId,\n\t\t\t0x09a /* \"'documentId' must be a defined, non-zero length string.\" */,\n\t\t);\n\n\t\treturn `http://localhost:3000/${documentId}/${url}`;\n\t}\n\n\tpublic createCreateNewRequest(documentId: string): IRequest {\n\t\treturn createLocalResolverCreateNewRequest(documentId);\n\t}\n}\n"]}
|
package/lib/legacy.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { IDocumentService, IDocumentServiceFactory, IDocumentServicePolicies, IR
|
|
|
8
8
|
import { ILocalDeltaConnectionServer } from "@fluidframework/server-local-server";
|
|
9
9
|
/**
|
|
10
10
|
* Implementation of document service factory for local use.
|
|
11
|
+
* @legacy
|
|
11
12
|
* @alpha
|
|
12
13
|
*/
|
|
13
14
|
export declare class LocalDocumentServiceFactory implements IDocumentServiceFactory {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localDocumentServiceFactory.d.ts","sourceRoot":"","sources":["../src/localDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EACN,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,YAAY,EACZ,aAAa,EACb,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAMlF
|
|
1
|
+
{"version":3,"file":"localDocumentServiceFactory.d.ts","sourceRoot":"","sources":["../src/localDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EACN,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,YAAY,EACZ,aAAa,EACb,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAMlF;;;;GAIG;AACH,qBAAa,2BAA4B,YAAW,uBAAuB;IASzE,OAAO,CAAC,QAAQ,CAAC,0BAA0B;IAC3C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;IAC1B,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAC;IATvC,OAAO,CAAC,QAAQ,CAAC,2BAA2B,CACjC;IAEX;;OAEG;gBAEe,0BAA0B,EAAE,2BAA2B,EACvD,QAAQ,CAAC,sCAA0B,EACnC,oBAAoB,CAAC,8BAAkB;IAG5C,eAAe,CAC3B,gBAAgB,EAAE,YAAY,GAAG,SAAS,EAC1C,WAAW,EAAE,YAAY,EACzB,MAAM,CAAC,EAAE,oBAAoB,EAC7B,kBAAkB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC,gBAAgB,CAAC;IAU5B;;;;OAIG;IACU,qBAAqB,CACjC,WAAW,EAAE,YAAY,EACzB,MAAM,CAAC,EAAE,oBAAoB,EAC7B,kBAAkB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC,gBAAgB,CAAC;IA8B5B;;;;OAIG;IACI,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM;IAQlE;;;;;;OAMG;IACI,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,GAAG;CAOtF"}
|
|
@@ -7,6 +7,7 @@ import { createDocument } from "./localCreateDocument.js";
|
|
|
7
7
|
import { createLocalDocumentService } from "./localDocumentService.js";
|
|
8
8
|
/**
|
|
9
9
|
* Implementation of document service factory for local use.
|
|
10
|
+
* @legacy
|
|
10
11
|
* @alpha
|
|
11
12
|
*/
|
|
12
13
|
export class LocalDocumentServiceFactory {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localDocumentServiceFactory.js","sourceRoot":"","sources":["../src/localDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,OAAO,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AAGrF,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAEvE
|
|
1
|
+
{"version":3,"file":"localDocumentServiceFactory.js","sourceRoot":"","sources":["../src/localDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,OAAO,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AAGrF,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAEvE;;;;GAIG;AACH,MAAM,OAAO,2BAA2B;IAKvC;;OAEG;IACH,YACkB,0BAAuD,EACvD,QAAmC,EACnC,oBAAuC;QAFvC,+BAA0B,GAA1B,0BAA0B,CAA6B;QACvD,aAAQ,GAAR,QAAQ,CAA2B;QACnC,yBAAoB,GAApB,oBAAoB,CAAmB;QAVzD,6CAA6C;QAC5B,gCAA2B,GAC3C,IAAI,GAAG,EAAE,CAAC;IASR,CAAC;IAEG,KAAK,CAAC,eAAe,CAC3B,gBAA0C,EAC1C,WAAyB,EACzB,MAA6B,EAC7B,kBAA4B;QAE5B,IAAI,CAAC,IAAI,CAAC,0BAA0B,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC7D,CAAC;QACD,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;YACpC,MAAM,cAAc,CAAC,IAAI,CAAC,0BAA0B,EAAE,WAAW,EAAE,gBAAgB,CAAC,CAAC;QACtF,CAAC;QACD,OAAO,IAAI,CAAC,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAC5E,CAAC;IAED;;;;OAIG;IACI,KAAK,CAA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5D,CAAC;IAED;;;;;;OAMG;IACI,UAAU,CAAC,QAAgB,EAAE,IAAa,EAAE,IAAoB,EAAE,OAAa;QACrF,MAAM,uBAAuB,GAAG,IAAI,CAAC,2BAA2B,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC/E,IAAI,uBAAuB,KAAK,SAAS,EAAE,CAAC;YAC3C,MAAM,IAAI,KAAK,CAAC,0BAA0B,QAAQ,EAAE,CAAC,CAAC;QACvD,CAAC;QACD,uBAAuB,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport {\n\tIDocumentService,\n\tIDocumentServiceFactory,\n\tIDocumentServicePolicies,\n\tIResolvedUrl,\n\tNackErrorType,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { DefaultTokenProvider } from \"@fluidframework/routerlicious-driver/internal\";\nimport { ILocalDeltaConnectionServer } from \"@fluidframework/server-local-server\";\n\nimport { createDocument } from \"./localCreateDocument.js\";\nimport { LocalDocumentDeltaConnection } from \"./localDocumentDeltaConnection.js\";\nimport { createLocalDocumentService } from \"./localDocumentService.js\";\n\n/**\n * Implementation of document service factory for local use.\n * @legacy\n * @alpha\n */\nexport class LocalDocumentServiceFactory implements IDocumentServiceFactory {\n\t// A map of clientId to LocalDocumentService.\n\tprivate readonly documentDeltaConnectionsMap: Map<string, LocalDocumentDeltaConnection> =\n\t\tnew Map();\n\n\t/**\n\t * @param localDeltaConnectionServer - delta connection server for ops\n\t */\n\tconstructor(\n\t\tprivate readonly localDeltaConnectionServer: ILocalDeltaConnectionServer,\n\t\tprivate readonly policies?: IDocumentServicePolicies,\n\t\tprivate readonly innerDocumentService?: IDocumentService,\n\t) {}\n\n\tpublic async createContainer(\n\t\tcreateNewSummary: ISummaryTree | undefined,\n\t\tresolvedUrl: IResolvedUrl,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\tif (!this.localDeltaConnectionServer) {\n\t\t\tthrow new Error(\"Provide the localDeltaConnectionServer!!\");\n\t\t}\n\t\tif (createNewSummary !== undefined) {\n\t\t\tawait createDocument(this.localDeltaConnectionServer, resolvedUrl, createNewSummary);\n\t\t}\n\t\treturn this.createDocumentService(resolvedUrl, logger, clientIsSummarizer);\n\t}\n\n\t/**\n\t * Creates and returns a document service for testing using the given resolved\n\t * URL for the tenant ID, document ID, and token.\n\t * @param resolvedUrl - resolved URL of document\n\t */\n\tpublic async createDocumentService(\n\t\tresolvedUrl: IResolvedUrl,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\tconst parsedUrl = new URL(resolvedUrl.url);\n\t\tconst [, tenantId, documentId] = parsedUrl.pathname ? parsedUrl.pathname.split(\"/\") : [];\n\t\tif (!documentId || !tenantId) {\n\t\t\tthrow new Error(\n\t\t\t\t`Couldn't parse resolved url. [documentId:${documentId}][tenantId:${tenantId}]`,\n\t\t\t);\n\t\t}\n\n\t\tconst fluidResolvedUrl = resolvedUrl;\n\t\tconst jwtToken = fluidResolvedUrl.tokens.jwt;\n\t\tif (!jwtToken) {\n\t\t\tthrow new Error(`Token was not provided.`);\n\t\t}\n\n\t\tconst tokenProvider = new DefaultTokenProvider(jwtToken);\n\n\t\treturn createLocalDocumentService(\n\t\t\tresolvedUrl,\n\t\t\tthis.localDeltaConnectionServer,\n\t\t\ttokenProvider,\n\t\t\ttenantId,\n\t\t\tdocumentId,\n\t\t\tthis.documentDeltaConnectionsMap,\n\t\t\tthis.policies,\n\t\t\tthis.innerDocumentService,\n\t\t\tlogger,\n\t\t);\n\t}\n\n\t/**\n\t * Gets the document delta connection for the clientId and asks it to disconnect the client.\n\t * @param clientId - The ID of the client to be disconnected.\n\t * @param disconnectReason - The reason of the disconnection.\n\t */\n\tpublic disconnectClient(clientId: string, disconnectReason: string) {\n\t\tconst documentDeltaConnection = this.documentDeltaConnectionsMap.get(clientId);\n\t\tif (documentDeltaConnection === undefined) {\n\t\t\tthrow new Error(`No client with the id: ${clientId}`);\n\t\t}\n\t\tdocumentDeltaConnection.disconnectClient(disconnectReason);\n\t}\n\n\t/**\n\t * Gets the document delta connection for the clientId and asks it to nack the client.\n\t * @param clientId - The ID of the client to be Nack'd.\n\t * @param code - An error code number that represents the error. It will be a valid HTTP error code.\n\t * @param type - Type of the Nack.\n\t * @param message - A message about the nack for debugging/logging/telemetry purposes.\n\t */\n\tpublic nackClient(clientId: string, code?: number, type?: NackErrorType, message?: any) {\n\t\tconst documentDeltaConnection = this.documentDeltaConnectionsMap.get(clientId);\n\t\tif (documentDeltaConnection === undefined) {\n\t\t\tthrow new Error(`No client with the id: ${clientId}`);\n\t\t}\n\t\tdocumentDeltaConnection.nackClient(code, type, message);\n\t}\n}\n"]}
|
package/lib/localResolver.d.ts
CHANGED
|
@@ -5,12 +5,14 @@
|
|
|
5
5
|
import { IRequest } from "@fluidframework/core-interfaces";
|
|
6
6
|
import { IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions/internal";
|
|
7
7
|
/**
|
|
8
|
+
* @legacy
|
|
8
9
|
* @alpha
|
|
9
10
|
*/
|
|
10
11
|
export declare function createLocalResolverCreateNewRequest(documentId: string): IRequest;
|
|
11
12
|
/**
|
|
12
13
|
* Resolves URLs by providing fake URLs which succeed with the other
|
|
13
14
|
* related local classes.
|
|
15
|
+
* @legacy
|
|
14
16
|
* @alpha
|
|
15
17
|
*/
|
|
16
18
|
export declare class LocalResolver implements IUrlResolver {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localResolver.d.ts","sourceRoot":"","sources":["../src/localResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAE3D,OAAO,EAEN,YAAY,EACZ,YAAY,EAEZ,MAAM,6CAA6C,CAAC;AAIrD
|
|
1
|
+
{"version":3,"file":"localResolver.d.ts","sourceRoot":"","sources":["../src/localResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAE3D,OAAO,EAEN,YAAY,EACZ,YAAY,EAEZ,MAAM,6CAA6C,CAAC;AAIrD;;;GAGG;AACH,wBAAgB,mCAAmC,CAAC,UAAU,EAAE,MAAM,GAAG,QAAQ,CAQhF;AAED;;;;;GAKG;AACH,qBAAa,aAAc,YAAW,YAAY;IACjD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAc;IACvC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAc;;IAIvC;;;;;OAKG;IACU,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC;IAoBjD,cAAc,CAC1B,WAAW,EAAE,YAAY,EACzB,WAAW,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC;IAkBX,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,QAAQ;CAG3D"}
|
package/lib/localResolver.js
CHANGED
|
@@ -6,6 +6,7 @@ import { assert } from "@fluidframework/core-utils/internal";
|
|
|
6
6
|
import { DriverHeader, ScopeType, } from "@fluidframework/driver-definitions/internal";
|
|
7
7
|
import { generateToken } from "./auth.js";
|
|
8
8
|
/**
|
|
9
|
+
* @legacy
|
|
9
10
|
* @alpha
|
|
10
11
|
*/
|
|
11
12
|
export function createLocalResolverCreateNewRequest(documentId) {
|
|
@@ -20,6 +21,7 @@ export function createLocalResolverCreateNewRequest(documentId) {
|
|
|
20
21
|
/**
|
|
21
22
|
* Resolves URLs by providing fake URLs which succeed with the other
|
|
22
23
|
* related local classes.
|
|
24
|
+
* @legacy
|
|
23
25
|
* @alpha
|
|
24
26
|
*/
|
|
25
27
|
export class LocalResolver {
|
package/lib/localResolver.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localResolver.js","sourceRoot":"","sources":["../src/localResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EACN,YAAY,EAGZ,SAAS,GACT,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C
|
|
1
|
+
{"version":3,"file":"localResolver.js","sourceRoot":"","sources":["../src/localResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EACN,YAAY,EAGZ,SAAS,GACT,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C;;;GAGG;AACH,MAAM,UAAU,mCAAmC,CAAC,UAAkB;IACrE,MAAM,gBAAgB,GAAa;QAClC,GAAG,EAAE,yBAAyB,UAAU,EAAE;QAC1C,OAAO,EAAE;YACR,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,IAAI;SAC9B;KACD,CAAC;IACF,OAAO,gBAAgB,CAAC;AACzB,CAAC;AAED;;;;;GAKG;AACH,MAAM,OAAO,aAAa;IAIzB;QAHiB,aAAQ,GAAG,UAAU,CAAC;QACtB,aAAQ,GAAG,UAAU,CAAC;IAExB,CAAC;IAEhB;;;;;OAKG;IACI,KAAK,CAAC,OAAO,CAAC,OAAiB;QACrC,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACvC,MAAM,QAAQ,GAAG,GAAG,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC;QACtE,MAAM,UAAU,GAAG,QAAQ,CAAC,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rE,CAAC;QAEF,OAAO,yBAAyB,UAAU,IAAI,GAAG,EAAE,CAAC;IACrD,CAAC;IAEM,sBAAsB,CAAC,UAAkB;QAC/C,OAAO,mCAAmC,CAAC,UAAU,CAAC,CAAC;IACxD,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tDriverHeader,\n\tIResolvedUrl,\n\tIUrlResolver,\n\tScopeType,\n} from \"@fluidframework/driver-definitions/internal\";\n\nimport { generateToken } from \"./auth.js\";\n\n/**\n * @legacy\n * @alpha\n */\nexport function createLocalResolverCreateNewRequest(documentId: string): IRequest {\n\tconst createNewRequest: IRequest = {\n\t\turl: `http://localhost:3000/${documentId}`,\n\t\theaders: {\n\t\t\t[DriverHeader.createNew]: true,\n\t\t},\n\t};\n\treturn createNewRequest;\n}\n\n/**\n * Resolves URLs by providing fake URLs which succeed with the other\n * related local classes.\n * @legacy\n * @alpha\n */\nexport class LocalResolver implements IUrlResolver {\n\tprivate readonly tenantId = \"tenantId\";\n\tprivate readonly tokenKey = \"tokenKey\";\n\n\tconstructor() {}\n\n\t/**\n\t * Resolves URL requests by providing fake URLs with an actually generated\n\t * token from constant test strings. The root of the URL is fake, but the\n\t * remaining relative URL can still be parsed.\n\t * @param request - request to handle\n\t */\n\tpublic async resolve(request: IRequest): Promise<IResolvedUrl> {\n\t\tconst parsedUrl = new URL(request.url);\n\t\tconst fullPath = `${parsedUrl.pathname.substr(1)}${parsedUrl.search}`;\n\t\tconst documentId = fullPath.split(\"/\")[0];\n\t\tconst scopes = [ScopeType.DocRead, ScopeType.DocWrite, ScopeType.SummaryWrite];\n\t\tconst resolved: IResolvedUrl = {\n\t\t\tendpoints: {\n\t\t\t\tdeltaStorageUrl: `http://localhost:3000/deltas/${this.tenantId}/${documentId}`,\n\t\t\t\tordererUrl: \"http://localhost:3000\",\n\t\t\t\tstorageUrl: `http://localhost:3000/repos/${this.tenantId}`,\n\t\t\t},\n\t\t\tid: documentId,\n\t\t\ttokens: { jwt: generateToken(this.tenantId, documentId, this.tokenKey, scopes) },\n\t\t\ttype: \"fluid\",\n\t\t\turl: `https://localhost:3000/${this.tenantId}/${fullPath}`,\n\t\t};\n\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\tlet url = relativeUrl;\n\t\tif (url.startsWith(\"/\")) {\n\t\t\turl = url.substr(1);\n\t\t}\n\t\tconst parsedUrl = new URL(resolvedUrl.url);\n\t\tif (parsedUrl.pathname === null) {\n\t\t\tthrow new Error(\"Url should contain tenant and docId!!\");\n\t\t}\n\t\tconst [, , documentId] = parsedUrl.pathname.split(\"/\");\n\t\tassert(\n\t\t\t!!documentId,\n\t\t\t0x09a /* \"'documentId' must be a defined, non-zero length string.\" */,\n\t\t);\n\n\t\treturn `http://localhost:3000/${documentId}/${url}`;\n\t}\n\n\tpublic createCreateNewRequest(documentId: string): IRequest {\n\t\treturn createLocalResolverCreateNewRequest(documentId);\n\t}\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/local-driver",
|
|
3
|
-
"version": "2.1.0-
|
|
3
|
+
"version": "2.1.0-276985",
|
|
4
4
|
"description": "Fluid local driver",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -69,26 +69,26 @@
|
|
|
69
69
|
"temp-directory": "nyc/.nyc_output"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@fluid-internal/client-utils": "2.1.0-
|
|
73
|
-
"@fluidframework/core-interfaces": "2.1.0-
|
|
74
|
-
"@fluidframework/core-utils": "2.1.0-
|
|
75
|
-
"@fluidframework/driver-base": "2.1.0-
|
|
76
|
-
"@fluidframework/driver-definitions": "2.1.0-
|
|
77
|
-
"@fluidframework/driver-utils": "2.1.0-
|
|
72
|
+
"@fluid-internal/client-utils": "2.1.0-276985",
|
|
73
|
+
"@fluidframework/core-interfaces": "2.1.0-276985",
|
|
74
|
+
"@fluidframework/core-utils": "2.1.0-276985",
|
|
75
|
+
"@fluidframework/driver-base": "2.1.0-276985",
|
|
76
|
+
"@fluidframework/driver-definitions": "2.1.0-276985",
|
|
77
|
+
"@fluidframework/driver-utils": "2.1.0-276985",
|
|
78
78
|
"@fluidframework/protocol-base": "^5.0.0",
|
|
79
|
-
"@fluidframework/routerlicious-driver": "2.1.0-
|
|
79
|
+
"@fluidframework/routerlicious-driver": "2.1.0-276985",
|
|
80
80
|
"@fluidframework/server-local-server": "^5.0.0",
|
|
81
81
|
"@fluidframework/server-services-client": "^5.0.0",
|
|
82
82
|
"@fluidframework/server-services-core": "^5.0.0",
|
|
83
83
|
"@fluidframework/server-test-utils": "^5.0.0",
|
|
84
|
-
"@fluidframework/telemetry-utils": "2.1.0-
|
|
84
|
+
"@fluidframework/telemetry-utils": "2.1.0-276985",
|
|
85
85
|
"jsrsasign": "^11.0.0",
|
|
86
86
|
"uuid": "^9.0.0"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
89
|
"@arethetypeswrong/cli": "^0.15.2",
|
|
90
90
|
"@biomejs/biome": "^1.7.3",
|
|
91
|
-
"@fluid-internal/mocha-test-setup": "2.1.0-
|
|
91
|
+
"@fluid-internal/mocha-test-setup": "2.1.0-276985",
|
|
92
92
|
"@fluid-tools/build-cli": "^0.39.0",
|
|
93
93
|
"@fluidframework/build-common": "^2.0.3",
|
|
94
94
|
"@fluidframework/build-tools": "^0.39.0",
|
|
@@ -118,8 +118,8 @@
|
|
|
118
118
|
},
|
|
119
119
|
"scripts": {
|
|
120
120
|
"api": "fluid-build . --task api",
|
|
121
|
-
"api-extractor:commonjs": "flub generate entrypoints --
|
|
122
|
-
"api-extractor:esnext": "flub generate entrypoints --
|
|
121
|
+
"api-extractor:commonjs": "flub generate entrypoints --outDir ./dist",
|
|
122
|
+
"api-extractor:esnext": "flub generate entrypoints --outDir ./lib --node10TypeCompat",
|
|
123
123
|
"build": "fluid-build . --task build",
|
|
124
124
|
"build:commonjs": "fluid-build . --task commonjs",
|
|
125
125
|
"build:compile": "fluid-build . --task compile",
|
package/src/localResolver.ts
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
import { generateToken } from "./auth.js";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
+
* @legacy
|
|
18
19
|
* @alpha
|
|
19
20
|
*/
|
|
20
21
|
export function createLocalResolverCreateNewRequest(documentId: string): IRequest {
|
|
@@ -30,6 +31,7 @@ export function createLocalResolverCreateNewRequest(documentId: string): IReques
|
|
|
30
31
|
/**
|
|
31
32
|
* Resolves URLs by providing fake URLs which succeed with the other
|
|
32
33
|
* related local classes.
|
|
34
|
+
* @legacy
|
|
33
35
|
* @alpha
|
|
34
36
|
*/
|
|
35
37
|
export class LocalResolver implements IUrlResolver {
|
|
File without changes
|