@scaleway/sdk 3.0.0-alpha.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. package/dist/index.gen.d.ts +362 -0
  2. package/dist/index.gen.js +323 -0
  3. package/package.json +71 -25
  4. package/README.md +0 -46
  5. package/dist/api/account/index.js +0 -4
  6. package/dist/api/account/v2/api.gen.js +0 -147
  7. package/dist/api/account/v2/index.gen.js +0 -4
  8. package/dist/api/account/v2/marshalling.gen.js +0 -39
  9. package/dist/api/account/v3/api.gen.js +0 -129
  10. package/dist/api/account/v3/index.gen.js +0 -6
  11. package/dist/api/account/v3/marshalling.gen.js +0 -39
  12. package/dist/api/account/v3/validation-rules.gen.js +0 -39
  13. package/dist/api/applesilicon/index.js +0 -2
  14. package/dist/api/applesilicon/v1alpha1/api.gen.js +0 -220
  15. package/dist/api/applesilicon/v1alpha1/content.gen.js +0 -7
  16. package/dist/api/applesilicon/v1alpha1/index.gen.js +0 -5
  17. package/dist/api/applesilicon/v1alpha1/marshalling.gen.js +0 -113
  18. package/dist/api/baremetal/index.js +0 -2
  19. package/dist/api/baremetal/v1/api.gen.js +0 -523
  20. package/dist/api/baremetal/v1/api.utils.js +0 -27
  21. package/dist/api/baremetal/v1/content.gen.js +0 -13
  22. package/dist/api/baremetal/v1/index.js +0 -5
  23. package/dist/api/baremetal/v1/marshalling.gen.js +0 -395
  24. package/dist/api/baremetal/v1/validation-rules.gen.js +0 -109
  25. package/dist/api/billing/index.js +0 -2
  26. package/dist/api/billing/v2alpha1/api.gen.js +0 -80
  27. package/dist/api/billing/v2alpha1/index.gen.js +0 -4
  28. package/dist/api/billing/v2alpha1/marshalling.gen.js +0 -53
  29. package/dist/api/block/index.js +0 -2
  30. package/dist/api/block/v1alpha1/api.gen.js +0 -245
  31. package/dist/api/block/v1alpha1/content.gen.js +0 -13
  32. package/dist/api/block/v1alpha1/index.gen.js +0 -7
  33. package/dist/api/block/v1alpha1/marshalling.gen.js +0 -175
  34. package/dist/api/block/v1alpha1/validation-rules.gen.js +0 -42
  35. package/dist/api/cockpit/index.js +0 -2
  36. package/dist/api/cockpit/v1beta1/api.gen.js +0 -448
  37. package/dist/api/cockpit/v1beta1/content.gen.js +0 -7
  38. package/dist/api/cockpit/v1beta1/index.gen.js +0 -5
  39. package/dist/api/cockpit/v1beta1/marshalling.gen.js +0 -220
  40. package/dist/api/container/index.js +0 -2
  41. package/dist/api/container/v1beta1/api.gen.js +0 -549
  42. package/dist/api/container/v1beta1/content.gen.js +0 -22
  43. package/dist/api/container/v1beta1/index.gen.js +0 -5
  44. package/dist/api/container/v1beta1/marshalling.gen.js +0 -330
  45. package/dist/api/document_db/index.js +0 -2
  46. package/dist/api/document_db/v1beta1/api.gen.js +0 -830
  47. package/dist/api/document_db/v1beta1/content.gen.js +0 -19
  48. package/dist/api/document_db/v1beta1/index.gen.js +0 -7
  49. package/dist/api/document_db/v1beta1/marshalling.gen.js +0 -580
  50. package/dist/api/document_db/v1beta1/validation-rules.gen.js +0 -10
  51. package/dist/api/domain/index.js +0 -2
  52. package/dist/api/domain/v2beta1/api.gen.js +0 -875
  53. package/dist/api/domain/v2beta1/content.gen.js +0 -28
  54. package/dist/api/domain/v2beta1/index.gen.js +0 -7
  55. package/dist/api/domain/v2beta1/marshalling.gen.js +0 -958
  56. package/dist/api/flexibleip/index.js +0 -2
  57. package/dist/api/flexibleip/v1alpha1/api.gen.js +0 -203
  58. package/dist/api/flexibleip/v1alpha1/content.gen.js +0 -10
  59. package/dist/api/flexibleip/v1alpha1/index.gen.js +0 -7
  60. package/dist/api/flexibleip/v1alpha1/marshalling.gen.js +0 -97
  61. package/dist/api/flexibleip/v1alpha1/validation-rules.gen.js +0 -14
  62. package/dist/api/function/index.js +0 -2
  63. package/dist/api/function/v1beta1/api.gen.js +0 -560
  64. package/dist/api/function/v1beta1/content.gen.js +0 -22
  65. package/dist/api/function/v1beta1/index.gen.js +0 -5
  66. package/dist/api/function/v1beta1/marshalling.gen.js +0 -368
  67. package/dist/api/iam/index.js +0 -2
  68. package/dist/api/iam/v1alpha1/api.gen.js +0 -799
  69. package/dist/api/iam/v1alpha1/index.gen.js +0 -6
  70. package/dist/api/iam/v1alpha1/marshalling.gen.js +0 -373
  71. package/dist/api/iam/v1alpha1/validation-rules.gen.js +0 -207
  72. package/dist/api/instance/index.js +0 -2
  73. package/dist/api/instance/v1/api.gen.js +0 -1003
  74. package/dist/api/instance/v1/api.utils.js +0 -369
  75. package/dist/api/instance/v1/content.gen.js +0 -31
  76. package/dist/api/instance/v1/index.js +0 -2
  77. package/dist/api/instance/v1/marshalling.gen.js +0 -1206
  78. package/dist/api/instance/v1/marshalling.utils.js +0 -63
  79. package/dist/api/iot/index.js +0 -2
  80. package/dist/api/iot/v1/api.gen.js +0 -581
  81. package/dist/api/iot/v1/content.gen.js +0 -7
  82. package/dist/api/iot/v1/index.gen.js +0 -5
  83. package/dist/api/iot/v1/marshalling.gen.js +0 -388
  84. package/dist/api/ipfs/index.js +0 -2
  85. package/dist/api/ipfs/v1alpha1/api.gen.js +0 -197
  86. package/dist/api/ipfs/v1alpha1/content.gen.js +0 -7
  87. package/dist/api/ipfs/v1alpha1/index.gen.js +0 -5
  88. package/dist/api/ipfs/v1alpha1/marshalling.gen.js +0 -121
  89. package/dist/api/k8s/index.js +0 -2
  90. package/dist/api/k8s/v1/api.gen.js +0 -454
  91. package/dist/api/k8s/v1/api.utils.js +0 -13
  92. package/dist/api/k8s/v1/content.gen.js +0 -13
  93. package/dist/api/k8s/v1/index.js +0 -4
  94. package/dist/api/k8s/v1/marshalling.gen.js +0 -333
  95. package/dist/api/k8s/v1/validation-rules.gen.js +0 -101
  96. package/dist/api/lb/index.js +0 -2
  97. package/dist/api/lb/v1/api.gen.js +0 -1669
  98. package/dist/api/lb/v1/api.utils.js +0 -81
  99. package/dist/api/lb/v1/content.gen.js +0 -16
  100. package/dist/api/lb/v1/index.js +0 -2
  101. package/dist/api/lb/v1/marshalling.gen.js +0 -923
  102. package/dist/api/marketplace/index.js +0 -4
  103. package/dist/api/marketplace/v1/api.gen.js +0 -60
  104. package/dist/api/marketplace/v1/index.gen.js +0 -4
  105. package/dist/api/marketplace/v1/marshalling.gen.js +0 -92
  106. package/dist/api/marketplace/v2/api.gen.js +0 -162
  107. package/dist/api/marketplace/v2/index.gen.js +0 -4
  108. package/dist/api/marketplace/v2/marshalling.gen.js +0 -94
  109. package/dist/api/mnq/index.js +0 -2
  110. package/dist/api/mnq/v1alpha1/api.gen.js +0 -205
  111. package/dist/api/mnq/v1alpha1/index.gen.js +0 -4
  112. package/dist/api/mnq/v1alpha1/marshalling.gen.js +0 -121
  113. package/dist/api/rdb/index.js +0 -2
  114. package/dist/api/rdb/v1/api.gen.js +0 -972
  115. package/dist/api/rdb/v1/content.gen.js +0 -22
  116. package/dist/api/rdb/v1/index.gen.js +0 -7
  117. package/dist/api/rdb/v1/marshalling.gen.js +0 -636
  118. package/dist/api/rdb/v1/validation-rules.gen.js +0 -10
  119. package/dist/api/redis/index.js +0 -2
  120. package/dist/api/redis/v1/api.gen.js +0 -389
  121. package/dist/api/redis/v1/content.gen.js +0 -7
  122. package/dist/api/redis/v1/index.gen.js +0 -5
  123. package/dist/api/redis/v1/marshalling.gen.js +0 -259
  124. package/dist/api/registry/index.js +0 -2
  125. package/dist/api/registry/v1/api.gen.js +0 -252
  126. package/dist/api/registry/v1/content.gen.js +0 -13
  127. package/dist/api/registry/v1/index.gen.js +0 -5
  128. package/dist/api/registry/v1/marshalling.gen.js +0 -106
  129. package/dist/api/secret/index.js +0 -2
  130. package/dist/api/secret/v1alpha1/api.gen.js +0 -415
  131. package/dist/api/secret/v1alpha1/index.gen.js +0 -4
  132. package/dist/api/secret/v1alpha1/marshalling.gen.js +0 -143
  133. package/dist/api/tem/index.js +0 -2
  134. package/dist/api/tem/v1alpha1/api.gen.js +0 -229
  135. package/dist/api/tem/v1alpha1/content.gen.js +0 -10
  136. package/dist/api/tem/v1alpha1/index.gen.js +0 -5
  137. package/dist/api/tem/v1alpha1/marshalling.gen.js +0 -159
  138. package/dist/api/test/index.js +0 -2
  139. package/dist/api/test/v1/api.gen.js +0 -152
  140. package/dist/api/test/v1/content.gen.js +0 -7
  141. package/dist/api/test/v1/index.gen.js +0 -5
  142. package/dist/api/test/v1/marshalling.gen.js +0 -79
  143. package/dist/api/vpc/index.js +0 -4
  144. package/dist/api/vpc/v1/api.gen.js +0 -110
  145. package/dist/api/vpc/v1/index.gen.js +0 -4
  146. package/dist/api/vpc/v1/marshalling.gen.js +0 -44
  147. package/dist/api/vpc/v2/api.gen.js +0 -276
  148. package/dist/api/vpc/v2/index.gen.js +0 -4
  149. package/dist/api/vpc/v2/marshalling.gen.js +0 -135
  150. package/dist/api/vpcgw/index.js +0 -2
  151. package/dist/api/vpcgw/v1/api.gen.js +0 -669
  152. package/dist/api/vpcgw/v1/content.gen.js +0 -10
  153. package/dist/api/vpcgw/v1/index.gen.js +0 -5
  154. package/dist/api/vpcgw/v1/marshalling.gen.js +0 -336
  155. package/dist/api/webhosting/index.js +0 -2
  156. package/dist/api/webhosting/v1alpha1/api.gen.js +0 -210
  157. package/dist/api/webhosting/v1alpha1/content.gen.js +0 -7
  158. package/dist/api/webhosting/v1alpha1/index.gen.js +0 -7
  159. package/dist/api/webhosting/v1alpha1/marshalling.gen.js +0 -173
  160. package/dist/api/webhosting/v1alpha1/validation-rules.gen.js +0 -23
  161. package/dist/helpers/is-browser.js +0 -5
  162. package/dist/helpers/is-response.js +0 -10
  163. package/dist/helpers/json.js +0 -11
  164. package/dist/helpers/marshalling.js +0 -130
  165. package/dist/index.cjs +0 -24364
  166. package/dist/index.d.ts +0 -27584
  167. package/dist/index.js +0 -69
  168. package/dist/internal/async/interval-retrier.js +0 -105
  169. package/dist/internal/async/sleep.js +0 -13
  170. package/dist/internal/interceptors/composer.js +0 -46
  171. package/dist/internal/interceptors/helpers.js +0 -32
  172. package/dist/internal/logger/console-logger.js +0 -38
  173. package/dist/internal/logger/index.js +0 -41
  174. package/dist/internal/logger/level-resolver.js +0 -13
  175. package/dist/internal/validations/string-validation.js +0 -38
  176. package/dist/node_modules/.pnpm/@scaleway_random-name@4.0.2/node_modules/@scaleway/random-name/dist/index.js +0 -13
  177. package/dist/scw/api.js +0 -12
  178. package/dist/scw/auth.js +0 -68
  179. package/dist/scw/client-ini-factory.js +0 -174
  180. package/dist/scw/client-ini-profile.js +0 -54
  181. package/dist/scw/client-settings.js +0 -78
  182. package/dist/scw/client.js +0 -98
  183. package/dist/scw/constants.js +0 -4
  184. package/dist/scw/custom-marshalling.js +0 -131
  185. package/dist/scw/errors/error-parser.js +0 -107
  186. package/dist/scw/errors/non-standard/invalid-request-mapper.js +0 -36
  187. package/dist/scw/errors/non-standard/unknown-resource-mapper.js +0 -27
  188. package/dist/scw/errors/scw-error.js +0 -66
  189. package/dist/scw/errors/standard/already-exists-error.js +0 -26
  190. package/dist/scw/errors/standard/denied-authentication-error.js +0 -52
  191. package/dist/scw/errors/standard/index.js +0 -13
  192. package/dist/scw/errors/standard/invalid-arguments-error.js +0 -67
  193. package/dist/scw/errors/standard/out-of-stock-error.js +0 -22
  194. package/dist/scw/errors/standard/permissions-denied-error.js +0 -48
  195. package/dist/scw/errors/standard/precondition-failed-error.js +0 -42
  196. package/dist/scw/errors/standard/quotas-exceeded-error.js +0 -68
  197. package/dist/scw/errors/standard/resource-expired-error.js +0 -26
  198. package/dist/scw/errors/standard/resource-locked-error.js +0 -25
  199. package/dist/scw/errors/standard/resource-not-found-error.js +0 -25
  200. package/dist/scw/errors/standard/too-many-requests-error.js +0 -70
  201. package/dist/scw/errors/standard/transient-state-error.js +0 -26
  202. package/dist/scw/errors/types.js +0 -23
  203. package/dist/scw/fetch/build-fetcher.js +0 -72
  204. package/dist/scw/fetch/http-dumper.js +0 -54
  205. package/dist/scw/fetch/http-interceptors.js +0 -99
  206. package/dist/scw/fetch/resource-paginator.js +0 -84
  207. package/dist/scw/fetch/response-parser.js +0 -72
  208. package/node_modules/@scaleway/random-name/.npmignore +0 -4
  209. package/node_modules/@scaleway/random-name/CHANGELOG.md +0 -129
  210. package/node_modules/@scaleway/random-name/LICENSE.md +0 -21
  211. package/node_modules/@scaleway/random-name/README.md +0 -26
  212. package/node_modules/@scaleway/random-name/dist/index.d.ts +0 -3
  213. package/node_modules/@scaleway/random-name/dist/index.js +0 -13
  214. package/node_modules/@scaleway/random-name/package.json +0 -23
