Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deps #560

Merged
merged 3 commits into from
Apr 29, 2024
Merged

Deps #560

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
# Go
steps:
- name: Check out repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

Expand All @@ -40,7 +40,14 @@ jobs:
- name: Install
run: npm install

- name: Test (Node.js <= 16.x)
if: matrix.node-version <= '16.x'
run: npm run test:nolint
env:
CI: true

- name: Test
if: matrix.node-version > '16.x'
run: npm test
env:
CI: true
Expand Down Expand Up @@ -72,10 +79,10 @@ jobs:
# Go
steps:
- name: Check out repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: lts/*
registry-url: https://registry.npmjs.org/
Expand Down
9 changes: 9 additions & 0 deletions _changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ Also see: [Architect changelog](https://github.com/architect/architect/blob/main

---

## [8.1.1] 2024-04-29

### Changed

- Updated dependencies
- Updated `package.json` `engines.node` property to reflect changes from v8

---

## [8.1.0] 2024-03-07

### Added
Expand Down
16 changes: 16 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const arc = require('@architect/eslint-config')

module.exports = [
...arc,
{
ignores: [
'.nyc_output/',
'arc-proxy-*',
'coverage/',
'dist.js',
'scratch/',
'src/http/get-index',
'types/',
],
},
]
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,22 @@
"types": "types/index.d.ts",
"scripts": {
"lint": "eslint --fix .",
"test": "npm run lint && npm run test:integration && npm run coverage && npm run test:types",
"test:nolint": "npm run test:integration && npm run coverage && npm run test:types",
"test:unit": "cross-env tape 'test/unit/**/*-test.js' | tap-arc",
"test:integration": "cross-env tape 'test/integration/**/*-test.js' | tap-arc",
"coverage": "nyc --reporter=lcov --reporter=text npm run test:unit",
"test": "npm run lint && npm run test:integration && npm run coverage && npm run test:types",
"test:types": "tsd --files types/*.test-d.ts",
"rc": "npm version prerelease --preid RC"
},
"engines": {
"node": ">=14"
"node": ">=16"
},
"author": "Brian LeRoux <b@brian.io>",
"license": "Apache-2.0",
"dependencies": {
"@aws-lite/apigatewaymanagementapi": "^0.0.8",
"@aws-lite/client": "^0.20.0",
"@aws-lite/client": "^0.21.1",
"@aws-lite/dynamodb": "^0.3.4",
"@aws-lite/sns": "^0.0.6",
"@aws-lite/sqs": "^0.2.2",
Expand All @@ -40,25 +41,25 @@
"uid-safe": "^2.1.5"
},
"devDependencies": {
"@architect/asap": "^7.0.8",
"@architect/eslint-config": "2.1.2",
"@architect/asap": "^7.0.10",
"@architect/eslint-config": "^3.0.0",
"@architect/req-res-fixtures": "git+https://github.com/architect/req-res-fixtures.git",
"@architect/sandbox": "^6.0.2",
"@architect/sandbox": "^6.0.4",
"@aws-lite/apigatewaymanagementapi-types": "^0.0.11",
"@aws-lite/dynamodb-types": "^0.3.6",
"@aws-lite/sns-types": "^0.0.8",
"@aws-lite/sqs-types": "^0.2.4",
"@types/aws-lambda": "^8.10.136",
"@types/aws-lambda": "^8.10.137",
"@types/node": "18",
"cross-env": "~7.0.3",
"eslint": "^8.57.0",
"eslint": "^9.1.1",
"nyc": "~15.1.0",
"proxyquire": "~2.1.3",
"sinon": "^17.0.1",
"tap-arc": "^1.2.2",
"tape": "^5.7.5",
"tiny-json-http": "^7.5.1",
"tsd": "^0.30.7"
"tsd": "^0.31.0"
},
"files": [
"types/*",
Expand Down
4 changes: 2 additions & 2 deletions src/events/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function eventFactory (arc) {
function publish (arn, payload, callback) {
client.sns.Publish({
TopicArn: arn,
Message: JSON.stringify(payload)
Message: JSON.stringify(payload),
})
.then(result => callback(null, result))
.catch(callback)
Expand Down Expand Up @@ -121,7 +121,7 @@ function queueFactory (arc) {
let params = {
QueueUrl: url,
DelaySeconds: delaySeconds || 0,
MessageBody: JSON.stringify(payload)
MessageBody: JSON.stringify(payload),
}
if (url.endsWith('.fifo')) {
params.MessageGroupId = groupID || name
Expand Down
4 changes: 2 additions & 2 deletions src/events/subscribe.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ let parallel = require('run-parallel')

let fallback = {
Records: [
{ Sns: { Message: JSON.stringify({}) } }
]
{ Sns: { Message: JSON.stringify({}) } },
],
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/http/_res-fmt.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ module.exports = function responseFormatter (req, params) {
let res = {
headers: Object.assign({}, { 'content-type': type }, params.headers || {}),
statusCode,
body
body,
}

// REST API stuff
Expand Down
6 changes: 3 additions & 3 deletions src/http/errors/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = function httpError (params) {
let {
statusCode = 502,
title = 'Unknown error',
message = ''
message = '',
} = params
title = title === 'Error'
? `${statusCode} error`
Expand All @@ -14,7 +14,7 @@ module.exports = function httpError (params) {
statusCode,
headers: {
'content-type': 'text/html; charset=utf8;',
'cache-control': 'no-cache, no-store, must-revalidate, max-age=0, s-maxage=0'
'cache-control': 'no-cache, no-store, must-revalidate, max-age=0, s-maxage=0',
},
body: `
<!DOCTYPE html>
Expand Down Expand Up @@ -83,6 +83,6 @@ module.exports = function httpError (params) {
</div>
</body>
</html>
`
`,
}
}
2 changes: 1 addition & 1 deletion src/http/helpers/binary-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ module.exports = [
'application/x-rar-compressed',
'application/x-tar',
'application/x-zip',
'application/zip'
'application/zip',
]
2 changes: 1 addition & 1 deletion src/http/helpers/body-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = function parseBody (req) {
: request.body
request.body = JSON.parse(data) || {}
}
catch (e) {
catch {
throw Error('Invalid request body encoding or invalid JSON')
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/http/helpers/csrf.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = function _csrf (req, res, next) {
else {
res({
status: 403,
html: 'invalid csrf token'
html: 'invalid csrf token',
})
}
}
4 changes: 2 additions & 2 deletions src/http/session/providers/ddb/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = function _create (name, payload, callback) {
if (err) callback(err)
else callback(null, { _secret: val })
})
}
},
],
function _put (err, results) {
if (err) throw err
Expand All @@ -29,7 +29,7 @@ module.exports = function _create (name, payload, callback) {
if (err) callback(err)
else data._client.PutItem({
TableName: name,
Item: session
Item: session,
}).then(() => callback(null, session)).catch(callback)
})
})
Expand Down
2 changes: 1 addition & 1 deletion src/http/session/providers/ddb/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = function _find (name, _idx, callback) {
else data._client.GetItem({
TableName: name,
ConsistentRead: true,
Key: { _idx }
Key: { _idx },
})
.then(item => {
let result = typeof item === 'undefined' ? false : item.Item
Expand Down
2 changes: 1 addition & 1 deletion src/http/session/providers/ddb/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function write (params, callback) {
let sameSite = ARC_SESSION_SAME_SITE || 'lax'
let options = {
maxAge,
expires: new Date(Date.now() + maxAge * 1000),
expires: new Date(Date.now() + (maxAge * 1000)),
secure: true,
httpOnly: true,
path: '/',
Expand Down
2 changes: 1 addition & 1 deletion src/http/session/providers/ddb/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = function _update (name, payload, callback) {
if (err) callback(err)
else data._client.PutItem({
TableName: name,
Item: session
Item: session,
}).then(() => callback(null, session)).catch(callback)
})
}
4 changes: 2 additions & 2 deletions src/http/session/providers/jwe.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ let jwe = {
setupCrypto()
const WEEK = 604800
return jwt.parse(token).setTokenLifetime(WEEK).verify(key)
}
},
}

/**
Expand Down Expand Up @@ -99,7 +99,7 @@ function write (payload, callback) {
let sameSite = ARC_SESSION_SAME_SITE || 'lax'
let options = {
maxAge,
expires: new Date(Date.now() + maxAge * 1000),
expires: new Date(Date.now() + (maxAge * 1000)),
secure: true,
httpOnly: true,
path: '/',
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ let arc = {
}
})
})
}
},
}
arc.events = require('./events')(arc, 'events')
arc.queues = require('./events')(arc, 'queues')
Expand Down
2 changes: 1 addition & 1 deletion src/lib/_get-ports.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = function getPorts (callback) {
// Fall back to an internal SSM query in case Functions is running as a bare module
else {
// Require in here or circular dep warnings may occur
// eslint-disable-next-line

let discovery = require('../discovery')
discovery((err, services) => {
if (err) callback(err)
Expand Down
2 changes: 1 addition & 1 deletion src/tables/factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function dynamoConstructor (params, callback) {

update (params, callback) {
return go(aws.dynamodb.UpdateItem, { ...params, TableName }, callback)
}
},
}
}
callback(null, data)
Expand Down
2 changes: 1 addition & 1 deletion src/tables/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = function tables (arc) {
function (created, callback) {
client = created
callback(null, client)
}
},
], callback)
}
return promise
Expand Down
14 changes: 7 additions & 7 deletions src/tables/legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ module.exports = function getLegacyDynamoClients ({ port, region }) {
let DB, Doc

if (isNode18) {
// eslint-disable-next-line

let dynamo = require('@aws-sdk/client-dynamodb')
// eslint-disable-next-line

let docclient = require('@aws-sdk/lib-dynamodb')
DB = dynamo.DynamoDB
Doc = docclient.DynamoDBDocument
}
else {
// eslint-disable-next-line

let dynamo = require('aws-sdk/clients/dynamodb')
DB = dynamo
Doc = dynamo.DocumentClient
Expand All @@ -37,8 +37,8 @@ module.exports = function getLegacyDynamoClients ({ port, region }) {
keepAlive: true,
maxSockets: 50, // Node can set to Infinity; AWS maxes at 50
rejectUnauthorized: true,
})
}
}),
},
}
}
client.db = new DB(config)
Expand All @@ -53,10 +53,10 @@ module.exports = function getLegacyDynamoClients ({ port, region }) {
if (isNode18) {
// Disable keep-alive locally (or wait Node's default 5s for sockets to time out)
let http = require('http')
// eslint-disable-next-line

let { NodeHttpHandler } = require('@smithy/node-http-handler')
config.requestHandler = new NodeHttpHandler({
httpAgent: new http.Agent({ keepAlive: false })
httpAgent: new http.Agent({ keepAlive: false }),
})
}
client.db = new DB(config)
Expand Down
10 changes: 5 additions & 5 deletions src/tables/old.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ function __trigger (types, handler) {
}
}

/* eslint-disable indent */

module.exports = {
insert: __trigger.bind({}, [ 'INSERT' ]),
modify: __trigger.bind({}, [ 'MODIFY' ]),
update: __trigger.bind({}, [ 'MODIFY' ]),
remove: __trigger.bind({}, [ 'REMOVE' ]),
destroy: __trigger.bind({}, [ 'REMOVE' ]),
all: __trigger.bind({}, [ 'INSERT', 'MODIFY', 'REMOVE' ]),
save: __trigger.bind({}, [ 'INSERT', 'MODIFY' ]),
change: __trigger.bind({}, [ 'INSERT', 'REMOVE' ])
destroy: __trigger.bind({}, [ 'REMOVE' ]),
all: __trigger.bind({}, [ 'INSERT', 'MODIFY', 'REMOVE' ]),
save: __trigger.bind({}, [ 'INSERT', 'MODIFY' ]),
change: __trigger.bind({}, [ 'INSERT', 'REMOVE' ]),
}
2 changes: 1 addition & 1 deletion src/ws/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function instantiateAPI () {
if (client) res(client)

getAwsClient({
plugins: [ import('@aws-lite/apigatewaymanagementapi') ]
plugins: [ import('@aws-lite/apigatewaymanagementapi') ],
}, (err, _client) => {
if (err) rej(err)
else {
Expand Down
Loading