@salesforce/lds-runtime-bridge 1.259.0 → 1.261.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/dist/ldsRuntimeBridge.js
CHANGED
|
@@ -18,6 +18,7 @@ import { isStoreKeyRecordViewEntity, RECORD_ID_PREFIX, RECORD_FIELDS_KEY_JUNCTIO
|
|
|
18
18
|
import '@salesforce/gate/lds.idempotencyWriteDisabled';
|
|
19
19
|
import '@salesforce/gate/lds.backdatingEnabled';
|
|
20
20
|
import { Kind, buildSchema, isObjectType, defaultFieldResolver } from 'force/ldsGraphqlParser';
|
|
21
|
+
import FIRST_DAY_OF_WEEK from '@salesforce/i18n/firstDayOfWeek';
|
|
21
22
|
import excludeStaleRecordsGate from '@salesforce/gate/lds.graphqlEvalExcludeStaleRecords';
|
|
22
23
|
import networkAdapter from 'force/ldsNetwork';
|
|
23
24
|
import ldsEngineCreator from 'force/ldsEngineCreator';
|
|
@@ -1979,16 +1980,21 @@ var DateRange;
|
|
|
1979
1980
|
(function (DateRange) {
|
|
1980
1981
|
DateRange["last_n_days"] = "last_n_days";
|
|
1981
1982
|
DateRange["next_n_days"] = "next_n_days";
|
|
1983
|
+
DateRange["n_days_ago"] = "n_days_ago";
|
|
1982
1984
|
DateRange["last_n_weeks"] = "last_n_weeks";
|
|
1983
1985
|
DateRange["next_n_weeks"] = "next_n_weeks";
|
|
1986
|
+
DateRange["n_weeks_ago"] = "n_weeks_ago";
|
|
1984
1987
|
DateRange["last_n_months"] = "last_n_months";
|
|
1985
1988
|
DateRange["next_n_months"] = "next_n_months";
|
|
1989
|
+
DateRange["n_months_ago"] = "n_months_ago";
|
|
1986
1990
|
DateRange["last_n_quarters"] = "last_n_quarters";
|
|
1987
1991
|
DateRange["next_n_quarters"] = "next_n_quarters";
|
|
1992
|
+
DateRange["n_quarters_ago"] = "n_quarters_ago";
|
|
1988
1993
|
DateRange["last_n_fiscal_quarters"] = "last_n_fiscal_quarters";
|
|
1989
1994
|
DateRange["next_n_fiscal_quarters"] = "next_n_fiscal_quarters";
|
|
1990
1995
|
DateRange["last_n_years"] = "last_n_years";
|
|
1991
1996
|
DateRange["next_n_years"] = "next_n_years";
|
|
1997
|
+
DateRange["n_years_ago"] = "n_years_ago";
|
|
1992
1998
|
DateRange["last_n_fiscal_years"] = "last_n_fiscal_years";
|
|
1993
1999
|
DateRange["next_n_fiscal_years"] = "next_n_fiscal_years";
|
|
1994
2000
|
})(DateRange || (DateRange = {}));
|
|
@@ -2059,6 +2065,7 @@ function dateTimeRange(input, op, field, alias) {
|
|
|
2059
2065
|
dataType: field.dataType,
|
|
2060
2066
|
};
|
|
2061
2067
|
}
|
|
2068
|
+
// relative date ranges defined at https://help.salesforce.com/s/articleView?id=sf.filter_dates_relative.htm&type=5
|
|
2062
2069
|
function dateRangesFrom(dateRange, input, dateFunction) {
|
|
2063
2070
|
// use 'start of day' to ensure the timestamp is 00:00:00 for date time values
|
|
2064
2071
|
switch (dateRange) {
|
|
@@ -2088,7 +2095,86 @@ function dateRangesFrom(dateRange, input, dateFunction) {
|
|
|
2088
2095
|
},
|
|
2089
2096
|
};
|
|
2090
2097
|
}
|
|
2091
|
-
//
|
|
2098
|
+
// n_days_ago
|
|
2099
|
+
// starts 12:00:00 am -(n) days from today
|
|
2100
|
+
// ends 11:59:99 pm -(n) days from today
|
|
2101
|
+
case DateRange.n_days_ago: {
|
|
2102
|
+
return {
|
|
2103
|
+
binding: {
|
|
2104
|
+
upper: `${-input + 1} days`,
|
|
2105
|
+
lower: `-${input} days`,
|
|
2106
|
+
},
|
|
2107
|
+
range: {
|
|
2108
|
+
upper: `${dateFunction}('now', 'start of day', ?, '-1 seconds')`,
|
|
2109
|
+
lower: `${dateFunction}('now', 'start of day', ?)`,
|
|
2110
|
+
},
|
|
2111
|
+
};
|
|
2112
|
+
}
|
|
2113
|
+
// next_n_weeks
|
|
2114
|
+
// starts at 00:00:00 the first day of the week n weeks after the current week
|
|
2115
|
+
// ends 23:59:59 of the last day of week before the current
|
|
2116
|
+
case DateRange.next_n_weeks: {
|
|
2117
|
+
const isStartOfWeek = isTodayStartOfWeek();
|
|
2118
|
+
return {
|
|
2119
|
+
binding: {
|
|
2120
|
+
// weekday FIRST_DAY_OF_WEEK goes to the next weekday of FIRST_DAY_OF_WEEK if not that current day
|
|
2121
|
+
// if that current day then it will be that day
|
|
2122
|
+
// so for the upper bound if today is the start of the week we need to add 7 more days to the value to get next week as the start
|
|
2123
|
+
upper: `${input * 7 + (isStartOfWeek ? 7 : 0)} days`,
|
|
2124
|
+
//lower bound starts out 00:00:00 of next week
|
|
2125
|
+
lower: `${isStartOfWeek ? 7 : 0} days`,
|
|
2126
|
+
},
|
|
2127
|
+
range: {
|
|
2128
|
+
upper: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?, '-1 seconds')`,
|
|
2129
|
+
lower: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?)`,
|
|
2130
|
+
},
|
|
2131
|
+
};
|
|
2132
|
+
}
|
|
2133
|
+
// last_n_weeks
|
|
2134
|
+
// starts at 00:00:00 of day 0 n weeks before the current week
|
|
2135
|
+
// ends 23:59:59 at last day of the week before the current week
|
|
2136
|
+
case DateRange.last_n_weeks: {
|
|
2137
|
+
const isStartOfWeek = isTodayStartOfWeek();
|
|
2138
|
+
return {
|
|
2139
|
+
binding: {
|
|
2140
|
+
// ending on at 23:59:59 of the week before the current week
|
|
2141
|
+
// -7 more days if today not start of week
|
|
2142
|
+
upper: `${-(isStartOfWeek ? 0 : 7)} days`,
|
|
2143
|
+
// starting on 00:00:00 of n * weeks before current week
|
|
2144
|
+
// -7 more days if today not the start of the week because weekday FIRST_DAY_OF_WEEK puts us next week day 0
|
|
2145
|
+
lower: `${-input * 7 - (isStartOfWeek ? 0 : 7)} days`,
|
|
2146
|
+
},
|
|
2147
|
+
range: {
|
|
2148
|
+
upper: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?, '-1 seconds')`,
|
|
2149
|
+
lower: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?)`,
|
|
2150
|
+
},
|
|
2151
|
+
};
|
|
2152
|
+
}
|
|
2153
|
+
// n_weeks_ago
|
|
2154
|
+
// starts 00:00:00 on day 0 of n weeks before the current week
|
|
2155
|
+
// ends 7 days after the start
|
|
2156
|
+
case DateRange.n_weeks_ago: {
|
|
2157
|
+
const isStartOfWeek = isTodayStartOfWeek();
|
|
2158
|
+
return {
|
|
2159
|
+
binding: {
|
|
2160
|
+
// end of week n weeks before current week
|
|
2161
|
+
// if today is start of the week then we need to -7 from the days given by n
|
|
2162
|
+
// so add 7 to remove a week from -(n)
|
|
2163
|
+
upper: `${-input * 7 + (isStartOfWeek ? 7 : 0)} days`,
|
|
2164
|
+
// start of the week n weeks from the current week
|
|
2165
|
+
// if today is the start of the week then -(n) will do to be the previous week, but
|
|
2166
|
+
// if today is not the start of the week we need to go back 1 more week since weekday FIRST_DAY_OF_WEEK will put us next week
|
|
2167
|
+
lower: `${-input * 7 - (isStartOfWeek ? 0 : 7)} days`,
|
|
2168
|
+
},
|
|
2169
|
+
range: {
|
|
2170
|
+
upper: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?, '-1 seconds')`,
|
|
2171
|
+
lower: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?)`,
|
|
2172
|
+
},
|
|
2173
|
+
};
|
|
2174
|
+
}
|
|
2175
|
+
// next_n_months
|
|
2176
|
+
// starts the first day of the next month at 00:00:00 and
|
|
2177
|
+
// ends end of the nth month 23:59:59
|
|
2092
2178
|
case DateRange.next_n_months: {
|
|
2093
2179
|
return {
|
|
2094
2180
|
binding: {
|
|
@@ -2101,7 +2187,8 @@ function dateRangesFrom(dateRange, input, dateFunction) {
|
|
|
2101
2187
|
},
|
|
2102
2188
|
};
|
|
2103
2189
|
}
|
|
2104
|
-
// last_n_months
|
|
2190
|
+
// last_n_months
|
|
2191
|
+
// starts at 00:00:00 first day of n months before the current month and
|
|
2105
2192
|
// ends at 23:59:59 the last day of the month before the current month
|
|
2106
2193
|
case DateRange.last_n_months: {
|
|
2107
2194
|
return {
|
|
@@ -2115,11 +2202,125 @@ function dateRangesFrom(dateRange, input, dateFunction) {
|
|
|
2115
2202
|
},
|
|
2116
2203
|
};
|
|
2117
2204
|
}
|
|
2205
|
+
// n_months_ago
|
|
2206
|
+
// starts at the first day of the month 00:00:00 n months ago from now
|
|
2207
|
+
// ends at 23:59:59 of n months ago
|
|
2208
|
+
case DateRange.n_months_ago: {
|
|
2209
|
+
return {
|
|
2210
|
+
binding: {
|
|
2211
|
+
// need to go 1 less month back then -1 seconds to get the end of it
|
|
2212
|
+
upper: `${-input + 1} months`,
|
|
2213
|
+
lower: `-${input} months`,
|
|
2214
|
+
},
|
|
2215
|
+
range: {
|
|
2216
|
+
upper: `${dateFunction}('now', 'start of month', ?, '-1 seconds')`,
|
|
2217
|
+
lower: `${dateFunction}('now', 'start of month', ?)`,
|
|
2218
|
+
},
|
|
2219
|
+
};
|
|
2220
|
+
}
|
|
2221
|
+
// next_n_years
|
|
2222
|
+
// starts 00:00:00 Jan 1st the year after the current year
|
|
2223
|
+
// ends Dec 31 23:59:59 of the nth year
|
|
2224
|
+
case DateRange.next_n_years: {
|
|
2225
|
+
return {
|
|
2226
|
+
binding: {
|
|
2227
|
+
upper: `+${input + 1} years`,
|
|
2228
|
+
lower: `+1 year`,
|
|
2229
|
+
},
|
|
2230
|
+
range: {
|
|
2231
|
+
upper: `${dateFunction}('now', 'start of year', ?, '-1 seconds')`,
|
|
2232
|
+
lower: `${dateFunction}('now', 'start of year', ?)`,
|
|
2233
|
+
},
|
|
2234
|
+
};
|
|
2235
|
+
}
|
|
2236
|
+
// last_n_years starts
|
|
2237
|
+
// starts 00:00:00 Jan 1 n+1 year ago and
|
|
2238
|
+
// ends dec 31 23:59:59 of the year before the current
|
|
2239
|
+
case DateRange.last_n_years: {
|
|
2240
|
+
return {
|
|
2241
|
+
binding: {
|
|
2242
|
+
upper: `-1 seconds`,
|
|
2243
|
+
lower: `-${input + 1} years`,
|
|
2244
|
+
},
|
|
2245
|
+
range: {
|
|
2246
|
+
upper: `${dateFunction}('now', 'start of year', ?)`,
|
|
2247
|
+
lower: `${dateFunction}('now', 'start of year', ?)`,
|
|
2248
|
+
},
|
|
2249
|
+
};
|
|
2250
|
+
}
|
|
2251
|
+
// n_years_ago
|
|
2252
|
+
// starts 00:00:00 Jan 1 of n years before the current year and
|
|
2253
|
+
// ends Dec 31 23:59:59 of that year
|
|
2254
|
+
case DateRange.n_years_ago: {
|
|
2255
|
+
return {
|
|
2256
|
+
binding: {
|
|
2257
|
+
upper: `-${input - 1} years`,
|
|
2258
|
+
lower: `-${input} years`,
|
|
2259
|
+
},
|
|
2260
|
+
range: {
|
|
2261
|
+
upper: `${dateFunction}('now', 'start of year', ?, '-1 seconds')`,
|
|
2262
|
+
lower: `${dateFunction}('now', 'start of year', ?)`,
|
|
2263
|
+
},
|
|
2264
|
+
};
|
|
2265
|
+
}
|
|
2266
|
+
// next_n_quarters
|
|
2267
|
+
// starts 00:00:00 first day of the quarter after the current quarter
|
|
2268
|
+
// ends 23:59:59 of the last day of n quarters in the future
|
|
2269
|
+
case DateRange.next_n_quarters: {
|
|
2270
|
+
const currentQuarterString = quarterStart(new Date());
|
|
2271
|
+
return {
|
|
2272
|
+
binding: {
|
|
2273
|
+
// add another quarter input to -1 seconds to get the end of the last day of the quarter
|
|
2274
|
+
upper: `${(input + 1) * 3} months`,
|
|
2275
|
+
lower: `3 months`,
|
|
2276
|
+
},
|
|
2277
|
+
range: {
|
|
2278
|
+
upper: `${dateFunction}('${currentQuarterString}', 'start of day', ?, '-1 seconds')`,
|
|
2279
|
+
lower: `${dateFunction}('${currentQuarterString}', 'start of day', ?)`,
|
|
2280
|
+
},
|
|
2281
|
+
};
|
|
2282
|
+
}
|
|
2283
|
+
// last_n_quarters
|
|
2284
|
+
// starts 00:00:00 the first day of n quarters ago
|
|
2285
|
+
// end 23:59:59 the last day of the quarter before the current quarter
|
|
2286
|
+
case DateRange.last_n_quarters: {
|
|
2287
|
+
const currentQuarterString = quarterStart(new Date());
|
|
2288
|
+
return {
|
|
2289
|
+
binding: {
|
|
2290
|
+
upper: `-1 seconds`,
|
|
2291
|
+
lower: `-${input * 3} months`,
|
|
2292
|
+
},
|
|
2293
|
+
range: {
|
|
2294
|
+
upper: `${dateFunction}('${currentQuarterString}', 'start of day', ?)`,
|
|
2295
|
+
lower: `${dateFunction}('${currentQuarterString}', 'start of day', ?)`,
|
|
2296
|
+
},
|
|
2297
|
+
};
|
|
2298
|
+
}
|
|
2299
|
+
// n_quarters_ago
|
|
2300
|
+
// starts 00:00:00 first day of the quarter n quarters before the current
|
|
2301
|
+
// ends 23:59:59 last day of the same quarter
|
|
2302
|
+
case DateRange.n_quarters_ago: {
|
|
2303
|
+
const currentQuarterString = quarterStart(new Date());
|
|
2304
|
+
return {
|
|
2305
|
+
binding: {
|
|
2306
|
+
// minus 1 quarter to be able to -1 seconds to get the end of the nth quarter
|
|
2307
|
+
upper: `-${(input - 1) * 3} months`,
|
|
2308
|
+
lower: `-${input * 3} months`,
|
|
2309
|
+
},
|
|
2310
|
+
range: {
|
|
2311
|
+
upper: `${dateFunction}('${currentQuarterString}', 'start of day', ?, '-1 seconds')`,
|
|
2312
|
+
lower: `${dateFunction}('${currentQuarterString}', 'start of day', ?)`,
|
|
2313
|
+
},
|
|
2314
|
+
};
|
|
2315
|
+
}
|
|
2118
2316
|
default:
|
|
2119
2317
|
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
2120
2318
|
throw new Error(`DateRangeInput ${dateRange} is not supported in local evalutation`);
|
|
2121
2319
|
}
|
|
2122
2320
|
}
|
|
2321
|
+
function isTodayStartOfWeek() {
|
|
2322
|
+
return new Date().getDay() === FIRST_DAY_OF_WEEK;
|
|
2323
|
+
}
|
|
2123
2324
|
|
|
2124
2325
|
const JSON_EXTRACT_PATH_INGESTION_TIMESTAMP = '$.ingestionTimestamp';
|
|
2125
2326
|
const JSON_EXTRACT_PATH_INGESTION_APINAME = '$.apiName';
|
|
@@ -3762,4 +3963,4 @@ function ldsRuntimeBridge() {
|
|
|
3762
3963
|
}
|
|
3763
3964
|
|
|
3764
3965
|
export { ldsRuntimeBridge as default };
|
|
3765
|
-
// version: 1.
|
|
3966
|
+
// version: 1.261.0-faaa0c74a
|
|
@@ -3,12 +3,14 @@ declare function error(_err: Error, _userSchemaOrText?: string, _data?: any): vo
|
|
|
3
3
|
declare function startActivity(_name: string): any;
|
|
4
4
|
declare function incrementCounter(_operation: string, _increment?: number, _hasError?: boolean, _tags?: any): void;
|
|
5
5
|
declare function trackValue(_operation: string, _value: number, _hasError?: boolean, _tags?: any): void;
|
|
6
|
+
declare function bucketValue(_operation: string, _value: number, _buckets: number[]): void;
|
|
6
7
|
export declare const instrumentation: {
|
|
7
8
|
log: typeof log;
|
|
8
9
|
error: typeof error;
|
|
9
10
|
startActivity: typeof startActivity;
|
|
10
11
|
incrementCounter: typeof incrementCounter;
|
|
11
12
|
trackValue: typeof trackValue;
|
|
13
|
+
bucketValue: typeof bucketValue;
|
|
12
14
|
};
|
|
13
15
|
export declare const METRIC_KEYS: {};
|
|
14
16
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-runtime-bridge",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.261.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "LDS runtime for bridge.app.",
|
|
6
6
|
"main": "dist/ldsRuntimeBridge.js",
|
|
@@ -34,17 +34,17 @@
|
|
|
34
34
|
"release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-bridge"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@salesforce/lds-adapters-uiapi": "^1.
|
|
38
|
-
"@salesforce/lds-instrumentation": "^1.
|
|
37
|
+
"@salesforce/lds-adapters-uiapi": "^1.261.0",
|
|
38
|
+
"@salesforce/lds-instrumentation": "^1.261.0",
|
|
39
39
|
"@salesforce/user": "0.0.21",
|
|
40
40
|
"o11y": "244.0.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@salesforce/lds-drafts-adapters-uiapi": "^1.
|
|
44
|
-
"@salesforce/lds-network-aura": "^1.
|
|
45
|
-
"@salesforce/lds-runtime-aura": "^1.
|
|
46
|
-
"@salesforce/lds-store-nimbus": "^1.
|
|
47
|
-
"@salesforce/nimbus-plugin-lds": "^1.
|
|
43
|
+
"@salesforce/lds-drafts-adapters-uiapi": "^1.261.0",
|
|
44
|
+
"@salesforce/lds-network-aura": "^1.261.0",
|
|
45
|
+
"@salesforce/lds-runtime-aura": "^1.261.0",
|
|
46
|
+
"@salesforce/lds-store-nimbus": "^1.261.0",
|
|
47
|
+
"@salesforce/nimbus-plugin-lds": "^1.261.0",
|
|
48
48
|
"babel-plugin-dynamic-import-node": "^2.3.3"
|
|
49
49
|
},
|
|
50
50
|
"luvioBundlesize": [
|