apple / apple/app-store-server-library-node
Export ConsumptionRequestReason from the package entry point; consider exposing FirstSendAttemptResult for consistency
- Dominant language
- TypeScript
- Stars
- 382
- Forks
- 79
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 9
Description
### 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:
```ts
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:
```ts
export { ConsumptionRequestReason } from './models/ConsumptionRequestReason';
```
If `FirstSendAttemptResult` is intended to remain a supported public enum, also add:
```ts
export { FirstSendAttemptResult } from './models/FirstSendAttemptResult';
```
Verify that the package's emitted JavaScript and declarations expose the intended symbols to package-root imports.
Contributor guide
Research direction
Start in index.ts and compare its notification-related exports with models/ConsumptionRequestReason and models/FirstSendAttemptResult. Compile the issue's TypeScript consumer example, then build the package and verify that package-root imports work in the emitted JavaScript and declaration files; the intended status of FirstSendAttemptResult should be resolved before exposing it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 78/100