@uncefact/untp-utils 0.2.0 → 0.4.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 (262) hide show
  1. package/README.md +40 -12
  2. package/artefacts/context/untp/0.6.0/dcc.json +1241 -0
  3. package/artefacts/context/untp/0.6.0/dfr.json +619 -0
  4. package/artefacts/context/untp/0.6.0/dia.json +162 -0
  5. package/artefacts/context/untp/0.6.0/dpp.json +1078 -0
  6. package/artefacts/context/untp/0.6.0/dte.json +1285 -0
  7. package/artefacts/context/untp/0.6.1/dcc.json +1388 -0
  8. package/artefacts/context/untp/0.6.1/dfr.json +690 -0
  9. package/artefacts/context/untp/0.6.1/dia.json +196 -0
  10. package/artefacts/context/untp/0.6.1/dpp.json +1164 -0
  11. package/artefacts/context/untp/0.6.1/dte.json +1340 -0
  12. package/artefacts/context/untp/0.7.0/untp.json +3493 -0
  13. package/artefacts/context/vcdm/2/credentials.json +301 -0
  14. package/artefacts/manifest.json +214 -0
  15. package/artefacts/schema/untp/0.6.0/dcc.json +1131 -0
  16. package/artefacts/schema/untp/0.6.0/dfr.json +1028 -0
  17. package/artefacts/schema/untp/0.6.0/dia.json +236 -0
  18. package/artefacts/schema/untp/0.6.0/dpp.json +1219 -0
  19. package/artefacts/schema/untp/0.6.0/dte.json +845 -0
  20. package/artefacts/schema/untp/0.6.1/dcc.json +1196 -0
  21. package/artefacts/schema/untp/0.6.1/dfr.json +1037 -0
  22. package/artefacts/schema/untp/0.6.1/dia.json +236 -0
  23. package/artefacts/schema/untp/0.6.1/dpp.json +1229 -0
  24. package/artefacts/schema/untp/0.6.1/dte.json +845 -0
  25. package/artefacts/schema/untp/0.7.0/cvc.json +701 -0
  26. package/artefacts/schema/untp/0.7.0/dcc.json +1133 -0
  27. package/artefacts/schema/untp/0.7.0/dfr.json +1245 -0
  28. package/artefacts/schema/untp/0.7.0/dia.json +443 -0
  29. package/artefacts/schema/untp/0.7.0/dpp.json +1300 -0
  30. package/artefacts/schema/untp/0.7.0/dte.json +1226 -0
  31. package/artefacts/schema/untp/0.7.0/linkset.json +119 -0
  32. package/artefacts/schema/vcdm/2/verifiable-credential.json +318 -0
  33. package/build/artefacts/detect-version-from-context.d.ts +7 -2
  34. package/build/artefacts/detect-version-from-context.js +17 -6
  35. package/build/artefacts/detect-version-from-context.js.map +1 -1
  36. package/build/artefacts/detect-version-from-context.test.js +59 -0
  37. package/build/artefacts/detect-version-from-context.test.js.map +1 -1
  38. package/build/artefacts/urls.d.ts +8 -1
  39. package/build/artefacts/urls.js +17 -5
  40. package/build/artefacts/urls.js.map +1 -1
  41. package/build/artefacts/urls.test.js +63 -1
  42. package/build/artefacts/urls.test.js.map +1 -1
  43. package/build/bundle/artefacts/context/untp/0.6.0/dcc.d.ts +2 -0
  44. package/build/bundle/artefacts/context/untp/0.6.0/dcc.js +1244 -0
  45. package/build/bundle/artefacts/context/untp/0.6.0/dcc.js.map +1 -0
  46. package/build/bundle/artefacts/context/untp/0.6.0/dfr.d.ts +2 -0
  47. package/build/bundle/artefacts/context/untp/0.6.0/dfr.js +622 -0
  48. package/build/bundle/artefacts/context/untp/0.6.0/dfr.js.map +1 -0
  49. package/build/bundle/artefacts/context/untp/0.6.0/dia.d.ts +2 -0
  50. package/build/bundle/artefacts/context/untp/0.6.0/dia.js +165 -0
  51. package/build/bundle/artefacts/context/untp/0.6.0/dia.js.map +1 -0
  52. package/build/bundle/artefacts/context/untp/0.6.0/dpp.d.ts +2 -0
  53. package/build/bundle/artefacts/context/untp/0.6.0/dpp.js +1081 -0
  54. package/build/bundle/artefacts/context/untp/0.6.0/dpp.js.map +1 -0
  55. package/build/bundle/artefacts/context/untp/0.6.0/dte.d.ts +2 -0
  56. package/build/bundle/artefacts/context/untp/0.6.0/dte.js +1288 -0
  57. package/build/bundle/artefacts/context/untp/0.6.0/dte.js.map +1 -0
  58. package/build/bundle/artefacts/context/untp/0.6.1/dcc.d.ts +2 -0
  59. package/build/bundle/artefacts/context/untp/0.6.1/dcc.js +1391 -0
  60. package/build/bundle/artefacts/context/untp/0.6.1/dcc.js.map +1 -0
  61. package/build/bundle/artefacts/context/untp/0.6.1/dfr.d.ts +2 -0
  62. package/build/bundle/artefacts/context/untp/0.6.1/dfr.js +693 -0
  63. package/build/bundle/artefacts/context/untp/0.6.1/dfr.js.map +1 -0
  64. package/build/bundle/artefacts/context/untp/0.6.1/dia.d.ts +2 -0
  65. package/build/bundle/artefacts/context/untp/0.6.1/dia.js +199 -0
  66. package/build/bundle/artefacts/context/untp/0.6.1/dia.js.map +1 -0
  67. package/build/bundle/artefacts/context/untp/0.6.1/dpp.d.ts +2 -0
  68. package/build/bundle/artefacts/context/untp/0.6.1/dpp.js +1167 -0
  69. package/build/bundle/artefacts/context/untp/0.6.1/dpp.js.map +1 -0
  70. package/build/bundle/artefacts/context/untp/0.6.1/dte.d.ts +2 -0
  71. package/build/bundle/artefacts/context/untp/0.6.1/dte.js +1343 -0
  72. package/build/bundle/artefacts/context/untp/0.6.1/dte.js.map +1 -0
  73. package/build/bundle/artefacts/context/untp/0.7.0/untp.d.ts +2 -0
  74. package/build/bundle/artefacts/context/untp/0.7.0/untp.js +3496 -0
  75. package/build/bundle/artefacts/context/untp/0.7.0/untp.js.map +1 -0
  76. package/build/bundle/artefacts/context/vcdm/2/credentials.d.ts +2 -0
  77. package/build/bundle/artefacts/context/vcdm/2/credentials.js +304 -0
  78. package/build/bundle/artefacts/context/vcdm/2/credentials.js.map +1 -0
  79. package/build/bundle/artefacts/schema/untp/0.6.0/dcc.d.ts +2 -0
  80. package/build/bundle/artefacts/schema/untp/0.6.0/dcc.js +1134 -0
  81. package/build/bundle/artefacts/schema/untp/0.6.0/dcc.js.map +1 -0
  82. package/build/bundle/artefacts/schema/untp/0.6.0/dfr.d.ts +2 -0
  83. package/build/bundle/artefacts/schema/untp/0.6.0/dfr.js +1031 -0
  84. package/build/bundle/artefacts/schema/untp/0.6.0/dfr.js.map +1 -0
  85. package/build/bundle/artefacts/schema/untp/0.6.0/dia.d.ts +2 -0
  86. package/build/bundle/artefacts/schema/untp/0.6.0/dia.js +239 -0
  87. package/build/bundle/artefacts/schema/untp/0.6.0/dia.js.map +1 -0
  88. package/build/bundle/artefacts/schema/untp/0.6.0/dpp.d.ts +2 -0
  89. package/build/bundle/artefacts/schema/untp/0.6.0/dpp.js +1222 -0
  90. package/build/bundle/artefacts/schema/untp/0.6.0/dpp.js.map +1 -0
  91. package/build/bundle/artefacts/schema/untp/0.6.0/dte.d.ts +2 -0
  92. package/build/bundle/artefacts/schema/untp/0.6.0/dte.js +848 -0
  93. package/build/bundle/artefacts/schema/untp/0.6.0/dte.js.map +1 -0
  94. package/build/bundle/artefacts/schema/untp/0.6.1/dcc.d.ts +2 -0
  95. package/build/bundle/artefacts/schema/untp/0.6.1/dcc.js +1199 -0
  96. package/build/bundle/artefacts/schema/untp/0.6.1/dcc.js.map +1 -0
  97. package/build/bundle/artefacts/schema/untp/0.6.1/dfr.d.ts +2 -0
  98. package/build/bundle/artefacts/schema/untp/0.6.1/dfr.js +1040 -0
  99. package/build/bundle/artefacts/schema/untp/0.6.1/dfr.js.map +1 -0
  100. package/build/bundle/artefacts/schema/untp/0.6.1/dia.d.ts +2 -0
  101. package/build/bundle/artefacts/schema/untp/0.6.1/dia.js +239 -0
  102. package/build/bundle/artefacts/schema/untp/0.6.1/dia.js.map +1 -0
  103. package/build/bundle/artefacts/schema/untp/0.6.1/dpp.d.ts +2 -0
  104. package/build/bundle/artefacts/schema/untp/0.6.1/dpp.js +1232 -0
  105. package/build/bundle/artefacts/schema/untp/0.6.1/dpp.js.map +1 -0
  106. package/build/bundle/artefacts/schema/untp/0.6.1/dte.d.ts +2 -0
  107. package/build/bundle/artefacts/schema/untp/0.6.1/dte.js +848 -0
  108. package/build/bundle/artefacts/schema/untp/0.6.1/dte.js.map +1 -0
  109. package/build/bundle/artefacts/schema/untp/0.7.0/cvc.d.ts +2 -0
  110. package/build/bundle/artefacts/schema/untp/0.7.0/cvc.js +704 -0
  111. package/build/bundle/artefacts/schema/untp/0.7.0/cvc.js.map +1 -0
  112. package/build/bundle/artefacts/schema/untp/0.7.0/dcc.d.ts +2 -0
  113. package/build/bundle/artefacts/schema/untp/0.7.0/dcc.js +1136 -0
  114. package/build/bundle/artefacts/schema/untp/0.7.0/dcc.js.map +1 -0
  115. package/build/bundle/artefacts/schema/untp/0.7.0/dfr.d.ts +2 -0
  116. package/build/bundle/artefacts/schema/untp/0.7.0/dfr.js +1248 -0
  117. package/build/bundle/artefacts/schema/untp/0.7.0/dfr.js.map +1 -0
  118. package/build/bundle/artefacts/schema/untp/0.7.0/dia.d.ts +2 -0
  119. package/build/bundle/artefacts/schema/untp/0.7.0/dia.js +446 -0
  120. package/build/bundle/artefacts/schema/untp/0.7.0/dia.js.map +1 -0
  121. package/build/bundle/artefacts/schema/untp/0.7.0/dpp.d.ts +2 -0
  122. package/build/bundle/artefacts/schema/untp/0.7.0/dpp.js +1303 -0
  123. package/build/bundle/artefacts/schema/untp/0.7.0/dpp.js.map +1 -0
  124. package/build/bundle/artefacts/schema/untp/0.7.0/dte.d.ts +2 -0
  125. package/build/bundle/artefacts/schema/untp/0.7.0/dte.js +1229 -0
  126. package/build/bundle/artefacts/schema/untp/0.7.0/dte.js.map +1 -0
  127. package/build/bundle/artefacts/schema/untp/0.7.0/linkset.d.ts +2 -0
  128. package/build/bundle/artefacts/schema/untp/0.7.0/linkset.js +122 -0
  129. package/build/bundle/artefacts/schema/untp/0.7.0/linkset.js.map +1 -0
  130. package/build/bundle/artefacts/schema/vcdm/2/verifiable-credential.d.ts +2 -0
  131. package/build/bundle/artefacts/schema/vcdm/2/verifiable-credential.js +321 -0
  132. package/build/bundle/artefacts/schema/vcdm/2/verifiable-credential.js.map +1 -0
  133. package/build/bundle/fallback.d.ts +41 -0
  134. package/build/bundle/fallback.js +62 -0
  135. package/build/bundle/fallback.js.map +1 -0
  136. package/build/bundle/fallback.test.d.ts +1 -0
  137. package/build/bundle/fallback.test.js +124 -0
  138. package/build/bundle/fallback.test.js.map +1 -0
  139. package/build/bundle/index.d.ts +4 -0
  140. package/build/bundle/index.js +77 -0
  141. package/build/bundle/index.js.map +1 -0
  142. package/build/bundle/lookup.d.ts +14 -0
  143. package/build/bundle/lookup.js +40 -0
  144. package/build/bundle/lookup.js.map +1 -0
  145. package/build/bundle/lookup.test.d.ts +1 -0
  146. package/build/bundle/lookup.test.js +70 -0
  147. package/build/bundle/lookup.test.js.map +1 -0
  148. package/build/bundle/public.d.ts +29 -0
  149. package/build/bundle/public.js +60 -0
  150. package/build/bundle/public.js.map +1 -0
  151. package/build/bundle/public.test.d.ts +1 -0
  152. package/build/bundle/public.test.js +41 -0
  153. package/build/bundle/public.test.js.map +1 -0
  154. package/build/bundle/refresh-classify.test.d.ts +1 -0
  155. package/build/bundle/refresh-classify.test.js +20 -0
  156. package/build/bundle/refresh-classify.test.js.map +1 -0
  157. package/build/bundle/refresh-main.test.d.ts +1 -0
  158. package/build/bundle/refresh-main.test.js +98 -0
  159. package/build/bundle/refresh-main.test.js.map +1 -0
  160. package/build/common/as-date-time.d.ts +13 -0
  161. package/build/common/as-date-time.js +44 -0
  162. package/build/common/as-date-time.js.map +1 -0
  163. package/build/common/as-date-time.test.d.ts +1 -0
  164. package/build/common/as-date-time.test.js +42 -0
  165. package/build/common/as-date-time.test.js.map +1 -0
  166. package/build/common/as-non-empty-string.d.ts +11 -4
  167. package/build/common/as-non-empty-string.js +15 -5
  168. package/build/common/as-non-empty-string.js.map +1 -1
  169. package/build/common/as-non-empty-string.test.js +7 -2
  170. package/build/common/as-non-empty-string.test.js.map +1 -1
  171. package/build/common/canonical-json.d.ts +10 -0
  172. package/build/common/canonical-json.js +29 -0
  173. package/build/common/canonical-json.js.map +1 -0
  174. package/build/common/canonical-json.test.d.ts +1 -0
  175. package/build/common/canonical-json.test.js +20 -0
  176. package/build/common/canonical-json.test.js.map +1 -0
  177. package/build/common/index.d.ts +5 -0
  178. package/build/common/index.js +6 -0
  179. package/build/common/index.js.map +1 -0
  180. package/build/common/validity-window.d.ts +45 -0
  181. package/build/common/validity-window.js +68 -0
  182. package/build/common/validity-window.js.map +1 -0
  183. package/build/common/validity-window.test.d.ts +1 -0
  184. package/build/common/validity-window.test.js +67 -0
  185. package/build/common/validity-window.test.js.map +1 -0
  186. package/build/conformity-vocabulary/codes.d.ts +4 -0
  187. package/build/conformity-vocabulary/codes.js +4 -0
  188. package/build/conformity-vocabulary/codes.js.map +1 -1
  189. package/build/conformity-vocabulary/parse-conformity-scheme.test.js +150 -0
  190. package/build/conformity-vocabulary/parse-conformity-scheme.test.js.map +1 -1
  191. package/build/conformity-vocabulary/parsers/v0-7-0.parser.js +225 -0
  192. package/build/conformity-vocabulary/parsers/v0-7-0.parser.js.map +1 -1
  193. package/build/conformity-vocabulary/types.d.ts +69 -15
  194. package/build/conformity-vocabulary/validate-conformity-claim.d.ts +17 -11
  195. package/build/conformity-vocabulary/validate-conformity-claim.js +118 -13
  196. package/build/conformity-vocabulary/validate-conformity-claim.js.map +1 -1
  197. package/build/conformity-vocabulary/validate-conformity-claim.test.js +265 -0
  198. package/build/conformity-vocabulary/validate-conformity-claim.test.js.map +1 -1
  199. package/build/loaders/index.d.ts +2 -0
  200. package/build/loaders/index.js +1 -0
  201. package/build/loaders/index.js.map +1 -1
  202. package/build/loaders/jsonld-document-loader.d.ts +7 -5
  203. package/build/loaders/jsonld-document-loader.js +11 -2
  204. package/build/loaders/jsonld-document-loader.js.map +1 -1
  205. package/build/loaders/jsonld-document-loader.test.js +41 -1
  206. package/build/loaders/jsonld-document-loader.test.js.map +1 -1
  207. package/build/loaders/schema-loader.d.ts +13 -3
  208. package/build/loaders/schema-loader.js +24 -8
  209. package/build/loaders/schema-loader.js.map +1 -1
  210. package/build/loaders/schema-loader.test.js +56 -1
  211. package/build/loaders/schema-loader.test.js.map +1 -1
  212. package/build/node/errors.d.ts +9 -3
  213. package/build/node/errors.js +9 -3
  214. package/build/node/errors.js.map +1 -1
  215. package/build/node/index.d.ts +1 -1
  216. package/build/node/index.js +1 -1
  217. package/build/node/index.js.map +1 -1
  218. package/build/node/is-private-ip.d.ts +8 -4
  219. package/build/node/is-private-ip.fail-closed.test.d.ts +1 -0
  220. package/build/node/is-private-ip.fail-closed.test.js +36 -0
  221. package/build/node/is-private-ip.fail-closed.test.js.map +1 -0
  222. package/build/node/is-private-ip.js +77 -12
  223. package/build/node/is-private-ip.js.map +1 -1
  224. package/build/node/is-private-ip.test.js +28 -0
  225. package/build/node/is-private-ip.test.js.map +1 -1
  226. package/build/node/validate-public-url.d.ts +43 -11
  227. package/build/node/validate-public-url.js +68 -34
  228. package/build/node/validate-public-url.js.map +1 -1
  229. package/build/node/validate-public-url.test.js +161 -14
  230. package/build/node/validate-public-url.test.js.map +1 -1
  231. package/build/resolvers/errors.d.ts +36 -6
  232. package/build/resolvers/errors.js +41 -7
  233. package/build/resolvers/errors.js.map +1 -1
  234. package/build/resolvers/resolve-document-if-changed.test.js +7 -0
  235. package/build/resolvers/resolve-document-if-changed.test.js.map +1 -1
  236. package/build/resolvers/resolve-document.d.ts +29 -9
  237. package/build/resolvers/resolve-document.integration.test.d.ts +1 -0
  238. package/build/resolvers/resolve-document.integration.test.js +108 -0
  239. package/build/resolvers/resolve-document.integration.test.js.map +1 -0
  240. package/build/resolvers/resolve-document.js +129 -49
  241. package/build/resolvers/resolve-document.js.map +1 -1
  242. package/build/resolvers/resolve-document.test.js +462 -12
  243. package/build/resolvers/resolve-document.test.js.map +1 -1
  244. package/build/resolvers/resolve-json-document.d.ts +11 -8
  245. package/build/resolvers/resolve-json-document.js +7 -6
  246. package/build/resolvers/resolve-json-document.js.map +1 -1
  247. package/build/resolvers/resolve-json-document.test.js +21 -4
  248. package/build/resolvers/resolve-json-document.test.js.map +1 -1
  249. package/build/validation/describe-jsonld-failure.d.ts +48 -8
  250. package/build/validation/describe-jsonld-failure.js +94 -27
  251. package/build/validation/describe-jsonld-failure.js.map +1 -1
  252. package/build/validation/describe-jsonld-failure.test.js +98 -13
  253. package/build/validation/describe-jsonld-failure.test.js.map +1 -1
  254. package/build/validation/index.d.ts +3 -2
  255. package/build/validation/index.js +2 -2
  256. package/build/validation/index.js.map +1 -1
  257. package/build/validation/validate-jsonld.d.ts +29 -3
  258. package/build/validation/validate-jsonld.js +49 -22
  259. package/build/validation/validate-jsonld.js.map +1 -1
  260. package/build/validation/validate-jsonld.test.js +62 -5
  261. package/build/validation/validate-jsonld.test.js.map +1 -1
  262. package/package.json +23 -3
