@pdtf/schemas 3.6.0-dev.7 → 3.6.0-dev.8

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 (130) hide show
  1. package/busy-spence-79c6bf/CLAUDE.md +101 -0
  2. package/busy-spence-79c6bf/LICENSE +21 -0
  3. package/busy-spence-79c6bf/README.md +435 -0
  4. package/busy-spence-79c6bf/docs/branch-release-workflow.md +138 -0
  5. package/busy-spence-79c6bf/docs/sef25-extensions-ui-spec.md +355 -0
  6. package/busy-spence-79c6bf/index.js +654 -0
  7. package/busy-spence-79c6bf/package-lock.json +7299 -0
  8. package/busy-spence-79c6bf/package.json +44 -0
  9. package/busy-spence-79c6bf/scripts/ta6ed6-titles.js +403 -0
  10. package/busy-spence-79c6bf/scripts/ta7ed5-titles.js +183 -0
  11. package/busy-spence-79c6bf/src/examples/v1/exampleAddParticipantVouch.json +32 -0
  12. package/busy-spence-79c6bf/src/examples/v1/exampleDocumentedVouch.json +40 -0
  13. package/busy-spence-79c6bf/src/examples/v1/exampleElectronicRecord.json +30 -0
  14. package/busy-spence-79c6bf/src/examples/v1/exampleTransaction.json +878 -0
  15. package/busy-spence-79c6bf/src/examples/v1/exampleVouch.json +25 -0
  16. package/busy-spence-79c6bf/src/examples/v2/exampleTransaction.json +901 -0
  17. package/busy-spence-79c6bf/src/examples/v3/exampleAddParticipantVouch.json +38 -0
  18. package/busy-spence-79c6bf/src/examples/v3/exampleCustomOverlay.json +55 -0
  19. package/busy-spence-79c6bf/src/examples/v3/exampleCustomOverlay2.json +93 -0
  20. package/busy-spence-79c6bf/src/examples/v3/exampleDocumentedVouch.json +47 -0
  21. package/busy-spence-79c6bf/src/examples/v3/exampleElectronicRecord.json +36 -0
  22. package/busy-spence-79c6bf/src/examples/v3/exampleTransaction.json +1038 -0
  23. package/busy-spence-79c6bf/src/examples/v3/exampleVouch.json +32 -0
  24. package/busy-spence-79c6bf/src/mappings/SendPropertyDetailsRequestSchema.json +1588 -0
  25. package/busy-spence-79c6bf/src/mappings/adf.js +198 -0
  26. package/busy-spence-79c6bf/src/schemas/v1/GeoJSON.json +1279 -0
  27. package/busy-spence-79c6bf/src/schemas/v1/baspiNotes.html +102 -0
  28. package/busy-spence-79c6bf/src/schemas/v1/energy-performance-certificate.json +124 -0
  29. package/busy-spence-79c6bf/src/schemas/v1/freehold-information.json +2051 -0
  30. package/busy-spence-79c6bf/src/schemas/v1/leasehold-information.json +2064 -0
  31. package/busy-spence-79c6bf/src/schemas/v1/legal-information.json +1045 -0
  32. package/busy-spence-79c6bf/src/schemas/v1/material-facts.json +2109 -0
  33. package/busy-spence-79c6bf/src/schemas/v1/pdtf-transaction-search-results.json +40 -0
  34. package/busy-spence-79c6bf/src/schemas/v1/pdtf-transaction.json +191 -0
  35. package/busy-spence-79c6bf/src/schemas/v1/searches/drainage-and-water.json +261 -0
  36. package/busy-spence-79c6bf/src/schemas/v1/searches/local-land-charges.json +69 -0
  37. package/busy-spence-79c6bf/src/schemas/v1/searches/local-searches-required.json +857 -0
  38. package/busy-spence-79c6bf/src/schemas/v1/searches.json +237 -0
  39. package/busy-spence-79c6bf/src/schemas/v1/title-deed.json +841 -0
  40. package/busy-spence-79c6bf/src/schemas/v2/baspiNotes.html +102 -0
  41. package/busy-spence-79c6bf/src/schemas/v2/combined.json +37731 -0
  42. package/busy-spence-79c6bf/src/schemas/v2/overlays/baspi.json +8132 -0
  43. package/busy-spence-79c6bf/src/schemas/v2/overlays/con29DW.json +705 -0
  44. package/busy-spence-79c6bf/src/schemas/v2/overlays/con29R.json +2956 -0
  45. package/busy-spence-79c6bf/src/schemas/v2/overlays/fme1.json +1259 -0
  46. package/busy-spence-79c6bf/src/schemas/v2/overlays/llc1.json +25 -0
  47. package/busy-spence-79c6bf/src/schemas/v2/overlays/lpe1.json +2171 -0
  48. package/busy-spence-79c6bf/src/schemas/v2/overlays/nts.json +326 -0
  49. package/busy-spence-79c6bf/src/schemas/v2/overlays/oc1.json +2799 -0
  50. package/busy-spence-79c6bf/src/schemas/v2/overlays/piq.json +3419 -0
  51. package/busy-spence-79c6bf/src/schemas/v2/overlays/rds.json +3736 -0
  52. package/busy-spence-79c6bf/src/schemas/v2/overlays/ta10.json +5306 -0
  53. package/busy-spence-79c6bf/src/schemas/v2/overlays/ta6.json +4533 -0
  54. package/busy-spence-79c6bf/src/schemas/v2/overlays/ta7.json +1045 -0
  55. package/busy-spence-79c6bf/src/schemas/v2/pdtf-transaction.json +34351 -0
  56. package/busy-spence-79c6bf/src/schemas/v2/skeleton.json +3973 -0
  57. package/busy-spence-79c6bf/src/schemas/v3/combined.json +48643 -0
  58. package/busy-spence-79c6bf/src/schemas/v3/compactSkeleton.txt +4519 -0
  59. package/busy-spence-79c6bf/src/schemas/v3/overlays/README.md +299 -0
  60. package/busy-spence-79c6bf/src/schemas/v3/overlays/baspi4.json +8030 -0
  61. package/busy-spence-79c6bf/src/schemas/v3/overlays/baspi5.json +8180 -0
  62. package/busy-spence-79c6bf/src/schemas/v3/overlays/con29DW.json +716 -0
  63. package/busy-spence-79c6bf/src/schemas/v3/overlays/con29R.json +2981 -0
  64. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/ac.json +334 -0
  65. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/as.json +74 -0
  66. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/dk.json +33 -0
  67. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/dr.json +73 -0
  68. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/er.json +85 -0
  69. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/fd.json +75 -0
  70. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/hi.json +51 -0
  71. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/hs.json +73 -0
  72. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/ic.json +94 -0
  73. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/jk.json +96 -0
  74. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/la.json +85 -0
  75. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/lc.json +76 -0
  76. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/ma.json +90 -0
  77. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/mc.json +38 -0
  78. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/mi.json +70 -0
  79. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/nd.json +44 -0
  80. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/oa.json +24 -0
  81. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/oc.json +57 -0
  82. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/pc.json +38 -0
  83. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/ph.json +195 -0
  84. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/rw.json +69 -0
  85. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/sb.json +73 -0
  86. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/sc.json +133 -0
  87. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/sd.json +64 -0
  88. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/sf.json +74 -0
  89. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/sl.json +68 -0
  90. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/ta.json +204 -0
  91. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/tf.json +103 -0
  92. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/tr.json +74 -0
  93. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/wg.json +351 -0
  94. package/busy-spence-79c6bf/src/schemas/v3/overlays/fme1.json +1266 -0
  95. package/busy-spence-79c6bf/src/schemas/v3/overlays/llc1.json +25 -0
  96. package/busy-spence-79c6bf/src/schemas/v3/overlays/lpe1.json +2199 -0
  97. package/busy-spence-79c6bf/src/schemas/v3/overlays/nts.json +2159 -0
  98. package/busy-spence-79c6bf/src/schemas/v3/overlays/nts2.json +2744 -0
  99. package/busy-spence-79c6bf/src/schemas/v3/overlays/ntsl.json +1815 -0
  100. package/busy-spence-79c6bf/src/schemas/v3/overlays/ntsl2.json +2219 -0
  101. package/busy-spence-79c6bf/src/schemas/v3/overlays/oc1.json +2817 -0
  102. package/busy-spence-79c6bf/src/schemas/v3/overlays/piq.json +3324 -0
  103. package/busy-spence-79c6bf/src/schemas/v3/overlays/rds.json +3668 -0
  104. package/busy-spence-79c6bf/src/schemas/v3/overlays/sef25.json +1653 -0
  105. package/busy-spence-79c6bf/src/schemas/v3/overlays/sr24.json +38 -0
  106. package/busy-spence-79c6bf/src/schemas/v3/overlays/ta10.json +4645 -0
  107. package/busy-spence-79c6bf/src/schemas/v3/overlays/ta6.json +4572 -0
  108. package/busy-spence-79c6bf/src/schemas/v3/overlays/ta6ed6.json +6665 -0
  109. package/busy-spence-79c6bf/src/schemas/v3/overlays/ta7.json +1537 -0
  110. package/busy-spence-79c6bf/src/schemas/v3/overlays/ta7ed5.json +1585 -0
  111. package/busy-spence-79c6bf/src/schemas/v3/pdtf-transaction.json +41570 -0
  112. package/busy-spence-79c6bf/src/schemas/v3/skeleton.json +5767 -0
  113. package/busy-spence-79c6bf/src/schemas/verifiedClaims/README.md +21 -0
  114. package/busy-spence-79c6bf/src/schemas/verifiedClaims/pdtf-verified-claims.json +447 -0
  115. package/busy-spence-79c6bf/src/utils/compactSkeleton.js +84 -0
  116. package/busy-spence-79c6bf/src/utils/countTokens.js +67 -0
  117. package/busy-spence-79c6bf/src/utils/extractExtensionOverlays.js +633 -0
  118. package/busy-spence-79c6bf/src/utils/extractOverlay.js +381 -0
  119. package/busy-spence-79c6bf/src/utils/extractProperties.js +44 -0
  120. package/busy-spence-79c6bf/src/utils/listPathTitles.js +36 -0
  121. package/busy-spence-79c6bf/src/utils/minimalSkeleton.js +85 -0
  122. package/busy-spence-79c6bf/src/utils/pathList.csv +903 -0
  123. package/busy-spence-79c6bf/src/utils/pathSkeleton.js +181 -0
  124. package/busy-spence-79c6bf/ta6ed6-titles-plan.md +118 -0
  125. package/busy-spence-79c6bf/ta7ed5-titles-spec.md +89 -0
  126. package/package.json +1 -1
  127. package/src/schemas/v3/combined.json +225 -47
  128. package/src/schemas/v3/overlays/llc1.json +1 -2
  129. package/src/schemas/v3/overlays/ta6ed6.json +204 -75
  130. package/src/schemas/v3/overlays/ta7ed5.json +54 -20
