@salesforce/lds-runtime-webruntime 1.380.0-dev5 → 1.380.0-dev7
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/ldsWebruntimeOneStoreInit.js +100 -7
- package/package.json +25 -25
|
@@ -196,6 +196,47 @@ function toError(x) {
|
|
|
196
196
|
}
|
|
197
197
|
return new Error(typeof x === "string" ? x : JSON.stringify(x));
|
|
198
198
|
}
|
|
199
|
+
var HttpStatusCode = /* @__PURE__ */ ((HttpStatusCode2) => {
|
|
200
|
+
HttpStatusCode2[HttpStatusCode2["Ok"] = 200] = "Ok";
|
|
201
|
+
HttpStatusCode2[HttpStatusCode2["Created"] = 201] = "Created";
|
|
202
|
+
HttpStatusCode2[HttpStatusCode2["NoContent"] = 204] = "NoContent";
|
|
203
|
+
HttpStatusCode2[HttpStatusCode2["NotModified"] = 304] = "NotModified";
|
|
204
|
+
HttpStatusCode2[HttpStatusCode2["BadRequest"] = 400] = "BadRequest";
|
|
205
|
+
HttpStatusCode2[HttpStatusCode2["Unauthorized"] = 401] = "Unauthorized";
|
|
206
|
+
HttpStatusCode2[HttpStatusCode2["Forbidden"] = 403] = "Forbidden";
|
|
207
|
+
HttpStatusCode2[HttpStatusCode2["NotFound"] = 404] = "NotFound";
|
|
208
|
+
HttpStatusCode2[HttpStatusCode2["ServerError"] = 500] = "ServerError";
|
|
209
|
+
HttpStatusCode2[HttpStatusCode2["GatewayTimeout"] = 504] = "GatewayTimeout";
|
|
210
|
+
return HttpStatusCode2;
|
|
211
|
+
})(HttpStatusCode || {});
|
|
212
|
+
function getStatusText(status) {
|
|
213
|
+
switch (status) {
|
|
214
|
+
case 200:
|
|
215
|
+
return "OK";
|
|
216
|
+
case 201:
|
|
217
|
+
return "Created";
|
|
218
|
+
case 304:
|
|
219
|
+
return "Not Modified";
|
|
220
|
+
case 400:
|
|
221
|
+
return "Bad Request";
|
|
222
|
+
case 404:
|
|
223
|
+
return "Not Found";
|
|
224
|
+
case 500:
|
|
225
|
+
return "Server Error";
|
|
226
|
+
default:
|
|
227
|
+
return `Unexpected HTTP Status Code: ${status}`;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
class FetchResponse extends Error {
|
|
231
|
+
constructor(status, body, headers) {
|
|
232
|
+
super();
|
|
233
|
+
this.status = status;
|
|
234
|
+
this.body = body;
|
|
235
|
+
this.headers = headers || {};
|
|
236
|
+
this.ok = status >= 200 && this.status <= 299;
|
|
237
|
+
this.statusText = getStatusText(status);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
199
240
|
class InternalError extends Error {
|
|
200
241
|
constructor(data) {
|
|
201
242
|
super();
|
|
@@ -715,7 +756,7 @@ class CacheControlCommand extends BaseCommand {
|
|
|
715
756
|
*/
|
|
716
757
|
buildSubscribe() {
|
|
717
758
|
return (consumerCallback) => {
|
|
718
|
-
if (this.subscriptions.length === 0 && this.operationType === "query") {
|
|
759
|
+
if (this.subscriptions.length === 0 && (this.operationType === "query" || this.operationType === "graphql")) {
|
|
719
760
|
this.subscribeToKeysUsed();
|
|
720
761
|
}
|
|
721
762
|
this.subscriptions.push(consumerCallback);
|
|
@@ -879,9 +920,6 @@ class AuraResourceCacheControlCommand extends AuraCacheControlCommand$1 {
|
|
|
879
920
|
super(services);
|
|
880
921
|
this.services = services;
|
|
881
922
|
}
|
|
882
|
-
execute() {
|
|
883
|
-
return super.execute();
|
|
884
|
-
}
|
|
885
923
|
readFromCache(cache) {
|
|
886
924
|
var _a;
|
|
887
925
|
const data = (_a = cache.get(this.buildKey())) == null ? void 0 : _a.value;
|
|
@@ -2057,6 +2095,59 @@ class MaxAgeCacheControlStrategy extends CacheControlStrategy {
|
|
|
2057
2095
|
];
|
|
2058
2096
|
}
|
|
2059
2097
|
}
|
|
2098
|
+
class OnlyIfCachedCacheControlStrategy extends CacheControlStrategy {
|
|
2099
|
+
execute(options) {
|
|
2100
|
+
const startTime = this.services.instrumentation ? this.services.instrumentation.currentTimeMs() : 0;
|
|
2101
|
+
return this.services.cacheInclusionPolicy.read({
|
|
2102
|
+
l1: this.filteredCache,
|
|
2103
|
+
readFromL1: (l1) => this.requestRunner.readFromCache(l1)
|
|
2104
|
+
}).then((result) => {
|
|
2105
|
+
if (result.isOk()) {
|
|
2106
|
+
this.collectCacheHitInstrumentation(
|
|
2107
|
+
startTime,
|
|
2108
|
+
options == null ? void 0 : options.instrumentationAttributes
|
|
2109
|
+
);
|
|
2110
|
+
return ok$2(void 0);
|
|
2111
|
+
}
|
|
2112
|
+
this.collectCacheMissInstrumentation(startTime, options == null ? void 0 : options.instrumentationAttributes);
|
|
2113
|
+
const error = new UserVisibleError(
|
|
2114
|
+
new FetchResponse(HttpStatusCode.GatewayTimeout, {
|
|
2115
|
+
error: "Cache miss for only-if-cached request"
|
|
2116
|
+
})
|
|
2117
|
+
);
|
|
2118
|
+
return err$1(error);
|
|
2119
|
+
});
|
|
2120
|
+
}
|
|
2121
|
+
get expiredChecks() {
|
|
2122
|
+
return [
|
|
2123
|
+
(cacheControlMetadata) => cacheControlMetadata.type === "no-store"
|
|
2124
|
+
];
|
|
2125
|
+
}
|
|
2126
|
+
collectCacheHitInstrumentation(startTime, instrumentationAttributes) {
|
|
2127
|
+
if (this.services.instrumentation) {
|
|
2128
|
+
const meter = this.services.instrumentation.metrics.getMeter("onestore");
|
|
2129
|
+
meter.createCounter(`command.only-if-cached.cache-hit.count`).add(1, instrumentationAttributes);
|
|
2130
|
+
meter.createHistogram(
|
|
2131
|
+
`command.only-if-cached.cache-hit.duration`
|
|
2132
|
+
).record(
|
|
2133
|
+
this.services.instrumentation.currentTimeMs() - startTime,
|
|
2134
|
+
instrumentationAttributes
|
|
2135
|
+
);
|
|
2136
|
+
}
|
|
2137
|
+
}
|
|
2138
|
+
collectCacheMissInstrumentation(startTime, instrumentationAttributes) {
|
|
2139
|
+
if (this.services.instrumentation) {
|
|
2140
|
+
const meter = this.services.instrumentation.metrics.getMeter("onestore");
|
|
2141
|
+
meter.createCounter(`command.only-if-cached.cache-miss.count`).add(1, instrumentationAttributes);
|
|
2142
|
+
meter.createHistogram(
|
|
2143
|
+
`command.only-if-cached.cache-miss.duration`
|
|
2144
|
+
).record(
|
|
2145
|
+
this.services.instrumentation.currentTimeMs() - startTime,
|
|
2146
|
+
instrumentationAttributes
|
|
2147
|
+
);
|
|
2148
|
+
}
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2060
2151
|
class CacheController {
|
|
2061
2152
|
constructor(services) {
|
|
2062
2153
|
this.services = services;
|
|
@@ -2070,6 +2161,8 @@ class CacheController {
|
|
|
2070
2161
|
return new MaxAgeCacheControlStrategy(this.services, config, requestRunner);
|
|
2071
2162
|
} else if (config.type === "no-cache") {
|
|
2072
2163
|
return new NoCacheCacheControlStrategy(this.services, config, requestRunner);
|
|
2164
|
+
} else if (config.type === "only-if-cached") {
|
|
2165
|
+
return new OnlyIfCachedCacheControlStrategy(this.services, config, requestRunner);
|
|
2073
2166
|
}
|
|
2074
2167
|
throw new Error(`Unknown cache control strategy ${config.type}`);
|
|
2075
2168
|
}
|
|
@@ -3717,7 +3810,7 @@ function buildServiceDescriptor$2(luvio) {
|
|
|
3717
3810
|
},
|
|
3718
3811
|
};
|
|
3719
3812
|
}
|
|
3720
|
-
// version: 1.380.0-
|
|
3813
|
+
// version: 1.380.0-dev7-9c2ae6143e
|
|
3721
3814
|
|
|
3722
3815
|
/**
|
|
3723
3816
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -3743,7 +3836,7 @@ function buildServiceDescriptor$1(notifyRecordUpdateAvailable, getNormalizedLuvi
|
|
|
3743
3836
|
},
|
|
3744
3837
|
};
|
|
3745
3838
|
}
|
|
3746
|
-
// version: 1.380.0-
|
|
3839
|
+
// version: 1.380.0-dev7-9c2ae6143e
|
|
3747
3840
|
|
|
3748
3841
|
/*!
|
|
3749
3842
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -4363,4 +4456,4 @@ const services = [
|
|
|
4363
4456
|
buildServiceDescriptor$1({}, {}),
|
|
4364
4457
|
];
|
|
4365
4458
|
setServices(services);
|
|
4366
|
-
// version: 1.380.0-
|
|
4459
|
+
// version: 1.380.0-dev7-d71b7de4f9
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-runtime-webruntime",
|
|
3
|
-
"version": "1.380.0-
|
|
3
|
+
"version": "1.380.0-dev7",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "LDS engine for Webruntime runtime",
|
|
6
6
|
"main": "dist/ldsWebruntimeOneStoreInit.js",
|
|
@@ -35,35 +35,35 @@
|
|
|
35
35
|
"ready": "yarn build && jest --collectCoverage && yarn test:size && yarn release:corejar"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@luvio/service-provisioner": "5.
|
|
39
|
-
"@luvio/tools-core": "5.
|
|
38
|
+
"@luvio/service-provisioner": " 5.60.0-dev2",
|
|
39
|
+
"@luvio/tools-core": " 5.60.0-dev2",
|
|
40
40
|
"jwt-encode": "1.0.1"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@luvio/command-aura-network": "5.
|
|
44
|
-
"@luvio/command-aura-normalized-cache-control": "5.
|
|
45
|
-
"@luvio/command-aura-resource-cache-control": "5.
|
|
46
|
-
"@luvio/command-fetch-network": "5.
|
|
47
|
-
"@luvio/command-http-normalized-cache-control": "5.
|
|
48
|
-
"@luvio/command-ndjson": "5.
|
|
49
|
-
"@luvio/command-network": "5.
|
|
50
|
-
"@luvio/command-sse": "5.
|
|
51
|
-
"@luvio/command-streaming": "5.
|
|
52
|
-
"@luvio/jwt-manager": "5.
|
|
43
|
+
"@luvio/command-aura-network": " 5.60.0-dev2",
|
|
44
|
+
"@luvio/command-aura-normalized-cache-control": " 5.60.0-dev2",
|
|
45
|
+
"@luvio/command-aura-resource-cache-control": " 5.60.0-dev2",
|
|
46
|
+
"@luvio/command-fetch-network": " 5.60.0-dev2",
|
|
47
|
+
"@luvio/command-http-normalized-cache-control": " 5.60.0-dev2",
|
|
48
|
+
"@luvio/command-ndjson": " 5.60.0-dev2",
|
|
49
|
+
"@luvio/command-network": " 5.60.0-dev2",
|
|
50
|
+
"@luvio/command-sse": " 5.60.0-dev2",
|
|
51
|
+
"@luvio/command-streaming": " 5.60.0-dev2",
|
|
52
|
+
"@luvio/jwt-manager": " 5.60.0-dev2",
|
|
53
53
|
"@luvio/network-adapter-composable": "0.158.7",
|
|
54
54
|
"@luvio/network-adapter-fetch": "0.158.7",
|
|
55
|
-
"@luvio/service-aura-network": "5.
|
|
56
|
-
"@luvio/service-cache": "5.
|
|
57
|
-
"@luvio/service-cache-control": "5.
|
|
58
|
-
"@luvio/service-cache-inclusion-policy": "5.
|
|
59
|
-
"@luvio/service-fetch-network": "5.
|
|
60
|
-
"@luvio/service-instrument-command": "5.
|
|
61
|
-
"@luvio/service-pubsub": "5.
|
|
62
|
-
"@luvio/service-store": "5.
|
|
63
|
-
"@luvio/utils": "5.
|
|
64
|
-
"@salesforce/lds-adapters-uiapi-lex": "^1.380.0-
|
|
65
|
-
"@salesforce/lds-luvio-service": "^1.380.0-
|
|
66
|
-
"@salesforce/lds-luvio-uiapi-records-service": "^1.380.0-
|
|
55
|
+
"@luvio/service-aura-network": " 5.60.0-dev2",
|
|
56
|
+
"@luvio/service-cache": " 5.60.0-dev2",
|
|
57
|
+
"@luvio/service-cache-control": " 5.60.0-dev2",
|
|
58
|
+
"@luvio/service-cache-inclusion-policy": " 5.60.0-dev2",
|
|
59
|
+
"@luvio/service-fetch-network": " 5.60.0-dev2",
|
|
60
|
+
"@luvio/service-instrument-command": " 5.60.0-dev2",
|
|
61
|
+
"@luvio/service-pubsub": " 5.60.0-dev2",
|
|
62
|
+
"@luvio/service-store": " 5.60.0-dev2",
|
|
63
|
+
"@luvio/utils": " 5.60.0-dev2",
|
|
64
|
+
"@salesforce/lds-adapters-uiapi-lex": "^1.380.0-dev7",
|
|
65
|
+
"@salesforce/lds-luvio-service": "^1.380.0-dev7",
|
|
66
|
+
"@salesforce/lds-luvio-uiapi-records-service": "^1.380.0-dev7"
|
|
67
67
|
},
|
|
68
68
|
"luvioBundlesize": [
|
|
69
69
|
{
|