@@ -0,0 +1,119 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://untp.unece.org/schema/idr/linkset-schema",
4
+ "title": "UNTP linkset schema extending RFC 9264 with UNTP link object properties",
5
+ "description": "A linkset schema aligned with the GS1 resolver linkset schema (https://ref.gs1.org/standards/resolver/linkset-schema) and extended with UNTP-specific link object properties for versioning, access control, and link creation. A UNTP-conformant linkset that omits the UNTP extension properties will also validate against the GS1 schema.",
6
+ "type": "object",
7
+ "properties": {
8
+ "linkset": {
9
+ "description": "The linkset",
10
+ "type": "array",
11
+ "items": {
12
+ "type": "object",
13
+ "properties": {
14
+ "anchor": {
15
+ "description": "The URL at the root of the linkset, a.k.a the link context",
16
+ "type": "string",
17
+ "pattern": "^https?:\\/\\/[a-zA-Z0-9./]+"
18
+ },
19
+ "itemDescription": {
20
+ "name": "Item description",
21
+ "description": "A description of the item. Deprecated in favour of description.",
22
+ "type": "string"
23
+ },
24
+ "description": {
25
+ "name": "Description",
26
+ "description": "A description of the item. Preferred alternative to itemDescription.",
27
+ "type": "string"
28
+ }
29
+ },
30
+ "patternProperties": {
31
+ "(?!(anchor|itemDescription|description))^([a-z-]+$)|(^https?:\\/\\/[a-zA-Z0-9./]+$)": {
32
+ "title": "Link object schema",
33
+ "description": "The schema for each link context object for each link relation type. Link relation types are either IANA-registered short names (lowercase alphabetic with hyphens) or full URLs as defined in RFC 8288.",
34
+ "type": "array",
35
+ "items": {
36
+ "type": "object",
37
+ "properties": {
38
+ "href": {
39
+ "name": "href",
40
+ "description": "The target URL",
41
+ "type": "string",
42
+ "pattern": "^https?:\\/\\/[a-zA-Z0-9./]+"
43
+ },
44
+ "title": {
45
+ "title": "title",
46
+ "description": "A human-readable title for the link",
47
+ "type": "string"
48
+ },
49
+ "hreflang": {
50
+ "name": "hreflang",
51
+ "description": "The human language(s) of the target resource",
52
+ "type": "array",
53
+ "items": {
54
+ "type": "string",
55
+ "pattern": "(^\\w{2}$)|(^\\w{2}-\\w{2}$)"
56
+ }
57
+ },
58
+ "type": {
59
+ "name": "Type",
60
+ "description": "The content type (MIME type) of the target resource",
61
+ "type": "string",
62
+ "pattern": "\\w+/[-+.\\w]+"
63
+ },
64
+ "context": {
65
+ "name": "Context",
66
+ "description": "Any additional descriptor for the link, typically a geography or jurisdiction in which the link applies",
67
+ "type": "array"
68
+ },
69
+ "fwqs": {
70
+ "name": "Forward query strings",
71
+ "type": "boolean"
72
+ },
73
+ "public": {
74
+ "name": "Link can be shared publicly",
75
+ "type": "boolean"
76
+ },
77
+ "rel": {
78
+ "name": "Additional link relations",
79
+ "description": "An array of additional IANA or extension link relation types that qualify this link, such as predecessor-version or edit.",
80
+ "type": "array",
81
+ "items": {
82
+ "type": "string"
83
+ }
84
+ },
85
+ "method": {
86
+ "name": "HTTP method",
87
+ "description": "An array whose first element is the HTTP method (e.g. POST) and subsequent elements are required HTTP header names (e.g. X-API-Key). Used to describe how a client should interact with the target to create or update a linked resource.",
88
+ "type": "array",
89
+ "items": {
90
+ "type": "string"
91
+ }
92
+ },
93
+ "encryptionMethod": {
94
+ "name": "Encryption method",
95
+ "description": "The encryption algorithm used to protect the target resource (e.g. AES-128). Indicates that the target requires a decryption key or proof of authorised role to access.",
96
+ "type": "string"
97
+ },
98
+ "accessRole": {
99
+ "name": "Access roles",
100
+ "description": "An array of role identifiers that are authorised to access the encrypted target resource.",
101
+ "type": "array",
102
+ "items": {
103
+ "type": "string"
104
+ }
105
+ }
106
+ },
107
+ "required": ["href", "title"],
108
+ "additionalProperties": false
109
+ }
110
+ }
111
+ },
112
+ "required": ["anchor"],
113
+ "additionalProperties": false
114
+ }
115
+ }
116
+ },
117
+ "required": ["linkset"],
118
+ "additionalProperties": false
119
+ }
@@ -0,0 +1,318 @@
1
+ {
2
+ "$id": "https://www.w3.org/2022/credentials/v2/verifiable-credential-schema.json",
3
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
4
+ "description": "JSON Schema for a Verifiable Credential according to the Verifiable Credentials Data Model v2",
5
+ "type": "object",
6
+ "$defs": {
7
+ "type": {
8
+ "oneOf": [
9
+ {
10
+ "type": "string"
11
+ },
12
+ {
13
+ "type": "array",
14
+ "minItems": 1
15
+ }
16
+ ]
17
+ },
18
+ "credentialSubject": {
19
+ "type": "object",
20
+ "properties": {
21
+ "id": {
22
+ "type": "string"
23
+ }
24
+ },
25
+ "minProperties": 1
26
+ },
27
+ "credentialSchema": {
28
+ "type": "object",
29
+ "properties": {
30
+ "id": {
31
+ "type": "string"
32
+ },
33
+ "type": {
34
+ "$ref": "#/$defs/type"
35
+ }
36
+ },
37
+ "required": ["id", "type"],
38
+ "additionalProperties": true
39
+ },
40
+ "credentialStatus": {
41
+ "type": "object",
42
+ "properties": {
43
+ "id": {
44
+ "type": "string"
45
+ },
46
+ "type": {
47
+ "$ref": "#/$defs/type"
48
+ }
49
+ },
50
+ "required": ["type"],
51
+ "additionalProperties": true
52
+ },
53
+ "refreshService": {
54
+ "type": "object",
55
+ "properties": {
56
+ "id": {
57
+ "type": "string"
58
+ },
59
+ "type": {
60
+ "$ref": "#/$defs/type"
61
+ }
62
+ },
63
+ "required": ["id", "type"],
64
+ "additionalProperties": true
65
+ },
66
+ "termsOfUse": {
67
+ "type": "object",
68
+ "properties": {
69
+ "id": {
70
+ "type": "string"
71
+ },
72
+ "type": {
73
+ "$ref": "#/$defs/type"
74
+ }
75
+ },
76
+ "required": ["type"],
77
+ "additionalProperties": true
78
+ },
79
+ "evidence": {
80
+ "type": "object",
81
+ "properties": {
82
+ "id": {
83
+ "type": "string"
84
+ },
85
+ "type": {
86
+ "$ref": "#/$defs/type"
87
+ }
88
+ },
89
+ "required": ["type"],
90
+ "additionalProperties": true
91
+ },
92
+ "proof": {
93
+ "type": "object",
94
+ "properties": {
95
+ "type": {
96
+ "$ref": "#/$defs/type"
97
+ },
98
+ "proofPurpose": {
99
+ "type": "string"
100
+ },
101
+ "verificationMethod": {
102
+ "oneOf": [
103
+ {
104
+ "type": "string"
105
+ },
106
+ {
107
+ "type": "array",
108
+ "minItems": 1,
109
+ "items": {
110
+ "type": "object",
111
+ "properties": {
112
+ "id": {
113
+ "type": "string"
114
+ },
115
+ "type": {
116
+ "type": "string"
117
+ },
118
+ "controller": {
119
+ "type": "string"
120
+ }
121
+ },
122
+ "required": ["id", "type", "controller"],
123
+ "additionalProperties": true
124
+ }
125
+ }
126
+ ]
127
+ },
128
+ "created": {
129
+ "type": "string"
130
+ },
131
+ "domain": {
132
+ "type": "string"
133
+ },
134
+ "challenge": {
135
+ "type": "string"
136
+ },
137
+ "proofValue": {
138
+ "type": "string"
139
+ }
140
+ },
141
+ "required": ["type", "proofPurpose", "verificationMethod"],
142
+ "additionalProperties": true
143
+ }
144
+ },
145
+ "properties": {
146
+ "@context": {
147
+ "type": "array",
148
+ "contains": {
149
+ "const": "https://www.w3.org/ns/credentials/v2"
150
+ },
151
+ "minItems": 1,
152
+ "items": {
153
+ "oneOf": [
154
+ {
155
+ "type": "string",
156
+ "minLength": 1
157
+ },
158
+ {
159
+ "type": "object",
160
+ "minProperties": 1,
161
+ "propertyNames": {
162
+ "type": "string",
163
+ "minLength": 1
164
+ }
165
+ }
166
+ ]
167
+ },
168
+ "prefixItems": [
169
+ {
170
+ "const": "https://www.w3.org/ns/credentials/v2"
171
+ }
172
+ ],
173
+ "uniqueItems": true
174
+ },
175
+ "id": {
176
+ "type": "string"
177
+ },
178
+ "type": {
179
+ "oneOf": [
180
+ {
181
+ "type": "array",
182
+ "contains": {
183
+ "const": "VerifiableCredential"
184
+ }
185
+ },
186
+ {
187
+ "type": "string",
188
+ "enum": ["VerifiableCredential"]
189
+ }
190
+ ]
191
+ },
192
+ "issuer": {
193
+ "oneOf": [
194
+ {
195
+ "type": "string"
196
+ },
197
+ {
198
+ "type": "object",
199
+ "properties": {
200
+ "id": {
201
+ "type": "string"
202
+ }
203
+ },
204
+ "required": ["id"],
205
+ "additionalProperties": true
206
+ }
207
+ ]
208
+ },
209
+ "validFrom": {
210
+ "type": "string",
211
+ "pattern": "-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\.[0-9]+)?|(24:00:00(\\.0+)?))(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))"
212
+ },
213
+ "validUntil": {
214
+ "type": "string",
215
+ "pattern": "-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\.[0-9]+)?|(24:00:00(\\.0+)?))(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))"
216
+ },
217
+ "credentialSubject": {
218
+ "oneOf": [
219
+ {
220
+ "$ref": "#/$defs/credentialSubject"
221
+ },
222
+ {
223
+ "type": "array",
224
+ "items": {
225
+ "$ref": "#/$defs/credentialSubject"
226
+ },
227
+ "minItems": 1
228
+ }
229
+ ]
230
+ },
231
+ "credentialStatus": {
232
+ "oneOf": [
233
+ {
234
+ "$ref": "#/$defs/credentialStatus"
235
+ },
236
+ {
237
+ "type": "array",
238
+ "items": {
239
+ "$ref": "#/$defs/credentialStatus"
240
+ },
241
+ "minItems": 1
242
+ }
243
+ ]
244
+ },
245
+ "credentialSchema": {
246
+ "oneOf": [
247
+ {
248
+ "$ref": "#/$defs/credentialSchema"
249
+ },
250
+ {
251
+ "type": "array",
252
+ "items": {
253
+ "$ref": "#/$defs/credentialSchema"
254
+ },
255
+ "minItems": 1
256
+ }
257
+ ]
258
+ },
259
+ "refreshService": {
260
+ "oneOf": [
261
+ {
262
+ "$ref": "#/$defs/refreshService"
263
+ },
264
+ {
265
+ "type": "array",
266
+ "items": {
267
+ "$ref": "#/$defs/refreshService"
268
+ },
269
+ "minItems": 1
270
+ }
271
+ ]
272
+ },
273
+ "termsOfUse": {
274
+ "oneOf": [
275
+ {
276
+ "$ref": "#/$defs/termsOfUse"
277
+ },
278
+ {
279
+ "type": "array",
280
+ "items": {
281
+ "$ref": "#/$defs/termsOfUse"
282
+ },
283
+ "minItems": 1
284
+ }
285
+ ]
286
+ },
287
+ "evidence": {
288
+ "oneOf": [
289
+ {
290
+ "$ref": "#/$defs/evidence"
291
+ },
292
+ {
293
+ "type": "array",
294
+ "items": {
295
+ "$ref": "#/$defs/evidence"
296
+ },
297
+ "minItems": 1
298
+ }
299
+ ]
300
+ },
301
+ "proof": {
302
+ "oneOf": [
303
+ {
304
+ "$ref": "#/$defs/proof"
305
+ },
306
+ {
307
+ "type": "array",
308
+ "items": {
309
+ "$ref": "#/$defs/proof"
310
+ },
311
+ "minItems": 1
312
+ }
313
+ ]
314
+ }
315
+ },
316
+ "required": ["@context", "type", "issuer", "credentialSubject"],
317
+ "additionalProperties": true
318
+ }
@@ -21,8 +21,13 @@ export interface DetectVersionFromContextOptions {
21
21
  }
