@salesforce/lds-worker-api 1.328.0 → 1.329.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1106,4 +1106,4 @@ if (process.env.NODE_ENV !== 'production') {
1106
1106
  }
1107
1107
 
1108
1108
  export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
1109
- // version: 1.328.0-f3d79bc783
1109
+ // version: 1.329.0-9b52e8059d
@@ -4265,7 +4265,7 @@ function withDefaultLuvio(callback) {
4265
4265
  }
4266
4266
  callbacks.push(callback);
4267
4267
  }
4268
- // version: 1.328.0-f3d79bc783
4268
+ // version: 1.329.0-9b52e8059d
4269
4269
 
4270
4270
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
4271
4271
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -5213,7 +5213,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
5213
5213
  const { apiFamily, name } = metadata;
5214
5214
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
5215
5215
  }
5216
- // version: 1.328.0-f3d79bc783
5216
+ // version: 1.329.0-9b52e8059d
5217
5217
 
5218
5218
  /**
5219
5219
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -9557,13 +9557,12 @@ function mergePendingFields$1(newRecord, oldRecord, existingNode) {
9557
9557
  }
9558
9558
  }
9559
9559
  }
9560
- else {
9561
- const state = fieldValueRep.linkData();
9562
- if (state !== undefined) {
9563
- const { fields } = state;
9564
- if (includes$3.call(fields, 'ExternalId')) {
9565
- continue;
9566
- }
9560
+ // If the fields requested off of this spanning record are external fields, skip them to avoid creating request that exceed the SOQL limits on external data. https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_limits.htm
9561
+ const state = fieldValueRep.linkData();
9562
+ if (state !== undefined) {
9563
+ const { fields } = state;
9564
+ if (includes$3.call(fields, 'ExternalId')) {
9565
+ continue;
9567
9566
  }
9568
9567
  }
9569
9568
  }
@@ -33851,7 +33850,7 @@ withDefaultLuvio((luvio) => {
33851
33850
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
33852
33851
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
33853
33852
  });
33854
- // version: 1.328.0-e51e28f7fc
33853
+ // version: 1.329.0-beac2bb064
33855
33854
 
33856
33855
  /**
33857
33856
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -80255,24 +80254,37 @@ function isCreateContentDocumentAndVersionDraftAdapterEvent(customEvent) {
80255
80254
  // so eslint doesn't complain about nimbus
80256
80255
  /* global __nimbus */
80257
80256
  function chunkToBase64(chunk) {
80258
- let binary = '';
80259
- const chunkSize = 32 * 1024;
80260
- for (let i = 0; i < chunk.length; i += chunkSize) {
80261
- binary += String.fromCharCode.apply(null, chunk.subarray(i, i + chunkSize));
80262
- }
80257
+ const bytes = new Uint8Array(chunk);
80258
+ const binary = String.fromCharCode.apply(null, bytes);
80263
80259
  return btoa(binary);
80264
80260
  }
