@nirvana-labs/nirvana 1.0.5 → 1.1.1

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 (148) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +1 -1
  3. package/client.d.mts +4 -0
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +4 -0
  6. package/client.d.ts.map +1 -1
  7. package/client.js +16 -0
  8. package/client.js.map +1 -1
  9. package/client.mjs +16 -0
  10. package/client.mjs.map +1 -1
  11. package/internal/headers.js +1 -1
  12. package/internal/headers.js.map +1 -1
  13. package/internal/headers.mjs +1 -1
  14. package/internal/headers.mjs.map +1 -1
  15. package/internal/to-file.d.mts +0 -1
  16. package/internal/to-file.d.mts.map +1 -1
  17. package/internal/to-file.d.ts +0 -1
  18. package/internal/to-file.d.ts.map +1 -1
  19. package/internal/to-file.js +3 -2
  20. package/internal/to-file.js.map +1 -1
  21. package/internal/to-file.mjs +3 -2
  22. package/internal/to-file.mjs.map +1 -1
  23. package/internal/uploads.d.mts +1 -1
  24. package/internal/uploads.d.mts.map +1 -1
  25. package/internal/uploads.d.ts +1 -1
  26. package/internal/uploads.d.ts.map +1 -1
  27. package/internal/uploads.js +14 -4
  28. package/internal/uploads.js.map +1 -1
  29. package/internal/uploads.mjs +12 -3
  30. package/internal/uploads.mjs.map +1 -1
  31. package/internal/utils/uuid.d.mts +1 -1
  32. package/internal/utils/uuid.d.mts.map +1 -1
  33. package/internal/utils/uuid.d.ts +1 -1
  34. package/internal/utils/uuid.d.ts.map +1 -1
  35. package/internal/utils/uuid.js +1 -2
  36. package/internal/utils/uuid.js.map +1 -1
  37. package/internal/utils/uuid.mjs +1 -2
  38. package/internal/utils/uuid.mjs.map +1 -1
  39. package/package.json +4 -5
  40. package/resources/api-keys.d.mts +28 -0
  41. package/resources/api-keys.d.mts.map +1 -1
  42. package/resources/api-keys.d.ts +28 -0
  43. package/resources/api-keys.d.ts.map +1 -1
  44. package/resources/api-keys.js +28 -0
  45. package/resources/api-keys.js.map +1 -1
  46. package/resources/api-keys.mjs +28 -0
  47. package/resources/api-keys.mjs.map +1 -1
  48. package/resources/compute/vms/os-images.d.mts +5 -0
  49. package/resources/compute/vms/os-images.d.mts.map +1 -1
  50. package/resources/compute/vms/os-images.d.ts +5 -0
  51. package/resources/compute/vms/os-images.d.ts.map +1 -1
  52. package/resources/compute/vms/os-images.js +5 -0
  53. package/resources/compute/vms/os-images.js.map +1 -1
  54. package/resources/compute/vms/os-images.mjs +5 -0
  55. package/resources/compute/vms/os-images.mjs.map +1 -1
  56. package/resources/compute/vms/vms.d.mts +38 -0
  57. package/resources/compute/vms/vms.d.mts.map +1 -1
  58. package/resources/compute/vms/vms.d.ts +38 -0
  59. package/resources/compute/vms/vms.d.ts.map +1 -1
  60. package/resources/compute/vms/vms.js +38 -0
  61. package/resources/compute/vms/vms.js.map +1 -1
  62. package/resources/compute/vms/vms.mjs +38 -0
  63. package/resources/compute/vms/vms.mjs.map +1 -1
  64. package/resources/compute/vms/volumes.d.mts +7 -0
  65. package/resources/compute/vms/volumes.d.mts.map +1 -1
  66. package/resources/compute/vms/volumes.d.ts +7 -0
  67. package/resources/compute/vms/volumes.d.ts.map +1 -1
  68. package/resources/compute/vms/volumes.js +7 -0
  69. package/resources/compute/vms/volumes.js.map +1 -1
  70. package/resources/compute/vms/volumes.mjs +7 -0
  71. package/resources/compute/vms/volumes.mjs.map +1 -1
  72. package/resources/compute/volumes.d.mts +35 -0
  73. package/resources/compute/volumes.d.mts.map +1 -1
  74. package/resources/compute/volumes.d.ts +35 -0
  75. package/resources/compute/volumes.d.ts.map +1 -1
  76. package/resources/compute/volumes.js +35 -0
  77. package/resources/compute/volumes.js.map +1 -1
  78. package/resources/compute/volumes.mjs +35 -0
  79. package/resources/compute/volumes.mjs.map +1 -1
  80. package/resources/networking/firewall-rules.d.mts +45 -0
  81. package/resources/networking/firewall-rules.d.mts.map +1 -1
  82. package/resources/networking/firewall-rules.d.ts +45 -0
  83. package/resources/networking/firewall-rules.d.ts.map +1 -1
  84. package/resources/networking/firewall-rules.js +45 -0
  85. package/resources/networking/firewall-rules.js.map +1 -1
  86. package/resources/networking/firewall-rules.mjs +45 -0
  87. package/resources/networking/firewall-rules.mjs.map +1 -1
  88. package/resources/networking/vpcs.d.mts +33 -0
  89. package/resources/networking/vpcs.d.mts.map +1 -1
  90. package/resources/networking/vpcs.d.ts +33 -0
  91. package/resources/networking/vpcs.d.ts.map +1 -1
  92. package/resources/networking/vpcs.js +33 -0
  93. package/resources/networking/vpcs.js.map +1 -1
  94. package/resources/networking/vpcs.mjs +33 -0
  95. package/resources/networking/vpcs.mjs.map +1 -1
  96. package/src/client.ts +17 -0
  97. package/src/internal/headers.ts +1 -1
  98. package/src/internal/to-file.ts +4 -2
  99. package/src/internal/uploads.ts +16 -4
  100. package/src/internal/utils/uuid.ts +1 -3
  101. package/src/resources/api-keys.ts +28 -0
  102. package/src/resources/compute/vms/os-images.ts +5 -0
  103. package/src/resources/compute/vms/vms.ts +38 -0
  104. package/src/resources/compute/vms/volumes.ts +7 -0
  105. package/src/resources/compute/volumes.ts +35 -0
  106. package/src/resources/networking/firewall-rules.ts +45 -0
  107. package/src/resources/networking/vpcs.ts +33 -0
  108. package/src/version.ts +1 -1
  109. package/version.d.mts +1 -1
  110. package/version.d.ts +1 -1
  111. package/version.js +1 -1
  112. package/version.mjs +1 -1
  113. package/internal/shims/crypto.d.mts +0 -13
  114. package/internal/shims/crypto.d.mts.map +0 -1
  115. package/internal/shims/crypto.d.ts +0 -13
  116. package/internal/shims/crypto.d.ts.map +0 -1
  117. package/internal/shims/crypto.js +0 -13
  118. package/internal/shims/crypto.js.map +0 -1
  119. package/internal/shims/crypto.mjs +0 -9
  120. package/internal/shims/crypto.mjs.map +0 -1
  121. package/internal/shims/file.d.mts +0 -22
  122. package/internal/shims/file.d.mts.map +0 -1
  123. package/internal/shims/file.d.ts +0 -22
  124. package/internal/shims/file.d.ts.map +0 -1
  125. package/internal/shims/file.js +0 -16
  126. package/internal/shims/file.js.map +0 -1
  127. package/internal/shims/file.mjs +0 -12
  128. package/internal/shims/file.mjs.map +0 -1
  129. package/internal/shims/getBuiltinModule.d.mts +0 -11
  130. package/internal/shims/getBuiltinModule.d.mts.map +0 -1
  131. package/internal/shims/getBuiltinModule.d.ts +0 -11
  132. package/internal/shims/getBuiltinModule.d.ts.map +0 -1
  133. package/internal/shims/getBuiltinModule.js +0 -71
  134. package/internal/shims/getBuiltinModule.js.map +0 -1
  135. package/internal/shims/getBuiltinModule.mjs +0 -67
  136. package/internal/shims/getBuiltinModule.mjs.map +0 -1
  137. package/internal/shims/nullGetBuiltinModule.d.mts +0 -2
  138. package/internal/shims/nullGetBuiltinModule.d.mts.map +0 -1
  139. package/internal/shims/nullGetBuiltinModule.d.ts +0 -2
  140. package/internal/shims/nullGetBuiltinModule.d.ts.map +0 -1
  141. package/internal/shims/nullGetBuiltinModule.js +0 -5
  142. package/internal/shims/nullGetBuiltinModule.js.map +0 -1
  143. package/internal/shims/nullGetBuiltinModule.mjs +0 -2
  144. package/internal/shims/nullGetBuiltinModule.mjs.map +0 -1
  145. package/src/internal/shims/crypto.ts +0 -18
  146. package/src/internal/shims/file.ts +0 -32
  147. package/src/internal/shims/getBuiltinModule.ts +0 -66
  148. package/src/internal/shims/nullGetBuiltinModule.ts +0 -1
