@shushed/helpers 0.0.232 → 0.0.234
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
|
};
|
|
@@ -780,9 +777,6 @@ class EnvEngine extends runtime_1.default {
|
|
|
780
777
|
projectId: pubSubProjectId
|
|
781
778
|
});
|
|
782
779
|
global.HUSH_PUBSUB_INSTANCE = pubSub;
|
|
783
|
-
this.logging.log('getPubSubHelper', {
|
|
784
|
-
serviceAccountEmail: serviceAccount,
|
|
785
|
-
});
|
|
786
780
|
return new pubsub_1.default(this, {
|
|
787
781
|
serviceAccountEmail: serviceAccount
|
|
788
782
|
}, pubSub);
|
|
@@ -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(
|
|
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,
|
|
@@ -98,12 +98,18 @@ class Runtime {
|
|
|
98
98
|
if (opts.trigger?.label) {
|
|
99
99
|
this.triggerId = opts.trigger.id || '00000000-0000-0000-0000-000000000000';
|
|
100
100
|
this.triggerName = opts.trigger?.label?.split(/\sv\d/)[0]?.trim() || this.workflowId;
|
|
101
|
-
this.triggerVersion = buildSemver((opts.trigger
|
|
101
|
+
this.triggerVersion = buildSemver((opts.trigger?.label?.split(/\sv/)?.find(x => /^\d/.test(x))?.trim() || '0'));
|
|
102
102
|
this.triggerDataProperties = opts.trigger.data?.properties;
|
|
103
103
|
this.triggerConfigProperties = opts.trigger.config?.properties;
|
|
104
104
|
}
|
|
105
105
|
else {
|
|
106
|
-
|
|
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;
|
|
@@ -176,7 +182,7 @@ class Runtime {
|
|
|
176
182
|
exports.default = Runtime;
|
|
177
183
|
;
|
|
178
184
|
function buildSemver(version) {
|
|
179
|
-
const parts = version.split(
|
|
185
|
+
const parts = version.split('.').map(x => parseInt(x, 10)).filter(x => !isNaN(x));
|
|
180
186
|
for (let i = parts.length; i < 3; i++) {
|
|
181
187
|
parts.push(0);
|
|
182
188
|
}
|
|
@@ -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
|
}>;
|