@nirvana-labs/nirvana 0.9.1 → 0.10.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 +9 -6
- package/README.md +108 -50
- package/api-promise.d.mts +2 -0
- package/api-promise.d.mts.map +1 -0
- package/api-promise.d.ts +2 -0
- package/api-promise.d.ts.map +1 -0
- package/{_shims/auto/runtime.js → api-promise.js} +3 -5
- package/api-promise.js.map +1 -0
- package/api-promise.mjs +2 -0
- package/api-promise.mjs.map +1 -0
- package/client.d.mts +189 -0
- package/client.d.mts.map +1 -0
- package/client.d.ts +189 -0
- package/client.d.ts.map +1 -0
- package/client.js +481 -0
- package/client.js.map +1 -0
- package/client.mjs +454 -0
- package/client.mjs.map +1 -0
- package/core/api-promise.d.mts +47 -0
- package/core/api-promise.d.mts.map +1 -0
- package/core/api-promise.d.ts +47 -0
- package/core/api-promise.d.ts.map +1 -0
- package/core/api-promise.js +84 -0
- package/core/api-promise.js.map +1 -0
- package/core/api-promise.mjs +80 -0
- package/core/api-promise.mjs.map +1 -0
- package/core/error.d.mts +47 -0
- package/core/error.d.mts.map +1 -0
- package/core/error.d.ts +47 -0
- package/core/error.d.ts.map +1 -0
- package/core/error.js +113 -0
- package/core/error.js.map +1 -0
- package/core/error.mjs +97 -0
- package/core/error.mjs.map +1 -0
- package/core/resource.d.mts +6 -0
- package/core/resource.d.mts.map +1 -0
- package/core/resource.d.ts +6 -0
- package/core/resource.d.ts.map +1 -0
- package/core/resource.js +11 -0
- package/core/resource.js.map +1 -0
- package/core/resource.mjs +7 -0
- package/core/resource.mjs.map +1 -0
- package/core/uploads.d.mts +3 -0
- package/core/uploads.d.mts.map +1 -0
- package/core/uploads.d.ts +3 -0
- package/core/uploads.d.ts.map +1 -0
- package/core/uploads.js +6 -0
- package/core/uploads.js.map +1 -0
- package/core/uploads.mjs +2 -0
- package/core/uploads.mjs.map +1 -0
- package/error.d.mts +2 -0
- package/error.d.mts.map +1 -0
- package/error.d.ts +1 -46
- package/error.d.ts.map +1 -1
- package/error.js +16 -110
- package/error.js.map +1 -1
- package/error.mjs +1 -96
- package/error.mjs.map +1 -1
- package/index.d.mts +6 -124
- package/index.d.mts.map +1 -0
- package/index.d.ts +5 -123
- package/index.d.ts.map +1 -1
- package/index.js +12 -116
- package/index.js.map +1 -1
- package/index.mjs +5 -89
- package/index.mjs.map +1 -1
- package/internal/builtin-types.d.mts +75 -0
- package/internal/builtin-types.d.mts.map +1 -0
- package/internal/builtin-types.d.ts +75 -0
- package/internal/builtin-types.d.ts.map +1 -0
- package/internal/builtin-types.js +4 -0
- package/internal/builtin-types.js.map +1 -0
- package/internal/builtin-types.mjs +3 -0
- package/internal/builtin-types.mjs.map +1 -0
- package/internal/detect-platform.d.mts +15 -0
- package/internal/detect-platform.d.mts.map +1 -0
- package/internal/detect-platform.d.ts +15 -0
- package/internal/detect-platform.d.ts.map +1 -0
- package/internal/detect-platform.js +162 -0
- package/internal/detect-platform.js.map +1 -0
- package/internal/detect-platform.mjs +157 -0
- package/internal/detect-platform.mjs.map +1 -0
- package/internal/errors.d.mts +3 -0
- package/internal/errors.d.mts.map +1 -0
- package/internal/errors.d.ts +3 -0
- package/internal/errors.d.ts.map +1 -0
- package/internal/errors.js +41 -0
- package/internal/errors.js.map +1 -0
- package/internal/errors.mjs +36 -0
- package/internal/errors.mjs.map +1 -0
- package/internal/headers.d.mts +21 -0
- package/internal/headers.d.mts.map +1 -0
- package/internal/headers.d.ts +21 -0
- package/internal/headers.d.ts.map +1 -0
- package/internal/headers.js +77 -0
- package/internal/headers.js.map +1 -0
- package/internal/headers.mjs +72 -0
- package/internal/headers.mjs.map +1 -0
- package/internal/parse.d.mts +13 -0
- package/internal/parse.d.mts.map +1 -0
- package/internal/parse.d.ts +13 -0
- package/internal/parse.d.ts.map +1 -0
- package/internal/parse.js +36 -0
- package/internal/parse.js.map +1 -0
- package/internal/parse.mjs +32 -0
- package/internal/parse.mjs.map +1 -0
- package/internal/request-options.d.mts +33 -0
- package/internal/request-options.d.mts.map +1 -0
- package/internal/request-options.d.ts +33 -0
- package/internal/request-options.d.ts.map +1 -0
- package/internal/request-options.js +14 -0
- package/internal/request-options.js.map +1 -0
- package/internal/request-options.mjs +10 -0
- package/internal/request-options.mjs.map +1 -0
- package/internal/shim-types.d.mts +28 -0
- package/internal/shim-types.d.ts +28 -0
- package/internal/shims/crypto.d.mts +13 -0
- package/internal/shims/crypto.d.mts.map +1 -0
- package/internal/shims/crypto.d.ts +13 -0
- package/internal/shims/crypto.d.ts.map +1 -0
- package/internal/shims/crypto.js +13 -0
- package/internal/shims/crypto.js.map +1 -0
- package/internal/shims/crypto.mjs +9 -0
- package/internal/shims/crypto.mjs.map +1 -0
- package/internal/shims/file.d.mts +23 -0
- package/internal/shims/file.d.mts.map +1 -0
- package/internal/shims/file.d.ts +23 -0
- package/internal/shims/file.d.ts.map +1 -0
- package/internal/shims/file.js +16 -0
- package/internal/shims/file.js.map +1 -0
- package/internal/shims/file.mjs +12 -0
- package/internal/shims/file.mjs.map +1 -0
- package/internal/shims/getBuiltinModule.d.mts +11 -0
- package/internal/shims/getBuiltinModule.d.mts.map +1 -0
- package/internal/shims/getBuiltinModule.d.ts +11 -0
- package/internal/shims/getBuiltinModule.d.ts.map +1 -0
- package/internal/shims/getBuiltinModule.js +71 -0
- package/internal/shims/getBuiltinModule.js.map +1 -0
- package/internal/shims/getBuiltinModule.mjs +67 -0
- package/internal/shims/getBuiltinModule.mjs.map +1 -0
- package/internal/shims/nullGetBuiltinModule.d.mts +2 -0
- package/internal/shims/nullGetBuiltinModule.d.mts.map +1 -0
- package/internal/shims/nullGetBuiltinModule.d.ts +2 -0
- package/internal/shims/nullGetBuiltinModule.d.ts.map +1 -0
- package/internal/shims/nullGetBuiltinModule.js +5 -0
- package/internal/shims/nullGetBuiltinModule.js.map +1 -0
- package/internal/shims/nullGetBuiltinModule.mjs +2 -0
- package/internal/shims/nullGetBuiltinModule.mjs.map +1 -0
- package/internal/shims.d.mts +20 -0
- package/internal/shims.d.mts.map +1 -0
- package/internal/shims.d.ts +20 -0
- package/internal/shims.d.ts.map +1 -0
- package/internal/shims.js +93 -0
- package/internal/shims.js.map +1 -0
- package/internal/shims.mjs +85 -0
- package/internal/shims.mjs.map +1 -0
- package/internal/to-file.d.mts +46 -0
- package/internal/to-file.d.mts.map +1 -0
- package/internal/to-file.d.ts +46 -0
- package/internal/to-file.d.ts.map +1 -0
- package/internal/to-file.js +91 -0
- package/internal/to-file.js.map +1 -0
- package/internal/to-file.mjs +87 -0
- package/internal/to-file.mjs.map +1 -0
- package/internal/types.d.mts +68 -0
- package/internal/types.d.mts.map +1 -0
- package/internal/types.d.ts +68 -0
- package/internal/types.d.ts.map +1 -0
- package/internal/types.js +4 -0
- package/internal/types.js.map +1 -0
- package/internal/types.mjs +3 -0
- package/internal/types.mjs.map +1 -0
- package/internal/uploads.d.mts +44 -0
- package/internal/uploads.d.mts.map +1 -0
- package/internal/uploads.d.ts +44 -0
- package/internal/uploads.d.ts.map +1 -0
- package/internal/uploads.js +131 -0
- package/internal/uploads.js.map +1 -0
- package/internal/uploads.mjs +122 -0
- package/internal/uploads.mjs.map +1 -0
- package/internal/utils/base64.d.mts +3 -0
- package/internal/utils/base64.d.mts.map +1 -0
- package/internal/utils/base64.d.ts +3 -0
- package/internal/utils/base64.d.ts.map +1 -0
- package/internal/utils/base64.js +33 -0
- package/internal/utils/base64.js.map +1 -0
- package/internal/utils/base64.mjs +28 -0
- package/internal/utils/base64.mjs.map +1 -0
- package/internal/utils/env.d.mts +9 -0
- package/internal/utils/env.d.mts.map +1 -0
- package/internal/utils/env.d.ts +9 -0
- package/internal/utils/env.d.ts.map +1 -0
- package/internal/utils/env.js +22 -0
- package/internal/utils/env.js.map +1 -0
- package/internal/utils/env.mjs +18 -0
- package/internal/utils/env.mjs.map +1 -0
- package/internal/utils/log.d.mts +38 -0
- package/internal/utils/log.d.mts.map +1 -0
- package/internal/utils/log.d.ts +38 -0
- package/internal/utils/log.d.ts.map +1 -0
- package/internal/utils/log.js +85 -0
- package/internal/utils/log.js.map +1 -0
- package/internal/utils/log.mjs +79 -0
- package/internal/utils/log.mjs.map +1 -0
- package/internal/utils/path.d.mts +15 -0
- package/internal/utils/path.d.mts.map +1 -0
- package/internal/utils/path.d.ts +15 -0
- package/internal/utils/path.d.ts.map +1 -0
- package/internal/utils/path.js +58 -0
- package/internal/utils/path.js.map +1 -0
- package/internal/utils/path.mjs +53 -0
- package/internal/utils/path.mjs.map +1 -0
- package/internal/utils/sleep.d.mts +2 -0
- package/internal/utils/sleep.d.mts.map +1 -0
- package/internal/utils/sleep.d.ts +2 -0
- package/internal/utils/sleep.d.ts.map +1 -0
- package/internal/utils/sleep.js +7 -0
- package/internal/utils/sleep.js.map +1 -0
- package/internal/utils/sleep.mjs +3 -0
- package/internal/utils/sleep.mjs.map +1 -0
- package/internal/utils/uuid.d.mts +5 -0
- package/internal/utils/uuid.d.mts.map +1 -0
- package/internal/utils/uuid.d.ts +5 -0
- package/internal/utils/uuid.d.ts.map +1 -0
- package/internal/utils/uuid.js +20 -0
- package/internal/utils/uuid.js.map +1 -0
- package/internal/utils/uuid.mjs +16 -0
- package/internal/utils/uuid.mjs.map +1 -0
- package/internal/utils/values.d.mts +16 -0
- package/internal/utils/values.d.mts.map +1 -0
- package/internal/utils/values.d.ts +16 -0
- package/internal/utils/values.d.ts.map +1 -0
- package/internal/utils/values.js +109 -0
- package/internal/utils/values.js.map +1 -0
- package/internal/utils/values.mjs +92 -0
- package/internal/utils/values.mjs.map +1 -0
- package/internal/utils.d.mts +7 -0
- package/internal/utils.d.mts.map +1 -0
- package/internal/utils.d.ts +7 -0
- package/internal/utils.d.ts.map +1 -0
- package/{_shims/auto/runtime-bun.js → internal/utils.js} +8 -5
- package/internal/utils.js.map +1 -0
- package/internal/utils.mjs +8 -0
- package/internal/utils.mjs.map +1 -0
- package/package.json +106 -63
- package/resource.d.mts +2 -0
- package/resource.d.mts.map +1 -0
- package/resource.d.ts +1 -5
- package/resource.d.ts.map +1 -1
- package/resource.js +16 -8
- package/resource.js.map +1 -1
- package/resource.mjs +1 -6
- package/resource.mjs.map +1 -1
- package/resources/api-keys.d.mts +93 -0
- package/resources/api-keys.d.mts.map +1 -0
- package/resources/api-keys.d.ts +8 -7
- package/resources/api-keys.d.ts.map +1 -1
- package/resources/api-keys.js +10 -8
- package/resources/api-keys.js.map +1 -1
- package/resources/api-keys.mjs +10 -8
- package/resources/api-keys.mjs.map +1 -1
- package/resources/compute/compute.d.mts +14 -0
- package/resources/compute/compute.d.mts.map +1 -0
- package/resources/compute/compute.d.ts +1 -1
- package/resources/compute/compute.d.ts.map +1 -1
- package/resources/compute/compute.js +1 -1
- package/resources/compute/compute.js.map +1 -1
- package/resources/compute/compute.mjs +1 -1
- package/resources/compute/index.d.mts +4 -0
- package/resources/compute/index.d.mts.map +1 -0
- package/resources/compute/index.d.ts.map +1 -1
- package/resources/compute/vms/index.d.mts +4 -0
- package/resources/compute/vms/index.d.mts.map +1 -0
- package/resources/compute/vms/index.d.ts.map +1 -1
- package/resources/compute/vms/os-images.d.mts +15 -0
- package/resources/compute/vms/os-images.d.mts.map +1 -0
- package/resources/compute/vms/os-images.d.ts +4 -3
- package/resources/compute/vms/os-images.d.ts.map +1 -1
- package/resources/compute/vms/os-images.js +1 -1
- package/resources/compute/vms/os-images.js.map +1 -1
- package/resources/compute/vms/os-images.mjs +1 -1
- package/resources/compute/vms/os-images.mjs.map +1 -1
- package/resources/compute/vms/vms.d.mts +148 -0
- package/resources/compute/vms/vms.d.mts.map +1 -0
- package/resources/compute/vms/vms.d.ts +8 -7
- package/resources/compute/vms/vms.d.ts.map +1 -1
- package/resources/compute/vms/vms.js +8 -7
- package/resources/compute/vms/vms.js.map +1 -1
- package/resources/compute/vms/vms.mjs +8 -7
- package/resources/compute/vms/vms.mjs.map +1 -1
- package/resources/compute/vms/volumes.d.mts +11 -0
- package/resources/compute/vms/volumes.d.mts.map +1 -0
- package/resources/compute/vms/volumes.d.ts +4 -3
- package/resources/compute/vms/volumes.d.ts.map +1 -1
- package/resources/compute/vms/volumes.js +4 -3
- package/resources/compute/vms/volumes.js.map +1 -1
- package/resources/compute/vms/volumes.mjs +4 -3
- package/resources/compute/vms/volumes.mjs.map +1 -1
- package/resources/compute/vms.d.mts +2 -0
- package/resources/compute/vms.d.mts.map +1 -0
- package/resources/compute/vms.d.ts.map +1 -1
- package/resources/compute/volumes.d.mts +72 -0
- package/resources/compute/volumes.d.mts.map +1 -0
- package/resources/compute/volumes.d.ts +8 -7
- package/resources/compute/volumes.d.ts.map +1 -1
- package/resources/compute/volumes.js +8 -7
- package/resources/compute/volumes.js.map +1 -1
- package/resources/compute/volumes.mjs +8 -7
- package/resources/compute/volumes.mjs.map +1 -1
- package/resources/compute.d.mts +2 -0
- package/resources/compute.d.mts.map +1 -0
- package/resources/compute.d.ts.map +1 -1
- package/resources/index.d.mts +7 -0
- package/resources/index.d.mts.map +1 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/networking/firewall-rules.d.mts +100 -0
- package/resources/networking/firewall-rules.d.mts.map +1 -0
- package/resources/networking/firewall-rules.d.ts +38 -9
- package/resources/networking/firewall-rules.d.ts.map +1 -1
- package/resources/networking/firewall-rules.js +15 -11
- package/resources/networking/firewall-rules.js.map +1 -1
- package/resources/networking/firewall-rules.mjs +15 -11
- package/resources/networking/firewall-rules.mjs.map +1 -1
- package/resources/networking/index.d.mts +4 -0
- package/resources/networking/index.d.mts.map +1 -0
- package/resources/networking/index.d.ts +1 -1
- package/resources/networking/index.d.ts.map +1 -1
- package/resources/networking/index.js.map +1 -1
- package/resources/networking/index.mjs.map +1 -1
- package/resources/networking/networking.d.mts +14 -0
- package/resources/networking/networking.d.mts.map +1 -0
- package/resources/networking/networking.d.ts +3 -3
- package/resources/networking/networking.d.ts.map +1 -1
- package/resources/networking/networking.js +1 -1
- package/resources/networking/networking.js.map +1 -1
- package/resources/networking/networking.mjs +1 -1
- package/resources/networking/networking.mjs.map +1 -1
- package/resources/networking/vpcs.d.mts +69 -0
- package/resources/networking/vpcs.d.mts.map +1 -0
- package/resources/networking/vpcs.d.ts +8 -7
- package/resources/networking/vpcs.d.ts.map +1 -1
- package/resources/networking/vpcs.js +8 -7
- package/resources/networking/vpcs.js.map +1 -1
- package/resources/networking/vpcs.mjs +8 -7
- package/resources/networking/vpcs.mjs.map +1 -1
- package/resources/networking.d.mts +2 -0
- package/resources/networking.d.mts.map +1 -0
- package/resources/networking.d.ts.map +1 -1
- package/resources/operations.d.mts +35 -0
- package/resources/operations.d.mts.map +1 -0
- package/resources/operations.d.ts +5 -4
- package/resources/operations.d.ts.map +1 -1
- package/resources/operations.js +4 -3
- package/resources/operations.js.map +1 -1
- package/resources/operations.mjs +4 -3
- package/resources/operations.mjs.map +1 -1
- package/resources/shared.d.mts +3 -0
- package/resources/shared.d.mts.map +1 -0
- package/resources/user.d.mts +23 -0
- package/resources/user.d.mts.map +1 -0
- package/resources/user.d.ts +4 -3
- package/resources/user.d.ts.map +1 -1
- package/resources/user.js +1 -1
- package/resources/user.js.map +1 -1
- package/resources/user.mjs +1 -1
- package/resources/user.mjs.map +1 -1
- package/resources.d.mts +2 -0
- package/resources.d.mts.map +1 -0
- package/resources.d.ts.map +1 -1
- package/src/api-promise.ts +2 -0
- package/src/client.ts +707 -0
- package/src/core/README.md +3 -0
- package/src/core/api-promise.ts +92 -0
- package/src/core/error.ts +130 -0
- package/src/core/resource.ts +11 -0
- package/src/core/uploads.ts +2 -0
- package/src/error.ts +2 -130
- package/src/index.ts +5 -191
- package/src/internal/README.md +3 -0
- package/src/internal/builtin-types.ts +93 -0
- package/src/internal/detect-platform.ts +196 -0
- package/src/internal/errors.ts +33 -0
- package/src/internal/headers.ts +96 -0
- package/src/internal/parse.ts +50 -0
- package/src/internal/request-options.ts +37 -0
- package/src/internal/shim-types.d.ts +28 -0
- package/src/internal/shims/crypto.ts +18 -0
- package/src/internal/shims/file.ts +32 -0
- package/src/internal/shims/getBuiltinModule.ts +66 -0
- package/src/internal/shims/nullGetBuiltinModule.ts +1 -0
- package/src/internal/shims.ts +107 -0
- package/src/internal/to-file.ts +152 -0
- package/src/internal/types.ts +92 -0
- package/src/internal/uploads.ts +175 -0
- package/src/internal/utils/base64.ts +37 -0
- package/src/internal/utils/env.ts +18 -0
- package/src/internal/utils/log.ts +126 -0
- package/src/internal/utils/path.ts +65 -0
- package/src/internal/utils/sleep.ts +3 -0
- package/src/internal/utils/uuid.ts +19 -0
- package/src/internal/utils/values.ts +102 -0
- package/src/internal/utils.ts +8 -0
- package/src/resource.ts +2 -11
- package/src/resources/api-keys.ts +14 -11
- package/src/resources/compute/compute.ts +1 -1
- package/src/resources/compute/vms/os-images.ts +4 -3
- package/src/resources/compute/vms/vms.ts +12 -14
- package/src/resources/compute/vms/volumes.ts +6 -4
- package/src/resources/compute/volumes.ts +14 -12
- package/src/resources/networking/firewall-rules.ts +63 -22
- package/src/resources/networking/index.ts +2 -0
- package/src/resources/networking/networking.ts +5 -1
- package/src/resources/networking/vpcs.ts +14 -12
- package/src/resources/operations.ts +7 -5
- package/src/resources/user.ts +4 -3
- package/src/tsconfig.json +2 -2
- package/src/uploads.ts +2 -255
- package/src/version.ts +1 -1
- package/uploads.d.mts +2 -0
- package/uploads.d.mts.map +1 -0
- package/uploads.d.ts +1 -74
- package/uploads.d.ts.map +1 -1
- package/uploads.js +16 -168
- package/uploads.js.map +1 -1
- package/uploads.mjs +1 -157
- package/uploads.mjs.map +1 -1
- package/version.d.mts +2 -0
- package/version.d.mts.map +1 -0
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
- package/_shims/MultipartBody.d.ts +0 -9
- package/_shims/MultipartBody.d.ts.map +0 -1
- package/_shims/MultipartBody.js +0 -16
- package/_shims/MultipartBody.js.map +0 -1
- package/_shims/MultipartBody.mjs +0 -12
- package/_shims/MultipartBody.mjs.map +0 -1
- package/_shims/README.md +0 -46
- package/_shims/auto/runtime-bun.d.ts +0 -5
- package/_shims/auto/runtime-bun.d.ts.map +0 -1
- package/_shims/auto/runtime-bun.js.map +0 -1
- package/_shims/auto/runtime-bun.mjs +0 -2
- package/_shims/auto/runtime-bun.mjs.map +0 -1
- package/_shims/auto/runtime-node.d.ts +0 -5
- package/_shims/auto/runtime-node.d.ts.map +0 -1
- package/_shims/auto/runtime-node.js +0 -21
- package/_shims/auto/runtime-node.js.map +0 -1
- package/_shims/auto/runtime-node.mjs +0 -2
- package/_shims/auto/runtime-node.mjs.map +0 -1
- package/_shims/auto/runtime.d.ts +0 -5
- package/_shims/auto/runtime.d.ts.map +0 -1
- package/_shims/auto/runtime.js.map +0 -1
- package/_shims/auto/runtime.mjs +0 -2
- package/_shims/auto/runtime.mjs.map +0 -1
- package/_shims/auto/types-node.d.ts +0 -5
- package/_shims/auto/types-node.d.ts.map +0 -1
- package/_shims/auto/types-node.js +0 -21
- package/_shims/auto/types-node.js.map +0 -1
- package/_shims/auto/types-node.mjs +0 -2
- package/_shims/auto/types-node.mjs.map +0 -1
- package/_shims/auto/types.d.ts +0 -101
- package/_shims/auto/types.js +0 -3
- package/_shims/auto/types.mjs +0 -3
- package/_shims/bun-runtime.d.ts +0 -6
- package/_shims/bun-runtime.d.ts.map +0 -1
- package/_shims/bun-runtime.js +0 -14
- package/_shims/bun-runtime.js.map +0 -1
- package/_shims/bun-runtime.mjs +0 -10
- package/_shims/bun-runtime.mjs.map +0 -1
- package/_shims/index.d.ts +0 -83
- package/_shims/index.js +0 -17
- package/_shims/index.mjs +0 -11
- package/_shims/manual-types.d.ts +0 -12
- package/_shims/manual-types.js +0 -3
- package/_shims/manual-types.mjs +0 -3
- package/_shims/node-runtime.d.ts +0 -3
- package/_shims/node-runtime.d.ts.map +0 -1
- package/_shims/node-runtime.js +0 -89
- package/_shims/node-runtime.js.map +0 -1
- package/_shims/node-runtime.mjs +0 -56
- package/_shims/node-runtime.mjs.map +0 -1
- package/_shims/node-types.d.ts +0 -42
- package/_shims/node-types.js +0 -3
- package/_shims/node-types.mjs +0 -3
- package/_shims/registry.d.ts +0 -37
- package/_shims/registry.d.ts.map +0 -1
- package/_shims/registry.js +0 -41
- package/_shims/registry.js.map +0 -1
- package/_shims/registry.mjs +0 -37
- package/_shims/registry.mjs.map +0 -1
- package/_shims/web-runtime.d.ts +0 -5
- package/_shims/web-runtime.d.ts.map +0 -1
- package/_shims/web-runtime.js +0 -78
- package/_shims/web-runtime.js.map +0 -1
- package/_shims/web-runtime.mjs +0 -71
- package/_shims/web-runtime.mjs.map +0 -1
- package/_shims/web-types.d.ts +0 -83
- package/_shims/web-types.js +0 -3
- package/_shims/web-types.mjs +0 -3
- package/core.d.ts +0 -252
- package/core.d.ts.map +0 -1
- package/core.js +0 -917
- package/core.js.map +0 -1
- package/core.mjs +0 -885
- package/core.mjs.map +0 -1
- package/shims/node.d.ts +0 -30
- package/shims/node.d.ts.map +0 -1
- package/shims/node.js +0 -31
- package/shims/node.js.map +0 -1
- package/shims/node.mjs +0 -5
- package/shims/node.mjs.map +0 -1
- package/shims/web.d.ts +0 -26
- package/shims/web.d.ts.map +0 -1
- package/shims/web.js +0 -31
- package/shims/web.js.map +0 -1
- package/shims/web.mjs +0 -5
- package/shims/web.mjs.map +0 -1
- package/src/_shims/MultipartBody.ts +0 -9
- package/src/_shims/README.md +0 -46
- package/src/_shims/auto/runtime-bun.ts +0 -4
- package/src/_shims/auto/runtime-node.ts +0 -4
- package/src/_shims/auto/runtime.ts +0 -4
- package/src/_shims/auto/types-node.ts +0 -4
- package/src/_shims/auto/types.d.ts +0 -101
- package/src/_shims/auto/types.js +0 -3
- package/src/_shims/auto/types.mjs +0 -3
- package/src/_shims/bun-runtime.ts +0 -14
- package/src/_shims/index.d.ts +0 -83
- package/src/_shims/index.js +0 -17
- package/src/_shims/index.mjs +0 -11
- package/src/_shims/manual-types.d.ts +0 -12
- package/src/_shims/manual-types.js +0 -3
- package/src/_shims/manual-types.mjs +0 -3
- package/src/_shims/node-runtime.ts +0 -81
- package/src/_shims/node-types.d.ts +0 -42
- package/src/_shims/node-types.js +0 -3
- package/src/_shims/node-types.mjs +0 -3
- package/src/_shims/registry.ts +0 -67
- package/src/_shims/web-runtime.ts +0 -103
- package/src/_shims/web-types.d.ts +0 -83
- package/src/_shims/web-types.js +0 -3
- package/src/_shims/web-types.mjs +0 -3
- package/src/core.ts +0 -1228
- package/src/shims/node.ts +0 -50
- package/src/shims/web.ts +0 -50
package/CHANGELOG.md
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 0.
|
|
3
|
+
## 0.10.0 (2025-04-10)
|
|
4
4
|
|
|
5
|
-
Full Changelog: [v0.9.0...v0.
|
|
5
|
+
Full Changelog: [v0.9.0...v0.10.0](https://github.com/nirvana-labs/nirvana-node/compare/v0.9.0...v0.10.0)
|
|
6
6
|
|
|
7
7
|
### Features
|
|
8
8
|
|
|
9
|
-
* **api:** manual updates ([
|
|
9
|
+
* **api:** manual updates ([37ee232](https://github.com/nirvana-labs/nirvana-node/commit/37ee232299a68a3dd35db28c8f016a0b8bb1a5bb))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* **internal:** fix file uploads in node 18 jest ([2fc416c](https://github.com/nirvana-labs/nirvana-node/commit/2fc416c802dca97475fd49c296da3f0ecf1931f6))
|
|
10
15
|
|
|
11
16
|
|
|
12
17
|
### Chores
|
|
13
18
|
|
|
14
|
-
*
|
|
15
|
-
* **internal:** reduce CI branch coverage ([e1149e1](https://github.com/nirvana-labs/nirvana-node/commit/e1149e116790ad16e3f65a9bb6d9f2c31d76d191))
|
|
16
|
-
* **internal:** upload builds and expand CI branch coverage ([7eeca03](https://github.com/nirvana-labs/nirvana-node/commit/7eeca03cd5dd222deaa92878140e38bec43e8785))
|
|
19
|
+
* sync repo ([f37723d](https://github.com/nirvana-labs/nirvana-node/commit/f37723de0281cc36270ded10a080f279e5cd8e5e))
|
|
17
20
|
|
|
18
21
|
## 0.9.0 (2025-04-10)
|
|
19
22
|
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Nirvana Labs
|
|
1
|
+
# Nirvana Labs TypeScript API Library
|
|
2
2
|
|
|
3
3
|
[](https://npmjs.org/package/@nirvana-labs/nirvana) 
|
|
4
4
|
|
|
@@ -179,8 +179,10 @@ Note that requests which time out will be [retried twice by default](#retries).
|
|
|
179
179
|
### Accessing raw Response data (e.g., headers)
|
|
180
180
|
|
|
181
181
|
The "raw" `Response` returned by `fetch()` can be accessed through the `.asResponse()` method on the `APIPromise` type that all methods return.
|
|
182
|
+
This method returns as soon as the headers for a successful response are received and does not consume the response body, so you are free to write custom parsing or streaming logic.
|
|
182
183
|
|
|
183
184
|
You can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.
|
|
185
|
+
Unlike `.asResponse()` this method consumes the body, returning once it is parsed.
|
|
184
186
|
|
|
185
187
|
<!-- prettier-ignore -->
|
|
186
188
|
```ts
|
|
@@ -225,6 +227,59 @@ console.log(raw.headers.get('X-My-Header'));
|
|
|
225
227
|
console.log(operation.id);
|
|
226
228
|
```
|
|
227
229
|
|
|
230
|
+
### Logging
|
|
231
|
+
|
|
232
|
+
> [!IMPORTANT]
|
|
233
|
+
> All log messages are intended for debugging only. The format and content of log messages
|
|
234
|
+
> may change between releases.
|
|
235
|
+
|
|
236
|
+
#### Log levels
|
|
237
|
+
|
|
238
|
+
The log level can be configured in two ways:
|
|
239
|
+
|
|
240
|
+
1. Via the `NIRVANA_LABS_LOG` environment variable
|
|
241
|
+
2. Using the `logLevel` client option (overrides the environment variable if set)
|
|
242
|
+
|
|
243
|
+
```ts
|
|
244
|
+
import NirvanaLabs from '@nirvana-labs/nirvana';
|
|
245
|
+
|
|
246
|
+
const client = new NirvanaLabs({
|
|
247
|
+
logLevel: 'debug', // Show all log messages
|
|
248
|
+
});
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Available log levels, from most to least verbose:
|
|
252
|
+
|
|
253
|
+
- `'debug'` - Show debug messages, info, warnings, and errors
|
|
254
|
+
- `'info'` - Show info messages, warnings, and errors
|
|
255
|
+
- `'warn'` - Show warnings and errors (default)
|
|
256
|
+
- `'error'` - Show only errors
|
|
257
|
+
- `'off'` - Disable all logging
|
|
258
|
+
|
|
259
|
+
At the `'debug'` level, all HTTP requests and responses are logged, including headers and bodies.
|
|
260
|
+
Some authentication-related headers are redacted, but sensitive data in request and response bodies
|
|
261
|
+
may still be visible.
|
|
262
|
+
|
|
263
|
+
#### Custom logger
|
|
264
|
+
|
|
265
|
+
By default, this library logs to `globalThis.console`. You can also provide a custom logger.
|
|
266
|
+
Most logging libraries are supported, including [pino](https://www.npmjs.com/package/pino), [winston](https://www.npmjs.com/package/winston), [bunyan](https://www.npmjs.com/package/bunyan), [consola](https://www.npmjs.com/package/consola), [signale](https://www.npmjs.com/package/signale), and [@std/log](https://jsr.io/@std/log). If your logger doesn't work, please open an issue.
|
|
267
|
+
|
|
268
|
+
When providing a custom logger, the `logLevel` option still controls which messages are emitted, messages
|
|
269
|
+
below the configured level will not be sent to your logger.
|
|
270
|
+
|
|
271
|
+
```ts
|
|
272
|
+
import NirvanaLabs from '@nirvana-labs/nirvana';
|
|
273
|
+
import pino from 'pino';
|
|
274
|
+
|
|
275
|
+
const logger = pino();
|
|
276
|
+
|
|
277
|
+
const client = new NirvanaLabs({
|
|
278
|
+
logger: logger.child({ name: 'NirvanaLabs' }),
|
|
279
|
+
logLevel: 'debug', // Send all messages to pino, allowing it to filter
|
|
280
|
+
});
|
|
281
|
+
```
|
|
282
|
+
|
|
228
283
|
### Making custom/undocumented requests
|
|
229
284
|
|
|
230
285
|
This library is typed for convenient access to the documented API. If you need to access undocumented
|
|
@@ -271,82 +326,85 @@ validate or strip extra properties from the response from the API.
|
|
|
271
326
|
|
|
272
327
|
### Customizing the fetch client
|
|
273
328
|
|
|
274
|
-
By default, this library
|
|
329
|
+
By default, this library expects a global `fetch` function is defined.
|
|
275
330
|
|
|
276
|
-
If you
|
|
277
|
-
(for example, if you are running Node with `--experimental-fetch` or using NextJS which polyfills with `undici`),
|
|
278
|
-
add the following import before your first import `from "NirvanaLabs"`:
|
|
331
|
+
If you want to use a different `fetch` function, you can either polyfill the global:
|
|
279
332
|
|
|
280
333
|
```ts
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
import NirvanaLabs from '@nirvana-labs/nirvana';
|
|
334
|
+
import fetch from 'my-fetch';
|
|
335
|
+
|
|
336
|
+
globalThis.fetch = fetch;
|
|
285
337
|
```
|
|
286
338
|
|
|
287
|
-
|
|
288
|
-
|
|
339
|
+
Or pass it to the client:
|
|
340
|
+
|
|
341
|
+
```ts
|
|
342
|
+
import NirvanaLabs from '@nirvana-labs/nirvana';
|
|
343
|
+
import fetch from 'my-fetch';
|
|
344
|
+
|
|
345
|
+
const client = new NirvanaLabs({ fetch });
|
|
346
|
+
```
|
|
289
347
|
|
|
290
|
-
###
|
|
348
|
+
### Fetch options
|
|
291
349
|
|
|
292
|
-
|
|
293
|
-
which can be used to inspect or alter the `Request` or `Response` before/after each request:
|
|
350
|
+
If you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)
|
|
294
351
|
|
|
295
352
|
```ts
|
|
296
|
-
import { fetch } from 'undici'; // as one example
|
|
297
353
|
import NirvanaLabs from '@nirvana-labs/nirvana';
|
|
298
354
|
|
|
299
355
|
const client = new NirvanaLabs({
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
const response = await fetch(url, init);
|
|
303
|
-
console.log('Got response', response);
|
|
304
|
-
return response;
|
|
356
|
+
fetchOptions: {
|
|
357
|
+
// `RequestInit` options
|
|
305
358
|
},
|
|
306
359
|
});
|
|
307
360
|
```
|
|
308
361
|
|
|
309
|
-
|
|
310
|
-
This is intended for debugging purposes only and may change in the future without notice.
|
|
362
|
+
#### Configuring proxies
|
|
311
363
|
|
|
312
|
-
|
|
364
|
+
To modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy
|
|
365
|
+
options to requests:
|
|
313
366
|
|
|
314
|
-
|
|
367
|
+
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg" align="top" width="18" height="21"> **Node** <sup>[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]</sup>
|
|
315
368
|
|
|
316
|
-
If you would like to disable or customize this behavior, for example to use the API behind a proxy, you can pass an `httpAgent` which is used for all requests (be they http or https), for example:
|
|
317
|
-
|
|
318
|
-
<!-- prettier-ignore -->
|
|
319
369
|
```ts
|
|
320
|
-
import
|
|
321
|
-
import
|
|
370
|
+
import NirvanaLabs from '@nirvana-labs/nirvana';
|
|
371
|
+
import * as undici from 'undici';
|
|
322
372
|
|
|
323
|
-
|
|
373
|
+
const proxyAgent = new undici.ProxyAgent('http://localhost:8888');
|
|
324
374
|
const client = new NirvanaLabs({
|
|
325
|
-
|
|
375
|
+
fetchOptions: {
|
|
376
|
+
dispatcher: proxyAgent,
|
|
377
|
+
},
|
|
326
378
|
});
|
|
379
|
+
```
|
|
327
380
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
public_ip_enabled: true,
|
|
337
|
-
region: 'us-wdc-1',
|
|
338
|
-
ssh_key: {
|
|
339
|
-
public_key:
|
|
340
|
-
'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDJiJabIUkXw7VrQG+yBohvhEsyoKEYvejZc4RFzV5maybqQei1punVsoe4r6gJttMM1Gr3cNr3OfepikCQAhAchw5ww94ZWqDsDYIqMrlDFbqhGTXDNzFAjeVIKptCOlz9k+7aM69YtLXJ6gFUCq1fbK9PjY+AK28UpMfKYUcyHQ== noname',
|
|
341
|
-
},
|
|
342
|
-
subnet_id: '123e4567-e89b-12d3-a456-426614174000',
|
|
381
|
+
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg" align="top" width="18" height="21"> **Bun** <sup>[[docs](https://bun.sh/guides/http/proxy)]</sup>
|
|
382
|
+
|
|
383
|
+
```ts
|
|
384
|
+
import NirvanaLabs from '@nirvana-labs/nirvana';
|
|
385
|
+
|
|
386
|
+
const client = new NirvanaLabs({
|
|
387
|
+
fetchOptions: {
|
|
388
|
+
proxy: 'http://localhost:8888',
|
|
343
389
|
},
|
|
344
|
-
|
|
345
|
-
|
|
390
|
+
});
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg" align="top" width="18" height="21"> **Deno** <sup>[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]</sup>
|
|
394
|
+
|
|
395
|
+
```ts
|
|
396
|
+
import NirvanaLabs from 'npm:@nirvana-labs/nirvana';
|
|
397
|
+
|
|
398
|
+
const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });
|
|
399
|
+
const client = new NirvanaLabs({
|
|
400
|
+
fetchOptions: {
|
|
401
|
+
client: httpClient,
|
|
346
402
|
},
|
|
347
|
-
);
|
|
403
|
+
});
|
|
348
404
|
```
|
|
349
405
|
|
|
406
|
+
## Frequently Asked Questions
|
|
407
|
+
|
|
350
408
|
## Semantic versioning
|
|
351
409
|
|
|
352
410
|
This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
|
|
@@ -361,7 +419,7 @@ We are keen for your feedback; please open an [issue](https://www.github.com/nir
|
|
|
361
419
|
|
|
362
420
|
## Requirements
|
|
363
421
|
|
|
364
|
-
TypeScript >= 4.
|
|
422
|
+
TypeScript >= 4.9 is supported.
|
|
365
423
|
|
|
366
424
|
The following runtimes are supported:
|
|
367
425
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-promise.d.mts","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":""}
|
package/api-promise.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-promise.d.ts","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":""}
|
|
@@ -14,8 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
__exportStar(require("../web-runtime.js"), exports);
|
|
21
|
-
//# sourceMappingURL=runtime.js.map
|
|
17
|
+
/** @deprecated Import from ./core/api-promise instead */
|
|
18
|
+
__exportStar(require("./core/api-promise.js"), exports);
|
|
19
|
+
//# sourceMappingURL=api-promise.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-promise.js","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAyD;AACzD,wDAAmC"}
|
package/api-promise.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-promise.mjs","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":""}
|
package/client.d.mts
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
|
|
2
|
+
import type { RequestInit, RequestInfo } from "./internal/builtin-types.mjs";
|
|
3
|
+
import type { PromiseOrValue, MergedRequestInit, FinalizedRequestInit } from "./internal/types.mjs";
|
|
4
|
+
import { type Logger, type LogLevel } from "./internal/utils/log.mjs";
|
|
5
|
+
export type { Logger, LogLevel } from "./internal/utils/log.mjs";
|
|
6
|
+
import * as Opts from "./internal/request-options.mjs";
|
|
7
|
+
import * as Errors from "./core/error.mjs";
|
|
8
|
+
import * as Uploads from "./core/uploads.mjs";
|
|
9
|
+
import * as API from "./resources/index.mjs";
|
|
10
|
+
import { APIPromise } from "./core/api-promise.mjs";
|
|
11
|
+
import { type Fetch } from "./internal/builtin-types.mjs";
|
|
12
|
+
import { HeadersLike, NullableHeaders } from "./internal/headers.mjs";
|
|
13
|
+
import { FinalRequestOptions, RequestOptions } from "./internal/request-options.mjs";
|
|
14
|
+
import { APIKeys } from "./resources/api-keys.mjs";
|
|
15
|
+
import { Operations } from "./resources/operations.mjs";
|
|
16
|
+
import { UserResource } from "./resources/user.mjs";
|
|
17
|
+
import { Compute } from "./resources/compute/compute.mjs";
|
|
18
|
+
import { Networking } from "./resources/networking/networking.mjs";
|
|
19
|
+
export interface ClientOptions {
|
|
20
|
+
/**
|
|
21
|
+
* Defaults to process.env['NIRVANA_LABS_API_KEY'].
|
|
22
|
+
*/
|
|
23
|
+
apiKey?: string | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Override the default base URL for the API, e.g., "https://api.example.com/v2/"
|
|
26
|
+
*
|
|
27
|
+
* Defaults to process.env['NIRVANA_LABS_BASE_URL'].
|
|
28
|
+
*/
|
|
29
|
+
baseURL?: string | null | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* The maximum amount of time (in milliseconds) that the client should wait for a response
|
|
32
|
+
* from the server before timing out a single request.
|
|
33
|
+
*
|
|
34
|
+
* Note that request timeouts are retried by default, so in a worst-case scenario you may wait
|
|
35
|
+
* much longer than this timeout before the promise succeeds or fails.
|
|
36
|
+
*/
|
|
37
|
+
timeout?: number | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Additional `RequestInit` options to be passed to `fetch` calls.
|
|
40
|
+
* Properties will be overridden by per-request `fetchOptions`.
|
|
41
|
+
*/
|
|
42
|
+
fetchOptions?: MergedRequestInit | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Specify a custom `fetch` function implementation.
|
|
45
|
+
*
|
|
46
|
+
* If not provided, we expect that `fetch` is defined globally.
|
|
47
|
+
*/
|
|
48
|
+
fetch?: Fetch | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* The maximum number of times that the client will retry a request in case of a
|
|
51
|
+
* temporary failure, like a network error or a 5XX error from the server.
|
|
52
|
+
*
|
|
53
|
+
* @default 2
|
|
54
|
+
*/
|
|
55
|
+
maxRetries?: number | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Default headers to include with every request to the API.
|
|
58
|
+
*
|
|
59
|
+
* These can be removed in individual requests by explicitly setting the
|
|
60
|
+
* header to `null` in request options.
|
|
61
|
+
*/
|
|
62
|
+
defaultHeaders?: HeadersLike | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Default query parameters to include with every request to the API.
|
|
65
|
+
*
|
|
66
|
+
* These can be removed in individual requests by explicitly setting the
|
|
67
|
+
* param to `undefined` in request options.
|
|
68
|
+
*/
|
|
69
|
+
defaultQuery?: Record<string, string | undefined> | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Set the log level.
|
|
72
|
+
*
|
|
73
|
+
* Defaults to process.env['NIRVANA_LABS_LOG'] or 'warn' if it isn't set.
|
|
74
|
+
*/
|
|
75
|
+
logLevel?: LogLevel | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Set the logger.
|
|
78
|
+
*
|
|
79
|
+
* Defaults to globalThis.console.
|
|
80
|
+
*/
|
|
81
|
+
logger?: Logger | undefined;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* API Client for interfacing with the Nirvana Labs API.
|
|
85
|
+
*/
|
|
86
|
+
export declare class NirvanaLabs {
|
|
87
|
+
#private;
|
|
88
|
+
apiKey: string;
|
|
89
|
+
baseURL: string;
|
|
90
|
+
maxRetries: number;
|
|
91
|
+
timeout: number;
|
|
92
|
+
logger: Logger | undefined;
|
|
93
|
+
logLevel: LogLevel | undefined;
|
|
94
|
+
fetchOptions: MergedRequestInit | undefined;
|
|
95
|
+
private fetch;
|
|
96
|
+
protected idempotencyHeader?: string;
|
|
97
|
+
private _options;
|
|
98
|
+
/**
|
|
99
|
+
* API Client for interfacing with the Nirvana Labs API.
|
|
100
|
+
*
|
|
101
|
+
* @param {string | undefined} [opts.apiKey=process.env['NIRVANA_LABS_API_KEY'] ?? undefined]
|
|
102
|
+
* @param {string} [opts.baseURL=process.env['NIRVANA_LABS_BASE_URL'] ?? https://api.nirvanalabs.io/] - Override the default base URL for the API.
|
|
103
|
+
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
104
|
+
* @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
|
|
105
|
+
* @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
106
|
+
* @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
|
|
107
|
+
* @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API.
|
|
108
|
+
* @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
109
|
+
*/
|
|
110
|
+
constructor({ baseURL, apiKey, ...opts }?: ClientOptions);
|
|
111
|
+
protected defaultQuery(): Record<string, string | undefined> | undefined;
|
|
112
|
+
protected validateHeaders({ values, nulls }: NullableHeaders): void;
|
|
113
|
+
protected authHeaders(opts: FinalRequestOptions): NullableHeaders | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* Basic re-implementation of `qs.stringify` for primitive types.
|
|
116
|
+
*/
|
|
117
|
+
protected stringifyQuery(query: Record<string, unknown>): string;
|
|
118
|
+
private getUserAgent;
|
|
119
|
+
protected defaultIdempotencyKey(): string;
|
|
120
|
+
protected makeStatusError(status: number, error: Object, message: string | undefined, headers: Headers): Errors.APIError;
|
|
121
|
+
buildURL(path: string, query: Record<string, unknown> | null | undefined): string;
|
|
122
|
+
/**
|
|
123
|
+
* Used as a callback for mutating the given `FinalRequestOptions` object.
|
|
124
|
+
*/
|
|
125
|
+
protected prepareOptions(options: FinalRequestOptions): Promise<void>;
|
|
126
|
+
/**
|
|
127
|
+
* Used as a callback for mutating the given `RequestInit` object.
|
|
128
|
+
*
|
|
129
|
+
* This is useful for cases where you want to add certain headers based off of
|
|
130
|
+
* the request properties, e.g. `method` or `url`.
|
|
131
|
+
*/
|
|
132
|
+
protected prepareRequest(request: RequestInit, { url, options }: {
|
|
133
|
+
url: string;
|
|
134
|
+
options: FinalRequestOptions;
|
|
135
|
+
}): Promise<void>;
|
|
136
|
+
get<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
|
|
137
|
+
post<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
|
|
138
|
+
patch<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
|
|
139
|
+
put<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
|
|
140
|
+
delete<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
|
|
141
|
+
private methodRequest;
|
|
142
|
+
request<Rsp>(options: PromiseOrValue<FinalRequestOptions>, remainingRetries?: number | null): APIPromise<Rsp>;
|
|
143
|
+
private makeRequest;
|
|
144
|
+
fetchWithTimeout(url: RequestInfo, init: RequestInit | undefined, ms: number, controller: AbortController): Promise<Response>;
|
|
145
|
+
private shouldRetry;
|
|
146
|
+
private retryRequest;
|
|
147
|
+
private calculateDefaultRetryTimeoutMillis;
|
|
148
|
+
buildRequest(options: FinalRequestOptions, { retryCount }?: {
|
|
149
|
+
retryCount?: number;
|
|
150
|
+
}): {
|
|
151
|
+
req: FinalizedRequestInit;
|
|
152
|
+
url: string;
|
|
153
|
+
timeout: number;
|
|
154
|
+
};
|
|
155
|
+
private buildHeaders;
|
|
156
|
+
private buildBody;
|
|
157
|
+
static NirvanaLabs: typeof NirvanaLabs;
|
|
158
|
+
static DEFAULT_TIMEOUT: number;
|
|
159
|
+
static NirvanaLabsError: typeof Errors.NirvanaLabsError;
|
|
160
|
+
static APIError: typeof Errors.APIError;
|
|
161
|
+
static APIConnectionError: typeof Errors.APIConnectionError;
|
|
162
|
+
static APIConnectionTimeoutError: typeof Errors.APIConnectionTimeoutError;
|
|
163
|
+
static APIUserAbortError: typeof Errors.APIUserAbortError;
|
|
164
|
+
static NotFoundError: typeof Errors.NotFoundError;
|
|
165
|
+
static ConflictError: typeof Errors.ConflictError;
|
|
166
|
+
static RateLimitError: typeof Errors.RateLimitError;
|
|
167
|
+
static BadRequestError: typeof Errors.BadRequestError;
|
|
168
|
+
static AuthenticationError: typeof Errors.AuthenticationError;
|
|
169
|
+
static InternalServerError: typeof Errors.InternalServerError;
|
|
170
|
+
static PermissionDeniedError: typeof Errors.PermissionDeniedError;
|
|
171
|
+
static UnprocessableEntityError: typeof Errors.UnprocessableEntityError;
|
|
172
|
+
static toFile: typeof Uploads.toFile;
|
|
173
|
+
user: API.UserResource;
|
|
174
|
+
apiKeys: API.APIKeys;
|
|
175
|
+
operations: API.Operations;
|
|
176
|
+
compute: API.Compute;
|
|
177
|
+
networking: API.Networking;
|
|
178
|
+
}
|
|
179
|
+
export declare namespace NirvanaLabs {
|
|
180
|
+
export type RequestOptions = Opts.RequestOptions;
|
|
181
|
+
export { UserResource as UserResource };
|
|
182
|
+
export { APIKeys as APIKeys };
|
|
183
|
+
export { Operations as Operations };
|
|
184
|
+
export { Compute as Compute };
|
|
185
|
+
export { Networking as Networking };
|
|
186
|
+
export type RegionName = API.RegionName;
|
|
187
|
+
export type ResourceStatus = API.ResourceStatus;
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=client.d.mts.map
|
package/client.d.mts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.mts","sourceRoot":"","sources":["src/client.ts"],"names":[],"mappings":";OAEO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAY;OAC3C,KAAK,EAAc,cAAc,EAAE,iBAAiB,EAAE,oBAAoB,EAA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