ts-pantry 0.10.56 → 0.11.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.
Files changed (32) hide show
  1. package/README.md +57 -1
  2. package/dist/app-store-connect.d.ts +158 -0
  3. package/dist/apple-certificates.d.ts +20 -0
  4. package/dist/bin/cli.js +41 -40
  5. package/dist/{chunk-g45rx4qn.js → chunk-2r9gt49p.js} +1 -1
  6. package/dist/{chunk-243kyjt8.js → chunk-403r79k6.js} +1 -1
  7. package/dist/{chunk-fggtv7gr.js → chunk-4gsrdtkb.js} +2 -2
  8. package/dist/{chunk-7d18r8aq.js → chunk-7msnsp1q.js} +2 -2
  9. package/dist/{chunk-zax8rwyg.js → chunk-8mzpwg2g.js} +1 -1
  10. package/dist/{chunk-jnrjjq8g.js → chunk-99e8jvg1.js} +1 -1
  11. package/dist/{chunk-vk0011mp.js → chunk-9ea7rzny.js} +2 -2
  12. package/dist/{chunk-znwq0cy6.js → chunk-9xe74rn4.js} +2 -2
  13. package/dist/{chunk-w804jptv.js → chunk-bsr3eswp.js} +1 -1
  14. package/dist/chunk-cqmq679y.js +1 -0
  15. package/dist/{chunk-13cp851v.js → chunk-fwgm0ck3.js} +1 -1
  16. package/dist/{chunk-8j53ncpc.js → chunk-g0992q6d.js} +1 -1
  17. package/dist/{chunk-0bgpvt66.js → chunk-h9bv6j3d.js} +1 -1
  18. package/dist/chunk-m3zve6gx.js +313 -0
  19. package/dist/{chunk-svr72cg1.js → chunk-mjkz6cxz.js} +4 -4
  20. package/dist/{chunk-dfe5chgn.js → chunk-mt6r4c0m.js} +1 -1
  21. package/dist/{chunk-rerj2ggp.js → chunk-pwytxyxw.js} +1 -1
  22. package/dist/chunk-pxfqk9q8.js +1 -0
  23. package/dist/{chunk-5td888mq.js → chunk-qzr4847k.js} +2 -2
  24. package/dist/chunk-xbcryeyd.js +1 -0
  25. package/dist/index.d.ts +2 -0
  26. package/dist/src/index.js +1 -1
  27. package/dist/src/testing/index.js +1 -1
  28. package/package.json +1 -1
  29. package/dist/chunk-063dmhj6.js +0 -313
  30. package/dist/chunk-ed3ddn6h.js +0 -1
  31. package/dist/chunk-qabzt0r1.js +0 -1
  32. package/dist/chunk-rj5fg7v6.js +0 -1
