@shushed/helpers 0.0.39 → 0.0.40
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/dist/index.d.ts +87 -1
- package/dist/index.js +7 -22
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -29090,6 +29090,91 @@ type TriggerOnCreateOptions = {
|
|
|
29090
29090
|
workflowId: string;
|
|
29091
29091
|
};
|
|
29092
29092
|
};
|
|
29093
|
+
type NodeOptions = {
|
|
29094
|
+
req: undefined;
|
|
29095
|
+
request: {
|
|
29096
|
+
headers: Record<string, string>;
|
|
29097
|
+
method: 'POST' | 'GET' | 'PUT' | 'PATCH';
|
|
29098
|
+
body: undefined;
|
|
29099
|
+
path: string;
|
|
29100
|
+
query: Record<string, string>;
|
|
29101
|
+
host: string;
|
|
29102
|
+
hostname: string;
|
|
29103
|
+
originalUrl: string;
|
|
29104
|
+
ip: string;
|
|
29105
|
+
ips: [];
|
|
29106
|
+
querystring: string;
|
|
29107
|
+
subdomains: Array<string>;
|
|
29108
|
+
secure: boolean;
|
|
29109
|
+
protocol: 'http' | 'https';
|
|
29110
|
+
params: undefined;
|
|
29111
|
+
};
|
|
29112
|
+
nodeReq: Request;
|
|
29113
|
+
auth: {
|
|
29114
|
+
getToken: (forceRefresh: boolean) => any;
|
|
29115
|
+
getKey: (options: {
|
|
29116
|
+
ignoreMissingKey?: boolean;
|
|
29117
|
+
}) => any;
|
|
29118
|
+
};
|
|
29119
|
+
workflow: {
|
|
29120
|
+
id: string;
|
|
29121
|
+
deployId: string;
|
|
29122
|
+
runtimeVersion: string;
|
|
29123
|
+
nodeValues: Record<string, any>;
|
|
29124
|
+
env: Record<string, any>;
|
|
29125
|
+
variables: Record<string, any>;
|
|
29126
|
+
inputs: any;
|
|
29127
|
+
outputs: any;
|
|
29128
|
+
nodes: Array<any>;
|
|
29129
|
+
builtNodes: Array<any>;
|
|
29130
|
+
};
|
|
29131
|
+
getBuildShipFile: (x: any) => any;
|
|
29132
|
+
inputProperties: Record<string, any>;
|
|
29133
|
+
env: {
|
|
29134
|
+
set: (args: {
|
|
29135
|
+
name: string;
|
|
29136
|
+
value: string;
|
|
29137
|
+
}[], level: 'workflow' | 'project') => Promise<void>;
|
|
29138
|
+
get: (name: string, level: 'workflow' | 'project') => string | null;
|
|
29139
|
+
triggerEnv: any;
|
|
29140
|
+
workflowId: string;
|
|
29141
|
+
};
|
|
29142
|
+
node: {
|
|
29143
|
+
id: string;
|
|
29144
|
+
};
|
|
29145
|
+
state: Record<string, any>;
|
|
29146
|
+
root: {
|
|
29147
|
+
state: Record<string, any>;
|
|
29148
|
+
inputs: any;
|
|
29149
|
+
};
|
|
29150
|
+
session: {
|
|
29151
|
+
rootState: undefined;
|
|
29152
|
+
sessionId: string;
|
|
29153
|
+
executedNodes: {
|
|
29154
|
+
[key: string]: {
|
|
29155
|
+
ts: number;
|
|
29156
|
+
executionTime: number;
|
|
29157
|
+
nodeId: string;
|
|
29158
|
+
nodeType: string;
|
|
29159
|
+
parents: Array<string>;
|
|
29160
|
+
success: boolean;
|
|
29161
|
+
libId: string;
|
|
29162
|
+
libType: string;
|
|
29163
|
+
};
|
|
29164
|
+
};
|
|
29165
|
+
nodeToTriggerSleep: undefined;
|
|
29166
|
+
stateToTriggerSleep: undefined;
|
|
29167
|
+
isSaved: boolean;
|
|
29168
|
+
isToBeSaved: boolean;
|
|
29169
|
+
isResumed: boolean;
|
|
29170
|
+
initialState: any;
|
|
29171
|
+
};
|
|
29172
|
+
logging: {
|
|
29173
|
+
log: (...x: Array<any>) => void;
|
|
29174
|
+
warn: (...x: Array<any>) => void;
|
|
29175
|
+
error: (...x: Array<any>) => void;
|
|
29176
|
+
};
|
|
29177
|
+
};
|
|
29093
29178
|
|
|
29094
29179
|
type index_BigQueryHelper = BigQueryHelper;
|
|
29095
29180
|
declare const index_BigQueryHelper: typeof BigQueryHelper;
|
|
@@ -29098,6 +29183,7 @@ declare const index_EnvEngine: typeof EnvEngine;
|
|
|
29098
29183
|
type index_JWKSHelper = JWKSHelper;
|
|
29099
29184
|
declare const index_JWKSHelper: typeof JWKSHelper;
|
|
29100
29185
|
type index_Message = Message;
|
|
29186
|
+
type index_NodeOptions = NodeOptions;
|
|
29101
29187
|
type index_PubSubHelper = PubSubHelper;
|
|
29102
29188
|
declare const index_PubSubHelper: typeof PubSubHelper;
|
|
29103
29189
|
type index_Runtime = Runtime;
|
|
@@ -29117,7 +29203,7 @@ declare const index_sanitizeToString: typeof sanitizeToString;
|
|
|
29117
29203
|
declare const index_validate: typeof validate;
|
|
29118
29204
|
declare const index_validateGoogleAuth: typeof validateGoogleAuth;
|
|
29119
29205
|
declare namespace index {
|
|
29120
|
-
export { index_BigQueryHelper as BigQueryHelper, index_EnvEngine as EnvEngine, index_JWKSHelper as JWKSHelper, type index_Message as Message, index_PubSubHelper as PubSubHelper, index_Runtime as Runtime, index_SchedulerHelper as SchedulerHelper, index_Secrets as Secrets, type index_TriggerOnCreateOptions as TriggerOnCreateOptions, type index_TriggerOnExecuteOptions as TriggerOnExecuteOptions, index_getEventTime as getEventTime, index_isCronMessage as isCronMessage, index_isPubSubRequest as isPubSubRequest, index_parseDateOrDefault as parseDateOrDefault, index_sanitize as sanitize, index_sanitizeToString as sanitizeToString, index_validate as validate, index_validateGoogleAuth as validateGoogleAuth };
|
|
29206
|
+
export { index_BigQueryHelper as BigQueryHelper, index_EnvEngine as EnvEngine, index_JWKSHelper as JWKSHelper, type index_Message as Message, type index_NodeOptions as NodeOptions, index_PubSubHelper as PubSubHelper, index_Runtime as Runtime, index_SchedulerHelper as SchedulerHelper, index_Secrets as Secrets, type index_TriggerOnCreateOptions as TriggerOnCreateOptions, type index_TriggerOnExecuteOptions as TriggerOnExecuteOptions, index_getEventTime as getEventTime, index_isCronMessage as isCronMessage, index_isPubSubRequest as isPubSubRequest, index_parseDateOrDefault as parseDateOrDefault, index_sanitize as sanitize, index_sanitizeToString as sanitizeToString, index_validate as validate, index_validateGoogleAuth as validateGoogleAuth };
|
|
29121
29207
|
}
|
|
29122
29208
|
|
|
29123
29209
|
export { index as lib, index$9 as schema, index$1 as types };
|
package/dist/index.js
CHANGED
|
@@ -817,35 +817,20 @@ var PubSubHelper = class extends Runtime {
|
|
|
817
817
|
let topic = await this.findTopic(topicName);
|
|
818
818
|
const metadata = {
|
|
819
819
|
labels: {
|
|
820
|
-
"created-at": (/* @__PURE__ */ new Date()).toISOString(),
|
|
821
|
-
"last-modified-at": (/* @__PURE__ */ new Date()).toISOString(),
|
|
820
|
+
"created-at": (/* @__PURE__ */ new Date()).toISOString().replace(/:/g, "-"),
|
|
821
|
+
"last-modified-at": (/* @__PURE__ */ new Date()).toISOString().replace(/:/g, "-"),
|
|
822
822
|
"created-by-bs-triggerid": this.triggerId,
|
|
823
823
|
"created-by-bs-workflowid": this.workflowId,
|
|
824
824
|
"bs-envname": this.systemEnvName,
|
|
825
825
|
"env": this.envName,
|
|
826
|
-
|
|
826
|
+
[`${this.workflowId}-${this.triggerId}`]: "true"
|
|
827
827
|
}
|
|
828
828
|
};
|
|
829
829
|
const [topicMetadata] = await topic?.getMetadata() || [null];
|
|
830
|
-
const currentUsedBy = (topicMetadata?.labels?.["used-by"] || "").split(",").map((x) => x.split(":").slice(0, 2)).reduce((acc, [wid, envName]) => {
|
|
831
|
-
acc[wid] = acc[wid] || [];
|
|
832
|
-
acc[wid].push(`${envName}---${this.triggerId}`);
|
|
833
|
-
return acc;
|
|
834
|
-
}, {});
|
|
835
|
-
if (currentUsedBy[this.workflowId] && currentUsedBy[this.workflowId].indexOf(`${this.systemEnvName}---${this.triggerId}`) !== -1) {
|
|
836
|
-
currentUsedBy[this.workflowId].push(`${this.systemEnvName}---${this.triggerId}`);
|
|
837
|
-
}
|
|
838
830
|
if (topic) {
|
|
839
|
-
const currentUsedByString = Object.entries(currentUsedBy).reduce((acc, [wid, x]) => {
|
|
840
|
-
x.forEach((y) => {
|
|
841
|
-
acc.push(wid + ":" + y);
|
|
842
|
-
});
|
|
843
|
-
return acc;
|
|
844
|
-
}, []).join(",");
|
|
845
|
-
metadata.labels["used-by"] = currentUsedByString;
|
|
846
831
|
const simMetadata = Object.assign({}, topicMetadata?.labels || {}, metadata.labels);
|
|
847
832
|
if (!(0, import_lodash.default)(topicMetadata?.labels, simMetadata)) {
|
|
848
|
-
simMetadata["last-modified-at"] = (/* @__PURE__ */ new Date()).toISOString();
|
|
833
|
+
simMetadata["last-modified-at"] = (/* @__PURE__ */ new Date()).toISOString().replace(/:/g, "-");
|
|
849
834
|
await topic.setMetadata({
|
|
850
835
|
labels: simMetadata
|
|
851
836
|
});
|
|
@@ -921,8 +906,8 @@ var PubSubHelper = class extends Runtime {
|
|
|
921
906
|
};
|
|
922
907
|
}
|
|
923
908
|
const proposedLabels = {
|
|
924
|
-
"created-at": subscriptionMetaData?.labels?.["created-at"] || (/* @__PURE__ */ new Date()).toISOString(),
|
|
925
|
-
"last-modified-at": subscriptionMetaData?.labels?.["created-at"] || (/* @__PURE__ */ new Date()).toISOString(),
|
|
909
|
+
"created-at": subscriptionMetaData?.labels?.["created-at"] || (/* @__PURE__ */ new Date()).toISOString().replace(/:/g, "-"),
|
|
910
|
+
"last-modified-at": subscriptionMetaData?.labels?.["created-at"] || (/* @__PURE__ */ new Date()).toISOString().replace(/:/g, "-"),
|
|
926
911
|
"env": this.envName,
|
|
927
912
|
"bs-triggerid": this.triggerId,
|
|
928
913
|
"bs-workflowid": this.workflowId,
|
|
@@ -935,7 +920,7 @@ var PubSubHelper = class extends Runtime {
|
|
|
935
920
|
};
|
|
936
921
|
const simLabels = Object.assign({}, subscriptionMetaData?.labels || {}, proposedLabels);
|
|
937
922
|
if (!(0, import_lodash.default)(simLabels, subscriptionMetaData?.labels)) {
|
|
938
|
-
simLabels["last-modified-at"] = (/* @__PURE__ */ new Date()).toISOString();
|
|
923
|
+
simLabels["last-modified-at"] = (/* @__PURE__ */ new Date()).toISOString().replace(/:/g, "-");
|
|
939
924
|
nextMetadata = nextMetadata || {};
|
|
940
925
|
nextMetadata.labels = simLabels;
|
|
941
926
|
}
|