@salesforce/lwc-adapters-uiapi 1.214.0 → 1.214.2
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/main.js +23 -17
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -9186,26 +9186,32 @@ const RECORD_ID_DECODER = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456';
|
|
|
9186
9186
|
* @returns An 18-char record id, and throws error if an invalid record id was provided.
|
|
9187
9187
|
*/
|
|
9188
9188
|
function getRecordId18(value) {
|
|
9189
|
-
if (
|
|
9190
|
-
|
|
9191
|
-
|
|
9192
|
-
|
|
9193
|
-
|
|
9194
|
-
|
|
9195
|
-
|
|
9196
|
-
|
|
9197
|
-
|
|
9198
|
-
|
|
9199
|
-
|
|
9200
|
-
|
|
9201
|
-
|
|
9202
|
-
|
|
9203
|
-
decodeValue += 1 << bit;
|
|
9189
|
+
if (isString(value)) {
|
|
9190
|
+
if (value.length === 18) {
|
|
9191
|
+
return value;
|
|
9192
|
+
}
|
|
9193
|
+
else if (value.length === 15) {
|
|
9194
|
+
// Add the 3 character suffix
|
|
9195
|
+
let recordId = value;
|
|
9196
|
+
for (let offset = 0; offset < 15; offset += 5) {
|
|
9197
|
+
let decodeValue = 0;
|
|
9198
|
+
for (let bit = 0; bit < 5; bit++) {
|
|
9199
|
+
const c = value[offset + bit];
|
|
9200
|
+
if (c >= 'A' && c <= 'Z') {
|
|
9201
|
+
decodeValue += 1 << bit;
|
|
9202
|
+
}
|
|
9204
9203
|
}
|
|
9204
|
+
recordId += RECORD_ID_DECODER[decodeValue];
|
|
9205
9205
|
}
|
|
9206
|
-
recordId
|
|
9206
|
+
return recordId;
|
|
9207
9207
|
}
|
|
9208
|
-
|
|
9208
|
+
}
|
|
9209
|
+
else if (value === undefined || value === null) {
|
|
9210
|
+
// Not throwing here - input params might not have settled
|
|
9211
|
+
return undefined;
|
|
9212
|
+
}
|
|
9213
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
9214
|
+
throw new Error(`Configuration Error: Invalid RecordId passed: ${JSON.stringify(value)}. RecordIds must be 15 or 18 character strings.`);
|
|
9209
9215
|
}
|
|
9210
9216
|
return undefined;
|
|
9211
9217
|
}
|