@ac-kit/format-asn1 0.1.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/LICENSE +28 -0
- package/README.md +33 -0
- package/dist/_encoding/constants.d.ts +43 -0
- package/dist/_encoding/constants.d.ts.map +1 -0
- package/dist/_encoding/constants.js +49 -0
- package/dist/_encoding/constants.js.map +1 -0
- package/dist/_encoding/errors.d.ts +8 -0
- package/dist/_encoding/errors.d.ts.map +1 -0
- package/dist/_encoding/errors.js +15 -0
- package/dist/_encoding/errors.js.map +1 -0
- package/dist/_encoding/tag.d.ts +26 -0
- package/dist/_encoding/tag.d.ts.map +1 -0
- package/dist/_encoding/tag.js +96 -0
- package/dist/_encoding/tag.js.map +1 -0
- package/dist/_encoding/tlv.d.ts +38 -0
- package/dist/_encoding/tlv.d.ts.map +1 -0
- package/dist/_encoding/tlv.js +66 -0
- package/dist/_encoding/tlv.js.map +1 -0
- package/dist/_encoding/values.d.ts +49 -0
- package/dist/_encoding/values.d.ts.map +1 -0
- package/dist/_encoding/values.js +285 -0
- package/dist/_encoding/values.js.map +1 -0
- package/dist/_encoding/vlq.d.ts +15 -0
- package/dist/_encoding/vlq.d.ts.map +1 -0
- package/dist/_encoding/vlq.js +23 -0
- package/dist/_encoding/vlq.js.map +1 -0
- package/dist/ber/codec.d.ts +28 -0
- package/dist/ber/codec.d.ts.map +1 -0
- package/dist/ber/codec.js +85 -0
- package/dist/ber/codec.js.map +1 -0
- package/dist/ber/decode.d.ts +9 -0
- package/dist/ber/decode.d.ts.map +1 -0
- package/dist/ber/decode.js +235 -0
- package/dist/ber/decode.js.map +1 -0
- package/dist/ber/encode.d.ts +12 -0
- package/dist/ber/encode.d.ts.map +1 -0
- package/dist/ber/encode.js +193 -0
- package/dist/ber/encode.js.map +1 -0
- package/dist/ber/tags.d.ts +17 -0
- package/dist/ber/tags.d.ts.map +1 -0
- package/dist/ber/tags.js +117 -0
- package/dist/ber/tags.js.map +1 -0
- package/dist/ber.d.ts +5 -0
- package/dist/ber.d.ts.map +1 -0
- package/dist/ber.js +5 -0
- package/dist/ber.js.map +1 -0
- package/dist/cer/decode.d.ts +5 -0
- package/dist/cer/decode.d.ts.map +1 -0
- package/dist/cer/decode.js +229 -0
- package/dist/cer/decode.js.map +1 -0
- package/dist/cer/encode.d.ts +14 -0
- package/dist/cer/encode.d.ts.map +1 -0
- package/dist/cer/encode.js +265 -0
- package/dist/cer/encode.js.map +1 -0
- package/dist/cer.d.ts +3 -0
- package/dist/cer.d.ts.map +1 -0
- package/dist/cer.js +3 -0
- package/dist/cer.js.map +1 -0
- package/dist/der/decode.d.ts +9 -0
- package/dist/der/decode.d.ts.map +1 -0
- package/dist/der/decode.js +217 -0
- package/dist/der/decode.js.map +1 -0
- package/dist/der/encode.d.ts +13 -0
- package/dist/der/encode.d.ts.map +1 -0
- package/dist/der/encode.js +223 -0
- package/dist/der/encode.js.map +1 -0
- package/dist/der.d.ts +3 -0
- package/dist/der.d.ts.map +1 -0
- package/dist/der.js +3 -0
- package/dist/der.js.map +1 -0
- package/dist/index.d.ts +71 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +71 -0
- package/dist/index.js.map +1 -0
- package/dist/per/constraints.d.ts +15 -0
- package/dist/per/constraints.d.ts.map +1 -0
- package/dist/per/constraints.js +37 -0
- package/dist/per/constraints.js.map +1 -0
- package/dist/per/decode.d.ts +7 -0
- package/dist/per/decode.d.ts.map +1 -0
- package/dist/per/decode.js +275 -0
- package/dist/per/decode.js.map +1 -0
- package/dist/per/encode.d.ts +19 -0
- package/dist/per/encode.d.ts.map +1 -0
- package/dist/per/encode.js +315 -0
- package/dist/per/encode.js.map +1 -0
- package/dist/per.d.ts +4 -0
- package/dist/per.d.ts.map +1 -0
- package/dist/per.js +4 -0
- package/dist/per.js.map +1 -0
- package/dist/schema/constraints/common.d.ts +56 -0
- package/dist/schema/constraints/common.d.ts.map +1 -0
- package/dist/schema/constraints/common.js +33 -0
- package/dist/schema/constraints/common.js.map +1 -0
- package/dist/schema/constraints/component-relation.d.ts +16 -0
- package/dist/schema/constraints/component-relation.d.ts.map +1 -0
- package/dist/schema/constraints/component-relation.js +9 -0
- package/dist/schema/constraints/component-relation.js.map +1 -0
- package/dist/schema/constraints/contents.d.ts +17 -0
- package/dist/schema/constraints/contents.d.ts.map +1 -0
- package/dist/schema/constraints/contents.js +7 -0
- package/dist/schema/constraints/contents.js.map +1 -0
- package/dist/schema/constraints/except.d.ts +15 -0
- package/dist/schema/constraints/except.d.ts.map +1 -0
- package/dist/schema/constraints/except.js +9 -0
- package/dist/schema/constraints/except.js.map +1 -0
- package/dist/schema/constraints/extensible.d.ts +14 -0
- package/dist/schema/constraints/extensible.d.ts.map +1 -0
- package/dist/schema/constraints/extensible.js +8 -0
- package/dist/schema/constraints/extensible.js.map +1 -0
- package/dist/schema/constraints/intersection.d.ts +14 -0
- package/dist/schema/constraints/intersection.d.ts.map +1 -0
- package/dist/schema/constraints/intersection.js +8 -0
- package/dist/schema/constraints/intersection.js.map +1 -0
- package/dist/schema/constraints/pattern.d.ts +13 -0
- package/dist/schema/constraints/pattern.d.ts.map +1 -0
- package/dist/schema/constraints/pattern.js +5 -0
- package/dist/schema/constraints/pattern.js.map +1 -0
- package/dist/schema/constraints/permitted-alphabet.d.ts +13 -0
- package/dist/schema/constraints/permitted-alphabet.d.ts.map +1 -0
- package/dist/schema/constraints/permitted-alphabet.js +5 -0
- package/dist/schema/constraints/permitted-alphabet.js.map +1 -0
- package/dist/schema/constraints/size.d.ts +15 -0
- package/dist/schema/constraints/size.d.ts.map +1 -0
- package/dist/schema/constraints/size.js +5 -0
- package/dist/schema/constraints/size.js.map +1 -0
- package/dist/schema/constraints/table.d.ts +14 -0
- package/dist/schema/constraints/table.d.ts.map +1 -0
- package/dist/schema/constraints/table.js +5 -0
- package/dist/schema/constraints/table.js.map +1 -0
- package/dist/schema/constraints/union.d.ts +14 -0
- package/dist/schema/constraints/union.d.ts.map +1 -0
- package/dist/schema/constraints/union.js +8 -0
- package/dist/schema/constraints/union.js.map +1 -0
- package/dist/schema/constraints/user-defined.d.ts +13 -0
- package/dist/schema/constraints/user-defined.d.ts.map +1 -0
- package/dist/schema/constraints/user-defined.js +5 -0
- package/dist/schema/constraints/user-defined.js.map +1 -0
- package/dist/schema/constraints/value-range.d.ts +12 -0
- package/dist/schema/constraints/value-range.d.ts.map +1 -0
- package/dist/schema/constraints/value-range.js +5 -0
- package/dist/schema/constraints/value-range.js.map +1 -0
- package/dist/schema/constraints/with-component.d.ts +14 -0
- package/dist/schema/constraints/with-component.d.ts.map +1 -0
- package/dist/schema/constraints/with-component.js +8 -0
- package/dist/schema/constraints/with-component.js.map +1 -0
- package/dist/schema/constraints/with-components.d.ts +15 -0
- package/dist/schema/constraints/with-components.d.ts.map +1 -0
- package/dist/schema/constraints/with-components.js +5 -0
- package/dist/schema/constraints/with-components.js.map +1 -0
- package/dist/schema/def.d.ts +25 -0
- package/dist/schema/def.d.ts.map +1 -0
- package/dist/schema/def.js +2 -0
- package/dist/schema/def.js.map +1 -0
- package/dist/schema/metadata.d.ts +68 -0
- package/dist/schema/metadata.d.ts.map +1 -0
- package/dist/schema/metadata.js +41 -0
- package/dist/schema/metadata.js.map +1 -0
- package/dist/schema/module.d.ts +52 -0
- package/dist/schema/module.d.ts.map +1 -0
- package/dist/schema/module.js +151 -0
- package/dist/schema/module.js.map +1 -0
- package/dist/schema/types/any-def.d.ts +46 -0
- package/dist/schema/types/any-def.d.ts.map +1 -0
- package/dist/schema/types/any-def.js +2 -0
- package/dist/schema/types/any-def.js.map +1 -0
- package/dist/schema/types/base.d.ts +95 -0
- package/dist/schema/types/base.d.ts.map +1 -0
- package/dist/schema/types/base.js +142 -0
- package/dist/schema/types/base.js.map +1 -0
- package/dist/schema/types/constructed/choice.d.ts +16 -0
- package/dist/schema/types/constructed/choice.d.ts.map +1 -0
- package/dist/schema/types/constructed/choice.js +9 -0
- package/dist/schema/types/constructed/choice.js.map +1 -0
- package/dist/schema/types/constructed/component.d.ts +104 -0
- package/dist/schema/types/constructed/component.d.ts.map +1 -0
- package/dist/schema/types/constructed/component.js +56 -0
- package/dist/schema/types/constructed/component.js.map +1 -0
- package/dist/schema/types/constructed/sequence-of.d.ts +20 -0
- package/dist/schema/types/constructed/sequence-of.d.ts.map +1 -0
- package/dist/schema/types/constructed/sequence-of.js +31 -0
- package/dist/schema/types/constructed/sequence-of.js.map +1 -0
- package/dist/schema/types/constructed/sequence.d.ts +16 -0
- package/dist/schema/types/constructed/sequence.d.ts.map +1 -0
- package/dist/schema/types/constructed/sequence.js +13 -0
- package/dist/schema/types/constructed/sequence.js.map +1 -0
- package/dist/schema/types/constructed/set-of.d.ts +20 -0
- package/dist/schema/types/constructed/set-of.d.ts.map +1 -0
- package/dist/schema/types/constructed/set-of.js +28 -0
- package/dist/schema/types/constructed/set-of.js.map +1 -0
- package/dist/schema/types/constructed/set.d.ts +16 -0
- package/dist/schema/types/constructed/set.d.ts.map +1 -0
- package/dist/schema/types/constructed/set.js +13 -0
- package/dist/schema/types/constructed/set.js.map +1 -0
- package/dist/schema/types/from-ref.d.ts +5 -0
- package/dist/schema/types/from-ref.d.ts.map +1 -0
- package/dist/schema/types/from-ref.js +103 -0
- package/dist/schema/types/from-ref.js.map +1 -0
- package/dist/schema/types/information-object/class-field.d.ts +92 -0
- package/dist/schema/types/information-object/class-field.d.ts.map +1 -0
- package/dist/schema/types/information-object/class-field.js +58 -0
- package/dist/schema/types/information-object/class-field.js.map +1 -0
- package/dist/schema/types/information-object/class.d.ts +25 -0
- package/dist/schema/types/information-object/class.d.ts.map +1 -0
- package/dist/schema/types/information-object/class.js +15 -0
- package/dist/schema/types/information-object/class.js.map +1 -0
- package/dist/schema/types/information-object/information-object.d.ts +31 -0
- package/dist/schema/types/information-object/information-object.d.ts.map +1 -0
- package/dist/schema/types/information-object/information-object.js +24 -0
- package/dist/schema/types/information-object/information-object.js.map +1 -0
- package/dist/schema/types/information-object/open-type.d.ts +24 -0
- package/dist/schema/types/information-object/open-type.d.ts.map +1 -0
- package/dist/schema/types/information-object/open-type.js +30 -0
- package/dist/schema/types/information-object/open-type.js.map +1 -0
- package/dist/schema/types/legacy/character-string.d.ts +10 -0
- package/dist/schema/types/legacy/character-string.d.ts.map +1 -0
- package/dist/schema/types/legacy/character-string.js +9 -0
- package/dist/schema/types/legacy/character-string.js.map +1 -0
- package/dist/schema/types/legacy/embedded-pdv.d.ts +10 -0
- package/dist/schema/types/legacy/embedded-pdv.d.ts.map +1 -0
- package/dist/schema/types/legacy/embedded-pdv.js +9 -0
- package/dist/schema/types/legacy/embedded-pdv.js.map +1 -0
- package/dist/schema/types/legacy/external.d.ts +10 -0
- package/dist/schema/types/legacy/external.d.ts.map +1 -0
- package/dist/schema/types/legacy/external.js +9 -0
- package/dist/schema/types/legacy/external.js.map +1 -0
- package/dist/schema/types/parameterized/parameterized-type.d.ts +76 -0
- package/dist/schema/types/parameterized/parameterized-type.d.ts.map +1 -0
- package/dist/schema/types/parameterized/parameterized-type.js +107 -0
- package/dist/schema/types/parameterized/parameterized-type.js.map +1 -0
- package/dist/schema/types/primitives/any.d.ts +10 -0
- package/dist/schema/types/primitives/any.d.ts.map +1 -0
- package/dist/schema/types/primitives/any.js +9 -0
- package/dist/schema/types/primitives/any.js.map +1 -0
- package/dist/schema/types/primitives/bit-string.d.ts +19 -0
- package/dist/schema/types/primitives/bit-string.d.ts.map +1 -0
- package/dist/schema/types/primitives/bit-string.js +39 -0
- package/dist/schema/types/primitives/bit-string.js.map +1 -0
- package/dist/schema/types/primitives/boolean.d.ts +12 -0
- package/dist/schema/types/primitives/boolean.d.ts.map +1 -0
- package/dist/schema/types/primitives/boolean.js +9 -0
- package/dist/schema/types/primitives/boolean.js.map +1 -0
- package/dist/schema/types/primitives/enumerated.d.ts +18 -0
- package/dist/schema/types/primitives/enumerated.d.ts.map +1 -0
- package/dist/schema/types/primitives/enumerated.js +21 -0
- package/dist/schema/types/primitives/enumerated.js.map +1 -0
- package/dist/schema/types/primitives/integer.d.ts +19 -0
- package/dist/schema/types/primitives/integer.d.ts.map +1 -0
- package/dist/schema/types/primitives/integer.js +29 -0
- package/dist/schema/types/primitives/integer.js.map +1 -0
- package/dist/schema/types/primitives/lazy.d.ts +34 -0
- package/dist/schema/types/primitives/lazy.d.ts.map +1 -0
- package/dist/schema/types/primitives/lazy.js +16 -0
- package/dist/schema/types/primitives/lazy.js.map +1 -0
- package/dist/schema/types/primitives/null.d.ts +9 -0
- package/dist/schema/types/primitives/null.d.ts.map +1 -0
- package/dist/schema/types/primitives/null.js +7 -0
- package/dist/schema/types/primitives/null.js.map +1 -0
- package/dist/schema/types/primitives/object-identifier.d.ts +10 -0
- package/dist/schema/types/primitives/object-identifier.d.ts.map +1 -0
- package/dist/schema/types/primitives/object-identifier.js +9 -0
- package/dist/schema/types/primitives/object-identifier.js.map +1 -0
- package/dist/schema/types/primitives/octet-string.d.ts +20 -0
- package/dist/schema/types/primitives/octet-string.d.ts.map +1 -0
- package/dist/schema/types/primitives/octet-string.js +54 -0
- package/dist/schema/types/primitives/octet-string.js.map +1 -0
- package/dist/schema/types/primitives/oid-iri.d.ts +9 -0
- package/dist/schema/types/primitives/oid-iri.d.ts.map +1 -0
- package/dist/schema/types/primitives/oid-iri.js +9 -0
- package/dist/schema/types/primitives/oid-iri.js.map +1 -0
- package/dist/schema/types/primitives/real.d.ts +16 -0
- package/dist/schema/types/primitives/real.d.ts.map +1 -0
- package/dist/schema/types/primitives/real.js +24 -0
- package/dist/schema/types/primitives/real.js.map +1 -0
- package/dist/schema/types/primitives/relative-oid-iri.d.ts +9 -0
- package/dist/schema/types/primitives/relative-oid-iri.d.ts.map +1 -0
- package/dist/schema/types/primitives/relative-oid-iri.js +9 -0
- package/dist/schema/types/primitives/relative-oid-iri.js.map +1 -0
- package/dist/schema/types/primitives/relative-oid.d.ts +10 -0
- package/dist/schema/types/primitives/relative-oid.d.ts.map +1 -0
- package/dist/schema/types/primitives/relative-oid.js +9 -0
- package/dist/schema/types/primitives/relative-oid.js.map +1 -0
- package/dist/schema/types/strings/bmp-string.d.ts +9 -0
- package/dist/schema/types/strings/bmp-string.d.ts.map +1 -0
- package/dist/schema/types/strings/bmp-string.js +13 -0
- package/dist/schema/types/strings/bmp-string.js.map +1 -0
- package/dist/schema/types/strings/general-string.d.ts +9 -0
- package/dist/schema/types/strings/general-string.d.ts.map +1 -0
- package/dist/schema/types/strings/general-string.js +13 -0
- package/dist/schema/types/strings/general-string.js.map +1 -0
- package/dist/schema/types/strings/graphic-string.d.ts +9 -0
- package/dist/schema/types/strings/graphic-string.d.ts.map +1 -0
- package/dist/schema/types/strings/graphic-string.js +13 -0
- package/dist/schema/types/strings/graphic-string.js.map +1 -0
- package/dist/schema/types/strings/ia5-string.d.ts +9 -0
- package/dist/schema/types/strings/ia5-string.d.ts.map +1 -0
- package/dist/schema/types/strings/ia5-string.js +13 -0
- package/dist/schema/types/strings/ia5-string.js.map +1 -0
- package/dist/schema/types/strings/numeric-string.d.ts +9 -0
- package/dist/schema/types/strings/numeric-string.d.ts.map +1 -0
- package/dist/schema/types/strings/numeric-string.js +13 -0
- package/dist/schema/types/strings/numeric-string.js.map +1 -0
- package/dist/schema/types/strings/printable-string.d.ts +9 -0
- package/dist/schema/types/strings/printable-string.d.ts.map +1 -0
- package/dist/schema/types/strings/printable-string.js +13 -0
- package/dist/schema/types/strings/printable-string.js.map +1 -0
- package/dist/schema/types/strings/string-base.d.ts +31 -0
- package/dist/schema/types/strings/string-base.d.ts.map +1 -0
- package/dist/schema/types/strings/string-base.js +24 -0
- package/dist/schema/types/strings/string-base.js.map +1 -0
- package/dist/schema/types/strings/teletex-string.d.ts +9 -0
- package/dist/schema/types/strings/teletex-string.d.ts.map +1 -0
- package/dist/schema/types/strings/teletex-string.js +13 -0
- package/dist/schema/types/strings/teletex-string.js.map +1 -0
- package/dist/schema/types/strings/universal-string.d.ts +9 -0
- package/dist/schema/types/strings/universal-string.d.ts.map +1 -0
- package/dist/schema/types/strings/universal-string.js +13 -0
- package/dist/schema/types/strings/universal-string.js.map +1 -0
- package/dist/schema/types/strings/utf8-string.d.ts +9 -0
- package/dist/schema/types/strings/utf8-string.d.ts.map +1 -0
- package/dist/schema/types/strings/utf8-string.js +13 -0
- package/dist/schema/types/strings/utf8-string.js.map +1 -0
- package/dist/schema/types/strings/videotex-string.d.ts +9 -0
- package/dist/schema/types/strings/videotex-string.d.ts.map +1 -0
- package/dist/schema/types/strings/videotex-string.js +13 -0
- package/dist/schema/types/strings/videotex-string.js.map +1 -0
- package/dist/schema/types/strings/visible-string.d.ts +9 -0
- package/dist/schema/types/strings/visible-string.d.ts.map +1 -0
- package/dist/schema/types/strings/visible-string.js +13 -0
- package/dist/schema/types/strings/visible-string.js.map +1 -0
- package/dist/schema/types/time/common.d.ts +6 -0
- package/dist/schema/types/time/common.d.ts.map +1 -0
- package/dist/schema/types/time/common.js +2 -0
- package/dist/schema/types/time/common.js.map +1 -0
- package/dist/schema/types/time/date-time.d.ts +9 -0
- package/dist/schema/types/time/date-time.d.ts.map +1 -0
- package/dist/schema/types/time/date-time.js +9 -0
- package/dist/schema/types/time/date-time.js.map +1 -0
- package/dist/schema/types/time/date.d.ts +9 -0
- package/dist/schema/types/time/date.d.ts.map +1 -0
- package/dist/schema/types/time/date.js +9 -0
- package/dist/schema/types/time/date.js.map +1 -0
- package/dist/schema/types/time/duration.d.ts +9 -0
- package/dist/schema/types/time/duration.d.ts.map +1 -0
- package/dist/schema/types/time/duration.js +9 -0
- package/dist/schema/types/time/duration.js.map +1 -0
- package/dist/schema/types/time/generalized-time.d.ts +10 -0
- package/dist/schema/types/time/generalized-time.d.ts.map +1 -0
- package/dist/schema/types/time/generalized-time.js +9 -0
- package/dist/schema/types/time/generalized-time.js.map +1 -0
- package/dist/schema/types/time/time-of-day.d.ts +9 -0
- package/dist/schema/types/time/time-of-day.d.ts.map +1 -0
- package/dist/schema/types/time/time-of-day.js +9 -0
- package/dist/schema/types/time/time-of-day.js.map +1 -0
- package/dist/schema/types/time/time.d.ts +9 -0
- package/dist/schema/types/time/time.d.ts.map +1 -0
- package/dist/schema/types/time/time.js +9 -0
- package/dist/schema/types/time/time.js.map +1 -0
- package/dist/schema/types/time/utc-time.d.ts +10 -0
- package/dist/schema/types/time/utc-time.d.ts.map +1 -0
- package/dist/schema/types/time/utc-time.js +9 -0
- package/dist/schema/types/time/utc-time.js.map +1 -0
- package/dist/schema/validate.d.ts +40 -0
- package/dist/schema/validate.d.ts.map +1 -0
- package/dist/schema/validate.js +176 -0
- package/dist/schema/validate.js.map +1 -0
- package/dist/schema/values.d.ts +132 -0
- package/dist/schema/values.d.ts.map +1 -0
- package/dist/schema/values.js +20 -0
- package/dist/schema/values.js.map +1 -0
- package/dist/schema/walk.d.ts +30 -0
- package/dist/schema/walk.d.ts.map +1 -0
- package/dist/schema/walk.js +86 -0
- package/dist/schema/walk.js.map +1 -0
- package/package.json +76 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { walkDef } from "./walk.js";
|
|
2
|
+
// ── validateSchema ────────────────────────────────────────────────────────────
|
|
3
|
+
/**
|
|
4
|
+
* Perform structural validation on a schema def tree.
|
|
5
|
+
*
|
|
6
|
+
* Checks: - Range / size constraints: min ≤ max. - Unique component names in
|
|
7
|
+
* SEQUENCE and SET. - `paramRef` / `paramValueRef` are only valid inside a
|
|
8
|
+
* parameterized type body (detected as top-level uses that have no template
|
|
9
|
+
* ancestor).
|
|
10
|
+
*
|
|
11
|
+
* Never throws — returns all violations as a list.
|
|
12
|
+
*/
|
|
13
|
+
export function validateSchema(def) {
|
|
14
|
+
const errors = [];
|
|
15
|
+
walkDef(def, (node, path) => {
|
|
16
|
+
if (node.kind === "sequence" || node.kind === "set") {
|
|
17
|
+
const names = new Set();
|
|
18
|
+
for (const comp of node.components) {
|
|
19
|
+
if (comp.kind === "component") {
|
|
20
|
+
if (names.has(comp.name)) {
|
|
21
|
+
errors.push({
|
|
22
|
+
path,
|
|
23
|
+
message: `Duplicate component name: "${comp.name}"`,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
names.add(comp.name);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (node.kind === "integer" ||
|
|
31
|
+
node.kind === "real" ||
|
|
32
|
+
node.kind === "octetString" ||
|
|
33
|
+
node.kind === "bitString" ||
|
|
34
|
+
node.kind === "utf8String" ||
|
|
35
|
+
node.kind === "numericString" ||
|
|
36
|
+
node.kind === "printableString" ||
|
|
37
|
+
node.kind === "ia5String" ||
|
|
38
|
+
node.kind === "visibleString" ||
|
|
39
|
+
node.kind === "generalString" ||
|
|
40
|
+
node.kind === "universalString" ||
|
|
41
|
+
node.kind === "bmpString" ||
|
|
42
|
+
node.kind === "teletexString" ||
|
|
43
|
+
node.kind === "videotexString" ||
|
|
44
|
+
node.kind === "graphicString" ||
|
|
45
|
+
node.kind === "sequenceOf" ||
|
|
46
|
+
node.kind === "setOf") {
|
|
47
|
+
const constraints = node.constraints ??
|
|
48
|
+
[];
|
|
49
|
+
for (const c of constraints) {
|
|
50
|
+
checkRangeBounds(c, path, errors);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (node.kind === "paramRef" || node.kind === "paramValueRef") {
|
|
54
|
+
errors.push({
|
|
55
|
+
path,
|
|
56
|
+
message: `"${node.kind}" can only appear inside a parameterized type body`,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
return { valid: errors.length === 0, errors };
|
|
61
|
+
}
|
|
62
|
+
function checkRangeBounds(c, path, errors) {
|
|
63
|
+
if (c.kind === "valueRange" || c.kind === "size") {
|
|
64
|
+
const { min, max } = c;
|
|
65
|
+
if (typeof min === "bigint" && typeof max === "bigint" && min > max) {
|
|
66
|
+
errors.push({
|
|
67
|
+
path,
|
|
68
|
+
message: `Constraint ${c.kind}: min (${min}) > max (${max})`,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (typeof min === "number" && typeof max === "number" && min > max) {
|
|
72
|
+
errors.push({
|
|
73
|
+
path,
|
|
74
|
+
message: `Constraint ${c.kind}: min (${min}) > max (${max})`,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (c.kind === "union" || c.kind === "intersection") {
|
|
79
|
+
for (const operand of c.operands) {
|
|
80
|
+
checkRangeBounds(operand, path, errors);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (c.kind === "extensibleConstraint") {
|
|
84
|
+
checkRangeBounds(c.constraint, path, errors);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// ── checkValueConstraint ──────────────────────────────────────────────────────
|
|
88
|
+
/**
|
|
89
|
+
* Check a runtime value against the declared constraints of a def.
|
|
90
|
+
*
|
|
91
|
+
* Returns all violations; never throws. This is encoding-format independent.
|
|
92
|
+
*/
|
|
93
|
+
export function checkValueConstraint(def, value) {
|
|
94
|
+
const violations = [];
|
|
95
|
+
const constraints = def.constraints ?? [];
|
|
96
|
+
for (const c of constraints) {
|
|
97
|
+
checkOneConstraint(c, value, violations);
|
|
98
|
+
}
|
|
99
|
+
return { ok: violations.length === 0, violations };
|
|
100
|
+
}
|
|
101
|
+
function checkOneConstraint(c, value, violations) {
|
|
102
|
+
if (c.kind === "valueRange") {
|
|
103
|
+
const n = typeof value === "bigint"
|
|
104
|
+
? value
|
|
105
|
+
: typeof value === "number"
|
|
106
|
+
? BigInt(value)
|
|
107
|
+
: undefined;
|
|
108
|
+
if (n !== undefined) {
|
|
109
|
+
const min = typeof c.min === "bigint"
|
|
110
|
+
? c.min
|
|
111
|
+
: c.min === "MIN"
|
|
112
|
+
? undefined
|
|
113
|
+
: BigInt(c.min);
|
|
114
|
+
const max = typeof c.max === "bigint"
|
|
115
|
+
? c.max
|
|
116
|
+
: c.max === "MAX"
|
|
117
|
+
? undefined
|
|
118
|
+
: BigInt(c.max);
|
|
119
|
+
if (min !== undefined && n < min) {
|
|
120
|
+
violations.push({ constraint: c, message: `Value ${n} < min ${min}` });
|
|
121
|
+
}
|
|
122
|
+
if (max !== undefined && n > max) {
|
|
123
|
+
violations.push({ constraint: c, message: `Value ${n} > max ${max}` });
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (c.kind === "size") {
|
|
129
|
+
const len = typeof value === "string"
|
|
130
|
+
? BigInt(value.length)
|
|
131
|
+
: value instanceof Uint8Array
|
|
132
|
+
? BigInt(value.byteLength)
|
|
133
|
+
: Array.isArray(value)
|
|
134
|
+
? BigInt(value.length)
|
|
135
|
+
: undefined;
|
|
136
|
+
if (len !== undefined) {
|
|
137
|
+
const min = typeof c.min === "bigint"
|
|
138
|
+
? c.min
|
|
139
|
+
: c.min === "MIN"
|
|
140
|
+
? 0n
|
|
141
|
+
: BigInt(c.min);
|
|
142
|
+
const max = typeof c.max === "bigint"
|
|
143
|
+
? c.max
|
|
144
|
+
: c.max === "MAX"
|
|
145
|
+
? undefined
|
|
146
|
+
: BigInt(c.max);
|
|
147
|
+
if (len < min) {
|
|
148
|
+
violations.push({ constraint: c, message: `Size ${len} < min ${min}` });
|
|
149
|
+
}
|
|
150
|
+
if (max !== undefined && len > max) {
|
|
151
|
+
violations.push({ constraint: c, message: `Size ${len} > max ${max}` });
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
if (c.kind === "permittedAlphabet") {
|
|
157
|
+
if (typeof value === "string") {
|
|
158
|
+
for (const ch of value) {
|
|
159
|
+
if (!c.alphabet.includes(ch)) {
|
|
160
|
+
violations.push({
|
|
161
|
+
constraint: c,
|
|
162
|
+
message: `Character "${ch}" not in permitted alphabet`,
|
|
163
|
+
});
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (c.kind === "extensibleConstraint") {
|
|
171
|
+
// Extension root is checked; extension additions are not.
|
|
172
|
+
checkOneConstraint(c.constraint, value, violations);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/schema/validate.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA8BpC,iFAAiF;AAEjF;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc,CAAC,GAAmB;IACjD,MAAM,MAAM,GAA4B,EAAE,CAAC;IAE3C,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;QAC3B,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;YACrD,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;YAChC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;gBACpC,IAAI,IAAI,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;oBAC/B,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;wBAC1B,MAAM,CAAC,IAAI,CAAC;4BACX,IAAI;4BACJ,OAAO,EAAE,8BAA8B,IAAI,CAAC,IAAI,GAAG;yBACnD,CAAC,CAAC;oBACJ,CAAC;oBACD,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACtB,CAAC;YACF,CAAC;QACF,CAAC;QAED,IACC,IAAI,CAAC,IAAI,KAAK,SAAS;YACvB,IAAI,CAAC,IAAI,KAAK,MAAM;YACpB,IAAI,CAAC,IAAI,KAAK,aAAa;YAC3B,IAAI,CAAC,IAAI,KAAK,WAAW;YACzB,IAAI,CAAC,IAAI,KAAK,YAAY;YAC1B,IAAI,CAAC,IAAI,KAAK,eAAe;YAC7B,IAAI,CA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,EAAE,EAAE,CAAC,CAAC;YACzE,CAAC;QACF,CAAC;QACD,OAAO;IACR,CAAC;IAED,IAAI,CAAC,CAAC,IAAI,KAAK,mBAAmB,EAAE,CAAC;QACpC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC/B,KAAK,MAAM,EAAE,IAAI,KAAK,EAAE,CAAC;gBACxB,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;oBAC9B,UAAU,CAAC,IAAI,CAAC;wBACf,UAAU,EAAE,CAAC;wBACb,OAAO,EAAE,cAAc,EAAE,6BAA6B;qBACtD,CAAC,CAAC;oBACH,MAAM;gBACP,CAAC;YACF,CAAC;QACF,CAAC;QACD,OAAO;IACR,CAAC;IAED,IAAI,CAAC,CAAC,IAAI,KAAK,sBAAsB,EAAE,CAAC;QACvC,0DAA0D;QAC1D,kBAAkB,CAAC,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;QACpD,OAAO;IACR,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime value representations used by the schema layer.
|
|
3
|
+
*
|
|
4
|
+
* These types carry the decoded or to-be-encoded values for ASN.1 types that
|
|
5
|
+
* require more than a primitive JS value. They are intentionally separate from
|
|
6
|
+
* the schema _definition_ types in `def.ts` and `types/`.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* A decoded BIT STRING value per X.680 §22 / X.690 §8.6.
|
|
10
|
+
*
|
|
11
|
+
* `unusedBits` is the count of trailing (least-significant) bits in the last
|
|
12
|
+
* byte of `bytes` that are not part of the bit string; valid range is 0..7.
|
|
13
|
+
* When `bytes` is empty, `unusedBits` must be 0.
|
|
14
|
+
*/
|
|
15
|
+
export interface BitStringValue {
|
|
16
|
+
readonly bytes: Uint8Array;
|
|
17
|
+
readonly unusedBits: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A finite REAL value encoded as `mantissa × 10^exponent` (decimal base). Both
|
|
21
|
+
* `mantissa` and `exponent` are arbitrary-precision integers, matching the
|
|
22
|
+
* precision guarantees of the ASN.1 REAL type (X.680 §21, X.690 §8.5).
|
|
23
|
+
*/
|
|
24
|
+
export interface RealFiniteValue {
|
|
25
|
+
readonly kind: "finite";
|
|
26
|
+
/** Signed mantissa. Zero mantissa represents the value 0. */
|
|
27
|
+
readonly mantissa: bigint;
|
|
28
|
+
/** Exponent (may be negative). */
|
|
29
|
+
readonly exponent: bigint;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A REAL value: either a finite decimal or one of the three special values
|
|
33
|
+
* PLUS-INFINITY, MINUS-INFINITY, and NOT-A-NUMBER (X.680 §21.1, X.690 §8.5.9).
|
|
34
|
+
*/
|
|
35
|
+
export type RealValue = RealFiniteValue | {
|
|
36
|
+
readonly kind: "plusInfinity";
|
|
37
|
+
} | {
|
|
38
|
+
readonly kind: "minusInfinity";
|
|
39
|
+
} | {
|
|
40
|
+
readonly kind: "notANumber";
|
|
41
|
+
};
|
|
42
|
+
/** REAL special value: PLUS-INFINITY (X.680 §21.1). */
|
|
43
|
+
export declare const REAL_PLUS_INFINITY: RealValue;
|
|
44
|
+
/** REAL special value: MINUS-INFINITY (X.680 §21.1). */
|
|
45
|
+
export declare const REAL_MINUS_INFINITY: RealValue;
|
|
46
|
+
/** REAL special value: NOT-A-NUMBER (X.680 §21.1, ITU-T 2021 edition). */
|
|
47
|
+
export declare const REAL_NOT_A_NUMBER: RealValue;
|
|
48
|
+
/** REAL value zero (mantissa = 0, exponent = 0). */
|
|
49
|
+
export declare const REAL_ZERO: RealValue;
|
|
50
|
+
/**
|
|
51
|
+
* A decoded UTCTime value per X.680 §45 / X.690 §11.8.
|
|
52
|
+
*
|
|
53
|
+
* `year` is the expanded four-digit year. The DER encoding allows only two
|
|
54
|
+
* digits (YY); values 00..49 map to 2000..2049, 50..99 map to 1950..1999 (RFC
|
|
55
|
+
* 5280 §4.1.2.5.1). The schema layer stores the expanded year directly.
|
|
56
|
+
*
|
|
57
|
+
* `utcOffsetMinutes` is 0 for the `Z` suffix (UTC), or a positive/negative
|
|
58
|
+
* offset in minutes for `+HHMM`/`-HHMM` forms.
|
|
59
|
+
*/
|
|
60
|
+
export interface UtcTimeValue {
|
|
61
|
+
readonly year: number;
|
|
62
|
+
readonly month: number;
|
|
63
|
+
readonly day: number;
|
|
64
|
+
readonly hour: number;
|
|
65
|
+
readonly minute: number;
|
|
66
|
+
readonly second: number;
|
|
67
|
+
readonly utcOffsetMinutes: number;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* A decoded GeneralizedTime value per X.680 §46 / X.690 §11.7.
|
|
71
|
+
*
|
|
72
|
+
* `fraction` is a value in [0, 1) representing the fractional-second part (e.g.
|
|
73
|
+
* `.5` → 500 ms). It is `undefined` when no fractional second was encoded.
|
|
74
|
+
*
|
|
75
|
+
* `utcOffsetMinutes` is `0` for the `Z` suffix, a non-zero integer for an
|
|
76
|
+
* explicit `+HHMM`/`-HHMM` offset, and `undefined` when no timezone suffix is
|
|
77
|
+
* present (local time).
|
|
78
|
+
*/
|
|
79
|
+
export interface GeneralizedTimeValue {
|
|
80
|
+
readonly year: number;
|
|
81
|
+
readonly month: number;
|
|
82
|
+
readonly day: number;
|
|
83
|
+
readonly hour: number;
|
|
84
|
+
readonly minute: number;
|
|
85
|
+
readonly second: number;
|
|
86
|
+
readonly fraction?: number | null;
|
|
87
|
+
readonly utcOffsetMinutes?: number | null;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* A raw ANY value: the complete DER encoding (tag + length + content) of the
|
|
91
|
+
* ANY value as received or to be sent. `encoded` is optional for encoding
|
|
92
|
+
* (omitted encodes as empty); always present after decoding.
|
|
93
|
+
*/
|
|
94
|
+
export interface AnyValue {
|
|
95
|
+
readonly encoded?: Uint8Array;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* A named number: an IDENTIFIER associated with an INTEGER or ENUMERATED value
|
|
99
|
+
* per X.680 §19.1 and §20.1.
|
|
100
|
+
*/
|
|
101
|
+
export interface NamedNumber {
|
|
102
|
+
readonly name: string;
|
|
103
|
+
readonly value: bigint;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* A named bit: an IDENTIFIER associated with a bit position in a BIT STRING per
|
|
107
|
+
* X.680 §22.4. Bit 0 is the first (most-significant) bit.
|
|
108
|
+
*/
|
|
109
|
+
export interface NamedBit {
|
|
110
|
+
readonly name: string;
|
|
111
|
+
/** Zero-based index into the bit string; bit 0 is the most-significant bit. */
|
|
112
|
+
readonly index: number;
|
|
113
|
+
}
|
|
114
|
+
declare const openTypeValueBrand: unique symbol;
|
|
115
|
+
/**
|
|
116
|
+
* A phantom-branded container for values carried in an ASN.1 open type
|
|
117
|
+
* (information object class field whose governing type is unknown at
|
|
118
|
+
* schema-definition time, X.681 §14).
|
|
119
|
+
*
|
|
120
|
+
* The type parameters `_Class` and `_Field` are phantom markers that allow the
|
|
121
|
+
* TypeScript type system to distinguish open-type values from different
|
|
122
|
+
* information object classes and fields, preventing accidental mixing.
|
|
123
|
+
*
|
|
124
|
+
* @template _Class — The information object class that governs this field.
|
|
125
|
+
* @template _Field — The string literal name of the open field.
|
|
126
|
+
*/
|
|
127
|
+
export interface OpenTypeValue<_Class = unknown, _Field extends string = string> {
|
|
128
|
+
readonly [openTypeValueBrand]: readonly [_Class, _Field];
|
|
129
|
+
readonly value: unknown;
|
|
130
|
+
}
|
|
131
|
+
export {};
|
|
132
|
+
//# sourceMappingURL=values.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"values.d.ts","sourceRoot":"","sources":["../../src/schema/values.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ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,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1C;AAID;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC;CAC9B;AAID;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,+EAA+E;IAC/E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACvB;AAID,OAAO,CAAC,MAAM,kBAAkB,EAAE,OAAO,MAAM,CAAC;AAEhD;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,aAAa,CAC7B,MAAM,GAAG,OAAO,EAChB,MAAM,SAAS,MAAM,GAAG,MAAM;IAE9B,QAAQ,CAAC,CAAC,kBAAkB,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzD,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACxB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime value representations used by the schema layer.
|
|
3
|
+
*
|
|
4
|
+
* These types carry the decoded or to-be-encoded values for ASN.1 types that
|
|
5
|
+
* require more than a primitive JS value. They are intentionally separate from
|
|
6
|
+
* the schema _definition_ types in `def.ts` and `types/`.
|
|
7
|
+
*/
|
|
8
|
+
/** REAL special value: PLUS-INFINITY (X.680 §21.1). */
|
|
9
|
+
export const REAL_PLUS_INFINITY = { kind: "plusInfinity" };
|
|
10
|
+
/** REAL special value: MINUS-INFINITY (X.680 §21.1). */
|
|
11
|
+
export const REAL_MINUS_INFINITY = { kind: "minusInfinity" };
|
|
12
|
+
/** REAL special value: NOT-A-NUMBER (X.680 §21.1, ITU-T 2021 edition). */
|
|
13
|
+
export const REAL_NOT_A_NUMBER = { kind: "notANumber" };
|
|
14
|
+
/** REAL value zero (mantissa = 0, exponent = 0). */
|
|
15
|
+
export const REAL_ZERO = {
|
|
16
|
+
kind: "finite",
|
|
17
|
+
mantissa: 0n,
|
|
18
|
+
exponent: 0n,
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=values.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"values.js","sourceRoot":"","sources":["../../src/schema/values.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAyCH,uDAAuD;AACvD,MAAM,CAAC,MAAM,kBAAkB,GAAc,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;AACtE,wDAAwD;AACxD,MAAM,CAAC,MAAM,mBAAmB,GAAc,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;AACxE,0EAA0E;AAC1E,MAAM,CAAC,MAAM,iBAAiB,GAAc,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;AACnE,oDAAoD;AACpD,MAAM,CAAC,MAAM,SAAS,GAAc;IACnC,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;CACZ,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { AnyAsn1TypeDef } from "./types/any-def.js";
|
|
2
|
+
/** Continue descending into children (default). */
|
|
3
|
+
export type WalkContinue = "continue";
|
|
4
|
+
/** Skip descending into the current node's children. */
|
|
5
|
+
export type WalkSkipChildren = "skipChildren";
|
|
6
|
+
/** Stop the entire walk immediately. */
|
|
7
|
+
export type WalkStop = "stop";
|
|
8
|
+
/** Control value returned from a visitor callback. */
|
|
9
|
+
export type WalkControl = WalkContinue | WalkSkipChildren | WalkStop;
|
|
10
|
+
/** Sentinel values for each control token. */
|
|
11
|
+
export declare const WalkContinue: WalkContinue;
|
|
12
|
+
export declare const WalkSkipChildren: WalkSkipChildren;
|
|
13
|
+
export declare const WalkStop: WalkStop;
|
|
14
|
+
/**
|
|
15
|
+
* Visitor callback passed to `walkDef`.
|
|
16
|
+
*
|
|
17
|
+
* @param def - The current node.
|
|
18
|
+
* @param path - Dot-separated path from the root to this node.
|
|
19
|
+
* @returns Control token; `undefined` is treated as `"continue"`.
|
|
20
|
+
*/
|
|
21
|
+
export type WalkDefVisitor = (def: AnyAsn1TypeDef, path: string) => WalkControl | undefined | void;
|
|
22
|
+
/**
|
|
23
|
+
* Walk a `AnyAsn1TypeDef` tree in pre-order.
|
|
24
|
+
*
|
|
25
|
+
* - `Asn1LazyTypeDef`: calls `getter()` and descends into the resolved schema.
|
|
26
|
+
* - `ComponentsOfRef`: treated as a reference, not descended into.
|
|
27
|
+
* - Returns `true` if the walk was stopped early (`WalkStop`).
|
|
28
|
+
*/
|
|
29
|
+
export declare function walkDef(def: AnyAsn1TypeDef, visitor: WalkDefVisitor, path?: string): boolean;
|
|
30
|
+
//# sourceMappingURL=walk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walk.d.ts","sourceRoot":"","sources":["../../src/schema/walk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIpD,mDAAmD;AACnD,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC;AACtC,wDAAwD;AACxD,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAC9C,wCAAwC;AACxC,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAC9B,sDAAsD;AACtD,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,gBAAgB,GAAG,QAAQ,CAAC;AAErE,8CAA8C;AAC9C,eAAO,MAAM,YAAY,EAAE,YAAyB,CAAC;AACrD,eAAO,MAAM,gBAAgB,EAAE,gBAAiC,CAAC;AACjE,eAAO,MAAM,QAAQ,EAAE,QAAiB,CAAC;AAIzC;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,CAC5B,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE,MAAM,KACR,WAAW,GAAG,SAAS,GAAG,IAAI,CAAC;AAIpC;;;;;;GAMG;AACH,wBAAgB,OAAO,CACtB,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,cAAc,EACvB,IAAI,SAAK,GACP,OAAO,CAMT"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/** Sentinel values for each control token. */
|
|
2
|
+
export const WalkContinue = "continue";
|
|
3
|
+
export const WalkSkipChildren = "skipChildren";
|
|
4
|
+
export const WalkStop = "stop";
|
|
5
|
+
// ── walkDef ───────────────────────────────────────────────────────────────────
|
|
6
|
+
/**
|
|
7
|
+
* Walk a `AnyAsn1TypeDef` tree in pre-order.
|
|
8
|
+
*
|
|
9
|
+
* - `Asn1LazyTypeDef`: calls `getter()` and descends into the resolved schema.
|
|
10
|
+
* - `ComponentsOfRef`: treated as a reference, not descended into.
|
|
11
|
+
* - Returns `true` if the walk was stopped early (`WalkStop`).
|
|
12
|
+
*/
|
|
13
|
+
export function walkDef(def, visitor, path = "") {
|
|
14
|
+
const control = visitor(def, path) ?? WalkContinue;
|
|
15
|
+
if (control === WalkStop)
|
|
16
|
+
return true;
|
|
17
|
+
if (control === WalkSkipChildren)
|
|
18
|
+
return false;
|
|
19
|
+
return walkChildren(def, visitor, path);
|
|
20
|
+
}
|
|
21
|
+
function walkChildren(def, visitor, path) {
|
|
22
|
+
switch (def.kind) {
|
|
23
|
+
case "sequence":
|
|
24
|
+
case "set": {
|
|
25
|
+
for (let i = 0; i < def.components.length; i++) {
|
|
26
|
+
const comp = def.components[i];
|
|
27
|
+
if (comp.kind === "component") {
|
|
28
|
+
const childPath = `${path ? `${path}.` : ""}components[${i}]:${comp.name}`;
|
|
29
|
+
if (walkDef(comp.type, visitor, childPath))
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
else if (comp.kind === "extensionAdditionGroup") {
|
|
33
|
+
for (let j = 0; j < comp.components.length; j++) {
|
|
34
|
+
const inner = comp.components[j];
|
|
35
|
+
const childPath = `${path ? `${path}.` : ""}components[${i}].components[${j}]:${inner.name}`;
|
|
36
|
+
if (walkDef(inner.type, visitor, childPath))
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// extensionMarker and componentsOf are not descended
|
|
41
|
+
}
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
case "choice": {
|
|
45
|
+
for (let i = 0; i < def.alternatives.length; i++) {
|
|
46
|
+
const alt = def.alternatives[i];
|
|
47
|
+
if ("name" in alt) {
|
|
48
|
+
const childPath = `${path ? `${path}.` : ""}alternatives[${i}]:${alt.name}`;
|
|
49
|
+
if (walkDef(alt.type, visitor, childPath))
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
case "sequenceOf":
|
|
56
|
+
case "setOf": {
|
|
57
|
+
const childPath = `${path ? `${path}.` : ""}elementType`;
|
|
58
|
+
if (walkDef(def.elementType, visitor, childPath))
|
|
59
|
+
return true;
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
case "tagged": {
|
|
63
|
+
const childPath = `${path ? `${path}.` : ""}innerType`;
|
|
64
|
+
if (walkDef(def.innerType, visitor, childPath))
|
|
65
|
+
return true;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
case "transform": {
|
|
69
|
+
const childPath = `${path ? `${path}.` : ""}innerType`;
|
|
70
|
+
if (walkDef(def.innerType, visitor, childPath))
|
|
71
|
+
return true;
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
case "lazy": {
|
|
75
|
+
const resolved = def.getter();
|
|
76
|
+
const childPath = `${path ? `${path}.` : ""}lazy`;
|
|
77
|
+
if (walkDef(resolved, visitor, childPath))
|
|
78
|
+
return true;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
default:
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=walk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walk.js","sourceRoot":"","sources":["../../src/schema/walk.ts"],"names":[],"mappings":"AAaA,8CAA8C;AAC9C,MAAM,CAAC,MAAM,YAAY,GAAiB,UAAU,CAAC;AACrD,MAAM,CAAC,MAAM,gBAAgB,GAAqB,cAAc,CAAC;AACjE,MAAM,CAAC,MAAM,QAAQ,GAAa,MAAM,CAAC;AAgBzC,iFAAiF;AAEjF;;;;;;GAMG;AACH,MAAM,UAAU,OAAO,CACtB,GAAmB,EACnB,OAAuB,EACvB,IAAI,GAAG,EAAE;IAET,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,YAAY,CAAC;IACnD,IAAI,OAAO,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACtC,IAAI,OAAO,KAAK,gBAAgB;QAAE,OAAO,KAAK,CAAC;IAE/C,OAAO,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AACzC,CAAC;AAED,SAAS,YAAY,CACpB,GAAmB,EACnB,OAAuB,EACvB,IAAY;IAEZ,QAAQ,GAAG,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,UAAU,CAAC;QAChB,KAAK,KAAK,EAAE,CAAC;YACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAChD,MAAM,IAAI,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAE,CAAC;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E,OAAO,EAAE,SAAS,CAAC;gBAAE,OAAO,IAAI,CAAC;YACvD,MAAM;QACP,CAAC;QACD;YACC,MAAM;IACR,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ac-kit/format-asn1",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "ASN.1 (X.690) runtime: encoding primitives, the schema model, and the BER, CER, DER and PER codecs as separate subpath exports.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"asn1",
|
|
7
|
+
"ber",
|
|
8
|
+
"codec",
|
|
9
|
+
"der",
|
|
10
|
+
"x690"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/anthochamp/node-essentials/tree/main/packages/format-asn1#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/anthochamp/node-essentials/issues"
|
|
15
|
+
},
|
|
16
|
+
"license": "BSD-3-Clause",
|
|
17
|
+
"author": "Anthony Champagne <dev@anthonychampagne.fr>",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/anthochamp/node-essentials.git",
|
|
21
|
+
"directory": "packages/format-asn1"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
26
|
+
"type": "module",
|
|
27
|
+
"sideEffects": false,
|
|
28
|
+
"main": "./dist/index.js",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": "./dist/index.js",
|
|
31
|
+
"./ber": "./dist/ber.js",
|
|
32
|
+
"./cer": "./dist/cer.js",
|
|
33
|
+
"./der": "./dist/der.js",
|
|
34
|
+
"./per": "./dist/per.js"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"main": "./dist/index.js",
|
|
38
|
+
"exports": {
|
|
39
|
+
".": "./dist/index.js",
|
|
40
|
+
"./ber": "./dist/ber.js",
|
|
41
|
+
"./cer": "./dist/cer.js",
|
|
42
|
+
"./der": "./dist/der.js",
|
|
43
|
+
"./per": "./dist/per.js"
|
|
44
|
+
},
|
|
45
|
+
"access": "public"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"compile": "tsc -p ./tsconfig.build.json -outDir dist",
|
|
49
|
+
"compile:check": "tsc -noEmit -p ./tsconfig.json",
|
|
50
|
+
"clean": "rimraf dist",
|
|
51
|
+
"build": "yarn clean && yarn compile",
|
|
52
|
+
"test": "yarn run -T vitest run",
|
|
53
|
+
"prepack": "yarn build"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@ac-kit/core": "^0.1.0",
|
|
57
|
+
"@ac-kit/format-core": "^0.1.0",
|
|
58
|
+
"@ac-kit/format-oid": "^0.1.0",
|
|
59
|
+
"@ac-kit/format-varint": "^0.1.0",
|
|
60
|
+
"@ac-kit/math-integer": "^0.1.0",
|
|
61
|
+
"@types/node": "^26.5.1"
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"@ac-kit/fixture-x509": "0.1.0",
|
|
65
|
+
"@ac-kit/tsconfig": "0.1.0",
|
|
66
|
+
"@ac-kit/typedoc-config": "0.1.0",
|
|
67
|
+
"@ac-kit/vitest-config": "0.1.0",
|
|
68
|
+
"@typescript/native": "typescript@7.0.2",
|
|
69
|
+
"rimraf": "6.1.3",
|
|
70
|
+
"typedoc": "0.28.20",
|
|
71
|
+
"typescript": "@typescript/typescript6@6.0.2"
|
|
72
|
+
},
|
|
73
|
+
"engines": {
|
|
74
|
+
"node": ">=24"
|
|
75
|
+
}
|
|
76
|
+
}
|