@azure/functions

  • Version 3.0.0
  • Published
  • 13.9 kB
  • No dependencies
  • MIT license

Install

npm i @azure/functions
yarn add @azure/functions
pnpm add @azure/functions

Overview

Azure Functions types for Typescript

Index

Namespaces

namespace @azure/functions

module '@azure/functions' {}

    interface BindingDefinition

    interface BindingDefinition {}

      property direction

      direction: 'in' | 'out' | 'inout' | undefined;
      • The direction of your binding, as defined in function.json.

      property name

      name: string;
      • The name of your binding, as defined in function.json.

      property type

      type: string;
      • The type of your binding, as defined in function.json.

      interface Context

      interface Context {}
      • The context object can be used for writing logs, reading data from bindings, setting outputs and using the context.done callback when your exported function is synchronous. A context object is passed to your function from the Azure Functions runtime on function invocation.

      property bindingData

      bindingData: ContextBindingData;
      • Trigger metadata and function invocation data.

      property bindingDefinitions

      bindingDefinitions: BindingDefinition[];
      • Bindings your function uses, as defined in function.json.

      property bindings

      bindings: ContextBindings;
      • Input and trigger binding data, as defined in function.json. Properties on this object are dynamically generated and named based off of the "name" property in function.json.

      property executionContext

      executionContext: ExecutionContext;
      • Function execution metadata.

      property invocationId

      invocationId: string;
      • A unique GUID per function invocation.

      property log

      log: Logger;
      • Allows you to write streaming function logs. Calling directly allows you to write streaming function logs at the default trace level.

      property req

      req?: HttpRequest;
      • HTTP request object. Provided to your function when using HTTP Bindings.

      property res

      res?: {
      [key: string]: any;
      };
      • HTTP response object. Provided to your function when using HTTP Bindings.

      property traceContext

      traceContext: TraceContext;
      • TraceContext information to enable distributed tracing scenarios.

      method done

      done: (err?: Error | string | null, result?: any) => void;
      • A callback function that signals to the runtime that your code has completed. If your function is synchronous, you must call context.done at the end of execution. If your function is asynchronous, you should not use this callback.

        Parameter err

        A user-defined error to pass back to the runtime. If present, your function execution will fail.

        Parameter result

        An object containing output binding data. result will be passed to JSON.stringify unless it is a string, Buffer, ArrayBufferView, or number.

      interface ContextBindingData

      interface ContextBindingData {}
      • Context binding data. Provided to your function trigger metadata and function invocation data.

      property invocationId

      invocationId: string;
      • A unique GUID per function invocation.

      index signature

      [name: string]: any;

        interface ContextBindings

        interface ContextBindings {}
        • Context bindings object. Provided to your function binding data, as defined in function.json.

        index signature

        [name: string]: any;

          interface Cookie

          interface Cookie {}
          • Http response cookie object to "Set-Cookie"

          property domain

          domain?: string;
          • Specifies allowed hosts to receive the cookie

          property expires

          expires?: Date | number;
          • NOTE: It is generally recommended that you use maxAge over expires. Sets the cookie to expire at a specific date instead of when the client closes. This can be a Javascript Date or Unix time in milliseconds.

          property httpOnly

          httpOnly?: boolean;
          • Sets the cookie to be inaccessible to JavaScript's Document.cookie API

          property maxAge

          maxAge?: number;
          • Number of seconds until the cookie expires. A zero or negative number will expire the cookie immediately.

          property name

          name: string;
          • Cookie name

          property path

          path?: string;
          • Specifies URL path that must exist in the requested URL

          property sameSite

          sameSite?: 'Strict' | 'Lax' | 'None' | undefined;
          • Can restrict the cookie to not be sent with cross-site requests

          property secure

          secure?: boolean;
          • Sets the cookie to only be sent with an encrypted request

          property value

          value: string;
          • Cookie value

          interface Exception

          interface Exception {}

            property message

            message?: string | null;
            • Exception message

            property source

            source?: string | null;
            • Exception source

            property stackTrace

            stackTrace?: string | null;
            • Exception stackTrace

            interface ExecutionContext

            interface ExecutionContext {}

              property functionDirectory

              functionDirectory: string;
              • The directory your function is in (this is the parent directory of this function's function.json).

              property functionName

              functionName: string;
              • The name of the function that is being invoked. The name of your function is always the same as the name of the corresponding function.json's parent directory.

              property invocationId

              invocationId: string;
              • A unique GUID per function invocation.

              property retryContext

              retryContext: RetryContext | null;
              • The retry context of the current function execution or null if the retry policy is not defined.

              interface HttpRequest

              interface HttpRequest {}
              • HTTP request object. Provided to your function when using HTTP Bindings.

              property body

              body?: any;
              • The HTTP request body.

              property headers

              headers: HttpRequestHeaders;
              • HTTP request headers.

              property method

              method: HttpMethod | null;
              • HTTP request method used to invoke this function.

              property params

              params: HttpRequestParams;
              • Route parameter keys and values.

              property query

              query: HttpRequestQuery;
              • Query string parameter keys and values from the URL.

              property rawBody

              rawBody?: any;
              • The HTTP request body as a UTF-8 string.

              property url

              url: string;
              • Request URL.

              interface HttpRequestHeaders

              interface HttpRequestHeaders {}
              • HTTP request headers.

              index signature

              [name: string]: string;

                interface HttpRequestParams

                interface HttpRequestParams {}
                • Route parameter keys and values.

                index signature

                [name: string]: string;

                  interface HttpRequestQuery

                  interface HttpRequestQuery {}
                  • Query string parameter keys and values from the URL.

                  index signature

                  [name: string]: string;

                    interface Logger

                    interface Logger {}
                    • Allows you to write streaming function logs.

                    method error

                    error: (...args: any[]) => void;
                    • Writes to error level logging or lower.

                    method info

                    info: (...args: any[]) => void;
                    • Writes to info level logging or lower.

                    method verbose

                    verbose: (...args: any[]) => void;
                    • Writes to verbose level logging.

                    method warn

                    warn: (...args: any[]) => void;
                    • Writes to warning level logging or lower.

                    call signature

                    (...args: any[]): void;
                    • Writes streaming function logs at the default trace level.

                    interface RetryContext

                    interface RetryContext {}

                      property exception

                      exception?: Exception;
                      • Exception that caused the retry

                      property maxRetryCount

                      maxRetryCount: number;
                      • Max retry count is the maximum number of times an execution is retried before eventual failure. A value of -1 means to retry indefinitely.

                      property retryCount

                      retryCount: number;
                      • Current retry count of the function executions.

                      interface Timer

                      interface Timer {}
                      • Timer schedule information. Provided to your function when using a timer binding.

                      property isPastDue

                      isPastDue: boolean;
                      • Whether this timer invocation is due to a missed schedule occurrence.

                      property schedule

                      schedule: {
                      /**
                      * Whether intervals between invocations should account for DST.
                      */
                      adjustForDST: boolean;
                      };

                        property scheduleStatus

                        scheduleStatus: {
                        /**
                        * The last recorded schedule occurrence. Date ISO string.
                        */
                        last: string;
                        /**
                        * The expected next schedule occurrence. Date ISO string.
                        */
                        next: string;
                        /**
                        * The last time this record was updated. This is used to re-calculate `next` with the current schedule after a host restart. Date ISO string.
                        */
                        lastUpdated: string;
                        };

                          interface TraceContext

                          interface TraceContext {}
                          • TraceContext information to enable distributed tracing scenarios.

                          property attributes

                          attributes:
                          | {
                          [k: string]: string;
                          }
                          | null
                          | undefined;
                          • Holds additional properties being sent as part of request telemetry.

                          property traceparent

                          traceparent: string | null | undefined;
                          • Describes the position of the incoming request in its trace graph in a portable, fixed-length format.

                          property tracestate

                          tracestate: string | null | undefined;
                          • Extends traceparent with vendor-specific data.

                          type AzureFunction

                          type AzureFunction = (context: Context, ...args: any[]) => Promise<any> | void;
                          • Interface for your Azure Function code. This function must be exported (via module.exports or exports) and will execute when triggered. It is recommended that you declare this function as async, which implicitly returns a Promise.

                            Parameter context

                            Context object passed to your function from the Azure Functions runtime.

                            Parameter args

                            Optional array of input and trigger binding data. These binding data are passed to the function in the same order that they are defined in function.json. Valid input types are string, HttpRequest, and Buffer.

                            Returns

                            Output bindings (optional). If you are returning a result from a Promise (or an async function), this result will be passed to JSON.stringify unless it is a string, Buffer, ArrayBufferView, or number.

                          type HttpMethod

                          type HttpMethod =
                          | 'GET'
                          | 'POST'
                          | 'DELETE'
                          | 'HEAD'
                          | 'PATCH'
                          | 'PUT'
                          | 'OPTIONS'
                          | 'TRACE'
                          | 'CONNECT';
                          • Possible values for an HTTP request method.

                          Package Files (1)

                          Dependencies (0)

                          No dependencies.

                          Dev Dependencies (0)

                          No dev dependencies.

                          Peer Dependencies (0)

                          No peer dependencies.

                          Badge

                          To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                          You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@azure/functions.

                          • Markdown
                            [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@azure/functions)
                          • HTML
                            <a href="https://www.jsdocs.io/package/@azure/functions"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>