@synergy-client/types 0.1.0

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/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # @synergy-client/types
2
+
3
+ Shared Synergy domain types (views, attributes, objects, store) used by the
4
+ **client** and the **configurator** — a single source of truth for types that
5
+ were previously duplicated in each app.
6
+
7
+ ## Usage
8
+
9
+ ```ts
10
+ import type { ViewItem, ViewAttribute, ListViewTable, Store } from '@synergy-client/types'
11
+ ```
12
+
13
+ ### Module-API declarations (for editors)
14
+
15
+ The same types are also emitted as a single **ambient** `.d.ts` string, for
16
+ embedding into a Monaco editor (the configurator's module editor) or a future
17
+ VS Code extension that highlights the context of saved Synergy modules:
18
+
19
+ ```ts
20
+ import { moduleApiDts } from '@synergy-client/types/module-api'
21
+ // monaco.languages.typescript.javascriptDefaults.addExtraLib(moduleApiDts, '...')
22
+ ```
23
+
24
+ ## Develop
25
+
26
+ ```bash
27
+ npm install
28
+ npm run build # tsc -> dist + generates dist/module-api.js
29
+ npm link # to consume locally from the client / configurator
30
+ ```
31
+
32
+ In a consumer: `npm link @synergy-client/types`.
33
+
34
+ ## Publish
35
+
36
+ Same flow as the other Synergy packages (registry configured in your `.npmrc`):
37
+
38
+ ```bash
39
+ npm version patch
40
+ npm publish
41
+ ```
@@ -0,0 +1,195 @@
1
+ export type ViewType = 'list' | 'detail' | 'other' | 'worker' | 'static' | 'select' | 'component' | 'print';
2
+ export interface SortBy {
3
+ key: string;
4
+ order: 'asc' | 'desc' | string;
5
+ }
6
+ /** A form element (field, group, table, button, ...). */
7
+ export interface ViewItem {
8
+ id: string;
9
+ type: string;
10
+ name: string;
11
+ label: string;
12
+ labelPosition: 'left' | 'top' | 'none';
13
+ groupType?: 'toolbar' | 'collapsible';
14
+ tagName?: string;
15
+ multiType: boolean;
16
+ multiTypeVariant: 'common' | 'objects';
17
+ fieldPath: string;
18
+ fieldTypePath?: string;
19
+ dataLinked?: boolean;
20
+ dataPath?: string;
21
+ defaultValue?: any;
22
+ fieldType: string;
23
+ viewAttribute: boolean;
24
+ ref: null | string;
25
+ required: boolean;
26
+ visible: boolean;
27
+ translate: boolean;
28
+ newRow: boolean;
29
+ fieldCols: number;
30
+ labelCols: number;
31
+ contentCols: number | null;
32
+ itemOffset: number;
33
+ dataType: 'string' | 'integer' | 'decimal' | 'date' | 'enum';
34
+ dateType: 'date' | 'datetime' | 'time';
35
+ disabled: boolean;
36
+ options?: any;
37
+ format: string | null;
38
+ filter?: any;
39
+ switch?: boolean;
40
+ maxLength: string | null;
41
+ numberPrecision: string | null;
42
+ numberScale: string | null;
43
+ onChange: string | null;
44
+ placeholder: string | null;
45
+ icon: string;
46
+ tooltip?: any;
47
+ classes: string | null;
48
+ styles: string | null;
49
+ inputClasses: string | null;
50
+ inputStyles: string | null;
51
+ multiple?: boolean;
52
+ showTotals?: boolean;
53
+ usePagination?: boolean;
54
+ rowsLimit?: number;
55
+ maxHeight?: number;
56
+ selectBtn?: boolean;
57
+ openBtn?: boolean;
58
+ addBtn?: boolean;
59
+ attrs: any;
60
+ /** Nested items (for groups/tables). */
61
+ items?: ViewItem[];
62
+ }
63
+ /** A view attribute (form-level field, not bound to the object). */
64
+ export interface ViewAttribute {
65
+ id: string;
66
+ title: string;
67
+ name: string;
68
+ type: 'field' | 'tableField' | 'dynamicTable' | null;
69
+ dataType: string | null;
70
+ standard?: boolean;
71
+ multiType: boolean;
72
+ multiTypeVariant: 'common' | 'objects';
73
+ typeOptions?: any;
74
+ dateType: string;
75
+ defaultValue?: any;
76
+ format: string | null;
77
+ ref: string | string[] | null;
78
+ lang?: any;
79
+ tableName?: string | null;
80
+ childs: ViewAttribute[];
81
+ }
82
+ export interface ViewAttributeTreeItem extends Omit<ViewAttribute, 'id' | 'childs'> {
83
+ attrId: string;
84
+ path: string;
85
+ fullName: string;
86
+ fullPath: string;
87
+ fullTitle: string;
88
+ expanded?: boolean;
89
+ viewAttribute?: boolean;
90
+ dependent: boolean;
91
+ childs: ViewAttributeTreeItem[];
92
+ }
93
+ /** A field of an app object (catalog/document/register). */
94
+ export interface ObjectField {
95
+ id: string;
96
+ name: string;
97
+ title: string;
98
+ ref: string | string[] | null;
99
+ lang?: any;
100
+ type: string | null;
101
+ filter?: string | null;
102
+ format?: string | null;
103
+ primaryKey: boolean;
104
+ leading: boolean;
105
+ multiType: boolean;
106
+ multiTypeVariant: 'common' | 'objects';
107
+ defaultValue?: any;
108
+ dbName?: string;
109
+ dateType?: string;
110
+ notNull?: boolean;
111
+ isTablePart: boolean;
112
+ model?: string;
113
+ virtual?: boolean;
114
+ comment?: string | null;
115
+ typeOptions?: any;
116
+ fields?: ObjectField[];
117
+ }
118
+ /** A toolbar button/group. */
119
+ export interface ToolbarItem {
120
+ id: string;
121
+ title: string;
122
+ icon?: string | null;
123
+ presentation: string;
124
+ variant: string;
125
+ size: string;
126
+ disabled: boolean;
127
+ visible: boolean;
128
+ systemDisabled: boolean;
129
+ systemVisible: boolean;
130
+ hidden: boolean;
131
+ tooltip?: string;
132
+ type?: string;
133
+ click?: (...args: any[]) => any;
134
+ items?: ToolbarItem[];
135
+ }
136
+ export interface Toolbar {
137
+ position: string;
138
+ buttonsPosition: string;
139
+ classes: string | null;
140
+ styles: string | null;
141
+ items: ToolbarItem[];
142
+ staticItems: ToolbarItem[];
143
+ commonCommands: ToolbarItem[];
144
+ }
145
+ /** List/table view data (list and select forms). */
146
+ export interface ListViewTable {
147
+ items: any[];
148
+ fields: any[];
149
+ total: number;
150
+ page: number;
151
+ limit: number;
152
+ filters: Record<string, any>;
153
+ sort: SortBy[];
154
+ folders: {
155
+ items: any[];
156
+ expanded: any[];
157
+ };
158
+ }
159
+ /** Current route (vue-router). */
160
+ export interface Route {
161
+ path: string;
162
+ fullPath: string;
163
+ name?: string | symbol | null;
164
+ params: Record<string, any>;
165
+ query: Record<string, any>;
166
+ hash: string;
167
+ meta: Record<string, any>;
168
+ }
169
+ /** Router instance (vue-router). */
170
+ export interface Router {
171
+ push(to: any): Promise<any>;
172
+ replace(to: any): Promise<any>;
173
+ back(): void;
174
+ forward(): void;
175
+ go(delta: number): void;
176
+ }
177
+ /** Entity data store (useStore('object'), or a view's `store`). */
178
+ export interface Store {
179
+ findByPk(payload?: any): Promise<any>;
180
+ findAll(payload?: any): Promise<any>;
181
+ count(payload?: any): Promise<number>;
182
+ create(payload?: any): Promise<any>;
183
+ createItem(payload?: any): Promise<any>;
184
+ update(payload?: any): Promise<any>;
185
+ updateItem(payload?: any): Promise<any>;
186
+ delete(payload?: any): Promise<any>;
187
+ deleteItem(payload?: any): Promise<any>;
188
+ addNewItem(payload?: any): Promise<any>;
189
+ changeDeletionMark(payload?: any): Promise<any>;
190
+ getView(): {
191
+ object: any;
192
+ attrs: any;
193
+ objectMeta: any;
194
+ };
195
+ }
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ // Shared Synergy domain types used by the client and the configurator.
2
+ // Kept self-contained (no external deps) so the same definitions can also be
3
+ // emitted as an ambient .d.ts for the configurator's Monaco IntelliSense.
4
+ export {};
@@ -0,0 +1 @@
1
+ export declare const moduleApiDts: string;
@@ -0,0 +1 @@
1
+ export const moduleApiDts = "type ViewType = 'list' | 'detail' | 'other' | 'worker' | 'static' | 'select' | 'component' | 'print';\ninterface SortBy {\n key: string;\n order: 'asc' | 'desc' | string;\n}\n/** A form element (field, group, table, button, ...). */\ninterface ViewItem {\n id: string;\n type: string;\n name: string;\n label: string;\n labelPosition: 'left' | 'top' | 'none';\n groupType?: 'toolbar' | 'collapsible';\n tagName?: string;\n multiType: boolean;\n multiTypeVariant: 'common' | 'objects';\n fieldPath: string;\n fieldTypePath?: string;\n dataLinked?: boolean;\n dataPath?: string;\n defaultValue?: any;\n fieldType: string;\n viewAttribute: boolean;\n ref: null | string;\n required: boolean;\n visible: boolean;\n translate: boolean;\n newRow: boolean;\n fieldCols: number;\n labelCols: number;\n contentCols: number | null;\n itemOffset: number;\n dataType: 'string' | 'integer' | 'decimal' | 'date' | 'enum';\n dateType: 'date' | 'datetime' | 'time';\n disabled: boolean;\n options?: any;\n format: string | null;\n filter?: any;\n switch?: boolean;\n maxLength: string | null;\n numberPrecision: string | null;\n numberScale: string | null;\n onChange: string | null;\n placeholder: string | null;\n icon: string;\n tooltip?: any;\n classes: string | null;\n styles: string | null;\n inputClasses: string | null;\n inputStyles: string | null;\n multiple?: boolean;\n showTotals?: boolean;\n usePagination?: boolean;\n rowsLimit?: number;\n maxHeight?: number;\n selectBtn?: boolean;\n openBtn?: boolean;\n addBtn?: boolean;\n attrs: any;\n /** Nested items (for groups/tables). */\n items?: ViewItem[];\n}\n/** A view attribute (form-level field, not bound to the object). */\ninterface ViewAttribute {\n id: string;\n title: string;\n name: string;\n type: 'field' | 'tableField' | 'dynamicTable' | null;\n dataType: string | null;\n standard?: boolean;\n multiType: boolean;\n multiTypeVariant: 'common' | 'objects';\n typeOptions?: any;\n dateType: string;\n defaultValue?: any;\n format: string | null;\n ref: string | string[] | null;\n lang?: any;\n tableName?: string | null;\n childs: ViewAttribute[];\n}\ninterface ViewAttributeTreeItem extends Omit<ViewAttribute, 'id' | 'childs'> {\n attrId: string;\n path: string;\n fullName: string;\n fullPath: string;\n fullTitle: string;\n expanded?: boolean;\n viewAttribute?: boolean;\n dependent: boolean;\n childs: ViewAttributeTreeItem[];\n}\n/** A field of an app object (catalog/document/register). */\ninterface ObjectField {\n id: string;\n name: string;\n title: string;\n ref: string | string[] | null;\n lang?: any;\n type: string | null;\n filter?: string | null;\n format?: string | null;\n primaryKey: boolean;\n leading: boolean;\n multiType: boolean;\n multiTypeVariant: 'common' | 'objects';\n defaultValue?: any;\n dbName?: string;\n dateType?: string;\n notNull?: boolean;\n isTablePart: boolean;\n model?: string;\n virtual?: boolean;\n comment?: string | null;\n typeOptions?: any;\n fields?: ObjectField[];\n}\n/** A toolbar button/group. */\ninterface ToolbarItem {\n id: string;\n title: string;\n icon?: string | null;\n presentation: string;\n variant: string;\n size: string;\n disabled: boolean;\n visible: boolean;\n systemDisabled: boolean;\n systemVisible: boolean;\n hidden: boolean;\n tooltip?: string;\n type?: string;\n click?: (...args: any[]) => any;\n items?: ToolbarItem[];\n}\ninterface Toolbar {\n position: string;\n buttonsPosition: string;\n classes: string | null;\n styles: string | null;\n items: ToolbarItem[];\n staticItems: ToolbarItem[];\n commonCommands: ToolbarItem[];\n}\n/** List/table view data (list and select forms). */\ninterface ListViewTable {\n items: any[];\n fields: any[];\n total: number;\n page: number;\n limit: number;\n filters: Record<string, any>;\n sort: SortBy[];\n folders: {\n items: any[];\n expanded: any[];\n };\n}\n/** Current route (vue-router). */\ninterface Route {\n path: string;\n fullPath: string;\n name?: string | symbol | null;\n params: Record<string, any>;\n query: Record<string, any>;\n hash: string;\n meta: Record<string, any>;\n}\n/** Router instance (vue-router). */\ninterface Router {\n push(to: any): Promise<any>;\n replace(to: any): Promise<any>;\n back(): void;\n forward(): void;\n go(delta: number): void;\n}\n/** Entity data store (useStore('object'), or a view's `store`). */\ninterface Store {\n findByPk(payload?: any): Promise<any>;\n findAll(payload?: any): Promise<any>;\n count(payload?: any): Promise<number>;\n create(payload?: any): Promise<any>;\n createItem(payload?: any): Promise<any>;\n update(payload?: any): Promise<any>;\n updateItem(payload?: any): Promise<any>;\n delete(payload?: any): Promise<any>;\n deleteItem(payload?: any): Promise<any>;\n addNewItem(payload?: any): Promise<any>;\n changeDeletionMark(payload?: any): Promise<any>;\n getView(): {\n object: any;\n attrs: any;\n objectMeta: any;\n };\n}";
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@synergy-client/types",
3
+ "version": "0.1.0",
4
+ "description": "Shared Synergy domain types (views, attributes, objects, store) used by the client and the configurator.",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./module-api": {
14
+ "types": "./dist/module-api.d.ts",
15
+ "import": "./dist/module-api.js"
16
+ }
17
+ },
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "scripts": {
22
+ "build": "tsc -p tsconfig.json && node scripts/gen-module-api.mjs",
23
+ "prepublishOnly": "npm run build"
24
+ },
25
+ "devDependencies": {
26
+ "typescript": "^5.6.0"
27
+ }
28
+ }