CoreFormsEnum

Overview #

CoreFormsEnum defines standard form identifiers used across the SDK. These are predefined keys for common forms like authorization and rate limiting.

Location: orchesty-nodejs-sdk/lib/Application/Base/CoreFormsEnum.ts

Standard Form Keys #

enum CoreFormsEnum {
    AUTHORIZATION_FORM = 'authorization_form',
    LIMITER_FORM = 'limiter_form',
}

AUTHORIZATION_FORM #

Used for storing authentication credentials.

Value: 'authorization_form'

Purpose: Store API keys, passwords, tokens, OAuth credentials

Usage:

import CoreFormsEnum from '../../lib/Application/Base/CoreFormsEnum';

const form = new Form(CoreFormsEnum.AUTHORIZATION_FORM, 'Authorization');

Accessing credentials:

const settings = applicationInstall.getSettings();
const authForm = settings[CoreFormsEnum.AUTHORIZATION_FORM];
const apiKey = authForm['api_key'];

LIMITER_FORM #

Used for rate limiting configuration.

Value: 'limiter_form'

Purpose: Store rate limiting settings (automatically added by SDK)

Note: This form is automatically injected by the SDK - you typically don't need to create it manually.

Usage Examples #

Authorization Form in Application #

import CoreFormsEnum from '../../lib/Application/Base/CoreFormsEnum';
import Field from '../../lib/Application/Model/Form/Field';
import FieldType from '../../lib/Application/Model/Form/FieldType';
import Form from '../../lib/Application/Model/Form/Form';
import FormStack from '../../lib/Application/Model/Form/FormStack';

public getFormStack(): FormStack {
    const apiKeyField = new Field(FieldType.PASSWORD, 'api_key', 'API Key');
    
    const authForm = new Form(
        CoreFormsEnum.AUTHORIZATION_FORM,  // Use standard key
        'Authorization'
    );
    authForm.addField(apiKeyField);
    
    const formStack = new FormStack();
    formStack.addForm(authForm);
    
    return formStack;
}

Accessing Authorization Form in Connector #

import CoreFormsEnum from '../../lib/Application/Base/CoreFormsEnum';

export default class MyConnector extends AConnector {
    
    public async processAction(dto: ProcessDto): Promise<ProcessDto> {
        const appInstall = await this.getApplicationInstallFromProcess(dto);
        const settings = appInstall.getSettings();
        
        // Access authorization form using standard key
        const authForm = settings[CoreFormsEnum.AUTHORIZATION_FORM];
        const apiKey = authForm['api_key'];
        
        // Use the credentials...
        return dto;
    }
}

OAuth2 Authorization Form #

import { USER, PASSWORD } from '../../lib/Authorization/Type/Basic/ABasicApplication';

public getFormStack(): FormStack {
    const userField = new Field(FieldType.TEXT, USER, 'Username');
    const passwordField = new Field(FieldType.PASSWORD, PASSWORD, 'Password');
    
    const authForm = new Form(
        CoreFormsEnum.AUTHORIZATION_FORM,
        'Authorization'
    );
    authForm.addField(userField);
    authForm.addField(passwordField);
    
    const formStack = new FormStack();
    formStack.addForm(authForm);
    
    return formStack;
}

Next Steps #

  1. Form - Create forms
  2. FormStack - Build form stacks
  3. ABasicApplication - Use CoreFormsEnum in applications
  4. ApplicationInstall - Access form data

See Also #

© 2025 Orchesty Solutions. All rights reserved.