@fluidframework/odsp-driver 2.42.0 → 2.43.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.
Files changed (77) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/contractsPublic.d.ts +11 -1
  3. package/dist/contractsPublic.d.ts.map +1 -1
  4. package/dist/contractsPublic.js +9 -2
  5. package/dist/contractsPublic.js.map +1 -1
  6. package/dist/fetchSnapshot.d.ts.map +1 -1
  7. package/dist/fetchSnapshot.js +11 -2
  8. package/dist/fetchSnapshot.js.map +1 -1
  9. package/dist/index.d.ts +1 -0
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +4 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/localOdspDriver/localOdspDocumentService.d.ts +6 -1
  14. package/dist/localOdspDriver/localOdspDocumentService.d.ts.map +1 -1
  15. package/dist/localOdspDriver/localOdspDocumentService.js +8 -0
  16. package/dist/localOdspDriver/localOdspDocumentService.js.map +1 -1
  17. package/dist/localOdspDriver/localOdspLayerCompatState.d.ts +11 -0
  18. package/dist/localOdspDriver/localOdspLayerCompatState.d.ts.map +1 -0
  19. package/dist/localOdspDriver/localOdspLayerCompatState.js +27 -0
  20. package/dist/localOdspDriver/localOdspLayerCompatState.js.map +1 -0
  21. package/dist/odspDocumentService.d.ts +6 -1
  22. package/dist/odspDocumentService.d.ts.map +1 -1
  23. package/dist/odspDocumentService.js +8 -0
  24. package/dist/odspDocumentService.js.map +1 -1
  25. package/dist/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
  26. package/dist/odspDriverUrlResolverForShareLink.js +2 -0
  27. package/dist/odspDriverUrlResolverForShareLink.js.map +1 -1
  28. package/dist/odspLayerCompatState.d.ts +11 -0
  29. package/dist/odspLayerCompatState.d.ts.map +1 -0
  30. package/dist/odspLayerCompatState.js +27 -0
  31. package/dist/odspLayerCompatState.js.map +1 -0
  32. package/dist/packageVersion.d.ts +1 -1
  33. package/dist/packageVersion.js +1 -1
  34. package/dist/packageVersion.js.map +1 -1
  35. package/lib/contractsPublic.d.ts +11 -1
  36. package/lib/contractsPublic.d.ts.map +1 -1
  37. package/lib/contractsPublic.js +9 -2
  38. package/lib/contractsPublic.js.map +1 -1
  39. package/lib/fetchSnapshot.d.ts.map +1 -1
  40. package/lib/fetchSnapshot.js +11 -2
  41. package/lib/fetchSnapshot.js.map +1 -1
  42. package/lib/index.d.ts +1 -0
  43. package/lib/index.d.ts.map +1 -1
  44. package/lib/index.js +2 -0
  45. package/lib/index.js.map +1 -1
  46. package/lib/localOdspDriver/localOdspDocumentService.d.ts +6 -1
  47. package/lib/localOdspDriver/localOdspDocumentService.d.ts.map +1 -1
  48. package/lib/localOdspDriver/localOdspDocumentService.js +8 -0
  49. package/lib/localOdspDriver/localOdspDocumentService.js.map +1 -1
  50. package/lib/localOdspDriver/localOdspLayerCompatState.d.ts +11 -0
  51. package/lib/localOdspDriver/localOdspLayerCompatState.d.ts.map +1 -0
  52. package/lib/localOdspDriver/localOdspLayerCompatState.js +24 -0
  53. package/lib/localOdspDriver/localOdspLayerCompatState.js.map +1 -0
  54. package/lib/odspDocumentService.d.ts +6 -1
  55. package/lib/odspDocumentService.d.ts.map +1 -1
  56. package/lib/odspDocumentService.js +8 -0
  57. package/lib/odspDocumentService.js.map +1 -1
  58. package/lib/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
  59. package/lib/odspDriverUrlResolverForShareLink.js +2 -0
  60. package/lib/odspDriverUrlResolverForShareLink.js.map +1 -1
  61. package/lib/odspLayerCompatState.d.ts +11 -0
  62. package/lib/odspLayerCompatState.d.ts.map +1 -0
  63. package/lib/odspLayerCompatState.js +24 -0
  64. package/lib/odspLayerCompatState.js.map +1 -0
  65. package/lib/packageVersion.d.ts +1 -1
  66. package/lib/packageVersion.js +1 -1
  67. package/lib/packageVersion.js.map +1 -1
  68. package/package.json +14 -14
  69. package/src/contractsPublic.ts +10 -2
  70. package/src/fetchSnapshot.ts +15 -2
  71. package/src/index.ts +3 -0
  72. package/src/localOdspDriver/localOdspDocumentService.ts +10 -1
  73. package/src/localOdspDriver/localOdspLayerCompatState.ts +27 -0
  74. package/src/odspDocumentService.ts +10 -1
  75. package/src/odspDriverUrlResolverForShareLink.ts +3 -0
  76. package/src/odspLayerCompatState.ts +27 -0
  77. package/src/packageVersion.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"odspDriverUrlResolverForShareLink.js","sourceRoot":"","sources":["../src/odspDriverUrlResolverForShareLink.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAcnE,OAAO,EAA6B,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EACN,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,uBAAuB,GACvB,MAAM,gBAAgB,CAAC;AAkBxB;;;;;;GAMG;AACH,MAAM,OAAO,iCAAiC;IAK7C;;;;;;;;;;;;OAYG;IACH,YACC,qBAAyD,EACzD,MAA6B,EACZ,OAAgB,EAChB,UAGe,EACf,oBAA4C;QAL5C,YAAO,GAAP,OAAO,CAAS;QAChB,eAAU,GAAV,UAAU,CAGK;QACf,yBAAoB,GAApB,oBAAoB,CAAwB;QAxB7C,qBAAgB,GAAG,IAAI,YAAY,EAAkB,CAAC;QA0BtE,IAAI,CAAC,MAAM,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,qBAAqB,EAAE,CAAC;YAC3B,IAAI,CAAC,qBAAqB,GAAG;gBAC5B,GAAG,qBAAqB;gBACxB,YA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;QAExF;;;;;aAKK;QACL,MAAM,oBAAoB,GACzB,uBAAuB,CAAC,iBAAiB,CAAC;YAC1C,eAAe,CAAC,QAAQ,EAAE,oBAAoB;YAC9C,uBAAuB,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAEpD,eAAe,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAEvC,OAAO,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,oBAAoB,CAAC,CAAC;IAC5F,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,iBAAiB,CAC9B,OAAe,EACf,UAAqC;QAErC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;QAE7B,qBAAqB,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;QAEvC,OAAO,GAAG,CAAC,IAAI,CAAC;IACjB,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest, ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { PromiseCache } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIContainerPackageInfo,\n\tIResolvedUrl,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tIOdspResolvedUrl,\n\tIdentityType,\n\tOdspResourceTokenFetchOptions,\n\tTokenFetcher,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { OdspFluidDataStoreLocator, SharingLinkHeader } from \"./contractsPublic.js\";\nimport { createOdspUrl } from \"./createOdspUrl.js\";\nimport { getFileLink } from \"./getFileLink.js\";\nimport { OdspDriverUrlResolver } from \"./odspDriverUrlResolver.js\";\nimport {\n\tgetLocatorFromOdspUrl,\n\tlocatorQueryParamName,\n\tstoreLocatorInOdspUrl,\n} from \"./odspFluidFileLink.js\";\nimport {\n\tappendNavParam,\n\tcreateOdspLogger,\n\tgetOdspResolvedUrl,\n\tgetContainerPackageName,\n} from \"./odspUtils.js\";\n\n/**\n * Properties passed to the code responsible for fetching share link for a file.\n * @legacy\n * @alpha\n */\nexport interface ShareLinkFetcherProps {\n\t/**\n\t * Callback method that is used to fetch access token necessary to call API that produces share link\n\t */\n\ttokenFetcher: TokenFetcher<OdspResourceTokenFetchOptions>;\n\t/**\n\t * Identity type determining the shape of share link as it differs for Enterprise and Consumer users.\n\t */\n\tidentityType: IdentityType;\n}\n\n/**\n * Resolver to resolve urls like the ones created by createOdspUrl which is driver inner\n * url format and the ones which have things like driveId, siteId, itemId etc encoded in nav param.\n * This resolver also handles share links and try to generate one for the use by the app.\n * @legacy\n * @alpha\n */\nexport class OdspDriverUrlResolverForShareLink implements IUrlResolver {\n\tprivate readonly logger: ITelemetryLoggerExt;\n\tprivate readonly sharingLinkCache = new PromiseCache<string, string>();\n\tprivate readonly shareLinkFetcherProps: ShareLinkFetcherProps | undefined;\n\n\t/**\n\t * Creates url resolver instance\n\t * @param shareLinkFetcherProps - properties used when fetching share link.\n\t * Can be set as 'undefined' for cases where share link is not needed. Currently, only\n\t * getAbsoluteUrl() method requires share link.\n\t * @param logger - logger object that is used as telemetry sink\n\t * @param appName - application name hint that is encoded with url produced by getAbsoluteUrl() method.\n\t * This hint is used by link handling logic which determines which app to redirect to when user\n\t * navigates directly to the link.\n\t * @param getContext - callback function which is used to get context for given resolved url. If context\n\t * is returned then it will be embedded into url returned by getAbsoluteUrl() method.\n\t * @param containerPackageInfo - container package information which will be used to extract the container package name.\n\t */\n\tpublic constructor(\n\t\tshareLinkFetcherProps?: ShareLinkFetcherProps | undefined,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\tprivate readonly appName?: string,\n\t\tprivate readonly getContext?: (\n\t\t\tresolvedUrl: IOdspResolvedUrl,\n\t\t\tdataStorePath: string,\n\t\t) => Promise<string | undefined>,\n\t\tprivate readonly containerPackageInfo?: IContainerPackageInfo,\n\t) {\n\t\tthis.logger = createOdspLogger(logger);\n\t\tif (shareLinkFetcherProps) {\n\t\t\tthis.shareLinkFetcherProps = {\n\t\t\t\t...shareLinkFetcherProps,\n\t\t\t\ttokenFetcher: shareLinkFetcherProps.tokenFetcher,\n\t\t\t};\n\t\t}\n\t}\n\n\t/**\n\t * Takes an already generated data store url (from requestUrl) and appends a path to the\n\t * existing data store information.\n\t */\n\tpublic appendDataStorePath(requestUrl: URL, pathToAppend: string): string | undefined {\n\t\tconst fluidInfo = getLocatorFromOdspUrl(requestUrl);\n\n\t\tif (!fluidInfo) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst parsingUrl = new URL(\n\t\t\tfluidInfo.dataStorePath,\n\t\t\t`${requestUrl.protocol}//${requestUrl.hostname}`,\n\t\t);\n\t\t// Determine if the caller is passing a query parameter or path since processing will be different.\n\t\tif (pathToAppend.startsWith(\"/?\") || pathToAppend.startsWith(\"?\")) {\n\t\t\tconst queryParams = new URLSearchParams(pathToAppend);\n\t\t\tfor (const [key, value] of queryParams.entries()) {\n\t\t\t\tparsingUrl.searchParams.append(key, value);\n\t\t\t}\n\t\t\tfluidInfo.dataStorePath = `${parsingUrl.pathname}${parsingUrl.search}`;\n\t\t} else {\n\t\t\tfluidInfo.dataStorePath = `${parsingUrl.pathname}${\n\t\t\t\tparsingUrl.pathname.endsWith(\"/\") || pathToAppend.startsWith(\"/\") ? \"\" : \"/\"\n\t\t\t}${pathToAppend}/${parsingUrl.search}`;\n\t\t}\n\t\tstoreLocatorInOdspUrl(requestUrl, fluidInfo);\n\n\t\treturn requestUrl.href;\n\t}\n\n\tprivate getKey(resolvedUrl: IOdspResolvedUrl): string {\n\t\treturn `${resolvedUrl.siteUrl},${resolvedUrl.driveId},${resolvedUrl.itemId}`;\n\t}\n\n\t/**\n\t * Resolves request URL into driver details\n\t */\n\tpublic async resolve(request: IRequest): Promise<IOdspResolvedUrl> {\n\t\tconst requestToBeResolved = { headers: request.headers, url: request.url };\n\t\tconst isSharingLinkToRedeem =\n\t\t\trequestToBeResolved.headers?.[SharingLinkHeader.isSharingLinkToRedeem];\n\t\ttry {\n\t\t\tconst url = new URL(request.url);\n\n\t\t\tconst odspFluidInfo = getLocatorFromOdspUrl(url);\n\t\t\tif (odspFluidInfo) {\n\t\t\t\trequestToBeResolved.url = createOdspUrl(odspFluidInfo);\n\t\t\t}\n\t\t} catch {\n\t\t\t// If the locator throws some error, then try to resolve the request as it is.\n\t\t}\n\n\t\tconst odspResolvedUrl = await new OdspDriverUrlResolver().resolve(requestToBeResolved);\n\n\t\todspResolvedUrl.context = await this.getContext?.(\n\t\t\todspResolvedUrl,\n\t\t\todspResolvedUrl.dataStorePath ?? \"\",\n\t\t);\n\n\t\todspResolvedUrl.appName = this.appName;\n\n\t\todspResolvedUrl.codeHint = odspResolvedUrl.codeHint?.containerPackageName\n\t\t\t? odspResolvedUrl.codeHint\n\t\t\t: { containerPackageName: getContainerPackageName(this.containerPackageInfo) };\n\n\t\tif (isSharingLinkToRedeem) {\n\t\t\t// We need to remove the nav param if set by host when setting the sharelink as otherwise the shareLinkId\n\t\t\t// when redeeming the share link during the redeem fallback for trees latest call becomes greater than\n\t\t\t// the eligible length.\n\t\t\todspResolvedUrl.shareLinkInfo = Object.assign(odspResolvedUrl.shareLinkInfo ?? {}, {\n\t\t\t\tsharingLinkToRedeem: this.removeNavParam(request.url),\n\t\t\t});\n\t\t}\n\t\tif (odspResolvedUrl.itemId) {\n\t\t\t// Kick start the sharing link request if we don't have it already as a performance optimization.\n\t\t\t// For detached create new, we don't have an item id yet and therefore cannot generate a share link\n\t\t\tthis.getShareLinkPromise(odspResolvedUrl).catch(() => {});\n\t\t}\n\t\treturn odspResolvedUrl;\n\t}\n\n\tprivate removeNavParam(link: string): string {\n\t\tconst url = new URL(link);\n\t\tconst params = new URLSearchParams(url.search);\n\t\tparams.delete(locatorQueryParamName);\n\t\turl.search = params.toString();\n\t\treturn url.href;\n\t}\n\n\tprivate async getShareLinkPromise(resolvedUrl: IOdspResolvedUrl): Promise<string> {\n\t\tif (this.shareLinkFetcherProps === undefined) {\n\t\t\tthrow new Error(\"Failed to get share link because share link fetcher props are missing\");\n\t\t}\n\n\t\tif (!(resolvedUrl.siteUrl && resolvedUrl.driveId && resolvedUrl.itemId)) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Failed to get share link because necessary information is missing \" +\n\t\t\t\t\t\"(e.g. siteUrl, driveId or itemId)\",\n\t\t\t);\n\t\t}\n\n\t\tconst key = this.getKey(resolvedUrl);\n\t\tconst cachedLinkPromise = this.sharingLinkCache.get(key);\n\t\tif (cachedLinkPromise) {\n\t\t\treturn cachedLinkPromise;\n\t\t}\n\t\tconst newLinkPromise = getFileLink(\n\t\t\tthis.shareLinkFetcherProps.tokenFetcher,\n\t\t\tresolvedUrl,\n\t\t\tthis.logger,\n\t\t).catch((error) => {\n\t\t\t// This should imply that error is a non-retriable error.\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"FluidFileUrlError\" }, error);\n\t\t\tthis.sharingLinkCache.remove(key);\n\t\t\tthrow error;\n\t\t});\n\t\tthis.sharingLinkCache.add(key, async () => newLinkPromise);\n\t\treturn newLinkPromise;\n\t}\n\n\t/**\n\t * Requests a driver + data store storage URL. Note that this method requires share link to be fetched\n\t * and it will throw in case share link fetcher props were not specified when instance was created.\n\t * @param resolvedUrl - The driver resolved URL\n\t * @param dataStorePath - 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\tdataStorePath: string,\n\t\tpackageInfoSource?: IContainerPackageInfo,\n\t): Promise<string> {\n\t\tconst odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n\n\t\tconst shareLink = await this.getShareLinkPromise(odspResolvedUrl);\n\n\t\treturn this.appendLocatorParams(shareLink, resolvedUrl, dataStorePath, packageInfoSource);\n\t}\n\n\t/**\n\t * Appends the store locator properties to the provided base URL. This function is useful for scenarios where an application\n\t * has a base URL (for example a sharing link) of the Fluid file, but does not have the locator information that would be used by Fluid\n\t * to load the file later.\n\t * @param baseUrl - The input URL on which the locator params will be appended.\n\t * @param resolvedUrl - odsp-driver's resolvedURL object.\n\t * @param dataStorePath - 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 * @returns The provided base URL appended with odsp-specific locator information\n\t */\n\tpublic async appendLocatorParams(\n\t\tbaseUrl: string,\n\t\tresolvedUrl: IResolvedUrl,\n\t\tdataStorePath: string,\n\t\tpackageInfoSource?: IContainerPackageInfo,\n\t): Promise<string> {\n\t\tconst odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n\n\t\t// If the user has passed an empty dataStorePath, then extract it from the resolved url.\n\t\tconst actualDataStorePath = dataStorePath || (odspResolvedUrl.dataStorePath ?? \"\");\n\n\t\todspResolvedUrl.context = await this.getContext?.(odspResolvedUrl, actualDataStorePath);\n\n\t\t/**\n\t\t * containerPackageName can be provided by various ways, in the order of priority:\n\t\t * 1. packageInfoSource - passed by the call of appendLocatorParams\n\t\t * 2. odspResolvedUrl.codeHint?.containerPackageName - passed by the odsp-driver's resolvedURL object\n\t\t * 3. this.containerPackageInfo - passed by the constructor of OdspDrvierUrlResolverForShareLink\n\t\t * */\n\t\tconst containerPackageName: string | undefined =\n\t\t\tgetContainerPackageName(packageInfoSource) ??\n\t\t\todspResolvedUrl.codeHint?.containerPackageName ??\n\t\t\tgetContainerPackageName(this.containerPackageInfo);\n\n\t\todspResolvedUrl.appName = this.appName;\n\n\t\treturn appendNavParam(baseUrl, odspResolvedUrl, actualDataStorePath, containerPackageName);\n\t}\n\n\t/**\n\t * Crafts a supported document/driver URL\n\t */\n\tpublic static createDocumentUrl(\n\t\tbaseUrl: string,\n\t\tdriverInfo: OdspFluidDataStoreLocator,\n\t): string {\n\t\tconst url = new URL(baseUrl);\n\n\t\tstoreLocatorInOdspUrl(url, driverInfo);\n\n\t\treturn url.href;\n\t}\n}\n"]}
