0.9.1 • Published 9 months ago

washswat-engine v0.9.1

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago
apidescription
getUidFromAuthenticationWashswatAuthtication API
getAuthenticationFromUidWashswatAuthtication API
extractJwtWithoutAuthenticationExtract payload without actual authentication

cache: node-cache and redis based cache wrapper

apidescription
initRedisInitialize cache to utilize redis. When cache uses without calling this init, it will use own memory cache.
setset cache.
getget cache

config: washswat config wrapper, based on platform-config and mongodb based

apidescription
configureWashswat platform configuration.
getFullPlatformConfigDatagetting full platform config data.
getAppConfigget application configuration data from package.json
getGlobalGatewayUrlget just gateway url from platform config data
getPlatformConfigget first platform config data.
readPlatformConfigread platform config data from mongodb
setHeaderset http/https header
clearExtraHeaderclear local header storage for new request
addHeaderadd new header. Probably for testing/debugging/information purpose

httpclient: axios based, cache-able REST client tool

apidescription
callcall axios based rest call with retry, cache functionality

logger: logger without using log4js

apidescription
FelixLogger.constructorinitialize logger
FelixLogger.setLevelset log level
FelixLogger.setPromptset log prompt
FelixLogger.setTimestampset log timestamp
FelixLogger.printprint formatted log message
FelixLogger.debugprint debug log
FelixLogger.infoprint info log
FelixLogger.warnprint warn log
FelixLogger.errorprint error log
FelixLogger.fatalprint fatal log
findMyLoggerfind logger by name
getLoggerget logger by name
setLogLevelset log level by name

mongoClient: mongodb based, cache-able mongodb client tool

Note: *2 version of apis are for supporting Typescript.

apidescription
init/init2initialize with mongo configuration
countcount query
findOne/findOne2find one query with cache support
deleteOne/deleteOne2delete one query
deleteMany/deleteMany2delete many query
updateOne/updateOne2update one quey
insertOne/intertOne2insert one query
insertMany/insertMany2inset many query
find/find2find query with cache support

mysql: mysql based, cache-able mysql client tool

apidescription
initinitialize with mysql configuration
queryquery with cache support

timer: timer utility for process duration tracking

apidescription
Timer.constructorinitialize timer with information
Timer.timerecord lap time with information
Timer.toStringget timing information as string
Timer.toJSONget timing information as JSON

util2: some useful utilities, one with JSON.stringify without circular reference problem

apidescription
getLoggerLegacy API call to get logger
setLogLevelLegacy API call to set log level
debugLegacy API call to print debug log
infoLegacy API call to print info log
errorLegacy API call to print error log
stringifyJSON.stringify with try-catch, multi-line format
stringify2JSON.stringify with try-catch, single-line format
stringifyWithoutCircularJSON.stringify without circular reference problem
genHashKeygenerate hash key from object (for cache key)
debugDumpdump object with limit and pretty format
debugExdump exception with pretty format
encryptObjectencrypt object with key and iv
decryptObjectdecrypt object with key and iv
encryptObjectWithSingleKeyencrypt object with single key, iv will use same key with variation.
decryptObjectWithSingleKeydecrypt object with single key, iv will use same key with variation.
export interface HttpInterface {
  status: boolean,
  message: string,
  data: any
}

export interface RestQueryRetryConfig {
  times: number,
  interval: number,
}

export interface RestQueryInterface {
  method: string,
  url: string,
  params: any,
  timeout: number,
  useCache: boolean,
  cacheTtl: number,
  retryConfig: RestQueryRetryConfig,
  headers: any,
  body: any,
  auth: any,
}

export interface RedisInitConfig {
  host: string,
  port: number,
  prefix: string,
}

export interface loggerOption {
  level: string,
  prompt: string,
  timestamp: boolean,
}

export interface MongoInterface {
  status: boolean,
  message: string,
  data: any
}

export interface MongoQueryInterface {
  name: string,
  db: string,
  collection: string,
  query: object,
  sort: object,
  fields: object,
  skip: number,
  limit: number,
  newValue: any,
  upsert: boolean,
}


export interface MongoConnectionOptions {
  poolSize: number,
  connectTimeoutMS: number,
}

export interface MongoConnectionEntry {
  name: string,
  url: string,
  options: MongoConnectionOptions,
  useCache: boolean,
  cacheTtl: number,
}

export interface MongoConnectionEntryList extends Array<MongoConnectionEntry> {}


export interface MysqlInterface {
  status: boolean,
  message: string,
  data: any
}

export interface MysqlConnectionInterface {
  host: string,
  user: string,
  password: string,
  database: string,
  useCache: boolean,
  cacheTtl: number
}
const configQuery: RestQueryInterface = {
  auth: undefined,
  body: {},
  headers: {},
  method: 'get',
  url: 'https://api.example.com/v1/config/domain/$1/service/$2',
  params: {},
  timeout: 3000,
  useCache: true,
  cacheTtl: 100,
  retryConfig: {
    times: 3,
    interval: 10,
  }
};

const mongoConnections = [
  {
    name: 'config',
    url:
      'mongodb://'
      + 'id:password@example.mongoserver.com:27017'
      + '?replicaSet=rs0&readPreference=secondaryPreferred',
    useCache: true,
    cacheTTL: 60,
  },
];

const queryObject = {
  name: 'config',
  db: 'configuration',
  collection: 'platform',
  query: {},
  fields: {},
  sort: {version: -1},
  skip: 0,
  limit: 1,
};
0.8.9

11 months ago

0.8.8

11 months ago

0.8.7

11 months ago

0.9.0

9 months ago

0.9.1

9 months ago

0.8.5

1 year ago

0.6.7

1 year ago

0.4.9

1 year ago

0.8.4

1 year ago

0.6.6

1 year ago

0.4.8

1 year ago

0.8.6

1 year ago

0.6.8

1 year ago

0.7.2

1 year ago

0.7.1

1 year ago

0.7.4

1 year ago

0.7.3

1 year ago

0.3.7

1 year ago

0.3.2

1 year ago

0.3.1

1 year ago

0.7.0

1 year ago

0.5.2

1 year ago

0.5.1

1 year ago

0.7.11

1 year ago

0.7.10

1 year ago

0.7.9

1 year ago

0.7.6

1 year ago

0.7.5

1 year ago

0.7.8

1 year ago

0.7.7

1 year ago

0.4.10

1 year ago

0.4.15

1 year ago

0.4.13

1 year ago

0.4.14

1 year ago

0.4.11

1 year ago

0.4.12

1 year ago

0.8.1

1 year ago

0.6.3

1 year ago

0.4.5

1 year ago

0.8.0

1 year ago

0.6.2

1 year ago

0.4.4

1 year ago

0.6.5

1 year ago

0.4.7

1 year ago

0.8.2

1 year ago

0.6.4

1 year ago

0.4.6

1 year ago

0.4.1

1 year ago

0.4.0

1 year ago

0.6.1

1 year ago

0.4.3

1 year ago

0.6.0

1 year ago

0.4.2

1 year ago

0.1.15

2 years ago

0.1.20

1 year ago

0.1.21

1 year ago

0.3.0

1 year ago

0.2.0

1 year ago

0.1.16

2 years ago

0.1.17

1 year ago

0.1.18

1 year ago

0.1.19

1 year ago

0.1.14

2 years ago

0.1.13

2 years ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.5

2 years ago