diff --git a/.github/codeql-config.yml b/.github/codeql-config.yml new file mode 100644 index 00000000..0468ce24 --- /dev/null +++ b/.github/codeql-config.yml @@ -0,0 +1,7 @@ +name: "CodeQL config" + +paths: + - index + - api +paths-ignore: + - api/swagger-ui diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 549b73cb..e5526229 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -32,7 +32,7 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'javascript', 'python' ] + language: [ 'javascript' ] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] # Learn more: # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed @@ -46,6 +46,7 @@ jobs: uses: github/codeql-action/init@v1 with: languages: ${{ matrix.language }} + config-file: ./.github/codeql-config.yml # If you wish to specify custom queries, you can do so here or in a config file. # By default, queries listed here will override any specified in a config file. # Prefix the list here with "+" to use these queries and those in the config file. diff --git a/.github/workflows/deactivate.yaml b/.github/workflows/deactivate.yaml new file mode 100644 index 00000000..0f32a866 --- /dev/null +++ b/.github/workflows/deactivate.yaml @@ -0,0 +1,15 @@ +name: Deactivate + +on: + pull_request: + types: [closed] + +jobs: + bury_review_env: + name: 🪦 Review + runs-on: ubuntu-latest + steps: + - uses: SocialGouv/actions/autodevops-deactivate@V1 + with: + kube-config: ${{ secrets.KUBECONFIG }} + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/indexing-dev.yml b/.github/workflows/indexing-dev.yml index c9831f32..608cb548 100644 --- a/.github/workflows/indexing-dev.yml +++ b/.github/workflows/indexing-dev.yml @@ -5,13 +5,52 @@ on: concurrency: cancel-in-progress: true - group: indexing + group: indexing-dev jobs: index: - name: Index + name: Index Dev runs-on: ubuntu-latest steps: - - name: Echo + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Yarn cache setup + uses: c-hive/gha-yarn-cache@v2 + with: + directory: .k8s + + - name: Install kosko-charts dependencies + shell: bash + run: yarn --cwd .k8s install --frozen-lockfile --prefer-offline + + - name: Generate indexing job + shell: bash + run: yarn --cwd .k8s --silent generate --env dev jobs/indexing > indexing.yml + env: + RANCHER_PROJECT_ID: ${{ secrets.RANCHER_PROJECT_ID }} + SOCIALGOUV_BASE_DOMAIN: ${{ secrets.SOCIALGOUV_BASE_DOMAIN }} + + - name: Archive indexing job + uses: actions/upload-artifact@v2 + with: + name: indexing.yml + path: indexing.yml + + - name: Get namespace name + uses: mikefarah/yq@master + id: namespace + with: + cmd: yq eval ".metadata.namespace" indexing.yml | head -n 1 + + - name: Create kubernetes config + shell: bash + run: | + mkdir ~/.kube + touch ~/.kube/config + echo ${{ secrets.KUBECONFIG }} | base64 -d > ~/.kube/config + + - name: Launch indexing Job shell: bash - run: echo "Hello, world" + run: | + kubectl apply -f indexing.yml --namespace ${{ steps.namespace.outputs.result }} diff --git a/.github/workflows/indexing-prod.yml b/.github/workflows/indexing-prod.yml new file mode 100644 index 00000000..13566630 --- /dev/null +++ b/.github/workflows/indexing-prod.yml @@ -0,0 +1,57 @@ +name: Indexing (prod) + +on: + workflow_dispatch: + +concurrency: + cancel-in-progress: true + group: indexing-prod + +jobs: + index: + name: Index Prod + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Yarn cache setup + uses: c-hive/gha-yarn-cache@v2 + with: + directory: .k8s + + - name: Install kosko-charts dependencies + shell: bash + run: yarn --cwd .k8s install --frozen-lockfile --prefer-offline + + - name: Generate indexing job + shell: bash + # HACK: we use preprod to run the job on the dev cluster + run: yarn --cwd .k8s --silent generate --env preprod jobs/indexing > indexing.yml + env: + RANCHER_PROJECT_ID: ${{ secrets.RANCHER_PROJECT_ID }} + SOCIALGOUV_BASE_DOMAIN: ${{ secrets.SOCIALGOUV_BASE_DOMAIN }} + + - name: Archive indexing job + uses: actions/upload-artifact@v2 + with: + name: indexing.yml + path: indexing.yml + + - name: Get namespace name + uses: mikefarah/yq@master + id: namespace + with: + cmd: yq eval ".metadata.namespace" indexing.yml | head -n 1 + + - name: Create kubernetes config + shell: bash + run: | + mkdir ~/.kube + touch ~/.kube/config + echo ${{ secrets.KUBECONFIG }} | base64 -d > ~/.kube/config + + - name: Launch indexing Job + shell: bash + run: | + kubectl apply -f indexing.yml --namespace ${{ steps.namespace.outputs.result }} diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml new file mode 100644 index 00000000..3e2fbd96 --- /dev/null +++ b/.github/workflows/production.yml @@ -0,0 +1,75 @@ +name: Production + +on: + push: + tags: + - v* + +concurrency: + group: production + cancel-in-progress: true + +jobs: + ############################################################################## + ## BUILD AND REGISTER DOCKER IMAGE + ############################################################################## + register: + name: Build & Register docker images + runs-on: ubuntu-latest + steps: + - name: Get project name + run: | + echo "project=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV + + - name: Register API + uses: SocialGouv/actions/autodevops-build-register@v1 + with: + project: ${{ env.project }} + imageName: ${{ env.project }}/search + token: ${{ secrets.GITHUB_TOKEN }} + dockerfile: ./api/Dockerfile + dockercontext: ./api + + - name: Register Frontend (demo) + uses: SocialGouv/actions/autodevops-build-register@v1 + with: + project: ${{ env.project }} + imageName: ${{ env.project }}/front + token: ${{ secrets.GITHUB_TOKEN }} + dockerfile: ./front/Dockerfile + dockercontext: ./front + + - name: Register Indexing + uses: SocialGouv/actions/autodevops-build-register@v1 + with: + project: ${{ env.project }} + imageName: ${{ env.project }}/index + token: ${{ secrets.GITHUB_TOKEN }} + dockerfile: ./index/Dockerfile + dockercontext: ./index + + ############################################################################## + ## DEPLOY PRODUCTION APPLICATION + ############################################################################## + deploy-prod: + name: Deploy production + runs-on: ubuntu-latest + needs: [register] + environment: + name: production + url: https://recherche-entreprises.fabrique.social.gouv.fr + steps: + - name: Use k8s manifests generation + uses: SocialGouv/actions/k8s-manifests@v1 + with: + environment: "prod" + rancherId: ${{ secrets.RANCHER_PROJECT_ID }} + socialgouvBaseDomain: ${{ secrets.SOCIALGOUV_BASE_DOMAIN }} + + - name: Use autodevops deployment + uses: SocialGouv/actions/autodevops-deploy@v1 + with: + environment: "prod" + token: ${{ secrets.GITHUB_TOKEN }} + kubeconfig: ${{ secrets.KUBECONFIG }} + rancherId: ${{ secrets.RANCHER_PROJECT_ID }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..2ac85b99 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,17 @@ +name: Release + +on: + workflow_dispatch: + push: + branches: [master, alpha, beta, next] + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - uses: SocialGouv/actions/autodevops-release@v1 + with: + github-token: ${{ secrets.SOCIALGROOVYBOT_BOTO_PAT }} + author-name: ${{ secrets.SOCIALGROOVYBOT_NAME }} + author-email: ${{ secrets.SOCIALGROOVYBOT_EMAIL }} diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml new file mode 100644 index 00000000..ca7b02cb --- /dev/null +++ b/.github/workflows/review.yml @@ -0,0 +1,81 @@ +name: Review + +on: + push: + branches: + - "**" + tags-ignore: + - v* + +concurrency: + cancel-in-progress: true + group: ${{ github.ref }} + +jobs: + ############################################################################## + ## BUILD AND REGISTER DOCKER IMAGES + ############################################################################## + register: + name: Build & Register + runs-on: ubuntu-latest + steps: + - name: Get project name + run: | + echo "project=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV + + - name: Register API + uses: SocialGouv/actions/autodevops-build-register@v1 + with: + project: ${{ env.project }} + imageName: ${{ env.project }}/search + token: ${{ secrets.GITHUB_TOKEN }} + dockerfile: ./api/Dockerfile + dockercontext: ./api + + - name: Register Frontend (demo) + uses: SocialGouv/actions/autodevops-build-register@v1 + with: + project: ${{ env.project }} + imageName: ${{ env.project }}/front + token: ${{ secrets.GITHUB_TOKEN }} + dockerfile: ./front/Dockerfile + dockercontext: ./front + + - name: Register Indexing + uses: SocialGouv/actions/autodevops-build-register@v1 + with: + project: ${{ env.project }} + imageName: ${{ env.project }}/index + token: ${{ secrets.GITHUB_TOKEN }} + dockerfile: ./index/Dockerfile + dockercontext: ./index + + ############################################################################## + ## GENERATE KUBERNETES MANIFESTS + ############################################################################## + manifests: + name: Generate k8s manifests + runs-on: ubuntu-latest + steps: + - name: Use k8s manifests generation + uses: SocialGouv/actions/k8s-manifests@v1 + with: + environment: "dev" + rancherId: ${{ secrets.RANCHER_PROJECT_ID }} + socialgouvBaseDomain: ${{ secrets.SOCIALGOUV_BASE_DOMAIN }} + + ############################################################################## + ## DEPLOY APPLICATION OVER KUBERNETES + ############################################################################## + deploy: + name: Deploy application + runs-on: ubuntu-latest + needs: [register, manifests] + steps: + - name: Use autodevops deployment + uses: SocialGouv/actions/autodevops-deploy@v1 + with: + environment: "dev" + token: ${{ secrets.GITHUB_TOKEN }} + kubeconfig: ${{ secrets.KUBECONFIG }} + rancherId: ${{ secrets.RANCHER_PROJECT_ID }} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index bd775d84..00000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,77 +0,0 @@ -include: - - project: SocialGouv/gitlab-ci-yml - file: /autodevops.yml - ref: v23.0.1 - -variables: - # AUTO_DEVOPS_TEST_DISABLED: "🛑" - AUTO_DEVOPS_QUALITY_DISABLED: "🛑" - AUTO_DEVOPS_KANIKO: "🛑" - # AUTO_DEVOPS_ENABLE_KAPP: "🛑" - AUTO_DEVOPS_RELEASE_AUTO: "🚀" - AUTO_DEVOPS_PRODUCTION_AUTO: "🚀" - -Install: - script: - - echo "no install" - -Test: - script: - - echo "no test" - -Build: - rules: - - when: never - -Register Kaniko image: - extends: .autodevops_register_kaniko_image - needs: [] - variables: - CONTEXT: ./index - IMAGE_NAME: recherche-entreprises-index - -Register API image: - extends: .autodevops_register_kaniko_image - needs: [] - variables: - CONTEXT: ./api - IMAGE_NAME: recherche-entreprises-api - -.indexing_job: - stage: Deploy - extends: - - .base_deploy_kosko_stage - allow_failure: true - -############## -# -# Note: these memory intensive jobs cannot run on public Github actions runners -# -############## - -Download and Index (dev): - extends: - - .indexing_job - rules: - - if: "$CI_COMMIT_TAG" - when: never - - when: manual - variables: - KOSKO_GENERATE_ARGS: --env dev jobs/indexing - environment: - name: ${CI_COMMIT_REF_NAME}${AUTO_DEVOPS_DEV_ENVIRONMENT_NAME} - url: https://${CI_ENVIRONMENT_SLUG}-${CI_PROJECT_NAME}.${KUBE_INGRESS_BASE_DOMAIN} - -Download and Index (prod): - extends: - - .indexing_job - rules: - - if: "$CI_COMMIT_TAG" - when: manual - variables: - # the preprod env is used for production index - # so it runs on the dev cluster - KOSKO_GENERATE_ARGS: --env preprod jobs/indexing - environment: - name: preprod${AUTO_DEVOPS_PREPROD_ENVIRONMENT_NAME} - url: https://preprod-${CI_PROJECT_NAME}.${KUBE_INGRESS_BASE_DOMAIN} diff --git a/.k8s/__tests__/__snapshots__/dev.ts.snap b/.k8s/__tests__/__snapshots__/dev.ts.snap index 6352247e..bab93c79 100644 --- a/.k8s/__tests__/__snapshots__/dev.ts.snap +++ b/.k8s/__tests__/__snapshots__/dev.ts.snap @@ -10,20 +10,21 @@ metadata: janitor/ttl: 15d field.cattle.io/creatorId: gitlab field.cattle.io/projectId: c-bd7z2:p-7ms8p - git/branch: master - git/remote: >- - https://gitlab-ci-token:[MASKED]@gitlab.factory.social.gouv.fr/SocialGouv/recherche-entreprises.git - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: master-dev42 - app.gitlab.com/env.name: master-dev42 + git/branch: refs/heads/mybranch + git/remote: socialgouv/recherche-entreprises + app.github.com/job: '5678' + app.github.com/ref: refs/heads/mybranch + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' labels: azure-pg-admin-user: recherche-entreprises - application: master-dev42-recherche-entreprises - component: master-dev42-recherche-entreprises + application: recherche-entreprises + component: recherche-entreprises owner: recherche-entreprises team: recherche-entreprises cert: wildcard - name: recherche-entreprises-85-master-dev42 + name: recherche-entreprises-mybranch --- apiVersion: apps/v1 kind: Deployment @@ -31,18 +32,20 @@ metadata: annotations: kapp.k14s.io/disable-default-ownership-label-rules: '' kapp.k14s.io/disable-default-label-scoping-rules: '' - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: master-dev42 - app.gitlab.com/env.name: master-dev42 + app.github.com/job: '5678' + app.github.com/ref: refs/heads/mybranch + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' labels: app: recherche-entreprises-api - application: master-dev42-recherche-entreprises - component: master-dev42-recherche-entreprises + application: recherche-entreprises + component: recherche-entreprises owner: recherche-entreprises team: recherche-entreprises cert: wildcard name: recherche-entreprises-api - namespace: recherche-entreprises-85-master-dev42 + namespace: recherche-entreprises-mybranch spec: replicas: 1 selector: @@ -53,20 +56,21 @@ spec: annotations: kapp.k14s.io/disable-default-ownership-label-rules: '' kapp.k14s.io/disable-default-label-scoping-rules: '' - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: master-dev42 - app.gitlab.com/env.name: master-dev42 + app.github.com/job: '5678' + app.github.com/ref: refs/heads/mybranch + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' labels: app: recherche-entreprises-api - application: master-dev42-recherche-entreprises - component: master-dev42-recherche-entreprises + application: recherche-entreprises + component: recherche-entreprises owner: recherche-entreprises team: recherche-entreprises cert: wildcard spec: containers: - - image: >- - harbor.fabrique.social.gouv.fr/cdtn/recherche-entreprises-api:0123456789abcdefghijklmnopqrstuvwxyz0123 + - image: harbor.fabrique.social.gouv.fr/cdtn/recherche-entreprises-api:1.5.8 livenessProbe: failureThreshold: 6 httpGet: @@ -113,35 +117,39 @@ metadata: sealedsecrets.bitnami.com/cluster-wide: 'true' kapp.k14s.io/disable-default-ownership-label-rules: '' kapp.k14s.io/disable-default-label-scoping-rules: '' - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: master-dev42 - app.gitlab.com/env.name: master-dev42 + app.github.com/job: '5678' + app.github.com/ref: refs/heads/mybranch + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' labels: - application: master-dev42-recherche-entreprises - component: master-dev42-recherche-entreprises + application: recherche-entreprises + component: recherche-entreprises owner: recherche-entreprises team: recherche-entreprises cert: wildcard - namespace: recherche-entreprises-85-master-dev42 + namespace: recherche-entreprises-mybranch spec: encryptedData: ELASTICSEARCH_URL: >- - AgDGWiSE5kUv0Mv4Dot8KfbSGm5XVlyi4V9yLiMI97deZctFWRd2T31MtTUz/XgT4VlFH4NUhK+dQonLEILE2P9rs4MMDaY09cc3NZiDLB9GJoBcWnWsa02QV4Xykk8UthTHQPFC4g+0ElFU4UewbIc3Zc2ZqIk5Y803TnYkRuAF1bM1ZdpWGnm+yh7+lXnbRMmFo62vhPVB8lnl9Z/RVxhs1jx6xnbIFyTjvelM4/sySiyHZ0h74fL61DAvOcNBgCTd49RRBBzcAhp6a8KL45FL1eAYyOqS8vW5uNeFu59Cu9ByRruhyTELjpPtLesjsBUHiqmfBh09esKw+mdtMmfYxIsy+JGPS50N8GiNj+n0A5XXtLQkm9oT884r4LEQip35YHyenh20NmueHX8RGMOXRT05PWnbL70NtZHqUwzFdc21vdFhXAb/MVaMgqcKG4RPkRS+qljn+pQjJ8DkY0EqgWOCfSyjB+jKJ65peSqqORq+B8zTDgpv9ZaN+xSDsfi+PckPPJqKOjaTkQW/VdfwpT6ipOUpNgznUOGy7XN9vxAQR9P79n6KlIyMsme4hN7OHX5ko0xWQZcCyfHbSbT7JHY5UpmTv+c0NtyrV755FQN75HDFRhQYHtgLnhR9PuBCZ8Gvtg2T/Nr63GsTMC5e52bj2zIRlOUTrsvxEIYKQoBPILoueEIcMz64/UiMAZ9RwH308wRHOrZtch5gclzUQWZEgI5Vx2cJQ/zr9iqBaedg2v8GqvESeKw1e7pgXoL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5uct7T4Lli4Dz/vJucBthIBVgYaVX/jLqfaNWpD1TuWkTHsf4gR5HErzQp60NDej/I7TespFMqRMhrroc6VaH/Wl6wV4msRM3sYaxcHPd4kJxrOeA7cQnfqQsWs4/RG++p+TCmD18qgevVBV1z11vFu2R6KE+c1YRANE5e6EBMO8yUly1yarrx6jOo6E5kAdKqPGkNUyq3BgOvGWmkbV32slQ4hXm7zUuyVnXBmpmoryowHhqV7iW8Si6CSMKACCENVqJPrk55VaL8sw8dZfQF0aekJoEqf/UqAv/DZUTYOAg4QI+4iD4= template: metadata: annotations: sealedsecrets.bitnami.com/cluster-wide: 'true' kapp.k14s.io/disable-default-ownership-label-rules: '' kapp.k14s.io/disable-default-label-scoping-rules: '' - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: master-dev42 - app.gitlab.com/env.name: master-dev42 + app.github.com/job: '5678' + app.github.com/ref: refs/heads/mybranch + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' name: elastic-recherche-entreprises-read labels: - application: master-dev42-recherche-entreprises - component: master-dev42-recherche-entreprises + application: recherche-entreprises + component: recherche-entreprises owner: recherche-entreprises team: recherche-entreprises cert: wildcard @@ -152,8 +160,8 @@ kind: Service metadata: labels: app: recherche-entreprises-api - application: master-dev42-recherche-entreprises - component: master-dev42-recherche-entreprises + application: recherche-entreprises + component: recherche-entreprises owner: recherche-entreprises team: recherche-entreprises cert: wildcard @@ -161,10 +169,12 @@ metadata: annotations: kapp.k14s.io/disable-default-ownership-label-rules: '' kapp.k14s.io/disable-default-label-scoping-rules: '' - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: master-dev42 - app.gitlab.com/env.name: master-dev42 - namespace: recherche-entreprises-85-master-dev42 + app.github.com/job: '5678' + app.github.com/ref: refs/heads/mybranch + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' + namespace: recherche-entreprises-mybranch spec: ports: - name: http @@ -181,21 +191,23 @@ metadata: kubernetes.io/ingress.class: nginx kapp.k14s.io/disable-default-ownership-label-rules: '' kapp.k14s.io/disable-default-label-scoping-rules: '' - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: master-dev42 - app.gitlab.com/env.name: master-dev42 + app.github.com/job: '5678' + app.github.com/ref: refs/heads/mybranch + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' labels: app: recherche-entreprises-api - application: master-dev42-recherche-entreprises - component: master-dev42-recherche-entreprises + application: recherche-entreprises + component: recherche-entreprises owner: recherche-entreprises team: recherche-entreprises cert: wildcard name: recherche-entreprises-api - namespace: recherche-entreprises-85-master-dev42 + namespace: recherche-entreprises-mybranch spec: rules: - - host: api-master-dev42-recherche-entreprises.dev42.fabrique.social.gouv.fr + - host: api-recherche-entreprises-mybranch.dev2.fabrique.social.gouv.fr http: paths: - backend: @@ -207,7 +219,310 @@ spec: pathType: Prefix tls: - hosts: - - api-master-dev42-recherche-entreprises.dev42.fabrique.social.gouv.fr + - api-recherche-entreprises-mybranch.dev2.fabrique.social.gouv.fr + secretName: wildcard-crt +--- +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/heads/mybranch + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' + labels: + app: recherche-entreprises-search + application: recherche-entreprises + component: recherche-entreprises + owner: recherche-entreprises + team: recherche-entreprises + cert: wildcard + name: recherche-entreprises-search + namespace: recherche-entreprises-mybranch +spec: + replicas: 1 + selector: + matchLabels: + app: recherche-entreprises-search + 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/heads/mybranch + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' + labels: + app: recherche-entreprises-search + application: recherche-entreprises + component: recherche-entreprises + owner: recherche-entreprises + team: recherche-entreprises + cert: wildcard + spec: + containers: + - image: >- + ghcr.io/socialgouv/recherche-entreprises/search:sha-0123456789abcdefghijklmnopqrstuvwxyz0123 + livenessProbe: + failureThreshold: 6 + httpGet: + path: /healthz + port: http + initialDelaySeconds: 30 + periodSeconds: 5 + timeoutSeconds: 5 + name: recherche-entreprises-search + ports: + - containerPort: 3000 + name: http + readinessProbe: + failureThreshold: 15 + httpGet: + path: /healthz + port: http + initialDelaySeconds: 0 + periodSeconds: 5 + successThreshold: 1 + timeoutSeconds: 1 + resources: + limits: + cpu: 500m + memory: 128Mi + requests: + cpu: 5m + memory: 16Mi + startupProbe: + failureThreshold: 12 + httpGet: + path: /healthz + port: http + periodSeconds: 5 + env: + - name: ELASTICSEARCH_INDEX_NAME + value: search-entreprises +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: recherche-entreprises-search + application: recherche-entreprises + component: recherche-entreprises + owner: recherche-entreprises + team: recherche-entreprises + cert: wildcard + name: recherche-entreprises-search + 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/heads/mybranch + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' + namespace: recherche-entreprises-mybranch +spec: + ports: + - name: http + port: 80 + targetPort: 3000 + selector: + app: recherche-entreprises-search + type: ClusterIP +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + kubernetes.io/ingress.class: nginx + 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/heads/mybranch + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' + labels: + app: recherche-entreprises-search + application: recherche-entreprises + component: recherche-entreprises + owner: recherche-entreprises + team: recherche-entreprises + cert: wildcard + name: recherche-entreprises-search + namespace: recherche-entreprises-mybranch +spec: + rules: + - host: search-recherche-entreprises-mybranch.dev2.fabrique.social.gouv.fr + http: + paths: + - backend: + service: + name: recherche-entreprises-search + port: + name: http + path: / + pathType: Prefix + tls: + - hosts: + - search-recherche-entreprises-mybranch.dev2.fabrique.social.gouv.fr + secretName: wildcard-crt +--- +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/heads/mybranch + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' + labels: + app: recherche-entreprises-front + application: recherche-entreprises + component: recherche-entreprises + owner: recherche-entreprises + team: recherche-entreprises + cert: wildcard + name: recherche-entreprises-front + namespace: recherche-entreprises-mybranch +spec: + replicas: 1 + selector: + matchLabels: + app: recherche-entreprises-front + 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/heads/mybranch + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' + labels: + app: recherche-entreprises-front + application: recherche-entreprises + component: recherche-entreprises + owner: recherche-entreprises + team: recherche-entreprises + cert: wildcard + spec: + containers: + - image: >- + ghcr.io/socialgouv/recherche-entreprises/front:sha-0123456789abcdefghijklmnopqrstuvwxyz0123 + livenessProbe: + failureThreshold: 6 + httpGet: + path: /healthz + port: http + initialDelaySeconds: 30 + periodSeconds: 5 + timeoutSeconds: 5 + name: recherche-entreprises-front + ports: + - containerPort: 80 + name: http + readinessProbe: + failureThreshold: 15 + httpGet: + path: /healthz + port: http + initialDelaySeconds: 0 + periodSeconds: 5 + successThreshold: 1 + timeoutSeconds: 1 + resources: + limits: + cpu: 500m + memory: 128Mi + requests: + cpu: 5m + memory: 16Mi + startupProbe: + failureThreshold: 12 + httpGet: + path: /healthz + port: http + periodSeconds: 5 + env: + - name: REACT_APP_API_URL + value: >- + https://search-recherche-entreprises-mybranch.dev2.fabrique.social.gouv.fr/api/v1 +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: recherche-entreprises-front + application: recherche-entreprises + component: recherche-entreprises + owner: recherche-entreprises + team: recherche-entreprises + cert: wildcard + name: recherche-entreprises-front + 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/heads/mybranch + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' + namespace: recherche-entreprises-mybranch +spec: + ports: + - name: http + port: 80 + targetPort: 80 + selector: + app: recherche-entreprises-front + type: ClusterIP +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + kubernetes.io/ingress.class: nginx + 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/heads/mybranch + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' + labels: + app: recherche-entreprises-front + application: recherche-entreprises + component: recherche-entreprises + owner: recherche-entreprises + team: recherche-entreprises + cert: wildcard + name: recherche-entreprises-front + namespace: recherche-entreprises-mybranch +spec: + rules: + - host: recherche-entreprises-mybranch.dev2.fabrique.social.gouv.fr + http: + paths: + - backend: + service: + name: recherche-entreprises-front + port: + name: http + path: / + pathType: Prefix + tls: + - hosts: + - recherche-entreprises-mybranch.dev2.fabrique.social.gouv.fr secretName: wildcard-crt " `; diff --git a/.k8s/__tests__/__snapshots__/indexing-dev.ts.snap b/.k8s/__tests__/__snapshots__/indexing-dev.ts.snap index afce1fe8..316ad409 100644 --- a/.k8s/__tests__/__snapshots__/indexing-dev.ts.snap +++ b/.k8s/__tests__/__snapshots__/indexing-dev.ts.snap @@ -8,33 +8,37 @@ metadata: name: elastic-recherche-entreprises-write annotations: sealedsecrets.bitnami.com/cluster-wide: 'true' - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: master-dev42 - app.gitlab.com/env.name: master-dev42 + app.github.com/job: '5678' + app.github.com/ref: refs/heads/mybranch + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' labels: - application: master-dev42-recherche-entreprises - component: master-dev42-recherche-entreprises + application: recherche-entreprises + component: recherche-entreprises owner: recherche-entreprises team: recherche-entreprises cert: wildcard - namespace: recherche-entreprises-85-master-dev42 + namespace: recherche-entreprises-mybranch spec: encryptedData: ELASTICSEARCH_URL: >- - AgDGWiSE5kUv0Mv4Dot8KfbSGm5XVlyi4V9yLiMI97deZctFWRd2T31MtTUz/XgT4VlFH4NUhK+dQonLEILE2P9rs4MMDaY09cc3NZiDLB9GJoBcWnWsa02QV4Xykk8UthTHQPFC4g+0ElFU4UewbIc3Zc2ZqIk5Y803TnYkRuAF1bM1ZdpWGnm+yh7+lXnbRMmFo62vhPVB8lnl9Z/RVxhs1jx6xnbIFyTjvelM4/sySiyHZ0h74fL61DAvOcNBgCTd49RRBBzcAhp6a8KL45FL1eAYyOqS8vW5uNeFu59Cu9ByRruhyTELjpPtLesjsBUHiqmfBh09esKw+mdtMmfYxIsy+JGPS50N8GiNj+n0A5XXtLQkm9oT884r4LEQip35YHyenh20NmueHX8RGMOXRT05PWnbL70NtZHqUwzFdc21vdFhXAb/MVaMgqcKG4RPkRS+qljn+pQjJ8DkY0EqgWOCfSyjB+jKJ65peSqqORq+B8zTDgpv9ZaN+xSDsfi+PckPPJqKOjaTkQW/VdfwpT6ipOUpNgznUOGy7XN9vxAQR9P79n6KlIyMsme4hN7OHX5ko0xWQZcCyfHbSbT7JHY5UpmTv+c0NtyrV755FQN75HDFRhQYHtg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K7FQ3HubkrDHvDPBJyaeyzLWgcXeox077xiCti7BaKssVO2itM6BO9gMyvC2hwnw5LjtItj1mY25wGRmMz5B8/9vMYMZ6Xmjf3DaczAUwL3RcW3NYqjbUc03pz45uAavC2ImNXtIBIoaaXh0T0rX6ZcQaJZxpax29KydecKDoDnkkx3owpVZoZryebXgG/sW34ddaoHsLwgKwBdxVoNO+L04g46JdXoJclPA/7GVPDz0voMCHIZymrBfRPf/xdqtq5w0EdiIAf7d6GogOjaUU9ujKMJJKw//nu3RmYziVWcaAHzkgKJZahRe+k2Kb8o+YsGFPFYoR936GAnJRnLn8sEMppuP2tHrij6SN/jSRbJll0HgsA/BKzPDhwSu0tiDt81HDZdxXusre5MRNzyiESOoKGSq7hc7ABHCIHSWyhbVNU= template: metadata: annotations: sealedsecrets.bitnami.com/cluster-wide: 'true' - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: master-dev42 - app.gitlab.com/env.name: master-dev42 + app.github.com/job: '5678' + app.github.com/ref: refs/heads/mybranch + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' name: elastic-recherche-entreprises-write labels: - application: master-dev42-recherche-entreprises - component: master-dev42-recherche-entreprises + application: recherche-entreprises + component: recherche-entreprises owner: recherche-entreprises team: recherche-entreprises cert: wildcard @@ -43,43 +47,89 @@ spec: apiVersion: v1 kind: ConfigMap data: - get-data.sh: > + sqlite.sh: > #!/bin/bash - # borrowed from annuaire entreprise : + # exit when any command fails - # https://github.com/etalab/api-annuaire-entreprises/tree/master/db/init + set -e - geodir=\${DATA_DIR}/geo + # download files, convert to SQLite and export to CSV - mkdir -p $geodir + DATA_DIR=\${DATA_DIR:-\\"./data\\"} + + + mkdir -p \\"$DATA_DIR\\" || true + + + echo \\"-- Working in $(dirname \\"$0\\")\\" + + cd \\"$(dirname \\"$0\\")\\" || exit echo \\"-- Download datasets\\" - for d in \`seq -w 1 19\` 2A 2B \`seq 21 74\` \`seq 76 95\` 98 \\"\\"; do - wget --progress=bar:force:noscroll -q --show-progress https://files.data.gouv.fr/geo-sirene/last/dep/geo_siret_$d.csv.gz --directory-prefix=$geodir - gunzip \${geodir}/geo_siret_$d.csv.gz + + if command -v apt-get &> /dev/null + + then + apt-get update -y + fi + + + # install sqlite3 if not exists + + if ! command -v sqlite3 &> /dev/null + + then + echo \\"sqlite3 could not be found\\" + apt-get install -y sqlite3 + fi + + # install wget if not exists + + if ! command -v wget &> /dev/null + + then + echo \\"wget could not be found\\" + apt-get install -y wget + fi + + # install unzip if not exists + + if ! command -v unzip &> /dev/null + + then + echo \\"unzip could not be found\\" + apt-get install -y unzip + fi + + + # geo siret par département + + for d in $(seq -w 1 19) 2A 2B $(seq 21 74) $(seq 76 95) 98 \\"\\"; do + wget --progress=bar:force:noscroll -q --show-progress \\"https://files.data.gouv.fr/geo-sirene/last/dep/geo_siret_$d.csv.gz\\" --directory-prefix=\\"$DATA_DIR\\" + gunzip \\"\${DATA_DIR}/geo_siret_$d.csv.gz\\" done - #Cas particulier Paris + # Cas particulier Paris 75101-75120 - for d in \`seq -w 1 20\`; do - wget --progress=bar:force:noscroll -q --show-progress https://files.data.gouv.fr/geo-sirene/last/dep/geo_siret_751$d.csv.gz --directory-prefix=$geodir - gunzip \${geodir}/geo_siret_751$d.csv.gz + for d in $(seq -w 1 20); do + wget --progress=bar:force:noscroll -q --show-progress \\"https://files.data.gouv.fr/geo-sirene/last/dep/geo_siret_751$d.csv.gz\\" --directory-prefix=\\"$DATA_DIR\\" + gunzip \\"\${DATA_DIR}/geo_siret_751$d.csv.gz\\" done - #Cas particulier DOM + # Cas particulier DOM 971->978 - for d in \`seq -w 1 8\`; do - wget --progress=bar:force:noscroll -q --show-progress https://files.data.gouv.fr/geo-sirene/last/dep/geo_siret_97$d.csv.gz --directory-prefix=$geodir - gunzip \${geodir}/geo_siret_97$d.csv.gz + for d in $(seq -w 1 8); do + wget --progress=bar:force:noscroll -q --show-progress \\"https://files.data.gouv.fr/geo-sirene/last/dep/geo_siret_97$d.csv.gz\\" --directory-prefix=\\"$DATA_DIR\\" + gunzip \\"\${DATA_DIR}/geo_siret_97$d.csv.gz\\" done @@ -87,224 +137,256 @@ data: wget --progress=bar:force:noscroll -q --show-progress https://files.data.gouv.fr/insee-sirene/StockUniteLegale_utf8.zip - --directory-prefix=$DATA_DIR + --directory-prefix=\\"$DATA_DIR\\" + + unzip \\"\${DATA_DIR}/StockUniteLegale_utf8.zip\\" -d \\"\${DATA_DIR}\\" # WEEZ data wget --progress=bar:force:noscroll -q --show-progress https://www.data.gouv.fr/fr/datasets/r/a785345a-6e8c-4961-ae0a-bc00878e4f2e - -O \${DATA_DIR}/WEEZ.csv - assemble_data.py: | - \\"\\"\\"CDTN Entreprises data assembler - - This script assembles data from different places and creates a new file that - will be used as source for our search index. - - \\"\\"\\" - import argparse - import pandas as pd - import numpy as np - from os import listdir - from os.path import isfile, join - - - def read_siren(stock_unite_legale_file): - \\"\\"\\" Read SIREN Stock Unite Legale - - Parameters - ---------- - stock_unite_legale_file: str - The location of the CSV or ZIP file - - Returns - ------- - employeurs - a Pandas dataframe containing the list of all companies that are still open - and employ people - \\"\\"\\" - trancheEffectifsUniteLegale = \\"trancheEffectifsUniteLegale\\" - categorieJuridiqueUniteLegale = \\"categorieJuridiqueUniteLegale\\" - nomenclatureActivitePrincipaleUniteLegale = \\"nomenclatureActivitePrincipaleUniteLegale\\" - categorieEntreprise = \\"categorieEntreprise\\" - activitePrincipaleUniteLegale = \\"activitePrincipaleUniteLegale\\" - - selection = [\\"siren\\", \\"sigleUniteLegale\\", \\"nomUniteLegale\\", \\"nomUsageUniteLegale\\", - 'denominationUniteLegale', \\"denominationUsuelle1UniteLegale\\", \\"denominationUsuelle2UniteLegale\\", - \\"denominationUsuelle3UniteLegale\\", activitePrincipaleUniteLegale, - trancheEffectifsUniteLegale, categorieJuridiqueUniteLegale, - nomenclatureActivitePrincipaleUniteLegale, categorieEntreprise] - - etatAdmin = \\"etatAdministratifUniteLegale\\" - caractereEmployeur = \\"caractereEmployeurUniteLegale\\" - - # we only select columns in use and convert to categorical dtype - # in order to decrease the dataframe memory footprint - cols = selection + [etatAdmin, caractereEmployeur] - raw = pd.read_csv(stock_unite_legale_file, usecols=cols, - dtype={ \\"siren\\": np.dtype(str), etatAdmin: \\"category\\", caractereEmployeur: \\"category\\", - trancheEffectifsUniteLegale: \\"category\\", - categorieJuridiqueUniteLegale: \\"category\\", - nomenclatureActivitePrincipaleUniteLegale: \\"category\\", - activitePrincipaleUniteLegale: \\"category\\", - categorieEntreprise: \\"category\\"}, ) - - is_ouvert = raw[etatAdmin] == \\"A\\" - is_employeur = raw[caractereEmployeur] == \\"O\\" - is_admin = raw[etatAdmin] == \\"A\\" - - employeurs = raw[is_ouvert & is_employeur & is_admin] - - return employeurs[selection] - - - def read_geo(geo_directory): - \\"\\"\\" Read GEO data - - Parameters - ---------- - geo_directory: str - The directory containing geo data for all regions - - Returns - ------- - all_geo - a Pandas dataframe containing geo information for all open companies - \\"\\"\\" - geo_files = [f for f in listdir( - geo_directory) if isfile(join(geo_directory, f))] - geo_selection = [\\"enseigne1Etablissement\\", \\"enseigne2Etablissement\\", \\"enseigne3Etablissement\\", \\"denominationUsuelleEtablissement\\", \\"activitePrincipaleEtablissement\\", - 'siren', 'siret', 'codePostalEtablissement', 'libelleCommuneEtablissement', \\"etatAdministratifEtablissement\\", \\"geo_adresse\\"] - geo = {} - for file in geo_files: - geo[file] = pd.read_csv( - geo_directory + file, dtype={\\"codePostalEtablissement\\": np.dtype(str), - \\"etatAdministratifEtablissement\\": \\"category\\", - \\"activitePrincipaleEtablissement\\": \\"category\\", - \\"siret\\": np.dtype(str), - \\"siren\\": np.dtype(str), - }, usecols=geo_selection - ) - - all_geo = pd.concat(geo.values(), ignore_index=True).dropna( - subset=['siret']) - - all_geo = all_geo.astype(dtype={\\"codePostalEtablissement\\": np.dtype(str), - \\"etatAdministratifEtablissement\\": \\"category\\", - \\"activitePrincipaleEtablissement\\": \\"category\\", - \\"siret\\": np.dtype(str), - \\"siren\\": np.dtype(str), - }) - - all_geo = all_geo[all_geo[\\"etatAdministratifEtablissement\\"] == \\"A\\"] - - return all_geo - - - def read_idcc(idcc_file): - \\"\\"\\" Read IDCC data - - Parameters - ---------- - idcc_file: str - The location of the CSV file containing associations between companies and their \\"convention collectives\\", (aka WEEZ) - - Returns - ------- - idccs - a Pandas dataframe containing siret / idcc associations - \\"\\"\\" - idccs = pd.read_csv(idcc_file, dtype={\\"SIRET\\": np.dtype(str)}, usecols=[\\"SIRET\\", \\"IDCC\\"]).rename( - columns={\\"SIRET\\": \\"siret\\", \\"IDCC\\": \\"idcc\\"}) - - return idccs - - - def assemble(siren, geo, idcc, output): - sirenGeo = pd.merge(siren, geo, on='siren') - merged = pd.merge(sirenGeo, idcc, how='left', on='siret') - - # add etablissement counts - etsCounts = merged.siren.value_counts().rename_axis( - 'siren').reset_index(name='etablissements') - withEts = pd.merge(merged, etsCounts, on='siren') - - # persits as CSV file - withEts.astype({'idcc': 'Int64'}).to_csv(output) - - - def main(): - parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument( - 'siren_file', - type=str, - help=\\"Location of the StockUniteLegale CSV or ZIP file\\" - ) - parser.add_argument( - 'geo_directory', - type=str, - help=\\"Location of the directory containing all the Geo CSV files\\" - ) - parser.add_argument( - 'idcc_file', - type=str, - help=\\"Location of the siret/idcc CSV file (aka WEEZ)\\" - ) - parser.add_argument( - 'output_file', - type=str, - help=\\"Location of the output file\\" - ) - - args = parser.parse_args() - - print(\\"Read SIREN data\\") - siren = read_siren(args.siren_file) - - print(\\"Read GEO data\\") - geo = read_geo(args.geo_directory) - - print(\\"Read IDCC data\\") - idcc = read_idcc(args.idcc_file) - - print(\\"Assemble datasets\\") - assemble(siren, geo, idcc, args.output_file) - - - if __name__ == \\"__main__\\": - main() - requirements.txt: | - numpy - pandas + -O \\"\${DATA_DIR}/WEEZ.csv\\" + + + echo \\"-- Import CSV datasets to sqlite\\" + + + sqlite3 -echo \\"\${DATA_DIR}/db.sqlite\\" \\".read import.sql\\" + + + echo \\"-- Export sqlite data to \${DATA_DIR}/assembly.csv\\" + + + sqlite3 -header -csv \\"\${DATA_DIR}/db.sqlite\\" \\".read export.sql\\" > + \\"\${DATA_DIR}/assembly.csv\\" + import.sql: |- + --- sqlite3 -echo db.sqlite \\".read import.sql\\" + --- + --- import local CSVs to sqlite database + --- + + PRAGMA synchronous = OFF; + + DROP TABLE IF EXISTS weez; + DROP TABLE IF EXISTS geo_siret; + DROP TABLE IF EXISTS stock; + + .mode csv + .import data/WEEZ.csv weez + .import data/StockUniteLegale_utf8.csv stock + .import data/geo_siret_.csv geo_siret + .import data/geo_siret_01.csv geo_siret + .import data/geo_siret_02.csv geo_siret + .import data/geo_siret_03.csv geo_siret + .import data/geo_siret_04.csv geo_siret + .import data/geo_siret_05.csv geo_siret + .import data/geo_siret_06.csv geo_siret + .import data/geo_siret_07.csv geo_siret + .import data/geo_siret_08.csv geo_siret + .import data/geo_siret_09.csv geo_siret + .import data/geo_siret_10.csv geo_siret + .import data/geo_siret_11.csv geo_siret + .import data/geo_siret_12.csv geo_siret + .import data/geo_siret_13.csv geo_siret + .import data/geo_siret_14.csv geo_siret + .import data/geo_siret_15.csv geo_siret + .import data/geo_siret_16.csv geo_siret + .import data/geo_siret_17.csv geo_siret + .import data/geo_siret_18.csv geo_siret + .import data/geo_siret_19.csv geo_siret + .import data/geo_siret_21.csv geo_siret + .import data/geo_siret_22.csv geo_siret + .import data/geo_siret_23.csv geo_siret + .import data/geo_siret_24.csv geo_siret + .import data/geo_siret_25.csv geo_siret + .import data/geo_siret_26.csv geo_siret + .import data/geo_siret_27.csv geo_siret + .import data/geo_siret_28.csv geo_siret + .import data/geo_siret_29.csv geo_siret + .import data/geo_siret_2A.csv geo_siret + .import data/geo_siret_2B.csv geo_siret + .import data/geo_siret_30.csv geo_siret + .import data/geo_siret_31.csv geo_siret + .import data/geo_siret_32.csv geo_siret + .import data/geo_siret_33.csv geo_siret + .import data/geo_siret_34.csv geo_siret + .import data/geo_siret_35.csv geo_siret + .import data/geo_siret_36.csv geo_siret + .import data/geo_siret_37.csv geo_siret + .import data/geo_siret_38.csv geo_siret + .import data/geo_siret_39.csv geo_siret + .import data/geo_siret_40.csv geo_siret + .import data/geo_siret_41.csv geo_siret + .import data/geo_siret_42.csv geo_siret + .import data/geo_siret_43.csv geo_siret + .import data/geo_siret_44.csv geo_siret + .import data/geo_siret_45.csv geo_siret + .import data/geo_siret_46.csv geo_siret + .import data/geo_siret_47.csv geo_siret + .import data/geo_siret_48.csv geo_siret + .import data/geo_siret_49.csv geo_siret + .import data/geo_siret_50.csv geo_siret + .import data/geo_siret_51.csv geo_siret + .import data/geo_siret_52.csv geo_siret + .import data/geo_siret_53.csv geo_siret + .import data/geo_siret_54.csv geo_siret + .import data/geo_siret_55.csv geo_siret + .import data/geo_siret_56.csv geo_siret + .import data/geo_siret_57.csv geo_siret + .import data/geo_siret_58.csv geo_siret + .import data/geo_siret_59.csv geo_siret + .import data/geo_siret_60.csv geo_siret + .import data/geo_siret_61.csv geo_siret + .import data/geo_siret_62.csv geo_siret + .import data/geo_siret_63.csv geo_siret + .import data/geo_siret_64.csv geo_siret + .import data/geo_siret_65.csv geo_siret + .import data/geo_siret_66.csv geo_siret + .import data/geo_siret_67.csv geo_siret + .import data/geo_siret_68.csv geo_siret + .import data/geo_siret_69.csv geo_siret + .import data/geo_siret_70.csv geo_siret + .import data/geo_siret_71.csv geo_siret + .import data/geo_siret_72.csv geo_siret + .import data/geo_siret_73.csv geo_siret + .import data/geo_siret_74.csv geo_siret + .import data/geo_siret_75101.csv geo_siret + .import data/geo_siret_75102.csv geo_siret + .import data/geo_siret_75103.csv geo_siret + .import data/geo_siret_75104.csv geo_siret + .import data/geo_siret_75105.csv geo_siret + .import data/geo_siret_75106.csv geo_siret + .import data/geo_siret_75107.csv geo_siret + .import data/geo_siret_75108.csv geo_siret + .import data/geo_siret_75109.csv geo_siret + .import data/geo_siret_75110.csv geo_siret + .import data/geo_siret_75111.csv geo_siret + .import data/geo_siret_75112.csv geo_siret + .import data/geo_siret_75113.csv geo_siret + .import data/geo_siret_75114.csv geo_siret + .import data/geo_siret_75115.csv geo_siret + .import data/geo_siret_75116.csv geo_siret + .import data/geo_siret_75117.csv geo_siret + .import data/geo_siret_75118.csv geo_siret + .import data/geo_siret_75119.csv geo_siret + .import data/geo_siret_75120.csv geo_siret + .import data/geo_siret_76.csv geo_siret + .import data/geo_siret_77.csv geo_siret + .import data/geo_siret_78.csv geo_siret + .import data/geo_siret_79.csv geo_siret + .import data/geo_siret_80.csv geo_siret + .import data/geo_siret_81.csv geo_siret + .import data/geo_siret_82.csv geo_siret + .import data/geo_siret_83.csv geo_siret + .import data/geo_siret_84.csv geo_siret + .import data/geo_siret_85.csv geo_siret + .import data/geo_siret_86.csv geo_siret + .import data/geo_siret_87.csv geo_siret + .import data/geo_siret_88.csv geo_siret + .import data/geo_siret_89.csv geo_siret + .import data/geo_siret_90.csv geo_siret + .import data/geo_siret_91.csv geo_siret + .import data/geo_siret_92.csv geo_siret + .import data/geo_siret_93.csv geo_siret + .import data/geo_siret_94.csv geo_siret + .import data/geo_siret_95.csv geo_siret + .import data/geo_siret_971.csv geo_siret + .import data/geo_siret_972.csv geo_siret + .import data/geo_siret_973.csv geo_siret + .import data/geo_siret_974.csv geo_siret + .import data/geo_siret_975.csv geo_siret + .import data/geo_siret_976.csv geo_siret + .import data/geo_siret_977.csv geo_siret + .import data/geo_siret_978.csv geo_siret + .import data/geo_siret_98.csv geo_siret + + CREATE INDEX 'geo_siret_idx' ON 'geo_siret' ('siret'); + CREATE INDEX 'geo_siren_idx' ON 'geo_siret' ('siren'); + CREATE INDEX 'weez_siret_idx' ON 'weez' ('SIRET'); + CREATE INDEX 'stock_siren_idx' ON 'stock' ('siren'); + + SELECT \\"weez\\", count(*) from weez; + SELECT \\"stock\\", count(*) from stock; + SELECT \\"geo_siret\\", count(*) from geo_siret; + export.sql: |+ + --- Output index data + --- sqlite3 -header -csv db.sqlite \\".read export.sql\\" > output.csv + + PRAGMA synchronous = OFF; + + SELECT + stock.siren, + stock.sigleUniteLegale, + stock.nomUniteLegale, + stock.prenom1UniteLegale, + stock.nomUsageUniteLegale, + stock.denominationUniteLegale, + stock.denominationUsuelle1UniteLegale, + stock.denominationUsuelle2UniteLegale, + stock.denominationUsuelle3UniteLegale, + stock.activitePrincipaleUniteLegale, + stock.trancheEffectifsUniteLegale, + stock.categorieJuridiqueUniteLegale, + stock.nomenclatureActivitePrincipaleUniteLegale, + stock.categorieEntreprise, + stock.etatAdministratifUniteLegale, + stock.caractereEmployeurUniteLegale, + geo_siret.siret, + geo_siret.codePostalEtablissement, + geo_siret.libelleCommuneEtablissement, + geo_siret.etatAdministratifEtablissement, + geo_siret.enseigne1Etablissement, + geo_siret.enseigne2Etablissement, + geo_siret.enseigne3Etablissement, + geo_siret.denominationUsuelleEtablissement, + geo_siret.activitePrincipaleEtablissement, + geo_siret.geo_adresse, + geo_siret.complementAdresseEtablissement, + geo_siret.numeroVoieEtablissement, + geo_siret.indiceRepetitionEtablissement, + geo_siret.typeVoieEtablissement, + geo_siret.libelleVoieEtablissement, + weez.IDCC as idcc, + (select count(*) FROM geo_siret where siren=stock.siren) etablissements + from stock, geo_siret + left join weez on weez.SIRET=geo_siret.siret + where stock.siren=geo_siret.siren; + + metadata: - name: config-map-files-0123456 + name: config-map-files-0123456789abcdefghijklmnopqrstuvwxyz0123 annotations: - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: master-dev42 - app.gitlab.com/env.name: master-dev42 + app.github.com/job: '5678' + app.github.com/ref: refs/heads/mybranch + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' labels: - application: master-dev42-recherche-entreprises - component: master-dev42-recherche-entreprises + application: recherche-entreprises + component: recherche-entreprises owner: recherche-entreprises team: recherche-entreprises cert: wildcard - namespace: recherche-entreprises-85-master-dev42 + namespace: recherche-entreprises-mybranch --- apiVersion: batch/v1 kind: Job metadata: - name: update-index-0123456 + name: update-index-0123456789abcdefghijklmnopqrstuvwxyz0123 annotations: - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: master-dev42 - app.gitlab.com/env.name: master-dev42 + app.github.com/job: '5678' + app.github.com/ref: refs/heads/mybranch + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' labels: - application: master-dev42-recherche-entreprises - component: master-dev42-recherche-entreprises + application: recherche-entreprises + component: recherche-entreprises owner: recherche-entreprises team: recherche-entreprises cert: wildcard - namespace: recherche-entreprises-85-master-dev42 + namespace: recherche-entreprises-mybranch spec: backoffLimit: 3 template: @@ -312,78 +394,66 @@ spec: containers: - name: update-index image: >- - harbor.fabrique.social.gouv.fr/cdtn/recherche-entreprises-index:0123456789abcdefghijklmnopqrstuvwxyz0123 + ghcr.io/socialgouv/recherche-entreprises/index:sha-0123456789abcdefghijklmnopqrstuvwxyz0123 volumeMounts: - name: data mountPath: /data env: - name: ASSEMBLY_FILE value: /data/assembly.csv + - name: ELASTICSEARCH_INDEX_NAME + value: search-entreprises envFrom: - secretRef: name: elastic-recherche-entreprises-write resources: limits: - cpu: '2' - memory: 18Gi + cpu: '4' + memory: 5Gi requests: - cpu: '1' - memory: 14Gi + cpu: '2' + memory: 2Gi restartPolicy: Never volumes: - name: data emptyDir: {} - configMap: - name: config-map-files-0123456 + name: config-map-files-0123456789abcdefghijklmnopqrstuvwxyz0123 defaultMode: 511 name: local-files initContainers: - args: - - '-c' - - > - - apt-get update -y && apt-get install -y wget - - - export DATA_DIR=\\"/data\\" - - - cd /data - - - echo \\"running get-data.sh...\\" - - - /mnt/scripts/get-data.sh - - - pip3 install -r /mnt/scripts/requirements.txt - - - echo \\"running assemble_data.py...\\" - - - python3 /mnt/scripts/assemble_data.py - $DATA_DIR/StockUniteLegale_utf8.zip $DATA_DIR/geo/ - $DATA_DIR/WEEZ.csv $DATA_DIR/assembly.csv + - /mnt/scripts/sqlite.sh command: - sh - image: python:3.9.4 + image: ubuntu:18.04 imagePullPolicy: Always - name: download-data + name: download-build-data + env: + - name: DATA_DIR + value: /mnt/scripts/data + resources: + limits: + cpu: '4' + memory: 2Gi + requests: + cpu: '2' + memory: 1Gi volumeMounts: - name: data - mountPath: /data + mountPath: /mnt/scripts/data - mountPath: /mnt/scripts name: local-files metadata: annotations: - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: master-dev42 - app.gitlab.com/env.name: master-dev42 + app.github.com/job: '5678' + app.github.com/ref: refs/heads/mybranch + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' labels: - application: master-dev42-recherche-entreprises - component: master-dev42-recherche-entreprises + application: recherche-entreprises + component: recherche-entreprises owner: recherche-entreprises team: recherche-entreprises cert: wildcard diff --git a/.k8s/__tests__/__snapshots__/indexing-preprod.ts.snap b/.k8s/__tests__/__snapshots__/indexing-preprod.ts.snap index da5138d9..ee2511cc 100644 --- a/.k8s/__tests__/__snapshots__/indexing-preprod.ts.snap +++ b/.k8s/__tests__/__snapshots__/indexing-preprod.ts.snap @@ -7,32 +7,36 @@ kind: SealedSecret metadata: name: elastic-recherche-entreprises-write annotations: - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: preprod-dev42 - app.gitlab.com/env.name: preprod-dev42 + app.github.com/job: '5678' + app.github.com/ref: refs/tags/v1.2.3 + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' labels: - application: v1-2-3-recherche-entreprises - component: v1-2-3-recherche-entreprises + application: recherche-entreprises + component: recherche-entreprises owner: recherche-entreprises team: recherche-entreprises cert: wildcard - namespace: recherche-entreprises-85-preprod-dev42 + namespace: recherche-entreprises-preprod spec: encryptedData: ELASTICSEARCH_URL: >- - AgB82d7LnDA/6RxRlks/7cRtmWuz6Ql1p4gCwdghu3X85Ek4FqSL6ui1tIBiu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RKUVS0ik0zuT1Xu9u9kU6Df2RVOQawiIOy14+5RrMqt0li1PuCFZjRTqbsLGogOzJQfaXKOafNjxswUqXSn4gR3pVBmm0tPJx+9iFdSrkavvGBrQeSDrNzY5UjeZwIgz9hveUUe1dxARBK8iXu0Q8P6W+VnFActyQs0gnoc4Zzb3jJNfxgDWv1LF/MK22b5G2YcZ3bk5LSsGxP1KICJ0J1MMSL8= + AgANlBsYYlxFPxOSitnqdZ4LhP822km9ijYFc46pkpkSKoYGRHNm7gbpaPTRNWJ4u647IYI8Hl8E63GrtACnhntEIvJlHTE8ZwOw7kIA7NuPj/xma4nN3RTlazH8dmaGskd/wCD8mDZS2R3MhXxqSy6DVGbNJyRAmrgLnzCOgp5/aJkQAC3sZ9GOce0x+X7ngd+qKrOzf+CZS/hnf4/aQvEj6Caq141nl74jpuwpfjb3PWKl9aATJocZkyNw92ITRmfnGu5oE0VIf+BJe8tyBvLN7dcPQ5txBEfDh/XBX3eCwpAJMeyN6XHioJKX9BbN1rCG5lt8jAurB6WAxeAVtt5maytoX9aYAWZMiK7FQ3HubkrDHvDPBJyaeyzLWgcXeox077xiCti7BaKssVO2itM6BO9gMyvC2hwnw5LjtItj1mY25wGRmMz5B8/9vMYMZ6Xmjf3DaczAUwL3RcW3NYqjbUc03pz45uAavC2ImNXtIBIoaaXh0T0rX6ZcQaJZxpax29KydecKDoDnkkx3owpVZoZryebXgG/sW34ddaoHsLwgKwBdxVoNO+L04g46JdXoJclPA/7GVPDz0voMCHIZymrBfRPf/xdqtq5w0EdiIAf7d6GogOjaUU9ujKMJJKw//nu3RmYziVWcaAHzkgKJZahRe+k2Kb8o+YsGFPFYoR936GAnJRnLn8sEMppuP2tHrij6SN/jSRbJll0HgsA/BKzPDhwSu0tiDt81HDZdxXusre5MRNzyiESOoKGSq7hc7ABHCIHSWyhbVNU= template: metadata: annotations: - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: preprod-dev42 - app.gitlab.com/env.name: preprod-dev42 + app.github.com/job: '5678' + app.github.com/ref: refs/tags/v1.2.3 + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' name: elastic-recherche-entreprises-write labels: - application: v1-2-3-recherche-entreprises - component: v1-2-3-recherche-entreprises + application: recherche-entreprises + component: recherche-entreprises owner: recherche-entreprises team: recherche-entreprises cert: wildcard @@ -41,43 +45,89 @@ spec: apiVersion: v1 kind: ConfigMap data: - get-data.sh: > + sqlite.sh: > #!/bin/bash - # borrowed from annuaire entreprise : + # exit when any command fails - # https://github.com/etalab/api-annuaire-entreprises/tree/master/db/init + set -e - geodir=\${DATA_DIR}/geo + # download files, convert to SQLite and export to CSV - mkdir -p $geodir + DATA_DIR=\${DATA_DIR:-\\"./data\\"} + + + mkdir -p \\"$DATA_DIR\\" || true + + + echo \\"-- Working in $(dirname \\"$0\\")\\" + + cd \\"$(dirname \\"$0\\")\\" || exit echo \\"-- Download datasets\\" - for d in \`seq -w 1 19\` 2A 2B \`seq 21 74\` \`seq 76 95\` 98 \\"\\"; do - wget --progress=bar:force:noscroll -q --show-progress https://files.data.gouv.fr/geo-sirene/last/dep/geo_siret_$d.csv.gz --directory-prefix=$geodir - gunzip \${geodir}/geo_siret_$d.csv.gz + + if command -v apt-get &> /dev/null + + then + apt-get update -y + fi + + + # install sqlite3 if not exists + + if ! command -v sqlite3 &> /dev/null + + then + echo \\"sqlite3 could not be found\\" + apt-get install -y sqlite3 + fi + + # install wget if not exists + + if ! command -v wget &> /dev/null + + then + echo \\"wget could not be found\\" + apt-get install -y wget + fi + + # install unzip if not exists + + if ! command -v unzip &> /dev/null + + then + echo \\"unzip could not be found\\" + apt-get install -y unzip + fi + + + # geo siret par département + + for d in $(seq -w 1 19) 2A 2B $(seq 21 74) $(seq 76 95) 98 \\"\\"; do + wget --progress=bar:force:noscroll -q --show-progress \\"https://files.data.gouv.fr/geo-sirene/last/dep/geo_siret_$d.csv.gz\\" --directory-prefix=\\"$DATA_DIR\\" + gunzip \\"\${DATA_DIR}/geo_siret_$d.csv.gz\\" done - #Cas particulier Paris + # Cas particulier Paris 75101-75120 - for d in \`seq -w 1 20\`; do - wget --progress=bar:force:noscroll -q --show-progress https://files.data.gouv.fr/geo-sirene/last/dep/geo_siret_751$d.csv.gz --directory-prefix=$geodir - gunzip \${geodir}/geo_siret_751$d.csv.gz + for d in $(seq -w 1 20); do + wget --progress=bar:force:noscroll -q --show-progress \\"https://files.data.gouv.fr/geo-sirene/last/dep/geo_siret_751$d.csv.gz\\" --directory-prefix=\\"$DATA_DIR\\" + gunzip \\"\${DATA_DIR}/geo_siret_751$d.csv.gz\\" done - #Cas particulier DOM + # Cas particulier DOM 971->978 - for d in \`seq -w 1 8\`; do - wget --progress=bar:force:noscroll -q --show-progress https://files.data.gouv.fr/geo-sirene/last/dep/geo_siret_97$d.csv.gz --directory-prefix=$geodir - gunzip \${geodir}/geo_siret_97$d.csv.gz + for d in $(seq -w 1 8); do + wget --progress=bar:force:noscroll -q --show-progress \\"https://files.data.gouv.fr/geo-sirene/last/dep/geo_siret_97$d.csv.gz\\" --directory-prefix=\\"$DATA_DIR\\" + gunzip \\"\${DATA_DIR}/geo_siret_97$d.csv.gz\\" done @@ -85,303 +135,322 @@ data: wget --progress=bar:force:noscroll -q --show-progress https://files.data.gouv.fr/insee-sirene/StockUniteLegale_utf8.zip - --directory-prefix=$DATA_DIR + --directory-prefix=\\"$DATA_DIR\\" + + unzip \\"\${DATA_DIR}/StockUniteLegale_utf8.zip\\" -d \\"\${DATA_DIR}\\" # WEEZ data wget --progress=bar:force:noscroll -q --show-progress https://www.data.gouv.fr/fr/datasets/r/a785345a-6e8c-4961-ae0a-bc00878e4f2e - -O \${DATA_DIR}/WEEZ.csv - assemble_data.py: | - \\"\\"\\"CDTN Entreprises data assembler - - This script assembles data from different places and creates a new file that - will be used as source for our search index. - - \\"\\"\\" - import argparse - import pandas as pd - import numpy as np - from os import listdir - from os.path import isfile, join - - - def read_siren(stock_unite_legale_file): - \\"\\"\\" Read SIREN Stock Unite Legale - - Parameters - ---------- - stock_unite_legale_file: str - The location of the CSV or ZIP file - - Returns - ------- - employeurs - a Pandas dataframe containing the list of all companies that are still open - and employ people - \\"\\"\\" - trancheEffectifsUniteLegale = \\"trancheEffectifsUniteLegale\\" - categorieJuridiqueUniteLegale = \\"categorieJuridiqueUniteLegale\\" - nomenclatureActivitePrincipaleUniteLegale = \\"nomenclatureActivitePrincipaleUniteLegale\\" - categorieEntreprise = \\"categorieEntreprise\\" - activitePrincipaleUniteLegale = \\"activitePrincipaleUniteLegale\\" - - selection = [\\"siren\\", \\"sigleUniteLegale\\", \\"nomUniteLegale\\", \\"nomUsageUniteLegale\\", - 'denominationUniteLegale', \\"denominationUsuelle1UniteLegale\\", \\"denominationUsuelle2UniteLegale\\", - \\"denominationUsuelle3UniteLegale\\", activitePrincipaleUniteLegale, - trancheEffectifsUniteLegale, categorieJuridiqueUniteLegale, - nomenclatureActivitePrincipaleUniteLegale, categorieEntreprise] - - etatAdmin = \\"etatAdministratifUniteLegale\\" - caractereEmployeur = \\"caractereEmployeurUniteLegale\\" - - # we only select columns in use and convert to categorical dtype - # in order to decrease the dataframe memory footprint - cols = selection + [etatAdmin, caractereEmployeur] - raw = pd.read_csv(stock_unite_legale_file, usecols=cols, - dtype={ \\"siren\\": np.dtype(str), etatAdmin: \\"category\\", caractereEmployeur: \\"category\\", - trancheEffectifsUniteLegale: \\"category\\", - categorieJuridiqueUniteLegale: \\"category\\", - nomenclatureActivitePrincipaleUniteLegale: \\"category\\", - activitePrincipaleUniteLegale: \\"category\\", - categorieEntreprise: \\"category\\"}, ) - - is_ouvert = raw[etatAdmin] == \\"A\\" - is_employeur = raw[caractereEmployeur] == \\"O\\" - is_admin = raw[etatAdmin] == \\"A\\" - - employeurs = raw[is_ouvert & is_employeur & is_admin] - - return employeurs[selection] - - - def read_geo(geo_directory): - \\"\\"\\" Read GEO data - - Parameters - ---------- - geo_directory: str - The directory containing geo data for all regions - - Returns - ------- - all_geo - a Pandas dataframe containing geo information for all open companies - \\"\\"\\" - geo_files = [f for f in listdir( - geo_directory) if isfile(join(geo_directory, f))] - geo_selection = [\\"enseigne1Etablissement\\", \\"enseigne2Etablissement\\", \\"enseigne3Etablissement\\", \\"denominationUsuelleEtablissement\\", \\"activitePrincipaleEtablissement\\", - 'siren', 'siret', 'codePostalEtablissement', 'libelleCommuneEtablissement', \\"etatAdministratifEtablissement\\", \\"geo_adresse\\"] - geo = {} - for file in geo_files: - geo[file] = pd.read_csv( - geo_directory + file, dtype={\\"codePostalEtablissement\\": np.dtype(str), - \\"etatAdministratifEtablissement\\": \\"category\\", - \\"activitePrincipaleEtablissement\\": \\"category\\", - \\"siret\\": np.dtype(str), - \\"siren\\": np.dtype(str), - }, usecols=geo_selection - ) - - all_geo = pd.concat(geo.values(), ignore_index=True).dropna( - subset=['siret']) - - all_geo = all_geo.astype(dtype={\\"codePostalEtablissement\\": np.dtype(str), - \\"etatAdministratifEtablissement\\": \\"category\\", - \\"activitePrincipaleEtablissement\\": \\"category\\", - \\"siret\\": np.dtype(str), - \\"siren\\": np.dtype(str), - }) - - all_geo = all_geo[all_geo[\\"etatAdministratifEtablissement\\"] == \\"A\\"] - - return all_geo - - - def read_idcc(idcc_file): - \\"\\"\\" Read IDCC data - - Parameters - ---------- - idcc_file: str - The location of the CSV file containing associations between companies and their \\"convention collectives\\", (aka WEEZ) - - Returns - ------- - idccs - a Pandas dataframe containing siret / idcc associations - \\"\\"\\" - idccs = pd.read_csv(idcc_file, dtype={\\"SIRET\\": np.dtype(str)}, usecols=[\\"SIRET\\", \\"IDCC\\"]).rename( - columns={\\"SIRET\\": \\"siret\\", \\"IDCC\\": \\"idcc\\"}) - - return idccs - - - def assemble(siren, geo, idcc, output): - sirenGeo = pd.merge(siren, geo, on='siren') - merged = pd.merge(sirenGeo, idcc, how='left', on='siret') - - # add etablissement counts - etsCounts = merged.siren.value_counts().rename_axis( - 'siren').reset_index(name='etablissements') - withEts = pd.merge(merged, etsCounts, on='siren') - - # persits as CSV file - withEts.astype({'idcc': 'Int64'}).to_csv(output) - - - def main(): - parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument( - 'siren_file', - type=str, - help=\\"Location of the StockUniteLegale CSV or ZIP file\\" - ) - parser.add_argument( - 'geo_directory', - type=str, - help=\\"Location of the directory containing all the Geo CSV files\\" - ) - parser.add_argument( - 'idcc_file', - type=str, - help=\\"Location of the siret/idcc CSV file (aka WEEZ)\\" - ) - parser.add_argument( - 'output_file', - type=str, - help=\\"Location of the output file\\" - ) - - args = parser.parse_args() - - print(\\"Read SIREN data\\") - siren = read_siren(args.siren_file) - - print(\\"Read GEO data\\") - geo = read_geo(args.geo_directory) - - print(\\"Read IDCC data\\") - idcc = read_idcc(args.idcc_file) - - print(\\"Assemble datasets\\") - assemble(siren, geo, idcc, args.output_file) - - - if __name__ == \\"__main__\\": - main() - requirements.txt: | - numpy - pandas + -O \\"\${DATA_DIR}/WEEZ.csv\\" + + + echo \\"-- Import CSV datasets to sqlite\\" + + + sqlite3 -echo \\"\${DATA_DIR}/db.sqlite\\" \\".read import.sql\\" + + + echo \\"-- Export sqlite data to \${DATA_DIR}/assembly.csv\\" + + + sqlite3 -header -csv \\"\${DATA_DIR}/db.sqlite\\" \\".read export.sql\\" > + \\"\${DATA_DIR}/assembly.csv\\" + import.sql: |- + --- sqlite3 -echo db.sqlite \\".read import.sql\\" + --- + --- import local CSVs to sqlite database + --- + + PRAGMA synchronous = OFF; + + DROP TABLE IF EXISTS weez; + DROP TABLE IF EXISTS geo_siret; + DROP TABLE IF EXISTS stock; + + .mode csv + .import data/WEEZ.csv weez + .import data/StockUniteLegale_utf8.csv stock + .import data/geo_siret_.csv geo_siret + .import data/geo_siret_01.csv geo_siret + .import data/geo_siret_02.csv geo_siret + .import data/geo_siret_03.csv geo_siret + .import data/geo_siret_04.csv geo_siret + .import data/geo_siret_05.csv geo_siret + .import data/geo_siret_06.csv geo_siret + .import data/geo_siret_07.csv geo_siret + .import data/geo_siret_08.csv geo_siret + .import data/geo_siret_09.csv geo_siret + .import data/geo_siret_10.csv geo_siret + .import data/geo_siret_11.csv geo_siret + .import data/geo_siret_12.csv geo_siret + .import data/geo_siret_13.csv geo_siret + .import data/geo_siret_14.csv geo_siret + .import data/geo_siret_15.csv geo_siret + .import data/geo_siret_16.csv geo_siret + .import data/geo_siret_17.csv geo_siret + .import data/geo_siret_18.csv geo_siret + .import data/geo_siret_19.csv geo_siret + .import data/geo_siret_21.csv geo_siret + .import data/geo_siret_22.csv geo_siret + .import data/geo_siret_23.csv geo_siret + .import data/geo_siret_24.csv geo_siret + .import data/geo_siret_25.csv geo_siret + .import data/geo_siret_26.csv geo_siret + .import data/geo_siret_27.csv geo_siret + .import data/geo_siret_28.csv geo_siret + .import data/geo_siret_29.csv geo_siret + .import data/geo_siret_2A.csv geo_siret + .import data/geo_siret_2B.csv geo_siret + .import data/geo_siret_30.csv geo_siret + .import data/geo_siret_31.csv geo_siret + .import data/geo_siret_32.csv geo_siret + .import data/geo_siret_33.csv geo_siret + .import data/geo_siret_34.csv geo_siret + .import data/geo_siret_35.csv geo_siret + .import data/geo_siret_36.csv geo_siret + .import data/geo_siret_37.csv geo_siret + .import data/geo_siret_38.csv geo_siret + .import data/geo_siret_39.csv geo_siret + .import data/geo_siret_40.csv geo_siret + .import data/geo_siret_41.csv geo_siret + .import data/geo_siret_42.csv geo_siret + .import data/geo_siret_43.csv geo_siret + .import data/geo_siret_44.csv geo_siret + .import data/geo_siret_45.csv geo_siret + .import data/geo_siret_46.csv geo_siret + .import data/geo_siret_47.csv geo_siret + .import data/geo_siret_48.csv geo_siret + .import data/geo_siret_49.csv geo_siret + .import data/geo_siret_50.csv geo_siret + .import data/geo_siret_51.csv geo_siret + .import data/geo_siret_52.csv geo_siret + .import data/geo_siret_53.csv geo_siret + .import data/geo_siret_54.csv geo_siret + .import data/geo_siret_55.csv geo_siret + .import data/geo_siret_56.csv geo_siret + .import data/geo_siret_57.csv geo_siret + .import data/geo_siret_58.csv geo_siret + .import data/geo_siret_59.csv geo_siret + .import data/geo_siret_60.csv geo_siret + .import data/geo_siret_61.csv geo_siret + .import data/geo_siret_62.csv geo_siret + .import data/geo_siret_63.csv geo_siret + .import data/geo_siret_64.csv geo_siret + .import data/geo_siret_65.csv geo_siret + .import data/geo_siret_66.csv geo_siret + .import data/geo_siret_67.csv geo_siret + .import data/geo_siret_68.csv geo_siret + .import data/geo_siret_69.csv geo_siret + .import data/geo_siret_70.csv geo_siret + .import data/geo_siret_71.csv geo_siret + .import data/geo_siret_72.csv geo_siret + .import data/geo_siret_73.csv geo_siret + .import data/geo_siret_74.csv geo_siret + .import data/geo_siret_75101.csv geo_siret + .import data/geo_siret_75102.csv geo_siret + .import data/geo_siret_75103.csv geo_siret + .import data/geo_siret_75104.csv geo_siret + .import data/geo_siret_75105.csv geo_siret + .import data/geo_siret_75106.csv geo_siret + .import data/geo_siret_75107.csv geo_siret + .import data/geo_siret_75108.csv geo_siret + .import data/geo_siret_75109.csv geo_siret + .import data/geo_siret_75110.csv geo_siret + .import data/geo_siret_75111.csv geo_siret + .import data/geo_siret_75112.csv geo_siret + .import data/geo_siret_75113.csv geo_siret + .import data/geo_siret_75114.csv geo_siret + .import data/geo_siret_75115.csv geo_siret + .import data/geo_siret_75116.csv geo_siret + .import data/geo_siret_75117.csv geo_siret + .import data/geo_siret_75118.csv geo_siret + .import data/geo_siret_75119.csv geo_siret + .import data/geo_siret_75120.csv geo_siret + .import data/geo_siret_76.csv geo_siret + .import data/geo_siret_77.csv geo_siret + .import data/geo_siret_78.csv geo_siret + .import data/geo_siret_79.csv geo_siret + .import data/geo_siret_80.csv geo_siret + .import data/geo_siret_81.csv geo_siret + .import data/geo_siret_82.csv geo_siret + .import data/geo_siret_83.csv geo_siret + .import data/geo_siret_84.csv geo_siret + .import data/geo_siret_85.csv geo_siret + .import data/geo_siret_86.csv geo_siret + .import data/geo_siret_87.csv geo_siret + .import data/geo_siret_88.csv geo_siret + .import data/geo_siret_89.csv geo_siret + .import data/geo_siret_90.csv geo_siret + .import data/geo_siret_91.csv geo_siret + .import data/geo_siret_92.csv geo_siret + .import data/geo_siret_93.csv geo_siret + .import data/geo_siret_94.csv geo_siret + .import data/geo_siret_95.csv geo_siret + .import data/geo_siret_971.csv geo_siret + .import data/geo_siret_972.csv geo_siret + .import data/geo_siret_973.csv geo_siret + .import data/geo_siret_974.csv geo_siret + .import data/geo_siret_975.csv geo_siret + .import data/geo_siret_976.csv geo_siret + .import data/geo_siret_977.csv geo_siret + .import data/geo_siret_978.csv geo_siret + .import data/geo_siret_98.csv geo_siret + + CREATE INDEX 'geo_siret_idx' ON 'geo_siret' ('siret'); + CREATE INDEX 'geo_siren_idx' ON 'geo_siret' ('siren'); + CREATE INDEX 'weez_siret_idx' ON 'weez' ('SIRET'); + CREATE INDEX 'stock_siren_idx' ON 'stock' ('siren'); + + SELECT \\"weez\\", count(*) from weez; + SELECT \\"stock\\", count(*) from stock; + SELECT \\"geo_siret\\", count(*) from geo_siret; + export.sql: |+ + --- Output index data + --- sqlite3 -header -csv db.sqlite \\".read export.sql\\" > output.csv + + PRAGMA synchronous = OFF; + + SELECT + stock.siren, + stock.sigleUniteLegale, + stock.nomUniteLegale, + stock.prenom1UniteLegale, + stock.nomUsageUniteLegale, + stock.denominationUniteLegale, + stock.denominationUsuelle1UniteLegale, + stock.denominationUsuelle2UniteLegale, + stock.denominationUsuelle3UniteLegale, + stock.activitePrincipaleUniteLegale, + stock.trancheEffectifsUniteLegale, + stock.categorieJuridiqueUniteLegale, + stock.nomenclatureActivitePrincipaleUniteLegale, + stock.categorieEntreprise, + stock.etatAdministratifUniteLegale, + stock.caractereEmployeurUniteLegale, + geo_siret.siret, + geo_siret.codePostalEtablissement, + geo_siret.libelleCommuneEtablissement, + geo_siret.etatAdministratifEtablissement, + geo_siret.enseigne1Etablissement, + geo_siret.enseigne2Etablissement, + geo_siret.enseigne3Etablissement, + geo_siret.denominationUsuelleEtablissement, + geo_siret.activitePrincipaleEtablissement, + geo_siret.geo_adresse, + geo_siret.complementAdresseEtablissement, + geo_siret.numeroVoieEtablissement, + geo_siret.indiceRepetitionEtablissement, + geo_siret.typeVoieEtablissement, + geo_siret.libelleVoieEtablissement, + weez.IDCC as idcc, + (select count(*) FROM geo_siret where siren=stock.siren) etablissements + from stock, geo_siret + left join weez on weez.SIRET=geo_siret.siret + where stock.siren=geo_siret.siren; + + metadata: - name: config-map-files-0123456 + name: config-map-files-0123456789abcdefghijklmnopqrstuvwxyz0123 annotations: - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: preprod-dev42 - app.gitlab.com/env.name: preprod-dev42 + app.github.com/job: '5678' + app.github.com/ref: refs/tags/v1.2.3 + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' labels: - application: v1-2-3-recherche-entreprises - component: v1-2-3-recherche-entreprises + application: recherche-entreprises + component: recherche-entreprises owner: recherche-entreprises team: recherche-entreprises cert: wildcard - namespace: recherche-entreprises-85-preprod-dev42 + namespace: recherche-entreprises-preprod --- apiVersion: batch/v1 kind: Job metadata: - name: update-index-0123456 + name: update-index-0123456789abcdefghijklmnopqrstuvwxyz0123 annotations: - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: preprod-dev42 - app.gitlab.com/env.name: preprod-dev42 + app.github.com/job: '5678' + app.github.com/ref: refs/tags/v1.2.3 + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' labels: - application: v1-2-3-recherche-entreprises - component: v1-2-3-recherche-entreprises + application: recherche-entreprises + component: recherche-entreprises owner: recherche-entreprises team: recherche-entreprises cert: wildcard - namespace: recherche-entreprises-85-preprod-dev42 + namespace: recherche-entreprises-preprod spec: backoffLimit: 3 template: spec: containers: - name: update-index - image: >- - harbor.fabrique.social.gouv.fr/cdtn/recherche-entreprises-index:1.2.3 + image: ghcr.io/socialgouv/recherche-entreprises/index:1.2.3 volumeMounts: - name: data mountPath: /data env: - name: ASSEMBLY_FILE value: /data/assembly.csv + - name: ELASTICSEARCH_INDEX_NAME + value: search-entreprises envFrom: - secretRef: name: elastic-recherche-entreprises-write resources: limits: - cpu: '2' - memory: 18Gi + cpu: '4' + memory: 5Gi requests: - cpu: '1' - memory: 14Gi + cpu: '2' + memory: 2Gi restartPolicy: Never volumes: - name: data emptyDir: {} - configMap: - name: config-map-files-0123456 + name: config-map-files-0123456789abcdefghijklmnopqrstuvwxyz0123 defaultMode: 511 name: local-files initContainers: - args: - - '-c' - - > - - apt-get update -y && apt-get install -y wget - - - export DATA_DIR=\\"/data\\" - - - cd /data - - - echo \\"running get-data.sh...\\" - - - /mnt/scripts/get-data.sh - - - pip3 install -r /mnt/scripts/requirements.txt - - - echo \\"running assemble_data.py...\\" - - - python3 /mnt/scripts/assemble_data.py - $DATA_DIR/StockUniteLegale_utf8.zip $DATA_DIR/geo/ - $DATA_DIR/WEEZ.csv $DATA_DIR/assembly.csv + - /mnt/scripts/sqlite.sh command: - sh - image: python:3.9.4 + image: ubuntu:18.04 imagePullPolicy: Always - name: download-data + name: download-build-data + env: + - name: DATA_DIR + value: /mnt/scripts/data + resources: + limits: + cpu: '4' + memory: 2Gi + requests: + cpu: '2' + memory: 1Gi volumeMounts: - name: data - mountPath: /data + mountPath: /mnt/scripts/data - mountPath: /mnt/scripts name: local-files metadata: annotations: - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: preprod-dev42 - app.gitlab.com/env.name: preprod-dev42 + app.github.com/job: '5678' + app.github.com/ref: refs/tags/v1.2.3 + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' labels: - application: v1-2-3-recherche-entreprises - component: v1-2-3-recherche-entreprises + application: recherche-entreprises + component: recherche-entreprises owner: recherche-entreprises team: recherche-entreprises cert: wildcard diff --git a/.k8s/__tests__/__snapshots__/indexing-prod.ts.snap b/.k8s/__tests__/__snapshots__/indexing-prod.ts.snap index db42ef11..b1ce71bb 100644 --- a/.k8s/__tests__/__snapshots__/indexing-prod.ts.snap +++ b/.k8s/__tests__/__snapshots__/indexing-prod.ts.snap @@ -7,32 +7,36 @@ kind: SealedSecret metadata: name: elastic-recherche-entreprises-write annotations: - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: preprod-dev42 - app.gitlab.com/env.name: preprod-dev42 + app.github.com/job: '5678' + app.github.com/ref: refs/tags/v1.2.3 + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' labels: - application: v1-2-3-recherche-entreprises - component: v1-2-3-recherche-entreprises + application: recherche-entreprises + component: recherche-entreprises owner: recherche-entreprises team: recherche-entreprises cert: wildcard - namespace: recherche-entreprises-85-preprod-dev42 + namespace: recherche-entreprises-preprod spec: encryptedData: ELASTICSEARCH_URL: >- AgA0evdMnmx3uImqSzGIHorhP2zdv0hFREYZt0FLKi9Eg389OmU1f8CKgpOJp5LPedSAghc8HEd//YeqYRvhQZhfclkw15FZJX7xxz3H75wYJMuNxnLPz8cEyruuA2NrqVoCNuf8p06aI1hfhjNlIKnPjewR14hK5tdKVmsRc1bfPOygUhslbp+aDCbyCFAVFamhaHYHYKdBKZ4B3V+pgLfQvJl2Xfnm3ChXO9Y7ptnI7IJjyzpResdQwasAppc6onvOrGAdms4wW0TZQOsrRV/3JwFHwbqwiX8DzdwkvLlK37HwV7XddiHOQsa3Z+ONI5y9Uhbw2+3ynMi0h8dVOxHmjeq4iPVBqSTWgRfqomz7MR+MSQfNwaE/D20qlt1fzrFvNezc07XxwYxogUS9QFVe8vgXbeoOFmgUA25pKUsOVgjs+ulA5uH7fMv9JhF5H93250FE+/VcHS1wtUAZw67w9GndnpEgs/kmqR9juD4qVEslrEb36OmsZi4hkgNKh8kK2GybTTaTw4I5xSuWu0mpQqZR3i5M8biT/B0YStW1EkajX02obUyQKSJk8VjLwXIFQ726kse5sMh8Ste+z1lKEIfq6jOKZZ7sUiSTwuLuGTm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x2k0LZzIpyG7VRVMRzliDqcDH4CuNdjFmsZ/KKD1re88AVArYNblasISTx4JxeomlG903SVJgIHjdZDLHsiUYnB+BeM11UBUGlVhaCH0+mV+1alXK+xkxLbaFIh3853onWvbZTvPkc74qFCKfqJX5J9cxLrwX+qq48EwZZIspaR8LtlcZfSem1NSavHyLUxBXP8IEF2o4stt3haKbq+kO+2dPr8/o141KyNzabbbP82wXikuDk3yRqX4j0yAZhfT+X4Sk8kJKH947CV2bHmkr0ySy9+qTiQqwwHthEKWxmCVsQocX13tGC+v9hYzjor9Eu1OFeDa+pzJ21tC5gMRIVUgsTJ4+mDqiJqPgHAB/rPMSB+JaK2DZchVR2MK4mDYcjiNOrzUNG1sRiKrgikIiBIHKBgyoWlJVkqNWzUHBDl0hCp8uEkOWcmBymNvI37HqFPxfENvIeu6vXZ2K+R51bkbEYYfcvrrFmeCh+bdpsKALhmGbtVG0NeKIHR8uicixu/ewi95LVE8hwkYeAZerlBNSF4HRs2ZvNwtqnzQtiv5Dh1aVfQe8AaXojuS22JqgE+eiZhzw225ovZZ/OYv81odymXdBhovF+uurhF1jxczPc0DWdAKagw0mZYFfC7ipBILEitnp7vsrIuZZoKoZHjRhgLikhu74USV7RrutZpPQKqgm5+RWGu1v8HZzK4eDrH3JHi9TjKbcRG50= template: metadata: annotations: - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: preprod-dev42 - app.gitlab.com/env.name: preprod-dev42 + app.github.com/job: '5678' + app.github.com/ref: refs/tags/v1.2.3 + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' name: elastic-recherche-entreprises-write labels: - application: v1-2-3-recherche-entreprises - component: v1-2-3-recherche-entreprises + application: recherche-entreprises + component: recherche-entreprises owner: recherche-entreprises team: recherche-entreprises cert: wildcard @@ -41,43 +45,89 @@ spec: apiVersion: v1 kind: ConfigMap data: - get-data.sh: > + sqlite.sh: > #!/bin/bash - # borrowed from annuaire entreprise : + # exit when any command fails - # https://github.com/etalab/api-annuaire-entreprises/tree/master/db/init + set -e - geodir=\${DATA_DIR}/geo + # download files, convert to SQLite and export to CSV - mkdir -p $geodir + DATA_DIR=\${DATA_DIR:-\\"./data\\"} + + + mkdir -p \\"$DATA_DIR\\" || true + + + echo \\"-- Working in $(dirname \\"$0\\")\\" + + cd \\"$(dirname \\"$0\\")\\" || exit echo \\"-- Download datasets\\" - for d in \`seq -w 1 19\` 2A 2B \`seq 21 74\` \`seq 76 95\` 98 \\"\\"; do - wget --progress=bar:force:noscroll -q --show-progress https://files.data.gouv.fr/geo-sirene/last/dep/geo_siret_$d.csv.gz --directory-prefix=$geodir - gunzip \${geodir}/geo_siret_$d.csv.gz + + if command -v apt-get &> /dev/null + + then + apt-get update -y + fi + + + # install sqlite3 if not exists + + if ! command -v sqlite3 &> /dev/null + + then + echo \\"sqlite3 could not be found\\" + apt-get install -y sqlite3 + fi + + # install wget if not exists + + if ! command -v wget &> /dev/null + + then + echo \\"wget could not be found\\" + apt-get install -y wget + fi + + # install unzip if not exists + + if ! command -v unzip &> /dev/null + + then + echo \\"unzip could not be found\\" + apt-get install -y unzip + fi + + + # geo siret par département + + for d in $(seq -w 1 19) 2A 2B $(seq 21 74) $(seq 76 95) 98 \\"\\"; do + wget --progress=bar:force:noscroll -q --show-progress \\"https://files.data.gouv.fr/geo-sirene/last/dep/geo_siret_$d.csv.gz\\" --directory-prefix=\\"$DATA_DIR\\" + gunzip \\"\${DATA_DIR}/geo_siret_$d.csv.gz\\" done - #Cas particulier Paris + # Cas particulier Paris 75101-75120 - for d in \`seq -w 1 20\`; do - wget --progress=bar:force:noscroll -q --show-progress https://files.data.gouv.fr/geo-sirene/last/dep/geo_siret_751$d.csv.gz --directory-prefix=$geodir - gunzip \${geodir}/geo_siret_751$d.csv.gz + for d in $(seq -w 1 20); do + wget --progress=bar:force:noscroll -q --show-progress \\"https://files.data.gouv.fr/geo-sirene/last/dep/geo_siret_751$d.csv.gz\\" --directory-prefix=\\"$DATA_DIR\\" + gunzip \\"\${DATA_DIR}/geo_siret_751$d.csv.gz\\" done - #Cas particulier DOM + # Cas particulier DOM 971->978 - for d in \`seq -w 1 8\`; do - wget --progress=bar:force:noscroll -q --show-progress https://files.data.gouv.fr/geo-sirene/last/dep/geo_siret_97$d.csv.gz --directory-prefix=$geodir - gunzip \${geodir}/geo_siret_97$d.csv.gz + for d in $(seq -w 1 8); do + wget --progress=bar:force:noscroll -q --show-progress \\"https://files.data.gouv.fr/geo-sirene/last/dep/geo_siret_97$d.csv.gz\\" --directory-prefix=\\"$DATA_DIR\\" + gunzip \\"\${DATA_DIR}/geo_siret_97$d.csv.gz\\" done @@ -85,303 +135,322 @@ data: wget --progress=bar:force:noscroll -q --show-progress https://files.data.gouv.fr/insee-sirene/StockUniteLegale_utf8.zip - --directory-prefix=$DATA_DIR + --directory-prefix=\\"$DATA_DIR\\" + + unzip \\"\${DATA_DIR}/StockUniteLegale_utf8.zip\\" -d \\"\${DATA_DIR}\\" # WEEZ data wget --progress=bar:force:noscroll -q --show-progress https://www.data.gouv.fr/fr/datasets/r/a785345a-6e8c-4961-ae0a-bc00878e4f2e - -O \${DATA_DIR}/WEEZ.csv - assemble_data.py: | - \\"\\"\\"CDTN Entreprises data assembler - - This script assembles data from different places and creates a new file that - will be used as source for our search index. - - \\"\\"\\" - import argparse - import pandas as pd - import numpy as np - from os import listdir - from os.path import isfile, join - - - def read_siren(stock_unite_legale_file): - \\"\\"\\" Read SIREN Stock Unite Legale - - Parameters - ---------- - stock_unite_legale_file: str - The location of the CSV or ZIP file - - Returns - ------- - employeurs - a Pandas dataframe containing the list of all companies that are still open - and employ people - \\"\\"\\" - trancheEffectifsUniteLegale = \\"trancheEffectifsUniteLegale\\" - categorieJuridiqueUniteLegale = \\"categorieJuridiqueUniteLegale\\" - nomenclatureActivitePrincipaleUniteLegale = \\"nomenclatureActivitePrincipaleUniteLegale\\" - categorieEntreprise = \\"categorieEntreprise\\" - activitePrincipaleUniteLegale = \\"activitePrincipaleUniteLegale\\" - - selection = [\\"siren\\", \\"sigleUniteLegale\\", \\"nomUniteLegale\\", \\"nomUsageUniteLegale\\", - 'denominationUniteLegale', \\"denominationUsuelle1UniteLegale\\", \\"denominationUsuelle2UniteLegale\\", - \\"denominationUsuelle3UniteLegale\\", activitePrincipaleUniteLegale, - trancheEffectifsUniteLegale, categorieJuridiqueUniteLegale, - nomenclatureActivitePrincipaleUniteLegale, categorieEntreprise] - - etatAdmin = \\"etatAdministratifUniteLegale\\" - caractereEmployeur = \\"caractereEmployeurUniteLegale\\" - - # we only select columns in use and convert to categorical dtype - # in order to decrease the dataframe memory footprint - cols = selection + [etatAdmin, caractereEmployeur] - raw = pd.read_csv(stock_unite_legale_file, usecols=cols, - dtype={ \\"siren\\": np.dtype(str), etatAdmin: \\"category\\", caractereEmployeur: \\"category\\", - trancheEffectifsUniteLegale: \\"category\\", - categorieJuridiqueUniteLegale: \\"category\\", - nomenclatureActivitePrincipaleUniteLegale: \\"category\\", - activitePrincipaleUniteLegale: \\"category\\", - categorieEntreprise: \\"category\\"}, ) - - is_ouvert = raw[etatAdmin] == \\"A\\" - is_employeur = raw[caractereEmployeur] == \\"O\\" - is_admin = raw[etatAdmin] == \\"A\\" - - employeurs = raw[is_ouvert & is_employeur & is_admin] - - return employeurs[selection] - - - def read_geo(geo_directory): - \\"\\"\\" Read GEO data - - Parameters - ---------- - geo_directory: str - The directory containing geo data for all regions - - Returns - ------- - all_geo - a Pandas dataframe containing geo information for all open companies - \\"\\"\\" - geo_files = [f for f in listdir( - geo_directory) if isfile(join(geo_directory, f))] - geo_selection = [\\"enseigne1Etablissement\\", \\"enseigne2Etablissement\\", \\"enseigne3Etablissement\\", \\"denominationUsuelleEtablissement\\", \\"activitePrincipaleEtablissement\\", - 'siren', 'siret', 'codePostalEtablissement', 'libelleCommuneEtablissement', \\"etatAdministratifEtablissement\\", \\"geo_adresse\\"] - geo = {} - for file in geo_files: - geo[file] = pd.read_csv( - geo_directory + file, dtype={\\"codePostalEtablissement\\": np.dtype(str), - \\"etatAdministratifEtablissement\\": \\"category\\", - \\"activitePrincipaleEtablissement\\": \\"category\\", - \\"siret\\": np.dtype(str), - \\"siren\\": np.dtype(str), - }, usecols=geo_selection - ) - - all_geo = pd.concat(geo.values(), ignore_index=True).dropna( - subset=['siret']) - - all_geo = all_geo.astype(dtype={\\"codePostalEtablissement\\": np.dtype(str), - \\"etatAdministratifEtablissement\\": \\"category\\", - \\"activitePrincipaleEtablissement\\": \\"category\\", - \\"siret\\": np.dtype(str), - \\"siren\\": np.dtype(str), - }) - - all_geo = all_geo[all_geo[\\"etatAdministratifEtablissement\\"] == \\"A\\"] - - return all_geo - - - def read_idcc(idcc_file): - \\"\\"\\" Read IDCC data - - Parameters - ---------- - idcc_file: str - The location of the CSV file containing associations between companies and their \\"convention collectives\\", (aka WEEZ) - - Returns - ------- - idccs - a Pandas dataframe containing siret / idcc associations - \\"\\"\\" - idccs = pd.read_csv(idcc_file, dtype={\\"SIRET\\": np.dtype(str)}, usecols=[\\"SIRET\\", \\"IDCC\\"]).rename( - columns={\\"SIRET\\": \\"siret\\", \\"IDCC\\": \\"idcc\\"}) - - return idccs - - - def assemble(siren, geo, idcc, output): - sirenGeo = pd.merge(siren, geo, on='siren') - merged = pd.merge(sirenGeo, idcc, how='left', on='siret') - - # add etablissement counts - etsCounts = merged.siren.value_counts().rename_axis( - 'siren').reset_index(name='etablissements') - withEts = pd.merge(merged, etsCounts, on='siren') - - # persits as CSV file - withEts.astype({'idcc': 'Int64'}).to_csv(output) - - - def main(): - parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument( - 'siren_file', - type=str, - help=\\"Location of the StockUniteLegale CSV or ZIP file\\" - ) - parser.add_argument( - 'geo_directory', - type=str, - help=\\"Location of the directory containing all the Geo CSV files\\" - ) - parser.add_argument( - 'idcc_file', - type=str, - help=\\"Location of the siret/idcc CSV file (aka WEEZ)\\" - ) - parser.add_argument( - 'output_file', - type=str, - help=\\"Location of the output file\\" - ) - - args = parser.parse_args() - - print(\\"Read SIREN data\\") - siren = read_siren(args.siren_file) - - print(\\"Read GEO data\\") - geo = read_geo(args.geo_directory) - - print(\\"Read IDCC data\\") - idcc = read_idcc(args.idcc_file) - - print(\\"Assemble datasets\\") - assemble(siren, geo, idcc, args.output_file) - - - if __name__ == \\"__main__\\": - main() - requirements.txt: | - numpy - pandas + -O \\"\${DATA_DIR}/WEEZ.csv\\" + + + echo \\"-- Import CSV datasets to sqlite\\" + + + sqlite3 -echo \\"\${DATA_DIR}/db.sqlite\\" \\".read import.sql\\" + + + echo \\"-- Export sqlite data to \${DATA_DIR}/assembly.csv\\" + + + sqlite3 -header -csv \\"\${DATA_DIR}/db.sqlite\\" \\".read export.sql\\" > + \\"\${DATA_DIR}/assembly.csv\\" + import.sql: |- + --- sqlite3 -echo db.sqlite \\".read import.sql\\" + --- + --- import local CSVs to sqlite database + --- + + PRAGMA synchronous = OFF; + + DROP TABLE IF EXISTS weez; + DROP TABLE IF EXISTS geo_siret; + DROP TABLE IF EXISTS stock; + + .mode csv + .import data/WEEZ.csv weez + .import data/StockUniteLegale_utf8.csv stock + .import data/geo_siret_.csv geo_siret + .import data/geo_siret_01.csv geo_siret + .import data/geo_siret_02.csv geo_siret + .import data/geo_siret_03.csv geo_siret + .import data/geo_siret_04.csv geo_siret + .import data/geo_siret_05.csv geo_siret + .import data/geo_siret_06.csv geo_siret + .import data/geo_siret_07.csv geo_siret + .import data/geo_siret_08.csv geo_siret + .import data/geo_siret_09.csv geo_siret + .import data/geo_siret_10.csv geo_siret + .import data/geo_siret_11.csv geo_siret + .import data/geo_siret_12.csv geo_siret + .import data/geo_siret_13.csv geo_siret + .import data/geo_siret_14.csv geo_siret + .import data/geo_siret_15.csv geo_siret + .import data/geo_siret_16.csv geo_siret + .import data/geo_siret_17.csv geo_siret + .import data/geo_siret_18.csv geo_siret + .import data/geo_siret_19.csv geo_siret + .import data/geo_siret_21.csv geo_siret + .import data/geo_siret_22.csv geo_siret + .import data/geo_siret_23.csv geo_siret + .import data/geo_siret_24.csv geo_siret + .import data/geo_siret_25.csv geo_siret + .import data/geo_siret_26.csv geo_siret + .import data/geo_siret_27.csv geo_siret + .import data/geo_siret_28.csv geo_siret + .import data/geo_siret_29.csv geo_siret + .import data/geo_siret_2A.csv geo_siret + .import data/geo_siret_2B.csv geo_siret + .import data/geo_siret_30.csv geo_siret + .import data/geo_siret_31.csv geo_siret + .import data/geo_siret_32.csv geo_siret + .import data/geo_siret_33.csv geo_siret + .import data/geo_siret_34.csv geo_siret + .import data/geo_siret_35.csv geo_siret + .import data/geo_siret_36.csv geo_siret + .import data/geo_siret_37.csv geo_siret + .import data/geo_siret_38.csv geo_siret + .import data/geo_siret_39.csv geo_siret + .import data/geo_siret_40.csv geo_siret + .import data/geo_siret_41.csv geo_siret + .import data/geo_siret_42.csv geo_siret + .import data/geo_siret_43.csv geo_siret + .import data/geo_siret_44.csv geo_siret + .import data/geo_siret_45.csv geo_siret + .import data/geo_siret_46.csv geo_siret + .import data/geo_siret_47.csv geo_siret + .import data/geo_siret_48.csv geo_siret + .import data/geo_siret_49.csv geo_siret + .import data/geo_siret_50.csv geo_siret + .import data/geo_siret_51.csv geo_siret + .import data/geo_siret_52.csv geo_siret + .import data/geo_siret_53.csv geo_siret + .import data/geo_siret_54.csv geo_siret + .import data/geo_siret_55.csv geo_siret + .import data/geo_siret_56.csv geo_siret + .import data/geo_siret_57.csv geo_siret + .import data/geo_siret_58.csv geo_siret + .import data/geo_siret_59.csv geo_siret + .import data/geo_siret_60.csv geo_siret + .import data/geo_siret_61.csv geo_siret + .import data/geo_siret_62.csv geo_siret + .import data/geo_siret_63.csv geo_siret + .import data/geo_siret_64.csv geo_siret + .import data/geo_siret_65.csv geo_siret + .import data/geo_siret_66.csv geo_siret + .import data/geo_siret_67.csv geo_siret + .import data/geo_siret_68.csv geo_siret + .import data/geo_siret_69.csv geo_siret + .import data/geo_siret_70.csv geo_siret + .import data/geo_siret_71.csv geo_siret + .import data/geo_siret_72.csv geo_siret + .import data/geo_siret_73.csv geo_siret + .import data/geo_siret_74.csv geo_siret + .import data/geo_siret_75101.csv geo_siret + .import data/geo_siret_75102.csv geo_siret + .import data/geo_siret_75103.csv geo_siret + .import data/geo_siret_75104.csv geo_siret + .import data/geo_siret_75105.csv geo_siret + .import data/geo_siret_75106.csv geo_siret + .import data/geo_siret_75107.csv geo_siret + .import data/geo_siret_75108.csv geo_siret + .import data/geo_siret_75109.csv geo_siret + .import data/geo_siret_75110.csv geo_siret + .import data/geo_siret_75111.csv geo_siret + .import data/geo_siret_75112.csv geo_siret + .import data/geo_siret_75113.csv geo_siret + .import data/geo_siret_75114.csv geo_siret + .import data/geo_siret_75115.csv geo_siret + .import data/geo_siret_75116.csv geo_siret + .import data/geo_siret_75117.csv geo_siret + .import data/geo_siret_75118.csv geo_siret + .import data/geo_siret_75119.csv geo_siret + .import data/geo_siret_75120.csv geo_siret + .import data/geo_siret_76.csv geo_siret + .import data/geo_siret_77.csv geo_siret + .import data/geo_siret_78.csv geo_siret + .import data/geo_siret_79.csv geo_siret + .import data/geo_siret_80.csv geo_siret + .import data/geo_siret_81.csv geo_siret + .import data/geo_siret_82.csv geo_siret + .import data/geo_siret_83.csv geo_siret + .import data/geo_siret_84.csv geo_siret + .import data/geo_siret_85.csv geo_siret + .import data/geo_siret_86.csv geo_siret + .import data/geo_siret_87.csv geo_siret + .import data/geo_siret_88.csv geo_siret + .import data/geo_siret_89.csv geo_siret + .import data/geo_siret_90.csv geo_siret + .import data/geo_siret_91.csv geo_siret + .import data/geo_siret_92.csv geo_siret + .import data/geo_siret_93.csv geo_siret + .import data/geo_siret_94.csv geo_siret + .import data/geo_siret_95.csv geo_siret + .import data/geo_siret_971.csv geo_siret + .import data/geo_siret_972.csv geo_siret + .import data/geo_siret_973.csv geo_siret + .import data/geo_siret_974.csv geo_siret + .import data/geo_siret_975.csv geo_siret + .import data/geo_siret_976.csv geo_siret + .import data/geo_siret_977.csv geo_siret + .import data/geo_siret_978.csv geo_siret + .import data/geo_siret_98.csv geo_siret + + CREATE INDEX 'geo_siret_idx' ON 'geo_siret' ('siret'); + CREATE INDEX 'geo_siren_idx' ON 'geo_siret' ('siren'); + CREATE INDEX 'weez_siret_idx' ON 'weez' ('SIRET'); + CREATE INDEX 'stock_siren_idx' ON 'stock' ('siren'); + + SELECT \\"weez\\", count(*) from weez; + SELECT \\"stock\\", count(*) from stock; + SELECT \\"geo_siret\\", count(*) from geo_siret; + export.sql: |+ + --- Output index data + --- sqlite3 -header -csv db.sqlite \\".read export.sql\\" > output.csv + + PRAGMA synchronous = OFF; + + SELECT + stock.siren, + stock.sigleUniteLegale, + stock.nomUniteLegale, + stock.prenom1UniteLegale, + stock.nomUsageUniteLegale, + stock.denominationUniteLegale, + stock.denominationUsuelle1UniteLegale, + stock.denominationUsuelle2UniteLegale, + stock.denominationUsuelle3UniteLegale, + stock.activitePrincipaleUniteLegale, + stock.trancheEffectifsUniteLegale, + stock.categorieJuridiqueUniteLegale, + stock.nomenclatureActivitePrincipaleUniteLegale, + stock.categorieEntreprise, + stock.etatAdministratifUniteLegale, + stock.caractereEmployeurUniteLegale, + geo_siret.siret, + geo_siret.codePostalEtablissement, + geo_siret.libelleCommuneEtablissement, + geo_siret.etatAdministratifEtablissement, + geo_siret.enseigne1Etablissement, + geo_siret.enseigne2Etablissement, + geo_siret.enseigne3Etablissement, + geo_siret.denominationUsuelleEtablissement, + geo_siret.activitePrincipaleEtablissement, + geo_siret.geo_adresse, + geo_siret.complementAdresseEtablissement, + geo_siret.numeroVoieEtablissement, + geo_siret.indiceRepetitionEtablissement, + geo_siret.typeVoieEtablissement, + geo_siret.libelleVoieEtablissement, + weez.IDCC as idcc, + (select count(*) FROM geo_siret where siren=stock.siren) etablissements + from stock, geo_siret + left join weez on weez.SIRET=geo_siret.siret + where stock.siren=geo_siret.siren; + + metadata: - name: config-map-files-0123456 + name: config-map-files-0123456789abcdefghijklmnopqrstuvwxyz0123 annotations: - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: preprod-dev42 - app.gitlab.com/env.name: preprod-dev42 + app.github.com/job: '5678' + app.github.com/ref: refs/tags/v1.2.3 + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' labels: - application: v1-2-3-recherche-entreprises - component: v1-2-3-recherche-entreprises + application: recherche-entreprises + component: recherche-entreprises owner: recherche-entreprises team: recherche-entreprises cert: wildcard - namespace: recherche-entreprises-85-preprod-dev42 + namespace: recherche-entreprises-preprod --- apiVersion: batch/v1 kind: Job metadata: - name: update-index-0123456 + name: update-index-0123456789abcdefghijklmnopqrstuvwxyz0123 annotations: - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: preprod-dev42 - app.gitlab.com/env.name: preprod-dev42 + app.github.com/job: '5678' + app.github.com/ref: refs/tags/v1.2.3 + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' labels: - application: v1-2-3-recherche-entreprises - component: v1-2-3-recherche-entreprises + application: recherche-entreprises + component: recherche-entreprises owner: recherche-entreprises team: recherche-entreprises cert: wildcard - namespace: recherche-entreprises-85-preprod-dev42 + namespace: recherche-entreprises-preprod spec: backoffLimit: 3 template: spec: containers: - name: update-index - image: >- - harbor.fabrique.social.gouv.fr/cdtn/recherche-entreprises-index:1.2.3 + image: ghcr.io/socialgouv/recherche-entreprises/index:1.2.3 volumeMounts: - name: data mountPath: /data env: - name: ASSEMBLY_FILE value: /data/assembly.csv + - name: ELASTICSEARCH_INDEX_NAME + value: search-entreprises envFrom: - secretRef: name: elastic-recherche-entreprises-write resources: limits: - cpu: '2' - memory: 18Gi + cpu: '4' + memory: 5Gi requests: - cpu: '1' - memory: 14Gi + cpu: '2' + memory: 2Gi restartPolicy: Never volumes: - name: data emptyDir: {} - configMap: - name: config-map-files-0123456 + name: config-map-files-0123456789abcdefghijklmnopqrstuvwxyz0123 defaultMode: 511 name: local-files initContainers: - args: - - '-c' - - > - - apt-get update -y && apt-get install -y wget - - - export DATA_DIR=\\"/data\\" - - - cd /data - - - echo \\"running get-data.sh...\\" - - - /mnt/scripts/get-data.sh - - - pip3 install -r /mnt/scripts/requirements.txt - - - echo \\"running assemble_data.py...\\" - - - python3 /mnt/scripts/assemble_data.py - $DATA_DIR/StockUniteLegale_utf8.zip $DATA_DIR/geo/ - $DATA_DIR/WEEZ.csv $DATA_DIR/assembly.csv + - /mnt/scripts/sqlite.sh command: - sh - image: python:3.9.4 + image: ubuntu:18.04 imagePullPolicy: Always - name: download-data + name: download-build-data + env: + - name: DATA_DIR + value: /mnt/scripts/data + resources: + limits: + cpu: '4' + memory: 2Gi + requests: + cpu: '2' + memory: 1Gi volumeMounts: - name: data - mountPath: /data + mountPath: /mnt/scripts/data - mountPath: /mnt/scripts name: local-files metadata: annotations: - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: preprod-dev42 - app.gitlab.com/env.name: preprod-dev42 + app.github.com/job: '5678' + app.github.com/ref: refs/tags/v1.2.3 + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' labels: - application: v1-2-3-recherche-entreprises - component: v1-2-3-recherche-entreprises + application: recherche-entreprises + component: recherche-entreprises owner: recherche-entreprises team: recherche-entreprises cert: wildcard diff --git a/.k8s/__tests__/__snapshots__/preprod.ts.snap b/.k8s/__tests__/__snapshots__/preprod.ts.snap index 1439ae60..2797cce6 100644 --- a/.k8s/__tests__/__snapshots__/preprod.ts.snap +++ b/.k8s/__tests__/__snapshots__/preprod.ts.snap @@ -9,20 +9,21 @@ metadata: socialgouv/creator: autodevops field.cattle.io/creatorId: gitlab field.cattle.io/projectId: c-bd7z2:p-7ms8p - git/branch: v1.2.3 - git/remote: >- - https://gitlab-ci-token:[MASKED]@gitlab.factory.social.gouv.fr/SocialGouv/recherche-entreprises.git - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: preprod-dev42 - app.gitlab.com/env.name: preprod-dev42 + git/branch: refs/tags/v1.2.3 + git/remote: socialgouv/recherche-entreprises + app.github.com/job: '5678' + app.github.com/ref: refs/tags/v1.2.3 + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' labels: azure-pg-admin-user: recherche-entreprises - application: v1-2-3-recherche-entreprises - component: v1-2-3-recherche-entreprises + application: recherche-entreprises + component: recherche-entreprises owner: recherche-entreprises team: recherche-entreprises cert: wildcard - name: recherche-entreprises-85-preprod-dev42 + name: recherche-entreprises-preprod --- apiVersion: apps/v1 kind: Deployment @@ -30,18 +31,20 @@ metadata: annotations: kapp.k14s.io/disable-default-ownership-label-rules: '' kapp.k14s.io/disable-default-label-scoping-rules: '' - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: preprod-dev42 - app.gitlab.com/env.name: preprod-dev42 + app.github.com/job: '5678' + app.github.com/ref: refs/tags/v1.2.3 + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' labels: app: recherche-entreprises-api - application: v1-2-3-recherche-entreprises - component: v1-2-3-recherche-entreprises + application: recherche-entreprises + component: recherche-entreprises owner: recherche-entreprises team: recherche-entreprises cert: wildcard name: recherche-entreprises-api - namespace: recherche-entreprises-85-preprod-dev42 + namespace: recherche-entreprises-preprod spec: replicas: 1 selector: @@ -52,19 +55,21 @@ spec: annotations: kapp.k14s.io/disable-default-ownership-label-rules: '' kapp.k14s.io/disable-default-label-scoping-rules: '' - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: preprod-dev42 - app.gitlab.com/env.name: preprod-dev42 + app.github.com/job: '5678' + app.github.com/ref: refs/tags/v1.2.3 + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' labels: app: recherche-entreprises-api - application: v1-2-3-recherche-entreprises - component: v1-2-3-recherche-entreprises + application: recherche-entreprises + component: recherche-entreprises owner: recherche-entreprises team: recherche-entreprises cert: wildcard spec: containers: - - image: harbor.fabrique.social.gouv.fr/cdtn/recherche-entreprises-api:1.2.3 + - image: harbor.fabrique.social.gouv.fr/cdtn/recherche-entreprises-api:1.5.8 livenessProbe: failureThreshold: 6 httpGet: @@ -111,35 +116,39 @@ metadata: sealedsecrets.bitnami.com/cluster-wide: 'true' kapp.k14s.io/disable-default-ownership-label-rules: '' kapp.k14s.io/disable-default-label-scoping-rules: '' - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: preprod-dev42 - app.gitlab.com/env.name: preprod-dev42 + app.github.com/job: '5678' + app.github.com/ref: refs/tags/v1.2.3 + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' labels: - application: v1-2-3-recherche-entreprises - component: v1-2-3-recherche-entreprises + application: recherche-entreprises + component: recherche-entreprises owner: recherche-entreprises team: recherche-entreprises cert: wildcard - namespace: recherche-entreprises-85-preprod-dev42 + namespace: recherche-entreprises-preprod spec: encryptedData: ELASTICSEARCH_URL: >- - AgDGWiSE5kUv0Mv4Dot8KfbSGm5XVlyi4V9yLiMI97deZctFWRd2T31MtTUz/XgT4VlFH4NUhK+dQonLEILE2P9rs4MMDaY09cc3NZiDLB9GJoBcWnWsa02QV4Xykk8UthTHQPFC4g+0ElFU4UewbIc3Zc2ZqIk5Y803TnYkRuAF1bM1ZdpWGnm+yh7+lXnbRMmFo62vhPVB8lnl9Z/RVxhs1jx6xnbIFyTjvelM4/sySiyHZ0h74fL61DAvOcNBgCTd49RRBBzcAhp6a8KL45FL1eAYyOqS8vW5uNeFu59Cu9ByRruhyTELjpPtLesjsBUHiqmfBh09esKw+mdtMmfYxIsy+JGPS50N8GiNj+n0A5XXtLQkm9oT884r4LEQip35YHyenh20NmueHX8RGMOXRT05PWnbL70NtZHqUwzFdc21vdFhXAb/MVaMgqcKG4RPkRS+qljn+pQjJ8DkY0EqgWOCfSyjB+jKJ65peSqqORq+B8zTDgpv9ZaN+xSDsfi+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ZsEcoCIsA2nXrp2/vQ/ATMtITKb1223jyHnJiargNnQrRVRA7Geuz5FyaqSXjqvjG1HrqVxAlVNzFPb/N3fN8C6KHCjtOuu/pOM+cqC4cFvzyzqGymcDOKGC5Ax47j5v0KsVlJZ93dfO2yD/Fi2txeuNdmQ42bvhpGbPJu/iYLXmaETvu6/qpL3UrU4i2KVyxXW0CbUzBVh1fTmCClAMDgETpWNvnRXgAuu0jbgTnWjN0zSmjia0/BJmY1Z5uct7T4Lli4Dz/vJucBthIBVgYaVX/jLqfaNWpD1TuWkTHsf4gR5HErzQp60NDej/I7TespFMqRMhrroc6VaH/Wl6wV4msRM3sYaxcHPd4kJxrOeA7cQnfqQsWs4/RG++p+TCmD18qgevVBV1z11vFu2R6KE+c1YRANE5e6EBMO8yUly1yarrx6jOo6E5kAdKqPGkNUyq3BgOvGWmkbV32slQ4hXm7zUuyVnXBmpmoryowHhqV7iW8Si6CSMKACCENVqJPrk55VaL8sw8dZfQF0aekJoEqf/UqAv/DZUTYOAg4QI+4iD4= template: metadata: annotations: sealedsecrets.bitnami.com/cluster-wide: 'true' kapp.k14s.io/disable-default-ownership-label-rules: '' kapp.k14s.io/disable-default-label-scoping-rules: '' - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: preprod-dev42 - app.gitlab.com/env.name: preprod-dev42 + app.github.com/job: '5678' + app.github.com/ref: refs/tags/v1.2.3 + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' name: elastic-recherche-entreprises-read labels: - application: v1-2-3-recherche-entreprises - component: v1-2-3-recherche-entreprises + application: recherche-entreprises + component: recherche-entreprises owner: recherche-entreprises team: recherche-entreprises cert: wildcard @@ -150,8 +159,8 @@ kind: Service metadata: labels: app: recherche-entreprises-api - application: v1-2-3-recherche-entreprises - component: v1-2-3-recherche-entreprises + application: recherche-entreprises + component: recherche-entreprises owner: recherche-entreprises team: recherche-entreprises cert: wildcard @@ -159,10 +168,12 @@ metadata: annotations: kapp.k14s.io/disable-default-ownership-label-rules: '' kapp.k14s.io/disable-default-label-scoping-rules: '' - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: preprod-dev42 - app.gitlab.com/env.name: preprod-dev42 - namespace: recherche-entreprises-85-preprod-dev42 + app.github.com/job: '5678' + app.github.com/ref: refs/tags/v1.2.3 + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' + namespace: recherche-entreprises-preprod spec: ports: - name: http @@ -179,21 +190,23 @@ metadata: kubernetes.io/ingress.class: nginx kapp.k14s.io/disable-default-ownership-label-rules: '' kapp.k14s.io/disable-default-label-scoping-rules: '' - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: preprod-dev42 - app.gitlab.com/env.name: preprod-dev42 + app.github.com/job: '5678' + app.github.com/ref: refs/tags/v1.2.3 + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' labels: app: recherche-entreprises-api - application: v1-2-3-recherche-entreprises - component: v1-2-3-recherche-entreprises + application: recherche-entreprises + component: recherche-entreprises owner: recherche-entreprises team: recherche-entreprises cert: wildcard name: recherche-entreprises-api - namespace: recherche-entreprises-85-preprod-dev42 + namespace: recherche-entreprises-preprod spec: rules: - - host: api-preprod-recherche-entreprises.dev42.fabrique.social.gouv.fr + - host: api-recherche-entreprises-preprod.dev2.fabrique.social.gouv.fr http: paths: - backend: @@ -205,7 +218,308 @@ spec: pathType: Prefix tls: - hosts: - - api-preprod-recherche-entreprises.dev42.fabrique.social.gouv.fr + - api-recherche-entreprises-preprod.dev2.fabrique.social.gouv.fr + secretName: wildcard-crt +--- +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/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' + labels: + app: recherche-entreprises-search + application: recherche-entreprises + component: recherche-entreprises + owner: recherche-entreprises + team: recherche-entreprises + cert: wildcard + name: recherche-entreprises-search + namespace: recherche-entreprises-preprod +spec: + replicas: 1 + selector: + matchLabels: + app: recherche-entreprises-search + 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/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' + labels: + app: recherche-entreprises-search + application: recherche-entreprises + component: recherche-entreprises + owner: recherche-entreprises + team: recherche-entreprises + cert: wildcard + spec: + containers: + - image: ghcr.io/socialgouv/recherche-entreprises/search:1.2.3 + livenessProbe: + failureThreshold: 6 + httpGet: + path: /healthz + port: http + initialDelaySeconds: 30 + periodSeconds: 5 + timeoutSeconds: 5 + name: recherche-entreprises-search + ports: + - containerPort: 3000 + name: http + readinessProbe: + failureThreshold: 15 + httpGet: + path: /healthz + port: http + initialDelaySeconds: 0 + periodSeconds: 5 + successThreshold: 1 + timeoutSeconds: 1 + resources: + limits: + cpu: 500m + memory: 128Mi + requests: + cpu: 5m + memory: 16Mi + startupProbe: + failureThreshold: 12 + httpGet: + path: /healthz + port: http + periodSeconds: 5 + env: + - name: ELASTICSEARCH_INDEX_NAME + value: search-entreprises +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: recherche-entreprises-search + application: recherche-entreprises + component: recherche-entreprises + owner: recherche-entreprises + team: recherche-entreprises + cert: wildcard + name: recherche-entreprises-search + 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/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' + namespace: recherche-entreprises-preprod +spec: + ports: + - name: http + port: 80 + targetPort: 3000 + selector: + app: recherche-entreprises-search + type: ClusterIP +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + kubernetes.io/ingress.class: nginx + 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/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' + labels: + app: recherche-entreprises-search + application: recherche-entreprises + component: recherche-entreprises + owner: recherche-entreprises + team: recherche-entreprises + cert: wildcard + name: recherche-entreprises-search + namespace: recherche-entreprises-preprod +spec: + rules: + - host: search-recherche-entreprises-preprod.dev2.fabrique.social.gouv.fr + http: + paths: + - backend: + service: + name: recherche-entreprises-search + port: + name: http + path: / + pathType: Prefix + tls: + - hosts: + - search-recherche-entreprises-preprod.dev2.fabrique.social.gouv.fr + secretName: wildcard-crt +--- +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/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' + labels: + app: recherche-entreprises-front + application: recherche-entreprises + component: recherche-entreprises + owner: recherche-entreprises + team: recherche-entreprises + cert: wildcard + name: recherche-entreprises-front + namespace: recherche-entreprises-preprod +spec: + replicas: 1 + selector: + matchLabels: + app: recherche-entreprises-front + 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/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' + labels: + app: recherche-entreprises-front + application: recherche-entreprises + component: recherche-entreprises + owner: recherche-entreprises + team: recherche-entreprises + cert: wildcard + spec: + containers: + - image: ghcr.io/socialgouv/recherche-entreprises/front:1.2.3 + livenessProbe: + failureThreshold: 6 + httpGet: + path: /healthz + port: http + initialDelaySeconds: 30 + periodSeconds: 5 + timeoutSeconds: 5 + name: recherche-entreprises-front + ports: + - containerPort: 80 + name: http + readinessProbe: + failureThreshold: 15 + httpGet: + path: /healthz + port: http + initialDelaySeconds: 0 + periodSeconds: 5 + successThreshold: 1 + timeoutSeconds: 1 + resources: + limits: + cpu: 500m + memory: 128Mi + requests: + cpu: 5m + memory: 16Mi + startupProbe: + failureThreshold: 12 + httpGet: + path: /healthz + port: http + periodSeconds: 5 + env: + - name: REACT_APP_API_URL + value: >- + https://search-recherche-entreprises-preprod.dev2.fabrique.social.gouv.fr/api/v1 +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: recherche-entreprises-front + application: recherche-entreprises + component: recherche-entreprises + owner: recherche-entreprises + team: recherche-entreprises + cert: wildcard + name: recherche-entreprises-front + 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/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' + namespace: recherche-entreprises-preprod +spec: + ports: + - name: http + port: 80 + targetPort: 80 + selector: + app: recherche-entreprises-front + type: ClusterIP +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + kubernetes.io/ingress.class: nginx + 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/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' + labels: + app: recherche-entreprises-front + application: recherche-entreprises + component: recherche-entreprises + owner: recherche-entreprises + team: recherche-entreprises + cert: wildcard + name: recherche-entreprises-front + namespace: recherche-entreprises-preprod +spec: + rules: + - host: recherche-entreprises-preprod.dev2.fabrique.social.gouv.fr + http: + paths: + - backend: + service: + name: recherche-entreprises-front + port: + name: http + path: / + pathType: Prefix + tls: + - hosts: + - recherche-entreprises-preprod.dev2.fabrique.social.gouv.fr secretName: wildcard-crt " `; diff --git a/.k8s/__tests__/__snapshots__/prod.ts.snap b/.k8s/__tests__/__snapshots__/prod.ts.snap index b8271c37..55ba28c0 100644 --- a/.k8s/__tests__/__snapshots__/prod.ts.snap +++ b/.k8s/__tests__/__snapshots__/prod.ts.snap @@ -8,9 +8,11 @@ metadata: annotations: kapp.k14s.io/disable-default-ownership-label-rules: '' kapp.k14s.io/disable-default-label-scoping-rules: '' - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: prod - app.gitlab.com/env.name: prod + app.github.com/job: '5678' + app.github.com/ref: refs/tags/v1.2.3 + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' labels: app: recherche-entreprises-api application: recherche-entreprises @@ -29,9 +31,11 @@ spec: annotations: kapp.k14s.io/disable-default-ownership-label-rules: '' kapp.k14s.io/disable-default-label-scoping-rules: '' - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: prod - app.gitlab.com/env.name: prod + app.github.com/job: '5678' + app.github.com/ref: refs/tags/v1.2.3 + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' labels: app: recherche-entreprises-api application: recherche-entreprises @@ -40,7 +44,7 @@ spec: team: recherche-entreprises spec: containers: - - image: harbor.fabrique.social.gouv.fr/cdtn/recherche-entreprises-api:1.2.3 + - image: harbor.fabrique.social.gouv.fr/cdtn/recherche-entreprises-api:1.5.8 livenessProbe: failureThreshold: 6 httpGet: @@ -86,9 +90,11 @@ metadata: annotations: kapp.k14s.io/disable-default-ownership-label-rules: '' kapp.k14s.io/disable-default-label-scoping-rules: '' - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: prod - app.gitlab.com/env.name: prod + app.github.com/job: '5678' + app.github.com/ref: refs/tags/v1.2.3 + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' labels: application: recherche-entreprises component: recherche-entreprises @@ -100,16 +106,18 @@ spec: ELASTICSEARCH_URL: >- AgAjiLY8OLRszj3zw7ngLaY3auR33D6sJSDaLQJWekd3Y4aHg5duw8wbdkMSu3WUARDGbFqyfoRQsG57xAliVJVLz07vFhxe7TXOnVMkpWH9pYdVqbl0blAnqyxTI7Uly9GvYDF7OcM23IvGA0svXHyge+nIUqO/zgvEyiYL/jiIfjXwKjXg0mJnH6/WszPBf9oaZYpwl0HOYHUK5LNIWyE5/nSSzCEMPamlACCtHdyRf0EywK3hur8V7FvC8gKDnByxn7IhVboOTdCsIQhrSV1ZePbvV5wex0H58JQdJWPMJxq/rRQKsNj/9Xmy8c31j3D2nCNQs6aSDi6wN9d2057rsiwIwqCnA8gPPh6bT26T2nnFFnbNFE/BMajucxxrx3+6ctIwmbC/ZpLrabzxcvoanc8o8zTS8s7FZL3/q00mWjAVy/OgIDdLKI8B2LQp1S+FGFdTmtzTNyscxtkjiJoEQeo1Mf8tWL2+h1nfeUipRq2xiVOa8KxM8ZkDPLFIAInA9w64/Ddk3FWnm5ky1MzRioZcjKqWfT6XxxNG/+4wvDCEMyDTLZyVY56sglGSSmizxXdBUeSR/n08F2k8Vw9s+qjTch5O1g/Agv87CVl+fROV/a4ayrP/gyTmLBT0OIsh6ZZtgIx1UJexF7fF8obFUcCAo8rvcj0ZlyP/ZNfmFu6CPUqd374DZyvZpwtnbX9fzpC2I1ZYNvV9vCVs5+BFULhbldsQPo5VMiEK1T+hunQr08yl3c/gtGYBpt5c6nn5xsopBWkwjjttVnsVVRZEDEwiDhlKbaJ/hedY3mZJ2g== ELASTICSEARCH_API_KEY: >- - AgBeveBsjm4jtYUPCGG29nyKrmf6Qo/N+XE2fr6ROfLaEeLHY4Ak7LxtL11Gk7+nPMB+/MyJb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ZgdZUQLuW6aWkueAW+0ccKop3VyBJn8fZ1xAKfIszgldpfUBxHuDJ8keEr9aJM8nYiC/lXNMb7dKDJkRoyn/X4mLv6VTwnaqvj/NwVfkK9mnZAoxQg2kEmiDWYvqNL7yRForYIZKDjU7dGUPBWPqeqvpKJ8QLsDnve1Amvhe6wr8K7FYpCLcyrAC0huPaU4/d3IFd7P/neGqocGEh1pvQDp1BWGytkmZAqu2nRp4y6zeVyPzO/G5BbVwOhvqG2BUIdFM68ekL2xFe8yeHIktqJeadgifOtYNF7xnDmsi/v57E6MAFoFiqkVG+4vtUCxQTYZNbDS5YDAo3DBaiIsdOgO0cIM/TCCxjcDPh3pQGs6fsFdENcXzgj8zZQnE3SjbojejTXfVEI6dSoHaIY4WBg0MXEwsivDJ8Ctjrc= template: metadata: name: elastic-recherche-entreprises-read annotations: kapp.k14s.io/disable-default-ownership-label-rules: '' kapp.k14s.io/disable-default-label-scoping-rules: '' - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: prod - app.gitlab.com/env.name: prod + app.github.com/job: '5678' + app.github.com/ref: refs/tags/v1.2.3 + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' labels: application: recherche-entreprises component: recherche-entreprises @@ -130,9 +138,11 @@ metadata: annotations: kapp.k14s.io/disable-default-ownership-label-rules: '' kapp.k14s.io/disable-default-label-scoping-rules: '' - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: prod - app.gitlab.com/env.name: prod + app.github.com/job: '5678' + app.github.com/ref: refs/tags/v1.2.3 + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' namespace: recherche-entreprises spec: ports: @@ -152,9 +162,11 @@ metadata: kubernetes.io/tls-acme: 'true' kapp.k14s.io/disable-default-ownership-label-rules: '' kapp.k14s.io/disable-default-label-scoping-rules: '' - app.gitlab.com/app: socialgouv-recherche-entreprises - app.gitlab.com/env: prod - app.gitlab.com/env.name: prod + app.github.com/job: '5678' + app.github.com/ref: refs/tags/v1.2.3 + app.github.com/repo: socialgouv/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' labels: app: recherche-entreprises-api application: recherche-entreprises @@ -180,6 +192,303 @@ spec: - api-recherche-entreprises.fabrique.social.gouv.fr secretName: recherche-entreprises-api-crt --- +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/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' + labels: + app: recherche-entreprises-search + application: recherche-entreprises + component: recherche-entreprises + owner: recherche-entreprises + team: recherche-entreprises + name: recherche-entreprises-search + namespace: recherche-entreprises +spec: + replicas: 1 + selector: + matchLabels: + app: recherche-entreprises-search + 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/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' + labels: + app: recherche-entreprises-search + application: recherche-entreprises + component: recherche-entreprises + owner: recherche-entreprises + team: recherche-entreprises + spec: + containers: + - image: ghcr.io/socialgouv/recherche-entreprises/search:1.2.3 + livenessProbe: + failureThreshold: 6 + httpGet: + path: /healthz + port: http + initialDelaySeconds: 30 + periodSeconds: 5 + timeoutSeconds: 5 + name: recherche-entreprises-search + ports: + - containerPort: 3000 + name: http + readinessProbe: + failureThreshold: 15 + httpGet: + path: /healthz + port: http + initialDelaySeconds: 0 + periodSeconds: 5 + successThreshold: 1 + timeoutSeconds: 1 + resources: + limits: + cpu: 500m + memory: 128Mi + requests: + cpu: 5m + memory: 16Mi + startupProbe: + failureThreshold: 12 + httpGet: + path: /healthz + port: http + periodSeconds: 5 + env: + - name: ELASTICSEARCH_INDEX_NAME + value: search-entreprises +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: recherche-entreprises-search + application: recherche-entreprises + component: recherche-entreprises + owner: recherche-entreprises + team: recherche-entreprises + name: recherche-entreprises-search + 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/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' + namespace: recherche-entreprises +spec: + ports: + - name: http + port: 80 + targetPort: 3000 + selector: + app: recherche-entreprises-search + 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/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' + labels: + app: recherche-entreprises-search + application: recherche-entreprises + component: recherche-entreprises + owner: recherche-entreprises + team: recherche-entreprises + name: recherche-entreprises-search + namespace: recherche-entreprises +spec: + rules: + - host: search-recherche-entreprises.fabrique.social.gouv.fr + http: + paths: + - backend: + service: + name: recherche-entreprises-search + port: + name: http + path: / + pathType: Prefix + tls: + - hosts: + - search-recherche-entreprises.fabrique.social.gouv.fr + secretName: recherche-entreprises-search-crt +--- +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/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' + labels: + app: recherche-entreprises-front + application: recherche-entreprises + component: recherche-entreprises + owner: recherche-entreprises + team: recherche-entreprises + name: recherche-entreprises-front + namespace: recherche-entreprises +spec: + replicas: 1 + selector: + matchLabels: + app: recherche-entreprises-front + 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/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' + labels: + app: recherche-entreprises-front + application: recherche-entreprises + component: recherche-entreprises + owner: recherche-entreprises + team: recherche-entreprises + spec: + containers: + - image: ghcr.io/socialgouv/recherche-entreprises/front:1.2.3 + livenessProbe: + failureThreshold: 6 + httpGet: + path: /healthz + port: http + initialDelaySeconds: 30 + periodSeconds: 5 + timeoutSeconds: 5 + name: recherche-entreprises-front + ports: + - containerPort: 80 + name: http + readinessProbe: + failureThreshold: 15 + httpGet: + path: /healthz + port: http + initialDelaySeconds: 0 + periodSeconds: 5 + successThreshold: 1 + timeoutSeconds: 1 + resources: + limits: + cpu: 500m + memory: 128Mi + requests: + cpu: 5m + memory: 16Mi + startupProbe: + failureThreshold: 12 + httpGet: + path: /healthz + port: http + periodSeconds: 5 + env: + - name: REACT_APP_API_URL + value: >- + https://search-recherche-entreprises.fabrique.social.gouv.fr/api/v1 +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: recherche-entreprises-front + application: recherche-entreprises + component: recherche-entreprises + owner: recherche-entreprises + team: recherche-entreprises + name: recherche-entreprises-front + 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/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' + namespace: recherche-entreprises +spec: + ports: + - name: http + port: 80 + targetPort: 80 + selector: + app: recherche-entreprises-front + 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/recherche-entreprises + app.github.com/run: '1234' + app.github.com/sha: '0123456' + labels: + app: recherche-entreprises-front + application: recherche-entreprises + component: recherche-entreprises + owner: recherche-entreprises + team: recherche-entreprises + name: recherche-entreprises-front + namespace: recherche-entreprises +spec: + rules: + - host: recherche-entreprises.fabrique.social.gouv.fr + http: + paths: + - backend: + service: + name: recherche-entreprises-front + port: + name: http + path: / + pathType: Prefix + tls: + - hosts: + - recherche-entreprises.fabrique.social.gouv.fr + secretName: recherche-entreprises-front-crt +--- apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: diff --git a/.k8s/__tests__/dev.ts b/.k8s/__tests__/dev.ts index a2457c24..ed94032b 100644 --- a/.k8s/__tests__/dev.ts +++ b/.k8s/__tests__/dev.ts @@ -1,7 +1,7 @@ // import { getEnvManifests } from "@socialgouv/kosko-charts/testing"; -import { project } from "@socialgouv/kosko-charts/testing/fake/gitlab-ci.env"; +import { project } from "@socialgouv/kosko-charts/testing/fake/github-actions.env"; jest.setTimeout(1000 * 60); test("kosko generate --dev", async () => { diff --git a/.k8s/__tests__/indexing-dev.ts b/.k8s/__tests__/indexing-dev.ts index f53628d0..3c0466bc 100644 --- a/.k8s/__tests__/indexing-dev.ts +++ b/.k8s/__tests__/indexing-dev.ts @@ -1,7 +1,7 @@ // import { getEnvManifests } from "@socialgouv/kosko-charts/testing"; -import { project } from "@socialgouv/kosko-charts/testing/fake/gitlab-ci.env"; +import { project } from "@socialgouv/kosko-charts/testing/fake/github-actions.env"; jest.setTimeout(1000 * 60); test("kosko generate --dev", async () => { diff --git a/.k8s/__tests__/indexing-preprod.ts b/.k8s/__tests__/indexing-preprod.ts index d2497231..e49008a6 100644 --- a/.k8s/__tests__/indexing-preprod.ts +++ b/.k8s/__tests__/indexing-preprod.ts @@ -1,7 +1,7 @@ // import { getEnvManifests } from "@socialgouv/kosko-charts/testing"; -import { project } from "@socialgouv/kosko-charts/testing/fake/gitlab-ci.env"; +import { project } from "@socialgouv/kosko-charts/testing/fake/github-actions.env"; jest.setTimeout(1000 * 60); test("kosko generate --dev", async () => { diff --git a/.k8s/__tests__/indexing-prod.ts b/.k8s/__tests__/indexing-prod.ts index 66e19f6e..6b11ee25 100644 --- a/.k8s/__tests__/indexing-prod.ts +++ b/.k8s/__tests__/indexing-prod.ts @@ -1,7 +1,7 @@ // import { getEnvManifests } from "@socialgouv/kosko-charts/testing"; -import { project } from "@socialgouv/kosko-charts/testing/fake/gitlab-ci.env"; +import { project } from "@socialgouv/kosko-charts/testing/fake/github-actions.env"; jest.setTimeout(1000 * 60); test("kosko generate --dev", async () => { diff --git a/.k8s/__tests__/preprod.ts b/.k8s/__tests__/preprod.ts index ea9aed49..b97eaa9b 100644 --- a/.k8s/__tests__/preprod.ts +++ b/.k8s/__tests__/preprod.ts @@ -1,7 +1,7 @@ // import { getEnvManifests } from "@socialgouv/kosko-charts/testing"; -import { project } from "@socialgouv/kosko-charts/testing/fake/gitlab-ci.env"; +import { project } from "@socialgouv/kosko-charts/testing/fake/github-actions.env"; jest.setTimeout(1000 * 60); test("kosko generate --preprod", async () => { diff --git a/.k8s/__tests__/prod.ts b/.k8s/__tests__/prod.ts index 52dfcd21..2e83a09f 100644 --- a/.k8s/__tests__/prod.ts +++ b/.k8s/__tests__/prod.ts @@ -1,14 +1,14 @@ // import { getEnvManifests } from "@socialgouv/kosko-charts/testing"; -import { project } from "@socialgouv/kosko-charts/testing/fake/gitlab-ci.env"; +import { project } from "@socialgouv/kosko-charts/testing/fake/github-actions.env"; jest.setTimeout(1000 * 60); test("kosko generate --prod", async () => { expect( await getEnvManifests("prod", "", { ...project("recherche-entreprises").prod, - RANCHER_PROJECT_ID: "c-lfcxv:p-d7g9q", + RANCHER_PROJECT_ID: "c-lfcxv:p-d7g9q", }) ).toMatchSnapshot(); }); diff --git a/.k8s/components/api-legacy.ts b/.k8s/components/api-legacy.ts new file mode 100644 index 00000000..854bce44 --- /dev/null +++ b/.k8s/components/api-legacy.ts @@ -0,0 +1,23 @@ +import env from "@kosko/env"; +import { create } from "@socialgouv/kosko-charts/components/app"; +import { addEnv, getDeployment } from "@socialgouv/kosko-charts/utils"; +import { getGithubRegistryImagePath } from "@socialgouv/kosko-charts/utils/getGithubRegistryImagePath"; +import { EnvVar } from "kubernetes-models/v1"; + +const getManifests = async () => { + const manifests = await create("recherche-entreprises-api", { + config: { + containerPort: 3000, + subDomainPrefix: "api-", + }, + deployment: { + image: + "harbor.fabrique.social.gouv.fr/cdtn/recherche-entreprises-api:1.5.8", + }, + env, + }); + + return manifests; +}; + +export default getManifests; diff --git a/.k8s/components/api.ts b/.k8s/components/api.ts index 72fc8cbf..ed6bee4a 100644 --- a/.k8s/components/api.ts +++ b/.k8s/components/api.ts @@ -1,16 +1,34 @@ import env from "@kosko/env"; import { create } from "@socialgouv/kosko-charts/components/app"; -import { getHarborImagePath } from "@socialgouv/kosko-charts/utils/getHarborImagePath"; +import { addEnv, getDeployment } from "@socialgouv/kosko-charts/utils"; +import { getGithubRegistryImagePath } from "@socialgouv/kosko-charts/utils/getGithubRegistryImagePath"; +import { EnvVar } from "kubernetes-models/v1"; -const manifests = create("recherche-entreprises-api", { - config: { - containerPort: 3000, - subDomainPrefix: "api-" - }, - deployment: { - image: getHarborImagePath({ name: "recherche-entreprises-api" }) - }, - env, -}); +const getManifests = async () => { + const manifests = await create("recherche-entreprises-search", { + config: { + containerPort: 3000, + subDomainPrefix: "search-", + }, + deployment: { + image: getGithubRegistryImagePath({ + name: "search", + project: "recherche-entreprises", + }), + }, + env, + }); + const deployment = getDeployment(manifests); -export default manifests; + addEnv({ + deployment, + data: new EnvVar({ + name: "ELASTICSEARCH_INDEX_NAME", + value: "search-entreprises", + }), + }); + + return manifests; +}; + +export default getManifests; diff --git a/.k8s/components/front.ts b/.k8s/components/front.ts new file mode 100644 index 00000000..a16f2387 --- /dev/null +++ b/.k8s/components/front.ts @@ -0,0 +1,38 @@ +import env from "@kosko/env"; +import { create } from "@socialgouv/kosko-charts/components/app"; +import { getGithubRegistryImagePath } from "@socialgouv/kosko-charts/utils/getGithubRegistryImagePath"; +import { + getDeployment, + getIngressHost, + addEnvs, +} from "@socialgouv/kosko-charts/utils"; + +import api from "./api"; + +const getManifests = async () => { + const manifests = await create("recherche-entreprises-front", { + config: { + containerPort: 80, + }, + deployment: { + image: getGithubRegistryImagePath({ + name: "front", + project: "recherche-entreprises", + }), + }, + env, + }); + const deployment = getDeployment(manifests); + const apiManifests = await api(); + const apiUrl = getIngressHost(apiManifests); + addEnvs({ + deployment, + data: { + REACT_APP_API_URL: `https://${apiUrl}/api/v1`, + }, + }); + + return manifests; +}; + +export default getManifests; diff --git a/.k8s/components/jobs/indexing.ts b/.k8s/components/jobs/indexing.ts index 05d2c71c..cfcf9353 100644 --- a/.k8s/components/jobs/indexing.ts +++ b/.k8s/components/jobs/indexing.ts @@ -1,8 +1,8 @@ -import env, { Environment } from "@kosko/env"; +import env from "@kosko/env"; import { SealedSecret } from "@kubernetes-models/sealed-secrets/bitnami.com/v1alpha1/SealedSecret"; -import gitlab from "@socialgouv/kosko-charts/environments/gitlab"; +import github from "@socialgouv/kosko-charts/environments/github"; import { addInitContainer } from "@socialgouv/kosko-charts/utils/addInitContainer"; -import { getHarborImagePath } from "@socialgouv/kosko-charts/utils/getHarborImagePath"; +import { getGithubRegistryImagePath } from "@socialgouv/kosko-charts/utils/getGithubRegistryImagePath"; import { updateMetadata } from "@socialgouv/kosko-charts/utils/updateMetadata"; import fs from "fs"; import { IIoK8sApiCoreV1PodSpec } from "kubernetes-models/api/core/v1/PodSpec"; @@ -29,21 +29,21 @@ const manifests = []; const secrets = { dev: { ELASTICSEARCH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XZ2K+R51bkbEYYfcvrrFmeCh+bdpsKALhmGbtVG0NeKIHR8uicixu/ewi95LVE8hwkYeAZerlBNSF4HRs2ZvNwtqnzQtiv5Dh1aVfQe8AaXojuS22JqgE+eiZhzw225ovZZ/OYv81odymXdBhovF+uurhF1jxczPc0DWdAKagw0mZYFfC7ipBILEitnp7vsrIuZZoKoZHjRhgLikhu74USV7RrutZpPQKqgm5+RWGu1v8HZzK4eDrH3JHi9TjKbcRG50=", }, }; @@ -80,12 +80,17 @@ const sealedSecret = getSealedSecret( {} ); +const envParams = github(process.env); + // base definition of the job const jobSpec: IIoK8sApiCoreV1PodSpec = { containers: [ { name: "update-index", - image: getHarborImagePath({ name: "recherche-entreprises-index" }), + image: getGithubRegistryImagePath({ + name: "index", + project: "recherche-entreprises", + }), volumeMounts: [ { name: "data", @@ -97,6 +102,10 @@ const jobSpec: IIoK8sApiCoreV1PodSpec = { name: "ASSEMBLY_FILE", value: "/data/assembly.csv", }, + { + name: "ELASTICSEARCH_INDEX_NAME", + value: "search-entreprises", + }, ], envFrom: [ { @@ -107,12 +116,12 @@ const jobSpec: IIoK8sApiCoreV1PodSpec = { ], resources: { limits: { - cpu: "2", - memory: "18Gi", + cpu: "4", + memory: "5Gi", }, requests: { - cpu: "1", - memory: "14Gi", + cpu: "2", + memory: "2Gi", }, }, }, @@ -126,36 +135,33 @@ const jobSpec: IIoK8sApiCoreV1PodSpec = { ], }; -// script for the initContainer of the index image -const initContainerScript = ` -apt-get update -y && apt-get install -y wget - -export DATA_DIR="/data" - -cd /data - -echo "running get-data.sh..." - -/mnt/scripts/get-data.sh - -pip3 install -r /mnt/scripts/requirements.txt - -echo "running assemble_data.py..." - -python3 /mnt/scripts/assemble_data.py $DATA_DIR/StockUniteLegale_utf8.zip $DATA_DIR/geo/ $DATA_DIR/WEEZ.csv $DATA_DIR/assembly.csv -`; - // initContainer definition, run above script and store data in a temp mount const initContainer = new Container({ - args: ["-c", initContainerScript], + args: ["/mnt/scripts/sqlite.sh"], command: ["sh"], - image: `python:3.9.4`, + image: `ubuntu:18.04`, imagePullPolicy: "Always", - name: `download-data`, + name: `download-build-data`, + env: [ + { + name: "DATA_DIR", + value: "/mnt/scripts/data", + }, + ], + resources: { + limits: { + cpu: "4", + memory: "2Gi", + }, + requests: { + cpu: "2", + memory: "1Gi", + }, + }, volumeMounts: [ { name: "data", - mountPath: "/data", + mountPath: "/mnt/scripts/data", }, { mountPath: "/mnt/scripts", @@ -166,9 +172,9 @@ const initContainer = new Container({ // add local files as volume to the initContainer const localFiles = [ - path.join(__dirname, "../../../assembly/scripts/get-data.sh"), - path.join(__dirname, "../../../assembly/src/assemble_data.py"), - path.join(__dirname, "../../../assembly/requirements.txt"), + path.join(__dirname, "../../../sqlite.sh"), + path.join(__dirname, "../../../import.sql"), + path.join(__dirname, "../../../export.sql"), ]; if (!jobSpec.volumes) { @@ -176,7 +182,7 @@ if (!jobSpec.volumes) { } jobSpec.volumes.push({ configMap: { - name: `config-map-files-${process.env.CI_COMMIT_SHORT_SHA}`, + name: `config-map-files-${process.env.GITHUB_SHA}`, defaultMode: 0o777, }, name: "local-files", @@ -192,14 +198,14 @@ const configMap = new ConfigMap({ {} ), metadata: { - name: `config-map-files-${process.env.CI_COMMIT_SHORT_SHA}`, + name: `config-map-files-${process.env.GITHUB_SHA}`, }, }); // create the final job const job = new Job({ metadata: { - name: `update-index-${process.env.CI_COMMIT_SHORT_SHA}`, + name: `update-index-${process.env.GITHUB_SHA}`, }, spec: { backoffLimit: 3, @@ -209,8 +215,6 @@ const job = new Job({ }, }); -const envParams = gitlab(process.env); - updateMetadata(configMap, { annotations: envParams.metadata.annotations ?? {}, labels: envParams.metadata.labels ?? {}, diff --git a/.k8s/environments/dev/recherche-entreprises-api.sealed-secret.yaml b/.k8s/environments/dev/recherche-entreprises-api.sealed-secret.yaml index 80687036..4ae3ddf4 100644 --- a/.k8s/environments/dev/recherche-entreprises-api.sealed-secret.yaml +++ b/.k8s/environments/dev/recherche-entreprises-api.sealed-secret.yaml @@ -3,16 +3,16 @@ kind: SealedSecret metadata: name: elastic-recherche-entreprises-read annotations: - sealedsecrets.bitnami.com/cluster-wide: 'true' + sealedsecrets.bitnami.com/cluster-wide: "true" spec: encryptedData: ELASTICSEARCH_URL: >- - AgDGWiSE5kUv0Mv4Dot8KfbSGm5XVlyi4V9yLiMI97deZctFWRd2T31MtTUz/XgT4VlFH4NUhK+dQonLEILE2P9rs4MMDaY09cc3NZiDLB9GJoBcWnWsa02QV4Xykk8UthTHQPFC4g+0ElFU4UewbIc3Zc2ZqIk5Y803TnYkRuAF1bM1ZdpWGnm+yh7+lXnbRMmFo62vhPVB8lnl9Z/RVxhs1jx6xnbIFyTjvelM4/sySiyHZ0h74fL61DAvOcNBgCTd49RRBBzcAhp6a8KL45FL1eAYyOqS8vW5uNeFu59Cu9ByRruhyTELjpPtLesjsBUHiqmfBh09esKw+mdtMmfYxIsy+JGPS50N8GiNj+n0A5XXtLQkm9oT884r4LEQip35YHyenh20NmueHX8RGMOXRT05PWnbL70NtZHqUwzFdc21vdFhXAb/MVaMgqcKG4RPkRS+qljn+pQjJ8DkY0EqgWOCfSyjB+jKJ65peSqqORq+B8zTDgpv9ZaN+xSDsfi+PckPPJqKOjaTkQW/VdfwpT6ipOUpNgznUOGy7XN9vxAQR9P79n6KlIyMsme4hN7OHX5ko0xWQZcCyfHbSbT7JHY5UpmTv+c0NtyrV755FQN75HDFRhQYHtgLnhR9PuBCZ8Gvtg2T/Nr63GsTMC5e52bj2zIRlOUTrsvxEIYKQoBPILoueEIcMz64/UiMAZ9RwH308wRHOrZtch5gclzUQWZEgI5Vx2cJQ/zr9iqBaedg2v8GqvESeKw1e7pgXoLE6pFKJtQa7cMwQgmrBkkxrEfePcRDP4yAMVQaiM8DoqIjVg== + AgCxK1MqqVkCOHvMjjcieUsj1uE/ATUzAfYTYVEMqcWFxTnugOaYlXB2mTuZtzdjXNvINREzDynnVRBghPIJvrJm59vPgexC5FyQptdPf2XwQAG6n0yML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MO8yUly1yarrx6jOo6E5kAdKqPGkNUyq3BgOvGWmkbV32slQ4hXm7zUuyVnXBmpmoryowHhqV7iW8Si6CSMKACCENVqJPrk55VaL8sw8dZfQF0aekJoEqf/UqAv/DZUTYOAg4QI+4iD4= template: metadata: annotations: - sealedsecrets.bitnami.com/cluster-wide: 'true' + sealedsecrets.bitnami.com/cluster-wide: "true" name: elastic-recherche-entreprises-read - type: Opaque \ No newline at end of file + type: Opaque diff --git a/.k8s/environments/prod/recherche-entreprises-api.sealed-secret.yaml b/.k8s/environments/prod/recherche-entreprises-api.sealed-secret.yaml index 3ca5cd7c..87e09af1 100644 --- a/.k8s/environments/prod/recherche-entreprises-api.sealed-secret.yaml +++ b/.k8s/environments/prod/recherche-entreprises-api.sealed-secret.yaml @@ -5,8 +5,8 @@ metadata: spec: encryptedData: ELASTICSEARCH_URL: AgAjiLY8OLRszj3zw7ngLaY3auR33D6sJSDaLQJWekd3Y4aHg5duw8wbdkMSu3WUARDGbFqyfoRQsG57xAliVJVLz07vFhxe7TXOnVMkpWH9pYdVqbl0blAnqyxTI7Uly9GvYDF7OcM23IvGA0svXHyge+nIUqO/zgvEyiYL/jiIfjXwKjXg0mJnH6/WszPBf9oaZYpwl0HOYHUK5LNIWyE5/nSSzCEMPamlACCtHdyRf0EywK3hur8V7FvC8gKDnByxn7IhVboOTdCsIQhrSV1ZePbvV5wex0H58JQdJWPMJxq/rRQKsNj/9Xmy8c31j3D2nCNQs6aSDi6wN9d2057rsiwIwqCnA8gPPh6bT26T2nnFFnbNFE/BMajucxxrx3+6ctIwmbC/ZpLrabzxcvoanc8o8zTS8s7FZL3/q00mWjAVy/OgIDdLKI8B2LQp1S+FGFdTmtzTNyscxtkjiJoEQeo1Mf8tWL2+h1nfeUipRq2xiVOa8KxM8ZkDPLFIAInA9w64/Ddk3FWnm5ky1MzRioZcjKqWfT6XxxNG/+4wvDCEMyDTLZyVY56sglGSSmizxXdBUeSR/n08F2k8Vw9s+qjTch5O1g/Agv87C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ulZFvZJOw+f0hS0KQ6lP84R3LLQTbm40KO71Al+UW0g/4L2eSqAvx3jmQEuLMPehlG7rwitoUDsAiuRPbclb0bfro9uhtWFXgLOTNU48mTT64Xq5mFsYKdNkwXXVgP7+wNg0UMsa2TlyDLMb7JW91MN5vOwsKtr7OfoPIKa5LwHvQIkFDcI4aWBuxsS2FGTBJ81xpgCAfBOnDVYz+ymon8FyQt6Y3SgSF0wjVZC7t8qkC0nPTRj6eCBc9loOt/NLUpSBqFhEYqO0FAl++sS0CZBgvsLnS8gAiiv3UwdLOz94QL0zqFdZBh5TZgdZUQLuW6aWkueAW+0ccKop3VyBJn8fZ1xAKfIszgldpfUBxHuDJ8keEr9aJM8nYiC/lXNMb7dKDJkRoyn/X4mLv6VTwnaqvj/NwVfkK9mnZAoxQg2kEmiDWYvqNL7yRForYIZKDjU7dGUPBWPqeqvpKJ8QLsDnve1Amvhe6wr8K7FYpCLcyrAC0huPaU4/d3IFd7P/neGqocGEh1pvQDp1BWGytkmZAqu2nRp4y6zeVyPzO/G5BbVwOhvqG2BUIdFM68ekL2xFe8yeHIktqJeadgifOtYNF7xnDmsi/v57E6MAFoFiqkVG+4vtUCxQTYZNbDS5YDAo3DBaiIsdOgO0cIM/TCCxjcDPh3pQGs6fsFdENcXzgj8zZQnE3SjbojejTXfVEI6dSoHaIY4WBg0MXEwsivDJ8Ctjrc= template: metadata: name: elastic-recherche-entreprises-read - type: Opaque \ No newline at end of file + type: Opaque diff --git a/README.md b/README.md index a46c4c50..34894f59 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Exemple : [/api/v1/search?q=plume&a=paris](https://api-recherche-entreprises.fab ## Étapes : -![](https://mermaid.ink/svg/eyJjb2RlIjoiZ3JhcGggTFJcblxuU3RvY2tVbml0ZUxlZ2FsZS5jc3YtLT5QeUFzc2VtYmx5wqBcbmdlb19zaXJldC5jc3YtLT5QeUFzc2VtYmx5wqBcbnNpcmV0MmlkY2MuY3N2LS0-UHlBc3NlbWJ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lkIjoie30iLCJ1cGRhdGVFZGl0b3IiOmZhbHNlLCJhdXRvU3luYyI6dHJ1ZSwidXBkYXRlRGlhZ3JhbSI6ZmFsc2V9) ## Données : @@ -28,19 +28,11 @@ Exemple : [/api/v1/search?q=plume&a=paris](https://api-recherche-entreprises.fab ## Assemblage -Le CSV est généré en deux étapes dans le dossier `assembly/` : +Le script `sqlite.sh` permet de permet de télécharger les CSV, les importer dans SQLite pour les aggréger et les re-exporter en CSV. -- Téléchargement des datasets (8GB) +Le fichier `./data/assembly.csv` fait +6Go avec plus de 30 millions de lignes. - `DATA_DIR=./data/ scripts/get-data.sh` - -- Assemblage des fichiers avec Python (numpy & pandas) - - `pip install -r requirements.txt` - - `DATA_DIR=./data/ OUTPUT_DIR=./output scripts/assemble.sh` - -Au final, le fichier `./output/assembly.csv` fait environ 600Mo +Cette opération dure environ 30 minutes. ## Indexation Elastic Search @@ -48,14 +40,16 @@ Le dossier `index/` contient les scripts qui injectent le fichier `assembly.csv` La mise à jour exploite la fonctionnalité [alias](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/indices-aliases.html) d'ElasticSearch pour éviter les downtimes. -Le script `scripts/create-es-keys.sh` permet de créer des token pour lire/écrire sur ces index. - Pour lancer une indexation : ```sh -yarn install - -ELASTICSEARCH_URL=https://elastic_url:9200 ELASTICSEARCH_API_KEY=key_with_writing_rights ASSEMBLY_FILE=./output/assembly.csv yarn start +yarn +ELASTICSEARCH_URL=https://elastic_url:9200 ELASTICSEARCH_API_KEY=key_with_writing_rights ASSEMBLY_FILE=./data/assembly.csv yarn start ``` -The default `ELASTICSEARCH_INDEX_NAME` is `recherche-entreprises` +Le script `scripts/create-es-keys.sh` permet de créer des token pour lire/écrire sur ces index. + +## Projets relatifs + +- Annuaire-entreprises : https://annuaire-entreprises.data.gouv.fr +- API Entreprise : https://entreprise.api.gouv.fr/catalogue/ diff --git a/api/Dockerfile b/api/Dockerfile index 35bd42d7..b7b31c0d 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -1,21 +1,24 @@ -FROM node:15-alpine as builder +FROM node:16-alpine as builder WORKDIR /app RUN chown node:node /app COPY package.json . COPY yarn.lock . -RUN yarn +RUN yarn --frozen-lockfile COPY . . RUN yarn build - +RUN yarn --frozen-lockfile --production # --- -FROM node:15-alpine +FROM node:16-alpine WORKDIR /app ENV NODE_ENV=production COPY --from=builder /app/dist ./dist -COPY package.json . +COPY --from=builder /app/node_modules ./node_modules + +WORKDIR /app/dist + USER node -ENTRYPOINT ["yarn", "start"] \ No newline at end of file +ENTRYPOINT ["node", "./src/index.js"] \ No newline at end of file diff --git a/api/README.md b/api/README.md index 67f568db..30fa7d4f 100644 --- a/api/README.md +++ b/api/README.md @@ -2,42 +2,14 @@ Exemple d'API qui exploite l'index ElasticSearch [recherche-entreprises](https://github.com/socialgouv/recherche-entreprises) -```sh -yarn install -yarn build -ELASTICSEARCH_URL=http://localhost:9200 ELASTICSEARCH_API_KEY=key yarn start -``` - -## **Generic search** - ---- - -Returns json data about companies matching search parameters - -- **URL** - - /api/v1/search - -- **Method:** - - `GET` - -- **Query Params** - - **Required:** +## API Documentation - `q=[string]` query used to perform the search on company names +Documentation [swagger / OpenAPI](./openapi.yaml) : https://api.recherche-entreprises.fabrique.social.gouv.fr - **Optional:** - - `a=[string]` city or postal code - - `l=[integer]` result limit - -- **Sample Call:** +- **Exemple:** ```sh - curl --request GET --url 'http://localhost:3000/api/v1/search?q=michelin&a=clermont&l=3' + curl --request GET --url 'http://localhost:3000/api/v1/search?query=michelin&address=clermont&limit=3&open=false' ``` - **Success Response:** @@ -214,3 +186,11 @@ Returns etablissement details for a given **siret** "siret": "85520050700710" } ``` + +## Dev + +```sh +yarn install +yarn build +ELASTICSEARCH_URL=http://localhost:9200 ELASTICSEARCH_API_KEY=key yarn start +``` diff --git a/api/openapi.yaml b/api/openapi.yaml new file mode 100644 index 00000000..03a72236 --- /dev/null +++ b/api/openapi.yaml @@ -0,0 +1,87 @@ +swagger: "2.0" +info: + description: "Document de l'API recherche-entreprises" + version: "1.0.0" + title: "API recherche-entreprises" + contact: + email: "codedutravailnumerique@travail.gouv.fr" + license: + name: "Apache-2.0" + url: "http://www.apache.org/licenses/LICENSE-2.0.html" +host: "api.recherche-entreprises.fabrique.social.gouv.fr" +basePath: "/api/v1" +schemes: + - "https" + - "http" +paths: + /search: + get: + summary: "Recherche entreprise" + description: "Reherche d'entreprise par nom d'établissement, raison sociale" + operationId: "search" + tags: + - "Recherche" + produces: + - "application/json" + parameters: + - in: "query" + name: "query" + description: "Texte de la recherche" + required: true + type: string + example: "Michelin" + value: "Michelin" + - in: "query" + name: "address" + description: "Localisation de l'entreprise" + required: false + example: "Lyon" + value: "Lyon" + type: string + - in: "query" + name: "limit" + description: "Nombre de résultats max" + required: false + example: 100 + value: 100 + default: 100 + type: integer + - in: "query" + name: "open" + description: "Retourne uniquement les établissements ouverts" + required: false + example: false + value: false + default: true + type: boolean + - in: "query" + name: "employer" + description: "Retourne uniquement les établissements avec des employés déclarés" + required: false + example: false + value: false + default: false + type: boolean + - in: "query" + name: "convention" + description: "Retourne uniquement les établissements avec une convention collective déclarée" + required: false + example: false + value: false + default: false + type: boolean + - in: "query" + name: "ranked" + description: "Si 'true', ordonne les résultats par taille d'établissement, basée sur la tranche effectif de l'unité légale. Si 'false', ordonné par SIRET décroissant." + required: false + example: true + value: true + default: true + type: boolean + responses: + "500": + description: "Unexpexted error occured" + +externalDocs: + description: "Find out more about Swagger" + url: "http://swagger.io" diff --git a/api/package.json b/api/package.json index 9058a6ea..6ebe3104 100644 --- a/api/package.json +++ b/api/package.json @@ -3,11 +3,10 @@ "version": "1.0.0", "description": "Sample API for recherche-entreprises", "private": true, - "main": "index.js", "scripts": { "dev": "nodemon --watch 'src/**' --ext 'ts' --ignore '__tests__' --exec 'ts-node src/index.ts'", - "build": "ncc build src/index.ts -o dist", - "start": "node dist/index.js", + "build": "tsc --outDir dist && cp openapi.yaml ./dist && cp -a ./swagger-ui ./dist", + "start": "node dist/src/index.js", "test": "jest", "lint": "eslint src/**/*.ts" }, @@ -18,24 +17,27 @@ "@koa/cors": "^3.1.0", "@socialgouv/kali-data": "^2.132.0", "koa": "^2.13.3", - "koa-router": "^10.1.1" + "koa-router": "^10.1.1", + "koa-static": "^5.0.0", + "yamljs": "^0.3.0" }, "devDependencies": { "@socialgouv/eslint-config-recommended": "^1.89.0", - "@types/jest": "^26.0.24", + "@types/jest": "^27.0.3", "@types/koa": "^2.13.4", "@types/koa-router": "^7.4.4", + "@types/koa-static": "^4.0.2", "@types/koa__cors": "^3.0.3", "@types/lodash.pick": "^4.4.6", - "@types/node": "^10.17.60", + "@types/node": "^16.11.10", "@types/supertest": "^2.0.11", - "@typescript-eslint/eslint-plugin": "^4.31.2", - "@typescript-eslint/parser": "^4.31.2", - "@vercel/ncc": "^0.28.6", - "eslint": "^7.32.0", + "@types/yamljs": "^0.2.31", + "@typescript-eslint/eslint-plugin": "^5.4.0", + "@typescript-eslint/parser": "^5.4.0", + "eslint": "^8.3.0", "eslint-import-resolver-typescript": "^2.5.0", "eslint-plugin-import": "^2.24.2", - "eslint-plugin-prettier": "^3.4.1", + "eslint-plugin-prettier": "^4.0.0", "jest": "^27", "nodemon": "^2.0.13", "prettier": "^2.4.1", diff --git a/api/src/__tests__/__snapshots__/api.test.ts.snap b/api/src/__tests__/__snapshots__/api.test.ts.snap index 59a4cc22..ca5cdc66 100644 --- a/api/src/__tests__/__snapshots__/api.test.ts.snap +++ b/api/src/__tests__/__snapshots__/api.test.ts.snap @@ -2,7 +2,7 @@ exports[`Test entreprise search correct siren 1`] = ` Object { - "activitePrincipale": "Édition de livres", + "caractereEmployeurUniteLegale": "O", "conventions": Array [ Object { "etat": "VIGUEUR_ETEN", @@ -24,15 +24,12 @@ Object { "title": "Convention collective nationale des bureaux d'études techniques, des cabinets d'ingénieurs-conseils et des sociétés de conseils du 15 décembre 1987. ", "url": "https://www.legifrance.gouv.fr/affichIDCC.do?idConvention=KALICONT000005635173", }, - Object { - "idcc": 9999, - "shortTitle": "", - }, ], - "etablissements": 35, + "etablissements": 133, + "etatAdministratifUniteLegale": "A", "highlightLabel": "MANUFACTURE FRANCAISE DES PNEUMATIQUES MICHELIN", "label": "MANUFACTURE FRANCAISE DES PNEUMATIQUES MICHELIN", - "matching": 35, + "matching": 133, "simpleLabel": "MANUFACTURE FRANCAISE DES PNEUMATIQUES MICHELIN", "siren": "855200507", } @@ -41,19 +38,28 @@ Object { exports[`Test etablissement search correct siret 1`] = ` Object { "activitePrincipale": "Traitement de données, hébergement et activités connexes", - "address": "107 Rue Servient 69003 Lyon", - "convention": Object { - "etat": "VIGUEUR_ETEN", - "id": "KALICONT000005635597", - "idcc": 45, - "mtime": 1562873918, - "shortTitle": "Caoutchouc", - "texte_de_base": "KALITEXT000005673838", - "title": "Convention collective nationale du caoutchouc du 6 mars 1953. Étendue par arrêté du 29 mai 1969 JORF 18 juin 1969 ", - "url": "https://www.legifrance.gouv.fr/affichIDCC.do?idConvention=KALICONT000005635597", - }, - "etablissements": 35, + "address": "107 RUE SERVIENT 69003 LYON", + "caractereEmployeurUniteLegale": "O", + "categorieEntreprise": "GE", + "conventions": Array [ + Object { + "etat": "VIGUEUR_ETEN", + "id": "KALICONT000005635597", + "idcc": 45, + "mtime": 1562873918, + "shortTitle": "Caoutchouc", + "texte_de_base": "KALITEXT000005673838", + "title": "Convention collective nationale du caoutchouc du 6 mars 1953. Étendue par arrêté du 29 mai 1969 JORF 18 juin 1969 ", + "url": "https://www.legifrance.gouv.fr/affichIDCC.do?idConvention=KALICONT000005635597", + }, + ], + "etablissements": 133, + "etatAdministratifEtablissement": "A", + "etatAdministratifUniteLegale": "A", "highlightLabel": "MANUFACTURE FRANCAISE DES PNEUMATIQUES MICHELIN", + "idccs": Array [ + "0045", + ], "label": "MANUFACTURE FRANCAISE DES PNEUMATIQUES MICHELIN", "matching": 1, "simpleLabel": "MANUFACTURE FRANCAISE DES PNEUMATIQUES MICHELIN", @@ -64,7 +70,146 @@ Object { exports[`Test search generic search 1`] = ` Object { - "activitePrincipale": "Édition de livres", + "activitePrincipale": "Fabrication et rechapage de pneumatiques", + "allMatchingEtablissements": Array [ + Object { + "address": "7 AVENUE DU PRÉSIDENT RENÉ COTY 10600 LA CHAPELLE-SAINT-LUC", + "idccs": Array [ + "0045", + ], + "siret": "85520050701171", + }, + Object { + "address": "PLACE ALEXANDRE DIEU 18230 SAINT-DOULCHARD", + "idccs": Array [ + "0045", + "9999", + ], + "siret": "85520050701106", + }, + Object { + "address": "ZAC DE L’ARNAHURT 33650 LA BRÈDE", + "idccs": Array [ + "0045", + ], + "siret": "85520050702823", + }, + Object { + "address": "RUE DE CHARLIEU 42300 ROANNE", + "idccs": Array [ + "0045", + ], + "siret": "85520050701445", + }, + Object { + "address": "ZI BLAVOZY-ST GERM LAPRADE 43700 BLAVOZY", + "idccs": Array [ + "0045", + "9999", + ], + "siret": "85520050701866", + }, + Object { + "address": "AVENUE EDOUARD MICHELIN 56000 VANNES", + "idccs": Array [ + "0045", + ], + "siret": "85520050700637", + }, + Object { + "address": "ZA PLATEAU D’HERIN 59220 ROUVIGNIES", + "idccs": Array [ + "0045", + ], + "siret": "85520050703086", + }, + Object { + "address": "107 RUE SERVIENT 69003 LYON", + "idccs": Array [ + "0045", + ], + "siret": "85520050703169", + }, + Object { + "address": "21 RUE MARCELLIN BERTHELOT 86000 POITIERS", + "idccs": Array [ + "0045", + ], + "siret": "85520050700132", + }, + Object { + "address": "ROUTE D’ARLES 13300 SALON-DE-PROVENCE", + "idccs": Array [ + "0045", + ], + "siret": "85520050703094", + }, + Object { + "address": "1 RUE GUTENBERG 37300 JOUÉ-LÈS-TOURS", + "idccs": Array [ + "0045", + "9999", + ], + "siret": "85520050700850", + }, + Object { + "address": "16 RUE DE TOUTLEMONDE 49300 CHOLET", + "idccs": Array [ + "0045", + "9999", + ], + "siret": "85520050700710", + }, + Object { + "address": "PLACE DES CARMES DECHAUX 63000 CLERMONT-FERRAND", + "idccs": Array [ + "0045", + "1486", + "9999", + ], + "siret": "85520050700017", + }, + Object { + "address": "ZI DE FELET 63300 THIERS", + "idccs": Array [ + "0045", + ], + "siret": "85520050702278", + }, + Object { + "address": "USINE MICHELIN DE BLANZY LA FIOLLE (ZONE INDUSTRIELLE) BLANZY", + "idccs": Array [ + "0045", + "9999", + ], + "siret": "85520050700306", + }, + Object { + "address": "ROUTE DE NANTES 85000 LA ROCHE-SUR-YON", + "idccs": Array [ + "0045", + "9999", + ], + "siret": "85520050701379", + }, + Object { + "address": "RUE DU XAY 88190 GOLBEY", + "idccs": Array [ + "0045", + ], + "siret": "85520050700108", + }, + Object { + "address": "27 COURS DE L’ILE SEGUIN 92100 BOULOGNE-BILLANCOURT", + "idccs": Array [ + "0045", + "1486", + "9999", + ], + "siret": "85520050703144", + }, + ], + "caractereEmployeurUniteLegale": "O", "conventions": Array [ Object { "etat": "VIGUEUR_ETEN", @@ -87,10 +232,11 @@ Object { "url": "https://www.legifrance.gouv.fr/affichIDCC.do?idConvention=KALICONT000005635173", }, ], - "etablissements": 35, + "etablissements": 133, + "etatAdministratifUniteLegale": "A", "highlightLabel": "MANUFACTURE FRANCAISE DES PNEUMATIQUES MICHELIN", "label": "MANUFACTURE FRANCAISE DES PNEUMATIQUES MICHELIN", - "matching": 20, + "matching": 18, "simpleLabel": "MANUFACTURE FRANCAISE DES PNEUMATIQUES MICHELIN", "siren": "855200507", } diff --git a/api/src/__tests__/api.test.ts b/api/src/__tests__/api.test.ts index 4c41b56e..632bbbbb 100644 --- a/api/src/__tests__/api.test.ts +++ b/api/src/__tests__/api.test.ts @@ -12,17 +12,38 @@ app.use(router.routes()); const apptest = supertest(http.createServer(app.callback())); -const searchCall = ( - query: string, - address: string | undefined, - limit: number | undefined -) => { - const addressQP = address ? `&a=${address}` : ""; - const limitQP = limit ? `&l=${limit}` : ""; - - return apptest.get( - `${API_PREFIX}/search?onlyWithConvention=true&q=${query}${addressQP}${limitQP}` - ); +const searchCall = ({ + query, + address, + limit, + open, + employer, + convention, + ranked, +}: { + query: string; + address?: string; + limit?: number; + open?: string; + employer?: boolean; + convention?: boolean; + ranked?: string; +}) => { + const addressQP = address ? `&address=${address}` : ""; + const limitQP = limit ? `&limit=${limit}` : ""; + + const openQP = open ? `&open=${open}` : ""; + const employerQP = employer ? `&employer=${employer}` : ""; + + const rankedQP = ranked ? `&ranked=${ranked}` : ""; + + const url = `${API_PREFIX}/search?convention=${ + convention?.toString() || true + }&query=${query}${addressQP}${limitQP}${openQP}${employerQP}${rankedQP}`; + + // console.log(url); + + return apptest.get(url); }; const michelinSiren = "855200507"; @@ -30,62 +51,69 @@ const michelinSiret = `${michelinSiren}03169`; describe("Test search", () => { test("generic search", async () => { - const { status, body } = await searchCall("michelin", undefined, undefined); + const { status, body } = await searchCall({ query: "michelin" }); + expect(status).toBe(200); expect(body.entreprises).toBeDefined(); expect(body.entreprises.length).toEqual(20); expect(body.entreprises[0].siren).toEqual(michelinSiren); // eslint-disable-next-line no-unused-vars - const { matchingEtablissement, ...partialBody } = body.entreprises[0]; + const { firstMatchingEtablissement, ...partialBody } = body.entreprises[0]; expect(partialBody).toMatchSnapshot(); }); test("with limit", async () => { const limit = 50; - const { body } = await searchCall("michelin", undefined, limit); + const { body } = await searchCall({ limit, query: "michelin" }); expect(body.entreprises.length).toEqual(limit); }); test("search with postal code and city", async () => { - const { body: b1 } = await searchCall("michelin", undefined, undefined); - expect(b1.entreprises[0].matchingEtablissement.address).not.toBe( - `"23 Place des Carmes Dechaux 63000 Clermont-Ferrand"` + const { body: b1 } = await searchCall({ query: "michelin" }); + expect(b1.entreprises[0].firstMatchingEtablissement.address).not.toBe( + `"23 PLACE DES CARMES DECHAUX 63000 CLERMONT-FERRAND"` ); - const { body: b2 } = await searchCall("michelin", "63 000", undefined); + const { body: b2 } = await searchCall({ + address: "63 000", + query: "michelin", + }); expect( - b2.entreprises[0].matchingEtablissement.address + b2.entreprises[0].firstMatchingEtablissement.address ).toMatchInlineSnapshot( - `"23 Place des Carmes Dechaux 63000 Clermont-Ferrand"` + `"PLACE DES CARMES DECHAUX 63000 CLERMONT-FERRAND"` ); - const { body: b3 } = await searchCall("michelin", "clermont", undefined); + const { body: b3 } = await searchCall({ + address: "clermont", + query: "michelin", + }); expect( - b3.entreprises[0].matchingEtablissement.address + b3.entreprises[0].firstMatchingEtablissement.address ).toMatchInlineSnapshot( - `"23 Place des Carmes Dechaux 63000 Clermont-Ferrand"` + `"PLACE DES CARMES DECHAUX 63000 CLERMONT-FERRAND"` ); - const { body: b4 } = await searchCall("michelin", "63", undefined); + const { body: b4 } = await searchCall({ address: "63", query: "michelin" }); expect( - b4.entreprises[0].matchingEtablissement.address + b4.entreprises[0].firstMatchingEtablissement.address ).toMatchInlineSnapshot( - `"23 Place des Carmes Dechaux 63000 Clermont-Ferrand"` + `"PLACE DES CARMES DECHAUX 63000 CLERMONT-FERRAND"` ); - }); + }, 15000); test("search with diatrics", async () => { - const { body: b1 } = await searchCall("michelin", undefined, undefined); - const { body: b2 } = await searchCall("michélin", undefined, undefined); - const { body: b3 } = await searchCall("Mîchèlin", undefined, undefined); + const { body: b1 } = await searchCall({ query: "michelin" }); + const { body: b2 } = await searchCall({ query: "michélin" }); + const { body: b3 } = await searchCall({ query: "Mîchèlin" }); expect(b1).toStrictEqual(b2); expect(b1).toStrictEqual(b3); }); test("search with siret", async () => { - const { body } = await searchCall(michelinSiret, undefined, undefined); - expect(body.entreprises[0].matchingEtablissement.siret).toEqual( + const { body } = await searchCall({ query: michelinSiret }); + expect(body.entreprises[0].firstMatchingEtablissement.siret).toEqual( michelinSiret ); }); @@ -116,6 +144,14 @@ describe("Test etablissement search", () => { ); expect(status).toEqual(400); }); + + test("multiple conventions for one etablissement", async () => { + const manyCCsSiret = "00572078400106"; + const { body } = await apptest.get( + `${API_PREFIX}/etablissement/${manyCCsSiret}` + ); + expect(body.conventions.length).toEqual(2); + }); }); describe("Test entreprise search", () => { @@ -123,8 +159,9 @@ describe("Test entreprise search", () => { const { body, status } = await apptest.get( `${API_PREFIX}/entreprise/${michelinSiren}` ); - // We delete matchingEtablissement since it comes from collapse wich is non deterministic - delete body.matchingEtablissement; + // We delete matching etablissement since it comes from collapse which is non deterministic + delete body.firstMatchingEtablissement; + delete body.allMatchingEtablissements; expect(status).toEqual(200); expect(body.siren).toEqual(michelinSiren); expect(body).toMatchSnapshot(); @@ -142,3 +179,68 @@ describe("Test entreprise search", () => { expect(status).toEqual(400); }); }); + +describe("Test api params", () => { + test("not only open", async () => { + const { body: b1 } = await searchCall({ + open: "false", + query: "michelin", + limit: 1, + convention: false, + }); + expect( + b1.entreprises[0].firstMatchingEtablissement + .etatAdministratifEtablissement + ).toEqual("F"); + }); + + test("not only employer", async () => { + const getNotEmployer = (resp: any) => + resp.entreprises.filter( + (e: any) => e.caractereEmployeurUniteLegale == "N" + ); + + const { body: notOnlyEmployer } = await searchCall({ + employer: false, + query: "michelin", + }); + expect(getNotEmployer(notOnlyEmployer).length).toBeGreaterThan(0); + + const { body: onlyEmployer } = await searchCall({ + employer: true, + query: "michelin", + }); + expect(getNotEmployer(onlyEmployer).length).toBe(0); + }); + + test("not with convention", async () => { + const { body: withConvention } = await searchCall({ + query: "truc", + limit: 1, + }); + const { body: noConvention } = await searchCall({ + convention: false, + query: "truc", + limit: 1, + }); + expect(noConvention.entreprises[0].conventions).toEqual([]); + expect(withConvention.entreprises[0].conventions.length).toBeGreaterThan(0); + }); + + test("unranked search", async () => { + const { + body: { entreprises: ranked }, + } = await searchCall({ query: "michelin" }); + + const { + body: { entreprises: unranked }, + } = await searchCall({ query: "michelin", ranked: "false" }); + + expect(unranked).not.toStrictEqual(ranked); + expect(ranked[0].label).toEqual( + "MANUFACTURE FRANCAISE DES PNEUMATIQUES MICHELIN" + ); + expect(unranked[0].label).not.toEqual(ranked[0].label); + expect(unranked[2].label).toEqual("BOULANGERIE MICHELIN"); + }); +}); diff --git a/api/src/elastic/index.ts b/api/src/elastic/index.ts index 6bc9e9f2..45d8768a 100644 --- a/api/src/elastic/index.ts +++ b/api/src/elastic/index.ts @@ -6,8 +6,8 @@ const API_KEY = process.env.ELASTICSEARCH_API_KEY; const auth = API_KEY ? { apiKey: API_KEY } : undefined; -export const ELASTICSEARCH_INDEX = - process.env.ELASTICSEARCH_INDEX || "recherche-entreprises"; +export const ELASTICSEARCH_INDEX_NAME = + process.env.ELASTICSEARCH_INDEX_NAME || "recherche-entreprises"; const esClientConfig = { auth, diff --git a/api/src/elastic/queries.ts b/api/src/elastic/queries.ts index 5c96eb06..48369369 100644 --- a/api/src/elastic/queries.ts +++ b/api/src/elastic/queries.ts @@ -7,12 +7,12 @@ const defaultLimit = 20; const conventionsSet = Object.fromEntries( kaliConventions.map((c) => { - const { num, etat, id, mtime, texte_de_base, url, title } = c; - return [num, { etat, id, mtime, texte_de_base, title, url }]; + const { num, etat, id, mtime, texte_de_base, url, title, shortTitle } = c; + return [num, { etat, id, mtime, texte_de_base, title, url, shortTitle }]; }) ); -// we remove deduplicate tokens to compose company's label +// we remove duplicated tokens to compose company's label const formatLabel = (naming: string[]) => { const labelTokens = naming .join(" ") @@ -46,11 +46,16 @@ export const mapHit = ({ denominationUsuelle1UniteLegale, denominationUsuelle2UniteLegale, denominationUsuelle3UniteLegale, + etatAdministratifEtablissement, + categorieEntreprise, + etatAdministratifUniteLegale, + caractereEmployeurUniteLegale, activitePrincipale, etablissements, siret, - address, + geo_adresse, naming, + idccs, }, inner_hits, highlight, @@ -68,23 +73,40 @@ export const mapHit = ({ ( acc: any, { - fields: { convention, idcc }, - }: { fields: { convention: string[]; idcc: string } } + fields: { convention, idccs }, + }: { fields: { convention: string[]; idccs: string[] } } ) => { - const kaliData = idcc ? conventionsSet[idcc] : undefined; - const o = { - idcc: parseInt(idcc), - shortTitle: convention ? convention[0] : "", - ...kaliData, - }; - if (!acc.has(o.idcc)) { - acc.set(o.idcc, o); - } + idccs?.forEach((idcc) => { + const idccNum = parseInt(idcc); + // ignore idcc 0 and 9999 : unkown ccs + if (idccNum && idccNum > 0 && idccNum < 9999) { + const kaliData = conventionsSet[idccNum]; + const o = { + idcc: idccNum, + // shortTitle: convention ? convention[0] : "", + ...kaliData, + }; + if (!acc.has(o.idcc)) { + acc.set(o.idcc, o); + } + } + }); + return acc; }, new Map() ); + const allMatchingEtablissements = inner_hits.matchingEtablissements.hits.hits + .filter((h: any) => h.fields) + .map( + ({ fields: { "geo_adresse.keyword": address, siret, idccs } }: any) => ({ + address: address[0], + siret: siret[0], + idccs, + }) + ); + // take first by priority const simpleLabel = [ denominationUniteLegale, @@ -97,49 +119,57 @@ export const mapHit = ({ return { activitePrincipale, + caractereEmployeurUniteLegale, conventions: Array.from(conventions.values()), etablissements: parseInt(etablissements), + etatAdministratifUniteLegale, highlightLabel, label, matching, - matchingEtablissement: { - address, + firstMatchingEtablissement: { + address: geo_adresse, + idccs, + categorieEntreprise, siret, + etatAdministratifEtablissement, }, + allMatchingEtablissements, simpleLabel, siren, }; }; +// rank by "effectif" const rank_feature = { boost: 10, field: "trancheEffectifsUniteLegale" }; const collapse = (withAllConventions: boolean) => ({ field: "siren", inner_hits: { _source: false, - docvalue_fields: ["idcc", "convention"], + docvalue_fields: ["siret", "geo_adresse.keyword", "idccs"], name: "matchingEtablissements", size: withAllConventions ? 10000 : 1, }, }); -const addressFilter = (address: string | undefined) => - address - ? [ - { - prefix: { - cp: address ? address.replace(/\D/g, "") : "", - }, +const addressFilter = (address: string) => { + // check if address filter is code postal or commune + const cp = parseInt(address); + + return cp + ? { + prefix: { + codePostalEtablissement: cp.toString(), }, - { - match: { - ville: { - query: address, - }, + } + : { + match: { + libelleCommuneEtablissement: { + query: address, }, }, - ] - : [{ match_all: {} }]; + }; +}; export type SearchArgs = { query: string; @@ -147,16 +177,65 @@ export type SearchArgs = { // return convention of every etablissements associated to the main company addAllConventions?: boolean; // only search for etablissements with convention attached - onlyWithConvention?: boolean; + convention: boolean; limit?: number | undefined; + // etablissement still open + open: boolean; + // etablissement employeur + employer: boolean; + // rank by effectif ? + ranked: boolean; +}; + +const onlyConventionFilter = { term: { withIdcc: true } }; + +const openFilters = [ + { term: { etatAdministratifUniteLegale: "A" } }, + { term: { etatAdministratifEtablissement: "A" } }, +]; + +const employerFilter = { + term: { + caractereEmployeurUniteLegale: "O", + }, +}; + +const makeFilters = ( + convention: boolean, + open: boolean, + employer: boolean, + address: string | undefined +) => { + const filters = []; + + if (convention) { + filters.push(onlyConventionFilter); + } + + if (open) { + filters.push(...openFilters); + } + + if (employer) { + filters.push(employerFilter); + } + + if (address) { + filters.push(addressFilter(address)); + } + + return filters; }; export const entrepriseSearchBody = ({ query, address, addAllConventions = true, - onlyWithConvention = true, + convention, limit = defaultLimit, + open, + employer, + ranked, }: SearchArgs) => ({ collapse: collapse(addAllConventions), highlight: { @@ -166,18 +245,8 @@ export const entrepriseSearchBody = ({ }, query: { bool: { - filter: onlyWithConvention - ? [ - { term: { withIdcc: onlyWithConvention } }, - { range: { "idcc.number": { lt: 5001 } } }, - ] - : undefined, + filter: makeFilters(convention, open, employer, address), must: [ - { - bool: { - should: addressFilter(address), - }, - }, { bool: { should: [ @@ -190,7 +259,7 @@ export const entrepriseSearchBody = ({ }, ], should: [ - { rank_feature }, + ranked ? { rank_feature } : undefined, // rank by siret with minimum boosting in order to ensure results appear in the same order // useful to always have the same first etablissement when no address passed { rank_feature: { boost: 0.1, field: "siretRank" } }, diff --git a/api/src/index.ts b/api/src/index.ts index f071ae4a..b3b177a1 100644 --- a/api/src/index.ts +++ b/api/src/index.ts @@ -1,15 +1,17 @@ import Koa from "koa"; import cors from "@koa/cors"; - +import serve from "koa-static"; import { router } from "./routes"; export const app = new Koa(); app.use(cors()); -const port = process.env.API_PORT || 3000; +const port = process.env.PORT || 3000; +app.use(serve("./swagger-ui")); app.use(router.routes()); + app.listen(port); console.log(`API started on port ${port}`); diff --git a/api/src/lib/index.ts b/api/src/lib/index.ts index c22d4272..8da78a92 100644 --- a/api/src/lib/index.ts +++ b/api/src/lib/index.ts @@ -1,4 +1,4 @@ -import { ELASTICSEARCH_INDEX, elasticsearchClient } from "../elastic"; +import { ELASTICSEARCH_INDEX_NAME, elasticsearchClient } from "../elastic"; import type { SearchArgs } from "../elastic/queries"; import { entrepriseSearchBody, mapHit } from "../elastic/queries"; @@ -6,27 +6,34 @@ export const search = async ({ query, address, addAllConventions, - onlyWithConvention, + convention, limit, + open, + employer, + ranked, }: SearchArgs) => { const body = entrepriseSearchBody({ addAllConventions, address, + convention, + employer, limit, - onlyWithConvention, + open, query, + ranked, }); const response = await elasticsearchClient.search({ body, - index: ELASTICSEARCH_INDEX, + // explain: true, + index: ELASTICSEARCH_INDEX_NAME, }); - // console.log(JSON.stringify(body, null, 2)); + // console.log(JSON.stringify(body, null, 2)); const entreprises = response.body.hits.hits.map(mapHit); - // console.log(JSON.stringify(entreprises, null, 2)); + // console.log(JSON.stringify(response, null, 2)); return entreprises; }; @@ -34,14 +41,17 @@ export const search = async ({ export const searchEntreprise = async (siren: string) => { const body = entrepriseSearchBody({ addAllConventions: true, + convention: false, + employer: false, limit: 1, - onlyWithConvention: false, + open: false, query: siren, + ranked: true, }); const response = await elasticsearchClient.search({ body, - index: ELASTICSEARCH_INDEX, + index: ELASTICSEARCH_INDEX_NAME, }); const matches = response.body.hits.hits.map(mapHit); @@ -56,30 +66,29 @@ export const searchEntreprise = async (siren: string) => { export const searchEtablissement = async (siret: string) => { const body = entrepriseSearchBody({ addAllConventions: false, + convention: false, + employer: false, limit: 1, - onlyWithConvention: false, + open: false, query: siret, + ranked: true, }); const response = await elasticsearchClient.search({ body, - index: ELASTICSEARCH_INDEX, + index: ELASTICSEARCH_INDEX_NAME, }); const matches = response.body.hits.hits.map(mapHit); if (matches && matches.length >= 1) { - const etablissement = matches[0]; + const raw = matches[0]; // update some fields related to etablissement - const convention = etablissement.conventions[0] - ? etablissement.conventions[0] - : undefined; - delete etablissement.conventions; - etablissement["convention"] = convention; - etablissement.siret = etablissement.matchingEtablissement.siret; - etablissement.address = etablissement.matchingEtablissement.address; - delete etablissement.matchingEtablissement; + const firstMatching = raw.firstMatchingEtablissement; + const etablissement = { ...raw, ...firstMatching }; + delete etablissement.firstMatchingEtablissement; + delete etablissement.allMatchingEtablissements; return etablissement; } else { diff --git a/api/src/routes/index.ts b/api/src/routes/index.ts index 9c7b1b38..38926d9e 100644 --- a/api/src/routes/index.ts +++ b/api/src/routes/index.ts @@ -1,4 +1,5 @@ import Router from "koa-router"; +import yamljs from "yamljs"; import pkg from "../../package.json"; import { search, searchEntreprise, searchEtablissement } from "../lib"; @@ -7,24 +8,31 @@ export const router = new Router(); export const API_PREFIX = "/api/v1"; +const parseBoolean = (param: string, defaultz = true) => + param === undefined ? defaultz : param.toLowerCase() !== "false"; + router.get(`${API_PREFIX}/search`, async (ctx) => { - const { q: query, a: address, l: limit, onlyWithConvention } = ctx.query; + const { query, address, limit, convention, open, employer, ranked } = + ctx.query; if (!query) { - ctx.throw(400, `query parameter q is required`); + ctx.throw(400, `query parameter query is required`); } try { const entreprises = await search({ addAllConventions: true, address: address as string, + convention: parseBoolean(convention as string, false), + employer: parseBoolean(employer as string, false), limit: parseInt(limit as string), - onlyWithConvention: !!onlyWithConvention, + open: parseBoolean(open as string, true), query: query as string, + ranked: parseBoolean(ranked as string, true), }); ctx.body = { entreprises }; } catch (err) { - console.log(JSON.stringify(err)); + console.log(err); ctx.throw(500); } }); @@ -52,7 +60,7 @@ router.get(`${API_PREFIX}/etablissement/:siret`, async (ctx) => { if ((err as any).status) { throw err; } else { - console.log(JSON.stringify(err)); + console.log(err); ctx.throw(500); } } @@ -81,7 +89,7 @@ router.get(`${API_PREFIX}/entreprise/:siren`, async (ctx) => { if ((err as any).status) { throw err; } else { - console.log(JSON.stringify(err)); + console.log(err); ctx.throw(500); } } @@ -92,10 +100,16 @@ router.get(`/healthz`, (ctx) => { ctx.body = { hello: "world" }; }); -router.get(`/`, (ctx) => { +router.get(`/version`, (ctx) => { ctx.body = { about: "https://github.com/SocialGouv/recherche-entreprises", success: true, version: pkg.version, }; }); + +const spec = yamljs.load("./openapi.yaml"); + +router.get("/swagger.json", (ctx) => { + ctx.body = spec; +}); diff --git a/api/swagger-ui/favicon-16x16.png b/api/swagger-ui/favicon-16x16.png new file mode 100644 index 00000000..8b194e61 Binary files /dev/null and b/api/swagger-ui/favicon-16x16.png differ diff --git a/api/swagger-ui/favicon-32x32.png b/api/swagger-ui/favicon-32x32.png new file mode 100644 index 00000000..249737fe Binary files /dev/null and b/api/swagger-ui/favicon-32x32.png differ diff --git a/api/swagger-ui/index.html b/api/swagger-ui/index.html new file mode 100644 index 00000000..d9aa5c7f --- /dev/null +++ b/api/swagger-ui/index.html @@ -0,0 +1,61 @@ + + + + + + Swagger UI + + + + + + + +
+ + + + + + diff --git a/api/swagger-ui/oauth2-redirect.html b/api/swagger-ui/oauth2-redirect.html new file mode 100644 index 00000000..64b171f7 --- /dev/null +++ b/api/swagger-ui/oauth2-redirect.html @@ -0,0 +1,75 @@ + + + + Swagger UI: OAuth2 Redirect + + + + + diff --git a/api/swagger-ui/swagger-ui-bundle.js b/api/swagger-ui/swagger-ui-bundle.js new file mode 100644 index 00000000..e9a9319e --- /dev/null +++ b/api/swagger-ui/swagger-ui-bundle.js @@ -0,0 +1,3 @@ +/*! For license information please see swagger-ui-bundle.js.LICENSE.txt */ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SwaggerUIBundle=t():e.SwaggerUIBundle=t()}(this,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/dist",n(n.s=463)}([function(e,t,n){"use strict";e.exports=n(533)},function(e,t,n){e.exports=function(){"use strict";var e=Array.prototype.slice;function t(e,t){t&&(e.prototype=Object.create(t.prototype)),e.prototype.constructor=e}function n(e){return i(e)?e:J(e)}function r(e){return u(e)?e:K(e)}function o(e){return s(e)?e:Y(e)}function a(e){return i(e)&&!c(e)?e:G(e)}function i(e){return!(!e||!e[f])}function u(e){return!(!e||!e[p])}function s(e){return!(!e||!e[h])}function c(e){return u(e)||s(e)}function l(e){return!(!e||!e[d])}t(r,n),t(o,n),t(a,n),n.isIterable=i,n.isKeyed=u,n.isIndexed=s,n.isAssociative=c,n.isOrdered=l,n.Keyed=r,n.Indexed=o,n.Set=a;var f="@@__IMMUTABLE_ITERABLE__@@",p="@@__IMMUTABLE_KEYED__@@",h="@@__IMMUTABLE_INDEXED__@@",d="@@__IMMUTABLE_ORDERED__@@",m="delete",v=5,g=1<>>0;if(""+n!==t||4294967295===n)return NaN;t=n}return t<0?A(e)+t:t}function C(){return!0}function j(e,t,n){return(0===e||void 0!==n&&e<=-n)&&(void 0===t||void 0!==n&&t>=n)}function T(e,t){return N(e,t,0)}function I(e,t){return N(e,t,t)}function N(e,t,n){return void 0===e?n:e<0?Math.max(0,t+e):void 0===t?e:Math.min(t,e)}var P=0,M=1,R=2,D="function"==typeof Symbol&&Symbol.iterator,L="@@iterator",B=D||L;function F(e){this.next=e}function z(e,t,n,r){var o=0===e?t:1===e?n:[t,n];return r?r.value=o:r={value:o,done:!1},r}function q(){return{value:void 0,done:!0}}function U(e){return!!H(e)}function V(e){return e&&"function"==typeof e.next}function W(e){var t=H(e);return t&&t.call(e)}function H(e){var t=e&&(D&&e[D]||e[L]);if("function"==typeof t)return t}function $(e){return e&&"number"==typeof e.length}function J(e){return null==e?ie():i(e)?e.toSeq():ce(e)}function K(e){return null==e?ie().toKeyedSeq():i(e)?u(e)?e.toSeq():e.fromEntrySeq():ue(e)}function Y(e){return null==e?ie():i(e)?u(e)?e.entrySeq():e.toIndexedSeq():se(e)}function G(e){return(null==e?ie():i(e)?u(e)?e.entrySeq():e:se(e)).toSetSeq()}F.prototype.toString=function(){return"[Iterator]"},F.KEYS=P,F.VALUES=M,F.ENTRIES=R,F.prototype.inspect=F.prototype.toSource=function(){return this.toString()},F.prototype[B]=function(){return this},t(J,n),J.of=function(){return J(arguments)},J.prototype.toSeq=function(){return this},J.prototype.toString=function(){return this.__toString("Seq {","}")},J.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},J.prototype.__iterate=function(e,t){return fe(this,e,t,!0)},J.prototype.__iterator=function(e,t){return pe(this,e,t,!0)},t(K,J),K.prototype.toKeyedSeq=function(){return this},t(Y,J),Y.of=function(){return Y(arguments)},Y.prototype.toIndexedSeq=function(){return this},Y.prototype.toString=function(){return this.__toString("Seq [","]")},Y.prototype.__iterate=function(e,t){return fe(this,e,t,!1)},Y.prototype.__iterator=function(e,t){return pe(this,e,t,!1)},t(G,J),G.of=function(){return G(arguments)},G.prototype.toSetSeq=function(){return this},J.isSeq=ae,J.Keyed=K,J.Set=G,J.Indexed=Y;var Q,Z,X,ee="@@__IMMUTABLE_SEQ__@@";function te(e){this._array=e,this.size=e.length}function ne(e){var t=Object.keys(e);this._object=e,this._keys=t,this.size=t.length}function re(e){this._iterable=e,this.size=e.length||e.size}function oe(e){this._iterator=e,this._iteratorCache=[]}function ae(e){return!(!e||!e[ee])}function ie(){return Q||(Q=new te([]))}function ue(e){var t=Array.isArray(e)?new te(e).fromEntrySeq():V(e)?new oe(e).fromEntrySeq():U(e)?new re(e).fromEntrySeq():"object"==typeof e?new ne(e):void 0;if(!t)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+e);return t}function se(e){var t=le(e);if(!t)throw new TypeError("Expected Array or iterable object of values: "+e);return t}function ce(e){var t=le(e)||"object"==typeof e&&new ne(e);if(!t)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+e);return t}function le(e){return $(e)?new te(e):V(e)?new oe(e):U(e)?new re(e):void 0}function fe(e,t,n,r){var o=e._cache;if(o){for(var a=o.length-1,i=0;i<=a;i++){var u=o[n?a-i:i];if(!1===t(u[1],r?u[0]:i,e))return i+1}return i}return e.__iterateUncached(t,n)}function pe(e,t,n,r){var o=e._cache;if(o){var a=o.length-1,i=0;return new F((function(){var e=o[n?a-i:i];return i++>a?q():z(t,r?e[0]:i-1,e[1])}))}return e.__iteratorUncached(t,n)}function he(e,t){return t?de(t,e,"",{"":e}):me(e)}function de(e,t,n,r){return Array.isArray(t)?e.call(r,n,Y(t).map((function(n,r){return de(e,n,r,t)}))):ve(t)?e.call(r,n,K(t).map((function(n,r){return de(e,n,r,t)}))):t}function me(e){return Array.isArray(e)?Y(e).map(me).toList():ve(e)?K(e).map(me).toMap():e}function ve(e){return e&&(e.constructor===Object||void 0===e.constructor)}function ge(e,t){if(e===t||e!=e&&t!=t)return!0;if(!e||!t)return!1;if("function"==typeof e.valueOf&&"function"==typeof t.valueOf){if((e=e.valueOf())===(t=t.valueOf())||e!=e&&t!=t)return!0;if(!e||!t)return!1}return!("function"!=typeof e.equals||"function"!=typeof t.equals||!e.equals(t))}function ye(e,t){if(e===t)return!0;if(!i(t)||void 0!==e.size&&void 0!==t.size&&e.size!==t.size||void 0!==e.__hash&&void 0!==t.__hash&&e.__hash!==t.__hash||u(e)!==u(t)||s(e)!==s(t)||l(e)!==l(t))return!1;if(0===e.size&&0===t.size)return!0;var n=!c(e);if(l(e)){var r=e.entries();return t.every((function(e,t){var o=r.next().value;return o&&ge(o[1],e)&&(n||ge(o[0],t))}))&&r.next().done}var o=!1;if(void 0===e.size)if(void 0===t.size)"function"==typeof e.cacheResult&&e.cacheResult();else{o=!0;var a=e;e=t,t=a}var f=!0,p=t.__iterate((function(t,r){if(n?!e.has(t):o?!ge(t,e.get(r,b)):!ge(e.get(r,b),t))return f=!1,!1}));return f&&e.size===p}function be(e,t){if(!(this instanceof be))return new be(e,t);if(this._value=e,this.size=void 0===t?1/0:Math.max(0,t),0===this.size){if(Z)return Z;Z=this}}function we(e,t){if(!e)throw new Error(t)}function xe(e,t,n){if(!(this instanceof xe))return new xe(e,t,n);if(we(0!==n,"Cannot step a Range by 0"),e=e||0,void 0===t&&(t=1/0),n=void 0===n?1:Math.abs(n),tr?q():z(e,o,n[t?r-o++:o++])}))},t(ne,K),ne.prototype.get=function(e,t){return void 0===t||this.has(e)?this._object[e]:t},ne.prototype.has=function(e){return this._object.hasOwnProperty(e)},ne.prototype.__iterate=function(e,t){for(var n=this._object,r=this._keys,o=r.length-1,a=0;a<=o;a++){var i=r[t?o-a:a];if(!1===e(n[i],i,this))return a+1}return a},ne.prototype.__iterator=function(e,t){var n=this._object,r=this._keys,o=r.length-1,a=0;return new F((function(){var i=r[t?o-a:a];return a++>o?q():z(e,i,n[i])}))},ne.prototype[d]=!0,t(re,Y),re.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);var n=W(this._iterable),r=0;if(V(n))for(var o;!(o=n.next()).done&&!1!==e(o.value,r++,this););return r},re.prototype.__iteratorUncached=function(e,t){if(t)return this.cacheResult().__iterator(e,t);var n=W(this._iterable);if(!V(n))return new F(q);var r=0;return new F((function(){var t=n.next();return t.done?t:z(e,r++,t.value)}))},t(oe,Y),oe.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);for(var n,r=this._iterator,o=this._iteratorCache,a=0;a=r.length){var t=n.next();if(t.done)return t;r[o]=t.value}return z(e,o,r[o++])}))},t(be,Y),be.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},be.prototype.get=function(e,t){return this.has(e)?this._value:t},be.prototype.includes=function(e){return ge(this._value,e)},be.prototype.slice=function(e,t){var n=this.size;return j(e,t,n)?this:new be(this._value,I(t,n)-T(e,n))},be.prototype.reverse=function(){return this},be.prototype.indexOf=function(e){return ge(this._value,e)?0:-1},be.prototype.lastIndexOf=function(e){return ge(this._value,e)?this.size:-1},be.prototype.__iterate=function(e,t){for(var n=0;n=0&&t=0&&nn?q():z(e,a++,i)}))},xe.prototype.equals=function(e){return e instanceof xe?this._start===e._start&&this._end===e._end&&this._step===e._step:ye(this,e)},t(_e,n),t(Ee,_e),t(Se,_e),t(ke,_e),_e.Keyed=Ee,_e.Indexed=Se,_e.Set=ke;var Ae="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(e,t){var n=65535&(e|=0),r=65535&(t|=0);return n*r+((e>>>16)*r+n*(t>>>16)<<16>>>0)|0};function Oe(e){return e>>>1&1073741824|3221225471&e}function Ce(e){if(!1===e||null==e)return 0;if("function"==typeof e.valueOf&&(!1===(e=e.valueOf())||null==e))return 0;if(!0===e)return 1;var t=typeof e;if("number"===t){if(e!=e||e===1/0)return 0;var n=0|e;for(n!==e&&(n^=4294967295*e);e>4294967295;)n^=e/=4294967295;return Oe(n)}if("string"===t)return e.length>Fe?je(e):Te(e);if("function"==typeof e.hashCode)return e.hashCode();if("object"===t)return Ie(e);if("function"==typeof e.toString)return Te(e.toString());throw new Error("Value type "+t+" cannot be hashed.")}function je(e){var t=Ue[e];return void 0===t&&(t=Te(e),qe===ze&&(qe=0,Ue={}),qe++,Ue[e]=t),t}function Te(e){for(var t=0,n=0;n0)switch(e.nodeType){case 1:return e.uniqueID;case 9:return e.documentElement&&e.documentElement.uniqueID}}var Re,De="function"==typeof WeakMap;De&&(Re=new WeakMap);var Le=0,Be="__immutablehash__";"function"==typeof Symbol&&(Be=Symbol(Be));var Fe=16,ze=255,qe=0,Ue={};function Ve(e){we(e!==1/0,"Cannot perform this action with an infinite size.")}function We(e){return null==e?ot():He(e)&&!l(e)?e:ot().withMutations((function(t){var n=r(e);Ve(n.size),n.forEach((function(e,n){return t.set(n,e)}))}))}function He(e){return!(!e||!e[Je])}t(We,Ee),We.of=function(){var t=e.call(arguments,0);return ot().withMutations((function(e){for(var n=0;n=t.length)throw new Error("Missing value for key: "+t[n]);e.set(t[n],t[n+1])}}))},We.prototype.toString=function(){return this.__toString("Map {","}")},We.prototype.get=function(e,t){return this._root?this._root.get(0,void 0,e,t):t},We.prototype.set=function(e,t){return at(this,e,t)},We.prototype.setIn=function(e,t){return this.updateIn(e,b,(function(){return t}))},We.prototype.remove=function(e){return at(this,e,b)},We.prototype.deleteIn=function(e){return this.updateIn(e,(function(){return b}))},We.prototype.update=function(e,t,n){return 1===arguments.length?e(this):this.updateIn([e],t,n)},We.prototype.updateIn=function(e,t,n){n||(n=t,t=void 0);var r=vt(this,_n(e),t,n);return r===b?void 0:r},We.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):ot()},We.prototype.merge=function(){return pt(this,void 0,arguments)},We.prototype.mergeWith=function(t){return pt(this,t,e.call(arguments,1))},We.prototype.mergeIn=function(t){var n=e.call(arguments,1);return this.updateIn(t,ot(),(function(e){return"function"==typeof e.merge?e.merge.apply(e,n):n[n.length-1]}))},We.prototype.mergeDeep=function(){return pt(this,ht,arguments)},We.prototype.mergeDeepWith=function(t){var n=e.call(arguments,1);return pt(this,dt(t),n)},We.prototype.mergeDeepIn=function(t){var n=e.call(arguments,1);return this.updateIn(t,ot(),(function(e){return"function"==typeof e.mergeDeep?e.mergeDeep.apply(e,n):n[n.length-1]}))},We.prototype.sort=function(e){return Ut(fn(this,e))},We.prototype.sortBy=function(e,t){return Ut(fn(this,t,e))},We.prototype.withMutations=function(e){var t=this.asMutable();return e(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this},We.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new S)},We.prototype.asImmutable=function(){return this.__ensureOwner()},We.prototype.wasAltered=function(){return this.__altered},We.prototype.__iterator=function(e,t){return new et(this,e,t)},We.prototype.__iterate=function(e,t){var n=this,r=0;return this._root&&this._root.iterate((function(t){return r++,e(t[1],t[0],n)}),t),r},We.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?rt(this.size,this._root,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},We.isMap=He;var $e,Je="@@__IMMUTABLE_MAP__@@",Ke=We.prototype;function Ye(e,t){this.ownerID=e,this.entries=t}function Ge(e,t,n){this.ownerID=e,this.bitmap=t,this.nodes=n}function Qe(e,t,n){this.ownerID=e,this.count=t,this.nodes=n}function Ze(e,t,n){this.ownerID=e,this.keyHash=t,this.entries=n}function Xe(e,t,n){this.ownerID=e,this.keyHash=t,this.entry=n}function et(e,t,n){this._type=t,this._reverse=n,this._stack=e._root&&nt(e._root)}function tt(e,t){return z(e,t[0],t[1])}function nt(e,t){return{node:e,index:0,__prev:t}}function rt(e,t,n,r){var o=Object.create(Ke);return o.size=e,o._root=t,o.__ownerID=n,o.__hash=r,o.__altered=!1,o}function ot(){return $e||($e=rt(0))}function at(e,t,n){var r,o;if(e._root){var a=_(w),i=_(x);if(r=it(e._root,e.__ownerID,0,void 0,t,n,a,i),!i.value)return e;o=e.size+(a.value?n===b?-1:1:0)}else{if(n===b)return e;o=1,r=new Ye(e.__ownerID,[[t,n]])}return e.__ownerID?(e.size=o,e._root=r,e.__hash=void 0,e.__altered=!0,e):r?rt(o,r):ot()}function it(e,t,n,r,o,a,i,u){return e?e.update(t,n,r,o,a,i,u):a===b?e:(E(u),E(i),new Xe(t,r,[o,a]))}function ut(e){return e.constructor===Xe||e.constructor===Ze}function st(e,t,n,r,o){if(e.keyHash===r)return new Ze(t,r,[e.entry,o]);var a,i=(0===n?e.keyHash:e.keyHash>>>n)&y,u=(0===n?r:r>>>n)&y;return new Ge(t,1<>>=1)i[u]=1&n?t[a++]:void 0;return i[r]=o,new Qe(e,a+1,i)}function pt(e,t,n){for(var o=[],a=0;a>1&1431655765))+(e>>2&858993459))+(e>>4)&252645135,e+=e>>8,127&(e+=e>>16)}function yt(e,t,n,r){var o=r?e:k(e);return o[t]=n,o}function bt(e,t,n,r){var o=e.length+1;if(r&&t+1===o)return e[t]=n,e;for(var a=new Array(o),i=0,u=0;u=xt)return ct(e,s,r,o);var p=e&&e===this.ownerID,h=p?s:k(s);return f?u?c===l-1?h.pop():h[c]=h.pop():h[c]=[r,o]:h.push([r,o]),p?(this.entries=h,this):new Ye(e,h)}},Ge.prototype.get=function(e,t,n,r){void 0===t&&(t=Ce(n));var o=1<<((0===e?t:t>>>e)&y),a=this.bitmap;return 0==(a&o)?r:this.nodes[gt(a&o-1)].get(e+v,t,n,r)},Ge.prototype.update=function(e,t,n,r,o,a,i){void 0===n&&(n=Ce(r));var u=(0===t?n:n>>>t)&y,s=1<=_t)return ft(e,p,c,u,d);if(l&&!d&&2===p.length&&ut(p[1^f]))return p[1^f];if(l&&d&&1===p.length&&ut(d))return d;var m=e&&e===this.ownerID,g=l?d?c:c^s:c|s,w=l?d?yt(p,f,d,m):wt(p,f,m):bt(p,f,d,m);return m?(this.bitmap=g,this.nodes=w,this):new Ge(e,g,w)},Qe.prototype.get=function(e,t,n,r){void 0===t&&(t=Ce(n));var o=(0===e?t:t>>>e)&y,a=this.nodes[o];return a?a.get(e+v,t,n,r):r},Qe.prototype.update=function(e,t,n,r,o,a,i){void 0===n&&(n=Ce(r));var u=(0===t?n:n>>>t)&y,s=o===b,c=this.nodes,l=c[u];if(s&&!l)return this;var f=it(l,e,t+v,n,r,o,a,i);if(f===l)return this;var p=this.count;if(l){if(!f&&--p0&&r=0&&e>>t&y;if(r>=this.array.length)return new Ct([],e);var o,a=0===r;if(t>0){var i=this.array[r];if((o=i&&i.removeBefore(e,t-v,n))===i&&a)return this}if(a&&!o)return this;var u=Lt(this,e);if(!a)for(var s=0;s>>t&y;if(o>=this.array.length)return this;if(t>0){var a=this.array[o];if((r=a&&a.removeAfter(e,t-v,n))===a&&o===this.array.length-1)return this}var i=Lt(this,e);return i.array.splice(o+1),r&&(i.array[o]=r),i};var jt,Tt,It={};function Nt(e,t){var n=e._origin,r=e._capacity,o=qt(r),a=e._tail;return i(e._root,e._level,0);function i(e,t,n){return 0===t?u(e,n):s(e,t,n)}function u(e,i){var u=i===o?a&&a.array:e&&e.array,s=i>n?0:n-i,c=r-i;return c>g&&(c=g),function(){if(s===c)return It;var e=t?--c:s++;return u&&u[e]}}function s(e,o,a){var u,s=e&&e.array,c=a>n?0:n-a>>o,l=1+(r-a>>o);return l>g&&(l=g),function(){for(;;){if(u){var e=u();if(e!==It)return e;u=null}if(c===l)return It;var n=t?--l:c++;u=i(s&&s[n],o-v,a+(n<=e.size||t<0)return e.withMutations((function(e){t<0?Ft(e,t).set(0,n):Ft(e,0,t+1).set(t,n)}));t+=e._origin;var r=e._tail,o=e._root,a=_(x);return t>=qt(e._capacity)?r=Dt(r,e.__ownerID,0,t,n,a):o=Dt(o,e.__ownerID,e._level,t,n,a),a.value?e.__ownerID?(e._root=o,e._tail=r,e.__hash=void 0,e.__altered=!0,e):Pt(e._origin,e._capacity,e._level,o,r):e}function Dt(e,t,n,r,o,a){var i,u=r>>>n&y,s=e&&u0){var c=e&&e.array[u],l=Dt(c,t,n-v,r,o,a);return l===c?e:((i=Lt(e,t)).array[u]=l,i)}return s&&e.array[u]===o?e:(E(a),i=Lt(e,t),void 0===o&&u===i.array.length-1?i.array.pop():i.array[u]=o,i)}function Lt(e,t){return t&&e&&t===e.ownerID?e:new Ct(e?e.array.slice():[],t)}function Bt(e,t){if(t>=qt(e._capacity))return e._tail;if(t<1<0;)n=n.array[t>>>r&y],r-=v;return n}}function Ft(e,t,n){void 0!==t&&(t|=0),void 0!==n&&(n|=0);var r=e.__ownerID||new S,o=e._origin,a=e._capacity,i=o+t,u=void 0===n?a:n<0?a+n:o+n;if(i===o&&u===a)return e;if(i>=u)return e.clear();for(var s=e._level,c=e._root,l=0;i+l<0;)c=new Ct(c&&c.array.length?[void 0,c]:[],r),l+=1<<(s+=v);l&&(i+=l,o+=l,u+=l,a+=l);for(var f=qt(a),p=qt(u);p>=1<f?new Ct([],r):h;if(h&&p>f&&iv;g-=v){var b=f>>>g&y;m=m.array[b]=Lt(m.array[b],r)}m.array[f>>>v&y]=h}if(u=p)i-=p,u-=p,s=v,c=null,d=d&&d.removeBefore(r,0,i);else if(i>o||p>>s&y;if(w!==p>>>s&y)break;w&&(l+=(1<o&&(c=c.removeBefore(r,s,i-l)),c&&pa&&(a=c.size),i(s)||(c=c.map((function(e){return he(e)}))),r.push(c)}return a>e.size&&(e=e.setSize(a)),mt(e,t,r)}function qt(e){return e>>v<=g&&i.size>=2*a.size?(r=(o=i.filter((function(e,t){return void 0!==e&&u!==t}))).toKeyedSeq().map((function(e){return e[0]})).flip().toMap(),e.__ownerID&&(r.__ownerID=o.__ownerID=e.__ownerID)):(r=a.remove(t),o=u===i.size-1?i.pop():i.set(u,void 0))}else if(s){if(n===i.get(u)[1])return e;r=a,o=i.set(u,[t,n])}else r=a.set(t,i.size),o=i.set(i.size,[t,n]);return e.__ownerID?(e.size=r.size,e._map=r,e._list=o,e.__hash=void 0,e):Wt(r,o)}function Jt(e,t){this._iter=e,this._useKeys=t,this.size=e.size}function Kt(e){this._iter=e,this.size=e.size}function Yt(e){this._iter=e,this.size=e.size}function Gt(e){this._iter=e,this.size=e.size}function Qt(e){var t=bn(e);return t._iter=e,t.size=e.size,t.flip=function(){return e},t.reverse=function(){var t=e.reverse.apply(this);return t.flip=function(){return e.reverse()},t},t.has=function(t){return e.includes(t)},t.includes=function(t){return e.has(t)},t.cacheResult=wn,t.__iterateUncached=function(t,n){var r=this;return e.__iterate((function(e,n){return!1!==t(n,e,r)}),n)},t.__iteratorUncached=function(t,n){if(t===R){var r=e.__iterator(t,n);return new F((function(){var e=r.next();if(!e.done){var t=e.value[0];e.value[0]=e.value[1],e.value[1]=t}return e}))}return e.__iterator(t===M?P:M,n)},t}function Zt(e,t,n){var r=bn(e);return r.size=e.size,r.has=function(t){return e.has(t)},r.get=function(r,o){var a=e.get(r,b);return a===b?o:t.call(n,a,r,e)},r.__iterateUncached=function(r,o){var a=this;return e.__iterate((function(e,o,i){return!1!==r(t.call(n,e,o,i),o,a)}),o)},r.__iteratorUncached=function(r,o){var a=e.__iterator(R,o);return new F((function(){var o=a.next();if(o.done)return o;var i=o.value,u=i[0];return z(r,u,t.call(n,i[1],u,e),o)}))},r}function Xt(e,t){var n=bn(e);return n._iter=e,n.size=e.size,n.reverse=function(){return e},e.flip&&(n.flip=function(){var t=Qt(e);return t.reverse=function(){return e.flip()},t}),n.get=function(n,r){return e.get(t?n:-1-n,r)},n.has=function(n){return e.has(t?n:-1-n)},n.includes=function(t){return e.includes(t)},n.cacheResult=wn,n.__iterate=function(t,n){var r=this;return e.__iterate((function(e,n){return t(e,n,r)}),!n)},n.__iterator=function(t,n){return e.__iterator(t,!n)},n}function en(e,t,n,r){var o=bn(e);return r&&(o.has=function(r){var o=e.get(r,b);return o!==b&&!!t.call(n,o,r,e)},o.get=function(r,o){var a=e.get(r,b);return a!==b&&t.call(n,a,r,e)?a:o}),o.__iterateUncached=function(o,a){var i=this,u=0;return e.__iterate((function(e,a,s){if(t.call(n,e,a,s))return u++,o(e,r?a:u-1,i)}),a),u},o.__iteratorUncached=function(o,a){var i=e.__iterator(R,a),u=0;return new F((function(){for(;;){var a=i.next();if(a.done)return a;var s=a.value,c=s[0],l=s[1];if(t.call(n,l,c,e))return z(o,r?c:u++,l,a)}}))},o}function tn(e,t,n){var r=We().asMutable();return e.__iterate((function(o,a){r.update(t.call(n,o,a,e),0,(function(e){return e+1}))})),r.asImmutable()}function nn(e,t,n){var r=u(e),o=(l(e)?Ut():We()).asMutable();e.__iterate((function(a,i){o.update(t.call(n,a,i,e),(function(e){return(e=e||[]).push(r?[i,a]:a),e}))}));var a=yn(e);return o.map((function(t){return mn(e,a(t))}))}function rn(e,t,n,r){var o=e.size;if(void 0!==t&&(t|=0),void 0!==n&&(n===1/0?n=o:n|=0),j(t,n,o))return e;var a=T(t,o),i=I(n,o);if(a!=a||i!=i)return rn(e.toSeq().cacheResult(),t,n,r);var u,s=i-a;s==s&&(u=s<0?0:s);var c=bn(e);return c.size=0===u?u:e.size&&u||void 0,!r&&ae(e)&&u>=0&&(c.get=function(t,n){return(t=O(this,t))>=0&&tu)return q();var e=o.next();return r||t===M?e:z(t,s-1,t===P?void 0:e.value[1],e)}))},c}function on(e,t,n){var r=bn(e);return r.__iterateUncached=function(r,o){var a=this;if(o)return this.cacheResult().__iterate(r,o);var i=0;return e.__iterate((function(e,o,u){return t.call(n,e,o,u)&&++i&&r(e,o,a)})),i},r.__iteratorUncached=function(r,o){var a=this;if(o)return this.cacheResult().__iterator(r,o);var i=e.__iterator(R,o),u=!0;return new F((function(){if(!u)return q();var e=i.next();if(e.done)return e;var o=e.value,s=o[0],c=o[1];return t.call(n,c,s,a)?r===R?e:z(r,s,c,e):(u=!1,q())}))},r}function an(e,t,n,r){var o=bn(e);return o.__iterateUncached=function(o,a){var i=this;if(a)return this.cacheResult().__iterate(o,a);var u=!0,s=0;return e.__iterate((function(e,a,c){if(!u||!(u=t.call(n,e,a,c)))return s++,o(e,r?a:s-1,i)})),s},o.__iteratorUncached=function(o,a){var i=this;if(a)return this.cacheResult().__iterator(o,a);var u=e.__iterator(R,a),s=!0,c=0;return new F((function(){var e,a,l;do{if((e=u.next()).done)return r||o===M?e:z(o,c++,o===P?void 0:e.value[1],e);var f=e.value;a=f[0],l=f[1],s&&(s=t.call(n,l,a,i))}while(s);return o===R?e:z(o,a,l,e)}))},o}function un(e,t){var n=u(e),o=[e].concat(t).map((function(e){return i(e)?n&&(e=r(e)):e=n?ue(e):se(Array.isArray(e)?e:[e]),e})).filter((function(e){return 0!==e.size}));if(0===o.length)return e;if(1===o.length){var a=o[0];if(a===e||n&&u(a)||s(e)&&s(a))return a}var c=new te(o);return n?c=c.toKeyedSeq():s(e)||(c=c.toSetSeq()),(c=c.flatten(!0)).size=o.reduce((function(e,t){if(void 0!==e){var n=t.size;if(void 0!==n)return e+n}}),0),c}function sn(e,t,n){var r=bn(e);return r.__iterateUncached=function(r,o){var a=0,u=!1;function s(e,c){var l=this;e.__iterate((function(e,o){return(!t||c0}function dn(e,t,r){var o=bn(e);return o.size=new te(r).map((function(e){return e.size})).min(),o.__iterate=function(e,t){for(var n,r=this.__iterator(M,t),o=0;!(n=r.next()).done&&!1!==e(n.value,o++,this););return o},o.__iteratorUncached=function(e,o){var a=r.map((function(e){return e=n(e),W(o?e.reverse():e)})),i=0,u=!1;return new F((function(){var n;return u||(n=a.map((function(e){return e.next()})),u=n.some((function(e){return e.done}))),u?q():z(e,i++,t.apply(null,n.map((function(e){return e.value}))))}))},o}function mn(e,t){return ae(e)?t:e.constructor(t)}function vn(e){if(e!==Object(e))throw new TypeError("Expected [K, V] tuple: "+e)}function gn(e){return Ve(e.size),A(e)}function yn(e){return u(e)?r:s(e)?o:a}function bn(e){return Object.create((u(e)?K:s(e)?Y:G).prototype)}function wn(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):J.prototype.cacheResult.call(this)}function xn(e,t){return e>t?1:e=0;n--)t={value:arguments[n],next:t};return this.__ownerID?(this.size=e,this._head=t,this.__hash=void 0,this.__altered=!0,this):Kn(e,t)},Vn.prototype.pushAll=function(e){if(0===(e=o(e)).size)return this;Ve(e.size);var t=this.size,n=this._head;return e.reverse().forEach((function(e){t++,n={value:e,next:n}})),this.__ownerID?(this.size=t,this._head=n,this.__hash=void 0,this.__altered=!0,this):Kn(t,n)},Vn.prototype.pop=function(){return this.slice(1)},Vn.prototype.unshift=function(){return this.push.apply(this,arguments)},Vn.prototype.unshiftAll=function(e){return this.pushAll(e)},Vn.prototype.shift=function(){return this.pop.apply(this,arguments)},Vn.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Yn()},Vn.prototype.slice=function(e,t){if(j(e,t,this.size))return this;var n=T(e,this.size);if(I(t,this.size)!==this.size)return Se.prototype.slice.call(this,e,t);for(var r=this.size-n,o=this._head;n--;)o=o.next;return this.__ownerID?(this.size=r,this._head=o,this.__hash=void 0,this.__altered=!0,this):Kn(r,o)},Vn.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Kn(this.size,this._head,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},Vn.prototype.__iterate=function(e,t){if(t)return this.reverse().__iterate(e);for(var n=0,r=this._head;r&&!1!==e(r.value,n++,this);)r=r.next;return n},Vn.prototype.__iterator=function(e,t){if(t)return this.reverse().__iterator(e);var n=0,r=this._head;return new F((function(){if(r){var t=r.value;return r=r.next,z(e,n++,t)}return q()}))},Vn.isStack=Wn;var Hn,$n="@@__IMMUTABLE_STACK__@@",Jn=Vn.prototype;function Kn(e,t,n,r){var o=Object.create(Jn);return o.size=e,o._head=t,o.__ownerID=n,o.__hash=r,o.__altered=!1,o}function Yn(){return Hn||(Hn=Kn(0))}function Gn(e,t){var n=function(n){e.prototype[n]=t[n]};return Object.keys(t).forEach(n),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach(n),e}Jn[$n]=!0,Jn.withMutations=Ke.withMutations,Jn.asMutable=Ke.asMutable,Jn.asImmutable=Ke.asImmutable,Jn.wasAltered=Ke.wasAltered,n.Iterator=F,Gn(n,{toArray:function(){Ve(this.size);var e=new Array(this.size||0);return this.valueSeq().__iterate((function(t,n){e[n]=t})),e},toIndexedSeq:function(){return new Kt(this)},toJS:function(){return this.toSeq().map((function(e){return e&&"function"==typeof e.toJS?e.toJS():e})).__toJS()},toJSON:function(){return this.toSeq().map((function(e){return e&&"function"==typeof e.toJSON?e.toJSON():e})).__toJS()},toKeyedSeq:function(){return new Jt(this,!0)},toMap:function(){return We(this.toKeyedSeq())},toObject:function(){Ve(this.size);var e={};return this.__iterate((function(t,n){e[n]=t})),e},toOrderedMap:function(){return Ut(this.toKeyedSeq())},toOrderedSet:function(){return Ln(u(this)?this.valueSeq():this)},toSet:function(){return jn(u(this)?this.valueSeq():this)},toSetSeq:function(){return new Yt(this)},toSeq:function(){return s(this)?this.toIndexedSeq():u(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Vn(u(this)?this.valueSeq():this)},toList:function(){return St(u(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(e,t){return 0===this.size?e+t:e+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+t},concat:function(){return mn(this,un(this,e.call(arguments,0)))},includes:function(e){return this.some((function(t){return ge(t,e)}))},entries:function(){return this.__iterator(R)},every:function(e,t){Ve(this.size);var n=!0;return this.__iterate((function(r,o,a){if(!e.call(t,r,o,a))return n=!1,!1})),n},filter:function(e,t){return mn(this,en(this,e,t,!0))},find:function(e,t,n){var r=this.findEntry(e,t);return r?r[1]:n},forEach:function(e,t){return Ve(this.size),this.__iterate(t?e.bind(t):e)},join:function(e){Ve(this.size),e=void 0!==e?""+e:",";var t="",n=!0;return this.__iterate((function(r){n?n=!1:t+=e,t+=null!=r?r.toString():""})),t},keys:function(){return this.__iterator(P)},map:function(e,t){return mn(this,Zt(this,e,t))},reduce:function(e,t,n){var r,o;return Ve(this.size),arguments.length<2?o=!0:r=t,this.__iterate((function(t,a,i){o?(o=!1,r=t):r=e.call(n,r,t,a,i)})),r},reduceRight:function(e,t,n){var r=this.toKeyedSeq().reverse();return r.reduce.apply(r,arguments)},reverse:function(){return mn(this,Xt(this,!0))},slice:function(e,t){return mn(this,rn(this,e,t,!0))},some:function(e,t){return!this.every(tr(e),t)},sort:function(e){return mn(this,fn(this,e))},values:function(){return this.__iterator(M)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some((function(){return!0}))},count:function(e,t){return A(e?this.toSeq().filter(e,t):this)},countBy:function(e,t){return tn(this,e,t)},equals:function(e){return ye(this,e)},entrySeq:function(){var e=this;if(e._cache)return new te(e._cache);var t=e.toSeq().map(er).toIndexedSeq();return t.fromEntrySeq=function(){return e.toSeq()},t},filterNot:function(e,t){return this.filter(tr(e),t)},findEntry:function(e,t,n){var r=n;return this.__iterate((function(n,o,a){if(e.call(t,n,o,a))return r=[o,n],!1})),r},findKey:function(e,t){var n=this.findEntry(e,t);return n&&n[0]},findLast:function(e,t,n){return this.toKeyedSeq().reverse().find(e,t,n)},findLastEntry:function(e,t,n){return this.toKeyedSeq().reverse().findEntry(e,t,n)},findLastKey:function(e,t){return this.toKeyedSeq().reverse().findKey(e,t)},first:function(){return this.find(C)},flatMap:function(e,t){return mn(this,cn(this,e,t))},flatten:function(e){return mn(this,sn(this,e,!0))},fromEntrySeq:function(){return new Gt(this)},get:function(e,t){return this.find((function(t,n){return ge(n,e)}),void 0,t)},getIn:function(e,t){for(var n,r=this,o=_n(e);!(n=o.next()).done;){var a=n.value;if((r=r&&r.get?r.get(a,b):b)===b)return t}return r},groupBy:function(e,t){return nn(this,e,t)},has:function(e){return this.get(e,b)!==b},hasIn:function(e){return this.getIn(e,b)!==b},isSubset:function(e){return e="function"==typeof e.includes?e:n(e),this.every((function(t){return e.includes(t)}))},isSuperset:function(e){return(e="function"==typeof e.isSubset?e:n(e)).isSubset(this)},keyOf:function(e){return this.findKey((function(t){return ge(t,e)}))},keySeq:function(){return this.toSeq().map(Xn).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},lastKeyOf:function(e){return this.toKeyedSeq().reverse().keyOf(e)},max:function(e){return pn(this,e)},maxBy:function(e,t){return pn(this,t,e)},min:function(e){return pn(this,e?nr(e):ar)},minBy:function(e,t){return pn(this,t?nr(t):ar,e)},rest:function(){return this.slice(1)},skip:function(e){return this.slice(Math.max(0,e))},skipLast:function(e){return mn(this,this.toSeq().reverse().skip(e).reverse())},skipWhile:function(e,t){return mn(this,an(this,e,t,!0))},skipUntil:function(e,t){return this.skipWhile(tr(e),t)},sortBy:function(e,t){return mn(this,fn(this,t,e))},take:function(e){return this.slice(0,Math.max(0,e))},takeLast:function(e){return mn(this,this.toSeq().reverse().take(e).reverse())},takeWhile:function(e,t){return mn(this,on(this,e,t))},takeUntil:function(e,t){return this.takeWhile(tr(e),t)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=ir(this))}});var Qn=n.prototype;Qn[f]=!0,Qn[B]=Qn.values,Qn.__toJS=Qn.toArray,Qn.__toStringMapper=rr,Qn.inspect=Qn.toSource=function(){return this.toString()},Qn.chain=Qn.flatMap,Qn.contains=Qn.includes,Gn(r,{flip:function(){return mn(this,Qt(this))},mapEntries:function(e,t){var n=this,r=0;return mn(this,this.toSeq().map((function(o,a){return e.call(t,[a,o],r++,n)})).fromEntrySeq())},mapKeys:function(e,t){var n=this;return mn(this,this.toSeq().flip().map((function(r,o){return e.call(t,r,o,n)})).flip())}});var Zn=r.prototype;function Xn(e,t){return t}function er(e,t){return[t,e]}function tr(e){return function(){return!e.apply(this,arguments)}}function nr(e){return function(){return-e.apply(this,arguments)}}function rr(e){return"string"==typeof e?JSON.stringify(e):String(e)}function or(){return k(arguments)}function ar(e,t){return et?-1:0}function ir(e){if(e.size===1/0)return 0;var t=l(e),n=u(e),r=t?1:0;return ur(e.__iterate(n?t?function(e,t){r=31*r+sr(Ce(e),Ce(t))|0}:function(e,t){r=r+sr(Ce(e),Ce(t))|0}:t?function(e){r=31*r+Ce(e)|0}:function(e){r=r+Ce(e)|0}),r)}function ur(e,t){return t=Ae(t,3432918353),t=Ae(t<<15|t>>>-15,461845907),t=Ae(t<<13|t>>>-13,5),t=Ae((t=(t+3864292196|0)^e)^t>>>16,2246822507),t=Oe((t=Ae(t^t>>>13,3266489909))^t>>>16)}function sr(e,t){return e^t+2654435769+(e<<6)+(e>>2)|0}return Zn[p]=!0,Zn[B]=Qn.entries,Zn.__toJS=Qn.toObject,Zn.__toStringMapper=function(e,t){return JSON.stringify(t)+": "+rr(e)},Gn(o,{toKeyedSeq:function(){return new Jt(this,!1)},filter:function(e,t){return mn(this,en(this,e,t,!1))},findIndex:function(e,t){var n=this.findEntry(e,t);return n?n[0]:-1},indexOf:function(e){var t=this.keyOf(e);return void 0===t?-1:t},lastIndexOf:function(e){var t=this.lastKeyOf(e);return void 0===t?-1:t},reverse:function(){return mn(this,Xt(this,!1))},slice:function(e,t){return mn(this,rn(this,e,t,!1))},splice:function(e,t){var n=arguments.length;if(t=Math.max(0|t,0),0===n||2===n&&!t)return this;e=T(e,e<0?this.count():this.size);var r=this.slice(0,e);return mn(this,1===n?r:r.concat(k(arguments,2),this.slice(e+t)))},findLastIndex:function(e,t){var n=this.findLastEntry(e,t);return n?n[0]:-1},first:function(){return this.get(0)},flatten:function(e){return mn(this,sn(this,e,!1))},get:function(e,t){return(e=O(this,e))<0||this.size===1/0||void 0!==this.size&&e>this.size?t:this.find((function(t,n){return n===e}),void 0,t)},has:function(e){return(e=O(this,e))>=0&&(void 0!==this.size?this.size===1/0||e1)try{return decodeURIComponent(t[1])}catch(e){console.error(e)}return null}function Ne(e){return t=e.replace(/\.[^./]*$/,""),Y()(J()(t));var t}function Pe(e,t,n,r,a){if(!t)return[];var u=[],s=t.get("nullable"),c=t.get("required"),f=t.get("maximum"),h=t.get("minimum"),d=t.get("type"),m=t.get("format"),g=t.get("maxLength"),b=t.get("minLength"),x=t.get("uniqueItems"),_=t.get("maxItems"),E=t.get("minItems"),S=t.get("pattern"),k=n||!0===c,A=null!=e;if(s&&null===e||!d||!(k||A&&"array"===d||!(!k&&!A)))return[];var O="string"===d&&e,C="array"===d&&l()(e)&&e.length,j="array"===d&&W.a.List.isList(e)&&e.count(),T=[O,C,j,"array"===d&&"string"==typeof e&&e,"file"===d&&e instanceof ue.a.File,"boolean"===d&&(e||!1===e),"number"===d&&(e||0===e),"integer"===d&&(e||0===e),"object"===d&&"object"===i()(e)&&null!==e,"object"===d&&"string"==typeof e&&e],I=N()(T).call(T,(function(e){return!!e}));if(k&&!I&&!r)return u.push("Required field is not provided"),u;if("object"===d&&(null===a||"application/json"===a)){var P,M=e;if("string"==typeof e)try{M=JSON.parse(e)}catch(e){return u.push("Parameter string value must be valid JSON"),u}if(t&&t.has("required")&&Ee(c.isList)&&c.isList()&&y()(c).call(c,(function(e){void 0===M[e]&&u.push({propKey:e,error:"Required property not found"})})),t&&t.has("properties"))y()(P=t.get("properties")).call(P,(function(e,t){var n=Pe(M[t],e,!1,r,a);u.push.apply(u,o()(p()(n).call(n,(function(e){return{propKey:t,error:e}}))))}))}if(S){var R=function(e,t){if(!new RegExp(t).test(e))return"Value must follow pattern "+t}(e,S);R&&u.push(R)}if(E&&"array"===d){var D=function(e,t){var n;if(!e&&t>=1||e&&e.lengtht)return v()(n="Array must not contain more then ".concat(t," item")).call(n,1===t?"":"s")}(e,_);L&&u.push({needRemove:!0,error:L})}if(x&&"array"===d){var B=function(e,t){if(e&&("true"===t||!0===t)){var n=Object(V.fromJS)(e),r=n.toSet();if(e.length>r.size){var o=Object(V.Set)();if(y()(n).call(n,(function(e,t){w()(n).call(n,(function(t){return Ee(t.equals)?t.equals(e):t===e})).size>1&&(o=o.add(t))})),0!==o.size)return p()(o).call(o,(function(e){return{index:e,error:"No duplicates allowed."}})).toArray()}}}(e,x);B&&u.push.apply(u,o()(B))}if(g||0===g){var F=function(e,t){var n;if(e.length>t)return v()(n="Value must be no longer than ".concat(t," character")).call(n,1!==t?"s":"")}(e,g);F&&u.push(F)}if(b){var z=function(e,t){var n;if(e.lengtht)return"Value must be less than ".concat(t)}(e,f);q&&u.push(q)}if(h||0===h){var U=function(e,t){if(e2&&void 0!==arguments[2]?arguments[2]:{},r=n.isOAS3,o=void 0!==r&&r,a=n.bypassRequiredCheck,i=void 0!==a&&a,u=e.get("required"),s=Object(le.a)(e,{isOAS3:o}),c=s.schema,l=s.parameterContentMediaType;return Pe(t,c,u,i,l)},Re=function(e,t,n){if(e&&(!e.xml||!e.xml.name)){if(e.xml=e.xml||{},!e.$$ref)return e.type||e.items||e.properties||e.additionalProperties?'\n\x3c!-- XML example cannot be generated; root element name is undefined --\x3e':null;var r=e.$$ref.match(/\S*\/(\S+)$/);e.xml.name=r[1]}return Object(ie.memoizedCreateXMLExample)(e,t,n)},De=[{when:/json/,shouldStringifyTypes:["string"]}],Le=["object"],Be=function(e,t,n,r){var a=Object(ie.memoizedSampleFromSchema)(e,t,r),u=i()(a),s=S()(De).call(De,(function(e,t){var r;return t.when.test(n)?v()(r=[]).call(r,o()(e),o()(t.shouldStringifyTypes)):e}),Le);return te()(s,(function(e){return e===u}))?M()(a,null,2):a},Fe=function(e,t,n,r){var o,a=Be(e,t,n,r);try{"\n"===(o=me.a.dump(me.a.load(a),{lineWidth:-1}))[o.length-1]&&(o=T()(o).call(o,0,o.length-1))}catch(e){return console.error(e),"error: could not generate yaml example"}return o.replace(/\t/g," ")},ze=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;return e&&Ee(e.toJS)&&(e=e.toJS()),r&&Ee(r.toJS)&&(r=r.toJS()),/xml/.test(t)?Re(e,n,r):/(yaml|yml)/.test(t)?Fe(e,n,t,r):Be(e,n,t,r)},qe=function(){var e={},t=ue.a.location.search;if(!t)return{};if(""!=t){var n=t.substr(1).split("&");for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(r=n[r].split("="),e[decodeURIComponent(r[0])]=r[1]&&decodeURIComponent(r[1])||"")}return e},Ue=function(t){return(t instanceof e?t:e.from(t.toString(),"utf-8")).toString("base64")},Ve={operationsSorter:{alpha:function(e,t){return e.get("path").localeCompare(t.get("path"))},method:function(e,t){return e.get("method").localeCompare(t.get("method"))}},tagsSorter:{alpha:function(e,t){return e.localeCompare(t)}}},We=function(e){var t=[];for(var n in e){var r=e[n];void 0!==r&&""!==r&&t.push([n,"=",encodeURIComponent(r).replace(/%20/g,"+")].join(""))}return t.join("&")},He=function(e,t,n){return!!X()(n,(function(n){return re()(e[n],t[n])}))};function $e(e){return"string"!=typeof e||""===e?"":Object(H.sanitizeUrl)(e)}function Je(e){return!(!e||D()(e).call(e,"localhost")>=0||D()(e).call(e,"127.0.0.1")>=0||"none"===e)}function Ke(e){if(!W.a.OrderedMap.isOrderedMap(e))return null;if(!e.size)return null;var t=B()(e).call(e,(function(e,t){return z()(t).call(t,"2")&&_()(e.get("content")||{}).length>0})),n=e.get("default")||W.a.OrderedMap(),r=(n.get("content")||W.a.OrderedMap()).keySeq().toJS().length?n:null;return t||r}var Ye=function(e){return"string"==typeof e||e instanceof String?U()(e).call(e).replace(/\s/g,"%20"):""},Ge=function(e){return ce()(Ye(e).replace(/%20/g,"_"))},Qe=function(e){return w()(e).call(e,(function(e,t){return/^x-/.test(t)}))},Ze=function(e){return w()(e).call(e,(function(e,t){return/^pattern|maxLength|minLength|maximum|minimum/.test(t)}))};function Xe(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){return!0};if("object"!==i()(e)||l()(e)||null===e||!t)return e;var o=A()({},e);return y()(n=_()(o)).call(n,(function(e){e===t&&r(o[e],e)?delete o[e]:o[e]=Xe(o[e],t,r)})),o}function et(e){if("string"==typeof e)return e;if(e&&e.toJS&&(e=e.toJS()),"object"===i()(e)&&null!==e)try{return M()(e,null,2)}catch(t){return String(e)}return null==e?"":e.toString()}function tt(e){return"number"==typeof e?e.toString():e}function nt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.returnAll,r=void 0!==n&&n,o=t.allowHashes,a=void 0===o||o;if(!W.a.Map.isMap(e))throw new Error("paramToIdentifier: received a non-Im.Map parameter as input");var i,u,s,c=e.get("name"),l=e.get("in"),f=[];e&&e.hashCode&&l&&c&&a&&f.push(v()(i=v()(u="".concat(l,".")).call(u,c,".hash-")).call(i,e.hashCode()));l&&c&&f.push(v()(s="".concat(l,".")).call(s,c));return f.push(c),r?f:f[0]||""}function rt(e,t){var n,r=nt(e,{returnAll:!0});return w()(n=p()(r).call(r,(function(e){return t[e]}))).call(n,(function(e){return void 0!==e}))[0]}function ot(){return it(pe()(32).toString("base64"))}function at(e){return it(de()("sha256").update(e).digest("base64"))}function it(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}var ut=function(e){return!e||!(!ge(e)||!e.isEmpty())}}).call(this,n(125).Buffer)},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(215);function o(e,t){for(var n=0;n1?t-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:r,n=null,a=null;return function(){return o(t,n,arguments)||(a=e.apply(null,arguments)),n=arguments,a}}))},function(e,t,n){e.exports=n(621)},function(e,t,n){var r=n(159),o=n(494);function a(t){return"function"==typeof r&&"symbol"==typeof o?(e.exports=a=function(e){return typeof e},e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=a=function(e){return e&&"function"==typeof r&&e.constructor===r&&e!==r.prototype?"symbol":typeof e},e.exports.default=e.exports,e.exports.__esModule=!0),a(t)}e.exports=a,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){e.exports=n(519)},function(e,t,n){e.exports=n(517)},function(e,t,n){"use strict";var r=n(38),o=n(120).f,a=n(318),i=n(31),u=n(103),s=n(70),c=n(51),l=function(e){var t=function(t,n,r){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,r)}return e.apply(this,arguments)};return t.prototype=e.prototype,t};e.exports=function(e,t){var n,f,p,h,d,m,v,g,y=e.target,b=e.global,w=e.stat,x=e.proto,_=b?r:w?r[y]:(r[y]||{}).prototype,E=b?i:i[y]||(i[y]={}),S=E.prototype;for(p in t)n=!a(b?p:y+(w?".":"#")+p,e.forced)&&_&&c(_,p),d=E[p],n&&(m=e.noTargetGet?(g=o(_,p))&&g.value:_[p]),h=n&&m?m:t[p],n&&typeof d==typeof h||(v=e.bind&&n?u(h,r):e.wrap&&n?l(h):x&&"function"==typeof h?u(Function.call,h):h,(e.sham||h&&h.sham||d&&d.sham)&&s(v,"sham",!0),E[p]=v,x&&(c(i,f=y+"Prototype")||s(i,f,{}),i[f][p]=h,e.real&&S&&!S[p]&&s(S,p,h)))}},function(e,t,n){e.exports=n(367)},function(e,t,n){e.exports=n(522)},function(e,t,n){var r=n(405),o=n(406),a=n(776),i=n(778),u=n(782),s=n(784),c=n(789),l=n(215),f=n(3);function p(e,t){var n=r(e);if(o){var u=o(e);t&&(u=a(u).call(u,(function(t){return i(e,t).enumerable}))),n.push.apply(n,u)}return n}e.exports=function(e){for(var t=1;t>",i=function(){invariant(!1,"ImmutablePropTypes type checking code is stripped in production.")};i.isRequired=i;var u=function(){return i};function s(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":e instanceof o.Iterable?"Immutable."+e.toSource().split(" ")[0]:t}function c(e){function t(t,n,r,o,i,u){for(var s=arguments.length,c=Array(s>6?s-6:0),l=6;l4)}function l(e){var t=e.get("swagger");return"string"==typeof t&&i()(t).call(t,"2.0")}function f(e){return function(t,n){return function(r){return n&&n.specSelectors&&n.specSelectors.specJson?c(n.specSelectors.specJson())?s.a.createElement(e,o()({},r,n,{Ori:t})):s.a.createElement(t,r):(console.warn("OAS3 wrapper: couldn't get spec"),null)}}}},function(e,t,n){e.exports=n(513)},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){var r=n(38),o=n(202),a=n(51),i=n(164),u=n(201),s=n(316),c=o("wks"),l=r.Symbol,f=s?l:l&&l.withoutSetter||i;e.exports=function(e){return a(c,e)&&(u||"string"==typeof c[e])||(u&&a(l,e)?c[e]=l[e]:c[e]=f("Symbol."+e)),c[e]}},function(e,t,n){var r=n(230);e.exports=function(e,t,n){var o=null==e?void 0:r(e,t);return void 0===o?n:o}},function(e,t,n){e.exports=n(807)},function(e,t,n){(function(t){var n=function(e){return e&&e.Math==Math&&e};e.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof t&&t)||function(){return this}()||Function("return this")()}).call(this,n(53))},function(e,t,n){var r=n(31);e.exports=function(e){return r[e+"Prototype"]}},function(e,t,n){var r=n(31),o=n(51),a=n(211),i=n(62).f;e.exports=function(e){var t=r.Symbol||(r.Symbol={});o(t,e)||i(t,e,{value:a.f(e)})}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){"use strict";n.r(t),n.d(t,"UPDATE_SPEC",(function(){return ee})),n.d(t,"UPDATE_URL",(function(){return te})),n.d(t,"UPDATE_JSON",(function(){return ne})),n.d(t,"UPDATE_PARAM",(function(){return re})),n.d(t,"UPDATE_EMPTY_PARAM_INCLUSION",(function(){return oe})),n.d(t,"VALIDATE_PARAMS",(function(){return ae})),n.d(t,"SET_RESPONSE",(function(){return ie})),n.d(t,"SET_REQUEST",(function(){return ue})),n.d(t,"SET_MUTATED_REQUEST",(function(){return se})),n.d(t,"LOG_REQUEST",(function(){return ce})),n.d(t,"CLEAR_RESPONSE",(function(){return le})),n.d(t,"CLEAR_REQUEST",(function(){return fe})),n.d(t,"CLEAR_VALIDATE_PARAMS",(function(){return pe})),n.d(t,"UPDATE_OPERATION_META_VALUE",(function(){return he})),n.d(t,"UPDATE_RESOLVED",(function(){return de})),n.d(t,"UPDATE_RESOLVED_SUBTREE",(function(){return me})),n.d(t,"SET_SCHEME",(function(){return ve})),n.d(t,"updateSpec",(function(){return ge})),n.d(t,"updateResolved",(function(){return ye})),n.d(t,"updateUrl",(function(){return be})),n.d(t,"updateJsonSpec",(function(){return we})),n.d(t,"parseToJson",(function(){return xe})),n.d(t,"resolveSpec",(function(){return Ee})),n.d(t,"requestResolvedSubtree",(function(){return Ae})),n.d(t,"changeParam",(function(){return Oe})),n.d(t,"changeParamByIdentity",(function(){return Ce})),n.d(t,"updateResolvedSubtree",(function(){return je})),n.d(t,"invalidateResolvedSubtreeCache",(function(){return Te})),n.d(t,"validateParams",(function(){return Ie})),n.d(t,"updateEmptyParamInclusion",(function(){return Ne})),n.d(t,"clearValidateParams",(function(){return Pe})),n.d(t,"changeConsumesValue",(function(){return Me})),n.d(t,"changeProducesValue",(function(){return Re})),n.d(t,"setResponse",(function(){return De})),n.d(t,"setRequest",(function(){return Le})),n.d(t,"setMutatedRequest",(function(){return Be})),n.d(t,"logRequest",(function(){return Fe})),n.d(t,"executeRequest",(function(){return ze})),n.d(t,"execute",(function(){return qe})),n.d(t,"clearResponse",(function(){return Ue})),n.d(t,"clearRequest",(function(){return Ve})),n.d(t,"setScheme",(function(){return We}));var r=n(24),o=n.n(r),a=n(49),i=n.n(a),u=n(68),s=n.n(u),c=n(18),l=n.n(c),f=n(37),p=n.n(f),h=n(23),d=n.n(h),m=n(4),v=n.n(m),g=n(306),y=n.n(g),b=n(28),w=n.n(b),x=n(189),_=n.n(x),E=n(60),S=n.n(E),k=n(12),A=n.n(k),O=n(190),C=n.n(O),j=n(17),T=n.n(j),I=n(22),N=n.n(I),P=n(2),M=n.n(P),R=n(15),D=n.n(R),L=n(20),B=n.n(L),F=n(307),z=n.n(F),q=n(66),U=n(1),V=n(82),W=n.n(V),H=n(134),$=n(439),J=n.n($),K=n(440),Y=n.n(K),G=n(308),Q=n.n(G),Z=n(5),X=["path","method"],ee="spec_update_spec",te="spec_update_url",ne="spec_update_json",re="spec_update_param",oe="spec_update_empty_param_inclusion",ae="spec_validate_param",ie="spec_set_response",ue="spec_set_request",se="spec_set_mutated_request",ce="spec_log_request",le="spec_clear_response",fe="spec_clear_request",pe="spec_clear_validate_param",he="spec_update_operation_meta_value",de="spec_update_resolved",me="spec_update_resolved_subtree",ve="set_scheme";function ge(e){var t,n=(t=e,J()(t)?t:"").replace(/\t/g," ");if("string"==typeof e)return{type:ee,payload:n}}function ye(e){return{type:de,payload:e}}function be(e){return{type:te,payload:e}}function we(e){return{type:ne,payload:e}}var xe=function(e){return function(t){var n=t.specActions,r=t.specSelectors,o=t.errActions,a=r.specStr,i=null;try{e=e||a(),o.clear({source:"parser"}),i=q.a.load(e)}catch(e){return console.error(e),o.newSpecErr({source:"parser",level:"error",message:e.reason,line:e.mark&&e.mark.line?e.mark.line+1:void 0})}return i&&"object"===l()(i)?n.updateJsonSpec(i):{}}},_e=!1,Ee=function(e,t){return function(n){var r=n.specActions,o=n.specSelectors,a=n.errActions,i=n.fn,u=i.fetch,s=i.resolve,c=i.AST,l=void 0===c?{}:c,f=n.getConfigs;_e||(console.warn("specActions.resolveSpec is deprecated since v3.10.0 and will be removed in v4.0.0; use requestResolvedSubtree instead!"),_e=!0);var p=f(),h=p.modelPropertyMacro,m=p.parameterMacro,g=p.requestInterceptor,b=p.responseInterceptor;void 0===e&&(e=o.specJson()),void 0===t&&(t=o.url());var w=l.getLineNumberForPath?l.getLineNumberForPath:function(){},x=o.specStr();return s({fetch:u,spec:e,baseDoc:t,modelPropertyMacro:h,parameterMacro:m,requestInterceptor:g,responseInterceptor:b}).then((function(e){var t=e.spec,n=e.errors;if(a.clear({type:"thrown"}),d()(n)&&n.length>0){var o=v()(n).call(n,(function(e){return console.error(e),e.line=e.fullPath?w(x,e.fullPath):null,e.path=e.fullPath?e.fullPath.join("."):null,e.level="error",e.type="thrown",e.source="resolver",y()(e,"message",{enumerable:!0,value:e.message}),e}));a.newThrownErrBatch(o)}return r.updateResolved(t)}))}},Se=[],ke=Y()(s()(p.a.mark((function e(){var t,n,r,o,a,i,u,c,l,f,h,m,g,b,x,E,k,O;return p.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Se.system){e.next=4;break}return console.error("debResolveSubtrees: don't have a system to operate on, aborting."),e.abrupt("return");case 4:if(n=t.errActions,r=t.errSelectors,o=t.fn,a=o.resolveSubtree,i=o.fetch,u=o.AST,c=void 0===u?{}:u,l=t.specSelectors,f=t.specActions,a){e.next=8;break}return console.error("Error: Swagger-Client did not provide a `resolveSubtree` method, doing nothing."),e.abrupt("return");case 8:return h=c.getLineNumberForPath?c.getLineNumberForPath:function(){},m=l.specStr(),g=t.getConfigs(),b=g.modelPropertyMacro,x=g.parameterMacro,E=g.requestInterceptor,k=g.responseInterceptor,e.prev=11,e.next=14,w()(Se).call(Se,function(){var e=s()(p.a.mark((function e(t,o){var u,c,f,g,w,O,j,T,I;return p.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t;case 2:return u=e.sent,c=u.resultMap,f=u.specWithCurrentSubtrees,e.next=7,a(f,o,{baseDoc:l.url(),modelPropertyMacro:b,parameterMacro:x,requestInterceptor:E,responseInterceptor:k});case 7:if(g=e.sent,w=g.errors,O=g.spec,r.allErrors().size&&n.clearBy((function(e){var t;return"thrown"!==e.get("type")||"resolver"!==e.get("source")||!_()(t=e.get("fullPath")).call(t,(function(e,t){return e===o[t]||void 0===o[t]}))})),d()(w)&&w.length>0&&(j=v()(w).call(w,(function(e){return e.line=e.fullPath?h(m,e.fullPath):null,e.path=e.fullPath?e.fullPath.join("."):null,e.level="error",e.type="thrown",e.source="resolver",y()(e,"message",{enumerable:!0,value:e.message}),e})),n.newThrownErrBatch(j)),!O||!l.isOAS3()||"components"!==o[0]||"securitySchemes"!==o[1]){e.next=15;break}return e.next=15,S.a.all(v()(T=A()(I=C()(O)).call(I,(function(e){return"openIdConnect"===e.type}))).call(T,function(){var e=s()(p.a.mark((function e(t){var n,r;return p.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={url:t.openIdConnectUrl,requestInterceptor:E,responseInterceptor:k},e.prev=1,e.next=4,i(n);case 4:(r=e.sent)instanceof Error||r.status>=400?console.error(r.statusText+" "+n.url):t.openIdConnectData=JSON.parse(r.text),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),console.error(e.t0);case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t){return e.apply(this,arguments)}}()));case 15:return Q()(c,o,O),Q()(f,o,O),e.abrupt("return",{resultMap:c,specWithCurrentSubtrees:f});case 18:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),S.a.resolve({resultMap:(l.specResolvedSubtree([])||Object(U.Map)()).toJS(),specWithCurrentSubtrees:l.specJson().toJS()}));case 14:O=e.sent,delete Se.system,Se=[],e.next=22;break;case 19:e.prev=19,e.t0=e.catch(11),console.error(e.t0);case 22:f.updateResolvedSubtree([],O.resultMap);case 23:case"end":return e.stop()}}),e,null,[[11,19]])}))),35),Ae=function(e){return function(t){var n;T()(n=v()(Se).call(Se,(function(e){return e.join("@@")}))).call(n,e.join("@@"))>-1||(Se.push(e),Se.system=t,ke())}};function Oe(e,t,n,r,o){return{type:re,payload:{path:e,value:r,paramName:t,paramIn:n,isXml:o}}}function Ce(e,t,n,r){return{type:re,payload:{path:e,param:t,value:n,isXml:r}}}var je=function(e,t){return{type:me,payload:{path:e,value:t}}},Te=function(){return{type:me,payload:{path:[],value:Object(U.Map)()}}},Ie=function(e,t){return{type:ae,payload:{pathMethod:e,isOAS3:t}}},Ne=function(e,t,n,r){return{type:oe,payload:{pathMethod:e,paramName:t,paramIn:n,includeEmptyValue:r}}};function Pe(e){return{type:pe,payload:{pathMethod:e}}}function Me(e,t){return{type:he,payload:{path:e,value:t,key:"consumes_value"}}}function Re(e,t){return{type:he,payload:{path:e,value:t,key:"produces_value"}}}var De=function(e,t,n){return{payload:{path:e,method:t,res:n},type:ie}},Le=function(e,t,n){return{payload:{path:e,method:t,req:n},type:ue}},Be=function(e,t,n){return{payload:{path:e,method:t,req:n},type:se}},Fe=function(e){return{payload:e,type:ce}},ze=function(e){return function(t){var n,r,o=t.fn,a=t.specActions,i=t.specSelectors,u=t.getConfigs,c=t.oas3Selectors,l=e.pathName,f=e.method,h=e.operation,m=u(),g=m.requestInterceptor,y=m.responseInterceptor,b=h.toJS();h&&h.get("parameters")&&N()(n=A()(r=h.get("parameters")).call(r,(function(e){return e&&!0===e.get("allowEmptyValue")}))).call(n,(function(t){if(i.parameterInclusionSettingFor([l,f],t.get("name"),t.get("in"))){e.parameters=e.parameters||{};var n=Object(Z.B)(t,e.parameters);(!n||n&&0===n.size)&&(e.parameters[t.get("name")]="")}}));if(e.contextUrl=W()(i.url()).toString(),b&&b.operationId?e.operationId=b.operationId:b&&l&&f&&(e.operationId=o.opId(b,l,f)),i.isOAS3()){var w,x=M()(w="".concat(l,":")).call(w,f);e.server=c.selectedServer(x)||c.selectedServer();var _=c.serverVariables({server:e.server,namespace:x}).toJS(),E=c.serverVariables({server:e.server}).toJS();e.serverVariables=D()(_).length?_:E,e.requestContentType=c.requestContentType(l,f),e.responseContentType=c.responseContentType(l,f)||"*/*";var S,k=c.requestBodyValue(l,f),O=c.requestBodyInclusionSetting(l,f);if(k&&k.toJS)e.requestBody=A()(S=v()(k).call(k,(function(e){return U.Map.isMap(e)?e.get("value"):e}))).call(S,(function(e,t){return(d()(e)?0!==e.length:!Object(Z.q)(e))||O.get(t)})).toJS();else e.requestBody=k}var C=B()({},e);C=o.buildRequest(C),a.setRequest(e.pathName,e.method,C);var j=function(){var t=s()(p.a.mark((function t(n){var r,o;return p.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,g.apply(undefined,[n]);case 2:return r=t.sent,o=B()({},r),a.setMutatedRequest(e.pathName,e.method,o),t.abrupt("return",r);case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();e.requestInterceptor=j,e.responseInterceptor=y;var T=z()();return o.execute(e).then((function(t){t.duration=z()()-T,a.setResponse(e.pathName,e.method,t)})).catch((function(t){"Failed to fetch"===t.message&&(t.name="",t.message='**Failed to fetch.** \n**Possible Reasons:** \n - CORS \n - Network Failure \n - URL scheme must be "http" or "https" for CORS request.'),a.setResponse(e.pathName,e.method,{error:!0,err:Object(H.serializeError)(t)})}))}},qe=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.path,n=e.method,r=i()(e,X);return function(e){var a=e.fn.fetch,i=e.specSelectors,u=e.specActions,s=i.specJsonWithResolvedSubtrees().toJS(),c=i.operationScheme(t,n),l=i.contentTypeValues([t,n]).toJS(),f=l.requestContentType,p=l.responseContentType,h=/xml/i.test(f),d=i.parameterValues([t,n],h).toJS();return u.executeRequest(o()(o()({},r),{},{fetch:a,spec:s,pathName:t,method:n,parameters:d,requestContentType:f,scheme:c,responseContentType:p}))}};function Ue(e,t){return{type:le,payload:{path:e,method:t}}}function Ve(e,t){return{type:fe,payload:{path:e,method:t}}}function We(e,t,n){return{type:ve,payload:{scheme:e,path:t,method:n}}}},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t=e.length?{done:!0}:{done:!1,value:e[u++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var c,l=!0,f=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){f=!0,c=e},f:function(){try{l||null==n.return||n.return()}finally{if(f)throw c}}}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(41);e.exports=function(e){if(!r(e))throw TypeError(String(e)+" is not an object");return e}},function(e,t){var n=Array.isArray;e.exports=n},function(e,t){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},function(e,t,n){var r=n(406),o=n(407),a=n(794);e.exports=function(e,t){if(null==e)return{};var n,i,u=a(e,t);if(r){var s=r(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(u[n]=e[n])}return u},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";n.r(t),n.d(t,"UPDATE_SELECTED_SERVER",(function(){return r})),n.d(t,"UPDATE_REQUEST_BODY_VALUE",(function(){return o})),n.d(t,"UPDATE_REQUEST_BODY_VALUE_RETAIN_FLAG",(function(){return a})),n.d(t,"UPDATE_REQUEST_BODY_INCLUSION",(function(){return i})),n.d(t,"UPDATE_ACTIVE_EXAMPLES_MEMBER",(function(){return u})),n.d(t,"UPDATE_REQUEST_CONTENT_TYPE",(function(){return s})),n.d(t,"UPDATE_RESPONSE_CONTENT_TYPE",(function(){return c})),n.d(t,"UPDATE_SERVER_VARIABLE_VALUE",(function(){return l})),n.d(t,"SET_REQUEST_BODY_VALIDATE_ERROR",(function(){return f})),n.d(t,"CLEAR_REQUEST_BODY_VALIDATE_ERROR",(function(){return p})),n.d(t,"CLEAR_REQUEST_BODY_VALUE",(function(){return h})),n.d(t,"setSelectedServer",(function(){return d})),n.d(t,"setRequestBodyValue",(function(){return m})),n.d(t,"setRetainRequestBodyValueFlag",(function(){return v})),n.d(t,"setRequestBodyInclusion",(function(){return g})),n.d(t,"setActiveExamplesMember",(function(){return y})),n.d(t,"setRequestContentType",(function(){return b})),n.d(t,"setResponseContentType",(function(){return w})),n.d(t,"setServerVariableValue",(function(){return x})),n.d(t,"setRequestBodyValidateError",(function(){return _})),n.d(t,"clearRequestBodyValidateError",(function(){return E})),n.d(t,"initRequestBodyValidateError",(function(){return S})),n.d(t,"clearRequestBodyValue",(function(){return k}));var r="oas3_set_servers",o="oas3_set_request_body_value",a="oas3_set_request_body_retain_flag",i="oas3_set_request_body_inclusion",u="oas3_set_active_examples_member",s="oas3_set_request_content_type",c="oas3_set_response_content_type",l="oas3_set_server_variable_value",f="oas3_set_request_body_validate_error",p="oas3_clear_request_body_validate_error",h="oas3_clear_request_body_value";function d(e,t){return{type:r,payload:{selectedServerUrl:e,namespace:t}}}function m(e){var t=e.value,n=e.pathMethod;return{type:o,payload:{value:t,pathMethod:n}}}var v=function(e){var t=e.value,n=e.pathMethod;return{type:a,payload:{value:t,pathMethod:n}}};function g(e){var t=e.value,n=e.pathMethod,r=e.name;return{type:i,payload:{value:t,pathMethod:n,name:r}}}function y(e){var t=e.name,n=e.pathMethod,r=e.contextType,o=e.contextName;return{type:u,payload:{name:t,pathMethod:n,contextType:r,contextName:o}}}function b(e){var t=e.value,n=e.pathMethod;return{type:s,payload:{value:t,pathMethod:n}}}function w(e){var t=e.value,n=e.path,r=e.method;return{type:c,payload:{value:t,path:n,method:r}}}function x(e){var t=e.server,n=e.namespace,r=e.key,o=e.val;return{type:l,payload:{server:t,namespace:n,key:r,val:o}}}var _=function(e){var t=e.path,n=e.method,r=e.validationErrors;return{type:f,payload:{path:t,method:n,validationErrors:r}}},E=function(e){var t=e.path,n=e.method;return{type:p,payload:{path:t,method:n}}},S=function(e){var t=e.pathMethod;return{type:p,payload:{path:t[0],method:t[1]}}},k=function(e){var t=e.pathMethod;return{type:h,payload:{pathMethod:t}}}},function(e,t,n){var r=n(57),o={}.hasOwnProperty;e.exports=Object.hasOwn||function(e,t){return o.call(r(e),t)}},function(e,t,n){e.exports=n(624)},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";n.d(t,"b",(function(){return m})),n.d(t,"e",(function(){return v})),n.d(t,"c",(function(){return y})),n.d(t,"a",(function(){return b})),n.d(t,"d",(function(){return w}));var r=n(45),o=n.n(r),a=n(18),i=n.n(a),u=n(97),s=n.n(u),c=n(2),l=n.n(c),f=n(48),p=n.n(f),h=function(e){return String.prototype.toLowerCase.call(e)},d=function(e){return e.replace(/[^\w]/gi,"_")};function m(e){var t=e.openapi;return!!t&&s()(t).call(t,"3")}function v(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=r.v2OperationIdCompatibilityMode;if(!e||"object"!==i()(e))return null;var a=(e.operationId||"").replace(/\s/g,"");return a.length?d(e.operationId):g(t,n,{v2OperationIdCompatibilityMode:o})}function g(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=r.v2OperationIdCompatibilityMode;if(o){var a,i,u=l()(a="".concat(t.toLowerCase(),"_")).call(a,e).replace(/[\s!@#$%^&*()_+=[{\]};:<>|./?,\\'""-]/g,"_");return(u=u||l()(i="".concat(e.substring(1),"_")).call(i,t)).replace(/((_){2,})/g,"_").replace(/^(_)*/g,"").replace(/([_])*$/g,"")}return l()(n="".concat(h(t))).call(n,d(e))}function y(e,t){var n;return l()(n="".concat(h(t),"-")).call(n,e)}function b(e,t){return e&&e.paths?function(e,t){return function(e,t,n){if(!e||"object"!==i()(e)||!e.paths||"object"!==i()(e.paths))return null;var r=e.paths;for(var o in r)for(var a in r[o])if("PARAMETERS"!==a.toUpperCase()){var u=r[o][a];if(u&&"object"===i()(u)){var s={spec:e,pathName:o,method:a.toUpperCase(),operation:u},c=t(s);if(n&&c)return s}}return}(e,t,!0)||null}(e,(function(e){var n=e.pathName,r=e.method,o=e.operation;if(!o||"object"!==i()(o))return!1;var a=o.operationId;return[v(o,n,r),y(n,r),a].some((function(e){return e&&e===t}))})):null}function w(e){var t=e.spec,n=t.paths,r={};if(!n||t.$$normalized)return e;for(var a in n){var i=n[a];if(p()(i)){var u=i.parameters,s=function(e){var n=i[e];if(!p()(n))return"continue";var s=v(n,a,e);if(s){r[s]?r[s].push(n):r[s]=[n];var c=r[s];if(c.length>1)c.forEach((function(e,t){var n;e.__originalOperationId=e.__originalOperationId||e.operationId,e.operationId=l()(n="".concat(s)).call(n,t+1)}));else if(void 0!==n.operationId){var f=c[0];f.__originalOperationId=f.__originalOperationId||n.operationId,f.operationId=s}}if("parameters"!==e){var h=[],d={};for(var m in t)"produces"!==m&&"consumes"!==m&&"security"!==m||(d[m]=t[m],h.push(d));if(u&&(d.parameters=u,h.push(d)),h.length){var g,y=o()(h);try{for(y.s();!(g=y.n()).done;){var b=g.value;for(var w in b)if(n[w]){if("parameters"===w){var x,_=o()(b[w]);try{var E=function(){var e=x.value;n[w].some((function(t){return t.name&&t.name===e.name||t.$ref&&t.$ref===e.$ref||t.$$ref&&t.$$ref===e.$$ref||t===e}))||n[w].push(e)};for(_.s();!(x=_.n()).done;)E()}catch(e){_.e(e)}finally{_.f()}}}else n[w]=b[w]}}catch(e){y.e(e)}finally{y.f()}}}};for(var c in i)s(c)}}return t.$$normalized=!0,e}},function(e,t,n){"use strict";n.r(t),n.d(t,"NEW_THROWN_ERR",(function(){return o})),n.d(t,"NEW_THROWN_ERR_BATCH",(function(){return a})),n.d(t,"NEW_SPEC_ERR",(function(){return i})),n.d(t,"NEW_SPEC_ERR_BATCH",(function(){return u})),n.d(t,"NEW_AUTH_ERR",(function(){return s})),n.d(t,"CLEAR",(function(){return c})),n.d(t,"CLEAR_BY",(function(){return l})),n.d(t,"newThrownErr",(function(){return f})),n.d(t,"newThrownErrBatch",(function(){return p})),n.d(t,"newSpecErr",(function(){return h})),n.d(t,"newSpecErrBatch",(function(){return d})),n.d(t,"newAuthErr",(function(){return m})),n.d(t,"clear",(function(){return v})),n.d(t,"clearBy",(function(){return g}));var r=n(134),o="err_new_thrown_err",a="err_new_thrown_err_batch",i="err_new_spec_err",u="err_new_spec_err_batch",s="err_new_auth_err",c="err_clear",l="err_clear_by";function f(e){return{type:o,payload:Object(r.serializeError)(e)}}function p(e){return{type:a,payload:e}}function h(e){return{type:i,payload:e}}function d(e){return{type:u,payload:e}}function m(e){return{type:s,payload:e}}function v(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:c,payload:e}}function g(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return!0};return{type:l,payload:e}}},function(e,t,n){var r=n(31),o=n(38),a=function(e){return"function"==typeof e?e:void 0};e.exports=function(e,t){return arguments.length<2?a(r[e])||a(o[e]):r[e]&&r[e][t]||o[e]&&o[e][t]}},function(e,t,n){var r=n(101);e.exports=function(e){return Object(r(e))}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}},function(e,t,n){var r=n(125),o=r.Buffer;function a(e,t){for(var n in e)t[n]=e[n]}function i(e,t,n){return o(e,t,n)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=r:(a(r,t),t.Buffer=i),a(o,i),i.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,n)},i.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=o(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},i.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},i.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,n){e.exports=n(809)},function(e,t,n){var r=n(161),o=n(101);e.exports=function(e){return r(o(e))}},function(e,t,n){var r=n(44),o=n(317),a=n(46),i=n(162),u=Object.defineProperty;t.f=r?u:function(e,t,n){if(a(e),t=i(t),a(n),o)try{return u(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){var r=n(122),o=Math.min;e.exports=function(e){return e>0?o(r(e),9007199254740991):0}},function(e,t,n){var r=n(163);e.exports=function(e){if(r(e))throw TypeError("Cannot convert a Symbol value to a string");return String(e)}},function(e,t,n){var r=n(341),o="object"==typeof self&&self&&self.Object===Object&&self,a=r||o||Function("return this")();e.exports=a},function(e,t,n){"use strict";function r(e){return null==e}var o={isNothing:r,isObject:function(e){return"object"==typeof e&&null!==e},toArray:function(e){return Array.isArray(e)?e:r(e)?[]:[e]},repeat:function(e,t){var n,r="";for(n=0;nu&&(t=r-u+(a=" ... ").length),n-r>u&&(n=r+u-(i=" ...").length),{str:a+e.slice(t,n).replace(/\t/g,"→")+i,pos:r-t+a.length}}function c(e,t){return o.repeat(" ",t-e.length)+e}var l=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n,r=/\r?\n|\r|\0/g,a=[0],i=[],u=-1;n=r.exec(e.buffer);)i.push(n.index),a.push(n.index+n[0].length),e.position<=n.index&&u<0&&(u=a.length-2);u<0&&(u=a.length-1);var l,f,p="",h=Math.min(e.line+t.linesAfter,i.length).toString().length,d=t.maxLength-(t.indent+h+3);for(l=1;l<=t.linesBefore&&!(u-l<0);l++)f=s(e.buffer,a[u-l],i[u-l],e.position-(a[u]-a[u-l]),d),p=o.repeat(" ",t.indent)+c((e.line-l+1).toString(),h)+" | "+f.str+"\n"+p;for(f=s(e.buffer,a[u],i[u],e.position,d),p+=o.repeat(" ",t.indent)+c((e.line+1).toString(),h)+" | "+f.str+"\n",p+=o.repeat("-",t.indent+h+3+f.pos)+"^\n",l=1;l<=t.linesAfter&&!(u+l>=i.length);l++)f=s(e.buffer,a[u+l],i[u+l],e.position-(a[u]-a[u+l]),d),p+=o.repeat(" ",t.indent)+c((e.line+l+1).toString(),h)+" | "+f.str+"\n";return p.replace(/\n$/,"")},f=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],p=["scalar","sequence","mapping"];var h=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===f.indexOf(t))throw new u('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(n){e[n].forEach((function(e){t[String(e)]=n}))})),t}(t.styleAliases||null),-1===p.indexOf(this.kind))throw new u('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function d(e,t){var n=[];return e[t].forEach((function(e){var t=n.length;n.forEach((function(n,r){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=r)})),n[t]=e})),n}function m(e){return this.extend(e)}m.prototype.extend=function(e){var t=[],n=[];if(e instanceof h)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new u("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof h))throw new u("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new u("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new u("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(e){if(!(e instanceof h))throw new u("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var r=Object.create(m.prototype);return r.implicit=(this.implicit||[]).concat(t),r.explicit=(this.explicit||[]).concat(n),r.compiledImplicit=d(r,"implicit"),r.compiledExplicit=d(r,"explicit"),r.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function r(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),A=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var O=/^[-+]?[0-9]+e/;var C=new h("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!A.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||o.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(o.isNegativeZero(e))return"-0.0";return n=e.toString(10),O.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),j=w.extend({implicit:[x,_,k,C]}),T=j,I=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),N=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var P=new h("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==I.exec(e)||null!==N.exec(e))},construct:function(e){var t,n,r,o,a,i,u,s,c=0,l=null;if(null===(t=I.exec(e))&&(t=N.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],r=+t[2]-1,o=+t[3],!t[4])return new Date(Date.UTC(n,r,o));if(a=+t[4],i=+t[5],u=+t[6],t[7]){for(c=t[7].slice(0,3);c.length<3;)c+="0";c=+c}return t[9]&&(l=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(l=-l)),s=new Date(Date.UTC(n,r,o,a,i,u,c)),l&&s.setTime(s.getTime()-l),s},instanceOf:Date,represent:function(e){return e.toISOString()}});var M=new h("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),R="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var D=new h("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,r=0,o=e.length,a=R;for(n=0;n64)){if(t<0)return!1;r+=6}return r%8==0},construct:function(e){var t,n,r=e.replace(/[\r\n=]/g,""),o=r.length,a=R,i=0,u=[];for(t=0;t>16&255),u.push(i>>8&255),u.push(255&i)),i=i<<6|a.indexOf(r.charAt(t));return 0===(n=o%4*6)?(u.push(i>>16&255),u.push(i>>8&255),u.push(255&i)):18===n?(u.push(i>>10&255),u.push(i>>2&255)):12===n&&u.push(i>>4&255),new Uint8Array(u)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,r="",o=0,a=e.length,i=R;for(t=0;t>18&63],r+=i[o>>12&63],r+=i[o>>6&63],r+=i[63&o]),o=(o<<8)+e[t];return 0===(n=a%3)?(r+=i[o>>18&63],r+=i[o>>12&63],r+=i[o>>6&63],r+=i[63&o]):2===n?(r+=i[o>>10&63],r+=i[o>>4&63],r+=i[o<<2&63],r+=i[64]):1===n&&(r+=i[o>>2&63],r+=i[o<<4&63],r+=i[64],r+=i[64]),r}}),L=Object.prototype.hasOwnProperty,B=Object.prototype.toString;var F=new h("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,r,o,a,i=[],u=e;for(t=0,n=u.length;t>10),56320+(e-65536&1023))}for(var ae=new Array(256),ie=new Array(256),ue=0;ue<256;ue++)ae[ue]=re(ue)?1:0,ie[ue]=re(ue);function se(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||W,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function ce(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=l(n),new u(t,n)}function le(e,t){throw ce(e,t)}function fe(e,t){e.onWarning&&e.onWarning.call(null,ce(e,t))}var pe={YAML:function(e,t,n){var r,o,a;null!==e.version&&le(e,"duplication of %YAML directive"),1!==n.length&&le(e,"YAML directive accepts exactly one argument"),null===(r=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&le(e,"ill-formed argument of the YAML directive"),o=parseInt(r[1],10),a=parseInt(r[2],10),1!==o&&le(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=a<2,1!==a&&2!==a&&fe(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var r,o;2!==n.length&&le(e,"TAG directive accepts exactly two arguments"),r=n[0],o=n[1],Y.test(r)||le(e,"ill-formed tag handle (first argument) of the TAG directive"),H.call(e.tagMap,r)&&le(e,'there is a previously declared suffix for "'+r+'" tag handle'),G.test(o)||le(e,"ill-formed tag prefix (second argument) of the TAG directive");try{o=decodeURIComponent(o)}catch(t){le(e,"tag prefix is malformed: "+o)}e.tagMap[r]=o}};function he(e,t,n,r){var o,a,i,u;if(t1&&(e.result+=o.repeat("\n",t-1))}function we(e,t){var n,r,o=e.tag,a=e.anchor,i=[],u=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=i),r=e.input.charCodeAt(e.position);0!==r&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,le(e,"tab characters must not be used in indentation")),45===r)&&ee(e.input.charCodeAt(e.position+1));)if(u=!0,e.position++,ge(e,!0,-1)&&e.lineIndent<=t)i.push(null),r=e.input.charCodeAt(e.position);else if(n=e.line,Ee(e,t,3,!1,!0),i.push(e.result),ge(e,!0,-1),r=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==r)le(e,"bad indentation of a sequence entry");else if(e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt)&&(g&&(i=e.line,u=e.lineStart,s=e.position),Ee(e,t,4,!0,o)&&(g?m=e.result:v=e.result),g||(me(e,p,h,d,m,v,i,u,s),d=m=v=null),ge(e,!0,-1),c=e.input.charCodeAt(e.position)),(e.line===a||e.lineIndent>t)&&0!==c)le(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===a?le(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):l?le(e,"repeat of an indentation width identifier"):(f=t+a-1,l=!0)}if(X(i)){do{i=e.input.charCodeAt(++e.position)}while(X(i));if(35===i)do{i=e.input.charCodeAt(++e.position)}while(!Z(i)&&0!==i)}for(;0!==i;){for(ve(e),e.lineIndent=0,i=e.input.charCodeAt(e.position);(!l||e.lineIndentf&&(f=e.lineIndent),Z(i))p++;else{if(e.lineIndent0){for(o=i,a=0;o>0;o--)(i=ne(u=e.input.charCodeAt(++e.position)))>=0?a=(a<<4)+i:le(e,"expected hexadecimal character");e.result+=oe(a),e.position++}else le(e,"unknown escape sequence");n=r=e.position}else Z(u)?(he(e,n,r,!0),be(e,ge(e,!1,t)),n=r=e.position):e.position===e.lineStart&&ye(e)?le(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}le(e,"unexpected end of the stream within a double quoted scalar")}(e,h)?g=!0:!function(e){var t,n,r;if(42!==(r=e.input.charCodeAt(e.position)))return!1;for(r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!ee(r)&&!te(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&le(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),H.call(e.anchorMap,n)||le(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],ge(e,!0,-1),!0}(e)?function(e,t,n){var r,o,a,i,u,s,c,l,f=e.kind,p=e.result;if(ee(l=e.input.charCodeAt(e.position))||te(l)||35===l||38===l||42===l||33===l||124===l||62===l||39===l||34===l||37===l||64===l||96===l)return!1;if((63===l||45===l)&&(ee(r=e.input.charCodeAt(e.position+1))||n&&te(r)))return!1;for(e.kind="scalar",e.result="",o=a=e.position,i=!1;0!==l;){if(58===l){if(ee(r=e.input.charCodeAt(e.position+1))||n&&te(r))break}else if(35===l){if(ee(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&ye(e)||n&&te(l))break;if(Z(l)){if(u=e.line,s=e.lineStart,c=e.lineIndent,ge(e,!1,-1),e.lineIndent>=t){i=!0,l=e.input.charCodeAt(e.position);continue}e.position=a,e.line=u,e.lineStart=s,e.lineIndent=c;break}}i&&(he(e,o,a,!1),be(e,e.line-u),o=a=e.position,i=!1),X(l)||(a=e.position+1),l=e.input.charCodeAt(++e.position)}return he(e,o,a,!1),!!e.result||(e.kind=f,e.result=p,!1)}(e,h,1===n)&&(g=!0,null===e.tag&&(e.tag="?")):(g=!0,null===e.tag&&null===e.anchor||le(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===m&&(g=s&&we(e,d))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&le(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),c=0,l=e.implicitTypes.length;c"),null!==e.result&&p.kind!==e.kind&&le(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+p.kind+'", not "'+e.kind+'"'),p.resolve(e.result,e.tag)?(e.result=p.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):le(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||g}function Se(e){var t,n,r,o,a=e.position,i=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(o=e.input.charCodeAt(e.position))&&(ge(e,!0,-1),o=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==o));){for(i=!0,o=e.input.charCodeAt(++e.position),t=e.position;0!==o&&!ee(o);)o=e.input.charCodeAt(++e.position);for(r=[],(n=e.input.slice(t,e.position)).length<1&&le(e,"directive name must not be less than one character in length");0!==o;){for(;X(o);)o=e.input.charCodeAt(++e.position);if(35===o){do{o=e.input.charCodeAt(++e.position)}while(0!==o&&!Z(o));break}if(Z(o))break;for(t=e.position;0!==o&&!ee(o);)o=e.input.charCodeAt(++e.position);r.push(e.input.slice(t,e.position))}0!==o&&ve(e),H.call(pe,n)?pe[n](e,n,r):fe(e,'unknown document directive "'+n+'"')}ge(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,ge(e,!0,-1)):i&&le(e,"directives end mark is expected"),Ee(e,e.lineIndent-1,4,!1,!0),ge(e,!0,-1),e.checkLineBreaks&&J.test(e.input.slice(a,e.position))&&fe(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&ye(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,ge(e,!0,-1)):e.position=55296&&r<=56319&&t+1=56320&&n<=57343?1024*(r-55296)+n-56320+65536:r}function Ue(e){return/^\n* /.test(e)}function Ve(e,t,n,r,o,a,i,u){var s,c,l=0,f=null,p=!1,h=!1,d=-1!==r,m=-1,v=Be(c=qe(e,0))&&c!==je&&!Le(c)&&45!==c&&63!==c&&58!==c&&44!==c&&91!==c&&93!==c&&123!==c&&125!==c&&35!==c&&38!==c&&42!==c&&33!==c&&124!==c&&61!==c&&62!==c&&39!==c&&34!==c&&37!==c&&64!==c&&96!==c&&function(e){return!Le(e)&&58!==e}(qe(e,e.length-1));if(t||i)for(s=0;s=65536?s+=2:s++){if(!Be(l=qe(e,s)))return 5;v=v&&ze(l,f,u),f=l}else{for(s=0;s=65536?s+=2:s++){if(10===(l=qe(e,s)))p=!0,d&&(h=h||s-m-1>r&&" "!==e[m+1],m=s);else if(!Be(l))return 5;v=v&&ze(l,f,u),f=l}h=h||d&&s-m-1>r&&" "!==e[m+1]}return p||h?n>9&&Ue(e)?5:i?2===a?5:2:h?4:3:!v||i||o(e)?2===a?5:2:1}function We(e,t,n,r,o){e.dump=function(){if(0===t.length)return 2===e.quotingType?'""':"''";if(!e.noCompatMode&&(-1!==Ie.indexOf(t)||Ne.test(t)))return 2===e.quotingType?'"'+t+'"':"'"+t+"'";var a=e.indent*Math.max(1,n),i=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-a),s=r||e.flowLevel>-1&&n>=e.flowLevel;switch(Ve(t,s,e.indent,i,(function(t){return function(e,t){var n,r;for(n=0,r=e.implicitTypes.length;n"+He(t,e.indent)+$e(Re(function(e,t){var n,r,o=/(\n+)([^\n]*)/g,a=(u=e.indexOf("\n"),u=-1!==u?u:e.length,o.lastIndex=u,Je(e.slice(0,u),t)),i="\n"===e[0]||" "===e[0];var u;for(;r=o.exec(e);){var s=r[1],c=r[2];n=" "===c[0],a+=s+(i||n||""===c?"":"\n")+Je(c,t),i=n}return a}(t,i),a));case 5:return'"'+function(e){for(var t,n="",r=0,o=0;o=65536?o+=2:o++)r=qe(e,o),!(t=Te[r])&&Be(r)?(n+=e[o],r>=65536&&(n+=e[o+1])):n+=t||Pe(r);return n}(t)+'"';default:throw new u("impossible error: invalid scalar style")}}()}function He(e,t){var n=Ue(e)?String(t):"",r="\n"===e[e.length-1];return n+(r&&("\n"===e[e.length-2]||"\n"===e)?"+":r?"":"-")+"\n"}function $e(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function Je(e,t){if(""===e||" "===e[0])return e;for(var n,r,o=/ [^ ]/g,a=0,i=0,u=0,s="";n=o.exec(e);)(u=n.index)-a>t&&(r=i>a?i:u,s+="\n"+e.slice(a,r),a=r+1),i=u;return s+="\n",e.length-a>t&&i>a?s+=e.slice(a,i)+"\n"+e.slice(i+1):s+=e.slice(a),s.slice(1)}function Ke(e,t,n,r){var o,a,i,u="",s=e.tag;for(o=0,a=n.length;o tag resolver accepts not "'+c+'" style');r=s.represent[c](t,c)}e.dump=r}return!0}return!1}function Ge(e,t,n,r,o,a,i){e.tag=null,e.dump=n,Ye(e,n,!1)||Ye(e,n,!0);var s,c=Oe.call(e.dump),l=r;r&&(r=e.flowLevel<0||e.flowLevel>t);var f,p,h="[object Object]"===c||"[object Array]"===c;if(h&&(p=-1!==(f=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||p||2!==e.indent&&t>0)&&(o=!1),p&&e.usedDuplicates[f])e.dump="*ref_"+f;else{if(h&&p&&!e.usedDuplicates[f]&&(e.usedDuplicates[f]=!0),"[object Object]"===c)r&&0!==Object.keys(e.dump).length?(!function(e,t,n,r){var o,a,i,s,c,l,f="",p=e.tag,h=Object.keys(n);if(!0===e.sortKeys)h.sort();else if("function"==typeof e.sortKeys)h.sort(e.sortKeys);else if(e.sortKeys)throw new u("sortKeys must be a boolean or a function");for(o=0,a=h.length;o1024)&&(e.dump&&10===e.dump.charCodeAt(0)?l+="?":l+="? "),l+=e.dump,c&&(l+=De(e,t)),Ge(e,t+1,s,!0,c)&&(e.dump&&10===e.dump.charCodeAt(0)?l+=":":l+=": ",f+=l+=e.dump));e.tag=p,e.dump=f||"{}"}(e,t,e.dump,o),p&&(e.dump="&ref_"+f+e.dump)):(!function(e,t,n){var r,o,a,i,u,s="",c=e.tag,l=Object.keys(n);for(r=0,o=l.length;r1024&&(u+="? "),u+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Ge(e,t,i,!1,!1)&&(s+=u+=e.dump));e.tag=c,e.dump="{"+s+"}"}(e,t,e.dump),p&&(e.dump="&ref_"+f+" "+e.dump));else if("[object Array]"===c)r&&0!==e.dump.length?(e.noArrayIndent&&!i&&t>0?Ke(e,t-1,e.dump,o):Ke(e,t,e.dump,o),p&&(e.dump="&ref_"+f+e.dump)):(!function(e,t,n){var r,o,a,i="",u=e.tag;for(r=0,o=n.length;r",e.dump=s+" "+e.dump)}return!0}function Qe(e,t){var n,r,o=[],a=[];for(Ze(e,o,a),n=0,r=a.length;n=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values"),a.Arguments=a.Array,o("keys"),o("values"),o("entries")},function(e,t){e.exports=function(e){return null!=e&&"object"==typeof e}},function(e,t,n){"use strict";(function(t){function n(e){return e instanceof t||e instanceof Date||e instanceof RegExp}function r(e){if(e instanceof t){var n=t.alloc?t.alloc(e.length):new t(e.length);return e.copy(n),n}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e);throw new Error("Unexpected situation")}function o(e){var t=[];return e.forEach((function(e,a){"object"==typeof e&&null!==e?Array.isArray(e)?t[a]=o(e):n(e)?t[a]=r(e):t[a]=i({},e):t[a]=e})),t}function a(e,t){return"__proto__"===t?void 0:e[t]}var i=e.exports=function(){if(arguments.length<1||"object"!=typeof arguments[0])return!1;if(arguments.length<2)return arguments[0];var e,t,u=arguments[0],s=Array.prototype.slice.call(arguments,1);return s.forEach((function(s){"object"!=typeof s||null===s||Array.isArray(s)||Object.keys(s).forEach((function(c){return t=a(u,c),(e=a(s,c))===u?void 0:"object"!=typeof e||null===e?void(u[c]=e):Array.isArray(e)?void(u[c]=o(e)):n(e)?void(u[c]=r(e)):"object"!=typeof t||null===t||Array.isArray(t)?void(u[c]=i({},e)):void(u[c]=i(t,e))}))})),u}}).call(this,n(125).Buffer)},function(e,t,n){e.exports=n(595)},function(e,t,n){"use strict";var r=n(912),o=n(913);function a(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=b,t.resolve=function(e,t){return b(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},t.format=function(e){o.isString(e)&&(e=b(e));return e instanceof a?e.format():a.prototype.format.call(e)},t.Url=a;var i=/^([a-z0-9.+-]+:)/i,u=/:[0-9]*$/,s=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(c),f=["%","/","?",";","#"].concat(l),p=["/","?","#"],h=/^[+a-z0-9A-Z_-]{0,63}$/,d=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},v={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=n(914);function b(e,t,n){if(e&&o.isObject(e)&&e instanceof a)return e;var r=new a;return r.parse(e,t,n),r}a.prototype.parse=function(e,t,n){if(!o.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var a=e.indexOf("?"),u=-1!==a&&a127?P+="x":P+=N[M];if(!P.match(h)){var D=T.slice(0,O),L=T.slice(O+1),B=N.match(d);B&&(D.push(B[1]),L.unshift(B[2])),L.length&&(b="/"+L.join(".")+b),this.hostname=D.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),j||(this.hostname=r.toASCII(this.hostname));var F=this.port?":"+this.port:"",z=this.hostname||"";this.host=z+F,this.href+=this.host,j&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!m[_])for(O=0,I=l.length;O0)&&n.host.split("@"))&&(n.auth=j.shift(),n.host=n.hostname=j.shift());return n.search=e.search,n.query=e.query,o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!E.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var k=E.slice(-1)[0],A=(n.host||e.host||E.length>1)&&("."===k||".."===k)||""===k,O=0,C=E.length;C>=0;C--)"."===(k=E[C])?E.splice(C,1):".."===k?(E.splice(C,1),O++):O&&(E.splice(C,1),O--);if(!x&&!_)for(;O--;O)E.unshift("..");!x||""===E[0]||E[0]&&"/"===E[0].charAt(0)||E.unshift(""),A&&"/"!==E.join("/").substr(-1)&&E.push("");var j,T=""===E[0]||E[0]&&"/"===E[0].charAt(0);S&&(n.hostname=n.host=T?"":E.length?E.shift():"",(j=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=j.shift(),n.host=n.hostname=j.shift()));return(x=x||n.host&&E.length)&&!T&&E.unshift(""),E.length?n.pathname=E.join("/"):(n.pathname=null,n.path=null),o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},a.prototype.parseHost=function(){var e=this.host,t=u.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){"use strict";n.r(t),n.d(t,"SHOW_AUTH_POPUP",(function(){return h})),n.d(t,"AUTHORIZE",(function(){return d})),n.d(t,"LOGOUT",(function(){return m})),n.d(t,"PRE_AUTHORIZE_OAUTH2",(function(){return v})),n.d(t,"AUTHORIZE_OAUTH2",(function(){return g})),n.d(t,"VALIDATE",(function(){return y})),n.d(t,"CONFIGURE_AUTH",(function(){return b})),n.d(t,"RESTORE_AUTHORIZATION",(function(){return w})),n.d(t,"showDefinitions",(function(){return x})),n.d(t,"authorize",(function(){return _})),n.d(t,"authorizeWithPersistOption",(function(){return E})),n.d(t,"logout",(function(){return S})),n.d(t,"logoutWithPersistOption",(function(){return k})),n.d(t,"preAuthorizeImplicit",(function(){return A})),n.d(t,"authorizeOauth2",(function(){return O})),n.d(t,"authorizeOauth2WithPersistOption",(function(){return C})),n.d(t,"authorizePassword",(function(){return j})),n.d(t,"authorizeApplication",(function(){return T})),n.d(t,"authorizeAccessCodeWithFormParams",(function(){return I})),n.d(t,"authorizeAccessCodeWithBasicAuthentication",(function(){return N})),n.d(t,"authorizeRequest",(function(){return P})),n.d(t,"configureAuth",(function(){return M})),n.d(t,"restoreAuthorization",(function(){return R})),n.d(t,"persistAuthorizationIfNeeded",(function(){return D}));var r=n(18),o=n.n(r),a=n(30),i=n.n(a),u=n(20),s=n.n(u),c=n(82),l=n.n(c),f=n(25),p=n(5),h="show_popup",d="authorize",m="logout",v="pre_authorize_oauth2",g="authorize_oauth2",y="validate",b="configure_auth",w="restore_authorization";function x(e){return{type:h,payload:e}}function _(e){return{type:d,payload:e}}var E=function(e){return function(t){var n=t.authActions;n.authorize(e),n.persistAuthorizationIfNeeded()}};function S(e){return{type:m,payload:e}}var k=function(e){return function(t){var n=t.authActions;n.logout(e),n.persistAuthorizationIfNeeded()}},A=function(e){return function(t){var n=t.authActions,r=t.errActions,o=e.auth,a=e.token,u=e.isValid,s=o.schema,c=o.name,l=s.get("flow");delete f.a.swaggerUIRedirectOauth2,"accessCode"===l||u||r.newAuthErr({authId:c,source:"auth",level:"warning",message:"Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"}),a.error?r.newAuthErr({authId:c,source:"auth",level:"error",message:i()(a)}):n.authorizeOauth2WithPersistOption({auth:o,token:a})}};function O(e){return{type:g,payload:e}}var C=function(e){return function(t){var n=t.authActions;n.authorizeOauth2(e),n.persistAuthorizationIfNeeded()}},j=function(e){return function(t){var n=t.authActions,r=e.schema,o=e.name,a=e.username,i=e.password,u=e.passwordType,c=e.clientId,l=e.clientSecret,f={grant_type:"password",scope:e.scopes.join(" "),username:a,password:i},h={};switch(u){case"request-body":!function(e,t,n){t&&s()(e,{client_id:t});n&&s()(e,{client_secret:n})}(f,c,l);break;case"basic":h.Authorization="Basic "+Object(p.a)(c+":"+l);break;default:console.warn("Warning: invalid passwordType ".concat(u," was passed, not including client id and secret"))}return n.authorizeRequest({body:Object(p.b)(f),url:r.get("tokenUrl"),name:o,headers:h,query:{},auth:e})}};var T=function(e){return function(t){var n=t.authActions,r=e.schema,o=e.scopes,a=e.name,i=e.clientId,u=e.clientSecret,s={Authorization:"Basic "+Object(p.a)(i+":"+u)},c={grant_type:"client_credentials",scope:o.join(" ")};return n.authorizeRequest({body:Object(p.b)(c),name:a,url:r.get("tokenUrl"),auth:e,headers:s})}},I=function(e){var t=e.auth,n=e.redirectUrl;return function(e){var r=e.authActions,o=t.schema,a=t.name,i=t.clientId,u=t.clientSecret,s=t.codeVerifier,c={grant_type:"authorization_code",code:t.code,client_id:i,client_secret:u,redirect_uri:n,code_verifier:s};return r.authorizeRequest({body:Object(p.b)(c),name:a,url:o.get("tokenUrl"),auth:t})}},N=function(e){var t=e.auth,n=e.redirectUrl;return function(e){var r=e.authActions,o=t.schema,a=t.name,i=t.clientId,u=t.clientSecret,s=t.codeVerifier,c={Authorization:"Basic "+Object(p.a)(i+":"+u)},l={grant_type:"authorization_code",code:t.code,client_id:i,redirect_uri:n,code_verifier:s};return r.authorizeRequest({body:Object(p.b)(l),name:a,url:o.get("tokenUrl"),auth:t,headers:c})}},P=function(e){return function(t){var n,r=t.fn,a=t.getConfigs,u=t.authActions,c=t.errActions,f=t.oas3Selectors,p=t.specSelectors,h=t.authSelectors,d=e.body,m=e.query,v=void 0===m?{}:m,g=e.headers,y=void 0===g?{}:g,b=e.name,w=e.url,x=e.auth,_=(h.getConfigs()||{}).additionalQueryStringParams;if(p.isOAS3()){var E=f.serverEffectiveValue(f.selectedServer());n=l()(w,E,!0)}else n=l()(w,p.url(),!0);"object"===o()(_)&&(n.query=s()({},n.query,_));var S=n.toString(),k=s()({Accept:"application/json, text/plain, */*","Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},y);r.fetch({url:S,method:"post",headers:k,query:v,body:d,requestInterceptor:a().requestInterceptor,responseInterceptor:a().responseInterceptor}).then((function(e){var t=JSON.parse(e.data),n=t&&(t.error||""),r=t&&(t.parseError||"");e.ok?n||r?c.newAuthErr({authId:b,level:"error",source:"auth",message:i()(t)}):u.authorizeOauth2WithPersistOption({auth:x,token:t}):c.newAuthErr({authId:b,level:"error",source:"auth",message:e.statusText})})).catch((function(e){var t=new Error(e).message;if(e.response&&e.response.data){var n=e.response.data;try{var r="string"==typeof n?JSON.parse(n):n;r.error&&(t+=", error: ".concat(r.error)),r.error_description&&(t+=", description: ".concat(r.error_description))}catch(e){}}c.newAuthErr({authId:b,level:"error",source:"auth",message:t})}))}};function M(e){return{type:b,payload:e}}function R(e){return{type:w,payload:e}}var D=function(){return function(e){var t=e.authSelectors;if((0,e.getConfigs)().persistAuthorization){var n=t.authorized();localStorage.setItem("authorized",i()(n.toJS()))}}}},function(e,t,n){var r=n(884);e.exports=function(e){for(var t=1;tS;S++)if((h||S in x)&&(b=_(y=x[S],S,w),e))if(t)A[S]=b;else if(b)switch(e){case 3:return!0;case 5:return y;case 6:return S;case 2:s.call(A,y)}else switch(e){case 4:return!1;case 7:s.call(A,y)}return f?-1:c||l?l:A}};e.exports={forEach:c(0),map:c(1),filter:c(2),some:c(3),every:c(4),find:c(5),findIndex:c(6),filterReject:c(7)}},function(e,t,n){n(72);var r=n(587),o=n(38),a=n(89),i=n(70),u=n(123),s=n(35)("toStringTag");for(var c in r){var l=o[c],f=l&&l.prototype;f&&a(f)!==s&&i(f,s,c),u[c]=u.Array}},function(e,t,n){"use strict";n.r(t),n.d(t,"lastError",(function(){return M})),n.d(t,"url",(function(){return R})),n.d(t,"specStr",(function(){return D})),n.d(t,"specSource",(function(){return L})),n.d(t,"specJson",(function(){return B})),n.d(t,"specResolved",(function(){return F})),n.d(t,"specResolvedSubtree",(function(){return z})),n.d(t,"specJsonWithResolvedSubtrees",(function(){return U})),n.d(t,"spec",(function(){return V})),n.d(t,"isOAS3",(function(){return W})),n.d(t,"info",(function(){return H})),n.d(t,"externalDocs",(function(){return $})),n.d(t,"version",(function(){return J})),n.d(t,"semver",(function(){return K})),n.d(t,"paths",(function(){return Y})),n.d(t,"operations",(function(){return G})),n.d(t,"consumes",(function(){return Q})),n.d(t,"produces",(function(){return Z})),n.d(t,"security",(function(){return X})),n.d(t,"securityDefinitions",(function(){return ee})),n.d(t,"findDefinition",(function(){return te})),n.d(t,"definitions",(function(){return ne})),n.d(t,"basePath",(function(){return re})),n.d(t,"host",(function(){return oe})),n.d(t,"schemes",(function(){return ae})),n.d(t,"operationsWithRootInherited",(function(){return ie})),n.d(t,"tags",(function(){return ue})),n.d(t,"tagDetails",(function(){return se})),n.d(t,"operationsWithTags",(function(){return ce})),n.d(t,"taggedOperations",(function(){return le})),n.d(t,"responses",(function(){return fe})),n.d(t,"requests",(function(){return pe})),n.d(t,"mutatedRequests",(function(){return he})),n.d(t,"responseFor",(function(){return de})),n.d(t,"requestFor",(function(){return me})),n.d(t,"mutatedRequestFor",(function(){return ve})),n.d(t,"allowTryItOutFor",(function(){return ge})),n.d(t,"parameterWithMetaByIdentity",(function(){return ye})),n.d(t,"parameterInclusionSettingFor",(function(){return be})),n.d(t,"parameterWithMeta",(function(){return we})),n.d(t,"operationWithMeta",(function(){return xe})),n.d(t,"getParameter",(function(){return _e})),n.d(t,"hasHost",(function(){return Ee})),n.d(t,"parameterValues",(function(){return Se})),n.d(t,"parametersIncludeIn",(function(){return ke})),n.d(t,"parametersIncludeType",(function(){return Ae})),n.d(t,"contentTypeValues",(function(){return Oe})),n.d(t,"currentProducesFor",(function(){return Ce})),n.d(t,"producesOptionsFor",(function(){return je})),n.d(t,"consumesOptionsFor",(function(){return Te})),n.d(t,"operationScheme",(function(){return Ie})),n.d(t,"canExecuteScheme",(function(){return Ne})),n.d(t,"validateBeforeExecute",(function(){return Pe})),n.d(t,"getOAS3RequiredRequestBodyContentType",(function(){return Me})),n.d(t,"isMediaTypeSchemaPropertiesEqual",(function(){return Re}));var r=n(13),o=n.n(r),a=n(14),i=n.n(a),u=n(2),s=n.n(u),c=n(19),l=n.n(c),f=n(22),p=n.n(f),h=n(17),d=n.n(h),m=n(4),v=n.n(m),g=n(12),y=n.n(g),b=n(52),w=n.n(b),x=n(28),_=n.n(x),E=n(188),S=n.n(E),k=n(67),A=n.n(k),O=n(23),C=n.n(O),j=n(16),T=n(5),I=n(1),N=["get","put","post","delete","options","head","patch","trace"],P=function(e){return e||Object(I.Map)()},M=Object(j.a)(P,(function(e){return e.get("lastError")})),R=Object(j.a)(P,(function(e){return e.get("url")})),D=Object(j.a)(P,(function(e){return e.get("spec")||""})),L=Object(j.a)(P,(function(e){return e.get("specSource")||"not-editor"})),B=Object(j.a)(P,(function(e){return e.get("json",Object(I.Map)())})),F=Object(j.a)(P,(function(e){return e.get("resolved",Object(I.Map)())})),z=function(e,t){var n;return e.getIn(s()(n=["resolvedSubtrees"]).call(n,i()(t)),void 0)},q=function e(t,n){return I.Map.isMap(t)&&I.Map.isMap(n)?n.get("$$ref")?n:Object(I.OrderedMap)().mergeWith(e,t,n):n},U=Object(j.a)(P,(function(e){return Object(I.OrderedMap)().mergeWith(q,e.get("json"),e.get("resolvedSubtrees"))})),V=function(e){return B(e)},W=Object(j.a)(V,(function(){return!1})),H=Object(j.a)(V,(function(e){return De(e&&e.get("info"))})),$=Object(j.a)(V,(function(e){return De(e&&e.get("externalDocs"))})),J=Object(j.a)(H,(function(e){return e&&e.get("version")})),K=Object(j.a)(J,(function(e){var t;return l()(t=/v?([0-9]*)\.([0-9]*)\.([0-9]*)/i.exec(e)).call(t,1)})),Y=Object(j.a)(U,(function(e){return e.get("paths")})),G=Object(j.a)(Y,(function(e){if(!e||e.size<1)return Object(I.List)();var t=Object(I.List)();return e&&p()(e)?(p()(e).call(e,(function(e,n){if(!e||!p()(e))return{};p()(e).call(e,(function(e,r){var o;d()(N).call(N,r)<0||(t=t.push(Object(I.fromJS)({path:n,method:r,operation:e,id:s()(o="".concat(r,"-")).call(o,n)})))}))})),t):Object(I.List)()})),Q=Object(j.a)(V,(function(e){return Object(I.Set)(e.get("consumes"))})),Z=Object(j.a)(V,(function(e){return Object(I.Set)(e.get("produces"))})),X=Object(j.a)(V,(function(e){return e.get("security",Object(I.List)())})),ee=Object(j.a)(V,(function(e){return e.get("securityDefinitions")})),te=function(e,t){var n=e.getIn(["resolvedSubtrees","definitions",t],null),r=e.getIn(["json","definitions",t],null);return n||r||null},ne=Object(j.a)(V,(function(e){var t=e.get("definitions");return I.Map.isMap(t)?t:Object(I.Map)()})),re=Object(j.a)(V,(function(e){return e.get("basePath")})),oe=Object(j.a)(V,(function(e){return e.get("host")})),ae=Object(j.a)(V,(function(e){return e.get("schemes",Object(I.Map)())})),ie=Object(j.a)(G,Q,Z,(function(e,t,n){return v()(e).call(e,(function(e){return e.update("operation",(function(e){if(e){if(!I.Map.isMap(e))return;return e.withMutations((function(e){return e.get("consumes")||e.update("consumes",(function(e){return Object(I.Set)(e).merge(t)})),e.get("produces")||e.update("produces",(function(e){return Object(I.Set)(e).merge(n)})),e}))}return Object(I.Map)()}))}))})),ue=Object(j.a)(V,(function(e){var t=e.get("tags",Object(I.List)());return I.List.isList(t)?y()(t).call(t,(function(e){return I.Map.isMap(e)})):Object(I.List)()})),se=function(e,t){var n,r=ue(e)||Object(I.List)();return w()(n=y()(r).call(r,I.Map.isMap)).call(n,(function(e){return e.get("name")===t}),Object(I.Map)())},ce=Object(j.a)(ie,ue,(function(e,t){return _()(e).call(e,(function(e,t){var n=Object(I.Set)(t.getIn(["operation","tags"]));return n.count()<1?e.update("default",Object(I.List)(),(function(e){return e.push(t)})):_()(n).call(n,(function(e,n){return e.update(n,Object(I.List)(),(function(e){return e.push(t)}))}),e)}),_()(t).call(t,(function(e,t){return e.set(t.get("name"),Object(I.List)())}),Object(I.OrderedMap)()))})),le=function(e){return function(t){var n,r=(0,t.getConfigs)(),o=r.tagsSorter,a=r.operationsSorter;return v()(n=ce(e).sortBy((function(e,t){return t}),(function(e,t){var n="function"==typeof o?o:T.H.tagsSorter[o];return n?n(e,t):null}))).call(n,(function(t,n){var r="function"==typeof a?a:T.H.operationsSorter[a],o=r?S()(t).call(t,r):t;return Object(I.Map)({tagDetails:se(e,n),operations:o})}))}},fe=Object(j.a)(P,(function(e){return e.get("responses",Object(I.Map)())})),pe=Object(j.a)(P,(function(e){return e.get("requests",Object(I.Map)())})),he=Object(j.a)(P,(function(e){return e.get("mutatedRequests",Object(I.Map)())})),de=function(e,t,n){return fe(e).getIn([t,n],null)},me=function(e,t,n){return pe(e).getIn([t,n],null)},ve=function(e,t,n){return he(e).getIn([t,n],null)},ge=function(){return!0},ye=function(e,t,n){var r,o,a=U(e).getIn(s()(r=["paths"]).call(r,i()(t),["parameters"]),Object(I.OrderedMap)()),u=e.getIn(s()(o=["meta","paths"]).call(o,i()(t),["parameters"]),Object(I.OrderedMap)()),c=v()(a).call(a,(function(e){var t,r,o,a=u.get(s()(t="".concat(n.get("in"),".")).call(t,n.get("name"))),i=u.get(s()(r=s()(o="".concat(n.get("in"),".")).call(o,n.get("name"),".hash-")).call(r,n.hashCode()));return Object(I.OrderedMap)().merge(e,a,i)}));return w()(c).call(c,(function(e){return e.get("in")===n.get("in")&&e.get("name")===n.get("name")}),Object(I.OrderedMap)())},be=function(e,t,n,r){var o,a,u=s()(o="".concat(r,".")).call(o,n);return e.getIn(s()(a=["meta","paths"]).call(a,i()(t),["parameter_inclusions",u]),!1)},we=function(e,t,n,r){var o,a=U(e).getIn(s()(o=["paths"]).call(o,i()(t),["parameters"]),Object(I.OrderedMap)()),u=w()(a).call(a,(function(e){return e.get("in")===r&&e.get("name")===n}),Object(I.OrderedMap)());return ye(e,t,u)},xe=function(e,t,n){var r,o=U(e).getIn(["paths",t,n],Object(I.OrderedMap)()),a=e.getIn(["meta","paths",t,n],Object(I.OrderedMap)()),i=v()(r=o.get("parameters",Object(I.List)())).call(r,(function(r){return ye(e,[t,n],r)}));return Object(I.OrderedMap)().merge(o,a).set("parameters",i)};function _e(e,t,n,r){var o;t=t||[];var a=e.getIn(s()(o=["meta","paths"]).call(o,i()(t),["parameters"]),Object(I.fromJS)([]));return w()(a).call(a,(function(e){return I.Map.isMap(e)&&e.get("name")===n&&e.get("in")===r}))||Object(I.Map)()}var Ee=Object(j.a)(V,(function(e){var t=e.get("host");return"string"==typeof t&&t.length>0&&"/"!==t[0]}));function Se(e,t,n){var r;t=t||[];var o=xe.apply(void 0,s()(r=[e]).call(r,i()(t))).get("parameters",Object(I.List)());return _()(o).call(o,(function(e,t){var r=n&&"body"===t.get("in")?t.get("value_xml"):t.get("value");return e.set(Object(T.A)(t,{allowHashes:!1}),r)}),Object(I.fromJS)({}))}function ke(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(I.List.isList(e))return A()(e).call(e,(function(e){return I.Map.isMap(e)&&e.get("in")===t}))}function Ae(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(I.List.isList(e))return A()(e).call(e,(function(e){return I.Map.isMap(e)&&e.get("type")===t}))}function Oe(e,t){var n,r;t=t||[];var o=U(e).getIn(s()(n=["paths"]).call(n,i()(t)),Object(I.fromJS)({})),a=e.getIn(s()(r=["meta","paths"]).call(r,i()(t)),Object(I.fromJS)({})),u=Ce(e,t),c=o.get("parameters")||new I.List,l=a.get("consumes_value")?a.get("consumes_value"):Ae(c,"file")?"multipart/form-data":Ae(c,"formData")?"application/x-www-form-urlencoded":void 0;return Object(I.fromJS)({requestContentType:l,responseContentType:u})}function Ce(e,t){var n,r;t=t||[];var o=U(e).getIn(s()(n=["paths"]).call(n,i()(t)),null);if(null!==o){var a=e.getIn(s()(r=["meta","paths"]).call(r,i()(t),["produces_value"]),null),u=o.getIn(["produces",0],null);return a||u||"application/json"}}function je(e,t){var n;t=t||[];var r=U(e),a=r.getIn(s()(n=["paths"]).call(n,i()(t)),null);if(null!==a){var u=t,c=o()(u,1)[0],l=a.get("produces",null),f=r.getIn(["paths",c,"produces"],null),p=r.getIn(["produces"],null);return l||f||p}}function Te(e,t){var n;t=t||[];var r=U(e),a=r.getIn(s()(n=["paths"]).call(n,i()(t)),null);if(null!==a){var u=t,c=o()(u,1)[0],l=a.get("consumes",null),f=r.getIn(["paths",c,"consumes"],null),p=r.getIn(["consumes"],null);return l||f||p}}var Ie=function(e,t,n){var r=e.get("url").match(/^([a-z][a-z0-9+\-.]*):/),o=C()(r)?r[1]:null;return e.getIn(["scheme",t,n])||e.getIn(["scheme","_defaultScheme"])||o||""},Ne=function(e,t,n){var r;return d()(r=["http","https"]).call(r,Ie(e,t,n))>-1},Pe=function(e,t){var n;t=t||[];var r=e.getIn(s()(n=["meta","paths"]).call(n,i()(t),["parameters"]),Object(I.fromJS)([])),o=!0;return p()(r).call(r,(function(e){var t=e.get("errors");t&&t.count()&&(o=!1)})),o},Me=function(e,t){var n,r,o={requestBody:!1,requestContentType:{}},a=e.getIn(s()(n=["resolvedSubtrees","paths"]).call(n,i()(t),["requestBody"]),Object(I.fromJS)([]));return a.size<1||(a.getIn(["required"])&&(o.requestBody=a.getIn(["required"])),p()(r=a.getIn(["content"]).entrySeq()).call(r,(function(e){var t=e[0];if(e[1].getIn(["schema","required"])){var n=e[1].getIn(["schema","required"]).toJS();o.requestContentType[t]=n}}))),o},Re=function(e,t,n,r){var o;if((n||r)&&n===r)return!0;var a=e.getIn(s()(o=["resolvedSubtrees","paths"]).call(o,i()(t),["requestBody","content"]),Object(I.fromJS)([]));if(a.size<2||!n||!r)return!1;var u=a.getIn([n,"schema","properties"],Object(I.fromJS)([])),c=a.getIn([r,"schema","properties"],Object(I.fromJS)([]));return!!u.equals(c)};function De(e){return I.Map.isMap(e)?e:new I.Map}},function(e,t,n){"use strict";(function(t){var r=n(816),o=n(817),a=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,i=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,u=/^[a-zA-Z]:/,s=new RegExp("^[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]+");function c(e){return(e||"").toString().replace(s,"")}var l=[["#","hash"],["?","query"],function(e,t){return h(t.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],f={hash:1,query:1};function p(e){var n,r=("undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{}).location||{},o={},i=typeof(e=e||r);if("blob:"===e.protocol)o=new m(unescape(e.pathname),{});else if("string"===i)for(n in o=new m(e,{}),f)delete o[n];else if("object"===i){for(n in e)n in f||(o[n]=e[n]);void 0===o.slashes&&(o.slashes=a.test(e.href))}return o}function h(e){return"file:"===e||"ftp:"===e||"http:"===e||"https:"===e||"ws:"===e||"wss:"===e}function d(e,t){e=c(e),t=t||{};var n,r=i.exec(e),o=r[1]?r[1].toLowerCase():"",a=!!r[2],u=!!r[3],s=0;return a?u?(n=r[2]+r[3]+r[4],s=r[2].length+r[3].length):(n=r[2]+r[4],s=r[2].length):u?(n=r[3]+r[4],s=r[3].length):n=r[4],"file:"===o?s>=2&&(n=n.slice(2)):h(o)?n=r[4]:o?a&&(n=n.slice(2)):s>=2&&h(t.protocol)&&(n=r[4]),{protocol:o,slashes:a||h(o),slashesCount:s,rest:n}}function m(e,t,n){if(e=c(e),!(this instanceof m))return new m(e,t,n);var a,i,s,f,v,g,y=l.slice(),b=typeof t,w=this,x=0;for("object"!==b&&"string"!==b&&(n=t,t=null),n&&"function"!=typeof n&&(n=o.parse),a=!(i=d(e||"",t=p(t))).protocol&&!i.slashes,w.slashes=i.slashes||a&&t.slashes,w.protocol=i.protocol||t.protocol||"",e=i.rest,("file:"===i.protocol&&(2!==i.slashesCount||u.test(e))||!i.slashes&&(i.protocol||i.slashesCount<2||!h(w.protocol)))&&(y[3]=[/(.*)/,"pathname"]);x=4?[t[0],t[1],t[2],t[3],"".concat(t[0],".").concat(t[1]),"".concat(t[0],".").concat(t[2]),"".concat(t[0],".").concat(t[3]),"".concat(t[1],".").concat(t[0]),"".concat(t[1],".").concat(t[2]),"".concat(t[1],".").concat(t[3]),"".concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[1]),"".concat(t[2],".").concat(t[3]),"".concat(t[3],".").concat(t[0]),"".concat(t[3],".").concat(t[1]),"".concat(t[3],".").concat(t[2]),"".concat(t[0],".").concat(t[1],".").concat(t[2]),"".concat(t[0],".").concat(t[1],".").concat(t[3]),"".concat(t[0],".").concat(t[2],".").concat(t[1]),"".concat(t[0],".").concat(t[2],".").concat(t[3]),"".concat(t[0],".").concat(t[3],".").concat(t[1]),"".concat(t[0],".").concat(t[3],".").concat(t[2]),"".concat(t[1],".").concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[0],".").concat(t[3]),"".concat(t[1],".").concat(t[2],".").concat(t[0]),"".concat(t[1],".").concat(t[2],".").concat(t[3]),"".concat(t[1],".").concat(t[3],".").concat(t[0]),"".concat(t[1],".").concat(t[3],".").concat(t[2]),"".concat(t[2],".").concat(t[0],".").concat(t[1]),"".concat(t[2],".").concat(t[0],".").concat(t[3]),"".concat(t[2],".").concat(t[1],".").concat(t[0]),"".concat(t[2],".").concat(t[1],".").concat(t[3]),"".concat(t[2],".").concat(t[3],".").concat(t[0]),"".concat(t[2],".").concat(t[3],".").concat(t[1]),"".concat(t[3],".").concat(t[0],".").concat(t[1]),"".concat(t[3],".").concat(t[0],".").concat(t[2]),"".concat(t[3],".").concat(t[1],".").concat(t[0]),"".concat(t[3],".").concat(t[1],".").concat(t[2]),"".concat(t[3],".").concat(t[2],".").concat(t[0]),"".concat(t[3],".").concat(t[2],".").concat(t[1]),"".concat(t[0],".").concat(t[1],".").concat(t[2],".").concat(t[3]),"".concat(t[0],".").concat(t[1],".").concat(t[3],".").concat(t[2]),"".concat(t[0],".").concat(t[2],".").concat(t[1],".").concat(t[3]),"".concat(t[0],".").concat(t[2],".").concat(t[3],".").concat(t[1]),"".concat(t[0],".").concat(t[3],".").concat(t[1],".").concat(t[2]),"".concat(t[0],".").concat(t[3],".").concat(t[2],".").concat(t[1]),"".concat(t[1],".").concat(t[0],".").concat(t[2],".").concat(t[3]),"".concat(t[1],".").concat(t[0],".").concat(t[3],".").concat(t[2]),"".concat(t[1],".").concat(t[2],".").concat(t[0],".").concat(t[3]),"".concat(t[1],".").concat(t[2],".").concat(t[3],".").concat(t[0]),"".concat(t[1],".").concat(t[3],".").concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[3],".").concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[0],".").concat(t[1],".").concat(t[3]),"".concat(t[2],".").concat(t[0],".").concat(t[3],".").concat(t[1]),"".concat(t[2],".").concat(t[1],".").concat(t[0],".").concat(t[3]),"".concat(t[2],".").concat(t[1],".").concat(t[3],".").concat(t[0]),"".concat(t[2],".").concat(t[3],".").concat(t[0],".").concat(t[1]),"".concat(t[2],".").concat(t[3],".").concat(t[1],".").concat(t[0]),"".concat(t[3],".").concat(t[0],".").concat(t[1],".").concat(t[2]),"".concat(t[3],".").concat(t[0],".").concat(t[2],".").concat(t[1]),"".concat(t[3],".").concat(t[1],".").concat(t[0],".").concat(t[2]),"".concat(t[3],".").concat(t[1],".").concat(t[2],".").concat(t[0]),"".concat(t[3],".").concat(t[2],".").concat(t[0],".").concat(t[1]),"".concat(t[3],".").concat(t[2],".").concat(t[1],".").concat(t[0])]:void 0),g[r]}function b(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=e.filter((function(e){return"token"!==e})),o=y(r);return o.reduce((function(e,t){return p()({},e,n[t])}),t)}function w(e){return e.join(" ")}function x(e){var t=e.node,n=e.stylesheet,r=e.style,o=void 0===r?{}:r,a=e.useInlineStyles,i=e.key,u=t.properties,s=t.type,c=t.tagName,l=t.value;if("text"===s)return l;if(c){var f,h=function(e,t){var n=0;return function(r){return n+=1,r.map((function(r,o){return x({node:r,stylesheet:e,useInlineStyles:t,key:"code-segment-".concat(n,"-").concat(o)})}))}}(n,a);if(a){var m=Object.keys(n).reduce((function(e,t){return t.split(".").forEach((function(t){e.includes(t)||e.push(t)})),e}),[]),g=u.className&&u.className.includes("token")?["token"]:[],y=u.className&&g.concat(u.className.filter((function(e){return!m.includes(e)})));f=p()({},u,{className:w(y)||void 0,style:b(u.className,Object.assign({},u.style,o),n)})}else f=p()({},u,{className:w(u.className)});var _=h(t.children);return d.a.createElement(c,v()({key:i},f),_)}}var _=/\n/g;function E(e){var t=e.codeString,n=e.codeStyle,r=e.containerStyle,o=void 0===r?{float:"left",paddingRight:"10px"}:r,a=e.numberStyle,i=void 0===a?{}:a,u=e.startingLineNumber;return d.a.createElement("code",{style:Object.assign({},n,o)},function(e){var t=e.lines,n=e.startingLineNumber,r=e.style;return t.map((function(e,t){var o=t+n;return d.a.createElement("span",{key:"line-".concat(t),className:"react-syntax-highlighter-line-number",style:"function"==typeof r?r(o):r},"".concat(o,"\n"))}))}({lines:t.replace(/\n$/,"").split("\n"),style:i,startingLineNumber:u}))}function S(e,t){return{type:"element",tagName:"span",properties:{key:"line-number--".concat(e),className:["comment","linenumber","react-syntax-highlighter-line-number"],style:t},children:[{type:"text",value:e}]}}function k(e,t,n){var r,o={display:"inline-block",minWidth:(r=n,"".concat(r.toString().length,".25em")),paddingRight:"1em",textAlign:"right",userSelect:"none"},a="function"==typeof e?e(t):e;return p()({},o,a)}function A(e){var t=e.children,n=e.lineNumber,r=e.lineNumberStyle,o=e.largestLineNumber,a=e.showInlineLineNumbers,i=e.lineProps,u=void 0===i?{}:i,s=e.className,c=void 0===s?[]:s,l=e.showLineNumbers,f=e.wrapLongLines,h="function"==typeof u?u(n):u;if(h.className=c,n&&a){var d=k(r,n,o);t.unshift(S(n,d))}return f&l&&(h.style=p()({},h.style,{display:"flex"})),{type:"element",tagName:"span",properties:h,children:t}}function O(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=0;r2&&void 0!==arguments[2]?arguments[2]:[];return A({children:e,lineNumber:t,lineNumberStyle:u,largestLineNumber:i,showInlineLineNumbers:o,lineProps:n,className:a,showLineNumbers:r,wrapLongLines:s})}function m(e,t){if(r&&t&&o){var n=k(u,t,i);e.unshift(S(t,n))}return e}function v(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return t||r.length>0?d(e,n,r):m(e,n)}for(var g=function(){var e=l[h],t=e.children[0].value;if(t.match(_)){var n=t.split("\n");n.forEach((function(t,o){var i=r&&f.length+a,u={type:"text",value:"".concat(t,"\n")};if(0===o){var s=v(l.slice(p+1,h).concat(A({children:[u],className:e.properties.className})),i);f.push(s)}else if(o===n.length-1){if(l[h+1]&&l[h+1].children&&l[h+1].children[0]){var c=A({children:[{type:"text",value:"".concat(t)}],className:e.properties.className});l.splice(h+1,0,c)}else{var d=v([u],i,e.properties.className);f.push(d)}}else{var m=v([u],i,e.properties.className);f.push(m)}})),p=h}h++};h .hljs-title":{color:"#88C0D0"},"hljs-keyword":{color:"#81A1C1"},"hljs-literal":{color:"#81A1C1"},"hljs-symbol":{color:"#81A1C1"},"hljs-number":{color:"#B48EAD"},"hljs-regexp":{color:"#EBCB8B"},"hljs-string":{color:"#A3BE8C"},"hljs-title":{color:"#8FBCBB"},"hljs-params":{color:"#D8DEE9"},"hljs-bullet":{color:"#81A1C1"},"hljs-code":{color:"#8FBCBB"},"hljs-emphasis":{fontStyle:"italic"},"hljs-formula":{color:"#8FBCBB"},"hljs-strong":{fontWeight:"bold"},"hljs-link:hover":{textDecoration:"underline"},"hljs-quote":{color:"#4C566A"},"hljs-comment":{color:"#4C566A"},"hljs-doctag":{color:"#8FBCBB"},"hljs-meta":{color:"#5E81AC"},"hljs-meta-keyword":{color:"#5E81AC"},"hljs-meta-string":{color:"#A3BE8C"},"hljs-attr":{color:"#8FBCBB"},"hljs-attribute":{color:"#D8DEE9"},"hljs-builtin-name":{color:"#81A1C1"},"hljs-name":{color:"#81A1C1"},"hljs-section":{color:"#88C0D0"},"hljs-tag":{color:"#81A1C1"},"hljs-variable":{color:"#D8DEE9"},"hljs-template-variable":{color:"#D8DEE9"},"hljs-template-tag":{color:"#5E81AC"},"abnf .hljs-attribute":{color:"#88C0D0"},"abnf .hljs-symbol":{color:"#EBCB8B"},"apache .hljs-attribute":{color:"#88C0D0"},"apache .hljs-section":{color:"#81A1C1"},"arduino .hljs-built_in":{color:"#88C0D0"},"aspectj .hljs-meta":{color:"#D08770"},"aspectj > .hljs-title":{color:"#88C0D0"},"bnf .hljs-attribute":{color:"#8FBCBB"},"clojure .hljs-name":{color:"#88C0D0"},"clojure .hljs-symbol":{color:"#EBCB8B"},"coq .hljs-built_in":{color:"#88C0D0"},"cpp .hljs-meta-string":{color:"#8FBCBB"},"css .hljs-built_in":{color:"#88C0D0"},"css .hljs-keyword":{color:"#D08770"},"diff .hljs-meta":{color:"#8FBCBB"},"ebnf .hljs-attribute":{color:"#8FBCBB"},"glsl .hljs-built_in":{color:"#88C0D0"},"groovy .hljs-meta:not(:first-child)":{color:"#D08770"},"haxe .hljs-meta":{color:"#D08770"},"java .hljs-meta":{color:"#D08770"},"ldif .hljs-attribute":{color:"#8FBCBB"},"lisp .hljs-name":{color:"#88C0D0"},"lua .hljs-built_in":{color:"#88C0D0"},"moonscript .hljs-built_in":{color:"#88C0D0"},"nginx .hljs-attribute":{color:"#88C0D0"},"nginx .hljs-section":{color:"#5E81AC"},"pf .hljs-built_in":{color:"#88C0D0"},"processing .hljs-built_in":{color:"#88C0D0"},"scss .hljs-keyword":{color:"#81A1C1"},"stylus .hljs-keyword":{color:"#81A1C1"},"swift .hljs-meta":{color:"#D08770"},"vim .hljs-built_in":{color:"#88C0D0",fontStyle:"italic"},"yaml .hljs-meta":{color:"#D08770"}},obsidian:{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:"#282b2e",color:"#e0e2e4"},"hljs-keyword":{color:"#93c763",fontWeight:"bold"},"hljs-selector-tag":{color:"#93c763",fontWeight:"bold"},"hljs-literal":{color:"#93c763",fontWeight:"bold"},"hljs-selector-id":{color:"#93c763"},"hljs-number":{color:"#ffcd22"},"hljs-attribute":{color:"#668bb0"},"hljs-code":{color:"white"},"hljs-class .hljs-title":{color:"white"},"hljs-section":{color:"white",fontWeight:"bold"},"hljs-regexp":{color:"#d39745"},"hljs-link":{color:"#d39745"},"hljs-meta":{color:"#557182"},"hljs-tag":{color:"#8cbbad"},"hljs-name":{color:"#8cbbad",fontWeight:"bold"},"hljs-bullet":{color:"#8cbbad"},"hljs-subst":{color:"#8cbbad"},"hljs-emphasis":{color:"#8cbbad"},"hljs-type":{color:"#8cbbad",fontWeight:"bold"},"hljs-built_in":{color:"#8cbbad"},"hljs-selector-attr":{color:"#8cbbad"},"hljs-selector-pseudo":{color:"#8cbbad"},"hljs-addition":{color:"#8cbbad"},"hljs-variable":{color:"#8cbbad"},"hljs-template-tag":{color:"#8cbbad"},"hljs-template-variable":{color:"#8cbbad"},"hljs-string":{color:"#ec7600"},"hljs-symbol":{color:"#ec7600"},"hljs-comment":{color:"#818e96"},"hljs-quote":{color:"#818e96"},"hljs-deletion":{color:"#818e96"},"hljs-selector-class":{color:"#A082BD"},"hljs-doctag":{fontWeight:"bold"},"hljs-title":{fontWeight:"bold"},"hljs-strong":{fontWeight:"bold"}},"tomorrow-night":{"hljs-comment":{color:"#969896"},"hljs-quote":{color:"#969896"},"hljs-variable":{color:"#cc6666"},"hljs-template-variable":{color:"#cc6666"},"hljs-tag":{color:"#cc6666"},"hljs-name":{color:"#cc6666"},"hljs-selector-id":{color:"#cc6666"},"hljs-selector-class":{color:"#cc6666"},"hljs-regexp":{color:"#cc6666"},"hljs-deletion":{color:"#cc6666"},"hljs-number":{color:"#de935f"},"hljs-built_in":{color:"#de935f"},"hljs-builtin-name":{color:"#de935f"},"hljs-literal":{color:"#de935f"},"hljs-type":{color:"#de935f"},"hljs-params":{color:"#de935f"},"hljs-meta":{color:"#de935f"},"hljs-link":{color:"#de935f"},"hljs-attribute":{color:"#f0c674"},"hljs-string":{color:"#b5bd68"},"hljs-symbol":{color:"#b5bd68"},"hljs-bullet":{color:"#b5bd68"},"hljs-addition":{color:"#b5bd68"},"hljs-title":{color:"#81a2be"},"hljs-section":{color:"#81a2be"},"hljs-keyword":{color:"#b294bb"},"hljs-selector-tag":{color:"#b294bb"},hljs:{display:"block",overflowX:"auto",background:"#1d1f21",color:"#c5c8c6",padding:"0.5em"},"hljs-emphasis":{fontStyle:"italic"},"hljs-strong":{fontWeight:"bold"}}},X=o()(Z),ee=function(e){return i()(X).call(X,e)?Z[e]:(console.warn("Request style '".concat(e,"' is not available, returning default instead")),Q)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.File=t.Blob=t.FormData=void 0;const r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:window;t.FormData=r.FormData,t.Blob=r.Blob,t.File=r.File},function(e,t){e.exports=!0},function(e,t){},function(e,t,n){var r=n(212),o=n(62).f,a=n(70),i=n(51),u=n(470),s=n(35)("toStringTag");e.exports=function(e,t,n,c){if(e){var l=n?e:e.prototype;i(l,s)||o(l,s,{configurable:!0,value:t}),c&&!r&&a(l,"toString",u)}}},function(e,t,n){var r=n(212),o=n(139),a=n(35)("toStringTag"),i="Arguments"==o(function(){return arguments}());e.exports=r?o:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),a))?n:i?o(t):"Object"==(r=o(t))&&"function"==typeof t.callee?"Arguments":r}},function(e,t,n){"use strict";e.exports=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e}},function(e,t,n){var r=n(639);e.exports=function(e){return null==e?"":r(e)}},function(e,t){e.exports=function(e,t){return e===t||e!=e&&t!=t}},function(e,t,n){var r=n(108),o=n(48);e.exports=function(e){if(!o(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},function(e,t,n){e.exports=n(632)},function(e,t,n){e.exports=n(885)},function(e,t,n){"use strict";function r(e){return function(e){try{return!!JSON.parse(e)}catch(e){return null}}(e)?"json":null}n.d(t,"a",(function(){return r}))},function(e,t,n){e.exports=n(628)},function(e,t,n){"use strict";n.r(t),n.d(t,"UPDATE_LAYOUT",(function(){return o})),n.d(t,"UPDATE_FILTER",(function(){return a})),n.d(t,"UPDATE_MODE",(function(){return i})),n.d(t,"SHOW",(function(){return u})),n.d(t,"updateLayout",(function(){return s})),n.d(t,"updateFilter",(function(){return c})),n.d(t,"show",(function(){return l})),n.d(t,"changeMode",(function(){return f}));var r=n(5),o="layout_update_layout",a="layout_update_filter",i="layout_update_mode",u="layout_show";function s(e){return{type:o,payload:e}}function c(e){return{type:a,payload:e}}function l(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e=Object(r.v)(e),{type:u,payload:{thing:e,shown:t}}}function f(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e=Object(r.v)(e),{type:i,payload:{thing:e,mode:t}}}},function(e,t,n){var r=n(382),o=n(149),a=n(145),i=n(47),u=n(109),s=n(146),c=n(176),l=n(177),f=Object.prototype.hasOwnProperty;e.exports=function(e){if(null==e)return!0;if(u(e)&&(i(e)||"string"==typeof e||"function"==typeof e.splice||s(e)||l(e)||a(e)))return!e.length;var t=o(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(c(e))return!r(e).length;for(var n in e)if(f.call(e,n))return!1;return!0}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var r=n(56);e.exports=r("navigator","userAgent")||""},function(e,t,n){var r=n(69);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){var r,o=n(46),a=n(206),i=n(209),u=n(144),s=n(321),c=n(204),l=n(165),f=l("IE_PROTO"),p=function(){},h=function(e){return"