@scaleway/sdk-inference 2.2.2 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,271 +1,175 @@
1
+ import { isJSONObject, resolveOneOf, unmarshalArrayOfObject, unmarshalDate } from "@scaleway/sdk-client";
1
2
  import randomName from "@scaleway/random-name";
2
- import { resolveOneOf, isJSONObject, unmarshalArrayOfObject, unmarshalDate } from "@scaleway/sdk-client";
3
- const unmarshalEndpointPrivateNetworkDetails = (data) => {
4
- if (!isJSONObject(data)) {
5
- throw new TypeError(
6
- `Unmarshalling the type 'EndpointPrivateNetworkDetails' failed as data isn't a dictionary.`
7
- );
8
- }
9
- return {
10
- privateNetworkId: data.private_network_id
11
- };
3
+ var unmarshalEndpointPrivateNetworkDetails = (data) => {
4
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'EndpointPrivateNetworkDetails' failed as data isn't a dictionary.`);
5
+ return { privateNetworkId: data.private_network_id };
12
6
  };
13
- const unmarshalEndpointPublicAccessDetails = (data) => {
14
- if (!isJSONObject(data)) {
15
- throw new TypeError(
16
- `Unmarshalling the type 'EndpointPublicAccessDetails' failed as data isn't a dictionary.`
17
- );
18
- }
19
- return {};
7
+ var unmarshalEndpointPublicAccessDetails = (data) => {
8
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'EndpointPublicAccessDetails' failed as data isn't a dictionary.`);
9
+ return {};
20
10
  };
21
11
  const unmarshalEndpoint = (data) => {
22
- if (!isJSONObject(data)) {
23
- throw new TypeError(
24
- `Unmarshalling the type 'Endpoint' failed as data isn't a dictionary.`
25
- );
26
- }
27
- return {
28
- disableAuth: data.disable_auth,
29
- id: data.id,
30
- privateNetwork: data.private_network ? unmarshalEndpointPrivateNetworkDetails(data.private_network) : void 0,
31
- publicAccess: data.public_access ? unmarshalEndpointPublicAccessDetails(data.public_access) : void 0,
32
- url: data.url
33
- };
12
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Endpoint' failed as data isn't a dictionary.`);
13
+ return {
14
+ disableAuth: data.disable_auth,
15
+ id: data.id,
16
+ privateNetwork: data.private_network ? unmarshalEndpointPrivateNetworkDetails(data.private_network) : void 0,
17
+ publicAccess: data.public_access ? unmarshalEndpointPublicAccessDetails(data.public_access) : void 0,
18
+ url: data.url
19
+ };
34
20
  };
35
21
  const unmarshalDeployment = (data) => {
36
- if (!isJSONObject(data)) {
37
- throw new TypeError(
38
- `Unmarshalling the type 'Deployment' failed as data isn't a dictionary.`
39
- );
40
- }
41
- return {
42
- createdAt: unmarshalDate(data.created_at),
43
- endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint),
44
- errorMessage: data.error_message,
45
- id: data.id,
46
- maxSize: data.max_size,
47
- minSize: data.min_size,
48
- modelId: data.model_id,
49
- modelName: data.model_name,
50
- name: data.name,
51
- nodeType: data.node_type,
52
- projectId: data.project_id,
53
- region: data.region,
54
- size: data.size,
55
- status: data.status,
56
- tags: data.tags,
57
- updatedAt: unmarshalDate(data.updated_at)
58
- };
59
- };
60
- const unmarshalModelS3Model = (data) => {
61
- if (!isJSONObject(data)) {
62
- throw new TypeError(
63
- `Unmarshalling the type 'ModelS3Model' failed as data isn't a dictionary.`
64
- );
65
- }
66
- return {
67
- nodeType: data.node_type,
68
- pythonDependencies: data.python_dependencies,
69
- s3Url: data.s3_url,
70
- tritonServerVersion: data.triton_server_version
71
- };
22
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Deployment' failed as data isn't a dictionary.`);
23
+ return {
24
+ createdAt: unmarshalDate(data.created_at),
25
+ endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint),
26
+ errorMessage: data.error_message,
27
+ id: data.id,
28
+ maxSize: data.max_size,
29
+ minSize: data.min_size,
30
+ modelId: data.model_id,
31
+ modelName: data.model_name,
32
+ name: data.name,
33
+ nodeType: data.node_type,
34
+ projectId: data.project_id,
35
+ region: data.region,
36
+ size: data.size,
37
+ status: data.status,
38
+ tags: data.tags,
39
+ updatedAt: unmarshalDate(data.updated_at)
40
+ };
41
+ };
42
+ var unmarshalModelS3Model = (data) => {
43
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ModelS3Model' failed as data isn't a dictionary.`);
44
+ return {
45
+ nodeType: data.node_type,
46
+ pythonDependencies: data.python_dependencies,
47
+ s3Url: data.s3_url,
48
+ tritonServerVersion: data.triton_server_version
49
+ };
72
50
  };
