@stacksjs/ts-cloud 0.1.11 → 0.1.14

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 (77) hide show
  1. package/README.md +41 -379
  2. package/dist/bin/cli.js +1039 -416
  3. package/dist/index.d.ts +34 -1
  4. package/dist/index.js +76467 -7133
  5. package/package.json +6 -6
  6. package/dist/aws/acm.d.ts +0 -129
  7. package/dist/aws/application-autoscaling.d.ts +0 -282
  8. package/dist/aws/bedrock.d.ts +0 -2292
  9. package/dist/aws/client.d.ts +0 -79
  10. package/dist/aws/cloudformation.d.ts +0 -105
  11. package/dist/aws/cloudfront.d.ts +0 -265
  12. package/dist/aws/cloudwatch-logs.d.ts +0 -48
  13. package/dist/aws/comprehend.d.ts +0 -505
  14. package/dist/aws/connect.d.ts +0 -377
  15. package/dist/aws/deploy-imap.d.ts +0 -14
  16. package/dist/aws/dynamodb.d.ts +0 -176
  17. package/dist/aws/ec2.d.ts +0 -272
  18. package/dist/aws/ecr.d.ts +0 -149
  19. package/dist/aws/ecs.d.ts +0 -162
  20. package/dist/aws/elasticache.d.ts +0 -71
  21. package/dist/aws/elbv2.d.ts +0 -248
  22. package/dist/aws/email.d.ts +0 -175
  23. package/dist/aws/eventbridge.d.ts +0 -142
  24. package/dist/aws/iam.d.ts +0 -638
  25. package/dist/aws/imap-server.d.ts +0 -119
  26. package/dist/aws/index.d.ts +0 -192
  27. package/dist/aws/kendra.d.ts +0 -782
  28. package/dist/aws/lambda.d.ts +0 -232
  29. package/dist/aws/opensearch.d.ts +0 -87
  30. package/dist/aws/personalize.d.ts +0 -516
  31. package/dist/aws/polly.d.ts +0 -214
  32. package/dist/aws/rds.d.ts +0 -240
  33. package/dist/aws/rekognition.d.ts +0 -543
  34. package/dist/aws/route53-domains.d.ts +0 -113
  35. package/dist/aws/route53.d.ts +0 -215
  36. package/dist/aws/s3.d.ts +0 -212
  37. package/dist/aws/scheduler.d.ts +0 -140
  38. package/dist/aws/secrets-manager.d.ts +0 -170
  39. package/dist/aws/ses.d.ts +0 -288
  40. package/dist/aws/setup-phone.d.ts +0 -0
  41. package/dist/aws/setup-sms.d.ts +0 -116
  42. package/dist/aws/sms.d.ts +0 -304
  43. package/dist/aws/smtp-server.d.ts +0 -61
  44. package/dist/aws/sns.d.ts +0 -117
  45. package/dist/aws/sqs.d.ts +0 -65
  46. package/dist/aws/ssm.d.ts +0 -179
  47. package/dist/aws/sts.d.ts +0 -15
  48. package/dist/aws/support.d.ts +0 -104
  49. package/dist/aws/test-imap.d.ts +0 -0
  50. package/dist/aws/textract.d.ts +0 -403
  51. package/dist/aws/transcribe.d.ts +0 -60
  52. package/dist/aws/translate.d.ts +0 -358
  53. package/dist/aws/voice.d.ts +0 -219
  54. package/dist/config.d.ts +0 -7
  55. package/dist/deploy/index.d.ts +0 -2
  56. package/dist/deploy/static-site-external-dns.d.ts +0 -51
  57. package/dist/deploy/static-site.d.ts +0 -71
  58. package/dist/dns/cloudflare.d.ts +0 -52
  59. package/dist/dns/godaddy.d.ts +0 -38
  60. package/dist/dns/index.d.ts +0 -45
  61. package/dist/dns/porkbun.d.ts +0 -18
  62. package/dist/dns/route53-adapter.d.ts +0 -38
  63. package/dist/dns/types.d.ts +0 -77
  64. package/dist/dns/validator.d.ts +0 -78
  65. package/dist/generators/index.d.ts +0 -1
  66. package/dist/generators/infrastructure.d.ts +0 -30
  67. package/dist/push/apns.d.ts +0 -60
  68. package/dist/push/fcm.d.ts +0 -117
  69. package/dist/push/index.d.ts +0 -14
  70. package/dist/security/pre-deploy-scanner.d.ts +0 -69
  71. package/dist/ssl/acme-client.d.ts +0 -67
  72. package/dist/ssl/index.d.ts +0 -2
  73. package/dist/ssl/letsencrypt.d.ts +0 -48
  74. package/dist/types.d.ts +0 -1
  75. package/dist/utils/cli.d.ts +0 -123
  76. package/dist/validation/index.d.ts +0 -1
  77. package/dist/validation/template.d.ts +0 -23
