@sealcode/sealgen 0.19.26 → 0.19.29

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.
Files changed (246) hide show
  1. package/@types/forms/controls/dropdown.d.ts +6 -6
  2. package/@types/forms/controls/single-reference.d.ts +9 -6
  3. package/@types/forms/fields/field.d.ts +2 -2
  4. package/@types/forms/fields/pick-from-list.d.ts +2 -2
  5. package/@types/forms/fields/simple-form-field.d.ts +1 -1
  6. package/@types/forms/multiform.d.ts +4 -3
  7. package/@types/page/stateful-page.d.ts +1 -1
  8. package/@types/src/add-collection.d.ts +1 -0
  9. package/@types/src/add-crud.d.ts +3 -0
  10. package/@types/src/add-crud.test.d.ts +1 -0
  11. package/@types/src/add-jdd-component.d.ts +1 -0
  12. package/@types/src/add-list-route.test.d.ts +1 -0
  13. package/@types/src/add-route.d.ts +3 -0
  14. package/@types/src/add-route.test.d.ts +1 -0
  15. package/@types/src/build.d.ts +3 -0
  16. package/@types/src/builders/backend-ts-builder.d.ts +7 -0
  17. package/@types/src/builders/builder.d.ts +11 -0
  18. package/@types/src/builders/colors-builder.d.ts +10 -0
  19. package/@types/src/builders/css-builder.d.ts +19 -0
  20. package/@types/src/builders/fonts-builder.d.ts +7 -0
  21. package/@types/src/builders/frontend-ts-builder.d.ts +11 -0
  22. package/@types/src/cli.d.ts +2 -0
  23. package/@types/src/components/components.d.ts +2 -0
  24. package/@types/src/components/tabs.d.ts +2 -0
  25. package/@types/src/components/toggle-modal.d.ts +6 -0
  26. package/@types/src/controllers/password-generate-button.stimulus.d.ts +5 -0
  27. package/@types/src/controllers/sealgen-table.stimulus.d.ts +13 -0
  28. package/@types/src/embeddable-file-extensions.d.ts +1 -0
  29. package/@types/src/esbuild-plugins/load-assets.d.ts +5 -0
  30. package/@types/src/esbuild-plugins/rewrite-asset-imports.d.ts +5 -0
  31. package/@types/src/example.test.d.ts +1 -0
  32. package/@types/src/forms/controls/array.d.ts +33 -0
  33. package/@types/src/forms/controls/autocomplete.d.ts +22 -0
  34. package/@types/src/forms/controls/big-radio-group.d.ts +14 -0
  35. package/@types/src/forms/controls/checkbox-group.d.ts +21 -0
  36. package/@types/src/forms/controls/checkbox.d.ts +17 -0
  37. package/@types/src/forms/controls/checkboxed-list-input.d.ts +21 -0
  38. package/@types/src/forms/controls/checkboxed-list-input.test.d.ts +1 -0
  39. package/@types/src/forms/controls/collapsible-checkbox-group.d.ts +11 -0
  40. package/@types/src/forms/controls/collapsible-field-group.d.ts +21 -0
  41. package/@types/src/forms/controls/controls.d.ts +32 -0
  42. package/@types/src/forms/controls/derived-frame.d.ts +19 -0
  43. package/@types/src/forms/controls/derived.d.ts +13 -0
  44. package/@types/src/forms/controls/dropdown.d.ts +30 -0
  45. package/@types/src/forms/controls/editable-collection-subset.d.ts +20 -0
  46. package/@types/src/forms/controls/field-group.d.ts +23 -0
  47. package/@types/src/forms/controls/file.d.ts +12 -0
  48. package/@types/src/forms/controls/file.test.d.ts +1 -0
  49. package/@types/src/forms/controls/form-control.d.ts +23 -0
  50. package/@types/src/forms/controls/form-field-control.d.ts +13 -0
  51. package/@types/src/forms/controls/form-header.d.ts +8 -0
  52. package/@types/src/forms/controls/form-paragraph.d.ts +7 -0
  53. package/@types/src/forms/controls/frame.d.ts +17 -0
  54. package/@types/src/forms/controls/hidden-input.d.ts +9 -0
  55. package/@types/src/forms/controls/html.d.ts +11 -0
  56. package/@types/src/forms/controls/hybrid.d.ts +10 -0
  57. package/@types/src/forms/controls/image.d.ts +19 -0
  58. package/@types/src/forms/controls/image.test.d.ts +1 -0
  59. package/@types/src/forms/controls/multiple-files.d.ts +42 -0
  60. package/@types/src/forms/controls/multiple-images.d.ts +19 -0
  61. package/@types/src/forms/controls/number.d.ts +13 -0
  62. package/@types/src/forms/controls/password-with-generator.d.ts +6 -0
  63. package/@types/src/forms/controls/radio.d.ts +16 -0
  64. package/@types/src/forms/controls/simple-input.d.ts +35 -0
  65. package/@types/src/forms/controls/single-reference.d.ts +14 -0
  66. package/@types/src/forms/controls/single-reference.test.d.ts +1 -0
  67. package/@types/src/forms/controls/table.d.ts +41 -0
  68. package/@types/src/forms/controls/textarea.d.ts +25 -0
  69. package/@types/src/forms/controls/tickable.d.ts +25 -0
  70. package/@types/src/forms/fields/boolean.d.ts +22 -0
  71. package/@types/src/forms/fields/boolean.test.d.ts +1 -0
  72. package/@types/src/forms/fields/checkboxed-list.d.ts +23 -0
  73. package/@types/src/forms/fields/collection-field.d.ts +22 -0
  74. package/@types/src/forms/fields/color.d.ts +4 -0
  75. package/@types/src/forms/fields/coordinates.d.ts +14 -0
  76. package/@types/src/forms/fields/date.d.ts +13 -0
  77. package/@types/src/forms/fields/datetime.d.ts +14 -0
  78. package/@types/src/forms/fields/deep-reverse-single-reference-list.d.ts +20 -0
  79. package/@types/src/forms/fields/deep-reverse-single-reference-table.d.ts +16 -0
  80. package/@types/src/forms/fields/email.d.ts +10 -0
  81. package/@types/src/forms/fields/email.test.d.ts +1 -0
  82. package/@types/src/forms/fields/enum-multiple-sealious.d.ts +16 -0
  83. package/@types/src/forms/fields/existing-sealious-value.d.ts +6 -0
  84. package/@types/src/forms/fields/field.d.ts +85 -0
  85. package/@types/src/forms/fields/field.test.d.ts +1 -0
  86. package/@types/src/forms/fields/fields.d.ts +34 -0
  87. package/@types/src/forms/fields/file.d.ts +25 -0
  88. package/@types/src/forms/fields/file.test.d.ts +1 -0
  89. package/@types/src/forms/fields/float.d.ts +4 -0
  90. package/@types/src/forms/fields/get-field-for-sealious.d.ts +33 -0
  91. package/@types/src/forms/fields/html.d.ts +6 -0
  92. package/@types/src/forms/fields/hybrid.d.ts +11 -0
  93. package/@types/src/forms/fields/image.d.ts +5 -0
  94. package/@types/src/forms/fields/int.d.ts +6 -0
  95. package/@types/src/forms/fields/item-draft.d.ts +20 -0
  96. package/@types/src/forms/fields/json.d.ts +13 -0
  97. package/@types/src/forms/fields/markdown.d.ts +6 -0
  98. package/@types/src/forms/fields/multiple-files.d.ts +16 -0
  99. package/@types/src/forms/fields/number.d.ts +25 -0
  100. package/@types/src/forms/fields/number.test.d.ts +1 -0
  101. package/@types/src/forms/fields/password.d.ts +10 -0
  102. package/@types/src/forms/fields/phone-number-with-country-code.d.ts +13 -0
  103. package/@types/src/forms/fields/phone-number.d.ts +17 -0
  104. package/@types/src/forms/fields/pick-from-list-sealious.d.ts +11 -0
  105. package/@types/src/forms/fields/pick-from-list.d.ts +15 -0
  106. package/@types/src/forms/fields/pick-from-list.test.d.ts +1 -0
  107. package/@types/src/forms/fields/proxy-field.d.ts +15 -0
  108. package/@types/src/forms/fields/regexp.d.ts +21 -0
  109. package/@types/src/forms/fields/regexp.test.d.ts +1 -0
  110. package/@types/src/forms/fields/simple-form-field.d.ts +31 -0
  111. package/@types/src/forms/fields/single-reference.d.ts +19 -0
  112. package/@types/src/forms/fields/structured-array.d.ts +23 -0
  113. package/@types/src/forms/fields/table.d.ts +16 -0
  114. package/@types/src/forms/fields/text.d.ts +6 -0
  115. package/@types/src/forms/fields/url.d.ts +6 -0
  116. package/@types/src/forms/form-types.d.ts +28 -0
  117. package/@types/src/forms/form.d.ts +34 -0
  118. package/@types/src/forms/form.test.d.ts +6 -0
  119. package/@types/src/forms/multiform.d.ts +23 -0
  120. package/@types/src/forms/multiform.test.d.ts +1 -0
  121. package/@types/src/generate-collections.d.ts +2 -0
  122. package/@types/src/generate-components.d.ts +1 -0
  123. package/@types/src/generate-routes.d.ts +5 -0
  124. package/@types/src/generate-routes.test.d.ts +1 -0
  125. package/@types/src/generate-stimulus.d.ts +1 -0
  126. package/@types/src/get-fonts.d.ts +2 -0
  127. package/@types/src/index.d.ts +48 -0
  128. package/@types/src/make-env.d.ts +1 -0
  129. package/@types/src/make-hidden-inputs.d.ts +5 -0
  130. package/@types/src/mount.d.ts +6 -0
  131. package/@types/src/notifier.d.ts +2 -0
  132. package/@types/src/page/access-control.d.ts +6 -0
  133. package/@types/src/page/default-list-filters.d.ts +18 -0
  134. package/@types/src/page/list.d.ts +49 -0
  135. package/@types/src/page/mountable-with-fields.d.ts +49 -0
  136. package/@types/src/page/mountable-with-fields.test.d.ts +1 -0
  137. package/@types/src/page/mountable.d.ts +10 -0
  138. package/@types/src/page/page.d.ts +18 -0
  139. package/@types/src/page/props-parser.d.ts +15 -0
  140. package/@types/src/page/sealious-list.d.ts +20 -0
  141. package/@types/src/page/sealious-list.test.d.ts +1 -0
  142. package/@types/src/page/stateful-page.d.ts +63 -0
  143. package/@types/src/page/stateful-page.test.d.ts +1 -0
  144. package/@types/src/register-external.d.ts +2 -0
  145. package/@types/src/register-external.test.d.ts +1 -0
  146. package/@types/src/run.d.ts +1 -0
  147. package/@types/src/sanitize.d.ts +1 -0
  148. package/@types/src/target-locreq.d.ts +4 -0
  149. package/@types/src/templates/collection.d.ts +1 -0
  150. package/@types/src/templates/form.d.ts +14 -0
  151. package/@types/src/templates/form.test.d.ts +1 -0
  152. package/@types/src/templates/jdd-component.d.ts +1 -0
  153. package/@types/src/templates/jdd-editor.d.ts +1 -0
  154. package/@types/src/templates/list.d.ts +1 -0
  155. package/@types/src/templates/long-running-process.d.ts +1 -0
  156. package/@types/src/templates/multiform.d.ts +1 -0
  157. package/@types/src/templates/page.d.ts +1 -0
  158. package/@types/src/templates/post.d.ts +1 -0
  159. package/@types/src/templates/redirect.d.ts +1 -0
  160. package/@types/src/templates/route-test.d.ts +1 -0
  161. package/@types/src/templates/shared/collection-create-form.d.ts +1 -0
  162. package/@types/src/templates/shared/collection-edit-form.d.ts +1 -0
  163. package/@types/src/templates/shared/collection-list.d.ts +16 -0
  164. package/@types/src/templates/shared/item-delete.d.ts +1 -0
  165. package/@types/src/templates/shared/shared-crud-form-fields.d.ts +1 -0
  166. package/@types/src/templates/stateful-page.d.ts +1 -0
  167. package/@types/src/templates/stimulus-controller.d.ts +1 -0
  168. package/@types/src/templates/templates.d.ts +1 -0
  169. package/@types/src/test_utils/exec_async.d.ts +1 -0
  170. package/@types/src/test_utils/locator_is_visible.d.ts +2 -0
  171. package/@types/src/test_utils/test-on-real-app.d.ts +26 -0
  172. package/@types/src/utils/assert-throws.d.ts +1 -0
  173. package/@types/src/utils/base64.d.ts +2 -0
  174. package/@types/src/utils/browser-creator.d.ts +1 -0
  175. package/@types/src/utils/escape-url-params.d.ts +2 -0
  176. package/@types/src/utils/exec.d.ts +5 -0
  177. package/@types/src/utils/extract-fields-from-collection.d.ts +14 -0
  178. package/@types/src/utils/format-external-url.d.ts +1 -0
  179. package/@types/src/utils/import-path.d.ts +2 -0
  180. package/@types/src/utils/input-wrapper.d.ts +5 -0
  181. package/@types/src/utils/list-collections.d.ts +1 -0
  182. package/@types/src/utils/make-slug.d.ts +1 -0
  183. package/@types/src/utils/module-dirname.d.ts +1 -0
  184. package/@types/src/utils/natural-numbers.d.ts +1 -0
  185. package/@types/src/utils/prettier.d.ts +3 -0
  186. package/@types/src/utils/question.d.ts +1 -0
  187. package/@types/src/utils/render-attributes.d.ts +1 -0
  188. package/@types/src/utils/sleep.d.ts +1 -0
  189. package/@types/src/utils/translate.d.ts +4 -0
  190. package/@types/src/utils/url-with-new-params.d.ts +2 -0
  191. package/@types/src/utils/utils.d.ts +17 -0
  192. package/@types/src/utils/walk.d.ts +1 -0
  193. package/@types/src/utils/with-fallback.d.ts +2 -0
  194. package/@types/src/utils/wrap-attributes.d.ts +3 -0
  195. package/@types/src/utils/write-file.d.ts +1 -0
  196. package/lib/add-route.js +1 -3
  197. package/lib/builders/colors-builder.js +4 -5
  198. package/lib/forms/controls/file.js +1 -1
  199. package/lib/forms/controls/multiple-files.js +6 -5
  200. package/lib/forms/controls/single-reference.js +4 -1
  201. package/lib/forms/controls/tickable.js +1 -1
  202. package/lib/forms/fields/file.js +5 -5
  203. package/lib/forms/fields/image.js +1 -3
  204. package/lib/forms/fields/phone-number-with-country-code.js +0 -1
  205. package/lib/forms/fields/simple-form-field.js +1 -1
  206. package/lib/forms/fields/structured-array.js +1 -2
  207. package/lib/get-fonts.js +5 -1
  208. package/lib/page/mountable-with-fields.js +1 -2
  209. package/lib/page/mountable-with-fields.test.js +1 -1
  210. package/lib/page/sealious-list.js +3 -1
  211. package/package.json +2 -2
  212. package/src/build.ts +1 -2
  213. package/src/cli.ts +4 -5
  214. package/src/forms/controls/controls.ts +0 -1
  215. package/src/forms/controls/dropdown.ts +15 -13
  216. package/src/forms/controls/file.ts +1 -1
  217. package/src/forms/controls/html.ts +4 -3
  218. package/src/forms/controls/multiple-files.ts +9 -12
  219. package/src/forms/controls/number.ts +8 -8
  220. package/src/forms/controls/single-reference.ts +25 -12
  221. package/src/forms/controls/table.ts +2 -2
  222. package/src/forms/controls/textarea.ts +4 -3
  223. package/src/forms/controls/tickable.ts +2 -2
  224. package/src/forms/fields/deep-reverse-single-reference-list.ts +2 -5
  225. package/src/forms/fields/deep-reverse-single-reference-table.ts +16 -14
  226. package/src/forms/fields/field.ts +4 -4
  227. package/src/forms/fields/file.ts +27 -21
  228. package/src/forms/fields/image.ts +1 -5
  229. package/src/forms/fields/phone-number-with-country-code.ts +1 -2
  230. package/src/forms/fields/pick-from-list.ts +2 -2
  231. package/src/forms/fields/simple-form-field.ts +3 -3
  232. package/src/forms/fields/structured-array.ts +2 -3
  233. package/src/forms/fields/table.ts +4 -7
  234. package/src/forms/multiform.ts +9 -6
  235. package/src/generate-routes.ts +3 -3
  236. package/src/get-fonts.ts +7 -3
  237. package/src/notifier.ts +1 -2
  238. package/src/page/list.ts +4 -4
  239. package/src/page/mountable-with-fields.test.ts +1 -1
  240. package/src/page/mountable-with-fields.ts +4 -4
  241. package/src/page/sealious-list.ts +17 -8
  242. package/src/page/stateful-page.ts +1 -1
  243. package/src/templates/jdd-editor.ts +1 -1
  244. package/src/test_utils/test-on-real-app.ts +5 -5
  245. package/tsconfig.json +2 -0
  246. package/src/forms/controls/big-radio-group.ts +0 -48
