@salesforce/lds-adapters-apex 1.282.0 → 1.284.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.
@@ -106,7 +106,6 @@ function createLink(ref) {
106
106
  }
107
107
 
108
108
  const CACHE_CONTROL = 'cache-control';
109
- const SHARED_ADAPTER_CONTEXT_ID = 'apex__shared';
110
109
  // eslint-disable-next-line @salesforce/lds/no-invalid-todo
111
110
  // TODO: APEX_TTL, apexResponseEquals, apexResponseIngest, and validateAdapterConfig should have been code generated
112
111
  // however compiler does not support response body type any so hand roll for now
@@ -205,32 +204,6 @@ function shouldCache(response) {
205
204
  const headerValue = getCacheControlHeaderValue(headers);
206
205
  return isCacheControlValueCacheable(headerValue);
207
206
  }
208
- function getCacheableKey(recordId) {
209
- return `${recordId}_cacheable`;
210
- }
211
- function set(context, recordId, value) {
212
- const key = getCacheableKey(recordId);
213
- context.set(key, value);
214
- }
215
- function get(context, key) {
216
- return context.get(getCacheableKey(key));
217
- }
218
- function setCacheControlAdapterContext(context, recordId, response) {
219
- const { headers } = response;
220
- const headerValue = getCacheControlHeaderValue(headers);
221
- if (headerValue !== undefined) {
222
- set(context, recordId, headerValue);
223
- }
224
- }
225
- function isCacheable(config, context) {
226
- const { apexClass, apexMethod, xSFDCAllowContinuation, methodParams } = config;
227
- const recordId = keyBuilder(apexClass, apexMethod, xSFDCAllowContinuation, methodParams);
228
- return checkAdapterContext(context, recordId);
229
- }
230
- function checkAdapterContext(context, recordId) {
231
- const contextValue = get(context, recordId);
232
- return isCacheControlValueCacheable(contextValue);
233
- }
234
207
 
235
208
  function createResourceParams$1(config) {
236
209
  const queryParams = create(null);
@@ -280,7 +253,7 @@ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
280
253
  return snapshot;
281
254
  }
282
255
  function buildCachedSnapshotCachePolicy$1(buildSnapshotContext, storeLookup) {
283
- const { luvio, config, adapterContext } = buildSnapshotContext;
256
+ const { luvio, config } = buildSnapshotContext;
284
257
  const { apexClass, apexMethod, xSFDCAllowContinuation, methodParams } = config;
285
258
  const recordId = keyBuilder(apexClass, apexMethod, xSFDCAllowContinuation, methodParams);
286
259
  return storeLookup({
@@ -294,21 +267,20 @@ function buildCachedSnapshotCachePolicy$1(buildSnapshotContext, storeLookup) {
294
267
  variables: {},
295
268
  }, {
296
269
  config,
297
- resolve: () => buildNetworkSnapshot$1(luvio, adapterContext, config, snapshotRefreshOptions),
270
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions),
298
271
  });
299
272
  }
300
- function onFetchResponseSuccess$1(luvio, context, config, resourceParams, response) {
273
+ function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
301
274
  const recordId = keyBuilderFromResourceParams$1(resourceParams);
302
275
  const select = {
303
276
  recordId,
304
277
  node: { kind: 'Fragment', opaque: true, private: [], version: APEX_VERSION },
305
278
  variables: {},
306
279
  };
307
- setCacheControlAdapterContext(context, recordId, response);
308
280
  if (shouldCache(response)) {
309
281
  const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
310
282
  config,
311
- resolve: () => buildNetworkSnapshot$1(luvio, context, config, snapshotRefreshOptions),
283
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions),
312
284
  });
313
285
  return luvio.storeBroadcast().then(() => snapshot);
314
286
  }
@@ -322,27 +294,27 @@ function onFetchResponseSuccess$1(luvio, context, config, resourceParams, respon
322
294
  data: response.body,
323
295
  });
