@prosopo/datasets-fs 3.0.38 → 3.0.43
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/.turbo/turbo-build$colon$cjs.log +38 -0
- package/.turbo/turbo-build$colon$tsc.log +32 -0
- package/.turbo/turbo-build.log +42 -0
- package/CHANGELOG.md +51 -0
- package/dist/cli/cli.d.ts +9 -0
- package/dist/cli/cli.d.ts.map +1 -0
- package/dist/cli/cli.js.map +1 -0
- package/dist/cli/cliCommand.d.ts +17 -0
- package/dist/cli/cliCommand.d.ts.map +1 -0
- package/dist/cli/cliCommand.js +31 -0
- package/dist/cli/cliCommand.js.map +1 -0
- package/dist/cli/cliCommandComposite.d.ts +14 -0
- package/dist/cli/cliCommandComposite.d.ts.map +1 -0
- package/dist/cli/cliCommandComposite.js +32 -0
- package/dist/cli/cliCommandComposite.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +34 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/flatten.d.ts +59 -0
- package/dist/commands/flatten.d.ts.map +1 -0
- package/dist/commands/flatten.js +95 -0
- package/dist/commands/flatten.js.map +1 -0
- package/dist/commands/generate.d.ts +115 -0
- package/dist/commands/generate.d.ts.map +1 -0
- package/dist/commands/generate.js +150 -0
- package/dist/commands/generate.js.map +1 -0
- package/dist/commands/generateV1.d.ts +179 -0
- package/dist/commands/generateV1.d.ts.map +1 -0
- package/dist/commands/generateV1.js +169 -0
- package/dist/commands/generateV1.js.map +1 -0
- package/dist/commands/generateV2.d.ts +189 -0
- package/dist/commands/generateV2.d.ts.map +1 -0
- package/dist/commands/generateV2.js +204 -0
- package/dist/commands/generateV2.js.map +1 -0
- package/dist/commands/get.d.ts +35 -0
- package/dist/commands/get.d.ts.map +1 -0
- package/dist/commands/get.js +92 -0
- package/dist/commands/get.js.map +1 -0
- package/dist/commands/labels.d.ts +47 -0
- package/dist/commands/labels.d.ts.map +1 -0
- package/dist/commands/labels.js +48 -0
- package/dist/commands/labels.js.map +1 -0
- package/dist/commands/relocate.d.ts +71 -0
- package/dist/commands/relocate.d.ts.map +1 -0
- package/dist/commands/relocate.js +81 -0
- package/dist/commands/relocate.js.map +1 -0
- package/dist/commands/resize.d.ts +69 -0
- package/dist/commands/resize.d.ts.map +1 -0
- package/dist/commands/resize.js +112 -0
- package/dist/commands/resize.js.map +1 -0
- package/dist/dummy.d.ts +2 -0
- package/dist/dummy.d.ts.map +1 -0
- package/dist/dummy.js +28 -0
- package/dist/dummy.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js.map +1 -0
- package/dist/tests/lodash.unit.test.d.ts +2 -0
- package/dist/tests/lodash.unit.test.d.ts.map +1 -0
- package/dist/tests/lodash.unit.test.js +29 -0
- package/dist/tests/lodash.unit.test.js.map +1 -0
- package/dist/tests/mocked.unit.test.d.ts +2 -0
- package/dist/tests/mocked.unit.test.d.ts.map +1 -0
- package/dist/tests/mocked.unit.test.js +252 -0
- package/dist/tests/mocked.unit.test.js.map +1 -0
- package/dist/tests/utils.d.ts +35 -0
- package/dist/tests/utils.d.ts.map +1 -0
- package/dist/tests/utils.js +101 -0
- package/dist/tests/utils.js.map +1 -0
- package/dist/utils/input.d.ts +24 -0
- package/dist/utils/input.d.ts.map +1 -0
- package/dist/utils/input.js +35 -0
- package/dist/utils/input.js.map +1 -0
- package/dist/utils/inputOutput.d.ts +21 -0
- package/dist/utils/inputOutput.d.ts.map +1 -0
- package/dist/utils/inputOutput.js +10 -0
- package/dist/utils/inputOutput.js.map +1 -0
- package/dist/utils/output.d.ts +36 -0
- package/dist/utils/output.d.ts.map +1 -0
- package/dist/utils/output.js +62 -0
- package/dist/utils/output.js.map +1 -0
- package/package.json +9 -8
- package/vite.cjs.config.ts +1 -1
- package/vite.esm.config.ts +1 -1
- package/vite.test.config.ts +1 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
> @prosopo/datasets-fs@3.0.43 build:cjs
|
|
3
|
+
> NODE_ENV=${NODE_ENV:-development}; vite build --config vite.cjs.config.ts --mode $NODE_ENV
|
|
4
|
+
|
|
5
|
+
ViteCommonJSConfig: .
|
|
6
|
+
{
|
|
7
|
+
tsConfigPaths: [
|
|
8
|
+
'/home/runner/work/captcha/captcha/packages/common/tsconfig.json',
|
|
9
|
+
'/home/runner/work/captcha/captcha/packages/locale/tsconfig.json',
|
|
10
|
+
'/home/runner/work/captcha/captcha/packages/types/tsconfig.json',
|
|
11
|
+
'/home/runner/work/captcha/captcha/packages/util/tsconfig.json',
|
|
12
|
+
'/home/runner/work/captcha/captcha/packages/util-crypto/tsconfig.json'
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
{
|
|
16
|
+
externals: [
|
|
17
|
+
'@prosopo/common',
|
|
18
|
+
'@prosopo/locale',
|
|
19
|
+
'@prosopo/types',
|
|
20
|
+
'@prosopo/util',
|
|
21
|
+
'@prosopo/util-crypto'
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
[36mvite v6.4.1 [32mbuilding SSR bundle for production...[36m[39m
|
|
25
|
+
Bundle build started
|
|
26
|
+
transforming...
|
|
27
|
+
Build end
|
|
28
|
+
[32m✓[39m 2 modules transformed.
|
|
29
|
+
rendering chunks...
|
|
30
|
+
[2mdist/cjs/[22m[36mindex.cjs [39m[1m[2m0.15 kB[22m[1m[22m
|
|
31
|
+
[2mdist/cjs/[22m[36mcli/cli.cjs [39m[1m[2m2.19 kB[22m[1m[22m
|
|
32
|
+
[32m✓ built in 152ms[39m
|
|
33
|
+
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/datasets-fs/src/tests/data/flat/data.json to /home/runner/work/captcha/captcha/packages/datasets-fs/dist/tests/data/flat/data.json
|
|
34
|
+
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/datasets-fs/src/tests/data/flat_resized/captchas_v1.json to /home/runner/work/captcha/captcha/packages/datasets-fs/dist/tests/data/flat_resized/captchas_v1.json
|
|
35
|
+
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/datasets-fs/src/tests/data/flat_resized/captchas_v2.json to /home/runner/work/captcha/captcha/packages/datasets-fs/dist/tests/data/flat_resized/captchas_v2.json
|
|
36
|
+
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/datasets-fs/src/tests/data/flat_resized/data.json to /home/runner/work/captcha/captcha/packages/datasets-fs/dist/tests/data/flat_resized/data.json
|
|
37
|
+
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/datasets-fs/src/tests/data/flat_resized/labels.json to /home/runner/work/captcha/captcha/packages/datasets-fs/dist/tests/data/flat_resized/labels.json
|
|
38
|
+
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/datasets-fs/src/tests/data/flat_resized/relocated_data.json to /home/runner/work/captcha/captcha/packages/datasets-fs/dist/tests/data/flat_resized/relocated_data.json
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
> @prosopo/datasets-fs@3.0.43 build:tsc
|
|
3
|
+
> tsc --build --verbose
|
|
4
|
+
|
|
5
|
+
4:56:59 PM - Projects in this build:
|
|
6
|
+
* ../../dev/config/tsconfig.json
|
|
7
|
+
* ../locale/tsconfig.json
|
|
8
|
+
* ../util/tsconfig.json
|
|
9
|
+
* ../util-crypto/tsconfig.json
|
|
10
|
+
* ../types/tsconfig.json
|
|
11
|
+
* ../common/tsconfig.json
|
|
12
|
+
* ../../dev/workspace/tsconfig.json
|
|
13
|
+
* tsconfig.json
|
|
14
|
+
|
|
15
|
+
4:56:59 PM - Project '../../dev/config/tsconfig.json' is up to date because newest input '../../dev/config/src/dependencies.ts' is older than output '../../dev/config/tsconfig.tsbuildinfo'
|
|
16
|
+
|
|
17
|
+
4:56:59 PM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
|
|
18
|
+
|
|
19
|
+
4:56:59 PM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/verifyRecency.ts' is older than output '../util/tsconfig.tsbuildinfo'
|
|
20
|
+
|
|
21
|
+
4:56:59 PM - Project '../util-crypto/tsconfig.json' is up to date because newest input '../util-crypto/src/types.ts' is older than output '../util-crypto/tsconfig.tsbuildinfo'
|
|
22
|
+
|
|
23
|
+
4:56:59 PM - Project '../types/tsconfig.json' is up to date because newest input '../types/src/procaptcha/api.ts' is older than output '../types/tsconfig.tsbuildinfo'
|
|
24
|
+
|
|
25
|
+
4:57:00 PM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/logger.ts' is older than output '../common/tsconfig.tsbuildinfo'
|
|
26
|
+
|
|
27
|
+
4:57:00 PM - Project '../../dev/workspace/tsconfig.json' is up to date because newest input '../../dev/workspace/src/index.ts' is older than output '../../dev/workspace/tsconfig.tsbuildinfo'
|
|
28
|
+
|
|
29
|
+
4:57:00 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
|
|
30
|
+
|
|
31
|
+
4:57:00 PM - Building project '/home/runner/work/captcha/captcha/packages/datasets-fs/tsconfig.json'...
|
|
32
|
+
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
|
|
2
|
+
> @prosopo/datasets-fs@3.0.43 build
|
|
3
|
+
> npm run build:cross-env -- --mode ${NODE_ENV:-development}
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
> @prosopo/datasets-fs@3.0.43 build:cross-env
|
|
7
|
+
> vite build --config vite.esm.config.ts --mode production
|
|
8
|
+
|
|
9
|
+
ViteEsmConfig: .
|
|
10
|
+
{
|
|
11
|
+
tsConfigPaths: [
|
|
12
|
+
'/home/runner/work/captcha/captcha/packages/common/tsconfig.json',
|
|
13
|
+
'/home/runner/work/captcha/captcha/packages/locale/tsconfig.json',
|
|
14
|
+
'/home/runner/work/captcha/captcha/packages/types/tsconfig.json',
|
|
15
|
+
'/home/runner/work/captcha/captcha/packages/util/tsconfig.json',
|
|
16
|
+
'/home/runner/work/captcha/captcha/packages/util-crypto/tsconfig.json'
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
{
|
|
20
|
+
externals: [
|
|
21
|
+
'@prosopo/common',
|
|
22
|
+
'@prosopo/locale',
|
|
23
|
+
'@prosopo/types',
|
|
24
|
+
'@prosopo/util',
|
|
25
|
+
'@prosopo/util-crypto'
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
[36mvite v6.4.1 [32mbuilding SSR bundle for production...[36m[39m
|
|
29
|
+
Bundle build started
|
|
30
|
+
transforming...
|
|
31
|
+
Build end
|
|
32
|
+
[32m✓[39m 2 modules transformed.
|
|
33
|
+
rendering chunks...
|
|
34
|
+
[2mdist/[22m[36mindex.js [39m[1m[2m0.05 kB[22m[1m[22m
|
|
35
|
+
[2mdist/[22m[36mcli/cli.js [39m[1m[2m1.76 kB[22m[1m[22m
|
|
36
|
+
[32m✓ built in 169ms[39m
|
|
37
|
+
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/datasets-fs/src/tests/data/flat/data.json to /home/runner/work/captcha/captcha/packages/datasets-fs/dist/tests/data/flat/data.json
|
|
38
|
+
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/datasets-fs/src/tests/data/flat_resized/captchas_v1.json to /home/runner/work/captcha/captcha/packages/datasets-fs/dist/tests/data/flat_resized/captchas_v1.json
|
|
39
|
+
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/datasets-fs/src/tests/data/flat_resized/captchas_v2.json to /home/runner/work/captcha/captcha/packages/datasets-fs/dist/tests/data/flat_resized/captchas_v2.json
|
|
40
|
+
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/datasets-fs/src/tests/data/flat_resized/data.json to /home/runner/work/captcha/captcha/packages/datasets-fs/dist/tests/data/flat_resized/data.json
|
|
41
|
+
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/datasets-fs/src/tests/data/flat_resized/labels.json to /home/runner/work/captcha/captcha/packages/datasets-fs/dist/tests/data/flat_resized/labels.json
|
|
42
|
+
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/datasets-fs/src/tests/data/flat_resized/relocated_data.json to /home/runner/work/captcha/captcha/packages/datasets-fs/dist/tests/data/flat_resized/relocated_data.json
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
# @prosopo/datasets-fs
|
|
2
2
|
|
|
3
|
+
## 3.0.43
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
- 0a38892: feat/cross-os-testing
|
|
7
|
+
- a8faa9a: bump license year
|
|
8
|
+
- 3acc333: Release 3.3.0
|
|
9
|
+
- Updated dependencies [a53526b]
|
|
10
|
+
- Updated dependencies [3acc333]
|
|
11
|
+
- Updated dependencies [0a38892]
|
|
12
|
+
- Updated dependencies [1ee3d80]
|
|
13
|
+
- Updated dependencies [a8faa9a]
|
|
14
|
+
- Updated dependencies [7543d17]
|
|
15
|
+
- Updated dependencies [3acc333]
|
|
16
|
+
- @prosopo/util@3.2.5
|
|
17
|
+
- @prosopo/util-crypto@13.5.29
|
|
18
|
+
- @prosopo/types@3.8.0
|
|
19
|
+
- @prosopo/common@3.1.28
|
|
20
|
+
- @prosopo/workspace@3.1.20
|
|
21
|
+
|
|
22
|
+
## 3.0.42
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies [141e462]
|
|
26
|
+
- @prosopo/types@3.7.2
|
|
27
|
+
|
|
28
|
+
## 3.0.41
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [345b25b]
|
|
32
|
+
- @prosopo/types@3.7.1
|
|
33
|
+
|
|
34
|
+
## 3.0.40
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- Updated dependencies [ce70a2b]
|
|
38
|
+
- Updated dependencies [c2b940f]
|
|
39
|
+
- Updated dependencies [f6b5094]
|
|
40
|
+
- @prosopo/types@3.7.0
|
|
41
|
+
- @prosopo/common@3.1.27
|
|
42
|
+
|
|
43
|
+
## 3.0.39
|
|
44
|
+
### Patch Changes
|
|
45
|
+
|
|
46
|
+
- 7d5eb3f: bump
|
|
47
|
+
- Updated dependencies [7d5eb3f]
|
|
48
|
+
- @prosopo/workspace@3.1.19
|
|
49
|
+
- @prosopo/common@3.1.26
|
|
50
|
+
- @prosopo/types@3.6.4
|
|
51
|
+
- @prosopo/util@3.2.4
|
|
52
|
+
- @prosopo/util-crypto@13.5.28
|
|
53
|
+
|
|
3
54
|
## 3.0.38
|
|
4
55
|
### Patch Changes
|
|
5
56
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CliCommandAny } from "./cliCommand.js";
|
|
2
|
+
export declare class Cli {
|
|
3
|
+
#private;
|
|
4
|
+
logger: import("@prosopo/common").Logger;
|
|
5
|
+
constructor(commands: CliCommandAny[]);
|
|
6
|
+
private config;
|
|
7
|
+
exec(args?: string[]): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli/cli.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIrD,qBAAa,GAAG;;IAEf,MAAM,mCAAsC;gBAEhC,QAAQ,EAAE,aAAa,EAAE;IAIrC,OAAO,CAAC,MAAM;IAiDD,IAAI,CAAC,IAAI,GAAE,MAAM,EAA0B;CAKxD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli/cli.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAgBxC,MAAM,OAAO,GAAG,O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AI,CAAC,CAAC;gBAC1B,CAAC;aACD,CAAC,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,uBAAA,IAAI,qBAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;YAE9D,CAAC,GAAG,CAAC,CAAC,OAAO,CACZ,IAAI,EACJ,iBAAiB,EACjB,CAAC,CAAO,EAAE,EAAE,CAAC,CAAC,EACd,GAAG,EAAE;gBACJ,MAAM,IAAI,eAAe,CAAC,qBAAqB,EAAE;oBAChD,OAAO,EAAE,EAAE,KAAK,EAAE,sBAAsB,EAAE;iBAC1C,CAAC,CAAC;YACJ,CAAC,CACD,CAAC;QACH,CAAC;QACD,CAAC,GAAG,CAAC;aACH,aAAa,EAAE;aACf,MAAM,EAAE;aACR,cAAc,CAAC,KAAK,EAAE,sCAAsC,CAAC,CAAC;QAChE,OAAO,CAAC,CAAC;IACV,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,OAAiB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACvD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAC7B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;QAC9D,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CACD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Options } from "yargs";
|
|
2
|
+
import type * as z from "zod";
|
|
3
|
+
export declare abstract class CliCommand<T extends z.ZodTypeAny> {
|
|
4
|
+
logger: import("@prosopo/common").Logger;
|
|
5
|
+
getOptions(): {
|
|
6
|
+
[key: string]: Options;
|
|
7
|
+
};
|
|
8
|
+
abstract getArgSchema(): T;
|
|
9
|
+
parse(args: unknown): Promise<z.infer<T>>;
|
|
10
|
+
_check(args: z.infer<T>): Promise<void>;
|
|
11
|
+
_run(args: z.infer<T>): Promise<void>;
|
|
12
|
+
exec(args: z.infer<T>): Promise<void>;
|
|
13
|
+
getCommandName(): string;
|
|
14
|
+
abstract getDescription(): string;
|
|
15
|
+
}
|
|
16
|
+
export type CliCommandAny = CliCommand<z.ZodTypeAny>;
|
|
17
|
+
//# sourceMappingURL=cliCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cliCommand.d.ts","sourceRoot":"","sources":["../../src/cli/cliCommand.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,KAAK,CAAC,MAAM,KAAK,CAAC;AAE9B,8BAAsB,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU;IACtD,MAAM,mCAAsC;IAGrC,UAAU,IAAI;QACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACvB;aAKe,YAAY,IAAI,CAAC;IAIpB,KAAK,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAQzC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAKvB,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAKrB,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAQ3B,cAAc;aAIL,cAAc,IAAI,MAAM;CACxC;AAED,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { getLogger } from "@prosopo/common";
|
|
2
|
+
import { kebabCase } from "@prosopo/util";
|
|
3
|
+
export class CliCommand {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.logger = getLogger("info", import.meta.url);
|
|
6
|
+
}
|
|
7
|
+
getOptions() {
|
|
8
|
+
return {};
|
|
9
|
+
}
|
|
10
|
+
async parse(args) {
|
|
11
|
+
const argsSchema = this.getArgSchema();
|
|
12
|
+
const parsed = await argsSchema.parse(args);
|
|
13
|
+
this.logger.debug(() => ({ data: { parsed }, msg: "parsed args:" }));
|
|
14
|
+
return parsed;
|
|
15
|
+
}
|
|
16
|
+
async _check(args) {
|
|
17
|
+
this.logger.debug(() => ({ msg: "runChecks", args }));
|
|
18
|
+
}
|
|
19
|
+
async _run(args) {
|
|
20
|
+
this.logger.debug(() => ({ msg: "run", args }));
|
|
21
|
+
}
|
|
22
|
+
async exec(args) {
|
|
23
|
+
this.logger.debug(() => ({ msg: "exec", args }));
|
|
24
|
+
await this._check(args);
|
|
25
|
+
await this._run(args);
|
|
26
|
+
}
|
|
27
|
+
getCommandName() {
|
|
28
|
+
return kebabCase(this.constructor.name);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=cliCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cliCommand.js","sourceRoot":"","sources":["../../src/cli/cliCommand.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAI1C,MAAM,OAAgB,UAAU;IAAhC;QACC,WAAM,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IA6C7C,CAAC;IA1CO,UAAU;QAGhB,OAAO,EAAE,CAAC;IACX,CAAC;IAOM,KAAK,CAAC,KAAK,CAAC,IAAa;QAC/B,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QACvC,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC;QACrE,OAAO,MAAM,CAAC;IACf,CAAC;IAGM,KAAK,CAAC,MAAM,CAAC,IAAgB;QACnC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACvD,CAAC;IAGM,KAAK,CAAC,IAAI,CAAC,IAAgB;QACjC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACjD,CAAC;IAGM,KAAK,CAAC,IAAI,CAAC,IAAgB;QACjC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAEjD,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAExB,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAEM,cAAc;QACpB,OAAO,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;CAGD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Options } from "yargs";
|
|
2
|
+
import type * as z from "zod";
|
|
3
|
+
import { CliCommand, type CliCommandAny } from "./cliCommand.js";
|
|
4
|
+
export declare abstract class CliCommandComposite<T extends z.ZodTypeAny> extends CliCommand<T> {
|
|
5
|
+
#private;
|
|
6
|
+
getCommands(): CliCommandAny[];
|
|
7
|
+
constructor(commands: CliCommandAny[]);
|
|
8
|
+
getOptions(): {
|
|
9
|
+
[key: string]: Options;
|
|
10
|
+
};
|
|
11
|
+
_run(args: z.TypeOf<T>): Promise<void>;
|
|
12
|
+
_check(args: z.TypeOf<T>): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=cliCommandComposite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cliCommandComposite.d.ts","sourceRoot":"","sources":["../../src/cli/cliCommandComposite.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAcrC,OAAO,KAAK,KAAK,CAAC,MAAM,KAAK,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEjE,8BAAsB,mBAAmB,CACxC,CAAC,SAAS,CAAC,CAAC,UAAU,CACrB,SAAQ,UAAU,CAAC,CAAC,CAAC;;IAGf,WAAW;gBAIN,QAAQ,EAAE,aAAa,EAAE;IAMrB,UAAU,IAAI;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE;IAQxC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAOtC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAMxD"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var _CliCommandComposite_commands;
|
|
2
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
|
3
|
+
import { CliCommand } from "./cliCommand.js";
|
|
4
|
+
export class CliCommandComposite extends CliCommand {
|
|
5
|
+
getCommands() {
|
|
6
|
+
return __classPrivateFieldGet(this, _CliCommandComposite_commands, "f");
|
|
7
|
+
}
|
|
8
|
+
constructor(commands) {
|
|
9
|
+
super();
|
|
10
|
+
_CliCommandComposite_commands.set(this, []);
|
|
11
|
+
__classPrivateFieldSet(this, _CliCommandComposite_commands, [...commands], "f");
|
|
12
|
+
}
|
|
13
|
+
getOptions() {
|
|
14
|
+
return __classPrivateFieldGet(this, _CliCommandComposite_commands, "f").reduce((prev, command) => {
|
|
15
|
+
return { ...prev, ...command.getOptions() };
|
|
16
|
+
}, {});
|
|
17
|
+
}
|
|
18
|
+
_run(args) {
|
|
19
|
+
return __classPrivateFieldGet(this, _CliCommandComposite_commands, "f").reduce(async (prev, command) => {
|
|
20
|
+
await prev;
|
|
21
|
+
await command._run(args);
|
|
22
|
+
}, Promise.resolve());
|
|
23
|
+
}
|
|
24
|
+
_check(args) {
|
|
25
|
+
return __classPrivateFieldGet(this, _CliCommandComposite_commands, "f").reduce(async (prev, command) => {
|
|
26
|
+
await prev;
|
|
27
|
+
await command._check(args);
|
|
28
|
+
}, Promise.resolve());
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
_CliCommandComposite_commands = new WeakMap();
|
|
32
|
+
//# sourceMappingURL=cliCommandComposite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cliCommandComposite.js","sourceRoot":"","sources":["../../src/cli/cliCommandComposite.ts"],"names":[],"mappings":";;AAeA,OAAO,EAAE,UAAU,EAAsB,MAAM,iBAAiB,CAAC;AAEjE,MAAM,OAAgB,mBAEpB,SAAQ,UAAa;IAGf,WAAW;QACjB,OAAO,uBAAA,IAAI,qCAAU,CAAC;IACvB,CAAC;IAED,YAAY,QAAyB;QACpC,KAAK,EAAE,CAAC;QAPT,wCAA6B,EAAE,EAAC;QAS/B,uBAAA,IAAI,iCAAa,CAAC,GAAG,QAAQ,CAAC,MAAA,CAAC;IAChC,CAAC;IAEe,UAAU;QAEzB,OAAO,uBAAA,IAAI,qCAAU,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE;YAE9C,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;QAC7C,CAAC,EAAE,EAAE,CAAC,CAAC;IACR,CAAC;IAEe,IAAI,CAAC,IAAiB;QACrC,OAAO,uBAAA,IAAI,qCAAU,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;YACpD,MAAM,IAAI,CAAC;YACX,MAAM,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IACvB,CAAC;IAEe,MAAM,CAAC,IAAiB;QACvC,OAAO,uBAAA,IAAI,qCAAU,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;YACpD,MAAM,IAAI,CAAC;YACX,MAAM,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IACvB,CAAC;CACD"}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { isMain } from "@prosopo/util";
|
|
2
|
+
import { Flatten } from "./commands/flatten.js";
|
|
3
|
+
import { GenerateV1 } from "./commands/generateV1.js";
|
|
4
|
+
import { GenerateV2 } from "./commands/generateV2.js";
|
|
5
|
+
import { Get } from "./commands/get.js";
|
|
6
|
+
import { Labels } from "./commands/labels.js";
|
|
7
|
+
import { Relocate } from "./commands/relocate.js";
|
|
8
|
+
import { Resize } from "./commands/resize.js";
|
|
9
|
+
import { Cli } from "./index.js";
|
|
10
|
+
const main = async () => {
|
|
11
|
+
const commands = [
|
|
12
|
+
new Flatten(),
|
|
13
|
+
new GenerateV1(),
|
|
14
|
+
new GenerateV2(),
|
|
15
|
+
new Get(),
|
|
16
|
+
new Labels(),
|
|
17
|
+
new Relocate(),
|
|
18
|
+
new Resize(),
|
|
19
|
+
];
|
|
20
|
+
const cli = new Cli(commands);
|
|
21
|
+
cli.logger.setLogLevel("debug");
|
|
22
|
+
await cli.exec();
|
|
23
|
+
};
|
|
24
|
+
if (isMain(import.meta.url)) {
|
|
25
|
+
main()
|
|
26
|
+
.then(() => {
|
|
27
|
+
process.exit(0);
|
|
28
|
+
})
|
|
29
|
+
.catch((err) => {
|
|
30
|
+
console.log("error", err);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAc9C,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEjC,MAAM,IAAI,GAAG,KAAK,IAAI,EAAE;IACvB,MAAM,QAAQ,GAAoB;QACjC,IAAI,OAAO,EAAE;QACb,IAAI,UAAU,EAAE;QAChB,IAAI,UAAU,EAAE;QAChB,IAAI,GAAG,EAAE;QACT,IAAI,MAAM,EAAE;QACZ,IAAI,QAAQ,EAAE;QACd,IAAI,MAAM,EAAE;KACZ,CAAC;IACF,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC9B,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAChC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;AAClB,CAAC,CAAC;AAGF,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;IAC7B,IAAI,EAAE;SACJ,IAAI,CAAC,GAAG,EAAE;QACV,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACd,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAC1B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { InputOutputCliCommand } from "../utils/inputOutput.js";
|
|
3
|
+
export declare const ArgsSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
|
|
4
|
+
input: z.ZodString;
|
|
5
|
+
}, {
|
|
6
|
+
output: z.ZodString;
|
|
7
|
+
overwrite: z.ZodOptional<z.ZodBoolean>;
|
|
8
|
+
}>, {
|
|
9
|
+
allowDuplicates: z.ZodOptional<z.ZodBoolean>;
|
|
10
|
+
}>, "strip", z.ZodTypeAny, {
|
|
11
|
+
input: string;
|
|
12
|
+
output: string;
|
|
13
|
+
overwrite?: boolean | undefined;
|
|
14
|
+
allowDuplicates?: boolean | undefined;
|
|
15
|
+
}, {
|
|
16
|
+
input: string;
|
|
17
|
+
output: string;
|
|
18
|
+
overwrite?: boolean | undefined;
|
|
19
|
+
allowDuplicates?: boolean | undefined;
|
|
20
|
+
}>;
|
|
21
|
+
export type ArgsSchemaType = typeof ArgsSchema;
|
|
22
|
+
export type Args = z.infer<ArgsSchemaType>;
|
|
23
|
+
export declare class Flatten extends InputOutputCliCommand<ArgsSchemaType> {
|
|
24
|
+
getArgSchema(): z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
|
|
25
|
+
input: z.ZodString;
|
|
26
|
+
}, {
|
|
27
|
+
output: z.ZodString;
|
|
28
|
+
overwrite: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
+
}>, {
|
|
30
|
+
allowDuplicates: z.ZodOptional<z.ZodBoolean>;
|
|
31
|
+
}>, "strip", z.ZodTypeAny, {
|
|
32
|
+
input: string;
|
|
33
|
+
output: string;
|
|
34
|
+
overwrite?: boolean | undefined;
|
|
35
|
+
allowDuplicates?: boolean | undefined;
|
|
36
|
+
}, {
|
|
37
|
+
input: string;
|
|
38
|
+
output: string;
|
|
39
|
+
overwrite?: boolean | undefined;
|
|
40
|
+
allowDuplicates?: boolean | undefined;
|
|
41
|
+
}>;
|
|
42
|
+
getDescription(): string;
|
|
43
|
+
getOptions(): {
|
|
44
|
+
[key: string]: import("yargs").Options;
|
|
45
|
+
} & {
|
|
46
|
+
input: {
|
|
47
|
+
description: string;
|
|
48
|
+
};
|
|
49
|
+
output: {
|
|
50
|
+
description: string;
|
|
51
|
+
};
|
|
52
|
+
allowDuplicates: {
|
|
53
|
+
boolean: boolean;
|
|
54
|
+
description: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
_run(args: Args): Promise<void>;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=flatten.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flatten.d.ts","sourceRoot":"","sources":["../../src/commands/flatten.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAEN,qBAAqB,EACrB,MAAM,yBAAyB,CAAC;AAEjC,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;EAErB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,UAAU,CAAC;AAC/C,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;AAE3C,qBAAa,OAAQ,SAAQ,qBAAqB,CAAC,cAAc,CAAC;IACjD,YAAY;;;;;;;;;;;;;;;;;;IAIZ,cAAc,IAAI,MAAM;IAIxB,UAAU;;;;;;;;;;;;;;IAiBJ,IAAI,CAAC,IAAI,EAAE,IAAI;CAuFrC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import { ProsopoDatasetError } from "@prosopo/common";
|
|
3
|
+
import { CaptchaItemTypes, DataSchema, } from "@prosopo/types";
|
|
4
|
+
import { at } from "@prosopo/util";
|
|
5
|
+
import { hexHash } from "@prosopo/util-crypto";
|
|
6
|
+
import { lodash } from "@prosopo/util/lodash";
|
|
7
|
+
import cliProgress from "cli-progress";
|
|
8
|
+
import * as z from "zod";
|
|
9
|
+
import { InputOutputArgsSchema, InputOutputCliCommand, } from "../utils/inputOutput.js";
|
|
10
|
+
export const ArgsSchema = InputOutputArgsSchema.extend({
|
|
11
|
+
allowDuplicates: z.boolean().optional(),
|
|
12
|
+
});
|
|
13
|
+
export class Flatten extends InputOutputCliCommand {
|
|
14
|
+
getArgSchema() {
|
|
15
|
+
return ArgsSchema;
|
|
16
|
+
}
|
|
17
|
+
getDescription() {
|
|
18
|
+
return "Restructure a directory containing directories for each image classification into a single directory with a file containing the labels";
|
|
19
|
+
}
|
|
20
|
+
getOptions() {
|
|
21
|
+
return lodash().merge(super.getOptions(), {
|
|
22
|
+
input: {
|
|
23
|
+
description: "Path to the data directory containing subdirectories for each image classification",
|
|
24
|
+
},
|
|
25
|
+
output: {
|
|
26
|
+
description: "Where to put the output file containing the labels and single directory of images",
|
|
27
|
+
},
|
|
28
|
+
allowDuplicates: {
|
|
29
|
+
boolean: true,
|
|
30
|
+
description: "If true, allow duplicates in the data",
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
async _run(args) {
|
|
35
|
+
this.logger.debug(() => ({ msg: "flatten run" }));
|
|
36
|
+
await super._run(args);
|
|
37
|
+
const dataDir = args.input;
|
|
38
|
+
const outDir = args.output;
|
|
39
|
+
this.logger.info(() => ({ msg: "reading data" }));
|
|
40
|
+
const labels = fs
|
|
41
|
+
.readdirSync(dataDir, { withFileTypes: true })
|
|
42
|
+
.filter((dirent) => dirent.isDirectory())
|
|
43
|
+
.map((dirent) => dirent.name)
|
|
44
|
+
.sort();
|
|
45
|
+
const imagesByLabel = labels.map((label) => fs.readdirSync(`${dataDir}/${label}`));
|
|
46
|
+
const imageDir = `${outDir}/images`;
|
|
47
|
+
fs.mkdirSync(imageDir, { recursive: true });
|
|
48
|
+
const bar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);
|
|
49
|
+
const items = [];
|
|
50
|
+
bar.start(imagesByLabel.reduce((acc, images) => acc + images.length, 0), 0);
|
|
51
|
+
labels.forEach((label, i) => {
|
|
52
|
+
const images = at(imagesByLabel, i);
|
|
53
|
+
for (const image of images) {
|
|
54
|
+
bar.increment();
|
|
55
|
+
const extension = image.split(".").pop();
|
|
56
|
+
const content = fs.readFileSync(`${dataDir}/${label}/${image}`);
|
|
57
|
+
const hex = hexHash(content);
|
|
58
|
+
const name = `${hex}.${extension}`;
|
|
59
|
+
if (fs.existsSync(`${imageDir}/${name}`)) {
|
|
60
|
+
for (const item of items) {
|
|
61
|
+
if (item.hash === hex) {
|
|
62
|
+
this.logger.info(() => ({
|
|
63
|
+
msg: `\ndupe: ${label}/${image}`,
|
|
64
|
+
data: { item },
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (!args.allowDuplicates) {
|
|
69
|
+
throw new ProsopoDatasetError("DATASET.DUPLICATE_IMAGE", {
|
|
70
|
+
context: { image: `${label}/${image}` },
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
fs.copyFileSync(`${dataDir}/${label}/${image}`, `${imageDir}/${name}`);
|
|
75
|
+
const filePath = fs.realpathSync(`${imageDir}/${name}`);
|
|
76
|
+
const entry = {
|
|
77
|
+
data: filePath,
|
|
78
|
+
type: CaptchaItemTypes.Image,
|
|
79
|
+
label,
|
|
80
|
+
hash: hex,
|
|
81
|
+
};
|
|
82
|
+
items.push(entry);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
bar.stop();
|
|
86
|
+
const data = {
|
|
87
|
+
items,
|
|
88
|
+
};
|
|
89
|
+
this.logger.info(() => ({ msg: "verifying data", data: { ...data } }));
|
|
90
|
+
DataSchema.parse(data);
|
|
91
|
+
this.logger.info(() => ({ msg: "writing data" }));
|
|
92
|
+
fs.writeFileSync(`${outDir}/data.json`, JSON.stringify(data, null, 4));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=flatten.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flatten.js","sourceRoot":"","sources":["../../src/commands/flatten.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EACN,gBAAgB,EAEhB,UAAU,GAEV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EACN,qBAAqB,EACrB,qBAAqB,GACrB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,CAAC,MAAM,UAAU,GAAG,qBAAqB,CAAC,MAAM,CAAC;IACtD,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACvC,CAAC,CAAC;AAIH,MAAM,OAAO,OAAQ,SAAQ,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CAAC,GAAG,MAAM,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACxE,CAAC;CACD"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { type Item, type LabelledItem } from "@prosopo/types";
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
import { OutputCliCommand } from "../utils/output.js";
|
|
4
|
+
export declare const ArgsSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
5
|
+
output: z.ZodString;
|
|
6
|
+
overwrite: z.ZodOptional<z.ZodBoolean>;
|
|
7
|
+
}, {
|
|
8
|
+
labels: z.ZodOptional<z.ZodString>;
|
|
9
|
+
labelled: z.ZodOptional<z.ZodString>;
|
|
10
|
+
unlabelled: z.ZodOptional<z.ZodString>;
|
|
11
|
+
seed: z.ZodNumber;
|
|
12
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
overwrite: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
allowDuplicates: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
allowDuplicatesLabelled: z.ZodOptional<z.ZodBoolean>;
|
|
16
|
+
allowDuplicatesUnlabelled: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
}>, "strip", z.ZodTypeAny, {
|
|
18
|
+
output: string;
|
|
19
|
+
seed: number;
|
|
20
|
+
overwrite?: boolean | undefined;
|
|
21
|
+
allowDuplicates?: boolean | undefined;
|
|
22
|
+
labels?: string | undefined;
|
|
23
|
+
labelled?: string | undefined;
|
|
24
|
+
unlabelled?: string | undefined;
|
|
25
|
+
size?: number | undefined;
|
|
26
|
+
allowDuplicatesLabelled?: boolean | undefined;
|
|
27
|
+
allowDuplicatesUnlabelled?: boolean | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
output: string;
|
|
30
|
+
seed: number;
|
|
31
|
+
overwrite?: boolean | undefined;
|
|
32
|
+
allowDuplicates?: boolean | undefined;
|
|
33
|
+
labels?: string | undefined;
|
|
34
|
+
labelled?: string | undefined;
|
|
35
|
+
unlabelled?: string | undefined;
|
|
36
|
+
size?: number | undefined;
|
|
37
|
+
allowDuplicatesLabelled?: boolean | undefined;
|
|
38
|
+
allowDuplicatesUnlabelled?: boolean | undefined;
|
|
39
|
+
}>;
|
|
40
|
+
export type ArgsSchemaType = typeof ArgsSchema;
|
|
41
|
+
export type Args = z.infer<ArgsSchemaType>;
|
|
42
|
+
export declare abstract class Generate<T extends ArgsSchemaType> extends OutputCliCommand<T> {
|
|
43
|
+
getOptions(): {
|
|
44
|
+
[key: string]: import("yargs").Options;
|
|
45
|
+
} & {
|
|
46
|
+
output: {
|
|
47
|
+
alias: string;
|
|
48
|
+
string: boolean;
|
|
49
|
+
demand: boolean;
|
|
50
|
+
description: string;
|
|
51
|
+
};
|
|
52
|
+
overwrite: {
|
|
53
|
+
boolean: boolean;
|
|
54
|
+
description: string;
|
|
55
|
+
};
|
|
56
|
+
} & {
|
|
57
|
+
output: {
|
|
58
|
+
description: string;
|
|
59
|
+
};
|
|
60
|
+
labelled: {
|
|
61
|
+
string: boolean;
|
|
62
|
+
demand: boolean;
|
|
63
|
+
description: string;
|
|
64
|
+
};
|
|
65
|
+
unlabelled: {
|
|
66
|
+
string: boolean;
|
|
67
|
+
demand: boolean;
|
|
68
|
+
description: string;
|
|
69
|
+
};
|
|
70
|
+
seed: {
|
|
71
|
+
number: boolean;
|
|
72
|
+
demand: boolean;
|
|
73
|
+
description: string;
|
|
74
|
+
};
|
|
75
|
+
size: {
|
|
76
|
+
number: boolean;
|
|
77
|
+
description: string;
|
|
78
|
+
};
|
|
79
|
+
labels: {
|
|
80
|
+
string: boolean;
|
|
81
|
+
description: string;
|
|
82
|
+
};
|
|
83
|
+
allowDuplicates: {
|
|
84
|
+
boolean: boolean;
|
|
85
|
+
description: string;
|
|
86
|
+
};
|
|
87
|
+
allowDuplicatesLabelled: {
|
|
88
|
+
boolean: boolean;
|
|
89
|
+
description: string;
|
|
90
|
+
};
|
|
91
|
+
allowDuplicatesUnlabelled: {
|
|
92
|
+
boolean: boolean;
|
|
93
|
+
description: string;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
_check(args: Args): Promise<void>;
|
|
97
|
+
labelled: LabelledItem[];
|
|
98
|
+
unlabelled: Item[];
|
|
99
|
+
labels: string[];
|
|
100
|
+
labelledMapFile: string;
|
|
101
|
+
unlabelledMapFile: string;
|
|
102
|
+
labelToImages: {
|
|
103
|
+
[label: string]: Item[];
|
|
104
|
+
};
|
|
105
|
+
targets: string[];
|
|
106
|
+
saltRounds: number;
|
|
107
|
+
private loadData;
|
|
108
|
+
private loadLabels;
|
|
109
|
+
_run(args: Args): Promise<void>;
|
|
110
|
+
}
|
|
111
|
+
export declare const checkDuplicates: (labelled: LabelledItem[], unlabelled: Item[], options: {
|
|
112
|
+
allowDuplicatesLabelled?: boolean;
|
|
113
|
+
allowDuplicatesUnlabelled?: boolean;
|
|
114
|
+
}) => void;
|
|
115
|
+
//# sourceMappingURL=generate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AAEA,OAAO,EAEN,KAAK,IAAI,EAET,KAAK,YAAY,EAEjB,MAAM,gBAAgB,CAAC;AAexB,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAoB,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAExE,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUrB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,UAAU,CAAC;AAC/C,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;AAE3C,8BAAsB,QAAQ,CAC7B,CAAC,SAAS,cAAc,CACvB,SAAQ,gBAAgB,CAAC,CAAC,CAAC;IACZ,UAAU;;;;;;;;;;;;;;;;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