52 Commits

Author SHA1 Message Date
9fa3165304 2.0.0 2023-03-20 14:23:33 +01:00
069d61ccf7 BREAKING CHANGE(core): update 2023-03-20 14:23:33 +01:00
0b56464a5f 1.0.27 2020-10-20 20:31:28 +00:00
4805687305 fix(core): update 2020-10-20 20:31:28 +00:00
c387a633bb 1.0.26 2020-10-20 20:28:34 +00:00
99efc2d5fe fix(core): update 2020-10-20 20:28:33 +00:00
e146b7741d 1.0.25 2020-09-24 00:59:02 +00:00
02866cbe8d fix(core): update 2020-09-24 00:59:01 +00:00
7a320d27a3 1.0.24 2020-09-24 00:45:24 +00:00
7910f9a856 fix(core): update 2020-09-24 00:45:23 +00:00
05194609fe 1.0.23 2020-09-24 00:32:54 +00:00
eb0ec04199 fix(core): update 2020-09-24 00:32:54 +00:00
ffd5eb2e52 1.0.22 2020-09-23 23:54:46 +00:00
c432079a70 fix(core): update 2020-09-23 23:54:46 +00:00
e2cab0bb59 1.0.21 2020-09-23 23:30:55 +00:00
aaaa8b3ee4 fix(core): update 2020-09-23 23:30:54 +00:00
4cc149069e 1.0.20 2020-07-28 17:24:53 +00:00
6c106a4f22 fix(core): update 2020-07-28 17:24:53 +00:00
85fca378ff 1.0.19 2020-07-28 17:14:17 +00:00
d096a08e42 fix(core): update 2020-07-28 17:14:16 +00:00
a715dd9e8c 1.0.18 2020-07-26 15:02:25 +00:00
ef8bf0a0d8 fix(core): update 2020-07-26 15:02:24 +00:00
f6d8910c45 1.0.17 2020-07-26 14:34:48 +00:00
0917b9dd06 fix(core): update 2020-07-26 14:34:47 +00:00
0455c34cfa 1.0.16 2020-07-26 14:01:17 +00:00
a69fee7985 fix(core): update 2020-07-26 14:01:17 +00:00
3e0d01520e 1.0.15 2020-07-26 13:54:47 +00:00
7c4db19825 fix(core): update 2020-07-26 13:54:46 +00:00
f7205e2f29 1.0.14 2020-07-25 16:58:07 +00:00
0caf4becbe fix(core): update 2020-07-25 16:58:06 +00:00
42af79a271 1.0.13 2020-07-25 16:34:11 +00:00
4dad23896c fix(core): update 2020-07-25 16:34:10 +00:00
03ae15b10d 1.0.12 2020-07-25 15:53:45 +00:00
f66a5a80e1 fix(core): update 2020-07-25 15:53:45 +00:00
4bd3c65588 1.0.11 2020-07-25 15:48:24 +00:00
f29dd9bf1c fix(core): update 2020-07-25 15:48:24 +00:00
2eeb4b7925 1.0.10 2020-07-25 15:47:35 +00:00
7e34275029 fix(core): update 2020-07-25 15:47:34 +00:00
c0e264146b 1.0.9 2020-07-25 15:40:11 +00:00
951772d515 fix(core): update 2020-07-25 15:40:10 +00:00
d786a3b7cd 1.0.8 2020-07-25 13:42:49 +00:00
6e0a48cc49 fix(core): update 2020-07-25 13:42:49 +00:00
88c0fc101b 1.0.7 2020-07-25 13:34:27 +00:00
6ec6869e9c fix(core): update 2020-07-25 13:34:26 +00:00
6df4f8de77 1.0.6 2020-07-05 23:35:55 +00:00
29f4529dd8 fix(core): update 2020-07-05 23:35:55 +00:00
a2392644b1 1.0.5 2020-07-05 23:31:26 +00:00
4a8c3159c0 fix(core): update 2020-07-05 23:31:26 +00:00
b118e03520 1.0.4 2020-07-05 17:53:50 +00:00
7675c27cab fix(core): update 2020-07-05 17:53:49 +00:00
4251dbf0af 1.0.3 2020-07-04 15:57:02 +00:00
6e42d063c5 fix(core): update 2020-07-04 15:57:01 +00:00
15 changed files with 4461 additions and 4843 deletions

View File

@@ -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
View File

@@ -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"
} }
] ]
} }

View File

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

View File

@@ -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"

4753
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"name": "@apiglobal/test-sdk", "name": "@apiglobal/test-sdk",
"version": "1.0.2", "version": "2.0.0",
"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",
@@ -8,19 +8,24 @@
"author": "Lossless GmbH", "author": "Lossless GmbH",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"test": "(tstest test/)", "test": "(tstest test/ --web)",
"build": "(tsbuild)", "build": "(tsbuild --web)",
"format": "(gitzone format)" "buildDocs": "tsdoc"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.0.22", "@gitzone/tsbuild": "^2.1.25",
"@gitzone/tstest": "^1.0.15", "@gitzone/tstest": "^1.0.52",
"@pushrocks/tapbundle": "^3.0.7", "@pushrocks/tapbundle": "^5.0.4",
"@types/node": "^10.11.7", "@types/node": "^18.15.3"
"tslint": "^5.11.0", },
"tslint-config-prettier": "^1.15.0" "dependencies": {
"@apiglobal/sdk": "^2.0.1",
"@apiglobal/typedrequest": "^2.0.12",
"@apiglobal/typedrequest-interfaces": "^2.0.1",
"@pushrocks/qenv": "^5.0.2",
"@pushrocks/smartexpress": "^4.0.28",
"@pushrocks/smartobject": "^1.0.4"
}, },
"dependencies": {},
"files": [ "files": [
"ts/**/*", "ts/**/*",
"ts_web/**/*", "ts_web/**/*",
@@ -32,5 +37,9 @@
"cli.js", "cli.js",
"npmextra.json", "npmextra.json",
"readme.md" "readme.md"
] ],
"browserslist": [
"last 1 chrome versions"
],
"type": "module"
} }

