@uncefact/untp-utils 0.1.0 → 0.3.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.
- package/README.md +52 -2
- package/artefacts/context/untp/0.6.0/dcc.json +1241 -0
- package/artefacts/context/untp/0.6.0/dfr.json +619 -0
- package/artefacts/context/untp/0.6.0/dia.json +162 -0
- package/artefacts/context/untp/0.6.0/dpp.json +1078 -0
- package/artefacts/context/untp/0.6.0/dte.json +1285 -0
- package/artefacts/context/untp/0.6.1/dcc.json +1388 -0
- package/artefacts/context/untp/0.6.1/dfr.json +690 -0
- package/artefacts/context/untp/0.6.1/dia.json +196 -0
- package/artefacts/context/untp/0.6.1/dpp.json +1164 -0
- package/artefacts/context/untp/0.6.1/dte.json +1340 -0
- package/artefacts/context/untp/0.7.0/untp.json +3493 -0
- package/artefacts/context/vcdm/2/credentials.json +301 -0
- package/artefacts/manifest.json +214 -0
- package/artefacts/schema/untp/0.6.0/dcc.json +1131 -0
- package/artefacts/schema/untp/0.6.0/dfr.json +1028 -0
- package/artefacts/schema/untp/0.6.0/dia.json +236 -0
- package/artefacts/schema/untp/0.6.0/dpp.json +1219 -0
- package/artefacts/schema/untp/0.6.0/dte.json +845 -0
- package/artefacts/schema/untp/0.6.1/dcc.json +1196 -0
- package/artefacts/schema/untp/0.6.1/dfr.json +1037 -0
- package/artefacts/schema/untp/0.6.1/dia.json +236 -0
- package/artefacts/schema/untp/0.6.1/dpp.json +1229 -0
- package/artefacts/schema/untp/0.6.1/dte.json +845 -0
- package/artefacts/schema/untp/0.7.0/cvc.json +701 -0
- package/artefacts/schema/untp/0.7.0/dcc.json +1133 -0
- package/artefacts/schema/untp/0.7.0/dfr.json +1245 -0
- package/artefacts/schema/untp/0.7.0/dia.json +443 -0
- package/artefacts/schema/untp/0.7.0/dpp.json +1300 -0
- package/artefacts/schema/untp/0.7.0/dte.json +1226 -0
- package/artefacts/schema/untp/0.7.0/linkset.json +119 -0
- package/artefacts/schema/vcdm/2/verifiable-credential.json +318 -0
- package/build/artefacts/detect-version-from-context.d.ts +46 -0
- package/build/artefacts/detect-version-from-context.js +77 -0
- package/build/artefacts/detect-version-from-context.js.map +1 -0
- package/build/artefacts/detect-version-from-context.test.d.ts +1 -0
- package/build/artefacts/detect-version-from-context.test.js +69 -0
- package/build/artefacts/detect-version-from-context.test.js.map +1 -0
- package/build/artefacts/index.d.ts +3 -0
- package/build/artefacts/index.js +4 -0
- package/build/artefacts/index.js.map +1 -0
- package/build/artefacts/urls.d.ts +85 -0
- package/build/artefacts/urls.js +141 -0
- package/build/artefacts/urls.js.map +1 -0
- package/build/artefacts/urls.test.d.ts +1 -0
- package/build/artefacts/urls.test.js +99 -0
- package/build/artefacts/urls.test.js.map +1 -0
- package/build/artefacts/version.d.ts +9 -0
- package/build/artefacts/version.js +17 -0
- package/build/artefacts/version.js.map +1 -0
- package/build/artefacts/version.test.d.ts +1 -0
- package/build/artefacts/version.test.js +16 -0
- package/build/artefacts/version.test.js.map +1 -0
- package/build/bundle/artefacts/context/untp/0.6.0/dcc.d.ts +2 -0
- package/build/bundle/artefacts/context/untp/0.6.0/dcc.js +1244 -0
- package/build/bundle/artefacts/context/untp/0.6.0/dcc.js.map +1 -0
- package/build/bundle/artefacts/context/untp/0.6.0/dfr.d.ts +2 -0
- package/build/bundle/artefacts/context/untp/0.6.0/dfr.js +622 -0
- package/build/bundle/artefacts/context/untp/0.6.0/dfr.js.map +1 -0
- package/build/bundle/artefacts/context/untp/0.6.0/dia.d.ts +2 -0
- package/build/bundle/artefacts/context/untp/0.6.0/dia.js +165 -0
- package/build/bundle/artefacts/context/untp/0.6.0/dia.js.map +1 -0
- package/build/bundle/artefacts/context/untp/0.6.0/dpp.d.ts +2 -0
- package/build/bundle/artefacts/context/untp/0.6.0/dpp.js +1081 -0
- package/build/bundle/artefacts/context/untp/0.6.0/dpp.js.map +1 -0
- package/build/bundle/artefacts/context/untp/0.6.0/dte.d.ts +2 -0
- package/build/bundle/artefacts/context/untp/0.6.0/dte.js +1288 -0
- package/build/bundle/artefacts/context/untp/0.6.0/dte.js.map +1 -0
- package/build/bundle/artefacts/context/untp/0.6.1/dcc.d.ts +2 -0
- package/build/bundle/artefacts/context/untp/0.6.1/dcc.js +1391 -0
- package/build/bundle/artefacts/context/untp/0.6.1/dcc.js.map +1 -0
- package/build/bundle/artefacts/context/untp/0.6.1/dfr.d.ts +2 -0
- package/build/bundle/artefacts/context/untp/0.6.1/dfr.js +693 -0
- package/build/bundle/artefacts/context/untp/0.6.1/dfr.js.map +1 -0
- package/build/bundle/artefacts/context/untp/0.6.1/dia.d.ts +2 -0
- package/build/bundle/artefacts/context/untp/0.6.1/dia.js +199 -0
- package/build/bundle/artefacts/context/untp/0.6.1/dia.js.map +1 -0
- package/build/bundle/artefacts/context/untp/0.6.1/dpp.d.ts +2 -0
- package/build/bundle/artefacts/context/untp/0.6.1/dpp.js +1167 -0
- package/build/bundle/artefacts/context/untp/0.6.1/dpp.js.map +1 -0
- package/build/bundle/artefacts/context/untp/0.6.1/dte.d.ts +2 -0
- package/build/bundle/artefacts/context/untp/0.6.1/dte.js +1343 -0
- package/build/bundle/artefacts/context/untp/0.6.1/dte.js.map +1 -0
- package/build/bundle/artefacts/context/untp/0.7.0/untp.d.ts +2 -0
- package/build/bundle/artefacts/context/untp/0.7.0/untp.js +3496 -0
- package/build/bundle/artefacts/context/untp/0.7.0/untp.js.map +1 -0
- package/build/bundle/artefacts/context/vcdm/2/credentials.d.ts +2 -0
- package/build/bundle/artefacts/context/vcdm/2/credentials.js +304 -0
- package/build/bundle/artefacts/context/vcdm/2/credentials.js.map +1 -0
- package/build/bundle/artefacts/schema/untp/0.6.0/dcc.d.ts +2 -0
- package/build/bundle/artefacts/schema/untp/0.6.0/dcc.js +1134 -0
- package/build/bundle/artefacts/schema/untp/0.6.0/dcc.js.map +1 -0
- package/build/bundle/artefacts/schema/untp/0.6.0/dfr.d.ts +2 -0
- package/build/bundle/artefacts/schema/untp/0.6.0/dfr.js +1031 -0
- package/build/bundle/artefacts/schema/untp/0.6.0/dfr.js.map +1 -0
- package/build/bundle/artefacts/schema/untp/0.6.0/dia.d.ts +2 -0
- package/build/bundle/artefacts/schema/untp/0.6.0/dia.js +239 -0
- package/build/bundle/artefacts/schema/untp/0.6.0/dia.js.map +1 -0
- package/build/bundle/artefacts/schema/untp/0.6.0/dpp.d.ts +2 -0
- package/build/bundle/artefacts/schema/untp/0.6.0/dpp.js +1222 -0
- package/build/bundle/artefacts/schema/untp/0.6.0/dpp.js.map +1 -0
- package/build/bundle/artefacts/schema/untp/0.6.0/dte.d.ts +2 -0
- package/build/bundle/artefacts/schema/untp/0.6.0/dte.js +848 -0
- package/build/bundle/artefacts/schema/untp/0.6.0/dte.js.map +1 -0
- package/build/bundle/artefacts/schema/untp/0.6.1/dcc.d.ts +2 -0
- package/build/bundle/artefacts/schema/untp/0.6.1/dcc.js +1199 -0
- package/build/bundle/artefacts/schema/untp/0.6.1/dcc.js.map +1 -0
- package/build/bundle/artefacts/schema/untp/0.6.1/dfr.d.ts +2 -0
- package/build/bundle/artefacts/schema/untp/0.6.1/dfr.js +1040 -0
- package/build/bundle/artefacts/schema/untp/0.6.1/dfr.js.map +1 -0
- package/build/bundle/artefacts/schema/untp/0.6.1/dia.d.ts +2 -0
- package/build/bundle/artefacts/schema/untp/0.6.1/dia.js +239 -0
- package/build/bundle/artefacts/schema/untp/0.6.1/dia.js.map +1 -0
- package/build/bundle/artefacts/schema/untp/0.6.1/dpp.d.ts +2 -0
- package/build/bundle/artefacts/schema/untp/0.6.1/dpp.js +1232 -0
- package/build/bundle/artefacts/schema/untp/0.6.1/dpp.js.map +1 -0
- package/build/bundle/artefacts/schema/untp/0.6.1/dte.d.ts +2 -0
- package/build/bundle/artefacts/schema/untp/0.6.1/dte.js +848 -0
- package/build/bundle/artefacts/schema/untp/0.6.1/dte.js.map +1 -0
- package/build/bundle/artefacts/schema/untp/0.7.0/cvc.d.ts +2 -0
- package/build/bundle/artefacts/schema/untp/0.7.0/cvc.js +704 -0
- package/build/bundle/artefacts/schema/untp/0.7.0/cvc.js.map +1 -0
- package/build/bundle/artefacts/schema/untp/0.7.0/dcc.d.ts +2 -0
- package/build/bundle/artefacts/schema/untp/0.7.0/dcc.js +1136 -0
- package/build/bundle/artefacts/schema/untp/0.7.0/dcc.js.map +1 -0
- package/build/bundle/artefacts/schema/untp/0.7.0/dfr.d.ts +2 -0
- package/build/bundle/artefacts/schema/untp/0.7.0/dfr.js +1248 -0
- package/build/bundle/artefacts/schema/untp/0.7.0/dfr.js.map +1 -0
- package/build/bundle/artefacts/schema/untp/0.7.0/dia.d.ts +2 -0
- package/build/bundle/artefacts/schema/untp/0.7.0/dia.js +446 -0
- package/build/bundle/artefacts/schema/untp/0.7.0/dia.js.map +1 -0
- package/build/bundle/artefacts/schema/untp/0.7.0/dpp.d.ts +2 -0
- package/build/bundle/artefacts/schema/untp/0.7.0/dpp.js +1303 -0
- package/build/bundle/artefacts/schema/untp/0.7.0/dpp.js.map +1 -0
- package/build/bundle/artefacts/schema/untp/0.7.0/dte.d.ts +2 -0
- package/build/bundle/artefacts/schema/untp/0.7.0/dte.js +1229 -0
- package/build/bundle/artefacts/schema/untp/0.7.0/dte.js.map +1 -0
- package/build/bundle/artefacts/schema/untp/0.7.0/linkset.d.ts +2 -0
- package/build/bundle/artefacts/schema/untp/0.7.0/linkset.js +122 -0
- package/build/bundle/artefacts/schema/untp/0.7.0/linkset.js.map +1 -0
- package/build/bundle/artefacts/schema/vcdm/2/verifiable-credential.d.ts +2 -0
- package/build/bundle/artefacts/schema/vcdm/2/verifiable-credential.js +321 -0
- package/build/bundle/artefacts/schema/vcdm/2/verifiable-credential.js.map +1 -0
- package/build/bundle/fallback.d.ts +41 -0
- package/build/bundle/fallback.js +62 -0
- package/build/bundle/fallback.js.map +1 -0
- package/build/bundle/fallback.test.d.ts +1 -0
- package/build/bundle/fallback.test.js +124 -0
- package/build/bundle/fallback.test.js.map +1 -0
- package/build/bundle/index.d.ts +4 -0
- package/build/bundle/index.js +77 -0
- package/build/bundle/index.js.map +1 -0
- package/build/bundle/lookup.d.ts +14 -0
- package/build/bundle/lookup.js +40 -0
- package/build/bundle/lookup.js.map +1 -0
- package/build/bundle/lookup.test.d.ts +1 -0
- package/build/bundle/lookup.test.js +70 -0
- package/build/bundle/lookup.test.js.map +1 -0
- package/build/bundle/public.d.ts +25 -0
- package/build/bundle/public.js +56 -0
- package/build/bundle/public.js.map +1 -0
- package/build/bundle/public.test.d.ts +1 -0
- package/build/bundle/public.test.js +35 -0
- package/build/bundle/public.test.js.map +1 -0
- package/build/bundle/refresh-classify.test.d.ts +1 -0
- package/build/bundle/refresh-classify.test.js +20 -0
- package/build/bundle/refresh-classify.test.js.map +1 -0
- package/build/bundle/refresh-main.test.d.ts +1 -0
- package/build/bundle/refresh-main.test.js +98 -0
- package/build/bundle/refresh-main.test.js.map +1 -0
- package/build/cache/in-memory-ttl-cache.d.ts +2 -0
- package/build/cache/in-memory-ttl-cache.js +76 -0
- package/build/cache/in-memory-ttl-cache.js.map +1 -0
- package/build/cache/in-memory-ttl-cache.test.d.ts +1 -0
- package/build/cache/in-memory-ttl-cache.test.js +236 -0
- package/build/cache/in-memory-ttl-cache.test.js.map +1 -0
- package/build/cache/index.d.ts +2 -0
- package/build/cache/index.js +2 -0
- package/build/cache/index.js.map +1 -0
- package/build/cache/ttl-cache.d.ts +22 -0
- package/build/cache/ttl-cache.js +2 -0
- package/build/cache/ttl-cache.js.map +1 -0
- package/build/common/as-date-time.d.ts +13 -0
- package/build/common/as-date-time.js +44 -0
- package/build/common/as-date-time.js.map +1 -0
- package/build/common/as-date-time.test.d.ts +1 -0
- package/build/common/as-date-time.test.js +42 -0
- package/build/common/as-date-time.test.js.map +1 -0
- package/build/common/as-non-empty-string.d.ts +14 -0
- package/build/common/as-non-empty-string.js +20 -0
- package/build/common/as-non-empty-string.js.map +1 -0
- package/build/common/as-non-empty-string.test.d.ts +1 -0
- package/build/common/as-non-empty-string.test.js +30 -0
- package/build/common/as-non-empty-string.test.js.map +1 -0
- package/build/common/index.d.ts +4 -0
- package/build/common/index.js +5 -0
- package/build/common/index.js.map +1 -0
- package/build/common/require-string.d.ts +12 -0
- package/build/common/require-string.js +27 -0
- package/build/common/require-string.js.map +1 -0
- package/build/common/require-string.test.d.ts +1 -0
- package/build/common/require-string.test.js +53 -0
- package/build/common/require-string.test.js.map +1 -0
- package/build/common/validity-window.d.ts +45 -0
- package/build/common/validity-window.js +68 -0
- package/build/common/validity-window.js.map +1 -0
- package/build/common/validity-window.test.d.ts +1 -0
- package/build/common/validity-window.test.js +67 -0
- package/build/common/validity-window.test.js.map +1 -0
- package/build/conformity-vocabulary/codes.d.ts +10 -0
- package/build/conformity-vocabulary/codes.js +10 -0
- package/build/conformity-vocabulary/codes.js.map +1 -0
- package/build/conformity-vocabulary/errors.d.ts +44 -0
- package/build/conformity-vocabulary/errors.js +68 -0
- package/build/conformity-vocabulary/errors.js.map +1 -0
- package/build/conformity-vocabulary/index.d.ts +6 -0
- package/build/conformity-vocabulary/index.js +7 -0
- package/build/conformity-vocabulary/index.js.map +1 -0
- package/build/conformity-vocabulary/parse-conformity-catalogue.d.ts +26 -0
- package/build/conformity-vocabulary/parse-conformity-catalogue.js +106 -0
- package/build/conformity-vocabulary/parse-conformity-catalogue.js.map +1 -0
- package/build/conformity-vocabulary/parse-conformity-catalogue.test.d.ts +1 -0
- package/build/conformity-vocabulary/parse-conformity-catalogue.test.js +327 -0
- package/build/conformity-vocabulary/parse-conformity-catalogue.test.js.map +1 -0
- package/build/conformity-vocabulary/parse-conformity-scheme.d.ts +28 -0
- package/build/conformity-vocabulary/parse-conformity-scheme.js +47 -0
- package/build/conformity-vocabulary/parse-conformity-scheme.js.map +1 -0
- package/build/conformity-vocabulary/parse-conformity-scheme.test.d.ts +1 -0
- package/build/conformity-vocabulary/parse-conformity-scheme.test.js +284 -0
- package/build/conformity-vocabulary/parse-conformity-scheme.test.js.map +1 -0
- package/build/conformity-vocabulary/parsers/v0-7-0.parser.d.ts +19 -0
- package/build/conformity-vocabulary/parsers/v0-7-0.parser.js +219 -0
- package/build/conformity-vocabulary/parsers/v0-7-0.parser.js.map +1 -0
- package/build/conformity-vocabulary/types.d.ts +180 -0
- package/build/conformity-vocabulary/types.js +2 -0
- package/build/conformity-vocabulary/types.js.map +1 -0
- package/build/conformity-vocabulary/validate-conformity-claim.d.ts +26 -0
- package/build/conformity-vocabulary/validate-conformity-claim.js +165 -0
- package/build/conformity-vocabulary/validate-conformity-claim.js.map +1 -0
- package/build/conformity-vocabulary/validate-conformity-claim.test.d.ts +1 -0
- package/build/conformity-vocabulary/validate-conformity-claim.test.js +478 -0
- package/build/conformity-vocabulary/validate-conformity-claim.test.js.map +1 -0
- package/build/http-headers/index.d.ts +5 -0
- package/build/http-headers/index.js +6 -0
- package/build/http-headers/index.js.map +1 -0
- package/build/http-headers/is-safe-header-value.d.ts +10 -0
- package/build/http-headers/is-safe-header-value.js +15 -0
- package/build/http-headers/is-safe-header-value.js.map +1 -0
- package/build/http-headers/is-safe-header-value.test.d.ts +1 -0
- package/build/http-headers/is-safe-header-value.test.js +37 -0
- package/build/http-headers/is-safe-header-value.test.js.map +1 -0
- package/build/http-headers/parse-entity-tag.d.ts +9 -0
- package/build/http-headers/parse-entity-tag.js +18 -0
- package/build/http-headers/parse-entity-tag.js.map +1 -0
- package/build/http-headers/parse-entity-tag.test.d.ts +1 -0
- package/build/http-headers/parse-entity-tag.test.js +41 -0
- package/build/http-headers/parse-entity-tag.test.js.map +1 -0
- package/build/http-headers/parse-imf-date.d.ts +13 -0
- package/build/http-headers/parse-imf-date.js +23 -0
- package/build/http-headers/parse-imf-date.js.map +1 -0
- package/build/http-headers/parse-imf-date.test.d.ts +1 -0
- package/build/http-headers/parse-imf-date.test.js +31 -0
- package/build/http-headers/parse-imf-date.test.js.map +1 -0
- package/build/http-headers/parse-media-type.d.ts +8 -0
- package/build/http-headers/parse-media-type.js +21 -0
- package/build/http-headers/parse-media-type.js.map +1 -0
- package/build/http-headers/parse-media-type.test.d.ts +1 -0
- package/build/http-headers/parse-media-type.test.js +39 -0
- package/build/http-headers/parse-media-type.test.js.map +1 -0
- package/build/http-headers/user-agent.d.ts +35 -0
- package/build/http-headers/user-agent.js +45 -0
- package/build/http-headers/user-agent.js.map +1 -0
- package/build/http-headers/user-agent.test.d.ts +1 -0
- package/build/http-headers/user-agent.test.js +27 -0
- package/build/http-headers/user-agent.test.js.map +1 -0
- package/build/index.d.ts +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/loaders/errors.d.ts +21 -0
- package/build/loaders/errors.js +45 -0
- package/build/loaders/errors.js.map +1 -0
- package/build/loaders/index.d.ts +5 -0
- package/build/loaders/index.js +5 -0
- package/build/loaders/index.js.map +1 -0
- package/build/loaders/jsonld-document-loader.d.ts +48 -0
- package/build/loaders/jsonld-document-loader.js +43 -0
- package/build/loaders/jsonld-document-loader.js.map +1 -0
- package/build/loaders/jsonld-document-loader.test.d.ts +1 -0
- package/build/loaders/jsonld-document-loader.test.js +111 -0
- package/build/loaders/jsonld-document-loader.test.js.map +1 -0
- package/build/loaders/schema-loader.d.ts +31 -0
- package/build/loaders/schema-loader.js +83 -0
- package/build/loaders/schema-loader.js.map +1 -0
- package/build/loaders/schema-loader.ssrf.test.d.ts +1 -0
- package/build/loaders/schema-loader.ssrf.test.js +55 -0
- package/build/loaders/schema-loader.ssrf.test.js.map +1 -0
- package/build/loaders/schema-loader.test.d.ts +1 -0
- package/build/loaders/schema-loader.test.js +217 -0
- package/build/loaders/schema-loader.test.js.map +1 -0
- package/build/multibase-digest/multibase-digest.d.ts +23 -0
- package/build/multibase-digest/multibase-digest.js +40 -0
- package/build/multibase-digest/multibase-digest.js.map +1 -1
- package/build/multibase-digest/multibase-digest.test.js +46 -0
- package/build/multibase-digest/multibase-digest.test.js.map +1 -1
- package/build/node/errors.d.ts +47 -0
- package/build/node/errors.js +86 -0
- package/build/node/errors.js.map +1 -0
- package/build/node/index.d.ts +3 -0
- package/build/node/index.js +4 -0
- package/build/node/index.js.map +1 -0
- package/build/node/is-private-ip.d.ts +45 -0
- package/build/node/is-private-ip.fail-closed.test.d.ts +1 -0
- package/build/node/is-private-ip.fail-closed.test.js +36 -0
- package/build/node/is-private-ip.fail-closed.test.js.map +1 -0
- package/build/node/is-private-ip.js +203 -0
- package/build/node/is-private-ip.js.map +1 -0
- package/build/node/is-private-ip.test.d.ts +1 -0
- package/build/node/is-private-ip.test.js +124 -0
- package/build/node/is-private-ip.test.js.map +1 -0
- package/build/node/validate-public-url.d.ts +81 -0
- package/build/node/validate-public-url.js +128 -0
- package/build/node/validate-public-url.js.map +1 -0
- package/build/node/validate-public-url.test.d.ts +1 -0
- package/build/node/validate-public-url.test.js +324 -0
- package/build/node/validate-public-url.test.js.map +1 -0
- package/build/resolvers/errors.d.ts +73 -0
- package/build/resolvers/errors.js +133 -0
- package/build/resolvers/errors.js.map +1 -0
- package/build/resolvers/index.d.ts +5 -0
- package/build/resolvers/index.js +6 -0
- package/build/resolvers/index.js.map +1 -0
- package/build/resolvers/resolve-document-if-changed.d.ts +48 -0
- package/build/resolvers/resolve-document-if-changed.js +42 -0
- package/build/resolvers/resolve-document-if-changed.js.map +1 -0
- package/build/resolvers/resolve-document-if-changed.test.d.ts +1 -0
- package/build/resolvers/resolve-document-if-changed.test.js +116 -0
- package/build/resolvers/resolve-document-if-changed.test.js.map +1 -0
- package/build/resolvers/resolve-document.d.ts +106 -0
- package/build/resolvers/resolve-document.integration.test.d.ts +1 -0
- package/build/resolvers/resolve-document.integration.test.js +108 -0
- package/build/resolvers/resolve-document.integration.test.js.map +1 -0
- package/build/resolvers/resolve-document.js +319 -0
- package/build/resolvers/resolve-document.js.map +1 -0
- package/build/resolvers/resolve-document.test.d.ts +1 -0
- package/build/resolvers/resolve-document.test.js +749 -0
- package/build/resolvers/resolve-document.test.js.map +1 -0
- package/build/resolvers/resolve-json-document.d.ts +43 -0
- package/build/resolvers/resolve-json-document.js +43 -0
- package/build/resolvers/resolve-json-document.js.map +1 -0
- package/build/resolvers/resolve-json-document.test.d.ts +1 -0
- package/build/resolvers/resolve-json-document.test.js +78 -0
- package/build/resolvers/resolve-json-document.test.js.map +1 -0
- package/build/structured-error.d.ts +49 -0
- package/build/structured-error.js +17 -0
- package/build/structured-error.js.map +1 -0
- package/build/structured-error.test.d.ts +1 -0
- package/build/structured-error.test.js +112 -0
- package/build/structured-error.test.js.map +1 -0
- package/build/validation/describe-jsonld-failure.d.ts +90 -0
- package/build/validation/describe-jsonld-failure.js +171 -0
- package/build/validation/describe-jsonld-failure.js.map +1 -0
- package/build/validation/describe-jsonld-failure.test.d.ts +1 -0
- package/build/validation/describe-jsonld-failure.test.js +226 -0
- package/build/validation/describe-jsonld-failure.test.js.map +1 -0
- package/build/validation/errors.d.ts +40 -0
- package/build/validation/errors.js +75 -0
- package/build/validation/errors.js.map +1 -0
- package/build/validation/index.d.ts +5 -0
- package/build/validation/index.js +5 -0
- package/build/validation/index.js.map +1 -0
- package/build/validation/validate-against-schemas.d.ts +22 -0
- package/build/validation/validate-against-schemas.js +65 -0
- package/build/validation/validate-against-schemas.js.map +1 -0
- package/build/validation/validate-against-schemas.test.d.ts +1 -0
- package/build/validation/validate-against-schemas.test.js +169 -0
- package/build/validation/validate-against-schemas.test.js.map +1 -0
- package/build/validation/validate-jsonld.context-cache.test.d.ts +1 -0
- package/build/validation/validate-jsonld.context-cache.test.js +32 -0
- package/build/validation/validate-jsonld.context-cache.test.js.map +1 -0
- package/build/validation/validate-jsonld.d.ts +59 -0
- package/build/validation/validate-jsonld.js +126 -0
- package/build/validation/validate-jsonld.js.map +1 -0
- package/build/validation/validate-jsonld.ssrf.test.d.ts +1 -0
- package/build/validation/validate-jsonld.ssrf.test.js +108 -0
- package/build/validation/validate-jsonld.ssrf.test.js.map +1 -0
- package/build/validation/validate-jsonld.test.d.ts +1 -0
- package/build/validation/validate-jsonld.test.js +257 -0
- package/build/validation/validate-jsonld.test.js.map +1 -0
- package/package.json +86 -5
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domains UNTP publishes versioned contexts under. UNTP v0.7 and above
|
|
3
|
+
* publish to `vocabulary.uncefact.org`; earlier versions (pre-0.7) were
|
|
4
|
+
* published to `test.uncefact.org`. Both are kept in the matcher so
|
|
5
|
+
* documents from either era resolve to a version string.
|
|
6
|
+
*/
|
|
7
|
+
export declare const UNTP_CONTEXT_DOMAINS: readonly ["vocabulary.uncefact.org", "test.uncefact.org"];
|
|
8
|
+
/**
|
|
9
|
+
* Options for {@link detectVersionFromContext}.
|
|
10
|
+
*/
|
|
11
|
+
export interface DetectVersionFromContextOptions {
|
|
12
|
+
/**
|
|
13
|
+
* When set, only context URLs whose hostname contains this substring are
|
|
14
|
+
* considered. Useful for extensions, where each extension publishes its own
|
|
15
|
+
* versioned context under a domain distinct from the UNTP core context.
|
|
16
|
+
*
|
|
17
|
+
* When omitted, any UNTP context domain ({@link UNTP_CONTEXT_DOMAINS}) is
|
|
18
|
+
* considered.
|
|
19
|
+
*/
|
|
20
|
+
domain?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
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.
|
|
26
|
+
*
|
|
27
|
+
* Works for any UNTP artefact that publishes a versioned context: credentials
|
|
28
|
+
* (DPP, DCC, DFR, DIA, DTE), conformity schemes, identifier scheme registers,
|
|
29
|
+
* etc. The function is data-only: it never fetches, never resolves contexts.
|
|
30
|
+
*
|
|
31
|
+
* @param doc - Any object that may carry an `@context` field. The field may
|
|
32
|
+
* be a string or an array; non-string entries in arrays are ignored.
|
|
33
|
+
* Non-object inputs return `undefined`.
|
|
34
|
+
* @param options - {@link DetectVersionFromContextOptions}.
|
|
35
|
+
* @returns The detected version string (for example `0.7.0` or `0.7.0-rc1`),
|
|
36
|
+
* or `undefined` when no matching UNTP context URL is found.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* detectVersionFromContext({ '@context': ['https://vocabulary.uncefact.org/untp/0.7.0/context/'] });
|
|
40
|
+
* // → '0.7.0'
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* detectVersionFromContext(extensionCredential, { domain: 'aatp.example.com' });
|
|
44
|
+
* // → '0.5.0' (or whatever the extension publishes)
|
|
45
|
+
*/
|
|
46
|
+
export declare function detectVersionFromContext(doc: unknown, options?: DetectVersionFromContextOptions): string | undefined;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domains UNTP publishes versioned contexts under. UNTP v0.7 and above
|
|
3
|
+
* publish to `vocabulary.uncefact.org`; earlier versions (pre-0.7) were
|
|
4
|
+
* published to `test.uncefact.org`. Both are kept in the matcher so
|
|
5
|
+
* documents from either era resolve to a version string.
|
|
6
|
+
*/
|
|
7
|
+
export const UNTP_CONTEXT_DOMAINS = ['vocabulary.uncefact.org', 'test.uncefact.org'];
|
|
8
|
+
/**
|
|
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.).
|
|
12
|
+
*/
|
|
13
|
+
const UNTP_VERSION_PATH_SEGMENT = /\/(\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?)\//;
|
|
14
|
+
/**
|
|
15
|
+
* 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.
|
|
18
|
+
*
|
|
19
|
+
* Works for any UNTP artefact that publishes a versioned context: credentials
|
|
20
|
+
* (DPP, DCC, DFR, DIA, DTE), conformity schemes, identifier scheme registers,
|
|
21
|
+
* etc. The function is data-only: it never fetches, never resolves contexts.
|
|
22
|
+
*
|
|
23
|
+
* @param doc - Any object that may carry an `@context` field. The field may
|
|
24
|
+
* be a string or an array; non-string entries in arrays are ignored.
|
|
25
|
+
* Non-object inputs return `undefined`.
|
|
26
|
+
* @param options - {@link DetectVersionFromContextOptions}.
|
|
27
|
+
* @returns The detected version string (for example `0.7.0` or `0.7.0-rc1`),
|
|
28
|
+
* or `undefined` when no matching UNTP context URL is found.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* detectVersionFromContext({ '@context': ['https://vocabulary.uncefact.org/untp/0.7.0/context/'] });
|
|
32
|
+
* // → '0.7.0'
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* detectVersionFromContext(extensionCredential, { domain: 'aatp.example.com' });
|
|
36
|
+
* // → '0.5.0' (or whatever the extension publishes)
|
|
37
|
+
*/
|
|
38
|
+
export function detectVersionFromContext(doc, options = {}) {
|
|
39
|
+
if (!doc || typeof doc !== 'object') {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
const contextField = doc['@context'];
|
|
43
|
+
const candidates = collectContextStrings(contextField);
|
|
44
|
+
const matchesDomain = buildDomainMatcher(options.domain);
|
|
45
|
+
for (const url of candidates) {
|
|
46
|
+
if (!matchesDomain(url)) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
const match = url.match(UNTP_VERSION_PATH_SEGMENT);
|
|
50
|
+
if (match) {
|
|
51
|
+
return match[1];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
function collectContextStrings(context) {
|
|
57
|
+
if (typeof context === 'string') {
|
|
58
|
+
return [context];
|
|
59
|
+
}
|
|
60
|
+
if (Array.isArray(context)) {
|
|
61
|
+
const out = [];
|
|
62
|
+
for (const entry of context) {
|
|
63
|
+
if (typeof entry === 'string') {
|
|
64
|
+
out.push(entry);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return out;
|
|
68
|
+
}
|
|
69
|
+
return [];
|
|
70
|
+
}
|
|
71
|
+
function buildDomainMatcher(domain) {
|
|
72
|
+
if (domain) {
|
|
73
|
+
return (url) => url.includes(domain);
|
|
74
|
+
}
|
|
75
|
+
return (url) => UNTP_CONTEXT_DOMAINS.some((d) => url.includes(d));
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=detect-version-from-context.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { detectVersionFromContext } from './detect-version-from-context.js';
|
|
2
|
+
describe('detectVersionFromContext', () => {
|
|
3
|
+
describe('UNTP context detection (default domain set)', () => {
|
|
4
|
+
it('returns the version from a single string @context', () => {
|
|
5
|
+
const doc = { '@context': 'https://vocabulary.uncefact.org/untp/0.7.0/context/' };
|
|
6
|
+
expect(detectVersionFromContext(doc)).toBe('0.7.0');
|
|
7
|
+
});
|
|
8
|
+
it('returns the version when @context is an array including the UNTP context', () => {
|
|
9
|
+
const doc = {
|
|
10
|
+
'@context': ['https://www.w3.org/ns/credentials/v2', 'https://vocabulary.uncefact.org/untp/0.7.0/context/'],
|
|
11
|
+
};
|
|
12
|
+
expect(detectVersionFromContext(doc)).toBe('0.7.0');
|
|
13
|
+
});
|
|
14
|
+
it('recognises pre-release versions', () => {
|
|
15
|
+
const doc = { '@context': 'https://vocabulary.uncefact.org/untp/0.7.0-rc.1/context/' };
|
|
16
|
+
expect(detectVersionFromContext(doc)).toBe('0.7.0-rc.1');
|
|
17
|
+
});
|
|
18
|
+
it('recognises the test.uncefact.org domain', () => {
|
|
19
|
+
const doc = { '@context': 'https://test.uncefact.org/untp/0.7.0/context/' };
|
|
20
|
+
expect(detectVersionFromContext(doc)).toBe('0.7.0');
|
|
21
|
+
});
|
|
22
|
+
it('returns undefined for non-UNTP context domains', () => {
|
|
23
|
+
const doc = { '@context': ['https://schema.org/', 'https://example.com/0.7.0/'] };
|
|
24
|
+
expect(detectVersionFromContext(doc)).toBeUndefined();
|
|
25
|
+
});
|
|
26
|
+
it('skips non-string entries within an array @context', () => {
|
|
27
|
+
const doc = {
|
|
28
|
+
'@context': [{ '@vocab': 'https://example.com/' }, 'https://vocabulary.uncefact.org/untp/0.7.0/context/'],
|
|
29
|
+
};
|
|
30
|
+
expect(detectVersionFromContext(doc)).toBe('0.7.0');
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
describe('domain-scoped detection', () => {
|
|
34
|
+
it('finds the version under a caller-supplied domain (extension context)', () => {
|
|
35
|
+
const doc = {
|
|
36
|
+
'@context': [
|
|
37
|
+
'https://www.w3.org/ns/credentials/v2',
|
|
38
|
+
'https://vocabulary.uncefact.org/untp/0.7.0/context/',
|
|
39
|
+
'https://aatp.example.com/untp/0.5.0/context/',
|
|
40
|
+
],
|
|
41
|
+
};
|
|
42
|
+
expect(detectVersionFromContext(doc, { domain: 'aatp.example.com' })).toBe('0.5.0');
|
|
43
|
+
});
|
|
44
|
+
it('returns undefined when no context matches the supplied domain', () => {
|
|
45
|
+
const doc = {
|
|
46
|
+
'@context': ['https://vocabulary.uncefact.org/untp/0.7.0/context/'],
|
|
47
|
+
};
|
|
48
|
+
expect(detectVersionFromContext(doc, { domain: 'nope.example.com' })).toBeUndefined();
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
describe('input handling', () => {
|
|
52
|
+
it('returns undefined when @context is missing', () => {
|
|
53
|
+
expect(detectVersionFromContext({})).toBeUndefined();
|
|
54
|
+
});
|
|
55
|
+
it('returns undefined for non-object input', () => {
|
|
56
|
+
expect(detectVersionFromContext(null)).toBeUndefined();
|
|
57
|
+
expect(detectVersionFromContext(undefined)).toBeUndefined();
|
|
58
|
+
expect(detectVersionFromContext('a string')).toBeUndefined();
|
|
59
|
+
expect(detectVersionFromContext(42)).toBeUndefined();
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
describe('regex robustness', () => {
|
|
63
|
+
it('ignores version-like substrings outside a path segment', () => {
|
|
64
|
+
const doc = { '@context': 'https://vocabulary.uncefact.org/untp/context?v=1.2.3' };
|
|
65
|
+
expect(detectVersionFromContext(doc)).toBeUndefined();
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=detect-version-from-context.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect-version-from-context.test.js","sourceRoot":"","sources":["../../src/artefacts/detect-version-from-context.test.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/artefacts/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,kCAAkC,CAAC"}
|