@enslo/sd-parsers-web 1.0.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/LICENSE +22 -0
- package/LICENSE.txt +21 -0
- package/README.md +221 -0
- package/dist/data/generators.d.ts +12 -0
- package/dist/data/generators.d.ts.map +1 -0
- package/dist/data/index.d.ts +10 -0
- package/dist/data/index.d.ts.map +1 -0
- package/dist/data/model.d.ts +25 -0
- package/dist/data/model.d.ts.map +1 -0
- package/dist/data/prompt.d.ts +20 -0
- package/dist/data/prompt.d.ts.map +1 -0
- package/dist/data/promptInfo.d.ts +56 -0
- package/dist/data/promptInfo.d.ts.map +1 -0
- package/dist/data/sampler.d.ts +24 -0
- package/dist/data/sampler.d.ts.map +1 -0
- package/dist/exceptions.d.ts +13 -0
- package/dist/exceptions.d.ts.map +1 -0
- package/dist/extractors/eagerness.d.ts +9 -0
- package/dist/extractors/eagerness.d.ts.map +1 -0
- package/dist/extractors/extractors.d.ts +30 -0
- package/dist/extractors/extractors.d.ts.map +1 -0
- package/dist/extractors/index.d.ts +14 -0
- package/dist/extractors/index.d.ts.map +1 -0
- package/dist/imageUtils.d.ts +16 -0
- package/dist/imageUtils.d.ts.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/parserManager.d.ts +26 -0
- package/dist/parserManager.d.ts.map +1 -0
- package/dist/parsers/automatic1111.d.ts +10 -0
- package/dist/parsers/automatic1111.d.ts.map +1 -0
- package/dist/parsers/comfyui.d.ts +10 -0
- package/dist/parsers/comfyui.d.ts.map +1 -0
- package/dist/parsers/dummy.d.ts +10 -0
- package/dist/parsers/dummy.d.ts.map +1 -0
- package/dist/parsers/fooocus.d.ts +10 -0
- package/dist/parsers/fooocus.d.ts.map +1 -0
- package/dist/parsers/index.d.ts +17 -0
- package/dist/parsers/index.d.ts.map +1 -0
- package/dist/parsers/invokeai.d.ts +13 -0
- package/dist/parsers/invokeai.d.ts.map +1 -0
- package/dist/parsers/novelai.d.ts +10 -0
- package/dist/parsers/novelai.d.ts.map +1 -0
- package/dist/parsers/parser.d.ts +38 -0
- package/dist/parsers/parser.d.ts.map +1 -0
- package/dist/sd-parsers-web.es.js +751 -0
- package/dist/sd-parsers-web.umd.js +4 -0
- package/package.json +62 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dummy.d.ts","sourceRoot":"","sources":["../../src/parsers/dummy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,UAAU,EAAmC,UAAU,EAAE,MAAM,SAAS,CAAC;AAElF;;GAEG;AACH,qBAAa,WAAY,SAAQ,MAAM;IACrC,SAAgB,SAAS,sBAAsB;IAEzC,KAAK,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC;CAOlE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Parser } from './parser';
|
|
2
|
+
import { Generators, PromptInfo } from '../data';
|
|
3
|
+
/**
|
|
4
|
+
* Parser for images generated by Fooocus
|
|
5
|
+
*/
|
|
6
|
+
export declare class FooocusParser extends Parser {
|
|
7
|
+
readonly generator = Generators.FOOOCUS;
|
|
8
|
+
parse(_parameters: Record<string, any>): Promise<PromptInfo>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=fooocus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fooocus.d.ts","sourceRoot":"","sources":["../../src/parsers/fooocus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA6B,MAAM,UAAU,CAAC;AAC7D,OAAO,EAAE,UAAU,EAA8D,UAAU,EAAE,MAAM,SAAS,CAAC;AAO7G;;GAEG;AACH,qBAAa,aAAc,SAAQ,MAAM;IACvC,SAAgB,SAAS,sBAAsB;IAEzC,KAAK,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC;CAsDnE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AUTOMATIC1111Parser } from './automatic1111';
|
|
2
|
+
import { FooocusParser } from './fooocus';
|
|
3
|
+
import { ComfyUIParser } from './comfyui';
|
|
4
|
+
import { InvokeAIParser } from './invokeai';
|
|
5
|
+
import { NovelAIParser } from './novelai';
|
|
6
|
+
/**
|
|
7
|
+
* Default managed parsers in order of precedence
|
|
8
|
+
*/
|
|
9
|
+
export declare const MANAGED_PARSERS: (typeof AUTOMATIC1111Parser | typeof FooocusParser | typeof ComfyUIParser | typeof InvokeAIParser | typeof NovelAIParser)[];
|
|
10
|
+
export { Parser } from './parser';
|
|
11
|
+
export { AUTOMATIC1111Parser } from './automatic1111';
|
|
12
|
+
export { FooocusParser } from './fooocus';
|
|
13
|
+
export { ComfyUIParser } from './comfyui';
|
|
14
|
+
export { InvokeAIParser } from './invokeai';
|
|
15
|
+
export { NovelAIParser } from './novelai';
|
|
16
|
+
export { DummyParser } from './dummy';
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/parsers/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG1C;;GAEG;AACH,eAAO,MAAM,eAAe,6HAM3B,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Parser } from './parser';
|
|
2
|
+
import { Generators, PromptInfo } from '../data';
|
|
3
|
+
/**
|
|
4
|
+
* Parser for images generated by InvokeAI
|
|
5
|
+
*/
|
|
6
|
+
export declare class InvokeAIParser extends Parser {
|
|
7
|
+
readonly generator = Generators.INVOKEAI;
|
|
8
|
+
parse(metadata: Record<string, any>): Promise<PromptInfo>;
|
|
9
|
+
private parseSdMetadata;
|
|
10
|
+
private parseDream;
|
|
11
|
+
private parseInvokeAiMeta;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=invokeai.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invokeai.d.ts","sourceRoot":"","sources":["../../src/parsers/invokeai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,UAAU,EAAiD,UAAU,EAAE,MAAM,SAAS,CAAC;AAGhG;;GAEG;AACH,qBAAa,cAAe,SAAQ,MAAM;IACxC,SAAgB,SAAS,uBAAuB;IAE1C,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC;IAqB/D,OAAO,CAAC,eAAe;IA8BvB,OAAO,CAAC,UAAU;IAwElB,OAAO,CAAC,iBAAiB;CAkC1B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Parser } from './parser';
|
|
2
|
+
import { Generators, PromptInfo } from '../data';
|
|
3
|
+
/**
|
|
4
|
+
* Parser for images generated by NovelAI
|
|
5
|
+
*/
|
|
6
|
+
export declare class NovelAIParser extends Parser {
|
|
7
|
+
readonly generator = Generators.NOVELAI;
|
|
8
|
+
parse(parameters: Record<string, any>): Promise<PromptInfo>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=novelai.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"novelai.d.ts","sourceRoot":"","sources":["../../src/parsers/novelai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA6B,MAAM,UAAU,CAAC;AAC7D,OAAO,EAAE,UAAU,EAA8D,UAAU,EAAE,MAAM,SAAS,CAAC;AAM7G;;GAEG;AACH,qBAAa,aAAc,SAAQ,MAAM;IACvC,SAAgB,SAAS,sBAAsB;IAEzC,KAAK,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC;CA8DlE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Generators, PromptInfo } from '../data';
|
|
2
|
+
/**
|
|
3
|
+
* Type for field renaming rules: [oldKey, newKey]
|
|
4
|
+
*/
|
|
5
|
+
export type RenameField = [string, string];
|
|
6
|
+
/**
|
|
7
|
+
* Type for field formatting rules: [oldKey, [valueKeys, formatString]]
|
|
8
|
+
*/
|
|
9
|
+
export type FormatField = [string, [string[], string]];
|
|
10
|
+
/**
|
|
11
|
+
* Replacement rules for normalizing parameters
|
|
12
|
+
*/
|
|
13
|
+
export type ReplacementRules = (RenameField | FormatField)[];
|
|
14
|
+
/**
|
|
15
|
+
* Abstract base class for parsers
|
|
16
|
+
*/
|
|
17
|
+
export declare abstract class Parser {
|
|
18
|
+
readonly generator: Generators;
|
|
19
|
+
protected doNormalizationPass: boolean;
|
|
20
|
+
protected debug: boolean;
|
|
21
|
+
constructor(normalizeParameters?: boolean, debug?: boolean);
|
|
22
|
+
/**
|
|
23
|
+
* Extract image generation information from the image metadata
|
|
24
|
+
*/
|
|
25
|
+
abstract parse(parameters: Record<string, any>): Promise<PromptInfo>;
|
|
26
|
+
/**
|
|
27
|
+
* Apply replacement rules and basic formatting to the keys of select image metadata entries.
|
|
28
|
+
* Returns a dictionary with normalized parameter values.
|
|
29
|
+
*/
|
|
30
|
+
normalizeParameters(parameters: Record<string, any> | [string, any][], replacementRules?: ReplacementRules, toLowerCase?: boolean, replaceWhitespace?: boolean): Record<string, any>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Remove dictionary entries specified by keys from the given dictionary.
|
|
34
|
+
* Ignores non-existing keys.
|
|
35
|
+
* Returns an array of the actually removed keys and their corresponding values.
|
|
36
|
+
*/
|
|
37
|
+
export declare function popKeys(keys: string[], dictionary: Record<string, any>): [string, any][];
|
|
38
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/parsers/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEjD;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,WAAW,GAAG,WAAW,CAAC,EAAE,CAAC;AAE7D;;GAEG;AACH,8BAAsB,MAAM;IAC1B,SAAgB,SAAS,EAAE,UAAU,CAAsB;IAC3D,SAAS,CAAC,mBAAmB,EAAE,OAAO,CAAC;IACvC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC;gBAEb,mBAAmB,GAAE,OAAc,EAAE,KAAK,GAAE,OAAe;IAKvE;;OAEG;IACH,QAAQ,CAAC,KAAK,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC;IAEpE;;;OAGG;IACH,mBAAmB,CACjB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EACjD,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,GAAE,OAAc,EAC3B,iBAAiB,GAAE,OAAc,GAChC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAsDvB;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAWxF"}
|