Skip to content

Install SDK

The install sdk middleware takes care of install and configuring the codedraw-core package to your backend.

Interface

typescript
import { Context } from 'hono';
import { SDK, SDKOptions } from '../sys/types';
export declare const InstallSDK: (options: SDKOptions) => (context: Context, next: Function) => Promise<any>;

Configutations

typescript
export declare type SDKOptions = {
  config?: {
    /**
     * A list of config key to omit from the get config call
     * you can remove nested properties using the dot and square bracket notations, for instance
     * `['properties.myNestedProperty[0].secret']` will remove the property `secret` from the first element
     * within the array `myNestedProperty` within the object `properties`.
     * It is recommended to use this configuration to avoid exposing secrets.
     */
    omits: string[];
  };
  runtime?: {
    storageType: StorageType;
    storageBinding?: string;
    /**
     * Use this config to customise the endpoint uri you want to use.
     */
    endpointUri: string;
    logs?: {
      /**
       * Defines the log level for the logs. Defaults to {@link LogLevel.INFO} when not undefined
       */
      level: LogLevel;
      /**
       * Defines if the logs should be stringified. Defaults to false
       */
      stringifyLog?: boolean;
    };
  };
  /**
   * Use this config to add custom validators for the CRUD operations
   */
  validators?: Validators<any, any>;
  /**
   * Configure the assets implementation
   */
  assets?: {
    /**
     * Sets the limit of how many assets can be resolved in a single request.
     * The requests return a list of signed assets for the client to use.
     * The default is 50 when not specified
     */
    fetchLimit?: number;
    /**
     * Sets the expiration of the signed url in seconds. When not specified the default is 600 seconds (10 minutes)
     * for both upload and get
     */
    signatureTtl?: number;
  };
  /**
   * Use this config to add custom code execution for the records
   */
  overrides?: Overrides<any, any, any>;
  /**
   * This config will disable all the generic routes for the CRUD operations.
   * Including the middleware wiring to extract the sri and the payload from requests.
   * When this config is set to true, all your overrides will be disabled.
   * Turn this setting on to have full control over your API implementation.
   */
  disableGenericImplementation?: boolean;
};