mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 03:12:15 +00:00
refactor: Upgrade to TypeScript 5.5 (no-changelog) (#9828)
This commit is contained in:
@@ -116,7 +116,7 @@ export class ExternalSecretsManager {
|
||||
)
|
||||
).map((i) => (i.status === 'rejected' ? null : i.value));
|
||||
this.providers = Object.fromEntries(
|
||||
(providers.filter((p) => p !== null) as SecretsProvider[]).map((s) => [s.name, s]),
|
||||
providers.filter((p): p is SecretsProvider => p !== null).map((s) => [s.name, s]),
|
||||
);
|
||||
this.cachedSettings = settings;
|
||||
await this.updateSecrets();
|
||||
|
||||
@@ -458,7 +458,7 @@ export class VaultProvider extends SecretsProvider {
|
||||
)
|
||||
)
|
||||
.map((i) => (i.status === 'rejected' ? null : i.value))
|
||||
.filter((v) => v !== null) as Array<[string, IDataObject]>,
|
||||
.filter((v): v is [string, IDataObject] => v !== null),
|
||||
);
|
||||
const name = path.substring(0, path.length - 1);
|
||||
return [name, data];
|
||||
@@ -480,7 +480,7 @@ export class VaultProvider extends SecretsProvider {
|
||||
return [basePath.substring(0, basePath.length - 1), value[1]];
|
||||
}),
|
||||
)
|
||||
).filter((v) => v !== null) as Array<[string, IDataObject]>,
|
||||
).filter((v): v is [string, IDataObject] => v !== null),
|
||||
);
|
||||
this.cachedSecrets = secrets;
|
||||
}
|
||||
|
||||
@@ -1047,10 +1047,8 @@ function getWorkflowHooksIntegrated(
|
||||
const hookFunctions = hookFunctionsSave();
|
||||
const preExecuteFunctions = hookFunctionsPreExecute();
|
||||
for (const key of Object.keys(preExecuteFunctions)) {
|
||||
if (hookFunctions[key] === undefined) {
|
||||
hookFunctions[key] = [];
|
||||
}
|
||||
hookFunctions[key]!.push.apply(hookFunctions[key], preExecuteFunctions[key]);
|
||||
const hooks = hookFunctions[key] ?? [];
|
||||
hooks.push.apply(hookFunctions[key], preExecuteFunctions[key]);
|
||||
}
|
||||
return new WorkflowHooks(hookFunctions, mode, executionId, workflowData);
|
||||
}
|
||||
@@ -1069,10 +1067,8 @@ export function getWorkflowHooksWorkerExecuter(
|
||||
const hookFunctions = hookFunctionsSaveWorker();
|
||||
const preExecuteFunctions = hookFunctionsPreExecute();
|
||||
for (const key of Object.keys(preExecuteFunctions)) {
|
||||
if (hookFunctions[key] === undefined) {
|
||||
hookFunctions[key] = [];
|
||||
}
|
||||
hookFunctions[key]!.push.apply(hookFunctions[key], preExecuteFunctions[key]);
|
||||
const hooks = hookFunctions[key] ?? [];
|
||||
hooks.push.apply(hookFunctions[key], preExecuteFunctions[key]);
|
||||
}
|
||||
|
||||
return new WorkflowHooks(hookFunctions, mode, executionId, workflowData, optionalParameters);
|
||||
@@ -1139,18 +1135,14 @@ export function getWorkflowHooksMain(
|
||||
const hookFunctions = hookFunctionsSave();
|
||||
const pushFunctions = hookFunctionsPush();
|
||||
for (const key of Object.keys(pushFunctions)) {
|
||||
if (hookFunctions[key] === undefined) {
|
||||
hookFunctions[key] = [];
|
||||
}
|
||||
hookFunctions[key]!.push.apply(hookFunctions[key], pushFunctions[key]);
|
||||
const hooks = hookFunctions[key] ?? [];
|
||||
hooks.push.apply(hookFunctions[key], pushFunctions[key]);
|
||||
}
|
||||
|
||||
const preExecuteFunctions = hookFunctionsPreExecute();
|
||||
for (const key of Object.keys(preExecuteFunctions)) {
|
||||
if (hookFunctions[key] === undefined) {
|
||||
hookFunctions[key] = [];
|
||||
}
|
||||
hookFunctions[key]!.push.apply(hookFunctions[key], preExecuteFunctions[key]);
|
||||
const hooks = hookFunctions[key] ?? [];
|
||||
hooks.push.apply(hookFunctions[key], preExecuteFunctions[key]);
|
||||
}
|
||||
|
||||
if (!hookFunctions.nodeExecuteBefore) hookFunctions.nodeExecuteBefore = [];
|
||||
|
||||
@@ -737,8 +737,10 @@ export class ExecuteBatch extends BaseCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if (nodeEdgeCases[nodeName].capResults !== undefined) {
|
||||
executionDataArray.splice(nodeEdgeCases[nodeName].capResults!);
|
||||
const capResults = nodeEdgeCases[nodeName].capResults;
|
||||
|
||||
if (capResults !== undefined) {
|
||||
executionDataArray.splice(capResults);
|
||||
}
|
||||
|
||||
if (nodeEdgeCases[nodeName].ignoredProperties !== undefined) {
|
||||
|
||||
@@ -235,13 +235,14 @@ export class SourceControlExportService {
|
||||
data: ICredentialDataDecryptedObject,
|
||||
): ICredentialDataDecryptedObject => {
|
||||
for (const [key] of Object.entries(data)) {
|
||||
const value = data[key];
|
||||
try {
|
||||
if (data[key] === null) {
|
||||
if (value === null) {
|
||||
delete data[key]; // remove invalid null values
|
||||
} else if (typeof data[key] === 'object') {
|
||||
data[key] = this.replaceCredentialData(data[key] as ICredentialDataDecryptedObject);
|
||||
} else if (typeof data[key] === 'string') {
|
||||
data[key] = stringContainsExpression(data[key] as string) ? data[key] : '';
|
||||
} else if (typeof value === 'object') {
|
||||
data[key] = this.replaceCredentialData(value as ICredentialDataDecryptedObject);
|
||||
} else if (typeof value === 'string') {
|
||||
data[key] = stringContainsExpression(value) ? data[key] : '';
|
||||
} else if (typeof data[key] === 'number') {
|
||||
// TODO: leaving numbers in for now, but maybe we should remove them
|
||||
continue;
|
||||
|
||||
@@ -84,8 +84,8 @@ export class SourceControlImportService {
|
||||
}),
|
||||
);
|
||||
return remoteWorkflowFilesParsed.filter(
|
||||
(e) => e !== undefined,
|
||||
) as SourceControlWorkflowVersionId[];
|
||||
(e): e is SourceControlWorkflowVersionId => e !== undefined,
|
||||
);
|
||||
}
|
||||
|
||||
public async getLocalVersionIdsFromDb(): Promise<SourceControlWorkflowVersionId[]> {
|
||||
|
||||
@@ -148,13 +148,15 @@ export class Telemetry {
|
||||
properties.success ? 'success' : 'error'
|
||||
}`;
|
||||
|
||||
if (!this.executionCountsBuffer[workflowId][key]) {
|
||||
const executionTrackDataKey = this.executionCountsBuffer[workflowId][key];
|
||||
|
||||
if (!executionTrackDataKey) {
|
||||
this.executionCountsBuffer[workflowId][key] = {
|
||||
count: 1,
|
||||
first: execTime,
|
||||
};
|
||||
} else {
|
||||
this.executionCountsBuffer[workflowId][key]!.count++;
|
||||
executionTrackDataKey.count++;
|
||||
}
|
||||
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user