@uns-kit/cli 0.0.36 → 0.0.37
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 +128 -128
- package/dist/index.js +11 -5
- package/package.json +8 -2
- package/templates/api/src/examples/api-example.ts +62 -62
- 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/src/examples/cron-example.ts +46 -46
- package/templates/default/README.md +32 -30
- package/templates/default/config.json +27 -27
- package/templates/default/gitignore +51 -51
- package/templates/default/package.json +38 -19
- 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 +68 -68
- package/templates/default/src/examples/load-test-data.ts +108 -108
- package/templates/default/src/examples/table-example.ts +66 -66
- package/templates/default/src/examples/uns-gateway-cli.ts +7 -7
- package/templates/default/src/index.ts +15 -15
- 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 -16
- 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/proto/uns-gateway.proto +102 -102
- package/templates/python/pyproject.toml +4 -4
- package/templates/python/scripts/setup.sh +87 -87
- package/templates/temporal/src/examples/temporal-example.ts +35 -35
- package/templates/vscode/.vscode/launch.json +164 -164
- package/templates/vscode/.vscode/settings.json +9 -9
- package/templates/vscode/uns-kit.code-workspace +13 -13
- package/templates/python/gen/__init__.py +0 -1
- package/templates/python/gen/uns_gateway_pb2.py +0 -70
- package/templates/python/gen/uns_gateway_pb2_grpc.py +0 -312
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,128 +1,128 @@
|
|
|
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
|
-
## Prerequisites
|
|
6
|
-
|
|
7
|
-
- Node.js 18 or newer (ES2022 runtime features)
|
|
8
|
-
- A package manager such as `pnpm`, `npm`, or `yarn`
|
|
9
|
-
- `git` available on PATH (required for `configure-devops`, used to initialize new projects automatically)
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
pnpm --package=@uns-kit/cli dlx uns-kit create my-uns-app
|
|
15
|
-
# or with npx
|
|
16
|
-
npx @uns-kit/cli create my-uns-app
|
|
17
|
-
# or after installing globally
|
|
18
|
-
npm install -g @uns-kit/cli
|
|
19
|
-
uns-kit create my-uns-app
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
The command creates a new directory, copies the starter template, and pins `@uns-kit/core` to the currently published version. After the scaffold finishes:
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
cd my-uns-app
|
|
26
|
-
pnpm install
|
|
27
|
-
pnpm run dev
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
When `git` is available on your PATH the scaffold also initializes a fresh repository so you can commit immediately.
|
|
31
|
-
|
|
32
|
-
## Commands
|
|
33
|
-
|
|
34
|
-
- `uns-kit create <name>` – create a new UNS project in the specified directory.
|
|
35
|
-
- `uns-kit configure [path] [features...]` – run multiple configure templates in sequence (`--all` applies every template).
|
|
36
|
-
- `uns-kit configure-devops [path]` – add Azure DevOps tooling (dependencies, script, config) to an existing project.
|
|
37
|
-
- `uns-kit configure-vscode [path]` – copy VS Code launch/workspace files into an existing project.
|
|
38
|
-
- `uns-kit configure-codegen [path]` – scaffold GraphQL code generation and UNS refresh scripts.
|
|
39
|
-
- `uns-kit configure-api [path]` – copy UNS API examples and add `@uns-kit/api`.
|
|
40
|
-
- `uns-kit configure-cron [path]` – copy UNS cron examples and add `@uns-kit/cron`.
|
|
41
|
-
- `uns-kit configure-temporal [path]` – copy UNS Temporal examples and add `@uns-kit/temporal`.
|
|
42
|
-
- `uns-kit configure-python [path]` – copy Python gateway client scaffolding (no npm dependency required).
|
|
43
|
-
- `uns-kit help` – display usage information.
|
|
44
|
-
|
|
45
|
-
### Configure multiple features at once
|
|
46
|
-
|
|
47
|
-
Chain several add-ons without running each subcommand manually:
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
uns-kit configure --all
|
|
51
|
-
uns-kit configure ./apps/gateway devops vscode codegen
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
Mix and match feature names after an optional target directory. Use `--all` to apply every available template in one shot.
|
|
55
|
-
|
|
56
|
-
### Configure Azure DevOps
|
|
57
|
-
|
|
58
|
-
Run inside a scaffolded project to add the Azure DevOps pull-request tooling:
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
uns-kit configure-devops
|
|
62
|
-
pnpm install
|
|
63
|
-
pnpm run pull-request
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
The command prompts for your Azure DevOps organization/project, ensures the remote repository exists, and updates `config.json` along with the necessary dev dependencies.
|
|
67
|
-
|
|
68
|
-
### Configure VS Code workspace
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
uns-kit configure-vscode
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
Copies `.vscode/launch.json` plus a baseline workspace file into the project. Existing files are never overwritten, making it safe to re-run after hand edits.
|
|
75
|
-
|
|
76
|
-
### Configure GraphQL code generation
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
uns-kit configure-codegen
|
|
80
|
-
pnpm install
|
|
81
|
-
pnpm run codegen
|
|
82
|
-
pnpm run refresh-uns
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
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`).
|
|
86
|
-
|
|
87
|
-
### Add UNS API scaffolding
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
uns-kit configure-api
|
|
91
|
-
pnpm install
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
Copies API-oriented examples (under `src/examples/`) and adds `@uns-kit/api` to your project dependencies.
|
|
95
|
-
|
|
96
|
-
### Add cron-based scaffolding
|
|
97
|
-
|
|
98
|
-
```bash
|
|
99
|
-
uns-kit configure-cron
|
|
100
|
-
pnpm install
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
Adds cron-oriented example stubs and installs `@uns-kit/cron`.
|
|
104
|
-
|
|
105
|
-
### Add Temporal scaffolding
|
|
106
|
-
|
|
107
|
-
```bash
|
|
108
|
-
uns-kit configure-temporal
|
|
109
|
-
pnpm install
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
Copies Temporal example placeholders and installs `@uns-kit/temporal`.
|
|
113
|
-
|
|
114
|
-
### Add Python gateway scaffolding
|
|
115
|
-
|
|
116
|
-
```bash
|
|
117
|
-
uns-kit configure-python
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
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.
|
|
121
|
-
|
|
122
|
-
### Extend the Config Schema
|
|
123
|
-
|
|
124
|
-
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.
|
|
125
|
-
|
|
126
|
-
## License
|
|
127
|
-
|
|
128
|
-
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
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- Node.js 18 or newer (ES2022 runtime features)
|
|
8
|
+
- A package manager such as `pnpm`, `npm`, or `yarn`
|
|
9
|
+
- `git` available on PATH (required for `configure-devops`, used to initialize new projects automatically)
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm --package=@uns-kit/cli dlx uns-kit create my-uns-app
|
|
15
|
+
# or with npx
|
|
16
|
+
npx @uns-kit/cli create my-uns-app
|
|
17
|
+
# or after installing globally
|
|
18
|
+
npm install -g @uns-kit/cli
|
|
19
|
+
uns-kit create my-uns-app
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The command creates a new directory, copies the starter template, and pins `@uns-kit/core` to the currently published version. After the scaffold finishes:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
cd my-uns-app
|
|
26
|
+
pnpm install
|
|
27
|
+
pnpm run dev
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
When `git` is available on your PATH the scaffold also initializes a fresh repository so you can commit immediately.
|
|
31
|
+
|
|
32
|
+
## Commands
|
|
33
|
+
|
|
34
|
+
- `uns-kit create <name>` – create a new UNS project in the specified directory.
|
|
35
|
+
- `uns-kit configure [path] [features...]` – run multiple configure templates in sequence (`--all` applies every template).
|
|
36
|
+
- `uns-kit configure-devops [path]` – add Azure DevOps tooling (dependencies, script, config) to an existing project.
|
|
37
|
+
- `uns-kit configure-vscode [path]` – copy VS Code launch/workspace files into an existing project.
|
|
38
|
+
- `uns-kit configure-codegen [path]` – scaffold GraphQL code generation and UNS refresh scripts.
|
|
39
|
+
- `uns-kit configure-api [path]` – copy UNS API examples and add `@uns-kit/api`.
|
|
40
|
+
- `uns-kit configure-cron [path]` – copy UNS cron examples and add `@uns-kit/cron`.
|
|
41
|
+
- `uns-kit configure-temporal [path]` – copy UNS Temporal examples and add `@uns-kit/temporal`.
|
|
42
|
+
- `uns-kit configure-python [path]` – copy Python gateway client scaffolding (no npm dependency required).
|
|
43
|
+
- `uns-kit help` – display usage information.
|
|
44
|
+
|
|
45
|
+
### Configure multiple features at once
|
|
46
|
+
|
|
47
|
+
Chain several add-ons without running each subcommand manually:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
uns-kit configure --all
|
|
51
|
+
uns-kit configure ./apps/gateway devops vscode codegen
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Mix and match feature names after an optional target directory. Use `--all` to apply every available template in one shot.
|
|
55
|
+
|
|
56
|
+
### Configure Azure DevOps
|
|
57
|
+
|
|
58
|
+
Run inside a scaffolded project to add the Azure DevOps pull-request tooling:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
uns-kit configure-devops
|
|
62
|
+
pnpm install
|
|
63
|
+
pnpm run pull-request
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The command prompts for your Azure DevOps organization/project, ensures the remote repository exists, and updates `config.json` along with the necessary dev dependencies.
|
|
67
|
+
|
|
68
|
+
### Configure VS Code workspace
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
uns-kit configure-vscode
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Copies `.vscode/launch.json` plus a baseline workspace file into the project. Existing files are never overwritten, making it safe to re-run after hand edits.
|
|
75
|
+
|
|
76
|
+
### Configure GraphQL code generation
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
uns-kit configure-codegen
|
|
80
|
+
pnpm install
|
|
81
|
+
pnpm run codegen
|
|
82
|
+
pnpm run refresh-uns
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
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`).
|
|
86
|
+
|
|
87
|
+
### Add UNS API scaffolding
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
uns-kit configure-api
|
|
91
|
+
pnpm install
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Copies API-oriented examples (under `src/examples/`) and adds `@uns-kit/api` to your project dependencies.
|
|
95
|
+
|
|
96
|
+
### Add cron-based scaffolding
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
uns-kit configure-cron
|
|
100
|
+
pnpm install
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Adds cron-oriented example stubs and installs `@uns-kit/cron`.
|
|
104
|
+
|
|
105
|
+
### Add Temporal scaffolding
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
uns-kit configure-temporal
|
|
109
|
+
pnpm install
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Copies Temporal example placeholders and installs `@uns-kit/temporal`.
|
|
113
|
+
|
|
114
|
+
### Add Python gateway scaffolding
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
uns-kit configure-python
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
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.
|
|
121
|
+
|
|
122
|
+
### Extend the Config Schema
|
|
123
|
+
|
|
124
|
+
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.
|
|
125
|
+
|
|
126
|
+
## License
|
|
127
|
+
|
|
128
|
+
MIT © Aljoša Vister
|
package/dist/index.js
CHANGED
|
@@ -1201,7 +1201,7 @@ function resolveUnsPackageSpecifier(packageName, relativeLocalPath) {
|
|
|
1201
1201
|
return `workspace:^${version}`;
|
|
1202
1202
|
}
|
|
1203
1203
|
const version = resolveUnsPackageVersion(packageName, relativeLocalPath);
|
|
1204
|
-
return `^${version}`;
|
|
1204
|
+
return version === "latest" ? "latest" : `^${version}`;
|
|
1205
1205
|
}
|
|
1206
1206
|
function resolveUnsPackageVersion(packageName, relativeLocalPath) {
|
|
1207
1207
|
const attempt = (factory) => {
|
|
@@ -1229,17 +1229,23 @@ function resolveUnsPackageVersion(packageName, relativeLocalPath) {
|
|
|
1229
1229
|
}
|
|
1230
1230
|
const cliDependencyVersion = attempt(() => {
|
|
1231
1231
|
const cliPkg = require("../package.json");
|
|
1232
|
-
const
|
|
1233
|
-
if (typeof
|
|
1232
|
+
const pinned = cliPkg.unsKitPackages?.[packageName];
|
|
1233
|
+
if (typeof pinned === "string" && pinned.trim()) {
|
|
1234
|
+
return pinned.trim();
|
|
1235
|
+
}
|
|
1236
|
+
const ranges = [cliPkg.dependencies?.[packageName], cliPkg.devDependencies?.[packageName]].filter((range) => typeof range === "string");
|
|
1237
|
+
for (const range of ranges) {
|
|
1234
1238
|
const match = range.match(/\d+\.\d+\.\d+/);
|
|
1235
|
-
|
|
1239
|
+
if (match?.[0]) {
|
|
1240
|
+
return match[0];
|
|
1241
|
+
}
|
|
1236
1242
|
}
|
|
1237
1243
|
return undefined;
|
|
1238
1244
|
});
|
|
1239
1245
|
if (cliDependencyVersion) {
|
|
1240
1246
|
return cliDependencyVersion;
|
|
1241
1247
|
}
|
|
1242
|
-
return "
|
|
1248
|
+
return "latest";
|
|
1243
1249
|
}
|
|
1244
1250
|
function resolveCliVersion() {
|
|
1245
1251
|
const attempt = (factory) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uns-kit/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.37",
|
|
4
4
|
"description": "Command line scaffolding tool for UNS applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,7 +26,13 @@
|
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"azure-devops-node-api": "^15.1.1",
|
|
29
|
-
"@uns-kit/core": "0.0.
|
|
29
|
+
"@uns-kit/core": "0.0.37"
|
|
30
|
+
},
|
|
31
|
+
"unsKitPackages": {
|
|
32
|
+
"@uns-kit/core": "0.0.36",
|
|
33
|
+
"@uns-kit/api": "0.0.19",
|
|
34
|
+
"@uns-kit/cron": "0.0.18",
|
|
35
|
+
"@uns-kit/temporal": "0.0.18"
|
|
30
36
|
},
|
|
31
37
|
"scripts": {
|
|
32
38
|
"build": "tsc -p tsconfig.build.json",
|
|
@@ -1,62 +1,62 @@
|
|
|
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.js";
|
|
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
|
-
activeKidUrl: config.uns.kidWellKnownUrl,
|
|
26
|
-
},
|
|
27
|
-
}
|
|
28
|
-
: {
|
|
29
|
-
jwtSecret: "CHANGEME",
|
|
30
|
-
};
|
|
31
|
-
const apiInput = await unsProxyProcess.createApiProxy("templateUnsApiInput", apiOptions);
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Register an API endpoint and event handler
|
|
35
|
-
*/
|
|
36
|
-
apiInput.get("example/", "summary-1",{
|
|
37
|
-
tags: ["Tag1"],
|
|
38
|
-
apiDescription: "Test API endpoint 1",
|
|
39
|
-
queryParams: [
|
|
40
|
-
{ name: "filter", type: "string", required: true, description: "Filter za podatke" },
|
|
41
|
-
{ name: "limit", type: "number", required: false, description: "Koliko podatkov želiš" },
|
|
42
|
-
]
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
apiInput.get("example/", "summary-2",{
|
|
46
|
-
tags: ["Tag2"],
|
|
47
|
-
apiDescription: "Test API endpoint 2",
|
|
48
|
-
queryParams: [
|
|
49
|
-
{ name: "filter", type: "string", required: true, description: "Filter za podatke" },
|
|
50
|
-
{ name: "limit", type: "number", required: false, description: "Koliko podatkov želiš" },
|
|
51
|
-
]
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
apiInput.event.on("apiGetEvent", (event: UnsEvents["apiGetEvent"]) => {
|
|
55
|
-
try {
|
|
56
|
-
const appContext = event.req.appContext;
|
|
57
|
-
// Add SQL query or any other code here
|
|
58
|
-
event.res.send("OK");
|
|
59
|
-
} catch (error) {
|
|
60
|
-
event.res.status(400).send("Error");
|
|
61
|
-
}
|
|
62
|
-
});
|
|
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.js";
|
|
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
|
+
activeKidUrl: config.uns.kidWellKnownUrl,
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
: {
|
|
29
|
+
jwtSecret: "CHANGEME",
|
|
30
|
+
};
|
|
31
|
+
const apiInput = await unsProxyProcess.createApiProxy("templateUnsApiInput", apiOptions);
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Register an API endpoint and event handler
|
|
35
|
+
*/
|
|
36
|
+
apiInput.get("example/", "summary-1",{
|
|
37
|
+
tags: ["Tag1"],
|
|
38
|
+
apiDescription: "Test API endpoint 1",
|
|
39
|
+
queryParams: [
|
|
40
|
+
{ name: "filter", type: "string", required: true, description: "Filter za podatke" },
|
|
41
|
+
{ name: "limit", type: "number", required: false, description: "Koliko podatkov želiš" },
|
|
42
|
+
]
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
apiInput.get("example/", "summary-2",{
|
|
46
|
+
tags: ["Tag2"],
|
|
47
|
+
apiDescription: "Test API endpoint 2",
|
|
48
|
+
queryParams: [
|
|
49
|
+
{ name: "filter", type: "string", required: true, description: "Filter za podatke" },
|
|
50
|
+
{ name: "limit", type: "number", required: false, description: "Koliko podatkov želiš" },
|
|
51
|
+
]
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
apiInput.event.on("apiGetEvent", (event: UnsEvents["apiGetEvent"]) => {
|
|
55
|
+
try {
|
|
56
|
+
const appContext = event.req.appContext;
|
|
57
|
+
// Add SQL query or any other code here
|
|
58
|
+
event.res.send("OK");
|
|
59
|
+
} catch (error) {
|
|
60
|
+
event.res.status(400).send("Error");
|
|
61
|
+
}
|
|
62
|
+
});
|
|
@@ -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"
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
2
|
-
import { ConfigFile } from '@uns-kit/core
|
|
3
|
-
|
|
4
|
-
const appConfig = await ConfigFile.loadConfig();
|
|
5
|
-
|
|
6
|
-
const config: CodegenConfig = {
|
|
7
|
-
schema: appConfig.uns.graphql,
|
|
8
|
-
generates: {
|
|
9
|
-
'src/graphql/schema.ts': {
|
|
10
|
-
plugins: ['typescript', 'typescript-operations', 'typescript-resolvers'],
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default config;
|
|
1
|
+
import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
2
|
+
import { ConfigFile } from '@uns-kit/core';
|
|
3
|
+
|
|
4
|
+
const appConfig = await ConfigFile.loadConfig();
|
|
5
|
+
|
|
6
|
+
const config: CodegenConfig = {
|
|
7
|
+
schema: appConfig.uns.graphql,
|
|
8
|
+
generates: {
|
|
9
|
+
'src/graphql/schema.ts': {
|
|
10
|
+
plugins: ['typescript', 'typescript-operations', 'typescript-resolvers'],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default config;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type UnsTags = string & {};
|
|
1
|
+
export type UnsTags = string & {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type UnsTopics = string & {};
|
|
1
|
+
export type UnsTopics = string & {};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
{
|
|
2
|
-
"uns": {
|
|
3
|
-
"graphql": "http://uns-datahub-controller:3200/graphql",
|
|
4
|
-
"rest": "http://uns-datahub-controller:3200/api",
|
|
5
|
-
"processName": "__APP_NAME__",
|
|
6
|
-
"instanceMode": "wait",
|
|
7
|
-
"handover": true,
|
|
8
|
-
"jwksWellKnownUrl": "http://uns-datahub-controller:3200/api/.well-known/jwks.json",
|
|
9
|
-
"kidWellKnownUrl": "http://uns-datahub-controller:3200/api/.well-known/kid",
|
|
10
|
-
"email": "user@example-org.com",
|
|
11
|
-
"password": "secret"
|
|
12
|
-
},
|
|
13
|
-
"infra": {
|
|
14
|
-
"host": "mosquitto:1883"
|
|
15
|
-
},
|
|
16
|
-
"output": {
|
|
17
|
-
"host": "mosquitto:1883"
|
|
18
|
-
},
|
|
19
|
-
"input": {
|
|
20
|
-
"host": "mosquitto:1883"
|
|
21
|
-
},
|
|
22
|
-
"devops": {
|
|
23
|
-
"provider": "azure-devops",
|
|
24
|
-
"organization": "example-org",
|
|
25
|
-
"project": "example-project"
|
|
26
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"uns": {
|
|
3
|
+
"graphql": "http://uns-datahub-controller:3200/graphql",
|
|
4
|
+
"rest": "http://uns-datahub-controller:3200/api",
|
|
5
|
+
"processName": "__APP_NAME__",
|
|
6
|
+
"instanceMode": "wait",
|
|
7
|
+
"handover": true,
|
|
8
|
+
"jwksWellKnownUrl": "http://uns-datahub-controller:3200/api/.well-known/jwks.json",
|
|
9
|
+
"kidWellKnownUrl": "http://uns-datahub-controller:3200/api/.well-known/kid",
|
|
10
|
+
"email": "user@example-org.com",
|
|
11
|
+
"password": "secret"
|
|
12
|
+
},
|
|
13
|
+
"infra": {
|
|
14
|
+
"host": "mosquitto:1883"
|
|
15
|
+
},
|
|
16
|
+
"output": {
|
|
17
|
+
"host": "mosquitto:1883"
|
|
18
|
+
},
|
|
19
|
+
"input": {
|
|
20
|
+
"host": "mosquitto:1883"
|
|
21
|
+
},
|
|
22
|
+
"devops": {
|
|
23
|
+
"provider": "azure-devops",
|
|
24
|
+
"organization": "example-org",
|
|
25
|
+
"project": "example-project"
|
|
26
|
+
}
|
|
27
27
|
}
|