@@ -0,0 +1,23 @@
1
+ import Router from "@koa/router";
2
+ import { Context } from "koa";
3
+ import { FlatTemplatable } from "tempstream";
4
+ import { Fields, MountableWithFields } from "../page/mountable-with-fields.js";
5
+ import type { FormDataValue, FormMessage } from "./form-types.js";
6
+ import { Form } from "./form.js";
7
+ export declare class Multiform extends MountableWithFields {
8
+ getControls: () => never[];
9
+ name: string;
10
+ forms: Record<string, Form<Fields, unknown>>;
11
+ init(path: string, router: Router): void;
12
+ extractRawValues(ctx: Context): Promise<Record<string, FormDataValue>>;
13
+ canAccess(): Promise<{
14
+ canAccess: boolean;
15
+ message: string;
16
+ }>;
17
+ getSubformsToRender(ctx: Context): Array<readonly [string, Form<any, unknown>]>;
18
+ renderSubform(ctx: Context, sub_form_name: string, show_field_errors: boolean): Promise<FlatTemplatable>;
19
+ getSubformRawValues(ctx: Context, sub_form_name: string): Promise<Record<string, FormDataValue>>;
20
+ render(ctx: Context, messages: FormMessage[], prerenderedForms: Record<string, FlatTemplatable | undefined> | undefined, show_field_errors: boolean): Promise<FlatTemplatable>;
21
+ makeBottomScript(): string;
22
+ mount(router: Router, path: string): void;
23
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare function extractCollectionClassname(full_file_path: string): Promise<string>;
2
+ export declare function generateCollections(): Promise<void>;
@@ -0,0 +1 @@
1
+ export declare function generateComponents(): Promise<void>;
@@ -0,0 +1,5 @@
1
+ export declare function generateURL(actionName: string, url: string): string;
2
+ export declare function sortRoutes<T extends {
3
+ url: string;
4
+ }>(urls: T[]): T[];
5
+ export declare function generateRoutes(): Promise<void>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare function generateStimulusControllers(controller_dirs: string[]): Promise<void>;
@@ -0,0 +1,2 @@
1
+ export declare const FONTS_CONFIG_PATH = "src/fonts.json";
2
+ export declare function getFonts(_?: Record<string, string | boolean>): Promise<void>;
@@ -0,0 +1,48 @@
1
+ export * as Controls from "./forms/controls/controls.js";
2
+ export * from "./forms/fields/field.js";
3
+ export * as Fields from "./forms/fields/fields.js";
4
+ export * from "./page/mountable.js";
5
+ export * from "./page/page.js";
6
+ export * from "./page/stateful-page.js";
7
+ export * from "./forms/form-types.js";
8
+ export * from "./forms/form.js";
9
+ export * from "./page/props-parser.js";
10
+ export * from "./utils/utils.js";
11
+ export * from "./page/list.js";
12
+ export * from "./page/sealious-list.js";
13
+ export * from "./utils/translate.js";
14
+ export * as sanitize from "./sanitize.js";
15
+ export * from "./forms/multiform.js";
16
+ export * as Components from "./components/components.js";
17
+ export * from "./mount.js";
18
+ export * from "./page/default-list-filters.js";
19
+ export * from "./forms/fields/get-field-for-sealious.js";
20
+ export * from "./forms/controls/form-control.js";
21
+ import { Context } from "koa";
22
+ import { Readable } from "node:stream";
23
+ export interface HTMLOptions {
24
+ morphing?: boolean;
25
+ }
26
+ export interface HTMLHeadOptions {
27
+ ctx: Context;
28
+ title: string | Promise<string | Readable>;
29
+ htmlOptions: Partial<HTMLOptions>;
30
+ metaImage?: string;
31
+ canonicalPath?: string;
32
+ css_clumps: string[];
33
+ description: string;
34
+ }
35
+ export interface HTMLArgs {
36
+ ctx: Context;
37
+ title: string | Promise<string>;
38
+ body: string | Promise<string> | Readable;
39
+ htmlOptions?: Partial<HTMLOptions>;
40
+ makeHead?: (args: HTMLHeadOptions) => string | Promise<string> | Readable | Promise<Readable>;
41
+ metaImage?: string;
42
+ canonicalPath?: string;
43
+ css_clumps?: string[];
44
+ description: string;
45
+ hideNavigation?: boolean;
46
+ }
47
+ export type HTMLFunc = (args: HTMLArgs) => Readable | Promise<Readable>;
48
+ export type BreadcrumbLabel = string | ((ctx: Context) => Promise<string>);
@@ -0,0 +1 @@
1
+ export declare function makeEnv(): Promise<void>;
@@ -0,0 +1,5 @@
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;
@@ -0,0 +1,6 @@
1
+ import Router from "@koa/router";
2
+ import { FileManager } from "@sealcode/file-manager";
3
+ import { Mountable } from "./page/mountable.js";
4
+ export declare function mount(router: Router, url: string | {
5
+ rawURL: string;
6
+ }, mountable: Mountable, use_dummy_app?: boolean, file_manager?: FileManager | undefined): void;
@@ -0,0 +1,2 @@
1
+ export declare const APP_BACK_ALIVE_SIGNAL = "app-back-alive";
2
+ export declare function make_notifier(port: number, app_port: number): (message: string) => void;
@@ -0,0 +1,6 @@
1
+ import { Context } from "koa";
2
+ import { ActionName, Collection } from "sealious";
3
+ export declare function peopleWhoCan(action: ActionName, collection: Collection): (ctx: Context) => Promise<{
4
+ canAccess: boolean;
5
+ message: string;
6
+ }>;
@@ -0,0 +1,18 @@
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>;
@@ -0,0 +1,49 @@
1
+ import { ShapeToType } from "@sealcode/ts-predicates";
2
+ import { Context } from "koa";
3
+ import { FlatTemplatable, Templatable } from "tempstream";
4
+ import { FormControl } from "../forms/controls/controls.js";
5
+ import { FormField } from "../forms/fields/field.js";
6
+ import { NumberField } from "../forms/fields/number.js";
7
+ import { TextBasedSimpleField } from "../forms/fields/simple-form-field.js";
8
+ import { FormDataValue } from "../forms/form-types.js";
9
+ import { Page } from "./page.js";
10
+ import Router from "@koa/router";
11
+ export declare const BasePagePropsShape: {};
12
+ export type BasePageProps = ShapeToType<typeof BasePagePropsShape>;
13
+ export declare const DEFAULT_ITEMS_PER_PAGE = 12;
14
+ export declare const BaseListPageFields: {
15
+ readonly page: NumberField<1, false>;
16
+ readonly itemsPerPage: NumberField<12, false>;
17
+ readonly sort: TextBasedSimpleField<false, import("../forms/controls/simple-input.js").SimpleInput<import("../forms/controls/simple-input.js").SimpleInputOptions>>;
18
+ };
19
+ export type ListSort = {
20
+ field: string;
21
+ order: "asc" | "desc";
22
+ };
23
+ export declare abstract class ListPage<ItemType, F extends typeof BaseListPageFields> extends Page<F> {
24
+ abstract getItems(ctx: Context, page: number, itemsPerPage: number | null, values: Record<string, FormDataValue>): Promise<ItemType[]>;
25
+ abstract getTotalPages(ctx: Context, itemsPerPage: number, values: Record<string, FormDataValue>): Promise<number>;
26
+ abstract renderItem(ctx: Context, item: ItemType, index: number): Promise<FlatTemplatable>;
27
+ filterFields: Record<string, FormField>;
28
+ filterControls: FormControl[];
29
+ init(path: string, router: Router): void;
30
+ renderListContainer(_: Context, content: Templatable): FlatTemplatable;
31
+ getPaginationConfig(ctx: Context): Promise<{
32
+ page: number;
33
+ itemsPerPage: number | null;
34
+ }>;
35
+ renderItems(ctx: Context, values?: Record<string, FormDataValue>, items?: ItemType[]): Promise<FlatTemplatable>;
36
+ renderPagination(ctx: Context, values: Record<string, FormDataValue>): Promise<FlatTemplatable>;
37
+ private renderPageButton;
38
+ getFilterValues(ctx: Context): Promise<Record<string, unknown>>;
39
+ getSort(ctx: Context): Promise<ListSort | null>;
40
+ makeSortLink(ctx: Context, field: string, order: "asc" | "desc" | null): string;
41
+ renderFilters(ctx: Context): Promise<FlatTemplatable>;
42
+ renderHeading(ctx: Context, field: string, label?: string): Promise<FlatTemplatable>;
43
+ getDefaultSort(_: Context): ListSort | null;
44
+ renderTableHead(ctx: Context, fields: {
45
+ field: string;
46
+ label?: string;
47
+ }[]): FlatTemplatable;
48
+ render(ctx: Context): Promise<FlatTemplatable>;
49
+ }
@@ -0,0 +1,49 @@
1
+ import { ShapeToType } from "@sealcode/ts-predicates";
2
+ import { Context } from "koa";
3
+ import { FlatTemplatable } from "tempstream";
4
+ import { FieldMessages, 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
+ import Router from "@koa/router";
9
+ export type PageErrorMessage = {
10
+ type: "access" | "internal";
11
+ message: string;
12
+ };
13
+ export type Fields = Record<string, FormField<boolean, any>>;
14
+ type Resolved<T> = T extends Promise<infer X> ? X : never;
15
+ type ParsedValue<T extends FormField> = Resolved<ReturnType<T["getParsedValue"]>>["parsed"];
16
+ export declare abstract class MountableWithFields<F extends Fields = Fields> extends Mountable {
17
+ getFields: () => F;
18
+ fields: F;
19
+ initialized: boolean;
20
+ field_names_prefix: string;
21
+ form_id: string;
22
+ abstract getControls: (fields: F) => FormControl[];
23
+ controls: FormControl[];
24
+ constructor();
25
+ /** most routes should be setup using .mount(), but mount runs before
26
+ initialization so we don't yet have controls, app, etc ready for dynamic
27
+ routes **/
28
+ init(path: string, router: Router): void;
29
+ makeFormControlContext(ctx: Context, data: FormData, validate: boolean, field_name_prefix?: string, form_id?: string): FormControlContext;
30
+ validateValues(_ctx: Context, _data: Record<string, FormDataValue>): Promise<{
31
+ valid: boolean;
32
+ error: string;
33
+ }>;
34
+ getInitialValues(_ctx: Context): Promise<Record<string, FormDataValue>>;
35
+ validate(ctx: Context, values: Record<string, FormDataValue>): Promise<{
36
+ valid: boolean;
37
+ field_errors: FieldMessages;
38
+ form_messages: FormMessage[];
39
+ }>;
40
+ renderControls(fctx: FormControlContext): FlatTemplatable;
41
+ renderError(_: Context, error: PageErrorMessage): Promise<FlatTemplatable>;
42
+ renderMessages(_: Context, data: FormData<keyof Fields>): FlatTemplatable;
43
+ abstract extractRawValues(ctx: Context): Promise<Record<string, FormDataValue>>;
44
+ getParsedValues(ctx: Context): Promise<{
45
+ [field in keyof F]: F[field] extends FormField<true> ? Exclude<ParsedValue<F[field]>, null> : ParsedValue<F[field]>;
46
+ }>;
47
+ getDatabaseValues(ctx: Context): Promise<ShapeToType<FieldsToShape<F>>>;
48
+ }
49
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import Router from "@koa/router";
2
+ import { Context } from "koa";
3
+ export declare abstract class Mountable {
4
+ init(_path: string, _router: Router): void;
5
+ abstract mount(router: Router, path: string): void;
6
+ abstract canAccess(ctx: Context): Promise<{
7
+ canAccess: boolean;
8
+ message: string;
9
+ }>;
10
+ }
@@ -0,0 +1,18 @@
1
+ import Router from "@koa/router";
2
+ import { Context } from "koa";
3
+ import { FlatTemplatable } from "tempstream";
4
+ import type { FormDataValue } from "../forms/form-types.js";
5
+ import { Fields, MountableWithFields, PageErrorMessage } from "./mountable-with-fields.js";
6
+ import { PagePropsParser } from "./props-parser.js";
7
+ export declare abstract class Page<F extends Fields = Record<string, never>> extends MountableWithFields<F> {
8
+ propsParser: PagePropsParser<Record<keyof Fields, unknown>>;
9
+ getControls: () => never[];
10
+ mount(router: Router, path: string): void;
11
+ canAccess(_: Context): Promise<{
12
+ canAccess: boolean;
13
+ message: string;
14
+ }>;
15
+ renderError(_: Context, error: PageErrorMessage): Promise<FlatTemplatable>;
16
+ abstract render(ctx: Context): Promise<FlatTemplatable>;
17
+ extractRawValues(ctx: Context): Promise<Record<string, FormDataValue>>;
18
+ }
@@ -0,0 +1,15 @@
1
+ import { Context } from "koa";
2
+ import { FormDataValue } from "../forms/form-types.js";
3
+ import type { BasePageProps } from "./list.js";
4
+ export type EncodedProps = Record<string, unknown>;
5
+ export declare abstract class PagePropsParser<PropsType> {
6
+ abstract decode(ctx: Context): Record<string, FormDataValue>;
7
+ abstract encode(props: Record<string, FormData>): EncodedProps;
8
+ abstract getHTMLInputName(prop_name: string): string;
9
+ overwriteProp(ctx: Context, new_props: Partial<PropsType>): EncodedProps;
10
+ }
11
+ export declare class AllQueryParams<PropsType extends BasePageProps> extends PagePropsParser<PropsType> {
12
+ decode(ctx: Context): Record<string, FormDataValue>;
13
+ encode(props: PropsType): Record<string, unknown>;
14
+ getHTMLInputName(prop_name: string): string;
15
+ }
@@ -0,0 +1,20 @@
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
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,63 @@
1
+ import Router from "@koa/router";
2
+ import { Context } from "koa";
3
+ import { Templatable } from "tempstream";
4
+ import { Mountable } from "./mountable.js";
5
+ export type StatefulPageActionDescription<ActionName> = {
6
+ action: ActionName;
7
+ label?: string;
8
+ content?: string;
9
+ disabled?: boolean;
10
+ } | ActionName;
11
+ export type StateAndMetadata<State, Actions> = {
12
+ state: State;
13
+ inputs: Record<string, string>;
14
+ action: keyof Actions;
15
+ action_args: string;
16
+ } | {
17
+ state: State;
18
+ inputs: Record<string, string>;
19
+ action: null;
20
+ action_args: null;
21
+ $: Record<string, unknown>;
22
+ };
23
+ export type StatefulPageActionArgument<State extends Record<string, unknown>, Args extends unknown[] = unknown[]> = {
24
+ ctx: Context;
25
+ state: State;
26
+ inputs: Record<string, string>;
27
+ args: Args;
28
+ page: StatefulPage<any, any>;
29
+ };
30
+ export type StatefulPageAction<State extends Record<string, unknown>, Args extends unknown[] = unknown[]> = (obj: StatefulPageActionArgument<State, Args>) => State | Promise<State>;
31
+ export type ExtractStatefulPageActionArgs<X> = X extends StatefulPageAction<any, infer Args> ? Args : never;
32
+ export declare abstract class StatefulPage<State extends Record<string, unknown>, Actions extends Record<string, StatefulPageAction<State>>> extends Mountable {
33
+ form_id?: string | undefined;
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(form_id?: string | undefined);
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
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare function registerExternalControllers(_args: Record<string, string | boolean>): Promise<void>;
2
+ export declare function registerExternalStyles(_args: Record<string, string | boolean>): Promise<void>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare function attribute(raw: string | number): string;
@@ -0,0 +1,4 @@
1
+ export declare const target_locreq: {
2
+ (module_path: string): unknown;
3
+ resolve: (module_path: string) => string;
4
+ };
@@ -0,0 +1 @@
1
+ export declare function collectionTemplate(collection_name: string, fields_string?: string): string;
@@ -0,0 +1,14 @@
1
+ declare const defaults: {
2
+ postimport: string;
3
+ get_fields: string;
4
+ get_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, _params?: Partial<typeof defaults>): Promise<string>;
14
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare function jddComponentTemplate(component_name: string): Promise<string>;
@@ -0,0 +1 @@
1
+ export declare function jddEditorTemplate(actionName: string): Promise<string>;
@@ -0,0 +1 @@
1
+ export declare const listTemplate: (action_name: string, newfilefullpath: string) => Promise<string>;
@@ -0,0 +1 @@
1
+ export declare function LongRunningProcessTemplate(action_name: string): Promise<string>;
@@ -0,0 +1 @@
1
+ export declare function multiformTemplate(action_name: string): Promise<string>;
@@ -0,0 +1 @@
1
+ export declare function pageTemplate(action_name: string): Promise<string>;
@@ -0,0 +1 @@
1
+ export declare function postTemplate(action_name: string): Promise<string>;
@@ -0,0 +1 @@
1
+ export declare function redirectTemplate(action_name: string): Promise<string>;
@@ -0,0 +1 @@
1
+ export declare function testTemplate(action_name: string): Promise<string>;
@@ -0,0 +1 @@
1
+ export declare function createItemFormTemplate(create_action_name: string, newfilefullpath: string, collection_name: string, list_action: string): Promise<string>;
@@ -0,0 +1 @@
1
+ export declare function editItemFormTemplate(edit_action_name: string, newfilefullpath: string, collection_name: string, list_action: string): Promise<string>;
@@ -0,0 +1,16 @@
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 {};
@@ -0,0 +1 @@
1
+ export declare function itemDeleteTemplate(delete_action_name: string, collection_name: string, list_action_name: string): Promise<string>;
@@ -0,0 +1 @@
1
+ export declare function sharedCrudFormFields(collection_name: string): Promise<string>;
@@ -0,0 +1 @@
1
+ export declare function statefulPageTemplate(action_name: string): Promise<string>;
@@ -0,0 +1 @@
1
+ export declare function jddComponentTemplate(controller_name: string): string;
@@ -0,0 +1 @@
1
+ export declare const Templates: Record<string, (action: string, params: any) => Promise<string>>;
@@ -0,0 +1 @@
1
+ export declare const execAsync: (cmd: string) => Promise<void>;
@@ -0,0 +1,2 @@
1
+ import { Locator } from "playwright";
2
+ export declare function locator_is_visible(locator: Locator, timeout?: number): Promise<boolean>;
@@ -0,0 +1,26 @@
1
+ import EventEmitter from "events";
2
+ export declare const callSealgenBin: () => string;
3
+ export declare class RealAppTest {
4
+ node_pid: number;
5
+ app_port: number;
6
+ mongo_port: number;
7
+ app_path: string;
8
+ container_name: string;
9
+ emitter: EventEmitter<[never]>;
10
+ static init(): Promise<RealAppTest>;
11
+ start(): Promise<void>;
12
+ close(): Promise<void>;
13
+ runSealgenCommand(command: string): Promise<void>;
14
+ build(): Promise<void>;
15
+ throwIfItKillsTheApp<T>(cb: () => Promise<T>): Promise<T>;
16
+ httpGET(path: string): Promise<{
17
+ status: number;
18
+ response: string;
19
+ }>;
20
+ httpPOST(path: string, body: Record<string, unknown>): Promise<{
21
+ status: number;
22
+ response: string;
23
+ }>;
24
+ addFile(target_path: string, content: string): Promise<void>;
25
+ fullURL(path: string): string;
26
+ }
@@ -0,0 +1 @@
1
+ export declare function assertThrowsAsync(fn: () => Promise<unknown>, error_handler?: (e: unknown) => Promise<void> | void): Promise<void>;
@@ -0,0 +1,2 @@
1
+ export declare function to_base64(s: string): string;
2
+ export declare function from_base64(s: string): string;
@@ -0,0 +1 @@
1
+ export function getBrowser(): Promise<any>;
@@ -0,0 +1,2 @@
1
+ export declare function escape_url_params(url: string): string;
2
+ export declare function unescape_url_params(url: string): string;
@@ -0,0 +1,5 @@
1
+ export declare function exec(program: string, args: string[]): Promise<{
2
+ stderr: string;
3
+ stdout: string;
4
+ exitCode: number;
5
+ }>;
@@ -0,0 +1,14 @@
1
+ import { FormField } from "../forms/fields/field.js";
2
+ export type ExtractedFieldInfo = {
3
+ name: string;
4
+ type: string;
5
+ target: string | null;
6
+ referencing_collection: string | null;
7
+ referencing_field: string | null;
8
+ intermediary_field_that_points_there: string | null;
9
+ is_required: boolean;
10
+ };
11
+ export type ExtractedFieldInfoWithFormField = ExtractedFieldInfo & {
12
+ form_field: FormField;
13
+ };
14
+ export default function extract_fields_from_collection(collection_name: string): Promise<ExtractedFieldInfoWithFormField[]>;
@@ -0,0 +1 @@
1
+ export declare function formatExternalURL(url: string): string;
@@ -0,0 +1,2 @@
1
+ export declare function importPath(project_module_path: string, project_target_path: string): string;
2
+ export declare function curryImportPath(project_module_path: string): (project_target_path: string) => string;
@@ -0,0 +1,5 @@
1
+ import { FlatTemplatable } from "tempstream";
2
+ import { FormField } from "../index.js";
3
+ export declare function getRequiredClass(isRequired: boolean): string;
4
+ export declare function inputWrapper(type: string, modifiers: string[], input: FlatTemplatable): Promise<string>;
5
+ export declare function autoWrapInput(field: FormField, input: FlatTemplatable): Promise<string>;
@@ -0,0 +1 @@
1
+ export declare function listCollections(): Promise<string[]>;
@@ -0,0 +1 @@
1
+ export declare function makeSlug(t: string): string;
@@ -0,0 +1 @@
1
+ export declare function module_dirname(module_url: string): string;
@@ -0,0 +1 @@
1
+ export declare function naturalNumbers(min: number, max: number): Generator<number, void, unknown>;
@@ -0,0 +1,3 @@
1
+ import { Options } from "prettier";
2
+ export declare function getPrettierConfig(parser?: string): Promise<Options>;
3
+ export declare function formatWithPrettier(content: string, lang?: string): Promise<string>;
@@ -0,0 +1 @@
1
+ export declare function question(text: string, validator: (answer: string) => boolean): Promise<string>;
@@ -0,0 +1 @@
1
+ export declare function renderAttributes(attrs: Record<string, string | boolean>): string;