@nice2dev/erp-adapter 1.3.10 → 1.3.11
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/CHANGELOG.md +68 -0
- package/README.md +60 -19
- package/dist/__tests__/omniverk/generator.test.d.ts +1 -0
- package/dist/__tests__/omniverk/kinds.test.d.ts +1 -0
- package/dist/__tests__/omniverk/preset.test.d.ts +1 -0
- package/dist/__tests__/omniverk/restProvider.test.d.ts +1 -0
- package/dist/__tests__/omniverk/seedFolderProvider.test.d.ts +1 -0
- package/dist/__tests__/omniverk/templates.test.d.ts +1 -0
- package/dist/__tests__/omniverk/validate.test.d.ts +1 -0
- package/dist/omniverk/fs/directoryHandle.d.ts +42 -0
- package/dist/omniverk/fs/memory.d.ts +8 -0
- package/dist/omniverk/fs/types.d.ts +33 -0
- package/dist/omniverk/generator.d.ts +98 -0
- package/dist/omniverk/index.d.ts +25 -0
- package/dist/omniverk/kinds.d.ts +33 -0
- package/dist/omniverk/manifestSections.d.ts +10 -0
- package/dist/omniverk/preset.d.ts +19 -0
- package/dist/omniverk/restProvider.d.ts +30 -0
- package/dist/omniverk/seedFolderProvider.d.ts +40 -0
- package/dist/omniverk/templates.d.ts +60 -0
- package/dist/omniverk/validate.d.ts +29 -0
- package/dist/omniverk.cjs +2 -0
- package/dist/omniverk.mjs +2658 -0
- package/package.json +15 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,73 @@
|
|
|
1
1
|
# @nice2dev/erp-adapter — Changelog
|
|
2
2
|
|
|
3
|
+
## 1.3.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 65fecd1: **`@nice2dev/erp-adapter/omniverk`: NiceDevelopmentStudio for OmniVerk seed modules.**
|
|
8
|
+
|
|
9
|
+
A new subpath of `@nice2dev/erp-adapter`. The main entry is unchanged. `@nice2dev/ui-forms` is a
|
|
10
|
+
new peer (the subpath runs on `@nice2dev/ui-forms/studio`); `@nice2dev/ui` an optional one
|
|
11
|
+
(types only).
|
|
12
|
+
|
|
13
|
+
- **File kinds** for every seed file, `{prefix}[.{unit}].{kind}.json`:
|
|
14
|
+
- manifest;
|
|
15
|
+
- entities: a field spelled `type` / `required` shows as `dataType` / `isRequired` and is
|
|
16
|
+
written back with the file's own spelling;
|
|
17
|
+
- translations over every language;
|
|
18
|
+
- views: List and Form open in NiceViewEditor; other types, such as Dashboard and legacy
|
|
19
|
+
`viewJson`, stay raw;
|
|
20
|
+
- workflows: state machines open in NiceWorkflowDesigner; automations stay raw;
|
|
21
|
+
- permissions, seed rows and scripts.
|
|
22
|
+
|
|
23
|
+
An entry opens in a visual editor only when it maps back to the same value. On all 567 OmniVerk
|
|
24
|
+
modules, an unedited document is written back byte for byte. The only exceptions are 3 files
|
|
25
|
+
with duplicate keys, which open raw.
|
|
26
|
+
|
|
27
|
+
- **`validateOmniVerkModule` / `validateOmniVerkWorkspace`:** the checks of OmniVerk's
|
|
28
|
+
`SeedJsonValidationTests`:
|
|
29
|
+
- manifest fields and icon config;
|
|
30
|
+
- Guid keys, and `type` vs `dataType`;
|
|
31
|
+
- List view shape;
|
|
32
|
+
- English and Polish key parity, no Polish in English labels, an English label for every
|
|
33
|
+
entity, field and view;
|
|
34
|
+
- no emoji icons;
|
|
35
|
+
- unique package names, and unique entity names per group.
|
|
36
|
+
|
|
37
|
+
They find no errors in the shipped seeds.
|
|
38
|
+
|
|
39
|
+
- **`buildOmniVerkModule`:** the Module Builder's generator (`ModulePackageWriter`). It gives the
|
|
40
|
+
same package names, entity ids and table names, plus an icon config.
|
|
41
|
+
**`duplicateOmniVerkModule`** copies a module under a new package name.
|
|
42
|
+
- **`createSeedFolderProvider`:** workspaces over seed folders (`Seed/Modules`, the `Custom.*`
|
|
43
|
+
overlay) and the wizard templates.
|
|
44
|
+
- A module of an earlier workspace shadows the same id in a later one.
|
|
45
|
+
- Writes are checked for conflicts and back up the previous text to `.revisions/`, with the
|
|
46
|
+
backend's stamp.
|
|
47
|
+
- Folders come from File System Access (`pickSeedDirectory`) or memory.
|
|
48
|
+
- **`createOmniVerkRestProvider`:** today's `api/module-manifests` (manifest only), or every file
|
|
49
|
+
through `api/module-files`. Templates go through `api/module-templates`.
|
|
50
|
+
- **`createOmniVerkStudioPreset`** ties it together: manifest sections from `ModuleManifest.cs`,
|
|
51
|
+
the entity field model, checks, the generator, and template properties. Their labels
|
|
52
|
+
(`devStudio.omniverk.*`) are translated in en, pl, de, fr, es and uk. With `scripting: true`
|
|
53
|
+
it adds the server-code section in the seeds' shape: `services` (name, scope, language,
|
|
54
|
+
script) and `controllers` (route, auth, and actions with verb, path, handler and auth).
|
|
55
|
+
|
|
56
|
+
ui-forms (`@nice2dev/ui-forms/studio`):
|
|
57
|
+
|
|
58
|
+
- A document opens raw when its unchanged model would not be written back byte for byte.
|
|
59
|
+
- Translations whose texts are nested open raw instead of empty.
|
|
60
|
+
- Text from the Source view and from script editors keeps its file's line breaks and BOM
|
|
61
|
+
(`keepTextFormat`).
|
|
62
|
+
- A manifest value in another shape than its section describes moves to "Other properties" and
|
|
63
|
+
is edited as JSON, instead of a form reshaping it. Examples: a per-language `description` object,
|
|
64
|
+
strings where the schema has objects, an item with keys the schema does not know, a value
|
|
65
|
+
outside an `enum`. It is not validated against that section either (`jsonValueFitsSchema`,
|
|
66
|
+
`fitManifestSection`). Measured on the 568 OmniVerk manifests, the OmniVerk sections show 31 keys
|
|
67
|
+
as forms wherever their shape allows. `setupWizard`, `installOptions`, `integrations`, `actions`
|
|
68
|
+
and most `dataSources` stay JSON, since seeds write them in mixed shapes.
|
|
69
|
+
- `JsonSchema` is exported from the subpath.
|
|
70
|
+
|
|
3
71
|
## 1.3.10
|
|
4
72
|
|
|
5
73
|
No changes in this release.
|
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Adapter layer connecting an OmniVerk .NET backend with @nice2dev/* React compone
|
|
|
14
14
|
npm install @nice2dev/erp-adapter
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
**Peer dependencies:** `react >= 17.0.0`, `react-dom >= 17.0.0`
|
|
17
|
+
**Peer dependencies:** `react >= 17.0.0`, `react-dom >= 17.0.0`, `@nice2dev/ui-forms` (used by the `/omniverk` subpath); optional `@nice2dev/ui` (types of the `/omniverk` subpath).
|
|
18
18
|
|
|
19
19
|
## Features
|
|
20
20
|
|
|
@@ -23,30 +23,30 @@ npm install @nice2dev/erp-adapter
|
|
|
23
23
|
- **ErpAuthAdapter** — JWT authentication (login, refresh, logout)
|
|
24
24
|
- **ErpFileAdapter** — File upload/download with blob storage
|
|
25
25
|
- **ErpExportAdapter** — Server-side export (xlsx, pdf, csv)
|
|
26
|
-
- **Control Registries** —
|
|
26
|
+
- **Control Registries** — Control descriptors (type, props, defaults) for view designer palettes
|
|
27
27
|
|
|
28
28
|
## Adapters
|
|
29
29
|
|
|
30
|
-
| Adapter
|
|
31
|
-
|
|
32
|
-
| `ErpDataAdapter`
|
|
33
|
-
| `ErpAuthAdapter`
|
|
34
|
-
| `ErpFileAdapter`
|
|
35
|
-
| `ErpExportAdapter`
|
|
36
|
-
| `createSignalRAdapter` | Real-time SignalR connection with auto-reconnect
|
|
30
|
+
| Adapter | Description |
|
|
31
|
+
| ---------------------- | ------------------------------------------------------------------------------- |
|
|
32
|
+
| `ErpDataAdapter` | Generic REST adapter for list/detail CRUD (supports paging, sorting, filtering) |
|
|
33
|
+
| `ErpAuthAdapter` | JWT login, token refresh, logout |
|
|
34
|
+
| `ErpFileAdapter` | File upload, download, delete against blob storage |
|
|
35
|
+
| `ErpExportAdapter` | Server-side export to xlsx, pdf, csv, json, xml |
|
|
36
|
+
| `createSignalRAdapter` | Real-time SignalR connection with auto-reconnect |
|
|
37
37
|
|
|
38
38
|
## Control Registries
|
|
39
39
|
|
|
40
|
-
| Registry
|
|
41
|
-
|
|
42
|
-
| `audioControlRegistry`
|
|
43
|
-
| `graphicControlRegistry`
|
|
44
|
-
| `threeControlRegistry`
|
|
45
|
-
| `gamificationControlRegistry` | Game engine, achievements, leaderboards
|
|
46
|
-
| `businessControlRegistry`
|
|
47
|
-
| `authControlRegistry`
|
|
48
|
-
| `socialControlRegistry`
|
|
49
|
-
| `allControlRegistries`
|
|
40
|
+
| Registry | Controls |
|
|
41
|
+
| ----------------------------- | ------------------------------------------------- |
|
|
42
|
+
| `audioControlRegistry` | DAW editor, player, karaoke, playlist, visualizer |
|
|
43
|
+
| `graphicControlRegistry` | Pixel, vector, photo, animation editors |
|
|
44
|
+
| `threeControlRegistry` | 3D model editor |
|
|
45
|
+
| `gamificationControlRegistry` | Game engine, achievements, leaderboards |
|
|
46
|
+
| `businessControlRegistry` | Charts, data grid, scheduler, gantt, pivot |
|
|
47
|
+
| `authControlRegistry` | Login, registration, 2FA, OAuth, captcha |
|
|
48
|
+
| `socialControlRegistry` | Comments, ratings, wiki |
|
|
49
|
+
| `allControlRegistries` | All of the above combined |
|
|
50
50
|
|
|
51
51
|
## Usage
|
|
52
52
|
|
|
@@ -81,6 +81,47 @@ await signalR.start();
|
|
|
81
81
|
signalR.on('ItemUpdated', (item) => console.log('Updated:', item));
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
+
## Development studio for OmniVerk seeds (`@nice2dev/erp-adapter/omniverk`)
|
|
85
|
+
|
|
86
|
+
`NiceDevelopmentStudio` (from `@nice2dev/ui-forms`) edits OmniVerk seed modules with this subpath:
|
|
87
|
+
file kinds for every `{prefix}[.{unit}].{kind}.json`, the checks of OmniVerk's
|
|
88
|
+
`SeedJsonValidationTests`, the Module Builder's generator (`ModulePackageWriter`), and providers.
|
|
89
|
+
A file is written back only when it was edited, and only the edited bytes change: a BOM, CRLF,
|
|
90
|
+
hand alignment and `25.0` stay. Shapes the editors do not understand open as raw JSON.
|
|
91
|
+
|
|
92
|
+
**Peers used here:** `@nice2dev/ui-forms` (runtime) and `@nice2dev/ui` (types).
|
|
93
|
+
|
|
94
|
+
```tsx
|
|
95
|
+
import { NiceDevelopmentStudio } from '@nice2dev/ui-forms';
|
|
96
|
+
import {
|
|
97
|
+
createDirectoryHandleFileSystem,
|
|
98
|
+
createOmniVerkRestProvider,
|
|
99
|
+
createOmniVerkStudioPreset,
|
|
100
|
+
createSeedFolderProvider,
|
|
101
|
+
pickSeedDirectory,
|
|
102
|
+
} from '@nice2dev/erp-adapter/omniverk';
|
|
103
|
+
|
|
104
|
+
// A developer's Seed/Modules folder (Chromium, File System Access) — call from a click
|
|
105
|
+
const seeds = await pickSeedDirectory({ id: 'seed-modules' });
|
|
106
|
+
const provider = createSeedFolderProvider({
|
|
107
|
+
roots: [{ id: 'system', label: 'System', fs: createDirectoryHandleFileSystem(seeds) }],
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// …or the OmniVerk API: today's manifest endpoints, or every file once `api/module-files` exists
|
|
111
|
+
const api = createOmniVerkRestProvider({ mode: 'manifest-only' });
|
|
112
|
+
|
|
113
|
+
<NiceDevelopmentStudio provider={provider} preset={(t) => createOmniVerkStudioPreset({ t })} />;
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
| Export | What it does |
|
|
117
|
+
| --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
118
|
+
| `createOmniVerkStudioPreset` | Kinds, manifest sections, entity field model, checks, generator, templates schema |
|
|
119
|
+
| `createSeedFolderProvider` | Workspaces over seed folders (`Seed/Modules`, the `Custom.*` overlay): shadowing, conflicts, `.revisions/` backups, `Templates/wizard-templates-*.seed.json` |
|
|
120
|
+
| `createOmniVerkRestProvider` | `manifest-only` (`api/module-manifests`) or `files` (`api/module-files`); templates via `api/module-templates` |
|
|
121
|
+
| `buildOmniVerkModule`, `duplicateOmniVerkModule` | A new `Custom.<Name>` package as the backend writes it (same entity ids and tables); a copy under a new package name |
|
|
122
|
+
| `validateOmniVerkModule`, `validateOmniVerkWorkspace` | The seed checks of OmniVerk's CI, per module and across modules |
|
|
123
|
+
| `createMemorySeedFileSystem`, `createDirectoryHandleFileSystem` | Seed folders in memory (tests, demos) or picked in the browser |
|
|
124
|
+
|
|
84
125
|
## Types
|
|
85
126
|
|
|
86
127
|
Key TypeScript types exported:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { SeedFileSystem } from './types';
|
|
2
|
+
/** The parts of `FileSystemFileHandle` used here. */
|
|
3
|
+
export interface SeedFileHandle {
|
|
4
|
+
kind: 'file';
|
|
5
|
+
name: string;
|
|
6
|
+
getFile(): Promise<{
|
|
7
|
+
lastModified: number;
|
|
8
|
+
size: number;
|
|
9
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
10
|
+
}>;
|
|
11
|
+
createWritable(): Promise<{
|
|
12
|
+
write(data: string): Promise<void>;
|
|
13
|
+
close(): Promise<void>;
|
|
14
|
+
}>;
|
|
15
|
+
}
|
|
16
|
+
/** The parts of `FileSystemDirectoryHandle` used here. */
|
|
17
|
+
export interface SeedDirectoryHandle {
|
|
18
|
+
kind: 'directory';
|
|
19
|
+
name: string;
|
|
20
|
+
values(): AsyncIterable<SeedFileHandle | SeedDirectoryHandle>;
|
|
21
|
+
getFileHandle(name: string, options?: {
|
|
22
|
+
create?: boolean;
|
|
23
|
+
}): Promise<SeedFileHandle>;
|
|
24
|
+
getDirectoryHandle(name: string, options?: {
|
|
25
|
+
create?: boolean;
|
|
26
|
+
}): Promise<SeedDirectoryHandle>;
|
|
27
|
+
removeEntry(name: string, options?: {
|
|
28
|
+
recursive?: boolean;
|
|
29
|
+
}): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
/** Whether this browser can open a folder (File System Access). */
|
|
32
|
+
export declare function isSeedFolderPickerSupported(): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Asks the user for a folder (call from a click). `id` lets the browser remember where the last
|
|
35
|
+
* folder of that purpose was (`seed-modules`, `seed-overlay`).
|
|
36
|
+
*/
|
|
37
|
+
export declare function pickSeedDirectory(options?: {
|
|
38
|
+
id?: string;
|
|
39
|
+
readOnly?: boolean;
|
|
40
|
+
}): Promise<SeedDirectoryHandle>;
|
|
41
|
+
/** A seed file system over a picked folder. */
|
|
42
|
+
export declare function createDirectoryHandleFileSystem(root: SeedDirectoryHandle): SeedFileSystem;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SeedFileSystem } from './types';
|
|
2
|
+
/** An in-memory folder you can also inspect. */
|
|
3
|
+
export interface MemorySeedFileSystem extends SeedFileSystem {
|
|
4
|
+
/** Every file by path. */
|
|
5
|
+
snapshot(): Record<string, string>;
|
|
6
|
+
}
|
|
7
|
+
/** A folder held in memory, seeded with `files` (path → text). */
|
|
8
|
+
export declare function createMemorySeedFileSystem(files?: Record<string, string>): MemorySeedFileSystem;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The file system a seed folder provider works on: a folder (`Seed/Modules`, the overlay) seen
|
|
3
|
+
* through paths relative to it, `/`-separated. Implementations: a File System Access directory
|
|
4
|
+
* (Chromium), an in-memory folder (tests, demos), or anything the host has (Node `fs`, Electron).
|
|
5
|
+
*/
|
|
6
|
+
/** An entry of a folder. */
|
|
7
|
+
export interface SeedFileEntry {
|
|
8
|
+
name: string;
|
|
9
|
+
kind: 'file' | 'directory';
|
|
10
|
+
}
|
|
11
|
+
/** A file's exact text — a BOM as a leading U+FEFF — and an opaque version for conflict checks. */
|
|
12
|
+
export interface SeedFileContent {
|
|
13
|
+
text: string;
|
|
14
|
+
version: string;
|
|
15
|
+
}
|
|
16
|
+
export interface SeedFileSystem {
|
|
17
|
+
/** The entries of a folder (`''` is the root); a missing folder has none. */
|
|
18
|
+
list(dir: string): Promise<SeedFileEntry[]>;
|
|
19
|
+
/** A file, or `null` when there is none. */
|
|
20
|
+
read(path: string): Promise<SeedFileContent | null>;
|
|
21
|
+
/** Writes a file (creating its folders) and returns its new version. */
|
|
22
|
+
write(path: string, text: string): Promise<string>;
|
|
23
|
+
/** Removes a file; a missing file is fine. */
|
|
24
|
+
remove(path: string): Promise<void>;
|
|
25
|
+
/** Removes a folder with everything in it. */
|
|
26
|
+
removeDir(path: string): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
/** `a/b` + `c` → `a/b/c`; empty parts are skipped. */
|
|
29
|
+
export declare const joinPath: (...parts: string[]) => string;
|
|
30
|
+
/** The folder of a path (`''` at the root). */
|
|
31
|
+
export declare const dirOf: (path: string) => string;
|
|
32
|
+
/** The last part of a path. */
|
|
33
|
+
export declare const baseOf: (path: string) => string;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { NiceStudioFile, NiceStudioGeneratedModule, NiceStudioModuleSpec } from '@nice2dev/ui-forms/studio';
|
|
2
|
+
/** The package prefix of modules built in an instance (the overlay). */
|
|
3
|
+
export declare const OMNIVERK_CUSTOM_PREFIX = "Custom.";
|
|
4
|
+
/** The data types a generated field can have (others are mapped onto them). */
|
|
5
|
+
export declare const OMNIVERK_DATA_TYPES: readonly ["string", "text", "int", "long", "decimal", "currency", "bool", "DateTime", "DateOnly", "TimeOnly", "json", "enum", "Guid"];
|
|
6
|
+
/** "Wypożyczalnia rowerów" → `WypozyczalniaRowerow` (letters and digits, accents dropped; a leading digit gets `M`). */
|
|
7
|
+
export declare function omniverkPascalIdentifier(text: string): string;
|
|
8
|
+
/** The file prefix of a package: `Custom.BikeRental` → `bikerental`, `Sales.Orders` → `orders`. */
|
|
9
|
+
export declare function omniverkFilePrefix(packageName: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* The id the backend gives an entity of a package: the same package and entity always give the
|
|
12
|
+
* same id, so a reinstalled module keeps its rows.
|
|
13
|
+
*/
|
|
14
|
+
export declare function omniverkStableId(packageName: string, entity: string): Promise<string>;
|
|
15
|
+
/** `custom_<prefix>_<entity>`, shortened with a hash to PostgreSQL's 63 characters. */
|
|
16
|
+
export declare function omniverkTableName(prefix: string, entity: string): Promise<string>;
|
|
17
|
+
/** A field of a described module (`ModulePackageField`). */
|
|
18
|
+
export interface OmniVerkFieldSpec {
|
|
19
|
+
name: string;
|
|
20
|
+
displayName?: string;
|
|
21
|
+
/** string, text, int, long, decimal, currency, bool, DateTime, DateOnly, TimeOnly, json, enum or Guid. */
|
|
22
|
+
dataType?: string;
|
|
23
|
+
isRequired?: boolean;
|
|
24
|
+
maxLength?: number;
|
|
25
|
+
isUnique?: boolean;
|
|
26
|
+
isIndexed?: boolean;
|
|
27
|
+
isForeignKey?: boolean;
|
|
28
|
+
/** The entity of the same module a foreign key points at. */
|
|
29
|
+
referencedEntity?: string;
|
|
30
|
+
defaultValue?: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
}
|
|
33
|
+
/** An entity of a described module (`ModulePackageEntity`). */
|
|
34
|
+
export interface OmniVerkEntitySpec {
|
|
35
|
+
name: string;
|
|
36
|
+
displayName?: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
icon?: string;
|
|
39
|
+
fields: OmniVerkFieldSpec[];
|
|
40
|
+
}
|
|
41
|
+
/** A described module (`ModulePackageSpec`). */
|
|
42
|
+
export interface OmniVerkModuleSpec {
|
|
43
|
+
/** As typed ("Wypożyczalnia rowerów"); the package is `Custom.<Name>`. */
|
|
44
|
+
name: string;
|
|
45
|
+
description?: string;
|
|
46
|
+
/** Catalogue category. Default `Custom`. */
|
|
47
|
+
category?: string;
|
|
48
|
+
/** Icon name (Material / Ntd). */
|
|
49
|
+
icon?: string;
|
|
50
|
+
entities: OmniVerkEntitySpec[];
|
|
51
|
+
/** Bundles to write; English and Polish are always written. */
|
|
52
|
+
locales?: string[];
|
|
53
|
+
/** A List and a Form view per entity. Default true. */
|
|
54
|
+
views?: boolean;
|
|
55
|
+
/** Read / Create / Edit / Delete / Admin and three groups. Default true. */
|
|
56
|
+
permissions?: boolean;
|
|
57
|
+
/** An `iconconfig.json` (every shipped module has one). Default true. */
|
|
58
|
+
iconConfig?: boolean;
|
|
59
|
+
/** The organization the package belongs to: only it sees and installs it. */
|
|
60
|
+
ownerTenantId?: string;
|
|
61
|
+
/** The designer definition it was written from. */
|
|
62
|
+
sourceDefinitionId?: string;
|
|
63
|
+
}
|
|
64
|
+
/** Options of {@link buildOmniVerkModule}. */
|
|
65
|
+
export interface OmniVerkBuildOptions {
|
|
66
|
+
/** Package names already taken: the new one gets a number (`Custom.Rental2`). */
|
|
67
|
+
existingPackageNames?: ReadonlySet<string>;
|
|
68
|
+
/** The clock of `exportedAt`. */
|
|
69
|
+
now?: () => Date;
|
|
70
|
+
}
|
|
71
|
+
/** A generated package: its name, its folder relative to the overlay, its files by name. */
|
|
72
|
+
export interface OmniVerkModulePackage {
|
|
73
|
+
packageName: string;
|
|
74
|
+
folder: string;
|
|
75
|
+
files: Array<{
|
|
76
|
+
path: string;
|
|
77
|
+
text: string;
|
|
78
|
+
}>;
|
|
79
|
+
}
|
|
80
|
+
/** The package, or why it cannot be written. */
|
|
81
|
+
export interface OmniVerkBuildResult {
|
|
82
|
+
package?: OmniVerkModulePackage;
|
|
83
|
+
problems: string[];
|
|
84
|
+
}
|
|
85
|
+
/** Writes a described module as an OmniVerk seed package (`ModulePackageWriter.Build`). */
|
|
86
|
+
export declare function buildOmniVerkModule(spec: OmniVerkModuleSpec, options?: OmniVerkBuildOptions): Promise<OmniVerkBuildResult>;
|
|
87
|
+
/** The studio wizard's answers as an OmniVerk module spec. */
|
|
88
|
+
export declare function omniverkSpecFromStudio(spec: NiceStudioModuleSpec): OmniVerkModuleSpec;
|
|
89
|
+
/**
|
|
90
|
+
* A copy of a module under a new package name: file names get the new prefix, references to the
|
|
91
|
+
* package and its permission codes follow, entities get the new package's ids and tables. Each
|
|
92
|
+
* file keeps its formatting.
|
|
93
|
+
*/
|
|
94
|
+
export declare function duplicateOmniVerkModule(files: readonly NiceStudioFile[], target: {
|
|
95
|
+
id: string;
|
|
96
|
+
packageId?: string;
|
|
97
|
+
name?: string;
|
|
98
|
+
}): Promise<NiceStudioGeneratedModule>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @nice2dev/erp-adapter/omniverk — NiceDevelopmentStudio for OmniVerk seed modules: file kinds
|
|
3
|
+
* that keep every byte the editors do not touch, the CI's checks, the Module Builder's generator,
|
|
4
|
+
* providers over seed folders (File System Access, memory) and over the OmniVerk API.
|
|
5
|
+
*/
|
|
6
|
+
export { omniverkEntitiesKind, omniverkFileKinds, omniverkI18nKind, omniverkManifestKind, omniverkPermissionsKind, omniverkScriptKind, omniverkSeedsKind, omniverkViewFromItem, omniverkViewItem, omniverkViewsKind, omniverkWorkflowFromItem, omniverkWorkflowItem, omniverkWorkflowsKind, } from './kinds';
|
|
7
|
+
export { omniverkManifestSections } from './manifestSections';
|
|
8
|
+
export type { OmniVerkManifestSectionsOptions, OmniVerkTranslate } from './manifestSections';
|
|
9
|
+
export { buildOmniVerkModule, duplicateOmniVerkModule, OMNIVERK_CUSTOM_PREFIX, OMNIVERK_DATA_TYPES, omniverkFilePrefix, omniverkPascalIdentifier, omniverkSpecFromStudio, omniverkStableId, omniverkTableName, } from './generator';
|
|
10
|
+
export type { OmniVerkBuildOptions, OmniVerkBuildResult, OmniVerkEntitySpec, OmniVerkFieldSpec, OmniVerkModulePackage, OmniVerkModuleSpec, } from './generator';
|
|
11
|
+
export { OMNIVERK_LEGACY_LIST_VIEW_FILES, validateOmniVerkModule, validateOmniVerkWorkspace, } from './validate';
|
|
12
|
+
export type { OmniVerkValidateOptions, OmniVerkWorkspaceModule } from './validate';
|
|
13
|
+
export { omniverkTemplateFromDto, omniverkTemplateFromEntry, omniverkTemplateToEntry, omniverkTemplateToInput, } from './templates';
|
|
14
|
+
export type { OmniVerkTemplateDto, OmniVerkTemplateInput } from './templates';
|
|
15
|
+
export { createSeedFolderProvider, omniverkRevisionStamp } from './seedFolderProvider';
|
|
16
|
+
export type { SeedFolderProvider, SeedFolderProviderOptions, SeedFolderRoot, } from './seedFolderProvider';
|
|
17
|
+
export { createOmniVerkRestProvider, OmniVerkRestError } from './restProvider';
|
|
18
|
+
export type { OmniVerkRestProviderOptions } from './restProvider';
|
|
19
|
+
export { createOmniVerkStudioPreset, OMNIVERK_LOCALES } from './preset';
|
|
20
|
+
export type { OmniVerkStudioPresetOptions } from './preset';
|
|
21
|
+
export { createMemorySeedFileSystem } from './fs/memory';
|
|
22
|
+
export type { MemorySeedFileSystem } from './fs/memory';
|
|
23
|
+
export { createDirectoryHandleFileSystem, isSeedFolderPickerSupported, pickSeedDirectory, } from './fs/directoryHandle';
|
|
24
|
+
export type { SeedDirectoryHandle, SeedFileHandle } from './fs/directoryHandle';
|
|
25
|
+
export type { SeedFileContent, SeedFileEntry, SeedFileSystem } from './fs/types';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { NiceViewDefinition, NiceWorkflowDefinition } from '@nice2dev/ui';
|
|
2
|
+
import { NiceStudioFileKind, NiceStudioItem, NiceStudioPermissions, NiceStudioSeeds } from '@nice2dev/ui-forms/studio';
|
|
3
|
+
type Row = Record<string, unknown>;
|
|
4
|
+
export declare const omniverkManifestKind: NiceStudioFileKind<Row>;
|
|
5
|
+
/**
|
|
6
|
+
* `*.entities.json` (one document per file; multi-part modules have several). A field written
|
|
7
|
+
* with `type` / `required` shows in the editor as `dataType` / `isRequired` and is written back
|
|
8
|
+
* with the key its file used — the studio never rewrites the spelling by itself.
|
|
9
|
+
*/
|
|
10
|
+
export declare const omniverkEntitiesKind: NiceStudioFileKind<Row[]>;
|
|
11
|
+
/** `{prefix}.{locale}.i18n.json` — `translations` or `keys`; one document over every language. */
|
|
12
|
+
export declare const omniverkI18nKind: NiceStudioFileKind<import('@nice2dev/ui-forms/studio').NiceStudioTranslations>;
|
|
13
|
+
/** A seed view as a list item: List and Form views open in the designer when they read back unchanged. */
|
|
14
|
+
export declare function omniverkViewItem(raw: unknown, index: number): NiceStudioItem<NiceViewDefinition>;
|
|
15
|
+
export declare function omniverkViewFromItem(item: NiceStudioItem<NiceViewDefinition>): unknown;
|
|
16
|
+
export declare const omniverkViewsKind: NiceStudioFileKind<NiceStudioItem<NiceViewDefinition>[]>;
|
|
17
|
+
/** A seed workflow: state machines (steps + connections) open in the designer; automations stay raw. */
|
|
18
|
+
export declare function omniverkWorkflowItem(raw: unknown, index: number): NiceStudioItem<NiceWorkflowDefinition>;
|
|
19
|
+
export declare function omniverkWorkflowFromItem(item: NiceStudioItem<NiceWorkflowDefinition>): unknown;
|
|
20
|
+
export declare const omniverkWorkflowsKind: NiceStudioFileKind<NiceStudioItem<NiceWorkflowDefinition>[]>;
|
|
21
|
+
/**
|
|
22
|
+
* `*.permissions.json`: permission codes and `permissionGroups` (roleDefaults and the rest kept).
|
|
23
|
+
* A file with fields the model does not carry (`category`, per-code flags) opens raw — the studio
|
|
24
|
+
* checks every document reads back unchanged before it offers a visual editor.
|
|
25
|
+
*/
|
|
26
|
+
export declare const omniverkPermissionsKind: NiceStudioFileKind<NiceStudioPermissions>;
|
|
27
|
+
/** `*.seeds.json`: rows per entity in `seeds` and `demoSeeds`; other shapes open raw. */
|
|
28
|
+
export declare const omniverkSeedsKind: NiceStudioFileKind<NiceStudioSeeds>;
|
|
29
|
+
/** Server scripts of a module (`services/*.js`, `jobs/*.js`, `*.cs`). */
|
|
30
|
+
export declare const omniverkScriptKind: NiceStudioFileKind<string>;
|
|
31
|
+
/** Every OmniVerk kind, in matching order (other files — iconconfig, panels, tests… — open as JSON). */
|
|
32
|
+
export declare const omniverkFileKinds: NiceStudioFileKind[];
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NiceManifestSection } from '@nice2dev/ui-forms/studio';
|
|
2
|
+
/** `t(key, fallback)` as the studio passes it to a preset factory. */
|
|
3
|
+
export type OmniVerkTranslate = (key: string, fallback: string) => string;
|
|
4
|
+
/** Options of {@link omniverkManifestSections}. */
|
|
5
|
+
export interface OmniVerkManifestSectionsOptions {
|
|
6
|
+
/** Adds the server-code section (services and HTTP controllers) of OmniVerk's module editor. */
|
|
7
|
+
scripting?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** The manifest of an OmniVerk seed module as studio sections. */
|
|
10
|
+
export declare function omniverkManifestSections(t?: OmniVerkTranslate, options?: OmniVerkManifestSectionsOptions): NiceManifestSection[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { NiceStudioPreset } from '@nice2dev/ui-forms/studio';
|
|
2
|
+
import { OmniVerkTranslate } from './manifestSections';
|
|
3
|
+
/** Languages OmniVerk ships bundles in; English and Polish are mandatory. */
|
|
4
|
+
export declare const OMNIVERK_LOCALES: string[];
|
|
5
|
+
/** Options of {@link createOmniVerkStudioPreset}. */
|
|
6
|
+
export interface OmniVerkStudioPresetOptions {
|
|
7
|
+
/** The studio's `t(key, fallback)` (pass the preset as `(t) => createOmniVerkStudioPreset({ t })`). */
|
|
8
|
+
t?: OmniVerkTranslate;
|
|
9
|
+
/** Languages offered. Default {@link OMNIVERK_LOCALES}. */
|
|
10
|
+
locales?: string[];
|
|
11
|
+
/** Adds the server-code manifest section (services and HTTP controllers). */
|
|
12
|
+
scripting?: boolean;
|
|
13
|
+
/** New modules get an `iconconfig.json`. Default true. */
|
|
14
|
+
iconConfig?: boolean;
|
|
15
|
+
/** The organization new modules belong to (`ownerTenantId`). */
|
|
16
|
+
ownerTenantId?: string;
|
|
17
|
+
}
|
|
18
|
+
/** The studio preset for OmniVerk seed modules. */
|
|
19
|
+
export declare function createOmniVerkStudioPreset(options?: OmniVerkStudioPresetOptions): NiceStudioPreset;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { NiceStudioProvider } from '@nice2dev/ui-forms/studio';
|
|
2
|
+
/** Options of {@link createOmniVerkRestProvider}. */
|
|
3
|
+
export interface OmniVerkRestProviderOptions {
|
|
4
|
+
/** The API root. Default `/api`. */
|
|
5
|
+
baseUrl?: string;
|
|
6
|
+
/** Default `manifest-only` (today's backend). */
|
|
7
|
+
mode?: 'manifest-only' | 'files';
|
|
8
|
+
/** Headers of every request (an `Authorization` bearer…); may be computed per request. */
|
|
9
|
+
headers?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>);
|
|
10
|
+
/** Default `same-origin`. */
|
|
11
|
+
credentials?: RequestCredentials;
|
|
12
|
+
/** Default `globalThis.fetch`. */
|
|
13
|
+
fetch?: typeof fetch;
|
|
14
|
+
/** Templates through `api/module-templates`. Default true. */
|
|
15
|
+
templates?: boolean;
|
|
16
|
+
/** The language template names are listed in. Default `en`. */
|
|
17
|
+
language?: string;
|
|
18
|
+
/** `manifest-only`: the workspace's label. Default `Seed/Modules`. */
|
|
19
|
+
workspaceLabel?: string;
|
|
20
|
+
/** `files`: ask the backend to check a module too (`POST …/validate`). Default false. */
|
|
21
|
+
serverValidation?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/** An answer the backend refused. */
|
|
24
|
+
export declare class OmniVerkRestError extends Error {
|
|
25
|
+
readonly status: number;
|
|
26
|
+
readonly body: unknown;
|
|
27
|
+
constructor(message: string, status: number, body: unknown);
|
|
28
|
+
}
|
|
29
|
+
/** A studio provider over the OmniVerk API. */
|
|
30
|
+
export declare function createOmniVerkRestProvider(options?: OmniVerkRestProviderOptions): NiceStudioProvider;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { NiceStudioProvider } from '@nice2dev/ui-forms/studio';
|
|
2
|
+
import { SeedFileSystem } from './fs/types';
|
|
3
|
+
/** A folder of modules: one workspace of the studio. */
|
|
4
|
+
export interface SeedFolderRoot {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
icon?: string;
|
|
9
|
+
fs: SeedFileSystem;
|
|
10
|
+
/** Modules can be opened but not changed (e.g. the shipped seeds on a production server). */
|
|
11
|
+
readOnly?: boolean;
|
|
12
|
+
/** The folder of the wizard templates; `false` for none. Default `Templates`. */
|
|
13
|
+
templatesDir?: string | false;
|
|
14
|
+
}
|
|
15
|
+
/** Options of {@link createSeedFolderProvider}. */
|
|
16
|
+
export interface SeedFolderProviderOptions {
|
|
17
|
+
/** In priority order: a module id found in an earlier root shadows the later ones. */
|
|
18
|
+
roots: SeedFolderRoot[];
|
|
19
|
+
/** Copy a file to `.revisions/` before it is overwritten or deleted. Default true. */
|
|
20
|
+
revisions?: boolean;
|
|
21
|
+
/** The folder (relative to its root) a new module goes to. Default `{package or Custom}/{Name}`. */
|
|
22
|
+
moduleFolder?(input: {
|
|
23
|
+
workspaceId: string;
|
|
24
|
+
packageId?: string;
|
|
25
|
+
id: string;
|
|
26
|
+
}): string;
|
|
27
|
+
/** Accepted `Group/Entity` duplicates of `validate` (the CI keeps such a list). */
|
|
28
|
+
knownDuplicates?: ReadonlySet<string>;
|
|
29
|
+
/** The clock of revision stamps. */
|
|
30
|
+
now?: () => Date;
|
|
31
|
+
}
|
|
32
|
+
/** The studio provider, plus a way to forget what it scanned. */
|
|
33
|
+
export interface SeedFolderProvider extends NiceStudioProvider {
|
|
34
|
+
/** Drops the scan, so the next listing reads the folders again. */
|
|
35
|
+
invalidate(): void;
|
|
36
|
+
}
|
|
37
|
+
/** `yyyyMMddTHHmmssfffZ` (UTC), as the backend stamps its revisions. */
|
|
38
|
+
export declare function omniverkRevisionStamp(date: Date): string;
|
|
39
|
+
/** A studio provider over OmniVerk seed folders. */
|
|
40
|
+
export declare function createSeedFolderProvider(options: SeedFolderProviderOptions): SeedFolderProvider;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { NiceStudioTemplate } from '@nice2dev/ui-forms/studio';
|
|
2
|
+
type Row = Record<string, unknown>;
|
|
3
|
+
/** A `wizard-templates-*.seed.json` entry as a studio template (unknown keys kept in `extra`). */
|
|
4
|
+
export declare function omniverkTemplateFromEntry(entry: unknown, readOnly?: boolean): NiceStudioTemplate;
|
|
5
|
+
/**
|
|
6
|
+
* A studio template as a seed entry, laid over the entry it came from: its key order, the tag
|
|
7
|
+
* spelling (`"a,b"` or `["a","b"]`) and per-module keys the studio does not know are kept.
|
|
8
|
+
*/
|
|
9
|
+
export declare function omniverkTemplateToEntry(template: NiceStudioTemplate, original?: unknown): Row;
|
|
10
|
+
/** `ModuleTemplateDetail` (or a list row with `modules=true`) of the backend. */
|
|
11
|
+
export interface OmniVerkTemplateDto {
|
|
12
|
+
slug: string;
|
|
13
|
+
category?: string | null;
|
|
14
|
+
subCategory?: string | null;
|
|
15
|
+
icon?: string | null;
|
|
16
|
+
tags?: string[];
|
|
17
|
+
parentSlug?: string | null;
|
|
18
|
+
/** `seed` and `code` templates cannot be changed here. */
|
|
19
|
+
source?: 'seed' | 'code' | 'custom';
|
|
20
|
+
isActive?: boolean;
|
|
21
|
+
sortOrder?: number;
|
|
22
|
+
name?: string;
|
|
23
|
+
description?: string;
|
|
24
|
+
translations?: Record<string, {
|
|
25
|
+
name: string;
|
|
26
|
+
description?: string | null;
|
|
27
|
+
}>;
|
|
28
|
+
modules?: Array<{
|
|
29
|
+
packageName: string;
|
|
30
|
+
required?: boolean;
|
|
31
|
+
condition?: string | null;
|
|
32
|
+
description?: string | null;
|
|
33
|
+
}>;
|
|
34
|
+
compliance?: string[];
|
|
35
|
+
defaultLanguage?: string | null;
|
|
36
|
+
}
|
|
37
|
+
/** `ModuleTemplateInput` of the backend. */
|
|
38
|
+
export interface OmniVerkTemplateInput {
|
|
39
|
+
slug: string;
|
|
40
|
+
category: string;
|
|
41
|
+
subCategory?: string | null;
|
|
42
|
+
icon?: string | null;
|
|
43
|
+
tags: string[];
|
|
44
|
+
isActive: boolean;
|
|
45
|
+
translations: Record<string, {
|
|
46
|
+
name: string;
|
|
47
|
+
description?: string | null;
|
|
48
|
+
}>;
|
|
49
|
+
modules: Array<{
|
|
50
|
+
packageName: string;
|
|
51
|
+
required: boolean;
|
|
52
|
+
condition?: string | null;
|
|
53
|
+
description?: string | null;
|
|
54
|
+
}>;
|
|
55
|
+
compliance?: string[];
|
|
56
|
+
defaultLanguage?: string | null;
|
|
57
|
+
}
|
|
58
|
+
export declare function omniverkTemplateFromDto(dto: OmniVerkTemplateDto, lang?: string): NiceStudioTemplate;
|
|
59
|
+
export declare function omniverkTemplateToInput(template: NiceStudioTemplate): OmniVerkTemplateInput;
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { NiceStudioFile, NiceStudioIssue, NiceStudioModuleContext } from '@nice2dev/ui-forms/studio';
|
|
2
|
+
/**
|
|
3
|
+
* Views files the CI lets keep List views without a top-level entity (`LegacyListViewFiles` of
|
|
4
|
+
* `SeedJsonValidationTests`, 2026-11-02): they list entities their module does not define.
|
|
5
|
+
*/
|
|
6
|
+
export declare const OMNIVERK_LEGACY_LIST_VIEW_FILES: ReadonlySet<string>;
|
|
7
|
+
/** Options of {@link validateOmniVerkModule}. */
|
|
8
|
+
export interface OmniVerkValidateOptions {
|
|
9
|
+
/** Views files exempt from the List view shape check. Default {@link OMNIVERK_LEGACY_LIST_VIEW_FILES}. */
|
|
10
|
+
legacyListViewFiles?: ReadonlySet<string>;
|
|
11
|
+
}
|
|
12
|
+
/** Every check of `SeedJsonValidationTests` that looks at one module. */
|
|
13
|
+
export declare function validateOmniVerkModule(ctx: Pick<NiceStudioModuleContext, 'files'>, options?: OmniVerkValidateOptions): NiceStudioIssue[];
|
|
14
|
+
/** A module of a workspace, for the checks that compare modules. */
|
|
15
|
+
export interface OmniVerkWorkspaceModule {
|
|
16
|
+
/** Shown in messages (a folder). */
|
|
17
|
+
location: string;
|
|
18
|
+
/** Modules of the same group may not share entity names (the top folder: `Commerce`, `Finance`…). */
|
|
19
|
+
group?: string;
|
|
20
|
+
files: readonly NiceStudioFile[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The checks of `SeedJsonValidationTests` across modules: unique package names, and entity names
|
|
24
|
+
* unique within a top-level folder (the second module's table would replace the first one's).
|
|
25
|
+
* `knownDuplicates` lists accepted `group/Entity` pairs (the CI keeps such a list).
|
|
26
|
+
*/
|
|
27
|
+
export declare function validateOmniVerkWorkspace(modules: readonly OmniVerkWorkspaceModule[], options?: {
|
|
28
|
+
knownDuplicates?: ReadonlySet<string>;
|
|
29
|
+
}): NiceStudioIssue[];
|