@uns-kit/temporal 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -16,19 +16,24 @@ Install `@uns-kit/core` as well—the plugin augments its runtime.
16
16
 
17
17
  ```ts
18
18
  import UnsProxyProcess from "@uns-kit/core/uns/uns-proxy-process";
19
- import unsTemporalPlugin, { type UnsProxyProcessWithTemporal } from "@uns-kit/temporal";
19
+ import { UnsAttributeType } from "@uns-kit/core/uns/uns-interfaces";
20
+ import type { UnsProxyProcessWithTemporal } from "@uns-kit/temporal";
21
+ import "@uns-kit/temporal";
20
22
 
21
- const process = new UnsProxyProcess("mqtt-broker:1883", { processName: "temporal-demo" }) as UnsProxyProcessWithTemporal;
22
- unsTemporalPlugin;
23
+ async function main() {
24
+ const process = new UnsProxyProcess("mqtt-broker:1883", { processName: "temporal-demo" }) as UnsProxyProcessWithTemporal;
23
25
 
24
- const temporal = await process.createTemporalProxy("hv-etl", "temporal:7233", "hv-namespace");
25
- await temporal.initializeTemporalProxy({
26
- topic: "factory/",
27
- attribute: "hv-status",
28
- attributeType: UnsAttributeType.Data,
29
- });
26
+ const temporal = await process.createTemporalProxy("hv-etl", "temporal:7233", "hv-namespace");
27
+ await temporal.initializeTemporalProxy({
28
+ topic: "factory/",
29
+ attribute: "hv-status",
30
+ attributeType: UnsAttributeType.Data,
31
+ });
30
32
 
31
- await temporal.startWorkflow("TransformHvSclData", { coil_id: "42" }, "ETL_HV_SCL_TASK_QUEUE");
33
+ await temporal.startWorkflow("TransformHvSclData", { coil_id: "42" }, "ETL_HV_SCL_TASK_QUEUE");
34
+ }
35
+
36
+ void main();
32
37
  ```
33
38
 
34
39
  ## Scripts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uns-kit/temporal",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "Temporal.io integration plugin for UnsProxyProcess, wiring workflows into the UNS.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -22,13 +22,17 @@
22
22
  "dist"
23
23
  ],
24
24
  "exports": {
25
+ ".": {
26
+ "types": "./dist/index.d.ts",
27
+ "import": "./dist/index.js"
28
+ },
25
29
  "./*": "./dist/*"
26
30
  },
27
31
  "main": "dist/index.js",
28
32
  "types": "dist/index.d.ts",
29
33
  "dependencies": {
30
34
  "@temporalio/client": "^1.13.0",
31
- "@uns-kit/core": "0.0.19"
35
+ "@uns-kit/core": "0.0.21"
32
36
  },
33
37
  "scripts": {
34
38
  "build": "tsc -p tsconfig.build.json",
@@ -1 +0,0 @@
1
- export {};
@@ -1,33 +0,0 @@
1
- /**
2
- * Change this file according to your specifications and rename it to index.ts
3
- */
4
- import UnsProxyProcess from "@uns-kit/core/uns/uns-proxy-process";
5
- import unsTemporalPlugin from "./uns-temporal-plugin.js";
6
- import { ConfigFile } from "@uns-kit/core/config-file";
7
- import { UnsAttributeType } from "@uns-kit/core/graphql/schema";
8
- import logger from "@uns-kit/core/logger";
9
- /**
10
- * Load the configuration from a file.
11
- * On the server, this file is provided by the `uns-datahub-controller`.
12
- * In the development environment, you are responsible for creating and maintaining this file and its contents.
13
- */
14
- const config = await ConfigFile.loadConfig();
15
- /**
16
- * Connect to the temporal and register uns topic for temporal
17
- */
18
- const unsProxyProcess = new UnsProxyProcess(config.infra.host, { processName: config.uns.processName });
19
- unsTemporalPlugin;
20
- const temporalTopic = {
21
- attribute: "temporal-data",
22
- topic: "sij/",
23
- attributeType: UnsAttributeType.Data,
24
- attributeNeedsPersistence: true,
25
- dataGroup: "temporal",
26
- description: "Temporal data example",
27
- tags: ["temporal"],
28
- };
29
- const temporalProxy = await unsProxyProcess.createTemporalProxy("templateUnsTemporal", "temporal-1.sij.digital:7233", "hv");
30
- await temporalProxy.initializeTemporalProxy(temporalTopic);
31
- // Start temporal workflow
32
- const result = await temporalProxy.startWorkflow("TransformHvSclData", { 'coil_id': "42" }, "ETL_HV_SCL_TASK_QUEUE");
33
- logger.info(`Workflow result: ${JSON.stringify(result)}`);