@gerege-systems/eid-mongolia-sdk 0.24.0 → 0.25.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/dist/pades.d.cts CHANGED
@@ -57,6 +57,8 @@ interface PadesPrepareOptions {
57
57
  * Харагдах гарын үсгийн байршил (Go `pades.Appearance`, APPEARANCE_SPEC.md §1). Координат нь pt, тухайн хуудасны CropBox
58
58
  * (байхгүй бол MediaBox)-ийн /Rotate-ийн ДАРААХ (дэлгэцэнд харагдах) зүүн доод булангаас; x баруун тийш, y дээш. Утга бүр
59
59
  * 0.01 pt хүртэл тойрогдоно. Өндөр ≥ 45 pt (QR), эс бөгөөс REQUEST_INVALID.
60
+ * `x, y` нь хүссэн байрлал: тэнд хуудасны агуулга байвал дүрслэл чөлөөт зай руу шилжинэ (PLACEMENT_SPEC.md) — эцсийн
61
+ * байрлал {@link PadesPrepared.placement}-д.
60
62
  */
61
63
  interface PadesAppearance {
62
64
  /** Оролтын баримтын хуудас, 1-ээс; 0/байхгүй = оролтын сүүлийн хуудас (энэ prepare-ийн нэмэх verify хуудас тооцогдохгүй). */
@@ -76,7 +78,30 @@ interface PadesPrepared {
76
78
  docId: string;
77
79
  /** Тунгалаг, сериалчилж хадгалж болно (бэлтгэсэн PDF дотор нь — PDF-тэй ижил нууцлалтай). Go SDK-тай нийцтэй. */
78
80
  state: Uint8Array;
81
+ /** Харагдах дүрслэл хаана зурагдсан (Go `Prepared.Placement`, PLACEMENT_SPEC.md); `appearance`-гүй бол байхгүй. */
82
+ placement?: PadesPlacement;
79
83
  }
84
+ /**
85
+ * The visible stamp's final rect (Go `pades.Placement`, PLACEMENT_SPEC.md) — `appearance` coordinates, pt. The stamp
86
+ * avoids existing page content: `appearance.x/y` is the preferred spot.
87
+ * - `requested` — drawn at `appearance.x/y` (that spot was free);
88
+ * - `moved` — that spot overlapped page content; the stamp moved to the first free spot (mirrored column, then up in
89
+ * 12 pt steps);
90
+ * - `overlap` — no free spot; drawn at the requested spot over content;
91
+ * - `unscanned` — the page could not be scanned within the limits; drawn at the requested spot.
92
+ *
93
+ * The signature is valid in every case; surface `overlap` / `unscanned` to the user (e.g. a notice).
94
+ */
95
+ interface PadesPlacement {
96
+ /** 1-based page of the input document the stamp is on. */
97
+ page: number;
98
+ x: number;
99
+ y: number;
100
+ width: number;
101
+ height: number;
102
+ status: PadesPlacementStatus;
103
+ }
104
+ type PadesPlacementStatus = "requested" | "moved" | "overlap" | "unscanned";
80
105
  interface PadesCompleteOptions {
81
106
  /** RFC 3161 TSA. Анхдагч `https://tsa.timeserver.mn/`. */
82
107
  tsaUrl?: string;
@@ -153,4 +178,4 @@ declare function prepare(pdf: Uint8Array | ArrayBuffer, opts: PadesPrepareOption
153
178
  */
154
179
  declare function complete(state: Uint8Array | ArrayBuffer, signature: Uint8Array | string, opts?: PadesCompleteOptions): Promise<PadesCompleted>;
155
180
 
156
- export { CertificateRevokedError, PADES_ERROR_CODES, PROFILE_VERSION, type PadesAppearance, type PadesCompleteOptions, type PadesCompleted, PadesError, type PadesErrorCode, type PadesPrepareOptions, type PadesPrepared, complete, prepare, profileVersion };
181
+ export { CertificateRevokedError, PADES_ERROR_CODES, PROFILE_VERSION, type PadesAppearance, type PadesCompleteOptions, type PadesCompleted, PadesError, type PadesErrorCode, type PadesPlacement, type PadesPlacementStatus, type PadesPrepareOptions, type PadesPrepared, complete, prepare, profileVersion };
package/dist/pades.d.ts CHANGED
@@ -57,6 +57,8 @@ interface PadesPrepareOptions {
57
57
  * Харагдах гарын үсгийн байршил (Go `pades.Appearance`, APPEARANCE_SPEC.md §1). Координат нь pt, тухайн хуудасны CropBox
58
58
  * (байхгүй бол MediaBox)-ийн /Rotate-ийн ДАРААХ (дэлгэцэнд харагдах) зүүн доод булангаас; x баруун тийш, y дээш. Утга бүр
59
59
  * 0.01 pt хүртэл тойрогдоно. Өндөр ≥ 45 pt (QR), эс бөгөөс REQUEST_INVALID.
60
+ * `x, y` нь хүссэн байрлал: тэнд хуудасны агуулга байвал дүрслэл чөлөөт зай руу шилжинэ (PLACEMENT_SPEC.md) — эцсийн
61
+ * байрлал {@link PadesPrepared.placement}-д.
60
62
  */
61
63
  interface PadesAppearance {
62
64
  /** Оролтын баримтын хуудас, 1-ээс; 0/байхгүй = оролтын сүүлийн хуудас (энэ prepare-ийн нэмэх verify хуудас тооцогдохгүй). */
@@ -76,7 +78,30 @@ interface PadesPrepared {
76
78
  docId: string;
77
79
  /** Тунгалаг, сериалчилж хадгалж болно (бэлтгэсэн PDF дотор нь — PDF-тэй ижил нууцлалтай). Go SDK-тай нийцтэй. */
78
80
  state: Uint8Array;
81
+ /** Харагдах дүрслэл хаана зурагдсан (Go `Prepared.Placement`, PLACEMENT_SPEC.md); `appearance`-гүй бол байхгүй. */
82
+ placement?: PadesPlacement;
79
83
  }
84
+ /**
85
+ * The visible stamp's final rect (Go `pades.Placement`, PLACEMENT_SPEC.md) — `appearance` coordinates, pt. The stamp
86
+ * avoids existing page content: `appearance.x/y` is the preferred spot.
87
+ * - `requested` — drawn at `appearance.x/y` (that spot was free);
88
+ * - `moved` — that spot overlapped page content; the stamp moved to the first free spot (mirrored column, then up in
89
+ * 12 pt steps);
90
+ * - `overlap` — no free spot; drawn at the requested spot over content;
91
+ * - `unscanned` — the page could not be scanned within the limits; drawn at the requested spot.
92
+ *
93
+ * The signature is valid in every case; surface `overlap` / `unscanned` to the user (e.g. a notice).
94
+ */
95
+ interface PadesPlacement {
96
+ /** 1-based page of the input document the stamp is on. */
97
+ page: number;
98
+ x: number;
99
+ y: number;
100
+ width: number;
101
+ height: number;
102
+ status: PadesPlacementStatus;
103
+ }
104
+ type PadesPlacementStatus = "requested" | "moved" | "overlap" | "unscanned";
80
105
  interface PadesCompleteOptions {
81
106
  /** RFC 3161 TSA. Анхдагч `https://tsa.timeserver.mn/`. */
82
107
  tsaUrl?: string;
@@ -153,4 +178,4 @@ declare function prepare(pdf: Uint8Array | ArrayBuffer, opts: PadesPrepareOption
153
178
  */
154
179
  declare function complete(state: Uint8Array | ArrayBuffer, signature: Uint8Array | string, opts?: PadesCompleteOptions): Promise<PadesCompleted>;
155
180
 
156
- export { CertificateRevokedError, PADES_ERROR_CODES, PROFILE_VERSION, type PadesAppearance, type PadesCompleteOptions, type PadesCompleted, PadesError, type PadesErrorCode, type PadesPrepareOptions, type PadesPrepared, complete, prepare, profileVersion };
181
+ export { CertificateRevokedError, PADES_ERROR_CODES, PROFILE_VERSION, type PadesAppearance, type PadesCompleteOptions, type PadesCompleted, PadesError, type PadesErrorCode, type PadesPlacement, type PadesPlacementStatus, type PadesPrepareOptions, type PadesPrepared, complete, prepare, profileVersion };