@stackshift-cloud/sdk 1.1.0 → 1.3.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 (45) hide show
  1. package/README.md +79 -1
  2. package/dist/ai-credits.d.ts +78 -0
  3. package/dist/ai-credits.js +15 -0
  4. package/dist/assets-dam-types.d.ts +259 -0
  5. package/dist/assets-dam-types.js +1 -0
  6. package/dist/assets-dam.d.ts +106 -0
  7. package/dist/assets-dam.js +52 -0
  8. package/dist/assets-video-types.d.ts +116 -0
  9. package/dist/assets-video-types.js +1 -0
  10. package/dist/assets-video.d.ts +25 -0
  11. package/dist/assets-video.js +19 -0
  12. package/dist/assets.d.ts +5 -1
  13. package/dist/assets.js +11 -2
  14. package/dist/client.d.ts +6 -0
  15. package/dist/client.js +14 -0
  16. package/dist/generated/assets-contract.d.ts +531 -1
  17. package/dist/generated/assets-contract.js +106 -0
  18. package/dist/index.d.ts +16 -0
  19. package/dist/index.js +9 -0
  20. package/dist/mail-advanced-types.d.ts +9 -0
  21. package/dist/mail-billing.d.ts +34 -0
  22. package/dist/mail-billing.js +7 -0
  23. package/dist/mail-brands.d.ts +35 -0
  24. package/dist/mail-brands.js +17 -0
  25. package/dist/mail-campaigns.d.ts +72 -10
  26. package/dist/mail-campaigns.js +25 -2
  27. package/dist/mail-marketing.d.ts +84 -0
  28. package/dist/mail-marketing.js +24 -0
  29. package/dist/mail-migration.d.ts +16 -0
  30. package/dist/mail-migration.js +10 -0
  31. package/dist/mail-otp-types.d.ts +4 -0
  32. package/dist/mail-simulation.d.ts +4 -0
  33. package/dist/mail-simulation.js +1 -0
  34. package/dist/mail-subscribers.d.ts +39 -0
  35. package/dist/mail-subscribers.js +1 -0
  36. package/dist/mail-template-types.d.ts +8 -0
  37. package/dist/mail-tracking.d.ts +59 -0
  38. package/dist/mail-tracking.js +14 -0
  39. package/dist/mail-webhook-types.d.ts +4 -1
  40. package/dist/mail.d.ts +12 -0
  41. package/dist/mail.js +19 -0
  42. package/dist/types.d.ts +13 -0
  43. package/dist/workload-security.d.ts +172 -0
  44. package/dist/workload-security.js +50 -0
  45. package/package.json +2 -2
@@ -1,6 +1,8 @@
1
+ import type { MailMode, MailSimulationOptions } from './mail-simulation.js';
1
2
  import type { JsonValue } from './types.js';
2
3
  export type MailOtpStatus = 'pending' | 'verified' | 'expired' | 'failed' | 'canceled';
