@stackshift-cloud/sdk 1.1.0 → 1.2.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.
- package/README.md +58 -1
- package/dist/assets-dam-types.d.ts +225 -0
- package/dist/assets-dam-types.js +1 -0
- package/dist/assets-dam.d.ts +96 -0
- package/dist/assets-dam.js +47 -0
- package/dist/assets-video-types.d.ts +116 -0
- package/dist/assets-video-types.js +1 -0
- package/dist/assets-video.d.ts +25 -0
- package/dist/assets-video.js +19 -0
- package/dist/assets.d.ts +5 -1
- package/dist/assets.js +11 -2
- package/dist/client.d.ts +4 -0
- package/dist/client.js +11 -0
- package/dist/generated/assets-contract.d.ts +246 -1
- package/dist/generated/assets-contract.js +49 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +8 -0
- package/dist/mail-advanced-types.d.ts +9 -0
- package/dist/mail-billing.d.ts +34 -0
- package/dist/mail-billing.js +7 -0
- package/dist/mail-brands.d.ts +35 -0
- package/dist/mail-brands.js +17 -0
- package/dist/mail-campaigns.d.ts +72 -10
- package/dist/mail-campaigns.js +25 -2
- package/dist/mail-marketing.d.ts +84 -0
- package/dist/mail-marketing.js +24 -0
- package/dist/mail-migration.d.ts +16 -0
- package/dist/mail-migration.js +10 -0
- package/dist/mail-otp-types.d.ts +4 -0
- package/dist/mail-simulation.d.ts +4 -0
- package/dist/mail-simulation.js +1 -0
- package/dist/mail-subscribers.d.ts +39 -0
- package/dist/mail-subscribers.js +1 -0
- package/dist/mail-template-types.d.ts +8 -0
- package/dist/mail-tracking.d.ts +59 -0
- package/dist/mail-tracking.js +14 -0
- package/dist/mail-webhook-types.d.ts +4 -1
- package/dist/mail.d.ts +12 -0
- package/dist/mail.js +19 -0
- package/dist/types.d.ts +13 -0
- package/dist/workload-security.d.ts +172 -0
- package/dist/workload-security.js +50 -0
- package/package.json +2 -2
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.
|
|
3
|
+
"version": "1.2.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"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"typescript": "^5.4.0"
|