diff --git a/package-lock.json b/package-lock.json index 8da39757..90ba52fb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -43,6 +43,7 @@ "winston": "^3.11.0" }, "devDependencies": { + "@gcornut/valibot-json-schema": "^0.42.0", "@playwright/test": "^1.39.0", "@testcontainers/localstack": "^10.7.2", "@types/node": "^20.8.9", @@ -50,6 +51,7 @@ "concurrently": "^8.2.2", "husky": "^9.0.11", "jsdom": "^24.1.0", + "json-schema-faker": "^0.5.6", "nodemon": "^3.0.1", "pluralize": "^8.0.0", "standard": "^17.1.0", @@ -1096,6 +1098,36 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, + "node_modules/@gcornut/valibot-json-schema": { + "version": "0.42.0", + "resolved": "https://registry.npmjs.org/@gcornut/valibot-json-schema/-/valibot-json-schema-0.42.0.tgz", + "integrity": "sha512-4Et4AN6wmqeA0PfU5Clkv/IS27wiefsWf6TemAZrb75uzkClYEFavim7SboeKwbll9Nbsn2Iv0LT/HS5H7orZg==", + "dev": true, + "dependencies": { + "valibot": "~0.42.0" + }, + "bin": { + "valibot-json-schema": "bin/index.js" + }, + "optionalDependencies": { + "@types/json-schema": ">= 7.0.14", + "esbuild-runner": ">= 2.2.2" + } + }, + "node_modules/@gcornut/valibot-json-schema/node_modules/valibot": { + "version": "0.42.1", + "resolved": "https://registry.npmjs.org/valibot/-/valibot-0.42.1.tgz", + "integrity": "sha512-3keXV29Ar5b//Hqi4MbSdV7lfVp6zuYLZuA9V1PvQUsXqogr+u5lvLPLk3A4f74VUXDnf/JfWMN6sB+koJ/FFw==", + "dev": true, + "peerDependencies": { + "typescript": ">=5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.14", "dev": true, @@ -4527,6 +4559,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/call-me-maybe": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.2.tgz", + "integrity": "sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==", + "dev": true + }, "node_modules/callsites": { "version": "3.1.0", "license": "MIT", @@ -6037,6 +6075,30 @@ "@esbuild/win32-x64": "0.21.5" } }, + "node_modules/esbuild-runner": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/esbuild-runner/-/esbuild-runner-2.2.2.tgz", + "integrity": "sha512-fRFVXcmYVmSmtYm2mL8RlUASt2TDkGh3uRcvHFOKNr/T58VrfVeKD9uT9nlgxk96u0LS0ehS/GY7Da/bXWKkhw==", + "dev": true, + "optional": true, + "dependencies": { + "source-map-support": "0.5.21", + "tslib": "2.4.0" + }, + "bin": { + "esr": "bin/esr.js" + }, + "peerDependencies": { + "esbuild": "*" + } + }, + "node_modules/esbuild-runner/node_modules/tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", + "dev": true, + "optional": true + }, "node_modules/escalade": { "version": "3.1.2", "license": "MIT", @@ -6609,6 +6671,19 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/esquery": { "version": "1.6.0", "dev": true, @@ -7068,6 +7143,12 @@ "node": ">= 6" } }, + "node_modules/format-util": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/format-util/-/format-util-1.0.5.tgz", + "integrity": "sha512-varLbTj0e0yVyRpqQhuWV+8hlePAgaoFRhNFj50BNjEIrw1/DphHSObtqwskVCPWNgzwPoQrZAbfa/SBiicNeg==", + "dev": true + }, "node_modules/formidable": { "version": "3.5.1", "dev": true, @@ -8744,6 +8825,53 @@ "dev": true, "license": "MIT" }, + "node_modules/json-schema-faker": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/json-schema-faker/-/json-schema-faker-0.5.6.tgz", + "integrity": "sha512-u/cFC26/GDxh2vPiAC8B8xVvpXAW+QYtG2mijEbKrimCk8IHtiwQBjCE8TwvowdhALWq9IcdIWZ+/8ocXvdL3Q==", + "dev": true, + "dependencies": { + "json-schema-ref-parser": "^6.1.0", + "jsonpath-plus": "^7.2.0" + }, + "bin": { + "jsf": "bin/gen.cjs" + } + }, + "node_modules/json-schema-ref-parser": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/json-schema-ref-parser/-/json-schema-ref-parser-6.1.0.tgz", + "integrity": "sha512-pXe9H1m6IgIpXmE5JSb8epilNTGsmTb2iPohAXpOdhqGFbQjNeHHsZxU+C8w6T81GZxSPFLeUoqDJmzxx5IGuw==", + "deprecated": "Please switch to @apidevtools/json-schema-ref-parser", + "dev": true, + "dependencies": { + "call-me-maybe": "^1.0.1", + "js-yaml": "^3.12.1", + "ono": "^4.0.11" + } + }, + "node_modules/json-schema-ref-parser/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/json-schema-ref-parser/node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, "node_modules/json-schema-traverse": { "version": "0.4.1", "dev": true, @@ -8779,6 +8907,15 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/jsonpath-plus": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/jsonpath-plus/-/jsonpath-plus-7.2.0.tgz", + "integrity": "sha512-zBfiUPM5nD0YZSBT/o/fbCUlCcepMIdP0CJZxM1+KgA4f2T206f6VAg9e7mX35+KlMaIc5qXW34f3BnwJ3w+RA==", + "dev": true, + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/jsonwebtoken": { "version": "9.0.2", "license": "MIT", @@ -9754,6 +9891,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/ono": { + "version": "4.0.11", + "resolved": "https://registry.npmjs.org/ono/-/ono-4.0.11.tgz", + "integrity": "sha512-jQ31cORBFE6td25deYeD80wxKBMj+zBmHTrVxnc6CKhx8gho6ipmWM5zj/oeoqioZ99yqBls9Z/9Nss7J26G2g==", + "dev": true, + "dependencies": { + "format-util": "^1.0.3" + } + }, "node_modules/open": { "version": "10.1.0", "dev": true, @@ -11791,6 +11937,12 @@ "node": ">=0.10.0" } }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true + }, "node_modules/ssh-remote-port-forward": { "version": "1.0.4", "dev": true, diff --git a/package.json b/package.json index b996559c..c7a4fa20 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "author": "", "license": "ISC", "devDependencies": { + "@gcornut/valibot-json-schema": "^0.42.0", "@playwright/test": "^1.39.0", "@testcontainers/localstack": "^10.7.2", "@types/node": "^20.8.9", @@ -45,6 +46,7 @@ "concurrently": "^8.2.2", "husky": "^9.0.11", "jsdom": "^24.1.0", + "json-schema-faker": "^0.5.6", "nodemon": "^3.0.1", "pluralize": "^8.0.0", "standard": "^17.1.0", diff --git a/src/routes/schemas.js b/src/routes/schemas.js index 1cfe837b..258ee427 100644 --- a/src/routes/schemas.js +++ b/src/routes/schemas.js @@ -30,7 +30,7 @@ export const StartPage = v.object({ * The values of this enum should match values of the 'status' column * in the query in `performanceDbApi.getLpaOverview()` */ -const datasetStatusEnum = { +export const datasetStatusEnum = { Live: 'Live', 'Needs fixing': 'Needs fixing', Warning: 'Warning', @@ -146,14 +146,14 @@ export const OrgIssueDetails = v.strictObject({ })), items: v.array(v.variant('type', [ v.strictObject({ - type: v.literal('item'), + type: v.literal('number'), number: v.integer(), href: v.string(), current: v.boolean() }), v.strictObject({ type: v.literal('ellipsis'), - ellipsis: v.boolean(), + ellipsis: v.literal(true), href: v.string() }) ])) diff --git a/src/views/organisations/issueDetails.html b/src/views/organisations/issueDetails.html index 08a2043e..72379f28 100644 --- a/src/views/organisations/issueDetails.html +++ b/src/views/organisations/issueDetails.html @@ -8,7 +8,7 @@ {% set serviceType = 'Submit'%} {% if issueEntitiesCount > 1 %} - {% set pageName %}{{organisation.name}} - {{dataset.name}} - Issues (Page {{entityNumber}} of {{issueEntitiesCount}}){% endset %} + {% set pageName %}{{organisation.name}} - {{dataset.name}} - Issues (Page {{pageNumber}} of {{issueEntitiesCount}}){% endset %} {% else %} {% set pageName %}{{organisation.name}} - {{dataset.name}} - Issues{% endset %} {%endif%} @@ -75,7 +75,7 @@ rows: entry.fields }) }} - {% if issueEntitiesCount > 1 %} + {% if pagination.items | length > 1 %} {{ govukPagination(pagination) }} {% endif %} diff --git a/src/views/organisations/overview.html b/src/views/organisations/overview.html index a0862a24..c38be7b1 100644 --- a/src/views/organisations/overview.html +++ b/src/views/organisations/overview.html @@ -69,24 +69,24 @@

Datasets