@fluidframework/odsp-driver 0.59.3003 → 0.59.4000

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 (69) hide show
  1. package/dist/WriteBufferUtils.js +1 -1
  2. package/dist/WriteBufferUtils.js.map +1 -1
  3. package/dist/createFile.d.ts +1 -1
  4. package/dist/createFile.d.ts.map +1 -1
  5. package/dist/createFile.js +36 -6
  6. package/dist/createFile.js.map +1 -1
  7. package/dist/fetchSnapshot.d.ts.map +1 -1
  8. package/dist/fetchSnapshot.js +2 -4
  9. package/dist/fetchSnapshot.js.map +1 -1
  10. package/dist/odspDocumentDeltaConnection.d.ts.map +1 -1
  11. package/dist/odspDocumentDeltaConnection.js +15 -2
  12. package/dist/odspDocumentDeltaConnection.js.map +1 -1
  13. package/dist/odspDocumentServiceFactoryCore.d.ts.map +1 -1
  14. package/dist/odspDocumentServiceFactoryCore.js +5 -1
  15. package/dist/odspDocumentServiceFactoryCore.js.map +1 -1
  16. package/dist/odspSnapshotParser.js +1 -1
  17. package/dist/odspSnapshotParser.js.map +1 -1
  18. package/dist/odspUtils.d.ts +1 -0
  19. package/dist/odspUtils.d.ts.map +1 -1
  20. package/dist/odspUtils.js +8 -9
  21. package/dist/odspUtils.js.map +1 -1
  22. package/dist/packageVersion.d.ts +1 -1
  23. package/dist/packageVersion.js +1 -1
  24. package/dist/packageVersion.js.map +1 -1
  25. package/dist/prefetchLatestSnapshot.d.ts.map +1 -1
  26. package/dist/prefetchLatestSnapshot.js +1 -1
  27. package/dist/prefetchLatestSnapshot.js.map +1 -1
  28. package/dist/zipItDataRepresentationUtils.js +2 -2
  29. package/dist/zipItDataRepresentationUtils.js.map +1 -1
  30. package/lib/WriteBufferUtils.js +1 -1
  31. package/lib/WriteBufferUtils.js.map +1 -1
  32. package/lib/createFile.d.ts +1 -1
  33. package/lib/createFile.d.ts.map +1 -1
  34. package/lib/createFile.js +37 -7
  35. package/lib/createFile.js.map +1 -1
  36. package/lib/fetchSnapshot.d.ts.map +1 -1
  37. package/lib/fetchSnapshot.js +2 -4
  38. package/lib/fetchSnapshot.js.map +1 -1
  39. package/lib/odspDocumentDeltaConnection.d.ts.map +1 -1
  40. package/lib/odspDocumentDeltaConnection.js +15 -2
  41. package/lib/odspDocumentDeltaConnection.js.map +1 -1
  42. package/lib/odspDocumentServiceFactoryCore.d.ts.map +1 -1
  43. package/lib/odspDocumentServiceFactoryCore.js +5 -1
  44. package/lib/odspDocumentServiceFactoryCore.js.map +1 -1
  45. package/lib/odspSnapshotParser.js +1 -1
  46. package/lib/odspSnapshotParser.js.map +1 -1
  47. package/lib/odspUtils.d.ts +1 -0
  48. package/lib/odspUtils.d.ts.map +1 -1
  49. package/lib/odspUtils.js +7 -8
  50. package/lib/odspUtils.js.map +1 -1
  51. package/lib/packageVersion.d.ts +1 -1
  52. package/lib/packageVersion.js +1 -1
  53. package/lib/packageVersion.js.map +1 -1
  54. package/lib/prefetchLatestSnapshot.d.ts.map +1 -1
  55. package/lib/prefetchLatestSnapshot.js +1 -1
  56. package/lib/prefetchLatestSnapshot.js.map +1 -1
  57. package/lib/zipItDataRepresentationUtils.js +2 -2
  58. package/lib/zipItDataRepresentationUtils.js.map +1 -1
  59. package/package.json +17 -15
  60. package/src/WriteBufferUtils.ts +1 -1
  61. package/src/createFile.ts +41 -5
  62. package/src/fetchSnapshot.ts +2 -4
  63. package/src/odspDocumentDeltaConnection.ts +14 -2
  64. package/src/odspDocumentServiceFactoryCore.ts +7 -0
  65. package/src/odspSnapshotParser.ts +1 -1
  66. package/src/odspUtils.ts +9 -8
  67. package/src/packageVersion.ts +1 -1
  68. package/src/prefetchLatestSnapshot.ts +1 -1
  69. package/src/zipItDataRepresentationUtils.ts +2 -2
