1- # MobX- RESTful- migrator
1+ # MobX RESTful migrator
22
33Data Migration framework based on [ MobX-RESTful] [ 1 ]
44
5+ [ ![ NPM Dependency] ( https://img.shields.io/librariesio/github/idea2app/MobX-RESTful-migrator.svg )] [ 2 ]
6+ [ ![ CI & CD] ( https://github.com/idea2app/MobX-RESTful-migrator/actions/workflows/main.yml/badge.svg )] [ 3 ]
7+
8+ [ ![ NPM] ( https://nodei.co/npm/mobx-restful-migrator.png?downloads=true&downloadRank=true&stars=true )] [ 4 ]
9+
510## Overview
611
712MobX-RESTful-migrator is a TypeScript library that provides a flexible data migration framework built on top of MobX-RESTful's ListModel abstraction. It allows you to migrate data from various sources through MobX-RESTful models with customizable field mappings and relationships.
@@ -50,7 +55,7 @@ import { buildURLData } from 'web-utility';
5055
5156export abstract class TableModel <
5257 D extends DataObject ,
53- F extends Filter <D > = Filter <D >
58+ F extends Filter <D > = Filter <D >,
5459> extends ListModel <D , F > {
5560 client = new HTTPClient ({ baseURI: ' http://localhost:8080' , responseType: ' json' });
5661
@@ -65,7 +70,7 @@ export abstract class TableModel<
6570
6671 async loadPage(pageIndex : number , pageSize : number , filter : F ) {
6772 const { body } = await this .client .get <{ list: D []; count: number }>(
68- ` ${this .baseURI }?${buildURLData ({ ... filter , pageIndex , pageSize })} `
73+ ` ${this .baseURI }?${buildURLData ({ ... filter , pageIndex , pageSize })} ` ,
6974 );
7075 return { pageData: body ! .list , totalCount: body ! .count };
7176 }
@@ -135,7 +140,6 @@ const loadSourceArticles = () => readCSV<SourceArticle>('article.csv');
135140
136141// Complete migration configuration demonstrating all 4 mapping types
137142const mapping: MigrationSchema <SourceArticle , Article > = {
138-
139143 // 1. Many-to-One mapping: Title + Subtitle → combined title
140144 title : ({ title , subtitle }) => ({
141145 title: { value: ` ${title }: ${subtitle } ` },
@@ -198,7 +202,7 @@ const migratorWithCustomLogger = new RestMigrator(
198202 loadSourceArticles ,
199203 ArticleModel ,
200204 mapping ,
201- new CustomEventBus ()
205+ new CustomEventBus (),
202206);
203207```
204208
@@ -332,3 +336,6 @@ const migrator = new RestMigrator(loadSourceArticles, ArticleModel, mapping, new
332336```
333337
334338[ 1 ] : https://github.com/idea2app/MobX-RESTful
339+ [ 2 ] : https://libraries.io/npm/mobx-restful-migrator
340+ [ 3 ] : https://github.com/idea2app/MobX-RESTful-migrator/actions/workflows/main.yml
341+ [ 4 ] : https://nodei.co/npm/mobx-restful-migrator/
0 commit comments