@planning-inspectorate/data-model 2.25.0 → 2.27.0

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.
Files changed (38) hide show
  1. package/docs/nsip-document.md +11 -9
  2. package/package.json +1 -1
  3. package/pins_data_model/models/model_appeal_document.py +1 -1
  4. package/pins_data_model/models/model_appeal_event.py +1 -1
  5. package/pins_data_model/models/model_appeal_event_estimate.py +1 -1
  6. package/pins_data_model/models/model_appeal_has.py +1 -1
  7. package/pins_data_model/models/model_appeal_representation.py +1 -1
  8. package/pins_data_model/models/model_appeal_s78.py +1 -1
  9. package/pins_data_model/models/model_dart_response.py +1 -1
  10. package/pins_data_model/models/model_entraid.py +1 -1
  11. package/pins_data_model/models/model_folder.py +1 -1
  12. package/pins_data_model/models/model_gettimesheets_response.py +1 -1
  13. package/pins_data_model/models/model_listed_building.py +1 -1
  14. package/pins_data_model/models/model_listed_buildings.py +1 -1
  15. package/pins_data_model/models/model_nsip_document.py +4 -2
  16. package/pins_data_model/models/model_nsip_exam_timetable.py +1 -1
  17. package/pins_data_model/models/model_nsip_invoice.py +1 -1
  18. package/pins_data_model/models/model_nsip_meeting.py +1 -1
  19. package/pins_data_model/models/model_nsip_project.py +1 -1
  20. package/pins_data_model/models/model_nsip_project_update.py +1 -1
  21. package/pins_data_model/models/model_nsip_representation.py +1 -1
  22. package/pins_data_model/models/model_nsip_subscription.py +1 -1
  23. package/pins_data_model/models/model_pins_inspector.py +1 -1
  24. package/pins_data_model/models/model_pins_lpa.py +1 -1
  25. package/pins_data_model/models/model_s51_advice.py +1 -1
  26. package/pins_data_model/models/model_service_user.py +1 -1
  27. package/schemas/commands/appeals-components/lpa-questionnaire-enforcement-common.schema.json +1 -13
  28. package/schemas/commands/appeals-components/lpa-questionnaire-enforcement.schema.json +17 -1
  29. package/schemas/nsip-document.schema.json +3 -1
  30. package/src/enums.cjs +3 -1
  31. package/src/enums.d.ts +3 -1
  32. package/src/enums.js +3 -1
  33. package/src/index.cjs +3 -1
  34. package/src/index.d.ts +1 -11
  35. package/src/lib/gen-types.js +71 -25
  36. package/src/schemas.d.ts +76 -9
  37. package/tests/appeals/commands/enforcement-listed-questionnaire.test.js +2 -5
  38. package/tests/appeals/commands/enforcement-questionnaire.test.js +2 -2
@@ -516,15 +516,17 @@ The location of the published document. Only applicable to documents which are p
516
516
 
517
517
  **enum**: the value of this property must be equal to one of the following values:
518
518
 
519
- | Value | Explanation |
520
- | :------------------------------- | :---------- |
521
- | `"not_redacted"` | |
522
- | `"redacted"` | |
523
- | `"awaiting_ai_redaction"` | |
524
- | `"ai_redaction_review_required"` | |
525
- | `"ai_redaction_failed"` | |
526
- | `"no_redaction_required"` | |
527
- | `null` | |
519
+ | Value | Explanation |
520
+ | :--------------------------------- | :---------- |
521
+ | `"not_redacted"` | |
522
+ | `"redacted"` | |
523
+ | `"awaiting_ai_redaction"` | |
524
+ | `"awaiting_ai_suggestions"` | |
525
+ | `"ai_suggestions_reviewed"` | |
526
+ | `"ai_suggestions_review_required"` | |
527
+ | `"ai_redaction_failed"` | |
528
+ | `"no_redaction_required"` | |
529
+ | `null` | |
528
530
 
529
531
  ## publishedStatus
530
532
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planning-inspectorate/data-model",
3
- "version": "2.25.0",
3
+ "version": "2.27.0",
4
4
  "description": "JSON Schemas for the Planning Inspectorate's Data Model",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: appeal-document.schema.json