4230
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -21,7 +21,6 @@ Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](htt
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@apiglobal/test-sdk)](https://lossless.cloud) PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@apiglobal/test-sdk)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@apiglobal/test-sdk)](https://lossless.cloud) PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@apiglobal/test-sdk)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@apiglobal/test-sdk)](https://lossless.cloud) BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@apiglobal/test-sdk)](https://lossless.cloud)
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](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)
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)

View File

@@ -1,8 +1,10 @@
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;
tap.test('first test', async () => { tap.test('first test', async () => {
console.log(testSdk.standardExport); console.log('TODO');
}); });
tap.start(); tap.start();

8
ts/00_commitinfo_data.ts Normal file
View File

@@ -0,0 +1,8 @@
/**
* autocreated commitinfo by @pushrocks/commitinfo
*/
export const commitinfo = {
name: '@apiglobal/test-sdk',
version: '2.0.0',
description: 'an sdk for testing ag handlers'
}

View File

@@ -1,3 +1,88 @@
import * as plugins from './test-sdk.plugins'; import * as plugins from './test-sdk.plugins.js';
import { AgTestServer } from './test-sdk.classes.testserver.js';
import { AAgHandler } from '@apiglobal/sdk';
export let standardExport = 'Hi there! :) This is an exported string'; export { AgTestServer };
let testServer: AgTestServer;
let handler: AAgHandler<any>;
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();
return testServer;
};
export const testFire = <
A extends plugins.agSdk.AAgHandler<any>,
T extends plugins.typedrequestInterfaces.ITypedRequest
>(
slugArg: A['slug'],
methodArg: T['method'],
requestArg: T['request']
) => {
if (!testServer) {
throw new Error('you need to create and start a testServer first!');
}
if (testServer.server.serverStatus !== 'running') {
throw new Error('you need to start the testServer first!');
}
const typedRequest = new plugins.typedrequest.TypedRequest<T>(
`http://localhost:${testServer.server.options.port}/${slugArg}`,
methodArg
);
const responsePromise = typedRequest.fire(requestArg);
const expect = async (expectedResponseArg: T['response']) => {
const actualResponse = await responsePromise;
const comparisonResult = plugins.smartobject.compareObjects(
expectedResponseArg,
actualResponse
);
let throwErrorBool = false;
if (comparisonResult.divergingProperties.length > 0) {
console.log(`The following properties diverged:`);
console.log(comparisonResult.divergingProperties);
for (const divProperty of comparisonResult.divergingProperties) {
if (expectedResponseArg[divProperty] !== 'maydiverge') {
throwErrorBool = true;
} else {
console.log(`${divProperty} may diverge, not throwing for this one`);
}
}
}
if (comparisonResult.missingProperties.length > 0) {
console.log(`The following properties diverged:`);
console.log(comparisonResult.divergingProperties);
throwErrorBool = true;
}
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');
}
return actualResponse;
};
return {
expect,
};
};
export const stopTestServer = async () => {
if (testServer) {
await testServer.stop();
await handler.stop();
}
};

View File

@@ -0,0 +1,52 @@
import * as plugins from './test-sdk.plugins.js';
export class AgTestServer {
public handlers: Array<plugins.agSdk.AAgHandler<any>> = [];
public server: plugins.smartexpress.Server;
constructor(handlerArg?: plugins.agSdk.AAgHandler<any>) {
if (handlerArg) {
this.addAgHandler(handlerArg);
}
}
public async addAgHandler(handlerArg: plugins.agSdk.AAgHandler<any>) {
this.handlers.push(handlerArg);
console.log(`added handler with slug ${handlerArg.slug}`);
if (this.server && this.server.serverStatus === 'running') {
await this.stop();
await this.start();
}
}
public async start() {
this.server = new plugins.smartexpress.Server({
cors: true,
forceSsl: false,
defaultAnswer: async () => 'apiglobal testserver',
domain: 'localhost',
port: 3000,
});
for (const handlerArg of this.handlers) {
console.log(`found handler with slug ${handlerArg.slug}`);
await handlerArg.start();
console.log(`started handler with slug ${handlerArg.slug}`);
const slugroute = `/${handlerArg.slug}`;
this.server.addRoute(
slugroute,
new plugins.smartexpress.HandlerTypedRouter(handlerArg.typedrouter)
);
console.log(`added slugroute ${slugroute}`);
}
await this.server.start();
}
public async stop() {
if (this.server) {
const previousServer = this.server;
this.server = null;
await previousServer.startedPromise;
await previousServer.stop();
}
}
}

View File

@@ -1,2 +1,13 @@
const removeme = {}; // apiglobal scope
export { removeme }; import * as agSdk from '@apiglobal/sdk';
import * as typedrequest from '@apiglobal/typedrequest';
import * as typedrequestInterfaces from '@apiglobal/typedrequest-interfaces';
export { agSdk, typedrequest, typedrequestInterfaces };
// pushrocks scope
import * as qenv from '@pushrocks/qenv';
import * as smartexpress from '@pushrocks/smartexpress';
import * as smartobject from '@pushrocks/smartobject';
export { qenv, smartexpress, smartobject };

10
tsconfig.json Normal file
View File

@@ -0,0 +1,10 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"useDefineForClassFields": false,
"target": "ES2022",
"module": "ES2022",
"moduleResolution": "nodenext",
"esModuleInterop": true
}
}

View File

@@ -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"
}