Member Junction
    Preparing search index...

    Action that parses CSV data into structured JSON format Supports multiple input sources, custom delimiters, and various parsing options

    // Parse CSV with headers
    await runAction({
    ActionName: 'CSV Parser',
    Params: [{
    Name: 'CSVData',
    Value: 'Name,Age,City\nJohn,30,NYC\nJane,25,LA'
    }]
    });

    // Parse CSV from URL with custom delimiter
    await runAction({
    ActionName: 'CSV Parser',
    Params: [{
    Name: 'FileURL',
    Value: 'https://example.com/data.csv'
    }, {
    Name: 'Delimiter',
    Value: ';'
    }]
    });

    // Parse CSV without headers
    await runAction({
    ActionName: 'CSV Parser',
    Params: [{
    Name: 'CSVData',
    Value: 'John,30,NYC\nJane,25,LA'
    }, {
    Name: 'HasHeaders',
    Value: false
    }]
    });

    Hierarchy

    • BaseFileHandlerAction
      • CSVParserAction
    Index

    Constructors

    Properties

    AuthorizesCaller: boolean

    True when the action authorizes its caller itself, so a public entry point such as the RunAction mutation may run it for an authenticated user without an MJ: Action Authorizations link. Set it only on an action that either checks an authorization the caller must hold, or reads and writes only with the caller's own permissions. Leave it false for an action that acts with more authority than its caller, or that reaches data or sends messages the caller chooses but could not otherwise reach.

    The engine reads the marker only from the class that runs, never from its parent classes. A subclass that overrides a marked action must declare the marker again.

    Methods

    • Get file content from various sources based on parameters Priority: FileID > FileURL > Data parameter

      Parameters

      • params: RunActionParams

        Action parameters

      • dataParamName: string

        Name of the parameter containing direct data

      • fileParamName: string = 'FileID'

        Name of the parameter containing file ID (default: 'FileID')

      • urlParamName: string = 'FileURL'

        Name of the parameter containing file URL (default: 'FileURL')

      Returns Promise<
          {
              content: string
              | Buffer;
              fileName?: string;
              mimeType?: string;
              source: "url" | "storage" | "direct";
          },
      >

      Object with content and metadata

    • Parses CSV data into JSON format

      Parameters

      • params: RunActionParams

        The action parameters containing:

        • CSVData: String containing CSV data (direct input)
        • FileID: UUID of MJ Storage file (alternative)
        • FileURL: URL of CSV file (alternative)
        • HasHeaders: Boolean indicating if first row contains headers (default: true)
        • Delimiter: Field delimiter character (default: ",")
        • QuoteChar: Character used to quote fields (default: '"')
        • EscapeChar: Character used to escape quotes (default: '"')
        • SkipEmptyRows: Skip empty rows (default: true)
        • TrimValues: Trim whitespace from values (default: true)
        • DynamicTyping: Convert numeric strings to numbers (default: true)
        • MaxRows: Maximum number of rows to parse (optional)

      Returns Promise<ActionResultSimple>

      Parsed CSV data as array of objects (if headers) or array of arrays

    • Executes the action with the provided parameters.

      Parameters

      Returns Promise<ActionResultSimple>

      Promise resolving to the action result

    • Save file to MJ Storage. Uploads the content to a FileStorageAccount and creates the corresponding MJ: Files entity record.

      Parameters

      • content: string | Buffer

        File content as string or Buffer

      • fileName: string

        Name for the file

      • mimeType: string

        MIME type of the file

      • params: RunActionParams

        Action parameters (for contextUser)

      • OptionalstorageAccountName: string

        Optional: name of the storage account to use (falls back to first active)

      • OptionalstoragePath: string

        Optional: custom storage path prefix (falls back to artifacts/{date}/{uuid}/)

      Returns Promise<string>

      The ID of the newly created MJ: Files record