@fluidframework/driver-utils 2.0.0-dev.4.4.0.162253 → 2.0.0-dev.5.2.0.169897

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 (83) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/blob.d.ts +53 -0
  3. package/dist/blob.d.ts.map +1 -0
  4. package/dist/blob.js +62 -0
  5. package/dist/blob.js.map +1 -0
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +5 -4
  9. package/dist/index.js.map +1 -1
  10. package/dist/insecureUrlResolver.d.ts.map +1 -1
  11. package/dist/insecureUrlResolver.js +1 -2
  12. package/dist/insecureUrlResolver.js.map +1 -1
  13. package/dist/network.d.ts +2 -1
  14. package/dist/network.d.ts.map +1 -1
  15. package/dist/network.js +2 -1
  16. package/dist/network.js.map +1 -1
  17. package/dist/networkUtils.d.ts +3 -2
  18. package/dist/networkUtils.d.ts.map +1 -1
  19. package/dist/networkUtils.js +1 -1
  20. package/dist/networkUtils.js.map +1 -1
  21. package/dist/packageVersion.d.ts +1 -1
  22. package/dist/packageVersion.js +1 -1
  23. package/dist/packageVersion.js.map +1 -1
  24. package/dist/parallelRequests.d.ts +4 -3
  25. package/dist/parallelRequests.d.ts.map +1 -1
  26. package/dist/parallelRequests.js.map +1 -1
  27. package/dist/runWithRetry.d.ts +2 -2
  28. package/dist/runWithRetry.d.ts.map +1 -1
  29. package/dist/runWithRetry.js.map +1 -1
  30. package/dist/treeConversions.d.ts.map +1 -1
  31. package/dist/treeConversions.js +4 -4
  32. package/dist/treeConversions.js.map +1 -1
  33. package/dist/tsdoc-metadata.json +11 -0
  34. package/lib/blob.d.ts +53 -0
  35. package/lib/blob.d.ts.map +1 -0
  36. package/lib/blob.js +56 -0
  37. package/lib/blob.js.map +1 -0
  38. package/lib/index.d.ts +1 -1
  39. package/lib/index.d.ts.map +1 -1
  40. package/lib/index.js +1 -1
  41. package/lib/index.js.map +1 -1
  42. package/lib/insecureUrlResolver.d.ts.map +1 -1
  43. package/lib/insecureUrlResolver.js +2 -3
  44. package/lib/insecureUrlResolver.js.map +1 -1
  45. package/lib/network.d.ts +2 -1
  46. package/lib/network.d.ts.map +1 -1
  47. package/lib/network.js +2 -1
  48. package/lib/network.js.map +1 -1
  49. package/lib/networkUtils.d.ts +3 -2
  50. package/lib/networkUtils.d.ts.map +1 -1
  51. package/lib/networkUtils.js +1 -1
  52. package/lib/networkUtils.js.map +1 -1
  53. package/lib/packageVersion.d.ts +1 -1
  54. package/lib/packageVersion.js +1 -1
  55. package/lib/packageVersion.js.map +1 -1
  56. package/lib/parallelRequests.d.ts +4 -3
  57. package/lib/parallelRequests.d.ts.map +1 -1
  58. package/lib/parallelRequests.js.map +1 -1
  59. package/lib/runWithRetry.d.ts +2 -2
  60. package/lib/runWithRetry.d.ts.map +1 -1
  61. package/lib/runWithRetry.js.map +1 -1
  62. package/lib/treeConversions.d.ts.map +1 -1
  63. package/lib/treeConversions.js +1 -1
  64. package/lib/treeConversions.js.map +1 -1
  65. package/package.json +17 -16
  66. package/src/blob.ts +68 -0
  67. package/src/index.ts +1 -1
  68. package/src/insecureUrlResolver.ts +4 -11
  69. package/src/network.ts +3 -1
  70. package/src/networkUtils.ts +4 -3
  71. package/src/packageVersion.ts +1 -1
  72. package/src/parallelRequests.ts +5 -5
  73. package/src/runWithRetry.ts +2 -2
  74. package/src/treeConversions.ts +1 -1
  75. package/dist/fluidResolvedUrl.d.ts +0 -16
  76. package/dist/fluidResolvedUrl.d.ts.map +0 -1
  77. package/dist/fluidResolvedUrl.js +0 -24
  78. package/dist/fluidResolvedUrl.js.map +0 -1
  79. package/lib/fluidResolvedUrl.d.ts +0 -16
  80. package/lib/fluidResolvedUrl.d.ts.map +0 -1
  81. package/lib/fluidResolvedUrl.js +0 -19
  82. package/lib/fluidResolvedUrl.js.map +0 -1
  83. package/src/fluidResolvedUrl.ts +0 -26