3
- # timestamp: 2026-02-19T12:13:41+00:00
3
+ # timestamp: 2026-03-02T10:53:29+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
 
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: appeal-event.schema.json
3
- # timestamp: 2026-02-19T12:13:41+00:00
3
+ # timestamp: 2026-03-02T10:53:30+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
 
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: appeal-event-estimate.schema.json
3
- # timestamp: 2026-02-19T12:13:41+00:00
3
+ # timestamp: 2026-03-02T10:53:30+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
 
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: appeal-has.schema.json
3
- # timestamp: 2026-02-19T12:13:41+00:00
3
+ # timestamp: 2026-03-02T10:53:30+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
 
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: appeal-representation.schema.json
3
- # timestamp: 2026-02-19T12:13:41+00:00
3
+ # timestamp: 2026-03-02T10:53:30+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
 
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: appeal-s78.schema.json
3
- # timestamp: 2026-02-19T12:13:41+00:00
3
+ # timestamp: 2026-03-02T10:53:30+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
 
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: dart-response.schema.json
3
- # timestamp: 2026-02-19T12:13:41+00:00
3
+ # timestamp: 2026-03-02T10:53:30+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
 
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: entraid.schema.json
3
- # timestamp: 2026-02-19T12:13:41+00:00
3
+ # timestamp: 2026-03-02T10:53:30+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
 
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: folder.schema.json
3
- # timestamp: 2026-02-19T12:13:41+00:00
3
+ # timestamp: 2026-03-02T10:53:30+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
 
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: gettimesheets-response.schema.json
3
- # timestamp: 2026-02-19T12:13:41+00:00
3
+ # timestamp: 2026-03-02T10:53:30+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
 
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: listed-building.schema.json
3
- # timestamp: 2026-02-19T12:13:41+00:00
3
+ # timestamp: 2026-03-02T10:53:30+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
 
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: listed-buildings.schema.json
3
- # timestamp: 2026-02-19T12:13:41+00:00
3
+ # timestamp: 2026-03-02T10:53:30+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
 
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: nsip-document.schema.json
3
- # timestamp: 2026-02-19T12:13:41+00:00
3
+ # timestamp: 2026-03-02T10:53:30+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
 
@@ -26,7 +26,9 @@ class RedactedStatus(Enum):
26
26
  not_redacted = "not_redacted"
27
27
  redacted = "redacted"
28
28
  awaiting_ai_redaction = "awaiting_ai_redaction"
29
- ai_redaction_review_required = "ai_redaction_review_required"
29
+ awaiting_ai_suggestions = "awaiting_ai_suggestions"
30
+ ai_suggestions_reviewed = "ai_suggestions_reviewed"
31
+ ai_suggestions_review_required = "ai_suggestions_review_required"
30
32
  ai_redaction_failed = "ai_redaction_failed"
31
33
  no_redaction_required = "no_redaction_required"
32
34
  NoneType_None = None
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: nsip-exam-timetable.schema.json
3
- # timestamp: 2026-02-19T12:13:41+00:00
3
+ # timestamp: 2026-03-02T10:53:30+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
 
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: nsip-invoice.schema.json
3
- # timestamp: 2026-02-19T12:13:41+00:00
3
+ # timestamp: 2026-03-02T10:53:30+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
 
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: nsip-meeting.schema.json
3
- # timestamp: 2026-02-19T12:13:41+00:00
3
+ # timestamp: 2026-03-02T10:53:31+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
 
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: nsip-project.schema.json
3
- # timestamp: 2026-02-19T12:13:41+00:00
3
+ # timestamp: 2026-03-02T10:53:31+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
 
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: nsip-project-update.schema.json
3
- # timestamp: 2026-02-19T12:13:40+00:00
3
+ # timestamp: 2026-03-02T10:53:31+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
 
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: nsip-representation.schema.json
3
- # timestamp: 2026-02-19T12:13:41+00:00
3
+ # timestamp: 2026-03-02T10:53:31+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
 
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: nsip-subscription.schema.json
3
- # timestamp: 2026-02-19T12:13:41+00:00
3
+ # timestamp: 2026-03-02T10:53:31+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
 
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: pins-inspector.schema.json
3
- # timestamp: 2026-02-19T12:13:40+00:00
3
+ # timestamp: 2026-03-02T10:53:31+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
 
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: pins-lpa.schema.json
3
- # timestamp: 2026-02-19T12:13:40+00:00
3
+ # timestamp: 2026-03-02T10:53:31+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
 
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: s51-advice.schema.json
3
- # timestamp: 2026-02-19T12:13:41+00:00
3
+ # timestamp: 2026-03-02T10:53:31+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
 
@@ -1,6 +1,6 @@
1
1
  # generated by datamodel-codegen:
2
2
  # filename: service-user.schema.json
3
- # timestamp: 2026-02-19T12:13:41+00:00
3
+ # timestamp: 2026-03-02T10:53:31+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
 
@@ -1,16 +1,13 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
3
  "$id": "commands/appeals-components/lpa-questionnaire-enforcement-common.schema.json",
4
- "title": "LPAQ Enforcement submission properties",
4
+ "title": "LPAQ Enforcement common submission properties",
5
5
  "description": "Schema defining any common enforcement specific properties for LPAQ submissions",
6
6
  "type": "object",
7
7
  "additionalProperties": true,
8
8
  "required": [
9
9
  "noticeRelatesToBuildingEngineeringMiningOther",
10
10
  "siteAreaSquareMetres",
11
- "changeOfUseRefuseOrWaste",
12
- "changeOfUseMineralExtraction",
13
- "changeOfUseMineralStorage",
14
11
  "relatesToErectionOfBuildingOrBuildings",
15
12
  "relatesToBuildingWithAgriculturalPurpose",
16
13
  "relatesToBuildingSingleDwellingHouse"
@@ -36,15 +33,6 @@
36
33
  "examples": [45.7],
37
34
  "description": "Floor space created by the breach, in square meters"
38
35
  },
39
- "changeOfUseRefuseOrWaste": {
40
- "type": ["boolean", "null"]
41
- },
42
- "changeOfUseMineralExtraction": {
43
- "type": ["boolean", "null"]
44
- },
45
- "changeOfUseMineralStorage": {
46
- "type": ["boolean", "null"]
47
- },
48
36
  "relatesToErectionOfBuildingOrBuildings": {
49
37
  "type": ["boolean", "null"]
50
38
  },
@@ -5,7 +5,14 @@
5
5
  "description": "Schema defining any enforcement specific properties for LPAQ submissions",
6
6
  "type": "object",
7
7
  "additionalProperties": true,
8
- "required": ["affectedTrunkRoadName", "isSiteOnCrownLand", "article4AffectedDevelopmentRights"],
8
+ "required": [
9
+ "affectedTrunkRoadName",
10
+ "isSiteOnCrownLand",
11
+ "article4AffectedDevelopmentRights",
12
+ "changeOfUseRefuseOrWaste",
13
+ "changeOfUseMineralExtraction",
14
+ "changeOfUseMineralStorage"
15
+ ],
9
16
  "allOf": [
10
17
  {
11
18
  "properties": {
@@ -20,6 +27,15 @@
20
27
  "article4AffectedDevelopmentRights": {
21
28
  "type": ["string", "null"],
22
29
  "description": "What permitted develpoment rights are affected by the Article 4 Direction"
30
+ },
31
+ "changeOfUseRefuseOrWaste": {
32
+ "type": ["boolean", "null"]
33
+ },
34
+ "changeOfUseMineralExtraction": {
35
+ "type": ["boolean", "null"]
36
+ },
37
+ "changeOfUseMineralStorage": {
38
+ "type": ["boolean", "null"]
23
39
  }
24
40
  }
25
41
  }
@@ -133,7 +133,9 @@
133
133
  "not_redacted",
134
134
  "redacted",
135
135
  "awaiting_ai_redaction",
136
- "ai_redaction_review_required",
136
+ "awaiting_ai_suggestions",
137
+ "ai_suggestions_reviewed",
138
+ "ai_suggestions_review_required",
137
139
  "ai_redaction_failed",
138
140
  "no_redaction_required",
139
141
  null
package/src/enums.cjs CHANGED
@@ -630,8 +630,10 @@ const NSIP_RECOMMENDATION = Object.freeze({
630
630
 
631
631
  const NSIP_REDACTED_STATUS = Object.freeze({
632
632
  AI_REDACTION_FAILED: 'ai_redaction_failed',
633
- AI_REDACTION_REVIEW_REQUIRED: 'ai_redaction_review_required',
633
+ AI_SUGGESTIONS_REVIEW_REQUIRED: 'ai_suggestions_review_required',
634
+ AI_SUGGESTIONS_REVIEWED: 'ai_suggestions_reviewed',
634
635
  AWAITING_AI_REDACTION: 'awaiting_ai_redaction',
636
+ AWAITING_AI_SUGGESTIONS: 'awaiting_ai_suggestions',
635
637
  NO_REDACTION_REQUIRED: 'no_redaction_required',
636
638
  NOT_REDACTED: 'not_redacted',
637
639
  REDACTED: 'redacted',
package/src/enums.d.ts CHANGED
@@ -628,8 +628,10 @@ export const NSIP_RECOMMENDATION = {
628
628
 
629
629
  export const NSIP_REDACTED_STATUS = {
630
630
  AI_REDACTION_FAILED: 'ai_redaction_failed',
631
- AI_REDACTION_REVIEW_REQUIRED: 'ai_redaction_review_required',
631
+ AI_SUGGESTIONS_REVIEW_REQUIRED: 'ai_suggestions_review_required',
632
+ AI_SUGGESTIONS_REVIEWED: 'ai_suggestions_reviewed',
632
633
  AWAITING_AI_REDACTION: 'awaiting_ai_redaction',
634
+ AWAITING_AI_SUGGESTIONS: 'awaiting_ai_suggestions',
633
635
  NO_REDACTION_REQUIRED: 'no_redaction_required',
634
636
  NOT_REDACTED: 'not_redacted',
635
637
  REDACTED: 'redacted',
package/src/enums.js CHANGED
@@ -628,8 +628,10 @@ export const NSIP_RECOMMENDATION = Object.freeze({
628
628
 
629
629
  export const NSIP_REDACTED_STATUS = Object.freeze({
630
630
  AI_REDACTION_FAILED: 'ai_redaction_failed',
631
- AI_REDACTION_REVIEW_REQUIRED: 'ai_redaction_review_required',
631
+ AI_SUGGESTIONS_REVIEW_REQUIRED: 'ai_suggestions_review_required',
632
+ AI_SUGGESTIONS_REVIEWED: 'ai_suggestions_reviewed',
632
633
  AWAITING_AI_REDACTION: 'awaiting_ai_redaction',
634
+ AWAITING_AI_SUGGESTIONS: 'awaiting_ai_suggestions',
633
635
  NO_REDACTION_REQUIRED: 'no_redaction_required',
634
636
  NOT_REDACTED: 'not_redacted',
635
637
  REDACTED: 'redacted',
package/src/index.cjs CHANGED
@@ -711,8 +711,10 @@ const NSIP_RECOMMENDATION = Object.freeze({
711
711
 
712
712
  const NSIP_REDACTED_STATUS = Object.freeze({
713
713
  AI_REDACTION_FAILED: 'ai_redaction_failed',
714
- AI_REDACTION_REVIEW_REQUIRED: 'ai_redaction_review_required',
714
+ AI_SUGGESTIONS_REVIEW_REQUIRED: 'ai_suggestions_review_required',
715
+ AI_SUGGESTIONS_REVIEWED: 'ai_suggestions_reviewed',
715
716
  AWAITING_AI_REDACTION: 'awaiting_ai_redaction',
717
+ AWAITING_AI_SUGGESTIONS: 'awaiting_ai_suggestions',
716
718
  NO_REDACTION_REQUIRED: 'no_redaction_required',
717
719
  NOT_REDACTED: 'not_redacted',
718
720
  REDACTED: 'redacted',
package/src/index.d.ts CHANGED
@@ -1,17 +1,7 @@
1
1
  import * as Schemas from './schemas.js';
2
2
  export * from './enums.js';
3
3
 
4
- export interface LoadedSchemas {
5
- schemas: {
6
- [name: string]: any;
7
- };
8
- commands: {
9
- [name: string]: any;
10
- };
11
- appealsComponents: {
12
- [name: string]: any;
13
- };
14
- }
4
+ export type LoadedSchemas = Schemas.SchemaMap;
15
5
 
16
6
  export const schemasPath: string;
17
7
  export const commandsPath: string;
@@ -1,55 +1,101 @@
1
1
  import fs from 'fs/promises';
2
2
  import path from 'path';
3
3
  import url from 'url';
4
- import { loadAllSchemas } from '../index.js';
4
+ import { commandsPath, loadAllSchemas, schemasPath } from '../index.js';
5
5
  import { compile } from 'json-schema-to-typescript';
6
- import { schemasPath, commandsPath } from '../index.js';
6
+ import { generateName } from 'json-schema-to-typescript/dist/src/utils.js';
7
7
 
8
8
  const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
9
9
 
10
10
  export const typesPath = path.join(__dirname, '..', 'schemas.d.ts');
11
11
 
12
+ const schemaTypeNames = new Map();
13
+
12
14
  /**
13
15
  * Load all schemas and generate TypeScript definitions
14
16
  */
15
17
  async function run() {
16
18
  const s = await loadAllSchemas();
19
+ const schemaKeys = Object.keys(s.schemas).sort();
20
+ const commandKeys = Object.keys(s.commands).sort();
21
+ const appealsComponentKeys = Object.keys(s.appealsComponents).sort();
17
22
 
18
- let types = '';
19
- let first = true;
23
+ /** @type {string[]} */
24
+ const typeDefinitions = [];
25
+ const typesMap = {
26
+ schemas: {},
27
+ commands: {},
28
+ appealsComponents: {}
29
+ };
20
30
 
21
- for (const schemaName of Object.keys(s.schemas).sort()) {
22
- const schema = s.schemas[schemaName];
23
- types += await compile(schema, schema['$id'], options(first));
24
- types += '\n';
25
- first = false;
31
+ for (let i = 0; i < schemaKeys.length; i++) {
32
+ const schemaKey = schemaKeys[i];
33
+ const schema = s.schemas[schemaKey];
34
+ typeDefinitions.push(await compile(schema, schema['$id'], options(i === 0)));
35
+ typesMap.schemas[schemaKey] = schemaTypeName(schema, typeDefinitions);
26
36
  }
27
37
 
28
- for (const commandName of Object.keys(s.commands).sort()) {
29
- const schema = s.commands[commandName];
38
+ for (const schemaKey of commandKeys) {
39
+ const schema = s.commands[schemaKey];
40
+ typeDefinitions.push(await commandSchemaToTypeString(schema, schemaKey));
41
+ typesMap.commands[schemaKey] = schemaTypeName(schema, typeDefinitions);
42
+ }
30
43
 
31
- if (
32
- commandName.startsWith('appeal') ||
33
- commandName.startsWith('appellant') ||
34
- commandName.startsWith('lpa-questionnaire')
35
- ) {
36
- // hack to allow nested $ref links to function in tests and gen types,
37
- // can we leverage a better means to resolve $refs that aligns with how tests/appeals references this
38
- types += await compile(schema, schema['$id'], options(first, commandsPath));
39
- } else {
40
- types += await compile(schema, schema['$id'], options(first));
41
- }
44
+ for (const schemaKey of appealsComponentKeys) {
45
+ const schema = s.appealsComponents[schemaKey];
46
+ // no need to generate types, will be included by the schemas and commands
47
+ typesMap.appealsComponents[schemaKey] = schemaTypeName(schema, typeDefinitions);
48
+ }
42
49
 
43
- types += '\n';
44
- first = false;
50
+ let types = typeDefinitions.join('\n');
51
+ types += `\nexport type SchemaMap = {`;
52
+ for (const [k, map] of Object.entries(typesMap)) {
53
+ types += `\n ${k}: {\n `;
54
+ types += Object.entries(map)
55
+ .map(([a, b]) => `'${a}': ${b};`)
56
+ .join('\n ');
57
+ types += `\n }`;
45
58
  }
59
+ types += `\n};\n`;
46
60
 
47
61
  await fs.writeFile(typesPath, types);
48
62
  }
49
63
 
64
+ function commandSchemaToTypeString(schema, name) {
65
+ let refPath;
66
+ // hack to allow nested $ref links to function in tests and gen types,
67
+ // can we leverage a better means to resolve $refs that aligns with how tests/appeals references this
68
+ if (['appeal', 'appellant', 'lpa-questionnaire'].some((prefix) => name.startsWith(prefix))) {
69
+ refPath = commandsPath;
70
+ }
71
+ return compile(schema, schema['$id'], options(false, refPath));
72
+ }
73
+
74
+ /**
75
+ * @param {any} schema
76
+ * @param {string[]} types
77
+ * @returns {string}
78
+ */
79
+ function schemaTypeName(schema, types) {
80
+ const name = generateName(schema.title || schema['$id'], new Set());
81
+ if (schemaTypeNames.has(name)) {
82
+ throw new Error(
83
+ `Schema with type name ${name} already exists (schemas ${schema['$id']}, ${schemaTypeNames.get(name)})\nEnsure schema title fields are unique and match the ID`
84
+ );
85
+ }
86
+ // check the type name is in the generated types
87
+ if (
88
+ types.some((typeStr) => typeStr.includes(`export interface ${name}`) || typeStr.includes(`export type ${name}`))
89
+ ) {
90
+ schemaTypeNames.set(name, schema['$id']);
91
+ return name;
92
+ }
93
+ throw new Error(`${name} not found in type definition`);
94
+ }
95
+
50
96
  /**
51
- *
52
97
  * @param {boolean} first
98
+ * @param {string} [refPath]
53
99
  * @returns {Partial<import('json-schema-to-typescript').Options>}
54
100
  */
55
101
  function options(first, refPath = schemasPath) {
package/src/schemas.d.ts CHANGED
@@ -2153,7 +2153,9 @@ export interface NSIPDocument {
2153
2153
  | 'not_redacted'
2154
2154
  | 'redacted'
2155
2155
  | 'awaiting_ai_redaction'
2156
- | 'ai_redaction_review_required'
2156
+ | 'awaiting_ai_suggestions'
2157
+ | 'ai_suggestions_reviewed'
2158
+ | 'ai_suggestions_review_required'
2157
2159
  | 'ai_redaction_failed'
2158
2160
  | 'no_redaction_required'
2159
2161
  | null;
@@ -4615,7 +4617,7 @@ export type LPAQCasAdvertSubmissionProperties = {
4615
4617
  /**
4616
4618
  * Schema defining any common enforcement specific properties for LPAQ submissions
4617
4619
  */
4618
- export type LPAQEnforcementSubmissionProperties = {
4620
+ export type LPAQEnforcementCommonSubmissionProperties = {
4619
4621
  noticeRelatesToBuildingEngineeringMiningOther?: boolean | null;
4620
4622
  /**
4621
4623
  * The site area, in square meters
@@ -4629,9 +4631,6 @@ export type LPAQEnforcementSubmissionProperties = {
4629
4631
  * Floor space created by the breach, in square meters
4630
4632
  */
4631
4633
  floorSpaceCreatedByBreachInSquareMetres?: number | null;
4632
- changeOfUseRefuseOrWaste?: boolean | null;
4633
- changeOfUseMineralExtraction?: boolean | null;
4634
- changeOfUseMineralStorage?: boolean | null;
4635
4634
  relatesToErectionOfBuildingOrBuildings?: boolean | null;
4636
4635
  relatesToBuildingWithAgriculturalPurpose?: boolean | null;
4637
4636
  relatesToBuildingSingleDwellingHouse?: boolean | null;
@@ -4639,7 +4638,7 @@ export type LPAQEnforcementSubmissionProperties = {
4639
4638
  /**
4640
4639
  * Schema defining any enforcement specific properties for LPAQ submissions
4641
4640
  */
4642
- export type LPAQEnforcementSubmissionProperties1 = {
4641
+ export type LPAQEnforcementSubmissionProperties = {
4643
4642
  /**
4644
4643
  * Name of trunk road within 67M of site
4645
4644
  */
@@ -4649,6 +4648,9 @@ export type LPAQEnforcementSubmissionProperties1 = {
4649
4648
  * What permitted develpoment rights are affected by the Article 4 Direction
4650
4649
  */
4651
4650
  article4AffectedDevelopmentRights?: string | null;
4651
+ changeOfUseRefuseOrWaste?: boolean | null;
4652
+ changeOfUseMineralExtraction?: boolean | null;
4653
+ changeOfUseMineralStorage?: boolean | null;
4652
4654
  };
4653
4655
  /**
4654
4656
  * Schema defining any LDC specific properties for LPAQ submissions
@@ -4718,8 +4720,8 @@ export interface LPAQuestionnaireCommand {
4718
4720
  InfrastructureLevyProperties &
4719
4721
  EnvironmentalImpactAssessmentProperties &
4720
4722
  SiteDesignationsAndProtectionSpecificProperties &
4721
- LPAQEnforcementSubmissionProperties &
4722
- LPAQEnforcementSubmissionProperties1)
4723
+ LPAQEnforcementCommonSubmissionProperties &
4724
+ LPAQEnforcementSubmissionProperties)
4723
4725
  | ({
4724
4726
  caseType?: 'X';
4725
4727
  } & LPAQCommonSubmissionProperties &
@@ -4735,7 +4737,7 @@ export interface LPAQuestionnaireCommand {
4735
4737
  InfrastructureLevyProperties &
4736
4738
  EnvironmentalImpactAssessmentProperties &
4737
4739
  SiteDesignationsAndProtectionSpecificProperties &
4738
- LPAQEnforcementSubmissionProperties &
4740
+ LPAQEnforcementCommonSubmissionProperties &
4739
4741
  LPAQListedBuildingSubmissionProperties);
4740
4742
  documents: {
4741
4743
  /**
@@ -5057,3 +5059,68 @@ export interface InterestedParty1 {
5057
5059
  [k: string]: unknown;
5058
5060
  }
5059
5061
 
5062
+ export type SchemaMap = {
5063
+ schemas: {
5064
+ 'appeal-document.schema.json': AppealDocument;
5065
+ 'appeal-event-estimate.schema.json': AppealEventEstimate;
5066
+ 'appeal-event.schema.json': AppealEvent;
5067
+ 'appeal-has.schema.json': AppealHASCase;
5068
+ 'appeal-representation.schema.json': AppealRepresentation;
5069
+ 'appeal-s78.schema.json': AppealS78Case;
5070
+ 'dart-response.schema.json': DaRTAPIResponse;
5071
+ 'entraid.schema.json': EntraIDUserObjects;
5072
+ 'folder.schema.json': Folder;
5073
+ 'gettimesheets-response.schema.json': GetTimesheetsAPIResponse;
5074
+ 'listed-building.schema.json': ListedBuilding;
5075
+ 'listed-buildings.schema.json': ListedBuildings;
5076
+ 'nsip-document.schema.json': NSIPDocument;
5077
+ 'nsip-exam-timetable.schema.json': ExaminationTimetable;
5078
+ 'nsip-invoice.schema.json': NSIPInvoice;
5079
+ 'nsip-meeting.schema.json': NSIPMeeting;
5080
+ 'nsip-project-update.schema.json': NSIPProjectUpdate;
5081
+ 'nsip-project.schema.json': NSIPProject;
5082
+ 'nsip-representation.schema.json': Representation;
5083
+ 'nsip-subscription.schema.json': NsipSubscription;
5084
+ 'pins-inspector.schema.json': PINSInspector;
5085
+ 'pins-lpa.schema.json': PINSLPA;
5086
+ 's51-advice.schema.json': S51Advice;
5087
+ 'service-user.schema.json': ServiceUser;
5088
+ }
5089
+ commands: {
5090
+ 'appeal-representation-submission.schema.json': AppealRepresentationSubmission;
5091
+ 'appellant-submission.schema.json': AppellantSubmissionCommand;
5092
+ 'interested-party.schema.json': InterestedParty;
5093
+ 'lpa-questionnaire.schema.json': LPAQuestionnaireCommand;
5094
+ 'new-deadline-submission.schema.json': NewDeadlineSubmission;
5095
+ 'nsip-exam-timetable-submission.schema.json': NsipExamTimetableSubmission;
5096
+ 'register-nsip-subscription.schema.json': RegisterNsipSubscription;
5097
+ 'register-representation.schema.json': RegisterRepresentation;
5098
+ }
5099
+ appealsComponents: {
5100
+ 'appeal-advert.submission.schema.json': AdvertSpecificProperties;
5101
+ 'appeal-common-planning.schema.json': AppellantCommonPlanningProperties;
5102
+ 'appeal-common-submission.schema.json': AppellantCommonSubmissionProperties;
5103
+ 'appeal-enforcement-common-submission.schema.json': AppellantEnforcementCommonSubmissionProperties;
5104
+ 'appeal-enforcement-listed-submission.schema.json': AppellantEnforcementListedBuildingSubmissionProperties;
5105
+ 'appeal-enforcement-notice-submission.schema.json': AppellantEnforcementNoticeSpecificSubmissionProperties;
5106
+ 'appeal-land-ownership.schema.json': AppealLandOwnershipProperties;
5107
+ 'appeal-ldc.submission.schema.json': LDCSpecificProperties;
5108
+ 'appeal-planning-obligation.submission.schema.json': PlanningObligationSpecificProperties;
5109
+ 'appeal-s78-submission.schema.json': AppellantS78SubmissionProperties;
5110
+ 'appeal-site-area.schema.json': SiteAreaProperties;
5111
+ 'appellant-procedure-preference.schema.json': AppellantProcedurePreferenceProperties;
5112
+ 'changed-listed-building-number.schema.json': ChangedListedBuildingNumbersProperties;
5113
+ 'environmental-impact-assessment.schema.json': EnvironmentalImpactAssessmentProperties;
5114
+ 'infrastructure-levy.schema.json': InfrastructureLevyProperties;
5115
+ 'lpa-procedure-preference.schema.json': LPAProcedurePreferenceProperties;
5116
+ 'lpa-questionnaire-advert.schema.json': LPAQCasAdvertSubmissionProperties;
5117
+ 'lpa-questionnaire-common.schema.json': LPAQCommonSubmissionProperties;
5118
+ 'lpa-questionnaire-enforcement-common.schema.json': LPAQEnforcementCommonSubmissionProperties;
5119
+ 'lpa-questionnaire-enforcement.schema.json': LPAQEnforcementSubmissionProperties;
5120
+ 'lpa-questionnaire-has.schema.json': LPAQHASSubmissionProperties;
5121
+ 'lpa-questionnaire-ldc.schema.json': LPAQLDCSubmissionProperties;
5122
+ 'lpa-questionnaire-listed-building.schema.json': LPAQListedBuildingSubmissionProperties;
5123
+ 'lpa-questionnaire-s78.schema.json': LPAQS78SubmissionProperties;
5124
+ 'site-designations-protection.schema.json': SiteDesignationsAndProtectionSpecificProperties;
5125
+ }
5126
+ };
@@ -63,11 +63,8 @@ const exampleEnforcementListedQuestionnaireSchema = {
63
63
  lpaProcedurePreferenceDuration: -34480053.16630782,
64
64
  noticeRelatesToBuildingEngineeringMiningOther: null,
65
65
  siteAreaSquareMetres: null,
66
- hasAllegedBreachArea: null,
67
- doesAllegedBreachCreateFloorSpace: null,
68
- changeOfUseRefuseOrWaste: null,
69
- changeOfUseMineralExtraction: null,
70
- changeOfUseMineralStorage: null,
66
+ areaOfAllegedBreachInSquareMetres: null,
67
+ floorSpaceCreatedByBreachInSquareMetres: null,
71
68
  relatesToErectionOfBuildingOrBuildings: null,
72
69
  relatesToBuildingWithAgriculturalPurpose: null,
73
70
  relatesToBuildingSingleDwellingHouse: null,
@@ -63,8 +63,8 @@ const exampleEnforcementQuestionnaireSchema = {
63
63
  lpaProcedurePreferenceDuration: -34480053.16630782,
64
64
  noticeRelatesToBuildingEngineeringMiningOther: null,
65
65
  siteAreaSquareMetres: null,
66
- hasAllegedBreachArea: null,
67
- doesAllegedBreachCreateFloorSpace: null,
66
+ areaOfAllegedBreachInSquareMetres: null,
67
+ floorSpaceCreatedByBreachInSquareMetres: null,
68
68
  changeOfUseRefuseOrWaste: null,
69
69
  changeOfUseMineralExtraction: null,
70
70
  changeOfUseMineralStorage: null,