@salesforce/lds-network-aura 1.451.0-dev10 → 1.451.0-dev11

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 (2) hide show
  1. package/dist/ldsNetwork.js +39 -5
  2. package/package.json +6 -6
@@ -15,6 +15,7 @@
15
15
  import { HttpStatusCode, isFormData } from 'force/luvioEngine';
16
16
  import { executeGlobalControllerRawResponse } from 'aura';
17
17
  import { registerCacheStats } from 'instrumentation/service';
18
+ import editDataGraphByNameGate from '@salesforce/gate/lds.dataGraph.putByName';
18
19
  import { createStorage } from 'force/ldsDurableStorage';
19
20
  import { getEnvironmentSetting, EnvironmentSettings } from 'force/ldsEnvironmentSettings';
20
21
 
@@ -455,12 +456,19 @@ function executeSoqlQueryPost(resourceRequest, resourceRequestContext) {
455
456
  }
456
457
  router.post((path) => path.startsWith(`${WAVE_BASE_URI}/soql`), executeSoqlQueryPost);
457
458
 
459
+ // Gate lds.dataGraph.putByName: closed => legacy params (no urlParams merge, no body.name
460
+ // fallback), so the editDataGraphByName rollout can be reverted. Fail-closed.
461
+ function isEditDataGraphByNameEnabled() {
462
+ return editDataGraphByNameGate.isOpen({ fallback: false });
463
+ }
458
464
  function buildDataGraphAction(actionName, bodyWrapper = 'input') {
459
465
  return (resourceRequest, resourceRequestContext) => {
460
466
  const { body } = resourceRequest;
461
- let buildParameters = {};
467
+ const buildParameters = isEditDataGraphByNameEnabled()
468
+ ? { ...resourceRequest.urlParams }
469
+ : {};
462
470
  if (resourceRequest.method === 'put' && resourceRequest.queryParams) {
463
- buildParameters = resourceRequest.queryParams;
471
+ Object.assign(buildParameters, resourceRequest.queryParams);
464
472
  }
465
473
  buildParameters[bodyWrapper] = body;
466
474
  const params = buildUiApiParams(buildParameters, resourceRequest);
@@ -468,10 +476,36 @@ function buildDataGraphAction(actionName, bodyWrapper = 'input') {
468
476
  return dispatchAction(actionName, params, enrichedConfig);
469
477
  };
470
478
  }
479
+ function getBodyName(body) {
480
+ if (typeof body === 'object' && body !== null && 'name' in body) {
481
+ const { name } = body;
482
+ return typeof name === 'string' ? name : undefined;
483
+ }
484
+ return undefined;
485
+ }
486
+ // CdpDataGraphController.editDataGraph requires dataGraphName. The collection path
487
+ // (PUT /data-graphs) has no URL param, so fall back to the body name.
488
+ function withDataGraphNameFromBody(handler) {
489
+ return (resourceRequest, resourceRequestContext) => {
490
+ const bodyName = getBodyName(resourceRequest.body);
491
+ if (isEditDataGraphByNameEnabled() &&
492
+ resourceRequest.urlParams?.dataGraphName === undefined &&
493
+ bodyName !== undefined) {
494
+ return handler({
495
+ ...resourceRequest,
496
+ urlParams: { ...resourceRequest.urlParams, dataGraphName: bodyName },
497
+ }, resourceRequestContext);
498
+ }
499
+ return handler(resourceRequest, resourceRequestContext);
500
+ };
501
+ }
471
502
  router.post((path) => path.startsWith(`${CDP_BASE_URI}/data-graphs/draft`), buildDataGraphAction('CdpDataGraphController.saveDataGraphDraft'));
472
503
  router.post((path) => path.startsWith(`${CDP_BASE_URI}/data-graphs`), buildDataGraphAction('CdpDataGraphController.createDataGraph'));
473
- router.put((path) => path.startsWith(`${CDP_BASE_URI}/data-graphs/retry`), buildDataGraphAction('CdpDataGraphController.retryDataGraph'));
474
- router.put((path) => path.startsWith(`${CDP_BASE_URI}/data-graphs`), buildDataGraphAction('CdpDataGraphController.editDataGraph'));
504
+ router.put((path) => path === `${CDP_BASE_URI}/data-graphs/retry`, buildDataGraphAction('CdpDataGraphController.retryDataGraph'));
505
+ // PUT /data-graphs: the name is only in the body
506
+ router.put((path) => path === `${CDP_BASE_URI}/data-graphs`, withDataGraphNameFromBody(buildDataGraphAction('CdpDataGraphController.editDataGraph')));
507
+ // PUT /data-graphs/{dataGraphName}: the name comes from urlParams
508
+ router.put((path) => path.startsWith(`${CDP_BASE_URI}/data-graphs/`), buildDataGraphAction('CdpDataGraphController.editDataGraph'));
475
509
 
476
510
  const LWR_APEX_BASE_URI = '/lwr/apex/v68.0';
477
511
  const ApexController = 'ApexActionController.execute';
@@ -5863,4 +5897,4 @@ function auraNetworkAdapter(resourceRequest, resourceRequestContext) {
5863
5897
  var main = platformNetworkAdapter(auraNetworkAdapter);
5864
5898
 
5865
5899
  export { CrudEventState, CrudEventType, UIAPI_GET_LAYOUT, UIAPI_GET_LAYOUT_USER_STATE, UIAPI_OBJECT_INFO_BATCH_PATH, UIAPI_OBJECT_INFO_PATH, UIAPI_RECORDS_PATH$1 as UIAPI_RECORDS_PATH, UIAPI_RELATED_LIST_RECORDS_BATCH_PATH, UIAPI_RELATED_LIST_RECORDS_PATH, createOkResponse$1 as createOkResponse, main as default, defaultActionConfig, dispatchAction as dispatchAuraAction, forceRecordTransactionsDisabled, getTransactionKey, instrument$1 as instrument, layoutStorage, layoutStorageStatsLogger, layoutUserStateStorage, layoutUserStateStorageStatsLogger, instrument as ldsNetworkAdapterInstrument, objectInfoStorage, objectInfoStorageStatsLogger, registerSubRequestNetworkAdapter, shouldForceRefresh };
5866
- // version: 1.451.0-dev10-f221dcc990
5900
+ // version: 1.451.0-dev11-1d572b7573
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-network-aura",
3
- "version": "1.451.0-dev10",
3
+ "version": "1.451.0-dev11",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS Network Adapter for Aura Runtime",
6
6
  "main": "dist/ldsNetwork.js",
@@ -37,11 +37,11 @@
37
37
  "@luvio/engine": "0.161.2"
38
38
  },
39
39
  "devDependencies": {
40
- "@salesforce/lds-adapters-uiapi": "^1.451.0-dev10",
41
- "@salesforce/lds-durable-storage": "^1.451.0-dev10",
42
- "@salesforce/lds-environment-settings": "^1.451.0-dev10",
43
- "@salesforce/lds-instrumentation": "^1.451.0-dev10",
44
- "@salesforce/lds-network-adapter": "^1.451.0-dev10"
40
+ "@salesforce/lds-adapters-uiapi": "^1.451.0-dev11",
41
+ "@salesforce/lds-durable-storage": "^1.451.0-dev11",
42
+ "@salesforce/lds-environment-settings": "^1.451.0-dev11",
43
+ "@salesforce/lds-instrumentation": "^1.451.0-dev11",
44
+ "@salesforce/lds-network-adapter": "^1.451.0-dev11"
45
45
  },
46
46
  "volta": {
47
47
  "extends": "../../package.json"