@tablecraft-app/plugin-postgres 1.20.0 → 1.21.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/index.js +21 -6
- package/package.json +1 -1
- package/table-craft-plugin.json +1 -1
package/index.js
CHANGED
|
@@ -10902,12 +10902,17 @@ var connectionFieldSchema = strictObject({
|
|
|
10902
10902
|
group: _enum(CONNECTION_FIELD_GROUPS).optional(),
|
|
10903
10903
|
secret: boolean().optional(),
|
|
10904
10904
|
/**
|
|
10905
|
-
* Draw the field only while the `select` or `checkbox` named by `key` holds `equals
|
|
10906
|
-
* a hidden field is neither checked
|
|
10905
|
+
* Draw the field only while the `select` or `checkbox` named by `key` holds `equals`, or one of
|
|
10906
|
+
* them when it is a list of a select's values (plans 058, 133); a hidden field is neither checked
|
|
10907
|
+
* nor required.
|
|
10907
10908
|
*/
|
|
10908
10909
|
visibleWhen: strictObject({
|
|
10909
10910
|
key: string$1().regex(FIELD_KEY),
|
|
10910
|
-
equals: union([
|
|
10911
|
+
equals: union([
|
|
10912
|
+
string$1(),
|
|
10913
|
+
boolean(),
|
|
10914
|
+
array(string$1()).min(1)
|
|
10915
|
+
])
|
|
10911
10916
|
}).optional()
|
|
10912
10917
|
});
|
|
10913
10918
|
/** `server`: `scheme://user:password@host:port/database?params`; `file`: a path, bare or as a URL. */
|
|
@@ -11019,13 +11024,23 @@ function tlsFieldsDeclared(connection) {
|
|
|
11019
11024
|
return field !== void 0 && tlsFieldFits(role, field, tls);
|
|
11020
11025
|
});
|
|
11021
11026
|
}
|
|
11022
|
-
|
|
11027
|
+
function visibleWhenFits(equals, source) {
|
|
11028
|
+
if (source.kind === "checkbox") return typeof equals === "boolean";
|
|
11029
|
+
if (source.kind !== "select" || typeof equals === "boolean") return false;
|
|
11030
|
+
if (typeof equals === "string") return true;
|
|
11031
|
+
const values = new Set((source.options ?? []).map((option) => option.value));
|
|
11032
|
+
return equals.every((value) => values.has(value));
|
|
11033
|
+
}
|
|
11034
|
+
/**
|
|
11035
|
+
* Every `visibleWhen` names another field of the form, a `select` or a `checkbox`; a list of values
|
|
11036
|
+
* names only a select's declared options.
|
|
11037
|
+
*/
|
|
11023
11038
|
function visibilityFieldsDeclared(connection) {
|
|
11024
11039
|
return connection.fields.every((field) => {
|
|
11025
11040
|
const condition = field.visibleWhen;
|
|
11026
11041
|
if (condition === void 0) return true;
|
|
11027
11042
|
const source = connection.fields.find((candidate) => candidate.key === condition.key);
|
|
11028
|
-
return source !== void 0 && source !== field && (
|
|
11043
|
+
return source !== void 0 && source !== field && visibleWhenFits(condition.equals, source);
|
|
11029
11044
|
});
|
|
11030
11045
|
}
|
|
11031
11046
|
/** Every scheme `url.sets` keys is one of `url.schemes`, and every value it sets is a declared field's. */
|
|
@@ -11068,7 +11083,7 @@ strictObject({
|
|
|
11068
11083
|
message: "tls names a field the form does not declare or one of the wrong kind: mode a select offering every verify mode, files of kind file, the passphrase a secret password",
|
|
11069
11084
|
path: ["tls"]
|
|
11070
11085
|
}).refine(visibilityFieldsDeclared, {
|
|
11071
|
-
message: "visibleWhen names a field the form does not declare, the field itself, or one that is not a select or checkbox, or compares it with a value of the wrong type",
|
|
11086
|
+
message: "visibleWhen names a field the form does not declare, the field itself, or one that is not a select or checkbox, or compares it with a value of the wrong type or a list holding a value the select does not offer",
|
|
11072
11087
|
path: ["fields"]
|
|
11073
11088
|
}).refine(urlSetsDeclared, {
|
|
11074
11089
|
message: "url.sets names a scheme the url does not list, or a field the form does not declare",
|
package/package.json
CHANGED