@@ -440,6 +440,7 @@ export class OdspDocumentDeltaConnection extends DocumentDeltaConnection {
440
440
  }
441
441
 
442
442
  protected serverDisconnectHandler = (error: IFluidErrorBase & OdspError) => {
443
+ this.logger.sendTelemetryEvent({ eventName: "ServerDisconnect" }, error);
443
444
  this.disposeCore(true, error);
444
445
  };
445
446
 
@@ -551,11 +552,22 @@ export class OdspDocumentDeltaConnection extends DocumentDeltaConnection {
551
552
 
552
553
  case "nack":
553
554
  // per client / document nack handling
554
- super.addTrackedListener(event, (clientIdOrDocumentId: string, message: INack[]) => {
555
+ super.addTrackedListener(event, (clientIdOrDocumentId: string, nacks: INack[]) => {
555
556
  if (clientIdOrDocumentId.length === 0 ||
556
557
  clientIdOrDocumentId === this.documentId ||
557
558
  (this.hasDetails && clientIdOrDocumentId === this.clientId)) {
558
- this.emit("nack", clientIdOrDocumentId, message);
559
+ const nackContent = nacks[0]?.content;
560
+ if (nackContent !== undefined) {
561
+ const { code, type, message, retryAfter } = nackContent;
562
+ this.logger.sendTelemetryEvent({
563
+ eventName: "ServerNack",
564
+ code,
565
+ type,
566
+ message,
567
+ retryAfterSeconds: retryAfter,
568
+ });
569
+ }
570
+ this.emit("nack", clientIdOrDocumentId, nacks);
559
571
  }
560
572
  });
561
573
  break;
@@ -125,6 +125,7 @@ export class OdspDocumentServiceFactoryCore implements IDocumentServiceFactory {
125
125
  fileEntry,
126
126
  this.hostPolicy.cacheCreateNewSummary ?? true,
127
127
  !!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,
128
+ odspResolvedUrl.isClpCompliantApp,
128
129
  );
129
130
  const docService = this.createDocumentServiceCore(odspResolvedUrl, odspLogger,
130
131
  cacheAndTracker, clientIsSummarizer);
@@ -156,6 +157,12 @@ export class OdspDocumentServiceFactoryCore implements IDocumentServiceFactory {
156
157
  // create the key to separate the socket reuse cache
157
158
  this.socketReferenceKeyPrefix = uuid();
158
159
  }
160
+ // Set enableRedeemFallback by default as true.
161
+ this.hostPolicy.enableRedeemFallback = this.hostPolicy.enableRedeemFallback ?? true;
162
+ this.hostPolicy.sessionOptions = {
163
+ forceAccessTokenViaAuthorizationHeader: true,
164
+ ...this.hostPolicy.sessionOptions,
165
+ };
159
166
  }
160
167
 
161
168
  public async createDocumentService(
@@ -58,7 +58,7 @@ export function convertOdspSnapshotToSnapsohtTreeAndBlobs(
58
58
  if (odspSnapshot.blobs) {
59
59
  odspSnapshot.blobs.forEach((blob) => {
60
60
  assert(blob.encoding === "base64" || blob.encoding === undefined,
61
- 0x0a4 /* `Unexpected blob encoding type: '${blob.encoding}'` */);
61
+ 0x0a4 /* Unexpected blob encoding type */);
62
62
  blobsWithBufferContent.set(blob.id, stringToBuffer(blob.content, blob.encoding ?? "utf8"));
63
63
  });
64
64
  }
package/src/odspUtils.ts CHANGED
@@ -129,21 +129,16 @@ export async function fetchHelper(
129
129
  duration: performance.now() - start,
130
130
  };
131
131
  }, (error) => {
132
- // While we do not know for sure whether computer is offline, this error is not actionable and
133
- // is pretty good indicator we are offline. Treating it as offline scenario will make it
134
- // easier to see other errors in telemetry.
135
- let online = isOnline();
132
+ const online = isOnline();
136
133
  const errorText = `${error}`;
137
- if (errorText === "TypeError: Failed to fetch") {
138
- online = OnlineStatus.Offline;
139
- }
134
+
140
135
  // This error is thrown by fetch() when AbortSignal is provided and it gets cancelled
141
136
  if (error.name === "AbortError") {
142
137
  throw new RetryableError(
143
138
  "Fetch Timeout (AbortError)", OdspErrorType.fetchTimeout, { driverVersion });
144
139
  }
145
140
  // TCP/IP timeout
146
- if (errorText.indexOf("ETIMEDOUT") !== -1) {
141
+ if (errorText.includes("ETIMEDOUT")) {
147
142
  throw new RetryableError(
148
143
  "Fetch Timeout (ETIMEDOUT)", OdspErrorType.fetchTimeout, { driverVersion });
149
144
  }
@@ -158,6 +153,8 @@ export async function fetchHelper(
158
153
  // pre-0.58 error message prefix: Offline
159
154
  `ODSP fetch failure (Offline): ${errorText}`, DriverErrorType.offlineError, { driverVersion });
160
155
  } else {
156
+ // It is perhaps still possible that this is due to being offline, the error does not reveal enough
157
+ // information to conclude. Could also be DNS errors, malformed fetch request, CSP violation, etc.
161
158
  throw new RetryableError(
162
159
  // pre-0.58 error message prefix: Fetch error
163
160
  `ODSP fetch failure: ${errorText}`, DriverErrorType.fetchFailure, { driverVersion });
@@ -343,3 +340,7 @@ export function createCacheSnapshotKey(odspResolvedUrl: IOdspResolvedUrl): ICach
343
340
  };
344
341
  return cacheEntry;
345
342
  }
343
+
344
+ // 80KB is the max body size that we can put in ump post body for server to be able to accept it.
345
+ // Keeping it 78KB to be a little cautious. As per the telemetry 99p is less than 78KB.
346
+ export const maxUmpPostBodySize = 79872;
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/odsp-driver";
9
- export const pkgVersion = "0.59.3003";
9
+ export const pkgVersion = "0.59.4000";
@@ -50,7 +50,7 @@ export async function prefetchLatestSnapshot(
50
50
  forceAccessTokenViaAuthorizationHeader: boolean,
51
51
  logger: ITelemetryBaseLogger,
52
52
  hostSnapshotFetchOptions: ISnapshotOptions | undefined,
53
- enableRedeemFallback?: boolean,
53
+ enableRedeemFallback: boolean = true,
54
54
  fetchBinarySnapshotFormat?: boolean,
55
55
  snapshotFormatFetchType?: SnapshotFormatSupportType,
56
56
  ): Promise<boolean> {
@@ -107,7 +107,7 @@ export const codeToBytesMap = {
107
107
 
108
108
  export function getValueSafely(map: { [index: number]: number; }, key: number) {
109
109
  const val = map[key];
110
- assert(val !== undefined, 0x287 /* `key= ${key} must exist in the map` */);
110
+ assert(val !== undefined, 0x287 /* key must exist in the map */);
111
111
  return val;
112
112
  }
113
113
 
@@ -123,7 +123,7 @@ export function getAndValidateNodeProps(node: NodeCore, props: string[], enforce
123
123
  }
124
124
  }
125
125
  if (enforceAllProps) {
126
- assert(propSet.size === 0, 0x288 /* `All properties should exist, Not found: ${[...propSet.keys()]}` */);
126
+ assert(propSet.size === 0, 0x288 /* All properties should exist */);
127
127
  }
128
128
  return res;
129
129
  }