10 Commits

Author SHA1 Message Date
f73334d8fc 1.0.10 2020-09-22 22:54:06 +00:00
d170af1db5 fix(core): update 2020-09-22 22:54:05 +00:00
9e6b92f864 1.0.9 2020-07-05 15:16:51 +00:00
b094c07ef2 fix(core): update 2020-07-05 15:16:50 +00:00
33584785df 1.0.8 2020-07-04 16:42:42 +00:00
580f8dd7f7 fix(core): update 2020-07-04 16:42:41 +00:00
c1d2231a94 1.0.7 2020-07-04 14:50:25 +00:00
d73a144e8f fix(core): update 2020-07-04 14:50:24 +00:00
e91131b7ae 1.0.6 2020-07-04 14:38:26 +00:00
4dd5d12a2e fix(core): update 2020-07-04 14:38:25 +00:00
9 changed files with 3702 additions and 297 deletions

3902
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.5",
"version": "1.0.10",
"private": false,
"description": "an sdk package for api.global",
"main": "dist_ts/index.js",
@ -8,21 +8,20 @@
"author": "Lossless GmbH",
"license": "MIT",
"scripts": {
"test": "(tstest test/)",
"build": "(tsbuild)",
"format": "(gitzone format)"
"test": "(tstest test/ --web)",
"build": "(tsbuild --web)"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.0.22",
"@gitzone/tstest": "^1.0.15",
"@gitzone/tsbuild": "^2.1.24",
"@gitzone/tstest": "^1.0.33",
"@pushrocks/tapbundle": "^3.0.7",
"@types/node": "^13.9.3",
"tslint": "^6.1.0",
"@types/node": "^14.0.14",
"tslint": "^6.1.2",
"tslint-config-prettier": "^1.15.0"
},
"dependencies": {
"@apiglobal/typedrequest": "^1.0.28",
"@tsclass/tsclass": "^3.0.16"
"@apiglobal/typedrequest": "^1.0.38",
"@tsclass/tsclass": "^3.0.18"
},
"files": [
"ts/**/*",

View File

@ -8,13 +8,20 @@ an sdk package for api.global
* [docs (typedoc)](https://apiglobal.gitlab.io/sdk/)
## Status for master
[![pipeline status](https://gitlab.com/apiglobal/sdk/badges/master/pipeline.svg)](https://gitlab.com/apiglobal/sdk/commits/master)
[![coverage report](https://gitlab.com/apiglobal/sdk/badges/master/coverage.svg)](https://gitlab.com/apiglobal/sdk/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/@apiglobal/sdk.svg)](https://www.npmjs.com/package/@apiglobal/sdk)
[![Known Vulnerabilities](https://snyk.io/test/npm/@apiglobal/sdk/badge.svg)](https://snyk.io/test/npm/@apiglobal/sdk)
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/)
Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/apiglobal/sdk/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/apiglobal/sdk/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@apiglobal/sdk)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/apiglobal/sdk)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@apiglobal/sdk)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@apiglobal/sdk)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@apiglobal/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

View File

@ -1,14 +1,29 @@
import { expect, tap } from '@pushrocks/tapbundle';
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> {
slug: 'testapi';
public async handleRequest(authInfo: sdk.AuthInfo<any>, request: ISimpleRequest) {
// this.authenticationHandler
let response: any;
return response;
public slug: 'testapi';
public typedrouter = new TypedRouter();
public async checkReqirements() {
return {
allOk: true,
reason: '',
};
}
public async start() {}
public async stop() {}
public async checkRequirements(): Promise<sdk.IRequirementResult> {
return {
allOk: true,
reason: ''
}
}
}

View File

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

View File

@ -0,0 +1,8 @@
import * as plugins from './sdk.plugins';
/**
* AgEnvironment handles the provision of environment variables to handlers
*/
export class AgEnvironment {
}

View File

@ -1,14 +1,22 @@
import * as plugins from './sdk.plugins';
import { AuthInfo } from './sdk.classes.authinfo';
export interface IRequirementResult {
allOk: boolean;
reason: string;
}
export abstract class AAgHandler<TClaim> {
/**
* a slug that separates the handler from other handlers
*/
public abstract slug: string;
public abstract typedrouter: plugins.typedrequest.TypedRouter;
public abstract checkRequirements(): Promise<IRequirementResult>;
public abstract handleRequest (authInfoArg: AuthInfo<TClaim>, request: plugins.tsclass.network.ISimpleRequest): Promise<plugins.tsclass.network.ISimpleResponse>;
/**
* start the ag-handler
*/
public abstract start(): Promise<any>;
public abstract stop(): Promise<any>;
}

View File

@ -1,6 +1,13 @@
// node native scope
import * as path from 'path';
// @apiglobal scope
import * as typedrequest from '@apiglobal/typedrequest';
export {
typedrequest
};
// @tsclass scope
import * as tsclass from '@tsclass/tsclass';