@scaleway/sdk-std 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/package.json +4 -7
  2. package/node_modules/@scaleway/sdk-client/README.md +0 -36
  3. package/node_modules/@scaleway/sdk-client/dist/bridge.d.ts +0 -12
  4. package/node_modules/@scaleway/sdk-client/dist/helpers/is-browser.cjs +0 -4
  5. package/node_modules/@scaleway/sdk-client/dist/helpers/is-browser.d.ts +0 -1
  6. package/node_modules/@scaleway/sdk-client/dist/helpers/is-browser.js +0 -4
  7. package/node_modules/@scaleway/sdk-client/dist/helpers/is-response.cjs +0 -4
  8. package/node_modules/@scaleway/sdk-client/dist/helpers/is-response.d.ts +0 -8
  9. package/node_modules/@scaleway/sdk-client/dist/helpers/is-response.js +0 -4
  10. package/node_modules/@scaleway/sdk-client/dist/helpers/json.cjs +0 -47
  11. package/node_modules/@scaleway/sdk-client/dist/helpers/json.d.ts +0 -32
  12. package/node_modules/@scaleway/sdk-client/dist/helpers/json.js +0 -47
  13. package/node_modules/@scaleway/sdk-client/dist/helpers/marshalling.cjs +0 -76
  14. package/node_modules/@scaleway/sdk-client/dist/helpers/marshalling.d.ts +0 -60
  15. package/node_modules/@scaleway/sdk-client/dist/helpers/marshalling.js +0 -76
  16. package/node_modules/@scaleway/sdk-client/dist/index.cjs +0 -56
  17. package/node_modules/@scaleway/sdk-client/dist/index.d.ts +0 -16
  18. package/node_modules/@scaleway/sdk-client/dist/index.js +0 -56
  19. package/node_modules/@scaleway/sdk-client/dist/internal/async/interval-retrier.cjs +0 -53
  20. package/node_modules/@scaleway/sdk-client/dist/internal/async/interval-retrier.d.ts +0 -111
  21. package/node_modules/@scaleway/sdk-client/dist/internal/async/interval-retrier.js +0 -53
  22. package/node_modules/@scaleway/sdk-client/dist/internal/async/sleep.cjs +0 -6
  23. package/node_modules/@scaleway/sdk-client/dist/internal/async/sleep.d.ts +0 -9
  24. package/node_modules/@scaleway/sdk-client/dist/internal/async/sleep.js +0 -6
  25. package/node_modules/@scaleway/sdk-client/dist/internal/interceptors/composer.cjs +0 -25
  26. package/node_modules/@scaleway/sdk-client/dist/internal/interceptors/composer.d.ts +0 -25
  27. package/node_modules/@scaleway/sdk-client/dist/internal/interceptors/composer.js +0 -25
  28. package/node_modules/@scaleway/sdk-client/dist/internal/interceptors/helpers.cjs +0 -12
  29. package/node_modules/@scaleway/sdk-client/dist/internal/interceptors/helpers.d.ts +0 -21
  30. package/node_modules/@scaleway/sdk-client/dist/internal/interceptors/helpers.js +0 -12
  31. package/node_modules/@scaleway/sdk-client/dist/internal/interceptors/types.d.ts +0 -89
  32. package/node_modules/@scaleway/sdk-client/dist/internal/logger/console-logger.cjs +0 -24
  33. package/node_modules/@scaleway/sdk-client/dist/internal/logger/console-logger.d.ts +0 -23
  34. package/node_modules/@scaleway/sdk-client/dist/internal/logger/console-logger.js +0 -24
  35. package/node_modules/@scaleway/sdk-client/dist/internal/logger/index.cjs +0 -12
  36. package/node_modules/@scaleway/sdk-client/dist/internal/logger/index.d.ts +0 -25
  37. package/node_modules/@scaleway/sdk-client/dist/internal/logger/index.js +0 -12
  38. package/node_modules/@scaleway/sdk-client/dist/internal/logger/level-resolver.cjs +0 -13
  39. package/node_modules/@scaleway/sdk-client/dist/internal/logger/level-resolver.d.ts +0 -9
  40. package/node_modules/@scaleway/sdk-client/dist/internal/logger/level-resolver.js +0 -13
  41. package/node_modules/@scaleway/sdk-client/dist/internal/logger/logger.d.ts +0 -13
  42. package/node_modules/@scaleway/sdk-client/dist/internal/validations/string-validation.cjs +0 -30
  43. package/node_modules/@scaleway/sdk-client/dist/internal/validations/string-validation.d.ts +0 -18
  44. package/node_modules/@scaleway/sdk-client/dist/internal/validations/string-validation.js +0 -30
  45. package/node_modules/@scaleway/sdk-client/dist/internals.d.ts +0 -10
  46. package/node_modules/@scaleway/sdk-client/dist/package.json.cjs +0 -8
  47. package/node_modules/@scaleway/sdk-client/dist/package.json.js +0 -8
  48. package/node_modules/@scaleway/sdk-client/dist/scw/api.cjs +0 -8
  49. package/node_modules/@scaleway/sdk-client/dist/scw/api.d.ts +0 -10
  50. package/node_modules/@scaleway/sdk-client/dist/scw/api.js +0 -8
  51. package/node_modules/@scaleway/sdk-client/dist/scw/auth.cjs +0 -25
  52. package/node_modules/@scaleway/sdk-client/dist/scw/auth.d.ts +0 -70
  53. package/node_modules/@scaleway/sdk-client/dist/scw/auth.js +0 -25
  54. package/node_modules/@scaleway/sdk-client/dist/scw/client-ini-factory.cjs +0 -66
  55. package/node_modules/@scaleway/sdk-client/dist/scw/client-ini-factory.d.ts +0 -111
  56. package/node_modules/@scaleway/sdk-client/dist/scw/client-ini-factory.js +0 -66
  57. package/node_modules/@scaleway/sdk-client/dist/scw/client-ini-profile.cjs +0 -23
  58. package/node_modules/@scaleway/sdk-client/dist/scw/client-ini-profile.d.ts +0 -82
  59. package/node_modules/@scaleway/sdk-client/dist/scw/client-ini-profile.js +0 -23
  60. package/node_modules/@scaleway/sdk-client/dist/scw/client-settings.cjs +0 -51
  61. package/node_modules/@scaleway/sdk-client/dist/scw/client-settings.d.ts +0 -59
  62. package/node_modules/@scaleway/sdk-client/dist/scw/client-settings.js +0 -51
  63. package/node_modules/@scaleway/sdk-client/dist/scw/client.cjs +0 -31
  64. package/node_modules/@scaleway/sdk-client/dist/scw/client.d.ts +0 -71
  65. package/node_modules/@scaleway/sdk-client/dist/scw/client.js +0 -31
  66. package/node_modules/@scaleway/sdk-client/dist/scw/constants.cjs +0 -11
  67. package/node_modules/@scaleway/sdk-client/dist/scw/constants.d.ts +0 -4
  68. package/node_modules/@scaleway/sdk-client/dist/scw/constants.js +0 -11
  69. package/node_modules/@scaleway/sdk-client/dist/scw/custom-marshalling.cjs +0 -152
  70. package/node_modules/@scaleway/sdk-client/dist/scw/custom-marshalling.d.ts +0 -104
  71. package/node_modules/@scaleway/sdk-client/dist/scw/custom-marshalling.js +0 -152
  72. package/node_modules/@scaleway/sdk-client/dist/scw/custom-types.cjs +0 -11
  73. package/node_modules/@scaleway/sdk-client/dist/scw/custom-types.d.ts +0 -74
  74. package/node_modules/@scaleway/sdk-client/dist/scw/custom-types.js +0 -11
  75. package/node_modules/@scaleway/sdk-client/dist/scw/errors/error-parser.cjs +0 -76
  76. package/node_modules/@scaleway/sdk-client/dist/scw/errors/error-parser.d.ts +0 -12
  77. package/node_modules/@scaleway/sdk-client/dist/scw/errors/error-parser.js +0 -76
  78. package/node_modules/@scaleway/sdk-client/dist/scw/errors/non-standard/invalid-request-mapper.cjs +0 -36
  79. package/node_modules/@scaleway/sdk-client/dist/scw/errors/non-standard/invalid-request-mapper.d.ts +0 -12
  80. package/node_modules/@scaleway/sdk-client/dist/scw/errors/non-standard/invalid-request-mapper.js +0 -36
  81. package/node_modules/@scaleway/sdk-client/dist/scw/errors/non-standard/unknown-resource-mapper.cjs +0 -23
  82. package/node_modules/@scaleway/sdk-client/dist/scw/errors/non-standard/unknown-resource-mapper.d.ts +0 -11
  83. package/node_modules/@scaleway/sdk-client/dist/scw/errors/non-standard/unknown-resource-mapper.js +0 -23
  84. package/node_modules/@scaleway/sdk-client/dist/scw/errors/scw-error-from-json.d.ts +0 -10
  85. package/node_modules/@scaleway/sdk-client/dist/scw/errors/scw-error.cjs +0 -43
  86. package/node_modules/@scaleway/sdk-client/dist/scw/errors/scw-error.d.ts +0 -25
  87. package/node_modules/@scaleway/sdk-client/dist/scw/errors/scw-error.js +0 -43
  88. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/already-exists-error.cjs +0 -31
  89. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/already-exists-error.d.ts +0 -16
  90. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/already-exists-error.js +0 -31
  91. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/denied-authentication-error.cjs +0 -37
  92. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/denied-authentication-error.d.ts +0 -15
  93. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/denied-authentication-error.js +0 -37
  94. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/index.cjs +0 -28
  95. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/index.d.ts +0 -17
  96. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/index.js +0 -28
  97. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/invalid-arguments-error.cjs +0 -54
  98. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/invalid-arguments-error.d.ts +0 -24
  99. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/invalid-arguments-error.js +0 -54
  100. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/out-of-stock-error.cjs +0 -17
  101. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/out-of-stock-error.d.ts +0 -14
  102. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/out-of-stock-error.js +0 -17
  103. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/permissions-denied-error.cjs +0 -29
  104. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/permissions-denied-error.d.ts +0 -23
  105. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/permissions-denied-error.js +0 -29
  106. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/precondition-failed-error.cjs +0 -32
  107. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/precondition-failed-error.d.ts +0 -15
  108. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/precondition-failed-error.js +0 -32
  109. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/quotas-exceeded-error.cjs +0 -43
  110. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/quotas-exceeded-error.d.ts +0 -34
  111. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/quotas-exceeded-error.js +0 -43
  112. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/resource-expired-error.cjs +0 -31
  113. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/resource-expired-error.d.ts +0 -16
  114. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/resource-expired-error.js +0 -31
  115. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/resource-locked-error.cjs +0 -20
  116. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/resource-locked-error.d.ts +0 -15
  117. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/resource-locked-error.js +0 -20
  118. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/resource-not-found-error.cjs +0 -24
  119. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/resource-not-found-error.d.ts +0 -15
  120. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/resource-not-found-error.js +0 -24
  121. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/too-many-requests-error.cjs +0 -58
  122. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/too-many-requests-error.d.ts +0 -32
  123. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/too-many-requests-error.js +0 -58
  124. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/transient-state-error.cjs +0 -31
  125. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/transient-state-error.d.ts +0 -16
  126. package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/transient-state-error.js +0 -31
  127. package/node_modules/@scaleway/sdk-client/dist/scw/errors/types.cjs +0 -15
  128. package/node_modules/@scaleway/sdk-client/dist/scw/errors/types.d.ts +0 -9
  129. package/node_modules/@scaleway/sdk-client/dist/scw/errors/types.js +0 -15
  130. package/node_modules/@scaleway/sdk-client/dist/scw/fetch/build-fetcher.cjs +0 -60
  131. package/node_modules/@scaleway/sdk-client/dist/scw/fetch/build-fetcher.d.ts +0 -23
  132. package/node_modules/@scaleway/sdk-client/dist/scw/fetch/build-fetcher.js +0 -60
  133. package/node_modules/@scaleway/sdk-client/dist/scw/fetch/http-dumper.cjs +0 -20
  134. package/node_modules/@scaleway/sdk-client/dist/scw/fetch/http-dumper.d.ts +0 -18
  135. package/node_modules/@scaleway/sdk-client/dist/scw/fetch/http-dumper.js +0 -20
  136. package/node_modules/@scaleway/sdk-client/dist/scw/fetch/http-interceptors.cjs +0 -43
  137. package/node_modules/@scaleway/sdk-client/dist/scw/fetch/http-interceptors.d.ts +0 -38
  138. package/node_modules/@scaleway/sdk-client/dist/scw/fetch/http-interceptors.js +0 -43
  139. package/node_modules/@scaleway/sdk-client/dist/scw/fetch/resource-paginator.cjs +0 -36
  140. package/node_modules/@scaleway/sdk-client/dist/scw/fetch/resource-paginator.d.ts +0 -47
  141. package/node_modules/@scaleway/sdk-client/dist/scw/fetch/resource-paginator.js +0 -36
  142. package/node_modules/@scaleway/sdk-client/dist/scw/fetch/response-parser.cjs +0 -55
  143. package/node_modules/@scaleway/sdk-client/dist/scw/fetch/response-parser.d.ts +0 -25
  144. package/node_modules/@scaleway/sdk-client/dist/scw/fetch/response-parser.js +0 -55
  145. package/node_modules/@scaleway/sdk-client/dist/scw/fetch/types.d.ts +0 -16
  146. package/node_modules/@scaleway/sdk-client/dist/scw/locality.d.ts +0 -2
  147. package/node_modules/@scaleway/sdk-client/dist/vendor/base64/index.cjs +0 -46
  148. package/node_modules/@scaleway/sdk-client/dist/vendor/base64/index.js +0 -46
  149. package/node_modules/@scaleway/sdk-client/package.json +0 -36
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleway/sdk-std",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Scaleway SDK Std",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -20,17 +20,14 @@
20
20
  "directory": "packages_generated/std"