@@ -6,12 +6,7 @@
6
6
  import { parse } from "url";
7
7
  import { assert } from "@fluidframework/common-utils";
8
8
  import { IRequest } from "@fluidframework/core-interfaces";
9
- import {
10
- IFluidResolvedUrl,
11
- IResolvedUrl,
12
- IUrlResolver,
13
- DriverHeader,
14
- } from "@fluidframework/driver-definitions";
9
+ import { IResolvedUrl, IUrlResolver, DriverHeader } from "@fluidframework/driver-definitions";
15
10
  import Axios from "axios";
16
11
 
17
12
  /**
@@ -98,7 +93,7 @@ export class InsecureUrlResolver implements IUrlResolver {
98
93
  // the actual container ID will be generated by the driver.
99
94
  // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
100
95
  if (!documentId) {
101
- const createNewResponse: IFluidResolvedUrl = {
96
+ const createNewResponse: IResolvedUrl = {
102
97
  endpoints: {
103
98
  deltaStorageUrl: `${this.ordererUrl}/deltas/${encodedTenantId}/new`,
104
99
  ordererUrl: this.ordererUrl,
@@ -122,7 +117,7 @@ export class InsecureUrlResolver implements IUrlResolver {
122
117
  const deltaStorageUrl = `${this.ordererUrl}/deltas/${encodedTenantId}/${encodedDocId}`;
123
118
  const storageUrl = `${this.storageUrl}/repos/${encodedTenantId}`;
124
119
 
125
- const response: IFluidResolvedUrl = {
120
+ const response: IResolvedUrl = {
126
121
  endpoints: {
127
122
  deltaStorageUrl,
128
123
  ordererUrl: this.ordererUrl,
@@ -137,9 +132,7 @@ export class InsecureUrlResolver implements IUrlResolver {
137
132
  }
138
133
 
139
134
  public async getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string> {
140
- const fluidResolvedUrl = resolvedUrl as IFluidResolvedUrl;
141
-
142
- const parsedUrl = parse(fluidResolvedUrl.url);
135
+ const parsedUrl = parse(resolvedUrl.url);
143
136
  const [, , documentId] = parsedUrl.pathname?.split("/") ?? [];
144
137
  // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
145
138
  assert(!!documentId, 0x273 /* "Invalid document id from parsed URL" */);
package/src/network.ts CHANGED
@@ -72,9 +72,11 @@ export class DeltaStreamConnectionForbiddenError
72
72
  static readonly errorType = DriverErrorType.deltaStreamConnectionForbidden;
73
73
  readonly errorType = DeltaStreamConnectionForbiddenError.errorType;
74
74
  readonly canRetry = false;
75
+ readonly storageOnlyReason: string | undefined;
75
76
 
76
- constructor(message: string, props: DriverErrorTelemetryProps) {
77
+ constructor(message: string, props: DriverErrorTelemetryProps, storageOnlyReason?: string) {
77
78
  super(message, { ...props, statusCode: 400 });
79
+ this.storageOnlyReason = storageOnlyReason;
78
80
  }
79
81
  }
80
82
 
@@ -3,17 +3,18 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { ITelemetryErrorEvent, ITelemetryLogger } from "@fluidframework/common-definitions";
6
+ import { ITelemetryErrorEvent } from "@fluidframework/common-definitions";
7
+ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
7
8
  import { isOnline, OnlineStatus, canRetryOnError } from "./network";
8
9
 
