@uns-kit/cli 2.0.20 → 2.0.22
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/LICENSE +21 -21
- package/README.md +175 -175
- package/package.json +6 -6
- package/templates/api/src/examples/api-example.ts +91 -91
- package/templates/azure-pipelines.yml +21 -21
- package/templates/codegen/codegen.ts +15 -15
- package/templates/codegen/src/uns/uns-tags.ts +1 -1
- package/templates/codegen/src/uns/uns-topics.ts +1 -1
- package/templates/config-files/config-docker.json +26 -26
- package/templates/config-files/config-localhost.json +26 -26
- package/templates/cron/AGENTS.md +23 -23
- package/templates/cron/src/examples/cron-example.ts +71 -69
- package/templates/default/.prettierignore +1 -1
- package/templates/default/.prettierrc +7 -7
- package/templates/default/AGENTS.md +23 -23
- package/templates/default/README.md +41 -41
- package/templates/default/config.json +27 -27
- package/templates/default/eslint.config.js +30 -30
- package/templates/default/gitignore +51 -51
- package/templates/default/package.json +46 -46
- package/templates/default/src/config/project.config.extension.example +23 -23
- package/templates/default/src/config/project.config.extension.ts +6 -6
- package/templates/default/src/examples/data-example.ts +86 -84
- package/templates/default/src/examples/load-test-data.ts +110 -108
- package/templates/default/src/examples/table-example.ts +97 -95
- package/templates/default/src/examples/table-window-load-test.ts +446 -444
- package/templates/default/src/examples/uns-gateway-cli.ts +10 -7
- package/templates/default/src/index.ts +15 -15
- package/templates/default/src/uns/uns-assets.ts +12 -12
- package/templates/default/src/uns/uns-dictionary.generated.ts +758 -758
- package/templates/default/src/uns/uns-measurements.generated.ts +366 -366
- package/templates/default/src/uns/uns-tags.ts +2 -2
- package/templates/default/src/uns/uns-topics.ts +2 -2
- package/templates/default/tsconfig.json +29 -29
- package/templates/python/app/README.md +8 -8
- package/templates/python/examples/README.md +134 -134
- package/templates/python/examples/api_handler.py +28 -28
- package/templates/python/examples/data_publish.py +11 -11
- package/templates/python/examples/data_subscribe.py +8 -8
- package/templates/python/examples/data_transformer.py +17 -17
- package/templates/python/examples/table_transformer.py +15 -15
- package/templates/python/gateway/cli.py +75 -75
- package/templates/python/gateway/client.py +155 -155
- package/templates/python/gateway/manager.py +97 -97
- package/templates/python/gen/__init__.py +1 -0
- package/templates/python/gen/uns_gateway_pb2.py +70 -0
- package/templates/python/gen/uns_gateway_pb2_grpc.py +312 -0
- package/templates/python/gitignore +47 -47
- package/templates/python/proto/uns-gateway.proto +102 -102
- package/templates/python/pyproject.toml +4 -4
- package/templates/python/runtime.json +4 -4
- package/templates/python/scripts/setup.sh +87 -87
- package/templates/temporal/src/examples/temporal-example.ts +37 -35
- package/templates/uns-dictionary/uns-dictionary.json +650 -650
- package/templates/uns-measurements/uns-measurements.json +360 -360
- package/templates/vscode/.vscode/launch.json +164 -164
- package/templates/vscode/.vscode/settings.json +9 -9
- package/templates/vscode/.vscode/tasks.json +27 -27
- package/templates/vscode/uns-kit.code-workspace +13 -13
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023 Aljoša Vister
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Aljoša Vister
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,175 +1,175 @@
|
|
|
1
|
-
# @uns-kit/cli
|
|
2
|
-
|
|
3
|
-
Command line scaffolding tool for the UNS toolkit. It bootstraps a new project with `@uns-kit/core` preconfigured and ready to extend with additional plugins.
|
|
4
|
-
|
|
5
|
-
Note: Apps built with uns-kit are intended to be managed by the **UNS Datahub controller**.
|
|
6
|
-
|
|
7
|
-
## uns-kit in context
|
|
8
|
-
|
|
9
|
-
uns-kit is a batteries-included toolkit for Unified Namespace applications. It standardizes MQTT wiring, auth, config schemas, and scaffolding so you can focus on your domain logic. The toolkit packages are:
|
|
10
|
-
|
|
11
|
-
| Package | Description |
|
|
12
|
-
| --- | --- |
|
|
13
|
-
| [`@uns-kit/core`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-core) | Base runtime utilities (UnsProxyProcess, MQTT helpers, configuration tooling, gRPC gateway support). |
|
|
14
|
-
| [`@uns-kit/api`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-api) | Express plugin that exposes HTTP endpoints, handles JWT/JWKS auth, and republishes API metadata to UNS. |
|
|
15
|
-
| [`@uns-kit/cron`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-cron) | Cron-driven scheduler that emits UNS events on a fixed cadence. |
|
|
16
|
-
| [`@uns-kit/temporal`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-temporal) | Temporal.io integration that wires workflows into UnsProxyProcess. |
|
|
17
|
-
| [`@uns-kit/cli`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-cli) | Command line tool for scaffolding new UNS applications. |
|
|
18
|
-
|
|
19
|
-
## Prerequisites
|
|
20
|
-
|
|
21
|
-
- Node.js 18 or newer (ES2022 runtime features)
|
|
22
|
-
- A package manager such as `pnpm`, `npm`, or `yarn`
|
|
23
|
-
- `git` available on PATH (required for `configure-devops`, used to initialize new projects automatically)
|
|
24
|
-
|
|
25
|
-
## Usage
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
pnpm --package=@uns-kit/cli dlx uns-kit create my-uns-app
|
|
29
|
-
# or with npx
|
|
30
|
-
npx @uns-kit/cli create my-uns-app
|
|
31
|
-
# or after installing globally
|
|
32
|
-
npm install -g @uns-kit/cli
|
|
33
|
-
uns-kit create my-uns-app
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
The command creates a new directory, copies the starter template, and pins `@uns-kit/core` to the currently published version. After the scaffold finishes:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
cd my-uns-app
|
|
40
|
-
pnpm install
|
|
41
|
-
pnpm run dev
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
When `git` is available on your PATH the scaffold also initializes a fresh repository so you can commit immediately.
|
|
45
|
-
|
|
46
|
-
### Create from a service bundle
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
uns-kit create --bundle ./service.bundle.json
|
|
50
|
-
uns-kit create --bundle ./service.bundle.json --dest ./my-dir
|
|
51
|
-
uns-kit create --bundle ./service.bundle.json --dest . --allow-existing
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
Bundle-driven create uses `service.bundle.json` as the source of truth. The CLI:
|
|
55
|
-
|
|
56
|
-
- scaffolds the base TypeScript app from the existing default template
|
|
57
|
-
- copies the original bundle into the project root as `service.bundle.json`
|
|
58
|
-
- generates `SERVICE_SPEC.md` and `AGENTS.md`
|
|
59
|
-
- applies supported bundle features such as `vscode` and `devops`
|
|
60
|
-
|
|
61
|
-
When `--bundle` is used, the default destination is `./<metadata.name>`. The TypeScript CLI only accepts bundles with `scaffold.stack = "ts"` and currently supports `scaffold.template = "default"` for this MVP. If the bundle targets Python instead, use `uns-kit-py create --bundle ...`.
|
|
62
|
-
|
|
63
|
-
## Commands
|
|
64
|
-
|
|
65
|
-
- `uns-kit create <name>` – create a new UNS project in the specified directory.
|
|
66
|
-
- `uns-kit create --bundle <path> [--dest <dir>] [--allow-existing]` – create a new TypeScript UNS project from `service.bundle.json`.
|
|
67
|
-
- `uns-kit configure [path] [features...]` – run multiple configure templates in sequence (`--all`, `--overwrite`).
|
|
68
|
-
- `uns-kit configure-templates [path] [templates...]` – copy any template directory (`--all`, `--overwrite`).
|
|
69
|
-
- `uns-kit configure-devops [path]` – add Azure DevOps tooling (dependencies, script, config) to an existing project.
|
|
70
|
-
- `uns-kit configure-vscode [path]` – copy VS Code launch/workspace files into an existing project.
|
|
71
|
-
- `uns-kit configure-codegen [path]` – scaffold GraphQL code generation and UNS refresh scripts.
|
|
72
|
-
- `uns-kit configure-api [path]` – copy UNS API examples and add `@uns-kit/api`.
|
|
73
|
-
- `uns-kit configure-cron [path]` – copy UNS cron examples and add `@uns-kit/cron`.
|
|
74
|
-
- `uns-kit configure-temporal [path]` – copy UNS Temporal examples and add `@uns-kit/temporal`.
|
|
75
|
-
- `uns-kit configure-python [path]` – copy Python gateway client scaffolding (no npm dependency required).
|
|
76
|
-
- `uns-kit help` – display usage information.
|
|
77
|
-
|
|
78
|
-
### Configure multiple features at once
|
|
79
|
-
|
|
80
|
-
Chain several add-ons without running each subcommand manually:
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
uns-kit configure --all
|
|
84
|
-
uns-kit configure ./apps/gateway devops vscode codegen
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
Mix and match feature names after an optional target directory. Use `--all` to apply every available template in one shot. Add `--overwrite` to refresh files from newer template versions.
|
|
88
|
-
|
|
89
|
-
### Copy arbitrary templates
|
|
90
|
-
|
|
91
|
-
Need a template that is not wired into a configure feature (or added in a newer release)? Use:
|
|
92
|
-
|
|
93
|
-
```bash
|
|
94
|
-
uns-kit configure-templates --all
|
|
95
|
-
uns-kit configure-templates ./apps/gateway uns-dictionary uns-measurements --overwrite
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### Configure Azure DevOps
|
|
99
|
-
|
|
100
|
-
Run inside a scaffolded project to add the Azure DevOps pull-request tooling:
|
|
101
|
-
|
|
102
|
-
```bash
|
|
103
|
-
uns-kit configure-devops
|
|
104
|
-
pnpm install
|
|
105
|
-
pnpm run pull-request
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
The command prompts for your Azure DevOps organization/project, ensures the remote repository exists, and updates `config.json` along with the necessary dev dependencies.
|
|
109
|
-
|
|
110
|
-
### Configure VS Code workspace
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
uns-kit configure-vscode
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
Copies `.vscode/launch.json` plus a baseline workspace file into the project. Existing files are skipped unless you pass `--overwrite`.
|
|
117
|
-
|
|
118
|
-
### Configure GraphQL code generation
|
|
119
|
-
|
|
120
|
-
```bash
|
|
121
|
-
uns-kit configure-codegen
|
|
122
|
-
pnpm install
|
|
123
|
-
pnpm run codegen
|
|
124
|
-
pnpm run refresh-uns
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
Adds `codegen.ts`, seeds `src/uns/` placeholder types, and wires the GraphQL Code Generator / `refresh-uns` script into `package.json`. After installing the new dev dependencies you can regenerate strongly-typed operations (`pnpm run codegen`) and rebuild UNS topics/tags from your environment (`pnpm run refresh-uns`).
|
|
128
|
-
After installing the new dev dependencies you can regenerate strongly-typed operations (`pnpm run codegen`) and rebuild UNS metadata (topics/tags/assets) from your environment (`pnpm run generate-uns-metadata`).
|
|
129
|
-
|
|
130
|
-
### Add UNS API scaffolding
|
|
131
|
-
|
|
132
|
-
```bash
|
|
133
|
-
uns-kit configure-api
|
|
134
|
-
pnpm install
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
Copies API-oriented examples (under `src/examples/`) and adds `@uns-kit/api` to your project dependencies.
|
|
138
|
-
Use `--overwrite` to refresh the examples after updating `uns-kit`.
|
|
139
|
-
|
|
140
|
-
### Add cron-based scaffolding
|
|
141
|
-
|
|
142
|
-
```bash
|
|
143
|
-
uns-kit configure-cron
|
|
144
|
-
pnpm install
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
Adds cron-oriented example stubs and installs `@uns-kit/cron`.
|
|
148
|
-
Use `--overwrite` to refresh the examples after updating `uns-kit`.
|
|
149
|
-
|
|
150
|
-
### Add Temporal scaffolding
|
|
151
|
-
|
|
152
|
-
```bash
|
|
153
|
-
uns-kit configure-temporal
|
|
154
|
-
pnpm install
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
Copies Temporal example placeholders and installs `@uns-kit/temporal`.
|
|
158
|
-
Use `--overwrite` to refresh the examples after updating `uns-kit`.
|
|
159
|
-
|
|
160
|
-
### Add Python gateway scaffolding
|
|
161
|
-
|
|
162
|
-
```bash
|
|
163
|
-
uns-kit configure-python
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
Copies the Python gateway client template (examples, scripts, requirements, proto) into your project so you can iterate on the gRPC gateway from Python alongside your TypeScript project.
|
|
167
|
-
Use `--overwrite` to refresh the examples after updating `uns-kit`.
|
|
168
|
-
|
|
169
|
-
### Extend the Config Schema
|
|
170
|
-
|
|
171
|
-
Edit `src/config/project.config.extension.ts` inside your generated project and run `pnpm run generate-config-schema`. This regenerates `config.schema.json` and `src/config/app-config.ts`, augmenting `@uns-kit/core`'s `AppConfig` so editors and runtime types stay in sync. If completions lag, reload the TypeScript server in your editor.
|
|
172
|
-
|
|
173
|
-
## License
|
|
174
|
-
|
|
175
|
-
MIT © Aljoša Vister
|
|
1
|
+
# @uns-kit/cli
|
|
2
|
+
|
|
3
|
+
Command line scaffolding tool for the UNS toolkit. It bootstraps a new project with `@uns-kit/core` preconfigured and ready to extend with additional plugins.
|
|
4
|
+
|
|
5
|
+
Note: Apps built with uns-kit are intended to be managed by the **UNS Datahub controller**.
|
|
6
|
+
|
|
7
|
+
## uns-kit in context
|
|
8
|
+
|
|
9
|
+
uns-kit is a batteries-included toolkit for Unified Namespace applications. It standardizes MQTT wiring, auth, config schemas, and scaffolding so you can focus on your domain logic. The toolkit packages are:
|
|
10
|
+
|
|
11
|
+
| Package | Description |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
| [`@uns-kit/core`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-core) | Base runtime utilities (UnsProxyProcess, MQTT helpers, configuration tooling, gRPC gateway support). |
|
|
14
|
+
| [`@uns-kit/api`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-api) | Express plugin that exposes HTTP endpoints, handles JWT/JWKS auth, and republishes API metadata to UNS. |
|
|
15
|
+
| [`@uns-kit/cron`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-cron) | Cron-driven scheduler that emits UNS events on a fixed cadence. |
|
|
16
|
+
| [`@uns-kit/temporal`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-temporal) | Temporal.io integration that wires workflows into UnsProxyProcess. |
|
|
17
|
+
| [`@uns-kit/cli`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-cli) | Command line tool for scaffolding new UNS applications. |
|
|
18
|
+
|
|
19
|
+
## Prerequisites
|
|
20
|
+
|
|
21
|
+
- Node.js 18 or newer (ES2022 runtime features)
|
|
22
|
+
- A package manager such as `pnpm`, `npm`, or `yarn`
|
|
23
|
+
- `git` available on PATH (required for `configure-devops`, used to initialize new projects automatically)
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pnpm --package=@uns-kit/cli dlx uns-kit create my-uns-app
|
|
29
|
+
# or with npx
|
|
30
|
+
npx @uns-kit/cli create my-uns-app
|
|
31
|
+
# or after installing globally
|
|
32
|
+
npm install -g @uns-kit/cli
|
|
33
|
+
uns-kit create my-uns-app
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The command creates a new directory, copies the starter template, and pins `@uns-kit/core` to the currently published version. After the scaffold finishes:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
cd my-uns-app
|
|
40
|
+
pnpm install
|
|
41
|
+
pnpm run dev
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
When `git` is available on your PATH the scaffold also initializes a fresh repository so you can commit immediately.
|
|
45
|
+
|
|
46
|
+
### Create from a service bundle
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
uns-kit create --bundle ./service.bundle.json
|
|
50
|
+
uns-kit create --bundle ./service.bundle.json --dest ./my-dir
|
|
51
|
+
uns-kit create --bundle ./service.bundle.json --dest . --allow-existing
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Bundle-driven create uses `service.bundle.json` as the source of truth. The CLI:
|
|
55
|
+
|
|
56
|
+
- scaffolds the base TypeScript app from the existing default template
|
|
57
|
+
- copies the original bundle into the project root as `service.bundle.json`
|
|
58
|
+
- generates `SERVICE_SPEC.md` and `AGENTS.md`
|
|
59
|
+
- applies supported bundle features such as `vscode` and `devops`
|
|
60
|
+
|
|
61
|
+
When `--bundle` is used, the default destination is `./<metadata.name>`. The TypeScript CLI only accepts bundles with `scaffold.stack = "ts"` and currently supports `scaffold.template = "default"` for this MVP. If the bundle targets Python instead, use `uns-kit-py create --bundle ...`.
|
|
62
|
+
|
|
63
|
+
## Commands
|
|
64
|
+
|
|
65
|
+
- `uns-kit create <name>` – create a new UNS project in the specified directory.
|
|
66
|
+
- `uns-kit create --bundle <path> [--dest <dir>] [--allow-existing]` – create a new TypeScript UNS project from `service.bundle.json`.
|
|
67
|
+
- `uns-kit configure [path] [features...]` – run multiple configure templates in sequence (`--all`, `--overwrite`).
|
|
68
|
+
- `uns-kit configure-templates [path] [templates...]` – copy any template directory (`--all`, `--overwrite`).
|
|
69
|
+
- `uns-kit configure-devops [path]` – add Azure DevOps tooling (dependencies, script, config) to an existing project.
|
|
70
|
+
- `uns-kit configure-vscode [path]` – copy VS Code launch/workspace files into an existing project.
|
|
71
|
+
- `uns-kit configure-codegen [path]` – scaffold GraphQL code generation and UNS refresh scripts.
|
|
72
|
+
- `uns-kit configure-api [path]` – copy UNS API examples and add `@uns-kit/api`.
|
|
73
|
+
- `uns-kit configure-cron [path]` – copy UNS cron examples and add `@uns-kit/cron`.
|
|
74
|
+
- `uns-kit configure-temporal [path]` – copy UNS Temporal examples and add `@uns-kit/temporal`.
|
|
75
|
+
- `uns-kit configure-python [path]` – copy Python gateway client scaffolding (no npm dependency required).
|
|
76
|
+
- `uns-kit help` – display usage information.
|
|
77
|
+
|
|
78
|
+
### Configure multiple features at once
|
|
79
|
+
|
|
80
|
+
Chain several add-ons without running each subcommand manually:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
uns-kit configure --all
|
|
84
|
+
uns-kit configure ./apps/gateway devops vscode codegen
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Mix and match feature names after an optional target directory. Use `--all` to apply every available template in one shot. Add `--overwrite` to refresh files from newer template versions.
|
|
88
|
+
|
|
89
|
+
### Copy arbitrary templates
|
|
90
|
+
|
|
91
|
+
Need a template that is not wired into a configure feature (or added in a newer release)? Use:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
uns-kit configure-templates --all
|
|
95
|
+
uns-kit configure-templates ./apps/gateway uns-dictionary uns-measurements --overwrite
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Configure Azure DevOps
|
|
99
|
+
|
|
100
|
+
Run inside a scaffolded project to add the Azure DevOps pull-request tooling:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
uns-kit configure-devops
|
|
104
|
+
pnpm install
|
|
105
|
+
pnpm run pull-request
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The command prompts for your Azure DevOps organization/project, ensures the remote repository exists, and updates `config.json` along with the necessary dev dependencies.
|
|
109
|
+
|
|
110
|
+
### Configure VS Code workspace
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
uns-kit configure-vscode
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Copies `.vscode/launch.json` plus a baseline workspace file into the project. Existing files are skipped unless you pass `--overwrite`.
|
|
117
|
+
|
|
118
|
+
### Configure GraphQL code generation
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
uns-kit configure-codegen
|
|
122
|
+
pnpm install
|
|
123
|
+
pnpm run codegen
|
|
124
|
+
pnpm run refresh-uns
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Adds `codegen.ts`, seeds `src/uns/` placeholder types, and wires the GraphQL Code Generator / `refresh-uns` script into `package.json`. After installing the new dev dependencies you can regenerate strongly-typed operations (`pnpm run codegen`) and rebuild UNS topics/tags from your environment (`pnpm run refresh-uns`).
|
|
128
|
+
After installing the new dev dependencies you can regenerate strongly-typed operations (`pnpm run codegen`) and rebuild UNS metadata (topics/tags/assets) from your environment (`pnpm run generate-uns-metadata`).
|
|
129
|
+
|
|
130
|
+
### Add UNS API scaffolding
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
uns-kit configure-api
|
|
134
|
+
pnpm install
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Copies API-oriented examples (under `src/examples/`) and adds `@uns-kit/api` to your project dependencies.
|
|
138
|
+
Use `--overwrite` to refresh the examples after updating `uns-kit`.
|
|
139
|
+
|
|
140
|
+
### Add cron-based scaffolding
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
uns-kit configure-cron
|
|
144
|
+
pnpm install
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Adds cron-oriented example stubs and installs `@uns-kit/cron`.
|
|
148
|
+
Use `--overwrite` to refresh the examples after updating `uns-kit`.
|
|
149
|
+
|
|
150
|
+
### Add Temporal scaffolding
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
uns-kit configure-temporal
|
|
154
|
+
pnpm install
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Copies Temporal example placeholders and installs `@uns-kit/temporal`.
|
|
158
|
+
Use `--overwrite` to refresh the examples after updating `uns-kit`.
|
|
159
|
+
|
|
160
|
+
### Add Python gateway scaffolding
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
uns-kit configure-python
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Copies the Python gateway client template (examples, scripts, requirements, proto) into your project so you can iterate on the gRPC gateway from Python alongside your TypeScript project.
|
|
167
|
+
Use `--overwrite` to refresh the examples after updating `uns-kit`.
|
|
168
|
+
|
|
169
|
+
### Extend the Config Schema
|
|
170
|
+
|
|
171
|
+
Edit `src/config/project.config.extension.ts` inside your generated project and run `pnpm run generate-config-schema`. This regenerates `config.schema.json` and `src/config/app-config.ts`, augmenting `@uns-kit/core`'s `AppConfig` so editors and runtime types stay in sync. If completions lag, reload the TypeScript server in your editor.
|
|
172
|
+
|
|
173
|
+
## License
|
|
174
|
+
|
|
175
|
+
MIT © Aljoša Vister
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uns-kit/cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.22",
|
|
4
4
|
"description": "Command line scaffolding tool for UNS applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"azure-devops-node-api": "^15.1.1",
|
|
29
|
-
"@uns-kit/core": "2.0.
|
|
29
|
+
"@uns-kit/core": "2.0.22"
|
|
30
30
|
},
|
|
31
31
|
"unsKitPackages": {
|
|
32
|
-
"@uns-kit/core": "2.0.
|
|
33
|
-
"@uns-kit/api": "2.0.
|
|
34
|
-
"@uns-kit/cron": "2.0.
|
|
35
|
-
"@uns-kit/temporal": "2.0.
|
|
32
|
+
"@uns-kit/core": "2.0.22",
|
|
33
|
+
"@uns-kit/api": "2.0.22",
|
|
34
|
+
"@uns-kit/cron": "2.0.22",
|
|
35
|
+
"@uns-kit/temporal": "2.0.22"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "tsc -p tsconfig.build.json",
|
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Change this file according to your specifications and rename it to index.ts
|
|
3
|
-
*/
|
|
4
|
-
import { UnsProxyProcess, ConfigFile } from "@uns-kit/core";
|
|
5
|
-
import { IApiProxyOptions } from "@uns-kit/core";
|
|
6
|
-
import type { UnsEvents } from "@uns-kit/core";
|
|
7
|
-
import "@uns-kit/api";
|
|
8
|
-
import { type UnsProxyProcessWithApi } from "@uns-kit/api";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Load the configuration from a file.
|
|
12
|
-
* On the server, this file is provided by the `uns-datahub-controller`.
|
|
13
|
-
* In the development environment, you are responsible for creating and maintaining this file and its contents.
|
|
14
|
-
*/
|
|
15
|
-
const config = await ConfigFile.loadConfig();
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Connect to the API proxy process
|
|
19
|
-
*/
|
|
20
|
-
const unsProxyProcess = new UnsProxyProcess(config.infra.host!, {processName: config.uns.processName}) as UnsProxyProcessWithApi;
|
|
21
|
-
const apiOptions: IApiProxyOptions = config.uns?.jwksWellKnownUrl
|
|
22
|
-
? {
|
|
23
|
-
jwks: {
|
|
24
|
-
wellKnownJwksUrl: config.uns.jwksWellKnownUrl,
|
|
25
|
-
...(config.uns.kidWellKnownUrl !== undefined
|
|
26
|
-
? { activeKidUrl: config.uns.kidWellKnownUrl }
|
|
27
|
-
: {}),
|
|
28
|
-
},
|
|
29
|
-
}
|
|
30
|
-
: {
|
|
31
|
-
jwtSecret: "CHANGEME",
|
|
32
|
-
};
|
|
33
|
-
const apiInput = await unsProxyProcess.createApiProxy("templateUnsApiInput", apiOptions);
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Register an API endpoint and event handler
|
|
37
|
-
*/
|
|
38
|
-
apiInput.get(
|
|
39
|
-
"enterprise/site/area/line/",
|
|
40
|
-
"line-3-furnace",
|
|
41
|
-
"energy-resource",
|
|
42
|
-
"main-bus",
|
|
43
|
-
"summary-1",
|
|
44
|
-
{
|
|
45
|
-
tags: ["Tag1"],
|
|
46
|
-
apiDescription: "Test API endpoint 1",
|
|
47
|
-
queryParams: [
|
|
48
|
-
{ name: "filter", type: "string", required: true, description: "Filter za podatke" },
|
|
49
|
-
{ name: "limit", type: "number", required: false, description: "Koliko podatkov želiš" },
|
|
50
|
-
],
|
|
51
|
-
}
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
apiInput.get(
|
|
55
|
-
"enterprise/site/area/line/",
|
|
56
|
-
"line-3-compressor",
|
|
57
|
-
"utility-resource",
|
|
58
|
-
"air-loop-1",
|
|
59
|
-
"summary-2",
|
|
60
|
-
{
|
|
61
|
-
tags: ["Tag2"],
|
|
62
|
-
apiDescription: "Test API endpoint 2",
|
|
63
|
-
queryParams: [
|
|
64
|
-
{ name: "filter", type: "string", required: true, description: "Filter za podatke" },
|
|
65
|
-
{ name: "limit", type: "number", required: false, description: "Koliko podatkov želiš" },
|
|
66
|
-
],
|
|
67
|
-
}
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Optional: register a catch-all API mapping for a topic prefix.
|
|
72
|
-
* This does not create per-attribute API nodes; the controller treats it as a fallback handler.
|
|
73
|
-
* You can provide a separate Swagger doc for catch-all so it stays distinct from normal APIs (optional).
|
|
74
|
-
*/
|
|
75
|
-
await apiInput.registerCatchAll("sij/acroni/#", {
|
|
76
|
-
apiDescription: "Catch-all handler for sij/acroni/*",
|
|
77
|
-
tags: ["CatchAll"],
|
|
78
|
-
queryParams: [
|
|
79
|
-
{ name: "filter", type: "string", required: false, description: "Filter parameter" },
|
|
80
|
-
]
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
apiInput.event.on("apiGetEvent", (event: UnsEvents["apiGetEvent"]) => {
|
|
84
|
-
try {
|
|
85
|
-
const appContext = event.req.appContext;
|
|
86
|
-
// Add SQL query or any other code here
|
|
87
|
-
event.res.send("OK");
|
|
88
|
-
} catch (error) {
|
|
89
|
-
event.res.status(400).send("Error");
|
|
90
|
-
}
|
|
91
|
-
});
|
|
1
|
+
/**
|
|
2
|
+
* Change this file according to your specifications and rename it to index.ts
|
|
3
|
+
*/
|
|
4
|
+
import { UnsProxyProcess, ConfigFile } from "@uns-kit/core";
|
|
5
|
+
import { IApiProxyOptions } from "@uns-kit/core";
|
|
6
|
+
import type { UnsEvents } from "@uns-kit/core";
|
|
7
|
+
import "@uns-kit/api";
|
|
8
|
+
import { type UnsProxyProcessWithApi } from "@uns-kit/api";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Load the configuration from a file.
|
|
12
|
+
* On the server, this file is provided by the `uns-datahub-controller`.
|
|
13
|
+
* In the development environment, you are responsible for creating and maintaining this file and its contents.
|
|
14
|
+
*/
|
|
15
|
+
const config = await ConfigFile.loadConfig();
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Connect to the API proxy process
|
|
19
|
+
*/
|
|
20
|
+
const unsProxyProcess = new UnsProxyProcess(config.infra.host!, {processName: config.uns.processName}) as UnsProxyProcessWithApi;
|
|
21
|
+
const apiOptions: IApiProxyOptions = config.uns?.jwksWellKnownUrl
|
|
22
|
+
? {
|
|
23
|
+
jwks: {
|
|
24
|
+
wellKnownJwksUrl: config.uns.jwksWellKnownUrl,
|
|
25
|
+
...(config.uns.kidWellKnownUrl !== undefined
|
|
26
|
+
? { activeKidUrl: config.uns.kidWellKnownUrl }
|
|
27
|
+
: {}),
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
: {
|
|
31
|
+
jwtSecret: "CHANGEME",
|
|
32
|
+
};
|
|
33
|
+
const apiInput = await unsProxyProcess.createApiProxy("templateUnsApiInput", apiOptions);
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Register an API endpoint and event handler
|
|
37
|
+
*/
|
|
38
|
+
apiInput.get(
|
|
39
|
+
"enterprise/site/area/line/",
|
|
40
|
+
"line-3-furnace",
|
|
41
|
+
"energy-resource",
|
|
42
|
+
"main-bus",
|
|
43
|
+
"summary-1",
|
|
44
|
+
{
|
|
45
|
+
tags: ["Tag1"],
|
|
46
|
+
apiDescription: "Test API endpoint 1",
|
|
47
|
+
queryParams: [
|
|
48
|
+
{ name: "filter", type: "string", required: true, description: "Filter za podatke" },
|
|
49
|
+
{ name: "limit", type: "number", required: false, description: "Koliko podatkov želiš" },
|
|
50
|
+
],
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
apiInput.get(
|
|
55
|
+
"enterprise/site/area/line/",
|
|
56
|
+
"line-3-compressor",
|
|
57
|
+
"utility-resource",
|
|
58
|
+
"air-loop-1",
|
|
59
|
+
"summary-2",
|
|
60
|
+
{
|
|
61
|
+
tags: ["Tag2"],
|
|
62
|
+
apiDescription: "Test API endpoint 2",
|
|
63
|
+
queryParams: [
|
|
64
|
+
{ name: "filter", type: "string", required: true, description: "Filter za podatke" },
|
|
65
|
+
{ name: "limit", type: "number", required: false, description: "Koliko podatkov želiš" },
|
|
66
|
+
],
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Optional: register a catch-all API mapping for a topic prefix.
|
|
72
|
+
* This does not create per-attribute API nodes; the controller treats it as a fallback handler.
|
|
73
|
+
* You can provide a separate Swagger doc for catch-all so it stays distinct from normal APIs (optional).
|
|
74
|
+
*/
|
|
75
|
+
await apiInput.registerCatchAll("sij/acroni/#", {
|
|
76
|
+
apiDescription: "Catch-all handler for sij/acroni/*",
|
|
77
|
+
tags: ["CatchAll"],
|
|
78
|
+
queryParams: [
|
|
79
|
+
{ name: "filter", type: "string", required: false, description: "Filter parameter" },
|
|
80
|
+
]
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
apiInput.event.on("apiGetEvent", (event: UnsEvents["apiGetEvent"]) => {
|
|
84
|
+
try {
|
|
85
|
+
const appContext = event.req.appContext;
|
|
86
|
+
// Add SQL query or any other code here
|
|
87
|
+
event.res.send("OK");
|
|
88
|
+
} catch (error) {
|
|
89
|
+
event.res.status(400).send("Error");
|
|
90
|
+
}
|
|
91
|
+
});
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
variables:
|
|
2
|
-
privatePool: 'Azure private pool'
|
|
3
|
-
|
|
4
|
-
trigger:
|
|
5
|
-
- master
|
|
6
|
-
|
|
7
|
-
stages:
|
|
8
|
-
- stage: version_tag
|
|
9
|
-
displayName: Add Version Tag
|
|
10
|
-
pool: $(privatePool)
|
|
11
|
-
jobs:
|
|
12
|
-
- job: add_tags
|
|
13
|
-
steps:
|
|
14
|
-
- checkout: self
|
|
15
|
-
persistCredentials: true
|
|
16
|
-
clean: true
|
|
17
|
-
- script: |
|
|
18
|
-
tag=$(node -pe "require('./package.json').version")
|
|
19
|
-
git tag $tag
|
|
20
|
-
git push origin $tag
|
|
21
|
-
displayName: "Add version tag from package.json"
|
|
1
|
+
variables:
|
|
2
|
+
privatePool: 'Azure private pool'
|
|
3
|
+
|
|
4
|
+
trigger:
|
|
5
|
+
- master
|
|
6
|
+
|
|
7
|
+
stages:
|
|
8
|
+
- stage: version_tag
|
|
9
|
+
displayName: Add Version Tag
|
|
10
|
+
pool: $(privatePool)
|
|
11
|
+
jobs:
|
|
12
|
+
- job: add_tags
|
|
13
|
+
steps:
|
|
14
|
+
- checkout: self
|
|
15
|
+
persistCredentials: true
|
|
16
|
+
clean: true
|
|
17
|
+
- script: |
|
|
18
|
+
tag=$(node -pe "require('./package.json').version")
|
|
19
|
+
git tag $tag
|
|
20
|
+
git push origin $tag
|
|
21
|
+
displayName: "Add version tag from package.json"
|