3
4
  export interface MailOtpSendInput {
5
+ simulation?: MailSimulationOptions;
4
6
  to: string;
5
7
  purpose: string;
6
8
  from?: string;
@@ -25,6 +27,7 @@ export interface MailOtpChallengeListOptions {
25
27
  cursor?: string;
26
28
  }
27
29
  export interface MailOtpChallenge {
30
+ mode?: MailMode;
28
31
  id: string;
29
32
  to: string;
30
33
  purpose: string;
@@ -46,6 +49,7 @@ export interface MailOtpChallengeListResult {
46
49
  nextCursor?: string | null;
47
50
  }
48
51
  export interface MailOtpSendResponse {
52
+ mode?: MailMode;
49
53
  id: string;
50
54
  to: string;
51
55
  purpose: string;
@@ -0,0 +1,4 @@
1
+ export type MailMode = 'live' | 'test';
2
+ export interface MailSimulationOptions {
3
+ scenario: 'delivered' | 'bounced' | 'complained' | 'delayed';
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,39 @@
1
+ export type MailImportMode = 'recorded_consent' | 'confirmation';
2
+ export interface MailImportRow {
3
+ row: number;
4
+ email: string;
5
+ outcome: 'imported' | 'updated' | 'invalid' | 'skipped';
6
+ code: string;
7
+ reason: string;
8
+ status?: string;
9
+ }
10
+ export interface MailImportResult {
11
+ imported: number;
12
+ skipped: number;
13
+ summary: {
14
+ imported: number;
15
+ updated: number;
16
+ invalid: number;
17
+ skipped: number;
18
+ pending: number;
19
+ };
20
+ rows: MailImportRow[];
21
+ preview: boolean;
22
+ }
23
+ export interface MailSendingDomainHealth {
24
+ state: 'healthy' | 'suspect' | 'degraded';
25
+ lastResult: 'verified' | 'failed' | 'indeterminate' | 'unknown';
26
+ lastCheckedAt: string | null;
27
+ lastSuccessAt: string | null;
28
+ nextCheckAt: string;
29
+ degradedAt: string | null;
30
+ issues: {
31
+ type?: string;
32
+ record: string;
33
+ name: string;
34
+ expected: string;
35
+ observed: string[];
36
+ status: string;
37
+ scope: 'customer' | 'platform';
38
+ }[];
39
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,5 @@
1
+ import type { MailMode, MailSimulationOptions } from './mail-simulation.js';
2
+ import type { MailTrackingOptions } from './mail-tracking.js';
1
3
  import type { JsonValue, MailAddressInput, MailIdempotencyStatus, MailStatus } from './types.js';
2
4
  export type MailTemplateStatus = 'active' | 'archived' | 'deleted';
3
5
  export interface MailTemplateCreateInput {
@@ -22,6 +24,7 @@ export interface MailTemplateListOptions {
22
24
  search?: string;
23
25
  }
24
26
  export interface MailTemplate {
27
+ mode?: MailMode;
25
28
  id: string;
26
29
  name: string;
27
30
  slug: string;
@@ -61,16 +64,20 @@ export interface MailTemplatePreviewInput {
61
64
  versionId?: string;
62
65
  }
63
66
  export interface MailTemplateTestSendInput {
67
+ simulation?: MailSimulationOptions;
64
68
  to: MailAddressInput;
65
69
  from?: MailAddressInput;
66
70
  data: Record<string, JsonValue>;
67
71
  versionId?: string;
68
72
  }
69
73
  export interface MailTemplateTestSendResponse {
74
+ mode?: MailMode;
70
75
  messageId: string;
71
76
  status: MailStatus;
72
77
  }
73
78
  export interface MailSendTemplateInput {
79
+ simulation?: MailSimulationOptions;
80
+ tracking?: MailTrackingOptions;
74
81
  template: string;
75
82
  versionId?: string;
76
83
  to: MailAddressInput;
@@ -88,6 +95,7 @@ export interface MailSendTemplateInput {
88
95
  }>;
89
96
  }
90
97
  export interface MailSendTemplateResponse {
98
+ mode?: MailMode;
91
99
  id: string;
92
100
  status: MailStatus;
93
101
  templateId: string;
@@ -0,0 +1,59 @@
1
+ import type { StackShift } from './client.js';
2
+ export interface MailTrackingOptions {
3
+ opens?: boolean;
4
+ clicks?: boolean;
5
+ }
6
+ export interface MailTrackingSettings {
7
+ opens: boolean;
8
+ clicks: boolean;
9
+ }
10
+ export interface MailEngagementCount {
11
+ kind: 'open' | 'click';
12
+ variant: string;
13
+ link?: string;
14
+ total: number;
15
+ unique: number;
16
+ suspectedAutomated: number;
17
+ firstAt?: string;
18
+ lastAt?: string;
19
+ }
20
+ export interface MailEngagementReport {
21
+ counts: MailEngagementCount[];
22
+ openEligible: number;
23
+ clickEligible: number;
24
+ openEngagedDelivered: number;
25
+ clickEngagedDelivered: number;
26
+ openDelivered: number;
27
+ clickDelivered: number;
28
+ scope: 'message' | 'recipient';
29
+ retentionDays: number;
30
+ }
31
+ export interface MailTrackingDomain {
32
+ id: string;
33
+ domainId: string;
34
+ hostname: string;
35
+ ownershipToken: string;
36
+ enabled: boolean;
37
+ status: 'pending' | 'provisioning' | 'active' | 'degraded' | 'revoked';
38
+ checkedAt?: string;
39
+ dnsValidUntil?: string;
40
+ }
41
+ export declare class MailTrackingClient {
42
+ private readonly client;
43
+ constructor(client: StackShift);
44
+ settings(): Promise<{
45
+ settings: MailTrackingSettings;
46
+ available: boolean;
47
+ }>;
48
+ updateSettings(input: MailTrackingSettings): Promise<MailTrackingSettings>;
49
+ message(id: string): Promise<MailEngagementReport>;
50
+ campaign(id: string): Promise<MailEngagementReport>;
51
+ domains(): Promise<{
52
+ data: MailTrackingDomain[];
53
+ target: string;
54
+ available: boolean;
55
+ }>;
56
+ createDomain(domainId: string, hostname: string): Promise<MailTrackingDomain>;
57
+ verifyDomain(id: string): Promise<MailTrackingDomain>;
58
+ updateDomain(id: string, enabled: boolean, revoke?: boolean): Promise<void>;
59
+ }
@@ -0,0 +1,14 @@
1
+ export class MailTrackingClient {
2
+ client;
3
+ constructor(client) {
4
+ this.client = client;
5
+ }
6
+ settings() { return this.client.mailRequest('/mail/tracking/settings'); }
7
+ updateSettings(input) { return this.client.mailRequest('/mail/tracking/settings', { method: 'PUT', body: input }); }
8
+ message(id) { return this.client.mailRequest(`/mail/messages/${encodeURIComponent(id)}/engagement`); }
9
+ campaign(id) { return this.client.mailRequest(`/mail/campaigns/${encodeURIComponent(id)}/engagement`); }
10
+ domains() { return this.client.mailRequest('/mail/tracking/domains'); }
11
+ createDomain(domainId, hostname) { return this.client.mailRequest('/mail/tracking/domains', { method: 'POST', body: { domainId, hostname } }); }
12
+ verifyDomain(id) { return this.client.mailRequest(`/mail/tracking/domains/${encodeURIComponent(id)}/verify`, { method: 'POST' }); }
13
+ updateDomain(id, enabled, revoke = false) { return this.client.mailRequest(`/mail/tracking/domains/${encodeURIComponent(id)}`, { method: 'PUT', body: { enabled, revoke } }); }
14
+ }
@@ -1,6 +1,8 @@
1
+ import type { MailMode } from './mail-simulation.js';
1
2
  import type { JsonValue } from './types.js';
2
- export type MailEventType = 'mail.message.accepted' | 'mail.message.queued' | 'mail.message.sending' | 'mail.message.mta_accepted' | 'mail.delivery.delayed' | 'mail.delivery.delivered' | 'mail.message.failed' | 'mail.message.bounced' | 'mail.message.suppressed' | 'mail.message.complained' | 'mail.suppression.created' | 'mail.suppression.deleted' | 'mail.otp.created' | 'mail.otp.sent' | 'mail.otp.verified' | 'mail.otp.failed_attempt' | 'mail.otp.failed' | 'mail.otp.expired' | 'mail.otp.canceled' | 'mail.template.created' | 'mail.template.updated' | 'mail.template.deleted' | 'mail.template.version.created' | 'mail.template.test_queued' | 'mail.domain.created' | 'mail.domain.verified' | 'mail.domain.failed' | 'mail.domain.deleted' | 'mail.webhook.created' | 'mail.webhook.updated' | 'mail.webhook.disabled' | 'mail.webhook.delivery.succeeded' | 'mail.webhook.delivery.failed' | 'mail.audience.created' | 'mail.audience.members.imported' | 'mail.campaign.created' | 'mail.campaign.queued';
3
+ export type MailEventType = 'mail.message.opened' | 'mail.message.clicked' | 'mail.message.accepted' | 'mail.message.queued' | 'mail.message.sending' | 'mail.message.mta_accepted' | 'mail.delivery.delayed' | 'mail.delivery.delivered' | 'mail.message.failed' | 'mail.message.bounced' | 'mail.message.suppressed' | 'mail.message.complained' | 'mail.suppression.created' | 'mail.suppression.deleted' | 'mail.otp.created' | 'mail.otp.sent' | 'mail.otp.verified' | 'mail.otp.failed_attempt' | 'mail.otp.failed' | 'mail.otp.expired' | 'mail.otp.canceled' | 'mail.template.created' | 'mail.template.updated' | 'mail.template.deleted' | 'mail.template.version.created' | 'mail.template.test_queued' | 'mail.domain.created' | 'mail.domain.verified' | 'mail.domain.failed' | 'mail.domain.deleted' | 'mail.webhook.created' | 'mail.webhook.updated' | 'mail.webhook.disabled' | 'mail.webhook.delivery.succeeded' | 'mail.webhook.delivery.failed' | 'mail.audience.created' | 'mail.audience.members.imported' | 'mail.campaign.created' | 'mail.campaign.queued';
3
4
  export interface MailEvent {
5
+ mode?: MailMode;
4
6
  id: string;
5
7
  type: MailEventType | string;
6
8
  resourceType?: string | null;
@@ -64,6 +66,7 @@ export interface MailWebhookListResult {
64
66
  nextCursor?: string | null;
65
67
  }
66
68
  export interface MailWebhookDelivery {
69
+ mode?: MailMode;
67
70
  id: string;
68
71
  endpointId: string;
69
72
  eventId: string;
package/dist/mail.d.ts CHANGED
@@ -1,3 +1,8 @@
1
+ import { MailAutomationsClient, MailFormsClient, MailSegmentsClient } from './mail-marketing.js';
2
+ import { MailBillingClient } from './mail-billing.js';
3
+ import { MailMigrationClient } from './mail-migration.js';
4
+ import { MailBrandsClient } from './mail-brands.js';
5
+ import { MailTrackingClient } from './mail-tracking.js';
1
6
  import type { StackShift } from './client.js';
2
7
  import type { MailLog, MailDomain, MailDomainListResult, MailMessage, MailMessageListOptions, MailMessageListResult, MailSendAttempt, MailSendInput, MailSendResponse } from './types.js';
3
8
  import type { MailBounce, MailBounceListOptions, MailBounceListResult, MailSuppression, MailSuppressionCreateInput, MailSuppressionListOptions, MailSuppressionListResult } from './mail-delivery-types.js';
@@ -17,6 +22,10 @@ export { MailExportsClient } from './mail-exports.js';
17
22
  import type { MailTemplateDiagnosticInput, MailTemplateDiagnosticResult } from './mail-diagnostics.js';
18
23
  export declare class MailClient {
19
24
  private readonly client;
25
+ readonly automations: MailAutomationsClient;
26
+ readonly forms: MailFormsClient;
27
+ readonly segments: MailSegmentsClient;
28
+ readonly tracking: MailTrackingClient;
20
29
  readonly domains: MailDomainsClient;
21
30
  readonly messages: MailMessagesClient;
22
31
  readonly suppressions: MailSuppressionsClient;
@@ -26,6 +35,9 @@ export declare class MailClient {
26
35
  readonly events: MailEventsClient;
27
36
  readonly webhooks: MailWebhooksClient;
28
37
  readonly streams: MailStreamsClient;
38
+ readonly billing: MailBillingClient;
39
+ readonly migration: MailMigrationClient;
40
+ readonly brands: MailBrandsClient;
29
41
  readonly audiences: MailAudiencesClient;
30
42
  readonly campaigns: MailCampaignsClient;
31
43
  readonly exports: MailExportsClient;
package/dist/mail.js CHANGED
@@ -1,3 +1,8 @@
1
+ import { MailAutomationsClient, MailFormsClient, MailSegmentsClient } from './mail-marketing.js';
2
+ import { MailBillingClient } from './mail-billing.js';
3
+ import { MailMigrationClient } from './mail-migration.js';
4
+ import { MailBrandsClient } from './mail-brands.js';
5
+ import { MailTrackingClient } from './mail-tracking.js';
1
6
  import { MailAnalyticsClient, MailBatchClient, MailInboundClient, MailScheduledClient } from './mail-advanced.js';
2
7
  export { MailAnalyticsClient, MailBatchClient, MailInboundClient, MailScheduledClient } from './mail-advanced.js';
3
8
  export { MailEventsClient, MailWebhooksClient, verifyWebhookSignature } from './mail-events-webhooks.js';
@@ -10,6 +15,10 @@ import { MailExportsClient } from './mail-exports.js';
10
15
  export { MailExportsClient } from './mail-exports.js';
11
16
  export class MailClient {
12
17
  client;
18
+ automations;
19
+ forms;
20
+ segments;
21
+ tracking;
13
22
  domains;
14
23
  messages;
15
24
  suppressions;
@@ -19,6 +28,9 @@ export class MailClient {
19
28
  events;
20
29
  webhooks;
21
30
  streams;
31
+ billing;
32
+ migration;
33
+ brands;
22
34
  audiences;
23
35
  campaigns;
24
36
  exports;
@@ -30,6 +42,7 @@ export class MailClient {
30
42
  analytics;
31
43
  constructor(client) {
32
44
  this.client = client;
45
+ this.tracking = new MailTrackingClient(client);
33
46
  this.domains = new MailDomainsClient(client);
34
47
  this.messages = new MailMessagesClient(client);
35
48
  this.suppressions = new MailSuppressionsClient(client);
@@ -39,6 +52,12 @@ export class MailClient {
39
52
  this.events = new MailEventsClient(client);
40
53
  this.webhooks = new MailWebhooksClient(client);
41
54
  this.streams = new MailStreamsClient(client);
55
+ this.billing = new MailBillingClient(client);
56
+ this.automations = new MailAutomationsClient(client);
57
+ this.forms = new MailFormsClient(client);
58
+ this.segments = new MailSegmentsClient(client);
59
+ this.migration = new MailMigrationClient(client);
60
+ this.brands = new MailBrandsClient(client);
42
61
  this.audiences = new MailAudiencesClient(client);
43
62
  this.campaigns = new MailCampaignsClient(client);
44
63
  this.exports = new MailExportsClient(client);
package/dist/types.d.ts CHANGED
@@ -1,8 +1,11 @@
1
+ import type { MailMode, MailSimulationOptions } from './mail-simulation.js';
2
+ import type { MailTrackingOptions } from './mail-tracking.js';
1
3
  export type JsonValue = string | number | boolean | null | JsonValue[] | {
2
4
  [key: string]: JsonValue;
3
5
  };
4
6
  export type AssetVisibility = 'public' | 'private';
5
7
  export interface StackShiftOptions {
8
+ assetSpaceId?: string;
6
9
  apiKey?: string;
7
10
  baseUrl?: string;
8
11
  mailBaseUrl?: string;
@@ -23,6 +26,7 @@ export interface MailDnsRecord {
23
26
  explanation?: string;
24
27
  }
25
28
  export interface MailDomain {
29
+ health?: import('./mail-subscribers.js').MailSendingDomainHealth;
26
30
  id: string;
27
31
  domain: string;
28
32
  status: MailDomainStatus;
@@ -45,6 +49,8 @@ export interface MailAddress {
45
49
  }
46
50
  export type MailAddressInput = string | MailAddress | Array<string | MailAddress>;
47
51
  export interface MailSendInput {
52
+ simulation?: MailSimulationOptions;
53
+ tracking?: MailTrackingOptions;
48
54
  from: string | MailAddress;
49
55
  to: MailAddressInput;
50
56
  cc?: MailAddressInput;
@@ -67,11 +73,13 @@ export interface MailSendInput {
67
73
  stream?: string;
68
74
  }
69
75
  export interface MailSendResponse {
76
+ mode?: MailMode;
70
77
  id: string;
71
78
  status: MailStatus;
72
79
  idempotencyStatus: MailIdempotencyStatus;
73
80
  }
74
81
  export interface MailMessage {
82
+ mode?: MailMode;
75
83
  id: string;
76
84
  from: MailAddress;
77
85
  to: string[];
@@ -138,6 +146,7 @@ export interface MailRecipientSummary {
138
146
  complained: number;
139
147
  }
140
148
  export interface MailMessageSummary {
149
+ mode?: MailMode;
141
150
  id: string;
142
151
  from: string;
143
152
  to: string[];
@@ -269,6 +278,7 @@ export interface AssetVersion {
269
278
  created_at: string;
270
279
  }
271
280
  export interface AssetCollection {
281
+ revision: number;
272
282
  id: string;
273
283
  name: string;
274
284
  description?: string;
@@ -298,6 +308,9 @@ export interface AssetUploadOptions {
298
308
  metadata?: Record<string, JsonValue>;
299
309
  }
300
310
  export interface AssetListOptions {
311
+ collectionId?: string;
312
+ duplicates?: boolean;
313
+ security?: 'all' | 'clean' | 'pending' | 'failed';
301
314
  bucket?: string;
302
315
  prefix?: string;
303
316
  visibility?: AssetVisibility;
@@ -0,0 +1,172 @@
1
+ import type { StackShift } from './client.js';
2
+ export type AdmissionDecision = 'allow' | 'review' | 'block';
3
+ export type SecurityResourceStatus = 'pending' | 'approved' | 'rejected' | 'revoked' | 'expired';
4
+ export type SecurityIncidentStatus = 'open' | 'reviewing' | 'quarantined' | 'released' | 'dismissed';
5
+ export interface WorkloadAdmission {
6
+ id: string;
7
+ project_id?: string;
8
+ deployment_id?: string;
9
+ environment: string;
10
+ execution_kind: string;
11
+ image_reference: string;
12
+ image_digest: string;
13
+ policy_version: string;
14
+ decision: AdmissionDecision;
15
+ sanitized_evidence: unknown;
16
+ receipt_digest: string;
17
+ issued_at: string;
18
+ expires_at: string;
19
+ revoked_at?: string;
20
+ }
21
+ export interface ExternalDependency {
22
+ id: string;
23
+ project_id: string;
24
+ environment: string;
25
+ hostname: string;
26
+ port: number;
27
+ protocol: string;
28
+ purpose: string;
29
+ tls_required: boolean;
30
+ private_route_required: boolean;
31
+ detected: boolean;
32
+ status: string;
33
+ created_at: string;
34
+ updated_at: string;
35
+ }
36
+ export interface EgressGrant {
37
+ id: string;
38
+ project_id: string;
39
+ dependency_id?: string;
40
+ environment: string;
41
+ protocol: string;
42
+ hostname?: string;
43
+ cidr?: string;
44
+ port_start: number;
45
+ port_end: number;
46
+ purpose: string;
47
+ status: SecurityResourceStatus;
48
+ broad_public_egress: boolean;
49
+ expires_at: string;
50
+ resolved_cidrs?: string[];
51
+ created_at: string;
52
+ updated_at: string;
53
+ }
54
+ export interface PrivateRoute {
55
+ id: string;
56
+ project_id: string;
57
+ node_id: string;
58
+ environment: string;
59
+ route_kind: string;
60
+ cidr: string;
61
+ hostname?: string;
62
+ purpose: string;
63
+ status: SecurityResourceStatus;
64
+ expires_at: string;
65
+ created_at: string;
66
+ updated_at: string;
67
+ }
68
+ export interface NetworkDestination {
69
+ protocol: string;
70
+ hostname?: string;
71
+ cidrs?: string[];
72
+ port_start: number;
73
+ port_end: number;
74
+ purpose: string;
75
+ grant_id?: string;
76
+ expires_at?: string;
77
+ }
78
+ export interface NetworkPolicy {
79
+ version: string;
80
+ mode: 'restricted' | 'quarantined';
81
+ allow_stackshift_dns: boolean;
82
+ allow_public_web: boolean;
83
+ destinations: NetworkDestination[];
84
+ block_private_ranges: boolean;
85
+ block_metadata: boolean;
86
+ block_alternate_dns: boolean;
87
+ block_unexpected_udp: boolean;
88
+ }
89
+ export interface PolicyInspection {
90
+ effective: boolean;
91
+ policy?: NetworkPolicy;
92
+ pending_dependencies?: ExternalDependency[];
93
+ }
94
+ export interface SecurityIncident {
95
+ id: string;
96
+ project_id: string;
97
+ deployment_id?: string;
98
+ environment: string;
99
+ category: string;
100
+ confidence: 'low' | 'medium' | 'high';
101
+ status: SecurityIncidentStatus;
102
+ sanitized_summary: string;
103
+ sanitized_evidence: unknown;
104
+ quarantined_at?: string;
105
+ enforcement_status: string;
106
+ released_at?: string;
107
+ resolution_note?: string;
108
+ created_at: string;
109
+ updated_at: string;
110
+ }
111
+ export interface DeclareDependencyInput {
112
+ environment: string;
113
+ hostname: string;
114
+ port: number;
115
+ protocol: string;
116
+ purpose: string;
117
+ tls_required?: boolean;
118
+ }
119
+ export interface RequestGrantInput {
120
+ dependency_id?: string;
121
+ environment: string;
122
+ protocol: string;
123
+ hostname?: string;
124
+ cidr?: string;
125
+ port_start: number;
126
+ port_end: number;
127
+ purpose: string;
128
+ broad_public_egress?: boolean;
129
+ expires_at: string;
130
+ }
131
+ export interface RequestPrivateRouteInput {
132
+ node_id: string;
133
+ environment: string;
134
+ route_kind: string;
135
+ cidr: string;
136
+ hostname?: string;
137
+ purpose: string;
138
+ expires_at: string;
139
+ }
140
+ export declare class WorkloadSecurityClient {
141
+ private readonly client;
142
+ constructor(client: StackShift);
143
+ private root;
144
+ admissions(projectId: string, limit?: number): Promise<{
145
+ admissions: WorkloadAdmission[];
146
+ }>;
147
+ policy(projectId: string, environment?: string): Promise<PolicyInspection>;
148
+ dependencies(projectId: string, environment?: string): Promise<{
149
+ dependencies: ExternalDependency[];
150
+ }>;
151
+ declareDependency(projectId: string, input: DeclareDependencyInput): Promise<{
152
+ dependencies: ExternalDependency[];
153
+ }>;
154
+ refreshDependencies(projectId: string, environment: string): Promise<{
155
+ dependencies: ExternalDependency[];
156
+ }>;
157
+ grants(projectId: string, environment?: string): Promise<{
158
+ grants: EgressGrant[];
159
+ }>;
160
+ requestGrant(projectId: string, input: RequestGrantInput): Promise<EgressGrant>;
161
+ privateRoutes(projectId: string, environment?: string): Promise<{
162
+ private_routes: PrivateRoute[];
163
+ }>;
164
+ requestPrivateRoute(projectId: string, input: RequestPrivateRouteInput): Promise<PrivateRoute>;
165
+ incidents(projectId: string, status?: SecurityIncidentStatus, limit?: number): Promise<{
166
+ incidents: SecurityIncident[];
167
+ }>;
168
+ incident(projectId: string, incidentId: string): Promise<{
169
+ incident: SecurityIncident;
170
+ notifications: unknown[];
171
+ }>;
172
+ }
@@ -0,0 +1,50 @@
1
+ export class WorkloadSecurityClient {
2
+ client;
3
+ constructor(client) {
4
+ this.client = client;
5
+ }
6
+ root(projectId) {
7
+ return `/projects/${encodeURIComponent(projectId)}/security`;
8
+ }
9
+ admissions(projectId, limit) {
10
+ return this.client.request(withQuery(`${this.root(projectId)}/admissions`, { limit }));
11
+ }
12
+ policy(projectId, environment) {
13
+ return this.client.request(withQuery(`${this.root(projectId)}/policy`, { environment }));
14
+ }
15
+ dependencies(projectId, environment) {
16
+ return this.client.request(withQuery(`${this.root(projectId)}/dependencies`, { environment }));
17
+ }
18
+ declareDependency(projectId, input) {
19
+ return this.client.request(`${this.root(projectId)}/dependencies`, { method: 'POST', body: input });
20
+ }
21
+ refreshDependencies(projectId, environment) {
22
+ return this.client.request(`${this.root(projectId)}/dependencies/refresh`, { method: 'POST', body: { environment } });
23
+ }
24
+ grants(projectId, environment) {
25
+ return this.client.request(withQuery(`${this.root(projectId)}/grants`, { environment }));
26
+ }
27
+ requestGrant(projectId, input) {
28
+ return this.client.request(`${this.root(projectId)}/grants`, { method: 'POST', body: input });
29
+ }
30
+ privateRoutes(projectId, environment) {
31
+ return this.client.request(withQuery(`${this.root(projectId)}/private-routes`, { environment }));
32
+ }
33
+ requestPrivateRoute(projectId, input) {
34
+ return this.client.request(`${this.root(projectId)}/private-routes`, { method: 'POST', body: input });
35
+ }
36
+ incidents(projectId, status, limit) {
37
+ return this.client.request(withQuery(`${this.root(projectId)}/incidents`, { status, limit }));
38
+ }
39
+ incident(projectId, incidentId) {
40
+ return this.client.request(`${this.root(projectId)}/incidents/${encodeURIComponent(incidentId)}`);
41
+ }
42
+ }
43
+ function withQuery(path, values) {
44
+ const query = new URLSearchParams();
45
+ for (const [key, value] of Object.entries(values)) {
46
+ if (value !== undefined && value !== '')
47
+ query.set(key, String(value));
48
+ }
49
+ return query.size ? `${path}?${query}` : path;
50
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackshift-cloud/sdk",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "Official JavaScript and TypeScript SDK for StackShift.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -17,7 +17,7 @@
17
17
  ],
18
18
  "scripts": {
19
19
  "build": "tsc -p tsconfig.json",
20
- "test": "npm run build && node test/mail.test.mjs && node test/mail-webhooks.test.mjs && node test/mail-advanced.test.mjs && node test/mail-exports.test.mjs && node test/mail-diagnostics.test.mjs && node test/assets.test.mjs && node test/assets-platform.test.mjs"
20
+ "test": "npm run build && node test/mail.test.mjs && node test/mail-simulation.test.mjs && node test/mail-platform.test.mjs && node test/mail-webhooks.test.mjs && node test/mail-advanced.test.mjs && node test/mail-tracking.test.mjs && node test/mail-subscribers.test.mjs && node test/mail-exports.test.mjs && node test/mail-diagnostics.test.mjs && node test/assets.test.mjs && node test/assets-platform.test.mjs && node test/assets-video.test.mjs && node test/assets-dam.test.mjs && node test/ai-credits.test.mjs"
21
21
  },
22
22
  "devDependencies": {
23
23
  "typescript": "^5.4.0"