@sealcode/jdd 0.3.6 → 0.4.1
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.cjs +38 -0
- package/.nyc_output/9ac81ada-0c47-42af-a81c-e4d65042e238.json +1 -0
- package/.nyc_output/processinfo/9ac81ada-0c47-42af-a81c-e4d65042e238.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -0
- package/.xunit +21 -0
- package/@types/api.test.d.ts +1 -0
- package/@types/component-arguments/component-argument.d.ts +21 -10
- package/@types/component-arguments/component-arguments.d.ts +9 -9
- package/@types/component-arguments/component-arguments.test.d.ts +1 -0
- package/@types/component-arguments/container-argument.d.ts +8 -0
- package/@types/component-arguments/enum.d.ts +3 -3
- package/@types/component-arguments/file.d.ts +19 -6
- package/@types/component-arguments/image.d.ts +5 -4
- package/@types/component-arguments/list.d.ts +10 -8
- package/@types/component-arguments/list.test.d.ts +1 -0
- package/@types/component-arguments/markdown.d.ts +4 -4
- package/@types/component-arguments/short-text.d.ts +4 -4
- package/@types/component-arguments/string-based-argument.d.ts +9 -0
- package/@types/component-arguments/structured.d.ts +9 -5
- package/@types/component-arguments/table.d.ts +6 -4
- package/@types/component-arguments/url.d.ts +4 -4
- package/@types/component.d.ts +8 -4
- package/@types/components/markdown.d.ts +4 -4
- package/@types/components/markdown.test.d.ts +1 -0
- package/@types/index.d.ts +10 -10
- package/@types/jdd-context.d.ts +5 -18
- package/@types/pipeline.d.ts +1 -0
- package/@types/primitives/block.d.ts +2 -2
- package/@types/primitives/heading.d.ts +5 -5
- package/@types/primitives/image.d.ts +1 -15
- package/@types/primitives/parse_primitives.d.ts +1 -1
- package/@types/primitives/primitive.d.ts +4 -4
- package/@types/primitives/text.d.ts +4 -4
- package/@types/registry.d.ts +1 -1
- package/@types/utils/insert_nbsp.test.d.ts +1 -0
- package/@types/utils/module-dirname.d.ts +1 -0
- package/coverage/clover.xml +466 -0
- package/hint-report/http-localhost-8080.html +11153 -0
- package/lib/api.test.js +169 -0
- package/lib/api.test.js.map +1 -0
- package/lib/component-arguments/component-argument.js +1 -5
- package/lib/component-arguments/component-argument.js.map +1 -1
- package/lib/component-arguments/component-arguments.js +9 -34
- package/lib/component-arguments/component-arguments.js.map +1 -1
- package/lib/component-arguments/component-arguments.test.js +111 -0
- package/lib/component-arguments/component-arguments.test.js.map +1 -0
- package/lib/component-arguments/container-argument.js +19 -0
- package/lib/component-arguments/container-argument.js.map +1 -0
- package/lib/component-arguments/enum.js +6 -10
- package/lib/component-arguments/enum.js.map +1 -1
- package/lib/component-arguments/file.js +33 -59
- package/lib/component-arguments/file.js.map +1 -1
- package/lib/component-arguments/image.js +17 -35
- package/lib/component-arguments/image.js.map +1 -1
- package/lib/component-arguments/list.js +36 -48
- package/lib/component-arguments/list.js.map +1 -1
- package/lib/component-arguments/list.test.js +8 -0
- package/lib/component-arguments/list.test.js.map +1 -0
- package/lib/component-arguments/markdown.js +4 -8
- package/lib/component-arguments/markdown.js.map +1 -1
- package/lib/component-arguments/short-text.js +4 -8
- package/lib/component-arguments/short-text.js.map +1 -1
- package/lib/component-arguments/string-based-argument.js +19 -0
- package/lib/component-arguments/string-based-argument.js.map +1 -0
- package/lib/component-arguments/structured.js +49 -62
- package/lib/component-arguments/structured.js.map +1 -1
- package/lib/component-arguments/table.js +92 -96
- package/lib/component-arguments/table.js.map +1 -1
- package/lib/component-arguments/url.js +4 -8
- package/lib/component-arguments/url.js.map +1 -1
- package/lib/component.js +52 -27
- package/lib/component.js.map +1 -1
- package/lib/components/markdown.js +7 -11
- package/lib/components/markdown.js.map +1 -1
- package/lib/components/markdown.test.js +22 -0
- package/lib/components/markdown.test.js.map +1 -0
- package/lib/index.js +56 -100
- package/lib/index.js.map +1 -1
- package/lib/jdd-context.js +19 -72
- package/lib/jdd-context.js.map +1 -1
- package/lib/pipeline.js +3 -2
- package/lib/pipeline.js.map +1 -1
- package/lib/primitives/image.js +1 -26
- package/lib/primitives/image.js.map +1 -1
- package/lib/registry.js +3 -5
- package/lib/registry.js.map +1 -1
- package/lib/utils/assert-throws.js +14 -32
- package/lib/utils/assert-throws.js.map +1 -1
- package/lib/utils/insert_nbsp.js +1 -5
- package/lib/utils/insert_nbsp.js.map +1 -1
- package/lib/utils/insert_nbsp.test.js +17 -0
- package/lib/utils/insert_nbsp.test.js.map +1 -0
- package/lib/utils/module-dirname.js +5 -0
- package/lib/utils/module-dirname.js.map +1 -0
- package/lib/utils/util-types.js +1 -2
- package/lib-instrumented/api.test.js +170 -0
- package/lib-instrumented/component-arguments/component-argument.js +3 -0
- package/lib-instrumented/component-arguments/component-arguments.js +3 -0
- package/lib-instrumented/component-arguments/component-arguments.test.js +3 -0
- package/lib-instrumented/component-arguments/container-argument.js +3 -0
- package/lib-instrumented/component-arguments/enum.js +3 -0
- package/lib-instrumented/component-arguments/file.js +3 -0
- package/lib-instrumented/component-arguments/image.js +3 -0
- package/lib-instrumented/component-arguments/list.js +3 -0
- package/lib-instrumented/component-arguments/markdown.js +9 -0
- package/lib-instrumented/component-arguments/short-text.js +3 -0
- package/lib-instrumented/component-arguments/string-based-argument.js +3 -0
- package/lib-instrumented/component-arguments/structured.js +4 -0
- package/lib-instrumented/component-arguments/table.js +4 -0
- package/lib-instrumented/component-arguments/url.js +3 -0
- package/lib-instrumented/component.js +7 -0
- package/lib-instrumented/components/markdown.js +3 -0
- package/lib-instrumented/components/markdown.test.js +3 -0
- package/lib-instrumented/index.js +24 -0
- package/lib-instrumented/jdd-context.js +3 -0
- package/lib-instrumented/pipeline.js +18 -0
- package/lib-instrumented/primitives/image.js +3 -0
- package/lib-instrumented/registry.js +5 -0
- package/lib-instrumented/utils/assert-throws.js +3 -0
- package/lib-instrumented/utils/insert_nbsp.js +3 -0
- package/lib-instrumented/utils/insert_nbsp.test.js +3 -0
- package/lib-instrumented/utils/module-dirname.js +3 -0
- package/lib-instrumented/utils/util-types.js +3 -0
- package/package.json +17 -10
- package/raport.html/http-localhost-8080.html +5051 -0
- package/test.cjs +53 -0
- package/lib/component-arguments.js +0 -160
- package/lib/component-arguments.js.map +0 -1
- package/lib/primitives/block.js +0 -44
- package/lib/primitives/block.js.map +0 -1
- package/lib/primitives/heading.js +0 -28
- package/lib/primitives/heading.js.map +0 -1
- package/lib/primitives/parse_primitives.js +0 -28
- package/lib/primitives/parse_primitives.js.map +0 -1
- package/lib/primitives/primitive.js +0 -13
- package/lib/primitives/primitive.js.map +0 -1
- package/lib/primitives/text.js +0 -23
- package/lib/primitives/text.js.map +0 -1
- package/lib/utils/fix-array.js +0 -16
- package/lib/utils/fix-array.js.map +0 -1
- package/lib/utils/maybepromise.js +0 -3
- package/lib/utils/maybepromise.js.map +0 -1
|
@@ -1,17 +1,28 @@
|
|
|
1
|
-
import { JDDContext, List } from "../index";
|
|
2
|
-
import { MaybePromise } from "../utils/util-types";
|
|
1
|
+
import { JDDContext, List } from "../index.js";
|
|
3
2
|
export type ExtractComponentArgumentValue<C> = C extends List<infer S> ? S[] : C extends ComponentArgument<infer T> ? T : never;
|
|
4
|
-
export type
|
|
3
|
+
export type ExtractStructuredComponentArgumentsParsed<C> = {
|
|
5
4
|
[property in keyof C]: ExtractComponentArgumentValue<C[property]>;
|
|
6
5
|
};
|
|
7
|
-
export
|
|
8
|
-
|
|
6
|
+
export type ExtractStructuredComponentArgumentsStorage<C> = {
|
|
7
|
+
[property in keyof C]: ExtractStorage<C[property]>;
|
|
8
|
+
};
|
|
9
|
+
export type ExtractStructuredComponentArgumentsReceived<C> = {
|
|
10
|
+
[property in keyof C]: ExtractReceived<C[property]>;
|
|
11
|
+
};
|
|
12
|
+
export type ExtractParsed<C> = C extends ComponentArgument<infer T> ? T : never;
|
|
13
|
+
export type ExtractStorage<C> = C extends ComponentArgument<infer _, infer T> ? T : never;
|
|
14
|
+
export type ExtractReceived<C> = C extends ComponentArgument<infer _, infer __, infer T> ? T : never;
|
|
15
|
+
export declare abstract class ComponentArgument<ParsedType, StorageType = ParsedType, ReceivedDataType = StorageType> {
|
|
16
|
+
example_values: ParsedType[];
|
|
9
17
|
parent_argument: ComponentArgument<unknown> | null;
|
|
10
18
|
abstract getTypeName(): string;
|
|
11
|
-
abstract getEmptyValue():
|
|
12
|
-
abstract countWords(value:
|
|
13
|
-
abstract
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
abstract getEmptyValue(): ParsedType;
|
|
20
|
+
abstract countWords(value: ParsedType): number;
|
|
21
|
+
abstract getSubArgument(key: string, value: ParsedType): ComponentArgument<unknown> | null;
|
|
22
|
+
abstract receivedToParsed(context: JDDContext, value: ReceivedDataType): Promise<ParsedType | ParsedType[]>;
|
|
23
|
+
abstract parsedToStorage(context: JDDContext, value: ParsedType): Promise<StorageType>;
|
|
24
|
+
abstract storageToParsed(context: JDDContext, value: StorageType): Promise<ParsedType>;
|
|
25
|
+
getExampleValue(_context: JDDContext): Promise<ParsedType> | ParsedType;
|
|
26
|
+
setExampleValues(values: ParsedType[]): this;
|
|
16
27
|
hasParent(type: string): boolean;
|
|
17
28
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { Enum } from "./enum";
|
|
2
|
-
export { Image } from "./image";
|
|
3
|
-
export { File } from "./file";
|
|
4
|
-
export { List } from "./list";
|
|
5
|
-
export { MarkdownArgument as Markdown } from "./markdown";
|
|
6
|
-
export { ShortText } from "./short-text";
|
|
7
|
-
export { Structured } from "./structured";
|
|
8
|
-
export * from "./table";
|
|
9
|
-
export { URL } from "./url";
|
|
1
|
+
export { Enum } from "./enum.js";
|
|
2
|
+
export { Image } from "./image.js";
|
|
3
|
+
export { File } from "./file.js";
|
|
4
|
+
export { List } from "./list.js";
|
|
5
|
+
export { MarkdownArgument as Markdown } from "./markdown.js";
|
|
6
|
+
export { ShortText } from "./short-text.js";
|
|
7
|
+
export { Structured } from "./structured.js";
|
|
8
|
+
export * from "./table.js";
|
|
9
|
+
export { URL } from "./url.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { JDDContext } from "../jdd-context.js";
|
|
2
|
+
import { ComponentArgument } from "./component-argument.js";
|
|
3
|
+
export declare abstract class ContainerArgument<P, S = P, R = P> extends ComponentArgument<P, S, R> {
|
|
4
|
+
abstract processAllSubarguments(context: JDDContext, values: unknown, processing_function: (argument: ComponentArgument<unknown>, value: unknown) => Promise<unknown>): unknown;
|
|
5
|
+
receivedToParsed(context: JDDContext, value: R): Promise<P>;
|
|
6
|
+
parsedToStorage(context: JDDContext, value: P): Promise<S>;
|
|
7
|
+
storageToParsed(context: JDDContext, value: S): Promise<P>;
|
|
8
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export declare class Enum<T extends string> extends
|
|
1
|
+
import { JDDContext } from "../jdd-context.js";
|
|
2
|
+
import { StringBasedArgument } from "./string-based-argument.js";
|
|
3
|
+
export declare class Enum<T extends string> extends StringBasedArgument<T> {
|
|
4
4
|
readonly values: Readonly<T[]>;
|
|
5
5
|
constructor(values: Readonly<T[]>);
|
|
6
6
|
getTypeName(): string;
|
|
@@ -1,11 +1,24 @@
|
|
|
1
|
-
import { JDDContext } from "../index";
|
|
2
|
-
import { ComponentArgument } from "./component-argument";
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { JDDContext } from "../index.js";
|
|
2
|
+
import { ComponentArgument } from "./component-argument.js";
|
|
3
|
+
import { FilePointer } from "@sealcode/file-manager";
|
|
4
|
+
type FileReceivedType = {
|
|
5
|
+
old: FilePointer | null;
|
|
6
|
+
new: FilePointer[] | FilePointer | null;
|
|
7
|
+
};
|
|
8
|
+
type FileFormDataType = {
|
|
9
|
+
old: string | null;
|
|
10
|
+
new?: unknown;
|
|
11
|
+
};
|
|
12
|
+
export declare class File extends ComponentArgument<FilePointer | null, string | null, FileReceivedType> {
|
|
5
13
|
constructor();
|
|
6
14
|
getTypeName(): string;
|
|
7
15
|
getEmptyValue(): null;
|
|
8
|
-
|
|
16
|
+
getSubArgument(): null;
|
|
17
|
+
getExampleValue(_context: JDDContext): Promise<FilePointer | null>;
|
|
9
18
|
countWords(): number;
|
|
10
|
-
|
|
19
|
+
receivedToParsed(_context: JDDContext, value: FileReceivedType): Promise<FilePointer | FilePointer[] | null>;
|
|
20
|
+
parsedToStorage(_context: JDDContext, value: FilePointer | null): Promise<string | null>;
|
|
21
|
+
storageToParsed(context: JDDContext, value: string | null): Promise<FilePointer | null>;
|
|
22
|
+
parsedToFormData(_context: JDDContext, value: FilePointer | null): Promise<FileFormDataType>;
|
|
11
23
|
}
|
|
24
|
+
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { JDDContext } from "
|
|
2
|
-
import { File as FileArgument } from "./file";
|
|
1
|
+
import { JDDContext } from "../index.js";
|
|
2
|
+
import { File as FileArgument } from "./file.js";
|
|
3
|
+
import { FilePointer } from "@sealcode/file-manager";
|
|
3
4
|
export declare class Image extends FileArgument {
|
|
4
|
-
private
|
|
5
|
+
private example_images;
|
|
5
6
|
getTypeName(): string;
|
|
6
7
|
setExampleImages(paths: string[]): this;
|
|
7
|
-
getExampleValue(context: JDDContext): Promise<
|
|
8
|
+
getExampleValue(context: JDDContext): Promise<FilePointer | null>;
|
|
8
9
|
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { JDDContext } from "
|
|
2
|
-
import { ComponentArgument } from "./component-argument";
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { JDDContext } from "../index.js";
|
|
2
|
+
import { ComponentArgument, ExtractParsed } from "./component-argument.js";
|
|
3
|
+
import { ContainerArgument } from "./container-argument.js";
|
|
4
|
+
export declare class List<T extends ComponentArgument<unknown>> extends ContainerArgument<ExtractParsed<T>[], unknown, unknown> {
|
|
5
|
+
item_type: ComponentArgument<ExtractParsed<T>, unknown, unknown>;
|
|
5
6
|
example_count: number | null;
|
|
6
|
-
constructor(item_type: ComponentArgument<T>, example_count?: number | null);
|
|
7
|
+
constructor(item_type: ComponentArgument<ExtractParsed<T>, unknown, unknown>, example_count?: number | null);
|
|
7
8
|
getTypeName(): string;
|
|
8
9
|
getEmptyValue(): never[];
|
|
10
|
+
getSubArgument(key: string): ComponentArgument<ExtractParsed<T>, unknown, unknown> | null;
|
|
9
11
|
getExampleCount(): number;
|
|
10
|
-
getExampleValue(context: JDDContext): Promise<T[]>;
|
|
11
|
-
countWords(value: Array<T
|
|
12
|
-
|
|
12
|
+
getExampleValue(context: JDDContext): Promise<ExtractParsed<T>[]>;
|
|
13
|
+
countWords(value: Array<ExtractParsed<T>>): number;
|
|
14
|
+
processAllSubarguments(_context: JDDContext, values: unknown, processing_function: (argument: ComponentArgument<unknown>, value: unknown) => Promise<unknown>): Promise<T[] | null>;
|
|
13
15
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { JDDContext } from "../jdd-context";
|
|
2
|
-
import { MaybePromise } from "../utils/util-types";
|
|
3
|
-
import {
|
|
4
|
-
export declare class MarkdownArgument extends
|
|
1
|
+
import { JDDContext } from "../jdd-context.js";
|
|
2
|
+
import { MaybePromise } from "../utils/util-types.js";
|
|
3
|
+
import { StringBasedArgument } from "./string-based-argument.js";
|
|
4
|
+
export declare class MarkdownArgument extends StringBasedArgument<string> {
|
|
5
5
|
getTypeName(): string;
|
|
6
6
|
getEmptyValue(): string;
|
|
7
7
|
countWords(value: string): number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { JDDContext } from "
|
|
2
|
-
import { MaybePromise } from "../utils/util-types";
|
|
3
|
-
import {
|
|
4
|
-
export declare class ShortText extends
|
|
1
|
+
import { JDDContext } from "../index.js";
|
|
2
|
+
import { MaybePromise } from "../utils/util-types.js";
|
|
3
|
+
import { StringBasedArgument } from "./string-based-argument.js";
|
|
4
|
+
export declare class ShortText extends StringBasedArgument<string> {
|
|
5
5
|
example_values: string[];
|
|
6
6
|
getTypeName(): string;
|
|
7
7
|
getEmptyValue(): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { JDDContext } from "../jdd-context.js";
|
|
2
|
+
import { ComponentArgument } from "./component-argument.js";
|
|
3
|
+
export declare abstract class StringBasedArgument<T extends string> extends ComponentArgument<T> {
|
|
4
|
+
receivedToParsed(_: JDDContext, value: T): Promise<T>;
|
|
5
|
+
parsedToStorage(_: JDDContext, value: T): Promise<T>;
|
|
6
|
+
storageToParsed(_: JDDContext, value: T): Promise<T>;
|
|
7
|
+
parsedToFormData(_: JDDContext, value: T): Promise<T>;
|
|
8
|
+
getSubArgument(): null;
|
|
9
|
+
}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import { JDDContext } from "
|
|
2
|
-
import { ComponentArgument, ExtractComponentArgumentValue } from "./component-argument";
|
|
3
|
-
|
|
1
|
+
import { JDDContext } from "../index.js";
|
|
2
|
+
import { ComponentArgument, ExtractComponentArgumentValue, ExtractStorage } from "./component-argument.js";
|
|
3
|
+
import { ContainerArgument } from "./container-argument.js";
|
|
4
|
+
export declare class Structured<T extends Record<string, ComponentArgument<unknown>>> extends ContainerArgument<{
|
|
4
5
|
[property in keyof T]: ExtractComponentArgumentValue<T[property]>;
|
|
6
|
+
}, {
|
|
7
|
+
[property in keyof T]: ExtractStorage<T[property]>;
|
|
5
8
|
}> {
|
|
6
9
|
structure: T;
|
|
7
10
|
constructor(structure: T);
|
|
8
11
|
getTypeName(): string;
|
|
12
|
+
getSubArgument(key: string): ComponentArgument<unknown, unknown, unknown>;
|
|
9
13
|
countWords(value: {
|
|
10
14
|
[property in keyof T]: ExtractComponentArgumentValue<T[property]>;
|
|
11
15
|
}): number;
|
|
12
16
|
getEmptyValue(): { [property in keyof T]: ExtractComponentArgumentValue<T[property]>; };
|
|
13
17
|
getExampleValue(context: JDDContext): Promise<{ [property in keyof T]: ExtractComponentArgumentValue<T[property]>; }>;
|
|
14
|
-
|
|
18
|
+
processAllSubarguments<SingleObject extends {
|
|
15
19
|
[property in keyof T]: ExtractComponentArgumentValue<T[property]>;
|
|
16
|
-
}>(
|
|
20
|
+
}>(_context: JDDContext, input: unknown, processing_function: (argument: ComponentArgument<unknown>, value: unknown) => Promise<unknown>): Promise<SingleObject | SingleObject[] | null>;
|
|
17
21
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { JDDContext } from "
|
|
2
|
-
import { ComponentArgument } from "./component-argument";
|
|
1
|
+
import { JDDContext } from "../index.js";
|
|
2
|
+
import { ComponentArgument } from "./component-argument.js";
|
|
3
|
+
import { ContainerArgument } from "./container-argument.js";
|
|
3
4
|
type TableHeader<HeaderType> = {
|
|
4
5
|
type: "header";
|
|
5
6
|
header_content: HeaderType;
|
|
@@ -15,10 +16,11 @@ export type TableData<CellType, HeaderType> = {
|
|
|
15
16
|
export declare function isTableHeader(x: unknown): x is TableHeader<unknown>;
|
|
16
17
|
export declare function isTableRegularRow<CellType = unknown>(x: unknown): x is TableRegularRow<CellType>;
|
|
17
18
|
export declare function isTableData<CellType = unknown, HeaderType = unknown>(x: unknown): x is TableData<CellType, HeaderType>;
|
|
18
|
-
export declare class Table<CellType, HeaderType> extends
|
|
19
|
+
export declare class Table<CellType, HeaderType> extends ContainerArgument<TableData<CellType, HeaderType>> {
|
|
19
20
|
header_type: ComponentArgument<HeaderType>;
|
|
20
21
|
cell_type: ComponentArgument<CellType>;
|
|
21
22
|
constructor(header_type: ComponentArgument<HeaderType>, cell_type: ComponentArgument<CellType>);
|
|
23
|
+
getSubArgument(key: string, value: TableData<CellType, HeaderType>): ComponentArgument<HeaderType, HeaderType, HeaderType> | ComponentArgument<CellType, CellType, CellType> | null;
|
|
22
24
|
getTypeName(): string;
|
|
23
25
|
getEmptyValue(): {
|
|
24
26
|
rows: ({
|
|
@@ -33,7 +35,7 @@ export declare class Table<CellType, HeaderType> extends ComponentArgument<Table
|
|
|
33
35
|
};
|
|
34
36
|
getExampleValue(context: JDDContext): Promise<TableData<CellType, HeaderType>>;
|
|
35
37
|
countWords(value: TableData<CellType, HeaderType>): number;
|
|
36
|
-
|
|
38
|
+
processAllSubarguments(context: JDDContext, input: unknown, processing_function: (argument: ComponentArgument<unknown>, value: unknown) => Promise<unknown>): Promise<TableData<CellType, HeaderType>>;
|
|
37
39
|
getColumnsCount(value: TableData<CellType, HeaderType>): number;
|
|
38
40
|
}
|
|
39
41
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { JDDContext } from "../jdd-context";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export declare class URL extends
|
|
1
|
+
import { JDDContext } from "../jdd-context.js";
|
|
2
|
+
import { MaybePromise } from "../utils/util-types.js";
|
|
3
|
+
import { StringBasedArgument } from "./string-based-argument.js";
|
|
4
|
+
export declare class URL extends StringBasedArgument<string> {
|
|
5
5
|
readonly urlType: Readonly<"relative" | "absolute">;
|
|
6
6
|
constructor(urlType: Readonly<"relative" | "absolute">);
|
|
7
7
|
getTypeName(): string;
|
package/@types/component.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FlatTemplatable } from "tempstream";
|
|
2
|
-
import { ComponentArgument,
|
|
2
|
+
import { ComponentArgument, ExtractStructuredComponentArgumentsParsed, ExtractStructuredComponentArgumentsReceived, ExtractStructuredComponentArgumentsStorage, JDDContext } from "./index.js";
|
|
3
3
|
export interface ComponentConstructor<A extends Record<string, ComponentArgument<unknown>> = Record<string, ComponentArgument<unknown>>> {
|
|
4
4
|
new (): Component<A>;
|
|
5
5
|
}
|
|
@@ -15,8 +15,12 @@ export type EarlyAsset = ({
|
|
|
15
15
|
};
|
|
16
16
|
export declare abstract class Component<ArgumentsT extends Record<string, ComponentArgument<unknown>> = Record<string, ComponentArgument<unknown>>> {
|
|
17
17
|
abstract getArguments(): ArgumentsT;
|
|
18
|
-
abstract toHTML(args:
|
|
19
|
-
getEarlyAssets(_args:
|
|
18
|
+
abstract toHTML(args: ExtractStructuredComponentArgumentsParsed<ArgumentsT>, context: JDDContext): FlatTemplatable;
|
|
19
|
+
getEarlyAssets(_args: ExtractStructuredComponentArgumentsParsed<ArgumentsT>, _context: JDDContext): Promise<EarlyAsset[]>;
|
|
20
20
|
countWords(args: Record<string, unknown>): number;
|
|
21
|
-
getExampleValues(context: JDDContext): Promise<
|
|
21
|
+
getExampleValues(context: JDDContext): Promise<ExtractStructuredComponentArgumentsParsed<ArgumentsT>>;
|
|
22
|
+
convertReceivedValuesToParsed(context: JDDContext, values: ExtractStructuredComponentArgumentsReceived<ArgumentsT>): Promise<ExtractStructuredComponentArgumentsParsed<ArgumentsT>>;
|
|
23
|
+
convertParsedToStorage(context: JDDContext, values: ExtractStructuredComponentArgumentsParsed<ArgumentsT>): Promise<ExtractStructuredComponentArgumentsStorage<ArgumentsT>>;
|
|
24
|
+
convertStorageToParsed(context: JDDContext, values: ExtractStructuredComponentArgumentsStorage<ArgumentsT>): Promise<ExtractStructuredComponentArgumentsParsed<ArgumentsT>>;
|
|
25
|
+
getArgumentAtPath(argument_path: string[], values: ExtractStructuredComponentArgumentsParsed<ArgumentsT>): ComponentArgument<unknown> | null;
|
|
22
26
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FlatTemplatable } from "tempstream";
|
|
2
|
-
import { Component } from "../component";
|
|
3
|
-
import { MarkdownArgument } from "../component-arguments/markdown";
|
|
4
|
-
import {
|
|
2
|
+
import { Component } from "../component.js";
|
|
3
|
+
import { MarkdownArgument } from "../component-arguments/markdown.js";
|
|
4
|
+
import { ExtractStructuredComponentArgumentsParsed } from "../index.js";
|
|
5
5
|
declare const component_arguments: {
|
|
6
6
|
readonly markdown: MarkdownArgument;
|
|
7
7
|
};
|
|
@@ -9,6 +9,6 @@ export declare class Markdown extends Component<typeof component_arguments> {
|
|
|
9
9
|
getArguments(): {
|
|
10
10
|
readonly markdown: MarkdownArgument;
|
|
11
11
|
};
|
|
12
|
-
toHTML({ markdown, }:
|
|
12
|
+
toHTML({ markdown, }: ExtractStructuredComponentArgumentsParsed<typeof component_arguments>): FlatTemplatable;
|
|
13
13
|
}
|
|
14
14
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/@types/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { JDDContext } from "./jdd-context";
|
|
3
|
-
import { Registry } from "./registry";
|
|
4
|
-
export * from "./component";
|
|
5
|
-
export * from "./component-arguments/component-argument";
|
|
6
|
-
export * as ComponentArguments from "./component-arguments/component-arguments";
|
|
7
|
-
export * from "./component-arguments/component-arguments";
|
|
8
|
-
export * from "./jdd-context";
|
|
9
|
-
export * from "./registry";
|
|
10
|
-
export { insert_nbsp } from "./utils/insert_nbsp";
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import { JDDContext } from "./jdd-context.js";
|
|
3
|
+
import { Registry } from "./registry.js";
|
|
4
|
+
export * from "./component.js";
|
|
5
|
+
export * from "./component-arguments/component-argument.js";
|
|
6
|
+
export * as ComponentArguments from "./component-arguments/component-arguments.js";
|
|
7
|
+
export * from "./component-arguments/component-arguments.js";
|
|
8
|
+
export * from "./jdd-context.js";
|
|
9
|
+
export * from "./registry.js";
|
|
10
|
+
export { insert_nbsp } from "./utils/insert_nbsp.js";
|
|
11
11
|
export type JDDocument = Array<{
|
|
12
12
|
component_name: string;
|
|
13
13
|
args: Record<string, unknown>;
|
package/@types/jdd-context.d.ts
CHANGED
|
@@ -1,24 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { FileManager, FilePointer, PathFilePointer } from "@sealcode/file-manager";
|
|
2
2
|
import type { KoaResponsiveImageRouter } from "koa-responsive-image-router";
|
|
3
3
|
import { FlatTemplatable } from "tempstream";
|
|
4
|
-
export type FSFilePointer = {
|
|
5
|
-
type: "path";
|
|
6
|
-
path: string;
|
|
7
|
-
mimetype?: string;
|
|
8
|
-
};
|
|
9
|
-
export type FilePointer = FSFilePointer | {
|
|
10
|
-
type: "buffer";
|
|
11
|
-
mimetype: string;
|
|
12
|
-
buffer: Buffer;
|
|
13
|
-
};
|
|
14
4
|
export interface JDDContext {
|
|
15
|
-
render_image: (file_id: string | null, args: Parameters<KoaResponsiveImageRouter["image"]>[1]) => FlatTemplatable;
|
|
5
|
+
render_image: (file_id: FilePointer | string | null, args: Parameters<KoaResponsiveImageRouter["image"]>[1]) => FlatTemplatable;
|
|
16
6
|
render_markdown: (markdown: string) => FlatTemplatable;
|
|
17
7
|
encode_file: (photo: FilePointer, persistent: boolean) => Promise<string>;
|
|
18
|
-
decode_file: (
|
|
8
|
+
decode_file: (token: string) => Promise<PathFilePointer | null>;
|
|
9
|
+
file_manager: FileManager;
|
|
19
10
|
}
|
|
20
|
-
export declare
|
|
21
|
-
decode_file: (id: string) => Promise<FSFilePointer | null>;
|
|
22
|
-
encode_file: (file_pointer: FilePointer, persistent: boolean) => Promise<string>;
|
|
23
|
-
};
|
|
24
|
-
export declare const simpleJDDContext: JDDContext;
|
|
11
|
+
export declare const makeSimpleJDDContext: (file_manager: FileManager) => JDDContext;
|
package/@types/pipeline.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ShapeToType } from "@sealcode/ts-predicates";
|
|
2
2
|
import { ConstPredicate } from "@sealcode/ts-predicates/@types/predicates/const";
|
|
3
3
|
import { LazyPredicate } from "@sealcode/ts-predicates/@types/predicates/lazy";
|
|
4
|
-
import { HeadingPrimitive } from "./heading";
|
|
5
|
-
import { Primitive, PrimitiveJSON } from "./primitive";
|
|
4
|
+
import { HeadingPrimitive } from "./heading.js";
|
|
5
|
+
import { Primitive, PrimitiveJSON } from "./primitive.js";
|
|
6
6
|
export declare const BlockShape: {
|
|
7
7
|
readonly type: ConstPredicate<"block">;
|
|
8
8
|
readonly content: LazyPredicate<PrimitiveJSON[]>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ShapeToType } from "@sealcode/ts-predicates";
|
|
2
|
-
import { Primitive } from "./primitive";
|
|
2
|
+
import { Primitive } from "./primitive.js";
|
|
3
3
|
export declare const HeadingShape: {
|
|
4
|
-
type: import("@sealcode/ts-predicates/@types/predicates/const").ConstPredicate<"heading">;
|
|
5
|
-
content: import("@sealcode/ts-predicates/@types/predicates/string").StringPredicate;
|
|
6
|
-
level: import("@sealcode/ts-predicates/@types/predicates/number").NumberPredicate;
|
|
7
|
-
id: import("@sealcode/ts-predicates/@types/predicates/predicate").Predicate<string | undefined>;
|
|
4
|
+
type: import("@sealcode/ts-predicates/@types/predicates/const.js").ConstPredicate<"heading">;
|
|
5
|
+
content: import("@sealcode/ts-predicates/@types/predicates/string.js").StringPredicate;
|
|
6
|
+
level: import("@sealcode/ts-predicates/@types/predicates/number.js").NumberPredicate;
|
|
7
|
+
id: import("@sealcode/ts-predicates/@types/predicates/predicate.js").Predicate<string | undefined>;
|
|
8
8
|
};
|
|
9
9
|
export type HeadingJSON = ShapeToType<typeof HeadingShape>;
|
|
10
10
|
export declare class HeadingPrimitive extends Primitive {
|
|
@@ -1,15 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { ShapeToType } from "@sealcode/ts-predicates";
|
|
3
|
-
export declare const ImageShape: {
|
|
4
|
-
type: import("@sealcode/ts-predicates/@types/predicates/const").ConstPredicate<"image">;
|
|
5
|
-
content: import("@sealcode/ts-predicates/@types/predicates/string").StringPredicate;
|
|
6
|
-
id: import("@sealcode/ts-predicates/@types/predicates/predicate").Predicate<string | undefined>;
|
|
7
|
-
};
|
|
8
|
-
export type ImageJSON = ShapeToType<typeof ImageShape>;
|
|
9
|
-
export declare class ImagePrimitive extends Primitive {
|
|
10
|
-
content: string;
|
|
11
|
-
id: string | null;
|
|
12
|
-
constructor(json: Record<string, unknown>);
|
|
13
|
-
to_html(): string;
|
|
14
|
-
extract_images(): string[];
|
|
15
|
-
}
|
|
1
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Primitive } from "./primitive";
|
|
1
|
+
import { Primitive } from "./primitive.js";
|
|
2
2
|
export declare function parse_primitives(primitive_json: Record<string, unknown>[]): Primitive[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BlockJSON } from "./block";
|
|
2
|
-
import { HeadingJSON, HeadingPrimitive } from "./heading";
|
|
3
|
-
import { ImageJSON } from "./image";
|
|
4
|
-
import { TextJSON } from "./text";
|
|
1
|
+
import { BlockJSON } from "./block.js";
|
|
2
|
+
import { HeadingJSON, HeadingPrimitive } from "./heading.js";
|
|
3
|
+
import { ImageJSON } from "./image.js";
|
|
4
|
+
import { TextJSON } from "./text.js";
|
|
5
5
|
export type PrimitiveJSON = BlockJSON | HeadingJSON | ImageJSON | TextJSON;
|
|
6
6
|
export declare abstract class Primitive {
|
|
7
7
|
id: string | null;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ShapeToType } from "@sealcode/ts-predicates";
|
|
2
|
-
import { Primitive } from "./primitive";
|
|
2
|
+
import { Primitive } from "./primitive.js";
|
|
3
3
|
export declare const TextShape: {
|
|
4
|
-
type: import("@sealcode/ts-predicates/@types/predicates/const").ConstPredicate<"text">;
|
|
5
|
-
content: import("@sealcode/ts-predicates/@types/predicates/string").StringPredicate;
|
|
6
|
-
id: import("@sealcode/ts-predicates/@types/predicates/predicate").Predicate<string | undefined>;
|
|
4
|
+
type: import("@sealcode/ts-predicates/@types/predicates/const.js").ConstPredicate<"text">;
|
|
5
|
+
content: import("@sealcode/ts-predicates/@types/predicates/string.js").StringPredicate;
|
|
6
|
+
id: import("@sealcode/ts-predicates/@types/predicates/predicate.js").Predicate<string | undefined>;
|
|
7
7
|
};
|
|
8
8
|
export type TextJSON = ShapeToType<typeof TextShape>;
|
|
9
9
|
export declare class TextPrimitive extends Primitive {
|
package/@types/registry.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function module_dirname(module_url: string): string;
|