73
51
  const unmarshalModel = (data) => {
74
- if (!isJSONObject(data)) {
75
- throw new TypeError(
76
- `Unmarshalling the type 'Model' failed as data isn't a dictionary.`
77
- );
78
- }
79
- return {
80
- compatibleNodeTypes: data.compatible_node_types,
81
- createdAt: unmarshalDate(data.created_at),
82
- description: data.description,
83
- hasEula: data.has_eula,
84
- id: data.id,
85
- isPublic: data.is_public,
86
- name: data.name,
87
- projectId: data.project_id,
88
- provider: data.provider,
89
- quantizationLevel: data.quantization_level,
90
- region: data.region,
91
- s3Model: data.s3_model ? unmarshalModelS3Model(data.s3_model) : void 0,
92
- tags: data.tags,
93
- updatedAt: unmarshalDate(data.updated_at)
94
- };
95
- };
96
- const unmarshalACLRule = (data) => {
97
- if (!isJSONObject(data)) {
98
- throw new TypeError(
99
- `Unmarshalling the type 'ACLRule' failed as data isn't a dictionary.`
100
- );
101
- }
102
- return {
103
- description: data.description,
104
- id: data.id,
105
- ip: data.ip
106
- };
52
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Model' failed as data isn't a dictionary.`);
53
+ return {
54
+ compatibleNodeTypes: data.compatible_node_types,
55
+ createdAt: unmarshalDate(data.created_at),
56
+ description: data.description,
57
+ hasEula: data.has_eula,
58
+ id: data.id,
59
+ isPublic: data.is_public,
60
+ name: data.name,
61
+ projectId: data.project_id,
62
+ provider: data.provider,
63
+ quantizationLevel: data.quantization_level,
64
+ region: data.region,
65
+ s3Model: data.s3_model ? unmarshalModelS3Model(data.s3_model) : void 0,
66
+ tags: data.tags,
67
+ updatedAt: unmarshalDate(data.updated_at)
68
+ };
69
+ };
70
+ var unmarshalACLRule = (data) => {
71
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ACLRule' failed as data isn't a dictionary.`);
72
+ return {
73
+ description: data.description,
74
+ id: data.id,
75
+ ip: data.ip
76
+ };
107
77
  };
108
78
  const unmarshalAddDeploymentACLRulesResponse = (data) => {
109
- if (!isJSONObject(data)) {
110
- throw new TypeError(
111
- `Unmarshalling the type 'AddDeploymentACLRulesResponse' failed as data isn't a dictionary.`
112
- );
113
- }
114
- return {
115
- rules: unmarshalArrayOfObject(data.rules, unmarshalACLRule)
116
- };
79
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'AddDeploymentACLRulesResponse' failed as data isn't a dictionary.`);
80
+ return { rules: unmarshalArrayOfObject(data.rules, unmarshalACLRule) };
117
81
  };
