Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular 10+ compatibility #663

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Use the development branch to create a new branch from. If adding new features a
# OIDC-SSO Service
A new campaing to call developers to register as beta testers for the [OnixJS](https://onixjs.io) Single Sign-On Service is active now. This campaing will be running during the month of June 2018, allowing all of those registered users to have early access during closed beta.

- _Closed beta access will be active starting from July 2108._
- _Closed beta access will be active starting from July 2018._

Register now and get the chance to have an unlimited annual enterprise membership for free.

Expand Down
259 changes: 130 additions & 129 deletions lib/angular2/shared/index.ejs
Original file line number Diff line number Diff line change
@@ -1,139 +1,140 @@
/* tslint:disable */
/**
* @module SDKModule
* @author Jonathan Casarrubias <t:@johncasarrubias> <gh:jonathan-casarrubias>
* @license MIT 2016 Jonathan Casarrubias
* @version 2.1.0
* @description
* The SDKModule is a generated Software Development Kit automatically built by
* the LoopBack SDK Builder open source module.
*
* The SDKModule provides Angular 2 >= RC.5 support, which means that NgModules
* can import this Software Development Kit as follows:
*
*
* APP Route Module Context
* ============================================================================
* import { NgModule } from '@angular/core';
* import { BrowserModule } from '@angular/platform-browser';
* // App Root
* import { AppComponent } from './app.component';
* // Feature Modules
* import { SDK[Browser|Node|Native]Module } from './shared/sdk/sdk.module';
* // Import Routing
* import { routing } from './app.routing';
* @NgModule({
* imports: [
* BrowserModule,
* routing,
* SDK[Browser|Node|Native]Module.forRoot()
* ],
* declarations: [ AppComponent ],
* bootstrap: [ AppComponent ]
* })
* export class AppModule { }
*
**/
<%- buildModuleImports(models, isIo, driver) %>
<% if ( driver === 'ng2web' || driver === 'ng2universal' ) { -%>
/**
* @module SDKBrowserModule
* @description
* This module should be imported when building a Web Application in the following scenarios:
*
* 1.- Regular web application
* 2.- Angular universal application (Browser Portion)
* 3.- Progressive applications (Angular Mobile, Ionic, WebViews, etc)
**/
@NgModule({
imports: [ CommonModule, HttpClientModule ],
declarations: [ ],
exports: [ ],
providers: [
* @author Jonathan Casarrubias <t:@johncasarrubias>
<gh:jonathan-casarrubias>
* @license MIT 2016 Jonathan Casarrubias
* @version 2.1.0
* @description
* The SDKModule is a generated Software Development Kit automatically built by
* the LoopBack SDK Builder open source module.
*
* The SDKModule provides Angular 2 >= RC.5 support, which means that NgModules
* can import this Software Development Kit as follows:
*
*
* APP Route Module Context
* ============================================================================
* import { NgModule } from '@angular/core';
* import { BrowserModule } from '@angular/platform-browser';
* // App Root
* import { AppComponent } from './app.component';
* // Feature Modules
* import { SDK[Browser|Node|Native]Module } from './shared/sdk/sdk.module';
* // Import Routing
* import { routing } from './app.routing';
* @NgModule({
* imports: [
* BrowserModule,
* routing,
* SDK[Browser|Node|Native]Module.forRoot()
* ],
* declarations: [ AppComponent ],
* bootstrap: [ AppComponent ]
* })
* export class AppModule { }
*
**/
<%- buildModuleImports(models, isIo, driver) %>
<% if ( driver === 'ng2web' || driver === 'ng2universal' ) { -%>
/**
* @module SDKBrowserModule
* @description
* This module should be imported when building a Web Application in the following scenarios:
*
* 1.- Regular web application
* 2.- Angular universal application (Browser Portion)
* 3.- Progressive applications (Angular Mobile, Ionic, WebViews, etc)
**/
@NgModule({
imports: [ CommonModule, HttpClientModule ],
declarations: [ ],
exports: [ ],
providers: [
<%- buildNgProviders(isIo) %>
]
})
export class SDKBrowserModule {
static forRoot(internalStorageProvider: any = {
]
})
export class SDKBrowserModule {
static forRoot(internalStorageProvider: any = {
provide: InternalStorage,
useClass: CookieBrowser
}): ModuleWithProviders {
return {
ngModule : SDKBrowserModule,
}): ModuleWithProviders<SDKBrowserModule> {
return {
ngModule : SDKBrowserModule,
providers : [
<%- buildNgModuleImports(models, 'browser', isIo, driver) %>
<%- buildNgModuleImports(models, 'browser', isIo, driver) %>
]
};
}
}
<% } -%>
<% if ( driver === 'ng2universal' ) { -%>
/**
* @module SDKNodeModule
* @description
* This module should be imported when building a Angular Universal Application.
**/
@NgModule({
imports: [ CommonModule, HttpModule ],
declarations: [ ],
exports: [ ],
providers: [
<%- buildNgProviders(isIo) %>
]
})
export class SDKNodeModule {
static forRoot(): ModuleWithProviders {
return {
ngModule : SDKNodeModule,
providers : [
<%- buildNgModuleImports(models, 'node', isIo, driver) %>
};
}
}
<% } -%>
<% if ( driver === 'ng2universal' ) { -%>
/**
* @module SDKNodeModule
* @description
* This module should be imported when building a Angular Universal Application.
**/
@NgModule({
imports: [ CommonModule, HttpModule ],
declarations: [ ],
exports: [ ],
providers: [
<%- buildNgProviders(isIo) %>
]
};
}
}
<% } -%>
<% if ( driver === 'ng2native' ) { -%>
/**
* @module SDKNativeModule
* @description
* This module should be imported when building a NativeScript Applications.
**/
@NgModule({
imports: [ CommonModule, NativeScriptHttpModule ],
declarations: [ ],
exports: [ ],
providers: [
<%- buildNgProviders(isIo) %>
]
})
export class SDKNativeModule {
static forRoot(): ModuleWithProviders {
return {
ngModule : SDKNativeModule,
providers : [
<%- buildNgModuleImports(models, 'nativescript', isIo, driver) %>
]
};
}
}
<% } -%>
/**
* Have Fun!!!
* - Jon
**/
export * from './models/index';
export * from './services/index';
export * from './lb.config';
<% if ( driver === 'ng2web' ) { -%>
export * from './storage/storage.swaps';
export { CookieBrowser } from './storage/cookie.browser';
export { StorageBrowser } from './storage/storage.browser';
<% } -%>
})
export class SDKNodeModule {
static forRoot(): ModuleWithProviders<SDKNodeModule> {
return {
ngModule : SDKNodeModule,
providers : [
<%- buildNgModuleImports(models, 'node', isIo, driver) %>
]
};
}
}
<% } -%>
<% if ( driver === 'ng2native' ) { -%>
/**
* @module SDKNativeModule
* @description
* This module should be imported when building a NativeScript Applications.
**/
@NgModule({
imports: [ CommonModule, NativeScriptHttpModule ],
declarations: [ ],
exports: [ ],
providers: [
<%- buildNgProviders(isIo) %>
]
})
export class SDKNativeModule {
static forRoot(): ModuleWithProviders<SDKNativeModule> {
return {
ngModule : SDKNativeModule,
providers : [
<%- buildNgModuleImports(models, 'nativescript', isIo, driver) %>
]
};
}
}
<% } -%>
/**
* Have Fun!!!
* - Jon
**/
export * from './models/index';
export * from './services/index';
export * from './lb.config';
<% if ( driver === 'ng2web' ) { -%>
export * from './storage/storage.swaps';
export { CookieBrowser } from './storage/cookie.browser';
export { StorageBrowser } from './storage/storage.browser';
<% } -%>

<% if ( isNgrx === 'enabled' || isNgrx === 'orm' ) { -%>
export * from './actions/index';
export * from './reducers/index';
export * from './state';
export * from './guards/index';
export * from './resolvers/index';
<% } -%>
<% if ( isNgrx === 'enabled' || isNgrx === 'orm' ) { -%>
export * from './actions/index';
export * from './reducers/index';
export * from './state';
export * from './guards/index';
export * from './resolvers/index';
<% } -%>
1 change: 1 addition & 0 deletions lib/angular2/shared/models/base.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export class SDKToken implements AccessTokenInterface {
userId: any = null;
user: any = null;
rememberMe: boolean = null;
principalType: string = null;
constructor(data?: AccessTokenInterface) {
Object.assign(this, data);
}
Expand Down
34 changes: 17 additions & 17 deletions lib/angular2/shared/orm/index.ejs
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
/* tslint:disable */
import {
NgModule,
ModuleWithProviders,
Optional,
SkipSelf
NgModule,
ModuleWithProviders,
Optional,
SkipSelf
} from '@angular/core';
import { Orm } from './orm';

export * from './orm';

@NgModule({})
export class OrmModule {
constructor(@Optional() @SkipSelf() parentModule: OrmModule) {
if (parentModule) {
throw new Error(
'OrmModule.forRoot() called twice. Lazy loaded modules do not need to import OrmModule.',
);
}
}
constructor(@Optional() @SkipSelf() parentModule: OrmModule) {
if (parentModule) {
throw new Error(
'OrmModule.forRoot() called twice. Lazy loaded modules do not need to import OrmModule.',
);
}
}

static forRoot(): ModuleWithProviders {
return {
ngModule: OrmModule,
providers: [ Orm ]
};
static forRoot(): ModuleWithProviders<OrmModule> {
return {
ngModule: OrmModule,
providers: [ Orm ]
};
}
}
}
2 changes: 2 additions & 0 deletions lib/angular2/shared/services/core/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export class LoopBackAuth {
this.token.created = this.load('created');
this.token.ttl = this.load('ttl');
this.token.rememberMe = this.load('rememberMe');
this.token.principalType = this.load('principalType');
}
/**
* @method setRememberMe
Expand Down Expand Up @@ -121,6 +122,7 @@ export class LoopBackAuth {
this.persist('created', this.token.created, expires);
this.persist('ttl', this.token.ttl, expires);
this.persist('rememberMe', this.token.rememberMe, expires);
this.persist('principalType', this.token.principalType, expires);
return true;
};
/**
Expand Down
Loading