@ministryofjustice/hmpps-digital-prison-reporting-frontend 4.19.0 → 4.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dpr/components/_async/async-polling/clientClass.mjs +0 -22
- package/dpr/components/_async/async-polling/view.njk +11 -8
- package/dpr/components/_catalogue/catalogue-list/utils.js +1 -1
- package/dpr/components/_catalogue/catalogue-list/utils.js.map +3 -3
- package/dpr/components/_catalogue/catalogue-list/utils.ts +50 -57
- package/dpr/components/_sync/sync-load/view.njk +1 -1
- package/dpr/components/user-reports/utils.js +1 -1
- package/dpr/components/user-reports/utils.js.map +2 -2
- package/dpr/components/user-reports/utils.ts +4 -4
- package/dpr/data/dashboardClient.js +1 -1
- package/dpr/data/dashboardClient.js.map +2 -2
- package/dpr/data/dashboardClient.ts +17 -0
- package/dpr/data/reportingClient.js +1 -1
- package/dpr/data/reportingClient.js.map +3 -3
- package/dpr/data/reportingClient.ts +1 -24
- package/dpr/middleware/setUpDprResources.js +1 -1
- package/dpr/middleware/setUpDprResources.js.map +3 -3
- package/dpr/middleware/setUpDprResources.ts +21 -3
- package/dpr/routes/authError.njk +10 -0
- package/dpr/routes/index.js +1 -1
- package/dpr/routes/index.js.map +3 -3
- package/dpr/routes/index.ts +7 -1
- package/dpr/routes/journeys/api-failures.cy.js +2 -0
- package/dpr/routes/journeys/api-failures.cy.js.map +7 -0
- package/dpr/routes/journeys/api-failures.cy.ts +377 -0
- package/dpr/routes/journeys/my-reports/bookmarks/service.js.map +2 -2
- package/dpr/routes/journeys/my-reports/bookmarks/service.ts +1 -0
- package/dpr/routes/journeys/request-report/controller.js +1 -1
- package/dpr/routes/journeys/request-report/controller.js.map +3 -3
- package/dpr/routes/journeys/request-report/controller.ts +25 -5
- package/dpr/routes/journeys/request-report/filters/controller.js +1 -1
- package/dpr/routes/journeys/request-report/filters/controller.js.map +2 -2
- package/dpr/routes/journeys/request-report/filters/controller.ts +1 -1
- package/dpr/routes/journeys/request-report/filters/utils.js +1 -1
- package/dpr/routes/journeys/request-report/filters/utils.js.map +2 -2
- package/dpr/routes/journeys/request-report/filters/utils.ts +1 -1
- package/dpr/routes/journeys/request-report/routes.js +1 -1
- package/dpr/routes/journeys/request-report/routes.js.map +3 -3
- package/dpr/routes/journeys/request-report/routes.ts +16 -0
- package/dpr/routes/journeys/request-report/status/controller.js +1 -1
- package/dpr/routes/journeys/request-report/status/controller.js.map +3 -3
- package/dpr/routes/journeys/request-report/status/controller.ts +0 -17
- package/dpr/routes/journeys/request-report/status/routes.js +1 -1
- package/dpr/routes/journeys/request-report/status/routes.js.map +2 -2
- package/dpr/routes/journeys/request-report/status/routes.ts +0 -1
- package/dpr/routes/journeys/view-report/async/dashboard/utils.js +1 -1
- package/dpr/routes/journeys/view-report/async/dashboard/utils.js.map +2 -2
- package/dpr/routes/journeys/view-report/async/dashboard/utils.ts +12 -4
- package/dpr/routes/journeys/view-report/sync/dashboard/controller.js +2 -0
- package/dpr/routes/journeys/view-report/sync/dashboard/controller.js.map +7 -0
- package/dpr/routes/journeys/view-report/sync/dashboard/controller.ts +39 -0
- package/dpr/routes/journeys/view-report/sync/dashboard/routes.js +2 -0
- package/dpr/routes/journeys/view-report/sync/dashboard/routes.js.map +7 -0
- package/dpr/routes/journeys/view-report/sync/dashboard/routes.ts +18 -0
- package/dpr/routes/journeys/view-report/sync/dashboard/utils.js +2 -0
- package/dpr/routes/journeys/view-report/sync/dashboard/utils.js.map +7 -0
- package/dpr/routes/journeys/view-report/sync/dashboard/utils.ts +149 -0
- package/dpr/routes/journeys/view-report/sync/load-report/controller.js +1 -1
- package/dpr/routes/journeys/view-report/sync/load-report/controller.js.map +3 -3
- package/dpr/routes/journeys/view-report/sync/load-report/controller.ts +43 -13
- package/dpr/routes/journeys/view-report/sync/report/routes.js +1 -1
- package/dpr/routes/journeys/view-report/sync/report/routes.js.map +3 -3
- package/dpr/routes/journeys/view-report/sync/report/routes.ts +2 -2
- package/dpr/routes/journeys/view-report/sync/routes.js +1 -1
- package/dpr/routes/journeys/view-report/sync/routes.js.map +3 -3
- package/dpr/routes/journeys/view-report/sync/routes.ts +2 -0
- package/dpr/routes/journeys/view-report/sync/tests.cy.js +1 -1
- package/dpr/routes/journeys/view-report/sync/tests.cy.js.map +2 -2
- package/dpr/routes/journeys/view-report/sync/tests.cy.ts +21 -1
- package/dpr/routes/serviceProblem.njk +10 -0
- package/dpr/services/dashboardService.js +1 -1
- package/dpr/services/dashboardService.js.map +2 -2
- package/dpr/services/dashboardService.ts +9 -0
- package/dpr/types/api.d.js +1 -1
- package/dpr/types/api.d.js.map +1 -1
- package/dpr/types/api.d.ts +139 -3
- package/package.json +6 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/dpr/data/reportingClient.ts"],
|
|
4
|
-
"sourcesContent": ["import ReportQuery from '../types/ReportQuery'\nimport logger from '../utils/logger'\nimport RestClient from './restClient'\nimport Dict = NodeJS.Dict\nimport { components, operations } from '../types/api'\nimport { ApiConfig, Count,
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GACA,IAAAK,EAAmB,8BACnBC,EAAuB,2BAMvB,MAAMJ,CAAgB,CAGpB,YAAYK,EAAmB,CAC7B,KAAK,WAAa,IAAI,EAAAC,QAAW,uBAAwBD,CAAM,CACjE,CAEA,SAASE,EAAsBC,EAAeC,EAA4C,CACxF,SAAAC,QAAO,KAAK,gDAAgDH,CAAY,IAAI,EAErE,KAAK,WACT,IAAI,CACH,KAAM,IAAIA,CAAY,SACtB,MAAOE,EAAa,yBAAyB,EAAI,EACjD,MAAAD,CACF,CAAC,EACA,KAAMG,GAAqBA,EAAU,KAAK,CAC/C,CAEA,QAAQJ,EAAsBC,EAAeI,EAAwD,CACnG,OAAO,KAAK,oBAAoBL,EAAcC,EAAOI,C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ingClient", "reportingClient_default", "__toCommonJS", "import_logger", "import_restClient", "config", "RestClient", "resourceName", "token", "countRequest", "logger", "response", "listRequest", "reportId", "definitionsPath", "queryParams", "variantId", "queryData", "query", "
|
|
4
|
+
"sourcesContent": ["import ReportQuery from '../types/ReportQuery'\nimport logger from '../utils/logger'\nimport RestClient from './restClient'\nimport Dict = NodeJS.Dict\nimport { components, operations } from '../types/api'\nimport { ApiConfig, Count, ListWithWarnings } from './types'\nimport type { ResultWithHeaders } from './restClient'\n\nclass ReportingClient {\n restClient: RestClient\n\n constructor(config: ApiConfig) {\n this.restClient = new RestClient('Reporting API Client', config)\n }\n\n getCount(resourceName: string, token: string, countRequest: ReportQuery): Promise<number> {\n logger.info(`Reporting client: Get count. { resourceName: ${resourceName} }`)\n\n return this.restClient\n .get({\n path: `/${resourceName}/count`,\n query: countRequest.toRecordWithFilterPrefix(true),\n token,\n })\n .then((response) => (<Count>response).count)\n }\n\n getList(resourceName: string, token: string, listRequest: ReportQuery): Promise<Array<Dict<string>>> {\n return this.getListWithWarnings(resourceName, token, listRequest).then((response) => response.data)\n }\n\n getListWithWarnings(resourceName: string, token: string, listRequest: ReportQuery): Promise<ListWithWarnings> {\n logger.info(`Reporting client: Get list. { resourceName: ${resourceName} }`)\n\n return this.restClient\n .getWithHeaders<Array<Dict<string>>>({\n path: `/${resourceName}`,\n query: listRequest.toRecordWithFilterPrefix(true),\n token,\n })\n .then((response: ResultWithHeaders<Array<Dict<string>>>) => ({\n data: response.data,\n warnings: {\n noDataAvailable: response.headers['x-no-data-warning'],\n },\n }))\n }\n\n getDefinitionSummary(\n token: string,\n reportId: string,\n definitionsPath?: string,\n ): Promise<components['schemas']['ReportDefinitionSummary']> {\n this.logInfo('Get definition summary', { reportId })\n\n const queryParams: operations['definitionSummary']['parameters']['query'] = {\n ...(definitionsPath && { dataProductDefinitionsPath: definitionsPath }),\n }\n\n return this.restClient\n .get({\n path: `/definitions/${reportId}`,\n query: queryParams,\n token,\n })\n .then((response) => <components['schemas']['ReportDefinitionSummary']>response)\n }\n\n getDefinitions(\n token: string,\n definitionsPath?: string,\n ): Promise<Array<components['schemas']['ReportDefinitionSummary']>> {\n this.logInfo('Get definitions')\n\n const queryParams: operations['definitions_1']['parameters']['query'] = {\n renderMethod: 'HTML',\n ...(definitionsPath && { dataProductDefinitionsPath: definitionsPath }),\n }\n\n return this.restClient\n .get({\n path: '/definitions',\n query: queryParams,\n token,\n })\n .then((response) => <Array<components['schemas']['ReportDefinitionSummary']>>response)\n }\n\n getDefinition(\n token: string,\n reportId: string,\n variantId: string,\n definitionsPath?: string,\n queryData?: Dict<string | string[]>,\n ): Promise<components['schemas']['SingleVariantReportDefinition']> {\n const query = {\n ...queryData,\n dataProductDefinitionsPath: definitionsPath,\n }\n\n this.logInfo('Get definition', { reportId, variantId, ...query })\n\n return this.restClient\n .get({\n path: `/definitions/${reportId}/${variantId}`,\n query,\n token,\n })\n .then((response) => <components['schemas']['SingleVariantReportDefinition']>response)\n }\n\n requestAsyncReport(\n token: string,\n reportId: string,\n variantId: string,\n query: Record<string, string | boolean | number>,\n ): Promise<Dict<string>> {\n this.logInfo('Request report', { reportId, variantId })\n\n return this.restClient\n .get({\n path: `/async/reports/${reportId}/${variantId}`,\n token,\n query,\n })\n .then((response) => <Dict<string>>response)\n }\n\n cancelAsyncRequest(\n token: string,\n reportId: string,\n variantId: string,\n executionId: string,\n dataProductDefinitionsPath?: string,\n ): Promise<Dict<string>> {\n this.logInfo('Cancel Request', { reportId, variantId, executionId })\n\n return this.restClient\n .delete({\n path: `/reports/${reportId}/${variantId}/statements/${executionId}`,\n token,\n query: {\n dataProductDefinitionsPath,\n },\n })\n .then((response) => <Dict<string>>response)\n }\n\n getAsyncReport(\n token: string,\n reportId: string,\n variantId: string,\n tableId: string,\n query: Record<string, string | string[]>,\n ): Promise<Array<Dict<string>>> {\n this.logInfo('Get Data', { reportId, variantId, tableId })\n\n return this.restClient\n .get({\n path: `/reports/${reportId}/${variantId}/tables/${tableId}/result`,\n token,\n query,\n })\n .then((response) => <Array<Dict<string>>>response)\n }\n\n getAsyncSummaryReport(\n token: string,\n reportId: string,\n variantId: string,\n tableId: string,\n summaryId: string,\n query: Dict<string | number>,\n ): Promise<Array<Dict<string>>> {\n this.logInfo('Get summary data', { reportId, variantId, tableId, summaryId })\n\n return this.restClient\n .get({\n path: `/reports/${reportId}/${variantId}/tables/${tableId}/result/summary/${summaryId}`,\n token,\n query,\n })\n .then((response) => <Array<Dict<string>>>response)\n }\n\n getAsyncReportStatus(\n token: string,\n reportId: string,\n variantId: string,\n executionId: string,\n dataProductDefinitionsPath?: string,\n tableId?: string,\n ): Promise<components['schemas']['StatementExecutionStatus']> {\n this.logInfo('Get status', { reportId, variantId, tableId, executionId })\n\n return this.restClient\n .get({\n path: `/reports/${reportId}/${variantId}/statements/${executionId}/status`,\n token,\n query: {\n dataProductDefinitionsPath,\n tableId,\n },\n })\n .then((response) => <components['schemas']['StatementExecutionStatus']>response)\n }\n\n getAsyncCount(token: string, tableId: string, dataProductDefinitionsPath?: string): Promise<number> {\n this.logInfo('Get count', { tableId })\n\n return this.restClient\n .get({\n path: `/report/tables/${tableId}/count`,\n token,\n query: {\n dataProductDefinitionsPath,\n },\n })\n .then((response) => (<Count>response).count)\n }\n\n getAsyncInteractiveCount(\n token: string,\n tableId: string,\n reportId: string,\n id: string,\n filters: ReportQuery,\n ): Promise<number> {\n this.logInfo('Get interactive count', { tableId, reportId, id })\n\n return this.restClient\n .get({\n path: `/reports/${reportId}/${id}/tables/${tableId}/count`,\n token,\n query: filters.toRecordWithFilterPrefix(true),\n })\n .then((response) => (<Count>response).count)\n }\n\n logInfo(title: string, args?: Dict<string>) {\n logger.info(`Reporting Client: ${title}:`)\n if (args && Object.keys(args).length) logger.info(JSON.stringify(args, null, 2))\n }\n}\n\nexport { ReportingClient }\nexport default ReportingClient\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,EAAA,YA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,OAAO,KAAKA,CAAI,EAAE,QAAQ,EAAAhB,QAAO,KAAK,KAAK,UAAUgB,EAAM,KAAM,CAAC,CAAC,CACjF,CACF,CAGA,IAAOzB,EAAQD",
|
|
6
|
+
"names": ["reportingClient_exports", "__export", "ReportingClient", "reportingClient_default", "__toCommonJS", "import_logger", "import_restClient", "config", "RestClient", "resourceName", "token", "countRequest", "logger", "response", "listRequest", "reportId", "definitionsPath", "queryParams", "variantId", "queryData", "query", "executionId", "dataProductDefinitionsPath", "tableId", "summaryId", "id", "filters", "title", "args"]
|
|
7
7
|
}
|
|
@@ -3,7 +3,7 @@ import logger from '../utils/logger'
|
|
|
3
3
|
import RestClient from './restClient'
|
|
4
4
|
import Dict = NodeJS.Dict
|
|
5
5
|
import { components, operations } from '../types/api'
|
|
6
|
-
import { ApiConfig, Count,
|
|
6
|
+
import { ApiConfig, Count, ListWithWarnings } from './types'
|
|
7
7
|
import type { ResultWithHeaders } from './restClient'
|
|
8
8
|
|
|
9
9
|
class ReportingClient {
|
|
@@ -109,29 +109,6 @@ class ReportingClient {
|
|
|
109
109
|
.then((response) => <components['schemas']['SingleVariantReportDefinition']>response)
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
getFieldValues({
|
|
113
|
-
token,
|
|
114
|
-
definitionName,
|
|
115
|
-
variantName,
|
|
116
|
-
fieldName,
|
|
117
|
-
prefix,
|
|
118
|
-
definitionsPath,
|
|
119
|
-
}: FieldValuesRequest): Promise<Array<string>> {
|
|
120
|
-
const query = {
|
|
121
|
-
dataProductDefinitionsPath: definitionsPath,
|
|
122
|
-
prefix,
|
|
123
|
-
}
|
|
124
|
-
this.logInfo('Get field values', { definitionName, variantName, fieldName, prefix })
|
|
125
|
-
|
|
126
|
-
return this.restClient
|
|
127
|
-
.get({
|
|
128
|
-
path: `/reports/${definitionName}/${variantName}/${fieldName}`,
|
|
129
|
-
token,
|
|
130
|
-
query,
|
|
131
|
-
})
|
|
132
|
-
.then((response) => <Array<string>>response)
|
|
133
|
-
}
|
|
134
|
-
|
|
135
112
|
requestAsyncReport(
|
|
136
113
|
token: string,
|
|
137
114
|
reportId: string,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var y=Object.create;var
|
|
1
|
+
"use strict";var y=Object.create;var d=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var C=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var F=(t,e)=>{for(var o in e)d(t,o,{get:e[o],enumerable:!0})},P=(t,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of w(e))!v.call(t,r)&&r!==o&&d(t,r,{get:()=>e[r],enumerable:!(i=E(e,r))||i.enumerable});return t};var S=(t,e,o)=>(o=t!=null?y(C(t)):{},P(e||!t||!t.__esModule?d(o,"default",{value:t,enumerable:!0}):o,t)),V=t=>P(d({},"__esModule",{value:!0}),t);var B={};F(B,{default:()=>A,errorRequestHandler:()=>h,populateDefinitions:()=>b,populateRequestedReports:()=>k,setupResources:()=>D});module.exports=V(B);var c=S(require("../utils/definitionUtils")),m=S(require("../utils/localsHelper"));const H=(t,e)=>t[e]?t[e].toString():null,Q=t=>H(t,"dataProductDefinitionsPath"),x=t=>{const e=Q(t);return e||null},h=t=>(e,o,i,r)=>e.status===401||e.status===403?i.render("dpr/routes/authError.njk",{layoutPath:t,message:"Sorry, there is a problem with authenticating your request"}):e.status>=400?i.render("dpr/routes/serviceProblem.njk",{layoutPath:t}):r(),D=(t,e,o)=>async(i,r,a)=>{I(i,r);try{return await b(t,i,r,o),await k(t,r),a()}catch(s){return h(e)(s,i,r,a)}},I=(t,e)=>{const o=t.flash("DPR_ERRORS");o&&o[0]&&(e.locals.validationErrors=JSON.parse(o[0]))},b=async(t,e,o,i)=>{const{token:r,dprUser:a}=m.default.getValues(o),s=x(e.query),n=e.body?.dataProductDefinitionsPath,l=s||n;l&&(o.locals.dpdPathFromQuery=!0);const g=i?.dataProductDefinitionsPath;g&&(o.locals.dpdPathFromConfig=!0),o.locals.definitionsPath=l||g,o.locals.pathSuffix=`?dataProductDefinitionsPath=${o.locals.definitionsPath}`;let u;r&&(u=await t.productCollectionStoreService.getSelectedProductCollectionId(a.id)),o.locals.definitions=await Promise.all([t.reportingService.getDefinitions(r,o.locals.definitionsPath),u&&t.productCollectionService.getProductCollection(r,u)]).then(([R,p])=>{if(p&&p){const q=p.products.map(f=>f.productId);return R.filter(f=>q.includes(f.id))}return R})??[]},k=async(t,e)=>{const{dprUser:o}=m.default.getValues(e);if(o.id){const{definitions:i,definitionsPath:r}=e.locals,a=await t.requestedReportService.getAllReports(o.id);e.locals.requestedReports=r?a.filter(n=>c.default.getCurrentVariantDefinition(i,n.reportId,n.id)):a;const s=await t.recentlyViewedService.getAllReports(o.id);if(e.locals.recentlyViewedReports=r?s.filter(n=>c.default.getCurrentVariantDefinition(i,n.reportId,n.id)):s,e.locals.downloadingEnabled=t.downloadPermissionService.enabled,e.locals.bookmarkingEnabled=t.bookmarkService.enabled,e.locals.collectionsEnabled=t.productCollectionService.enabled,e.locals.requestMissingEnabled=t.missingReportService.enabled,e.locals.saveDefaultsEnabled=t.defaultFilterValuesService.enabled,e.locals.bookmarkingEnabled){const n=await t.bookmarkService.getAllBookmarks(o.id);e.locals.bookmarks=r?n.filter(l=>c.default.getCurrentVariantDefinition(i,l.reportId,l.id)):n}}};var A=D;0&&(module.exports={errorRequestHandler,populateDefinitions,populateRequestedReports,setupResources});
|
|
2
2
|
//# sourceMappingURL=setUpDprResources.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/dpr/middleware/setUpDprResources.ts"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { RequestHandler, Response, Request } from 'express'\nimport type { ParsedQs } from 'qs'\nimport { Services } from '../types/Services'\nimport { RequestedReport, StoredReportData } from '../types/UserReports'\nimport DefinitionUtils from '../utils/definitionUtils'\nimport { BookmarkStoreData } from '../types/Bookmark'\nimport { DprConfig } from '../types/DprConfig'\nimport localsHelper from '../utils/localsHelper'\n\nconst getQueryParamAsString = (query: ParsedQs, name: string) => (query[name] ? query[name].toString() : null)\nconst getDefinitionsPath = (query: ParsedQs) => getQueryParamAsString(query, 'dataProductDefinitionsPath')\n\nconst deriveDefinitionsPath = (query: ParsedQs): string | null => {\n const definitionsPath = getDefinitionsPath(query)\n if (definitionsPath) {\n return definitionsPath\n }\n\n return null\n}\n\nexport const setupResources = (services: Services, config?: DprConfig): RequestHandler => {\n return async (req, res, next) => {\n populateValidationErrors(req, res)\n try {\n await populateDefinitions(services, req, res, config)\n await populateRequestedReports(services, res)\n return next()\n } catch (error) {\n return
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,wBAAAC,EAAA,6BAAAC,EAAA,mBAAAC,IAAA,eAAAC,
|
|
6
|
-
"names": ["setUpDprResources_exports", "__export", "setUpDprResources_default", "populateDefinitions", "populateRequestedReports", "setupResources", "__toCommonJS", "import_definitionUtils", "import_localsHelper", "getQueryParamAsString", "query", "name", "getDefinitionsPath", "deriveDefinitionsPath", "definitionsPath", "
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { RequestHandler, Response, Request, ErrorRequestHandler, NextFunction } from 'express'\nimport type { ParsedQs } from 'qs'\nimport { HTTPError } from 'superagent'\nimport { Services } from '../types/Services'\nimport { RequestedReport, StoredReportData } from '../types/UserReports'\nimport DefinitionUtils from '../utils/definitionUtils'\nimport { BookmarkStoreData } from '../types/Bookmark'\nimport { DprConfig } from '../types/DprConfig'\nimport localsHelper from '../utils/localsHelper'\n\nconst getQueryParamAsString = (query: ParsedQs, name: string) => (query[name] ? query[name].toString() : null)\nconst getDefinitionsPath = (query: ParsedQs) => getQueryParamAsString(query, 'dataProductDefinitionsPath')\n\nconst deriveDefinitionsPath = (query: ParsedQs): string | null => {\n const definitionsPath = getDefinitionsPath(query)\n if (definitionsPath) {\n return definitionsPath\n }\n\n return null\n}\n\nexport const errorRequestHandler =\n (layoutPath: string): ErrorRequestHandler =>\n (error: HTTPError, _req: Request, res: Response, next: NextFunction) => {\n if (error.status === 401 || error.status === 403) {\n return res.render('dpr/routes/authError.njk', {\n layoutPath,\n message: 'Sorry, there is a problem with authenticating your request',\n })\n }\n if (error.status >= 400) {\n return res.render('dpr/routes/serviceProblem.njk', {\n layoutPath,\n })\n }\n return next()\n }\n\nexport const setupResources = (services: Services, layoutPath: string, config?: DprConfig): RequestHandler => {\n return async (req, res, next) => {\n populateValidationErrors(req, res)\n try {\n await populateDefinitions(services, req, res, config)\n await populateRequestedReports(services, res)\n return next()\n } catch (error) {\n return errorRequestHandler(layoutPath)(error, req, res, next)\n }\n }\n}\n\nconst populateValidationErrors = (req: Request, res: Response) => {\n const errors = req.flash(`DPR_ERRORS`)\n if (errors && errors[0]) {\n res.locals['validationErrors'] = JSON.parse(errors[0])\n }\n}\n\nexport const populateDefinitions = async (services: Services, req: Request, res: Response, config?: DprConfig) => {\n // Get the DPD path from the query\n const { token, dprUser } = localsHelper.getValues(res)\n\n const dpdPathFromQuery = deriveDefinitionsPath(req.query)\n const dpdPathFromBody = req.body?.dataProductDefinitionsPath\n const definitionsPathFromQuery = dpdPathFromQuery || dpdPathFromBody\n\n if (definitionsPathFromQuery) {\n res.locals['dpdPathFromQuery'] = true\n }\n\n // Get the DPD path from the config\n const dpdPathFromConfig = config?.dataProductDefinitionsPath\n if (dpdPathFromConfig) {\n res.locals['dpdPathFromConfig'] = true\n }\n\n // query takes presedence over config\n res.locals['definitionsPath'] = definitionsPathFromQuery || dpdPathFromConfig\n res.locals['pathSuffix'] = `?dataProductDefinitionsPath=${res.locals['definitionsPath']}`\n\n let selectedProductCollectionId: string | undefined\n if (token) {\n selectedProductCollectionId = await services.productCollectionStoreService.getSelectedProductCollectionId(\n dprUser.id,\n )\n }\n\n res.locals['definitions'] =\n (await Promise.all([\n services.reportingService.getDefinitions(token, res.locals['definitionsPath']),\n selectedProductCollectionId &&\n services.productCollectionService.getProductCollection(token, selectedProductCollectionId),\n ]).then(([defs, selectedProductCollection]) => {\n if (selectedProductCollection && selectedProductCollection) {\n const productIds = selectedProductCollection.products.map((product) => product.productId)\n return defs.filter((def) => productIds.includes(def.id))\n }\n return defs\n })) ?? []\n}\n\nexport const populateRequestedReports = async (services: Services, res: Response) => {\n const { dprUser } = localsHelper.getValues(res)\n if (dprUser.id) {\n const { definitions, definitionsPath } = res.locals\n\n const requested = await services.requestedReportService.getAllReports(dprUser.id)\n res.locals['requestedReports'] = !definitionsPath\n ? requested\n : requested.filter((report: RequestedReport) => {\n return DefinitionUtils.getCurrentVariantDefinition(definitions, report.reportId, report.id)\n })\n\n const recent = await services.recentlyViewedService.getAllReports(dprUser.id)\n res.locals['recentlyViewedReports'] = !definitionsPath\n ? recent\n : recent.filter((report: StoredReportData) => {\n return DefinitionUtils.getCurrentVariantDefinition(definitions, report.reportId, report.id)\n })\n\n res.locals['downloadingEnabled'] = services.downloadPermissionService.enabled\n res.locals['bookmarkingEnabled'] = services.bookmarkService.enabled\n res.locals['collectionsEnabled'] = services.productCollectionService.enabled\n res.locals['requestMissingEnabled'] = services.missingReportService.enabled\n res.locals['saveDefaultsEnabled'] = services.defaultFilterValuesService.enabled\n\n if (res.locals['bookmarkingEnabled']) {\n const bookmarks = await services.bookmarkService.getAllBookmarks(dprUser.id)\n res.locals['bookmarks'] = !definitionsPath\n ? bookmarks\n : bookmarks.filter((bookmark: BookmarkStoreData) => {\n return DefinitionUtils.getCurrentVariantDefinition(definitions, bookmark.reportId, bookmark.id)\n })\n }\n }\n}\n\nexport default setupResources\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,wBAAAC,EAAA,wBAAAC,EAAA,6BAAAC,EAAA,mBAAAC,IAAA,eAAAC,EAAAP,GAMA,IAAAQ,EAA4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OAAO,mBAAwBE,EAAS,0BAA0B,QACtEF,EAAI,OAAO,mBAAwBE,EAAS,gBAAgB,QAC5DF,EAAI,OAAO,mBAAwBE,EAAS,yBAAyB,QACrEF,EAAI,OAAO,sBAA2BE,EAAS,qBAAqB,QACpEF,EAAI,OAAO,oBAAyBE,EAAS,2BAA2B,QAEpEF,EAAI,OAAO,mBAAuB,CACpC,MAAMyB,EAAY,MAAMvB,EAAS,gBAAgB,gBAAgBM,EAAQ,EAAE,EAC3ER,EAAI,OAAO,UAAgBJ,EAEvB6B,EAAU,OAAQC,GACT,EAAAH,QAAgB,4BAA4BH,EAAaM,EAAS,SAAUA,EAAS,EAAE,CAC/F,EAHDD,CAIN,CACF,CACF,EAEA,IAAO1C,EAAQI",
|
|
6
|
+
"names": ["setUpDprResources_exports", "__export", "setUpDprResources_default", "errorRequestHandler", "populateDefinitions", "populateRequestedReports", "setupResources", "__toCommonJS", "import_definitionUtils", "import_localsHelper", "getQueryParamAsString", "query", "name", "getDefinitionsPath", "deriveDefinitionsPath", "definitionsPath", "layoutPath", "error", "_req", "res", "next", "services", "config", "req", "populateValidationErrors", "errors", "token", "dprUser", "localsHelper", "dpdPathFromQuery", "dpdPathFromBody", "definitionsPathFromQuery", "dpdPathFromConfig", "selectedProductCollectionId", "defs", "selectedProductCollection", "productIds", "product", "def", "definitions", "requested", "report", "DefinitionUtils", "recent", "bookmarks", "bookmark"]
|
|
7
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { RequestHandler, Response, Request } from 'express'
|
|
2
|
+
import { RequestHandler, Response, Request, ErrorRequestHandler, NextFunction } from 'express'
|
|
3
3
|
import type { ParsedQs } from 'qs'
|
|
4
|
+
import { HTTPError } from 'superagent'
|
|
4
5
|
import { Services } from '../types/Services'
|
|
5
6
|
import { RequestedReport, StoredReportData } from '../types/UserReports'
|
|
6
7
|
import DefinitionUtils from '../utils/definitionUtils'
|
|
@@ -20,7 +21,24 @@ const deriveDefinitionsPath = (query: ParsedQs): string | null => {
|
|
|
20
21
|
return null
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
export const
|
|
24
|
+
export const errorRequestHandler =
|
|
25
|
+
(layoutPath: string): ErrorRequestHandler =>
|
|
26
|
+
(error: HTTPError, _req: Request, res: Response, next: NextFunction) => {
|
|
27
|
+
if (error.status === 401 || error.status === 403) {
|
|
28
|
+
return res.render('dpr/routes/authError.njk', {
|
|
29
|
+
layoutPath,
|
|
30
|
+
message: 'Sorry, there is a problem with authenticating your request',
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
if (error.status >= 400) {
|
|
34
|
+
return res.render('dpr/routes/serviceProblem.njk', {
|
|
35
|
+
layoutPath,
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
return next()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const setupResources = (services: Services, layoutPath: string, config?: DprConfig): RequestHandler => {
|
|
24
42
|
return async (req, res, next) => {
|
|
25
43
|
populateValidationErrors(req, res)
|
|
26
44
|
try {
|
|
@@ -28,7 +46,7 @@ export const setupResources = (services: Services, config?: DprConfig): RequestH
|
|
|
28
46
|
await populateRequestedReports(services, res)
|
|
29
47
|
return next()
|
|
30
48
|
} catch (error) {
|
|
31
|
-
return
|
|
49
|
+
return errorRequestHandler(layoutPath)(error, req, res, next)
|
|
32
50
|
}
|
|
33
51
|
}
|
|
34
52
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{% extends layoutPath %}
|
|
2
|
+
|
|
3
|
+
{% block content %}
|
|
4
|
+
<h1 class="govuk-heading-xl">Sorry, there is a problem with authenticating your request.</h1>
|
|
5
|
+
<p>The problem has been reported to the service team.</p>
|
|
6
|
+
<p>Try again later.</p>
|
|
7
|
+
<h2 class="govuk-heading-m">Get help</h2>
|
|
8
|
+
<p>Contact the helpdesk on 0800 917 5148 or #6598 from inside an establishment.</p>
|
|
9
|
+
<p><a class="govuk-link--no-visited-state" href="{{ digitalPrisonServicesUrl }}">Go to digital services home page</a></p>
|
|
10
|
+
{% endblock %}
|
package/dpr/routes/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var l=Object.create;var i=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var R=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var d=(e,r)=>{for(var t in r)i(e,t,{get:r[t],enumerable:!0})},m=(e,r,t,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of y(r))!v.call(e,o)&&o!==t&&i(e,o,{get:()=>r[o],enumerable:!(u=g(r,o))||u.enumerable});return e};var s=(e,r,t)=>(t=e!=null?l(R(e)):{},m(r||!e||!e.__esModule?i(t,"default",{value:e,enumerable:!0}):t,e)),P=e=>m(i({},"__esModule",{value:!0}),e);var q={};d(q,{default:()=>h});module.exports=P(q);var n=require("express"),f=s(require("../utils/logger")),p=s(require("./journeys/routes")),a=s(require("../middleware/setUpNestedRoute")),c=require("../middleware/setUpDprResources");function S(e){f.default.info("Initialiasing DPR routes...");const r=(0,n.Router)({mergeParams:!0});return r.use("/",(0,a.default)(),(0,p.default)(e),(0,c.errorRequestHandler)(e.layoutPath)),r}var h=S;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dpr/routes/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/dpr/routes/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { Router } from 'express'\nimport type { Services } from '../types/Services'\nimport logger from '../utils/logger'\nimport JourneyRoutes from './journeys/routes'\n// middleware\nimport setUpNestedRoute from '../middleware/setUpNestedRoute'\n\nfunction routes(routeImportParams: { services: Services; layoutPath: string }) {\n logger.info('Initialiasing DPR routes...')\n const router = Router({ mergeParams: true })\n router.use('/'
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAuB,mBAEvBC,EAAmB,8BACnBC,EAA0B,gCAE1BC,EAA6B,
|
|
6
|
-
"names": ["routes_exports", "__export", "routes_default", "__toCommonJS", "import_express", "import_logger", "import_routes", "import_setUpNestedRoute", "routes", "routeImportParams", "logger", "router", "setUpNestedRoute", "JourneyRoutes"]
|
|
4
|
+
"sourcesContent": ["import { Router } from 'express'\nimport type { Services } from '../types/Services'\nimport logger from '../utils/logger'\nimport JourneyRoutes from './journeys/routes'\n// middleware\nimport setUpNestedRoute from '../middleware/setUpNestedRoute'\nimport { errorRequestHandler } from '../middleware/setUpDprResources'\n\nfunction routes(routeImportParams: { services: Services; layoutPath: string }) {\n logger.info('Initialiasing DPR routes...')\n const router = Router({ mergeParams: true })\n router.use(\n '/',\n setUpNestedRoute(),\n JourneyRoutes(routeImportParams),\n errorRequestHandler(routeImportParams.layoutPath),\n )\n return router\n}\n\nexport default routes\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAuB,mBAEvBC,EAAmB,8BACnBC,EAA0B,gCAE1BC,EAA6B,6CAC7BC,EAAoC,2CAEpC,SAASC,EAAOC,EAA+D,CAC7E,EAAAC,QAAO,KAAK,6BAA6B,EACzC,MAAMC,KAAS,UAAO,CAAE,YAAa,EAAK,CAAC,EAC3C,OAAAA,EAAO,IACL,OACA,EAAAC,SAAiB,KACjB,EAAAC,SAAcJ,CAAiB,KAC/B,uBAAoBA,EAAkB,UAAU,CAClD,EACOE,CACT,CAEA,IAAOV,EAAQO",
|
|
6
|
+
"names": ["routes_exports", "__export", "routes_default", "__toCommonJS", "import_express", "import_logger", "import_routes", "import_setUpNestedRoute", "import_setUpDprResources", "routes", "routeImportParams", "logger", "router", "setUpNestedRoute", "JourneyRoutes"]
|
|
7
7
|
}
|
package/dpr/routes/index.ts
CHANGED
|
@@ -4,11 +4,17 @@ import logger from '../utils/logger'
|
|
|
4
4
|
import JourneyRoutes from './journeys/routes'
|
|
5
5
|
// middleware
|
|
6
6
|
import setUpNestedRoute from '../middleware/setUpNestedRoute'
|
|
7
|
+
import { errorRequestHandler } from '../middleware/setUpDprResources'
|
|
7
8
|
|
|
8
9
|
function routes(routeImportParams: { services: Services; layoutPath: string }) {
|
|
9
10
|
logger.info('Initialiasing DPR routes...')
|
|
10
11
|
const router = Router({ mergeParams: true })
|
|
11
|
-
router.use(
|
|
12
|
+
router.use(
|
|
13
|
+
'/',
|
|
14
|
+
setUpNestedRoute(),
|
|
15
|
+
JourneyRoutes(routeImportParams),
|
|
16
|
+
errorRequestHandler(routeImportParams.layoutPath),
|
|
17
|
+
)
|
|
12
18
|
return router
|
|
13
19
|
}
|
|
14
20
|
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var t=require("cypress-tests/cypressUtils");context("Try to run the app with failing and broken api endpoints",()=>{const i="/embedded/platform/";beforeEach(()=>{(0,t.stubBaseTasks)()}),describe("erroring endpoints - reports",()=>{it("should cope with definitions list failing",()=>{(0,t.executeReportStubs)(),cy.task("stubDefinitionRequestExamplesSuccess"),cy.task("stubRequestSuccessResult20"),cy.task("getDefinitionSummariesFailure"),cy.visit(i),cy.findByRole("heading",{name:/Sorry, there is a problem with the service/}).should("be.visible")}),it("should cope with definitions list being unauthd",()=>{(0,t.executeReportStubs)(),cy.task("stubDefinitionRequestExamplesSuccess"),cy.task("stubRequestSuccessResult20"),cy.task("getDefinitionSummariesUnauthenticatedFailure"),cy.visit(i),cy.findByRole("heading",{name:/Sorry, there is a problem with authenticating your request/}).should("be.visible")}),it("should cope with single definition endpoint failing",()=>{(0,t.executeReportStubs)(),cy.task("stubDefinitionRequestExamplesSuccess"),cy.task("stubRequestSuccessResult20"),cy.task("getSingleDefinitionFailure"),cy.visit(i),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(s,e)=>!!e?.textContent?.includes("Successful Report")&&!!e?.textContent?.includes("this will succeed")}).within(()=>{cy.findByRole("link",{name:"Request report"}).click()})}),cy.findByRole("heading",{name:/Your report has failed to generate/}).should("be.visible")}),it("should cope with single definition failing",()=>{(0,t.executeReportStubs)(),cy.task("stubDefinitionRequestExamplesSuccess"),cy.task("stubRequestSuccessResult20"),cy.task("getSingleDefinitionFailure"),cy.visit(i),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(s,e)=>!!e?.textContent?.includes("Successful Report")&&!!e?.textContent?.includes("this will succeed")}).within(()=>{cy.findByRole("link",{name:"Request report"}).click()})}),cy.findByRole("heading",{name:/Your report has failed to generate/}).should("be.visible")}),it("should cope with single definition variant failing",()=>{(0,t.executeReportStubs)(),cy.task("stubDefinitionRequestExamplesSuccess"),cy.task("stubRequestSuccessResult20"),cy.task("getSingleDefinitionVariantFailure"),cy.visit(i),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(s,e)=>!!e?.textContent?.includes("Successful Report")&&!!e?.textContent?.includes("this will succeed")}).within(()=>{cy.findByRole("link",{name:"Request report"}).click()})}),cy.findByRole("heading",{name:/Your report has failed to generate/}).should("be.visible")}),it("should cope with count failing",()=>{(0,t.executeReportStubs)(),cy.task("stubDefinitionRequestExamplesSuccess"),cy.task("stubRequestSuccessResult20"),cy.task("getAsyncCountFailure"),cy.visit(i),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(s,e)=>!!e?.textContent?.includes("Successful Report")&&!!e?.textContent?.includes("this will succeed")}).within(()=>{cy.findByRole("link",{name:"Request report"}).click()})}),cy.findByRole("button",{name:/Request/}).click(),cy.findByRole("heading",{name:/Your report has failed to generate/}).should("be.visible")}),it("should cope with requestAsyncReport failing",()=>{(0,t.executeReportStubs)(),cy.task("stubDefinitionRequestExamplesSuccess"),cy.task("stubRequestSuccessResult20"),cy.task("requestAsyncReportFailure"),cy.visit(i),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(s,e)=>!!e?.textContent?.includes("Successful Report")&&!!e?.textContent?.includes("this will succeed")}).within(()=>{cy.findByRole("link",{name:"Request report"}).click()})}),cy.findByRole("button",{name:/Request/}).click(),cy.findByRole("heading",{name:/Your report has failed to generate/}).should("be.visible")}),it("should cope with cancelAsyncRequest failing",()=>{(0,t.stubBaseTasks)(),(0,t.stubDefinitionsTasks)(),cy.task("stubViewAsyncReportingResults"),cy.task("stubRequestSuccessReportTablesCount"),cy.task("stubAsyncRequestSuccessReportTablesCount"),cy.task("stubDefinitionRequestExamplesSuccess"),cy.task("stubRequestSuccessResult20"),cy.task("cancelAsyncRequestFailure"),cy.visit(i),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(s,e)=>!!e?.textContent?.includes("Successful Report")&&!!e?.textContent?.includes("this will succeed")}).within(()=>{cy.findByRole("link",{name:"Request report"}).click()})}),cy.findByRole("button",{name:/Request/}).click(),cy.findByRole("button",{name:/Cancel request/}).click(),cy.findByRole("heading",{name:/Your report has failed to generate/}).should("be.visible")}),it("should cope with getAsyncReport failing",()=>{(0,t.executeReportStubs)(),cy.task("stubDefinitionRequestExamplesSuccess"),cy.task("stubRequestSuccessResult20"),cy.task("getAsyncReportFailure"),cy.visit(i),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(s,e)=>!!e?.textContent?.includes("Successful Report")&&!!e?.textContent?.includes("this will succeed")}).within(()=>{cy.findByRole("link",{name:"Request report"}).click()})}),cy.findByRole("button",{name:/Request/}).click(),cy.findByRole("heading",{name:/Your report has failed to generate/}).should("be.visible")}),it("should cope with getAsyncSummaryReport failing",()=>{(0,t.stubBaseTasks)(),(0,t.stubDefinitionsTasks)(),cy.task("stubViewAsyncReportingResults"),cy.task("getAsyncSummaryReportFailure"),cy.visit(i),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(s,e)=>!!e?.textContent?.includes("Successful Report")&&!!e?.textContent?.includes("this will succeed")}).within(()=>{cy.findByRole("link",{name:"Request report"}).click()})}),cy.findByRole("button",{name:/Request/}).click(),cy.findByRole("heading",{name:/Your report has failed to generate/}).should("be.visible")}),it("should cope with getAsyncReportStatus failing",()=>{(0,t.executeReportStubs)(),cy.task("stubDefinitionRequestExamplesSuccess"),cy.task("getAsyncReportStatusFailure"),cy.visit(i),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(s,e)=>!!e?.textContent?.includes("Successful Report")&&!!e?.textContent?.includes("this will succeed")}).within(()=>{cy.findByRole("link",{name:"Request report"}).click()})}),cy.findByRole("button",{name:/Request/}).click(),cy.findByRole("heading",{name:/Your report has failed to generate/}).should("be.visible")})}),describe("erroring endpoints - dashboards",()=>{it("should cope with single definition endpoint failing",()=>{(0,t.executeDashboardStubs)(),cy.task("stubDataQualityDashboardsResultMock"),cy.task("stubListExampleDashboard"),cy.task("stubDefinitionFeatureTestingInteractive"),cy.task("getSingleDashboardFailure"),cy.visit(i),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(s,e)=>!!e.textContent?.includes("Data quality data set")}).within(()=>{cy.findByRole("link",{name:"Request dashboard"}).click()})}),cy.findByRole("heading",{name:/Your report has failed to generate/}).should("be.visible")}),it("should cope with requestAsyncDashboard failing",()=>{(0,t.executeDashboardStubs)(),cy.task("stubDataQualityDashboardsResultMock"),cy.task("stubListExampleDashboard"),cy.task("stubDefinitionFeatureTestingInteractive"),cy.task("requestAsyncDashboardFailure"),cy.visit(i),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(s,e)=>!!e.textContent?.includes("Data quality data set")}).within(()=>{cy.findByRole("link",{name:"Request dashboard"}).click()})}),cy.findByRole("button",{name:"Request dashboard"}).click(),cy.findByRole("heading",{name:/Your report has failed to generate/}).should("be.visible")}),it("should cope with getAsyncDashboard failing",()=>{(0,t.executeDashboardStubs)(),cy.task("stubDataQualityDashboardsResultMock"),cy.task("stubListExampleDashboard"),cy.task("stubDefinitionFeatureTestingInteractive"),cy.task("getAsyncDashboardFailure"),cy.visit(i),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(s,e)=>!!e.textContent?.includes("Data quality data set")}).within(()=>{cy.findByRole("link",{name:"Request dashboard"}).click()})}),cy.findByRole("button",{name:"Request dashboard"}).click(),cy.findByRole("heading",{name:/Your report has failed to generate/}).should("be.visible")}),it("should cope with getAsyncDashboardStatus failing",()=>{(0,t.stubBaseTasks)(),(0,t.stubDefinitionsTasks)(),cy.task("stubViewAsyncResults"),cy.task("stubDataQualityDashboardsResultMock"),cy.task("stubListExampleDashboard"),cy.task("stubDefinitionFeatureTestingInteractive"),cy.task("getAsyncDashboardStatusFailure"),cy.visit(i),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(s,e)=>!!e.textContent?.includes("Data quality data set")}).within(()=>{cy.findByRole("link",{name:"Request dashboard"}).click()})}),cy.findByRole("button",{name:"Request dashboard"}).click(),cy.findByRole("heading",{name:/Your report has failed to generate/}).should("be.visible")}),it("should cope with cancelAsyncRequest failing",()=>{(0,t.stubBaseTasks)(),(0,t.stubDefinitionsTasks)(),cy.task("stubReportsStartedStatus"),cy.task("stubMockDashboardsStatusStarted"),cy.task("stubViewAsyncResults"),cy.task("stubDataQualityDashboardsResultMock"),cy.task("stubListExampleDashboard"),cy.task("stubDefinitionFeatureTestingInteractive"),cy.task("cancelAsyncRequestDashboardFailure"),cy.visit(i),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(s,e)=>!!e.textContent?.includes("Data quality data set")}).within(()=>{cy.findByRole("link",{name:"Request dashboard"}).click()})}),cy.findByRole("button",{name:/Request/}).click(),cy.findByRole("button",{name:/Cancel request/}).click(),cy.task("stubMockDashboardsStatusFinished"),cy.findByRole("heading",{name:/Failed to abort request/}).should("be.visible")})})});
|
|
2
|
+
//# sourceMappingURL=api-failures.cy.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/dpr/routes/journeys/api-failures.cy.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n executeDashboardStubs,\n executeReportStubs,\n stubBaseTasks,\n stubDefinitionsTasks,\n} from 'cypress-tests/cypressUtils'\n\ncontext('Try to run the app with failing and broken api endpoints', () => {\n const path = '/embedded/platform/'\n\n beforeEach(() => {\n stubBaseTasks()\n })\n\n describe('erroring endpoints - reports', () => {\n it('should cope with definitions list failing', () => {\n executeReportStubs()\n cy.task('stubDefinitionRequestExamplesSuccess')\n cy.task('stubRequestSuccessResult20')\n cy.task('getDefinitionSummariesFailure')\n\n cy.visit(path)\n\n cy.findByRole('heading', { name: /Sorry, there is a problem with the service/ }).should('be.visible')\n })\n\n it('should cope with definitions list being unauthd', () => {\n executeReportStubs()\n cy.task('stubDefinitionRequestExamplesSuccess')\n cy.task('stubRequestSuccessResult20')\n cy.task('getDefinitionSummariesUnauthenticatedFailure')\n\n cy.visit(path)\n\n cy.findByRole('heading', { name: /Sorry, there is a problem with authenticating your request/ }).should(\n 'be.visible',\n )\n })\n\n it('should cope with single definition endpoint failing', () => {\n executeReportStubs()\n cy.task('stubDefinitionRequestExamplesSuccess')\n cy.task('stubRequestSuccessResult20')\n cy.task('getSingleDefinitionFailure')\n\n cy.visit(path)\n cy.findByLabelText(/Reports catalogue.*/i).within(() => {\n cy.findByRole('row', {\n name: (_, element) => {\n return (\n Boolean(element?.textContent?.includes('Successful Report')) &&\n Boolean(element?.textContent?.includes('this will succeed'))\n )\n },\n }).within(() => {\n cy.findByRole('link', { name: 'Request report' }).click()\n })\n })\n\n cy.findByRole('heading', { name: /Your report has failed to generate/ }).should('be.visible')\n })\n\n it('should cope with single definition failing', () => {\n executeReportStubs()\n cy.task('stubDefinitionRequestExamplesSuccess')\n cy.task('stubRequestSuccessResult20')\n cy.task('getSingleDefinitionFailure')\n\n cy.visit(path)\n cy.findByLabelText(/Reports catalogue.*/i).within(() => {\n cy.findByRole('row', {\n name: (_, element) => {\n return (\n Boolean(element?.textContent?.includes('Successful Report')) &&\n Boolean(element?.textContent?.includes('this will succeed'))\n )\n },\n }).within(() => {\n cy.findByRole('link', { name: 'Request report' }).click()\n })\n })\n\n cy.findByRole('heading', { name: /Your report has failed to generate/ }).should('be.visible')\n })\n\n it('should cope with single definition variant failing', () => {\n executeReportStubs()\n cy.task('stubDefinitionRequestExamplesSuccess')\n cy.task('stubRequestSuccessResult20')\n cy.task('getSingleDefinitionVariantFailure')\n\n cy.visit(path)\n cy.findByLabelText(/Reports catalogue.*/i).within(() => {\n cy.findByRole('row', {\n name: (_, element) => {\n return (\n Boolean(element?.textContent?.includes('Successful Report')) &&\n Boolean(element?.textContent?.includes('this will succeed'))\n )\n },\n }).within(() => {\n cy.findByRole('link', { name: 'Request report' }).click()\n })\n })\n\n cy.findByRole('heading', { name: /Your report has failed to generate/ }).should('be.visible')\n })\n\n it('should cope with count failing', () => {\n executeReportStubs()\n cy.task('stubDefinitionRequestExamplesSuccess')\n cy.task('stubRequestSuccessResult20')\n cy.task('getAsyncCountFailure')\n\n cy.visit(path)\n cy.findByLabelText(/Reports catalogue.*/i).within(() => {\n cy.findByRole('row', {\n name: (_, element) => {\n return (\n Boolean(element?.textContent?.includes('Successful Report')) &&\n Boolean(element?.textContent?.includes('this will succeed'))\n )\n },\n }).within(() => {\n cy.findByRole('link', { name: 'Request report' }).click()\n })\n })\n cy.findByRole('button', { name: /Request/ }).click()\n\n cy.findByRole('heading', { name: /Your report has failed to generate/ }).should('be.visible')\n })\n\n it('should cope with requestAsyncReport failing', () => {\n executeReportStubs()\n cy.task('stubDefinitionRequestExamplesSuccess')\n cy.task('stubRequestSuccessResult20')\n cy.task('requestAsyncReportFailure')\n\n cy.visit(path)\n cy.findByLabelText(/Reports catalogue.*/i).within(() => {\n cy.findByRole('row', {\n name: (_, element) => {\n return (\n Boolean(element?.textContent?.includes('Successful Report')) &&\n Boolean(element?.textContent?.includes('this will succeed'))\n )\n },\n }).within(() => {\n cy.findByRole('link', { name: 'Request report' }).click()\n })\n })\n cy.findByRole('button', { name: /Request/ }).click()\n\n cy.findByRole('heading', { name: /Your report has failed to generate/ }).should('be.visible')\n })\n\n it('should cope with cancelAsyncRequest failing', () => {\n stubBaseTasks()\n stubDefinitionsTasks()\n cy.task('stubViewAsyncReportingResults')\n cy.task('stubRequestSuccessReportTablesCount')\n cy.task('stubAsyncRequestSuccessReportTablesCount')\n cy.task('stubDefinitionRequestExamplesSuccess')\n cy.task('stubRequestSuccessResult20')\n cy.task('cancelAsyncRequestFailure')\n\n cy.visit(path)\n cy.findByLabelText(/Reports catalogue.*/i).within(() => {\n cy.findByRole('row', {\n name: (_, element) => {\n return (\n Boolean(element?.textContent?.includes('Successful Report')) &&\n Boolean(element?.textContent?.includes('this will succeed'))\n )\n },\n }).within(() => {\n cy.findByRole('link', { name: 'Request report' }).click()\n })\n })\n cy.findByRole('button', { name: /Request/ }).click()\n\n cy.findByRole('button', { name: /Cancel request/ }).click()\n\n cy.findByRole('heading', { name: /Your report has failed to generate/ }).should('be.visible')\n })\n\n it('should cope with getAsyncReport failing', () => {\n executeReportStubs()\n cy.task('stubDefinitionRequestExamplesSuccess')\n cy.task('stubRequestSuccessResult20')\n cy.task('getAsyncReportFailure')\n\n cy.visit(path)\n cy.findByLabelText(/Reports catalogue.*/i).within(() => {\n cy.findByRole('row', {\n name: (_, element) => {\n return (\n Boolean(element?.textContent?.includes('Successful Report')) &&\n Boolean(element?.textContent?.includes('this will succeed'))\n )\n },\n }).within(() => {\n cy.findByRole('link', { name: 'Request report' }).click()\n })\n })\n cy.findByRole('button', { name: /Request/ }).click()\n\n cy.findByRole('heading', { name: /Your report has failed to generate/ }).should('be.visible')\n })\n\n it('should cope with getAsyncSummaryReport failing', () => {\n stubBaseTasks()\n stubDefinitionsTasks()\n cy.task('stubViewAsyncReportingResults')\n cy.task('getAsyncSummaryReportFailure')\n\n cy.visit(path)\n cy.findByLabelText(/Reports catalogue.*/i).within(() => {\n cy.findByRole('row', {\n name: (_, element) => {\n return (\n Boolean(element?.textContent?.includes('Successful Report')) &&\n Boolean(element?.textContent?.includes('this will succeed'))\n )\n },\n }).within(() => {\n cy.findByRole('link', { name: 'Request report' }).click()\n })\n })\n cy.findByRole('button', { name: /Request/ }).click()\n\n cy.findByRole('heading', { name: /Your report has failed to generate/ }).should('be.visible')\n })\n\n it('should cope with getAsyncReportStatus failing', () => {\n executeReportStubs()\n cy.task('stubDefinitionRequestExamplesSuccess')\n cy.task('getAsyncReportStatusFailure')\n\n cy.visit(path)\n cy.findByLabelText(/Reports catalogue.*/i).within(() => {\n cy.findByRole('row', {\n name: (_, element) => {\n return (\n Boolean(element?.textContent?.includes('Successful Report')) &&\n Boolean(element?.textContent?.includes('this will succeed'))\n )\n },\n }).within(() => {\n cy.findByRole('link', { name: 'Request report' }).click()\n })\n })\n cy.findByRole('button', { name: /Request/ }).click()\n\n cy.findByRole('heading', { name: /Your report has failed to generate/ }).should('be.visible')\n })\n })\n\n describe('erroring endpoints - dashboards', () => {\n it('should cope with single definition endpoint failing', () => {\n executeDashboardStubs()\n cy.task('stubDataQualityDashboardsResultMock')\n cy.task('stubListExampleDashboard')\n cy.task('stubDefinitionFeatureTestingInteractive')\n cy.task('getSingleDashboardFailure')\n\n cy.visit(path)\n cy.findByLabelText(/Reports catalogue.*/i).within(() => {\n cy.findByRole('row', {\n name: (_, element) => {\n return Boolean(element.textContent?.includes('Data quality data set'))\n },\n }).within(() => {\n cy.findByRole('link', { name: 'Request dashboard' }).click()\n })\n })\n\n cy.findByRole('heading', { name: /Your report has failed to generate/ }).should('be.visible')\n })\n\n it('should cope with requestAsyncDashboard failing', () => {\n executeDashboardStubs()\n cy.task('stubDataQualityDashboardsResultMock')\n cy.task('stubListExampleDashboard')\n cy.task('stubDefinitionFeatureTestingInteractive')\n cy.task('requestAsyncDashboardFailure')\n\n cy.visit(path)\n cy.findByLabelText(/Reports catalogue.*/i).within(() => {\n cy.findByRole('row', {\n name: (_, element) => {\n return Boolean(element.textContent?.includes('Data quality data set'))\n },\n }).within(() => {\n cy.findByRole('link', { name: 'Request dashboard' }).click()\n })\n })\n cy.findByRole('button', { name: 'Request dashboard' }).click()\n\n cy.findByRole('heading', { name: /Your report has failed to generate/ }).should('be.visible')\n })\n\n it('should cope with getAsyncDashboard failing', () => {\n executeDashboardStubs()\n cy.task('stubDataQualityDashboardsResultMock')\n cy.task('stubListExampleDashboard')\n cy.task('stubDefinitionFeatureTestingInteractive')\n cy.task('getAsyncDashboardFailure')\n\n cy.visit(path)\n cy.findByLabelText(/Reports catalogue.*/i).within(() => {\n cy.findByRole('row', {\n name: (_, element) => {\n return Boolean(element.textContent?.includes('Data quality data set'))\n },\n }).within(() => {\n cy.findByRole('link', { name: 'Request dashboard' }).click()\n })\n })\n cy.findByRole('button', { name: 'Request dashboard' }).click()\n\n cy.findByRole('heading', { name: /Your report has failed to generate/ }).should('be.visible')\n })\n\n it('should cope with getAsyncDashboardStatus failing', () => {\n stubBaseTasks()\n stubDefinitionsTasks()\n cy.task('stubViewAsyncResults')\n cy.task('stubDataQualityDashboardsResultMock')\n cy.task('stubListExampleDashboard')\n cy.task('stubDefinitionFeatureTestingInteractive')\n cy.task('getAsyncDashboardStatusFailure')\n\n cy.visit(path)\n cy.findByLabelText(/Reports catalogue.*/i).within(() => {\n cy.findByRole('row', {\n name: (_, element) => {\n return Boolean(element.textContent?.includes('Data quality data set'))\n },\n }).within(() => {\n cy.findByRole('link', { name: 'Request dashboard' }).click()\n })\n })\n cy.findByRole('button', { name: 'Request dashboard' }).click()\n\n cy.findByRole('heading', { name: /Your report has failed to generate/ }).should('be.visible')\n })\n\n it('should cope with cancelAsyncRequest failing', () => {\n stubBaseTasks()\n stubDefinitionsTasks()\n cy.task('stubReportsStartedStatus')\n cy.task('stubMockDashboardsStatusStarted')\n cy.task('stubViewAsyncResults')\n cy.task('stubDataQualityDashboardsResultMock')\n cy.task('stubListExampleDashboard')\n cy.task('stubDefinitionFeatureTestingInteractive')\n cy.task('cancelAsyncRequestDashboardFailure')\n\n cy.visit(path)\n cy.findByLabelText(/Reports catalogue.*/i).within(() => {\n cy.findByRole('row', {\n name: (_, element) => {\n return Boolean(element.textContent?.includes('Data quality data set'))\n },\n }).within(() => {\n cy.findByRole('link', { name: 'Request dashboard' }).click()\n })\n })\n cy.findByRole('button', { name: /Request/ }).click()\n\n cy.findByRole('button', { name: /Cancel request/ }).click()\n cy.task('stubMockDashboardsStatusFinished')\n cy.findByRole('heading', { name: /Failed to abort request/ }).should('be.visible')\n })\n })\n})\n"],
|
|
5
|
+
"mappings": "aAAA,IAAAA,EAKO,sCAEP,QAAQ,2DAA4D,IAAM,CACxE,MAAMC,EAAO,sBAEb,WAAW,IAAM,IACf,iBAAc,CAChB,CAAC,EAED,SAAS,+BAAgC,IAAM,CAC7C,GAAG,4CAA6C,IAAM,IACpD,sBAAmB,EACnB,GAAG,KAAK,sCAAsC,EAC9C,GAAG,KAAK,4BAA4B,EACpC,GAAG,KAAK,+BAA+B,EAEvC,GAAG,MAAMA,CAAI,EAEb,GAAG,WAAW,UAAW,CAAE,KAAM,4CAA6C,CAAC,EAAE,OAAO,YAAY,CACtG,CAAC,EAED,GAAG,kDAAmD,IAAM,IAC1D,sBAAmB,EACnB,GAAG,KAAK,sCAAsC,EAC9C,GAAG,KAAK,4BAA4B,EACpC,GAAG,KAAK,8CAA8C,EAEtD,GAAG,MAAMA,CAAI,EAEb,GAAG,WAAW,UAAW,CAAE,KAAM,4DAA6D,CAAC,EAAE,OAC/F,YACF,CACF,CAAC,EAED,GAAG,sDAAuD,IAAM,IAC9D,sBAAmB,EACnB,GAAG,KAAK,sCAAsC,EAC9C,GAAG,KAAK,4BAA4B,EACpC,GAAG,KAAK,4BAA4B,EAEpC,GAAG,MAAMA,CAAI,EACb,GAAG,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