콘텐츠로 이동

NotificationRecipientLiveness — @gj-kit/nest-notifications

@gj-kit/nest-notifications/core에서 공개하는 interface입니다. package version 0.1.1의 release declaration을 그대로 표시합니다.

import { NotificationRecipientLiveness } from '@gj-kit/nest-notifications/core';
/**
* ingress·계정 수명주기 포트와 의무 I1–I3 · L1–L4 (설계 §3.3.6).
*
* 파이프라인은 이 파일의 어떤 메서드도 호출하지 않는다. 그런데도 `./core`에 있는 이유는
* 이 패키지의 첫 보증(G1: ingress 멱등)과 유일한 "개인정보 사고" 등급 보증(G7: tombstone
* 이후 배달 0)이 전적으로 이 두 포트 위에 서 있기 때문이다. 라이브러리가 이 의무를 강제할
* 수 없다는 사실도 그대로 적는다 — 강제하는 것은 `./testing`의 적합성 케이스뿐이다.
*/
/**
* Recipient lifecycle barrier. The library calls neither method: staging calls
* `ensureLive` from the host publisher, and account deletion calls `tombstone`
* from the host lifecycle.
*
* `notificationRecipientKey(applicationKey, recipientRef)` is the intended key
* for the tombstone row: it lets an implementation retain the barrier after a
* purge without retaining the raw recipient reference.
*
* Obligations (design 3.3.6):
*
* - **I2** — `stage` calls `ensureLive` inside its own transaction, before the
* insert, and writes nothing when it returns false. Acquiring - not merely
* reading - is what makes stage and purge serialise against each other.
* - **L3** — the tombstone row survives the purge that follows it. Delete it and
* a late `ensureLive` returns true, so a deleted account starts receiving
* notifications again.
*/
interface NotificationRecipientLiveness<Transaction = unknown> {
/**
* Acquires the recipient gate inside this transaction and returns false once
* the ref is tombstoned (I2).
*/
ensureLive(transaction: Transaction, applicationKey: string, recipientRef: string): Promise<boolean>;
/** Marks deletion. The tombstone row must survive the purge that follows (L3). */
tombstone(transaction: Transaction, applicationKey: string, recipientRef: string): Promise<void>;
}

이 선언은 매개변수, optionality, 제네릭, 반환값, 공개 union/type 계약의 정본입니다. 호출 전 필요한 환경·권한·오류 경계는 패키지 Golden path와 이 subpath의 import 조건을 함께 확인하세요.

  • 패키지: @gj-kit/nest-notifications
  • 버전: 0.1.1
  • 공개 entry: ./core
  • 소스: GitHub

Recipient lifecycle barrier. The library calls neither method: staging calls ensureLive from the host publisher, and account deletion calls tombstone from the host lifecycle.

notificationRecipientKey(applicationKey, recipientRef) is the intended key for the tombstone row: it lets an implementation retain the barrier after a purge without retaining the raw recipient reference.

Obligations (design 3.3.6):

  • I2stage calls ensureLive inside its own transaction, before the insert, and writes nothing when it returns false. Acquiring - not merely reading - is what makes stage and purge serialise against each other.
  • L3 — the tombstone row survives the purge that follows it. Delete it and a late ensureLive returns true, so a deleted account starts receiving notifications again.