@pantechdynamic/sdk 0.4.0 → 0.5.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/CHANGELOG.md +17 -0
- package/README.md +78 -6
- package/dist/index.cjs +232 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12882 -9564
- package/dist/index.d.ts +12882 -9564
- package/dist/index.js +232 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,23 @@ A new version heading here (`## X.Y.Z (YYYY-MM-DD)`) pushed to main is
|
|
|
4
4
|
tagged `vX.Y.Z` and published to npm. Add changes under `## Unreleased`
|
|
5
5
|
until then.
|
|
6
6
|
|
|
7
|
+
## Unreleased
|
|
8
|
+
|
|
9
|
+
## 0.5.0 (2026-11-24)
|
|
10
|
+
|
|
11
|
+
- Dynamic IP for instances: `instances.dynamicIp` (`get`, `set`, `disable`, and non-retrying
|
|
12
|
+
`rotate`), optional `address_rotation` on `instances.create`, and `DynamicIp`, `DynamicIpEvent`,
|
|
13
|
+
and `PutDynamicIpRequest` type aliases.
|
|
14
|
+
- S3-compatible Object Storage: `client.objectStorage` (`getStatus`, `getUsage`, and
|
|
15
|
+
`objectStorage.keys.{list, create, revoke}` with non-enumerable `secret_access_key`) and
|
|
16
|
+
`client.buckets` (`list`, `create`, `get`, `update`, `delete`, `stats`, `empty`, CORS, lifecycle,
|
|
17
|
+
tags, object lock, `buckets.objects.*` with binary upload/download and per-object visibility, and
|
|
18
|
+
`buckets.multipart.*`).
|
|
19
|
+
- Raw binary request body support (`BinaryBody`: `Uint8Array | ArrayBuffer | Blob | string`,
|
|
20
|
+
defaulting to `Content-Type: application/octet-stream` unless overridden) and `Accept:
|
|
21
|
+
application/octet-stream` for `arrayBuffer` binary downloads across Node.js, Bun, Deno, and edge
|
|
22
|
+
runtimes.
|
|
23
|
+
|
|
7
24
|
## 0.4.0 (2026-11-10)
|
|
8
25
|
|
|
9
26
|
- `client.dns`, Pantech DNS on Pantech's own name servers (two per zone): `dns.zones` (`list`, `listAll`,
|
package/README.md
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
[](LICENSE)
|
|
6
6
|
|
|
7
7
|
The official client for the [Pantech Dynamics public API](https://docs.pantechdynamics.com/api):
|
|
8
|
-
instances, VPC networks, firewalls, public IPs, load balancers, volumes, snapshots,
|
|
9
|
-
databases, managed Kubernetes, SSH keys, webhooks, billing, usage, and moving from another
|
|
8
|
+
instances, VPC networks, firewalls, public IPs, load balancers, volumes, snapshots, object storage,
|
|
9
|
+
managed databases, managed Kubernetes, SSH keys, webhooks, billing, usage, and moving from another
|
|
10
|
+
cloud.
|
|
10
11
|
|
|
11
12
|
- Zero runtime dependencies. Uses the global `fetch` and Web Crypto, so it runs on Node.js 18+,
|
|
12
13
|
Bun, Deno and edge runtimes.
|
|
@@ -65,13 +66,14 @@ Every method takes per-call options last: `{ signal, timeout, maxRetries, idempo
|
|
|
65
66
|
|---|---|
|
|
66
67
|
| Account | `me.get()`, `me.revoke()` |
|
|
67
68
|
| Catalogue | `regions.list()`, `plans.list({ placement })`, `images.list()`, `diskOfferings.quote(slug, { size_gb })`, `databaseEngines.list()`, `kubernetesVersions.list()`, `pricing.estimate({...})` |
|
|
68
|
-
| Instances | `instances.list/listAll/create/get/delete/start/stop/reboot/rebuild/rename/resize/restore/…`, `instances.snapshots.*`, `instances.sshAccess.*`, `instanceOrders.wait(order)` |
|
|
69
|
+
| Instances | `instances.list/listAll/create/get/delete/start/stop/reboot/rebuild/rename/resize/restore/…`, `instances.snapshots.*`, `instances.sshAccess.*`, `instances.dynamicIp.*`, `instanceOrders.wait(order)` |
|
|
69
70
|
| Networks | `networks.*`, `networks.subnets.list(networkId)`, `networks.firewallRules.create(subnetId, {...})` |
|
|
70
71
|
| Public IPs | `publicIps.*`, `publicIps.portForwardingRules.*` |
|
|
71
72
|
| Load balancers | `loadBalancers.*` |
|
|
72
73
|
| Kubernetes | `kubernetes.*`, `kubernetes.nodePools.*`, `kubernetes.addons.toggle(...)` |
|
|
73
74
|
| Security groups | `securityGroups.*`, `securityGroups.replaceRules(id, {...})` |
|
|
74
75
|
| Volumes and snapshots | `volumes.*`, `volumes.snapshots.*`, `snapshots.*` |
|
|
76
|
+
| Object storage | `objectStorage.getStatus/getUsage`, `objectStorage.keys.*`, `buckets.*`, `buckets.objects.*`, `buckets.multipart.*` |
|
|
75
77
|
| Databases | `databases.*`, `databases.snapshots.*`, `databaseOrders.wait(order)` |
|
|
76
78
|
| SSH keys, webhooks | `sshKeys.*`, `webhooks.*`, `webhooks.deliveries.*` |
|
|
77
79
|
| Billing and usage | `billing.credit.get()`, `billing.credit.purchases.create(...)`, `billing.receipts.getPdf(id)`, `usage.get()` |
|
|
@@ -112,6 +114,72 @@ failed or unpaid order with `OrderFailedError`, a failed cloud connection or sca
|
|
|
112
114
|
`CloudFailedError`, a failed DNS zone or record change with `DNSFailedError`, a certificate that
|
|
113
115
|
cannot be issued with `CertificateFailedError`, and a wait that runs out with `WaitTimeoutError`.
|
|
114
116
|
|
|
117
|
+
## Dynamic IP
|
|
118
|
+
|
|
119
|
+
`client.instances.dynamicIp` manages a rotating public outbound address on a standard instance:
|
|
120
|
+
outbound traffic leaves from a dynamic IP that changes on your schedule (`every_12_hours`, `daily`,
|
|
121
|
+
`weekly`, or `monthly`), while inbound traffic continues to reach the instance's static address.
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
// Enable Dynamic IP at creation time:
|
|
125
|
+
const order = await client.instances.create({
|
|
126
|
+
name: "worker-1",
|
|
127
|
+
plan_slug: "starter",
|
|
128
|
+
image_slug: "ubuntu-24-04",
|
|
129
|
+
ssh_key_id: "sshk_…",
|
|
130
|
+
security_group_id: "sg_…",
|
|
131
|
+
address_rotation: { schedule: "weekly", connections: "keep" },
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
// Or manage Dynamic IP on an existing instance:
|
|
135
|
+
await client.instances.dynamicIp.set("vm_…", { schedule: "daily", connections: "move", on_demand: true });
|
|
136
|
+
const ip = await client.instances.dynamicIp.get("vm_…");
|
|
137
|
+
console.log(ip.state, ip.current_address, ip.next_rotation_at);
|
|
138
|
+
|
|
139
|
+
// Rotate immediately (requires on_demand: true; sent once and never retried after an error):
|
|
140
|
+
await client.instances.dynamicIp.rotate("vm_…");
|
|
141
|
+
|
|
142
|
+
// Turn off Dynamic IP and end its surcharge:
|
|
143
|
+
await client.instances.dynamicIp.disable("vm_…");
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Object storage
|
|
147
|
+
|
|
148
|
+
`client.objectStorage` and `client.buckets` manage S3-compatible buckets, access keys, binary
|
|
149
|
+
uploads and downloads, per-object visibility, multipart uploads, and bucket rules (CORS, lifecycle,
|
|
150
|
+
tags, and object lock).
|
|
151
|
+
|
|
152
|
+
```ts
|
|
153
|
+
const status = await client.objectStorage.getStatus();
|
|
154
|
+
const key = await client.objectStorage.keys.create({ name: "app", region: "af-abj" });
|
|
155
|
+
// key.secret_access_key is shown once and is non-enumerable (console.log / JSON.stringify omit it).
|
|
156
|
+
|
|
157
|
+
const bucket = await client.buckets.create({ name: "media-assets", region: "af-abj" });
|
|
158
|
+
|
|
159
|
+
// Upload raw bytes (Uint8Array, ArrayBuffer, Blob, or string) and download as ArrayBuffer:
|
|
160
|
+
await client.buckets.objects.upload(bucket.id, { key: "images/hero.png" }, pngBytes, {
|
|
161
|
+
headers: { "Content-Type": "image/png" },
|
|
162
|
+
});
|
|
163
|
+
const data = await client.buckets.objects.download(bucket.id, { key: "images/hero.png" });
|
|
164
|
+
|
|
165
|
+
// Publish one object and read its public URL:
|
|
166
|
+
const vis = await client.buckets.objects.setVisibility(bucket.id, { key: "images/hero.png", public: true });
|
|
167
|
+
console.log(vis.public_url);
|
|
168
|
+
|
|
169
|
+
// Multipart upload for large objects:
|
|
170
|
+
const session = await client.buckets.multipart.start(bucket.id, { key: "backups/db.tar.gz" });
|
|
171
|
+
const part1 = await client.buckets.multipart.uploadPart(
|
|
172
|
+
bucket.id,
|
|
173
|
+
{ key: "backups/db.tar.gz", upload_id: session.upload_id, part_number: 1 },
|
|
174
|
+
chunk1,
|
|
175
|
+
);
|
|
176
|
+
await client.buckets.multipart.complete(bucket.id, {
|
|
177
|
+
key: "backups/db.tar.gz",
|
|
178
|
+
upload_id: session.upload_id,
|
|
179
|
+
parts: [{ part_number: 1, etag: part1.etag }],
|
|
180
|
+
});
|
|
181
|
+
```
|
|
182
|
+
|
|
115
183
|
## Move from another cloud
|
|
116
184
|
|
|
117
185
|
`client.migrate` connects an AWS account through a read-only role that only Pantech can assume (no
|
|
@@ -259,7 +327,9 @@ try {
|
|
|
259
327
|
Prices are before VAT. A TLD whose offer has `privacy_always_on: true` (the `.ng` family) has
|
|
260
328
|
privacy protection that cannot be turned off: asking for `privacy: false` is a `422` naming field
|
|
261
329
|
`privacy` with code `PRIVACY_ALWAYS_ON`. `.ng` contacts need `state` and `postal_code`, and
|
|
262
|
-
`name.ng` registrants must be people (`type: "person"`).
|
|
330
|
+
`name.ng` registrants must be people (`type: "person"`). Send `accept_terms: true` only once the
|
|
331
|
+
registrant has read and accepted the
|
|
332
|
+
[Domain Registration Agreement](https://pantechdynamics.com/legal/domain-registration).
|
|
263
333
|
|
|
264
334
|
`domains` also has `listTlds`, `checkTransfer`, `update` (auto-renew, transfer lock, privacy),
|
|
265
335
|
`setNameServers`, `getContact`/`updateContact`, `requestAuthCode`/`getAuthCode`,
|
|
@@ -304,8 +374,10 @@ to `maxRetries` times with jittered backoff.
|
|
|
304
374
|
|
|
305
375
|
The API does not replay some writes by key, so the SDK sends them once (except after a `429`,
|
|
306
376
|
which is refused before anything runs): creating and deleting SSH keys, opening an instance
|
|
307
|
-
console, issuing a volume key credential,
|
|
308
|
-
|
|
377
|
+
console, issuing a volume key credential, rotating an instance's dynamic IP now
|
|
378
|
+
(`instances.dynamicIp.rotate`), creating object storage access keys, emptying a bucket, starting
|
|
379
|
+
and completing multipart uploads, testing, deleting, rotating the secret of and redelivering
|
|
380
|
+
webhooks, and `DELETE /me`.
|
|
309
381
|
|
|
310
382
|
## Webhooks
|
|
311
383
|
|
package/dist/index.cjs
CHANGED
|
@@ -327,7 +327,7 @@ async function* paginate(fetchPage, startCursor) {
|
|
|
327
327
|
}
|
|
328
328
|
|
|
329
329
|
// src/resource.ts
|
|
330
|
-
var SECRET_FIELDS = ["secret", "private_key_pem"];
|
|
330
|
+
var SECRET_FIELDS = ["secret", "private_key_pem", "secret_access_key"];
|
|
331
331
|
function hideSecrets(value) {
|
|
332
332
|
if (value && typeof value === "object") {
|
|
333
333
|
for (const field of SECRET_FIELDS) {
|
|
@@ -903,13 +903,18 @@ var Domains = class extends APIResource {
|
|
|
903
903
|
}
|
|
904
904
|
/**
|
|
905
905
|
* Buys the domain for `years` (1 to 10), paid from your credit first; a
|
|
906
|
-
* failed order is refunded. `accept_terms` must be true
|
|
907
|
-
*
|
|
906
|
+
* failed order is refunded. `accept_terms` must be true: the registrant has
|
|
907
|
+
* accepted the Domain Registration Agreement
|
|
908
|
+
* (https://pantechdynamics.com/legal/domain-registration). Follow the order with
|
|
909
|
+
* `orders.wait(result)`.
|
|
908
910
|
*/
|
|
909
911
|
register(body, options) {
|
|
910
912
|
return this._post("/domains", body, options);
|
|
911
913
|
}
|
|
912
|
-
/**
|
|
914
|
+
/**
|
|
915
|
+
* Moves a domain to Pantech with its auth code, adding `years` to its term.
|
|
916
|
+
* `accept_terms` must be true, as for `register`. Follow it with `orders.wait`.
|
|
917
|
+
*/
|
|
913
918
|
transfer(body, options) {
|
|
914
919
|
return this._post("/domains/transfers", body, options);
|
|
915
920
|
}
|
|
@@ -1144,6 +1149,8 @@ var Instances = class extends APIResource {
|
|
|
1144
1149
|
snapshots = new InstanceSnapshots(this._client);
|
|
1145
1150
|
/** Short-lived SSH access grants through the browser terminal relay. */
|
|
1146
1151
|
sshAccess = new InstanceSshAccess(this._client);
|
|
1152
|
+
/** Dynamic IP: a public outbound address that rotates on a schedule or on demand. */
|
|
1153
|
+
dynamicIp = new InstanceDynamicIp(this._client);
|
|
1147
1154
|
/** One page of your instances. */
|
|
1148
1155
|
list(params = {}, options) {
|
|
1149
1156
|
return this._get("/instances", params, options);
|
|
@@ -1251,6 +1258,24 @@ var InstanceSshAccess = class extends APIResource {
|
|
|
1251
1258
|
return this._delete(path`/instances/${instanceId}/ssh-access/${grantId}`, options);
|
|
1252
1259
|
}
|
|
1253
1260
|
};
|
|
1261
|
+
var InstanceDynamicIp = class extends APIResource {
|
|
1262
|
+
/** Whether the instance has a dynamic IP, its schedule, current address and recent changes. */
|
|
1263
|
+
get(instanceId, options) {
|
|
1264
|
+
return this._get(path`/instances/${instanceId}/address-rotation`, void 0, options);
|
|
1265
|
+
}
|
|
1266
|
+
/** Turns on or changes dynamic IP settings for the instance. */
|
|
1267
|
+
set(instanceId, body, options) {
|
|
1268
|
+
return this._put(path`/instances/${instanceId}/address-rotation`, body, options);
|
|
1269
|
+
}
|
|
1270
|
+
/** Turns off dynamic IP for the instance and stops its surcharge. */
|
|
1271
|
+
disable(instanceId, options) {
|
|
1272
|
+
return this._delete(path`/instances/${instanceId}/address-rotation`, options);
|
|
1273
|
+
}
|
|
1274
|
+
/** Gives the instance a new dynamic IP now, outside its schedule. Sent once: the API does not replay it. */
|
|
1275
|
+
rotate(instanceId, options) {
|
|
1276
|
+
return this._post(path`/instances/${instanceId}/address-rotation/rotate`, void 0, options, { noRetry: true });
|
|
1277
|
+
}
|
|
1278
|
+
};
|
|
1254
1279
|
var InstanceOrders = class extends APIResource {
|
|
1255
1280
|
list(params = {}, options) {
|
|
1256
1281
|
return this._get("/instance-orders", params, options);
|
|
@@ -1604,6 +1629,192 @@ var FirewallRules = class extends APIResource {
|
|
|
1604
1629
|
}
|
|
1605
1630
|
};
|
|
1606
1631
|
|
|
1632
|
+
// src/resources/object-storage.ts
|
|
1633
|
+
var ObjectStorage = class extends APIResource {
|
|
1634
|
+
/** S3 access keys for your organization. */
|
|
1635
|
+
keys = new ObjectStorageKeys(this._client);
|
|
1636
|
+
/** Whether object storage is available, with endpoints and regional pricing. */
|
|
1637
|
+
getStatus(options) {
|
|
1638
|
+
return this._get("/object-storage", void 0, options);
|
|
1639
|
+
}
|
|
1640
|
+
/** Hourly object storage traffic and operations for your organization. */
|
|
1641
|
+
getUsage(params = {}, options) {
|
|
1642
|
+
return this._get("/object-storage/usage", params, options);
|
|
1643
|
+
}
|
|
1644
|
+
};
|
|
1645
|
+
var ObjectStorageKeys = class extends APIResource {
|
|
1646
|
+
/** Lists your S3 access keys without their secrets. */
|
|
1647
|
+
list(params = {}, options) {
|
|
1648
|
+
return this._get("/object-storage/keys", params, options);
|
|
1649
|
+
}
|
|
1650
|
+
/**
|
|
1651
|
+
* Creates an S3 access key. Its `secret_access_key` is returned once and
|
|
1652
|
+
* never replayed; it is non-enumerable so `console.log` and `JSON.stringify`
|
|
1653
|
+
* leave it out while `key.secret_access_key` reads it.
|
|
1654
|
+
*/
|
|
1655
|
+
async create(body, options) {
|
|
1656
|
+
return hideSecrets(
|
|
1657
|
+
await this._post("/object-storage/keys", body, options, { noRetry: true })
|
|
1658
|
+
);
|
|
1659
|
+
}
|
|
1660
|
+
/** Revokes an S3 access key at once. */
|
|
1661
|
+
revoke(storageKeyId, options) {
|
|
1662
|
+
return this._delete(path`/object-storage/keys/${storageKeyId}`, options);
|
|
1663
|
+
}
|
|
1664
|
+
};
|
|
1665
|
+
var Buckets = class extends APIResource {
|
|
1666
|
+
/** Objects and folders inside a bucket. */
|
|
1667
|
+
objects = new BucketObjects(this._client);
|
|
1668
|
+
/** Multipart uploads for large objects. */
|
|
1669
|
+
multipart = new BucketMultipart(this._client);
|
|
1670
|
+
/** Lists every bucket in your organization. */
|
|
1671
|
+
list(options) {
|
|
1672
|
+
return this._get("/buckets", void 0, options);
|
|
1673
|
+
}
|
|
1674
|
+
/** Creates a new bucket. */
|
|
1675
|
+
create(body, options) {
|
|
1676
|
+
return this._post("/buckets", body, options);
|
|
1677
|
+
}
|
|
1678
|
+
/** Gets one bucket's settings and endpoints. */
|
|
1679
|
+
get(bucketId, options) {
|
|
1680
|
+
return this._get(path`/buckets/${bucketId}`, void 0, options);
|
|
1681
|
+
}
|
|
1682
|
+
/** Updates a bucket's versioning, access policy, or public prefixes. */
|
|
1683
|
+
update(bucketId, body, options) {
|
|
1684
|
+
return this._patch(path`/buckets/${bucketId}`, body, options);
|
|
1685
|
+
}
|
|
1686
|
+
/** Deletes a bucket. Pass `{ force: true }` to empty it before removal. */
|
|
1687
|
+
delete(bucketId, params = {}, options) {
|
|
1688
|
+
return this._request("DELETE", path`/buckets/${bucketId}`, { query: params }, options);
|
|
1689
|
+
}
|
|
1690
|
+
/** Live total size and object count of a bucket. */
|
|
1691
|
+
stats(bucketId, options) {
|
|
1692
|
+
return this._get(path`/buckets/${bucketId}/stats`, void 0, options);
|
|
1693
|
+
}
|
|
1694
|
+
/** Deletes all objects, versions, and active multipart uploads in a bucket. Sent once: not retried on error. */
|
|
1695
|
+
empty(bucketId, options) {
|
|
1696
|
+
return this._post(path`/buckets/${bucketId}/empty`, void 0, options, { noRetry: true });
|
|
1697
|
+
}
|
|
1698
|
+
/** Reads the bucket's CORS rules. */
|
|
1699
|
+
getCors(bucketId, options) {
|
|
1700
|
+
return this._get(path`/buckets/${bucketId}/cors`, void 0, options);
|
|
1701
|
+
}
|
|
1702
|
+
/** Replaces the bucket's CORS rules (an empty list clears them). */
|
|
1703
|
+
setCors(bucketId, body, options) {
|
|
1704
|
+
return this._put(path`/buckets/${bucketId}/cors`, body, options);
|
|
1705
|
+
}
|
|
1706
|
+
/** Reads the bucket's lifecycle rules. */
|
|
1707
|
+
getLifecycle(bucketId, options) {
|
|
1708
|
+
return this._get(path`/buckets/${bucketId}/lifecycle`, void 0, options);
|
|
1709
|
+
}
|
|
1710
|
+
/** Replaces the bucket's lifecycle rules (an empty list clears them). */
|
|
1711
|
+
setLifecycle(bucketId, body, options) {
|
|
1712
|
+
return this._put(path`/buckets/${bucketId}/lifecycle`, body, options);
|
|
1713
|
+
}
|
|
1714
|
+
/** Reads the bucket's tags. */
|
|
1715
|
+
getTags(bucketId, options) {
|
|
1716
|
+
return this._get(path`/buckets/${bucketId}/tags`, void 0, options);
|
|
1717
|
+
}
|
|
1718
|
+
/** Replaces the bucket's tags (an empty list clears them). */
|
|
1719
|
+
setTags(bucketId, body, options) {
|
|
1720
|
+
return this._put(path`/buckets/${bucketId}/tags`, body, options);
|
|
1721
|
+
}
|
|
1722
|
+
/** Reads the bucket's default object lock configuration. */
|
|
1723
|
+
getObjectLock(bucketId, options) {
|
|
1724
|
+
return this._get(path`/buckets/${bucketId}/object-lock`, void 0, options);
|
|
1725
|
+
}
|
|
1726
|
+
/** Updates the bucket's default object lock configuration. */
|
|
1727
|
+
setObjectLock(bucketId, body, options) {
|
|
1728
|
+
return this._put(path`/buckets/${bucketId}/object-lock`, body, options);
|
|
1729
|
+
}
|
|
1730
|
+
};
|
|
1731
|
+
var BucketObjects = class extends APIResource {
|
|
1732
|
+
/** Lists folders and objects under a prefix, searches across the bucket, or lists object versions. */
|
|
1733
|
+
list(bucketId, params = {}, options) {
|
|
1734
|
+
return this._get(path`/buckets/${bucketId}/objects`, params, options);
|
|
1735
|
+
}
|
|
1736
|
+
/** Reads metadata, headers, tags, lock status, and public visibility of one object. */
|
|
1737
|
+
getMeta(bucketId, params, options) {
|
|
1738
|
+
return this._get(path`/buckets/${bucketId}/objects/meta`, params, options);
|
|
1739
|
+
}
|
|
1740
|
+
/** Downloads an object's raw bytes as an `ArrayBuffer`. */
|
|
1741
|
+
download(bucketId, params, options) {
|
|
1742
|
+
return this._request(
|
|
1743
|
+
"GET",
|
|
1744
|
+
path`/buckets/${bucketId}/objects/download`,
|
|
1745
|
+
{ query: params, responseType: "arrayBuffer" },
|
|
1746
|
+
options
|
|
1747
|
+
);
|
|
1748
|
+
}
|
|
1749
|
+
/** Mints a short-lived signed download URL when direct transfers are enabled. */
|
|
1750
|
+
presignDownload(bucketId, body, options) {
|
|
1751
|
+
return this._post(path`/buckets/${bucketId}/objects/download-url`, body, options);
|
|
1752
|
+
}
|
|
1753
|
+
/**
|
|
1754
|
+
* Streams an object upload into the bucket as raw bytes. Sets
|
|
1755
|
+
* `Content-Type: application/octet-stream` unless `options.headers` sets a
|
|
1756
|
+
* custom `Content-Type`.
|
|
1757
|
+
*/
|
|
1758
|
+
upload(bucketId, params, body, options) {
|
|
1759
|
+
return this._request("PUT", path`/buckets/${bucketId}/objects/upload`, { query: params, rawBody: body }, options);
|
|
1760
|
+
}
|
|
1761
|
+
/** Mints a short-lived signed upload URL when direct transfers are enabled. */
|
|
1762
|
+
presignUpload(bucketId, body, options) {
|
|
1763
|
+
return this._post(path`/buckets/${bucketId}/objects/upload-url`, body, options);
|
|
1764
|
+
}
|
|
1765
|
+
/** Creates a folder marker object ending with `/`. */
|
|
1766
|
+
createFolder(bucketId, body, options) {
|
|
1767
|
+
return this._post(path`/buckets/${bucketId}/objects/folder`, body, options);
|
|
1768
|
+
}
|
|
1769
|
+
/** Copies, renames, or updates metadata of an object inside the bucket. */
|
|
1770
|
+
copy(bucketId, body, options) {
|
|
1771
|
+
return this._post(path`/buckets/${bucketId}/objects/copy`, body, options);
|
|
1772
|
+
}
|
|
1773
|
+
/** Deletes one or more objects or versions, or deletes a folder prefix recursively. */
|
|
1774
|
+
delete(bucketId, body, options) {
|
|
1775
|
+
return this._post(path`/buckets/${bucketId}/objects/delete`, body, options);
|
|
1776
|
+
}
|
|
1777
|
+
/** Replaces tags on an object or object version. */
|
|
1778
|
+
setTags(bucketId, body, options) {
|
|
1779
|
+
return this._put(path`/buckets/${bucketId}/objects/tags`, body, options);
|
|
1780
|
+
}
|
|
1781
|
+
/** Sets retention or legal hold on an object or object version. */
|
|
1782
|
+
setLock(bucketId, body, options) {
|
|
1783
|
+
return this._put(path`/buckets/${bucketId}/objects/lock`, body, options);
|
|
1784
|
+
}
|
|
1785
|
+
/** Sets whether a specific object is publicly readable and returns its `public_url`. */
|
|
1786
|
+
setVisibility(bucketId, body, options) {
|
|
1787
|
+
return this._put(path`/buckets/${bucketId}/objects/visibility`, body, options);
|
|
1788
|
+
}
|
|
1789
|
+
};
|
|
1790
|
+
var BucketMultipart = class extends APIResource {
|
|
1791
|
+
/** Starts a multipart upload session for a large object. Sent once: not retried on error. */
|
|
1792
|
+
start(bucketId, body, options) {
|
|
1793
|
+
return this._post(path`/buckets/${bucketId}/objects/multipart/start`, body, options, { noRetry: true });
|
|
1794
|
+
}
|
|
1795
|
+
/** Mints a short-lived signed upload URL for one part of an active multipart upload. */
|
|
1796
|
+
signPart(bucketId, body, options) {
|
|
1797
|
+
return this._post(path`/buckets/${bucketId}/objects/multipart/sign-part`, body, options);
|
|
1798
|
+
}
|
|
1799
|
+
/** Uploads one part of an active multipart upload as raw bytes. */
|
|
1800
|
+
uploadPart(bucketId, params, body, options) {
|
|
1801
|
+
return this._request(
|
|
1802
|
+
"PUT",
|
|
1803
|
+
path`/buckets/${bucketId}/objects/multipart/part`,
|
|
1804
|
+
{ query: params, rawBody: body },
|
|
1805
|
+
options
|
|
1806
|
+
);
|
|
1807
|
+
}
|
|
1808
|
+
/** Completes a multipart upload from its uploaded part ETags. Sent once: not retried on error. */
|
|
1809
|
+
complete(bucketId, body, options) {
|
|
1810
|
+
return this._post(path`/buckets/${bucketId}/objects/multipart/complete`, body, options, { noRetry: true });
|
|
1811
|
+
}
|
|
1812
|
+
/** Aborts an active multipart upload and discards uploaded parts. */
|
|
1813
|
+
abort(bucketId, body, options) {
|
|
1814
|
+
return this._post(path`/buckets/${bucketId}/objects/multipart/abort`, body, options);
|
|
1815
|
+
}
|
|
1816
|
+
};
|
|
1817
|
+
|
|
1607
1818
|
// src/resources/operations.ts
|
|
1608
1819
|
function operationId(ref) {
|
|
1609
1820
|
const id = typeof ref === "string" ? ref : ref.operation_id;
|
|
@@ -2034,7 +2245,7 @@ var WebhookDeliveries = class extends APIResource {
|
|
|
2034
2245
|
};
|
|
2035
2246
|
|
|
2036
2247
|
// src/version.ts
|
|
2037
|
-
var VERSION = "0.
|
|
2248
|
+
var VERSION = "0.5.0";
|
|
2038
2249
|
|
|
2039
2250
|
// src/client.ts
|
|
2040
2251
|
var DEFAULT_BASE_URL = "https://api.pantechdynamics.com/public/v1";
|
|
@@ -2044,7 +2255,7 @@ var MAX_RETRY_AFTER_MS = 6e4;
|
|
|
2044
2255
|
var RETRY_STATUSES = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);
|
|
2045
2256
|
var ACCEPT = {
|
|
2046
2257
|
json: "application/json",
|
|
2047
|
-
arrayBuffer: "
|
|
2258
|
+
arrayBuffer: "application/octet-stream",
|
|
2048
2259
|
text: "text/dns, text/plain;q=0.9",
|
|
2049
2260
|
response: "application/json"
|
|
2050
2261
|
};
|
|
@@ -2097,6 +2308,10 @@ var Pantech = class {
|
|
|
2097
2308
|
iam;
|
|
2098
2309
|
/** TLS certificates Pantech issues and renews, or ones you import. */
|
|
2099
2310
|
certificates;
|
|
2311
|
+
/** S3-compatible object storage: status, usage and access keys. */
|
|
2312
|
+
objectStorage;
|
|
2313
|
+
/** Object storage buckets, objects, multipart uploads and bucket rules. */
|
|
2314
|
+
buckets;
|
|
2100
2315
|
operations;
|
|
2101
2316
|
constructor(options = {}) {
|
|
2102
2317
|
const apiKey = options.apiKey ?? readEnv("PANTECH_API_KEY");
|
|
@@ -2144,6 +2359,8 @@ var Pantech = class {
|
|
|
2144
2359
|
this.registry = new Registry(this);
|
|
2145
2360
|
this.iam = new IAM(this);
|
|
2146
2361
|
this.certificates = new Certificates(this);
|
|
2362
|
+
this.objectStorage = new ObjectStorage(this);
|
|
2363
|
+
this.buckets = new Buckets(this);
|
|
2147
2364
|
}
|
|
2148
2365
|
/**
|
|
2149
2366
|
* Sends one request and returns its decoded body (undefined for an empty
|
|
@@ -2160,7 +2377,12 @@ var Pantech = class {
|
|
|
2160
2377
|
Authorization: `Bearer ${this.#apiKey}`
|
|
2161
2378
|
};
|
|
2162
2379
|
let payload;
|
|
2163
|
-
if (req.
|
|
2380
|
+
if (req.rawBody !== void 0) {
|
|
2381
|
+
payload = req.rawBody;
|
|
2382
|
+
if (!hasHeader(headers, "content-type")) {
|
|
2383
|
+
headers["Content-Type"] = "application/octet-stream";
|
|
2384
|
+
}
|
|
2385
|
+
} else if (req.body !== void 0) {
|
|
2164
2386
|
payload = JSON.stringify(req.body);
|
|
2165
2387
|
headers["Content-Type"] = "application/json";
|
|
2166
2388
|
}
|
|
@@ -2218,6 +2440,9 @@ var Pantech = class {
|
|
|
2218
2440
|
}
|
|
2219
2441
|
}
|
|
2220
2442
|
};
|
|
2443
|
+
function hasHeader(headers, name) {
|
|
2444
|
+
return Object.keys(headers).some((key) => key.toLowerCase() === name);
|
|
2445
|
+
}
|
|
2221
2446
|
function queryString(query) {
|
|
2222
2447
|
if (!query) return "";
|
|
2223
2448
|
const params = new URLSearchParams();
|