From 184d848cc8312fb0fc9d0a30b3aa609541fc724c Mon Sep 17 00:00:00 2001 From: Desoindx Date: Wed, 5 Jan 2022 15:28:48 +0100 Subject: [PATCH 01/12] Add a basic psychologists pages --- .env.development | 6 + .eslintignore | 1 + .eslintrc.json | 6 +- .gitignore | 6 + .sequelizerc | 7 + Dockerfile | 34 +- docker-compose.yaml | 17 + jsconfig.json | 5 - next.config.js | 8 + package.json | 17 +- public/robots.txt | 2 + src/components/Directory.tsx | 81 +++ src/cron/cron.ts | 27 + src/cron/demarchesSimplifiees.ts | 34 ++ src/cron/launch.ts | 25 + src/db/config/config.ts | 16 + src/db/migrations/20220105084912-add-psy.js | 74 +++ src/db/migrations/20220105122918-ds-cursor.js | 33 ++ src/db/models/dsCursor.ts | 23 + src/db/models/index.ts | 18 + src/db/models/psychologist.ts | 35 ++ src/db/seeds/index.ts | 50 ++ src/pages/annuaire.tsx | 23 + src/pages/api/psychologists.ts | 18 + src/services/api.ts | 17 + src/services/config.ts | 18 + .../demarchesSimplifiees/buildRequest.ts | 57 ++ src/services/demarchesSimplifiees/import.ts | 50 ++ .../parsePsychologists.ts | 49 ++ src/services/demarchesSimplifiees/request.ts | 34 ++ src/services/getAddressCoordinates.ts | 37 ++ src/services/psychologists.ts | 10 + tsconfig.json | 19 +- types/coordinates.d.ts | 16 + types/demarcheSimplifiee.d.ts | 13 + types/psychologist.d.ts | 38 ++ yarn.lock | 558 +++++++++++++++++- 37 files changed, 1449 insertions(+), 33 deletions(-) create mode 100644 .eslintignore create mode 100644 .sequelizerc create mode 100644 docker-compose.yaml delete mode 100644 jsconfig.json create mode 100644 public/robots.txt create mode 100644 src/components/Directory.tsx create mode 100644 src/cron/cron.ts create mode 100644 src/cron/demarchesSimplifiees.ts create mode 100644 src/cron/launch.ts create mode 100644 src/db/config/config.ts create mode 100644 src/db/migrations/20220105084912-add-psy.js create mode 100644 src/db/migrations/20220105122918-ds-cursor.js create mode 100644 src/db/models/dsCursor.ts create mode 100644 src/db/models/index.ts create mode 100644 src/db/models/psychologist.ts create mode 100644 src/db/seeds/index.ts create mode 100644 src/pages/annuaire.tsx create mode 100644 src/pages/api/psychologists.ts create mode 100644 src/services/api.ts create mode 100644 src/services/config.ts create mode 100644 src/services/demarchesSimplifiees/buildRequest.ts create mode 100644 src/services/demarchesSimplifiees/import.ts create mode 100644 src/services/demarchesSimplifiees/parsePsychologists.ts create mode 100644 src/services/demarchesSimplifiees/request.ts create mode 100644 src/services/getAddressCoordinates.ts create mode 100644 src/services/psychologists.ts create mode 100644 types/coordinates.d.ts create mode 100644 types/demarcheSimplifiee.d.ts create mode 100644 types/psychologist.d.ts diff --git a/.env.development b/.env.development index b15abe2f..aced99f3 100644 --- a/.env.development +++ b/.env.development @@ -1,2 +1,8 @@ NEXT_TELEMETRY_DISABLED=1 +POSTGRESQL_URL=postgres://monpsysante:monpsysante@localhost:5432/monpsysante +DB_LOGGING_ENABLE=true +DISPLAY_DIRECTORY=true +DEMARCHES_SIMPLIFIEES_TOKEN=api-token +DEMARCHES_SIMPLIFIEES_ID=52209 +DEMARCHES_SIMPLIFIEES_CHAMPS=[["Q2hhbXAtMTYwMzgwNQ==", "phone"], ["Q2hhbXAtMTYyNzkzOQ==", "address"], ["Q2hhbXAtMTYwMTE4Ng==", "emailPro"], ["Q2hhbXAtMTYzOTUyNA==", "teleconsultation"], ["Q2hhbXAtMTY2MDM0Nw==", "languages"], ["Q2hhbXAtMTYzOTQwMQ==", "website"]] diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000..c349970a --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +src/db/migrations/ diff --git a/.eslintrc.json b/.eslintrc.json index 0b0c309e..528b4fc5 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -11,7 +11,8 @@ ".js", ".jsx", ".ts", - ".tsx" + ".tsx", + ".d.ts" ] } } @@ -20,7 +21,8 @@ "jsx-a11y/anchor-is-valid": "off", "react/prop-types": "off", "jsx-a11y/label-has-for": "off", - "import/no-unresolved": [2, {"caseSensitive": false}] + "import/no-unresolved": [2, {"caseSensitive": false}], + "react/display-name": "off" }, "overrides": [ { diff --git a/.gitignore b/.gitignore index 46ed1f14..ee4ea21b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,9 @@ .eslintcache coverage node_modules + +.env + +out/ + +.DS_Store diff --git a/.sequelizerc b/.sequelizerc new file mode 100644 index 00000000..ec03b098 --- /dev/null +++ b/.sequelizerc @@ -0,0 +1,7 @@ +const path = require('path'); + +module.exports = { + 'config': path.resolve('./src/db/config', 'config.js'), + 'models-path': path.resolve('./src/db', 'models'), + 'migrations-path': path.resolve('./src/db', 'migrations'), +} diff --git a/Dockerfile b/Dockerfile index f1063b7f..fb787c10 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,31 @@ -ARG PRODUCTION - -FROM node:14-alpine as builder - -COPY . . +# from https://nextjs.org/docs/deployment +# Builder +FROM node:14-alpine AS builder +RUN apk add --no-cache libc6-compat +WORKDIR /app +COPY package.json yarn.lock ./ RUN yarn install --frozen-lockfile +COPY . . RUN yarn build && yarn install --production --ignore-scripts --prefer-offline -RUN yarn export -FROM ghcr.io/socialgouv/docker/nginx:6.64.2 +# Production image, copy all the files and run next +FROM node:14-alpine AS runner +WORKDIR /app -ARG PRODUCTION +ENV NODE_ENV production -COPY --from=builder /out /usr/share/nginx/html +# You only need to copy next.config.js if you are NOT using the default configuration +COPY --from=builder /app/next.config.js . +COPY --from=builder /app/sentry.client.config.js . +COPY --from=builder /app/sentry.server.config.js . +COPY --from=builder /app/.env.production . +COPY --from=builder /app/package.json . +COPY --from=builder /app/src ./src +COPY --from=builder /app/public ./public +COPY --from=builder /app/node_modules ./node_modules +COPY --from=builder --chown=node:node /app/.next ./.next -# Create a robots.txt based on PRODUCTION build argument -RUN if [ ! -z "$PRODUCTION" ]; then echo -e "User-agent: *\nAllow: /">/usr/share/nginx/html/robots.txt; else echo -e "User-agent: *\nDisallow: /">/usr/share/nginx/html/robots.txt; fi +USER node +CMD ["yarn", "start"] \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 00000000..7ffd50ba --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,17 @@ +version: "3.6" + +services: + db: + image: postgres:14 + volumes: + - db_data:/var/lib/postgresql/data + ports: + - "5432:5432" + environment: + POSTGRES_DB: monpsysante + POSTGRES_USER: monpsysante + POSTGRES_PASSWORD: monpsysante + restart: always + +volumes: + db_data: diff --git a/jsconfig.json b/jsconfig.json deleted file mode 100644 index 36aa1a4d..00000000 --- a/jsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "compilerOptions": { - "baseUrl": "." - } -} diff --git a/next.config.js b/next.config.js index 662d1492..1c9da8ae 100644 --- a/next.config.js +++ b/next.config.js @@ -12,8 +12,16 @@ module.exports = withSentryConfig( webpack: (config, { isServer /*, buildId */ }) => { if (!isServer) { config.resolve.alias["@sentry/node"] = "@sentry/browser"; + config.resolve.fallback = { + fs: false, + path: false, + os: false, + }; } return config; }, + env: { + DISPLAY_DIRECTORY: process.env.DISPLAY_DIRECTORY === "true" + } }) ); diff --git a/package.json b/package.json index 2039a2e5..931cc9e2 100644 --- a/package.json +++ b/package.json @@ -17,9 +17,17 @@ "@socialgouv/matomo-next": "^1.2.2", "@typescript-eslint/eslint-plugin": "^5.9.0", "@zeit/next-source-maps": "^0.0.3", + "axios": "^0.24.0", + "cron": "^1.8.2", + "dotenv": "^10.0.0", + "graphql": "^16.2.0", + "graphql-request": "^3.7.0", "next": "^12.0.7", + "pg": "^8.7.1", + "pg-hstore": "^2.3.4", "react": "^17.0.2", "react-dom": "^17.0.2", + "sequelize": "^6.12.5", "typescript-eslint": "^0.0.1-alpha.0" }, "devDependencies": { @@ -27,13 +35,16 @@ "@commitlint/config-conventional": "^16.0.0", "@socialgouv/eslint-config-react": "^1.101.0", "@socialgouv/eslint-config-recommended": "^1.101.0", + "@types/faker": "^5.5.9", "@types/react": "^17.0.38", "eslint": "^8.6.0", "eslint-config-next": "^12.0.7", "eslint-plugin-import": "^2.25.4", + "faker": "^5.5.3", "jest": "^27.4.5", "lint-staged": "^12.1.5", "prettier": "^2.5.1", + "sequelize-cli": "^6.3.0", "typescript": "^4.5.4" }, "license": "MIT", @@ -47,6 +58,10 @@ "lint:fix": "eslint ./src --fix", "precommit": "lint-staged", "start": "NODE_ENV=production next start", - "export": "next export" + "export": "next export", + "db:seed": "ts-node src/db/seeds/index.ts", + "db:migrate": "npx sequelize-cli db:migrate", + "db:migrate:undo": "npx sequelize-cli db:migrate:undo", + "db:migrate:create": "npx sequelize migration:create --name" } } diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 00000000..177c3a6a --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,2 @@ +# User-agent: * signifie que l'accès est accordé à tous les agents (tous les spiders), quels qu'ils soient. +User-agent: * diff --git a/src/components/Directory.tsx b/src/components/Directory.tsx new file mode 100644 index 00000000..a82af8df --- /dev/null +++ b/src/components/Directory.tsx @@ -0,0 +1,81 @@ +import { Button, Table } from "@dataesr/react-dsfr"; +import axios from "axios"; +import React, { useEffect, useRef, useState } from "react"; + +import { Psychologist } from "../../types/psychologist"; + +const columns = [ + { + label: "Nom", + name: "name", + render: (psychologist) => + `${psychologist.lastName.toUpperCase()} ${psychologist.firstName}`, + }, + { + label: "Adresse", + name: "address", + }, + { + label: "", + name: "action", + render: () => ( + <> +
+
+
+ +
+ + ), + }, +]; + +const Directory = () => { + const table = useRef(null); + const [psychologists, setPsychologists] = useState(); + const [currentPage, setCurrentPage] = useState(1); + useEffect(() => { + axios + .get("/api/psychologists") + .then((response) => setPsychologists(response.data)); + }, []); + + if (!psychologists) { + return null; + } + return ( +
+ { + setCurrentPage(p); + table.current.scrollIntoView({ + behavior: "smooth", + block: "start", + }); + }} + surrendingPages={3} + /> + + ); +}; + +export default Directory; diff --git a/src/cron/cron.ts b/src/cron/cron.ts new file mode 100644 index 00000000..ad7f9da8 --- /dev/null +++ b/src/cron/cron.ts @@ -0,0 +1,27 @@ +import * as Sentry from "@sentry/node"; +import cron from "cron"; + +import * as demarchesSimplifiees from "./demarchesSimplifiees"; + +Sentry.init({ + dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, +}); + +const jobs = [ + { + cronTime: "*/5 * * * *", + name: "Import latest data from DS", + onTick: demarchesSimplifiees.importData, + start: true, + timeZone: "Europe/Paris", + }, +]; + +let activeJobs = 0; +jobs.forEach((job) => { + console.log(`🚀 The job "${job.name}" is ON ${job.cronTime}`); + new cron.CronJob(job); + activeJobs++; +}); + +console.log(`Started ${activeJobs} cron jobs`); diff --git a/src/cron/demarchesSimplifiees.ts b/src/cron/demarchesSimplifiees.ts new file mode 100644 index 00000000..654b54e7 --- /dev/null +++ b/src/cron/demarchesSimplifiees.ts @@ -0,0 +1,34 @@ +import { models } from "../db/models"; +import { getPsychologistList } from "../services/demarchesSimplifiees/import"; +import { saveMany } from "../services/psychologists"; + +export const importData = async (): Promise => { + try { + console.log("Starting importData..."); + const latestCursor = await models.DSCursor.findOne({ + raw: true, + where: { id: 1 }, + }); + + //@ts-ignore + const dsAPIData = await getPsychologistList(latestCursor.cursor); + + if (dsAPIData.psychologists.length > 0) { + await saveMany(dsAPIData.psychologists); + await models.DSCursor.update( + { + cursor: dsAPIData.lastCursor, + }, + { where: { id: 1 } } + ); + + console.log(`{$psychologists.psychologists.length} downloaded`); + } else { + console.log("No psychologists to save"); + } + + console.log("importData done"); + } catch (err) { + console.error("ERROR: Could not import DS API data to PG", err); + } +}; diff --git a/src/cron/launch.ts b/src/cron/launch.ts new file mode 100644 index 00000000..263b626a --- /dev/null +++ b/src/cron/launch.ts @@ -0,0 +1,25 @@ +import * as demarchesSimplifiees from "./demarchesSimplifiees"; + +const runJob = async (job): Promise => { + await job(); + process.exit(0); +}; + +if (process.argv.length < 3) { + console.log("Please specify the cron you want to launch:"); + console.log("ts-node src/cron/launch.ts job_name"); + process.exit(1); +} + +const cronJobs = { + importData: demarchesSimplifiees.importData, +}; + +const jobName = process.argv[2]; +const job = cronJobs[jobName]; +if (job) { + runJob(job); +} else { + console.log(`The job ${process.argv[2]} does not exist !`); + process.exit(2); +} diff --git a/src/db/config/config.ts b/src/db/config/config.ts new file mode 100644 index 00000000..0a839862 --- /dev/null +++ b/src/db/config/config.ts @@ -0,0 +1,16 @@ +import dotenv from "dotenv"; + +dotenv.config(); + +export default { + development: { + dialect: "postgres", + url: process.env.POSTGRESQL_URL, + }, + production: { + dialect: process.env.POSTGRES_DB_DIALECT, + logging: true, + operatorsAliases: 0, + url: process.env.SCALINGO_POSTGRESQL_URL, + }, +}; diff --git a/src/db/migrations/20220105084912-add-psy.js b/src/db/migrations/20220105084912-add-psy.js new file mode 100644 index 00000000..fa695483 --- /dev/null +++ b/src/db/migrations/20220105084912-add-psy.js @@ -0,0 +1,74 @@ +module.exports = { + up: async (queryInterface, Sequelize) => { + await queryInterface.createTable('psychologist', { + id: { + primaryKey: true, + type: Sequelize.INTEGER, + }, + first_name: { + allowNull: false, + type: Sequelize.STRING, + }, + last_name: { + allowNull: false, + type: Sequelize.STRING, + }, + email: { + allowNull: false, + type: Sequelize.STRING, + }, + archived: { + allowNull: false, + type: Sequelize.BOOLEAN, + }, + phone: { + allowNull: false, + type: Sequelize.STRING + }, + address: { + allowNull: false, + type: Sequelize.TEXT + }, + email_pro: { + allowNull: false, + type: Sequelize.STRING + }, + teleconsultation: { + allowNull: false, + type: Sequelize.BOOLEAN, + }, + languages: { + allowNull: false, + type: Sequelize.STRING + }, + website: { + allowNull: false, + type: Sequelize.STRING + }, + longitude: { + allowNull: true, + type: Sequelize.FLOAT, + }, + latitude: { + allowNull: true, + type: Sequelize.FLOAT, + }, + instructor_id: { + allowNull: false, + type: Sequelize.STRING + }, + created_at: { + allowNull: false, + type: Sequelize.DATE, + }, + updated_at: { + allowNull: false, + type: Sequelize.DATE, + }, + }); + }, + + down: async (queryInterface, Sequelize) => { + await queryInterface.dropTable('psychologist'); + }, +}; diff --git a/src/db/migrations/20220105122918-ds-cursor.js b/src/db/migrations/20220105122918-ds-cursor.js new file mode 100644 index 00000000..8967243b --- /dev/null +++ b/src/db/migrations/20220105122918-ds-cursor.js @@ -0,0 +1,33 @@ +module.exports = { + up: async (queryInterface, Sequelize) => { + await queryInterface.createTable('ds_cursor', { + id: { + primaryKey: true, + type: Sequelize.INTEGER, + }, + cursor: { + allowNull: true, + type: Sequelize.STRING, + }, + created_at: { + allowNull: false, + type: Sequelize.DATE, + }, + updated_at: { + allowNull: false, + type: Sequelize.DATE, + }, + }); + + await queryInterface.bulkInsert('ds_cursor', [{ + id: 1, + cursor: undefined, + created_at: new Date(), + updated_at: new Date(), + }]) + }, + + down: async (queryInterface, Sequelize) => { + await queryInterface.dropTable('ds_cursor'); + } +}; diff --git a/src/db/models/dsCursor.ts b/src/db/models/dsCursor.ts new file mode 100644 index 00000000..1ba43ade --- /dev/null +++ b/src/db/models/dsCursor.ts @@ -0,0 +1,23 @@ +import { DataTypes, Model } from "sequelize"; + +export default (sequelize) => { + class DSCursor extends Model {} + + DSCursor.init( + { + cursor: DataTypes.STRING, + id: { + primaryKey: true, + type: DataTypes.INTEGER, + }, + }, + { + freezeTableName: true, + modelName: "dsCursors", + sequelize, + tableName: "ds_cursor", + underscored: true, + } + ); + return DSCursor; +}; diff --git a/src/db/models/index.ts b/src/db/models/index.ts new file mode 100644 index 00000000..a7eacf37 --- /dev/null +++ b/src/db/models/index.ts @@ -0,0 +1,18 @@ +import { Sequelize } from "sequelize"; + +import config from "../../services/config"; +import dsCursor from "./dsCursor"; +import psychologist from "./psychologist"; + +const sequelize = new Sequelize(config.postgre.url, { + define: { + freezeTableName: true, + }, + dialect: "postgres", + logging: config.postgre.logging ? console.log : false, +}); + +export const models = { + DSCursor: dsCursor(sequelize), + Psychologist: psychologist(sequelize), +}; diff --git a/src/db/models/psychologist.ts b/src/db/models/psychologist.ts new file mode 100644 index 00000000..938be29e --- /dev/null +++ b/src/db/models/psychologist.ts @@ -0,0 +1,35 @@ +import { DataTypes, Model } from "sequelize"; + +export default (sequelize) => { + class Psychologist extends Model {} + + Psychologist.init( + { + address: DataTypes.STRING, + archived: DataTypes.BOOLEAN, + email: DataTypes.STRING, + emailPro: DataTypes.STRING, + firstName: DataTypes.STRING, + id: { + primaryKey: true, + type: DataTypes.NUMBER, + }, + instructorId: DataTypes.STRING, + languages: DataTypes.STRING, + lastName: DataTypes.STRING, + latitude: DataTypes.FLOAT, + longitude: DataTypes.FLOAT, + phone: DataTypes.STRING, + teleconsultation: DataTypes.BOOLEAN, + website: DataTypes.STRING, + }, + { + freezeTableName: true, + modelName: "psychologists", + sequelize, + tableName: "psychologist", + underscored: true, + } + ); + return Psychologist; +}; diff --git a/src/db/seeds/index.ts b/src/db/seeds/index.ts new file mode 100644 index 00000000..20423156 --- /dev/null +++ b/src/db/seeds/index.ts @@ -0,0 +1,50 @@ +import * as dotenv from "dotenv"; +import faker from "faker"; + +import { Psychologist } from "../../../types/psychologist"; +import { models } from "../models"; + +const NUMBER_OF_PSYCHOLOGISTS = 1000; + +const deleteAll = async () => { + await models.Psychologist.destroy({ where: {} }); +}; + +const createPsychologists = async () => { + const psychologists: Psychologist[] = []; + + for (let i = 0; i < NUMBER_OF_PSYCHOLOGISTS; i++) { + psychologists.push({ + address: `${faker.address.streetAddress()} ${faker.address.zipCode( + "#####" + )} ${faker.address.city()}`, + archived: false, + email: faker.internet.email(), + emailPro: faker.internet.email(), + firstName: faker.name.firstName(), + id: i, + instructorId: faker.datatype.uuid(), + languages: faker.lorem.word(1), + lastName: faker.name.lastName(), + latitude: parseFloat(faker.address.latitude()), + longitude: parseFloat(faker.address.longitude()), + phone: faker.phone.phoneNumber("0# ## ## ## ##"), + teleconsultation: faker.datatype.boolean(), + website: faker.helpers.randomize([ + faker.internet.domainName(), + faker.internet.url(), + ]), + }); + } + + await models.Psychologist.bulkCreate(psychologists); +}; + +const createAllData = async () => { + await deleteAll(); + + await createPsychologists(); +}; + +dotenv.config(); +createAllData(); diff --git a/src/pages/annuaire.tsx b/src/pages/annuaire.tsx new file mode 100644 index 00000000..f1484791 --- /dev/null +++ b/src/pages/annuaire.tsx @@ -0,0 +1,23 @@ +import { useRouter } from "next/router"; +import React, { useEffect } from "react"; + +import Directory from "../components/Directory"; + +export default () => { + const router = useRouter(); + useEffect(() => { + if (!process.env.DISPLAY_DIRECTORY) { + router.push("/"); + } + + document.title = "MonPsySanté - Annuaire"; + }, []); + + return ( +
+
+ +
+
+ ); +}; diff --git a/src/pages/api/psychologists.ts b/src/pages/api/psychologists.ts new file mode 100644 index 00000000..bc5dbbd2 --- /dev/null +++ b/src/pages/api/psychologists.ts @@ -0,0 +1,18 @@ +import { NextApiRequest, NextApiResponse } from "next"; + +import { handleApiError } from "../../services/api"; +import config from "../../services/config"; +import { getAll } from "../../services/psychologists"; + +const psychologists = async (req: NextApiRequest, res: NextApiResponse) => { + if (req.method === "GET") { + console.log(config); + if (!config.displayDirectory) { + return res.status(200).json([]); + } + const psychologists = await getAll(); + return res.status(200).json(psychologists); + } +}; + +export default handleApiError(psychologists); diff --git a/src/services/api.ts b/src/services/api.ts new file mode 100644 index 00000000..55c6dcb0 --- /dev/null +++ b/src/services/api.ts @@ -0,0 +1,17 @@ +import { NextApiRequest, NextApiResponse } from "next"; + +export const handleApiError = ( + handler: (req: NextApiRequest, res: NextApiResponse) => void +) => { + return async function ( + req: NextApiRequest, + res: NextApiResponse + ): Promise { + try { + await handler(req, res); + } catch (error) { + console.log(error); + res.status(500).json("Something went wrong..."); + } + }; +}; diff --git a/src/services/config.ts b/src/services/config.ts new file mode 100644 index 00000000..96f32263 --- /dev/null +++ b/src/services/config.ts @@ -0,0 +1,18 @@ +import dotenv from "dotenv"; + +dotenv.config(); + +export default { + demarchesSimplifiees: { + apiToken: process.env.DEMARCHES_SIMPLIFIEES_TOKEN, + apiUrl: "https://www.demarches-simplifiees.fr/api/v2/graphql", + champs: process.env.DEMARCHES_SIMPLIFIEES_CHAMPS, + id: process.env.DEMARCHES_SIMPLIFIEES_ID, + }, + displayDirectory: process.env.DISPLAY_DIRECTORY, + minScoreAddress: parseFloat(process.env.MIN_SCORE_ADDRESS || "0.55"), + postgre: { + logging: process.env.DB_LOGGING_ENABLE === "true", + url: process.env.POSTGRESQL_URL, + }, +}; diff --git a/src/services/demarchesSimplifiees/buildRequest.ts b/src/services/demarchesSimplifiees/buildRequest.ts new file mode 100644 index 00000000..b7b7913b --- /dev/null +++ b/src/services/demarchesSimplifiees/buildRequest.ts @@ -0,0 +1,57 @@ +import { gql } from "graphql-request"; + +import { DSResponse } from "../../../types/demarcheSimplifiee"; +import config from "../config"; +import { request } from "./request"; + +const getWhereConditionAfterCursor = (cursor: string): string => { + if (cursor) { + return `(after: "${cursor}")`; + } + return ""; +}; + +export const requestPsychologists = async ( + afterCursor: string | undefined +): Promise => { + const paginationCondition = getWhereConditionAfterCursor(afterCursor); + const query = gql` + { + demarche (number: ${config.demarchesSimplifiees.id}) { + id + dossiers ${paginationCondition} { + pageInfo { + hasNextPage + endCursor + } + nodes { + archived + number + groupeInstructeur { + id + label + } + state + champs { + id + label + stringValue + } + usager { + email + } + demandeur { + ... on PersonnePhysique { + civilite + nom + prenom + } + } + } + } + } + } + `; + + return request(query); +}; diff --git a/src/services/demarchesSimplifiees/import.ts b/src/services/demarchesSimplifiees/import.ts new file mode 100644 index 00000000..a688a0a6 --- /dev/null +++ b/src/services/demarchesSimplifiees/import.ts @@ -0,0 +1,50 @@ +import { DSResponse } from "../../../types/demarcheSimplifiee"; +import { DSPsychologist, Psychologist } from "../../../types/psychologist"; +import { requestPsychologists } from "./buildRequest"; +import parsePsychologists from "./parsePsychologists"; + +const getAllPsychologistList = async ( + graphqlFunction: (string) => Promise, + cursor: string | undefined = undefined, + accumulator: DSPsychologist[] = [] +): Promise<{ + psychologists: DSPsychologist[]; + lastCursor: string; +}> => { + const apiResponse = await graphqlFunction(cursor); + + const { pageInfo, nodes } = apiResponse.demarche.dossiers; + + const nextAccumulator = accumulator.concat(nodes); + + if (pageInfo.hasNextPage) { + return getAllPsychologistList( + graphqlFunction, + pageInfo.endCursor, + nextAccumulator + ); + } + return { + lastCursor: pageInfo.endCursor, + psychologists: nextAccumulator, + }; +}; + +export const getPsychologistList = async ( + cursor: string | undefined +): Promise<{ + psychologists: Psychologist[]; + lastCursor: string; +}> => { + const time = `Fetching all psychologists from DS (query id #${Math.random().toString()})`; + + console.time(time); + const list = await getAllPsychologistList(requestPsychologists, cursor); + const results = { + lastCursor: list.lastCursor, + psychologists: await parsePsychologists(list.psychologists), + }; + console.timeEnd(time); + + return results; +}; diff --git a/src/services/demarchesSimplifiees/parsePsychologists.ts b/src/services/demarchesSimplifiees/parsePsychologists.ts new file mode 100644 index 00000000..1cd6abc3 --- /dev/null +++ b/src/services/demarchesSimplifiees/parsePsychologists.ts @@ -0,0 +1,49 @@ +import { DSPsychologist, Psychologist } from "../../../types/psychologist"; +import config from "../config"; +import getAddressCoordinates from "../getAddressCoordinates"; + +const parseDossierMetadata = async ( + dossier: DSPsychologist +): Promise => { + const psychologist: Partial = { + archived: dossier.archived, + email: dossier.usager.email, + firstName: dossier.demandeur.prenom, + id: dossier.number, + instructorId: dossier.groupeInstructeur.id, + lastName: dossier.demandeur.nom, + }; + + JSON.parse(config.demarchesSimplifiees.champs).forEach(([id, field]) => { + const dossierChamp = dossier.champs.find((champ) => champ.id === id); + if (dossierChamp) { + if (field === "teleconsultation") { + psychologist.teleconsultation = dossierChamp.stringValue === "true"; + } else { + psychologist[field] = dossierChamp.stringValue; + } + } + }); + + const coordinates = await getAddressCoordinates(psychologist.address); + if (coordinates) { + psychologist.longitude = coordinates.longitude; + psychologist.latitude = coordinates.latitude; + } + + return psychologist as Psychologist; +}; + +const parsePsychologists = async ( + dsPsychologists: DSPsychologist[] +): Promise => { + console.log(`Parsing ${dsPsychologists.length} psychologists from DS API`); + + return Promise.all( + dsPsychologists.map(async (dsPsychologist) => + parseDossierMetadata(dsPsychologist) + ) + ); +}; + +export default parsePsychologists; diff --git a/src/services/demarchesSimplifiees/request.ts b/src/services/demarchesSimplifiees/request.ts new file mode 100644 index 00000000..d12d0977 --- /dev/null +++ b/src/services/demarchesSimplifiees/request.ts @@ -0,0 +1,34 @@ +import { GraphQLClient } from "graphql-request"; + +import config from "../config"; + +const endpoint = config.demarchesSimplifiees.apiUrl; +const graphQLClient = new GraphQLClient(endpoint, { + headers: { + "Content-Type": "application/json", + authorization: `Bearer ${config.demarchesSimplifiees.apiToken}`, + }, +}); + +const logErrorsFromDS = (apiResponse: { + response: { errors: string[] }; +}): void => { + if (apiResponse.response) { + if (apiResponse.response.errors.length > 0) { + apiResponse.response.errors.forEach((err) => { + console.error("Error details", err); + }); + } + } +}; + +export const request = async (query: string, variables = undefined) => { + try { + const result = await graphQLClient.request(query, variables); + return result; + } catch (err) { + console.error("API has returned error", err); + logErrorsFromDS(err); + throw "Error from DS API"; + } +}; diff --git a/src/services/getAddressCoordinates.ts b/src/services/getAddressCoordinates.ts new file mode 100644 index 00000000..1c9a1a36 --- /dev/null +++ b/src/services/getAddressCoordinates.ts @@ -0,0 +1,37 @@ +import axios from "axios/index"; + +import { Coordinates, CoordinatesAPI } from "../../types/coordinates"; +import config from "./config"; + +const ADDRESS_DELIMITER = ";"; + +const getAddressCoordinates = async (address: string): Promise => { + const firstAddress = address.split(ADDRESS_DELIMITER)[0]; + const url = encodeURI( + `https://api-adresse.data.gouv.fr/search/?q=${firstAddress}&limit=1` + ); + const response = await axios.get(url).catch((error) => { + console.log("error", error); + }); + + if (response && response.data.features && response.data.features.length > 0) { + const feature = response.data.features[0]; + const [longitude, latitude] = feature.geometry.coordinates; + const { score, label } = feature.properties; + console.debug(`"${firstAddress}" ; "${label}" ; "${score}"`); + + if (score > config.minScoreAddress) { + return Promise.resolve({ + latitude, + longitude, + }); + } + // Insufficient score + return Promise.resolve(null); + } + // Not found + console.debug(`"${firstAddress}" ; "" ; "0"`); + return Promise.resolve(null); +}; + +export default getAddressCoordinates; diff --git a/src/services/psychologists.ts b/src/services/psychologists.ts new file mode 100644 index 00000000..ede1a74c --- /dev/null +++ b/src/services/psychologists.ts @@ -0,0 +1,10 @@ +import { Psychologist } from "../../types/psychologist"; +import { models } from "../db/models"; + +export const getAll = async () => { + return models.Psychologist.findAll({ raw: true }); +}; + +export const saveMany = async (psychologists: Psychologist[]) => { + return models.Psychologist.bulkCreate(psychologists); +}; diff --git a/tsconfig.json b/tsconfig.json index b605f6be..9714439d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "es5", + "target": "esnext", "lib": [ "dom", "dom.iterable", @@ -12,25 +12,32 @@ "forceConsistentCasingInFileNames": true, "noEmit": true, "esModuleInterop": true, - "module": "esnext", - "moduleResolution": "node", + "module": "commonjs", "resolveJsonModule": true, - "isolatedModules": true, + "moduleResolution": "node", "jsx": "preserve", + "experimentalDecorators": true, + "emitDecoratorMetadata": true, + "noUnusedLocals": true, + "sourceMap": true, + "types": [ + "node" + ], "baseUrl": ".", "paths": { "src": [ "src/*" ] }, + "isolatedModules": true, "incremental": true }, "include": [ "next-env.d.ts", "**/*.ts", - "**/*.tsx" + "**/*.tsx", ], "exclude": [ - "node_modules" + "node_modules", ] } diff --git a/types/coordinates.d.ts b/types/coordinates.d.ts new file mode 100644 index 00000000..58ed9d01 --- /dev/null +++ b/types/coordinates.d.ts @@ -0,0 +1,16 @@ +export interface Coordinates { + longitude: number; + latitude: number; +} + +export interface CoordinatesAPI { + features: { + geometry: { + coordinates: number[]; + }; + properties: { + score: number; + label: string; + }; + }[]; +} diff --git a/types/demarcheSimplifiee.d.ts b/types/demarcheSimplifiee.d.ts new file mode 100644 index 00000000..d5929267 --- /dev/null +++ b/types/demarcheSimplifiee.d.ts @@ -0,0 +1,13 @@ +import { DSPsychologist } from "./psychologist"; + +export interface DSResponse { + demarche: { + dossiers: { + pageInfo: { + hasNextPage: boolean; + endCursor: string; + }; + nodes: DSPsychologist[]; + }; + }; +} diff --git a/types/psychologist.d.ts b/types/psychologist.d.ts new file mode 100644 index 00000000..f124ecdb --- /dev/null +++ b/types/psychologist.d.ts @@ -0,0 +1,38 @@ +export interface Psychologist { + id: number; + firstName: string; + lastName: string; + email: string; + archived: boolean; + phone: string; + address: string; + emailPro: string; + teleconsultation: boolean; + languages: string; + website: string; + longitude: number; + latitude: number; + instructorId: string; +} + +export interface DSPsychologist { + archived: boolean; + number: number; + state: string; + groupeInstructeur: { + id: string; + label: string; + }; + usager: { + email: string; + }; + demandeur: { + nom: string; + prenom: string; + }; + champs: { + id: string; + label: string; + stringValue: string; + }[]; +} diff --git a/yarn.lock b/yarn.lock index f8a1cf08..c7369c05 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1150,11 +1150,23 @@ dependencies: "@babel/types" "^7.3.0" +"@types/debug@^4.1.7": + version "4.1.7" + resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.7.tgz#7cc0ea761509124709b8b2d1090d8f6c17aadb82" + integrity sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg== + dependencies: + "@types/ms" "*" + "@types/estree@0.0.39": version "0.0.39" resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw== +"@types/faker@^5.5.9": + version "5.5.9" + resolved "https://registry.yarnpkg.com/@types/faker/-/faker-5.5.9.tgz#588ede92186dc557bff8341d294335d50d255f0c" + integrity sha512-uCx6mP3UY5SIO14XlspxsGjgaemrxpssJI0Ol+GfhxtcKpv9pgRZYsS4eeKeHVLje6Qtc8lGszuBI461+gVZBA== + "@types/graceful-fs@^4.1.2": version "4.1.5" resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.5.tgz#21ffba0d98da4350db64891f92a9e5db3cdb4e15" @@ -1196,6 +1208,11 @@ resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.2.tgz#ee771e2ba4b3dc5b372935d549fd9617bf345b8c" integrity sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ== +"@types/ms@*": + version "0.7.31" + resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.31.tgz#31b7ca6407128a3d2bbc27fe2d21b345397f6197" + integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA== + "@types/node@*": version "16.11.12" resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.12.tgz#ac7fb693ac587ee182c3780c26eb65546a1a3c10" @@ -1396,6 +1413,11 @@ abab@^2.0.3, abab@^2.0.5: resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.5.tgz#c0b678fb32d60fc1219c784d6a826fe385aeb79a" integrity sha512-9IK9EadsbHo6jLWIpxpR6pL0sazTXV6+SQv25ZB+F7Bj9mJNaOc4nCRabwd5M/JwmUa8idz6Eci6eKfJryPs6Q== +abbrev@1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" + integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== + acorn-globals@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-6.0.0.tgz#46cdd39f0f8ff08a876619b55f5ac8a6dc770b45" @@ -1645,6 +1667,11 @@ asynckit@^0.4.0: resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= +at-least-node@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2" + integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg== + available-typed-arrays@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7" @@ -1655,6 +1682,13 @@ axe-core@^4.3.5: resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.3.5.tgz#78d6911ba317a8262bfee292aeafcc1e04b49cc5" integrity sha512-WKTW1+xAzhMS5dJsxWkliixlO/PqC4VhmO9T4juNYcaTg9jzWiJsou6m5pxWYGfigWbwzJWeFY6z47a+4neRXA== +axios@^0.24.0: + version "0.24.0" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.24.0.tgz#804e6fa1e4b9c5288501dd9dff56a7a0940d20d6" + integrity sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA== + dependencies: + follow-redirects "^1.14.4" + axobject-query@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-2.2.0.tgz#943d47e10c0b704aa42275e20edf3722648989be" @@ -1753,6 +1787,11 @@ binary-extensions@^2.0.0: resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== +bluebird@^3.7.2: + version "3.7.2" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" + integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== + bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.9: version "4.12.0" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" @@ -1888,6 +1927,11 @@ buffer-from@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== +buffer-writer@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/buffer-writer/-/buffer-writer-2.0.0.tgz#ce7eb81a38f7829db09c873f2fbb792c0c98ec04" + integrity sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw== + buffer-xor@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" @@ -1933,7 +1977,7 @@ camelcase-keys@^6.2.2: map-obj "^4.0.0" quick-lru "^4.0.1" -camelcase@^5.3.1: +camelcase@^5.0.0, camelcase@^5.3.1: version "5.3.1" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== @@ -2026,6 +2070,17 @@ clean-stack@^2.0.0: resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" integrity sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A== +cli-color@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/cli-color/-/cli-color-2.0.1.tgz#93e3491308691f1e46beb78b63d0fb2585e42ba6" + integrity sha512-eBbxZF6fqPUNnf7CLAFOersUnyYzv83tHFLSlts+OAHsNendaqv2tHCq+/MO+b3Y+9JeoUlIvobyxG/Z8GNeOg== + dependencies: + d "^1.0.1" + es5-ext "^0.10.53" + es6-iterator "^2.0.3" + memoizee "^0.4.15" + timers-ext "^0.1.7" + cli-cursor@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307" @@ -2049,6 +2104,15 @@ cli-truncate@^3.1.0: slice-ansi "^5.0.0" string-width "^5.0.0" +cliui@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-6.0.0.tgz#511d702c0c4e41ca156d7d0e96021f23e13225b1" + integrity sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.0" + wrap-ansi "^6.2.0" + cliui@^7.0.2: version "7.0.4" resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" @@ -2114,6 +2178,11 @@ combined-stream@^1.0.8: dependencies: delayed-stream "~1.0.0" +commander@^2.19.0: + version "2.20.3" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" + integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== + commander@^8.3.0: version "8.3.0" resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66" @@ -2137,6 +2206,14 @@ concat-map@0.0.1: resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= +config-chain@^1.1.12: + version "1.1.13" + resolved "https://registry.yarnpkg.com/config-chain/-/config-chain-1.1.13.tgz#fad0795aa6a6cdaff9ed1b68e9dff94372c232f4" + integrity sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ== + dependencies: + ini "^1.3.4" + proto-list "~1.2.1" + console-control-strings@^1.0.0, console-control-strings@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" @@ -2260,6 +2337,20 @@ create-require@^1.1.0: resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== +cron@^1.8.2: + version "1.8.2" + resolved "https://registry.yarnpkg.com/cron/-/cron-1.8.2.tgz#4ac5e3c55ba8c163d84f3407bde94632da8370ce" + integrity sha512-Gk2c4y6xKEO8FSAUTklqtfSr7oTq0CiPQeLBG5Fl0qoXpZyMcj1SG59YL+hqq04bu6/IuEA7lMkYDAplQNKkyg== + dependencies: + moment-timezone "^0.5.x" + +cross-fetch@^3.0.6: + version "3.1.4" + resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.4.tgz#9723f3a3a247bf8b89039f3a380a9244e8fa2f39" + integrity sha512-1eAtFWdIubi6T4XPy6ei9iUFoKpUkIF971QLN8lIvvvwueI65+Nw5haMNKUwfJxabqlIIDODJKGrQ66gxC0PbQ== + dependencies: + node-fetch "2.6.1" + cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" @@ -2327,6 +2418,14 @@ csstype@^3.0.2: resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.0.10.tgz#2ad3a7bed70f35b965707c092e5f30b327c290e5" integrity sha512-2u44ZG2OcNUO9HDp/Jl8C07x6pU/eTR3ncV91SiK3dhG9TWvRVsCoJw14Ckx5DgWkzGA3waZWO3d7pgqpUI/XA== +d@1, d@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/d/-/d-1.0.1.tgz#8698095372d58dbee346ffd0c7093f99f8f9eb5a" + integrity sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA== + dependencies: + es5-ext "^0.10.50" + type "^1.0.1" + damerau-levenshtein@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.7.tgz#64368003512a1a6992593741a09a9d31a836f55d" @@ -2380,7 +2479,7 @@ decamelize-keys@^1.1.0: decamelize "^1.1.0" map-obj "^1.0.0" -decamelize@^1.1.0: +decamelize@^1.1.0, decamelize@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= @@ -2529,6 +2628,26 @@ dot-prop@^5.1.0: dependencies: is-obj "^2.0.0" +dotenv@^10.0.0: + version "10.0.0" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-10.0.0.tgz#3d4227b8fb95f81096cdd2b66653fb2c7085ba81" + integrity sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q== + +dottie@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/dottie/-/dottie-2.0.2.tgz#cc91c0726ce3a054ebf11c55fbc92a7f266dd154" + integrity sha512-fmrwR04lsniq/uSr8yikThDTrM7epXHBAAjH9TbeH3rEA8tdCO7mRzB9hdmdGyJCxF8KERo9CITcm3kGuoyMhg== + +editorconfig@^0.15.3: + version "0.15.3" + resolved "https://registry.yarnpkg.com/editorconfig/-/editorconfig-0.15.3.tgz#bef84c4e75fb8dcb0ce5cee8efd51c15999befc5" + integrity sha512-M9wIMFx96vq0R4F+gRpY3o2exzb8hEj/n9S8unZtHSvYjibBp/iMufSzvmOcV/laG0ZtuTVGtiJggPOSW2r93g== + dependencies: + commander "^2.19.0" + lru-cache "^4.1.5" + semver "^5.6.0" + sigmund "^1.0.1" + electron-to-chromium@^1.3.723: version "1.4.14" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.14.tgz#b0aa41fbfbf2eff8c2c6f7a871c03075250f8956" @@ -2638,11 +2757,47 @@ es-to-primitive@^1.2.1: is-date-object "^1.0.1" is-symbol "^1.0.2" +es5-ext@^0.10.35, es5-ext@^0.10.46, es5-ext@^0.10.50, es5-ext@^0.10.53, es5-ext@~0.10.14, es5-ext@~0.10.2, es5-ext@~0.10.46: + version "0.10.53" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.53.tgz#93c5a3acfdbef275220ad72644ad02ee18368de1" + integrity sha512-Xs2Stw6NiNHWypzRTY1MtaG/uJlwCk8kH81920ma8mvN8Xq1gsfhZvpkImLQArw8AHnv8MT2I45J3c0R8slE+Q== + dependencies: + es6-iterator "~2.0.3" + es6-symbol "~3.1.3" + next-tick "~1.0.0" + +es6-iterator@^2.0.3, es6-iterator@~2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" + integrity sha1-p96IkUGgWpSwhUQDstCg+/qY87c= + dependencies: + d "1" + es5-ext "^0.10.35" + es6-symbol "^3.1.1" + es6-object-assign@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/es6-object-assign/-/es6-object-assign-1.1.0.tgz#c2c3582656247c39ea107cb1e6652b6f9f24523c" integrity sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw= +es6-symbol@^3.1.1, es6-symbol@~3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18" + integrity sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA== + dependencies: + d "^1.0.1" + ext "^1.1.2" + +es6-weak-map@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.3.tgz#b6da1f16cc2cc0d9be43e6bdbfc5e7dfcdf31d53" + integrity sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA== + dependencies: + d "1" + es5-ext "^0.10.46" + es6-iterator "^2.0.3" + es6-symbol "^3.1.1" + escalade@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" @@ -2990,6 +3145,14 @@ etag@1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= +event-emitter@^0.3.5: + version "0.3.5" + resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39" + integrity sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk= + dependencies: + d "1" + es5-ext "~0.10.14" + events@3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" @@ -3035,6 +3198,23 @@ expect@^27.4.2: jest-message-util "^27.4.2" jest-regex-util "^27.4.0" +ext@^1.1.2: + version "1.6.0" + resolved "https://registry.yarnpkg.com/ext/-/ext-1.6.0.tgz#3871d50641e874cc172e2b53f919842d19db4c52" + integrity sha512-sdBImtzkq2HpkdRLtlLWDa6w4DX22ijZLKx8BMPUuKe1c5lbN6xwQDQCxSfxBQnHZ13ls/FH0MQZx/q/gr6FQg== + dependencies: + type "^2.5.0" + +extract-files@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/extract-files/-/extract-files-9.0.0.tgz#8a7744f2437f81f5ed3250ed9f1550de902fe54a" + integrity sha512-CvdFfHkC95B4bBBk36hcEmvdR2awOdhhVUYH6S/zrVj3477zven/fJMYg7121h4T1xHZC+tetUpubpAhxwI7hQ== + +faker@^5.5.3: + version "5.5.3" + resolved "https://registry.yarnpkg.com/faker/-/faker-5.5.3.tgz#c57974ee484431b25205c2c8dc09fda861e51e0e" + integrity sha512-wLTv2a28wjUyWkbnX7u/ABZBkUkIF2fCd73V6P2oFqEGEktDfzWx4UxrSqtPRw0xPRAcjeAOIiJWqZm3pP4u3g== + fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" @@ -3139,6 +3319,11 @@ flatted@^3.1.0: resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.4.tgz#28d9969ea90661b5134259f312ab6aa7929ac5e2" integrity sha512-8/sOawo8tJ4QOBX8YlQBMxL8+RLZfxMQOif9o0KUKTNTjMYElWPE0r/m5VNFxTRd0NSw8qSy8dajrwX4RYI1Hw== +follow-redirects@^1.14.4: + version "1.14.6" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.6.tgz#8cfb281bbc035b3c067d6cd975b0f6ade6e855cd" + integrity sha512-fhUl5EwSJbbl8AR+uYL2KQDxLkdSjZGR36xy46AO7cOMTrCMON6Sa28FmAnC2tRTDbd/Uuzz3aJBv7EBN7JH8A== + foreach@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" @@ -3162,6 +3347,16 @@ fs-extra@^10.0.0: jsonfile "^6.0.1" universalify "^2.0.0" +fs-extra@^9.0.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" + integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ== + dependencies: + at-least-node "^1.0.0" + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^2.0.0" + fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" @@ -3201,7 +3396,7 @@ gensync@^1.0.0-beta.2: resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== -get-caller-file@^2.0.5: +get-caller-file@^2.0.1, get-caller-file@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== @@ -3330,6 +3525,20 @@ graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.4: resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.8.tgz#e412b8d33f5e006593cbd3cee6df9f2cebbe802a" integrity sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg== +graphql-request@^3.7.0: + version "3.7.0" + resolved "https://registry.yarnpkg.com/graphql-request/-/graphql-request-3.7.0.tgz#c7406e537084f8b9788541e3e6704340ca13055b" + integrity sha512-dw5PxHCgBneN2DDNqpWu8QkbbJ07oOziy8z+bK/TAXufsOLaETuVO4GkXrbs0WjhdKhBMN3BkpN/RIvUHkmNUQ== + dependencies: + cross-fetch "^3.0.6" + extract-files "^9.0.0" + form-data "^3.0.0" + +graphql@^16.2.0: + version "16.2.0" + resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.2.0.tgz#de3150e80f1fc009590b92a9d16ab1b46e12b656" + integrity sha512-MuQd7XXrdOcmfwuLwC2jNvx0n3rxIuNYOxUtiee5XOmfrWo613ar2U8pE7aHAKh8VwfpifubpD9IP+EdEAEOsA== + hard-rejection@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/hard-rejection/-/hard-rejection-2.1.0.tgz#1c6eda5c1685c63942766d79bb40ae773cecd883" @@ -3569,6 +3778,11 @@ indent-string@^4.0.0: resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251" integrity sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg== +inflection@^1.13.1: + version "1.13.1" + resolved "https://registry.yarnpkg.com/inflection/-/inflection-1.13.1.tgz#c5cadd80888a90cf84c2e96e340d7edc85d5f0cb" + integrity sha512-dldYtl2WlN0QDkIDtg8+xFwOS2Tbmp12t1cHa5/YClU6ZQjTFm7B66UcVbh9NQB+HvT5BAd2t5+yKsBkw5pcqA== + inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" @@ -3736,6 +3950,11 @@ is-potential-custom-element-name@^1.0.1: resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz#171ed6f19e3ac554394edf78caa05784a45bebb5" integrity sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ== +is-promise@^2.2.2: + 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-regex@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958" @@ -4280,6 +4499,16 @@ jest@^27.4.5: import-local "^3.0.2" jest-cli "^27.4.5" +js-beautify@^1.8.8: + version "1.14.0" + resolved "https://registry.yarnpkg.com/js-beautify/-/js-beautify-1.14.0.tgz#2ce790c555d53ce1e3d7363227acf5dc69024c2d" + integrity sha512-yuck9KirNSCAwyNJbqW+BxJqJ0NLJ4PwBUzQQACl5O3qHMBXVkXb/rD0ilh/Lat/tn88zSZ+CAHOlk0DsY7GuQ== + dependencies: + config-chain "^1.1.12" + editorconfig "^0.15.3" + glob "^7.1.3" + nopt "^5.0.0" + "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" @@ -4530,7 +4759,7 @@ lodash.sortby@^4.7.0: resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= -lodash@^4.17.15, lodash@^4.17.19, lodash@^4.7.0: +lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.21, lodash@^4.17.5, lodash@^4.7.0: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -4552,6 +4781,14 @@ loose-envify@^1.1.0, loose-envify@^1.4.0: dependencies: js-tokens "^3.0.0 || ^4.0.0" +lru-cache@^4.1.5: + version "4.1.5" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" + integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g== + dependencies: + pseudomap "^1.0.2" + yallist "^2.1.2" + lru-cache@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" @@ -4559,6 +4796,13 @@ lru-cache@^6.0.0: dependencies: yallist "^4.0.0" +lru-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/lru-queue/-/lru-queue-0.1.0.tgz#2738bd9f0d3cf4f84490c5736c48699ac632cda3" + integrity sha1-Jzi9nw089PhEkMVzbEhpmsYyzaM= + dependencies: + es5-ext "~0.10.2" + lru_map@^0.3.3: version "0.3.3" resolved "https://registry.yarnpkg.com/lru_map/-/lru_map-0.3.3.tgz#b5c8351b9464cbd750335a79650a0ec0e56118dd" @@ -4602,6 +4846,20 @@ md5.js@^1.3.4: inherits "^2.0.1" safe-buffer "^5.1.2" +memoizee@^0.4.15: + version "0.4.15" + resolved "https://registry.yarnpkg.com/memoizee/-/memoizee-0.4.15.tgz#e6f3d2da863f318d02225391829a6c5956555b72" + integrity sha512-UBWmJpLZd5STPm7PMUlOw/TSy972M+z8gcyQ5veOnSDRREz/0bmpyTfKt3/51DhEBqCZQn1udM/5flcSPYhkdQ== + dependencies: + d "^1.0.1" + es5-ext "^0.10.53" + es6-weak-map "^2.0.3" + event-emitter "^0.3.5" + is-promise "^2.2.2" + lru-queue "^0.1.0" + next-tick "^1.1.0" + timers-ext "^0.1.7" + meow@^8.0.0: version "8.1.2" resolved "https://registry.yarnpkg.com/meow/-/meow-8.1.2.tgz#bcbe45bda0ee1729d350c03cffc8395a36c4e897" @@ -4710,6 +4968,18 @@ mkdirp@^0.5.5: dependencies: minimist "^1.2.5" +moment-timezone@^0.5.34, moment-timezone@^0.5.x: + version "0.5.34" + resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.34.tgz#a75938f7476b88f155d3504a9343f7519d9a405c" + integrity sha512-3zAEHh2hKUs3EXLESx/wsgw6IQdusOT8Bxm3D9UrHPQR7zlMmzwybC8zHEM1tQ4LJwP7fcxrWr8tuBg05fFCbg== + dependencies: + moment ">= 2.9.0" + +"moment@>= 2.9.0", moment@^2.29.1: + version "2.29.1" + resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.1.tgz#b2be769fa31940be9eeea6469c075e35006fa3d3" + integrity sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ== + ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" @@ -4735,6 +5005,16 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= +next-tick@1, next-tick@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb" + integrity sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ== + +next-tick@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c" + integrity sha1-yobR/ogoFpsBICCOPchCS524NCw= + next@^12.0.7: version "12.0.7" resolved "https://registry.yarnpkg.com/next/-/next-12.0.7.tgz#33ebf229b81b06e583ab5ae7613cffe1ca2103fc" @@ -4836,6 +5116,13 @@ node-releases@^2.0.1: resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.1.tgz#3d1d395f204f1f2f29a54358b9fb678765ad2fc5" integrity sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA== +nopt@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-5.0.0.tgz#530942bb58a512fccafe53fe210f13a25355dc88" + integrity sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ== + dependencies: + abbrev "1" + normalize-package-data@^2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" @@ -5063,6 +5350,11 @@ p-try@^2.0.0: resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== +packet-reader@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/packet-reader/-/packet-reader-1.0.0.tgz#9238e5480dedabacfe1fe3f2771063f164157d74" + integrity sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ== + pako@~1.0.5: version "1.0.11" resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf" @@ -5126,7 +5418,7 @@ path-key@^3.0.0, path-key@^3.1.0: resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== -path-parse@^1.0.6: +path-parse@^1.0.6, path-parse@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== @@ -5147,6 +5439,64 @@ pbkdf2@^3.0.3: safe-buffer "^5.0.1" sha.js "^2.4.8" +pg-connection-string@^2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/pg-connection-string/-/pg-connection-string-2.5.0.tgz#538cadd0f7e603fc09a12590f3b8a452c2c0cf34" + integrity sha512-r5o/V/ORTA6TmUnyWZR9nCj1klXCO2CEKNRlVuJptZe85QuhFayC7WeMic7ndayT5IRIR0S0xFxFi2ousartlQ== + +pg-hstore@^2.3.4: + version "2.3.4" + resolved "https://registry.yarnpkg.com/pg-hstore/-/pg-hstore-2.3.4.tgz#4425e3e2a3e15d2a334c35581186c27cf2e9b8dd" + integrity sha512-N3SGs/Rf+xA1M2/n0JBiXFDVMzdekwLZLAO0g7mpDY9ouX+fDI7jS6kTq3JujmYbtNSJ53TJ0q4G98KVZSM4EA== + dependencies: + underscore "^1.13.1" + +pg-int8@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/pg-int8/-/pg-int8-1.0.1.tgz#943bd463bf5b71b4170115f80f8efc9a0c0eb78c" + integrity sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw== + +pg-pool@^3.4.1: + version "3.4.1" + resolved "https://registry.yarnpkg.com/pg-pool/-/pg-pool-3.4.1.tgz#0e71ce2c67b442a5e862a9c182172c37eda71e9c" + integrity sha512-TVHxR/gf3MeJRvchgNHxsYsTCHQ+4wm3VIHSS19z8NC0+gioEhq1okDY1sm/TYbfoP6JLFx01s0ShvZ3puP/iQ== + +pg-protocol@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/pg-protocol/-/pg-protocol-1.5.0.tgz#b5dd452257314565e2d54ab3c132adc46565a6a0" + integrity sha512-muRttij7H8TqRNu/DxrAJQITO4Ac7RmX3Klyr/9mJEOBeIpgnF8f9jAfRz5d3XwQZl5qBjF9gLsUtMPJE0vezQ== + +pg-types@^2.1.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/pg-types/-/pg-types-2.2.0.tgz#2d0250d636454f7cfa3b6ae0382fdfa8063254a3" + integrity sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA== + dependencies: + pg-int8 "1.0.1" + postgres-array "~2.0.0" + postgres-bytea "~1.0.0" + postgres-date "~1.0.4" + postgres-interval "^1.1.0" + +pg@^8.7.1: + version "8.7.1" + resolved "https://registry.yarnpkg.com/pg/-/pg-8.7.1.tgz#9ea9d1ec225980c36f94e181d009ab9f4ce4c471" + integrity sha512-7bdYcv7V6U3KAtWjpQJJBww0UEsWuh4yQ/EjNf2HeO/NnvKjpvhEIe/A/TleP6wtmSKnUnghs5A9jUoK6iDdkA== + dependencies: + buffer-writer "2.0.0" + packet-reader "1.0.0" + pg-connection-string "^2.5.0" + pg-pool "^3.4.1" + pg-protocol "^1.5.0" + pg-types "^2.1.0" + pgpass "1.x" + +pgpass@1.x: + version "1.0.5" + resolved "https://registry.yarnpkg.com/pgpass/-/pgpass-1.0.5.tgz#9b873e4a564bb10fa7a7dbd55312728d422a223d" + integrity sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug== + dependencies: + split2 "^4.1.0" + picocolors@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" @@ -5195,6 +5545,28 @@ postcss@8.2.15: nanoid "^3.1.23" source-map "^0.6.1" +postgres-array@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/postgres-array/-/postgres-array-2.0.0.tgz#48f8fce054fbc69671999329b8834b772652d82e" + integrity sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA== + +postgres-bytea@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/postgres-bytea/-/postgres-bytea-1.0.0.tgz#027b533c0aa890e26d172d47cf9ccecc521acd35" + integrity sha1-AntTPAqokOJtFy1Hz5zOzFIazTU= + +postgres-date@~1.0.4: + version "1.0.7" + resolved "https://registry.yarnpkg.com/postgres-date/-/postgres-date-1.0.7.tgz#51bc086006005e5061c591cee727f2531bf641a8" + integrity sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q== + +postgres-interval@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/postgres-interval/-/postgres-interval-1.2.0.tgz#b460c82cb1587507788819a06aa0fffdb3544695" + integrity sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ== + dependencies: + xtend "^4.0.0" + prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" @@ -5259,11 +5631,21 @@ prop-types@^15.7.2: object-assign "^4.1.1" react-is "^16.8.1" +proto-list@~1.2.1: + version "1.2.4" + resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849" + integrity sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk= + proxy-from-env@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== +pseudomap@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM= + psl@^1.1.33: version "1.8.0" resolved "https://registry.yarnpkg.com/psl/-/psl-1.8.0.tgz#9326f8bcfb013adcc005fdff056acce020e51c24" @@ -5459,6 +5841,11 @@ require-directory@^2.1.1: resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= +require-main-filename@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" + integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== + requireindex@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/requireindex/-/requireindex-1.2.0.tgz#3463cdb22ee151902635aa6c9535d4de9c2ef1ef" @@ -5501,6 +5888,15 @@ resolve@^1.10.0, resolve@^1.12.0, resolve@^1.20.0: is-core-module "^2.2.0" path-parse "^1.0.6" +resolve@^1.5.0: + version "1.21.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.21.0.tgz#b51adc97f3472e6a5cf4444d34bc9d6b9037591f" + integrity sha512-3wCbTpk5WJlyE4mSOtDLhqQmGFi0/TD9VPwmiolnk8U0wRgMEktqCXd3vy5buTO3tljvalNvKrjHEfrd2WpEKA== + dependencies: + is-core-module "^2.8.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + resolve@^2.0.0-next.3: version "2.0.0-next.3" resolved "https://registry.yarnpkg.com/resolve/-/resolve-2.0.0-next.3.tgz#d41016293d4a8586a39ca5d9b5f15cbea1f55e46" @@ -5517,6 +5913,11 @@ restore-cursor@^3.1.0: onetime "^5.1.0" signal-exit "^3.0.2" +retry-as-promised@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/retry-as-promised/-/retry-as-promised-5.0.0.tgz#f4ecc25133603a2d2a7aff4a128691d7bc506d54" + integrity sha512-6S+5LvtTl2ggBumk04hBo/4Uf6fRJUwIgunGZ7CYEBCeufGFW1Pu6ucUf/UskHeWOIsUcLOGLFXPig5tR5V1nA== + reusify@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" @@ -5586,7 +5987,7 @@ scheduler@^0.20.2: loose-envify "^1.1.0" object-assign "^4.1.1" -"semver@2 || 3 || 4 || 5": +"semver@2 || 3 || 4 || 5", semver@^5.6.0: version "5.7.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== @@ -5603,7 +6004,46 @@ semver@^6.0.0, semver@^6.3.0: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== -set-blocking@~2.0.0: +sequelize-cli@^6.3.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/sequelize-cli/-/sequelize-cli-6.3.0.tgz#6eb42e1e73e68b18cb86ffb28d8c9f1bab336007" + integrity sha512-+SkTDSeQdo93k7ZtSn5FCVXiMp+KMvkIrGtdLydLaR8TMoAHPpzw1AZCW6MAsL9M1VxRWoCKBFhzMG5gtcYNsQ== + dependencies: + cli-color "^2.0.0" + fs-extra "^9.0.0" + js-beautify "^1.8.8" + lodash "^4.17.5" + resolve "^1.5.0" + umzug "^2.3.0" + yargs "^15.0.0" + +sequelize-pool@^7.1.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/sequelize-pool/-/sequelize-pool-7.1.0.tgz#210b391af4002762f823188fd6ecfc7413020768" + integrity sha512-G9c0qlIWQSK29pR/5U2JF5dDQeqqHRragoyahj/Nx4KOOQ3CPPfzxnfqFPCSB7x5UgjOgnZ61nSxz+fjDpRlJg== + +sequelize@^6.12.5: + version "6.12.5" + resolved "https://registry.yarnpkg.com/sequelize/-/sequelize-6.12.5.tgz#b2b41ab0f9301e10f5acab6ffd134dac325f111e" + integrity sha512-V//3SwPHMkPZi0amkCLlk2aNdS+qnLR0tTAzAYvhrxZ6t7JgMDiIO4R5+84nHZ0PwGE71RDXKOBBVhkYjABxhQ== + dependencies: + "@types/debug" "^4.1.7" + debug "^4.3.3" + dottie "^2.0.2" + inflection "^1.13.1" + lodash "^4.17.21" + moment "^2.29.1" + moment-timezone "^0.5.34" + pg-connection-string "^2.5.0" + retry-as-promised "^5.0.0" + semver "^7.3.5" + sequelize-pool "^7.1.0" + toposort-class "^1.0.1" + uuid "^8.3.2" + validator "^13.7.0" + wkx "^0.5.0" + +set-blocking@^2.0.0, set-blocking@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= @@ -5652,6 +6092,11 @@ side-channel@^1.0.4: get-intrinsic "^1.0.2" object-inspect "^1.9.0" +sigmund@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/sigmund/-/sigmund-1.0.1.tgz#3ff21f198cad2175f9f3b781853fd94d0d19b590" + integrity sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA= + signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.3: version "3.0.6" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.6.tgz#24e630c4b0f03fea446a2bd299e62b4a6ca8d0af" @@ -5756,6 +6201,11 @@ split2@^3.0.0: dependencies: readable-stream "^3.0.0" +split2@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/split2/-/split2-4.1.0.tgz#101907a24370f85bb782f08adaabe4e281ecf809" + integrity sha512-VBiJxFkxiXRlUIeyMQi8s4hgvKCSjtknJv/LVYbrgALPwf5zSKmEwV9Lst25AkvMDnvxODugjdl6KZgwKM1WYQ== + sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" @@ -6014,6 +6464,11 @@ supports-hyperlinks@^2.0.0: has-flag "^4.0.0" supports-color "^7.0.0" +supports-preserve-symlinks-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" + integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== + symbol-tree@^3.2.4: version "3.2.4" resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" @@ -6070,6 +6525,14 @@ timers-browserify@2.0.12: dependencies: setimmediate "^1.0.4" +timers-ext@^0.1.7: + version "0.1.7" + resolved "https://registry.yarnpkg.com/timers-ext/-/timers-ext-0.1.7.tgz#6f57ad8578e07a3fb9f91d9387d65647555e25c6" + integrity sha512-b85NUNzTSdodShTIbky6ZF02e8STtVVfD+fu4aXXShEELpozH+bCpJLYMPZbsABN2wDH7fJpqIoXxJpzbf0NqQ== + dependencies: + es5-ext "~0.10.46" + next-tick "1" + tmpl@1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" @@ -6092,6 +6555,11 @@ toidentifier@1.0.0: resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553" integrity sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw== +toposort-class@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/toposort-class/-/toposort-class-1.0.1.tgz#7ffd1f78c8be28c3ba45cd4e1a3f5ee193bd9988" + integrity sha1-f/0feMi+KMO6Rc1OGj9e4ZO9mYg= + tough-cookie@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.0.0.tgz#d822234eeca882f991f0f908824ad2622ddbece4" @@ -6224,6 +6692,16 @@ type-fest@^0.8.1: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== +type@^1.0.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/type/-/type-1.2.0.tgz#848dd7698dafa3e54a6c479e759c4bc3f18847a0" + integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg== + +type@^2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/type/-/type-2.5.0.tgz#0a2e78c2e77907b252abe5f298c1b01c63f0db3d" + integrity sha512-180WMDQaIMm3+7hGXWf12GtdniDEy7nYcyFMKJn/eZz/6tSLXrUN9V0wKSbMjej0I1WHWbpREDEKHtqPQa9NNw== + typedarray-to-buffer@^3.1.5: version "3.1.5" resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" @@ -6246,6 +6724,13 @@ typescript@^4.5.4: resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.4.tgz#a17d3a0263bf5c8723b9c52f43c5084edf13c2e8" integrity sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg== +umzug@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/umzug/-/umzug-2.3.0.tgz#0ef42b62df54e216b05dcaf627830a6a8b84a184" + integrity sha512-Z274K+e8goZK8QJxmbRPhl89HPO1K+ORFtm6rySPhFKfKc5GHhqdzD0SGhSWHkzoXasqJuItdhorSvY7/Cgflw== + dependencies: + bluebird "^3.7.2" + unbox-primitive@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.1.tgz#085e215625ec3162574dc8859abee78a59b14471" @@ -6256,6 +6741,11 @@ unbox-primitive@^1.0.1: has-symbols "^1.0.2" which-boxed-primitive "^1.0.2" +underscore@^1.13.1: + version "1.13.2" + resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.13.2.tgz#276cea1e8b9722a8dbed0100a407dda572125881" + integrity sha512-ekY1NhRzq0B08g4bGuX4wd2jZx5GnKz6mKSqFL4nqBlfyMGiG10gDFhDTMEfYmDL6Jy0FUIZp7wiRB+0BP7J2g== + universalify@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" @@ -6329,6 +6819,11 @@ validate-npm-package-license@^3.0.1: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" +validator@^13.7.0: + version "13.7.0" + resolved "https://registry.yarnpkg.com/validator/-/validator-13.7.0.tgz#4f9658ba13ba8f3d82ee881d3516489ea85c0857" + integrity sha512-nYXQLCBkpJ8X6ltALua9dRrZDHVYxjJ1wgskNt1lH9fzGjs3tgojGSCBjmEPwkWS1y29+DrizMTW19Pr9uB2nw== + vm-browserify@1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0" @@ -6432,6 +6927,11 @@ which-boxed-primitive@^1.0.2: is-string "^1.0.5" is-symbol "^1.0.3" +which-module@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" + integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= + which-typed-array@^1.1.2: version "1.1.7" resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.7.tgz#2761799b9a22d4b8660b3c1b40abaa7739691793" @@ -6458,6 +6958,13 @@ wide-align@^1.1.0: dependencies: string-width "^1.0.2 || 2 || 3 || 4" +wkx@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/wkx/-/wkx-0.5.0.tgz#c6c37019acf40e517cc6b94657a25a3d4aa33e8c" + integrity sha512-Xng/d4Ichh8uN4l0FToV/258EjMGU9MGcA0HV2d9B/ZpZB3lqQm7nkOdZdm5GhKtLLhAE7PiVQwN4eN+2YJJUg== + dependencies: + "@types/node" "*" + word-wrap@^1.2.3, word-wrap@~1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" @@ -6511,16 +7018,26 @@ xmlchars@^2.2.0: resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== -xtend@^4.0.2: +xtend@^4.0.0, xtend@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== +y18n@^4.0.0: + version "4.0.3" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf" + integrity sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ== + y18n@^5.0.5: version "5.0.8" resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== +yallist@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" + integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI= + yallist@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" @@ -6531,6 +7048,14 @@ yaml@^1.10.0, yaml@^1.10.2: resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== +yargs-parser@^18.1.2: + version "18.1.3" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0" + integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + yargs-parser@^20.2.2, yargs-parser@^20.2.3: version "20.2.9" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" @@ -6541,6 +7066,23 @@ yargs-parser@^21.0.0: resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.0.0.tgz#a485d3966be4317426dd56bdb6a30131b281dc55" integrity sha512-z9kApYUOCwoeZ78rfRYYWdiU/iNL6mwwYlkkZfJoyMR1xps+NEBX5X7XmRpxkZHhXJ6+Ey00IwKxBBSW9FIjyA== +yargs@^15.0.0: + version "15.4.1" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8" + integrity sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A== + dependencies: + cliui "^6.0.0" + decamelize "^1.2.0" + find-up "^4.1.0" + get-caller-file "^2.0.1" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^4.2.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^18.1.2" + yargs@^16.2.0: version "16.2.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" From ddc0bb88529df7d19621cb70d8214d78a418498a Mon Sep 17 00:00:00 2001 From: Desoindx Date: Wed, 5 Jan 2022 17:34:50 +0100 Subject: [PATCH 02/12] Add a healthz route --- .../__tests__/__snapshots__/deploy.js.snap | 204 ------------------ .socialgouv/__tests__/deploy.js | 27 --- .socialgouv/config.json | 9 +- src/pages/healthz.tsx | 5 + 4 files changed, 7 insertions(+), 238 deletions(-) delete mode 100644 .socialgouv/__tests__/__snapshots__/deploy.js.snap delete mode 100644 .socialgouv/__tests__/deploy.js create mode 100644 src/pages/healthz.tsx diff --git a/.socialgouv/__tests__/__snapshots__/deploy.js.snap b/.socialgouv/__tests__/__snapshots__/deploy.js.snap deleted file mode 100644 index 7cafab6d..00000000 --- a/.socialgouv/__tests__/__snapshots__/deploy.js.snap +++ /dev/null @@ -1,204 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`deploy dev 2 1`] = ` -"--- -apiVersion: networking.k8s.io/v1 -kind: NetworkPolicy -metadata: - name: netpol-monpsy - namespace: monpsy -spec: - ingress: - - from: - - podSelector: {} - - from: - - namespaceSelector: - matchLabels: - network-policy/source: ingress-controller - - from: - - namespaceSelector: - matchLabels: - network-policy/source: monitoring - podSelector: {} - policyTypes: - - Ingress ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - annotations: - kapp.k14s.io/disable-default-ownership-label-rules: '' - kapp.k14s.io/disable-default-label-scoping-rules: '' - app.github.com/job: '5678' - app.github.com/ref: refs/tags/v1.2.3 - app.github.com/repo: socialgouv/monpsy - app.github.com/run: '1234' - app.github.com/sha: '0123456' - labels: - app: app - application: monpsy - component: nginx - owner: monpsy - team: monpsy - name: app - namespace: monpsy -spec: - replicas: 1 - selector: - matchLabels: - app: app - template: - metadata: - annotations: - kapp.k14s.io/disable-default-ownership-label-rules: '' - kapp.k14s.io/disable-default-label-scoping-rules: '' - app.github.com/job: '5678' - app.github.com/ref: refs/tags/v1.2.3 - app.github.com/repo: socialgouv/monpsy - app.github.com/run: '1234' - app.github.com/sha: '0123456' - labels: - app: app - application: monpsy - component: nginx - owner: monpsy - team: monpsy - spec: - containers: - - image: ghcr.io/socialgouv/mon-psy-sante/app:1.2.3 - livenessProbe: - failureThreshold: 6 - httpGet: - path: /index.html - port: http - initialDelaySeconds: 30 - periodSeconds: 5 - timeoutSeconds: 5 - name: app - ports: - - containerPort: 80 - name: http - readinessProbe: - failureThreshold: 15 - httpGet: - path: /index.html - port: http - initialDelaySeconds: 0 - periodSeconds: 5 - successThreshold: 1 - timeoutSeconds: 1 - resources: - limits: - cpu: 500m - memory: 128Mi - requests: - cpu: 5m - memory: 32Mi - startupProbe: - failureThreshold: 12 - httpGet: - path: /index.html - port: http - periodSeconds: 5 ---- -apiVersion: v1 -kind: Service -metadata: - labels: - app: app - application: monpsy - component: nginx - owner: monpsy - team: monpsy - name: app - annotations: - kapp.k14s.io/disable-default-ownership-label-rules: '' - kapp.k14s.io/disable-default-label-scoping-rules: '' - app.github.com/job: '5678' - app.github.com/ref: refs/tags/v1.2.3 - app.github.com/repo: socialgouv/monpsy - app.github.com/run: '1234' - app.github.com/sha: '0123456' - namespace: monpsy -spec: - ports: - - name: http - port: 80 - targetPort: 80 - selector: - app: app - type: ClusterIP ---- -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - annotations: - kubernetes.io/ingress.class: nginx - cert-manager.io/cluster-issuer: letsencrypt-prod - kubernetes.io/tls-acme: 'true' - kapp.k14s.io/disable-default-ownership-label-rules: '' - kapp.k14s.io/disable-default-label-scoping-rules: '' - app.github.com/job: '5678' - app.github.com/ref: refs/tags/v1.2.3 - app.github.com/repo: socialgouv/monpsy - app.github.com/run: '1234' - app.github.com/sha: '0123456' - nginx.ingress.kubernetes.io/configuration-snippet: >- - more_set_headers \\"Content-Security-Policy: default-src 'none'; connect-src - 'self' https://*.gouv.fr https://services.sarbacane.com; font-src 'self' - data:; img-src 'self' data: https://forms.sbc08.com; prefetch-src 'self' - https://*.gouv.fr; script-src 'self' https://*.gouv.fr - https://*.sbc08.com; frame-src 'self' https://*.gouv.fr; style-src 'self' - 'unsafe-inline'\\"; - - more_set_headers \\"X-Frame-Options: deny\\"; - - more_set_headers \\"X-XSS-Protection: 1; mode=block\\"; - - more_set_headers \\"X-Content-Type-Options: nosniff\\"; - labels: - app: app - application: monpsy - component: nginx - owner: monpsy - team: monpsy - name: app - namespace: monpsy -spec: - rules: - - host: monpsy.fabrique.social.gouv.fr - http: - paths: - - backend: - service: - name: app - port: - name: http - path: / - pathType: Prefix - tls: - - hosts: - - monpsy.fabrique.social.gouv.fr - secretName: app-crt ---- -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - annotations: - kubernetes.io/ingress.class: nginx - nginx.ingress.kubernetes.io/permanent-redirect: https://monpsy.sante.gouv.fr$request_uri - cert-manager.io/cluster-issuer: letsencrypt-prod - kubernetes.io/tls-acme: 'true' - labels: - app.kubernetes.io/component: redirect - app.kubernetes.io/name: www - name: monpsy-redirect -spec: - rules: - - host: www.monpsy.sante.gouv.fr - tls: - - hosts: - - www.monpsy.sante.gouv.fr - secretName: monpsy-redirect -" -`; diff --git a/.socialgouv/__tests__/deploy.js b/.socialgouv/__tests__/deploy.js deleted file mode 100644 index e2acd108..00000000 --- a/.socialgouv/__tests__/deploy.js +++ /dev/null @@ -1,27 +0,0 @@ -import util from "util"; -import { directory } from "tempy"; -import { project } from "@socialgouv/kosko-charts/testing/fake/github-actions.env"; - -const exec = util.promisify(require("child_process").exec); - -jest.setTimeout(1000 * 60); - -test("deploy dev 2", async () => { - const dir = directory(); - const env = project("monpsy").prod; - - env.SOCIALGOUV_CONFIG_PATH = `${dir}/autodevops/config.json`; - - Object.assign(process.env, env); - - const cmd = ` - npx degit SocialGouv/kosko-charts/templates/autodevops ${dir}/autodevops; \ - yarn --cwd ${dir}/autodevops --silent; \ - cp -r ${__dirname}/../environments ${__dirname}/../config.json ${dir}/autodevops/; \ - yarn --cwd ${dir}/autodevops --silent generate --env prod - `; - - const { stdout: manifest } = await exec(cmd, { env: process.env }); - - expect(manifest).toMatchSnapshot(); -}); diff --git a/.socialgouv/config.json b/.socialgouv/config.json index 81237a9a..9bf86829 100644 --- a/.socialgouv/config.json +++ b/.socialgouv/config.json @@ -1,12 +1,7 @@ { "name": "app", - "type": "static", + "type": "app", "subdomain": "monpsy", "registry": "ghcr", - "project": "mon-psy-sante", - "ingress": { - "annotations": { - "nginx.ingress.kubernetes.io/configuration-snippet": "more_set_headers \"Content-Security-Policy: default-src 'none'; connect-src 'self' https://*.gouv.fr https://services.sarbacane.com; font-src 'self' data:; img-src 'self' data: https://forms.sbc08.com; prefetch-src 'self' https://*.gouv.fr; script-src 'self' https://*.gouv.fr https://*.sbc08.com; frame-src 'self' https://*.gouv.fr; style-src 'self' 'unsafe-inline'\";\nmore_set_headers \"X-Frame-Options: deny\";\nmore_set_headers \"X-XSS-Protection: 1; mode=block\";\nmore_set_headers \"X-Content-Type-Options: nosniff\";" - } - } + "project": "mon-psy-sante" } diff --git a/src/pages/healthz.tsx b/src/pages/healthz.tsx new file mode 100644 index 00000000..a565069a --- /dev/null +++ b/src/pages/healthz.tsx @@ -0,0 +1,5 @@ +import React from "react"; + +export default function Healthz() { + return
; +} From c3b63497365ebf282b344f2b4eb97355736757f8 Mon Sep 17 00:00:00 2001 From: Desoindx Date: Mon, 10 Jan 2022 10:39:04 +0100 Subject: [PATCH 03/12] Change type directory --- src/components/Directory.tsx | 2 +- src/db/seeds/index.ts | 2 +- src/services/demarchesSimplifiees/buildRequest.ts | 2 +- src/services/demarchesSimplifiees/import.ts | 4 ++-- src/services/demarchesSimplifiees/parsePsychologists.ts | 2 +- src/services/getAddressCoordinates.ts | 2 +- src/services/psychologists.ts | 2 +- {types => src/types}/coordinates.d.ts | 0 {types => src/types}/demarcheSimplifiee.d.ts | 0 {types => src/types}/psychologist.d.ts | 0 10 files changed, 8 insertions(+), 8 deletions(-) rename {types => src/types}/coordinates.d.ts (100%) rename {types => src/types}/demarcheSimplifiee.d.ts (100%) rename {types => src/types}/psychologist.d.ts (100%) diff --git a/src/components/Directory.tsx b/src/components/Directory.tsx index a82af8df..7d41a2c5 100644 --- a/src/components/Directory.tsx +++ b/src/components/Directory.tsx @@ -2,7 +2,7 @@ import { Button, Table } from "@dataesr/react-dsfr"; import axios from "axios"; import React, { useEffect, useRef, useState } from "react"; -import { Psychologist } from "../../types/psychologist"; +import { Psychologist } from "../types/psychologist"; const columns = [ { diff --git a/src/db/seeds/index.ts b/src/db/seeds/index.ts index 20423156..a8e39a90 100644 --- a/src/db/seeds/index.ts +++ b/src/db/seeds/index.ts @@ -1,7 +1,7 @@ import * as dotenv from "dotenv"; import faker from "faker"; -import { Psychologist } from "../../../types/psychologist"; +import { Psychologist } from "../../types/psychologist"; import { models } from "../models"; const NUMBER_OF_PSYCHOLOGISTS = 1000; diff --git a/src/services/demarchesSimplifiees/buildRequest.ts b/src/services/demarchesSimplifiees/buildRequest.ts index b7b7913b..2fad397e 100644 --- a/src/services/demarchesSimplifiees/buildRequest.ts +++ b/src/services/demarchesSimplifiees/buildRequest.ts @@ -1,6 +1,6 @@ import { gql } from "graphql-request"; -import { DSResponse } from "../../../types/demarcheSimplifiee"; +import { DSResponse } from "../../types/demarcheSimplifiee"; import config from "../config"; import { request } from "./request"; diff --git a/src/services/demarchesSimplifiees/import.ts b/src/services/demarchesSimplifiees/import.ts index a688a0a6..ec2f4b90 100644 --- a/src/services/demarchesSimplifiees/import.ts +++ b/src/services/demarchesSimplifiees/import.ts @@ -1,5 +1,5 @@ -import { DSResponse } from "../../../types/demarcheSimplifiee"; -import { DSPsychologist, Psychologist } from "../../../types/psychologist"; +import { DSResponse } from "../../types/demarcheSimplifiee"; +import { DSPsychologist, Psychologist } from "../../types/psychologist"; import { requestPsychologists } from "./buildRequest"; import parsePsychologists from "./parsePsychologists"; diff --git a/src/services/demarchesSimplifiees/parsePsychologists.ts b/src/services/demarchesSimplifiees/parsePsychologists.ts index 1cd6abc3..a31f845f 100644 --- a/src/services/demarchesSimplifiees/parsePsychologists.ts +++ b/src/services/demarchesSimplifiees/parsePsychologists.ts @@ -1,4 +1,4 @@ -import { DSPsychologist, Psychologist } from "../../../types/psychologist"; +import { DSPsychologist, Psychologist } from "../../types/psychologist"; import config from "../config"; import getAddressCoordinates from "../getAddressCoordinates"; diff --git a/src/services/getAddressCoordinates.ts b/src/services/getAddressCoordinates.ts index 1c9a1a36..e657a712 100644 --- a/src/services/getAddressCoordinates.ts +++ b/src/services/getAddressCoordinates.ts @@ -1,6 +1,6 @@ import axios from "axios/index"; -import { Coordinates, CoordinatesAPI } from "../../types/coordinates"; +import { Coordinates, CoordinatesAPI } from "../types/coordinates"; import config from "./config"; const ADDRESS_DELIMITER = ";"; diff --git a/src/services/psychologists.ts b/src/services/psychologists.ts index ede1a74c..3c1a88e6 100644 --- a/src/services/psychologists.ts +++ b/src/services/psychologists.ts @@ -1,5 +1,5 @@ -import { Psychologist } from "../../types/psychologist"; import { models } from "../db/models"; +import { Psychologist } from "../types/psychologist"; export const getAll = async () => { return models.Psychologist.findAll({ raw: true }); diff --git a/types/coordinates.d.ts b/src/types/coordinates.d.ts similarity index 100% rename from types/coordinates.d.ts rename to src/types/coordinates.d.ts diff --git a/types/demarcheSimplifiee.d.ts b/src/types/demarcheSimplifiee.d.ts similarity index 100% rename from types/demarcheSimplifiee.d.ts rename to src/types/demarcheSimplifiee.d.ts diff --git a/types/psychologist.d.ts b/src/types/psychologist.d.ts similarity index 100% rename from types/psychologist.d.ts rename to src/types/psychologist.d.ts From ed79152375451082df157fbe167e32542b531ac1 Mon Sep 17 00:00:00 2001 From: Desoindx Date: Mon, 10 Jan 2022 10:39:19 +0100 Subject: [PATCH 04/12] Add env variables --- .env.development | 1 - .socialgouv/environments/dev/app.configmap.yaml | 6 ++++++ next.config.js | 3 --- src/components/Directory.tsx | 13 ++++++++++--- src/db/seeds/index.ts | 2 -- src/pages/annuaire.tsx | 10 +++------- src/pages/api/psychologists.ts | 1 - src/services/config.ts | 12 +++++++----- 8 files changed, 26 insertions(+), 22 deletions(-) create mode 100644 .socialgouv/environments/dev/app.configmap.yaml diff --git a/.env.development b/.env.development index aced99f3..3a66cfff 100644 --- a/.env.development +++ b/.env.development @@ -1,7 +1,6 @@ NEXT_TELEMETRY_DISABLED=1 POSTGRESQL_URL=postgres://monpsysante:monpsysante@localhost:5432/monpsysante DB_LOGGING_ENABLE=true -DISPLAY_DIRECTORY=true DEMARCHES_SIMPLIFIEES_TOKEN=api-token DEMARCHES_SIMPLIFIEES_ID=52209 diff --git a/.socialgouv/environments/dev/app.configmap.yaml b/.socialgouv/environments/dev/app.configmap.yaml new file mode 100644 index 00000000..75d2c623 --- /dev/null +++ b/.socialgouv/environments/dev/app.configmap.yaml @@ -0,0 +1,6 @@ +kind: ConfigMap +apiVersion: v1 +metadata: + name: app-configmap +data: + NEXT_PUBLIC_DISPLAY_DIRECTORY: "true" \ No newline at end of file diff --git a/next.config.js b/next.config.js index 1c9da8ae..6bafca70 100644 --- a/next.config.js +++ b/next.config.js @@ -20,8 +20,5 @@ module.exports = withSentryConfig( } return config; }, - env: { - DISPLAY_DIRECTORY: process.env.DISPLAY_DIRECTORY === "true" - } }) ); diff --git a/src/components/Directory.tsx b/src/components/Directory.tsx index 7d41a2c5..eac941e9 100644 --- a/src/components/Directory.tsx +++ b/src/components/Directory.tsx @@ -1,5 +1,6 @@ import { Button, Table } from "@dataesr/react-dsfr"; import axios from "axios"; +import { useRouter } from "next/router"; import React, { useEffect, useRef, useState } from "react"; import { Psychologist } from "../types/psychologist"; @@ -40,13 +41,19 @@ const columns = [ ]; const Directory = () => { + const router = useRouter(); const table = useRef(null); const [psychologists, setPsychologists] = useState(); const [currentPage, setCurrentPage] = useState(1); useEffect(() => { - axios - .get("/api/psychologists") - .then((response) => setPsychologists(response.data)); + console.log(process.env.NEXT_PUBLIC_DISPLAY_DIRECTORY); + if (process.env.NEXT_PUBLIC_DISPLAY_DIRECTORY !== "true") { + router.push("/"); + } else { + axios + .get("/api/psychologists") + .then((response) => setPsychologists(response.data)); + } }, []); if (!psychologists) { diff --git a/src/db/seeds/index.ts b/src/db/seeds/index.ts index a8e39a90..53c9e4c9 100644 --- a/src/db/seeds/index.ts +++ b/src/db/seeds/index.ts @@ -1,4 +1,3 @@ -import * as dotenv from "dotenv"; import faker from "faker"; import { Psychologist } from "../../types/psychologist"; @@ -46,5 +45,4 @@ const createAllData = async () => { await createPsychologists(); }; -dotenv.config(); createAllData(); diff --git a/src/pages/annuaire.tsx b/src/pages/annuaire.tsx index f1484791..854f83cd 100644 --- a/src/pages/annuaire.tsx +++ b/src/pages/annuaire.tsx @@ -1,15 +1,9 @@ -import { useRouter } from "next/router"; import React, { useEffect } from "react"; import Directory from "../components/Directory"; -export default () => { - const router = useRouter(); +const Annuaire = () => { useEffect(() => { - if (!process.env.DISPLAY_DIRECTORY) { - router.push("/"); - } - document.title = "MonPsySanté - Annuaire"; }, []); @@ -21,3 +15,5 @@ export default () => {
); }; + +export default Annuaire; diff --git a/src/pages/api/psychologists.ts b/src/pages/api/psychologists.ts index bc5dbbd2..382d67ec 100644 --- a/src/pages/api/psychologists.ts +++ b/src/pages/api/psychologists.ts @@ -6,7 +6,6 @@ import { getAll } from "../../services/psychologists"; const psychologists = async (req: NextApiRequest, res: NextApiResponse) => { if (req.method === "GET") { - console.log(config); if (!config.displayDirectory) { return res.status(200).json([]); } diff --git a/src/services/config.ts b/src/services/config.ts index 96f32263..3f673393 100644 --- a/src/services/config.ts +++ b/src/services/config.ts @@ -1,7 +1,9 @@ -import dotenv from "dotenv"; - -dotenv.config(); +const parseBoolean = (value: string) => value === "true"; +console.log( + process.env.NEXT_PUBLIC_DISPLAY_DIRECTORY, + process.env.NEXT_PUBLIC_DISPLAY_DIRECTORY === "true" +); export default { demarchesSimplifiees: { apiToken: process.env.DEMARCHES_SIMPLIFIEES_TOKEN, @@ -9,10 +11,10 @@ export default { champs: process.env.DEMARCHES_SIMPLIFIEES_CHAMPS, id: process.env.DEMARCHES_SIMPLIFIEES_ID, }, - displayDirectory: process.env.DISPLAY_DIRECTORY, + displayDirectory: parseBoolean(process.env.NEXT_PUBLIC_DISPLAY_DIRECTORY), minScoreAddress: parseFloat(process.env.MIN_SCORE_ADDRESS || "0.55"), postgre: { - logging: process.env.DB_LOGGING_ENABLE === "true", + logging: parseBoolean(process.env.DB_LOGGING_ENABLE), url: process.env.POSTGRESQL_URL, }, }; From 1dabc42529745531ec0dd3a5e951778d5ecc2b34 Mon Sep 17 00:00:00 2001 From: Desoindx Date: Mon, 10 Jan 2022 09:11:57 +0100 Subject: [PATCH 05/12] Add ts-node --- .eslintignore | 1 + package.json | 8 ++++--- src/db/config/{config.ts => config.js} | 5 ++-- yarn.lock | 32 ++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 6 deletions(-) rename src/db/config/{config.ts => config.js} (83%) diff --git a/.eslintignore b/.eslintignore index c349970a..bd05c4e9 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +1,2 @@ src/db/migrations/ +src/db/config/ \ No newline at end of file diff --git a/package.json b/package.json index 931cc9e2..be5d3798 100644 --- a/package.json +++ b/package.json @@ -15,11 +15,14 @@ "@sentry/nextjs": "^6.16.1", "@socialgouv/bootstrap.core": "^0.2.1", "@socialgouv/matomo-next": "^1.2.2", + "@types/faker": "^5.5.9", + "@types/sequelize": "^4.28.11", "@typescript-eslint/eslint-plugin": "^5.9.0", "@zeit/next-source-maps": "^0.0.3", "axios": "^0.24.0", "cron": "^1.8.2", "dotenv": "^10.0.0", + "faker": "^5.5.3", "graphql": "^16.2.0", "graphql-request": "^3.7.0", "next": "^12.0.7", @@ -28,6 +31,8 @@ "react": "^17.0.2", "react-dom": "^17.0.2", "sequelize": "^6.12.5", + "sequelize-cli": "^6.3.0", + "ts-node": "^10.4.0", "typescript-eslint": "^0.0.1-alpha.0" }, "devDependencies": { @@ -35,16 +40,13 @@ "@commitlint/config-conventional": "^16.0.0", "@socialgouv/eslint-config-react": "^1.101.0", "@socialgouv/eslint-config-recommended": "^1.101.0", - "@types/faker": "^5.5.9", "@types/react": "^17.0.38", "eslint": "^8.6.0", "eslint-config-next": "^12.0.7", "eslint-plugin-import": "^2.25.4", - "faker": "^5.5.3", "jest": "^27.4.5", "lint-staged": "^12.1.5", "prettier": "^2.5.1", - "sequelize-cli": "^6.3.0", "typescript": "^4.5.4" }, "license": "MIT", diff --git a/src/db/config/config.ts b/src/db/config/config.js similarity index 83% rename from src/db/config/config.ts rename to src/db/config/config.js index 0a839862..0c6e9c2a 100644 --- a/src/db/config/config.ts +++ b/src/db/config/config.js @@ -1,8 +1,7 @@ -import dotenv from "dotenv"; - +var dotenv = require("dotenv"); dotenv.config(); -export default { +module.exports = { development: { dialect: "postgres", url: process.env.POSTGRESQL_URL, diff --git a/yarn.lock b/yarn.lock index c7369c05..27e9f194 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1150,6 +1150,18 @@ dependencies: "@babel/types" "^7.3.0" +"@types/bluebird@*": + version "3.5.36" + resolved "https://registry.yarnpkg.com/@types/bluebird/-/bluebird-3.5.36.tgz#00d9301d4dc35c2f6465a8aec634bb533674c652" + integrity sha512-HBNx4lhkxN7bx6P0++W8E289foSu8kO8GCk2unhuVggO+cE7rh9DhZUyPhUxNRG9m+5B5BTKxZQ5ZP92x/mx9Q== + +"@types/continuation-local-storage@*": + version "3.2.4" + resolved "https://registry.yarnpkg.com/@types/continuation-local-storage/-/continuation-local-storage-3.2.4.tgz#655c8ffd9327aa60fb8ae773a5f2efbc973a7cbb" + integrity sha512-OT32vCVMymU1JMPKDeY0lX3cduAr0Pm/VwIbxygMeDS4lRcv57qYXn9bMwBRcRnEpXKBb/r4xYaZCARTZllP0A== + dependencies: + "@types/node" "*" + "@types/debug@^4.1.7": version "4.1.7" resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.7.tgz#7cc0ea761509124709b8b2d1090d8f6c17aadb82" @@ -1203,6 +1215,11 @@ resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= +"@types/lodash@*": + version "4.14.178" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.178.tgz#341f6d2247db528d4a13ddbb374bcdc80406f4f8" + integrity sha512-0d5Wd09ItQWH1qFbEyQ7oTQ3GZrMfth5JkbN3EvTKLXcHLRDSXeLnlvlOn0wvxVIwK5o2M8JzP/OWz7T3NRsbw== + "@types/minimist@^1.2.0": version "1.2.2" resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.2.tgz#ee771e2ba4b3dc5b372935d549fd9617bf345b8c" @@ -1252,11 +1269,26 @@ resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.2.tgz#1a62f89525723dde24ba1b01b092bf5df8ad4d39" integrity sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew== +"@types/sequelize@^4.28.11": + version "4.28.11" + resolved "https://registry.yarnpkg.com/@types/sequelize/-/sequelize-4.28.11.tgz#8b0c530bac4e6d73a0416a94db0de820cc4d47c3" + integrity sha512-2zeMcB5ZI+u1UwxM4sa3gLu8eSp0Gk+emTKPWXuNk3ePFo4EUYLgmIhGV6b+kYoshXpZHG3nJVMK00tuh5vEQA== + dependencies: + "@types/bluebird" "*" + "@types/continuation-local-storage" "*" + "@types/lodash" "*" + "@types/validator" "*" + "@types/stack-utils@^2.0.0": version "2.0.1" resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c" integrity sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw== +"@types/validator@*": + version "13.7.1" + resolved "https://registry.yarnpkg.com/@types/validator/-/validator-13.7.1.tgz#cdab1b4779f6b1718a08de89d92d2603b71950cb" + integrity sha512-I6OUIZ5cYRk5lp14xSOAiXjWrfVoMZVjDuevBYgQDYzZIjsf2CAISpEcXOkFAtpAHbmWIDLcZObejqny/9xq5Q== + "@types/yargs-parser@*": version "20.2.1" resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-20.2.1.tgz#3b9ce2489919d9e4fea439b76916abc34b2df129" From fe7ffa54db9cb2e037a91794c1acdf47fc03a08f Mon Sep 17 00:00:00 2001 From: Desoindx Date: Mon, 10 Jan 2022 12:46:49 +0100 Subject: [PATCH 06/12] Test .env --- .env.staging | 10 ++++++++++ .socialgouv/environments/dev/app.configmap.yaml | 6 ------ Dockerfile | 3 +++ src/components/Directory.tsx | 1 - src/services/config.ts | 4 ---- 5 files changed, 13 insertions(+), 11 deletions(-) create mode 100644 .env.staging delete mode 100644 .socialgouv/environments/dev/app.configmap.yaml diff --git a/.env.staging b/.env.staging new file mode 100644 index 00000000..10feac4f --- /dev/null +++ b/.env.staging @@ -0,0 +1,10 @@ +NEXT_TELEMETRY_DISABLED=1 +POSTGRESQL_URL=postgres://monpsysante:monpsysante@localhost:5432/monpsysante +DB_LOGGING_ENABLE=true + + +DEMARCHES_SIMPLIFIEES_TOKEN=api-token +DEMARCHES_SIMPLIFIEES_ID=52209 +DEMARCHES_SIMPLIFIEES_CHAMPS=[["Q2hhbXAtMTYwMzgwNQ==", "phone"], ["Q2hhbXAtMTYyNzkzOQ==", "address"], ["Q2hhbXAtMTYwMTE4Ng==", "emailPro"], ["Q2hhbXAtMTYzOTUyNA==", "teleconsultation"], ["Q2hhbXAtMTY2MDM0Nw==", "languages"], ["Q2hhbXAtMTYzOTQwMQ==", "website"]] + +NEXT_PUBLIC_DISPLAY_DIRECTORY=true \ No newline at end of file diff --git a/.socialgouv/environments/dev/app.configmap.yaml b/.socialgouv/environments/dev/app.configmap.yaml deleted file mode 100644 index 75d2c623..00000000 --- a/.socialgouv/environments/dev/app.configmap.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: ConfigMap -apiVersion: v1 -metadata: - name: app-configmap -data: - NEXT_PUBLIC_DISPLAY_DIRECTORY: "true" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index fb787c10..c3542ba5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,9 +4,12 @@ FROM node:14-alpine AS builder RUN apk add --no-cache libc6-compat WORKDIR /app + COPY package.json yarn.lock ./ RUN yarn install --frozen-lockfile COPY . . + +RUN if [ -z "$PRODUCTION" ]; then cp .env.staging .env.production; fi RUN yarn build && yarn install --production --ignore-scripts --prefer-offline # Production image, copy all the files and run next diff --git a/src/components/Directory.tsx b/src/components/Directory.tsx index eac941e9..966773b7 100644 --- a/src/components/Directory.tsx +++ b/src/components/Directory.tsx @@ -46,7 +46,6 @@ const Directory = () => { const [psychologists, setPsychologists] = useState(); const [currentPage, setCurrentPage] = useState(1); useEffect(() => { - console.log(process.env.NEXT_PUBLIC_DISPLAY_DIRECTORY); if (process.env.NEXT_PUBLIC_DISPLAY_DIRECTORY !== "true") { router.push("/"); } else { diff --git a/src/services/config.ts b/src/services/config.ts index 3f673393..15293084 100644 --- a/src/services/config.ts +++ b/src/services/config.ts @@ -1,9 +1,5 @@ const parseBoolean = (value: string) => value === "true"; -console.log( - process.env.NEXT_PUBLIC_DISPLAY_DIRECTORY, - process.env.NEXT_PUBLIC_DISPLAY_DIRECTORY === "true" -); export default { demarchesSimplifiees: { apiToken: process.env.DEMARCHES_SIMPLIFIEES_TOKEN, From 52d03e24e140e9a3ae4d63049dcad88c26f652bf Mon Sep 17 00:00:00 2001 From: Desoindx Date: Tue, 11 Jan 2022 11:08:46 +0100 Subject: [PATCH 07/12] Add a nice geolocation --- docker-compose.yaml | 2 +- package.json | 18 +- src/components/Directory.tsx | 271 +++++- src/components/utils/departments.ts | 28 + src/css/style.css | 9 + src/db/migrations/20220105084912-add-psy.js | 9 +- src/db/models/psychologist.ts | 3 +- src/db/seeds/index.ts | 9 +- src/pages/annuaire.tsx | 4 +- .../index.ts} | 9 +- src/services/config.ts | 4 + .../parsePsychologists.ts | 6 +- src/services/psychologists.ts | 41 +- src/types/enums/filters.ts | 4 + src/types/psychologist.d.ts | 3 +- yarn.lock | 876 +++++++++++------- 16 files changed, 886 insertions(+), 410 deletions(-) create mode 100644 src/components/utils/departments.ts rename src/pages/api/{psychologists.ts => psychologists/index.ts} (59%) create mode 100644 src/types/enums/filters.ts diff --git a/docker-compose.yaml b/docker-compose.yaml index 7ffd50ba..34f75eb0 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -2,7 +2,7 @@ version: "3.6" services: db: - image: postgres:14 + image: postgis/postgis:14-master volumes: - db_data:/var/lib/postgresql/data ports: diff --git a/package.json b/package.json index be5d3798..2f18537d 100644 --- a/package.json +++ b/package.json @@ -11,32 +11,34 @@ "url": "git+https://github.com/SocialGouv/mon-psy-sante" }, "dependencies": { - "@dataesr/react-dsfr": "^0.9.4", + "@dataesr/react-dsfr": "^0.9.8", "@sentry/nextjs": "^6.16.1", "@socialgouv/bootstrap.core": "^0.2.1", "@socialgouv/matomo-next": "^1.2.2", "@types/faker": "^5.5.9", "@types/sequelize": "^4.28.11", - "@typescript-eslint/eslint-plugin": "^5.9.0", + "@typescript-eslint/eslint-plugin": "^5.9.1", "@zeit/next-source-maps": "^0.0.3", "axios": "^0.24.0", "cron": "^1.8.2", - "dotenv": "^10.0.0", - "faker": "^5.5.3", + "dotenv": "^11.0.0", + "faker": "^6.6.6", "graphql": "^16.2.0", "graphql-request": "^3.7.0", + "leaflet": "^1.7.1", "next": "^12.0.7", "pg": "^8.7.1", "pg-hstore": "^2.3.4", "react": "^17.0.2", "react-dom": "^17.0.2", - "sequelize": "^6.12.5", + "react-leaflet": "^3.2.4", + "sequelize": "^6.13.0", "sequelize-cli": "^6.3.0", "ts-node": "^10.4.0", "typescript-eslint": "^0.0.1-alpha.0" }, "devDependencies": { - "@commitlint/cli": "^16.0.1", + "@commitlint/cli": "^16.0.2", "@commitlint/config-conventional": "^16.0.0", "@socialgouv/eslint-config-react": "^1.101.0", "@socialgouv/eslint-config-recommended": "^1.101.0", @@ -44,8 +46,8 @@ "eslint": "^8.6.0", "eslint-config-next": "^12.0.7", "eslint-plugin-import": "^2.25.4", - "jest": "^27.4.5", - "lint-staged": "^12.1.5", + "jest": "^27.4.7", + "lint-staged": "^12.1.7", "prettier": "^2.5.1", "typescript": "^4.5.4" }, diff --git a/src/components/Directory.tsx b/src/components/Directory.tsx index 966773b7..e8467f1a 100644 --- a/src/components/Directory.tsx +++ b/src/components/Directory.tsx @@ -1,9 +1,28 @@ -import { Button, Table } from "@dataesr/react-dsfr"; +import { + Alert, + Button, + Col, + SearchableSelect, + Table, +} from "@dataesr/react-dsfr"; import axios from "axios"; import { useRouter } from "next/router"; import React, { useEffect, useRef, useState } from "react"; +import { Coordinates } from "../types/coordinates"; +import { FILTER } from "../types/enums/filters"; import { Psychologist } from "../types/psychologist"; +import { departments, getDepartment } from "./utils/departments"; + +const AROUND_ME = "Autour de moi"; +const AROUND_ME_OPTION = [{ label: AROUND_ME, value: AROUND_ME }]; + +const geoStatusEnum = { + DENIED: -1, + GRANTED: 1, + UNKNOWN: 0, + UNSUPPORTED: -2, +}; const columns = [ { @@ -16,71 +35,229 @@ const columns = [ label: "Adresse", name: "address", }, - { - label: "", - name: "action", - render: () => ( - <> -
-
-
- -
- - ), - }, ]; const Directory = () => { const router = useRouter(); const table = useRef(null); + + const [coords, setCoords] = useState(); + const [geoStatus, setGeoStatus] = useState(geoStatusEnum.UNKNOWN); + const [geoLoading, setGeoLoading] = useState(false); + const [options, setOptions] = useState(AROUND_ME_OPTION); + const [psychologists, setPsychologists] = useState(); const [currentPage, setCurrentPage] = useState(1); + + const [filter, setFilter] = useState(""); + const [filterText, setFilterText] = useState(""); + + const loadPsychologists = () => { + let query = ""; + if (coords) { + query = `?${FILTER.LONGITUDE}=${coords.longitude}&${FILTER.LATITUDE}=${coords.latitude}`; + } + axios + .get(`/api/psychologists${query}`) + .then((response) => setPsychologists(response.data)); + }; + useEffect(() => { if (process.env.NEXT_PUBLIC_DISPLAY_DIRECTORY !== "true") { router.push("/"); } else { - axios - .get("/api/psychologists") - .then((response) => setPsychologists(response.data)); + loadPsychologists(); } }, []); + const success = (pos) => { + const { longitude, latitude } = pos.coords; + setCoords({ latitude, longitude }); + setGeoStatus(geoStatusEnum.GRANTED); + setGeoLoading(false); + }; + + const errors = () => { + setGeoStatus(geoStatusEnum.DENIED); + }; + + const getGeolocation = (state) => { + if (state === "granted") { + setGeoLoading(true); + navigator.geolocation.getCurrentPosition(success); + } else if (state === "prompt") { + setGeoLoading(true); + navigator.geolocation.getCurrentPosition(success, errors); + } else if (state === "denied") { + setGeoStatus(geoStatusEnum.DENIED); + } + }; + + const checkGeolocationPermission = () => { + if (!coords) { + if (navigator.geolocation) { + navigator.permissions.query({ name: "geolocation" }).then((result) => { + getGeolocation(result.state); + }); + } else { + setGeoStatus(geoStatusEnum.UNSUPPORTED); + } + } + }; + + useEffect(() => { + if (filter === AROUND_ME) { + checkGeolocationPermission(); + } else if (filter && typeof filter === "string") { + axios + .get( + `https://api-adresse.data.gouv.fr/search/?q=${filter}&postCode=${filter}` + ) + .then((response) => { + const coordinates = response.data.features[0].geometry.coordinates; + setCoords({ + latitude: coordinates[1], + longitude: coordinates[0], + }); + }); + } else if (filter) { + const coordinates = filter.split("-"); + setCoords({ + latitude: coordinates[1], + longitude: coordinates[0], + }); + } + }, [filter]); + + const searchCommunes = () => { + if (filterText.length > 2 && filterText !== AROUND_ME) { + axios + .get( + `https://geo.api.gouv.fr/communes?nom=${filterText}&limit=10&fields=population,centre,departement,nom` + ) + .then((response) => { + console.log(response.data); + const communes = response.data + .sort((a, b) => b.population - a.population) + .map((commune) => ({ + label: `${commune.nom}, ${commune.departement.nom}`, + value: `${commune.centre.coordinates[0]}-${commune.centre.coordinates[1]}`, + })); + setOptions(communes.concat(AROUND_ME_OPTION)); + }); + } + }; + + const searchDepartment = (department: string) => { + axios + .get( + `https://geo.api.gouv.fr/departements/${department}/communes?limit=10&fields=population,centre,departement,nom,codesPostaux` + ) + .then((response) => { + console.log(response.data); + const communes = response.data + .flatMap((commune) => + commune.codesPostaux.map((codePostal) => ({ + centre: commune.centre, + codePostal, + departement: commune.departement, + nom: commune.nom, + population: commune.population, + })) + ) + .filter((commune) => commune.codePostal.startsWith(filterText)) + .sort((a, b) => b.population - a.population) + .map((commune) => ({ + label: `${commune.nom}, ${commune.codePostal}, ${commune.departement.nom}`, + value: commune.codePostal, + })); + setOptions(communes.concat(AROUND_ME_OPTION)); + }); + }; + + useEffect(() => { + if (filter) { + return; + } + + if (filterText) { + if (isNaN(+filterText)) { + searchCommunes(); + return; + } + + const department = getDepartment(filterText); + if (department) { + searchDepartment(department); + return; + } + } + + setOptions(AROUND_ME_OPTION); + }, [filterText]); + if (!psychologists) { return null; } + return ( -
-
{ - setCurrentPage(p); - table.current.scrollIntoView({ - behavior: "smooth", - block: "start", - }); - }} - surrendingPages={3} + <> + + option.label === AROUND_ME || + option.label.toLowerCase().includes(label.toLowerCase()) + } + label="Rechercher par ville, code postal ou région" + options={options} /> - + + {filter === AROUND_ME && geoStatus === geoStatusEnum.DENIED && ( + + )} + {filter === AROUND_ME && geoStatus === geoStatusEnum.UNSUPPORTED && ( + + )} +
+
+
{ + setCurrentPage(p); + table.current.scrollIntoView({ + behavior: "smooth", + block: "start", + }); + }} + surrendingPages={3} + /> + + + + ); }; diff --git a/src/components/utils/departments.ts b/src/components/utils/departments.ts new file mode 100644 index 00000000..aea4d3c7 --- /dev/null +++ b/src/components/utils/departments.ts @@ -0,0 +1,28 @@ +export const getDepartment = (text: string): string => { + if (!text || text.length < 2) { + return null; + } + + if (text.startsWith("971")) { + return "971"; + } + if (text.startsWith("972")) { + return "972"; + } + if (text.startsWith("973")) { + return "973"; + } + if (text.startsWith("974")) { + return "974"; + } + if (text.startsWith("976")) { + return "976"; + } + + const number = +text.slice(0, 2); + if (number > 0 && number < 96) { + return text.slice(0, 2); + } + + return null; +}; diff --git a/src/css/style.css b/src/css/style.css index b9ef6bc6..38cb9fcd 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -10,6 +10,15 @@ background-color: var(--background-alt-pink-tuile); } +.select-search-options { + background-color: var(--grey-1000) !important; +} + +.map { + width: 100%; + min-height: 500px; +} + .highlight { color: var(--pink-tuile-main-556); } diff --git a/src/db/migrations/20220105084912-add-psy.js b/src/db/migrations/20220105084912-add-psy.js index fa695483..cadc624d 100644 --- a/src/db/migrations/20220105084912-add-psy.js +++ b/src/db/migrations/20220105084912-add-psy.js @@ -1,5 +1,6 @@ module.exports = { up: async (queryInterface, Sequelize) => { + await queryInterface.sequelize.query(`CREATE EXTENSION IF NOT EXISTS "postgis";`) await queryInterface.createTable('psychologist', { id: { primaryKey: true, @@ -45,13 +46,9 @@ module.exports = { allowNull: false, type: Sequelize.STRING }, - longitude: { + coordinates: { allowNull: true, - type: Sequelize.FLOAT, - }, - latitude: { - allowNull: true, - type: Sequelize.FLOAT, + type: Sequelize.GEOMETRY('POINT') }, instructor_id: { allowNull: false, diff --git a/src/db/models/psychologist.ts b/src/db/models/psychologist.ts index 938be29e..5e163741 100644 --- a/src/db/models/psychologist.ts +++ b/src/db/models/psychologist.ts @@ -7,6 +7,7 @@ export default (sequelize) => { { address: DataTypes.STRING, archived: DataTypes.BOOLEAN, + coordinates: DataTypes.GEOMETRY("POINT"), email: DataTypes.STRING, emailPro: DataTypes.STRING, firstName: DataTypes.STRING, @@ -17,8 +18,6 @@ export default (sequelize) => { instructorId: DataTypes.STRING, languages: DataTypes.STRING, lastName: DataTypes.STRING, - latitude: DataTypes.FLOAT, - longitude: DataTypes.FLOAT, phone: DataTypes.STRING, teleconsultation: DataTypes.BOOLEAN, website: DataTypes.STRING, diff --git a/src/db/seeds/index.ts b/src/db/seeds/index.ts index 53c9e4c9..366192e8 100644 --- a/src/db/seeds/index.ts +++ b/src/db/seeds/index.ts @@ -18,6 +18,13 @@ const createPsychologists = async () => { "#####" )} ${faker.address.city()}`, archived: false, + coordinates: { + coordinates: [ + parseFloat(faker.address.longitude()), + parseFloat(faker.address.latitude()), + ], + type: "POINT", + }, email: faker.internet.email(), emailPro: faker.internet.email(), firstName: faker.name.firstName(), @@ -25,8 +32,6 @@ const createPsychologists = async () => { instructorId: faker.datatype.uuid(), languages: faker.lorem.word(1), lastName: faker.name.lastName(), - latitude: parseFloat(faker.address.latitude()), - longitude: parseFloat(faker.address.longitude()), phone: faker.phone.phoneNumber("0# ## ## ## ##"), teleconsultation: faker.datatype.boolean(), website: faker.helpers.randomize([ diff --git a/src/pages/annuaire.tsx b/src/pages/annuaire.tsx index 854f83cd..b2f76a96 100644 --- a/src/pages/annuaire.tsx +++ b/src/pages/annuaire.tsx @@ -9,9 +9,7 @@ const Annuaire = () => { return (
-
- -
+
); }; diff --git a/src/pages/api/psychologists.ts b/src/pages/api/psychologists/index.ts similarity index 59% rename from src/pages/api/psychologists.ts rename to src/pages/api/psychologists/index.ts index 382d67ec..b467a847 100644 --- a/src/pages/api/psychologists.ts +++ b/src/pages/api/psychologists/index.ts @@ -1,15 +1,16 @@ import { NextApiRequest, NextApiResponse } from "next"; -import { handleApiError } from "../../services/api"; -import config from "../../services/config"; -import { getAll } from "../../services/psychologists"; +import { handleApiError } from "../../../services/api"; +import config from "../../../services/config"; +import { getAll } from "../../../services/psychologists"; const psychologists = async (req: NextApiRequest, res: NextApiResponse) => { if (req.method === "GET") { if (!config.displayDirectory) { return res.status(200).json([]); } - const psychologists = await getAll(); + const filters = req.query; + const psychologists = await getAll(filters); return res.status(200).json(psychologists); } }; diff --git a/src/services/config.ts b/src/services/config.ts index 15293084..7b983341 100644 --- a/src/services/config.ts +++ b/src/services/config.ts @@ -1,3 +1,7 @@ +import * as dotenv from "dotenv"; + +dotenv.config(); + const parseBoolean = (value: string) => value === "true"; export default { diff --git a/src/services/demarchesSimplifiees/parsePsychologists.ts b/src/services/demarchesSimplifiees/parsePsychologists.ts index a31f845f..5f032f60 100644 --- a/src/services/demarchesSimplifiees/parsePsychologists.ts +++ b/src/services/demarchesSimplifiees/parsePsychologists.ts @@ -27,8 +27,10 @@ const parseDossierMetadata = async ( const coordinates = await getAddressCoordinates(psychologist.address); if (coordinates) { - psychologist.longitude = coordinates.longitude; - psychologist.latitude = coordinates.latitude; + psychologist.coordinates = { + coordinates: [coordinates.longitude, coordinates.latitude], + type: "POINT", + }; } return psychologist as Psychologist; diff --git a/src/services/psychologists.ts b/src/services/psychologists.ts index 3c1a88e6..f90f5cec 100644 --- a/src/services/psychologists.ts +++ b/src/services/psychologists.ts @@ -1,8 +1,45 @@ +import Sequelize from "sequelize"; + import { models } from "../db/models"; +import { FILTER } from "../types/enums/filters"; import { Psychologist } from "../types/psychologist"; -export const getAll = async () => { - return models.Psychologist.findAll({ raw: true }); +export const getOne = async (id: string) => { + return models.Psychologist.findOne({ + raw: true, + where: { id }, + }); +}; + +export const getAll = async (filters: { + [key in FILTER]?: string | string[]; +}) => { + const query: Sequelize.FindOptions = { raw: true }; + if (filters[FILTER.LONGITUDE] && filters[FILTER.LATITUDE]) { + query.attributes = { + include: [ + [ + Sequelize.fn( + "ST_Distance", + Sequelize.col("coordinates"), + Sequelize.fn( + "ST_SetSRID", + Sequelize.fn( + "ST_MakePoint", + filters[FILTER.LONGITUDE], + filters[FILTER.LATITUDE] + ), + 4326 + ) + ), + "distance", + ], + ], + }; + query.order = Sequelize.literal("distance ASC"); + } + + return models.Psychologist.findAll(query); }; export const saveMany = async (psychologists: Psychologist[]) => { diff --git a/src/types/enums/filters.ts b/src/types/enums/filters.ts new file mode 100644 index 00000000..c03ff6ae --- /dev/null +++ b/src/types/enums/filters.ts @@ -0,0 +1,4 @@ +export enum FILTER { + LONGITUDE = "longitude", + LATITUDE = "latitude", +} diff --git a/src/types/psychologist.d.ts b/src/types/psychologist.d.ts index f124ecdb..17ea6faa 100644 --- a/src/types/psychologist.d.ts +++ b/src/types/psychologist.d.ts @@ -10,8 +10,7 @@ export interface Psychologist { teleconsultation: boolean; languages: string; website: string; - longitude: number; - latitude: number; + coordinates: { type: string; coordinates: [number, number] }; instructorId: string; } diff --git a/yarn.lock b/yarn.lock index 27e9f194..4173d2af 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16,12 +16,24 @@ dependencies: "@babel/highlight" "^7.16.0" +"@babel/code-frame@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.16.7.tgz#44416b6bd7624b998f5b1af5d470856c40138789" + integrity sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg== + dependencies: + "@babel/highlight" "^7.16.7" + "@babel/compat-data@^7.16.0": version "7.16.4" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.16.4.tgz#081d6bbc336ec5c2435c6346b2ae1fb98b5ac68e" integrity sha512-1o/jo7D+kC9ZjHX5v+EHrdjl3PhxMrLSOTGsOdHJ+KL8HCaEK6ehrVL2RS6oHDZp+L7xLirLrPmQtEng769J/Q== -"@babel/core@^7.1.0", "@babel/core@^7.12.3", "@babel/core@^7.7.2", "@babel/core@^7.7.5": +"@babel/compat-data@^7.16.4": + version "7.16.8" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.16.8.tgz#31560f9f29fdf1868de8cb55049538a1b9732a60" + integrity sha512-m7OkX0IdKLKPpBlJtF561YJal5y/jyI5fNfWbPxh2D/nbzzGI4qRyrD8xO2jB24u7l+5I2a43scCG2IrfjC50Q== + +"@babel/core@^7.1.0", "@babel/core@^7.12.3", "@babel/core@^7.7.2": version "7.16.0" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.16.0.tgz#c4ff44046f5fe310525cc9eb4ef5147f0c5374d4" integrity sha512-mYZEvshBRHGsIAiyH5PzCFTCfbWfoYbO/jcSdXQSUQu1/pW0xDZAUP7KEc32heqWTAfAHhV9j1vH8Sav7l+JNQ== @@ -42,6 +54,27 @@ semver "^6.3.0" source-map "^0.5.0" +"@babel/core@^7.8.0": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.16.7.tgz#db990f931f6d40cb9b87a0dc7d2adc749f1dcbcf" + integrity sha512-aeLaqcqThRNZYmbMqtulsetOQZ/5gbR/dWruUCJcpas4Qoyy+QeagfDsPdMrqwsPRDNxJvBlRiZxxX7THO7qtA== + dependencies: + "@babel/code-frame" "^7.16.7" + "@babel/generator" "^7.16.7" + "@babel/helper-compilation-targets" "^7.16.7" + "@babel/helper-module-transforms" "^7.16.7" + "@babel/helpers" "^7.16.7" + "@babel/parser" "^7.16.7" + "@babel/template" "^7.16.7" + "@babel/traverse" "^7.16.7" + "@babel/types" "^7.16.7" + convert-source-map "^1.7.0" + debug "^4.1.0" + gensync "^1.0.0-beta.2" + json5 "^2.1.2" + semver "^6.3.0" + source-map "^0.5.0" + "@babel/generator@^7.16.0", "@babel/generator@^7.7.2": version "7.16.0" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.16.0.tgz#d40f3d1d5075e62d3500bccb67f3daa8a95265b2" @@ -51,6 +84,15 @@ jsesc "^2.5.1" source-map "^0.5.0" +"@babel/generator@^7.16.7", "@babel/generator@^7.16.8": + version "7.16.8" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.16.8.tgz#359d44d966b8cd059d543250ce79596f792f2ebe" + integrity sha512-1ojZwE9+lOXzcWdWmO6TbUzDfqLD39CmEhN8+2cX9XkDo5yW1OpgfejfliysR2AWLpMamTiOiAp/mtroaymhpw== + dependencies: + "@babel/types" "^7.16.8" + jsesc "^2.5.1" + source-map "^0.5.0" + "@babel/helper-compilation-targets@^7.16.0": version "7.16.3" resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.16.3.tgz#5b480cd13f68363df6ec4dc8ac8e2da11363cbf0" @@ -61,6 +103,23 @@ browserslist "^4.17.5" semver "^6.3.0" +"@babel/helper-compilation-targets@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.16.7.tgz#06e66c5f299601e6c7da350049315e83209d551b" + integrity sha512-mGojBwIWcwGD6rfqgRXVlVYmPAv7eOpIemUG3dGnDdCY4Pae70ROij3XmfrH6Fa1h1aiDylpglbZyktfzyo/hA== + dependencies: + "@babel/compat-data" "^7.16.4" + "@babel/helper-validator-option" "^7.16.7" + browserslist "^4.17.5" + semver "^6.3.0" + +"@babel/helper-environment-visitor@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.16.7.tgz#ff484094a839bde9d89cd63cba017d7aae80ecd7" + integrity sha512-SLLb0AAn6PkUeAfKJCCOl9e1R53pQlGAfc4y4XuMRZfqeMYLE0dM1LMhqbGAlGQY0lfw5/ohoYWAe9V1yibRag== + dependencies: + "@babel/types" "^7.16.7" + "@babel/helper-function-name@^7.16.0": version "7.16.0" resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.16.0.tgz#b7dd0797d00bbfee4f07e9c4ea5b0e30c8bb1481" @@ -70,6 +129,15 @@ "@babel/template" "^7.16.0" "@babel/types" "^7.16.0" +"@babel/helper-function-name@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.16.7.tgz#f1ec51551fb1c8956bc8dd95f38523b6cf375f8f" + integrity sha512-QfDfEnIUyyBSR3HtrtGECuZ6DAyCkYFp7GHl75vFtTnn6pjKeK0T1DB5lLkFvBea8MdaiUABx3osbgLyInoejA== + dependencies: + "@babel/helper-get-function-arity" "^7.16.7" + "@babel/template" "^7.16.7" + "@babel/types" "^7.16.7" + "@babel/helper-get-function-arity@^7.16.0": version "7.16.0" resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.16.0.tgz#0088c7486b29a9cb5d948b1a1de46db66e089cfa" @@ -77,6 +145,13 @@ dependencies: "@babel/types" "^7.16.0" +"@babel/helper-get-function-arity@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.16.7.tgz#ea08ac753117a669f1508ba06ebcc49156387419" + integrity sha512-flc+RLSOBXzNzVhcLu6ujeHUrD6tANAOU5ojrRx/as+tbzf8+stUCj7+IfRRoAbEZqj/ahXEMsjhOhgeZsrnTw== + dependencies: + "@babel/types" "^7.16.7" + "@babel/helper-hoist-variables@^7.16.0": version "7.16.0" resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.0.tgz#4c9023c2f1def7e28ff46fc1dbcd36a39beaa81a" @@ -84,6 +159,13 @@ dependencies: "@babel/types" "^7.16.0" +"@babel/helper-hoist-variables@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.7.tgz#86bcb19a77a509c7b77d0e22323ef588fa58c246" + integrity sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg== + dependencies: + "@babel/types" "^7.16.7" + "@babel/helper-member-expression-to-functions@^7.16.0": version "7.16.0" resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.16.0.tgz#29287040efd197c77636ef75188e81da8bccd5a4" @@ -98,6 +180,13 @@ dependencies: "@babel/types" "^7.16.0" +"@babel/helper-module-imports@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.16.7.tgz#25612a8091a999704461c8a222d0efec5d091437" + integrity sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg== + dependencies: + "@babel/types" "^7.16.7" + "@babel/helper-module-transforms@^7.16.0": version "7.16.0" resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.16.0.tgz#1c82a8dd4cb34577502ebd2909699b194c3e9bb5" @@ -112,6 +201,20 @@ "@babel/traverse" "^7.16.0" "@babel/types" "^7.16.0" +"@babel/helper-module-transforms@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.16.7.tgz#7665faeb721a01ca5327ddc6bba15a5cb34b6a41" + integrity sha512-gaqtLDxJEFCeQbYp9aLAefjhkKdjKcdh6DB7jniIGU3Pz52WAmP268zK0VgPz9hUNkMSYeH976K2/Y6yPadpng== + dependencies: + "@babel/helper-environment-visitor" "^7.16.7" + "@babel/helper-module-imports" "^7.16.7" + "@babel/helper-simple-access" "^7.16.7" + "@babel/helper-split-export-declaration" "^7.16.7" + "@babel/helper-validator-identifier" "^7.16.7" + "@babel/template" "^7.16.7" + "@babel/traverse" "^7.16.7" + "@babel/types" "^7.16.7" + "@babel/helper-optimise-call-expression@^7.16.0": version "7.16.0" resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.16.0.tgz#cecdb145d70c54096b1564f8e9f10cd7d193b338" @@ -141,6 +244,13 @@ dependencies: "@babel/types" "^7.16.0" +"@babel/helper-simple-access@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.16.7.tgz#d656654b9ea08dbb9659b69d61063ccd343ff0f7" + integrity sha512-ZIzHVyoeLMvXMN/vok/a4LWRy8G2v205mNP0XOuf9XRLyX5/u9CnVulUtDgUTama3lT+bf/UqucuZjqiGuTS1g== + dependencies: + "@babel/types" "^7.16.7" + "@babel/helper-split-export-declaration@^7.16.0": version "7.16.0" resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.0.tgz#29672f43663e936df370aaeb22beddb3baec7438" @@ -148,16 +258,33 @@ dependencies: "@babel/types" "^7.16.0" +"@babel/helper-split-export-declaration@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.7.tgz#0b648c0c42da9d3920d85ad585f2778620b8726b" + integrity sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw== + dependencies: + "@babel/types" "^7.16.7" + "@babel/helper-validator-identifier@^7.14.9", "@babel/helper-validator-identifier@^7.15.7": version "7.15.7" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz#220df993bfe904a4a6b02ab4f3385a5ebf6e2389" integrity sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w== +"@babel/helper-validator-identifier@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz#e8c602438c4a8195751243da9031d1607d247cad" + integrity sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw== + "@babel/helper-validator-option@^7.14.5": version "7.14.5" resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.14.5.tgz#6e72a1fff18d5dfcb878e1e62f1a021c4b72d5a3" integrity sha512-OX8D5eeX4XwcroVW45NMvoYaIuFI+GQpA2a8Gi+X/U/cDUIRsV37qQfF905F0htTRCREQIB4KqPeaveRJUl3Ow== +"@babel/helper-validator-option@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz#b203ce62ce5fe153899b617c08957de860de4d23" + integrity sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ== + "@babel/helpers@^7.16.0": version "7.16.3" resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.16.3.tgz#27fc64f40b996e7074dc73128c3e5c3e7f55c43c" @@ -167,6 +294,15 @@ "@babel/traverse" "^7.16.3" "@babel/types" "^7.16.0" +"@babel/helpers@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.16.7.tgz#7e3504d708d50344112767c3542fc5e357fffefc" + integrity sha512-9ZDoqtfY7AuEOt3cxchfii6C7GDyyMBffktR5B2jvWv8u2+efwvpnVKXMWzNehqy68tKgAfSwfdw/lWpthS2bw== + dependencies: + "@babel/template" "^7.16.7" + "@babel/traverse" "^7.16.7" + "@babel/types" "^7.16.7" + "@babel/highlight@^7.10.4", "@babel/highlight@^7.16.0": version "7.16.0" resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.16.0.tgz#6ceb32b2ca4b8f5f361fb7fd821e3fddf4a1725a" @@ -176,11 +312,25 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.16.0", "@babel/parser@^7.16.3", "@babel/parser@^7.7.0", "@babel/parser@^7.7.2": +"@babel/highlight@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.16.7.tgz#81a01d7d675046f0d96f82450d9d9578bdfd6b0b" + integrity sha512-aKpPMfLvGO3Q97V0qhw/V2SWNWlwfJknuwAunU7wZLSfrM4xTBvg7E5opUVi1kJTBKihE38CPg4nBiqX83PWYw== + dependencies: + "@babel/helper-validator-identifier" "^7.16.7" + chalk "^2.0.0" + js-tokens "^4.0.0" + +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.16.0", "@babel/parser@^7.16.3", "@babel/parser@^7.7.0": version "7.16.4" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.16.4.tgz#d5f92f57cf2c74ffe9b37981c0e72fee7311372e" integrity sha512-6V0qdPUaiVHH3RtZeLIsc+6pDhbYzHR8ogA8w+f+Wc77DuXto19g2QUwveINoS34Uw+W8/hQDGJCx+i4n7xcng== +"@babel/parser@^7.16.7", "@babel/parser@^7.16.8": + version "7.16.8" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.16.8.tgz#61c243a3875f7d0b0962b0543a33ece6ff2f1f17" + integrity sha512-i7jDUfrVBWc+7OKcBzEe5n7fbv3i2fWtxKzzCvOjnzSxMfWMigAhtfJ7qzZNGFNMsCCd67+uz553dYKWXPvCKw== + "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" @@ -310,7 +460,16 @@ "@babel/parser" "^7.16.0" "@babel/types" "^7.16.0" -"@babel/traverse@^7.1.0", "@babel/traverse@^7.16.0", "@babel/traverse@^7.16.3", "@babel/traverse@^7.7.0", "@babel/traverse@^7.7.2": +"@babel/template@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.16.7.tgz#8d126c8701fde4d66b264b3eba3d96f07666d155" + integrity sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w== + dependencies: + "@babel/code-frame" "^7.16.7" + "@babel/parser" "^7.16.7" + "@babel/types" "^7.16.7" + +"@babel/traverse@^7.16.0", "@babel/traverse@^7.16.3", "@babel/traverse@^7.7.0", "@babel/traverse@^7.7.2": version "7.16.3" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.16.3.tgz#f63e8a938cc1b780f66d9ed3c54f532ca2d14787" integrity sha512-eolumr1vVMjqevCpwVO99yN/LoGL0EyHiLO5I043aYQvwOJ9eR5UsZSClHVCzfhBduMAsSzgA/6AyqPjNayJag== @@ -325,6 +484,22 @@ debug "^4.1.0" globals "^11.1.0" +"@babel/traverse@^7.16.7": + version "7.16.8" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.16.8.tgz#bab2f2b09a5fe8a8d9cad22cbfe3ba1d126fef9c" + integrity sha512-xe+H7JlvKsDQwXRsBhSnq1/+9c+LlQcCK3Tn/l5sbx02HYns/cn7ibp9+RV1sIUqu7hKg91NWsgHurO9dowITQ== + dependencies: + "@babel/code-frame" "^7.16.7" + "@babel/generator" "^7.16.8" + "@babel/helper-environment-visitor" "^7.16.7" + "@babel/helper-function-name" "^7.16.7" + "@babel/helper-hoist-variables" "^7.16.7" + "@babel/helper-split-export-declaration" "^7.16.7" + "@babel/parser" "^7.16.8" + "@babel/types" "^7.16.8" + debug "^4.1.0" + globals "^11.1.0" + "@babel/types@7.15.0": version "7.15.0" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.15.0.tgz#61af11f2286c4e9c69ca8deb5f4375a73c72dcbd" @@ -341,15 +516,23 @@ "@babel/helper-validator-identifier" "^7.15.7" to-fast-properties "^2.0.0" +"@babel/types@^7.16.7", "@babel/types@^7.16.8": + version "7.16.8" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.16.8.tgz#0ba5da91dd71e0a4e7781a30f22770831062e3c1" + integrity sha512-smN2DQc5s4M7fntyjGtyIPbRJv6wW4rU/94fmYJ7PKQuZkC0qGMHXJbg6sNGt12JmVr4k5YaptI/XtiLJBnmIg== + dependencies: + "@babel/helper-validator-identifier" "^7.16.7" + to-fast-properties "^2.0.0" + "@bcoe/v8-coverage@^0.2.3": version "0.2.3" resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@commitlint/cli@^16.0.1": - version "16.0.1" - resolved "https://registry.yarnpkg.com/@commitlint/cli/-/cli-16.0.1.tgz#21905c898ebece7da42277209022b1bc80c4fb39" - integrity sha512-61gGRy65WiVDRsqP0dAR2fAgE3qrTBW3fgz9MySv32y5Ib3ZXXDDq6bGyQqi2dSaPuDYzNCRwwlC7mmQM73T/g== +"@commitlint/cli@^16.0.2": + version "16.0.2" + resolved "https://registry.yarnpkg.com/@commitlint/cli/-/cli-16.0.2.tgz#393b03793fc59b93e5f4dd7dd535a6cc5a7413ca" + integrity sha512-Jt7iaBjoLGC5Nq4dHPTvTYnqPGkElFPBtTXTvBpTgatZApczyjI2plE0oG4GYWPp1suHIS/VdVDOMpPZjGVusg== dependencies: "@commitlint/format" "^16.0.0" "@commitlint/lint" "^16.0.0" @@ -509,10 +692,10 @@ dependencies: "@cspotcode/source-map-consumer" "0.8.0" -"@dataesr/react-dsfr@^0.9.4": - version "0.9.4" - resolved "https://registry.yarnpkg.com/@dataesr/react-dsfr/-/react-dsfr-0.9.4.tgz#bff2d22f63bbbc17d168c08c7c8c581c63e0b202" - integrity sha512-zFa3OugM2Iq2mrkCTzrRGGNCTSkQ91bbMv1NdkcjTIVM1awa1OfCuaxjQTZs+TgJ+WoyxhVWIptNCDcqMApWIg== +"@dataesr/react-dsfr@^0.9.8": + version "0.9.8" + resolved "https://registry.yarnpkg.com/@dataesr/react-dsfr/-/react-dsfr-0.9.8.tgz#716cea33aa1c8f93f47657f7838d6d65ac0b80bf" + integrity sha512-Y+6KC4ObdJBEOOvLZ8iREB1cytHGCkiTNPyXMKDKes/9TNu1xXHXTloCV8GrRWIbgZd9qs80mE4V9WK+8WaNVA== dependencies: "@babel/runtime" "^7.16.3" "@gouvfr/dsfr" "1.2.1" @@ -592,27 +775,27 @@ resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== -"@jest/console@^27.4.2": - version "27.4.2" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-27.4.2.tgz#7a95612d38c007ddb528ee446fe5e5e785e685ce" - integrity sha512-xknHThRsPB/To1FUbi6pCe43y58qFC03zfb6R7fDb/FfC7k2R3i1l+izRBJf8DI46KhYGRaF14Eo9A3qbBoixg== +"@jest/console@^27.4.6": + version "27.4.6" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-27.4.6.tgz#0742e6787f682b22bdad56f9db2a8a77f6a86107" + integrity sha512-jauXyacQD33n47A44KrlOVeiXHEXDqapSdfb9kTekOchH/Pd18kBIO1+xxJQRLuG+LUuljFCwTG92ra4NW7SpA== dependencies: "@jest/types" "^27.4.2" "@types/node" "*" chalk "^4.0.0" - jest-message-util "^27.4.2" + jest-message-util "^27.4.6" jest-util "^27.4.2" slash "^3.0.0" -"@jest/core@^27.4.5": - version "27.4.5" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-27.4.5.tgz#cae2dc34259782f4866c6606c3b480cce920ed4c" - integrity sha512-3tm/Pevmi8bDsgvo73nX8p/WPng6KWlCyScW10FPEoN1HU4pwI83tJ3TsFvi1FfzsjwUlMNEPowgb/rPau/LTQ== +"@jest/core@^27.4.7": + version "27.4.7" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-27.4.7.tgz#84eabdf42a25f1fa138272ed229bcf0a1b5e6913" + integrity sha512-n181PurSJkVMS+kClIFSX/LLvw9ExSb+4IMtD6YnfxZVerw9ANYtW0bPrm0MJu2pfe9SY9FJ9FtQ+MdZkrZwjg== dependencies: - "@jest/console" "^27.4.2" - "@jest/reporters" "^27.4.5" - "@jest/test-result" "^27.4.2" - "@jest/transform" "^27.4.5" + "@jest/console" "^27.4.6" + "@jest/reporters" "^27.4.6" + "@jest/test-result" "^27.4.6" + "@jest/transform" "^27.4.6" "@jest/types" "^27.4.2" "@types/node" "*" ansi-escapes "^4.2.1" @@ -621,63 +804,63 @@ exit "^0.1.2" graceful-fs "^4.2.4" jest-changed-files "^27.4.2" - jest-config "^27.4.5" - jest-haste-map "^27.4.5" - jest-message-util "^27.4.2" + jest-config "^27.4.7" + jest-haste-map "^27.4.6" + jest-message-util "^27.4.6" jest-regex-util "^27.4.0" - jest-resolve "^27.4.5" - jest-resolve-dependencies "^27.4.5" - jest-runner "^27.4.5" - jest-runtime "^27.4.5" - jest-snapshot "^27.4.5" + jest-resolve "^27.4.6" + jest-resolve-dependencies "^27.4.6" + jest-runner "^27.4.6" + jest-runtime "^27.4.6" + jest-snapshot "^27.4.6" jest-util "^27.4.2" - jest-validate "^27.4.2" - jest-watcher "^27.4.2" + jest-validate "^27.4.6" + jest-watcher "^27.4.6" micromatch "^4.0.4" rimraf "^3.0.0" slash "^3.0.0" strip-ansi "^6.0.0" -"@jest/environment@^27.4.4": - version "27.4.4" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-27.4.4.tgz#66ebebc79673d84aad29d2bb70a8c51e6c29bb4d" - integrity sha512-q+niMx7cJgt/t/b6dzLOh4W8Ef/8VyKG7hxASK39jakijJzbFBGpptx3RXz13FFV7OishQ9lTbv+dQ5K3EhfDQ== +"@jest/environment@^27.4.6": + version "27.4.6" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-27.4.6.tgz#1e92885d64f48c8454df35ed9779fbcf31c56d8b" + integrity sha512-E6t+RXPfATEEGVidr84WngLNWZ8ffCPky8RqqRK6u1Bn0LK92INe0MDttyPl/JOzaq92BmDzOeuqk09TvM22Sg== dependencies: - "@jest/fake-timers" "^27.4.2" + "@jest/fake-timers" "^27.4.6" "@jest/types" "^27.4.2" "@types/node" "*" - jest-mock "^27.4.2" + jest-mock "^27.4.6" -"@jest/fake-timers@^27.4.2": - version "27.4.2" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-27.4.2.tgz#d217f86c3ba2027bf29e0b731fd0cb761a72d093" - integrity sha512-f/Xpzn5YQk5adtqBgvw1V6bF8Nx3hY0OIRRpCvWcfPl0EAjdqWPdhH3t/3XpiWZqtjIEHDyMKP9ajpva1l4Zmg== +"@jest/fake-timers@^27.4.6": + version "27.4.6" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-27.4.6.tgz#e026ae1671316dbd04a56945be2fa251204324e8" + integrity sha512-mfaethuYF8scV8ntPpiVGIHQgS0XIALbpY2jt2l7wb/bvq4Q5pDLk4EP4D7SAvYT1QrPOPVZAtbdGAOOyIgs7A== dependencies: "@jest/types" "^27.4.2" "@sinonjs/fake-timers" "^8.0.1" "@types/node" "*" - jest-message-util "^27.4.2" - jest-mock "^27.4.2" + jest-message-util "^27.4.6" + jest-mock "^27.4.6" jest-util "^27.4.2" -"@jest/globals@^27.4.4": - version "27.4.4" - resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-27.4.4.tgz#fe501a80c23ea2dab585c42be2a519bb5e38530d" - integrity sha512-bqpqQhW30BOreXM8bA8t8JbOQzsq/WnPTnBl+It3UxAD9J8yxEAaBEylHx1dtBapAr/UBk8GidXbzmqnee8tYQ== +"@jest/globals@^27.4.6": + version "27.4.6" + resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-27.4.6.tgz#3f09bed64b0fd7f5f996920258bd4be8f52f060a" + integrity sha512-kAiwMGZ7UxrgPzu8Yv9uvWmXXxsy0GciNejlHvfPIfWkSxChzv6bgTS3YqBkGuHcis+ouMFI2696n2t+XYIeFw== dependencies: - "@jest/environment" "^27.4.4" + "@jest/environment" "^27.4.6" "@jest/types" "^27.4.2" - expect "^27.4.2" + expect "^27.4.6" -"@jest/reporters@^27.4.5": - version "27.4.5" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-27.4.5.tgz#e229acca48d18ea39e805540c1c322b075ae63ad" - integrity sha512-3orsG4vi8zXuBqEoy2LbnC1kuvkg1KQUgqNxmxpQgIOQEPeV0onvZu+qDQnEoX8qTQErtqn/xzcnbpeTuOLSiA== +"@jest/reporters@^27.4.6": + version "27.4.6" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-27.4.6.tgz#b53dec3a93baf9b00826abf95b932de919d6d8dd" + integrity sha512-+Zo9gV81R14+PSq4wzee4GC2mhAN9i9a7qgJWL90Gpx7fHYkWpTBvwWNZUXvJByYR9tAVBdc8VxDWqfJyIUrIQ== dependencies: "@bcoe/v8-coverage" "^0.2.3" - "@jest/console" "^27.4.2" - "@jest/test-result" "^27.4.2" - "@jest/transform" "^27.4.5" + "@jest/console" "^27.4.6" + "@jest/test-result" "^27.4.6" + "@jest/transform" "^27.4.6" "@jest/types" "^27.4.2" "@types/node" "*" chalk "^4.0.0" @@ -686,14 +869,14 @@ glob "^7.1.2" graceful-fs "^4.2.4" istanbul-lib-coverage "^3.0.0" - istanbul-lib-instrument "^4.0.3" + istanbul-lib-instrument "^5.1.0" istanbul-lib-report "^3.0.0" istanbul-lib-source-maps "^4.0.0" - istanbul-reports "^3.0.2" - jest-haste-map "^27.4.5" - jest-resolve "^27.4.5" + istanbul-reports "^3.1.3" + jest-haste-map "^27.4.6" + jest-resolve "^27.4.6" jest-util "^27.4.2" - jest-worker "^27.4.5" + jest-worker "^27.4.6" slash "^3.0.0" source-map "^0.6.0" string-length "^4.0.1" @@ -709,43 +892,43 @@ graceful-fs "^4.2.4" source-map "^0.6.0" -"@jest/test-result@^27.4.2": - version "27.4.2" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-27.4.2.tgz#05fd4a5466ec502f3eae0b39dff2b93ea4d5d9ec" - integrity sha512-kr+bCrra9jfTgxHXHa2UwoQjxvQk3Am6QbpAiJ5x/50LW8llOYrxILkqY0lZRW/hu8FXesnudbql263+EW9iNA== +"@jest/test-result@^27.4.6": + version "27.4.6" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-27.4.6.tgz#b3df94c3d899c040f602cea296979844f61bdf69" + integrity sha512-fi9IGj3fkOrlMmhQqa/t9xum8jaJOOAi/lZlm6JXSc55rJMXKHxNDN1oCP39B0/DhNOa2OMupF9BcKZnNtXMOQ== dependencies: - "@jest/console" "^27.4.2" + "@jest/console" "^27.4.6" "@jest/types" "^27.4.2" "@types/istanbul-lib-coverage" "^2.0.0" collect-v8-coverage "^1.0.0" -"@jest/test-sequencer@^27.4.5": - version "27.4.5" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-27.4.5.tgz#1d7e026844d343b60d2ca7fd82c579a17b445d7d" - integrity sha512-n5woIn/1v+FT+9hniymHPARA9upYUmfi5Pw9ewVwXCDlK4F5/Gkees9v8vdjGdAIJ2MPHLHodiajLpZZanWzEQ== +"@jest/test-sequencer@^27.4.6": + version "27.4.6" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-27.4.6.tgz#447339b8a3d7b5436f50934df30854e442a9d904" + integrity sha512-3GL+nsf6E1PsyNsJuvPyIz+DwFuCtBdtvPpm/LMXVkBJbdFvQYCDpccYT56qq5BGniXWlE81n2qk1sdXfZebnw== dependencies: - "@jest/test-result" "^27.4.2" + "@jest/test-result" "^27.4.6" graceful-fs "^4.2.4" - jest-haste-map "^27.4.5" - jest-runtime "^27.4.5" + jest-haste-map "^27.4.6" + jest-runtime "^27.4.6" -"@jest/transform@^27.4.5": - version "27.4.5" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-27.4.5.tgz#3dfe2e3680cd4aa27356172bf25617ab5b94f195" - integrity sha512-PuMet2UlZtlGzwc6L+aZmR3I7CEBpqadO03pU40l2RNY2fFJ191b9/ITB44LNOhVtsyykx0OZvj0PCyuLm7Eew== +"@jest/transform@^27.4.6": + version "27.4.6" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-27.4.6.tgz#153621940b1ed500305eacdb31105d415dc30231" + integrity sha512-9MsufmJC8t5JTpWEQJ0OcOOAXaH5ioaIX6uHVBLBMoCZPfKKQF+EqP8kACAvCZ0Y1h2Zr3uOccg8re+Dr5jxyw== dependencies: "@babel/core" "^7.1.0" "@jest/types" "^27.4.2" - babel-plugin-istanbul "^6.0.0" + babel-plugin-istanbul "^6.1.1" chalk "^4.0.0" convert-source-map "^1.4.0" fast-json-stable-stringify "^2.0.0" graceful-fs "^4.2.4" - jest-haste-map "^27.4.5" + jest-haste-map "^27.4.6" jest-regex-util "^27.4.0" jest-util "^27.4.2" micromatch "^4.0.4" - pirates "^4.0.1" + pirates "^4.0.4" slash "^3.0.0" source-map "^0.6.1" write-file-atomic "^3.0.0" @@ -881,6 +1064,11 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" +"@react-leaflet/core@^1.1.1": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@react-leaflet/core/-/core-1.1.1.tgz#827fd05bb542cf874116176d8ef48d5b12163f81" + integrity sha512-7PGLWa9MZ5x/cWy8EH2VzI4T8q5WpuHbixzCDXqixP/WyqwIrg5NDUPgYuFnB4IEIZF+6nA265mYzswFo/h1Pw== + "@rollup/plugin-image@^2.1.1": version "2.1.1" resolved "https://registry.yarnpkg.com/@rollup/plugin-image/-/plugin-image-2.1.1.tgz#898d6b59ac0025d7971ef45640ab330cb0663b0c" @@ -1301,14 +1489,14 @@ dependencies: "@types/yargs-parser" "*" -"@typescript-eslint/eslint-plugin@^5.9.0": - version "5.9.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.9.0.tgz#382182d5cb062f52aac54434cfc47c28898c8006" - integrity sha512-qT4lr2jysDQBQOPsCCvpPUZHjbABoTJW8V9ZzIYKHMfppJtpdtzszDYsldwhFxlhvrp7aCHeXD1Lb9M1zhwWwQ== +"@typescript-eslint/eslint-plugin@^5.9.1": + version "5.9.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.9.1.tgz#e5a86d7e1f9dc0b3df1e6d94feaf20dd838d066c" + integrity sha512-Xv9tkFlyD4MQGpJgTo6wqDqGvHIRmRgah/2Sjz1PUnJTawjHWIwBivUE9x0QtU2WVii9baYgavo/bHjrZJkqTw== dependencies: - "@typescript-eslint/experimental-utils" "5.9.0" - "@typescript-eslint/scope-manager" "5.9.0" - "@typescript-eslint/type-utils" "5.9.0" + "@typescript-eslint/experimental-utils" "5.9.1" + "@typescript-eslint/scope-manager" "5.9.1" + "@typescript-eslint/type-utils" "5.9.1" debug "^4.3.2" functional-red-black-tree "^1.0.1" ignore "^5.1.8" @@ -1316,15 +1504,15 @@ semver "^7.3.5" tsutils "^3.21.0" -"@typescript-eslint/experimental-utils@5.9.0": - version "5.9.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-5.9.0.tgz#652762d37d6565ef07af285021b8347b6c79a827" - integrity sha512-ZnLVjBrf26dn7ElyaSKa6uDhqwvAi4jBBmHK1VxuFGPRAxhdi18ubQYSGA7SRiFiES3q9JiBOBHEBStOFkwD2g== +"@typescript-eslint/experimental-utils@5.9.1": + version "5.9.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-5.9.1.tgz#8c407c4dd5ffe522329df6e4c9c2b52206d5f7f1" + integrity sha512-cb1Njyss0mLL9kLXgS/eEY53SZQ9sT519wpX3i+U457l2UXRDuo87hgKfgRazmu9/tQb0x2sr3Y0yrU+Zz0y+w== dependencies: "@types/json-schema" "^7.0.9" - "@typescript-eslint/scope-manager" "5.9.0" - "@typescript-eslint/types" "5.9.0" - "@typescript-eslint/typescript-estree" "5.9.0" + "@typescript-eslint/scope-manager" "5.9.1" + "@typescript-eslint/types" "5.9.1" + "@typescript-eslint/typescript-estree" "5.9.1" eslint-scope "^5.1.1" eslint-utils "^3.0.0" @@ -1366,12 +1554,20 @@ "@typescript-eslint/types" "5.9.0" "@typescript-eslint/visitor-keys" "5.9.0" -"@typescript-eslint/type-utils@5.9.0": - version "5.9.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.9.0.tgz#fd5963ead04bc9b7af9c3a8e534d8d39f1ce5f93" - integrity sha512-uVCb9dJXpBrK1071ri5aEW7ZHdDHAiqEjYznF3HSSvAJXyrkxGOw2Ejibz/q6BXdT8lea8CMI0CzKNFTNI6TEQ== +"@typescript-eslint/scope-manager@5.9.1": + version "5.9.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.9.1.tgz#6c27be89f1a9409f284d95dfa08ee3400166fe69" + integrity sha512-8BwvWkho3B/UOtzRyW07ffJXPaLSUKFBjpq8aqsRvu6HdEuzCY57+ffT7QoV4QXJXWSU1+7g3wE4AlgImmQ9pQ== dependencies: - "@typescript-eslint/experimental-utils" "5.9.0" + "@typescript-eslint/types" "5.9.1" + "@typescript-eslint/visitor-keys" "5.9.1" + +"@typescript-eslint/type-utils@5.9.1": + version "5.9.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.9.1.tgz#c6832ffe655b9b1fec642d36db1a262d721193de" + integrity sha512-tRSpdBnPRssjlUh35rE9ug5HrUvaB9ntREy7gPXXKwmIx61TNN7+l5YKgi1hMKxo5NvqZCfYhA5FvyuJG6X6vg== + dependencies: + "@typescript-eslint/experimental-utils" "5.9.1" debug "^4.3.2" tsutils "^3.21.0" @@ -1385,6 +1581,11 @@ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.9.0.tgz#e5619803e39d24a03b3369506df196355736e1a3" integrity sha512-mWp6/b56Umo1rwyGCk8fPIzb9Migo8YOniBGPAQDNC6C52SeyNGN4gsVwQTAR+RS2L5xyajON4hOLwAGwPtUwg== +"@typescript-eslint/types@5.9.1": + version "5.9.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.9.1.tgz#1bef8f238a2fb32ebc6ff6d75020d9f47a1593c6" + integrity sha512-SsWegWudWpkZCwwYcKoDwuAjoZXnM1y2EbEerTHho19Hmm+bQ56QG4L4jrtCu0bI5STaRTvRTZmjprWlTw/5NQ== + "@typescript-eslint/typescript-estree@5.6.0": version "5.6.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.6.0.tgz#dfbb19c9307fdd81bd9c650c67e8397821d7faf0" @@ -1411,6 +1612,19 @@ semver "^7.3.5" tsutils "^3.21.0" +"@typescript-eslint/typescript-estree@5.9.1": + version "5.9.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.9.1.tgz#d5b996f49476495070d2b8dd354861cf33c005d6" + integrity sha512-gL1sP6A/KG0HwrahVXI9fZyeVTxEYV//6PmcOn1tD0rw8VhUWYeZeuWHwwhnewnvEMcHjhnJLOBhA9rK4vmb8A== + dependencies: + "@typescript-eslint/types" "5.9.1" + "@typescript-eslint/visitor-keys" "5.9.1" + debug "^4.3.2" + globby "^11.0.4" + is-glob "^4.0.3" + semver "^7.3.5" + tsutils "^3.21.0" + "@typescript-eslint/visitor-keys@5.6.0": version "5.6.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.6.0.tgz#3e36509e103fe9713d8f035ac977235fd63cb6e6" @@ -1427,6 +1641,14 @@ "@typescript-eslint/types" "5.9.0" eslint-visitor-keys "^3.0.0" +"@typescript-eslint/visitor-keys@5.9.1": + version "5.9.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.9.1.tgz#f52206f38128dd4f675cf28070a41596eee985b7" + integrity sha512-Xh37pNz9e9ryW4TVdwiFzmr4hloty8cFj8GTWMXh3Z8swGwyQWeCcNgF0hm6t09iZd6eiZmIf4zHedQVP6TVtg== + dependencies: + "@typescript-eslint/types" "5.9.1" + eslint-visitor-keys "^3.0.0" + "@zeit/next-source-maps@^0.0.3": version "0.0.3" resolved "https://registry.yarnpkg.com/@zeit/next-source-maps/-/next-source-maps-0.0.3.tgz#d62e93b4f5ccdd542c8530d21f60dd2757d98e3c" @@ -1738,21 +1960,21 @@ babel-eslint@^10.1.0: eslint-visitor-keys "^1.0.0" resolve "^1.12.0" -babel-jest@^27.4.5: - version "27.4.5" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-27.4.5.tgz#d38bd0be8ea71d8b97853a5fc9f76deeb095c709" - integrity sha512-3uuUTjXbgtODmSv/DXO9nZfD52IyC2OYTFaXGRzL0kpykzroaquCrD5+lZNafTvZlnNqZHt5pb0M08qVBZnsnA== +babel-jest@^27.4.6: + version "27.4.6" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-27.4.6.tgz#4d024e69e241cdf4f396e453a07100f44f7ce314" + integrity sha512-qZL0JT0HS1L+lOuH+xC2DVASR3nunZi/ozGhpgauJHgmI7f8rudxf6hUjEHympdQ/J64CdKmPkgfJ+A3U6QCrg== dependencies: - "@jest/transform" "^27.4.5" + "@jest/transform" "^27.4.6" "@jest/types" "^27.4.2" "@types/babel__core" "^7.1.14" - babel-plugin-istanbul "^6.0.0" + babel-plugin-istanbul "^6.1.1" babel-preset-jest "^27.4.0" chalk "^4.0.0" graceful-fs "^4.2.4" slash "^3.0.0" -babel-plugin-istanbul@^6.0.0: +babel-plugin-istanbul@^6.1.1: version "6.1.1" resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz#fa88ec59232fd9b4e36dbbc540a8ec9a9b47da73" integrity sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA== @@ -2660,10 +2882,10 @@ dot-prop@^5.1.0: dependencies: is-obj "^2.0.0" -dotenv@^10.0.0: - version "10.0.0" - resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-10.0.0.tgz#3d4227b8fb95f81096cdd2b66653fb2c7085ba81" - integrity sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q== +dotenv@^11.0.0: + version "11.0.0" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-11.0.0.tgz#ee37feddf8ada6d348a79e198312d4a8abfd1c1e" + integrity sha512-Fp/b504Y5W+e+FpCxTFMUZ7ZEQkQYF0rx+KZtmwixJxGQbLHrhCwo3FjZgNC8vIfrSi29PABNbMoCGD9YoiXbQ== dottie@^2.0.2: version "2.0.2" @@ -3218,17 +3440,15 @@ exit@^0.1.2: resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" integrity sha1-BjJjj42HfMghB9MKD/8aF8uhzQw= -expect@^27.4.2: - version "27.4.2" - resolved "https://registry.yarnpkg.com/expect/-/expect-27.4.2.tgz#4429b0f7e307771d176de9bdf23229b101db6ef6" - integrity sha512-BjAXIDC6ZOW+WBFNg96J22D27Nq5ohn+oGcuP2rtOtcjuxNoV9McpQ60PcQWhdFOSBIQdR72e+4HdnbZTFSTyg== +expect@^27.4.6: + version "27.4.6" + resolved "https://registry.yarnpkg.com/expect/-/expect-27.4.6.tgz#f335e128b0335b6ceb4fcab67ece7cbd14c942e6" + integrity sha512-1M/0kAALIaj5LaG66sFJTbRsWTADnylly82cu4bspI0nl+pgP4E6Bh/aqdHlTUjul06K7xQnnrAoqfxVU0+/ag== dependencies: "@jest/types" "^27.4.2" - ansi-styles "^5.0.0" jest-get-type "^27.4.0" - jest-matcher-utils "^27.4.2" - jest-message-util "^27.4.2" - jest-regex-util "^27.4.0" + jest-matcher-utils "^27.4.6" + jest-message-util "^27.4.6" ext@^1.1.2: version "1.6.0" @@ -3242,10 +3462,10 @@ extract-files@^9.0.0: resolved "https://registry.yarnpkg.com/extract-files/-/extract-files-9.0.0.tgz#8a7744f2437f81f5ed3250ed9f1550de902fe54a" integrity sha512-CvdFfHkC95B4bBBk36hcEmvdR2awOdhhVUYH6S/zrVj3477zven/fJMYg7121h4T1xHZC+tetUpubpAhxwI7hQ== -faker@^5.5.3: - version "5.5.3" - resolved "https://registry.yarnpkg.com/faker/-/faker-5.5.3.tgz#c57974ee484431b25205c2c8dc09fda861e51e0e" - integrity sha512-wLTv2a28wjUyWkbnX7u/ABZBkUkIF2fCd73V6P2oFqEGEktDfzWx4UxrSqtPRw0xPRAcjeAOIiJWqZm3pP4u3g== +faker@^6.6.6: + version "6.6.6" + resolved "https://registry.yarnpkg.com/faker/-/faker-6.6.6.tgz#e9529da0109dca4c7c5dbfeaadbd9234af943033" + integrity sha512-9tCqYEDHI5RYFQigXFwF1hnCwcWCOJl/hmll0lr5D2Ljjb0o4wphb69wikeJDz5qCEzXCoPvG6ss5SDP6IfOdg== fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" @@ -4064,17 +4284,7 @@ istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz#189e7909d0a39fa5a3dfad5b03f71947770191d3" integrity sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw== -istanbul-lib-instrument@^4.0.3: - version "4.0.3" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.3.tgz#873c6fff897450118222774696a3f28902d77c1d" - integrity sha512-BXgQl9kf4WTCPCCpmFGoJkz/+uhvm7h7PFKUYxh7qarQd3ER33vHG//qaE8eN25l07YqZPpHXU9I09l/RD5aGQ== - dependencies: - "@babel/core" "^7.7.5" - "@istanbuljs/schema" "^0.1.2" - istanbul-lib-coverage "^3.0.0" - semver "^6.3.0" - -istanbul-lib-instrument@^5.0.4: +istanbul-lib-instrument@^5.0.4, istanbul-lib-instrument@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-5.1.0.tgz#7b49198b657b27a730b8e9cb601f1e1bff24c59a" integrity sha512-czwUz525rkOFDJxfKK6mYfIs9zBKILyrZQxjz3ABhjQXhbhFsSbo1HW/BFcsDnfJYJWA6thRR5/TUY2qs5W99Q== @@ -4103,10 +4313,10 @@ istanbul-lib-source-maps@^4.0.0: istanbul-lib-coverage "^3.0.0" source-map "^0.6.1" -istanbul-reports@^3.0.2: - version "3.1.1" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.1.1.tgz#7085857f17d2441053c6ce5c3b8fdf6882289397" - integrity sha512-q1kvhAXWSsXfMjCdNHNPKZZv94OlspKnoGv+R9RGbnqOOQ0VbNfLFgQDVgi7hHenKsndGq3/o0OBdzDXthWcNw== +istanbul-reports@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.1.3.tgz#4bcae3103b94518117930d51283690960b50d3c2" + integrity sha512-x9LtDVtfm/t1GFiLl3NffC7hz+I1ragvgX1P/Lg1NlIagifZDKUkuuaAxH/qpwj2IuEfD8G2Bs/UKp+sZ/pKkg== dependencies: html-escaper "^2.0.0" istanbul-lib-report "^3.0.0" @@ -4120,86 +4330,86 @@ jest-changed-files@^27.4.2: execa "^5.0.0" throat "^6.0.1" -jest-circus@^27.4.5: - version "27.4.5" - resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-27.4.5.tgz#70bfb78e0200cab9b84747bf274debacaa538467" - integrity sha512-eTNWa9wsvBwPykhMMShheafbwyakcdHZaEYh5iRrQ0PFJxkDP/e3U/FvzGuKWu2WpwUA3C3hPlfpuzvOdTVqnw== +jest-circus@^27.4.6: + version "27.4.6" + resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-27.4.6.tgz#d3af34c0eb742a967b1919fbb351430727bcea6c" + integrity sha512-UA7AI5HZrW4wRM72Ro80uRR2Fg+7nR0GESbSI/2M+ambbzVuA63mn5T1p3Z/wlhntzGpIG1xx78GP2YIkf6PhQ== dependencies: - "@jest/environment" "^27.4.4" - "@jest/test-result" "^27.4.2" + "@jest/environment" "^27.4.6" + "@jest/test-result" "^27.4.6" "@jest/types" "^27.4.2" "@types/node" "*" chalk "^4.0.0" co "^4.6.0" dedent "^0.7.0" - expect "^27.4.2" + expect "^27.4.6" is-generator-fn "^2.0.0" - jest-each "^27.4.2" - jest-matcher-utils "^27.4.2" - jest-message-util "^27.4.2" - jest-runtime "^27.4.5" - jest-snapshot "^27.4.5" + jest-each "^27.4.6" + jest-matcher-utils "^27.4.6" + jest-message-util "^27.4.6" + jest-runtime "^27.4.6" + jest-snapshot "^27.4.6" jest-util "^27.4.2" - pretty-format "^27.4.2" + pretty-format "^27.4.6" slash "^3.0.0" stack-utils "^2.0.3" throat "^6.0.1" -jest-cli@^27.4.5: - version "27.4.5" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-27.4.5.tgz#8708f54c28d13681f3255ec9026a2b15b03d41e8" - integrity sha512-hrky3DSgE0u7sQxaCL7bdebEPHx5QzYmrGuUjaPLmPE8jx5adtvGuOlRspvMoVLTTDOHRnZDoRLYJuA+VCI7Hg== +jest-cli@^27.4.7: + version "27.4.7" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-27.4.7.tgz#d00e759e55d77b3bcfea0715f527c394ca314e5a" + integrity sha512-zREYhvjjqe1KsGV15mdnxjThKNDgza1fhDT+iUsXWLCq3sxe9w5xnvyctcYVT5PcdLSjv7Y5dCwTS3FCF1tiuw== dependencies: - "@jest/core" "^27.4.5" - "@jest/test-result" "^27.4.2" + "@jest/core" "^27.4.7" + "@jest/test-result" "^27.4.6" "@jest/types" "^27.4.2" chalk "^4.0.0" exit "^0.1.2" graceful-fs "^4.2.4" import-local "^3.0.2" - jest-config "^27.4.5" + jest-config "^27.4.7" jest-util "^27.4.2" - jest-validate "^27.4.2" + jest-validate "^27.4.6" prompts "^2.0.1" yargs "^16.2.0" -jest-config@^27.4.5: - version "27.4.5" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-27.4.5.tgz#77ed7f2ba7bcfd7d740ade711d0d13512e08a59e" - integrity sha512-t+STVJtPt+fpqQ8GBw850NtSQbnDOw/UzdPfzDaHQ48/AylQlW7LHj3dH+ndxhC1UxJ0Q3qkq7IH+nM1skwTwA== +jest-config@^27.4.7: + version "27.4.7" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-27.4.7.tgz#4f084b2acbd172c8b43aa4cdffe75d89378d3972" + integrity sha512-xz/o/KJJEedHMrIY9v2ParIoYSrSVY6IVeE4z5Z3i101GoA5XgfbJz+1C8EYPsv7u7f39dS8F9v46BHDhn0vlw== dependencies: - "@babel/core" "^7.1.0" - "@jest/test-sequencer" "^27.4.5" + "@babel/core" "^7.8.0" + "@jest/test-sequencer" "^27.4.6" "@jest/types" "^27.4.2" - babel-jest "^27.4.5" + babel-jest "^27.4.6" chalk "^4.0.0" ci-info "^3.2.0" deepmerge "^4.2.2" glob "^7.1.1" graceful-fs "^4.2.4" - jest-circus "^27.4.5" - jest-environment-jsdom "^27.4.4" - jest-environment-node "^27.4.4" + jest-circus "^27.4.6" + jest-environment-jsdom "^27.4.6" + jest-environment-node "^27.4.6" jest-get-type "^27.4.0" - jest-jasmine2 "^27.4.5" + jest-jasmine2 "^27.4.6" jest-regex-util "^27.4.0" - jest-resolve "^27.4.5" - jest-runner "^27.4.5" + jest-resolve "^27.4.6" + jest-runner "^27.4.6" jest-util "^27.4.2" - jest-validate "^27.4.2" + jest-validate "^27.4.6" micromatch "^4.0.4" - pretty-format "^27.4.2" + pretty-format "^27.4.6" slash "^3.0.0" -jest-diff@^27.4.2: - version "27.4.2" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-27.4.2.tgz#786b2a5211d854f848e2dcc1e324448e9481f36f" - integrity sha512-ujc9ToyUZDh9KcqvQDkk/gkbf6zSaeEg9AiBxtttXW59H/AcqEYp1ciXAtJp+jXWva5nAf/ePtSsgWwE5mqp4Q== +jest-diff@^27.4.6: + version "27.4.6" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-27.4.6.tgz#93815774d2012a2cbb6cf23f84d48c7a2618f98d" + integrity sha512-zjaB0sh0Lb13VyPsd92V7HkqF6yKRH9vm33rwBt7rPYrpQvS1nCvlIy2pICbKta+ZjWngYLNn4cCK4nyZkjS/w== dependencies: chalk "^4.0.0" diff-sequences "^27.4.0" jest-get-type "^27.4.0" - pretty-format "^27.4.2" + pretty-format "^27.4.6" jest-docblock@^27.4.0: version "27.4.0" @@ -4208,40 +4418,40 @@ jest-docblock@^27.4.0: dependencies: detect-newline "^3.0.0" -jest-each@^27.4.2: - version "27.4.2" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-27.4.2.tgz#19364c82a692d0d26557642098d1f4619c9ee7d3" - integrity sha512-53V2MNyW28CTruB3lXaHNk6PkiIFuzdOC9gR3C6j8YE/ACfrPnz+slB0s17AgU1TtxNzLuHyvNlLJ+8QYw9nBg== +jest-each@^27.4.6: + version "27.4.6" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-27.4.6.tgz#e7e8561be61d8cc6dbf04296688747ab186c40ff" + integrity sha512-n6QDq8y2Hsmn22tRkgAk+z6MCX7MeVlAzxmZDshfS2jLcaBlyhpF3tZSJLR+kXmh23GEvS0ojMR8i6ZeRvpQcA== dependencies: "@jest/types" "^27.4.2" chalk "^4.0.0" jest-get-type "^27.4.0" jest-util "^27.4.2" - pretty-format "^27.4.2" + pretty-format "^27.4.6" -jest-environment-jsdom@^27.4.4: - version "27.4.4" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-27.4.4.tgz#94f738e99514d7a880e8ed8e03e3a321d43b49db" - integrity sha512-cYR3ndNfHBqQgFvS1RL7dNqSvD//K56j/q1s2ygNHcfTCAp12zfIromO1w3COmXrxS8hWAh7+CmZmGCIoqGcGA== +jest-environment-jsdom@^27.4.6: + version "27.4.6" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-27.4.6.tgz#c23a394eb445b33621dfae9c09e4c8021dea7b36" + integrity sha512-o3dx5p/kHPbUlRvSNjypEcEtgs6LmvESMzgRFQE6c+Prwl2JLA4RZ7qAnxc5VM8kutsGRTB15jXeeSbJsKN9iA== dependencies: - "@jest/environment" "^27.4.4" - "@jest/fake-timers" "^27.4.2" + "@jest/environment" "^27.4.6" + "@jest/fake-timers" "^27.4.6" "@jest/types" "^27.4.2" "@types/node" "*" - jest-mock "^27.4.2" + jest-mock "^27.4.6" jest-util "^27.4.2" jsdom "^16.6.0" -jest-environment-node@^27.4.4: - version "27.4.4" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-27.4.4.tgz#42fe5e3b224cb69b99811ebf6f5eaa5a59618514" - integrity sha512-D+v3lbJ2GjQTQR23TK0kY3vFVmSeea05giInI41HHOaJnAwOnmUHTZgUaZL+VxUB43pIzoa7PMwWtCVlIUoVoA== +jest-environment-node@^27.4.6: + version "27.4.6" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-27.4.6.tgz#ee8cd4ef458a0ef09d087c8cd52ca5856df90242" + integrity sha512-yfHlZ9m+kzTKZV0hVfhVu6GuDxKAYeFHrfulmy7Jxwsq4V7+ZK7f+c0XP/tbVDMQW7E4neG2u147hFkuVz0MlQ== dependencies: - "@jest/environment" "^27.4.4" - "@jest/fake-timers" "^27.4.2" + "@jest/environment" "^27.4.6" + "@jest/fake-timers" "^27.4.6" "@jest/types" "^27.4.2" "@types/node" "*" - jest-mock "^27.4.2" + jest-mock "^27.4.6" jest-util "^27.4.2" jest-get-type@^27.4.0: @@ -4249,10 +4459,10 @@ jest-get-type@^27.4.0: resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-27.4.0.tgz#7503d2663fffa431638337b3998d39c5e928e9b5" integrity sha512-tk9o+ld5TWq41DkK14L4wox4s2D9MtTpKaAVzXfr5CUKm5ZK2ExcaFE0qls2W71zE/6R2TxxrK9w2r6svAFDBQ== -jest-haste-map@^27.4.5: - version "27.4.5" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-27.4.5.tgz#c2921224a59223f91e03ec15703905978ef0cc1a" - integrity sha512-oJm1b5qhhPs78K24EDGifWS0dELYxnoBiDhatT/FThgB9yxqUm5F6li3Pv+Q+apMBmmPNzOBnZ7ZxWMB1Leq1Q== +jest-haste-map@^27.4.6: + version "27.4.6" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-27.4.6.tgz#c60b5233a34ca0520f325b7e2cc0a0140ad0862a" + integrity sha512-0tNpgxg7BKurZeFkIOvGCkbmOHbLFf4LUQOxrQSMjvrQaQe3l6E8x6jYC1NuWkGo5WDdbr8FEzUxV2+LWNawKQ== dependencies: "@jest/types" "^27.4.2" "@types/graceful-fs" "^4.1.2" @@ -4263,58 +4473,57 @@ jest-haste-map@^27.4.5: jest-regex-util "^27.4.0" jest-serializer "^27.4.0" jest-util "^27.4.2" - jest-worker "^27.4.5" + jest-worker "^27.4.6" micromatch "^4.0.4" walker "^1.0.7" optionalDependencies: fsevents "^2.3.2" -jest-jasmine2@^27.4.5: - version "27.4.5" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-27.4.5.tgz#ff79d11561679ff6c89715b0cd6b1e8c0dfbc6dc" - integrity sha512-oUnvwhJDj2LhOiUB1kdnJjkx8C5PwgUZQb9urF77mELH9DGR4e2GqpWQKBOYXWs5+uTN9BGDqRz3Aeg5Wts7aw== +jest-jasmine2@^27.4.6: + version "27.4.6" + resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-27.4.6.tgz#109e8bc036cb455950ae28a018f983f2abe50127" + integrity sha512-uAGNXF644I/whzhsf7/qf74gqy9OuhvJ0XYp8SDecX2ooGeaPnmJMjXjKt0mqh1Rl5dtRGxJgNrHlBQIBfS5Nw== dependencies: - "@babel/traverse" "^7.1.0" - "@jest/environment" "^27.4.4" + "@jest/environment" "^27.4.6" "@jest/source-map" "^27.4.0" - "@jest/test-result" "^27.4.2" + "@jest/test-result" "^27.4.6" "@jest/types" "^27.4.2" "@types/node" "*" chalk "^4.0.0" co "^4.6.0" - expect "^27.4.2" + expect "^27.4.6" is-generator-fn "^2.0.0" - jest-each "^27.4.2" - jest-matcher-utils "^27.4.2" - jest-message-util "^27.4.2" - jest-runtime "^27.4.5" - jest-snapshot "^27.4.5" + jest-each "^27.4.6" + jest-matcher-utils "^27.4.6" + jest-message-util "^27.4.6" + jest-runtime "^27.4.6" + jest-snapshot "^27.4.6" jest-util "^27.4.2" - pretty-format "^27.4.2" + pretty-format "^27.4.6" throat "^6.0.1" -jest-leak-detector@^27.4.2: - version "27.4.2" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-27.4.2.tgz#7fc3120893a7a911c553f3f2bdff9faa4454abbb" - integrity sha512-ml0KvFYZllzPBJWDei3mDzUhyp/M4ubKebX++fPaudpe8OsxUE+m+P6ciVLboQsrzOCWDjE20/eXew9QMx/VGw== +jest-leak-detector@^27.4.6: + version "27.4.6" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-27.4.6.tgz#ed9bc3ce514b4c582637088d9faf58a33bd59bf4" + integrity sha512-kkaGixDf9R7CjHm2pOzfTxZTQQQ2gHTIWKY/JZSiYTc90bZp8kSZnUMS3uLAfwTZwc0tcMRoEX74e14LG1WapA== dependencies: jest-get-type "^27.4.0" - pretty-format "^27.4.2" + pretty-format "^27.4.6" -jest-matcher-utils@^27.4.2: - version "27.4.2" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-27.4.2.tgz#d17c5038607978a255e0a9a5c32c24e984b6c60b" - integrity sha512-jyP28er3RRtMv+fmYC/PKG8wvAmfGcSNproVTW2Y0P/OY7/hWUOmsPfxN1jOhM+0u2xU984u2yEagGivz9OBGQ== +jest-matcher-utils@^27.4.6: + version "27.4.6" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-27.4.6.tgz#53ca7f7b58170638590e946f5363b988775509b8" + integrity sha512-XD4PKT3Wn1LQnRAq7ZsTI0VRuEc9OrCPFiO1XL7bftTGmfNF0DcEwMHRgqiu7NGf8ZoZDREpGrCniDkjt79WbA== dependencies: chalk "^4.0.0" - jest-diff "^27.4.2" + jest-diff "^27.4.6" jest-get-type "^27.4.0" - pretty-format "^27.4.2" + pretty-format "^27.4.6" -jest-message-util@^27.4.2: - version "27.4.2" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-27.4.2.tgz#07f3f1bf207d69cf798ce830cc57f1a849f99388" - integrity sha512-OMRqRNd9E0DkBLZpFtZkAGYOXl6ZpoMtQJWTAREJKDOFa0M6ptB7L67tp+cszMBkvSgKOhNtQp2Vbcz3ZZKo/w== +jest-message-util@^27.4.6: + version "27.4.6" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-27.4.6.tgz#9fdde41a33820ded3127465e1a5896061524da31" + integrity sha512-0p5szriFU0U74czRSFjH6RyS7UYIAkn/ntwMuOwTGWrQIOh5NzXXrq72LOqIkJKKvFbPq+byZKuBz78fjBERBA== dependencies: "@babel/code-frame" "^7.12.13" "@jest/types" "^27.4.2" @@ -4322,14 +4531,14 @@ jest-message-util@^27.4.2: chalk "^4.0.0" graceful-fs "^4.2.4" micromatch "^4.0.4" - pretty-format "^27.4.2" + pretty-format "^27.4.6" slash "^3.0.0" stack-utils "^2.0.3" -jest-mock@^27.4.2: - version "27.4.2" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-27.4.2.tgz#184ff197a25491bfe4570c286daa5d62eb760b88" - integrity sha512-PDDPuyhoukk20JrQKeofK12hqtSka7mWH0QQuxSNgrdiPsrnYYLS6wbzu/HDlxZRzji5ylLRULeuI/vmZZDrYA== +jest-mock@^27.4.6: + version "27.4.6" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-27.4.6.tgz#77d1ba87fbd33ccb8ef1f061697e7341b7635195" + integrity sha512-kvojdYRkst8iVSZ1EJ+vc1RRD9llueBjKzXzeCytH3dMM7zvPV/ULcfI2nr0v0VUgm3Bjt3hBCQvOeaBz+ZTHw== dependencies: "@jest/types" "^27.4.2" "@types/node" "*" @@ -4344,40 +4553,40 @@ jest-regex-util@^27.4.0: resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-27.4.0.tgz#e4c45b52653128843d07ad94aec34393ea14fbca" integrity sha512-WeCpMpNnqJYMQoOjm1nTtsgbR4XHAk1u00qDoNBQoykM280+/TmgA5Qh5giC1ecy6a5d4hbSsHzpBtu5yvlbEg== -jest-resolve-dependencies@^27.4.5: - version "27.4.5" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-27.4.5.tgz#9398af854bdb12d6a9e5a8a536ee401f889a3ecf" - integrity sha512-elEVvkvRK51y037NshtEkEnukMBWvlPzZHiL847OrIljJ8yIsujD2GXRPqDXC4rEVKbcdsy7W0FxoZb4WmEs7w== +jest-resolve-dependencies@^27.4.6: + version "27.4.6" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-27.4.6.tgz#fc50ee56a67d2c2183063f6a500cc4042b5e2327" + integrity sha512-W85uJZcFXEVZ7+MZqIPCscdjuctruNGXUZ3OHSXOfXR9ITgbUKeHj+uGcies+0SsvI5GtUfTw4dY7u9qjTvQOw== dependencies: "@jest/types" "^27.4.2" jest-regex-util "^27.4.0" - jest-snapshot "^27.4.5" + jest-snapshot "^27.4.6" -jest-resolve@^27.4.5: - version "27.4.5" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-27.4.5.tgz#8dc44f5065fb8d58944c20f932cb7b9fe9760cca" - integrity sha512-xU3z1BuOz/hUhVUL+918KqUgK+skqOuUsAi7A+iwoUldK6/+PW+utK8l8cxIWT9AW7IAhGNXjSAh1UYmjULZZw== +jest-resolve@^27.4.6: + version "27.4.6" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-27.4.6.tgz#2ec3110655e86d5bfcfa992e404e22f96b0b5977" + integrity sha512-SFfITVApqtirbITKFAO7jOVN45UgFzcRdQanOFzjnbd+CACDoyeX7206JyU92l4cRr73+Qy/TlW51+4vHGt+zw== dependencies: "@jest/types" "^27.4.2" chalk "^4.0.0" graceful-fs "^4.2.4" - jest-haste-map "^27.4.5" + jest-haste-map "^27.4.6" jest-pnp-resolver "^1.2.2" jest-util "^27.4.2" - jest-validate "^27.4.2" + jest-validate "^27.4.6" resolve "^1.20.0" resolve.exports "^1.1.0" slash "^3.0.0" -jest-runner@^27.4.5: - version "27.4.5" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-27.4.5.tgz#daba2ba71c8f34137dc7ac45616add35370a681e" - integrity sha512-/irauncTfmY1WkTaRQGRWcyQLzK1g98GYG/8QvIPviHgO1Fqz1JYeEIsSfF+9mc/UTA6S+IIHFgKyvUrtiBIZg== +jest-runner@^27.4.6: + version "27.4.6" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-27.4.6.tgz#1d390d276ec417e9b4d0d081783584cbc3e24773" + integrity sha512-IDeFt2SG4DzqalYBZRgbbPmpwV3X0DcntjezPBERvnhwKGWTW7C5pbbA5lVkmvgteeNfdd/23gwqv3aiilpYPg== dependencies: - "@jest/console" "^27.4.2" - "@jest/environment" "^27.4.4" - "@jest/test-result" "^27.4.2" - "@jest/transform" "^27.4.5" + "@jest/console" "^27.4.6" + "@jest/environment" "^27.4.6" + "@jest/test-result" "^27.4.6" + "@jest/transform" "^27.4.6" "@jest/types" "^27.4.2" "@types/node" "*" chalk "^4.0.0" @@ -4385,49 +4594,45 @@ jest-runner@^27.4.5: exit "^0.1.2" graceful-fs "^4.2.4" jest-docblock "^27.4.0" - jest-environment-jsdom "^27.4.4" - jest-environment-node "^27.4.4" - jest-haste-map "^27.4.5" - jest-leak-detector "^27.4.2" - jest-message-util "^27.4.2" - jest-resolve "^27.4.5" - jest-runtime "^27.4.5" + jest-environment-jsdom "^27.4.6" + jest-environment-node "^27.4.6" + jest-haste-map "^27.4.6" + jest-leak-detector "^27.4.6" + jest-message-util "^27.4.6" + jest-resolve "^27.4.6" + jest-runtime "^27.4.6" jest-util "^27.4.2" - jest-worker "^27.4.5" + jest-worker "^27.4.6" source-map-support "^0.5.6" throat "^6.0.1" -jest-runtime@^27.4.5: - version "27.4.5" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-27.4.5.tgz#97703ad2a1799d4f50ab59049bd21a9ceaed2813" - integrity sha512-CIYqwuJQXHQtPd/idgrx4zgJ6iCb6uBjQq1RSAGQrw2S8XifDmoM1Ot8NRd80ooAm+ZNdHVwsktIMGlA1F1FAQ== +jest-runtime@^27.4.6: + version "27.4.6" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-27.4.6.tgz#83ae923818e3ea04463b22f3597f017bb5a1cffa" + integrity sha512-eXYeoR/MbIpVDrjqy5d6cGCFOYBFFDeKaNWqTp0h6E74dK0zLHzASQXJpl5a2/40euBmKnprNLJ0Kh0LCndnWQ== dependencies: - "@jest/console" "^27.4.2" - "@jest/environment" "^27.4.4" - "@jest/globals" "^27.4.4" + "@jest/environment" "^27.4.6" + "@jest/fake-timers" "^27.4.6" + "@jest/globals" "^27.4.6" "@jest/source-map" "^27.4.0" - "@jest/test-result" "^27.4.2" - "@jest/transform" "^27.4.5" + "@jest/test-result" "^27.4.6" + "@jest/transform" "^27.4.6" "@jest/types" "^27.4.2" - "@types/yargs" "^16.0.0" chalk "^4.0.0" cjs-module-lexer "^1.0.0" collect-v8-coverage "^1.0.0" execa "^5.0.0" - exit "^0.1.2" glob "^7.1.3" graceful-fs "^4.2.4" - jest-haste-map "^27.4.5" - jest-message-util "^27.4.2" - jest-mock "^27.4.2" + jest-haste-map "^27.4.6" + jest-message-util "^27.4.6" + jest-mock "^27.4.6" jest-regex-util "^27.4.0" - jest-resolve "^27.4.5" - jest-snapshot "^27.4.5" + jest-resolve "^27.4.6" + jest-snapshot "^27.4.6" jest-util "^27.4.2" - jest-validate "^27.4.2" slash "^3.0.0" strip-bom "^4.0.0" - yargs "^16.2.0" jest-serializer@^27.4.0: version "27.4.0" @@ -4437,34 +4642,32 @@ jest-serializer@^27.4.0: "@types/node" "*" graceful-fs "^4.2.4" -jest-snapshot@^27.4.5: - version "27.4.5" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-27.4.5.tgz#2ea909b20aac0fe62504bc161331f730b8a7ecc7" - integrity sha512-eCi/iM1YJFrJWiT9de4+RpWWWBqsHiYxFG9V9o/n0WXs6GpW4lUt4FAHAgFPTLPqCUVzrMQmSmTZSgQzwqR7IQ== +jest-snapshot@^27.4.6: + version "27.4.6" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-27.4.6.tgz#e2a3b4fff8bdce3033f2373b2e525d8b6871f616" + integrity sha512-fafUCDLQfzuNP9IRcEqaFAMzEe7u5BF7mude51wyWv7VRex60WznZIC7DfKTgSIlJa8aFzYmXclmN328aqSDmQ== dependencies: "@babel/core" "^7.7.2" "@babel/generator" "^7.7.2" - "@babel/parser" "^7.7.2" "@babel/plugin-syntax-typescript" "^7.7.2" "@babel/traverse" "^7.7.2" "@babel/types" "^7.0.0" - "@jest/transform" "^27.4.5" + "@jest/transform" "^27.4.6" "@jest/types" "^27.4.2" "@types/babel__traverse" "^7.0.4" "@types/prettier" "^2.1.5" babel-preset-current-node-syntax "^1.0.0" chalk "^4.0.0" - expect "^27.4.2" + expect "^27.4.6" graceful-fs "^4.2.4" - jest-diff "^27.4.2" + jest-diff "^27.4.6" jest-get-type "^27.4.0" - jest-haste-map "^27.4.5" - jest-matcher-utils "^27.4.2" - jest-message-util "^27.4.2" - jest-resolve "^27.4.5" + jest-haste-map "^27.4.6" + jest-matcher-utils "^27.4.6" + jest-message-util "^27.4.6" jest-util "^27.4.2" natural-compare "^1.4.0" - pretty-format "^27.4.2" + pretty-format "^27.4.6" semver "^7.3.2" jest-util@^27.4.2: @@ -4479,24 +4682,24 @@ jest-util@^27.4.2: graceful-fs "^4.2.4" picomatch "^2.2.3" -jest-validate@^27.4.2: - version "27.4.2" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-27.4.2.tgz#eecfcc1b1c9429aa007da08a2bae4e32a81bbbc3" - integrity sha512-hWYsSUej+Fs8ZhOm5vhWzwSLmVaPAxRy+Mr+z5MzeaHm9AxUpXdoVMEW4R86y5gOobVfBsMFLk4Rb+QkiEpx1A== +jest-validate@^27.4.6: + version "27.4.6" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-27.4.6.tgz#efc000acc4697b6cf4fa68c7f3f324c92d0c4f1f" + integrity sha512-872mEmCPVlBqbA5dToC57vA3yJaMRfIdpCoD3cyHWJOMx+SJwLNw0I71EkWs41oza/Er9Zno9XuTkRYCPDUJXQ== dependencies: "@jest/types" "^27.4.2" camelcase "^6.2.0" chalk "^4.0.0" jest-get-type "^27.4.0" leven "^3.1.0" - pretty-format "^27.4.2" + pretty-format "^27.4.6" -jest-watcher@^27.4.2: - version "27.4.2" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-27.4.2.tgz#c9037edfd80354c9fe90de4b6f8b6e2b8e736744" - integrity sha512-NJvMVyyBeXfDezhWzUOCOYZrUmkSCiatpjpm+nFUid74OZEHk6aMLrZAukIiFDwdbqp6mTM6Ui1w4oc+8EobQg== +jest-watcher@^27.4.6: + version "27.4.6" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-27.4.6.tgz#673679ebeffdd3f94338c24f399b85efc932272d" + integrity sha512-yKQ20OMBiCDigbD0quhQKLkBO+ObGN79MO4nT7YaCuQ5SM+dkBNWE8cZX0FjU6czwMvWw6StWbe+Wv4jJPJ+fw== dependencies: - "@jest/test-result" "^27.4.2" + "@jest/test-result" "^27.4.6" "@jest/types" "^27.4.2" "@types/node" "*" ansi-escapes "^4.2.1" @@ -4513,23 +4716,23 @@ jest-worker@27.0.0-next.5: merge-stream "^2.0.0" supports-color "^8.0.0" -jest-worker@^27.4.5: - version "27.4.5" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.4.5.tgz#d696e3e46ae0f24cff3fa7195ffba22889262242" - integrity sha512-f2s8kEdy15cv9r7q4KkzGXvlY0JTcmCbMHZBfSQDwW77REr45IDWwd0lksDFeVHH2jJ5pqb90T77XscrjeGzzg== +jest-worker@^27.4.6: + version "27.4.6" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.4.6.tgz#5d2d93db419566cb680752ca0792780e71b3273e" + integrity sha512-gHWJF/6Xi5CTG5QCvROr6GcmpIqNYpDJyc8A1h/DyXqH1tD6SnRCM0d3U5msV31D2LB/U+E0M+W4oyvKV44oNw== dependencies: "@types/node" "*" merge-stream "^2.0.0" supports-color "^8.0.0" -jest@^27.4.5: - version "27.4.5" - resolved "https://registry.yarnpkg.com/jest/-/jest-27.4.5.tgz#66e45acba44137fac26be9d3cc5bb031e136dc0f" - integrity sha512-uT5MiVN3Jppt314kidCk47MYIRilJjA/l2mxwiuzzxGUeJIvA8/pDaJOAX5KWvjAo7SCydcW0/4WEtgbLMiJkg== +jest@^27.4.7: + version "27.4.7" + resolved "https://registry.yarnpkg.com/jest/-/jest-27.4.7.tgz#87f74b9026a1592f2da05b4d258e57505f28eca4" + integrity sha512-8heYvsx7nV/m8m24Vk26Y87g73Ba6ueUd0MWed/NXMhSZIm62U/llVbS0PJe1SHunbyXjJ/BqG1z9bFjGUIvTg== dependencies: - "@jest/core" "^27.4.5" + "@jest/core" "^27.4.7" import-local "^3.0.2" - jest-cli "^27.4.5" + jest-cli "^27.4.7" js-beautify@^1.8.8: version "1.14.0" @@ -4672,6 +4875,11 @@ language-tags@^1.0.5: dependencies: language-subtag-registry "~0.3.2" +leaflet@^1.7.1: + version "1.7.1" + resolved "https://registry.yarnpkg.com/leaflet/-/leaflet-1.7.1.tgz#10d684916edfe1bf41d688a3b97127c0322a2a19" + integrity sha512-/xwPEBidtg69Q3HlqPdU3DnrXQOvQU/CCHA1tcDQVzOwm91YMYaILjNp7L4Eaw5Z4sOYdbBz6koWyibppd8Zqw== + leven@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" @@ -4710,10 +4918,10 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== -lint-staged@^12.1.5: - version "12.1.5" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-12.1.5.tgz#e05582fc39aed5cb13b9dd1dfb8330407246d809" - integrity sha512-WyKb+0sNKDTd1LwwAfTBPp0XmdaKkAOEbg4oHE4Kq2+oQVchg/VAcjVQtSqZih1izNsTURjc2EkhG/syRQUXdA== +lint-staged@^12.1.7: + version "12.1.7" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-12.1.7.tgz#fe9137992ac18a456422bb8484dd30be0140629f" + integrity sha512-bltv/ejiLWtowExpjU+s5z8j1Byjg9AlmaAjMmqNbIicY69u6sYIwXGg0dCn0TlkrrY2CphtHIXAkbZ+1VoWQQ== dependencies: cli-truncate "^3.1.0" colorette "^2.0.16" @@ -5544,7 +5752,7 @@ picomatch@^2.2.2: resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== -pirates@^4.0.1: +pirates@^4.0.4: version "4.0.4" resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.4.tgz#07df81e61028e402735cdd49db701e4885b4e6e6" integrity sha512-ZIrVPH+A52Dw84R0L3/VS9Op04PuQ2SEoJL6bkshmiTic/HldyW9Tf7oH5mhJZBK7NmDx27vSMrYEXPXclpDKw== @@ -5621,12 +5829,11 @@ prettier@^2.5.1: resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.5.1.tgz#fff75fa9d519c54cf0fce328c1017d94546bc56a" integrity sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg== -pretty-format@^27.4.2: - version "27.4.2" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-27.4.2.tgz#e4ce92ad66c3888423d332b40477c87d1dac1fb8" - integrity sha512-p0wNtJ9oLuvgOQDEIZ9zQjZffK7KtyR6Si0jnXULIDwrlNF8Cuir3AZP0hHv0jmKuNN/edOnbMjnzd4uTcmWiw== +pretty-format@^27.4.6: + version "27.4.6" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-27.4.6.tgz#1b784d2f53c68db31797b2348fa39b49e31846b7" + integrity sha512-NblstegA1y/RJW2VyML+3LlpFjzx62cUrtBIKIWDXEDkjNeleA7Od7nrzcs/VLQvAeV4CgSYhrN39DRN88Qi/g== dependencies: - "@jest/types" "^27.4.2" ansi-regex "^5.0.1" ansi-styles "^5.0.0" react-is "^17.0.1" @@ -5771,6 +5978,13 @@ react-is@^16.7.0, react-is@^16.8.1: resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== +react-leaflet@^3.2.4: + version "3.2.4" + resolved "https://registry.yarnpkg.com/react-leaflet/-/react-leaflet-3.2.4.tgz#5c87ca457d126e2f525d68cf169b9331402bcce0" + integrity sha512-GY7jUYFMVLqEOcI/NRtuTQ1lYiBqRxK5CWabLNupdqaz+Iy3HZbka/p9athICoAp9Nm87C4yC1YGU7lMr3X7Dg== + dependencies: + "@react-leaflet/core" "^1.1.1" + react-property@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/react-property/-/react-property-2.0.0.tgz#2156ba9d85fa4741faf1918b38efc1eae3c6a136" @@ -6054,10 +6268,10 @@ sequelize-pool@^7.1.0: resolved "https://registry.yarnpkg.com/sequelize-pool/-/sequelize-pool-7.1.0.tgz#210b391af4002762f823188fd6ecfc7413020768" integrity sha512-G9c0qlIWQSK29pR/5U2JF5dDQeqqHRragoyahj/Nx4KOOQ3CPPfzxnfqFPCSB7x5UgjOgnZ61nSxz+fjDpRlJg== -sequelize@^6.12.5: - version "6.12.5" - resolved "https://registry.yarnpkg.com/sequelize/-/sequelize-6.12.5.tgz#b2b41ab0f9301e10f5acab6ffd134dac325f111e" - integrity sha512-V//3SwPHMkPZi0amkCLlk2aNdS+qnLR0tTAzAYvhrxZ6t7JgMDiIO4R5+84nHZ0PwGE71RDXKOBBVhkYjABxhQ== +sequelize@^6.13.0: + version "6.13.0" + resolved "https://registry.yarnpkg.com/sequelize/-/sequelize-6.13.0.tgz#ce042fc511313094c1e4ca2b2ee13a563359e7b6" + integrity sha512-p0dXXGZSc0Ng7CdGwlKN4P6DTRD/w9Ar2CnmHamNVDnqEWh6pMVOp3xrlG5+IWhbwrqL3SjIYEYt3Xog1vXRDw== dependencies: "@types/debug" "^4.1.7" debug "^4.3.3" From 210514c32e822f1c9e8b6b30b637ad0185264e01 Mon Sep 17 00:00:00 2001 From: Desoindx Date: Tue, 11 Jan 2022 17:10:32 +0100 Subject: [PATCH 08/12] Use proper field --- .env.development | 4 +-- .env.production | 10 ++++--- .env.staging | 6 ++--- src/cron/demarchesSimplifiees.ts | 2 +- src/db/config/config.js | 8 +++--- src/db/migrations/20220105084912-add-psy.js | 26 +++++++++---------- src/db/models/psychologist.ts | 4 +-- src/db/seeds/index.ts | 4 +-- src/services/config.ts | 2 +- .../parsePsychologists.ts | 9 ++++--- src/types/psychologist.d.ts | 4 +-- 11 files changed, 41 insertions(+), 38 deletions(-) diff --git a/.env.development b/.env.development index 3a66cfff..e2efcdc7 100644 --- a/.env.development +++ b/.env.development @@ -1,7 +1,7 @@ NEXT_TELEMETRY_DISABLED=1 -POSTGRESQL_URL=postgres://monpsysante:monpsysante@localhost:5432/monpsysante +DATABASE_URL=postgres://monpsysante:monpsysante@localhost:5432/monpsysante DB_LOGGING_ENABLE=true DEMARCHES_SIMPLIFIEES_TOKEN=api-token DEMARCHES_SIMPLIFIEES_ID=52209 -DEMARCHES_SIMPLIFIEES_CHAMPS=[["Q2hhbXAtMTYwMzgwNQ==", "phone"], ["Q2hhbXAtMTYyNzkzOQ==", "address"], ["Q2hhbXAtMTYwMTE4Ng==", "emailPro"], ["Q2hhbXAtMTYzOTUyNA==", "teleconsultation"], ["Q2hhbXAtMTY2MDM0Nw==", "languages"], ["Q2hhbXAtMTYzOTQwMQ==", "website"]] +DEMARCHES_SIMPLIFIEES_CHAMPS=[["Q2hhbXAtMTYwMzgwNQ==", "phone"], ["Q2hhbXAtMTYyNzkzOQ==", "address"], ["Q2hhbXAtMTYzOTUyNA==", "teleconsultation"], ["Q2hhbXAtMTY2MDM0Nw==", "languages"], ["Q2hhbXAtMTYzOTQwMQ==", "website"], ["Q2hhbXAtMjI0NzExMg==", "cdsmsp"], ["Q2hhbXAtMjIyMjcwMg==", "withChildren"]] diff --git a/.env.production b/.env.production index 27af0dd3..89f5f202 100644 --- a/.env.production +++ b/.env.production @@ -1,4 +1,8 @@ -NEXT_PUBLIC_MATOMO_URL=https://matomo.fabrique.social.gouv.fr -NEXT_PUBLIC_MATOMO_SITE_ID="59" -NEXT_PUBLIC_SENTRY_DSN=https://36021ef8cb3b4edc99320a1e2fd1f453@sentry.fabrique.social.gouv.fr/61 NEXT_TELEMETRY_DISABLED=1 +DB_LOGGING_ENABLE=false + +DEMARCHES_SIMPLIFIEES_TOKEN=api-token +DEMARCHES_SIMPLIFIEES_ID=52209 +DEMARCHES_SIMPLIFIEES_CHAMPS=[["Q2hhbXAtMTYwMzgwNQ==", "phone"], ["Q2hhbXAtMTYyNzkzOQ==", "address"], ["Q2hhbXAtMTYzOTUyNA==", "teleconsultation"], ["Q2hhbXAtMTY2MDM0Nw==", "languages"], ["Q2hhbXAtMTYzOTQwMQ==", "website"], ["Q2hhbXAtMjI0NzExMg==", "cdsmsp"], ["Q2hhbXAtMjIyMjcwMg==", "withChildren"]] + +NEXT_PUBLIC_DISPLAY_DIRECTORY=false \ No newline at end of file diff --git a/.env.staging b/.env.staging index 10feac4f..2aee5116 100644 --- a/.env.staging +++ b/.env.staging @@ -1,10 +1,8 @@ NEXT_TELEMETRY_DISABLED=1 -POSTGRESQL_URL=postgres://monpsysante:monpsysante@localhost:5432/monpsysante -DB_LOGGING_ENABLE=true - +DB_LOGGING_ENABLE=false DEMARCHES_SIMPLIFIEES_TOKEN=api-token DEMARCHES_SIMPLIFIEES_ID=52209 -DEMARCHES_SIMPLIFIEES_CHAMPS=[["Q2hhbXAtMTYwMzgwNQ==", "phone"], ["Q2hhbXAtMTYyNzkzOQ==", "address"], ["Q2hhbXAtMTYwMTE4Ng==", "emailPro"], ["Q2hhbXAtMTYzOTUyNA==", "teleconsultation"], ["Q2hhbXAtMTY2MDM0Nw==", "languages"], ["Q2hhbXAtMTYzOTQwMQ==", "website"]] +DEMARCHES_SIMPLIFIEES_CHAMPS=[["Q2hhbXAtMTYwMzgwNQ==", "phone"], ["Q2hhbXAtMTYyNzkzOQ==", "address"], ["Q2hhbXAtMTYzOTUyNA==", "teleconsultation"], ["Q2hhbXAtMTY2MDM0Nw==", "languages"], ["Q2hhbXAtMTYzOTQwMQ==", "website"], ["Q2hhbXAtMjI0NzExMg==", "cdsmsp"], ["Q2hhbXAtMjIyMjcwMg==", "withChildren"]] NEXT_PUBLIC_DISPLAY_DIRECTORY=true \ No newline at end of file diff --git a/src/cron/demarchesSimplifiees.ts b/src/cron/demarchesSimplifiees.ts index 654b54e7..15e0d8ba 100644 --- a/src/cron/demarchesSimplifiees.ts +++ b/src/cron/demarchesSimplifiees.ts @@ -22,7 +22,7 @@ export const importData = async (): Promise => { { where: { id: 1 } } ); - console.log(`{$psychologists.psychologists.length} downloaded`); + console.log(`${dsAPIData.psychologists.length} downloaded`); } else { console.log("No psychologists to save"); } diff --git a/src/db/config/config.js b/src/db/config/config.js index 0c6e9c2a..13467f17 100644 --- a/src/db/config/config.js +++ b/src/db/config/config.js @@ -4,12 +4,10 @@ dotenv.config(); module.exports = { development: { dialect: "postgres", - url: process.env.POSTGRESQL_URL, + url: process.env.DATABASE_URL, }, production: { - dialect: process.env.POSTGRES_DB_DIALECT, - logging: true, - operatorsAliases: 0, - url: process.env.SCALINGO_POSTGRESQL_URL, + dialect: "postgres", + url: process.env.DATABASE_URL, }, }; diff --git a/src/db/migrations/20220105084912-add-psy.js b/src/db/migrations/20220105084912-add-psy.js index cadc624d..7a05dfb7 100644 --- a/src/db/migrations/20220105084912-add-psy.js +++ b/src/db/migrations/20220105084912-add-psy.js @@ -14,38 +14,38 @@ module.exports = { allowNull: false, type: Sequelize.STRING, }, - email: { - allowNull: false, - type: Sequelize.STRING, - }, archived: { allowNull: false, type: Sequelize.BOOLEAN, }, - phone: { - allowNull: false, - type: Sequelize.STRING - }, address: { allowNull: false, type: Sequelize.TEXT }, - email_pro: { + phone: { allowNull: false, type: Sequelize.STRING }, - teleconsultation: { + website: { allowNull: false, - type: Sequelize.BOOLEAN, + type: Sequelize.STRING }, - languages: { + cdsmsp: { allowNull: false, type: Sequelize.STRING }, - website: { + languages: { allowNull: false, type: Sequelize.STRING }, + teleconsultation: { + allowNull: false, + type: Sequelize.BOOLEAN, + }, + with_children: { + allowNull: false, + type: Sequelize.BOOLEAN, + }, coordinates: { allowNull: true, type: Sequelize.GEOMETRY('POINT') diff --git a/src/db/models/psychologist.ts b/src/db/models/psychologist.ts index 5e163741..d9097a69 100644 --- a/src/db/models/psychologist.ts +++ b/src/db/models/psychologist.ts @@ -7,9 +7,8 @@ export default (sequelize) => { { address: DataTypes.STRING, archived: DataTypes.BOOLEAN, + cdsmsp: DataTypes.STRING, coordinates: DataTypes.GEOMETRY("POINT"), - email: DataTypes.STRING, - emailPro: DataTypes.STRING, firstName: DataTypes.STRING, id: { primaryKey: true, @@ -21,6 +20,7 @@ export default (sequelize) => { phone: DataTypes.STRING, teleconsultation: DataTypes.BOOLEAN, website: DataTypes.STRING, + withChildren: DataTypes.BOOLEAN, }, { freezeTableName: true, diff --git a/src/db/seeds/index.ts b/src/db/seeds/index.ts index 366192e8..c882e319 100644 --- a/src/db/seeds/index.ts +++ b/src/db/seeds/index.ts @@ -18,6 +18,7 @@ const createPsychologists = async () => { "#####" )} ${faker.address.city()}`, archived: false, + cdsmsp: faker.lorem.word(5), coordinates: { coordinates: [ parseFloat(faker.address.longitude()), @@ -25,8 +26,6 @@ const createPsychologists = async () => { ], type: "POINT", }, - email: faker.internet.email(), - emailPro: faker.internet.email(), firstName: faker.name.firstName(), id: i, instructorId: faker.datatype.uuid(), @@ -38,6 +37,7 @@ const createPsychologists = async () => { faker.internet.domainName(), faker.internet.url(), ]), + withChildren: faker.datatype.boolean(), }); } diff --git a/src/services/config.ts b/src/services/config.ts index 7b983341..42728437 100644 --- a/src/services/config.ts +++ b/src/services/config.ts @@ -15,6 +15,6 @@ export default { minScoreAddress: parseFloat(process.env.MIN_SCORE_ADDRESS || "0.55"), postgre: { logging: parseBoolean(process.env.DB_LOGGING_ENABLE), - url: process.env.POSTGRESQL_URL, + url: process.env.DATABASE_URL, }, }; diff --git a/src/services/demarchesSimplifiees/parsePsychologists.ts b/src/services/demarchesSimplifiees/parsePsychologists.ts index 5f032f60..a7cb531c 100644 --- a/src/services/demarchesSimplifiees/parsePsychologists.ts +++ b/src/services/demarchesSimplifiees/parsePsychologists.ts @@ -7,18 +7,21 @@ const parseDossierMetadata = async ( ): Promise => { const psychologist: Partial = { archived: dossier.archived, - email: dossier.usager.email, firstName: dossier.demandeur.prenom, id: dossier.number, instructorId: dossier.groupeInstructeur.id, lastName: dossier.demandeur.nom, }; + dossier.champs.forEach((champ) => + console.log(champ.id, champ.label, champ.stringValue) + ); + JSON.parse(config.demarchesSimplifiees.champs).forEach(([id, field]) => { const dossierChamp = dossier.champs.find((champ) => champ.id === id); if (dossierChamp) { - if (field === "teleconsultation") { - psychologist.teleconsultation = dossierChamp.stringValue === "true"; + if (field === "teleconsultation" || field === "withChildren") { + psychologist[field] = dossierChamp.stringValue === "true"; } else { psychologist[field] = dossierChamp.stringValue; } diff --git a/src/types/psychologist.d.ts b/src/types/psychologist.d.ts index 17ea6faa..a04b4570 100644 --- a/src/types/psychologist.d.ts +++ b/src/types/psychologist.d.ts @@ -2,13 +2,13 @@ export interface Psychologist { id: number; firstName: string; lastName: string; - email: string; archived: boolean; phone: string; address: string; - emailPro: string; teleconsultation: boolean; + withChildren: boolean; languages: string; + cdsmsp: string; website: string; coordinates: { type: string; coordinates: [number, number] }; instructorId: string; From 36048fc4f2a9e7c61631e0493c54231409ccb962 Mon Sep 17 00:00:00 2001 From: Julien Bouquillon Date: Tue, 11 Jan 2022 17:40:07 +0100 Subject: [PATCH 09/12] feat(ci): add seeds command (#28) * Test .env * feat: add db deploy * Use proper DB URL * fix: use devInitContainerCommand * Do a db migration in docker * run db:migrate * Fix build Co-authored-by: Desoindx --- .socialgouv/config.json | 4 +++- Dockerfile | 1 + package.json | 7 ++++--- src/components/Directory.tsx | 9 +++++++-- src/services/config.ts | 4 ++-- yarn.lock | 8 ++++---- 6 files changed, 21 insertions(+), 12 deletions(-) diff --git a/.socialgouv/config.json b/.socialgouv/config.json index 9bf86829..43d48af3 100644 --- a/.socialgouv/config.json +++ b/.socialgouv/config.json @@ -3,5 +3,7 @@ "type": "app", "subdomain": "monpsy", "registry": "ghcr", - "project": "mon-psy-sante" + "project": "mon-psy-sante", + "azurepg": true, + "devInitContainerCommand": ["yarn", "db:init"] } diff --git a/Dockerfile b/Dockerfile index c3542ba5..ab21f2df 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,6 +22,7 @@ ENV NODE_ENV production COPY --from=builder /app/next.config.js . COPY --from=builder /app/sentry.client.config.js . COPY --from=builder /app/sentry.server.config.js . +COPY --from=builder /app/.sequelizerc . COPY --from=builder /app/.env.production . COPY --from=builder /app/package.json . COPY --from=builder /app/src ./src diff --git a/package.json b/package.json index 2f18537d..510a5d9e 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "axios": "^0.24.0", "cron": "^1.8.2", "dotenv": "^11.0.0", - "faker": "^6.6.6", + "faker": "^5.5.3", "graphql": "^16.2.0", "graphql-request": "^3.7.0", "leaflet": "^1.7.1", @@ -61,9 +61,10 @@ "lint": "eslint ./src", "lint:fix": "eslint ./src --fix", "precommit": "lint-staged", - "start": "NODE_ENV=production next start", + "start": "yarn run db:migrate && NODE_ENV=production next start", "export": "next export", - "db:seed": "ts-node src/db/seeds/index.ts", + "db:init": "yarn run db:migrate && yarn run db:seed", + "db:seed": "ts-node --transpile-only src/db/seeds/index.ts", "db:migrate": "npx sequelize-cli db:migrate", "db:migrate:undo": "npx sequelize-cli db:migrate:undo", "db:migrate:create": "npx sequelize migration:create --name" diff --git a/src/components/Directory.tsx b/src/components/Directory.tsx index e8467f1a..41bc5115 100644 --- a/src/components/Directory.tsx +++ b/src/components/Directory.tsx @@ -12,7 +12,7 @@ import React, { useEffect, useRef, useState } from "react"; import { Coordinates } from "../types/coordinates"; import { FILTER } from "../types/enums/filters"; import { Psychologist } from "../types/psychologist"; -import { departments, getDepartment } from "./utils/departments"; +import { getDepartment } from "./utils/departments"; const AROUND_ME = "Autour de moi"; const AROUND_ME_OPTION = [{ label: AROUND_ME, value: AROUND_ME }]; @@ -109,6 +109,7 @@ const Directory = () => { if (filter === AROUND_ME) { checkGeolocationPermission(); } else if (filter && typeof filter === "string") { + setGeoLoading(true); axios .get( `https://api-adresse.data.gouv.fr/search/?q=${filter}&postCode=${filter}` @@ -119,6 +120,7 @@ const Directory = () => { latitude: coordinates[1], longitude: coordinates[0], }); + setGeoLoading(false); }); } else if (filter) { const coordinates = filter.split("-"); @@ -214,7 +216,10 @@ const Directory = () => { label="Rechercher par ville, code postal ou région" options={options} /> - {filter === AROUND_ME && geoStatus === geoStatusEnum.DENIED && ( diff --git a/src/services/config.ts b/src/services/config.ts index 42728437..3ec1eef6 100644 --- a/src/services/config.ts +++ b/src/services/config.ts @@ -2,7 +2,7 @@ import * as dotenv from "dotenv"; dotenv.config(); -const parseBoolean = (value: string) => value === "true"; +const parseBoolean = (value: string | undefined) => value === "true"; export default { demarchesSimplifiees: { @@ -15,6 +15,6 @@ export default { minScoreAddress: parseFloat(process.env.MIN_SCORE_ADDRESS || "0.55"), postgre: { logging: parseBoolean(process.env.DB_LOGGING_ENABLE), - url: process.env.DATABASE_URL, + url: process.env.DATABASE_URL || "", }, }; diff --git a/yarn.lock b/yarn.lock index 4173d2af..0cc5d142 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3462,10 +3462,10 @@ extract-files@^9.0.0: resolved "https://registry.yarnpkg.com/extract-files/-/extract-files-9.0.0.tgz#8a7744f2437f81f5ed3250ed9f1550de902fe54a" integrity sha512-CvdFfHkC95B4bBBk36hcEmvdR2awOdhhVUYH6S/zrVj3477zven/fJMYg7121h4T1xHZC+tetUpubpAhxwI7hQ== -faker@^6.6.6: - version "6.6.6" - resolved "https://registry.yarnpkg.com/faker/-/faker-6.6.6.tgz#e9529da0109dca4c7c5dbfeaadbd9234af943033" - integrity sha512-9tCqYEDHI5RYFQigXFwF1hnCwcWCOJl/hmll0lr5D2Ljjb0o4wphb69wikeJDz5qCEzXCoPvG6ss5SDP6IfOdg== +faker@^5.5.3: + version "5.5.3" + resolved "https://registry.yarnpkg.com/faker/-/faker-5.5.3.tgz#c57974ee484431b25205c2c8dc09fda861e51e0e" + integrity sha512-wLTv2a28wjUyWkbnX7u/ABZBkUkIF2fCd73V6P2oFqEGEktDfzWx4UxrSqtPRw0xPRAcjeAOIiJWqZm3pP4u3g== fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" From 82fd43fa808dd0eaef29ae8b35ae983192d5e771 Mon Sep 17 00:00:00 2001 From: Desoindx Date: Tue, 18 Jan 2022 15:02:16 +0100 Subject: [PATCH 10/12] Review --- .env.production | 4 ++++ Dockerfile | 2 +- README.md | 2 ++ next.config.js | 28 +++++++++++++++++++++++++++- package.json | 3 +-- public/robots.staging.txt | 2 ++ public/robots.txt | 2 +- src/cron/cron.ts | 4 +--- src/pages/healthz.tsx | 2 +- yarn.lock | 5 +++++ 10 files changed, 45 insertions(+), 9 deletions(-) create mode 100644 public/robots.staging.txt diff --git a/.env.production b/.env.production index 89f5f202..a0b6621e 100644 --- a/.env.production +++ b/.env.production @@ -1,3 +1,7 @@ +NEXT_PUBLIC_MATOMO_URL=https://matomo.fabrique.social.gouv.fr +NEXT_PUBLIC_MATOMO_SITE_ID="59" +NEXT_PUBLIC_SENTRY_DSN=https://36021ef8cb3b4edc99320a1e2fd1f453@sentry.fabrique.social.gouv.fr/61 + NEXT_TELEMETRY_DISABLED=1 DB_LOGGING_ENABLE=false diff --git a/Dockerfile b/Dockerfile index ab21f2df..9cd917cc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ COPY package.json yarn.lock ./ RUN yarn install --frozen-lockfile COPY . . -RUN if [ -z "$PRODUCTION" ]; then cp .env.staging .env.production; fi +RUN if [ -z "$PRODUCTION" ]; then cp .env.staging .env.production; cp ./public/robots.staging.txt ./public/robots.txt; fi RUN yarn build && yarn install --production --ignore-scripts --prefer-offline # Production image, copy all the files and run next diff --git a/README.md b/README.md index 826aef58..ea72e833 100644 --- a/README.md +++ b/README.md @@ -7,5 +7,7 @@ https://monpsy.sante.gouv.fr ``` yarn yarn build + yarn run db:init npm run dev ``` + diff --git a/next.config.js b/next.config.js index 6bafca70..5518660e 100644 --- a/next.config.js +++ b/next.config.js @@ -1,6 +1,22 @@ const nextSourceMaps = require("@zeit/next-source-maps"); const { withSentryConfig } = require("@sentry/nextjs"); +const csp = { + 'default-src': ["'none'"], + 'connect-src': ["'self'", "https://*.gouv.fr", "https://services.sarbacane.com"], + 'font-src': ["'self'", "data:"], + 'img-src': ["'self'", "data:", "https://forms.sbc08.com"], + 'prefetch-src': ["'self'", "https://*.gouv.fr"], + 'script-src': ["'self'", "https://*.gouv.fr", "https://*.sbc08.com"], + 'frame-src': ["'self'", "https://*.gouv.fr"], + 'style-src': ["'self'", "'unsafe-inline'"] +} + +// In dev we allow 'unsafe-eval', so HMR doesn't trigger the CSP +if (process.env.NODE_ENV !== 'production') { + csp['script-src'].push("'unsafe-eval'"); +} + module.exports = withSentryConfig( nextSourceMaps({ // by default, sentry tries to upload sourcemaps at build time @@ -20,5 +36,15 @@ module.exports = withSentryConfig( } return config; }, - }) + async headers() { + return [ + { + source: '/:path*', + headers: [{ + key: "Content-Security-Policy", + value: Object.keys(csp).map(key => `${key} ${csp[key].join(" ")}`).join(";") + }], + }, + ] + }, }) ); diff --git a/package.json b/package.json index d4280b21..64c4a191 100644 --- a/package.json +++ b/package.json @@ -25,13 +25,12 @@ "faker": "^5.5.3", "graphql": "^16.2.0", "graphql-request": "^3.7.0", - "leaflet": "^1.7.1", + "helmet": "^5.0.1", "next": "^12.0.7", "pg": "^8.7.1", "pg-hstore": "^2.3.4", "react": "^17.0.2", "react-dom": "^17.0.2", - "react-leaflet": "^3.2.4", "sequelize": "^6.13.0", "sequelize-cli": "^6.3.0", "ts-node": "^10.4.0", diff --git a/public/robots.staging.txt b/public/robots.staging.txt new file mode 100644 index 00000000..77470cb3 --- /dev/null +++ b/public/robots.staging.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: / \ No newline at end of file diff --git a/public/robots.txt b/public/robots.txt index 177c3a6a..14267e90 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1,2 +1,2 @@ -# User-agent: * signifie que l'accès est accordé à tous les agents (tous les spiders), quels qu'ils soient. User-agent: * +Allow: / \ No newline at end of file diff --git a/src/cron/cron.ts b/src/cron/cron.ts index ad7f9da8..533eb00e 100644 --- a/src/cron/cron.ts +++ b/src/cron/cron.ts @@ -17,11 +17,9 @@ const jobs = [ }, ]; -let activeJobs = 0; jobs.forEach((job) => { console.log(`🚀 The job "${job.name}" is ON ${job.cronTime}`); new cron.CronJob(job); - activeJobs++; }); -console.log(`Started ${activeJobs} cron jobs`); +console.log(`Started cron jobs`); diff --git a/src/pages/healthz.tsx b/src/pages/healthz.tsx index a565069a..9f4092a9 100644 --- a/src/pages/healthz.tsx +++ b/src/pages/healthz.tsx @@ -1,5 +1,5 @@ import React from "react"; export default function Healthz() { - return
; + return
App is up and running
; } diff --git a/yarn.lock b/yarn.lock index f0249fe9..32176937 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3545,6 +3545,11 @@ he@1.2.0: resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== +helmet@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/helmet/-/helmet-5.0.1.tgz#e8b2aacf881dd5cffadbb640f23155f23de485ae" + integrity sha512-iyYpGYH2nbQVaQtauYDnemWg45S2RyGvJ+iKj+V9jp7Dc1NTtAJHmD+hFOSYS7Xdwe1GeyVEYSydggXLOg6TKQ== + hmac-drbg@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" From bfa274dcf7046df07d4185971e54bf46cffec20f Mon Sep 17 00:00:00 2001 From: Desoindx Date: Tue, 18 Jan 2022 16:51:24 +0100 Subject: [PATCH 11/12] Update Readme --- README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ea72e833..9ed233fd 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,19 @@ https://monpsy.sante.gouv.fr # Run locally +First you need to run a docker with a postgre DB +``` + docker-compose up +``` + +then you need to prepare the project ``` yarn - yarn build yarn run db:init - npm run dev +``` + +and finally you can run the project locally with +``` + yarn run dev ``` From 128457ebb4d1b36c647877df630896659b8ca44e Mon Sep 17 00:00:00 2001 From: Desoindx Date: Fri, 21 Jan 2022 08:59:58 +0100 Subject: [PATCH 12/12] Manage 2A and 2B departments --- src/components/Directory.tsx | 54 ++++++++++++++++------------- src/components/utils/departments.ts | 3 ++ src/pages/annuaire.tsx | 18 +++++----- 3 files changed, 42 insertions(+), 33 deletions(-) diff --git a/src/components/Directory.tsx b/src/components/Directory.tsx index 41bc5115..1882c5d1 100644 --- a/src/components/Directory.tsx +++ b/src/components/Directory.tsx @@ -150,31 +150,37 @@ const Directory = () => { } }; - const searchDepartment = (department: string) => { - axios - .get( - `https://geo.api.gouv.fr/departements/${department}/communes?limit=10&fields=population,centre,departement,nom,codesPostaux` - ) - .then((response) => { - console.log(response.data); - const communes = response.data - .flatMap((commune) => - commune.codesPostaux.map((codePostal) => ({ - centre: commune.centre, - codePostal, - departement: commune.departement, - nom: commune.nom, - population: commune.population, - })) + const searchDepartment = async (department: string) => { + const results = await Promise.all( + department + .split("|") + .map((x) => + axios.get( + `https://geo.api.gouv.fr/departements/${x}/communes?limit=10&fields=population,centre,departement,nom,codesPostaux` ) - .filter((commune) => commune.codePostal.startsWith(filterText)) - .sort((a, b) => b.population - a.population) - .map((commune) => ({ - label: `${commune.nom}, ${commune.codePostal}, ${commune.departement.nom}`, - value: commune.codePostal, - })); - setOptions(communes.concat(AROUND_ME_OPTION)); + ) + ); + + const communes = results + .flatMap((result) => result.data) + .flatMap((commune) => + commune.codesPostaux.map((codePostal) => ({ + centre: commune.centre, + codePostal, + departement: commune.departement, + nom: commune.nom, + population: commune.population, + })) + ) + .filter((commune) => commune.codePostal.startsWith(filterText)) + .sort((a, b) => b.population - a.population) + .map((commune) => { + return { + label: `${commune.nom}, ${commune.codePostal}, ${commune.departement.nom}`, + value: `${commune.codePostal} ${commune.nom}`, + }; }); + setOptions(communes.concat(AROUND_ME_OPTION)); }; useEffect(() => { @@ -213,7 +219,7 @@ const Directory = () => { option.label === AROUND_ME || option.label.toLowerCase().includes(label.toLowerCase()) } - label="Rechercher par ville, code postal ou région" + label="Rechercher par ville ou code postal" options={options} />