1
+ {"version":3,"file":"odspDriverUrlResolverForShareLink.js","sourceRoot":"","sources":["../src/odspDriverUrlResolverForShareLink.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAcnE,OAAO,EAA6B,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EACN,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,uBAAuB,GACvB,MAAM,gBAAgB,CAAC;AAkBxB;;;;;;GAMG;AACH,MAAM,OAAO,iCAAiC;IAK7C;;;;;;;;;;;;OAYG;IACH,YACC,qBAAyD,EACzD,MAA6B,EACZ,OAAgB,EAChB,UAGe,EACf,oBAA4C;QAL5C,YAAO,GAAP,OAAO,CAAS;QAChB,eAAU,GAAV,UAAU,CAGK;QACf,yBAAoB,GAApB,oBAAoB,CAAwB;QAxB7C,qBAAgB,GAAG,IAAI,YAAY,EAAkB,CAAC;QA0BtE,IAAI,CAAC,MAAM,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,qBAAqB,EAAE,CAAC;YAC3B,IAAI,CAAC,qBAAqB,GAAG;gBAC5B,GAAG,qBAAqB;gBACxB,YAAY,EAAE,qBAAqB,CAAC,YAAY;aAChD,CAAC;QACH,CAAC;IACF,CAAC;IAED;;;OAGG;IACI,mBAAmB,CAAC,UAAe,EAAE,YAAoB;QAC/D,MAAM,SAAS,GAAG,q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F;;;;;aAKK;QACL,MAAM,oBAAoB,GACzB,uBAAuB,CAAC,iBAAiB,CAAC;YAC1C,eAAe,CAAC,QAAQ,EAAE,oBAAoB;YAC9C,uBAAuB,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAEpD,eAAe,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAEvC,OAAO,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,oBAAoB,CAAC,CAAC;IAC5F,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,iBAAiB,CAC9B,OAAe,EACf,UAAqC;QAErC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;QAE7B,qBAAqB,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;QAEvC,OAAO,GAAG,CAAC,IAAI,CAAC;IACjB,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest, ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { PromiseCache } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIContainerPackageInfo,\n\tIResolvedUrl,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tIOdspResolvedUrl,\n\tIdentityType,\n\tOdspResourceTokenFetchOptions,\n\tTokenFetcher,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { OdspFluidDataStoreLocator, SharingLinkHeader } from \"./contractsPublic.js\";\nimport { createOdspUrl } from \"./createOdspUrl.js\";\nimport { getFileLink } from \"./getFileLink.js\";\nimport { OdspDriverUrlResolver } from \"./odspDriverUrlResolver.js\";\nimport {\n\tgetLocatorFromOdspUrl,\n\tlocatorQueryParamName,\n\tstoreLocatorInOdspUrl,\n} from \"./odspFluidFileLink.js\";\nimport {\n\tappendNavParam,\n\tcreateOdspLogger,\n\tgetOdspResolvedUrl,\n\tgetContainerPackageName,\n} from \"./odspUtils.js\";\n\n/**\n * Properties passed to the code responsible for fetching share link for a file.\n * @legacy\n * @alpha\n */\nexport interface ShareLinkFetcherProps {\n\t/**\n\t * Callback method that is used to fetch access token necessary to call API that produces share link\n\t */\n\ttokenFetcher: TokenFetcher<OdspResourceTokenFetchOptions>;\n\t/**\n\t * Identity type determining the shape of share link as it differs for Enterprise and Consumer users.\n\t */\n\tidentityType: IdentityType;\n}\n\n/**\n * Resolver to resolve urls like the ones created by createOdspUrl which is driver inner\n * url format and the ones which have things like driveId, siteId, itemId etc encoded in nav param.\n * This resolver also handles share links and try to generate one for the use by the app.\n * @legacy\n * @alpha\n */\nexport class OdspDriverUrlResolverForShareLink implements IUrlResolver {\n\tprivate readonly logger: ITelemetryLoggerExt;\n\tprivate readonly sharingLinkCache = new PromiseCache<string, string>();\n\tprivate readonly shareLinkFetcherProps: ShareLinkFetcherProps | undefined;\n\n\t/**\n\t * Creates url resolver instance\n\t * @param shareLinkFetcherProps - properties used when fetching share link.\n\t * Can be set as 'undefined' for cases where share link is not needed. Currently, only\n\t * getAbsoluteUrl() method requires share link.\n\t * @param logger - logger object that is used as telemetry sink\n\t * @param appName - application name hint that is encoded with url produced by getAbsoluteUrl() method.\n\t * This hint is used by link handling logic which determines which app to redirect to when user\n\t * navigates directly to the link.\n\t * @param getContext - callback function which is used to get context for given resolved url. If context\n\t * is returned then it will be embedded into url returned by getAbsoluteUrl() method.\n\t * @param containerPackageInfo - container package information which will be used to extract the container package name.\n\t */\n\tpublic constructor(\n\t\tshareLinkFetcherProps?: ShareLinkFetcherProps | undefined,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\tprivate readonly appName?: string,\n\t\tprivate readonly getContext?: (\n\t\t\tresolvedUrl: IOdspResolvedUrl,\n\t\t\tdataStorePath: string,\n\t\t) => Promise<string | undefined>,\n\t\tprivate readonly containerPackageInfo?: IContainerPackageInfo,\n\t) {\n\t\tthis.logger = createOdspLogger(logger);\n\t\tif (shareLinkFetcherProps) {\n\t\t\tthis.shareLinkFetcherProps = {\n\t\t\t\t...shareLinkFetcherProps,\n\t\t\t\ttokenFetcher: shareLinkFetcherProps.tokenFetcher,\n\t\t\t};\n\t\t}\n\t}\n\n\t/**\n\t * Takes an already generated data store url (from requestUrl) and appends a path to the\n\t * existing data store information.\n\t */\n\tpublic appendDataStorePath(requestUrl: URL, pathToAppend: string): string | undefined {\n\t\tconst fluidInfo = getLocatorFromOdspUrl(requestUrl);\n\n\t\tif (!fluidInfo) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst parsingUrl = new URL(\n\t\t\tfluidInfo.dataStorePath,\n\t\t\t`${requestUrl.protocol}//${requestUrl.hostname}`,\n\t\t);\n\t\t// Determine if the caller is passing a query parameter or path since processing will be different.\n\t\tif (pathToAppend.startsWith(\"/?\") || pathToAppend.startsWith(\"?\")) {\n\t\t\tconst queryParams = new URLSearchParams(pathToAppend);\n\t\t\tfor (const [key, value] of queryParams.entries()) {\n\t\t\t\tparsingUrl.searchParams.append(key, value);\n\t\t\t}\n\t\t\tfluidInfo.dataStorePath = `${parsingUrl.pathname}${parsingUrl.search}`;\n\t\t} else {\n\t\t\tfluidInfo.dataStorePath = `${parsingUrl.pathname}${\n\t\t\t\tparsingUrl.pathname.endsWith(\"/\") || pathToAppend.startsWith(\"/\") ? \"\" : \"/\"\n\t\t\t}${pathToAppend}/${parsingUrl.search}`;\n\t\t}\n\t\tstoreLocatorInOdspUrl(requestUrl, fluidInfo);\n\n\t\treturn requestUrl.href;\n\t}\n\n\tprivate getKey(resolvedUrl: IOdspResolvedUrl): string {\n\t\treturn `${resolvedUrl.siteUrl},${resolvedUrl.driveId},${resolvedUrl.itemId}`;\n\t}\n\n\t/**\n\t * Resolves request URL into driver details\n\t */\n\tpublic async resolve(request: IRequest): Promise<IOdspResolvedUrl> {\n\t\tconst requestToBeResolved = { headers: request.headers, url: request.url };\n\t\tconst isSharingLinkToRedeem =\n\t\t\trequestToBeResolved.headers?.[SharingLinkHeader.isSharingLinkToRedeem];\n\t\tconst isRedemptionNonDurable =\n\t\t\trequestToBeResolved.headers?.[SharingLinkHeader.isRedemptionNonDurable];\n\t\ttry {\n\t\t\tconst url = new URL(request.url);\n\n\t\t\tconst odspFluidInfo = getLocatorFromOdspUrl(url);\n\t\t\tif (odspFluidInfo) {\n\t\t\t\trequestToBeResolved.url = createOdspUrl(odspFluidInfo);\n\t\t\t}\n\t\t} catch {\n\t\t\t// If the locator throws some error, then try to resolve the request as it is.\n\t\t}\n\n\t\tconst odspResolvedUrl = await new OdspDriverUrlResolver().resolve(requestToBeResolved);\n\n\t\todspResolvedUrl.context = await this.getContext?.(\n\t\t\todspResolvedUrl,\n\t\t\todspResolvedUrl.dataStorePath ?? \"\",\n\t\t);\n\n\t\todspResolvedUrl.appName = this.appName;\n\n\t\todspResolvedUrl.codeHint = odspResolvedUrl.codeHint?.containerPackageName\n\t\t\t? odspResolvedUrl.codeHint\n\t\t\t: { containerPackageName: getContainerPackageName(this.containerPackageInfo) };\n\n\t\tif (isSharingLinkToRedeem) {\n\t\t\t// We need to remove the nav param if set by host when setting the sharelink as otherwise the shareLinkId\n\t\t\t// when redeeming the share link during the redeem fallback for trees latest call becomes greater than\n\t\t\t// the eligible length.\n\t\t\todspResolvedUrl.shareLinkInfo = Object.assign(odspResolvedUrl.shareLinkInfo ?? {}, {\n\t\t\t\tsharingLinkToRedeem: this.removeNavParam(request.url),\n\t\t\t\tisRedemptionNonDurable: isRedemptionNonDurable ?? false,\n\t\t\t});\n\t\t}\n\t\tif (odspResolvedUrl.itemId) {\n\t\t\t// Kick start the sharing link request if we don't have it already as a performance optimization.\n\t\t\t// For detached create new, we don't have an item id yet and therefore cannot generate a share link\n\t\t\tthis.getShareLinkPromise(odspResolvedUrl).catch(() => {});\n\t\t}\n\t\treturn odspResolvedUrl;\n\t}\n\n\tprivate removeNavParam(link: string): string {\n\t\tconst url = new URL(link);\n\t\tconst params = new URLSearchParams(url.search);\n\t\tparams.delete(locatorQueryParamName);\n\t\turl.search = params.toString();\n\t\treturn url.href;\n\t}\n\n\tprivate async getShareLinkPromise(resolvedUrl: IOdspResolvedUrl): Promise<string> {\n\t\tif (this.shareLinkFetcherProps === undefined) {\n\t\t\tthrow new Error(\"Failed to get share link because share link fetcher props are missing\");\n\t\t}\n\n\t\tif (!(resolvedUrl.siteUrl && resolvedUrl.driveId && resolvedUrl.itemId)) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Failed to get share link because necessary information is missing \" +\n\t\t\t\t\t\"(e.g. siteUrl, driveId or itemId)\",\n\t\t\t);\n\t\t}\n\n\t\tconst key = this.getKey(resolvedUrl);\n\t\tconst cachedLinkPromise = this.sharingLinkCache.get(key);\n\t\tif (cachedLinkPromise) {\n\t\t\treturn cachedLinkPromise;\n\t\t}\n\t\tconst newLinkPromise = getFileLink(\n\t\t\tthis.shareLinkFetcherProps.tokenFetcher,\n\t\t\tresolvedUrl,\n\t\t\tthis.logger,\n\t\t).catch((error) => {\n\t\t\t// This should imply that error is a non-retriable error.\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"FluidFileUrlError\" }, error);\n\t\t\tthis.sharingLinkCache.remove(key);\n\t\t\tthrow error;\n\t\t});\n\t\tthis.sharingLinkCache.add(key, async () => newLinkPromise);\n\t\treturn newLinkPromise;\n\t}\n\n\t/**\n\t * Requests a driver + data store storage URL. Note that this method requires share link to be fetched\n\t * and it will throw in case share link fetcher props were not specified when instance was created.\n\t * @param resolvedUrl - The driver resolved URL\n\t * @param dataStorePath - 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\tdataStorePath: string,\n\t\tpackageInfoSource?: IContainerPackageInfo,\n\t): Promise<string> {\n\t\tconst odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n\n\t\tconst shareLink = await this.getShareLinkPromise(odspResolvedUrl);\n\n\t\treturn this.appendLocatorParams(shareLink, resolvedUrl, dataStorePath, packageInfoSource);\n\t}\n\n\t/**\n\t * Appends the store locator properties to the provided base URL. This function is useful for scenarios where an application\n\t * has a base URL (for example a sharing link) of the Fluid file, but does not have the locator information that would be used by Fluid\n\t * to load the file later.\n\t * @param baseUrl - The input URL on which the locator params will be appended.\n\t * @param resolvedUrl - odsp-driver's resolvedURL object.\n\t * @param dataStorePath - 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 * @returns The provided base URL appended with odsp-specific locator information\n\t */\n\tpublic async appendLocatorParams(\n\t\tbaseUrl: string,\n\t\tresolvedUrl: IResolvedUrl,\n\t\tdataStorePath: string,\n\t\tpackageInfoSource?: IContainerPackageInfo,\n\t): Promise<string> {\n\t\tconst odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n\n\t\t// If the user has passed an empty dataStorePath, then extract it from the resolved url.\n\t\tconst actualDataStorePath = dataStorePath || (odspResolvedUrl.dataStorePath ?? \"\");\n\n\t\todspResolvedUrl.context = await this.getContext?.(odspResolvedUrl, actualDataStorePath);\n\n\t\t/**\n\t\t * containerPackageName can be provided by various ways, in the order of priority:\n\t\t * 1. packageInfoSource - passed by the call of appendLocatorParams\n\t\t * 2. odspResolvedUrl.codeHint?.containerPackageName - passed by the odsp-driver's resolvedURL object\n\t\t * 3. this.containerPackageInfo - passed by the constructor of OdspDrvierUrlResolverForShareLink\n\t\t * */\n\t\tconst containerPackageName: string | undefined =\n\t\t\tgetContainerPackageName(packageInfoSource) ??\n\t\t\todspResolvedUrl.codeHint?.containerPackageName ??\n\t\t\tgetContainerPackageName(this.containerPackageInfo);\n\n\t\todspResolvedUrl.appName = this.appName;\n\n\t\treturn appendNavParam(baseUrl, odspResolvedUrl, actualDataStorePath, containerPackageName);\n\t}\n\n\t/**\n\t * Crafts a supported document/driver URL\n\t */\n\tpublic static createDocumentUrl(\n\t\tbaseUrl: string,\n\t\tdriverInfo: OdspFluidDataStoreLocator,\n\t): string {\n\t\tconst url = new URL(baseUrl);\n\n\t\tstoreLocatorInOdspUrl(url, driverInfo);\n\n\t\treturn url.href;\n\t}\n}\n"]}
@@ -0,0 +1,11 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { type ILayerCompatDetails } from "@fluid-internal/client-utils";
6
+ /**
7
+ * ODSP Driver's compatibility details that is exposed to the Loader layer.
8
+ * @internal
9
+ */
10
+ export declare const odspDriverCompatDetailsForLoader: ILayerCompatDetails;
11
+ //# sourceMappingURL=odspLayerCompatState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"odspLayerCompatState.d.ts","sourceRoot":"","sources":["../src/odspLayerCompatState.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAIxE;;;GAGG;AACH,eAAO,MAAM,gCAAgC,EAAE,mBAa9C,CAAC"}
@@ -0,0 +1,24 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { pkgVersion } from "./packageVersion.js";
6
+ /**
7
+ * ODSP Driver's compatibility details that is exposed to the Loader layer.
8
+ * @internal
9
+ */
10
+ export const odspDriverCompatDetailsForLoader = {
11
+ /**
12
+ * The package version of the ODSP Driver layer.
13
+ */
14
+ pkgVersion,
15
+ /**
16
+ * The current generation of the ODSP Driver layer.
17
+ */
18
+ generation: 1,
19
+ /**
20
+ * The features supported by the ODSP Driver layer across the Driver / Loader boundary.
21
+ */
22
+ supportedFeatures: new Set(),
23
+ };
24
+ //# sourceMappingURL=odspLayerCompatState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"odspLayerCompatState.js","sourceRoot":"","sources":["../src/odspLayerCompatState.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;;GAGG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAwB;IACpE;;OAEG;IACH,UAAU;IACV;;OAEG;IACH,UAAU,EAAE,CAAC;IACb;;OAEG;IACH,iBAAiB,EAAE,IAAI,GAAG,EAAU;CACpC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type ILayerCompatDetails } from \"@fluid-internal/client-utils\";\n\nimport { pkgVersion } from \"./packageVersion.js\";\n\n/**\n * ODSP Driver's compatibility details that is exposed to the Loader layer.\n * @internal\n */\nexport const odspDriverCompatDetailsForLoader: ILayerCompatDetails = {\n\t/**\n\t * The package version of the ODSP Driver layer.\n\t */\n\tpkgVersion,\n\t/**\n\t * The current generation of the ODSP Driver layer.\n\t */\n\tgeneration: 1,\n\t/**\n\t * The features supported by the ODSP Driver layer across the Driver / Loader boundary.\n\t */\n\tsupportedFeatures: new Set<string>(),\n};\n"]}
@@ -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.42.0";
8
+ export declare const pkgVersion = "2.43.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -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.42.0";
8
+ export const pkgVersion = "2.43.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,QAAQ,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.42.0\";\n"]}
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,QAAQ,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.43.0\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/odsp-driver",
3
- "version": "2.42.0",
3
+ "version": "2.43.0",
4
4
  "description": "Socket storage implementation for SPO and ODC",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -69,27 +69,27 @@