22
22
  /**
23
23
  * Derives the spec version from a UNTP document's `@context` by looking for a
24
- * path segment shaped `/{major}.{minor}.{patch}[-prerelease]/` inside a known
25
- * UNTP context URL.
24
+ * path segment shaped `/{major}.{minor}.{patch}[-prerelease]` inside a known
25
+ * UNTP context URL. Only the part of the URL before any `?` or `#` is read, so
26
+ * a version-shaped string inside a query or fragment never supplies the
27
+ * version, while a version that a query or fragment immediately follows still
28
+ * does. Within that part the segment must be bounded on the left by `/` and on
29
+ * the right by `/` or the end of the string. The published schema decides the
30
+ * exact context string that the document must use.
26
31
  *
27
32
  * Works for any UNTP artefact that publishes a versioned context: credentials
28
33
  * (DPP, DCC, DFR, DIA, DTE), conformity schemes, identifier scheme registers,
@@ -7,14 +7,24 @@
7
7
  export const UNTP_CONTEXT_DOMAINS = ['vocabulary.uncefact.org', 'test.uncefact.org'];
8
8
  /**
9
9
  * A version segment in a UNTP-published context path. Matches a path segment
10
- * shaped `/{major}.{minor}.{patch}[-prerelease]/`. The pre-release suffix
11
- * captures common forms (`-rc1`, `-alpha.2`, `-2024-05-21`, etc.).
10
+ * shaped `/{major}.{minor}.{patch}[-prerelease]` when it is bounded on the
11
+ * left by `/` and on the right by `/` or the end of the string. It is applied
12
+ * to the part of the URL before any `?` or `#`, so query and fragment parts
13
+ * never supply the version. The pre-release suffix captures common forms (`-rc1`, `-alpha.2`,
14
+ * `-2024-05-21`, etc.).
15
+ * This identifies only the version; the published schema decides the exact
16
+ * context string.
12
17
  */
