refactor(core): Move Logger to core (no-changelog) (#12310)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-12-23 13:46:13 +01:00
committed by GitHub
parent b4c77f27b6
commit 471d7b9420
142 changed files with 328 additions and 302 deletions

View File

@@ -1,7 +1,6 @@
import { Client } from 'ldapts';
import type { ClientOptions, Entry } from 'ldapts';
import type { ICredentialDataDecryptedObject, IDataObject } from 'n8n-workflow';
import { LoggerProxy as Logger } from 'n8n-workflow';
import type { ICredentialDataDecryptedObject, IDataObject, Logger } from 'n8n-workflow';
export const BINARY_AD_ATTRIBUTES = ['objectGUID', 'objectSid'];
const resolveEntryBinaryAttributes = (entry: Entry): Entry => {
@@ -18,6 +17,7 @@ export const resolveBinaryAttributes = (entries: Entry[]): void => {
};
export async function createLdapClient(
context: { logger: Logger },
credentials: ICredentialDataDecryptedObject,
nodeDebug?: boolean,
nodeType?: string,
@@ -45,7 +45,7 @@ export async function createLdapClient(
}
if (nodeDebug) {
Logger.info(
context.logger.info(
`[${nodeType} | ${nodeName}] - LDAP Options: ${JSON.stringify(ldapOptions, null, 2)}`,
);
}

View File

@@ -103,7 +103,7 @@ export class Ldap implements INodeType {
credential: ICredentialsDecrypted,
): Promise<INodeCredentialTestResult> {
const credentials = credential.data as ICredentialDataDecryptedObject;
const client = await createLdapClient(credentials);
const client = await createLdapClient(this, credentials);
try {
await client.bind(credentials.bindDN as string, credentials.bindPassword as string);
} catch (error) {
@@ -123,7 +123,7 @@ export class Ldap implements INodeType {
loadOptions: {
async getAttributes(this: ILoadOptionsFunctions) {
const credentials = await this.getCredentials('ldap');
const client = await createLdapClient(credentials);
const client = await createLdapClient(this, credentials);
try {
await client.bind(credentials.bindDN as string, credentials.bindPassword as string);
@@ -153,7 +153,7 @@ export class Ldap implements INodeType {
async getObjectClasses(this: ILoadOptionsFunctions) {
const credentials = await this.getCredentials('ldap');
const client = await createLdapClient(credentials);
const client = await createLdapClient(this, credentials);
try {
await client.bind(credentials.bindDN as string, credentials.bindPassword as string);
} catch (error) {
@@ -196,7 +196,7 @@ export class Ldap implements INodeType {
async getAttributesForDn(this: ILoadOptionsFunctions) {
const credentials = await this.getCredentials('ldap');
const client = await createLdapClient(credentials);
const client = await createLdapClient(this, credentials);
try {
await client.bind(credentials.bindDN as string, credentials.bindPassword as string);
@@ -242,6 +242,7 @@ export class Ldap implements INodeType {
const credentials = await this.getCredentials('ldap');
const client = await createLdapClient(
this,
credentials,
nodeDebug,
this.getNode().type,