@scaleway/sdk 2.68.0 → 2.70.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.
Files changed (96) hide show
  1. package/dist/api/account/v3/api.gen.cjs +23 -0
  2. package/dist/api/account/v3/api.gen.d.ts +11 -1
  3. package/dist/api/account/v3/api.gen.js +24 -1
  4. package/dist/api/account/v3/index.gen.d.ts +1 -1
  5. package/dist/api/account/v3/marshalling.gen.cjs +171 -0
  6. package/dist/api/account/v3/marshalling.gen.d.ts +3 -1
  7. package/dist/api/account/v3/marshalling.gen.js +173 -2
  8. package/dist/api/account/v3/types.gen.d.ts +93 -0
  9. package/dist/api/applesilicon/v1alpha1/types.gen.d.ts +3 -2
  10. package/dist/api/audit_trail/v1alpha1/api.gen.cjs +1 -0
  11. package/dist/api/audit_trail/v1alpha1/api.gen.js +1 -0
  12. package/dist/api/audit_trail/v1alpha1/marshalling.gen.cjs +5 -0
  13. package/dist/api/audit_trail/v1alpha1/marshalling.gen.js +5 -0
  14. package/dist/api/audit_trail/v1alpha1/types.gen.d.ts +50 -14
  15. package/dist/api/audit_trail/v1alpha1/validation-rules.gen.cjs +3 -0
  16. package/dist/api/audit_trail/v1alpha1/validation-rules.gen.d.ts +3 -0
  17. package/dist/api/audit_trail/v1alpha1/validation-rules.gen.js +3 -0
  18. package/dist/api/billing/v2beta1/api.gen.cjs +9 -2
  19. package/dist/api/billing/v2beta1/api.gen.d.ts +9 -2
  20. package/dist/api/billing/v2beta1/api.gen.js +9 -2
  21. package/dist/api/billing/v2beta1/types.gen.d.ts +1 -1
  22. package/dist/api/cockpit/v1/marshalling.gen.cjs +4 -4
  23. package/dist/api/cockpit/v1/marshalling.gen.js +4 -4
  24. package/dist/api/cockpit/v1/types.gen.d.ts +3 -3
  25. package/dist/api/edge_services/v1beta1/api.gen.cjs +1 -1
  26. package/dist/api/edge_services/v1beta1/api.gen.js +1 -1
  27. package/dist/api/edge_services/v1beta1/marshalling.gen.cjs +1 -0
  28. package/dist/api/edge_services/v1beta1/marshalling.gen.d.ts +2 -1
  29. package/dist/api/edge_services/v1beta1/marshalling.gen.js +1 -0
  30. package/dist/api/edge_services/v1beta1/types.gen.d.ts +104 -104
  31. package/dist/api/iam/v1alpha1/api.gen.cjs +8 -0
  32. package/dist/api/iam/v1alpha1/api.gen.d.ts +2 -1
  33. package/dist/api/iam/v1alpha1/api.gen.js +9 -1
  34. package/dist/api/iam/v1alpha1/index.gen.d.ts +1 -1
  35. package/dist/api/iam/v1alpha1/marshalling.gen.cjs +46 -0
  36. package/dist/api/iam/v1alpha1/marshalling.gen.d.ts +2 -1
  37. package/dist/api/iam/v1alpha1/marshalling.gen.js +46 -0
  38. package/dist/api/iam/v1alpha1/types.gen.d.ts +26 -0
  39. package/dist/api/iam/v1alpha1/validation-rules.gen.cjs +23 -12
  40. package/dist/api/iam/v1alpha1/validation-rules.gen.d.ts +22 -11
  41. package/dist/api/iam/v1alpha1/validation-rules.gen.js +23 -12
  42. package/dist/api/inference/index.gen.cjs +4 -2
  43. package/dist/api/inference/index.gen.d.ts +1 -0
  44. package/dist/api/inference/index.gen.js +4 -2
  45. package/dist/api/inference/v1/api.gen.cjs +274 -0
  46. package/dist/api/inference/v1/api.gen.d.ts +140 -0
  47. package/dist/api/inference/v1/api.gen.js +274 -0
  48. package/dist/api/inference/v1/content.gen.cjs +13 -0
  49. package/dist/api/inference/v1/content.gen.d.ts +5 -0
  50. package/dist/api/inference/v1/content.gen.js +13 -0
  51. package/dist/api/inference/v1/index.gen.cjs +9 -0
  52. package/dist/api/inference/v1/index.gen.d.ts +4 -0
  53. package/dist/api/inference/v1/index.gen.js +9 -0
  54. package/dist/api/inference/v1/marshalling.gen.cjs +260 -0
  55. package/dist/api/inference/v1/marshalling.gen.d.ts +14 -0
  56. package/dist/api/inference/v1/marshalling.gen.js +260 -0
  57. package/dist/api/inference/v1/types.gen.d.ts +395 -0
  58. package/dist/api/inference/v1/validation-rules.gen.cjs +65 -0
  59. package/dist/api/inference/v1/validation-rules.gen.d.ts +57 -0
  60. package/dist/api/inference/v1/validation-rules.gen.js +65 -0
  61. package/dist/api/instance/v1/index.gen.d.ts +1 -1
  62. package/dist/api/instance/v1/marshalling.gen.cjs +13 -0
  63. package/dist/api/instance/v1/marshalling.gen.js +13 -0
  64. package/dist/api/instance/v1/types.gen.d.ts +10 -0
  65. package/dist/api/mongodb/v1alpha1/types.gen.d.ts +1 -1
  66. package/dist/api/secret/v1beta1/api.gen.cjs +2 -34
  67. package/dist/api/secret/v1beta1/api.gen.d.ts +3 -19
  68. package/dist/api/secret/v1beta1/api.gen.js +2 -34
  69. package/dist/api/secret/v1beta1/index.gen.d.ts +1 -1
  70. package/dist/api/secret/v1beta1/types.gen.d.ts +3 -19
  71. package/dist/api/tem/v1alpha1/api.gen.cjs +93 -0
  72. package/dist/api/tem/v1alpha1/api.gen.d.ts +44 -1
  73. package/dist/api/tem/v1alpha1/api.gen.js +94 -1
  74. package/dist/api/tem/v1alpha1/index.gen.d.ts +1 -1
  75. package/dist/api/tem/v1alpha1/marshalling.gen.cjs +114 -0
  76. package/dist/api/tem/v1alpha1/marshalling.gen.d.ts +7 -1
  77. package/dist/api/tem/v1alpha1/marshalling.gen.js +114 -0
  78. package/dist/api/tem/v1alpha1/types.gen.d.ts +162 -6
  79. package/dist/api/tem/v1alpha1/validation-rules.gen.cjs +10 -0
  80. package/dist/api/tem/v1alpha1/validation-rules.gen.d.ts +9 -0
  81. package/dist/api/tem/v1alpha1/validation-rules.gen.js +10 -0
  82. package/dist/api/vpcgw/v1/api.gen.cjs +7 -0
  83. package/dist/api/vpcgw/v1/api.gen.d.ts +7 -0
  84. package/dist/api/vpcgw/v1/api.gen.js +7 -0
  85. package/dist/api/vpcgw/v1/types.gen.d.ts +1 -0
  86. package/dist/api/webhosting/v1/index.gen.d.ts +1 -1
  87. package/dist/api/webhosting/v1/marshalling.gen.cjs +23 -1
  88. package/dist/api/webhosting/v1/marshalling.gen.js +23 -1
  89. package/dist/api/webhosting/v1/types.gen.d.ts +51 -12
  90. package/dist/scw/constants.cjs +1 -1
  91. package/dist/scw/constants.d.ts +2 -2
  92. package/dist/scw/constants.js +1 -1
  93. package/dist/scw/errors/standard/quotas-exceeded-error.cjs +1 -1
  94. package/dist/scw/errors/standard/quotas-exceeded-error.d.ts +4 -4
  95. package/dist/scw/errors/standard/quotas-exceeded-error.js +1 -1
  96. package/package.json +2 -2
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const DEPLOYMENT_TRANSIENT_STATUSES = [
4
+ "creating",
5
+ "deploying",
6
+ "deleting"
7
+ ];
8
+ const MODEL_TRANSIENT_STATUSES = [
9
+ "preparing",
10
+ "downloading"
11
+ ];
12
+ exports.DEPLOYMENT_TRANSIENT_STATUSES = DEPLOYMENT_TRANSIENT_STATUSES;
13
+ exports.MODEL_TRANSIENT_STATUSES = MODEL_TRANSIENT_STATUSES;
@@ -0,0 +1,5 @@
1
+ import type { DeploymentStatus, ModelStatus } from './types.gen';
2
+ /** Lists transient statutes of the enum {@link DeploymentStatus}. */
3
+ export declare const DEPLOYMENT_TRANSIENT_STATUSES: DeploymentStatus[];
4
+ /** Lists transient statutes of the enum {@link ModelStatus}. */
5
+ export declare const MODEL_TRANSIENT_STATUSES: ModelStatus[];
@@ -0,0 +1,13 @@
1
+ const DEPLOYMENT_TRANSIENT_STATUSES = [
2
+ "creating",
3
+ "deploying",
4
+ "deleting"
5
+ ];
6
+ const MODEL_TRANSIENT_STATUSES = [
7
+ "preparing",
8
+ "downloading"
9
+ ];
10
+ export {
11
+ DEPLOYMENT_TRANSIENT_STATUSES,
12
+ MODEL_TRANSIENT_STATUSES
13
+ };
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const api_gen = require("./api.gen.cjs");
4
+ const content_gen = require("./content.gen.cjs");
5
+ const validationRules_gen = require("./validation-rules.gen.cjs");
6
+ exports.API = api_gen.API;
7
+ exports.DEPLOYMENT_TRANSIENT_STATUSES = content_gen.DEPLOYMENT_TRANSIENT_STATUSES;
8
+ exports.MODEL_TRANSIENT_STATUSES = content_gen.MODEL_TRANSIENT_STATUSES;
9
+ exports.ValidationRules = validationRules_gen;
@@ -0,0 +1,4 @@
1
+ export { API } from './api.gen.js';
2
+ export * from './content.gen.js';
3
+ export type { CreateDeploymentRequest, CreateEndpointRequest, CreateModelRequest, DeleteDeploymentRequest, DeleteEndpointRequest, DeleteModelRequest, Deployment, DeploymentQuantization, DeploymentStatus, Endpoint, EndpointPrivateNetworkDetails, EndpointPublicNetworkDetails, EndpointSpec, GetDeploymentCertificateRequest, GetDeploymentRequest, GetModelRequest, ListDeploymentsRequest, ListDeploymentsRequestOrderBy, ListDeploymentsResponse, ListModelsRequest, ListModelsRequestOrderBy, ListModelsResponse, ListNodeTypesRequest, ListNodeTypesResponse, Model, ModelSource, ModelStatus, ModelSupportInfo, ModelSupportedNode, ModelSupportedQuantization, NodeType, NodeTypeStock, UpdateDeploymentRequest, UpdateEndpointRequest, } from './types.gen';
4
+ export * as ValidationRules from './validation-rules.gen.js';
@@ -0,0 +1,9 @@
1
+ import { API } from "./api.gen.js";
2
+ import { DEPLOYMENT_TRANSIENT_STATUSES, MODEL_TRANSIENT_STATUSES } from "./content.gen.js";
3
+ import * as validationRules_gen from "./validation-rules.gen.js";
4
+ export {
5
+ API,
6
+ DEPLOYMENT_TRANSIENT_STATUSES,
7
+ MODEL_TRANSIENT_STATUSES,
8
+ validationRules_gen as ValidationRules
9
+ };
@@ -0,0 +1,260 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const randomName = require("@scaleway/random-name");
4
+ const json = require("../../../helpers/json.cjs");
5
+ const marshalling = require("../../../helpers/marshalling.cjs");
6
+ require("../../../vendor/base64/index.cjs");
7
+ const unmarshalEndpointPrivateNetworkDetails = (data) => {
8
+ if (!json.isJSONObject(data)) {
9
+ throw new TypeError(
10
+ `Unmarshalling the type 'EndpointPrivateNetworkDetails' failed as data isn't a dictionary.`
11
+ );
12
+ }
13
+ return {
14
+ privateNetworkId: data.private_network_id
15
+ };
16
+ };
17
+ const unmarshalEndpointPublicNetworkDetails = (data) => {
18
+ if (!json.isJSONObject(data)) {
19
+ throw new TypeError(
20
+ `Unmarshalling the type 'EndpointPublicNetworkDetails' failed as data isn't a dictionary.`
21
+ );
22
+ }
23
+ return {};
24
+ };
25
+ const unmarshalEndpoint = (data) => {
26
+ if (!json.isJSONObject(data)) {
27
+ throw new TypeError(
28
+ `Unmarshalling the type 'Endpoint' failed as data isn't a dictionary.`
29
+ );
30
+ }
31
+ return {
32
+ disableAuth: data.disable_auth,
33
+ id: data.id,
34
+ privateNetwork: data.private_network ? unmarshalEndpointPrivateNetworkDetails(data.private_network) : void 0,
35
+ publicNetwork: data.public_network ? unmarshalEndpointPublicNetworkDetails(data.public_network) : void 0,
36
+ url: data.url
37
+ };
38
+ };
39
+ const unmarshalModelSupportedQuantization = (data) => {
40
+ if (!json.isJSONObject(data)) {
41
+ throw new TypeError(
42
+ `Unmarshalling the type 'ModelSupportedQuantization' failed as data isn't a dictionary.`
43
+ );
44
+ }
45
+ return {
46
+ allowed: data.allowed,
47
+ maxContextSize: data.max_context_size,
48
+ quantizationBits: data.quantization_bits
49
+ };
50
+ };
51
+ const unmarshalModelSupportedNode = (data) => {
52
+ if (!json.isJSONObject(data)) {
53
+ throw new TypeError(
54
+ `Unmarshalling the type 'ModelSupportedNode' failed as data isn't a dictionary.`
55
+ );
56
+ }
57
+ return {
58
+ nodeTypeName: data.node_type_name,
59
+ quantizations: marshalling.unmarshalArrayOfObject(
60
+ data.quantizations,
61
+ unmarshalModelSupportedQuantization
62
+ )
63
+ };
64
+ };
65
+ const unmarshalModelSupportInfo = (data) => {
66
+ if (!json.isJSONObject(data)) {
67
+ throw new TypeError(
68
+ `Unmarshalling the type 'ModelSupportInfo' failed as data isn't a dictionary.`
69
+ );
70
+ }
71
+ return {
72
+ nodes: marshalling.unmarshalArrayOfObject(data.nodes, unmarshalModelSupportedNode)
73
+ };
74
+ };
75
+ const unmarshalDeploymentQuantization = (data) => {
76
+ if (!json.isJSONObject(data)) {
77
+ throw new TypeError(
78
+ `Unmarshalling the type 'DeploymentQuantization' failed as data isn't a dictionary.`
79
+ );
80
+ }
81
+ return {
82
+ bits: data.bits,
83
+ enabled: data.enabled
84
+ };
85
+ };
86
+ const unmarshalDeployment = (data) => {
87
+ if (!json.isJSONObject(data)) {
88
+ throw new TypeError(
89
+ `Unmarshalling the type 'Deployment' failed as data isn't a dictionary.`
90
+ );
91
+ }
92
+ return {
93
+ createdAt: marshalling.unmarshalDate(data.created_at),
94
+ endpoints: marshalling.unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint),
95
+ errorMessage: data.error_message,
96
+ id: data.id,
97
+ maxSize: data.max_size,
98
+ minSize: data.min_size,
99
+ modelId: data.model_id,
100
+ modelName: data.model_name,
101
+ name: data.name,
102
+ nodeTypeName: data.node_type_name,
103
+ projectId: data.project_id,
104
+ quantization: data.quantization ? unmarshalDeploymentQuantization(data.quantization) : void 0,
105
+ region: data.region,
106
+ size: data.size,
107
+ status: data.status,
108
+ tags: data.tags,
109
+ updatedAt: marshalling.unmarshalDate(data.updated_at)
110
+ };
111
+ };
112
+ const unmarshalModel = (data) => {
113
+ if (!json.isJSONObject(data)) {
114
+ throw new TypeError(
115
+ `Unmarshalling the type 'Model' failed as data isn't a dictionary.`
116
+ );
117
+ }
118
+ return {
119
+ createdAt: marshalling.unmarshalDate(data.created_at),
120
+ description: data.description,
121
+ errorMessage: data.error_message,
122
+ hasEula: data.has_eula,
123
+ id: data.id,
124
+ name: data.name,
125
+ nodesSupport: marshalling.unmarshalArrayOfObject(
126
+ data.nodes_support,
127
+ unmarshalModelSupportInfo
128
+ ),
129
+ parameterSizeBits: data.parameter_size_bits,
130
+ projectId: data.project_id,
131
+ region: data.region,
132
+ sizeBytes: data.size_bytes,
133
+ status: data.status,
134
+ tags: data.tags,
135
+ updatedAt: marshalling.unmarshalDate(data.updated_at)
136
+ };
137
+ };
138
+ const unmarshalListDeploymentsResponse = (data) => {
139
+ if (!json.isJSONObject(data)) {
140
+ throw new TypeError(
141
+ `Unmarshalling the type 'ListDeploymentsResponse' failed as data isn't a dictionary.`
142
+ );
143
+ }
144
+ return {
145
+ deployments: marshalling.unmarshalArrayOfObject(data.deployments, unmarshalDeployment),
146
+ totalCount: data.total_count
147
+ };
148
+ };
149
+ const unmarshalListModelsResponse = (data) => {
150
+ if (!json.isJSONObject(data)) {
151
+ throw new TypeError(
152
+ `Unmarshalling the type 'ListModelsResponse' failed as data isn't a dictionary.`
153
+ );
154
+ }
155
+ return {
156
+ models: marshalling.unmarshalArrayOfObject(data.models, unmarshalModel),
157
+ totalCount: data.total_count
158
+ };
159
+ };
160
+ const unmarshalNodeType = (data) => {
161
+ if (!json.isJSONObject(data)) {
162
+ throw new TypeError(
163
+ `Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`
164
+ );
165
+ }
166
+ return {
167
+ beta: data.beta,
168
+ createdAt: marshalling.unmarshalDate(data.created_at),
169
+ description: data.description,
170
+ disabled: data.disabled,
171
+ gpus: data.gpus,
172
+ memory: data.memory,
173
+ name: data.name,
174
+ region: data.region,
175
+ stockStatus: data.stock_status,
176
+ updatedAt: marshalling.unmarshalDate(data.updated_at),
177
+ vcpus: data.vcpus,
178
+ vram: data.vram
179
+ };
180
+ };
181
+ const unmarshalListNodeTypesResponse = (data) => {
182
+ if (!json.isJSONObject(data)) {
183
+ throw new TypeError(
184
+ `Unmarshalling the type 'ListNodeTypesResponse' failed as data isn't a dictionary.`
185
+ );
186
+ }
187
+ return {
188
+ nodeTypes: marshalling.unmarshalArrayOfObject(data.node_types, unmarshalNodeType),
189
+ totalCount: data.total_count
190
+ };
191
+ };
192
+ const marshalEndpointPrivateNetworkDetails = (request, defaults) => ({
193
+ private_network_id: request.privateNetworkId
194
+ });
195
+ const marshalEndpointPublicNetworkDetails = (request, defaults) => ({});
196
+ const marshalDeploymentQuantization = (request, defaults) => ({
197
+ bits: request.bits,
198
+ enabled: request.enabled
199
+ });
200
+ const marshalEndpointSpec = (request, defaults) => ({
201
+ disable_auth: request.disableAuth,
202
+ ...marshalling.resolveOneOf([
203
+ {
204
+ param: "public_network",
205
+ value: request.publicNetwork !== void 0 ? marshalEndpointPublicNetworkDetails(request.publicNetwork) : void 0
206
+ },
207
+ {
208
+ param: "private_network",
209
+ value: request.privateNetwork !== void 0 ? marshalEndpointPrivateNetworkDetails(
210
+ request.privateNetwork
211
+ ) : void 0
212
+ }
213
+ ])
214
+ });
215
+ const marshalCreateDeploymentRequest = (request, defaults) => ({
216
+ accept_eula: request.acceptEula,
217
+ endpoints: request.endpoints.map((elt) => marshalEndpointSpec(elt)),
218
+ max_size: request.maxSize,
219
+ min_size: request.minSize,
220
+ model_id: request.modelId,
221
+ name: request.name || randomName("inference"),
222
+ node_type_name: request.nodeTypeName,
223
+ project_id: request.projectId ?? defaults.defaultProjectId,
224
+ quantization: request.quantization !== void 0 ? marshalDeploymentQuantization(request.quantization) : void 0,
225
+ tags: request.tags
226
+ });
227
+ const marshalCreateEndpointRequest = (request, defaults) => ({
228
+ deployment_id: request.deploymentId,
229
+ endpoint: marshalEndpointSpec(request.endpoint)
230
+ });
231
+ const marshalModelSource = (request, defaults) => ({
232
+ url: request.url,
233
+ ...marshalling.resolveOneOf([{ param: "secret", value: request.secret }])
234
+ });
235
+ const marshalCreateModelRequest = (request, defaults) => ({
236
+ name: request.name || randomName("model"),
237
+ project_id: request.projectId ?? defaults.defaultProjectId,
238
+ source: marshalModelSource(request.source)
239
+ });
240
+ const marshalUpdateDeploymentRequest = (request, defaults) => ({
241
+ max_size: request.maxSize,
242
+ min_size: request.minSize,
243
+ name: request.name,
244
+ tags: request.tags
245
+ });
246
+ const marshalUpdateEndpointRequest = (request, defaults) => ({
247
+ disable_auth: request.disableAuth
248
+ });
249
+ exports.marshalCreateDeploymentRequest = marshalCreateDeploymentRequest;
250
+ exports.marshalCreateEndpointRequest = marshalCreateEndpointRequest;
251
+ exports.marshalCreateModelRequest = marshalCreateModelRequest;
252
+ exports.marshalUpdateDeploymentRequest = marshalUpdateDeploymentRequest;
253
+ exports.marshalUpdateEndpointRequest = marshalUpdateEndpointRequest;
254
+ exports.unmarshalDeployment = unmarshalDeployment;
255
+ exports.unmarshalEndpoint = unmarshalEndpoint;
256
+ exports.unmarshalListDeploymentsResponse = unmarshalListDeploymentsResponse;
257
+ exports.unmarshalListModelsResponse = unmarshalListModelsResponse;
258
+ exports.unmarshalListNodeTypesResponse = unmarshalListNodeTypesResponse;
259
+ exports.unmarshalModel = unmarshalModel;
260
+ exports.unmarshalModelSupportInfo = unmarshalModelSupportInfo;
@@ -0,0 +1,14 @@
1
+ import type { DefaultValues } from '../../../bridge';
2
+ import type { CreateDeploymentRequest, CreateEndpointRequest, CreateModelRequest, Deployment, Endpoint, ListDeploymentsResponse, ListModelsResponse, ListNodeTypesResponse, Model, ModelSupportInfo, UpdateDeploymentRequest, UpdateEndpointRequest } from './types.gen';
3
+ export declare const unmarshalEndpoint: (data: unknown) => Endpoint;
4
+ export declare const unmarshalModelSupportInfo: (data: unknown) => ModelSupportInfo;
5
+ export declare const unmarshalDeployment: (data: unknown) => Deployment;
6
+ export declare const unmarshalModel: (data: unknown) => Model;
7
+ export declare const unmarshalListDeploymentsResponse: (data: unknown) => ListDeploymentsResponse;
8
+ export declare const unmarshalListModelsResponse: (data: unknown) => ListModelsResponse;
9
+ export declare const unmarshalListNodeTypesResponse: (data: unknown) => ListNodeTypesResponse;
10
+ export declare const marshalCreateDeploymentRequest: (request: CreateDeploymentRequest, defaults: DefaultValues) => Record<string, unknown>;
11
+ export declare const marshalCreateEndpointRequest: (request: CreateEndpointRequest, defaults: DefaultValues) => Record<string, unknown>;
12
+ export declare const marshalCreateModelRequest: (request: CreateModelRequest, defaults: DefaultValues) => Record<string, unknown>;
13
+ export declare const marshalUpdateDeploymentRequest: (request: UpdateDeploymentRequest, defaults: DefaultValues) => Record<string, unknown>;
14
+ export declare const marshalUpdateEndpointRequest: (request: UpdateEndpointRequest, defaults: DefaultValues) => Record<string, unknown>;
@@ -0,0 +1,260 @@
1
+ import randomName from "@scaleway/random-name";
2
+ import { isJSONObject } from "../../../helpers/json.js";
3
+ import { unmarshalDate, unmarshalArrayOfObject, resolveOneOf } from "../../../helpers/marshalling.js";
4
+ import "../../../vendor/base64/index.js";
5
+ const unmarshalEndpointPrivateNetworkDetails = (data) => {
6
+ if (!isJSONObject(data)) {
7
+ throw new TypeError(
8
+ `Unmarshalling the type 'EndpointPrivateNetworkDetails' failed as data isn't a dictionary.`
9
+ );
10
+ }
11
+ return {
12
+ privateNetworkId: data.private_network_id
13
+ };
14
+ };
15
+ const unmarshalEndpointPublicNetworkDetails = (data) => {
16
+ if (!isJSONObject(data)) {
17
+ throw new TypeError(
18
+ `Unmarshalling the type 'EndpointPublicNetworkDetails' failed as data isn't a dictionary.`
19
+ );
20
+ }
21
+ return {};
22
+ };
23
+ const unmarshalEndpoint = (data) => {
24
+ if (!isJSONObject(data)) {
25
+ throw new TypeError(
26
+ `Unmarshalling the type 'Endpoint' failed as data isn't a dictionary.`
27
+ );
28
+ }
29
+ return {
30
+ disableAuth: data.disable_auth,
31
+ id: data.id,
32
+ privateNetwork: data.private_network ? unmarshalEndpointPrivateNetworkDetails(data.private_network) : void 0,
33
+ publicNetwork: data.public_network ? unmarshalEndpointPublicNetworkDetails(data.public_network) : void 0,
34
+ url: data.url
35
+ };
36
+ };
37
+ const unmarshalModelSupportedQuantization = (data) => {
38
+ if (!isJSONObject(data)) {
39
+ throw new TypeError(
40
+ `Unmarshalling the type 'ModelSupportedQuantization' failed as data isn't a dictionary.`
41
+ );
42
+ }
43
+ return {
44
+ allowed: data.allowed,
45
+ maxContextSize: data.max_context_size,
46
+ quantizationBits: data.quantization_bits
47
+ };
48
+ };
49
+ const unmarshalModelSupportedNode = (data) => {
50
+ if (!isJSONObject(data)) {
51
+ throw new TypeError(
52
+ `Unmarshalling the type 'ModelSupportedNode' failed as data isn't a dictionary.`
53
+ );
54
+ }
55
+ return {
56
+ nodeTypeName: data.node_type_name,
57
+ quantizations: unmarshalArrayOfObject(
58
+ data.quantizations,
59
+ unmarshalModelSupportedQuantization
60
+ )
61
+ };
62
+ };
63
+ const unmarshalModelSupportInfo = (data) => {
64
+ if (!isJSONObject(data)) {
65
+ throw new TypeError(
66
+ `Unmarshalling the type 'ModelSupportInfo' failed as data isn't a dictionary.`
67
+ );
68
+ }
69
+ return {
70
+ nodes: unmarshalArrayOfObject(data.nodes, unmarshalModelSupportedNode)
71
+ };
72
+ };
73
+ const unmarshalDeploymentQuantization = (data) => {
74
+ if (!isJSONObject(data)) {
75
+ throw new TypeError(
76
+ `Unmarshalling the type 'DeploymentQuantization' failed as data isn't a dictionary.`
77
+ );
78
+ }
79
+ return {
80
+ bits: data.bits,
81
+ enabled: data.enabled
82
+ };
83
+ };
84
+ const unmarshalDeployment = (data) => {
85
+ if (!isJSONObject(data)) {
86
+ throw new TypeError(
87
+ `Unmarshalling the type 'Deployment' failed as data isn't a dictionary.`
88
+ );
89
+ }
90
+ return {
91
+ createdAt: unmarshalDate(data.created_at),
92
+ endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint),
93
+ errorMessage: data.error_message,
94
+ id: data.id,
95
+ maxSize: data.max_size,
96
+ minSize: data.min_size,
97
+ modelId: data.model_id,
98
+ modelName: data.model_name,
99
+ name: data.name,
100
+ nodeTypeName: data.node_type_name,
101
+ projectId: data.project_id,
102
+ quantization: data.quantization ? unmarshalDeploymentQuantization(data.quantization) : void 0,
103
+ region: data.region,
104
+ size: data.size,
105
+ status: data.status,
106
+ tags: data.tags,
107
+ updatedAt: unmarshalDate(data.updated_at)
108
+ };
109
+ };
110
+ const unmarshalModel = (data) => {
111
+ if (!isJSONObject(data)) {
112
+ throw new TypeError(
113
+ `Unmarshalling the type 'Model' failed as data isn't a dictionary.`
114
+ );
115
+ }
116
+ return {
117
+ createdAt: unmarshalDate(data.created_at),
118
+ description: data.description,
119
+ errorMessage: data.error_message,
120
+ hasEula: data.has_eula,
121
+ id: data.id,
122
+ name: data.name,
123
+ nodesSupport: unmarshalArrayOfObject(
124
+ data.nodes_support,
125
+ unmarshalModelSupportInfo
126
+ ),
127
+ parameterSizeBits: data.parameter_size_bits,
128
+ projectId: data.project_id,
129
+ region: data.region,
130
+ sizeBytes: data.size_bytes,
131
+ status: data.status,
132
+ tags: data.tags,
133
+ updatedAt: unmarshalDate(data.updated_at)
134
+ };
135
+ };
136
+ const unmarshalListDeploymentsResponse = (data) => {
137
+ if (!isJSONObject(data)) {
138
+ throw new TypeError(
139
+ `Unmarshalling the type 'ListDeploymentsResponse' failed as data isn't a dictionary.`
140
+ );
141
+ }
142
+ return {
143
+ deployments: unmarshalArrayOfObject(data.deployments, unmarshalDeployment),
144
+ totalCount: data.total_count
145
+ };
146
+ };
147
+ const unmarshalListModelsResponse = (data) => {
148
+ if (!isJSONObject(data)) {
149
+ throw new TypeError(
150
+ `Unmarshalling the type 'ListModelsResponse' failed as data isn't a dictionary.`
151
+ );
152
+ }
153
+ return {
154
+ models: unmarshalArrayOfObject(data.models, unmarshalModel),
155
+ totalCount: data.total_count
156
+ };
157
+ };
158
+ const unmarshalNodeType = (data) => {
159
+ if (!isJSONObject(data)) {
160
+ throw new TypeError(
161
+ `Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`
162
+ );
163
+ }
164
+ return {
165
+ beta: data.beta,
166
+ createdAt: unmarshalDate(data.created_at),
167
+ description: data.description,
168
+ disabled: data.disabled,
169
+ gpus: data.gpus,
170
+ memory: data.memory,
171
+ name: data.name,
172
+ region: data.region,
173
+ stockStatus: data.stock_status,
174
+ updatedAt: unmarshalDate(data.updated_at),
175
+ vcpus: data.vcpus,
176
+ vram: data.vram
177
+ };
178
+ };
179
+ const unmarshalListNodeTypesResponse = (data) => {
180
+ if (!isJSONObject(data)) {
181
+ throw new TypeError(
182
+ `Unmarshalling the type 'ListNodeTypesResponse' failed as data isn't a dictionary.`
183
+ );
184
+ }
185
+ return {
186
+ nodeTypes: unmarshalArrayOfObject(data.node_types, unmarshalNodeType),
187
+ totalCount: data.total_count
188
+ };
189
+ };
190
+ const marshalEndpointPrivateNetworkDetails = (request, defaults) => ({
191
+ private_network_id: request.privateNetworkId
192
+ });
193
+ const marshalEndpointPublicNetworkDetails = (request, defaults) => ({});
194
+ const marshalDeploymentQuantization = (request, defaults) => ({
195
+ bits: request.bits,
196
+ enabled: request.enabled
197
+ });
198
+ const marshalEndpointSpec = (request, defaults) => ({
199
+ disable_auth: request.disableAuth,
200
+ ...resolveOneOf([
201
+ {
202
+ param: "public_network",
203
+ value: request.publicNetwork !== void 0 ? marshalEndpointPublicNetworkDetails(request.publicNetwork) : void 0
204
+ },
205
+ {
206
+ param: "private_network",
207
+ value: request.privateNetwork !== void 0 ? marshalEndpointPrivateNetworkDetails(
208
+ request.privateNetwork
209
+ ) : void 0
210
+ }
211
+ ])
212
+ });
213
+ const marshalCreateDeploymentRequest = (request, defaults) => ({
214
+ accept_eula: request.acceptEula,
215
+ endpoints: request.endpoints.map((elt) => marshalEndpointSpec(elt)),
216
+ max_size: request.maxSize,
217
+ min_size: request.minSize,
218
+ model_id: request.modelId,
219
+ name: request.name || randomName("inference"),
220
+ node_type_name: request.nodeTypeName,
221
+ project_id: request.projectId ?? defaults.defaultProjectId,
222
+ quantization: request.quantization !== void 0 ? marshalDeploymentQuantization(request.quantization) : void 0,
223
+ tags: request.tags
224
+ });
225
+ const marshalCreateEndpointRequest = (request, defaults) => ({
226
+ deployment_id: request.deploymentId,
227
+ endpoint: marshalEndpointSpec(request.endpoint)
228
+ });
229
+ const marshalModelSource = (request, defaults) => ({
230
+ url: request.url,
231
+ ...resolveOneOf([{ param: "secret", value: request.secret }])
232
+ });
233
+ const marshalCreateModelRequest = (request, defaults) => ({
234
+ name: request.name || randomName("model"),
235
+ project_id: request.projectId ?? defaults.defaultProjectId,
236
+ source: marshalModelSource(request.source)
237
+ });
238
+ const marshalUpdateDeploymentRequest = (request, defaults) => ({
239
+ max_size: request.maxSize,
240
+ min_size: request.minSize,
241
+ name: request.name,
242
+ tags: request.tags
243
+ });
244
+ const marshalUpdateEndpointRequest = (request, defaults) => ({
245
+ disable_auth: request.disableAuth
246
+ });
247
+ export {
248
+ marshalCreateDeploymentRequest,
249
+ marshalCreateEndpointRequest,
250
+ marshalCreateModelRequest,
251
+ marshalUpdateDeploymentRequest,
252
+ marshalUpdateEndpointRequest,
253
+ unmarshalDeployment,
254
+ unmarshalEndpoint,
255
+ unmarshalListDeploymentsResponse,
256
+ unmarshalListModelsResponse,
257
+ unmarshalListNodeTypesResponse,
258
+ unmarshalModel,
259
+ unmarshalModelSupportInfo
260
+ };