13
- const UNTP_VERSION_PATH_SEGMENT = /\/(\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?)\//;
18
+ const UNTP_VERSION_PATH_SEGMENT = /\/(\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?)(?=\/|$)/;
14
19
  /**
15
20
  * Derives the spec version from a UNTP document's `@context` by looking for a
16
- * path segment shaped `/{major}.{minor}.{patch}[-prerelease]/` inside a known
17
- * UNTP context URL.
21
+ * path segment shaped `/{major}.{minor}.{patch}[-prerelease]` inside a known
22
+ * UNTP context URL. Only the part of the URL before any `?` or `#` is read, so
23
+ * a version-shaped string inside a query or fragment never supplies the
24
+ * version, while a version that a query or fragment immediately follows still
25
+ * does. Within that part the segment must be bounded on the left by `/` and on
26
+ * the right by `/` or the end of the string. The published schema decides the
27
+ * exact context string that the document must use.
18
28
  *
19
29
  * Works for any UNTP artefact that publishes a versioned context: credentials
20
30
  * (DPP, DCC, DFR, DIA, DTE), conformity schemes, identifier scheme registers,
@@ -46,7 +56,8 @@ export function detectVersionFromContext(doc, options = {}) {
46
56
  if (!matchesDomain(url)) {
47
57
  continue;
48
58
  }
49
- const match = url.match(UNTP_VERSION_PATH_SEGMENT);
59
+ const path = url.split(/[?#]/, 1)[0];
60
+ const match = path.match(UNTP_VERSION_PATH_SEGMENT);
50
61
  if (match) {
51
62
  return match[1];
52
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"detect-version-from-context.js","sourceRoot":"","sources":["../../src/artefacts/detect-version-from-context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,yBAAyB,EAAE,mBAAmB,CAAU,CAAC;AAE9F;;;;GAIG;AACH,MAAM,yBAAyB,GAAG,yCAAyC,CAAC;AAiB5E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,wBAAwB,CACtC,GAAY,EACZ,UAA2C,EAAE;IAE7C,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QACpC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,YAAY,GAAI,GAAgC,CAAC,UAAU,CAAC,CAAC;IACnE,MAAM,UAAU,GAAG,qBAAqB,CAAC,YAAY,CAAC,CAAC;IACvD,MAAM,aAAa,GAAG,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAEzD,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAC7B,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC;YACxB,SAAS;QACX,CAAC;QACD,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;QACnD,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,qBAAqB,CAAC,OAAgB;IAC7C,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,OAAO,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,MAAM,GAAG,GAAa,EAAE,CAAC;QACzB,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC9B,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAClB,CAAC;QACH,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,SAAS,kBAAkB,CAAC,MAA0B;IACpD,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AACpE,CAAC"}
1
+ {"version":3,"file":"detect-version-from-context.js","sourceRoot":"","sources":["../../src/artefacts/detect-version-from-context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,yBAAyB,EAAE,mBAAmB,CAAU,CAAC;AAE9F;;;;;;;;;GASG;AACH,MAAM,yBAAyB,GAAG,+CAA+C,CAAC;AAiBlF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,UAAU,wBAAwB,CACtC,GAAY,EACZ,UAA2C,EAAE;IAE7C,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QACpC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,YAAY,GAAI,GAAgC,CAAC,UAAU,CAAC,CAAC;IACnE,MAAM,UAAU,GAAG,qBAAqB,CAAC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GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AACpE,CAAC"}
@@ -15,6 +15,61 @@ describe('detectVersionFromContext', () => {
15
15
  const doc = { '@context': 'https://vocabulary.uncefact.org/untp/0.7.0-rc.1/context/' };
16
16
  expect(detectVersionFromContext(doc)).toBe('0.7.0-rc.1');
17
17
  });
18
+ it('returns the version when it is the terminal path segment without a trailing slash', () => {
19
+ const doc = { '@context': 'https://test.uncefact.org/vocabulary/untp/dpp/0.5.0' };
20
+ expect(detectVersionFromContext(doc)).toBe('0.5.0');
21
+ });
22
+ it('recognises a terminal pre-release version without a trailing slash', () => {
23
+ const doc = { '@context': 'https://vocabulary.uncefact.org/untp/0.7.0-rc.1' };
24
+ expect(detectVersionFromContext(doc)).toBe('0.7.0-rc.1');
25
+ });
26
+ it('uses the first version-shaped path segment', () => {
27
+ // The first version-shaped segment wins when a later path segment also looks like a version.
28
+ const doc = { '@context': 'https://vocabulary.uncefact.org/untp/0.6.0/dpp/0.7.0/' };
29
+ expect(detectVersionFromContext(doc)).toBe('0.6.0');
30
+ });
31
+ it('ignores a version-shaped path in a query', () => {
32
+ const doc = { '@context': 'https://vocabulary.uncefact.org/untp/context?path=/0.7.0' };
33
+ expect(detectVersionFromContext(doc)).toBeUndefined();
34
+ });
35
+ it('ignores a version-shaped path in a fragment', () => {
36
+ const doc = { '@context': 'https://vocabulary.uncefact.org/untp/context#path=/0.7.0' };
37
+ expect(detectVersionFromContext(doc)).toBeUndefined();
38
+ });
39
+ it('uses a genuine pathname version after a query-only context entry', () => {
40
+ const doc = {
41
+ '@context': [
42
+ 'https://vocabulary.uncefact.org/untp/context?path=/0.7.0',
43
+ 'https://vocabulary.uncefact.org/untp/0.6.0/context/',
44
+ ],
45
+ };
46
+ expect(detectVersionFromContext(doc)).toBe('0.6.0');
47
+ });
48
+ it('recognises a version bounded by a query string', () => {
49
+ const doc = { '@context': 'https://test.uncefact.org/vocabulary/untp/dpp/0.5.0?format=json' };
50
+ expect(detectVersionFromContext(doc)).toBe('0.5.0');
51
+ });
52
+ it('recognises a version bounded by a fragment', () => {
53
+ const doc = { '@context': 'https://test.uncefact.org/vocabulary/untp/dpp/0.5.0#context' };
54
+ expect(detectVersionFromContext(doc)).toBe('0.5.0');
55
+ });
56
+ it('rejects a version with a trailing dot', () => {
57
+ const doc = { '@context': 'https://test.uncefact.org/vocabulary/untp/dpp/0.5.0./' };
58
+ expect(detectVersionFromContext(doc)).toBeUndefined();
59
+ });
60
+ it('rejects a four-part version', () => {
61
+ const doc = { '@context': 'https://test.uncefact.org/vocabulary/untp/dpp/0.5.0.1/' };
62
+ expect(detectVersionFromContext(doc)).toBeUndefined();
63
+ });
64
+ it('does not detect a filename-shaped version on an unrelated domain', () => {
65
+ const doc = { '@context': 'https://example.org/untp/0.5.0-rc.1.jsonld' };
66
+ expect(detectVersionFromContext(doc)).toBeUndefined();
67
+ });
68
+ it('keeps the complete filename-shaped suffix when the domain is recognised', () => {
69
+ // SemVer permits dotted prerelease identifiers, so the detector cannot tell a filename extension from a prerelease part; no published UNTP context has this shape.
70
+ const doc = { '@context': 'https://vocabulary.uncefact.org/untp/0.5.0-rc.1.jsonld' };
71
+ expect(detectVersionFromContext(doc)).toBe('0.5.0-rc.1.jsonld');
72
+ });
18
73
  it('recognises the test.uncefact.org domain', () => {
19
74
  const doc = { '@context': 'https://test.uncefact.org/untp/0.7.0/context/' };
20
75
  expect(detectVersionFromContext(doc)).toBe('0.7.0');
@@ -23,6 +78,10 @@ describe('detectVersionFromContext', () => {
23
78
  const doc = { '@context': ['https://schema.org/', 'https://example.com/0.7.0/'] };
24
79
  expect(detectVersionFromContext(doc)).toBeUndefined();
25
80
  });
81
+ it('does not recognise a filename-embedded version', () => {
82
+ const doc = { '@context': 'https://aatp.foodagility.com/context/aatp-dlp-context-0.4.0.jsonld' };
83
+ expect(detectVersionFromContext(doc, { domain: 'aatp.foodagility.com' })).toBeUndefined();
84
+ });
26
85
  it('skips non-string entries within an array @context', () => {
27
86
  const doc = {
28
87
  '@context': [{ '@vocab': 'https://example.com/' }, 'https://vocabulary.uncefact.org/untp/0.7.0/context/'],
@@ -1 +1 @@
1
- {"version":3,"file":"detect-version-from-context.test.js","sourceRoot":"","sources":["../../src/artefacts/detect-version-from-context.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,QAAQ,CAAC,6CAA6C,EAAE,GAAG,EAAE;QAC3D,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;YAC3D,MAAM,GAAG,GAAG,EAAE,UAAU,EAAE,qDAAqD,EAAE,CAAC;YAClF,MAAM,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,0EAA0E,EAAE,GAAG,EAAE;YAClF,MAAM,GAAG,GAAG;gBACV,UAAU,EAAE,CAAC,sCAAsC,EAAE,qDAAqD,CAAC;aAC5G,CAAC;YACF,MAAM,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE;YACzC,MAAM,GAAG,GAAG,EAAE,UAAU,EAAE,0DAA0D,EAAE,CAAC;YACvF,MAAM,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;YACjD,MAAM,GAAG,GAAG,EAAE,UAAU,EAAE,+CAA+C,EAAE,CAAC;YAC5E,MAAM,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtD,CAAC,CAAC,CA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,GAAG,EAAE;YACpD,MAAM,CAAC,wBAAwB,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;QACvD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;YAChD,MAAM,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;YACvD,MAAM,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;YAC5D,MAAM,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;YAC7D,MAAM,CAAC,wBAAwB,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;QACvD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,EAAE,CAAC,wDAAwD,EAAE,GAAG,EAAE;YAChE,MAAM,GAAG,GAAG,EAAE,UAAU,EAAE,sDAAsD,EAAE,CAAC;YACnF,MAAM,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;QACxD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"detect-version-from-context.test.js","sourceRoot":"","sources":["../../src/artefacts/detect-version-from-context.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,QAAQ,CAAC,6CAA6C,EAAE,GAAG,EAAE;QAC3D,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;YAC3D,MAAM,GAAG,GAAG,EAAE,UAAU,EAAE,qDAAqD,EAAE,CAAC;YAClF,MAAM,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CA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AE,CAAC,wCAAwC,EAAE,GAAG,EAAE;YAChD,MAAM,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;YACvD,MAAM,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;YAC5D,MAAM,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;YAC7D,MAAM,CAAC,wBAAwB,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;QACvD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,EAAE,CAAC,wDAAwD,EAAE,GAAG,EAAE;YAChE,MAAM,GAAG,GAAG,EAAE,UAAU,EAAE,sDAAsD,EAAE,CAAC;YACnF,MAAM,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;QACxD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -74,6 +74,13 @@ export interface UntpArtefactUrls {
74
74
  * `ConformityScheme`). Must be a recognised type.
75
75
  * @param version - Semantic version of the artefact (e.g. `0.7.0`).
76
76
  * @returns The {@link UntpArtefactUrls} appropriate for the version.
77
- * @throws {Error} When `type` is not a recognised UNTP artefact type.
77
+ * @throws {Error} When `type` is not a recognised UNTP artefact type, or when `type` is
78
+ * `ConformityScheme` and `version` is before 0.7.0.
78
79
  */