324
296
  }
325
- function onFetchResponseError$1(luvio, context, config, _resourceParams, response) {
297
+ function onFetchResponseError$1(luvio, config, _resourceParams, response) {
326
298
  return Promise.resolve(luvio.errorSnapshot(response, {
327
299
  config,
328
- resolve: () => buildNetworkSnapshot$1(luvio, context, config, snapshotRefreshOptions),
300
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions),
329
301
  }));
330
302
  }
331
- function buildNetworkSnapshot$1(luvio, context, config, options) {
303
+ function buildNetworkSnapshot$1(luvio, config, options) {
332
304
  const resourceParams = createResourceParams$1(config);
333
305
  const request = createResourceRequest$1(resourceParams);
334
306
  return luvio.dispatchResourceRequest(request, options).then((response) => {
335
- return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, context, config, resourceParams, response),
307
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response),
336
308
  // TODO [W-10490362]: Properly generate the response cache keys
337
309
  () => {
338
310
  return new StoreKeyMap();
339
311
  });
340
312
  }, (response) => {
341
- return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, context, config, resourceParams, response));
313
+ return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
342
314
  });
343
315
  }
344
316
  function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
345
- const { luvio, config, adapterContext } = context;
317
+ const { luvio, config } = context;
346
318
  const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
347
319
  const dispatchOptions = {
348
320
  resourceRequestContext: {
@@ -356,14 +328,14 @@ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext
356
328
  priority: networkPriority,
357
329
  };
358
330
  }
359
- return buildNetworkSnapshot$1(luvio, adapterContext, config, dispatchOptions);
331
+ return buildNetworkSnapshot$1(luvio, config, dispatchOptions);
360
332
  }
361
333
  const factory = (luvio, invokerParams) => {
362
334
  const { namespace, classname, method, isContinuation } = invokerParams;
363
335
  return getApexAdapterFactory(luvio, namespace, classname, method, isContinuation);
364
336
  };
365
337
  function getApexAdapterFactory(luvio, namespace, classname, method, isContinuation) {
366
- return luvio.withContext(function apex__getApex(untrustedConfig, context, requestContext) {
338
+ return (untrustedConfig, requestContext) => {
367
339
  // Even though the config is of type `any`,
368
340
  // validation is required here because `undefined`
369
341
  // values on a wire mean that properties on the component
@@ -374,8 +346,8 @@ function getApexAdapterFactory(luvio, namespace, classname, method, isContinuati
374
346
  return null;
375
347
  }
376
348
  const configPlus = configBuilder(config, apexClassnameBuilder(namespace, classname), method, isContinuation);
377
- return luvio.applyCachePolicy(requestContext || {}, { config: configPlus, luvio, adapterContext: context }, buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
378
- }, { contextId: SHARED_ADAPTER_CONTEXT_ID });
349
+ return luvio.applyCachePolicy(requestContext || {}, { config: configPlus, luvio }, buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
350
+ };
379
351
  }
380
352
 
381
353
  /**
@@ -539,14 +511,13 @@ function buildCachedSnapshotCachePolicy(buildSnapshotContext, storeLookup) {
539
511
  variables: {},
540
512
  });
541
513
  }
542
- function onFetchResponseSuccess(luvio, context, _config, resourceParams, response) {
514
+ function onFetchResponseSuccess(luvio, _config, resourceParams, response) {
543
515
  const recordId = keyBuilderFromResourceParams(resourceParams);
544
516
  const select = {
545
517
  recordId,
546
518
  node: { kind: 'Fragment', opaque: true, private: [], version: APEX_VERSION },
547
519
  variables: {},
548
520
  };
549
- setCacheControlAdapterContext(context, recordId, response);
550
521
  if (shouldCache(response)) {
551
522
  const snapshot = ingestSuccess(luvio, resourceParams, response);
552
523
  return luvio.storeBroadcast().then(() => snapshot);
@@ -561,24 +532,24 @@ function onFetchResponseSuccess(luvio, context, _config, resourceParams, respons
561
532
  data: response.body,
562
533
  });
563
534
  }
564
- function onFetchResponseError(luvio, _context, _config, _resourceParams, response) {
535
+ function onFetchResponseError(luvio, _config, _resourceParams, response) {
565
536
  return Promise.resolve(luvio.errorSnapshot(response));
566
537
  }
567
- function buildNetworkSnapshot(luvio, context, config, options) {
538
+ function buildNetworkSnapshot(luvio, config, options) {
568
539
  const resourceParams = createResourceParams(config);
569
540
  const request = createResourceRequest(resourceParams);
570
541
  return luvio.dispatchResourceRequest(request, options).then((response) => {
571
- return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, context, config, resourceParams, response),
542
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response),
572
543
  // TODO [W-10490362]: Properly generate response cache keys
573
544
  () => {
574
545
  return new StoreKeyMap();
575
546
  });
576
547
  }, (response) => {
577
- return luvio.handleErrorResponse(() => onFetchResponseError(luvio, context, config, resourceParams, response));
548
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
578
549
  });
579
550
  }
580
551
  function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
581
- const { luvio, config, adapterContext } = context;
552
+ const { luvio, config } = context;
582
553
  const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
583
554
  const dispatchOptions = {
584
555
  resourceRequestContext: {
@@ -592,7 +563,7 @@ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext)
592
563
  priority: networkPriority,
593
564
  };
594
565
  }
595
- return buildNetworkSnapshot(luvio, adapterContext, config, dispatchOptions);
566
+ return buildNetworkSnapshot(luvio, config, dispatchOptions);
596
567
  }
597
568
  function handleSnapshot(snapshot) {
598
569
  if (snapshot.state === 'Error') {
@@ -625,20 +596,14 @@ const getInvoker = (luvio, invokerParams) => {
625
596
  return invokerFactory(luvio, invokerParams, getApexAdapterFactory);
626
597
  };
627
598
  function postApexAdapterFactory(luvio, namespace, classname, method, isContinuation) {
628
- return luvio.withContext(function apex__postApex(config, context, requestContext) {
599
+ return (config, requestContext) => {
629
600
  // config validation is unnecessary for this imperative adapter
630
601
  // due to the config being of type `any`.
631
602
  // however, we have special config validation for the wire adapter,
632
603
  // explanation in getApex
633
604
  const configPlus = configBuilder(config, apexClassnameBuilder(namespace, classname), method, isContinuation);
634
- // if this response isn't meant to be cached then pass a buildCached
635
- // func that returns undefined, that way cache policy impls will know
636
- // not to do any cache lookups
637
- const buildCached = isCacheable(configPlus, context)
638
- ? buildCachedSnapshotCachePolicy
639
- : () => undefined;
640
- return luvio.applyCachePolicy(requestContext || {}, { config: configPlus, luvio, adapterContext: context }, buildCached, buildNetworkSnapshotCachePolicy);
641
- }, { contextId: SHARED_ADAPTER_CONTEXT_ID });
605
+ return luvio.applyCachePolicy(requestContext || {}, { config: configPlus, luvio }, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
606
+ };
642
607
  }
643
608
 
644
609
  /**
@@ -1,4 +1,4 @@
1
- import type { AdapterContext, Luvio, ResourceIngest, FetchResponse } from '@luvio/engine';
1
+ import type { Luvio, ResourceIngest, FetchResponse } from '@luvio/engine';
2
2
  interface ApexScopedModuleParams {
3
3
  namespace: string;
4
4
  classname: string;
@@ -16,7 +16,6 @@ export interface ApexAdapterConfig {
16
16
  export type BuildSnapshotContext = {
17
17
  luvio: Luvio;
18
18
  config: ApexAdapterConfig;
19
- adapterContext: AdapterContext;
20
19
  };
21
20
  export declare const CACHE_CONTROL = "cache-control";
22
21
  export declare const SHARED_ADAPTER_CONTEXT_ID = "apex__shared";
@@ -37,8 +36,4 @@ export declare function keyBuilder(classname: string, method: string, isContinua
37
36
  export declare function configBuilder(config: any, classname: string, method: string, isContinuation: boolean): ApexAdapterConfig;
38
37
  export declare function apexClassnameBuilder(namespace: string, classname: string): string;
39
38
  export declare function shouldCache(response: FetchResponse<any>): boolean;
40
- export declare function getCacheableKey(recordId: string): string;
41
- export declare function setCacheControlAdapterContext(context: AdapterContext, recordId: string, response: FetchResponse<any>): void;
42
- export declare function isCacheable(config: ApexAdapterConfig, context: AdapterContext): boolean;
43
- export declare function checkAdapterContext(context: AdapterContext, recordId: string): boolean;
44
39
  export {};
@@ -1,4 +1,4 @@
1
- import type { Adapter, AdapterContext, DispatchResourceRequestContext, ErrorResponse, FulfilledSnapshot, Luvio, FetchResponse, Snapshot, SnapshotRefresh, StaleSnapshot } from '@luvio/engine';
1
+ import type { Adapter, DispatchResourceRequestContext, ErrorResponse, FulfilledSnapshot, Luvio, FetchResponse, Snapshot, SnapshotRefresh, StaleSnapshot } from '@luvio/engine';
2
2
  import type { AdapterValidationConfig } from '../../generated/adapters/adapter-utils';
3
3
  import type { ResourceRequestConfig } from '../../generated/resources/getByApexMethodAndApexClass';
4
4
  import type { ApexAdapterConfig, ApexInvokerParams } from '../../util/shared';
@@ -7,8 +7,8 @@ export declare const getByApexMethodAndApexClass_ConfigPropertyNames: AdapterVal
7
7
  export declare function createResourceParams(config: ApexAdapterConfig): ResourceRequestConfig;
8
8
  export declare function keyBuilderFromResourceParams(params: ResourceRequestConfig): string;
9
9
  export declare function ingestSuccess(luvio: Luvio, resourceParams: ResourceRequestConfig, response: FetchResponse<any>, snapshotRefresh?: SnapshotRefresh<any>): FulfilledSnapshot<any, any> | StaleSnapshot<any, any>;
10
- export declare function onFetchResponseSuccess(luvio: Luvio, context: AdapterContext, config: ApexAdapterConfig, resourceParams: ResourceRequestConfig, response: FetchResponse<any>): Promise<FulfilledSnapshot<any, any> | StaleSnapshot<any, any>>;
11
- export declare function onFetchResponseError(luvio: Luvio, context: AdapterContext, config: ApexAdapterConfig, _resourceParams: ResourceRequestConfig, response: ErrorResponse): Promise<import("@luvio/engine").ErrorSnapshot>;
12
- export declare function buildNetworkSnapshot(luvio: Luvio, context: AdapterContext, config: ApexAdapterConfig, options?: DispatchResourceRequestContext): Promise<Snapshot<any>>;
10
+ export declare function onFetchResponseSuccess(luvio: Luvio, config: ApexAdapterConfig, resourceParams: ResourceRequestConfig, response: FetchResponse<any>): Promise<FulfilledSnapshot<any, any> | StaleSnapshot<any, any>>;
11
+ export declare function onFetchResponseError(luvio: Luvio, config: ApexAdapterConfig, _resourceParams: ResourceRequestConfig, response: ErrorResponse): Promise<import("@luvio/engine").ErrorSnapshot>;
12
+ export declare function buildNetworkSnapshot(luvio: Luvio, config: ApexAdapterConfig, options?: DispatchResourceRequestContext): Promise<Snapshot<any>>;
13
13
  export declare const factory: (luvio: Luvio, invokerParams: ApexInvokerParams) => Adapter<any, any>;
14
14
  export declare function getApexAdapterFactory(luvio: Luvio, namespace: string, classname: string, method: string, isContinuation: boolean): Adapter<any, any>;
@@ -1,12 +1,12 @@
1
- import type { Adapter, AdapterContext, AdapterRequestContext, DispatchResourceRequestContext, ErrorResponse, FulfilledSnapshot, Luvio, FetchResponse, Snapshot, SnapshotRefresh, StaleSnapshot } from '@luvio/engine';
1
+ import type { Adapter, AdapterRequestContext, DispatchResourceRequestContext, ErrorResponse, FulfilledSnapshot, Luvio, FetchResponse, Snapshot, SnapshotRefresh, StaleSnapshot } from '@luvio/engine';
2
2
  import type { ResourceRequestConfig } from '../../generated/resources/postByApexMethodAndApexClass';
3
3
  import type { ApexAdapterConfig, ApexInvokerParams } from '../../util/shared';
4
4
  export declare function createResourceParams(config: ApexAdapterConfig): ResourceRequestConfig;
5
5
  export declare function keyBuilderFromResourceParams(params: ResourceRequestConfig): string;
6
6
  export declare function ingestSuccess(luvio: Luvio, resourceParams: ResourceRequestConfig, response: FetchResponse<any>, snapshotRefresh?: SnapshotRefresh<any>): FulfilledSnapshot<any, any> | StaleSnapshot<any, any>;
7
- export declare function onFetchResponseSuccess(luvio: Luvio, context: AdapterContext, _config: ApexAdapterConfig, resourceParams: ResourceRequestConfig, response: FetchResponse<any>): Promise<FulfilledSnapshot<any, any> | StaleSnapshot<any, any>>;
8
- export declare function onFetchResponseError(luvio: Luvio, _context: AdapterContext, _config: ApexAdapterConfig, _resourceParams: ResourceRequestConfig, response: ErrorResponse): Promise<import("@luvio/engine").ErrorSnapshot>;
9
- export declare function buildNetworkSnapshot(luvio: Luvio, context: AdapterContext, config: ApexAdapterConfig, options?: DispatchResourceRequestContext): Promise<Snapshot<any>>;
7
+ export declare function onFetchResponseSuccess(luvio: Luvio, _config: ApexAdapterConfig, resourceParams: ResourceRequestConfig, response: FetchResponse<any>): Promise<FulfilledSnapshot<any, any> | StaleSnapshot<any, any>>;
8
+ export declare function onFetchResponseError(luvio: Luvio, _config: ApexAdapterConfig, _resourceParams: ResourceRequestConfig, response: ErrorResponse): Promise<import("@luvio/engine").ErrorSnapshot>;
9
+ export declare function buildNetworkSnapshot(luvio: Luvio, config: ApexAdapterConfig, options?: DispatchResourceRequestContext): Promise<Snapshot<any>>;
10
10
  type ApexInvoker = (config: unknown, requestContext: AdapterRequestContext) => Promise<any>;
11
11
  export type ApexAdapterFactory<Config, DataType> = (luvio: Luvio, namespace: string, classname: string, method: string, isContinuation: boolean) => Adapter<Config, DataType>;
12
12
  export declare const postInvoker: (luvio: Luvio, invokerParams: ApexInvokerParams) => ApexInvoker;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-adapters-apex",
3
- "version": "1.282.0",
3
+ "version": "1.284.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "Wire adapters for Apex",
6
6
  "main": "dist/es/es2018/apex-service.js",
@@ -30,12 +30,12 @@
30
30
  ]
31
31
  },
32
32
  "dependencies": {
33
- "@salesforce/lds-bindings": "^1.282.0",
34
- "@salesforce/lds-default-luvio": "^1.282.0"
33
+ "@salesforce/lds-bindings": "^1.284.0",
34
+ "@salesforce/lds-default-luvio": "^1.284.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@salesforce/lds-compiler-plugins": "^1.282.0",
38
- "@salesforce/lds-karma": "^1.282.0"
37
+ "@salesforce/lds-compiler-plugins": "^1.284.0",
38
+ "@salesforce/lds-karma": "^1.284.0"
39
39
  },
40
40
  "nx": {
41
41
  "targets": {
package/sfdc/index.js CHANGED
@@ -116,7 +116,6 @@ function createLink(ref) {
116
116
  }
117
117
 
118
118
  const CACHE_CONTROL = 'cache-control';
119
- const SHARED_ADAPTER_CONTEXT_ID = 'apex__shared';
120
119
  // eslint-disable-next-line @salesforce/lds/no-invalid-todo
121
120
  // TODO: APEX_TTL, apexResponseEquals, apexResponseIngest, and validateAdapterConfig should have been code generated
122
121
  // however compiler does not support response body type any so hand roll for now
@@ -215,32 +214,6 @@ function shouldCache(response) {
215
214
  const headerValue = getCacheControlHeaderValue(headers);
216
215
  return isCacheControlValueCacheable(headerValue);
217
216
  }
218
- function getCacheableKey(recordId) {
219
- return `${recordId}_cacheable`;
220
- }
221
- function set(context, recordId, value) {
222
- const key = getCacheableKey(recordId);
223
- context.set(key, value);
224
- }
225
- function get(context, key) {
226
- return context.get(getCacheableKey(key));
227
- }
228
- function setCacheControlAdapterContext(context, recordId, response) {
229
- const { headers } = response;
230
- const headerValue = getCacheControlHeaderValue(headers);
231
- if (headerValue !== undefined) {
232
- set(context, recordId, headerValue);
233
- }
234
- }
235
- function isCacheable(config, context) {
236
- const { apexClass, apexMethod, xSFDCAllowContinuation, methodParams } = config;
237
- const recordId = keyBuilder(apexClass, apexMethod, xSFDCAllowContinuation, methodParams);
238
- return checkAdapterContext(context, recordId);
239
- }
240
- function checkAdapterContext(context, recordId) {
241
- const contextValue = get(context, recordId);
242
- return isCacheControlValueCacheable(contextValue);
243
- }
244
217
 
245
218
  function createResourceParams$1(config) {
246
219
  const queryParams = create(null);
@@ -290,7 +263,7 @@ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
290
263
  return snapshot;
291
264
  }
292
265
  function buildCachedSnapshotCachePolicy$1(buildSnapshotContext, storeLookup) {
293
- const { luvio, config, adapterContext } = buildSnapshotContext;
266
+ const { luvio, config } = buildSnapshotContext;
294
267
  const { apexClass, apexMethod, xSFDCAllowContinuation, methodParams } = config;
295
268
  const recordId = keyBuilder(apexClass, apexMethod, xSFDCAllowContinuation, methodParams);
296
269
  return storeLookup({
@@ -304,21 +277,20 @@ function buildCachedSnapshotCachePolicy$1(buildSnapshotContext, storeLookup) {
304
277
  variables: {},
305
278
  }, {
306
279
  config,
307
- resolve: () => buildNetworkSnapshot$1(luvio, adapterContext, config, snapshotRefreshOptions),
280
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions),
308
281
  });
309
282
  }
310
- function onFetchResponseSuccess$1(luvio, context, config, resourceParams, response) {
283
+ function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
311
284
  const recordId = keyBuilderFromResourceParams$1(resourceParams);
312
285
  const select = {
313
286
  recordId,
314
287
  node: { kind: 'Fragment', opaque: true, private: [], version: APEX_VERSION },
315
288
  variables: {},
316
289
  };
317
- setCacheControlAdapterContext(context, recordId, response);
318
290
  if (shouldCache(response)) {
319
291
  const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
320
292
  config,
321
- resolve: () => buildNetworkSnapshot$1(luvio, context, config, snapshotRefreshOptions),
293
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions),
322
294
  });
323
295
  return luvio.storeBroadcast().then(() => snapshot);
324
296
  }
@@ -332,27 +304,27 @@ function onFetchResponseSuccess$1(luvio, context, config, resourceParams, respon
332
304
  data: response.body,
333
305
  });
334
306
  }
335
- function onFetchResponseError$1(luvio, context, config, _resourceParams, response) {
307
+ function onFetchResponseError$1(luvio, config, _resourceParams, response) {
336
308
  return Promise.resolve(luvio.errorSnapshot(response, {
337
309
  config,
338
- resolve: () => buildNetworkSnapshot$1(luvio, context, config, snapshotRefreshOptions),
310
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions),
339
311
  }));
340
312
  }
341
- function buildNetworkSnapshot$1(luvio, context, config, options) {
313
+ function buildNetworkSnapshot$1(luvio, config, options) {
342
314
  const resourceParams = createResourceParams$1(config);
343
315
  const request = createResourceRequest$1(resourceParams);
344
316
  return luvio.dispatchResourceRequest(request, options).then((response) => {
345
- return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, context, config, resourceParams, response),
317
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response),
346
318
  // TODO [W-10490362]: Properly generate the response cache keys
347
319
  () => {
348
320
  return new StoreKeyMap();
349
321
  });
350
322
  }, (response) => {
351
- return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, context, config, resourceParams, response));
323
+ return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
352
324
  });
353
325
  }
354
326
  function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
355
- const { luvio, config, adapterContext } = context;
327
+ const { luvio, config } = context;
356
328
  const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
357
329
  const dispatchOptions = {
358
330
  resourceRequestContext: {
@@ -366,14 +338,14 @@ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext
366
338
  priority: networkPriority,
367
339
  };
368
340
  }
369
- return buildNetworkSnapshot$1(luvio, adapterContext, config, dispatchOptions);
341
+ return buildNetworkSnapshot$1(luvio, config, dispatchOptions);
370
342
  }
371
343
  const factory = (luvio, invokerParams) => {
372
344
  const { namespace, classname, method, isContinuation } = invokerParams;
373
345
  return getApexAdapterFactory(luvio, namespace, classname, method, isContinuation);
374
346
  };
375
347
  function getApexAdapterFactory(luvio, namespace, classname, method, isContinuation) {
376
- return luvio.withContext(function apex__getApex(untrustedConfig, context, requestContext) {
348
+ return (untrustedConfig, requestContext) => {
377
349
  // Even though the config is of type `any`,
378
350
  // validation is required here because `undefined`
379
351
  // values on a wire mean that properties on the component
@@ -384,8 +356,8 @@ function getApexAdapterFactory(luvio, namespace, classname, method, isContinuati
384
356
  return null;
385
357
  }
386
358
  const configPlus = configBuilder(config, apexClassnameBuilder(namespace, classname), method, isContinuation);
387
- return luvio.applyCachePolicy(requestContext || {}, { config: configPlus, luvio, adapterContext: context }, buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
388
- }, { contextId: SHARED_ADAPTER_CONTEXT_ID });
359
+ return luvio.applyCachePolicy(requestContext || {}, { config: configPlus, luvio }, buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
360
+ };
389
361
  }
390
362
 
391
363
  /**
@@ -518,14 +490,13 @@ function buildCachedSnapshotCachePolicy(buildSnapshotContext, storeLookup) {
518
490
  variables: {},
519
491
  });
520
492
  }
521
- function onFetchResponseSuccess(luvio, context, _config, resourceParams, response) {
493
+ function onFetchResponseSuccess(luvio, _config, resourceParams, response) {
522
494
  const recordId = keyBuilderFromResourceParams(resourceParams);
523
495
  const select = {
524
496
  recordId,
525
497
  node: { kind: 'Fragment', opaque: true, private: [], version: APEX_VERSION },
526
498
  variables: {},
527
499
  };
528
- setCacheControlAdapterContext(context, recordId, response);
529
500
  if (shouldCache(response)) {
530
501
  const snapshot = ingestSuccess(luvio, resourceParams, response);
531
502
  return luvio.storeBroadcast().then(() => snapshot);
@@ -540,24 +511,24 @@ function onFetchResponseSuccess(luvio, context, _config, resourceParams, respons
540
511
  data: response.body,
541
512
  });
542
513
  }
543
- function onFetchResponseError(luvio, _context, _config, _resourceParams, response) {
514
+ function onFetchResponseError(luvio, _config, _resourceParams, response) {
544
515
  return Promise.resolve(luvio.errorSnapshot(response));
545
516
  }
546
- function buildNetworkSnapshot(luvio, context, config, options) {
517
+ function buildNetworkSnapshot(luvio, config, options) {
547
518
  const resourceParams = createResourceParams(config);
548
519
  const request = createResourceRequest(resourceParams);
549
520
  return luvio.dispatchResourceRequest(request, options).then((response) => {
550
- return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, context, config, resourceParams, response),
521
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response),
551
522
  // TODO [W-10490362]: Properly generate response cache keys
552
523
  () => {
553
524
  return new StoreKeyMap();
554
525
  });
555
526
  }, (response) => {
556
- return luvio.handleErrorResponse(() => onFetchResponseError(luvio, context, config, resourceParams, response));
527
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
557
528
  });
558
529
  }
559
530
  function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
560
- const { luvio, config, adapterContext } = context;
531
+ const { luvio, config } = context;
561
532
  const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
562
533
  const dispatchOptions = {
563
534
  resourceRequestContext: {
@@ -571,7 +542,7 @@ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext)
571
542
  priority: networkPriority,
572
543
  };
573
544
  }
574
- return buildNetworkSnapshot(luvio, adapterContext, config, dispatchOptions);
545
+ return buildNetworkSnapshot(luvio, config, dispatchOptions);
575
546
  }
576
547
  function handleSnapshot(snapshot) {
577
548
  if (snapshot.state === 'Error') {
@@ -604,20 +575,14 @@ const getInvoker = (luvio, invokerParams) => {
604
575
  return invokerFactory(luvio, invokerParams, getApexAdapterFactory);
605
576
  };
606
577
  function postApexAdapterFactory(luvio, namespace, classname, method, isContinuation) {
607
- return luvio.withContext(function apex__postApex(config, context, requestContext) {
578
+ return (config, requestContext) => {
608
579
  // config validation is unnecessary for this imperative adapter
609
580
  // due to the config being of type `any`.
610
581
  // however, we have special config validation for the wire adapter,
611
582
  // explanation in getApex
612
583
  const configPlus = configBuilder(config, apexClassnameBuilder(namespace, classname), method, isContinuation);
613
- // if this response isn't meant to be cached then pass a buildCached
614
- // func that returns undefined, that way cache policy impls will know
615
- // not to do any cache lookups
616
- const buildCached = isCacheable(configPlus, context)
617
- ? buildCachedSnapshotCachePolicy
618
- : () => undefined;
619
- return luvio.applyCachePolicy(requestContext || {}, { config: configPlus, luvio, adapterContext: context }, buildCached, buildNetworkSnapshotCachePolicy);
620
- }, { contextId: SHARED_ADAPTER_CONTEXT_ID });
584
+ return luvio.applyCachePolicy(requestContext || {}, { config: configPlus, luvio }, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
585
+ };
621
586
  }
622
587
 
623
588
  const REFRESH_APEX_KEY = 'refreshApex';
@@ -683,4 +648,4 @@ const getApexInvoker = function (namespace, classname, method, isContinuation, i
683
648
  };
684
649
 
685
650
  export { getApexInvoker, getApexInvoker_imperative, refreshApex };
686
- // version: 1.282.0-dd2e9831c
651
+ // version: 1.284.0-8b78b708e