Interface SerializeFunctionArgs

SerializeFunctionArgs are arguments used to serialize a JavaScript function

interface SerializeFunctionArgs {
    allowSecrets?: boolean;
    exportName?: string;
    isFactoryFunction?: boolean;
    logResource?: Resource;
    serialize?: ((o) => boolean);
}

Properties

allowSecrets?: boolean

If true, allow secrets to be serialized into the function. This should only be set to true if the calling code will handle this and propoerly wrap the resulting text in a Secret before passing it into any Resources or serializing it to any other output format. If set, the containsSecrets property on the returned SerializedFunction object will indicate whether secrets were serialized into the function text.

exportName?: string

The name to export from the module defined by the generated module text. Defaults to 'handler'.

isFactoryFunction?: boolean

If this is a function which, when invoked, will produce the actual entrypoint function. Useful for when serializing a function that has high startup cost that only wants to be run once. The signature of this function should be: () => (provider_handler_args...) => provider_result

This will then be emitted as: exports.[exportName] = serialized_func_name();

In other words, the function will be invoked (once) and the resulting inner function will be what is exported.

logResource?: Resource

The resource to log any errors we encounter against.

serialize?: ((o) => boolean)

A function to prevent serialization of certain objects captured during the serialization. Primarily used to prevent potential cycles.

Type declaration

    • (o): boolean
    • Parameters

      • o: any

      Returns boolean

Generated using TypeDoc