From 9ec0b41513f7370335fddb4b706530f6209ba74c Mon Sep 17 00:00:00 2001 From: Brian Posey <15091170+btposey@users.noreply.github.com> Date: Thu, 5 Dec 2024 17:43:19 -0500 Subject: [PATCH 01/49] Move lib up to backend directory to isolate az functions Jira ticket: CAMS-461 Co-authored-by: Fritz Madden <96319835+fmaddenflx@users.noreply.github.com> Co-authored-by: James Brooks <12275865+jamesobrooks@users.noreply.github.com> Co-authored-by: Brian Posey <15091170+btposey@users.noreply.github.com>, --- .../{functions => }/.dependency-cruiser.js | 0 backend/{functions => }/.eslintignore | 0 backend/{functions => }/.eslintrc.json | 0 backend/{functions => }/.gitignore | 0 backend/{functions => }/.prettierrc | 0 .../attorneys/attorneys.function.test.ts | 6 +++--- .../functions/attorneys/attorneys.function.ts | 2 +- .../azure/application-context-creator.test.ts | 12 +++++------ .../azure/application-context-creator.ts | 12 +++++------ backend/functions/azure/functions.test.ts | 4 ++-- backend/functions/azure/functions.ts | 10 +++++----- backend/functions/azure/testing-helpers.ts | 6 +++--- .../case.assignment.function.test.ts | 10 +++++----- .../case.assignment.function.ts | 2 +- .../case-associated.function.test.ts | 4 ++-- .../case-associated.function.ts | 2 +- .../case-docket/case-docket.function.test.ts | 10 +++++----- .../case-docket/case-docket.function.ts | 2 +- .../case-history.function.test.ts | 10 +++++----- .../case-history/case-history.function.ts | 2 +- .../case-summary.function.test.ts | 6 +++--- .../case-summary/case-summary.function.ts | 2 +- .../functions/cases/cases.function.test.ts | 6 +++--- backend/functions/cases/cases.function.ts | 2 +- .../consolidations.function.test.ts | 6 +++--- .../consolidations/consolidations.function.ts | 2 +- .../functions/courts/courts.function.test.ts | 4 ++-- backend/functions/courts/courts.function.ts | 2 +- .../healthcheck/healthcheck.db.cosmos.test.ts | 8 ++++---- .../healthcheck/healthcheck.db.cosmos.ts | 10 +++++----- .../healthcheck/healthcheck.db.sql.ts | 4 ++-- .../healthcheck/healthcheck.function.ts | 6 +++--- .../functions/healthcheck/healthcheck.info.ts | 2 +- .../functions/healthcheck/healthcheck.test.ts | 2 +- .../lib/testing/mock-data/attorneys.mock.ts | 7 ------- backend/functions/me/me.function.test.ts | 4 ++-- backend/functions/me/me.function.ts | 2 +- .../activity/flattenBoundingArrays.test.ts | 2 +- .../activity/flattenBoundingArrays.ts | 2 +- .../activity/getConsolidations.test.ts | 6 +++--- .../migration/activity/getConsolidations.ts | 6 +++--- .../migration/activity/getPageCount.test.ts | 6 +++--- .../migration/activity/getPageCount.ts | 6 +++--- .../activity/migrateConsolidation.ts | 6 +++--- .../activity/migrateConsolidations.test.ts | 6 +++--- .../client/acms-migration-trigger.function.ts | 6 +++--- .../migration/orchestration/orchestrator.ts | 2 +- .../orchestration/sub-orchestrator-etl.ts | 2 +- .../orchestration/sub-orchestrator-paging.ts | 2 +- .../functions/oauth2/mock-oauth2.function.ts | 4 ++-- .../office-staff-sync.function.test.ts | 6 +++--- .../office-staff-sync.function.ts | 2 +- .../offices/offices.function.test.ts | 4 ++-- backend/functions/offices/offices.function.ts | 2 +- .../orders-manual-sync.function.test.ts | 8 ++++---- .../orders-manual-sync.function.ts | 2 +- .../orders-suggestions.function.test.ts | 4 ++-- .../orders-suggestions.function.ts | 2 +- .../orders-sync/orders-sync.function.test.ts | 8 ++++---- .../orders-sync/orders-sync.function.ts | 2 +- .../functions/orders/orders.function.test.ts | 8 ++++---- backend/functions/orders/orders.function.ts | 2 +- backend/{functions => }/jest.config.js | 8 ++++---- .../abstract-mssql-client.exception.test.ts | 0 .../gateways/abstract-mssql-client.test.ts | 0 .../gateways/abstract-mssql-client.ts | 0 .../gateways/acms/acms.gateway.test.ts | 0 .../adapters/gateways/acms/acms.gateway.ts | 0 .../adapters/gateways/cases.local.gateway.ts | 6 +++--- .../gateways/debtor-type-gateway.test.ts | 0 .../adapters/gateways/debtor-type-gateway.ts | 0 .../dxtr/case-docket.dxtr.gateway.test.ts | 0 .../gateways/dxtr/case-docket.dxtr.gateway.ts | 2 +- .../gateways/dxtr/case-docket.mock.gateway.ts | 2 +- .../gateways/dxtr/cases.dxtr.gateway.test.ts | 4 ++-- .../gateways/dxtr/cases.dxtr.gateway.ts | 9 +++------ .../adapters/gateways/dxtr/dxtr.constants.ts | 0 .../gateways/dxtr/dxtr.gateway.helper.test.ts | 0 .../gateways/dxtr/dxtr.gateway.helper.ts | 0 .../dxtr/offices.dxtr.gateway.test.ts | 4 ++-- .../gateways/dxtr/offices.dxtr.gateway.ts | 8 ++------ .../gateways/dxtr/orders.dxtr.gateway.test.ts | 2 +- .../gateways/dxtr/orders.dxtr.gateway.ts | 4 ++-- .../adapters/gateways/gateway-helper.test.ts | 0 .../lib/adapters/gateways/gateway-helper.ts | 6 +++--- .../case-assignment.mongo.repository.test.ts | 2 +- .../mongo/case-assignment.mongo.repository.ts | 2 +- .../mongo/cases.mongo.repository.test.ts | 8 ++++---- .../gateways/mongo/cases.mongo.repository.ts | 4 ++-- .../consolidations.mongo.repository.test.ts | 2 +- .../mongo/consolidations.mongo.repository.ts | 6 +++--- .../mongo/offices.mongo.repository.test.ts | 6 +++--- .../mongo/offices.mongo.repository.ts | 8 ++++---- .../mongo/orders.mongo.repository.test.ts | 4 ++-- .../gateways/mongo/orders.mongo.repository.ts | 8 ++------ .../runtime-state.mongo.repository.test.ts | 0 .../mongo/runtime-state.mongo.repository.ts | 0 ...ser-session-cache.mongo.repository.test.ts | 4 ++-- .../user-session-cache.mongo.repository.ts | 4 ++-- .../mongo/utils/base-mongo-repository.ts | 0 .../mongo/utils/mongo-adapter.test.ts | 0 .../gateways/mongo/utils/mongo-adapter.ts | 0 .../mongo/utils/mongo-query-renderer.test.ts | 0 .../mongo/utils/mongo-query-renderer.ts | 0 .../adapters/gateways/okta/HumbleVerifier.ts | 2 +- .../gateways/okta/okta-gateway.test.ts | 2 +- .../adapters/gateways/okta/okta-gateway.ts | 4 ++-- .../okta/okta-user-group-gateway.test.ts | 2 +- .../gateways/okta/okta-user-group-gateway.ts | 2 +- .../gateways/petition-gateway.test.ts | 0 .../lib/adapters/gateways/petition-gateway.ts | 0 .../storage/local-storage-gateway.test.ts | 2 +- .../gateways/storage/local-storage-gateway.ts | 4 ++-- .../adapters/services/logger.service.test.ts | 0 .../lib/adapters/services/logger.service.ts | 0 .../lib/adapters/types/authorization.ts | 4 ++-- .../lib/adapters/types/basic.d.ts | 2 +- .../lib/adapters/types/cases.d.ts | 0 .../lib/adapters/types/database.d.ts | 0 .../lib/adapters/types/http.d.ts | 0 .../adapters/types/persistence.gateway.d.ts | 2 +- .../lib/adapters/types/region.d.ts | 0 .../lib/adapters/types/storage.ts | 4 ++-- .../adapters/utils/database.exception.test.ts | 2 +- .../lib/adapters/utils/database.test.ts | 2 +- .../lib/adapters/utils/database.ts | 0 .../lib/adapters/utils/date-helper.test.ts | 0 .../lib/adapters/utils/date-helper.ts | 0 .../lib/adapters/utils/feature-flag.test.ts | 0 .../lib/adapters/utils/feature-flag.ts | 2 +- .../lib/adapters/utils/http-response.test.ts | 0 .../lib/adapters/utils/http-response.ts | 4 ++-- .../lib/adapters/utils/string-helper.test.ts | 0 .../lib/adapters/utils/string-helper.ts | 0 .../lib/common-errors/bad-request.ts | 2 +- .../lib/common-errors/cams-error.ts | 2 +- .../lib/common-errors/common-errors.test.ts | 2 +- .../lib/common-errors/error-utilities.test.ts | 2 +- .../lib/common-errors/error-utilities.ts | 0 .../lib/common-errors/forbidden-error.ts | 2 +- .../lib/common-errors/not-found-error.ts | 2 +- .../lib/common-errors/server-config-error.ts | 2 +- .../lib/common-errors/unauthorized-error.ts | 2 +- .../lib/common-errors/unknown-error.ts | 2 +- .../configs/application-configuration.test.ts | 0 .../lib/configs/application-configuration.ts | 0 .../authorization-configuration.test.ts | 0 .../configs/authorization-configuration.ts | 4 ++-- .../user-groups-gateway-configuration.ts | 2 +- .../acms-orders.controller.test.ts | 0 .../acms-orders/acms-orders.controller.ts | 0 .../attorneys/attorneys.controller.test.ts | 2 +- .../attorneys/attorneys.controller.ts | 2 +- .../case.assignment.controller.test.ts | 10 +++++----- .../case.assignment.controller.ts | 8 ++++---- .../case-associated.controller.test.ts | 2 +- .../case-associated.controller.ts | 2 +- .../case-docket.controller.test.ts | 0 .../case-docket/case-docket.controller.ts | 2 +- .../case-history.controller.test.ts | 0 .../case-history/case-history.controller.ts | 2 +- .../case-summary.controller.test.ts | 2 +- .../case-summary/case-summary.controller.ts | 2 +- .../cases/cases.controller.test.ts | 6 +++--- .../lib/controllers/cases/cases.controller.ts | 10 +++++----- .../lib/controllers/controller.ts | 0 .../courts/courts.controller.test.ts | 2 +- .../controllers/courts/courts.controller.ts | 2 +- .../lib/controllers/me/me.controller.ts | 2 +- .../offices/offices.controller.test.ts | 2 +- .../controllers/offices/offices.controller.ts | 4 ++-- .../orders/orders.controller.test.ts | 10 +++++----- .../controllers/orders/orders.controller.ts | 6 +++--- .../lib/deferrable/defer-close.test.ts | 0 .../lib/deferrable/defer-close.ts | 0 .../lib/deferrable/defer-release.test.ts | 0 .../lib/deferrable/defer-release.ts | 0 .../deferrable/finalize-deferrable.test.ts | 0 .../lib/deferrable/finalize-deferrable.ts | 0 backend/{functions => }/lib/factory.test.ts | 0 backend/{functions => }/lib/factory.ts | 0 .../lib/humble-objects/mongo-humble.ts | 0 .../lib/query/query-builder.test.ts | 0 .../lib/query/query-builder.ts | 0 .../acms-dxtr-divisions/compare-divisions.ts | 4 ++-- .../lib/testing/analysis/export-office-csv.ts | 4 ++-- .../test-acms-migration.ts | 4 ++-- .../test-okta-group-api.ts | 2 +- .../local-data/local-cases-repository.ts | 4 ++-- .../local-consolidation-orders-repository.ts | 4 ++-- .../lib/testing/mock-data/attorneys.mock.ts | 7 +++++++ .../mock-data/cams-http-request-helper.ts | 2 +- .../mock-data/case-docket-entries.mock.ts | 2 +- .../testing/mock-data/case-history.mock.ts | 6 +++--- .../testing/mock-data/case-summaries.mock.ts | 2 +- .../lib/testing/mock-data/cases.mock.json | 0 .../mock-data/debtor-attorneys.mock.ts | 2 +- .../lib/testing/mock-data/debtors.mock.ts | 2 +- .../mock-data/generic-test-data.mock.ts | 0 .../lib/testing/mock-data/index.ts | 0 .../{functions => }/lib/testing/mock-fetch.ts | 0 .../mock-gateways/mock-attorneys.gateway.ts | 4 ++-- .../mock-gateways/mock-mongo.repository.ts | 4 ++-- .../mock-gateways/mock-oauth2-gateway.ts | 10 +++++----- .../mock-user-session-use-case.ts | 8 ++++---- .../mock-gateways/mock.offices.gateway.ts | 2 +- .../mock-gateways/mock.offices.repository.ts | 2 +- .../mock-gateways/mock.orders.gateway.ts | 4 ++-- .../lib/testing/testing-constants.ts | 0 .../lib/testing/testing-utilities.ts | 6 +++--- .../use-cases/acms-orders/acms-orders.test.ts | 12 +++++------ .../lib/use-cases/acms-orders/acms-orders.ts | 10 +++++----- .../use-cases/assignment.exception.test.ts | 2 +- .../lib/use-cases/assignment.exception.ts | 2 +- .../use-cases/attorney.gateway.interface.d.ts | 2 +- .../lib/use-cases/attorneys.test.ts | 2 +- .../lib/use-cases/attorneys.ts | 2 +- .../lib/use-cases/case-assignment.test.ts | 8 ++++---- .../lib/use-cases/case-assignment.ts | 10 +++++----- .../case-associated/case-associated.ts | 2 +- .../use-cases/case-docket/case-docket.test.ts | 0 .../lib/use-cases/case-docket/case-docket.ts | 2 +- .../case-history/case-history.test.ts | 0 .../use-cases/case-history/case-history.ts | 2 +- .../lib/use-cases/case-management.test.ts | 16 +++++++-------- .../lib/use-cases/case-management.ts | 12 +++++------ .../lib/use-cases/cases.interface.d.ts | 4 ++-- .../lib/use-cases/courts/courts.test.ts | 4 ++-- .../lib/use-cases/courts/courts.ts | 2 +- .../lib/use-cases/gateways.types.ts | 18 ++++++++--------- .../lib/use-cases/offices/offices.test.ts | 10 +++++----- .../lib/use-cases/offices/offices.ts | 4 ++-- .../lib/use-cases/offices/offices.types.ts | 2 +- .../orders-consolidation-approval.test.ts | 12 +++++------ .../orders/orders-local-gateway.test.ts | 10 +++++----- .../lib/use-cases/orders/orders.test.ts | 20 +++++++++---------- .../lib/use-cases/orders/orders.ts | 18 ++++++++--------- .../user-session/user-session.test.ts | 12 +++++------ .../use-cases/user-session/user-session.ts | 8 ++++---- backend/{functions => }/package-lock.json | 0 backend/{functions => }/package.json | 18 ++++++++--------- backend/{functions => }/tsconfig.build.json | 0 backend/{functions => }/tsconfig.json | 2 +- 243 files changed, 416 insertions(+), 427 deletions(-) rename backend/{functions => }/.dependency-cruiser.js (100%) rename backend/{functions => }/.eslintignore (100%) rename backend/{functions => }/.eslintrc.json (100%) rename backend/{functions => }/.gitignore (100%) rename backend/{functions => }/.prettierrc (100%) delete mode 100644 backend/functions/lib/testing/mock-data/attorneys.mock.ts rename backend/{functions => }/jest.config.js (84%) rename backend/{functions => }/lib/adapters/gateways/abstract-mssql-client.exception.test.ts (100%) rename backend/{functions => }/lib/adapters/gateways/abstract-mssql-client.test.ts (100%) rename backend/{functions => }/lib/adapters/gateways/abstract-mssql-client.ts (100%) rename backend/{functions => }/lib/adapters/gateways/acms/acms.gateway.test.ts (100%) rename backend/{functions => }/lib/adapters/gateways/acms/acms.gateway.ts (100%) rename backend/{functions => }/lib/adapters/gateways/cases.local.gateway.ts (94%) rename backend/{functions => }/lib/adapters/gateways/debtor-type-gateway.test.ts (100%) rename backend/{functions => }/lib/adapters/gateways/debtor-type-gateway.ts (100%) rename backend/{functions => }/lib/adapters/gateways/dxtr/case-docket.dxtr.gateway.test.ts (100%) rename backend/{functions => }/lib/adapters/gateways/dxtr/case-docket.dxtr.gateway.ts (99%) rename backend/{functions => }/lib/adapters/gateways/dxtr/case-docket.mock.gateway.ts (91%) rename backend/{functions => }/lib/adapters/gateways/dxtr/cases.dxtr.gateway.test.ts (99%) rename backend/{functions => }/lib/adapters/gateways/dxtr/cases.dxtr.gateway.ts (99%) rename backend/{functions => }/lib/adapters/gateways/dxtr/dxtr.constants.ts (100%) rename backend/{functions => }/lib/adapters/gateways/dxtr/dxtr.gateway.helper.test.ts (100%) rename backend/{functions => }/lib/adapters/gateways/dxtr/dxtr.gateway.helper.ts (100%) rename backend/{functions => }/lib/adapters/gateways/dxtr/offices.dxtr.gateway.test.ts (95%) rename backend/{functions => }/lib/adapters/gateways/dxtr/offices.dxtr.gateway.ts (95%) rename backend/{functions => }/lib/adapters/gateways/dxtr/orders.dxtr.gateway.test.ts (99%) rename backend/{functions => }/lib/adapters/gateways/dxtr/orders.dxtr.gateway.ts (99%) rename backend/{functions => }/lib/adapters/gateways/gateway-helper.test.ts (100%) rename backend/{functions => }/lib/adapters/gateways/gateway-helper.ts (86%) rename backend/{functions => }/lib/adapters/gateways/mongo/case-assignment.mongo.repository.test.ts (98%) rename backend/{functions => }/lib/adapters/gateways/mongo/case-assignment.mongo.repository.ts (97%) rename backend/{functions => }/lib/adapters/gateways/mongo/cases.mongo.repository.test.ts (95%) rename backend/{functions => }/lib/adapters/gateways/mongo/cases.mongo.repository.ts (96%) rename backend/{functions => }/lib/adapters/gateways/mongo/consolidations.mongo.repository.test.ts (98%) rename backend/{functions => }/lib/adapters/gateways/mongo/consolidations.mongo.repository.ts (93%) rename backend/{functions => }/lib/adapters/gateways/mongo/offices.mongo.repository.test.ts (93%) rename backend/{functions => }/lib/adapters/gateways/mongo/offices.mongo.repository.ts (90%) rename backend/{functions => }/lib/adapters/gateways/mongo/orders.mongo.repository.test.ts (97%) rename backend/{functions => }/lib/adapters/gateways/mongo/orders.mongo.repository.ts (94%) rename backend/{functions => }/lib/adapters/gateways/mongo/runtime-state.mongo.repository.test.ts (100%) rename backend/{functions => }/lib/adapters/gateways/mongo/runtime-state.mongo.repository.ts (100%) rename backend/{functions => }/lib/adapters/gateways/mongo/user-session-cache.mongo.repository.test.ts (95%) rename backend/{functions => }/lib/adapters/gateways/mongo/user-session-cache.mongo.repository.ts (95%) rename backend/{functions => }/lib/adapters/gateways/mongo/utils/base-mongo-repository.ts (100%) rename backend/{functions => }/lib/adapters/gateways/mongo/utils/mongo-adapter.test.ts (100%) rename backend/{functions => }/lib/adapters/gateways/mongo/utils/mongo-adapter.ts (100%) rename backend/{functions => }/lib/adapters/gateways/mongo/utils/mongo-query-renderer.test.ts (100%) rename backend/{functions => }/lib/adapters/gateways/mongo/utils/mongo-query-renderer.ts (100%) rename backend/{functions => }/lib/adapters/gateways/okta/HumbleVerifier.ts (94%) rename backend/{functions => }/lib/adapters/gateways/okta/okta-gateway.test.ts (98%) rename backend/{functions => }/lib/adapters/gateways/okta/okta-gateway.ts (95%) rename backend/{functions => }/lib/adapters/gateways/okta/okta-user-group-gateway.test.ts (99%) rename backend/{functions => }/lib/adapters/gateways/okta/okta-user-group-gateway.ts (99%) rename backend/{functions => }/lib/adapters/gateways/petition-gateway.test.ts (100%) rename backend/{functions => }/lib/adapters/gateways/petition-gateway.ts (100%) rename backend/{functions => }/lib/adapters/gateways/storage/local-storage-gateway.test.ts (93%) rename backend/{functions => }/lib/adapters/gateways/storage/local-storage-gateway.ts (96%) rename backend/{functions => }/lib/adapters/services/logger.service.test.ts (100%) rename backend/{functions => }/lib/adapters/services/logger.service.ts (100%) rename backend/{functions => }/lib/adapters/types/authorization.ts (90%) rename backend/{functions => }/lib/adapters/types/basic.d.ts (96%) rename backend/{functions => }/lib/adapters/types/cases.d.ts (100%) rename backend/{functions => }/lib/adapters/types/database.d.ts (100%) rename backend/{functions => }/lib/adapters/types/http.d.ts (100%) rename backend/{functions => }/lib/adapters/types/persistence.gateway.d.ts (95%) rename backend/{functions => }/lib/adapters/types/region.d.ts (100%) rename backend/{functions => }/lib/adapters/types/storage.ts (74%) rename backend/{functions => }/lib/adapters/utils/database.exception.test.ts (98%) rename backend/{functions => }/lib/adapters/utils/database.test.ts (97%) rename backend/{functions => }/lib/adapters/utils/database.ts (100%) rename backend/{functions => }/lib/adapters/utils/date-helper.test.ts (100%) rename backend/{functions => }/lib/adapters/utils/date-helper.ts (100%) rename backend/{functions => }/lib/adapters/utils/feature-flag.test.ts (100%) rename backend/{functions => }/lib/adapters/utils/feature-flag.ts (92%) rename backend/{functions => }/lib/adapters/utils/http-response.test.ts (100%) rename backend/{functions => }/lib/adapters/utils/http-response.ts (82%) rename backend/{functions => }/lib/adapters/utils/string-helper.test.ts (100%) rename backend/{functions => }/lib/adapters/utils/string-helper.ts (100%) rename backend/{functions => }/lib/common-errors/bad-request.ts (84%) rename backend/{functions => }/lib/common-errors/cams-error.ts (90%) rename backend/{functions => }/lib/common-errors/common-errors.test.ts (96%) rename backend/{functions => }/lib/common-errors/error-utilities.test.ts (91%) rename backend/{functions => }/lib/common-errors/error-utilities.ts (100%) rename backend/{functions => }/lib/common-errors/forbidden-error.ts (85%) rename backend/{functions => }/lib/common-errors/not-found-error.ts (88%) rename backend/{functions => }/lib/common-errors/server-config-error.ts (86%) rename backend/{functions => }/lib/common-errors/unauthorized-error.ts (84%) rename backend/{functions => }/lib/common-errors/unknown-error.ts (85%) rename backend/{functions => }/lib/configs/application-configuration.test.ts (100%) rename backend/{functions => }/lib/configs/application-configuration.ts (100%) rename backend/{functions => }/lib/configs/authorization-configuration.test.ts (100%) rename backend/{functions => }/lib/configs/authorization-configuration.ts (89%) rename backend/{functions => }/lib/configs/user-groups-gateway-configuration.ts (90%) rename backend/{functions => }/lib/controllers/acms-orders/acms-orders.controller.test.ts (100%) rename backend/{functions => }/lib/controllers/acms-orders/acms-orders.controller.ts (100%) rename backend/{functions => }/lib/controllers/attorneys/attorneys.controller.test.ts (95%) rename backend/{functions => }/lib/controllers/attorneys/attorneys.controller.ts (94%) rename backend/{functions => }/lib/controllers/case-assignment/case.assignment.controller.test.ts (95%) rename backend/{functions => }/lib/controllers/case-assignment/case.assignment.controller.ts (91%) rename backend/{functions => }/lib/controllers/case-associated/case-associated.controller.test.ts (96%) rename backend/{functions => }/lib/controllers/case-associated/case-associated.controller.ts (93%) rename backend/{functions => }/lib/controllers/case-docket/case-docket.controller.test.ts (100%) rename backend/{functions => }/lib/controllers/case-docket/case-docket.controller.ts (95%) rename backend/{functions => }/lib/controllers/case-history/case-history.controller.test.ts (100%) rename backend/{functions => }/lib/controllers/case-history/case-history.controller.ts (94%) rename backend/{functions => }/lib/controllers/case-summary/case-summary.controller.test.ts (95%) rename backend/{functions => }/lib/controllers/case-summary/case-summary.controller.ts (94%) rename backend/{functions => }/lib/controllers/cases/cases.controller.test.ts (98%) rename backend/{functions => }/lib/controllers/cases/cases.controller.ts (90%) rename backend/{functions => }/lib/controllers/controller.ts (100%) rename backend/{functions => }/lib/controllers/courts/courts.controller.test.ts (96%) rename backend/{functions => }/lib/controllers/courts/courts.controller.ts (93%) rename backend/{functions => }/lib/controllers/me/me.controller.ts (92%) rename backend/{functions => }/lib/controllers/offices/offices.controller.test.ts (98%) rename backend/{functions => }/lib/controllers/offices/offices.controller.ts (92%) rename backend/{functions => }/lib/controllers/orders/orders.controller.test.ts (97%) rename backend/{functions => }/lib/controllers/orders/orders.controller.ts (97%) rename backend/{functions => }/lib/deferrable/defer-close.test.ts (100%) rename backend/{functions => }/lib/deferrable/defer-close.ts (100%) rename backend/{functions => }/lib/deferrable/defer-release.test.ts (100%) rename backend/{functions => }/lib/deferrable/defer-release.ts (100%) rename backend/{functions => }/lib/deferrable/finalize-deferrable.test.ts (100%) rename backend/{functions => }/lib/deferrable/finalize-deferrable.ts (100%) rename backend/{functions => }/lib/factory.test.ts (100%) rename backend/{functions => }/lib/factory.ts (100%) rename backend/{functions => }/lib/humble-objects/mongo-humble.ts (100%) rename backend/{functions => }/lib/query/query-builder.test.ts (100%) rename backend/{functions => }/lib/query/query-builder.ts (100%) rename backend/{functions => }/lib/testing/analysis/acms-dxtr-divisions/compare-divisions.ts (99%) rename backend/{functions => }/lib/testing/analysis/export-office-csv.ts (91%) rename backend/{functions => }/lib/testing/isolated-integration/test-acms-migration.ts (77%) rename backend/{functions => }/lib/testing/isolated-integration/test-okta-group-api.ts (95%) rename backend/{functions => }/lib/testing/local-data/local-cases-repository.ts (94%) rename backend/{functions => }/lib/testing/local-data/local-consolidation-orders-repository.ts (88%) create mode 100644 backend/lib/testing/mock-data/attorneys.mock.ts rename backend/{functions => }/lib/testing/mock-data/cams-http-request-helper.ts (84%) rename backend/{functions => }/lib/testing/mock-data/case-docket-entries.mock.ts (99%) rename backend/{functions => }/lib/testing/mock-data/case-history.mock.ts (94%) rename backend/{functions => }/lib/testing/mock-data/case-summaries.mock.ts (91%) rename backend/{functions => }/lib/testing/mock-data/cases.mock.json (100%) rename backend/{functions => }/lib/testing/mock-data/debtor-attorneys.mock.ts (97%) rename backend/{functions => }/lib/testing/mock-data/debtors.mock.ts (97%) rename backend/{functions => }/lib/testing/mock-data/generic-test-data.mock.ts (100%) rename backend/{functions => }/lib/testing/mock-data/index.ts (100%) rename backend/{functions => }/lib/testing/mock-fetch.ts (100%) rename backend/{functions => }/lib/testing/mock-gateways/mock-attorneys.gateway.ts (81%) rename backend/{functions => }/lib/testing/mock-gateways/mock-mongo.repository.ts (96%) rename backend/{functions => }/lib/testing/mock-gateways/mock-oauth2-gateway.ts (86%) rename backend/{functions => }/lib/testing/mock-gateways/mock-user-session-use-case.ts (78%) rename backend/{functions => }/lib/testing/mock-gateways/mock.offices.gateway.ts (96%) rename backend/{functions => }/lib/testing/mock-gateways/mock.offices.repository.ts (68%) rename backend/{functions => }/lib/testing/mock-gateways/mock.orders.gateway.ts (76%) rename backend/{functions => }/lib/testing/testing-constants.ts (100%) rename backend/{functions => }/lib/testing/testing-utilities.ts (86%) rename backend/{functions => }/lib/use-cases/acms-orders/acms-orders.test.ts (97%) rename backend/{functions => }/lib/use-cases/acms-orders/acms-orders.ts (95%) rename backend/{functions => }/lib/use-cases/assignment.exception.test.ts (84%) rename backend/{functions => }/lib/use-cases/assignment.exception.ts (84%) rename backend/{functions => }/lib/use-cases/attorney.gateway.interface.d.ts (81%) rename backend/{functions => }/lib/use-cases/attorneys.test.ts (94%) rename backend/{functions => }/lib/use-cases/attorneys.ts (93%) rename backend/{functions => }/lib/use-cases/case-assignment.test.ts (96%) rename backend/{functions => }/lib/use-cases/case-assignment.ts (94%) rename backend/{functions => }/lib/use-cases/case-associated/case-associated.ts (95%) rename backend/{functions => }/lib/use-cases/case-docket/case-docket.test.ts (100%) rename backend/{functions => }/lib/use-cases/case-docket/case-docket.ts (87%) rename backend/{functions => }/lib/use-cases/case-history/case-history.test.ts (100%) rename backend/{functions => }/lib/use-cases/case-history/case-history.ts (85%) rename backend/{functions => }/lib/use-cases/case-management.test.ts (96%) rename backend/{functions => }/lib/use-cases/case-management.ts (92%) rename backend/{functions => }/lib/use-cases/cases.interface.d.ts (76%) rename backend/{functions => }/lib/use-cases/courts/courts.test.ts (87%) rename backend/{functions => }/lib/use-cases/courts/courts.ts (92%) rename backend/{functions => }/lib/use-cases/gateways.types.ts (89%) rename backend/{functions => }/lib/use-cases/offices/offices.test.ts (95%) rename backend/{functions => }/lib/use-cases/offices/offices.ts (97%) rename backend/{functions => }/lib/use-cases/offices/offices.types.ts (77%) rename backend/{functions => }/lib/use-cases/orders/orders-consolidation-approval.test.ts (96%) rename backend/{functions => }/lib/use-cases/orders/orders-local-gateway.test.ts (94%) rename backend/{functions => }/lib/use-cases/orders/orders.test.ts (97%) rename backend/{functions => }/lib/use-cases/orders/orders.ts (96%) rename backend/{functions => }/lib/use-cases/user-session/user-session.test.ts (93%) rename backend/{functions => }/lib/use-cases/user-session/user-session.ts (89%) rename backend/{functions => }/package-lock.json (100%) rename backend/{functions => }/package.json (74%) rename backend/{functions => }/tsconfig.build.json (100%) rename backend/{functions => }/tsconfig.json (81%) diff --git a/backend/functions/.dependency-cruiser.js b/backend/.dependency-cruiser.js similarity index 100% rename from backend/functions/.dependency-cruiser.js rename to backend/.dependency-cruiser.js diff --git a/backend/functions/.eslintignore b/backend/.eslintignore similarity index 100% rename from backend/functions/.eslintignore rename to backend/.eslintignore diff --git a/backend/functions/.eslintrc.json b/backend/.eslintrc.json similarity index 100% rename from backend/functions/.eslintrc.json rename to backend/.eslintrc.json diff --git a/backend/functions/.gitignore b/backend/.gitignore similarity index 100% rename from backend/functions/.gitignore rename to backend/.gitignore diff --git a/backend/functions/.prettierrc b/backend/.prettierrc similarity index 100% rename from backend/functions/.prettierrc rename to backend/.prettierrc diff --git a/backend/functions/attorneys/attorneys.function.test.ts b/backend/functions/attorneys/attorneys.function.test.ts index f0375b9c8..18db41b8e 100644 --- a/backend/functions/attorneys/attorneys.function.test.ts +++ b/backend/functions/attorneys/attorneys.function.test.ts @@ -1,12 +1,12 @@ -import { AttorneysController } from '../lib/controllers/attorneys/attorneys.controller'; -import { CamsError } from '../lib/common-errors/cams-error'; +import { AttorneysController } from '../../lib/controllers/attorneys/attorneys.controller'; +import { CamsError } from '../../lib/common-errors/cams-error'; import { MockData } from '../../../common/src/cams/test-utilities/mock-data'; import { buildTestResponseError, buildTestResponseSuccess, createMockAzureFunctionRequest, } from '../azure/testing-helpers'; -import AttorneyList from '../lib/use-cases/attorneys'; +import AttorneyList from '../../lib/use-cases/attorneys'; import handler from './attorneys.function'; import { InvocationContext } from '@azure/functions'; import { ResponseBody } from '../../../common/src/api/response'; diff --git a/backend/functions/attorneys/attorneys.function.ts b/backend/functions/attorneys/attorneys.function.ts index 802e1aac4..f481f02d3 100644 --- a/backend/functions/attorneys/attorneys.function.ts +++ b/backend/functions/attorneys/attorneys.function.ts @@ -1,6 +1,6 @@ import * as dotenv from 'dotenv'; import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions'; -import { AttorneysController } from '../lib/controllers/attorneys/attorneys.controller'; +import { AttorneysController } from '../../lib/controllers/attorneys/attorneys.controller'; import { initializeApplicationInsights } from '../azure/app-insights'; import { toAzureError, toAzureSuccess } from '../azure/functions'; import ContextCreator from '../azure/application-context-creator'; diff --git a/backend/functions/azure/application-context-creator.test.ts b/backend/functions/azure/application-context-creator.test.ts index 15e76a094..483cea9b1 100644 --- a/backend/functions/azure/application-context-creator.test.ts +++ b/backend/functions/azure/application-context-creator.test.ts @@ -1,13 +1,13 @@ import MockData from '../../../common/src/cams/test-utilities/mock-data'; -import { ApplicationContext } from '../lib/adapters/types/basic'; -import * as FeatureFlags from '../lib/adapters/utils/feature-flag'; -import { ApplicationConfiguration } from '../lib/configs/application-configuration'; -import { MockUserSessionUseCase } from '../lib/testing/mock-gateways/mock-user-session-use-case'; -import { createMockApplicationContext } from '../lib/testing/testing-utilities'; +import { ApplicationContext } from '../../lib/adapters/types/basic'; +import * as FeatureFlags from '../../lib/adapters/utils/feature-flag'; +import { ApplicationConfiguration } from '../../lib/configs/application-configuration'; +import { MockUserSessionUseCase } from '../../lib/testing/mock-gateways/mock-user-session-use-case'; +import { createMockApplicationContext } from '../../lib/testing/testing-utilities'; import ContextCreator from './application-context-creator'; import { createMockAzureFunctionContext, createMockAzureFunctionRequest } from './testing-helpers'; import { azureToCamsHttpRequest } from './functions'; -import { LoggerImpl } from '../lib/adapters/services/logger.service'; +import { LoggerImpl } from '../../lib/adapters/services/logger.service'; describe('Application Context Creator', () => { describe('applicationContextCreator', () => { diff --git a/backend/functions/azure/application-context-creator.ts b/backend/functions/azure/application-context-creator.ts index adbfdeeb3..861b4374c 100644 --- a/backend/functions/azure/application-context-creator.ts +++ b/backend/functions/azure/application-context-creator.ts @@ -1,12 +1,12 @@ import * as jwt from 'jsonwebtoken'; import { InvocationContext, HttpRequest } from '@azure/functions'; -import { ApplicationContext } from '../lib/adapters/types/basic'; -import { ApplicationConfiguration } from '../lib/configs/application-configuration'; -import { getFeatureFlags } from '../lib/adapters/utils/feature-flag'; -import { LoggerImpl } from '../lib/adapters/services/logger.service'; +import { ApplicationContext } from '../../lib/adapters/types/basic'; +import { ApplicationConfiguration } from '../../lib/configs/application-configuration'; +import { getFeatureFlags } from '../../lib/adapters/utils/feature-flag'; +import { LoggerImpl } from '../../lib/adapters/services/logger.service'; import { azureToCamsHttpRequest } from './functions'; -import { UnauthorizedError } from '../lib/common-errors/unauthorized-error'; -import { getUserSessionUseCase } from '../lib/factory'; +import { UnauthorizedError } from '../../lib/common-errors/unauthorized-error'; +import { getUserSessionUseCase } from '../../lib/factory'; const MODULE_NAME = 'APPLICATION-CONTEXT-CREATOR'; diff --git a/backend/functions/azure/functions.test.ts b/backend/functions/azure/functions.test.ts index ddfa3cc44..c8c2a1e16 100644 --- a/backend/functions/azure/functions.test.ts +++ b/backend/functions/azure/functions.test.ts @@ -1,7 +1,7 @@ import { azureToCamsHttpRequest, toAzureSuccess } from './functions'; import { HttpRequest, HttpResponseInit } from '@azure/functions'; -import { CamsHttpRequest } from '../lib/adapters/types/http'; -import { CamsHttpResponseInit } from '../lib/adapters/utils/http-response'; +import { CamsHttpRequest } from '../../lib/adapters/types/http'; +import { CamsHttpResponseInit } from '../../lib/adapters/utils/http-response'; describe('functions test', () => { test('should return properly formatted CamsHttpRequest from malformed headers and query', async () => { diff --git a/backend/functions/azure/functions.ts b/backend/functions/azure/functions.ts index e655342b1..58d7e73df 100644 --- a/backend/functions/azure/functions.ts +++ b/backend/functions/azure/functions.ts @@ -1,9 +1,9 @@ import { HttpRequest, HttpResponseInit } from '@azure/functions'; -import { CamsDict, CamsHttpMethod, CamsHttpRequest } from '../lib/adapters/types/http'; -import { CamsHttpResponseInit, commonHeaders } from '../lib/adapters/utils/http-response'; -import { ApplicationContext } from '../lib/adapters/types/basic'; -import { getCamsError } from '../lib/common-errors/error-utilities'; -import { LoggerImpl } from '../lib/adapters/services/logger.service'; +import { CamsDict, CamsHttpMethod, CamsHttpRequest } from '../../lib/adapters/types/http'; +import { CamsHttpResponseInit, commonHeaders } from '../../lib/adapters/utils/http-response'; +import { ApplicationContext } from '../../lib/adapters/types/basic'; +import { getCamsError } from '../../lib/common-errors/error-utilities'; +import { LoggerImpl } from '../../lib/adapters/services/logger.service'; function azureToCamsDict(it: Iterable<[string, string]>): CamsDict { if (!it) return {}; diff --git a/backend/functions/azure/testing-helpers.ts b/backend/functions/azure/testing-helpers.ts index 290e4aa80..1b51e1cec 100644 --- a/backend/functions/azure/testing-helpers.ts +++ b/backend/functions/azure/testing-helpers.ts @@ -1,10 +1,10 @@ import { HttpRequest, InvocationContext } from '@azure/functions'; import { randomUUID } from 'node:crypto'; -import { CamsHttpRequest } from '../lib/adapters/types/http'; +import { CamsHttpRequest } from '../../lib/adapters/types/http'; import MockData from '../../../common/src/cams/test-utilities/mock-data'; -import { httpSuccess } from '../lib/adapters/utils/http-response'; +import { httpSuccess } from '../../lib/adapters/utils/http-response'; import { toAzureError, toAzureSuccess } from './functions'; -import { ApplicationContext } from '../lib/adapters/types/basic'; +import { ApplicationContext } from '../../lib/adapters/types/basic'; import { ResponseBody } from '../../../common/src/api/response'; export function createMockAzureFunctionContext( diff --git a/backend/functions/case-assignments/case.assignment.function.test.ts b/backend/functions/case-assignments/case.assignment.function.test.ts index 0b08f5710..2f9d787a8 100644 --- a/backend/functions/case-assignments/case.assignment.function.test.ts +++ b/backend/functions/case-assignments/case.assignment.function.test.ts @@ -1,18 +1,18 @@ import handler from './case.assignment.function'; -import { CaseAssignmentController } from '../lib/controllers/case-assignment/case.assignment.controller'; +import { CaseAssignmentController } from '../../lib/controllers/case-assignment/case.assignment.controller'; import ContextCreator from '../azure/application-context-creator'; import { CaseAssignment } from '../../../common/src/cams/assignments'; import { MockData } from '../../../common/src/cams/test-utilities/mock-data'; -import { CamsHttpRequest } from '../lib/adapters/types/http'; +import { CamsHttpRequest } from '../../lib/adapters/types/http'; import { InvocationContext } from '@azure/functions'; -import { createMockApplicationContext } from '../lib/testing/testing-utilities'; +import { createMockApplicationContext } from '../../lib/testing/testing-utilities'; import { buildTestResponseError, buildTestResponseSuccess, createMockAzureFunctionRequest, } from '../azure/testing-helpers'; -import { CamsError } from '../lib/common-errors/cams-error'; -import { UnknownError } from '../lib/common-errors/unknown-error'; +import { CamsError } from '../../lib/common-errors/cams-error'; +import { UnknownError } from '../../lib/common-errors/unknown-error'; import HttpStatusCodes from '../../../common/src/api/http-status-codes'; describe('Case Assignment Function Tests', () => { diff --git a/backend/functions/case-assignments/case.assignment.function.ts b/backend/functions/case-assignments/case.assignment.function.ts index 62f75fce0..7b74817a3 100644 --- a/backend/functions/case-assignments/case.assignment.function.ts +++ b/backend/functions/case-assignments/case.assignment.function.ts @@ -1,5 +1,5 @@ import { app, InvocationContext, HttpRequest, HttpResponseInit } from '@azure/functions'; -import { CaseAssignmentController } from '../lib/controllers/case-assignment/case.assignment.controller'; +import { CaseAssignmentController } from '../../lib/controllers/case-assignment/case.assignment.controller'; import ContextCreator from '../azure/application-context-creator'; import { initializeApplicationInsights } from '../azure/app-insights'; import { toAzureError, toAzureSuccess } from '../azure/functions'; diff --git a/backend/functions/case-associated/case-associated.function.test.ts b/backend/functions/case-associated/case-associated.function.test.ts index fa585f15b..ef6990542 100644 --- a/backend/functions/case-associated/case-associated.function.test.ts +++ b/backend/functions/case-associated/case-associated.function.test.ts @@ -1,5 +1,5 @@ -import { NotFoundError } from '../lib/common-errors/not-found-error'; -import { CaseAssociatedController } from '../lib/controllers/case-associated/case-associated.controller'; +import { NotFoundError } from '../../lib/common-errors/not-found-error'; +import { CaseAssociatedController } from '../../lib/controllers/case-associated/case-associated.controller'; import handler from './case-associated.function'; import ContextCreator from '../azure/application-context-creator'; import MockData from '../../../common/src/cams/test-utilities/mock-data'; diff --git a/backend/functions/case-associated/case-associated.function.ts b/backend/functions/case-associated/case-associated.function.ts index ded7a8332..7ea3d55e0 100644 --- a/backend/functions/case-associated/case-associated.function.ts +++ b/backend/functions/case-associated/case-associated.function.ts @@ -2,7 +2,7 @@ import * as dotenv from 'dotenv'; import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions'; import ContextCreator from '../azure/application-context-creator'; import { initializeApplicationInsights } from '../azure/app-insights'; -import { CaseAssociatedController } from '../lib/controllers/case-associated/case-associated.controller'; +import { CaseAssociatedController } from '../../lib/controllers/case-associated/case-associated.controller'; import { toAzureError, toAzureSuccess } from '../azure/functions'; dotenv.config(); diff --git a/backend/functions/case-docket/case-docket.function.test.ts b/backend/functions/case-docket/case-docket.function.test.ts index 17d8efc66..c4154f65c 100644 --- a/backend/functions/case-docket/case-docket.function.test.ts +++ b/backend/functions/case-docket/case-docket.function.test.ts @@ -1,15 +1,15 @@ import handler from './case-docket.function'; -import { DXTR_CASE_DOCKET_ENTRIES } from '../lib/testing/mock-data/case-docket-entries.mock'; -import { NORMAL_CASE_ID, NOT_FOUND_ERROR_CASE_ID } from '../lib/testing/testing-constants'; +import { DXTR_CASE_DOCKET_ENTRIES } from '../../lib/testing/mock-data/case-docket-entries.mock'; +import { NORMAL_CASE_ID, NOT_FOUND_ERROR_CASE_ID } from '../../lib/testing/testing-constants'; import { InvocationContext } from '@azure/functions'; -import { CamsHttpRequest } from '../lib/adapters/types/http'; +import { CamsHttpRequest } from '../../lib/adapters/types/http'; import { buildTestResponseError, buildTestResponseSuccess, createMockAzureFunctionRequest, } from '../azure/testing-helpers'; -import { CaseDocketController } from '../lib/controllers/case-docket/case-docket.controller'; -import { NotFoundError } from '../lib/common-errors/not-found-error'; +import { CaseDocketController } from '../../lib/controllers/case-docket/case-docket.controller'; +import { NotFoundError } from '../../lib/common-errors/not-found-error'; import { CaseDocket } from '../../../common/src/cams/cases'; describe('Case docket function', () => { diff --git a/backend/functions/case-docket/case-docket.function.ts b/backend/functions/case-docket/case-docket.function.ts index 1aad04740..989b001b1 100644 --- a/backend/functions/case-docket/case-docket.function.ts +++ b/backend/functions/case-docket/case-docket.function.ts @@ -1,7 +1,7 @@ import * as dotenv from 'dotenv'; import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions'; import ContextCreator from '../azure/application-context-creator'; -import { CaseDocketController } from '../lib/controllers/case-docket/case-docket.controller'; +import { CaseDocketController } from '../../lib/controllers/case-docket/case-docket.controller'; import { initializeApplicationInsights } from '../azure/app-insights'; import { toAzureError, toAzureSuccess } from '../azure/functions'; diff --git a/backend/functions/case-history/case-history.function.test.ts b/backend/functions/case-history/case-history.function.test.ts index 5f4198cdc..39dd2b45a 100644 --- a/backend/functions/case-history/case-history.function.test.ts +++ b/backend/functions/case-history/case-history.function.test.ts @@ -1,12 +1,12 @@ -import { CASE_HISTORY } from '../lib/testing/mock-data/case-history.mock'; -import { NORMAL_CASE_ID, NOT_FOUND_ERROR_CASE_ID } from '../lib/testing/testing-constants'; -import { NotFoundError } from '../lib/common-errors/not-found-error'; -import { CamsHttpRequest } from '../lib/adapters/types/http'; +import { CASE_HISTORY } from '../../lib/testing/mock-data/case-history.mock'; +import { NORMAL_CASE_ID, NOT_FOUND_ERROR_CASE_ID } from '../../lib/testing/testing-constants'; +import { NotFoundError } from '../../lib/common-errors/not-found-error'; +import { CamsHttpRequest } from '../../lib/adapters/types/http'; import { InvocationContext } from '@azure/functions'; import handler from './case-history.function'; import ContextCreator from '../azure/application-context-creator'; import MockData from '../../../common/src/cams/test-utilities/mock-data'; -import { CaseHistoryController } from '../lib/controllers/case-history/case-history.controller'; +import { CaseHistoryController } from '../../lib/controllers/case-history/case-history.controller'; import { buildTestResponseError, buildTestResponseSuccess, diff --git a/backend/functions/case-history/case-history.function.ts b/backend/functions/case-history/case-history.function.ts index 69ffec218..a4f9d1ca7 100644 --- a/backend/functions/case-history/case-history.function.ts +++ b/backend/functions/case-history/case-history.function.ts @@ -1,7 +1,7 @@ import * as dotenv from 'dotenv'; import { app, InvocationContext, HttpRequest, HttpResponseInit } from '@azure/functions'; import ContextCreator from '../azure/application-context-creator'; -import { CaseHistoryController } from '../lib/controllers/case-history/case-history.controller'; +import { CaseHistoryController } from '../../lib/controllers/case-history/case-history.controller'; import { initializeApplicationInsights } from '../azure/app-insights'; import { toAzureError, toAzureSuccess } from '../azure/functions'; diff --git a/backend/functions/case-summary/case-summary.function.test.ts b/backend/functions/case-summary/case-summary.function.test.ts index 40ee2fda9..82fd95a5a 100644 --- a/backend/functions/case-summary/case-summary.function.test.ts +++ b/backend/functions/case-summary/case-summary.function.test.ts @@ -1,7 +1,7 @@ import { InvocationContext } from '@azure/functions'; import { CaseDetail } from '../../../common/src/cams/cases'; import { MockData } from '../../../common/src/cams/test-utilities/mock-data'; -import { NotFoundError } from '../lib/common-errors/not-found-error'; +import { NotFoundError } from '../../lib/common-errors/not-found-error'; import handler from './case-summary.function'; import ContextCreator from '../azure/application-context-creator'; import { @@ -9,8 +9,8 @@ import { buildTestResponseSuccess, createMockAzureFunctionRequest, } from '../azure/testing-helpers'; -import { CamsHttpRequest } from '../lib/adapters/types/http'; -import { CaseSummaryController } from '../lib/controllers/case-summary/case-summary.controller'; +import { CamsHttpRequest } from '../../lib/adapters/types/http'; +import { CaseSummaryController } from '../../lib/controllers/case-summary/case-summary.controller'; describe('Case summary function', () => { jest diff --git a/backend/functions/case-summary/case-summary.function.ts b/backend/functions/case-summary/case-summary.function.ts index 81204a5f7..44ddbc8ab 100644 --- a/backend/functions/case-summary/case-summary.function.ts +++ b/backend/functions/case-summary/case-summary.function.ts @@ -3,7 +3,7 @@ import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/fu import ContextCreator from '../azure/application-context-creator'; import { initializeApplicationInsights } from '../azure/app-insights'; import { toAzureError, toAzureSuccess } from '../azure/functions'; -import { CaseSummaryController } from '../lib/controllers/case-summary/case-summary.controller'; +import { CaseSummaryController } from '../../lib/controllers/case-summary/case-summary.controller'; dotenv.config(); diff --git a/backend/functions/cases/cases.function.test.ts b/backend/functions/cases/cases.function.test.ts index c3cc1db1b..1b45c208d 100644 --- a/backend/functions/cases/cases.function.test.ts +++ b/backend/functions/cases/cases.function.test.ts @@ -1,13 +1,13 @@ import handler from './cases.function'; import { buildTestResponseSuccess, createMockAzureFunctionRequest } from '../azure/testing-helpers'; -import { CasesController } from '../lib/controllers/cases/cases.controller'; +import { CasesController } from '../../lib/controllers/cases/cases.controller'; import ContextCreator from '../azure/application-context-creator'; import MockData from '../../../common/src/cams/test-utilities/mock-data'; import { InvocationContext } from '@azure/functions'; import { ResourceActions } from '../../../common/src/cams/actions'; import { CaseDetail } from '../../../common/src/cams/cases'; -import { commonHeaders } from '../lib/adapters/utils/http-response'; -import { CamsError } from '../lib/common-errors/cams-error'; +import { commonHeaders } from '../../lib/adapters/utils/http-response'; +import { CamsError } from '../../lib/common-errors/cams-error'; describe('Cases function', () => { jest diff --git a/backend/functions/cases/cases.function.ts b/backend/functions/cases/cases.function.ts index aaebe6a91..428f65817 100644 --- a/backend/functions/cases/cases.function.ts +++ b/backend/functions/cases/cases.function.ts @@ -1,6 +1,6 @@ import * as dotenv from 'dotenv'; import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions'; -import { CasesController } from '../lib/controllers/cases/cases.controller'; +import { CasesController } from '../../lib/controllers/cases/cases.controller'; import ContextCreator from '../azure/application-context-creator'; import { initializeApplicationInsights } from '../azure/app-insights'; import { toAzureError, toAzureSuccess } from '../azure/functions'; diff --git a/backend/functions/consolidations/consolidations.function.test.ts b/backend/functions/consolidations/consolidations.function.test.ts index 655c7f619..07ad5eaf2 100644 --- a/backend/functions/consolidations/consolidations.function.test.ts +++ b/backend/functions/consolidations/consolidations.function.test.ts @@ -1,6 +1,6 @@ import { MockData } from '../../../common/src/cams/test-utilities/mock-data'; import handler from './consolidations.function'; -import { CamsHttpRequest } from '../lib/adapters/types/http'; +import { CamsHttpRequest } from '../../lib/adapters/types/http'; import ContextCreator from '../azure/application-context-creator'; import { buildTestResponseError, @@ -8,9 +8,9 @@ import { createMockAzureFunctionContext, createMockAzureFunctionRequest, } from '../azure/testing-helpers'; -import { OrdersController } from '../lib/controllers/orders/orders.controller'; +import { OrdersController } from '../../lib/controllers/orders/orders.controller'; import { ConsolidationOrder } from '../../../common/src/cams/orders'; -import { BadRequestError } from '../lib/common-errors/bad-request'; +import { BadRequestError } from '../../lib/common-errors/bad-request'; describe('Consolidations Function tests', () => { const defaultRequestProps: Partial = { diff --git a/backend/functions/consolidations/consolidations.function.ts b/backend/functions/consolidations/consolidations.function.ts index 8850455d8..1b3ee1646 100644 --- a/backend/functions/consolidations/consolidations.function.ts +++ b/backend/functions/consolidations/consolidations.function.ts @@ -2,7 +2,7 @@ import * as dotenv from 'dotenv'; import { initializeApplicationInsights } from '../azure/app-insights'; import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions'; import ContextCreator from '../azure/application-context-creator'; -import { OrdersController } from '../lib/controllers/orders/orders.controller'; +import { OrdersController } from '../../lib/controllers/orders/orders.controller'; import { toAzureError, toAzureSuccess } from '../azure/functions'; dotenv.config(); diff --git a/backend/functions/courts/courts.function.test.ts b/backend/functions/courts/courts.function.test.ts index a45286d01..a46aa03bc 100644 --- a/backend/functions/courts/courts.function.test.ts +++ b/backend/functions/courts/courts.function.test.ts @@ -1,4 +1,4 @@ -import { CamsError } from '../lib/common-errors/cams-error'; +import { CamsError } from '../../lib/common-errors/cams-error'; import handler from './courts.function'; import { buildTestResponseError, @@ -6,7 +6,7 @@ import { createMockAzureFunctionContext, createMockAzureFunctionRequest, } from '../azure/testing-helpers'; -import { CourtsController } from '../lib/controllers/courts/courts.controller'; +import { CourtsController } from '../../lib/controllers/courts/courts.controller'; import { CourtDivisionDetails } from '../../../common/src/cams/courts'; import { COURT_DIVISIONS } from '../../../common/src/cams/test-utilities/courts.mock'; diff --git a/backend/functions/courts/courts.function.ts b/backend/functions/courts/courts.function.ts index a97ad560c..20687d927 100644 --- a/backend/functions/courts/courts.function.ts +++ b/backend/functions/courts/courts.function.ts @@ -1,7 +1,7 @@ import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions'; import ContextCreator from '../azure/application-context-creator'; import { toAzureError, toAzureSuccess } from '../azure/functions'; -import { CourtsController } from '../lib/controllers/courts/courts.controller'; +import { CourtsController } from '../../lib/controllers/courts/courts.controller'; const MODULE_NAME = 'COURTS_FUNCTION'; diff --git a/backend/functions/healthcheck/healthcheck.db.cosmos.test.ts b/backend/functions/healthcheck/healthcheck.db.cosmos.test.ts index 1dc90b893..42f74b89c 100644 --- a/backend/functions/healthcheck/healthcheck.db.cosmos.test.ts +++ b/backend/functions/healthcheck/healthcheck.db.cosmos.test.ts @@ -1,11 +1,11 @@ import { describe } from 'node:test'; -import { ApplicationContext } from '../lib/adapters/types/basic'; -import { createMockApplicationContext } from '../lib/testing/testing-utilities'; -import { closeDeferred } from '../lib/deferrable/defer-close'; +import { ApplicationContext } from '../../lib/adapters/types/basic'; +import { createMockApplicationContext } from '../../lib/testing/testing-utilities'; +import { closeDeferred } from '../../lib/deferrable/defer-close'; import HealthcheckCosmosDb, { HealthCheckDocument } from './healthcheck.db.cosmos'; -import { MongoCollectionAdapter } from '../lib/adapters/gateways/mongo/utils/mongo-adapter'; +import { MongoCollectionAdapter } from '../../lib/adapters/gateways/mongo/utils/mongo-adapter'; describe('healthcheck db tests', () => { let context: ApplicationContext; diff --git a/backend/functions/healthcheck/healthcheck.db.cosmos.ts b/backend/functions/healthcheck/healthcheck.db.cosmos.ts index 3a6344ccd..b4515d81c 100644 --- a/backend/functions/healthcheck/healthcheck.db.cosmos.ts +++ b/backend/functions/healthcheck/healthcheck.db.cosmos.ts @@ -1,9 +1,9 @@ import * as dotenv from 'dotenv'; -import { ApplicationContext } from '../lib/adapters/types/basic'; -import { DocumentClient } from '../lib/humble-objects/mongo-humble'; -import QueryBuilder from '../lib/query/query-builder'; -import { deferClose } from '../lib/deferrable/defer-close'; -import { MongoCollectionAdapter } from '../lib/adapters/gateways/mongo/utils/mongo-adapter'; +import { ApplicationContext } from '../../lib/adapters/types/basic'; +import { DocumentClient } from '../../lib/humble-objects/mongo-humble'; +import QueryBuilder from '../../lib/query/query-builder'; +import { deferClose } from '../../lib/deferrable/defer-close'; +import { MongoCollectionAdapter } from '../../lib/adapters/gateways/mongo/utils/mongo-adapter'; dotenv.config(); diff --git a/backend/functions/healthcheck/healthcheck.db.sql.ts b/backend/functions/healthcheck/healthcheck.db.sql.ts index 4cf6f4170..79edcbd36 100644 --- a/backend/functions/healthcheck/healthcheck.db.sql.ts +++ b/backend/functions/healthcheck/healthcheck.db.sql.ts @@ -1,5 +1,5 @@ -import { ApplicationContext } from '../lib/adapters/types/basic'; -import { getSqlConnection } from '../lib/factory'; +import { ApplicationContext } from '../../lib/adapters/types/basic'; +import { getSqlConnection } from '../../lib/factory'; const MODULE_NAME = 'HEALTHCHECK-SQL-DB'; diff --git a/backend/functions/healthcheck/healthcheck.function.ts b/backend/functions/healthcheck/healthcheck.function.ts index d89d84389..388bab50d 100644 --- a/backend/functions/healthcheck/healthcheck.function.ts +++ b/backend/functions/healthcheck/healthcheck.function.ts @@ -1,14 +1,14 @@ import ContextCreator from '../azure/application-context-creator'; -import { CamsError } from '../lib/common-errors/cams-error'; +import { CamsError } from '../../lib/common-errors/cams-error'; import HealthcheckCosmosDb from './healthcheck.db.cosmos'; import { app, InvocationContext, HttpResponseInit, HttpRequest } from '@azure/functions'; import HealthcheckSqlDb from './healthcheck.db.sql'; import HealthcheckInfo from './healthcheck.info'; import { toAzureError, toAzureSuccess } from '../azure/functions'; -import { httpSuccess } from '../lib/adapters/utils/http-response'; +import { httpSuccess } from '../../lib/adapters/utils/http-response'; import HttpStatusCodes from '../../../common/src/api/http-status-codes'; -import { closeDeferred } from '../lib/deferrable/defer-close'; +import { closeDeferred } from '../../lib/deferrable/defer-close'; const MODULE_NAME = 'HEALTHCHECK'; diff --git a/backend/functions/healthcheck/healthcheck.info.ts b/backend/functions/healthcheck/healthcheck.info.ts index 856ca6842..d67a51fe0 100644 --- a/backend/functions/healthcheck/healthcheck.info.ts +++ b/backend/functions/healthcheck/healthcheck.info.ts @@ -1,5 +1,5 @@ import * as dotenv from 'dotenv'; -import { ApplicationContext } from '../lib/adapters/types/basic'; +import { ApplicationContext } from '../../lib/adapters/types/basic'; dotenv.config(); diff --git a/backend/functions/healthcheck/healthcheck.test.ts b/backend/functions/healthcheck/healthcheck.test.ts index c6a8ecac3..4fb780b2e 100644 --- a/backend/functions/healthcheck/healthcheck.test.ts +++ b/backend/functions/healthcheck/healthcheck.test.ts @@ -1,5 +1,5 @@ import { createMockAzureFunctionRequest } from '../azure/testing-helpers'; -import { MongoCollectionAdapter } from '../lib/adapters/gateways/mongo/utils/mongo-adapter'; +import { MongoCollectionAdapter } from '../../lib/adapters/gateways/mongo/utils/mongo-adapter'; import { HealthCheckDocument } from './healthcheck.db.cosmos'; import handler, { checkResults } from './healthcheck.function'; diff --git a/backend/functions/lib/testing/mock-data/attorneys.mock.ts b/backend/functions/lib/testing/mock-data/attorneys.mock.ts deleted file mode 100644 index 243bfe501..000000000 --- a/backend/functions/lib/testing/mock-data/attorneys.mock.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { TRIAL_ATTORNEYS } from '../../../../../common/src/cams/test-utilities/attorneys.mock'; - -const list = { - attorneyList: TRIAL_ATTORNEYS, -}; - -export { list }; diff --git a/backend/functions/me/me.function.test.ts b/backend/functions/me/me.function.test.ts index 0ffe1a0a7..ecef356d0 100644 --- a/backend/functions/me/me.function.test.ts +++ b/backend/functions/me/me.function.test.ts @@ -5,11 +5,11 @@ import { } from '../azure/testing-helpers'; import ContextCreator from '../azure/application-context-creator'; import MockData from '../../../common/src/cams/test-utilities/mock-data'; -import { ForbiddenError } from '../lib/common-errors/forbidden-error'; +import { ForbiddenError } from '../../lib/common-errors/forbidden-error'; import handler from '../me/me.function'; import { InvocationContext } from '@azure/functions'; import { CamsSession } from '../../../common/src/cams/session'; -import { createMockApplicationContext } from '../lib/testing/testing-utilities'; +import { createMockApplicationContext } from '../../lib/testing/testing-utilities'; describe('me Function test', () => { const context = new InvocationContext({ diff --git a/backend/functions/me/me.function.ts b/backend/functions/me/me.function.ts index ed5b536e5..36de4c333 100644 --- a/backend/functions/me/me.function.ts +++ b/backend/functions/me/me.function.ts @@ -1,7 +1,7 @@ import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions'; import ContextCreator from '../azure/application-context-creator'; import { toAzureError, toAzureSuccess } from '../azure/functions'; -import { MeController } from '../lib/controllers/me/me.controller'; +import { MeController } from '../../lib/controllers/me/me.controller'; const MODULE_NAME = 'ME-FUNCTION'; diff --git a/backend/functions/migration/activity/flattenBoundingArrays.test.ts b/backend/functions/migration/activity/flattenBoundingArrays.test.ts index 999bbf991..1defc160e 100644 --- a/backend/functions/migration/activity/flattenBoundingArrays.test.ts +++ b/backend/functions/migration/activity/flattenBoundingArrays.test.ts @@ -1,5 +1,5 @@ import { InvocationContext } from '@azure/functions'; -import { AcmsBounds, AcmsPredicate } from '../../lib/use-cases/acms-orders/acms-orders'; +import { AcmsBounds, AcmsPredicate } from '../../../lib/use-cases/acms-orders/acms-orders'; import module from './flattenBoundingArrays'; describe('Flatten bounding arrays activity', () => { diff --git a/backend/functions/migration/activity/flattenBoundingArrays.ts b/backend/functions/migration/activity/flattenBoundingArrays.ts index 0f7f79f06..510a55369 100644 --- a/backend/functions/migration/activity/flattenBoundingArrays.ts +++ b/backend/functions/migration/activity/flattenBoundingArrays.ts @@ -1,5 +1,5 @@ import { InvocationContext } from '@azure/functions'; -import { AcmsBounds, AcmsPredicate } from '../../lib/use-cases/acms-orders/acms-orders'; +import { AcmsBounds, AcmsPredicate } from '../../../lib/use-cases/acms-orders/acms-orders'; async function flattenBoundingArrays( bounds: AcmsBounds, diff --git a/backend/functions/migration/activity/getConsolidations.test.ts b/backend/functions/migration/activity/getConsolidations.test.ts index f866c48f9..c71eef9ca 100644 --- a/backend/functions/migration/activity/getConsolidations.test.ts +++ b/backend/functions/migration/activity/getConsolidations.test.ts @@ -1,9 +1,9 @@ import { InvocationContext } from '@azure/functions'; -import AcmsOrdersController from '../../lib/controllers/acms-orders/acms-orders.controller'; +import AcmsOrdersController from '../../../lib/controllers/acms-orders/acms-orders.controller'; import module from './getConsolidations'; -import { AcmsPredicateAndPage } from '../../lib/use-cases/acms-orders/acms-orders'; +import { AcmsPredicateAndPage } from '../../../lib/use-cases/acms-orders/acms-orders'; import { createMockAzureFunctionContext } from '../../azure/testing-helpers'; -import { CamsError } from '../../lib/common-errors/cams-error'; +import { CamsError } from '../../../lib/common-errors/cams-error'; describe('getConsolidations test', () => { afterEach(() => { diff --git a/backend/functions/migration/activity/getConsolidations.ts b/backend/functions/migration/activity/getConsolidations.ts index a1ae9428f..07cf062e3 100644 --- a/backend/functions/migration/activity/getConsolidations.ts +++ b/backend/functions/migration/activity/getConsolidations.ts @@ -1,8 +1,8 @@ import { InvocationContext } from '@azure/functions'; -import { AcmsPredicateAndPage } from '../../lib/use-cases/acms-orders/acms-orders'; +import { AcmsPredicateAndPage } from '../../../lib/use-cases/acms-orders/acms-orders'; import ContextCreator from '../../azure/application-context-creator'; -import AcmsOrdersController from '../../lib/controllers/acms-orders/acms-orders.controller'; -import { getCamsError } from '../../lib/common-errors/error-utilities'; +import AcmsOrdersController from '../../../lib/controllers/acms-orders/acms-orders.controller'; +import { getCamsError } from '../../../lib/common-errors/error-utilities'; const MODULE_NAME = 'IMPORT_ACTION_GET_CONSOLIDATIONS'; diff --git a/backend/functions/migration/activity/getPageCount.test.ts b/backend/functions/migration/activity/getPageCount.test.ts index 5ba9d2511..26120948c 100644 --- a/backend/functions/migration/activity/getPageCount.test.ts +++ b/backend/functions/migration/activity/getPageCount.test.ts @@ -1,8 +1,8 @@ import { InvocationContext } from '@azure/functions'; import { createMockAzureFunctionContext } from '../../azure/testing-helpers'; -import { CamsError } from '../../lib/common-errors/cams-error'; -import AcmsOrdersController from '../../lib/controllers/acms-orders/acms-orders.controller'; -import { AcmsPredicateAndPage } from '../../lib/use-cases/acms-orders/acms-orders'; +import { CamsError } from '../../../lib/common-errors/cams-error'; +import AcmsOrdersController from '../../../lib/controllers/acms-orders/acms-orders.controller'; +import { AcmsPredicateAndPage } from '../../../lib/use-cases/acms-orders/acms-orders'; import module from './getPageCount'; describe('getPageCount test', () => { diff --git a/backend/functions/migration/activity/getPageCount.ts b/backend/functions/migration/activity/getPageCount.ts index b71dc68cd..eb4454f12 100644 --- a/backend/functions/migration/activity/getPageCount.ts +++ b/backend/functions/migration/activity/getPageCount.ts @@ -1,8 +1,8 @@ import { InvocationContext } from '@azure/functions'; import ContextCreator from '../../azure/application-context-creator'; -import { AcmsPredicateAndPage } from '../../lib/use-cases/acms-orders/acms-orders'; -import AcmsOrdersController from '../../lib/controllers/acms-orders/acms-orders.controller'; -import { getCamsError } from '../../lib/common-errors/error-utilities'; +import { AcmsPredicateAndPage } from '../../../lib/use-cases/acms-orders/acms-orders'; +import AcmsOrdersController from '../../../lib/controllers/acms-orders/acms-orders.controller'; +import { getCamsError } from '../../../lib/common-errors/error-utilities'; const MODULE_NAME = 'IMPORT-ACTION-GET-PAGE-COUNT'; diff --git a/backend/functions/migration/activity/migrateConsolidation.ts b/backend/functions/migration/activity/migrateConsolidation.ts index ff5077efb..b3b943314 100644 --- a/backend/functions/migration/activity/migrateConsolidation.ts +++ b/backend/functions/migration/activity/migrateConsolidation.ts @@ -1,8 +1,8 @@ import { InvocationContext } from '@azure/functions'; import ContextCreator from '../../azure/application-context-creator'; -import AcmsOrdersController from '../../lib/controllers/acms-orders/acms-orders.controller'; -import { getCamsError } from '../../lib/common-errors/error-utilities'; -import { AcmsTransformationResult } from '../../lib/use-cases/acms-orders/acms-orders'; +import AcmsOrdersController from '../../../lib/controllers/acms-orders/acms-orders.controller'; +import { getCamsError } from '../../../lib/common-errors/error-utilities'; +import { AcmsTransformationResult } from '../../../lib/use-cases/acms-orders/acms-orders'; const MODULE_NAME = 'IMPORT_ACTION_MIGRATE_CONSOLIDATION'; diff --git a/backend/functions/migration/activity/migrateConsolidations.test.ts b/backend/functions/migration/activity/migrateConsolidations.test.ts index e2263fba8..bf135fe0b 100644 --- a/backend/functions/migration/activity/migrateConsolidations.test.ts +++ b/backend/functions/migration/activity/migrateConsolidations.test.ts @@ -1,9 +1,9 @@ import { InvocationContext } from '@azure/functions'; -import AcmsOrdersController from '../../lib/controllers/acms-orders/acms-orders.controller'; +import AcmsOrdersController from '../../../lib/controllers/acms-orders/acms-orders.controller'; import module from './migrateConsolidation'; import { createMockAzureFunctionContext } from '../../azure/testing-helpers'; -import { CamsError } from '../../lib/common-errors/cams-error'; -import { AcmsTransformationResult } from '../../lib/use-cases/acms-orders/acms-orders'; +import { CamsError } from '../../../lib/common-errors/cams-error'; +import { AcmsTransformationResult } from '../../../lib/use-cases/acms-orders/acms-orders'; describe('getConsolidations test', () => { afterEach(() => { diff --git a/backend/functions/migration/client/acms-migration-trigger.function.ts b/backend/functions/migration/client/acms-migration-trigger.function.ts index 7a56ad0e7..478ac0ce4 100644 --- a/backend/functions/migration/client/acms-migration-trigger.function.ts +++ b/backend/functions/migration/client/acms-migration-trigger.function.ts @@ -1,10 +1,10 @@ import * as df from 'durable-functions'; import { HttpRequest, HttpResponse, InvocationContext } from '@azure/functions'; import { MAIN_ORCHESTRATOR } from '../loadConsolidations'; -import { TriggerRequest } from '../../lib/use-cases/acms-orders/acms-orders'; -import { BadRequestError } from '../../lib/common-errors/bad-request'; +import { TriggerRequest } from '../../../lib/use-cases/acms-orders/acms-orders'; +import { BadRequestError } from '../../../lib/common-errors/bad-request'; import * as dotenv from 'dotenv'; -import { UnauthorizedError } from '../../lib/common-errors/unauthorized-error'; +import { UnauthorizedError } from '../../../lib/common-errors/unauthorized-error'; const MODULE_NAME = 'ACMS_MIGRATION_TRIGGER'; dotenv.config(); diff --git a/backend/functions/migration/orchestration/orchestrator.ts b/backend/functions/migration/orchestration/orchestrator.ts index 65d417a16..09ead0161 100644 --- a/backend/functions/migration/orchestration/orchestrator.ts +++ b/backend/functions/migration/orchestration/orchestrator.ts @@ -3,7 +3,7 @@ import { AcmsBounds, AcmsPartitionReport, AcmsPredicate, -} from '../../lib/use-cases/acms-orders/acms-orders'; +} from '../../../lib/use-cases/acms-orders/acms-orders'; import { FLATTEN_BOUNDING_ARRAYS, SUB_ORCHESTRATOR_PAGING } from '../loadConsolidations'; import { OrchestrationContext } from 'durable-functions'; diff --git a/backend/functions/migration/orchestration/sub-orchestrator-etl.ts b/backend/functions/migration/orchestration/sub-orchestrator-etl.ts index 1d1b93669..5c36ce624 100644 --- a/backend/functions/migration/orchestration/sub-orchestrator-etl.ts +++ b/backend/functions/migration/orchestration/sub-orchestrator-etl.ts @@ -2,7 +2,7 @@ import { AcmsTransformationResult, AcmsPredicateAndPage, AcmsPageReport, -} from '../../lib/use-cases/acms-orders/acms-orders'; +} from '../../../lib/use-cases/acms-orders/acms-orders'; import { GET_CONSOLIDATIONS, MIGRATE_CONSOLIDATION } from '../loadConsolidations'; import { OrchestrationContext } from 'durable-functions'; diff --git a/backend/functions/migration/orchestration/sub-orchestrator-paging.ts b/backend/functions/migration/orchestration/sub-orchestrator-paging.ts index 7c780b698..75759ab12 100644 --- a/backend/functions/migration/orchestration/sub-orchestrator-paging.ts +++ b/backend/functions/migration/orchestration/sub-orchestrator-paging.ts @@ -5,7 +5,7 @@ import { AcmsPredicate, AcmsPredicateAndPage, AcmsPartitionReport, -} from '../../lib/use-cases/acms-orders/acms-orders'; +} from '../../../lib/use-cases/acms-orders/acms-orders'; export function* subOrchestratorPaging(context: OrchestrationContext) { const predicate: AcmsPredicate = context.df.getInput(); diff --git a/backend/functions/oauth2/mock-oauth2.function.ts b/backend/functions/oauth2/mock-oauth2.function.ts index 31eed04be..bb3b1a4ed 100644 --- a/backend/functions/oauth2/mock-oauth2.function.ts +++ b/backend/functions/oauth2/mock-oauth2.function.ts @@ -1,8 +1,8 @@ import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions'; import ContextCreator from '../azure/application-context-creator'; -import { mockAuthentication } from '../lib/testing/mock-gateways/mock-oauth2-gateway'; +import { mockAuthentication } from '../../lib/testing/mock-gateways/mock-oauth2-gateway'; import { toAzureError, toAzureSuccess } from '../azure/functions'; -import { httpSuccess } from '../lib/adapters/utils/http-response'; +import { httpSuccess } from '../../lib/adapters/utils/http-response'; const MODULE_NAME = 'MOCK-OAUTH2-FUNCTION'; diff --git a/backend/functions/office-staff-sync/office-staff-sync.function.test.ts b/backend/functions/office-staff-sync/office-staff-sync.function.test.ts index 18814cdf0..223021419 100644 --- a/backend/functions/office-staff-sync/office-staff-sync.function.test.ts +++ b/backend/functions/office-staff-sync/office-staff-sync.function.test.ts @@ -1,9 +1,9 @@ -import { LoggerImpl } from '../lib/adapters/services/logger.service'; -import { CamsError } from '../lib/common-errors/cams-error'; +import { LoggerImpl } from '../../lib/adapters/services/logger.service'; +import { CamsError } from '../../lib/common-errors/cams-error'; import timerTrigger from './office-staff-sync.function'; import { Timer } from '@azure/functions'; import { createMockAzureFunctionContext } from '../azure/testing-helpers'; -import { OfficesController } from '../lib/controllers/offices/offices.controller'; +import { OfficesController } from '../../lib/controllers/offices/offices.controller'; describe('Office Staff Sync Function tests', () => { const context = createMockAzureFunctionContext(); diff --git a/backend/functions/office-staff-sync/office-staff-sync.function.ts b/backend/functions/office-staff-sync/office-staff-sync.function.ts index f6e6a17b6..cd91182af 100644 --- a/backend/functions/office-staff-sync/office-staff-sync.function.ts +++ b/backend/functions/office-staff-sync/office-staff-sync.function.ts @@ -3,7 +3,7 @@ import { app, InvocationContext, Timer } from '@azure/functions'; import ContextCreator from '../azure/application-context-creator'; import { initializeApplicationInsights } from '../azure/app-insights'; import { toAzureError } from '../azure/functions'; -import { OfficesController } from '../lib/controllers/offices/offices.controller'; +import { OfficesController } from '../../lib/controllers/offices/offices.controller'; dotenv.config(); diff --git a/backend/functions/offices/offices.function.test.ts b/backend/functions/offices/offices.function.test.ts index 809719c77..c6c611a51 100644 --- a/backend/functions/offices/offices.function.test.ts +++ b/backend/functions/offices/offices.function.test.ts @@ -1,4 +1,4 @@ -import { CamsError } from '../lib/common-errors/cams-error'; +import { CamsError } from '../../lib/common-errors/cams-error'; import ContextCreator from '../azure/application-context-creator'; import MockData from '../../../common/src/cams/test-utilities/mock-data'; import handler from './offices.function'; @@ -8,7 +8,7 @@ import { createMockAzureFunctionContext, createMockAzureFunctionRequest, } from '../azure/testing-helpers'; -import { OfficesController } from '../lib/controllers/offices/offices.controller'; +import { OfficesController } from '../../lib/controllers/offices/offices.controller'; import { USTP_OFFICES_ARRAY, UstpOfficeDetails } from '../../../common/src/cams/offices'; describe('offices Function tests', () => { diff --git a/backend/functions/offices/offices.function.ts b/backend/functions/offices/offices.function.ts index 1d5560e16..f644b7547 100644 --- a/backend/functions/offices/offices.function.ts +++ b/backend/functions/offices/offices.function.ts @@ -1,6 +1,6 @@ import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions'; import ContextCreator from '../azure/application-context-creator'; -import { OfficesController } from '../lib/controllers/offices/offices.controller'; +import { OfficesController } from '../../lib/controllers/offices/offices.controller'; import { toAzureError, toAzureSuccess } from '../azure/functions'; const MODULE_NAME = 'OFFICES_FUNCTION'; diff --git a/backend/functions/orders-manual-sync/orders-manual-sync.function.test.ts b/backend/functions/orders-manual-sync/orders-manual-sync.function.test.ts index 604496ee7..b8fd8d4d6 100644 --- a/backend/functions/orders-manual-sync/orders-manual-sync.function.test.ts +++ b/backend/functions/orders-manual-sync/orders-manual-sync.function.test.ts @@ -1,7 +1,7 @@ -import { LoggerImpl } from '../lib/adapters/services/logger.service'; -import { CamsError } from '../lib/common-errors/cams-error'; -import { OrdersController } from '../lib/controllers/orders/orders.controller'; -import { SyncOrdersStatus } from '../lib/use-cases/orders/orders'; +import { LoggerImpl } from '../../lib/adapters/services/logger.service'; +import { CamsError } from '../../lib/common-errors/cams-error'; +import { OrdersController } from '../../lib/controllers/orders/orders.controller'; +import { SyncOrdersStatus } from '../../lib/use-cases/orders/orders'; import handler from './orders-manual-sync.function'; import { buildTestResponseSuccess, createMockAzureFunctionRequest } from '../azure/testing-helpers'; diff --git a/backend/functions/orders-manual-sync/orders-manual-sync.function.ts b/backend/functions/orders-manual-sync/orders-manual-sync.function.ts index d4c88f8e8..7f9d23e11 100644 --- a/backend/functions/orders-manual-sync/orders-manual-sync.function.ts +++ b/backend/functions/orders-manual-sync/orders-manual-sync.function.ts @@ -2,7 +2,7 @@ import * as dotenv from 'dotenv'; import { app, InvocationContext, HttpRequest, HttpResponseInit } from '@azure/functions'; import ContextCreator from '../azure/application-context-creator'; import { initializeApplicationInsights } from '../azure/app-insights'; -import { OrdersController } from '../lib/controllers/orders/orders.controller'; +import { OrdersController } from '../../lib/controllers/orders/orders.controller'; import { toAzureError, toAzureSuccess } from '../azure/functions'; dotenv.config(); diff --git a/backend/functions/orders-suggestions/orders-suggestions.function.test.ts b/backend/functions/orders-suggestions/orders-suggestions.function.test.ts index 392735266..6a08e96ba 100644 --- a/backend/functions/orders-suggestions/orders-suggestions.function.test.ts +++ b/backend/functions/orders-suggestions/orders-suggestions.function.test.ts @@ -1,11 +1,11 @@ import handler from './orders-suggestions.function'; -import { CamsError } from '../lib/common-errors/cams-error'; +import { CamsError } from '../../lib/common-errors/cams-error'; import { buildTestResponseSuccess, createMockAzureFunctionContext, createMockAzureFunctionRequest, } from '../azure/testing-helpers'; -import { OrdersController } from '../lib/controllers/orders/orders.controller'; +import { OrdersController } from '../../lib/controllers/orders/orders.controller'; import MockData from '../../../common/src/cams/test-utilities/mock-data'; import { CaseSummary } from '../../../common/src/cams/cases'; import { buildTestResponseError } from '../azure/testing-helpers'; diff --git a/backend/functions/orders-suggestions/orders-suggestions.function.ts b/backend/functions/orders-suggestions/orders-suggestions.function.ts index ba55d0d99..3674a35c6 100644 --- a/backend/functions/orders-suggestions/orders-suggestions.function.ts +++ b/backend/functions/orders-suggestions/orders-suggestions.function.ts @@ -1,7 +1,7 @@ import { InvocationContext, HttpRequest, HttpResponseInit, app } from '@azure/functions'; import ContextCreator from '../azure/application-context-creator'; import { initializeApplicationInsights } from '../azure/app-insights'; -import { OrdersController } from '../lib/controllers/orders/orders.controller'; +import { OrdersController } from '../../lib/controllers/orders/orders.controller'; import * as dotenv from 'dotenv'; import { toAzureError, toAzureSuccess } from '../azure/functions'; diff --git a/backend/functions/orders-sync/orders-sync.function.test.ts b/backend/functions/orders-sync/orders-sync.function.test.ts index cd261fb88..a5a915642 100644 --- a/backend/functions/orders-sync/orders-sync.function.test.ts +++ b/backend/functions/orders-sync/orders-sync.function.test.ts @@ -1,10 +1,10 @@ -import { LoggerImpl } from '../lib/adapters/services/logger.service'; -import { CamsError } from '../lib/common-errors/cams-error'; +import { LoggerImpl } from '../../lib/adapters/services/logger.service'; +import { CamsError } from '../../lib/common-errors/cams-error'; import timerTrigger from './orders-sync.function'; import { Timer } from '@azure/functions'; import { createMockAzureFunctionContext } from '../azure/testing-helpers'; -import { OrdersController } from '../lib/controllers/orders/orders.controller'; -import * as factory from '../lib/factory'; +import { OrdersController } from '../../lib/controllers/orders/orders.controller'; +import * as factory from '../../lib/factory'; describe('Orders Sync Function tests', () => { const context = createMockAzureFunctionContext({ MONGO_CONNECTION_STRING: 'fake' }); diff --git a/backend/functions/orders-sync/orders-sync.function.ts b/backend/functions/orders-sync/orders-sync.function.ts index c25213f31..110ac4088 100644 --- a/backend/functions/orders-sync/orders-sync.function.ts +++ b/backend/functions/orders-sync/orders-sync.function.ts @@ -2,7 +2,7 @@ import * as dotenv from 'dotenv'; import { app, InvocationContext, Timer } from '@azure/functions'; import ContextCreator from '../azure/application-context-creator'; import { initializeApplicationInsights } from '../azure/app-insights'; -import { OrdersController } from '../lib/controllers/orders/orders.controller'; +import { OrdersController } from '../../lib/controllers/orders/orders.controller'; import { toAzureError } from '../azure/functions'; dotenv.config(); diff --git a/backend/functions/orders/orders.function.test.ts b/backend/functions/orders/orders.function.test.ts index cf925ba4c..774637121 100644 --- a/backend/functions/orders/orders.function.test.ts +++ b/backend/functions/orders/orders.function.test.ts @@ -1,8 +1,8 @@ import handler from './orders.function'; -import { CamsError } from '../lib/common-errors/cams-error'; +import { CamsError } from '../../lib/common-errors/cams-error'; import { MockData } from '../../../common/src/cams/test-utilities/mock-data'; -import { CamsHttpRequest } from '../lib/adapters/types/http'; -import { OrdersController } from '../lib/controllers/orders/orders.controller'; +import { CamsHttpRequest } from '../../lib/adapters/types/http'; +import { OrdersController } from '../../lib/controllers/orders/orders.controller'; import { Order } from '../../../common/src/cams/orders'; import { buildTestResponseError, @@ -10,7 +10,7 @@ import { createMockAzureFunctionContext, createMockAzureFunctionRequest, } from '../azure/testing-helpers'; -import { commonHeaders } from '../lib/adapters/utils/http-response'; +import { commonHeaders } from '../../lib/adapters/utils/http-response'; import HttpStatusCodes from '../../../common/src/api/http-status-codes'; describe('Orders Function tests', () => { diff --git a/backend/functions/orders/orders.function.ts b/backend/functions/orders/orders.function.ts index 18d1fb842..c6df6ce97 100644 --- a/backend/functions/orders/orders.function.ts +++ b/backend/functions/orders/orders.function.ts @@ -2,7 +2,7 @@ import * as dotenv from 'dotenv'; import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions'; import ContextCreator from '../azure/application-context-creator'; import { initializeApplicationInsights } from '../azure/app-insights'; -import { OrdersController } from '../lib/controllers/orders/orders.controller'; +import { OrdersController } from '../../lib/controllers/orders/orders.controller'; import { toAzureError, toAzureSuccess } from '../azure/functions'; const MODULE_NAME = 'ORDERS_FUNCTION'; diff --git a/backend/functions/jest.config.js b/backend/jest.config.js similarity index 84% rename from backend/functions/jest.config.js rename to backend/jest.config.js index ff284ec8a..0d00470a7 100644 --- a/backend/functions/jest.config.js +++ b/backend/jest.config.js @@ -16,7 +16,7 @@ module.exports = { '.*test.[jt]s', '.*mock.*.ts', '.*.d.ts', - 'azure/app-insights.ts', + 'functions/azure/app-insights.ts', 'dist/', 'coverage/', 'lib/adapters/gateways/cases.local.gateway.ts', @@ -28,9 +28,9 @@ module.exports = { 'lib/testing/testing-utilities.ts', 'jest.*config.js', 'lib/adapters/gateways/okta/HumbleVerifier.ts', - 'migration/client/', - 'migration/orchestration/', - 'migration/loadConsolidations.ts', + 'functions/migration/client/', + 'functions/migration/orchestration/', + 'functions/migration/loadConsolidations.ts', ], testMatch: ['**/?(*.)+(spec|test).[jt]s?(x)', '!**/?(*.)+(integration).(spec|test).[jt]s?(x)'], }; diff --git a/backend/functions/lib/adapters/gateways/abstract-mssql-client.exception.test.ts b/backend/lib/adapters/gateways/abstract-mssql-client.exception.test.ts similarity index 100% rename from backend/functions/lib/adapters/gateways/abstract-mssql-client.exception.test.ts rename to backend/lib/adapters/gateways/abstract-mssql-client.exception.test.ts diff --git a/backend/functions/lib/adapters/gateways/abstract-mssql-client.test.ts b/backend/lib/adapters/gateways/abstract-mssql-client.test.ts similarity index 100% rename from backend/functions/lib/adapters/gateways/abstract-mssql-client.test.ts rename to backend/lib/adapters/gateways/abstract-mssql-client.test.ts diff --git a/backend/functions/lib/adapters/gateways/abstract-mssql-client.ts b/backend/lib/adapters/gateways/abstract-mssql-client.ts similarity index 100% rename from backend/functions/lib/adapters/gateways/abstract-mssql-client.ts rename to backend/lib/adapters/gateways/abstract-mssql-client.ts diff --git a/backend/functions/lib/adapters/gateways/acms/acms.gateway.test.ts b/backend/lib/adapters/gateways/acms/acms.gateway.test.ts similarity index 100% rename from backend/functions/lib/adapters/gateways/acms/acms.gateway.test.ts rename to backend/lib/adapters/gateways/acms/acms.gateway.test.ts diff --git a/backend/functions/lib/adapters/gateways/acms/acms.gateway.ts b/backend/lib/adapters/gateways/acms/acms.gateway.ts similarity index 100% rename from backend/functions/lib/adapters/gateways/acms/acms.gateway.ts rename to backend/lib/adapters/gateways/acms/acms.gateway.ts diff --git a/backend/functions/lib/adapters/gateways/cases.local.gateway.ts b/backend/lib/adapters/gateways/cases.local.gateway.ts similarity index 94% rename from backend/functions/lib/adapters/gateways/cases.local.gateway.ts rename to backend/lib/adapters/gateways/cases.local.gateway.ts index 6696d2a08..733cacbf4 100644 --- a/backend/functions/lib/adapters/gateways/cases.local.gateway.ts +++ b/backend/lib/adapters/gateways/cases.local.gateway.ts @@ -2,10 +2,10 @@ import { CasesInterface } from '../../use-cases/cases.interface'; import { ApplicationContext } from '../types/basic'; import { GatewayHelper } from './gateway-helper'; import { getMonthDayYearStringFromDate } from '../utils/date-helper'; -import { CaseBasics, CaseDetail } from '../../../../../common/src/cams/cases'; +import { CaseBasics, CaseDetail } from '../../../../common/src/cams/cases'; import { CamsError } from '../../common-errors/cams-error'; -import { CasesSearchPredicate } from '../../../../../common/src/api/search'; -import MockData from '../../../../../common/src/cams/test-utilities/mock-data'; +import { CasesSearchPredicate } from '../../../../common/src/api/search'; +import MockData from '../../../../common/src/cams/test-utilities/mock-data'; const MODULE_NAME = 'MOCK-CASES-GATEWAY'; diff --git a/backend/functions/lib/adapters/gateways/debtor-type-gateway.test.ts b/backend/lib/adapters/gateways/debtor-type-gateway.test.ts similarity index 100% rename from backend/functions/lib/adapters/gateways/debtor-type-gateway.test.ts rename to backend/lib/adapters/gateways/debtor-type-gateway.test.ts diff --git a/backend/functions/lib/adapters/gateways/debtor-type-gateway.ts b/backend/lib/adapters/gateways/debtor-type-gateway.ts similarity index 100% rename from backend/functions/lib/adapters/gateways/debtor-type-gateway.ts rename to backend/lib/adapters/gateways/debtor-type-gateway.ts diff --git a/backend/functions/lib/adapters/gateways/dxtr/case-docket.dxtr.gateway.test.ts b/backend/lib/adapters/gateways/dxtr/case-docket.dxtr.gateway.test.ts similarity index 100% rename from backend/functions/lib/adapters/gateways/dxtr/case-docket.dxtr.gateway.test.ts rename to backend/lib/adapters/gateways/dxtr/case-docket.dxtr.gateway.test.ts diff --git a/backend/functions/lib/adapters/gateways/dxtr/case-docket.dxtr.gateway.ts b/backend/lib/adapters/gateways/dxtr/case-docket.dxtr.gateway.ts similarity index 99% rename from backend/functions/lib/adapters/gateways/dxtr/case-docket.dxtr.gateway.ts rename to backend/lib/adapters/gateways/dxtr/case-docket.dxtr.gateway.ts index c145b16b2..39b664108 100644 --- a/backend/functions/lib/adapters/gateways/dxtr/case-docket.dxtr.gateway.ts +++ b/backend/lib/adapters/gateways/dxtr/case-docket.dxtr.gateway.ts @@ -7,7 +7,7 @@ import { ApplicationContext } from '../../types/basic'; import { CaseDocketGateway } from '../../../use-cases/gateways.types'; import { CamsError } from '../../../common-errors/cams-error'; import { NotFoundError } from '../../../common-errors/not-found-error'; -import { CaseDocket, CaseDocketEntryDocument } from '../../../../../../common/src/cams/cases'; +import { CaseDocket, CaseDocketEntryDocument } from '../../../../../common/src/cams/cases'; const MODULENAME = 'CASE-DOCKET-DXTR-GATEWAY'; diff --git a/backend/functions/lib/adapters/gateways/dxtr/case-docket.mock.gateway.ts b/backend/lib/adapters/gateways/dxtr/case-docket.mock.gateway.ts similarity index 91% rename from backend/functions/lib/adapters/gateways/dxtr/case-docket.mock.gateway.ts rename to backend/lib/adapters/gateways/dxtr/case-docket.mock.gateway.ts index 0a4038154..16dc39931 100644 --- a/backend/functions/lib/adapters/gateways/dxtr/case-docket.mock.gateway.ts +++ b/backend/lib/adapters/gateways/dxtr/case-docket.mock.gateway.ts @@ -3,7 +3,7 @@ import { ApplicationContext } from '../../types/basic'; import { CaseDocketGateway } from '../../../use-cases/gateways.types'; import { GatewayHelper } from '../gateway-helper'; import { NORMAL_CASE_ID } from '../../../testing/testing-constants'; -import { CaseDocket } from '../../../../../../common/src/cams/cases'; +import { CaseDocket } from '../../../../../common/src/cams/cases'; const MODULE_NAME = 'CASE-DOCKET-MOCK-GATEWAY'; diff --git a/backend/functions/lib/adapters/gateways/dxtr/cases.dxtr.gateway.test.ts b/backend/lib/adapters/gateways/dxtr/cases.dxtr.gateway.test.ts similarity index 99% rename from backend/functions/lib/adapters/gateways/dxtr/cases.dxtr.gateway.test.ts rename to backend/lib/adapters/gateways/dxtr/cases.dxtr.gateway.test.ts index d59f83fab..2b81d97a2 100644 --- a/backend/functions/lib/adapters/gateways/dxtr/cases.dxtr.gateway.test.ts +++ b/backend/lib/adapters/gateways/dxtr/cases.dxtr.gateway.test.ts @@ -1,13 +1,13 @@ import CasesDxtrGateway, { getCaseIdParts } from './cases.dxtr.gateway'; import * as database from '../../utils/database'; import { QueryResults } from '../../types/database'; -import { CaseDetail } from '../../../../../../common/src/cams/cases'; +import { CaseDetail } from '../../../../../common/src/cams/cases'; import * as featureFlags from '../../utils/feature-flag'; import { CamsError } from '../../../common-errors/cams-error'; import { NotFoundError } from '../../../common-errors/not-found-error'; import { CASE_SUMMARIES } from '../../../testing/mock-data/case-summaries.mock'; import { DEBTORS } from '../../../testing/mock-data/debtors.mock'; -import { MockData } from '../../../../../../common/src/cams/test-utilities/mock-data'; +import { MockData } from '../../../../../common/src/cams/test-utilities/mock-data'; import { createMockApplicationContext } from '../../../testing/testing-utilities'; const dxtrDatabaseName = 'some-database-name'; diff --git a/backend/functions/lib/adapters/gateways/dxtr/cases.dxtr.gateway.ts b/backend/lib/adapters/gateways/dxtr/cases.dxtr.gateway.ts similarity index 99% rename from backend/functions/lib/adapters/gateways/dxtr/cases.dxtr.gateway.ts rename to backend/lib/adapters/gateways/dxtr/cases.dxtr.gateway.ts index 2b3f528ad..af955e12d 100644 --- a/backend/functions/lib/adapters/gateways/dxtr/cases.dxtr.gateway.ts +++ b/backend/lib/adapters/gateways/dxtr/cases.dxtr.gateway.ts @@ -12,12 +12,9 @@ import { getDebtorTypeLabel } from '../debtor-type-gateway'; import { getPetitionInfo } from '../petition-gateway'; import { NotFoundError } from '../../../common-errors/not-found-error'; import { CamsError } from '../../../common-errors/cams-error'; -import { - CasesSearchPredicate, - DEFAULT_SEARCH_LIMIT, -} from '../../../../../../common/src/api/search'; -import { CaseBasics, CaseDetail, CaseSummary } from '../../../../../../common/src/cams/cases'; -import { Party, DebtorAttorney } from '../../../../../../common/src/cams/parties'; +import { CasesSearchPredicate, DEFAULT_SEARCH_LIMIT } from '../../../../../common/src/api/search'; +import { CaseBasics, CaseDetail, CaseSummary } from '../../../../../common/src/cams/cases'; +import { Party, DebtorAttorney } from '../../../../../common/src/cams/parties'; const MODULENAME = 'CASES-DXTR-GATEWAY'; diff --git a/backend/functions/lib/adapters/gateways/dxtr/dxtr.constants.ts b/backend/lib/adapters/gateways/dxtr/dxtr.constants.ts similarity index 100% rename from backend/functions/lib/adapters/gateways/dxtr/dxtr.constants.ts rename to backend/lib/adapters/gateways/dxtr/dxtr.constants.ts diff --git a/backend/functions/lib/adapters/gateways/dxtr/dxtr.gateway.helper.test.ts b/backend/lib/adapters/gateways/dxtr/dxtr.gateway.helper.test.ts similarity index 100% rename from backend/functions/lib/adapters/gateways/dxtr/dxtr.gateway.helper.test.ts rename to backend/lib/adapters/gateways/dxtr/dxtr.gateway.helper.test.ts diff --git a/backend/functions/lib/adapters/gateways/dxtr/dxtr.gateway.helper.ts b/backend/lib/adapters/gateways/dxtr/dxtr.gateway.helper.ts similarity index 100% rename from backend/functions/lib/adapters/gateways/dxtr/dxtr.gateway.helper.ts rename to backend/lib/adapters/gateways/dxtr/dxtr.gateway.helper.ts diff --git a/backend/functions/lib/adapters/gateways/dxtr/offices.dxtr.gateway.test.ts b/backend/lib/adapters/gateways/dxtr/offices.dxtr.gateway.test.ts similarity index 95% rename from backend/functions/lib/adapters/gateways/dxtr/offices.dxtr.gateway.test.ts rename to backend/lib/adapters/gateways/dxtr/offices.dxtr.gateway.test.ts index dcef5ec4c..0cad274e1 100644 --- a/backend/functions/lib/adapters/gateways/dxtr/offices.dxtr.gateway.test.ts +++ b/backend/lib/adapters/gateways/dxtr/offices.dxtr.gateway.test.ts @@ -4,8 +4,8 @@ import { ApplicationContext } from '../../types/basic'; import { createMockApplicationContext } from '../../../testing/testing-utilities'; import * as database from '../../utils/database'; import { QueryResults } from '../../types/database'; -import { COURT_DIVISIONS } from '../../../../../../common/src/cams/test-utilities/courts.mock'; -import { USTP_OFFICES_ARRAY, UstpOfficeDetails } from '../../../../../../common/src/cams/offices'; +import { COURT_DIVISIONS } from '../../../../../common/src/cams/test-utilities/courts.mock'; +import { USTP_OFFICES_ARRAY, UstpOfficeDetails } from '../../../../../common/src/cams/offices'; describe('offices gateway tests', () => { describe('getOffice tests', () => { diff --git a/backend/functions/lib/adapters/gateways/dxtr/offices.dxtr.gateway.ts b/backend/lib/adapters/gateways/dxtr/offices.dxtr.gateway.ts similarity index 95% rename from backend/functions/lib/adapters/gateways/dxtr/offices.dxtr.gateway.ts rename to backend/lib/adapters/gateways/dxtr/offices.dxtr.gateway.ts index 0eba548cc..ee47ee3c2 100644 --- a/backend/functions/lib/adapters/gateways/dxtr/offices.dxtr.gateway.ts +++ b/backend/lib/adapters/gateways/dxtr/offices.dxtr.gateway.ts @@ -4,12 +4,8 @@ import { ApplicationContext } from '../../types/basic'; import { DbTableFieldSpec, QueryResults } from '../../types/database'; import { executeQuery } from '../../utils/database'; import { OfficesGateway } from '../../../use-cases/offices/offices.types'; -import { CamsUserReference } from '../../../../../../common/src/cams/users'; -import { - UstpDivision, - UstpGroup, - UstpOfficeDetails, -} from '../../../../../../common/src/cams/offices'; +import { CamsUserReference } from '../../../../../common/src/cams/users'; +import { UstpDivision, UstpGroup, UstpOfficeDetails } from '../../../../../common/src/cams/offices'; import { buildOfficeCode, getOfficeName } from '../../../use-cases/offices/offices'; const MODULE_NAME = 'OFFICES-GATEWAY'; diff --git a/backend/functions/lib/adapters/gateways/dxtr/orders.dxtr.gateway.test.ts b/backend/lib/adapters/gateways/dxtr/orders.dxtr.gateway.test.ts similarity index 99% rename from backend/functions/lib/adapters/gateways/dxtr/orders.dxtr.gateway.test.ts rename to backend/lib/adapters/gateways/dxtr/orders.dxtr.gateway.test.ts index 0d1d983eb..310e87502 100644 --- a/backend/functions/lib/adapters/gateways/dxtr/orders.dxtr.gateway.test.ts +++ b/backend/lib/adapters/gateways/dxtr/orders.dxtr.gateway.test.ts @@ -9,7 +9,7 @@ import { dxtrOrdersSorter, } from './orders.dxtr.gateway'; import { ApplicationContext } from '../../types/basic'; -import { MockData } from '../../../../../../common/src/cams/test-utilities/mock-data'; +import { MockData } from '../../../../../common/src/cams/test-utilities/mock-data'; function getEarliestDate(docket: DxtrOrderDocketEntry[]) { return docket.reduce((earliestDate, de) => { diff --git a/backend/functions/lib/adapters/gateways/dxtr/orders.dxtr.gateway.ts b/backend/lib/adapters/gateways/dxtr/orders.dxtr.gateway.ts similarity index 99% rename from backend/functions/lib/adapters/gateways/dxtr/orders.dxtr.gateway.ts rename to backend/lib/adapters/gateways/dxtr/orders.dxtr.gateway.ts index aa515f110..b93e798a9 100644 --- a/backend/functions/lib/adapters/gateways/dxtr/orders.dxtr.gateway.ts +++ b/backend/lib/adapters/gateways/dxtr/orders.dxtr.gateway.ts @@ -9,9 +9,9 @@ import { RawConsolidationOrder, RawOrderSync, TransferOrder, -} from '../../../../../../common/src/cams/orders'; +} from '../../../../../common/src/cams/orders'; import { DxtrCaseDocketEntryDocument, translateModel } from './case-docket.dxtr.gateway'; -import { CaseDocketEntry } from '../../../../../../common/src/cams/cases'; +import { CaseDocketEntry } from '../../../../../common/src/cams/cases'; const MODULE_NAME = 'ORDERS-DXTR-GATEWAY'; diff --git a/backend/functions/lib/adapters/gateways/gateway-helper.test.ts b/backend/lib/adapters/gateways/gateway-helper.test.ts similarity index 100% rename from backend/functions/lib/adapters/gateways/gateway-helper.test.ts rename to backend/lib/adapters/gateways/gateway-helper.test.ts diff --git a/backend/functions/lib/adapters/gateways/gateway-helper.ts b/backend/lib/adapters/gateways/gateway-helper.ts similarity index 86% rename from backend/functions/lib/adapters/gateways/gateway-helper.ts rename to backend/lib/adapters/gateways/gateway-helper.ts index 714bfdd9c..57ece00e0 100644 --- a/backend/functions/lib/adapters/gateways/gateway-helper.ts +++ b/backend/lib/adapters/gateways/gateway-helper.ts @@ -6,9 +6,9 @@ import { DEBTOR_ATTORNEYS } from '../../testing/mock-data/debtor-attorneys.mock' import { DEBTORS } from '../../testing/mock-data/debtors.mock'; import { DXTR_CASE_DOCKET_ENTRIES } from '../../testing/mock-data/case-docket-entries.mock'; import { CASE_HISTORY } from '../../testing/mock-data/case-history.mock'; -import { CaseDetail, CaseDocketEntry } from '../../../../../common/src/cams/cases'; -import { DebtorAttorney, Party } from '../../../../../common/src/cams/parties'; -import { CaseAssignmentHistory } from '../../../../../common/src/cams/history'; +import { CaseDetail, CaseDocketEntry } from '../../../../common/src/cams/cases'; +import { DebtorAttorney, Party } from '../../../../common/src/cams/parties'; +import { CaseAssignmentHistory } from '../../../../common/src/cams/history'; export class GatewayHelper { getAllCasesMockExtract(): CaseDetail[] { diff --git a/backend/functions/lib/adapters/gateways/mongo/case-assignment.mongo.repository.test.ts b/backend/lib/adapters/gateways/mongo/case-assignment.mongo.repository.test.ts similarity index 98% rename from backend/functions/lib/adapters/gateways/mongo/case-assignment.mongo.repository.test.ts rename to backend/lib/adapters/gateways/mongo/case-assignment.mongo.repository.test.ts index 3f8fa0933..0a2561a9e 100644 --- a/backend/functions/lib/adapters/gateways/mongo/case-assignment.mongo.repository.test.ts +++ b/backend/lib/adapters/gateways/mongo/case-assignment.mongo.repository.test.ts @@ -1,4 +1,4 @@ -import MockData from '../../../../../../common/src/cams/test-utilities/mock-data'; +import MockData from '../../../../../common/src/cams/test-utilities/mock-data'; import { getCamsError } from '../../../common-errors/error-utilities'; import { closeDeferred } from '../../../deferrable/defer-close'; import { createMockApplicationContext } from '../../../testing/testing-utilities'; diff --git a/backend/functions/lib/adapters/gateways/mongo/case-assignment.mongo.repository.ts b/backend/lib/adapters/gateways/mongo/case-assignment.mongo.repository.ts similarity index 97% rename from backend/functions/lib/adapters/gateways/mongo/case-assignment.mongo.repository.ts rename to backend/lib/adapters/gateways/mongo/case-assignment.mongo.repository.ts index 9a1dd124a..db266b923 100644 --- a/backend/functions/lib/adapters/gateways/mongo/case-assignment.mongo.repository.ts +++ b/backend/lib/adapters/gateways/mongo/case-assignment.mongo.repository.ts @@ -1,5 +1,5 @@ import { ApplicationContext } from '../../types/basic'; -import { CaseAssignment } from '../../../../../../common/src/cams/assignments'; +import { CaseAssignment } from '../../../../../common/src/cams/assignments'; import QueryBuilder from '../../../query/query-builder'; import { CaseAssignmentRepository } from '../../../use-cases/gateways.types'; import { getCamsError } from '../../../common-errors/error-utilities'; diff --git a/backend/functions/lib/adapters/gateways/mongo/cases.mongo.repository.test.ts b/backend/lib/adapters/gateways/mongo/cases.mongo.repository.test.ts similarity index 95% rename from backend/functions/lib/adapters/gateways/mongo/cases.mongo.repository.test.ts rename to backend/lib/adapters/gateways/mongo/cases.mongo.repository.test.ts index 0c5170d34..e7723e7c1 100644 --- a/backend/functions/lib/adapters/gateways/mongo/cases.mongo.repository.test.ts +++ b/backend/lib/adapters/gateways/mongo/cases.mongo.repository.test.ts @@ -1,7 +1,7 @@ -import { SYSTEM_USER_REFERENCE } from '../../../../../../common/src/cams/auditable'; -import { TransferFrom, TransferTo } from '../../../../../../common/src/cams/events'; -import { CaseAssignmentHistory } from '../../../../../../common/src/cams/history'; -import MockData from '../../../../../../common/src/cams/test-utilities/mock-data'; +import { SYSTEM_USER_REFERENCE } from '../../../../../common/src/cams/auditable'; +import { TransferFrom, TransferTo } from '../../../../../common/src/cams/events'; +import { CaseAssignmentHistory } from '../../../../../common/src/cams/history'; +import MockData from '../../../../../common/src/cams/test-utilities/mock-data'; import { CamsError } from '../../../common-errors/cams-error'; import { closeDeferred } from '../../../deferrable/defer-close'; import { CASE_HISTORY } from '../../../testing/mock-data/case-history.mock'; diff --git a/backend/functions/lib/adapters/gateways/mongo/cases.mongo.repository.ts b/backend/lib/adapters/gateways/mongo/cases.mongo.repository.ts similarity index 96% rename from backend/functions/lib/adapters/gateways/mongo/cases.mongo.repository.ts rename to backend/lib/adapters/gateways/mongo/cases.mongo.repository.ts index 40178aa32..598225ea3 100644 --- a/backend/functions/lib/adapters/gateways/mongo/cases.mongo.repository.ts +++ b/backend/lib/adapters/gateways/mongo/cases.mongo.repository.ts @@ -4,9 +4,9 @@ import { Transfer, TransferFrom, TransferTo, -} from '../../../../../../common/src/cams/events'; +} from '../../../../../common/src/cams/events'; import { ApplicationContext } from '../../types/basic'; -import { CaseHistory } from '../../../../../../common/src/cams/history'; +import { CaseHistory } from '../../../../../common/src/cams/history'; import QueryBuilder from '../../../query/query-builder'; import { CasesRepository } from '../../../use-cases/gateways.types'; import { getCamsError } from '../../../common-errors/error-utilities'; diff --git a/backend/functions/lib/adapters/gateways/mongo/consolidations.mongo.repository.test.ts b/backend/lib/adapters/gateways/mongo/consolidations.mongo.repository.test.ts similarity index 98% rename from backend/functions/lib/adapters/gateways/mongo/consolidations.mongo.repository.test.ts rename to backend/lib/adapters/gateways/mongo/consolidations.mongo.repository.test.ts index 970520db4..af9632d23 100644 --- a/backend/functions/lib/adapters/gateways/mongo/consolidations.mongo.repository.test.ts +++ b/backend/lib/adapters/gateways/mongo/consolidations.mongo.repository.test.ts @@ -1,6 +1,6 @@ import { ApplicationContext } from '../../types/basic'; import { createMockApplicationContext } from '../../../testing/testing-utilities'; -import MockData from '../../../../../../common/src/cams/test-utilities/mock-data'; +import MockData from '../../../../../common/src/cams/test-utilities/mock-data'; import ConsolidationOrdersMongoRepository from './consolidations.mongo.repository'; import { MongoCollectionAdapter } from './utils/mongo-adapter'; import QueryBuilder from '../../../query/query-builder'; diff --git a/backend/functions/lib/adapters/gateways/mongo/consolidations.mongo.repository.ts b/backend/lib/adapters/gateways/mongo/consolidations.mongo.repository.ts similarity index 93% rename from backend/functions/lib/adapters/gateways/mongo/consolidations.mongo.repository.ts rename to backend/lib/adapters/gateways/mongo/consolidations.mongo.repository.ts index 62c2e08fe..ca6958ec0 100644 --- a/backend/functions/lib/adapters/gateways/mongo/consolidations.mongo.repository.ts +++ b/backend/lib/adapters/gateways/mongo/consolidations.mongo.repository.ts @@ -1,10 +1,10 @@ -import { OrdersSearchPredicate } from '../../../../../../common/src/api/search'; -import { ConsolidationOrder } from '../../../../../../common/src/cams/orders'; +import { OrdersSearchPredicate } from '../../../../../common/src/api/search'; +import { ConsolidationOrder } from '../../../../../common/src/cams/orders'; import QueryBuilder, { ConditionOrConjunction } from '../../../query/query-builder'; import { ConsolidationOrdersRepository } from '../../../use-cases/gateways.types'; import { ApplicationContext } from '../../types/basic'; import { getCamsError } from '../../../common-errors/error-utilities'; -import { CamsDocument } from '../../../../../../common/src/cams/document'; +import { CamsDocument } from '../../../../../common/src/cams/document'; import { BaseMongoRepository } from './utils/base-mongo-repository'; const MODULE_NAME: string = 'CONSOLIDATIONS_MONGO_REPOSITORY'; diff --git a/backend/functions/lib/adapters/gateways/mongo/offices.mongo.repository.test.ts b/backend/lib/adapters/gateways/mongo/offices.mongo.repository.test.ts similarity index 93% rename from backend/functions/lib/adapters/gateways/mongo/offices.mongo.repository.test.ts rename to backend/lib/adapters/gateways/mongo/offices.mongo.repository.test.ts index 8ae93dfaf..1b0cf6d79 100644 --- a/backend/functions/lib/adapters/gateways/mongo/offices.mongo.repository.test.ts +++ b/backend/lib/adapters/gateways/mongo/offices.mongo.repository.test.ts @@ -5,11 +5,11 @@ import { } from '../../../testing/testing-utilities'; import { ApplicationContext } from '../../types/basic'; import { MongoCollectionAdapter } from './utils/mongo-adapter'; -import MockData from '../../../../../../common/src/cams/test-utilities/mock-data'; +import MockData from '../../../../../common/src/cams/test-utilities/mock-data'; import QueryBuilder from '../../../query/query-builder'; -import { CamsRole } from '../../../../../../common/src/cams/roles'; +import { CamsRole } from '../../../../../common/src/cams/roles'; import { closeDeferred } from '../../../deferrable/defer-close'; -import { createAuditRecord } from '../../../../../../common/src/cams/auditable'; +import { createAuditRecord } from '../../../../../common/src/cams/auditable'; import { getCamsError } from '../../../common-errors/error-utilities'; describe('offices repo', () => { diff --git a/backend/functions/lib/adapters/gateways/mongo/offices.mongo.repository.ts b/backend/lib/adapters/gateways/mongo/offices.mongo.repository.ts similarity index 90% rename from backend/functions/lib/adapters/gateways/mongo/offices.mongo.repository.ts rename to backend/lib/adapters/gateways/mongo/offices.mongo.repository.ts index 9ee537311..3f9aab637 100644 --- a/backend/functions/lib/adapters/gateways/mongo/offices.mongo.repository.ts +++ b/backend/lib/adapters/gateways/mongo/offices.mongo.repository.ts @@ -1,8 +1,8 @@ import { ApplicationContext } from '../../types/basic'; -import { AttorneyUser, CamsUserReference, Staff } from '../../../../../../common/src/cams/users'; -import { Auditable, createAuditRecord } from '../../../../../../common/src/cams/auditable'; -import { CamsRole } from '../../../../../../common/src/cams/roles'; -import { getCamsUserReference } from '../../../../../../common/src/cams/session'; +import { AttorneyUser, CamsUserReference, Staff } from '../../../../../common/src/cams/users'; +import { Auditable, createAuditRecord } from '../../../../../common/src/cams/auditable'; +import { CamsRole } from '../../../../../common/src/cams/roles'; +import { getCamsUserReference } from '../../../../../common/src/cams/session'; import QueryBuilder from '../../../query/query-builder'; import { getCamsError } from '../../../common-errors/error-utilities'; import { OfficesRepository } from '../../../use-cases/gateways.types'; diff --git a/backend/functions/lib/adapters/gateways/mongo/orders.mongo.repository.test.ts b/backend/lib/adapters/gateways/mongo/orders.mongo.repository.test.ts similarity index 97% rename from backend/functions/lib/adapters/gateways/mongo/orders.mongo.repository.test.ts rename to backend/lib/adapters/gateways/mongo/orders.mongo.repository.test.ts index 9a8f947e0..0d8210578 100644 --- a/backend/functions/lib/adapters/gateways/mongo/orders.mongo.repository.test.ts +++ b/backend/lib/adapters/gateways/mongo/orders.mongo.repository.test.ts @@ -1,8 +1,8 @@ import { createMockApplicationContext } from '../../../testing/testing-utilities'; import { OrdersMongoRepository } from './orders.mongo.repository'; import { ApplicationContext } from '../../types/basic'; -import MockData from '../../../../../../common/src/cams/test-utilities/mock-data'; -import { TransferOrderAction } from '../../../../../../common/src/cams/orders'; +import MockData from '../../../../../common/src/cams/test-utilities/mock-data'; +import { TransferOrderAction } from '../../../../../common/src/cams/orders'; import { MongoCollectionAdapter } from './utils/mongo-adapter'; import QueryBuilder from '../../../query/query-builder'; import { closeDeferred } from '../../../deferrable/defer-close'; diff --git a/backend/functions/lib/adapters/gateways/mongo/orders.mongo.repository.ts b/backend/lib/adapters/gateways/mongo/orders.mongo.repository.ts similarity index 94% rename from backend/functions/lib/adapters/gateways/mongo/orders.mongo.repository.ts rename to backend/lib/adapters/gateways/mongo/orders.mongo.repository.ts index 40d308f83..417d502ec 100644 --- a/backend/functions/lib/adapters/gateways/mongo/orders.mongo.repository.ts +++ b/backend/lib/adapters/gateways/mongo/orders.mongo.repository.ts @@ -1,9 +1,5 @@ -import { OrdersSearchPredicate } from '../../../../../../common/src/api/search'; -import { - Order, - TransferOrder, - TransferOrderAction, -} from '../../../../../../common/src/cams/orders'; +import { OrdersSearchPredicate } from '../../../../../common/src/api/search'; +import { Order, TransferOrder, TransferOrderAction } from '../../../../../common/src/cams/orders'; import { ApplicationContext } from '../../types/basic'; import { OrdersRepository } from '../../../use-cases/gateways.types'; import QueryBuilder, { ConditionOrConjunction } from '../../../query/query-builder'; diff --git a/backend/functions/lib/adapters/gateways/mongo/runtime-state.mongo.repository.test.ts b/backend/lib/adapters/gateways/mongo/runtime-state.mongo.repository.test.ts similarity index 100% rename from backend/functions/lib/adapters/gateways/mongo/runtime-state.mongo.repository.test.ts rename to backend/lib/adapters/gateways/mongo/runtime-state.mongo.repository.test.ts diff --git a/backend/functions/lib/adapters/gateways/mongo/runtime-state.mongo.repository.ts b/backend/lib/adapters/gateways/mongo/runtime-state.mongo.repository.ts similarity index 100% rename from backend/functions/lib/adapters/gateways/mongo/runtime-state.mongo.repository.ts rename to backend/lib/adapters/gateways/mongo/runtime-state.mongo.repository.ts diff --git a/backend/functions/lib/adapters/gateways/mongo/user-session-cache.mongo.repository.test.ts b/backend/lib/adapters/gateways/mongo/user-session-cache.mongo.repository.test.ts similarity index 95% rename from backend/functions/lib/adapters/gateways/mongo/user-session-cache.mongo.repository.test.ts rename to backend/lib/adapters/gateways/mongo/user-session-cache.mongo.repository.test.ts index de64a44e6..743dfb170 100644 --- a/backend/functions/lib/adapters/gateways/mongo/user-session-cache.mongo.repository.test.ts +++ b/backend/lib/adapters/gateways/mongo/user-session-cache.mongo.repository.test.ts @@ -5,8 +5,8 @@ import { CachedCamsSession, UserSessionCacheMongoRepository, } from './user-session-cache.mongo.repository'; -import { MockData } from '../../../../../../common/src/cams/test-utilities/mock-data'; -import { CamsJwtClaims } from '../../../../../../common/src/cams/jwt'; +import { MockData } from '../../../../../common/src/cams/test-utilities/mock-data'; +import { CamsJwtClaims } from '../../../../../common/src/cams/jwt'; import { MongoCollectionAdapter } from './utils/mongo-adapter'; import { closeDeferred } from '../../../deferrable/defer-close'; import QueryBuilder from '../../../query/query-builder'; diff --git a/backend/functions/lib/adapters/gateways/mongo/user-session-cache.mongo.repository.ts b/backend/lib/adapters/gateways/mongo/user-session-cache.mongo.repository.ts similarity index 95% rename from backend/functions/lib/adapters/gateways/mongo/user-session-cache.mongo.repository.ts rename to backend/lib/adapters/gateways/mongo/user-session-cache.mongo.repository.ts index fdba69d2d..ba3deb9ca 100644 --- a/backend/functions/lib/adapters/gateways/mongo/user-session-cache.mongo.repository.ts +++ b/backend/lib/adapters/gateways/mongo/user-session-cache.mongo.repository.ts @@ -1,8 +1,8 @@ import * as jwt from 'jsonwebtoken'; import { ApplicationContext } from '../../types/basic'; -import { CamsSession } from '../../../../../../common/src/cams/session'; +import { CamsSession } from '../../../../../common/src/cams/session'; import { UnauthorizedError } from '../../../common-errors/unauthorized-error'; -import { CamsJwtClaims } from '../../../../../../common/src/cams/jwt'; +import { CamsJwtClaims } from '../../../../../common/src/cams/jwt'; import { getCamsError } from '../../../common-errors/error-utilities'; import QueryBuilder from '../../../query/query-builder'; import { UserSessionCacheRepository } from '../../../use-cases/gateways.types'; diff --git a/backend/functions/lib/adapters/gateways/mongo/utils/base-mongo-repository.ts b/backend/lib/adapters/gateways/mongo/utils/base-mongo-repository.ts similarity index 100% rename from backend/functions/lib/adapters/gateways/mongo/utils/base-mongo-repository.ts rename to backend/lib/adapters/gateways/mongo/utils/base-mongo-repository.ts diff --git a/backend/functions/lib/adapters/gateways/mongo/utils/mongo-adapter.test.ts b/backend/lib/adapters/gateways/mongo/utils/mongo-adapter.test.ts similarity index 100% rename from backend/functions/lib/adapters/gateways/mongo/utils/mongo-adapter.test.ts rename to backend/lib/adapters/gateways/mongo/utils/mongo-adapter.test.ts diff --git a/backend/functions/lib/adapters/gateways/mongo/utils/mongo-adapter.ts b/backend/lib/adapters/gateways/mongo/utils/mongo-adapter.ts similarity index 100% rename from backend/functions/lib/adapters/gateways/mongo/utils/mongo-adapter.ts rename to backend/lib/adapters/gateways/mongo/utils/mongo-adapter.ts diff --git a/backend/functions/lib/adapters/gateways/mongo/utils/mongo-query-renderer.test.ts b/backend/lib/adapters/gateways/mongo/utils/mongo-query-renderer.test.ts similarity index 100% rename from backend/functions/lib/adapters/gateways/mongo/utils/mongo-query-renderer.test.ts rename to backend/lib/adapters/gateways/mongo/utils/mongo-query-renderer.test.ts diff --git a/backend/functions/lib/adapters/gateways/mongo/utils/mongo-query-renderer.ts b/backend/lib/adapters/gateways/mongo/utils/mongo-query-renderer.ts similarity index 100% rename from backend/functions/lib/adapters/gateways/mongo/utils/mongo-query-renderer.ts rename to backend/lib/adapters/gateways/mongo/utils/mongo-query-renderer.ts diff --git a/backend/functions/lib/adapters/gateways/okta/HumbleVerifier.ts b/backend/lib/adapters/gateways/okta/HumbleVerifier.ts similarity index 94% rename from backend/functions/lib/adapters/gateways/okta/HumbleVerifier.ts rename to backend/lib/adapters/gateways/okta/HumbleVerifier.ts index 71c473e83..d93fc98c1 100644 --- a/backend/functions/lib/adapters/gateways/okta/HumbleVerifier.ts +++ b/backend/lib/adapters/gateways/okta/HumbleVerifier.ts @@ -1,6 +1,6 @@ /* eslint-disable-next-line @typescript-eslint/no-require-imports */ import OktaJwtVerifier = require('@okta/jwt-verifier'); -import { CamsJwt } from '../../../../../../common/src/cams/jwt'; +import { CamsJwt } from '../../../../../common/src/cams/jwt'; type Algorithm = | 'HS256' diff --git a/backend/functions/lib/adapters/gateways/okta/okta-gateway.test.ts b/backend/lib/adapters/gateways/okta/okta-gateway.test.ts similarity index 98% rename from backend/functions/lib/adapters/gateways/okta/okta-gateway.test.ts rename to backend/lib/adapters/gateways/okta/okta-gateway.test.ts index 5254ac71c..7830fb255 100644 --- a/backend/functions/lib/adapters/gateways/okta/okta-gateway.test.ts +++ b/backend/lib/adapters/gateways/okta/okta-gateway.test.ts @@ -2,7 +2,7 @@ import * as Verifier from './HumbleVerifier'; import { UnauthorizedError } from '../../../common-errors/unauthorized-error'; import MockFetch from '../../../testing/mock-fetch'; import OktaGateway from './okta-gateway'; -import { CamsJwtHeader } from '../../../../../../common/src/cams/jwt'; +import { CamsJwtHeader } from '../../../../../common/src/cams/jwt'; import * as AuthorizationConfiguration from '../../../configs/authorization-configuration'; import { AuthorizationConfig } from '../../types/authorization'; diff --git a/backend/functions/lib/adapters/gateways/okta/okta-gateway.ts b/backend/lib/adapters/gateways/okta/okta-gateway.ts similarity index 95% rename from backend/functions/lib/adapters/gateways/okta/okta-gateway.ts rename to backend/lib/adapters/gateways/okta/okta-gateway.ts index 6cd4929b3..d275df5ff 100644 --- a/backend/functions/lib/adapters/gateways/okta/okta-gateway.ts +++ b/backend/lib/adapters/gateways/okta/okta-gateway.ts @@ -3,8 +3,8 @@ import { OpenIdConnectGateway } from '../../types/authorization'; import { ServerConfigError } from '../../../common-errors/server-config-error'; import { UnauthorizedError } from '../../../common-errors/unauthorized-error'; import { verifyAccessToken } from './HumbleVerifier'; -import { CamsUser } from '../../../../../../common/src/cams/users'; -import { CamsJwt } from '../../../../../../common/src/cams/jwt'; +import { CamsUser } from '../../../../../common/src/cams/users'; +import { CamsJwt } from '../../../../../common/src/cams/jwt'; import { isCamsError } from '../../../common-errors/cams-error'; const MODULE_NAME = 'OKTA-GATEWAY'; diff --git a/backend/functions/lib/adapters/gateways/okta/okta-user-group-gateway.test.ts b/backend/lib/adapters/gateways/okta/okta-user-group-gateway.test.ts similarity index 99% rename from backend/functions/lib/adapters/gateways/okta/okta-user-group-gateway.test.ts rename to backend/lib/adapters/gateways/okta/okta-user-group-gateway.test.ts index 1854486db..7aabb24c7 100644 --- a/backend/functions/lib/adapters/gateways/okta/okta-user-group-gateway.test.ts +++ b/backend/lib/adapters/gateways/okta/okta-user-group-gateway.test.ts @@ -1,5 +1,5 @@ import { Collection, Group, User } from '@okta/okta-sdk-nodejs'; -import { CamsUserGroup, CamsUserReference } from '../../../../../../common/src/cams/users'; +import { CamsUserGroup, CamsUserReference } from '../../../../../common/src/cams/users'; import { OktaUserGroupGateway } from './okta-user-group-gateway'; import { UnknownError } from '../../../common-errors/unknown-error'; import { UserGroupGatewayConfig } from '../../types/authorization'; diff --git a/backend/functions/lib/adapters/gateways/okta/okta-user-group-gateway.ts b/backend/lib/adapters/gateways/okta/okta-user-group-gateway.ts similarity index 99% rename from backend/functions/lib/adapters/gateways/okta/okta-user-group-gateway.ts rename to backend/lib/adapters/gateways/okta/okta-user-group-gateway.ts index 27b2416b9..db84fce1b 100644 --- a/backend/functions/lib/adapters/gateways/okta/okta-user-group-gateway.ts +++ b/backend/lib/adapters/gateways/okta/okta-user-group-gateway.ts @@ -3,7 +3,7 @@ import { GroupApiListGroupsRequest, GroupApiListGroupUsersRequest, } from '@okta/okta-sdk-nodejs'; -import { CamsUserGroup, CamsUserReference } from '../../../../../../common/src/cams/users'; +import { CamsUserGroup, CamsUserReference } from '../../../../../common/src/cams/users'; import { UserGroupGateway, UserGroupGatewayConfig } from '../../types/authorization'; import { V2Configuration } from '@okta/okta-sdk-nodejs/src/types/configuration'; import { UnknownError } from '../../../common-errors/unknown-error'; diff --git a/backend/functions/lib/adapters/gateways/petition-gateway.test.ts b/backend/lib/adapters/gateways/petition-gateway.test.ts similarity index 100% rename from backend/functions/lib/adapters/gateways/petition-gateway.test.ts rename to backend/lib/adapters/gateways/petition-gateway.test.ts diff --git a/backend/functions/lib/adapters/gateways/petition-gateway.ts b/backend/lib/adapters/gateways/petition-gateway.ts similarity index 100% rename from backend/functions/lib/adapters/gateways/petition-gateway.ts rename to backend/lib/adapters/gateways/petition-gateway.ts diff --git a/backend/functions/lib/adapters/gateways/storage/local-storage-gateway.test.ts b/backend/lib/adapters/gateways/storage/local-storage-gateway.test.ts similarity index 93% rename from backend/functions/lib/adapters/gateways/storage/local-storage-gateway.test.ts rename to backend/lib/adapters/gateways/storage/local-storage-gateway.test.ts index 2cb4a0d5d..c723fa0e9 100644 --- a/backend/functions/lib/adapters/gateways/storage/local-storage-gateway.test.ts +++ b/backend/lib/adapters/gateways/storage/local-storage-gateway.test.ts @@ -2,7 +2,7 @@ import LocalStorageGateway, { OFFICE_MAPPING_PATH, ROLE_MAPPING_PATH, } from './local-storage-gateway'; -import { CamsRole } from '../../../../../../common/src/cams/roles'; +import { CamsRole } from '../../../../../common/src/cams/roles'; describe('map get', () => { test('should return appropriate string for valid path', () => { diff --git a/backend/functions/lib/adapters/gateways/storage/local-storage-gateway.ts b/backend/lib/adapters/gateways/storage/local-storage-gateway.ts similarity index 96% rename from backend/functions/lib/adapters/gateways/storage/local-storage-gateway.ts rename to backend/lib/adapters/gateways/storage/local-storage-gateway.ts index 038994f52..65e1f0ebf 100644 --- a/backend/functions/lib/adapters/gateways/storage/local-storage-gateway.ts +++ b/backend/lib/adapters/gateways/storage/local-storage-gateway.ts @@ -1,10 +1,10 @@ -import { CamsRole } from '../../../../../../common/src/cams/roles'; +import { CamsRole } from '../../../../../common/src/cams/roles'; import { StorageGateway } from '../../types/storage'; import { USTP_OFFICES_ARRAY, UstpDivisionMeta, UstpOfficeDetails, -} from '../../../../../../common/src/cams/offices'; +} from '../../../../../common/src/cams/offices'; let roleMapping: Map; export const ROLE_MAPPING_PATH = '/rolemapping.csv'; diff --git a/backend/functions/lib/adapters/services/logger.service.test.ts b/backend/lib/adapters/services/logger.service.test.ts similarity index 100% rename from backend/functions/lib/adapters/services/logger.service.test.ts rename to backend/lib/adapters/services/logger.service.test.ts diff --git a/backend/functions/lib/adapters/services/logger.service.ts b/backend/lib/adapters/services/logger.service.ts similarity index 100% rename from backend/functions/lib/adapters/services/logger.service.ts rename to backend/lib/adapters/services/logger.service.ts diff --git a/backend/functions/lib/adapters/types/authorization.ts b/backend/lib/adapters/types/authorization.ts similarity index 90% rename from backend/functions/lib/adapters/types/authorization.ts rename to backend/lib/adapters/types/authorization.ts index 06976d508..8bc125d96 100644 --- a/backend/functions/lib/adapters/types/authorization.ts +++ b/backend/lib/adapters/types/authorization.ts @@ -1,5 +1,5 @@ -import { CamsUser, CamsUserGroup, CamsUserReference } from '../../../../../common/src/cams/users'; -import { CamsJwt } from '../../../../../common/src/cams/jwt'; +import { CamsUser, CamsUserGroup, CamsUserReference } from '../../../../common/src/cams/users'; +import { CamsJwt } from '../../../../common/src/cams/jwt'; import { ApplicationContext } from './basic'; export type AuthorizationConfig = { diff --git a/backend/functions/lib/adapters/types/basic.d.ts b/backend/lib/adapters/types/basic.d.ts similarity index 96% rename from backend/functions/lib/adapters/types/basic.d.ts rename to backend/lib/adapters/types/basic.d.ts index 189afebbc..fa59b19c0 100644 --- a/backend/functions/lib/adapters/types/basic.d.ts +++ b/backend/lib/adapters/types/basic.d.ts @@ -1,6 +1,6 @@ import { ApplicationConfiguration } from '../../configs/application-configuration'; import { CamsError } from '../../common-errors/cams-error'; -import { CamsSession } from '../../../../../common/src/cams/session'; +import { CamsSession } from '../../../../common/src/cams/session'; import { CamsHttpRequest } from './http'; import { Closable } from '../../deferrable/defer-close'; import { Releasable } from '../../use-cases/gateways.types'; diff --git a/backend/functions/lib/adapters/types/cases.d.ts b/backend/lib/adapters/types/cases.d.ts similarity index 100% rename from backend/functions/lib/adapters/types/cases.d.ts rename to backend/lib/adapters/types/cases.d.ts diff --git a/backend/functions/lib/adapters/types/database.d.ts b/backend/lib/adapters/types/database.d.ts similarity index 100% rename from backend/functions/lib/adapters/types/database.d.ts rename to backend/lib/adapters/types/database.d.ts diff --git a/backend/functions/lib/adapters/types/http.d.ts b/backend/lib/adapters/types/http.d.ts similarity index 100% rename from backend/functions/lib/adapters/types/http.d.ts rename to backend/lib/adapters/types/http.d.ts diff --git a/backend/functions/lib/adapters/types/persistence.gateway.d.ts b/backend/lib/adapters/types/persistence.gateway.d.ts similarity index 95% rename from backend/functions/lib/adapters/types/persistence.gateway.d.ts rename to backend/lib/adapters/types/persistence.gateway.d.ts index 15ec70305..c63c9aca4 100644 --- a/backend/functions/lib/adapters/types/persistence.gateway.d.ts +++ b/backend/lib/adapters/types/persistence.gateway.d.ts @@ -1,7 +1,7 @@ import { RecordObj, ObjectKeyVal } from './basic'; import { DbResult } from './database'; import { ApplicationContext } from './basic'; -import { AttorneyUser } from '../../../../../common/src/cams/users'; +import { AttorneyUser } from '../../../../common/src/cams/users'; export interface PersistenceGateway { createRecord( diff --git a/backend/functions/lib/adapters/types/region.d.ts b/backend/lib/adapters/types/region.d.ts similarity index 100% rename from backend/functions/lib/adapters/types/region.d.ts rename to backend/lib/adapters/types/region.d.ts diff --git a/backend/functions/lib/adapters/types/storage.ts b/backend/lib/adapters/types/storage.ts similarity index 74% rename from backend/functions/lib/adapters/types/storage.ts rename to backend/lib/adapters/types/storage.ts index 9636c96b1..9fb1d6bd9 100644 --- a/backend/functions/lib/adapters/types/storage.ts +++ b/backend/lib/adapters/types/storage.ts @@ -1,5 +1,5 @@ -import { CamsRole } from '../../../../../common/src/cams/roles'; -import { UstpDivisionMeta, UstpOfficeDetails } from '../../../../../common/src/cams/offices'; +import { CamsRole } from '../../../../common/src/cams/roles'; +import { UstpDivisionMeta, UstpOfficeDetails } from '../../../../common/src/cams/offices'; export type StorageGateway = { get(key: string): string | null; diff --git a/backend/functions/lib/adapters/utils/database.exception.test.ts b/backend/lib/adapters/utils/database.exception.test.ts similarity index 98% rename from backend/functions/lib/adapters/utils/database.exception.test.ts rename to backend/lib/adapters/utils/database.exception.test.ts index 639be3d72..ac89423ad 100644 --- a/backend/functions/lib/adapters/utils/database.exception.test.ts +++ b/backend/lib/adapters/utils/database.exception.test.ts @@ -1,4 +1,4 @@ -import { executeQuery } from '../utils/database'; +import { executeQuery } from './database'; import { QueryResults, IDbConfig } from '../types/database'; import { ConnectionError, MSSQLError, RequestError } from 'mssql'; import { createMockApplicationContext } from '../../testing/testing-utilities'; diff --git a/backend/functions/lib/adapters/utils/database.test.ts b/backend/lib/adapters/utils/database.test.ts similarity index 97% rename from backend/functions/lib/adapters/utils/database.test.ts rename to backend/lib/adapters/utils/database.test.ts index 9ef67ec4d..458fc8439 100644 --- a/backend/functions/lib/adapters/utils/database.test.ts +++ b/backend/lib/adapters/utils/database.test.ts @@ -1,4 +1,4 @@ -import { executeQuery } from '../utils/database'; +import { executeQuery } from './database'; import { QueryResults, IDbConfig } from '../types/database'; import { createMockApplicationContext } from '../../testing/testing-utilities'; diff --git a/backend/functions/lib/adapters/utils/database.ts b/backend/lib/adapters/utils/database.ts similarity index 100% rename from backend/functions/lib/adapters/utils/database.ts rename to backend/lib/adapters/utils/database.ts diff --git a/backend/functions/lib/adapters/utils/date-helper.test.ts b/backend/lib/adapters/utils/date-helper.test.ts similarity index 100% rename from backend/functions/lib/adapters/utils/date-helper.test.ts rename to backend/lib/adapters/utils/date-helper.test.ts diff --git a/backend/functions/lib/adapters/utils/date-helper.ts b/backend/lib/adapters/utils/date-helper.ts similarity index 100% rename from backend/functions/lib/adapters/utils/date-helper.ts rename to backend/lib/adapters/utils/date-helper.ts diff --git a/backend/functions/lib/adapters/utils/feature-flag.test.ts b/backend/lib/adapters/utils/feature-flag.test.ts similarity index 100% rename from backend/functions/lib/adapters/utils/feature-flag.test.ts rename to backend/lib/adapters/utils/feature-flag.test.ts diff --git a/backend/functions/lib/adapters/utils/feature-flag.ts b/backend/lib/adapters/utils/feature-flag.ts similarity index 92% rename from backend/functions/lib/adapters/utils/feature-flag.ts rename to backend/lib/adapters/utils/feature-flag.ts index 05cd60e68..02bedf958 100644 --- a/backend/functions/lib/adapters/utils/feature-flag.ts +++ b/backend/lib/adapters/utils/feature-flag.ts @@ -1,6 +1,6 @@ import * as ld from '@launchdarkly/node-server-sdk'; import { ApplicationConfiguration } from '../../configs/application-configuration'; -import { defaultFeatureFlags } from '../../../../../common/src/feature-flags'; +import { defaultFeatureFlags } from '../../../../common/src/feature-flags'; import { FeatureFlagSet } from '../types/basic'; export async function getFeatureFlags(config: ApplicationConfiguration): Promise { diff --git a/backend/functions/lib/adapters/utils/http-response.test.ts b/backend/lib/adapters/utils/http-response.test.ts similarity index 100% rename from backend/functions/lib/adapters/utils/http-response.test.ts rename to backend/lib/adapters/utils/http-response.test.ts diff --git a/backend/functions/lib/adapters/utils/http-response.ts b/backend/lib/adapters/utils/http-response.ts similarity index 82% rename from backend/functions/lib/adapters/utils/http-response.ts rename to backend/lib/adapters/utils/http-response.ts index 29e0d2462..b7020bc41 100644 --- a/backend/functions/lib/adapters/utils/http-response.ts +++ b/backend/lib/adapters/utils/http-response.ts @@ -1,5 +1,5 @@ -import HttpStatusCodes from '../../../../../common/src/api/http-status-codes'; -import { ResponseBody } from '../../../../../common/src/api/response'; +import HttpStatusCodes from '../../../../common/src/api/http-status-codes'; +import { ResponseBody } from '../../../../common/src/api/response'; export const commonHeaders: Record = { 'Content-Type': 'application/json', diff --git a/backend/functions/lib/adapters/utils/string-helper.test.ts b/backend/lib/adapters/utils/string-helper.test.ts similarity index 100% rename from backend/functions/lib/adapters/utils/string-helper.test.ts rename to backend/lib/adapters/utils/string-helper.test.ts diff --git a/backend/functions/lib/adapters/utils/string-helper.ts b/backend/lib/adapters/utils/string-helper.ts similarity index 100% rename from backend/functions/lib/adapters/utils/string-helper.ts rename to backend/lib/adapters/utils/string-helper.ts diff --git a/backend/functions/lib/common-errors/bad-request.ts b/backend/lib/common-errors/bad-request.ts similarity index 84% rename from backend/functions/lib/common-errors/bad-request.ts rename to backend/lib/common-errors/bad-request.ts index e05fa6db1..549d453e2 100644 --- a/backend/functions/lib/common-errors/bad-request.ts +++ b/backend/lib/common-errors/bad-request.ts @@ -1,5 +1,5 @@ import { CamsError, CamsErrorOptions } from './cams-error'; -import HttpStatusCodes from '../../../../common/src/api/http-status-codes'; +import HttpStatusCodes from '../../../common/src/api/http-status-codes'; /* eslint-disable-next-line @typescript-eslint/no-empty-object-type */ interface BadRequestErrorOptions extends CamsErrorOptions {} diff --git a/backend/functions/lib/common-errors/cams-error.ts b/backend/lib/common-errors/cams-error.ts similarity index 90% rename from backend/functions/lib/common-errors/cams-error.ts rename to backend/lib/common-errors/cams-error.ts index b8dd9ff37..9685cd13f 100644 --- a/backend/functions/lib/common-errors/cams-error.ts +++ b/backend/lib/common-errors/cams-error.ts @@ -1,4 +1,4 @@ -import HttpStatusCodes from '../../../../common/src/api/http-status-codes'; +import HttpStatusCodes from '../../../common/src/api/http-status-codes'; export interface CamsErrorOptions { status?: number; diff --git a/backend/functions/lib/common-errors/common-errors.test.ts b/backend/lib/common-errors/common-errors.test.ts similarity index 96% rename from backend/functions/lib/common-errors/common-errors.test.ts rename to backend/lib/common-errors/common-errors.test.ts index 8e3059459..9afed4487 100644 --- a/backend/functions/lib/common-errors/common-errors.test.ts +++ b/backend/lib/common-errors/common-errors.test.ts @@ -5,7 +5,7 @@ import { NotFoundError } from './not-found-error'; import { ServerConfigError } from './server-config-error'; import { UnauthorizedError } from './unauthorized-error'; import { UnknownError } from './unknown-error'; -import HttpStatusCodes from '../../../../common/src/api/http-status-codes'; +import HttpStatusCodes from '../../../common/src/api/http-status-codes'; describe('Common errors', () => { const testModuleName = 'Test'; diff --git a/backend/functions/lib/common-errors/error-utilities.test.ts b/backend/lib/common-errors/error-utilities.test.ts similarity index 91% rename from backend/functions/lib/common-errors/error-utilities.test.ts rename to backend/lib/common-errors/error-utilities.test.ts index 03695b9f5..1b68b6972 100644 --- a/backend/functions/lib/common-errors/error-utilities.test.ts +++ b/backend/lib/common-errors/error-utilities.test.ts @@ -1,7 +1,7 @@ import { UnauthorizedError } from './unauthorized-error'; import { getCamsError } from './error-utilities'; import { isCamsError } from './cams-error'; -import HttpStatusCodes from '../../../../common/src/api/http-status-codes'; +import HttpStatusCodes from '../../../common/src/api/http-status-codes'; const MODULE_NAME = 'test-module'; describe('error utilities tests', () => { diff --git a/backend/functions/lib/common-errors/error-utilities.ts b/backend/lib/common-errors/error-utilities.ts similarity index 100% rename from backend/functions/lib/common-errors/error-utilities.ts rename to backend/lib/common-errors/error-utilities.ts diff --git a/backend/functions/lib/common-errors/forbidden-error.ts b/backend/lib/common-errors/forbidden-error.ts similarity index 85% rename from backend/functions/lib/common-errors/forbidden-error.ts rename to backend/lib/common-errors/forbidden-error.ts index 2b32e6f41..c8f3f6e91 100644 --- a/backend/functions/lib/common-errors/forbidden-error.ts +++ b/backend/lib/common-errors/forbidden-error.ts @@ -1,5 +1,5 @@ import { CamsError, CamsErrorOptions } from './cams-error'; -import HttpStatusCodes from '../../../../common/src/api/http-status-codes'; +import HttpStatusCodes from '../../../common/src/api/http-status-codes'; /* eslint-disable-next-line @typescript-eslint/no-empty-object-type */ interface ForbiddenErrorOptions extends CamsErrorOptions {} diff --git a/backend/functions/lib/common-errors/not-found-error.ts b/backend/lib/common-errors/not-found-error.ts similarity index 88% rename from backend/functions/lib/common-errors/not-found-error.ts rename to backend/lib/common-errors/not-found-error.ts index d82f53df5..8d8e6f975 100644 --- a/backend/functions/lib/common-errors/not-found-error.ts +++ b/backend/lib/common-errors/not-found-error.ts @@ -1,5 +1,5 @@ import { CamsError, CamsErrorOptions, isCamsError } from './cams-error'; -import HttpStatusCodes from '../../../../common/src/api/http-status-codes'; +import HttpStatusCodes from '../../../common/src/api/http-status-codes'; /* eslint-disable-next-line @typescript-eslint/no-empty-object-type */ interface NotFoundErrorOptions extends CamsErrorOptions {} diff --git a/backend/functions/lib/common-errors/server-config-error.ts b/backend/lib/common-errors/server-config-error.ts similarity index 86% rename from backend/functions/lib/common-errors/server-config-error.ts rename to backend/lib/common-errors/server-config-error.ts index d0de0694f..85641b335 100644 --- a/backend/functions/lib/common-errors/server-config-error.ts +++ b/backend/lib/common-errors/server-config-error.ts @@ -1,5 +1,5 @@ import { CamsError, CamsErrorOptions } from './cams-error'; -import HttpStatusCodes from '../../../../common/src/api/http-status-codes'; +import HttpStatusCodes from '../../../common/src/api/http-status-codes'; /* eslint-disable-next-line @typescript-eslint/no-empty-object-type */ export interface ServerConfigErrorOptions extends CamsErrorOptions {} diff --git a/backend/functions/lib/common-errors/unauthorized-error.ts b/backend/lib/common-errors/unauthorized-error.ts similarity index 84% rename from backend/functions/lib/common-errors/unauthorized-error.ts rename to backend/lib/common-errors/unauthorized-error.ts index 7d0c50d52..bcdb99834 100644 --- a/backend/functions/lib/common-errors/unauthorized-error.ts +++ b/backend/lib/common-errors/unauthorized-error.ts @@ -1,5 +1,5 @@ import { CamsError, CamsErrorOptions } from './cams-error'; -import HttpStatusCodes from '../../../../common/src/api/http-status-codes'; +import HttpStatusCodes from '../../../common/src/api/http-status-codes'; /* eslint-disable-next-line @typescript-eslint/no-empty-object-type */ interface UnauthorizedErrorOptions extends CamsErrorOptions {} diff --git a/backend/functions/lib/common-errors/unknown-error.ts b/backend/lib/common-errors/unknown-error.ts similarity index 85% rename from backend/functions/lib/common-errors/unknown-error.ts rename to backend/lib/common-errors/unknown-error.ts index fc5c5fd75..49d5c7a9f 100644 --- a/backend/functions/lib/common-errors/unknown-error.ts +++ b/backend/lib/common-errors/unknown-error.ts @@ -1,5 +1,5 @@ import { CamsError, CamsErrorOptions } from './cams-error'; -import HttpStatusCodes from '../../../../common/src/api/http-status-codes'; +import HttpStatusCodes from '../../../common/src/api/http-status-codes'; /* eslint-disable-next-line @typescript-eslint/no-empty-object-type */ interface UnknownErrorOptions extends CamsErrorOptions {} diff --git a/backend/functions/lib/configs/application-configuration.test.ts b/backend/lib/configs/application-configuration.test.ts similarity index 100% rename from backend/functions/lib/configs/application-configuration.test.ts rename to backend/lib/configs/application-configuration.test.ts diff --git a/backend/functions/lib/configs/application-configuration.ts b/backend/lib/configs/application-configuration.ts similarity index 100% rename from backend/functions/lib/configs/application-configuration.ts rename to backend/lib/configs/application-configuration.ts diff --git a/backend/functions/lib/configs/authorization-configuration.test.ts b/backend/lib/configs/authorization-configuration.test.ts similarity index 100% rename from backend/functions/lib/configs/authorization-configuration.test.ts rename to backend/lib/configs/authorization-configuration.test.ts diff --git a/backend/functions/lib/configs/authorization-configuration.ts b/backend/lib/configs/authorization-configuration.ts similarity index 89% rename from backend/functions/lib/configs/authorization-configuration.ts rename to backend/lib/configs/authorization-configuration.ts index 82479b985..9e1c31787 100644 --- a/backend/functions/lib/configs/authorization-configuration.ts +++ b/backend/lib/configs/authorization-configuration.ts @@ -1,7 +1,7 @@ import * as dotenv from 'dotenv'; import { AuthorizationConfig } from '../adapters/types/authorization'; -import { EnvLoginConfig } from '../../../../common/src/cams/login'; -import { keyValuesToRecord } from '../../../../common/src/cams/utilities'; +import { EnvLoginConfig } from '../../../common/src/cams/login'; +import { keyValuesToRecord } from '../../../common/src/cams/utilities'; dotenv.config(); diff --git a/backend/functions/lib/configs/user-groups-gateway-configuration.ts b/backend/lib/configs/user-groups-gateway-configuration.ts similarity index 90% rename from backend/functions/lib/configs/user-groups-gateway-configuration.ts rename to backend/lib/configs/user-groups-gateway-configuration.ts index 756ea8ecb..34b6f95df 100644 --- a/backend/functions/lib/configs/user-groups-gateway-configuration.ts +++ b/backend/lib/configs/user-groups-gateway-configuration.ts @@ -1,6 +1,6 @@ import * as dotenv from 'dotenv'; import { UserGroupGatewayConfig } from '../adapters/types/authorization'; -import { keyValuesToRecord } from '../../../../common/src/cams/utilities'; +import { keyValuesToRecord } from '../../../common/src/cams/utilities'; dotenv.config(); diff --git a/backend/functions/lib/controllers/acms-orders/acms-orders.controller.test.ts b/backend/lib/controllers/acms-orders/acms-orders.controller.test.ts similarity index 100% rename from backend/functions/lib/controllers/acms-orders/acms-orders.controller.test.ts rename to backend/lib/controllers/acms-orders/acms-orders.controller.test.ts diff --git a/backend/functions/lib/controllers/acms-orders/acms-orders.controller.ts b/backend/lib/controllers/acms-orders/acms-orders.controller.ts similarity index 100% rename from backend/functions/lib/controllers/acms-orders/acms-orders.controller.ts rename to backend/lib/controllers/acms-orders/acms-orders.controller.ts diff --git a/backend/functions/lib/controllers/attorneys/attorneys.controller.test.ts b/backend/lib/controllers/attorneys/attorneys.controller.test.ts similarity index 95% rename from backend/functions/lib/controllers/attorneys/attorneys.controller.test.ts rename to backend/lib/controllers/attorneys/attorneys.controller.test.ts index 0638c1537..e49bbaaf2 100644 --- a/backend/functions/lib/controllers/attorneys/attorneys.controller.test.ts +++ b/backend/lib/controllers/attorneys/attorneys.controller.test.ts @@ -1,4 +1,4 @@ -import MockData from '../../../../../common/src/cams/test-utilities/mock-data'; +import MockData from '../../../../common/src/cams/test-utilities/mock-data'; import { createMockApplicationContext } from '../../testing/testing-utilities'; import AttorneysList from '../../use-cases/attorneys'; import { NotFoundError } from '../../common-errors/not-found-error'; diff --git a/backend/functions/lib/controllers/attorneys/attorneys.controller.ts b/backend/lib/controllers/attorneys/attorneys.controller.ts similarity index 94% rename from backend/functions/lib/controllers/attorneys/attorneys.controller.ts rename to backend/lib/controllers/attorneys/attorneys.controller.ts index 0848b5505..f9166a78e 100644 --- a/backend/functions/lib/controllers/attorneys/attorneys.controller.ts +++ b/backend/lib/controllers/attorneys/attorneys.controller.ts @@ -1,6 +1,6 @@ import { ApplicationContext } from '../../adapters/types/basic'; import AttorneysList from '../../use-cases/attorneys'; -import { AttorneyUser } from '../../../../../common/src/cams/users'; +import { AttorneyUser } from '../../../../common/src/cams/users'; import { CamsHttpResponseInit, httpSuccess } from '../../adapters/utils/http-response'; import { getCamsError } from '../../common-errors/error-utilities'; import { CamsController } from '../controller'; diff --git a/backend/functions/lib/controllers/case-assignment/case.assignment.controller.test.ts b/backend/lib/controllers/case-assignment/case.assignment.controller.test.ts similarity index 95% rename from backend/functions/lib/controllers/case-assignment/case.assignment.controller.test.ts rename to backend/lib/controllers/case-assignment/case.assignment.controller.test.ts index d38f6c919..d7c336901 100644 --- a/backend/functions/lib/controllers/case-assignment/case.assignment.controller.test.ts +++ b/backend/lib/controllers/case-assignment/case.assignment.controller.test.ts @@ -3,7 +3,7 @@ import { THROW_PERMISSIONS_ERROR_CASE_ID, THROW_UNKNOWN_ERROR_CASE_ID, } from '../../testing/testing-constants'; -import { MockData } from '../../../../../common/src/cams/test-utilities/mock-data'; +import { MockData } from '../../../../common/src/cams/test-utilities/mock-data'; import { CaseAssignmentUseCase } from '../../use-cases/case-assignment'; import { CamsError } from '../../common-errors/cams-error'; import { ForbiddenError } from '../../common-errors/forbidden-error'; @@ -11,13 +11,13 @@ import { createMockApplicationContext, createMockApplicationContextSession, } from '../../testing/testing-utilities'; -import { CamsRole } from '../../../../../common/src/cams/roles'; -import { CamsUserReference } from '../../../../../common/src/cams/users'; +import { CamsRole } from '../../../../common/src/cams/roles'; +import { CamsUserReference } from '../../../../common/src/cams/users'; import { UnknownError } from '../../common-errors/unknown-error'; -import HttpStatusCodes from '../../../../../common/src/api/http-status-codes'; +import HttpStatusCodes from '../../../../common/src/api/http-status-codes'; import { httpSuccess } from '../../adapters/utils/http-response'; import { mockCamsHttpRequest } from '../../testing/mock-data/cams-http-request-helper'; -import { REGION_02_GROUP_NY } from '../../../../../common/src/cams/test-utilities/mock-user'; +import { REGION_02_GROUP_NY } from '../../../../common/src/cams/test-utilities/mock-user'; import { ApplicationContext } from '../../adapters/types/basic'; const Jane = MockData.getCamsUserReference({ name: 'Jane' }); diff --git a/backend/functions/lib/controllers/case-assignment/case.assignment.controller.ts b/backend/lib/controllers/case-assignment/case.assignment.controller.ts similarity index 91% rename from backend/functions/lib/controllers/case-assignment/case.assignment.controller.ts rename to backend/lib/controllers/case-assignment/case.assignment.controller.ts index e6786eb85..4b21b2292 100644 --- a/backend/functions/lib/controllers/case-assignment/case.assignment.controller.ts +++ b/backend/lib/controllers/case-assignment/case.assignment.controller.ts @@ -1,11 +1,11 @@ import { ApplicationContext } from '../../adapters/types/basic'; import { CaseAssignmentUseCase } from '../../use-cases/case-assignment'; import { AssignmentError } from '../../use-cases/assignment.exception'; -import { CaseAssignment } from '../../../../../common/src/cams/assignments'; -import { CamsUserReference } from '../../../../../common/src/cams/users'; -import { CamsRole } from '../../../../../common/src/cams/roles'; +import { CaseAssignment } from '../../../../common/src/cams/assignments'; +import { CamsUserReference } from '../../../../common/src/cams/users'; +import { CamsRole } from '../../../../common/src/cams/roles'; import { CamsHttpResponseInit, httpSuccess } from '../../adapters/utils/http-response'; -import HttpStatusCodes from '../../../../../common/src/api/http-status-codes'; +import HttpStatusCodes from '../../../../common/src/api/http-status-codes'; import { CamsController } from '../controller'; import { getCamsError } from '../../common-errors/error-utilities'; import { finalizeDeferrable } from '../../deferrable/finalize-deferrable'; diff --git a/backend/functions/lib/controllers/case-associated/case-associated.controller.test.ts b/backend/lib/controllers/case-associated/case-associated.controller.test.ts similarity index 96% rename from backend/functions/lib/controllers/case-associated/case-associated.controller.test.ts rename to backend/lib/controllers/case-associated/case-associated.controller.test.ts index 7aa89b780..e9c75280e 100644 --- a/backend/functions/lib/controllers/case-associated/case-associated.controller.test.ts +++ b/backend/lib/controllers/case-associated/case-associated.controller.test.ts @@ -7,7 +7,7 @@ import { } from '../../testing/testing-constants'; import { NotFoundError } from '../../common-errors/not-found-error'; import { CaseAssociatedUseCase } from '../../use-cases/case-associated/case-associated'; -import { MockData } from '../../../../../common/src/cams/test-utilities/mock-data'; +import { MockData } from '../../../../common/src/cams/test-utilities/mock-data'; describe('Test case-history controller', () => { let applicationContext; diff --git a/backend/functions/lib/controllers/case-associated/case-associated.controller.ts b/backend/lib/controllers/case-associated/case-associated.controller.ts similarity index 93% rename from backend/functions/lib/controllers/case-associated/case-associated.controller.ts rename to backend/lib/controllers/case-associated/case-associated.controller.ts index b9f69784d..1eb6a598f 100644 --- a/backend/functions/lib/controllers/case-associated/case-associated.controller.ts +++ b/backend/lib/controllers/case-associated/case-associated.controller.ts @@ -1,7 +1,7 @@ import { ApplicationContext } from '../../adapters/types/basic'; import { isCamsError } from '../../common-errors/cams-error'; import { UnknownError } from '../../common-errors/unknown-error'; -import { EventCaseReference } from '../../../../../common/src/cams/events'; +import { EventCaseReference } from '../../../../common/src/cams/events'; import { CaseAssociatedUseCase } from '../../use-cases/case-associated/case-associated'; import { CamsHttpResponseInit, httpSuccess } from '../../adapters/utils/http-response'; import { finalizeDeferrable } from '../../deferrable/finalize-deferrable'; diff --git a/backend/functions/lib/controllers/case-docket/case-docket.controller.test.ts b/backend/lib/controllers/case-docket/case-docket.controller.test.ts similarity index 100% rename from backend/functions/lib/controllers/case-docket/case-docket.controller.test.ts rename to backend/lib/controllers/case-docket/case-docket.controller.test.ts diff --git a/backend/functions/lib/controllers/case-docket/case-docket.controller.ts b/backend/lib/controllers/case-docket/case-docket.controller.ts similarity index 95% rename from backend/functions/lib/controllers/case-docket/case-docket.controller.ts rename to backend/lib/controllers/case-docket/case-docket.controller.ts index 68bd9f1ab..5b82875f4 100644 --- a/backend/functions/lib/controllers/case-docket/case-docket.controller.ts +++ b/backend/lib/controllers/case-docket/case-docket.controller.ts @@ -4,7 +4,7 @@ import { getCaseDocketUseCase } from '../../factory'; import { isCamsError } from '../../common-errors/cams-error'; import { UnknownError } from '../../common-errors/unknown-error'; import { CamsHttpResponseInit, httpSuccess } from '../../adapters/utils/http-response'; -import { CaseDocket } from '../../../../../common/src/cams/cases'; +import { CaseDocket } from '../../../../common/src/cams/cases'; import { CamsController } from '../controller'; import { finalizeDeferrable } from '../../deferrable/finalize-deferrable'; diff --git a/backend/functions/lib/controllers/case-history/case-history.controller.test.ts b/backend/lib/controllers/case-history/case-history.controller.test.ts similarity index 100% rename from backend/functions/lib/controllers/case-history/case-history.controller.test.ts rename to backend/lib/controllers/case-history/case-history.controller.test.ts diff --git a/backend/functions/lib/controllers/case-history/case-history.controller.ts b/backend/lib/controllers/case-history/case-history.controller.ts similarity index 94% rename from backend/functions/lib/controllers/case-history/case-history.controller.ts rename to backend/lib/controllers/case-history/case-history.controller.ts index dcef99465..0b30f9791 100644 --- a/backend/functions/lib/controllers/case-history/case-history.controller.ts +++ b/backend/lib/controllers/case-history/case-history.controller.ts @@ -1,6 +1,6 @@ import { ApplicationContext } from '../../adapters/types/basic'; import { CaseHistoryUseCase } from '../../use-cases/case-history/case-history'; -import { CaseHistory } from '../../../../../common/src/cams/history'; +import { CaseHistory } from '../../../../common/src/cams/history'; import { CamsHttpResponseInit, httpSuccess } from '../../adapters/utils/http-response'; import { getCamsError } from '../../common-errors/error-utilities'; import { CamsController } from '../controller'; diff --git a/backend/functions/lib/controllers/case-summary/case-summary.controller.test.ts b/backend/lib/controllers/case-summary/case-summary.controller.test.ts similarity index 95% rename from backend/functions/lib/controllers/case-summary/case-summary.controller.test.ts rename to backend/lib/controllers/case-summary/case-summary.controller.test.ts index c7f1a3815..60245d9ba 100644 --- a/backend/functions/lib/controllers/case-summary/case-summary.controller.test.ts +++ b/backend/lib/controllers/case-summary/case-summary.controller.test.ts @@ -1,7 +1,7 @@ import { createMockApplicationContext } from '../../testing/testing-utilities'; import CaseManagement from '../../use-cases/case-management'; import { NotFoundError } from '../../common-errors/not-found-error'; -import { MockData } from '../../../../../common/src/cams/test-utilities/mock-data'; +import { MockData } from '../../../../common/src/cams/test-utilities/mock-data'; import { CaseSummaryController } from './case-summary.controller'; describe('Test case-summary controller', () => { diff --git a/backend/functions/lib/controllers/case-summary/case-summary.controller.ts b/backend/lib/controllers/case-summary/case-summary.controller.ts similarity index 94% rename from backend/functions/lib/controllers/case-summary/case-summary.controller.ts rename to backend/lib/controllers/case-summary/case-summary.controller.ts index 6aaa42e26..b7ec5e17a 100644 --- a/backend/functions/lib/controllers/case-summary/case-summary.controller.ts +++ b/backend/lib/controllers/case-summary/case-summary.controller.ts @@ -1,5 +1,5 @@ import { ApplicationContext } from '../../adapters/types/basic'; -import { CaseSummary } from '../../../../../common/src/cams/cases'; +import { CaseSummary } from '../../../../common/src/cams/cases'; import CaseManagement from '../../use-cases/case-management'; import { CamsHttpResponseInit, httpSuccess } from '../../adapters/utils/http-response'; import { getCamsError } from '../../common-errors/error-utilities'; diff --git a/backend/functions/lib/controllers/cases/cases.controller.test.ts b/backend/lib/controllers/cases/cases.controller.test.ts similarity index 98% rename from backend/functions/lib/controllers/cases/cases.controller.test.ts rename to backend/lib/controllers/cases/cases.controller.test.ts index edef2a3ee..861db7df9 100644 --- a/backend/functions/lib/controllers/cases/cases.controller.test.ts +++ b/backend/lib/controllers/cases/cases.controller.test.ts @@ -1,15 +1,15 @@ -import { MockData } from '../../../../../common/src/cams/test-utilities/mock-data'; +import { MockData } from '../../../../common/src/cams/test-utilities/mock-data'; import { ApplicationContext } from '../../adapters/types/basic'; import { CamsHttpResponseInit } from '../../adapters/utils/http-response'; import CaseManagement from '../../use-cases/case-management'; import { CasesController } from './cases.controller'; -import { CaseBasics, CaseDetail } from '../../../../../common/src/cams/cases'; +import { CaseBasics, CaseDetail } from '../../../../common/src/cams/cases'; import { mockCamsHttpRequest, mockRequestUrl, } from '../../testing/mock-data/cams-http-request-helper'; import { createMockApplicationContext } from '../../testing/testing-utilities'; -import { ResourceActions } from '../../../../../common/src/cams/actions'; +import { ResourceActions } from '../../../../common/src/cams/actions'; import { CamsError } from '../../common-errors/cams-error'; describe('cases controller test', () => { diff --git a/backend/functions/lib/controllers/cases/cases.controller.ts b/backend/lib/controllers/cases/cases.controller.ts similarity index 90% rename from backend/functions/lib/controllers/cases/cases.controller.ts rename to backend/lib/controllers/cases/cases.controller.ts index 0fc46b73b..65682d2d5 100644 --- a/backend/functions/lib/controllers/cases/cases.controller.ts +++ b/backend/lib/controllers/cases/cases.controller.ts @@ -1,12 +1,12 @@ import { ApplicationContext } from '../../adapters/types/basic'; import CaseManagement from '../../use-cases/case-management'; -import { ResponseBody } from '../../../../../common/src/api/response'; -import { CaseBasics, CaseDetail } from '../../../../../common/src/cams/cases'; -import { CasesSearchPredicate } from '../../../../../common/src/api/search'; +import { ResponseBody } from '../../../../common/src/api/response'; +import { CaseBasics, CaseDetail } from '../../../../common/src/cams/cases'; +import { CasesSearchPredicate } from '../../../../common/src/api/search'; import { CamsHttpRequest } from '../../adapters/types/http'; -import { Pagination } from '../../../../../common/src/api/pagination'; +import { Pagination } from '../../../../common/src/api/pagination'; import { httpSuccess } from '../../adapters/utils/http-response'; -import { ResourceActions } from '../../../../../common/src/cams/actions'; +import { ResourceActions } from '../../../../common/src/cams/actions'; import { CamsController } from '../controller'; import { getCamsError } from '../../common-errors/error-utilities'; import { finalizeDeferrable } from '../../deferrable/finalize-deferrable'; diff --git a/backend/functions/lib/controllers/controller.ts b/backend/lib/controllers/controller.ts similarity index 100% rename from backend/functions/lib/controllers/controller.ts rename to backend/lib/controllers/controller.ts diff --git a/backend/functions/lib/controllers/courts/courts.controller.test.ts b/backend/lib/controllers/courts/courts.controller.test.ts similarity index 96% rename from backend/functions/lib/controllers/courts/courts.controller.test.ts rename to backend/lib/controllers/courts/courts.controller.test.ts index 6f25ab025..150980508 100644 --- a/backend/functions/lib/controllers/courts/courts.controller.test.ts +++ b/backend/lib/controllers/courts/courts.controller.test.ts @@ -1,6 +1,6 @@ import { createMockApplicationContext } from '../../testing/testing-utilities'; import { ApplicationContext } from '../../adapters/types/basic'; -import { COURT_DIVISIONS } from '../../../../../common/src/cams/test-utilities/courts.mock'; +import { COURT_DIVISIONS } from '../../../../common/src/cams/test-utilities/courts.mock'; import { CamsError } from '../../common-errors/cams-error'; import { mockCamsHttpRequest } from '../../testing/mock-data/cams-http-request-helper'; import { CourtsController } from './courts.controller'; diff --git a/backend/functions/lib/controllers/courts/courts.controller.ts b/backend/lib/controllers/courts/courts.controller.ts similarity index 93% rename from backend/functions/lib/controllers/courts/courts.controller.ts rename to backend/lib/controllers/courts/courts.controller.ts index 98bee2796..d36af65c4 100644 --- a/backend/functions/lib/controllers/courts/courts.controller.ts +++ b/backend/lib/controllers/courts/courts.controller.ts @@ -3,7 +3,7 @@ import { CamsHttpResponseInit, httpSuccess } from '../../adapters/utils/http-res import { getCamsError } from '../../common-errors/error-utilities'; import { CamsController } from '../controller'; import { CourtsUseCase } from '../../use-cases/courts/courts'; -import { CourtDivisionDetails } from '../../../../../common/src/cams/courts'; +import { CourtDivisionDetails } from '../../../../common/src/cams/courts'; import { finalizeDeferrable } from '../../deferrable/finalize-deferrable'; const MODULE_NAME = 'COURTS-CONTROLLER'; diff --git a/backend/functions/lib/controllers/me/me.controller.ts b/backend/lib/controllers/me/me.controller.ts similarity index 92% rename from backend/functions/lib/controllers/me/me.controller.ts rename to backend/lib/controllers/me/me.controller.ts index f03976155..e50ad2547 100644 --- a/backend/functions/lib/controllers/me/me.controller.ts +++ b/backend/lib/controllers/me/me.controller.ts @@ -1,4 +1,4 @@ -import { CamsSession } from '../../../../../common/src/cams/session'; +import { CamsSession } from '../../../../common/src/cams/session'; import { ApplicationContext } from '../../adapters/types/basic'; import { CamsHttpResponseInit, httpSuccess } from '../../adapters/utils/http-response'; import { getCamsError } from '../../common-errors/error-utilities'; diff --git a/backend/functions/lib/controllers/offices/offices.controller.test.ts b/backend/lib/controllers/offices/offices.controller.test.ts similarity index 98% rename from backend/functions/lib/controllers/offices/offices.controller.test.ts rename to backend/lib/controllers/offices/offices.controller.test.ts index 25f75b77a..089b6a71b 100644 --- a/backend/functions/lib/controllers/offices/offices.controller.test.ts +++ b/backend/lib/controllers/offices/offices.controller.test.ts @@ -1,7 +1,7 @@ import { createMockApplicationContext } from '../../testing/testing-utilities'; import { ApplicationContext } from '../../adapters/types/basic'; import { OfficesController } from './offices.controller'; -import { COURT_DIVISIONS } from '../../../../../common/src/cams/test-utilities/courts.mock'; +import { COURT_DIVISIONS } from '../../../../common/src/cams/test-utilities/courts.mock'; import { CamsError } from '../../common-errors/cams-error'; import { mockCamsHttpRequest } from '../../testing/mock-data/cams-http-request-helper'; import { UnknownError } from '../../common-errors/unknown-error'; diff --git a/backend/functions/lib/controllers/offices/offices.controller.ts b/backend/lib/controllers/offices/offices.controller.ts similarity index 92% rename from backend/functions/lib/controllers/offices/offices.controller.ts rename to backend/lib/controllers/offices/offices.controller.ts index b151ea0c2..bfbf95dc1 100644 --- a/backend/functions/lib/controllers/offices/offices.controller.ts +++ b/backend/lib/controllers/offices/offices.controller.ts @@ -1,10 +1,10 @@ import { OfficesUseCase } from '../../use-cases/offices/offices'; import { ApplicationContext } from '../../adapters/types/basic'; -import { UstpOfficeDetails } from '../../../../../common/src/cams/offices'; +import { UstpOfficeDetails } from '../../../../common/src/cams/offices'; import { CamsHttpResponseInit, httpSuccess } from '../../adapters/utils/http-response'; import { getCamsError } from '../../common-errors/error-utilities'; import { CamsController, CamsTimerController } from '../controller'; -import { CamsUserReference } from '../../../../../common/src/cams/users'; +import { CamsUserReference } from '../../../../common/src/cams/users'; import { BadRequestError } from '../../common-errors/bad-request'; import { finalizeDeferrable } from '../../deferrable/finalize-deferrable'; diff --git a/backend/functions/lib/controllers/orders/orders.controller.test.ts b/backend/lib/controllers/orders/orders.controller.test.ts similarity index 97% rename from backend/functions/lib/controllers/orders/orders.controller.test.ts rename to backend/lib/controllers/orders/orders.controller.test.ts index 875b54e4c..fe72cfefc 100644 --- a/backend/functions/lib/controllers/orders/orders.controller.test.ts +++ b/backend/lib/controllers/orders/orders.controller.test.ts @@ -11,14 +11,14 @@ import { Order, TransferOrder, TransferOrderAction, -} from '../../../../../common/src/cams/orders'; -import { MockData } from '../../../../../common/src/cams/test-utilities/mock-data'; -import { sortDates } from '../../../../../common/src/date-helper'; +} from '../../../../common/src/cams/orders'; +import { MockData } from '../../../../common/src/cams/test-utilities/mock-data'; +import { sortDates } from '../../../../common/src/date-helper'; import { OrdersController } from './orders.controller'; import { CamsHttpResponseInit, commonHeaders } from '../../adapters/utils/http-response'; -import HttpStatusCodes from '../../../../../common/src/api/http-status-codes'; +import HttpStatusCodes from '../../../../common/src/api/http-status-codes'; import { mockCamsHttpRequest } from '../../testing/mock-data/cams-http-request-helper'; -import { ResponseBody } from '../../../../../common/src/api/response'; +import { ResponseBody } from '../../../../common/src/api/response'; import { NotFoundError } from '../../common-errors/not-found-error'; import { BadRequestError } from '../../common-errors/bad-request'; import * as crypto from 'crypto'; diff --git a/backend/functions/lib/controllers/orders/orders.controller.ts b/backend/lib/controllers/orders/orders.controller.ts similarity index 97% rename from backend/functions/lib/controllers/orders/orders.controller.ts rename to backend/lib/controllers/orders/orders.controller.ts index e2a933919..aaa0b3717 100644 --- a/backend/functions/lib/controllers/orders/orders.controller.ts +++ b/backend/lib/controllers/orders/orders.controller.ts @@ -8,12 +8,12 @@ import { isConsolidationOrderRejection, Order, TransferOrderAction, -} from '../../../../../common/src/cams/orders'; -import { CaseSummary } from '../../../../../common/src/cams/cases'; +} from '../../../../common/src/cams/orders'; +import { CaseSummary } from '../../../../common/src/cams/cases'; import { BadRequestError } from '../../common-errors/bad-request'; import { CamsHttpResponseInit, httpSuccess } from '../../adapters/utils/http-response'; import { getCamsError } from '../../common-errors/error-utilities'; -import HttpStatusCodes from '../../../../../common/src/api/http-status-codes'; +import HttpStatusCodes from '../../../../common/src/api/http-status-codes'; import { CamsController, CamsTimerController } from '../controller'; import { NotFoundError } from '../../common-errors/not-found-error'; import { finalizeDeferrable } from '../../deferrable/finalize-deferrable'; diff --git a/backend/functions/lib/deferrable/defer-close.test.ts b/backend/lib/deferrable/defer-close.test.ts similarity index 100% rename from backend/functions/lib/deferrable/defer-close.test.ts rename to backend/lib/deferrable/defer-close.test.ts diff --git a/backend/functions/lib/deferrable/defer-close.ts b/backend/lib/deferrable/defer-close.ts similarity index 100% rename from backend/functions/lib/deferrable/defer-close.ts rename to backend/lib/deferrable/defer-close.ts diff --git a/backend/functions/lib/deferrable/defer-release.test.ts b/backend/lib/deferrable/defer-release.test.ts similarity index 100% rename from backend/functions/lib/deferrable/defer-release.test.ts rename to backend/lib/deferrable/defer-release.test.ts diff --git a/backend/functions/lib/deferrable/defer-release.ts b/backend/lib/deferrable/defer-release.ts similarity index 100% rename from backend/functions/lib/deferrable/defer-release.ts rename to backend/lib/deferrable/defer-release.ts diff --git a/backend/functions/lib/deferrable/finalize-deferrable.test.ts b/backend/lib/deferrable/finalize-deferrable.test.ts similarity index 100% rename from backend/functions/lib/deferrable/finalize-deferrable.test.ts rename to backend/lib/deferrable/finalize-deferrable.test.ts diff --git a/backend/functions/lib/deferrable/finalize-deferrable.ts b/backend/lib/deferrable/finalize-deferrable.ts similarity index 100% rename from backend/functions/lib/deferrable/finalize-deferrable.ts rename to backend/lib/deferrable/finalize-deferrable.ts diff --git a/backend/functions/lib/factory.test.ts b/backend/lib/factory.test.ts similarity index 100% rename from backend/functions/lib/factory.test.ts rename to backend/lib/factory.test.ts diff --git a/backend/functions/lib/factory.ts b/backend/lib/factory.ts similarity index 100% rename from backend/functions/lib/factory.ts rename to backend/lib/factory.ts diff --git a/backend/functions/lib/humble-objects/mongo-humble.ts b/backend/lib/humble-objects/mongo-humble.ts similarity index 100% rename from backend/functions/lib/humble-objects/mongo-humble.ts rename to backend/lib/humble-objects/mongo-humble.ts diff --git a/backend/functions/lib/query/query-builder.test.ts b/backend/lib/query/query-builder.test.ts similarity index 100% rename from backend/functions/lib/query/query-builder.test.ts rename to backend/lib/query/query-builder.test.ts diff --git a/backend/functions/lib/query/query-builder.ts b/backend/lib/query/query-builder.ts similarity index 100% rename from backend/functions/lib/query/query-builder.ts rename to backend/lib/query/query-builder.ts diff --git a/backend/functions/lib/testing/analysis/acms-dxtr-divisions/compare-divisions.ts b/backend/lib/testing/analysis/acms-dxtr-divisions/compare-divisions.ts similarity index 99% rename from backend/functions/lib/testing/analysis/acms-dxtr-divisions/compare-divisions.ts rename to backend/lib/testing/analysis/acms-dxtr-divisions/compare-divisions.ts index 8f9fe2bcd..f0a11edf8 100644 --- a/backend/functions/lib/testing/analysis/acms-dxtr-divisions/compare-divisions.ts +++ b/backend/lib/testing/analysis/acms-dxtr-divisions/compare-divisions.ts @@ -1,8 +1,8 @@ import { InvocationContext } from '@azure/functions'; -import applicationContextCreator from '../../../../azure/application-context-creator'; +import applicationContextCreator from '../../../../functions/azure/application-context-creator'; import { LoggerImpl } from '../../../adapters/services/logger.service'; import OfficesDxtrGateway from '../../../adapters/gateways/dxtr/offices.dxtr.gateway'; -import { UstpOfficeDetails } from '../../../../../../common/src/cams/offices'; +import { UstpOfficeDetails } from '../../../../../common/src/cams/offices'; import * as fs from 'fs/promises'; // Sourced from Office_Regions_and_Divisions.pdf diff --git a/backend/functions/lib/testing/analysis/export-office-csv.ts b/backend/lib/testing/analysis/export-office-csv.ts similarity index 91% rename from backend/functions/lib/testing/analysis/export-office-csv.ts rename to backend/lib/testing/analysis/export-office-csv.ts index 4675fe8ed..99795faba 100644 --- a/backend/functions/lib/testing/analysis/export-office-csv.ts +++ b/backend/lib/testing/analysis/export-office-csv.ts @@ -1,8 +1,8 @@ import { InvocationContext } from '@azure/functions'; -import applicationContextCreator from '../../../azure/application-context-creator'; +import applicationContextCreator from '../../../functions/azure/application-context-creator'; import { LoggerImpl } from '../../adapters/services/logger.service'; import OfficesDxtrGateway from '../../adapters/gateways/dxtr/offices.dxtr.gateway'; -import { UstpOfficeDetails } from '../../../../../common/src/cams/offices'; +import { UstpOfficeDetails } from '../../../../common/src/cams/offices'; import * as fs from 'fs/promises'; const MODULE_NAME = 'ITEST'; diff --git a/backend/functions/lib/testing/isolated-integration/test-acms-migration.ts b/backend/lib/testing/isolated-integration/test-acms-migration.ts similarity index 77% rename from backend/functions/lib/testing/isolated-integration/test-acms-migration.ts rename to backend/lib/testing/isolated-integration/test-acms-migration.ts index c8e1b17e5..c7deb9932 100644 --- a/backend/functions/lib/testing/isolated-integration/test-acms-migration.ts +++ b/backend/lib/testing/isolated-integration/test-acms-migration.ts @@ -1,5 +1,5 @@ -import migrateConsolidation from '../../../migration/activity/migrateConsolidation'; -import { createMockAzureFunctionContext } from '../../../azure/testing-helpers'; +import migrateConsolidation from '../../../functions/migration/activity/migrateConsolidation'; +import { createMockAzureFunctionContext } from '../../../functions/azure/testing-helpers'; import * as dotenv from 'dotenv'; dotenv.config(); diff --git a/backend/functions/lib/testing/isolated-integration/test-okta-group-api.ts b/backend/lib/testing/isolated-integration/test-okta-group-api.ts similarity index 95% rename from backend/functions/lib/testing/isolated-integration/test-okta-group-api.ts rename to backend/lib/testing/isolated-integration/test-okta-group-api.ts index 1bd03c93c..d7587d88a 100644 --- a/backend/functions/lib/testing/isolated-integration/test-okta-group-api.ts +++ b/backend/lib/testing/isolated-integration/test-okta-group-api.ts @@ -1,6 +1,6 @@ import { InvocationContext } from '@azure/functions'; import { LoggerImpl } from '../../adapters/services/logger.service'; -import applicationContextCreator from '../../../azure/application-context-creator'; +import applicationContextCreator from '../../../functions/azure/application-context-creator'; import { UserGroupGatewayConfig } from '../../adapters/types/authorization'; import { getUserGroupGatewayConfig } from '../../configs/user-groups-gateway-configuration'; import OktaUserGroupGateway from '../../adapters/gateways/okta/okta-user-group-gateway'; diff --git a/backend/functions/lib/testing/local-data/local-cases-repository.ts b/backend/lib/testing/local-data/local-cases-repository.ts similarity index 94% rename from backend/functions/lib/testing/local-data/local-cases-repository.ts rename to backend/lib/testing/local-data/local-cases-repository.ts index eb25b823b..6bd05e260 100644 --- a/backend/functions/lib/testing/local-data/local-cases-repository.ts +++ b/backend/lib/testing/local-data/local-cases-repository.ts @@ -6,8 +6,8 @@ import { Transfer, TransferFrom, TransferTo, -} from '../../../../../common/src/cams/events'; -import { CaseHistory } from '../../../../../common/src/cams/history'; +} from '../../../../common/src/cams/events'; +import { CaseHistory } from '../../../../common/src/cams/history'; import { CasesRepository } from '../../use-cases/gateways.types'; export class LocalCasesRepository implements CasesRepository { diff --git a/backend/functions/lib/testing/local-data/local-consolidation-orders-repository.ts b/backend/lib/testing/local-data/local-consolidation-orders-repository.ts similarity index 88% rename from backend/functions/lib/testing/local-data/local-consolidation-orders-repository.ts rename to backend/lib/testing/local-data/local-consolidation-orders-repository.ts index 5dd2f58c1..8135e68f3 100644 --- a/backend/functions/lib/testing/local-data/local-consolidation-orders-repository.ts +++ b/backend/lib/testing/local-data/local-consolidation-orders-repository.ts @@ -1,6 +1,6 @@ -import { ConsolidationOrder } from '../../../../../common/src/cams/orders'; +import { ConsolidationOrder } from '../../../../common/src/cams/orders'; import { ConsolidationOrdersRepository } from '../../use-cases/gateways.types'; -import { OrdersSearchPredicate } from '../../../../../common/src/api/search'; +import { OrdersSearchPredicate } from '../../../../common/src/api/search'; import * as crypto from 'crypto'; import { ApplicationContext } from '../../adapters/types/basic'; diff --git a/backend/lib/testing/mock-data/attorneys.mock.ts b/backend/lib/testing/mock-data/attorneys.mock.ts new file mode 100644 index 000000000..98ee01717 --- /dev/null +++ b/backend/lib/testing/mock-data/attorneys.mock.ts @@ -0,0 +1,7 @@ +import { TRIAL_ATTORNEYS } from '../../../../common/src/cams/test-utilities/attorneys.mock'; + +const list = { + attorneyList: TRIAL_ATTORNEYS, +}; + +export { list }; diff --git a/backend/functions/lib/testing/mock-data/cams-http-request-helper.ts b/backend/lib/testing/mock-data/cams-http-request-helper.ts similarity index 84% rename from backend/functions/lib/testing/mock-data/cams-http-request-helper.ts rename to backend/lib/testing/mock-data/cams-http-request-helper.ts index 4bfd6196e..bb37e17f6 100644 --- a/backend/functions/lib/testing/mock-data/cams-http-request-helper.ts +++ b/backend/lib/testing/mock-data/cams-http-request-helper.ts @@ -1,4 +1,4 @@ -import { MockData } from '../../../../../common/src/cams/test-utilities/mock-data'; +import { MockData } from '../../../../common/src/cams/test-utilities/mock-data'; import { CamsHttpRequest } from '../../adapters/types/http'; export const mockRequestUrl = 'http://mockhost/api'; diff --git a/backend/functions/lib/testing/mock-data/case-docket-entries.mock.ts b/backend/lib/testing/mock-data/case-docket-entries.mock.ts similarity index 99% rename from backend/functions/lib/testing/mock-data/case-docket-entries.mock.ts rename to backend/lib/testing/mock-data/case-docket-entries.mock.ts index b469deb4b..18174fbf5 100644 --- a/backend/functions/lib/testing/mock-data/case-docket-entries.mock.ts +++ b/backend/lib/testing/mock-data/case-docket-entries.mock.ts @@ -1,4 +1,4 @@ -import { CaseDocket, CaseDocketEntryDocument } from '../../../../../common/src/cams/cases'; +import { CaseDocket, CaseDocketEntryDocument } from '../../../../common/src/cams/cases'; import { DxtrCaseDocketEntryDocument } from '../../adapters/gateways/dxtr/case-docket.dxtr.gateway'; export const DXTR_CASE_DOCKET_ENTRIES: CaseDocket = [ diff --git a/backend/functions/lib/testing/mock-data/case-history.mock.ts b/backend/lib/testing/mock-data/case-history.mock.ts similarity index 94% rename from backend/functions/lib/testing/mock-data/case-history.mock.ts rename to backend/lib/testing/mock-data/case-history.mock.ts index 98d451711..b201c044a 100644 --- a/backend/functions/lib/testing/mock-data/case-history.mock.ts +++ b/backend/lib/testing/mock-data/case-history.mock.ts @@ -1,6 +1,6 @@ -import { SYSTEM_USER_REFERENCE } from '../../../../../common/src/cams/auditable'; -import { CaseAssignmentHistory } from '../../../../../common/src/cams/history'; -import MockData from '../../../../../common/src/cams/test-utilities/mock-data'; +import { SYSTEM_USER_REFERENCE } from '../../../../common/src/cams/auditable'; +import { CaseAssignmentHistory } from '../../../../common/src/cams/history'; +import MockData from '../../../../common/src/cams/test-utilities/mock-data'; export const CASE_HISTORY: CaseAssignmentHistory[] = [ { diff --git a/backend/functions/lib/testing/mock-data/case-summaries.mock.ts b/backend/lib/testing/mock-data/case-summaries.mock.ts similarity index 91% rename from backend/functions/lib/testing/mock-data/case-summaries.mock.ts rename to backend/lib/testing/mock-data/case-summaries.mock.ts index bf13d3b49..6f4ff0bf6 100644 --- a/backend/functions/lib/testing/mock-data/case-summaries.mock.ts +++ b/backend/lib/testing/mock-data/case-summaries.mock.ts @@ -1,4 +1,4 @@ -import { CaseSummary } from '../../../../../common/src/cams/cases'; +import { CaseSummary } from '../../../../common/src/cams/cases'; export const CASE_SUMMARIES: CaseSummary[] = [ { diff --git a/backend/functions/lib/testing/mock-data/cases.mock.json b/backend/lib/testing/mock-data/cases.mock.json similarity index 100% rename from backend/functions/lib/testing/mock-data/cases.mock.json rename to backend/lib/testing/mock-data/cases.mock.json diff --git a/backend/functions/lib/testing/mock-data/debtor-attorneys.mock.ts b/backend/lib/testing/mock-data/debtor-attorneys.mock.ts similarity index 97% rename from backend/functions/lib/testing/mock-data/debtor-attorneys.mock.ts rename to backend/lib/testing/mock-data/debtor-attorneys.mock.ts index 37529b668..64300d057 100644 --- a/backend/functions/lib/testing/mock-data/debtor-attorneys.mock.ts +++ b/backend/lib/testing/mock-data/debtor-attorneys.mock.ts @@ -1,4 +1,4 @@ -import { DebtorAttorney } from '../../../../../common/src/cams/parties'; +import { DebtorAttorney } from '../../../../common/src/cams/parties'; export const DEBTOR_ATTORNEYS = new Map([ [ diff --git a/backend/functions/lib/testing/mock-data/debtors.mock.ts b/backend/lib/testing/mock-data/debtors.mock.ts similarity index 97% rename from backend/functions/lib/testing/mock-data/debtors.mock.ts rename to backend/lib/testing/mock-data/debtors.mock.ts index 1afeeb828..f56303c0e 100644 --- a/backend/functions/lib/testing/mock-data/debtors.mock.ts +++ b/backend/lib/testing/mock-data/debtors.mock.ts @@ -1,4 +1,4 @@ -import { Party } from '../../../../../common/src/cams/parties'; +import { Party } from '../../../../common/src/cams/parties'; export const DEBTORS = new Map([ [ diff --git a/backend/functions/lib/testing/mock-data/generic-test-data.mock.ts b/backend/lib/testing/mock-data/generic-test-data.mock.ts similarity index 100% rename from backend/functions/lib/testing/mock-data/generic-test-data.mock.ts rename to backend/lib/testing/mock-data/generic-test-data.mock.ts diff --git a/backend/functions/lib/testing/mock-data/index.ts b/backend/lib/testing/mock-data/index.ts similarity index 100% rename from backend/functions/lib/testing/mock-data/index.ts rename to backend/lib/testing/mock-data/index.ts diff --git a/backend/functions/lib/testing/mock-fetch.ts b/backend/lib/testing/mock-fetch.ts similarity index 100% rename from backend/functions/lib/testing/mock-fetch.ts rename to backend/lib/testing/mock-fetch.ts diff --git a/backend/functions/lib/testing/mock-gateways/mock-attorneys.gateway.ts b/backend/lib/testing/mock-gateways/mock-attorneys.gateway.ts similarity index 81% rename from backend/functions/lib/testing/mock-gateways/mock-attorneys.gateway.ts rename to backend/lib/testing/mock-gateways/mock-attorneys.gateway.ts index 41021efad..69ff425af 100644 --- a/backend/functions/lib/testing/mock-gateways/mock-attorneys.gateway.ts +++ b/backend/lib/testing/mock-gateways/mock-attorneys.gateway.ts @@ -1,5 +1,5 @@ -import { TRIAL_ATTORNEYS } from '../../../../../common/src/cams/test-utilities/attorneys.mock'; -import { AttorneyUser } from '../../../../../common/src/cams/users'; +import { TRIAL_ATTORNEYS } from '../../../../common/src/cams/test-utilities/attorneys.mock'; +import { AttorneyUser } from '../../../../common/src/cams/users'; import { ApplicationContext } from '../../adapters/types/basic'; import { AttorneyGatewayInterface } from '../../use-cases/attorney.gateway.interface'; diff --git a/backend/functions/lib/testing/mock-gateways/mock-mongo.repository.ts b/backend/lib/testing/mock-gateways/mock-mongo.repository.ts similarity index 96% rename from backend/functions/lib/testing/mock-gateways/mock-mongo.repository.ts rename to backend/lib/testing/mock-gateways/mock-mongo.repository.ts index 8e01c99ce..556c1fb57 100644 --- a/backend/functions/lib/testing/mock-gateways/mock-mongo.repository.ts +++ b/backend/lib/testing/mock-gateways/mock-mongo.repository.ts @@ -4,8 +4,8 @@ import { TransferTo, ConsolidationTo, ConsolidationFrom, -} from '../../../../../common/src/cams/events'; -import { CaseHistory } from '../../../../../common/src/cams/history'; +} from '../../../../common/src/cams/events'; +import { CaseHistory } from '../../../../common/src/cams/history'; import { ApplicationContext } from '../../adapters/types/basic'; import { CaseAssignmentRepository, diff --git a/backend/functions/lib/testing/mock-gateways/mock-oauth2-gateway.ts b/backend/lib/testing/mock-gateways/mock-oauth2-gateway.ts similarity index 86% rename from backend/functions/lib/testing/mock-gateways/mock-oauth2-gateway.ts rename to backend/lib/testing/mock-gateways/mock-oauth2-gateway.ts index 5386e4158..2d464504c 100644 --- a/backend/functions/lib/testing/mock-gateways/mock-oauth2-gateway.ts +++ b/backend/lib/testing/mock-gateways/mock-oauth2-gateway.ts @@ -1,12 +1,12 @@ import * as jwt from 'jsonwebtoken'; import { ApplicationContext } from '../../adapters/types/basic'; import { ForbiddenError } from '../../common-errors/forbidden-error'; -import { MockUser, MockUsers } from '../../../../../common/src/cams/test-utilities/mock-user'; -import { CamsUser } from '../../../../../common/src/cams/users'; -import { CamsRole } from '../../../../../common/src/cams/roles'; -import { CamsJwt, CamsJwtClaims, CamsJwtHeader } from '../../../../../common/src/cams/jwt'; +import { MockUser, MockUsers } from '../../../../common/src/cams/test-utilities/mock-user'; +import { CamsUser } from '../../../../common/src/cams/users'; +import { CamsRole } from '../../../../common/src/cams/roles'; +import { CamsJwt, CamsJwtClaims, CamsJwtHeader } from '../../../../common/src/cams/jwt'; import { OpenIdConnectGateway } from '../../adapters/types/authorization'; -import { USTP_OFFICES_ARRAY } from '../../../../../common/src/cams/offices'; +import { USTP_OFFICES_ARRAY } from '../../../../common/src/cams/offices'; const MODULE_NAME = 'MOCK_OAUTH2_GATEWAY'; const mockUsers: MockUser[] = MockUsers; diff --git a/backend/functions/lib/testing/mock-gateways/mock-user-session-use-case.ts b/backend/lib/testing/mock-gateways/mock-user-session-use-case.ts similarity index 78% rename from backend/functions/lib/testing/mock-gateways/mock-user-session-use-case.ts rename to backend/lib/testing/mock-gateways/mock-user-session-use-case.ts index 056db8f41..a40198bb0 100644 --- a/backend/functions/lib/testing/mock-gateways/mock-user-session-use-case.ts +++ b/backend/lib/testing/mock-gateways/mock-user-session-use-case.ts @@ -1,10 +1,10 @@ import * as jwt from 'jsonwebtoken'; import { ApplicationContext } from '../../adapters/types/basic'; import { getUser } from './mock-oauth2-gateway'; -import { CamsSession } from '../../../../../common/src/cams/session'; -import { CamsRole } from '../../../../../common/src/cams/roles'; -import { CamsJwtClaims } from '../../../../../common/src/cams/jwt'; -import { REGION_02_GROUP_NY } from '../../../../../common/src/cams/test-utilities/mock-user'; +import { CamsSession } from '../../../../common/src/cams/session'; +import { CamsRole } from '../../../../common/src/cams/roles'; +import { CamsJwtClaims } from '../../../../common/src/cams/jwt'; +import { REGION_02_GROUP_NY } from '../../../../common/src/cams/test-utilities/mock-user'; const cache = new Map(); diff --git a/backend/functions/lib/testing/mock-gateways/mock.offices.gateway.ts b/backend/lib/testing/mock-gateways/mock.offices.gateway.ts similarity index 96% rename from backend/functions/lib/testing/mock-gateways/mock.offices.gateway.ts rename to backend/lib/testing/mock-gateways/mock.offices.gateway.ts index a53ef9e1c..7fe56747b 100644 --- a/backend/functions/lib/testing/mock-gateways/mock.offices.gateway.ts +++ b/backend/lib/testing/mock-gateways/mock.offices.gateway.ts @@ -1,4 +1,4 @@ -import { USTP_OFFICES_ARRAY, UstpOfficeDetails } from '../../../../../common/src/cams/offices'; +import { USTP_OFFICES_ARRAY, UstpOfficeDetails } from '../../../../common/src/cams/offices'; import { USTP_OFFICE_NAME_MAP } from '../../adapters/gateways/dxtr/dxtr.constants'; import { ApplicationContext } from '../../adapters/types/basic'; import { CamsError } from '../../common-errors/cams-error'; diff --git a/backend/functions/lib/testing/mock-gateways/mock.offices.repository.ts b/backend/lib/testing/mock-gateways/mock.offices.repository.ts similarity index 68% rename from backend/functions/lib/testing/mock-gateways/mock.offices.repository.ts rename to backend/lib/testing/mock-gateways/mock.offices.repository.ts index 39309b511..2537fe3b9 100644 --- a/backend/functions/lib/testing/mock-gateways/mock.offices.repository.ts +++ b/backend/lib/testing/mock-gateways/mock.offices.repository.ts @@ -1,4 +1,4 @@ -import { TRIAL_ATTORNEYS } from '../../../../../common/src/cams/test-utilities/attorneys.mock'; +import { TRIAL_ATTORNEYS } from '../../../../common/src/cams/test-utilities/attorneys.mock'; export const MockOfficesRepository = { release: () => {}, diff --git a/backend/functions/lib/testing/mock-gateways/mock.orders.gateway.ts b/backend/lib/testing/mock-gateways/mock.orders.gateway.ts similarity index 76% rename from backend/functions/lib/testing/mock-gateways/mock.orders.gateway.ts rename to backend/lib/testing/mock-gateways/mock.orders.gateway.ts index 5e98a98ff..c9c14a109 100644 --- a/backend/functions/lib/testing/mock-gateways/mock.orders.gateway.ts +++ b/backend/lib/testing/mock-gateways/mock.orders.gateway.ts @@ -1,5 +1,5 @@ -import { RawOrderSync } from '../../../../../common/src/cams/orders'; -import MockData from '../../../../../common/src/cams/test-utilities/mock-data'; +import { RawOrderSync } from '../../../../common/src/cams/orders'; +import MockData from '../../../../common/src/cams/test-utilities/mock-data'; import { ApplicationContext } from '../../adapters/types/basic'; import { OrdersGateway } from '../../use-cases/gateways.types'; diff --git a/backend/functions/lib/testing/testing-constants.ts b/backend/lib/testing/testing-constants.ts similarity index 100% rename from backend/functions/lib/testing/testing-constants.ts rename to backend/lib/testing/testing-constants.ts diff --git a/backend/functions/lib/testing/testing-utilities.ts b/backend/lib/testing/testing-utilities.ts similarity index 86% rename from backend/functions/lib/testing/testing-utilities.ts rename to backend/lib/testing/testing-utilities.ts index 3b1371dbe..338e604b2 100644 --- a/backend/functions/lib/testing/testing-utilities.ts +++ b/backend/lib/testing/testing-utilities.ts @@ -1,9 +1,9 @@ import { ApplicationContext } from '../adapters/types/basic'; import { HttpRequest, InvocationContext } from '@azure/functions'; -import { MockData } from '../../../../common/src/cams/test-utilities/mock-data'; -import { CamsSession } from '../../../../common/src/cams/session'; +import { MockData } from '../../../common/src/cams/test-utilities/mock-data'; +import { CamsSession } from '../../../common/src/cams/session'; import { CamsHttpMethod, CamsHttpRequest } from '../adapters/types/http'; -import ContextCreator from '../../azure/application-context-creator'; +import ContextCreator from '../../functions/azure/application-context-creator'; import { LoggerImpl } from '../adapters/services/logger.service'; const invocationContext = new InvocationContext(); diff --git a/backend/functions/lib/use-cases/acms-orders/acms-orders.test.ts b/backend/lib/use-cases/acms-orders/acms-orders.test.ts similarity index 97% rename from backend/functions/lib/use-cases/acms-orders/acms-orders.test.ts rename to backend/lib/use-cases/acms-orders/acms-orders.test.ts index 8de6861c8..89493f72b 100644 --- a/backend/functions/lib/use-cases/acms-orders/acms-orders.test.ts +++ b/backend/lib/use-cases/acms-orders/acms-orders.test.ts @@ -3,14 +3,14 @@ import { createMockApplicationContext } from '../../testing/testing-utilities'; import { AcmsGateway } from '../gateways.types'; import AcmsOrders, { AcmsConsolidation, AcmsPredicate, AcmsPredicateAndPage } from './acms-orders'; import { CasesMongoRepository } from '../../adapters/gateways/mongo/cases.mongo.repository'; -import MockData from '../../../../../common/src/cams/test-utilities/mock-data'; +import MockData from '../../../../common/src/cams/test-utilities/mock-data'; import { AcmsGatewayImpl } from '../../adapters/gateways/acms/acms.gateway'; import CasesDxtrGateway from '../../adapters/gateways/dxtr/cases.dxtr.gateway'; -import { CaseSummary } from '../../../../../common/src/cams/cases'; -import { ConsolidationType } from '../../../../../common/src/cams/orders'; -import { CaseConsolidationHistory } from '../../../../../common/src/cams/history'; -import { ACMS_SYSTEM_USER_REFERENCE } from '../../../../../common/src/cams/auditable'; -import { ConsolidationFrom } from '../../../../../common/src/cams/events'; +import { CaseSummary } from '../../../../common/src/cams/cases'; +import { ConsolidationType } from '../../../../common/src/cams/orders'; +import { CaseConsolidationHistory } from '../../../../common/src/cams/history'; +import { ACMS_SYSTEM_USER_REFERENCE } from '../../../../common/src/cams/auditable'; +import { ConsolidationFrom } from '../../../../common/src/cams/events'; const mockAcmsGateway: AcmsGateway = { getPageCount: function (..._ignore): Promise { diff --git a/backend/functions/lib/use-cases/acms-orders/acms-orders.ts b/backend/lib/use-cases/acms-orders/acms-orders.ts similarity index 95% rename from backend/functions/lib/use-cases/acms-orders/acms-orders.ts rename to backend/lib/use-cases/acms-orders/acms-orders.ts index 316b04055..af1c9e8a7 100644 --- a/backend/functions/lib/use-cases/acms-orders/acms-orders.ts +++ b/backend/lib/use-cases/acms-orders/acms-orders.ts @@ -1,10 +1,10 @@ import { ApplicationContext } from '../../adapters/types/basic'; import Factory from '../../factory'; -import { ConsolidationFrom, ConsolidationTo } from '../../../../../common/src/cams/events'; -import { ConsolidationType } from '../../../../../common/src/cams/orders'; -import { CaseSummary } from '../../../../../common/src/cams/cases'; -import { CaseConsolidationHistory } from '../../../../../common/src/cams/history'; -import { ACMS_SYSTEM_USER_REFERENCE } from '../../../../../common/src/cams/auditable'; +import { ConsolidationFrom, ConsolidationTo } from '../../../../common/src/cams/events'; +import { ConsolidationType } from '../../../../common/src/cams/orders'; +import { CaseSummary } from '../../../../common/src/cams/cases'; +import { CaseConsolidationHistory } from '../../../../common/src/cams/history'; +import { ACMS_SYSTEM_USER_REFERENCE } from '../../../../common/src/cams/auditable'; import { getCamsError } from '../../common-errors/error-utilities'; const MODULE_NAME = 'ACMS_ORDERS_USE_CASE'; diff --git a/backend/functions/lib/use-cases/assignment.exception.test.ts b/backend/lib/use-cases/assignment.exception.test.ts similarity index 84% rename from backend/functions/lib/use-cases/assignment.exception.test.ts rename to backend/lib/use-cases/assignment.exception.test.ts index b4af91996..1a8682a3d 100644 --- a/backend/functions/lib/use-cases/assignment.exception.test.ts +++ b/backend/lib/use-cases/assignment.exception.test.ts @@ -1,5 +1,5 @@ import { AssignmentError } from './assignment.exception'; -import HttpStatusCodes from '../../../../common/src/api/http-status-codes'; +import HttpStatusCodes from '../../../common/src/api/http-status-codes'; describe('CAMS Assignment Exception', () => { const testModuleName = 'Test'; diff --git a/backend/functions/lib/use-cases/assignment.exception.ts b/backend/lib/use-cases/assignment.exception.ts similarity index 84% rename from backend/functions/lib/use-cases/assignment.exception.ts rename to backend/lib/use-cases/assignment.exception.ts index dac52dd79..7adbeadbd 100644 --- a/backend/functions/lib/use-cases/assignment.exception.ts +++ b/backend/lib/use-cases/assignment.exception.ts @@ -1,5 +1,5 @@ import { CamsError, CamsErrorOptions } from '../common-errors/cams-error'; -import HttpStatusCodes from '../../../../common/src/api/http-status-codes'; +import HttpStatusCodes from '../../../common/src/api/http-status-codes'; /* eslint-disable-next-line @typescript-eslint/no-empty-object-type */ export interface AssignmentErrorOptions extends CamsErrorOptions {} diff --git a/backend/functions/lib/use-cases/attorney.gateway.interface.d.ts b/backend/lib/use-cases/attorney.gateway.interface.d.ts similarity index 81% rename from backend/functions/lib/use-cases/attorney.gateway.interface.d.ts rename to backend/lib/use-cases/attorney.gateway.interface.d.ts index daccb5487..4a7032ce8 100644 --- a/backend/functions/lib/use-cases/attorney.gateway.interface.d.ts +++ b/backend/lib/use-cases/attorney.gateway.interface.d.ts @@ -1,5 +1,5 @@ import { ApplicationContext } from '../adapters/types/basic'; -import { AttorneyUser } from '../../../../common/src/cams/users'; +import { AttorneyUser } from '../../../common/src/cams/users'; export interface AttorneyGatewayInterface { getAttorneys(applicationContext: ApplicationContext): Promise>; diff --git a/backend/functions/lib/use-cases/attorneys.test.ts b/backend/lib/use-cases/attorneys.test.ts similarity index 94% rename from backend/functions/lib/use-cases/attorneys.test.ts rename to backend/lib/use-cases/attorneys.test.ts index ad5ebc814..86fa8d78d 100644 --- a/backend/functions/lib/use-cases/attorneys.test.ts +++ b/backend/lib/use-cases/attorneys.test.ts @@ -1,4 +1,4 @@ -import { TRIAL_ATTORNEYS } from '../../../../common/src/cams/test-utilities/attorneys.mock'; +import { TRIAL_ATTORNEYS } from '../../../common/src/cams/test-utilities/attorneys.mock'; import { createMockApplicationContext } from '../testing/testing-utilities'; import AttorneysList from './attorneys'; import { CaseAssignmentUseCase } from './case-assignment'; diff --git a/backend/functions/lib/use-cases/attorneys.ts b/backend/lib/use-cases/attorneys.ts similarity index 93% rename from backend/functions/lib/use-cases/attorneys.ts rename to backend/lib/use-cases/attorneys.ts index 30687370e..a362bb589 100644 --- a/backend/functions/lib/use-cases/attorneys.ts +++ b/backend/lib/use-cases/attorneys.ts @@ -2,7 +2,7 @@ import { AttorneyGatewayInterface } from './attorney.gateway.interface'; import { ApplicationContext } from '../adapters/types/basic'; import { getAttorneyGateway } from '../factory'; import { CaseAssignmentUseCase } from './case-assignment'; -import { AttorneyUser } from '../../../../common/src/cams/users'; +import { AttorneyUser } from '../../../common/src/cams/users'; const MODULE_NAME = 'ATTORNEYS-USE-CASE'; diff --git a/backend/functions/lib/use-cases/case-assignment.test.ts b/backend/lib/use-cases/case-assignment.test.ts similarity index 96% rename from backend/functions/lib/use-cases/case-assignment.test.ts rename to backend/lib/use-cases/case-assignment.test.ts index 15ecdb4f6..235170623 100644 --- a/backend/functions/lib/use-cases/case-assignment.test.ts +++ b/backend/lib/use-cases/case-assignment.test.ts @@ -4,12 +4,12 @@ import { createMockApplicationContext, createMockApplicationContextSession, } from '../testing/testing-utilities'; -import MockData from '../../../../common/src/cams/test-utilities/mock-data'; -import { CamsRole } from '../../../../common/src/cams/roles'; +import MockData from '../../../common/src/cams/test-utilities/mock-data'; +import { CamsRole } from '../../../common/src/cams/roles'; import CaseManagement from './case-management'; -import { getCourtDivisionCodes } from '../../../../common/src/cams/users'; +import { getCourtDivisionCodes } from '../../../common/src/cams/users'; import { MockMongoRepository } from '../testing/mock-gateways/mock-mongo.repository'; -import { ConsolidationOrder } from '../../../../common/src/cams/orders'; +import { ConsolidationOrder } from '../../../common/src/cams/orders'; const randomId = () => { return '' + Math.random() * 99999999; diff --git a/backend/functions/lib/use-cases/case-assignment.ts b/backend/lib/use-cases/case-assignment.ts similarity index 94% rename from backend/functions/lib/use-cases/case-assignment.ts rename to backend/lib/use-cases/case-assignment.ts index 69668639b..ea53158cc 100644 --- a/backend/functions/lib/use-cases/case-assignment.ts +++ b/backend/lib/use-cases/case-assignment.ts @@ -1,13 +1,13 @@ import Factory, { getAssignmentRepository } from '../factory'; import { ApplicationContext } from '../adapters/types/basic'; import { CaseAssignmentRepository } from './gateways.types'; -import { CaseAssignment } from '../../../../common/src/cams/assignments'; -import { CaseAssignmentHistory } from '../../../../common/src/cams/history'; +import { CaseAssignment } from '../../../common/src/cams/assignments'; +import { CaseAssignmentHistory } from '../../../common/src/cams/history'; import CaseManagement from './case-management'; -import { CamsUserReference, getCourtDivisionCodes } from '../../../../common/src/cams/users'; -import { CamsRole } from '../../../../common/src/cams/roles'; +import { CamsUserReference, getCourtDivisionCodes } from '../../../common/src/cams/users'; +import { CamsRole } from '../../../common/src/cams/roles'; import { AssignmentError } from './assignment.exception'; -import { createAuditRecord } from '../../../../common/src/cams/auditable'; +import { createAuditRecord } from '../../../common/src/cams/auditable'; const MODULE_NAME = 'CASE-ASSIGNMENT'; diff --git a/backend/functions/lib/use-cases/case-associated/case-associated.ts b/backend/lib/use-cases/case-associated/case-associated.ts similarity index 95% rename from backend/functions/lib/use-cases/case-associated/case-associated.ts rename to backend/lib/use-cases/case-associated/case-associated.ts index 8393ec1d8..e2728b0f7 100644 --- a/backend/functions/lib/use-cases/case-associated/case-associated.ts +++ b/backend/lib/use-cases/case-associated/case-associated.ts @@ -1,6 +1,6 @@ import Factory from '../../factory'; import { ApplicationContext } from '../../adapters/types/basic'; -import { EventCaseReference } from '../../../../../common/src/cams/events'; +import { EventCaseReference } from '../../../../common/src/cams/events'; function getEarliestDate(orders: Array) { const earliestOrder = orders.sort((a, b) => (a.orderDate < b.orderDate ? -1 : 1))[0]; diff --git a/backend/functions/lib/use-cases/case-docket/case-docket.test.ts b/backend/lib/use-cases/case-docket/case-docket.test.ts similarity index 100% rename from backend/functions/lib/use-cases/case-docket/case-docket.test.ts rename to backend/lib/use-cases/case-docket/case-docket.test.ts diff --git a/backend/functions/lib/use-cases/case-docket/case-docket.ts b/backend/lib/use-cases/case-docket/case-docket.ts similarity index 87% rename from backend/functions/lib/use-cases/case-docket/case-docket.ts rename to backend/lib/use-cases/case-docket/case-docket.ts index a5ade3001..fee01510d 100644 --- a/backend/functions/lib/use-cases/case-docket/case-docket.ts +++ b/backend/lib/use-cases/case-docket/case-docket.ts @@ -1,6 +1,6 @@ import { CaseDocketGateway } from '../gateways.types'; import { ApplicationContext } from '../../adapters/types/basic'; -import { CaseDocket } from '../../../../../common/src/cams/cases'; +import { CaseDocket } from '../../../../common/src/cams/cases'; export class CaseDocketUseCase { private readonly gateway: CaseDocketGateway; diff --git a/backend/functions/lib/use-cases/case-history/case-history.test.ts b/backend/lib/use-cases/case-history/case-history.test.ts similarity index 100% rename from backend/functions/lib/use-cases/case-history/case-history.test.ts rename to backend/lib/use-cases/case-history/case-history.test.ts diff --git a/backend/functions/lib/use-cases/case-history/case-history.ts b/backend/lib/use-cases/case-history/case-history.ts similarity index 85% rename from backend/functions/lib/use-cases/case-history/case-history.ts rename to backend/lib/use-cases/case-history/case-history.ts index db878dd26..1b426e825 100644 --- a/backend/functions/lib/use-cases/case-history/case-history.ts +++ b/backend/lib/use-cases/case-history/case-history.ts @@ -1,6 +1,6 @@ import Factory from '../../factory'; import { ApplicationContext } from '../../adapters/types/basic'; -import { CaseHistory } from '../../../../../common/src/cams/history'; +import { CaseHistory } from '../../../../common/src/cams/history'; export class CaseHistoryUseCase { public async getCaseHistory(context: ApplicationContext): Promise { diff --git a/backend/functions/lib/use-cases/case-management.test.ts b/backend/lib/use-cases/case-management.test.ts similarity index 96% rename from backend/functions/lib/use-cases/case-management.test.ts rename to backend/lib/use-cases/case-management.test.ts index 02e76f32c..14dde07f6 100644 --- a/backend/functions/lib/use-cases/case-management.test.ts +++ b/backend/lib/use-cases/case-management.test.ts @@ -1,25 +1,25 @@ import CaseManagement, { getAction } from './case-management'; import { UnknownError } from '../common-errors/unknown-error'; import { CamsError } from '../common-errors/cams-error'; -import { MockData } from '../../../../common/src/cams/test-utilities/mock-data'; -import { CaseAssignment } from '../../../../common/src/cams/assignments'; +import { MockData } from '../../../common/src/cams/test-utilities/mock-data'; +import { CaseAssignment } from '../../../common/src/cams/assignments'; import { createMockApplicationContext, createMockApplicationContextSession, } from '../testing/testing-utilities'; -import { CamsRole } from '../../../../common/src/cams/roles'; +import { CamsRole } from '../../../common/src/cams/roles'; import { getCasesGateway } from '../factory'; import { ApplicationContext } from '../adapters/types/basic'; -import { CamsUser } from '../../../../common/src/cams/users'; +import { CamsUser } from '../../../common/src/cams/users'; import { REGION_02_GROUP_BU, REGION_02_GROUP_NY, -} from '../../../../common/src/cams/test-utilities/mock-user'; -import { ustpOfficeToCourtDivision } from '../../../../common/src/cams/courts'; +} from '../../../common/src/cams/test-utilities/mock-user'; +import { ustpOfficeToCourtDivision } from '../../../common/src/cams/courts'; import { buildOfficeCode } from './offices/offices'; import { MockMongoRepository } from '../testing/mock-gateways/mock-mongo.repository'; -import { TransferOrder } from '../../../../common/src/cams/orders'; -import { ConsolidationTo } from '../../../../common/src/cams/events'; +import { TransferOrder } from '../../../common/src/cams/orders'; +import { ConsolidationTo } from '../../../common/src/cams/events'; const attorneyJaneSmith = { id: '001', name: 'Jane Smith' }; const attorneyJoeNobel = { id: '002', name: 'Joe Nobel' }; diff --git a/backend/functions/lib/use-cases/case-management.ts b/backend/lib/use-cases/case-management.ts similarity index 92% rename from backend/functions/lib/use-cases/case-management.ts rename to backend/lib/use-cases/case-management.ts index d2e6b2610..6656a6f0c 100644 --- a/backend/functions/lib/use-cases/case-management.ts +++ b/backend/lib/use-cases/case-management.ts @@ -1,5 +1,5 @@ import { ApplicationContext } from '../adapters/types/basic'; -import { CaseBasics, CaseDetail, CaseSummary } from '../../../../common/src/cams/cases'; +import { CaseBasics, CaseDetail, CaseSummary } from '../../../common/src/cams/cases'; import Factory, { getAssignmentRepository, getCasesGateway, getOfficesGateway } from '../factory'; import { CasesInterface } from './cases.interface'; import { CaseAssignmentUseCase } from './case-assignment'; @@ -8,12 +8,12 @@ import { isCamsError } from '../common-errors/cams-error'; import { AssignmentError } from './assignment.exception'; import { OfficesGateway } from './offices/offices.types'; import { CaseAssignmentRepository } from './gateways.types'; -import { CasesSearchPredicate } from '../../../../common/src/api/search'; -import Actions, { Action, ResourceActions } from '../../../../common/src/cams/actions'; -import { CamsRole } from '../../../../common/src/cams/roles'; -import { getCourtDivisionCodes } from '../../../../common/src/cams/users'; +import { CasesSearchPredicate } from '../../../common/src/api/search'; +import Actions, { Action, ResourceActions } from '../../../common/src/cams/actions'; +import { CamsRole } from '../../../common/src/cams/roles'; +import { getCourtDivisionCodes } from '../../../common/src/cams/users'; import { buildOfficeCode } from './offices/offices'; -import { CaseAssignment } from '../../../../common/src/cams/assignments'; +import { CaseAssignment } from '../../../common/src/cams/assignments'; import { getCamsError } from '../common-errors/error-utilities'; const MODULE_NAME = 'CASE-MANAGEMENT-USE-CASE'; diff --git a/backend/functions/lib/use-cases/cases.interface.d.ts b/backend/lib/use-cases/cases.interface.d.ts similarity index 76% rename from backend/functions/lib/use-cases/cases.interface.d.ts rename to backend/lib/use-cases/cases.interface.d.ts index 99bc1713d..43e71f034 100644 --- a/backend/functions/lib/use-cases/cases.interface.d.ts +++ b/backend/lib/use-cases/cases.interface.d.ts @@ -1,6 +1,6 @@ import { ApplicationContext } from '../adapters/types/basic'; -import { CaseBasics, CaseDetail, CaseSummary } from '../../../../common/src/cams/cases'; -import { CasesSearchPredicate } from '../../../../common/src/api/search'; +import { CaseBasics, CaseDetail, CaseSummary } from '../../../common/src/cams/cases'; +import { CasesSearchPredicate } from '../../../common/src/api/search'; export interface CasesInterface { getCaseDetail(applicationContext: ApplicationContext, caseId: string): Promise; diff --git a/backend/functions/lib/use-cases/courts/courts.test.ts b/backend/lib/use-cases/courts/courts.test.ts similarity index 87% rename from backend/functions/lib/use-cases/courts/courts.test.ts rename to backend/lib/use-cases/courts/courts.test.ts index 9139e382b..26768fb93 100644 --- a/backend/functions/lib/use-cases/courts/courts.test.ts +++ b/backend/lib/use-cases/courts/courts.test.ts @@ -2,8 +2,8 @@ import { CourtsUseCase } from './courts'; import { ApplicationContext } from '../../adapters/types/basic'; import { createMockApplicationContext } from '../../testing/testing-utilities'; import { OfficesUseCase } from '../offices/offices'; -import { USTP_OFFICES_ARRAY } from '../../../../../common/src/cams/offices'; -import { ustpOfficeToCourtDivision } from '../../../../../common/src/cams/courts'; +import { USTP_OFFICES_ARRAY } from '../../../../common/src/cams/offices'; +import { ustpOfficeToCourtDivision } from '../../../../common/src/cams/courts'; describe('Courts use case tests', () => { let useCase: CourtsUseCase; diff --git a/backend/functions/lib/use-cases/courts/courts.ts b/backend/lib/use-cases/courts/courts.ts similarity index 92% rename from backend/functions/lib/use-cases/courts/courts.ts rename to backend/lib/use-cases/courts/courts.ts index 80288c692..03466e307 100644 --- a/backend/functions/lib/use-cases/courts/courts.ts +++ b/backend/lib/use-cases/courts/courts.ts @@ -2,7 +2,7 @@ import { ApplicationContext } from '../../adapters/types/basic'; import { CourtDivisionDetails, ustpOfficeToCourtDivision, -} from '../../../../../common/src/cams/courts'; +} from '../../../../common/src/cams/courts'; import { OfficesUseCase } from '../offices/offices'; export class CourtsUseCase { diff --git a/backend/functions/lib/use-cases/gateways.types.ts b/backend/lib/use-cases/gateways.types.ts similarity index 89% rename from backend/functions/lib/use-cases/gateways.types.ts rename to backend/lib/use-cases/gateways.types.ts index 8479ad768..95d45ed19 100644 --- a/backend/functions/lib/use-cases/gateways.types.ts +++ b/backend/lib/use-cases/gateways.types.ts @@ -4,20 +4,20 @@ import { Order, RawOrderSync, TransferOrderAction, -} from '../../../../common/src/cams/orders'; +} from '../../../common/src/cams/orders'; import { ConsolidationTo, ConsolidationFrom, TransferFrom, TransferTo, -} from '../../../../common/src/cams/events'; -import { CaseAssignmentHistory, CaseHistory } from '../../../../common/src/cams/history'; -import { CaseDocket } from '../../../../common/src/cams/cases'; -import { OrdersSearchPredicate } from '../../../../common/src/api/search'; -import { AttorneyUser, CamsUserGroup, CamsUserReference } from '../../../../common/src/cams/users'; -import { UstpOfficeDetails } from '../../../../common/src/cams/offices'; -import { CaseAssignment } from '../../../../common/src/cams/assignments'; -import { CamsSession } from '../../../../common/src/cams/session'; +} from '../../../common/src/cams/events'; +import { CaseAssignmentHistory, CaseHistory } from '../../../common/src/cams/history'; +import { CaseDocket } from '../../../common/src/cams/cases'; +import { OrdersSearchPredicate } from '../../../common/src/api/search'; +import { AttorneyUser, CamsUserGroup, CamsUserReference } from '../../../common/src/cams/users'; +import { UstpOfficeDetails } from '../../../common/src/cams/offices'; +import { CaseAssignment } from '../../../common/src/cams/assignments'; +import { CamsSession } from '../../../common/src/cams/session'; import { ConditionOrConjunction, Sort } from '../query/query-builder'; import { AcmsConsolidation, AcmsPredicate, AcmsPredicateAndPage } from './acms-orders/acms-orders'; diff --git a/backend/functions/lib/use-cases/offices/offices.test.ts b/backend/lib/use-cases/offices/offices.test.ts similarity index 95% rename from backend/functions/lib/use-cases/offices/offices.test.ts rename to backend/lib/use-cases/offices/offices.test.ts index 494e3d35e..6068ef853 100644 --- a/backend/functions/lib/use-cases/offices/offices.test.ts +++ b/backend/lib/use-cases/offices/offices.test.ts @@ -4,14 +4,14 @@ import { createMockApplicationContext } from '../../testing/testing-utilities'; import * as factory from '../../factory'; import OktaUserGroupGateway from '../../adapters/gateways/okta/okta-user-group-gateway'; import { UserGroupGatewayConfig } from '../../adapters/types/authorization'; -import { CamsUserGroup, Staff } from '../../../../../common/src/cams/users'; -import MockData from '../../../../../common/src/cams/test-utilities/mock-data'; -import { USTP_OFFICES_ARRAY, UstpDivisionMeta } from '../../../../../common/src/cams/offices'; -import { TRIAL_ATTORNEYS } from '../../../../../common/src/cams/test-utilities/attorneys.mock'; +import { CamsUserGroup, Staff } from '../../../../common/src/cams/users'; +import MockData from '../../../../common/src/cams/test-utilities/mock-data'; +import { USTP_OFFICES_ARRAY, UstpDivisionMeta } from '../../../../common/src/cams/offices'; +import { TRIAL_ATTORNEYS } from '../../../../common/src/cams/test-utilities/attorneys.mock'; import AttorneysList from '../attorneys'; import { MockMongoRepository } from '../../testing/mock-gateways/mock-mongo.repository'; import { MockOfficesRepository } from '../../testing/mock-gateways/mock.offices.repository'; -import { CamsRole } from '../../../../../common/src/cams/roles'; +import { CamsRole } from '../../../../common/src/cams/roles'; describe('offices use case tests', () => { let applicationContext: ApplicationContext; diff --git a/backend/functions/lib/use-cases/offices/offices.ts b/backend/lib/use-cases/offices/offices.ts similarity index 97% rename from backend/functions/lib/use-cases/offices/offices.ts rename to backend/lib/use-cases/offices/offices.ts index b2983f9b4..d700f38a5 100644 --- a/backend/functions/lib/use-cases/offices/offices.ts +++ b/backend/lib/use-cases/offices/offices.ts @@ -1,5 +1,5 @@ -import { UstpOfficeDetails } from '../../../../../common/src/cams/offices'; -import { AttorneyUser, Staff } from '../../../../../common/src/cams/users'; +import { UstpOfficeDetails } from '../../../../common/src/cams/offices'; +import { AttorneyUser, Staff } from '../../../../common/src/cams/users'; import { ApplicationContext } from '../../adapters/types/basic'; import { getOfficesGateway, diff --git a/backend/functions/lib/use-cases/offices/offices.types.ts b/backend/lib/use-cases/offices/offices.types.ts similarity index 77% rename from backend/functions/lib/use-cases/offices/offices.types.ts rename to backend/lib/use-cases/offices/offices.types.ts index 53711d67a..854ce6762 100644 --- a/backend/functions/lib/use-cases/offices/offices.types.ts +++ b/backend/lib/use-cases/offices/offices.types.ts @@ -1,4 +1,4 @@ -import { UstpOfficeDetails } from '../../../../../common/src/cams/offices'; +import { UstpOfficeDetails } from '../../../../common/src/cams/offices'; import { ApplicationContext } from '../../adapters/types/basic'; export interface OfficesGateway { diff --git a/backend/functions/lib/use-cases/orders/orders-consolidation-approval.test.ts b/backend/lib/use-cases/orders/orders-consolidation-approval.test.ts similarity index 96% rename from backend/functions/lib/use-cases/orders/orders-consolidation-approval.test.ts rename to backend/lib/use-cases/orders/orders-consolidation-approval.test.ts index 5db22292c..e7bb63a8b 100644 --- a/backend/functions/lib/use-cases/orders/orders-consolidation-approval.test.ts +++ b/backend/lib/use-cases/orders/orders-consolidation-approval.test.ts @@ -7,15 +7,15 @@ import { getCasesRepository } from '../../factory'; import { ConsolidationOrderActionApproval, getCaseSummaryFromConsolidationOrderCase, -} from '../../../../../common/src/cams/orders'; -import { MockData } from '../../../../../common/src/cams/test-utilities/mock-data'; +} from '../../../../common/src/cams/orders'; +import { MockData } from '../../../../common/src/cams/test-utilities/mock-data'; import { ApplicationContext } from '../../adapters/types/basic'; import * as crypto from 'crypto'; -import { CaseHistory, ConsolidationOrderSummary } from '../../../../../common/src/cams/history'; +import { CaseHistory, ConsolidationOrderSummary } from '../../../../common/src/cams/history'; import { CaseAssignmentUseCase } from '../case-assignment'; -import { CamsRole } from '../../../../../common/src/cams/roles'; -import { SYSTEM_USER_REFERENCE } from '../../../../../common/src/cams/auditable'; -import { REGION_02_GROUP_NY } from '../../../../../common/src/cams/test-utilities/mock-user'; +import { CamsRole } from '../../../../common/src/cams/roles'; +import { SYSTEM_USER_REFERENCE } from '../../../../common/src/cams/auditable'; +import { REGION_02_GROUP_NY } from '../../../../common/src/cams/test-utilities/mock-user'; import { MockMongoRepository } from '../../testing/mock-gateways/mock-mongo.repository'; describe('Orders use case', () => { diff --git a/backend/functions/lib/use-cases/orders/orders-local-gateway.test.ts b/backend/lib/use-cases/orders/orders-local-gateway.test.ts similarity index 94% rename from backend/functions/lib/use-cases/orders/orders-local-gateway.test.ts rename to backend/lib/use-cases/orders/orders-local-gateway.test.ts index bdd542b3b..9e67bd285 100644 --- a/backend/functions/lib/use-cases/orders/orders-local-gateway.test.ts +++ b/backend/lib/use-cases/orders/orders-local-gateway.test.ts @@ -1,18 +1,18 @@ -import { MockData } from '../../../../../common/src/cams/test-utilities/mock-data'; +import { MockData } from '../../../../common/src/cams/test-utilities/mock-data'; import { ConsolidationOrder, ConsolidationOrderActionApproval, -} from '../../../../../common/src/cams/orders'; +} from '../../../../common/src/cams/orders'; import { Factory } from '../../factory'; import { CasesRepository, ConsolidationOrdersRepository } from '../gateways.types'; -import { ConsolidationFrom, ConsolidationTo } from '../../../../../common/src/cams/events'; +import { ConsolidationFrom, ConsolidationTo } from '../../../../common/src/cams/events'; import { createMockApplicationContext, createMockApplicationContextSession, } from '../../testing/testing-utilities'; -import { CamsRole } from '../../../../../common/src/cams/roles'; -import { REGION_02_GROUP_NY } from '../../../../../common/src/cams/test-utilities/mock-user'; +import { CamsRole } from '../../../../common/src/cams/roles'; +import { REGION_02_GROUP_NY } from '../../../../common/src/cams/test-utilities/mock-user'; import { LocalCasesRepository } from '../../testing/local-data/local-cases-repository'; import { LocalConsolidationOrdersRepository } from '../../testing/local-data/local-consolidation-orders-repository'; import { OrdersUseCase } from './orders'; diff --git a/backend/functions/lib/use-cases/orders/orders.test.ts b/backend/lib/use-cases/orders/orders.test.ts similarity index 97% rename from backend/functions/lib/use-cases/orders/orders.test.ts rename to backend/lib/use-cases/orders/orders.test.ts index bceff338e..dd6fdb0e7 100644 --- a/backend/functions/lib/use-cases/orders/orders.test.ts +++ b/backend/lib/use-cases/orders/orders.test.ts @@ -17,29 +17,29 @@ import { getCaseSummaryFromTransferOrder, TransferOrder, TransferOrderAction, -} from '../../../../../common/src/cams/orders'; +} from '../../../../common/src/cams/orders'; import { ConsolidationFrom, ConsolidationTo, TransferFrom, TransferTo, -} from '../../../../../common/src/cams/events'; +} from '../../../../common/src/cams/events'; import { CASE_SUMMARIES } from '../../testing/mock-data/case-summaries.mock'; -import { MockData } from '../../../../../common/src/cams/test-utilities/mock-data'; +import { MockData } from '../../../../common/src/cams/test-utilities/mock-data'; import { CasesLocalGateway } from '../../adapters/gateways/cases.local.gateway'; -import { CaseSummary } from '../../../../../common/src/cams/cases'; +import { CaseSummary } from '../../../../common/src/cams/cases'; import { ApplicationContext } from '../../adapters/types/basic'; import { NotFoundError } from '../../common-errors/not-found-error'; import * as crypto from 'crypto'; -import { CaseHistory, ConsolidationOrderSummary } from '../../../../../common/src/cams/history'; +import { CaseHistory, ConsolidationOrderSummary } from '../../../../common/src/cams/history'; import { MockOrdersGateway } from '../../testing/mock-gateways/mock.orders.gateway'; -import { CamsRole } from '../../../../../common/src/cams/roles'; -import { getCamsUserReference } from '../../../../../common/src/cams/session'; +import { CamsRole } from '../../../../common/src/cams/roles'; +import { getCamsUserReference } from '../../../../common/src/cams/session'; import { CaseAssignmentUseCase } from '../case-assignment'; -import { REGION_02_GROUP_NY } from '../../../../../common/src/cams/test-utilities/mock-user'; -import { getCourtDivisionCodes } from '../../../../../common/src/cams/users'; +import { REGION_02_GROUP_NY } from '../../../../common/src/cams/test-utilities/mock-user'; +import { getCourtDivisionCodes } from '../../../../common/src/cams/users'; import { MockMongoRepository } from '../../testing/mock-gateways/mock-mongo.repository'; -import { UstpDivisionMeta } from '../../../../../common/src/cams/offices'; +import { UstpDivisionMeta } from '../../../../common/src/cams/offices'; describe('Orders use case', () => { const CASE_ID = '000-11-22222'; diff --git a/backend/functions/lib/use-cases/orders/orders.ts b/backend/lib/use-cases/orders/orders.ts similarity index 96% rename from backend/functions/lib/use-cases/orders/orders.ts rename to backend/lib/use-cases/orders/orders.ts index 20b51a78a..06d49ed0f 100644 --- a/backend/functions/lib/use-cases/orders/orders.ts +++ b/backend/lib/use-cases/orders/orders.ts @@ -14,30 +14,30 @@ import { ConsolidationType, getCaseSummaryFromTransferOrder, getCaseSummaryFromConsolidationOrderCase, -} from '../../../../../common/src/cams/orders'; +} from '../../../../common/src/cams/orders'; import { ConsolidationFrom, ConsolidationTo, TransferFrom, TransferTo, -} from '../../../../../common/src/cams/events'; -import { CaseSummary } from '../../../../../common/src/cams/cases'; +} from '../../../../common/src/cams/events'; +import { CaseSummary } from '../../../../common/src/cams/cases'; import { CamsError } from '../../common-errors/cams-error'; -import { sortDates, sortDatesReverse } from '../../../../../common/src/date-helper'; +import { sortDates, sortDatesReverse } from '../../../../common/src/date-helper'; import * as crypto from 'crypto'; import { CaseConsolidationHistory, CaseHistory, ConsolidationOrderSummary, isConsolidationHistory, -} from '../../../../../common/src/cams/history'; +} from '../../../../common/src/cams/history'; import { CaseAssignmentUseCase } from '../case-assignment'; import { BadRequestError } from '../../common-errors/bad-request'; -import { CamsUserReference, getCourtDivisionCodes } from '../../../../../common/src/cams/users'; -import { CamsRole } from '../../../../../common/src/cams/roles'; +import { CamsUserReference, getCourtDivisionCodes } from '../../../../common/src/cams/users'; +import { CamsRole } from '../../../../common/src/cams/roles'; import { UnauthorizedError } from '../../common-errors/unauthorized-error'; -import { createAuditRecord } from '../../../../../common/src/cams/auditable'; -import { OrdersSearchPredicate } from '../../../../../common/src/api/search'; +import { createAuditRecord } from '../../../../common/src/cams/auditable'; +import { OrdersSearchPredicate } from '../../../../common/src/api/search'; import { isNotFoundError } from '../../common-errors/not-found-error'; import { Factory } from '../../factory'; diff --git a/backend/functions/lib/use-cases/user-session/user-session.test.ts b/backend/lib/use-cases/user-session/user-session.test.ts similarity index 93% rename from backend/functions/lib/use-cases/user-session/user-session.test.ts rename to backend/lib/use-cases/user-session/user-session.test.ts index 4097bc89a..72f1aad3c 100644 --- a/backend/functions/lib/use-cases/user-session/user-session.test.ts +++ b/backend/lib/use-cases/user-session/user-session.test.ts @@ -1,17 +1,17 @@ import { UserSessionUseCase } from './user-session'; import { ApplicationContext } from '../../adapters/types/basic'; import { createMockApplicationContext } from '../../testing/testing-utilities'; -import { MockData } from '../../../../../common/src/cams/test-utilities/mock-data'; +import { MockData } from '../../../../common/src/cams/test-utilities/mock-data'; import { UnauthorizedError } from '../../common-errors/unauthorized-error'; import * as factoryModule from '../../factory'; import { ServerConfigError } from '../../common-errors/server-config-error'; -import { CamsSession } from '../../../../../common/src/cams/session'; -import { CamsRole } from '../../../../../common/src/cams/roles'; -import { urlRegex } from '../../../../../common/src/cams/test-utilities/regex'; -import { CamsJwtHeader } from '../../../../../common/src/cams/jwt'; +import { CamsSession } from '../../../../common/src/cams/session'; +import { CamsRole } from '../../../../common/src/cams/roles'; +import { urlRegex } from '../../../../common/src/cams/test-utilities/regex'; +import { CamsJwtHeader } from '../../../../common/src/cams/jwt'; import MockOpenIdConnectGateway from '../../testing/mock-gateways/mock-oauth2-gateway'; import * as Verifier from '../../adapters/gateways/okta/HumbleVerifier'; -import { REGION_02_GROUP_NY } from '../../../../../common/src/cams/test-utilities/mock-user'; +import { REGION_02_GROUP_NY } from '../../../../common/src/cams/test-utilities/mock-user'; import { MockMongoRepository } from '../../testing/mock-gateways/mock-mongo.repository'; import { NotFoundError } from '../../common-errors/not-found-error'; diff --git a/backend/functions/lib/use-cases/user-session/user-session.ts b/backend/lib/use-cases/user-session/user-session.ts similarity index 89% rename from backend/functions/lib/use-cases/user-session/user-session.ts rename to backend/lib/use-cases/user-session/user-session.ts index 04fd1ff9d..83378b55a 100644 --- a/backend/functions/lib/use-cases/user-session/user-session.ts +++ b/backend/lib/use-cases/user-session/user-session.ts @@ -3,11 +3,11 @@ import { ApplicationContext } from '../../adapters/types/basic'; import { UnauthorizedError } from '../../common-errors/unauthorized-error'; import { isCamsError } from '../../common-errors/cams-error'; import { ServerConfigError } from '../../common-errors/server-config-error'; -import { UstpOfficeDetails } from '../../../../../common/src/cams/offices'; +import { UstpOfficeDetails } from '../../../../common/src/cams/offices'; import LocalStorageGateway from '../../adapters/gateways/storage/local-storage-gateway'; -import { CamsRole } from '../../../../../common/src/cams/roles'; -import { CamsSession } from '../../../../../common/src/cams/session'; -import { REGION_02_GROUP_NY } from '../../../../../common/src/cams/test-utilities/mock-user'; +import { CamsRole } from '../../../../common/src/cams/roles'; +import { CamsSession } from '../../../../common/src/cams/session'; +import { REGION_02_GROUP_NY } from '../../../../common/src/cams/test-utilities/mock-user'; import { isNotFoundError } from '../../common-errors/not-found-error'; const MODULE_NAME = 'USER-SESSION-GATEWAY'; diff --git a/backend/functions/package-lock.json b/backend/package-lock.json similarity index 100% rename from backend/functions/package-lock.json rename to backend/package-lock.json diff --git a/backend/functions/package.json b/backend/package.json similarity index 74% rename from backend/functions/package.json rename to backend/package.json index ec0ebc375..dc59fdb44 100644 --- a/backend/functions/package.json +++ b/backend/package.json @@ -44,22 +44,22 @@ "scripts": { "clean": "rm -rf ./dist && rm -rf ./node_modules && rm -rf ./coverage", "build": "tsc --build tsconfig.build.json", - "build-common": "pushd ../../common && npm ci && npm run build && popd", + "build-common": "pushd ../common && npm ci && npm run build && popd", "watch": "tsc --project tsconfig.build.json -w", "prestart": "npm run build", "start": "func start --typescript", "start:dev": "nodemon --esm src/server.ts", "test": "CAMS_LOGIN_PROVIDER='mock' DATABASE_MOCK='true' MONGO_CONNECTION_STRING='mongodb://test-string' jest -c jest.config.js", "test:open-handles": "CAMS_LOGIN_PROVIDER='mock' DATABASE_MOCK='true' MONGO_CONNECTION_STRING='mongodb://test-string' jest -c jest.config.js --detectOpenHandles", - "lint": "eslint .", - "lint:fix": "eslint . --fix", - "format": "prettier --write './**/*.{js,ts,css,md,json}' --config ./.prettierrc", - "pack": "mkdir -p /tmp/build && zip -q -r /tmp/build/$OUT.zip . --exclude @.funcignore --exclude .funcignore && mv /tmp/build/$OUT.zip .", + "lint": "eslint functions", + "lint:fix": "eslint functions --fix", + "format": "prettier --write './**/*.{js,ts,css,md,json}' --config .prettierrc", + "pack": "mkdir -p /tmp/build && zip -q -r /tmp/build/$OUT.zip functions --exclude @.funcignore --exclude .funcignore && mv /tmp/build/$OUT.zip .", "coverage": "npm test -- --coverage", "coverage:ci": "npm config set script-shell=/bin/bash && npm run build-common && npm test -- --coverage", - "dependency-cruiser-graphical": "current_time=$(date +'%Y-%m-%d_%H%M') && npx depcruise --output-type dot --do-not-follow '^node_modules($|/)' attorneys case-assignments case-docket case-history case-summary cases consolidations healthcheck offices orders orders-manual-sync orders-sync lib | dot -T svg > ../../docs/architecture/dependency-cruiser/functions/dependency-graph_api_${current_time}.svg", - "dependency-cruiser:ci": "npx depcruise --output-type err-long attorneys case-assignments case-docket case-history case-summary cases consolidations healthcheck offices orders orders-manual-sync orders-sync lib ", - "itest:okta-group-api": "CAMS_LOGIN_PROVIDER=okta npx ts-node ./lib/testing/isolated-integration/test-okta-group-api.ts", - "itest:export-office-csv": "CAMS_LOGIN_PROVIDER=okta npx ts-node ./lib/testing/isolated-integration/export-office-csv.ts" + "dependency-cruiser-graphical": "current_time=$(date +'%Y-%m-%d_%H%M') && npx depcruise --output-type dot --do-not-follow '^node_modules($|/)' functions/attorneys case-assignments case-docket case-history case-summary cases consolidations healthcheck offices orders orders-manual-sync orders-sync ../lib | dot -T svg > ../../docs/architecture/dependency-cruiser/functions/dependency-graph_api_${current_time}.svg", + "dependency-cruiser:ci": "npx depcruise --output-type err-long functions/attorneys case-assignments case-docket case-history case-summary cases consolidations healthcheck offices orders orders-manual-sync orders-sync ../lib ", + "itest:okta-group-api": "CAMS_LOGIN_PROVIDER=okta npx ts-node lib/testing/isolated-integration/test-okta-group-api.ts", + "itest:export-office-csv": "CAMS_LOGIN_PROVIDER=okta npx ts-node ../lib/testing/isolated-integration/export-office-csv.ts" } } diff --git a/backend/functions/tsconfig.build.json b/backend/tsconfig.build.json similarity index 100% rename from backend/functions/tsconfig.build.json rename to backend/tsconfig.build.json diff --git a/backend/functions/tsconfig.json b/backend/tsconfig.json similarity index 81% rename from backend/functions/tsconfig.json rename to backend/tsconfig.json index ce3ea8bb6..ab1da766c 100644 --- a/backend/functions/tsconfig.json +++ b/backend/tsconfig.json @@ -7,6 +7,6 @@ "strict": false, "resolveJsonModule": true }, - "references": [{ "path": "../../common" }], + "references": [{ "path": "../common"}], "exclude": ["node_modules"] } From 05ed5c839d643a05fad0909c05408f95004e9c22 Mon Sep 17 00:00:00 2001 From: Brian Posey <15091170+btposey@users.noreply.github.com> Date: Thu, 5 Dec 2024 17:48:38 -0500 Subject: [PATCH 02/49] Fix backend start path Jira ticket: CAMS-461 Co-authored-by: Fritz Madden <96319835+fmaddenflx@users.noreply.github.com> Co-authored-by: James Brooks <12275865+jamesobrooks@users.noreply.github.com> Co-authored-by: Brian Posey <15091170+btposey@users.noreply.github.com>, --- backend/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/package.json b/backend/package.json index dc59fdb44..b7c5a25c8 100644 --- a/backend/package.json +++ b/backend/package.json @@ -47,7 +47,7 @@ "build-common": "pushd ../common && npm ci && npm run build && popd", "watch": "tsc --project tsconfig.build.json -w", "prestart": "npm run build", - "start": "func start --typescript", + "start": "pushd functions && func start --typescript && popd", "start:dev": "nodemon --esm src/server.ts", "test": "CAMS_LOGIN_PROVIDER='mock' DATABASE_MOCK='true' MONGO_CONNECTION_STRING='mongodb://test-string' jest -c jest.config.js", "test:open-handles": "CAMS_LOGIN_PROVIDER='mock' DATABASE_MOCK='true' MONGO_CONNECTION_STRING='mongodb://test-string' jest -c jest.config.js --detectOpenHandles", From 6abe1b2768272b248fa93754617a2edfa7fd8221 Mon Sep 17 00:00:00 2001 From: James Brooks <12275865+jamesobrooks@users.noreply.github.com> Date: Fri, 6 Dec 2024 08:53:03 -0600 Subject: [PATCH 03/49] Change workflow paths to api Jira ticket: CAMS-461 Co-authored-by: Fritz Madden <96319835+fmaddenflx@users.noreply.github.com> Co-authored-by: Arthur Morrow <133667008+amorrow-flexion@users.noreply.github.com> --- .github/workflows/continuous-deployment.yml | 2 +- .github/workflows/sub-build.yml | 4 ++-- .github/workflows/sub-security-scan.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/continuous-deployment.yml b/.github/workflows/continuous-deployment.yml index 6bd1aee47..a69c4415f 100644 --- a/.github/workflows/continuous-deployment.yml +++ b/.github/workflows/continuous-deployment.yml @@ -88,7 +88,7 @@ jobs: unit-test-backend: uses: ./.github/workflows/reusable-unit-test.yml with: - path: backend/functions + path: backend node-version: ${{ vars.NODE_VERSION }} unit-test-common: diff --git a/.github/workflows/sub-build.yml b/.github/workflows/sub-build.yml index 1e9f704d1..8d75b086d 100644 --- a/.github/workflows/sub-build.yml +++ b/.github/workflows/sub-build.yml @@ -84,7 +84,7 @@ jobs: backend: defaults: run: - working-directory: backend/functions + working-directory: backend runs-on: ubuntu-latest environment: ${{ inputs.environment }} @@ -107,5 +107,5 @@ jobs: uses: actions/upload-artifact@v4.4.0 with: name: ${{ inputs.apiName }}-build - path: backend/functions/${{ inputs.apiName }}.zip + path: backend/${{ inputs.apiName }}.zip if-no-files-found: error diff --git a/.github/workflows/sub-security-scan.yml b/.github/workflows/sub-security-scan.yml index 45d33114e..dd6f78a53 100644 --- a/.github/workflows/sub-security-scan.yml +++ b/.github/workflows/sub-security-scan.yml @@ -12,7 +12,7 @@ jobs: sca-scan-backend: uses: ./.github/workflows/reusable-sca-scan.yml with: - path: backend/functions + path: backend secrets: inherit # pragma: allowlist secret sca-scan-common: From 1135cff5761967fec3a06a9a9123593d905b8b61 Mon Sep 17 00:00:00 2001 From: James Brooks <12275865+jamesobrooks@users.noreply.github.com> Date: Fri, 6 Dec 2024 09:02:22 -0600 Subject: [PATCH 04/49] Fix remaining path issues Jira ticket: CAMS-461 Co-authored-by: Fritz Madden <96319835+fmaddenflx@users.noreply.github.com> Co-authored-by: Arthur Morrow <133667008+amorrow-flexion@users.noreply.github.com> --- .github/workflows/sub-build.yml | 2 +- ops/scripts/utility/clean-all-projects.sh | 2 +- ops/scripts/utility/clean-install-all-projects.sh | 2 +- package.json | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/sub-build.yml b/.github/workflows/sub-build.yml index 8d75b086d..88151447a 100644 --- a/.github/workflows/sub-build.yml +++ b/.github/workflows/sub-build.yml @@ -93,7 +93,7 @@ jobs: - uses: actions/checkout@v3 - name: Execute Build run: | - pushd ../../common + pushd ../common npm ci popd diff --git a/ops/scripts/utility/clean-all-projects.sh b/ops/scripts/utility/clean-all-projects.sh index 568fdde6e..04247a166 100755 --- a/ops/scripts/utility/clean-all-projects.sh +++ b/ops/scripts/utility/clean-all-projects.sh @@ -6,7 +6,7 @@ # From the root directory, run the following command: # ./ops/scripts/utility/clean-all-projects.sh -PROJECTS=("backend/functions" "common" "dev-tools" "test/e2e" "user-interface") +PROJECTS=("backend" "common" "dev-tools" "test/e2e" "user-interface") for str in "${PROJECTS[@]}"; do pushd "${str}" || exit diff --git a/ops/scripts/utility/clean-install-all-projects.sh b/ops/scripts/utility/clean-install-all-projects.sh index a6278cebe..bec66001e 100755 --- a/ops/scripts/utility/clean-install-all-projects.sh +++ b/ops/scripts/utility/clean-install-all-projects.sh @@ -6,7 +6,7 @@ # From the root directory, run the following command: # ./ops/scripts/utility/clean-all-projects.sh -PROJECTS=("backend/functions" "common" "dev-tools" "test/e2e" "user-interface") +PROJECTS=("backend" "common" "dev-tools" "test/e2e" "user-interface") for str in "${PROJECTS[@]}"; do pushd "${str}" || exit diff --git a/package.json b/package.json index a6c5ab260..5ce5ce99c 100644 --- a/package.json +++ b/package.json @@ -7,10 +7,10 @@ "scripts": { "clean:all": "./ops/scripts/utility/clean-all-projects.sh", "ci:all": "./ops/scripts/utility/clean-install-all-projects.sh", - "start:backend": "cd backend/functions && npm run start", + "start:backend": "cd backend && npm run start", "start:frontend": "cd user-interface && npm run start", "build": "npm run build:common && npm run build:backend && npm run build:frontend", - "build:backend": "cd backend/functions && npm run build", + "build:backend": "cd backend && npm run build", "build:frontend": "cd user-interface && npm run build", "build:common": "cd common && npm run build", "clean-and-build": "npm run clean:all && npm run ci:all && npm run build" From 73ebee820ffb1dc769cb8b32b5a3f12210290967 Mon Sep 17 00:00:00 2001 From: James Brooks <12275865+jamesobrooks@users.noreply.github.com> Date: Fri, 6 Dec 2024 09:12:19 -0600 Subject: [PATCH 05/49] Fix backend zip creation Jira ticket: CAMS-461 Co-authored-by: Fritz Madden <96319835+fmaddenflx@users.noreply.github.com> Co-authored-by: Arthur Morrow <133667008+amorrow-flexion@users.noreply.github.com> --- backend/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/package.json b/backend/package.json index b7c5a25c8..4aee8079a 100644 --- a/backend/package.json +++ b/backend/package.json @@ -54,7 +54,7 @@ "lint": "eslint functions", "lint:fix": "eslint functions --fix", "format": "prettier --write './**/*.{js,ts,css,md,json}' --config .prettierrc", - "pack": "mkdir -p /tmp/build && zip -q -r /tmp/build/$OUT.zip functions --exclude @.funcignore --exclude .funcignore && mv /tmp/build/$OUT.zip .", + "pack": "mkdir -p /tmp/build && zip -q -r /tmp/build/$OUT.zip functions --exclude functions/@.funcignore --exclude functions/.funcignore && mv /tmp/build/$OUT.zip .", "coverage": "npm test -- --coverage", "coverage:ci": "npm config set script-shell=/bin/bash && npm run build-common && npm test -- --coverage", "dependency-cruiser-graphical": "current_time=$(date +'%Y-%m-%d_%H%M') && npx depcruise --output-type dot --do-not-follow '^node_modules($|/)' functions/attorneys case-assignments case-docket case-history case-summary cases consolidations healthcheck offices orders orders-manual-sync orders-sync ../lib | dot -T svg > ../../docs/architecture/dependency-cruiser/functions/dependency-graph_api_${current_time}.svg", From d23584f56077b8a2c769656ce73b2a4439926241 Mon Sep 17 00:00:00 2001 From: Arthur Morrow Date: Fri, 6 Dec 2024 17:47:50 -0500 Subject: [PATCH 06/49] separate durable function and workflow accomodations refactor to create separate functionApps for durable and non durable functions, updated workflows and scripts to accomodate for the addition Jira ticket: CAMS-461 Co-authored-by: Fritz Madden <96319835+fmaddenflx@users.noreply.github.com> Co-authored-by: Arthur Morrow <133667008+amorrow-flexion@users.noreply.github.com> Co-authored-by: James Brooks <12275865+jamesobrooks@users.noreply.github.com> Co-authored-by: Brian Posey <15091170+btposey@users.noreply.github.com>, --- .github/workflows/continuous-deployment.yml | 19 ++- .github/workflows/reusable-backend-slot.yml | 14 +- .github/workflows/reusable-build-info.yml | 25 +-- .../workflows/reusable-database-deploy.yml | 7 +- .github/workflows/reusable-e2e.yml | 8 +- .github/workflows/reusable-endpoint-test.yml | 6 +- .github/workflows/reusable-frontend-slot.yml | 4 +- .github/workflows/sub-build.yml | 25 ++- .github/workflows/sub-deploy-code-slot.yml | 124 +++++++++++--- .github/workflows/sub-deploy-code.yml | 59 +++++-- .../workflows/sub-deploy-slot-resources.yml | 10 +- .github/workflows/sub-deploy.yml | 15 +- .gitignore | 3 + backend/functions/{ => api}/.funcignore | 0 .../attorneys/attorneys.function.test.ts | 16 +- .../{ => api}/attorneys/attorneys.function.ts | 8 +- .../case.assignment.function.test.ts | 20 +-- .../case.assignment.function.ts | 8 +- .../case-associated.function.test.ts | 12 +- .../case-associated.function.ts | 8 +- .../case-docket/case-docket.function.test.ts | 14 +- .../case-docket/case-docket.function.ts | 8 +- .../case-history.function.test.ts | 18 +-- .../case-history/case-history.function.ts | 8 +- .../case-summary.function.test.ts | 14 +- .../case-summary/case-summary.function.ts | 8 +- .../{ => api}/cases/cases.function.test.ts | 19 ++- .../{ => api}/cases/cases.function.ts | 8 +- .../consolidations.function.test.ts | 14 +- .../consolidations/consolidations.function.ts | 8 +- .../{ => api}/courts/courts.function.test.ts | 10 +- .../{ => api}/courts/courts.function.ts | 6 +- .../healthcheck/healthcheck.db.cosmos.test.ts | 8 +- .../healthcheck/healthcheck.db.cosmos.ts | 10 +- .../healthcheck/healthcheck.db.sql.ts | 4 +- .../healthcheck/healthcheck.function.ts | 12 +- .../{ => api}/healthcheck/healthcheck.info.ts | 2 +- .../{ => api}/healthcheck/healthcheck.test.ts | 4 +- backend/functions/api/host.json | 25 +++ .../{ => api}/me/me.function.test.ts | 14 +- backend/functions/{ => api}/me/me.function.ts | 6 +- .../{ => api}/oauth2/mock-oauth2.function.ts | 8 +- .../office-staff-sync.function.test.ts | 8 +- .../office-staff-sync.function.ts | 8 +- .../offices/offices.function.test.ts | 12 +- .../{ => api}/offices/offices.function.ts | 6 +- .../orders-manual-sync.function.test.ts | 13 +- .../orders-manual-sync.function.ts | 8 +- .../orders-suggestions.function.test.ts | 12 +- .../orders-suggestions.function.ts | 8 +- .../orders-sync/orders-sync.function.test.ts | 10 +- .../orders-sync/orders-sync.function.ts | 8 +- .../{ => api}/orders/orders.function.test.ts | 16 +- .../{ => api}/orders/orders.function.ts | 8 +- backend/functions/api/package-lock.json | 105 ++++++++++++ backend/functions/api/package.json | 10 ++ backend/functions/api/tsconfig.build.json | 7 + backend/functions/migration/.funcignore | 15 ++ backend/functions/{ => migration}/host.json | 0 backend/functions/migration/package-lock.json | 105 ++++++++++++ backend/functions/migration/package.json | 10 ++ .../functions/migration/tsconfig.build.json | 7 + backend/lib/load-env.ts | 8 + backend/package.json | 18 ++- backend/tsconfig.build.json | 5 +- ops/cloud-deployment/backend-api-deploy.bicep | 153 ++++++++++++++---- .../frontend-webapp-deploy.bicep | 6 +- .../lib/network/ustp-cams-network.bicep | 113 +++++++++---- ops/cloud-deployment/main.bicep | 43 +++-- ops/scripts/pipeline/azure-deploy.sh | 28 +++- ops/scripts/pipeline/endpoint-test.sh | 6 +- .../slots/az-slot-api-resource-deploy.sh | 62 ++++--- .../slots/az-slot-web-resource-deploy.sh | 6 +- .../utility/clean-install-all-projects.sh | 4 +- package.json | 10 +- 75 files changed, 1053 insertions(+), 404 deletions(-) rename backend/functions/{ => api}/.funcignore (100%) rename backend/functions/{ => api}/attorneys/attorneys.function.test.ts (78%) rename backend/functions/{ => api}/attorneys/attorneys.function.ts (75%) rename backend/functions/{ => api}/case-assignments/case.assignment.function.test.ts (85%) rename backend/functions/{ => api}/case-assignments/case.assignment.function.ts (75%) rename backend/functions/{ => api}/case-associated/case-associated.function.test.ts (77%) rename backend/functions/{ => api}/case-associated/case-associated.function.ts (74%) rename backend/functions/{ => api}/case-docket/case-docket.function.test.ts (73%) rename backend/functions/{ => api}/case-docket/case-docket.function.ts (77%) rename backend/functions/{ => api}/case-history/case-history.function.test.ts (74%) rename backend/functions/{ => api}/case-history/case-history.function.ts (75%) rename backend/functions/{ => api}/case-summary/case-summary.function.test.ts (79%) rename backend/functions/{ => api}/case-summary/case-summary.function.ts (75%) rename backend/functions/{ => api}/cases/cases.function.test.ts (72%) rename backend/functions/{ => api}/cases/cases.function.ts (76%) rename backend/functions/{ => api}/consolidations/consolidations.function.test.ts (87%) rename backend/functions/{ => api}/consolidations/consolidations.function.ts (76%) rename backend/functions/{ => api}/courts/courts.function.test.ts (79%) rename backend/functions/{ => api}/courts/courts.function.ts (80%) rename backend/functions/{ => api}/healthcheck/healthcheck.db.cosmos.test.ts (85%) rename backend/functions/{ => api}/healthcheck/healthcheck.db.cosmos.ts (87%) rename backend/functions/{ => api}/healthcheck/healthcheck.db.sql.ts (85%) rename backend/functions/{ => api}/healthcheck/healthcheck.function.ts (86%) rename backend/functions/{ => api}/healthcheck/healthcheck.info.ts (90%) rename backend/functions/{ => api}/healthcheck/healthcheck.test.ts (91%) create mode 100644 backend/functions/api/host.json rename backend/functions/{ => api}/me/me.function.test.ts (72%) rename backend/functions/{ => api}/me/me.function.ts (79%) rename backend/functions/{ => api}/oauth2/mock-oauth2.function.ts (73%) rename backend/functions/{ => api}/office-staff-sync/office-staff-sync.function.test.ts (79%) rename backend/functions/{ => api}/office-staff-sync/office-staff-sync.function.ts (72%) rename backend/functions/{ => api}/offices/offices.function.test.ts (81%) rename backend/functions/{ => api}/offices/offices.function.ts (81%) rename backend/functions/{ => api}/orders-manual-sync/orders-manual-sync.function.test.ts (81%) rename backend/functions/{ => api}/orders-manual-sync/orders-manual-sync.function.ts (82%) rename backend/functions/{ => api}/orders-suggestions/orders-suggestions.function.test.ts (79%) rename backend/functions/{ => api}/orders-suggestions/orders-suggestions.function.ts (76%) rename backend/functions/{ => api}/orders-sync/orders-sync.function.test.ts (81%) rename backend/functions/{ => api}/orders-sync/orders-sync.function.ts (72%) rename backend/functions/{ => api}/orders/orders.function.test.ts (84%) rename backend/functions/{ => api}/orders/orders.function.ts (75%) create mode 100644 backend/functions/api/package-lock.json create mode 100644 backend/functions/api/package.json create mode 100644 backend/functions/api/tsconfig.build.json create mode 100644 backend/functions/migration/.funcignore rename backend/functions/{ => migration}/host.json (100%) create mode 100644 backend/functions/migration/package-lock.json create mode 100644 backend/functions/migration/package.json create mode 100644 backend/functions/migration/tsconfig.build.json create mode 100644 backend/lib/load-env.ts diff --git a/.github/workflows/continuous-deployment.yml b/.github/workflows/continuous-deployment.yml index a69c4415f..0673aa766 100644 --- a/.github/workflows/continuous-deployment.yml +++ b/.github/workflows/continuous-deployment.yml @@ -29,7 +29,9 @@ on: - "false" - "true" enableBicepDeployment: - description: "enableBicepDeployment: Execute main.bicep deployment for application component Azure resources" + description: + "enableBicepDeployment: Execute main.bicep deployment for application component Azure + resources" required: true default: "false" type: choice @@ -109,12 +111,13 @@ jobs: secrets: inherit # pragma: allowlist secret with: nodeVersion: ${{ vars.NODE_VERSION }} - apiName: ${{ needs.setup.outputs.apiName }} - camsServerHostname: ${{ needs.setup.outputs.apiName }}.azurewebsites${{ vars.AZ_HOSTNAME_SUFFIX }} + camsServerHostname: ${{ needs.setup.outputs.apiFunctionName }}.azurewebsites${{ vars.AZ_HOSTNAME_SUFFIX }} camsServerPort: ${{ vars.CAMS_SERVER_PORT }} camsServerProtocol: ${{ vars.CAMS_SERVER_PROTOCOL }} camsBasePath: ${{ vars.CAMS_BASE_PATH }} webappName: ${{ needs.setup.outputs.webappName }} + apiFunctionName: ${{ needs.setup.outputs.apiFunctionName }} + migrationFunctionName: ${{ needs.setup.outputs.migrationFunctionName }} environment: ${{ needs.setup.outputs.ghaEnvironment }} launchDarklyEnvironment: ${{ vars.CAMS_LAUNCH_DARKLY_ENV }} @@ -131,13 +134,16 @@ jobs: unit-test-backend, unit-test-common, ] - if: ((github.ref == 'refs/heads/main') || (github.ref == 'refs/heads/dependency-updates-auto') || (inputs.deployBranch == 'true')) + if: + ((github.ref == 'refs/heads/main') || (github.ref == 'refs/heads/dependency-updates-auto') || + (inputs.deployBranch == 'true')) with: ghaEnvironment: ${{ needs.setup.outputs.ghaEnvironment }} azResourceGrpAppEncrypted: ${{ needs.setup.outputs.azResourceGrpAppEncrypted }} azResourceGrpNetworkEncrypted: ${{ needs.setup.outputs.azResourceGrpNetworkEncrypted }} stackName: ${{ needs.setup.outputs.stackName }} - apiName: ${{ needs.setup.outputs.apiName }} + apiFunctionName: ${{ needs.setup.outputs.apiFunctionName }} + migrationFunctionName: ${{ needs.setup.outputs.migrationFunctionName }} webAppName: ${{ needs.setup.outputs.webappName }} environmentHash: ${{ needs.setup.outputs.environmentHash }} execVnetDeploy: ${{ needs.setup.outputs.execVnetDeploy }} @@ -154,7 +160,8 @@ jobs: ghaEnvironment: ${{ needs.setup.outputs.ghaEnvironment }} azResourceGrpAppEncrypted: ${{ needs.setup.outputs.azResourceGrpAppEncrypted }} stackName: ${{ needs.setup.outputs.stackName }} - apiName: ${{ needs.setup.outputs.apiName }} + apiFunctionName: ${{ needs.setup.outputs.apiFunctionName }} + migrationFunctionName: ${{ needs.setup.outputs.migrationFunctionName }} webAppName: ${{ needs.setup.outputs.webappName }} environmentHash: ${{ needs.setup.outputs.environmentHash }} slotName: ${{ needs.setup.outputs.slotName }} diff --git a/.github/workflows/reusable-backend-slot.yml b/.github/workflows/reusable-backend-slot.yml index c4c8cdd12..696a58a99 100644 --- a/.github/workflows/reusable-backend-slot.yml +++ b/.github/workflows/reusable-backend-slot.yml @@ -6,7 +6,10 @@ on: webAppName: required: true type: string - apiName: + apiFunctionName: + required: true + type: string + migrationFunctionName: required: true type: string ghaEnvironment: @@ -51,16 +54,19 @@ jobs: - name: Create API Slot Resource run: | - slotStorageAccountName=ustpslot${{ inputs.environmentHash }} + migrationSlotStorageAccountName=ustpslot${{ inputs.environmentHash }} + apiSlotStorageAccountName=migrationslot${{ inputs.environmentHash }} ./ops/scripts/pipeline/slots/az-slot-api-resource-deploy.sh \ --resourceGroup ${{ steps.rgApp.outputs.out }} \ --idResourceGroup ${{ secrets.AZURE_RG }} \ - --apiName ${{ inputs.apiName }} \ + --apiFunctionName ${{ inputs.apiFunctionName }} \ + --migrationFunctionName ${{ inputs.migrationFunctionName }} \ --webappName ${{ inputs.webappName }} \ --slotName ${{ inputs.slotName }} \ --kvIdName ${{ secrets.AZ_KV_APP_CONFIG_MANAGED_ID }} \ --sqlIdName ${{ secrets.AZ_SQL_IDENTITY_NAME }} \ - --storageAccName ${slotStorageAccountName:0:24} \ + --apiStorageAccName ${migrationSlotStorageAccountName:0:24} \ + --migrationStorageAccName ${apiSlotStorageAccountName:0:24} \ --databaseName ${{ secrets.AZ_COSMOS_DATABASE_NAME }} \ --infoSha ${{ inputs.environmentHash || 'DOES_NOT_EXIST' }} diff --git a/.github/workflows/reusable-build-info.yml b/.github/workflows/reusable-build-info.yml index 33fbb92e9..416438e0f 100644 --- a/.github/workflows/reusable-build-info.yml +++ b/.github/workflows/reusable-build-info.yml @@ -19,9 +19,9 @@ on: webappName: description: "Expected Web Application name [used for Azure Resource]" value: ${{ jobs.build-info.outputs.webappName }} - apiName: + apiFunctionName: description: "" - value: ${{ jobs.build-info.outputs.apiName }} + value: ${{ jobs.build-info.outputs.apiFunctionName }} azResourceGrpAppEncrypted: description: "" value: ${{ jobs.build-info.outputs.azResourceGrpAppEncrypted }} @@ -31,6 +31,9 @@ on: environmentHash: description: "" value: ${{ jobs.build-info.outputs.environmentHash }} + migrationFunctionName: + description: "" + value: ${{ jobs.build-info.outputs.migrationFunctionName }} slotName: description: "" value: ${{ jobs.build-info.outputs.slotName }} @@ -56,12 +59,13 @@ jobs: outputs: stackName: ${{ steps.build-info.outputs.stackName }} webappName: ${{ steps.build-info.outputs.webappName }} - apiName: ${{ steps.build-info.outputs.apiName }} + apiFunctionName: ${{ steps.build-info.outputs.apiFunctionName }} azResourceGrpAppEncrypted: ${{ steps.rgApp.outputs.out }} azResourceGrpNetworkEncrypted: ${{ steps.rgNetwork.outputs.out }} environmentHash: ${{ steps.check-env.outputs.environmentHash }} execVnetDeploy: ${{ steps.build-info.outputs.execVnetDeploy }} slotName: ${{ steps.build-info.outputs.slotName }} + migrationFunctionName: ${{ steps.build-info.outputs.migrationFunctionName }} deployBicep: ${{ steps.check-bicep.outputs.deployBicep }} initialDeployment: ${{ steps.check-initial-deployment.outputs.initialDeployment }} steps: @@ -101,9 +105,11 @@ jobs: stackName=$(ops/scripts/pipeline/generate-stackname.sh ${{ inputs.environment }} ${{ vars.APP_NAME }} ${{ vars.DEV_SUFFIX }} ${{ github.ref_name }}) echo "Stack Name: $stackName" webappName="${stackName}-webapp" - echo "Webapp Artifact: $webappName" - apiName="${stackName}-node-api" - echo "Api Artifact: $apiName" + echo "Webapp Name: $webappName" + apiFunctionName="${stackName}-node-api" + echo "Api Function Name: $apiFunctionName" + migrationFunctionName="${stackName}-migration" + echo "Migration Function Name: $migrationFunctionName" # Deployment flags echo "Bicep Deployment Flag: ${{ inputs.enableBicepDeployment == 'true' }}" @@ -115,7 +121,8 @@ jobs: echo "azResourceGrpNetwork=${{ secrets.AZ_NETWORK_RG }}${resourceGroupSuffix}" >> $GITHUB_OUTPUT echo "stackName=${stackName}" >> $GITHUB_OUTPUT echo "webappName=${webappName}" >> $GITHUB_OUTPUT - echo "apiName=${apiName}" >> $GITHUB_OUTPUT + echo "apiFunctionName=${apiFunctionName}" >> $GITHUB_OUTPUT + echo "migrationFunctionName=${migrationFunctionName}" >> $GITHUB_OUTPUT echo "execVnetDeploy=${execVnetDeploy}" >> $GITHUB_OUTPUT echo "slotName=${{ vars.SLOT_NAME }}" >> $GITHUB_OUTPUT @@ -140,10 +147,10 @@ jobs: op: decode in: ${{ steps.rgApp.outputs.out }} - - name: Check Initial Deployment + - name: Check Initial Deployment # update flag --apiName to --apiFunctionName id: check-initial-deployment run: | - initialDeployment=$(./ops/scripts/pipeline/check-for-environment.sh --resource-group ${{ steps.rgAppDecode.outputs.out }} --webappName ${{ steps.build-info.outputs.webappName }} --apiName ${{ steps.build-info.outputs.apiName }}) + initialDeployment=$(./ops/scripts/pipeline/check-for-environment.sh --resource-group ${{ steps.rgAppDecode.outputs.out }} --webappName ${{ steps.build-info.outputs.webappName }} --apiName ${{ steps.build-info.outputs.apiFunctionName }}) echo "initialDeployment=${initialDeployment}" >> $GITHUB_OUTPUT echo "Initial Deployment: ${initialDeployment}" diff --git a/.github/workflows/reusable-database-deploy.yml b/.github/workflows/reusable-database-deploy.yml index 97484d6c0..d90cedc64 100644 --- a/.github/workflows/reusable-database-deploy.yml +++ b/.github/workflows/reusable-database-deploy.yml @@ -9,7 +9,10 @@ on: azResourceGrpNetworkEncrypted: required: true type: string - apiName: + apiFunctionName: + required: true + type: string + migrationFunctionName: required: true type: string environmentHash: @@ -57,7 +60,7 @@ jobs: - name: Deploy Cosmos MongoDB id: azure-mongodb-deploy run: | - allowedNetworks=$(az network vnet subnet list -g ${{ steps.rgNetwork.outputs.out }} --vnet-name ${{ vars.AZ_NETWORK_VNET_NAME }} --query "[?name=='snet-${{ inputs.apiName }}'].id" -o json) + allowedNetworks=$(az network vnet subnet list -g ${{ steps.rgNetwork.outputs.out }} --vnet-name ${{ vars.AZ_NETWORK_VNET_NAME }} --query "[?name=='snet-${{ inputs.apiFunctionName }}' || name=='snet-${{inputs.migrationFunctionName}}'].id" -o json) ./ops/scripts/pipeline/az-cosmos-deploy.sh \ -g ${{ secrets.AZURE_RG }} \ diff --git a/.github/workflows/reusable-e2e.yml b/.github/workflows/reusable-e2e.yml index b8cf09533..4477c8ce9 100644 --- a/.github/workflows/reusable-e2e.yml +++ b/.github/workflows/reusable-e2e.yml @@ -3,7 +3,7 @@ name: End-to-end Tests on: workflow_call: inputs: - apiName: + apiFunctionName: required: true type: string slotName: @@ -75,13 +75,13 @@ jobs: fi echo "Seeding E2E CosmosDB..." - curl -v -d '{"txIdOverride": '0'}' -H "Content-Type: application/json" https://${{ inputs.apiName }}.azurewebsites${{ vars.AZ_HOSTNAME_SUFFIX }}/api/orders-sync?x-ms-routing-name=${{ inputs.slotName }} + curl -v -d '{"txIdOverride": '0'}' -H "Content-Type: application/json" https://${{ inputs.apiFunctionName }}.azurewebsites${{ vars.AZ_HOSTNAME_SUFFIX }}/api/orders-sync?x-ms-routing-name=${{ inputs.slotName }} - name: Restart API and Install Node dependencies working-directory: test/e2e run: | - az functionapp restart --name ${{ inputs.apiName }} --resource-group ${{ steps.rgApp.outputs.out }} & az webapp restart --name ${{ inputs.webappName }} --resource-group ${{ steps.rgApp.outputs.out }} - az functionapp restart --name ${{ inputs.apiName }} --resource-group ${{ steps.rgApp.outputs.out }} --slot staging & az webapp restart --name ${{ inputs.webappName }} --resource-group ${{ steps.rgApp.outputs.out }} --slot staging + az functionapp restart --name ${{ inputs.apiFunctionName }} --resource-group ${{ steps.rgApp.outputs.out }} & az webapp restart --name ${{ inputs.webappName }} --resource-group ${{ steps.rgApp.outputs.out }} + az functionapp restart --name ${{ inputs.apiFunctionName }} --resource-group ${{ steps.rgApp.outputs.out }} --slot staging & az webapp restart --name ${{ inputs.webappName }} --resource-group ${{ steps.rgApp.outputs.out }} --slot staging sleep 10 npm ci npx playwright install chromium msedge diff --git a/.github/workflows/reusable-endpoint-test.yml b/.github/workflows/reusable-endpoint-test.yml index 502f13d01..3eebf6842 100644 --- a/.github/workflows/reusable-endpoint-test.yml +++ b/.github/workflows/reusable-endpoint-test.yml @@ -3,7 +3,7 @@ name: Endpoint Tests on: workflow_call: inputs: - apiName: + apiFunctionName: required: true type: string slotName: @@ -33,7 +33,7 @@ jobs: env: stackName: ${{ inputs.stackName }} webappName: ${{ inputs.webappName }} - apiName: ${{ inputs.apiName }} + apiFunctionName: ${{ inputs.apiFunctionName }} branchHashId: ${{ inputs.branchHashId }} priority: 200 steps: @@ -62,7 +62,7 @@ jobs: - name: Health check App Resources run: | ./ops/scripts/pipeline/endpoint-test.sh \ - --apiName ${{ inputs.apiName }} \ + --apiFunctionName ${{ inputs.apiFunctionName }} \ --webappName ${{ inputs.webappName }} \ --hostSuffix ${{ vars.AZ_HOSTNAME_SUFFIX }} \ --gitSha ${{ github.sha }} \ diff --git a/.github/workflows/reusable-frontend-slot.yml b/.github/workflows/reusable-frontend-slot.yml index a857b533c..e9d84dcdb 100644 --- a/.github/workflows/reusable-frontend-slot.yml +++ b/.github/workflows/reusable-frontend-slot.yml @@ -6,7 +6,7 @@ on: webAppName: required: true type: string - apiName: + apiFunctionName: required: true type: string ghaEnvironment: @@ -51,7 +51,7 @@ jobs: ./ops/scripts/pipeline/slots/az-slot-web-resource-deploy.sh \ --resourceGroup ${{ steps.rgApp.outputs.out }} \ --webappName ${{ inputs.webappName }} \ - --apiName ${{ inputs.apiName }} \ + --apiFunctionName ${{ inputs.apiFunctionName }} \ --slotName ${{ inputs.slotName }} \ --subscription ${{ secrets.AZURE_SUBSCRIPTION }} \ --network-rg ${{ steps.rgNetwork.outputs.out }} \ diff --git a/.github/workflows/sub-build.yml b/.github/workflows/sub-build.yml index 88151447a..3d9e0d5fd 100644 --- a/.github/workflows/sub-build.yml +++ b/.github/workflows/sub-build.yml @@ -6,7 +6,10 @@ on: nodeVersion: required: true type: string - apiName: + apiFunctionName: + required: true + type: string + migrationFunctionName: required: true type: string camsServerHostname: @@ -100,12 +103,22 @@ jobs: npm ci npm run build - - name: Package Application - run: OUT=${{ inputs.apiName }} npm run pack + - name: Package API + run: OUT=${{ inputs.apiFunctionName }} npm run pack + + - name: Package Migration + run: OUT=${{ inputs.migrationFunctionName }} npm run pack:migration + + - name: Upload API Azure Functions Artifact + uses: actions/upload-artifact@v4.4.0 + with: + name: ${{ inputs.apiFunctionName }}-build + path: backend/api/${{ inputs.apiFunctionName }}.zip + if-no-files-found: error - - name: Upload Node Azure Functions Artifact + - name: Upload Migration Azure Functions Artifact uses: actions/upload-artifact@v4.4.0 with: - name: ${{ inputs.apiName }}-build - path: backend/${{ inputs.apiName }}.zip + name: ${{ inputs.migrationFunctionName }}-build + path: backend/migration/${{ inputs.migrationFunctionName }}.zip if-no-files-found: error diff --git a/.github/workflows/sub-deploy-code-slot.yml b/.github/workflows/sub-deploy-code-slot.yml index 1041d44f6..95398a632 100644 --- a/.github/workflows/sub-deploy-code-slot.yml +++ b/.github/workflows/sub-deploy-code-slot.yml @@ -15,7 +15,10 @@ on: webappName: required: true type: string - apiName: + apiFunctionName: + required: true + type: string + migrationFunctionName: required: true type: string azResourceGrpAppEncrypted: @@ -40,8 +43,9 @@ jobs: ghaEnvironment: ${{ inputs.ghaEnvironment }} environmentHash: ${{ inputs.environmentHash }} stackName: ${{ inputs.stackName }} - webAppName: ${{ inputs.webappName }} - apiName: ${{ inputs.apiName }} + webappName: ${{ inputs.webappName }} + apiFunctionName: ${{ inputs.apiFunctionName }} + migrationFunctionName: ${{ inputs.migrationFunctionName }} azResourceGrpAppEncrypted: ${{ inputs.azResourceGrpAppEncrypted }} secrets: inherit # pragma: allowlist secret @@ -77,7 +81,7 @@ jobs: -n ${{ inputs.webappName }} \ --slotName ${{ inputs.slotName }} - deploy-service-slot: + deploy-api-slot: runs-on: ubuntu-latest environment: ${{ inputs.ghaEnvironment }} steps: @@ -86,7 +90,7 @@ jobs: - name: Download artifact from build job uses: actions/download-artifact@v4.1.7 with: - name: ${{ inputs.apiName }}-build + name: ${{ inputs.apiFunctionName }}-build - uses: azure/login@v1 with: @@ -100,22 +104,54 @@ jobs: op: decode in: ${{ inputs.azResourceGrpAppEncrypted }} - - name: Deploy Azure Functions slot backend - id: deploy-backend-slot-step + - name: Deploy Azure Function API slot + id: deploy-api-slot-step run: | ./ops/scripts/pipeline/slots/az-func-slot-deploy.sh \ -g ${{ steps.rgApp.outputs.out }} \ - -n ${{ inputs.apiName }} \ - --src ./${{ inputs.apiName }}.zip \ + -n ${{ inputs.apiFunctionName }} \ + --src ./${{ inputs.apiFunctionName }}.zip \ + --slotName ${{ inputs.slotName }} + + deploy-migration-slot: + runs-on: ubuntu-latest + environment: ${{ inputs.ghaEnvironment }} + steps: + - uses: actions/checkout@main + + - name: Download artifact from build job + uses: actions/download-artifact@v4.1.7 + with: + name: ${{ inputs.migrationFunctionName }}-build + + - uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + environment: ${{ vars.AZURE_ENVIRONMENT }} + + - uses: cloudposse/github-action-secret-outputs@main + id: rgApp + with: + secret: ${{ secrets.PGP_SIGNING_PASSPHRASE }} + op: decode + in: ${{ inputs.azResourceGrpAppEncrypted }} + + - name: Deploy Azure Function Migration slot + id: deploy-migration-slot-step + run: | + ./ops/scripts/pipeline/slots/az-func-slot-deploy.sh \ + -g ${{ steps.rgApp.outputs.out }} \ + -n ${{ inputs.migrationFunctionName }} \ + --src ./${{ inputs.migrationFunctionName }}.zip \ --slotName ${{ inputs.slotName }} endpoint-test-application-slot: - needs: [deploy-webapp-slot, deploy-service-slot] + needs: [deploy-webapp-slot, deploy-api-slot, deploy-migration-slot] uses: ./.github/workflows/reusable-endpoint-test.yml with: stackName: ${{ inputs.stackName }} webappName: ${{ inputs.webappName }} - apiName: ${{ inputs.apiName }} + apiFunctionName: ${{ inputs.apiFunctionName }} branchHashId: ${{ inputs.environmentHash }} ghaEnvironment: ${{ inputs.ghaEnvironment }} azResourceGrpAppEncrypted: ${{ inputs.azResourceGrpAppEncrypted }} @@ -124,10 +160,15 @@ jobs: execute-e2e-test: needs: - [deploy-webapp-slot, deploy-service-slot, endpoint-test-application-slot] + [ + deploy-webapp-slot, + deploy-api-slot, + deploy-migration-slot, + endpoint-test-application-slot, + ] uses: ./.github/workflows/reusable-e2e.yml with: - apiName: ${{ inputs.apiName }} + apiFunctionName: ${{ inputs.apiFunctionName }} slotName: ${{ inputs.slotName }} webappName: ${{ inputs.webappName }} stackName: ${{ inputs.stackName }} @@ -140,7 +181,13 @@ jobs: swap-webapp-deployment-slot: if: ${{ inputs.initialDeployment != 'true' }} runs-on: ubuntu-latest - needs: [deploy-webapp-slot, deploy-service-slot, execute-e2e-test] + needs: + [ + deploy-webapp-slot, + deploy-api-slot, + deploy-migration-slot, + execute-e2e-test, + ] environment: ${{ inputs.ghaEnvironment }} env: webappName: ${{ inputs.webappName }} @@ -164,10 +211,45 @@ jobs: swap-nodeapi-deployment-slot: if: ${{ inputs.initialDeployment != 'true' }} runs-on: ubuntu-latest - needs: [deploy-webapp-slot, deploy-service-slot, execute-e2e-test] + needs: + [ + deploy-webapp-slot, + deploy-api-slot, + deploy-migration-slot, + execute-e2e-test, + ] + environment: ${{ inputs.ghaEnvironment }} + env: + apiFunctionName: ${{ inputs.apiFunctionName }} + slotName: ${{ inputs.slotName }} + steps: + - uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + environment: ${{ vars.AZURE_ENVIRONMENT }} + - uses: cloudposse/github-action-secret-outputs@main + id: rgApp + with: + secret: ${{ secrets.PGP_SIGNING_PASSPHRASE }} + op: decode + in: ${{ inputs.azResourceGrpAppEncrypted }} + - name: Swap Deployment Slot + run: | + az functionapp deployment slot swap --slot ${{ env.slotName }} --name ${{ env.apiFunctionName }} -g ${{ steps.rgApp.outputs.out }} + az webapp traffic-routing clear --name ${{ env.apiFunctionName }} -g ${{ steps.rgApp.outputs.out }} + + swap-migration-app-deployment-slot: + if: ${{ inputs.initialDeployment != 'true' }} + runs-on: ubuntu-latest + needs: + [ + deploy-webapp-slot, + deploy-api-slot, + deploy-migration-slot, + execute-e2e-test, + ] environment: ${{ inputs.ghaEnvironment }} env: - apiName: ${{ inputs.apiName }} slotName: ${{ inputs.slotName }} steps: - uses: azure/login@v1 @@ -182,8 +264,8 @@ jobs: in: ${{ inputs.azResourceGrpAppEncrypted }} - name: Swap Deployment Slot run: | - az functionapp deployment slot swap --slot ${{ env.slotName }} --name ${{ env.apiName }} -g ${{ steps.rgApp.outputs.out }} - az webapp traffic-routing clear --name ${{ env.apiName }} -g ${{ steps.rgApp.outputs.out }} + az functionapp deployment slot swap --slot ${{ env.slotName }} --name ${{ inputs.migrationFunctionName }} -g ${{ steps.rgApp.outputs.out }} + az webapp traffic-routing clear --name ${{ inputs.migrationFunctionName }} -g ${{ steps.rgApp.outputs.out }} endpoint-test-application-post-swap: needs: [swap-nodeapi-deployment-slot, swap-webapp-deployment-slot] @@ -191,7 +273,7 @@ jobs: with: stackName: ${{ inputs.stackName }} webappName: ${{ inputs.webappName }} - apiName: ${{ inputs.apiName }} + apiFunctionName: ${{ inputs.apiFunctionName }} branchHashId: ${{ inputs.environmentHash }} ghaEnvironment: ${{ inputs.ghaEnvironment }} azResourceGrpAppEncrypted: ${{ inputs.azResourceGrpAppEncrypted }} @@ -204,7 +286,7 @@ jobs: environment: ${{ inputs.ghaEnvironment }} env: webappName: ${{ inputs.webappName }} - apiName: ${{ inputs.apiName }} + apiFunctionName: ${{ inputs.apiFunctionName }} steps: - uses: azure/login@v1 with: @@ -221,4 +303,4 @@ jobs: - name: Enable production slot access run: | az webapp config access-restriction add --resource-group ${{ steps.rgApp.outputs.out }} --name ${{ env.webappName }} --rule-name AllowAll --action Allow --ip-address 0.0.0.0/0 --priority 100 1>/dev/null || true - az functionapp config access-restriction add --resource-group ${{ steps.rgApp.outputs.out }} --name ${{ env.apiName }} --rule-name AllowAll --action Allow --ip-address 0.0.0.0/0 --priority 100 1>/dev/null || true + az functionapp config access-restriction add --resource-group ${{ steps.rgApp.outputs.out }} --name ${{ env.apiFunctionName }} --rule-name AllowAll --action Allow --ip-address 0.0.0.0/0 --priority 100 1>/dev/null || true diff --git a/.github/workflows/sub-deploy-code.yml b/.github/workflows/sub-deploy-code.yml index 7befe872a..d0dbc8071 100644 --- a/.github/workflows/sub-deploy-code.yml +++ b/.github/workflows/sub-deploy-code.yml @@ -15,7 +15,10 @@ on: webappName: required: true type: string - apiName: + apiFunctionName: + required: true + type: string + migrationFunctionName: required: true type: string azResourceGrpAppEncrypted: @@ -54,7 +57,39 @@ jobs: -g ${{ steps.rgApp.outputs.out }} \ -n ${{ inputs.webappName }} - deploy-service: + deploy-api: + runs-on: ubuntu-latest + environment: ${{ inputs.ghaEnvironment }} + steps: + - uses: actions/checkout@main + + - name: Download artifact from build job + uses: actions/download-artifact@v4.1.7 + with: + name: ${{ inputs.apiFunctionName }}-build + + - uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + environment: ${{ vars.AZURE_ENVIRONMENT }} + + - uses: cloudposse/github-action-secret-outputs@main + id: rgApp + with: + secret: ${{ secrets.PGP_SIGNING_PASSPHRASE }} + op: decode + in: ${{ inputs.azResourceGrpAppEncrypted }} + + - name: Deploy Azure Functions API + id: deploy-backend-api-step + run: | + sleep 30 && + ./ops/scripts/pipeline/az-func-deploy.sh \ + -g ${{ steps.rgApp.outputs.out }} \ + -n ${{ inputs.apiFunctionName }} \ + --src ./${{ inputs.apiFunctionName }}.zip + + deploy-migration-app: runs-on: ubuntu-latest environment: ${{ inputs.ghaEnvironment }} steps: @@ -63,7 +98,7 @@ jobs: - name: Download artifact from build job uses: actions/download-artifact@v4.1.7 with: - name: ${{ inputs.apiName }}-build + name: ${{ inputs.migrationFunctionName }}-build - uses: azure/login@v1 with: @@ -77,22 +112,22 @@ jobs: op: decode in: ${{ inputs.azResourceGrpAppEncrypted }} - - name: Deploy Azure Functions backend - id: deploy-backend-step + - name: Deploy Azure Function Migration App + id: deploy-migration-app-step run: | sleep 30 && ./ops/scripts/pipeline/az-func-deploy.sh \ -g ${{ steps.rgApp.outputs.out }} \ - -n ${{ inputs.apiName }} \ - --src ./${{ inputs.apiName }}.zip + -n ${{ inputs.migrationFunctionName }} \ + --src ./${{ inputs.migrationFunctionName }}.zip - endpoint-test-application: - needs: [deploy-webapp, deploy-service] + endpoint-test-application: # TODO: healthcheck/endpoint test on new migration function app? + needs: [deploy-webapp, deploy-api] uses: ./.github/workflows/reusable-endpoint-test.yml with: stackName: ${{ inputs.stackName }} webappName: ${{ inputs.webappName }} - apiName: ${{ inputs.apiName }} + apiFunctionName: ${{ inputs.apiFunctionName }} branchHashId: ${{ inputs.environmentHash }} ghaEnvironment: ${{ inputs.ghaEnvironment }} azResourceGrpAppEncrypted: ${{ inputs.azResourceGrpAppEncrypted }} @@ -105,7 +140,7 @@ jobs: environment: ${{ inputs.ghaEnvironment }} env: webappName: ${{ inputs.webappName }} - apiName: ${{ inputs.apiName }} + apiFunctionName: ${{ inputs.apiFunctionName }} steps: - uses: azure/login@v1 with: @@ -122,4 +157,4 @@ jobs: - name: Enable production slot access run: | az webapp config access-restriction add --resource-group ${{ steps.rgApp.outputs.out }} --name ${{ env.webappName }} --rule-name AllowAll --action Allow --ip-address 0.0.0.0/0 --priority 100 1>/dev/null || true - az functionapp config access-restriction add --resource-group ${{ steps.rgApp.outputs.out }} --name ${{ env.apiName }} --rule-name AllowAll --action Allow --ip-address 0.0.0.0/0 --priority 100 1>/dev/null || true + az functionapp config access-restriction add --resource-group ${{ steps.rgApp.outputs.out }} --name ${{ env.apiFunctionName }} --rule-name AllowAll --action Allow --ip-address 0.0.0.0/0 --priority 100 1>/dev/null || true diff --git a/.github/workflows/sub-deploy-slot-resources.yml b/.github/workflows/sub-deploy-slot-resources.yml index fe4272ec4..026fcaeea 100644 --- a/.github/workflows/sub-deploy-slot-resources.yml +++ b/.github/workflows/sub-deploy-slot-resources.yml @@ -6,7 +6,10 @@ on: webAppName: required: true type: string - apiName: + apiFunctionName: + required: true + type: string + migrationFunctionName: required: true type: string ghaEnvironment: @@ -29,7 +32,7 @@ jobs: uses: ./.github/workflows/reusable-frontend-slot.yml with: webAppName: ${{ inputs.webAppName }} - apiName: ${{ inputs.apiName }} + apiFunctionName: ${{ inputs.apiFunctionName }} ghaEnvironment: ${{ inputs.ghaEnvironment }} azResourceGrpAppEncrypted: ${{ inputs.azResourceGrpAppEncrypted }} azResourceGrpNetworkEncrypted: ${{ inputs.azResourceGrpNetworkEncrypted }} @@ -40,7 +43,8 @@ jobs: uses: ./.github/workflows/reusable-backend-slot.yml with: webAppName: ${{ inputs.webAppName }} - apiName: ${{ inputs.apiName }} + apiFunctionName: ${{ inputs.apiFunctionName }} + migrationFunctionName: ${{ inputs.migrationFunctionName }} ghaEnvironment: ${{ inputs.ghaEnvironment }} azResourceGrpAppEncrypted: ${{ inputs.azResourceGrpAppEncrypted }} azResourceGrpNetworkEncrypted: ${{ inputs.azResourceGrpNetworkEncrypted }} diff --git a/.github/workflows/sub-deploy.yml b/.github/workflows/sub-deploy.yml index fbe55bcf2..c566d2a33 100644 --- a/.github/workflows/sub-deploy.yml +++ b/.github/workflows/sub-deploy.yml @@ -15,7 +15,10 @@ on: stackName: required: true type: string - apiName: + apiFunctionName: + required: true + type: string + migrationFunctionName: required: true type: string webAppName: @@ -45,7 +48,9 @@ jobs: deploy-infra: name: Azure Infrastructure uses: ./.github/workflows/reusable-deploy.yml - if: ((github.ref == 'refs/heads/main') || (inputs.deployBranch == 'true')) && ${{ inputs.deployBicep == 'true' }} + if: + ((github.ref == 'refs/heads/main') || (inputs.deployBranch == 'true')) && ${{ + inputs.deployBicep == 'true' }} with: ghaEnvironment: ${{ inputs.ghaEnvironment }} azResourceGrpAppEncrypted: ${{ inputs.azResourceGrpAppEncrypted }} @@ -66,7 +71,8 @@ jobs: ghaEnvironment: ${{ inputs.ghaEnvironment }} azResourceGrpNetworkEncrypted: ${{ inputs.azResourceGrpNetworkEncrypted }} environmentHash: ${{ inputs.environmentHash }} - apiName: ${{ inputs.apiName }} + apiFunctionName: ${{ inputs.apiFunctionName }} + migrationFunctionName: ${{ inputs.migrationFunctionName }} secrets: inherit # pragma: allowlist secret deploy-slot-resources: @@ -76,7 +82,8 @@ jobs: if: ((github.ref == 'refs/heads/main') || (inputs.deployBranch == 'true')) with: webAppName: ${{ inputs.webappName }} - apiName: ${{ inputs.apiName }} + apiFunctionName: ${{ inputs.apiFunctionName }} + migrationFunctionName: ${{ inputs.migrationFunctionName }} ghaEnvironment: ${{ inputs.ghaEnvironment }} azResourceGrpAppEncrypted: ${{ inputs.azResourceGrpAppEncrypted }} azResourceGrpNetworkEncrypted: ${{ inputs.azResourceGrpNetworkEncrypted }} diff --git a/.gitignore b/.gitignore index 98d9ac132..bebb0bbf8 100644 --- a/.gitignore +++ b/.gitignore @@ -75,6 +75,9 @@ cams1.code-workspace # Node **/node_modules/ +# Dist +**/dist/ + # Veracode **/pipeline-scan* diff --git a/backend/functions/.funcignore b/backend/functions/api/.funcignore similarity index 100% rename from backend/functions/.funcignore rename to backend/functions/api/.funcignore diff --git a/backend/functions/attorneys/attorneys.function.test.ts b/backend/functions/api/attorneys/attorneys.function.test.ts similarity index 78% rename from backend/functions/attorneys/attorneys.function.test.ts rename to backend/functions/api/attorneys/attorneys.function.test.ts index 18db41b8e..897502717 100644 --- a/backend/functions/attorneys/attorneys.function.test.ts +++ b/backend/functions/api/attorneys/attorneys.function.test.ts @@ -1,17 +1,17 @@ -import { AttorneysController } from '../../lib/controllers/attorneys/attorneys.controller'; -import { CamsError } from '../../lib/common-errors/cams-error'; -import { MockData } from '../../../common/src/cams/test-utilities/mock-data'; +import { AttorneysController } from '../../../lib/controllers/attorneys/attorneys.controller'; +import { CamsError } from '../../../lib/common-errors/cams-error'; +import { MockData } from '../../../../common/src/cams/test-utilities/mock-data'; import { buildTestResponseError, buildTestResponseSuccess, createMockAzureFunctionRequest, -} from '../azure/testing-helpers'; -import AttorneyList from '../../lib/use-cases/attorneys'; +} from '../../azure/testing-helpers'; +import AttorneyList from '../../../lib/use-cases/attorneys'; import handler from './attorneys.function'; import { InvocationContext } from '@azure/functions'; -import { ResponseBody } from '../../../common/src/api/response'; -import { AttorneyUser } from '../../../common/src/cams/users'; -import ContextCreator from '../azure/application-context-creator'; +import { ResponseBody } from '../../../../common/src/api/response'; +import { AttorneyUser } from '../../../../common/src/cams/users'; +import ContextCreator from '../../azure/application-context-creator'; describe('Attorneys Azure Function tests', () => { const request = createMockAzureFunctionRequest(); diff --git a/backend/functions/attorneys/attorneys.function.ts b/backend/functions/api/attorneys/attorneys.function.ts similarity index 75% rename from backend/functions/attorneys/attorneys.function.ts rename to backend/functions/api/attorneys/attorneys.function.ts index f481f02d3..c69188491 100644 --- a/backend/functions/attorneys/attorneys.function.ts +++ b/backend/functions/api/attorneys/attorneys.function.ts @@ -1,9 +1,9 @@ import * as dotenv from 'dotenv'; import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions'; -import { AttorneysController } from '../../lib/controllers/attorneys/attorneys.controller'; -import { initializeApplicationInsights } from '../azure/app-insights'; -import { toAzureError, toAzureSuccess } from '../azure/functions'; -import ContextCreator from '../azure/application-context-creator'; +import { AttorneysController } from '../../../lib/controllers/attorneys/attorneys.controller'; +import { initializeApplicationInsights } from '../../azure/app-insights'; +import { toAzureError, toAzureSuccess } from '../../azure/functions'; +import ContextCreator from '../../azure/application-context-creator'; dotenv.config(); diff --git a/backend/functions/case-assignments/case.assignment.function.test.ts b/backend/functions/api/case-assignments/case.assignment.function.test.ts similarity index 85% rename from backend/functions/case-assignments/case.assignment.function.test.ts rename to backend/functions/api/case-assignments/case.assignment.function.test.ts index 2f9d787a8..c51997169 100644 --- a/backend/functions/case-assignments/case.assignment.function.test.ts +++ b/backend/functions/api/case-assignments/case.assignment.function.test.ts @@ -1,19 +1,19 @@ import handler from './case.assignment.function'; -import { CaseAssignmentController } from '../../lib/controllers/case-assignment/case.assignment.controller'; -import ContextCreator from '../azure/application-context-creator'; -import { CaseAssignment } from '../../../common/src/cams/assignments'; -import { MockData } from '../../../common/src/cams/test-utilities/mock-data'; -import { CamsHttpRequest } from '../../lib/adapters/types/http'; +import { CaseAssignmentController } from '../../../lib/controllers/case-assignment/case.assignment.controller'; +import ContextCreator from '../../azure/application-context-creator'; +import { CaseAssignment } from '../../../../common/src/cams/assignments'; +import { MockData } from '../../../../common/src/cams/test-utilities/mock-data'; +import { CamsHttpRequest } from '../../../lib/adapters/types/http'; import { InvocationContext } from '@azure/functions'; -import { createMockApplicationContext } from '../../lib/testing/testing-utilities'; +import { createMockApplicationContext } from '../../../lib/testing/testing-utilities'; import { buildTestResponseError, buildTestResponseSuccess, createMockAzureFunctionRequest, -} from '../azure/testing-helpers'; -import { CamsError } from '../../lib/common-errors/cams-error'; -import { UnknownError } from '../../lib/common-errors/unknown-error'; -import HttpStatusCodes from '../../../common/src/api/http-status-codes'; +} from '../../azure/testing-helpers'; +import { CamsError } from '../../../lib/common-errors/cams-error'; +import { UnknownError } from '../../../lib/common-errors/unknown-error'; +import HttpStatusCodes from '../../../../common/src/api/http-status-codes'; describe('Case Assignment Function Tests', () => { const defaultRequestProps: Partial = { diff --git a/backend/functions/case-assignments/case.assignment.function.ts b/backend/functions/api/case-assignments/case.assignment.function.ts similarity index 75% rename from backend/functions/case-assignments/case.assignment.function.ts rename to backend/functions/api/case-assignments/case.assignment.function.ts index 7b74817a3..7977d3a43 100644 --- a/backend/functions/case-assignments/case.assignment.function.ts +++ b/backend/functions/api/case-assignments/case.assignment.function.ts @@ -1,8 +1,8 @@ import { app, InvocationContext, HttpRequest, HttpResponseInit } from '@azure/functions'; -import { CaseAssignmentController } from '../../lib/controllers/case-assignment/case.assignment.controller'; -import ContextCreator from '../azure/application-context-creator'; -import { initializeApplicationInsights } from '../azure/app-insights'; -import { toAzureError, toAzureSuccess } from '../azure/functions'; +import { CaseAssignmentController } from '../../../lib/controllers/case-assignment/case.assignment.controller'; +import ContextCreator from '../../azure/application-context-creator'; +import { initializeApplicationInsights } from '../../azure/app-insights'; +import { toAzureError, toAzureSuccess } from '../../azure/functions'; const MODULE_NAME = 'CASE-ASSIGNMENT-FUNCTION'; diff --git a/backend/functions/case-associated/case-associated.function.test.ts b/backend/functions/api/case-associated/case-associated.function.test.ts similarity index 77% rename from backend/functions/case-associated/case-associated.function.test.ts rename to backend/functions/api/case-associated/case-associated.function.test.ts index ef6990542..29d4a02df 100644 --- a/backend/functions/case-associated/case-associated.function.test.ts +++ b/backend/functions/api/case-associated/case-associated.function.test.ts @@ -1,15 +1,15 @@ -import { NotFoundError } from '../../lib/common-errors/not-found-error'; -import { CaseAssociatedController } from '../../lib/controllers/case-associated/case-associated.controller'; +import { NotFoundError } from '../../../lib/common-errors/not-found-error'; +import { CaseAssociatedController } from '../../../lib/controllers/case-associated/case-associated.controller'; import handler from './case-associated.function'; -import ContextCreator from '../azure/application-context-creator'; -import MockData from '../../../common/src/cams/test-utilities/mock-data'; +import ContextCreator from '../../azure/application-context-creator'; +import MockData from '../../../../common/src/cams/test-utilities/mock-data'; import { InvocationContext } from '@azure/functions'; import { buildTestResponseError, buildTestResponseSuccess, createMockAzureFunctionRequest, -} from '../azure/testing-helpers'; -import { EventCaseReference } from '../../../common/src/cams/events'; +} from '../../azure/testing-helpers'; +import { EventCaseReference } from '../../../../common/src/cams/events'; describe('Case summary function', () => { jest diff --git a/backend/functions/case-associated/case-associated.function.ts b/backend/functions/api/case-associated/case-associated.function.ts similarity index 74% rename from backend/functions/case-associated/case-associated.function.ts rename to backend/functions/api/case-associated/case-associated.function.ts index 7ea3d55e0..5994d86b2 100644 --- a/backend/functions/case-associated/case-associated.function.ts +++ b/backend/functions/api/case-associated/case-associated.function.ts @@ -1,9 +1,9 @@ import * as dotenv from 'dotenv'; import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions'; -import ContextCreator from '../azure/application-context-creator'; -import { initializeApplicationInsights } from '../azure/app-insights'; -import { CaseAssociatedController } from '../../lib/controllers/case-associated/case-associated.controller'; -import { toAzureError, toAzureSuccess } from '../azure/functions'; +import ContextCreator from '../../azure/application-context-creator'; +import { initializeApplicationInsights } from '../../azure/app-insights'; +import { CaseAssociatedController } from '../../../lib/controllers/case-associated/case-associated.controller'; +import { toAzureError, toAzureSuccess } from '../../azure/functions'; dotenv.config(); diff --git a/backend/functions/case-docket/case-docket.function.test.ts b/backend/functions/api/case-docket/case-docket.function.test.ts similarity index 73% rename from backend/functions/case-docket/case-docket.function.test.ts rename to backend/functions/api/case-docket/case-docket.function.test.ts index c4154f65c..9bd996781 100644 --- a/backend/functions/case-docket/case-docket.function.test.ts +++ b/backend/functions/api/case-docket/case-docket.function.test.ts @@ -1,16 +1,16 @@ import handler from './case-docket.function'; -import { DXTR_CASE_DOCKET_ENTRIES } from '../../lib/testing/mock-data/case-docket-entries.mock'; -import { NORMAL_CASE_ID, NOT_FOUND_ERROR_CASE_ID } from '../../lib/testing/testing-constants'; +import { DXTR_CASE_DOCKET_ENTRIES } from '../../../lib/testing/mock-data/case-docket-entries.mock'; +import { NORMAL_CASE_ID, NOT_FOUND_ERROR_CASE_ID } from '../../../lib/testing/testing-constants'; import { InvocationContext } from '@azure/functions'; -import { CamsHttpRequest } from '../../lib/adapters/types/http'; +import { CamsHttpRequest } from '../../../lib/adapters/types/http'; import { buildTestResponseError, buildTestResponseSuccess, createMockAzureFunctionRequest, -} from '../azure/testing-helpers'; -import { CaseDocketController } from '../../lib/controllers/case-docket/case-docket.controller'; -import { NotFoundError } from '../../lib/common-errors/not-found-error'; -import { CaseDocket } from '../../../common/src/cams/cases'; +} from '../../azure/testing-helpers'; +import { CaseDocketController } from '../../../lib/controllers/case-docket/case-docket.controller'; +import { NotFoundError } from '../../../lib/common-errors/not-found-error'; +import { CaseDocket } from '../../../../common/src/cams/cases'; describe('Case docket function', () => { const context = new InvocationContext({ diff --git a/backend/functions/case-docket/case-docket.function.ts b/backend/functions/api/case-docket/case-docket.function.ts similarity index 77% rename from backend/functions/case-docket/case-docket.function.ts rename to backend/functions/api/case-docket/case-docket.function.ts index 989b001b1..478e5fe0f 100644 --- a/backend/functions/case-docket/case-docket.function.ts +++ b/backend/functions/api/case-docket/case-docket.function.ts @@ -1,9 +1,9 @@ import * as dotenv from 'dotenv'; import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions'; -import ContextCreator from '../azure/application-context-creator'; -import { CaseDocketController } from '../../lib/controllers/case-docket/case-docket.controller'; -import { initializeApplicationInsights } from '../azure/app-insights'; -import { toAzureError, toAzureSuccess } from '../azure/functions'; +import ContextCreator from '../../azure/application-context-creator'; +import { CaseDocketController } from '../../../lib/controllers/case-docket/case-docket.controller'; +import { initializeApplicationInsights } from '../../azure/app-insights'; +import { toAzureError, toAzureSuccess } from '../../azure/functions'; dotenv.config(); diff --git a/backend/functions/case-history/case-history.function.test.ts b/backend/functions/api/case-history/case-history.function.test.ts similarity index 74% rename from backend/functions/case-history/case-history.function.test.ts rename to backend/functions/api/case-history/case-history.function.test.ts index 39dd2b45a..f9d1a9a93 100644 --- a/backend/functions/case-history/case-history.function.test.ts +++ b/backend/functions/api/case-history/case-history.function.test.ts @@ -1,18 +1,18 @@ -import { CASE_HISTORY } from '../../lib/testing/mock-data/case-history.mock'; -import { NORMAL_CASE_ID, NOT_FOUND_ERROR_CASE_ID } from '../../lib/testing/testing-constants'; -import { NotFoundError } from '../../lib/common-errors/not-found-error'; -import { CamsHttpRequest } from '../../lib/adapters/types/http'; +import { CASE_HISTORY } from '../../../lib/testing/mock-data/case-history.mock'; +import { NORMAL_CASE_ID, NOT_FOUND_ERROR_CASE_ID } from '../../../lib/testing/testing-constants'; +import { NotFoundError } from '../../../lib/common-errors/not-found-error'; +import { CamsHttpRequest } from '../../../lib/adapters/types/http'; import { InvocationContext } from '@azure/functions'; import handler from './case-history.function'; -import ContextCreator from '../azure/application-context-creator'; -import MockData from '../../../common/src/cams/test-utilities/mock-data'; -import { CaseHistoryController } from '../../lib/controllers/case-history/case-history.controller'; +import ContextCreator from '../../azure/application-context-creator'; +import MockData from '../../../../common/src/cams/test-utilities/mock-data'; +import { CaseHistoryController } from '../../../lib/controllers/case-history/case-history.controller'; import { buildTestResponseError, buildTestResponseSuccess, createMockAzureFunctionRequest, -} from '../azure/testing-helpers'; -import { CaseHistory } from '../../../common/src/cams/history'; +} from '../../azure/testing-helpers'; +import { CaseHistory } from '../../../../common/src/cams/history'; describe('Case History Function Tests', () => { const defaultRequestProps: Partial = { diff --git a/backend/functions/case-history/case-history.function.ts b/backend/functions/api/case-history/case-history.function.ts similarity index 75% rename from backend/functions/case-history/case-history.function.ts rename to backend/functions/api/case-history/case-history.function.ts index a4f9d1ca7..c33b2a237 100644 --- a/backend/functions/case-history/case-history.function.ts +++ b/backend/functions/api/case-history/case-history.function.ts @@ -1,9 +1,9 @@ import * as dotenv from 'dotenv'; import { app, InvocationContext, HttpRequest, HttpResponseInit } from '@azure/functions'; -import ContextCreator from '../azure/application-context-creator'; -import { CaseHistoryController } from '../../lib/controllers/case-history/case-history.controller'; -import { initializeApplicationInsights } from '../azure/app-insights'; -import { toAzureError, toAzureSuccess } from '../azure/functions'; +import ContextCreator from '../../azure/application-context-creator'; +import { CaseHistoryController } from '../../../lib/controllers/case-history/case-history.controller'; +import { initializeApplicationInsights } from '../../azure/app-insights'; +import { toAzureError, toAzureSuccess } from '../../azure/functions'; const MODULE_NAME = 'CASE-HISTORY-FUNCTION'; diff --git a/backend/functions/case-summary/case-summary.function.test.ts b/backend/functions/api/case-summary/case-summary.function.test.ts similarity index 79% rename from backend/functions/case-summary/case-summary.function.test.ts rename to backend/functions/api/case-summary/case-summary.function.test.ts index 82fd95a5a..b497fac70 100644 --- a/backend/functions/case-summary/case-summary.function.test.ts +++ b/backend/functions/api/case-summary/case-summary.function.test.ts @@ -1,16 +1,16 @@ import { InvocationContext } from '@azure/functions'; -import { CaseDetail } from '../../../common/src/cams/cases'; -import { MockData } from '../../../common/src/cams/test-utilities/mock-data'; -import { NotFoundError } from '../../lib/common-errors/not-found-error'; +import { CaseDetail } from '../../../../common/src/cams/cases'; +import { MockData } from '../../../../common/src/cams/test-utilities/mock-data'; +import { NotFoundError } from '../../../lib/common-errors/not-found-error'; import handler from './case-summary.function'; -import ContextCreator from '../azure/application-context-creator'; +import ContextCreator from '../../azure/application-context-creator'; import { buildTestResponseError, buildTestResponseSuccess, createMockAzureFunctionRequest, -} from '../azure/testing-helpers'; -import { CamsHttpRequest } from '../../lib/adapters/types/http'; -import { CaseSummaryController } from '../../lib/controllers/case-summary/case-summary.controller'; +} from '../../azure/testing-helpers'; +import { CamsHttpRequest } from '../../../lib/adapters/types/http'; +import { CaseSummaryController } from '../../../lib/controllers/case-summary/case-summary.controller'; describe('Case summary function', () => { jest diff --git a/backend/functions/case-summary/case-summary.function.ts b/backend/functions/api/case-summary/case-summary.function.ts similarity index 75% rename from backend/functions/case-summary/case-summary.function.ts rename to backend/functions/api/case-summary/case-summary.function.ts index 44ddbc8ab..7a34a9ba6 100644 --- a/backend/functions/case-summary/case-summary.function.ts +++ b/backend/functions/api/case-summary/case-summary.function.ts @@ -1,9 +1,9 @@ import * as dotenv from 'dotenv'; import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions'; -import ContextCreator from '../azure/application-context-creator'; -import { initializeApplicationInsights } from '../azure/app-insights'; -import { toAzureError, toAzureSuccess } from '../azure/functions'; -import { CaseSummaryController } from '../../lib/controllers/case-summary/case-summary.controller'; +import ContextCreator from '../../azure/application-context-creator'; +import { initializeApplicationInsights } from '../../azure/app-insights'; +import { toAzureError, toAzureSuccess } from '../../azure/functions'; +import { CaseSummaryController } from '../../../lib/controllers/case-summary/case-summary.controller'; dotenv.config(); diff --git a/backend/functions/cases/cases.function.test.ts b/backend/functions/api/cases/cases.function.test.ts similarity index 72% rename from backend/functions/cases/cases.function.test.ts rename to backend/functions/api/cases/cases.function.test.ts index 1b45c208d..4730c1a25 100644 --- a/backend/functions/cases/cases.function.test.ts +++ b/backend/functions/api/cases/cases.function.test.ts @@ -1,13 +1,16 @@ import handler from './cases.function'; -import { buildTestResponseSuccess, createMockAzureFunctionRequest } from '../azure/testing-helpers'; -import { CasesController } from '../../lib/controllers/cases/cases.controller'; -import ContextCreator from '../azure/application-context-creator'; -import MockData from '../../../common/src/cams/test-utilities/mock-data'; +import { + buildTestResponseSuccess, + createMockAzureFunctionRequest, +} from '../../azure/testing-helpers'; +import { CasesController } from '../../../lib/controllers/cases/cases.controller'; +import ContextCreator from '../../azure/application-context-creator'; +import MockData from '../../../../common/src/cams/test-utilities/mock-data'; import { InvocationContext } from '@azure/functions'; -import { ResourceActions } from '../../../common/src/cams/actions'; -import { CaseDetail } from '../../../common/src/cams/cases'; -import { commonHeaders } from '../../lib/adapters/utils/http-response'; -import { CamsError } from '../../lib/common-errors/cams-error'; +import { ResourceActions } from '../../../../common/src/cams/actions'; +import { CaseDetail } from '../../../../common/src/cams/cases'; +import { commonHeaders } from '../../../lib/adapters/utils/http-response'; +import { CamsError } from '../../../lib/common-errors/cams-error'; describe('Cases function', () => { jest diff --git a/backend/functions/cases/cases.function.ts b/backend/functions/api/cases/cases.function.ts similarity index 76% rename from backend/functions/cases/cases.function.ts rename to backend/functions/api/cases/cases.function.ts index 428f65817..60251be68 100644 --- a/backend/functions/cases/cases.function.ts +++ b/backend/functions/api/cases/cases.function.ts @@ -1,9 +1,9 @@ import * as dotenv from 'dotenv'; import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions'; -import { CasesController } from '../../lib/controllers/cases/cases.controller'; -import ContextCreator from '../azure/application-context-creator'; -import { initializeApplicationInsights } from '../azure/app-insights'; -import { toAzureError, toAzureSuccess } from '../azure/functions'; +import { CasesController } from '../../../lib/controllers/cases/cases.controller'; +import ContextCreator from '../../azure/application-context-creator'; +import { initializeApplicationInsights } from '../../azure/app-insights'; +import { toAzureError, toAzureSuccess } from '../../azure/functions'; dotenv.config(); diff --git a/backend/functions/consolidations/consolidations.function.test.ts b/backend/functions/api/consolidations/consolidations.function.test.ts similarity index 87% rename from backend/functions/consolidations/consolidations.function.test.ts rename to backend/functions/api/consolidations/consolidations.function.test.ts index 07ad5eaf2..3b2c944f7 100644 --- a/backend/functions/consolidations/consolidations.function.test.ts +++ b/backend/functions/api/consolidations/consolidations.function.test.ts @@ -1,16 +1,16 @@ -import { MockData } from '../../../common/src/cams/test-utilities/mock-data'; +import { MockData } from '../../../../common/src/cams/test-utilities/mock-data'; import handler from './consolidations.function'; -import { CamsHttpRequest } from '../../lib/adapters/types/http'; -import ContextCreator from '../azure/application-context-creator'; +import { CamsHttpRequest } from '../../../lib/adapters/types/http'; +import ContextCreator from '../../azure/application-context-creator'; import { buildTestResponseError, buildTestResponseSuccess, createMockAzureFunctionContext, createMockAzureFunctionRequest, -} from '../azure/testing-helpers'; -import { OrdersController } from '../../lib/controllers/orders/orders.controller'; -import { ConsolidationOrder } from '../../../common/src/cams/orders'; -import { BadRequestError } from '../../lib/common-errors/bad-request'; +} from '../../azure/testing-helpers'; +import { OrdersController } from '../../../lib/controllers/orders/orders.controller'; +import { ConsolidationOrder } from '../../../../common/src/cams/orders'; +import { BadRequestError } from '../../../lib/common-errors/bad-request'; describe('Consolidations Function tests', () => { const defaultRequestProps: Partial = { diff --git a/backend/functions/consolidations/consolidations.function.ts b/backend/functions/api/consolidations/consolidations.function.ts similarity index 76% rename from backend/functions/consolidations/consolidations.function.ts rename to backend/functions/api/consolidations/consolidations.function.ts index 1b3ee1646..107ceef02 100644 --- a/backend/functions/consolidations/consolidations.function.ts +++ b/backend/functions/api/consolidations/consolidations.function.ts @@ -1,9 +1,9 @@ import * as dotenv from 'dotenv'; -import { initializeApplicationInsights } from '../azure/app-insights'; +import { initializeApplicationInsights } from '../../azure/app-insights'; import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions'; -import ContextCreator from '../azure/application-context-creator'; -import { OrdersController } from '../../lib/controllers/orders/orders.controller'; -import { toAzureError, toAzureSuccess } from '../azure/functions'; +import ContextCreator from '../../azure/application-context-creator'; +import { OrdersController } from '../../../lib/controllers/orders/orders.controller'; +import { toAzureError, toAzureSuccess } from '../../azure/functions'; dotenv.config(); diff --git a/backend/functions/courts/courts.function.test.ts b/backend/functions/api/courts/courts.function.test.ts similarity index 79% rename from backend/functions/courts/courts.function.test.ts rename to backend/functions/api/courts/courts.function.test.ts index a46aa03bc..aba16c247 100644 --- a/backend/functions/courts/courts.function.test.ts +++ b/backend/functions/api/courts/courts.function.test.ts @@ -1,14 +1,14 @@ -import { CamsError } from '../../lib/common-errors/cams-error'; +import { CamsError } from '../../../lib/common-errors/cams-error'; import handler from './courts.function'; import { buildTestResponseError, buildTestResponseSuccess, createMockAzureFunctionContext, createMockAzureFunctionRequest, -} from '../azure/testing-helpers'; -import { CourtsController } from '../../lib/controllers/courts/courts.controller'; -import { CourtDivisionDetails } from '../../../common/src/cams/courts'; -import { COURT_DIVISIONS } from '../../../common/src/cams/test-utilities/courts.mock'; +} from '../../azure/testing-helpers'; +import { CourtsController } from '../../../lib/controllers/courts/courts.controller'; +import { CourtDivisionDetails } from '../../../../common/src/cams/courts'; +import { COURT_DIVISIONS } from '../../../../common/src/cams/test-utilities/courts.mock'; describe('Courts Function tests', () => { let request; diff --git a/backend/functions/courts/courts.function.ts b/backend/functions/api/courts/courts.function.ts similarity index 80% rename from backend/functions/courts/courts.function.ts rename to backend/functions/api/courts/courts.function.ts index 20687d927..21f4e28be 100644 --- a/backend/functions/courts/courts.function.ts +++ b/backend/functions/api/courts/courts.function.ts @@ -1,7 +1,7 @@ import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions'; -import ContextCreator from '../azure/application-context-creator'; -import { toAzureError, toAzureSuccess } from '../azure/functions'; -import { CourtsController } from '../../lib/controllers/courts/courts.controller'; +import ContextCreator from '../../azure/application-context-creator'; +import { toAzureError, toAzureSuccess } from '../../azure/functions'; +import { CourtsController } from '../../../lib/controllers/courts/courts.controller'; const MODULE_NAME = 'COURTS_FUNCTION'; diff --git a/backend/functions/healthcheck/healthcheck.db.cosmos.test.ts b/backend/functions/api/healthcheck/healthcheck.db.cosmos.test.ts similarity index 85% rename from backend/functions/healthcheck/healthcheck.db.cosmos.test.ts rename to backend/functions/api/healthcheck/healthcheck.db.cosmos.test.ts index 42f74b89c..4ce2530ea 100644 --- a/backend/functions/healthcheck/healthcheck.db.cosmos.test.ts +++ b/backend/functions/api/healthcheck/healthcheck.db.cosmos.test.ts @@ -1,11 +1,11 @@ import { describe } from 'node:test'; -import { ApplicationContext } from '../../lib/adapters/types/basic'; -import { createMockApplicationContext } from '../../lib/testing/testing-utilities'; -import { closeDeferred } from '../../lib/deferrable/defer-close'; +import { ApplicationContext } from '../../../lib/adapters/types/basic'; +import { createMockApplicationContext } from '../../../lib/testing/testing-utilities'; +import { closeDeferred } from '../../../lib/deferrable/defer-close'; import HealthcheckCosmosDb, { HealthCheckDocument } from './healthcheck.db.cosmos'; -import { MongoCollectionAdapter } from '../../lib/adapters/gateways/mongo/utils/mongo-adapter'; +import { MongoCollectionAdapter } from '../../../lib/adapters/gateways/mongo/utils/mongo-adapter'; describe('healthcheck db tests', () => { let context: ApplicationContext; diff --git a/backend/functions/healthcheck/healthcheck.db.cosmos.ts b/backend/functions/api/healthcheck/healthcheck.db.cosmos.ts similarity index 87% rename from backend/functions/healthcheck/healthcheck.db.cosmos.ts rename to backend/functions/api/healthcheck/healthcheck.db.cosmos.ts index b4515d81c..e055864eb 100644 --- a/backend/functions/healthcheck/healthcheck.db.cosmos.ts +++ b/backend/functions/api/healthcheck/healthcheck.db.cosmos.ts @@ -1,9 +1,9 @@ import * as dotenv from 'dotenv'; -import { ApplicationContext } from '../../lib/adapters/types/basic'; -import { DocumentClient } from '../../lib/humble-objects/mongo-humble'; -import QueryBuilder from '../../lib/query/query-builder'; -import { deferClose } from '../../lib/deferrable/defer-close'; -import { MongoCollectionAdapter } from '../../lib/adapters/gateways/mongo/utils/mongo-adapter'; +import { ApplicationContext } from '../../../lib/adapters/types/basic'; +import { DocumentClient } from '../../../lib/humble-objects/mongo-humble'; +import QueryBuilder from '../../../lib/query/query-builder'; +import { deferClose } from '../../../lib/deferrable/defer-close'; +import { MongoCollectionAdapter } from '../../../lib/adapters/gateways/mongo/utils/mongo-adapter'; dotenv.config(); diff --git a/backend/functions/healthcheck/healthcheck.db.sql.ts b/backend/functions/api/healthcheck/healthcheck.db.sql.ts similarity index 85% rename from backend/functions/healthcheck/healthcheck.db.sql.ts rename to backend/functions/api/healthcheck/healthcheck.db.sql.ts index 79edcbd36..08e4501e8 100644 --- a/backend/functions/healthcheck/healthcheck.db.sql.ts +++ b/backend/functions/api/healthcheck/healthcheck.db.sql.ts @@ -1,5 +1,5 @@ -import { ApplicationContext } from '../../lib/adapters/types/basic'; -import { getSqlConnection } from '../../lib/factory'; +import { ApplicationContext } from '../../../lib/adapters/types/basic'; +import { getSqlConnection } from '../../../lib/factory'; const MODULE_NAME = 'HEALTHCHECK-SQL-DB'; diff --git a/backend/functions/healthcheck/healthcheck.function.ts b/backend/functions/api/healthcheck/healthcheck.function.ts similarity index 86% rename from backend/functions/healthcheck/healthcheck.function.ts rename to backend/functions/api/healthcheck/healthcheck.function.ts index 388bab50d..6cc93ae76 100644 --- a/backend/functions/healthcheck/healthcheck.function.ts +++ b/backend/functions/api/healthcheck/healthcheck.function.ts @@ -1,14 +1,14 @@ -import ContextCreator from '../azure/application-context-creator'; -import { CamsError } from '../../lib/common-errors/cams-error'; +import ContextCreator from '../../azure/application-context-creator'; +import { CamsError } from '../../../lib/common-errors/cams-error'; import HealthcheckCosmosDb from './healthcheck.db.cosmos'; import { app, InvocationContext, HttpResponseInit, HttpRequest } from '@azure/functions'; import HealthcheckSqlDb from './healthcheck.db.sql'; import HealthcheckInfo from './healthcheck.info'; -import { toAzureError, toAzureSuccess } from '../azure/functions'; -import { httpSuccess } from '../../lib/adapters/utils/http-response'; -import HttpStatusCodes from '../../../common/src/api/http-status-codes'; -import { closeDeferred } from '../../lib/deferrable/defer-close'; +import { toAzureError, toAzureSuccess } from '../../azure/functions'; +import { httpSuccess } from '../../../lib/adapters/utils/http-response'; +import HttpStatusCodes from '../../../../common/src/api/http-status-codes'; +import { closeDeferred } from '../../../lib/deferrable/defer-close'; const MODULE_NAME = 'HEALTHCHECK'; diff --git a/backend/functions/healthcheck/healthcheck.info.ts b/backend/functions/api/healthcheck/healthcheck.info.ts similarity index 90% rename from backend/functions/healthcheck/healthcheck.info.ts rename to backend/functions/api/healthcheck/healthcheck.info.ts index d67a51fe0..ea67fd1fd 100644 --- a/backend/functions/healthcheck/healthcheck.info.ts +++ b/backend/functions/api/healthcheck/healthcheck.info.ts @@ -1,5 +1,5 @@ import * as dotenv from 'dotenv'; -import { ApplicationContext } from '../../lib/adapters/types/basic'; +import { ApplicationContext } from '../../../lib/adapters/types/basic'; dotenv.config(); diff --git a/backend/functions/healthcheck/healthcheck.test.ts b/backend/functions/api/healthcheck/healthcheck.test.ts similarity index 91% rename from backend/functions/healthcheck/healthcheck.test.ts rename to backend/functions/api/healthcheck/healthcheck.test.ts index 4fb780b2e..e2271270b 100644 --- a/backend/functions/healthcheck/healthcheck.test.ts +++ b/backend/functions/api/healthcheck/healthcheck.test.ts @@ -1,5 +1,5 @@ -import { createMockAzureFunctionRequest } from '../azure/testing-helpers'; -import { MongoCollectionAdapter } from '../../lib/adapters/gateways/mongo/utils/mongo-adapter'; +import { createMockAzureFunctionRequest } from '../../azure/testing-helpers'; +import { MongoCollectionAdapter } from '../../../lib/adapters/gateways/mongo/utils/mongo-adapter'; import { HealthCheckDocument } from './healthcheck.db.cosmos'; import handler, { checkResults } from './healthcheck.function'; diff --git a/backend/functions/api/host.json b/backend/functions/api/host.json new file mode 100644 index 000000000..9093e3097 --- /dev/null +++ b/backend/functions/api/host.json @@ -0,0 +1,25 @@ +{ + "version": "2.0", + "logging": { + "applicationInsights": { + "enableDependencyTracking": true, + "dependencyTrackingOptions": { + "enableSqlCommandTextInstrumentation": true + }, + "samplingSettings": { + "isEnabled": true + } + }, + "fileLoggingMode": "always", + "logLevel": { + "default": "Debug", + "Host.Results": "Information", + "Function": "Information", + "Worker": "Information" + } + }, + "extensionBundle": { + "id": "Microsoft.Azure.Functions.ExtensionBundle", + "version": "[4.*, 5.0.0)" + } +} diff --git a/backend/functions/me/me.function.test.ts b/backend/functions/api/me/me.function.test.ts similarity index 72% rename from backend/functions/me/me.function.test.ts rename to backend/functions/api/me/me.function.test.ts index ecef356d0..7dea1960c 100644 --- a/backend/functions/me/me.function.test.ts +++ b/backend/functions/api/me/me.function.test.ts @@ -2,14 +2,14 @@ import { buildTestResponseError, buildTestResponseSuccess, createMockAzureFunctionRequest, -} from '../azure/testing-helpers'; -import ContextCreator from '../azure/application-context-creator'; -import MockData from '../../../common/src/cams/test-utilities/mock-data'; -import { ForbiddenError } from '../../lib/common-errors/forbidden-error'; -import handler from '../me/me.function'; +} from '../../azure/testing-helpers'; +import ContextCreator from '../../azure/application-context-creator'; +import MockData from '../../../../common/src/cams/test-utilities/mock-data'; +import { ForbiddenError } from '../../../lib/common-errors/forbidden-error'; +import handler from './me.function'; import { InvocationContext } from '@azure/functions'; -import { CamsSession } from '../../../common/src/cams/session'; -import { createMockApplicationContext } from '../../lib/testing/testing-utilities'; +import { CamsSession } from '../../../../common/src/cams/session'; +import { createMockApplicationContext } from '../../../lib/testing/testing-utilities'; describe('me Function test', () => { const context = new InvocationContext({ diff --git a/backend/functions/me/me.function.ts b/backend/functions/api/me/me.function.ts similarity index 79% rename from backend/functions/me/me.function.ts rename to backend/functions/api/me/me.function.ts index 36de4c333..9a43da326 100644 --- a/backend/functions/me/me.function.ts +++ b/backend/functions/api/me/me.function.ts @@ -1,7 +1,7 @@ import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions'; -import ContextCreator from '../azure/application-context-creator'; -import { toAzureError, toAzureSuccess } from '../azure/functions'; -import { MeController } from '../../lib/controllers/me/me.controller'; +import ContextCreator from '../../azure/application-context-creator'; +import { toAzureError, toAzureSuccess } from '../../azure/functions'; +import { MeController } from '../../../lib/controllers/me/me.controller'; const MODULE_NAME = 'ME-FUNCTION'; diff --git a/backend/functions/oauth2/mock-oauth2.function.ts b/backend/functions/api/oauth2/mock-oauth2.function.ts similarity index 73% rename from backend/functions/oauth2/mock-oauth2.function.ts rename to backend/functions/api/oauth2/mock-oauth2.function.ts index bb3b1a4ed..c4ea70a5d 100644 --- a/backend/functions/oauth2/mock-oauth2.function.ts +++ b/backend/functions/api/oauth2/mock-oauth2.function.ts @@ -1,8 +1,8 @@ import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions'; -import ContextCreator from '../azure/application-context-creator'; -import { mockAuthentication } from '../../lib/testing/mock-gateways/mock-oauth2-gateway'; -import { toAzureError, toAzureSuccess } from '../azure/functions'; -import { httpSuccess } from '../../lib/adapters/utils/http-response'; +import ContextCreator from '../../azure/application-context-creator'; +import { mockAuthentication } from '../../../lib/testing/mock-gateways/mock-oauth2-gateway'; +import { toAzureError, toAzureSuccess } from '../../azure/functions'; +import { httpSuccess } from '../../../lib/adapters/utils/http-response'; const MODULE_NAME = 'MOCK-OAUTH2-FUNCTION'; diff --git a/backend/functions/office-staff-sync/office-staff-sync.function.test.ts b/backend/functions/api/office-staff-sync/office-staff-sync.function.test.ts similarity index 79% rename from backend/functions/office-staff-sync/office-staff-sync.function.test.ts rename to backend/functions/api/office-staff-sync/office-staff-sync.function.test.ts index 223021419..22d239d8e 100644 --- a/backend/functions/office-staff-sync/office-staff-sync.function.test.ts +++ b/backend/functions/api/office-staff-sync/office-staff-sync.function.test.ts @@ -1,9 +1,9 @@ -import { LoggerImpl } from '../../lib/adapters/services/logger.service'; -import { CamsError } from '../../lib/common-errors/cams-error'; +import { LoggerImpl } from '../../../lib/adapters/services/logger.service'; +import { CamsError } from '../../../lib/common-errors/cams-error'; import timerTrigger from './office-staff-sync.function'; import { Timer } from '@azure/functions'; -import { createMockAzureFunctionContext } from '../azure/testing-helpers'; -import { OfficesController } from '../../lib/controllers/offices/offices.controller'; +import { createMockAzureFunctionContext } from '../../azure/testing-helpers'; +import { OfficesController } from '../../../lib/controllers/offices/offices.controller'; describe('Office Staff Sync Function tests', () => { const context = createMockAzureFunctionContext(); diff --git a/backend/functions/office-staff-sync/office-staff-sync.function.ts b/backend/functions/api/office-staff-sync/office-staff-sync.function.ts similarity index 72% rename from backend/functions/office-staff-sync/office-staff-sync.function.ts rename to backend/functions/api/office-staff-sync/office-staff-sync.function.ts index cd91182af..3138d1ab4 100644 --- a/backend/functions/office-staff-sync/office-staff-sync.function.ts +++ b/backend/functions/api/office-staff-sync/office-staff-sync.function.ts @@ -1,9 +1,9 @@ import * as dotenv from 'dotenv'; import { app, InvocationContext, Timer } from '@azure/functions'; -import ContextCreator from '../azure/application-context-creator'; -import { initializeApplicationInsights } from '../azure/app-insights'; -import { toAzureError } from '../azure/functions'; -import { OfficesController } from '../../lib/controllers/offices/offices.controller'; +import ContextCreator from '../../azure/application-context-creator'; +import { initializeApplicationInsights } from '../../azure/app-insights'; +import { toAzureError } from '../../azure/functions'; +import { OfficesController } from '../../../lib/controllers/offices/offices.controller'; dotenv.config(); diff --git a/backend/functions/offices/offices.function.test.ts b/backend/functions/api/offices/offices.function.test.ts similarity index 81% rename from backend/functions/offices/offices.function.test.ts rename to backend/functions/api/offices/offices.function.test.ts index c6c611a51..73c05950d 100644 --- a/backend/functions/offices/offices.function.test.ts +++ b/backend/functions/api/offices/offices.function.test.ts @@ -1,15 +1,15 @@ -import { CamsError } from '../../lib/common-errors/cams-error'; -import ContextCreator from '../azure/application-context-creator'; -import MockData from '../../../common/src/cams/test-utilities/mock-data'; +import { CamsError } from '../../../lib/common-errors/cams-error'; +import ContextCreator from '../../azure/application-context-creator'; +import MockData from '../../../../common/src/cams/test-utilities/mock-data'; import handler from './offices.function'; import { buildTestResponseError, buildTestResponseSuccess, createMockAzureFunctionContext, createMockAzureFunctionRequest, -} from '../azure/testing-helpers'; -import { OfficesController } from '../../lib/controllers/offices/offices.controller'; -import { USTP_OFFICES_ARRAY, UstpOfficeDetails } from '../../../common/src/cams/offices'; +} from '../../azure/testing-helpers'; +import { OfficesController } from '../../../lib/controllers/offices/offices.controller'; +import { USTP_OFFICES_ARRAY, UstpOfficeDetails } from '../../../../common/src/cams/offices'; describe('offices Function tests', () => { let request; diff --git a/backend/functions/offices/offices.function.ts b/backend/functions/api/offices/offices.function.ts similarity index 81% rename from backend/functions/offices/offices.function.ts rename to backend/functions/api/offices/offices.function.ts index f644b7547..f2737a8fa 100644 --- a/backend/functions/offices/offices.function.ts +++ b/backend/functions/api/offices/offices.function.ts @@ -1,7 +1,7 @@ import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions'; -import ContextCreator from '../azure/application-context-creator'; -import { OfficesController } from '../../lib/controllers/offices/offices.controller'; -import { toAzureError, toAzureSuccess } from '../azure/functions'; +import ContextCreator from '../../azure/application-context-creator'; +import { OfficesController } from '../../../lib/controllers/offices/offices.controller'; +import { toAzureError, toAzureSuccess } from '../../azure/functions'; const MODULE_NAME = 'OFFICES_FUNCTION'; diff --git a/backend/functions/orders-manual-sync/orders-manual-sync.function.test.ts b/backend/functions/api/orders-manual-sync/orders-manual-sync.function.test.ts similarity index 81% rename from backend/functions/orders-manual-sync/orders-manual-sync.function.test.ts rename to backend/functions/api/orders-manual-sync/orders-manual-sync.function.test.ts index b8fd8d4d6..7383b870d 100644 --- a/backend/functions/orders-manual-sync/orders-manual-sync.function.test.ts +++ b/backend/functions/api/orders-manual-sync/orders-manual-sync.function.test.ts @@ -1,9 +1,12 @@ -import { LoggerImpl } from '../../lib/adapters/services/logger.service'; -import { CamsError } from '../../lib/common-errors/cams-error'; -import { OrdersController } from '../../lib/controllers/orders/orders.controller'; -import { SyncOrdersStatus } from '../../lib/use-cases/orders/orders'; +import { LoggerImpl } from '../../../lib/adapters/services/logger.service'; +import { CamsError } from '../../../lib/common-errors/cams-error'; +import { OrdersController } from '../../../lib/controllers/orders/orders.controller'; +import { SyncOrdersStatus } from '../../../lib/use-cases/orders/orders'; import handler from './orders-manual-sync.function'; -import { buildTestResponseSuccess, createMockAzureFunctionRequest } from '../azure/testing-helpers'; +import { + buildTestResponseSuccess, + createMockAzureFunctionRequest, +} from '../../azure/testing-helpers'; const syncResponse: SyncOrdersStatus = { options: { diff --git a/backend/functions/orders-manual-sync/orders-manual-sync.function.ts b/backend/functions/api/orders-manual-sync/orders-manual-sync.function.ts similarity index 82% rename from backend/functions/orders-manual-sync/orders-manual-sync.function.ts rename to backend/functions/api/orders-manual-sync/orders-manual-sync.function.ts index 7f9d23e11..f06830c48 100644 --- a/backend/functions/orders-manual-sync/orders-manual-sync.function.ts +++ b/backend/functions/api/orders-manual-sync/orders-manual-sync.function.ts @@ -1,9 +1,9 @@ import * as dotenv from 'dotenv'; import { app, InvocationContext, HttpRequest, HttpResponseInit } from '@azure/functions'; -import ContextCreator from '../azure/application-context-creator'; -import { initializeApplicationInsights } from '../azure/app-insights'; -import { OrdersController } from '../../lib/controllers/orders/orders.controller'; -import { toAzureError, toAzureSuccess } from '../azure/functions'; +import ContextCreator from '../../azure/application-context-creator'; +import { initializeApplicationInsights } from '../../azure/app-insights'; +import { OrdersController } from '../../../lib/controllers/orders/orders.controller'; +import { toAzureError, toAzureSuccess } from '../../azure/functions'; dotenv.config(); diff --git a/backend/functions/orders-suggestions/orders-suggestions.function.test.ts b/backend/functions/api/orders-suggestions/orders-suggestions.function.test.ts similarity index 79% rename from backend/functions/orders-suggestions/orders-suggestions.function.test.ts rename to backend/functions/api/orders-suggestions/orders-suggestions.function.test.ts index 6a08e96ba..cc5322c58 100644 --- a/backend/functions/orders-suggestions/orders-suggestions.function.test.ts +++ b/backend/functions/api/orders-suggestions/orders-suggestions.function.test.ts @@ -1,14 +1,14 @@ import handler from './orders-suggestions.function'; -import { CamsError } from '../../lib/common-errors/cams-error'; +import { CamsError } from '../../../lib/common-errors/cams-error'; import { buildTestResponseSuccess, createMockAzureFunctionContext, createMockAzureFunctionRequest, -} from '../azure/testing-helpers'; -import { OrdersController } from '../../lib/controllers/orders/orders.controller'; -import MockData from '../../../common/src/cams/test-utilities/mock-data'; -import { CaseSummary } from '../../../common/src/cams/cases'; -import { buildTestResponseError } from '../azure/testing-helpers'; +} from '../../azure/testing-helpers'; +import { OrdersController } from '../../../lib/controllers/orders/orders.controller'; +import MockData from '../../../../common/src/cams/test-utilities/mock-data'; +import { CaseSummary } from '../../../../common/src/cams/cases'; +import { buildTestResponseError } from '../../azure/testing-helpers'; describe('Orders suggestions function tests', () => { const context = createMockAzureFunctionContext(); diff --git a/backend/functions/orders-suggestions/orders-suggestions.function.ts b/backend/functions/api/orders-suggestions/orders-suggestions.function.ts similarity index 76% rename from backend/functions/orders-suggestions/orders-suggestions.function.ts rename to backend/functions/api/orders-suggestions/orders-suggestions.function.ts index 3674a35c6..d0e87f994 100644 --- a/backend/functions/orders-suggestions/orders-suggestions.function.ts +++ b/backend/functions/api/orders-suggestions/orders-suggestions.function.ts @@ -1,10 +1,10 @@ import { InvocationContext, HttpRequest, HttpResponseInit, app } from '@azure/functions'; -import ContextCreator from '../azure/application-context-creator'; -import { initializeApplicationInsights } from '../azure/app-insights'; -import { OrdersController } from '../../lib/controllers/orders/orders.controller'; +import ContextCreator from '../../azure/application-context-creator'; +import { initializeApplicationInsights } from '../../azure/app-insights'; +import { OrdersController } from '../../../lib/controllers/orders/orders.controller'; import * as dotenv from 'dotenv'; -import { toAzureError, toAzureSuccess } from '../azure/functions'; +import { toAzureError, toAzureSuccess } from '../../azure/functions'; dotenv.config(); initializeApplicationInsights(); diff --git a/backend/functions/orders-sync/orders-sync.function.test.ts b/backend/functions/api/orders-sync/orders-sync.function.test.ts similarity index 81% rename from backend/functions/orders-sync/orders-sync.function.test.ts rename to backend/functions/api/orders-sync/orders-sync.function.test.ts index a5a915642..46d074acf 100644 --- a/backend/functions/orders-sync/orders-sync.function.test.ts +++ b/backend/functions/api/orders-sync/orders-sync.function.test.ts @@ -1,10 +1,10 @@ -import { LoggerImpl } from '../../lib/adapters/services/logger.service'; -import { CamsError } from '../../lib/common-errors/cams-error'; +import { LoggerImpl } from '../../../lib/adapters/services/logger.service'; +import { CamsError } from '../../../lib/common-errors/cams-error'; import timerTrigger from './orders-sync.function'; import { Timer } from '@azure/functions'; -import { createMockAzureFunctionContext } from '../azure/testing-helpers'; -import { OrdersController } from '../../lib/controllers/orders/orders.controller'; -import * as factory from '../../lib/factory'; +import { createMockAzureFunctionContext } from '../../azure/testing-helpers'; +import { OrdersController } from '../../../lib/controllers/orders/orders.controller'; +import * as factory from '../../../lib/factory'; describe('Orders Sync Function tests', () => { const context = createMockAzureFunctionContext({ MONGO_CONNECTION_STRING: 'fake' }); diff --git a/backend/functions/orders-sync/orders-sync.function.ts b/backend/functions/api/orders-sync/orders-sync.function.ts similarity index 72% rename from backend/functions/orders-sync/orders-sync.function.ts rename to backend/functions/api/orders-sync/orders-sync.function.ts index 110ac4088..eb269bda3 100644 --- a/backend/functions/orders-sync/orders-sync.function.ts +++ b/backend/functions/api/orders-sync/orders-sync.function.ts @@ -1,9 +1,9 @@ import * as dotenv from 'dotenv'; import { app, InvocationContext, Timer } from '@azure/functions'; -import ContextCreator from '../azure/application-context-creator'; -import { initializeApplicationInsights } from '../azure/app-insights'; -import { OrdersController } from '../../lib/controllers/orders/orders.controller'; -import { toAzureError } from '../azure/functions'; +import ContextCreator from '../../azure/application-context-creator'; +import { initializeApplicationInsights } from '../../azure/app-insights'; +import { OrdersController } from '../../../lib/controllers/orders/orders.controller'; +import { toAzureError } from '../../azure/functions'; dotenv.config(); diff --git a/backend/functions/orders/orders.function.test.ts b/backend/functions/api/orders/orders.function.test.ts similarity index 84% rename from backend/functions/orders/orders.function.test.ts rename to backend/functions/api/orders/orders.function.test.ts index 774637121..4d62f8e7b 100644 --- a/backend/functions/orders/orders.function.test.ts +++ b/backend/functions/api/orders/orders.function.test.ts @@ -1,17 +1,17 @@ import handler from './orders.function'; -import { CamsError } from '../../lib/common-errors/cams-error'; -import { MockData } from '../../../common/src/cams/test-utilities/mock-data'; -import { CamsHttpRequest } from '../../lib/adapters/types/http'; -import { OrdersController } from '../../lib/controllers/orders/orders.controller'; -import { Order } from '../../../common/src/cams/orders'; +import { CamsError } from '../../../lib/common-errors/cams-error'; +import { MockData } from '../../../../common/src/cams/test-utilities/mock-data'; +import { CamsHttpRequest } from '../../../lib/adapters/types/http'; +import { OrdersController } from '../../../lib/controllers/orders/orders.controller'; +import { Order } from '../../../../common/src/cams/orders'; import { buildTestResponseError, buildTestResponseSuccess, createMockAzureFunctionContext, createMockAzureFunctionRequest, -} from '../azure/testing-helpers'; -import { commonHeaders } from '../../lib/adapters/utils/http-response'; -import HttpStatusCodes from '../../../common/src/api/http-status-codes'; +} from '../../azure/testing-helpers'; +import { commonHeaders } from '../../../lib/adapters/utils/http-response'; +import HttpStatusCodes from '../../../../common/src/api/http-status-codes'; describe('Orders Function tests', () => { const request = createMockAzureFunctionRequest({ diff --git a/backend/functions/orders/orders.function.ts b/backend/functions/api/orders/orders.function.ts similarity index 75% rename from backend/functions/orders/orders.function.ts rename to backend/functions/api/orders/orders.function.ts index c6df6ce97..127a39b5d 100644 --- a/backend/functions/orders/orders.function.ts +++ b/backend/functions/api/orders/orders.function.ts @@ -1,9 +1,9 @@ import * as dotenv from 'dotenv'; import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions'; -import ContextCreator from '../azure/application-context-creator'; -import { initializeApplicationInsights } from '../azure/app-insights'; -import { OrdersController } from '../../lib/controllers/orders/orders.controller'; -import { toAzureError, toAzureSuccess } from '../azure/functions'; +import ContextCreator from '../../azure/application-context-creator'; +import { initializeApplicationInsights } from '../../azure/app-insights'; +import { OrdersController } from '../../../lib/controllers/orders/orders.controller'; +import { toAzureError, toAzureSuccess } from '../../azure/functions'; const MODULE_NAME = 'ORDERS_FUNCTION'; diff --git a/backend/functions/api/package-lock.json b/backend/functions/api/package-lock.json new file mode 100644 index 000000000..584f737b8 --- /dev/null +++ b/backend/functions/api/package-lock.json @@ -0,0 +1,105 @@ +{ + "name": "cams-api", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "cams-api", + "version": "1.0.0", + "workspaces": [ + "../../" + ], + "dependencies": { + "@azure/functions": "^4.6.0" + } + }, + "../..": { + "name": "node", + "version": "1.0.0", + "dependencies": { + "@azure/cosmos": "^4.2.0", + "@azure/functions": "^4.6.0", + "@azure/identity": "^4.5.0", + "@azure/keyvault-secrets": "^4.9.0", + "@launchdarkly/node-server-sdk": "^9.7.2", + "@okta/jwt-verifier": "^4.0.1", + "@okta/okta-sdk-nodejs": "^7.1.1", + "applicationinsights": "^3.4.0", + "dotenv": "^16.4.7", + "durable-functions": "^3.1.0", + "jsonwebtoken": "^9.0.2", + "mongodb": "^6.11.0", + "mssql": "^10.0.4" + }, + "devDependencies": { + "@faker-js/faker": "^9.3.0", + "@types/jest": "^29.5.14", + "@types/mssql": "^9.1.5", + "@types/node": "^22.10.1", + "@typescript-eslint/eslint-plugin": "^7.18.0", + "azure-function-context-mock": "^0.0.7", + "dependency-cruiser": "^16.7.0", + "eslint": "^8.57.1", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-import": "^2.31.0", + "eslint-plugin-n": "^16.6.2", + "eslint-plugin-prettier": "^5.2.1", + "eslint-plugin-promise": "^6.6.0", + "jest": "^29.7.0", + "prettier": "^3.4.2", + "ts-jest": "^29.2.5", + "typescript": "^5.7.2" + } + }, + "node_modules/@azure/functions": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@azure/functions/-/functions-4.6.0.tgz", + "integrity": "sha512-vGq9jXlgrJ3KaI8bepgfpk26zVY8vFZsQukF85qjjKTAR90eFOOBNaa+mc/0ViDY2lcdrU2fL/o1pQyZUtTDsw==", + "dependencies": { + "cookie": "^0.7.0", + "long": "^4.0.0", + "undici": "^5.13.0" + }, + "engines": { + "node": ">=18.0" + } + }, + "node_modules/@fastify/busboy": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", + "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", + "engines": { + "node": ">=14" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/long": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", + "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" + }, + "node_modules/node": { + "resolved": "../..", + "link": true + }, + "node_modules/undici": { + "version": "5.28.4", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz", + "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==", + "dependencies": { + "@fastify/busboy": "^2.0.0" + }, + "engines": { + "node": ">=14.0" + } + } + } +} diff --git a/backend/functions/api/package.json b/backend/functions/api/package.json new file mode 100644 index 000000000..c898fad82 --- /dev/null +++ b/backend/functions/api/package.json @@ -0,0 +1,10 @@ +{ + "name": "cams-api", + "version": "1.0.0", + "description": "", + "workspaces": ["../../"], + "dependencies": { + "@azure/functions": "^4.6.0" + }, + "main": "dist/backend/functions/api/*/*.function.js" +} diff --git a/backend/functions/api/tsconfig.build.json b/backend/functions/api/tsconfig.build.json new file mode 100644 index 000000000..efef3c642 --- /dev/null +++ b/backend/functions/api/tsconfig.build.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "outDir": "dist" + }, + "extends": "../../tsconfig.json", + "exclude": ["**/*.test.ts", "**/testing*", "**/fake*", "**/testing/*"] +} diff --git a/backend/functions/migration/.funcignore b/backend/functions/migration/.funcignore new file mode 100644 index 000000000..931ec1df9 --- /dev/null +++ b/backend/functions/migration/.funcignore @@ -0,0 +1,15 @@ +*.js.map +*.ts +.git* +.vscode +__azurite_db*__.json +__blobstorage__ +__queuestorage__ +local.settings.json +test +tsconfig.json +*.zip +README.md +.env +.eslint* +*.test.* diff --git a/backend/functions/host.json b/backend/functions/migration/host.json similarity index 100% rename from backend/functions/host.json rename to backend/functions/migration/host.json diff --git a/backend/functions/migration/package-lock.json b/backend/functions/migration/package-lock.json new file mode 100644 index 000000000..d43500849 --- /dev/null +++ b/backend/functions/migration/package-lock.json @@ -0,0 +1,105 @@ +{ + "name": "cams-migration", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "cams-migration", + "version": "1.0.0", + "workspaces": [ + "../../" + ], + "dependencies": { + "@azure/functions": "^4.6.0" + } + }, + "../..": { + "name": "node", + "version": "1.0.0", + "dependencies": { + "@azure/cosmos": "^4.2.0", + "@azure/functions": "^4.6.0", + "@azure/identity": "^4.5.0", + "@azure/keyvault-secrets": "^4.9.0", + "@launchdarkly/node-server-sdk": "^9.7.2", + "@okta/jwt-verifier": "^4.0.1", + "@okta/okta-sdk-nodejs": "^7.1.1", + "applicationinsights": "^3.4.0", + "dotenv": "^16.4.7", + "durable-functions": "^3.1.0", + "jsonwebtoken": "^9.0.2", + "mongodb": "^6.11.0", + "mssql": "^10.0.4" + }, + "devDependencies": { + "@faker-js/faker": "^9.3.0", + "@types/jest": "^29.5.14", + "@types/mssql": "^9.1.5", + "@types/node": "^22.10.1", + "@typescript-eslint/eslint-plugin": "^7.18.0", + "azure-function-context-mock": "^0.0.7", + "dependency-cruiser": "^16.7.0", + "eslint": "^8.57.1", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-import": "^2.31.0", + "eslint-plugin-n": "^16.6.2", + "eslint-plugin-prettier": "^5.2.1", + "eslint-plugin-promise": "^6.6.0", + "jest": "^29.7.0", + "prettier": "^3.4.2", + "ts-jest": "^29.2.5", + "typescript": "^5.7.2" + } + }, + "node_modules/@azure/functions": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@azure/functions/-/functions-4.6.0.tgz", + "integrity": "sha512-vGq9jXlgrJ3KaI8bepgfpk26zVY8vFZsQukF85qjjKTAR90eFOOBNaa+mc/0ViDY2lcdrU2fL/o1pQyZUtTDsw==", + "dependencies": { + "cookie": "^0.7.0", + "long": "^4.0.0", + "undici": "^5.13.0" + }, + "engines": { + "node": ">=18.0" + } + }, + "node_modules/@fastify/busboy": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", + "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", + "engines": { + "node": ">=14" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/long": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", + "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" + }, + "node_modules/node": { + "resolved": "../..", + "link": true + }, + "node_modules/undici": { + "version": "5.28.4", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz", + "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==", + "dependencies": { + "@fastify/busboy": "^2.0.0" + }, + "engines": { + "node": ">=14.0" + } + } + } +} diff --git a/backend/functions/migration/package.json b/backend/functions/migration/package.json new file mode 100644 index 000000000..39aac1768 --- /dev/null +++ b/backend/functions/migration/package.json @@ -0,0 +1,10 @@ +{ + "name": "cams-migration", + "version": "1.0.0", + "description": "", + "workspaces": ["../../"], + "dependencies": { + "@azure/functions": "^4.6.0" + }, + "main": "dist/backend/functions/migration/*/*.js" +} diff --git a/backend/functions/migration/tsconfig.build.json b/backend/functions/migration/tsconfig.build.json new file mode 100644 index 000000000..efef3c642 --- /dev/null +++ b/backend/functions/migration/tsconfig.build.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "outDir": "dist" + }, + "extends": "../../tsconfig.json", + "exclude": ["**/*.test.ts", "**/testing*", "**/fake*", "**/testing/*"] +} diff --git a/backend/lib/load-env.ts b/backend/lib/load-env.ts new file mode 100644 index 000000000..4e6e17fd2 --- /dev/null +++ b/backend/lib/load-env.ts @@ -0,0 +1,8 @@ +import * as dotenv from 'dotenv'; +import * as path from 'path'; + +function loadEnv() { + dotenv.config({ path: path.resolve(__dirname, '../.env') }); +} + +module.exports = { loadEnv }; diff --git a/backend/package.json b/backend/package.json index 4aee8079a..1abd09723 100644 --- a/backend/package.json +++ b/backend/package.json @@ -36,29 +36,33 @@ "mongodb": "^6.11.0", "mssql": "^10.0.4" }, - "main": "dist/backend/functions/*/*.js", "overrides": { "@azure/identity": "$@azure/identity", "cookie": "^0.7.2" }, "scripts": { - "clean": "rm -rf ./dist && rm -rf ./node_modules && rm -rf ./coverage", + "clean": "rm -rf ./dist && rm -rf ./node_modules && rm -rf ./coverage && npm run clean:api && npm run clean:migration", + "clean:api": "pushd functions/api && rm -rf ./dist && rm -rf ./node_modules && rm -rf ./coverage && popd", + "clean:migration": "pushd functions/migration && rm -rf ./dist && rm -rf ./node_modules && rm -rf ./coverage && popd", "build": "tsc --build tsconfig.build.json", + "build:api": "pushd functions/api && tsc --build tsconfig.build.json && popd", + "build:migration": "pushd functions/migration && tsc --build tsconfig.build.json && popd", "build-common": "pushd ../common && npm ci && npm run build && popd", "watch": "tsc --project tsconfig.build.json -w", "prestart": "npm run build", - "start": "pushd functions && func start --typescript && popd", - "start:dev": "nodemon --esm src/server.ts", + "start:api": "pushd functions/api && func start --typescript && popd", + "start:migration": "pushd functions/migration && func start --typescript && popd", "test": "CAMS_LOGIN_PROVIDER='mock' DATABASE_MOCK='true' MONGO_CONNECTION_STRING='mongodb://test-string' jest -c jest.config.js", "test:open-handles": "CAMS_LOGIN_PROVIDER='mock' DATABASE_MOCK='true' MONGO_CONNECTION_STRING='mongodb://test-string' jest -c jest.config.js --detectOpenHandles", "lint": "eslint functions", "lint:fix": "eslint functions --fix", "format": "prettier --write './**/*.{js,ts,css,md,json}' --config .prettierrc", - "pack": "mkdir -p /tmp/build && zip -q -r /tmp/build/$OUT.zip functions --exclude functions/@.funcignore --exclude functions/.funcignore && mv /tmp/build/$OUT.zip .", + "pack": "mkdir -p /tmp/build && zip -q -r /tmp/build/$OUT.zip functions --exclude functions/api/@.funcignore --exclude functions/api/.funcignore --exclude functions/migration && mv /tmp/build/api/$OUT.zip .", + "pack:migration": "mkdir -p /tmp/build && zip -q -r /tmp/build/$OUT.zip functions/migration --exclude functions/migration/@.funcignore --exclude functions/migration/.funcignore --exclude functions/api && mv /tmp/build/migration/$OUT.zip .", "coverage": "npm test -- --coverage", "coverage:ci": "npm config set script-shell=/bin/bash && npm run build-common && npm test -- --coverage", - "dependency-cruiser-graphical": "current_time=$(date +'%Y-%m-%d_%H%M') && npx depcruise --output-type dot --do-not-follow '^node_modules($|/)' functions/attorneys case-assignments case-docket case-history case-summary cases consolidations healthcheck offices orders orders-manual-sync orders-sync ../lib | dot -T svg > ../../docs/architecture/dependency-cruiser/functions/dependency-graph_api_${current_time}.svg", - "dependency-cruiser:ci": "npx depcruise --output-type err-long functions/attorneys case-assignments case-docket case-history case-summary cases consolidations healthcheck offices orders orders-manual-sync orders-sync ../lib ", + "dependency-cruiser-graphical": "current_time=$(date +'%Y-%m-%d_%H%M') && npx depcruise --output-type dot --do-not-follow '^node_modules($|/)' functions/api/attorneys case-assignments case-docket case-history case-summary cases consolidations healthcheck offices orders orders-manual-sync orders-sync ../lib | dot -T svg > ../../docs/architecture/dependency-cruiser/functions/dependency-graph_api_${current_time}.svg", + "dependency-cruiser:ci": "npx depcruise --output-type err-long functions/api/attorneys case-assignments case-docket case-history case-summary cases consolidations healthcheck offices orders orders-manual-sync orders-sync ../lib ", "itest:okta-group-api": "CAMS_LOGIN_PROVIDER=okta npx ts-node lib/testing/isolated-integration/test-okta-group-api.ts", "itest:export-office-csv": "CAMS_LOGIN_PROVIDER=okta npx ts-node ../lib/testing/isolated-integration/export-office-csv.ts" } diff --git a/backend/tsconfig.build.json b/backend/tsconfig.build.json index 276ba9abd..5cee1ca91 100644 --- a/backend/tsconfig.build.json +++ b/backend/tsconfig.build.json @@ -1,4 +1,7 @@ { + "compilerOptions": { + "outDir": "dist" + }, "extends": "./tsconfig.json", - "exclude": ["**/*.test.ts","**/testing*","**/fake*", "**/testing/*"] + "exclude": ["**/*.test.ts", "**/testing*", "**/fake*", "**/testing/*", "functions"] } diff --git a/ops/cloud-deployment/backend-api-deploy.bicep b/ops/cloud-deployment/backend-api-deploy.bicep index c29d4459c..e8e6473f3 100644 --- a/ops/cloud-deployment/backend-api-deploy.bicep +++ b/ops/cloud-deployment/backend-api-deploy.bicep @@ -37,11 +37,16 @@ var planTypeToSkuMap = { param stackName string = 'ustp-cams' -param functionName string +param apiFunctionName string + +param apiFunctionSubnetId string + +param migrationFunctionName string + +param migrationFunctionSubnetId string param virtualNetworkResourceGroupName string -param functionSubnetId string param privateEndpointSubnetId string @@ -75,7 +80,7 @@ param functionsVersion string = '~4' @description('Storage account name. Default creates unique name from resource group id and stack name') @minLength(3) @maxLength(24) -param functionsStorageName string = 'ustpfunc${uniqueString(resourceGroup().id, functionName)}' +param functionsStorageName string = 'ustpfunc${uniqueString(resourceGroup().id, apiFunctionName)}' @description('List of origins to allow. Need to include protocol') param corsAllowOrigins array = [] @@ -159,7 +164,7 @@ resource storageAccount 'Microsoft.Storage/storageAccounts@2022-09-01' = { name: functionsStorageName location: location tags: { - 'Stack Name': functionName + 'Stack Name': apiFunctionName } sku: { name: 'Standard_LRS' @@ -172,33 +177,33 @@ resource storageAccount 'Microsoft.Storage/storageAccounts@2022-09-01' = { } module appInsights './lib/app-insights/app-insights.bicep' = if (createApplicationInsights) { - name: '${functionName}-application-insights-module' + name: '${apiFunctionName}-application-insights-module' params: { location: location kind: 'web' - appInsightsName: 'appi-${functionName}' + appInsightsName: 'appi-${apiFunctionName}' applicationType: 'web' workspaceResourceId: analyticsWorkspaceId } } module diagnosticSettings './lib/app-insights/diagnostics-settings-func.bicep' = if (createApplicationInsights) { - name: '${functionName}-diagnostic-settings-module' + name: '${apiFunctionName}-diagnostic-settings-module' params: { - functionAppName: functionName + functionAppName: apiFunctionName workspaceResourceId: analyticsWorkspaceId } dependsOn: [ appInsights - functionApp + apiFunctionApp ] } module healthAlertRule './lib/monitoring-alerts/metrics-alert-rule.bicep' = if (createAlerts) { - name: '${functionName}-healthcheck-alert-rule-module' + name: '${apiFunctionName}-healthcheck-alert-rule-module' params: { - alertName: '${functionName}-health-check-alert' - appId: functionApp.id + alertName: '${apiFunctionName}-health-check-alert' + appId: apiFunctionApp.id timeAggregation: 'Average' operator: 'LessThan' targetResourceType: 'Microsoft.Web/sites' @@ -211,10 +216,10 @@ module healthAlertRule './lib/monitoring-alerts/metrics-alert-rule.bicep' = if ( } module httpAlertRule './lib/monitoring-alerts/metrics-alert-rule.bicep' = if (createAlerts) { - name: '${functionName}-http-error-alert-rule-module' + name: '${apiFunctionName}-http-error-alert-rule-module' params: { - alertName: '${functionName}-http-error-alert' - appId: functionApp.id + alertName: '${apiFunctionName}-http-error-alert' + appId: apiFunctionApp.id timeAggregation: 'Total' operator: 'GreaterThanOrEqual' targetResourceType: 'Microsoft.Web/sites' @@ -237,8 +242,8 @@ var userAssignedIdentities = union( createSqlServerVnetRule ? { '${sqlIdentity.id}': {} } : {} ) -resource functionApp 'Microsoft.Web/sites@2022-09-01' = { - name: functionName +resource apiFunctionApp 'Microsoft.Web/sites@2022-09-01' = { + name: apiFunctionName location: location kind: 'functionapp,linux' identity: { @@ -249,7 +254,7 @@ resource functionApp 'Microsoft.Web/sites@2022-09-01' = { serverFarmId: servicePlan.id enabled: true httpsOnly: true - virtualNetworkSubnetId: functionSubnetId + virtualNetworkSubnetId: apiFunctionSubnetId keyVaultReferenceIdentity: appConfigIdentity.id } dependsOn: [ @@ -258,6 +263,27 @@ resource functionApp 'Microsoft.Web/sites@2022-09-01' = { ] } + +resource migrationFunctionApp 'Microsoft.Web/sites@2022-09-01' = { + name: migrationFunctionName + location: location + kind: 'functionapp,linux' + identity: { + type: 'UserAssigned' + userAssignedIdentities: userAssignedIdentities + } + properties: { + serverFarmId: servicePlan.id + enabled: true + httpsOnly: true + virtualNetworkSubnetId: migrationFunctionSubnetId + keyVaultReferenceIdentity: appConfigIdentity.id + } + dependsOn: [ + appConfigIdentity + sqlIdentity + ] +} //TODO: Clear segregation with DXTR vs ACMS variable/secret naming in GitHub and ADO secret libraries var applicationSettings = concat( @@ -410,8 +436,8 @@ var ipSecurityRestrictionsRules = concat( : [] ) -resource functionAppConfig 'Microsoft.Web/sites/config@2022-09-01' = { - parent: functionApp +resource apiFunctionConfig 'Microsoft.Web/sites/config@2022-09-01' = { + parent: apiFunctionApp name: 'web' properties: { cors: { @@ -441,14 +467,60 @@ resource functionAppConfig 'Microsoft.Web/sites/config@2022-09-01' = { } } -module privateEndpoint './lib/network/subnet-private-endpoint.bicep' = { - name: '${functionName}-pep-module' +resource migrationFunctionConfig 'Microsoft.Web/sites/config@2022-09-01' = { + parent: migrationFunctionApp + name: 'web' + properties: { + cors: { + allowedOrigins: corsAllowOrigins + } + numberOfWorkers: 1 + alwaysOn: true + http20Enabled: true + functionAppScaleLimit: 0 + minimumElasticInstanceCount: 0 + publicNetworkAccess: 'Enabled' + ipSecurityRestrictions: ipSecurityRestrictionsRules + ipSecurityRestrictionsDefaultAction: 'Deny' + scmIpSecurityRestrictions: [ + { + ipAddress: 'Any' + action: 'Deny' + priority: 2147483647 + name: 'Deny all' + description: 'Deny all access' + } + ] + scmIpSecurityRestrictionsDefaultAction: 'Deny' + scmIpSecurityRestrictionsUseMain: false + linuxFxVersion: linuxFxVersionMap['${functionsRuntime}'] + appSettings: applicationSettings + } +} + +module apiPrivateEndpoint './lib/network/subnet-private-endpoint.bicep' = { + name: '${apiFunctionName}-pep-module' scope: resourceGroup(virtualNetworkResourceGroupName) params: { privateLinkGroup: 'sites' - stackName: functionName + stackName: apiFunctionName location: location - privateLinkServiceId: functionApp.id + privateLinkServiceId: apiFunctionApp.id + privateEndpointSubnetId: privateEndpointSubnetId + privateDnsZoneName: privateDnsZoneName + privateDnsZoneResourceGroup: privateDnsZoneResourceGroup + privateDnsZoneSubscriptionId: privateDnsZoneSubscriptionId + } +} + +module migrationFunctionPrivateEndpoint './lib/network/subnet-private-endpoint.bicep' = { + name: '${migrationFunctionName}-pep-module' + scope: resourceGroup(virtualNetworkResourceGroupName) + params: { + privateLinkGroup: 'sites' + stackName: migrationFunctionName + location: location + privateLinkServiceId: migrationFunctionApp.id privateEndpointSubnetId: privateEndpointSubnetId privateDnsZoneName: privateDnsZoneName privateDnsZoneResourceGroup: privateDnsZoneResourceGroup @@ -458,25 +530,35 @@ module privateEndpoint './lib/network/subnet-private-endpoint.bicep' = { var createSqlServerVnetRule = !empty(sqlServerResourceGroupName) && !empty(sqlServerName) && !isUstpDeployment -module setSqlServerVnetRule './lib/network/sql-vnet-rule.bicep' = if (createSqlServerVnetRule) { +module setMigrationFunctionSqlServerVnetRule './lib/network/sql-vnet-rule.bicep' = if (createSqlServerVnetRule) { + scope: resourceGroup(sqlServerResourceGroupName) + name: '${apiFunctionName}-sql-vnet-rule-module' + params: { + stackName: migrationFunctionName + sqlServerName: sqlServerName + subnetId: apiFunctionSubnetId + } +} + +module setApiFunctionSqlServerVnetRule './lib/network/sql-vnet-rule.bicep' = if (createSqlServerVnetRule) { scope: resourceGroup(sqlServerResourceGroupName) - name: '${functionName}-sql-vnet-rule-module' + name: '${apiFunctionName}-sql-vnet-rule-module' params: { - stackName: functionName + stackName: apiFunctionName sqlServerName: sqlServerName - subnetId: functionSubnetId + subnetId: apiFunctionSubnetId } } -// Creates a managed identity that would be used to grant access to functionapp instance -var sqlIdentityName = !empty(sqlServerIdentityName) ? sqlServerIdentityName : 'id-sql-${functionName}-readonly' +// Creates a managed identity that would be used to grant access to function instance +var sqlIdentityName = !empty(sqlServerIdentityName) ? sqlServerIdentityName : 'id-sql-${apiFunctionName}-readonly' var sqlIdentityRG = !empty(sqlServerIdentityResourceGroupName) ? sqlServerIdentityResourceGroupName : sqlServerResourceGroupName module sqlManagedIdentity './lib/identity/managed-identity.bicep' = if (createSqlServerVnetRule) { scope: resourceGroup(sqlIdentityRG) - name: '${functionName}-sql-identity-module' + name: '${apiFunctionName}-sql-identity-module' params: { managedIdentityName: sqlIdentityName location: location @@ -488,7 +570,8 @@ resource sqlIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-3 scope: resourceGroup(sqlIdentityRG) } -output functionAppName string = functionApp.name -output functionAppId string = functionApp.id -output createdSqlServerVnetRule bool = createSqlServerVnetRule -output keyVaultId string = functionApp.properties.keyVaultReferenceIdentity +// output apiFunctionAppName string = apiFunctionApp.name +// output apiFunctionAppId string = apiFunctionApp.id +// output migrationFunctionAppId string = migrationFunctionApp.id +// output createdSqlServerVnetRule bool = createSqlServerVnetRule +// output keyVaultId string = apiFunctionApp.properties.keyVaultReferenceIdentity diff --git a/ops/cloud-deployment/frontend-webapp-deploy.bicep b/ops/cloud-deployment/frontend-webapp-deploy.bicep index 8c04db27d..505fd4a35 100644 --- a/ops/cloud-deployment/frontend-webapp-deploy.bicep +++ b/ops/cloud-deployment/frontend-webapp-deploy.bicep @@ -316,6 +316,6 @@ module privateEndpoint './lib/network/subnet-private-endpoint.bicep' = { privateDnsZoneSubscriptionId: privateDnsZoneSubscriptionId } } -output webappName string = webapp.name -output webappId string = webapp.id -output webappUrl string = webapp.properties.hostNameSslStates[0].name +// output webappName string = webapp.name +// output webappId string = webapp.id +// output webappUrl string = webapp.properties.hostNameSslStates[0].name diff --git a/ops/cloud-deployment/lib/network/ustp-cams-network.bicep b/ops/cloud-deployment/lib/network/ustp-cams-network.bicep index 6748c0c46..f6a0872a2 100644 --- a/ops/cloud-deployment/lib/network/ustp-cams-network.bicep +++ b/ops/cloud-deployment/lib/network/ustp-cams-network.bicep @@ -14,17 +14,23 @@ param virtualNetworkName string = 'vnet-${stackName}' param linkVnetIds array = [] -param vnetAddressPrefix array = [ '10.10.0.0/16' ] +param vnetAddressPrefix array = ['10.10.0.0/16'] -param functionName string = '${stackName}-node-api' +param apiFunctionName string = '${stackName}-node-api' -param functionSubnetName string = 'snet-${functionName}' +param apiFunctionSubnetName string = 'snet-${apiFunctionName}' -param functionSubnetAddressPrefix string = '10.10.11.0/28' +param apiFunctionSubnetAddressPrefix string = '10.10.11.0/28' + +param migrationFunctionName string = '${stackName}-migration' + +param migrationSubnetAddressPrefix string = '10.10.14.0/28' + +param migrationSubnetName string = 'snet-${migrationFunctionName}' param webappName string = '${stackName}-node-api' -param webappSubnetName string = 'snet-${functionName}' +param webappSubnetName string = 'snet-${apiFunctionName}' param webappSubnetAddressPrefix string = '10.10.10.0/28' @@ -41,35 +47,32 @@ param privateDnsZoneResourceGroup string = networkResourceGroupName @description('Private DNS Zone subscription, all 3 params here are set because the Prod environment uses a different subscription and RG for these') param privateDnsZoneSubscriptionId string = subscription().subscriptionId - - -module targetVnet './vnet.bicep' = - if (deployVnet) { - name: '${stackName}-vnet-module' - scope: resourceGroup(networkResourceGroupName) - params: { - vnetName: virtualNetworkName - vnetAddressPrefix: vnetAddressPrefix - location: location - } +module targetVnet './vnet.bicep' = if (deployVnet) { + name: '${stackName}-vnet-module' + scope: resourceGroup(networkResourceGroupName) + params: { + vnetName: virtualNetworkName + vnetAddressPrefix: vnetAddressPrefix + location: location } +} resource ustpVirtualNetwork 'Microsoft.Network/virtualNetworks@2022-09-01' existing = { name: virtualNetworkName scope: resourceGroup(networkResourceGroupName) } -module ustpDnsZones './private-dns-zones.bicep' ={ - name: '${stackName}-network-dns-module' - scope: resourceGroup(privateDnsZoneSubscriptionId, privateDnsZoneResourceGroup) - params: { - stackName: stackName - virtualNetworkId: ustpVirtualNetwork.id - linkVnetIds: linkVnetIds - privateDnsZoneName: privateDnsZoneName - deployDns: deployDns - privateDnsZoneSubscriptionId: privateDnsZoneSubscriptionId - privateDnsZoneResourceGroup: privateDnsZoneResourceGroup +module ustpDnsZones './private-dns-zones.bicep' = { + name: '${stackName}-network-dns-module' + scope: resourceGroup(privateDnsZoneSubscriptionId, privateDnsZoneResourceGroup) + params: { + stackName: stackName + virtualNetworkId: ustpVirtualNetwork.id + linkVnetIds: linkVnetIds + privateDnsZoneName: privateDnsZoneName + deployDns: deployDns + privateDnsZoneSubscriptionId: privateDnsZoneSubscriptionId + privateDnsZoneResourceGroup: privateDnsZoneResourceGroup } } @@ -104,13 +107,50 @@ module privateEndpointSubnet './subnet.bicep' = { ] } -module functionSubnet './subnet.bicep' = { - name: '${functionName}-subnet-module' +module apiFunctionSubnet './subnet.bicep' = { + name: '${apiFunctionName}-subnet-module' + scope: resourceGroup(networkResourceGroupName) + params: { + virtualNetworkName: virtualNetworkName + subnetName: apiFunctionSubnetName + subnetAddressPrefix: apiFunctionSubnetAddressPrefix + subnetServiceEndpoints: [ + { + service: 'Microsoft.Sql' + locations: [ + location + ] + } + { + service: 'Microsoft.AzureCosmosDB' + locations: [ + location + ] + } + ] + subnetDelegations: [ + { + name: 'Microsoft.Web/serverfarms' + properties: { + serviceName: 'Microsoft.Web/serverfarms' + } + } + ] + } + dependsOn: [ + ustpVirtualNetwork + ustpDnsZones + privateEndpointSubnet + ] +} + +module migrationFunctionSubnet './subnet.bicep' = { + name: '${migrationFunctionName}-subnet-module' scope: resourceGroup(networkResourceGroupName) params: { virtualNetworkName: virtualNetworkName - subnetName: functionSubnetName - subnetAddressPrefix: functionSubnetAddressPrefix + subnetName: migrationSubnetName + subnetAddressPrefix: migrationSubnetAddressPrefix subnetServiceEndpoints: [ { service: 'Microsoft.Sql' @@ -161,13 +201,18 @@ module webappSubnet './subnet.bicep' = { dependsOn: [ ustpVirtualNetwork ustpDnsZones - functionSubnet + apiFunctionSubnet ] } output privateEndpointSubnetName string = privateEndpointSubnet.outputs.subnetName output privateEndpointSubnetId string = privateEndpointSubnet.outputs.subnetId -output functionSubnetId string = functionSubnet.outputs.subnetId +output apiFunctionSubnetId string = apiFunctionSubnet.outputs.subnetId output webappSubnetId string = webappSubnet.outputs.subnetId +output migrationFunctionSubnetId string = migrationFunctionSubnet.outputs.subnetId output privateDnsZoneId string = ustpDnsZones.outputs.privateDnsZoneId -output cosmosDbAllowedSubnets array = [privateEndpointSubnet.outputs.subnetId, functionSubnet.outputs.subnetId] +output cosmosDbAllowedSubnets array = [ + privateEndpointSubnet.outputs.subnetId + apiFunctionSubnet.outputs.subnetId + migrationFunctionSubnet.outputs.subnetId +] diff --git a/ops/cloud-deployment/main.bicep b/ops/cloud-deployment/main.bicep index f0eeafabc..57de1f52f 100644 --- a/ops/cloud-deployment/main.bicep +++ b/ops/cloud-deployment/main.bicep @@ -44,11 +44,17 @@ param webappSubnetAddressPrefix string = '10.10.10.0/28' ]) param webappPlanType string = 'P1v2' -param functionName string = '${stackName}-node-api' +param apiFunctionName string = '${stackName}-node-api' -param functionSubnetName string = 'snet-${functionName}' +param apiFunctionSubnetName string = 'snet-${apiFunctionName}' -param functionSubnetAddressPrefix string = '10.10.11.0/28' +param apiFunctionSubnetAddressPrefix string = '10.10.11.0/28' + +param migrationFunctionName string = '${stackName}-migration' + +param migrationSubnetAddressPrefix string = '10.10.14.0/28' + +param migrationSubnetName string = 'snet-${migrationFunctionName}' @description('Plan type to determine functionapp service plan Sku') @allowed([ @@ -139,9 +145,12 @@ module network './lib//network/ustp-cams-network.bicep' = { networkResourceGroupName: networkResourceGroupName deployVnet: deployVnet location: location - functionName: functionName - functionSubnetName: functionSubnetName - functionSubnetAddressPrefix: functionSubnetAddressPrefix + apiFunctionName: apiFunctionName + apiFunctionSubnetName: apiFunctionSubnetName + apiFunctionSubnetAddressPrefix: apiFunctionSubnetAddressPrefix + migrationFunctionName: migrationFunctionName + migrationSubnetAddressPrefix: migrationSubnetAddressPrefix + migrationSubnetName: migrationSubnetName webappName: webappName webappSubnetAddressPrefix: webappSubnetAddressPrefix webappSubnetName: webappSubnetName @@ -172,7 +181,7 @@ module ustpWebapp 'frontend-webapp-deploy.bicep' = { createAlerts: createAlerts actionGroupName: actionGroupName actionGroupResourceGroupName: analyticsResourceGroupName - targetApiServerHost: '${functionName}.azurewebsites${azHostSuffix} ${functionName}-${slotName}.azurewebsites${azHostSuffix}' //adding both production and slot hostname to CSP + targetApiServerHost: '${apiFunctionName}.azurewebsites${azHostSuffix} ${apiFunctionName}-${slotName}.azurewebsites${azHostSuffix}' //adding both production and slot hostname to CSP ustpIssueCollectorHash: ustpIssueCollectorHash camsReactSelectHash: camsReactSelectHash webappSubnetId: network.outputs.webappSubnetId @@ -196,10 +205,12 @@ module ustpFunctions 'backend-api-deploy.bicep' = { analyticsWorkspaceId: analyticsWorkspaceId location: location planType: functionPlanType - planName: 'plan-${functionName}' - functionName: functionName + planName: 'plan-${stackName}-functions' + apiFunctionName: apiFunctionName + apiFunctionSubnetId: network.outputs.apiFunctionSubnetId + migrationFunctionName: migrationFunctionName + migrationFunctionSubnetId: network.outputs.migrationFunctionSubnetId functionsRuntime: 'node' - functionSubnetId: network.outputs.functionSubnetId sqlServerName: sqlServerName sqlServerResourceGroupName: sqlServerResourceGroupName sqlServerIdentityName: sqlServerIdentityName @@ -230,9 +241,9 @@ module ustpFunctions 'backend-api-deploy.bicep' = { // main.bicep outputs -resource identityKeyVaultAppConfig 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' existing = { - name: idKeyvaultAppConfiguration - scope: resourceGroup(kvAppConfigResourceGroupName) -} -output keyVaultId string = identityKeyVaultAppConfig.id -output keyVaultManagedIdName string = identityKeyVaultAppConfig.name +// resource identityKeyVaultAppConfig 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' existing = { +// name: idKeyvaultAppConfiguration +// scope: resourceGroup(kvAppConfigResourceGroupName) +// } +// output keyVaultId string = identityKeyVaultAppConfig.id +// output keyVaultManagedIdName string = identityKeyVaultAppConfig.name diff --git a/ops/scripts/pipeline/azure-deploy.sh b/ops/scripts/pipeline/azure-deploy.sh index 8af2415ac..cd51ef69f 100755 --- a/ops/scripts/pipeline/azure-deploy.sh +++ b/ops/scripts/pipeline/azure-deploy.sh @@ -16,12 +16,12 @@ deployment_parameters='' is_ustp_deployment=false inputParams=() -requiredUSTPParams=("--mssqlRequestTimeout" "--isUstpDeployment" "--resource-group" "--file" "--stackName" "--networkResourceGroupName" "--virtualNetworkName" "--analyticsWorkspaceId" "--idKeyvaultAppConfiguration" "--kvAppConfigName" "--cosmosDatabaseName" "--deployVnet" "--camsReactSelectHash" "--ustpIssueCollectorHash" "--createAlerts" "--deployAppInsights" "--functionPlanType" "--webappPlanType" "--loginProvider" "--loginProviderConfig" "--sqlServerName" "--sqlServerResourceGroupName" "--oktaUrl" "--location" "--webappSubnetName" "--functionSubnetName" "--privateEndpointSubnetName" "--webappSubnetAddressPrefix" "--privateEndpointSubnetAddressPrefix" "--functionSubnetAddressPrefix" "--privateDnsZoneName" "--privateDnsZoneResourceGroup" "--privateDnsZoneSubscriptionId" "--analyticsResourceGroupName" "--kvAppConfigResourceGroupName" "--deployDns") +requiredUSTPParams=("--mssqlRequestTimeout" "--isUstpDeployment" "--resource-group" "--file" "--stackName" "--networkResourceGroupName" "--virtualNetworkName" "--analyticsWorkspaceId" "--idKeyvaultAppConfiguration" "--kvAppConfigName" "--cosmosDatabaseName" "--deployVnet" "--camsReactSelectHash" "--ustpIssueCollectorHash" "--createAlerts" "--deployAppInsights" "--functionPlanType" "--webappPlanType" "--loginProvider" "--loginProviderConfig" "--sqlServerName" "--sqlServerResourceGroupName" "--oktaUrl" "--location" "--webappSubnetName" "--apiFunctionSubnetName" "--privateEndpointSubnetName" "--webappSubnetAddressPrefix" "--privateEndpointSubnetAddressPrefix" "--apiFunctionSubnetAddressPrefix" "--migrationSubnetName" "--migrationSubnetAddressPrefix" "--privateDnsZoneName" "--privateDnsZoneResourceGroup" "--privateDnsZoneSubscriptionId" "--analyticsResourceGroupName" "--kvAppConfigResourceGroupName" "--deployDns") requiredFlexionParams=("--mssqlRequestTimeout" "--resource-group" "--file" "--stackName" "--networkResourceGroupName" "--kvAppConfigName" "--kvAppConfigResourceGroupName" "--virtualNetworkName" "--analyticsWorkspaceId" "--idKeyvaultAppConfiguration" "--cosmosDatabaseName" "--deployVnet" "--camsReactSelectHash" "--ustpIssueCollectorHash" "--createAlerts" "--deployAppInsights" "--functionPlanType" "--webappPlanType" "--loginProvider" "--loginProviderConfig" "--sqlServerName" "--sqlServerResourceGroupName" "--sqlServerIdentityName" "--actionGroupName" "--oktaUrl") # shellcheck disable=SC2034 # REASON: to have a reference for all possible parameters -allParams=("--mssqlRequestTimeout" "--isUstpDeployment" "--resource-group" "--file" "--stackName" "--networkResourceGroupName" "--virtualNetworkName" "--analyticsWorkspaceId" "--idKeyvaultAppConfiguration" "--kvAppConfigName" "--cosmosDatabaseName" "--deployVnet" "--camsReactSelectHash" "--ustpIssueCollectorHash" "--createAlerts" "--deployAppInsights" "--functionPlanType" "--webappPlanType" "--loginProvider" "--loginProviderConfig" "--sqlServerName" "--sqlServerResourceGroupName" "--sqlServerIdentityResourceGroupName" "--sqlServerIdentityName" "--actionGroupName" "--oktaUrl" "--location" "--webappSubnetName" "--functionSubnetName" "--privateEndpointSubnetName" "--webappSubnetAddressPrefix" "--functionSubnetAddressPrefix" "--vnetAddressPrefix" "--linkVnetIds" "--privateDnsZoneName" "--privateDnsZoneResourceGroup" "--privateDnsZoneSubscriptionId" "--analyticsResourceGroupName" "--kvAppConfigResourceGroupName" "--deployDns" "--azHostSuffix" "--allowVeracodeScan") +allParams=("--mssqlRequestTimeout" "--isUstpDeployment" "--resource-group" "--file" "--stackName" "--networkResourceGroupName" "--virtualNetworkName" "--analyticsWorkspaceId" "--idKeyvaultAppConfiguration" "--kvAppConfigName" "--cosmosDatabaseName" "--deployVnet" "--camsReactSelectHash" "--ustpIssueCollectorHash" "--createAlerts" "--deployAppInsights" "--functionPlanType" "--webappPlanType" "--loginProvider" "--loginProviderConfig" "--sqlServerName" "--sqlServerResourceGroupName" "--sqlServerIdentityResourceGroupName" "--sqlServerIdentityName" "--actionGroupName" "--oktaUrl" "--location" "--webappSubnetName" "--apiFunctionSubnetName" "--privateEndpointSubnetName" "--webappSubnetAddressPrefix" "--apiFunctionSubnetAddressPrefix" "--migrationSubnetName" "--migrationSubnetAddressPrefix" "--vnetAddressPrefix" "--linkVnetIds" "--privateDnsZoneName" "--privateDnsZoneResourceGroup" "--privateDnsZoneSubscriptionId" "--analyticsResourceGroupName" "--kvAppConfigResourceGroupName" "--deployDns" "--azHostSuffix" "--allowVeracodeScan") function az_vnet_exists_func() { @@ -158,16 +158,28 @@ while [[ $# -gt 0 ]]; do deployment_parameters="${deployment_parameters} ${webapp_subnet_address_prefix_param}" shift 2 ;; - --functionSubnetName) + --apiFunctionSubnetName) inputParams+=("${1}") - function_subnet_name_param="functionSubnetName=${2}" - deployment_parameters="${deployment_parameters} ${function_subnet_name_param}" + api_function_subnet_name_param="apiFunctionSubnetName=${2}" + deployment_parameters="${deployment_parameters} ${api_function_subnet_name_param}" shift 2 ;; - --functionSubnetAddressPrefix) + --apiFunctionSubnetAddressPrefix) inputParams+=("${1}") - function_subnet_address_prefix_param="functionSubnetAddressPrefix=${2}" - deployment_parameters="${deployment_parameters} ${function_subnet_address_prefix_param}" + api_function_subnet_address_prefix_param="apiFunctionSubnetAddressPrefix=${2}" + deployment_parameters="${deployment_parameters} ${api_function_subnet_address_prefix_param}" + shift 2 + ;; + --migrationFunctionSubnetName) + inputParams+=("${1}") + migration_function_subnet_name_param="migrationFunctionSubnetName=${2}" + deployment_parameters="${deployment_parameters} ${migration_function_subnet_name_param}" + shift 2 + ;; + --migrationFunctionSubnetAddressPrefix) + inputParams+=("${1}") + migration_function_subnet_address_prefix_param="migrationFunctionSubnetAddressPrefix=${2}" + deployment_parameters="${deployment_parameters} ${migration_function_subnet_address_prefix_param}" shift 2 ;; --privateEndpointSubnetName) diff --git a/ops/scripts/pipeline/endpoint-test.sh b/ops/scripts/pipeline/endpoint-test.sh index 059b1a3ed..4c6e21e1d 100755 --- a/ops/scripts/pipeline/endpoint-test.sh +++ b/ops/scripts/pipeline/endpoint-test.sh @@ -2,7 +2,7 @@ # Title: endpoint-test.sh # Description: Verify 200 response from frontend and backend -# Usage: ./endpoint-test.sh --webappName webappName --apiName apiName --slot slotName --hostSuffix hostSuffix +# Usage: ./endpoint-test.sh --webappName webappName --apiFunctionName apiFunctionName --slot slotName --hostSuffix hostSuffix # # Exitcodes # ========== @@ -18,11 +18,11 @@ isLocalRun='' while [[ $# -gt 0 ]]; do case $1 in -h | --help) - echo "./endpoint-test.sh --webappName webappName --apiName apiName --slot slotName --hostSuffix hostSuffix" + echo "./endpoint-test.sh --webappName webappName --apiFunctionName apiFunctionName --slot slotName --hostSuffix hostSuffix" exit 0 ;; - --apiName) + --apiFunctionName) api_name="${2}" shift 2 ;; diff --git a/ops/scripts/pipeline/slots/az-slot-api-resource-deploy.sh b/ops/scripts/pipeline/slots/az-slot-api-resource-deploy.sh index 2177855c8..d21bdebed 100755 --- a/ops/scripts/pipeline/slots/az-slot-api-resource-deploy.sh +++ b/ops/scripts/pipeline/slots/az-slot-api-resource-deploy.sh @@ -2,7 +2,7 @@ # Title: az-slot-api-resource-deploy.sh # Description: Helper script to provision Azure slot deployment resources for Azure functionapp api -# Usage: ./az-slot-api-resource-deploy.sh -h --resourceGroup resourceGroupName --idResourceGroup managedIdResourceGroup --webappName webappName --apiName functionappName --slotName staging --kvIdName kvManagedIdName --sqlIdName sqlManagedIdName --cosmosIdName cosmosManagedIdName --storageAccName apiStorageAccountName --databaseName cosmosDbName --infoSha environmentHash --isUstpDeployment +# Usage: ./az-slot-api-resource-deploy.sh -h --resourceGroup resourceGroupName --idResourceGroup managedIdResourceGroup --webappName webappName --apiFunctionName functionappName --slotName staging --kvIdName kvManagedIdName --sqlIdName sqlManagedIdName --cosmosIdName cosmosManagedIdName --apiStorageAccName apiStorageAccountName --databaseName cosmosDbName --infoSha environmentHash --isUstpDeployment # # Exitcodes # ========== @@ -18,7 +18,7 @@ info_sha='' while [[ $# -gt 0 ]]; do case $1 in -h | --help) - echo "USAGE: az-slot-api-resource-deploy.sh -h --resourceGroup resourceGroupName --idResourceGroup managedIdResourceGroup --webappName webappName --apiName functionappName --slotName staging --kvIdName kvManagedIdName --sqlIdName sqlManagedIdName --storageAccName apiStorageAccountName --databaseName cosmosDbName --infoSha environmentHash" + echo "USAGE: az-slot-api-resource-deploy.sh -h --resourceGroup resourceGroupName --idResourceGroup managedIdResourceGroup --webappName webappName --apiFunctionName functionappName --slotName staging --kvIdName kvManagedIdName --sqlIdName sqlManagedIdName --apiStorageAccName apiStorageAccountName --databaseName cosmosDbName --infoSha environmentHash" exit 0 ;; --resourceGroup) @@ -31,8 +31,13 @@ while [[ $# -gt 0 ]]; do shift 2 ;; - --apiName) - api_name="${2}" + --apiFunctionName) + api_function_name="${2}" + shift 2 + ;; + + --migrationFunctionName) + migration_function_name="${2}" shift 2 ;; @@ -54,8 +59,12 @@ while [[ $# -gt 0 ]]; do sql_id_name="${2}" shift 2 ;; - --storageAccName) - storage_acc_name="${2}" + --apiStorageAccName) + api_storage_acc_name="${2}" + shift 2 + ;; + --migrationStorageAccName) + migration_storage_acc_name="${2}" shift 2 ;; --databaseName) @@ -78,14 +87,21 @@ done #Function App Slot Deployment and Configuration echo "Creating Storage account for Node API Slot..." -az storage account create --name "$storage_acc_name" --resource-group "$app_rg" -o json -storage_acc_key=$(az storage account keys list -g "$app_rg" --account-name "$storage_acc_name" --query '[0].value' -o tsv) +az storage account create --name "$api_storage_acc_name" --resource-group "$app_rg" -o json -echo "Creating Node API Staging Slot..." -az functionapp deployment slot create --name "$api_name" --resource-group "$app_rg" --slot "$slot_name" --configuration-source "$api_name" +az storage account create --name "$migration_storage_acc_name" --resource-group "$app_rg" -o json + +api_storage_acc_key=$(az storage account keys list -g "$app_rg" --account-name "$api_storage_acc_name" --query '[0].value' -o tsv) +migration_storage_acc_key=$(az storage account keys list -g "$app_rg" --account-name "$migration_storage_acc_name" --query '[0].value' -o tsv) -echo "Setting deployment slot settings for storage account and cosmos database for e2e testing..." +echo "Creating API Function Staging Slot..." +az functionapp deployment slot create --name "$api_function_name" --resource-group "$app_rg" --slot "$slot_name" --configuration-source "$api_function_name" + +echo "Creating Node API Function Staging Slot..." +az functionapp deployment slot create --name "$migration_function_name" --resource-group "$app_rg" --slot "$slot_name" --configuration-source "$migration_function_name" + +echo "Setting deployment slot settings for storage account and cosmos database for e2e testing..." databaseName=$database_name if [[ ${is_ustp_deployment} == true ]]; then @@ -102,13 +118,13 @@ echo "Database Name :${databaseName}" commitSha=$(git rev-parse HEAD) -az functionapp config appsettings set -g "$app_rg" -n "$api_name" --slot "$slot_name" --settings "INFO_SHA=$commitSha" --slot-settings COSMOS_DATABASE_NAME="$databaseName" MyTaskHub="${slot_name}" AzureWebJobsStorage="DefaultEndpointsProtocol=https;AccountName=${storage_acc_name};EndpointSuffix=core.usgovcloudapi.net;AccountKey=${storage_acc_key}" +az functionapp config appsettings set -g "$app_rg" -n "$api_function_name" --slot "$slot_name" --settings "INFO_SHA=$commitSha" --slot-settings COSMOS_DATABASE_NAME="$databaseName" MyTaskHub="${slot_name}" AzureWebJobsStorage="DefaultEndpointsProtocol=https;AccountName=${api_storage_acc_name};EndpointSuffix=core.usgovcloudapi.net;AccountKey=${api_storage_acc_key}" +az functionapp config appsettings set -g "$app_rg" -n "$migration_function_name" --slot "$slot_name" --settings "INFO_SHA=$commitSha" --slot-settings COSMOS_DATABASE_NAME="$databaseName" MyTaskHub="${slot_name}" AzureWebJobsStorage="DefaultEndpointsProtocol=https;AccountName=${migration_storage_acc_name};EndpointSuffix=core.usgovcloudapi.net;AccountKey=${migration_storage_acc_key}" echo "Setting CORS Allowed origins for the API..." -az functionapp cors add -g "$app_rg" --name "$api_name" --slot "$slot_name" --allowed-origins "https://${webapp_name}-${slot_name}.azurewebsites.us" +az functionapp cors add -g "$app_rg" --name "$api_function_name" --slot "$slot_name" --allowed-origins "https://${webapp_name}-${slot_name}.azurewebsites.us" -echo "Assigning managed Identities..." # Identities occasionally come through with improper id for usage here, this constructs that kv_ref_id=$(az identity list -g "$id_rg" --query "[?name == '$kv_id_name'].id" -o tsv) identities="$kv_ref_id" @@ -118,11 +134,21 @@ if [[ ${sql_id_name} != null && ${sql_id_name} != '' ]]; then identities="$identities $sql_ref_id" fi + +echo "Assigning managed Identities API Function App..." # shellcheck disable=SC2086 # REASON: Adds unwanted quotes after --identities -az functionapp identity assign -g "$app_rg" -n "$api_name" --slot "$slot_name" --identities $identities +az functionapp identity assign -g "$app_rg" -n "$api_function_name" --slot "$slot_name" --identities $identities + +echo "Assigning managed Identities to Migration Function App..." +# shellcheck disable=SC2086 # REASON: Adds unwanted quotes after --identities +az functionapp identity assign -g "$app_rg" -n "$migration_function_name" --slot "$slot_name" --identities $identities + +echo "Setting KeyVaultReferenceIdentity API Function App..." +az functionapp update --resource-group "$app_rg" --name "$api_function_name" --slot "$slot_name" --set keyVaultReferenceIdentity="$kv_ref_id" -echo "Setting KeyVaultReferenceIdentity..." -az functionapp update --resource-group "$app_rg" --name "$api_name" --slot "$slot_name" --set keyVaultReferenceIdentity="$kv_ref_id" +echo "Setting KeyVaultReferenceIdentity for Migration Function App..." +az functionapp update --resource-group "$app_rg" --name "$api_function_name" --slot "$slot_name" --set keyVaultReferenceIdentity="$kv_ref_id" +#TODO: deal with traffic routing if we want to test # shellcheck disable=SC2086 -az webapp traffic-routing set --distribution ${slot_name}=0 --name "${api_name}" --resource-group "${app_rg}" +az webapp traffic-routing set --distribution ${slot_name}=0 --name "${api_function_name}" --resource-group "${app_rg}" diff --git a/ops/scripts/pipeline/slots/az-slot-web-resource-deploy.sh b/ops/scripts/pipeline/slots/az-slot-web-resource-deploy.sh index 21d6ea11f..7442c7adc 100755 --- a/ops/scripts/pipeline/slots/az-slot-web-resource-deploy.sh +++ b/ops/scripts/pipeline/slots/az-slot-web-resource-deploy.sh @@ -2,7 +2,7 @@ # Title: az-slot-web-resource-deploy.sh # Description: Helper script to provision Azure slot deployment resources for Azure webapp -# Usage: ./az-slot-web-resource-deploy.sh -h --resourceGroup resourceGroupName --webappName webappName --apiName apiName --slotName staging --subscription networkSubscription --network-rg networkResourceGroup --vnet vnetName --subnet webappSubnetName" +# Usage: ./az-slot-web-resource-deploy.sh -h --resourceGroup resourceGroupName --webappName webappName --apiFunctionName apiFunctionName --slotName staging --subscription networkSubscription --network-rg networkResourceGroup --vnet vnetName --subnet webappSubnetName" # # Exitcodes # ========== @@ -15,7 +15,7 @@ set -euo pipefail # ensure job step fails in CI pipeline when error occurs while [[ $# -gt 0 ]]; do case $1 in -h | --help) - echo "USAGE: az-slot-web-resource-deploy.sh -h --resourceGroup resourceGroupName --webappName webappName --apiName apiName --slotName staging --subscription networkSubscription --network-rg networkResourceGroup --vnet vnetName --subnet webappSubnetName" + echo "USAGE: az-slot-web-resource-deploy.sh -h --resourceGroup resourceGroupName --webappName webappName --apiFunctionName apiFunctionName --slotName staging --subscription networkSubscription --network-rg networkResourceGroup --vnet vnetName --subnet webappSubnetName" exit 0 ;; --resourceGroup) @@ -27,7 +27,7 @@ while [[ $# -gt 0 ]]; do shift 2 ;; - --apiName) + --apiFunctionName) api_name="${2}" shift 2 ;; diff --git a/ops/scripts/utility/clean-install-all-projects.sh b/ops/scripts/utility/clean-install-all-projects.sh index bec66001e..49d4e4b4c 100755 --- a/ops/scripts/utility/clean-install-all-projects.sh +++ b/ops/scripts/utility/clean-install-all-projects.sh @@ -6,11 +6,11 @@ # From the root directory, run the following command: # ./ops/scripts/utility/clean-all-projects.sh -PROJECTS=("backend" "common" "dev-tools" "test/e2e" "user-interface") +PROJECTS=("backend" "backend/functions/api" "backend/functions/migration" "common" "dev-tools" "test/e2e" "user-interface") for str in "${PROJECTS[@]}"; do pushd "${str}" || exit - echo "Cleaning ${str}." + echo "Clean installing ${str}." npm ci popd || exit done diff --git a/package.json b/package.json index 5ce5ce99c..5b1673ea4 100644 --- a/package.json +++ b/package.json @@ -7,12 +7,12 @@ "scripts": { "clean:all": "./ops/scripts/utility/clean-all-projects.sh", "ci:all": "./ops/scripts/utility/clean-install-all-projects.sh", - "start:backend": "cd backend && npm run start", - "start:frontend": "cd user-interface && npm run start", + "start:backend": "pushd backend && npm run start && popd", + "start:frontend": "pushd user-interface && npm run start && popd", "build": "npm run build:common && npm run build:backend && npm run build:frontend", - "build:backend": "cd backend && npm run build", - "build:frontend": "cd user-interface && npm run build", - "build:common": "cd common && npm run build", + "build:backend": "pushd backend && npm run build && npm run build:api && npm run build:migration && popd", + "build:frontend": "pushd user-interface && npm run build && popd", + "build:common": "pushd common && npm run build && popd", "clean-and-build": "npm run clean:all && npm run ci:all && npm run build" } } From cbb097d23ed88233128468414e8c098aeab6ad10 Mon Sep 17 00:00:00 2001 From: Arthur Morrow Date: Mon, 9 Dec 2024 09:02:32 -0500 Subject: [PATCH 07/49] edited workflow to run ci properly on newly split functions Jira ticket: CAMS-461 --- .github/workflows/sub-build.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sub-build.yml b/.github/workflows/sub-build.yml index 3d9e0d5fd..f98f3ca50 100644 --- a/.github/workflows/sub-build.yml +++ b/.github/workflows/sub-build.yml @@ -100,8 +100,17 @@ jobs: npm ci popd + pushd ./functions/api npm ci - npm run build + popd + + npm run build:api + + npm pushd ./functions/migration + npm ci + popd + + npm run build:migration - name: Package API run: OUT=${{ inputs.apiFunctionName }} npm run pack From 0a9eb9e447794a1466a86d76998cdf77836e56de Mon Sep 17 00:00:00 2001 From: Arthur Morrow Date: Mon, 9 Dec 2024 09:18:46 -0500 Subject: [PATCH 08/49] corrected paths in pushd Jira ticket: CAMS-461 --- .github/workflows/sub-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sub-build.yml b/.github/workflows/sub-build.yml index f98f3ca50..1f9d1fe29 100644 --- a/.github/workflows/sub-build.yml +++ b/.github/workflows/sub-build.yml @@ -100,13 +100,13 @@ jobs: npm ci popd - pushd ./functions/api + pushd functions/api npm ci popd npm run build:api - npm pushd ./functions/migration + npm pushd functions/migration npm ci popd From d4b98222f442889797c01ed2c9041ae962c68329 Mon Sep 17 00:00:00 2001 From: Arthur Morrow Date: Mon, 9 Dec 2024 09:22:26 -0500 Subject: [PATCH 09/49] removed npm Jira ticket: CAMS-461 --- .github/workflows/sub-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sub-build.yml b/.github/workflows/sub-build.yml index 1f9d1fe29..187cbb6b1 100644 --- a/.github/workflows/sub-build.yml +++ b/.github/workflows/sub-build.yml @@ -106,7 +106,7 @@ jobs: npm run build:api - npm pushd functions/migration + pushd functions/migration npm ci popd From eb0765a9b9fb2efd30400bd8b516eb3d1b22c8e1 Mon Sep 17 00:00:00 2001 From: Arthur Morrow Date: Mon, 9 Dec 2024 10:11:39 -0500 Subject: [PATCH 10/49] moved app insights and alert creation into one place Jira ticket: CAMS-461 --- .github/workflows/sub-build.yml | 6 - ops/cloud-deployment/backend-api-deploy.bicep | 170 +++++++++--------- .../app-insights/function-app-insights.bicep | 72 ++++++++ 3 files changed, 162 insertions(+), 86 deletions(-) create mode 100644 ops/cloud-deployment/lib/app-insights/function-app-insights.bicep diff --git a/.github/workflows/sub-build.yml b/.github/workflows/sub-build.yml index 187cbb6b1..1d21c4a5e 100644 --- a/.github/workflows/sub-build.yml +++ b/.github/workflows/sub-build.yml @@ -100,16 +100,10 @@ jobs: npm ci popd - pushd functions/api npm ci - popd npm run build:api - pushd functions/migration - npm ci - popd - npm run build:migration - name: Package API diff --git a/ops/cloud-deployment/backend-api-deploy.bicep b/ops/cloud-deployment/backend-api-deploy.bicep index e8e6473f3..194ee6637 100644 --- a/ops/cloud-deployment/backend-api-deploy.bicep +++ b/ops/cloud-deployment/backend-api-deploy.bicep @@ -37,6 +37,19 @@ var planTypeToSkuMap = { param stackName string = 'ustp-cams' +@description('Azure functions version') +param functionsVersion string = '~4' + +@description('Storage account name. Default creates unique name from resource group id and stack name') +@minLength(3) +@maxLength(24) +param apiFunctionStorageName string = 'ustpfunc${uniqueString(resourceGroup().id, apiFunctionName)}' + +@description('Storage account name. Default creates unique name from resource group id and stack name') +@minLength(3) +@maxLength(24) +param migrationFunctionStorageName string = 'ustpmigr${uniqueString(resourceGroup().id, apiFunctionName)}' + param apiFunctionName string param apiFunctionSubnetId string @@ -74,14 +87,6 @@ param loginProvider string @description('Is ustp deployment') param isUstpDeployment bool -@description('Azure functions version') -param functionsVersion string = '~4' - -@description('Storage account name. Default creates unique name from resource group id and stack name') -@minLength(3) -@maxLength(24) -param functionsStorageName string = 'ustpfunc${uniqueString(resourceGroup().id, apiFunctionName)}' - @description('List of origins to allow. Need to include protocol') param corsAllowOrigins array = [] @@ -135,9 +140,6 @@ resource appConfigIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@202 scope: resourceGroup(kvAppConfigResourceGroupName) } -/* - App service plan (hosting plan) for Azure functions instances -*/ resource servicePlan 'Microsoft.Web/serverfarms@2022-09-01' = { location: location name: planName @@ -157,11 +159,9 @@ resource servicePlan 'Microsoft.Web/serverfarms@2022-09-01' = { } } -/* - Storage resource for Azure functions -*/ -resource storageAccount 'Microsoft.Storage/storageAccounts@2022-09-01' = { - name: functionsStorageName +//Storage Account Resources +resource apiFunctionStorageAccount 'Microsoft.Storage/storageAccounts@2022-09-01' = { + name: apiFunctionStorageName location: location tags: { 'Stack Name': apiFunctionName @@ -176,65 +176,24 @@ resource storageAccount 'Microsoft.Storage/storageAccounts@2022-09-01' = { } } -module appInsights './lib/app-insights/app-insights.bicep' = if (createApplicationInsights) { - name: '${apiFunctionName}-application-insights-module' - params: { - location: location - kind: 'web' - appInsightsName: 'appi-${apiFunctionName}' - applicationType: 'web' - workspaceResourceId: analyticsWorkspaceId - } -} - -module diagnosticSettings './lib/app-insights/diagnostics-settings-func.bicep' = if (createApplicationInsights) { - name: '${apiFunctionName}-diagnostic-settings-module' - params: { - functionAppName: apiFunctionName - workspaceResourceId: analyticsWorkspaceId +resource migrationFunctonStorageAccount 'Microsoft.Storage/storageAccounts@2022-09-01' = { + name: migrationFunctionStorageName + location: location + tags: { + 'Stack Name': apiFunctionName } - dependsOn: [ - appInsights - apiFunctionApp - ] -} - -module healthAlertRule './lib/monitoring-alerts/metrics-alert-rule.bicep' = if (createAlerts) { - name: '${apiFunctionName}-healthcheck-alert-rule-module' - params: { - alertName: '${apiFunctionName}-health-check-alert' - appId: apiFunctionApp.id - timeAggregation: 'Average' - operator: 'LessThan' - targetResourceType: 'Microsoft.Web/sites' - metricName: 'HealthCheckStatus' - severity: 2 - threshold: 100 - actionGroupName: actionGroupName - actionGroupResourceGroupName: actionGroupResourceGroupName + sku: { + name: 'Standard_LRS' } -} - -module httpAlertRule './lib/monitoring-alerts/metrics-alert-rule.bicep' = if (createAlerts) { - name: '${apiFunctionName}-http-error-alert-rule-module' - params: { - alertName: '${apiFunctionName}-http-error-alert' - appId: apiFunctionApp.id - timeAggregation: 'Total' - operator: 'GreaterThanOrEqual' - targetResourceType: 'Microsoft.Web/sites' - metricName: 'Http5xx' - severity: 1 - threshold: 1 - actionGroupName: actionGroupName - actionGroupResourceGroupName: actionGroupResourceGroupName + kind: 'Storage' + properties: { + supportsHttpsTrafficOnly: true + defaultToOAuthAuthentication: true } } -/* - Create functionapp -*/ +//Function App Resources var userAssignedIdentities = union( { '${appConfigIdentity.id}': {} @@ -284,14 +243,39 @@ resource migrationFunctionApp 'Microsoft.Web/sites@2022-09-01' = { sqlIdentity ] } + +//Create App Insights +module apiFunctionAppInsights 'lib/app-insights/function-app-insights.bicep' = { + name:'appi-${apiFunctionName}-module' + scope: resourceGroup() + params: { + actionGroupName: actionGroupName + actionGroupResourceGroupName: actionGroupResourceGroupName + analyticsWorkspaceId: analyticsWorkspaceId + createAlerts: createAlerts + createApplicationInsights: createApplicationInsights + functionAppName: apiFunctionName + } +} + +module migrationFunctionAppInsights 'lib/app-insights/function-app-insights.bicep' = { + name:'appi-${migrationFunctionName}-module' + scope: resourceGroup() + params: { + actionGroupName: actionGroupName + actionGroupResourceGroupName: actionGroupResourceGroupName + analyticsWorkspaceId: analyticsWorkspaceId + createAlerts: createAlerts + createApplicationInsights: createApplicationInsights + functionAppName: migrationFunctionName + } + +} + //TODO: Clear segregation with DXTR vs ACMS variable/secret naming in GitHub and ADO secret libraries -var applicationSettings = concat( +var baseApplicationSettings = concat( [ - { - name: 'AzureWebJobsStorage' - value: 'DefaultEndpointsProtocol=https;AccountName=${storageAccount.name};EndpointSuffix=${environment().suffixes.storage};AccountKey=${storageAccount.listKeys().keys[0].value}' - } { name: 'FUNCTIONS_EXTENSION_VERSION' value: functionsVersion @@ -397,9 +381,6 @@ var applicationSettings = concat( value: 'main' } ], - createApplicationInsights - ? [{ name: 'APPLICATIONINSIGHTS_CONNECTION_STRING', value: appInsights.outputs.connectionString }] - : [], isUstpDeployment ? [ { name: 'MSSQL_USER', value: '@Microsoft.KeyVault(VaultName=${kvAppConfigName};SecretName=MSSQL-USER)' } @@ -413,6 +394,34 @@ var applicationSettings = concat( ] ) +//Migration Function Application Settings +var migrationApplicationSettings = concat( + [ + { + name: 'AzureWebJobsStorage' + value: 'DefaultEndpointsProtocol=https;AccountName=${migrationFunctonStorageAccount.name};EndpointSuffix=${environment().suffixes.storage};AccountKey=${migrationFunctonStorageAccount.listKeys().keys[0].value}' + } + ], + baseApplicationSettings, + createApplicationInsights + ? [{ name: 'APPLICATIONINSIGHTS_CONNECTION_STRING', value: migrationFunctionAppInsights.outputs.connectionString }] + : [] +) + +//API Function Application Settings +var apiApplicationSettings = concat( + [ + { + name: 'AzureWebJobsStorage' + value: 'DefaultEndpointsProtocol=https;AccountName=${apiFunctionStorageAccount.name};EndpointSuffix=${environment().suffixes.storage};AccountKey=${apiFunctionStorageAccount.listKeys().keys[0].value}' + } + ], + baseApplicationSettings, + createApplicationInsights + ? [{ name: 'APPLICATIONINSIGHTS_CONNECTION_STRING', value: apiFunctionAppInsights.outputs.connectionString }] + : [] +) + var ipSecurityRestrictionsRules = concat( [ { @@ -463,7 +472,7 @@ resource apiFunctionConfig 'Microsoft.Web/sites/config@2022-09-01' = { scmIpSecurityRestrictionsDefaultAction: 'Deny' scmIpSecurityRestrictionsUseMain: false linuxFxVersion: linuxFxVersionMap['${functionsRuntime}'] - appSettings: applicationSettings + appSettings: apiApplicationSettings } } @@ -494,10 +503,11 @@ resource migrationFunctionConfig 'Microsoft.Web/sites/config@2022-09-01' = { scmIpSecurityRestrictionsDefaultAction: 'Deny' scmIpSecurityRestrictionsUseMain: false linuxFxVersion: linuxFxVersionMap['${functionsRuntime}'] - appSettings: applicationSettings + appSettings: migrationApplicationSettings } } +//Private Endpoints module apiPrivateEndpoint './lib/network/subnet-private-endpoint.bicep' = { name: '${apiFunctionName}-pep-module' scope: resourceGroup(virtualNetworkResourceGroupName) @@ -536,7 +546,7 @@ module setMigrationFunctionSqlServerVnetRule './lib/network/sql-vnet-rule.bicep' params: { stackName: migrationFunctionName sqlServerName: sqlServerName - subnetId: apiFunctionSubnetId + subnetId: migrationFunctionSubnetId } } diff --git a/ops/cloud-deployment/lib/app-insights/function-app-insights.bicep b/ops/cloud-deployment/lib/app-insights/function-app-insights.bicep new file mode 100644 index 000000000..f372d58e6 --- /dev/null +++ b/ops/cloud-deployment/lib/app-insights/function-app-insights.bicep @@ -0,0 +1,72 @@ +param functionAppName string + +param analyticsWorkspaceId string + +param createAlerts bool + +param createApplicationInsights bool + +param actionGroupName string + +param actionGroupResourceGroupName string + +resource functionApp 'Microsoft.Web/sites@2022-09-01' existing = { + name: functionAppName +} + +module appInsights '../app-insights/app-insights.bicep' = if (createApplicationInsights) { + name: '${functionAppName}-application-insights-module' + params: { + location: functionApp.location + kind: 'web' + appInsightsName: 'appi-${functionAppName}' + applicationType: 'web' + workspaceResourceId: analyticsWorkspaceId + } +} + +module diagnosticSettings '../app-insights/diagnostics-settings-func.bicep' = if (createApplicationInsights) { + name: '${functionAppName}-diagnostic-settings-module' + params: { + functionAppName: functionAppName + workspaceResourceId: analyticsWorkspaceId + } + dependsOn: [ + appInsights + functionApp + ] +} + +module healthAlertRule '../monitoring-alerts/metrics-alert-rule.bicep' = if (createAlerts) { + name: '${functionAppName}-healthcheck-alert-rule-module' + params: { + alertName: '${functionAppName}-health-check-alert' + appId: functionApp.id + timeAggregation: 'Average' + operator: 'LessThan' + targetResourceType: 'Microsoft.Web/sites' + metricName: 'HealthCheckStatus' + severity: 2 + threshold: 100 + actionGroupName: actionGroupName + actionGroupResourceGroupName: actionGroupResourceGroupName + } +} + +module httpAlertRule '../monitoring-alerts/metrics-alert-rule.bicep' = if (createAlerts) { + name: '${functionAppName}-http-error-alert-rule-module' + params: { + alertName: '${functionAppName}-http-error-alert' + appId: functionApp.id + timeAggregation: 'Total' + operator: 'GreaterThanOrEqual' + targetResourceType: 'Microsoft.Web/sites' + metricName: 'Http5xx' + severity: 1 + threshold: 1 + actionGroupName: actionGroupName + actionGroupResourceGroupName: actionGroupResourceGroupName + } +} + +output connectionString string = appInsights.outputs.connectionString From 8c6b7696fcb05fc8acb4827a4e635a5dcf07bfe8 Mon Sep 17 00:00:00 2001 From: Arthur Morrow Date: Mon, 9 Dec 2024 10:19:15 -0500 Subject: [PATCH 11/49] added node dependency to backend Jira ticket: CAMS-461 --- .github/workflows/sub-build.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/sub-build.yml b/.github/workflows/sub-build.yml index 1d21c4a5e..4b1178979 100644 --- a/.github/workflows/sub-build.yml +++ b/.github/workflows/sub-build.yml @@ -94,6 +94,13 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: ${{ inputs.nodeVersion }} + cache: "npm" + cache-dependency-path: backend/package-lock.json + - name: Execute Build run: | pushd ../common From 61d2eccf71065d5e68f58520dec59f43b802559c Mon Sep 17 00:00:00 2001 From: Arthur Morrow Date: Mon, 9 Dec 2024 10:35:54 -0500 Subject: [PATCH 12/49] added use-base for ci Jira ticket: CAMS-461 --- .github/workflows/sub-build.yml | 8 ++------ backend/package.json | 1 + 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/sub-build.yml b/.github/workflows/sub-build.yml index 4b1178979..550ccacf5 100644 --- a/.github/workflows/sub-build.yml +++ b/.github/workflows/sub-build.yml @@ -94,12 +94,6 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version: ${{ inputs.nodeVersion }} - cache: "npm" - cache-dependency-path: backend/package-lock.json - name: Execute Build run: | @@ -109,6 +103,8 @@ jobs: npm ci + npm run use-bash + npm run build:api npm run build:migration diff --git a/backend/package.json b/backend/package.json index 1abd09723..9e8187974 100644 --- a/backend/package.json +++ b/backend/package.json @@ -60,6 +60,7 @@ "pack": "mkdir -p /tmp/build && zip -q -r /tmp/build/$OUT.zip functions --exclude functions/api/@.funcignore --exclude functions/api/.funcignore --exclude functions/migration && mv /tmp/build/api/$OUT.zip .", "pack:migration": "mkdir -p /tmp/build && zip -q -r /tmp/build/$OUT.zip functions/migration --exclude functions/migration/@.funcignore --exclude functions/migration/.funcignore --exclude functions/api && mv /tmp/build/migration/$OUT.zip .", "coverage": "npm test -- --coverage", + "use-bash": "npm config set script-shell=/bin/bash", "coverage:ci": "npm config set script-shell=/bin/bash && npm run build-common && npm test -- --coverage", "dependency-cruiser-graphical": "current_time=$(date +'%Y-%m-%d_%H%M') && npx depcruise --output-type dot --do-not-follow '^node_modules($|/)' functions/api/attorneys case-assignments case-docket case-history case-summary cases consolidations healthcheck offices orders orders-manual-sync orders-sync ../lib | dot -T svg > ../../docs/architecture/dependency-cruiser/functions/dependency-graph_api_${current_time}.svg", "dependency-cruiser:ci": "npx depcruise --output-type err-long functions/api/attorneys case-assignments case-docket case-history case-summary cases consolidations healthcheck offices orders orders-manual-sync orders-sync ../lib ", From 9700e79b9b85d326929ea23e69807a40369c05f0 Mon Sep 17 00:00:00 2001 From: Arthur Morrow Date: Mon, 9 Dec 2024 10:49:42 -0500 Subject: [PATCH 13/49] created use-bash in package.json and corrected pack Jira ticket: CAMS-461 Co-authored-by: Arthur Morrow <133667008+amorrow-flexion@users.noreply.github.com> Co-authored-by: James Brooks <12275865+jamesobrooks@users.noreply.github.com> --- .github/workflows/sub-build.yml | 8 +++----- backend/package.json | 6 +++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/sub-build.yml b/.github/workflows/sub-build.yml index 550ccacf5..978fd59f0 100644 --- a/.github/workflows/sub-build.yml +++ b/.github/workflows/sub-build.yml @@ -97,13 +97,11 @@ jobs: - name: Execute Build run: | - pushd ../common - npm ci - popd + npm run use-bash - npm ci + npm run build-common - npm run use-bash + npm ci npm run build:api diff --git a/backend/package.json b/backend/package.json index 9e8187974..bc3cf7280 100644 --- a/backend/package.json +++ b/backend/package.json @@ -57,11 +57,11 @@ "lint": "eslint functions", "lint:fix": "eslint functions --fix", "format": "prettier --write './**/*.{js,ts,css,md,json}' --config .prettierrc", - "pack": "mkdir -p /tmp/build && zip -q -r /tmp/build/$OUT.zip functions --exclude functions/api/@.funcignore --exclude functions/api/.funcignore --exclude functions/migration && mv /tmp/build/api/$OUT.zip .", - "pack:migration": "mkdir -p /tmp/build && zip -q -r /tmp/build/$OUT.zip functions/migration --exclude functions/migration/@.funcignore --exclude functions/migration/.funcignore --exclude functions/api && mv /tmp/build/migration/$OUT.zip .", + "pack": "mkdir -p /tmp/build/api && zip -q -r /tmp/build/api/$OUT.zip functions --exclude functions/api/@.funcignore --exclude functions/api/.funcignore --exclude functions/migration && mv /tmp/build/api/$OUT.zip .", + "pack:migration": "mkdir -p /tmp/build/migration && zip -q -r /tmp/build/migration/$OUT.zip functions --exclude functions/migration/@.funcignore --exclude functions/migration/.funcignore --exclude functions/api && mv /tmp/build/migration/$OUT.zip .", "coverage": "npm test -- --coverage", "use-bash": "npm config set script-shell=/bin/bash", - "coverage:ci": "npm config set script-shell=/bin/bash && npm run build-common && npm test -- --coverage", + "coverage:ci": "npm run use-bash && npm run build-common && npm test -- --coverage", "dependency-cruiser-graphical": "current_time=$(date +'%Y-%m-%d_%H%M') && npx depcruise --output-type dot --do-not-follow '^node_modules($|/)' functions/api/attorneys case-assignments case-docket case-history case-summary cases consolidations healthcheck offices orders orders-manual-sync orders-sync ../lib | dot -T svg > ../../docs/architecture/dependency-cruiser/functions/dependency-graph_api_${current_time}.svg", "dependency-cruiser:ci": "npx depcruise --output-type err-long functions/api/attorneys case-assignments case-docket case-history case-summary cases consolidations healthcheck offices orders orders-manual-sync orders-sync ../lib ", "itest:okta-group-api": "CAMS_LOGIN_PROVIDER=okta npx ts-node lib/testing/isolated-integration/test-okta-group-api.ts", From 0a99c0add5d044e7c8df81e58203bb2856d3bfd9 Mon Sep 17 00:00:00 2001 From: Arthur Morrow Date: Mon, 9 Dec 2024 10:53:39 -0500 Subject: [PATCH 14/49] fixed artifact path on build Jira ticket: CAMS-461 --- .github/workflows/sub-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sub-build.yml b/.github/workflows/sub-build.yml index 978fd59f0..baccd6761 100644 --- a/.github/workflows/sub-build.yml +++ b/.github/workflows/sub-build.yml @@ -117,12 +117,12 @@ jobs: uses: actions/upload-artifact@v4.4.0 with: name: ${{ inputs.apiFunctionName }}-build - path: backend/api/${{ inputs.apiFunctionName }}.zip + path: backend/${{ inputs.apiFunctionName }}.zip if-no-files-found: error - name: Upload Migration Azure Functions Artifact uses: actions/upload-artifact@v4.4.0 with: name: ${{ inputs.migrationFunctionName }}-build - path: backend/migration/${{ inputs.migrationFunctionName }}.zip + path: backend/${{ inputs.migrationFunctionName }}.zip if-no-files-found: error From 8f800829de3529cf5eb955fc55749432802dd4f4 Mon Sep 17 00:00:00 2001 From: Arthur Morrow Date: Mon, 9 Dec 2024 10:59:22 -0500 Subject: [PATCH 15/49] addressed todo in bicep Jira ticket: CAMS-461 --- ops/cloud-deployment/main.bicep | 2 -- 1 file changed, 2 deletions(-) diff --git a/ops/cloud-deployment/main.bicep b/ops/cloud-deployment/main.bicep index 57de1f52f..13de524c8 100644 --- a/ops/cloud-deployment/main.bicep +++ b/ops/cloud-deployment/main.bicep @@ -126,8 +126,6 @@ param camsReactSelectHash string param cosmosDatabaseName string - -//TODO: Break out Alerts && Action Group module actionGroup './lib/monitoring-alerts/alert-action-group.bicep' = if (createAlerts) { name: '${actionGroupName}-action-group-module' From 407dcd8a9bcbe267c007dd9ccf94aa30a752d974 Mon Sep 17 00:00:00 2001 From: Arthur Morrow Date: Mon, 9 Dec 2024 11:23:02 -0500 Subject: [PATCH 16/49] fixed sql vnet rule fir migration functionapp Jira ticket: CAMS-461 --- ops/cloud-deployment/backend-api-deploy.bicep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ops/cloud-deployment/backend-api-deploy.bicep b/ops/cloud-deployment/backend-api-deploy.bicep index 194ee6637..89fc95d3a 100644 --- a/ops/cloud-deployment/backend-api-deploy.bicep +++ b/ops/cloud-deployment/backend-api-deploy.bicep @@ -542,7 +542,7 @@ var createSqlServerVnetRule = !empty(sqlServerResourceGroupName) && !empty(sqlSe module setMigrationFunctionSqlServerVnetRule './lib/network/sql-vnet-rule.bicep' = if (createSqlServerVnetRule) { scope: resourceGroup(sqlServerResourceGroupName) - name: '${apiFunctionName}-sql-vnet-rule-module' + name: '${migrationFunctionName}-sql-vnet-rule-module' params: { stackName: migrationFunctionName sqlServerName: sqlServerName From 33115ca58e01ccc4fd582c7e5a4b5e942cd6604f Mon Sep 17 00:00:00 2001 From: Arthur Morrow Date: Mon, 9 Dec 2024 11:25:21 -0500 Subject: [PATCH 17/49] fixed webapp name [skip ci] Jira ticket: CAMS-461 --- ops/cloud-deployment/lib/network/ustp-cams-network.bicep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ops/cloud-deployment/lib/network/ustp-cams-network.bicep b/ops/cloud-deployment/lib/network/ustp-cams-network.bicep index f6a0872a2..1fe488b44 100644 --- a/ops/cloud-deployment/lib/network/ustp-cams-network.bicep +++ b/ops/cloud-deployment/lib/network/ustp-cams-network.bicep @@ -28,7 +28,7 @@ param migrationSubnetAddressPrefix string = '10.10.14.0/28' param migrationSubnetName string = 'snet-${migrationFunctionName}' -param webappName string = '${stackName}-node-api' +param webappName string = '${stackName}-webapp' param webappSubnetName string = 'snet-${apiFunctionName}' From dbda7335068b4a8351962e6e25f9f4e686b89197 Mon Sep 17 00:00:00 2001 From: Arthur Morrow Date: Mon, 9 Dec 2024 11:40:13 -0500 Subject: [PATCH 18/49] fixed dependency issue in network subnets Jira ticket: CAMS-461 --- ops/cloud-deployment/lib/network/ustp-cams-network.bicep | 2 ++ ops/scripts/pipeline/slots/az-slot-api-resource-deploy.sh | 3 +++ 2 files changed, 5 insertions(+) diff --git a/ops/cloud-deployment/lib/network/ustp-cams-network.bicep b/ops/cloud-deployment/lib/network/ustp-cams-network.bicep index 1fe488b44..9f9a5444d 100644 --- a/ops/cloud-deployment/lib/network/ustp-cams-network.bicep +++ b/ops/cloud-deployment/lib/network/ustp-cams-network.bicep @@ -178,6 +178,7 @@ module migrationFunctionSubnet './subnet.bicep' = { ustpVirtualNetwork ustpDnsZones privateEndpointSubnet + apiFunctionSubnet ] } @@ -202,6 +203,7 @@ module webappSubnet './subnet.bicep' = { ustpVirtualNetwork ustpDnsZones apiFunctionSubnet + migrationFunctionSubnet ] } diff --git a/ops/scripts/pipeline/slots/az-slot-api-resource-deploy.sh b/ops/scripts/pipeline/slots/az-slot-api-resource-deploy.sh index d21bdebed..3c413550d 100755 --- a/ops/scripts/pipeline/slots/az-slot-api-resource-deploy.sh +++ b/ops/scripts/pipeline/slots/az-slot-api-resource-deploy.sh @@ -125,6 +125,9 @@ az functionapp config appsettings set -g "$app_rg" -n "$migration_function_name" echo "Setting CORS Allowed origins for the API..." az functionapp cors add -g "$app_rg" --name "$api_function_name" --slot "$slot_name" --allowed-origins "https://${webapp_name}-${slot_name}.azurewebsites.us" +echo "Setting CORS Allowed origins for Migration function" +az functionapp cors add -g "$app_rg" --name "$api_function_name" --slot "$slot_name" --allowed-origins "https://portal.azure.us" + # Identities occasionally come through with improper id for usage here, this constructs that kv_ref_id=$(az identity list -g "$id_rg" --query "[?name == '$kv_id_name'].id" -o tsv) identities="$kv_ref_id" From 180e6b90115420066ad09f5709a3ba4692416171 Mon Sep 17 00:00:00 2001 From: Arthur Morrow Date: Mon, 9 Dec 2024 11:46:01 -0500 Subject: [PATCH 19/49] added stop operation to migration slot [skip ci] Jira ticket: CAMS-461 Co-authored-by: Fritz Madden <96319835+fmaddenflx@users.noreply.github.com> Co-authored-by: Arthur Morrow <133667008+amorrow-flexion@users.noreply.github.com> Co-authored-by: James Brooks <12275865+jamesobrooks@users.noreply.github.com> Co-authored-by: Brian Posey <15091170+btposey@users.noreply.github.com>, --- .github/workflows/sub-deploy-code-slot.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/sub-deploy-code-slot.yml b/.github/workflows/sub-deploy-code-slot.yml index 95398a632..1276aad9b 100644 --- a/.github/workflows/sub-deploy-code-slot.yml +++ b/.github/workflows/sub-deploy-code-slot.yml @@ -266,6 +266,7 @@ jobs: run: | az functionapp deployment slot swap --slot ${{ env.slotName }} --name ${{ inputs.migrationFunctionName }} -g ${{ steps.rgApp.outputs.out }} az webapp traffic-routing clear --name ${{ inputs.migrationFunctionName }} -g ${{ steps.rgApp.outputs.out }} + az functionapp stop -g ${{ steps.rgApp.outputs.out }} --name ${{ inputs.migrationFunctionName }} --slot ${{ inputs.slotName }} endpoint-test-application-post-swap: needs: [swap-nodeapi-deployment-slot, swap-webapp-deployment-slot] @@ -304,3 +305,4 @@ jobs: run: | az webapp config access-restriction add --resource-group ${{ steps.rgApp.outputs.out }} --name ${{ env.webappName }} --rule-name AllowAll --action Allow --ip-address 0.0.0.0/0 --priority 100 1>/dev/null || true az functionapp config access-restriction add --resource-group ${{ steps.rgApp.outputs.out }} --name ${{ env.apiFunctionName }} --rule-name AllowAll --action Allow --ip-address 0.0.0.0/0 --priority 100 1>/dev/null || true + az functionapp config access-restriction add --resource-group ${{ steps.rgApp.outputs.out }} --name ${{ inputs.migrationFunctionName }} --rule-name AllowAll --action Allow --ip-address 0.0.0.0/0 --priority 100 1>/dev/null || true From 73270b72606c1c6df19d16f383f99e818d9d7bc0 Mon Sep 17 00:00:00 2001 From: Arthur Morrow Date: Mon, 9 Dec 2024 11:57:58 -0500 Subject: [PATCH 20/49] commented out prelim steps for now fixed appi dependencies Jira ticket: CAMS-461 Co-authored-by: Fritz Madden <96319835+fmaddenflx@users.noreply.github.com> Co-authored-by: James Brooks <12275865+jamesobrooks@users.noreply.github.com> Co-authored-by: Brian Posey <15091170+btposey@users.noreply.github.com>, --- .github/workflows/continuous-deployment.yml | 119 ++++++++---------- ops/cloud-deployment/backend-api-deploy.bicep | 7 +- 2 files changed, 61 insertions(+), 65 deletions(-) diff --git a/.github/workflows/continuous-deployment.yml b/.github/workflows/continuous-deployment.yml index 0673aa766..4223cf5de 100644 --- a/.github/workflows/continuous-deployment.yml +++ b/.github/workflows/continuous-deployment.yml @@ -49,60 +49,60 @@ jobs: enableBicepDeployment: ${{ inputs.enableBicepDeployment }} deployVnet: ${{ inputs.deployVnet }} - accessibility-test: - defaults: - run: - working-directory: user-interface - - runs-on: ubuntu-latest - - steps: - - name: Install chrome - uses: browser-actions/setup-chrome@v1 - - - name: Get source code - uses: actions/checkout@v3 - - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version: ${{ vars.NODE_VERSION }} - cache: "npm" - cache-dependency-path: user-interface/package-lock.json - - - name: Install Node dependencies - run: | - pushd ../common - npm ci - popd - - npm ci && npm install -g pa11y-ci - - - name: Run pa11y Test - run: ../ops/scripts/pipeline/accessibility-test.sh - - unit-test-frontend: - uses: ./.github/workflows/reusable-unit-test.yml - with: - path: user-interface - node-version: ${{ vars.NODE_VERSION }} - - unit-test-backend: - uses: ./.github/workflows/reusable-unit-test.yml - with: - path: backend - node-version: ${{ vars.NODE_VERSION }} - - unit-test-common: - uses: ./.github/workflows/reusable-unit-test.yml - with: - path: common - node-version: ${{ vars.NODE_VERSION }} - - security-scan: - name: Security - uses: ./.github/workflows/sub-security-scan.yml - secrets: inherit # pragma: allowlist secret + # accessibility-test: + # defaults: + # run: + # working-directory: user-interface + + # runs-on: ubuntu-latest + + # steps: + # - name: Install chrome + # uses: browser-actions/setup-chrome@v1 + + # - name: Get source code + # uses: actions/checkout@v3 + + # - name: Use Node.js + # uses: actions/setup-node@v3 + # with: + # node-version: ${{ vars.NODE_VERSION }} + # cache: "npm" + # cache-dependency-path: user-interface/package-lock.json + + # - name: Install Node dependencies + # run: | + # pushd ../common + # npm ci + # popd + + # npm ci && npm install -g pa11y-ci + + # - name: Run pa11y Test + # run: ../ops/scripts/pipeline/accessibility-test.sh + + # unit-test-frontend: + # uses: ./.github/workflows/reusable-unit-test.yml + # with: + # path: user-interface + # node-version: ${{ vars.NODE_VERSION }} + + # unit-test-backend: + # uses: ./.github/workflows/reusable-unit-test.yml + # with: + # path: backend + # node-version: ${{ vars.NODE_VERSION }} + + # unit-test-common: + # uses: ./.github/workflows/reusable-unit-test.yml + # with: + # path: common + # node-version: ${{ vars.NODE_VERSION }} + + # security-scan: + # name: Security + # uses: ./.github/workflows/sub-security-scan.yml + # secrets: inherit # pragma: allowlist secret build: name: Build @@ -124,16 +124,7 @@ jobs: deploy: name: Cloud Resource Deployment uses: ./.github/workflows/sub-deploy.yml - needs: - [ - setup, - build, - accessibility-test, - security-scan, - unit-test-frontend, - unit-test-backend, - unit-test-common, - ] + needs: [setup, build] if: ((github.ref == 'refs/heads/main') || (github.ref == 'refs/heads/dependency-updates-auto') || (inputs.deployBranch == 'true')) diff --git a/ops/cloud-deployment/backend-api-deploy.bicep b/ops/cloud-deployment/backend-api-deploy.bicep index 89fc95d3a..03a19098b 100644 --- a/ops/cloud-deployment/backend-api-deploy.bicep +++ b/ops/cloud-deployment/backend-api-deploy.bicep @@ -256,6 +256,9 @@ module apiFunctionAppInsights 'lib/app-insights/function-app-insights.bicep' = { createApplicationInsights: createApplicationInsights functionAppName: apiFunctionName } + dependsOn: [ + apiFunctionApp + ] } module migrationFunctionAppInsights 'lib/app-insights/function-app-insights.bicep' = { @@ -269,7 +272,9 @@ module migrationFunctionAppInsights 'lib/app-insights/function-app-insights.bice createApplicationInsights: createApplicationInsights functionAppName: migrationFunctionName } - + dependsOn: [ + migrationFunctionApp + ] } //TODO: Clear segregation with DXTR vs ACMS variable/secret naming in GitHub and ADO secret libraries From 6231e1e36d11500434c3abf2811f284d51e624d2 Mon Sep 17 00:00:00 2001 From: Arthur Morrow Date: Mon, 9 Dec 2024 12:33:07 -0500 Subject: [PATCH 21/49] corrected pack commands and az-delete-branch-resources Jira ticket: CAMS-461 Co-authored-by: Arthur Morrow <133667008+amorrow-flexion@users.noreply.github.com> Co-authored-by: James Brooks <12275865+jamesobrooks@users.noreply.github.com> --- backend/package.json | 4 ++-- ops/scripts/utility/az-delete-branch-resources.sh | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/package.json b/backend/package.json index bc3cf7280..4cc4190f2 100644 --- a/backend/package.json +++ b/backend/package.json @@ -57,8 +57,8 @@ "lint": "eslint functions", "lint:fix": "eslint functions --fix", "format": "prettier --write './**/*.{js,ts,css,md,json}' --config .prettierrc", - "pack": "mkdir -p /tmp/build/api && zip -q -r /tmp/build/api/$OUT.zip functions --exclude functions/api/@.funcignore --exclude functions/api/.funcignore --exclude functions/migration && mv /tmp/build/api/$OUT.zip .", - "pack:migration": "mkdir -p /tmp/build/migration && zip -q -r /tmp/build/migration/$OUT.zip functions --exclude functions/migration/@.funcignore --exclude functions/migration/.funcignore --exclude functions/api && mv /tmp/build/migration/$OUT.zip .", + "pack": "mkdir -p /tmp/build/api && zip -q -r /tmp/build/api/$OUT.zip functions . --exclude api/@.funcignore --exclude api/.funcignore --exclude migration && mv /tmp/build/api/$OUT.zip .", + "pack:migration": "mkdir -p /tmp/build/migration && zip -q -r /tmp/build/migration/$OUT.zip . functions --exclude migration/@.funcignore --exclude migration/.funcignore --exclude api && mv /tmp/build/migration/$OUT.zip .", "coverage": "npm test -- --coverage", "use-bash": "npm config set script-shell=/bin/bash", "coverage:ci": "npm run use-bash && npm run build-common && npm test -- --coverage", diff --git a/ops/scripts/utility/az-delete-branch-resources.sh b/ops/scripts/utility/az-delete-branch-resources.sh index 1e05e73fc..a46dfd139 100755 --- a/ops/scripts/utility/az-delete-branch-resources.sh +++ b/ops/scripts/utility/az-delete-branch-resources.sh @@ -41,8 +41,11 @@ if [[ "${rgAppExists}" == "true" ]]; then echo "Start disconnecting VNET integration" webapp="ustp-cams-dev-${hash_id}-webapp" az webapp vnet-integration remove -g "${app_rg}" -n "${webapp}" - functionapp="ustp-cams-dev-${hash_id}-node-api" - az functionapp vnet-integration remove -g "${app_rg}" -n "${functionapp}" + apiFunctionApp="ustp-cams-dev-${hash_id}-node-api" + az functionapp vnet-integration remove -g "${app_rg}" -n "${apiFunctionApp}" + echo "Completed disconnecting VNET integration" + migrationFunctionApp="ustp-cams-dev-${hash_id}-migration" + az functionapp vnet-integration remove -g "${app_rg}" -n "${migrationFunctionApp}" echo "Completed disconnecting VNET integration" fi From 75756c58d50c35adc1eae8d1ba305ac8b9ce1257 Mon Sep 17 00:00:00 2001 From: Arthur Morrow Date: Mon, 9 Dec 2024 12:45:40 -0500 Subject: [PATCH 22/49] fixed pack commands Jira ticket: CAMS-461 Co-authored-by: James Brooks <12275865+jamesobrooks@users.noreply.github.com> --- backend/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/package.json b/backend/package.json index 4cc4190f2..c7d423329 100644 --- a/backend/package.json +++ b/backend/package.json @@ -57,8 +57,8 @@ "lint": "eslint functions", "lint:fix": "eslint functions --fix", "format": "prettier --write './**/*.{js,ts,css,md,json}' --config .prettierrc", - "pack": "mkdir -p /tmp/build/api && zip -q -r /tmp/build/api/$OUT.zip functions . --exclude api/@.funcignore --exclude api/.funcignore --exclude migration && mv /tmp/build/api/$OUT.zip .", - "pack:migration": "mkdir -p /tmp/build/migration && zip -q -r /tmp/build/migration/$OUT.zip . functions --exclude migration/@.funcignore --exclude migration/.funcignore --exclude api && mv /tmp/build/migration/$OUT.zip .", + "pack": "mkdir -p /tmp/build/api && zip -q -r /tmp/build/api/$OUT.zip . --exclude api/@.funcignore --exclude api/.funcignore --exclude migration && mv /tmp/build/api/$OUT.zip .", + "pack:migration": "mkdir -p /tmp/build/migration && zip -q -r /tmp/build/migration/$OUT.zip . --exclude migration/@.funcignore --exclude migration/.funcignore --exclude api && mv /tmp/build/migration/$OUT.zip .", "coverage": "npm test -- --coverage", "use-bash": "npm config set script-shell=/bin/bash", "coverage:ci": "npm run use-bash && npm run build-common && npm test -- --coverage", From 7359f21a1650979568583cf5efe0bbd5b5933d1b Mon Sep 17 00:00:00 2001 From: Arthur Morrow Date: Mon, 9 Dec 2024 12:55:41 -0500 Subject: [PATCH 23/49] correctly used dirs in zip command for pack Jira ticket: CAMS-461 Co-authored-by: James Brooks <12275865+jamesobrooks@users.noreply.github.com> --- backend/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/package.json b/backend/package.json index c7d423329..85445ae7c 100644 --- a/backend/package.json +++ b/backend/package.json @@ -57,8 +57,8 @@ "lint": "eslint functions", "lint:fix": "eslint functions --fix", "format": "prettier --write './**/*.{js,ts,css,md,json}' --config .prettierrc", - "pack": "mkdir -p /tmp/build/api && zip -q -r /tmp/build/api/$OUT.zip . --exclude api/@.funcignore --exclude api/.funcignore --exclude migration && mv /tmp/build/api/$OUT.zip .", - "pack:migration": "mkdir -p /tmp/build/migration && zip -q -r /tmp/build/migration/$OUT.zip . --exclude migration/@.funcignore --exclude migration/.funcignore --exclude api && mv /tmp/build/migration/$OUT.zip .", + "pack": "mkdir -p /tmp/build/api && zip -q -r /tmp/build/api/$OUT.zip . --exclude api/@.funcignore --exclude api/.funcignore --exclude migration** && mv /tmp/build/api/$OUT.zip .", + "pack:migration": "mkdir -p /tmp/build/migration && zip -q -r /tmp/build/migration/$OUT.zip . --exclude migration/@.funcignore --exclude migration/.funcignore --exclude api** && mv /tmp/build/migration/$OUT.zip .", "coverage": "npm test -- --coverage", "use-bash": "npm config set script-shell=/bin/bash", "coverage:ci": "npm run use-bash && npm run build-common && npm test -- --coverage", From 6210a165fcb28067b5e5d102b8e89e716d1774aa Mon Sep 17 00:00:00 2001 From: Arthur Morrow Date: Mon, 9 Dec 2024 13:08:29 -0500 Subject: [PATCH 24/49] another attempt at pack commands Jira ticket: CAMS-461 --- backend/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/package.json b/backend/package.json index 85445ae7c..2a43f94c7 100644 --- a/backend/package.json +++ b/backend/package.json @@ -57,8 +57,8 @@ "lint": "eslint functions", "lint:fix": "eslint functions --fix", "format": "prettier --write './**/*.{js,ts,css,md,json}' --config .prettierrc", - "pack": "mkdir -p /tmp/build/api && zip -q -r /tmp/build/api/$OUT.zip . --exclude api/@.funcignore --exclude api/.funcignore --exclude migration** && mv /tmp/build/api/$OUT.zip .", - "pack:migration": "mkdir -p /tmp/build/migration && zip -q -r /tmp/build/migration/$OUT.zip . --exclude migration/@.funcignore --exclude migration/.funcignore --exclude api** && mv /tmp/build/migration/$OUT.zip .", + "pack": "mkdir -p /tmp/build/api && zip -q -r /tmp/build/api/$OUT.zip functions/ --exclude functions/api/@.funcignore --exclude api/.funcignore --exclude functions/migration** && mv /tmp/build/api/$OUT.zip .", + "pack:migration": "mkdir -p /tmp/build/migration && zip -q -r /tmp/build/migration/$OUT.zip functions/ --exclude functions/migration/@.funcignore --exclude functions/migration/.funcignore --exclude functions/api** && mv /tmp/build/migration/$OUT.zip .", "coverage": "npm test -- --coverage", "use-bash": "npm config set script-shell=/bin/bash", "coverage:ci": "npm run use-bash && npm run build-common && npm test -- --coverage", From a10905dcbe8dcf6d8a0b39066e2ec7916edbb147 Mon Sep 17 00:00:00 2001 From: Arthur Morrow Date: Mon, 9 Dec 2024 13:10:04 -0500 Subject: [PATCH 25/49] final attempt Jira ticket: CAMS-461 --- backend/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/package.json b/backend/package.json index 2a43f94c7..1b45aa0ad 100644 --- a/backend/package.json +++ b/backend/package.json @@ -57,8 +57,8 @@ "lint": "eslint functions", "lint:fix": "eslint functions --fix", "format": "prettier --write './**/*.{js,ts,css,md,json}' --config .prettierrc", - "pack": "mkdir -p /tmp/build/api && zip -q -r /tmp/build/api/$OUT.zip functions/ --exclude functions/api/@.funcignore --exclude api/.funcignore --exclude functions/migration** && mv /tmp/build/api/$OUT.zip .", - "pack:migration": "mkdir -p /tmp/build/migration && zip -q -r /tmp/build/migration/$OUT.zip functions/ --exclude functions/migration/@.funcignore --exclude functions/migration/.funcignore --exclude functions/api** && mv /tmp/build/migration/$OUT.zip .", + "pack": "mkdir -p /tmp/build/api && zip -q -r /tmp/build/api/$OUT.zip . --exclude functions/api/@.funcignore --exclude functions/api/.funcignore --exclude functions/migration** && mv /tmp/build/api/$OUT.zip .", + "pack:migration": "mkdir -p /tmp/build/migration && zip -q -r /tmp/build/migration/$OUT.zip . --exclude functions/migration/@.funcignore --exclude functions/migration/.funcignore --exclude functions/api** && mv /tmp/build/migration/$OUT.zip .", "coverage": "npm test -- --coverage", "use-bash": "npm config set script-shell=/bin/bash", "coverage:ci": "npm run use-bash && npm run build-common && npm test -- --coverage", From a8a6ec46410644adc0013f732af409a17d8fb8c9 Mon Sep 17 00:00:00 2001 From: Brian Posey <15091170+btposey@users.noreply.github.com> Date: Mon, 9 Dec 2024 17:40:41 -0500 Subject: [PATCH 26/49] Refactor building AZ function packages Jira ticket: CAMS-461 --- .gitignore | 3 ++- backend/functions/api/package.json | 12 ++++++----- backend/functions/api/tsconfig.build.json | 2 +- backend/functions/migration/package.json | 12 ++++++----- .../functions/migration/tsconfig.build.json | 2 +- backend/pack.sh | 11 ++++++++++ backend/package.json | 20 +++++++++++-------- 7 files changed, 41 insertions(+), 21 deletions(-) create mode 100755 backend/pack.sh diff --git a/.gitignore b/.gitignore index bebb0bbf8..79426714e 100644 --- a/.gitignore +++ b/.gitignore @@ -75,8 +75,9 @@ cams1.code-workspace # Node **/node_modules/ -# Dist +# Build and Dist **/dist/ +**/build/ # Veracode **/pipeline-scan* diff --git a/backend/functions/api/package.json b/backend/functions/api/package.json index c898fad82..b31326f3e 100644 --- a/backend/functions/api/package.json +++ b/backend/functions/api/package.json @@ -2,9 +2,11 @@ "name": "cams-api", "version": "1.0.0", "description": "", - "workspaces": ["../../"], - "dependencies": { - "@azure/functions": "^4.6.0" - }, - "main": "dist/backend/functions/api/*/*.function.js" + "main": "backend/functions/api/*/*.js", + "scripts": { + "clean": "rm -rf build/ dist/ api.zip", + "start": "func start --javascript", + "build": "tsc --build tsconfig.build.json", + "pack": "export PACK_OUT=api; export PACK_TEMP_DIR=/tmp/build/${pwd}; ../../pack.sh" + } } diff --git a/backend/functions/api/tsconfig.build.json b/backend/functions/api/tsconfig.build.json index efef3c642..bbaddc8ab 100644 --- a/backend/functions/api/tsconfig.build.json +++ b/backend/functions/api/tsconfig.build.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "outDir": "dist" + "outDir": "build" }, "extends": "../../tsconfig.json", "exclude": ["**/*.test.ts", "**/testing*", "**/fake*", "**/testing/*"] diff --git a/backend/functions/migration/package.json b/backend/functions/migration/package.json index 39aac1768..d2bde55fa 100644 --- a/backend/functions/migration/package.json +++ b/backend/functions/migration/package.json @@ -2,9 +2,11 @@ "name": "cams-migration", "version": "1.0.0", "description": "", - "workspaces": ["../../"], - "dependencies": { - "@azure/functions": "^4.6.0" - }, - "main": "dist/backend/functions/migration/*/*.js" + "main": "backend/functions/migration/*/*.js", + "scripts": { + "clean": "rm -rf build/ dist/ migration.zip", + "start": "func start --javascript", + "build": "tsc --build tsconfig.build.json", + "pack": "export PACK_OUT=migration; export PACK_TEMP_DIR=/tmp/build/${pwd}; ../../pack.sh" + } } diff --git a/backend/functions/migration/tsconfig.build.json b/backend/functions/migration/tsconfig.build.json index efef3c642..bbaddc8ab 100644 --- a/backend/functions/migration/tsconfig.build.json +++ b/backend/functions/migration/tsconfig.build.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "outDir": "dist" + "outDir": "build" }, "extends": "../../tsconfig.json", "exclude": ["**/*.test.ts", "**/testing*", "**/fake*", "**/testing/*"] diff --git a/backend/pack.sh b/backend/pack.sh new file mode 100755 index 000000000..31f6e8088 --- /dev/null +++ b/backend/pack.sh @@ -0,0 +1,11 @@ +#! /usr/bin/bash +mkdir -p dist/node_modules/ +cp -r build/* dist/ +cp -r ../../node_modules/* dist/node_modules/ +cp package.json dist/ +cp host.json dist/ +mkdir -p "$PACK_TEMP_DIR" +pushd dist || exit +zip -r "$PACK_TEMP_DIR/$PACK_OUT.zip" . --exclude "*.map" --exclude "*.ts" +popd || exit +mv "$PACK_TEMP_DIR/$PACK_OUT.zip" . diff --git a/backend/package.json b/backend/package.json index 1b45aa0ad..314cb9222 100644 --- a/backend/package.json +++ b/backend/package.json @@ -22,8 +22,8 @@ "typescript": "^5.7.2" }, "dependencies": { - "@azure/cosmos": "^4.2.0", "@azure/functions": "^4.6.0", + "@azure/cosmos": "^4.2.0", "@azure/identity": "^4.5.0", "@azure/keyvault-secrets": "^4.9.0", "@launchdarkly/node-server-sdk": "^9.7.2", @@ -41,13 +41,19 @@ "cookie": "^0.7.2" }, "scripts": { - "clean": "rm -rf ./dist && rm -rf ./node_modules && rm -rf ./coverage && npm run clean:api && npm run clean:migration", - "clean:api": "pushd functions/api && rm -rf ./dist && rm -rf ./node_modules && rm -rf ./coverage && popd", - "clean:migration": "pushd functions/migration && rm -rf ./dist && rm -rf ./node_modules && rm -rf ./coverage && popd", + "all": "npm run clean:all && npm ci && npm run build:all && npm run pack:all", + "clean:all": "npm run clean && npm run clean:api && npm run clean:migration", + "clean": "rm -rf ./dist && rm -rf ./node_modules && rm -rf ./coverage", + "clean:api": "pushd functions/api && npm run clean && popd", + "clean:migration": "pushd functions/migration && npm run clean && popd", + "build:all": "npm run build-common && npm run build && npm run build:api && npm run build:migration", "build": "tsc --build tsconfig.build.json", - "build:api": "pushd functions/api && tsc --build tsconfig.build.json && popd", - "build:migration": "pushd functions/migration && tsc --build tsconfig.build.json && popd", "build-common": "pushd ../common && npm ci && npm run build && popd", + "build:api": "npm run build && pushd functions/api && npm run build && popd", + "build:migration": "npm run build && pushd functions/migration && npm run build && popd", + "pack:all": "npm run pack:api && npm run pack:migration", + "pack:api": "pushd functions/api && npm run pack && popd", + "pack:migration": "pushd functions/migration && npm run pack && popd", "watch": "tsc --project tsconfig.build.json -w", "prestart": "npm run build", "start:api": "pushd functions/api && func start --typescript && popd", @@ -57,8 +63,6 @@ "lint": "eslint functions", "lint:fix": "eslint functions --fix", "format": "prettier --write './**/*.{js,ts,css,md,json}' --config .prettierrc", - "pack": "mkdir -p /tmp/build/api && zip -q -r /tmp/build/api/$OUT.zip . --exclude functions/api/@.funcignore --exclude functions/api/.funcignore --exclude functions/migration** && mv /tmp/build/api/$OUT.zip .", - "pack:migration": "mkdir -p /tmp/build/migration && zip -q -r /tmp/build/migration/$OUT.zip . --exclude functions/migration/@.funcignore --exclude functions/migration/.funcignore --exclude functions/api** && mv /tmp/build/migration/$OUT.zip .", "coverage": "npm test -- --coverage", "use-bash": "npm config set script-shell=/bin/bash", "coverage:ci": "npm run use-bash && npm run build-common && npm test -- --coverage", From b93ce03ab674883669e8c4434d1e84c247f7f176 Mon Sep 17 00:00:00 2001 From: Brian Posey <15091170+btposey@users.noreply.github.com> Date: Mon, 9 Dec 2024 19:01:27 -0500 Subject: [PATCH 27/49] Fix running locally vs packaging Jira ticket: CAMS-461 --- backend/functions/api/dist.package.json | 9 ++ backend/functions/api/package-lock.json | 105 ------------------ backend/functions/api/package.json | 7 +- backend/functions/migration/dist.package.json | 9 ++ backend/functions/migration/package.json | 7 +- backend/pack.sh | 4 +- backend/package.json | 6 +- 7 files changed, 32 insertions(+), 115 deletions(-) create mode 100644 backend/functions/api/dist.package.json delete mode 100644 backend/functions/api/package-lock.json create mode 100644 backend/functions/migration/dist.package.json diff --git a/backend/functions/api/dist.package.json b/backend/functions/api/dist.package.json new file mode 100644 index 000000000..f7567cb32 --- /dev/null +++ b/backend/functions/api/dist.package.json @@ -0,0 +1,9 @@ +{ + "name": "cams-api", + "version": "1.0.0", + "description": "", + "main": "backend/functions/api/*/*.function.js", + "scripts": { + "start": "func start --javascript" + } +} diff --git a/backend/functions/api/package-lock.json b/backend/functions/api/package-lock.json deleted file mode 100644 index 584f737b8..000000000 --- a/backend/functions/api/package-lock.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "name": "cams-api", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "cams-api", - "version": "1.0.0", - "workspaces": [ - "../../" - ], - "dependencies": { - "@azure/functions": "^4.6.0" - } - }, - "../..": { - "name": "node", - "version": "1.0.0", - "dependencies": { - "@azure/cosmos": "^4.2.0", - "@azure/functions": "^4.6.0", - "@azure/identity": "^4.5.0", - "@azure/keyvault-secrets": "^4.9.0", - "@launchdarkly/node-server-sdk": "^9.7.2", - "@okta/jwt-verifier": "^4.0.1", - "@okta/okta-sdk-nodejs": "^7.1.1", - "applicationinsights": "^3.4.0", - "dotenv": "^16.4.7", - "durable-functions": "^3.1.0", - "jsonwebtoken": "^9.0.2", - "mongodb": "^6.11.0", - "mssql": "^10.0.4" - }, - "devDependencies": { - "@faker-js/faker": "^9.3.0", - "@types/jest": "^29.5.14", - "@types/mssql": "^9.1.5", - "@types/node": "^22.10.1", - "@typescript-eslint/eslint-plugin": "^7.18.0", - "azure-function-context-mock": "^0.0.7", - "dependency-cruiser": "^16.7.0", - "eslint": "^8.57.1", - "eslint-config-prettier": "^9.1.0", - "eslint-plugin-import": "^2.31.0", - "eslint-plugin-n": "^16.6.2", - "eslint-plugin-prettier": "^5.2.1", - "eslint-plugin-promise": "^6.6.0", - "jest": "^29.7.0", - "prettier": "^3.4.2", - "ts-jest": "^29.2.5", - "typescript": "^5.7.2" - } - }, - "node_modules/@azure/functions": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/@azure/functions/-/functions-4.6.0.tgz", - "integrity": "sha512-vGq9jXlgrJ3KaI8bepgfpk26zVY8vFZsQukF85qjjKTAR90eFOOBNaa+mc/0ViDY2lcdrU2fL/o1pQyZUtTDsw==", - "dependencies": { - "cookie": "^0.7.0", - "long": "^4.0.0", - "undici": "^5.13.0" - }, - "engines": { - "node": ">=18.0" - } - }, - "node_modules/@fastify/busboy": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", - "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", - "engines": { - "node": ">=14" - } - }, - "node_modules/cookie": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", - "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" - }, - "node_modules/node": { - "resolved": "../..", - "link": true - }, - "node_modules/undici": { - "version": "5.28.4", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz", - "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==", - "dependencies": { - "@fastify/busboy": "^2.0.0" - }, - "engines": { - "node": ">=14.0" - } - } - } -} diff --git a/backend/functions/api/package.json b/backend/functions/api/package.json index b31326f3e..ec3200270 100644 --- a/backend/functions/api/package.json +++ b/backend/functions/api/package.json @@ -2,10 +2,11 @@ "name": "cams-api", "version": "1.0.0", "description": "", - "main": "backend/functions/api/*/*.js", + "main": "build/backend/functions/api/*/*.function.js", "scripts": { - "clean": "rm -rf build/ dist/ api.zip", - "start": "func start --javascript", + "clean": "rm -rf build/ dist/ *.zip", + "prestart": "npm run build", + "start": "func start --typescript --model v4", "build": "tsc --build tsconfig.build.json", "pack": "export PACK_OUT=api; export PACK_TEMP_DIR=/tmp/build/${pwd}; ../../pack.sh" } diff --git a/backend/functions/migration/dist.package.json b/backend/functions/migration/dist.package.json new file mode 100644 index 000000000..9edc4d695 --- /dev/null +++ b/backend/functions/migration/dist.package.json @@ -0,0 +1,9 @@ +{ + "name": "cams-migration", + "version": "1.0.0", + "description": "", + "main": "backend/functions/migration/*/*.js", + "scripts": { + "start": "func start --javascript" + } +} diff --git a/backend/functions/migration/package.json b/backend/functions/migration/package.json index d2bde55fa..04aada96a 100644 --- a/backend/functions/migration/package.json +++ b/backend/functions/migration/package.json @@ -2,10 +2,11 @@ "name": "cams-migration", "version": "1.0.0", "description": "", - "main": "backend/functions/migration/*/*.js", + "main": "build/backend/functions/migration/*/*.js", "scripts": { - "clean": "rm -rf build/ dist/ migration.zip", - "start": "func start --javascript", + "clean": "rm -rf build/ dist/ *.zip", + "prestart": "npm run build", + "start": "func start --typescript --model v4", "build": "tsc --build tsconfig.build.json", "pack": "export PACK_OUT=migration; export PACK_TEMP_DIR=/tmp/build/${pwd}; ../../pack.sh" } diff --git a/backend/pack.sh b/backend/pack.sh index 31f6e8088..d76060bef 100755 --- a/backend/pack.sh +++ b/backend/pack.sh @@ -1,8 +1,8 @@ -#! /usr/bin/bash +#! /bin/bash mkdir -p dist/node_modules/ cp -r build/* dist/ cp -r ../../node_modules/* dist/node_modules/ -cp package.json dist/ +cp dist.package.json dist/package.json cp host.json dist/ mkdir -p "$PACK_TEMP_DIR" pushd dist || exit diff --git a/backend/package.json b/backend/package.json index 314cb9222..b568ff9b9 100644 --- a/backend/package.json +++ b/backend/package.json @@ -52,12 +52,14 @@ "build:api": "npm run build && pushd functions/api && npm run build && popd", "build:migration": "npm run build && pushd functions/migration && npm run build && popd", "pack:all": "npm run pack:api && npm run pack:migration", + "pack": "npm run pack:api", "pack:api": "pushd functions/api && npm run pack && popd", "pack:migration": "pushd functions/migration && npm run pack && popd", "watch": "tsc --project tsconfig.build.json -w", "prestart": "npm run build", - "start:api": "pushd functions/api && func start --typescript && popd", - "start:migration": "pushd functions/migration && func start --typescript && popd", + "start": "npm run start:api", + "start:api": "pushd functions/api && npm run start && popd", + "start:migration": "pushd functions/migration && npm run start && popd", "test": "CAMS_LOGIN_PROVIDER='mock' DATABASE_MOCK='true' MONGO_CONNECTION_STRING='mongodb://test-string' jest -c jest.config.js", "test:open-handles": "CAMS_LOGIN_PROVIDER='mock' DATABASE_MOCK='true' MONGO_CONNECTION_STRING='mongodb://test-string' jest -c jest.config.js --detectOpenHandles", "lint": "eslint functions", From 307cdd4b2806825cd94f7f06351ad18ec2dac6cb Mon Sep 17 00:00:00 2001 From: Brian Posey <15091170+btposey@users.noreply.github.com> Date: Mon, 9 Dec 2024 19:08:49 -0500 Subject: [PATCH 28/49] Limit redundant builds when starting locally Jira ticket: CAMS-461 --- backend/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/package.json b/backend/package.json index b568ff9b9..0e125877f 100644 --- a/backend/package.json +++ b/backend/package.json @@ -49,14 +49,14 @@ "build:all": "npm run build-common && npm run build && npm run build:api && npm run build:migration", "build": "tsc --build tsconfig.build.json", "build-common": "pushd ../common && npm ci && npm run build && popd", - "build:api": "npm run build && pushd functions/api && npm run build && popd", - "build:migration": "npm run build && pushd functions/migration && npm run build && popd", + "build:api": "pushd functions/api && npm run build && popd", + "build:migration": "pushd functions/migration && npm run build && popd", "pack:all": "npm run pack:api && npm run pack:migration", "pack": "npm run pack:api", "pack:api": "pushd functions/api && npm run pack && popd", "pack:migration": "pushd functions/migration && npm run pack && popd", "watch": "tsc --project tsconfig.build.json -w", - "prestart": "npm run build", + "prestart": "npm run build-common && npm run build", "start": "npm run start:api", "start:api": "pushd functions/api && npm run start && popd", "start:migration": "pushd functions/migration && npm run start && popd", From e6b42af416fc6e2bc7dfdff31f47dc3e6a19fdee Mon Sep 17 00:00:00 2001 From: Brian Posey <15091170+btposey@users.noreply.github.com> Date: Mon, 9 Dec 2024 19:20:14 -0500 Subject: [PATCH 29/49] Sync .env and local.settings.json with functions Jira ticket: CAMS-461 --- backend/functions/api/package.json | 2 +- backend/functions/migration/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/functions/api/package.json b/backend/functions/api/package.json index ec3200270..2de0ebcd0 100644 --- a/backend/functions/api/package.json +++ b/backend/functions/api/package.json @@ -5,7 +5,7 @@ "main": "build/backend/functions/api/*/*.function.js", "scripts": { "clean": "rm -rf build/ dist/ *.zip", - "prestart": "npm run build", + "prestart": "npm run build && cp ../../.env ../../local.settings.json .", "start": "func start --typescript --model v4", "build": "tsc --build tsconfig.build.json", "pack": "export PACK_OUT=api; export PACK_TEMP_DIR=/tmp/build/${pwd}; ../../pack.sh" diff --git a/backend/functions/migration/package.json b/backend/functions/migration/package.json index 04aada96a..2911ae88d 100644 --- a/backend/functions/migration/package.json +++ b/backend/functions/migration/package.json @@ -5,7 +5,7 @@ "main": "build/backend/functions/migration/*/*.js", "scripts": { "clean": "rm -rf build/ dist/ *.zip", - "prestart": "npm run build", + "prestart": "npm run build && cp ../../.env ../../local.settings.json .", "start": "func start --typescript --model v4", "build": "tsc --build tsconfig.build.json", "pack": "export PACK_OUT=migration; export PACK_TEMP_DIR=/tmp/build/${pwd}; ../../pack.sh" From e27a24aecabba5fabf5c1d7622c7d3cab9ca309f Mon Sep 17 00:00:00 2001 From: Brian Posey <15091170+btposey@users.noreply.github.com> Date: Mon, 9 Dec 2024 19:35:30 -0500 Subject: [PATCH 30/49] Use OUT env var for naming package archive Jira ticket: CAMS-461 --- backend/pack.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/backend/pack.sh b/backend/pack.sh index d76060bef..fcad82b2e 100755 --- a/backend/pack.sh +++ b/backend/pack.sh @@ -1,4 +1,11 @@ #! /bin/bash + +if [[ $OUT == "" ]]; then + FILE_NAME=$PACK_OUT; +else + FILE_NAME=$OUT; +fi + mkdir -p dist/node_modules/ cp -r build/* dist/ cp -r ../../node_modules/* dist/node_modules/ @@ -6,6 +13,6 @@ cp dist.package.json dist/package.json cp host.json dist/ mkdir -p "$PACK_TEMP_DIR" pushd dist || exit -zip -r "$PACK_TEMP_DIR/$PACK_OUT.zip" . --exclude "*.map" --exclude "*.ts" +zip -r "$PACK_TEMP_DIR/$FILE_NAME.zip" . --exclude "*.map" --exclude "*.ts" popd || exit -mv "$PACK_TEMP_DIR/$PACK_OUT.zip" . +mv "$PACK_TEMP_DIR/$FILE_NAME.zip" . From f545c1a9bcdd9f23b24a6c7b81e44d3b12523180 Mon Sep 17 00:00:00 2001 From: Brian Posey <15091170+btposey@users.noreply.github.com> Date: Mon, 9 Dec 2024 19:44:03 -0500 Subject: [PATCH 31/49] Fix temp archive path and file name for CI pipeline Jira ticket: CAMS-461 --- backend/functions/api/package.json | 2 +- backend/functions/migration/package.json | 2 +- backend/pack.sh | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/backend/functions/api/package.json b/backend/functions/api/package.json index 2de0ebcd0..e946bd94c 100644 --- a/backend/functions/api/package.json +++ b/backend/functions/api/package.json @@ -8,6 +8,6 @@ "prestart": "npm run build && cp ../../.env ../../local.settings.json .", "start": "func start --typescript --model v4", "build": "tsc --build tsconfig.build.json", - "pack": "export PACK_OUT=api; export PACK_TEMP_DIR=/tmp/build/${pwd}; ../../pack.sh" + "pack": "export PACK_OUT=api; ../../pack.sh api" } } diff --git a/backend/functions/migration/package.json b/backend/functions/migration/package.json index 2911ae88d..d46b926f9 100644 --- a/backend/functions/migration/package.json +++ b/backend/functions/migration/package.json @@ -8,6 +8,6 @@ "prestart": "npm run build && cp ../../.env ../../local.settings.json .", "start": "func start --typescript --model v4", "build": "tsc --build tsconfig.build.json", - "pack": "export PACK_OUT=migration; export PACK_TEMP_DIR=/tmp/build/${pwd}; ../../pack.sh" + "pack": "export PACK_OUT=migration; ../../pack.sh migration" } } diff --git a/backend/pack.sh b/backend/pack.sh index fcad82b2e..334959d78 100755 --- a/backend/pack.sh +++ b/backend/pack.sh @@ -6,6 +6,10 @@ else FILE_NAME=$OUT; fi +PACK_TEMP_DIR="/tmp/build/$1" + +echo "Creating archive $PACK_TEMP_DIR/$FILE_NAME.zip" + mkdir -p dist/node_modules/ cp -r build/* dist/ cp -r ../../node_modules/* dist/node_modules/ @@ -13,6 +17,6 @@ cp dist.package.json dist/package.json cp host.json dist/ mkdir -p "$PACK_TEMP_DIR" pushd dist || exit -zip -r "$PACK_TEMP_DIR/$FILE_NAME.zip" . --exclude "*.map" --exclude "*.ts" +zip -q -r "$PACK_TEMP_DIR/$FILE_NAME.zip" . --exclude "*.map" --exclude "*.ts" popd || exit mv "$PACK_TEMP_DIR/$FILE_NAME.zip" . From 8505c2afc45f9c20ececd261f5f0518e3d0cb211 Mon Sep 17 00:00:00 2001 From: Brian Posey <15091170+btposey@users.noreply.github.com> Date: Mon, 9 Dec 2024 19:48:56 -0500 Subject: [PATCH 32/49] Fix paths to archive in Github workflow Jira ticket: CAMS-461 --- .github/workflows/sub-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sub-build.yml b/.github/workflows/sub-build.yml index baccd6761..75f52b665 100644 --- a/.github/workflows/sub-build.yml +++ b/.github/workflows/sub-build.yml @@ -117,12 +117,12 @@ jobs: uses: actions/upload-artifact@v4.4.0 with: name: ${{ inputs.apiFunctionName }}-build - path: backend/${{ inputs.apiFunctionName }}.zip + path: backend/function/api/${{ inputs.apiFunctionName }}.zip if-no-files-found: error - name: Upload Migration Azure Functions Artifact uses: actions/upload-artifact@v4.4.0 with: name: ${{ inputs.migrationFunctionName }}-build - path: backend/${{ inputs.migrationFunctionName }}.zip + path: backend/functions/migration/${{ inputs.migrationFunctionName }}.zip if-no-files-found: error From 7264fb4b10ece1673e745b7dc149b73a5efada35 Mon Sep 17 00:00:00 2001 From: Brian Posey <15091170+btposey@users.noreply.github.com> Date: Mon, 9 Dec 2024 19:53:06 -0500 Subject: [PATCH 33/49] Fix typo in functions archive path Jira ticket: CAMS-461 --- .github/workflows/sub-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sub-build.yml b/.github/workflows/sub-build.yml index 75f52b665..e4289b6f3 100644 --- a/.github/workflows/sub-build.yml +++ b/.github/workflows/sub-build.yml @@ -117,7 +117,7 @@ jobs: uses: actions/upload-artifact@v4.4.0 with: name: ${{ inputs.apiFunctionName }}-build - path: backend/function/api/${{ inputs.apiFunctionName }}.zip + path: backend/functions/api/${{ inputs.apiFunctionName }}.zip if-no-files-found: error - name: Upload Migration Azure Functions Artifact From 2fa3214a755c267171c4ea227ea1e024b6856a2c Mon Sep 17 00:00:00 2001 From: Brian Posey <15091170+btposey@users.noreply.github.com> Date: Mon, 9 Dec 2024 20:01:23 -0500 Subject: [PATCH 34/49] Simplify pack.sh env var param for file name Jira ticket: CAMS-461 --- backend/functions/api/package.json | 2 +- backend/functions/migration/package.json | 2 +- backend/pack.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/functions/api/package.json b/backend/functions/api/package.json index e946bd94c..a11c5cb70 100644 --- a/backend/functions/api/package.json +++ b/backend/functions/api/package.json @@ -8,6 +8,6 @@ "prestart": "npm run build && cp ../../.env ../../local.settings.json .", "start": "func start --typescript --model v4", "build": "tsc --build tsconfig.build.json", - "pack": "export PACK_OUT=api; ../../pack.sh api" + "pack": "../../pack.sh api" } } diff --git a/backend/functions/migration/package.json b/backend/functions/migration/package.json index d46b926f9..7d6bce5c7 100644 --- a/backend/functions/migration/package.json +++ b/backend/functions/migration/package.json @@ -8,6 +8,6 @@ "prestart": "npm run build && cp ../../.env ../../local.settings.json .", "start": "func start --typescript --model v4", "build": "tsc --build tsconfig.build.json", - "pack": "export PACK_OUT=migration; ../../pack.sh migration" + "pack": "../../pack.sh migration" } } diff --git a/backend/pack.sh b/backend/pack.sh index 334959d78..fc106f431 100755 --- a/backend/pack.sh +++ b/backend/pack.sh @@ -1,7 +1,7 @@ #! /bin/bash if [[ $OUT == "" ]]; then - FILE_NAME=$PACK_OUT; + FILE_NAME=$1; else FILE_NAME=$OUT; fi From 3da41aee8734885c765fad82ebeae7c2d8879f24 Mon Sep 17 00:00:00 2001 From: Brian Posey <15091170+btposey@users.noreply.github.com> Date: Tue, 10 Dec 2024 09:49:14 -0500 Subject: [PATCH 35/49] Consolidate build dir back into dist Jira ticket: CAMS-461 Co-authored-by: Arthur Morrow <133667008+amorrow-flexion@users.noreply.github.com> Co-authored-by: Brian Posey <15091170+btposey@users.noreply.github.com>, --- .gitignore | 3 +-- backend/functions/api/dist.package.json | 9 --------- backend/functions/api/package.json | 6 +++--- backend/functions/api/tsconfig.build.json | 2 +- backend/functions/migration/dist.package.json | 9 --------- backend/functions/migration/package.json | 6 +++--- backend/functions/migration/tsconfig.build.json | 2 +- backend/pack.sh | 12 ++++-------- 8 files changed, 13 insertions(+), 36 deletions(-) delete mode 100644 backend/functions/api/dist.package.json delete mode 100644 backend/functions/migration/dist.package.json diff --git a/.gitignore b/.gitignore index 79426714e..bebb0bbf8 100644 --- a/.gitignore +++ b/.gitignore @@ -75,9 +75,8 @@ cams1.code-workspace # Node **/node_modules/ -# Build and Dist +# Dist **/dist/ -**/build/ # Veracode **/pipeline-scan* diff --git a/backend/functions/api/dist.package.json b/backend/functions/api/dist.package.json deleted file mode 100644 index f7567cb32..000000000 --- a/backend/functions/api/dist.package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "cams-api", - "version": "1.0.0", - "description": "", - "main": "backend/functions/api/*/*.function.js", - "scripts": { - "start": "func start --javascript" - } -} diff --git a/backend/functions/api/package.json b/backend/functions/api/package.json index a11c5cb70..d829f969c 100644 --- a/backend/functions/api/package.json +++ b/backend/functions/api/package.json @@ -2,11 +2,11 @@ "name": "cams-api", "version": "1.0.0", "description": "", - "main": "build/backend/functions/api/*/*.function.js", + "main": "dist/backend/functions/api/*/*.function.js", "scripts": { - "clean": "rm -rf build/ dist/ *.zip", + "clean": "rm -rf dist/ node_modules/ *.zip", "prestart": "npm run build && cp ../../.env ../../local.settings.json .", - "start": "func start --typescript --model v4", + "start": "func start --javascript", "build": "tsc --build tsconfig.build.json", "pack": "../../pack.sh api" } diff --git a/backend/functions/api/tsconfig.build.json b/backend/functions/api/tsconfig.build.json index bbaddc8ab..efef3c642 100644 --- a/backend/functions/api/tsconfig.build.json +++ b/backend/functions/api/tsconfig.build.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "outDir": "build" + "outDir": "dist" }, "extends": "../../tsconfig.json", "exclude": ["**/*.test.ts", "**/testing*", "**/fake*", "**/testing/*"] diff --git a/backend/functions/migration/dist.package.json b/backend/functions/migration/dist.package.json deleted file mode 100644 index 9edc4d695..000000000 --- a/backend/functions/migration/dist.package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "cams-migration", - "version": "1.0.0", - "description": "", - "main": "backend/functions/migration/*/*.js", - "scripts": { - "start": "func start --javascript" - } -} diff --git a/backend/functions/migration/package.json b/backend/functions/migration/package.json index 7d6bce5c7..7ab29411a 100644 --- a/backend/functions/migration/package.json +++ b/backend/functions/migration/package.json @@ -2,11 +2,11 @@ "name": "cams-migration", "version": "1.0.0", "description": "", - "main": "build/backend/functions/migration/*/*.js", + "main": "dist/backend/functions/migration/loadConsolidations.js", "scripts": { - "clean": "rm -rf build/ dist/ *.zip", + "clean": "rm -rf dist/ node_modules/ *.zip", "prestart": "npm run build && cp ../../.env ../../local.settings.json .", - "start": "func start --typescript --model v4", + "start": "func start --javascript", "build": "tsc --build tsconfig.build.json", "pack": "../../pack.sh migration" } diff --git a/backend/functions/migration/tsconfig.build.json b/backend/functions/migration/tsconfig.build.json index bbaddc8ab..efef3c642 100644 --- a/backend/functions/migration/tsconfig.build.json +++ b/backend/functions/migration/tsconfig.build.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "outDir": "build" + "outDir": "dist" }, "extends": "../../tsconfig.json", "exclude": ["**/*.test.ts", "**/testing*", "**/fake*", "**/testing/*"] diff --git a/backend/pack.sh b/backend/pack.sh index fc106f431..8aa980a34 100755 --- a/backend/pack.sh +++ b/backend/pack.sh @@ -10,13 +10,9 @@ PACK_TEMP_DIR="/tmp/build/$1" echo "Creating archive $PACK_TEMP_DIR/$FILE_NAME.zip" -mkdir -p dist/node_modules/ -cp -r build/* dist/ -cp -r ../../node_modules/* dist/node_modules/ -cp dist.package.json dist/package.json -cp host.json dist/ +mkdir -p dist/ +mkdir -p node_modules/ +cp -r ../../node_modules/* node_modules/ mkdir -p "$PACK_TEMP_DIR" -pushd dist || exit -zip -q -r "$PACK_TEMP_DIR/$FILE_NAME.zip" . --exclude "*.map" --exclude "*.ts" -popd || exit +zip -q -r "$PACK_TEMP_DIR/$FILE_NAME.zip" ./dist ./node_modules ./package.json ./host.json --exclude "*.map" --exclude "*.ts" mv "$PACK_TEMP_DIR/$FILE_NAME.zip" . From f08ad210d7152ad9f659c1bcd306fcc71d05c175 Mon Sep 17 00:00:00 2001 From: James Brooks <12275865+jamesobrooks@users.noreply.github.com> Date: Tue, 10 Dec 2024 12:09:17 -0600 Subject: [PATCH 36/49] Run clean:all for the backend instead of clean I would actually prefer to not make this change, rather change the clean script in the backend to clean all. But I'd like to hear what others' thoughts are about this. [skip ci] Jira ticket: CAMS-461 --- ops/scripts/utility/clean-all-projects.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ops/scripts/utility/clean-all-projects.sh b/ops/scripts/utility/clean-all-projects.sh index 04247a166..377dfbbc9 100755 --- a/ops/scripts/utility/clean-all-projects.sh +++ b/ops/scripts/utility/clean-all-projects.sh @@ -6,7 +6,7 @@ # From the root directory, run the following command: # ./ops/scripts/utility/clean-all-projects.sh -PROJECTS=("backend" "common" "dev-tools" "test/e2e" "user-interface") +PROJECTS=("common" "dev-tools" "test/e2e" "user-interface") for str in "${PROJECTS[@]}"; do pushd "${str}" || exit @@ -15,4 +15,9 @@ for str in "${PROJECTS[@]}"; do popd || exit done +pushd "backend" || exit +echo "Cleaning backend." +npm run clean:all +popd || exit + exit 0 From 080fd0e9c8a85dc43565279bba97652f1cf78e25 Mon Sep 17 00:00:00 2001 From: James Brooks <12275865+jamesobrooks@users.noreply.github.com> Date: Tue, 10 Dec 2024 12:16:18 -0600 Subject: [PATCH 37/49] Ignore package-lock.json files The api and migration packages exist to manage Azure Functions, not npm packages. For the time being, they should not have their own dependencies and thus should never have 'npm ci' run against them as part of the build process. [skip ci] Jira ticket: CAMS-461 --- backend/functions/api/.gitignore | 2 + backend/functions/migration/.gitignore | 2 + backend/functions/migration/package-lock.json | 105 ------------------ 3 files changed, 4 insertions(+), 105 deletions(-) create mode 100644 backend/functions/api/.gitignore create mode 100644 backend/functions/migration/.gitignore delete mode 100644 backend/functions/migration/package-lock.json diff --git a/backend/functions/api/.gitignore b/backend/functions/api/.gitignore new file mode 100644 index 000000000..ee0da9b3f --- /dev/null +++ b/backend/functions/api/.gitignore @@ -0,0 +1,2 @@ +# Ignore package-lock.json as this project should not have its own dependencies +package-lock.json diff --git a/backend/functions/migration/.gitignore b/backend/functions/migration/.gitignore new file mode 100644 index 000000000..ee0da9b3f --- /dev/null +++ b/backend/functions/migration/.gitignore @@ -0,0 +1,2 @@ +# Ignore package-lock.json as this project should not have its own dependencies +package-lock.json diff --git a/backend/functions/migration/package-lock.json b/backend/functions/migration/package-lock.json deleted file mode 100644 index d43500849..000000000 --- a/backend/functions/migration/package-lock.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "name": "cams-migration", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "cams-migration", - "version": "1.0.0", - "workspaces": [ - "../../" - ], - "dependencies": { - "@azure/functions": "^4.6.0" - } - }, - "../..": { - "name": "node", - "version": "1.0.0", - "dependencies": { - "@azure/cosmos": "^4.2.0", - "@azure/functions": "^4.6.0", - "@azure/identity": "^4.5.0", - "@azure/keyvault-secrets": "^4.9.0", - "@launchdarkly/node-server-sdk": "^9.7.2", - "@okta/jwt-verifier": "^4.0.1", - "@okta/okta-sdk-nodejs": "^7.1.1", - "applicationinsights": "^3.4.0", - "dotenv": "^16.4.7", - "durable-functions": "^3.1.0", - "jsonwebtoken": "^9.0.2", - "mongodb": "^6.11.0", - "mssql": "^10.0.4" - }, - "devDependencies": { - "@faker-js/faker": "^9.3.0", - "@types/jest": "^29.5.14", - "@types/mssql": "^9.1.5", - "@types/node": "^22.10.1", - "@typescript-eslint/eslint-plugin": "^7.18.0", - "azure-function-context-mock": "^0.0.7", - "dependency-cruiser": "^16.7.0", - "eslint": "^8.57.1", - "eslint-config-prettier": "^9.1.0", - "eslint-plugin-import": "^2.31.0", - "eslint-plugin-n": "^16.6.2", - "eslint-plugin-prettier": "^5.2.1", - "eslint-plugin-promise": "^6.6.0", - "jest": "^29.7.0", - "prettier": "^3.4.2", - "ts-jest": "^29.2.5", - "typescript": "^5.7.2" - } - }, - "node_modules/@azure/functions": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/@azure/functions/-/functions-4.6.0.tgz", - "integrity": "sha512-vGq9jXlgrJ3KaI8bepgfpk26zVY8vFZsQukF85qjjKTAR90eFOOBNaa+mc/0ViDY2lcdrU2fL/o1pQyZUtTDsw==", - "dependencies": { - "cookie": "^0.7.0", - "long": "^4.0.0", - "undici": "^5.13.0" - }, - "engines": { - "node": ">=18.0" - } - }, - "node_modules/@fastify/busboy": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", - "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", - "engines": { - "node": ">=14" - } - }, - "node_modules/cookie": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", - "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" - }, - "node_modules/node": { - "resolved": "../..", - "link": true - }, - "node_modules/undici": { - "version": "5.28.4", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz", - "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==", - "dependencies": { - "@fastify/busboy": "^2.0.0" - }, - "engines": { - "node": ">=14.0" - } - } - } -} From 9a836434130f21e95785f46e2b72900e82debe2e Mon Sep 17 00:00:00 2001 From: James Brooks <12275865+jamesobrooks@users.noreply.github.com> Date: Tue, 10 Dec 2024 12:46:58 -0600 Subject: [PATCH 38/49] Fix lint scripts [skip ci] Jira ticket: CAMS-461 --- backend/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/package.json b/backend/package.json index 0e125877f..6430aa6ec 100644 --- a/backend/package.json +++ b/backend/package.json @@ -62,8 +62,8 @@ "start:migration": "pushd functions/migration && npm run start && popd", "test": "CAMS_LOGIN_PROVIDER='mock' DATABASE_MOCK='true' MONGO_CONNECTION_STRING='mongodb://test-string' jest -c jest.config.js", "test:open-handles": "CAMS_LOGIN_PROVIDER='mock' DATABASE_MOCK='true' MONGO_CONNECTION_STRING='mongodb://test-string' jest -c jest.config.js --detectOpenHandles", - "lint": "eslint functions", - "lint:fix": "eslint functions --fix", + "lint": "eslint .", + "lint:fix": "eslint . --fix", "format": "prettier --write './**/*.{js,ts,css,md,json}' --config .prettierrc", "coverage": "npm test -- --coverage", "use-bash": "npm config set script-shell=/bin/bash", From 39e05ac1e13d79823d8a2a7c8eef277ab83ccef4 Mon Sep 17 00:00:00 2001 From: James Brooks <12275865+jamesobrooks@users.noreply.github.com> Date: Tue, 10 Dec 2024 12:58:23 -0600 Subject: [PATCH 39/49] Remove unused file Jira ticket: CAMS-461 Co-authored-by: Fritz Madden <96319835+fmaddenflx@users.noreply.github.com> Co-authored-by: Arthur Morrow <133667008+amorrow-flexion@users.noreply.github.com> Co-authored-by: Brian Posey <15091170+btposey@users.noreply.github.com>, --- backend/lib/load-env.ts | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 backend/lib/load-env.ts diff --git a/backend/lib/load-env.ts b/backend/lib/load-env.ts deleted file mode 100644 index 4e6e17fd2..000000000 --- a/backend/lib/load-env.ts +++ /dev/null @@ -1,8 +0,0 @@ -import * as dotenv from 'dotenv'; -import * as path from 'path'; - -function loadEnv() { - dotenv.config({ path: path.resolve(__dirname, '../.env') }); -} - -module.exports = { loadEnv }; From 2edede57e5737fd5559239704c136bf8165d553c Mon Sep 17 00:00:00 2001 From: James Brooks <12275865+jamesobrooks@users.noreply.github.com> Date: Tue, 10 Dec 2024 13:00:00 -0600 Subject: [PATCH 40/49] Clean up use of clean scripts Jira ticket: CAMS-461 Co-authored-by: Fritz Madden <96319835+fmaddenflx@users.noreply.github.com> Co-authored-by: Arthur Morrow <133667008+amorrow-flexion@users.noreply.github.com> Co-authored-by: Brian Posey <15091170+btposey@users.noreply.github.com>, --- backend/functions/api/package.json | 4 ++-- backend/functions/migration/package.json | 4 ++-- backend/pack.sh | 1 + ops/scripts/utility/clean-all-projects.sh | 7 +------ ops/scripts/utility/clean-install-all-projects.sh | 2 +- 5 files changed, 7 insertions(+), 11 deletions(-) diff --git a/backend/functions/api/package.json b/backend/functions/api/package.json index d829f969c..7e76ee65a 100644 --- a/backend/functions/api/package.json +++ b/backend/functions/api/package.json @@ -4,8 +4,8 @@ "description": "", "main": "dist/backend/functions/api/*/*.function.js", "scripts": { - "clean": "rm -rf dist/ node_modules/ *.zip", - "prestart": "npm run build && cp ../../.env ../../local.settings.json .", + "clean": "rm -rf ./dist ./node_modules *.zip", + "prestart": "npm run build && cp ../../.env .", "start": "func start --javascript", "build": "tsc --build tsconfig.build.json", "pack": "../../pack.sh api" diff --git a/backend/functions/migration/package.json b/backend/functions/migration/package.json index 7ab29411a..d800a2273 100644 --- a/backend/functions/migration/package.json +++ b/backend/functions/migration/package.json @@ -4,8 +4,8 @@ "description": "", "main": "dist/backend/functions/migration/loadConsolidations.js", "scripts": { - "clean": "rm -rf dist/ node_modules/ *.zip", - "prestart": "npm run build && cp ../../.env ../../local.settings.json .", + "clean": "rm -rf ./dist ./node_modules *.zip", + "prestart": "npm run build && cp ../../.env .", "start": "func start --javascript", "build": "tsc --build tsconfig.build.json", "pack": "../../pack.sh migration" diff --git a/backend/pack.sh b/backend/pack.sh index 8aa980a34..5bc240a59 100755 --- a/backend/pack.sh +++ b/backend/pack.sh @@ -16,3 +16,4 @@ cp -r ../../node_modules/* node_modules/ mkdir -p "$PACK_TEMP_DIR" zip -q -r "$PACK_TEMP_DIR/$FILE_NAME.zip" ./dist ./node_modules ./package.json ./host.json --exclude "*.map" --exclude "*.ts" mv "$PACK_TEMP_DIR/$FILE_NAME.zip" . +rm -rf node_modules diff --git a/ops/scripts/utility/clean-all-projects.sh b/ops/scripts/utility/clean-all-projects.sh index 377dfbbc9..4db4d5815 100755 --- a/ops/scripts/utility/clean-all-projects.sh +++ b/ops/scripts/utility/clean-all-projects.sh @@ -6,7 +6,7 @@ # From the root directory, run the following command: # ./ops/scripts/utility/clean-all-projects.sh -PROJECTS=("common" "dev-tools" "test/e2e" "user-interface") +PROJECTS=("backend" "backend/functions/api" "backend/functions/migration" "common" "dev-tools" "test/e2e" "user-interface") for str in "${PROJECTS[@]}"; do pushd "${str}" || exit @@ -15,9 +15,4 @@ for str in "${PROJECTS[@]}"; do popd || exit done -pushd "backend" || exit -echo "Cleaning backend." -npm run clean:all -popd || exit - exit 0 diff --git a/ops/scripts/utility/clean-install-all-projects.sh b/ops/scripts/utility/clean-install-all-projects.sh index 49d4e4b4c..82c878a12 100755 --- a/ops/scripts/utility/clean-install-all-projects.sh +++ b/ops/scripts/utility/clean-install-all-projects.sh @@ -6,7 +6,7 @@ # From the root directory, run the following command: # ./ops/scripts/utility/clean-all-projects.sh -PROJECTS=("backend" "backend/functions/api" "backend/functions/migration" "common" "dev-tools" "test/e2e" "user-interface") +PROJECTS=("backend" "common" "dev-tools" "test/e2e" "user-interface") for str in "${PROJECTS[@]}"; do pushd "${str}" || exit From 7f5bb804b6b37757dbc9bba6aeae1b0d36d433c0 Mon Sep 17 00:00:00 2001 From: James Brooks <12275865+jamesobrooks@users.noreply.github.com> Date: Tue, 10 Dec 2024 13:21:11 -0600 Subject: [PATCH 41/49] Remove unused scripts Jira ticket: CAMS-461 Co-authored-by: Fritz Madden <96319835+fmaddenflx@users.noreply.github.com> Co-authored-by: Arthur Morrow <133667008+amorrow-flexion@users.noreply.github.com> Co-authored-by: Brian Posey <15091170+btposey@users.noreply.github.com>, --- backend/package.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/backend/package.json b/backend/package.json index 6430aa6ec..50b6cd37f 100644 --- a/backend/package.json +++ b/backend/package.json @@ -55,8 +55,6 @@ "pack": "npm run pack:api", "pack:api": "pushd functions/api && npm run pack && popd", "pack:migration": "pushd functions/migration && npm run pack && popd", - "watch": "tsc --project tsconfig.build.json -w", - "prestart": "npm run build-common && npm run build", "start": "npm run start:api", "start:api": "pushd functions/api && npm run start && popd", "start:migration": "pushd functions/migration && npm run start && popd", From 9a08c59acbfa94d368c600a0672fda80e01375e8 Mon Sep 17 00:00:00 2001 From: James Brooks <12275865+jamesobrooks@users.noreply.github.com> Date: Tue, 10 Dec 2024 13:30:27 -0600 Subject: [PATCH 42/49] Rename functions directory to function-apps Jira ticket: CAMS-461 Co-authored-by: Fritz Madden <96319835+fmaddenflx@users.noreply.github.com> Co-authored-by: Arthur Morrow <133667008+amorrow-flexion@users.noreply.github.com> Co-authored-by: Brian Posey <15091170+btposey@users.noreply.github.com>, --- .github/workflows/sub-build.yml | 4 +-- architecture/export-architecture-diagrams.sh | 4 +-- .../api/.funcignore | 0 .../api/.gitignore | 0 .../api/attorneys/attorneys.function.test.ts | 0 .../api/attorneys/attorneys.function.ts | 0 .../case.assignment.function.test.ts | 0 .../case.assignment.function.ts | 0 .../case-associated.function.test.ts | 0 .../case-associated.function.ts | 0 .../case-docket/case-docket.function.test.ts | 0 .../api/case-docket/case-docket.function.ts | 0 .../case-history.function.test.ts | 0 .../api/case-history/case-history.function.ts | 0 .../case-summary.function.test.ts | 0 .../api/case-summary/case-summary.function.ts | 0 .../api/cases/cases.function.test.ts | 0 .../api/cases/cases.function.ts | 0 .../consolidations.function.test.ts | 0 .../consolidations/consolidations.function.ts | 0 .../api/courts/courts.function.test.ts | 0 .../api/courts/courts.function.ts | 0 .../healthcheck/healthcheck.db.cosmos.test.ts | 0 .../api/healthcheck/healthcheck.db.cosmos.ts | 0 .../api/healthcheck/healthcheck.db.sql.ts | 0 .../api/healthcheck/healthcheck.function.ts | 0 .../api/healthcheck/healthcheck.info.ts | 0 .../api/healthcheck/healthcheck.test.ts | 0 .../api/host.json | 0 .../api/me/me.function.test.ts | 0 .../api/me/me.function.ts | 0 .../api/oauth2/mock-oauth2.function.ts | 0 .../office-staff-sync.function.test.ts | 0 .../office-staff-sync.function.ts | 0 .../api/offices/offices.function.test.ts | 0 .../api/offices/offices.function.ts | 0 .../orders-manual-sync.function.test.ts | 0 .../orders-manual-sync.function.ts | 0 .../orders-suggestions.function.test.ts | 0 .../orders-suggestions.function.ts | 0 .../orders-sync/orders-sync.function.test.ts | 0 .../api/orders-sync/orders-sync.function.ts | 0 .../api/orders/orders.function.test.ts | 0 .../api/orders/orders.function.ts | 0 .../api/package.json | 0 .../api/tsconfig.build.json | 0 .../azure/app-insights.ts | 0 .../azure/application-context-creator.test.ts | 0 .../azure/application-context-creator.ts | 0 .../azure/functions.test.ts | 2 +- .../azure/functions.ts | 0 .../azure/testing-helpers.ts | 0 .../migration/.funcignore | 0 .../migration/.gitignore | 0 .../activity/flattenBoundingArrays.test.ts | 0 .../activity/flattenBoundingArrays.ts | 0 .../activity/getConsolidations.test.ts | 0 .../migration/activity/getConsolidations.ts | 0 .../migration/activity/getPageCount.test.ts | 0 .../migration/activity/getPageCount.ts | 0 .../activity/migrateConsolidation.ts | 0 .../activity/migrateConsolidations.test.ts | 0 .../client/acms-migration-trigger.function.ts | 0 .../migration/host.json | 0 .../migration/loadConsolidations.ts | 0 .../migration/orchestration/orchestrator.ts | 0 .../orchestration/sub-orchestrator-etl.ts | 0 .../orchestration/sub-orchestrator-paging.ts | 0 .../migration/package.json | 0 .../migration/tsconfig.build.json | 0 backend/jest.config.js | 8 ++--- backend/lib/factory.test.ts | 2 +- .../acms-dxtr-divisions/compare-divisions.ts | 4 +-- .../lib/testing/analysis/export-office-csv.ts | 2 +- .../test-acms-migration.ts | 4 +-- .../test-okta-group-api.ts | 2 +- backend/lib/testing/testing-utilities.ts | 2 +- .../orders/orders-local-gateway.test.ts | 2 +- backend/package.json | 20 ++++++------ backend/tsconfig.build.json | 4 ++- common/src/cams/events.test.ts | 2 +- common/src/cams/users.test.ts | 2 +- .../dependency-cruiser/functions/current.svg | 32 +++++++++---------- .../dependency-graph_2023-09-18_1237.svg | 30 ++++++++--------- .../dependency-graph_2023-09-26_1701.svg | 30 ++++++++--------- .../dependency-graph_2023-09-27_1700.svg | 26 +++++++-------- .../dependency-graph_2023-10-04_1610.svg | 26 +++++++-------- .../dependency-graph_api_2023-10-19_1223.svg | 18 +++++------ .../dependency-graph_api_2023-12.svg | 26 +++++++-------- .../slots/az-slot-start-stop-operations.sh | 2 +- ops/scripts/utility/audit.sh | 2 +- ops/scripts/utility/check-outdated.sh | 2 +- ops/scripts/utility/clean-all-projects.sh | 2 +- ops/scripts/utility/run-all-tests.sh | 2 +- ops/scripts/utility/update-dependencies.sh | 2 +- test/e2e/playwright/auth-setup.ts | 2 +- user-interface/src/lib/models/api2.test.ts | 4 +-- user-interface/src/lib/utils/datetime.test.ts | 2 +- 98 files changed, 137 insertions(+), 135 deletions(-) rename backend/{functions => function-apps}/api/.funcignore (100%) rename backend/{functions => function-apps}/api/.gitignore (100%) rename backend/{functions => function-apps}/api/attorneys/attorneys.function.test.ts (100%) rename backend/{functions => function-apps}/api/attorneys/attorneys.function.ts (100%) rename backend/{functions => function-apps}/api/case-assignments/case.assignment.function.test.ts (100%) rename backend/{functions => function-apps}/api/case-assignments/case.assignment.function.ts (100%) rename backend/{functions => function-apps}/api/case-associated/case-associated.function.test.ts (100%) rename backend/{functions => function-apps}/api/case-associated/case-associated.function.ts (100%) rename backend/{functions => function-apps}/api/case-docket/case-docket.function.test.ts (100%) rename backend/{functions => function-apps}/api/case-docket/case-docket.function.ts (100%) rename backend/{functions => function-apps}/api/case-history/case-history.function.test.ts (100%) rename backend/{functions => function-apps}/api/case-history/case-history.function.ts (100%) rename backend/{functions => function-apps}/api/case-summary/case-summary.function.test.ts (100%) rename backend/{functions => function-apps}/api/case-summary/case-summary.function.ts (100%) rename backend/{functions => function-apps}/api/cases/cases.function.test.ts (100%) rename backend/{functions => function-apps}/api/cases/cases.function.ts (100%) rename backend/{functions => function-apps}/api/consolidations/consolidations.function.test.ts (100%) rename backend/{functions => function-apps}/api/consolidations/consolidations.function.ts (100%) rename backend/{functions => function-apps}/api/courts/courts.function.test.ts (100%) rename backend/{functions => function-apps}/api/courts/courts.function.ts (100%) rename backend/{functions => function-apps}/api/healthcheck/healthcheck.db.cosmos.test.ts (100%) rename backend/{functions => function-apps}/api/healthcheck/healthcheck.db.cosmos.ts (100%) rename backend/{functions => function-apps}/api/healthcheck/healthcheck.db.sql.ts (100%) rename backend/{functions => function-apps}/api/healthcheck/healthcheck.function.ts (100%) rename backend/{functions => function-apps}/api/healthcheck/healthcheck.info.ts (100%) rename backend/{functions => function-apps}/api/healthcheck/healthcheck.test.ts (100%) rename backend/{functions => function-apps}/api/host.json (100%) rename backend/{functions => function-apps}/api/me/me.function.test.ts (100%) rename backend/{functions => function-apps}/api/me/me.function.ts (100%) rename backend/{functions => function-apps}/api/oauth2/mock-oauth2.function.ts (100%) rename backend/{functions => function-apps}/api/office-staff-sync/office-staff-sync.function.test.ts (100%) rename backend/{functions => function-apps}/api/office-staff-sync/office-staff-sync.function.ts (100%) rename backend/{functions => function-apps}/api/offices/offices.function.test.ts (100%) rename backend/{functions => function-apps}/api/offices/offices.function.ts (100%) rename backend/{functions => function-apps}/api/orders-manual-sync/orders-manual-sync.function.test.ts (100%) rename backend/{functions => function-apps}/api/orders-manual-sync/orders-manual-sync.function.ts (100%) rename backend/{functions => function-apps}/api/orders-suggestions/orders-suggestions.function.test.ts (100%) rename backend/{functions => function-apps}/api/orders-suggestions/orders-suggestions.function.ts (100%) rename backend/{functions => function-apps}/api/orders-sync/orders-sync.function.test.ts (100%) rename backend/{functions => function-apps}/api/orders-sync/orders-sync.function.ts (100%) rename backend/{functions => function-apps}/api/orders/orders.function.test.ts (100%) rename backend/{functions => function-apps}/api/orders/orders.function.ts (100%) rename backend/{functions => function-apps}/api/package.json (100%) rename backend/{functions => function-apps}/api/tsconfig.build.json (100%) rename backend/{functions => function-apps}/azure/app-insights.ts (100%) rename backend/{functions => function-apps}/azure/application-context-creator.test.ts (100%) rename backend/{functions => function-apps}/azure/application-context-creator.ts (100%) rename backend/{functions => function-apps}/azure/functions.test.ts (97%) rename backend/{functions => function-apps}/azure/functions.ts (100%) rename backend/{functions => function-apps}/azure/testing-helpers.ts (100%) rename backend/{functions => function-apps}/migration/.funcignore (100%) rename backend/{functions => function-apps}/migration/.gitignore (100%) rename backend/{functions => function-apps}/migration/activity/flattenBoundingArrays.test.ts (100%) rename backend/{functions => function-apps}/migration/activity/flattenBoundingArrays.ts (100%) rename backend/{functions => function-apps}/migration/activity/getConsolidations.test.ts (100%) rename backend/{functions => function-apps}/migration/activity/getConsolidations.ts (100%) rename backend/{functions => function-apps}/migration/activity/getPageCount.test.ts (100%) rename backend/{functions => function-apps}/migration/activity/getPageCount.ts (100%) rename backend/{functions => function-apps}/migration/activity/migrateConsolidation.ts (100%) rename backend/{functions => function-apps}/migration/activity/migrateConsolidations.test.ts (100%) rename backend/{functions => function-apps}/migration/client/acms-migration-trigger.function.ts (100%) rename backend/{functions => function-apps}/migration/host.json (100%) rename backend/{functions => function-apps}/migration/loadConsolidations.ts (100%) rename backend/{functions => function-apps}/migration/orchestration/orchestrator.ts (100%) rename backend/{functions => function-apps}/migration/orchestration/sub-orchestrator-etl.ts (100%) rename backend/{functions => function-apps}/migration/orchestration/sub-orchestrator-paging.ts (100%) rename backend/{functions => function-apps}/migration/package.json (100%) rename backend/{functions => function-apps}/migration/tsconfig.build.json (100%) diff --git a/.github/workflows/sub-build.yml b/.github/workflows/sub-build.yml index e4289b6f3..358a1d1b5 100644 --- a/.github/workflows/sub-build.yml +++ b/.github/workflows/sub-build.yml @@ -117,12 +117,12 @@ jobs: uses: actions/upload-artifact@v4.4.0 with: name: ${{ inputs.apiFunctionName }}-build - path: backend/functions/api/${{ inputs.apiFunctionName }}.zip + path: backend/function-apps/api/${{ inputs.apiFunctionName }}.zip if-no-files-found: error - name: Upload Migration Azure Functions Artifact uses: actions/upload-artifact@v4.4.0 with: name: ${{ inputs.migrationFunctionName }}-build - path: backend/functions/migration/${{ inputs.migrationFunctionName }}.zip + path: backend/function-apps/migration/${{ inputs.migrationFunctionName }}.zip if-no-files-found: error diff --git a/architecture/export-architecture-diagrams.sh b/architecture/export-architecture-diagrams.sh index 8324da346..0fc80478f 100755 --- a/architecture/export-architecture-diagrams.sh +++ b/architecture/export-architecture-diagrams.sh @@ -41,7 +41,7 @@ mermaid_file="./structurizr-FunctionsAPIwithWebapp.mmd" cat "$mermaid_file" printf "\n\`\`\`\n" } > temp_file.md -mv temp_file.md ../docs/architecture/diagrams/cams-webapp-with-functions-api.md +mv temp_file.md ../docs/architecture/diagrams/cams-webapp-with-function-apps-api.md ## CAMS Webapp Components mermaid_file="./structurizr-CAMSWebapp.mmd" @@ -59,6 +59,6 @@ mermaid_file="./structurizr-FunctionsAPI.mmd" cat "$mermaid_file" printf "\n\`\`\`\n" } > temp_file.md -mv temp_file.md ../docs/architecture/diagrams/cams-functions-api-components.md +mv temp_file.md ../docs/architecture/diagrams/cams-function-apps-api-components.md popd || exit diff --git a/backend/functions/api/.funcignore b/backend/function-apps/api/.funcignore similarity index 100% rename from backend/functions/api/.funcignore rename to backend/function-apps/api/.funcignore diff --git a/backend/functions/api/.gitignore b/backend/function-apps/api/.gitignore similarity index 100% rename from backend/functions/api/.gitignore rename to backend/function-apps/api/.gitignore diff --git a/backend/functions/api/attorneys/attorneys.function.test.ts b/backend/function-apps/api/attorneys/attorneys.function.test.ts similarity index 100% rename from backend/functions/api/attorneys/attorneys.function.test.ts rename to backend/function-apps/api/attorneys/attorneys.function.test.ts diff --git a/backend/functions/api/attorneys/attorneys.function.ts b/backend/function-apps/api/attorneys/attorneys.function.ts similarity index 100% rename from backend/functions/api/attorneys/attorneys.function.ts rename to backend/function-apps/api/attorneys/attorneys.function.ts diff --git a/backend/functions/api/case-assignments/case.assignment.function.test.ts b/backend/function-apps/api/case-assignments/case.assignment.function.test.ts similarity index 100% rename from backend/functions/api/case-assignments/case.assignment.function.test.ts rename to backend/function-apps/api/case-assignments/case.assignment.function.test.ts diff --git a/backend/functions/api/case-assignments/case.assignment.function.ts b/backend/function-apps/api/case-assignments/case.assignment.function.ts similarity index 100% rename from backend/functions/api/case-assignments/case.assignment.function.ts rename to backend/function-apps/api/case-assignments/case.assignment.function.ts diff --git a/backend/functions/api/case-associated/case-associated.function.test.ts b/backend/function-apps/api/case-associated/case-associated.function.test.ts similarity index 100% rename from backend/functions/api/case-associated/case-associated.function.test.ts rename to backend/function-apps/api/case-associated/case-associated.function.test.ts diff --git a/backend/functions/api/case-associated/case-associated.function.ts b/backend/function-apps/api/case-associated/case-associated.function.ts similarity index 100% rename from backend/functions/api/case-associated/case-associated.function.ts rename to backend/function-apps/api/case-associated/case-associated.function.ts diff --git a/backend/functions/api/case-docket/case-docket.function.test.ts b/backend/function-apps/api/case-docket/case-docket.function.test.ts similarity index 100% rename from backend/functions/api/case-docket/case-docket.function.test.ts rename to backend/function-apps/api/case-docket/case-docket.function.test.ts diff --git a/backend/functions/api/case-docket/case-docket.function.ts b/backend/function-apps/api/case-docket/case-docket.function.ts similarity index 100% rename from backend/functions/api/case-docket/case-docket.function.ts rename to backend/function-apps/api/case-docket/case-docket.function.ts diff --git a/backend/functions/api/case-history/case-history.function.test.ts b/backend/function-apps/api/case-history/case-history.function.test.ts similarity index 100% rename from backend/functions/api/case-history/case-history.function.test.ts rename to backend/function-apps/api/case-history/case-history.function.test.ts diff --git a/backend/functions/api/case-history/case-history.function.ts b/backend/function-apps/api/case-history/case-history.function.ts similarity index 100% rename from backend/functions/api/case-history/case-history.function.ts rename to backend/function-apps/api/case-history/case-history.function.ts diff --git a/backend/functions/api/case-summary/case-summary.function.test.ts b/backend/function-apps/api/case-summary/case-summary.function.test.ts similarity index 100% rename from backend/functions/api/case-summary/case-summary.function.test.ts rename to backend/function-apps/api/case-summary/case-summary.function.test.ts diff --git a/backend/functions/api/case-summary/case-summary.function.ts b/backend/function-apps/api/case-summary/case-summary.function.ts similarity index 100% rename from backend/functions/api/case-summary/case-summary.function.ts rename to backend/function-apps/api/case-summary/case-summary.function.ts diff --git a/backend/functions/api/cases/cases.function.test.ts b/backend/function-apps/api/cases/cases.function.test.ts similarity index 100% rename from backend/functions/api/cases/cases.function.test.ts rename to backend/function-apps/api/cases/cases.function.test.ts diff --git a/backend/functions/api/cases/cases.function.ts b/backend/function-apps/api/cases/cases.function.ts similarity index 100% rename from backend/functions/api/cases/cases.function.ts rename to backend/function-apps/api/cases/cases.function.ts diff --git a/backend/functions/api/consolidations/consolidations.function.test.ts b/backend/function-apps/api/consolidations/consolidations.function.test.ts similarity index 100% rename from backend/functions/api/consolidations/consolidations.function.test.ts rename to backend/function-apps/api/consolidations/consolidations.function.test.ts diff --git a/backend/functions/api/consolidations/consolidations.function.ts b/backend/function-apps/api/consolidations/consolidations.function.ts similarity index 100% rename from backend/functions/api/consolidations/consolidations.function.ts rename to backend/function-apps/api/consolidations/consolidations.function.ts diff --git a/backend/functions/api/courts/courts.function.test.ts b/backend/function-apps/api/courts/courts.function.test.ts similarity index 100% rename from backend/functions/api/courts/courts.function.test.ts rename to backend/function-apps/api/courts/courts.function.test.ts diff --git a/backend/functions/api/courts/courts.function.ts b/backend/function-apps/api/courts/courts.function.ts similarity index 100% rename from backend/functions/api/courts/courts.function.ts rename to backend/function-apps/api/courts/courts.function.ts diff --git a/backend/functions/api/healthcheck/healthcheck.db.cosmos.test.ts b/backend/function-apps/api/healthcheck/healthcheck.db.cosmos.test.ts similarity index 100% rename from backend/functions/api/healthcheck/healthcheck.db.cosmos.test.ts rename to backend/function-apps/api/healthcheck/healthcheck.db.cosmos.test.ts diff --git a/backend/functions/api/healthcheck/healthcheck.db.cosmos.ts b/backend/function-apps/api/healthcheck/healthcheck.db.cosmos.ts similarity index 100% rename from backend/functions/api/healthcheck/healthcheck.db.cosmos.ts rename to backend/function-apps/api/healthcheck/healthcheck.db.cosmos.ts diff --git a/backend/functions/api/healthcheck/healthcheck.db.sql.ts b/backend/function-apps/api/healthcheck/healthcheck.db.sql.ts similarity index 100% rename from backend/functions/api/healthcheck/healthcheck.db.sql.ts rename to backend/function-apps/api/healthcheck/healthcheck.db.sql.ts diff --git a/backend/functions/api/healthcheck/healthcheck.function.ts b/backend/function-apps/api/healthcheck/healthcheck.function.ts similarity index 100% rename from backend/functions/api/healthcheck/healthcheck.function.ts rename to backend/function-apps/api/healthcheck/healthcheck.function.ts diff --git a/backend/functions/api/healthcheck/healthcheck.info.ts b/backend/function-apps/api/healthcheck/healthcheck.info.ts similarity index 100% rename from backend/functions/api/healthcheck/healthcheck.info.ts rename to backend/function-apps/api/healthcheck/healthcheck.info.ts diff --git a/backend/functions/api/healthcheck/healthcheck.test.ts b/backend/function-apps/api/healthcheck/healthcheck.test.ts similarity index 100% rename from backend/functions/api/healthcheck/healthcheck.test.ts rename to backend/function-apps/api/healthcheck/healthcheck.test.ts diff --git a/backend/functions/api/host.json b/backend/function-apps/api/host.json similarity index 100% rename from backend/functions/api/host.json rename to backend/function-apps/api/host.json diff --git a/backend/functions/api/me/me.function.test.ts b/backend/function-apps/api/me/me.function.test.ts similarity index 100% rename from backend/functions/api/me/me.function.test.ts rename to backend/function-apps/api/me/me.function.test.ts diff --git a/backend/functions/api/me/me.function.ts b/backend/function-apps/api/me/me.function.ts similarity index 100% rename from backend/functions/api/me/me.function.ts rename to backend/function-apps/api/me/me.function.ts diff --git a/backend/functions/api/oauth2/mock-oauth2.function.ts b/backend/function-apps/api/oauth2/mock-oauth2.function.ts similarity index 100% rename from backend/functions/api/oauth2/mock-oauth2.function.ts rename to backend/function-apps/api/oauth2/mock-oauth2.function.ts diff --git a/backend/functions/api/office-staff-sync/office-staff-sync.function.test.ts b/backend/function-apps/api/office-staff-sync/office-staff-sync.function.test.ts similarity index 100% rename from backend/functions/api/office-staff-sync/office-staff-sync.function.test.ts rename to backend/function-apps/api/office-staff-sync/office-staff-sync.function.test.ts diff --git a/backend/functions/api/office-staff-sync/office-staff-sync.function.ts b/backend/function-apps/api/office-staff-sync/office-staff-sync.function.ts similarity index 100% rename from backend/functions/api/office-staff-sync/office-staff-sync.function.ts rename to backend/function-apps/api/office-staff-sync/office-staff-sync.function.ts diff --git a/backend/functions/api/offices/offices.function.test.ts b/backend/function-apps/api/offices/offices.function.test.ts similarity index 100% rename from backend/functions/api/offices/offices.function.test.ts rename to backend/function-apps/api/offices/offices.function.test.ts diff --git a/backend/functions/api/offices/offices.function.ts b/backend/function-apps/api/offices/offices.function.ts similarity index 100% rename from backend/functions/api/offices/offices.function.ts rename to backend/function-apps/api/offices/offices.function.ts diff --git a/backend/functions/api/orders-manual-sync/orders-manual-sync.function.test.ts b/backend/function-apps/api/orders-manual-sync/orders-manual-sync.function.test.ts similarity index 100% rename from backend/functions/api/orders-manual-sync/orders-manual-sync.function.test.ts rename to backend/function-apps/api/orders-manual-sync/orders-manual-sync.function.test.ts diff --git a/backend/functions/api/orders-manual-sync/orders-manual-sync.function.ts b/backend/function-apps/api/orders-manual-sync/orders-manual-sync.function.ts similarity index 100% rename from backend/functions/api/orders-manual-sync/orders-manual-sync.function.ts rename to backend/function-apps/api/orders-manual-sync/orders-manual-sync.function.ts diff --git a/backend/functions/api/orders-suggestions/orders-suggestions.function.test.ts b/backend/function-apps/api/orders-suggestions/orders-suggestions.function.test.ts similarity index 100% rename from backend/functions/api/orders-suggestions/orders-suggestions.function.test.ts rename to backend/function-apps/api/orders-suggestions/orders-suggestions.function.test.ts diff --git a/backend/functions/api/orders-suggestions/orders-suggestions.function.ts b/backend/function-apps/api/orders-suggestions/orders-suggestions.function.ts similarity index 100% rename from backend/functions/api/orders-suggestions/orders-suggestions.function.ts rename to backend/function-apps/api/orders-suggestions/orders-suggestions.function.ts diff --git a/backend/functions/api/orders-sync/orders-sync.function.test.ts b/backend/function-apps/api/orders-sync/orders-sync.function.test.ts similarity index 100% rename from backend/functions/api/orders-sync/orders-sync.function.test.ts rename to backend/function-apps/api/orders-sync/orders-sync.function.test.ts diff --git a/backend/functions/api/orders-sync/orders-sync.function.ts b/backend/function-apps/api/orders-sync/orders-sync.function.ts similarity index 100% rename from backend/functions/api/orders-sync/orders-sync.function.ts rename to backend/function-apps/api/orders-sync/orders-sync.function.ts diff --git a/backend/functions/api/orders/orders.function.test.ts b/backend/function-apps/api/orders/orders.function.test.ts similarity index 100% rename from backend/functions/api/orders/orders.function.test.ts rename to backend/function-apps/api/orders/orders.function.test.ts diff --git a/backend/functions/api/orders/orders.function.ts b/backend/function-apps/api/orders/orders.function.ts similarity index 100% rename from backend/functions/api/orders/orders.function.ts rename to backend/function-apps/api/orders/orders.function.ts diff --git a/backend/functions/api/package.json b/backend/function-apps/api/package.json similarity index 100% rename from backend/functions/api/package.json rename to backend/function-apps/api/package.json diff --git a/backend/functions/api/tsconfig.build.json b/backend/function-apps/api/tsconfig.build.json similarity index 100% rename from backend/functions/api/tsconfig.build.json rename to backend/function-apps/api/tsconfig.build.json diff --git a/backend/functions/azure/app-insights.ts b/backend/function-apps/azure/app-insights.ts similarity index 100% rename from backend/functions/azure/app-insights.ts rename to backend/function-apps/azure/app-insights.ts diff --git a/backend/functions/azure/application-context-creator.test.ts b/backend/function-apps/azure/application-context-creator.test.ts similarity index 100% rename from backend/functions/azure/application-context-creator.test.ts rename to backend/function-apps/azure/application-context-creator.test.ts diff --git a/backend/functions/azure/application-context-creator.ts b/backend/function-apps/azure/application-context-creator.ts similarity index 100% rename from backend/functions/azure/application-context-creator.ts rename to backend/function-apps/azure/application-context-creator.ts diff --git a/backend/functions/azure/functions.test.ts b/backend/function-apps/azure/functions.test.ts similarity index 97% rename from backend/functions/azure/functions.test.ts rename to backend/function-apps/azure/functions.test.ts index c8c2a1e16..ee9a2c9f7 100644 --- a/backend/functions/azure/functions.test.ts +++ b/backend/function-apps/azure/functions.test.ts @@ -3,7 +3,7 @@ import { HttpRequest, HttpResponseInit } from '@azure/functions'; import { CamsHttpRequest } from '../../lib/adapters/types/http'; import { CamsHttpResponseInit } from '../../lib/adapters/utils/http-response'; -describe('functions test', () => { +describe('function-apps test', () => { test('should return properly formatted CamsHttpRequest from malformed headers and query', async () => { const request = { method: 'GET', diff --git a/backend/functions/azure/functions.ts b/backend/function-apps/azure/functions.ts similarity index 100% rename from backend/functions/azure/functions.ts rename to backend/function-apps/azure/functions.ts diff --git a/backend/functions/azure/testing-helpers.ts b/backend/function-apps/azure/testing-helpers.ts similarity index 100% rename from backend/functions/azure/testing-helpers.ts rename to backend/function-apps/azure/testing-helpers.ts diff --git a/backend/functions/migration/.funcignore b/backend/function-apps/migration/.funcignore similarity index 100% rename from backend/functions/migration/.funcignore rename to backend/function-apps/migration/.funcignore diff --git a/backend/functions/migration/.gitignore b/backend/function-apps/migration/.gitignore similarity index 100% rename from backend/functions/migration/.gitignore rename to backend/function-apps/migration/.gitignore diff --git a/backend/functions/migration/activity/flattenBoundingArrays.test.ts b/backend/function-apps/migration/activity/flattenBoundingArrays.test.ts similarity index 100% rename from backend/functions/migration/activity/flattenBoundingArrays.test.ts rename to backend/function-apps/migration/activity/flattenBoundingArrays.test.ts diff --git a/backend/functions/migration/activity/flattenBoundingArrays.ts b/backend/function-apps/migration/activity/flattenBoundingArrays.ts similarity index 100% rename from backend/functions/migration/activity/flattenBoundingArrays.ts rename to backend/function-apps/migration/activity/flattenBoundingArrays.ts diff --git a/backend/functions/migration/activity/getConsolidations.test.ts b/backend/function-apps/migration/activity/getConsolidations.test.ts similarity index 100% rename from backend/functions/migration/activity/getConsolidations.test.ts rename to backend/function-apps/migration/activity/getConsolidations.test.ts diff --git a/backend/functions/migration/activity/getConsolidations.ts b/backend/function-apps/migration/activity/getConsolidations.ts similarity index 100% rename from backend/functions/migration/activity/getConsolidations.ts rename to backend/function-apps/migration/activity/getConsolidations.ts diff --git a/backend/functions/migration/activity/getPageCount.test.ts b/backend/function-apps/migration/activity/getPageCount.test.ts similarity index 100% rename from backend/functions/migration/activity/getPageCount.test.ts rename to backend/function-apps/migration/activity/getPageCount.test.ts diff --git a/backend/functions/migration/activity/getPageCount.ts b/backend/function-apps/migration/activity/getPageCount.ts similarity index 100% rename from backend/functions/migration/activity/getPageCount.ts rename to backend/function-apps/migration/activity/getPageCount.ts diff --git a/backend/functions/migration/activity/migrateConsolidation.ts b/backend/function-apps/migration/activity/migrateConsolidation.ts similarity index 100% rename from backend/functions/migration/activity/migrateConsolidation.ts rename to backend/function-apps/migration/activity/migrateConsolidation.ts diff --git a/backend/functions/migration/activity/migrateConsolidations.test.ts b/backend/function-apps/migration/activity/migrateConsolidations.test.ts similarity index 100% rename from backend/functions/migration/activity/migrateConsolidations.test.ts rename to backend/function-apps/migration/activity/migrateConsolidations.test.ts diff --git a/backend/functions/migration/client/acms-migration-trigger.function.ts b/backend/function-apps/migration/client/acms-migration-trigger.function.ts similarity index 100% rename from backend/functions/migration/client/acms-migration-trigger.function.ts rename to backend/function-apps/migration/client/acms-migration-trigger.function.ts diff --git a/backend/functions/migration/host.json b/backend/function-apps/migration/host.json similarity index 100% rename from backend/functions/migration/host.json rename to backend/function-apps/migration/host.json diff --git a/backend/functions/migration/loadConsolidations.ts b/backend/function-apps/migration/loadConsolidations.ts similarity index 100% rename from backend/functions/migration/loadConsolidations.ts rename to backend/function-apps/migration/loadConsolidations.ts diff --git a/backend/functions/migration/orchestration/orchestrator.ts b/backend/function-apps/migration/orchestration/orchestrator.ts similarity index 100% rename from backend/functions/migration/orchestration/orchestrator.ts rename to backend/function-apps/migration/orchestration/orchestrator.ts diff --git a/backend/functions/migration/orchestration/sub-orchestrator-etl.ts b/backend/function-apps/migration/orchestration/sub-orchestrator-etl.ts similarity index 100% rename from backend/functions/migration/orchestration/sub-orchestrator-etl.ts rename to backend/function-apps/migration/orchestration/sub-orchestrator-etl.ts diff --git a/backend/functions/migration/orchestration/sub-orchestrator-paging.ts b/backend/function-apps/migration/orchestration/sub-orchestrator-paging.ts similarity index 100% rename from backend/functions/migration/orchestration/sub-orchestrator-paging.ts rename to backend/function-apps/migration/orchestration/sub-orchestrator-paging.ts diff --git a/backend/functions/migration/package.json b/backend/function-apps/migration/package.json similarity index 100% rename from backend/functions/migration/package.json rename to backend/function-apps/migration/package.json diff --git a/backend/functions/migration/tsconfig.build.json b/backend/function-apps/migration/tsconfig.build.json similarity index 100% rename from backend/functions/migration/tsconfig.build.json rename to backend/function-apps/migration/tsconfig.build.json diff --git a/backend/jest.config.js b/backend/jest.config.js index 0d00470a7..f2ce5d400 100644 --- a/backend/jest.config.js +++ b/backend/jest.config.js @@ -16,7 +16,7 @@ module.exports = { '.*test.[jt]s', '.*mock.*.ts', '.*.d.ts', - 'functions/azure/app-insights.ts', + 'function-apps/azure/app-insights.ts', 'dist/', 'coverage/', 'lib/adapters/gateways/cases.local.gateway.ts', @@ -28,9 +28,9 @@ module.exports = { 'lib/testing/testing-utilities.ts', 'jest.*config.js', 'lib/adapters/gateways/okta/HumbleVerifier.ts', - 'functions/migration/client/', - 'functions/migration/orchestration/', - 'functions/migration/loadConsolidations.ts', + 'function-apps/migration/client/', + 'function-apps/migration/orchestration/', + 'function-apps/migration/loadConsolidations.ts', ], testMatch: ['**/?(*.)+(spec|test).[jt]s?(x)', '!**/?(*.)+(integration).(spec|test).[jt]s?(x)'], }; diff --git a/backend/lib/factory.test.ts b/backend/lib/factory.test.ts index 265166247..b9c53e2d1 100644 --- a/backend/lib/factory.test.ts +++ b/backend/lib/factory.test.ts @@ -1,7 +1,7 @@ import { ApplicationContext } from './adapters/types/basic'; import { createMockApplicationContext } from './testing/testing-utilities'; -describe('Factory functions', () => { +describe('Factory function-apps', () => { let dbContext: ApplicationContext; let mockDbContext: ApplicationContext; let factory; diff --git a/backend/lib/testing/analysis/acms-dxtr-divisions/compare-divisions.ts b/backend/lib/testing/analysis/acms-dxtr-divisions/compare-divisions.ts index f0a11edf8..cb14e312f 100644 --- a/backend/lib/testing/analysis/acms-dxtr-divisions/compare-divisions.ts +++ b/backend/lib/testing/analysis/acms-dxtr-divisions/compare-divisions.ts @@ -1,5 +1,5 @@ import { InvocationContext } from '@azure/functions'; -import applicationContextCreator from '../../../../functions/azure/application-context-creator'; +import applicationContextCreator from '../../../../function-apps/azure/application-context-creator'; import { LoggerImpl } from '../../../adapters/services/logger.service'; import OfficesDxtrGateway from '../../../adapters/gateways/dxtr/offices.dxtr.gateway'; import { UstpOfficeDetails } from '../../../../../common/src/cams/offices'; @@ -433,7 +433,7 @@ async function main() { ); // Write the results to the temp directory. - // See: backend/functions/temp/ + // See: backend/function-apps/temp/ await outputResults(output); } diff --git a/backend/lib/testing/analysis/export-office-csv.ts b/backend/lib/testing/analysis/export-office-csv.ts index 99795faba..b89ca92b5 100644 --- a/backend/lib/testing/analysis/export-office-csv.ts +++ b/backend/lib/testing/analysis/export-office-csv.ts @@ -1,5 +1,5 @@ import { InvocationContext } from '@azure/functions'; -import applicationContextCreator from '../../../functions/azure/application-context-creator'; +import applicationContextCreator from '../../../function-apps/azure/application-context-creator'; import { LoggerImpl } from '../../adapters/services/logger.service'; import OfficesDxtrGateway from '../../adapters/gateways/dxtr/offices.dxtr.gateway'; import { UstpOfficeDetails } from '../../../../common/src/cams/offices'; diff --git a/backend/lib/testing/isolated-integration/test-acms-migration.ts b/backend/lib/testing/isolated-integration/test-acms-migration.ts index c7deb9932..6899421e9 100644 --- a/backend/lib/testing/isolated-integration/test-acms-migration.ts +++ b/backend/lib/testing/isolated-integration/test-acms-migration.ts @@ -1,5 +1,5 @@ -import migrateConsolidation from '../../../functions/migration/activity/migrateConsolidation'; -import { createMockAzureFunctionContext } from '../../../functions/azure/testing-helpers'; +import migrateConsolidation from '../../../function-apps/migration/activity/migrateConsolidation'; +import { createMockAzureFunctionContext } from '../../../function-apps/azure/testing-helpers'; import * as dotenv from 'dotenv'; dotenv.config(); diff --git a/backend/lib/testing/isolated-integration/test-okta-group-api.ts b/backend/lib/testing/isolated-integration/test-okta-group-api.ts index d7587d88a..2b4edab63 100644 --- a/backend/lib/testing/isolated-integration/test-okta-group-api.ts +++ b/backend/lib/testing/isolated-integration/test-okta-group-api.ts @@ -1,6 +1,6 @@ import { InvocationContext } from '@azure/functions'; import { LoggerImpl } from '../../adapters/services/logger.service'; -import applicationContextCreator from '../../../functions/azure/application-context-creator'; +import applicationContextCreator from '../../../function-apps/azure/application-context-creator'; import { UserGroupGatewayConfig } from '../../adapters/types/authorization'; import { getUserGroupGatewayConfig } from '../../configs/user-groups-gateway-configuration'; import OktaUserGroupGateway from '../../adapters/gateways/okta/okta-user-group-gateway'; diff --git a/backend/lib/testing/testing-utilities.ts b/backend/lib/testing/testing-utilities.ts index 338e604b2..9a59a840c 100644 --- a/backend/lib/testing/testing-utilities.ts +++ b/backend/lib/testing/testing-utilities.ts @@ -3,7 +3,7 @@ import { HttpRequest, InvocationContext } from '@azure/functions'; import { MockData } from '../../../common/src/cams/test-utilities/mock-data'; import { CamsSession } from '../../../common/src/cams/session'; import { CamsHttpMethod, CamsHttpRequest } from '../adapters/types/http'; -import ContextCreator from '../../functions/azure/application-context-creator'; +import ContextCreator from '../../function-apps/azure/application-context-creator'; import { LoggerImpl } from '../adapters/services/logger.service'; const invocationContext = new InvocationContext(); diff --git a/backend/lib/use-cases/orders/orders-local-gateway.test.ts b/backend/lib/use-cases/orders/orders-local-gateway.test.ts index 9e67bd285..c24fb1cc1 100644 --- a/backend/lib/use-cases/orders/orders-local-gateway.test.ts +++ b/backend/lib/use-cases/orders/orders-local-gateway.test.ts @@ -114,7 +114,7 @@ describe('orders use case tests', () => { }); test('should not create a second lead case for an existing consolidation', async () => { - // Spy/mock the factory functions so we can return a LOCAL database of our choosing for the test. + // Spy/mock the factory function-apps so we can return a LOCAL database of our choosing for the test. // We need a generic LOCAL gateway implementation that we return via the mocked factory function. const localCasesRepo = new LocalCasesRepository(); const localConsolidationsRepo = new LocalConsolidationOrdersRepository(); diff --git a/backend/package.json b/backend/package.json index 50b6cd37f..5247ec1af 100644 --- a/backend/package.json +++ b/backend/package.json @@ -44,20 +44,20 @@ "all": "npm run clean:all && npm ci && npm run build:all && npm run pack:all", "clean:all": "npm run clean && npm run clean:api && npm run clean:migration", "clean": "rm -rf ./dist && rm -rf ./node_modules && rm -rf ./coverage", - "clean:api": "pushd functions/api && npm run clean && popd", - "clean:migration": "pushd functions/migration && npm run clean && popd", + "clean:api": "pushd function-apps/api && npm run clean && popd", + "clean:migration": "pushd function-apps/migration && npm run clean && popd", "build:all": "npm run build-common && npm run build && npm run build:api && npm run build:migration", "build": "tsc --build tsconfig.build.json", "build-common": "pushd ../common && npm ci && npm run build && popd", - "build:api": "pushd functions/api && npm run build && popd", - "build:migration": "pushd functions/migration && npm run build && popd", + "build:api": "pushd function-apps/api && npm run build && popd", + "build:migration": "pushd function-apps/migration && npm run build && popd", "pack:all": "npm run pack:api && npm run pack:migration", "pack": "npm run pack:api", - "pack:api": "pushd functions/api && npm run pack && popd", - "pack:migration": "pushd functions/migration && npm run pack && popd", + "pack:api": "pushd function-apps/api && npm run pack && popd", + "pack:migration": "pushd function-apps/migration && npm run pack && popd", "start": "npm run start:api", - "start:api": "pushd functions/api && npm run start && popd", - "start:migration": "pushd functions/migration && npm run start && popd", + "start:api": "pushd function-apps/api && npm run start && popd", + "start:migration": "pushd function-apps/migration && npm run start && popd", "test": "CAMS_LOGIN_PROVIDER='mock' DATABASE_MOCK='true' MONGO_CONNECTION_STRING='mongodb://test-string' jest -c jest.config.js", "test:open-handles": "CAMS_LOGIN_PROVIDER='mock' DATABASE_MOCK='true' MONGO_CONNECTION_STRING='mongodb://test-string' jest -c jest.config.js --detectOpenHandles", "lint": "eslint .", @@ -66,8 +66,8 @@ "coverage": "npm test -- --coverage", "use-bash": "npm config set script-shell=/bin/bash", "coverage:ci": "npm run use-bash && npm run build-common && npm test -- --coverage", - "dependency-cruiser-graphical": "current_time=$(date +'%Y-%m-%d_%H%M') && npx depcruise --output-type dot --do-not-follow '^node_modules($|/)' functions/api/attorneys case-assignments case-docket case-history case-summary cases consolidations healthcheck offices orders orders-manual-sync orders-sync ../lib | dot -T svg > ../../docs/architecture/dependency-cruiser/functions/dependency-graph_api_${current_time}.svg", - "dependency-cruiser:ci": "npx depcruise --output-type err-long functions/api/attorneys case-assignments case-docket case-history case-summary cases consolidations healthcheck offices orders orders-manual-sync orders-sync ../lib ", + "dependency-cruiser-graphical": "current_time=$(date +'%Y-%m-%d_%H%M') && npx depcruise --output-type dot --do-not-follow '^node_modules($|/)' function-apps/api/attorneys case-assignments case-docket case-history case-summary cases consolidations healthcheck offices orders orders-manual-sync orders-sync ../lib | dot -T svg > ../../docs/architecture/dependency-cruiser/functions/dependency-graph_api_${current_time}.svg", + "dependency-cruiser:ci": "npx depcruise --output-type err-long function-apps/api/attorneys case-assignments case-docket case-history case-summary cases consolidations healthcheck offices orders orders-manual-sync orders-sync ../lib ", "itest:okta-group-api": "CAMS_LOGIN_PROVIDER=okta npx ts-node lib/testing/isolated-integration/test-okta-group-api.ts", "itest:export-office-csv": "CAMS_LOGIN_PROVIDER=okta npx ts-node ../lib/testing/isolated-integration/export-office-csv.ts" } diff --git a/backend/tsconfig.build.json b/backend/tsconfig.build.json index 5cee1ca91..43ffdae92 100644 --- a/backend/tsconfig.build.json +++ b/backend/tsconfig.build.json @@ -3,5 +3,7 @@ "outDir": "dist" }, "extends": "./tsconfig.json", - "exclude": ["**/*.test.ts", "**/testing*", "**/fake*", "**/testing/*", "functions"] + "exclude": ["**/*.test.ts", "**/testing*", "**/fake*", "**/testing/*", + "function-apps" + ] } diff --git a/common/src/cams/events.test.ts b/common/src/cams/events.test.ts index 1b90ea819..2a813dfc7 100644 --- a/common/src/cams/events.test.ts +++ b/common/src/cams/events.test.ts @@ -26,7 +26,7 @@ const substantiveConsolidationChildCase: Consolidation[] = [ }), ]; -describe('Event domain helper functions', () => { +describe('Event domain helper function-apps', () => { describe('isJointAdministrationLeadCase', () => { test('should return true', () => { expect(isJointAdministrationLeadCase(jointAdministrationLeadCase)).toBeTruthy(); diff --git a/common/src/cams/users.test.ts b/common/src/cams/users.test.ts index a2f60f4c2..a739d3046 100644 --- a/common/src/cams/users.test.ts +++ b/common/src/cams/users.test.ts @@ -2,7 +2,7 @@ import MockData from './test-utilities/mock-data'; import { REGION_02_GROUP_NY, REGION_02_GROUP_SE } from './test-utilities/mock-user'; import { getCourtDivisionCodes, getGroupDesignators } from './users'; -describe('users helper functions tests', () => { +describe('users helper function-apps tests', () => { describe('getCourtDivisionCodes tests', () => { test('should get division codes from a user with offices', () => { const user = MockData.getCamsUser({ diff --git a/docs/architecture/dependency-cruiser/functions/current.svg b/docs/architecture/dependency-cruiser/functions/current.svg index 1fadda8d1..4e773ff0c 100644 --- a/docs/architecture/dependency-cruiser/functions/current.svg +++ b/docs/architecture/dependency-cruiser/functions/current.svg @@ -728,7 +728,7 @@ - + node_modules/@azure/functions @@ -740,7 +740,7 @@ - + attorneys/attorneys.function.ts->node_modules/@azure/functions @@ -782,7 +782,7 @@ - + lib/adapters/utils/application-context-creator.ts->node_modules/@azure/functions @@ -1061,7 +1061,7 @@ - + case-assignments/case.assignment.function.ts->node_modules/@azure/functions @@ -1085,7 +1085,7 @@ - + lib/adapters/types/basic.d.ts->node_modules/@azure/functions @@ -1232,7 +1232,7 @@ - + case-docket/case-docket.function.ts->node_modules/@azure/functions @@ -1475,7 +1475,7 @@ - + case-history/case-history.function.ts->node_modules/@azure/functions @@ -1679,7 +1679,7 @@ - + case-summary/case-summary.function.ts->node_modules/@azure/functions @@ -1757,7 +1757,7 @@ - + cases/cases.function.ts->node_modules/@azure/functions @@ -1943,7 +1943,7 @@ - + consolidations/consolidations.function.ts->node_modules/@azure/functions @@ -2627,7 +2627,7 @@ - + healthcheck/healthcheck.function.ts->node_modules/@azure/functions @@ -5138,7 +5138,7 @@ - + lib/adapters/services/logger.service.ts->node_modules/@azure/functions @@ -6686,7 +6686,7 @@ - + offices/offices.function.ts->node_modules/@azure/functions @@ -6770,7 +6770,7 @@ - + orders-manual-sync/orders-manual-sync.function.ts->node_modules/@azure/functions @@ -6869,7 +6869,7 @@ - + orders-sync/orders-sync.function.ts->node_modules/@azure/functions @@ -6965,7 +6965,7 @@ - + orders/orders.function.ts->node_modules/@azure/functions diff --git a/docs/architecture/dependency-cruiser/functions/dependency-graph_2023-09-18_1237.svg b/docs/architecture/dependency-cruiser/functions/dependency-graph_2023-09-18_1237.svg index ad578035e..c97f676b0 100644 --- a/docs/architecture/dependency-cruiser/functions/dependency-graph_2023-09-18_1237.svg +++ b/docs/architecture/dependency-cruiser/functions/dependency-graph_2023-09-18_1237.svg @@ -211,7 +211,7 @@ - + node_modules/@azure/functions @@ -223,7 +223,7 @@ - + lib/adapters/controllers/attorneys.controller.ts->node_modules/@azure/functions @@ -280,7 +280,7 @@ - + lib/adapters/utils/http.ts->node_modules/@azure/functions @@ -331,7 +331,7 @@ - + attorneys/attorneys.function.ts->node_modules/@azure/functions @@ -383,7 +383,7 @@ no-circular - + lib/adapters/utils/application-context-creator.ts->node_modules/@azure/functions @@ -500,7 +500,7 @@ - + lib/adapters/controllers/case.assignment.controller.ts->node_modules/@azure/functions @@ -605,7 +605,7 @@ - + case-assignments/case.assignment.function.ts->node_modules/@azure/functions @@ -677,7 +677,7 @@ - + cases/cases.function.ts->node_modules/@azure/functions @@ -743,7 +743,7 @@ - + lib/adapters/controllers/cases.controller.ts->node_modules/@azure/functions @@ -836,7 +836,7 @@ - + lib/adapters/types/basic.d.ts->node_modules/@azure/functions @@ -1121,7 +1121,7 @@ - + healthcheck/healthcheck.function.ts->node_modules/@azure/functions @@ -1382,7 +1382,7 @@ - + lib/adapters/controllers/users.controller.ts->node_modules/@azure/functions @@ -2558,7 +2558,7 @@ - + lib/adapters/gateways/mock-cases.gateway.ts->node_modules/@azure/functions @@ -2759,7 +2759,7 @@ - + lib/adapters/services/logger.service.test.ts->node_modules/@azure/functions @@ -3264,7 +3264,7 @@ - + users/users.function.ts->node_modules/@azure/functions diff --git a/docs/architecture/dependency-cruiser/functions/dependency-graph_2023-09-26_1701.svg b/docs/architecture/dependency-cruiser/functions/dependency-graph_2023-09-26_1701.svg index ad578035e..c97f676b0 100644 --- a/docs/architecture/dependency-cruiser/functions/dependency-graph_2023-09-26_1701.svg +++ b/docs/architecture/dependency-cruiser/functions/dependency-graph_2023-09-26_1701.svg @@ -211,7 +211,7 @@ - + node_modules/@azure/functions @@ -223,7 +223,7 @@ - + lib/adapters/controllers/attorneys.controller.ts->node_modules/@azure/functions @@ -280,7 +280,7 @@ - + lib/adapters/utils/http.ts->node_modules/@azure/functions @@ -331,7 +331,7 @@ - + attorneys/attorneys.function.ts->node_modules/@azure/functions @@ -383,7 +383,7 @@ no-circular - + lib/adapters/utils/application-context-creator.ts->node_modules/@azure/functions @@ -500,7 +500,7 @@ - + lib/adapters/controllers/case.assignment.controller.ts->node_modules/@azure/functions @@ -605,7 +605,7 @@ - + case-assignments/case.assignment.function.ts->node_modules/@azure/functions @@ -677,7 +677,7 @@ - + cases/cases.function.ts->node_modules/@azure/functions @@ -743,7 +743,7 @@ - + lib/adapters/controllers/cases.controller.ts->node_modules/@azure/functions @@ -836,7 +836,7 @@ - + lib/adapters/types/basic.d.ts->node_modules/@azure/functions @@ -1121,7 +1121,7 @@ - + healthcheck/healthcheck.function.ts->node_modules/@azure/functions @@ -1382,7 +1382,7 @@ - + lib/adapters/controllers/users.controller.ts->node_modules/@azure/functions @@ -2558,7 +2558,7 @@ - + lib/adapters/gateways/mock-cases.gateway.ts->node_modules/@azure/functions @@ -2759,7 +2759,7 @@ - + lib/adapters/services/logger.service.test.ts->node_modules/@azure/functions @@ -3264,7 +3264,7 @@ - + users/users.function.ts->node_modules/@azure/functions diff --git a/docs/architecture/dependency-cruiser/functions/dependency-graph_2023-09-27_1700.svg b/docs/architecture/dependency-cruiser/functions/dependency-graph_2023-09-27_1700.svg index 52fc8ace5..7ef051dd0 100644 --- a/docs/architecture/dependency-cruiser/functions/dependency-graph_2023-09-27_1700.svg +++ b/docs/architecture/dependency-cruiser/functions/dependency-graph_2023-09-27_1700.svg @@ -206,7 +206,7 @@ - + node_modules/@azure/functions @@ -218,7 +218,7 @@ - + lib/adapters/controllers/attorneys.controller.ts->node_modules/@azure/functions @@ -275,7 +275,7 @@ - + lib/adapters/utils/http.ts->node_modules/@azure/functions @@ -326,7 +326,7 @@ - + attorneys/attorneys.function.ts->node_modules/@azure/functions @@ -378,7 +378,7 @@ no-circular - + lib/adapters/utils/application-context-creator.ts->node_modules/@azure/functions @@ -495,7 +495,7 @@ - + lib/adapters/controllers/case.assignment.controller.ts->node_modules/@azure/functions @@ -600,7 +600,7 @@ - + case-assignments/case.assignment.function.ts->node_modules/@azure/functions @@ -672,7 +672,7 @@ - + cases/cases.function.ts->node_modules/@azure/functions @@ -738,7 +738,7 @@ - + lib/adapters/controllers/cases.controller.ts->node_modules/@azure/functions @@ -831,7 +831,7 @@ - + lib/adapters/types/basic.d.ts->node_modules/@azure/functions @@ -1071,7 +1071,7 @@ - + healthcheck/healthcheck.function.ts->node_modules/@azure/functions @@ -2013,7 +2013,7 @@ - + lib/adapters/gateways/mock-cases.gateway.ts->node_modules/@azure/functions @@ -2079,7 +2079,7 @@ - + lib/adapters/services/logger.service.test.ts->node_modules/@azure/functions diff --git a/docs/architecture/dependency-cruiser/functions/dependency-graph_2023-10-04_1610.svg b/docs/architecture/dependency-cruiser/functions/dependency-graph_2023-10-04_1610.svg index 518d6a137..3cbf86608 100644 --- a/docs/architecture/dependency-cruiser/functions/dependency-graph_2023-10-04_1610.svg +++ b/docs/architecture/dependency-cruiser/functions/dependency-graph_2023-10-04_1610.svg @@ -206,7 +206,7 @@ - + node_modules/@azure/functions @@ -218,7 +218,7 @@ - + lib/adapters/controllers/attorneys.controller.ts->node_modules/@azure/functions @@ -275,7 +275,7 @@ - + lib/adapters/utils/http.ts->node_modules/@azure/functions @@ -326,7 +326,7 @@ - + attorneys/attorneys.function.ts->node_modules/@azure/functions @@ -378,7 +378,7 @@ no-circular - + lib/adapters/utils/application-context-creator.ts->node_modules/@azure/functions @@ -495,7 +495,7 @@ - + lib/adapters/controllers/case.assignment.controller.ts->node_modules/@azure/functions @@ -600,7 +600,7 @@ - + case-assignments/case.assignment.function.ts->node_modules/@azure/functions @@ -666,7 +666,7 @@ - + cases/cases.function.ts->node_modules/@azure/functions @@ -732,7 +732,7 @@ - + lib/adapters/controllers/cases.controller.ts->node_modules/@azure/functions @@ -849,7 +849,7 @@ - + lib/adapters/types/basic.d.ts->node_modules/@azure/functions @@ -1106,7 +1106,7 @@ - + healthcheck/healthcheck.function.ts->node_modules/@azure/functions @@ -2166,7 +2166,7 @@ - + lib/adapters/gateways/mock-cases.gateway.ts->node_modules/@azure/functions @@ -2232,7 +2232,7 @@ - + lib/adapters/services/logger.service.test.ts->node_modules/@azure/functions diff --git a/docs/architecture/dependency-cruiser/functions/dependency-graph_api_2023-10-19_1223.svg b/docs/architecture/dependency-cruiser/functions/dependency-graph_api_2023-10-19_1223.svg index 56fb60d10..20431c044 100644 --- a/docs/architecture/dependency-cruiser/functions/dependency-graph_api_2023-10-19_1223.svg +++ b/docs/architecture/dependency-cruiser/functions/dependency-graph_api_2023-10-19_1223.svg @@ -398,7 +398,7 @@ - + node_modules/@azure/functions @@ -410,7 +410,7 @@ - + attorneys/attorneys.function.ts->node_modules/@azure/functions @@ -470,7 +470,7 @@ no-circular - + lib/adapters/utils/application-context-creator.ts->node_modules/@azure/functions @@ -731,7 +731,7 @@ - + case-assignments/case.assignment.function.ts->node_modules/@azure/functions @@ -749,7 +749,7 @@ - + lib/adapters/types/basic.d.ts->node_modules/@azure/functions @@ -863,7 +863,7 @@ - + cases/cases.function.ts->node_modules/@azure/functions @@ -1289,7 +1289,7 @@ - + healthcheck/healthcheck.function.ts->node_modules/@azure/functions @@ -2501,7 +2501,7 @@ - + lib/adapters/gateways/mock-cases.gateway.ts->node_modules/@azure/functions @@ -2567,7 +2567,7 @@ - + lib/adapters/services/logger.service.test.ts->node_modules/@azure/functions diff --git a/docs/architecture/dependency-cruiser/functions/dependency-graph_api_2023-12.svg b/docs/architecture/dependency-cruiser/functions/dependency-graph_api_2023-12.svg index 518d6a137..3cbf86608 100644 --- a/docs/architecture/dependency-cruiser/functions/dependency-graph_api_2023-12.svg +++ b/docs/architecture/dependency-cruiser/functions/dependency-graph_api_2023-12.svg @@ -206,7 +206,7 @@ - + node_modules/@azure/functions @@ -218,7 +218,7 @@ - + lib/adapters/controllers/attorneys.controller.ts->node_modules/@azure/functions @@ -275,7 +275,7 @@ - + lib/adapters/utils/http.ts->node_modules/@azure/functions @@ -326,7 +326,7 @@ - + attorneys/attorneys.function.ts->node_modules/@azure/functions @@ -378,7 +378,7 @@ no-circular - + lib/adapters/utils/application-context-creator.ts->node_modules/@azure/functions @@ -495,7 +495,7 @@ - + lib/adapters/controllers/case.assignment.controller.ts->node_modules/@azure/functions @@ -600,7 +600,7 @@ - + case-assignments/case.assignment.function.ts->node_modules/@azure/functions @@ -666,7 +666,7 @@ - + cases/cases.function.ts->node_modules/@azure/functions @@ -732,7 +732,7 @@ - + lib/adapters/controllers/cases.controller.ts->node_modules/@azure/functions @@ -849,7 +849,7 @@ - + lib/adapters/types/basic.d.ts->node_modules/@azure/functions @@ -1106,7 +1106,7 @@ - + healthcheck/healthcheck.function.ts->node_modules/@azure/functions @@ -2166,7 +2166,7 @@ - + lib/adapters/gateways/mock-cases.gateway.ts->node_modules/@azure/functions @@ -2232,7 +2232,7 @@ - + lib/adapters/services/logger.service.test.ts->node_modules/@azure/functions diff --git a/ops/scripts/pipeline/slots/az-slot-start-stop-operations.sh b/ops/scripts/pipeline/slots/az-slot-start-stop-operations.sh index 560c94bf0..aa3cc5012 100755 --- a/ops/scripts/pipeline/slots/az-slot-start-stop-operations.sh +++ b/ops/scripts/pipeline/slots/az-slot-start-stop-operations.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Description: Helper script to start and stop slots so we do not run sync functions against slot resources +# Description: Helper script to start and stop slots so we do not run sync function-apps against slot resources # Prerequisite: # - curl # - Azure CLI diff --git a/ops/scripts/utility/audit.sh b/ops/scripts/utility/audit.sh index 9095b53e5..b5dcb8a4d 100755 --- a/ops/scripts/utility/audit.sh +++ b/ops/scripts/utility/audit.sh @@ -59,7 +59,7 @@ trap 'rm -f "$TEMP_FILE"' EXIT cat ./ops/scripts/utility/audit-comment.md >> "$TEMP_FILE" RESULTS=0 -PROJECTS=("backend/functions" "common" "dev-tools" "test/e2e" "user-interface") +PROJECTS=("backend" "common" "dev-tools" "test/e2e" "user-interface") for dir in "${PROJECTS[@]}"; do pushd "${dir}" || exit npm ci diff --git a/ops/scripts/utility/check-outdated.sh b/ops/scripts/utility/check-outdated.sh index 673ca2649..5265900ab 100755 --- a/ops/scripts/utility/check-outdated.sh +++ b/ops/scripts/utility/check-outdated.sh @@ -59,7 +59,7 @@ trap 'rm -f "$TEMP_FILE"' EXIT cat ./ops/scripts/utility/outdated-comment.md >> "$TEMP_FILE" OUTDATED=false -PROJECTS=("backend/functions" "common" "dev-tools" "test/e2e" "user-interface") +PROJECTS=("backend" "common" "dev-tools" "test/e2e" "user-interface") for dir in "${PROJECTS[@]}"; do pushd "${dir}" || exit npm ci diff --git a/ops/scripts/utility/clean-all-projects.sh b/ops/scripts/utility/clean-all-projects.sh index 4db4d5815..efe23c201 100755 --- a/ops/scripts/utility/clean-all-projects.sh +++ b/ops/scripts/utility/clean-all-projects.sh @@ -6,7 +6,7 @@ # From the root directory, run the following command: # ./ops/scripts/utility/clean-all-projects.sh -PROJECTS=("backend" "backend/functions/api" "backend/functions/migration" "common" "dev-tools" "test/e2e" "user-interface") +PROJECTS=("backend" "backend/function-apps/api" "backend/function-apps/migration" "common" "dev-tools" "test/e2e" "user-interface") for str in "${PROJECTS[@]}"; do pushd "${str}" || exit diff --git a/ops/scripts/utility/run-all-tests.sh b/ops/scripts/utility/run-all-tests.sh index 88781d9d2..a3147df43 100755 --- a/ops/scripts/utility/run-all-tests.sh +++ b/ops/scripts/utility/run-all-tests.sh @@ -6,7 +6,7 @@ # From the root directory, run the following command: # ./ops/scripts/utility/run-all-tests.sh -PROJECTS=("backend/functions" "common" "user-interface") +PROJECTS=("backend" "common" "user-interface") for str in "${PROJECTS[@]}"; do pushd "${str}" || exit diff --git a/ops/scripts/utility/update-dependencies.sh b/ops/scripts/utility/update-dependencies.sh index a14721fa6..95710f63b 100755 --- a/ops/scripts/utility/update-dependencies.sh +++ b/ops/scripts/utility/update-dependencies.sh @@ -72,7 +72,7 @@ else fi -PROJECTS=("backend/functions" "common" "dev-tools" "test/e2e" "user-interface") +PROJECTS=("backend" "common" "dev-tools" "test/e2e" "user-interface") for str in "${PROJECTS[@]}"; do pushd "${str}" || exit diff --git a/test/e2e/playwright/auth-setup.ts b/test/e2e/playwright/auth-setup.ts index b6b491aa7..811ee238c 100644 --- a/test/e2e/playwright/auth-setup.ts +++ b/test/e2e/playwright/auth-setup.ts @@ -57,7 +57,7 @@ async function oktaLogin(page: Page) { function usingAuthenticationProvider() { let loginFunction; const provider = process.env.CAMS_LOGIN_PROVIDER ?? 'mock'; - // TODO: Add new login functions as we add new providers. + // TODO: Add new login function-apps as we add new providers. switch (provider.toLowerCase()) { case 'none': loginFunction = noOp; diff --git a/user-interface/src/lib/models/api2.test.ts b/user-interface/src/lib/models/api2.test.ts index 9265145df..61fb7d474 100644 --- a/user-interface/src/lib/models/api2.test.ts +++ b/user-interface/src/lib/models/api2.test.ts @@ -75,7 +75,7 @@ describe('extractPathFromUri', () => { }); }); -describe('_Api2 functions', async () => { +describe('_Api2 function-apps', async () => { let api: ApiType; let api2: Api2Type; @@ -86,7 +86,7 @@ describe('_Api2 functions', async () => { api2 = await import('./api2'); }); - test('should call real api functions', async () => { + test('should call real api function-apps', async () => { await callApiFunction(api2.Api2.getAttorneys, null, api); await callApiFunction(api2.Api2.getCaseAssignments, 'some-id', api); await callApiFunction(api2.Api2.getCaseAssociations, 'some-id', api); diff --git a/user-interface/src/lib/utils/datetime.test.ts b/user-interface/src/lib/utils/datetime.test.ts index fd2525fd8..083ac636e 100644 --- a/user-interface/src/lib/utils/datetime.test.ts +++ b/user-interface/src/lib/utils/datetime.test.ts @@ -54,7 +54,7 @@ describe('Date/Time utilities', () => { }); }); - describe('sort functions', () => { + describe('sort function-apps', () => { test('should sort dates newest first', () => { const middle = new Date(2024, 0, 1); const newest = new Date(2024, 1, 1); From 5a684f1a92f62a4d10850d4192cbe78ccb5823e1 Mon Sep 17 00:00:00 2001 From: Arthur Morrow Date: Tue, 10 Dec 2024 15:05:22 -0500 Subject: [PATCH 43/49] uncommmented unit tests and security scans Jira ticket: CAMS-461 --- .github/workflows/continuous-deployment.yml | 119 +++++++++++--------- 1 file changed, 64 insertions(+), 55 deletions(-) diff --git a/.github/workflows/continuous-deployment.yml b/.github/workflows/continuous-deployment.yml index 4223cf5de..0673aa766 100644 --- a/.github/workflows/continuous-deployment.yml +++ b/.github/workflows/continuous-deployment.yml @@ -49,60 +49,60 @@ jobs: enableBicepDeployment: ${{ inputs.enableBicepDeployment }} deployVnet: ${{ inputs.deployVnet }} - # accessibility-test: - # defaults: - # run: - # working-directory: user-interface - - # runs-on: ubuntu-latest - - # steps: - # - name: Install chrome - # uses: browser-actions/setup-chrome@v1 - - # - name: Get source code - # uses: actions/checkout@v3 - - # - name: Use Node.js - # uses: actions/setup-node@v3 - # with: - # node-version: ${{ vars.NODE_VERSION }} - # cache: "npm" - # cache-dependency-path: user-interface/package-lock.json - - # - name: Install Node dependencies - # run: | - # pushd ../common - # npm ci - # popd - - # npm ci && npm install -g pa11y-ci - - # - name: Run pa11y Test - # run: ../ops/scripts/pipeline/accessibility-test.sh - - # unit-test-frontend: - # uses: ./.github/workflows/reusable-unit-test.yml - # with: - # path: user-interface - # node-version: ${{ vars.NODE_VERSION }} - - # unit-test-backend: - # uses: ./.github/workflows/reusable-unit-test.yml - # with: - # path: backend - # node-version: ${{ vars.NODE_VERSION }} - - # unit-test-common: - # uses: ./.github/workflows/reusable-unit-test.yml - # with: - # path: common - # node-version: ${{ vars.NODE_VERSION }} - - # security-scan: - # name: Security - # uses: ./.github/workflows/sub-security-scan.yml - # secrets: inherit # pragma: allowlist secret + accessibility-test: + defaults: + run: + working-directory: user-interface + + runs-on: ubuntu-latest + + steps: + - name: Install chrome + uses: browser-actions/setup-chrome@v1 + + - name: Get source code + uses: actions/checkout@v3 + + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: ${{ vars.NODE_VERSION }} + cache: "npm" + cache-dependency-path: user-interface/package-lock.json + + - name: Install Node dependencies + run: | + pushd ../common + npm ci + popd + + npm ci && npm install -g pa11y-ci + + - name: Run pa11y Test + run: ../ops/scripts/pipeline/accessibility-test.sh + + unit-test-frontend: + uses: ./.github/workflows/reusable-unit-test.yml + with: + path: user-interface + node-version: ${{ vars.NODE_VERSION }} + + unit-test-backend: + uses: ./.github/workflows/reusable-unit-test.yml + with: + path: backend + node-version: ${{ vars.NODE_VERSION }} + + unit-test-common: + uses: ./.github/workflows/reusable-unit-test.yml + with: + path: common + node-version: ${{ vars.NODE_VERSION }} + + security-scan: + name: Security + uses: ./.github/workflows/sub-security-scan.yml + secrets: inherit # pragma: allowlist secret build: name: Build @@ -124,7 +124,16 @@ jobs: deploy: name: Cloud Resource Deployment uses: ./.github/workflows/sub-deploy.yml - needs: [setup, build] + needs: + [ + setup, + build, + accessibility-test, + security-scan, + unit-test-frontend, + unit-test-backend, + unit-test-common, + ] if: ((github.ref == 'refs/heads/main') || (github.ref == 'refs/heads/dependency-updates-auto') || (inputs.deployBranch == 'true')) From edac5b2c1a36f14e9cffecc116379ccebc9f4875 Mon Sep 17 00:00:00 2001 From: Arthur Morrow Date: Tue, 10 Dec 2024 15:08:33 -0500 Subject: [PATCH 44/49] removed commented out bicep code Jira ticket: CAMS-461 --- ops/cloud-deployment/backend-api-deploy.bicep | 6 ------ ops/cloud-deployment/frontend-webapp-deploy.bicep | 3 --- ops/cloud-deployment/main.bicep | 8 -------- 3 files changed, 17 deletions(-) diff --git a/ops/cloud-deployment/backend-api-deploy.bicep b/ops/cloud-deployment/backend-api-deploy.bicep index 03a19098b..e48db2b55 100644 --- a/ops/cloud-deployment/backend-api-deploy.bicep +++ b/ops/cloud-deployment/backend-api-deploy.bicep @@ -584,9 +584,3 @@ resource sqlIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-3 name: sqlIdentityName scope: resourceGroup(sqlIdentityRG) } - -// output apiFunctionAppName string = apiFunctionApp.name -// output apiFunctionAppId string = apiFunctionApp.id -// output migrationFunctionAppId string = migrationFunctionApp.id -// output createdSqlServerVnetRule bool = createSqlServerVnetRule -// output keyVaultId string = apiFunctionApp.properties.keyVaultReferenceIdentity diff --git a/ops/cloud-deployment/frontend-webapp-deploy.bicep b/ops/cloud-deployment/frontend-webapp-deploy.bicep index 505fd4a35..58b4d5252 100644 --- a/ops/cloud-deployment/frontend-webapp-deploy.bicep +++ b/ops/cloud-deployment/frontend-webapp-deploy.bicep @@ -316,6 +316,3 @@ module privateEndpoint './lib/network/subnet-private-endpoint.bicep' = { privateDnsZoneSubscriptionId: privateDnsZoneSubscriptionId } } -// output webappName string = webapp.name -// output webappId string = webapp.id -// output webappUrl string = webapp.properties.hostNameSslStates[0].name diff --git a/ops/cloud-deployment/main.bicep b/ops/cloud-deployment/main.bicep index 13de524c8..bdf799ee0 100644 --- a/ops/cloud-deployment/main.bicep +++ b/ops/cloud-deployment/main.bicep @@ -237,11 +237,3 @@ module ustpFunctions 'backend-api-deploy.bicep' = { ] } -// main.bicep outputs - -// resource identityKeyVaultAppConfig 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' existing = { -// name: idKeyvaultAppConfiguration -// scope: resourceGroup(kvAppConfigResourceGroupName) -// } -// output keyVaultId string = identityKeyVaultAppConfig.id -// output keyVaultManagedIdName string = identityKeyVaultAppConfig.name From 511ba778bbe1928a39b5fcce4a2dddae8d62cb76 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 20:09:36 +0000 Subject: [PATCH 45/49] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- ops/cloud-deployment/main.bicep | 1 - 1 file changed, 1 deletion(-) diff --git a/ops/cloud-deployment/main.bicep b/ops/cloud-deployment/main.bicep index bdf799ee0..8c33ed837 100644 --- a/ops/cloud-deployment/main.bicep +++ b/ops/cloud-deployment/main.bicep @@ -236,4 +236,3 @@ module ustpFunctions 'backend-api-deploy.bicep' = { network ] } - From e6e6b4a1a74d6e6255ffad990fd4da5f1245ca1c Mon Sep 17 00:00:00 2001 From: Brian Posey <15091170+btposey@users.noreply.github.com> Date: Tue, 10 Dec 2024 15:30:49 -0500 Subject: [PATCH 46/49] Fix package.json entry point paths Jira ticket: CAMS-461 Co-authored-by: Fritz Madden <96319835+fmaddenflx@users.noreply.github.com> Co-authored-by: Arthur Morrow <133667008+amorrow-flexion@users.noreply.github.com> Co-authored-by: James Brooks <12275865+jamesobrooks@users.noreply.github.com> Co-authored-by: Brian Posey <15091170+btposey@users.noreply.github.com>, --- backend/function-apps/api/package.json | 2 +- backend/function-apps/migration/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/function-apps/api/package.json b/backend/function-apps/api/package.json index 7e76ee65a..c45a335bb 100644 --- a/backend/function-apps/api/package.json +++ b/backend/function-apps/api/package.json @@ -2,7 +2,7 @@ "name": "cams-api", "version": "1.0.0", "description": "", - "main": "dist/backend/functions/api/*/*.function.js", + "main": "dist/backend/function-apps/api/*/*.function.js", "scripts": { "clean": "rm -rf ./dist ./node_modules *.zip", "prestart": "npm run build && cp ../../.env .", diff --git a/backend/function-apps/migration/package.json b/backend/function-apps/migration/package.json index d800a2273..6ed42908f 100644 --- a/backend/function-apps/migration/package.json +++ b/backend/function-apps/migration/package.json @@ -2,7 +2,7 @@ "name": "cams-migration", "version": "1.0.0", "description": "", - "main": "dist/backend/functions/migration/loadConsolidations.js", + "main": "dist/backend/function-apps/migration/loadConsolidations.js", "scripts": { "clean": "rm -rf ./dist ./node_modules *.zip", "prestart": "npm run build && cp ../../.env .", From 4a1baee062108490243c855cd641dea1e0a1566e Mon Sep 17 00:00:00 2001 From: James Brooks <12275865+jamesobrooks@users.noreply.github.com> Date: Tue, 10 Dec 2024 14:49:56 -0600 Subject: [PATCH 47/49] Fix erroneous change --- backend/lib/use-cases/orders/orders-local-gateway.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/lib/use-cases/orders/orders-local-gateway.test.ts b/backend/lib/use-cases/orders/orders-local-gateway.test.ts index c24fb1cc1..9e67bd285 100644 --- a/backend/lib/use-cases/orders/orders-local-gateway.test.ts +++ b/backend/lib/use-cases/orders/orders-local-gateway.test.ts @@ -114,7 +114,7 @@ describe('orders use case tests', () => { }); test('should not create a second lead case for an existing consolidation', async () => { - // Spy/mock the factory function-apps so we can return a LOCAL database of our choosing for the test. + // Spy/mock the factory functions so we can return a LOCAL database of our choosing for the test. // We need a generic LOCAL gateway implementation that we return via the mocked factory function. const localCasesRepo = new LocalCasesRepository(); const localConsolidationsRepo = new LocalConsolidationOrdersRepository(); From 359779a28c5763887b14ff762902e8d3369f4052 Mon Sep 17 00:00:00 2001 From: Brian Posey <15091170+btposey@users.noreply.github.com> Date: Tue, 10 Dec 2024 16:12:40 -0500 Subject: [PATCH 48/49] Fix functions -> function-apps renaming errors Jira ticket: CAMS-461 --- .github/workflows/reusable-build-info.yml | 2 +- ops/scripts/pipeline/slots/az-slot-start-stop-operations.sh | 2 +- test/e2e/playwright/auth-setup.ts | 2 +- user-interface/src/lib/models/api2.test.ts | 4 ++-- user-interface/src/lib/utils/datetime.test.ts | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/reusable-build-info.yml b/.github/workflows/reusable-build-info.yml index 416438e0f..fcf14c140 100644 --- a/.github/workflows/reusable-build-info.yml +++ b/.github/workflows/reusable-build-info.yml @@ -147,7 +147,7 @@ jobs: op: decode in: ${{ steps.rgApp.outputs.out }} - - name: Check Initial Deployment # update flag --apiName to --apiFunctionName + - name: Check Initial Deployment id: check-initial-deployment run: | initialDeployment=$(./ops/scripts/pipeline/check-for-environment.sh --resource-group ${{ steps.rgAppDecode.outputs.out }} --webappName ${{ steps.build-info.outputs.webappName }} --apiName ${{ steps.build-info.outputs.apiFunctionName }}) diff --git a/ops/scripts/pipeline/slots/az-slot-start-stop-operations.sh b/ops/scripts/pipeline/slots/az-slot-start-stop-operations.sh index aa3cc5012..560c94bf0 100755 --- a/ops/scripts/pipeline/slots/az-slot-start-stop-operations.sh +++ b/ops/scripts/pipeline/slots/az-slot-start-stop-operations.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Description: Helper script to start and stop slots so we do not run sync function-apps against slot resources +# Description: Helper script to start and stop slots so we do not run sync functions against slot resources # Prerequisite: # - curl # - Azure CLI diff --git a/test/e2e/playwright/auth-setup.ts b/test/e2e/playwright/auth-setup.ts index 811ee238c..b6b491aa7 100644 --- a/test/e2e/playwright/auth-setup.ts +++ b/test/e2e/playwright/auth-setup.ts @@ -57,7 +57,7 @@ async function oktaLogin(page: Page) { function usingAuthenticationProvider() { let loginFunction; const provider = process.env.CAMS_LOGIN_PROVIDER ?? 'mock'; - // TODO: Add new login function-apps as we add new providers. + // TODO: Add new login functions as we add new providers. switch (provider.toLowerCase()) { case 'none': loginFunction = noOp; diff --git a/user-interface/src/lib/models/api2.test.ts b/user-interface/src/lib/models/api2.test.ts index 61fb7d474..9265145df 100644 --- a/user-interface/src/lib/models/api2.test.ts +++ b/user-interface/src/lib/models/api2.test.ts @@ -75,7 +75,7 @@ describe('extractPathFromUri', () => { }); }); -describe('_Api2 function-apps', async () => { +describe('_Api2 functions', async () => { let api: ApiType; let api2: Api2Type; @@ -86,7 +86,7 @@ describe('_Api2 function-apps', async () => { api2 = await import('./api2'); }); - test('should call real api function-apps', async () => { + test('should call real api functions', async () => { await callApiFunction(api2.Api2.getAttorneys, null, api); await callApiFunction(api2.Api2.getCaseAssignments, 'some-id', api); await callApiFunction(api2.Api2.getCaseAssociations, 'some-id', api); diff --git a/user-interface/src/lib/utils/datetime.test.ts b/user-interface/src/lib/utils/datetime.test.ts index 083ac636e..fd2525fd8 100644 --- a/user-interface/src/lib/utils/datetime.test.ts +++ b/user-interface/src/lib/utils/datetime.test.ts @@ -54,7 +54,7 @@ describe('Date/Time utilities', () => { }); }); - describe('sort function-apps', () => { + describe('sort functions', () => { test('should sort dates newest first', () => { const middle = new Date(2024, 0, 1); const newest = new Date(2024, 1, 1); From 488acb8146bde4b1017d973c1d559ea7d10715ae Mon Sep 17 00:00:00 2001 From: Arthur Morrow Date: Tue, 10 Dec 2024 16:25:08 -0500 Subject: [PATCH 49/49] updated stop slot to include migration function Jira ticket: CAMS-461 --- .../slots/az-slot-start-stop-operations.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/ops/scripts/pipeline/slots/az-slot-start-stop-operations.sh b/ops/scripts/pipeline/slots/az-slot-start-stop-operations.sh index 560c94bf0..0af280c67 100755 --- a/ops/scripts/pipeline/slots/az-slot-start-stop-operations.sh +++ b/ops/scripts/pipeline/slots/az-slot-start-stop-operations.sh @@ -4,7 +4,7 @@ # Prerequisite: # - curl # - Azure CLI -# Usage: az-slot-lifecycle.sh -g --apiName --webappName --slotName --operation +# Usage: az-slot-start-stop-operations.sh -g --apiFunctionName --migrationFunctionName --webappName --slotName --operation set -euo pipefail # ensure job step fails in CI pipeline when error occurs @@ -18,8 +18,13 @@ while [[ $# -gt 0 ]]; do shift 2 ;; - --apiName) - api_name="${2}" + --apiFunctionName) + api_function_name="${2}" + shift 2 + ;; + + --migrationFunctionName) + migration_function_name="${2}" shift 2 ;; @@ -46,13 +51,15 @@ done if [[ ${operation} == 'stop' ]]; then echo "Stopping Node API ${slot_name} slot..." - az functionapp stop -g "${app_rg}" --name "${api_name}" --slot "${slot_name}" + az functionapp stop -g "${app_rg}" --name "${api_function_name}" --slot "${slot_name}" + echo "Stopping Migration Function ${slot_name} slot..." + az functionapp stop -g "${app_rg}" --name "${migration_function_name}" --slot "${slot_name}" echo "Stopping Webapp ${slot_name} slot..." az webapp stop -g "${app_rg}" --name "${webapp_name}" --slot "${slot_name}" elif [[ ${operation} == 'start' ]]; then echo "Starting Node API ${slot_name} slot..." - az functionapp start -g "${app_rg}" --name "${api_name}" --slot "${slot_name}" + az functionapp start -g "${app_rg}" --name "${api_function_name}" --slot "${slot_name}" echo "Starting Webapp ${slot_name} slot..." az webapp start -g "${app_rg}" --name "${webapp_name}" --slot "${slot_name}"