Skip to content

Commit 5aa41ce

Browse files
author
fernandocode
committed
0.3.0-beta.2
Complete migration to ionic 4.0+ and angular 6.0+. With basic unit tests and compatible with AOT compilation.
1 parent 10f9ebd commit 5aa41ce

31 files changed

+600
-489
lines changed

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
"version": "0.0.0",
44
"scripts": {
55
"ng": "ng",
6-
"start": "ng serve",
7-
"build": "ng build ionic-database-builder",
6+
"start": "ng serve --aot",
7+
"build": "ng build ionic-database-builder --prod",
88
"postbuild": "node scripts/copy-artifacts.js",
99
"test": "ng test",
1010
"lint": "ng lint",
11-
"e2e": "ng e2e"
11+
"e2e": "ng e2e",
12+
"publish": "npm run build && npm publish dist/ionic-database-builder"
1213
},
1314
"private": true,
1415
"dependencies": {

projects/ionic-database-builder/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ionic-database-builder",
3-
"version": "0.3.0-beta.1",
3+
"version": "0.3.0-beta.2",
44
"description": "Extended library from database-builder to assist in creating and maintaining SQL commands. Allowing integrate execute commands with SQLite ('@ionic-native/sqlite'), Web Sql, etc. Through the interface injection 'DatabaseCreatorContract' returning an implementation of 'DatabaseObject'.",
55
"repository": {
66
"type": "git",

projects/ionic-database-builder/src/lib/defaults/database-factory-default.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import { DatabaseObject, DatabaseCreatorContract } from "database-builder";
44
import { Observable, Observer } from "rxjs";
55
import { DATABASE_CREATOR, IS_AVAILABLE_DATABASE } from '../utils/dependency-injection-definition';
66

7-
@Injectable({
8-
providedIn: 'root'
9-
})
7+
@Injectable()
108
export class DatabaseFactoryDefault extends DatabaseFactoryContract {
119

1210
constructor(

projects/ionic-database-builder/src/lib/defaults/database-settings-factory-default.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ import { Injector, Injectable } from "@angular/core";
33
import { DatabaseSettingsModel } from "../model/database-settings-model";
44
import { DatabaseSettingsFactoryContract } from 'ionic-database-builder';
55

6-
@Injectable({
7-
providedIn: 'root'
8-
})
6+
@Injectable()
97
export class DatabaseSettingsFactoryDefault extends DatabaseSettingsFactoryContract {
108

119
private _model: DatabaseSettingsModel;

projects/ionic-database-builder/src/lib/defaults/mappers-table-simple.ts

Lines changed: 0 additions & 63 deletions
This file was deleted.

projects/ionic-database-builder/src/lib/ionic-database-builder.component.spec.ts

Lines changed: 0 additions & 25 deletions
This file was deleted.

projects/ionic-database-builder/src/lib/ionic-database-builder.component.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

projects/ionic-database-builder/src/lib/ionic-database-builder.module.ts

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,62 @@
11
import { DatabaseCreatorContract } from 'database-builder';
2-
import { NgModule, Type, ModuleWithProviders } from '@angular/core';
3-
// import { IonicDatabaseBuilderComponent } from './ionic-database-builder.component';
2+
import { Type, ModuleWithProviders, NgModule, SkipSelf, Optional } from '@angular/core';
43
import { DatabaseMigrationContract } from './services/database-migration-contract';
54
import { DatabaseSettingsFactoryContract } from './utils/database-settings-factory-contract';
65
import { IS_AVAILABLE_DATABASE, DATABASE_CREATOR, IS_ENABLE_LOG, DATABASE_MIGRATION } from './utils/dependency-injection-definition';
76
import { Database } from './services/database';
87
import { DatabaseMigration } from './services/database-migration';
9-
import { DatabaseHelperService } from './services/database-helper-service';
8+
import { DatabaseHelperService } from './services/database-helper.service';
109
import { DatabaseFactoryDefault } from './defaults/database-factory-default';
1110
import { DatabaseFactoryContract } from './utils/database-factory-contract';
1211

1312
@NgModule({
14-
// // declarations: [IonicDatabaseBuilderComponent],
15-
// imports: [
16-
// ],
17-
// // exports: [IonicDatabaseBuilderComponent],
18-
// providers: [
19-
// // DatabaseMigration,
20-
// // Database,
21-
// // DatabaseHelperService,
22-
// // {
23-
// // provide: DATABASE_FACTORY,
24-
// // useClass: DatabaseFactoryDefault
25-
// // }
26-
// ]
13+
providers: [
14+
DatabaseMigration,
15+
Database,
16+
DatabaseHelperService,
17+
{
18+
provide: DatabaseFactoryContract,
19+
useClass: DatabaseFactoryDefault
20+
}
21+
]
2722
})
2823
export class IonicDatabaseBuilderModule {
2924

25+
constructor(@Optional() @SkipSelf() parentModule: IonicDatabaseBuilderModule) {
26+
if (parentModule) {
27+
throw new Error(
28+
'IonicDatabaseBuilderModule is already loaded. Import it in the AppModule only');
29+
}
30+
}
31+
32+
public static forSimple(
33+
isEnableLogProvider: boolean = false,
34+
isAvailableProvider: boolean = true
35+
): ModuleWithProviders {
36+
return {
37+
ngModule: IonicDatabaseBuilderModule,
38+
providers: [
39+
{ provide: IS_ENABLE_LOG, useValue: isEnableLogProvider },
40+
{ provide: IS_AVAILABLE_DATABASE, useValue: isAvailableProvider },
41+
]
42+
};
43+
}
44+
3045
public static forRoot(
3146
settingsProvider: Type<DatabaseSettingsFactoryContract>,
32-
isAvailableProvider: boolean,
3347
databaseCreatorProvider: Type<DatabaseCreatorContract>,
34-
isEnableLogProvider: boolean,
35-
databaseMigrationContract: Type<DatabaseMigrationContract>
48+
databaseMigrationContract: Type<DatabaseMigrationContract>,
49+
isEnableLogProvider: boolean = false,
50+
isAvailableProvider: boolean = true,
3651
): ModuleWithProviders {
3752
return {
3853
ngModule: IonicDatabaseBuilderModule,
3954
providers: [
4055
{ provide: DatabaseSettingsFactoryContract, useClass: settingsProvider },
41-
{ provide: IS_AVAILABLE_DATABASE, useValue: isAvailableProvider },
4256
{ provide: DATABASE_CREATOR, useClass: databaseCreatorProvider },
43-
{ provide: IS_ENABLE_LOG, useValue: isEnableLogProvider },
4457
{ provide: DATABASE_MIGRATION, useClass: databaseMigrationContract },
45-
46-
DatabaseMigration,
47-
Database,
48-
DatabaseHelperService,
49-
{
50-
provide: DatabaseFactoryContract,
51-
useClass: DatabaseFactoryDefault
52-
}
58+
{ provide: IS_ENABLE_LOG, useValue: isEnableLogProvider },
59+
{ provide: IS_AVAILABLE_DATABASE, useValue: isAvailableProvider },
5360
]
5461
};
5562
}

projects/ionic-database-builder/src/lib/ionic-database-builder.service.spec.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.

projects/ionic-database-builder/src/lib/ionic-database-builder.service.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)