69
69
  "temp-directory": "nyc/.nyc_output"
70
70
  },
71
71
  "dependencies": {
72
- "@fluid-internal/client-utils": "~2.42.0",
73
- "@fluidframework/core-interfaces": "~2.42.0",
74
- "@fluidframework/core-utils": "~2.42.0",
75
- "@fluidframework/driver-base": "~2.42.0",
76
- "@fluidframework/driver-definitions": "~2.42.0",
77
- "@fluidframework/driver-utils": "~2.42.0",
78
- "@fluidframework/odsp-doclib-utils": "~2.42.0",
79
- "@fluidframework/odsp-driver-definitions": "~2.42.0",
80
- "@fluidframework/telemetry-utils": "~2.42.0",
72
+ "@fluid-internal/client-utils": "~2.43.0",
73
+ "@fluidframework/core-interfaces": "~2.43.0",
74
+ "@fluidframework/core-utils": "~2.43.0",
75
+ "@fluidframework/driver-base": "~2.43.0",
76
+ "@fluidframework/driver-definitions": "~2.43.0",
77
+ "@fluidframework/driver-utils": "~2.43.0",
78
+ "@fluidframework/odsp-doclib-utils": "~2.43.0",
79
+ "@fluidframework/odsp-driver-definitions": "~2.43.0",
80
+ "@fluidframework/telemetry-utils": "~2.43.0",
81
81
  "socket.io-client": "~4.7.5",
82
82
  "uuid": "^9.0.0"
83
83
  },