118
82
  const unmarshalEula = (data) => {
119
- if (!isJSONObject(data)) {
120
- throw new TypeError(
121
- `Unmarshalling the type 'Eula' failed as data isn't a dictionary.`
122
- );
123
- }
124
- return {
125
- content: data.content
126
- };
83
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Eula' failed as data isn't a dictionary.`);
84
+ return { content: data.content };
127
85
  };
128
86
  const unmarshalListDeploymentACLRulesResponse = (data) => {
129
- if (!isJSONObject(data)) {
130
- throw new TypeError(
131
- `Unmarshalling the type 'ListDeploymentACLRulesResponse' failed as data isn't a dictionary.`
132
- );
133
- }
134
- return {
135
- rules: unmarshalArrayOfObject(data.rules, unmarshalACLRule),
136
- totalCount: data.total_count
137
- };
87
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListDeploymentACLRulesResponse' failed as data isn't a dictionary.`);
88
+ return {
89
+ rules: unmarshalArrayOfObject(data.rules, unmarshalACLRule),
90
+ totalCount: data.total_count
91
+ };
138
92
  };
139
93
  const unmarshalListDeploymentsResponse = (data) => {
140
- if (!isJSONObject(data)) {
141
- throw new TypeError(
142
- `Unmarshalling the type 'ListDeploymentsResponse' failed as data isn't a dictionary.`
143
- );
144
- }
145
- return {
146
- deployments: unmarshalArrayOfObject(data.deployments, unmarshalDeployment),
147
- totalCount: data.total_count
148
- };
94
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListDeploymentsResponse' failed as data isn't a dictionary.`);
95
+ return {
96
+ deployments: unmarshalArrayOfObject(data.deployments, unmarshalDeployment),
97
+ totalCount: data.total_count
98
+ };
149
99
  };
150
100
  const unmarshalListModelsResponse = (data) => {
151
- if (!isJSONObject(data)) {
152
- throw new TypeError(
153
- `Unmarshalling the type 'ListModelsResponse' failed as data isn't a dictionary.`
154
- );
155
- }
156
- return {
157
- models: unmarshalArrayOfObject(data.models, unmarshalModel),
158
- totalCount: data.total_count
159
- };
160
- };
161
- const unmarshalNodeType = (data) => {
162
- if (!isJSONObject(data)) {
163
- throw new TypeError(
164
- `Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`
165
- );
166
- }
167
- return {
168
- beta: data.beta,
169
- createdAt: unmarshalDate(data.created_at),
170
- description: data.description,
171
- disabled: data.disabled,
172
- gpus: data.gpus,
173
- memory: data.memory,
174
- name: data.name,
175
- region: data.region,
176
- stockStatus: data.stock_status,
177
- updatedAt: unmarshalDate(data.updated_at),
178
- vcpus: data.vcpus,
179
- vram: data.vram
180
- };
101
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListModelsResponse' failed as data isn't a dictionary.`);
102
+ return {
103
+ models: unmarshalArrayOfObject(data.models, unmarshalModel),
104
+ totalCount: data.total_count
105
+ };
106
+ };
107
+ var unmarshalNodeType = (data) => {
108
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`);
109
+ return {
110
+ beta: data.beta,
111
+ createdAt: unmarshalDate(data.created_at),
112
+ description: data.description,
113
+ disabled: data.disabled,
114
+ gpus: data.gpus,
115
+ memory: data.memory,
116
+ name: data.name,
117
+ region: data.region,
118
+ stockStatus: data.stock_status,
119
+ updatedAt: unmarshalDate(data.updated_at),
120
+ vcpus: data.vcpus,
121
+ vram: data.vram
122
+ };
181
123
  };
