@scaleway/sdk 0.1.0-beta.9 → 1.0.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/README.md +1 -1
- package/dist/api/account/index.js +2 -2
- package/dist/api/account/v2/api.gen.js +5 -18
- package/dist/api/account/v2/index.gen.js +3 -0
- package/dist/api/account/v2/marshalling.gen.js +0 -2
- package/dist/api/account/v2alpha1/api.gen.js +3 -13
- package/dist/api/account/v2alpha1/marshalling.gen.js +0 -5
- package/dist/api/applesilicon/index.js +2 -2
- package/dist/api/applesilicon/v1alpha1/api.gen.js +7 -27
- package/dist/api/applesilicon/v1alpha1/index.gen.js +4 -0
- package/dist/api/applesilicon/v1alpha1/marshalling.gen.js +1 -14
- package/dist/api/baremetal/v1/api.gen.js +47 -49
- package/dist/api/baremetal/v1/api.utils.js +2 -10
- package/dist/api/baremetal/v1/content.gen.js +6 -3
- package/dist/api/baremetal/v1/index.js +4 -1
- package/dist/api/baremetal/v1/marshalling.gen.js +44 -45
- package/dist/api/baremetal/v1/validation-rules.gen.js +109 -0
- package/dist/api/container/index.js +2 -2
- package/dist/api/container/v1beta1/api.gen.js +5 -51
- package/dist/api/container/v1beta1/content.gen.js +4 -4
- package/dist/api/container/v1beta1/{index.js → index.gen.js} +3 -1
- package/dist/api/container/v1beta1/marshalling.gen.js +12 -26
- package/dist/api/domain/index.js +2 -2
- package/dist/api/domain/v2beta1/api.gen.js +55 -85
- package/dist/api/domain/v2beta1/content.gen.js +22 -1
- package/dist/api/domain/v2beta1/index.gen.js +4 -0
- package/dist/api/domain/v2beta1/marshalling.gen.js +47 -165
- package/dist/api/flexibleip/index.js +2 -2
- package/dist/api/flexibleip/v1alpha1/api.gen.js +5 -22
- package/dist/api/flexibleip/v1alpha1/content.gen.js +1 -1
- package/dist/api/flexibleip/v1alpha1/index.gen.js +6 -0
- package/dist/api/flexibleip/v1alpha1/marshalling.gen.js +0 -7
- package/dist/api/flexibleip/v1alpha1/validation-rules.gen.js +14 -0
- package/dist/api/function/index.js +2 -2
- package/dist/api/function/v1beta1/api.gen.js +54 -57
- package/dist/api/function/v1beta1/content.gen.js +8 -5
- package/dist/api/function/v1beta1/index.gen.js +4 -0
- package/dist/api/function/v1beta1/marshalling.gen.js +125 -33
- package/dist/api/iam/index.js +2 -2
- package/dist/api/iam/v1alpha1/api.gen.js +15 -62
- package/dist/api/iam/v1alpha1/index.gen.js +5 -0
- package/dist/api/iam/v1alpha1/marshalling.gen.js +7 -29
- package/dist/api/iam/v1alpha1/validation-rules.gen.js +184 -0
- package/dist/api/instance/v1/api.gen.js +38 -118
- package/dist/api/instance/v1/api.utils.js +59 -51
- package/dist/api/instance/v1/content.gen.js +7 -7
- package/dist/api/instance/v1/marshalling.gen.js +46 -168
- package/dist/api/instance/v1/marshalling.utils.js +63 -0
- package/dist/api/iot/index.js +2 -2
- package/dist/api/iot/v1/api.gen.js +5 -56
- package/dist/api/iot/v1/index.gen.js +4 -0
- package/dist/api/iot/v1/marshalling.gen.js +2 -51
- package/dist/api/k8s/index.js +2 -2
- package/dist/api/k8s/v1/api.gen.js +17 -43
- package/dist/api/k8s/v1/content.gen.js +2 -2
- package/dist/api/k8s/v1/index.gen.js +6 -0
- package/dist/api/k8s/v1/marshalling.gen.js +18 -36
- package/dist/api/k8s/v1/validation-rules.gen.js +92 -0
- package/dist/api/lb/v1/api.gen.js +8 -163
- package/dist/api/lb/v1/api.utils.js +3 -9
- package/dist/api/lb/v1/content.gen.js +3 -3
- package/dist/api/lb/v1/marshalling.gen.js +74 -101
- package/dist/api/marketplace/index.js +4 -2
- package/dist/api/marketplace/v1/api.gen.js +3 -13
- package/dist/api/marketplace/v1/index.gen.js +3 -0
- package/dist/api/marketplace/v1/marshalling.gen.js +0 -13
- package/dist/api/marketplace/v2/api.gen.js +85 -0
- package/dist/api/marketplace/v2/index.gen.js +3 -0
- package/dist/api/marketplace/v2/marshalling.gen.js +92 -0
- package/dist/api/mnq/index.js +2 -2
- package/dist/api/mnq/v1alpha1/api.gen.js +7 -25
- package/dist/api/mnq/v1alpha1/index.gen.js +3 -0
- package/dist/api/mnq/v1alpha1/marshalling.gen.js +7 -46
- package/dist/api/rdb/index.js +2 -2
- package/dist/api/rdb/v1/api.gen.js +15 -89
- package/dist/api/rdb/v1/content.gen.js +10 -4
- package/dist/api/rdb/v1/index.gen.js +4 -0
- package/dist/api/rdb/v1/marshalling.gen.js +25 -81
- package/dist/api/redis/index.js +2 -2
- package/dist/api/redis/{v1alpha1 → v1}/api.gen.js +45 -77
- package/dist/api/redis/{v1alpha1 → v1}/content.gen.js +1 -1
- package/dist/api/redis/v1/index.gen.js +4 -0
- package/dist/api/redis/{v1alpha1 → v1}/marshalling.gen.js +42 -59
- package/dist/api/registry/index.js +2 -2
- package/dist/api/registry/v1/api.gen.js +5 -29
- package/dist/api/registry/v1/content.gen.js +2 -2
- package/dist/api/registry/v1/{index.js → index.gen.js} +3 -1
- package/dist/api/registry/v1/marshalling.gen.js +2 -8
- package/dist/api/secret/index.js +2 -0
- package/dist/api/secret/v1alpha1/api.gen.js +135 -0
- package/dist/api/secret/v1alpha1/index.gen.js +3 -0
- package/dist/api/secret/v1alpha1/marshalling.gen.js +82 -0
- package/dist/api/tem/index.js +2 -0
- package/dist/api/tem/v1alpha1/api.gen.js +109 -0
- package/dist/api/tem/v1alpha1/content.gen.js +10 -0
- package/dist/api/tem/v1alpha1/index.gen.js +4 -0
- package/dist/api/tem/v1alpha1/marshalling.gen.js +132 -0
- package/dist/api/test/index.js +2 -2
- package/dist/api/test/v1/api.gen.js +6 -20
- package/dist/api/test/v1/index.gen.js +4 -0
- package/dist/api/test/v1/marshalling.gen.js +2 -5
- package/dist/api/vpc/index.js +2 -2
- package/dist/api/vpc/v1/api.gen.js +6 -17
- package/dist/api/vpc/v1/index.gen.js +3 -0
- package/dist/api/vpc/v1/marshalling.gen.js +1 -3
- package/dist/api/vpcgw/index.js +2 -2
- package/dist/api/vpcgw/v1/api.gen.js +5 -64
- package/dist/api/vpcgw/v1/content.gen.js +2 -2
- package/dist/api/vpcgw/v1/{index.js → index.gen.js} +3 -1
- package/dist/api/vpcgw/v1/marshalling.gen.js +3 -24
- package/dist/helpers/json.js +1 -2
- package/dist/helpers/marshalling.js +7 -20
- package/dist/index.cjs +3864 -2945
- package/dist/index.d.ts +7212 -4332
- package/dist/index.js +10 -6
- package/dist/internal/async/interval-retrier.js +10 -16
- package/dist/internal/interceptors/interceptor.js +3 -1
- package/dist/internal/interceptors/request.js +1 -3
- package/dist/internal/logger/console-logger.js +3 -5
- package/dist/internal/logger/index.js +3 -5
- package/dist/internal/logger/level-resolver.js +0 -3
- package/dist/internal/validations/string-validation.js +8 -10
- package/dist/node_modules/.pnpm/@scaleway_random-name@4.0.1/node_modules/@scaleway/random-name/dist/index.js +13 -0
- package/dist/scw/api.js +3 -4
- package/dist/scw/auth.js +3 -5
- package/dist/scw/client-ini-factory.js +32 -15
- package/dist/scw/client-ini-profile.js +10 -4
- package/dist/scw/client-settings.js +32 -15
- package/dist/scw/client.js +5 -6
- package/dist/scw/constants.js +1 -1
- package/dist/scw/custom-marshalling.js +8 -14
- package/dist/scw/errors/error-parser.js +2 -21
- package/dist/scw/errors/non-standard/invalid-request-mapper.js +17 -15
- package/dist/scw/errors/non-standard/unknown-resource-mapper.js +7 -6
- package/dist/scw/errors/scw-error.js +20 -20
- package/dist/scw/errors/standard/already-exists-error.js +3 -4
- package/dist/scw/errors/standard/denied-authentication-error.js +4 -11
- package/dist/scw/errors/standard/invalid-arguments-error.js +1 -10
- package/dist/scw/errors/standard/out-of-stock-error.js +0 -3
- package/dist/scw/errors/standard/permissions-denied-error.js +1 -4
- package/dist/scw/errors/standard/precondition-failed-error.js +4 -8
- package/dist/scw/errors/standard/quotas-exceeded-error.js +14 -14
- package/dist/scw/errors/standard/resource-expired-error.js +3 -4
- package/dist/scw/errors/standard/resource-locked-error.js +3 -4
- package/dist/scw/errors/standard/resource-not-found-error.js +3 -4
- package/dist/scw/errors/standard/too-many-requests-error.js +3 -16
- package/dist/scw/errors/standard/transient-state-error.js +3 -4
- package/dist/scw/errors/types.js +0 -3
- package/dist/scw/fetch/build-fetcher.js +1 -9
- package/dist/scw/fetch/http-dumper.js +4 -7
- package/dist/scw/fetch/http-interceptors.js +9 -12
- package/dist/scw/fetch/resource-paginator.js +18 -16
- package/dist/scw/fetch/response-parser.js +17 -23
- package/node_modules/@scaleway/random-name/CHANGELOG.md +42 -63
- package/node_modules/@scaleway/random-name/dist/index.js +5 -246
- package/node_modules/@scaleway/random-name/package.json +6 -5
- package/package.json +4 -5
- package/dist/api/account/v2/index.js +0 -1
- package/dist/api/applesilicon/v1alpha1/index.js +0 -2
- package/dist/api/domain/v2beta1/index.js +0 -2
- package/dist/api/flexibleip/v1alpha1/index.js +0 -2
- package/dist/api/function/v1beta1/index.js +0 -2
- package/dist/api/iam/v1alpha1/index.js +0 -1
- package/dist/api/iot/v1/index.js +0 -2
- package/dist/api/k8s/v1/index.js +0 -2
- package/dist/api/marketplace/v1/index.js +0 -1
- package/dist/api/mnq/v1alpha1/index.js +0 -1
- package/dist/api/rdb/v1/index.js +0 -2
- package/dist/api/redis/v1alpha1/index.js +0 -2
- package/dist/api/test/v1/index.js +0 -1
- package/dist/api/vpc/v1/index.js +0 -1
- package/dist/node_modules/.pnpm/@scaleway_random-name@3.0.2/node_modules/@scaleway/random-name/dist/index.js +0 -254
- package/node_modules/@scaleway/random-name/dist/index.browser.js +0 -256
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { waitForResource } from '../../../internal/async/interval-retrier.js';
|
|
2
|
-
import { API } from '../../../scw/api.js';
|
|
2
|
+
import { API as API$1 } from '../../../scw/api.js';
|
|
3
3
|
import { validatePathParam, urlParams } from '../../../helpers/marshalling.js';
|
|
4
4
|
import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
|
|
5
5
|
import { GATEWAY_TRANSIENT_STATUSES, GATEWAY_NETWORK_TRANSIENT_STATUSES } from './content.gen.js';
|
|
@@ -9,303 +9,248 @@ import { unmarshalListGatewaysResponse, unmarshalGateway, marshalCreateGatewayRe
|
|
|
9
9
|
const jsonContentHeaders = {
|
|
10
10
|
'Content-Type': 'application/json; charset=utf-8'
|
|
11
11
|
};
|
|
12
|
-
/** VPC Public Gateway API. */
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
/** VPC Public Gateway API. */
|
|
14
|
+
class API extends API$1 {
|
|
15
15
|
constructor() {
|
|
16
16
|
var _this;
|
|
17
|
-
|
|
18
17
|
super(...arguments);
|
|
19
18
|
_this = this;
|
|
20
|
-
|
|
21
19
|
this.pageOfListGateways = function (request) {
|
|
22
20
|
if (request === void 0) {
|
|
23
21
|
request = {};
|
|
24
22
|
}
|
|
25
|
-
|
|
26
23
|
return _this.client.fetch({
|
|
27
24
|
method: 'GET',
|
|
28
25
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/gateways`,
|
|
29
26
|
urlParams: urlParams(['name', request.name], ['order_by', request.orderBy ?? 'created_at_asc'], ['organization_id', request.organizationId ?? _this.client.settings.defaultOrganizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['private_network_id', request.privateNetworkId], ['project_id', request.projectId ?? _this.client.settings.defaultProjectId], ['status', request.status ?? 'unknown'], ['tags', request.tags], ['type', request.type])
|
|
30
27
|
}, unmarshalListGatewaysResponse);
|
|
31
28
|
};
|
|
32
|
-
|
|
33
29
|
this.listGateways = function (request) {
|
|
34
30
|
if (request === void 0) {
|
|
35
31
|
request = {};
|
|
36
32
|
}
|
|
37
|
-
|
|
38
33
|
return enrichForPagination('gateways', _this.pageOfListGateways, request);
|
|
39
34
|
};
|
|
40
|
-
|
|
41
35
|
this.getGateway = request => this.client.fetch({
|
|
42
36
|
method: 'GET',
|
|
43
37
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/gateways/${validatePathParam('gatewayId', request.gatewayId)}`
|
|
44
38
|
}, unmarshalGateway);
|
|
45
|
-
|
|
46
39
|
this.waitForGateway = (request, options) => waitForResource((options == null ? void 0 : options.stop) ?? (res => Promise.resolve(!GATEWAY_TRANSIENT_STATUSES.includes(res.status))), this.getGateway, request, options);
|
|
47
|
-
|
|
48
40
|
this.createGateway = request => this.client.fetch({
|
|
49
41
|
body: JSON.stringify(marshalCreateGatewayRequest(request, this.client.settings)),
|
|
50
42
|
headers: jsonContentHeaders,
|
|
51
43
|
method: 'POST',
|
|
52
44
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/gateways`
|
|
53
45
|
}, unmarshalGateway);
|
|
54
|
-
|
|
55
46
|
this.updateGateway = request => this.client.fetch({
|
|
56
47
|
body: JSON.stringify(marshalUpdateGatewayRequest(request, this.client.settings)),
|
|
57
48
|
headers: jsonContentHeaders,
|
|
58
49
|
method: 'PATCH',
|
|
59
50
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/gateways/${validatePathParam('gatewayId', request.gatewayId)}`
|
|
60
51
|
}, unmarshalGateway);
|
|
61
|
-
|
|
62
52
|
this.deleteGateway = request => this.client.fetch({
|
|
63
53
|
method: 'DELETE',
|
|
64
54
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/gateways/${validatePathParam('gatewayId', request.gatewayId)}`,
|
|
65
55
|
urlParams: urlParams(['cleanup_dhcp', request.cleanupDhcp])
|
|
66
56
|
});
|
|
67
|
-
|
|
68
57
|
this.upgradeGateway = request => this.client.fetch({
|
|
69
58
|
body: '{}',
|
|
70
59
|
headers: jsonContentHeaders,
|
|
71
60
|
method: 'POST',
|
|
72
61
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/gateways/${validatePathParam('gatewayId', request.gatewayId)}/upgrade`
|
|
73
62
|
}, unmarshalGateway);
|
|
74
|
-
|
|
75
63
|
this.pageOfListGatewayNetworks = function (request) {
|
|
76
64
|
if (request === void 0) {
|
|
77
65
|
request = {};
|
|
78
66
|
}
|
|
79
|
-
|
|
80
67
|
return _this.client.fetch({
|
|
81
68
|
method: 'GET',
|
|
82
69
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/gateway-networks`,
|
|
83
70
|
urlParams: urlParams(['dhcp_id', request.dhcpId], ['enable_masquerade', request.enableMasquerade], ['gateway_id', request.gatewayId], ['order_by', request.orderBy ?? 'created_at_asc'], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['private_network_id', request.privateNetworkId], ['status', request.status ?? 'unknown'])
|
|
84
71
|
}, unmarshalListGatewayNetworksResponse);
|
|
85
72
|
};
|
|
86
|
-
|
|
87
73
|
this.listGatewayNetworks = function (request) {
|
|
88
74
|
if (request === void 0) {
|
|
89
75
|
request = {};
|
|
90
76
|
}
|
|
91
|
-
|
|
92
77
|
return enrichForPagination('gatewayNetworks', _this.pageOfListGatewayNetworks, request);
|
|
93
78
|
};
|
|
94
|
-
|
|
95
79
|
this.getGatewayNetwork = request => this.client.fetch({
|
|
96
80
|
method: 'GET',
|
|
97
81
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/gateway-networks/${validatePathParam('gatewayNetworkId', request.gatewayNetworkId)}`
|
|
98
82
|
}, unmarshalGatewayNetwork);
|
|
99
|
-
|
|
100
83
|
this.waitForGatewayNetwork = (request, options) => waitForResource((options == null ? void 0 : options.stop) ?? (res => Promise.resolve(!GATEWAY_NETWORK_TRANSIENT_STATUSES.includes(res.status))), this.getGatewayNetwork, request, options);
|
|
101
|
-
|
|
102
84
|
this.createGatewayNetwork = request => this.client.fetch({
|
|
103
85
|
body: JSON.stringify(marshalCreateGatewayNetworkRequest(request, this.client.settings)),
|
|
104
86
|
headers: jsonContentHeaders,
|
|
105
87
|
method: 'POST',
|
|
106
88
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/gateway-networks`
|
|
107
89
|
}, unmarshalGatewayNetwork);
|
|
108
|
-
|
|
109
90
|
this.updateGatewayNetwork = request => this.client.fetch({
|
|
110
91
|
body: JSON.stringify(marshalUpdateGatewayNetworkRequest(request, this.client.settings)),
|
|
111
92
|
headers: jsonContentHeaders,
|
|
112
93
|
method: 'PATCH',
|
|
113
94
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/gateway-networks/${validatePathParam('gatewayNetworkId', request.gatewayNetworkId)}`
|
|
114
95
|
}, unmarshalGatewayNetwork);
|
|
115
|
-
|
|
116
96
|
this.deleteGatewayNetwork = request => this.client.fetch({
|
|
117
97
|
method: 'DELETE',
|
|
118
98
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/gateway-networks/${validatePathParam('gatewayNetworkId', request.gatewayNetworkId)}`,
|
|
119
99
|
urlParams: urlParams(['cleanup_dhcp', request.cleanupDhcp])
|
|
120
100
|
});
|
|
121
|
-
|
|
122
101
|
this.pageOfListDHCPs = function (request) {
|
|
123
102
|
if (request === void 0) {
|
|
124
103
|
request = {};
|
|
125
104
|
}
|
|
126
|
-
|
|
127
105
|
return _this.client.fetch({
|
|
128
106
|
method: 'GET',
|
|
129
107
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/dhcps`,
|
|
130
108
|
urlParams: urlParams(['address', request.address], ['has_address', request.hasAddress], ['order_by', request.orderBy ?? 'created_at_asc'], ['organization_id', request.organizationId ?? _this.client.settings.defaultOrganizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId ?? _this.client.settings.defaultProjectId])
|
|
131
109
|
}, unmarshalListDHCPsResponse);
|
|
132
110
|
};
|
|
133
|
-
|
|
134
111
|
this.listDHCPs = function (request) {
|
|
135
112
|
if (request === void 0) {
|
|
136
113
|
request = {};
|
|
137
114
|
}
|
|
138
|
-
|
|
139
115
|
return enrichForPagination('dhcps', _this.pageOfListDHCPs, request);
|
|
140
116
|
};
|
|
141
|
-
|
|
142
117
|
this.getDHCP = request => this.client.fetch({
|
|
143
118
|
method: 'GET',
|
|
144
119
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/dhcps/${validatePathParam('dhcpId', request.dhcpId)}`
|
|
145
120
|
}, unmarshalDHCP);
|
|
146
|
-
|
|
147
121
|
this.createDHCP = request => this.client.fetch({
|
|
148
122
|
body: JSON.stringify(marshalCreateDHCPRequest(request, this.client.settings)),
|
|
149
123
|
headers: jsonContentHeaders,
|
|
150
124
|
method: 'POST',
|
|
151
125
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/dhcps`
|
|
152
126
|
}, unmarshalDHCP);
|
|
153
|
-
|
|
154
127
|
this.updateDHCP = request => this.client.fetch({
|
|
155
128
|
body: JSON.stringify(marshalUpdateDHCPRequest(request, this.client.settings)),
|
|
156
129
|
headers: jsonContentHeaders,
|
|
157
130
|
method: 'PATCH',
|
|
158
131
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/dhcps/${validatePathParam('dhcpId', request.dhcpId)}`
|
|
159
132
|
}, unmarshalDHCP);
|
|
160
|
-
|
|
161
133
|
this.deleteDHCP = request => this.client.fetch({
|
|
162
134
|
method: 'DELETE',
|
|
163
135
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/dhcps/${validatePathParam('dhcpId', request.dhcpId)}`
|
|
164
136
|
});
|
|
165
|
-
|
|
166
137
|
this.pageOfListDHCPEntries = function (request) {
|
|
167
138
|
if (request === void 0) {
|
|
168
139
|
request = {};
|
|
169
140
|
}
|
|
170
|
-
|
|
171
141
|
return _this.client.fetch({
|
|
172
142
|
method: 'GET',
|
|
173
143
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/dhcp-entries`,
|
|
174
144
|
urlParams: urlParams(['gateway_network_id', request.gatewayNetworkId], ['hostname', request.hostname], ['ip_address', request.ipAddress], ['mac_address', request.macAddress], ['order_by', request.orderBy ?? 'created_at_asc'], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['type', request.type ?? 'unknown'])
|
|
175
145
|
}, unmarshalListDHCPEntriesResponse);
|
|
176
146
|
};
|
|
177
|
-
|
|
178
147
|
this.listDHCPEntries = function (request) {
|
|
179
148
|
if (request === void 0) {
|
|
180
149
|
request = {};
|
|
181
150
|
}
|
|
182
|
-
|
|
183
151
|
return enrichForPagination('dhcpEntries', _this.pageOfListDHCPEntries, request);
|
|
184
152
|
};
|
|
185
|
-
|
|
186
153
|
this.getDHCPEntry = request => this.client.fetch({
|
|
187
154
|
method: 'GET',
|
|
188
155
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/dhcp-entries/${validatePathParam('dhcpEntryId', request.dhcpEntryId)}`
|
|
189
156
|
}, unmarshalDHCPEntry);
|
|
190
|
-
|
|
191
157
|
this.createDHCPEntry = request => this.client.fetch({
|
|
192
158
|
body: JSON.stringify(marshalCreateDHCPEntryRequest(request, this.client.settings)),
|
|
193
159
|
headers: jsonContentHeaders,
|
|
194
160
|
method: 'POST',
|
|
195
161
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/dhcp-entries`
|
|
196
162
|
}, unmarshalDHCPEntry);
|
|
197
|
-
|
|
198
163
|
this.updateDHCPEntry = request => this.client.fetch({
|
|
199
164
|
body: JSON.stringify(marshalUpdateDHCPEntryRequest(request, this.client.settings)),
|
|
200
165
|
headers: jsonContentHeaders,
|
|
201
166
|
method: 'PATCH',
|
|
202
167
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/dhcp-entries/${validatePathParam('dhcpEntryId', request.dhcpEntryId)}`
|
|
203
168
|
}, unmarshalDHCPEntry);
|
|
204
|
-
|
|
205
169
|
this.setDHCPEntries = request => this.client.fetch({
|
|
206
170
|
body: JSON.stringify(marshalSetDHCPEntriesRequest(request, this.client.settings)),
|
|
207
171
|
headers: jsonContentHeaders,
|
|
208
172
|
method: 'PUT',
|
|
209
173
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/dhcp-entries`
|
|
210
174
|
}, unmarshalSetDHCPEntriesResponse);
|
|
211
|
-
|
|
212
175
|
this.deleteDHCPEntry = request => this.client.fetch({
|
|
213
176
|
method: 'DELETE',
|
|
214
177
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/dhcp-entries/${validatePathParam('dhcpEntryId', request.dhcpEntryId)}`
|
|
215
178
|
});
|
|
216
|
-
|
|
217
179
|
this.pageOfListPATRules = function (request) {
|
|
218
180
|
if (request === void 0) {
|
|
219
181
|
request = {};
|
|
220
182
|
}
|
|
221
|
-
|
|
222
183
|
return _this.client.fetch({
|
|
223
184
|
method: 'GET',
|
|
224
185
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/pat-rules`,
|
|
225
186
|
urlParams: urlParams(['gateway_id', request.gatewayId], ['order_by', request.orderBy ?? 'created_at_asc'], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['private_ip', request.privateIp], ['protocol', request.protocol ?? 'unknown'])
|
|
226
187
|
}, unmarshalListPATRulesResponse);
|
|
227
188
|
};
|
|
228
|
-
|
|
229
189
|
this.listPATRules = function (request) {
|
|
230
190
|
if (request === void 0) {
|
|
231
191
|
request = {};
|
|
232
192
|
}
|
|
233
|
-
|
|
234
193
|
return enrichForPagination('patRules', _this.pageOfListPATRules, request);
|
|
235
194
|
};
|
|
236
|
-
|
|
237
195
|
this.getPATRule = request => this.client.fetch({
|
|
238
196
|
method: 'GET',
|
|
239
197
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/pat-rules/${validatePathParam('patRuleId', request.patRuleId)}`
|
|
240
198
|
}, unmarshalPATRule);
|
|
241
|
-
|
|
242
199
|
this.createPATRule = request => this.client.fetch({
|
|
243
200
|
body: JSON.stringify(marshalCreatePATRuleRequest(request, this.client.settings)),
|
|
244
201
|
headers: jsonContentHeaders,
|
|
245
202
|
method: 'POST',
|
|
246
203
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/pat-rules`
|
|
247
204
|
}, unmarshalPATRule);
|
|
248
|
-
|
|
249
205
|
this.updatePATRule = request => this.client.fetch({
|
|
250
206
|
body: JSON.stringify(marshalUpdatePATRuleRequest(request, this.client.settings)),
|
|
251
207
|
headers: jsonContentHeaders,
|
|
252
208
|
method: 'PATCH',
|
|
253
209
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/pat-rules/${validatePathParam('patRuleId', request.patRuleId)}`
|
|
254
210
|
}, unmarshalPATRule);
|
|
255
|
-
|
|
256
211
|
this.setPATRules = request => this.client.fetch({
|
|
257
212
|
body: JSON.stringify(marshalSetPATRulesRequest(request, this.client.settings)),
|
|
258
213
|
headers: jsonContentHeaders,
|
|
259
214
|
method: 'PUT',
|
|
260
215
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/pat-rules`
|
|
261
216
|
}, unmarshalSetPATRulesResponse);
|
|
262
|
-
|
|
263
217
|
this.deletePATRule = request => this.client.fetch({
|
|
264
218
|
method: 'DELETE',
|
|
265
219
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/pat-rules/${validatePathParam('patRuleId', request.patRuleId)}`
|
|
266
220
|
});
|
|
267
|
-
|
|
268
221
|
this.listGatewayTypes = function (request) {
|
|
269
222
|
if (request === void 0) {
|
|
270
223
|
request = {};
|
|
271
224
|
}
|
|
272
|
-
|
|
273
225
|
return _this.client.fetch({
|
|
274
226
|
method: 'GET',
|
|
275
227
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/gateway-types`
|
|
276
228
|
}, unmarshalListGatewayTypesResponse);
|
|
277
229
|
};
|
|
278
|
-
|
|
279
230
|
this.pageOfListIPs = function (request) {
|
|
280
231
|
if (request === void 0) {
|
|
281
232
|
request = {};
|
|
282
233
|
}
|
|
283
|
-
|
|
284
234
|
return _this.client.fetch({
|
|
285
235
|
method: 'GET',
|
|
286
236
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/ips`,
|
|
287
237
|
urlParams: urlParams(['is_free', request.isFree], ['order_by', request.orderBy ?? 'created_at_asc'], ['organization_id', request.organizationId ?? _this.client.settings.defaultOrganizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId ?? _this.client.settings.defaultProjectId], ['reverse', request.reverse], ['tags', request.tags])
|
|
288
238
|
}, unmarshalListIPsResponse);
|
|
289
239
|
};
|
|
290
|
-
|
|
291
240
|
this.listIPs = function (request) {
|
|
292
241
|
if (request === void 0) {
|
|
293
242
|
request = {};
|
|
294
243
|
}
|
|
295
|
-
|
|
296
244
|
return enrichForPagination('ips', _this.pageOfListIPs, request);
|
|
297
245
|
};
|
|
298
|
-
|
|
299
246
|
this.getIP = request => this.client.fetch({
|
|
300
247
|
method: 'GET',
|
|
301
248
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/ips/${validatePathParam('ipId', request.ipId)}`
|
|
302
249
|
}, unmarshalIP);
|
|
303
|
-
|
|
304
250
|
this.createIP = function (request) {
|
|
305
251
|
if (request === void 0) {
|
|
306
252
|
request = {};
|
|
307
253
|
}
|
|
308
|
-
|
|
309
254
|
return _this.client.fetch({
|
|
310
255
|
body: JSON.stringify(marshalCreateIPRequest(request, _this.client.settings)),
|
|
311
256
|
headers: jsonContentHeaders,
|
|
@@ -313,19 +258,16 @@ class VpcgwV1GenAPI extends API {
|
|
|
313
258
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/ips`
|
|
314
259
|
}, unmarshalIP);
|
|
315
260
|
};
|
|
316
|
-
|
|
317
261
|
this.updateIP = request => this.client.fetch({
|
|
318
262
|
body: JSON.stringify(marshalUpdateIPRequest(request, this.client.settings)),
|
|
319
263
|
headers: jsonContentHeaders,
|
|
320
264
|
method: 'PATCH',
|
|
321
265
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/ips/${validatePathParam('ipId', request.ipId)}`
|
|
322
266
|
}, unmarshalIP);
|
|
323
|
-
|
|
324
267
|
this.deleteIP = request => this.client.fetch({
|
|
325
268
|
method: 'DELETE',
|
|
326
269
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/ips/${validatePathParam('ipId', request.ipId)}`
|
|
327
270
|
});
|
|
328
|
-
|
|
329
271
|
this.refreshSSHKeys = request => this.client.fetch({
|
|
330
272
|
body: '{}',
|
|
331
273
|
headers: jsonContentHeaders,
|
|
@@ -333,8 +275,7 @@ class VpcgwV1GenAPI extends API {
|
|
|
333
275
|
path: `/vpc-gw/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/gateways/${validatePathParam('gatewayId', request.gatewayId)}/refresh-ssh-keys`
|
|
334
276
|
}, unmarshalGateway);
|
|
335
277
|
}
|
|
336
|
-
|
|
337
278
|
}
|
|
338
|
-
|
|
279
|
+
API.LOCALITIES = ['fr-par-1', 'fr-par-2', 'nl-ams-1', 'nl-ams-2', 'pl-waw-1', 'pl-waw-2'];
|
|
339
280
|
|
|
340
|
-
export {
|
|
281
|
+
export { API };
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
/** Lists transient statutes of the enum {@link GatewayNetworkStatus}. */
|
|
5
5
|
const GATEWAY_NETWORK_TRANSIENT_STATUSES = ['attaching', 'configuring', 'detaching'];
|
|
6
|
-
/** Lists transient statutes of the enum {@link GatewayStatus}. */
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
/** Lists transient statutes of the enum {@link GatewayStatus}. */
|
|
8
|
+
const GATEWAY_TRANSIENT_STATUSES = ['allocating', 'configuring', 'stopping', 'deleting'];
|
|
9
9
|
|
|
10
10
|
export { GATEWAY_NETWORK_TRANSIENT_STATUSES, GATEWAY_TRANSIENT_STATUSES };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import randomName from '../../../node_modules/.pnpm/@scaleway_random-name@
|
|
1
|
+
import randomName from '../../../node_modules/.pnpm/@scaleway_random-name@4.0.1/node_modules/@scaleway/random-name/dist/index.js';
|
|
2
2
|
import { isJSONObject } from '../../../helpers/json.js';
|
|
3
3
|
import { unmarshalDate, unmarshalArrayOfObject, resolveOneOf } from '../../../helpers/marshalling.js';
|
|
4
4
|
|
|
@@ -7,7 +7,6 @@ const unmarshalDHCP = data => {
|
|
|
7
7
|
if (!isJSONObject(data)) {
|
|
8
8
|
throw new TypeError(`Unmarshalling the type 'DHCP' failed as data isn't a dictionary.`);
|
|
9
9
|
}
|
|
10
|
-
|
|
11
10
|
return {
|
|
12
11
|
address: data.address,
|
|
13
12
|
createdAt: unmarshalDate(data.created_at),
|
|
@@ -34,7 +33,6 @@ const unmarshalGatewayNetwork = data => {
|
|
|
34
33
|
if (!isJSONObject(data)) {
|
|
35
34
|
throw new TypeError(`Unmarshalling the type 'GatewayNetwork' failed as data isn't a dictionary.`);
|
|
36
35
|
}
|
|
37
|
-
|
|
38
36
|
return {
|
|
39
37
|
address: data.address,
|
|
40
38
|
createdAt: unmarshalDate(data.created_at),
|
|
@@ -50,24 +48,20 @@ const unmarshalGatewayNetwork = data => {
|
|
|
50
48
|
zone: data.zone
|
|
51
49
|
};
|
|
52
50
|
};
|
|
53
|
-
|
|
54
51
|
const unmarshalGatewayType = data => {
|
|
55
52
|
if (!isJSONObject(data)) {
|
|
56
53
|
throw new TypeError(`Unmarshalling the type 'GatewayType' failed as data isn't a dictionary.`);
|
|
57
54
|
}
|
|
58
|
-
|
|
59
55
|
return {
|
|
60
56
|
bandwidth: data.bandwidth,
|
|
61
57
|
name: data.name,
|
|
62
58
|
zone: data.zone
|
|
63
59
|
};
|
|
64
60
|
};
|
|
65
|
-
|
|
66
61
|
const unmarshalIP = data => {
|
|
67
62
|
if (!isJSONObject(data)) {
|
|
68
63
|
throw new TypeError(`Unmarshalling the type 'IP' failed as data isn't a dictionary.`);
|
|
69
64
|
}
|
|
70
|
-
|
|
71
65
|
return {
|
|
72
66
|
address: data.address,
|
|
73
67
|
createdAt: unmarshalDate(data.created_at),
|
|
@@ -85,7 +79,6 @@ const unmarshalDHCPEntry = data => {
|
|
|
85
79
|
if (!isJSONObject(data)) {
|
|
86
80
|
throw new TypeError(`Unmarshalling the type 'DHCPEntry' failed as data isn't a dictionary.`);
|
|
87
81
|
}
|
|
88
|
-
|
|
89
82
|
return {
|
|
90
83
|
createdAt: unmarshalDate(data.created_at),
|
|
91
84
|
gatewayNetworkId: data.gateway_network_id,
|
|
@@ -102,7 +95,6 @@ const unmarshalGateway = data => {
|
|
|
102
95
|
if (!isJSONObject(data)) {
|
|
103
96
|
throw new TypeError(`Unmarshalling the type 'Gateway' failed as data isn't a dictionary.`);
|
|
104
97
|
}
|
|
105
|
-
|
|
106
98
|
return {
|
|
107
99
|
bastionEnabled: data.bastion_enabled,
|
|
108
100
|
bastionPort: data.bastion_port,
|
|
@@ -128,7 +120,6 @@ const unmarshalPATRule = data => {
|
|
|
128
120
|
if (!isJSONObject(data)) {
|
|
129
121
|
throw new TypeError(`Unmarshalling the type 'PATRule' failed as data isn't a dictionary.`);
|
|
130
122
|
}
|
|
131
|
-
|
|
132
123
|
return {
|
|
133
124
|
createdAt: unmarshalDate(data.created_at),
|
|
134
125
|
gatewayId: data.gateway_id,
|
|
@@ -145,7 +136,6 @@ const unmarshalListDHCPEntriesResponse = data => {
|
|
|
145
136
|
if (!isJSONObject(data)) {
|
|
146
137
|
throw new TypeError(`Unmarshalling the type 'ListDHCPEntriesResponse' failed as data isn't a dictionary.`);
|
|
147
138
|
}
|
|
148
|
-
|
|
149
139
|
return {
|
|
150
140
|
dhcpEntries: unmarshalArrayOfObject(data.dhcp_entries, unmarshalDHCPEntry),
|
|
151
141
|
totalCount: data.total_count
|
|
@@ -155,7 +145,6 @@ const unmarshalListDHCPsResponse = data => {
|
|
|
155
145
|
if (!isJSONObject(data)) {
|
|
156
146
|
throw new TypeError(`Unmarshalling the type 'ListDHCPsResponse' failed as data isn't a dictionary.`);
|
|
157
147
|
}
|
|
158
|
-
|
|
159
148
|
return {
|
|
160
149
|
dhcps: unmarshalArrayOfObject(data.dhcps, unmarshalDHCP),
|
|
161
150
|
totalCount: data.total_count
|
|
@@ -165,7 +154,6 @@ const unmarshalListGatewayNetworksResponse = data => {
|
|
|
165
154
|
if (!isJSONObject(data)) {
|
|
166
155
|
throw new TypeError(`Unmarshalling the type 'ListGatewayNetworksResponse' failed as data isn't a dictionary.`);
|
|
167
156
|
}
|
|
168
|
-
|
|
169
157
|
return {
|
|
170
158
|
gatewayNetworks: unmarshalArrayOfObject(data.gateway_networks, unmarshalGatewayNetwork),
|
|
171
159
|
totalCount: data.total_count
|
|
@@ -175,7 +163,6 @@ const unmarshalListGatewayTypesResponse = data => {
|
|
|
175
163
|
if (!isJSONObject(data)) {
|
|
176
164
|
throw new TypeError(`Unmarshalling the type 'ListGatewayTypesResponse' failed as data isn't a dictionary.`);
|
|
177
165
|
}
|
|
178
|
-
|
|
179
166
|
return {
|
|
180
167
|
types: unmarshalArrayOfObject(data.types, unmarshalGatewayType)
|
|
181
168
|
};
|
|
@@ -184,7 +171,6 @@ const unmarshalListGatewaysResponse = data => {
|
|
|
184
171
|
if (!isJSONObject(data)) {
|
|
185
172
|
throw new TypeError(`Unmarshalling the type 'ListGatewaysResponse' failed as data isn't a dictionary.`);
|
|
186
173
|
}
|
|
187
|
-
|
|
188
174
|
return {
|
|
189
175
|
gateways: unmarshalArrayOfObject(data.gateways, unmarshalGateway),
|
|
190
176
|
totalCount: data.total_count
|
|
@@ -194,7 +180,6 @@ const unmarshalListIPsResponse = data => {
|
|
|
194
180
|
if (!isJSONObject(data)) {
|
|
195
181
|
throw new TypeError(`Unmarshalling the type 'ListIPsResponse' failed as data isn't a dictionary.`);
|
|
196
182
|
}
|
|
197
|
-
|
|
198
183
|
return {
|
|
199
184
|
ips: unmarshalArrayOfObject(data.ips, unmarshalIP),
|
|
200
185
|
totalCount: data.total_count
|
|
@@ -204,7 +189,6 @@ const unmarshalListPATRulesResponse = data => {
|
|
|
204
189
|
if (!isJSONObject(data)) {
|
|
205
190
|
throw new TypeError(`Unmarshalling the type 'ListPATRulesResponse' failed as data isn't a dictionary.`);
|
|
206
191
|
}
|
|
207
|
-
|
|
208
192
|
return {
|
|
209
193
|
patRules: unmarshalArrayOfObject(data.pat_rules, unmarshalPATRule),
|
|
210
194
|
totalCount: data.total_count
|
|
@@ -214,7 +198,6 @@ const unmarshalSetDHCPEntriesResponse = data => {
|
|
|
214
198
|
if (!isJSONObject(data)) {
|
|
215
199
|
throw new TypeError(`Unmarshalling the type 'SetDHCPEntriesResponse' failed as data isn't a dictionary.`);
|
|
216
200
|
}
|
|
217
|
-
|
|
218
201
|
return {
|
|
219
202
|
dhcpEntries: unmarshalArrayOfObject(data.dhcp_entries, unmarshalDHCPEntry)
|
|
220
203
|
};
|
|
@@ -223,24 +206,20 @@ const unmarshalSetPATRulesResponse = data => {
|
|
|
223
206
|
if (!isJSONObject(data)) {
|
|
224
207
|
throw new TypeError(`Unmarshalling the type 'SetPATRulesResponse' failed as data isn't a dictionary.`);
|
|
225
208
|
}
|
|
226
|
-
|
|
227
209
|
return {
|
|
228
210
|
patRules: unmarshalArrayOfObject(data.pat_rules, unmarshalPATRule)
|
|
229
211
|
};
|
|
230
212
|
};
|
|
231
|
-
|
|
232
213
|
const marshalSetDHCPEntriesRequestEntry = (request, defaults) => ({
|
|
233
214
|
ip_address: request.ipAddress,
|
|
234
215
|
mac_address: request.macAddress
|
|
235
216
|
});
|
|
236
|
-
|
|
237
217
|
const marshalSetPATRulesRequestRule = (request, defaults) => ({
|
|
238
218
|
private_ip: request.privateIp,
|
|
239
219
|
private_port: request.privatePort,
|
|
240
220
|
protocol: request.protocol,
|
|
241
221
|
public_port: request.publicPort
|
|
242
222
|
});
|
|
243
|
-
|
|
244
223
|
const marshalCreateDHCPEntryRequest = (request, defaults) => ({
|
|
245
224
|
gateway_network_id: request.gatewayNetworkId,
|
|
246
225
|
ip_address: request.ipAddress,
|
|
@@ -294,7 +273,7 @@ const marshalCreatePATRuleRequest = (request, defaults) => ({
|
|
|
294
273
|
gateway_id: request.gatewayId,
|
|
295
274
|
private_ip: request.privateIp,
|
|
296
275
|
private_port: request.privatePort,
|
|
297
|
-
protocol: request.protocol,
|
|
276
|
+
protocol: request.protocol ?? 'unknown',
|
|
298
277
|
public_port: request.publicPort
|
|
299
278
|
});
|
|
300
279
|
const marshalSetDHCPEntriesRequest = (request, defaults) => ({
|
|
@@ -350,7 +329,7 @@ const marshalUpdateIPRequest = (request, defaults) => ({
|
|
|
350
329
|
const marshalUpdatePATRuleRequest = (request, defaults) => ({
|
|
351
330
|
private_ip: request.privateIp,
|
|
352
331
|
private_port: request.privatePort,
|
|
353
|
-
protocol: request.protocol,
|
|
332
|
+
protocol: request.protocol ?? 'unknown',
|
|
354
333
|
public_port: request.publicPort
|
|
355
334
|
});
|
|
356
335
|
|
package/dist/helpers/json.js
CHANGED
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @internal
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
6
|
const isJSONObject = obj => {
|
|
8
7
|
const objT = typeof obj;
|
|
9
|
-
return obj !== undefined && obj !== null && objT !== 'string' && objT !== 'number' && objT !== 'boolean' && Array.isArray(obj)
|
|
8
|
+
return obj !== undefined && obj !== null && objT !== 'string' && objT !== 'number' && objT !== 'boolean' && !Array.isArray(obj) && objT === 'object';
|
|
10
9
|
};
|
|
11
10
|
|
|
12
11
|
export { isJSONObject };
|
|
@@ -16,6 +16,7 @@ function validatePathParam(name, param) {
|
|
|
16
16
|
if (typeof param === 'number') return param.toString();
|
|
17
17
|
throw new TypeError(`param ${name} cannot be empty in request`);
|
|
18
18
|
}
|
|
19
|
+
|
|
19
20
|
/**
|
|
20
21
|
* Resolves the ideal parameter and value amongst an optional list.
|
|
21
22
|
*
|
|
@@ -28,26 +29,21 @@ function validatePathParam(name, param) {
|
|
|
28
29
|
*
|
|
29
30
|
* @internal
|
|
30
31
|
*/
|
|
31
|
-
|
|
32
32
|
const resolveOneOf = function (list, isRequired) {
|
|
33
33
|
if (isRequired === void 0) {
|
|
34
34
|
isRequired = false;
|
|
35
35
|
}
|
|
36
|
-
|
|
37
36
|
const elt = list.find(obj => obj.value) || list.find(obj => obj.default);
|
|
38
37
|
const value = (elt == null ? void 0 : elt.value) || (elt == null ? void 0 : elt.default);
|
|
39
38
|
if (value) return {
|
|
40
39
|
[elt.param]: value
|
|
41
40
|
};
|
|
42
|
-
|
|
43
41
|
if (isRequired) {
|
|
44
42
|
const keyList = list.map(obj => obj.param).join(' or ');
|
|
45
43
|
throw new TypeError(`one of ${keyList} must be indicated in the request`);
|
|
46
44
|
}
|
|
47
|
-
|
|
48
45
|
return {};
|
|
49
46
|
};
|
|
50
|
-
|
|
51
47
|
/**
|
|
52
48
|
* Filters defined parameters tuples and converts them to URLSearchParams.
|
|
53
49
|
*
|
|
@@ -58,11 +54,9 @@ const resolveOneOf = function (list, isRequired) {
|
|
|
58
54
|
*/
|
|
59
55
|
const urlParams = function () {
|
|
60
56
|
const params = new URLSearchParams();
|
|
61
|
-
|
|
62
57
|
for (var _len = arguments.length, paramTuples = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
63
58
|
paramTuples[_key] = arguments[_key];
|
|
64
59
|
}
|
|
65
|
-
|
|
66
60
|
for (const [key, value] of paramTuples) {
|
|
67
61
|
if (typeof key === 'string' && value != null) {
|
|
68
62
|
if (Array.isArray(value)) {
|
|
@@ -76,63 +70,56 @@ const urlParams = function () {
|
|
|
76
70
|
}
|
|
77
71
|
}
|
|
78
72
|
}
|
|
79
|
-
|
|
80
73
|
return params;
|
|
81
74
|
};
|
|
75
|
+
|
|
82
76
|
/**
|
|
83
77
|
* Unmarshals data to Date object.
|
|
84
78
|
*
|
|
85
79
|
* @internal
|
|
86
80
|
*/
|
|
87
|
-
|
|
88
81
|
const unmarshalDate = data => {
|
|
89
82
|
if (typeof data !== 'string') {
|
|
90
83
|
return undefined;
|
|
91
84
|
}
|
|
92
|
-
|
|
93
85
|
const date = new Date(data);
|
|
94
|
-
|
|
95
86
|
if (Number.isNaN(date.getTime())) {
|
|
96
87
|
return undefined;
|
|
97
88
|
}
|
|
98
|
-
|
|
99
89
|
return date;
|
|
100
90
|
};
|
|
91
|
+
|
|
101
92
|
/**
|
|
102
93
|
* Unmarshals array of object.
|
|
103
94
|
*
|
|
104
95
|
* @internal
|
|
105
96
|
*/
|
|
106
|
-
|
|
107
97
|
const unmarshalArrayOfObject = function (data, unmarshaller, emptyFallback) {
|
|
108
98
|
if (emptyFallback === void 0) {
|
|
109
99
|
emptyFallback = true;
|
|
110
100
|
}
|
|
111
|
-
|
|
112
101
|
if (!Array.isArray(data)) {
|
|
113
102
|
return emptyFallback ? [] : undefined;
|
|
114
103
|
}
|
|
115
|
-
|
|
116
104
|
return data.map(elt => unmarshaller(elt));
|
|
117
105
|
};
|
|
106
|
+
|
|
118
107
|
/**
|
|
119
108
|
* Unmarshals map of object.
|
|
120
109
|
*
|
|
121
110
|
* @internal
|
|
122
111
|
*/
|
|
123
|
-
|
|
124
112
|
const unmarshalMapOfObject = function (data, unmarshaller, emptyFallback) {
|
|
125
113
|
if (emptyFallback === void 0) {
|
|
126
114
|
emptyFallback = true;
|
|
127
115
|
}
|
|
128
|
-
|
|
129
|
-
if (!data || typeof data !== 'object' || Array.isArray(data)) {
|
|
116
|
+
if (!data || typeof data !== 'object' || !(data instanceof Object) || Array.isArray(data)) {
|
|
130
117
|
return emptyFallback ? {} : undefined;
|
|
131
118
|
}
|
|
132
|
-
|
|
133
119
|
return Object.entries(data).reduce((acc, _ref) => {
|
|
134
120
|
let [key, value] = _ref;
|
|
135
|
-
return {
|
|
121
|
+
return {
|
|
122
|
+
...acc,
|
|
136
123
|
[key]: unmarshaller(value)
|
|
137
124
|
};
|
|
138
125
|
}, {});
|