84
84
  "devDependencies": {
85
85
  "@arethetypeswrong/cli": "^0.17.1",
86
86
  "@biomejs/biome": "~1.9.3",
87
- "@fluid-internal/mocha-test-setup": "~2.42.0",
88
- "@fluid-tools/build-cli": "^0.55.0",
87
+ "@fluid-internal/mocha-test-setup": "~2.43.0",
88
+ "@fluid-tools/build-cli": "^0.56.0",
89
89
  "@fluidframework/build-common": "^2.0.3",
90
- "@fluidframework/build-tools": "^0.55.0",
90
+ "@fluidframework/build-tools": "^0.56.0",
91
91
  "@fluidframework/eslint-config-fluid": "^5.7.4",
92
- "@fluidframework/odsp-driver-previous": "npm:@fluidframework/odsp-driver@2.41.0",
92
+ "@fluidframework/odsp-driver-previous": "npm:@fluidframework/odsp-driver@2.42.0",
93
93
  "@microsoft/api-extractor": "7.52.8",
94
94
  "@types/mocha": "^10.0.10",
95
95
  "@types/node": "^18.19.0",
@@ -21,9 +21,16 @@ export interface OdspFluidDataStoreLocator extends IOdspUrlParts {
21
21
  * @internal
22
22
  */
23
23
  export enum SharingLinkHeader {
24
- // Can be used in request made to resolver, to tell the resolver that the passed in URL is a sharing link
25
- // which can be redeemed at server to get permissions.
24
+ /**
25
+ * Can be used in request made to resolver, to tell the resolver that the passed in URL is a sharing link
26
+ * which can be redeemed at server to get permissions.
27
+ */
26
28
  isSharingLinkToRedeem = "isSharingLinkToRedeem",
29
+ /**
30
+ * When isSharingLinkToRedeem is true, this header can be used to tell the server that the redemption of the sharing link
31
+ * is meant to be non-durable.
32
+ */
33
+ isRedemptionNonDurable = "isRedemptionNonDurable",
27
34
  }
28
35
 
29
36
  /**
@@ -31,6 +38,7 @@ export enum SharingLinkHeader {
31
38
  */
32
39
  export interface ISharingLinkHeader {
33
40
  [SharingLinkHeader.isSharingLinkToRedeem]: boolean;
41
+ [SharingLinkHeader.isRedemptionNonDurable]: boolean;
34
42
  }
35
43
  /**
36
44
  * @internal
@@ -224,6 +224,9 @@ async function redeemSharingLink(
224
224
  odspResolvedUrl.shareLinkInfo?.sharingLinkToRedeem,
225
225
  );
226
226
 
227
+ const isRedemptionNonDurable: boolean =
228
+ odspResolvedUrl.shareLinkInfo?.isRedemptionNonDurable === true;
229
+
227
230
  let redeemUrl: string | undefined;
228
231
  async function callSharesAPI(baseUrl: string): Promise<void> {
229
232
  await getWithRetryForTokenRefresh(async (tokenFetchOptions) => {
@@ -240,7 +243,7 @@ async function redeemSharingLink(
240
243
  "RedeemShareLink",
241
244
  );
242
245
  const headers = getHeadersWithAuth(authHeader);
243
- headers.prefer = "redeemSharingLink";
246
+ headers.prefer = isRedemptionNonDurable ? "nonDurableRedeem" : "redeemSharingLink";
244
247
  await fetchAndParseAsJSONHelper(url, { headers, method });
245
248
  });
246
249
  }
@@ -251,6 +254,7 @@ async function redeemSharingLink(
251
254
  queryParamsLength: new URL(odspResolvedUrl.shareLinkInfo?.sharingLinkToRedeem).search
252
255
  .length,
253
256
  useHeaders: true,
257
+ isRedemptionNonDurable,
254
258
  });
255
259
  // There is an issue where if we use the siteUrl in /shares, then the allowed length of url is just a few hundred characters(300-400)
256
260
  // and we fail to do the redeem. But if we use the tenant domain in the url, then the allowed length becomes 2048. So,
@@ -287,6 +291,8 @@ async function fetchLatestSnapshotCore(
287
291
  const fetchSnapshotForLoadingGroup = isSnapshotFetchForLoadingGroup(loadingGroupIds);
288
292
  const eventName = fetchSnapshotForLoadingGroup ? "TreesLatestForGroup" : "TreesLatest";
289
293
  const internalFarmType = checkForKnownServerFarmType(odspResolvedUrl.siteUrl);
294
+ const isRedemptionNonDurable: boolean =
295
+ odspResolvedUrl.shareLinkInfo?.isRedemptionNonDurable === true;
290
296
 
291
297
  const perfEvent = {
292
298
  eventName,
@@ -296,6 +302,8 @@ async function fetchLatestSnapshotCore(
296
302
  redeemFallbackEnabled: enableRedeemFallback,
297
303
  details: {
298
304
  internalFarmType,
305
+ // Whether the redemption used is non-durable or not.
306
+ isRedemptionNonDurable,
299
307
  },
300
308
  };
301
309
  if (snapshotOptions !== undefined) {
@@ -724,11 +732,16 @@ export const downloadSnapshot = mockify(
724
732
  const queryString = getQueryString(queryParams);
725
733
  const url = `${snapshotUrl}/trees/latest${queryString}`;
726
734
  const method = "POST";
735
+ const isRedemptionNonDurable: boolean =
736
+ odspResolvedUrl.shareLinkInfo?.isRedemptionNonDurable === true;
727
737
  // The location of file can move on Spo in which case server returns 308(Permanent Redirect) error.
728
738
  // Adding below header will make VROOM API return 404 instead of 308 and browser can intercept it.
729
739
  // This error thrown by server will contain the new redirect location. Look at the 404 error parsing
730
740
  // for further reference here: \packages\utils\odsp-doclib-utils\src\odspErrorUtils.ts
731
- const header = { prefer: "manualredirect" };
741
+ // If the share link is non-durable, we will add the nonDurableRedeem header to the header.prefer.
742
+ const header = isRedemptionNonDurable
743
+ ? { prefer: "manualredirect, nonDurableRedeem" }
744
+ : { prefer: "manualredirect" };
732
745
  const authHeader = await getAuthHeader(
733
746
  { ...tokenFetchOptions, request: { url, method } },
734
747
  "downloadSnapshot",
package/src/index.ts CHANGED
@@ -66,3 +66,6 @@ export {
66
66
  ISnapshotContentsWithProps,
67
67
  parseCompactSnapshotResponse,
68
68
  } from "./compactSnapshotParser.js";
69
+
70
+ // Layer Compat details
71
+ export { odspDriverCompatDetailsForLoader } from "./odspLayerCompatState.js";
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { TypedEventEmitter } from "@fluid-internal/client-utils";
6
+ import { TypedEventEmitter, type ILayerCompatDetails } from "@fluid-internal/client-utils";
7
7
  import { IClient } from "@fluidframework/driver-definitions";
8
8
  import {
9
9
  IDocumentDeltaStorageService,
@@ -18,6 +18,7 @@ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
18
18
 
19
19
  import { LocalOdspDeltaStorageService } from "./localOdspDeltaStorageService.js";
20
20
  import { LocalOdspDocumentStorageService } from "./localOdspDocumentStorageManager.js";
21
+ import { localOdspDriverCompatDetailsForLoader } from "./localOdspLayerCompatState.js";
21
22
 
22
23
  /**
23
24
  * IDocumentService implementation that provides explicit snapshot to the document storage service.
@@ -37,6 +38,14 @@ export class LocalOdspDocumentService
37
38
  super();
38
39
  }
39
40
 
41
+ /**
42
+ * The compatibility details of the Local ODSP Driver layer that is exposed to the Loader layer
43
+ * for validating Loader-Driver compatibility.
44
+ */
45
+ public get ILayerCompatDetails(): ILayerCompatDetails {
46
+ return localOdspDriverCompatDetailsForLoader;
47
+ }
48
+
40
49
  public get resolvedUrl(): IResolvedUrl {
41
50
  return this.odspResolvedUrl;
42
51
  }
@@ -0,0 +1,27 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { type ILayerCompatDetails } from "@fluid-internal/client-utils";
7
+
8
+ import { pkgVersion } from "../packageVersion.js";
9
+
10
+ /**
11
+ * Local ODSP Driver's compatibility details that is exposed to the Loader layer.
12
+ * @internal
13
+ */
14
+ export const localOdspDriverCompatDetailsForLoader: ILayerCompatDetails = {
15
+ /**
16
+ * The package version of the Local ODSP Driver layer.
17
+ */
18
+ pkgVersion,
19
+ /**
20
+ * The current generation of the Local ODSP Driver layer.
21
+ */
22
+ generation: 1,
23
+ /**
24
+ * The features supported by the Local ODSP Driver layer across the Driver / Loader boundary.
25
+ */
26
+ supportedFeatures: new Set<string>(),
27
+ };
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { TypedEventEmitter } from "@fluid-internal/client-utils";
6
+ import { TypedEventEmitter, type ILayerCompatDetails } from "@fluid-internal/client-utils";
7
7
  import { assert } from "@fluidframework/core-utils/internal";
8
8
  import { IClient } from "@fluidframework/driver-definitions";
9
9
  import {
@@ -38,6 +38,7 @@ import {
38
38
  OdspDeltaStorageWithCache,
39
39
  } from "./odspDeltaStorageService.js";
40
40
  import { OdspDocumentStorageService } from "./odspDocumentStorageManager.js";
41
+ import { odspDriverCompatDetailsForLoader } from "./odspLayerCompatState.js";
41
42
  import { hasOdcOrigin } from "./odspUrlHelper.js";
42
43
  import { getOdspResolvedUrl } from "./odspUtils.js";
43
44
  import { OpsCache } from "./opsCaching.js";
@@ -100,6 +101,14 @@ export class OdspDocumentService
100
101
  );
101
102
  }
102
103
 
104
+ /**
105
+ * The compatibility details of the ODSP Driver layer that is exposed to the Loader layer
106
+ * for validating Loader-Driver compatibility.
107
+ */
108
+ public get ILayerCompatDetails(): ILayerCompatDetails {
109
+ return odspDriverCompatDetailsForLoader;
110
+ }
111
+
103
112
  private storageManager?: OdspDocumentStorageService;
104
113
 
105
114
  private readonly mc: MonitoringContext;
@@ -137,6 +137,8 @@ export class OdspDriverUrlResolverForShareLink implements IUrlResolver {
137
137
  const requestToBeResolved = { headers: request.headers, url: request.url };
138
138
  const isSharingLinkToRedeem =
139
139
  requestToBeResolved.headers?.[SharingLinkHeader.isSharingLinkToRedeem];
140
+ const isRedemptionNonDurable =
141
+ requestToBeResolved.headers?.[SharingLinkHeader.isRedemptionNonDurable];
140
142
  try {
141
143
  const url = new URL(request.url);
142
144
 
@@ -167,6 +169,7 @@ export class OdspDriverUrlResolverForShareLink implements IUrlResolver {
167
169
  // the eligible length.
168
170
  odspResolvedUrl.shareLinkInfo = Object.assign(odspResolvedUrl.shareLinkInfo ?? {}, {
169
171
  sharingLinkToRedeem: this.removeNavParam(request.url),
172
+ isRedemptionNonDurable: isRedemptionNonDurable ?? false,
170
173
  });
171
174
  }
172
175
  if (odspResolvedUrl.itemId) {
@@ -0,0 +1,27 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { type ILayerCompatDetails } from "@fluid-internal/client-utils";
7
+
8
+ import { pkgVersion } from "./packageVersion.js";
9
+
10
+ /**
11
+ * ODSP Driver's compatibility details that is exposed to the Loader layer.
12
+ * @internal
13
+ */
14
+ export const odspDriverCompatDetailsForLoader: ILayerCompatDetails = {
15
+ /**
16
+ * The package version of the ODSP Driver layer.
17
+ */
18
+ pkgVersion,
19
+ /**
20
+ * The current generation of the ODSP Driver layer.
21
+ */
22
+ generation: 1,
23
+ /**
24
+ * The features supported by the ODSP Driver layer across the Driver / Loader boundary.
25
+ */
26
+ supportedFeatures: new Set<string>(),
27
+ };
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/odsp-driver";
9
- export const pkgVersion = "2.42.0";
9
+ export const pkgVersion = "2.43.0";