182
124
  const unmarshalListNodeTypesResponse = (data) => {
183
- if (!isJSONObject(data)) {
184
- throw new TypeError(
185
- `Unmarshalling the type 'ListNodeTypesResponse' failed as data isn't a dictionary.`
186
- );
187
- }
188
- return {
189
- nodeTypes: unmarshalArrayOfObject(data.node_types, unmarshalNodeType),
190
- totalCount: data.total_count
191
- };
125
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListNodeTypesResponse' failed as data isn't a dictionary.`);
126
+ return {
127
+ nodeTypes: unmarshalArrayOfObject(data.node_types, unmarshalNodeType),
128
+ totalCount: data.total_count
129
+ };
192
130
  };
193
131
  const unmarshalSetDeploymentACLRulesResponse = (data) => {
194
- if (!isJSONObject(data)) {
195
- throw new TypeError(
196
- `Unmarshalling the type 'SetDeploymentACLRulesResponse' failed as data isn't a dictionary.`
197
- );
198
- }
199
- return {
200
- rules: unmarshalArrayOfObject(data.rules, unmarshalACLRule)
201
- };
132
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SetDeploymentACLRulesResponse' failed as data isn't a dictionary.`);
133
+ return { rules: unmarshalArrayOfObject(data.rules, unmarshalACLRule) };
202
134
  };
203
- const marshalACLRuleRequest = (request, defaults) => ({
204
- description: request.description,
205
- ip: request.ip
206
- });
207
- const marshalAddDeploymentACLRulesRequest = (request, defaults) => ({
208
- acls: request.acls !== void 0 ? request.acls.map((elt) => marshalACLRuleRequest(elt)) : void 0
135
+ var marshalACLRuleRequest = (request, defaults) => ({
136
+ description: request.description,
137
+ ip: request.ip
209
138
  });
210
- const marshalEndpointSpecPrivateNetwork = (request, defaults) => ({
211
- private_network_id: request.privateNetworkId
212
- });
213
- const marshalEndpointSpecPublic = (request, defaults) => ({});
214
- const marshalEndpointSpec = (request, defaults) => ({
215
- disable_auth: request.disableAuth,
216
- ...resolveOneOf([
217
- {
218
- param: "public",
219
- value: request.public !== void 0 ? marshalEndpointSpecPublic(request.public) : void 0
220
- },
221
- {
222
- param: "private_network",
223
- value: request.privateNetwork !== void 0 ? marshalEndpointSpecPrivateNetwork(request.privateNetwork) : void 0
224
- }
225
- ])
139
+ const marshalAddDeploymentACLRulesRequest = (request, defaults) => ({ acls: request.acls !== void 0 ? request.acls.map((elt) => marshalACLRuleRequest(elt, defaults)) : void 0 });
140
+ var marshalEndpointSpecPrivateNetwork = (request, defaults) => ({ private_network_id: request.privateNetworkId });
141
+ var marshalEndpointSpecPublic = (request, defaults) => ({});
142
+ var marshalEndpointSpec = (request, defaults) => ({
143
+ disable_auth: request.disableAuth,
144
+ ...resolveOneOf([{
145
+ param: "public",
146
+ value: request.public !== void 0 ? marshalEndpointSpecPublic(request.public, defaults) : void 0
147
+ }, {
148
+ param: "private_network",
149
+ value: request.privateNetwork !== void 0 ? marshalEndpointSpecPrivateNetwork(request.privateNetwork, defaults) : void 0
150
+ }])
226
151
  });
227
152
  const marshalCreateDeploymentRequest = (request, defaults) => ({
228
- accept_eula: request.acceptEula,
229
- endpoints: request.endpoints.map((elt) => marshalEndpointSpec(elt)),
230
- max_size: request.maxSize,
231
- min_size: request.minSize,
232
- model_name: request.modelName,
233
- name: request.name || randomName("inference"),
234
- node_type: request.nodeType,
235
- project_id: request.projectId ?? defaults.defaultProjectId,
236
- tags: request.tags
153
+ accept_eula: request.acceptEula,
154
+ endpoints: request.endpoints.map((elt) => marshalEndpointSpec(elt, defaults)),
155
+ max_size: request.maxSize,
156
+ min_size: request.minSize,
157
+ model_name: request.modelName,
158
+ name: request.name || randomName("inference"),
159
+ node_type: request.nodeType,
160
+ project_id: request.projectId ?? defaults.defaultProjectId,
161
+ tags: request.tags
237
162
  });
238
163
  const marshalCreateEndpointRequest = (request, defaults) => ({
239
- deployment_id: request.deploymentId,
240
- endpoint: marshalEndpointSpec(request.endpoint)
241
- });
242
- const marshalSetDeploymentACLRulesRequest = (request, defaults) => ({
243
- acls: request.acls !== void 0 ? request.acls.map((elt) => marshalACLRuleRequest(elt)) : void 0
164
+ deployment_id: request.deploymentId,
165
+ endpoint: marshalEndpointSpec(request.endpoint, defaults)
244
166
  });
167
+ const marshalSetDeploymentACLRulesRequest = (request, defaults) => ({ acls: request.acls !== void 0 ? request.acls.map((elt) => marshalACLRuleRequest(elt, defaults)) : void 0 });
245
168
  const marshalUpdateDeploymentRequest = (request, defaults) => ({
246
- max_size: request.maxSize,
247
- min_size: request.minSize,
248
- name: request.name,
249
- tags: request.tags
169
+ max_size: request.maxSize,
170
+ min_size: request.minSize,
171
+ name: request.name,
172
+ tags: request.tags
250
173
  });
251
- const marshalUpdateEndpointRequest = (request, defaults) => ({
252
- disable_auth: request.disableAuth
253
- });
254
- export {
255
- marshalAddDeploymentACLRulesRequest,
256
- marshalCreateDeploymentRequest,
257
- marshalCreateEndpointRequest,
258
- marshalSetDeploymentACLRulesRequest,
259
- marshalUpdateDeploymentRequest,
260
- marshalUpdateEndpointRequest,
261
- unmarshalAddDeploymentACLRulesResponse,
262
- unmarshalDeployment,
263
- unmarshalEndpoint,
264
- unmarshalEula,
265
- unmarshalListDeploymentACLRulesResponse,
266
- unmarshalListDeploymentsResponse,
267
- unmarshalListModelsResponse,
268
- unmarshalListNodeTypesResponse,
269
- unmarshalModel,
270
- unmarshalSetDeploymentACLRulesResponse
271
- };
174
+ const marshalUpdateEndpointRequest = (request, defaults) => ({ disable_auth: request.disableAuth });
175
+ export { marshalAddDeploymentACLRulesRequest, marshalCreateDeploymentRequest, marshalCreateEndpointRequest, marshalSetDeploymentACLRulesRequest, marshalUpdateDeploymentRequest, marshalUpdateEndpointRequest, unmarshalAddDeploymentACLRulesResponse, unmarshalDeployment, unmarshalEndpoint, unmarshalEula, unmarshalListDeploymentACLRulesResponse, unmarshalListDeploymentsResponse, unmarshalListModelsResponse, unmarshalListNodeTypesResponse, unmarshalModel, unmarshalSetDeploymentACLRulesResponse };
@@ -1,56 +1,54 @@
1
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
+ var validation_rules_gen_exports = /* @__PURE__ */ __exportAll({
3
+ CreateDeploymentRequest: () => CreateDeploymentRequest,
4
+ ListDeploymentsRequest: () => ListDeploymentsRequest,
5
+ ListModelsRequest: () => ListModelsRequest,
6
+ UpdateDeploymentRequest: () => UpdateDeploymentRequest
7
+ });
1
8
  const CreateDeploymentRequest = {
2
- maxSize: {
3
- greaterThanOrEqual: 1,
4
- lessThanOrEqual: 50
5
- },
6
- minSize: {
7
- greaterThanOrEqual: 1,
8
- lessThanOrEqual: 50
9
- },
10
- modelName: {
11
- maxLength: 255,
12
- minLength: 0,
13
- pattern: /^[A-Za-z0-9_-]+\/[A-Za-z0-9_.-]+(:\w+)?$/
14
- },
15
- name: {
16
- maxLength: 255,
17
- minLength: 1,
18
- pattern: /^[A-Za-z0-9-_]+$/
19
- },
20
- nodeType: {
21
- maxLength: 64,
22
- minLength: 1
23
- }
24
- };
25
- const ListDeploymentsRequest = {
26
- name: {
27
- maxLength: 255,
28
- minLength: 1
29
- }
30
- };
31
- const ListModelsRequest = {
32
- name: {
33
- maxLength: 255,
34
- minLength: 1
35
- }
9
+ maxSize: {
10
+ greaterThanOrEqual: 1,
11
+ lessThanOrEqual: 50
12
+ },
13
+ minSize: {
14
+ greaterThanOrEqual: 1,
15
+ lessThanOrEqual: 50
16
+ },
17
+ modelName: {
18
+ maxLength: 255,
19
+ minLength: 0,
20
+ pattern: /^[A-Za-z0-9_-]+\/[A-Za-z0-9_.-]+(:\w+)?$/
21
+ },
22
+ name: {
23
+ maxLength: 255,
24
+ minLength: 1,
25
+ pattern: /^[A-Za-z0-9-_]+$/
26
+ },
27
+ nodeType: {
28
+ maxLength: 64,
29
+ minLength: 1
30
+ }
36
31
  };
32
+ const ListDeploymentsRequest = { name: {
33
+ maxLength: 255,
34
+ minLength: 1
35
+ } };
36
+ const ListModelsRequest = { name: {
37
+ maxLength: 255,
38
+ minLength: 1
39
+ } };
37
40
  const UpdateDeploymentRequest = {
38
- maxSize: {
39
- greaterThanOrEqual: 1,
40
- lessThanOrEqual: 50
41
- },
42
- minSize: {
43
- greaterThanOrEqual: 1,
44
- lessThanOrEqual: 50
45
- },
46
- name: {
47
- maxLength: 255,
48
- minLength: 1
49
- }
50
- };
51
- export {
52
- CreateDeploymentRequest,
53
- ListDeploymentsRequest,
54
- ListModelsRequest,
55
- UpdateDeploymentRequest
41
+ maxSize: {
42
+ greaterThanOrEqual: 1,
43
+ lessThanOrEqual: 50
44
+ },
45
+ minSize: {
46
+ greaterThanOrEqual: 1,
47
+ lessThanOrEqual: 50
48
+ },
49
+ name: {
50
+ maxLength: 255,
51
+ minLength: 1
52
+ }
56
53
  };
54
+ export { validation_rules_gen_exports };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleway/sdk-inference",
3
- "version": "2.2.2",
3
+ "version": "2.3.1",
4
4
  "description": "Scaleway SDK inference",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
@@ -27,13 +27,13 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@scaleway/random-name": "5.1.2",
30
- "@scaleway/sdk-std": "2.1.1"
30
+ "@scaleway/sdk-std": "2.2.1"
31
31
  },
32
32
  "peerDependencies": {
33
- "@scaleway/sdk-client": "^2.1.0"
33
+ "@scaleway/sdk-client": "^2.2.1"
34
34
  },
35
35
  "devDependencies": {
36
- "@scaleway/sdk-client": "^2.1.0"
36
+ "@scaleway/sdk-client": "^2.2.1"
37
37
  },
38
38
  "scripts": {
39
39
  "package:check": "pnpm publint",