New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

sls-helper-plugin-janis

Package Overview
Dependencies
Maintainers
1
Versions
147
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sls-helper-plugin-janis - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

CHANGELOG.md

34

lib/plugin.js
'use strict';
const base = require('./service/base');
const templates = require('./service/templates');
const authorizers = require('./service/authorizers');
const cors = require('./service/cors');
const apiGet = require('./api/get');
const apiList = require('./api/list');
const apiPost = require('./api/post');
const apiPut = require('./api/put');
module.exports.base = require('./service/base');
module.exports = {
base,
templates,
authorizers,
cors,
apiGet,
apiList,
apiPost,
apiPut
};
module.exports.templates = require('./service/templates');
module.exports.authorizers = require('./service/authorizers');
module.exports.cors = require('./service/cors');
module.exports.apiGet = require('./api/get');
module.exports.apiList = require('./api/list');
module.exports.apiPost = require('./api/post');
module.exports.apiPut = require('./api/put');
module.exports.eventListener = require('./event-listener');

@@ -5,9 +5,37 @@ 'use strict';

FullAuthorizer: [
'method.request.header.janis-client',
'method.request.header.janis-api-key',
'method.request.header.janis-api-secret'
'janis-client',
'janis-api-key',
'janis-api-secret'
],
NoClientAuthorizer: [
'method.request.header.janis-api-key',
'method.request.header.janis-api-secret'
'janis-api-key',
'janis-api-secret'
],
LoggedAuthorizer: [
'janis-api-key',
'janis-api-secret'
],
ApiKeyAuthorizer: [
'janis-api-key',
'janis-api-secret'
],
UserAuthorizer: [
'janis-api-key',
'janis-api-secret'
],
DevUserAuthorizer: [
'janis-api-key',
'janis-api-secret'
],
ServiceAuthorizer: [
'janis-client',
'janis-api-key',
'janis-api-secret'
],
ServiceNoClientAuthorizer: [
'janis-api-key',
'janis-api-secret'
],
ClientAuthorizer: [
'janis-client'
]

@@ -19,3 +47,3 @@ };

resultTtlInSeconds: 300,
identitySource: headers.join(','),
identitySource: headers.map(header => `method.request.header.${header}`).join(','),
type: 'request'

@@ -22,0 +50,0 @@ });

@@ -18,6 +18,6 @@ 'use strict';

