druxt 0.25.2-dev.20261119231013 → 0.25.2-dev.20261120230059
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/druxt.esm.js +122 -13
- package/dist/druxt.ssr.js +122 -13
- package/package.json +1 -1
package/dist/druxt.esm.js
CHANGED
|
@@ -70,12 +70,119 @@ const configHasCredentials = (config, sessionCookie = DRUPAL_SESSION_COOKIE) =>
|
|
|
70
70
|
const headers = config.headers || {};
|
|
71
71
|
return headersHaveCredentials(headers, sessionCookie) || headersHaveCredentials(headers.common, sessionCookie) || headersHaveCredentials(headers.get, sessionCookie);
|
|
72
72
|
};
|
|
73
|
-
const hasCredentials = (axios, sessionCookie = DRUPAL_SESSION_COOKIE) => {
|
|
73
|
+
const hasCredentials = (axios, sessionCookie = DRUPAL_SESSION_COOKIE, url = "") => {
|
|
74
74
|
if (!axios)
|
|
75
75
|
return false;
|
|
76
76
|
if (credentialed.has(axios))
|
|
77
77
|
return true;
|
|
78
|
-
return configHasCredentials(axios.defaults, sessionCookie);
|
|
78
|
+
return configHasCredentials(axios.defaults, sessionCookie) || interceptorsAddCredentials(axios, sessionCookie, url);
|
|
79
|
+
};
|
|
80
|
+
const PROBE = Symbol.for("druxt.processCache.probe");
|
|
81
|
+
const isProbe = (config) => !!(config && config[PROBE]);
|
|
82
|
+
const copy = (value) => {
|
|
83
|
+
if (Array.isArray(value))
|
|
84
|
+
return value.map(copy);
|
|
85
|
+
if (!value || typeof value !== "object" || Object.getPrototypeOf(value) !== Object.prototype)
|
|
86
|
+
return value;
|
|
87
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, copy(item)]));
|
|
88
|
+
};
|
|
89
|
+
const METHODS = ["delete", "get", "head", "post", "put", "patch", "options"];
|
|
90
|
+
const flattenHeaders = (headers) => {
|
|
91
|
+
const own = Object.fromEntries(Object.entries(headers).filter(([name]) => name !== "common" && !METHODS.includes(name)));
|
|
92
|
+
const flat = {};
|
|
93
|
+
for (const layer of [headers.common, headers.get, own]) {
|
|
94
|
+
for (const [name, value] of Object.entries(layer || {})) {
|
|
95
|
+
const key = Object.keys(flat).find((item) => item.toLowerCase() === name.toLowerCase());
|
|
96
|
+
if (key === void 0 || key === name)
|
|
97
|
+
flat[name] = value;
|
|
98
|
+
else if (flat[key] !== false)
|
|
99
|
+
flat[key] = value;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (headers.common && typeof headers.common === "object")
|
|
103
|
+
flat.common = headers.common;
|
|
104
|
+
return flat;
|
|
105
|
+
};
|
|
106
|
+
const probeHeaders = (headers) => {
|
|
107
|
+
const find = (name) => Object.keys(headers).find((key) => key.toLowerCase() === String(name).toLowerCase());
|
|
108
|
+
const methods = {
|
|
109
|
+
set(name, value) {
|
|
110
|
+
if (name && typeof name === "object") {
|
|
111
|
+
for (const [key, item] of Object.entries(name))
|
|
112
|
+
methods.set(key, item);
|
|
113
|
+
} else if (value !== void 0 && value !== false) {
|
|
114
|
+
const key = find(name);
|
|
115
|
+
if (key && key !== name)
|
|
116
|
+
delete headers[key];
|
|
117
|
+
headers[name] = value;
|
|
118
|
+
}
|
|
119
|
+
return headers;
|
|
120
|
+
},
|
|
121
|
+
get: (name) => {
|
|
122
|
+
const key = find(name);
|
|
123
|
+
return key ? headers[key] : void 0;
|
|
124
|
+
},
|
|
125
|
+
has: (name) => !!find(name),
|
|
126
|
+
delete: (name) => {
|
|
127
|
+
const key = find(name);
|
|
128
|
+
if (key)
|
|
129
|
+
delete headers[key];
|
|
130
|
+
return !!key;
|
|
131
|
+
},
|
|
132
|
+
toJSON: () => ({ ...headers })
|
|
133
|
+
};
|
|
134
|
+
for (const name of ["Authorization", "Content-Type", "Accept"]) {
|
|
135
|
+
const suffix = name.replace("-", "");
|
|
136
|
+
methods[`set${suffix}`] = (value) => methods.set(name, value);
|
|
137
|
+
methods[`get${suffix}`] = () => methods.get(name);
|
|
138
|
+
methods[`has${suffix}`] = () => methods.has(name);
|
|
139
|
+
}
|
|
140
|
+
for (const [name, fn] of Object.entries(methods)) {
|
|
141
|
+
Object.defineProperty(headers, name, { value: fn, enumerable: false, configurable: true, writable: true });
|
|
142
|
+
}
|
|
143
|
+
return headers;
|
|
144
|
+
};
|
|
145
|
+
const interceptorsAddCredentials = (axios, sessionCookie, url) => {
|
|
146
|
+
const manager = ((axios || {}).interceptors || {}).request;
|
|
147
|
+
if (!manager || typeof manager.forEach !== "function")
|
|
148
|
+
return false;
|
|
149
|
+
const defaults = copy({ ...axios.defaults || {} });
|
|
150
|
+
const headers = probeHeaders(flattenHeaders(copy({ ...(axios.defaults || {}).headers || {} })));
|
|
151
|
+
let config = { ...defaults, headers, method: "get", url, [PROBE]: true };
|
|
152
|
+
const handlers = [];
|
|
153
|
+
manager.forEach((handler) => {
|
|
154
|
+
if (!handler || typeof handler.fulfilled !== "function")
|
|
155
|
+
return;
|
|
156
|
+
if (typeof handler.runWhen === "function") {
|
|
157
|
+
let refused = false;
|
|
158
|
+
try {
|
|
159
|
+
refused = handler.runWhen(config) === false;
|
|
160
|
+
} catch (e) {
|
|
161
|
+
refused = false;
|
|
162
|
+
}
|
|
163
|
+
if (refused)
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
handlers.unshift(handler);
|
|
167
|
+
});
|
|
168
|
+
for (const { fulfilled } of handlers) {
|
|
169
|
+
if (fulfilled.constructor && fulfilled.constructor.name === "AsyncFunction")
|
|
170
|
+
continue;
|
|
171
|
+
let next;
|
|
172
|
+
try {
|
|
173
|
+
next = fulfilled(config);
|
|
174
|
+
} catch (e) {
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
if (next && typeof next.then === "function") {
|
|
178
|
+
next.then(void 0, () => {
|
|
179
|
+
});
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
if (next)
|
|
183
|
+
config = next;
|
|
184
|
+
}
|
|
185
|
+
return configHasCredentials(config, sessionCookie);
|
|
79
186
|
};
|
|
80
187
|
const watchCredentials = (axios, sessionCookie = DRUPAL_SESSION_COOKIE) => {
|
|
81
188
|
const interceptors = ((axios || {}).interceptors || {}).response;
|
|
@@ -123,8 +230,8 @@ const parseCacheLifetime = (headers) => {
|
|
|
123
230
|
const age = parseInt(header("age"), 10) || 0;
|
|
124
231
|
return Math.max(0, lifetime - age);
|
|
125
232
|
};
|
|
126
|
-
const processCache = (scope, { axios, ttl, sessionCookie, maxSize, sizeOf = jsonSize } = {}) => {
|
|
127
|
-
if (!runtime.isServer() || hasCredentials(axios, sessionCookie))
|
|
233
|
+
const processCache = (scope, { axios, ttl, sessionCookie, maxSize, sizeOf = jsonSize, url } = {}) => {
|
|
234
|
+
if (!runtime.isServer() || hasCredentials(axios, sessionCookie, url))
|
|
128
235
|
return null;
|
|
129
236
|
if (!scopes.has(scope))
|
|
130
237
|
scopes.set(scope, new Map());
|
|
@@ -246,7 +353,8 @@ class DruxtClient {
|
|
|
246
353
|
if (options.debug) {
|
|
247
354
|
const log = this.log;
|
|
248
355
|
this.axios.interceptors.request.use((config) => {
|
|
249
|
-
|
|
356
|
+
if (!isProbe(config))
|
|
357
|
+
log.info(config.url);
|
|
250
358
|
return config;
|
|
251
359
|
}, (error) => {
|
|
252
360
|
log.error(error);
|
|
@@ -281,14 +389,14 @@ class DruxtClient {
|
|
|
281
389
|
resetProcessCache();
|
|
282
390
|
this.cacheGeneration += 1;
|
|
283
391
|
}
|
|
284
|
-
processCache(scope) {
|
|
392
|
+
processCache(scope, url = this.options.endpoint) {
|
|
285
393
|
if (!this.options.cache)
|
|
286
394
|
return null;
|
|
287
395
|
const { ttl, sessionCookie, maxSize = DEFAULT_MAX_SIZE, content } = this.options.cache;
|
|
288
396
|
if (scope === "content" && !content)
|
|
289
397
|
return null;
|
|
290
398
|
const sizeOf = scope === "content" ? (value) => byteSize(value.body) : void 0;
|
|
291
|
-
return processCache(scope, { axios: this.axios, ttl, sessionCookie, maxSize, sizeOf });
|
|
399
|
+
return processCache(scope, { axios: this.axios, ttl, sessionCookie, maxSize, sizeOf, url });
|
|
292
400
|
}
|
|
293
401
|
cacheLifetime(document) {
|
|
294
402
|
const record = document && typeof document === "object" && lifetimes.get(document);
|
|
@@ -389,7 +497,7 @@ class DruxtClient {
|
|
|
389
497
|
async get(url, options) {
|
|
390
498
|
const { bypassCache, ...config } = options || {};
|
|
391
499
|
const cacheable = Object.keys(config).every((option) => CACHE_SAFE_OPTIONS.includes(option)) && (typeof config.validateStatus !== "function" || config.validateStatus(200));
|
|
392
|
-
const before = cacheable ? this.processCache("content") : null;
|
|
500
|
+
const before = cacheable ? this.processCache("content", url) : null;
|
|
393
501
|
const key = JSON.stringify([this.indexKey, url]);
|
|
394
502
|
if (before && !bypassCache) {
|
|
395
503
|
const stored = before.get(key);
|
|
@@ -403,7 +511,7 @@ class DruxtClient {
|
|
|
403
511
|
const at = Date.now();
|
|
404
512
|
if (res && res.data && typeof res.data === "object")
|
|
405
513
|
lifetimes.set(res.data, { seconds, at });
|
|
406
|
-
const after = before && this.processCache("content");
|
|
514
|
+
const after = before && this.processCache("content", url);
|
|
407
515
|
const current = after && after.get(key);
|
|
408
516
|
if (after && !(current && current.started > started) && res && res.status === 200 && res.data && typeof res.data === "object") {
|
|
409
517
|
const value = { body: JSON.stringify(res.data), headers: { ...res.headers }, seconds, at, started };
|
|
@@ -440,8 +548,9 @@ class DruxtClient {
|
|
|
440
548
|
return collections;
|
|
441
549
|
}
|
|
442
550
|
async getIndex(resource, prefix) {
|
|
551
|
+
const url = [prefix, this.options.endpoint].join("");
|
|
443
552
|
if (!(this.index || {})[prefix]) {
|
|
444
|
-
const shared = this.processCache("index");
|
|
553
|
+
const shared = this.processCache("index", url);
|
|
445
554
|
const sharedKey = [this.indexKey, prefix || ""].join(":");
|
|
446
555
|
const stored = shared && shared.get(sharedKey);
|
|
447
556
|
if (stored)
|
|
@@ -449,7 +558,7 @@ class DruxtClient {
|
|
|
449
558
|
}
|
|
450
559
|
if (!(this.index || {})[prefix]) {
|
|
451
560
|
const key = [this.indexKey, prefix || ""].join(":");
|
|
452
|
-
const before = this.processCache("index");
|
|
561
|
+
const before = this.processCache("index", url);
|
|
453
562
|
const since = before ? before.generation : void 0;
|
|
454
563
|
const started = this.indexCache.generation;
|
|
455
564
|
const request = this.indexRequests[key] || (this.indexRequests[key] = this.fetchIndex(prefix));
|
|
@@ -464,7 +573,7 @@ class DruxtClient {
|
|
|
464
573
|
return resource ? fetched.index[resource] || false : fetched.index;
|
|
465
574
|
}
|
|
466
575
|
this.index[prefix] = fetched.index;
|
|
467
|
-
const shared = this.processCache("index");
|
|
576
|
+
const shared = this.processCache("index", url);
|
|
468
577
|
if (shared)
|
|
469
578
|
shared.set(key, fetched.index, fetched.lifetime, since);
|
|
470
579
|
}
|
|
@@ -578,7 +687,7 @@ const cacheClearHandler = (secret) => (req, res) => {
|
|
|
578
687
|
};
|
|
579
688
|
|
|
580
689
|
var name = "druxt";
|
|
581
|
-
var version = "0.25.2-dev.
|
|
690
|
+
var version = "0.25.2-dev.20261120230059";
|
|
582
691
|
var description = "The Fully Decoupled Drupal Framework for Nuxt.js.";
|
|
583
692
|
var keywords = [
|
|
584
693
|
"cms",
|
package/dist/druxt.ssr.js
CHANGED
|
@@ -83,12 +83,119 @@ const configHasCredentials = (config, sessionCookie = DRUPAL_SESSION_COOKIE) =>
|
|
|
83
83
|
const headers = config.headers || {};
|
|
84
84
|
return headersHaveCredentials(headers, sessionCookie) || headersHaveCredentials(headers.common, sessionCookie) || headersHaveCredentials(headers.get, sessionCookie);
|
|
85
85
|
};
|
|
86
|
-
const hasCredentials = (axios, sessionCookie = DRUPAL_SESSION_COOKIE) => {
|
|
86
|
+
const hasCredentials = (axios, sessionCookie = DRUPAL_SESSION_COOKIE, url = "") => {
|
|
87
87
|
if (!axios)
|
|
88
88
|
return false;
|
|
89
89
|
if (credentialed.has(axios))
|
|
90
90
|
return true;
|
|
91
|
-
return configHasCredentials(axios.defaults, sessionCookie);
|
|
91
|
+
return configHasCredentials(axios.defaults, sessionCookie) || interceptorsAddCredentials(axios, sessionCookie, url);
|
|
92
|
+
};
|
|
93
|
+
const PROBE = Symbol.for("druxt.processCache.probe");
|
|
94
|
+
const isProbe = (config) => !!(config && config[PROBE]);
|
|
95
|
+
const copy = (value) => {
|
|
96
|
+
if (Array.isArray(value))
|
|
97
|
+
return value.map(copy);
|
|
98
|
+
if (!value || typeof value !== "object" || Object.getPrototypeOf(value) !== Object.prototype)
|
|
99
|
+
return value;
|
|
100
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, copy(item)]));
|
|
101
|
+
};
|
|
102
|
+
const METHODS = ["delete", "get", "head", "post", "put", "patch", "options"];
|
|
103
|
+
const flattenHeaders = (headers) => {
|
|
104
|
+
const own = Object.fromEntries(Object.entries(headers).filter(([name]) => name !== "common" && !METHODS.includes(name)));
|
|
105
|
+
const flat = {};
|
|
106
|
+
for (const layer of [headers.common, headers.get, own]) {
|
|
107
|
+
for (const [name, value] of Object.entries(layer || {})) {
|
|
108
|
+
const key = Object.keys(flat).find((item) => item.toLowerCase() === name.toLowerCase());
|
|
109
|
+
if (key === void 0 || key === name)
|
|
110
|
+
flat[name] = value;
|
|
111
|
+
else if (flat[key] !== false)
|
|
112
|
+
flat[key] = value;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (headers.common && typeof headers.common === "object")
|
|
116
|
+
flat.common = headers.common;
|
|
117
|
+
return flat;
|
|
118
|
+
};
|
|
119
|
+
const probeHeaders = (headers) => {
|
|
120
|
+
const find = (name) => Object.keys(headers).find((key) => key.toLowerCase() === String(name).toLowerCase());
|
|
121
|
+
const methods = {
|
|
122
|
+
set(name, value) {
|
|
123
|
+
if (name && typeof name === "object") {
|
|
124
|
+
for (const [key, item] of Object.entries(name))
|
|
125
|
+
methods.set(key, item);
|
|
126
|
+
} else if (value !== void 0 && value !== false) {
|
|
127
|
+
const key = find(name);
|
|
128
|
+
if (key && key !== name)
|
|
129
|
+
delete headers[key];
|
|
130
|
+
headers[name] = value;
|
|
131
|
+
}
|
|
132
|
+
return headers;
|
|
133
|
+
},
|
|
134
|
+
get: (name) => {
|
|
135
|
+
const key = find(name);
|
|
136
|
+
return key ? headers[key] : void 0;
|
|
137
|
+
},
|
|
138
|
+
has: (name) => !!find(name),
|
|
139
|
+
delete: (name) => {
|
|
140
|
+
const key = find(name);
|
|
141
|
+
if (key)
|
|
142
|
+
delete headers[key];
|
|
143
|
+
return !!key;
|
|
144
|
+
},
|
|
145
|
+
toJSON: () => ({ ...headers })
|
|
146
|
+
};
|
|
147
|
+
for (const name of ["Authorization", "Content-Type", "Accept"]) {
|
|
148
|
+
const suffix = name.replace("-", "");
|
|
149
|
+
methods[`set${suffix}`] = (value) => methods.set(name, value);
|
|
150
|
+
methods[`get${suffix}`] = () => methods.get(name);
|
|
151
|
+
methods[`has${suffix}`] = () => methods.has(name);
|
|
152
|
+
}
|
|
153
|
+
for (const [name, fn] of Object.entries(methods)) {
|
|
154
|
+
Object.defineProperty(headers, name, { value: fn, enumerable: false, configurable: true, writable: true });
|
|
155
|
+
}
|
|
156
|
+
return headers;
|
|
157
|
+
};
|
|
158
|
+
const interceptorsAddCredentials = (axios, sessionCookie, url) => {
|
|
159
|
+
const manager = ((axios || {}).interceptors || {}).request;
|
|
160
|
+
if (!manager || typeof manager.forEach !== "function")
|
|
161
|
+
return false;
|
|
162
|
+
const defaults = copy({ ...axios.defaults || {} });
|
|
163
|
+
const headers = probeHeaders(flattenHeaders(copy({ ...(axios.defaults || {}).headers || {} })));
|
|
164
|
+
let config = { ...defaults, headers, method: "get", url, [PROBE]: true };
|
|
165
|
+
const handlers = [];
|
|
166
|
+
manager.forEach((handler) => {
|
|
167
|
+
if (!handler || typeof handler.fulfilled !== "function")
|
|
168
|
+
return;
|
|
169
|
+
if (typeof handler.runWhen === "function") {
|
|
170
|
+
let refused = false;
|
|
171
|
+
try {
|
|
172
|
+
refused = handler.runWhen(config) === false;
|
|
173
|
+
} catch (e) {
|
|
174
|
+
refused = false;
|
|
175
|
+
}
|
|
176
|
+
if (refused)
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
handlers.unshift(handler);
|
|
180
|
+
});
|
|
181
|
+
for (const { fulfilled } of handlers) {
|
|
182
|
+
if (fulfilled.constructor && fulfilled.constructor.name === "AsyncFunction")
|
|
183
|
+
continue;
|
|
184
|
+
let next;
|
|
185
|
+
try {
|
|
186
|
+
next = fulfilled(config);
|
|
187
|
+
} catch (e) {
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
if (next && typeof next.then === "function") {
|
|
191
|
+
next.then(void 0, () => {
|
|
192
|
+
});
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
if (next)
|
|
196
|
+
config = next;
|
|
197
|
+
}
|
|
198
|
+
return configHasCredentials(config, sessionCookie);
|
|
92
199
|
};
|
|
93
200
|
const watchCredentials = (axios, sessionCookie = DRUPAL_SESSION_COOKIE) => {
|
|
94
201
|
const interceptors = ((axios || {}).interceptors || {}).response;
|
|
@@ -136,8 +243,8 @@ const parseCacheLifetime = (headers) => {
|
|
|
136
243
|
const age = parseInt(header("age"), 10) || 0;
|
|
137
244
|
return Math.max(0, lifetime - age);
|
|
138
245
|
};
|
|
139
|
-
const processCache = (scope, { axios, ttl, sessionCookie, maxSize, sizeOf = jsonSize } = {}) => {
|
|
140
|
-
if (!runtime.isServer() || hasCredentials(axios, sessionCookie))
|
|
246
|
+
const processCache = (scope, { axios, ttl, sessionCookie, maxSize, sizeOf = jsonSize, url } = {}) => {
|
|
247
|
+
if (!runtime.isServer() || hasCredentials(axios, sessionCookie, url))
|
|
141
248
|
return null;
|
|
142
249
|
if (!scopes.has(scope))
|
|
143
250
|
scopes.set(scope, new Map());
|
|
@@ -259,7 +366,8 @@ class DruxtClient {
|
|
|
259
366
|
if (options.debug) {
|
|
260
367
|
const log = this.log;
|
|
261
368
|
this.axios.interceptors.request.use((config) => {
|
|
262
|
-
|
|
369
|
+
if (!isProbe(config))
|
|
370
|
+
log.info(config.url);
|
|
263
371
|
return config;
|
|
264
372
|
}, (error) => {
|
|
265
373
|
log.error(error);
|
|
@@ -294,14 +402,14 @@ class DruxtClient {
|
|
|
294
402
|
resetProcessCache();
|
|
295
403
|
this.cacheGeneration += 1;
|
|
296
404
|
}
|
|
297
|
-
processCache(scope) {
|
|
405
|
+
processCache(scope, url = this.options.endpoint) {
|
|
298
406
|
if (!this.options.cache)
|
|
299
407
|
return null;
|
|
300
408
|
const { ttl, sessionCookie, maxSize = DEFAULT_MAX_SIZE, content } = this.options.cache;
|
|
301
409
|
if (scope === "content" && !content)
|
|
302
410
|
return null;
|
|
303
411
|
const sizeOf = scope === "content" ? (value) => byteSize(value.body) : void 0;
|
|
304
|
-
return processCache(scope, { axios: this.axios, ttl, sessionCookie, maxSize, sizeOf });
|
|
412
|
+
return processCache(scope, { axios: this.axios, ttl, sessionCookie, maxSize, sizeOf, url });
|
|
305
413
|
}
|
|
306
414
|
cacheLifetime(document) {
|
|
307
415
|
const record = document && typeof document === "object" && lifetimes.get(document);
|
|
@@ -402,7 +510,7 @@ class DruxtClient {
|
|
|
402
510
|
async get(url, options) {
|
|
403
511
|
const { bypassCache, ...config } = options || {};
|
|
404
512
|
const cacheable = Object.keys(config).every((option) => CACHE_SAFE_OPTIONS.includes(option)) && (typeof config.validateStatus !== "function" || config.validateStatus(200));
|
|
405
|
-
const before = cacheable ? this.processCache("content") : null;
|
|
513
|
+
const before = cacheable ? this.processCache("content", url) : null;
|
|
406
514
|
const key = JSON.stringify([this.indexKey, url]);
|
|
407
515
|
if (before && !bypassCache) {
|
|
408
516
|
const stored = before.get(key);
|
|
@@ -416,7 +524,7 @@ class DruxtClient {
|
|
|
416
524
|
const at = Date.now();
|
|
417
525
|
if (res && res.data && typeof res.data === "object")
|
|
418
526
|
lifetimes.set(res.data, { seconds, at });
|
|
419
|
-
const after = before && this.processCache("content");
|
|
527
|
+
const after = before && this.processCache("content", url);
|
|
420
528
|
const current = after && after.get(key);
|
|
421
529
|
if (after && !(current && current.started > started) && res && res.status === 200 && res.data && typeof res.data === "object") {
|
|
422
530
|
const value = { body: JSON.stringify(res.data), headers: { ...res.headers }, seconds, at, started };
|
|
@@ -453,8 +561,9 @@ class DruxtClient {
|
|
|
453
561
|
return collections;
|
|
454
562
|
}
|
|
455
563
|
async getIndex(resource, prefix) {
|
|
564
|
+
const url = [prefix, this.options.endpoint].join("");
|
|
456
565
|
if (!(this.index || {})[prefix]) {
|
|
457
|
-
const shared = this.processCache("index");
|
|
566
|
+
const shared = this.processCache("index", url);
|
|
458
567
|
const sharedKey = [this.indexKey, prefix || ""].join(":");
|
|
459
568
|
const stored = shared && shared.get(sharedKey);
|
|
460
569
|
if (stored)
|
|
@@ -462,7 +571,7 @@ class DruxtClient {
|
|
|
462
571
|
}
|
|
463
572
|
if (!(this.index || {})[prefix]) {
|
|
464
573
|
const key = [this.indexKey, prefix || ""].join(":");
|
|
465
|
-
const before = this.processCache("index");
|
|
574
|
+
const before = this.processCache("index", url);
|
|
466
575
|
const since = before ? before.generation : void 0;
|
|
467
576
|
const started = this.indexCache.generation;
|
|
468
577
|
const request = this.indexRequests[key] || (this.indexRequests[key] = this.fetchIndex(prefix));
|
|
@@ -477,7 +586,7 @@ class DruxtClient {
|
|
|
477
586
|
return resource ? fetched.index[resource] || false : fetched.index;
|
|
478
587
|
}
|
|
479
588
|
this.index[prefix] = fetched.index;
|
|
480
|
-
const shared = this.processCache("index");
|
|
589
|
+
const shared = this.processCache("index", url);
|
|
481
590
|
if (shared)
|
|
482
591
|
shared.set(key, fetched.index, fetched.lifetime, since);
|
|
483
592
|
}
|
|
@@ -591,7 +700,7 @@ const cacheClearHandler = (secret) => (req, res) => {
|
|
|
591
700
|
};
|
|
592
701
|
|
|
593
702
|
var name = "druxt";
|
|
594
|
-
var version = "0.25.2-dev.
|
|
703
|
+
var version = "0.25.2-dev.20261120230059";
|
|
595
704
|
var description = "The Fully Decoupled Drupal Framework for Nuxt.js.";
|
|
596
705
|
var keywords = [
|
|
597
706
|
"cms",
|