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

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
@@ -123,6 +123,74 @@ export default class ImportProductDbDestination implements Destination {
123
123
  }
124
124
  ```
125
125
 
126
+ ## Usage Examples
127
+
128
+ The `sample/` folder contains two complete ETL implementation examples:
129
+
130
+ ### 1. Books Import (Source → Destination)
131
+
132
+ This example shows a simple ETL process without transformation:
133
+
134
+ **Command:** `node ace import:books`
135
+
136
+ **Components:**
137
+ - **Source**: `book_csv_source.ts` - Reads a CSV file of books (5M records) with batch processing (500 items)
138
+ - **Destination**: `book_db_destination.ts` - Inserts data into database via `db.table().multiInsert()`
139
+
140
+ **Features:**
141
+ - Batch processing for performance optimization
142
+ - CSV error handling (empty lines and errors ignored)
143
+ - Optimized buffer (128KB) for large files
144
+
145
+ ### 2. Products Import (Source → Transform → Destination)
146
+
147
+ This example shows a complete ETL process with data transformation:
148
+
149
+ **Command:** `node ace import:products`
150
+
151
+ **Components:**
152
+ - **Source**: `product_csv_source.ts` - Reads a CSV file of products (500K records)
153
+ - **Transform**: `product_csv_to_db_transform.ts` - Transforms CSV data (French column names → English)
154
+ - **Destination**: `product_db_destination.ts` - Saves via Lucid model `Product.create()`
155
+
156
+ **Features:**
157
+ - Column name transformation (e.g., `Nom` → `name`, `Prix` → `price`)
158
+ - AdonisJS model usage for persistence
159
+ - Data processing logging
160
+
161
+ ### Example Files Structure
162
+
163
+ ```
164
+ sample/
165
+ ├── commands/
166
+ │ ├── import_books.ts # Books import command
167
+ │ └── import_products.ts # Products import command
168
+ ├── etl/
169
+ │ ├── sources/
170
+ │ │ ├── book_csv_source.ts
171
+ │ │ └── product_csv_source.ts
172
+ │ ├── transforms/
173
+ │ │ └── product_csv_to_db_transform.ts
174
+ │ ├── destinations/
175
+ │ │ ├── book_db_destination.ts
176
+ │ │ └── product_db_destination.ts
177
+ │ └── resources/
178
+ │ ├── books.csv # Sample data
179
+ │ └── products.csv # Sample data
180
+ └── app/models/
181
+ ├── book.ts # Book model
182
+ └── product.ts # Product model
183
+ ```
184
+
185
+ These examples demonstrate different possible approaches:
186
+ - **Batch processing** vs **line-by-line processing**
187
+ - **Direct database insertion** vs **Lucid model usage**
188
+ - **With or without data transformation**
189
+
190
+ ## Performance Optimization
191
+
192
+ For large-scale ETL operations, consider integrating with a job queue system (like BullMQ, or AdonisJS Queue package) to run ETL processes asynchronously, distribute workload across multiple workers, and improve reliability with automatic retry mechanisms.
193
+
126
194
  ## Dependencies
127
195
 
128
196
  This package requires:
@@ -190,11 +258,9 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
190
258
 
191
259
  ## Changelog
192
260
 
193
- ### 1.0.0-alpha.1
261
+ ### 1.0.0
194
262
  - Initial release
195
263
  - Interactive ETL component generation
196
264
  - Support for Source, Transform, and Destination components
197
265
  - TypeScript support
198
-
199
- ### 1.0.0-alpha.2
200
266
  - Custom directory configuration support via `directories.etl` in adonisrc.ts
@@ -4,7 +4,7 @@
4
4
  to: app.makePath(app.rcFile.directories['etl'] || 'app/etl/', 'destinations', resourceFileName)
5
5
  })
6
6
  }}}
7
- import { Destination } from '@jrmc/adonis-etl'
7
+ import type { Destination } from '@jrmc/adonis-etl'
8
8
 
9
9
  export default class {{ className }} implements Destination {
10
10
  async write(row: unknown) {
@@ -4,7 +4,7 @@
4
4
  to: app.makePath(app.rcFile.directories['etl'] || 'app/etl/', 'sources', resourceFileName)
5
5
  })
6
6
  }}}
7
- import { Source } from '@jrmc/adonis-etl'
7
+ import type { Source } from '@jrmc/adonis-etl'
8
8
 
9
9
  export default class {{ className }} implements Source {
10
10
  async *each() {
@@ -4,7 +4,7 @@
4
4
  to: app.makePath(app.rcFile.directories['etl'] || 'app/etl/', 'transforms', resourceFileName)
5
5
  })
6
6
  }}}
7
- import { Transform } from '@jrmc/adonis-etl'
7
+ import type { Transform } from '@jrmc/adonis-etl'
8
8
 
9
9
  export default class {{ className }} implements Transform {
10
10
  async process(row: unknown) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jrmc/adonis-etl",
3
- "version": "1.0.0-alpha.3",
3
+ "version": "1.0.1",
4
4
  "keywords": [
5
5
  "adonisjs",
6
6
  "etl",
@@ -50,7 +50,7 @@
50
50
  "prettier": "@adonisjs/prettier-config",
51
51
  "publishConfig": {
52
52
  "access": "public",
53
- "tag": "alpha"
53
+ "tag": "latest"
54
54
  },
55
55
  "volta": {
56
56
  "node": "22.17.0"