JSPM

@hipsjs/adonis-lucid-uuid

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q39924F
  • License MIT

Addon for adding UUID to AdonisJS Lucid ORM

Package Exports

  • @hipsjs/adonis-lucid-uuid

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@hipsjs/adonis-lucid-uuid) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Adonis Lucid UUID

Works with @adonisjs/lucid@alpha (^8..) (adonis preview v5)

Adds a decorator to Lucid models for a uuid. Uses the uuid package

📄 Installation

Make sure to install it using npm or yarn.

# npm
npm i --save @hipsjs/adonis-lucid-uuid

# yarn
yarn add @hipsjs/adonis-lucid-uuid

Make sure to register the provider inside .adonisrc.json file.

"providers": [
  "@hipsjs/adonis-lucid-uuid"
]

For TypeScript projects add to tsconfig.json file:

"compilerOptions": {
  "types": [
    "@hipsjs/adonis-lucid-uuid"
  ]
}

🔧 Usage

import { BaseModel } from '@ioc:Adonis/Lucid/Orm'
import { withUuid } from '@ioc:Hipsjs/Lucid/Uuid'

@withUuid({ column: 'uid', version: 'v4' })
export default class User extends BaseModel {
  public uid: string
}

the @withUuid decorator supports the following options:

{
    column?: string
    version?: string
    name?: string
    namespace?: string
    isPrimary?: boolean
}

all options are optional and default to:

{
  column: 'uid',                                      
  version: 'v4', 									
  name: 'yourdomain.com',							
  namespace: '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
  isPrimary: false,
}

Name and namespace option are passed for v3 and v5 of uuid

⚙️ Development

See package.json scripts

⭐ Show Your Support

Please give a ⭐ if this project helped you!

💕 Contributing

If you have any questions or requests or want to contribute to @hipsjs/adonis-lucid-uuid or other packages, please write the issue or send in a Pull Request freely.