Ldap Active Directory Schema Typescript Generator
How to use
import {
getSchemaAttributes,
getSchemaClasses,
generateInterfaceFiles,
} from "./index";
async function main() {
const schemaDn = "CN=Schema,CN=Configuration,DC=ki,DC=local";
const options = {
user: process.env.AD_USER ?? "",
pass: process.env.AD_Pass ?? "",
ldapServerUrl: process.env.AD_URI ?? "",
};
const objectAttributes = await getSchemaAttributes({ schemaDn, options });
const objectClasses = await getSchemaClasses({ schemaDn, options });
await generateInterfaceFiles({ objectAttributes, objectClasses });
}
main().catch((err) => {
console.log(err);
});
Result
creates typescript interface for each LDAP class that exist in schema
Sample:
import { Top } from "./Top";
export interface Account extends Top {
uid?: string[];
host?: string[];
ou?: string[];
o?: string[];
l?: string;
seeAlso?: object[];
description?: string[];
}
Options:
options?: {
outputFolder?: string;
usePrettier?: boolean;
indexFile: boolean;
};