@salesforce/lds-adapters-uiapi-lex 1.298.0 → 1.300.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-adapters-uiapi-lex",
3
- "version": "1.298.0",
3
+ "version": "1.300.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "UIAPI LWC Adapters built for LEX",
6
6
  "repository": {
@@ -12,9 +12,9 @@
12
12
  * *******************************************************************************************
13
13
  */
14
14
  /* proxy-compat-disable */
15
- import { convertAuraResponseToData, TypeRegistryCachePolicyCommand, CachePolicyCommand, DataNotFoundError, toError } from 'force/luvioRuntime3';
16
- import { CommandWireAdapterConstructor } from 'force/luvioLwcBindings3';
17
- import { register } from 'force/luvioRegistry';
15
+ import { convertAuraResponseToData, TypeRegistryCachePolicyCommand, CachePolicyCommand } from 'force/luvioRuntime4';
16
+ import { CommandWireAdapterConstructor } from 'force/luvioLwcBindings4';
17
+ import { serviceBroker } from 'force/luvioServiceBroker4';
18
18
 
19
19
  /**
20
20
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -23,6 +23,34 @@ import { register } from 'force/luvioRegistry';
23
23
  */
24
24
 
25
25
 
26
+ /**
27
+ * Copyright (c) 2022, Salesforce, Inc.,
28
+ * All rights reserved.
29
+ * For full license text, see the LICENSE.txt file
30
+ */
31
+
32
+ /**
33
+ * Converts an arbitrary value to an Error.
34
+ *
35
+ * @param x anything
36
+ * @returns Error corresponding to x
37
+ */
38
+ function toError(x) {
39
+ if (x instanceof Error) {
40
+ return x;
41
+ }
42
+ return new Error(`${x}`);
43
+ }
44
+
45
+ // an error to indicate that the data inside a WithErrors construct
46
+ // is missing or incomplete
47
+ class DataNotFoundError extends Error {
48
+ constructor(message) {
49
+ super(message);
50
+ this.name = 'DataNotFoundError';
51
+ }
52
+ }
53
+
26
54
  /**
27
55
  * Copyright (c) 2022, Salesforce, Inc.,
28
56
  * All rights reserved.
@@ -61,6 +89,10 @@ const objectInfoType = {
61
89
  }
62
90
  store.set(key, data);
63
91
  },
92
+ delete: function (key, services) {
93
+ services.store.delete(key);
94
+ services.metadataRepository.delete(key);
95
+ },
64
96
  };
65
97
  function dedupe(value) {
66
98
  if (value === undefined) {
@@ -73,21 +105,21 @@ function dedupe(value) {
73
105
  return Object.keys(result);
74
106
  }
75
107
 
108
+ const GET_OBJECT_INFO_CONFIG_SCHEMA = {
109
+ type: 'object',
110
+ properties: {
111
+ objectApiName: {
112
+ type: 'string',
113
+ },
114
+ },
115
+ required: ['objectApiName'],
116
+ additionalProperties: false,
117
+ };
76
118
  class GetObjectInfoCommand extends TypeRegistryCachePolicyCommand {
77
119
  constructor() {
78
120
  super(...arguments);
79
121
  this.returnTypeNamespace = objectInfoType.namespace;
80
122
  this.returnTypeName = objectInfoType.typeName;
81
- this.configJsonSchema = {
82
- type: 'object',
83
- properties: {
84
- objectApiName: {
85
- type: 'string',
86
- },
87
- },
88
- required: ['objectApiName'],
89
- additionalProperties: false,
90
- };
91
123
  }
92
124
  buildKeyConfigFromInstance(instance) {
93
125
  return {
@@ -235,24 +267,23 @@ class UiApiCompositeCachingCommand extends CachePolicyCommand {
235
267
  }
236
268
  }
237
269
 
270
+ const GET_OBJECT_INFOS_CONFIG_SCHEMA = {
271
+ type: 'object',
272
+ properties: {
273
+ objectApiNames: {
274
+ type: 'array',
275
+ items: {
276
+ type: 'string',
277
+ },
278
+ minItems: 1,
279
+ },
280
+ },
281
+ required: ['objectApiNames'],
282
+ additionalProperties: false,
283
+ };
238
284
  class GetObjectInfosCommand extends UiApiCompositeCachingCommand {
239
285
  constructor(config, commandContext, services) {
240
- const coercedConfig = { objectApiNames: dedupe(config.objectApiNames) };
241
- super(coercedConfig, commandContext, services);
242
- this.configJsonSchema = {
243
- type: 'object',
244
- properties: {
245
- objectApiNames: {
246
- type: 'array',
247
- items: {
248
- type: 'string',
249
- },
250
- minItems: 1,
251
- },
252
- },
253
- required: ['objectApiNames'],
254
- additionalProperties: false,
255
- };
286
+ super({ objectApiNames: dedupe(config.objectApiNames) }, commandContext, services);
256
287
  this.compositeTypeNamespace = UiApiNamespace;
257
288
  this.compositeTypeName = ObjectInfoRepresentationName;
258
289
  }
@@ -271,37 +302,63 @@ class GetObjectInfosCommandAura extends GetObjectInfosCommand {
271
302
  }
272
303
  }
273
304
 
274
- const commandModuleRegistration = {
275
- id: 'commandModule-uiapi',
276
- services: {
277
- // TODO [W-15288468]: version values need to be rolled up by the build
278
- metadataRepository: '1.0.0',
279
- store: '1.0.0',
280
- keySubscription: '1.0.0',
281
- typeRegistry: '1.0.0',
282
- cacheInclusionPolicy: '1.0.0',
283
- cachePolicy: '1.0.0',
284
- auraNetwork: '1.0.0',
305
+ let getObjectInfo;
306
+ let getObjectInfos;
307
+ const serviceRequests = {
308
+ metadataRepository: {
309
+ type: 'metadataRepository',
310
+ version: '1.0',
285
311
  },
286
- setServices: (services) => {
287
- services.typeRegistry.register(objectInfoType);
288
- return {
289
- getObjectInfo: (getObjectInfo = class extends CommandWireAdapterConstructor {
290
- getCommand() {
291
- return new GetObjectInfoCommandAura(this.config, {}, services);
292
- }
293
- }),
294
- getObjectInfos: (getObjectInfos = class extends CommandWireAdapterConstructor {
295
- getCommand() {
296
- return new GetObjectInfosCommandAura(this.config, {}, services);
297
- }
298
- }),
299
- };
312
+ store: {
313
+ type: 'store',
314
+ version: '1.0',
315
+ },
316
+ keySubscription: {
317
+ type: 'keySubscription',
318
+ version: '1.0',
319
+ },
320
+ typeRegistry: {
321
+ type: 'typeRegistry',
322
+ version: '1.0',
323
+ },
324
+ cacheInclusionPolicy: {
325
+ type: 'cacheInclusionPolicy',
326
+ version: '1.0',
327
+ },
328
+ cachePolicy: {
329
+ type: 'cachePolicy',
330
+ version: '1.0',
331
+ },
332
+ auraNetwork: {
333
+ type: 'auraNetwork',
334
+ version: '1.0',
335
+ },
336
+ requestDedupe: {
337
+ type: 'requestDedupe',
338
+ version: '1.0',
300
339
  },
301
340
  };
302
- register(commandModuleRegistration);
303
- let getObjectInfo;
304
- let getObjectInfos;
341
+ serviceBroker.subscribe((services) => {
342
+ services.typeRegistry.register(objectInfoType);
343
+ getObjectInfo = class extends CommandWireAdapterConstructor {
344
+ constructor() {
345
+ super(...arguments);
346
+ this.configSchema = GET_OBJECT_INFO_CONFIG_SCHEMA;
347
+ }
348
+ getCommand() {
349
+ return new GetObjectInfoCommandAura(this.config, {}, services);
350
+ }
351
+ };
352
+ getObjectInfos = class extends CommandWireAdapterConstructor {
353
+ constructor() {
354
+ super(...arguments);
355
+ this.configSchema = GET_OBJECT_INFOS_CONFIG_SCHEMA;
356
+ }
357
+ getCommand() {
358
+ return new GetObjectInfosCommandAura(this.config, {}, services);
359
+ }
360
+ };
361
+ }, serviceRequests);
305
362
 
306
363
  export { getObjectInfo, getObjectInfos };
307
- // version: 1.298.0-3a2eedddc
364
+ // version: 1.300.0-76f5b2b4ea