21
21
  },
22
22
  "engines": {
23
- "node": ">=20.19.0"
23
+ "node": ">=20.19.1"
24
24
  },
25
25
  "dependencies": {
26
- "@scaleway/sdk-client": "^1.2.1"
26
+ "@scaleway/sdk-client": "^1.2.2"
27
27
  },
28
28
  "peerDependencies": {
29
- "@scaleway/sdk-client": "^1.2.1"
29
+ "@scaleway/sdk-client": "^1.2.2"
30
30
  },
31
- "bundledDependencies": [
32
- "@scaleway/sdk-client"
33
- ],
34
31
  "scripts": {
35
32
  "package:check": "pnpm publint",
36
33
  "typecheck": "tsc --noEmit",
@@ -1,36 +0,0 @@
1
- # Scaleway SDK Client
2
-
3
- This SDK Client enables you to interact with Scaleway APIs.
4
-
5
- **🔗  Important links:**
6
-
7
- - [Reference documentation](https://scaleway.github.io/scaleway-sdk-js)
8
- - [Example projects](https://github.com/scaleway/scaleway-sdk-js/tree/master/examples)
9
- - [Developers website](https://developers.scaleway.com) (API documentation)
10
-
11
- ## Getting Started
12
-
13
- You'll need a pair of access and secret keys to connect to Scaleway API. Please check the [documentation](https://www.scaleway.com/en/docs/identity-and-access-management/iam/how-to/create-api-keys/) on how to retrieve them.
14
-
15
- **A minimal setup** would look like this:
16
-
17
- ```ts
18
- import { createClient } from '@scaleway/sdk-client'
19
- import { Registry } from '@scaleway/sdk'
20
-
21
- const client = createClient({
22
- accessKey: 'SCWXXXXXXXXXXXXXXXXX',
23
- secretKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
24
- defaultProjectId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
25
- defaultRegion: 'fr-par',
26
- defaultZone: 'fr-par-1',
27
- })
28
-
29
- const api = new Registry.v1.API(client)
30
- ```
31
-
32
- **For more information**, please check the [GitHub project](https://github.com/scaleway/scaleway-sdk-js).
33
-
34
- ## Reach us
35
-
36
- We love feedback. Feel free to reach us on [Scaleway Slack community](https://slack.scaleway.com/), we are waiting for you on [#opensource](https://scaleway-community.slack.com/app_redirect?channel=opensource).
@@ -1,12 +0,0 @@
1
- /** List all helpers required by APIs */
2
- export { isJSONObject } from './helpers/json.js';
3
- export { waitForResource } from './internal/async/interval-retrier.js';
4
- export type { WaitForOptions } from './internal/async/interval-retrier.js';
5
- export { API } from './scw/api.js';
6
- export type { DefaultValues } from './scw/client-settings.js';
7
- export type { Money, ServiceInfo, ScwFile, TimeSeries, } from './scw/custom-types.js';
8
- export { Decimal } from './scw/custom-types.js';
9
- export { marshalScwFile, marshalMoney, marshalTimeSeries, marshalDecimal, marshalBlobToScwFile, unmarshalMoney, unmarshalScwFile, unmarshalServiceInfo, unmarshalTimeSeries, unmarshalTimeSeriesPoint, unmarshalDecimal, } from './scw/custom-marshalling.js';
10
- export { enrichForPagination } from './scw/fetch/resource-paginator.js';
11
- export type { Region, Zone } from './scw/locality';
12
- export { resolveOneOf, unmarshalDate, unmarshalArrayOfObject, unmarshalMapOfObject, urlParams, validatePathParam, } from './helpers/marshalling.js';
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const isBrowser = () => typeof window !== "undefined" && typeof window.document !== "undefined";
4
- exports.isBrowser = isBrowser;
@@ -1 +0,0 @@
1
- export declare const isBrowser: () => boolean;
@@ -1,4 +0,0 @@
1
- const isBrowser = () => typeof window !== "undefined" && typeof window.document !== "undefined";
2
- export {
3
- isBrowser
4
- };
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const isResponse = (obj) => obj !== null && obj !== void 0 && typeof obj === "object" && "status" in obj && typeof obj.status === "number" && "statusText" in obj && typeof obj.statusText === "string" && "headers" in obj && typeof obj.headers === "object" && "body" in obj && typeof obj.body !== "undefined";
4
- exports.isResponse = isResponse;
@@ -1,8 +0,0 @@
1
- /**
2
- * Validates an object is of type Response without using `instanceof`.
3
- *
4
- * @remarks Check issue #509 for more context.
5
- *
6
- * @internal
7
- */
8
- export declare const isResponse: (obj: unknown) => obj is Response;
@@ -1,4 +0,0 @@
1
- const isResponse = (obj) => obj !== null && obj !== void 0 && typeof obj === "object" && "status" in obj && typeof obj.status === "number" && "statusText" in obj && typeof obj.statusText === "string" && "headers" in obj && typeof obj.headers === "object" && "body" in obj && typeof obj.body !== "undefined";
2
- export {
3
- isResponse
4
- };
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const isJSONObject = (obj) => {
4
- const objT = typeof obj;
5
- return obj !== void 0 && obj !== null && objT !== "string" && objT !== "number" && objT !== "boolean" && !Array.isArray(obj) && objT === "object";
6
- };
7
- const camelize = (str) => {
8
- const strLength = str.length;
9
- if (strLength <= 0) {
10
- return str;
11
- }
12
- let out = "";
13
- for (let capNext = false, index = 0; index < strLength; index += 1) {
14
- const char = str.charAt(index);
15
- if (char >= "a" && char <= "z") {
16
- if (capNext) {
17
- out += char.toUpperCase();
18
- } else {
19
- out += char;
20
- }
21
- } else if (char >= "A" && char <= "Z") {
22
- out += char;
23
- } else if (char >= "0" && char <= "9") {
24
- out += char;
25
- }
26
- capNext = char === "_" || char === " " || char === "-" || char === ".";
27
- }
28
- return out.charAt(0).toLowerCase() + out.substring(1);
29
- };
30
- const camelizeKeys = (obj, ignoreKeys = []) => {
31
- if (Array.isArray(obj)) {
32
- return obj.map((v) => camelizeKeys(v, ignoreKeys));
33
- }
34
- if (obj && typeof obj === "object" && !(obj instanceof Date)) {
35
- return Object.entries(obj).reduce(
36
- (acc, [key, value]) => ({
37
- ...acc,
38
- [camelize(key)]: ignoreKeys.includes(key) ? value : camelizeKeys(value, ignoreKeys)
39
- }),
40
- {}
41
- );
42
- }
43
- return obj;
44
- };
45
- exports.camelize = camelize;
46
- exports.camelizeKeys = camelizeKeys;
47
- exports.isJSONObject = isJSONObject;
@@ -1,32 +0,0 @@
1
- export type JSON = string | number | boolean | null | JSON[] | {
2
- [key: string]: JSON;
3
- };
4
- export interface JSONObject {
5
- [key: string]: JSON;
6
- }
7
- export declare const isJSON: (obj: unknown) => obj is JSON;
8
- /**
9
- * Validates an unknown object is a JSON Object.
10
- *
11
- * @internal
12
- */
13
- export declare const isJSONObject: (obj: unknown) => obj is JSONObject;
14
- /**
15
- * Camelizes a string.
16
- *
17
- * @param str - The string to camelize
18
- * @returns The camelized string
19
- *
20
- * @internal
21
- */
22
- export declare const camelize: (str: string) => string;
23
- /**
24
- * Camelizes keys of an object (deeply).
25
- *
26
- * @param obj - The object
27
- * @param ignoreKeys - The keys to ignore
28
- * @returns The object with camelized keys
29
- *
30
- * @internal
31
- */
32
- export declare const camelizeKeys: <T>(obj: object | unknown[] | unknown, ignoreKeys?: string[]) => T;
@@ -1,47 +0,0 @@
1
- const isJSONObject = (obj) => {
2
- const objT = typeof obj;
3
- return obj !== void 0 && obj !== null && objT !== "string" && objT !== "number" && objT !== "boolean" && !Array.isArray(obj) && objT === "object";
4
- };
5
- const camelize = (str) => {
6
- const strLength = str.length;
7
- if (strLength <= 0) {
8
- return str;
9
- }
10
- let out = "";
11
- for (let capNext = false, index = 0; index < strLength; index += 1) {
12
- const char = str.charAt(index);
13
- if (char >= "a" && char <= "z") {
14
- if (capNext) {
15
- out += char.toUpperCase();
16
- } else {
17
- out += char;
18
- }
19
- } else if (char >= "A" && char <= "Z") {
20
- out += char;
21
- } else if (char >= "0" && char <= "9") {
22
- out += char;
23
- }
24
- capNext = char === "_" || char === " " || char === "-" || char === ".";
25
- }
26
- return out.charAt(0).toLowerCase() + out.substring(1);
27
- };
28
- const camelizeKeys = (obj, ignoreKeys = []) => {
29
- if (Array.isArray(obj)) {
30
- return obj.map((v) => camelizeKeys(v, ignoreKeys));
31
- }
32
- if (obj && typeof obj === "object" && !(obj instanceof Date)) {
33
- return Object.entries(obj).reduce(
34
- (acc, [key, value]) => ({
35
- ...acc,
36
- [camelize(key)]: ignoreKeys.includes(key) ? value : camelizeKeys(value, ignoreKeys)
37
- }),
38
- {}
39
- );
40
- }
41
- return obj;
42
- };
43
- export {
44
- camelize,
45
- camelizeKeys,
46
- isJSONObject
47
- };
@@ -1,76 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- function validatePathParam(name, param) {
4
- if (typeof param === "string" && param.length > 0) return param;
5
- if (typeof param === "number") return param.toString();
6
- throw new TypeError(`param ${name} cannot be empty in request`);
7
- }
8
- const resolveOneOf = (list, isRequired = false) => {
9
- const elt = list.find((obj) => obj.value !== void 0) ?? list.find((obj) => obj.default !== void 0);
10
- const value = elt?.value ?? elt?.default;
11
- if (elt && value !== void 0) {
12
- return { [elt.param]: value };
13
- }
14
- if (isRequired) {
15
- const keyList = list.map((obj) => obj.param).join(" or ");
16
- throw new TypeError(`one of ${keyList} must be indicated in the request`);
17
- }
18
- return {};
19
- };
20
- const urlParams = (...paramTuples) => {
21
- const params = new URLSearchParams();
22
- for (const [key, value] of paramTuples) {
23
- if (typeof key === "string" && value != null) {
24
- if (Array.isArray(value)) {
25
- for (const innerValue of value) {
26
- if (innerValue !== null) {
27
- params.append(
28
- key,
29
- innerValue instanceof Date ? innerValue.toISOString() : innerValue.toString()
30
- );
31
- }
32
- }
33
- } else {
34
- params.append(
35
- key,
36
- value instanceof Date ? value.toISOString() : value.toString()
37
- );
38
- }
39
- }
40
- }
41
- return params;
42
- };
43
- const unmarshalDate = (data) => {
44
- if (typeof data !== "string") {
45
- return void 0;
46
- }
47
- const date = new Date(data);
48
- if (Number.isNaN(date.getTime())) {
49
- return void 0;
50
- }
51
- return date;
52
- };
53
- const unmarshalArrayOfObject = (data, unmarshaller, emptyFallback = true) => {
54
- if (!Array.isArray(data)) {
55
- return emptyFallback ? [] : void 0;
56
- }
57
- return data.map((elt) => unmarshaller(elt));
58
- };
59
- const unmarshalMapOfObject = (data, unmarshaller, emptyFallback = true) => {
60
- if (!data || typeof data !== "object" || !(data instanceof Object) || Array.isArray(data)) {
61
- return emptyFallback ? {} : void 0;
62
- }
63
- return Object.entries(data).reduce(
64
- (acc, [key, value]) => ({
65
- ...acc,
66
- [key]: unmarshaller(value)
67
- }),
68
- {}
69
- );
70
- };
71
- exports.resolveOneOf = resolveOneOf;
72
- exports.unmarshalArrayOfObject = unmarshalArrayOfObject;
73
- exports.unmarshalDate = unmarshalDate;
74
- exports.unmarshalMapOfObject = unmarshalMapOfObject;
75
- exports.urlParams = urlParams;
76
- exports.validatePathParam = validatePathParam;
@@ -1,60 +0,0 @@
1
- /**
2
- * Returns the parameter if it's valid as path parameter
3
- * (string and not empty, or number), else throws an exception.
4
- *
5
- * @param name - The parameter name
6
- * @param param - The parameter value
7
- * @returns The parameter value
8
- *
9
- * @throws TypeError
10
- * Thrown if the parameter is invalid.
11
- *
12
- * @internal
13
- */
14
- export declare function validatePathParam(name: string, param: string | number | undefined): string;
15
- /**
16
- * Resolves the ideal parameter and value amongst an optional list.
17
- *
18
- * @param list - The list to be looking into
19
- * @param isRequired - If at least one "one-of" should be found, false by default
20
- * @returns The parameter and value
21
- *
22
- * @throws TypeError
23
- * Thrown if isRequired is true, and no value or default value is specified.
24
- *
25
- * @internal
26
- */
27
- export declare const resolveOneOf: <T>(list: {
28
- param: string;
29
- value: T | undefined;
30
- default?: T | undefined;
31
- }[], isRequired?: boolean) => Record<string, T>;
32
- type URLParameterValue = string | number | boolean | Date | null;
33
- /**
34
- * Filters defined parameters tuples and converts them to URLSearchParams.
35
- *
36
- * @param paramTuples - The key/value pairs
37
- * @returns URLSearchParams
38
- *
39
- * @internal
40
- */
41
- export declare const urlParams: (...paramTuples: Readonly<[string, URLParameterValue | URLParameterValue[] | undefined]>[]) => URLSearchParams;
42
- /**
43
- * Unmarshals data to Date object.
44
- *
45
- * @internal
46
- */
47
- export declare const unmarshalDate: (data: unknown) => Date | undefined;
48
- /**
49
- * Unmarshals array of object.
50
- *
51
- * @internal
52
- */
53
- export declare const unmarshalArrayOfObject: <T, B extends boolean>(data: unknown, unmarshaller: (input: unknown) => T, emptyFallback?: B) => B extends true ? T[] | undefined : T[];
54
- /**
55
- * Unmarshals map of object.
56
- *
57
- * @internal
58
- */
59
- export declare const unmarshalMapOfObject: <T, B extends boolean>(data: unknown, unmarshaller: (input: unknown) => T, emptyFallback?: B) => B extends true ? Record<string, T> | undefined : Record<string, T>;
60
- export {};
@@ -1,76 +0,0 @@
1
- function validatePathParam(name, param) {
2
- if (typeof param === "string" && param.length > 0) return param;
3
- if (typeof param === "number") return param.toString();
4
- throw new TypeError(`param ${name} cannot be empty in request`);
5
- }
6
- const resolveOneOf = (list, isRequired = false) => {
7
- const elt = list.find((obj) => obj.value !== void 0) ?? list.find((obj) => obj.default !== void 0);
8
- const value = elt?.value ?? elt?.default;
9
- if (elt && value !== void 0) {
10
- return { [elt.param]: value };
11
- }
12
- if (isRequired) {
13
- const keyList = list.map((obj) => obj.param).join(" or ");
14
- throw new TypeError(`one of ${keyList} must be indicated in the request`);
15
- }
16
- return {};
17
- };
18
- const urlParams = (...paramTuples) => {
19
- const params = new URLSearchParams();
20
- for (const [key, value] of paramTuples) {
21
- if (typeof key === "string" && value != null) {
22
- if (Array.isArray(value)) {
23
- for (const innerValue of value) {
24
- if (innerValue !== null) {
25
- params.append(
26
- key,
27
- innerValue instanceof Date ? innerValue.toISOString() : innerValue.toString()
28
- );
29
- }
30
- }
31
- } else {
32
- params.append(
33
- key,
34
- value instanceof Date ? value.toISOString() : value.toString()
35
- );
36
- }
37
- }
38
- }
39
- return params;
40
- };
41
- const unmarshalDate = (data) => {
42
- if (typeof data !== "string") {
43
- return void 0;
44
- }
45
- const date = new Date(data);
46
- if (Number.isNaN(date.getTime())) {
47
- return void 0;
48
- }
49
- return date;
50
- };
51
- const unmarshalArrayOfObject = (data, unmarshaller, emptyFallback = true) => {
52
- if (!Array.isArray(data)) {
53
- return emptyFallback ? [] : void 0;
54
- }
55
- return data.map((elt) => unmarshaller(elt));
56
- };
57
- const unmarshalMapOfObject = (data, unmarshaller, emptyFallback = true) => {
58
- if (!data || typeof data !== "object" || !(data instanceof Object) || Array.isArray(data)) {
59
- return emptyFallback ? {} : void 0;
60
- }
61
- return Object.entries(data).reduce(
62
- (acc, [key, value]) => ({
63
- ...acc,
64
- [key]: unmarshaller(value)
65
- }),
66
- {}
67
- );
68
- };
69
- export {
70
- resolveOneOf,
71
- unmarshalArrayOfObject,
72
- unmarshalDate,
73
- unmarshalMapOfObject,
74
- urlParams,
75
- validatePathParam
76
- };
@@ -1,56 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./internal/logger/index.cjs");
4
- const client = require("./scw/client.cjs");
5
- const constants = require("./scw/constants.cjs");
6
- const clientIniFactory = require("./scw/client-ini-factory.cjs");
7
- const customTypes = require("./scw/custom-types.cjs");
8
- const index$1 = require("./scw/errors/standard/index.cjs");
9
- const json = require("./helpers/json.cjs");
10
- const intervalRetrier = require("./internal/async/interval-retrier.cjs");
11
- const helpers = require("./internal/interceptors/helpers.cjs");
12
- const api = require("./scw/api.cjs");
13
- const auth = require("./scw/auth.cjs");
14
- const customMarshalling = require("./scw/custom-marshalling.cjs");
15
- const marshalling = require("./helpers/marshalling.cjs");
16
- const resourcePaginator = require("./scw/fetch/resource-paginator.cjs");
17
- exports.enableConsoleLogger = index.enableConsoleLogger;
18
- exports.setLogger = index.setLogger;
19
- exports.createAdvancedClient = client.createAdvancedClient;
20
- exports.createClient = client.createClient;
21
- exports.AUTH_HEADER_KEY = constants.AUTH_HEADER_KEY;
22
- exports.SESSION_HEADER_KEY = constants.SESSION_HEADER_KEY;
23
- exports.withAdditionalInterceptors = clientIniFactory.withAdditionalInterceptors;
24
- exports.withDefaultPageSize = clientIniFactory.withDefaultPageSize;
25
- exports.withHTTPClient = clientIniFactory.withHTTPClient;
26
- exports.withProfile = clientIniFactory.withProfile;
27
- exports.withUserAgent = clientIniFactory.withUserAgent;
28
- exports.withUserAgentSuffix = clientIniFactory.withUserAgentSuffix;
29
- exports.Decimal = customTypes.Decimal;
30
- exports.Errors = index$1;
31
- exports.isJSONObject = json.isJSONObject;
32
- exports.createExponentialBackoffStrategy = intervalRetrier.createExponentialBackoffStrategy;
33
- exports.tryAtIntervals = intervalRetrier.tryAtIntervals;
34
- exports.waitForResource = intervalRetrier.waitForResource;
35
- exports.addAsyncHeaderInterceptor = helpers.addAsyncHeaderInterceptor;
36
- exports.API = api.API;
37
- exports.authenticateWithSessionToken = auth.authenticateWithSessionToken;
38
- exports.marshalBlobToScwFile = customMarshalling.marshalBlobToScwFile;
39
- exports.marshalDecimal = customMarshalling.marshalDecimal;
40
- exports.marshalMoney = customMarshalling.marshalMoney;
41
- exports.marshalScwFile = customMarshalling.marshalScwFile;
42
- exports.marshalTimeSeries = customMarshalling.marshalTimeSeries;
43
- exports.unmarshalAnyRes = customMarshalling.unmarshalAnyRes;
44
- exports.unmarshalDecimal = customMarshalling.unmarshalDecimal;
45
- exports.unmarshalMoney = customMarshalling.unmarshalMoney;
46
- exports.unmarshalScwFile = customMarshalling.unmarshalScwFile;
47
- exports.unmarshalServiceInfo = customMarshalling.unmarshalServiceInfo;
48
- exports.unmarshalTimeSeries = customMarshalling.unmarshalTimeSeries;
49
- exports.unmarshalTimeSeriesPoint = customMarshalling.unmarshalTimeSeriesPoint;
50
- exports.resolveOneOf = marshalling.resolveOneOf;
51
- exports.unmarshalArrayOfObject = marshalling.unmarshalArrayOfObject;
52
- exports.unmarshalDate = marshalling.unmarshalDate;
53
- exports.unmarshalMapOfObject = marshalling.unmarshalMapOfObject;
54
- exports.urlParams = marshalling.urlParams;
55
- exports.validatePathParam = marshalling.validatePathParam;
56
- exports.enrichForPagination = resourcePaginator.enrichForPagination;
@@ -1,16 +0,0 @@
1
- export type { WaitForOptions, WaitForStopCondition, } from './internal/async/interval-retrier.js';
2
- export type { NetworkInterceptors, RequestInterceptor, ResponseInterceptor, ResponseErrorInterceptor, } from './internal/interceptors/types';
3
- export { enableConsoleLogger, setLogger } from './internal/logger/index.js';
4
- export type { Logger } from './internal/logger/logger';
5
- export { createClient, createAdvancedClient } from './scw/client.js';
6
- export { AUTH_HEADER_KEY, SESSION_HEADER_KEY } from './scw/constants.js';
7
- export type { Client } from './scw/client.js';
8
- export type { Profile } from './scw/client-ini-profile.js';
9
- export type { Settings } from './scw/client-settings.js';
10
- export { withAdditionalInterceptors, withDefaultPageSize, withHTTPClient, withProfile, withUserAgent, withUserAgentSuffix, } from './scw/client-ini-factory.js';
11
- export type { ClientConfig } from './scw/client-ini-factory.js';
12
- export { Decimal } from './scw/custom-types.js';
13
- export type { Money, ScwFile, TimeSeries } from './scw/custom-types.js';
14
- export * as Errors from './scw/errors/standard/index.js';
15
- export type { Region, Zone } from './scw/locality';
16
- export * from './internals';
@@ -1,56 +0,0 @@
1
- import { enableConsoleLogger, setLogger } from "./internal/logger/index.js";
2
- import { createAdvancedClient, createClient } from "./scw/client.js";
3
- import { AUTH_HEADER_KEY, SESSION_HEADER_KEY } from "./scw/constants.js";
4
- import { withAdditionalInterceptors, withDefaultPageSize, withHTTPClient, withProfile, withUserAgent, withUserAgentSuffix } from "./scw/client-ini-factory.js";
5
- import { Decimal } from "./scw/custom-types.js";
6
- import * as index from "./scw/errors/standard/index.js";
7
- import { isJSONObject } from "./helpers/json.js";
8
- import { createExponentialBackoffStrategy, tryAtIntervals, waitForResource } from "./internal/async/interval-retrier.js";
9
- import { addAsyncHeaderInterceptor } from "./internal/interceptors/helpers.js";
10
- import { API } from "./scw/api.js";
11
- import { authenticateWithSessionToken } from "./scw/auth.js";
12
- import { marshalBlobToScwFile, marshalDecimal, marshalMoney, marshalScwFile, marshalTimeSeries, unmarshalAnyRes, unmarshalDecimal, unmarshalMoney, unmarshalScwFile, unmarshalServiceInfo, unmarshalTimeSeries, unmarshalTimeSeriesPoint } from "./scw/custom-marshalling.js";
13
- import { resolveOneOf, unmarshalArrayOfObject, unmarshalDate, unmarshalMapOfObject, urlParams, validatePathParam } from "./helpers/marshalling.js";
14
- import { enrichForPagination } from "./scw/fetch/resource-paginator.js";
15
- export {
16
- API,
17
- AUTH_HEADER_KEY,
18
- Decimal,
19
- index as Errors,
20
- SESSION_HEADER_KEY,
21
- addAsyncHeaderInterceptor,
22
- authenticateWithSessionToken,
23
- createAdvancedClient,
24
- createClient,
25
- createExponentialBackoffStrategy,
26
- enableConsoleLogger,
27
- enrichForPagination,
28
- isJSONObject,
29
- marshalBlobToScwFile,
30
- marshalDecimal,
31
- marshalMoney,
32
- marshalScwFile,
33
- marshalTimeSeries,
34
- resolveOneOf,
35
- setLogger,
36
- tryAtIntervals,
37
- unmarshalAnyRes,
38
- unmarshalArrayOfObject,
39
- unmarshalDate,
40
- unmarshalDecimal,
41
- unmarshalMapOfObject,
42
- unmarshalMoney,
43
- unmarshalScwFile,
44
- unmarshalServiceInfo,
45
- unmarshalTimeSeries,
46
- unmarshalTimeSeriesPoint,
47
- urlParams,
48
- validatePathParam,
49
- waitForResource,
50
- withAdditionalInterceptors,
51
- withDefaultPageSize,
52
- withHTTPClient,
53
- withProfile,
54
- withUserAgent,
55
- withUserAgentSuffix
56
- };
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const sleep = require("./sleep.cjs");
4
- const DEFAULT_TIMEOUT_SECONDS = 300;
5
- const DEFAULT_MIN_DELAY_SECONDS = 1;
6
- const DEFAULT_MAX_DELAY_SECONDS = 30;
7
- function* createExponentialBackoffStrategy(minDelay, maxDelay) {
8
- if (minDelay < 1 || maxDelay < 1 || minDelay > maxDelay) {
9
- throw new Error(
10
- "Waiter: minDelay must be >= 1 and maxDelay must be >= minDelay"
11
- );
12
- }
13
- let attempt = 1;
14
- const ceiling = Math.log(maxDelay / minDelay) / Math.log(2) + 1;
15
- const randomInRange = (min, max) => min + Math.random() * (max - min);
16
- while (true) {
17
- if (attempt > ceiling) {
18
- yield maxDelay;
19
- } else {
20
- yield randomInRange(minDelay, minDelay * 2 ** (attempt - 1));
21
- }
22
- attempt += 1;
23
- }
24
- }
25
- const tryAtIntervals = async (retry, strategy, timeout = DEFAULT_TIMEOUT_SECONDS) => {
26
- const timeoutTimestamp = Date.now() + timeout * 1e3;
27
- let retryCount = 0;
28
- while (Date.now() <= timeoutTimestamp) {
29
- const delay = strategy.next(retryCount += 1).value * 1e3;
30
- if (timeoutTimestamp <= Date.now() + delay) break;
31
- await sleep.sleep(delay);
32
- const { value, done } = await retry();
33
- if (done) return value;
34
- }
35
- throw new Error(`Timeout after ${timeout}s`);
36
- };
37
- const waitForResource = (stop, fetcher, request, options, strategy = createExponentialBackoffStrategy(
38
- options?.minDelay ?? DEFAULT_MIN_DELAY_SECONDS,
39
- options?.maxDelay ?? DEFAULT_MAX_DELAY_SECONDS
40
- )) => tryAtIntervals(
41
- async () => {
42
- const value = await fetcher(request);
43
- return {
44
- done: await stop(value),
45
- value
46
- };
47
- },
48
- strategy,
49
- options?.timeout
50
- );
51
- exports.createExponentialBackoffStrategy = createExponentialBackoffStrategy;
52
- exports.tryAtIntervals = tryAtIntervals;
53
- exports.waitForResource = waitForResource;