@sfxcode/mongocamp-server-core 2.7.0 → 2.7.1
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/index.d.mts +3 -0
- package/dist/index.mjs +15 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1908,6 +1908,9 @@ declare class ConfigPersistence {
|
|
|
1908
1908
|
* 2.6.0: a database created before 2.2.0 stored the old default 401 of `AUTH_GRANT_DENIED_STATUS` at its first start, and kept answering
|
|
1909
1909
|
* 401 for a missing grant. A stored 401 that no update set (no `changedAt`, written since 2.6.0) becomes the default 403 once; an
|
|
1910
1910
|
* administrator who wants 401 patches it again (then it is marked and stays).
|
|
1911
|
+
*
|
|
1912
|
+
* 2.7.1: the same for an old default of `CORS_HEADERS_EXPOSED` (see `LegacyCorsHeadersExposed`). Without `x-pagination-next` a browser
|
|
1913
|
+
* cannot read the cursor, and a cursor read (nuxt-ui-mongocamp `fetchAllDocuments`) ends after the first page without saying so.
|
|
1911
1914
|
*/
|
|
1912
1915
|
private upgradeLegacyDefaults;
|
|
1913
1916
|
/** Reads the stored values; at startup also the keys that need a restart, later only the ones that are active at once. */
|
package/dist/index.mjs
CHANGED
|
@@ -1968,6 +1968,11 @@ class ConfigStore {
|
|
|
1968
1968
|
const EnvComment = "updated by env";
|
|
1969
1969
|
const SecretKeys = /* @__PURE__ */ new Set(["CONNECTION_PASSWORD", "AUTH_SECRET"]);
|
|
1970
1970
|
const SecretMask = "********";
|
|
1971
|
+
const LegacyCorsHeadersExposed = [
|
|
1972
|
+
["Content-Type", "x-pagination-rows-per-page", "x-pagination-current-page", "x-pagination-count-rows", "x-pagination-count-pages"],
|
|
1973
|
+
["Content-Type", "x-pagination-rows-per-page", "x-pagination-current-page", "x-pagination-count-rows", "x-pagination-count-pages", "x-request-id"],
|
|
1974
|
+
["Content-Type", "x-pagination-rows-per-page", "x-pagination-current-page", "x-pagination-count-rows", "x-pagination-count-pages", "x-pagination-next", "x-request-id"]
|
|
1975
|
+
];
|
|
1971
1976
|
const RefreshIntervalMillis = 6e4;
|
|
1972
1977
|
function plainNumber(value) {
|
|
1973
1978
|
if (typeof value === "number") {
|
|
@@ -2069,9 +2074,19 @@ class ConfigPersistence {
|
|
|
2069
2074
|
* 2.6.0: a database created before 2.2.0 stored the old default 401 of `AUTH_GRANT_DENIED_STATUS` at its first start, and kept answering
|
|
2070
2075
|
* 401 for a missing grant. A stored 401 that no update set (no `changedAt`, written since 2.6.0) becomes the default 403 once; an
|
|
2071
2076
|
* administrator who wants 401 patches it again (then it is marked and stays).
|
|
2077
|
+
*
|
|
2078
|
+
* 2.7.1: the same for an old default of `CORS_HEADERS_EXPOSED` (see `LegacyCorsHeadersExposed`). Without `x-pagination-next` a browser
|
|
2079
|
+
* cannot read the cursor, and a cursor read (nuxt-ui-mongocamp `fetchAllDocuments`) ends after the first page without saying so.
|
|
2072
2080
|
*/
|
|
2073
2081
|
async upgradeLegacyDefaults() {
|
|
2074
2082
|
await this.collection.updateOne({ key: "AUTH_GRANT_DENIED_STATUS", value: 401, changedAt: { $exists: false } }, { $set: { value: 403 } });
|
|
2083
|
+
const corsHeadersExposed = this.config.definition(ConfigKeys.CorsHeadersExposed);
|
|
2084
|
+
if (corsHeadersExposed) {
|
|
2085
|
+
await this.collection.updateOne(
|
|
2086
|
+
{ key: corsHeadersExposed.key, value: { $in: LegacyCorsHeadersExposed }, changedAt: { $exists: false } },
|
|
2087
|
+
{ $set: { value: toStored(corsHeadersExposed.type, defaultOf(corsHeadersExposed)) } }
|
|
2088
|
+
);
|
|
2089
|
+
}
|
|
2075
2090
|
}
|
|
2076
2091
|
/** Reads the stored values; at startup also the keys that need a restart, later only the ones that are active at once. */
|
|
2077
2092
|
async refresh(startup) {
|