dicebear 5.0.0-alpha.33 → 5.0.0-alpha.35
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function getOptionsBySchema(schema:
|
|
1
|
+
import { StyleSchema } from '@dicebear/core';
|
|
2
|
+
export declare function getOptionsBySchema(schema: StyleSchema): Record<string, any>;
|
|
@@ -5,36 +5,34 @@ export function getOptionsBySchema(schema) {
|
|
|
5
5
|
continue;
|
|
6
6
|
}
|
|
7
7
|
const property = schema.properties[key];
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
option.type = 'number';
|
|
14
|
-
}
|
|
15
|
-
option.choices = [];
|
|
16
|
-
if (property.enum) {
|
|
17
|
-
option.choices.push(...property.enum.filter((v) => typeof v === 'string'));
|
|
18
|
-
}
|
|
19
|
-
if (typeof property.items === 'object' &&
|
|
20
|
-
'enum' in property.items &&
|
|
21
|
-
property.items.enum) {
|
|
22
|
-
option.choices.push(...property.items.enum.filter((v) => typeof v === 'string'));
|
|
23
|
-
}
|
|
24
|
-
if (option.choices.length === 0) {
|
|
25
|
-
delete option.choices;
|
|
26
|
-
}
|
|
27
|
-
if (property.default !== undefined && property.default !== null) {
|
|
28
|
-
option.default =
|
|
29
|
-
typeof property.default === 'boolean'
|
|
30
|
-
? property.default
|
|
31
|
-
: property.default;
|
|
32
|
-
}
|
|
33
|
-
if (property.description) {
|
|
34
|
-
option.description = property.description;
|
|
35
|
-
}
|
|
36
|
-
result[key] = option;
|
|
8
|
+
const option = {
|
|
9
|
+
type: property.type,
|
|
10
|
+
};
|
|
11
|
+
if (option.type === 'integer') {
|
|
12
|
+
option.type = 'number';
|
|
37
13
|
}
|
|
14
|
+
option.choices = [];
|
|
15
|
+
if (property.enum) {
|
|
16
|
+
option.choices.push(...property.enum.filter((v) => typeof v === 'string'));
|
|
17
|
+
}
|
|
18
|
+
if (typeof property.items === 'object' &&
|
|
19
|
+
'enum' in property.items &&
|
|
20
|
+
property.items.enum) {
|
|
21
|
+
option.choices.push(...property.items.enum.filter((v) => typeof v === 'string'));
|
|
22
|
+
}
|
|
23
|
+
if (option.choices.length === 0) {
|
|
24
|
+
delete option.choices;
|
|
25
|
+
}
|
|
26
|
+
if (property.default !== undefined && property.default !== null) {
|
|
27
|
+
option.default =
|
|
28
|
+
typeof property.default === 'boolean'
|
|
29
|
+
? property.default
|
|
30
|
+
: property.default;
|
|
31
|
+
}
|
|
32
|
+
if (property.description) {
|
|
33
|
+
option.description = property.description;
|
|
34
|
+
}
|
|
35
|
+
result[key] = option;
|
|
38
36
|
}
|
|
39
37
|
return result;
|
|
40
38
|
}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import type { Style } from '@dicebear/core';
|
|
2
|
-
|
|
3
|
-
export declare function getStyleCommandSchema(style: Style<any>): JSONSchema7;
|
|
1
|
+
import type { Style, StyleSchema } from '@dicebear/core';
|
|
2
|
+
export declare function getStyleCommandSchema(style: Style<any>): StyleSchema;
|
|
@@ -1,30 +1,25 @@
|
|
|
1
1
|
import { schema as coreSchema } from '@dicebear/core';
|
|
2
|
-
import mergeAllOf from 'json-schema-merge-allof';
|
|
3
2
|
export function getStyleCommandSchema(style) {
|
|
4
|
-
return
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
default: 1,
|
|
12
|
-
},
|
|
13
|
-
format: {
|
|
14
|
-
type: 'string',
|
|
15
|
-
enum: ['svg', 'png', 'jpg', 'jpeg'],
|
|
16
|
-
default: 'svg',
|
|
17
|
-
},
|
|
18
|
-
exif: {
|
|
19
|
-
description: 'Include Exif Metadata',
|
|
20
|
-
type: 'boolean',
|
|
21
|
-
default: false,
|
|
22
|
-
},
|
|
23
|
-
},
|
|
3
|
+
return {
|
|
4
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
5
|
+
properties: {
|
|
6
|
+
count: {
|
|
7
|
+
description: 'Defines how many avatars to create.',
|
|
8
|
+
type: 'number',
|
|
9
|
+
default: 1,
|
|
24
10
|
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
11
|
+
format: {
|
|
12
|
+
type: 'string',
|
|
13
|
+
enum: ['svg', 'png', 'jpg', 'jpeg'],
|
|
14
|
+
default: 'svg',
|
|
15
|
+
},
|
|
16
|
+
exif: {
|
|
17
|
+
description: 'Include Exif Metadata',
|
|
18
|
+
type: 'boolean',
|
|
19
|
+
default: false,
|
|
20
|
+
},
|
|
21
|
+
...coreSchema.properties,
|
|
22
|
+
...style.schema.properties,
|
|
23
|
+
},
|
|
24
|
+
};
|
|
30
25
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StyleSchema } from '@dicebear/core';
|
|
2
2
|
import { ArgumentsCamelCase } from 'yargs';
|
|
3
|
-
export declare function validateInputBySchema(input: ArgumentsCamelCase<unknown>, schema:
|
|
3
|
+
export declare function validateInputBySchema(input: ArgumentsCamelCase<unknown>, schema: StyleSchema): any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dicebear",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.35",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "CLI for DiceBear - An avatar library for designers and developers",
|
|
6
6
|
"homepage": "https://github.com/dicebear/dicebear",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"prepublishOnly": "npm run build"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@dicebear/collection": "^5.0.0-alpha.
|
|
29
|
-
"@dicebear/core": "^5.0.0-alpha.
|
|
28
|
+
"@dicebear/collection": "^5.0.0-alpha.35",
|
|
29
|
+
"@dicebear/core": "^5.0.0-alpha.35",
|
|
30
30
|
"@resvg/resvg-js": "^2.0.0",
|
|
31
31
|
"ajv": "^8.11.0",
|
|
32
32
|
"chalk": "^5.0.1",
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
"cli-progress": "^3.10.0",
|
|
35
35
|
"exiftool-vendored": "^16.3.0",
|
|
36
36
|
"fs-extra": "^10.1.0",
|
|
37
|
-
"json-schema-merge-allof": "^0.8.1",
|
|
38
37
|
"p-queue": "^7.2.0",
|
|
39
38
|
"sharp": "^0.30.4",
|
|
40
39
|
"update-notifier": "^5.1.0",
|
|
@@ -44,8 +43,6 @@
|
|
|
44
43
|
"@tsconfig/recommended": "^1.0.1",
|
|
45
44
|
"@types/cli-progress": "^3.9.2",
|
|
46
45
|
"@types/fs-extra": "^9.0.13",
|
|
47
|
-
"@types/json-schema": "^7.0.11",
|
|
48
|
-
"@types/json-schema-merge-allof": "^0.6.1",
|
|
49
46
|
"@types/update-notifier": "^5.1.0",
|
|
50
47
|
"@types/yargs": "^17.0.10",
|
|
51
48
|
"del-cli": "^4.0.1",
|
|
@@ -54,5 +51,5 @@
|
|
|
54
51
|
"engines": {
|
|
55
52
|
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
56
53
|
},
|
|
57
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "e6f55ebe3a5b8a60394744d95533528bb8b119ef"
|
|
58
55
|
}
|