package/README.md CHANGED
@@ -5,7 +5,7 @@ TypeScript types for Pantry package manager configuration with **full type valid
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- bun add -d ts-pantry ts-pantry
8
+ bun add -d ts-pantry
9
9
  ```
10
10
 
11
11
  ## Usage
@@ -42,6 +42,62 @@ export default config
42
42
  - **IntelliSense Support**: Get autocomplete for all 3000+ packages from the pkgx registry
43
43
  - **Version Validation**: Invalid versions trigger TypeScript errors
44
44
  - **Zero Configuration**: Just import and use - no additional setup required
45
+ - **App Store Automation**: Provision macOS identifiers, capabilities, certificates,
46
+ and profiles, then manage App Store versions and processed builds
47
+
48
+ ## App Store Connect
49
+
50
+ Pantry owns the provider-neutral Apple distribution layer used by release actions
51
+ and framework integrations. Authentication defaults to
52
+ `APP_STORE_CONNECT_API_KEY_ID`, `APP_STORE_CONNECT_API_ISSUER_ID`, and
53
+ `APP_STORE_CONNECT_API_KEY_PATH`.
54
+
55
+ Provisioning is plan-only unless `checkOnly: false` is explicitly passed. It
56
+ reuses active certificates and profiles and never revokes existing resources.
57
+ Apple requires the initial app record to be created manually in App Store
58
+ Connect; Pantry reports that remaining action in its result.
59
+
60
+ ```bash
61
+ # Generate the two private-key/CSR pairs locally.
62
+ ts-pantry app-store:csr --name "Example Desktop"
63
+
64
+ # Safe plan (no Apple resources are changed).
65
+ ts-pantry app-store:provision \
66
+ --bundle-id com.example.desktop \
67
+ --name "Example Desktop"
68
+
69
+ # Apply after supplying CSRs for any missing certificates.
70
+ ts-pantry app-store:provision \
71
+ --bundle-id com.example.desktop \
72
+ --name "Example Desktop" \
73
+ --app-certificate-csr .pantry/apple/mac-app-distribution.csr \
74
+ --installer-certificate-csr .pantry/apple/mac-installer-distribution.csr \
75
+ --apply
76
+ ```
77
+
78
+ ```typescript
79
+ import {
80
+ AppStoreConnectClient,
81
+ ensureAppStoreVersions,
82
+ provisionMacApp,
83
+ waitForAppStoreBuilds,
84
+ } from 'ts-pantry'
85
+
86
+ const plan = await provisionMacApp({
87
+ identifier: 'com.example.desktop',
88
+ name: 'Example Desktop',
89
+ capabilities: ['APP_GROUPS'],
90
+ })
91
+
92
+ const client = new AppStoreConnectClient()
93
+ const app = await client.findApp('com.example.desktop')
94
+ if (app) {
95
+ const versions = await ensureAppStoreVersions(client, app.id, [
96
+ { platform: 'MAC_OS', version: '1.0.0' },
97
+ ])
98
+ await waitForAppStoreBuilds(client, app.id, versions, '42')
99
+ }
100
+ ```
45
101
 
46
102
  ## Type Definitions
47
103
 
@@ -0,0 +1,158 @@
1
+ export declare function appStoreConnectToken(auth: Required<AppStoreConnectAuth>, now?: number): string;
2
+ /** Create or align an editable App Store version for each requested Apple platform. */
3
+ export declare function ensureAppStoreVersions(client: AppStoreConnectClient, appId: string, requestedVersions: Array<{ platform: AppStoreVersionPlatform, version: string }>): Promise<AppStoreVersionResult[]>;
4
+ /** Wait for uploaded binaries to process, then select them for their App Store versions. */
5
+ export declare function waitForAppStoreBuilds(client: AppStoreConnectClient, appId: string, versions: Array<Pick<AppStoreVersionResult, 'platform' | 'version' | 'id'>>, buildNumber: string, options?: WaitForAppStoreBuildsOptions): Promise<AppStoreBuildAttachmentResult[]>;
6
+ export declare function provisionMacApp(options: MacAppProvisionOptions): Promise<MacAppProvisionResult>;
7
+ export declare interface AppStoreConnectAuth {
8
+ keyId?: string
9
+ issuerId?: string
10
+ keyPath?: string
11
+ }
12
+ export declare interface AppStoreConnectResource<T extends Record<string, unknown>> {
13
+ type: string
14
+ id: string
15
+ attributes: T
16
+ relationships?: Record<string, { data?: { type: string, id: string } | null }>
17
+ }
18
+ export declare interface BundleIdAttributes extends Record<string, unknown> {
19
+ identifier: string
20
+ name: string
21
+ platform: BundleIdPlatform
22
+ seedId?: string
23
+ }
24
+ export declare interface BundleIdCapabilityAttributes extends Record<string, unknown> {
25
+ capabilityType: string
26
+ settings?: Array<Record<string, unknown>>
27
+ }
28
+ export declare interface CertificateAttributes extends Record<string, unknown> {
29
+ certificateType: MacDistributionCertificateType
30
+ displayName?: string
31
+ name?: string
32
+ serialNumber?: string
33
+ platform?: string
34
+ expirationDate?: string
35
+ certificateContent?: string
36
+ activated?: boolean
37
+ }
38
+ export declare interface ProfileAttributes extends Record<string, unknown> {
39
+ name: string
40
+ platform?: BundleIdPlatform
41
+ profileContent?: string
42
+ uuid?: string
43
+ createdDate?: string
44
+ expirationDate?: string
45
+ profileState: 'ACTIVE' | 'INVALID'
46
+ profileType: 'MAC_APP_STORE'
47
+ }
48
+ export declare interface AppAttributes extends Record<string, unknown> {
49
+ bundleId: string
50
+ name: string
51
+ primaryLocale: string
52
+ sku: string
53
+ }
54
+ export declare interface AppStoreVersionAttributes extends Record<string, unknown> {
55
+ platform: AppStoreVersionPlatform
56
+ versionString: string
57
+ appStoreState: string
58
+ }
59
+ export declare interface BuildAttributes extends Record<string, unknown> {
60
+ version: string
61
+ uploadedDate: string
62
+ expired: boolean
63
+ processingState: string
64
+ }
65
+ export declare interface PreReleaseVersionAttributes extends Record<string, unknown> {
66
+ version: string
67
+ platform: AppStoreVersionPlatform
68
+ }
69
+ export declare interface AppStoreBuildResult {
70
+ id: string
71
+ buildNumber: string
72
+ version: string
73
+ platform: AppStoreVersionPlatform
74
+ processingState: string
75
+ }
76
+ export declare interface AppStoreVersionResult {
77
+ platform: AppStoreVersionPlatform
78
+ version: string
79
+ created: boolean
80
+ updated: boolean
81
+ id: string
82
+ status: AppStoreVersionStatus
83
+ appStoreState: string
84
+ reason?: string
85
+ }
86
+ export declare interface AppStoreBuildAttachmentResult {
87
+ platform: AppStoreVersionPlatform
88
+ versionId: string
89
+ buildId: string
90
+ buildNumber: string
91
+ }
92
+ export declare interface WaitForAppStoreBuildsOptions {
93
+ timeoutMs?: number
94
+ pollIntervalMs?: number
95
+ sleep?: (milliseconds: number) => Promise<void>
96
+ now?: () => number
97
+ }
98
+ export declare interface AppStoreConnectClientOptions extends AppStoreConnectAuth {
99
+ baseUrl?: string
100
+ fetch?: typeof globalThis.fetch
101
+ now?: () => number
102
+ }
103
+ export declare interface MacAppProvisionOptions extends AppStoreConnectClientOptions {
104
+ identifier: string
105
+ name: string
106
+ capabilities?: string[]
107
+ appCertificateCsr?: string
108
+ installerCertificateCsr?: string
109
+ profileName?: string
110
+ checkOnly?: boolean
111
+ }
112
+ export declare interface MacAppProvisionResult {
113
+ mode: 'plan' | 'apply'
114
+ bundleId: { identifier: string, id?: string, exists: boolean, created: boolean }
115
+ capabilities: Array<{ type: string, enabled: boolean, created: boolean }>
116
+ certificates: Array<{
117
+ type: MacDistributionCertificateType
118
+ id?: string
119
+ exists: boolean
120
+ created: boolean
121
+ expirationDate?: string
122
+ certificateContent?: string
123
+ }>
124
+ profile: {
125
+ id?: string
126
+ name: string
127
+ exists: boolean
128
+ created: boolean
129
+ expirationDate?: string
130
+ profileContent?: string
131
+ }
132
+ appRecord: { exists: boolean, id?: string, manualAction?: string }
133
+ actions: string[]
134
+ }
135
+ export type BundleIdPlatform = 'IOS' | 'MAC_OS' | 'UNIVERSAL';
136
+ export type AppStoreVersionPlatform = 'IOS' | 'MAC_OS';
137
+ export type MacDistributionCertificateType = 'MAC_APP_DISTRIBUTION' | 'MAC_INSTALLER_DISTRIBUTION';
138
+ export type AppStoreVersionStatus = 'ready' | 'deferred' | 'published';
139
+ export declare class AppStoreConnectClient {
140
+ constructor(options?: AppStoreConnectClientOptions);
141
+ request<T>(path: string, init?: RequestInit): Promise<T>;
142
+ upload(url: string, init: RequestInit): Promise<void>;
143
+ findBundleId(identifier: string): Promise<AppStoreConnectResource<BundleIdAttributes> | undefined>;
144
+ registerBundleId(identifier: string, name: string, platform?: BundleIdPlatform): Promise<AppStoreConnectResource<BundleIdAttributes>>;
145
+ ensureBundleId(identifier: string, name: string, options?: { checkOnly?: boolean, platform?: BundleIdPlatform }): Promise<{ bundleId?: AppStoreConnectResource<BundleIdAttributes>, created: boolean }>;
146
+ listBundleIdCapabilities(bundleIdId: string): Promise<Array<AppStoreConnectResource<BundleIdCapabilityAttributes>>>;
147
+ enableBundleIdCapability(bundleIdId: string, capabilityType: string, settings?: Array<Record<string, unknown>>): Promise<AppStoreConnectResource<BundleIdCapabilityAttributes>>;
148
+ listCertificates(certificateType: MacDistributionCertificateType): Promise<Array<AppStoreConnectResource<CertificateAttributes>>>;
149
+ createCertificate(certificateType: MacDistributionCertificateType, csrContent: string): Promise<AppStoreConnectResource<CertificateAttributes>>;
150
+ listProfiles(bundleIdId: string): Promise<Array<AppStoreConnectResource<ProfileAttributes>>>;
151
+ createMacAppStoreProfile(name: string, bundleIdId: string, certificateId: string): Promise<AppStoreConnectResource<ProfileAttributes>>;
152
+ findApp(bundleId: string): Promise<AppStoreConnectResource<AppAttributes> | undefined>;
153
+ listAppStoreVersions(appId: string): Promise<Array<AppStoreConnectResource<AppStoreVersionAttributes>>>;
154
+ createAppStoreVersion(appId: string, platform: AppStoreVersionPlatform, versionString: string): Promise<AppStoreConnectResource<AppStoreVersionAttributes>>;
155
+ updateAppStoreVersion(versionId: string, versionString: string): Promise<AppStoreConnectResource<AppStoreVersionAttributes>>;
156
+ listBuilds(appId: string, buildNumber: string): Promise<AppStoreBuildResult[]>;
157
+ attachBuild(versionId: string, buildId: string): Promise<void>;
158
+ }
@@ -0,0 +1,20 @@
1
+ /** Generate private keys and CSRs for the two Mac App Store certificate types. */
2
+ export declare function generateMacCertificateRequests(options: MacCertificateRequestOptions): MacCertificateRequest[];
3
+ /** Combine an Apple-issued certificate and its private key into a CI-ready P12. */
4
+ export declare function exportAppleCertificateP12(options: AppleCertificateP12Options): string;
5
+ export declare interface MacCertificateRequestOptions {
6
+ outputDirectory: string
7
+ commonName: string
8
+ }
9
+ export declare interface MacCertificateRequest {
10
+ type: 'MAC_APP_DISTRIBUTION' | 'MAC_INSTALLER_DISTRIBUTION'
11
+ keyPath: string
12
+ csrPath: string
13
+ }
14
+ export declare interface AppleCertificateP12Options {
15
+ certificatePath: string
16
+ privateKeyPath: string
17
+ outputPath: string
18
+ password: string
19
+ name: string
20
+ }