@bifravst/aws-cdk-lambda-helpers 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdk/TestApp.d.ts +5 -0
- package/dist/cdk/TestApp.js +12 -0
- package/dist/cdk/TestStack.d.ts +12 -0
- package/dist/cdk/TestStack.js +39 -0
- package/dist/cdk/baseLayer.d.ts +2 -0
- package/dist/cdk/baseLayer.js +5 -0
- package/dist/cdk/e2e.js +11 -0
- package/dist/cdk/lambda.d.ts +2 -0
- package/dist/cdk/lambda.js +5 -0
- package/dist/cdk/packTestLambdas.d.ts +5 -0
- package/dist/cdk/packTestLambdas.js +4 -0
- package/dist/e2e.spec.js +17 -0
- package/dist/lambdas/test.zip +0 -0
- package/dist/layers/baseLayer/nodejs/node_modules/.package-lock.json +16 -0
- package/dist/layers/baseLayer/nodejs/node_modules/id128/CHANGES +20 -0
- package/dist/layers/baseLayer/nodejs/node_modules/id128/LICENSE +18 -0
- package/dist/layers/baseLayer/nodejs/node_modules/id128/README.md +853 -0
- package/dist/layers/baseLayer/nodejs/node_modules/id128/index.d.ts +167 -0
- package/dist/layers/baseLayer/nodejs/node_modules/id128/index.js +49 -0
- package/dist/layers/baseLayer/nodejs/node_modules/id128/package.json +68 -0
- package/dist/layers/baseLayer/nodejs/node_modules/id128/src/coder/base.js +53 -0
- package/dist/layers/baseLayer/nodejs/node_modules/id128/src/coder/crockford32.js +114 -0
- package/dist/layers/baseLayer/nodejs/node_modules/id128/src/coder/hex.js +63 -0
- package/dist/layers/baseLayer/nodejs/node_modules/id128/src/coder/uuid.js +77 -0
- package/dist/layers/baseLayer/nodejs/node_modules/id128/src/common/byte-array.js +26 -0
- package/dist/layers/baseLayer/nodejs/node_modules/id128/src/common/epoch-converter.js +32 -0
- package/dist/layers/baseLayer/nodejs/node_modules/id128/src/common/exception.js +18 -0
- package/dist/layers/baseLayer/nodejs/node_modules/id128/src/common/fake-machine.js +26 -0
- package/dist/layers/baseLayer/nodejs/node_modules/id128/src/common/machine.js +37 -0
- package/dist/layers/baseLayer/nodejs/node_modules/id128/src/common/random-bytes-browser.js +9 -0
- package/dist/layers/baseLayer/nodejs/node_modules/id128/src/common/random-bytes.js +17 -0
- package/dist/layers/baseLayer/nodejs/node_modules/id128/src/factory/id.js +96 -0
- package/dist/layers/baseLayer/nodejs/node_modules/id128/src/factory/versioned-id.js +72 -0
- package/dist/layers/baseLayer/nodejs/node_modules/id128/src/id/base.js +39 -0
- package/dist/layers/baseLayer/nodejs/node_modules/id128/src/id/ulid-monotonic.js +71 -0
- package/dist/layers/baseLayer/nodejs/node_modules/id128/src/id/ulid.js +64 -0
- package/dist/layers/baseLayer/nodejs/node_modules/id128/src/id/uuid-1.js +149 -0
- package/dist/layers/baseLayer/nodejs/node_modules/id128/src/id/uuid-4.js +24 -0
- package/dist/layers/baseLayer/nodejs/node_modules/id128/src/id/uuid-6.js +146 -0
- package/dist/layers/baseLayer/nodejs/node_modules/id128/src/id/uuid-nil.js +33 -0
- package/dist/layers/baseLayer/nodejs/node_modules/id128/src/id/uuid.js +58 -0
- package/dist/layers/baseLayer/nodejs/node_modules/id128/utils.js +35 -0
- package/dist/layers/baseLayer/nodejs/package-lock.json +6671 -0
- package/dist/layers/baseLayer/nodejs/package.json +1 -0
- package/dist/layers/baseLayer.zip +0 -0
- package/dist/src/checkSumOfFiles.spec.d.ts +1 -0
- package/dist/src/commonParent.spec.d.ts +1 -0
- package/dist/{packLambda.d.ts → src/packLambda.d.ts} +2 -2
- package/package.json +12 -6
- /package/dist/{checkSumOfFiles.spec.d.ts → cdk/e2e.d.ts} +0 -0
- /package/dist/{commonParent.spec.d.ts → e2e.spec.d.ts} +0 -0
- /package/dist/{LambdaLogGroup.d.ts → src/LambdaLogGroup.d.ts} +0 -0
- /package/dist/{LambdaLogGroup.js → src/LambdaLogGroup.js} +0 -0
- /package/dist/{LambdaSource.d.ts → src/LambdaSource.d.ts} +0 -0
- /package/dist/{LambdaSource.js → src/LambdaSource.js} +0 -0
- /package/dist/{cdk.d.ts → src/cdk.d.ts} +0 -0
- /package/dist/{cdk.js → src/cdk.js} +0 -0
- /package/dist/{checkSumOfFiles.spec.js → src/checkSumOfFiles.spec.js} +0 -0
- /package/dist/{checksumOfFiles.d.ts → src/checksumOfFiles.d.ts} +0 -0
- /package/dist/{checksumOfFiles.js → src/checksumOfFiles.js} +0 -0
- /package/dist/{commonParent.d.ts → src/commonParent.d.ts} +0 -0
- /package/dist/{commonParent.js → src/commonParent.js} +0 -0
- /package/dist/{commonParent.spec.js → src/commonParent.spec.js} +0 -0
- /package/dist/{findDependencies.d.ts → src/findDependencies.d.ts} +0 -0
- /package/dist/{findDependencies.js → src/findDependencies.js} +0 -0
- /package/dist/{lambda.d.ts → src/lambda.d.ts} +0 -0
- /package/dist/{lambda.js → src/lambda.js} +0 -0
- /package/dist/{layer.d.ts → src/layer.d.ts} +0 -0
- /package/dist/{layer.js → src/layer.js} +0 -0
- /package/dist/{packLambda.js → src/packLambda.js} +0 -0
- /package/dist/{packLambdaFromPath.d.ts → src/packLambdaFromPath.d.ts} +0 -0
- /package/dist/{packLambdaFromPath.js → src/packLambdaFromPath.js} +0 -0
- /package/dist/{packLayer.d.ts → src/packLayer.d.ts} +0 -0
- /package/dist/{packLayer.js → src/packLayer.js} +0 -0
- /package/dist/{util.d.ts → src/util.d.ts} +0 -0
- /package/dist/{util.js → src/util.js} +0 -0
@@ -0,0 +1,12 @@
|
|
1
|
+
import { App, Stack } from 'aws-cdk-lib';
|
2
|
+
import type { PackedLayer } from '../src/layer.js';
|
3
|
+
import type { TestLambdas } from './packTestLambdas.js';
|
4
|
+
export declare class TestStack extends Stack {
|
5
|
+
constructor(parent: App, id: string, { lambdaSources, layer, }: {
|
6
|
+
lambdaSources: TestLambdas;
|
7
|
+
layer: PackedLayer;
|
8
|
+
});
|
9
|
+
}
|
10
|
+
export type StackOutputs = {
|
11
|
+
lambdaURL: string;
|
12
|
+
};
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import { App, CfnOutput, Duration, aws_lambda as Lambda, Stack, } from 'aws-cdk-lib';
|
2
|
+
import { LambdaLogGroup, LambdaSource } from '../src/cdk.js';
|
3
|
+
export class TestStack extends Stack {
|
4
|
+
constructor(parent, id, { lambdaSources, layer, }) {
|
5
|
+
super(parent, id, {});
|
6
|
+
const baseLayer = new Lambda.LayerVersion(this, 'baseLayer', {
|
7
|
+
layerVersionName: `${Stack.of(this).stackName}-baseLayer`,
|
8
|
+
code: new LambdaSource(this, {
|
9
|
+
id: 'baseLayer',
|
10
|
+
zipFile: layer.layerZipFile,
|
11
|
+
hash: layer.hash,
|
12
|
+
}).code,
|
13
|
+
compatibleArchitectures: [Lambda.Architecture.ARM_64],
|
14
|
+
compatibleRuntimes: [Lambda.Runtime.NODEJS_20_X],
|
15
|
+
});
|
16
|
+
const fn = new Lambda.Function(this, 'fn', {
|
17
|
+
handler: lambdaSources.test.handler,
|
18
|
+
architecture: Lambda.Architecture.ARM_64,
|
19
|
+
runtime: Lambda.Runtime.NODEJS_20_X,
|
20
|
+
timeout: Duration.seconds(1),
|
21
|
+
memorySize: 1792,
|
22
|
+
code: new LambdaSource(this, lambdaSources.test).code,
|
23
|
+
description: 'Returns a ULID',
|
24
|
+
environment: {
|
25
|
+
NODE_NO_WARNINGS: '1',
|
26
|
+
},
|
27
|
+
layers: [baseLayer],
|
28
|
+
...new LambdaLogGroup(this, 'fnLogs'),
|
29
|
+
});
|
30
|
+
const url = fn.addFunctionUrl({
|
31
|
+
authType: Lambda.FunctionUrlAuthType.NONE,
|
32
|
+
});
|
33
|
+
new CfnOutput(this, 'lambdaURL', {
|
34
|
+
exportName: `${this.stackName}:lambdaURL`,
|
35
|
+
description: 'API endpoint',
|
36
|
+
value: url.url,
|
37
|
+
});
|
38
|
+
}
|
39
|
+
}
|
package/dist/cdk/e2e.js
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
import { TestApp } from './TestApp.js';
|
2
|
+
import { pack as packBaseLayer } from './baseLayer.js';
|
3
|
+
import { packTestLambdas } from './packTestLambdas.js';
|
4
|
+
import { fromEnv } from '@nordicsemiconductor/from-env';
|
5
|
+
const { stackName } = fromEnv({
|
6
|
+
stackName: 'STACK_NAME',
|
7
|
+
})(process.env);
|
8
|
+
new TestApp(stackName, {
|
9
|
+
lambdaSources: await packTestLambdas(),
|
10
|
+
layer: await packBaseLayer(),
|
11
|
+
});
|
package/dist/e2e.spec.js
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
import { describe, it } from 'node:test';
|
2
|
+
import assert from 'node:assert/strict';
|
3
|
+
import { stackOutput } from '@nordicsemiconductor/cloudformation-helpers';
|
4
|
+
import { CloudFormationClient } from '@aws-sdk/client-cloudformation';
|
5
|
+
import { fromEnv } from '@nordicsemiconductor/from-env';
|
6
|
+
void describe('end-to-end tests', () => {
|
7
|
+
void it('should return an ULID', async () => {
|
8
|
+
const { stackName } = fromEnv({
|
9
|
+
stackName: 'STACK_NAME',
|
10
|
+
})(process.env);
|
11
|
+
const { lambdaURL } = await stackOutput(new CloudFormationClient({}))(stackName);
|
12
|
+
const res = await fetch(new URL(lambdaURL));
|
13
|
+
assert.equal(res.ok, true);
|
14
|
+
assert.equal(res.status, 201);
|
15
|
+
assert.match(await res.text(), /^[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}$/);
|
16
|
+
});
|
17
|
+
});
|
Binary file
|
@@ -0,0 +1,16 @@
|
|
1
|
+
{
|
2
|
+
"name": "@bifravst/aws-cdk-lambda-helpers",
|
3
|
+
"version": "0.0.0-development",
|
4
|
+
"lockfileVersion": 3,
|
5
|
+
"requires": true,
|
6
|
+
"packages": {
|
7
|
+
"node_modules/id128": {
|
8
|
+
"version": "1.6.6",
|
9
|
+
"resolved": "https://registry.npmjs.org/id128/-/id128-1.6.6.tgz",
|
10
|
+
"integrity": "sha512-ExSXL9qcyQ7X/AfyO4ouARLnztm7Nmry1rwGi1nbrtSM90tjjqKzeMKqJfkw5bDdDX7XqdXIRzYYkVj5PU28Hg==",
|
11
|
+
"engines": {
|
12
|
+
"node": ">=v6.9.0"
|
13
|
+
}
|
14
|
+
}
|
15
|
+
}
|
16
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
- 0.1.0 : Move extraneous exports from index.js into utils.js.
|
2
|
+
- 0.2.0 : Add browser support for Browserify/Webpack.
|
3
|
+
- 0.3.0 : Pass named arguments to .generate instead of positional.
|
4
|
+
- 1.0.0 : Added support for Uuid V1 and extracted competitive benchmarks.
|
5
|
+
- 1.0.1 : Remove lockfile from release.
|
6
|
+
- 1.0.2 : Fix bad version push.
|
7
|
+
- 1.0.3 : Delete the extra benchmarks for real.
|
8
|
+
- 1.1.0 : Performance improvements and renamed resetClockSequence to reset.
|
9
|
+
- 1.1.1 : Fixed repo link.
|
10
|
+
- 1.2.0 : Added generic UUID factory.
|
11
|
+
- 1.3.0 : Added UUID V6 support.
|
12
|
+
- 1.4.0 : Exposed encoding verifiers.
|
13
|
+
- 1.5.0 : Fixed benchmarks and added support for node +12.5.
|
14
|
+
- 1.6.0 : Added Typescript support and top-level id comparators.
|
15
|
+
- 1.6.1 : Tweaked random memory allocation and updated benchmarks.
|
16
|
+
- 1.6.2 : Fixed docs
|
17
|
+
- 1.6.3 : Fixed memory profile by reusing the buffer of random.
|
18
|
+
- 1.6.4 : Fixed worker support
|
19
|
+
- 1.6.5 : Removed erroneous packaged files
|
20
|
+
- 1.6.6 : Fix CHANGES and add credit for worker support
|
@@ -0,0 +1,18 @@
|
|
1
|
+
Copyright 2018 Aaron Cohen <aarondcohen@gmail.com>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
5
|
+
the Software without restriction, including without limitation the rights to
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
7
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
8
|
+
subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
15
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
16
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
17
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
18
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|