@@ -1,84 +0,0 @@
1
- const extract = key => result => result[key];
2
- function* pages(key, fetcher, request, firstPage) {
3
- if (!Array.isArray(firstPage[key])) {
4
- throw new Error(`Property ${key} is not a list in paginated result`);
5
- }
6
- const getList = extract(key);
7
- let page = request.page || 1;
8
- if (page === 1) {
9
- yield Promise.resolve(getList(firstPage));
10
- page += 1;
11
- }
12
- const {
13
- length
14
- } = firstPage[key];
15
- if (!length) return;
16
- const {
17
- totalCount
18
- } = firstPage;
19
- while (page <= Math.floor((totalCount + length - 1) / length)) {
20
- yield fetcher({
21
- ...request,
22
- page
23
- }).then(getList);
24
- page += 1;
25
- }
26
- }
27
-
28
- /**
29
- * Fetches a paginated resource.
30
- *
31
- * @param key - The resource key of values list
32
- * @param fetcher - The method to retrieve paginated resources
33
- * @param request - A request with pagination options
34
- * @param initial - The first page
35
- * @returns An async generator of resources arrays
36
- */
37
- function fetchPaginated(key, fetcher, request, initial) {
38
- try {
39
- if (initial === void 0) {
40
- initial = fetcher(request);
41
- }
42
- return async function* () {
43
- yield* pages(key, fetcher, request, await initial);
44
- }();
45
- } catch (e) {
46
- return Promise.reject(e);
47
- }
48
- }
49
-
50
- /**
51
- * Fetches all paginated resource.
52
- *
53
- * @param key - The resource key of values list
54
- * @param fetcher - The method to retrieve paginated resources
55
- * @param request - A request with pagination options
56
- * @param initial - The first page
57
- * @returns A resources array Promise
58
- */
59
- const fetchAll = async function (key, fetcher, request, initial) {
60
- if (initial === void 0) {
61
- initial = fetcher(request);
62
- }
63
- return (await Promise.all(Array.from(pages(key, fetcher, request, await initial)))).flat();
64
- };
65
-
66
- /**
67
- * Enriches a listing method with helpers.
68
- *
69
- * @param key - The resource key of values list
70
- * @param fetcher - The method to retrieve paginated resources
71
- * @param request - A request with pagination options
72
- * @returns A resource Promise with the pagination helpers
73
- *
74
- * @internal
75
- */
76
- const enrichForPagination = (key, fetcher, request) => {
77
- const firstPage = fetcher(request);
78
- return Object.assign(firstPage, {
79
- all: () => fetchAll(key, fetcher, request, firstPage),
80
- [Symbol.asyncIterator]: () => fetchPaginated(key, fetcher, request, firstPage)
81
- });
82
- };
83
-
84
- export { enrichForPagination, extract, fetchAll, fetchPaginated };
@@ -1,72 +0,0 @@
1
- import { isResponse } from '../../helpers/is-response.js';
2
- import { isJSONObject } from '../../helpers/json.js';
3
- import { parseScalewayError } from '../errors/error-parser.js';
4
- import { ScalewayError } from '../errors/scw-error.js';
5
-
6
- const X_TOTAL_COUNT_HEADER_KEY = 'x-total-count';
7
- const TOTAL_COUNT_RES_KEY = 'total_count';
8
-
9
- /**
10
- * Fixes the totalCount property for old APIs.
11
- *
12
- * @internal
13
- */
14
- const fixLegacyTotalCount = (obj, headers) => {
15
- const headerVal = headers.get(X_TOTAL_COUNT_HEADER_KEY);
16
- if (!headerVal) {
17
- return obj;
18
- }
19
- const totalCount = parseInt(headerVal, 10);
20
- if (Number.isNaN(totalCount)) {
21
- return obj;
22
- }
23
- if (isJSONObject(obj) && !(TOTAL_COUNT_RES_KEY in obj)) {
24
- return Object.assign(obj, {
25
- [TOTAL_COUNT_RES_KEY]: totalCount
26
- });
27
- }
28
- return obj;
29
- };
30
-
31
- /**
32
- * Makes response parser.
33
- *
34
- * @param unmarshaller - The response payload unmarshaller
35
- * @returns An async converter of HTTP Response to desired result
36
- *
37
- * @throws {@link ScalewayError}
38
- * Thrown by the API if the request couldn't be completed.
39
- *
40
- * @throws TypeError
41
- * Thrown if the response parameter isn't of the expected type.
42
- *
43
- * @throws Error
44
- * JSON parsing could trigger an error.
45
- *
46
- * @internal
47
- */
48
- const responseParser = (unmarshaller, responseType) => async response => {
49
- if (!isResponse(response)) {
50
- throw new TypeError('Invalid response object');
51
- }
52
- if (response.ok) {
53
- if (response.status === 204) return unmarshaller(undefined);
54
- const contentType = response.headers.get('Content-Type');
55
- try {
56
- if (responseType === 'json' && contentType === 'application/json') {
57
- return unmarshaller(fixLegacyTotalCount(await response.json(), response.headers));
58
- }
59
- if (responseType === 'blob') {
60
- return unmarshaller(await response.blob());
61
- }
62
- return unmarshaller(await response.text());
63
- } catch (err) {
64
- throw new ScalewayError(response.status, `could not parse '${contentType ?? ''}' response${err instanceof Error ? `: ${err.message}` : ''}`);
65
- }
66
- }
67
- const error = await response.clone().json().catch(() => response.text());
68
- if (isJSONObject(error)) throw parseScalewayError(response.status, error);
69
- throw new ScalewayError(response.status, typeof error === 'string' ? error : 'cannot read error response body');
70
- };
71
-
72
- export { fixLegacyTotalCount, responseParser };
@@ -1,4 +0,0 @@
1
- **/__tests__/**
2
- src
3
- .eslintrc.cjs
4
- !.npmignore
@@ -1,129 +0,0 @@
1
- # Change Log
2
-
3
- ## 4.0.2
4
-
5
- ### Patch Changes
6
-
7
- - [#1380](https://github.com/scaleway/scaleway-lib/pull/1380) [`c0e0d51`](https://github.com/scaleway/scaleway-lib/commit/c0e0d5104680149f9b38ae509b17d14a66c4d733) Thanks [@QuiiBz](https://github.com/QuiiBz)! - Add `exports` field & fix package lint errors
8
-
9
- All notable changes to this project will be documented in this file.
10
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
11
-
12
- ## 4.0.1 (2023-01-13)
13
-
14
- ### :package: Chore
15
-
16
- - **release:** publish ([9d6de7b](https://github.com/scaleway/scaleway-lib/commit/9d6de7b63065f53774cb64b0e5a46a868dc9933a))
17
-
18
- ### :bug: Bug Fixes
19
-
20
- - harden ts code ([#1158](https://github.com/scaleway/scaleway-lib/issues/1158)) ([7e2130e](https://github.com/scaleway/scaleway-lib/commit/7e2130ea4c2a079c69ec49b27444daa8f6076d03))
21
-
22
- ## 4.0.0 (2023-01-06)
23
-
24
- ### ⚠ BREAKING CHANGES
25
-
26
- - packages are ESM only
27
-
28
- ### :package: Chore
29
-
30
- - **release:** publish ([20c9d4f](https://github.com/scaleway/scaleway-lib/commit/20c9d4fb39822245252bf362bc7a8d26127e511d))
31
-
32
- ### :gear: Features
33
-
34
- - publish packages as ESM only ([#1145](https://github.com/scaleway/scaleway-lib/issues/1145)) ([4c25097](https://github.com/scaleway/scaleway-lib/commit/4c25097254a5ba7f0a5dbb6fdf5d6578a75f777a))
35
-
36
- ## 3.0.3 (2022-12-29)
37
-
38
- ### Bug Fixes
39
-
40
- - specify sideEffect free packages ([#1134](https://github.com/scaleway/scaleway-lib/issues/1134)) ([20510f0](https://github.com/scaleway/scaleway-lib/commit/20510f0f66fde99e682529db28fe85d580efe474))
41
-
42
- ### 3.0.2 (2022-04-08)
43
-
44
- **Note:** Version bump only for package @scaleway/random-name
45
-
46
- ### 3.0.1 (2022-03-11)
47
-
48
- **Note:** Version bump only for package @scaleway/random-name
49
-
50
- ## 3.0.0 (2021-11-18)
51
-
52
- ### ⚠ BREAKING CHANGES
53
-
54
- - **random-name:** split package in two to offer a raw and a react hook version (#500)
55
-
56
- ### Features
57
-
58
- - **random-name:** split package in two to offer a raw and a react hook version ([#500](https://github.com/scaleway/scaleway-lib/issues/500)) ([cf57f2e](https://github.com/scaleway/scaleway-lib/commit/cf57f2ed949198b68b73af0ee43945bebe59f39b))
59
-
60
- ### 2.1.1 (2021-10-21)
61
-
62
- **Note:** Version bump only for package @scaleway/random-name
63
-
64
- ## [2.1.0](https://github.com/scaleway/scaleway-lib/compare/@scaleway/random-name@2.0.0...@scaleway/random-name@2.1.0) (2021-07-21)
65
-
66
- ### Features
67
-
68
- - **random-name:** base the generator on moby and expose react hook ([#281](https://github.com/scaleway/scaleway-lib/issues/281)) ([6e986be](https://github.com/scaleway/scaleway-lib/commit/6e986beb2609e533199a2b38b989c3b8b0c3c56b))
69
-
70
- ## 2.0.0 (2021-07-20)
71
-
72
- ### ⚠ BREAKING CHANGES
73
-
74
- - migrate the codebase to typescript
75
-
76
- ### Code Refactoring
77
-
78
- - migrate to typescript ([#272](https://github.com/scaleway/scaleway-lib/issues/272)) ([3923c68](https://github.com/scaleway/scaleway-lib/commit/3923c68d6f7feadee7e2e30e32c9ef5d1f3003b9))
79
-
80
- ### 1.3.2 (2021-05-11)
81
-
82
- **Note:** Version bump only for package @scaleway/random-name
83
-
84
- ### 1.3.1 (2021-05-10)
85
-
86
- **Note:** Version bump only for package @scaleway/random-name
87
-
88
- # 1.3.0 (2021-03-04)
89
-
90
- ### Features
91
-
92
- - updated eslint setting to force carriage return before return ([3514034](https://github.com/scaleway/scaleway-lib/commit/3514034804ae06083825adc3e57003ed8dba4933))
93
-
94
- ## 1.2.1 (2021-02-15)
95
-
96
- **Note:** Version bump only for package @scaleway/random-name
97
-
98
- # 1.2.0 (2021-01-28)
99
-
100
- ### Bug Fixes
101
-
102
- - correct browser entrypoints ([2c0724d](https://github.com/scaleway/scaleway-lib/commit/2c0724d00b45664757c380188618908fcae2c606))
103
- - **random-name:** add npmignore ([d7b7e70](https://github.com/scaleway/scaleway-lib/commit/d7b7e701db4ae090650408794a380ebe084e8407))
104
-
105
- ### Features
106
-
107
- - migrate randomName from shire and scw-ui ([5729af8](https://github.com/scaleway/scaleway-lib/commit/5729af8c38a436679e948025dfff89c45a9b8e5c))
108
-
109
- ## [1.1.3](https://github.com/scaleway/scaleway-lib/compare/@scaleway/random-name@1.1.2...@scaleway/random-name@1.1.3) (2020-11-08)
110
-
111
- **Note:** Version bump only for package @scaleway/random-name
112
-
113
- ## [1.1.2](https://github.com/scaleway/scaleway-lib/compare/@scaleway/random-name@1.1.1...@scaleway/random-name@1.1.2) (2020-10-28)
114
-
115
- ### Bug Fixes
116
-
117
- - correct browser entrypoints ([8a7d0b5](https://github.com/scaleway/scaleway-lib/commit/8a7d0b503ee22eedb07d5021b3a3fd4e059e627a))
118
-
119
- ## [1.1.1](https://github.com/scaleway/scaleway-lib/compare/@scaleway/random-name@1.1.0...@scaleway/random-name@1.1.1) (2020-10-28)
120
-
121
- ### Bug Fixes
122
-
123
- - **random-name:** add npmignore ([2731b54](https://github.com/scaleway/scaleway-lib/commit/2731b5452bb33fb369ee2370156e565b5a328d42))
124
-
125
- # 1.1.0 (2020-10-28)
126
-
127
- ### Features
128
-
129
- - migrate randomName from shire and scw-ui ([331a2f9](https://github.com/scaleway/scaleway-lib/commit/331a2f91a5aa777806bbc1dc1014fc5b6987db8c))
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2021 Scaleway
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,26 +0,0 @@
1
- # `@scaleway/random-name`
2
-
3
- A tiny utility to generate random names.
4
-
5
- Fully inspired by [Moby name generator](https://github.com/moby/moby/blob/master/pkg/namesgenerator/names-generator.go)
6
-
7
- ---
8
-
9
- ## Install
10
-
11
- ```bash
12
- $ pnpm add @scaleway/random-name
13
- ```
14
-
15
- ## Usage
16
-
17
- ```js
18
- import randomName from '@scaleway/random-name'
19
-
20
- // randomName(prefix: string = '', separator: string = '-'): string
21
-
22
- randomName() // => "admiring-allen"
23
- randomName('superb') // => "superb-admiring-allen"
24
- randomName('superb', '_') // => "superb_admiring_allen"
25
- randomName('', '_') // => "admiring_allen"
26
- ```
@@ -1,3 +0,0 @@
1
- declare const randomName: (prefix?: string, separator?: string) => string;
2
-
3
- export { randomName as default };
@@ -1,13 +0,0 @@
1
- const ADJECTIVES = ['admiring', 'adoring', 'affectionate', 'agitated', 'amazing', 'angry', 'awesome', 'beautiful', 'blissful', 'bold', 'boring', 'brave', 'busy', 'charming', 'clever', 'cool', 'compassionate', 'competent', 'condescending', 'confident', 'cranky', 'crazy', 'dazzling', 'determined', 'distracted', 'dreamy', 'eager', 'ecstatic', 'elastic', 'elated', 'elegant', 'eloquent', 'epic', 'exciting', 'fervent', 'festive', 'flamboyant', 'focused', 'friendly', 'frosty', 'funny', 'gallant', 'gifted', 'goofy', 'gracious', 'great', 'happy', 'hardcore', 'heuristic', 'hopeful', 'hungry', 'infallible', 'inspiring', 'interesting', 'intelligent', 'jolly', 'jovial', 'keen', 'kind', 'laughing', 'loving', 'lucid', 'magical', 'mystifying', 'modest', 'musing', 'naughty', 'nervous', 'nice', 'nifty', 'nostalgic', 'objective', 'optimistic', 'peaceful', 'pedantic', 'pensive', 'practical', 'priceless', 'quirky', 'quizzical', 'recursing', 'relaxed', 'reverent', 'romantic', 'sad', 'serene', 'sharp', 'silly', 'sleepy', 'stoic', 'strange', 'stupefied', 'suspicious', 'sweet', 'tender', 'thirsty', 'trusting', 'unruffled', 'upbeat', 'vibrant', 'vigilant', 'vigorous', 'wizardly', 'wonderful', 'xenodochial', 'youthful', 'zealous', 'zen'];
2
- const NAMES = ['albattani', 'allen', 'almeida', 'antonelli', 'agnesi', 'archimedes', 'ardinghelli', 'aryabhata', 'austin', 'babbage', 'banach', 'banzai', 'bardeen', 'bartik', 'bassi', 'beaver', 'bell', 'benz', 'bhabha', 'bhaskara', 'black', 'blackburn', 'blackwell', 'bohr', 'booth', 'borg', 'bose', 'bouman', 'boyd', 'brahmagupta', 'brattain', 'brown', 'buck', 'burnell', 'cannon', 'carson', 'cartwright', 'carver', 'cerf', 'chandrasekhar', 'chaplygin', 'chatelet', 'chatterjee', 'chebyshev', 'cohen', 'chaum', 'clarke', 'colden', 'cori', 'cray', 'curran', 'curie', 'darwin', 'davinci', 'dewdney', 'dhawan', 'diffie', 'dijkstra', 'dirac', 'driscoll', 'dubinsky', 'easley', 'edison', 'einstein', 'elbakyan', 'elgamal', 'elion', 'ellis', 'engelbart', 'euclid', 'euler', 'faraday', 'feistel', 'fermat', 'fermi', 'feynman', 'franklin', 'gagarin', 'galileo', 'galois', 'ganguly', 'gates', 'gauss', 'germain', 'goldberg', 'goldstine', 'goldwasser', 'golick', 'goodall', 'gould', 'greider', 'grothendieck', 'haibt', 'hamilton', 'haslett', 'hawking', 'hellman', 'heisenberg', 'hermann', 'herschel', 'hertz', 'heyrovsky', 'hodgkin', 'hofstadter', 'hoover', 'hopper', 'hugle', 'hypatia', 'ishizaka', 'jackson', 'jang', 'jemison', 'jennings', 'jepsen', 'johnson', 'joliot', 'jones', 'kalam', 'kapitsa', 'kare', 'keldysh', 'keller', 'kepler', 'khayyam', 'khorana', 'kilby', 'kirch', 'knuth', 'kowalevski', 'lalande', 'lamarr', 'lamport', 'leakey', 'leavitt', 'lederberg', 'lehmann', 'lewin', 'lichterman', 'liskov', 'lovelace', 'lumiere', 'mahavira', 'margulis', 'matsumoto', 'maxwell', 'mayer', 'mccarthy', 'mcclintock', 'mclaren', 'mclean', 'mcnulty', 'mendel', 'mendeleev', 'meitner', 'meninsky', 'merkle', 'mestorf', 'mirzakhani', 'montalcini', 'moore', 'morse', 'murdock', 'moser', 'napier', 'nash', 'neumann', 'newton', 'nightingale', 'nobel', 'noether', 'northcutt', 'noyce', 'panini', 'pare', 'pascal', 'pasteur', 'payne', 'perlman', 'pike', 'poincare', 'poitras', 'proskuriakova', 'ptolemy', 'raman', 'ramanujan', 'ride', 'ritchie', 'rhodes', 'robinson', 'roentgen', 'rosalind', 'rubin', 'saha', 'sammet', 'sanderson', 'satoshi', 'shamir', 'shannon', 'shaw', 'shirley', 'shockley', 'shtern', 'sinoussi', 'snyder', 'solomon', 'spence', 'stonebraker', 'sutherland', 'swanson', 'swartz', 'swirles', 'taussig', 'tereshkova', 'tesla', 'tharp', 'thompson', 'torvalds', 'tu', 'turing', 'varahamihira', 'vaughan', 'visvesvaraya', 'volhard', 'villani', 'wescoff', 'wilbur', 'wiles', 'williams', 'williamson', 'wilson', 'wing', 'wozniak', 'wright', 'wu', 'yalow', 'yonath', 'zhukovsky'];
3
- const randomName = function () {
4
- let prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
5
- let separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '-';
6
- const name = `${ADJECTIVES[Math.floor(Math.random() * ADJECTIVES.length)] ?? ''}${separator}${NAMES[Math.floor(Math.random() * NAMES.length)] ?? ''}`;
7
- if (name === `boring${separator}wozniak`) {
8
- return randomName(prefix, separator);
9
- }
10
- return prefix.length > 0 ? `${prefix}${separator}${name}` : name;
11
- };
12
-
13
- export { randomName as default };
@@ -1,23 +0,0 @@
1
- {
2
- "name": "@scaleway/random-name",
3
- "version": "4.0.2",
4
- "description": "A small utility to generate a random name",
5
- "type": "module",
6
- "engines": {
7
- "node": ">=14.x"
8
- },
9
- "sideEffects": false,
10
- "exports": {
11
- "types": "./dist/index.d.ts",
12
- "default": "./dist/index.js"
13
- },
14
- "publishConfig": {
15
- "access": "public"
16
- },
17
- "repository": {
18
- "type": "git",
19
- "url": "https://github.com/scaleway/scaleway-lib",
20
- "directory": "packages/random-name"
21
- },
22
- "license": "MIT"
23
- }