Export ConsumptionRequestReason from the package entry point; consider exposing FirstSendAttemptResult for consistency

Aperta Adatta ai principianti
#449 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
api

Direzione di ricerca

Inizia da index.ts e confronta i suoi export relativi alle notifiche con models/ConsumptionRequestReason e models/FirstSendAttemptResult. Compila l’esempio di consumer TypeScript dell’issue, quindi builda il package e verifica che gli import dalla root del package funzionino nei file JavaScript e di dichiarazione emessi; lo stato previsto di FirstSendAttemptResult deve essere determinato prima di esporlo.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Description

ConsumptionRequestReason is a defined enum used by the public Data.consumptionRequestReason field, but index.ts does not re-export it. Consumers cannot import the enum from @apple/app-store-server-library, even though they can receive values of that field in decoded notifications.

Consumers must currently use string literals or import the enum through an internal distribution path. This is inconsistent with the package's public exports for other notification-related enums.

FirstSendAttemptResult is also defined but not re-exported. Unlike ConsumptionRequestReason, it is not referenced by any current model in this revision. Exposing it is therefore a separate API-consistency consideration, not evidence that a current model's enum is inaccessible. If that enum is obsolete, maintainers may prefer to clarify its status rather than add it to the public API.

Reproduction

Compile this consumer code:

import {
  ConsumptionRequestReason,
  FirstSendAttemptResult,
} from '@apple/app-store-server-library';

console.log(ConsumptionRequestReason.UNINTENDED_PURCHASE);
console.log(FirstSendAttemptResult.SUCCESS);

Both imports fail with a missing-export diagnostic. TypeScript 5.9.3 reported TS2724 for each symbol under both moduleResolution: "NodeNext" and moduleResolution: "Bundler".

Existing exports such as Environment and SignedDataVerifier compile successfully in the same consumer configurations, isolating the problem to the missing symbols.

Expected behavior

Consumers should be able to import ConsumptionRequestReason from the package entry point and compare notification data against its named values.

Suggested change

Add the missing public export:

export { ConsumptionRequestReason } from './models/ConsumptionRequestReason';

If FirstSendAttemptResult is intended to remain a supported public enum, also add:

export { FirstSendAttemptResult } from './models/FirstSendAttemptResult';

Verify that the package's emitted JavaScript and declarations expose the intended symbols to package-root imports.

Lingua principale
TypeScript
Stelle
388
Fork
88
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apple/app-store-server-library-node

Tutte le issue di apple/app-store-server-library-node

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.