@pantechdynamic/sdk 0.4.0 → 0.6.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 +45 -0
- package/README.md +144 -10
- package/dist/index.cjs +483 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18209 -10769
- package/dist/index.d.ts +18209 -10769
- package/dist/index.js +483 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,51 @@ 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.6.0 (2026-11-25)
|
|
10
|
+
|
|
11
|
+
- Pantech Migrate reads every cloud it supports, not only AWS: `migrate.providers.list()` lists
|
|
12
|
+
them and how each is read (`federated` for AWS, Google Cloud, Azure and Huawei Cloud; `agent`
|
|
13
|
+
for DigitalOcean, Hetzner, Linode, Vultr, Contabo and OpenStack). `migrate.connections.create`
|
|
14
|
+
takes a `provider`, `update` takes `gcp`, `azure` or `huawei` federation details, and
|
|
15
|
+
connections and scans report `external_account_id`, connections their `agent` and the provider's
|
|
16
|
+
`setup`, and scans their `provider` and `runner`.
|
|
17
|
+
- The Pantech Migrate agent: `migrate.connections.enrollAgent` (a one-time code, sent once and
|
|
18
|
+
never retried, since each call issues a new one) and `migrate.connections.revokeAgent`.
|
|
19
|
+
- People: a scan's `users` say where each person comes from (`source`), their `access_level` and
|
|
20
|
+
their `roles`, and `migrate.migrations.sendInvites` invites a plan's `user` items with their
|
|
21
|
+
roles. Plan item targets carry `image_slug` (Windows Server, on request) and `invite_id`.
|
|
22
|
+
- Buckets: `migrate.copyAccess` (`get`, `set`) and `migrate.bucketImports` (`list`, `listAll`,
|
|
23
|
+
`start`, `get`, `cancel`, `resync` with optional `mirror_deletes`).
|
|
24
|
+
- Servers: `migrate.serverCopies` (`start`, `getTemplate` for the AWS copy role, `list`, `listAll`,
|
|
25
|
+
`get`, `sync`, `cutOver`, `cancel`).
|
|
26
|
+
- Databases: `migrate.databaseImports` (`start`, `list`, `listAll`, `get`, `checkReadiness`,
|
|
27
|
+
`cutOver`, `cancel`, `revokeAccess`).
|
|
28
|
+
- Kubernetes: `migrate.kubernetesMoves` (`start`, `list`, `listAll`, `getSourceAccess`, `get`,
|
|
29
|
+
`preview`, `apply`, `syncVolumes`, `cutOver`, `cancel`, and `downloadManifests`, which returns
|
|
30
|
+
the YAML as a string). Scans report `kubernetes_clusters`, plans have `kubernetes_cluster` items,
|
|
31
|
+
and `migrate.migrations.updateItem` takes `allow_version_downgrade`.
|
|
32
|
+
- Type aliases for every new schema, such as `CloudProvider`, `CloudAgentEnrollment`, `CopyAccess`,
|
|
33
|
+
`BucketImport`, `ServerCopy`, `DatabaseImport`, `KubernetesMove` and `KubernetesMoveDetail`.
|
|
34
|
+
- `databases.getSnapshotSchedule` and `databases.setSnapshotSchedule`: automatic snapshots of a
|
|
35
|
+
database's data disk, as for instances and volumes.
|
|
36
|
+
|
|
37
|
+
## 0.5.0 (2026-11-24)
|
|
38
|
+
|
|
39
|
+
- Dynamic IP for instances: `instances.dynamicIp` (`get`, `set`, `disable`, and non-retrying
|
|
40
|
+
`rotate`), optional `address_rotation` on `instances.create`, and `DynamicIp`, `DynamicIpEvent`,
|
|
41
|
+
and `PutDynamicIpRequest` type aliases.
|
|
42
|
+
- S3-compatible Object Storage: `client.objectStorage` (`getStatus`, `getUsage`, and
|
|
43
|
+
`objectStorage.keys.{list, create, revoke}` with non-enumerable `secret_access_key`) and
|
|
44
|
+
`client.buckets` (`list`, `create`, `get`, `update`, `delete`, `stats`, `empty`, CORS, lifecycle,
|
|
45
|
+
tags, object lock, `buckets.objects.*` with binary upload/download and per-object visibility, and
|
|
46
|
+
`buckets.multipart.*`).
|
|
47
|
+
- Raw binary request body support (`BinaryBody`: `Uint8Array | ArrayBuffer | Blob | string`,
|
|
48
|
+
defaulting to `Content-Type: application/octet-stream` unless overridden) and `Accept:
|
|
49
|
+
application/octet-stream` for `arrayBuffer` binary downloads across Node.js, Bun, Deno, and edge
|
|
50
|
+
runtimes.
|
|
51
|
+
|
|
7
52
|
## 0.4.0 (2026-11-10)
|
|
8
53
|
|
|
9
54
|
- `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,17 +66,18 @@ 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()` |
|
|
78
|
-
| Move from another cloud | `migrate.connections
|
|
80
|
+
| Move from another cloud | `migrate.providers.list()`, `migrate.connections.*` (`enrollAgent`, `revokeAgent`), `migrate.scans.*`, `migrate.migrations.*` (`sendInvites`), `migrate.copyAccess.get/set`, `migrate.bucketImports.*`, `migrate.serverCopies.*`, `migrate.databaseImports.*`, `migrate.kubernetesMoves.*` |
|
|
79
81
|
| DNS | `dns.zones.*` (`exportZoneFile`, `importZoneFile`, `verify`, `wait`), `dns.records.*` (`batch`, `wait`) |
|
|
80
82
|
| Certificates | `certificates.request/import/get/list/update/verify/reimport/export/revoke/delete`, `certificates.wait(id)` |
|
|
81
83
|
| Teams and access policies | `iam.members.list()`, `iam.actions.list()`, `iam.settings.*`, `iam.teams.*`, `iam.teams.members.*`, `iam.policies.*`, `iam.policies.attachments.*`, `iam.effectiveAccess(userId)`, `iam.simulate({...})` |
|
|
@@ -112,11 +114,80 @@ 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
|
-
`client.migrate` connects
|
|
118
|
-
|
|
119
|
-
Terraform
|
|
185
|
+
`client.migrate` connects another cloud read-only, scans what runs there, and plans the move with a
|
|
186
|
+
price comparison and a Terraform export. Nothing is created on Pantech until you apply the
|
|
187
|
+
Terraform or start a copy. `migrate.providers.list()` names every cloud it can read and how:
|
|
188
|
+
AWS, Google Cloud, Azure and Huawei Cloud are `federated` (Pantech signs short-lived tokens your
|
|
189
|
+
cloud trusts, so no keys are shared); DigitalOcean, Hetzner, Linode, Vultr, Contabo and OpenStack
|
|
190
|
+
are read by the Pantech Migrate `agent`, which keeps your read-only token on your machine.
|
|
120
191
|
|
|
121
192
|
```ts
|
|
122
193
|
let conn = await client.migrate.connections.create({ name: "Production AWS" });
|
|
@@ -133,6 +204,65 @@ const { files } = await client.migrate.migrations.exportTerraform(plan.id); // m
|
|
|
133
204
|
`migrate.migrations.updateItem(id, { key, excluded: true })` leaves an item out, or changes its
|
|
134
205
|
plan, size, address range or role, before you export. See `examples/migrate-from-aws.ts`.
|
|
135
206
|
|
|
207
|
+
Other clouds connect the same way. For Google Cloud, Azure and Huawei Cloud, run the script in
|
|
208
|
+
`conn.setup.template` and send what it prints with `update`; for an agent provider, enroll the
|
|
209
|
+
agent where it will run:
|
|
210
|
+
|
|
211
|
+
```ts
|
|
212
|
+
const gcp = await client.migrate.connections.create({ provider: "gcp", name: "Production GCP" });
|
|
213
|
+
await client.migrate.connections.update(gcp.id, {
|
|
214
|
+
gcp: { project_number: "…", pool_id: "…", provider_id: "…", service_account_email: "…", project_ids: ["…"] },
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
const hetzner = await client.migrate.connections.create({ provider: "hetzner", name: "Hetzner" });
|
|
218
|
+
const { enroll_command } = await client.migrate.connections.enrollAgent(hetzner.id); // shown once
|
|
219
|
+
await client.migrate.connections.wait(hetzner.id); // connected once the agent has enrolled
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
`enrollAgent` is sent once and never retried, since each call issues a new code;
|
|
223
|
+
`revokeAgent(id)` ends the agent at once. A plan lists the people it found as items of kind
|
|
224
|
+
`user`; `migrate.migrations.sendInvites(planId, { keys })` invites them with their roles, and is
|
|
225
|
+
safe to repeat.
|
|
226
|
+
|
|
227
|
+
Then move the data across. Each copy is free; what it creates bills as usual.
|
|
228
|
+
|
|
229
|
+
```ts
|
|
230
|
+
// Buckets: choose them, deploy the copy role, then import.
|
|
231
|
+
await client.migrate.copyAccess.set(conn.id, { buckets: ["assets"] }); // returns the copy role template
|
|
232
|
+
await client.migrate.copyAccess.set(conn.id, { role_arn: "arn:aws:iam::…:role/…" }); // CopyRoleArn output
|
|
233
|
+
const imp = await client.migrate.bucketImports.start({
|
|
234
|
+
connection_id: conn.id,
|
|
235
|
+
source_bucket: "assets",
|
|
236
|
+
destination_bucket_name: "assets",
|
|
237
|
+
});
|
|
238
|
+
await client.migrate.bucketImports.resync(imp.id); // copies only what changed
|
|
239
|
+
|
|
240
|
+
// Servers: copy the disks, copy what changed, then cut over to a new instance.
|
|
241
|
+
const copy = await client.migrate.serverCopies.start(plan.id, { item_key: "…", subnet_id: "…" });
|
|
242
|
+
await client.migrate.serverCopies.sync(copy.id);
|
|
243
|
+
await client.migrate.serverCopies.cutOver(copy.id); // stop the application first
|
|
244
|
+
|
|
245
|
+
// Databases, through the Migrate agent: the source's credentials stay on it.
|
|
246
|
+
const dbi = await client.migrate.databaseImports.start(plan.id, {
|
|
247
|
+
item_key: "…",
|
|
248
|
+
destination_database_id: "…",
|
|
249
|
+
source_ref: "prod-db",
|
|
250
|
+
mode: "replicate",
|
|
251
|
+
});
|
|
252
|
+
await client.migrate.databaseImports.cutOver(dbi.id); // stop writes to the source first
|
|
253
|
+
|
|
254
|
+
// Kubernetes: preview, apply, then cut over.
|
|
255
|
+
const move = await client.migrate.kubernetesMoves.start(plan.id, { item_key: "…", cluster_id: "…" });
|
|
256
|
+
await client.migrate.kubernetesMoves.preview(move.id);
|
|
257
|
+
await client.migrate.kubernetesMoves.apply(move.id);
|
|
258
|
+
await client.migrate.kubernetesMoves.cutOver(move.id, { source_writes_stopped: true });
|
|
259
|
+
const manifests = await client.migrate.kubernetesMoves.downloadManifests(move.id); // YAML, for GitOps
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Each step is asynchronous: follow it with `get` (`bucketImports.get`, `serverCopies.get`,
|
|
263
|
+
`databaseImports.get`, `kubernetesMoves.get`) until its `status` says it is ready for the next.
|
|
264
|
+
Windows servers are copied with the agent only, once Windows is enabled for your organization.
|
|
265
|
+
|
|
136
266
|
## Certificates
|
|
137
267
|
|
|
138
268
|
`client.certificates` issues TLS certificates through a publicly trusted CA and renews them by
|
|
@@ -259,7 +389,9 @@ try {
|
|
|
259
389
|
Prices are before VAT. A TLD whose offer has `privacy_always_on: true` (the `.ng` family) has
|
|
260
390
|
privacy protection that cannot be turned off: asking for `privacy: false` is a `422` naming field
|
|
261
391
|
`privacy` with code `PRIVACY_ALWAYS_ON`. `.ng` contacts need `state` and `postal_code`, and
|
|
262
|
-
`name.ng` registrants must be people (`type: "person"`).
|
|
392
|
+
`name.ng` registrants must be people (`type: "person"`). Send `accept_terms: true` only once the
|
|
393
|
+
registrant has read and accepted the
|
|
394
|
+
[Domain Registration Agreement](https://pantechdynamics.com/legal/domain-registration).
|
|
263
395
|
|
|
264
396
|
`domains` also has `listTlds`, `checkTransfer`, `update` (auto-renew, transfer lock, privacy),
|
|
265
397
|
`setNameServers`, `getContact`/`updateContact`, `requestAuthCode`/`getAuthCode`,
|
|
@@ -304,8 +436,10 @@ to `maxRetries` times with jittered backoff.
|
|
|
304
436
|
|
|
305
437
|
The API does not replay some writes by key, so the SDK sends them once (except after a `429`,
|
|
306
438
|
which is refused before anything runs): creating and deleting SSH keys, opening an instance
|
|
307
|
-
console, issuing a volume key credential,
|
|
308
|
-
|
|
439
|
+
console, issuing a volume key credential, rotating an instance's dynamic IP now
|
|
440
|
+
(`instances.dynamicIp.rotate`), creating object storage access keys, emptying a bucket, starting
|
|
441
|
+
and completing multipart uploads, testing, deleting, rotating the secret of and redelivering
|
|
442
|
+
webhooks, and `DELETE /me`.
|
|
309
443
|
|
|
310
444
|
## Webhooks
|
|
311
445
|
|