@nebula-ai/sdk 1.2.0 → 1.3.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 +35 -0
- package/LICENSE +4 -23
- package/README.md +305 -128
- 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/api-promise.js +6 -0
- package/api-promise.js.map +1 -0
- package/api-promise.mjs +2 -0
- package/api-promise.mjs.map +1 -0
- package/client.d.mts +205 -0
- package/client.d.mts.map +1 -0
- package/client.d.ts +205 -0
- package/client.d.ts.map +1 -0
- package/client.js +505 -0
- package/client.js.map +1 -0
- package/client.mjs +501 -0
- package/client.mjs.map +1 -0
- package/core/api-promise.d.mts +46 -0
- package/core/api-promise.d.mts.map +1 -0
- package/core/api-promise.d.ts +46 -0
- package/core/api-promise.d.ts.map +1 -0
- package/core/api-promise.js +74 -0
- package/core/api-promise.js.map +1 -0
- package/core/api-promise.mjs +70 -0
- package/core/api-promise.mjs.map +1 -0
- package/core/error.d.mts +46 -0
- package/core/error.d.mts.map +1 -0
- package/core/error.d.ts +46 -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 +2 -0
- package/error.d.ts.map +1 -0
- package/error.js +6 -0
- package/error.js.map +1 -0
- package/error.mjs +2 -0
- package/error.mjs.map +1 -0
- package/index.d.mts +13 -0
- package/index.d.mts.map +1 -0
- package/index.d.ts +13 -0
- package/index.d.ts.map +1 -0
- package/index.js +43 -0
- package/index.js.map +1 -0
- package/index.mjs +13 -0
- package/index.mjs.map +1 -0
- package/internal/builtin-types.d.mts +73 -0
- package/internal/builtin-types.d.mts.map +1 -0
- package/internal/builtin-types.d.ts +73 -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 +20 -0
- package/internal/headers.d.mts.map +1 -0
- package/internal/headers.d.ts +20 -0
- package/internal/headers.d.ts.map +1 -0
- package/internal/headers.js +79 -0
- package/internal/headers.js.map +1 -0
- package/internal/headers.mjs +74 -0
- package/internal/headers.mjs.map +1 -0
- package/internal/parse.d.mts +12 -0
- package/internal/parse.d.mts.map +1 -0
- package/internal/parse.d.ts +12 -0
- package/internal/parse.d.ts.map +1 -0
- package/internal/parse.js +40 -0
- package/internal/parse.js.map +1 -0
- package/internal/parse.mjs +37 -0
- package/internal/parse.mjs.map +1 -0
- package/internal/qs/formats.d.mts +7 -0
- package/internal/qs/formats.d.mts.map +1 -0
- package/internal/qs/formats.d.ts +7 -0
- package/internal/qs/formats.d.ts.map +1 -0
- package/internal/qs/formats.js +13 -0
- package/internal/qs/formats.js.map +1 -0
- package/internal/qs/formats.mjs +9 -0
- package/internal/qs/formats.mjs.map +1 -0
- package/internal/qs/index.d.mts +10 -0
- package/internal/qs/index.d.mts.map +1 -0
- package/internal/qs/index.d.ts +10 -0
- package/internal/qs/index.d.ts.map +1 -0
- package/internal/qs/index.js +14 -0
- package/internal/qs/index.js.map +1 -0
- package/internal/qs/index.mjs +10 -0
- package/internal/qs/index.mjs.map +1 -0
- package/internal/qs/stringify.d.mts +3 -0
- package/internal/qs/stringify.d.mts.map +1 -0
- package/internal/qs/stringify.d.ts +3 -0
- package/internal/qs/stringify.d.ts.map +1 -0
- package/internal/qs/stringify.js +277 -0
- package/internal/qs/stringify.js.map +1 -0
- package/internal/qs/stringify.mjs +274 -0
- package/internal/qs/stringify.mjs.map +1 -0
- package/internal/qs/types.d.mts +57 -0
- package/internal/qs/types.d.mts.map +1 -0
- package/internal/qs/types.d.ts +57 -0
- package/internal/qs/types.d.ts.map +1 -0
- package/internal/qs/types.js +3 -0
- package/internal/qs/types.js.map +1 -0
- package/internal/qs/types.mjs +2 -0
- package/internal/qs/types.mjs.map +1 -0
- package/internal/qs/utils.d.mts +15 -0
- package/internal/qs/utils.d.mts.map +1 -0
- package/internal/qs/utils.d.ts +15 -0
- package/internal/qs/utils.d.ts.map +1 -0
- package/internal/qs/utils.js +230 -0
- package/internal/qs/utils.js.map +1 -0
- package/internal/qs/utils.mjs +217 -0
- package/internal/qs/utils.mjs.map +1 -0
- package/internal/request-options.d.mts +79 -0
- package/internal/request-options.d.mts.map +1 -0
- package/internal/request-options.d.ts +79 -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 +17 -0
- package/internal/shim-types.d.mts.map +1 -0
- package/internal/shim-types.d.ts +17 -0
- package/internal/shim-types.d.ts.map +1 -0
- package/internal/shim-types.js +4 -0
- package/internal/shim-types.js.map +1 -0
- package/internal/shim-types.mjs +3 -0
- package/internal/shim-types.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 +92 -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 +45 -0
- package/internal/to-file.d.mts.map +1 -0
- package/internal/to-file.d.ts +45 -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 +88 -0
- package/internal/to-file.mjs.map +1 -0
- package/internal/tslib.js +81 -0
- package/internal/tslib.mjs +17 -0
- package/internal/types.d.mts +69 -0
- package/internal/types.d.mts.map +1 -0
- package/internal/types.d.ts +69 -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 +42 -0
- package/internal/uploads.d.mts.map +1 -0
- package/internal/uploads.d.ts +42 -0
- package/internal/uploads.d.ts.map +1 -0
- package/internal/uploads.js +141 -0
- package/internal/uploads.js.map +1 -0
- package/internal/uploads.mjs +131 -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 +38 -0
- package/internal/utils/base64.js.map +1 -0
- package/internal/utils/base64.mjs +33 -0
- package/internal/utils/base64.mjs.map +1 -0
- package/internal/utils/bytes.d.mts +4 -0
- package/internal/utils/bytes.d.mts.map +1 -0
- package/internal/utils/bytes.d.ts +4 -0
- package/internal/utils/bytes.d.ts.map +1 -0
- package/internal/utils/bytes.js +31 -0
- package/internal/utils/bytes.js.map +1 -0
- package/internal/utils/bytes.mjs +26 -0
- package/internal/utils/bytes.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 +37 -0
- package/internal/utils/log.d.mts.map +1 -0
- package/internal/utils/log.d.ts +37 -0
- package/internal/utils/log.d.ts.map +1 -0
- package/internal/utils/log.js +86 -0
- package/internal/utils/log.js.map +1 -0
- package/internal/utils/log.mjs +80 -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 +79 -0
- package/internal/utils/path.js.map +1 -0
- package/internal/utils/path.mjs +74 -0
- package/internal/utils/path.mjs.map +1 -0
- package/internal/utils/query.d.mts +2 -0
- package/internal/utils/query.d.mts.map +1 -0
- package/internal/utils/query.d.ts +2 -0
- package/internal/utils/query.d.ts.map +1 -0
- package/internal/utils/query.js +10 -0
- package/internal/utils/query.js.map +1 -0
- package/internal/utils/query.mjs +6 -0
- package/internal/utils/query.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 +19 -0
- package/internal/utils/uuid.js.map +1 -0
- package/internal/utils/uuid.mjs +15 -0
- package/internal/utils/uuid.mjs.map +1 -0
- package/internal/utils/values.d.mts +18 -0
- package/internal/utils/values.d.mts.map +1 -0
- package/internal/utils/values.d.ts +18 -0
- package/internal/utils/values.d.ts.map +1 -0
- package/internal/utils/values.js +112 -0
- package/internal/utils/values.js.map +1 -0
- package/internal/utils/values.mjs +94 -0
- package/internal/utils/values.mjs.map +1 -0
- package/internal/utils.d.mts +8 -0
- package/internal/utils.d.mts.map +1 -0
- package/internal/utils.d.ts +8 -0
- package/internal/utils.d.ts.map +1 -0
- package/internal/utils.js +12 -0
- package/internal/utils.js.map +1 -0
- package/internal/utils.mjs +9 -0
- package/internal/utils.mjs.map +1 -0
- package/lib/dx.d.mts +96 -0
- package/lib/dx.d.mts.map +1 -0
- package/lib/dx.d.ts +96 -0
- package/lib/dx.d.ts.map +1 -0
- package/lib/dx.js +239 -0
- package/lib/dx.js.map +1 -0
- package/lib/dx.mjs +235 -0
- package/lib/dx.mjs.map +1 -0
- package/package.json +144 -58
- package/resource.d.mts +2 -0
- package/resource.d.mts.map +1 -0
- package/resource.d.ts +2 -0
- package/resource.d.ts.map +1 -0
- package/resource.js +6 -0
- package/resource.js.map +1 -0
- package/resource.mjs +2 -0
- package/resource.mjs.map +1 -0
- package/resources/collections.d.mts +289 -0
- package/resources/collections.d.mts.map +1 -0
- package/resources/collections.d.ts +289 -0
- package/resources/collections.d.ts.map +1 -0
- package/resources/collections.js +72 -0
- package/resources/collections.js.map +1 -0
- package/resources/collections.mjs +68 -0
- package/resources/collections.mjs.map +1 -0
- package/resources/connectors.d.mts +148 -0
- package/resources/connectors.d.mts.map +1 -0
- package/resources/connectors.d.ts +148 -0
- package/resources/connectors.d.ts.map +1 -0
- package/resources/connectors.js +50 -0
- package/resources/connectors.js.map +1 -0
- package/resources/connectors.mjs +46 -0
- package/resources/connectors.mjs.map +1 -0
- package/resources/index.d.mts +6 -0
- package/resources/index.d.mts.map +1 -0
- package/resources/index.d.ts +6 -0
- package/resources/index.d.ts.map +1 -0
- package/resources/index.js +13 -0
- package/resources/index.js.map +1 -0
- package/resources/index.mjs +6 -0
- package/resources/index.mjs.map +1 -0
- package/resources/memories.d.mts +1737 -0
- package/resources/memories.d.mts.map +1 -0
- package/resources/memories.d.ts +1737 -0
- package/resources/memories.d.ts.map +1 -0
- package/resources/memories.js +157 -0
- package/resources/memories.js.map +1 -0
- package/resources/memories.mjs +153 -0
- package/resources/memories.mjs.map +1 -0
- package/resources/snapshots.d.mts +281 -0
- package/resources/snapshots.d.mts.map +1 -0
- package/resources/snapshots.d.ts +281 -0
- package/resources/snapshots.d.ts.map +1 -0
- package/resources/snapshots.js +22 -0
- package/resources/snapshots.js.map +1 -0
- package/resources/snapshots.mjs +18 -0
- package/resources/snapshots.mjs.map +1 -0
- package/resources/top-level.d.mts +14 -0
- package/resources/top-level.d.mts.map +1 -0
- package/resources/top-level.d.ts +14 -0
- package/resources/top-level.d.ts.map +1 -0
- package/resources/top-level.js +4 -0
- package/resources/top-level.js.map +1 -0
- package/resources/top-level.mjs +3 -0
- package/resources/top-level.mjs.map +1 -0
- package/resources.d.mts +2 -0
- package/resources.d.mts.map +1 -0
- package/resources.d.ts +2 -0
- package/resources.d.ts.map +1 -0
- package/resources.js +5 -0
- package/resources.js.map +1 -0
- package/resources.mjs +2 -0
- package/resources.mjs.map +1 -0
- package/src/api-promise.ts +2 -0
- package/src/client.ts +892 -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 -0
- package/src/index.ts +36 -0
- 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 +97 -0
- package/src/internal/parse.ts +56 -0
- package/src/internal/qs/LICENSE.md +13 -0
- package/src/internal/qs/README.md +3 -0
- package/src/internal/qs/formats.ts +10 -0
- package/src/internal/qs/index.ts +13 -0
- package/src/internal/qs/stringify.ts +385 -0
- package/src/internal/qs/types.ts +71 -0
- package/src/internal/qs/utils.ts +265 -0
- package/src/internal/request-options.ts +93 -0
- package/src/internal/shim-types.ts +26 -0
- package/src/internal/shims.ts +107 -0
- package/src/internal/to-file.ts +154 -0
- package/src/internal/types.ts +95 -0
- package/src/internal/uploads.ts +187 -0
- package/src/internal/utils/base64.ts +40 -0
- package/src/internal/utils/bytes.ts +32 -0
- package/src/internal/utils/env.ts +18 -0
- package/src/internal/utils/log.ts +127 -0
- package/src/internal/utils/path.ts +88 -0
- package/src/internal/utils/query.ts +7 -0
- package/src/internal/utils/sleep.ts +3 -0
- package/src/internal/utils/uuid.ts +17 -0
- package/src/internal/utils/values.ts +105 -0
- package/src/internal/utils.ts +9 -0
- package/src/lib/.keep +4 -0
- package/src/lib/dx.ts +459 -0
- package/src/resource.ts +2 -0
- package/src/resources/collections.ts +474 -0
- package/src/resources/connectors.ts +236 -0
- package/src/resources/index.ts +56 -0
- package/src/resources/memories.ts +2409 -0
- package/src/resources/snapshots.ts +387 -0
- package/src/resources/top-level.ts +19 -0
- package/src/resources.ts +1 -0
- package/src/tsconfig.json +11 -0
- package/src/uploads.ts +2 -0
- package/src/version.ts +1 -0
- package/uploads.d.mts +2 -0
- package/uploads.d.mts.map +1 -0
- package/uploads.d.ts +2 -0
- package/uploads.d.ts.map +1 -0
- package/uploads.js +6 -0
- package/uploads.js.map +1 -0
- package/uploads.mjs +2 -0
- package/uploads.mjs.map +1 -0
- package/version.d.mts +2 -0
- package/version.d.mts.map +1 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +5 -0
- package/version.js.map +1 -0
- package/version.mjs +2 -0
- package/version.mjs.map +1 -0
- package/dist/index.d.mts +0 -557
- package/dist/index.d.ts +0 -557
- package/dist/index.js +0 -1282
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -1267
- package/dist/index.mjs.map +0 -1
package/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { Nebula as default } from "./lib/dx.js";
|
|
2
|
+
export { type Uploadable, toFile } from "./core/uploads.js";
|
|
3
|
+
export { APIPromise } from "./core/api-promise.js";
|
|
4
|
+
export { type ClientOptions } from "./client.js";
|
|
5
|
+
export { Nebula, type MemoryInput } from "./lib/dx.js";
|
|
6
|
+
export { NebulaError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.js";
|
|
7
|
+
export { APIError as NebulaException, APIConnectionError as NebulaClientException, AuthenticationError as NebulaAuthenticationException, RateLimitError as NebulaRateLimitException, BadRequestError as NebulaValidationException, NotFoundError as NebulaNotFoundException, } from "./core/error.js";
|
|
8
|
+
export * from "./resources/collections.js";
|
|
9
|
+
export * from "./resources/connectors.js";
|
|
10
|
+
export * from "./resources/memories.js";
|
|
11
|
+
export * from "./resources/snapshots.js";
|
|
12
|
+
export * from "./resources/top-level.js";
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAEO,EAAE,MAAM,IAAI,OAAO,EAAE;OAErB,EAAE,KAAK,UAAU,EAAE,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,KAAK,aAAa,EAAE;OACtB,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE;OAC5B,EACL,WAAW,EACX,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB;OACM,EACL,QAAQ,IAAI,eAAe,EAC3B,kBAAkB,IAAI,qBAAqB,EAC3C,mBAAmB,IAAI,6BAA6B,EACpD,cAAc,IAAI,wBAAwB,EAC1C,eAAe,IAAI,yBAAyB,EAC5C,aAAa,IAAI,uBAAuB,GACzC"}
|
package/index.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
exports = module.exports = function (...args) {
|
|
4
|
+
return new exports.default(...args)
|
|
5
|
+
}
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.NebulaNotFoundException = exports.NebulaValidationException = exports.NebulaRateLimitException = exports.NebulaAuthenticationException = exports.NebulaClientException = exports.NebulaException = exports.UnprocessableEntityError = exports.PermissionDeniedError = exports.InternalServerError = exports.AuthenticationError = exports.BadRequestError = exports.RateLimitError = exports.ConflictError = exports.NotFoundError = exports.APIUserAbortError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.APIError = exports.NebulaError = exports.Nebula = exports.APIPromise = exports.toFile = exports.default = void 0;
|
|
8
|
+
const tslib_1 = require("./internal/tslib.js");
|
|
9
|
+
var dx_1 = require("./lib/dx.js");
|
|
10
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return dx_1.Nebula; } });
|
|
11
|
+
var uploads_1 = require("./core/uploads.js");
|
|
12
|
+
Object.defineProperty(exports, "toFile", { enumerable: true, get: function () { return uploads_1.toFile; } });
|
|
13
|
+
var api_promise_1 = require("./core/api-promise.js");
|
|
14
|
+
Object.defineProperty(exports, "APIPromise", { enumerable: true, get: function () { return api_promise_1.APIPromise; } });
|
|
15
|
+
var dx_2 = require("./lib/dx.js");
|
|
16
|
+
Object.defineProperty(exports, "Nebula", { enumerable: true, get: function () { return dx_2.Nebula; } });
|
|
17
|
+
var error_1 = require("./core/error.js");
|
|
18
|
+
Object.defineProperty(exports, "NebulaError", { enumerable: true, get: function () { return error_1.NebulaError; } });
|
|
19
|
+
Object.defineProperty(exports, "APIError", { enumerable: true, get: function () { return error_1.APIError; } });
|
|
20
|
+
Object.defineProperty(exports, "APIConnectionError", { enumerable: true, get: function () { return error_1.APIConnectionError; } });
|
|
21
|
+
Object.defineProperty(exports, "APIConnectionTimeoutError", { enumerable: true, get: function () { return error_1.APIConnectionTimeoutError; } });
|
|
22
|
+
Object.defineProperty(exports, "APIUserAbortError", { enumerable: true, get: function () { return error_1.APIUserAbortError; } });
|
|
23
|
+
Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return error_1.NotFoundError; } });
|
|
24
|
+
Object.defineProperty(exports, "ConflictError", { enumerable: true, get: function () { return error_1.ConflictError; } });
|
|
25
|
+
Object.defineProperty(exports, "RateLimitError", { enumerable: true, get: function () { return error_1.RateLimitError; } });
|
|
26
|
+
Object.defineProperty(exports, "BadRequestError", { enumerable: true, get: function () { return error_1.BadRequestError; } });
|
|
27
|
+
Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: function () { return error_1.AuthenticationError; } });
|
|
28
|
+
Object.defineProperty(exports, "InternalServerError", { enumerable: true, get: function () { return error_1.InternalServerError; } });
|
|
29
|
+
Object.defineProperty(exports, "PermissionDeniedError", { enumerable: true, get: function () { return error_1.PermissionDeniedError; } });
|
|
30
|
+
Object.defineProperty(exports, "UnprocessableEntityError", { enumerable: true, get: function () { return error_1.UnprocessableEntityError; } });
|
|
31
|
+
var error_2 = require("./core/error.js");
|
|
32
|
+
Object.defineProperty(exports, "NebulaException", { enumerable: true, get: function () { return error_2.APIError; } });
|
|
33
|
+
Object.defineProperty(exports, "NebulaClientException", { enumerable: true, get: function () { return error_2.APIConnectionError; } });
|
|
34
|
+
Object.defineProperty(exports, "NebulaAuthenticationException", { enumerable: true, get: function () { return error_2.AuthenticationError; } });
|
|
35
|
+
Object.defineProperty(exports, "NebulaRateLimitException", { enumerable: true, get: function () { return error_2.RateLimitError; } });
|
|
36
|
+
Object.defineProperty(exports, "NebulaValidationException", { enumerable: true, get: function () { return error_2.BadRequestError; } });
|
|
37
|
+
Object.defineProperty(exports, "NebulaNotFoundException", { enumerable: true, get: function () { return error_2.NotFoundError; } });
|
|
38
|
+
tslib_1.__exportStar(require("./resources/collections.js"), exports);
|
|
39
|
+
tslib_1.__exportStar(require("./resources/connectors.js"), exports);
|
|
40
|
+
tslib_1.__exportStar(require("./resources/memories.js"), exports);
|
|
41
|
+
tslib_1.__exportStar(require("./resources/snapshots.js"), exports);
|
|
42
|
+
tslib_1.__exportStar(require("./resources/top-level.js"), exports);
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,kCAA6C;AAApC,6FAAA,MAAM,OAAW;AAE1B,6CAAyD;AAA/B,iGAAA,MAAM,OAAA;AAChC,qDAAgD;AAAvC,yGAAA,UAAU,OAAA;AAEnB,kCAAoD;AAA3C,4FAAA,MAAM,OAAA;AACf,yCAcsB;AAbpB,oGAAA,WAAW,OAAA;AACX,iGAAA,QAAQ,OAAA;AACR,2GAAA,kBAAkB,OAAA;AAClB,kHAAA,yBAAyB,OAAA;AACzB,0GAAA,iBAAiB,OAAA;AACjB,sGAAA,aAAa,OAAA;AACb,sGAAA,aAAa,OAAA;AACb,uGAAA,cAAc,OAAA;AACd,wGAAA,eAAe,OAAA;AACf,4GAAA,mBAAmB,OAAA;AACnB,4GAAA,mBAAmB,OAAA;AACnB,8GAAA,qBAAqB,OAAA;AACrB,iHAAA,wBAAwB,OAAA;AAE1B,yCAOsB;AANpB,wGAAA,QAAQ,OAAmB;AAC3B,8GAAA,kBAAkB,OAAyB;AAC3C,sHAAA,mBAAmB,OAAiC;AACpD,iHAAA,cAAc,OAA4B;AAC1C,kHAAA,eAAe,OAA6B;AAC5C,gHAAA,aAAa,OAA2B;AAE1C,qEAAwC;AACxC,oEAAuC;AACvC,kEAAqC;AACrC,mEAAsC;AACtC,mEAAsC"}
|
package/index.mjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
export { Nebula as default } from "./lib/dx.mjs";
|
|
3
|
+
export { toFile } from "./core/uploads.mjs";
|
|
4
|
+
export { APIPromise } from "./core/api-promise.mjs";
|
|
5
|
+
export { Nebula } from "./lib/dx.mjs";
|
|
6
|
+
export { NebulaError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.mjs";
|
|
7
|
+
export { APIError as NebulaException, APIConnectionError as NebulaClientException, AuthenticationError as NebulaAuthenticationException, RateLimitError as NebulaRateLimitException, BadRequestError as NebulaValidationException, NotFoundError as NebulaNotFoundException, } from "./core/error.mjs";
|
|
8
|
+
export * from "./resources/collections.mjs";
|
|
9
|
+
export * from "./resources/connectors.mjs";
|
|
10
|
+
export * from "./resources/memories.mjs";
|
|
11
|
+
export * from "./resources/snapshots.mjs";
|
|
12
|
+
export * from "./resources/top-level.mjs";
|
|
13
|
+
//# sourceMappingURL=index.mjs.map
|
package/index.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,MAAM,IAAI,OAAO,EAAE;OAErB,EAAmB,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OAEd,EAAE,MAAM,EAAoB;OAC5B,EACL,WAAW,EACX,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB;OACM,EACL,QAAQ,IAAI,eAAe,EAC3B,kBAAkB,IAAI,qBAAqB,EAC3C,mBAAmB,IAAI,6BAA6B,EACpD,cAAc,IAAI,wBAAwB,EAC1C,eAAe,IAAI,yBAAyB,EAC5C,aAAa,IAAI,uBAAuB,GACzC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export type Fetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
2
|
+
/**
|
|
3
|
+
* An alias to the builtin `RequestInit` type so we can
|
|
4
|
+
* easily alias it in import statements if there are name clashes.
|
|
5
|
+
*
|
|
6
|
+
* https://developer.mozilla.org/docs/Web/API/RequestInit
|
|
7
|
+
*/
|
|
8
|
+
type _RequestInit = RequestInit;
|
|
9
|
+
/**
|
|
10
|
+
* An alias to the builtin `Response` type so we can
|
|
11
|
+
* easily alias it in import statements if there are name clashes.
|
|
12
|
+
*
|
|
13
|
+
* https://developer.mozilla.org/docs/Web/API/Response
|
|
14
|
+
*/
|
|
15
|
+
type _Response = Response;
|
|
16
|
+
/**
|
|
17
|
+
* The type for the first argument to `fetch`.
|
|
18
|
+
*
|
|
19
|
+
* https://developer.mozilla.org/docs/Web/API/Window/fetch#resource
|
|
20
|
+
*/
|
|
21
|
+
type _RequestInfo = Request | URL | string;
|
|
22
|
+
/**
|
|
23
|
+
* The type for constructing `RequestInit` Headers.
|
|
24
|
+
*
|
|
25
|
+
* https://developer.mozilla.org/docs/Web/API/RequestInit#setting_headers
|
|
26
|
+
*/
|
|
27
|
+
type _HeadersInit = RequestInit['headers'];
|
|
28
|
+
/**
|
|
29
|
+
* The type for constructing `RequestInit` body.
|
|
30
|
+
*
|
|
31
|
+
* https://developer.mozilla.org/docs/Web/API/RequestInit#body
|
|
32
|
+
*/
|
|
33
|
+
type _BodyInit = RequestInit['body'];
|
|
34
|
+
/**
|
|
35
|
+
* An alias to the builtin `Array<T>` type so we can
|
|
36
|
+
* easily alias it in import statements if there are name clashes.
|
|
37
|
+
*/
|
|
38
|
+
type _Array<T> = Array<T>;
|
|
39
|
+
/**
|
|
40
|
+
* An alias to the builtin `Record<K, T>` type so we can
|
|
41
|
+
* easily alias it in import statements if there are name clashes.
|
|
42
|
+
*/
|
|
43
|
+
type _Record<K extends keyof any, T> = Record<K, T>;
|
|
44
|
+
export type { _Array as Array, _BodyInit as BodyInit, _HeadersInit as HeadersInit, _Record as Record, _RequestInfo as RequestInfo, _RequestInit as RequestInit, _Response as Response, };
|
|
45
|
+
/**
|
|
46
|
+
* A copy of the builtin `EndingType` type as it isn't fully supported in certain
|
|
47
|
+
* environments and attempting to reference the global version will error.
|
|
48
|
+
*
|
|
49
|
+
* https://github.com/microsoft/TypeScript/blob/49ad1a3917a0ea57f5ff248159256e12bb1cb705/src/lib/dom.generated.d.ts#L27941
|
|
50
|
+
*/
|
|
51
|
+
type EndingType = 'native' | 'transparent';
|
|
52
|
+
/**
|
|
53
|
+
* A copy of the builtin `BlobPropertyBag` type as it isn't fully supported in certain
|
|
54
|
+
* environments and attempting to reference the global version will error.
|
|
55
|
+
*
|
|
56
|
+
* https://github.com/microsoft/TypeScript/blob/49ad1a3917a0ea57f5ff248159256e12bb1cb705/src/lib/dom.generated.d.ts#L154
|
|
57
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob#options
|
|
58
|
+
*/
|
|
59
|
+
export interface BlobPropertyBag {
|
|
60
|
+
endings?: EndingType;
|
|
61
|
+
type?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A copy of the builtin `FilePropertyBag` type as it isn't fully supported in certain
|
|
65
|
+
* environments and attempting to reference the global version will error.
|
|
66
|
+
*
|
|
67
|
+
* https://github.com/microsoft/TypeScript/blob/49ad1a3917a0ea57f5ff248159256e12bb1cb705/src/lib/dom.generated.d.ts#L503
|
|
68
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/File/File#options
|
|
69
|
+
*/
|
|
70
|
+
export interface FilePropertyBag extends BlobPropertyBag {
|
|
71
|
+
lastModified?: number;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=builtin-types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin-types.d.mts","sourceRoot":"","sources":["../src/internal/builtin-types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,KAAK,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE7F;;;;;GAKG;AACH,KAAK,YAAY,GAAG,WAAW,CAAC;AAEhC;;;;;GAKG;AACH,KAAK,SAAS,GAAG,QAAQ,CAAC;AAE1B;;;;GAIG;AACH,KAAK,YAAY,GAAG,OAAO,GAAG,GAAG,GAAG,MAAM,CAAC;AAE3C;;;;GAIG;AACH,KAAK,YAAY,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;AAE3C;;;;GAIG;AACH,KAAK,SAAS,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;AAErC;;;GAGG;AACH,KAAK,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;AAE1B;;;GAGG;AACH,KAAK,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAEpD,YAAY,EACV,MAAM,IAAI,KAAK,EACf,SAAS,IAAI,QAAQ,EACrB,YAAY,IAAI,WAAW,EAC3B,OAAO,IAAI,MAAM,EACjB,YAAY,IAAI,WAAW,EAC3B,YAAY,IAAI,WAAW,EAC3B,SAAS,IAAI,QAAQ,GACtB,CAAC;AAEF;;;;;GAKG;AACH,KAAK,UAAU,GAAG,QAAQ,GAAG,aAAa,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export type Fetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
2
|
+
/**
|
|
3
|
+
* An alias to the builtin `RequestInit` type so we can
|
|
4
|
+
* easily alias it in import statements if there are name clashes.
|
|
5
|
+
*
|
|
6
|
+
* https://developer.mozilla.org/docs/Web/API/RequestInit
|
|
7
|
+
*/
|
|
8
|
+
type _RequestInit = RequestInit;
|
|
9
|
+
/**
|
|
10
|
+
* An alias to the builtin `Response` type so we can
|
|
11
|
+
* easily alias it in import statements if there are name clashes.
|
|
12
|
+
*
|
|
13
|
+
* https://developer.mozilla.org/docs/Web/API/Response
|
|
14
|
+
*/
|
|
15
|
+
type _Response = Response;
|
|
16
|
+
/**
|
|
17
|
+
* The type for the first argument to `fetch`.
|
|
18
|
+
*
|
|
19
|
+
* https://developer.mozilla.org/docs/Web/API/Window/fetch#resource
|
|
20
|
+
*/
|
|
21
|
+
type _RequestInfo = Request | URL | string;
|
|
22
|
+
/**
|
|
23
|
+
* The type for constructing `RequestInit` Headers.
|
|
24
|
+
*
|
|
25
|
+
* https://developer.mozilla.org/docs/Web/API/RequestInit#setting_headers
|
|
26
|
+
*/
|
|
27
|
+
type _HeadersInit = RequestInit['headers'];
|
|
28
|
+
/**
|
|
29
|
+
* The type for constructing `RequestInit` body.
|
|
30
|
+
*
|
|
31
|
+
* https://developer.mozilla.org/docs/Web/API/RequestInit#body
|
|
32
|
+
*/
|
|
33
|
+
type _BodyInit = RequestInit['body'];
|
|
34
|
+
/**
|
|
35
|
+
* An alias to the builtin `Array<T>` type so we can
|
|
36
|
+
* easily alias it in import statements if there are name clashes.
|
|
37
|
+
*/
|
|
38
|
+
type _Array<T> = Array<T>;
|
|
39
|
+
/**
|
|
40
|
+
* An alias to the builtin `Record<K, T>` type so we can
|
|
41
|
+
* easily alias it in import statements if there are name clashes.
|
|
42
|
+
*/
|
|
43
|
+
type _Record<K extends keyof any, T> = Record<K, T>;
|
|
44
|
+
export type { _Array as Array, _BodyInit as BodyInit, _HeadersInit as HeadersInit, _Record as Record, _RequestInfo as RequestInfo, _RequestInit as RequestInit, _Response as Response, };
|
|
45
|
+
/**
|
|
46
|
+
* A copy of the builtin `EndingType` type as it isn't fully supported in certain
|
|
47
|
+
* environments and attempting to reference the global version will error.
|
|
48
|
+
*
|
|
49
|
+
* https://github.com/microsoft/TypeScript/blob/49ad1a3917a0ea57f5ff248159256e12bb1cb705/src/lib/dom.generated.d.ts#L27941
|
|
50
|
+
*/
|
|
51
|
+
type EndingType = 'native' | 'transparent';
|
|
52
|
+
/**
|
|
53
|
+
* A copy of the builtin `BlobPropertyBag` type as it isn't fully supported in certain
|
|
54
|
+
* environments and attempting to reference the global version will error.
|
|
55
|
+
*
|
|
56
|
+
* https://github.com/microsoft/TypeScript/blob/49ad1a3917a0ea57f5ff248159256e12bb1cb705/src/lib/dom.generated.d.ts#L154
|
|
57
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob#options
|
|
58
|
+
*/
|
|
59
|
+
export interface BlobPropertyBag {
|
|
60
|
+
endings?: EndingType;
|
|
61
|
+
type?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A copy of the builtin `FilePropertyBag` type as it isn't fully supported in certain
|
|
65
|
+
* environments and attempting to reference the global version will error.
|
|
66
|
+
*
|
|
67
|
+
* https://github.com/microsoft/TypeScript/blob/49ad1a3917a0ea57f5ff248159256e12bb1cb705/src/lib/dom.generated.d.ts#L503
|
|
68
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/File/File#options
|
|
69
|
+
*/
|
|
70
|
+
export interface FilePropertyBag extends BlobPropertyBag {
|
|
71
|
+
lastModified?: number;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=builtin-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin-types.d.ts","sourceRoot":"","sources":["../src/internal/builtin-types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,KAAK,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE7F;;;;;GAKG;AACH,KAAK,YAAY,GAAG,WAAW,CAAC;AAEhC;;;;;GAKG;AACH,KAAK,SAAS,GAAG,QAAQ,CAAC;AAE1B;;;;GAIG;AACH,KAAK,YAAY,GAAG,OAAO,GAAG,GAAG,GAAG,MAAM,CAAC;AAE3C;;;;GAIG;AACH,KAAK,YAAY,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;AAE3C;;;;GAIG;AACH,KAAK,SAAS,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;AAErC;;;GAGG;AACH,KAAK,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;AAE1B;;;GAGG;AACH,KAAK,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAEpD,YAAY,EACV,MAAM,IAAI,KAAK,EACf,SAAS,IAAI,QAAQ,EACrB,YAAY,IAAI,WAAW,EAC3B,OAAO,IAAI,MAAM,EACjB,YAAY,IAAI,WAAW,EAC3B,YAAY,IAAI,WAAW,EAC3B,SAAS,IAAI,QAAQ,GACtB,CAAC;AAEF;;;;;GAKG;AACH,KAAK,UAAU,GAAG,QAAQ,GAAG,aAAa,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin-types.js","sourceRoot":"","sources":["../src/internal/builtin-types.ts"],"names":[],"mappings":";AAAA,sFAAsF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin-types.mjs","sourceRoot":"","sources":["../src/internal/builtin-types.ts"],"names":[],"mappings":"AAAA,sFAAsF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const isRunningInBrowser: () => boolean;
|
|
2
|
+
type Arch = 'x32' | 'x64' | 'arm' | 'arm64' | `other:${string}` | 'unknown';
|
|
3
|
+
type PlatformName = 'MacOS' | 'Linux' | 'Windows' | 'FreeBSD' | 'OpenBSD' | 'iOS' | 'Android' | `Other:${string}` | 'Unknown';
|
|
4
|
+
type Browser = 'ie' | 'edge' | 'chrome' | 'firefox' | 'safari';
|
|
5
|
+
type PlatformProperties = {
|
|
6
|
+
'X-Stainless-Lang': 'js';
|
|
7
|
+
'X-Stainless-Package-Version': string;
|
|
8
|
+
'X-Stainless-OS': PlatformName;
|
|
9
|
+
'X-Stainless-Arch': Arch;
|
|
10
|
+
'X-Stainless-Runtime': 'node' | 'deno' | 'edge' | `browser:${Browser}` | 'unknown';
|
|
11
|
+
'X-Stainless-Runtime-Version': string;
|
|
12
|
+
};
|
|
13
|
+
export declare const getPlatformHeaders: () => PlatformProperties;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=detect-platform.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect-platform.d.mts","sourceRoot":"","sources":["../src/internal/detect-platform.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB,eAS9B,CAAC;AA0BF,KAAK,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;AAC5E,KAAK,YAAY,GACb,OAAO,GACP,OAAO,GACP,SAAS,GACT,SAAS,GACT,SAAS,GACT,KAAK,GACL,SAAS,GACT,SAAS,MAAM,EAAE,GACjB,SAAS,CAAC;AACd,KAAK,OAAO,GAAG,IAAI,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;AAC/D,KAAK,kBAAkB,GAAG;IACxB,kBAAkB,EAAE,IAAI,CAAC;IACzB,6BAA6B,EAAE,MAAM,CAAC;IACtC,gBAAgB,EAAE,YAAY,CAAC;IAC/B,kBAAkB,EAAE,IAAI,CAAC;IACzB,qBAAqB,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW,OAAO,EAAE,GAAG,SAAS,CAAC;IACnF,6BAA6B,EAAE,MAAM,CAAC;CACvC,CAAC;AAuIF,eAAO,MAAM,kBAAkB,0BAE9B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const isRunningInBrowser: () => boolean;
|
|
2
|
+
type Arch = 'x32' | 'x64' | 'arm' | 'arm64' | `other:${string}` | 'unknown';
|
|
3
|
+
type PlatformName = 'MacOS' | 'Linux' | 'Windows' | 'FreeBSD' | 'OpenBSD' | 'iOS' | 'Android' | `Other:${string}` | 'Unknown';
|
|
4
|
+
type Browser = 'ie' | 'edge' | 'chrome' | 'firefox' | 'safari';
|
|
5
|
+
type PlatformProperties = {
|
|
6
|
+
'X-Stainless-Lang': 'js';
|
|
7
|
+
'X-Stainless-Package-Version': string;
|
|
8
|
+
'X-Stainless-OS': PlatformName;
|
|
9
|
+
'X-Stainless-Arch': Arch;
|
|
10
|
+
'X-Stainless-Runtime': 'node' | 'deno' | 'edge' | `browser:${Browser}` | 'unknown';
|
|
11
|
+
'X-Stainless-Runtime-Version': string;
|
|
12
|
+
};
|
|
13
|
+
export declare const getPlatformHeaders: () => PlatformProperties;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=detect-platform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect-platform.d.ts","sourceRoot":"","sources":["../src/internal/detect-platform.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB,eAS9B,CAAC;AA0BF,KAAK,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;AAC5E,KAAK,YAAY,GACb,OAAO,GACP,OAAO,GACP,SAAS,GACT,SAAS,GACT,SAAS,GACT,KAAK,GACL,SAAS,GACT,SAAS,MAAM,EAAE,GACjB,SAAS,CAAC;AACd,KAAK,OAAO,GAAG,IAAI,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;AAC/D,KAAK,kBAAkB,GAAG;IACxB,kBAAkB,EAAE,IAAI,CAAC;IACzB,6BAA6B,EAAE,MAAM,CAAC;IACtC,gBAAgB,EAAE,YAAY,CAAC;IAC/B,kBAAkB,EAAE,IAAI,CAAC;IACzB,qBAAqB,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW,OAAO,EAAE,GAAG,SAAS,CAAC;IACnF,6BAA6B,EAAE,MAAM,CAAC;CACvC,CAAC;AAuIF,eAAO,MAAM,kBAAkB,0BAE9B,CAAC"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.getPlatformHeaders = exports.isRunningInBrowser = void 0;
|
|
5
|
+
const version_1 = require("../version.js");
|
|
6
|
+
const isRunningInBrowser = () => {
|
|
7
|
+
return (
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
typeof window !== 'undefined' &&
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
typeof window.document !== 'undefined' &&
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
typeof navigator !== 'undefined');
|
|
14
|
+
};
|
|
15
|
+
exports.isRunningInBrowser = isRunningInBrowser;
|
|
16
|
+
/**
|
|
17
|
+
* Note this does not detect 'browser'; for that, use getBrowserInfo().
|
|
18
|
+
*/
|
|
19
|
+
function getDetectedPlatform() {
|
|
20
|
+
if (typeof Deno !== 'undefined' && Deno.build != null) {
|
|
21
|
+
return 'deno';
|
|
22
|
+
}
|
|
23
|
+
if (typeof EdgeRuntime !== 'undefined') {
|
|
24
|
+
return 'edge';
|
|
25
|
+
}
|
|
26
|
+
if (Object.prototype.toString.call(typeof globalThis.process !== 'undefined' ? globalThis.process : 0) === '[object process]') {
|
|
27
|
+
return 'node';
|
|
28
|
+
}
|
|
29
|
+
return 'unknown';
|
|
30
|
+
}
|
|
31
|
+
const getPlatformProperties = () => {
|
|
32
|
+
const detectedPlatform = getDetectedPlatform();
|
|
33
|
+
if (detectedPlatform === 'deno') {
|
|
34
|
+
return {
|
|
35
|
+
'X-Stainless-Lang': 'js',
|
|
36
|
+
'X-Stainless-Package-Version': version_1.VERSION,
|
|
37
|
+
'X-Stainless-OS': normalizePlatform(Deno.build.os),
|
|
38
|
+
'X-Stainless-Arch': normalizeArch(Deno.build.arch),
|
|
39
|
+
'X-Stainless-Runtime': 'deno',
|
|
40
|
+
'X-Stainless-Runtime-Version': typeof Deno.version === 'string' ? Deno.version : Deno.version?.deno ?? 'unknown',
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
if (typeof EdgeRuntime !== 'undefined') {
|
|
44
|
+
return {
|
|
45
|
+
'X-Stainless-Lang': 'js',
|
|
46
|
+
'X-Stainless-Package-Version': version_1.VERSION,
|
|
47
|
+
'X-Stainless-OS': 'Unknown',
|
|
48
|
+
'X-Stainless-Arch': `other:${EdgeRuntime}`,
|
|
49
|
+
'X-Stainless-Runtime': 'edge',
|
|
50
|
+
'X-Stainless-Runtime-Version': globalThis.process.version,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
// Check if Node.js
|
|
54
|
+
if (detectedPlatform === 'node') {
|
|
55
|
+
return {
|
|
56
|
+
'X-Stainless-Lang': 'js',
|
|
57
|
+
'X-Stainless-Package-Version': version_1.VERSION,
|
|
58
|
+
'X-Stainless-OS': normalizePlatform(globalThis.process.platform ?? 'unknown'),
|
|
59
|
+
'X-Stainless-Arch': normalizeArch(globalThis.process.arch ?? 'unknown'),
|
|
60
|
+
'X-Stainless-Runtime': 'node',
|
|
61
|
+
'X-Stainless-Runtime-Version': globalThis.process.version ?? 'unknown',
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const browserInfo = getBrowserInfo();
|
|
65
|
+
if (browserInfo) {
|
|
66
|
+
return {
|
|
67
|
+
'X-Stainless-Lang': 'js',
|
|
68
|
+
'X-Stainless-Package-Version': version_1.VERSION,
|
|
69
|
+
'X-Stainless-OS': 'Unknown',
|
|
70
|
+
'X-Stainless-Arch': 'unknown',
|
|
71
|
+
'X-Stainless-Runtime': `browser:${browserInfo.browser}`,
|
|
72
|
+
'X-Stainless-Runtime-Version': browserInfo.version,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
// TODO add support for Cloudflare workers, etc.
|
|
76
|
+
return {
|
|
77
|
+
'X-Stainless-Lang': 'js',
|
|
78
|
+
'X-Stainless-Package-Version': version_1.VERSION,
|
|
79
|
+
'X-Stainless-OS': 'Unknown',
|
|
80
|
+
'X-Stainless-Arch': 'unknown',
|
|
81
|
+
'X-Stainless-Runtime': 'unknown',
|
|
82
|
+
'X-Stainless-Runtime-Version': 'unknown',
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
// Note: modified from https://github.com/JS-DevTools/host-environment/blob/b1ab79ecde37db5d6e163c050e54fe7d287d7c92/src/isomorphic.browser.ts
|
|
86
|
+
function getBrowserInfo() {
|
|
87
|
+
if (typeof navigator === 'undefined' || !navigator) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
// NOTE: The order matters here!
|
|
91
|
+
const browserPatterns = [
|
|
92
|
+
{ key: 'edge', pattern: /Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ },
|
|
93
|
+
{ key: 'ie', pattern: /MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ },
|
|
94
|
+
{ key: 'ie', pattern: /Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/ },
|
|
95
|
+
{ key: 'chrome', pattern: /Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ },
|
|
96
|
+
{ key: 'firefox', pattern: /Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ },
|
|
97
|
+
{ key: 'safari', pattern: /(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/ },
|
|
98
|
+
];
|
|
99
|
+
// Find the FIRST matching browser
|
|
100
|
+
for (const { key, pattern } of browserPatterns) {
|
|
101
|
+
const match = pattern.exec(navigator.userAgent);
|
|
102
|
+
if (match) {
|
|
103
|
+
const major = match[1] || 0;
|
|
104
|
+
const minor = match[2] || 0;
|
|
105
|
+
const patch = match[3] || 0;
|
|
106
|
+
return { browser: key, version: `${major}.${minor}.${patch}` };
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
const normalizeArch = (arch) => {
|
|
112
|
+
// Node docs:
|
|
113
|
+
// - https://nodejs.org/api/process.html#processarch
|
|
114
|
+
// Deno docs:
|
|
115
|
+
// - https://doc.deno.land/deno/stable/~/Deno.build
|
|
116
|
+
if (arch === 'x32')
|
|
117
|
+
return 'x32';
|
|
118
|
+
if (arch === 'x86_64' || arch === 'x64')
|
|
119
|
+
return 'x64';
|
|
120
|
+
if (arch === 'arm')
|
|
121
|
+
return 'arm';
|
|
122
|
+
if (arch === 'aarch64' || arch === 'arm64')
|
|
123
|
+
return 'arm64';
|
|
124
|
+
if (arch)
|
|
125
|
+
return `other:${arch}`;
|
|
126
|
+
return 'unknown';
|
|
127
|
+
};
|
|
128
|
+
const normalizePlatform = (platform) => {
|
|
129
|
+
// Node platforms:
|
|
130
|
+
// - https://nodejs.org/api/process.html#processplatform
|
|
131
|
+
// Deno platforms:
|
|
132
|
+
// - https://doc.deno.land/deno/stable/~/Deno.build
|
|
133
|
+
// - https://github.com/denoland/deno/issues/14799
|
|
134
|
+
platform = platform.toLowerCase();
|
|
135
|
+
// NOTE: this iOS check is untested and may not work
|
|
136
|
+
// Node does not work natively on IOS, there is a fork at
|
|
137
|
+
// https://github.com/nodejs-mobile/nodejs-mobile
|
|
138
|
+
// however it is unknown at the time of writing how to detect if it is running
|
|
139
|
+
if (platform.includes('ios'))
|
|
140
|
+
return 'iOS';
|
|
141
|
+
if (platform === 'android')
|
|
142
|
+
return 'Android';
|
|
143
|
+
if (platform === 'darwin')
|
|
144
|
+
return 'MacOS';
|
|
145
|
+
if (platform === 'win32')
|
|
146
|
+
return 'Windows';
|
|
147
|
+
if (platform === 'freebsd')
|
|
148
|
+
return 'FreeBSD';
|
|
149
|
+
if (platform === 'openbsd')
|
|
150
|
+
return 'OpenBSD';
|
|
151
|
+
if (platform === 'linux')
|
|
152
|
+
return 'Linux';
|
|
153
|
+
if (platform)
|
|
154
|
+
return `Other:${platform}`;
|
|
155
|
+
return 'Unknown';
|
|
156
|
+
};
|
|
157
|
+
let _platformHeaders;
|
|
158
|
+
const getPlatformHeaders = () => {
|
|
159
|
+
return (_platformHeaders ?? (_platformHeaders = getPlatformProperties()));
|
|
160
|
+
};
|
|
161
|
+
exports.getPlatformHeaders = getPlatformHeaders;
|
|
162
|
+
//# sourceMappingURL=detect-platform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect-platform.js","sourceRoot":"","sources":["../src/internal/detect-platform.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,2CAAqC;AAE9B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hB,gBAAgB,GAAK,qBAAqB,EAAE,EAAC,CAAC;AACxD,CAAC,CAAC;AAFW,QAAA,kBAAkB,sBAE7B"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { VERSION } from "../version.mjs";
|
|
3
|
+
export const isRunningInBrowser = () => {
|
|
4
|
+
return (
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
typeof window !== 'undefined' &&
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
typeof window.document !== 'undefined' &&
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
typeof navigator !== 'undefined');
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Note this does not detect 'browser'; for that, use getBrowserInfo().
|
|
14
|
+
*/
|
|
15
|
+
function getDetectedPlatform() {
|
|
16
|
+
if (typeof Deno !== 'undefined' && Deno.build != null) {
|
|
17
|
+
return 'deno';
|
|
18
|
+
}
|
|
19
|
+
if (typeof EdgeRuntime !== 'undefined') {
|
|
20
|
+
return 'edge';
|
|
21
|
+
}
|
|
22
|
+
if (Object.prototype.toString.call(typeof globalThis.process !== 'undefined' ? globalThis.process : 0) === '[object process]') {
|
|
23
|
+
return 'node';
|
|
24
|
+
}
|
|
25
|
+
return 'unknown';
|
|
26
|
+
}
|
|
27
|
+
const getPlatformProperties = () => {
|
|
28
|
+
const detectedPlatform = getDetectedPlatform();
|
|
29
|
+
if (detectedPlatform === 'deno') {
|
|
30
|
+
return {
|
|
31
|
+
'X-Stainless-Lang': 'js',
|
|
32
|
+
'X-Stainless-Package-Version': VERSION,
|
|
33
|
+
'X-Stainless-OS': normalizePlatform(Deno.build.os),
|
|
34
|
+
'X-Stainless-Arch': normalizeArch(Deno.build.arch),
|
|
35
|
+
'X-Stainless-Runtime': 'deno',
|
|
36
|
+
'X-Stainless-Runtime-Version': typeof Deno.version === 'string' ? Deno.version : Deno.version?.deno ?? 'unknown',
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
if (typeof EdgeRuntime !== 'undefined') {
|
|
40
|
+
return {
|
|
41
|
+
'X-Stainless-Lang': 'js',
|
|
42
|
+
'X-Stainless-Package-Version': VERSION,
|
|
43
|
+
'X-Stainless-OS': 'Unknown',
|
|
44
|
+
'X-Stainless-Arch': `other:${EdgeRuntime}`,
|
|
45
|
+
'X-Stainless-Runtime': 'edge',
|
|
46
|
+
'X-Stainless-Runtime-Version': globalThis.process.version,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
// Check if Node.js
|
|
50
|
+
if (detectedPlatform === 'node') {
|
|
51
|
+
return {
|
|
52
|
+
'X-Stainless-Lang': 'js',
|
|
53
|
+
'X-Stainless-Package-Version': VERSION,
|
|
54
|
+
'X-Stainless-OS': normalizePlatform(globalThis.process.platform ?? 'unknown'),
|
|
55
|
+
'X-Stainless-Arch': normalizeArch(globalThis.process.arch ?? 'unknown'),
|
|
56
|
+
'X-Stainless-Runtime': 'node',
|
|
57
|
+
'X-Stainless-Runtime-Version': globalThis.process.version ?? 'unknown',
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const browserInfo = getBrowserInfo();
|
|
61
|
+
if (browserInfo) {
|
|
62
|
+
return {
|
|
63
|
+
'X-Stainless-Lang': 'js',
|
|
64
|
+
'X-Stainless-Package-Version': VERSION,
|
|
65
|
+
'X-Stainless-OS': 'Unknown',
|
|
66
|
+
'X-Stainless-Arch': 'unknown',
|
|
67
|
+
'X-Stainless-Runtime': `browser:${browserInfo.browser}`,
|
|
68
|
+
'X-Stainless-Runtime-Version': browserInfo.version,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
// TODO add support for Cloudflare workers, etc.
|
|
72
|
+
return {
|
|
73
|
+
'X-Stainless-Lang': 'js',
|
|
74
|
+
'X-Stainless-Package-Version': VERSION,
|
|
75
|
+
'X-Stainless-OS': 'Unknown',
|
|
76
|
+
'X-Stainless-Arch': 'unknown',
|
|
77
|
+
'X-Stainless-Runtime': 'unknown',
|
|
78
|
+
'X-Stainless-Runtime-Version': 'unknown',
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
// Note: modified from https://github.com/JS-DevTools/host-environment/blob/b1ab79ecde37db5d6e163c050e54fe7d287d7c92/src/isomorphic.browser.ts
|
|
82
|
+
function getBrowserInfo() {
|
|
83
|
+
if (typeof navigator === 'undefined' || !navigator) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
// NOTE: The order matters here!
|
|
87
|
+
const browserPatterns = [
|
|
88
|
+
{ key: 'edge', pattern: /Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ },
|
|
89
|
+
{ key: 'ie', pattern: /MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ },
|
|
90
|
+
{ key: 'ie', pattern: /Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/ },
|
|
91
|
+
{ key: 'chrome', pattern: /Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ },
|
|
92
|
+
{ key: 'firefox', pattern: /Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ },
|
|
93
|
+
{ key: 'safari', pattern: /(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/ },
|
|
94
|
+
];
|
|
95
|
+
// Find the FIRST matching browser
|
|
96
|
+
for (const { key, pattern } of browserPatterns) {
|
|
97
|
+
const match = pattern.exec(navigator.userAgent);
|
|
98
|
+
if (match) {
|
|
99
|
+
const major = match[1] || 0;
|
|
100
|
+
const minor = match[2] || 0;
|
|
101
|
+
const patch = match[3] || 0;
|
|
102
|
+
return { browser: key, version: `${major}.${minor}.${patch}` };
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
const normalizeArch = (arch) => {
|
|
108
|
+
// Node docs:
|
|
109
|
+
// - https://nodejs.org/api/process.html#processarch
|
|
110
|
+
// Deno docs:
|
|
111
|
+
// - https://doc.deno.land/deno/stable/~/Deno.build
|
|
112
|
+
if (arch === 'x32')
|
|
113
|
+
return 'x32';
|
|
114
|
+
if (arch === 'x86_64' || arch === 'x64')
|
|
115
|
+
return 'x64';
|
|
116
|
+
if (arch === 'arm')
|
|
117
|
+
return 'arm';
|
|
118
|
+
if (arch === 'aarch64' || arch === 'arm64')
|
|
119
|
+
return 'arm64';
|
|
120
|
+
if (arch)
|
|
121
|
+
return `other:${arch}`;
|
|
122
|
+
return 'unknown';
|
|
123
|
+
};
|
|
124
|
+
const normalizePlatform = (platform) => {
|
|
125
|
+
// Node platforms:
|
|
126
|
+
// - https://nodejs.org/api/process.html#processplatform
|
|
127
|
+
// Deno platforms:
|
|
128
|
+
// - https://doc.deno.land/deno/stable/~/Deno.build
|
|
129
|
+
// - https://github.com/denoland/deno/issues/14799
|
|
130
|
+
platform = platform.toLowerCase();
|
|
131
|
+
// NOTE: this iOS check is untested and may not work
|
|
132
|
+
// Node does not work natively on IOS, there is a fork at
|
|
133
|
+
// https://github.com/nodejs-mobile/nodejs-mobile
|
|
134
|
+
// however it is unknown at the time of writing how to detect if it is running
|
|
135
|
+
if (platform.includes('ios'))
|
|
136
|
+
return 'iOS';
|
|
137
|
+
if (platform === 'android')
|
|
138
|
+
return 'Android';
|
|
139
|
+
if (platform === 'darwin')
|
|
140
|
+
return 'MacOS';
|
|
141
|
+
if (platform === 'win32')
|
|
142
|
+
return 'Windows';
|
|
143
|
+
if (platform === 'freebsd')
|
|
144
|
+
return 'FreeBSD';
|
|
145
|
+
if (platform === 'openbsd')
|
|
146
|
+
return 'OpenBSD';
|
|
147
|
+
if (platform === 'linux')
|
|
148
|
+
return 'Linux';
|
|
149
|
+
if (platform)
|
|
150
|
+
return `Other:${platform}`;
|
|
151
|
+
return 'Unknown';
|
|
152
|
+
};
|
|
153
|
+
let _platformHeaders;
|
|
154
|
+
export const getPlatformHeaders = () => {
|
|
155
|
+
return (_platformHeaders ?? (_platformHeaders = getPlatformProperties()));
|
|
156
|
+
};
|
|
157
|
+
//# sourceMappingURL=detect-platform.mjs.map
|