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

未关闭 适合新手
#449 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
typescript
领域
api

调研方向

从 index.ts 开始,将其中与通知相关的导出与 models/ConsumptionRequestReason 和 models/FirstSendAttemptResult 进行比较。编译 issue 中的 TypeScript consumer 示例,然后构建 package,并验证从 package 根目录导入的内容能在生成的 JavaScript 文件和声明文件中正常工作;应在公开 FirstSendAttemptResult 之前确定其预期状态。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
TypeScript
星标
388
派生
88
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apple/app-store-server-library-node 的其他 Issue

查看 apple/app-store-server-library-node 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。