@camunda8/orchestration-cluster-api 1.0.0

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.
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/logger.ts
21
+ var logger_exports = {};
22
+ __export(logger_exports, {
23
+ createLogger: () => createLogger
24
+ });
25
+ module.exports = __toCommonJS(logger_exports);
26
+
27
+ // src/runtime/logger.ts
28
+ var ORDER = {
29
+ silent: 0,
30
+ error: 1,
31
+ warn: 2,
32
+ info: 3,
33
+ debug: 4,
34
+ trace: 5
35
+ };
36
+ function createLogger(opts = {}) {
37
+ let currentLevel = opts.level || "error";
38
+ let transport = opts.transport;
39
+ const baseScope = opts.scope || "";
40
+ function isEnabled(need) {
41
+ return ORDER[currentLevel] >= ORDER[need];
42
+ }
43
+ function evalArgs(args) {
44
+ return args.map((a) => typeof a === "function" && a.length === 0 ? a() : a).flat();
45
+ }
46
+ function emit(level, scope, rawArgs) {
47
+ if (!isEnabled(level)) return;
48
+ const args = evalArgs(rawArgs);
49
+ const evt = { level, scope, ts: Date.now(), args };
50
+ if (transport) {
51
+ try {
52
+ transport(evt);
53
+ } catch {
54
+ }
55
+ } else {
56
+ const tag = `[camunda-sdk][${level}]${scope ? `[${scope}]` : ""}`;
57
+ const method = level === "error" ? "error" : level === "warn" ? "warn" : "log";
58
+ console[method](tag, ...args);
59
+ }
60
+ }
61
+ function emitCode(level, scope, code, msg, data) {
62
+ if (!isEnabled(level)) return;
63
+ const evt = { level, scope, ts: Date.now(), args: [msg], code, data };
64
+ if (transport) {
65
+ try {
66
+ transport(evt);
67
+ } catch {
68
+ }
69
+ } else {
70
+ const tag = `[camunda-sdk][${level}]${scope ? `[${scope}]` : ""}`;
71
+ const method = level === "error" ? "error" : level === "warn" ? "warn" : "log";
72
+ console[method](tag, code + ":", msg, data ?? "");
73
+ }
74
+ }
75
+ const make = (scope) => ({
76
+ level: () => currentLevel,
77
+ setLevel(l) {
78
+ currentLevel = l;
79
+ },
80
+ setTransport(t) {
81
+ transport = t;
82
+ },
83
+ error: (...a) => emit("error", scope, a),
84
+ warn: (...a) => emit("warn", scope, a),
85
+ info: (...a) => emit("info", scope, a),
86
+ debug: (...a) => emit("debug", scope, a),
87
+ trace: (...a) => emit("trace", scope, a),
88
+ scope(child) {
89
+ return make(scope ? `${scope}:${child}` : child);
90
+ },
91
+ code(l, code, msg, data) {
92
+ emitCode(l, scope, code, msg, data);
93
+ }
94
+ });
95
+ return make(baseScope);
96
+ }
97
+ // Annotate the CommonJS export names for ESM import in node:
98
+ 0 && (module.exports = {
99
+ createLogger
100
+ });
101
+ //# sourceMappingURL=logger.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/logger.ts","../src/runtime/logger.ts"],"sourcesContent":["// Deprecated: global logger API removed. Per-client logger accessible via client.logger().\nexport type { LogEvent, LogLevel, LogTransport, Logger } from './runtime/logger';\nexport { createLogger } from './runtime/logger';\n","// Per-client logger (no global singleton). Construct via createLogger.\n\nexport type LogLevel = 'silent' | 'error' | 'warn' | 'info' | 'debug' | 'trace';\nexport interface LogEvent {\n level: LogLevel;\n scope: string;\n ts: number;\n args: any[];\n code?: string;\n data?: any;\n}\nexport type LogTransport = (e: LogEvent) => void;\nconst ORDER: Record<LogLevel, number> = {\n silent: 0,\n error: 1,\n warn: 2,\n info: 3,\n debug: 4,\n trace: 5,\n};\n\nexport interface Logger {\n level(): LogLevel;\n setLevel(level: LogLevel): void; // internal use\n setTransport(t?: LogTransport): void; // internal use\n error(...a: any[]): void;\n warn(...a: any[]): void;\n info(...a: any[]): void;\n debug(...a: any[]): void;\n trace(...a: any[]): void;\n scope(child: string): Logger;\n code(level: LogLevel, code: string, msg: string, data?: any): void;\n}\n\nexport interface CreateLoggerOptions {\n level?: LogLevel;\n transport?: LogTransport;\n scope?: string;\n}\n\nexport function createLogger(opts: CreateLoggerOptions = {}): Logger {\n let currentLevel: LogLevel = opts.level || 'error';\n let transport: LogTransport | undefined = opts.transport;\n const baseScope = opts.scope || '';\n\n function isEnabled(need: LogLevel) {\n return ORDER[currentLevel] >= ORDER[need];\n }\n function evalArgs(args: any[]): any[] {\n // Support lazy function args: if an arg is a function with zero arity, call it.\n return args.map((a) => (typeof a === 'function' && a.length === 0 ? a() : a)).flat();\n }\n function emit(level: LogLevel, scope: string, rawArgs: any[]) {\n if (!isEnabled(level)) return;\n const args = evalArgs(rawArgs);\n const evt: LogEvent = { level, scope, ts: Date.now(), args };\n if (transport) {\n try {\n transport(evt);\n } catch {\n /* ignore transport errors */\n }\n } else {\n const tag = `[camunda-sdk][${level}]${scope ? `[${scope}]` : ''}`;\n const method = level === 'error' ? 'error' : level === 'warn' ? 'warn' : 'log';\n // eslint-disable-next-line no-console\n (console as any)[method](tag, ...args);\n }\n }\n function emitCode(level: LogLevel, scope: string, code: string, msg: string, data?: any) {\n if (!isEnabled(level)) return;\n const evt: LogEvent = { level, scope, ts: Date.now(), args: [msg], code, data };\n if (transport) {\n try {\n transport(evt);\n // eslint-disable-next-line no-empty\n } catch {}\n } else {\n const tag = `[camunda-sdk][${level}]${scope ? `[${scope}]` : ''}`;\n const method = level === 'error' ? 'error' : level === 'warn' ? 'warn' : 'log';\n // eslint-disable-next-line no-console\n (console as any)[method](tag, code + ':', msg, data ?? '');\n }\n }\n const make = (scope: string): Logger => ({\n level: () => currentLevel,\n setLevel(l: LogLevel) {\n currentLevel = l;\n },\n setTransport(t?: LogTransport) {\n transport = t;\n },\n error: (...a: any[]) => emit('error', scope, a),\n warn: (...a: any[]) => emit('warn', scope, a),\n info: (...a: any[]) => emit('info', scope, a),\n debug: (...a: any[]) => emit('debug', scope, a),\n trace: (...a: any[]) => emit('trace', scope, a),\n scope(child: string) {\n return make(scope ? `${scope}:${child}` : child);\n },\n code(l: LogLevel, code: string, msg: string, data?: any) {\n emitCode(l, scope, code, msg, data);\n },\n });\n return make(baseScope);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACYA,IAAM,QAAkC;AAAA,EACtC,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AACT;AAqBO,SAAS,aAAa,OAA4B,CAAC,GAAW;AACnE,MAAI,eAAyB,KAAK,SAAS;AAC3C,MAAI,YAAsC,KAAK;AAC/C,QAAM,YAAY,KAAK,SAAS;AAEhC,WAAS,UAAU,MAAgB;AACjC,WAAO,MAAM,YAAY,KAAK,MAAM,IAAI;AAAA,EAC1C;AACA,WAAS,SAAS,MAAoB;AAEpC,WAAO,KAAK,IAAI,CAAC,MAAO,OAAO,MAAM,cAAc,EAAE,WAAW,IAAI,EAAE,IAAI,CAAE,EAAE,KAAK;AAAA,EACrF;AACA,WAAS,KAAK,OAAiB,OAAe,SAAgB;AAC5D,QAAI,CAAC,UAAU,KAAK,EAAG;AACvB,UAAM,OAAO,SAAS,OAAO;AAC7B,UAAM,MAAgB,EAAE,OAAO,OAAO,IAAI,KAAK,IAAI,GAAG,KAAK;AAC3D,QAAI,WAAW;AACb,UAAI;AACF,kBAAU,GAAG;AAAA,MACf,QAAQ;AAAA,MAER;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ACjD;AAAA,IACA,KAAK,GAAa,MAAc,KAAa,MAAY;AACvD,eAAS,GAAG,OAAO,MAAM,KAAK,IAAI;AAAA,IACpC;AAAA,EACF;AACA,SAAO,KAAK,SAAS;AACvB;","names":[]}
@@ -0,0 +1,30 @@
1
+ type LogLevel = 'silent' | 'error' | 'warn' | 'info' | 'debug' | 'trace';
2
+ interface LogEvent {
3
+ level: LogLevel;
4
+ scope: string;
5
+ ts: number;
6
+ args: any[];
7
+ code?: string;
8
+ data?: any;
9
+ }
10
+ type LogTransport = (e: LogEvent) => void;
11
+ interface Logger {
12
+ level(): LogLevel;
13
+ setLevel(level: LogLevel): void;
14
+ setTransport(t?: LogTransport): void;
15
+ error(...a: any[]): void;
16
+ warn(...a: any[]): void;
17
+ info(...a: any[]): void;
18
+ debug(...a: any[]): void;
19
+ trace(...a: any[]): void;
20
+ scope(child: string): Logger;
21
+ code(level: LogLevel, code: string, msg: string, data?: any): void;
22
+ }
23
+ interface CreateLoggerOptions {
24
+ level?: LogLevel;
25
+ transport?: LogTransport;
26
+ scope?: string;
27
+ }
28
+ declare function createLogger(opts?: CreateLoggerOptions): Logger;
29
+
30
+ export { type LogEvent, type LogLevel, type LogTransport, type Logger, createLogger };
@@ -0,0 +1,30 @@
1
+ type LogLevel = 'silent' | 'error' | 'warn' | 'info' | 'debug' | 'trace';
2
+ interface LogEvent {
3
+ level: LogLevel;
4
+ scope: string;
5
+ ts: number;
6
+ args: any[];
7
+ code?: string;
8
+ data?: any;
9
+ }
10
+ type LogTransport = (e: LogEvent) => void;
11
+ interface Logger {
12
+ level(): LogLevel;
13
+ setLevel(level: LogLevel): void;
14
+ setTransport(t?: LogTransport): void;
15
+ error(...a: any[]): void;
16
+ warn(...a: any[]): void;
17
+ info(...a: any[]): void;
18
+ debug(...a: any[]): void;
19
+ trace(...a: any[]): void;
20
+ scope(child: string): Logger;
21
+ code(level: LogLevel, code: string, msg: string, data?: any): void;
22
+ }
23
+ interface CreateLoggerOptions {
24
+ level?: LogLevel;
25
+ transport?: LogTransport;
26
+ scope?: string;
27
+ }
28
+ declare function createLogger(opts?: CreateLoggerOptions): Logger;
29
+
30
+ export { type LogEvent, type LogLevel, type LogTransport, type Logger, createLogger };
package/dist/logger.js ADDED
@@ -0,0 +1,7 @@
1
+ import {
2
+ createLogger
3
+ } from "./chunk-5JT7PDVS.js";
4
+ export {
5
+ createLogger
6
+ };
7
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json ADDED
@@ -0,0 +1,139 @@
1
+ {
2
+ "name": "@camunda8/orchestration-cluster-api",
3
+ "private": false,
4
+ "version": "1.0.0",
5
+ "type": "module",
6
+ "main": "dist/index.cjs",
7
+ "module": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs",
14
+ "default": "./dist/index.js"
15
+ },
16
+ "./logger": {
17
+ "types": "./dist/logger.d.ts",
18
+ "import": "./dist/logger.js",
19
+ "require": "./dist/logger.cjs",
20
+ "default": "./dist/logger.js"
21
+ },
22
+ "./fp": {
23
+ "types": "./dist/fp/index.d.ts",
24
+ "import": "./dist/fp/index.js",
25
+ "require": "./dist/fp/index.cjs",
26
+ "default": "./dist/fp/index.js"
27
+ }
28
+ },
29
+ "author": "josh.wulf@camunda.com",
30
+ "license": "Apache-2.0",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/camunda/orchestration-cluster-api-js.git"
34
+ },
35
+ "scripts": {
36
+ "camundacon:eventual:shell": "./camundacon/eventual/eventual.sh",
37
+ "camundacon:eventual:sdk": "tsx camundacon/eventual/eventual.ts",
38
+ "camundacon:eventual:sdk:trace": "CAMUNDA_SDK_LOG_LEVEL=trace tsx camundacon/eventual/eventual.ts",
39
+ "camundacon:backpressure:legacy": "CAMUNDA_SDK_BACKPRESSURE_PROFILE=LEGACY tsx camundacon/backpressure/backpressure.ts",
40
+ "camundacon:backpressure:legacy:long": "BP_PROFILE_ACTIVATE_BATCH=20 BP_PROFILE_TARGET=10000 CAMUNDA_SDK_BACKPRESSURE_PROFILE=LEGACY tsx camundacon/backpressure/backpressure.ts",
41
+ "camundacon:backpressure:balanced": "CAMUNDA_SDK_BACKPRESSURE_PROFILE=BALANCED tsx camundacon/backpressure/backpressure.ts",
42
+ "camundacon:backpressure:balanced:long": "BP_PROFILE_ACTIVATE_BATCH=20 BP_PROFILE_TARGET=10000 CAMUNDA_SDK_BACKPRESSURE_PROFILE=BALANCED tsx camundacon/backpressure/backpressure.ts",
43
+ "camundacon:backpressure:aggressive": "CAMUNDA_SDK_BACKPRESSURE_PROFILE=AGGRESSIVE tsx camundacon/backpressure/backpressure.ts",
44
+ "camundacon:tags:first": "tsx camundacon/tags/first.ts",
45
+ "camundacon:tags:second": "tsx camundacon/tags/second.ts",
46
+ "camundacon:tags:third": "tsx camundacon/tags/third.ts",
47
+ "clean": "rimraf dist src/gen src/facade",
48
+ "fetch:spec": "tsx scripts/fetch-spec.ts",
49
+ "generate": "npm run clean && npm run fetch:spec && npm run _pipeline:generate",
50
+ "_pipeline:generate": "npm run preprocess && npm run generate:sdk && tsx scripts/postprocess-deployment-schema.ts && npm run generate:class && npm run generate:facade && npm run gate && tsx scripts/postprocess-zod-augment.ts && npm run scaffold:methods && npm run validate:scaffolds && npm run test",
51
+ "generate:local": "npm run clean && cp ../rest-api.domain.yaml ./rest-api.source.yaml && npm run _pipeline:generate",
52
+ "scaffold:methods": "tsx scripts/generate-test-scaffolds.ts",
53
+ "validate:scaffolds": "tsx scripts/validate-test-scaffolds.ts",
54
+ "generate:class": "tsx scripts/generate-class-methods.ts",
55
+ "generate:facade": "tsx scripts/generate-facade.ts",
56
+ "gate": "tsx scripts/postprocess-gate-validation.ts",
57
+ "generate:sdk": "openapi-ts -i ./rest-api.source.yaml -o src/gen",
58
+ "preprocess": "tsx scripts/preprocess-brands.ts",
59
+ "build": "npm run generate && npm run docs:config && npm run format && tsup src/index.ts src/logger.ts src/fp/index.ts --dts --format esm,cjs --sourcemap --out-dir dist",
60
+ "build:local": "npm run generate:local && npm run docs:config && tsup src/index.ts src/logger.ts src/fp/index.ts --dts --format esm,cjs --sourcemap --out-dir dist",
61
+ "test": "CAMUNDA_SDK_INTEGRATION=0 vitest run --passWithNoTests --exclude 'tests-integration/' --exclude 'camundacon/**'",
62
+ "test:integration": "CAMUNDA_SDK_INTEGRATION=1 vitest run tests-integration",
63
+ "docs": "tsx scripts/generate-doc.ts",
64
+ "docs:config": "tsx scripts/generate-config-doc.ts",
65
+ "test:dist": "npm run build --silent && node tests/dist-usage.smoke.mjs",
66
+ "lint": "eslint . --ext .ts,.tsx --max-warnings=0",
67
+ "lint:fix": "eslint . --ext .ts,.tsx --fix",
68
+ "lint-staged": "lint-staged",
69
+ "format": "prettier . --write",
70
+ "format:check": "prettier . --check",
71
+ "release": "semantic-release",
72
+ "prepare": "husky install",
73
+ "responses:regenerate": "assert-json-body extract",
74
+ "docker:start": "docker compose -f docker/docker-compose.yaml up -d",
75
+ "docker:stop": "docker compose -f docker/docker-compose.yaml down",
76
+ "docker:es:start": "docker compose -f docker/docker-compose-es.yaml up -d",
77
+ "docker:es:stop": "docker compose -f docker/docker-compose-es.yaml down && npm run docker:es:cleanup",
78
+ "docker:es:cleanup": "docker volume rm docker_elastic && docker volume rm docker_zeebe && docker volume rm docker_prometheus-data && docker volume rm docker_grafana-data"
79
+ },
80
+ "files": [
81
+ "dist",
82
+ "README.md",
83
+ "CHANGELOG.md",
84
+ "package.json",
85
+ "LICENSE"
86
+ ],
87
+ "sideEffects": false,
88
+ "publishConfig": {
89
+ "access": "public"
90
+ },
91
+ "dependencies": {
92
+ "p-retry": "^6.0.1",
93
+ "typed-env": "^2.0.0",
94
+ "zod": "^4"
95
+ },
96
+ "devDependencies": {
97
+ "@commitlint/cli": "^19.3.0",
98
+ "@commitlint/config-conventional": "^19.2.2",
99
+ "@hey-api/client-fetch": "^0.13.1",
100
+ "@hey-api/openapi-ts": "^0.82.2",
101
+ "@semantic-release/changelog": "^6.0.3",
102
+ "@semantic-release/git": "^10.0.1",
103
+ "@semantic-release/npm": "^11.0.0",
104
+ "@types/node": "^20.14.9",
105
+ "@types/single-line-log": "^1.1.2",
106
+ "@typescript-eslint/eslint-plugin": "^7.18.0",
107
+ "@typescript-eslint/parser": "^7.18.0",
108
+ "assert-json-body": "^1.3.0",
109
+ "chalk": "^5.6.2",
110
+ "eslint": "^8.57.0",
111
+ "eslint-config-prettier": "^9.1.2",
112
+ "eslint-plugin-import": "^2.32.0",
113
+ "eslint-plugin-unused-imports": "^3.2.0",
114
+ "fp-ts": "^2.16.11",
115
+ "husky": "^9.0.11",
116
+ "lint-staged": "^15.2.8",
117
+ "openapi-typescript-codegen": "^0.29.0",
118
+ "prettier": "^3.6.2",
119
+ "rimraf": "^6.0.1",
120
+ "semantic-release": "^23.0.0",
121
+ "single-line-log": "^1.1.2",
122
+ "tsup": "^8.0.2",
123
+ "tsx": "^4.7.0",
124
+ "typescript": "^5.4.5",
125
+ "vitest": "^3.2.4",
126
+ "yaml": "^2.8.1"
127
+ },
128
+ "lint-staged": {
129
+ "*.{ts,tsx,js,json,md,yml,yaml}": [
130
+ "prettier --write"
131
+ ],
132
+ "*.{ts,tsx}": [
133
+ "eslint --fix"
134
+ ]
135
+ },
136
+ "engines": {
137
+ "node": ">=18"
138
+ }
139
+ }