This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { NativeAttributeValue } from '@aws-sdk/util-dynamodb/src/models'; | |
import { AttributeValue } from '@aws-sdk/client-dynamodb'; | |
import { marshall } from '@aws-sdk/util-dynamodb'; | |
interface DynamoUpdateParams { | |
UpdateExpression: string; | |
ExpressionAttributeNames: Record<string, string>; | |
ExpressionAttributeValues: Record<string, AttributeValue>; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TODO's Index | |
<template> | |
<ToDo v-for="todo in todos" :data="todo"/> | |
</template> | |
<script> | |
export default { | |
data() { | |
return { | |
todos: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"app": "npx ts-node --prefer-ts-exts bin/example-cdk.ts", | |
"context": { | |
"@aws-cdk/core:enableStackNameDuplicates": "true", | |
"aws-cdk:enableDiffNoFail": "true", | |
"@aws-cdk/core:stackRelativeExports": "true", | |
"@aws-cdk/aws-ecr-assets:dockerIgnoreSupport": true, | |
"@aws-cdk/aws-secretsmanager:parseOwnedSecretName": true, | |
"@aws-cdk/aws-kms:defaultKeyPolicies": true, | |
"@aws-cdk/aws-s3:grantWriteWithoutAcl": true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"compilerOptions": { | |
// project options | |
"lib": [ | |
"ESNext", | |
"dom" | |
], // specifies which default set of type definitions to use ("DOM", "ES6", etc) | |
"outDir": "lib", // .js (as well as .d.ts, .js.map, etc.) files will be emitted into this directory., | |
"removeComments": true, // Strips all comments from TypeScript files when converting into JavaScript- you rarely read compiled code so this saves space | |
"target": "ES6", // Target environment. Most modern browsers support ES6, but you may want to set it to newer or older. (defaults to ES3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hasOwnProperty<X extends {}, Y extends PropertyKey>(obj: X, prop: Y): obj is X & Record<Y, unknown> { | |
return Object.hasOwnProperty.call(obj, prop) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface DynamoUpdateParams { | |
UpdateExpression: string; | |
ExpressionAttributeNames: Record<string, string>; | |
ExpressionAttributeValues: Record<string, unknown>; | |
} | |
export const DynamicUpdateExpressionFromObject = (map: Record<string, unknown>): DynamoUpdateParams => { | |
const ExpressionAttributeNames: Record<string, string> = Object.keys(map) | |
.reduce((acc, curr) => ({ ...acc, ...{ [`#${curr}`]: curr } }), {}); | |
const UpdateExpression: string = Object.values(ExpressionAttributeNames) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Using Loops (and Regex) | |
const validateIP = ip => { | |
const regex = /^\d+$/; | |
const s = IP.split('.'); | |
if(s.length !== 4) return false; | |
for(let i = 0; i < s.length; i++) { | |
if(!regex.test(s[i])) return false; | |
if(s[i].length > 1 && s[i].startsWith('0')) return false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:12 | |
WORKDIR /app | |
# install JRE for dynamo-offline (required for tests) | |
RUN apt-get update \ | |
&& apt-get install -y default-jre \ | |
&& apt-get clean \ | |
&& rm -rf /var/lib/apt/lists/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image: docker:latest | |
cache: | |
paths: | |
- node_modules/ | |
stages: | |
- build | |
- precheck | |
- test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqsRecordGenerator from '@tests/utilities/sqsRecordFactory'; | |
import { SQSEvent, SQSRecord } from 'aws-lambda'; | |
export default (events?: SQSRecord[]): SQSEvent => ({ | |
Records: events || [sqsRecordGenerator()], | |
}); |
NewerOlder