@pubid/pubid 0.1.56 → 0.1.57

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.
@@ -158,6 +158,7 @@ export declare class IsoTcDocument extends IsoIdentifier {
158
158
  readonly sc_number: string | undefined;
159
159
  readonly wg_type: string | undefined;
160
160
  readonly wg_number: string | undefined;
161
+ constructor(attrs?: Record<string, unknown>);
161
162
  render(): string;
162
163
  }
163
164
  export declare class IsoBundledIdentifier extends IsoIdentifier {
@@ -774,8 +774,23 @@ export class IsoTcDocument extends IsoIdentifier {
774
774
  wg_type: { type: "string" },
775
775
  wg_number: { type: "string" },
776
776
  });
777
- static mappings = keyValue({ wire: "tc_type", to: "tc_type" }, { wire: "tc_number", to: "tc_number" }, { wire: "sc_type", to: "sc_type" }, { wire: "sc_number", to: "sc_number" }, { wire: "wg_type", to: "wg_type" }, { wire: "wg_number", to: "wg_number" }, { wire: "number", to: "number" }, ...dateTrio(), { wire: "publisher", to: "publisher" });
777
+ static mappings = keyValue({ wire: "tc_type", to: "tc_type" }, { wire: "tc_number", to: "tc_number" }, { wire: "sc_type", to: "sc_type" }, { wire: "sc_number", to: "sc_number" }, { wire: "wg_type", to: "wg_type" }, { wire: "wg_number", to: "wg_number" }, { wire: "number", to: "number" }, ...dateTrio(),
778
+ // The gem's inherited mapping + default-drop semantics: the ISO
779
+ // publisher stays off the wire, a non-ISO publisher emits ("IEC/TC
780
+ // 10 N 5" keeps publisher: "IEC").
781
+ ...publisherMappings());
778
782
  static urnGenerator = IsoUrnGenerator;
783
+ constructor(attrs = {}) {
784
+ super(attrs);
785
+ // The gem materializes the publisher default on every construction
786
+ // path (parse, from_hash, the bare-TC route): a TC document always
787
+ // carries a publisher (ISO unless the face names another), so
788
+ // from_hash of a default-published row renders the full face.
789
+ const self = this;
790
+ if (self["publisher"] === undefined) {
791
+ self["publisher"] = new IsoPublisher({});
792
+ }
793
+ }
779
794
  render() {
780
795
  let result = this.publisher === undefined ? "" : this.publisher.render();
781
796
  if (this.tc_type !== undefined && this.tc_type !== "")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pubid/pubid",
3
- "version": "0.1.56",
3
+ "version": "0.1.57",
4
4
  "description": "TypeScript PubID identifiers: resolution, normalization and canonical hashes for every identifier in the pubid-testsuite corpus (41 standards bodies), with a conformance runner mirroring the Ruby reference",
5
5
  "type": "module",
6
6
  "license": "MIT",