@tablecraft-app/plugin-api 1.1.0 → 1.2.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/dist/errors.d.ts +10 -1
- package/dist/errors.js +18 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/keyspace.d.ts +180 -0
- package/dist/keyspace.js +2 -0
- package/dist/manifest.d.ts +14 -0
- package/dist/manifest.js +65 -3
- package/dist/plugin.d.ts +106 -1
- package/dist/plugin.js +9 -0
- package/dist/testing/index.d.ts +100 -3
- package/dist/testing/index.js +346 -18
- package/dist/url.d.ts +3 -1
- package/dist/url.js +11 -2
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/url.js
CHANGED
|
@@ -112,6 +112,7 @@ function parseServer(form, url, text) {
|
|
|
112
112
|
throw new ConnectionUrlError(`That is not a valid ${scheme}:// URL; check the port is a number and special characters are percent-encoded.`);
|
|
113
113
|
}
|
|
114
114
|
const collected = new Collected(form, url);
|
|
115
|
+
Object.assign(collected.values, url.sets?.[scheme]);
|
|
115
116
|
collected.part("host", decoded(parsed.hostname.replace(/^\[(.*)\]$/, "$1")));
|
|
116
117
|
collected.part("port", parsed.port);
|
|
117
118
|
collected.part("database", decoded(parsed.pathname.replace(LEADING_SLASHES, "")));
|
|
@@ -178,12 +179,20 @@ function encodedPath(path) {
|
|
|
178
179
|
return encodeURI(path).replaceAll("?", "%3F").replaceAll("#", "%23");
|
|
179
180
|
}
|
|
180
181
|
/**
|
|
181
|
-
* The connection URL of `config`, in the
|
|
182
|
+
* The connection URL of `config`, in the first scheme whose `sets` the config holds, else the first
|
|
183
|
+
* that sets nothing. Never carries a secret field, so
|
|
182
184
|
* the result is safe to copy, show and log; params equal to their field's default are left out.
|
|
183
185
|
*/
|
|
184
186
|
export function formatConnectionUrl(form, config) {
|
|
185
187
|
const url = urlOf(form);
|
|
186
|
-
const
|
|
188
|
+
const implied = (candidate) => {
|
|
189
|
+
const sets = url.sets?.[candidate];
|
|
190
|
+
return sets !== undefined && Object.entries(sets).every(([key, value]) => config[key] === value);
|
|
191
|
+
};
|
|
192
|
+
const scheme = url.schemes.find(implied) ??
|
|
193
|
+
url.schemes.find((candidate) => url.sets?.[candidate] === undefined) ??
|
|
194
|
+
url.schemes[0] ??
|
|
195
|
+
"";
|
|
187
196
|
const valueOf = (part) => {
|
|
188
197
|
const key = url.parts[part];
|
|
189
198
|
if (key === undefined || fieldOf(form, key)?.secret === true)
|
package/dist/version.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The plugin contract's version, by semver (decision 106): a host loads a plugin built for the same
|
|
3
3
|
* major and an older or equal minor. Typed `string` so a bump does not change the API report.
|
|
4
4
|
*/
|
|
5
|
-
export const API_VERSION = "1.
|
|
5
|
+
export const API_VERSION = "1.2.0";
|
|
6
6
|
const SEMVER = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
|
|
7
7
|
/** `major.minor.patch` and nothing else; pre-release and build tags are not accepted. */
|
|
8
8
|
export function parseVersion(text) {
|