@shushed/helpers 0.0.232 → 0.0.233

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.
@@ -684,13 +684,10 @@ class EnvEngine extends runtime_1.default {
684
684
  const message = {
685
685
  requestSource: requestSource,
686
686
  messageId: requestBody?.message?.messageId || undefined,
687
- sourceSystem: requestBody?.message?.attributes?.source_system || 'unknown',
688
- targetSystem: requestBody?.message?.attributes?.target_system || 'unknown',
689
687
  buildshipId: requestBody?.message?.attributes?.buildship_id || 'unknown',
690
688
  publishTime: (0, utils_1.parseDateOrDefault)(requestBody?.message?.publish_time),
691
689
  body: messageBody,
692
690
  bodyTxt: messageBodyRaw,
693
- exportableToBigQuery: !!requestBody?.message?.attributes?.bigquery,
694
691
  extraAttributes: Object.assign({}, request.query, (0, lodash_omit_1.default)(requestBody?.message?.attributes || {}, ['source_system', 'target_system', 'buildship_id', 'bigquery'])),
695
692
  subscriptionName: (requestBody?.subscription?.split('/')?.pop() || request.query.subscriptionName)?.replace(/^rn\./, ''),
696
693
  };
@@ -111,8 +111,11 @@ class PubSubHelper extends runtime_1.default {
111
111
  attributes: nextAttributes
112
112
  };
113
113
  let messageId = null;
114
- if (options.dryRun) {
115
- messageId = await topic.publishMessage(message);
114
+ if (!options.dryRun) {
115
+ messageId = await topic.publishMessage({
116
+ data: Buffer.from(JSON.stringify(message.data)),
117
+ attributes: message.attributes,
118
+ });
116
119
  }
117
120
  return {
118
121
  message,
@@ -103,7 +103,13 @@ class Runtime {
103
103
  this.triggerConfigProperties = opts.trigger.config?.properties;
104
104
  }
105
105
  else {
106
- this.triggerId = Object.values(opts.session?.executedNodes || {}).find(e => e.nodeType === 'trigger')?.nodeId ?? '00000000-0000-0000-0000-000000000000';
106
+ const triggerIdFromSession = Object.values(opts.session?.executedNodes || {}).find(e => e.nodeType === 'trigger')?.nodeId;
107
+ let triggerIdFromPath = opts.request?.path?.split('/')?.[3];
108
+ const isTheTriggerIdInPath = triggerIdFromPath && opts.workflow?.nodeValues?.[triggerIdFromPath] && Object.keys(opts.workflow.nodeValues[triggerIdFromPath]).find(x => x.startsWith('config.'));
109
+ if (!isTheTriggerIdInPath) {
110
+ triggerIdFromPath = undefined;
111
+ }
112
+ this.triggerId = triggerIdFromSession || triggerIdFromPath || '00000000-0000-0000-0000-000000000000';
107
113
  this.triggerName = this.workflowRoot[this.triggerId]?.triggerName || this.workflowId;
108
114
  this.triggerVersion = this.workflowRoot[this.triggerId]?.triggerVersion || '0.0.0';
109
115
  this.triggerConfig = this.workflowRoot[this.triggerId]?.triggerConfig;
@@ -107,13 +107,10 @@ declare class EnvEngine extends Runtime {
107
107
  }, nodeReq: IncomingMessage): Promise<{
108
108
  requestSource: string;
109
109
  messageId: string | undefined;
110
- sourceSystem: string;
111
- targetSystem: string;
112
110
  buildshipId: string;
113
111
  publishTime: Date | null;
114
112
  body: any;
115
113
  bodyTxt: string | null;
116
- exportableToBigQuery: boolean;
117
114
  extraAttributes: Record<string, string>;
118
115
  subscriptionName: string | undefined;
119
116
  }[]>;
@@ -123,13 +120,10 @@ declare class EnvEngine extends Runtime {
123
120
  }, nodeReq: IncomingMessage): Promise<{
124
121
  requestSource: string;
125
122
  messageId: string | undefined;
126
- sourceSystem: string;
127
- targetSystem: string;
128
123
  buildshipId: string;
129
124
  publishTime: Date | null;
130
125
  body: any;
131
126
  bodyTxt: string | null;
132
- exportableToBigQuery: boolean;
133
127
  extraAttributes: Record<string, string>;
134
128
  subscriptionName: string | undefined;
135
129
  }>;
@@ -13,6 +13,7 @@ export type Opts = {
13
13
  runtimeUrl?: string;
14
14
  request?: {
15
15
  host?: string;
16
+ path?: string;
16
17
  };
17
18
  runtimeEnv?: string;
18
19
  env?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shushed/helpers",
3
- "version": "0.0.232",
3
+ "version": "0.0.233",
4
4
  "author": "",
5
5
  "license": "UNLICENSED",
6
6
  "description": "",