@scaleway/sdk 2.4.0 → 2.4.2

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.
@@ -34,7 +34,7 @@ class API extends API$1 {
34
34
  }, unmarshalJobDefinition);
35
35
  getJobDefinition = request => this.client.fetch({
36
36
  method: 'GET',
37
- path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-definitions/${validatePathParam('id', request.id)}`
37
+ path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-definitions/${validatePathParam('jobDefinitionId', request.jobDefinitionId)}`
38
38
  }, unmarshalJobDefinition);
39
39
  pageOfListJobDefinitions = (() => {
40
40
  var _this2 = this;
@@ -62,27 +62,27 @@ class API extends API$1 {
62
62
  body: JSON.stringify(marshalUpdateJobDefinitionRequest(request, this.client.settings)),
63
63
  headers: jsonContentHeaders,
64
64
  method: 'PATCH',
65
- path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-definitions/${validatePathParam('id', request.id)}`
65
+ path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-definitions/${validatePathParam('jobDefinitionId', request.jobDefinitionId)}`
66
66
  }, unmarshalJobDefinition);
67
67
  deleteJobDefinition = request => this.client.fetch({
68
68
  method: 'DELETE',
69
- path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-definitions/${validatePathParam('id', request.id)}`
69
+ path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-definitions/${validatePathParam('jobDefinitionId', request.jobDefinitionId)}`
70
70
  });
71
71
  startJobDefinition = request => this.client.fetch({
72
72
  body: '{}',
73
73
  headers: jsonContentHeaders,
74
74
  method: 'POST',
75
- path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-definitions/${validatePathParam('id', request.id)}/start`
75
+ path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-definitions/${validatePathParam('jobDefinitionId', request.jobDefinitionId)}/start`
76
76
  }, unmarshalJobRun);
77
77
  getJobRun = request => this.client.fetch({
78
78
  method: 'GET',
79
- path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-runs/${validatePathParam('id', request.id)}`
79
+ path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-runs/${validatePathParam('jobRunId', request.jobRunId)}`
80
80
  }, unmarshalJobRun);
81
81
  stopJobRun = request => this.client.fetch({
82
82
  body: '{}',
83
83
  headers: jsonContentHeaders,
84
84
  method: 'POST',
85
- path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-runs/${validatePathParam('id', request.id)}/stop`
85
+ path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-runs/${validatePathParam('jobRunId', request.jobRunId)}/stop`
86
86
  }, unmarshalJobRun);
87
87
  pageOfListJobRuns = (() => {
88
88
  var _this4 = this;
@@ -93,7 +93,7 @@ class API extends API$1 {
93
93
  return _this4.client.fetch({
94
94
  method: 'GET',
95
95
  path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? _this4.client.settings.defaultRegion)}/job-runs`,
96
- urlParams: urlParams(['id', request.id], ['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ?? _this4.client.settings.defaultPageSize], ['project_id', request.projectId])
96
+ urlParams: urlParams(['job_definition_id', request.jobDefinitionId], ['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ?? _this4.client.settings.defaultPageSize], ['project_id', request.projectId])
97
97
  }, unmarshalListJobRunsResponse);
98
98
  };
99
99
  })();
package/dist/index.cjs CHANGED
@@ -497,7 +497,7 @@ const assertValidSettings = obj => {
497
497
  }
498
498
  };
499
499
 
500
- const version = 'v2.3.0';
500
+ const version = 'v2.4.1';
501
501
  const userAgent = `scaleway-sdk-js/${version}`;
502
502
 
503
503
  const isBrowser = () =>
@@ -16287,7 +16287,7 @@ let API$e = class API extends API$v {
16287
16287
  }, unmarshalJobDefinition);
16288
16288
  getJobDefinition = request => this.client.fetch({
16289
16289
  method: 'GET',
16290
- path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-definitions/${validatePathParam('id', request.id)}`
16290
+ path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-definitions/${validatePathParam('jobDefinitionId', request.jobDefinitionId)}`
16291
16291
  }, unmarshalJobDefinition);
16292
16292
  pageOfListJobDefinitions = (request = {}) => this.client.fetch({
16293
16293
  method: 'GET',
@@ -16299,32 +16299,32 @@ let API$e = class API extends API$v {
16299
16299
  body: JSON.stringify(marshalUpdateJobDefinitionRequest(request, this.client.settings)),
16300
16300
  headers: jsonContentHeaders$d,
16301
16301
  method: 'PATCH',
16302
- path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-definitions/${validatePathParam('id', request.id)}`
16302
+ path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-definitions/${validatePathParam('jobDefinitionId', request.jobDefinitionId)}`
16303
16303
  }, unmarshalJobDefinition);
16304
16304
  deleteJobDefinition = request => this.client.fetch({
16305
16305
  method: 'DELETE',
16306
- path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-definitions/${validatePathParam('id', request.id)}`
16306
+ path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-definitions/${validatePathParam('jobDefinitionId', request.jobDefinitionId)}`
16307
16307
  });
16308
16308
  startJobDefinition = request => this.client.fetch({
16309
16309
  body: '{}',
16310
16310
  headers: jsonContentHeaders$d,
16311
16311
  method: 'POST',
16312
- path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-definitions/${validatePathParam('id', request.id)}/start`
16312
+ path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-definitions/${validatePathParam('jobDefinitionId', request.jobDefinitionId)}/start`
16313
16313
  }, unmarshalJobRun);
16314
16314
  getJobRun = request => this.client.fetch({
16315
16315
  method: 'GET',
16316
- path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-runs/${validatePathParam('id', request.id)}`
16316
+ path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-runs/${validatePathParam('jobRunId', request.jobRunId)}`
16317
16317
  }, unmarshalJobRun);
16318
16318
  stopJobRun = request => this.client.fetch({
16319
16319
  body: '{}',
16320
16320
  headers: jsonContentHeaders$d,
16321
16321
  method: 'POST',
16322
- path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-runs/${validatePathParam('id', request.id)}/stop`
16322
+ path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-runs/${validatePathParam('jobRunId', request.jobRunId)}/stop`
16323
16323
  }, unmarshalJobRun);
16324
16324
  pageOfListJobRuns = (request = {}) => this.client.fetch({
16325
16325
  method: 'GET',
16326
16326
  path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-runs`,
16327
- urlParams: urlParams(['id', request.id], ['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['project_id', request.projectId])
16327
+ urlParams: urlParams(['job_definition_id', request.jobDefinitionId], ['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['project_id', request.projectId])
16328
16328
  }, unmarshalListJobRunsResponse);
16329
16329
  listJobRuns = (request = {}) => enrichForPagination('jobRuns', this.pageOfListJobRuns, request);
16330
16330
  };
@@ -26704,6 +26704,7 @@ exports.addAsyncHeaderInterceptor = addAsyncHeaderInterceptor;
26704
26704
  exports.authenticateWithSessionToken = authenticateWithSessionToken;
26705
26705
  exports.createAdvancedClient = createAdvancedClient;
26706
26706
  exports.createClient = createClient;
26707
+ exports.createExponentialBackoffStrategy = createExponentialBackoffStrategy;
26707
26708
  exports.enableConsoleLogger = enableConsoleLogger;
26708
26709
  exports.enrichForPagination = enrichForPagination;
26709
26710
  exports.isJSONObject = isJSONObject;
@@ -26712,6 +26713,7 @@ exports.marshalScwFile = marshalScwFile;
26712
26713
  exports.marshalTimeSeries = marshalTimeSeries;
26713
26714
  exports.resolveOneOf = resolveOneOf;
26714
26715
  exports.setLogger = setLogger;
26716
+ exports.tryAtIntervals = tryAtIntervals;
26715
26717
  exports.unmarshalArrayOfObject = unmarshalArrayOfObject;
26716
26718
  exports.unmarshalDate = unmarshalDate;
26717
26719
  exports.unmarshalMapOfObject = unmarshalMapOfObject;
package/dist/index.d.ts CHANGED
@@ -1,9 +1,41 @@
1
+ /**
2
+ * Function to retry logic between each interval.
3
+ *
4
+ * @returns The result and if it's done
5
+ *
6
+ * @throws An exception might be thrown by the logic being run
7
+ *
8
+ * @internal
9
+ */
10
+ type Retry<T> = () => Promise<IteratorResult<T, T>>;
1
11
  /**
2
12
  * Generated interval strategy iterator.
3
13
  *
4
14
  * @internal
5
15
  */
6
16
  type IntervalStrategy = Generator<number, never | number, number>;
17
+ /**
18
+ * Creates an exponential backoff interval strategy.
19
+ *
20
+ * @param minDelay - The minimum delay before the next try in seconds
21
+ * @param maxDelay - The maximum delay before the next try in seconds
22
+ * @returns An exponential backoff generator
23
+ *
24
+ * @internal
25
+ */
26
+ declare function createExponentialBackoffStrategy(minDelay: number, maxDelay: number): IntervalStrategy;
27
+ /**
28
+ * Tries a specific logic several times until it succeeds, timeouts, or throws an exception.
29
+ *
30
+ * @param retry - The function to retry logic between each interval
31
+ * @param strategy - A generated interval strategy iterator
32
+ * @param timeout - The maximum time elapsed before timeout error
33
+ *
34
+ * @throws An timeout exception or error thrown by the logic being run
35
+ *
36
+ * @internal
37
+ */
38
+ declare const tryAtIntervals: <T>(retry: Retry<T>, strategy: IntervalStrategy, timeout?: number) => Promise<T>;
7
39
  /**
8
40
  * Represents the condition to stop waiting for a resource.
9
41
  *
@@ -17222,7 +17254,7 @@ type DeleteJobDefinitionRequest = {
17222
17254
  * config.
17223
17255
  */
17224
17256
  region?: Region;
17225
- id: string;
17257
+ jobDefinitionId: string;
17226
17258
  };
17227
17259
  type GetJobDefinitionRequest = {
17228
17260
  /**
@@ -17230,7 +17262,7 @@ type GetJobDefinitionRequest = {
17230
17262
  * config.
17231
17263
  */
17232
17264
  region?: Region;
17233
- id: string;
17265
+ jobDefinitionId: string;
17234
17266
  };
17235
17267
  type GetJobRunRequest = {
17236
17268
  /**
@@ -17238,7 +17270,7 @@ type GetJobRunRequest = {
17238
17270
  * config.
17239
17271
  */
17240
17272
  region?: Region;
17241
- id: string;
17273
+ jobRunId: string;
17242
17274
  };
17243
17275
  type GetServiceInfoRequest = {
17244
17276
  /**
@@ -17271,7 +17303,7 @@ type ListJobRunsRequest$1 = {
17271
17303
  page?: number;
17272
17304
  pageSize?: number;
17273
17305
  orderBy?: ListJobRunsRequestOrderBy;
17274
- id?: string;
17306
+ jobDefinitionId?: string;
17275
17307
  projectId?: string;
17276
17308
  };
17277
17309
  interface ListJobRunsResponse {
@@ -17284,7 +17316,7 @@ type StartJobDefinitionRequest = {
17284
17316
  * config.
17285
17317
  */
17286
17318
  region?: Region;
17287
- id: string;
17319
+ jobDefinitionId: string;
17288
17320
  };
17289
17321
  type StopJobRunRequest = {
17290
17322
  /**
@@ -17292,7 +17324,7 @@ type StopJobRunRequest = {
17292
17324
  * config.
17293
17325
  */
17294
17326
  region?: Region;
17295
- id: string;
17327
+ jobRunId: string;
17296
17328
  };
17297
17329
  type UpdateJobDefinitionRequest$1 = {
17298
17330
  /**
@@ -17300,7 +17332,7 @@ type UpdateJobDefinitionRequest$1 = {
17300
17332
  * config.
17301
17333
  */
17302
17334
  region?: Region;
17303
- id: string;
17335
+ jobDefinitionId: string;
17304
17336
  name?: string;
17305
17337
  cpuLimit?: number;
17306
17338
  memoryLimit?: number;
@@ -31661,4 +31693,4 @@ declare namespace index {
31661
31693
  export { index_gen as v1alpha1 };
31662
31694
  }
31663
31695
 
31664
- export { API$v as API, index$x as Account, index$w as AppleSilicon, index$u as BareMetal, index$t as Billing, index$s as Block, type Client, type ClientConfig, index$r as Cockpit, index$q as Container, type DefaultValues, index$p as DocumentDB, index$o as Domain, index$y as Errors, index$n as FlexibleIP, index$m as Function, index$l as IAM, index$i as IOT, index$h as IPAM, index$g as IPFS, index$j as Instance, index$f as Jobs, index$d as K8S, index$b as LB, type Logger, index$9 as MNQ, index$a as Marketplace, type Money, type NetworkInterceptors, type Profile, index$8 as RDB, index$7 as Redis, type Region, index$6 as Registry, type RequestInterceptor, type ResponseErrorInterceptor, type ResponseInterceptor, type ScwFile, index$5 as Secret, type ServiceInfo, type Settings, index_gen$6 as Std, index$4 as Test, type TimeSeries, index$3 as TransactionalEmail, index$2 as VPC, index$1 as VPCGW, type WaitForOptions, type WaitForStopCondition, index as Webhosting, type Zone, addAsyncHeaderInterceptor, authenticateWithSessionToken, createAdvancedClient, createClient, enableConsoleLogger, enrichForPagination, isJSONObject, marshalMoney, marshalScwFile, marshalTimeSeries, resolveOneOf, setLogger, unmarshalArrayOfObject, unmarshalDate, unmarshalMapOfObject, unmarshalMoney, unmarshalScwFile, unmarshalServiceInfo, unmarshalTimeSeries, unmarshalTimeSeriesPoint, urlParams, validatePathParam, waitForResource, withAdditionalInterceptors, withDefaultPageSize, withHTTPClient, withProfile, withUserAgent, withUserAgentSuffix };
31696
+ export { API$v as API, index$x as Account, index$w as AppleSilicon, index$u as BareMetal, index$t as Billing, index$s as Block, type Client, type ClientConfig, index$r as Cockpit, index$q as Container, type DefaultValues, index$p as DocumentDB, index$o as Domain, index$y as Errors, index$n as FlexibleIP, index$m as Function, index$l as IAM, index$i as IOT, index$h as IPAM, index$g as IPFS, index$j as Instance, index$f as Jobs, index$d as K8S, index$b as LB, type Logger, index$9 as MNQ, index$a as Marketplace, type Money, type NetworkInterceptors, type Profile, index$8 as RDB, index$7 as Redis, type Region, index$6 as Registry, type RequestInterceptor, type ResponseErrorInterceptor, type ResponseInterceptor, type ScwFile, index$5 as Secret, type ServiceInfo, type Settings, index_gen$6 as Std, index$4 as Test, type TimeSeries, index$3 as TransactionalEmail, index$2 as VPC, index$1 as VPCGW, type WaitForOptions, type WaitForStopCondition, index as Webhosting, type Zone, addAsyncHeaderInterceptor, authenticateWithSessionToken, createAdvancedClient, createClient, createExponentialBackoffStrategy, enableConsoleLogger, enrichForPagination, isJSONObject, marshalMoney, marshalScwFile, marshalTimeSeries, resolveOneOf, setLogger, tryAtIntervals, unmarshalArrayOfObject, unmarshalDate, unmarshalMapOfObject, unmarshalMoney, unmarshalScwFile, unmarshalServiceInfo, unmarshalTimeSeries, unmarshalTimeSeriesPoint, urlParams, validatePathParam, waitForResource, withAdditionalInterceptors, withDefaultPageSize, withHTTPClient, withProfile, withUserAgent, withUserAgentSuffix };
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ export { withAdditionalInterceptors, withDefaultPageSize, withHTTPClient, withPr
4
4
  import * as index from './scw/errors/standard/index.js';
5
5
  export { index as Errors };
6
6
  export { isJSONObject } from './helpers/json.js';
7
- export { waitForResource } from './internal/async/interval-retrier.js';
7
+ export { createExponentialBackoffStrategy, tryAtIntervals, waitForResource } from './internal/async/interval-retrier.js';
8
8
  export { addAsyncHeaderInterceptor } from './internal/interceptors/helpers.js';
9
9
  export { API } from './scw/api.js';
10
10
  export { authenticateWithSessionToken } from './scw/auth.js';
@@ -1,4 +1,4 @@
1
- const version = 'v2.3.0';
1
+ const version = 'v2.4.1';
2
2
  const userAgent = `scaleway-sdk-js/${version}`;
3
3
 
4
4
  export { userAgent, version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleway/sdk",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Scaleway SDK.",
6
6
  "keywords": [
@@ -35,5 +35,5 @@
35
35
  "bundledDependencies": [
36
36
  "@scaleway/random-name"
37
37
  ],
38
- "gitHead": "fa1757c65ee02addb3038d711a8b5b991bee0802"
38
+ "gitHead": "ff1e68177fcbabd67296ee90ca447c5c6c374cc9"
39
39
  }