@jrmc/adonis-etl 1.0.0-alpha.1 → 1.0.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1 +1,200 @@
1
- # adonis-etl
1
+ # @jrmc/adonis-etl
2
+
3
+ [![npm version](https://badge.fury.io/js/%40jrmc%2Fadonis-etl.svg)](https://badge.fury.io/js/%40jrmc%2Fadonis-etl)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ AdonisJS ETL skaffold commands package - Generate ETL (Extract, Transform, Load) components for your AdonisJS applications.
7
+
8
+ ## Features
9
+
10
+ - 🚀 **Interactive CLI** - Guided command to create ETL components
11
+ - 📦 **Component Generation** - Generate Source, Transform, and Destination classes
12
+ - 🎯 **Smart Naming** - Automatic class naming based on your ETL process
13
+ - 🔧 **TypeScript Ready** - Full TypeScript support with proper interfaces
14
+ - 📁 **Organized Structure** - Files are created in proper directories (`app/etl/`)
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ node ace add @jrmc/adonis-etl
20
+ ```
21
+
22
+ ### Custom Directory Configuration
23
+
24
+ You can customize the directory where ETL files are generated by adding a `directories` configuration to your `adonisrc.ts`:
25
+
26
+ ```typescript
27
+ // adonisrc.ts
28
+ export default defineConfig({
29
+ directories: {
30
+ etl: 'etl', // Custom path for ETL files
31
+ },
32
+ // ... other configurations
33
+ })
34
+ ```
35
+
36
+ If not specified, files will be generated in the default `app/etl/` directory.
37
+
38
+ ## Usage
39
+
40
+ ### Generate ETL Components
41
+
42
+ Run the interactive command to create your ETL components:
43
+
44
+ ```bash
45
+ node ace make:etl my-process
46
+ ```
47
+
48
+ The command will guide you through:
49
+
50
+ 1. **Selecting components** - Choose which ETL components to create:
51
+ - Source (data extraction)
52
+ - Transform (data transformation)
53
+ - Destination (data loading)
54
+
55
+ 2. **Defining source type** - Specify your data source (e.g., `database`, `api`, `file`)
56
+
57
+ 3. **Defining destination type** - Specify your data destination (e.g., `database`, `api`, `file`)
58
+
59
+ ### Example
60
+
61
+ ```bash
62
+ $ node ace make:etl import-product
63
+
64
+ ? Which ETL components do you want to create? ›
65
+ ❯◉ Source
66
+ ◉ Transform
67
+ ◉ Destination
68
+
69
+ ? What is the source type? (e.g., database, api, file) › csv
70
+ ? What is the destination type? (e.g., database, api, file) › db
71
+
72
+ ✅ ETL files created successfully for: import-product
73
+ ```
74
+
75
+ This will create (with default configuration):
76
+
77
+ - `app/etl/sources/import_product_csv_source.ts`
78
+ - `app/etl/transforms/import_product_csv_to_db_transform.ts`
79
+ - `app/etl/destinations/import_product_db_destination.ts`
80
+
81
+ Or with custom directory configuration (`directories.etl: 'Opsone/jerem'`):
82
+
83
+ - `Opsone/jerem/sources/import_product_csv_source.ts`
84
+ - `Opsone/jerem/transforms/import_product_csv_to_db_transform.ts`
85
+ - `Opsone/jerem/destinations/import_product_db_destination.ts`
86
+
87
+ ## Generated Files
88
+
89
+ ### Source Component
90
+
91
+ ```typescript
92
+ import { Source } from '@jrmc/adonis-etl'
93
+
94
+ export default class ImportProductCsvSource implements Source {
95
+ async *each() {
96
+ // Implement your data extraction logic here
97
+ }
98
+ }
99
+ ```
100
+
101
+ ### Transform Component
102
+
103
+ ```typescript
104
+ import { Transform } from '@jrmc/adonis-etl'
105
+
106
+ export default class ImportProductCsvToDbTransform implements Transform {
107
+ async process(row: unknown) {
108
+ // Implement your data transformation logic here
109
+ return row
110
+ }
111
+ }
112
+ ```
113
+
114
+ ### Destination Component
115
+
116
+ ```typescript
117
+ import { Destination } from '@jrmc/adonis-etl'
118
+
119
+ export default class ImportProductDbDestination implements Destination {
120
+ async write(row: unknown) {
121
+ // Implement your data loading logic here
122
+ }
123
+ }
124
+ ```
125
+
126
+ ## Dependencies
127
+
128
+ This package requires:
129
+ - `@jrmc/etl` - The core ETL library
130
+ - AdonisJS 6.x
131
+ - Node.js 22.17.0+
132
+
133
+ ## File Structure
134
+
135
+ Generated files are organized in the following structure:
136
+
137
+ **Default structure:**
138
+ ```
139
+ app/
140
+ └── etl/
141
+ ├── sources/
142
+ │ └── your_source_files.ts
143
+ ├── transforms/
144
+ │ └── your_transform_files.ts
145
+ └── destinations/
146
+ └── your_destination_files.ts
147
+ ```
148
+
149
+ **Custom structure (with `directories.etl: 'src/module/etl'`):**
150
+ ```
151
+ src/
152
+ └── module/
153
+ └── etl/
154
+ ├── sources/
155
+ │ └── your_source_files.ts
156
+ ├── transforms/
157
+ │ └── your_transform_files.ts
158
+ └── destinations/
159
+ └── your_destination_files.ts
160
+ ```
161
+
162
+ ## Naming Convention
163
+
164
+ The generated class names follow this pattern:
165
+
166
+ - **Source**: `{process_name}_{source_type}_source`
167
+ - **Transform**: `{process_name}_{source_type}_to_{destination_type}_transform`
168
+ - **Destination**: `{process_name}_{destination_type}_destination`
169
+
170
+ All names are automatically converted to snake_case for file names and PascalCase for class names.
171
+
172
+ **Example**: For process `import-product` with source `csv` and destination `db`:
173
+ - File: `import_product_csv_source.ts` → Class: `ImportProductCsvSource`
174
+ - File: `import_product_csv_to_db_transform.ts` → Class: `ImportProductCsvToDbTransform`
175
+ - File: `import_product_db_destination.ts` → Class: `ImportProductDbDestination`
176
+
177
+ ## Contributing
178
+
179
+ Contributions are welcome! Please feel free to submit a Pull Request.
180
+
181
+ ## License
182
+
183
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
184
+
185
+ ## Author
186
+
187
+ **Jeremy Chaufourier**
188
+ - Email: jeremy@chaufourier.fr
189
+ - GitHub: [@batosai](https://github.com/batosai)
190
+
191
+ ## Changelog
192
+
193
+ ### 1.0.0-alpha.1
194
+ - Initial release
195
+ - Interactive ETL component generation
196
+ - Support for Source, Transform, and Destination components
197
+ - TypeScript support
198
+
199
+ ### 1.0.0-alpha.2
200
+ - Custom directory configuration support via `directories.etl` in adonisrc.ts
@@ -1,7 +1,7 @@
1
1
  {{#var resourceFileName = string(className).snakeCase().ext('.ts').toString()}}
2
2
  {{{
3
3
  exports({
4
- to: app.makePath('app/etl/destinations', resourceFileName)
4
+ to: app.makePath(app.rcFile.directories['etl'] || 'app/etl/', 'destinations', resourceFileName)
5
5
  })
6
6
  }}}
7
7
  import { Destination } from '@jrmc/adonis-etl'
@@ -1,7 +1,7 @@
1
1
  {{#var resourceFileName = string(className).snakeCase().ext('.ts').toString()}}
2
2
  {{{
3
3
  exports({
4
- to: app.makePath('app/etl/sources', resourceFileName)
4
+ to: app.makePath(app.rcFile.directories['etl'] || 'app/etl/', 'sources', resourceFileName)
5
5
  })
6
6
  }}}
7
7
  import { Source } from '@jrmc/adonis-etl'
@@ -1,7 +1,7 @@
1
1
  {{#var resourceFileName = string(className).snakeCase().ext('.ts').toString()}}
2
2
  {{{
3
3
  exports({
4
- to: app.makePath('app/etl/transforms', resourceFileName)
4
+ to: app.makePath(app.rcFile.directories['etl'] || 'app/etl/', 'transforms', resourceFileName)
5
5
  })
6
6
  }}}
7
7
  import { Transform } from '@jrmc/adonis-etl'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jrmc/adonis-etl",
3
- "version": "1.0.0-alpha.1",
3
+ "version": "1.0.0-alpha.3",
4
4
  "keywords": [
5
5
  "adonisjs",
6
6
  "etl",
@@ -9,7 +9,7 @@
9
9
  ],
10
10
  "author": "Jeremy Chaufourier jeremy@chaufourier.fr",
11
11
  "license": "MIT",
12
- "description": "AdonisJS ETL commands package",
12
+ "description": "AdonisJS ETL skaffold commands package - Generate ETL (Extract, Transform, Load) components for your AdonisJS applications.",
13
13
  "type": "module",
14
14
  "main": "build/index.js",
15
15
  "repository": {