@sealcode/sealgen 0.18.7 → 0.18.10
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/package.json +2 -2
- package/@types/remove-named-imports.d.ts +0 -5
- package/@types/src/CSSBuilder.d.ts +0 -19
- package/@types/src/add-collection.d.ts +0 -1
- package/@types/src/add-crud.d.ts +0 -3
- package/@types/src/add-jdd-component.d.ts +0 -1
- package/@types/src/add-list-route.test.d.ts +0 -1
- package/@types/src/add-route.d.ts +0 -3
- package/@types/src/add-route.test.d.ts +0 -1
- package/@types/src/add-verbose-crud.d.ts +0 -3
- package/@types/src/build.d.ts +0 -3
- package/@types/src/builder.d.ts +0 -35
- package/@types/src/builders/backend-ts-builder.d.ts +0 -7
- package/@types/src/builders/builder.d.ts +0 -11
- package/@types/src/builders/colors-builder.d.ts +0 -10
- package/@types/src/builders/css-builder.d.ts +0 -19
- package/@types/src/builders/fonts-builder.d.ts +0 -7
- package/@types/src/builders/frontend-ts-builder.d.ts +0 -11
- package/@types/src/cli.d.ts +0 -2
- package/@types/src/components/components.d.ts +0 -2
- package/@types/src/components/tabs.d.ts +0 -2
- package/@types/src/components/toggle-modal.d.ts +0 -6
- package/@types/src/crud-field-snippets.d.ts +0 -3
- package/@types/src/embeddable-file-extensions.d.ts +0 -1
- package/@types/src/esbuild-plugins/load-assets.d.ts +0 -5
- package/@types/src/esbuild-plugins/rewrite-asset-imports.d.ts +0 -5
- package/@types/src/example.test.d.ts +0 -1
- package/@types/src/find-css-includes.d.ts +0 -1
- package/@types/src/forms/controls/array.d.ts +0 -35
- package/@types/src/forms/controls/autocomplete.d.ts +0 -22
- package/@types/src/forms/controls/big-radio-group.d.ts +0 -14
- package/@types/src/forms/controls/checkbox-group.d.ts +0 -21
- package/@types/src/forms/controls/checkbox.d.ts +0 -17
- package/@types/src/forms/controls/checkboxed-list-input.d.ts +0 -21
- package/@types/src/forms/controls/checkboxed-list-input.test.d.ts +0 -1
- package/@types/src/forms/controls/collapsible-checkbox-group.d.ts +0 -11
- package/@types/src/forms/controls/collapsible-field-group.d.ts +0 -21
- package/@types/src/forms/controls/controls.d.ts +0 -31
- package/@types/src/forms/controls/derived-frame.d.ts +0 -21
- package/@types/src/forms/controls/derived.d.ts +0 -13
- package/@types/src/forms/controls/dropdown.d.ts +0 -30
- package/@types/src/forms/controls/editable-collection-subset.d.ts +0 -20
- package/@types/src/forms/controls/field-group.d.ts +0 -23
- package/@types/src/forms/controls/file.d.ts +0 -13
- package/@types/src/forms/controls/file.test.d.ts +0 -1
- package/@types/src/forms/controls/form-control.d.ts +0 -20
- package/@types/src/forms/controls/form-field-control.d.ts +0 -13
- package/@types/src/forms/controls/form-header.d.ts +0 -8
- package/@types/src/forms/controls/form-paragraph.d.ts +0 -7
- package/@types/src/forms/controls/frame.d.ts +0 -17
- package/@types/src/forms/controls/hidden-input.d.ts +0 -9
- package/@types/src/forms/controls/html.d.ts +0 -11
- package/@types/src/forms/controls/multiple-files.d.ts +0 -40
- package/@types/src/forms/controls/multiple-photos.d.ts +0 -19
- package/@types/src/forms/controls/number.d.ts +0 -13
- package/@types/src/forms/controls/photo.d.ts +0 -21
- package/@types/src/forms/controls/photo.test.d.ts +0 -1
- package/@types/src/forms/controls/radio.d.ts +0 -16
- package/@types/src/forms/controls/reverse-single-reference.d.ts +0 -1
- package/@types/src/forms/controls/simple-input.d.ts +0 -33
- package/@types/src/forms/controls/single-reference.d.ts +0 -13
- package/@types/src/forms/controls/single-reference.test.d.ts +0 -1
- package/@types/src/forms/controls/table.d.ts +0 -34
- package/@types/src/forms/controls/textarea.d.ts +0 -25
- package/@types/src/forms/controls/tickable.d.ts +0 -25
- package/@types/src/forms/fields/boolean.d.ts +0 -17
- package/@types/src/forms/fields/boolean.test.d.ts +0 -1
- package/@types/src/forms/fields/checkboxed-list.d.ts +0 -21
- package/@types/src/forms/fields/collection-field.d.ts +0 -15
- package/@types/src/forms/fields/email.d.ts +0 -7
- package/@types/src/forms/fields/email.test.d.ts +0 -1
- package/@types/src/forms/fields/enum-multiple.d.ts +0 -18
- package/@types/src/forms/fields/enum-multiple.test.d.ts +0 -1
- package/@types/src/forms/fields/enum.d.ts +0 -18
- package/@types/src/forms/fields/enum.test.d.ts +0 -1
- package/@types/src/forms/fields/existing-sealious-value.d.ts +0 -6
- package/@types/src/forms/fields/field.d.ts +0 -48
- package/@types/src/forms/fields/field.test.d.ts +0 -1
- package/@types/src/forms/fields/fields.d.ts +0 -16
- package/@types/src/forms/fields/file.d.ts +0 -19
- package/@types/src/forms/fields/file.test.d.ts +0 -1
- package/@types/src/forms/fields/multiple-files.d.ts +0 -14
- package/@types/src/forms/fields/number.d.ts +0 -23
- package/@types/src/forms/fields/number.test.d.ts +0 -1
- package/@types/src/forms/fields/pick-from-list.d.ts +0 -14
- package/@types/src/forms/fields/pick-from-list.test.d.ts +0 -1
- package/@types/src/forms/fields/proxy-field.d.ts +0 -13
- package/@types/src/forms/fields/regexp.d.ts +0 -16
- package/@types/src/forms/fields/regexp.test.d.ts +0 -1
- package/@types/src/forms/fields/reverse-single-reference.d.ts +0 -13
- package/@types/src/forms/fields/simple-form-field.d.ts +0 -9
- package/@types/src/forms/fields/structured-array.d.ts +0 -14
- package/@types/src/forms/fields/table.d.ts +0 -13
- package/@types/src/forms/form-types.d.ts +0 -26
- package/@types/src/forms/form.d.ts +0 -31
- package/@types/src/forms/form.test.d.ts +0 -6
- package/@types/src/forms/multiform.d.ts +0 -24
- package/@types/src/forms/multiform.test.d.ts +0 -1
- package/@types/src/generate-collections.d.ts +0 -2
- package/@types/src/generate-components.d.ts +0 -1
- package/@types/src/generate-routes.d.ts +0 -5
- package/@types/src/generate-routes.test.d.ts +0 -1
- package/@types/src/generate-stimulus.d.ts +0 -1
- package/@types/src/get-fonts.d.ts +0 -2
- package/@types/src/index.d.ts +0 -46
- package/@types/src/make-env.d.ts +0 -1
- package/@types/src/make-hidden-inputs.d.ts +0 -5
- package/@types/src/mount.d.ts +0 -7
- package/@types/src/notifier.d.ts +0 -2
- package/@types/src/page/access-control.d.ts +0 -6
- package/@types/src/page/default-list-filters.d.ts +0 -18
- package/@types/src/page/list.d.ts +0 -48
- package/@types/src/page/mountable-with-fields.d.ts +0 -42
- package/@types/src/page/mountable-with-fields.test.d.ts +0 -1
- package/@types/src/page/mountable.d.ts +0 -11
- package/@types/src/page/page.d.ts +0 -19
- package/@types/src/page/props-parser.d.ts +0 -16
- package/@types/src/page/sealious-list.d.ts +0 -20
- package/@types/src/page/sealious-list.test.d.ts +0 -1
- package/@types/src/page/stateful-page.d.ts +0 -63
- package/@types/src/page/stateful-page.test.d.ts +0 -1
- package/@types/src/register-external.d.ts +0 -2
- package/@types/src/register-external.test.d.ts +0 -1
- package/@types/src/run.d.ts +0 -1
- package/@types/src/sanitize.d.ts +0 -1
- package/@types/src/target-locreq.d.ts +0 -4
- package/@types/src/templates/collection.d.ts +0 -1
- package/@types/src/templates/form.d.ts +0 -16
- package/@types/src/templates/jdd-component.d.ts +0 -1
- package/@types/src/templates/jdd-editor.d.ts +0 -1
- package/@types/src/templates/list.d.ts +0 -1
- package/@types/src/templates/long-running-process.d.ts +0 -1
- package/@types/src/templates/multiform.d.ts +0 -1
- package/@types/src/templates/page.d.ts +0 -1
- package/@types/src/templates/post.d.ts +0 -1
- package/@types/src/templates/redirect.d.ts +0 -1
- package/@types/src/templates/route-test.d.ts +0 -1
- package/@types/src/templates/shared/collection-create-form.d.ts +0 -1
- package/@types/src/templates/shared/collection-edit-form.d.ts +0 -1
- package/@types/src/templates/shared/collection-list.d.ts +0 -16
- package/@types/src/templates/shared/confirm-item-delete.d.ts +0 -1
- package/@types/src/templates/shared/handlers/boolean.d.ts +0 -2
- package/@types/src/templates/shared/handlers/date.d.ts +0 -2
- package/@types/src/templates/shared/handlers/deep-reverse-single-reference.d.ts +0 -2
- package/@types/src/templates/shared/handlers/default.d.ts +0 -2
- package/@types/src/templates/shared/handlers/enum.d.ts +0 -2
- package/@types/src/templates/shared/handlers/file.d.ts +0 -2
- package/@types/src/templates/shared/handlers/image.d.ts +0 -2
- package/@types/src/templates/shared/handlers/int.d.ts +0 -2
- package/@types/src/templates/shared/handlers/jdd.d.ts +0 -2
- package/@types/src/templates/shared/handlers/settable-by.d.ts +0 -2
- package/@types/src/templates/shared/handlers/single-reference.d.ts +0 -2
- package/@types/src/templates/shared/handlers/structured-array.d.ts +0 -2
- package/@types/src/templates/shared/item-delete.d.ts +0 -1
- package/@types/src/templates/shared/shared-crud-form-fields.d.ts +0 -68
- package/@types/src/templates/stateful-page.d.ts +0 -1
- package/@types/src/templates/stimulus-controller.d.ts +0 -1
- package/@types/src/templates/templates.d.ts +0 -21
- package/@types/src/test_utils/exec_async.d.ts +0 -1
- package/@types/src/test_utils/locator_is_visible.d.ts +0 -2
- package/@types/src/test_utils/test-on-real-app.d.ts +0 -27
- package/@types/src/utils/assert-throws.d.ts +0 -1
- package/@types/src/utils/base64.d.ts +0 -2
- package/@types/src/utils/browser-creator.d.ts +0 -1
- package/@types/src/utils/escape-url-params.d.ts +0 -2
- package/@types/src/utils/exec.d.ts +0 -5
- package/@types/src/utils/extract-fields-from-collection.d.ts +0 -14
- package/@types/src/utils/format-external-url.d.ts +0 -1
- package/@types/src/utils/import-path.d.ts +0 -2
- package/@types/src/utils/input-wrapper.d.ts +0 -3
- package/@types/src/utils/list-collections.d.ts +0 -1
- package/@types/src/utils/make-slug.d.ts +0 -1
- package/@types/src/utils/module-dirname.d.ts +0 -1
- package/@types/src/utils/natural-numbers.d.ts +0 -1
- package/@types/src/utils/prettier.d.ts +0 -3
- package/@types/src/utils/question.d.ts +0 -1
- package/@types/src/utils/render-attributes.d.ts +0 -1
- package/@types/src/utils/sleep.d.ts +0 -1
- package/@types/src/utils/translate.d.ts +0 -3
- package/@types/src/utils/url-with-new-params.d.ts +0 -2
- package/@types/src/utils/utils.d.ts +0 -17
- package/@types/src/utils/walk.d.ts +0 -1
- package/@types/src/utils/with-fallback.d.ts +0 -2
- package/@types/src/utils/write-file.d.ts +0 -1
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { FormDataValue } from "../form-types.js";
|
|
2
|
-
import { Context } from "koa";
|
|
3
|
-
import { FieldParseResult, FormField } from "./field.js";
|
|
4
|
-
export declare class SimpleFormField<Required extends boolean> extends FormField<Required, string | null> {
|
|
5
|
-
parse(_: Context, raw_value: FormDataValue): Promise<FieldParseResult<string>>;
|
|
6
|
-
predicate: import("@sealcode/ts-predicates").Predicate<string>;
|
|
7
|
-
getEmptyValue(): string;
|
|
8
|
-
constructor(required: Required);
|
|
9
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Context } from "koa";
|
|
2
|
-
import { Field, FieldsetOutput, FieldTypes } from "sealious";
|
|
3
|
-
import { FormDataValue } from "../form-types.js";
|
|
4
|
-
import { FormField } from "./field.js";
|
|
5
|
-
export declare class StructuredArrayField<Fields extends Record<string, Field<unknown>>> extends FormField<true, FieldTypes.ArrayStorageInput<FieldsetOutput<Fields>>> {
|
|
6
|
-
sealious_field: FieldTypes.StructuredArray<Fields>;
|
|
7
|
-
constructor(sealious_field: FieldTypes.StructuredArray<Fields>);
|
|
8
|
-
parse(_context: Context, value: FormDataValue): Promise<{
|
|
9
|
-
parsable: true;
|
|
10
|
-
error: null;
|
|
11
|
-
parsed_value: FieldsetOutput<Fields>;
|
|
12
|
-
}>;
|
|
13
|
-
getEmptyValue(): FieldTypes.ArrayStorageInput<FieldsetOutput<Fields>>;
|
|
14
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Context } from "koa";
|
|
2
|
-
import { FormDataValue } from "../form-types.js";
|
|
3
|
-
import { FieldParseResult, FormField } from "./field.js";
|
|
4
|
-
export type ExtractFormFieldParsed<Field extends FormField> = Field extends FormField<true, infer T> ? NonNullable<T> : Field extends FormField<true, infer T> ? T : never;
|
|
5
|
-
export type TableFieldParsed<F extends Record<string, FormField>> = {
|
|
6
|
-
[field_name in keyof F]: ExtractFormFieldParsed<F[field_name]>;
|
|
7
|
-
}[];
|
|
8
|
-
export declare class Table<F extends Record<string, FormField>> extends FormField<false, TableFieldParsed<F>> {
|
|
9
|
-
columns: F;
|
|
10
|
-
constructor(columns: F);
|
|
11
|
-
getEmptyValue(): never[];
|
|
12
|
-
parse(ctx: Context, raw_value: FormDataValue): Promise<FieldParseResult<TableFieldParsed<F>>>;
|
|
13
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { FilePointer } from "@sealcode/file-manager";
|
|
2
|
-
import type { FlatTemplatable } from "tempstream";
|
|
3
|
-
import type { FormField } from "./fields/field.js";
|
|
4
|
-
export type FormDataPrimitive = string | string[] | number | undefined | FilePointer;
|
|
5
|
-
export type FormDataValue = FormDataPrimitive | Record<string, FormDataPrimitive>;
|
|
6
|
-
export type FieldValueType<F extends FormField> = F extends FormField<infer R> ? R : never;
|
|
7
|
-
export type FormFieldsToValues<F extends Record<string, FormField<boolean, keyof F>>> = {
|
|
8
|
-
[Property in keyof F]: FieldValueType<F[Property]>;
|
|
9
|
-
};
|
|
10
|
-
export type FormMessage = {
|
|
11
|
-
type: "info" | "success" | "error";
|
|
12
|
-
text: string;
|
|
13
|
-
};
|
|
14
|
-
export type FormData<Fieldnames extends string = string> = {
|
|
15
|
-
raw_values: Record<Fieldnames, FormDataValue>;
|
|
16
|
-
messages: FormMessage[];
|
|
17
|
-
};
|
|
18
|
-
export type FormReaction = {
|
|
19
|
-
action: "stay";
|
|
20
|
-
content: FlatTemplatable;
|
|
21
|
-
messages?: FormMessage[];
|
|
22
|
-
} | {
|
|
23
|
-
action: "redirect";
|
|
24
|
-
url: string;
|
|
25
|
-
messages?: FormMessage[];
|
|
26
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/// <reference types="koa__router" resolution-mode="require"/>
|
|
2
|
-
import { Context } from "koa";
|
|
3
|
-
import Router from "@koa/router";
|
|
4
|
-
import { FlatTemplatable } from "tempstream";
|
|
5
|
-
import { FormData, FormDataValue, FormMessage, FormReaction } from "./form-types.js";
|
|
6
|
-
import { Fields, MountableWithFields, PageErrorMessage } from "../page/mountable-with-fields.js";
|
|
7
|
-
export declare abstract class Form<F extends Fields, SubmitResult> extends MountableWithFields<F> {
|
|
8
|
-
defaultSuccessMessage: string;
|
|
9
|
-
submitButtonText: string;
|
|
10
|
-
action: string;
|
|
11
|
-
useTurbo: boolean;
|
|
12
|
-
form_id: string;
|
|
13
|
-
canAccess(_: Context): Promise<{
|
|
14
|
-
canAccess: boolean;
|
|
15
|
-
message: string;
|
|
16
|
-
}>;
|
|
17
|
-
renderError(_: Context, error: PageErrorMessage): Promise<FlatTemplatable>;
|
|
18
|
-
makeSubmitButton(): FlatTemplatable;
|
|
19
|
-
render(ctx: Context, data: FormData, show_field_errors: boolean): Promise<FlatTemplatable>;
|
|
20
|
-
makeFormClasses(_ctx: Context): Promise<string[]>;
|
|
21
|
-
makeOpenFormTag(ctx: Context): FlatTemplatable;
|
|
22
|
-
makeCloseFormTag(): FlatTemplatable;
|
|
23
|
-
onValuesInvalid(ctx: Context, form_messages: FormMessage[], _field_errors: Partial<Record<keyof Fields, string>>): Promise<FormReaction>;
|
|
24
|
-
onError(ctx: Context, data: FormData, error: unknown): Promise<FormReaction>;
|
|
25
|
-
abstract onSubmit(ctx: Context, data: FormData): SubmitResult | Promise<SubmitResult>;
|
|
26
|
-
onSuccess(ctx: Context, _data: FormData, _submitResult: SubmitResult): Promise<FormReaction>;
|
|
27
|
-
getRawValuesOnSuccess(ctx: Context): Promise<Record<string, FormDataValue>>;
|
|
28
|
-
handlePost(ctx: Context): Promise<FormReaction>;
|
|
29
|
-
mount(router: Router, path: string): void;
|
|
30
|
-
extractRawValues(ctx: Context): Promise<Record<string, FormDataValue>>;
|
|
31
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/// <reference types="koa__router" resolution-mode="require"/>
|
|
2
|
-
import Router from "@koa/router";
|
|
3
|
-
import { Context } from "koa";
|
|
4
|
-
import { FlatTemplatable } from "tempstream";
|
|
5
|
-
import { Fields, MountableWithFields } from "../page/mountable-with-fields.js";
|
|
6
|
-
import type { FormDataValue, FormMessage } from "./form-types.js";
|
|
7
|
-
import { Form } from "./form.js";
|
|
8
|
-
export declare class Multiform extends MountableWithFields {
|
|
9
|
-
controls: never[];
|
|
10
|
-
name: string;
|
|
11
|
-
forms: Record<string, Form<Fields, unknown>>;
|
|
12
|
-
init(): void;
|
|
13
|
-
extractRawValues(ctx: Context): Promise<Record<string, FormDataValue>>;
|
|
14
|
-
canAccess(): Promise<{
|
|
15
|
-
canAccess: boolean;
|
|
16
|
-
message: string;
|
|
17
|
-
}>;
|
|
18
|
-
getSubformsToRender(ctx: Context): Array<readonly [string, Form<any, unknown>]>;
|
|
19
|
-
renderSubform(ctx: Context, sub_form_name: string, show_field_errors: boolean): Promise<FlatTemplatable>;
|
|
20
|
-
getSubformRawValues(ctx: Context, sub_form_name: string): Promise<Record<string, FormDataValue>>;
|
|
21
|
-
render(ctx: Context, messages: FormMessage[], prerenderedForms: Record<string, import("tempstream/@types/stringify.js").Stringifiable | undefined> | undefined, show_field_errors: boolean): Promise<FlatTemplatable>;
|
|
22
|
-
makeBottomScript(): string;
|
|
23
|
-
mount(router: Router, path: string): void;
|
|
24
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function generateComponents(): Promise<void>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function generateStimulusControllers(controller_dirs: string[]): Promise<void>;
|
package/@types/src/index.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
export * as Controls from "./forms/controls/controls.js";
|
|
3
|
-
export * from "./forms/fields/field.js";
|
|
4
|
-
export * as Fields from "./forms/fields/fields.js";
|
|
5
|
-
export * from "./page/mountable.js";
|
|
6
|
-
export * from "./page/page.js";
|
|
7
|
-
export * from "./page/stateful-page.js";
|
|
8
|
-
export * from "./forms/form-types.js";
|
|
9
|
-
export * from "./forms/form.js";
|
|
10
|
-
export * from "./page/props-parser.js";
|
|
11
|
-
export * from "./utils/utils.js";
|
|
12
|
-
export * from "./page/list.js";
|
|
13
|
-
export * from "./page/sealious-list.js";
|
|
14
|
-
export * from "./utils/translate.js";
|
|
15
|
-
export * as sanitize from "./sanitize.js";
|
|
16
|
-
export * from "./forms/multiform.js";
|
|
17
|
-
export * as Components from "./components/components.js";
|
|
18
|
-
export * from "./mount.js";
|
|
19
|
-
export * from "./page/default-list-filters.js";
|
|
20
|
-
import { Context } from "koa";
|
|
21
|
-
import { Readable } from "node:stream";
|
|
22
|
-
export interface HTMLOptions {
|
|
23
|
-
morphing?: boolean;
|
|
24
|
-
}
|
|
25
|
-
export interface HTMLHeadOptions {
|
|
26
|
-
ctx: Context;
|
|
27
|
-
title: string | Promise<string | Readable>;
|
|
28
|
-
htmlOptions: Partial<HTMLOptions>;
|
|
29
|
-
metaImage?: string;
|
|
30
|
-
canonicalPath?: string;
|
|
31
|
-
css_clumps: string[];
|
|
32
|
-
description: string;
|
|
33
|
-
}
|
|
34
|
-
export interface HTMLArgs {
|
|
35
|
-
ctx: Context;
|
|
36
|
-
title: string | Promise<string>;
|
|
37
|
-
body: string | Promise<string>;
|
|
38
|
-
htmlOptions?: Partial<HTMLOptions>;
|
|
39
|
-
makeHead?: (args: HTMLHeadOptions) => string | Promise<string> | Readable | Promise<Readable>;
|
|
40
|
-
metaImage?: string;
|
|
41
|
-
canonicalPath?: string;
|
|
42
|
-
css_clumps?: string[];
|
|
43
|
-
description: string;
|
|
44
|
-
hideNavigation?: boolean;
|
|
45
|
-
}
|
|
46
|
-
export type HTMLFunc = (args: HTMLArgs) => Readable | Promise<Readable>;
|
package/@types/src/make-env.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function makeEnv(): Promise<void>;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Context } from "koa";
|
|
2
|
-
import { FlatTemplatable } from "tempstream";
|
|
3
|
-
import { FormField } from "./forms/fields/field.js";
|
|
4
|
-
import { FormDataValue } from "./forms/form-types.js";
|
|
5
|
-
export declare function makeHiddenInputs(ctx: Context, fields: Record<string, FormField>, values: Record<string, FormDataValue>, fields_to_skip: string[]): FlatTemplatable;
|
package/@types/src/mount.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/// <reference types="koa__router" resolution-mode="require"/>
|
|
2
|
-
import Router from "@koa/router";
|
|
3
|
-
import { FileManager } from "@sealcode/file-manager";
|
|
4
|
-
import { Mountable } from "./page/mountable.js";
|
|
5
|
-
export declare function mount(router: Router, url: string | {
|
|
6
|
-
rawURL: string;
|
|
7
|
-
}, mountable: Mountable, use_dummy_app?: boolean, file_manager?: FileManager | undefined): void;
|
package/@types/src/notifier.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { Context } from "koa";
|
|
2
|
-
import { Field } from "sealious";
|
|
3
|
-
import { FlatTemplatable } from "tempstream";
|
|
4
|
-
export type ListFilterRender = (value: string, field: Field<any>, ctx: Context) => FlatTemplatable;
|
|
5
|
-
export type DefaultListFilter = {
|
|
6
|
-
render: ListFilterRender;
|
|
7
|
-
prepareValue?: (filter_value: unknown) => unknown;
|
|
8
|
-
};
|
|
9
|
-
export declare const BooleanListFilter: {
|
|
10
|
-
render: (value: string, field: Field<any>) => string;
|
|
11
|
-
};
|
|
12
|
-
export declare const SimpleTextFilter: {
|
|
13
|
-
render: (value: string, field: Field<any>) => string;
|
|
14
|
-
prepareValue: (value: string) => {
|
|
15
|
-
regex: string;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
export declare const DefaultListFilters: Record<"boolean" | "text" | "fallback", DefaultListFilter>;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { Context } from "koa";
|
|
2
|
-
import { Templatable, FlatTemplatable } from "tempstream";
|
|
3
|
-
import { Page } from "./page.js";
|
|
4
|
-
import { ShapeToType } from "@sealcode/ts-predicates";
|
|
5
|
-
import { FormControl } from "../forms/controls/controls.js";
|
|
6
|
-
import { FormField } from "../forms/fields/field.js";
|
|
7
|
-
import { NumberField } from "../forms/fields/number.js";
|
|
8
|
-
import { SimpleFormField } from "../forms/fields/simple-form-field.js";
|
|
9
|
-
import { FormDataValue } from "../forms/form-types.js";
|
|
10
|
-
export declare const BasePagePropsShape: {};
|
|
11
|
-
export type BasePageProps = ShapeToType<typeof BasePagePropsShape>;
|
|
12
|
-
export declare const DEFAULT_ITEMS_PER_PAGE = 12;
|
|
13
|
-
export declare const BaseListPageFields: {
|
|
14
|
-
readonly page: NumberField<1, false>;
|
|
15
|
-
readonly itemsPerPage: NumberField<12, false>;
|
|
16
|
-
readonly sort: SimpleFormField<false>;
|
|
17
|
-
};
|
|
18
|
-
export type ListSort = {
|
|
19
|
-
field: string;
|
|
20
|
-
order: "asc" | "desc";
|
|
21
|
-
};
|
|
22
|
-
export declare abstract class ListPage<ItemType, F extends typeof BaseListPageFields> extends Page<F> {
|
|
23
|
-
abstract getItems(ctx: Context, page: number, itemsPerPage: number | null, values: Record<string, FormDataValue>): Promise<ItemType[]>;
|
|
24
|
-
abstract getTotalPages(ctx: Context, itemsPerPage: number, values: Record<string, FormDataValue>): Promise<number>;
|
|
25
|
-
abstract renderItem(ctx: Context, item: ItemType, index: number): Promise<FlatTemplatable>;
|
|
26
|
-
filterFields: Record<string, FormField>;
|
|
27
|
-
filterControls: FormControl[];
|
|
28
|
-
init(): void;
|
|
29
|
-
renderListContainer(_: Context, content: Templatable): FlatTemplatable;
|
|
30
|
-
getPaginationConfig(ctx: Context): Promise<{
|
|
31
|
-
page: number;
|
|
32
|
-
itemsPerPage: number | null;
|
|
33
|
-
}>;
|
|
34
|
-
renderItems(ctx: Context, values?: Record<string, FormDataValue>, items?: ItemType[]): Promise<FlatTemplatable>;
|
|
35
|
-
renderPagination(ctx: Context, values: Record<string, FormDataValue>): Promise<FlatTemplatable>;
|
|
36
|
-
private renderPageButton;
|
|
37
|
-
getFilterValues(ctx: Context): Promise<Record<string, unknown>>;
|
|
38
|
-
getSort(ctx: Context): Promise<ListSort | null>;
|
|
39
|
-
makeSortLink(ctx: Context, field: string, order: "asc" | "desc" | null): string;
|
|
40
|
-
renderFilters(ctx: Context): Promise<FlatTemplatable>;
|
|
41
|
-
renderHeading(ctx: Context, field: string, label?: string): Promise<FlatTemplatable>;
|
|
42
|
-
getDefaultSort(_: Context): ListSort | null;
|
|
43
|
-
renderTableHead(ctx: Context, fields: {
|
|
44
|
-
field: string;
|
|
45
|
-
label?: string;
|
|
46
|
-
}[]): FlatTemplatable;
|
|
47
|
-
render(ctx: Context): Promise<FlatTemplatable>;
|
|
48
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { ShapeToType } from "@sealcode/ts-predicates";
|
|
2
|
-
import { Context } from "koa";
|
|
3
|
-
import { FlatTemplatable } from "tempstream";
|
|
4
|
-
import { FormControl, FormControlContext } from "../forms/controls/form-control.js";
|
|
5
|
-
import type { FieldsToShape, FormField } from "../forms/fields/field.js";
|
|
6
|
-
import type { FormDataValue, FormMessage, FormData } from "../forms/form-types.js";
|
|
7
|
-
import { Mountable } from "./mountable.js";
|
|
8
|
-
export type PageErrorMessage = {
|
|
9
|
-
type: "access" | "internal";
|
|
10
|
-
message: string;
|
|
11
|
-
};
|
|
12
|
-
export type Fields = Record<string, FormField<boolean, any>>;
|
|
13
|
-
type Resolved<T> = T extends Promise<infer X> ? X : never;
|
|
14
|
-
type ParsedValue<T extends FormField> = Resolved<ReturnType<T["getValue"]>>["parsed"];
|
|
15
|
-
export declare abstract class MountableWithFields<F extends Fields = Fields> extends Mountable {
|
|
16
|
-
fields: F;
|
|
17
|
-
field_names_prefix: string;
|
|
18
|
-
form_id: string;
|
|
19
|
-
abstract controls: FormControl[];
|
|
20
|
-
constructor();
|
|
21
|
-
init(): void;
|
|
22
|
-
makeFormControlContext(ctx: Context, data: FormData, validate: boolean, field_name_prefix?: string, form_id?: string): FormControlContext;
|
|
23
|
-
validateValues(_ctx: Context, _data: Record<string, FormDataValue>): Promise<{
|
|
24
|
-
valid: boolean;
|
|
25
|
-
error: string;
|
|
26
|
-
}>;
|
|
27
|
-
getInitialValues(_ctx: Context): Promise<Record<string, FormDataValue>>;
|
|
28
|
-
validate(ctx: Context, values: Record<string, FormDataValue>): Promise<{
|
|
29
|
-
valid: boolean;
|
|
30
|
-
field_errors: Partial<Record<keyof Fields, string>>;
|
|
31
|
-
form_messages: FormMessage[];
|
|
32
|
-
}>;
|
|
33
|
-
renderControls(fctx: FormControlContext): FlatTemplatable;
|
|
34
|
-
renderError(_: Context, error: PageErrorMessage): Promise<FlatTemplatable>;
|
|
35
|
-
renderMessages(_: Context, data: FormData<keyof Fields>): FlatTemplatable;
|
|
36
|
-
abstract extractRawValues(ctx: Context): Promise<Record<string, FormDataValue>>;
|
|
37
|
-
getParsedValues(ctx: Context): Promise<{
|
|
38
|
-
[field in keyof F]: F[field] extends FormField<true> ? Exclude<ParsedValue<F[field]>, null> : ParsedValue<F[field]>;
|
|
39
|
-
}>;
|
|
40
|
-
getDatabaseValues(ctx: Context): Promise<ShapeToType<FieldsToShape<F>>>;
|
|
41
|
-
}
|
|
42
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/// <reference types="koa__router" resolution-mode="require"/>
|
|
2
|
-
import Router from "@koa/router";
|
|
3
|
-
import { Context } from "koa";
|
|
4
|
-
export declare abstract class Mountable {
|
|
5
|
-
init(): void;
|
|
6
|
-
abstract mount(router: Router, path: string): void;
|
|
7
|
-
abstract canAccess(ctx: Context): Promise<{
|
|
8
|
-
canAccess: boolean;
|
|
9
|
-
message: string;
|
|
10
|
-
}>;
|
|
11
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/// <reference types="koa__router" resolution-mode="require"/>
|
|
2
|
-
import Router from "@koa/router";
|
|
3
|
-
import { Context } from "koa";
|
|
4
|
-
import { FlatTemplatable } from "tempstream";
|
|
5
|
-
import type { FormDataValue } from "../forms/form-types.js";
|
|
6
|
-
import { Fields, MountableWithFields, PageErrorMessage } from "./mountable-with-fields.js";
|
|
7
|
-
import { PagePropsParser } from "./props-parser.js";
|
|
8
|
-
export declare abstract class Page<F extends Fields = Record<string, never>> extends MountableWithFields<F> {
|
|
9
|
-
propsParser: PagePropsParser<Record<keyof Fields, unknown>>;
|
|
10
|
-
controls: never[];
|
|
11
|
-
mount(router: Router, path: string): void;
|
|
12
|
-
canAccess(_: Context): Promise<{
|
|
13
|
-
canAccess: boolean;
|
|
14
|
-
message: string;
|
|
15
|
-
}>;
|
|
16
|
-
renderError(_: Context, error: PageErrorMessage): Promise<FlatTemplatable>;
|
|
17
|
-
abstract render(ctx: Context): Promise<FlatTemplatable>;
|
|
18
|
-
extractRawValues(ctx: Context): Promise<Record<string, FormDataValue>>;
|
|
19
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import { Context } from "koa";
|
|
3
|
-
import { FormDataValue } from "../forms/form-types.js";
|
|
4
|
-
import type { BasePageProps } from "./list.js";
|
|
5
|
-
export type EncodedProps = Record<string, unknown>;
|
|
6
|
-
export declare abstract class PagePropsParser<PropsType> {
|
|
7
|
-
abstract decode(ctx: Context): Record<string, FormDataValue>;
|
|
8
|
-
abstract encode(props: Record<string, FormData>): EncodedProps;
|
|
9
|
-
abstract getHTMLInputName(prop_name: string): string;
|
|
10
|
-
overwriteProp(ctx: Context, new_props: Partial<PropsType>): EncodedProps;
|
|
11
|
-
}
|
|
12
|
-
export declare class AllQueryParams<PropsType extends BasePageProps> extends PagePropsParser<PropsType> {
|
|
13
|
-
decode(ctx: Context): Record<string, FormDataValue>;
|
|
14
|
-
encode(props: PropsType): Record<string, unknown>;
|
|
15
|
-
getHTMLInputName(prop_name: string): string;
|
|
16
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Context } from "koa";
|
|
2
|
-
import { BaseListPageFields, ListPage } from "./list.js";
|
|
3
|
-
import { Collection, CollectionItem, ItemList, Context as SealiousContext } from "sealious";
|
|
4
|
-
import { FlatTemplatable, Templatable } from "tempstream";
|
|
5
|
-
export declare abstract class SealiousItemListPage<C extends Collection, F extends typeof BaseListPageFields> extends ListPage<CollectionItem<C>, F> {
|
|
6
|
-
collection: C;
|
|
7
|
-
constructor(collection: C);
|
|
8
|
-
getContextForList(ctx: Context): Promise<SealiousContext>;
|
|
9
|
-
getTotalPages(ctx: Context, itemsPerPage: number): Promise<number>;
|
|
10
|
-
protected addFilter(ctx: Context, list: ItemList<C>): Promise<void>;
|
|
11
|
-
makeQuery(ctx: Context): Promise<ItemList<C>>;
|
|
12
|
-
getItems(ctx: Context, page: number, itemsPerPage: number | null): Promise<CollectionItem<C>[]>;
|
|
13
|
-
getFilterValues(ctx: Context): Promise<Record<string, string | undefined>>;
|
|
14
|
-
renderListContainer(_: Context, content: Templatable): FlatTemplatable;
|
|
15
|
-
renderItem(_: Context, item: CollectionItem<C>, _index: number): Promise<FlatTemplatable>;
|
|
16
|
-
canAccess: (ctx: Context) => Promise<{
|
|
17
|
-
canAccess: boolean;
|
|
18
|
-
message: string;
|
|
19
|
-
}>;
|
|
20
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/// <reference types="koa__router" resolution-mode="require"/>
|
|
2
|
-
import Router from "@koa/router";
|
|
3
|
-
import { Context } from "koa";
|
|
4
|
-
import { Templatable } from "tempstream";
|
|
5
|
-
import { Mountable } from "./mountable.js";
|
|
6
|
-
export type StatefulPageActionDescription<ActionName> = {
|
|
7
|
-
action: ActionName;
|
|
8
|
-
label?: string;
|
|
9
|
-
content?: string;
|
|
10
|
-
disabled?: boolean;
|
|
11
|
-
} | ActionName;
|
|
12
|
-
export type StateAndMetadata<State, Actions> = {
|
|
13
|
-
state: State;
|
|
14
|
-
inputs: Record<string, string>;
|
|
15
|
-
action: keyof Actions;
|
|
16
|
-
action_args: string;
|
|
17
|
-
} | {
|
|
18
|
-
state: State;
|
|
19
|
-
inputs: Record<string, string>;
|
|
20
|
-
action: null;
|
|
21
|
-
action_args: null;
|
|
22
|
-
$: Record<string, unknown>;
|
|
23
|
-
};
|
|
24
|
-
export type StatefulPageActionArgument<State extends Record<string, unknown>, Args extends unknown[] = unknown[]> = {
|
|
25
|
-
ctx: Context;
|
|
26
|
-
state: State;
|
|
27
|
-
inputs: Record<string, string>;
|
|
28
|
-
args: Args;
|
|
29
|
-
page: StatefulPage<any, any>;
|
|
30
|
-
};
|
|
31
|
-
export type StatefulPageAction<State extends Record<string, unknown>, Args extends unknown[] = unknown[]> = (obj: StatefulPageActionArgument<State, Args>) => State | Promise<State>;
|
|
32
|
-
export type ExtractStatefulPageActionArgs<X> = X extends StatefulPageAction<any, infer Args> ? Args : never;
|
|
33
|
-
export declare abstract class StatefulPage<State extends Record<string, unknown>, Actions extends Record<string, StatefulPageAction<State>>> extends Mountable {
|
|
34
|
-
abstract actions: Actions;
|
|
35
|
-
abstract getInitialState(ctx: Context): State | Promise<State>;
|
|
36
|
-
abstract render(ctx: Context, state: State, inputs: Record<string, string>): Templatable | Promise<Templatable>;
|
|
37
|
-
canAccess(_ctx: Context): Promise<{
|
|
38
|
-
canAccess: boolean;
|
|
39
|
-
message: string;
|
|
40
|
-
}>;
|
|
41
|
-
constructor();
|
|
42
|
-
abstract wrapInLayout(ctx: Context, content: Templatable, state: State): Templatable;
|
|
43
|
-
wrapInForm(context: Context, state: State, content: Templatable): Promise<Templatable>;
|
|
44
|
-
extractActionAndLabel<ActionName extends keyof Actions>(action_description: StatefulPageActionDescription<ActionName>): {
|
|
45
|
-
action: string;
|
|
46
|
-
label: string;
|
|
47
|
-
content: string;
|
|
48
|
-
disabled: boolean;
|
|
49
|
-
};
|
|
50
|
-
makeActionURL<ActionName extends keyof Actions>(action_description: StatefulPageActionDescription<ActionName>, ...args: ExtractStatefulPageActionArgs<Actions[ActionName]>): string;
|
|
51
|
-
makeActionButton<ActionName extends keyof Actions>(_state: State, action_description: StatefulPageActionDescription<ActionName>, ...args: ExtractStatefulPageActionArgs<Actions[ActionName]>): string;
|
|
52
|
-
makeActionCallback<ActionName extends keyof Actions>(action_description: {
|
|
53
|
-
action: ActionName;
|
|
54
|
-
label?: string;
|
|
55
|
-
} | ActionName, ...args: ExtractStatefulPageActionArgs<Actions[ActionName]>): string;
|
|
56
|
-
rerender(): string;
|
|
57
|
-
preprocessState(values: State): Promise<State>;
|
|
58
|
-
preprocessOverrides(_context: Context, _state: State, values: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
59
|
-
serializeState(_context: Context, state: State): Promise<string>;
|
|
60
|
-
deserializeState(_context: Context, s: string): Promise<State>;
|
|
61
|
-
extractState(ctx: Context): Promise<StateAndMetadata<State, Actions>>;
|
|
62
|
-
mount(router: Router, path: string): void;
|
|
63
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/@types/src/run.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/@types/src/sanitize.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function attribute(raw: string | number): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function collectionTemplate(collection_name: string, fields_string?: string): string;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
declare const defaults: {
|
|
2
|
-
postimport: string;
|
|
3
|
-
fields: string;
|
|
4
|
-
controls: string;
|
|
5
|
-
validate_method: string;
|
|
6
|
-
onsubmit: string;
|
|
7
|
-
can_access: string;
|
|
8
|
-
render: string;
|
|
9
|
-
get_initial_values: string;
|
|
10
|
-
other_methods: string;
|
|
11
|
-
success_message: string;
|
|
12
|
-
};
|
|
13
|
-
export declare function formTemplate(action_name: string, newfilefullpath: string, _params?: Partial<typeof defaults> & {
|
|
14
|
-
success_message: string;
|
|
15
|
-
}): Promise<string>;
|
|
16
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function jddComponentTemplate(component_name: string): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function jddEditorTemplate(actionName: string): Promise<string>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const listTemplate: (action_name: string, newfilefullpath: string) => Promise<string>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function LongRunningProcessTemplate(action_name: string, newfilefullpath: string): Promise<string>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function multiformTemplate(action_name: string, newfilefullpath: string): Promise<string>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function pageTemplate(action_name: string, newfilefullpath: string): Promise<string>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function postTemplate(action_name: string): Promise<string>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function redirectTemplate(action_name: string): Promise<string>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function testTemplate(action_name: string, new_file_fullpath: string): Promise<string>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function createItemFormTemplate(create_action_name: string, newfilefullpath: string, collection_name: string, list_action: string): Promise<string>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function editItemFormTemplate(edit_action_name: string, newfilefullpath: string, collection_name: string, list_action: string): Promise<string>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export declare function makeDefaultFilterFields(collection_fields: {
|
|
2
|
-
name: string;
|
|
3
|
-
type: string;
|
|
4
|
-
}[]): string;
|
|
5
|
-
export declare function makeDefaultDisplayFields(collection_fields: {
|
|
6
|
-
name: string;
|
|
7
|
-
type: string;
|
|
8
|
-
}[]): string;
|
|
9
|
-
declare const default_hooks: {
|
|
10
|
-
pre_header_html: string;
|
|
11
|
-
post_header_html: string;
|
|
12
|
-
post_import_js: string;
|
|
13
|
-
render_item: (collection_name: string) => string;
|
|
14
|
-
};
|
|
15
|
-
export declare function collectionListTemplate(collection_name: string, action_name: string, _: string, _hooks?: Partial<typeof default_hooks>): Promise<string>;
|
|
16
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function askItemDeleteTemplate(ask_delete_action_name: string, collection_name: string, newfilefullpath: string, list_action_name: string, delete_action_name: string): Promise<string>;
|