@fluidframework/odsp-driver 2.0.0-internal.3.2.2 → 2.0.0-internal.3.3.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/dist/odspDocumentDeltaConnection.d.ts.map +1 -1
- package/dist/odspDocumentDeltaConnection.js +4 -1
- package/dist/odspDocumentDeltaConnection.js.map +1 -1
- package/dist/odspDocumentService.d.ts.map +1 -1
- package/dist/odspDocumentService.js +1 -0
- package/dist/odspDocumentService.js.map +1 -1
- package/dist/odspDocumentServiceFactoryCore.d.ts +3 -0
- package/dist/odspDocumentServiceFactoryCore.d.ts.map +1 -1
- package/dist/odspDocumentServiceFactoryCore.js +3 -0
- package/dist/odspDocumentServiceFactoryCore.js.map +1 -1
- package/dist/odspDriverUrlResolver.d.ts.map +1 -1
- package/dist/odspDriverUrlResolver.js +1 -9
- package/dist/odspDriverUrlResolver.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/odspDocumentDeltaConnection.d.ts.map +1 -1
- package/lib/odspDocumentDeltaConnection.js +4 -1
- package/lib/odspDocumentDeltaConnection.js.map +1 -1
- package/lib/odspDocumentService.d.ts.map +1 -1
- package/lib/odspDocumentService.js +1 -0
- package/lib/odspDocumentService.js.map +1 -1
- package/lib/odspDocumentServiceFactoryCore.d.ts +3 -0
- package/lib/odspDocumentServiceFactoryCore.d.ts.map +1 -1
- package/lib/odspDocumentServiceFactoryCore.js +3 -0
- package/lib/odspDocumentServiceFactoryCore.js.map +1 -1
- package/lib/odspDriverUrlResolver.d.ts.map +1 -1
- package/lib/odspDriverUrlResolver.js +1 -9
- package/lib/odspDriverUrlResolver.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/package.json +16 -30
- package/src/odspDocumentDeltaConnection.ts +4 -1
- package/src/odspDocumentService.ts +1 -0
- package/src/odspDocumentServiceFactoryCore.ts +3 -0
- package/src/odspDriverUrlResolver.ts +1 -11
- package/src/packageVersion.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspDriverUrlResolver.js","sourceRoot":"","sources":["../src/odspDriverUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAEtD,OAAO,EACN,eAAe,EACf,YAAY,GAIZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAEN,cAAc,GAEd,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,SAAS,UAAU,CAAC,OAAe,EAAE,OAAe,EAAE,MAAc,EAAE,WAAoB;IACzF,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;IAC3C,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,YAAY,WAAW,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9D,OAAO,GAAG,UAAU,CAAC,UAAU,CAAC,WAAW,OAAO,UAAU,MAAM,IAAI,OAAO,EAAE,CAAC;AACjF,CAAC;AAED,SAAS,cAAc,CAAC,OAAe,EAAE,OAAe,EAAE,MAAc,EAAE,WAAoB;IAC7F,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,W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AAK,IAAI,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;KACnD;IAED,OAAO;QACN,OAAO;QACP,OAAO,EAAE,kBAAkB,CAAC,OAAO,CAAC;QACpC,MAAM,EAAE,kBAAkB,CAAC,MAAM,CAAC;QAClC,IAAI,EAAE,kBAAkB,CAAC,IAAI,CAAC;QAC9B,oBAAoB,EAAE,oBAAoB;YACzC,CAAC,CAAC,kBAAkB,CAAC,oBAAoB,CAAC;YAC1C,CAAC,CAAC,SAAS;QACZ,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS;KACtE,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { assert } from \"@fluidframework/common-utils\";\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport {\n\tDriverErrorType,\n\tDriverHeader,\n\tIContainerPackageInfo,\n\tIResolvedUrl,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions\";\nimport {\n\tIOdspResolvedUrl,\n\tShareLinkTypes,\n\tShareLinkInfoType,\n} from \"@fluidframework/odsp-driver-definitions\";\nimport { NonRetryableError } from \"@fluidframework/driver-utils\";\nimport { createOdspUrl } from \"./createOdspUrl\";\nimport { getApiRoot } from \"./odspUrlHelper\";\nimport { getOdspResolvedUrl } from \"./odspUtils\";\nimport { getHashedDocumentId } from \"./odspPublicUtils\";\nimport { ClpCompliantAppHeader } from \"./contractsPublic\";\nimport { pkgVersion } from \"./packageVersion\";\n\nfunction getUrlBase(siteUrl: string, driveId: string, itemId: string, fileVersion?: string) {\n\tconst siteOrigin = new URL(siteUrl).origin;\n\tconst version = fileVersion ? `versions/${fileVersion}/` : \"\";\n\treturn `${getApiRoot(siteOrigin)}/drives/${driveId}/items/${itemId}/${version}`;\n}\n\nfunction getSnapshotUrl(siteUrl: string, driveId: string, itemId: string, fileVersion?: string) {\n\tconst urlBase = getUrlBase(siteUrl, driveId, itemId, fileVersion);\n\treturn `${urlBase}opStream/snapshots`;\n}\n\nfunction getAttachmentPOSTUrl(\n\tsiteUrl: string,\n\tdriveId: string,\n\titemId: string,\n\tfileVersion?: string,\n) {\n\tconst urlBase = getUrlBase(siteUrl, driveId, itemId, fileVersion);\n\treturn `${urlBase}opStream/attachment`;\n}\n\nfunction getAttachmentGETUrl(\n\tsiteUrl: string,\n\tdriveId: string,\n\titemId: string,\n\tfileVersion?: string,\n) {\n\tconst urlBase = getUrlBase(siteUrl, driveId, itemId, fileVersion);\n\treturn `${urlBase}opStream/attachments`;\n}\n\nfunction getDeltaStorageUrl(\n\tsiteUrl: string,\n\tdriveId: string,\n\titemId: string,\n\tfileVersion?: string,\n) {\n\tconst urlBase = getUrlBase(siteUrl, driveId, itemId, fileVersion);\n\treturn `${urlBase}opStream`;\n}\n\n/**\n * Utility that enables us to handle paths provided with a beginning slash.\n * For example if a value of '/id1/id2' is provided, id1/id2 is returned.\n */\nfunction removeBeginningSlash(str: string): string {\n\tif (str.startsWith(\"/\")) {\n\t\treturn str.substr(1);\n\t}\n\n\treturn str;\n}\n\n/**\n * Resolver to resolve urls like the ones created by createOdspUrl which is driver inner\n * url format. Ex: `${siteUrl}?driveId=${driveId}&itemId=${itemId}&path=${path}`\n */\nexport class OdspDriverUrlResolver implements IUrlResolver {\n\tconstructor() {}\n\n\tpublic async resolve(request: IRequest): Promise<IOdspResolvedUrl> {\n\t\tif (request.headers?.[DriverHeader.createNew]) {\n\t\t\tconst [siteURL, queryString] = request.url.split(\"?\");\n\n\t\t\tconst searchParams = new URLSearchParams(queryString);\n\t\t\tconst fileName = request.headers[DriverHeader.createNew].fileName;\n\t\t\tconst driveID = searchParams.get(\"driveId\");\n\t\t\tconst filePath = searchParams.get(\"path\");\n\t\t\tconst packageName = searchParams.get(\"containerPackageName\");\n\t\t\tconst createLinkType = searchParams.get(\"createLinkType\");\n\t\t\tif (!(fileName && siteURL && driveID && filePath !== null && filePath !== undefined)) {\n\t\t\t\tthrow new NonRetryableError(\n\t\t\t\t\t\"Proper new file params should be there!!\",\n\t\t\t\t\tDriverErrorType.genericError,\n\t\t\t\t\t{ driverVersion: pkgVersion },\n\t\t\t\t);\n\t\t\t}\n\t\t\tlet shareLinkInfo: ShareLinkInfoType | undefined;\n\t\t\tif (createLinkType && createLinkType in ShareLinkTypes) {\n\t\t\t\tshareLinkInfo = {\n\t\t\t\t\tcreateLink: {\n\t\t\t\t\t\ttype: ShareLinkTypes[createLinkType],\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tendpoints: {\n\t\t\t\t\tsnapshotStorageUrl: \"\",\n\t\t\t\t\tattachmentGETStorageUrl: \"\",\n\t\t\t\t\tattachmentPOSTStorageUrl: \"\",\n\t\t\t\t\tdeltaStorageUrl: \"\",\n\t\t\t\t},\n\t\t\t\ttokens: {},\n\t\t\t\ttype: \"fluid\",\n\t\t\t\todspResolvedUrl: true,\n\t\t\t\tid: \"odspCreateNew\",\n\t\t\t\turl: `fluid-odsp://${siteURL}?${queryString}&version=null`,\n\t\t\t\tsiteUrl: siteURL,\n\t\t\t\thashedDocumentId: \"\",\n\t\t\t\tdriveId: driveID,\n\t\t\t\titemId: \"\",\n\t\t\t\tfileName,\n\t\t\t\tsummarizer: false,\n\t\t\t\tcodeHint: {\n\t\t\t\t\tcontainerPackageName: packageName ?? undefined,\n\t\t\t\t},\n\t\t\t\tfileVersion: undefined,\n\t\t\t\tshareLinkInfo,\n\t\t\t\tisClpCompliantApp: request.headers?.[ClpCompliantAppHeader.isClpCompliantApp],\n\t\t\t};\n\t\t}\n\t\tconst { siteUrl, driveId, itemId, path, containerPackageName, fileVersion } = decodeOdspUrl(\n\t\t\trequest.url,\n\t\t);\n\t\tconst hashedDocumentId = await getHashedDocumentId(driveId, itemId);\n\t\tassert(!hashedDocumentId.includes(\"/\"), 0x0a8 /* \"Docid should not contain slashes!!\" */);\n\n\t\tlet documentUrl = `fluid-odsp://placeholder/placeholder/${hashedDocumentId}/${removeBeginningSlash(\n\t\t\tpath,\n\t\t)}`;\n\n\t\tif (request.url.length > 0) {\n\t\t\t// In case of any additional parameters add them back to the url\n\t\t\tconst requestURL = new URL(request.url);\n\t\t\tconst searchParams = requestURL.search;\n\t\t\tif (searchParams) {\n\t\t\t\tdocumentUrl += searchParams;\n\t\t\t}\n\t\t}\n\n\t\tconst summarizer = !!request.headers?.[DriverHeader.summarizingClient];\n\n\t\treturn {\n\t\t\ttype: \"fluid\",\n\t\t\todspResolvedUrl: true,\n\t\t\tendpoints: {\n\t\t\t\tsnapshotStorageUrl: getSnapshotUrl(siteUrl, driveId, itemId, fileVersion),\n\t\t\t\tattachmentPOSTStorageUrl: getAttachmentPOSTUrl(\n\t\t\t\t\tsiteUrl,\n\t\t\t\t\tdriveId,\n\t\t\t\t\titemId,\n\t\t\t\t\tfileVersion,\n\t\t\t\t),\n\t\t\t\tattachmentGETStorageUrl: getAttachmentGETUrl(siteUrl, driveId, itemId, fileVersion),\n\t\t\t\tdeltaStorageUrl: getDeltaStorageUrl(siteUrl, driveId, itemId, fileVersion),\n\t\t\t},\n\t\t\tid: hashedDocumentId,\n\t\t\ttokens: {},\n\t\t\turl: documentUrl,\n\t\t\thashedDocumentId,\n\t\t\tsiteUrl,\n\t\t\tdriveId,\n\t\t\titemId,\n\t\t\tdataStorePath: path,\n\t\t\tfileName: \"\",\n\t\t\tsummarizer,\n\t\t\tcodeHint: {\n\t\t\t\tcontainerPackageName,\n\t\t\t},\n\t\t\tfileVersion,\n\t\t\tisClpCompliantApp: request.headers?.[ClpCompliantAppHeader.isClpCompliantApp],\n\t\t};\n\t}\n\n\t/**\n\t * Requests a driver + data store storage URL.\n\t * @param resolvedUrl - The driver resolved URL.\n\t * @param relativeUrl - The relative data store path URL.\n\t * For requesting a driver URL, this value should always be '/'. If an empty string is passed, then dataStorePath\n\t * will be extracted from the resolved url if present.\n\t * @param packageInfoSource - optional, represents container package information to be included in url.\n\t */\n\tpublic async getAbsoluteUrl(\n\t\tresolvedUrl: IResolvedUrl,\n\t\trelativeUrl: string,\n\t\tpackageInfoSource?: IContainerPackageInfo,\n\t): Promise<string> {\n\t\tconst odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n\n\t\tlet dataStorePath = relativeUrl;\n\t\tif (relativeUrl === \"\" && odspResolvedUrl.dataStorePath !== undefined) {\n\t\t\t// If the user has passed an empty dataStorePath, then extract it from the resolved url.\n\t\t\tdataStorePath = odspResolvedUrl.dataStorePath;\n\t\t}\n\t\tif (dataStorePath.startsWith(\"/\")) {\n\t\t\tdataStorePath = dataStorePath.substr(1);\n\t\t}\n\n\t\t// back-compat: GitHub #9653\n\t\tconst isFluidPackage = (pkg: any) =>\n\t\t\ttypeof pkg === \"object\" &&\n\t\t\ttypeof pkg?.name === \"string\" &&\n\t\t\ttypeof pkg?.fluid === \"object\";\n\t\tlet containerPackageName;\n\t\tif (packageInfoSource && \"name\" in packageInfoSource) {\n\t\t\tcontainerPackageName = packageInfoSource.name;\n\t\t\t// packageInfoSource is cast to any as it is typed to IContainerPackageInfo instead of IFluidCodeDetails\n\t\t} else if (isFluidPackage((packageInfoSource as any)?.package)) {\n\t\t\tcontainerPackageName = (packageInfoSource as any)?.package.name;\n\t\t} else {\n\t\t\tcontainerPackageName = (packageInfoSource as any)?.package;\n\t\t}\n\t\tcontainerPackageName =\n\t\t\tcontainerPackageName ?? odspResolvedUrl.codeHint?.containerPackageName;\n\n\t\treturn createOdspUrl({\n\t\t\t...odspResolvedUrl,\n\t\t\tcontainerPackageName,\n\t\t\tdataStorePath,\n\t\t});\n\t}\n}\n\nfunction decodeOdspUrl(url: string): {\n\tsiteUrl: string;\n\tdriveId: string;\n\titemId: string;\n\tpath: string;\n\tcontainerPackageName?: string;\n\tfileVersion?: string;\n} {\n\tconst [siteUrl, queryString] = url.split(\"?\");\n\n\tconst searchParams = new URLSearchParams(queryString);\n\n\tconst driveId = searchParams.get(\"driveId\");\n\tconst itemId = searchParams.get(\"itemId\");\n\tconst path = searchParams.get(\"path\");\n\tconst containerPackageName = searchParams.get(\"containerPackageName\");\n\tconst fileVersion = searchParams.get(\"fileVersion\");\n\n\tif (driveId === null) {\n\t\tthrow new Error(\"ODSP URL did not contain a drive id\");\n\t}\n\n\tif (itemId === null) {\n\t\tthrow new Error(\"ODSP Url did not contain an item id\");\n\t}\n\n\tif (path === null) {\n\t\tthrow new Error(\"ODSP Url did not contain a path\");\n\t}\n\n\treturn {\n\t\tsiteUrl,\n\t\tdriveId: decodeURIComponent(driveId),\n\t\titemId: decodeURIComponent(itemId),\n\t\tpath: decodeURIComponent(path),\n\t\tcontainerPackageName: containerPackageName\n\t\t\t? decodeURIComponent(containerPackageName)\n\t\t\t: undefined,\n\t\tfileVersion: fileVersion ? decodeURIComponent(fileVersion) : undefined,\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"odspDriverUrlResolver.js","sourceRoot":"","sources":["../src/odspDriverUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAEtD,OAAO,EACN,eAAe,EACf,YAAY,GAIZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAEN,cAAc,GAEd,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,SAAS,UAAU,CAAC,OAAe,EAAE,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AK,IAAI,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;KACvD;IAED,IAAI,MAAM,KAAK,IAAI,EAAE;QACpB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;KACvD;IAED,IAAI,IAAI,KAAK,IAAI,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;KACnD;IAED,OAAO;QACN,OAAO;QACP,OAAO,EAAE,kBAAkB,CAAC,OAAO,CAAC;QACpC,MAAM,EAAE,kBAAkB,CAAC,MAAM,CAAC;QAClC,IAAI,EAAE,kBAAkB,CAAC,IAAI,CAAC;QAC9B,oBAAoB,EAAE,oBAAoB;YACzC,CAAC,CAAC,kBAAkB,CAAC,oBAAoB,CAAC;YAC1C,CAAC,CAAC,SAAS;QACZ,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS;KACtE,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { assert } from \"@fluidframework/common-utils\";\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport {\n\tDriverErrorType,\n\tDriverHeader,\n\tIContainerPackageInfo,\n\tIResolvedUrl,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions\";\nimport {\n\tIOdspResolvedUrl,\n\tShareLinkTypes,\n\tShareLinkInfoType,\n} from \"@fluidframework/odsp-driver-definitions\";\nimport { NonRetryableError } from \"@fluidframework/driver-utils\";\nimport { createOdspUrl } from \"./createOdspUrl\";\nimport { getApiRoot } from \"./odspUrlHelper\";\nimport { getOdspResolvedUrl } from \"./odspUtils\";\nimport { getHashedDocumentId } from \"./odspPublicUtils\";\nimport { ClpCompliantAppHeader } from \"./contractsPublic\";\nimport { pkgVersion } from \"./packageVersion\";\n\nfunction getUrlBase(siteUrl: string, driveId: string, itemId: string, fileVersion?: string) {\n\tconst siteOrigin = new URL(siteUrl).origin;\n\tconst version = fileVersion ? `versions/${fileVersion}/` : \"\";\n\treturn `${getApiRoot(siteOrigin)}/drives/${driveId}/items/${itemId}/${version}`;\n}\n\nfunction getSnapshotUrl(siteUrl: string, driveId: string, itemId: string, fileVersion?: string) {\n\tconst urlBase = getUrlBase(siteUrl, driveId, itemId, fileVersion);\n\treturn `${urlBase}opStream/snapshots`;\n}\n\nfunction getAttachmentPOSTUrl(\n\tsiteUrl: string,\n\tdriveId: string,\n\titemId: string,\n\tfileVersion?: string,\n) {\n\tconst urlBase = getUrlBase(siteUrl, driveId, itemId, fileVersion);\n\treturn `${urlBase}opStream/attachment`;\n}\n\nfunction getAttachmentGETUrl(\n\tsiteUrl: string,\n\tdriveId: string,\n\titemId: string,\n\tfileVersion?: string,\n) {\n\tconst urlBase = getUrlBase(siteUrl, driveId, itemId, fileVersion);\n\treturn `${urlBase}opStream/attachments`;\n}\n\nfunction getDeltaStorageUrl(\n\tsiteUrl: string,\n\tdriveId: string,\n\titemId: string,\n\tfileVersion?: string,\n) {\n\tconst urlBase = getUrlBase(siteUrl, driveId, itemId, fileVersion);\n\treturn `${urlBase}opStream`;\n}\n\n/**\n * Utility that enables us to handle paths provided with a beginning slash.\n * For example if a value of '/id1/id2' is provided, id1/id2 is returned.\n */\nfunction removeBeginningSlash(str: string): string {\n\tif (str.startsWith(\"/\")) {\n\t\treturn str.substr(1);\n\t}\n\n\treturn str;\n}\n\n/**\n * Resolver to resolve urls like the ones created by createOdspUrl which is driver inner\n * url format. Ex: `${siteUrl}?driveId=${driveId}&itemId=${itemId}&path=${path}`\n */\nexport class OdspDriverUrlResolver implements IUrlResolver {\n\tconstructor() {}\n\n\tpublic async resolve(request: IRequest): Promise<IOdspResolvedUrl> {\n\t\tif (request.headers?.[DriverHeader.createNew]) {\n\t\t\tconst [siteURL, queryString] = request.url.split(\"?\");\n\n\t\t\tconst searchParams = new URLSearchParams(queryString);\n\t\t\tconst fileName = request.headers[DriverHeader.createNew].fileName;\n\t\t\tconst driveID = searchParams.get(\"driveId\");\n\t\t\tconst filePath = searchParams.get(\"path\");\n\t\t\tconst packageName = searchParams.get(\"containerPackageName\");\n\t\t\tconst createLinkType = searchParams.get(\"createLinkType\");\n\t\t\tif (!(fileName && siteURL && driveID && filePath !== null && filePath !== undefined)) {\n\t\t\t\tthrow new NonRetryableError(\n\t\t\t\t\t\"Proper new file params should be there!!\",\n\t\t\t\t\tDriverErrorType.genericError,\n\t\t\t\t\t{ driverVersion: pkgVersion },\n\t\t\t\t);\n\t\t\t}\n\t\t\tlet shareLinkInfo: ShareLinkInfoType | undefined;\n\t\t\tif (createLinkType && createLinkType in ShareLinkTypes) {\n\t\t\t\tshareLinkInfo = {\n\t\t\t\t\tcreateLink: {\n\t\t\t\t\t\ttype: ShareLinkTypes[createLinkType],\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tendpoints: {\n\t\t\t\t\tsnapshotStorageUrl: \"\",\n\t\t\t\t\tattachmentGETStorageUrl: \"\",\n\t\t\t\t\tattachmentPOSTStorageUrl: \"\",\n\t\t\t\t\tdeltaStorageUrl: \"\",\n\t\t\t\t},\n\t\t\t\ttokens: {},\n\t\t\t\ttype: \"fluid\",\n\t\t\t\todspResolvedUrl: true,\n\t\t\t\tid: \"odspCreateNew\",\n\t\t\t\turl: `fluid-odsp://${siteURL}?${queryString}&version=null`,\n\t\t\t\tsiteUrl: siteURL,\n\t\t\t\thashedDocumentId: \"\",\n\t\t\t\tdriveId: driveID,\n\t\t\t\titemId: \"\",\n\t\t\t\tfileName,\n\t\t\t\tsummarizer: false,\n\t\t\t\tcodeHint: {\n\t\t\t\t\tcontainerPackageName: packageName ?? undefined,\n\t\t\t\t},\n\t\t\t\tfileVersion: undefined,\n\t\t\t\tshareLinkInfo,\n\t\t\t\tisClpCompliantApp: request.headers?.[ClpCompliantAppHeader.isClpCompliantApp],\n\t\t\t};\n\t\t}\n\t\tconst { siteUrl, driveId, itemId, path, containerPackageName, fileVersion } = decodeOdspUrl(\n\t\t\trequest.url,\n\t\t);\n\t\tconst hashedDocumentId = await getHashedDocumentId(driveId, itemId);\n\t\tassert(!hashedDocumentId.includes(\"/\"), 0x0a8 /* \"Docid should not contain slashes!!\" */);\n\n\t\tconst documentUrl = `fluid-odsp://placeholder/placeholder/${hashedDocumentId}/${removeBeginningSlash(\n\t\t\tpath,\n\t\t)}`;\n\n\t\tconst summarizer = !!request.headers?.[DriverHeader.summarizingClient];\n\t\treturn {\n\t\t\ttype: \"fluid\",\n\t\t\todspResolvedUrl: true,\n\t\t\tendpoints: {\n\t\t\t\tsnapshotStorageUrl: getSnapshotUrl(siteUrl, driveId, itemId, fileVersion),\n\t\t\t\tattachmentPOSTStorageUrl: getAttachmentPOSTUrl(\n\t\t\t\t\tsiteUrl,\n\t\t\t\t\tdriveId,\n\t\t\t\t\titemId,\n\t\t\t\t\tfileVersion,\n\t\t\t\t),\n\t\t\t\tattachmentGETStorageUrl: getAttachmentGETUrl(siteUrl, driveId, itemId, fileVersion),\n\t\t\t\tdeltaStorageUrl: getDeltaStorageUrl(siteUrl, driveId, itemId, fileVersion),\n\t\t\t},\n\t\t\tid: hashedDocumentId,\n\t\t\ttokens: {},\n\t\t\turl: documentUrl,\n\t\t\thashedDocumentId,\n\t\t\tsiteUrl,\n\t\t\tdriveId,\n\t\t\titemId,\n\t\t\tdataStorePath: path,\n\t\t\tfileName: \"\",\n\t\t\tsummarizer,\n\t\t\tcodeHint: {\n\t\t\t\tcontainerPackageName,\n\t\t\t},\n\t\t\tfileVersion,\n\t\t\tisClpCompliantApp: request.headers?.[ClpCompliantAppHeader.isClpCompliantApp],\n\t\t};\n\t}\n\n\t/**\n\t * Requests a driver + data store storage URL.\n\t * @param resolvedUrl - The driver resolved URL.\n\t * @param relativeUrl - The relative data store path URL.\n\t * For requesting a driver URL, this value should always be '/'. If an empty string is passed, then dataStorePath\n\t * will be extracted from the resolved url if present.\n\t * @param packageInfoSource - optional, represents container package information to be included in url.\n\t */\n\tpublic async getAbsoluteUrl(\n\t\tresolvedUrl: IResolvedUrl,\n\t\trelativeUrl: string,\n\t\tpackageInfoSource?: IContainerPackageInfo,\n\t): Promise<string> {\n\t\tconst odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n\n\t\tlet dataStorePath = relativeUrl;\n\t\tif (relativeUrl === \"\" && odspResolvedUrl.dataStorePath !== undefined) {\n\t\t\t// If the user has passed an empty dataStorePath, then extract it from the resolved url.\n\t\t\tdataStorePath = odspResolvedUrl.dataStorePath;\n\t\t}\n\t\tif (dataStorePath.startsWith(\"/\")) {\n\t\t\tdataStorePath = dataStorePath.substr(1);\n\t\t}\n\n\t\t// back-compat: GitHub #9653\n\t\tconst isFluidPackage = (pkg: any) =>\n\t\t\ttypeof pkg === \"object\" &&\n\t\t\ttypeof pkg?.name === \"string\" &&\n\t\t\ttypeof pkg?.fluid === \"object\";\n\t\tlet containerPackageName;\n\t\tif (packageInfoSource && \"name\" in packageInfoSource) {\n\t\t\tcontainerPackageName = packageInfoSource.name;\n\t\t\t// packageInfoSource is cast to any as it is typed to IContainerPackageInfo instead of IFluidCodeDetails\n\t\t} else if (isFluidPackage((packageInfoSource as any)?.package)) {\n\t\t\tcontainerPackageName = (packageInfoSource as any)?.package.name;\n\t\t} else {\n\t\t\tcontainerPackageName = (packageInfoSource as any)?.package;\n\t\t}\n\t\tcontainerPackageName =\n\t\t\tcontainerPackageName ?? odspResolvedUrl.codeHint?.containerPackageName;\n\n\t\treturn createOdspUrl({\n\t\t\t...odspResolvedUrl,\n\t\t\tcontainerPackageName,\n\t\t\tdataStorePath,\n\t\t});\n\t}\n}\n\nfunction decodeOdspUrl(url: string): {\n\tsiteUrl: string;\n\tdriveId: string;\n\titemId: string;\n\tpath: string;\n\tcontainerPackageName?: string;\n\tfileVersion?: string;\n} {\n\tconst [siteUrl, queryString] = url.split(\"?\");\n\n\tconst searchParams = new URLSearchParams(queryString);\n\n\tconst driveId = searchParams.get(\"driveId\");\n\tconst itemId = searchParams.get(\"itemId\");\n\tconst path = searchParams.get(\"path\");\n\tconst containerPackageName = searchParams.get(\"containerPackageName\");\n\tconst fileVersion = searchParams.get(\"fileVersion\");\n\n\tif (driveId === null) {\n\t\tthrow new Error(\"ODSP URL did not contain a drive id\");\n\t}\n\n\tif (itemId === null) {\n\t\tthrow new Error(\"ODSP Url did not contain an item id\");\n\t}\n\n\tif (path === null) {\n\t\tthrow new Error(\"ODSP Url did not contain a path\");\n\t}\n\n\treturn {\n\t\tsiteUrl,\n\t\tdriveId: decodeURIComponent(driveId),\n\t\titemId: decodeURIComponent(itemId),\n\t\tpath: decodeURIComponent(path),\n\t\tcontainerPackageName: containerPackageName\n\t\t\t? decodeURIComponent(containerPackageName)\n\t\t\t: undefined,\n\t\tfileVersion: fileVersion ? decodeURIComponent(fileVersion) : undefined,\n\t};\n}\n"]}
|
package/lib/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/odsp-driver";
|
|
8
|
-
export declare const pkgVersion = "2.0.0-internal.3.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-internal.3.3.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/lib/packageVersion.js
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export const pkgName = "@fluidframework/odsp-driver";
|
|
8
|
-
export const pkgVersion = "2.0.0-internal.3.
|
|
8
|
+
export const pkgVersion = "2.0.0-internal.3.3.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,6BAA6B,CAAC;AACrD,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/odsp-driver\";\nexport const pkgVersion = \"2.0.0-internal.3.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,6BAA6B,CAAC;AACrD,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/odsp-driver\";\nexport const pkgVersion = \"2.0.0-internal.3.3.0\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/odsp-driver",
|
|
3
|
-
"version": "2.0.0-internal.3.
|
|
3
|
+
"version": "2.0.0-internal.3.3.0",
|
|
4
4
|
"description": "Socket storage implementation for SPO and ODC",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -37,28 +37,28 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@fluidframework/common-definitions": "^0.20.1",
|
|
39
39
|
"@fluidframework/common-utils": "^1.1.1",
|
|
40
|
-
"@fluidframework/core-interfaces": ">=2.0.0-internal.3.
|
|
41
|
-
"@fluidframework/driver-base": ">=2.0.0-internal.3.
|
|
42
|
-
"@fluidframework/driver-definitions": ">=2.0.0-internal.3.
|
|
43
|
-
"@fluidframework/driver-utils": ">=2.0.0-internal.3.
|
|
44
|
-
"@fluidframework/gitresources": "^0.1038.
|
|
45
|
-
"@fluidframework/odsp-doclib-utils": ">=2.0.0-internal.3.
|
|
46
|
-
"@fluidframework/odsp-driver-definitions": ">=2.0.0-internal.3.
|
|
47
|
-
"@fluidframework/protocol-base": "^0.1038.
|
|
40
|
+
"@fluidframework/core-interfaces": ">=2.0.0-internal.3.3.0 <2.0.0-internal.4.0.0",
|
|
41
|
+
"@fluidframework/driver-base": ">=2.0.0-internal.3.3.0 <2.0.0-internal.4.0.0",
|
|
42
|
+
"@fluidframework/driver-definitions": ">=2.0.0-internal.3.3.0 <2.0.0-internal.4.0.0",
|
|
43
|
+
"@fluidframework/driver-utils": ">=2.0.0-internal.3.3.0 <2.0.0-internal.4.0.0",
|
|
44
|
+
"@fluidframework/gitresources": "^0.1038.3000",
|
|
45
|
+
"@fluidframework/odsp-doclib-utils": ">=2.0.0-internal.3.3.0 <2.0.0-internal.4.0.0",
|
|
46
|
+
"@fluidframework/odsp-driver-definitions": ">=2.0.0-internal.3.3.0 <2.0.0-internal.4.0.0",
|
|
47
|
+
"@fluidframework/protocol-base": "^0.1038.3000",
|
|
48
48
|
"@fluidframework/protocol-definitions": "^1.1.0",
|
|
49
|
-
"@fluidframework/telemetry-utils": ">=2.0.0-internal.3.
|
|
49
|
+
"@fluidframework/telemetry-utils": ">=2.0.0-internal.3.3.0 <2.0.0-internal.4.0.0",
|
|
50
50
|
"abort-controller": "^3.0.0",
|
|
51
51
|
"node-fetch": "^2.6.9",
|
|
52
52
|
"socket.io-client": "^4.4.1",
|
|
53
53
|
"uuid": "^8.3.1"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@fluid-tools/build-cli": "^0.
|
|
56
|
+
"@fluid-tools/build-cli": "^0.12.0",
|
|
57
57
|
"@fluidframework/build-common": "^1.1.0",
|
|
58
|
-
"@fluidframework/build-tools": "^0.
|
|
58
|
+
"@fluidframework/build-tools": "^0.12.0",
|
|
59
59
|
"@fluidframework/eslint-config-fluid": "^2.0.0",
|
|
60
|
-
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.3.
|
|
61
|
-
"@fluidframework/odsp-driver-previous": "npm:@fluidframework/odsp-driver@2.0.0-internal.3.
|
|
60
|
+
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.3.3.0 <2.0.0-internal.4.0.0",
|
|
61
|
+
"@fluidframework/odsp-driver-previous": "npm:@fluidframework/odsp-driver@2.0.0-internal.3.2.0",
|
|
62
62
|
"@microsoft/api-extractor": "^7.22.2",
|
|
63
63
|
"@rushstack/eslint-config": "^2.5.1",
|
|
64
64
|
"@types/mocha": "^9.1.1",
|
|
@@ -78,21 +78,7 @@
|
|
|
78
78
|
"typescript": "~4.5.5"
|
|
79
79
|
},
|
|
80
80
|
"typeValidation": {
|
|
81
|
-
"
|
|
82
|
-
"previousVersionStyle": "~previousMinor",
|
|
83
|
-
"baselineRange": ">=2.0.0-internal.3.1.0 <2.0.0-internal.3.2.0",
|
|
84
|
-
"baselineVersion": "2.0.0-internal.3.1.0",
|
|
85
|
-
"broken": {
|
|
86
|
-
"ClassDeclaration_OdspDocumentServiceFactory": {
|
|
87
|
-
"forwardCompat": false
|
|
88
|
-
},
|
|
89
|
-
"ClassDeclaration_OdspDocumentServiceFactoryCore": {
|
|
90
|
-
"forwardCompat": false
|
|
91
|
-
},
|
|
92
|
-
"ClassDeclaration_OdspDocumentServiceFactoryWithCodeSplit": {
|
|
93
|
-
"forwardCompat": false
|
|
94
|
-
}
|
|
95
|
-
}
|
|
81
|
+
"broken": {}
|
|
96
82
|
},
|
|
97
83
|
"scripts": {
|
|
98
84
|
"build": "npm run build:genver && concurrently npm:build:compile npm:lint && npm run build:docs",
|
|
@@ -118,7 +104,7 @@
|
|
|
118
104
|
"test:mocha": "mocha --ignore 'dist/test/types/*' --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup --unhandled-rejections=strict",
|
|
119
105
|
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
120
106
|
"tsc": "tsc",
|
|
121
|
-
"typetests:gen": "
|
|
107
|
+
"typetests:gen": "fluid-type-test-generator",
|
|
122
108
|
"typetests:prepare": "flub generate typetests --prepare --dir . --pin"
|
|
123
109
|
}
|
|
124
110
|
}
|
|
@@ -387,7 +387,7 @@ export class OdspDocumentDeltaConnection extends DocumentDeltaConnection {
|
|
|
387
387
|
logger: ITelemetryLogger,
|
|
388
388
|
private readonly enableMultiplexing?: boolean,
|
|
389
389
|
) {
|
|
390
|
-
super(socket, documentId, logger);
|
|
390
|
+
super(socket, documentId, logger, false, uuid());
|
|
391
391
|
this.socketReference = socketReference;
|
|
392
392
|
this.requestOpsNoncePrefix = `${uuid()}-`;
|
|
393
393
|
}
|
|
@@ -493,6 +493,9 @@ export class OdspDocumentDeltaConnection extends DocumentDeltaConnection {
|
|
|
493
493
|
{
|
|
494
494
|
eventName: "ServerDisconnect",
|
|
495
495
|
clientId: this.hasDetails ? this.clientId : undefined,
|
|
496
|
+
details: JSON.stringify({
|
|
497
|
+
connection: this.connectionId,
|
|
498
|
+
}),
|
|
496
499
|
},
|
|
497
500
|
error,
|
|
498
501
|
);
|
|
@@ -127,6 +127,7 @@ export class OdspDocumentService implements IDocumentService {
|
|
|
127
127
|
this._policies = {
|
|
128
128
|
// load in storage-only mode if a file version is specified
|
|
129
129
|
storageOnly: odspResolvedUrl.fileVersion !== undefined,
|
|
130
|
+
summarizeProtocolTree: true,
|
|
130
131
|
};
|
|
131
132
|
|
|
132
133
|
this.mc = loggerToMonitoringContext(
|
|
@@ -49,6 +49,9 @@ import {
|
|
|
49
49
|
* to leverage code splitting as a means to keep bundles as small as possible.
|
|
50
50
|
*/
|
|
51
51
|
export class OdspDocumentServiceFactoryCore implements IDocumentServiceFactory {
|
|
52
|
+
/**
|
|
53
|
+
* @deprecated 2.0.0-internal.3.3.0 Document service factories should not be distinguished by unique non-standard protocols. To be removed in an upcoming release.
|
|
54
|
+
*/
|
|
52
55
|
public readonly protocolName = "fluid-odsp:";
|
|
53
56
|
|
|
54
57
|
private readonly nonPersistentCache: INonPersistentCache = new NonPersistentCache();
|
|
@@ -141,21 +141,11 @@ export class OdspDriverUrlResolver implements IUrlResolver {
|
|
|
141
141
|
const hashedDocumentId = await getHashedDocumentId(driveId, itemId);
|
|
142
142
|
assert(!hashedDocumentId.includes("/"), 0x0a8 /* "Docid should not contain slashes!!" */);
|
|
143
143
|
|
|
144
|
-
|
|
144
|
+
const documentUrl = `fluid-odsp://placeholder/placeholder/${hashedDocumentId}/${removeBeginningSlash(
|
|
145
145
|
path,
|
|
146
146
|
)}`;
|
|
147
147
|
|
|
148
|
-
if (request.url.length > 0) {
|
|
149
|
-
// In case of any additional parameters add them back to the url
|
|
150
|
-
const requestURL = new URL(request.url);
|
|
151
|
-
const searchParams = requestURL.search;
|
|
152
|
-
if (searchParams) {
|
|
153
|
-
documentUrl += searchParams;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
148
|
const summarizer = !!request.headers?.[DriverHeader.summarizingClient];
|
|
158
|
-
|
|
159
149
|
return {
|
|
160
150
|
type: "fluid",
|
|
161
151
|
odspResolvedUrl: true,
|
package/src/packageVersion.ts
CHANGED