@sealcode/sealgen 0.19.24 → 0.19.25-hotfix1

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 (224) hide show
  1. package/@types/forms/controls/array.d.ts +3 -1
  2. package/@types/forms/controls/controls.d.ts +0 -1
  3. package/@types/forms/controls/dropdown.d.ts +6 -6
  4. package/@types/forms/controls/single-reference.d.ts +8 -6
  5. package/@types/forms/fields/CollectionField.d.ts +1 -0
  6. package/@types/forms/fields/boolean.d.ts +1 -2
  7. package/@types/forms/fields/collection-field.d.ts +12 -5
  8. package/@types/forms/fields/coordinates.d.ts +2 -2
  9. package/@types/forms/fields/date.d.ts +1 -2
  10. package/@types/forms/fields/datetime.d.ts +1 -2
  11. package/@types/forms/fields/deep-reverse-single-reference-list.d.ts +1 -1
  12. package/@types/forms/fields/deep-reverse-single-reference-table.d.ts +1 -2
  13. package/@types/forms/fields/enum-multiple-sealious.d.ts +1 -2
  14. package/@types/forms/fields/field.d.ts +8 -4
  15. package/@types/forms/fields/fields.d.ts +1 -0
  16. package/@types/forms/fields/file.d.ts +4 -3
  17. package/@types/forms/fields/int.d.ts +1 -2
  18. package/@types/forms/fields/json.d.ts +1 -2
  19. package/@types/forms/fields/phone-number-with-country-code.d.ts +1 -2
  20. package/@types/forms/fields/pick-from-list.d.ts +2 -2
  21. package/@types/forms/fields/regexp.d.ts +1 -2
  22. package/@types/forms/fields/simple-form-field.d.ts +3 -4
  23. package/@types/forms/fields/single-reference.d.ts +2 -3
  24. package/@types/forms/fields/structured-array.d.ts +1 -2
  25. package/@types/forms/fields/structured.d.ts +19 -0
  26. package/@types/forms/fields/text.d.ts +1 -2
  27. package/@types/forms/fields/url.d.ts +1 -2
  28. package/@types/forms/multiform.d.ts +4 -3
  29. package/@types/index.d.ts +29 -18
  30. package/@types/page/stateful-page.d.ts +1 -1
  31. package/@types/src/add-collection.d.ts +1 -0
  32. package/@types/src/add-crud.d.ts +3 -0
  33. package/@types/src/add-crud.test.d.ts +1 -0
  34. package/@types/src/add-jdd-component.d.ts +1 -0
  35. package/@types/src/add-list-route.test.d.ts +1 -0
  36. package/@types/src/add-route.d.ts +3 -0
  37. package/@types/src/add-route.test.d.ts +1 -0
  38. package/@types/src/build.d.ts +3 -0
  39. package/@types/src/builders/backend-ts-builder.d.ts +7 -0
  40. package/@types/src/builders/builder.d.ts +11 -0
  41. package/@types/src/builders/colors-builder.d.ts +10 -0
  42. package/@types/src/builders/css-builder.d.ts +19 -0
  43. package/@types/src/builders/fonts-builder.d.ts +7 -0
  44. package/@types/src/builders/frontend-ts-builder.d.ts +11 -0
  45. package/@types/src/cli.d.ts +2 -0
  46. package/@types/src/components/components.d.ts +2 -0
  47. package/@types/src/components/tabs.d.ts +2 -0
  48. package/@types/src/components/toggle-modal.d.ts +6 -0
  49. package/@types/src/controllers/password-generate-button.stimulus.d.ts +5 -0
  50. package/@types/src/controllers/sealgen-table.stimulus.d.ts +13 -0
  51. package/@types/src/embeddable-file-extensions.d.ts +1 -0
  52. package/@types/src/esbuild-plugins/load-assets.d.ts +5 -0
  53. package/@types/src/esbuild-plugins/rewrite-asset-imports.d.ts +5 -0
  54. package/@types/src/example.test.d.ts +1 -0
  55. package/@types/src/forms/controls/array.d.ts +33 -0
  56. package/@types/src/forms/controls/autocomplete.d.ts +22 -0
  57. package/@types/src/forms/controls/big-radio-group.d.ts +14 -0
  58. package/@types/src/forms/controls/checkbox-group.d.ts +21 -0
  59. package/@types/src/forms/controls/checkbox.d.ts +17 -0
  60. package/@types/src/forms/controls/checkboxed-list-input.d.ts +21 -0
  61. package/@types/src/forms/controls/checkboxed-list-input.test.d.ts +1 -0
  62. package/@types/src/forms/controls/collapsible-checkbox-group.d.ts +11 -0
  63. package/@types/src/forms/controls/collapsible-field-group.d.ts +21 -0
  64. package/@types/src/forms/controls/controls.d.ts +32 -0
  65. package/@types/src/forms/controls/derived-frame.d.ts +19 -0
  66. package/@types/src/forms/controls/derived.d.ts +13 -0
  67. package/@types/src/forms/controls/dropdown.d.ts +30 -0
  68. package/@types/src/forms/controls/editable-collection-subset.d.ts +20 -0
  69. package/@types/src/forms/controls/field-group.d.ts +23 -0
  70. package/@types/src/forms/controls/file.d.ts +12 -0
  71. package/@types/src/forms/controls/file.test.d.ts +1 -0
  72. package/@types/src/forms/controls/form-control.d.ts +23 -0
  73. package/@types/src/forms/controls/form-field-control.d.ts +13 -0
  74. package/@types/src/forms/controls/form-header.d.ts +8 -0
  75. package/@types/src/forms/controls/form-paragraph.d.ts +7 -0
  76. package/@types/src/forms/controls/frame.d.ts +17 -0
  77. package/@types/src/forms/controls/hidden-input.d.ts +9 -0
  78. package/@types/src/forms/controls/html.d.ts +11 -0
  79. package/@types/src/forms/controls/hybrid.d.ts +10 -0
  80. package/@types/src/forms/controls/image.d.ts +19 -0
  81. package/@types/src/forms/controls/image.test.d.ts +1 -0
  82. package/@types/src/forms/controls/multiple-files.d.ts +42 -0
  83. package/@types/src/forms/controls/multiple-images.d.ts +19 -0
  84. package/@types/src/forms/controls/number.d.ts +13 -0
  85. package/@types/src/forms/controls/password-with-generator.d.ts +6 -0
  86. package/@types/src/forms/controls/radio.d.ts +16 -0
  87. package/@types/src/forms/controls/simple-input.d.ts +35 -0
  88. package/@types/src/forms/controls/single-reference.d.ts +14 -0
  89. package/@types/src/forms/controls/single-reference.test.d.ts +1 -0
  90. package/@types/{forms/controls/table.d.sync-conflict-20260502-145940-GP5D735.ts → src/forms/controls/table.d.ts} +2 -0
  91. package/@types/src/forms/controls/textarea.d.ts +25 -0
  92. package/@types/src/forms/controls/tickable.d.ts +25 -0
  93. package/@types/src/forms/fields/boolean.d.ts +22 -0
  94. package/@types/src/forms/fields/boolean.test.d.ts +1 -0
  95. package/@types/src/forms/fields/checkboxed-list.d.ts +23 -0
  96. package/@types/src/forms/fields/collection-field.d.ts +22 -0
  97. package/@types/src/forms/fields/color.d.ts +4 -0
  98. package/@types/src/forms/fields/coordinates.d.ts +14 -0
  99. package/@types/src/forms/fields/date.d.ts +13 -0
  100. package/@types/src/forms/fields/datetime.d.ts +14 -0
  101. package/@types/src/forms/fields/deep-reverse-single-reference-list.d.ts +20 -0
  102. package/@types/src/forms/fields/deep-reverse-single-reference-table.d.ts +16 -0
  103. package/@types/src/forms/fields/email.d.ts +10 -0
  104. package/@types/src/forms/fields/email.test.d.ts +1 -0
  105. package/@types/src/forms/fields/enum-multiple-sealious.d.ts +16 -0
  106. package/@types/src/forms/fields/existing-sealious-value.d.ts +6 -0
  107. package/@types/src/forms/fields/field.d.ts +85 -0
  108. package/@types/src/forms/fields/field.test.d.ts +1 -0
  109. package/@types/src/forms/fields/fields.d.ts +34 -0
  110. package/@types/src/forms/fields/file.d.ts +25 -0
  111. package/@types/src/forms/fields/file.test.d.ts +1 -0
  112. package/@types/src/forms/fields/float.d.ts +4 -0
  113. package/@types/src/forms/fields/get-field-for-sealious.d.ts +33 -0
  114. package/@types/src/forms/fields/html.d.ts +6 -0
  115. package/@types/src/forms/fields/hybrid.d.ts +11 -0
  116. package/@types/src/forms/fields/image.d.ts +5 -0
  117. package/@types/src/forms/fields/int.d.ts +6 -0
  118. package/@types/src/forms/fields/item-draft.d.ts +20 -0
  119. package/@types/src/forms/fields/json.d.ts +13 -0
  120. package/@types/src/forms/fields/markdown.d.ts +6 -0
  121. package/@types/src/forms/fields/multiple-files.d.ts +16 -0
  122. package/@types/src/forms/fields/number.d.ts +25 -0
  123. package/@types/src/forms/fields/number.test.d.ts +1 -0
  124. package/@types/src/forms/fields/password.d.ts +10 -0
  125. package/@types/src/forms/fields/phone-number-with-country-code.d.ts +13 -0
  126. package/@types/src/forms/fields/phone-number.d.ts +17 -0
  127. package/@types/src/forms/fields/pick-from-list-sealious.d.ts +11 -0
  128. package/@types/src/forms/fields/pick-from-list.d.ts +15 -0
  129. package/@types/src/forms/fields/pick-from-list.test.d.ts +1 -0
  130. package/@types/src/forms/fields/proxy-field.d.ts +15 -0
  131. package/@types/src/forms/fields/regexp.d.ts +21 -0
  132. package/@types/src/forms/fields/regexp.test.d.ts +1 -0
  133. package/@types/src/forms/fields/simple-form-field.d.ts +31 -0
  134. package/@types/src/forms/fields/single-reference.d.ts +19 -0
  135. package/@types/src/forms/fields/structured-array.d.ts +23 -0
  136. package/@types/src/forms/fields/table.d.ts +16 -0
  137. package/@types/src/forms/fields/text.d.ts +6 -0
  138. package/@types/src/forms/fields/url.d.ts +6 -0
  139. package/@types/src/forms/form-types.d.ts +28 -0
  140. package/@types/src/forms/form.d.ts +34 -0
  141. package/@types/src/forms/form.test.d.ts +6 -0
  142. package/@types/src/forms/multiform.d.ts +23 -0
  143. package/@types/src/forms/multiform.test.d.ts +1 -0
  144. package/@types/src/generate-collections.d.ts +2 -0
  145. package/@types/src/generate-components.d.ts +1 -0
  146. package/@types/src/generate-routes.d.ts +5 -0
  147. package/@types/src/generate-routes.test.d.ts +1 -0
  148. package/@types/src/generate-stimulus.d.ts +1 -0
  149. package/@types/src/get-fonts.d.ts +2 -0
  150. package/@types/{index.d.sync-conflict-20260502-145557-GP5D735.ts → src/index.d.ts} +1 -0
  151. package/@types/src/make-env.d.ts +1 -0
  152. package/@types/src/make-hidden-inputs.d.ts +5 -0
  153. package/@types/src/mount.d.ts +6 -0
  154. package/@types/src/notifier.d.ts +2 -0
  155. package/@types/src/page/access-control.d.ts +6 -0
  156. package/@types/src/page/default-list-filters.d.ts +18 -0
  157. package/@types/src/page/list.d.ts +49 -0
  158. package/@types/src/page/mountable-with-fields.d.ts +49 -0
  159. package/@types/src/page/mountable-with-fields.test.d.ts +1 -0
  160. package/@types/src/page/mountable.d.ts +10 -0
  161. package/@types/src/page/page.d.ts +18 -0
  162. package/@types/src/page/props-parser.d.ts +15 -0
  163. package/@types/src/page/sealious-list.d.ts +20 -0
  164. package/@types/src/page/sealious-list.test.d.ts +1 -0
  165. package/@types/src/page/stateful-page.d.ts +63 -0
  166. package/@types/src/page/stateful-page.test.d.ts +1 -0
  167. package/@types/src/register-external.d.ts +2 -0
  168. package/@types/src/register-external.test.d.ts +1 -0
  169. package/@types/src/run.d.ts +1 -0
  170. package/@types/src/sanitize.d.ts +1 -0
  171. package/@types/src/target-locreq.d.ts +4 -0
  172. package/@types/src/templates/collection.d.ts +1 -0
  173. package/@types/src/templates/form.d.ts +14 -0
  174. package/@types/src/templates/form.test.d.ts +1 -0
  175. package/@types/src/templates/jdd-component.d.ts +1 -0
  176. package/@types/src/templates/jdd-editor.d.ts +1 -0
  177. package/@types/src/templates/list.d.ts +1 -0
  178. package/@types/src/templates/long-running-process.d.ts +1 -0
  179. package/@types/src/templates/multiform.d.ts +1 -0
  180. package/@types/src/templates/page.d.ts +1 -0
  181. package/@types/src/templates/post.d.ts +1 -0
  182. package/@types/src/templates/redirect.d.ts +1 -0
  183. package/@types/src/templates/route-test.d.ts +1 -0
  184. package/@types/src/templates/shared/collection-create-form.d.ts +1 -0
  185. package/@types/src/templates/shared/collection-edit-form.d.ts +1 -0
  186. package/@types/src/templates/shared/collection-list.d.ts +16 -0
  187. package/@types/src/templates/shared/item-delete.d.ts +1 -0
  188. package/@types/src/templates/shared/shared-crud-form-fields.d.ts +1 -0
  189. package/@types/src/templates/stateful-page.d.ts +1 -0
  190. package/@types/src/templates/stimulus-controller.d.ts +1 -0
  191. package/@types/src/templates/templates.d.ts +1 -0
  192. package/@types/src/test_utils/exec_async.d.ts +1 -0
  193. package/@types/src/test_utils/locator_is_visible.d.ts +2 -0
  194. package/@types/src/test_utils/test-on-real-app.d.ts +26 -0
  195. package/@types/src/utils/assert-throws.d.ts +1 -0
  196. package/@types/src/utils/base64.d.ts +2 -0
  197. package/@types/src/utils/browser-creator.d.ts +1 -0
  198. package/@types/src/utils/escape-url-params.d.ts +2 -0
  199. package/@types/src/utils/exec.d.ts +5 -0
  200. package/@types/src/utils/extract-fields-from-collection.d.ts +14 -0
  201. package/@types/src/utils/format-external-url.d.ts +1 -0
  202. package/@types/src/utils/import-path.d.ts +2 -0
  203. package/@types/src/utils/input-wrapper.d.ts +5 -0
  204. package/@types/src/utils/list-collections.d.ts +1 -0
  205. package/@types/src/utils/make-slug.d.ts +1 -0
  206. package/@types/src/utils/module-dirname.d.ts +1 -0
  207. package/@types/src/utils/natural-numbers.d.ts +1 -0
  208. package/@types/src/utils/prettier.d.ts +3 -0
  209. package/@types/src/utils/question.d.ts +1 -0
  210. package/@types/src/utils/render-attributes.d.ts +1 -0
  211. package/@types/src/utils/sleep.d.ts +1 -0
  212. package/@types/src/utils/translate.d.ts +4 -0
  213. package/@types/src/utils/url-with-new-params.d.ts +2 -0
  214. package/@types/src/utils/utils.d.ts +17 -0
  215. package/@types/src/utils/walk.d.ts +1 -0
  216. package/@types/src/utils/with-fallback.d.ts +2 -0
  217. package/@types/src/utils/wrap-attributes.d.ts +3 -0
  218. package/@types/src/utils/write-file.d.ts +1 -0
  219. package/lib/add-crud.test.js +1 -1
  220. package/lib/builders/backend-ts-builder.js +1 -1
  221. package/lib/forms/controls/textarea.js +2 -1
  222. package/package.json +1 -1
  223. package/src/builders/backend-ts-builder.ts +1 -0
  224. package/src/forms/controls/textarea.ts +5 -4
