@fluidframework/routerlicious-driver 2.73.0 → 2.74.0-365691

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.
@@ -99,7 +99,7 @@ exports.socketIoPath = "socket.io";
99
99
  */
100
100
  function getUrlForTelemetry(hostName, path = "") {
101
101
  // Strip off "http://" or "https://"
102
- const hostNameMatch = hostName.match(/^(?:https?:\/\/)?([^/]+)/);
102
+ const hostNameMatch = /^(?:https?:\/\/)?([^/]+)/.exec(hostName);
103
103
  if (!hostNameMatch) {
104
104
  return undefined;
105
105
  }
@@ -1 +1 @@
1
- {"version":3,"file":"errorUtils.js","sourceRoot":"","sources":["../src/errorUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,0EAIqD;AACrD,oEAM+C;AAC/C,uEAAyF;AAEzF,iDAAqE;AACrE,2DAAkE;AAElE;;;;GAIG;AACU,QAAA,uBAAuB,GAAG;IACtC,kCAAkC;IAClC,GAAG,2BAAgB;IAEnB;;OAEG;IACH,YAAY,EAAE,cAAc;IAE5B;;;OAGG;IACH,oBAAoB,EAAE,sBAAsB;CACnC,CAAC;AA0CX,MAAa,oBAAqB,SAAQ,uBAAY;IAIrD,YACC,OAAe,EACN,iBAAyB,EAClC,KAAgC;QAEhC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAHb,sBAAiB,GAAjB,iBAAiB,CAAQ;QAL1B,cAAS,GAAG,+BAAuB,CAAC,oBAAoB,CAAC;QACzD,aAAQ,GAAG,IAAI,CAAC;IAQzB,CAAC;CACD;AAXD,oDAWC;AAQD,SAAgB,sBAAsB,CACrC,YAAoB,EACpB,UAAkB,EAClB,YAAqB,EACrB,eAA2C,EAC3C,iBAAmC;IAEnC,IAAI,KAAkC,CAAC;IACvC,MAAM,KAAK,GAAG,EAAE,GAAG,eAAe,EAAE,UAAU,EAAE,aAAa,EAAb,8BAAa,EAAE,CAAC;IAChE,QAAQ,UAAU,EAAE,CAAC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BACX,QAAQ;gBACR,UAAU;gBACV,SAAS;gBACT,OAAO;gBACP,MAAM;gBACN,aAAa;gBACb,aAAa;aACb,CAAC,QAAQ,CAAC,OAAO,CAAC,EAClB,CAAC;gBACF,aAAa,IAAI,IAAI,OAAO,EAAE,CAAC;YAChC,CAAC;iBAAM,CAAC;gBACP,aAAa,IAAI,WAAW,CAAC;YAC9B,CAAC;QACF,CAAC;IACF,CAAC;IAED,OAAO,GAAG,gBAAgB,GAAG,aAAa,EAAE,CAAC;AAC9C,CAAC;AAvCD,gDAuCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tDriverError,\n\tDriverErrorTypes,\n\tIDriverErrorBase,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tAuthorizationError,\n\tGenericNetworkError,\n\tNonRetryableError,\n\tcreateGenericNetworkError,\n\ttype DriverErrorTelemetryProps,\n} from \"@fluidframework/driver-utils/internal\";\nimport { IFluidErrorBase, LoggingError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { R11sServiceClusterDrainingErrorCode } from \"./contracts.js\";\nimport { pkgVersion as driverVersion } from \"./packageVersion.js\";\n\n/**\n * Routerlicious Error types\n * Different error types that may be thrown by the routerlicious driver\n * @internal\n */\nexport const RouterliciousErrorTypes = {\n\t// Inherit base driver error types\n\t...DriverErrorTypes,\n\n\t/**\n\t * SSL Certificate Error.\n\t */\n\tsslCertError: \"sslCertError\",\n\n\t/**\n\t * Error for when the service drains a cluster to which the socket connection is connected to and it disconnects\n\t * all the clients in that cluster.\n\t */\n\tclusterDrainingError: \"clusterDrainingError\",\n} as const;\n/**\n * @internal\n */\nexport type RouterliciousErrorTypes =\n\t(typeof RouterliciousErrorTypes)[keyof typeof RouterliciousErrorTypes];\n\n/**\n * Interface for error responses for the WebSocket connection\n * Intended to be compatible with output from `NetworkError.toJSON`.\n */\nexport interface IR11sSocketError {\n\t/**\n\t * An error code number for the error that occurred.\n\t * It will be a valid HTTP status code.\n\t */\n\tcode: number;\n\n\t/**\n\t * A message about the error that occurred for debugging / logging purposes.\n\t * This should not be displayed to the user directly.\n\t */\n\tmessage: string;\n\n\t/**\n\t * Optional Retry-After time in seconds.\n\t * The client should wait this many seconds before retrying its request.\n\t */\n\tretryAfter?: number;\n\n\t/**\n\t * Optional Retry-After time in milliseconds.\n\t * The client should wait this many milliseconds before retrying its request.\n\t */\n\tretryAfterMs?: number;\n\n\t/**\n\t * Optional internalErrorCode to specify the specific error code for the error within the main code above.\n\t */\n\tinternalErrorCode?: string | number;\n}\n\nexport class ClusterDrainingError extends LoggingError implements IFluidErrorBase {\n\treadonly errorType = RouterliciousErrorTypes.clusterDrainingError;\n\treadonly canRetry = true;\n\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly retryAfterSeconds: number,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\tsuper(message, props);\n\t}\n}\n\nexport interface IR11sError extends Omit<IDriverErrorBase, \"errorType\"> {\n\treadonly errorType: RouterliciousErrorTypes;\n}\n\nexport type R11sError = DriverError | IR11sError;\n\nexport function createR11sNetworkError(\n\terrorMessage: string,\n\tstatusCode: number,\n\tretryAfterMs?: number,\n\tadditionalProps?: DriverErrorTelemetryProps,\n\tinternalErrorCode?: string | number,\n): IFluidErrorBase & R11sError {\n\tlet error: IFluidErrorBase & R11sError;\n\tconst props = { ...additionalProps, statusCode, driverVersion };\n\tswitch (statusCode) {\n\t\tcase 401:\n\t\t// The first 401 is manually retried in RouterliciousRestWrapper with a refreshed token,\n\t\t// so we treat repeat 401s the same as 403.\n\t\tcase 403:\n\t\t\terror = new AuthorizationError(errorMessage, undefined, undefined, props);\n\t\t\tbreak;\n\t\tcase 404:\n\t\t\tconst errorType = RouterliciousErrorTypes.fileNotFoundOrAccessDeniedError;\n\t\t\terror = new NonRetryableError(errorMessage, errorType, props);\n\t\t\tbreak;\n\t\tcase 429:\n\t\t\terror = createGenericNetworkError(errorMessage, { canRetry: true, retryAfterMs }, props);\n\t\t\tbreak;\n\t\tcase 500:\n\t\tcase 502:\n\t\t\terror = new GenericNetworkError(errorMessage, true, props);\n\t\t\tbreak;\n\t\tcase 503:\n\t\t\tif (internalErrorCode === R11sServiceClusterDrainingErrorCode) {\n\t\t\t\terror = new ClusterDrainingError(\n\t\t\t\t\terrorMessage,\n\t\t\t\t\tretryAfterMs !== undefined ? retryAfterMs / 1000 : 660,\n\t\t\t\t\tprops,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\tdefault:\n\t\t\tconst retryInfo = { canRetry: retryAfterMs !== undefined, retryAfterMs };\n\t\t\terror = createGenericNetworkError(errorMessage, retryInfo, props);\n\t\t\tbreak;\n\t}\n\terror.addTelemetryProperties({ endpointReached: true });\n\treturn error;\n}\n\nexport function throwR11sNetworkError(\n\terrorMessage: string,\n\tstatusCode: number,\n\tretryAfterMs?: number,\n\tadditionalProps?: DriverErrorTelemetryProps,\n): never {\n\tthrow createR11sNetworkError(errorMessage, statusCode, retryAfterMs, additionalProps);\n}\n\n/**\n * Returns network error based on error object from R11s socket (IR11sSocketError)\n */\nexport function errorObjectFromSocketError(\n\tsocketError: IR11sSocketError,\n\thandler: string,\n\tadditionalProps?: DriverErrorTelemetryProps,\n): R11sError {\n\t// pre-0.58 error message prefix: R11sSocketError\n\tconst message = `R11s socket error (${handler}): ${socketError.message}`;\n\tconst error = createR11sNetworkError(\n\t\tmessage,\n\t\tsocketError.code,\n\t\tsocketError.retryAfterMs,\n\t\tadditionalProps,\n\t\tsocketError.internalErrorCode,\n\t);\n\terror.addTelemetryProperties({\n\t\trelayServiceError: true,\n\t\tscenarioName: handler,\n\t\tinternalErrorCode: socketError.internalErrorCode,\n\t});\n\treturn error;\n}\n\n/** Simulate the pathname for socket connection */\nexport const socketIoPath = \"socket.io\";\n\n/**\n * Get a stripped version of a URL safe for r11s telemetry\n * @returns undefined if no appropriate hostName is provided\n */\nexport function getUrlForTelemetry(hostName: string, path: string = \"\"): string | undefined {\n\t// Strip off \"http://\" or \"https://\"\n\tconst hostNameMatch = hostName.match(/^(?:https?:\\/\\/)?([^/]+)/);\n\tif (!hostNameMatch) {\n\t\treturn undefined;\n\t}\n\tconst strippedHostName = hostNameMatch[1];\n\n\tlet extractedPath = \"\";\n\t// Extract portions of the path and explicitly match them to known path names\n\tfor (const portion of path.split(\"/\")) {\n\t\tif (portion !== \"\") {\n\t\t\t// eslint-disable-next-line unicorn/prefer-ternary\n\t\t\tif (\n\t\t\t\t[\n\t\t\t\t\tsocketIoPath,\n\t\t\t\t\t\"repos\",\n\t\t\t\t\t\"deltas\",\n\t\t\t\t\t\"documents\",\n\t\t\t\t\t\"session\",\n\t\t\t\t\t\"git\",\n\t\t\t\t\t\"summaries\",\n\t\t\t\t\t\"latest\",\n\t\t\t\t\t\"document\",\n\t\t\t\t\t\"commits\",\n\t\t\t\t\t\"blobs\",\n\t\t\t\t\t\"refs\",\n\t\t\t\t\t\"revokeToken\",\n\t\t\t\t\t\"accesstoken\",\n\t\t\t\t].includes(portion)\n\t\t\t) {\n\t\t\t\textractedPath += `/${portion}`;\n\t\t\t} else {\n\t\t\t\textractedPath += \"/REDACTED\";\n\t\t\t}\n\t\t}\n\t}\n\n\treturn `${strippedHostName}${extractedPath}`;\n}\n"]}
1
+ {"version":3,"file":"errorUtils.js","sourceRoot":"","sources":["../src/errorUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,0EAIqD;AACrD,oEAM+C;AAC/C,uEAAyF;AAEzF,iDAAqE;AACrE,2DAAkE;AAElE;;;;GAIG;AACU,QAAA,uBAAuB,GAAG;IACtC,kCAAkC;IAClC,GAAG,2BAAgB;IAEnB;;OAEG;IACH,YAAY,EAAE,cAAc;IAE5B;;;OAGG;IACH,oBAAoB,EAAE,sBAAsB;CACnC,CAAC;AA0CX,MAAa,oBAAqB,SAAQ,uBAAY;IAIrD,YACC,OAAe,EACN,iBAAyB,EAClC,KAAgC;QAEhC,KAAK,CAAC,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;IAChE,IAAI,CAAC,aAAa,EAAE,CAAC;QACpB,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,MAAM,gBAAgB,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;IAE1C,IAAI,aAAa,GAAG,EAAE,CAAC;IACvB,6EAA6E;IAC7E,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACvC,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;YACpB,kDAAkD;YAClD,IACC;gBACC,oBAAY;gBACZ,OAAO;gBACP,QAAQ;gBACR,WAAW;gBACX,SAAS;gBACT,KAAK;gBACL,WAAW;gBACX,QAAQ;gBACR,UAAU;gBACV,SAAS;gBACT,OAAO;gBACP,MAAM;gBACN,aAAa;gBACb,aAAa;aACb,CAAC,QAAQ,CAAC,OAAO,CAAC,EAClB,CAAC;gBACF,aAAa,IAAI,IAAI,OAAO,EAAE,CAAC;YAChC,CAAC;iBAAM,CAAC;gBACP,aAAa,IAAI,WAAW,CAAC;YAC9B,CAAC;QACF,CAAC;IACF,CAAC;IAED,OAAO,GAAG,gBAAgB,GAAG,aAAa,EAAE,CAAC;AAC9C,CAAC;AAvCD,gDAuCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tDriverError,\n\tDriverErrorTypes,\n\tIDriverErrorBase,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tAuthorizationError,\n\tGenericNetworkError,\n\tNonRetryableError,\n\tcreateGenericNetworkError,\n\ttype DriverErrorTelemetryProps,\n} from \"@fluidframework/driver-utils/internal\";\nimport { IFluidErrorBase, LoggingError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { R11sServiceClusterDrainingErrorCode } from \"./contracts.js\";\nimport { pkgVersion as driverVersion } from \"./packageVersion.js\";\n\n/**\n * Routerlicious Error types\n * Different error types that may be thrown by the routerlicious driver\n * @internal\n */\nexport const RouterliciousErrorTypes = {\n\t// Inherit base driver error types\n\t...DriverErrorTypes,\n\n\t/**\n\t * SSL Certificate Error.\n\t */\n\tsslCertError: \"sslCertError\",\n\n\t/**\n\t * Error for when the service drains a cluster to which the socket connection is connected to and it disconnects\n\t * all the clients in that cluster.\n\t */\n\tclusterDrainingError: \"clusterDrainingError\",\n} as const;\n/**\n * @internal\n */\nexport type RouterliciousErrorTypes =\n\t(typeof RouterliciousErrorTypes)[keyof typeof RouterliciousErrorTypes];\n\n/**\n * Interface for error responses for the WebSocket connection\n * Intended to be compatible with output from `NetworkError.toJSON`.\n */\nexport interface IR11sSocketError {\n\t/**\n\t * An error code number for the error that occurred.\n\t * It will be a valid HTTP status code.\n\t */\n\tcode: number;\n\n\t/**\n\t * A message about the error that occurred for debugging / logging purposes.\n\t * This should not be displayed to the user directly.\n\t */\n\tmessage: string;\n\n\t/**\n\t * Optional Retry-After time in seconds.\n\t * The client should wait this many seconds before retrying its request.\n\t */\n\tretryAfter?: number;\n\n\t/**\n\t * Optional Retry-After time in milliseconds.\n\t * The client should wait this many milliseconds before retrying its request.\n\t */\n\tretryAfterMs?: number;\n\n\t/**\n\t * Optional internalErrorCode to specify the specific error code for the error within the main code above.\n\t */\n\tinternalErrorCode?: string | number;\n}\n\nexport class ClusterDrainingError extends LoggingError implements IFluidErrorBase {\n\treadonly errorType = RouterliciousErrorTypes.clusterDrainingError;\n\treadonly canRetry = true;\n\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly retryAfterSeconds: number,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\tsuper(message, props);\n\t}\n}\n\nexport interface IR11sError extends Omit<IDriverErrorBase, \"errorType\"> {\n\treadonly errorType: RouterliciousErrorTypes;\n}\n\nexport type R11sError = DriverError | IR11sError;\n\nexport function createR11sNetworkError(\n\terrorMessage: string,\n\tstatusCode: number,\n\tretryAfterMs?: number,\n\tadditionalProps?: DriverErrorTelemetryProps,\n\tinternalErrorCode?: string | number,\n): IFluidErrorBase & R11sError {\n\tlet error: IFluidErrorBase & R11sError;\n\tconst props = { ...additionalProps, statusCode, driverVersion };\n\tswitch (statusCode) {\n\t\tcase 401:\n\t\t// The first 401 is manually retried in RouterliciousRestWrapper with a refreshed token,\n\t\t// so we treat repeat 401s the same as 403.\n\t\tcase 403:\n\t\t\terror = new AuthorizationError(errorMessage, undefined, undefined, props);\n\t\t\tbreak;\n\t\tcase 404:\n\t\t\tconst errorType = RouterliciousErrorTypes.fileNotFoundOrAccessDeniedError;\n\t\t\terror = new NonRetryableError(errorMessage, errorType, props);\n\t\t\tbreak;\n\t\tcase 429:\n\t\t\terror = createGenericNetworkError(errorMessage, { canRetry: true, retryAfterMs }, props);\n\t\t\tbreak;\n\t\tcase 500:\n\t\tcase 502:\n\t\t\terror = new GenericNetworkError(errorMessage, true, props);\n\t\t\tbreak;\n\t\tcase 503:\n\t\t\tif (internalErrorCode === R11sServiceClusterDrainingErrorCode) {\n\t\t\t\terror = new ClusterDrainingError(\n\t\t\t\t\terrorMessage,\n\t\t\t\t\tretryAfterMs !== undefined ? retryAfterMs / 1000 : 660,\n\t\t\t\t\tprops,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\tdefault:\n\t\t\tconst retryInfo = { canRetry: retryAfterMs !== undefined, retryAfterMs };\n\t\t\terror = createGenericNetworkError(errorMessage, retryInfo, props);\n\t\t\tbreak;\n\t}\n\terror.addTelemetryProperties({ endpointReached: true });\n\treturn error;\n}\n\nexport function throwR11sNetworkError(\n\terrorMessage: string,\n\tstatusCode: number,\n\tretryAfterMs?: number,\n\tadditionalProps?: DriverErrorTelemetryProps,\n): never {\n\tthrow createR11sNetworkError(errorMessage, statusCode, retryAfterMs, additionalProps);\n}\n\n/**\n * Returns network error based on error object from R11s socket (IR11sSocketError)\n */\nexport function errorObjectFromSocketError(\n\tsocketError: IR11sSocketError,\n\thandler: string,\n\tadditionalProps?: DriverErrorTelemetryProps,\n): R11sError {\n\t// pre-0.58 error message prefix: R11sSocketError\n\tconst message = `R11s socket error (${handler}): ${socketError.message}`;\n\tconst error = createR11sNetworkError(\n\t\tmessage,\n\t\tsocketError.code,\n\t\tsocketError.retryAfterMs,\n\t\tadditionalProps,\n\t\tsocketError.internalErrorCode,\n\t);\n\terror.addTelemetryProperties({\n\t\trelayServiceError: true,\n\t\tscenarioName: handler,\n\t\tinternalErrorCode: socketError.internalErrorCode,\n\t});\n\treturn error;\n}\n\n/** Simulate the pathname for socket connection */\nexport const socketIoPath = \"socket.io\";\n\n/**\n * Get a stripped version of a URL safe for r11s telemetry\n * @returns undefined if no appropriate hostName is provided\n */\nexport function getUrlForTelemetry(hostName: string, path: string = \"\"): string | undefined {\n\t// Strip off \"http://\" or \"https://\"\n\tconst hostNameMatch = /^(?:https?:\\/\\/)?([^/]+)/.exec(hostName);\n\tif (!hostNameMatch) {\n\t\treturn undefined;\n\t}\n\tconst strippedHostName = hostNameMatch[1];\n\n\tlet extractedPath = \"\";\n\t// Extract portions of the path and explicitly match them to known path names\n\tfor (const portion of path.split(\"/\")) {\n\t\tif (portion !== \"\") {\n\t\t\t// eslint-disable-next-line unicorn/prefer-ternary\n\t\t\tif (\n\t\t\t\t[\n\t\t\t\t\tsocketIoPath,\n\t\t\t\t\t\"repos\",\n\t\t\t\t\t\"deltas\",\n\t\t\t\t\t\"documents\",\n\t\t\t\t\t\"session\",\n\t\t\t\t\t\"git\",\n\t\t\t\t\t\"summaries\",\n\t\t\t\t\t\"latest\",\n\t\t\t\t\t\"document\",\n\t\t\t\t\t\"commits\",\n\t\t\t\t\t\"blobs\",\n\t\t\t\t\t\"refs\",\n\t\t\t\t\t\"revokeToken\",\n\t\t\t\t\t\"accesstoken\",\n\t\t\t\t].includes(portion)\n\t\t\t) {\n\t\t\t\textractedPath += `/${portion}`;\n\t\t\t} else {\n\t\t\t\textractedPath += \"/REDACTED\";\n\t\t\t}\n\t\t}\n\t}\n\n\treturn `${strippedHostName}${extractedPath}`;\n}\n"]}
@@ -1 +1 @@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AAC,QAAQ,CAAC,SAAS,CAAU;gBAGlB,YAAY,EAAE,OAAO,EACtC,YAAY,EAAE,OAAO,EACJ,WAAW,EAAE,WAAW;IAU7B,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAOtD,UAAU,CACtB,IAAI,EAAE,oBAAoB,GACxB,OAAO,CAAC,aAAa,CAAC,sBAAsB,CAAC,CAAC;IAQpC,UAAU,CACtB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GACX,OAAO,CAAC,aAAa,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAgBjC,UAAU,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAIxE,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAM1E,aAAa,CACzB,OAAO,EAAE,oBAAoB,EAC7B,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAQnC,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;IAOjF,OAAO,CAAC,cAAc;CAatB"}
package/dist/historian.js CHANGED
@@ -40,7 +40,8 @@ class Historian {
40
40
  propsToLog: {},
41
41
  requestUrl: "",
42
42
  }
43
- : Promise.reject(error));
43
+ : // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
44
+ Promise.reject(error));
44
45
  }
