@nice2dev/ui-forms 1.4.4 → 1.4.6
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/dist/index.cjs +8 -6
- package/dist/index.d.ts +283 -8
- package/dist/index.mjs +3938 -2784
- package/dist/studio.cjs +23 -7
- package/dist/studio.d.ts +277 -8
- package/dist/studio.mjs +928 -575
- package/dist/ui-forms.css +1 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ import { NiceDataSourceSchemaTable } from '@nice2dev/ui';
|
|
|
8
8
|
import { NiceFieldValidationRule } from '@nice2dev/ui';
|
|
9
9
|
import { NiceFormItem } from '@nice2dev/ui';
|
|
10
10
|
import { NiceHookBinding } from '@nice2dev/ui';
|
|
11
|
+
import { NiceNoCodeIo } from '@nice2dev/ui';
|
|
12
|
+
import { NiceNoCodeStep } from '@nice2dev/ui';
|
|
11
13
|
import { NiceRbacModel } from '@nice2dev/ui';
|
|
12
14
|
import { NiceScriptRunnerProps } from '@nice2dev/ui';
|
|
13
15
|
import { NiceStandardProps } from '@nice2dev/ui';
|
|
@@ -16,6 +18,18 @@ import { NiceViewDefinition } from '@nice2dev/ui';
|
|
|
16
18
|
import { NiceWorkflowDefinition } from '@nice2dev/ui';
|
|
17
19
|
import { RefAttributes } from 'react';
|
|
18
20
|
|
|
21
|
+
/** The layout with a new folder in `group` (inside `parent` / `section`); returns its id too. */
|
|
22
|
+
export declare function addStudioFolder(layout: NiceStudioLayout, folder: Omit<NiceStudioLayoutFolder, 'id'>): {
|
|
23
|
+
layout: NiceStudioLayout;
|
|
24
|
+
id: string;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/** The layout with a new section; returns the layout and the section's id. */
|
|
28
|
+
export declare function addStudioSection(layout: NiceStudioLayout, label: string): {
|
|
29
|
+
layout: NiceStudioLayout;
|
|
30
|
+
id: string;
|
|
31
|
+
};
|
|
32
|
+
|
|
19
33
|
/** Generated fields → NiceSchemaForm fields, with their validation rules. */
|
|
20
34
|
export declare function aiFormConfigToFormFields(config: {
|
|
21
35
|
fields: readonly NiceAIFormFieldLike[];
|
|
@@ -46,17 +60,20 @@ export declare function defineManifestSection<TSchema extends JsonSchema>(sectio
|
|
|
46
60
|
|
|
47
61
|
/** A starter access model: admin / user × view / create / edit / delete over the module's views and entities. */
|
|
48
62
|
export declare function deriveDefaultRbac(module: {
|
|
49
|
-
manifest?:
|
|
63
|
+
manifest?: Row_2;
|
|
50
64
|
views?: ReadonlyArray<{
|
|
51
65
|
id: string;
|
|
52
66
|
name: string;
|
|
53
67
|
}>;
|
|
54
|
-
entities?: readonly
|
|
68
|
+
entities?: readonly Row_2[];
|
|
55
69
|
}): NiceRbacModel;
|
|
56
70
|
|
|
57
71
|
/** Reads how `text` is written: BOM, line breaks, indentation, final newline, colon spacing. */
|
|
58
72
|
export declare function detectJsonTextFormat(text: string): NiceJsonTextFormat;
|
|
59
73
|
|
|
74
|
+
/** An empty layout: no sections, no folders — the flat tree. */
|
|
75
|
+
export declare const emptyStudioLayout: () => NiceStudioLayout;
|
|
76
|
+
|
|
60
77
|
/**
|
|
61
78
|
* The file changes that store a document's new model: only files whose text differs from what
|
|
62
79
|
* was read, plus files the encoder adds or removes.
|
|
@@ -67,7 +84,7 @@ export declare function encodeDocument(doc: NiceStudioDocument, model: unknown,
|
|
|
67
84
|
export declare const endsWithAny: (...suffixes: string[]) => (path: string) => boolean;
|
|
68
85
|
|
|
69
86
|
/** The module's entities as the tables NiceDataSourceBuilder queries. */
|
|
70
|
-
export declare function entitiesToSchemas(entities: readonly
|
|
87
|
+
export declare function entitiesToSchemas(entities: readonly Row_2[]): NiceDataSourceSchemaTable[];
|
|
71
88
|
|
|
72
89
|
/** The file name of a path. */
|
|
73
90
|
export declare const fileName: (path: string) => string;
|
|
@@ -207,12 +224,27 @@ export declare interface FormSectionDefinition {
|
|
|
207
224
|
fields: FormFieldDefinition[];
|
|
208
225
|
}
|
|
209
226
|
|
|
227
|
+
/** A list item back as the stored script: its definition merged onto the entry as stored. */
|
|
228
|
+
export declare function fromStudioScriptItem(item: NiceStudioItem<NiceStudioScriptDef>): unknown;
|
|
229
|
+
|
|
210
230
|
/**
|
|
211
231
|
* Translations split into one file per language, edited as one document. A new language gets a
|
|
212
232
|
* file shaped and formatted like its siblings; a language removed in the editor loses its file.
|
|
213
233
|
*/
|
|
214
234
|
export declare function i18nFileKind(o?: NiceI18nFileKindOptions): NiceStudioFileKind<NiceStudioTranslations>;
|
|
215
235
|
|
|
236
|
+
/**
|
|
237
|
+
* The kind of a stored script: its `kind`, else from what it holds — no-code steps, a SQL language
|
|
238
|
+
* or `sql` text, a C# language (server) — else browser code.
|
|
239
|
+
*/
|
|
240
|
+
export declare function inferStudioScriptKind(raw: Row): NiceStudioScriptKind;
|
|
241
|
+
|
|
242
|
+
/** Whether a layout holds nothing (its file can go). */
|
|
243
|
+
export declare const isEmptyStudioLayout: (layout: NiceStudioLayout) => boolean;
|
|
244
|
+
|
|
245
|
+
/** Whether a path is a module's layout file. */
|
|
246
|
+
export declare const isStudioLayoutPath: (path: string) => boolean;
|
|
247
|
+
|
|
216
248
|
/**
|
|
217
249
|
* A file holding a list of entries edited one at a time (views, workflows). Entries the editor
|
|
218
250
|
* does not understand stay raw and round-trip as they are.
|
|
@@ -293,7 +325,7 @@ export declare function modulePrefix(files: readonly NiceStudioFile[]): string;
|
|
|
293
325
|
|
|
294
326
|
export declare const nativeDataSourcesKind: NiceStudioFileKind<NiceDataSourceDef[]>;
|
|
295
327
|
|
|
296
|
-
export declare const nativeEntitiesKind: NiceStudioFileKind<
|
|
328
|
+
export declare const nativeEntitiesKind: NiceStudioFileKind<Row_3[]>;
|
|
297
329
|
|
|
298
330
|
/** The file kinds of the native format, in matching order. */
|
|
299
331
|
export declare const nativeFileKinds: NiceStudioFileKind[];
|
|
@@ -302,17 +334,29 @@ export declare const nativeHooksKind: NiceStudioFileKind<NiceHookBinding[]>;
|
|
|
302
334
|
|
|
303
335
|
export declare const nativeI18nKind: NiceStudioFileKind<NiceStudioTranslations>;
|
|
304
336
|
|
|
305
|
-
export declare const nativeManifestKind: NiceStudioFileKind<
|
|
337
|
+
export declare const nativeManifestKind: NiceStudioFileKind<Row_3>;
|
|
306
338
|
|
|
307
339
|
export declare const nativeRbacKind: NiceStudioFileKind<NiceRbacModel>;
|
|
308
340
|
|
|
309
|
-
/**
|
|
341
|
+
/** `{id}.scripts.json`: `{ scripts: [...], phases: { postInstall: [...] } }` (1.4.6). */
|
|
342
|
+
export declare const nativeScriptsKind: NiceStudioFileKind<NiceStudioScripts>;
|
|
343
|
+
|
|
344
|
+
/** The studio's own format: manifest, entities, translations, views, workflows, data sources, access, hooks, scripts. */
|
|
310
345
|
export declare const nativeStudioPreset: NiceStudioPreset;
|
|
311
346
|
|
|
312
347
|
export declare const nativeViewsKind: NiceStudioFileKind<NiceStudioItem<NiceViewDefinition>[]>;
|
|
313
348
|
|
|
314
349
|
export declare const nativeWorkflowsKind: NiceStudioFileKind<NiceStudioItem<NiceWorkflowDefinition>[]>;
|
|
315
350
|
|
|
351
|
+
/** A new script of a kind, with a starting body in its language. */
|
|
352
|
+
export declare function newStudioScript(spec: NiceStudioNewScript): NiceStudioScriptDef;
|
|
353
|
+
|
|
354
|
+
/** The script kinds, in the order "Add script" offers them. */
|
|
355
|
+
export declare const NICE_STUDIO_SCRIPT_KINDS: readonly NiceStudioScriptKind[];
|
|
356
|
+
|
|
357
|
+
/** Install phases offered for database scripts when the preset names none. */
|
|
358
|
+
export declare const NICE_STUDIO_SCRIPT_PHASES: readonly string[];
|
|
359
|
+
|
|
316
360
|
/** A generated field, as an AI form generator describes it. */
|
|
317
361
|
export declare interface NiceAIFormFieldLike {
|
|
318
362
|
id?: string;
|
|
@@ -409,6 +453,11 @@ export declare interface NiceDevelopmentStudioProps extends NiceStandardProps {
|
|
|
409
453
|
reviewBeforeSave?: boolean;
|
|
410
454
|
/** Runs script files (`script` documents) in a NiceScriptRunner. */
|
|
411
455
|
scriptRunner?: Omit<NiceScriptRunnerProps, 'value' | 'onChange'>;
|
|
456
|
+
/**
|
|
457
|
+
* The host's data for a module's no-code scripts (1.4.6): with it the script editor's Run runs
|
|
458
|
+
* the steps against it (`read` a data source, `write` rows, `callScript`).
|
|
459
|
+
*/
|
|
460
|
+
scriptIo?: (module: NiceStudioModuleKey) => NiceNoCodeIo | undefined;
|
|
412
461
|
/** The host's own preview of a view (e.g. its runtime renderer): small in the preview, full beside the designer. */
|
|
413
462
|
renderViewPreview?: (ctx: NiceStudioViewPreviewContext) => React.ReactNode;
|
|
414
463
|
/** Extra parts of a module (payments, webhooks, …): rows under the module, opened full-screen. */
|
|
@@ -703,6 +752,22 @@ export declare interface NiceSchemaFormProps extends NiceStandardProps {
|
|
|
703
752
|
tutorial?: NiceComponentTutorial;
|
|
704
753
|
}
|
|
705
754
|
|
|
755
|
+
/** Options of {@link scriptsFileKind}. */
|
|
756
|
+
export declare interface NiceScriptsFileKindOptions {
|
|
757
|
+
id?: string;
|
|
758
|
+
label?: string;
|
|
759
|
+
labelKey?: string;
|
|
760
|
+
icon?: string;
|
|
761
|
+
match(path: string): boolean;
|
|
762
|
+
/** The property holding the scripts list. Default `scripts`; the file may also be the bare list. */
|
|
763
|
+
property?: string;
|
|
764
|
+
/**
|
|
765
|
+
* The property holding the database scripts per phase. Default `phases`. The same as `property`:
|
|
766
|
+
* that property holds either — a list of scripts or an object of phases (OmniVerk).
|
|
767
|
+
*/
|
|
768
|
+
phasesProperty?: string;
|
|
769
|
+
}
|
|
770
|
+
|
|
706
771
|
/** A host's own action in the studio's tree header (e.g. "Open a folder…"). */
|
|
707
772
|
export declare interface NiceStudioAction {
|
|
708
773
|
key: string;
|
|
@@ -713,6 +778,11 @@ export declare interface NiceStudioAction {
|
|
|
713
778
|
onSelect: () => void;
|
|
714
779
|
}
|
|
715
780
|
|
|
781
|
+
/** The studio's own editors. */
|
|
782
|
+
export declare type NiceStudioBuiltinEditorId = 'manifest' | 'entities' | 'i18n' | 'views' | 'workflows' | 'permissions' | 'rbac' | 'dataSources' | 'seeds' | 'hooks' | 'script'
|
|
783
|
+
/** A list of named scripts and database scripts per phase ({@link NiceStudioScripts}, 1.4.6). */
|
|
784
|
+
| 'scriptList' | 'json' | 'text';
|
|
785
|
+
|
|
716
786
|
/** What a file kind's decode and encode know about the module. */
|
|
717
787
|
export declare interface NiceStudioCodecContext {
|
|
718
788
|
moduleId: string;
|
|
@@ -734,8 +804,11 @@ export declare interface NiceStudioDocument<M = unknown> {
|
|
|
734
804
|
error?: string;
|
|
735
805
|
}
|
|
736
806
|
|
|
737
|
-
/**
|
|
738
|
-
|
|
807
|
+
/**
|
|
808
|
+
* The editors a file kind can open in: a built-in one, or the id of an editor the host registers
|
|
809
|
+
* (1.4.5 — the union was closed; an unknown id opens as raw JSON / text until one is registered).
|
|
810
|
+
*/
|
|
811
|
+
export declare type NiceStudioEditorId = NiceStudioBuiltinEditorId | (string & {});
|
|
739
812
|
|
|
740
813
|
/** New and removed files of an encoded document. */
|
|
741
814
|
export declare interface NiceStudioEncoded {
|
|
@@ -795,6 +868,11 @@ export declare interface NiceStudioFileKind<M = unknown> {
|
|
|
795
868
|
/** The document a file belongs to (files with the same group open together). Default: the path. */
|
|
796
869
|
group?(path: string): string;
|
|
797
870
|
editor: NiceStudioEditorId;
|
|
871
|
+
/**
|
|
872
|
+
* The tree group its documents are listed under (1.4.5): one of the preset's `groups`, or a
|
|
873
|
+
* built-in group id. Default: the built-in group of its editor (none for raw JSON / text).
|
|
874
|
+
*/
|
|
875
|
+
treeGroup?: string;
|
|
798
876
|
/** The files of one document → the editor's model. Throwing opens the files as raw JSON / text. */
|
|
799
877
|
decode(files: readonly NiceStudioFile[], ctx: NiceStudioCodecContext): M;
|
|
800
878
|
/** The model → the document's files (only their text; unchanged files may be returned as they were). */
|
|
@@ -811,6 +889,20 @@ export declare interface NiceStudioGeneratedModule {
|
|
|
811
889
|
}>;
|
|
812
890
|
}
|
|
813
891
|
|
|
892
|
+
/**
|
|
893
|
+
* A group of the tree a preset adds (1.4.5): its documents — of the kinds whose `treeGroup` names
|
|
894
|
+
* it — are listed one per row under it, like scripts.
|
|
895
|
+
*/
|
|
896
|
+
export declare interface NiceStudioGroupDef {
|
|
897
|
+
id: string;
|
|
898
|
+
label: string;
|
|
899
|
+
labelKey?: string;
|
|
900
|
+
/** NiceIcon name. */
|
|
901
|
+
icon?: string;
|
|
902
|
+
/** Where it goes among the groups (the built-in ones are 10, 20, … 100). Default: after them. */
|
|
903
|
+
order?: number;
|
|
904
|
+
}
|
|
905
|
+
|
|
814
906
|
/** A problem found in a module. */
|
|
815
907
|
export declare interface NiceStudioIssue {
|
|
816
908
|
severity: 'error' | 'warning' | 'info';
|
|
@@ -844,6 +936,40 @@ export declare interface NiceStudioItem<D> {
|
|
|
844
936
|
rawReason?: string;
|
|
845
937
|
}
|
|
846
938
|
|
|
939
|
+
/** The layout of a module — the content of its `{prefix}.studio.json`. */
|
|
940
|
+
export declare interface NiceStudioLayout {
|
|
941
|
+
version: 1;
|
|
942
|
+
sections: NiceStudioLayoutSection[];
|
|
943
|
+
folders: NiceStudioLayoutFolder[];
|
|
944
|
+
/** By entry ref, `group:key` — `entities:Customer`, `views:customer-list`. */
|
|
945
|
+
placement: Record<string, NiceStudioLayoutPlacement>;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
/** A folder inside one group of a module (entities, views…), optionally nested and in a section. */
|
|
949
|
+
export declare interface NiceStudioLayoutFolder {
|
|
950
|
+
id: string;
|
|
951
|
+
label: string;
|
|
952
|
+
/** The group it belongs to: `entities`, `views`, `workflows`, a preset's own group… */
|
|
953
|
+
group: string;
|
|
954
|
+
/** The folder it sits in. */
|
|
955
|
+
parent?: string;
|
|
956
|
+
/** The section it sits in (absent: the module's own groups). */
|
|
957
|
+
section?: string;
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
/** Where one entry sits: a section, a folder, an order among its siblings. */
|
|
961
|
+
export declare interface NiceStudioLayoutPlacement {
|
|
962
|
+
section?: string;
|
|
963
|
+
folder?: string;
|
|
964
|
+
order?: number;
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
/** A section of a module: a band of the tree that holds groups (Sales, Warehouse…). */
|
|
968
|
+
export declare interface NiceStudioLayoutSection {
|
|
969
|
+
id: string;
|
|
970
|
+
label: string;
|
|
971
|
+
}
|
|
972
|
+
|
|
847
973
|
/** What validators and generators get. */
|
|
848
974
|
export declare interface NiceStudioModuleContext {
|
|
849
975
|
key: NiceStudioModuleKey;
|
|
@@ -909,6 +1035,16 @@ export declare interface NiceStudioModuleSpec {
|
|
|
909
1035
|
permissions?: boolean;
|
|
910
1036
|
}
|
|
911
1037
|
|
|
1038
|
+
/** What "Add script" asks for. */
|
|
1039
|
+
export declare interface NiceStudioNewScript {
|
|
1040
|
+
kind: NiceStudioScriptKind;
|
|
1041
|
+
/** The display name; the script's `name` is made from it. */
|
|
1042
|
+
name: string;
|
|
1043
|
+
language?: string;
|
|
1044
|
+
category?: string;
|
|
1045
|
+
trigger?: string;
|
|
1046
|
+
}
|
|
1047
|
+
|
|
912
1048
|
/** A group of modules in a workspace (a category, a product line). */
|
|
913
1049
|
export declare interface NiceStudioPackage {
|
|
914
1050
|
id: string;
|
|
@@ -919,6 +1055,11 @@ export declare interface NiceStudioPackage {
|
|
|
919
1055
|
/** Computed from the modules (e.g. their `category`) rather than stored: it cannot be edited. */
|
|
920
1056
|
derived?: boolean;
|
|
921
1057
|
readOnly?: boolean;
|
|
1058
|
+
/**
|
|
1059
|
+
* The package it sits in (1.4.5): packages nest in the tree. An id with `/` (`Finance/Banking`, an
|
|
1060
|
+
* OmniVerk category path) nests under the part before its last `/` without it.
|
|
1061
|
+
*/
|
|
1062
|
+
parentId?: string;
|
|
922
1063
|
}
|
|
923
1064
|
|
|
924
1065
|
/** An extra part of a module (payments, webhooks — anything host-specific): a row under the module in the tree, its content full-screen. */
|
|
@@ -951,6 +1092,8 @@ export declare interface NiceStudioPreset {
|
|
|
951
1092
|
id: string;
|
|
952
1093
|
/** Tried in order; a path no kind matches opens as raw JSON (`*.json`) or text. */
|
|
953
1094
|
kinds: NiceStudioFileKind[];
|
|
1095
|
+
/** Groups of the tree the preset adds to the built-in ones (1.4.5). */
|
|
1096
|
+
groups?: NiceStudioGroupDef[];
|
|
954
1097
|
/** The manifest's sections, each a form over part of the manifest. */
|
|
955
1098
|
manifestSections?: NiceManifestSection[];
|
|
956
1099
|
entities?: NiceStudioEntityOptions;
|
|
@@ -974,6 +1117,8 @@ export declare interface NiceStudioPreset {
|
|
|
974
1117
|
path: string;
|
|
975
1118
|
text: string;
|
|
976
1119
|
} | undefined;
|
|
1120
|
+
/** Kinds, categories, triggers and phases of the module's scripts (1.4.6). */
|
|
1121
|
+
scripts?: NiceStudioScriptOptions;
|
|
977
1122
|
/** Lifecycle triggers offered by a `hooks` document. */
|
|
978
1123
|
hooks?: {
|
|
979
1124
|
triggers: Array<{
|
|
@@ -1045,6 +1190,73 @@ export declare interface NiceStudioRevision {
|
|
|
1045
1190
|
path?: string;
|
|
1046
1191
|
}
|
|
1047
1192
|
|
|
1193
|
+
/** A named script of a module (1.4.6). Fields the studio does not edit stay in the stored entry. */
|
|
1194
|
+
export declare interface NiceStudioScriptDef {
|
|
1195
|
+
id?: string;
|
|
1196
|
+
/** The name other scripts and the app call it by (unique in the module). */
|
|
1197
|
+
name: string;
|
|
1198
|
+
displayName?: string;
|
|
1199
|
+
description?: string;
|
|
1200
|
+
kind: NiceStudioScriptKind;
|
|
1201
|
+
/** `typescript`, `javascript`, `csharp`, `sql`… (none for a no-code script). */
|
|
1202
|
+
language?: string;
|
|
1203
|
+
/** Free grouping: `formatting`, `validation`, `integration`… */
|
|
1204
|
+
category?: string;
|
|
1205
|
+
/** What runs it: an event, a schedule, a button (one of the preset's `scripts.triggers`). */
|
|
1206
|
+
trigger?: string;
|
|
1207
|
+
parameters?: NiceStudioScriptParameter[];
|
|
1208
|
+
returnType?: string;
|
|
1209
|
+
/** The code (frontend, backend, SQL). */
|
|
1210
|
+
source?: string;
|
|
1211
|
+
/** A file of the module holding the code instead of `source`. */
|
|
1212
|
+
sourcePath?: string;
|
|
1213
|
+
/** The steps of a no-code script. */
|
|
1214
|
+
steps?: NiceNoCodeStep[];
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
/**
|
|
1218
|
+
* What a script is (1.4.6): code run in the browser (`frontend`), code run on the server
|
|
1219
|
+
* (`backend`), no-code steps (`noCode`, run by `runNoCodeScript`) or a SQL query or procedure.
|
|
1220
|
+
*/
|
|
1221
|
+
export declare type NiceStudioScriptKind = 'frontend' | 'backend' | 'noCode' | 'sql';
|
|
1222
|
+
|
|
1223
|
+
/** How a preset's scripts look (1.4.6). */
|
|
1224
|
+
export declare interface NiceStudioScriptOptions {
|
|
1225
|
+
/** The kinds "Add script" offers. Default: all four. */
|
|
1226
|
+
kinds?: NiceStudioScriptKind[];
|
|
1227
|
+
/** Categories offered (the module's own are offered too). */
|
|
1228
|
+
categories?: string[];
|
|
1229
|
+
/** What can run a script. */
|
|
1230
|
+
triggers?: Array<{
|
|
1231
|
+
id: string;
|
|
1232
|
+
label: string;
|
|
1233
|
+
description?: string;
|
|
1234
|
+
}>;
|
|
1235
|
+
/** Install phases offered for database scripts. Default: preInstall, postInstall, preUninstall, postUninstall. */
|
|
1236
|
+
phases?: string[];
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
/** A parameter of a script. */
|
|
1240
|
+
export declare interface NiceStudioScriptParameter {
|
|
1241
|
+
name: string;
|
|
1242
|
+
/** Its type as the script's language writes it (`string`, `Date | string`, `decimal`). */
|
|
1243
|
+
type?: string;
|
|
1244
|
+
description?: string;
|
|
1245
|
+
default?: unknown;
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
/** The model of the `scriptList` editor (1.4.6): named scripts and database scripts per phase. */
|
|
1249
|
+
export declare interface NiceStudioScripts {
|
|
1250
|
+
scripts: Array<NiceStudioItem<NiceStudioScriptDef>>;
|
|
1251
|
+
/** SQL statements per install phase: `{ postInstall: ['CREATE INDEX …'] }`. */
|
|
1252
|
+
phases?: Record<string, string[]>;
|
|
1253
|
+
/**
|
|
1254
|
+
* What the file can hold when one property keeps either (OmniVerk's `scripts` is a list of
|
|
1255
|
+
* scripts or an object of phases): only named scripts, or only phases. Absent: both.
|
|
1256
|
+
*/
|
|
1257
|
+
holds?: 'scripts' | 'phases';
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1048
1260
|
/** The model of the `seeds` editor: rows per entity, plus demo rows. */
|
|
1049
1261
|
export declare interface NiceStudioSeeds {
|
|
1050
1262
|
seeds: Record<string, Array<Record<string, unknown>>>;
|
|
@@ -1123,6 +1335,12 @@ export declare function parseJsonText(text: string): {
|
|
|
1123
1335
|
format: NiceJsonTextFormat;
|
|
1124
1336
|
};
|
|
1125
1337
|
|
|
1338
|
+
/**
|
|
1339
|
+
* A layout from its file's text — what it can read of it: unknown fields and broken entries are
|
|
1340
|
+
* dropped, a text that does not parse gives the empty layout.
|
|
1341
|
+
*/
|
|
1342
|
+
export declare function parseStudioLayout(text: string | undefined): NiceStudioLayout;
|
|
1343
|
+
|
|
1126
1344
|
/**
|
|
1127
1345
|
* `previous` with its content replaced by `next`, changing as few bytes as possible. Falls back
|
|
1128
1346
|
* to {@link stringifyJsonText} in the file's own format when the text cannot be patched (invalid
|
|
@@ -1133,9 +1351,36 @@ export declare function patchJsonText(previous: string, next: unknown, options?:
|
|
|
1133
1351
|
/** {@link patchJsonText}, also telling whether the patch was exact. */
|
|
1134
1352
|
export declare function patchJsonTextDetailed(previous: string, next: unknown, options?: NiceJsonPatchOptions): NiceJsonPatchResult;
|
|
1135
1353
|
|
|
1354
|
+
/**
|
|
1355
|
+
* The layout with an entry put somewhere: into a folder (its section follows the folder's), into a
|
|
1356
|
+
* section (out of any folder), or back to its group (`{}`).
|
|
1357
|
+
*/
|
|
1358
|
+
export declare function placeStudioEntry(layout: NiceStudioLayout, ref: string, target: {
|
|
1359
|
+
folder?: string;
|
|
1360
|
+
section?: string;
|
|
1361
|
+
}): NiceStudioLayout;
|
|
1362
|
+
|
|
1136
1363
|
/** The translations inside a file: `translations`, `keys`, or the whole file when it is a flat map. */
|
|
1137
1364
|
export declare function readTranslations(root: unknown): Record<string, string>;
|
|
1138
1365
|
|
|
1366
|
+
/**
|
|
1367
|
+
* The layout without a section or folder. What it held moves up: a folder's entries and folders go
|
|
1368
|
+
* to its parent (or the group), a section's folders and entries back to the module's own groups.
|
|
1369
|
+
*/
|
|
1370
|
+
export declare function removeStudioLayoutNode(layout: NiceStudioLayout, node: {
|
|
1371
|
+
kind: 'section' | 'folder';
|
|
1372
|
+
id: string;
|
|
1373
|
+
}): NiceStudioLayout;
|
|
1374
|
+
|
|
1375
|
+
/** The layout after an entry was renamed — its placement follows it (`entities:Old` → `entities:New`). */
|
|
1376
|
+
export declare function renameStudioEntryRef(layout: NiceStudioLayout, from: string, to: string): NiceStudioLayout;
|
|
1377
|
+
|
|
1378
|
+
/** The layout with a section or folder renamed. */
|
|
1379
|
+
export declare function renameStudioLayoutNode(layout: NiceStudioLayout, node: {
|
|
1380
|
+
kind: 'section' | 'folder';
|
|
1381
|
+
id: string;
|
|
1382
|
+
}, label: string): NiceStudioLayout;
|
|
1383
|
+
|
|
1139
1384
|
/** The kind a path opens with: the first that matches, else JSON or text. */
|
|
1140
1385
|
export declare function resolveFileKind(kinds: readonly NiceStudioFileKind[], path: string): NiceStudioFileKind;
|
|
1141
1386
|
|
|
@@ -1143,21 +1388,51 @@ declare type Row = Record<string, unknown>;
|
|
|
1143
1388
|
|
|
1144
1389
|
declare type Row_2 = Record<string, unknown>;
|
|
1145
1390
|
|
|
1391
|
+
declare type Row_3 = Record<string, unknown>;
|
|
1392
|
+
|
|
1146
1393
|
/** Parses JSON without a BOM and returns `fallback` when the text is not JSON. */
|
|
1147
1394
|
export declare function safeJson<T = unknown>(text: string, fallback: T): T;
|
|
1148
1395
|
|
|
1149
1396
|
/** Convert a FormSchema into DevExtreme-style form items. */
|
|
1150
1397
|
export declare function schemaToFormItems(schema: FormSchema): any[];
|
|
1151
1398
|
|
|
1399
|
+
/**
|
|
1400
|
+
* A file of named scripts and database scripts per phase (the `scriptList` editor). Scripts the
|
|
1401
|
+
* form does not understand stay raw and round-trip as they are; a file whose phases are not lists
|
|
1402
|
+
* of SQL text opens as raw JSON.
|
|
1403
|
+
*/
|
|
1404
|
+
export declare function scriptsFileKind(o: NiceScriptsFileKindOptions): NiceStudioFileKind<NiceStudioScripts>;
|
|
1405
|
+
|
|
1406
|
+
/** A layout's file text: two-space JSON with a final newline, in the line ending of `previous`. */
|
|
1407
|
+
export declare function serializeStudioLayout(layout: NiceStudioLayout, previous?: string): string;
|
|
1408
|
+
|
|
1152
1409
|
/** A file-name-safe id out of a display name: "Bike rental" → `bike-rental`. */
|
|
1153
1410
|
export declare function slugifyModuleId(name: string): string;
|
|
1154
1411
|
|
|
1155
1412
|
/** Writes `value` in a given format (defaults: two spaces, LF, final newline, no BOM). */
|
|
1156
1413
|
export declare function stringifyJsonText(value: unknown, format?: Partial<NiceJsonTextFormat>): string;
|
|
1157
1414
|
|
|
1415
|
+
/** The ref of an entry in a layout: `group:key`. */
|
|
1416
|
+
export declare const studioEntryRef: (group: string, key: string) => string;
|
|
1417
|
+
|
|
1418
|
+
/**
|
|
1419
|
+
* The path of a module's layout file: the one it has, else `{prefix}.studio.json` after the prefix
|
|
1420
|
+
* of its files, else `module.studio.json`.
|
|
1421
|
+
*/
|
|
1422
|
+
export declare function studioLayoutPath(files: readonly NiceStudioFile[]): string;
|
|
1423
|
+
|
|
1424
|
+
/** `"Send invoice"` → `sendInvoice`: a name usable as a function's. */
|
|
1425
|
+
export declare function studioScriptIdentifier(name: string): string;
|
|
1426
|
+
|
|
1427
|
+
/** The languages of a kind, the first being the default (none for no-code). */
|
|
1428
|
+
export declare function studioScriptLanguages(kind: NiceStudioScriptKind): string[];
|
|
1429
|
+
|
|
1158
1430
|
/** Any other file, edited as text. */
|
|
1159
1431
|
export declare const textFallbackKind: NiceStudioFileKind<string>;
|
|
1160
1432
|
|
|
1433
|
+
/** A stored script as a list item: with a definition when the form can keep every field it edits. */
|
|
1434
|
+
export declare function toStudioScriptItem(raw: unknown, index: number): NiceStudioItem<NiceStudioScriptDef>;
|
|
1435
|
+
|
|
1161
1436
|
/**
|
|
1162
1437
|
* Validate a value object against a (subset of) Draft-07 JSON Schema.
|
|
1163
1438
|
* Covers required, type, enum, minLength/maxLength, minimum/maximum and pattern.
|