@@ -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;
@@ -0,0 +1 @@
1
+ export declare function sleep(time: number): Promise<unknown>;
@@ -0,0 +1,4 @@
1
+ import { Context } from "koa";
2
+ import { Translation } from "sealious";
3
+ /** deprecated */
4
+ export declare function t(ctx: Context, key: string, _props: unknown[], _default_translation: Translation): string;
@@ -0,0 +1,2 @@
1
+ import { Context } from "koa";
2
+ export declare function UrlWithNewParams(ctx: Context, query_params: Record<string, unknown>): string;
@@ -0,0 +1,17 @@
1
+ export type Awaited<T> = T extends Promise<infer U> ? U : T;
2
+ export type UnwrapArray<T> = T extends Array<infer U> ? U : T;
3
+ export declare function keys<S extends string>(object: Record<S, unknown>): S[];
4
+ export type ExtractTail<T extends any[]> = T extends [infer _, ...infer Tail] ? Tail : never;
5
+ export { sleep } from "./sleep.js";
6
+ export { naturalNumbers } from "./natural-numbers.js";
7
+ export { UrlWithNewParams } from "./url-with-new-params.js";
8
+ export { exec } from "./exec.js";
9
+ export { importPath, curryImportPath } from "./import-path.js";
10
+ export { listCollections } from "./list-collections.js";
11
+ export { walkDir } from "./walk.js";
12
+ export { assertThrowsAsync } from "./assert-throws.js";
13
+ export * from "./make-slug.js";
14
+ export * from "./render-attributes.js";
15
+ export * from "./format-external-url.js";
16
+ export * from "./base64.js";
17
+ export * from "./with-fallback.js";
@@ -0,0 +1 @@
1
+ export declare function walkDir(dir: string): Promise<string[]>;
@@ -0,0 +1,2 @@
1
+ export declare function withFallback<T1, T2 extends NonNullable<unknown>>(value1: T1, value2: T2): NonNullable<T1> | T2;
2
+ export declare function withFallback<T1, T2, T3 extends NonNullable<unknown>>(value1: T1, value2: T2, value3?: T3): NonNullable<T2> | T3;
@@ -0,0 +1,3 @@
1
+ export declare function needsQuotes(str: string): boolean;
2
+ export declare function wrapAttribute(name: string): string;
3
+ export declare function wrapKeyName(name: string): string;
@@ -0,0 +1 @@
1
+ export declare function writeFile(path: string, content: string): Promise<void>;
@@ -10,7 +10,7 @@ describe("add crud test", () => {
10
10
  after(async () => {
11
11
  await page.close();
12
12
  });
13
- it.only("Generate simple sealious crud", async function() {
13
+ it("Generate simple sealious crud", async function() {
14
14
  const test_app = await RealAppTest.init();
15
15
  const path = "/sample";
16
16
  await test_app.runSealgenCommand(`add-collection --collection_name=sealcode-test`);
@@ -14,7 +14,7 @@ class BackendTSBuilder extends Builder {
14
14
  return "backend-ts";
15
15
  }
16
16
  ownsFile(file_path) {
17
- return (file_path.endsWith(".ts") || file_path.endsWith(".tsx")) && !file_path.endsWith("src/back/collections/collections.ts") && !file_path.endsWith("src/back/routes/routes.ts") && !file_path.endsWith("src/back/routes/urls.ts") && !file_path.endsWith("stimulus.ts") && !file_path.startsWith("src/front");
17
+ return (file_path.endsWith(".ts") || file_path.endsWith(".tsx")) && !file_path.endsWith("src/back/collections/collections.ts") && !file_path.endsWith("src/back/routes/routes.ts") && !file_path.endsWith("src/back/routes/urls.ts") && !file_path.endsWith("src/back/jdd-components/components.ts") && !file_path.endsWith("stimulus.ts") && !file_path.startsWith("src/front");
18
18
  }
19
19
  async dispose() {
20
20
  }
@@ -1,4 +1,5 @@
1
1
  import { SimpleInput } from "./simple-input.js";
2
+ import { htmlEscape } from "escape-goat";
2
3
  class Textarea extends SimpleInput {
3
4
  constructor(field, options = {}) {
4
5
  super(field, options);
@@ -31,7 +32,7 @@ class Textarea extends SimpleInput {
31
32
  return (
32
33
  /* HTML */
33
34
  `<textarea ${attributes}>
34
- ${String(value) || ""}</textarea
35
+ ${htmlEscape(String(value)) || ""}</textarea
35
36
  >`
36
37
  );
37
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sealcode/sealgen",
3
- "version": "0.19.24",
3
+ "version": "0.19.25-hotfix1",
4
4
  "description": "Module to automate adding routes and collections to a sealious application",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",
@@ -22,6 +22,7 @@ export class BackendTSBuilder extends Builder {
22
22
  !file_path.endsWith("src/back/collections/collections.ts") &&
23
23
  !file_path.endsWith("src/back/routes/routes.ts") &&
24
24
  !file_path.endsWith("src/back/routes/urls.ts") &&
25
+ !file_path.endsWith("src/back/jdd-components/components.ts") &&
25
26
  !file_path.endsWith("stimulus.ts") &&
26
27
  !file_path.startsWith("src/front")
27
28
  );
@@ -3,6 +3,7 @@ import { FormField } from "../fields/field.js";
3
3
  import { FormDataValue } from "../form-types.js";
4
4
  import { FormControlContext } from "./form-control.js";
5
5
  import { SimpleInput, SimpleInputOptions } from "./simple-input.js";
6
+ import { htmlEscape } from "escape-goat";
6
7
 
7
8
  export class Textarea extends SimpleInput {
8
9
  constructor(
@@ -19,11 +20,11 @@ export class Textarea extends SimpleInput {
19
20
  }
20
21
 
21
22
  renderDescription() {
22
- return this.options.description
23
- ? /* HTML */ `<div class="form-input__description">
23
+ return this.options.description ?
24
+ /* HTML */ `<div class="form-input__description">
24
25
  ${this.options.description}
25
26
  </div>`
26
- : "";
27
+ : "";
27
28
  }
28
29
 
29
30
  async getInputAttributes(
@@ -51,7 +52,7 @@ export class Textarea extends SimpleInput {
51
52
  ) {
52
53
  const { parsed: value } = await this.field.getParsedValue(ctx, data);
53
54
  return /* HTML */ `<textarea ${attributes}>
54
- ${String(value) || ""}</textarea
55
+ ${htmlEscape(String(value)) || ""}</textarea
55
56
  >`;
56
57
  }
57
58
  }