@@ -0,0 +1,21 @@
1
+ ## README
2
+
3
+ ### About verified claims
4
+ `pdtf-verified-claims.json` describes the schema container in which we store property `claims` and their corresponding `verification`.
5
+
6
+ This schema structure is strongly influenced by OpenID Connect for Identity Assurance 1.0's way of storing "verified claims".
7
+
8
+ More Details from the OIDC page which describes the details the nature of `verification` and `claims` objects: https://openid.net/specs/openid-connect-4-identity-assurance-1_0.html#name-representing-verified-claim
9
+
10
+ ### Terms of Use
11
+ The schema supports an optional `terms_of_use` object to control access to verified claims based on confidentiality levels:
12
+
13
+ * **Public**: No access restrictions (`allowed_roles: []`)
14
+ * **Restricted**: Requires some participant role but not specifically defined (`allowed_roles: []`)
15
+ * **Confidential**: Specific roles defined for access control (e.g., `allowed_roles: ["Seller's Conveyancer", "Buyer's Conveyancer"]`)
16
+
17
+ The `allowed_roles` array accepts any of the participant roles defined in [pdtf-transaction.json](../v3/pdtf-transaction.json).
18
+
19
+ Notes:
20
+ * For PDTF Schema, all data included in the `claims` object must adhere to [pdtf-transaction.json (v3)](../v3/pdtf-transaction.json)
21
+ * For verification, there is more freedom in terms of the type of data that can currently be provided, see the documentation in the OIDC link above for details and examples.
@@ -0,0 +1,447 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://trust.propdata.org.uk/schemas/verifiedClaims/pdtf-verified-claims.json",
4
+ "definitions": {
5
+ "date_type": {
6
+ "type": "string",
7
+ "format": "date"
8
+ },
9
+ "time_type": {
10
+ "type": "string",
11
+ "format": "date-time"
12
+ },
13
+ "document_number": {
14
+ "type": "string"
15
+ },
16
+ "document_details": {
17
+ "type": "object",
18
+ "properties": {
19
+ "type": {
20
+ "type": "string"
21
+ },
22
+ "document_number": {
23
+ "$ref": "#/definitions/document_number"
24
+ },
25
+ "number": {
26
+ "$ref": "#/definitions/document_number"
27
+ },
28
+ "personal_number": {
29
+ "type": "string"
30
+ },
31
+ "serial_number": {
32
+ "type": "string"
33
+ },
34
+ "date_of_issuance": {
35
+ "$ref": "#/definitions/date_type"
36
+ },
37
+ "date_of_expiry": {
38
+ "$ref": "#/definitions/date_type"
39
+ },
40
+ "issuer": {
41
+ "type": "object",
42
+ "properties": {
43
+ "name": {
44
+ "type": "string"
45
+ },
46
+ "formatted": {
47
+ "type": "string"
48
+ },
49
+ "street_address": {
50
+ "type": "string"
51
+ },
52
+ "locality": {
53
+ "type": "string"
54
+ },
55
+ "region": {
56
+ "type": "string"
57
+ },
58
+ "postal_code": {
59
+ "type": "string"
60
+ },
61
+ "country": {
62
+ "type": "string"
63
+ },
64
+ "country_code": {
65
+ "type": "string"
66
+ },
67
+ "jurisdiction": {
68
+ "type": "string"
69
+ }
70
+ }
71
+ }
72
+ }
73
+ },
74
+ "validation_method": {
75
+ "type": "object",
76
+ "properties": {
77
+ "type": {
78
+ "type": "string"
79
+ }
80
+ }
81
+ },
82
+ "verification_method": {
83
+ "type": "object",
84
+ "properties": {
85
+ "type": {
86
+ "type": "string"
87
+ }
88
+ }
89
+ },
90
+ "evidence": {
91
+ "type": "object",
92
+ "properties": {
93
+ "type": {
94
+ "type": "string",
95
+ "enum": ["document", "electronic_record", "vouch"]
96
+ },
97
+ "attachments": {
98
+ "$ref": "#/definitions/attachments"
99
+ }
100
+ },
101
+ "required": ["type"],
102
+ "allOf": [
103
+ {
104
+ "if": {
105
+ "properties": {
106
+ "type": {
107
+ "const": "document"
108
+ }
109
+ }
110
+ },
111
+ "then": {
112
+ "properties": {
113
+ "validation_method": {
114
+ "$ref": "#/definitions/validation_method"
115
+ },
116
+ "verification_method": {
117
+ "$ref": "#/definitions/verification_method"
118
+ },
119
+ "verifier": {
120
+ "type": "object",
121
+ "properties": {
122
+ "organization": {
123
+ "type": "string"
124
+ },
125
+ "txn": {
126
+ "type": "string"
127
+ }
128
+ }
129
+ },
130
+ "time": {
131
+ "$ref": "#/definitions/time_type"
132
+ },
133
+ "document_details": {
134
+ "$ref": "#/definitions/document_details"
135
+ }
136
+ }
137
+ }
138
+ },
139
+ {
140
+ "if": {
141
+ "properties": {
142
+ "type": {
143
+ "value": "electronic_record"
144
+ }
145
+ }
146
+ },
147
+ "then": {
148
+ "properties": {
149
+ "validation_method": {
150
+ "$ref": "#/definitions/validation_method"
151
+ },
152
+ "verification_method": {
153
+ "$ref": "#/definitions/verification_method"
154
+ },
155
+ "verifier": {
156
+ "type": "object",
157
+ "required": ["organization"],
158
+ "properties": {
159
+ "organization": {
160
+ "type": "string"
161
+ },
162
+ "txn": {
163
+ "type": "string"
164
+ }
165
+ }
166
+ },
167
+ "time": {
168
+ "$ref": "#/definitions/time_type"
169
+ },
170
+ "record": {
171
+ "type": "object",
172
+ "required": ["source"],
173
+ "properties": {
174
+ "type": {
175
+ "type": "string"
176
+ },
177
+ "personal_number": {
178
+ "type": "string"
179
+ },
180
+ "created_at": {
181
+ "$ref": "#/definitions/date_type"
182
+ },
183
+ "date_of_expiry": {
184
+ "$ref": "#/definitions/date_type"
185
+ },
186
+ "source": {
187
+ "type": "object",
188
+ "required": ["name"],
189
+ "properties": {
190
+ "name": {
191
+ "type": "string"
192
+ },
193
+ "formatted": {
194
+ "type": "string"
195
+ },
196
+ "street_address": {
197
+ "type": "string"
198
+ },
199
+ "locality": {
200
+ "type": "string"
201
+ },
202
+ "region": {
203
+ "type": "string"
204
+ },
205
+ "postal_code": {
206
+ "type": "string"
207
+ },
208
+ "country": {
209
+ "type": "string"
210
+ },
211
+ "country_code": {
212
+ "type": "string"
213
+ },
214
+ "jurisdiction": {
215
+ "type": "string"
216
+ },
217
+ "rights": { "type": "string" }
218
+ }
219
+ }
220
+ }
221
+ }
222
+ }
223
+ }
224
+ },
225
+ {
226
+ "if": {
227
+ "properties": {
228
+ "type": {
229
+ "value": "vouch"
230
+ }
231
+ }
232
+ },
233
+ "then": {
234
+ "properties": {
235
+ "validation_method": {
236
+ "$ref": "#/definitions/validation_method"
237
+ },
238
+ "verification_method": {
239
+ "$ref": "#/definitions/verification_method"
240
+ },
241
+ "verifier": {
242
+ "type": "object",
243
+ "properties": {
244
+ "organization": {
245
+ "type": "string"
246
+ },
247
+ "txn": {
248
+ "type": "string"
249
+ }
250
+ }
251
+ },
252
+ "time": {
253
+ "$ref": "#/definitions/time_type"
254
+ },
255
+ "attestation": {
256
+ "type": "object",
257
+ "properties": {
258
+ "type": {
259
+ "type": "string",
260
+ "const": "digital_attestation"
261
+ },
262
+ "reference_number": {
263
+ "type": "string"
264
+ },
265
+ "personal_number": {
266
+ "type": "string"
267
+ },
268
+ "date_of_issuance": {
269
+ "$ref": "#/definitions/date_type"
270
+ },
271
+ "date_of_expiry": {
272
+ "$ref": "#/definitions/date_type"
273
+ },
274
+ "voucher": {
275
+ "type": "object",
276
+ "properties": {
277
+ "name": {
278
+ "type": "string"
279
+ },
280
+ "birthdate": {
281
+ "$ref": "#/definitions/date_type"
282
+ },
283
+ "formatted": {
284
+ "type": "string"
285
+ },
286
+ "street_address": {
287
+ "type": "string"
288
+ },
289
+ "locality": {
290
+ "type": "string"
291
+ },
292
+ "region": {
293
+ "type": "string"
294
+ },
295
+ "postal_code": {
296
+ "type": "string"
297
+ },
298
+ "country": {
299
+ "type": "string"
300
+ },
301
+ "occupation": {
302
+ "type": "string"
303
+ },
304
+ "organization": {
305
+ "type": "string"
306
+ }
307
+ }
308
+ }
309
+ }
310
+ }
311
+ }
312
+ }
313
+ }
314
+ ]
315
+ },
316
+ "digest": {
317
+ "type": "object",
318
+ "properties": {
319
+ "alg": {
320
+ "type": "string"
321
+ },
322
+ "value": {
323
+ "type": "string",
324
+ "contentEncoding": "base64"
325
+ }
326
+ },
327
+ "required": ["alg", "value"]
328
+ },
329
+ "external_attachment": {
330
+ "type": "object",
331
+ "properties": {
332
+ "desc": {
333
+ "type": "string"
334
+ },
335
+ "digest": {
336
+ "$ref": "#/definitions/digest"
337
+ },
338
+ "url": {
339
+ "type": "string",
340
+ "format": "uri"
341
+ },
342
+ "access_token": {
343
+ "type": ["string", "null"]
344
+ },
345
+ "expires_in": {
346
+ "type": "integer",
347
+ "minimum": 1
348
+ },
349
+ "pdtfSchemaPath": {
350
+ "type": "string"
351
+ }
352
+ },
353
+ "required": ["digest", "url"]
354
+ },
355
+ "attachments": {
356
+ "type": "array",
357
+ "minItems": 1,
358
+ "items": {
359
+ "$ref": "#/definitions/external_attachment"
360
+ }
361
+ },
362
+ "verified_claims_def": {
363
+ "type": "object",
364
+ "properties": {
365
+ "id": {
366
+ "description": "The unique identifier of the verified claim",
367
+ "type": "string"
368
+ },
369
+ "transactionId": {
370
+ "description": "The unique identifier of the PDTF transaction to which these claims relate",
371
+ "type": "string"
372
+ },
373
+ "schemaVersion": {
374
+ "description": "The semantic version of the schema used to validate the claims",
375
+ "type": "string"
376
+ },
377
+ "timestamp": {
378
+ "type": "integer",
379
+ "minimum": 0,
380
+ "description": "Unix timestamp in milliseconds when the verified claims were created"
381
+ },
382
+ "verification": {
383
+ "type": "object",
384
+ "properties": {
385
+ "trust_framework": {
386
+ "type": "string",
387
+ "const": "uk_pdtf"
388
+ },
389
+ "time": {
390
+ "$ref": "#/definitions/time_type"
391
+ },
392
+ "evidence": {
393
+ "type": "array",
394
+ "minItems": 1,
395
+ "items": {
396
+ "oneOf": [
397
+ {
398
+ "$ref": "#/definitions/evidence"
399
+ }
400
+ ]
401
+ }
402
+ }
403
+ },
404
+ "required": ["trust_framework"],
405
+ "additionalProperties": true
406
+ },
407
+ "claims": {
408
+ "type": "object",
409
+ "patternProperties": {
410
+ "^(/|([a-zA-Z0-9/-]+)+$)": {}
411
+ },
412
+ "minProperties": 1,
413
+ "additionalProperties": false
414
+ },
415
+ "terms_of_use": {
416
+ "type": "object",
417
+ "properties": {
418
+ "confidentiality_level": {
419
+ "type": "string",
420
+ "enum": ["public", "restricted", "confidential"]
421
+ },
422
+ "allowed_roles": {
423
+ "type": "array",
424
+ "items": {
425
+ "type": "string"
426
+ }
427
+ }
428
+ },
429
+ "additionalProperties": false
430
+ }
431
+ },
432
+ "required": ["verification", "claims"],
433
+ "additionalProperties": false
434
+ }
435
+ },
436
+ "type": "object",
437
+ "required": ["verified_claims"],
438
+ "properties": {
439
+ "verified_claims": {
440
+ "type": "array",
441
+ "items": {
442
+ "$ref": "#/definitions/verified_claims_def"
443
+ }
444
+ }
445
+ },
446
+ "additionalProperties": false
447
+ }
@@ -0,0 +1,84 @@
1
+ const fs = require("fs");
2
+
3
+ // Read the current skeleton
4
+ const skeleton = require("../schemas/v3/skeleton.json");
5
+
6
+ // Convert to ultra-compact format
7
+ const toCompact = (obj, indent = "") => {
8
+ if (typeof obj === "string") {
9
+ // Type indicators
10
+ if (["string", "number", "integer", "boolean", "variant"].includes(obj)) {
11
+ return obj[0]; // Just first letter: s, n, i, b, v
12
+ }
13
+ return obj;
14
+ }
15
+
16
+ if (Array.isArray(obj)) {
17
+ if (obj.length === 0) return "[]";
18
+ // Array with content
19
+ const inner = toCompact(obj[0], indent + " ");
20
+ if (typeof inner === "string" && inner.length === 1) {
21
+ return `[${inner}]`; // Simple array like [s]
22
+ }
23
+ return `[\n${indent} ${inner}\n${indent}]`;
24
+ }
25
+
26
+ if (obj && typeof obj === "object") {
27
+ const keys = Object.keys(obj);
28
+ if (keys.length === 0) return "{}";
29
+
30
+ // Check if it's a simple object with only type indicators
31
+ const allSimple = keys.every(k =>
32
+ typeof obj[k] === "string" &&
33
+ ["s", "n", "i", "b", "v"].includes(toCompact(obj[k]))
34
+ );
35
+
36
+ if (allSimple && keys.length < 5) {
37
+ // Inline format: {a:s b:n c:s}
38
+ return `{${keys.map(k => `${k}:${toCompact(obj[k])}`).join(" ")}}`;
39
+ }
40
+
41
+ // Multi-line format
42
+ const lines = keys.map(k => {
43
+ const val = toCompact(obj[k], indent + " ");
44
+ if (typeof val === "string" && val.length === 1) {
45
+ return `${indent} ${k}:${val}`;
46
+ } else if (typeof val === "string" && (val === "{}" || val === "[]")) {
47
+ return `${indent} ${k}${val}`;
48
+ } else if (typeof val === "string" && val.startsWith("{") && val.endsWith("}")) {
49
+ return `${indent} ${k}${val}`;
50
+ } else if (typeof val === "string" && val.startsWith("[") && !val.includes("\n")) {
51
+ return `${indent} ${k}${val}`;
52
+ } else {
53
+ return `${indent} ${k}:\n${indent} ${val}`;
54
+ }
55
+ });
56
+
57
+ return `{\n${lines.join("\n")}\n${indent}}`;
58
+ }
59
+
60
+ return String(obj);
61
+ };
62
+
63
+ // Generate ultra-compact version
64
+ const compact = toCompact(skeleton);
65
+
66
+ // Write compact version
67
+ fs.writeFileSync("../schemas/v3/compactSkeleton.txt", compact);
68
+
69
+ console.log("Compact skeleton written to ../schemas/v3/compactSkeleton.txt");
70
+ console.log(`Size: ${compact.length} bytes`);
71
+
72
+ // Count tokens
73
+ try {
74
+ const GPT3Encoder = require('gpt-3-encoder');
75
+ const encoded = GPT3Encoder.encode(compact);
76
+ console.log(`Tokens (GPT-3): ${encoded.length}`);
77
+ console.log(`Reduction: ${((1 - encoded.length / 78734) * 100).toFixed(1)}% fewer tokens than JSON skeleton`);
78
+
79
+ // Show sample
80
+ console.log("\nFirst 500 chars:");
81
+ console.log(compact.substring(0, 500));
82
+ } catch (e) {
83
+ console.log(`Estimated tokens: ~${Math.ceil(compact.length / 4)}`);
84
+ }
@@ -0,0 +1,67 @@
1
+ const fs = require('fs');
2
+
3
+ // Try to use tiktoken or a similar library
4
+ // For Claude/Anthropic models, we can estimate using the cl100k_base encoding
5
+ // which is similar to what Claude uses
6
+
7
+ // First, let's check what's available
8
+ try {
9
+ // Option 1: Use gpt-tokenizer (common npm package)
10
+ const { encode } = require('gpt-tokenizer');
11
+
12
+ const content = fs.readFileSync('../schemas/v3/skeleton.json', 'utf8');
13
+ const tokens = encode(content);
14
+
15
+ console.log(`Using gpt-tokenizer:`);
16
+ console.log(`Total tokens: ${tokens.length}`);
17
+ console.log(`File size: ${content.length} characters`);
18
+ console.log(`Ratio: ${(content.length / tokens.length).toFixed(2)} characters per token`);
19
+
20
+ } catch (e1) {
21
+ console.log("gpt-tokenizer not found, trying gpt-3-encoder...");
22
+
23
+ try {
24
+ // Option 2: Use gpt-3-encoder
25
+ const GPT3Encoder = require('gpt-3-encoder');
26
+
27
+ const content = fs.readFileSync('../schemas/v3/skeleton.json', 'utf8');
28
+ const encoded = GPT3Encoder.encode(content);
29
+
30
+ console.log(`Using gpt-3-encoder:`);
31
+ console.log(`Total tokens: ${encoded.length}`);
32
+ console.log(`File size: ${content.length} characters`);
33
+ console.log(`Ratio: ${(content.length / encoded.length).toFixed(2)} characters per token`);
34
+
35
+ } catch (e2) {
36
+ console.log("No tokenizer library found. Falling back to estimation...");
37
+
38
+ // Option 3: Manual estimation
39
+ const content = fs.readFileSync('../schemas/v3/skeleton.json', 'utf8');
40
+
41
+ // Count different types of content for better estimation
42
+ const lines = content.split('\n');
43
+ const words = content.split(/\s+/);
44
+ const punctuation = content.match(/[{}:,\[\]"]/g) || [];
45
+
46
+ // Rough estimation:
47
+ // - JSON structure tokens (brackets, colons, quotes): ~1 token each
48
+ // - Words: ~1 token each
49
+ // - Whitespace: usually absorbed into adjacent tokens
50
+
51
+ const structureTokens = punctuation.length;
52
+ const wordTokens = words.length;
53
+ const estimatedTokens = Math.ceil((structureTokens + wordTokens) * 0.75); // 0.75 factor for overlap
54
+
55
+ console.log("Manual estimation:");
56
+ console.log(`File size: ${content.length} characters`);
57
+ console.log(`Lines: ${lines.length}`);
58
+ console.log(`Words: ${words.length}`);
59
+ console.log(`JSON punctuation: ${punctuation.length}`);
60
+ console.log(`Estimated tokens: ~${estimatedTokens}`);
61
+ console.log(`Ratio: ${(content.length / estimatedTokens).toFixed(2)} characters per token`);
62
+
63
+ // Also do a simple character-based estimation
64
+ const simpleEstimate = Math.ceil(content.length / 4);
65
+ console.log(`\nSimple estimation (chars/4): ~${simpleEstimate} tokens`);
66
+ }
67
+ }