@uns-kit/cli 2.0.50 → 2.0.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +0 -26
- package/dist/service-bundle.js +5 -0
- package/package.json +6 -7
- package/templates/config-files/config-localhost.json +3 -3
- package/templates/cron/AGENTS.md +0 -1
- package/templates/default/AGENTS.md +0 -1
- package/templates/default/README.md +2 -2
- package/templates/default/src/index.ts +17 -9
- package/templates/temporal/src/examples/temporal-example.ts +0 -37
package/dist/index.js
CHANGED
|
@@ -112,17 +112,6 @@ async function main() {
|
|
|
112
112
|
}
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
if (command === "configure-temporal") {
|
|
116
|
-
const { targetPath, overwrite } = parseTemplateCommandArgs(args.slice(1));
|
|
117
|
-
try {
|
|
118
|
-
await configureTemporal(targetPath, { overwrite });
|
|
119
|
-
}
|
|
120
|
-
catch (error) {
|
|
121
|
-
console.error(error.message);
|
|
122
|
-
process.exitCode = 1;
|
|
123
|
-
}
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
115
|
if (command === "configure-python") {
|
|
127
116
|
const { targetPath, overwrite } = parseTemplateCommandArgs(args.slice(1));
|
|
128
117
|
try {
|
|
@@ -192,7 +181,6 @@ function printHelp() {
|
|
|
192
181
|
" configure-codegen [dir] Copy GraphQL codegen template and dependencies\n" +
|
|
193
182
|
" configure-api [dir] Copy UNS API examples and add @uns-kit/api\n" +
|
|
194
183
|
" configure-cron [dir] Copy UNS cron examples and add @uns-kit/cron\n" +
|
|
195
|
-
" configure-temporal [dir] Copy UNS Temporal examples and add @uns-kit/temporal\n" +
|
|
196
184
|
" configure-python [dir] Copy Python gateway client scaffolding\n" +
|
|
197
185
|
" configure-uns-reference [dir] Copy UNS dictionaries (objects/attributes/measurements)\n" +
|
|
198
186
|
" upgrade [dir] Remove obsolete scripts and update to current conventions\n" +
|
|
@@ -771,16 +759,6 @@ async function configureCron(targetPath, options = {}) {
|
|
|
771
759
|
overwrite: options.overwrite,
|
|
772
760
|
});
|
|
773
761
|
}
|
|
774
|
-
async function configureTemporal(targetPath, options = {}) {
|
|
775
|
-
await configurePlugin({
|
|
776
|
-
targetPath,
|
|
777
|
-
templateName: "temporal",
|
|
778
|
-
dependencyName: "@uns-kit/temporal",
|
|
779
|
-
dependencySpecifier: resolveUnsPackageSpecifier("@uns-kit/temporal", "../../uns-temporal/package.json"),
|
|
780
|
-
label: "UNS Temporal",
|
|
781
|
-
overwrite: options.overwrite,
|
|
782
|
-
});
|
|
783
|
-
}
|
|
784
762
|
async function configurePython(targetPath, options = {}) {
|
|
785
763
|
await configurePlugin({
|
|
786
764
|
targetPath,
|
|
@@ -877,7 +855,6 @@ const configureFeatureHandlers = {
|
|
|
877
855
|
codegen: configureCodegen,
|
|
878
856
|
api: configureApi,
|
|
879
857
|
cron: configureCron,
|
|
880
|
-
temporal: configureTemporal,
|
|
881
858
|
python: configurePython,
|
|
882
859
|
"uns-reference": configureUnsReference,
|
|
883
860
|
};
|
|
@@ -888,7 +865,6 @@ const configureFeatureLabels = {
|
|
|
888
865
|
codegen: "GraphQL codegen tooling",
|
|
889
866
|
api: "UNS API resources",
|
|
890
867
|
cron: "UNS cron resources",
|
|
891
|
-
temporal: "UNS Temporal resources",
|
|
892
868
|
python: "Python client scaffolding",
|
|
893
869
|
"uns-reference": "UNS dictionaries (objects/attributes/measurements)",
|
|
894
870
|
};
|
|
@@ -1086,8 +1062,6 @@ const configureFeatureAliases = {
|
|
|
1086
1062
|
"configure-api": "api",
|
|
1087
1063
|
cron: "cron",
|
|
1088
1064
|
"configure-cron": "cron",
|
|
1089
|
-
temporal: "temporal",
|
|
1090
|
-
"configure-temporal": "temporal",
|
|
1091
1065
|
python: "python",
|
|
1092
1066
|
"configure-python": "python",
|
|
1093
1067
|
"uns-reference": "uns-reference",
|
package/dist/service-bundle.js
CHANGED
|
@@ -64,6 +64,11 @@ export function generateAgentsMarkdown(bundle) {
|
|
|
64
64
|
["Template", bundle.scaffold.template],
|
|
65
65
|
]),
|
|
66
66
|
"",
|
|
67
|
+
"## Bundle Source",
|
|
68
|
+
"",
|
|
69
|
+
"- Read `service.bundle.json` first when planning or generating service-specific code; it is the project source of truth.",
|
|
70
|
+
"- Keep `SERVICE_SPEC.md` and this file aligned with `service.bundle.json` when the bundle changes.",
|
|
71
|
+
"",
|
|
67
72
|
"## Project Context",
|
|
68
73
|
...renderStringList(bundle.docs.agents.projectContext),
|
|
69
74
|
"",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uns-kit/cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.52",
|
|
4
4
|
"description": "Command line scaffolding tool for UNS applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,14 +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.52"
|
|
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/database": "2.0.
|
|
36
|
-
"@uns-kit/temporal": "2.0.47"
|
|
32
|
+
"@uns-kit/core": "2.0.52",
|
|
33
|
+
"@uns-kit/api": "2.0.52",
|
|
34
|
+
"@uns-kit/cron": "2.0.52",
|
|
35
|
+
"@uns-kit/database": "2.0.52"
|
|
37
36
|
},
|
|
38
37
|
"scripts": {
|
|
39
38
|
"build": "tsc -p tsconfig.build.json",
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"password": "secret"
|
|
20
20
|
},
|
|
21
21
|
"infra": {
|
|
22
|
-
"host": "localhost
|
|
22
|
+
"host": "localhost"
|
|
23
23
|
},
|
|
24
24
|
"output": {
|
|
25
|
-
"host": "localhost
|
|
25
|
+
"host": "localhost"
|
|
26
26
|
},
|
|
27
27
|
"input": {
|
|
28
|
-
"host": "localhost
|
|
28
|
+
"host": "localhost"
|
|
29
29
|
},
|
|
30
30
|
"devops": {
|
|
31
31
|
"provider": "azure-devops",
|
package/templates/cron/AGENTS.md
CHANGED
|
@@ -11,7 +11,6 @@ Pointers for AI/code-assist tools when working in this generated project.
|
|
|
11
11
|
- `@uns-kit/core/README.md`
|
|
12
12
|
- `@uns-kit/api/README.md` (if installed)
|
|
13
13
|
- `@uns-kit/cron/README.md` (if installed)
|
|
14
|
-
- `@uns-kit/temporal/README.md` (if installed)
|
|
15
14
|
- `@uns-kit/cli/README.md` (if installed)
|
|
16
15
|
|
|
17
16
|
## Generators in this project
|
|
@@ -11,7 +11,6 @@ Pointers for AI/code-assist tools when working in this generated project.
|
|
|
11
11
|
- `@uns-kit/core/README.md`
|
|
12
12
|
- `@uns-kit/api/README.md` (if installed)
|
|
13
13
|
- `@uns-kit/cron/README.md` (if installed)
|
|
14
|
-
- `@uns-kit/temporal/README.md` (if installed)
|
|
15
14
|
- `@uns-kit/cli/README.md` (if installed)
|
|
16
15
|
|
|
17
16
|
## Generators in this project
|
|
@@ -65,14 +65,14 @@ console.log(values);
|
|
|
65
65
|
## Next Steps
|
|
66
66
|
|
|
67
67
|
- Install additional plugins: `pnpm add @uns-kit/api` etc.
|
|
68
|
-
- Create MQTT proxies
|
|
68
|
+
- Create MQTT proxies inside `src/index.ts`.
|
|
69
69
|
- Extend `src/config/project.config.extension.ts` with project-specific sections and run `pnpm run generate-config-schema` (reload your editor's TS server afterward if completions lag).
|
|
70
70
|
- Run `uns-kit configure-devops` to add the Azure DevOps pull-request tooling.
|
|
71
71
|
- Run `uns-kit configure-vscode` to copy workspace/launch configuration for VS Code.
|
|
72
72
|
- Run `uns-kit configure-codegen` to scaffold GraphQL code generation and UNS refresh scripts.
|
|
73
73
|
- Run `pnpm run sync-uns-schema -- --controller-url ... --token ...` to pull `uns-dictionary.json` and `uns-measurements.json` from the controller export into this project, then regenerate the typed files automatically.
|
|
74
74
|
- Run `pnpm run sync-uns-metadata -- --controller-url ... --token ...` to regenerate topic, tag, and asset IntelliSense from the controller metadata export. The token must be admin or include `export:uns-reference`.
|
|
75
|
-
- Run `uns-kit configure-api` / `configure-cron`
|
|
75
|
+
- Run `uns-kit configure-api` / `configure-cron` to pull in example stubs and install the matching UNS plugins (add `--overwrite` to refresh templates).
|
|
76
76
|
- Run `uns-kit configure-python` to copy the Python gateway client template (examples, scripts, proto).
|
|
77
77
|
- Commit your new project and start building!
|
|
78
78
|
|
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
import { UnsProxyProcess } from "@uns-kit/core";
|
|
1
|
+
import { ConfigFile, UnsProxyProcess } from "@uns-kit/core";
|
|
2
|
+
import type { ISO8601 } from "@uns-kit/core/uns/uns-interfaces.js";
|
|
2
3
|
|
|
3
4
|
async function main(): Promise<void> {
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
5
|
+
const config = await ConfigFile.loadConfig();
|
|
6
|
+
const processName = config.uns.processName ?? "__APP_NAME__";
|
|
7
|
+
const unsProcess = new UnsProxyProcess(config.infra.host ?? "localhost", {
|
|
8
|
+
processName,
|
|
7
9
|
});
|
|
8
10
|
|
|
9
|
-
const
|
|
11
|
+
const mqttOutput = await unsProcess.createUnsMqttProxy(
|
|
12
|
+
config.output?.host ?? "localhost",
|
|
13
|
+
"defaultOutput",
|
|
14
|
+
config.uns.instanceMode ?? "wait",
|
|
15
|
+
config.uns.handover ?? true,
|
|
16
|
+
);
|
|
10
17
|
|
|
11
|
-
|
|
18
|
+
const time = new Date().toISOString() as ISO8601;
|
|
19
|
+
|
|
20
|
+
await mqttOutput.publishMqttMessage({
|
|
12
21
|
topic: "example/site/area/line/",
|
|
13
22
|
asset: "demo-asset",
|
|
14
23
|
objectType: "utility-resource",
|
|
@@ -17,9 +26,8 @@ async function main(): Promise<void> {
|
|
|
17
26
|
attribute: "status",
|
|
18
27
|
description: "Service startup marker",
|
|
19
28
|
data: {
|
|
20
|
-
time
|
|
29
|
+
time,
|
|
21
30
|
value: "started",
|
|
22
|
-
uom: "state",
|
|
23
31
|
dataGroup: "runtime",
|
|
24
32
|
},
|
|
25
33
|
validityMode: "lifecycle",
|
|
@@ -27,7 +35,7 @@ async function main(): Promise<void> {
|
|
|
27
35
|
},
|
|
28
36
|
});
|
|
29
37
|
|
|
30
|
-
console.log(`UNS process '${
|
|
38
|
+
console.log(`UNS process '${processName}' is ready. Edit src/index.ts to add your logic.`);
|
|
31
39
|
}
|
|
32
40
|
|
|
33
41
|
void main();
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Change this file according to your specifications and rename it to index.ts
|
|
3
|
-
*/
|
|
4
|
-
import { UnsProxyProcess, ConfigFile, getLogger } from "@uns-kit/core";
|
|
5
|
-
import { ITemporalTopic } from "@uns-kit/temporal.js";
|
|
6
|
-
import "@uns-kit/temporal";
|
|
7
|
-
import { type UnsProxyProcessWithTemporal } from "@uns-kit/temporal.js";
|
|
8
|
-
import { UnsAttributeType } from "@uns-kit/core/graphql/schema.js";
|
|
9
|
-
|
|
10
|
-
const logger = getLogger(import.meta.url);
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Load the configuration from a file.
|
|
14
|
-
* On the server, this file is provided by the `uns-datahub-controller`.
|
|
15
|
-
* In the development environment, you are responsible for creating and maintaining this file and its contents.
|
|
16
|
-
*/
|
|
17
|
-
const config = await ConfigFile.loadConfig();
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Connect to the temporal and register uns topic for temporal
|
|
21
|
-
*/
|
|
22
|
-
const unsProxyProcess = new UnsProxyProcess(config.infra.host!, {processName:config.uns.processName}) as UnsProxyProcessWithTemporal;
|
|
23
|
-
const temporalTopic: ITemporalTopic = {
|
|
24
|
-
attribute: "temporal-data",
|
|
25
|
-
topic: "example/",
|
|
26
|
-
attributeType: UnsAttributeType.Data,
|
|
27
|
-
attributeNeedsPersistence: true,
|
|
28
|
-
dataGroup: "temporal",
|
|
29
|
-
description: "Temporal data example",
|
|
30
|
-
tags: ["temporal"],
|
|
31
|
-
}
|
|
32
|
-
const temporalProxy = await unsProxyProcess.createTemporalProxy("templateUnsTemporal", "temporal.example.local:7233", "line-namespace");
|
|
33
|
-
await temporalProxy.initializeTemporalProxy(temporalTopic);
|
|
34
|
-
|
|
35
|
-
// Start temporal workflow
|
|
36
|
-
const result = await temporalProxy.startWorkflow("TransformLineData", {'coil_id': "42"}, "ETL_LINE_TASK_QUEUE");
|
|
37
|
-
logger.info(`Workflow result: ${JSON.stringify(result)}`);
|