fix(package): initial

This commit is contained in:
Philipp Kunz 2018-08-17 23:23:49 +02:00
commit 15058aebfa
11 changed files with 274 additions and 0 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
.nogit/
node_modules/
coverage/
public/
pages/
.yarn/

142
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,142 @@
# gitzone standard
image: hosttoday/ht-docker-node:npmci
cache:
paths:
- .npmci_cache/
key: "$CI_BUILD_STAGE"
stages:
- security
- test
- release
- metadata
# ====================
# security stage
# ====================
mirror:
stage: security
script:
- npmci git mirror
tags:
- docker
- notpriv
snyk:
stage: security
script:
- npmci command npm install -g snyk
- npmci command npm install --ignore-scripts
- npmci command snyk test
tags:
- docker
- notpriv
# ====================
# test stage
# ====================
testLEGACY:
stage: test
script:
- npmci node install legacy
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- notpriv
allow_failure: true
testLTS:
stage: test
script:
- npmci node install lts
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- notpriv
testSTABLE:
stage: test
script:
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- notpriv
release:
stage: release
script:
- npmci node install stable
- npmci npm publish
only:
- tags
tags:
- docker
- notpriv
# ====================
# metadata stage
# ====================
codequality:
stage: metadata
image: docker:stable
allow_failure: true
services:
- docker:stable-dind
script:
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
- docker run
--env SOURCE_CODE="$PWD"
--volume "$PWD":/code
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
artifacts:
paths: [codeclimate.json]
tags:
- docker
- priv
trigger:
stage: metadata
script:
- npmci trigger
only:
- tags
tags:
- docker
- notpriv
pages:
image: hosttoday/ht-docker-node:npmci
stage: metadata
script:
- npmci command npm install -g typedoc typescript
- npmci npm install
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
tags:
- docker
- notpriv
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public
allow_failure: true
windowsCompatibility:
image: stefanscherer/node-windows:10-build-tools
stage: metadata
script:
- npm install & npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- windows
allow_failure: true

8
npmextra.json Normal file
View File

@ -0,0 +1,8 @@
{
"npmci": {
"npmGlobalTools": [
"@gitzone/npmts",
"ts-node"
]
}
}

5
package-lock.json generated Normal file
View File

@ -0,0 +1,5 @@
{
"name": "smartsession",
"version": "1.0.1",
"lockfileVersion": 1
}

17
package.json Normal file
View File

@ -0,0 +1,17 @@
{
"name": "smartsession",
"private": false,
"version": "1.0.1",
"description": "handle sessions serverside",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"author": "Lossless GmbH",
"license": "MIT",
"scripts": {
"test": "(tsrun test/test.ts)",
"format": "(gitzone format)",
"build": "(npmts)"
},
"devDependencies": {},
"dependencies": {}
}

8
test/test.ts Normal file
View File

@ -0,0 +1,8 @@
import { expect, tap } from '@pushrocks/tapbundle';
import * as smartsession from '../ts/index';
tap.test('first test', async () => {
console.log(smartsession.standardExport);
});
tap.start();

3
ts/index.ts Normal file
View File

@ -0,0 +1,3 @@
import * as smartsession from './smartsession.classes.smartsession';

View File

@ -0,0 +1,17 @@
import * as plugins from './smartsession.plugins';
import { } from './smartsession.classes.store';
export class Smartsession {
/**
* registers a new user with a given key and assign
*/
register<T>(uuidArg: string, payloadArg: T): boolean {
return true
}
registerAndGenerateUuid(): string {
return ''
}
}

View File

@ -0,0 +1,63 @@
import * as plugins from './smartsession.plugins';
export interface storageObject {
[key: string]: any
}
/**
* SessionStore is in charge of storing session related data
*/
export class SessionStore<T> {
memoryStore: storageObject = {};
/**
* check for an id
*/
checkForId(idArg: string): boolean {
if(this.memoryStore[idArg]) {
return true;
}
return false
}
/**
* gets an id
*/
getId(idArg: string): T {
return this.memoryStore[idArg];
}
/**
*
*/
removeId(idArg: string): boolean {
// TODO: implement
if(this.checkForId(idArg)) {
delete this.memoryStore[idArg];
return true
}
return false
}
/**
* updates an id within store
*/
updateId(idArg: string, payloadArg: T) {
if(this.checkForId(idArg)) {
this.memoryStore[idArg] = payloadArg;
}
}
/**
* upserts an id within store
*/
upsertId(idArg: string, payloadArg: T) {
this.memoryStore[idArg] = payloadArg;
}
/**
* syncs the fast memory store with a persistence layer in an async way
* TODO: Think about what actions need to be blocking to ensure cluster availability
*/
sync() {}
};

View File

@ -0,0 +1,2 @@
const removeme = {};
export { removeme };

3
tslint.json Normal file
View File

@ -0,0 +1,3 @@
{
"extends": "tslint-config-standard"
}