80265
- async function streamBufferToBinaryStore(binaryStore, buffer, mimeType) {
80261
+ async function streamBufferToBinaryStore(binaryStore, file, mimeType) {
80266
80262
  const uri = await binaryStore.createStream(mimeType);
80267
- const bufferSize = 64 * 1024; // 64k buffer size
80268
- const uint8Array = new Uint8Array(buffer);
80269
- for (let offset = 0; offset < uint8Array.length; offset += bufferSize) {
80270
- const chunk = uint8Array.subarray(offset, Math.min(offset + bufferSize, uint8Array.length));
80271
- const base64Chunk = chunkToBase64(chunk);
80272
- await binaryStore.writeToStream(uri, base64Chunk);
80263
+ const CHUNK_SIZE = 64 * 1024; // 64KB
80264
+ const fileSize = file.size;
80265
+ let offset = 0;
80266
+ try {
80267
+ while (offset < fileSize) {
80268
+ const end = Math.min(offset + CHUNK_SIZE, fileSize);
80269
+ const chunk = file.slice(offset, end);
80270
+ const arrayBuffer = await chunk.arrayBuffer();
80271
+ const base64Chunk = chunkToBase64(arrayBuffer);
80272
+ await binaryStore.writeToStream(uri, base64Chunk);
80273
+ offset = end;
80274
+ }
80275
+ await binaryStore.closeStream(uri);
80276
+ return uri;
80273
80277
  }
80274
- await binaryStore.closeStream(uri);
80275
- return uri;
80278
+ catch (error) {
80279
+ await binaryStore.closeStream(uri);
80280
+ throw error;
80281
+ }
80282
+ }
80283
+ function isFileLike(object) {
80284
+ return (object &&
80285
+ typeof object === 'object' &&
80286
+ typeof object.size === 'number' &&
80287
+ typeof object.slice === 'function');
80276
80288
  }
80277
80289
  function createContentDocumentAndVersionDraftAdapterFactory(luvio, binaryStore, actionHandler, durableRecordStore) {
80278
80290
  return async function createContentDocumentAndVersionDraftAdapter(config, buildResourceRequest, requestContext) {
@@ -80287,15 +80299,17 @@ function createContentDocumentAndVersionDraftAdapterFactory(luvio, binaryStore,
80287
80299
  if (!isFileReference(config.fileData)) {
80288
80300
  const { fileData } = config;
80289
80301
  const { name, size, type } = fileData;
80290
- const buffer = await fileData.arrayBuffer();
80291
- var uri;
80292
- // see if new chunking-api exists, if it doesnt fall back to memory-intensive mobile api
80302
+ let uri = ''; // Initialize uri with an empty string
80303
+ // Check if chunking API exists, fallback if it doesn't
80293
80304
  if (!__nimbus.plugins.LdsBinaryStorePlugin.createStream) {
80305
+ const buffer = await fileData.arrayBuffer();
80294
80306
  uri = await binaryStore.store(new Uint8Array(buffer), type, size);
80295
80307
  }
80296
- else {
80297
- uri = await streamBufferToBinaryStore(binaryStore, buffer, type);
80308
+ else if (isFileLike(fileData)) {
80309
+ // Only pass to streamBufferToBinaryStore if it's FileLike
80310
+ uri = await streamBufferToBinaryStore(binaryStore, fileData, type);
80298
80311
  }
80312
+ else ;
80299
80313
  config.fileData = {
80300
80314
  isFileReference: true,
80301
80315
  handle: uri,
@@ -92665,7 +92679,7 @@ register$1({
92665
92679
  id: '@salesforce/lds-network-adapter',
92666
92680
  instrument: instrument$2,
92667
92681
  });
92668
- // version: 1.328.0-f3d79bc783
92682
+ // version: 1.329.0-9b52e8059d
92669
92683
 
92670
92684
  const { create: create$2, keys: keys$2 } = Object;
92671
92685
  const { stringify, parse } = JSON;
@@ -115232,7 +115246,7 @@ register$1({
115232
115246
  configuration: { ...configurationForGraphQLAdapters$1 },
115233
115247
  instrument: instrument$1,
115234
115248
  });
115235
- // version: 1.328.0-e51e28f7fc
115249
+ // version: 1.329.0-beac2bb064
115236
115250
 
115237
115251
  // On core the unstable adapters are re-exported with different names,
115238
115252
  // we want to match them here.
@@ -115384,7 +115398,7 @@ withDefaultLuvio((luvio) => {
115384
115398
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
115385
115399
  graphQLImperative = ldsAdapter;
115386
115400
  });
115387
- // version: 1.328.0-e51e28f7fc
115401
+ // version: 1.329.0-beac2bb064
115388
115402
 
115389
115403
  var gqlApi = /*#__PURE__*/Object.freeze({
115390
115404
  __proto__: null,
@@ -116154,7 +116168,7 @@ const callbacks$1 = [];
116154
116168
  function register(r) {
116155
116169
  callbacks$1.forEach((callback) => callback(r));
116156
116170
  }
116157
- // version: 1.328.0-f3d79bc783
116171
+ // version: 1.329.0-9b52e8059d
116158
116172
 
116159
116173
  /**
116160
116174
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -117217,4 +117231,4 @@ const { luvio } = getRuntime();
117217
117231
  setDefaultLuvio({ luvio });
117218
117232
 
117219
117233
  export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
117220
- // version: 1.328.0-f3d79bc783
117234
+ // version: 1.329.0-9b52e8059d
@@ -4271,7 +4271,7 @@
4271
4271
  }
4272
4272
  callbacks.push(callback);
4273
4273
  }
4274
- // version: 1.328.0-f3d79bc783
4274
+ // version: 1.329.0-9b52e8059d
4275
4275
 
4276
4276
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
4277
4277
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -5219,7 +5219,7 @@
5219
5219
  const { apiFamily, name } = metadata;
5220
5220
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
5221
5221
  }
5222
- // version: 1.328.0-f3d79bc783
5222
+ // version: 1.329.0-9b52e8059d
5223
5223
 
5224
5224
  /**
5225
5225
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -9563,13 +9563,12 @@
9563
9563
  }
9564
9564
  }
9565
9565
  }
9566
- else {
9567
- const state = fieldValueRep.linkData();
9568
- if (state !== undefined) {
9569
- const { fields } = state;
9570
- if (includes$3.call(fields, 'ExternalId')) {
9571
- continue;
9572
- }
9566
+ // If the fields requested off of this spanning record are external fields, skip them to avoid creating request that exceed the SOQL limits on external data. https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_limits.htm
9567
+ const state = fieldValueRep.linkData();
9568
+ if (state !== undefined) {
9569
+ const { fields } = state;
9570
+ if (includes$3.call(fields, 'ExternalId')) {
9571
+ continue;
9573
9572
  }
9574
9573
  }
9575
9574
  }
@@ -33857,7 +33856,7 @@
33857
33856
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
33858
33857
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
33859
33858
  });
33860
- // version: 1.328.0-e51e28f7fc
33859
+ // version: 1.329.0-beac2bb064
33861
33860
 
33862
33861
  /**
33863
33862
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -80261,24 +80260,37 @@
80261
80260
  // so eslint doesn't complain about nimbus
80262
80261
  /* global __nimbus */
80263
80262
  function chunkToBase64(chunk) {
80264
- let binary = '';
80265
- const chunkSize = 32 * 1024;
80266
- for (let i = 0; i < chunk.length; i += chunkSize) {
80267
- binary += String.fromCharCode.apply(null, chunk.subarray(i, i + chunkSize));
80268
- }
80263
+ const bytes = new Uint8Array(chunk);
80264
+ const binary = String.fromCharCode.apply(null, bytes);
80269
80265
  return btoa(binary);
80270
80266
  }
80271
- async function streamBufferToBinaryStore(binaryStore, buffer, mimeType) {
80267
+ async function streamBufferToBinaryStore(binaryStore, file, mimeType) {
80272
80268
  const uri = await binaryStore.createStream(mimeType);
80273
- const bufferSize = 64 * 1024; // 64k buffer size
80274
- const uint8Array = new Uint8Array(buffer);
80275
- for (let offset = 0; offset < uint8Array.length; offset += bufferSize) {
80276
- const chunk = uint8Array.subarray(offset, Math.min(offset + bufferSize, uint8Array.length));
80277
- const base64Chunk = chunkToBase64(chunk);
80278
- await binaryStore.writeToStream(uri, base64Chunk);
80269
+ const CHUNK_SIZE = 64 * 1024; // 64KB
80270
+ const fileSize = file.size;
80271
+ let offset = 0;
80272
+ try {
80273
+ while (offset < fileSize) {
80274
+ const end = Math.min(offset + CHUNK_SIZE, fileSize);
80275
+ const chunk = file.slice(offset, end);
80276
+ const arrayBuffer = await chunk.arrayBuffer();
80277
+ const base64Chunk = chunkToBase64(arrayBuffer);
80278
+ await binaryStore.writeToStream(uri, base64Chunk);
80279
+ offset = end;
80280
+ }
80281
+ await binaryStore.closeStream(uri);
80282
+ return uri;
80279
80283
  }
80280
- await binaryStore.closeStream(uri);
80281
- return uri;
80284
+ catch (error) {
80285
+ await binaryStore.closeStream(uri);
80286
+ throw error;
80287
+ }
80288
+ }
80289
+ function isFileLike(object) {
80290
+ return (object &&
80291
+ typeof object === 'object' &&
80292
+ typeof object.size === 'number' &&
80293
+ typeof object.slice === 'function');
80282
80294
  }
80283
80295
  function createContentDocumentAndVersionDraftAdapterFactory(luvio, binaryStore, actionHandler, durableRecordStore) {
80284
80296
  return async function createContentDocumentAndVersionDraftAdapter(config, buildResourceRequest, requestContext) {
@@ -80293,15 +80305,17 @@
80293
80305
  if (!isFileReference(config.fileData)) {
80294
80306
  const { fileData } = config;
80295
80307
  const { name, size, type } = fileData;
80296
- const buffer = await fileData.arrayBuffer();
80297
- var uri;
80298
- // see if new chunking-api exists, if it doesnt fall back to memory-intensive mobile api
80308
+ let uri = ''; // Initialize uri with an empty string
80309
+ // Check if chunking API exists, fallback if it doesn't
80299
80310
  if (!__nimbus.plugins.LdsBinaryStorePlugin.createStream) {
80311
+ const buffer = await fileData.arrayBuffer();
80300
80312
  uri = await binaryStore.store(new Uint8Array(buffer), type, size);
80301
80313
  }
80302
- else {
80303
- uri = await streamBufferToBinaryStore(binaryStore, buffer, type);
80314
+ else if (isFileLike(fileData)) {
80315
+ // Only pass to streamBufferToBinaryStore if it's FileLike
80316
+ uri = await streamBufferToBinaryStore(binaryStore, fileData, type);
80304
80317
  }
80318
+ else ;
80305
80319
  config.fileData = {
80306
80320
  isFileReference: true,
80307
80321
  handle: uri,
@@ -92671,7 +92685,7 @@
92671
92685
  id: '@salesforce/lds-network-adapter',
92672
92686
  instrument: instrument$2,
92673
92687
  });
92674
- // version: 1.328.0-f3d79bc783
92688
+ // version: 1.329.0-9b52e8059d
92675
92689
 
92676
92690
  const { create: create$2, keys: keys$2 } = Object;
92677
92691
  const { stringify, parse } = JSON;
@@ -115238,7 +115252,7 @@
115238
115252
  configuration: { ...configurationForGraphQLAdapters$1 },
115239
115253
  instrument: instrument$1,
115240
115254
  });
115241
- // version: 1.328.0-e51e28f7fc
115255
+ // version: 1.329.0-beac2bb064
115242
115256
 
115243
115257
  // On core the unstable adapters are re-exported with different names,
115244
115258
  // we want to match them here.
@@ -115390,7 +115404,7 @@
115390
115404
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
115391
115405
  graphQLImperative = ldsAdapter;
115392
115406
  });
115393
- // version: 1.328.0-e51e28f7fc
115407
+ // version: 1.329.0-beac2bb064
115394
115408
 
115395
115409
  var gqlApi = /*#__PURE__*/Object.freeze({
115396
115410
  __proto__: null,
@@ -116160,7 +116174,7 @@
116160
116174
  function register(r) {
116161
116175
  callbacks$1.forEach((callback) => callback(r));
116162
116176
  }
116163
- // version: 1.328.0-f3d79bc783
116177
+ // version: 1.329.0-9b52e8059d
116164
116178
 
116165
116179
  /**
116166
116180
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -117242,4 +117256,4 @@
117242
117256
  exports.subscribeToAdapter = subscribeToAdapter;
117243
117257
 
117244
117258
  }));
117245
- // version: 1.328.0-f3d79bc783
117259
+ // version: 1.329.0-9b52e8059d
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-worker-api",
3
- "version": "1.328.0",
3
+ "version": "1.329.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "",
6
6
  "main": "dist/standalone/es/lds-worker-api.js",
@@ -35,14 +35,14 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@oat-sa/rollup-plugin-wildcard-external": "^1.0.0",
38
- "@salesforce/lds-adapters-graphql": "^1.328.0",
39
- "@salesforce/lds-adapters-uiapi": "^1.328.0",
40
- "@salesforce/lds-default-luvio": "^1.328.0",
41
- "@salesforce/lds-drafts": "^1.328.0",
42
- "@salesforce/lds-graphql-parser": "^1.328.0",
43
- "@salesforce/lds-luvio-engine": "^1.328.0",
44
- "@salesforce/lds-runtime-mobile": "^1.328.0",
45
- "@salesforce/nimbus-plugin-lds": "^1.328.0",
38
+ "@salesforce/lds-adapters-graphql": "^1.329.0",
39
+ "@salesforce/lds-adapters-uiapi": "^1.329.0",
40
+ "@salesforce/lds-default-luvio": "^1.329.0",
41
+ "@salesforce/lds-drafts": "^1.329.0",
42
+ "@salesforce/lds-graphql-parser": "^1.329.0",
43
+ "@salesforce/lds-luvio-engine": "^1.329.0",
44
+ "@salesforce/lds-runtime-mobile": "^1.329.0",
45
+ "@salesforce/nimbus-plugin-lds": "^1.329.0",
46
46
  "ajv": "^8.11.0",
47
47
  "glob": "^7.1.5",
48
48
  "nimbus-types": "^2.0.0-alpha1",