@@ -1,71 +0,0 @@
1
- import type { DnsProviderConfig } from '../dns/types';
2
- /**
3
- * Generate CloudFormation template for static site infrastructure
4
- */
5
- export declare function generateStaticSiteTemplate(config: {
6
- bucketName: string
7
- domain?: string
8
- certificateArn?: string
9
- hostedZoneId?: string
10
- defaultRootObject?: string
11
- errorDocument?: string
12
- }): object;
13
- /**
14
- * Deploy a static site to AWS
15
- * Automatically routes to external DNS deployment when a non-Route53 dnsProvider is configured
16
- */
17
- export declare function deployStaticSite(config: StaticSiteConfig): Promise<DeployResult>;
18
- /**
19
- * Upload files to S3 bucket (only uploads changed files)
20
- */
21
- export declare function uploadStaticFiles(options: UploadOptions): Promise<{ uploaded: number; skipped: number; errors: string[] }>;
22
- /**
23
- * Invalidate CloudFront cache
24
- */
25
- export declare function invalidateCache(distributionId: string): Promise<{ invalidationId: string }>;
26
- /**
27
- * Delete static site infrastructure
28
- */
29
- export declare function deleteStaticSite(stackName: string, region?: string): Promise<{ success: boolean; message: string }>;
30
- /**
31
- * Full deployment: infrastructure + files + cache invalidation
32
- */
33
- export declare function deployStaticSiteFull(config: StaticSiteConfig & {
34
- sourceDir: string
35
- cleanBucket?: boolean
36
- onProgress?: (stage: string, detail?: string) => void
37
- }): Promise<DeployResult & { filesUploaded?: number; filesSkipped?: number }>;
38
- export declare interface StaticSiteConfig {
39
- siteName: string
40
- region?: string
41
- domain?: string
42
- subdomain?: string
43
- baseDomain?: string
44
- bucket?: string
45
- hostedZoneId?: string
46
- certificateArn?: string
47
- stackName?: string
48
- defaultRootObject?: string
49
- errorDocument?: string
50
- cacheControl?: string
51
- tags?: Record<string, string>
52
- dnsProvider?: DnsProviderConfig
53
- }
54
- export declare interface DeployResult {
55
- success: boolean
56
- stackId?: string
57
- stackName: string
58
- bucket: string
59
- distributionId?: string
60
- distributionDomain?: string
61
- domain?: string
62
- certificateArn?: string
63
- message: string
64
- }
65
- export declare interface UploadOptions {
66
- sourceDir: string
67
- bucket: string
68
- region: string
69
- cacheControl?: string
70
- onProgress?: (uploaded: number, total: number, file: string) => void
71
- }
@@ -1,52 +0,0 @@
1
- import type { CreateRecordResult, DeleteRecordResult, DnsProvider, DnsRecord, DnsRecordResult, DnsRecordType, ListRecordsResult, } from './types';
2
- declare interface CloudflareRecord {
3
- id: string
4
- zone_id: string
5
- zone_name: string
6
- name: string
7
- type: string
8
- content: string
9
- proxiable: boolean
10
- proxied: boolean
11
- ttl: number
12
- locked: boolean
13
- meta: Record<string, any>
14
- comment?: string
15
- tags?: string[]
16
- created_on: string
17
- modified_on: string
18
- priority?: number
19
- }
20
- export declare class CloudflareProvider implements DnsProvider {
21
- readonly name: any;
22
- private apiToken: string;
23
- private zoneCache: Map<string, string>;
24
- constructor(apiToken: string);
25
- private request<T>(method: string, endpoint: string, body?: any): Promise<CloudflareApiResponse<T>>;
26
- private getRootDomain(domain: string): string;
27
- private getZoneId(domain: string): Promise<string>;
28
- private getFullRecordName(name: string, domain: string): string;
29
- private toCloudflareRecord(record: DnsRecord, domain: string): Partial<CloudflareRecord>;
30
- private fromCloudflareRecord(record: CloudflareRecord): DnsRecordResult;
31
- createRecord(domain: string, record: DnsRecord): Promise<CreateRecordResult>;
32
- upsertRecord(domain: string, record: DnsRecord): Promise<CreateRecordResult>;
33
- deleteRecord(domain: string, record: DnsRecord): Promise<DeleteRecordResult>;
34
- listRecords(domain: string, type?: DnsRecordType): Promise<ListRecordsResult>;
35
- canManageDomain(domain: string): Promise<boolean>;
36
- listDomains(): Promise<string[]>;
37
- getZoneDetails(domain: string): Promise<{
38
- id: string
39
- name: string
40
- status: string
41
- nameServers: string[]
42
- paused: boolean
43
- } | null>;
44
- purgeCache(domain: string, options?: {
45
- purgeEverything?: boolean
46
- files?: string[]
47
- tags?: string[]
48
- hosts?: string[]
49
- }): Promise<boolean>;
50
- getRecordProxyStatus(domain: string, record: DnsRecord): Promise<boolean | null>;
51
- setRecordProxyStatus(domain: string, record: DnsRecord, proxied: boolean): Promise<boolean>;
52
- }
@@ -1,38 +0,0 @@
1
- import type { CreateRecordResult, DeleteRecordResult, DnsProvider, DnsRecord, DnsRecordResult, DnsRecordType, ListRecordsResult, } from './types';
2
- declare interface GoDaddyRecord {
3
- type: string
4
- name: string
5
- data: string
6
- ttl: number
7
- priority?: number
8
- }
9
- export declare class GoDaddyProvider implements DnsProvider {
10
- readonly name: any;
11
- private apiKey: string;
12
- private apiSecret: string;
13
- private baseUrl: string;
14
- constructor(apiKey: string, apiSecret: string, environment?: 'production' | 'ote');
15
- private request<T>(method: string, endpoint: string, body?: any): Promise<T>;
16
- private getSubdomain(recordName: string, domain: string): string;
17
- private getRootDomain(domain: string): string;
18
- private toGoDaddyRecord(record: DnsRecord, domain: string): GoDaddyRecord;
19
- private fromGoDaddyRecord(record: GoDaddyRecord, domain: string): DnsRecordResult;
20
- createRecord(domain: string, record: DnsRecord): Promise<CreateRecordResult>;
21
- upsertRecord(domain: string, record: DnsRecord): Promise<CreateRecordResult>;
22
- deleteRecord(domain: string, record: DnsRecord): Promise<DeleteRecordResult>;
23
- listRecords(domain: string, type?: DnsRecordType): Promise<ListRecordsResult>;
24
- canManageDomain(domain: string): Promise<boolean>;
25
- listDomains(): Promise<string[]>;
26
- getDomainDetails(domain: string): Promise<{
27
- domain: string
28
- status: string
29
- nameServers?: string[]
30
- expires?: string
31
- } | null>;
32
- updateNameServers(domain: string, nameservers: string[]): Promise<boolean>;
33
- checkDomainAvailability(domain: string): Promise<{
34
- available: boolean
35
- price?: number
36
- currency?: string
37
- }>;
38
- }
@@ -1,45 +0,0 @@
1
- import { CloudflareProvider } from './cloudflare';
2
- import { GoDaddyProvider } from './godaddy';
3
- import { PorkbunProvider } from './porkbun';
4
- import { Route53Provider } from './route53-adapter';
5
- import type { DnsProvider, DnsProviderConfig } from './types';
6
- /**
7
- * Create a DNS provider from configuration
8
- */
9
- export declare function createDnsProvider(config: DnsProviderConfig): DnsProvider;
10
- /**
11
- * Auto-detect DNS provider for a domain
12
- * Tries each provider to see which one can manage the domain
13
- */
14
- export declare function detectDnsProvider(domain: string, configs: DnsProviderConfig[]): Promise<DnsProvider | null>;
15
- /**
16
- * Default factory instance (can be configured globally)
17
- */
18
- export declare const dnsProviders: DnsProviderFactory;
19
- /**
20
- * DNS Provider factory with environment variable support
21
- */
22
- export declare class DnsProviderFactory {
23
- private providers: Map<string, DnsProvider>;
24
- private configs: DnsProviderConfig[];
25
- addConfig(config: DnsProviderConfig): this;
26
- addRoute53(region?: string, hostedZoneId?: string): this;
27
- addPorkbun(apiKey: string, secretKey: string): this;
28
- addGoDaddy(apiKey: string, apiSecret: string, environment?: 'production' | 'ote'): this;
29
- addCloudflare(apiToken: string): this;
30
- loadFromEnv(): this;
31
- getProvider(name: 'route53' | 'porkbun' | 'godaddy' | 'cloudflare'): DnsProvider | null;
32
- getProviderForDomain(domain: string): Promise<DnsProvider | null>;
33
- getAllProviders(): DnsProvider[];
34
- }
35
- export * from './types';
36
- export { PorkbunProvider } from './porkbun';
37
- export { GoDaddyProvider } from './godaddy';
38
- export { CloudflareProvider } from './cloudflare';
39
- export { Route53Provider } from './route53-adapter';
40
- export {
41
- UnifiedDnsValidator,
42
- createPorkbunValidator,
43
- createGoDaddyValidator,
44
- createRoute53Validator,
45
- } from './validator';
@@ -1,18 +0,0 @@
1
- import type { CreateRecordResult, DeleteRecordResult, DnsProvider, DnsRecord, DnsRecordType, ListRecordsResult, } from './types';
2
- export declare class PorkbunProvider implements DnsProvider {
3
- readonly name: any;
4
- private apiKey: string;
5
- private secretKey: string;
6
- constructor(apiKey: string, secretKey: string);
7
- private request<T extends PorkbunApiResponse>(endpoint: string, additionalBody?: Record<string, any>): Promise<T>;
8
- private getSubdomain(recordName: string, domain: string): string;
9
- private getRootDomain(domain: string): string;
10
- createRecord(domain: string, record: DnsRecord): Promise<CreateRecordResult>;
11
- upsertRecord(domain: string, record: DnsRecord): Promise<CreateRecordResult>;
12
- deleteRecord(domain: string, record: DnsRecord): Promise<DeleteRecordResult>;
13
- listRecords(domain: string, type?: DnsRecordType): Promise<ListRecordsResult>;
14
- canManageDomain(domain: string): Promise<boolean>;
15
- listDomains(): Promise<string[]>;
16
- getNameServers(domain: string): Promise<string[]>;
17
- updateNameServers(domain: string, nameservers: string[]): Promise<boolean>;
18
- }
@@ -1,38 +0,0 @@
1
- import { Route53Client } from '../aws/route53';
2
- import type { CreateRecordResult, DeleteRecordResult, DnsProvider, DnsRecord, DnsRecordType, ListRecordsResult, } from './types';
3
- export declare class Route53Provider implements DnsProvider {
4
- readonly name: any;
5
- private client: Route53Client;
6
- private hostedZoneCache: Map<string, string>;
7
- private providedHostedZoneId?: string;
8
- constructor(region?: string, hostedZoneId?: string);
9
- private getRootDomain(domain: string): string;
10
- private getHostedZoneId(domain: string): Promise<string | null>;
11
- private normalizeName(name: string): string;
12
- createRecord(domain: string, record: DnsRecord): Promise<CreateRecordResult>;
13
- upsertRecord(domain: string, record: DnsRecord): Promise<CreateRecordResult>;
14
- deleteRecord(domain: string, record: DnsRecord): Promise<DeleteRecordResult>;
15
- listRecords(domain: string, type?: DnsRecordType): Promise<ListRecordsResult>;
16
- canManageDomain(domain: string): Promise<boolean>;
17
- listDomains(): Promise<string[]>;
18
- getRoute53Client(): Route53Client;
19
- createAliasRecord(params: {
20
- domain: string
21
- name: string
22
- targetHostedZoneId: string
23
- targetDnsName: string
24
- evaluateTargetHealth?: boolean
25
- type?: 'A' | 'AAAA'
26
- }): Promise<CreateRecordResult>;
27
- createCloudFrontAlias(params: {
28
- domain: string
29
- name: string
30
- cloudFrontDomainName: string
31
- }): Promise<CreateRecordResult>;
32
- createAlbAlias(params: {
33
- domain: string
34
- name: string
35
- albDnsName: string
36
- region: string
37
- }): Promise<CreateRecordResult>;
38
- }
@@ -1,77 +0,0 @@
1
- export declare interface DnsRecord {
2
- name: string
3
- type: DnsRecordType
4
- content: string
5
- value?: string
6
- ttl?: number
7
- priority?: number
8
- weight?: number
9
- port?: number
10
- }
11
- export declare interface DnsRecordResult extends DnsRecord {
12
- id?: string
13
- }
14
- export declare interface CreateRecordResult {
15
- success: boolean
16
- id?: string
17
- message?: string
18
- }
19
- export declare interface DeleteRecordResult {
20
- success: boolean
21
- message?: string
22
- }
23
- export declare interface ListRecordsResult {
24
- success: boolean
25
- records: DnsRecordResult[]
26
- message?: string
27
- }
28
- /**
29
- * Common DNS Provider interface
30
- * All DNS providers (Route53, Porkbun, GoDaddy, etc.) implement this
31
- */
32
- export declare interface DnsProvider {
33
- name: string
34
- createRecord(domain: string, record: DnsRecord): Promise<CreateRecordResult>
35
- upsertRecord(domain: string, record: DnsRecord): Promise<CreateRecordResult>
36
- deleteRecord(domain: string, record: DnsRecord): Promise<DeleteRecordResult>
37
- listRecords(domain: string, type?: DnsRecordType): Promise<ListRecordsResult>
38
- canManageDomain(domain: string): Promise<boolean>
39
- listDomains(): Promise<string[]>
40
- }
41
- /**
42
- * DNS Provider configuration types
43
- */
44
- export declare interface Route53ProviderConfig {
45
- provider: 'route53'
46
- region?: string
47
- hostedZoneId?: string
48
- }
49
- export declare interface PorkbunProviderConfig {
50
- provider: 'porkbun'
51
- apiKey: string
52
- secretKey: string
53
- }
54
- export declare interface GoDaddyProviderConfig {
55
- provider: 'godaddy'
56
- apiKey: string
57
- apiSecret: string
58
- environment?: 'production' | 'ote'
59
- }
60
- export declare interface CloudflareProviderConfig {
61
- provider: 'cloudflare'
62
- apiToken: string
63
- }
64
- /**
65
- * Extended configuration for certificate validation
66
- */
67
- export declare interface CertificateValidationConfig {
68
- provider: DnsProviderConfig
69
- waitForValidation?: boolean
70
- maxWaitMinutes?: number
71
- }
72
- /**
73
- * DNS Provider Types
74
- * Common interfaces for DNS provider abstraction
75
- */
76
- export type DnsRecordType = 'A' | 'AAAA' | 'CNAME' | 'TXT' | 'MX' | 'NS' | 'SRV' | 'CAA'
77
- export type DnsProviderConfig = Route53ProviderConfig | PorkbunProviderConfig | GoDaddyProviderConfig | CloudflareProviderConfig
@@ -1,78 +0,0 @@
1
- import { ACMClient } from '../aws/acm';
2
- import type { DnsProvider, DnsProviderConfig } from './types';
3
- /**
4
- * Helper function to create a validator with Porkbun
5
- */
6
- export declare function createPorkbunValidator(apiKey: string, secretKey: string, acmRegion?: string): UnifiedDnsValidator;
7
- /**
8
- * Helper function to create a validator with GoDaddy
9
- */
10
- export declare function createGoDaddyValidator(apiKey: string, apiSecret: string, acmRegion?: string, environment?: 'production' | 'ote'): UnifiedDnsValidator;
11
- /**
12
- * Helper function to create a validator with Route53
13
- */
14
- export declare function createRoute53Validator(region?: string, hostedZoneId?: string, acmRegion?: string): UnifiedDnsValidator;
15
- export declare interface ValidationRecord {
16
- domainName: string
17
- recordName: string
18
- recordType: string
19
- recordValue: string
20
- }
21
- export declare interface CertificateValidationResult {
22
- certificateArn: string
23
- validationRecords: ValidationRecord[]
24
- isNew: boolean
25
- status: 'pending' | 'issued' | 'failed'
26
- }
27
- /**
28
- * Unified DNS Validator
29
- * Handles ACM certificate validation with any DNS provider
30
- */
31
- export declare class UnifiedDnsValidator {
32
- private acm: ACMClient;
33
- private dnsProvider: DnsProvider;
34
- constructor(dnsProvider: DnsProvider | DnsProviderConfig, acmRegion?: string);
35
- getProvider(): DnsProvider;
36
- requestAndValidate(params: {
37
- domainName: string
38
- subjectAlternativeNames?: string[]
39
- waitForValidation?: boolean
40
- maxWaitMinutes?: number
41
- }): Promise<CertificateValidationResult>;
42
- createValidationRecords(params: {
43
- certificateArn: string
44
- domain: string
45
- }): Promise<{
46
- success: boolean
47
- records: ValidationRecord[]
48
- errors: string[]
49
- }>;
50
- deleteValidationRecords(params: {
51
- certificateArn: string
52
- domain: string
53
- }): Promise<{
54
- success: boolean
55
- errors: string[]
56
- }>;
57
- findOrCreateCertificate(params: {
58
- domainName: string
59
- subjectAlternativeNames?: string[]
60
- waitForValidation?: boolean
61
- maxWaitMinutes?: number
62
- }): Promise<CertificateValidationResult>;
63
- requestCertificateWithCommonSans(params: {
64
- domainName: string
65
- includeWww?: boolean
66
- includeWildcard?: boolean
67
- additionalSans?: string[]
68
- waitForValidation?: boolean
69
- }): Promise<CertificateValidationResult>;
70
- private waitForValidationOptions(certificateArn: string, maxAttempts?: any): Promise<void>;
71
- getCertificateStatus(certificateArn: string): Promise<{
72
- status: string
73
- domainValidations: Array<{
74
- domain: string
75
- status: string
76
- }>
77
- }>;
78
- }
@@ -1 +0,0 @@
1
- export * from './infrastructure';
@@ -1,30 +0,0 @@
1
- import { TemplateBuilder, } from 'ts-cloud-core';
2
- import type { CloudConfig } from 'ts-cloud-types';
3
- export declare interface GenerationOptions {
4
- config: CloudConfig
5
- environment: 'production' | 'staging' | 'development'
6
- modules?: string[]
7
- }
8
- export declare class InfrastructureGenerator {
9
- private builder: TemplateBuilder;
10
- private config: CloudConfig;
11
- private environment: 'production' | 'staging' | 'development';
12
- private mergedConfig: CloudConfig;
13
- constructor(options: GenerationOptions);
14
- private mergeEnvironmentConfig(): CloudConfig;
15
- private shouldDeploy(resource: any): boolean;
16
- generate(): this;
17
- private applyGlobalTags(tags: Record<string, string>): void;
18
- private generateServerless(slug: string, env: typeof this.environment): void;
19
- private generateServer(slug: string, env: typeof this.environment): void;
20
- private generateSharedInfrastructure(slug: string, env: typeof this.environment): void;
21
- private generateRealtimeResources(slug: string, env: typeof this.environment): void;
22
- private generateConnectHandlerCode(): string;
23
- private generateDisconnectHandlerCode(): string;
24
- private generateMessageHandlerCode(): string;
25
- private generateRealtimeServerResources(slug: string, env: typeof this.environment): void;
26
- generateBroadcastConfig(): string;
27
- toYAML(): string;
28
- toJSON(): string;
29
- getBuilder(): TemplateBuilder;
30
- }
@@ -1,60 +0,0 @@
1
- export declare interface APNsConfig {
2
- keyId: string
3
- teamId: string
4
- privateKey: string
5
- bundleId: string
6
- production?: boolean
7
- }
8
- export declare interface APNsNotification {
9
- deviceToken: string
10
- title?: string
11
- subtitle?: string
12
- body?: string
13
- badge?: number
14
- sound?: string | { name: string; critical?: number; volume?: number }
15
- category?: string
16
- threadId?: string
17
- data?: Record<string, any>
18
- contentAvailable?: boolean
19
- mutableContent?: boolean
20
- pushType?: 'alert' | 'background' | 'voip' | 'complication' | 'fileprovider' | 'mdm' | 'liveactivity'
21
- priority?: 5 | 10
22
- expiration?: number
23
- collapseId?: string
24
- targetContentId?: string
25
- }
26
- export declare interface APNsSendResult {
27
- success: boolean
28
- deviceToken: string
29
- apnsId?: string
30
- statusCode?: number
31
- error?: string
32
- reason?: string
33
- timestamp?: number
34
- }
35
- export declare interface APNsBatchResult {
36
- sent: number
37
- failed: number
38
- results: APNsSendResult[]
39
- }
40
- /**
41
- * Apple Push Notification Service client
42
- */
43
- export declare class APNsClient {
44
- private config: APNsConfig;
45
- private token: string | null;
46
- private tokenGeneratedAt: number;
47
- private client: http2.ClientHttp2Session | null;
48
- private host: string;
49
- constructor(config: APNsConfig);
50
- private generateToken(): string;
51
- private derToRaw(derSignature: Buffer): Buffer;
52
- private getClient(): Promise<http2.ClientHttp2Session>;
53
- private buildPayload(notification: APNsNotification): object;
54
- send(notification: APNsNotification): Promise<APNsSendResult>;
55
- sendBatch(notifications: APNsNotification[], options?: { concurrency?: number }): Promise<APNsBatchResult>;
56
- sendSimple(deviceToken: string, title: string, body: string, data?: Record<string, any>): Promise<APNsSendResult>;
57
- sendSilent(deviceToken: string, data?: Record<string, any>): Promise<APNsSendResult>;
58
- close(): void;
59
- }
60
- export default APNsClient;
@@ -1,117 +0,0 @@
1
- export declare interface FCMConfig {
2
- projectId: string
3
- clientEmail: string
4
- privateKey: string
5
- }
6
- export declare interface FCMNotification {
7
- token?: string
8
- topic?: string
9
- condition?: string
10
- title?: string
11
- body?: string
12
- imageUrl?: string
13
- data?: Record<string, string>
14
- android?: {
15
- /** Channel ID for Android O+ */
16
- channelId?: string
17
- /** Notification priority */
18
- priority?: 'normal' | 'high'
19
- /** Time to live in seconds */
20
- ttl?: number
21
- /** Collapse key for message deduplication */
22
- collapseKey?: string
23
- /** Notification icon */
24
- icon?: string
25
- /** Notification icon color (hex) */
26
- color?: string
27
- /** Sound to play */
28
- sound?: string
29
- /** Click action */
30
- clickAction?: string
31
- /** Tag for notification replacement */
32
- tag?: string
33
- /** Direct boot aware */
34
- directBootOk?: boolean
35
- /** Visibility: private, public, secret */
36
- visibility?: 'private' | 'public' | 'secret'
37
- /** Notification count */
38
- notificationCount?: number
39
- }
40
- webpush?: {
41
- /** Web notification options */
42
- notification?: {
43
- title?: string
44
- body?: string
45
- icon?: string
46
- badge?: string
47
- image?: string
48
- requireInteraction?: boolean
49
- silent?: boolean
50
- tag?: string
51
- actions?: Array<{ action: string; title: string; icon?: string }>
52
- }
53
- /** FCM options for web */
54
- fcmOptions?: {
55
- link?: string
56
- analyticsLabel?: string
57
- }
58
- /** Custom headers */
59
- headers?: Record<string, string>
60
- /** Custom data */
61
- data?: Record<string, string>
62
- }
63
- apns?: {
64
- /** APNs headers */
65
- headers?: Record<string, string>
66
- /** APNs payload */
67
- payload?: {
68
- aps?: Record<string, any>
69
- [key: string]: any
70
- }
71
- /** FCM options */
72
- fcmOptions?: {
73
- analyticsLabel?: string
74
- image?: string
75
- }
76
- }
77
- fcmOptions?: {
78
- analyticsLabel?: string
79
- }
80
- }
81
- export declare interface FCMSendResult {
82
- success: boolean
83
- messageId?: string
84
- error?: string
85
- errorCode?: string
86
- }
87
- export declare interface FCMBatchResult {
88
- sent: number
89
- failed: number
90
- results: Array<FCMSendResult & { token?: string }>
91
- }
92
- /**
93
- * Firebase Cloud Messaging client
94
- */
95
- export declare class FCMClient {
96
- private config: FCMConfig;
97
- private accessToken: string | null;
98
- private tokenExpiresAt: number;
99
- constructor(config: FCMConfig);
100
- static fromServiceAccount(serviceAccount: {
101
- project_id: string
102
- client_email: string
103
- private_key: string
104
- }): FCMClient;
105
- private generateJWT(): string;
106
- private getAccessToken(): Promise<string>;
107
- private buildMessage(notification: FCMNotification): object;
108
- send(notification: FCMNotification): Promise<FCMSendResult>;
109
- sendBatch(tokens: string[], notification: Omit<FCMNotification, 'token' | 'topic' | 'condition'>, options?: { concurrency?: number }): Promise<FCMBatchResult>;
110
- sendToTopic(topic: string, notification: Omit<FCMNotification, 'token' | 'topic' | 'condition'>): Promise<FCMSendResult>;
111
- sendToCondition(condition: string, notification: Omit<FCMNotification, 'token' | 'topic' | 'condition'>): Promise<FCMSendResult>;
112
- sendSimple(token: string, title: string, body: string, data?: Record<string, string>): Promise<FCMSendResult>;
113
- sendSilent(token: string, data: Record<string, string>): Promise<FCMSendResult>;
114
- subscribeToTopic(tokens: string[], topic: string): Promise<{ success: boolean; error?: string }>;
115
- unsubscribeFromTopic(tokens: string[], topic: string): Promise<{ success: boolean; error?: string }>;
116
- }
117
- export default FCMClient;
@@ -1,14 +0,0 @@
1
- export type {
2
- APNsConfig,
3
- APNsNotification,
4
- APNsSendResult,
5
- APNsBatchResult,
6
- } from './apns';
7
- export type {
8
- FCMConfig,
9
- FCMNotification,
10
- FCMSendResult,
11
- FCMBatchResult,
12
- } from './fcm';
13
- export * from './apns';
14
- export * from './fcm';