@salesforce/lds-runtime-bridge 1.332.0-dev2 → 1.332.0-dev20
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/dist/ldsRuntimeBridge.js +60 -5
- package/package.json +9 -9
package/dist/ldsRuntimeBridge.js
CHANGED
|
@@ -15,7 +15,7 @@ import { setDefaultLuvio } from 'force/ldsEngine';
|
|
|
15
15
|
import { setBypassDeepFreeze, StoreKeySet, serializeStructuredKey, StringKeyInMemoryStore, Reader, deepFreeze, emitAdapterEvent, InMemoryStore, Environment, Luvio } from 'force/luvioEngine';
|
|
16
16
|
import { setupInstrumentation, instrumentAdapter as instrumentAdapter$1, instrumentLuvio } from 'force/ldsInstrumentation';
|
|
17
17
|
import { instrument } from 'force/ldsBindings';
|
|
18
|
-
import {
|
|
18
|
+
import { RECORD_VIEW_ENTITY_ID_PREFIX, API_NAMESPACE, isStoreKeyRecordViewEntity, extractRecordIdFromStoreKey, keyBuilderRecord, RECORD_FIELDS_KEY_JUNCTION, RECORD_ID_PREFIX } from 'force/ldsAdaptersUiapi';
|
|
19
19
|
import networkAdapter from 'force/ldsNetwork';
|
|
20
20
|
import ldsEngineCreator from 'force/ldsEngineCreator';
|
|
21
21
|
import { getRuntime as getRuntime$1 } from 'native/ldsRuntimeMobile';
|
|
@@ -1577,9 +1577,15 @@ function setupMobileInstrumentation(luvio, store) {
|
|
|
1577
1577
|
|
|
1578
1578
|
const { keys, values, create, assign, freeze, entries } = Object;
|
|
1579
1579
|
|
|
1580
|
+
const RECORD_TEMPLATE_CREATE_REPRESENTATION_NAME = 'RecordTemplateCreateRepresentation';
|
|
1581
|
+
const RECORD_TEMPLATE_CREATE_REPRESENTATION_PREFIX = `${API_NAMESPACE}::${RECORD_TEMPLATE_CREATE_REPRESENTATION_NAME}:`;
|
|
1580
1582
|
function buildRecordFieldStoreKey(recordKey, fieldName) {
|
|
1581
1583
|
return `${recordKey}${RECORD_FIELDS_KEY_JUNCTION}${fieldName}`;
|
|
1582
1584
|
}
|
|
1585
|
+
function isStoreKeyRecordTemplateId(key) {
|
|
1586
|
+
return (key.indexOf(RECORD_TEMPLATE_CREATE_REPRESENTATION_PREFIX) > -1 &&
|
|
1587
|
+
key.indexOf(RECORD_FIELDS_KEY_JUNCTION) === -1);
|
|
1588
|
+
}
|
|
1583
1589
|
function isStoreKeyRecordId(key) {
|
|
1584
1590
|
return key.indexOf(RECORD_ID_PREFIX) > -1 && key.indexOf(RECORD_FIELDS_KEY_JUNCTION) === -1;
|
|
1585
1591
|
}
|
|
@@ -1591,7 +1597,9 @@ function isStoreRecordError(storeRecord) {
|
|
|
1591
1597
|
}
|
|
1592
1598
|
function isEntryDurableRecordRepresentation(entry, key) {
|
|
1593
1599
|
// Either a DurableRecordRepresentation or StoreRecordError can live at a record key
|
|
1594
|
-
return ((isStoreKeyRecordId(key) ||
|
|
1600
|
+
return ((isStoreKeyRecordId(key) ||
|
|
1601
|
+
isStoreKeyRecordViewEntity(key) ||
|
|
1602
|
+
isStoreKeyRecordTemplateId(key)) &&
|
|
1595
1603
|
entry.data.__type === undefined);
|
|
1596
1604
|
}
|
|
1597
1605
|
/**
|
|
@@ -1700,6 +1708,29 @@ function buildDurableRecordRepresentation(normalizedRecord, records, pendingEntr
|
|
|
1700
1708
|
fields: filteredFields,
|
|
1701
1709
|
};
|
|
1702
1710
|
}
|
|
1711
|
+
// We have a local version of this that calls the imported version because
|
|
1712
|
+
// we need to check for a prefix that is defined in this file
|
|
1713
|
+
function extractRecordIdFromStoreKeyWithRecordTemplate(key) {
|
|
1714
|
+
const superResult = extractRecordIdFromStoreKey(key);
|
|
1715
|
+
if (superResult) {
|
|
1716
|
+
return superResult;
|
|
1717
|
+
}
|
|
1718
|
+
if (key === undefined || key.indexOf(RECORD_TEMPLATE_CREATE_REPRESENTATION_PREFIX) === -1) {
|
|
1719
|
+
return undefined;
|
|
1720
|
+
}
|
|
1721
|
+
const parts = key.split(':');
|
|
1722
|
+
return parts[parts.length - 1].split('_')[0];
|
|
1723
|
+
}
|
|
1724
|
+
function buildRecordTemplateCreateKeyFromId(recordId, apiName) {
|
|
1725
|
+
return `${RECORD_TEMPLATE_CREATE_REPRESENTATION_PREFIX}${apiName}:${recordId}`;
|
|
1726
|
+
}
|
|
1727
|
+
function extractAPINameFromRecordTemplateKey(originalKey) {
|
|
1728
|
+
if (originalKey.indexOf(RECORD_TEMPLATE_CREATE_REPRESENTATION_PREFIX) !== -1) {
|
|
1729
|
+
const trimmed = originalKey.substring(RECORD_TEMPLATE_CREATE_REPRESENTATION_PREFIX.length);
|
|
1730
|
+
return trimmed.split(':')[0];
|
|
1731
|
+
}
|
|
1732
|
+
return undefined;
|
|
1733
|
+
}
|
|
1703
1734
|
function getDenormalizedKey(originalKey, recordId, luvio) {
|
|
1704
1735
|
// this will likely need to be handled when moving to structured keys
|
|
1705
1736
|
// note record view entities dont have an associated keybuilder. They get ingested as records to a different key format
|
|
@@ -1707,6 +1738,11 @@ function getDenormalizedKey(originalKey, recordId, luvio) {
|
|
|
1707
1738
|
if (originalKey.startsWith(RECORD_VIEW_ENTITY_ID_PREFIX)) {
|
|
1708
1739
|
return RECORD_VIEW_ENTITY_ID_PREFIX + recordId;
|
|
1709
1740
|
}
|
|
1741
|
+
// if key starts with record template, return that plus record id and api name
|
|
1742
|
+
const apiName = extractAPINameFromRecordTemplateKey(originalKey);
|
|
1743
|
+
if (originalKey.startsWith(RECORD_TEMPLATE_CREATE_REPRESENTATION_PREFIX) && apiName) {
|
|
1744
|
+
return buildRecordTemplateCreateKeyFromId(recordId, apiName);
|
|
1745
|
+
}
|
|
1710
1746
|
return keyBuilderRecord(luvio, { recordId });
|
|
1711
1747
|
}
|
|
1712
1748
|
function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecords, getStoreMetadata, getStore, sqlStore) {
|
|
@@ -1724,9 +1760,10 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
|
|
|
1724
1760
|
// map of records to avoid requesting duplicate record keys when requesting both records and fields
|
|
1725
1761
|
const recordEntries = {};
|
|
1726
1762
|
const recordViewEntries = {};
|
|
1763
|
+
const recordTemplateEntries = {};
|
|
1727
1764
|
for (let i = 0, len = entriesLength; i < len; i++) {
|
|
1728
1765
|
const id = entries[i];
|
|
1729
|
-
const recordId =
|
|
1766
|
+
const recordId = extractRecordIdFromStoreKeyWithRecordTemplate(id);
|
|
1730
1767
|
if (recordId !== undefined) {
|
|
1731
1768
|
if (id.startsWith(RECORD_VIEW_ENTITY_ID_PREFIX)) {
|
|
1732
1769
|
if (recordViewEntries[recordId] === undefined) {
|
|
@@ -1735,6 +1772,13 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
|
|
|
1735
1772
|
filteredEntryIds.push(key);
|
|
1736
1773
|
}
|
|
1737
1774
|
}
|
|
1775
|
+
else if (id.startsWith(RECORD_TEMPLATE_CREATE_REPRESENTATION_PREFIX)) {
|
|
1776
|
+
if (recordTemplateEntries[recordId] === undefined) {
|
|
1777
|
+
const key = getDenormalizedKey(id, recordId, luvio);
|
|
1778
|
+
recordTemplateEntries[recordId] = true;
|
|
1779
|
+
filteredEntryIds.push(key);
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1738
1782
|
else {
|
|
1739
1783
|
if (recordEntries[recordId] === undefined) {
|
|
1740
1784
|
const key = getDenormalizedKey(id, recordId, luvio);
|
|
@@ -1778,21 +1822,29 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
|
|
|
1778
1822
|
const keys$1 = keys(entries);
|
|
1779
1823
|
const putRecords = {};
|
|
1780
1824
|
const putRecordViews = {};
|
|
1825
|
+
const putRecordTemplateViews = {};
|
|
1781
1826
|
const storeRecords = getStoreRecords !== undefined ? getStoreRecords() : {};
|
|
1782
1827
|
const storeMetadata = getStoreMetadata !== undefined ? getStoreMetadata() : {};
|
|
1783
1828
|
const store = getStore();
|
|
1784
1829
|
for (let i = 0, len = keys$1.length; i < len; i++) {
|
|
1785
1830
|
const key = keys$1[i];
|
|
1786
1831
|
let value = entries[key];
|
|
1787
|
-
const recordId =
|
|
1832
|
+
const recordId = extractRecordIdFromStoreKeyWithRecordTemplate(key);
|
|
1788
1833
|
// do not put normalized field values
|
|
1789
1834
|
if (recordId !== undefined) {
|
|
1790
1835
|
const isRecordView = key.startsWith(RECORD_VIEW_ENTITY_ID_PREFIX);
|
|
1836
|
+
const isRecordTemplateView = key.startsWith(RECORD_TEMPLATE_CREATE_REPRESENTATION_PREFIX);
|
|
1837
|
+
// put a record view in there for record templates
|
|
1791
1838
|
if (isRecordView) {
|
|
1792
1839
|
if (putRecordViews[recordId] === true) {
|
|
1793
1840
|
continue;
|
|
1794
1841
|
}
|
|
1795
1842
|
}
|
|
1843
|
+
else if (isRecordTemplateView) {
|
|
1844
|
+
if (putRecordTemplateViews[recordId] === true) {
|
|
1845
|
+
continue;
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1796
1848
|
else {
|
|
1797
1849
|
if (putRecords[recordId] === true) {
|
|
1798
1850
|
continue;
|
|
@@ -1813,6 +1865,9 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
|
|
|
1813
1865
|
if (isRecordView) {
|
|
1814
1866
|
putRecordViews[recordId] = true;
|
|
1815
1867
|
}
|
|
1868
|
+
else if (isRecordTemplateView) {
|
|
1869
|
+
putRecordTemplateViews[recordId] = true;
|
|
1870
|
+
}
|
|
1816
1871
|
else {
|
|
1817
1872
|
putRecords[recordId] = true;
|
|
1818
1873
|
}
|
|
@@ -1998,4 +2053,4 @@ function ldsRuntimeBridge() {
|
|
|
1998
2053
|
}
|
|
1999
2054
|
|
|
2000
2055
|
export { ldsRuntimeBridge as default };
|
|
2001
|
-
// version: 1.332.0-
|
|
2056
|
+
// version: 1.332.0-dev20-f65bc51b43
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-runtime-bridge",
|
|
3
|
-
"version": "1.332.0-
|
|
3
|
+
"version": "1.332.0-dev20",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "LDS runtime for bridge.app.",
|
|
6
6
|
"main": "dist/ldsRuntimeBridge.js",
|
|
@@ -34,18 +34,18 @@
|
|
|
34
34
|
"release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-bridge"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@salesforce/lds-bindings": "^1.332.0-
|
|
38
|
-
"@salesforce/lds-durable-records": "^1.332.0-
|
|
39
|
-
"@salesforce/lds-instrumentation": "^1.332.0-
|
|
40
|
-
"@salesforce/lds-runtime-mobile": "^1.332.0-
|
|
37
|
+
"@salesforce/lds-bindings": "^1.332.0-dev20",
|
|
38
|
+
"@salesforce/lds-durable-records": "^1.332.0-dev20",
|
|
39
|
+
"@salesforce/lds-instrumentation": "^1.332.0-dev20",
|
|
40
|
+
"@salesforce/lds-runtime-mobile": "^1.332.0-dev20",
|
|
41
41
|
"@salesforce/user": "0.0.21",
|
|
42
42
|
"o11y": "250.7.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@salesforce/lds-network-aura": "^1.332.0-
|
|
46
|
-
"@salesforce/lds-runtime-aura": "^1.332.0-
|
|
47
|
-
"@salesforce/lds-store-nimbus": "^1.332.0-
|
|
48
|
-
"@salesforce/nimbus-plugin-lds": "^1.332.0-
|
|
45
|
+
"@salesforce/lds-network-aura": "^1.332.0-dev20",
|
|
46
|
+
"@salesforce/lds-runtime-aura": "^1.332.0-dev20",
|
|
47
|
+
"@salesforce/lds-store-nimbus": "^1.332.0-dev20",
|
|
48
|
+
"@salesforce/nimbus-plugin-lds": "^1.332.0-dev20",
|
|
49
49
|
"babel-plugin-dynamic-import-node": "^2.3.3"
|
|
50
50
|
},
|
|
51
51
|
"luvioBundlesize": [
|