Socket
Socket
Sign inDemoInstall

ldap-schema-ts-generator

Package Overview
Dependencies
6
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ldap-schema-ts-generator

Ldap Active Directory Schema Typescript Interface Generator


Version published
Weekly downloads
2
Maintainers
1
Created
Weekly downloads
 

Readme

Source

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";

/**  - object class: account
 *  - child of class: top
 *  - dn: CN=account,CN=Schema,CN=Configuration,DC=ki,DC=local
 */

export interface Account extends Top {
  /**  - attributeSyntax: 2.5.5.12
   *   - attributeID: 0.9.2342.19200300.100.1.1
   *   - adminDisplayName: uid
   *   - adminDescription: A user ID.
   *   - dn: CN=uid,CN=Schema,CN=Configuration,DC=ki,DC=local
   */
  uid?: string[];

  /**  - attributeSyntax: 2.5.5.12
   *   - attributeID: 0.9.2342.19200300.100.1.9
   *   - adminDisplayName: host
   *   - adminDescription: The host attribute type specifies a host computer.
   *   - dn: CN=host,CN=Schema,CN=Configuration,DC=ki,DC=local
   */
  host?: string[];

  /**  - attributeSyntax: 2.5.5.12
   *   - attributeID: 2.5.4.11
   *   - adminDisplayName: Organizational-Unit-Name
   *   - adminDescription: Organizational-Unit-Name
   *   - dn: CN=Organizational-Unit-Name,CN=Schema,CN=Configuration,DC=ki,DC=local
   */
  ou?: string[];

  /**  - attributeSyntax: 2.5.5.12
   *   - attributeID: 2.5.4.10
   *   - adminDisplayName: Organization-Name
   *   - adminDescription: Organization-Name
   *   - dn: CN=Organization-Name,CN=Schema,CN=Configuration,DC=ki,DC=local
   */
  o?: string[];

  /**  - attributeSyntax: 2.5.5.12
   *   - attributeID: 2.5.4.7
   *   - adminDisplayName: Locality-Name
   *   - adminDescription: Locality-Name
   *   - dn: CN=Locality-Name,CN=Schema,CN=Configuration,DC=ki,DC=local
   */
  l?: string;

  /**  - attributeSyntax: 2.5.5.1
   *   - attributeID: 2.5.4.34
   *   - adminDisplayName: See-Also
   *   - adminDescription: See-Also
   *   - dn: CN=See-Also,CN=Schema,CN=Configuration,DC=ki,DC=local
   */
  seeAlso?: object[];

  /**  - attributeSyntax: 2.5.5.12
   *   - attributeID: 2.5.4.13
   *   - adminDisplayName: Description
   *   - adminDescription: Description
   *   - dn: CN=Description,CN=Schema,CN=Configuration,DC=ki,DC=local
   */
  description?: string[];
}

Options:

options?: {
    /** default generated folder of root directory of you project */
    outputFolder?: string;
    /** use prettier to format generated files. default true */
    usePrettier?: boolean;
    /** create index file for output folder. default true */
    indexFile: boolean;
  };

Keywords

FAQs

Last updated on 07 Apr 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc