@planning-inspectorate/data-model 2.48.0 → 2.49.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.
@@ -17,7 +17,7 @@ any of
17
17
  | [submissionId](#submissionid) | `string` | Optional | can be null | [Appeal HAS Case](appeal-has-properties-submissionid.md "appeal-has.schema.json#/properties/submissionId") |
18
18
  | [caseStatus](#casestatus) | `string` | Required | cannot be null | [Appeal HAS Case](appeal-has-properties-casestatus.md "appeal-has.schema.json#/properties/caseStatus") |
19
19
  | [caseType](#casetype) | `string` | Required | cannot be null | [Appeal HAS Case](appeal-has-properties-casetype.md "appeal-has.schema.json#/properties/caseType") |
20
- | [caseProcedure](#caseprocedure) | `string` | Required | cannot be null | [Appeal HAS Case](appeal-has-properties-caseprocedure.md "appeal-has.schema.json#/properties/caseProcedure") |
20
+ | [caseProcedure](#caseprocedure) | `string` | Required | can be null | [Appeal HAS Case](appeal-has-properties-caseprocedure.md "appeal-has.schema.json#/properties/caseProcedure") |
21
21
  | [lpaCode](#lpacode) | `string` | Required | cannot be null | [Appeal HAS Case](appeal-has-properties-lpacode.md "appeal-has.schema.json#/properties/lpaCode") |
22
22
  | [caseOfficerId](#caseofficerid) | `string` | Required | can be null | [Appeal HAS Case](appeal-has-properties-caseofficerid.md "appeal-has.schema.json#/properties/caseOfficerId") |
23
23
  | [inspectorId](#inspectorid) | `string` | Required | can be null | [Appeal HAS Case](appeal-has-properties-inspectorid.md "appeal-has.schema.json#/properties/inspectorId") |
@@ -287,7 +287,7 @@ The type of procedure for the appeal
287
287
 
288
288
  * Type: `string`
289
289
 
290
- * cannot be null
290
+ * can be null
291
291
 
292
292
  * defined in: [Appeal HAS Case](appeal-has-properties-caseprocedure.md "appeal-has.schema.json#/properties/caseProcedure")
293
293
 
@@ -299,11 +299,14 @@ The type of procedure for the appeal
299
299
 
300
300
  **enum**: the value of this property must be equal to one of the following values:
301
301
 
302
- | Value | Explanation |
303
- | :---------- | :---------- |
304
- | `"written"` | |
305
- | `"hearing"` | |
306
- | `"inquiry"` | |
302
+ | Value | Explanation |
303
+ | :--------------- | :---------- |
304
+ | `"written"` | |
305
+ | `"hearing"` | |
306
+ | `"inquiry"` | |
307
+ | `"writtenPart1"` | |
308
+ | `"writtenPart2"` | |
309
+ | `null` | |
307
310
 
308
311
  ## lpaCode
309
312
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planning-inspectorate/data-model",
3
- "version": "2.48.0",
3
+ "version": "2.49.0",
4
4
  "description": "JSON Schemas for the Planning Inspectorate's Data Model",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -59,6 +59,9 @@ class CaseProcedure(Enum):
59
59
  written = "written"
60
60
  hearing = "hearing"
61
61
  inquiry = "inquiry"
62
+ writtenPart1 = "writtenPart1"
63
+ writtenPart2 = "writtenPart2"
64
+ NoneType_None = None
62
65
 
63
66
 
64
67
  class AllocationLevel(Enum):
@@ -135,8 +135,8 @@
135
135
  "description": "The internal code for an appeal type, e.g. D (Householder)"
136
136
  },
137
137
  "caseProcedure": {
138
- "type": "string",
139
- "enum": ["written", "hearing", "inquiry"],
138
+ "type": ["string", "null"],
139
+ "enum": ["written", "hearing", "inquiry", "writtenPart1", "writtenPart2", null],
140
140
  "description": "The type of procedure for the appeal"
141
141
  },
142
142
  "lpaCode": {
package/src/enums.cjs CHANGED
@@ -7,12 +7,6 @@ const APPEAL_HAS_CASE_DECISION_OUTCOME = Object.freeze({
7
7
  SPLIT_DECISION: 'split_decision',
8
8
  });
9
9
 
10
- const APPEAL_HAS_CASE_PROCEDURE = Object.freeze({
11
- HEARING: 'hearing',
12
- INQUIRY: 'inquiry',
13
- WRITTEN: 'written',
14
- });
15
-
16
10
  const APPEAL_HAS_CASE_STATUS = Object.freeze({
17
11
  ASSIGN_CASE_OFFICER: 'assign_case_officer',
18
12
  AWAITING_EVENT: 'awaiting_event',
@@ -43,6 +37,12 @@ const APPEAL_HAS_TYPE_OF_PLANNING_APPLICATION = Object.freeze({
43
37
  RESERVED_MATTERS: 'reserved-matters',
44
38
  });
45
39
 
40
+ const APPEAL_UNDER_ACT_SECTION = Object.freeze({
41
+ EXISTING_DEVELOPMENT: 'existing-development',
42
+ PROPOSED_CHANGES_TO_A_LISTED_BUILDING: 'proposed-changes-to-a-listed-building',
43
+ PROPOSED_USE_OF_A_DEVELOPMENT: 'proposed-use-of-a-development',
44
+ });
45
+
46
46
  const APPEAL_ALLOCATION_LEVEL = Object.freeze({
47
47
  A: 'A',
48
48
  B: 'B',
@@ -54,12 +54,6 @@ const APPEAL_ALLOCATION_LEVEL = Object.freeze({
54
54
  H: 'H',
55
55
  });
56
56
 
57
- const APPEAL_APPEAL_UNDER_ACT_SECTION = Object.freeze({
58
- EXISTING_DEVELOPMENT: 'existing-development',
59
- PROPOSED_CHANGES_TO_A_LISTED_BUILDING: 'proposed-changes-to-a-listed-building',
60
- PROPOSED_USE_OF_A_DEVELOPMENT: 'proposed-use-of-a-development',
61
- });
62
-
63
57
  const APPEAL_APPELLANT_PROCEDURE_PREFERENCE = Object.freeze({
64
58
  HEARING: 'hearing',
65
59
  INQUIRY: 'inquiry',
@@ -831,6 +825,9 @@ const STATUS = Object.freeze({
831
825
  UNCHECKED: 'unchecked',
832
826
  });
833
827
 
828
+ /** @deprecated use APPEAL_UNDER_ACT_SECTION **/
829
+ const APPEAL_APPEAL_UNDER_ACT_SECTION = APPEAL_UNDER_ACT_SECTION;
830
+
834
831
  exports.APPEAL_ALLOCATION_LEVEL = APPEAL_ALLOCATION_LEVEL;
835
832
  exports.APPEAL_APPEAL_UNDER_ACT_SECTION = APPEAL_APPEAL_UNDER_ACT_SECTION;
836
833
  exports.APPEAL_APPELLANT_PROCEDURE_PREFERENCE = APPEAL_APPELLANT_PROCEDURE_PREFERENCE;
@@ -851,7 +848,6 @@ exports.APPEAL_EIA_ENVIRONMENTAL_IMPACT_SCHEDULE = APPEAL_EIA_ENVIRONMENTAL_IMPA
851
848
  exports.APPEAL_EVENT_STATUS = APPEAL_EVENT_STATUS;
852
849
  exports.APPEAL_EVENT_TYPE = APPEAL_EVENT_TYPE;
853
850
  exports.APPEAL_HAS_CASE_DECISION_OUTCOME = APPEAL_HAS_CASE_DECISION_OUTCOME;
854
- exports.APPEAL_HAS_CASE_PROCEDURE = APPEAL_HAS_CASE_PROCEDURE;
855
851
  exports.APPEAL_HAS_CASE_STATUS = APPEAL_HAS_CASE_STATUS;
856
852
  exports.APPEAL_HAS_TYPE_OF_PLANNING_APPLICATION = APPEAL_HAS_TYPE_OF_PLANNING_APPLICATION;
857
853
  exports.APPEAL_INVALID_OR_INCOMPLETE_DETAILS = APPEAL_INVALID_OR_INCOMPLETE_DETAILS;
@@ -868,6 +864,7 @@ exports.APPEAL_REPRESENTATION_TYPE = APPEAL_REPRESENTATION_TYPE;
868
864
  exports.APPEAL_SOURCE = APPEAL_SOURCE;
869
865
  exports.APPEAL_SOURCE_SYSTEM = APPEAL_SOURCE_SYSTEM;
870
866
  exports.APPEAL_TYPE_OF_PLANNING_APPLICATION = APPEAL_TYPE_OF_PLANNING_APPLICATION;
867
+ exports.APPEAL_UNDER_ACT_SECTION = APPEAL_UNDER_ACT_SECTION;
871
868
  exports.APPEAL_VIRUS_CHECK_STATUS = APPEAL_VIRUS_CHECK_STATUS;
872
869
  exports.APPLICATION_UPDATE_STATUS = APPLICATION_UPDATE_STATUS;
873
870
  exports.CASE_STAGE = CASE_STAGE;
package/src/enums.d.ts CHANGED
@@ -5,12 +5,6 @@ export const APPEAL_HAS_CASE_DECISION_OUTCOME = {
5
5
  SPLIT_DECISION: 'split_decision',
6
6
  } as const;
7
7
 
8
- export const APPEAL_HAS_CASE_PROCEDURE = {
9
- HEARING: 'hearing',
10
- INQUIRY: 'inquiry',
11
- WRITTEN: 'written',
12
- } as const;
13
-
14
8
  export const APPEAL_HAS_CASE_STATUS = {
15
9
  ASSIGN_CASE_OFFICER: 'assign_case_officer',
16
10
  AWAITING_EVENT: 'awaiting_event',
@@ -41,6 +35,12 @@ export const APPEAL_HAS_TYPE_OF_PLANNING_APPLICATION = {
41
35
  RESERVED_MATTERS: 'reserved-matters',
42
36
  } as const;
43
37
 
38
+ export const APPEAL_UNDER_ACT_SECTION = {
39
+ EXISTING_DEVELOPMENT: 'existing-development',
40
+ PROPOSED_CHANGES_TO_A_LISTED_BUILDING: 'proposed-changes-to-a-listed-building',
41
+ PROPOSED_USE_OF_A_DEVELOPMENT: 'proposed-use-of-a-development',
42
+ } as const;
43
+
44
44
  export const APPEAL_ALLOCATION_LEVEL = {
45
45
  A: 'A',
46
46
  B: 'B',
@@ -52,12 +52,6 @@ export const APPEAL_ALLOCATION_LEVEL = {
52
52
  H: 'H',
53
53
  } as const;
54
54
 
55
- export const APPEAL_APPEAL_UNDER_ACT_SECTION = {
56
- EXISTING_DEVELOPMENT: 'existing-development',
57
- PROPOSED_CHANGES_TO_A_LISTED_BUILDING: 'proposed-changes-to-a-listed-building',
58
- PROPOSED_USE_OF_A_DEVELOPMENT: 'proposed-use-of-a-development',
59
- } as const;
60
-
61
55
  export const APPEAL_APPELLANT_PROCEDURE_PREFERENCE = {
62
56
  HEARING: 'hearing',
63
57
  INQUIRY: 'inquiry',
@@ -829,3 +823,5 @@ export const STATUS = {
829
823
  UNCHECKED: 'unchecked',
830
824
  } as const;
831
825
 
826
+ /** @deprecated use APPEAL_UNDER_ACT_SECTION **/
827
+ export const APPEAL_APPEAL_UNDER_ACT_SECTION = APPEAL_UNDER_ACT_SECTION;
package/src/enums.js CHANGED
@@ -5,12 +5,6 @@ export const APPEAL_HAS_CASE_DECISION_OUTCOME = Object.freeze({
5
5
  SPLIT_DECISION: 'split_decision',
6
6
  });
7
7
 
8
- export const APPEAL_HAS_CASE_PROCEDURE = Object.freeze({
9
- HEARING: 'hearing',
10
- INQUIRY: 'inquiry',
11
- WRITTEN: 'written',
12
- });
13
-
14
8
  export const APPEAL_HAS_CASE_STATUS = Object.freeze({
15
9
  ASSIGN_CASE_OFFICER: 'assign_case_officer',
16
10
  AWAITING_EVENT: 'awaiting_event',
@@ -41,6 +35,12 @@ export const APPEAL_HAS_TYPE_OF_PLANNING_APPLICATION = Object.freeze({
41
35
  RESERVED_MATTERS: 'reserved-matters',
42
36
  });
43
37
 
38
+ export const APPEAL_UNDER_ACT_SECTION = Object.freeze({
39
+ EXISTING_DEVELOPMENT: 'existing-development',
40
+ PROPOSED_CHANGES_TO_A_LISTED_BUILDING: 'proposed-changes-to-a-listed-building',
41
+ PROPOSED_USE_OF_A_DEVELOPMENT: 'proposed-use-of-a-development',
42
+ });
43
+
44
44
  export const APPEAL_ALLOCATION_LEVEL = Object.freeze({
45
45
  A: 'A',
46
46
  B: 'B',
@@ -52,12 +52,6 @@ export const APPEAL_ALLOCATION_LEVEL = Object.freeze({
52
52
  H: 'H',
53
53
  });
54
54
 
55
- export const APPEAL_APPEAL_UNDER_ACT_SECTION = Object.freeze({
56
- EXISTING_DEVELOPMENT: 'existing-development',
57
- PROPOSED_CHANGES_TO_A_LISTED_BUILDING: 'proposed-changes-to-a-listed-building',
58
- PROPOSED_USE_OF_A_DEVELOPMENT: 'proposed-use-of-a-development',
59
- });
60
-
61
55
  export const APPEAL_APPELLANT_PROCEDURE_PREFERENCE = Object.freeze({
62
56
  HEARING: 'hearing',
63
57
  INQUIRY: 'inquiry',
@@ -829,3 +823,5 @@ export const STATUS = Object.freeze({
829
823
  UNCHECKED: 'unchecked',
830
824
  });
831
825
 
826
+ /** @deprecated use APPEAL_UNDER_ACT_SECTION **/
827
+ export const APPEAL_APPEAL_UNDER_ACT_SECTION = APPEAL_UNDER_ACT_SECTION;
package/src/index.cjs CHANGED
@@ -88,12 +88,6 @@ const APPEAL_HAS_CASE_DECISION_OUTCOME = Object.freeze({
88
88
  SPLIT_DECISION: 'split_decision',
89
89
  });
90
90
 
91
- const APPEAL_HAS_CASE_PROCEDURE = Object.freeze({
92
- HEARING: 'hearing',
93
- INQUIRY: 'inquiry',
94
- WRITTEN: 'written',
95
- });
96
-
97
91
  const APPEAL_HAS_CASE_STATUS = Object.freeze({
98
92
  ASSIGN_CASE_OFFICER: 'assign_case_officer',
99
93
  AWAITING_EVENT: 'awaiting_event',
@@ -124,6 +118,12 @@ const APPEAL_HAS_TYPE_OF_PLANNING_APPLICATION = Object.freeze({
124
118
  RESERVED_MATTERS: 'reserved-matters',
125
119
  });
126
120
 
121
+ const APPEAL_UNDER_ACT_SECTION = Object.freeze({
122
+ EXISTING_DEVELOPMENT: 'existing-development',
123
+ PROPOSED_CHANGES_TO_A_LISTED_BUILDING: 'proposed-changes-to-a-listed-building',
124
+ PROPOSED_USE_OF_A_DEVELOPMENT: 'proposed-use-of-a-development',
125
+ });
126
+
127
127
  const APPEAL_ALLOCATION_LEVEL = Object.freeze({
128
128
  A: 'A',
129
129
  B: 'B',
@@ -135,12 +135,6 @@ const APPEAL_ALLOCATION_LEVEL = Object.freeze({
135
135
  H: 'H',
136
136
  });
137
137
 
138
- const APPEAL_APPEAL_UNDER_ACT_SECTION = Object.freeze({
139
- EXISTING_DEVELOPMENT: 'existing-development',
140
- PROPOSED_CHANGES_TO_A_LISTED_BUILDING: 'proposed-changes-to-a-listed-building',
141
- PROPOSED_USE_OF_A_DEVELOPMENT: 'proposed-use-of-a-development',
142
- });
143
-
144
138
  const APPEAL_APPELLANT_PROCEDURE_PREFERENCE = Object.freeze({
145
139
  HEARING: 'hearing',
146
140
  INQUIRY: 'inquiry',
@@ -912,6 +906,9 @@ const STATUS = Object.freeze({
912
906
  UNCHECKED: 'unchecked',
913
907
  });
914
908
 
909
+ /** @deprecated use APPEAL_UNDER_ACT_SECTION **/
910
+ const APPEAL_APPEAL_UNDER_ACT_SECTION = APPEAL_UNDER_ACT_SECTION;
911
+
915
912
  const __dirname$1 = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
916
913
 
917
914
  const schemasPath = path.join(__dirname$1, '..', 'schemas');
@@ -964,7 +961,6 @@ exports.APPEAL_EIA_ENVIRONMENTAL_IMPACT_SCHEDULE = APPEAL_EIA_ENVIRONMENTAL_IMPA
964
961
  exports.APPEAL_EVENT_STATUS = APPEAL_EVENT_STATUS;
965
962
  exports.APPEAL_EVENT_TYPE = APPEAL_EVENT_TYPE;
966
963
  exports.APPEAL_HAS_CASE_DECISION_OUTCOME = APPEAL_HAS_CASE_DECISION_OUTCOME;
967
- exports.APPEAL_HAS_CASE_PROCEDURE = APPEAL_HAS_CASE_PROCEDURE;
968
964
  exports.APPEAL_HAS_CASE_STATUS = APPEAL_HAS_CASE_STATUS;
969
965
  exports.APPEAL_HAS_TYPE_OF_PLANNING_APPLICATION = APPEAL_HAS_TYPE_OF_PLANNING_APPLICATION;
970
966
  exports.APPEAL_INVALID_OR_INCOMPLETE_DETAILS = APPEAL_INVALID_OR_INCOMPLETE_DETAILS;
@@ -981,6 +977,7 @@ exports.APPEAL_REPRESENTATION_TYPE = APPEAL_REPRESENTATION_TYPE;
981
977
  exports.APPEAL_SOURCE = APPEAL_SOURCE;
982
978
  exports.APPEAL_SOURCE_SYSTEM = APPEAL_SOURCE_SYSTEM;
983
979
  exports.APPEAL_TYPE_OF_PLANNING_APPLICATION = APPEAL_TYPE_OF_PLANNING_APPLICATION;
980
+ exports.APPEAL_UNDER_ACT_SECTION = APPEAL_UNDER_ACT_SECTION;
984
981
  exports.APPEAL_VIRUS_CHECK_STATUS = APPEAL_VIRUS_CHECK_STATUS;
985
982
  exports.APPLICATION_UPDATE_STATUS = APPLICATION_UPDATE_STATUS;
986
983
  exports.CASE_STAGE = CASE_STAGE;
@@ -57,7 +57,10 @@ export function generateEnumMap(enums) {
57
57
 
58
58
  for (const e of enums) {
59
59
  const prefix = schemaPrefix(e.schemaName);
60
- const key = prefix ? prefix + '_' + e.key : e.key;
60
+ let key = e.key;
61
+ if (prefix && !key.startsWith(prefix)) {
62
+ key = prefix + '_' + key;
63
+ }
61
64
 
62
65
  const existingEnum = enumProps[key];
63
66
  const thisEnum = e.values;
@@ -187,6 +190,9 @@ export function schemaPrefix(schemaName) {
187
190
  if (schemaName === 'message') {
188
191
  return 'message';
189
192
  }
193
+ if (schemaName.toLowerCase().includes('applications')) {
194
+ return 'application';
195
+ }
190
196
  if (schemaName.toLowerCase().includes('appeal')) {
191
197
  return 'appeal';
192
198
  }
@@ -37,6 +37,11 @@ async function run() {
37
37
  tsOutput += generateConstants(name, enumProps[name], { ts: true }) + NEW_LINE.repeat(2);
38
38
  }
39
39
 
40
+ // for backwards compatibility, to remove once APPEAL_APPEAL_UNDER_ACT_SECTION isn't referenced
41
+ const forCompatibility = `/** @deprecated use APPEAL_UNDER_ACT_SECTION **/${NEW_LINE}export const APPEAL_APPEAL_UNDER_ACT_SECTION = APPEAL_UNDER_ACT_SECTION;`;
42
+ output += forCompatibility;
43
+ tsOutput += forCompatibility;
44
+
40
45
  await fs.writeFile(constPath, output);
41
46
  await fs.writeFile(constTsPath, tsOutput);
42
47
  }
package/src/schemas.d.ts CHANGED
@@ -381,7 +381,7 @@ export type AppealHASCase = (GridReference | SiteAddress) & {
381
381
  /**
382
382
  * The type of procedure for the appeal
383
383
  */
384
- caseProcedure: 'written' | 'hearing' | 'inquiry';
384
+ caseProcedure: 'written' | 'hearing' | 'inquiry' | 'writtenPart1' | 'writtenPart2' | null;
385
385
  /**
386
386
  * A unique identifier for the Local Planning Authority
387
387
  */
@@ -329,4 +329,38 @@ describe(schema, () => {
329
329
  const validationResult = ajv.validate(schema, test);
330
330
  assert.strictEqual(validationResult, true);
331
331
  });
332
+
333
+ describe('caseProcedure schema validation (Group A - HAS)', () => {
334
+ it('should accept existing values: written, hearing, inquiry', () => {
335
+ for (const proc of ['written', 'hearing', 'inquiry']) {
336
+ const test = structuredClone(appealHas);
337
+ test.caseProcedure = proc;
338
+ const validationResult = ajv.validate(schema, test);
339
+ assert.strictEqual(validationResult, true, `Expected caseProcedure "${proc}" to be valid`);
340
+ }
341
+ });
342
+
343
+ it('should accept new expedited appeal values: writtenPart1, writtenPart2', () => {
344
+ for (const proc of ['writtenPart1', 'writtenPart2']) {
345
+ const test = structuredClone(appealHas);
346
+ test.caseProcedure = proc;
347
+ const validationResult = ajv.validate(schema, test);
348
+ assert.strictEqual(validationResult, true, `Expected caseProcedure "${proc}" to be valid`);
349
+ }
350
+ });
351
+
352
+ it('should accept null value for caseProcedure', () => {
353
+ const test = structuredClone(appealHas);
354
+ test.caseProcedure = null;
355
+ const validationResult = ajv.validate(schema, test);
356
+ assert.strictEqual(validationResult, true, 'Expected caseProcedure null to be valid');
357
+ });
358
+
359
+ it('should reject invalid caseProcedure values', () => {
360
+ const test = structuredClone(appealHas);
361
+ test.caseProcedure = 'invalidProcedure';
362
+ const validationResult = ajv.validate(schema, test);
363
+ assert.strictEqual(validationResult, false, 'Expected invalid caseProcedure value to fail validation');
364
+ });
365
+ });
332
366
  });
@@ -72,6 +72,7 @@ describe('schemas', () => {
72
72
  it('should use the singular form for $id', () => {
73
73
  // very crude test to ensure schemas don't end in 's'...
74
74
  const suffixExceptions = [
75
+ 'address',
75
76
  'has', // allow has suffix for appeals
76
77
  'listed-buildings' // allow this temporary schema, to remove when this schema copy is removed
77
78
  ];