0.0.4 • Published 25 days ago

@kitmi/feat-pipeline v0.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
25 days ago

@kitmi/feat-pipeline

Jacaranda Framework Pipeline Features

@kitmi/feat-pipeline

Features

Installation

To install @kitmi/feat-pipeline, run the following command:

bun add @kitmi/feat-pipeline

Or if you're using npm:

npm install @kitmi/feat-pipeline

Sample

pre:
    define:
        hashAlgorithm: 'sha256'

    pathResolve:
        path: '$input.localPath'
        base: '$app.workingPath'

    fileInfo: # get file info, e.g. size, mime, etc.
        file: 'pathResolve'

    hashFile: 
        algorithm: 'define.hashAlgorithm'
        file: 'pathResolve'

    transform: # transform the input value with type cast and modifiers (validator/processor/activator)
        input: '$input.ref'
        type: 'string'
        post:
            - '|pascalCase'
            - '|toLower'

    dbExistUnique: # check if the record exists in the database
        service: 'prisma'
        model: '$env.modelName'
        where:
            ref: '$input.ref'
            checksum: 'hashFile'
                
    formatObjectKey: # format the object key with string template
        task: format
        template: '${$input.remotePath}/${transform}${fileInfo.extName}'

    uploadCloud:
        when: 
            dbExistUnique: false
        file: 'pathResolve'        
        objectKey: 'formatObjectKey'
        contentType: 'fileInfo.mime'        
        service: 'cloudStorage.aws'
        payload:
            publicRead: true

    copy: # copy from input to data
        input: $input
        filter: # filter out the following keys
            - localPath
            - remotePath

    setUrl:        
        when: 
            dbExistUnique: false
        task: fill
        data:
            url: 'uploadCloud.url'

    fill:
        data:
            name: 'fileInfo.fileName'
            fileSize: 'fileInfo.size'
            mimeType: 'fileInfo.mime'
            storedName: 'formatObjectKey'
            checksum: 'hashFile'

Task Development

Task interface

License

  • MIT
  • Copyright (c) 2023 KITMI PTY LTD
0.0.4

25 days ago

0.0.3

25 days ago

0.0.2

25 days ago

0.0.1

25 days ago