Skip to content

Commit

Permalink
Initial migration. No compilation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbrazzatti committed May 12, 2023
1 parent b41cb87 commit f8e4a67
Show file tree
Hide file tree
Showing 42 changed files with 2,513 additions and 513 deletions.
105 changes: 97 additions & 8 deletions core/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"lodash": "^4.17.21",
"moment": "^2.29.1",
"path-exists": "^5.0.0",
"rxjs": "^6.6.2",
"rxjs": "^7.8.1",
"rxjs-compat": "^6.6.7",
"stream": "0.0.2",
"typescript": "^5.0.4"
Expand Down
15 changes: 8 additions & 7 deletions core/src/CoreController.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
declare var _;
declare var sails;

import pathExists = require('path-exists');
import {pathExistsSync} from 'path-exists';

import {APIErrorResponse } from './model/APIErrorResponse';
export module Controllers.Core {

Expand Down Expand Up @@ -145,21 +146,21 @@ export module Controllers.Core {

//Check if view exists for branding and portal
var viewToTest: string = sails.config.appPath + "/views/" + branding + "/" + portal + "/" + view + ".ejs";
if (pathExists.pathExistsSync(viewToTest)) {
if (pathExistsSync(viewToTest)) {
resolvedView = branding + "/" + portal + "/" + view;
}
// If view doesn't exist, next try for portal with default branding
if (resolvedView == null) {
viewToTest = sails.config.appPath + "/views/default/" + portal + "/" + view + ".ejs";
if (pathExists.pathExistsSync(viewToTest)) {
if (pathExistsSync(viewToTest)) {
resolvedView = "default/" + portal + "/" + view;
}
}

// If view still doesn't exist, next try for default portal with default branding
if (resolvedView == null) {
viewToTest = sails.config.appPath + "/views/default/default/" + view + ".ejs";
if (pathExists.pathExistsSync(viewToTest)) {
if (pathExistsSync(viewToTest)) {
resolvedView = "default/default/" + view;
}
}
Expand All @@ -172,21 +173,21 @@ export module Controllers.Core {

//Check if view exists for branding and portal
var layoutToTest: string = sails.config.appPath + "/views/" + branding + "/" + portal + "/layout/layout.ejs";
if (pathExists.pathExistsSync(layoutToTest)) {
if (pathExistsSync(layoutToTest)) {
resolvedLayout = branding + "/" + portal + "/layout";
}
// If view doesn't exist, next try for portal with default branding
if (resolvedLayout == null) {
layoutToTest = sails.config.appPath + "/views/default/" + portal + "/layout.ejs";
if (pathExists.pathExistsSync(layoutToTest)) {
if (pathExistsSync(layoutToTest)) {
resolvedLayout = "/default/" + portal + "/layout";
}
}

// If view still doesn't exist, next try for default portal with default branding
if (resolvedLayout == null) {
layoutToTest = sails.config.appPath + "/views/default/default/" + "layout.ejs";
if (pathExists.pathExistsSync(layoutToTest)) {
if (pathExistsSync(layoutToTest)) {
resolvedLayout = "default/default/layout";
}
}
Expand Down
8 changes: 5 additions & 3 deletions core/src/CoreService.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { Observable } from 'rxjs/Rx';
import { from,bindNodeCallback, bindCallback, Observable } from 'rxjs';


declare var sails;
// changed to a manual lodash load instead of relying on Sails global object
// this enables testing of installable hooks that rely on services at load-time (i.e. index.js)
Expand All @@ -25,9 +27,9 @@ export module Services.Core {
*/
protected getObservable(q, method='exec', type='node'): Observable<any> {
if (type == 'node')
return Observable.bindNodeCallback(q[method].bind(q))();
return bindNodeCallback(q[method].bind(q))();
else
return Observable.bindCallback(q[method].bind(q))();
return bindCallback(q[method].bind(q))();
}

/**
Expand Down
Loading

0 comments on commit f8e4a67

Please sign in to comment.