return {
service: `Janis${serviceName}Service`,
service: 'Janis${self:custom.serviceName}Service',
provider: {
name: 'aws',
runtime: 'nodejs10.x',
runtime: 'nodejs12.x',
memorySize: 256,

@@ -27,5 +27,29 @@ stage: 'local',

endpointType: 'REGIONAL',
apiName: 'JANIS ${self:custom.humanReadableStage.${self:custom.stage}} ${self:custom.serviceName} API',
environment: {
JANIS_SERVICE_NAME: '${self:custom.serviceNameInLowerCase}',
JANIS_SERVICE_SECRET: '${self:custom.serviceApiSecret.${self:custom.stage}}',
JANIS_ENV: '${self:custom.stage}',
MS_PATH: 'src'
},
tags: {
Owner: 'Janis',
Microservice: '${self:custom.serviceName}',
Stack: '${self:custom.humanReadableStage.${self:custom.stage}}'
},
iamRoleStatements: [
{
Effect: 'Allow',
Action: [
's3:PutObject'
],
Resource: [
'arn:aws:s3:::janis-trace-service-${self:custom.stage}/*'
]
}
],
...(provider || {})
},
package: {
individually: true,
include: [

@@ -43,2 +67,18 @@ 'src/config/*',

humanReadableStage: {
local: 'Local',
beta: 'Beta',
qa: 'QA',
prod: 'Prod'
},
'serverless-offline': {
port: servicePort,
host: '0.0.0.0',
stage: 'local',
prefix: 'api',
printOutput: true,
cacheInvalidationRegex: 'node_modules/(?!\\@janiscommerce\\/[^(mongodb|mysql)])'
},
janisDomains: {

@@ -59,2 +99,6 @@ local: 'janis.localhost',

cacheEnabled: {
prod: false
},
apiGatewayCaching: {

@@ -66,13 +110,87 @@ enabled: '${self:custom.cacheEnabled.${self:custom.stage}, \'false\'}',

'serverless-offline': {
port: servicePort,
host: '0.0.0.0',
stage: 'local',
prefix: 'api',
printOutput: true
stageVariables: {
serviceName: '${self:custom.serviceNameInLowerCase}'
},
serviceApiSecret: {
local: '',
beta: '',
qa: '',
prod: ''
},
reducer: {
ignoreMissing: true
},
...(custom || {})
},
plugins: [
'serverless-domain-manager',
'serverless-reqvalidator-plugin',
'serverless-offline',
'serverless-api-gateway-caching',
'serverless-plugin-reducer',
'serverless-plugin-stage-variables'
],
resources: [
{
Resources: {
unauthorizedResponse: {
Type: 'AWS::ApiGateway::GatewayResponse',
Properties: {
ResponseParameters: {
'gatewayresponse.header.Access-Control-Allow-Origin': 'method.request.header.Origin'
},
ResponseTemplates: {
'application/json': '{"message":$context.error.messageString}'
},
ResponseType: 'UNAUTHORIZED',
RestApiId: {
Ref: 'ApiGatewayRestApi'
},
StatusCode: '401'
}
},
badRequestBodyResponse: {
Type: 'AWS::ApiGateway::GatewayResponse',
Properties: {
ResponseParameters: {
'gatewayresponse.header.Access-Control-Allow-Origin': 'method.request.header.Origin'
},
ResponseTemplates: {
'application/json': '{"message":$context.error.messageString,"validationError":"$context.error.validationErrorString"}'
},
ResponseType: 'BAD_REQUEST_BODY',
RestApiId: {
Ref: 'ApiGatewayRestApi'
},
StatusCode: '400'
}
},
badRequestParameters: {
Type: 'AWS::ApiGateway::GatewayResponse',
Properties: {
ResponseParameters: {
'gatewayresponse.header.Access-Control-Allow-Origin': 'method.request.header.Origin'
},
ResponseTemplates: {
'application/json': '{"message":$context.error.messageString,"validationError":"$context.error.validationErrorString"}'
},
ResponseType: 'BAD_REQUEST_PARAMETERS',
RestApiId: {
Ref: 'ApiGatewayRestApi'
},
StatusCode: '400'
}
}
}
}
],
...serviceConfig
};
};
{
"name": "sls-helper-plugin-janis",
"version": "1.0.0",
"version": "1.1.0",
"description": "A Serverless Helper plugin to add custom helpers for JANIS Commerce",

@@ -5,0 +5,0 @@ "main": "lib/plugin.js",

@@ -79,2 +79,13 @@ # Serverless Helper Plugin JANIS

| requestHeaders | object | A key value to map headers to a boolean indicating if it's required or not | | |
| authorizer | string | The name of the authorizer | Valid authorizers: FullAuthorizer, NoClientAuthorizer | |
| authorizer | string | The name of the authorizer | Valid authorizers: FullAuthorizer, NoClientAuthorizer, LoggedAuthorizer, ApiKeyAuthorizer, UserAuthorizer, DevUserAuthorizer, ServiceAuthorizer, ServiceNoClientAuthorizer, ClientAuthorizer | |
### eventListener
Used to implement JANIS Events listeners
| Option | Type | Description | Attributes | Default value |
|--------|------|-------------|------------|---------------|
| entityName | string | The entity name | **Required** | |
| eventName | string | The event name | **Required** | |
| mustHaveClient | boolean | Indicates if authorizer must validate that client or not | | false |
| listenersDirName | string | Indicates the path where the event listener files are placed | | 'event-listeners' |
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc