Skip to content
Merged
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
4 changes: 2 additions & 2 deletions 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 package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wshcmx/cli",
"version": "3.4.0",
"version": "3.5.0",
"main": "dist/index.js",
"type": "module",
"repository": "github:wshcmx/cli",
Expand Down
11 changes: 9 additions & 2 deletions test/transformers/api_patterns/cases/passport-pattern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,19 @@ export function authenticateApplication(req: Request, xAppId: string): Authentic

const credentials = applicationDocument.TopElem.credentials;
let credentialDocument;
let credential;

for (let i = 0; i < credentials.ChildNum; i++) {
credentialDocument = tools.open_doc<CredentialDocument>(credentials[i].id);
credential = credentials[i];

if (credential === undefined) {
continue;
}

credentialDocument = tools.open_doc<CredentialDocument>(credential.id);

if (credentialDocument === undefined) {
wshcmx.utils.log.error(`Авторизационные данные по id "${credentials[i].id}" не найдены в базе данных`, "passport");
wshcmx.utils.log.error(`Авторизационные данные по id "${credential.id}" не найдены в базе данных`, "passport");
continue;
}

Expand Down
5 changes: 5 additions & 0 deletions test/transformers/api_patterns/cases/router-pattern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ export type ControllerLibrary = {
export function init() {
createRouterRule();
const apis = ReadDirectory("./../controllers");

if (apis[0] === undefined) {
return;
}

const apiFunctions = OpenCodeLib<ControllerLibrary>(apis[0]).functions();
const apiRoute = apiFunctions[0] as Route & {
HasProperty(key: string): boolean;
Expand Down
9 changes: 7 additions & 2 deletions test/transformers/api_patterns/expected/passport-pattern.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ function authenticateApplication(req, xAppId) {
}
var credentials = applicationDocument.TopElem.credentials;
var credentialDocument;
var credential;
for (var i = 0; i < credentials.ChildNum; i++) {
credentialDocument = tools.open_doc(credentials[i].id);
credential = credentials[i];
if (credential === undefined) {
continue;
}
credentialDocument = tools.open_doc(credential.id);
if (credentialDocument === undefined) {
wshcmx.utils.log.error("Авторизационные данные по id \"" + credentials[i].id + "\" не найдены в базе данных", "passport");
wshcmx.utils.log.error("Авторизационные данные по id \"" + credential.id + "\" не найдены в базе данных", "passport");
continue;
}
if (credentialDocument.TopElem.login == req.AuthLogin
Expand Down
3 changes: 3 additions & 0 deletions test/transformers/api_patterns/expected/router-pattern.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ function createRouterRule() {
function init() {
createRouterRule();
var apis = ReadDirectory("./../controllers");
if (apis[0] === undefined) {
return;
}
var apiFunctions = OpenCodeLib(apis[0]).functions();
var apiRoute = apiFunctions[0];
wshcmx.routes.push({
Expand Down
4 changes: 2 additions & 2 deletions test/transformers/api_patterns/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ export type Route = Object & {
access: string;
callback: string;
method: string;
params?: object;
params: object | undefined;
pattern: string;
url?: string;
url: string | undefined;
};

export type RouteParameter = {
Expand Down
12 changes: 9 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,20 @@
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"noUnusedParameters": true,
"noUnusedLocals": true,
"strict": true,
"allowJs": true,
"skipLibCheck": true,
"types": ["node"],
"rootDir": "src",
"outDir": "./dist"
"outDir": "./dist",
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
"noImplicitReturns": true,
"noImplicitOverride": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"noPropertyAccessFromIndexSignature": true
},
"include": [
"src/**/*"
Expand Down