45
46
  async createTree(tree) {
46
47
  return this.restWrapper.post(`/git/trees`, tree, this.getQueryString());
@@ -1 +1 @@
1
- {"version":3,"file":"historian.js","sourceRoot":"","sources":["../src/historian.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAgE;AAyBzD,MAAM,oCAAoC,GAAG,CAAC,WAAyB,EAAU,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N,GAAG,IAAI,CAAC,kBAAkB;YAC1B,GAAG,WAAW;SACd,CAAC;IACH,CAAC;CACD;AA7FD,8BA6FC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fromUtf8ToBase64 } from \"@fluid-internal/client-utils\";\nimport type {\n\tIGitBlob,\n\tIGitCommitDetails,\n\tIGitCreateBlobParams,\n\tIGitCreateBlobResponse,\n\tIGitCreateTreeParams,\n\tIGitTree,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tIWholeSummaryPayload,\n\tIWriteSummaryResponse,\n} from \"@fluidframework/server-services-client\";\n\nimport { IWholeFlatSnapshot } from \"./contracts.js\";\nimport { type QueryStringType } from \"./queryStringUtils.js\";\nimport { IR11sResponse } from \"./restWrapper.js\";\nimport { RestWrapper } from \"./restWrapperBase.js\";\nimport { IHistorian } from \"./storageContracts.js\";\n\nexport interface ICredentials {\n\tuser: string;\n\tpassword: string;\n}\n\nexport const getAuthorizationTokenFromCredentials = (credentials: ICredentials): string =>\n\t`Basic ${fromUtf8ToBase64(`${credentials.user}:${credentials.password}`)}`;\n\n/**\n * Implementation of the IHistorian interface that calls out to a REST interface\n */\nexport class Historian implements IHistorian {\n\tprivate readonly defaultQueryString: QueryStringType = {};\n\tprivate readonly cacheBust: boolean;\n\n\tconstructor(\n\t\tprivate readonly historianApi: boolean,\n\t\tdisableCache: boolean,\n\t\tprivate readonly restWrapper: RestWrapper,\n\t) {\n\t\tif (disableCache && this.historianApi) {\n\t\t\tthis.defaultQueryString.disableCache = disableCache;\n\t\t\tthis.cacheBust = false;\n\t\t} else {\n\t\t\tthis.cacheBust = disableCache;\n\t\t}\n\t}\n\n\tpublic async getBlob(sha: string): Promise<IR11sResponse<IGitBlob>> {\n\t\treturn this.restWrapper.get<IGitBlob>(\n\t\t\t`/git/blobs/${encodeURIComponent(sha)}`,\n\t\t\tthis.getQueryString(),\n\t\t);\n\t}\n\n\tpublic async createBlob(\n\t\tblob: IGitCreateBlobParams,\n\t): Promise<IR11sResponse<IGitCreateBlobResponse>> {\n\t\treturn this.restWrapper.post<IGitCreateBlobResponse>(\n\t\t\t`/git/blobs`,\n\t\t\tblob,\n\t\t\tthis.getQueryString(),\n\t\t);\n\t}\n\n\tpublic async getCommits(\n\t\tsha: string,\n\t\tcount: number,\n\t): Promise<IR11sResponse<IGitCommitDetails[]>> {\n\t\treturn this.restWrapper\n\t\t\t.get<IGitCommitDetails[]>(`/commits`, this.getQueryString({ count, sha }))\n\t\t\t.catch(async (error) =>\n\t\t\t\terror.statusCode === 400 || error.statusCode === 404\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tcontent: [],\n\t\t\t\t\t\t\theaders: new Map(),\n\t\t\t\t\t\t\tpropsToLog: {},\n\t\t\t\t\t\t\trequestUrl: \"\",\n\t\t\t\t\t\t}\n\t\t\t\t\t: Promise.reject<IR11sResponse<IGitCommitDetails[]>>(error),\n\t\t\t);\n\t}\n\n\tpublic async createTree(tree: IGitCreateTreeParams): Promise<IR11sResponse<IGitTree>> {\n\t\treturn this.restWrapper.post<IGitTree>(`/git/trees`, tree, this.getQueryString());\n\t}\n\n\tpublic async getTree(sha: string, recursive: boolean): Promise<IR11sResponse<IGitTree>> {\n\t\treturn this.restWrapper.get<IGitTree>(\n\t\t\t`/git/trees/${encodeURIComponent(sha)}`,\n\t\t\tthis.getQueryString({ recursive: recursive ? 1 : 0 }),\n\t\t);\n\t}\n\tpublic async createSummary(\n\t\tsummary: IWholeSummaryPayload,\n\t\tinitial?: boolean,\n\t): Promise<IR11sResponse<IWriteSummaryResponse>> {\n\t\treturn this.restWrapper.post<IWriteSummaryResponse>(\n\t\t\t`/git/summaries`,\n\t\t\tsummary,\n\t\t\tthis.getQueryString(initial !== undefined ? { initial } : undefined),\n\t\t);\n\t}\n\n\tpublic async getSnapshot(sha: string): Promise<IR11sResponse<IWholeFlatSnapshot>> {\n\t\treturn this.restWrapper.get<IWholeFlatSnapshot>(\n\t\t\t`/git/summaries/${sha}`,\n\t\t\tthis.getQueryString(),\n\t\t);\n\t}\n\n\tprivate getQueryString(queryString?: QueryStringType): QueryStringType {\n\t\tif (this.cacheBust) {\n\t\t\treturn {\n\t\t\t\tcacheBust: Date.now(),\n\t\t\t\t...this.defaultQueryString,\n\t\t\t\t...queryString,\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t...this.defaultQueryString,\n\t\t\t...queryString,\n\t\t};\n\t}\n}\n"]}
1
+ {"version":3,"file":"historian.js","sourceRoot":"","sources":["../src/historian.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAgE;AAyBzD,MAAM,oCAAoC,GAAG,CAAC,WAAyB,EAAU,EAAE,CACzF,SAAS,IAAA,+BAAgB,EAAC,GAAG,WAAW,CAAC,IAAI,IAAI,WAAW,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC;AAD/D,QAAA,oCAAoC,wCAC2B;AAE5E;;GAEG;AACH,MAAa,SAAS;IAIrB,YACkB,YAAqB,EACtC,YAAqB,EACJ,WAAwB;QAFxB,iBAAY,GAAZ,YAAY,CAAS;QAErB,gBAAW,GAAX,WAAW,CAAa;QANzB,uBAAkB,GAAoB,EAAE,CAAC;QAQzD,IAAI,YAAY,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACvC,IAAI,CAAC,kBAAkB,CAAC,YAAY,GAAG,YAAY,CAAC;YACpD,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACxB,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC;QAC/B,CAAC;IACF,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,GAAW;QAC/B,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAC1B,cAAc,kBAAkB,CAAC,GAAG,CAAC,EAAE,EACvC,IAAI,CAAC,cAAc,EAAE,CACrB,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,UAAU,CACtB,IAA0B;QAE1B,OA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AS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CACpE,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,GAAW;QACnC,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAC1B,kBAAkB,GAAG,EAAE,EACvB,IAAI,CAAC,cAAc,EAAE,CACrB,CAAC;IACH,CAAC;IAEO,cAAc,CAAC,WAA6B;QACnD,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,OAAO;gBACN,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;gBACrB,GAAG,IAAI,CAAC,kBAAkB;gBAC1B,GAAG,WAAW;aACd,CAAC;QACH,CAAC;QACD,OAAO;YACN,GAAG,IAAI,CAAC,kBAAkB;YAC1B,GAAG,WAAW;SACd,CAAC;IACH,CAAC;CACD;AA9FD,8BA8FC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fromUtf8ToBase64 } from \"@fluid-internal/client-utils\";\nimport type {\n\tIGitBlob,\n\tIGitCommitDetails,\n\tIGitCreateBlobParams,\n\tIGitCreateBlobResponse,\n\tIGitCreateTreeParams,\n\tIGitTree,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tIWholeSummaryPayload,\n\tIWriteSummaryResponse,\n} from \"@fluidframework/server-services-client\";\n\nimport { IWholeFlatSnapshot } from \"./contracts.js\";\nimport { type QueryStringType } from \"./queryStringUtils.js\";\nimport { IR11sResponse } from \"./restWrapper.js\";\nimport { RestWrapper } from \"./restWrapperBase.js\";\nimport { IHistorian } from \"./storageContracts.js\";\n\nexport interface ICredentials {\n\tuser: string;\n\tpassword: string;\n}\n\nexport const getAuthorizationTokenFromCredentials = (credentials: ICredentials): string =>\n\t`Basic ${fromUtf8ToBase64(`${credentials.user}:${credentials.password}`)}`;\n\n/**\n * Implementation of the IHistorian interface that calls out to a REST interface\n */\nexport class Historian implements IHistorian {\n\tprivate readonly defaultQueryString: QueryStringType = {};\n\tprivate readonly cacheBust: boolean;\n\n\tconstructor(\n\t\tprivate readonly historianApi: boolean,\n\t\tdisableCache: boolean,\n\t\tprivate readonly restWrapper: RestWrapper,\n\t) {\n\t\tif (disableCache && this.historianApi) {\n\t\t\tthis.defaultQueryString.disableCache = disableCache;\n\t\t\tthis.cacheBust = false;\n\t\t} else {\n\t\t\tthis.cacheBust = disableCache;\n\t\t}\n\t}\n\n\tpublic async getBlob(sha: string): Promise<IR11sResponse<IGitBlob>> {\n\t\treturn this.restWrapper.get<IGitBlob>(\n\t\t\t`/git/blobs/${encodeURIComponent(sha)}`,\n\t\t\tthis.getQueryString(),\n\t\t);\n\t}\n\n\tpublic async createBlob(\n\t\tblob: IGitCreateBlobParams,\n\t): Promise<IR11sResponse<IGitCreateBlobResponse>> {\n\t\treturn this.restWrapper.post<IGitCreateBlobResponse>(\n\t\t\t`/git/blobs`,\n\t\t\tblob,\n\t\t\tthis.getQueryString(),\n\t\t);\n\t}\n\n\tpublic async getCommits(\n\t\tsha: string,\n\t\tcount: number,\n\t): Promise<IR11sResponse<IGitCommitDetails[]>> {\n\t\treturn this.restWrapper\n\t\t\t.get<IGitCommitDetails[]>(`/commits`, this.getQueryString({ count, sha }))\n\t\t\t.catch(async (error) =>\n\t\t\t\terror.statusCode === 400 || error.statusCode === 404\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tcontent: [],\n\t\t\t\t\t\t\theaders: new Map(),\n\t\t\t\t\t\t\tpropsToLog: {},\n\t\t\t\t\t\t\trequestUrl: \"\",\n\t\t\t\t\t\t}\n\t\t\t\t\t: // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n\t\t\t\t\t\tPromise.reject<IR11sResponse<IGitCommitDetails[]>>(error),\n\t\t\t);\n\t}\n\n\tpublic async createTree(tree: IGitCreateTreeParams): Promise<IR11sResponse<IGitTree>> {\n\t\treturn this.restWrapper.post<IGitTree>(`/git/trees`, tree, this.getQueryString());\n\t}\n\n\tpublic async getTree(sha: string, recursive: boolean): Promise<IR11sResponse<IGitTree>> {\n\t\treturn this.restWrapper.get<IGitTree>(\n\t\t\t`/git/trees/${encodeURIComponent(sha)}`,\n\t\t\tthis.getQueryString({ recursive: recursive ? 1 : 0 }),\n\t\t);\n\t}\n\tpublic async createSummary(\n\t\tsummary: IWholeSummaryPayload,\n\t\tinitial?: boolean,\n\t): Promise<IR11sResponse<IWriteSummaryResponse>> {\n\t\treturn this.restWrapper.post<IWriteSummaryResponse>(\n\t\t\t`/git/summaries`,\n\t\t\tsummary,\n\t\t\tthis.getQueryString(initial !== undefined ? { initial } : undefined),\n\t\t);\n\t}\n\n\tpublic async getSnapshot(sha: string): Promise<IR11sResponse<IWholeFlatSnapshot>> {\n\t\treturn this.restWrapper.get<IWholeFlatSnapshot>(\n\t\t\t`/git/summaries/${sha}`,\n\t\t\tthis.getQueryString(),\n\t\t);\n\t}\n\n\tprivate getQueryString(queryString?: QueryStringType): QueryStringType {\n\t\tif (this.cacheBust) {\n\t\t\treturn {\n\t\t\t\tcacheBust: Date.now(),\n\t\t\t\t...this.defaultQueryString,\n\t\t\t\t...queryString,\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t...this.defaultQueryString,\n\t\t\t...queryString,\n\t\t};\n\t}\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/routerlicious-driver";
8
- export declare const pkgVersion = "2.73.0";
8
+ export declare const pkgVersion = "2.74.0-365691";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,yCAAyC,CAAC;AAC9D,eAAO,MAAM,UAAU,WAAW,CAAC"}
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,yCAAyC,CAAC;AAC9D,eAAO,MAAM,UAAU,kBAAkB,CAAC"}
@@ -8,5 +8,5 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.pkgVersion = exports.pkgName = void 0;
10
10
  exports.pkgName = "@fluidframework/routerlicious-driver";
11
- exports.pkgVersion = "2.73.0";
11
+ exports.pkgVersion = "2.74.0-365691";
12
12
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,sCAAsC,CAAC;AACjD,QAAA,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/routerlicious-driver\";\nexport const pkgVersion = \"2.73.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,sCAAsC,CAAC;AACjD,QAAA,UAAU,GAAG,eAAe,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/routerlicious-driver\";\nexport const pkgVersion = \"2.74.0-365691\";\n"]}
package/lib/errorUtils.js CHANGED
@@ -92,7 +92,7 @@ export const socketIoPath = "socket.io";
92
92
  */
93
93
  export function getUrlForTelemetry(hostName, path = "") {
94
94
  // Strip off "http://" or "https://"
95
- const hostNameMatch = hostName.match(/^(?:https?:\/\/)?([^/]+)/);
95
+ const hostNameMatch = /^(?:https?:\/\/)?([^/]+)/.exec(hostName);
96
96
  if (!hostNameMatch) {
97
97
  return undefined;
98
98
  }
@@ -1 +1 @@
1
- {"version":3,"file":"errorUtils.js","sourceRoot":"","sources":["../src/errorUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,gBAAgB,GAEhB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACN,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,yBAAyB,GAEzB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAmB,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAEzF,OAAO,EAAE,mCAAmC,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,UAAU,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAElE;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACtC,kCAAkC;IAClC,GAAG,gBAAgB;IAEnB;;OAEG;IACH,YAAY,EAAE,cAAc;IAE5B;;;OAGG;IACH,oBAAoB,EAAE,sBAAsB;CACnC,CAAC;AA0CX,MAAM,OAAO,oBAAqB,SAAQ,YAAY;IAIrD,YACC,OAAe,EACN,iBAAyB,EAClC,KAAgC;QAEhC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAHb,sBAAiB,GAAjB,iBAAiB,CAAQ;QAL1B,cAAS,GAAG,uBAAuB,CAAC,oBAAoB,CAAC;QACzD,aAAQ,GAAG,IAAI,CAAC;IAQzB,CAAC;CACD;AAQD,MAAM,UAAU,sBAAsB,CACrC,YAAoB,EACpB,UAAkB,EAClB,YAAqB,EACrB,eAA2C,EAC3C,iBAAmC;IAEnC,IAAI,KAAkC,CAAC;IACvC,MAAM,KAAK,GAAG,EAAE,GAAG,eAAe,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC;IAChE,QA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Q;gBACR,UAAU;gBACV,SAAS;gBACT,OAAO;gBACP,MAAM;gBACN,aAAa;gBACb,aAAa;aACb,CAAC,QAAQ,CAAC,OAAO,CAAC,EAClB,CAAC;gBACF,aAAa,IAAI,IAAI,OAAO,EAAE,CAAC;YAChC,CAAC;iBAAM,CAAC;gBACP,aAAa,IAAI,WAAW,CAAC;YAC9B,CAAC;QACF,CAAC;IACF,CAAC;IAED,OAAO,GAAG,gBAAgB,GAAG,aAAa,EAAE,CAAC;AAC9C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tDriverError,\n\tDriverErrorTypes,\n\tIDriverErrorBase,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tAuthorizationError,\n\tGenericNetworkError,\n\tNonRetryableError,\n\tcreateGenericNetworkError,\n\ttype DriverErrorTelemetryProps,\n} from \"@fluidframework/driver-utils/internal\";\nimport { IFluidErrorBase, LoggingError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { R11sServiceClusterDrainingErrorCode } from \"./contracts.js\";\nimport { pkgVersion as driverVersion } from \"./packageVersion.js\";\n\n/**\n * Routerlicious Error types\n * Different error types that may be thrown by the routerlicious driver\n * @internal\n */\nexport const RouterliciousErrorTypes = {\n\t// Inherit base driver error types\n\t...DriverErrorTypes,\n\n\t/**\n\t * SSL Certificate Error.\n\t */\n\tsslCertError: \"sslCertError\",\n\n\t/**\n\t * Error for when the service drains a cluster to which the socket connection is connected to and it disconnects\n\t * all the clients in that cluster.\n\t */\n\tclusterDrainingError: \"clusterDrainingError\",\n} as const;\n/**\n * @internal\n */\nexport type RouterliciousErrorTypes =\n\t(typeof RouterliciousErrorTypes)[keyof typeof RouterliciousErrorTypes];\n\n/**\n * Interface for error responses for the WebSocket connection\n * Intended to be compatible with output from `NetworkError.toJSON`.\n */\nexport interface IR11sSocketError {\n\t/**\n\t * An error code number for the error that occurred.\n\t * It will be a valid HTTP status code.\n\t */\n\tcode: number;\n\n\t/**\n\t * A message about the error that occurred for debugging / logging purposes.\n\t * This should not be displayed to the user directly.\n\t */\n\tmessage: string;\n\n\t/**\n\t * Optional Retry-After time in seconds.\n\t * The client should wait this many seconds before retrying its request.\n\t */\n\tretryAfter?: number;\n\n\t/**\n\t * Optional Retry-After time in milliseconds.\n\t * The client should wait this many milliseconds before retrying its request.\n\t */\n\tretryAfterMs?: number;\n\n\t/**\n\t * Optional internalErrorCode to specify the specific error code for the error within the main code above.\n\t */\n\tinternalErrorCode?: string | number;\n}\n\nexport class ClusterDrainingError extends LoggingError implements IFluidErrorBase {\n\treadonly errorType = RouterliciousErrorTypes.clusterDrainingError;\n\treadonly canRetry = true;\n\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly retryAfterSeconds: number,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\tsuper(message, props);\n\t}\n}\n\nexport interface IR11sError extends Omit<IDriverErrorBase, \"errorType\"> {\n\treadonly errorType: RouterliciousErrorTypes;\n}\n\nexport type R11sError = DriverError | IR11sError;\n\nexport function createR11sNetworkError(\n\terrorMessage: string,\n\tstatusCode: number,\n\tretryAfterMs?: number,\n\tadditionalProps?: DriverErrorTelemetryProps,\n\tinternalErrorCode?: string | number,\n): IFluidErrorBase & R11sError {\n\tlet error: IFluidErrorBase & R11sError;\n\tconst props = { ...additionalProps, statusCode, driverVersion };\n\tswitch (statusCode) {\n\t\tcase 401:\n\t\t// The first 401 is manually retried in RouterliciousRestWrapper with a refreshed token,\n\t\t// so we treat repeat 401s the same as 403.\n\t\tcase 403:\n\t\t\terror = new AuthorizationError(errorMessage, undefined, undefined, props);\n\t\t\tbreak;\n\t\tcase 404:\n\t\t\tconst errorType = RouterliciousErrorTypes.fileNotFoundOrAccessDeniedError;\n\t\t\terror = new NonRetryableError(errorMessage, errorType, props);\n\t\t\tbreak;\n\t\tcase 429:\n\t\t\terror = createGenericNetworkError(errorMessage, { canRetry: true, retryAfterMs }, props);\n\t\t\tbreak;\n\t\tcase 500:\n\t\tcase 502:\n\t\t\terror = new GenericNetworkError(errorMessage, true, props);\n\t\t\tbreak;\n\t\tcase 503:\n\t\t\tif (internalErrorCode === R11sServiceClusterDrainingErrorCode) {\n\t\t\t\terror = new ClusterDrainingError(\n\t\t\t\t\terrorMessage,\n\t\t\t\t\tretryAfterMs !== undefined ? retryAfterMs / 1000 : 660,\n\t\t\t\t\tprops,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\tdefault:\n\t\t\tconst retryInfo = { canRetry: retryAfterMs !== undefined, retryAfterMs };\n\t\t\terror = createGenericNetworkError(errorMessage, retryInfo, props);\n\t\t\tbreak;\n\t}\n\terror.addTelemetryProperties({ endpointReached: true });\n\treturn error;\n}\n\nexport function throwR11sNetworkError(\n\terrorMessage: string,\n\tstatusCode: number,\n\tretryAfterMs?: number,\n\tadditionalProps?: DriverErrorTelemetryProps,\n): never {\n\tthrow createR11sNetworkError(errorMessage, statusCode, retryAfterMs, additionalProps);\n}\n\n/**\n * Returns network error based on error object from R11s socket (IR11sSocketError)\n */\nexport function errorObjectFromSocketError(\n\tsocketError: IR11sSocketError,\n\thandler: string,\n\tadditionalProps?: DriverErrorTelemetryProps,\n): R11sError {\n\t// pre-0.58 error message prefix: R11sSocketError\n\tconst message = `R11s socket error (${handler}): ${socketError.message}`;\n\tconst error = createR11sNetworkError(\n\t\tmessage,\n\t\tsocketError.code,\n\t\tsocketError.retryAfterMs,\n\t\tadditionalProps,\n\t\tsocketError.internalErrorCode,\n\t);\n\terror.addTelemetryProperties({\n\t\trelayServiceError: true,\n\t\tscenarioName: handler,\n\t\tinternalErrorCode: socketError.internalErrorCode,\n\t});\n\treturn error;\n}\n\n/** Simulate the pathname for socket connection */\nexport const socketIoPath = \"socket.io\";\n\n/**\n * Get a stripped version of a URL safe for r11s telemetry\n * @returns undefined if no appropriate hostName is provided\n */\nexport function getUrlForTelemetry(hostName: string, path: string = \"\"): string | undefined {\n\t// Strip off \"http://\" or \"https://\"\n\tconst hostNameMatch = hostName.match(/^(?:https?:\\/\\/)?([^/]+)/);\n\tif (!hostNameMatch) {\n\t\treturn undefined;\n\t}\n\tconst strippedHostName = hostNameMatch[1];\n\n\tlet extractedPath = \"\";\n\t// Extract portions of the path and explicitly match them to known path names\n\tfor (const portion of path.split(\"/\")) {\n\t\tif (portion !== \"\") {\n\t\t\t// eslint-disable-next-line unicorn/prefer-ternary\n\t\t\tif (\n\t\t\t\t[\n\t\t\t\t\tsocketIoPath,\n\t\t\t\t\t\"repos\",\n\t\t\t\t\t\"deltas\",\n\t\t\t\t\t\"documents\",\n\t\t\t\t\t\"session\",\n\t\t\t\t\t\"git\",\n\t\t\t\t\t\"summaries\",\n\t\t\t\t\t\"latest\",\n\t\t\t\t\t\"document\",\n\t\t\t\t\t\"commits\",\n\t\t\t\t\t\"blobs\",\n\t\t\t\t\t\"refs\",\n\t\t\t\t\t\"revokeToken\",\n\t\t\t\t\t\"accesstoken\",\n\t\t\t\t].includes(portion)\n\t\t\t) {\n\t\t\t\textractedPath += `/${portion}`;\n\t\t\t} else {\n\t\t\t\textractedPath += \"/REDACTED\";\n\t\t\t}\n\t\t}\n\t}\n\n\treturn `${strippedHostName}${extractedPath}`;\n}\n"]}
1
+ {"version":3,"file":"errorUtils.js","sourceRoot":"","sources":["../src/errorUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,gBAAgB,GAEhB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACN,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,yBAAyB,GAEzB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAmB,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAEzF,OAAO,EAAE,mCAAmC,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,UAAU,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAElE;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GA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,MAAM,YAAY,GAAG,WAAW,CAAC;AAExC;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAAgB,EAAE,OAAe,EAAE;IACrE,oCAAoC;IACpC,MAAM,aAAa,GAAG,0BAA0B,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAChE,IAAI,CAAC,aAAa,EAAE,CAAC;QACpB,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,MAAM,gBAAgB,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;IAE1C,IAAI,aAAa,GAAG,EAAE,CAAC;IACvB,6EAA6E;IAC7E,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACvC,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;YACpB,kDAAkD;YAClD,IACC;gBACC,YAAY;gBACZ,OAAO;gBACP,QAAQ;gBACR,WAAW;gBACX,SAAS;gBACT,KAAK;gBACL,WAAW;gBACX,QAAQ;gBACR,UAAU;gBACV,SAAS;gBACT,OAAO;gBACP,MAAM;gBACN,aAAa;gBACb,aAAa;aACb,CAAC,QAAQ,CAAC,OAAO,CAAC,EAClB,CAAC;gBACF,aAAa,IAAI,IAAI,OAAO,EAAE,CAAC;YAChC,CAAC;iBAAM,CAAC;gBACP,aAAa,IAAI,WAAW,CAAC;YAC9B,CAAC;QACF,CAAC;IACF,CAAC;IAED,OAAO,GAAG,gBAAgB,GAAG,aAAa,EAAE,CAAC;AAC9C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tDriverError,\n\tDriverErrorTypes,\n\tIDriverErrorBase,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tAuthorizationError,\n\tGenericNetworkError,\n\tNonRetryableError,\n\tcreateGenericNetworkError,\n\ttype DriverErrorTelemetryProps,\n} from \"@fluidframework/driver-utils/internal\";\nimport { IFluidErrorBase, LoggingError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { R11sServiceClusterDrainingErrorCode } from \"./contracts.js\";\nimport { pkgVersion as driverVersion } from \"./packageVersion.js\";\n\n/**\n * Routerlicious Error types\n * Different error types that may be thrown by the routerlicious driver\n * @internal\n */\nexport const RouterliciousErrorTypes = {\n\t// Inherit base driver error types\n\t...DriverErrorTypes,\n\n\t/**\n\t * SSL Certificate Error.\n\t */\n\tsslCertError: \"sslCertError\",\n\n\t/**\n\t * Error for when the service drains a cluster to which the socket connection is connected to and it disconnects\n\t * all the clients in that cluster.\n\t */\n\tclusterDrainingError: \"clusterDrainingError\",\n} as const;\n/**\n * @internal\n */\nexport type RouterliciousErrorTypes =\n\t(typeof RouterliciousErrorTypes)[keyof typeof RouterliciousErrorTypes];\n\n/**\n * Interface for error responses for the WebSocket connection\n * Intended to be compatible with output from `NetworkError.toJSON`.\n */\nexport interface IR11sSocketError {\n\t/**\n\t * An error code number for the error that occurred.\n\t * It will be a valid HTTP status code.\n\t */\n\tcode: number;\n\n\t/**\n\t * A message about the error that occurred for debugging / logging purposes.\n\t * This should not be displayed to the user directly.\n\t */\n\tmessage: string;\n\n\t/**\n\t * Optional Retry-After time in seconds.\n\t * The client should wait this many seconds before retrying its request.\n\t */\n\tretryAfter?: number;\n\n\t/**\n\t * Optional Retry-After time in milliseconds.\n\t * The client should wait this many milliseconds before retrying its request.\n\t */\n\tretryAfterMs?: number;\n\n\t/**\n\t * Optional internalErrorCode to specify the specific error code for the error within the main code above.\n\t */\n\tinternalErrorCode?: string | number;\n}\n\nexport class ClusterDrainingError extends LoggingError implements IFluidErrorBase {\n\treadonly errorType = RouterliciousErrorTypes.clusterDrainingError;\n\treadonly canRetry = true;\n\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly retryAfterSeconds: number,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\tsuper(message, props);\n\t}\n}\n\nexport interface IR11sError extends Omit<IDriverErrorBase, \"errorType\"> {\n\treadonly errorType: RouterliciousErrorTypes;\n}\n\nexport type R11sError = DriverError | IR11sError;\n\nexport function createR11sNetworkError(\n\terrorMessage: string,\n\tstatusCode: number,\n\tretryAfterMs?: number,\n\tadditionalProps?: DriverErrorTelemetryProps,\n\tinternalErrorCode?: string | number,\n): IFluidErrorBase & R11sError {\n\tlet error: IFluidErrorBase & R11sError;\n\tconst props = { ...additionalProps, statusCode, driverVersion };\n\tswitch (statusCode) {\n\t\tcase 401:\n\t\t// The first 401 is manually retried in RouterliciousRestWrapper with a refreshed token,\n\t\t// so we treat repeat 401s the same as 403.\n\t\tcase 403:\n\t\t\terror = new AuthorizationError(errorMessage, undefined, undefined, props);\n\t\t\tbreak;\n\t\tcase 404:\n\t\t\tconst errorType = RouterliciousErrorTypes.fileNotFoundOrAccessDeniedError;\n\t\t\terror = new NonRetryableError(errorMessage, errorType, props);\n\t\t\tbreak;\n\t\tcase 429:\n\t\t\terror = createGenericNetworkError(errorMessage, { canRetry: true, retryAfterMs }, props);\n\t\t\tbreak;\n\t\tcase 500:\n\t\tcase 502:\n\t\t\terror = new GenericNetworkError(errorMessage, true, props);\n\t\t\tbreak;\n\t\tcase 503:\n\t\t\tif (internalErrorCode === R11sServiceClusterDrainingErrorCode) {\n\t\t\t\terror = new ClusterDrainingError(\n\t\t\t\t\terrorMessage,\n\t\t\t\t\tretryAfterMs !== undefined ? retryAfterMs / 1000 : 660,\n\t\t\t\t\tprops,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\tdefault:\n\t\t\tconst retryInfo = { canRetry: retryAfterMs !== undefined, retryAfterMs };\n\t\t\terror = createGenericNetworkError(errorMessage, retryInfo, props);\n\t\t\tbreak;\n\t}\n\terror.addTelemetryProperties({ endpointReached: true });\n\treturn error;\n}\n\nexport function throwR11sNetworkError(\n\terrorMessage: string,\n\tstatusCode: number,\n\tretryAfterMs?: number,\n\tadditionalProps?: DriverErrorTelemetryProps,\n): never {\n\tthrow createR11sNetworkError(errorMessage, statusCode, retryAfterMs, additionalProps);\n}\n\n/**\n * Returns network error based on error object from R11s socket (IR11sSocketError)\n */\nexport function errorObjectFromSocketError(\n\tsocketError: IR11sSocketError,\n\thandler: string,\n\tadditionalProps?: DriverErrorTelemetryProps,\n): R11sError {\n\t// pre-0.58 error message prefix: R11sSocketError\n\tconst message = `R11s socket error (${handler}): ${socketError.message}`;\n\tconst error = createR11sNetworkError(\n\t\tmessage,\n\t\tsocketError.code,\n\t\tsocketError.retryAfterMs,\n\t\tadditionalProps,\n\t\tsocketError.internalErrorCode,\n\t);\n\terror.addTelemetryProperties({\n\t\trelayServiceError: true,\n\t\tscenarioName: handler,\n\t\tinternalErrorCode: socketError.internalErrorCode,\n\t});\n\treturn error;\n}\n\n/** Simulate the pathname for socket connection */\nexport const socketIoPath = \"socket.io\";\n\n/**\n * Get a stripped version of a URL safe for r11s telemetry\n * @returns undefined if no appropriate hostName is provided\n */\nexport function getUrlForTelemetry(hostName: string, path: string = \"\"): string | undefined {\n\t// Strip off \"http://\" or \"https://\"\n\tconst hostNameMatch = /^(?:https?:\\/\\/)?([^/]+)/.exec(hostName);\n\tif (!hostNameMatch) {\n\t\treturn undefined;\n\t}\n\tconst strippedHostName = hostNameMatch[1];\n\n\tlet extractedPath = \"\";\n\t// Extract portions of the path and explicitly match them to known path names\n\tfor (const portion of path.split(\"/\")) {\n\t\tif (portion !== \"\") {\n\t\t\t// eslint-disable-next-line unicorn/prefer-ternary\n\t\t\tif (\n\t\t\t\t[\n\t\t\t\t\tsocketIoPath,\n\t\t\t\t\t\"repos\",\n\t\t\t\t\t\"deltas\",\n\t\t\t\t\t\"documents\",\n\t\t\t\t\t\"session\",\n\t\t\t\t\t\"git\",\n\t\t\t\t\t\"summaries\",\n\t\t\t\t\t\"latest\",\n\t\t\t\t\t\"document\",\n\t\t\t\t\t\"commits\",\n\t\t\t\t\t\"blobs\",\n\t\t\t\t\t\"refs\",\n\t\t\t\t\t\"revokeToken\",\n\t\t\t\t\t\"accesstoken\",\n\t\t\t\t].includes(portion)\n\t\t\t) {\n\t\t\t\textractedPath += `/${portion}`;\n\t\t\t} else {\n\t\t\t\textractedPath += \"/REDACTED\";\n\t\t\t}\n\t\t}\n\t}\n\n\treturn `${strippedHostName}${extractedPath}`;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"historian.d.ts","sourceRoot":"","sources":["../src/historian.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACX,QAAQ,EACR,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,QAAQ,EACR,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACN,oBAAoB,EACpB,qBAAqB,EACrB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,oCAAoC,gBAAiB,YAAY,KAAG,MACN,CAAC;AAE5E;;GAEG;AACH,qBAAa,SAAU,YAAW,UAAU;IAK1C,OAAO,CAAC,QAAQ,CAAC,YAAY;IAE7B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAN7B,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAuB;IAC1D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAU;gBAGlB,YAAY,EAAE,OAAO,EACtC,YAAY,EAAE,OAAO,EACJ,WAAW,EAAE,WAAW;IAU7B,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAOtD,UAAU,CACtB,IAAI,EAAE,oBAAoB,GACxB,OAAO,CAAC,a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ACH,qBAAa,SAAU,YAAW,UAAU;IAK1C,OAAO,CAAC,QAAQ,CAAC,YAAY;IAE7B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAN7B,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAuB;IAC1D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAU;gBAGlB,YAAY,EAAE,OAAO,EACtC,YAAY,EAAE,OAAO,EACJ,WAAW,EAAE,WAAW;IAU7B,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAOtD,UAAU,CACtB,IAAI,EAAE,oBAAoB,GACxB,OAAO,CAAC,aAAa,CAAC,sBAAsB,CAAC,CAAC;IAQpC,UAAU,CACtB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GACX,OAAO,CAAC,aAAa,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAgBjC,UAAU,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAIxE,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAM1E,aAAa,CACzB,OAAO,EAAE,oBAAoB,EAC7B,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAQnC,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;IAOjF,OAAO,CAAC,cAAc;CAatB"}
package/lib/historian.js CHANGED
@@ -36,7 +36,8 @@ export class Historian {
36
36
  propsToLog: {},
37
37
  requestUrl: "",
38
38
  }
39
- : Promise.reject(error));
39
+ : // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
40
+ Promise.reject(error));
40
41
  }
41
42
  async createTree(tree) {
42
43
  return this.restWrapper.post(`/git/trees`, t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B;QACnD,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,OAAO;gBACN,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;gBACrB,GAAG,IAAI,CAAC,kBAAkB;gBAC1B,GAAG,WAAW;aACd,CAAC;QACH,CAAC;QACD,OAAO;YACN,GAAG,IAAI,CAAC,kBAAkB;YAC1B,GAAG,WAAW;SACd,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fromUtf8ToBase64 } from \"@fluid-internal/client-utils\";\nimport type {\n\tIGitBlob,\n\tIGitCommitDetails,\n\tIGitCreateBlobParams,\n\tIGitCreateBlobResponse,\n\tIGitCreateTreeParams,\n\tIGitTree,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tIWholeSummaryPayload,\n\tIWriteSummaryResponse,\n} from \"@fluidframework/server-services-client\";\n\nimport { IWholeFlatSnapshot } from \"./contracts.js\";\nimport { type QueryStringType } from \"./queryStringUtils.js\";\nimport { IR11sResponse } from \"./restWrapper.js\";\nimport { RestWrapper } from \"./restWrapperBase.js\";\nimport { IHistorian } from \"./storageContracts.js\";\n\nexport interface ICredentials {\n\tuser: string;\n\tpassword: string;\n}\n\nexport const getAuthorizationTokenFromCredentials = (credentials: ICredentials): string =>\n\t`Basic ${fromUtf8ToBase64(`${credentials.user}:${credentials.password}`)}`;\n\n/**\n * Implementation of the IHistorian interface that calls out to a REST interface\n */\nexport class Historian implements IHistorian {\n\tprivate readonly defaultQueryString: QueryStringType = {};\n\tprivate readonly cacheBust: boolean;\n\n\tconstructor(\n\t\tprivate readonly historianApi: boolean,\n\t\tdisableCache: boolean,\n\t\tprivate readonly restWrapper: RestWrapper,\n\t) {\n\t\tif (disableCache && this.historianApi) {\n\t\t\tthis.defaultQueryString.disableCache = disableCache;\n\t\t\tthis.cacheBust = false;\n\t\t} else {\n\t\t\tthis.cacheBust = disableCache;\n\t\t}\n\t}\n\n\tpublic async getBlob(sha: string): Promise<IR11sResponse<IGitBlob>> {\n\t\treturn this.restWrapper.get<IGitBlob>(\n\t\t\t`/git/blobs/${encodeURIComponent(sha)}`,\n\t\t\tthis.getQueryString(),\n\t\t);\n\t}\n\n\tpublic async createBlob(\n\t\tblob: IGitCreateBlobParams,\n\t): Promise<IR11sResponse<IGitCreateBlobResponse>> {\n\t\treturn this.restWrapper.post<IGitCreateBlobResponse>(\n\t\t\t`/git/blobs`,\n\t\t\tblob,\n\t\t\tthis.getQueryString(),\n\t\t);\n\t}\n\n\tpublic async getCommits(\n\t\tsha: string,\n\t\tcount: number,\n\t): Promise<IR11sResponse<IGitCommitDetails[]>> {\n\t\treturn this.restWrapper\n\t\t\t.get<IGitCommitDetails[]>(`/commits`, this.getQueryString({ count, sha }))\n\t\t\t.catch(async (error) =>\n\t\t\t\terror.statusCode === 400 || error.statusCode === 404\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tcontent: [],\n\t\t\t\t\t\t\theaders: new Map(),\n\t\t\t\t\t\t\tpropsToLog: {},\n\t\t\t\t\t\t\trequestUrl: \"\",\n\t\t\t\t\t\t}\n\t\t\t\t\t: Promise.reject<IR11sResponse<IGitCommitDetails[]>>(error),\n\t\t\t);\n\t}\n\n\tpublic async createTree(tree: IGitCreateTreeParams): Promise<IR11sResponse<IGitTree>> {\n\t\treturn this.restWrapper.post<IGitTree>(`/git/trees`, tree, this.getQueryString());\n\t}\n\n\tpublic async getTree(sha: string, recursive: boolean): Promise<IR11sResponse<IGitTree>> {\n\t\treturn this.restWrapper.get<IGitTree>(\n\t\t\t`/git/trees/${encodeURIComponent(sha)}`,\n\t\t\tthis.getQueryString({ recursive: recursive ? 1 : 0 }),\n\t\t);\n\t}\n\tpublic async createSummary(\n\t\tsummary: IWholeSummaryPayload,\n\t\tinitial?: boolean,\n\t): Promise<IR11sResponse<IWriteSummaryResponse>> {\n\t\treturn this.restWrapper.post<IWriteSummaryResponse>(\n\t\t\t`/git/summaries`,\n\t\t\tsummary,\n\t\t\tthis.getQueryString(initial !== undefined ? { initial } : undefined),\n\t\t);\n\t}\n\n\tpublic async getSnapshot(sha: string): Promise<IR11sResponse<IWholeFlatSnapshot>> {\n\t\treturn this.restWrapper.get<IWholeFlatSnapshot>(\n\t\t\t`/git/summaries/${sha}`,\n\t\t\tthis.getQueryString(),\n\t\t);\n\t}\n\n\tprivate getQueryString(queryString?: QueryStringType): QueryStringType {\n\t\tif (this.cacheBust) {\n\t\t\treturn {\n\t\t\t\tcacheBust: Date.now(),\n\t\t\t\t...this.defaultQueryString,\n\t\t\t\t...queryString,\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t...this.defaultQueryString,\n\t\t\t...queryString,\n\t\t};\n\t}\n}\n"]}
