Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1830daacba | |||
| 52cca1c8f3 | |||
| fd5f50e420 | |||
| ce88b62d3c | |||
| 9fa3165304 | |||
| 069d61ccf7 | |||
| 0b56464a5f | |||
| 4805687305 | |||
| c387a633bb | |||
| 99efc2d5fe | |||
| e146b7741d | |||
| 02866cbe8d | |||
| 7a320d27a3 | |||
| 7910f9a856 | |||
| 05194609fe | |||
| eb0ec04199 | |||
| ffd5eb2e52 | |||
| c432079a70 | |||
| e2cab0bb59 | |||
| aaaa8b3ee4 | |||
| 4cc149069e | |||
| 6c106a4f22 | |||
| 85fca378ff | |||
| d096a08e42 |
@@ -12,30 +12,38 @@ stages:
|
|||||||
- release
|
- release
|
||||||
- metadata
|
- metadata
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- pnpm install -g pnpm
|
||||||
|
- pnpm install -g @shipzone/npmci
|
||||||
|
- npmci npm prepare
|
||||||
|
|
||||||
# ====================
|
# ====================
|
||||||
# security stage
|
# security stage
|
||||||
# ====================
|
# ====================
|
||||||
mirror:
|
# ====================
|
||||||
stage: security
|
# security stage
|
||||||
script:
|
# ====================
|
||||||
- npmci git mirror
|
auditProductionDependencies:
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
audit:
|
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
stage: security
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
- npmci command npm config set registry https://registry.npmjs.org
|
||||||
- npmci command npm install --ignore-scripts
|
- npmci command pnpm audit --audit-level=high --prod
|
||||||
- npmci command npm config set registry https://registry.npmjs.org
|
|
||||||
- npmci command npm audit --audit-level=high
|
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
- lossless
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
allow_failure: true
|
||||||
|
|
||||||
|
auditDevDependencies:
|
||||||
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
|
stage: security
|
||||||
|
script:
|
||||||
|
- npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
- npmci command pnpm audit --audit-level=high --dev
|
||||||
|
tags:
|
||||||
|
- lossless
|
||||||
|
- docker
|
||||||
|
allow_failure: true
|
||||||
|
|
||||||
# ====================
|
# ====================
|
||||||
# test stage
|
# test stage
|
||||||
@@ -44,28 +52,22 @@ audit:
|
|||||||
testStable:
|
testStable:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install stable
|
- npmci node install stable
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci npm test
|
- npmci npm test
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
|
||||||
- docker
|
- docker
|
||||||
- priv
|
|
||||||
|
|
||||||
testBuild:
|
testBuild:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install stable
|
- npmci node install stable
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci command npm run build
|
- npmci npm build
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
|
||||||
|
|
||||||
release:
|
release:
|
||||||
stage: release
|
stage: release
|
||||||
@@ -85,11 +87,12 @@ release:
|
|||||||
codequality:
|
codequality:
|
||||||
stage: metadata
|
stage: metadata
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
script:
|
script:
|
||||||
- npmci command npm install -g tslint typescript
|
- npmci command npm install -g typescript
|
||||||
- npmci npm prepare
|
- npmci npm prepare
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
- lossless
|
||||||
- docker
|
- docker
|
||||||
@@ -109,11 +112,9 @@ trigger:
|
|||||||
pages:
|
pages:
|
||||||
stage: metadata
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci node install lts
|
- npmci node install stable
|
||||||
- npmci command npm install -g @gitzone/tsdoc
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci command tsdoc
|
- npmci command npm run buildDocs
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
- lossless
|
||||||
- docker
|
- docker
|
||||||
|
|||||||
24
.vscode/launch.json
vendored
24
.vscode/launch.json
vendored
@@ -2,28 +2,10 @@
|
|||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "current file",
|
"command": "npm test",
|
||||||
"type": "node",
|
"name": "Run npm test",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"args": [
|
"type": "node-terminal"
|
||||||
"${relativeFile}"
|
|
||||||
],
|
|
||||||
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
|
||||||
"cwd": "${workspaceRoot}",
|
|
||||||
"protocol": "inspector",
|
|
||||||
"internalConsoleOptions": "openOnSessionStart"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "test.ts",
|
|
||||||
"type": "node",
|
|
||||||
"request": "launch",
|
|
||||||
"args": [
|
|
||||||
"test/test.ts"
|
|
||||||
],
|
|
||||||
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
|
||||||
"cwd": "${workspaceRoot}",
|
|
||||||
"protocol": "inspector",
|
|
||||||
"internalConsoleOptions": "openOnSessionStart"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@@ -15,7 +15,7 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"projectType": {
|
"projectType": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["website", "element", "service", "npm"]
|
"enum": ["website", "element", "service", "npm", "wcc"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"githost": "gitlab.com",
|
"githost": "gitlab.com",
|
||||||
"gitscope": "apiglobal",
|
"gitscope": "apiglobal",
|
||||||
"gitrepo": "test-sdk",
|
"gitrepo": "test-sdk",
|
||||||
"shortDescription": "an sdk for testing ag handlers",
|
"description": "an sdk for testing ag handlers",
|
||||||
"npmPackagename": "@apiglobal/test-sdk",
|
"npmPackagename": "@apiglobal/test-sdk",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"projectDomain": "api.global"
|
"projectDomain": "api.global"
|
||||||
|
|||||||
10786
package-lock.json
generated
10786
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
31
package.json
31
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@apiglobal/test-sdk",
|
"name": "@apiglobal/test-sdk",
|
||||||
"version": "1.0.18",
|
"version": "2.0.2",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "an sdk for testing ag handlers",
|
"description": "an sdk for testing ag handlers",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
@@ -9,21 +9,22 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/ --web)",
|
"test": "(tstest test/ --web)",
|
||||||
"build": "(tsbuild --web)"
|
"build": "(tsbuild --web --allowimplicitany)",
|
||||||
|
"buildDocs": "tsdoc"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.0.22",
|
"@gitzone/tsbuild": "^2.1.25",
|
||||||
"@gitzone/tstest": "^1.0.43",
|
"@gitzone/tsrun": "^1.2.39",
|
||||||
"@pushrocks/tapbundle": "^3.2.9",
|
"@gitzone/tstest": "^1.0.52",
|
||||||
"@types/node": "^14.0.26",
|
"@pushrocks/tapbundle": "^5.0.4",
|
||||||
"tslint": "^6.1.2",
|
"@types/node": "^18.15.3"
|
||||||
"tslint-config-prettier": "^1.18.0"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apiglobal/sdk": "^1.0.9",
|
"@apiglobal/sdk": "^2.0.1",
|
||||||
"@apiglobal/typedrequest": "^1.0.40",
|
"@apiglobal/typedrequest": "^2.0.12",
|
||||||
"@apiglobal/typedrequest-interfaces": "^1.0.15",
|
"@apiglobal/typedrequest-interfaces": "^2.0.1",
|
||||||
"@pushrocks/smartexpress": "^3.0.73",
|
"@pushrocks/qenv": "^5.0.2",
|
||||||
|
"@pushrocks/smartexpress": "^4.0.28",
|
||||||
"@pushrocks/smartobject": "^1.0.4"
|
"@pushrocks/smartobject": "^1.0.4"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
@@ -37,5 +38,9 @@
|
|||||||
"cli.js",
|
"cli.js",
|
||||||
"npmextra.json",
|
"npmextra.json",
|
||||||
"readme.md"
|
"readme.md"
|
||||||
]
|
],
|
||||||
|
"browserslist": [
|
||||||
|
"last 1 chrome versions"
|
||||||
|
],
|
||||||
|
"type": "module"
|
||||||
}
|
}
|
||||||
|
|||||||
4232
pnpm-lock.yaml
generated
Normal file
4232
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -21,7 +21,6 @@ Code Style | [](htt
|
|||||||
PackagePhobia (total standalone install weight) | [](https://lossless.cloud)
|
PackagePhobia (total standalone install weight) | [](https://lossless.cloud)
|
||||||
PackagePhobia (package size on registry) | [](https://lossless.cloud)
|
PackagePhobia (package size on registry) | [](https://lossless.cloud)
|
||||||
BundlePhobia (total size when bundled) | [](https://lossless.cloud)
|
BundlePhobia (total size when bundled) | [](https://lossless.cloud)
|
||||||
Platform support | [](https://lossless.cloud) [](https://lossless.cloud)
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@@ -33,7 +32,6 @@ We are always happy for code contributions. If you are not the code contributing
|
|||||||
|
|
||||||
For further information read the linked docs at the top of this readme.
|
For further information read the linked docs at the top of this readme.
|
||||||
|
|
||||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
## Legal
|
||||||
|
> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
|
||||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
||||||
|
|
||||||
[](https://maintainedby.lossless.com)
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { expect, tap } from '@pushrocks/tapbundle';
|
||||||
import * as testSdk from '../ts/index';
|
import * as testSdk from '../ts/index.js';
|
||||||
|
|
||||||
let testServer: testSdk.AgTestServer;
|
let testServer: testSdk.AgTestServer;
|
||||||
|
|
||||||
|
|||||||
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* autocreated commitinfo by @pushrocks/commitinfo
|
||||||
|
*/
|
||||||
|
export const commitinfo = {
|
||||||
|
name: '@apiglobal/test-sdk',
|
||||||
|
version: '2.0.2',
|
||||||
|
description: 'an sdk for testing ag handlers'
|
||||||
|
}
|
||||||
39
ts/index.ts
39
ts/index.ts
@@ -1,13 +1,24 @@
|
|||||||
import * as plugins from './test-sdk.plugins';
|
import * as plugins from './test-sdk.plugins.js';
|
||||||
import { AgTestServer } from './test-sdk.classes.testserver';
|
import { AgTestServer } from './test-sdk.classes.testserver.js';
|
||||||
|
import { AAgHandler } from '@apiglobal/sdk';
|
||||||
|
|
||||||
export {
|
export { AgTestServer };
|
||||||
AgTestServer
|
|
||||||
};
|
|
||||||
|
|
||||||
let testServer: AgTestServer;
|
let testServer: AgTestServer;
|
||||||
export const createTestServer = async (handlerArg: plugins.agSdk.AAgHandler<any>) => {
|
let handler: AAgHandler<any>;
|
||||||
testServer = new AgTestServer(handlerArg);
|
export const createTestServer = async (handlerArg: {
|
||||||
|
new (envManagerArg: plugins.agSdk.AgEnvironment): plugins.agSdk.AAgHandler<any>;
|
||||||
|
}) => {
|
||||||
|
class AgEnvironement extends plugins.agSdk.AgEnvironment {
|
||||||
|
public qenv = new plugins.qenv.Qenv('./', './.nogit');
|
||||||
|
public async getEnvVar(nameArg: string) {
|
||||||
|
return this.qenv.getEnvVarOnDemand(nameArg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
handler = new handlerArg(new AgEnvironement());
|
||||||
|
console.log(`now checking requirements for handler with slug ${handler.slug}...`);
|
||||||
|
await handler.checkRequirements();
|
||||||
|
testServer = new AgTestServer(handler);
|
||||||
await testServer.start();
|
await testServer.start();
|
||||||
return testServer;
|
return testServer;
|
||||||
};
|
};
|
||||||
@@ -33,7 +44,10 @@ export const testFire = <
|
|||||||
const responsePromise = typedRequest.fire(requestArg);
|
const responsePromise = typedRequest.fire(requestArg);
|
||||||
const expect = async (expectedResponseArg: T['response']) => {
|
const expect = async (expectedResponseArg: T['response']) => {
|
||||||
const actualResponse = await responsePromise;
|
const actualResponse = await responsePromise;
|
||||||
const comparisonResult = plugins.smartobject.compareObjects(expectedResponseArg, actualResponse);
|
const comparisonResult = plugins.smartobject.compareObjects(
|
||||||
|
expectedResponseArg,
|
||||||
|
actualResponse
|
||||||
|
);
|
||||||
let throwErrorBool = false;
|
let throwErrorBool = false;
|
||||||
if (comparisonResult.divergingProperties.length > 0) {
|
if (comparisonResult.divergingProperties.length > 0) {
|
||||||
console.log(`The following properties diverged:`);
|
console.log(`The following properties diverged:`);
|
||||||
@@ -52,16 +66,23 @@ export const testFire = <
|
|||||||
throwErrorBool = true;
|
throwErrorBool = true;
|
||||||
}
|
}
|
||||||
if (throwErrorBool) {
|
if (throwErrorBool) {
|
||||||
|
console.log('Result: response did not comply');
|
||||||
|
console.log('-> expected:');
|
||||||
|
console.log(expectedResponseArg);
|
||||||
|
console.log('-> but actually received:');
|
||||||
|
console.log(actualResponse);
|
||||||
throw new Error('response did not comply');
|
throw new Error('response did not comply');
|
||||||
}
|
}
|
||||||
|
return actualResponse;
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
expect
|
expect,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const stopTestServer = async () => {
|
export const stopTestServer = async () => {
|
||||||
if (testServer) {
|
if (testServer) {
|
||||||
await testServer.stop();
|
await testServer.stop();
|
||||||
|
await handler.stop();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import * as plugins from './test-sdk.plugins';
|
import * as plugins from './test-sdk.plugins.js';
|
||||||
|
|
||||||
export class AgTestServer {
|
export class AgTestServer {
|
||||||
public handlers: Array<plugins.agSdk.AAgHandler<any>> = [];
|
public handlers: Array<plugins.agSdk.AAgHandler<any>> = [];
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ import * as typedrequestInterfaces from '@apiglobal/typedrequest-interfaces';
|
|||||||
export { agSdk, typedrequest, typedrequestInterfaces };
|
export { agSdk, typedrequest, typedrequestInterfaces };
|
||||||
|
|
||||||
// pushrocks scope
|
// pushrocks scope
|
||||||
|
import * as qenv from '@pushrocks/qenv';
|
||||||
import * as smartexpress from '@pushrocks/smartexpress';
|
import * as smartexpress from '@pushrocks/smartexpress';
|
||||||
import * as smartobject from '@pushrocks/smartobject';
|
import * as smartobject from '@pushrocks/smartobject';
|
||||||
|
|
||||||
export { smartexpress, smartobject };
|
export { qenv, smartexpress, smartobject };
|
||||||
|
|||||||
10
tsconfig.json
Normal file
10
tsconfig.json
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"useDefineForClassFields": false,
|
||||||
|
"target": "ES2022",
|
||||||
|
"module": "ES2022",
|
||||||
|
"moduleResolution": "nodenext",
|
||||||
|
"esModuleInterop": true
|
||||||
|
}
|
||||||
|
}
|
||||||
17
tslint.json
17
tslint.json
@@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": ["tslint:latest", "tslint-config-prettier"],
|
|
||||||
"rules": {
|
|
||||||
"semicolon": [true, "always"],
|
|
||||||
"no-console": false,
|
|
||||||
"ordered-imports": false,
|
|
||||||
"object-literal-sort-keys": false,
|
|
||||||
"member-ordering": {
|
|
||||||
"options":{
|
|
||||||
"order": [
|
|
||||||
"static-method"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"defaultSeverity": "warning"
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user