@sealcode/sealgen 0.8.43 → 0.8.47
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/.eslintrc.js +1 -1
- package/.mocharc.js +10 -0
- package/.nycrc +6 -0
- package/.prettierrc +20 -13
- package/@types/add-route.d.ts +3 -1
- package/@types/build.d.ts +3 -1
- package/@types/forms/fields/boolean.test.d.ts +1 -0
- package/@types/forms/fields/email.test.d.ts +1 -0
- package/@types/forms/fields/enum-multiple.test.d.ts +1 -0
- package/@types/forms/fields/enum.test.d.ts +1 -0
- package/@types/forms/fields/number.test.d.ts +1 -0
- package/@types/forms/fields/pick-from-list.test.d.ts +1 -0
- package/@types/forms/fields/regexp.test.d.ts +1 -0
- package/@types/forms/form.test.d.ts +6 -0
- package/@types/forms/multiform.test.d.ts +1 -0
- package/@types/mount.d.ts +1 -1
- package/@types/page/mountable-with-fields.d.ts +1 -1
- package/@types/test_utils/locator_is_visible.d.ts +2 -0
- package/@types/utils/assert-throws.d.ts +1 -0
- package/@types/utils/browser-creator.d.ts +1 -0
- package/@types/utils/utils.d.ts +1 -0
- package/lib/add-route.js +3 -3
- package/lib/add-route.js.map +1 -1
- package/lib/add-route.test.js +55 -0
- package/lib/add-route.test.js.map +1 -0
- package/lib/build.js +3 -2
- package/lib/build.js.map +1 -1
- package/lib/cli.js +1 -1
- package/lib/cli.js.map +1 -1
- package/lib/example.test.js +4 -0
- package/lib/example.test.js.map +1 -0
- package/lib/forms/fields/boolean.test.js +37 -0
- package/lib/forms/fields/boolean.test.js.map +1 -0
- package/lib/forms/fields/email.test.js +25 -0
- package/lib/forms/fields/email.test.js.map +1 -0
- package/lib/forms/fields/enum-multiple.test.js +32 -0
- package/lib/forms/fields/enum-multiple.test.js.map +1 -0
- package/lib/forms/fields/enum.test.js +26 -0
- package/lib/forms/fields/enum.test.js.map +1 -0
- package/lib/forms/fields/number.js +0 -1
- package/lib/forms/fields/number.js.map +1 -1
- package/lib/forms/fields/number.test.js +35 -0
- package/lib/forms/fields/number.test.js.map +1 -0
- package/lib/forms/fields/pick-from-list.test.js +22 -0
- package/lib/forms/fields/pick-from-list.test.js.map +1 -0
- package/lib/forms/fields/regexp.test.js +26 -0
- package/lib/forms/fields/regexp.test.js.map +1 -0
- package/lib/forms/form.test.js +275 -0
- package/lib/forms/form.test.js.map +1 -0
- package/lib/forms/multiform.js +11 -2
- package/lib/forms/multiform.js.map +1 -1
- package/lib/forms/multiform.test.js +431 -0
- package/lib/forms/multiform.test.js.map +1 -0
- package/lib/make-env.js +1 -1
- package/lib/mount.js +38 -3
- package/lib/mount.js.map +1 -1
- package/lib/test_utils/locator_is_visible.js +15 -0
- package/lib/test_utils/locator_is_visible.js.map +1 -0
- package/lib/utils/assert-throws.js +24 -0
- package/lib/utils/assert-throws.js.map +1 -0
- package/lib/utils/browser-creator.js +14 -0
- package/lib/utils/browser-creator.js.map +1 -0
- package/lib/utils/exec.js.map +1 -1
- package/lib/utils/question.js.map +1 -1
- package/lib/utils/utils.js +3 -1
- package/lib/utils/utils.js.map +1 -1
- package/mocha_root_hooks.js +6 -0
- package/package.json +16 -8
- package/src/add-route.test.ts +58 -0
- package/src/add-route.ts +6 -5
- package/src/build.ts +6 -3
- package/src/cli.ts +2 -2
- package/src/forms/fields/boolean.test.ts +36 -0
- package/src/forms/fields/email.test.ts +24 -0
- package/src/forms/fields/enum-multiple.test.ts +31 -0
- package/src/forms/fields/enum.test.ts +25 -0
- package/src/forms/fields/number.test.ts +34 -0
- package/src/forms/fields/number.ts +0 -1
- package/src/forms/fields/pick-from-list.test.ts +19 -0
- package/src/forms/fields/regexp.test.ts +25 -0
- package/src/forms/form.test.ts +351 -0
- package/src/forms/multiform.test.ts +540 -0
- package/src/forms/multiform.ts +12 -2
- package/src/make-env.ts +1 -1
- package/src/mount.ts +43 -9
- package/src/page/mountable-with-fields.ts +1 -1
- package/src/test_utils/locator_is_visible.ts +17 -0
- package/src/utils/assert-throws.ts +18 -0
- package/src/utils/browser-creator.js +10 -0
- package/src/utils/exec.ts +8 -2
- package/src/utils/question.ts +4 -1
- package/src/utils/utils.ts +1 -0
- package/tsconfig.json +2 -3
- package/.nyc_output/1c5dff80-7861-427a-b1bb-d0686211f098.json +0 -1
- package/.nyc_output/a38a0d08-1f1f-4973-b5e2-efc434c1593d.json +0 -1
- package/.nyc_output/processinfo/1c5dff80-7861-427a-b1bb-d0686211f098.json +0 -1
- package/.nyc_output/processinfo/a38a0d08-1f1f-4973-b5e2-efc434c1593d.json +0 -1
- package/.nyc_output/processinfo/index.json +0 -1
- package/.xunit +0 -3
- package/@types/forms/fields/files-multiple.d.ts +0 -12
- package/coverage/clover.xml +0 -79
- package/lib/forms/fields/files-multiple.js +0 -18
- package/lib/forms/fields/files-multiple.js.map +0 -1
- package/lib/sealgen-url.js +0 -1
- package/lib/sealgen-url.js.map +0 -1
- package/lib/tests/manual/multiform.js +0 -95
- package/lib/tests/manual/multiform.js.map +0 -1
- package/src/tests/manual/multiform.ts +0 -112
- package/test.js +0 -68
- /package/@types/{tests/manual/multiform.d.ts → add-route.test.d.ts} +0 -0
- /package/@types/{sealgen-url.d.ts → example.test.d.ts} +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { firefox } from "playwright";
|
|
2
|
+
|
|
3
|
+
let browser_promise = null;
|
|
4
|
+
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
6
|
+
export async function getBrowser() {
|
|
7
|
+
if (!browser_promise) browser_promise = firefox.launch();
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
9
|
+
return browser_promise;
|
|
10
|
+
}
|
package/src/utils/exec.ts
CHANGED
|
@@ -9,8 +9,14 @@ export async function exec(
|
|
|
9
9
|
let stdout = "";
|
|
10
10
|
let stderr = "";
|
|
11
11
|
const process = spawn(program, args);
|
|
12
|
-
process.stdout.on(
|
|
13
|
-
|
|
12
|
+
process.stdout.on(
|
|
13
|
+
"data",
|
|
14
|
+
(data: Buffer) => (stdout += data.toString())
|
|
15
|
+
);
|
|
16
|
+
process.stderr.on(
|
|
17
|
+
"data",
|
|
18
|
+
(data: Buffer) => (stderr += data.toString())
|
|
19
|
+
);
|
|
14
20
|
process.on("close", (exitCode) => {
|
|
15
21
|
if (exitCode === 0) {
|
|
16
22
|
resolve({ stdout, stderr, exitCode });
|
package/src/utils/question.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { createInterface } from "readline";
|
|
2
2
|
|
|
3
|
-
export async function question(
|
|
3
|
+
export async function question(
|
|
4
|
+
text: string,
|
|
5
|
+
validator: (answer: string) => boolean
|
|
6
|
+
) {
|
|
4
7
|
const rl = createInterface({
|
|
5
8
|
input: process.stdin,
|
|
6
9
|
output: process.stdout,
|
package/src/utils/utils.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { exec } from "./exec";
|
|
|
8
8
|
export { importPath, curryImportPath } from "./import-path";
|
|
9
9
|
export { listCollections } from "./list-collections";
|
|
10
10
|
export { walkDir } from "./walk";
|
|
11
|
+
export { assertThrowsAsync } from "./assert-throws";
|
|
11
12
|
export * from "./make-slug";
|
|
12
13
|
export * from "./render-attributes";
|
|
13
14
|
export * from "./format-external-url";
|
package/tsconfig.json
CHANGED
|
@@ -10,15 +10,14 @@
|
|
|
10
10
|
"esModuleInterop": true,
|
|
11
11
|
"lib": ["ES6", "ESNext"],
|
|
12
12
|
"outDir": "lib",
|
|
13
|
-
"checkJs":
|
|
13
|
+
"checkJs": false,
|
|
14
14
|
"allowJs": true,
|
|
15
15
|
"declarationDir": "@types",
|
|
16
16
|
"resolveJsonModule": true,
|
|
17
17
|
"sourceMap": true,
|
|
18
18
|
"allowSyntheticDefaultImports": true,
|
|
19
|
-
"keyofStringsOnly": true,
|
|
20
19
|
"skipLibCheck": true
|
|
21
20
|
},
|
|
22
21
|
"include": ["src/**/*"],
|
|
23
|
-
"exclude": ["src
|
|
22
|
+
"exclude": ["node_modules/**, src/utils/browser-creator.js"]
|
|
24
23
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"/home/kuba/projects/sealcode/sealgen/src/example.test.ts":{"path":"/home/kuba/projects/sealcode/sealgen/src/example.test.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":3,"column":3}},"1":{"start":{"line":2,"column":4},"end":{"line":2,"column":32}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}},"loc":{"start":{"line":1,"column":29},"end":{"line":3,"column":1}},"line":1},"1":{"name":"(anonymous_1)","decl":{"start":{"line":2,"column":21},"end":{"line":2,"column":22}},"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":30}},"line":2}},"branchMap":{},"s":{"0":1,"1":1},"f":{"0":1,"1":1},"b":{},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"f60a8a2f5051bd47a2ce6553c1f7f9e18533ec03","contentHash":"80209287f8d0b7c368c56582afecd56b1dd5756f6894ddc90f7687a0d13a9bd3"}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"/home/kuba/projects/sealcode/sealgen/.eslintrc.js":{"path":"/home/kuba/projects/sealcode/sealgen/.eslintrc.js","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":38,"column":2}}},"fnMap":{},"branchMap":{},"s":{"0":0},"f":{},"b":{},"all":true},"/home/kuba/projects/sealcode/sealgen/@types/cli.d.ts":{"path":"/home/kuba/projects/sealcode/sealgen/@types/cli.d.ts","statementMap":{},"fnMap":{},"branchMap":{},"s":{},"f":{},"b":{},"all":true},"/home/kuba/projects/sealcode/sealgen/@types/forms/controls/controls.d.ts":{"path":"/home/kuba/projects/sealcode/sealgen/@types/forms/controls/controls.d.ts","statementMap":{},"fnMap":{},"branchMap":{},"s":{},"f":{},"b":{},"all":true},"/home/kuba/projects/sealcode/sealgen/@types/run.d.ts":{"path":"/home/kuba/projects/sealcode/sealgen/@types/run.d.ts","statementMap":{},"fnMap":{},"branchMap":{},"s":{},"f":{},"b":{},"all":true},"/home/kuba/projects/sealcode/sealgen/@types/tests/manual/multiform.d.ts":{"path":"/home/kuba/projects/sealcode/sealgen/@types/tests/manual/multiform.d.ts","statementMap":{},"fnMap":{},"branchMap":{},"s":{},"f":{},"b":{},"all":true},"/home/kuba/projects/sealcode/sealgen/src/example.test.ts":{"path":"/home/kuba/projects/sealcode/sealgen/src/example.test.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":3,"column":3}},"1":{"start":{"line":2,"column":1},"end":{"line":2,"column":28}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}},"loc":{"start":{"line":1,"column":29},"end":{"line":3,"column":1}},"line":1},"1":{"name":"(anonymous_1)","decl":{"start":{"line":2,"column":18},"end":{"line":2,"column":19}},"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":26}},"line":2}},"branchMap":{},"s":{"0":0,"1":0},"f":{"0":0,"1":0},"b":{},"all":true},"/home/kuba/projects/sealcode/sealgen/src/forms/controls/controls.ts":{"path":"/home/kuba/projects/sealcode/sealgen/src/forms/controls/controls.ts","statementMap":{},"fnMap":{},"branchMap":{},"s":{},"f":{},"b":{},"all":true},"/home/kuba/projects/sealcode/sealgen/src/run.ts":{"path":"/home/kuba/projects/sealcode/sealgen/src/run.ts","statementMap":{},"fnMap":{},"branchMap":{},"s":{},"f":{},"b":{},"all":true},"/home/kuba/projects/sealcode/sealgen/test.js":{"path":"/home/kuba/projects/sealcode/sealgen/test.js","statementMap":{"0":{"start":{"line":1,"column":12},"end":{"line":1,"column":26}},"1":{"start":{"line":2,"column":18},"end":{"line":2,"column":42}},"2":{"start":{"line":4,"column":13},"end":{"line":4,"column":34}},"3":{"start":{"line":5,"column":13},"end":{"line":5,"column":22}},"4":{"start":{"line":7,"column":16},"end":{"line":7,"column":38}},"5":{"start":{"line":9,"column":14},"end":{"line":9,"column":31}},"6":{"start":{"line":11,"column":20},"end":{"line":18,"column":1}},"7":{"start":{"line":20,"column":0},"end":{"line":28,"column":1}},"8":{"start":{"line":21,"column":4},"end":{"line":27,"column":6}},"9":{"start":{"line":30,"column":20},"end":{"line":30,"column":40}},"10":{"start":{"line":32,"column":14},"end":{"line":32,"column":55}},"11":{"start":{"line":34,"column":0},"end":{"line":49,"column":1}},"12":{"start":{"line":35,"column":16},"end":{"line":42,"column":5}},"13":{"start":{"line":43,"column":4},"end":{"line":47,"column":5}},"14":{"start":{"line":44,"column":8},"end":{"line":44,"column":39}},"15":{"start":{"line":46,"column":8},"end":{"line":46,"column":41}},"16":{"start":{"line":48,"column":4},"end":{"line":48,"column":35}},"17":{"start":{"line":51,"column":0},"end":{"line":53,"column":1}},"18":{"start":{"line":52,"column":4},"end":{"line":52,"column":46}},"19":{"start":{"line":55,"column":0},"end":{"line":55,"column":42}},"20":{"start":{"line":57,"column":13},"end":{"line":60,"column":2}},"21":{"start":{"line":62,"column":0},"end":{"line":68,"column":3}},"22":{"start":{"line":63,"column":4},"end":{"line":67,"column":5}},"23":{"start":{"line":64,"column":8},"end":{"line":64,"column":24}},"24":{"start":{"line":66,"column":8},"end":{"line":66,"column":27}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":62,"column":16},"end":{"line":62,"column":17}},"loc":{"start":{"line":62,"column":32},"end":{"line":68,"column":1}},"line":62}},"branchMap":{"0":{"loc":{"start":{"line":20,"column":0},"end":{"line":28,"column":1}},"type":"if","locations":[{"start":{"line":20,"column":0},"end":{"line":28,"column":1}},{"start":{"line":20,"column":0},"end":{"line":28,"column":1}}],"line":20},"1":{"loc":{"start":{"line":34,"column":0},"end":{"line":49,"column":1}},"type":"if","locations":[{"start":{"line":34,"column":0},"end":{"line":49,"column":1}},{"start":{"line":34,"column":0},"end":{"line":49,"column":1}}],"line":34},"2":{"loc":{"start":{"line":43,"column":4},"end":{"line":47,"column":5}},"type":"if","locations":[{"start":{"line":43,"column":4},"end":{"line":47,"column":5}},{"start":{"line":43,"column":4},"end":{"line":47,"column":5}}],"line":43},"3":{"loc":{"start":{"line":51,"column":0},"end":{"line":53,"column":1}},"type":"if","locations":[{"start":{"line":51,"column":0},"end":{"line":53,"column":1}},{"start":{"line":51,"column":0},"end":{"line":53,"column":1}}],"line":51},"4":{"loc":{"start":{"line":63,"column":4},"end":{"line":67,"column":5}},"type":"if","locations":[{"start":{"line":63,"column":4},"end":{"line":67,"column":5}},{"start":{"line":63,"column":4},"end":{"line":67,"column":5}}],"line":63}},"s":{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0},"f":{"0":0},"b":{"0":[0,0],"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0]},"all":true}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"parent":null,"pid":78339,"argv":["/usr/bin/node","/home/kuba/projects/sealcode/sealgen/node_modules/.bin/mocha","--recursive","--timeout=10000","--require","source-map-support/register","-r"," ts-node/register","--reporter","xunit","--reporter-option","output=.xunit","src/**/*.test.ts"],"execArgv":[],"cwd":"/home/kuba/projects/sealcode/sealgen","time":1666291707797,"ppid":78328,"coverageFilename":"/home/kuba/projects/sealcode/sealgen/.nyc_output/1c5dff80-7861-427a-b1bb-d0686211f098.json","externalId":"","uuid":"1c5dff80-7861-427a-b1bb-d0686211f098","files":["/home/kuba/projects/sealcode/sealgen/src/example.test.ts"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"parent":null,"pid":78328,"argv":["/usr/bin/node","/home/kuba/projects/sealcode/sealgen/node_modules/.bin/nyc","-all","--exclude","lib","--source-map","false","--reporter","clover","./node_modules/.bin/mocha","--recursive","--timeout=10000","--require","source-map-support/register","-r"," ts-node/register","--reporter","xunit","--reporter-option","output=.xunit","src/**/*.test.ts"],"execArgv":[],"cwd":"/home/kuba/projects/sealcode/sealgen","time":1666291706894,"ppid":78321,"coverageFilename":"/home/kuba/projects/sealcode/sealgen/.nyc_output/a38a0d08-1f1f-4973-b5e2-efc434c1593d.json","externalId":"","uuid":"a38a0d08-1f1f-4973-b5e2-efc434c1593d","files":["/home/kuba/projects/sealcode/sealgen/.eslintrc.js","/home/kuba/projects/sealcode/sealgen/@types/cli.d.ts","/home/kuba/projects/sealcode/sealgen/@types/forms/controls/controls.d.ts","/home/kuba/projects/sealcode/sealgen/@types/run.d.ts","/home/kuba/projects/sealcode/sealgen/@types/tests/manual/multiform.d.ts","/home/kuba/projects/sealcode/sealgen/src/example.test.ts","/home/kuba/projects/sealcode/sealgen/src/forms/controls/controls.ts","/home/kuba/projects/sealcode/sealgen/src/run.ts","/home/kuba/projects/sealcode/sealgen/test.js"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"processes":{"1c5dff80-7861-427a-b1bb-d0686211f098":{"parent":null,"children":[]},"a38a0d08-1f1f-4973-b5e2-efc434c1593d":{"parent":null,"children":[]}},"files":{"/home/kuba/projects/sealcode/sealgen/src/example.test.ts":["1c5dff80-7861-427a-b1bb-d0686211f098","a38a0d08-1f1f-4973-b5e2-efc434c1593d"],"/home/kuba/projects/sealcode/sealgen/.eslintrc.js":["a38a0d08-1f1f-4973-b5e2-efc434c1593d"],"/home/kuba/projects/sealcode/sealgen/@types/cli.d.ts":["a38a0d08-1f1f-4973-b5e2-efc434c1593d"],"/home/kuba/projects/sealcode/sealgen/@types/forms/controls/controls.d.ts":["a38a0d08-1f1f-4973-b5e2-efc434c1593d"],"/home/kuba/projects/sealcode/sealgen/@types/run.d.ts":["a38a0d08-1f1f-4973-b5e2-efc434c1593d"],"/home/kuba/projects/sealcode/sealgen/@types/tests/manual/multiform.d.ts":["a38a0d08-1f1f-4973-b5e2-efc434c1593d"],"/home/kuba/projects/sealcode/sealgen/src/forms/controls/controls.ts":["a38a0d08-1f1f-4973-b5e2-efc434c1593d"],"/home/kuba/projects/sealcode/sealgen/src/run.ts":["a38a0d08-1f1f-4973-b5e2-efc434c1593d"],"/home/kuba/projects/sealcode/sealgen/test.js":["a38a0d08-1f1f-4973-b5e2-efc434c1593d"]},"externalIds":{}}
|
package/.xunit
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { FieldTypes as SealiousFieldTypes } from "sealious";
|
|
2
|
-
import { FormField } from "./field";
|
|
3
|
-
export declare class MultipleFilesField extends FormField<false> {
|
|
4
|
-
collection_field: SealiousFieldTypes.ReverseSingleReference;
|
|
5
|
-
constructor(collection_field: SealiousFieldTypes.ReverseSingleReference);
|
|
6
|
-
getEmptyValue(): undefined;
|
|
7
|
-
parse(): Promise<{
|
|
8
|
-
readonly parsed_value: undefined;
|
|
9
|
-
readonly parsable: true;
|
|
10
|
-
readonly error: null;
|
|
11
|
-
}>;
|
|
12
|
-
}
|
package/coverage/clover.xml
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<coverage generated="1666291709806" clover="3.2.0">
|
|
3
|
-
<project timestamp="1666291709807" name="All files">
|
|
4
|
-
<metrics statements="28" coveredstatements="2" conditionals="10" coveredconditionals="0" methods="3" coveredmethods="2" elements="41" coveredelements="4" complexity="0" loc="28" ncloc="28" packages="6" files="9" classes="9"/>
|
|
5
|
-
<package name="sealgen">
|
|
6
|
-
<metrics statements="26" coveredstatements="0" conditionals="10" coveredconditionals="0" methods="1" coveredmethods="0"/>
|
|
7
|
-
<file name=".eslintrc.js" path="/home/kuba/projects/sealcode/sealgen/.eslintrc.js">
|
|
8
|
-
<metrics statements="1" coveredstatements="0" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
|
|
9
|
-
<line num="1" count="0" type="stmt"/>
|
|
10
|
-
</file>
|
|
11
|
-
<file name="test.js" path="/home/kuba/projects/sealcode/sealgen/test.js">
|
|
12
|
-
<metrics statements="25" coveredstatements="0" conditionals="10" coveredconditionals="0" methods="1" coveredmethods="0"/>
|
|
13
|
-
<line num="1" count="0" type="stmt"/>
|
|
14
|
-
<line num="2" count="0" type="stmt"/>
|
|
15
|
-
<line num="4" count="0" type="stmt"/>
|
|
16
|
-
<line num="5" count="0" type="stmt"/>
|
|
17
|
-
<line num="7" count="0" type="stmt"/>
|
|
18
|
-
<line num="9" count="0" type="stmt"/>
|
|
19
|
-
<line num="11" count="0" type="stmt"/>
|
|
20
|
-
<line num="20" count="0" type="cond" truecount="0" falsecount="2"/>
|
|
21
|
-
<line num="21" count="0" type="stmt"/>
|
|
22
|
-
<line num="30" count="0" type="stmt"/>
|
|
23
|
-
<line num="32" count="0" type="stmt"/>
|
|
24
|
-
<line num="34" count="0" type="cond" truecount="0" falsecount="2"/>
|
|
25
|
-
<line num="35" count="0" type="stmt"/>
|
|
26
|
-
<line num="43" count="0" type="cond" truecount="0" falsecount="2"/>
|
|
27
|
-
<line num="44" count="0" type="stmt"/>
|
|
28
|
-
<line num="46" count="0" type="stmt"/>
|
|
29
|
-
<line num="48" count="0" type="stmt"/>
|
|
30
|
-
<line num="51" count="0" type="cond" truecount="0" falsecount="2"/>
|
|
31
|
-
<line num="52" count="0" type="stmt"/>
|
|
32
|
-
<line num="55" count="0" type="stmt"/>
|
|
33
|
-
<line num="57" count="0" type="stmt"/>
|
|
34
|
-
<line num="62" count="0" type="stmt"/>
|
|
35
|
-
<line num="63" count="0" type="cond" truecount="0" falsecount="2"/>
|
|
36
|
-
<line num="64" count="0" type="stmt"/>
|
|
37
|
-
<line num="66" count="0" type="stmt"/>
|
|
38
|
-
</file>
|
|
39
|
-
</package>
|
|
40
|
-
<package name="sealgen.@types">
|
|
41
|
-
<metrics statements="0" coveredstatements="0" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
|
|
42
|
-
<file name="cli.d.ts" path="/home/kuba/projects/sealcode/sealgen/@types/cli.d.ts">
|
|
43
|
-
<metrics statements="0" coveredstatements="0" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
|
|
44
|
-
</file>
|
|
45
|
-
<file name="run.d.ts" path="/home/kuba/projects/sealcode/sealgen/@types/run.d.ts">
|
|
46
|
-
<metrics statements="0" coveredstatements="0" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
|
|
47
|
-
</file>
|
|
48
|
-
</package>
|
|
49
|
-
<package name="sealgen.@types.forms.controls">
|
|
50
|
-
<metrics statements="0" coveredstatements="0" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
|
|
51
|
-
<file name="controls.d.ts" path="/home/kuba/projects/sealcode/sealgen/@types/forms/controls/controls.d.ts">
|
|
52
|
-
<metrics statements="0" coveredstatements="0" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
|
|
53
|
-
</file>
|
|
54
|
-
</package>
|
|
55
|
-
<package name="sealgen.@types.tests.manual">
|
|
56
|
-
<metrics statements="0" coveredstatements="0" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
|
|
57
|
-
<file name="multiform.d.ts" path="/home/kuba/projects/sealcode/sealgen/@types/tests/manual/multiform.d.ts">
|
|
58
|
-
<metrics statements="0" coveredstatements="0" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
|
|
59
|
-
</file>
|
|
60
|
-
</package>
|
|
61
|
-
<package name="sealgen.src">
|
|
62
|
-
<metrics statements="2" coveredstatements="2" conditionals="0" coveredconditionals="0" methods="2" coveredmethods="2"/>
|
|
63
|
-
<file name="example.test.ts" path="/home/kuba/projects/sealcode/sealgen/src/example.test.ts">
|
|
64
|
-
<metrics statements="2" coveredstatements="2" conditionals="0" coveredconditionals="0" methods="2" coveredmethods="2"/>
|
|
65
|
-
<line num="1" count="1" type="stmt"/>
|
|
66
|
-
<line num="2" count="1" type="stmt"/>
|
|
67
|
-
</file>
|
|
68
|
-
<file name="run.ts" path="/home/kuba/projects/sealcode/sealgen/src/run.ts">
|
|
69
|
-
<metrics statements="0" coveredstatements="0" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
|
|
70
|
-
</file>
|
|
71
|
-
</package>
|
|
72
|
-
<package name="sealgen.src.forms.controls">
|
|
73
|
-
<metrics statements="0" coveredstatements="0" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
|
|
74
|
-
<file name="controls.ts" path="/home/kuba/projects/sealcode/sealgen/src/forms/controls/controls.ts">
|
|
75
|
-
<metrics statements="0" coveredstatements="0" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
|
|
76
|
-
</file>
|
|
77
|
-
</package>
|
|
78
|
-
</project>
|
|
79
|
-
</coverage>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MultipleFilesField = void 0;
|
|
4
|
-
const field_1 = require("./field");
|
|
5
|
-
class MultipleFilesField extends field_1.FormField {
|
|
6
|
-
constructor(collection_field) {
|
|
7
|
-
super(false);
|
|
8
|
-
this.collection_field = collection_field;
|
|
9
|
-
}
|
|
10
|
-
getEmptyValue() {
|
|
11
|
-
return undefined;
|
|
12
|
-
}
|
|
13
|
-
async parse() {
|
|
14
|
-
return { parsed_value: undefined, parsable: true, error: null }; // the control is supposed to do the heavy lifting here
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
exports.MultipleFilesField = MultipleFilesField;
|
|
18
|
-
//# sourceMappingURL=files-multiple.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"files-multiple.js","sourceRoot":"","sources":["../../../src/forms/fields/files-multiple.ts"],"names":[],"mappings":";;;AACA,mCAAoC;AAEpC,MAAa,kBAAmB,SAAQ,iBAAgB;IACvD,YACQ,gBAA2D;QAElE,KAAK,CAAC,KAAK,CAAC,CAAC;QAFN,qBAAgB,GAAhB,gBAAgB,CAA2C;IAGnE,CAAC;IAED,aAAa;QACZ,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,KAAK;QACV,OAAc,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,uDAAuD;IAChI,CAAC;CACD;AAdD,gDAcC"}
|
package/lib/sealgen-url.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=sealgen-url.js.map
|
package/lib/sealgen-url.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sealgen-url.js","sourceRoot":"","sources":["../src/sealgen-url.ts"],"names":[],"mappings":""}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const koa_1 = __importDefault(require("koa"));
|
|
7
|
-
const router_1 = __importDefault(require("@koa/router"));
|
|
8
|
-
const __1 = require("../..");
|
|
9
|
-
const multiform_1 = require("../../forms/multiform");
|
|
10
|
-
const koa_body_1 = __importDefault(require("koa-body"));
|
|
11
|
-
const tempstream_1 = require("tempstream");
|
|
12
|
-
const app = new koa_1.default({ proxy: true });
|
|
13
|
-
const router = new router_1.default();
|
|
14
|
-
const fields1 = {
|
|
15
|
-
email: new __1.Fields.SimpleFormField(true),
|
|
16
|
-
password: new __1.Fields.SimpleFormField(true),
|
|
17
|
-
};
|
|
18
|
-
const form1 = new (class extends __1.Form {
|
|
19
|
-
constructor() {
|
|
20
|
-
super(...arguments);
|
|
21
|
-
this.defaultSuccessMessage = "Form1 done!";
|
|
22
|
-
this.controls = [
|
|
23
|
-
new __1.Controls.FormHeader("form1"),
|
|
24
|
-
new __1.Controls.SimpleInput(fields1.email),
|
|
25
|
-
];
|
|
26
|
-
this.fields = fields1;
|
|
27
|
-
}
|
|
28
|
-
onSubmit() {
|
|
29
|
-
console.log("form1 submit");
|
|
30
|
-
}
|
|
31
|
-
})();
|
|
32
|
-
const fields2 = {
|
|
33
|
-
name: new __1.Fields.SimpleFormField(true),
|
|
34
|
-
surname: new __1.Fields.SimpleFormField(true),
|
|
35
|
-
};
|
|
36
|
-
const form2 = new (class extends __1.Form {
|
|
37
|
-
constructor() {
|
|
38
|
-
super(...arguments);
|
|
39
|
-
this.defaultSuccessMessage = "Form2 done!";
|
|
40
|
-
this.controls = [
|
|
41
|
-
new __1.Controls.FormHeader("form2"),
|
|
42
|
-
new __1.Controls.SimpleInput(fields2.name),
|
|
43
|
-
];
|
|
44
|
-
this.fields = fields2;
|
|
45
|
-
}
|
|
46
|
-
onSubmit() {
|
|
47
|
-
console.log("form2 submit");
|
|
48
|
-
}
|
|
49
|
-
})();
|
|
50
|
-
const multiform = new (class extends multiform_1.Multiform {
|
|
51
|
-
constructor() {
|
|
52
|
-
super(...arguments);
|
|
53
|
-
this.name = "multiform_test";
|
|
54
|
-
this.forms = { form1, form2 };
|
|
55
|
-
}
|
|
56
|
-
async render(ctx, messages, prerenderedForms, show_field_errors = true) {
|
|
57
|
-
return tempstream_1.tempstream /* HTML */ `<!DOCTYPE html>
|
|
58
|
-
<html>
|
|
59
|
-
<head>
|
|
60
|
-
<title>Multiform Test - Sealgen</title>
|
|
61
|
-
<script type="module">
|
|
62
|
-
import hotwiredTurbo from "https://cdn.skypack.dev/pin/@hotwired/turbo@v7.0.0-9XNv1By6uiqRlBzQLO2d/mode=imports,min/optimized/@hotwired/turbo.js";
|
|
63
|
-
</script>
|
|
64
|
-
</head>
|
|
65
|
-
<body>
|
|
66
|
-
${super.render(ctx, messages, prerenderedForms, show_field_errors)}
|
|
67
|
-
</body>
|
|
68
|
-
</html>`;
|
|
69
|
-
}
|
|
70
|
-
})();
|
|
71
|
-
const URL = "/";
|
|
72
|
-
async function handleHtmlPromise(ctx, next) {
|
|
73
|
-
await next();
|
|
74
|
-
if (ctx.body instanceof Promise) {
|
|
75
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
76
|
-
ctx.body = await ctx.body;
|
|
77
|
-
}
|
|
78
|
-
ctx.set("content-type", "text/html;charset=utf-8");
|
|
79
|
-
}
|
|
80
|
-
router.use(URL, koa_body_1.default(), async (ctx, next) => {
|
|
81
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
82
|
-
ctx.$body = ctx.request.body;
|
|
83
|
-
ctx.$app = {
|
|
84
|
-
getString: (_, args, trans) => (typeof trans == "function" ? trans(args) : trans),
|
|
85
|
-
};
|
|
86
|
-
await next();
|
|
87
|
-
}, handleHtmlPromise);
|
|
88
|
-
multiform.init();
|
|
89
|
-
multiform.mount(router, URL);
|
|
90
|
-
// to automatically add trailing slashes:
|
|
91
|
-
router.use(URL, (ctx) => ctx.set("content-type", "text/html;charset=utf-8"));
|
|
92
|
-
app.use(router.routes()).use(router.allowedMethods());
|
|
93
|
-
app.listen(3000);
|
|
94
|
-
console.log("Multiform test app listening on localhost:3000");
|
|
95
|
-
//# sourceMappingURL=multiform.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"multiform.js","sourceRoot":"","sources":["../../../src/tests/manual/multiform.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import Koa, { Context } from "koa";
|
|
2
|
-
import Router from "@koa/router";
|
|
3
|
-
import { Controls, Fields, Form } from "../..";
|
|
4
|
-
import { Multiform } from "../../forms/multiform";
|
|
5
|
-
import koaBody from "koa-body";
|
|
6
|
-
import { FlatTemplatable, tempstream } from "tempstream";
|
|
7
|
-
import { App } from "sealious";
|
|
8
|
-
import { FormMessage } from "../../forms/form";
|
|
9
|
-
const app = new Koa({ proxy: true });
|
|
10
|
-
const router = new Router();
|
|
11
|
-
|
|
12
|
-
const fields1 = {
|
|
13
|
-
email: new Fields.SimpleFormField(true),
|
|
14
|
-
password: new Fields.SimpleFormField(true),
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const form1 = new (class extends Form<typeof fields1, void> {
|
|
18
|
-
defaultSuccessMessage = "Form1 done!";
|
|
19
|
-
controls = [
|
|
20
|
-
new Controls.FormHeader("form1"),
|
|
21
|
-
new Controls.SimpleInput(fields1.email),
|
|
22
|
-
];
|
|
23
|
-
fields = fields1;
|
|
24
|
-
onSubmit() {
|
|
25
|
-
console.log("form1 submit");
|
|
26
|
-
}
|
|
27
|
-
})();
|
|
28
|
-
|
|
29
|
-
const fields2 = {
|
|
30
|
-
name: new Fields.SimpleFormField(true),
|
|
31
|
-
surname: new Fields.SimpleFormField(true),
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const form2 = new (class extends Form<Record<never, unknown>, void> {
|
|
35
|
-
defaultSuccessMessage = "Form2 done!";
|
|
36
|
-
controls = [
|
|
37
|
-
new Controls.FormHeader("form2"),
|
|
38
|
-
new Controls.SimpleInput(fields2.name),
|
|
39
|
-
];
|
|
40
|
-
fields = fields2;
|
|
41
|
-
onSubmit() {
|
|
42
|
-
console.log("form2 submit");
|
|
43
|
-
}
|
|
44
|
-
})();
|
|
45
|
-
|
|
46
|
-
const multiform = new (class extends Multiform {
|
|
47
|
-
name = "multiform_test";
|
|
48
|
-
forms = { form1, form2 };
|
|
49
|
-
async render(
|
|
50
|
-
ctx: Koa.Context,
|
|
51
|
-
messages: FormMessage[],
|
|
52
|
-
prerenderedForms?: Record<string, FlatTemplatable | undefined>,
|
|
53
|
-
show_field_errors: boolean = true
|
|
54
|
-
): Promise<FlatTemplatable> {
|
|
55
|
-
return tempstream/* HTML */ `<!DOCTYPE html>
|
|
56
|
-
<html>
|
|
57
|
-
<head>
|
|
58
|
-
<title>Multiform Test - Sealgen</title>
|
|
59
|
-
<script type="module">
|
|
60
|
-
import hotwiredTurbo from "https://cdn.skypack.dev/pin/@hotwired/turbo@v7.0.0-9XNv1By6uiqRlBzQLO2d/mode=imports,min/optimized/@hotwired/turbo.js";
|
|
61
|
-
</script>
|
|
62
|
-
</head>
|
|
63
|
-
<body>
|
|
64
|
-
${super.render(
|
|
65
|
-
ctx,
|
|
66
|
-
messages,
|
|
67
|
-
prerenderedForms,
|
|
68
|
-
show_field_errors
|
|
69
|
-
)}
|
|
70
|
-
</body>
|
|
71
|
-
</html>`;
|
|
72
|
-
}
|
|
73
|
-
})();
|
|
74
|
-
|
|
75
|
-
const URL = "/";
|
|
76
|
-
|
|
77
|
-
async function handleHtmlPromise(ctx: Context, next: Koa.Next) {
|
|
78
|
-
await next();
|
|
79
|
-
if (ctx.body instanceof Promise) {
|
|
80
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
81
|
-
ctx.body = await ctx.body;
|
|
82
|
-
}
|
|
83
|
-
ctx.set("content-type", "text/html;charset=utf-8");
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
router.use(
|
|
87
|
-
URL,
|
|
88
|
-
koaBody(),
|
|
89
|
-
async (ctx, next) => {
|
|
90
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
91
|
-
ctx.$body = ctx.request.body;
|
|
92
|
-
ctx.$app = {
|
|
93
|
-
getString: (
|
|
94
|
-
_: unknown,
|
|
95
|
-
args: unknown[],
|
|
96
|
-
trans: string | ((...args: unknown[]) => string)
|
|
97
|
-
) => (typeof trans == "function" ? trans(args) : trans),
|
|
98
|
-
} as unknown as App;
|
|
99
|
-
await next();
|
|
100
|
-
},
|
|
101
|
-
handleHtmlPromise
|
|
102
|
-
);
|
|
103
|
-
multiform.init();
|
|
104
|
-
multiform.mount(router, URL);
|
|
105
|
-
// to automatically add trailing slashes:
|
|
106
|
-
|
|
107
|
-
router.use(URL, (ctx) => ctx.set("content-type", "text/html;charset=utf-8"));
|
|
108
|
-
|
|
109
|
-
app.use(router.routes()).use(router.allowedMethods());
|
|
110
|
-
app.listen(3000);
|
|
111
|
-
|
|
112
|
-
console.log("Multiform test app listening on localhost:3000");
|
package/test.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
const mri = require("mri");
|
|
2
|
-
const { spawn } = require("child_process");
|
|
3
|
-
|
|
4
|
-
const argv = process.argv.slice(2);
|
|
5
|
-
const args = mri(argv);
|
|
6
|
-
|
|
7
|
-
const bin_dir = "./node_modules/.bin/";
|
|
8
|
-
|
|
9
|
-
const mocha = bin_dir + "mocha";
|
|
10
|
-
|
|
11
|
-
let mocha_options = [
|
|
12
|
-
"--recursive",
|
|
13
|
-
"--timeout=10000",
|
|
14
|
-
"--require",
|
|
15
|
-
"source-map-support/register",
|
|
16
|
-
"-r",
|
|
17
|
-
" ts-node/register"
|
|
18
|
-
];
|
|
19
|
-
|
|
20
|
-
if (args["test-report"]) {
|
|
21
|
-
mocha_options = [
|
|
22
|
-
...mocha_options,
|
|
23
|
-
"--reporter",
|
|
24
|
-
"xunit",
|
|
25
|
-
"--reporter-option",
|
|
26
|
-
"output=.xunit",
|
|
27
|
-
];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const mocha_files = ["src/**/*.test.ts"];
|
|
31
|
-
|
|
32
|
-
let command = [mocha, ...mocha_options, ...mocha_files];
|
|
33
|
-
|
|
34
|
-
if (args.cover) {
|
|
35
|
-
const nyc = [
|
|
36
|
-
bin_dir + "nyc",
|
|
37
|
-
"-all",
|
|
38
|
-
"--exclude",
|
|
39
|
-
"lib",
|
|
40
|
-
"--source-map",
|
|
41
|
-
"false",
|
|
42
|
-
];
|
|
43
|
-
if (args["cover-html"]) {
|
|
44
|
-
nyc.push("--reporter", "lcov");
|
|
45
|
-
} else {
|
|
46
|
-
nyc.push("--reporter", "clover");
|
|
47
|
-
}
|
|
48
|
-
command = [...nyc, ...command];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (args.debug) {
|
|
52
|
-
command = ["node", "inspect", ...command];
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
console.log("spawning mocha...", command);
|
|
56
|
-
|
|
57
|
-
const proc = spawn(command[0], command.slice(1), {
|
|
58
|
-
stdio: "inherit",
|
|
59
|
-
env: process.env,
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
proc.on("exit", function (code) {
|
|
63
|
-
if (args["test-report"]) {
|
|
64
|
-
process.exit(0);
|
|
65
|
-
} else {
|
|
66
|
-
process.exit(code);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
File without changes
|
|
File without changes
|