@sealcode/jdd 0.4.7 → 0.4.9
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/.nyc_output/e011c901-5465-47ac-9da1-eca657e5bb92.json +1 -0
- package/.nyc_output/processinfo/e011c901-5465-47ac-9da1-eca657e5bb92.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -1
- package/.xunit +13 -5
- package/@types/component-arguments/component-argument.d.ts +5 -3
- package/@types/component-arguments/file.d.ts +1 -1
- package/@types/component-arguments/list.d.ts +6 -6
- package/@types/component-arguments/string-based-argument.d.ts +1 -1
- package/@types/component-arguments/structured.d.ts +6 -2
- package/@types/component-arguments/table.d.ts +1 -1
- package/@types/component.test.d.ts +1 -0
- package/@types/document.d.ts +1 -0
- package/coverage/clover.xml +296 -191
- package/lib/component-arguments/component-argument.js.map +1 -1
- package/lib/component-arguments/file.js +1 -1
- package/lib/component-arguments/file.js.map +1 -1
- package/lib/component-arguments/list.js +5 -4
- package/lib/component-arguments/list.js.map +1 -1
- package/lib/component-arguments/string-based-argument.js +1 -1
- package/lib/component-arguments/string-based-argument.js.map +1 -1
- package/lib/component-arguments/structured.js +2 -2
- package/lib/component-arguments/structured.js.map +1 -1
- package/lib/component-arguments/structured.test.js.map +1 -1
- package/lib/component-arguments/table.js +17 -5
- package/lib/component-arguments/table.js.map +1 -1
- package/lib/component.js +9 -2
- package/lib/component.js.map +1 -1
- package/lib/component.test.js +42 -0
- package/lib/component.test.js.map +1 -0
- package/lib/document.js +3 -0
- package/lib/document.js.map +1 -1
- package/lib-instrumented/component-arguments/component-argument.js +2 -2
- package/lib-instrumented/component-arguments/container-argument.js +3 -3
- package/lib-instrumented/component-arguments/file.js +3 -3
- package/lib-instrumented/component-arguments/file.test.js +4 -0
- package/lib-instrumented/component-arguments/list.js +3 -3
- package/lib-instrumented/component-arguments/list.test.js +5 -0
- package/lib-instrumented/component-arguments/string-based-argument.js +3 -3
- package/lib-instrumented/component-arguments/structured.js +3 -3
- package/lib-instrumented/component-arguments/structured.test.js +5 -0
- package/lib-instrumented/component-arguments/table.js +4 -4
- package/lib-instrumented/component-arguments/table.test.js +4 -0
- package/lib-instrumented/component.js +6 -4
- package/lib-instrumented/component.test.js +3 -0
- package/lib-instrumented/components/markdown.test.js +3 -3
- package/lib-instrumented/document.js +3 -0
- package/lib-instrumented/document.test.js +3 -0
- package/lib-instrumented/index.js +4 -4
- package/package.json +1 -1
- package/.nyc_output/9ac81ada-0c47-42af-a81c-e4d65042e238.json +0 -1
- package/.nyc_output/processinfo/9ac81ada-0c47-42af-a81c-e4d65042e238.json +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"processes":{"
|
|
1
|
+
{"processes":{"e011c901-5465-47ac-9da1-eca657e5bb92":{"parent":null,"children":[]}},"files":{"/home/kuba/projects/sealcode/jdd/lib/api.test.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/component-argument.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/container-argument.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/list.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/file.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/utils/module-dirname.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/image.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/string-based-argument.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/short-text.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/structured.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/enum.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/markdown.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/url.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/utils/insert_nbsp.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/jdd-context.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/component-arguments.test.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/file.test.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/list.test.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/structured.test.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/table.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/table.test.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/component-arguments.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/registry.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/document.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/index.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component.test.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/components/markdown.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/components/markdown.test.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/document.test.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/utils/insert_nbsp.test.js":["e011c901-5465-47ac-9da1-eca657e5bb92"]},"externalIds":{}}
|
package/.xunit
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<testsuite name="Mocha Tests" tests="
|
|
1
|
+
<testsuite name="Mocha Tests" tests="27" failures="0" errors="0" skipped="0" timestamp="Sun, 05 May 2024 14:50:57 GMT" time="0.029">
|
|
2
2
|
<testcase classname="component arguments" name="handles nesting objects and arrays" time="0"/>
|
|
3
3
|
<testcase classname="component arguments" name="handles enums" time="0"/>
|
|
4
4
|
<testcase classname="component arguments" name="Gives a nice example" time="0.001"/>
|
|
@@ -9,13 +9,21 @@
|
|
|
9
9
|
<testcase classname="component arguments Word counting" name="ShortText argument" time="0"/>
|
|
10
10
|
<testcase classname="component arguments Word counting" name="MarkdownArgument argument" time="0"/>
|
|
11
11
|
<testcase classname="component arguments Word counting" name="List argument" time="0"/>
|
|
12
|
-
<testcase classname="component arguments Word counting" name="Structured argument" time="0
|
|
13
|
-
<testcase classname="component arguments List argument" name="Generates example values from provided examples, if they are provided" time="0"/>
|
|
12
|
+
<testcase classname="component arguments Word counting" name="Structured argument" time="0"/>
|
|
13
|
+
<testcase classname="component arguments List argument" name="Generates example values from provided examples, if they are provided" time="0.001"/>
|
|
14
14
|
<testcase classname="component arguments test URL component argument class" name="allows for chaining methods when setting example values" time="0"/>
|
|
15
15
|
<testcase classname="component arguments test URL component argument class" name="returns example url of type based on specyfic urlType argument" time="0"/>
|
|
16
16
|
<testcase classname="component arguments test URL component argument class" name="returns correct component argument type" time="0"/>
|
|
17
|
-
<testcase classname="
|
|
17
|
+
<testcase classname="File field" name="Properly describes the parsed value" time="0"/>
|
|
18
|
+
<testcase classname="list" name="allows for creating a list of images" time="0"/>
|
|
19
|
+
<testcase classname="list" name="properly parses list arguments" time="0"/>
|
|
20
|
+
<testcase classname="structured argument" name="properly extracts parsed type" time="0.001"/>
|
|
21
|
+
<testcase classname="structured argument" name="properly extracts parsed type within a list" time="0"/>
|
|
22
|
+
<testcase classname="table argument" name="properly parses type value" time="0"/>
|
|
23
|
+
<testcase classname="component class getSubArgument" name="traverses argument path that includes a table" time="0.003"/>
|
|
24
|
+
<testcase classname="markdown component" name="renders as a part of a JDD" time="0.016"/>
|
|
25
|
+
<testcase classname="document" name="converts from parsed to storage" time="0"/>
|
|
18
26
|
<testcase classname="create non braking space util" name="should replace space for one letter word with non braking space" time="0"/>
|
|
19
|
-
<testcase classname="create non braking space util" name="should keep original copy if there isn't any one letter word" time="0
|
|
27
|
+
<testcase classname="create non braking space util" name="should keep original copy if there isn't any one letter word" time="0"/>
|
|
20
28
|
<testcase classname="create non braking space util" name="shold find one letter word on first position" time="0"/>
|
|
21
29
|
</testsuite>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JDDContext, Table, TableData } from "../index.js";
|
|
1
|
+
import { JDDContext, Structured, Table, TableData } from "../index.js";
|
|
2
2
|
import { List } from "./list.js";
|
|
3
3
|
export type ExtractStructuredComponentArgumentsParsed<C> = {
|
|
4
4
|
[property in keyof C]: ExtractParsed<C[property]>;
|
|
@@ -9,7 +9,9 @@ export type ExtractStructuredComponentArgumentsStorage<C> = {
|
|
|
9
9
|
export type ExtractStructuredComponentArgumentsReceived<C> = {
|
|
10
10
|
[property in keyof C]: ExtractReceived<C[property]>;
|
|
11
11
|
};
|
|
12
|
-
export type ExtractParsed<C> = C extends List<infer T> ? T[] : C extends
|
|
12
|
+
export type ExtractParsed<C> = C extends List<infer T, any> ? T[] : C extends Structured<infer TT3> ? {
|
|
13
|
+
[property in keyof TT3]: ExtractParsed<TT3[property]>;
|
|
14
|
+
} : C extends ComponentArgument<infer T2, any, any> ? T2 : C extends Table<infer TT1, infer TT2> ? TableData<TT1, TT2> : never;
|
|
13
15
|
export type ExtractStorage<C> = C extends ComponentArgument<infer _, infer T> ? T : never;
|
|
14
16
|
export type ExtractReceived<C> = C extends ComponentArgument<infer _, infer __, infer T> ? T : never;
|
|
15
17
|
export declare abstract class ComponentArgument<ParsedType, StorageType = ParsedType, ReceivedDataType = StorageType> {
|
|
@@ -18,7 +20,7 @@ export declare abstract class ComponentArgument<ParsedType, StorageType = Parsed
|
|
|
18
20
|
abstract getTypeName(): string;
|
|
19
21
|
abstract getEmptyValue(): ParsedType;
|
|
20
22
|
abstract countWords(value: ParsedType): number;
|
|
21
|
-
abstract getSubArgument(
|
|
23
|
+
abstract getSubArgument(path: string[], value: ParsedType): readonly [ComponentArgument<unknown> | null, string[], unknown];
|
|
22
24
|
abstract receivedToParsed(context: JDDContext, value: ReceivedDataType): Promise<ParsedType | ParsedType[]>;
|
|
23
25
|
abstract parsedToStorage(context: JDDContext, value: ParsedType): Promise<StorageType>;
|
|
24
26
|
abstract storageToParsed(context: JDDContext, value: StorageType): Promise<ParsedType>;
|
|
@@ -13,7 +13,7 @@ export declare class File extends ComponentArgument<FilePointer | null, string |
|
|
|
13
13
|
constructor();
|
|
14
14
|
getTypeName(): string;
|
|
15
15
|
getEmptyValue(): null;
|
|
16
|
-
getSubArgument(): null;
|
|
16
|
+
getSubArgument(): readonly [null, string[], null];
|
|
17
17
|
getExampleValue(_context: JDDContext): Promise<FilePointer | null>;
|
|
18
18
|
countWords(): number;
|
|
19
19
|
receivedToParsed(_context: JDDContext, value: FileReceivedType): Promise<FilePointer | FilePointer[] | null>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { ComponentArgument } from "./component-argument.js";
|
|
2
2
|
import { ContainerArgument } from "./container-argument.js";
|
|
3
3
|
import { JDDContext } from "../jdd-context.js";
|
|
4
|
-
export declare class List<T
|
|
5
|
-
item_type: ComponentArgument<
|
|
4
|
+
export declare class List<ParsedType, T extends ComponentArgument<ParsedType, unknown, unknown>> extends ContainerArgument<ParsedType[], unknown, unknown> {
|
|
5
|
+
item_type: ComponentArgument<ParsedType, unknown, unknown>;
|
|
6
6
|
example_count: number | null;
|
|
7
|
-
constructor(item_type: ComponentArgument<
|
|
7
|
+
constructor(item_type: ComponentArgument<ParsedType, unknown, unknown>, example_count?: number | null);
|
|
8
8
|
getTypeName(): string;
|
|
9
9
|
getEmptyValue(): never[];
|
|
10
|
-
getSubArgument(key: string): ComponentArgument<
|
|
10
|
+
getSubArgument([key, ...rest]: string[], value: unknown[]): readonly [null, string[], null] | readonly [ComponentArgument<ParsedType, unknown, unknown>, string[], unknown];
|
|
11
11
|
getExampleCount(): number;
|
|
12
|
-
getExampleValue(context: JDDContext): Promise<
|
|
13
|
-
countWords(value: Array<
|
|
12
|
+
getExampleValue(context: JDDContext): Promise<ParsedType[]>;
|
|
13
|
+
countWords(value: Array<ParsedType>): number;
|
|
14
14
|
processAllSubarguments(_context: JDDContext, values: unknown, processing_function: (argument: ComponentArgument<unknown>, value: unknown) => Promise<unknown>): Promise<T[] | null>;
|
|
15
15
|
}
|
|
@@ -5,5 +5,5 @@ export declare abstract class StringBasedArgument<T extends string> extends Comp
|
|
|
5
5
|
parsedToStorage(_: JDDContext, value: T): Promise<T>;
|
|
6
6
|
storageToParsed(_: JDDContext, value: T): Promise<T>;
|
|
7
7
|
parsedToFormData(_: JDDContext, value: T): Promise<T>;
|
|
8
|
-
getSubArgument(): null;
|
|
8
|
+
getSubArgument(): readonly [null, string[], null];
|
|
9
9
|
}
|
|
@@ -9,11 +9,15 @@ export declare class Structured<T extends Record<string, ComponentArgument<unkno
|
|
|
9
9
|
structure: T;
|
|
10
10
|
constructor(structure: T);
|
|
11
11
|
getTypeName(): string;
|
|
12
|
-
getSubArgument(key: string
|
|
12
|
+
getSubArgument([key, ...rest]: string[], value: {
|
|
13
|
+
[property in keyof T]: ExtractParsed<T[property]>;
|
|
14
|
+
}): readonly [ComponentArgument<any> | null, string[], unknown];
|
|
13
15
|
countWords(value: {
|
|
14
16
|
[property in keyof T]: ExtractParsed<T[property]>;
|
|
15
17
|
}): number;
|
|
16
|
-
getEmptyValue(): {
|
|
18
|
+
getEmptyValue(): {
|
|
19
|
+
[property in keyof T]: ExtractParsed<T[property]>;
|
|
20
|
+
};
|
|
17
21
|
getExampleValue(context: JDDContext): Promise<{ [property in keyof T]: ExtractParsed<T[property]>; }>;
|
|
18
22
|
processAllSubarguments<SingleObject extends {
|
|
19
23
|
[property in keyof T]: ExtractParsed<T[property]>;
|
|
@@ -20,7 +20,7 @@ export declare class Table<CellType, HeaderType> extends ContainerArgument<Table
|
|
|
20
20
|
header_type: ComponentArgument<HeaderType, unknown, unknown>;
|
|
21
21
|
cell_type: ComponentArgument<CellType, unknown, unknown>;
|
|
22
22
|
constructor(header_type: ComponentArgument<HeaderType, unknown, unknown>, cell_type: ComponentArgument<CellType, unknown, unknown>);
|
|
23
|
-
getSubArgument(key: string, value: TableData<CellType, HeaderType>): ComponentArgument<HeaderType, unknown, unknown
|
|
23
|
+
getSubArgument([_, key, ...rest]: string[], value: TableData<CellType, HeaderType>): readonly [null, string[], null] | readonly [ComponentArgument<HeaderType, unknown, unknown>, string[], HeaderType] | readonly [ComponentArgument<CellType, unknown, unknown>, string[], CellType];
|
|
24
24
|
getTypeName(): string;
|
|
25
25
|
getEmptyValue(): {
|
|
26
26
|
rows: ({
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/@types/document.d.ts
CHANGED
|
@@ -12,3 +12,4 @@ export type JDDocumentContainer<Status extends "parsed" | "storage"> = {
|
|
|
12
12
|
export declare function documentToStorage(registry: Registry, jdd_context: JDDContext, document_container: JDDocumentContainer<"parsed">): Promise<JDDocumentContainer<"storage">>;
|
|
13
13
|
export declare function documentToParsed(registry: Registry, jdd_context: JDDContext, document_container: JDDocumentContainer<"storage">): Promise<JDDocumentContainer<"parsed">>;
|
|
14
14
|
export declare function documentContainerFromParsed(document: RawJDDocument): JDDocumentContainer<"parsed">;
|
|
15
|
+
export declare function documentContainerFromStorage(document: RawJDDocument): JDDocumentContainer<"storage">;
|