@sfxcode/mongocamp-server-core 2.7.0 → 2.7.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/index.d.mts +1 -5
- package/dist/index.mjs +29 -6
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1904,11 +1904,7 @@ declare class ConfigPersistence {
|
|
|
1904
1904
|
private persistentDefinitions;
|
|
1905
1905
|
/** Registers the missing keys with their defaults (`registerConfig`) and reads the stored values; the refresh starts if wanted. */
|
|
1906
1906
|
initialize(refreshMillis?: number | false): Promise<void>;
|
|
1907
|
-
/**
|
|
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
|
-
* 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
|
-
* administrator who wants 401 patches it again (then it is marked and stays).
|
|
1911
|
-
*/
|
|
1907
|
+
/** Replaces the stored old defaults of `LegacyDefaults` that nobody set (no `changedAt`, written since 2.6.0) by the current ones. */
|
|
1912
1908
|
private upgradeLegacyDefaults;
|
|
1913
1909
|
/** Reads the stored values; at startup also the keys that need a restart, later only the ones that are active at once. */
|
|
1914
1910
|
refresh(startup: boolean): Promise<void>;
|
package/dist/index.mjs
CHANGED
|
@@ -1968,6 +1968,24 @@ 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
|
+
];
|
|
1976
|
+
const LegacyAggregationStagesDenied = [
|
|
1977
|
+
["$function", "$accumulator", "$where", "$out", "$merge", "$currentOp", "$listSessions"]
|
|
1978
|
+
];
|
|
1979
|
+
const LegacyDefaults = [
|
|
1980
|
+
// a database created before 2.2.0 kept answering 401 for a missing grant
|
|
1981
|
+
{ key: ConfigKeys.AuthGrantDeniedStatus, since: "2.6.0", values: [401] },
|
|
1982
|
+
// without x-pagination-next a browser cannot read the cursor, and a cursor read ends after the first page without saying so
|
|
1983
|
+
{ key: ConfigKeys.CorsHeadersExposed, since: "2.7.1", values: LegacyCorsHeadersExposed },
|
|
1984
|
+
// the Scala server allowed $collStats and $indexStats
|
|
1985
|
+
{ key: ConfigKeys.AggregationStagesDenied, since: "2.7.2", values: LegacyAggregationStagesDenied },
|
|
1986
|
+
// the Scala server served the API reference by default
|
|
1987
|
+
{ key: ConfigKeys.DocsSwagger, since: "2.7.2", values: [true] }
|
|
1988
|
+
];
|
|
1971
1989
|
const RefreshIntervalMillis = 6e4;
|
|
1972
1990
|
function plainNumber(value) {
|
|
1973
1991
|
if (typeof value === "number") {
|
|
@@ -2065,13 +2083,18 @@ class ConfigPersistence {
|
|
|
2065
2083
|
this.timer.unref?.();
|
|
2066
2084
|
}
|
|
2067
2085
|
}
|
|
2068
|
-
/**
|
|
2069
|
-
* 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
|
-
* 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
|
-
* administrator who wants 401 patches it again (then it is marked and stays).
|
|
2072
|
-
*/
|
|
2086
|
+
/** Replaces the stored old defaults of `LegacyDefaults` that nobody set (no `changedAt`, written since 2.6.0) by the current ones. */
|
|
2073
2087
|
async upgradeLegacyDefaults() {
|
|
2074
|
-
|
|
2088
|
+
for (const { key, values } of LegacyDefaults) {
|
|
2089
|
+
const definition = this.config.definition(key);
|
|
2090
|
+
if (!definition) {
|
|
2091
|
+
continue;
|
|
2092
|
+
}
|
|
2093
|
+
await this.collection.updateOne(
|
|
2094
|
+
{ key, value: { $in: values }, changedAt: { $exists: false } },
|
|
2095
|
+
{ $set: { value: toStored(definition.type, defaultOf(definition)) } }
|
|
2096
|
+
);
|
|
2097
|
+
}
|
|
2075
2098
|
}
|
|
2076
2099
|
/** Reads the stored values; at startup also the keys that need a restart, later only the ones that are active at once. */
|
|
2077
2100
|
async refresh(startup) {
|