1
+ {"version":3,"file":"historian.js","sourceRoot":"","sources":["../src/historian.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAyBhE,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,WAAyB,EAAU,EAAE,CACzF,SAAS,gBAAgB,CAAC,GAAG,WAAW,CAAC,IAAI,IAAI,WAAW,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC;AAE5E;;GAEG;AACH,MAAM,OAAO,SAAS;IAIrB,YACkB,YAAqB,EACtC,YAAqB,EACJ,WAAwB;QAFxB,iBAAY,GAAZ,YAAY,CAAS;QAErB,gBAAW,GAAX,WAAW,CAAa;QANzB,uBAAkB,GAAoB,EAAE,CAAC;QAQzD,IAAI,YAAY,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACvC,IAAI,CAAC,kBAAkB,CAAC,YAAY,GAAG,YAAY,CAAC;YACpD,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACxB,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC;QAC/B,CAAC;IACF,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,GAAW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C,CACrD,CAAC;IACH,CAAC;IACM,KAAK,CAAC,aAAa,CACzB,OAA6B,EAC7B,OAAiB;QAEjB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAC3B,gBAAgB,EAChB,OAAO,EACP,IAAI,CAAC,cAAc,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CACpE,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,GAAW;QACnC,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAC1B,kBAAkB,GAAG,EAAE,EACvB,IAAI,CAAC,cAAc,EAAE,CACrB,CAAC;IACH,CAAC;IAEO,cAAc,CAAC,WAA6B;QACnD,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,OAAO;gBACN,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;gBACrB,GAAG,IAAI,CAAC,kBAAkB;gBAC1B,GAAG,WAAW;aACd,CAAC;QACH,CAAC;QACD,OAAO;YACN,GAAG,IAAI,CAAC,kBAAkB;YAC1B,GAAG,WAAW;SACd,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fromUtf8ToBase64 } from \"@fluid-internal/client-utils\";\nimport type {\n\tIGitBlob,\n\tIGitCommitDetails,\n\tIGitCreateBlobParams,\n\tIGitCreateBlobResponse,\n\tIGitCreateTreeParams,\n\tIGitTree,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tIWholeSummaryPayload,\n\tIWriteSummaryResponse,\n} from \"@fluidframework/server-services-client\";\n\nimport { IWholeFlatSnapshot } from \"./contracts.js\";\nimport { type QueryStringType } from \"./queryStringUtils.js\";\nimport { IR11sResponse } from \"./restWrapper.js\";\nimport { RestWrapper } from \"./restWrapperBase.js\";\nimport { IHistorian } from \"./storageContracts.js\";\n\nexport interface ICredentials {\n\tuser: string;\n\tpassword: string;\n}\n\nexport const getAuthorizationTokenFromCredentials = (credentials: ICredentials): string =>\n\t`Basic ${fromUtf8ToBase64(`${credentials.user}:${credentials.password}`)}`;\n\n/**\n * Implementation of the IHistorian interface that calls out to a REST interface\n */\nexport class Historian implements IHistorian {\n\tprivate readonly defaultQueryString: QueryStringType = {};\n\tprivate readonly cacheBust: boolean;\n\n\tconstructor(\n\t\tprivate readonly historianApi: boolean,\n\t\tdisableCache: boolean,\n\t\tprivate readonly restWrapper: RestWrapper,\n\t) {\n\t\tif (disableCache && this.historianApi) {\n\t\t\tthis.defaultQueryString.disableCache = disableCache;\n\t\t\tthis.cacheBust = false;\n\t\t} else {\n\t\t\tthis.cacheBust = disableCache;\n\t\t}\n\t}\n\n\tpublic async getBlob(sha: string): Promise<IR11sResponse<IGitBlob>> {\n\t\treturn this.restWrapper.get<IGitBlob>(\n\t\t\t`/git/blobs/${encodeURIComponent(sha)}`,\n\t\t\tthis.getQueryString(),\n\t\t);\n\t}\n\n\tpublic async createBlob(\n\t\tblob: IGitCreateBlobParams,\n\t): Promise<IR11sResponse<IGitCreateBlobResponse>> {\n\t\treturn this.restWrapper.post<IGitCreateBlobResponse>(\n\t\t\t`/git/blobs`,\n\t\t\tblob,\n\t\t\tthis.getQueryString(),\n\t\t);\n\t}\n\n\tpublic async getCommits(\n\t\tsha: string,\n\t\tcount: number,\n\t): Promise<IR11sResponse<IGitCommitDetails[]>> {\n\t\treturn this.restWrapper\n\t\t\t.get<IGitCommitDetails[]>(`/commits`, this.getQueryString({ count, sha }))\n\t\t\t.catch(async (error) =>\n\t\t\t\terror.statusCode === 400 || error.statusCode === 404\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tcontent: [],\n\t\t\t\t\t\t\theaders: new Map(),\n\t\t\t\t\t\t\tpropsToLog: {},\n\t\t\t\t\t\t\trequestUrl: \"\",\n\t\t\t\t\t\t}\n\t\t\t\t\t: // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n\t\t\t\t\t\tPromise.reject<IR11sResponse<IGitCommitDetails[]>>(error),\n\t\t\t);\n\t}\n\n\tpublic async createTree(tree: IGitCreateTreeParams): Promise<IR11sResponse<IGitTree>> {\n\t\treturn this.restWrapper.post<IGitTree>(`/git/trees`, tree, this.getQueryString());\n\t}\n\n\tpublic async getTree(sha: string, recursive: boolean): Promise<IR11sResponse<IGitTree>> {\n\t\treturn this.restWrapper.get<IGitTree>(\n\t\t\t`/git/trees/${encodeURIComponent(sha)}`,\n\t\t\tthis.getQueryString({ recursive: recursive ? 1 : 0 }),\n\t\t);\n\t}\n\tpublic async createSummary(\n\t\tsummary: IWholeSummaryPayload,\n\t\tinitial?: boolean,\n\t): Promise<IR11sResponse<IWriteSummaryResponse>> {\n\t\treturn this.restWrapper.post<IWriteSummaryResponse>(\n\t\t\t`/git/summaries`,\n\t\t\tsummary,\n\t\t\tthis.getQueryString(initial !== undefined ? { initial } : undefined),\n\t\t);\n\t}\n\n\tpublic async getSnapshot(sha: string): Promise<IR11sResponse<IWholeFlatSnapshot>> {\n\t\treturn this.restWrapper.get<IWholeFlatSnapshot>(\n\t\t\t`/git/summaries/${sha}`,\n\t\t\tthis.getQueryString(),\n\t\t);\n\t}\n\n\tprivate getQueryString(queryString?: QueryStringType): QueryStringType {\n\t\tif (this.cacheBust) {\n\t\t\treturn {\n\t\t\t\tcacheBust: Date.now(),\n\t\t\t\t...this.defaultQueryString,\n\t\t\t\t...queryString,\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t...this.defaultQueryString,\n\t\t\t...queryString,\n\t\t};\n\t}\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/routerlicious-driver";
8
- export declare const pkgVersion = "2.73.0";
8
+ export declare const pkgVersion = "2.74.0-365691";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,yCAAyC,CAAC;AAC9D,eAAO,MAAM,UAAU,WAAW,CAAC"}
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,yCAAyC,CAAC;AAC9D,eAAO,MAAM,UAAU,kBAAkB,CAAC"}
@@ -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/routerlicious-driver";
8
- export const pkgVersion = "2.73.0";
8
+ export const pkgVersion = "2.74.0-365691";
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,sCAAsC,CAAC;AAC9D,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/routerlicious-driver\";\nexport const pkgVersion = \"2.73.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,sCAAsC,CAAC;AAC9D,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,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/routerlicious-driver\";\nexport const pkgVersion = \"2.74.0-365691\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/routerlicious-driver",
3
- "version": "2.73.0",
3
+ "version": "2.74.0-365691",
4
4
  "description": "Socket.IO + Git implementation of Fluid service API",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -69,14 +69,14 @@
69
69
  "temp-directory": "nyc/.nyc_output"
70
70
  },
71
71
  "dependencies": {
72
- "@fluid-internal/client-utils": "~2.73.0",
73
- "@fluidframework/core-interfaces": "~2.73.0",
74
- "@fluidframework/core-utils": "~2.73.0",
75
- "@fluidframework/driver-base": "~2.73.0",
76
- "@fluidframework/driver-definitions": "~2.73.0",
77
- "@fluidframework/driver-utils": "~2.73.0",
72
+ "@fluid-internal/client-utils": "2.74.0-365691",
73
+ "@fluidframework/core-interfaces": "2.74.0-365691",
74
+ "@fluidframework/core-utils": "2.74.0-365691",
75
+ "@fluidframework/driver-base": "2.74.0-365691",
76
+ "@fluidframework/driver-definitions": "2.74.0-365691",
77
+ "@fluidframework/driver-utils": "2.74.0-365691",
78
78
  "@fluidframework/server-services-client": "^7.0.0",
79
- "@fluidframework/telemetry-utils": "~2.73.0",
79
+ "@fluidframework/telemetry-utils": "2.74.0-365691",
80
80
  "cross-fetch": "^3.1.5",
81
81
  "json-stringify-safe": "5.0.1",
82
82
  "socket.io-client": "~4.7.5",
@@ -85,12 +85,12 @@
85
85
  "devDependencies": {
86
86
  "@arethetypeswrong/cli": "^0.17.1",
87
87
  "@biomejs/biome": "~1.9.3",
88
- "@fluid-internal/mocha-test-setup": "~2.73.0",
88
+ "@fluid-internal/mocha-test-setup": "2.74.0-365691",
89
89
  "@fluid-tools/build-cli": "^0.60.0",
90
90
  "@fluidframework/build-common": "^2.0.3",
91
91
  "@fluidframework/build-tools": "^0.60.0",
92
- "@fluidframework/eslint-config-fluid": "~2.73.0",
93
- "@fluidframework/routerlicious-driver-previous": "npm:@fluidframework/routerlicious-driver@2.71.0",
92
+ "@fluidframework/eslint-config-fluid": "2.74.0-365691",
93
+ "@fluidframework/routerlicious-driver-previous": "npm:@fluidframework/routerlicious-driver@2.73.0",
94
94
  "@microsoft/api-extractor": "7.52.11",
95
95
  "@types/mocha": "^10.0.10",
96
96
  "@types/nock": "^9.3.0",
package/src/errorUtils.ts CHANGED
@@ -188,7 +188,7 @@ export const socketIoPath = "socket.io";
188
188
  */
189
189
  export function getUrlForTelemetry(hostName: string, path: string = ""): string | undefined {
190
190
  // Strip off "http://" or "https://"
191
- const hostNameMatch = hostName.match(/^(?:https?:\/\/)?([^/]+)/);
191
+ const hostNameMatch = /^(?:https?:\/\/)?([^/]+)/.exec(hostName);
192
192
  if (!hostNameMatch) {
193
193
  return undefined;
194
194
  }
package/src/historian.ts CHANGED
@@ -82,7 +82,8 @@ export class Historian implements IHistorian {
82
82
  propsToLog: {},
83
83
  requestUrl: "",
84
84
  }
85
- : Promise.reject<IR11sResponse<IGitCommitDetails[]>>(error),
85
+ : // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
86
+ Promise.reject<IR11sResponse<IGitCommitDetails[]>>(error),
86
87
  );
87
88
  }
88
89
 
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/routerlicious-driver";
9
- export const pkgVersion = "2.73.0";
9
+ export const pkgVersion = "2.74.0-365691";