79
80
  export declare function buildUntpArtefactUrls(type: string, version: string): UntpArtefactUrls;
81
+ /**
82
+ * The published Identity Resolver link set schema URL for a UNTP version. The schema exists from
83
+ * 0.7.0 under the artefacts layout only (`/idr/LinksetSchema.json`); no legacy per-type form ever
84
+ * existed, so this is a single layout rather than a version switch.
85
+ */
86
+ export declare function buildLinkSetSchemaUrl(version: string): string;
@@ -91,10 +91,10 @@ const DOCS_VERSION_FALLBACKS = {
91
91
  * @throws {Error} When `type` is not a recognised UNTP artefact type.
92
92
  */
93
93
  export function buildSpecificationPageUrl(type, version) {
94
- const slug = UNTP_SPECIFICATION_PAGE_SLUGS[type];
95
- if (!slug) {
94
+ if (!Object.hasOwn(UNTP_SPECIFICATION_PAGE_SLUGS, type)) {
96
95
  throw new Error(`Unknown UNTP artefact type "${type}". Expected one of: ${Object.keys(UNTP_SPECIFICATION_PAGE_SLUGS).join(', ')}.`);
97
96
  }
97
+ const slug = UNTP_SPECIFICATION_PAGE_SLUGS[type];
98
98
  const docsVersion = DOCS_VERSION_FALLBACKS[version] ?? version;
99
99
  if (docsVersion === CURRENT_UNTP_DOCS_VERSION) {
100
100
  return `${DOCS_BASE}/specification/${slug}`;
@@ -111,13 +111,17 @@ export function buildSpecificationPageUrl(type, version) {
111
111
  * `ConformityScheme`). Must be a recognised type.
112
112
  * @param version - Semantic version of the artefact (e.g. `0.7.0`).
113
113
  * @returns The {@link UntpArtefactUrls} appropriate for the version.
114
- * @throws {Error} When `type` is not a recognised UNTP artefact type.
114
+ * @throws {Error} When `type` is not a recognised UNTP artefact type, or when `type` is
115
+ * `ConformityScheme` and `version` is before 0.7.0.
115
116
  */
116
117
  export function buildUntpArtefactUrls(type, version) {
117
- const shortCode = UNTP_SHORT_CREDENTIAL_TYPES[type];
118
- if (!shortCode) {
118
+ if (!Object.hasOwn(UNTP_SHORT_CREDENTIAL_TYPES, type)) {
119
119
  throw new Error(`Unknown UNTP artefact type "${type}". Expected one of: ${Object.keys(UNTP_SHORT_CREDENTIAL_TYPES).join(', ')}.`);
120
120
  }
121
+ const shortCode = UNTP_SHORT_CREDENTIAL_TYPES[type];
122
+ if (type === 'ConformityScheme' && !isV070OrAbove(version)) {
123
+ throw new Error(`ConformityScheme has no artefacts for versions before UNTP 0.7.0 and "${version}" is not a UNTP 0.7.0 or later version.`);
124
+ }
121
125
  if (isV070OrAbove(version)) {
122
126
  const fileName = UNTP_CORE_SCHEMA_FILENAMES[type];
123
127
  return {
@@ -130,4 +134,12 @@ export function buildUntpArtefactUrls(type, version) {
130
134
  contextUrl: `${LEGACY_BASE}/${shortCode}/${version}/context/`,
131
135
  };
132
136
  }
137
+ /**
138
+ * The published Identity Resolver link set schema URL for a UNTP version. The schema exists from
139
+ * 0.7.0 under the artefacts layout only (`/idr/LinksetSchema.json`); no legacy per-type form ever
140
+ * existed, so this is a single layout rather than a version switch.
141
+ */
142
+ export function buildLinkSetSchemaUrl(version) {
143
+ return `${ARTEFACTS_SCHEMA_BASE}/v${version}/idr/LinksetSchema.json`;
144
+ }
133
145
  //# sourceMappingURL=urls.js.map