@shushed/helpers 0.0.198-v2-20251104174054 → 0.0.198-v2-20251104214132

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.
@@ -77,7 +77,14 @@ class Runtime {
77
77
  else {
78
78
  this.workflowId = opts.workflowId || opts.workflow?.id || '';
79
79
  this.triggerId = opts.triggerId || opts.trigger?.id || '';
80
+ if (!this.triggerId && opts.session) {
81
+ this.triggerId = Object.values(opts.session?.executedNodes || {}).find(e => e.nodeType === 'trigger')?.nodeId ?? 'unknown';
82
+ }
83
+ else if (!this.triggerId) {
84
+ this.triggerId = 'unknown';
85
+ }
80
86
  this.systemEnvName = this.getSystemEnvName(opts);
87
+ console.log('JAKUBENV', this.systemEnvName);
81
88
  this.envName = this.systemEnvName === DEFAULT_BRANCH ? 'prod' : this.systemEnvName;
82
89
  this.pubSubPrefix = this.envName === 'prod' ? '' : `${this.envName}---`;
83
90
  this.runtimeUrl = this.getRuntimeUrl(opts);
@@ -96,19 +103,19 @@ class Runtime {
96
103
  if (options instanceof Runtime) {
97
104
  return options.systemEnvName;
98
105
  }
99
- if (options.runtimeEnv) {
100
- return options.runtimeEnv;
101
- }
102
106
  if (process.env.runtime) {
103
107
  return process.env.runtime;
104
108
  }
105
- let systemEnvName = null;
106
- if (options.env?.triggerEnv) {
107
- systemEnvName = options.env.triggerEnv.systemEnvName;
109
+ if (process.env.runtimeEnv) {
110
+ return process.env.runtimeEnv;
108
111
  }
109
112
  if (options.env?.runtimeEnv) {
110
113
  return options.env.runtimeEnv;
111
114
  }
115
+ let systemEnvName = null;
116
+ if (options.env?.triggerEnv) {
117
+ systemEnvName = options.env.triggerEnv.systemEnvName;
118
+ }
112
119
  if (options.runtimeUrl || options.request?.host || options.url) {
113
120
  const hostId = (options.runtimeUrl || options.request?.host || options.url || '').replace(/^(?:https?:)?\/\//i, '').split('/')[0].split('.')[0].toLowerCase();
114
121
  if (hostId.includes('-')) {
@@ -18,6 +18,15 @@ export type Opts = {
18
18
  };
19
19
  env?: {
20
20
  triggerEnv?: any;
21
+ runtimeEnv?: string;
22
+ };
23
+ session?: {
24
+ executedNodes: {
25
+ [key: string]: {
26
+ nodeId: string;
27
+ nodeType: string;
28
+ };
29
+ };
21
30
  };
22
31
  logging?: ILogging;
23
32
  } | Runtime;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shushed/helpers",
3
- "version": "0.0.198-v2-20251104174054",
3
+ "version": "0.0.198-v2-20251104214132",
4
4
  "author": "",
5
5
  "license": "UNLICENSED",
6
6
  "description": "",