8 Commits

Author SHA1 Message Date
d5516f11f7 1.0.15 2020-09-26 12:31:09 +00:00
a9cf2bb4c3 fix(core): update 2020-09-26 12:31:08 +00:00
ee99ddd23c 1.0.14 2020-09-26 11:57:27 +00:00
b99a0548a2 fix(core): update 2020-09-26 11:57:26 +00:00
1c678ced10 1.0.13 2020-09-23 22:34:43 +00:00
df1f6dff2e fix(core): update 2020-09-23 22:34:42 +00:00
961dfc5693 1.0.12 2020-09-23 21:24:32 +00:00
6e761cb2b9 fix(core): update 2020-09-23 21:24:32 +00:00
11 changed files with 7259 additions and 846 deletions

View File

@ -19,23 +19,35 @@ mirror:
stage: security
script:
- npmci git mirror
only:
- tags
tags:
- lossless
- docker
- notpriv
audit:
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --production --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=prod --production
tags:
- docker
auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high
- npmci command npm audit --audit-level=high --only=dev
tags:
- lossless
- docker
- notpriv
allow_failure: true
# ====================
# test stage
@ -50,9 +62,7 @@ testStable:
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
- priv
testBuild:
stage: test
@ -63,9 +73,7 @@ testBuild:
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
- notpriv
release:
stage: release
@ -85,6 +93,8 @@ release:
codequality:
stage: metadata
allow_failure: true
only:
- tags
script:
- npmci command npm install -g tslint typescript
- npmci npm prepare

View File

@ -15,7 +15,7 @@
"properties": {
"projectType": {
"type": "string",
"enum": ["website", "element", "service", "npm"]
"enum": ["website", "element", "service", "npm", "wcc"]
}
}
}

8019
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "@apiglobal/sdk",
"version": "1.0.11",
"version": "1.0.15",
"private": false,
"description": "an sdk package for api.global",
"main": "dist_ts/index.js",
@ -21,6 +21,7 @@
},
"dependencies": {
"@apiglobal/typedrequest": "^1.0.38",
"@pushrocks/smartfile": "^8.0.0",
"@tsclass/tsclass": "^3.0.18"
},
"files": [
@ -34,5 +35,8 @@
"cli.js",
"npmextra.json",
"readme.md"
],
"browserslist": [
"last 1 chrome versions"
]
}

View File

@ -3,7 +3,6 @@ import * as sdk from '../ts/index';
import { ISimpleRequest } from '@tsclass/tsclass/dist_ts/network';
import { TypedRouter } from '@apiglobal/typedrequest';
tap.test('should create a valid Handler', async () => {
class MyHandler extends sdk.AAgHandler<any> {
public slug: 'testapi';
@ -23,8 +22,8 @@ tap.test('should create a valid Handler', async () => {
public async checkRequirements(): Promise<sdk.IRequirementResult> {
return {
allOk: true,
reason: ''
}
reason: '',
};
}
}

View File

@ -1,3 +1,5 @@
export * from './sdk.classes.agenvironment';
export * from './sdk.classes.aghandler';
export * from './sdk.classes.authinfo';
export * from './interfaces';

View File

@ -1 +1 @@
export {};
export * from './projectsettings';

View File

@ -0,0 +1,10 @@
export interface IProjectSettings {
slug: string;
packageName: string;
environmentVariables: { [key: string]: string };
registryId: string;
registryDescriptor: {
registryUrl: string;
registryToken: string;
};
}

View File

@ -17,9 +17,29 @@ export abstract class AAgHandler<TClaim> {
public abstract typedrouter: plugins.typedrequest.TypedRouter;
public abstract checkRequirements(): Promise<IRequirementResult>;
public async checkQenvFile(pathToQenvFileArg: string) {
if(!(await plugins.smartfile.fs.fileExists(pathToQenvFileArg))) {
throw new Error(`AgHandler with slug '${this.slug}': qenv file does not exists at ${pathToQenvFileArg}`);
}
const qenvFile = plugins.smartfile.fs.toObjectSync(pathToQenvFileArg);
const missingEnvironmentVariables: string[] = [];
for (const envVar of qenvFile.required as string[]) {
const result = this.agEnvironment.getEnvVar(envVar);
if (!result) {
missingEnvironmentVariables.push(envVar);
}
}
if (missingEnvironmentVariables.length > 0) {
console.log(`AgHandler with slug '${this.slug}': There are ${missingEnvironmentVariables.length} missing environment variables`);
const errorMessage = `AgHandler with slug '${this.slug}': The missing env Varibles are ${missingEnvironmentVariables}`;
console.log(errorMessage);
throw new Error(errorMessage);
}
}
constructor(agEnvironmentArg: AgEnvironment) {
this.agEnvironment = agEnvironmentArg;
};
}
/**
* start the ag-handler

View File

@ -4,8 +4,13 @@ import * as path from 'path';
// @apiglobal scope
import * as typedrequest from '@apiglobal/typedrequest';
export { typedrequest };
// pushrocks scope
import * as smartfile from '@pushrocks/smartfile';
export {
typedrequest
smartfile
};
// @tsclass scope