@@ -1,6 +1,6 @@
1
- import { type File, getFile } from './shims/file';
2
1
  import { BlobPart, getName, makeFile, isAsyncIterable } from './uploads';
3
2
  import type { FilePropertyBag } from './builtin-types';
3
+ import { checkFileSupport } from './uploads';
4
4
 
5
5
  type BlobLikePart = string | ArrayBuffer | ArrayBufferView | BlobLike | DataView;
6
6
 
@@ -85,12 +85,14 @@ export async function toFile(
85
85
  name?: string | null | undefined,
86
86
  options?: FilePropertyBag | undefined,
87
87
  ): Promise<File> {
88
+ checkFileSupport();
89
+
88
90
  // If it's a promise, resolve it.
89
91
  value = await value;
90
92
 
91
93
  // If we've been given a `File` we don't need to do anything
92
94
  if (isFileLike(value)) {
93
- if (value instanceof getFile()) {
95
+ if (value instanceof File) {
94
96
  return value;
95
97
  }
96
98
  return makeFile([await value.arrayBuffer()], value.name);
@@ -1,7 +1,6 @@
1
1
  import { type RequestOptions } from './request-options';
2
2
  import type { FilePropertyBag, Fetch } from './builtin-types';
3
3
  import type { NirvanaLabs } from '../client';
4
- import { type File, getFile } from './shims/file';
5
4
  import { ReadableStreamFrom } from './shims';
6
5
 
7
6
  export type BlobPart = string | ArrayBuffer | ArrayBufferView | Blob | DataView;
@@ -12,6 +11,20 @@ interface BunFile extends Blob {
12
11
  readonly name?: string | undefined;
13
12
  }
14
13
 
14
+ export const checkFileSupport = () => {
15
+ if (typeof File === 'undefined') {
16
+ const { process } = globalThis as any;
17
+ const isOldNode =
18
+ typeof process?.versions?.node === 'string' && parseInt(process.versions.node.split('.')) < 20;
19
+ throw new Error(
20
+ '`File` is not defined as a global, which is required for file uploads.' +
21
+ (isOldNode ?
22
+ " Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`."
23
+ : ''),
24
+ );
25
+ }
26
+ };
27
+
15
28
  /**
16
29
  * Typically, this is a native "File" class.
17
30
  *
@@ -32,7 +45,7 @@ export function makeFile(
32
45
  fileName: string | undefined,
33
46
  options?: FilePropertyBag,
34
47
  ): File {
35
- const File = getFile();
48
+ checkFileSupport();
36
49
  return new File(fileBits as any, fileName ?? 'unknown_file', options);
37
50
  }
38
51
 
@@ -125,8 +138,7 @@ export const createForm = async <T = Record<string, unknown>>(
125
138
 
126
139
  // We check for Blob not File because Bun.File doesn't inherit from File,
127
140
  // but they both inherit from Blob and have a `name` property at runtime.
128
- const isNamedBlob = (value: object) =>
129
- value instanceof getFile() || (value instanceof Blob && 'name' in value);
141
+ const isNamedBlob = (value: object) => value instanceof Blob && 'name' in value;
130
142
 
131
143
  const isUploadable = (value: unknown) =>
132
144
  typeof value === 'object' &&
@@ -1,12 +1,10 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { getCrypto } from '../shims/crypto';
4
-
5
3
  /**
6
4
  * https://stackoverflow.com/a/2117523
7
5
  */
8
6
  export let uuid4 = function () {
9
- const crypto = getCrypto();
7
+ const { crypto } = globalThis as any;
10
8
  if (crypto?.randomUUID) {
11
9
  uuid4 = crypto.randomUUID.bind(crypto);
12
10
  return crypto.randomUUID();
@@ -9,6 +9,14 @@ import { path } from '../internal/utils/path';
9
9
  export class APIKeys extends APIResource {
10
10
  /**
11
11
  * Create a new API key
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const apiKey = await client.apiKeys.create({
16
+ * expires_at: '2025-12-31T23:59:59Z',
17
+ * name: 'my-api-key',
18
+ * });
19
+ * ```
12
20
  */
13
21
  create(body: APIKeyCreateParams, options?: RequestOptions): APIPromise<APIKey> {
14
22
  return this._client.post('/v1/api_keys', { body, ...options });
@@ -16,6 +24,11 @@ export class APIKeys extends APIResource {
16
24
 
17
25
  /**
18
26
  * Update an API key's name
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const apiKey = await client.apiKeys.update('api_key_id');
31
+ * ```
19
32
  */
20
33
  update(apiKeyID: string, body: APIKeyUpdateParams, options?: RequestOptions): APIPromise<APIKey> {
21
34
  return this._client.patch(path`/v1/api_keys/${apiKeyID}`, { body, ...options });
@@ -23,6 +36,11 @@ export class APIKeys extends APIResource {
23
36
 
24
37
  /**
25
38
  * List all API keys you created
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const apiKeyList = await client.apiKeys.list();
43
+ * ```
26
44
  */
27
45
  list(options?: RequestOptions): APIPromise<APIKeyList> {
28
46
  return this._client.get('/v1/api_keys', options);
@@ -30,6 +48,11 @@ export class APIKeys extends APIResource {
30
48
 
31
49
  /**
32
50
  * Delete an API key
51
+ *
52
+ * @example
53
+ * ```ts
54
+ * await client.apiKeys.delete('api_key_id');
55
+ * ```
33
56
  */
34
57
  delete(apiKeyID: string, options?: RequestOptions): APIPromise<void> {
35
58
  return this._client.delete(path`/v1/api_keys/${apiKeyID}`, {
@@ -40,6 +63,11 @@ export class APIKeys extends APIResource {
40
63
 
41
64
  /**
42
65
  * Get details about an API key
66
+ *
67
+ * @example
68
+ * ```ts
69
+ * const apiKey = await client.apiKeys.get('api_key_id');
70
+ * ```
43
71
  */
44
72
  get(apiKeyID: string, options?: RequestOptions): APIPromise<APIKey> {
45
73
  return this._client.get(path`/v1/api_keys/${apiKeyID}`, options);
@@ -8,6 +8,11 @@ import { RequestOptions } from '../../../internal/request-options';
8
8
  export class OSImages extends APIResource {
9
9
  /**
10
10
  * List all OS Images
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const osImages = await client.compute.vms.osImages.list();
15
+ * ```
11
16
  */
12
17
  list(options?: RequestOptions): APIPromise<OSImageListResponse> {
13
18
  return this._client.get('/v1/compute/vms/os_images', options);
@@ -17,6 +17,24 @@ export class VMs extends APIResource {
17
17
 
18
18
  /**
19
19
  * Create a VM
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * const operation = await client.compute.vms.create({
24
+ * boot_volume: { size: 100 },
25
+ * cpu_config: { vcpu: 2 },
26
+ * memory_config: { size: 2 },
27
+ * name: 'my-vm',
28
+ * os_image_name: 'ubuntu-noble-2025-04-03',
29
+ * public_ip_enabled: true,
30
+ * region: 'us-wdc-1',
31
+ * ssh_key: {
32
+ * public_key:
33
+ * 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDJiJabIUkXw7VrQG+yBohvhEsyoKEYvejZc4RFzV5maybqQei1punVsoe4r6gJttMM1Gr3cNr3OfepikCQAhAchw5ww94ZWqDsDYIqMrlDFbqhGTXDNzFAjeVIKptCOlz9k+7aM69YtLXJ6gFUCq1fbK9PjY+AK28UpMfKYUcyHQ== noname',
34
+ * },
35
+ * subnet_id: '123e4567-e89b-12d3-a456-426614174000',
36
+ * });
37
+ * ```
20
38
  */
21
39
  create(body: VMCreateParams, options?: RequestOptions): APIPromise<OperationsAPI.Operation> {
22
40
  return this._client.post('/v1/compute/vms', { body, ...options });
@@ -24,6 +42,11 @@ export class VMs extends APIResource {
24
42
 
25
43
  /**
26
44
  * Update a VM
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * const operation = await client.compute.vms.update('vm_id');
49
+ * ```
27
50
  */
28
51
  update(vmID: string, body: VMUpdateParams, options?: RequestOptions): APIPromise<OperationsAPI.Operation> {
29
52
  return this._client.patch(path`/v1/compute/vms/${vmID}`, { body, ...options });
@@ -31,6 +54,11 @@ export class VMs extends APIResource {
31
54
 
32
55
  /**
33
56
  * List all VMs
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * const vmList = await client.compute.vms.list();
61
+ * ```
34
62
  */
35
63
  list(options?: RequestOptions): APIPromise<VMList> {
36
64
  return this._client.get('/v1/compute/vms', options);
@@ -38,6 +66,11 @@ export class VMs extends APIResource {
38
66
 
39
67
  /**
40
68
  * Delete a VM
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * const operation = await client.compute.vms.delete('vm_id');
73
+ * ```
41
74
  */
42
75
  delete(vmID: string, options?: RequestOptions): APIPromise<OperationsAPI.Operation> {
43
76
  return this._client.delete(path`/v1/compute/vms/${vmID}`, options);
@@ -45,6 +78,11 @@ export class VMs extends APIResource {
45
78
 
46
79
  /**
47
80
  * Get details about a VM
81
+ *
82
+ * @example
83
+ * ```ts
84
+ * const vm = await client.compute.vms.get('vm_id');
85
+ * ```
48
86
  */
49
87
  get(vmID: string, options?: RequestOptions): APIPromise<VM> {
50
88
  return this._client.get(path`/v1/compute/vms/${vmID}`, options);
@@ -9,6 +9,13 @@ import { path } from '../../../internal/utils/path';
9
9
  export class Volumes extends APIResource {
10
10
  /**
11
11
  * List VM's Volumes
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const volumeList = await client.compute.vms.volumes.list(
16
+ * 'vm_id',
17
+ * );
18
+ * ```
12
19
  */
13
20
  list(vmID: string, options?: RequestOptions): APIPromise<VolumesAPI.VolumeList> {
14
21
  return this._client.get(path`/v1/compute/vms/${vmID}/volumes`, options);
@@ -10,6 +10,15 @@ import { path } from '../../internal/utils/path';
10
10
  export class Volumes extends APIResource {
11
11
  /**
12
12
  * Create a Volume. Only data volumes can be created.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const operation = await client.compute.volumes.create({
17
+ * name: 'my-data-volume',
18
+ * size: 100,
19
+ * vm_id: 'vm_id',
20
+ * });
21
+ * ```
13
22
  */
14
23
  create(body: VolumeCreateParams, options?: RequestOptions): APIPromise<OperationsAPI.Operation> {
15
24
  return this._client.post('/v1/compute/volumes', { body, ...options });
@@ -17,6 +26,13 @@ export class Volumes extends APIResource {
17
26
 
18
27
  /**
19
28
  * Update a Volume. Boot or data volumes can be updated.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * const operation = await client.compute.volumes.update(
33
+ * 'volume_id',
34
+ * );
35
+ * ```
20
36
  */
21
37
  update(
22
38
  volumeID: string,
@@ -28,6 +44,11 @@ export class Volumes extends APIResource {
28
44
 
29
45
  /**
30
46
  * List all volumes
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * const volumeList = await client.compute.volumes.list();
51
+ * ```
31
52
  */
32
53
  list(options?: RequestOptions): APIPromise<VolumeList> {
33
54
  return this._client.get('/v1/compute/volumes', options);
@@ -35,6 +56,13 @@ export class Volumes extends APIResource {
35
56
 
36
57
  /**
37
58
  * Delete a Volume. Boot or data volumes can be deleted.
59
+ *
60
+ * @example
61
+ * ```ts
62
+ * const operation = await client.compute.volumes.delete(
63
+ * 'volume_id',
64
+ * );
65
+ * ```
38
66
  */
39
67
  delete(volumeID: string, options?: RequestOptions): APIPromise<OperationsAPI.Operation> {
40
68
  return this._client.delete(path`/v1/compute/volumes/${volumeID}`, options);
@@ -42,6 +70,13 @@ export class Volumes extends APIResource {
42
70
 
43
71
  /**
44
72
  * Get a Volume.
73
+ *
74
+ * @example
75
+ * ```ts
76
+ * const volume = await client.compute.volumes.get(
77
+ * 'volume_id',
78
+ * );
79
+ * ```
45
80
  */
46
81
  get(volumeID: string, options?: RequestOptions): APIPromise<Volume> {
47
82
  return this._client.get(path`/v1/compute/volumes/${volumeID}`, options);
@@ -10,6 +10,18 @@ import { path } from '../../internal/utils/path';
10
10
  export class FirewallRules extends APIResource {
11
11
  /**
12
12
  * Create a firewall rule
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const operation =
17
+ * await client.networking.firewallRules.create('vpc_id', {
18
+ * destination_address: '0.0.0.0/0',
19
+ * destination_ports: ['22', '80', '443'],
20
+ * name: 'my-firewall-rule',
21
+ * protocol: 'tcp',
22
+ * source_address: '0.0.0.0/0',
23
+ * });
24
+ * ```
13
25
  */
14
26
  create(
15
27
  vpcID: string,
@@ -21,6 +33,15 @@ export class FirewallRules extends APIResource {
21
33
 
22
34
  /**
23
35
  * Update a firewall rule
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * const operation =
40
+ * await client.networking.firewallRules.update(
41
+ * 'firewall_rule_id',
42
+ * { vpc_id: 'vpc_id' },
43
+ * );
44
+ * ```
24
45
  */
25
46
  update(
26
47
  firewallRuleID: string,
@@ -36,6 +57,12 @@ export class FirewallRules extends APIResource {
36
57
 
37
58
  /**
38
59
  * List all firewall rules
60
+ *
61
+ * @example
62
+ * ```ts
63
+ * const firewallRuleList =
64
+ * await client.networking.firewallRules.list('vpc_id');
65
+ * ```
39
66
  */
40
67
  list(vpcID: string, options?: RequestOptions): APIPromise<FirewallRuleList> {
41
68
  return this._client.get(path`/v1/networking/vpcs/${vpcID}/firewall_rules`, options);
@@ -43,6 +70,15 @@ export class FirewallRules extends APIResource {
43
70
 
44
71
  /**
45
72
  * Delete a firewall rule
73
+ *
74
+ * @example
75
+ * ```ts
76
+ * const operation =
77
+ * await client.networking.firewallRules.delete(
78
+ * 'firewall_rule_id',
79
+ * { vpc_id: 'vpc_id' },
80
+ * );
81
+ * ```
46
82
  */
47
83
  delete(
48
84
  firewallRuleID: string,
@@ -55,6 +91,15 @@ export class FirewallRules extends APIResource {
55
91
 
56
92
  /**
57
93
  * Get details about a firewall rule
94
+ *
95
+ * @example
96
+ * ```ts
97
+ * const firewallRule =
98
+ * await client.networking.firewallRules.get(
99
+ * 'firewall_rule_id',
100
+ * { vpc_id: 'vpc_id' },
101
+ * );
102
+ * ```
58
103
  */
59
104
  get(
60
105
  firewallRuleID: string,
@@ -10,6 +10,15 @@ import { path } from '../../internal/utils/path';
10
10
  export class VPCs extends APIResource {
11
11
  /**
12
12
  * Create a VPC
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const operation = await client.networking.vpcs.create({
17
+ * name: 'my-vpc',
18
+ * region: 'us-wdc-1',
19
+ * subnet_name: 'my-subnet',
20
+ * });
21
+ * ```
13
22
  */
14
23
  create(body: VPCCreateParams, options?: RequestOptions): APIPromise<OperationsAPI.Operation> {
15
24
  return this._client.post('/v1/networking/vpcs', { body, ...options });
@@ -17,6 +26,13 @@ export class VPCs extends APIResource {
17
26
 
18
27
  /**
19
28
  * Update a VPC
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * const operation = await client.networking.vpcs.update(
33
+ * 'vpc_id',
34
+ * );
35
+ * ```
20
36
  */
21
37
  update(
22
38
  vpcID: string,
@@ -28,6 +44,11 @@ export class VPCs extends APIResource {
28
44
 
29
45
  /**
30
46
  * List all VPCs
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * const vpcList = await client.networking.vpcs.list();
51
+ * ```
31
52
  */
32
53
  list(options?: RequestOptions): APIPromise<VPCList> {
33
54
  return this._client.get('/v1/networking/vpcs', options);
@@ -35,6 +56,13 @@ export class VPCs extends APIResource {
35
56
 
36
57
  /**
37
58
  * Delete a VPC
59
+ *
60
+ * @example
61
+ * ```ts
62
+ * const operation = await client.networking.vpcs.delete(
63
+ * 'vpc_id',
64
+ * );
65
+ * ```
38
66
  */
39
67
  delete(vpcID: string, options?: RequestOptions): APIPromise<OperationsAPI.Operation> {
40
68
  return this._client.delete(path`/v1/networking/vpcs/${vpcID}`, options);
@@ -42,6 +70,11 @@ export class VPCs extends APIResource {
42
70
 
43
71
  /**
44
72
  * Get details about a VPC
73
+ *
74
+ * @example
75
+ * ```ts
76
+ * const vpc = await client.networking.vpcs.get('vpc_id');
77
+ * ```
45
78
  */
46
79
  get(vpcID: string, options?: RequestOptions): APIPromise<VPC> {
47
80
  return this._client.get(path`/v1/networking/vpcs/${vpcID}`, options);
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.0.5'; // x-release-please-version
1
+ export const VERSION = '1.1.1'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.0.5";
1
+ export declare const VERSION = "1.1.1";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.0.5";
1
+ export declare const VERSION = "1.1.1";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '1.0.5'; // x-release-please-version
4
+ exports.VERSION = '1.1.1'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '1.0.5'; // x-release-please-version
1
+ export const VERSION = '1.1.1'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map
@@ -1,13 +0,0 @@
1
- type Crypto = {
2
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues) */
3
- getRandomValues<T extends ArrayBufferView | null>(array: T): T;
4
- /**
5
- * Available only in secure contexts.
6
- *
7
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID)
8
- */
9
- randomUUID?: () => string;
10
- };
11
- export declare let getCrypto: () => Crypto | undefined;
12
- export {};
13
- //# sourceMappingURL=crypto.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"crypto.d.mts","sourceRoot":"","sources":["../../src/internal/shims/crypto.ts"],"names":[],"mappings":"AAEA,KAAK,MAAM,GAAG;IACZ,yFAAyF;IACzF,eAAe,CAAC,CAAC,SAAS,eAAe,GAAG,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC;IAC/D;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,MAAM,CAAC;CAC3B,CAAC;AACF,eAAO,IAAI,SAAS,EAAE,MAAM,MAAM,GAAG,SAKpC,CAAC"}
@@ -1,13 +0,0 @@
1
- type Crypto = {
2
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues) */
3
- getRandomValues<T extends ArrayBufferView | null>(array: T): T;
4
- /**
5
- * Available only in secure contexts.
6
- *
7
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID)
8
- */
9
- randomUUID?: () => string;
10
- };
11
- export declare let getCrypto: () => Crypto | undefined;
12
- export {};
13
- //# sourceMappingURL=crypto.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../src/internal/shims/crypto.ts"],"names":[],"mappings":"AAEA,KAAK,MAAM,GAAG;IACZ,yFAAyF;IACzF,eAAe,CAAC,CAAC,SAAS,eAAe,GAAG,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC;IAC/D;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,MAAM,CAAC;CAC3B,CAAC;AACF,eAAO,IAAI,SAAS,EAAE,MAAM,MAAM,GAAG,SAKpC,CAAC"}
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCrypto = void 0;
4
- const getBuiltinModule_1 = require("./getBuiltinModule.js");
5
- let getCrypto = function lazyGetCrypto() {
6
- if (exports.getCrypto !== lazyGetCrypto)
7
- return (0, exports.getCrypto)();
8
- const crypto = globalThis.crypto || (0, getBuiltinModule_1.getBuiltinModule)?.('node:crypto')?.webcrypto;
9
- exports.getCrypto = () => crypto;
10
- return crypto;
11
- };
12
- exports.getCrypto = getCrypto;
13
- //# sourceMappingURL=crypto.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"crypto.js","sourceRoot":"","sources":["../../src/internal/shims/crypto.ts"],"names":[],"mappings":";;;AAAA,4DAAsD;AAY/C,IAAI,SAAS,GAA6B,SAAS,aAAa;IACrE,IAAI,iBAAS,KAAK,aAAa;QAAE,OAAO,IAAA,iBAAS,GAAE,CAAC;IACpD,MAAM,MAAM,GAAY,UAAkB,CAAC,MAAM,IAAK,IAAA,mCAAgB,CAAA,EAAE,CAAC,aAAa,CAAS,EAAE,SAAS,CAAC;IAC3G,iBAAS,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC;IACzB,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AALS,QAAA,SAAS,aAKlB"}
@@ -1,9 +0,0 @@
1
- import { getBuiltinModule } from "./getBuiltinModule.mjs";
2
- export let getCrypto = function lazyGetCrypto() {
3
- if (getCrypto !== lazyGetCrypto)
4
- return getCrypto();
5
- const crypto = globalThis.crypto || getBuiltinModule?.('node:crypto')?.webcrypto;
6
- getCrypto = () => crypto;
7
- return crypto;
8
- };
9
- //# sourceMappingURL=crypto.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"crypto.mjs","sourceRoot":"","sources":["../../src/internal/shims/crypto.ts"],"names":[],"mappings":"OAAO,EAAE,gBAAgB,EAAE;AAY3B,MAAM,CAAC,IAAI,SAAS,GAA6B,SAAS,aAAa;IACrE,IAAI,SAAS,KAAK,aAAa;QAAE,OAAO,SAAS,EAAE,CAAC;IACpD,MAAM,MAAM,GAAY,UAAkB,CAAC,MAAM,IAAK,gBAAgB,EAAE,CAAC,aAAa,CAAS,EAAE,SAAS,CAAC;IAC3G,SAAS,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC;IACzB,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
@@ -1,22 +0,0 @@
1
- export declare let getFile: () => FileConstructor;
2
- type FileConstructor = typeof globalThis extends {
3
- File: infer fileConstructor;
4
- } ? fileConstructor : typeof FallbackFile;
5
- export type File = InstanceType<FileConstructor>;
6
- type FallbackBlobSource = ConstructorParameters<typeof Blob>[0] extends infer T ? T : never;
7
- /**
8
- * A [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) provides information about files.
9
- */
10
- declare class FallbackFile extends Blob {
11
- constructor(sources: FallbackBlobSource, fileName: string, options?: any);
12
- /**
13
- * The name of the `File`.
14
- */
15
- readonly name: string;
16
- /**
17
- * The last modified date of the `File`.
18
- */
19
- readonly lastModified: number;
20
- }
21
- export {};
22
- //# sourceMappingURL=file.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file.d.mts","sourceRoot":"","sources":["../../src/internal/shims/file.ts"],"names":[],"mappings":"AAEA,eAAO,IAAI,OAAO,QAA2B,eAO5C,CAAC;AAEF,KAAK,eAAe,GAClB,OAAO,UAAU,SAAS;IAAE,IAAI,EAAE,MAAM,eAAe,CAAA;CAAE,GAAG,eAAe,GAAG,OAAO,YAAY,CAAC;AACpG,MAAM,MAAM,IAAI,GAAG,YAAY,CAAC,eAAe,CAAC,CAAC;AAIjD,KAAK,kBAAkB,GAAG,qBAAqB,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAC5F;;GAEG;AACH,OAAO,OAAO,YAAa,SAAQ,IAAI;gBACzB,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG;IACxE;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B"}
@@ -1,22 +0,0 @@
1
- export declare let getFile: () => FileConstructor;
2
- type FileConstructor = typeof globalThis extends {
3
- File: infer fileConstructor;
4
- } ? fileConstructor : typeof FallbackFile;
5
- export type File = InstanceType<FileConstructor>;
6
- type FallbackBlobSource = ConstructorParameters<typeof Blob>[0] extends infer T ? T : never;
7
- /**
8
- * A [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) provides information about files.
9
- */
10
- declare class FallbackFile extends Blob {
11
- constructor(sources: FallbackBlobSource, fileName: string, options?: any);
12
- /**
13
- * The name of the `File`.
14
- */
15
- readonly name: string;
16
- /**
17
- * The last modified date of the `File`.
18
- */
19
- readonly lastModified: number;
20
- }
21
- export {};
22
- //# sourceMappingURL=file.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/internal/shims/file.ts"],"names":[],"mappings":"AAEA,eAAO,IAAI,OAAO,QAA2B,eAO5C,CAAC;AAEF,KAAK,eAAe,GAClB,OAAO,UAAU,SAAS;IAAE,IAAI,EAAE,MAAM,eAAe,CAAA;CAAE,GAAG,eAAe,GAAG,OAAO,YAAY,CAAC;AACpG,MAAM,MAAM,IAAI,GAAG,YAAY,CAAC,eAAe,CAAC,CAAC;AAIjD,KAAK,kBAAkB,GAAG,qBAAqB,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAC5F;;GAEG;AACH,OAAO,OAAO,YAAa,SAAQ,IAAI;gBACzB,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG;IACxE;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getFile = void 0;
4
- const getBuiltinModule_1 = require("./getBuiltinModule.js");
5
- let getFile = function lazyGetFile() {
6
- if (exports.getFile !== lazyGetFile)
7
- return (0, exports.getFile)();
8
- // We can drop getBuiltinModule once we no longer support Node < 20.0.0
9
- const File = globalThis.File ?? (0, getBuiltinModule_1.getBuiltinModule)?.('node:buffer')?.File;
10
- if (!File)
11
- throw new Error('`File` is not defined as a global, which is required for file uploads.');
12
- exports.getFile = () => File;
13
- return File;
14
- };
15
- exports.getFile = getFile;
16
- //# sourceMappingURL=file.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/internal/shims/file.ts"],"names":[],"mappings":";;;AAAA,4DAAsD;AAE/C,IAAI,OAAO,GAAG,SAAS,WAAW;IACvC,IAAI,eAAO,KAAK,WAAW;QAAE,OAAO,IAAA,eAAO,GAAE,CAAC;IAC9C,uEAAuE;IACvE,MAAM,IAAI,GAAI,UAAkB,CAAC,IAAI,IAAK,IAAA,mCAAgB,CAAA,EAAE,CAAC,aAAa,CAAS,EAAE,IAAI,CAAC;IAC1F,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,wEAAwE,CAAC,CAAC;IACrG,eAAO,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC;IACrB,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAPS,QAAA,OAAO,WAOhB"}
@@ -1,12 +0,0 @@
1
- import { getBuiltinModule } from "./getBuiltinModule.mjs";
2
- export let getFile = function lazyGetFile() {
3
- if (getFile !== lazyGetFile)
4
- return getFile();
5
- // We can drop getBuiltinModule once we no longer support Node < 20.0.0
6
- const File = globalThis.File ?? getBuiltinModule?.('node:buffer')?.File;
7
- if (!File)
8
- throw new Error('`File` is not defined as a global, which is required for file uploads.');
9
- getFile = () => File;
10
- return File;
11
- };
12
- //# sourceMappingURL=file.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file.mjs","sourceRoot":"","sources":["../../src/internal/shims/file.ts"],"names":[],"mappings":"OAAO,EAAE,gBAAgB,EAAE;AAE3B,MAAM,CAAC,IAAI,OAAO,GAAG,SAAS,WAAW;IACvC,IAAI,OAAO,KAAK,WAAW;QAAE,OAAO,OAAO,EAAE,CAAC;IAC9C,uEAAuE;IACvE,MAAM,IAAI,GAAI,UAAkB,CAAC,IAAI,IAAK,gBAAgB,EAAE,CAAC,aAAa,CAAS,EAAE,IAAI,CAAC;IAC1F,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,wEAAwE,CAAC,CAAC;IACrG,OAAO,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC;IACrB,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
@@ -1,11 +0,0 @@
1
- /**
2
- * Load a Node built-in module. ID may or may not be prefixed by `node:` and
3
- * will be normalized. If we used static imports then our bundle size would be bloated by
4
- * injected polyfills, and if we used dynamic require then in addition to bundlers logging warnings,
5
- * our code would not work when bundled to ESM and run in Node 18.
6
- * @param {string} id ID of the built-in to be loaded.
7
- * @returns {object|undefined} exports of the built-in. Undefined if the built-in
8
- * does not exist.
9
- */
10
- export declare let getBuiltinModule: null | ((id: string) => object | undefined);
11
- //# sourceMappingURL=getBuiltinModule.d.mts.map