Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.
This repository was archived by the owner on May 14, 2024. It is now read-only.

replace documentation doesnt match with actual behaviour in 3.0.2 #865

@tomnil

Description

@tomnil

Reading the documentation, I would assume this works (it works fine for version 2).

const change = new ldap.Change({
  operation: 'replace',
  modification: {
    pets: ['cat', 'dog']
  }
});

The defined interface Change also suggest that this should work.

export interface Change {
    operation: string;
    modification: {
        [key: string]: any;
    };
}

What's acutally needed in order to pass the Attribute.isAttribute check (if not done like this, an error of modification must be an Attribute will be thrown).

const input: ldapjs.Change = {
	operation: 'replace',
	modification: {
		type: "pets",
		values: ['cat', 'dog']
	}
};

Ps. As a bonus, change the interface to:

export interface Change {
    operation: "add" | "delete" | "replace";
    modification: {
        [key: string]: string | number | whatever-is-allowed-here;
    };
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions