This file contains hidden or 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 { createServer, proxy } from 'aws-serverless-express'; | |
import connectDatabase from './database'; | |
import app from './app'; | |
export const handler = (event, ctx) => { | |
// This will re-use `cachedMongoConn` between function calls. | |
// See https://www.mongodb.com/blog/post/serverless-development-with-nodejs-aws-lambda-mongodb-atlas | |
// See https://docs.atlas.mongodb.com/best-practices-connecting-to-aws-lambda/ |
This file contains hidden or 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 'isomorphic-fetch'; | |
import Koa from 'koa'; | |
import bodyParser from 'koa-bodyparser'; | |
import convert from 'koa-convert'; | |
import cors from 'koa-cors'; | |
import koaLogger from 'koa-logger'; | |
import Router from '@koa/router'; | |
const app = new Koa(); |
This file contains hidden or 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
CREATE OR REPLACE FUNCTION notify_rows_changes() | |
RETURNS trigger AS $$ | |
DECLARE | |
record JSON; | |
BEGIN | |
record := row_to_json(CASE TG_OP | |
WHEN 'INSERT' THEN NEW | |
WHEN 'UPDATE' THEN NEW | |
ELSE OLD | |
END); |
This file contains hidden or 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 * as CDK from '@aws-cdk/core'; | |
import * as S3 from '@aws-cdk/aws-s3'; | |
import * as S3Deployment from '@aws-cdk/aws-s3-deployment'; | |
import * as Lambda from '@aws-cdk/aws-lambda'; | |
import * as APIGateway from '@aws-cdk/aws-apigateway'; | |
import * as SSM from '@aws-cdk/aws-ssm'; | |
import * as SecretsManager from '@aws-cdk/aws-secretsmanager'; | |
import { ConfigProps, getParam, ModeStack } from './helpers'; |
This file contains hidden or 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 firebase from 'firebase/app'; | |
import 'firebase/messaging'; | |
import { useEffect, useRef } from 'react'; | |
import config from '../config'; | |
import firebaseConfig from './firebaseConfig'; | |
import { PushTokenAddMutation } from './__generated__/PushTokenAddMutation.graphql'; | |
import { PushTokenAdd, USER_PUSHENDPOINT_TYPE } from './PushTokenAddMutation'; |
This file contains hidden or 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
- name: Restore yarn workspaces | |
id: yarn-cache | |
uses: actions/cache@master | |
with: | |
path: | | |
node_modules | |
*/*/node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
- name: Install dependencies | |
if: steps.yarn-cache.outputs.cache-hit != 'true' |
This file contains hidden or 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 rules from "../rbac-rules"; | |
const check = (rules, role, action, data) => { | |
const permissions = rules[role]; | |
if (!permissions) { | |
// role is not present in the rules | |
return false; | |
} | |
const staticPermissions = permissions.static; |
This file contains hidden or 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 React, { useContext, useCallback } from 'react'; | |
export const FeatureFlagContext = React.createContext<string[]>([]); | |
export const useFeatureFlag = () => { | |
const features = useContext<string[]>(FeatureFlagContext); | |
const hasFeature = useCallback( | |
(feature: string) => { | |
return features.includes(feature); |
This file contains hidden or 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
const path = require('path'); | |
const nodeExternals = require('webpack-node-externals'); | |
const cwd = process.cwd(); | |
export const outputPath = path.join(cwd, '.webpack'); | |
export const outputFilename = 'bundle.js'; | |
export default { |
This file contains hidden or 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
module.exports = { | |
presets: [ | |
'@babel/preset-react', | |
[ | |
'@babel/preset-env', | |
{ | |
targets: { | |
node: 'current', | |
}, | |
}, |