9
10
  export function logNetworkFailure(
10
- logger: ITelemetryLogger,
11
+ logger: ITelemetryLoggerExt,
11
12
  event: ITelemetryErrorEvent,
12
13
  error?: any,
13
14
  ) {
14
15
  const newEvent = { ...event };
15
16
 
16
- const errorOnlineProp = error.online;
17
+ const errorOnlineProp = error?.online;
17
18
  newEvent.online =
18
19
  typeof errorOnlineProp === "string" ? errorOnlineProp : OnlineStatus[isOnline()];
19
20
 
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/driver-utils";
9
- export const pkgVersion = "2.0.0-dev.4.4.0.162253";
9
+ export const pkgVersion = "2.0.0-dev.5.2.0.169897";
@@ -3,8 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { assert, Deferred, performance } from "@fluidframework/common-utils";
6
- import { ITelemetryLogger, ITelemetryProperties } from "@fluidframework/common-definitions";
7
- import { PerformanceEvent } from "@fluidframework/telemetry-utils";
6
+ import { ITelemetryProperties } from "@fluidframework/common-definitions";
7
+ import { ITelemetryLoggerExt, PerformanceEvent } from "@fluidframework/telemetry-utils";
8
8
  import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
9
9
  import { IDeltasFetchResult, IStream, IStreamResult } from "@fluidframework/driver-definitions";
10
10
  import { getRetryDelayFromError, canRetryOnError, createGenericNetworkError } from "./network";
@@ -50,7 +50,7 @@ export class ParallelRequests<T> {
50
50
  from: number,
51
51
  private to: number | undefined,
52
52
  private readonly payloadSize: number,
53
- private readonly logger: ITelemetryLogger,
53
+ private readonly logger: ITelemetryLoggerExt,
54
54
  private readonly requestCallback: (
55
55
  request: number,
56
56
  from: number,
@@ -409,7 +409,7 @@ async function getSingleOpBatch(
409
409
  get: (telemetryProps: ITelemetryProperties) => Promise<IDeltasFetchResult>,
410
410
  props: ITelemetryProperties,
411
411
  strongTo: boolean,
412
- logger: ITelemetryLogger,
412
+ logger: ITelemetryLoggerExt,
413
413
  signal?: AbortSignal,
414
414
  scenarioName?: string,
415
415
  ): Promise<{ partial: boolean; cancel: boolean; payload: ISequencedDocumentMessage[] }> {
@@ -540,7 +540,7 @@ export function requestOps(
540
540
  fromTotal: number,
541
541
  toTotal: number | undefined,
542
542
  payloadSize: number,
543
- logger: ITelemetryLogger,
543
+ logger: ITelemetryLoggerExt,
544
544
  signal?: AbortSignal,
545
545
  scenarioName?: string,
546
546
  ): IStream<ISequencedDocumentMessage[]> {
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { ITelemetryLogger } from "@fluidframework/common-definitions";
6
+ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
7
7
  import { delay, performance } from "@fluidframework/common-utils";
8
8
  import { DriverErrorType } from "@fluidframework/driver-definitions";
9
9
  import { canRetryOnError, getRetryDelayFromError } from "./network";
@@ -45,7 +45,7 @@ export interface IProgress {
45
45
  export async function runWithRetry<T>(
46
46
  api: (cancel?: AbortSignal) => Promise<T>,
47
47
  fetchCallName: string,
48
- logger: ITelemetryLogger,
48
+ logger: ITelemetryLoggerExt,
49
49
  progress: IProgress,
50
50
  ): Promise<T> {
51
51
  let result: T | undefined;
@@ -4,8 +4,8 @@
4
4
  */
5
5
 
6
6
  import { Uint8ArrayToString, unreachableCase } from "@fluidframework/common-utils";
7
- import { AttachmentTreeEntry, BlobTreeEntry, TreeTreeEntry } from "@fluidframework/protocol-base";
8
7
  import { ISummaryTree, ITree, ITreeEntry, SummaryType } from "@fluidframework/protocol-definitions";
8
+ import { AttachmentTreeEntry, BlobTreeEntry, TreeTreeEntry } from "./blob";
9
9
  import { isCombinedAppAndProtocolSummary } from "./summaryForCreateNew";
10
10
 
11
11
  /**
@@ -1,16 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { IResolvedUrl, IFluidResolvedUrl } from "@fluidframework/driver-definitions";
6
- /**
7
- * @deprecated In the next major release all IResolvedUrl will be IFluidResolvedUrl,
8
- * so this method is no longer necessary.
9
- */
10
- export declare const isFluidResolvedUrl: (resolved: IResolvedUrl | undefined) => resolved is IFluidResolvedUrl;
11
- /**
12
- * @deprecated In the next major release all IResolvedUrl will be IFluidResolvedUrl,
13
- * so this method is no longer necessary.
14
- */
15
- export declare function ensureFluidResolvedUrl(resolved: IResolvedUrl | undefined): asserts resolved is IFluidResolvedUrl;
16
- //# sourceMappingURL=fluidResolvedUrl.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fluidResolvedUrl.d.ts","sourceRoot":"","sources":["../src/fluidResolvedUrl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAErF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,aACpB,YAAY,GAAG,SAAS,kCAC2B,CAAC;AAE/D;;;GAGG;AACH,wBAAgB,sBAAsB,CACrC,QAAQ,EAAE,YAAY,GAAG,SAAS,GAChC,OAAO,CAAC,QAAQ,IAAI,iBAAiB,CAIvC"}
@@ -1,24 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
- * Licensed under the MIT License.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.ensureFluidResolvedUrl = exports.isFluidResolvedUrl = void 0;
8
- /**
9
- * @deprecated In the next major release all IResolvedUrl will be IFluidResolvedUrl,
10
- * so this method is no longer necessary.
11
- */
12
- const isFluidResolvedUrl = (resolved) => (resolved === null || resolved === void 0 ? void 0 : resolved.type) === "fluid";
13
- exports.isFluidResolvedUrl = isFluidResolvedUrl;
14
- /**
15
- * @deprecated In the next major release all IResolvedUrl will be IFluidResolvedUrl,
16
- * so this method is no longer necessary.
17
- */
18
- function ensureFluidResolvedUrl(resolved) {
19
- if (!(0, exports.isFluidResolvedUrl)(resolved)) {
20
- throw new Error(`resolved is not a Fluid url. Type: ${resolved === null || resolved === void 0 ? void 0 : resolved.type}`);
21
- }
22
- }
23
- exports.ensureFluidResolvedUrl = ensureFluidResolvedUrl;
24
- //# sourceMappingURL=fluidResolvedUrl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fluidResolvedUrl.js","sourceRoot":"","sources":["../src/fluidResolvedUrl.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;;GAGG;AACI,MAAM,kBAAkB,GAAG,CACjC,QAAkC,EACF,EAAE,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,MAAK,OAAO,CAAC;AAFlD,QAAA,kBAAkB,sBAEgC;AAE/D;;;GAGG;AACH,SAAgB,sBAAsB,CACrC,QAAkC;IAElC,IAAI,CAAC,IAAA,0BAAkB,EAAC,QAAQ,CAAC,EAAE;QAClC,MAAM,IAAI,KAAK,CAAC,sCAAsC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,EAAE,CAAC,CAAC;KACxE;AACF,CAAC;AAND,wDAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IResolvedUrl, IFluidResolvedUrl } from \"@fluidframework/driver-definitions\";\n\n/**\n * @deprecated In the next major release all IResolvedUrl will be IFluidResolvedUrl,\n * so this method is no longer necessary.\n */\nexport const isFluidResolvedUrl = (\n\tresolved: IResolvedUrl | undefined,\n): resolved is IFluidResolvedUrl => resolved?.type === \"fluid\";\n\n/**\n * @deprecated In the next major release all IResolvedUrl will be IFluidResolvedUrl,\n * so this method is no longer necessary.\n */\nexport function ensureFluidResolvedUrl(\n\tresolved: IResolvedUrl | undefined,\n): asserts resolved is IFluidResolvedUrl {\n\tif (!isFluidResolvedUrl(resolved)) {\n\t\tthrow new Error(`resolved is not a Fluid url. Type: ${resolved?.type}`);\n\t}\n}\n"]}
@@ -1,16 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { IResolvedUrl, IFluidResolvedUrl } from "@fluidframework/driver-definitions";
6
- /**
7
- * @deprecated In the next major release all IResolvedUrl will be IFluidResolvedUrl,
8
- * so this method is no longer necessary.
9
- */
10
- export declare const isFluidResolvedUrl: (resolved: IResolvedUrl | undefined) => resolved is IFluidResolvedUrl;
11
- /**
12
- * @deprecated In the next major release all IResolvedUrl will be IFluidResolvedUrl,
13
- * so this method is no longer necessary.
14
- */
15
- export declare function ensureFluidResolvedUrl(resolved: IResolvedUrl | undefined): asserts resolved is IFluidResolvedUrl;
16
- //# sourceMappingURL=fluidResolvedUrl.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fluidResolvedUrl.d.ts","sourceRoot":"","sources":["../src/fluidResolvedUrl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAErF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,aACpB,YAAY,GAAG,SAAS,kCAC2B,CAAC;AAE/D;;;GAGG;AACH,wBAAgB,sBAAsB,CACrC,QAAQ,EAAE,YAAY,GAAG,SAAS,GAChC,OAAO,CAAC,QAAQ,IAAI,iBAAiB,CAIvC"}
@@ -1,19 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- /**
6
- * @deprecated In the next major release all IResolvedUrl will be IFluidResolvedUrl,
7
- * so this method is no longer necessary.
8
- */
9
- export const isFluidResolvedUrl = (resolved) => (resolved === null || resolved === void 0 ? void 0 : resolved.type) === "fluid";
10
- /**
11
- * @deprecated In the next major release all IResolvedUrl will be IFluidResolvedUrl,
12
- * so this method is no longer necessary.
13
- */
14
- export function ensureFluidResolvedUrl(resolved) {
15
- if (!isFluidResolvedUrl(resolved)) {
16
- throw new Error(`resolved is not a Fluid url. Type: ${resolved === null || resolved === void 0 ? void 0 : resolved.type}`);
17
- }
18
- }
19
- //# sourceMappingURL=fluidResolvedUrl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fluidResolvedUrl.js","sourceRoot":"","sources":["../src/fluidResolvedUrl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CACjC,QAAkC,EACF,EAAE,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,MAAK,OAAO,CAAC;AAE/D;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACrC,QAAkC;IAElC,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE;QAClC,MAAM,IAAI,KAAK,CAAC,sCAAsC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,EAAE,CAAC,CAAC;KACxE;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IResolvedUrl, IFluidResolvedUrl } from \"@fluidframework/driver-definitions\";\n\n/**\n * @deprecated In the next major release all IResolvedUrl will be IFluidResolvedUrl,\n * so this method is no longer necessary.\n */\nexport const isFluidResolvedUrl = (\n\tresolved: IResolvedUrl | undefined,\n): resolved is IFluidResolvedUrl => resolved?.type === \"fluid\";\n\n/**\n * @deprecated In the next major release all IResolvedUrl will be IFluidResolvedUrl,\n * so this method is no longer necessary.\n */\nexport function ensureFluidResolvedUrl(\n\tresolved: IResolvedUrl | undefined,\n): asserts resolved is IFluidResolvedUrl {\n\tif (!isFluidResolvedUrl(resolved)) {\n\t\tthrow new Error(`resolved is not a Fluid url. Type: ${resolved?.type}`);\n\t}\n}\n"]}
@@ -1,26 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
-
6
- import { IResolvedUrl, IFluidResolvedUrl } from "@fluidframework/driver-definitions";
7
-
8
- /**
9
- * @deprecated In the next major release all IResolvedUrl will be IFluidResolvedUrl,
10
- * so this method is no longer necessary.
11
- */
12
- export const isFluidResolvedUrl = (
13
- resolved: IResolvedUrl | undefined,
14
- ): resolved is IFluidResolvedUrl => resolved?.type === "fluid";
15
-
16
- /**
17
- * @deprecated In the next major release all IResolvedUrl will be IFluidResolvedUrl,
18
- * so this method is no longer necessary.
19
- */
20
- export function ensureFluidResolvedUrl(
21
- resolved: IResolvedUrl | undefined,
22
- ): asserts resolved is IFluidResolvedUrl {
23
- if (!isFluidResolvedUrl(resolved)) {
24
- throw new Error(`resolved is not a Fluid url. Type: ${resolved?.type}`);
25
- }
26
- }