@scaleway/sdk-client 1.2.2 → 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/dist/bridge.d.ts CHANGED
@@ -8,5 +8,5 @@ export type { Money, ServiceInfo, ScwFile, TimeSeries, } from './scw/custom-type
8
8
  export { Decimal } from './scw/custom-types.js';
9
9
  export { marshalScwFile, marshalMoney, marshalTimeSeries, marshalDecimal, marshalBlobToScwFile, unmarshalMoney, unmarshalScwFile, unmarshalServiceInfo, unmarshalTimeSeries, unmarshalTimeSeriesPoint, unmarshalDecimal, } from './scw/custom-marshalling.js';
10
10
  export { enrichForPagination } from './scw/fetch/resource-paginator.js';
11
- export type { Region, Zone } from './scw/locality';
11
+ export type { Region, Zone } from './scw/locality.js';
12
12
  export { resolveOneOf, unmarshalDate, unmarshalArrayOfObject, unmarshalMapOfObject, urlParams, validatePathParam, } from './helpers/marshalling.js';
package/dist/index.cjs CHANGED
@@ -14,6 +14,7 @@ const auth = require("./scw/auth.cjs");
14
14
  const customMarshalling = require("./scw/custom-marshalling.cjs");
15
15
  const marshalling = require("./helpers/marshalling.cjs");
16
16
  const resourcePaginator = require("./scw/fetch/resource-paginator.cjs");
17
+ const locality = require("./scw/locality.cjs");
17
18
  exports.enableConsoleLogger = index.enableConsoleLogger;
18
19
  exports.setLogger = index.setLogger;
19
20
  exports.createAdvancedClient = client.createAdvancedClient;
@@ -54,3 +55,4 @@ exports.unmarshalMapOfObject = marshalling.unmarshalMapOfObject;
54
55
  exports.urlParams = marshalling.urlParams;
55
56
  exports.validatePathParam = marshalling.validatePathParam;
56
57
  exports.enrichForPagination = resourcePaginator.enrichForPagination;
58
+ exports.toApiLocality = locality.toApiLocality;
package/dist/index.d.ts CHANGED
@@ -12,5 +12,7 @@ export type { ClientConfig } from './scw/client-ini-factory.js';
12
12
  export { Decimal } from './scw/custom-types.js';
13
13
  export type { Money, ScwFile, TimeSeries } from './scw/custom-types.js';
14
14
  export * as Errors from './scw/errors/standard/index.js';
15
- export type { Region, Zone } from './scw/locality';
15
+ export type { Region, Zone } from './scw/locality.js';
16
16
  export * from './internals';
17
+ export { toApiLocality } from './scw/locality.js';
18
+ export type { ApiLocality } from './scw/locality.js';
package/dist/index.js CHANGED
@@ -12,6 +12,7 @@ import { authenticateWithSessionToken } from "./scw/auth.js";
12
12
  import { marshalBlobToScwFile, marshalDecimal, marshalMoney, marshalScwFile, marshalTimeSeries, unmarshalAnyRes, unmarshalDecimal, unmarshalMoney, unmarshalScwFile, unmarshalServiceInfo, unmarshalTimeSeries, unmarshalTimeSeriesPoint } from "./scw/custom-marshalling.js";
13
13
  import { resolveOneOf, unmarshalArrayOfObject, unmarshalDate, unmarshalMapOfObject, urlParams, validatePathParam } from "./helpers/marshalling.js";
14
14
  import { enrichForPagination } from "./scw/fetch/resource-paginator.js";
15
+ import { toApiLocality } from "./scw/locality.js";
15
16
  export {
16
17
  API,
17
18
  AUTH_HEADER_KEY,
@@ -33,6 +34,7 @@ export {
33
34
  marshalTimeSeries,
34
35
  resolveOneOf,
35
36
  setLogger,
37
+ toApiLocality,
36
38
  tryAtIntervals,
37
39
  unmarshalAnyRes,
38
40
  unmarshalArrayOfObject,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const version = "1.2.1";
3
+ const version = "1.2.3";
4
4
  const pkg = {
5
5
  version
6
6
  };
@@ -1,4 +1,4 @@
1
- const version = "1.2.1";
1
+ const version = "1.2.3";
2
2
  const pkg = {
3
3
  version
4
4
  };
@@ -1,4 +1,4 @@
1
- import type { Region, Zone } from './locality';
1
+ import type { Region, Zone } from './locality.js';
2
2
  /**
3
3
  * Holds access key and secret key.
4
4
  *
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ function toApiLocality(legacy) {
4
+ if (!legacy) {
5
+ return { type: "unspecified" };
6
+ }
7
+ const { zones, regions } = legacy;
8
+ if (zones && zones.length > 0) {
9
+ return { type: "zone", zones };
10
+ }
11
+ if (regions && regions.length > 0) {
12
+ return { type: "region", regions };
13
+ }
14
+ return { type: "global" };
15
+ }
16
+ exports.toApiLocality = toApiLocality;
@@ -1,2 +1,17 @@
1
1
  export type Region = 'fr-par' | 'nl-ams' | 'pl-waw' | (string & {});
2
2
  export type Zone = 'fr-par-1' | 'fr-par-2' | 'fr-par-3' | 'nl-ams-1' | 'nl-ams-2' | 'nl-ams-3' | 'pl-waw-1' | 'pl-waw-2' | 'pl-waw-3' | (string & {});
3
+ export type ApiLocality = {
4
+ type: 'zone';
5
+ zones: Zone[];
6
+ } | {
7
+ type: 'region';
8
+ regions: Region[];
9
+ } | {
10
+ type: 'global';
11
+ } | {
12
+ type: 'unspecified';
13
+ };
14
+ export declare function toApiLocality(legacy?: {
15
+ zones?: Zone[];
16
+ regions?: Region[];
17
+ }): ApiLocality;
@@ -0,0 +1,16 @@
1
+ function toApiLocality(legacy) {
2
+ if (!legacy) {
3
+ return { type: "unspecified" };
4
+ }
5
+ const { zones, regions } = legacy;
6
+ if (zones && zones.length > 0) {
7
+ return { type: "zone", zones };
8
+ }
9
+ if (regions && regions.length > 0) {
10
+ return { type: "region", regions };
11
+ }
12
+ return { type: "global" };
13
+ }
14
+ export {
15
+ toApiLocality
16
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleway/sdk-client",
3
- "version": "1.2.2",
3
+ "version": "1.3.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Scaleway SDK Client",
6
6
  "keywords": [
@@ -9,9 +9,6 @@
9
9
  "sdk",
10
10
  "client"
11
11
  ],
12
- "main": "dist/index.cjs",
13
- "module": "dist/index.js",
14
- "types": "dist/index.d.ts",
15
12
  "files": [
16
13
  "dist"
17
14
  ],
@@ -20,13 +17,21 @@
20
17
  },
21
18
  "repository": {
22
19
  "type": "git",
23
- "url": "https://github.com/scaleway/scaleway-sdk-js",
20
+ "url": "git+https://github.com/scaleway/scaleway-sdk-js",
24
21
  "directory": "packages/client"
25
22
  },
26
23
  "engines": {
27
24
  "node": ">=20.19.1"
28
25
  },
29
26
  "type": "module",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "import": "./dist/index.js",
31
+ "require": "./dist/index.cjs",
32
+ "default": "./dist/index.js"
33
+ }
34
+ },
30
35
  "scripts": {
31
36
  "typecheck": "tsc --noEmit",
32
37
  "type:generate": "tsc --declaration -p tsconfig.build.json",