From 23e0e234413386e2f3978620d0415aa222b39c62 Mon Sep 17 00:00:00 2001 From: Sidney Alcantara Date: Thu, 23 Apr 2020 11:21:04 +1000 Subject: [PATCH 01/38] rich text editor: fix ol --- www/public/static/tinymce_content.css | 3 ++- www/src/components/RenderedHtml.tsx | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/www/public/static/tinymce_content.css b/www/public/static/tinymce_content.css index b56edd53..2c7a13c4 100644 --- a/www/public/static/tinymce_content.css +++ b/www/public/static/tinymce_content.css @@ -47,7 +47,8 @@ a { color: #e22729; } -ul { +ul, +ol { margin: 0; padding-left: 1.5em; } diff --git a/www/src/components/RenderedHtml.tsx b/www/src/components/RenderedHtml.tsx index 61807ce5..3ee104ec 100644 --- a/www/src/components/RenderedHtml.tsx +++ b/www/src/components/RenderedHtml.tsx @@ -32,7 +32,7 @@ const useStyles = makeStyles(theme => "&:hover": { color: theme.palette.primary.dark }, }, - "& ul": { + "& ul, & ol": { margin: 0, paddingLeft: "1.5em", }, From 5544a76020d72199ab0e0978201fde1017691518 Mon Sep 17 00:00:00 2001 From: Sidney Alcantara Date: Thu, 23 Apr 2020 11:36:53 +1000 Subject: [PATCH 02/38] fix Url field style --- www/src/components/Table/formatters/Url.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/www/src/components/Table/formatters/Url.tsx b/www/src/components/Table/formatters/Url.tsx index 2f96bae8..a0d5d113 100644 --- a/www/src/components/Table/formatters/Url.tsx +++ b/www/src/components/Table/formatters/Url.tsx @@ -1,10 +1,18 @@ import React from "react"; import { CustomCellProps } from "./withCustomCell"; +import { Link } from "@material-ui/core"; + export default function Url({ value }: CustomCellProps) { return ( - + {value} - + ); } From bd9421f93f4a20dab9f8dadf800d2928890c7697 Mon Sep 17 00:00:00 2001 From: Sidney Alcantara Date: Thu, 23 Apr 2020 11:53:56 +1000 Subject: [PATCH 03/38] allow dateTime fields to be clearable --- www/src/components/SideDrawer/Form/Fields/DatePicker.tsx | 2 +- www/src/components/SideDrawer/Form/Fields/DateTimePicker.tsx | 2 +- www/src/components/Table/formatters/Date.tsx | 3 ++- www/src/components/Table/formatters/Url.tsx | 2 ++ www/src/contexts/firetableContext.tsx | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/www/src/components/SideDrawer/Form/Fields/DatePicker.tsx b/www/src/components/SideDrawer/Form/Fields/DatePicker.tsx index e39cbf7e..ab62ef27 100644 --- a/www/src/components/SideDrawer/Form/Fields/DatePicker.tsx +++ b/www/src/components/SideDrawer/Form/Fields/DatePicker.tsx @@ -18,7 +18,7 @@ export default function DatePicker(props: KeyboardDatePickerProps) { transformedValue = props.field.value; const handleChange = (date: Date | null) => { - if (!date || isNaN(date.valueOf())) return; + if (isNaN(date?.valueOf() ?? 0)) return; props.form.setFieldValue(props.field.name, date); }; diff --git a/www/src/components/SideDrawer/Form/Fields/DateTimePicker.tsx b/www/src/components/SideDrawer/Form/Fields/DateTimePicker.tsx index b6f9cb7e..e7fe1d4a 100644 --- a/www/src/components/SideDrawer/Form/Fields/DateTimePicker.tsx +++ b/www/src/components/SideDrawer/Form/Fields/DateTimePicker.tsx @@ -20,7 +20,7 @@ export default function DateTimePicker(props: KeyboardDateTimePickerProps) { transformedValue = props.field.value; const handleChange = (date: Date | null) => { - if (!date || isNaN(date.valueOf())) return; + if (isNaN(date?.valueOf() ?? 0)) return; props.form.setFieldValue(props.field.name, date); }; diff --git a/www/src/components/Table/formatters/Date.tsx b/www/src/components/Table/formatters/Date.tsx index 9cdf2ba6..d89fae68 100644 --- a/www/src/components/Table/formatters/Date.tsx +++ b/www/src/components/Table/formatters/Date.tsx @@ -58,7 +58,7 @@ export default function Date({ const [handleDateChange] = useDebouncedCallback( date => { - if (!date || isNaN(date.valueOf())) return; + if (isNaN(date?.valueOf() ?? 0)) return; onSubmit(date); if (dataGridRef?.current?.selectCell) @@ -75,6 +75,7 @@ export default function Date({ onClick={e => e.stopPropagation()} format={fieldType === FieldType.date ? DATE_FORMAT : DATE_TIME_FORMAT} fullWidth + clearable keyboardIcon={} className={clsx("cell-collapse-padding", classes.root)} InputProps={{ diff --git a/www/src/components/Table/formatters/Url.tsx b/www/src/components/Table/formatters/Url.tsx index a0d5d113..80372df3 100644 --- a/www/src/components/Table/formatters/Url.tsx +++ b/www/src/components/Table/formatters/Url.tsx @@ -4,6 +4,8 @@ import { CustomCellProps } from "./withCustomCell"; import { Link } from "@material-ui/core"; export default function Url({ value }: CustomCellProps) { + if (!value) return null; + return ( { fieldName: string, value: any ) => { - if (value === null || value === undefined) return; + if (value === undefined) return; const ftUser = firetableUser(currentUser); const _ft_updatedAt = new Date(); From 223aeab8a52f1dfab494b2639f0079190d68edc2 Mon Sep 17 00:00:00 2001 From: Sidney Alcantara Date: Thu, 23 Apr 2020 12:07:41 +1000 Subject: [PATCH 04/38] add SubTable field to side drawer --- .../SideDrawer/Form/Fields/SubTable.tsx | 78 +++++++++++++++++++ www/src/components/SideDrawer/Form/index.tsx | 9 ++- www/src/components/SideDrawer/index.tsx | 4 + 3 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 www/src/components/SideDrawer/Form/Fields/SubTable.tsx diff --git a/www/src/components/SideDrawer/Form/Fields/SubTable.tsx b/www/src/components/SideDrawer/Form/Fields/SubTable.tsx new file mode 100644 index 00000000..1f5de19e --- /dev/null +++ b/www/src/components/SideDrawer/Form/Fields/SubTable.tsx @@ -0,0 +1,78 @@ +import React from "react"; +import { FieldProps } from "formik"; + +import { Link } from "react-router-dom"; +import queryString from "query-string"; +import useRouter from "hooks/useRouter"; + +import { + makeStyles, + createStyles, + Grid, + Typography, + IconButton, +} from "@material-ui/core"; + +import LaunchIcon from "@material-ui/icons/Launch"; + +const useStyles = makeStyles(theme => + createStyles({ + labelContainer: { + borderRadius: theme.shape.borderRadius, + backgroundColor: + theme.palette.type === "light" + ? "rgba(0, 0, 0, 0.09)" + : "rgba(255, 255, 255, 0.09)", + padding: theme.spacing(9 / 8, 1, 9 / 8, 1.5), + + textAlign: "left", + minHeight: 56, + }, + }) +); + +export default function SubTable({ + form, + field, + label, + parentLabel, +}: FieldProps & { parentLabel?: string; label: string }) { + const classes = useStyles(); + + const router = useRouter(); + const parentLabels = queryString.parse(router.location.search).parentLabel; + + let subTablePath = ""; + if (parentLabels) + subTablePath = + encodeURIComponent(`${form.values.ref.path}/${field.name}`) + + `?parentLabel=${parentLabels},${ + parentLabel ? form.values[parentLabel] : "" + }`; + else + subTablePath = + encodeURIComponent(`${form.values.ref.path}/${field.name}`) + + `?parentLabel=${ + parentLabel ? encodeURIComponent(form.values[parentLabel]) : "" + }`; + + return ( + + + + {label} + {parentLabel && `: ${form.values[parentLabel]}`} + + + + + + + + ); +} diff --git a/www/src/components/SideDrawer/Form/index.tsx b/www/src/components/SideDrawer/Form/index.tsx index c0de3019..2dc78793 100644 --- a/www/src/components/SideDrawer/Form/index.tsx +++ b/www/src/components/SideDrawer/Form/index.tsx @@ -72,6 +72,9 @@ const ConnectTable = lazy(() => "./Fields/ConnectTable" /* webpackChunkName: "SideDrawer-ConnectTable" */ ) ); +const SubTable = lazy(() => + import("./Fields/SubTable" /* webpackChunkName: "SideDrawer-SubTable" */) +); const Action = lazy(() => import("./Fields/Action" /* webpackChunkName: "SideDrawer-Action" */) ); @@ -299,7 +302,11 @@ export default function Form({ fields, values }: IFormProps) { ); break; - // case FieldType.subTable: + case FieldType.subTable: + renderedField = ( + + ); + break; case FieldType.action: renderedField = ( diff --git a/www/src/components/SideDrawer/index.tsx b/www/src/components/SideDrawer/index.tsx index 23024b03..624421dd 100644 --- a/www/src/components/SideDrawer/index.tsx +++ b/www/src/components/SideDrawer/index.tsx @@ -87,6 +87,10 @@ export default function SideDrawer() { field.config = column.config; break; + case FieldType.subTable: + field.parentLabel = column.parentLabel; + break; + case FieldType.action: field.callableName = column.callableName; break; From 0b5df8633e533da1a71fbf789860466617f9eb11 Mon Sep 17 00:00:00 2001 From: Shams mosowi Date: Thu, 23 Apr 2020 10:35:02 +0800 Subject: [PATCH 05/38] snapshot sync docs --- .../functions/src/snapshotSync/config.json | 29 ++++ .../functions/src/snapshotSync/index.ts | 138 +++++++++++++----- .../functions/src/synonyms/config.ts | 5 +- .../functions/src/synonyms/index.ts | 8 +- 4 files changed, 133 insertions(+), 47 deletions(-) diff --git a/cloud_functions/functions/src/snapshotSync/config.json b/cloud_functions/functions/src/snapshotSync/config.json index 1c6bb576..47d45f75 100644 --- a/cloud_functions/functions/src/snapshotSync/config.json +++ b/cloud_functions/functions/src/snapshotSync/config.json @@ -3,7 +3,9 @@ "source": "teams", "onUpdate": true, "target": "teams/{{id}}/dueDiligence", + "targetType": "subCollection", "snapshotField": "team", + "isArray": false, "fieldsToSync": [ "cohort", "teamName", @@ -26,5 +28,32 @@ "gtm", "defensibility" ] + }, + { + "source": "founders", + "target": "{{team.docPath}}", + "targetType": "document", + "snapshotField": "teamMembers", + "isArray": true, + + "fieldsToSync": [ + [ + "firstName", + "lastName", + "title", + "preferredName", + "personalBio", + "founderType", + "founderBio", + "cohort", + "email", + "profilePhoto", + "twitter", + "employerLogos", + "linkedin", + "publicProfile", + "companies" + ] + ] } ] diff --git a/cloud_functions/functions/src/snapshotSync/index.ts b/cloud_functions/functions/src/snapshotSync/index.ts index acf6df55..bb89e855 100644 --- a/cloud_functions/functions/src/snapshotSync/index.ts +++ b/cloud_functions/functions/src/snapshotSync/index.ts @@ -4,7 +4,15 @@ import { db } from "../config"; import * as _ from "lodash"; import { replacer } from "../utils/email"; -// returns object of fieldsToSync + +enum TargetTypes { + subCollection = "subCollection", + document = "document", +} +/** + * returns object with only keys included in fieldsToSync + * @param docData + */ const docReducer = (docData: FirebaseFirestore.DocumentData) => ( acc: any, curr: string @@ -16,26 +24,17 @@ const docReducer = (docData: FirebaseFirestore.DocumentData) => ( /** * - * @param targetCollection + * @param targetPath * @param fieldsToSync */ -const syncDoc = ( - targetCollection: string, +const syncSubCollection = async ( + targetPath: string, snapshotField: string, - fieldsToSync: string[] -) => async (snapshot: FirebaseFirestore.DocumentSnapshot) => { - const docData = snapshot.data(); - if (!docData) return false; // returns if theres no data in the doc - const syncData = fieldsToSync.reduce(docReducer(docData), {}); - - const collectionPath = targetCollection.replace( - /\{\{(.*?)\}\}/g, - replacer({ ...docData, id: snapshot.id }) - ); - if (Object.keys(syncData).length === 0) return false; // returns if theres nothing to sync - const targetDocs = await db.collection(collectionPath).get(); + syncData: any, + snapshot: FirebaseFirestore.DocumentSnapshot +) => { + const targetDocs = await db.collection(targetPath).get(); if (targetDocs.empty) return false; - for (let i = 0; i < targetDocs.docs.length; i++) { const doc = targetDocs.docs[i]; await doc.ref.update({ @@ -48,25 +47,90 @@ const syncDoc = ( return true; }; +const syncDocSnapshot = async ( + targetPath, + isArray, + snapshotField, + newSnapshotData, + snapshot +) => { + const targetRef = db.doc(targetPath); + const targetSnapshot = await targetRef.get(); + const targetData = targetSnapshot.data(); + if (!targetData) { + console.warn("target does not exist"); + return false; + } + + if (isArray) { + const oldSnapshotsArray = targetData[snapshotField]; + const snapshotDocPath = snapshot.ref.path; + const oldSnapshot = _.find(oldSnapshotsArray, { docPath: snapshotDocPath }); + const updatedSnapshotsArray = _.filter(oldSnapshotsArray, item => { + return item.docPath !== snapshotDocPath; + }); + updatedSnapshotsArray.push({ ...oldSnapshot, snapshot: newSnapshotData }); + + return targetRef.update({ [snapshotField]: updatedSnapshotsArray }); + } else { + return targetRef.update({ + [snapshotField]: { + ...targetData[snapshotField], + snapshot: newSnapshotData, + }, + }); + } +}; + /** * onUpdate change to snapshot adapter * @param targetCollection * @param fieldsToSync */ -const syncDocOnUpdate = ( - targetCollection: string, - snapshotField: string, - fieldsToSync: string[] -) => (snapshot: functions.Change) => { - const afterData = snapshot.after.data(); - const beforeData = snapshot.before.data(); +const syncDocOnUpdate = (config: { + target: string; + snapshotField: string; + targetType: TargetTypes; + fieldsToSync: string[]; + isArray: boolean; +}) => (snapshot: functions.Change) => { + const { fieldsToSync, target, snapshotField, targetType, isArray } = config; + const afterData = fieldsToSync.reduce( + docReducer(snapshot.after.data() || {}), + {} + ); + const beforeData = fieldsToSync.reduce( + docReducer(snapshot.before.data() || {}), + {} + ); const hasChanged = !_.isEqual(afterData, beforeData); + if (Object.keys(afterData).length === 0) return false; // returns if theres nothing to sync + + const targetPath = target.replace( + /\{\{(.*?)\}\}/g, + replacer({ ...snapshot.after.data(), id: snapshot.after.id }) + ); if (hasChanged) { - return syncDoc( - targetCollection, - snapshotField, - fieldsToSync - )(snapshot.after); + switch (targetType) { + case TargetTypes.subCollection: + return syncSubCollection( + targetPath, + snapshotField, + afterData, + snapshot.after + ); + + case TargetTypes.document: + return syncDocSnapshot( + targetPath, + isArray, + snapshotField, + afterData, + snapshot.after + ); + default: + return false; + } } else { console.warn("no change detected"); return false; @@ -75,20 +139,14 @@ const syncDocOnUpdate = ( /** * returns 2 different trigger functions (onCreate,onUpdate) in an object - * @param collection configuration object + * @param config configuration object */ -const snapshotSyncFnsGenerator = collection => +const snapshotSyncFnsGenerator = config => Object.entries({ - onUpdate: collection.onUpdate + onUpdate: config.onUpdate ? functions.firestore - .document(`${collection.source}/{docId}`) - .onUpdate( - syncDocOnUpdate( - collection.target, - collection.snapshotField, - collection.fieldsToSync - ) - ) + .document(`${config.source}/{docId}`) + .onUpdate(syncDocOnUpdate(config)) : null, }).reduce((a, [k, v]) => (v === null ? a : { ...a, [k]: v }), {}); diff --git a/cloud_functions/functions/src/synonyms/config.ts b/cloud_functions/functions/src/synonyms/config.ts index 4392c7fa..c718463d 100644 --- a/cloud_functions/functions/src/synonyms/config.ts +++ b/cloud_functions/functions/src/synonyms/config.ts @@ -217,9 +217,8 @@ const config = [ listenerField: "icResult", synonymField: "isDecided", transformer: icResult => { - if (["Yes", "No"].includes(icResult)) { - return true; - } else return false; + if (icResult && ["Yes", "No"].includes(icResult)) return true; + else return false; }, }, ], diff --git a/cloud_functions/functions/src/synonyms/index.ts b/cloud_functions/functions/src/synonyms/index.ts index 23f8e302..56b9fd8d 100644 --- a/cloud_functions/functions/src/synonyms/index.ts +++ b/cloud_functions/functions/src/synonyms/index.ts @@ -12,10 +12,9 @@ type synonymGroup = { const synonyms = (docData, groups: synonymGroup[]) => groups.reduce((update: any, currGroup) => { if ( - currGroup.isForced || - (docData[currGroup.listenerField] && - docData[currGroup.synonymField] !== - currGroup.transformer(docData[currGroup.listenerField], docData)) + docData[currGroup.listenerField] && + docData[currGroup.synonymField] !== + currGroup.transformer(docData[currGroup.listenerField], docData) ) { return { ...update, @@ -41,6 +40,7 @@ const addSynonymOnUpdate = (groups: synonymGroup[]) => ( } const changedGroups = groups.reduce((acc: synonymGroup[], currGroup) => { if ( + currGroup.isForced || beforeData[currGroup.listenerField] !== afterData[currGroup.listenerField] ) { return [...acc, currGroup]; From 9ed3b40dc82df6caeeccc4fb080ccb507c3fe454 Mon Sep 17 00:00:00 2001 From: Shams mosowi Date: Thu, 23 Apr 2020 14:32:30 +0800 Subject: [PATCH 06/38] testing cloud build variables --- cloudbuildPermissionsFunctions.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cloudbuildPermissionsFunctions.yaml b/cloudbuildPermissionsFunctions.yaml index f4ede7a9..43ab43c4 100644 --- a/cloudbuildPermissionsFunctions.yaml +++ b/cloudbuildPermissionsFunctions.yaml @@ -25,5 +25,9 @@ steps: entrypoint: yarn args: - "deploy" + - "--project ${_PROJECT_ID}" + - "--only" - "functions:FT_permissions" dir: "cloud_functions/functions" + substitutions: + _PROJECT_ID: "project-id" # default value From 7ed19be0dc2b4b669c801c80b0a2074e277b7ce4 Mon Sep 17 00:00:00 2001 From: Shams mosowi Date: Thu, 23 Apr 2020 14:34:22 +0800 Subject: [PATCH 07/38] yaml fix --- cloudbuildPermissionsFunctions.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudbuildPermissionsFunctions.yaml b/cloudbuildPermissionsFunctions.yaml index 43ab43c4..bdd2ad10 100644 --- a/cloudbuildPermissionsFunctions.yaml +++ b/cloudbuildPermissionsFunctions.yaml @@ -29,5 +29,5 @@ steps: - "--only" - "functions:FT_permissions" dir: "cloud_functions/functions" - substitutions: + substitutions: _PROJECT_ID: "project-id" # default value From c07c7c6776898ac393a1eb39e95eb9b975f6b637 Mon Sep 17 00:00:00 2001 From: Shams mosowi Date: Thu, 23 Apr 2020 14:35:43 +0800 Subject: [PATCH 08/38] yaml fix2 --- cloudbuildPermissionsFunctions.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cloudbuildPermissionsFunctions.yaml b/cloudbuildPermissionsFunctions.yaml index bdd2ad10..67db0e5b 100644 --- a/cloudbuildPermissionsFunctions.yaml +++ b/cloudbuildPermissionsFunctions.yaml @@ -29,5 +29,5 @@ steps: - "--only" - "functions:FT_permissions" dir: "cloud_functions/functions" - substitutions: - _PROJECT_ID: "project-id" # default value +substitutions: + _PROJECT_ID: "project-id" # default value From 92dfab58aa48a0365105e8a93b39c6c60ba521a1 Mon Sep 17 00:00:00 2001 From: Shams mosowi Date: Thu, 23 Apr 2020 14:37:14 +0800 Subject: [PATCH 09/38] update build script --- cloud_functions/functions/package.json | 2 +- cloudbuildPermissionsFunctions.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cloud_functions/functions/package.json b/cloud_functions/functions/package.json index 30172b84..bc26e3d7 100644 --- a/cloud_functions/functions/package.json +++ b/cloud_functions/functions/package.json @@ -7,7 +7,7 @@ "serve": "npm run build && firebase serve --only functions", "shell": "npm run build && firebase functions:shell", "start": "npm run shell", - "deploy": "firebase deploy --token \"$FIREBASE_TOKEN\" --project antler-vc --only", + "deploy": "firebase deploy --token \"$FIREBASE_TOKEN\"", "logs": "firebase functions:log" }, "engines": { diff --git a/cloudbuildPermissionsFunctions.yaml b/cloudbuildPermissionsFunctions.yaml index 67db0e5b..cd897204 100644 --- a/cloudbuildPermissionsFunctions.yaml +++ b/cloudbuildPermissionsFunctions.yaml @@ -29,5 +29,6 @@ steps: - "--only" - "functions:FT_permissions" dir: "cloud_functions/functions" + substitutions: _PROJECT_ID: "project-id" # default value From 875a5810295d1cc603357ec1628271fd4c6503b0 Mon Sep 17 00:00:00 2001 From: Shams mosowi Date: Thu, 23 Apr 2020 14:39:41 +0800 Subject: [PATCH 10/38] fix yaml args --- cloudbuildPermissionsFunctions.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cloudbuildPermissionsFunctions.yaml b/cloudbuildPermissionsFunctions.yaml index cd897204..2fae304b 100644 --- a/cloudbuildPermissionsFunctions.yaml +++ b/cloudbuildPermissionsFunctions.yaml @@ -25,7 +25,8 @@ steps: entrypoint: yarn args: - "deploy" - - "--project ${_PROJECT_ID}" + - "--project" + - "${_PROJECT_ID}" - "--only" - "functions:FT_permissions" dir: "cloud_functions/functions" From efd86a2782db6424513d3847a4d82a537d654307 Mon Sep 17 00:00:00 2001 From: Shams mosowi Date: Thu, 23 Apr 2020 14:50:42 +0800 Subject: [PATCH 11/38] generalize cloudfunction build yaml --- cloudbuildfunctions.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cloudbuildfunctions.yaml b/cloudbuildfunctions.yaml index 2f739105..031ea2e6 100644 --- a/cloudbuildfunctions.yaml +++ b/cloudbuildfunctions.yaml @@ -25,5 +25,12 @@ steps: entrypoint: yarn args: - "deploy" - - "functions:exportTable" + - "--project" + - "${_PROJECT_ID}" + - "--only" + - "functions:${_FUNCTIONS_GROUP}" dir: "cloud_functions/functions" + +substitutions: + _PROJECT_ID: "project-id" # default value + _FUNCTIONS_GROUP: "exportTable" # default value From edb75f1bf6df932a1b19b39e0d96764f3cb75f02 Mon Sep 17 00:00:00 2001 From: Shams mosowi Date: Sat, 25 Apr 2020 19:00:56 +0800 Subject: [PATCH 12/38] fix: url fields without http redirect correctly --- www/src/components/Table/formatters/Url.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/www/src/components/Table/formatters/Url.tsx b/www/src/components/Table/formatters/Url.tsx index 80372df3..ea84d7ee 100644 --- a/www/src/components/Table/formatters/Url.tsx +++ b/www/src/components/Table/formatters/Url.tsx @@ -5,10 +5,10 @@ import { Link } from "@material-ui/core"; export default function Url({ value }: CustomCellProps) { if (!value) return null; - + const href = value.includes("http") ? value : `https://${value}`; return ( Date: Sat, 25 Apr 2020 19:02:55 +0800 Subject: [PATCH 13/38] callable cloud build trigger --- .../functions/src/buildTriggers/index.ts | 74 +++++++++++++++++++ cloud_functions/functions/src/index.ts | 1 + 2 files changed, 75 insertions(+) create mode 100644 cloud_functions/functions/src/buildTriggers/index.ts diff --git a/cloud_functions/functions/src/buildTriggers/index.ts b/cloud_functions/functions/src/buildTriggers/index.ts new file mode 100644 index 00000000..4f4c58ea --- /dev/null +++ b/cloud_functions/functions/src/buildTriggers/index.ts @@ -0,0 +1,74 @@ +import * as functions from "firebase-functions"; +const { CloudBuildClient } = require("@google-cloud/cloudbuild"); +const cb = new CloudBuildClient(); + +export const triggerCloudBuild = functions.https.onCall( + async ( + data: { + ref: { + id: string; + path: string; + parentId: string; + }; + row: any; + action: "run" | "redo" | "undo"; + }, + context: functions.https.CallableContext + ) => { + const { + row, //ref, action + } = data; + + if (!context.auth) { + return false; + } + const { triggerId, branch, projectId, groupName } = row; + + // Starts a build against the branch provided. + const [resp] = await cb.runBuildTrigger({ + projectId, //project hosting cloud build + triggerId, + source: { + branchName: branch, + substitutions: { + _PROJECT_ID: projectId, + _FUNCTIONS_GROUP: groupName, + }, + }, + }); + console.info(`triggered build for ${triggerId}`); + const [build] = await resp.promise(); + + const STATUS_LOOKUP = [ + "UNKNOWN", + "Queued", + "Working", + "Success", + "Failure", + "Error", + "Timeout", + "Cancelled", + ]; + for (const step of build.steps) { + console.info( + `step:\n\tname: ${step.name}\n\tstatus: ${STATUS_LOOKUP[build.status]}` + ); + } + + console.log(context.auth.token); + if (triggerId) { + return { + message: "cloud functions are snow flakes", + cellValue: { + redo: true, + status: `Triggered`, + // completedAt: serverTimestamp(), + meta: { ranBy: context.auth.token.email }, + undo: false, + }, + success: true, + }; + } + return false; + } +); diff --git a/cloud_functions/functions/src/index.ts b/cloud_functions/functions/src/index.ts index 5a46410e..85f20df7 100644 --- a/cloud_functions/functions/src/index.ts +++ b/cloud_functions/functions/src/index.ts @@ -16,6 +16,7 @@ import synonymsFnsGenerator from "./synonyms"; import synonymsConfig from "./synonyms/config"; export { exportTable } from "./export"; +export { triggerCloudBuild } from "./buildTriggers"; import * as callableFns from "./callable"; export const callable = callableFns; From a5167111141758d7fcb572b252e50cf973c82787 Mon Sep 17 00:00:00 2001 From: Shams mosowi Date: Sat, 25 Apr 2020 19:09:09 +0800 Subject: [PATCH 14/38] remove cloud build configs for individual fn groups --- cloud_functions/functions/package.json | 1 + cloudbuildAlgoliaFunctions.yaml | 29 --------------------- cloudbuildCollectionSyncFunctions.yaml | 29 --------------------- cloudbuildHistoryFunctions.yaml | 29 --------------------- cloudbuildPermissionsFunctions.yaml | 35 -------------------------- cloudbuildSnapshotSyncFunctions.yaml | 29 --------------------- cloudbuildSynonymsFunctions.yaml | 29 --------------------- 7 files changed, 1 insertion(+), 180 deletions(-) delete mode 100644 cloudbuildAlgoliaFunctions.yaml delete mode 100644 cloudbuildCollectionSyncFunctions.yaml delete mode 100644 cloudbuildHistoryFunctions.yaml delete mode 100644 cloudbuildPermissionsFunctions.yaml delete mode 100644 cloudbuildSnapshotSyncFunctions.yaml delete mode 100644 cloudbuildSynonymsFunctions.yaml diff --git a/cloud_functions/functions/package.json b/cloud_functions/functions/package.json index bc26e3d7..2d6566f4 100644 --- a/cloud_functions/functions/package.json +++ b/cloud_functions/functions/package.json @@ -15,6 +15,7 @@ }, "main": "lib/src/index.js", "dependencies": { + "@google-cloud/cloudbuild": "^1.5.0", "@types/algoliasearch": "^3.34.5", "@types/json2csv": "^4.5.0", "@types/lodash": "^4.14.149", diff --git a/cloudbuildAlgoliaFunctions.yaml b/cloudbuildAlgoliaFunctions.yaml deleted file mode 100644 index 96086f77..00000000 --- a/cloudbuildAlgoliaFunctions.yaml +++ /dev/null @@ -1,29 +0,0 @@ -steps: - - name: gcr.io/cloud-builders/gcloud - args: - - kms - - decrypt - - --ciphertext-file=cloud_functions/functions/.env.enc - - --plaintext-file=cloud_functions/functions/.env - - --location=global - - --keyring=antler-vc - - --key=cloudbuild-env - - name: gcr.io/cloud-builders/gcloud - args: - - kms - - decrypt - - --ciphertext-file=cloud_functions/functions/firebase-credentials.json.enc - - --plaintext-file=cloud_functions/functions/firebase-credentials.json - - --location=global - - --keyring=antler-vc - - --key=cloudbuild-env - - name: node:10.15.1 - entrypoint: yarn - args: ["install"] - dir: "cloud_functions/functions" - - name: node:10.15.1 - entrypoint: yarn - args: - - "deploy" - - "functions:FT_algolia" - dir: "cloud_functions/functions" diff --git a/cloudbuildCollectionSyncFunctions.yaml b/cloudbuildCollectionSyncFunctions.yaml deleted file mode 100644 index f2f8558b..00000000 --- a/cloudbuildCollectionSyncFunctions.yaml +++ /dev/null @@ -1,29 +0,0 @@ -steps: - - name: gcr.io/cloud-builders/gcloud - args: - - kms - - decrypt - - --ciphertext-file=cloud_functions/functions/.env.enc - - --plaintext-file=cloud_functions/functions/.env - - --location=global - - --keyring=antler-vc - - --key=cloudbuild-env - - name: gcr.io/cloud-builders/gcloud - args: - - kms - - decrypt - - --ciphertext-file=cloud_functions/functions/firebase-credentials.json.enc - - --plaintext-file=cloud_functions/functions/firebase-credentials.json - - --location=global - - --keyring=antler-vc - - --key=cloudbuild-env - - name: node:10.15.1 - entrypoint: yarn - args: ["install"] - dir: "cloud_functions/functions" - - name: node:10.15.1 - entrypoint: yarn - args: - - "deploy" - - "functions:FT_sync" - dir: "cloud_functions/functions" diff --git a/cloudbuildHistoryFunctions.yaml b/cloudbuildHistoryFunctions.yaml deleted file mode 100644 index 3236dcf7..00000000 --- a/cloudbuildHistoryFunctions.yaml +++ /dev/null @@ -1,29 +0,0 @@ -steps: - - name: gcr.io/cloud-builders/gcloud - args: - - kms - - decrypt - - --ciphertext-file=cloud_functions/functions/.env.enc - - --plaintext-file=cloud_functions/functions/.env - - --location=global - - --keyring=antler-vc - - --key=cloudbuild-env - - name: gcr.io/cloud-builders/gcloud - args: - - kms - - decrypt - - --ciphertext-file=cloud_functions/functions/firebase-credentials.json.enc - - --plaintext-file=cloud_functions/functions/firebase-credentials.json - - --location=global - - --keyring=antler-vc - - --key=cloudbuild-env - - name: node:10.15.1 - entrypoint: yarn - args: ["install"] - dir: "cloud_functions/functions" - - name: node:10.15.1 - entrypoint: yarn - args: - - "deploy" - - "functions:FT_history" - dir: "cloud_functions/functions" diff --git a/cloudbuildPermissionsFunctions.yaml b/cloudbuildPermissionsFunctions.yaml deleted file mode 100644 index 2fae304b..00000000 --- a/cloudbuildPermissionsFunctions.yaml +++ /dev/null @@ -1,35 +0,0 @@ -steps: - - name: gcr.io/cloud-builders/gcloud - args: - - kms - - decrypt - - --ciphertext-file=cloud_functions/functions/.env.enc - - --plaintext-file=cloud_functions/functions/.env - - --location=global - - --keyring=antler-vc - - --key=cloudbuild-env - - name: gcr.io/cloud-builders/gcloud - args: - - kms - - decrypt - - --ciphertext-file=cloud_functions/functions/firebase-credentials.json.enc - - --plaintext-file=cloud_functions/functions/firebase-credentials.json - - --location=global - - --keyring=antler-vc - - --key=cloudbuild-env - - name: node:10.15.1 - entrypoint: yarn - args: ["install"] - dir: "cloud_functions/functions" - - name: node:10.15.1 - entrypoint: yarn - args: - - "deploy" - - "--project" - - "${_PROJECT_ID}" - - "--only" - - "functions:FT_permissions" - dir: "cloud_functions/functions" - -substitutions: - _PROJECT_ID: "project-id" # default value diff --git a/cloudbuildSnapshotSyncFunctions.yaml b/cloudbuildSnapshotSyncFunctions.yaml deleted file mode 100644 index 19036bbd..00000000 --- a/cloudbuildSnapshotSyncFunctions.yaml +++ /dev/null @@ -1,29 +0,0 @@ -steps: - - name: gcr.io/cloud-builders/gcloud - args: - - kms - - decrypt - - --ciphertext-file=cloud_functions/functions/.env.enc - - --plaintext-file=cloud_functions/functions/.env - - --location=global - - --keyring=antler-vc - - --key=cloudbuild-env - - name: gcr.io/cloud-builders/gcloud - args: - - kms - - decrypt - - --ciphertext-file=cloud_functions/functions/firebase-credentials.json.enc - - --plaintext-file=cloud_functions/functions/firebase-credentials.json - - --location=global - - --keyring=antler-vc - - --key=cloudbuild-env - - name: node:10.15.1 - entrypoint: yarn - args: ["install"] - dir: "cloud_functions/functions" - - name: node:10.15.1 - entrypoint: yarn - args: - - "deploy" - - "functions:FT_snapshotSync" - dir: "cloud_functions/functions" diff --git a/cloudbuildSynonymsFunctions.yaml b/cloudbuildSynonymsFunctions.yaml deleted file mode 100644 index 8e9f8a8e..00000000 --- a/cloudbuildSynonymsFunctions.yaml +++ /dev/null @@ -1,29 +0,0 @@ -steps: - - name: gcr.io/cloud-builders/gcloud - args: - - kms - - decrypt - - --ciphertext-file=cloud_functions/functions/.env.enc - - --plaintext-file=cloud_functions/functions/.env - - --location=global - - --keyring=antler-vc - - --key=cloudbuild-env - - name: gcr.io/cloud-builders/gcloud - args: - - kms - - decrypt - - --ciphertext-file=cloud_functions/functions/firebase-credentials.json.enc - - --plaintext-file=cloud_functions/functions/firebase-credentials.json - - --location=global - - --keyring=antler-vc - - --key=cloudbuild-env - - name: node:10.15.1 - entrypoint: yarn - args: ["install"] - dir: "cloud_functions/functions" - - name: node:10.15.1 - entrypoint: yarn - args: - - "deploy" - - "functions:FT_synonyms" - dir: "cloud_functions/functions" From 67bfa12b12bc5124adb32cb34b7cbb3b7c0535dc Mon Sep 17 00:00:00 2001 From: Shams mosowi Date: Mon, 27 Apr 2020 17:59:05 +0800 Subject: [PATCH 15/38] firetstore backup --- cloud_functions/functions/package.json | 1 + cloud_functions/functions/src/backup.ts | 83 ++++ cloud_functions/functions/src/index.ts | 1 + cloud_functions/functions/yarn.lock | 552 +++++++++++++----------- 4 files changed, 396 insertions(+), 241 deletions(-) create mode 100644 cloud_functions/functions/src/backup.ts diff --git a/cloud_functions/functions/package.json b/cloud_functions/functions/package.json index 2d6566f4..0046c845 100644 --- a/cloud_functions/functions/package.json +++ b/cloud_functions/functions/package.json @@ -16,6 +16,7 @@ "main": "lib/src/index.js", "dependencies": { "@google-cloud/cloudbuild": "^1.5.0", + "@google-cloud/firestore": "^3.7.5", "@types/algoliasearch": "^3.34.5", "@types/json2csv": "^4.5.0", "@types/lodash": "^4.14.149", diff --git a/cloud_functions/functions/src/backup.ts b/cloud_functions/functions/src/backup.ts new file mode 100644 index 00000000..417598c5 --- /dev/null +++ b/cloud_functions/functions/src/backup.ts @@ -0,0 +1,83 @@ +import * as functions from "firebase-functions"; +import * as firestore from "@google-cloud/firestore"; +import { hasAnyRole } from "./utils/auth"; + +const client = new firestore.v1.FirestoreAdminClient(); + +// Replace BUCKET_NAME +const bucket = "gs://antler-backups"; + +// const restoreFirestoreBackup = (collectionIds: string[] = []) => { +// const projectId = process.env.GCP_PROJECT || process.env.GCLOUD_PROJECT; +// const databaseName = client.databasePath(projectId, "(default)"); + +// return client + +// .importDocuments({ +// name: databaseName, +// inputUriPrefix: bucket, +// // Leave collectionIds empty to export all collections +// // or set to a list of collection IDs to export, +// // collectionIds: ['users', 'posts'] +// collectionIds, +// }) +// .then((responses) => { +// const response = responses[0]; +// console.log(`Operation Name: ${response["name"]}`); +// return response; +// }) +// .catch((err) => { +// console.error(err); +// throw new Error("Export operation failed"); +// }); +// }; + +const firestoreBackup = (collectionIds: string[] = []) => { + const projectId = process.env.GCP_PROJECT || process.env.GCLOUD_PROJECT; + const databaseName = client.databasePath(projectId, "(default)"); + + return client + .exportDocuments({ + name: databaseName, + outputUriPrefix: bucket, + // Leave collectionIds empty to export all collections + // or set to a list of collection IDs to export, + // collectionIds: ['users', 'posts'] + collectionIds, + }) + .then((responses) => { + const response = responses[0]; + console.log(`Operation Name: ${response["name"]}`); + return response; + }) + .catch((err) => { + console.error(err); + throw new Error("Export operation failed"); + }); +}; +export const scheduledFirestoreBackup = functions.pubsub + .schedule("every 24 hours") + .onRun((context) => { + console.log(context); + return firestoreBackup(); + }); + +export const callableFirestoreBackup = functions.https.onCall( + async (data, context) => { + console.log(data); + const authorized = hasAnyRole(["ADMIN"], context); + if (!context.auth || !authorized) { + console.warn(`unauthorized user${context}`); + return { + success: false, + message: "you don't have permissions to send this email", + }; + } else { + await firestoreBackup(); + return { + success: true, + message: "backup ran", + }; + } + } +); diff --git a/cloud_functions/functions/src/index.ts b/cloud_functions/functions/src/index.ts index 85f20df7..a8387bbd 100644 --- a/cloud_functions/functions/src/index.ts +++ b/cloud_functions/functions/src/index.ts @@ -17,6 +17,7 @@ import synonymsConfig from "./synonyms/config"; export { exportTable } from "./export"; export { triggerCloudBuild } from "./buildTriggers"; +export { scheduledFirestoreBackup, callableFirestoreBackup } from "./backup"; import * as callableFns from "./callable"; export const callable = callableFns; diff --git a/cloud_functions/functions/yarn.lock b/cloud_functions/functions/yarn.lock index bed0d45d..76f70452 100644 --- a/cloud_functions/functions/yarn.lock +++ b/cloud_functions/functions/yarn.lock @@ -9,65 +9,77 @@ dependencies: "@babel/highlight" "^7.8.3" +"@babel/helper-validator-identifier@^7.9.0": + version "7.9.5" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.5.tgz#90977a8e6fbf6b431a7dc31752eee233bf052d80" + integrity sha512-/8arLKUFq882w4tWGj9JYzRpAlZgiWUJ+dtteNTDqrRBz9Iguck9Rn3ykuBDoUwh2TO4tSAJlrxDUOXWklJe4g== + "@babel/highlight@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.8.3.tgz#28f173d04223eaaa59bc1d439a3836e6d1265797" - integrity sha512-PX4y5xQUvy0fnEVHrYOarRPXVWafSjTW9T0Hab8gVIawpl2Sj0ORyrygANq+KjcNlSSTw0YCLSNA8OyZ1I4yEg== + version "7.9.0" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.9.0.tgz#4e9b45ccb82b79607271b2979ad82c7b68163079" + integrity sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ== dependencies: + "@babel/helper-validator-identifier" "^7.9.0" chalk "^2.0.0" - esutils "^2.0.2" js-tokens "^4.0.0" -"@firebase/app-types@0.5.3": - version "0.5.3" - resolved "https://registry.yarnpkg.com/@firebase/app-types/-/app-types-0.5.3.tgz#b1e4b2229c9af7a1dd2ecc88bc80dba8f56a3ec1" - integrity sha512-PH1egwhlEhZSp7/jiUNszG1BX1NBUuL86Zd1ZoXT3qaFS9YSGGEY7n0DKgI0fWoVa5GzfbzKOC+J1e4T/+PY1Q== +"@firebase/app-types@0.6.0": + version "0.6.0" + resolved "https://registry.yarnpkg.com/@firebase/app-types/-/app-types-0.6.0.tgz#8dcc3e793c6983e9d54f7eb623a7618c05f2d94c" + integrity sha512-ld6rzjXk/SUauHiQZJkeuSJpxIZ5wdnWuF5fWBFQNPaxsaJ9kyYg9GqEvwZ1z2e6JP5cU9gwRBlfW1WkGtGDYA== "@firebase/auth-interop-types@0.1.4": version "0.1.4" resolved "https://registry.yarnpkg.com/@firebase/auth-interop-types/-/auth-interop-types-0.1.4.tgz#e81589f58508630a5bffa604d7c949a0d01ea97b" integrity sha512-CLKNS84KGAv5lRnHTQZFWoR11Ti7gIPFirDDXWek/fSU+TdYdnxJFR5XSD4OuGyzUYQ3Dq7aVj5teiRdyBl9hA== -"@firebase/component@0.1.7": - version "0.1.7" - resolved "https://registry.yarnpkg.com/@firebase/component/-/component-0.1.7.tgz#ea722393af1b28902b0603e1bf45dd291d1a07f7" - integrity sha512-FAoi1ELlrVY9Uy9zzTlhc+3nn5VdYe36C/OpDnFXb2K/AH0jR6wcVTvLqGYFBPFVjgqO5MKCn3Mq3DCnro8QGg== +"@firebase/component@0.1.10": + version "0.1.10" + resolved "https://registry.yarnpkg.com/@firebase/component/-/component-0.1.10.tgz#9df3a6555568602ca7b262a3bff2125024f61649" + integrity sha512-Iy1+f8wp6mROz19oxWUd31NxMlGxtW1IInGHITnVa6eZtXOg0lxcbgYeLp9W3PKzvvNfshHU0obDkcMY97zRAw== dependencies: - "@firebase/util" "0.2.42" + "@firebase/util" "0.2.45" tslib "1.11.1" -"@firebase/database-types@0.4.13": - version "0.4.13" - resolved "https://registry.yarnpkg.com/@firebase/database-types/-/database-types-0.4.13.tgz#bca2c02859dcab92f1f967ee067304c642feebc1" - integrity sha512-7bDsD90Q9YmmB/A90UnZLv7jqgULClxAT1C4aw1dGfcS49XEUh2uuoW3NqS5vvtbMHJiurrN73ADddwgCrltww== +"@firebase/database-types@0.5.0": + version "0.5.0" + resolved "https://registry.yarnpkg.com/@firebase/database-types/-/database-types-0.5.0.tgz#603a0865c3180a9ffb6f5fa065d156387385a74d" + integrity sha512-6/W3frFznYOALtw2nrWVPK2ytgdl89CzTqVBHCCGf22wT6uKU63iDBo+Nw+7olFGpD15O0zwYalFIcMZ27tkew== dependencies: - "@firebase/app-types" "0.5.3" + "@firebase/app-types" "0.6.0" -"@firebase/database@^0.5.17": - version "0.5.23" - resolved "https://registry.yarnpkg.com/@firebase/database/-/database-0.5.23.tgz#372f0fda8fe057287f47afb6053a49bd58c5afa1" - integrity sha512-6zVa3dJoUT8bpiSai/aIbGPEDrGaFwR1iMMmXCYSf6su46ZYMLOYjSV/+nOHZaT4/TyQZY3D+iIL0WyRuEVOjA== +"@firebase/database@^0.6.0": + version "0.6.1" + resolved "https://registry.yarnpkg.com/@firebase/database/-/database-0.6.1.tgz#76ee8003aa1fff7ff5deb317959bbb0e35e56765" + integrity sha512-7XqUbj3nK2vEdFjGOXBfKISmpLrM0caIwwfDPxhn6i7X/g6AIH+D1limH+Jit4QeKMh/IJZDNqO7P+Fz+e8q1Q== dependencies: "@firebase/auth-interop-types" "0.1.4" - "@firebase/component" "0.1.7" - "@firebase/database-types" "0.4.13" - "@firebase/logger" "0.1.37" - "@firebase/util" "0.2.42" + "@firebase/component" "0.1.10" + "@firebase/database-types" "0.5.0" + "@firebase/logger" "0.2.2" + "@firebase/util" "0.2.45" faye-websocket "0.11.3" tslib "1.11.1" -"@firebase/logger@0.1.37": - version "0.1.37" - resolved "https://registry.yarnpkg.com/@firebase/logger/-/logger-0.1.37.tgz#0fa4263bc529ed2afd3da81d81f51c6035fa7145" - integrity sha512-uiVVfVlhCZLfUBqOCUuh8V3t+8lKTFJ6mgDoH99YFbuWYUUch8OHWQG70qg/I6m7IRIZLtHyPt3OCxYgI0R6Yw== +"@firebase/logger@0.2.2": + version "0.2.2" + resolved "https://registry.yarnpkg.com/@firebase/logger/-/logger-0.2.2.tgz#aea3ef8cbb131c9d3daaf8022f120f194a40509f" + integrity sha512-MbEy17Ha1w/DlLtvxG89ScQ+0+yoElGKJ1nUCQHHLjeMNsRwd2wnUPOVCsZvtBzQp8Z0GaFmD4a2iG2v91lEbA== -"@firebase/util@0.2.42": - version "0.2.42" - resolved "https://registry.yarnpkg.com/@firebase/util/-/util-0.2.42.tgz#bfbc284bbc4c36579379a8236a7db2f12bd462bb" - integrity sha512-ihFavcy7OdSMwZySidRSi58RkiqVVcmVAVy2J5VSKWaCQcBL8+4+H0ytmmXplxKCaQAsyqj1XhJx+MaCJyXknQ== +"@firebase/util@0.2.45": + version "0.2.45" + resolved "https://registry.yarnpkg.com/@firebase/util/-/util-0.2.45.tgz#d52f28da8a4d7a4fa97d36202a86d5f654fbed6d" + integrity sha512-k3IqXaIgwlPg7m5lXmMUtkqA/p+LMFkFQIqBuDtdT0iyWB6kQDokyjw2Sgd3GoTybs6tWqUKFZupZpV6r73UHw== dependencies: tslib "1.11.1" +"@google-cloud/cloudbuild@^1.5.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@google-cloud/cloudbuild/-/cloudbuild-1.5.0.tgz#42b9fbff54164955bc6cd02004c07173e56b247a" + integrity sha512-HPGzrgkRyY8mpPcrPPUhzxZs+ja59AthTLjmtVb2pJ8vVEeUmKmAhsCylkgSuo79ECGm5mUt96G+tjSXYCXXAw== + dependencies: + google-gax "^1.14.2" + "@google-cloud/common@^2.1.1": version "2.4.0" resolved "https://registry.yarnpkg.com/@google-cloud/common/-/common-2.4.0.tgz#2783b7de8435024a31453510f2dab5a6a91a4c82" @@ -83,10 +95,10 @@ retry-request "^4.0.0" teeny-request "^6.0.0" -"@google-cloud/firestore@^3.0.0": - version "3.7.1" - resolved "https://registry.yarnpkg.com/@google-cloud/firestore/-/firestore-3.7.1.tgz#477706ddb9ca4324087cff6b23c32b75808c28bd" - integrity sha512-2zDGr3wnzgMf/sn+wgqLJoakKbchqrn1F05O0CrXdr3pmOpRCTDWD+ua/k73JG/fqWGkoLw+uuDQew980ZHlvw== +"@google-cloud/firestore@^3.0.0", "@google-cloud/firestore@^3.7.5": + version "3.7.5" + resolved "https://registry.yarnpkg.com/@google-cloud/firestore/-/firestore-3.7.5.tgz#d8d68acb591e607b70bc04f49cab60f30d68a613" + integrity sha512-yfgGDQUlkMLxUMRZnGICWSDSvcV2EIjjK3Wc9MEBfju9ULBX1MfR0hU1PzRdtEK7HQ6a8Dh53QJBBngY2CkazA== dependencies: deep-equal "^2.0.0" functional-red-black-tree "^1.0.1" @@ -118,9 +130,9 @@ integrity sha512-VccZDcOql77obTnFh0TbNED/6ZbbmHDf8UMNnzO1d5g9V0Htfm4k5cllY8P1tJsRKC3zWYGRLaViiupcgVjBoQ== "@google-cloud/pubsub@^1.1.5": - version "1.6.0" - resolved "https://registry.yarnpkg.com/@google-cloud/pubsub/-/pubsub-1.6.0.tgz#135e58aa85c50ff765ae036ea5b749171e9f1396" - integrity sha512-RL7GJFOQaJpUcNjMDXAQ6dv+cxIIzzDc5DFwbak8KlIvK9znw/YrEybki8e8JTMdvU5Kg7FKGi5RmI6EQkWkVw== + version "1.7.2" + resolved "https://registry.yarnpkg.com/@google-cloud/pubsub/-/pubsub-1.7.2.tgz#63315a7b843ede94bc5c5cff65e16b2d0ac6b193" + integrity sha512-/TziioDSV4FS4wKF1sIaQ+1gvE+um83oHz1nRsZ3L87uWSoOciBjJAcocgPjqrpnW441+Nuw4w0QdSUV1Lka/g== dependencies: "@google-cloud/paginator" "^2.0.0" "@google-cloud/precise-date" "^1.0.0" @@ -139,9 +151,9 @@ protobufjs "^6.8.1" "@google-cloud/storage@^4.1.2": - version "4.6.0" - resolved "https://registry.yarnpkg.com/@google-cloud/storage/-/storage-4.6.0.tgz#c6afef92627b96fd8b9f436c1b622be3d2b9a949" - integrity sha512-ubhbLAnj+hrp32x5gI+JajKU0kvhApA6PsLOLkuOj4Cz4b6MNsyhSWZ5rq2W7TylqfNNW8M9QxPCKWg3Sb0IbA== + version "4.7.0" + resolved "https://registry.yarnpkg.com/@google-cloud/storage/-/storage-4.7.0.tgz#a7466086a83911c7979cc238d00a127ffb645615" + integrity sha512-f0guAlbeg7Z0m3gKjCfBCu7FG9qS3M3oL5OQQxlvGoPtK7/qg3+W+KQV73O2/sbuS54n0Kh2mvT5K2FWzF5vVQ== dependencies: "@google-cloud/common" "^2.1.1" "@google-cloud/paginator" "^2.0.0" @@ -149,10 +161,10 @@ arrify "^2.0.0" compressible "^2.0.12" concat-stream "^2.0.0" - date-and-time "^0.12.0" + date-and-time "^0.13.0" duplexify "^3.5.0" extend "^3.0.2" - gaxios "^2.0.1" + gaxios "^3.0.0" gcs-resumable-upload "^2.2.4" hash-stream-validation "^0.2.2" mime "^2.2.0" @@ -166,17 +178,24 @@ through2 "^3.0.0" xdg-basedir "^4.0.0" -"@grpc/grpc-js@^0.6.12", "@grpc/grpc-js@^0.6.18": +"@grpc/grpc-js@^0.6.12": version "0.6.18" resolved "https://registry.yarnpkg.com/@grpc/grpc-js/-/grpc-js-0.6.18.tgz#ba3b3dfef869533161d192a385412a4abd0db127" integrity sha512-uAzv/tM8qpbf1vpx1xPMfcUMzbfdqJtdCYAqY/LsLeQQlnTb4vApylojr+wlCyr7bZeg3AFfHvtihnNOQQt/nA== dependencies: semver "^6.2.0" +"@grpc/grpc-js@^0.7.4": + version "0.7.9" + resolved "https://registry.yarnpkg.com/@grpc/grpc-js/-/grpc-js-0.7.9.tgz#a0fae94fecfd4a44fbde496f689c2b4179407bf5" + integrity sha512-ihn9xWOqubMPBlU77wcYpy7FFamGo5xtsK27EAILL/eoOvGEAq29UOrqRvqYPwWfl2+3laFmGKNR7uCdJhKu4Q== + dependencies: + semver "^6.2.0" + "@grpc/proto-loader@^0.5.1": - version "0.5.3" - resolved "https://registry.yarnpkg.com/@grpc/proto-loader/-/proto-loader-0.5.3.tgz#a233070720bf7560c4d70e29e7950c72549a132c" - integrity sha512-8qvUtGg77G2ZT2HqdqYoM/OY97gQd/0crSG34xNmZ4ZOsv3aQT/FQV9QfZPazTGna6MIoyUd+u6AxsoZjJ/VMQ== + version "0.5.4" + resolved "https://registry.yarnpkg.com/@grpc/proto-loader/-/proto-loader-0.5.4.tgz#038a3820540f621eeb1b05d81fbedfb045e14de0" + integrity sha512-HTM4QpI9B2XFkPz7pjwMyMgZchJ93TVkL3kWPW8GDMDKYxsMnmf4w2TNMJK7+KNiYHS5cJrCEAFlF+AwtXWVPA== dependencies: lodash.camelcase "^4.3.0" protobufjs "^6.8.6" @@ -235,9 +254,9 @@ integrity sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA= "@tootallnate/once@1": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.0.0.tgz#9c13c2574c92d4503b005feca8f2e16cc1611506" - integrity sha512-KYyTT/T6ALPkIRd2Ge080X/BsXvy9O0hcWTtMWkPvwAwF99+vn6Dv4GzrFT/Nn1LePr+FFDbRXXlqmsy9lw2zA== + version "1.1.2" + resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82" + integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw== "@types/algoliasearch@^3.34.5": version "3.34.10" @@ -267,20 +286,21 @@ "@types/node" "*" "@types/express-serve-static-core@*": - version "4.17.2" - resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.2.tgz#f6f41fa35d42e79dbf6610eccbb2637e6008a0cf" - integrity sha512-El9yMpctM6tORDAiBwZVLMcxoTMcqqRO9dVyYcn7ycLWbvR8klrDn8CAOwRfZujZtWD7yS/mshTdz43jMOejbg== + version "4.17.5" + resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.5.tgz#a00ac7dadd746ae82477443e4d480a6a93ea083c" + integrity sha512-578YH5Lt88AKoADy0b2jQGwJtrBxezXtVe/MBqWXKZpqx91SnC0pVkVCcxcytz3lWW+cHBYDi3Ysh0WXc+rAYw== dependencies: "@types/node" "*" "@types/range-parser" "*" -"@types/express@^4.17.0": - version "4.17.3" - resolved "https://registry.yarnpkg.com/@types/express/-/express-4.17.3.tgz#38e4458ce2067873b09a73908df488870c303bd9" - integrity sha512-I8cGRJj3pyOLs/HndoP+25vOqhqWkAZsWMEmq1qXy/b/M3ppufecUwaK2/TVDVxcV61/iSdhykUjQQ2DLSrTdg== +"@types/express@^4.17.3": + version "4.17.6" + resolved "https://registry.yarnpkg.com/@types/express/-/express-4.17.6.tgz#6bce49e49570507b86ea1b07b806f04697fac45e" + integrity sha512-n/mr9tZI83kd4azlPG5y997C/M4DNABK9yErhFM6hKdym4kkmd9j0vtsJyjFIwfRBxtrxZtAfGZCNRIBMFLK5w== dependencies: "@types/body-parser" "*" "@types/express-serve-static-core" "*" + "@types/qs" "*" "@types/serve-static" "*" "@types/fs-extra@^8.0.1": @@ -290,11 +310,6 @@ dependencies: "@types/node" "*" -"@types/js-yaml@^3.12.2": - version "3.12.3" - resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-3.12.3.tgz#abf383c5b639d0aa8b8c4a420d6a85f703357d6c" - integrity sha512-otRe77JNNWzoVGLKw8TCspKswRoQToys4tuL6XYVBFxjgeM0RUrx7m3jkaTdxILxeGry3zM8mGYkGXMeQ02guA== - "@types/json2csv@^4.5.0": version "4.5.1" resolved "https://registry.yarnpkg.com/@types/json2csv/-/json2csv-4.5.1.tgz#75b7e18f996f1c294de8641b3abf0f3214f0a9ca" @@ -303,11 +318,11 @@ "@types/node" "*" "@types/lodash@^4.14.149": - version "4.14.149" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.149.tgz#1342d63d948c6062838fbf961012f74d4e638440" - integrity sha512-ijGqzZt/b7BfzcK9vTrS6MFljQRPn5BFWOx8oE0GYxribu6uV+aA9zZuXI1zc/etK9E8nrgdoF2+LgUw7+9tJQ== + version "4.14.150" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.150.tgz#649fe44684c3f1fcb6164d943c5a61977e8cf0bd" + integrity sha512-kMNLM5JBcasgYscD9x/Gvr6lTAv2NVgsKtet/hm93qMyf/D1pt+7jeEZklKJKxMVmXjxbRVQQGfqDSfipYCO6w== -"@types/long@^4.0.0": +"@types/long@^4.0.0", "@types/long@^4.0.1": version "4.0.1" resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.1.tgz#459c65fa1867dafe6a8f322c4c51695663cc55e9" integrity sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w== @@ -317,26 +332,26 @@ resolved "https://registry.yarnpkg.com/@types/mime/-/mime-2.0.1.tgz#dc488842312a7f075149312905b5e3c0b054c79d" integrity sha512-FwI9gX75FgVBJ7ywgnq/P7tw+/o1GUbtP0KzbtusLigAOgIgNISRK0ZPl4qertvXSIE8YbsVJueQ90cDt9YYyw== -"@types/node@*": - version "13.9.1" - resolved "https://registry.yarnpkg.com/@types/node/-/node-13.9.1.tgz#96f606f8cd67fb018847d9b61e93997dabdefc72" - integrity sha512-E6M6N0blf/jiZx8Q3nb0vNaswQeEyn0XlupO+xN6DtJ6r6IT4nXrTry7zhIfYvFCl3/8Cu6WIysmUBKiqV0bqQ== - -"@types/node@^10.1.0": - version "10.17.17" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.17.tgz#7a183163a9e6ff720d86502db23ba4aade5999b8" - integrity sha512-gpNnRnZP3VWzzj5k3qrpRC6Rk3H/uclhAVo1aIvwzK5p5cOrs9yEyQ8H/HBsBY0u5rrWxXEiVPQ0dEB6pkjE8Q== +"@types/node@*", "@types/node@^13.7.0": + version "13.13.4" + resolved "https://registry.yarnpkg.com/@types/node/-/node-13.13.4.tgz#1581d6c16e3d4803eb079c87d4ac893ee7501c2c" + integrity sha512-x26ur3dSXgv5AwKS0lNfbjpCakGIduWU1DU91Zz58ONRWrIKGunmZBNv4P7N+e27sJkiGDsw/3fT4AtsqQBrBA== "@types/node@^8.10.59": - version "8.10.59" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.59.tgz#9e34261f30183f9777017a13d185dfac6b899e04" - integrity sha512-8RkBivJrDCyPpBXhVZcjh7cQxVBSmRk9QM7hOketZzp6Tg79c0N8kkpAIito9bnJ3HCVCHVYz+KHTEbfQNfeVQ== + version "8.10.60" + resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.60.tgz#73eb4d1e1c8aa5dc724363b57db019cf28863ef7" + integrity sha512-YjPbypHFuiOV0bTgeF07HpEEqhmHaZqYNSdCKeBJa+yFoQ/7BC+FpJcwmi34xUIIRVFktnUyP1dPU8U0612GOg== "@types/normalize-package-data@^2.4.0": version "2.4.0" resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e" integrity sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA== +"@types/qs@*": + version "6.9.1" + resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.1.tgz#937fab3194766256ee09fcd40b781740758617e7" + integrity sha512-lhbQXx9HKZAPgBkISrBcmAcMpZsmpe/Cd/hY7LGZS5OfkySUBItnPZHgQPssWYUET8elF+yCFBbP1Q0RZPTdaw== + "@types/range-parser@*": version "1.2.3" resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.3.tgz#7ee330ba7caafb98090bece86a5ee44115904c2c" @@ -393,9 +408,9 @@ agentkeepalive@^2.2.0: integrity sha1-xdG9SxKQCPEWPyNvhuX66iAm4u8= ajv@^6.5.5: - version "6.12.0" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.0.tgz#06d60b96d87b8454a5adaba86e7854da629db4b7" - integrity sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw== + version "6.12.2" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.2.tgz#c629c5eced17baf314437918d2da88c99d5958cd" + integrity sha512-k+V+hzjm5q/Mr8ef/1Y9goCmlsK4I6Sm74teeyGvFk1XrOsbsKLjEdrvny42CZ+a8sXbk8KWpY/bDwS+FLL2UQ== dependencies: fast-deep-equal "^3.1.1" fast-json-stable-stringify "^2.0.0" @@ -516,6 +531,11 @@ argparse@^1.0.7: dependencies: sprintf-js "~1.0.2" +array-filter@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/array-filter/-/array-filter-1.0.0.tgz#baf79e62e6ef4c2a4c0b831232daffec251f9d83" + integrity sha1-uveeYubvTCpMC4MSMtr/7CUfnYM= + array-flatten@1.1.1, array-flatten@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" @@ -584,6 +604,13 @@ asynckit@^0.4.0: resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= +available-typed-arrays@^1.0.0, available-typed-arrays@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.2.tgz#6b098ca9d8039079ee3f77f7b783c4480ba513f5" + integrity sha512-XWX3OX8Onv97LMk/ftVyBibpGwY5a8SmuxZPzeOxqmuEqUCOM9ZE+uIaD1VNJ5QnvU2UQusvmKbuM1FR8QWGfQ== + dependencies: + array-filter "^1.0.0" + aws-sign2@~0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" @@ -733,9 +760,9 @@ buffer-indexof-polyfill@~1.0.0: integrity sha1-qfuAbOgUXVQoUQznLyeLs2OmOL8= buffer@^5.1.0, buffer@^5.5.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.5.0.tgz#9c3caa3d623c33dd1c7ef584b89b88bf9c9bc1ce" - integrity sha512-9FTEDjLjwoAkEwyMGDjYJQN2gfRgOKBKRfiglhvibGbpeeU/pQn1bJxQqm32OD/AIeEuHxU9roxXxg34Byp/Ww== + version "5.6.0" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.6.0.tgz#a31749dc7d81d84db08abf937b6b8c4033f62786" + integrity sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw== dependencies: base64-js "^1.0.2" ieee754 "^1.1.4" @@ -840,9 +867,9 @@ chardet@^0.7.0: integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== chokidar@^3.0.2: - version "3.3.1" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.3.1.tgz#c84e5b3d18d9a4d77558fef466b1bf16bbeb3450" - integrity sha512-4QYCEWOcK3OJrxwvyyAOxFuhpvOVCYkr33LPfFNBjAD/w3sEzWsp2BUOkI4l9bHvWioAd0rc6NlHUOEaWkTeqg== + version "3.4.0" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.4.0.tgz#b30611423ce376357c765b9b8f904b9fba3c0be8" + integrity sha512-aXAaho2VJtisB/1fg1+3nlLJqGOuewTzQpd/Tz0yTg2R0e4IGtshYvtjowyEumcBv2z+y4+kc75Mz7j5xJskcQ== dependencies: anymatch "~3.1.1" braces "~3.0.2" @@ -850,7 +877,7 @@ chokidar@^3.0.2: is-binary-path "~2.1.0" is-glob "~4.0.1" normalize-path "~3.0.0" - readdirp "~3.3.0" + readdirp "~3.4.0" optionalDependencies: fsevents "~2.1.2" @@ -901,9 +928,9 @@ cli-cursor@^2.1.0: restore-cursor "^2.0.0" cli-spinners@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.2.0.tgz#e8b988d9206c692302d8ee834e7a85c0144d8f77" - integrity sha512-tgU3fKwzYjiLEQgPMD9Jt+JjHVL9kW93FiIMX/l7rivvOD4/LL0Mf7gda3+4U2KJBloybwgj5KEoQgGRioMiKQ== + version "2.3.0" + resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.3.0.tgz#0632239a4b5aa4c958610142c34bb7a651fc8df5" + integrity sha512-Xs2Hf2nzrvJMFKimOR7YR0QwZ8fc0u98kdtwN1eNAZzNQgH3vK2pXzff6GJtKh7S5hoJ87ECiAiZFS2fb5Ii2w== cli-table@^0.3.1: version "0.3.1" @@ -913,9 +940,9 @@ cli-table@^0.3.1: colors "1.0.3" cli-width@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" - integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk= + version "2.2.1" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.1.tgz#b0433d0b4e9c847ef18868a4ef16fd5fc8271c48" + integrity sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw== clone@^1.0.2: version "1.0.4" @@ -1188,10 +1215,10 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" -date-and-time@^0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/date-and-time/-/date-and-time-0.12.0.tgz#6d30c91c47fa72edadd628b71ec2ac46909b9267" - integrity sha512-n2RJIAp93AucgF/U/Rz5WRS2Hjg5Z+QxscaaMCi6pVZT1JpJKRH+C08vyH/lRR1kxNXnPxgo3lWfd+jCb/UcuQ== +date-and-time@^0.13.0: + version "0.13.1" + resolved "https://registry.yarnpkg.com/date-and-time/-/date-and-time-0.13.1.tgz#d12ba07ac840d5b112dc4c83f8a03e8a51f78dd6" + integrity sha512-/Uge9DJAT+s+oAcDxtBhyR8+sKjUnZbYmyhbmWjTHNtX7B7oWD8YyYdeXcBRbwSj6hVvj+IQegJam7m7czhbFw== debug@2.6.9, debug@^2.6.9: version "2.6.9" @@ -1229,22 +1256,24 @@ debug@^3.0.0, debug@^3.1.0, debug@^3.1.1: ms "^2.1.1" deep-equal@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-2.0.1.tgz#fc12bbd6850e93212f21344748682ccc5a8813cf" - integrity sha512-7Et6r6XfNW61CPPCIYfm1YPGSmh6+CliYeL4km7GWJcpX5LTAflGF8drLLR+MZX+2P3NZfAfSduutBbSWqER4g== + version "2.0.3" + resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-2.0.3.tgz#cad1c15277ad78a5c01c49c2dee0f54de8a6a7b0" + integrity sha512-Spqdl4H+ky45I9ByyJtXteOm9CaIrPmnIPmOhrkKGNYWeDgCvJ8jNYVCTjChxW4FqGuZnLHADc8EKRMX6+CgvA== dependencies: - es-abstract "^1.16.3" - es-get-iterator "^1.0.1" + es-abstract "^1.17.5" + es-get-iterator "^1.1.0" is-arguments "^1.0.4" - is-date-object "^1.0.1" - is-regex "^1.0.4" + is-date-object "^1.0.2" + is-regex "^1.0.5" isarray "^2.0.5" - object-is "^1.0.1" + object-is "^1.1.2" object-keys "^1.1.1" - regexp.prototype.flags "^1.2.0" - side-channel "^1.0.1" + object.assign "^4.1.0" + regexp.prototype.flags "^1.3.0" + side-channel "^1.0.2" which-boxed-primitive "^1.0.1" - which-collection "^1.0.0" + which-collection "^1.0.1" + which-typed-array "^1.1.2" deep-extend@^0.6.0: version "0.6.0" @@ -1308,9 +1337,9 @@ diff@^4.0.1: integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== dom-walk@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.1.tgz#672226dc74c8f799ad35307df936aba11acd6018" - integrity sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg= + version "0.1.2" + resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.2.tgz#0c548bef048f4d1f2a97249002236060daa3fd84" + integrity sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w== dot-prop@^4.1.0: version "4.2.0" @@ -1415,10 +1444,10 @@ error-ex@^1.3.1: dependencies: is-arrayish "^0.2.1" -es-abstract@^1.16.3, es-abstract@^1.17.0-next.1, es-abstract@^1.17.4: - version "1.17.4" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.4.tgz#e3aedf19706b20e7c2594c35fc0d57605a79e184" - integrity sha512-Ae3um/gb8F0mui/jPL+QiqmglkUsaQf7FwBEHYIFkztkneosu9imhqHpBzQ3h1vit8t5iQ74t6PEVvphBZiuiQ== +es-abstract@^1.17.0-next.1, es-abstract@^1.17.4, es-abstract@^1.17.5: + version "1.17.5" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.5.tgz#d8c9d1d66c8981fb9200e2251d799eee92774ae9" + integrity sha512-BR9auzDbySxOcfog0tLECW8l28eRGpDpU3Dm3Hp4q/N+VtLTmyj4EUN088XZWQDW/hzj6sYRDXeOFsaAODKvpg== dependencies: es-to-primitive "^1.2.1" function-bind "^1.1.1" @@ -1432,7 +1461,7 @@ es-abstract@^1.16.3, es-abstract@^1.17.0-next.1, es-abstract@^1.17.4: string.prototype.trimleft "^2.1.1" string.prototype.trimright "^2.1.1" -es-get-iterator@^1.0.1: +es-get-iterator@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/es-get-iterator/-/es-get-iterator-1.1.0.tgz#bb98ad9d6d63b31aacdc8f89d5d0ee57bcb5b4c8" integrity sha512-UfrmHuWQlNMTs35e1ypnvikg6jCz3SK8v8ImvmDsh36fCVUR1MqoFDiyn0/k52C8NqO3YsO8Oe0azeesNuqSsQ== @@ -1517,11 +1546,6 @@ esprima@^4.0.0, esprima@~4.0.0: resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== -esutils@^2.0.2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" - integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== - etag@~1.8.1: version "1.8.1" resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" @@ -1659,9 +1683,9 @@ fast-json-stable-stringify@^2.0.0: integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== fast-text-encoding@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/fast-text-encoding/-/fast-text-encoding-1.0.1.tgz#4a428566f74fc55ebdd447555b1eb4d9cf514455" - integrity sha512-x4FEgaz3zNRtJfLFqJmHWxkMDDvXVtaznj2V9jiP8ACUJrUgist4bP9FmDL2Vew2Y9mEQI/tG4GqabaitYp9CQ== + version "1.0.2" + resolved "https://registry.yarnpkg.com/fast-text-encoding/-/fast-text-encoding-1.0.2.tgz#ff1ad5677bde049e0f8656aa6083a7ef2c5836e2" + integrity sha512-5rQdinSsycpzvAoHga2EDn+LRX1d5xLFsuNG0Kg61JrAT/tASXcLL0nf/33v+sAxlQcfYmWbTURa1mmAf55jGw== fast-url-parser@^1.1.3: version "1.1.3" @@ -1718,11 +1742,11 @@ find-up@^4.0.0: path-exists "^4.0.0" firebase-admin@^8.9.2: - version "8.10.0" - resolved "https://registry.yarnpkg.com/firebase-admin/-/firebase-admin-8.10.0.tgz#4a838aec52df49845eba07ad59a40b4df996e815" - integrity sha512-QzJZ1sBh9xzKjb44aP6m1duy0Xe1ixexwh0eaOt1CkJYCOq2b6bievK4GNWMl5yGQ7FFBEbZO6hyDi+5wrctcg== + version "8.11.0" + resolved "https://registry.yarnpkg.com/firebase-admin/-/firebase-admin-8.11.0.tgz#6292474c1270731655bc7c54a16499d54012fd0b" + integrity sha512-DapjZBeilXIDJShlWIvcgPkX6HhOHCs5C9972ZDNpfm0aSSgWuwgVQz9vs9iTk0u+oQuqRjxcHveZki0qaHJ2w== dependencies: - "@firebase/database" "^0.5.17" + "@firebase/database" "^0.6.0" "@types/node" "^8.10.59" dicer "^0.3.0" jsonwebtoken "8.1.0" @@ -1732,23 +1756,22 @@ firebase-admin@^8.9.2: "@google-cloud/storage" "^4.1.2" firebase-functions@^3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/firebase-functions/-/firebase-functions-3.3.0.tgz#8c6d909eebfa4bce1b25a2e34edfc52cc786a020" - integrity sha512-dP6PCG+OwR6RtFpOqwPsLnfiCr3CwXAm/SVGMbO53vDAk0nhUQ1WGAyHDYmIyMAkaLJkIKGwDnX7XmZ5+yAg7g== + version "3.6.1" + resolved "https://registry.yarnpkg.com/firebase-functions/-/firebase-functions-3.6.1.tgz#05fdf991e9f3f46cb2c7b32dd4a523766b17e14a" + integrity sha512-CBvlDEoFgsdm10PTHs7gRd5xBmhp+eqCqgsyqKbzmdbU3J8RYqtBWoHm2O31gjtZv6MyOWvS3oFITShzBulylQ== dependencies: - "@types/express" "^4.17.0" + "@types/express" "^4.17.3" cors "^2.8.5" express "^4.17.1" jsonwebtoken "^8.5.1" lodash "^4.17.14" firebase-tools@^7.16.1: - version "7.16.1" - resolved "https://registry.yarnpkg.com/firebase-tools/-/firebase-tools-7.16.1.tgz#1c18250ae842d424e4487ab23695adf7abef675b" - integrity sha512-IK2LOfdTvPvSvChpgNiadO/KiKt3lbIDvwPsvuaPw1fgWuTNtSbTzrLb/pXcnRUfObI03qKuMhiAEB/28zYjfg== + version "7.16.2" + resolved "https://registry.yarnpkg.com/firebase-tools/-/firebase-tools-7.16.2.tgz#6f318de5d35346b48219e9f7da23ce4576eac16e" + integrity sha512-8jxJMdOtsiXeKGZx5nR3+uOdMAY8XqNZq28XOGPzD4r+6U6AAmbvyhj2500Jm6LtsXQhcKHPaWF4XICv+m3sKg== dependencies: "@google-cloud/pubsub" "^1.1.5" - "@types/js-yaml" "^3.12.2" JSONStream "^1.2.1" archiver "^3.0.0" body-parser "^1.19.0" @@ -1881,9 +1904,9 @@ fs.realpath@^1.0.0: integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= fsevents@~2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.2.tgz#4c0a1fb34bc68e543b4b82a9ec392bfbda840805" - integrity sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA== + version "2.1.3" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.3.tgz#fb738703ae8d2f9fe900c33836ddebee8b97f23e" + integrity sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ== fstream@^1.0.12: version "1.0.12" @@ -1915,10 +1938,21 @@ gaxios@^1.0.4: https-proxy-agent "^2.2.1" node-fetch "^2.3.0" -gaxios@^2.0.0, gaxios@^2.0.1, gaxios@^2.1.0: - version "2.3.2" - resolved "https://registry.yarnpkg.com/gaxios/-/gaxios-2.3.2.tgz#ed666826c2039b89d384907cc075595269826553" - integrity sha512-K/+py7UvKRDaEwEKlLiRKrFr+wjGjsMz5qH7Vs549QJS7cpSCOT/BbWL7pzqECflc46FcNPipjSfB+V1m8PAhw== +gaxios@^2.0.0, gaxios@^2.1.0: + version "2.3.4" + resolved "https://registry.yarnpkg.com/gaxios/-/gaxios-2.3.4.tgz#eea99353f341c270c5f3c29fc46b8ead56f0a173" + integrity sha512-US8UMj8C5pRnao3Zykc4AAVr+cffoNKRTg9Rsf2GiuZCW69vgJj38VK2PzlPuQU73FZ/nTk9/Av6/JGcE1N9vA== + dependencies: + abort-controller "^3.0.0" + extend "^3.0.2" + https-proxy-agent "^5.0.0" + is-stream "^2.0.0" + node-fetch "^2.3.0" + +gaxios@^3.0.0: + version "3.0.3" + resolved "https://registry.yarnpkg.com/gaxios/-/gaxios-3.0.3.tgz#497730758f5b0d43a32ebdbebe5f1bd9f7db7aed" + integrity sha512-PkzQludeIFhd535/yucALT/Wxyj/y2zLyrMwPcJmnLHDugmV49NvAi/vb+VUq/eWztATZCNcb8ue+ywPG+oLuw== dependencies: abort-controller "^3.0.0" extend "^3.0.2" @@ -2066,11 +2100,11 @@ google-auto-auth@^0.10.1: request "^2.79.0" google-gax@^1.13.0, google-gax@^1.14.2: - version "1.15.1" - resolved "https://registry.yarnpkg.com/google-gax/-/google-gax-1.15.1.tgz#a1fa5448e077d94dcf643e7cb0e0cc413a328217" - integrity sha512-1T1PwSZWnbdRusA+NCZMSe56iU6swGvuZuy54eYl9vEHiRXTLYbQmUkWY2CqgYD9Fd/T4WBkUl22+rZG80unyw== + version "1.15.2" + resolved "https://registry.yarnpkg.com/google-gax/-/google-gax-1.15.2.tgz#a58aff43ec383f4f056f9d796e8d5e4891161eb8" + integrity sha512-yNNiRf9QxWpZNfQQmSPz3rIDTBDDKnLKY/QEsjCaJyDxttespr6v8WRGgU5KrU/6ZM7QRlgBAYXCkxqHhJp0wA== dependencies: - "@grpc/grpc-js" "^0.6.18" + "@grpc/grpc-js" "^0.7.4" "@grpc/proto-loader" "^0.5.1" "@types/fs-extra" "^8.0.1" "@types/long" "^4.0.0" @@ -2427,7 +2461,7 @@ is-ci@^1.0.10: dependencies: ci-info "^1.5.0" -is-date-object@^1.0.1: +is-date-object@^1.0.1, is-date-object@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.2.tgz#bda736f2cd8fd06d32844e7743bfa7494c3bfd7e" integrity sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g== @@ -2500,16 +2534,16 @@ is-path-inside@^1.0.0: path-is-inside "^1.0.1" is-promise@^2.1, is-promise@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" - integrity sha1-eaKp7OfwlugPNtKy87wWwf9L8/o= + version "2.2.2" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.2.2.tgz#39ab959ccbf9a774cf079f7b40c7a26f763135f1" + integrity sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ== is-redirect@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-redirect/-/is-redirect-1.0.0.tgz#1d03dded53bd8db0f30c26e4f95d36fc7c87dc24" integrity sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ= -is-regex@^1.0.4, is-regex@^1.0.5: +is-regex@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.5.tgz#39d589a358bf18967f726967120b8fc1aed74eae" integrity sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ== @@ -2553,6 +2587,16 @@ is-symbol@^1.0.2: dependencies: has-symbols "^1.0.1" +is-typed-array@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.3.tgz#a4ff5a5e672e1a55f99c7f54e59597af5c1df04d" + integrity sha512-BSYUBOK/HJibQ30wWkWold5txYwMUXQct9YHAQJr8fSwvZoiglcqB0pd7vEN23+Tsi9IUEjztdOSzl4qLVYGTQ== + dependencies: + available-typed-arrays "^1.0.0" + es-abstract "^1.17.4" + foreach "^2.0.5" + has-symbols "^1.0.1" + is-typedarray@^1.0.0, is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" @@ -2700,9 +2744,9 @@ jsonparse@^1.2.0, jsonparse@^1.3.1: integrity sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA= jsonschema@^1.0.2: - version "1.2.5" - resolved "https://registry.yarnpkg.com/jsonschema/-/jsonschema-1.2.5.tgz#bab69d97fa28946aec0a56a9cc266d23fe80ae61" - integrity sha512-kVTF+08x25PQ0CjuVc0gRM9EUPb0Fe9Ln/utFOgcdxEIOHuU7ooBk/UPTd7t1M91pP35m0MU1T8M5P7vP1bRRw== + version "1.2.6" + resolved "https://registry.yarnpkg.com/jsonschema/-/jsonschema-1.2.6.tgz#52b0a8e9dc06bbae7295249d03e4b9faee8a0c0b" + integrity sha512-SqhURKZG07JyKKeo/ir24QnS4/BV7a6gQy93bUSe4lUdNp0QNpIz2c9elWJQ9dpc5cQYY6cvCzgRwy0MQCLyqA== jsonwebtoken@8.1.0: version "8.1.0" @@ -3015,9 +3059,9 @@ make-dir@^1.0.0: pify "^3.0.0" make-dir@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.0.2.tgz#04a1acbf22221e1d6ef43559f43e05a90dbb4392" - integrity sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w== + version "3.1.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" + integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw== dependencies: semver "^6.0.0" @@ -3072,17 +3116,17 @@ methods@~1.1.2: resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= -mime-db@1.43.0, "mime-db@>= 1.43.0 < 2": - version "1.43.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.43.0.tgz#0a12e0502650e473d735535050e7c8f4eb4fae58" - integrity sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ== +mime-db@1.44.0, "mime-db@>= 1.43.0 < 2": + version "1.44.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.44.0.tgz#fa11c5eb0aca1334b4233cb4d52f10c5a6272f92" + integrity sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg== mime-types@^2.0.8, mime-types@^2.1.12, mime-types@^2.1.16, mime-types@~2.1.19, mime-types@~2.1.24: - version "2.1.26" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.26.tgz#9c921fc09b7e149a65dfdc0da4d20997200b0a06" - integrity sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ== + version "2.1.27" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.27.tgz#47949f98e279ea53119f5722e0f34e529bec009f" + integrity sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w== dependencies: - mime-db "1.43.0" + mime-db "1.44.0" mime@1.6.0: version "1.6.0" @@ -3138,17 +3182,10 @@ minizlib@^1.2.1: dependencies: minipass "^2.9.0" -"mkdirp@>=0.5 0", mkdirp@^0.5.0: - version "0.5.4" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.4.tgz#fd01504a6797ec5c9be81ff43d204961ed64a512" - integrity sha512-iG9AK/dJLtJ0XNgTuDbSyNS3zECqDlAhnQW4CsNxBG3LQJBbHmRX1egw39DmtOdCAqY+dKXV+sgPgilNWUKMVw== - dependencies: - minimist "^1.2.5" - -mkdirp@^0.5.1: - version "0.5.3" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.3.tgz#5a514b7179259287952881e94410ec5465659f8c" - integrity sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg== +"mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@^0.5.3: + version "0.5.5" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" + integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== dependencies: minimist "^1.2.5" @@ -3277,10 +3314,13 @@ object-inspect@^1.7.0: resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.7.0.tgz#f4f6bd181ad77f006b5ece60bd0b6f398ff74a67" integrity sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw== -object-is@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/object-is/-/object-is-1.0.2.tgz#6b80eb84fe451498f65007982f035a5b445edec4" - integrity sha512-Epah+btZd5wrrfjkJZq1AOB9O6OxUQto45hzFd7lXGrpHPGE0W1k+426yrZV+k6NJOzLNNW/nVsmZdIWsAqoOQ== +object-is@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/object-is/-/object-is-1.1.2.tgz#c5d2e87ff9e119f78b7a088441519e2eec1573b6" + integrity sha512-5lHCz+0uufF6wZ7CRFWJN3hp8Jqblpgve06U5CMQ3f//6iDjPr2PEo9MWCjEssDsa+UZEL4PkFpr+BMop6aKzQ== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.5" object-keys@^1.0.11, object-keys@^1.0.12, object-keys@^1.1.0, object-keys@^1.1.1: version "1.1.1" @@ -3370,9 +3410,9 @@ p-finally@^1.0.0: integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= p-limit@^2.2.0: - version "2.2.2" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.2.tgz#61279b67721f5287aa1c13a9a7fbbc48c9291b1e" - integrity sha512-WGR+xHecKTr7EbUEhyLSh5Dube9JtdiG78ufaeLxTgpudf/20KqyMioIUZJAezlTIi6evxuoUs9YXc11cU+yzQ== + version "2.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" + integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== dependencies: p-try "^2.0.0" @@ -3463,7 +3503,7 @@ performance-now@^2.1.0: resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= -picomatch@^2.0.4, picomatch@^2.0.7: +picomatch@^2.0.4, picomatch@^2.2.1: version "2.2.2" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg== @@ -3541,9 +3581,9 @@ progress@^2.0.3: integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== protobufjs@^6.8.1, protobufjs@^6.8.6, protobufjs@^6.8.8, protobufjs@^6.8.9: - version "6.8.9" - resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.8.9.tgz#0b1adbcdaa983d369c3d9108a97c814edc030754" - integrity sha512-j2JlRdUeL/f4Z6x4aU4gj9I2LECglC+5qR2TrWb193Tla1qfdaNQTZ8I27Pt7K0Ajmvjjpft7O3KWTGciz4gpw== + version "6.9.0" + resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.9.0.tgz#c08b2bf636682598e6fabbf0edb0b1256ff090bd" + integrity sha512-LlGVfEWDXoI/STstRDdZZKb/qusoAWUnmLg9R8OLSO473mBLWHowx8clbX5/+mKDEI+v7GzjoK9tRPZMMcoTrg== dependencies: "@protobufjs/aspromise" "^1.1.2" "@protobufjs/base64" "^1.1.2" @@ -3555,8 +3595,8 @@ protobufjs@^6.8.1, protobufjs@^6.8.6, protobufjs@^6.8.8, protobufjs@^6.8.9: "@protobufjs/path" "^1.1.2" "@protobufjs/pool" "^1.1.0" "@protobufjs/utf8" "^1.1.0" - "@types/long" "^4.0.0" - "@types/node" "^10.1.0" + "@types/long" "^4.0.1" + "@types/node" "^13.7.0" long "^4.0.0" proxy-addr@~2.0.5: @@ -3693,12 +3733,12 @@ readable-stream@~2.0.0: string_decoder "~0.10.x" util-deprecate "~1.0.1" -readdirp@~3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.3.0.tgz#984458d13a1e42e2e9f5841b129e162f369aff17" - integrity sha512-zz0pAkSPOXXm1viEwygWIPSPkcBYjW1xU5j/JBh5t9bGCJwa6f9+BJa6VaB2g+b55yVrmXzqkyLf4xaWYM0IkQ== +readdirp@~3.4.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.4.0.tgz#9fdccdf9e9155805449221ac645e8303ab5b9ada" + integrity sha512-0xe001vZBnJEK+uKcj8qOhyAKPzIT+gStxWr3LCB0DwcXR5NZJ3IaC+yGnHCYzB/S7ov3m3EEbZI2zeNvX+hGQ== dependencies: - picomatch "^2.0.7" + picomatch "^2.2.1" redeyed@~2.1.0: version "2.1.1" @@ -3714,7 +3754,7 @@ reduce@^1.0.1: dependencies: object-keys "^1.1.0" -regexp.prototype.flags@^1.2.0: +regexp.prototype.flags@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.3.0.tgz#7aba89b3c13a64509dabcf3ca8d9fbb9bdf5cb75" integrity sha512-2+Q0C5g951OlYlJz6yu5/M33IcsESLlLfsyIaLJaG4FA2r4yP8MvVMJUUP/fVBkSpbbbZlS5gynbEWLipiiXiQ== @@ -3769,9 +3809,9 @@ resolve-from@^3.0.0: integrity sha1-six699nWiBvItuZTM17rywoYh0g= resolve@^1.10.0, resolve@^1.3.2: - version "1.15.1" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.15.1.tgz#27bdcdeffeaf2d6244b95bb0f9f4b4653451f3e8" - integrity sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w== + version "1.17.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444" + integrity sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w== dependencies: path-parse "^1.0.6" @@ -3841,9 +3881,9 @@ run-node@^1.0.0: integrity sha512-kc120TBlQ3mih1LSzdAJXo4xn/GWS2ec0l3S+syHDXP9uRr0JAT8Qd3mdMuyjqCzeZktgP3try92cEgf9Nks8A== rxjs@^6.4.0: - version "6.5.4" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.4.tgz#e0777fe0d184cec7872df147f303572d414e211c" - integrity sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q== + version "6.5.5" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.5.tgz#c5c884e3094c8cfee31bf27eb87e54ccfc87f9ec" + integrity sha512-WfQI+1gohdf0Dai/Bbmk5L5ItH5tYqm3ki2c5GdWhKjalzjg93N3avFjVStyZZz+A2Em+ZxKH5bNghw9UeylGQ== dependencies: tslib "^1.9.0" @@ -3940,7 +3980,7 @@ shebang-regex@^1.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= -side-channel@^1.0.1: +side-channel@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.2.tgz#df5d1abadb4e4bf4af1cd8852bf132d2f7876947" integrity sha512-7rL9YlPHg7Ancea1S96Pa8/QWb4BtXL/TZvS6B8XFetGBeuhAsfmUspK6DokBeZ64+Kj9TCNRD/30pVz1BvQNA== @@ -3949,9 +3989,9 @@ side-channel@^1.0.1: object-inspect "^1.7.0" signal-exit@^3.0.0, signal-exit@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" - integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= + version "3.0.3" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c" + integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA== slash@^3.0.0: version "3.0.0" @@ -3963,10 +4003,10 @@ snakeize@^0.1.0: resolved "https://registry.yarnpkg.com/snakeize/-/snakeize-0.1.0.tgz#10c088d8b58eb076b3229bb5a04e232ce126422d" integrity sha1-EMCI2LWOsHazIpu1oE4jLOEmQi0= -source-map-support@^0.5.6: - version "0.5.16" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.16.tgz#0ae069e7fe3ba7538c64c98515e35339eac5a042" - integrity sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ== +source-map-support@^0.5.17: + version "0.5.19" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61" + integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw== dependencies: buffer-from "^1.0.0" source-map "^0.6.0" @@ -3985,9 +4025,9 @@ spdx-correct@^3.0.0: spdx-license-ids "^3.0.0" spdx-exceptions@^2.1.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz#2ea450aee74f2a89bfb94519c07fcd6f41322977" - integrity sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA== + version "2.3.0" + resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz#3f28ce1a77a00372683eade4a433183527a2163d" + integrity sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A== spdx-expression-parse@^3.0.0: version "3.0.0" @@ -4064,21 +4104,39 @@ string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: is-fullwidth-code-point "^2.0.0" strip-ansi "^4.0.0" -string.prototype.trimleft@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/string.prototype.trimleft/-/string.prototype.trimleft-2.1.1.tgz#9bdb8ac6abd6d602b17a4ed321870d2f8dcefc74" - integrity sha512-iu2AGd3PuP5Rp7x2kEZCrB2Nf41ehzh+goo8TV7z8/XDBbsvc6HQIlUl9RjkZ4oyrW1XM5UwlGl1oVEaDjg6Ag== +string.prototype.trimend@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz#85812a6b847ac002270f5808146064c995fb6913" + integrity sha512-LRPxFUaTtpqYsTeNKaFOw3R4bxIzWOnbQ837QfBylo8jIxtcbK/A/sMV7Q+OAV/vWo+7s25pOE10KYSjaSO06g== dependencies: define-properties "^1.1.3" - function-bind "^1.1.1" + es-abstract "^1.17.5" + +string.prototype.trimleft@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/string.prototype.trimleft/-/string.prototype.trimleft-2.1.2.tgz#4408aa2e5d6ddd0c9a80739b087fbc067c03b3cc" + integrity sha512-gCA0tza1JBvqr3bfAIFJGqfdRTyPae82+KTnm3coDXkZN9wnuW3HjGgN386D7hfv5CHQYCI022/rJPVlqXyHSw== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.5" + string.prototype.trimstart "^1.0.0" string.prototype.trimright@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/string.prototype.trimright/-/string.prototype.trimright-2.1.1.tgz#440314b15996c866ce8a0341894d45186200c5d9" - integrity sha512-qFvWL3/+QIgZXVmJBfpHmxLB7xsUXz6HsUmP8+5dRaC3Q7oKUv9Vo6aMCRZC1smrtyECFsIT30PqBJ1gTjAs+g== + version "2.1.2" + resolved "https://registry.yarnpkg.com/string.prototype.trimright/-/string.prototype.trimright-2.1.2.tgz#c76f1cef30f21bbad8afeb8db1511496cfb0f2a3" + integrity sha512-ZNRQ7sY3KroTaYjRS6EbNiiHrOkjihL9aQE/8gfQ4DtAC/aEBRHFJa44OmoWxGGqXuJlfKkZW4WcXErGr+9ZFg== dependencies: define-properties "^1.1.3" - function-bind "^1.1.1" + es-abstract "^1.17.5" + string.prototype.trimend "^1.0.0" + +string.prototype.trimstart@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz#14af6d9f34b053f7cfc89b72f8f2ee14b9039a54" + integrity sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.5" string_decoder@^1.1.1: version "1.3.0" @@ -4327,14 +4385,14 @@ try-require@^1.0.0: integrity sha1-NEiaLKwMCcHMEO2RugEVlNQzO+I= ts-node@^8.6.2: - version "8.6.2" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.6.2.tgz#7419a01391a818fbafa6f826a33c1a13e9464e35" - integrity sha512-4mZEbofxGqLL2RImpe3zMJukvEvcO1XP8bj8ozBPySdCUXEcU5cIRwR0aM3R+VoZq7iXc8N86NC0FspGRqP4gg== + version "8.9.1" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.9.1.tgz#2f857f46c47e91dcd28a14e052482eb14cfd65a5" + integrity sha512-yrq6ODsxEFTLz0R3BX2myf0WBCSQh9A+py8PBo1dCzWIOcvisbyH6akNKqDHMgXePF2kir5mm5JXJTH3OUJYOQ== dependencies: arg "^4.1.0" diff "^4.0.1" make-error "^1.1.1" - source-map-support "^0.5.6" + source-map-support "^0.5.17" yn "3.1.1" tslib@1.11.1, tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0: @@ -4343,9 +4401,9 @@ tslib@1.11.1, tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0: integrity sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA== tslint@^6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/tslint/-/tslint-6.1.0.tgz#c6c611b8ba0eed1549bf5a59ba05a7732133d851" - integrity sha512-fXjYd/61vU6da04E505OZQGb2VCN2Mq3doeWcOIryuG+eqdmFUXTYVwdhnbEu2k46LNLgUYt9bI5icQze/j0bQ== + version "6.1.2" + resolved "https://registry.yarnpkg.com/tslint/-/tslint-6.1.2.tgz#2433c248512cc5a7b2ab88ad44a6b1b34c6911cf" + integrity sha512-UyNrLdK3E0fQG/xWNqAFAC5ugtFyPO4JJR1KyyfQAyzR8W0fTRrC91A8Wej4BntFzcvETdCSDa/4PnNYJQLYiA== dependencies: "@babel/code-frame" "^7.0.0" builtin-modules "^1.1.1" @@ -4355,7 +4413,7 @@ tslint@^6.1.0: glob "^7.1.1" js-yaml "^3.13.1" minimatch "^3.0.4" - mkdirp "^0.5.1" + mkdirp "^0.5.3" resolve "^1.3.2" semver "^5.3.0" tslib "^1.10.0" @@ -4454,9 +4512,9 @@ unzip-response@^2.0.1: integrity sha1-0vD3N9FrBhXnKmk17QQhRXLVb5c= unzipper@^0.10.10: - version "0.10.10" - resolved "https://registry.yarnpkg.com/unzipper/-/unzipper-0.10.10.tgz#d82d41fbdfa1f0731123eb11c2cfc028b45d3d42" - integrity sha512-wEgtqtrnJ/9zIBsQb8UIxOhAH1eTHfi7D/xvmrUoMEePeI6u24nq1wigazbIFtHt6ANYXdEVTvc8XYNlTurs7A== + version "0.10.11" + resolved "https://registry.yarnpkg.com/unzipper/-/unzipper-0.10.11.tgz#0b4991446472cbdb92ee7403909f26c2419c782e" + integrity sha512-+BrAq2oFqWod5IESRjL3S8baohbevGcVA+teAIOYWM3pDVdseogqbzhhvvmiyQrUNKFUnDMtELW3X8ykbyDCJw== dependencies: big-integer "^1.6.17" binary "~0.3.0" @@ -4520,9 +4578,9 @@ uuid@^3.0.0, uuid@^3.3.2: integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== uuid@^7.0.0: - version "7.0.2" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-7.0.2.tgz#7ff5c203467e91f5e0d85cfcbaaf7d2ebbca9be6" - integrity sha512-vy9V/+pKG+5ZTYKf+VcphF5Oc6EFiu3W8Nv3P3zIh0EqVI80ZxOzuPfe9EHjkFNvf8+xuTHVeei4Drydlx4zjw== + version "7.0.3" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-7.0.3.tgz#c5c9f2c8cf25dc0a372c4df1441c41f5bd0c680b" + integrity sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg== valid-url@^1: version "1.0.9" @@ -4588,7 +4646,7 @@ which-boxed-primitive@^1.0.1: is-string "^1.0.4" is-symbol "^1.0.2" -which-collection@^1.0.0: +which-collection@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/which-collection/-/which-collection-1.0.1.tgz#70eab71ebbbd2aefaf32f917082fc62cdcb70906" integrity sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A== @@ -4598,6 +4656,18 @@ which-collection@^1.0.0: is-weakmap "^2.0.1" is-weakset "^2.0.1" +which-typed-array@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.2.tgz#e5f98e56bda93e3dac196b01d47c1156679c00b2" + integrity sha512-KT6okrd1tE6JdZAy3o2VhMoYPh3+J6EMZLyrxBQsZflI1QCZIxMrIYLkosd8Twf+YfknVIHmYQPgJt238p8dnQ== + dependencies: + available-typed-arrays "^1.0.2" + es-abstract "^1.17.5" + foreach "^2.0.5" + function-bind "^1.1.1" + has-symbols "^1.0.1" + is-typed-array "^1.1.3" + which@^1.2.9: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" From 15568309ec88f8371544836ef1c6f6a71472fdfc Mon Sep 17 00:00:00 2001 From: Shams mosowi Date: Mon, 27 Apr 2020 18:02:07 +0800 Subject: [PATCH 16/38] create .env file during cloud build --- cloud_functions/functions/src/backup.ts | 2 +- cloudbuild.yaml | 28 ++++++++++++++++--------- www/createDotEnv.js | 18 ++++++++++++++++ 3 files changed, 37 insertions(+), 11 deletions(-) create mode 100644 www/createDotEnv.js diff --git a/cloud_functions/functions/src/backup.ts b/cloud_functions/functions/src/backup.ts index 417598c5..73bf9071 100644 --- a/cloud_functions/functions/src/backup.ts +++ b/cloud_functions/functions/src/backup.ts @@ -5,7 +5,7 @@ import { hasAnyRole } from "./utils/auth"; const client = new firestore.v1.FirestoreAdminClient(); // Replace BUCKET_NAME -const bucket = "gs://antler-backups"; +const bucket = "gs://BUCKET_NAME"; // const restoreFirestoreBackup = (collectionIds: string[] = []) => { // const projectId = process.env.GCP_PROJECT || process.env.GCLOUD_PROJECT; diff --git a/cloudbuild.yaml b/cloudbuild.yaml index c839f95f..5c16c163 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -1,13 +1,4 @@ steps: - - name: gcr.io/cloud-builders/gcloud - args: - - kms - - decrypt - - --ciphertext-file=www/.env.enc - - --plaintext-file=www/.env - - --location=global - - --keyring=antler-vc - - --key=cloudbuild-env - name: node:10.15.1 entrypoint: yarn args: ["install"] @@ -18,5 +9,22 @@ steps: dir: "www" - name: node:10.15.1 entrypoint: yarn - args: ["deploy"] + args: + - env + - "${_PROJECT_ID}" + - "${_FIREBASE_WEB_API_KEY}" + - "${_ALGOLIA_APP_ID}" + - "${_ALGOLIA_APP_KEY}" + dir: "www" + - name: node:10.15.1 + entrypoint: yarn + args: + - deploy + - --project + - "${_PROJECT_ID}" + - --debug + - --token + - "${_FIREBASE_TOKEN}" + - --only + - hosting dir: "www" diff --git a/www/createDotEnv.js b/www/createDotEnv.js new file mode 100644 index 00000000..0192f440 --- /dev/null +++ b/www/createDotEnv.js @@ -0,0 +1,18 @@ +import * as fs from "fs"; + +const main = ( + projectID = "", + firebaseWebApiKey = "", + algoliaAppId = "", + algoliaSearhApiKey = "" +) => { + return fs.writeFileSync( + ".env", + `REACT_APP_FIREBASE_PROJECT_ID = ${projectID} +REACT_APP_FIREBASE_PROJECT_WEB_API_KEY = ${firebaseWebApiKey} +REACT_APP_ALGOLIA_APP_ID = ${algoliaAppId} +REACT_APP_ALGOLIA_SEARCH_API_KEY = ${algoliaSearhApiKey}` + ); +}; + +main(process.argv[2], process.argv[3], process.argv[4], process.argv[5]); From 150a6d46ebc7b5e6111e8abd454351bffeb811ea Mon Sep 17 00:00:00 2001 From: Shams mosowi Date: Mon, 27 Apr 2020 18:02:36 +0800 Subject: [PATCH 17/38] added prettier --- cloud_functions/functions/package.json | 2 + cloud_functions/functions/yarn.lock | 134 ++++++++++++++++++++++++- 2 files changed, 134 insertions(+), 2 deletions(-) diff --git a/cloud_functions/functions/package.json b/cloud_functions/functions/package.json index 0046c845..70d1e7f2 100644 --- a/cloud_functions/functions/package.json +++ b/cloud_functions/functions/package.json @@ -29,6 +29,8 @@ "devDependencies": { "firebase-tools": "^7.16.1", "husky": "^3.0.9", + "prettier": "^2.0.5", + "pretty-quick": "^2.0.1", "ts-node": "^8.6.2", "tslint": "^6.1.0", "typescript": "^3.2.2" diff --git a/cloud_functions/functions/yarn.lock b/cloud_functions/functions/yarn.lock index 76f70452..a908852b 100644 --- a/cloud_functions/functions/yarn.lock +++ b/cloud_functions/functions/yarn.lock @@ -332,6 +332,11 @@ resolved "https://registry.yarnpkg.com/@types/mime/-/mime-2.0.1.tgz#dc488842312a7f075149312905b5e3c0b054c79d" integrity sha512-FwI9gX75FgVBJ7ywgnq/P7tw+/o1GUbtP0KzbtusLigAOgIgNISRK0ZPl4qertvXSIE8YbsVJueQ90cDt9YYyw== +"@types/minimatch@^3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" + integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== + "@types/node@*", "@types/node@^13.7.0": version "13.13.4" resolved "https://registry.yarnpkg.com/@types/node/-/node-13.13.4.tgz#1581d6c16e3d4803eb079c87d4ac893ee7501c2c" @@ -531,6 +536,11 @@ argparse@^1.0.7: dependencies: sprintf-js "~1.0.2" +array-differ@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/array-differ/-/array-differ-3.0.0.tgz#3cbb3d0f316810eafcc47624734237d6aee4ae6b" + integrity sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg== + array-filter@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/array-filter/-/array-filter-1.0.0.tgz#baf79e62e6ef4c2a4c0b831232daffec251f9d83" @@ -546,7 +556,12 @@ array-flatten@3.0.0: resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-3.0.0.tgz#6428ca2ee52c7b823192ec600fa3ed2f157cd541" integrity sha512-zPMVc3ZYlGLNk4mpK1NzP2wg0ml9t7fUgDsayR5Y5rSzxQilzR9FGu/EH2jQOcKSAeAfWeylyW8juy3OkWRvNA== -arrify@^2.0.0: +array-union@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" + integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== + +arrify@^2.0.0, arrify@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-2.0.1.tgz#c9655e9331e0abcd588d2a7cad7e9956f66701fa" integrity sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug== @@ -1178,6 +1193,15 @@ cross-spawn@^6.0.0, cross-spawn@^6.0.5: shebang-command "^1.2.0" which "^1.2.9" +cross-spawn@^7.0.0: + version "7.0.2" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.2.tgz#d0d7dcfa74e89115c7619f4f721a94e1fdb716d6" + integrity sha512-PD6G8QG3S4FK/XCGFbEQrDqO2AnMMsy0meR7lerlIOHAAbkuavGU/pOqprrlvfTNjvowivTeBsjebAL0NSoMxw== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + crypto-random-string@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/crypto-random-string/-/crypto-random-string-1.0.0.tgz#a230f64f568310e1498009940790ec99545bca7e" @@ -1595,6 +1619,21 @@ execa@^1.0.0: signal-exit "^3.0.0" strip-eof "^1.0.0" +execa@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-2.1.0.tgz#e5d3ecd837d2a60ec50f3da78fd39767747bbe99" + integrity sha512-Y/URAVapfbYy2Xp/gb6A0E7iR8xeqOCXsuuaoMn7A5PzrXUK84E1gyiEfq0wQd/GHA6GsoHWwhNq8anb0mleIw== + dependencies: + cross-spawn "^7.0.0" + get-stream "^5.0.0" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^3.0.0" + onetime "^5.1.0" + p-finally "^2.0.0" + signal-exit "^3.0.2" + strip-final-newline "^2.0.0" + exit-code@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/exit-code/-/exit-code-1.0.2.tgz#ce165811c9f117af6a5f882940b96ae7f9aecc34" @@ -1733,7 +1772,7 @@ finalhandler@1.1.2, finalhandler@~1.1.2: statuses "~1.5.0" unpipe "~1.0.0" -find-up@^4.0.0: +find-up@^4.0.0, find-up@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== @@ -2006,6 +2045,13 @@ get-stream@^4.0.0: dependencies: pump "^3.0.0" +get-stream@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.1.0.tgz#01203cdc92597f9b909067c3e656cc1f4d3c4dc9" + integrity sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw== + dependencies: + pump "^3.0.0" + getpass@^0.1.1: version "0.1.7" resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" @@ -2347,6 +2393,11 @@ ieee754@^1.1.4: resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84" integrity sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg== +ignore@^5.1.4: + version "5.1.4" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.4.tgz#84b7b3dbe64552b6ef0eca99f6743dbec6d97adf" + integrity sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A== + import-fresh@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-2.0.0.tgz#d81355c15612d386c61f9ddd3922d4304822a546" @@ -3111,6 +3162,11 @@ merge-descriptors@1.0.1: resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" integrity sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E= +merge-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" + integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== + methods@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" @@ -3200,6 +3256,11 @@ morgan@^1.8.2: on-finished "~2.3.0" on-headers "~1.0.2" +mri@^1.1.4: + version "1.1.5" + resolved "https://registry.yarnpkg.com/mri/-/mri-1.1.5.tgz#ce21dba2c69f74a9b7cf8a1ec62307e089e223e0" + integrity sha512-d2RKzMD4JNyHMbnbWnznPaa8vbdlq/4pNZ3IgdaGrVbBhebBsGUUE/6qorTMYNS6TwuH3ilfOlD2bf4Igh8CKg== + ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" @@ -3215,6 +3276,17 @@ ms@^2.0.0, ms@^2.1.1: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== +multimatch@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/multimatch/-/multimatch-4.0.0.tgz#8c3c0f6e3e8449ada0af3dd29efb491a375191b3" + integrity sha512-lDmx79y1z6i7RNx0ZGCPq1bzJ6ZoDDKbvh7jxr9SJcWLkShMzXrHbYVpTdnhNM5MXpDUxCQ4DgqVttVXlBgiBQ== + dependencies: + "@types/minimatch" "^3.0.3" + array-differ "^3.0.0" + array-union "^2.1.0" + arrify "^2.0.1" + minimatch "^3.0.4" + mute-stream@0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" @@ -3299,6 +3371,13 @@ npm-run-path@^2.0.0: dependencies: path-key "^2.0.0" +npm-run-path@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-3.1.0.tgz#7f91be317f6a466efed3c9f2980ad8a4ee8b0fa5" + integrity sha512-Dbl4A/VfiVGLgQv29URL9xshU8XDY1GeLy+fsaZ1AA8JDSfjvr5P5+pzRbWqRSBxk6/DW7MIh8lTM/PaGnP2kg== + dependencies: + path-key "^3.0.0" + oauth-sign@~0.9.0: version "0.9.0" resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" @@ -3409,6 +3488,11 @@ p-finally@^1.0.0: resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= +p-finally@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-2.0.1.tgz#bd6fcaa9c559a096b680806f4d657b3f0f240561" + integrity sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw== + p-limit@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" @@ -3481,6 +3565,11 @@ path-key@^2.0.0, path-key@^2.0.1: resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= +path-key@^3.0.0, path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + path-parse@^1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" @@ -3560,6 +3649,23 @@ prepend-http@^1.0.1: resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc" integrity sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw= +prettier@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.0.5.tgz#d6d56282455243f2f92cc1716692c08aa31522d4" + integrity sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg== + +pretty-quick@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/pretty-quick/-/pretty-quick-2.0.1.tgz#417ee605ade98ecc686e72f63b5d28a2c35b43e9" + integrity sha512-y7bJt77XadjUr+P1uKqZxFWLddvj3SKY6EU4BuQtMxmmEFSMpbN132pUWdSG1g1mtUfO0noBvn7wBf0BVeomHg== + dependencies: + chalk "^2.4.2" + execa "^2.1.0" + find-up "^4.1.0" + ignore "^5.1.4" + mri "^1.1.4" + multimatch "^4.0.0" + process-nextick-args@~1.0.6: version "1.0.7" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" @@ -3975,11 +4081,23 @@ shebang-command@^1.2.0: dependencies: shebang-regex "^1.0.0" +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + shebang-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + side-channel@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.2.tgz#df5d1abadb4e4bf4af1cd8852bf132d2f7876947" @@ -4183,6 +4301,11 @@ strip-eof@^1.0.0: resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= +strip-final-newline@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" + integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== + strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" @@ -4675,6 +4798,13 @@ which@^1.2.9: dependencies: isexe "^2.0.0" +which@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + widest-line@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/widest-line/-/widest-line-2.0.1.tgz#7438764730ec7ef4381ce4df82fb98a53142a3fc" From b9d604ee0f5f65f9a1f1742a9d7a5e41a020cfde Mon Sep 17 00:00:00 2001 From: Shams mosowi Date: Mon, 27 Apr 2020 20:51:08 +0800 Subject: [PATCH 18/38] env script --- cloudbuild.yaml | 2 ++ www/package.json | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cloudbuild.yaml b/cloudbuild.yaml index 5c16c163..19b943a8 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -28,3 +28,5 @@ steps: - --only - hosting dir: "www" +substitutions: + _PROJECT_ID: "project-id" # default value diff --git a/www/package.json b/www/package.json index 739b1c29..fa498df5 100644 --- a/www/package.json +++ b/www/package.json @@ -61,7 +61,8 @@ "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", - "deploy": "firebase deploy --project \"$PROJECT_ID\" --debug --token \"$FIREBASE_TOKEN\" --only hosting" + "env": "node createDotEnv", + "deploy": "firebase deploy" }, "engines": { "node": "10" From d87c9a1856f2ff256889d7c01150622ffaf654e5 Mon Sep 17 00:00:00 2001 From: Shams mosowi Date: Mon, 27 Apr 2020 21:55:03 +0800 Subject: [PATCH 19/38] reorder cloud build steps --- cloudbuild.yaml | 9 +++++---- www/.firebaserc | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/cloudbuild.yaml b/cloudbuild.yaml index 19b943a8..51d6c716 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -3,10 +3,6 @@ steps: entrypoint: yarn args: ["install"] dir: "www" - - name: node:10.15.1 - entrypoint: yarn - args: ["build"] - dir: "www" - name: node:10.15.1 entrypoint: yarn args: @@ -16,6 +12,11 @@ steps: - "${_ALGOLIA_APP_ID}" - "${_ALGOLIA_APP_KEY}" dir: "www" + - name: node:10.15.1 + entrypoint: yarn + args: ["build"] + dir: "www" + - name: node:10.15.1 entrypoint: yarn args: diff --git a/www/.firebaserc b/www/.firebaserc index 233b9d9a..986ae016 100644 --- a/www/.firebaserc +++ b/www/.firebaserc @@ -1,9 +1,9 @@ { "projects": { - "default": "antler-vc" + "default": "antler-develop" }, "targets": { - "antler-vc": { + "antler-develop": { "hosting": { "firetable": [ "antler-admin" From 32aafb19b6dc19aec184fc0b4f6721adf859f3f8 Mon Sep 17 00:00:00 2001 From: Shams mosowi Date: Mon, 27 Apr 2020 22:19:49 +0800 Subject: [PATCH 20/38] switch to require --- www/createDotEnv.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/createDotEnv.js b/www/createDotEnv.js index 0192f440..623ddb7f 100644 --- a/www/createDotEnv.js +++ b/www/createDotEnv.js @@ -1,4 +1,4 @@ -import * as fs from "fs"; +const fs = require("fs"); const main = ( projectID = "", From 4afca01eedff773654886ec42a2d88b99df53871 Mon Sep 17 00:00:00 2001 From: Shams mosowi Date: Tue, 28 Apr 2020 12:02:51 +0800 Subject: [PATCH 21/38] prevent multi select crashing --- www/src/components/MultiSelect/index.tsx | 15 +++++--- .../Table/formatters/MultiSelect.tsx | 34 +++++++++++-------- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/www/src/components/MultiSelect/index.tsx b/www/src/components/MultiSelect/index.tsx index d4a11d11..2b967827 100644 --- a/www/src/components/MultiSelect/index.tsx +++ b/www/src/components/MultiSelect/index.tsx @@ -58,19 +58,24 @@ export default function MultiSelect({ width: dropdownWidth, }); - const sanitisedValue = value.filter(v => v?.length > 0); + const sanitisedValue = Array.isArray(value) + ? value.filter((v) => v?.length > 0) + : [value]; // Transform `option` prop if it’s just strings let options = typeof optionsProp[0] === "string" ? (optionsProp as string[]).map( - item => ({ label: item, value: item } as OptionType) + (item) => ({ label: item, value: item } as OptionType) ) : (optionsProp as OptionType[]); // If `freeText` enabled, show the user’s custom fields if (freeText) { // `value` prop is an array of all values. It removes labels - const formattedValues = sanitisedValue?.map(x => ({ label: x, value: x })); + const formattedValues = sanitisedValue?.map((x) => ({ + label: x, + value: x, + })); options = _unionWith( options, formattedValues, @@ -86,7 +91,7 @@ export default function MultiSelect({ className={clsx(classes.root, className)} {...TextFieldProps} SelectProps={{ - renderValue: value => { + renderValue: (value) => { const selected = value as string[]; if (selected.length === 1 && typeof selected[0] === "string") { const selectedOption = _find(options, { value: selected[0] }); @@ -109,7 +114,7 @@ export default function MultiSelect({ ...TextFieldProps.SelectProps?.MenuProps, }, }} - ref={el => { + ref={(el) => { if (!el) return; const width = el.getBoundingClientRect().width; if (dropdownWidth < width) setDropdownWidth(width); diff --git a/www/src/components/Table/formatters/MultiSelect.tsx b/www/src/components/Table/formatters/MultiSelect.tsx index 7e146cf2..e38cb702 100644 --- a/www/src/components/Table/formatters/MultiSelect.tsx +++ b/www/src/components/Table/formatters/MultiSelect.tsx @@ -9,7 +9,7 @@ import FormattedChip from "components/FormattedChip"; import { FieldType } from "constants/fields"; import { useFiretableContext } from "contexts/firetableContext"; -const useStyles = makeStyles(theme => +const useStyles = makeStyles((theme) => createStyles({ root: { minWidth: 0, @@ -63,23 +63,27 @@ export default function MultiSelect({ ? (([value] as unknown) as string[]) : value; // And support transforming array of strings back to string - const handleChange = value => onSubmit(isSingle ? value.join(", ") : value); + const handleChange = (value) => onSubmit(isSingle ? value.join(", ") : value); // Render chips - const renderValue = value => ( - - {value?.map( - item => - typeof item === "string" && ( - - - - ) - )} - - ); + const renderValue = (value) => { + //if (Array.isArray(value)) + return ( + + {value?.map( + (item) => + typeof item === "string" && ( + + + + ) + )} + + ); + // else + }; - const onClick = e => e.stopPropagation(); + const onClick = (e) => e.stopPropagation(); const onClose = () => { if (dataGridRef?.current?.selectCell) dataGridRef.current.selectCell({ rowIdx, idx: column.idx }); From 5ecd90dd9fd1b44dea1e6b560c63a0d31c882e79 Mon Sep 17 00:00:00 2001 From: Shams mosowi Date: Tue, 28 Apr 2020 12:03:50 +0800 Subject: [PATCH 22/38] initials checkboxs as false when adding new row --- www/src/components/Table/TableHeader.tsx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/www/src/components/Table/TableHeader.tsx b/www/src/components/Table/TableHeader.tsx index 1735cfea..d04206ee 100644 --- a/www/src/components/Table/TableHeader.tsx +++ b/www/src/components/Table/TableHeader.tsx @@ -18,10 +18,11 @@ import ExportCSV from "./ExportCSV"; import { FireTableFilter } from "hooks/useFiretable"; import { DRAWER_COLLAPSED_WIDTH } from "components/SideDrawer"; import { useFiretableContext } from "contexts/firetableContext"; +import { FieldType } from "constants/fields"; export const TABLE_HEADER_HEIGHT = 56; -const useStyles = makeStyles(theme => +const useStyles = makeStyles((theme) => createStyles({ root: { width: `calc(100% - ${DRAWER_COLLAPSED_WIDTH}px)`, @@ -85,7 +86,16 @@ export default function TableHeader({ > - - - )} - - - } - label={longestLabel} - variant="outlined" - role="presentation" - ref={el => { - if (!el) return; - const width = el.getBoundingClientRect().width; - if (dropdownWidth < width) setDropdownWidth(width + 32); - }} - /> - - - ); -} diff --git a/www/src/components/MultiSelect/index.tsx b/www/src/components/MultiSelect/index.tsx deleted file mode 100644 index 2b967827..00000000 --- a/www/src/components/MultiSelect/index.tsx +++ /dev/null @@ -1,133 +0,0 @@ -import React, { useState } from "react"; -import clsx from "clsx"; -import _unionWith from "lodash/unionWith"; -import _find from "lodash/find"; -import { TextField, TextFieldProps } from "@material-ui/core"; - -import useStyles from "./styles"; -import PopupContents from "./PopupContents"; - -export type OptionType = { label: string; value: string; data?: any }; - -export interface IMultiSelectProps { - label: string; - value: string[]; - editable?: boolean; - /** The list of options to display. Passing `string[]` will auto-transform */ - options: OptionType[] | string[]; - itemRenderer?: ( - option: OptionType, - select: Function, - deselect: Function, - isSelected: Boolean - ) => React.ReactNode; - searchable?: boolean; - onChange: (value: string[]) => void; - - /** Optionally allow the user to select all options */ - selectAll?: boolean; - /** Optionally allow the user to add a custom option */ - freeText?: boolean; - /** Optionally set this prop to `false` to only allow one option */ - multiple?: boolean; - /** Optional style overrides for root MUI `TextField` component */ - className?: string; - /** Override any props of the root MUI `TextField` component */ - TextFieldProps?: Partial; -} - -export default function MultiSelect({ - options: optionsProp, - label, - className, - TextFieldProps = {}, - ...props -}: IMultiSelectProps) { - const { - value = [], - searchable = true, - freeText = false, - multiple = true, - } = props; - - const [dropdownWidth, setDropdownWidth] = useState(200); - const classes = useStyles({ - searchable, - freeText, - multiple, - width: dropdownWidth, - }); - - const sanitisedValue = Array.isArray(value) - ? value.filter((v) => v?.length > 0) - : [value]; - - // Transform `option` prop if it’s just strings - let options = - typeof optionsProp[0] === "string" - ? (optionsProp as string[]).map( - (item) => ({ label: item, value: item } as OptionType) - ) - : (optionsProp as OptionType[]); - // If `freeText` enabled, show the user’s custom fields - if (freeText) { - // `value` prop is an array of all values. It removes labels - const formattedValues = sanitisedValue?.map((x) => ({ - label: x, - value: x, - })); - options = _unionWith( - options, - formattedValues, - (a, b) => a.value === b.value - ); - } - return ( - { - const selected = value as string[]; - if (selected.length === 1 && typeof selected[0] === "string") { - const selectedOption = _find(options, { value: selected[0] }); - return selectedOption?.label; - } - return `${selected.length} of ${options.length} selected`; - }, - displayEmpty: true, - classes: { root: classes.selectRoot }, - ...TextFieldProps.SelectProps, - // Must have this set to prevent MUI transforming `value` - // prop for this component to a comma-separated string - multiple: true, - MenuProps: { - classes: { paper: classes.paper, list: classes.menuChild }, - MenuListProps: { disablePadding: true }, - getContentAnchorEl: null, - anchorOrigin: { vertical: "bottom", horizontal: "center" }, - transformOrigin: { vertical: "top", horizontal: "center" }, - ...TextFieldProps.SelectProps?.MenuProps, - }, - }} - ref={(el) => { - if (!el) return; - const width = el.getBoundingClientRect().width; - if (dropdownWidth < width) setDropdownWidth(width); - }} - > -
- -
-
- ); -} diff --git a/www/src/components/MultiSelect/styles.ts b/www/src/components/MultiSelect/styles.ts deleted file mode 100644 index 7cd23e89..00000000 --- a/www/src/components/MultiSelect/styles.ts +++ /dev/null @@ -1,99 +0,0 @@ -import { makeStyles, createStyles } from "@material-ui/core"; - -interface StylesProps { - searchable: boolean; - freeText: boolean; - multiple: boolean; - width?: number; -} - -export const useStyles = makeStyles(theme => - createStyles({ - root: { minWidth: 200 }, - selectRoot: { paddingRight: theme.spacing(4) }, - - paper: { overflow: "hidden", maxHeight: "calc(100% - 48px)" }, - popupContentsWrapper: { outline: 0 }, - menuChild: { - padding: `0 ${theme.spacing(2)}px`, - width: ({ width }: StylesProps) => width || 480, - maxWidth: `calc(100vw - ${theme.spacing(4)}px)`, - minWidth: 300, - }, - - noMargins: { margin: 0 }, - - searchRow: { marginTop: theme.spacing(2) }, - - chipListRow: { - background: `${theme.palette.background.paper} no-repeat`, - backgroundImage: - "linear-gradient(to bottom, rgba(255,255,255,1), rgba(255,255,255,0)), linear-gradient(to top, rgba(255,255,255,1), rgba(255,255,255,0))", - backgroundPosition: `-12px 0, -24px 100%`, - backgroundSize: `calc(100% + 12px + 12px) 16px`, - - position: "relative", - - "&::before, &::after": { - content: '""', - position: "absolute", - top: 0, - left: 0, - right: 0, - zIndex: 9, - - display: "block", - height: 16, - - background: `linear-gradient(to bottom, #fff, rgba(255, 255, 255, 0))`, - }, - - "&::after": { - top: "auto", - bottom: 0, - background: `linear-gradient(to top, #fff, rgba(255, 255, 255, 0))`, - }, - }, - chipList: ({ searchable, freeText, multiple }: StylesProps) => { - let maxHeightDeductions = 0; - if (searchable) maxHeightDeductions -= 64; - if (multiple) maxHeightDeductions -= 48; - if (freeText) maxHeightDeductions -= 48; - if (freeText && !multiple) maxHeightDeductions -= theme.spacing(2); - - return { - margin: `0px -${theme.spacing(2)}px`, - padding: `12px ${theme.spacing(2) - theme.spacing(0.5)}px`, - overflowY: "auto" as "auto", - maxHeight: `calc(100vh - 48px - ${-maxHeightDeductions}px)`, - }; - }, - chip: { - margin: theme.spacing(0.5), - // Allow multi-line chip - maxWidth: `calc(100% - ${theme.spacing(1)}px)`, - }, - selectedChip: { backgroundColor: theme.palette.divider }, - - footerRow: { marginBottom: theme.spacing(2) }, - addCustomButton: { marginLeft: -theme.spacing(1) }, - selectedRow: { - "$chipListRow + &": { marginTop: -theme.spacing(1) }, - "$footerRow + &": { marginTop: -theme.spacing(2) }, - - marginBottom: 0, - "& > div": { height: 48 }, - }, - selectAllButton: { marginRight: -theme.spacing(1) }, - selectedNum: { fontFeatureSettings: '"tnum"' }, - - measureChip: { - visibility: "hidden", - position: "absolute", - top: 0, - left: 0, - }, - }) -); - -export default useStyles; diff --git a/www/src/components/SideDrawer/Form/Fields/MultiSelect.tsx b/www/src/components/SideDrawer/Form/Fields/MultiSelect.tsx index b20601d9..c67f7f12 100644 --- a/www/src/components/SideDrawer/Form/Fields/MultiSelect.tsx +++ b/www/src/components/SideDrawer/Form/Fields/MultiSelect.tsx @@ -3,9 +3,7 @@ import { FieldProps } from "formik"; import { useTheme, Grid } from "@material-ui/core"; -import MultiSelect_, { - IMultiSelectProps as IMultiSelectProps_, -} from "components/MultiSelect"; +import MultiSelect_, { MultiSelectProps } from "@antlerengineering/multiselect"; import FormattedChip from "components/FormattedChip"; export default function MultiSelect({ @@ -13,22 +11,24 @@ export default function MultiSelect({ form, editable, ...props -}: FieldProps & IMultiSelectProps_) { +}: FieldProps & MultiSelectProps & { editable?: boolean }) { const theme = useTheme(); + const handleDelete = (index: number) => () => { const newValues = [...field.value]; newValues.splice(index, 1); form.setFieldValue(field.name, newValues); }; + return ( <> form.setFieldValue(field.name, value)} + disabled={editable === false} TextFieldProps={{ - disabled: editable === false, - fullWidth: true, label: "", hiddenLabel: true, error: !!(form.touched[field.name] && form.errors[field.name]), diff --git a/www/src/components/SideDrawer/Form/Fields/SingleSelect.tsx b/www/src/components/SideDrawer/Form/Fields/SingleSelect.tsx index 1a39e35e..b45b377f 100644 --- a/www/src/components/SideDrawer/Form/Fields/SingleSelect.tsx +++ b/www/src/components/SideDrawer/Form/Fields/SingleSelect.tsx @@ -3,7 +3,7 @@ import { FieldProps } from "formik"; import { useTheme } from "@material-ui/core"; -import MultiSelect, { IMultiSelectProps } from "components/MultiSelect"; +import MultiSelect, { MultiSelectProps } from "@antlerengineering/multiselect"; import FormattedChip from "components/FormattedChip"; /** @@ -13,22 +13,22 @@ import FormattedChip from "components/FormattedChip"; export default function SingleSelect({ field, form, + editable, ...props -}: FieldProps & IMultiSelectProps) { +}: FieldProps & MultiSelectProps & { editable: boolean }) { const theme = useTheme(); - const value = ([field.value] as unknown) as string[]; - const handleChange = value => - form.setFieldValue(field.name, value.join(", ")); + const handleChange = value => form.setFieldValue(field.name, value); return ( <> form.setFieldTouched(field.name), }} searchable - freeText - multiple={false} + freeText={false} /> {field.value?.length > 0 && ( diff --git a/www/src/components/Table/Filters/DocSelector.tsx b/www/src/components/Table/Filters/DocSelector.tsx index 56caddd8..fb8dbd97 100644 --- a/www/src/components/Table/Filters/DocSelector.tsx +++ b/www/src/components/Table/Filters/DocSelector.tsx @@ -1,13 +1,7 @@ import React, { useState, useEffect } from "react"; import useAlgolia from "hooks/useAlgolia"; -import { createStyles, makeStyles } from "@material-ui/core"; -import MultiSelect from "components/MultiSelect"; -const useStyles = makeStyles(theme => - createStyles({ - root: { minWidth: 200 }, - }) -); +import MultiSelect from "@antlerengineering/multiselect"; const AlgoliaSelect = (props: any) => { const { @@ -17,11 +11,7 @@ const AlgoliaSelect = (props: any) => { labelReducer, filters, } = props; - const [searchState, searchDispatch] = useAlgolia( - algoliaIndex, - algoliaKey, - filters - ); + const [searchState] = useAlgolia(algoliaIndex, algoliaKey, filters); console.log(filters); const [options, setOptions] = useState([]); @@ -40,6 +30,7 @@ const AlgoliaSelect = (props: any) => { return ( 10} //shows type to filter after 10 options diff --git a/www/src/components/Table/Filters/index.tsx b/www/src/components/Table/Filters/index.tsx index a993e6da..5a62f7c0 100644 --- a/www/src/components/Table/Filters/index.tsx +++ b/www/src/components/Table/Filters/index.tsx @@ -18,7 +18,7 @@ import { import FilterIcon from "@material-ui/icons/FilterList"; import CloseIcon from "@material-ui/icons/Close"; -import MultiSelect from "components/MultiSelect"; +import MultiSelect from "@antlerengineering/multiselect"; import { FieldType } from "constants/fields"; import { FireTableFilter } from "hooks/useFiretable"; @@ -207,32 +207,36 @@ const Filters = ({ columns, setFilters }: any) => { ); case FieldType.singleSelect: - const val = query?.value - ? Array.isArray(query.value) - ? query.value - : [query.value as string] - : []; + if (operator === "in") + return ( + setQuery(query => ({ ...query, value }))} + options={selectedColumn.options} + label="" + value={Array.isArray(query?.value) ? query.value : []} + TextFieldProps={{ hiddenLabel: true }} + /> + ); return ( { - if (operator === "==") - setQuery(query => ({ ...query, value: value[0] })); - else setQuery(query => ({ ...query, value })); + if (value !== null) setQuery(query => ({ ...query, value })); }} options={selectedColumn.options} label="" - value={val} - multiple={operator === "in"} + value={typeof query?.value === "string" ? query.value : null} TextFieldProps={{ hiddenLabel: true }} /> ); + case FieldType.multiSelect: return ( { - setQuery(query => ({ ...query, value })); - }} + multiple + onChange={value => setQuery(query => ({ ...query, value }))} value={query.value as string[]} options={selectedColumn.options} label={""} diff --git a/www/src/components/Table/formatters/MultiSelect.tsx b/www/src/components/Table/formatters/MultiSelect.tsx index e38cb702..d5757874 100644 --- a/www/src/components/Table/formatters/MultiSelect.tsx +++ b/www/src/components/Table/formatters/MultiSelect.tsx @@ -4,43 +4,48 @@ import { CustomCellProps } from "./withCustomCell"; import { makeStyles, createStyles, Grid } from "@material-ui/core"; -import MultiSelect_ from "components/MultiSelect"; -import FormattedChip from "components/FormattedChip"; +import MultiSelect_ from "@antlerengineering/multiselect"; +import FormattedChip, { VARIANTS } from "components/FormattedChip"; import { FieldType } from "constants/fields"; import { useFiretableContext } from "contexts/firetableContext"; -const useStyles = makeStyles((theme) => +const useStyles = makeStyles(theme => createStyles({ root: { - minWidth: 0, - position: "absolute", top: 0, right: 0, bottom: 0, left: 0, }, - fullHeight: { + + inputBase: { height: "100%", font: "inherit", - color: "inherit", + color: "inherit !important", letterSpacing: "inherit", }, select: { - padding: theme.spacing(0, 3, 0, 1.5), + height: "100%", display: "flex", alignItems: "center", - + whiteSpace: "pre-line", + padding: theme.spacing(0, 4, 0, 1.5), "&&": { paddingRight: theme.spacing(4) }, }, - icon: { marginRight: theme.spacing(1) }, + selectSingleLabel: { + maxHeight: "100%", + overflow: "hidden", + }, + icon: { right: theme.spacing(1) }, chipList: { overflowX: "hidden", width: "100%", }, chip: { cursor: "inherit" }, + chipLabel: { whiteSpace: "nowrap" }, }) ); @@ -58,71 +63,70 @@ export default function MultiSelect({ // Support SingleSelect field const isSingle = (column as any).type === FieldType.singleSelect; - // If SingleSelect, transform string to array of strings - const transformedValue = isSingle - ? (([value] as unknown) as string[]) - : value; - // And support transforming array of strings back to string - const handleChange = (value) => onSubmit(isSingle ? value.join(", ") : value); + // Render chips or basic string + const renderValue = isSingle + ? () => + typeof value === "string" && VARIANTS.includes(value.toLowerCase()) ? ( + + ) : ( + {value} + ) + : () => ( + + {value?.map( + item => + typeof item === "string" && ( + + + + ) + )} + + ); - // Render chips - const renderValue = (value) => { - //if (Array.isArray(value)) - return ( - - {value?.map( - (item) => - typeof item === "string" && ( - - - - ) - )} - - ); - // else - }; - - const onClick = (e) => e.stopPropagation(); - const onClose = () => { + const handleOpen = () => { if (dataGridRef?.current?.selectCell) dataGridRef.current.selectCell({ rowIdx, idx: column.idx }); }; return ( ); } diff --git a/www/yarn.lock b/www/yarn.lock index 9247740e..5f509f0f 100644 --- a/www/yarn.lock +++ b/www/yarn.lock @@ -106,6 +106,11 @@ "@algolia/logger-common" "4.1.0" "@algolia/requester-common" "4.1.0" +"@antlerengineering/multiselect@^0.3.9": + version "0.3.9" + resolved "https://registry.yarnpkg.com/@antlerengineering/multiselect/-/multiselect-0.3.9.tgz#a368c8b26227c37c80ac225d0007a999b0242997" + integrity sha512-lSWjuiESiM4GgjSVF0eqWvVrSxQcFMB9dlO5stM21NtAH4UNnoTtEolKdfGataA3CPCEM3lFxSagiC3is2bK+Q== + "@babel/code-frame@7.8.3", "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.8.3.tgz#33e25903d7481181534e12ec0a25f16b6fcf419e" @@ -1555,7 +1560,7 @@ "@babel/traverse" "^7.6.2" jscodeshift-add-imports "^1.0.1" -"@material-ui/core@^4.7.1", "@material-ui/core@^4.9.4": +"@material-ui/core@^4.7.1": version "4.9.7" resolved "https://registry.yarnpkg.com/@material-ui/core/-/core-4.9.7.tgz#0c1caf123278770f34c5d8e9ecd9e1314f87a621" integrity sha512-RTRibZgq572GHEskMAG4sP+bt3P3XyIkv3pOTR8grZAW2rSUd6JoGZLRM4S2HkuO7wS7cAU5SpU2s1EsmTgWog== @@ -1573,6 +1578,25 @@ react-is "^16.8.0" react-transition-group "^4.3.0" +"@material-ui/core@^4.9.13": + version "4.9.13" + resolved "https://registry.yarnpkg.com/@material-ui/core/-/core-4.9.13.tgz#024962bcdda05139e1bad17a1815bf4088702b15" + integrity sha512-GEXNwUr+laZ0N+F1efmHB64Fyg+uQIRXLqbSejg3ebSXgLYNpIjnMOPRfWdu4rICq0dAIgvvNXGkKDMcf3AMpA== + dependencies: + "@babel/runtime" "^7.4.4" + "@material-ui/react-transition-group" "^4.3.0" + "@material-ui/styles" "^4.9.13" + "@material-ui/system" "^4.9.13" + "@material-ui/types" "^5.0.1" + "@material-ui/utils" "^4.9.12" + "@types/react-transition-group" "^4.2.0" + clsx "^1.0.4" + hoist-non-react-statics "^3.3.2" + popper.js "^1.16.1-lts" + prop-types "^15.7.2" + react-is "^16.8.0" + react-transition-group "^4.3.0" + "@material-ui/icons@^4.5.1", "@material-ui/icons@^4.9.1": version "4.9.1" resolved "https://registry.yarnpkg.com/@material-ui/icons/-/icons-4.9.1.tgz#fdeadf8cb3d89208945b33dbc50c7c616d0bd665" @@ -1580,10 +1604,10 @@ dependencies: "@babel/runtime" "^7.4.4" -"@material-ui/lab@^4.0.0-alpha.44": - version "4.0.0-alpha.46" - resolved "https://registry.yarnpkg.com/@material-ui/lab/-/lab-4.0.0-alpha.46.tgz#453546d58d3a0064263c198dedb6a1c54d24d1a4" - integrity sha512-JGgZmj1UNP8bbYNAGvndipjXRK3x2+9mFBzbX7MyCj+WpfnJbeqTmJK2No9MXvPj/EZJ1piaKif46FdDc4U93A== +"@material-ui/lab@^4.0.0-alpha.52": + version "4.0.0-alpha.52" + resolved "https://registry.yarnpkg.com/@material-ui/lab/-/lab-4.0.0-alpha.52.tgz#a868d8c772a90db091a6bfc89aed21a0e2c486bf" + integrity sha512-aDoRWA+q3/T2spvvQrxPz8qjtf9l8NhaG9ZISBy9zD3cJ05s3KfEP2nrsoBOBgonlSMFQQzUTnxAwThwsJfllw== dependencies: "@babel/runtime" "^7.4.4" "@material-ui/utils" "^4.9.6" @@ -1603,6 +1627,38 @@ react-transition-group "^4.0.0" rifm "^0.7.0" +"@material-ui/react-transition-group@^4.3.0": + version "4.3.0" + resolved "https://registry.yarnpkg.com/@material-ui/react-transition-group/-/react-transition-group-4.3.0.tgz#92529142addb5cc179dbf42d246c7e3fe4d6104b" + integrity sha512-CwQ0aXrlUynUTY6sh3UvKuvye1o92en20VGAs6TORnSxUYeRmkX8YeTUN3lAkGiBX1z222FxLFO36WWh6q73rQ== + dependencies: + "@babel/runtime" "^7.5.5" + dom-helpers "^5.0.1" + loose-envify "^1.4.0" + prop-types "^15.6.2" + +"@material-ui/styles@^4.9.13": + version "4.9.13" + resolved "https://registry.yarnpkg.com/@material-ui/styles/-/styles-4.9.13.tgz#08b3976bdd21c38bc076693d95834f97539f3b15" + integrity sha512-lWlXJanBdHQ18jW/yphedRokHcvZD1GdGzUF/wQxKDsHwDDfO45ZkAxuSBI202dG+r1Ph483Z3pFykO2obeSRA== + dependencies: + "@babel/runtime" "^7.4.4" + "@emotion/hash" "^0.8.0" + "@material-ui/types" "^5.0.1" + "@material-ui/utils" "^4.9.6" + clsx "^1.0.4" + csstype "^2.5.2" + hoist-non-react-statics "^3.3.2" + jss "^10.0.3" + jss-plugin-camel-case "^10.0.3" + jss-plugin-default-unit "^10.0.3" + jss-plugin-global "^10.0.3" + jss-plugin-nested "^10.0.3" + jss-plugin-props-sort "^10.0.3" + jss-plugin-rule-value-function "^10.0.3" + jss-plugin-vendor-prefixer "^10.0.3" + prop-types "^15.7.2" + "@material-ui/styles@^4.9.6": version "4.9.6" resolved "https://registry.yarnpkg.com/@material-ui/styles/-/styles-4.9.6.tgz#924a30bf7c9b91af9c8f19c12c8573b8a4ecd085" @@ -1625,6 +1681,15 @@ jss-plugin-vendor-prefixer "^10.0.3" prop-types "^15.7.2" +"@material-ui/system@^4.9.13": + version "4.9.13" + resolved "https://registry.yarnpkg.com/@material-ui/system/-/system-4.9.13.tgz#adefb3b6a5ddf0b00fe4e82ac63bb48276e9749d" + integrity sha512-6AlpvdW6KJJ5bF1Xo2OD13sCN8k+nlL36412/bWnWZOKIfIMo/Lb8c8d1DOIaT/RKWxTEUaWnKZjabVnA3eZjA== + dependencies: + "@babel/runtime" "^7.4.4" + "@material-ui/utils" "^4.9.6" + prop-types "^15.7.2" + "@material-ui/system@^4.9.6": version "4.9.6" resolved "https://registry.yarnpkg.com/@material-ui/system/-/system-4.9.6.tgz#fd060540224da4d1740da8ca6e7af288e217717e" @@ -1639,6 +1704,20 @@ resolved "https://registry.yarnpkg.com/@material-ui/types/-/types-5.0.0.tgz#26d6259dc6b39f4c2e1e9aceff7a11e031941741" integrity sha512-UeH2BuKkwDndtMSS0qgx1kCzSMw+ydtj0xx/XbFtxNSTlXydKwzs5gVW5ZKsFlAkwoOOQ9TIsyoCC8hq18tOwg== +"@material-ui/types@^5.0.1": + version "5.0.1" + resolved "https://registry.yarnpkg.com/@material-ui/types/-/types-5.0.1.tgz#c4954063cdc196eb327ee62c041368b1aebb6d61" + integrity sha512-wURPSY7/3+MAtng3i26g+WKwwNE3HEeqa/trDBR5+zWKmcjO+u9t7Npu/J1r+3dmIa/OeziN9D/18IrBKvKffw== + +"@material-ui/utils@^4.9.12": + version "4.9.12" + resolved "https://registry.yarnpkg.com/@material-ui/utils/-/utils-4.9.12.tgz#0d639f1c1ed83fffb2ae10c21d15a938795d9e65" + integrity sha512-/0rgZPEOcZq5CFA4+4n6Q6zk7fi8skHhH2Bcra8R3epoJEYy5PL55LuMazPtPH1oKeRausDV/Omz4BbgFsn1HQ== + dependencies: + "@babel/runtime" "^7.4.4" + prop-types "^15.7.2" + react-is "^16.8.0" + "@material-ui/utils@^4.9.6": version "4.9.6" resolved "https://registry.yarnpkg.com/@material-ui/utils/-/utils-4.9.6.tgz#5f1f9f6e4df9c8b6a263293b68c94834248ff157" @@ -10643,7 +10722,7 @@ pnp-webpack-plugin@1.6.0: dependencies: ts-pnp "^1.1.2" -popper.js@^1.14.1: +popper.js@^1.14.1, popper.js@^1.16.1-lts: version "1.16.1" resolved "https://registry.yarnpkg.com/popper.js/-/popper.js-1.16.1.tgz#2a223cb3dc7b6213d740e40372be40de43e65b1b" integrity sha512-Wb4p1J4zyFTbM+u6WuO4XstYx4Ky9Cewe4DWrel7B0w6VVICvPwdOpotjzcf6eD8TsckVnIMNONQyPIUFOUbCQ== From 17a827a16ca75963f2ada0c9dfb9bb27af3ce303 Mon Sep 17 00:00:00 2001 From: Sidney Alcantara Date: Wed, 6 May 2020 16:28:19 +1000 Subject: [PATCH 34/38] commit .env.development --- .gitignore | 2 +- www/.env.development.enc | Bin 0 -> 381 bytes 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 www/.env.development.enc diff --git a/.gitignore b/.gitignore index 0a43fb37..b5dce173 100644 --- a/.gitignore +++ b/.gitignore @@ -26,7 +26,7 @@ cloud_functions/functions/firebase-credentials.json .DS_Store .env* !.env.example -!.env.enc +!*.enc npm-debug.log* yarn-debug.log* diff --git a/www/.env.development.enc b/www/.env.development.enc new file mode 100644 index 0000000000000000000000000000000000000000..2f391de0784780b70dd037395747e1a064b68daf GIT binary patch literal 381 zcmV-@0fPPtBmiwq7aV+>tX(n{MPqHukj!x2#m`1;*4tsEZG3471o%XhixSiV0MJOW z%h#bO0l<{k9cb*SBi)7~?KFDd>H8kzNYPcZ;ZCl!1(G=`8&ze3jqpe$JloS`nlX^d zbjfC))?4U}TA3xfJqCEE4b)|7y^<%aJo4#KA=H&Oe7|mND9>1GUC8Qn3NlA^XfJa5 z1`^=GRi6xA{*GDK?@02jatFJkuI`aHgE^CD=ok2~d^?dtCXd<0FF}Be2FLZ0P=lj2 zr0gXDT|_FN3Qq#cXxeZx;!5pBlY z#spGPCGhLKTLUM{j>i$S(+M*-pbPJEv~tziPkbtyt}Sb~NB3X`VSVe!`x bo5O%U9G!~+7SC#Wk{d$0WJV_~njQ?HWtqBa literal 0 HcmV?d00001 From 0d0f0602f7035ffd1a46cd23489386c779fddf8e Mon Sep 17 00:00:00 2001 From: Shams mosowi Date: Sat, 9 May 2020 16:48:27 +0800 Subject: [PATCH 35/38] remove and gitIgnore .firebaserc file --- .gitignore | 6 ++++++ cloud_functions/.firebaserc | 5 ----- 2 files changed, 6 insertions(+), 5 deletions(-) delete mode 100644 cloud_functions/.firebaserc diff --git a/.gitignore b/.gitignore index b5dce173..b74c7e93 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ # dependencies /node_modules www/node_modules +www/.firebaserc + Firetable/node_modules cloud_functions/functions/node_modules /.pnp @@ -21,6 +23,7 @@ cloud_functions/functions/src/collectionSync/config.json cloud_functions/functions/src/history/config.json cloud_functions/functions/src/algolia/config.json cloud_functions/functions/firebase-credentials.json +cloud_functions/.firebaserc # misc .DS_Store @@ -31,6 +34,9 @@ cloud_functions/functions/firebase-credentials.json npm-debug.log* yarn-debug.log* yarn-error.log* +firebase-debug.log* + + # Accidental package installs to root directories yarn.lock diff --git a/cloud_functions/.firebaserc b/cloud_functions/.firebaserc deleted file mode 100644 index 3b961cb8..00000000 --- a/cloud_functions/.firebaserc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "projects": { - "default":"antler-vc" - } -} From 9b20f666a49bef1104813b401f607a7942aecdda Mon Sep 17 00:00:00 2001 From: Shams mosowi Date: Sat, 9 May 2020 16:51:09 +0800 Subject: [PATCH 36/38] remove project id from deploy command --- cloud_functions/functions/.env.enc | Bin 226 -> 0 bytes cloud_functions/functions/package.json | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 cloud_functions/functions/.env.enc diff --git a/cloud_functions/functions/.env.enc b/cloud_functions/functions/.env.enc deleted file mode 100644 index a53c990acad46e27c7501dfc58aec55b3f0e427d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 226 zcmV<803H7dBmiwq7aURB|3)PGzqfZ_z3rWlBOSMnMLXO42j*ypQ|@<;OA@&O0MJOW z%ZoqgK2WPpai36kMBI?-p^w@>?VhYqmNZnu(}c~tMdejx$(f2-p&;J8N0W~ajjc7C zhq7o+L4X*C$V{kzae|4#cR%Nd8DMDlr=dd5cGv;j{>|-UG9TU Date: Mon, 11 May 2020 11:55:18 +0800 Subject: [PATCH 37/38] move snapshotSync config to firestore --- .gitignore | 2 + cloud_functions/functions/fetchConfig.ts | 4 ++ .../functions/src/snapshotSync/config.json | 58 ------------------- 3 files changed, 6 insertions(+), 58 deletions(-) delete mode 100644 cloud_functions/functions/src/snapshotSync/config.json diff --git a/.gitignore b/.gitignore index b74c7e93..1696b419 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,8 @@ cloud_functions/functions/lib cloud_functions/functions/src/collectionSync/config.json cloud_functions/functions/src/history/config.json cloud_functions/functions/src/algolia/config.json +cloud_functions/functions/src/snapshotSync/config.json + cloud_functions/functions/firebase-credentials.json cloud_functions/.firebaserc diff --git a/cloud_functions/functions/fetchConfig.ts b/cloud_functions/functions/fetchConfig.ts index 4d1a53e0..4a6cf129 100644 --- a/cloud_functions/functions/fetchConfig.ts +++ b/cloud_functions/functions/fetchConfig.ts @@ -33,6 +33,10 @@ const main = async () => { "_FIRETABLE_/_SETTINGS_/_CONFIG_/_COLLECTION_SYNC_", "./src/collectionSync/config.json" ); + await docConfig2json( + "_FIRETABLE_/_SETTINGS_/_CONFIG_/_SNAPSHOT_SYNC_", + "./src/snapshotSync/config.json" + ); return true; }; diff --git a/cloud_functions/functions/src/snapshotSync/config.json b/cloud_functions/functions/src/snapshotSync/config.json deleted file mode 100644 index 21587397..00000000 --- a/cloud_functions/functions/src/snapshotSync/config.json +++ /dev/null @@ -1,58 +0,0 @@ -[ - { - "source": "teams", - "onUpdate": true, - "target": "teams/{{id}}/dueDiligence", - "targetType": "subCollection", - "snapshotField": "team", - "isArray": false, - "fieldsToSync": [ - "cohort", - "teamName", - "trackOutDate", - "teamMembers", - "focusArea", - "isDissolved", - "oneLineDescription", - "documents", - "longDescription", - "shortPitchDeck", - "logo", - "problem", - "model", - "geography", - "targetCustomer", - "marketSize", - "competitors", - "innovation", - "gtm", - "defensibility" - ] - }, - { - "fnName": "foundersDoc2myTeam", - "source": "founders", - "target": "{{team.docPath}}", - "targetType": "document", - "snapshotField": "teamMembers", - "isArray": true, - "onUpdate": true, - "fieldsToSync": [ - "firstName", - "lastName", - "title", - "preferredName", - "personalBio", - "founderType", - "founderBio", - "cohort", - "email", - "profilePhoto", - "twitter", - "employerLogos", - "linkedin", - "publicProfile", - "companies" - ] - } -] From 57fb561eeff1e99633a414038aec077c70c7cdb1 Mon Sep 17 00:00:00 2001 From: Shams mosowi Date: Mon, 11 May 2020 13:05:02 +0800 Subject: [PATCH 38/38] grid view POC --- fireform | 1 + www/package.json | 2 + www/src/App.tsx | 9 +- www/src/components/Grid/AlgoliaFilters.tsx | 237 ++++++++++++++++++++ www/src/components/Grid/Card/index.tsx | 249 +++++++++++++++++++++ www/src/components/Grid/Card/styles.ts | 58 +++++ www/src/components/Grid/index.tsx | 83 +++++++ www/src/constants/routes.ts | 2 + www/src/views/GridView.tsx | 39 ++++ www/yarn.lock | 21 +- 10 files changed, 699 insertions(+), 2 deletions(-) create mode 160000 fireform create mode 100644 www/src/components/Grid/AlgoliaFilters.tsx create mode 100644 www/src/components/Grid/Card/index.tsx create mode 100644 www/src/components/Grid/Card/styles.ts create mode 100644 www/src/components/Grid/index.tsx create mode 100644 www/src/views/GridView.tsx diff --git a/fireform b/fireform new file mode 160000 index 00000000..dd6aa49a --- /dev/null +++ b/fireform @@ -0,0 +1 @@ +Subproject commit dd6aa49a10806386d1192a94ef4b52bce8069a91 diff --git a/www/package.json b/www/package.json index e6029de2..dd4e9937 100644 --- a/www/package.json +++ b/www/package.json @@ -3,6 +3,7 @@ "version": "0.1.0", "private": true, "dependencies": { + "@antlerengineering/components": "^0.2.7", "@antlerengineering/multiselect": "^0.3.9", "@date-io/date-fns": "1.x", "@material-ui/core": "^4.9.13", @@ -52,6 +53,7 @@ "react-scripts": "^3.3.0", "tinymce": "^5.2.0", "typescript": "^3.7.2", + "use-algolia": "^1.3.0", "use-debounce": "^3.3.0", "use-persisted-state": "^0.3.0", "yarn": "^1.19.0", diff --git a/www/src/App.tsx b/www/src/App.tsx index 28526059..75a0d704 100644 --- a/www/src/App.tsx +++ b/www/src/App.tsx @@ -26,6 +26,9 @@ import SignOutView from "views/SignOutView"; const TableView = lazy(() => import("./views/TableView" /* webpackChunkName: "TableView" */) ); +const GridView = lazy(() => + import("./views/GridView" /* webpackChunkName: "GridView" */) +); const TablesView = lazy(() => import("./views/TablesView" /* webpackChunkName: "TablesView" */) ); @@ -52,7 +55,7 @@ const App: React.FC = () => { ( @@ -65,6 +68,10 @@ const App: React.FC = () => { path={routes.tableWithId} render={() => } /> + } + /> )} diff --git a/www/src/components/Grid/AlgoliaFilters.tsx b/www/src/components/Grid/AlgoliaFilters.tsx new file mode 100644 index 00000000..b4c1300d --- /dev/null +++ b/www/src/components/Grid/AlgoliaFilters.tsx @@ -0,0 +1,237 @@ +import React, { useState, useEffect } from "react"; +import { SearchIndex } from "algoliasearch/lite"; +import { FacetHit } from "@algolia/client-search"; +import useAlgolia from "use-algolia"; +import { useDebouncedCallback } from "use-debounce"; + +import { + makeStyles, + createStyles, + Grid, + Typography, + Button, + TextField, + InputAdornment, + ListItemSecondaryAction, +} from "@material-ui/core"; +import SearchIcon from "@material-ui/icons/Search"; + +import MultiSelect from "@antlerengineering/multiselect"; + +const useStyles = makeStyles(theme => + createStyles({ + resetFilters: { marginRight: -theme.spacing(1) }, + + filterGrid: { + marginTop: 0, + marginBottom: theme.spacing(3), + }, + + listItemText: { whiteSpace: "pre-line" }, + count: { + position: "static", + marginLeft: "auto", + paddingLeft: theme.spacing(1.5), + transform: "none", + color: theme.palette.text.disabled, + }, + }) +); + +/** + * Generates the string to dispatch as filters for the query + * @param filterValues The user-selected filters + * @param requiredFilters Filters not selected by the user + */ +const generateFiltersString = ( + filterValues: Record, + requiredFilters?: string +) => { + if (Object.keys(filterValues).length === 0) return null; + + let filtersString = Object.entries(filterValues) + .filter(([, values]) => values.length > 0) + .map( + ([facet, values]) => + `(${values + .map(value => `${facet}:"${value.replace(/"/g, '\\"')}"`) + .join(" OR ")})` + ) + .join(" AND "); + + if (requiredFilters) { + if (filtersString) + filtersString = requiredFilters + " AND " + filtersString; + else filtersString = requiredFilters; + } + + return filtersString; +}; + +export interface IAlgoliaFiltersProps { + index: SearchIndex; + request: ReturnType[0]["request"]; + requestDispatch: ReturnType[1]; + requiredFilters?: string; + label: string; + filters: { + label: string; + facet: string; + labelTransformer?: (value: string) => string; + }[]; + search?: boolean; +} + +export default function AlgoliaFilters({ + index, + request, + requestDispatch, + requiredFilters, + label, + filters, + search = true, +}: IAlgoliaFiltersProps) { + const classes = useStyles(); + + // Store filter values + const [filterValues, setFilterValues] = useState>( + {} + ); + // Push filter values to dispatch + useEffect(() => { + const filtersString = generateFiltersString(filterValues, requiredFilters); + if (filtersString === null) return; + requestDispatch({ filters: filtersString }); + }, [filterValues]); + + // Store facet values + const [facetValues, setFacetValues] = useState< + Record + >({}); + // Get facet values + useEffect(() => { + if (!index) return; + + filters.forEach(filter => { + const params = { ...request, maxFacetHits: 100 }; + // Ignore current user-selected value for these filters so all options + // continue to show up + params.filters = + generateFiltersString( + { ...filterValues, [filter.facet]: [] }, + requiredFilters + ) ?? ""; + + index + .searchForFacetValues(filter.facet, "", params) + .then(({ facetHits }) => + setFacetValues(other => ({ ...other, [filter.facet]: facetHits })) + ); + }); + }, [filters, index, filterValues, requiredFilters]); + + // Reset filters + const handleResetFilters = () => { + setFilterValues({}); + setQuery(""); + requestDispatch({ filters: requiredFilters ?? "", query: "" }); + }; + + // Store search query + const [query, setQuery] = useState(""); + const [handleQueryChange] = useDebouncedCallback( + (query: string) => requestDispatch({ query }), + 500 + ); + + return ( +
+ + + + Filter{label ? " " + label : "s"} + + + + + + + + + + {search && ( + + { + setQuery(e.target.value); + handleQueryChange(e.target.value); + }} + variant="filled" + type="search" + InputProps={{ + startAdornment: ( + + + + ), + }} + aria-label={`Search${label ? " " + label : ""}`} + placeholder={`Search${label ? " " + label : ""}`} + hiddenLabel + fullWidth + /> + + )} + + {filters.map(filter => ( + + + setFilterValues(other => ({ ...other, [filter.facet]: value })) + } + options={ + facetValues[filter.facet]?.map(item => ({ + value: item.value, + label: filter.labelTransformer + ? filter.labelTransformer(item.value) + : item.value, + count: item.count, + })) ?? [] + } + itemRenderer={option => ( + + {option.label} + + + {(option as any).count} + + + + )} + searchable={facetValues[filter.facet]?.length > 10} + /> + + ))} + +
+ ); +} diff --git a/www/src/components/Grid/Card/index.tsx b/www/src/components/Grid/Card/index.tsx new file mode 100644 index 00000000..e0b3e710 --- /dev/null +++ b/www/src/components/Grid/Card/index.tsx @@ -0,0 +1,249 @@ +import React, { useState } from "react"; +import clsx from "clsx"; + +import { + Card, + Grid, + Typography, + Button, + CardActions, + CardContent, + CardMedia, + Divider, + Tabs, + Tab, +} from "@material-ui/core"; +import { ButtonProps } from "@material-ui/core/Button"; +import { GoIcon } from "@antlerengineering/components"; + +import useStyles from "./styles"; +export interface ICardProps { + className?: string; + style?: React.CSSProperties; + + overline?: React.ReactNode; + title?: React.ReactNode; + imageSource?: string; + imageShape?: "square" | "circle"; + imageClassName?: string; + + tabs?: { + label: string; + content: React.ReactNode; + disabled?: boolean; + }[]; + bodyContent?: React.ReactNode; + + primaryButton?: { label: string } & Partial; + primaryLink?: { + href?: string; + target?: string; + rel?: string; + label: string; + } & Partial; + secondaryAction?: React.ReactNode; +} + +const a11yProps = (index: number) => ({ + id: `full-width-tab-${index}`, + "aria-controls": `full-width-tabpanel-${index}`, +}); + +export default function BasicCard({ + className, + style, + + overline, + title, + imageSource, + imageShape = "square", + imageClassName, + + tabs, + bodyContent, + + primaryButton, + primaryLink, + secondaryAction, +}: ICardProps) { + const classes = useStyles(); + + const [tab, setTab] = useState(0); + + const handleChangeTab = (event: React.ChangeEvent<{}>, newValue: number) => + setTab(newValue); + + return ( + + + + + + {(overline || title || imageSource) && ( + + + + {overline && ( + + {overline} + + )} + {title && ( + + {title} + + )} + + + {imageSource && ( + + + + )} + + + )} + + {tabs && ( + + + {tabs?.map((tab, index) => ( + + ))} + + + + )} + + {(tabs || bodyContent) && ( + + {tabs && ( +
+ {tabs[tab].content && Array.isArray(tabs[tab].content) ? ( + + {(tabs[tab].content as React.ReactNode[]).map( + (element, index) => ( + + {element} + + ) + )} + + ) : ( + tabs[tab].content + )} +
+ )} + + {bodyContent && Array.isArray(bodyContent) ? ( + + {bodyContent.map((element, i) => ( + + {element} + + ))} + + ) : ( + bodyContent + )} +
+ )} +
+
+
+ + {(primaryButton || primaryLink || secondaryAction) && ( + + + + + {primaryButton && ( + + )} + {primaryLink && ( + + )} + + {secondaryAction && {secondaryAction}} + + + )} +
+
+ ); +} diff --git a/www/src/components/Grid/Card/styles.ts b/www/src/components/Grid/Card/styles.ts new file mode 100644 index 00000000..32483b74 --- /dev/null +++ b/www/src/components/Grid/Card/styles.ts @@ -0,0 +1,58 @@ +import { makeStyles, createStyles } from "@material-ui/core/styles"; + +const useStyles = makeStyles(theme => + createStyles({ + root: { width: "100%", height: "100%" }, + container: { height: "100%" }, + + cardContentContainer: { + "&:last-child": { paddingBottom: theme.spacing(3) }, + }, + cardContent: { + "&:last-child": { paddingBottom: 0 }, + }, + + headerContainer: {}, + tabsContainer: { "$headerContainer + &": { marginTop: theme.spacing(2) } }, + contentContainer: { + "$headerContainer + &": { marginTop: theme.spacing(2) }, + }, + + overline: { + marginBottom: theme.spacing(3), + color: theme.palette.text.disabled, + wordBreak: "break-word", + }, + title: { + whiteSpace: "pre-line", + wordBreak: "break-word", + }, + image: { + width: 80, + height: 80, + borderRadius: theme.shape.borderRadius, + }, + imageCircle: { borderRadius: "50%" }, + + tabs: { margin: theme.spacing(0, -2) }, + tab: { minWidth: 0 }, + tabDivider: { marginTop: -1 }, + + tabSection: { paddingTop: theme.spacing(2), height: "100%" }, + tabContentGrid: { height: `calc(100% + ${theme.spacing(3)}px)` }, + + divider: { + margin: theme.spacing(2), + marginBottom: 0, + }, + cardActions: { + padding: theme.spacing(0.75, 1), + display: "flex", + justifyContent: "space-between", + }, + + primaryLinkLabel: { whiteSpace: "nowrap" }, + }) +); + +export default useStyles; diff --git a/www/src/components/Grid/index.tsx b/www/src/components/Grid/index.tsx new file mode 100644 index 00000000..30d85459 --- /dev/null +++ b/www/src/components/Grid/index.tsx @@ -0,0 +1,83 @@ +import React from "react"; + +import { Grid as MuiGrid } from "@material-ui/core"; +import Card from "./Card"; +import useAlgolia from "use-algolia"; +import AlgoliaFilters from "./AlgoliaFilters"; +import _get from "lodash/get"; +const advisorsFilters = [ + { label: "Type", facet: "type" }, + { label: "Experience (Industry)", facet: "expertise" }, + { label: "Location", facet: "location" }, +]; + +interface IGridProps { + collection: string; + filters: any[]; +} +export const replacer = (data: any) => (m: string, key: string) => { + const objKey = key.split(":")[0]; + const defaultValue = key.split(":")[1] || ""; + return _get(data, objKey, defaultValue); +}; + +const CARD_CONFIG = { + title: `{{firstName}} {{lastName}}`, + image: "{{profilePhoto[0].downloadURL}}", + body: "{{bio}}", +}; +export default function Grid({ collection, filters }: IGridProps) { + const [algoliaState, requestDispatch, , setAlgoliaConfig] = useAlgolia( + process.env.REACT_APP_ALGOLIA_APP_ID!, + process.env.REACT_APP_ALGOLIA_SEARCH_API_KEY!, + collection, + { hitsPerPage: 100 } + ); + + const isLoading = algoliaState.loading || !algoliaState.index; + const noResults = algoliaState.hits.length === 0; + const requiredFilters = ``; + const isEmpty = + noResults && + algoliaState.request?.query === undefined && + algoliaState.request?.filters === requiredFilters; + return ( + <> + {algoliaState.index && !isEmpty && ( + + )} + + {" "} + {algoliaState.hits.map(hit => { + return ( + + {" "} + {" "} + + ); + })} + + + ); +} diff --git a/www/src/constants/routes.ts b/www/src/constants/routes.ts index 65d9368b..d25e0320 100644 --- a/www/src/constants/routes.ts +++ b/www/src/constants/routes.ts @@ -5,6 +5,8 @@ export enum routes { table = "/table", tableWithId = "/table/:id", + grid = "/grid", + gridWithId = "/grid/:id", editor = "/editor", } diff --git a/www/src/views/GridView.tsx b/www/src/views/GridView.tsx new file mode 100644 index 00000000..78298e27 --- /dev/null +++ b/www/src/views/GridView.tsx @@ -0,0 +1,39 @@ +import React from "react"; +import queryString from "query-string"; + +import { Hidden } from "@material-ui/core"; + +import Navigation from "components/Navigation"; +import Grid from "components/Grid"; +import SideDrawer from "components/SideDrawer"; + +import { FireTableFilter } from "hooks/useFiretable"; +import useRouter from "hooks/useRouter"; + +export default function GridView() { + const router = useRouter(); + const tableCollection = decodeURIComponent(router.match.params.id); + + let filters: FireTableFilter[] = []; + const parsed = queryString.parse(router.location.search); + if (typeof parsed.filters === "string") { + // decoded + //[{"key":"cohort","operator":"==","value":"AMS1"}] + filters = JSON.parse(parsed.filters); + //TODO: json schema validator + } + + return ( + + + + + + + + ); +} diff --git a/www/yarn.lock b/www/yarn.lock index 5f509f0f..6c9e545b 100644 --- a/www/yarn.lock +++ b/www/yarn.lock @@ -106,6 +106,15 @@ "@algolia/logger-common" "4.1.0" "@algolia/requester-common" "4.1.0" +"@antlerengineering/components@^0.2.7": + version "0.2.7" + resolved "https://registry.yarnpkg.com/@antlerengineering/components/-/components-0.2.7.tgz#9d05d5ad841f85ab75d0c5b3bd8e37f1aa58a679" + integrity sha512-3lK/3VO+hEdNkOsPComvGVxr/30rTre0W5H4kWQcmdUi7nkB65WMRjnUcu1/IGBctTGlZiygv38W9DterND/7A== + dependencies: + dompurify "^2.0.10" + lodash "^4.17.15" + lodash-es "^4.17.15" + "@antlerengineering/multiselect@^0.3.9": version "0.3.9" resolved "https://registry.yarnpkg.com/@antlerengineering/multiselect/-/multiselect-0.3.9.tgz#a368c8b26227c37c80ac225d0007a999b0242997" @@ -5076,6 +5085,11 @@ domhandler@^3.0.0: dependencies: domelementtype "^2.0.1" +dompurify@^2.0.10: + version "2.0.11" + resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-2.0.11.tgz#cd47935774230c5e478b183a572e726300b3891d" + integrity sha512-qVoGPjIW9IqxRij7klDQQ2j6nSe4UNWANBhZNLnsS7ScTtLb+3YdxkRY8brNTpkUiTtcXsCJO+jS0UCDfenLuA== + dompurify@^2.0.8: version "2.0.8" resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-2.0.8.tgz#6ef89d2d227d041af139c7b01d9f67ed59c2eb3c" @@ -8978,7 +8992,7 @@ locate-path@^5.0.0: dependencies: p-locate "^4.1.0" -lodash-es@^4.17.14, lodash-es@^4.2.1: +lodash-es@^4.17.14, lodash-es@^4.17.15, lodash-es@^4.2.1: version "4.17.15" resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.15.tgz#21bd96839354412f23d7a10340e5eac6ee455d78" integrity sha512-rlrc3yU3+JNOpZ9zj5pQtxnx2THmvRykwL4Xlxoa8I9lHBlVbbyPhgyPMioxVZ4NqyxaVVtaJnzsyOidQIhyyQ== @@ -14086,6 +14100,11 @@ url@^0.11.0: punycode "1.3.2" querystring "0.2.0" +use-algolia@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/use-algolia/-/use-algolia-1.3.0.tgz#a53623b9c248bad14ca1cba551658c625613cb72" + integrity sha512-t6rY8apz0CmeNUbVchsi0+7UIeutJ8FPNfGTbx/f2vCw1LFYAo9ZUrG81vIsKMAhSLP2FKEXeztDWYr976MEpw== + use-debounce@^3.3.0: version "3.4.0" resolved "https://registry.yarnpkg.com/use-debounce/-/use-debounce-3.4.0.tgz#e61653fd4daad9beaa6e4695bc1d3fbd35f7e5b3"