@nexgencloud/hyperstack-sdk-typescript 1.55.1-alpha → 1.55.4-alpha
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 +2 -2
- package/api.ts +68 -0
- package/common.ts +2 -2
- package/dist/api.d.ts +68 -0
- package/dist/common.js +2 -0
- package/dist/esm/api.d.ts +68 -0
- package/dist/esm/common.js +2 -0
- package/dist/esm/hyperstackHeaders.d.ts +24 -0
- package/dist/esm/hyperstackHeaders.js +68 -0
- package/dist/hyperstackHeaders.d.ts +24 -0
- package/dist/hyperstackHeaders.js +72 -0
- package/hyperstackHeaders.ts +78 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
## @nexgencloud/hyperstack-sdk-typescript@v1.55.
|
|
1
|
+
## @nexgencloud/hyperstack-sdk-typescript@v1.55.4-alpha
|
|
2
2
|
|
|
3
3
|
This generator creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments:
|
|
4
4
|
|
|
@@ -36,7 +36,7 @@ navigate to the folder of your consuming project and run one of the following co
|
|
|
36
36
|
_published:_
|
|
37
37
|
|
|
38
38
|
```
|
|
39
|
-
npm install @nexgencloud/hyperstack-sdk-typescript@v1.55.
|
|
39
|
+
npm install @nexgencloud/hyperstack-sdk-typescript@v1.55.4-alpha --save
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
_unPublished (not recommended):_
|
package/api.ts
CHANGED
|
@@ -1783,6 +1783,43 @@ export interface CompatibleFlavor {
|
|
|
1783
1783
|
*/
|
|
1784
1784
|
'reason'?: string;
|
|
1785
1785
|
}
|
|
1786
|
+
/**
|
|
1787
|
+
*
|
|
1788
|
+
* @export
|
|
1789
|
+
* @interface CompatibleImage
|
|
1790
|
+
*/
|
|
1791
|
+
export interface CompatibleImage {
|
|
1792
|
+
/**
|
|
1793
|
+
* JSON constraints object
|
|
1794
|
+
* @type {object}
|
|
1795
|
+
* @memberof CompatibleImage
|
|
1796
|
+
*/
|
|
1797
|
+
'constraints'?: object;
|
|
1798
|
+
/**
|
|
1799
|
+
*
|
|
1800
|
+
* @type {number}
|
|
1801
|
+
* @memberof CompatibleImage
|
|
1802
|
+
*/
|
|
1803
|
+
'image_id'?: number;
|
|
1804
|
+
/**
|
|
1805
|
+
*
|
|
1806
|
+
* @type {string}
|
|
1807
|
+
* @memberof CompatibleImage
|
|
1808
|
+
*/
|
|
1809
|
+
'image_name'?: string;
|
|
1810
|
+
/**
|
|
1811
|
+
* Either \'hard\' or \'soft\'
|
|
1812
|
+
* @type {string}
|
|
1813
|
+
* @memberof CompatibleImage
|
|
1814
|
+
*/
|
|
1815
|
+
'link_type'?: string;
|
|
1816
|
+
/**
|
|
1817
|
+
*
|
|
1818
|
+
* @type {string}
|
|
1819
|
+
* @memberof CompatibleImage
|
|
1820
|
+
*/
|
|
1821
|
+
'reason'?: string;
|
|
1822
|
+
}
|
|
1786
1823
|
/**
|
|
1787
1824
|
*
|
|
1788
1825
|
* @export
|
|
@@ -4097,6 +4134,12 @@ export interface FlavorFields {
|
|
|
4097
4134
|
* @memberof FlavorFields
|
|
4098
4135
|
*/
|
|
4099
4136
|
'id'?: number;
|
|
4137
|
+
/**
|
|
4138
|
+
* Image compatibility restrictions for this flavor (flavor → image links)
|
|
4139
|
+
* @type {ImageRestrictions}
|
|
4140
|
+
* @memberof FlavorFields
|
|
4141
|
+
*/
|
|
4142
|
+
'image_restrictions'?: ImageRestrictions;
|
|
4100
4143
|
/**
|
|
4101
4144
|
*
|
|
4102
4145
|
* @type {Array<LableResonse>}
|
|
@@ -4845,6 +4888,31 @@ export interface ImageGetResponse {
|
|
|
4845
4888
|
*/
|
|
4846
4889
|
'type'?: string;
|
|
4847
4890
|
}
|
|
4891
|
+
/**
|
|
4892
|
+
*
|
|
4893
|
+
* @export
|
|
4894
|
+
* @interface ImageRestrictions
|
|
4895
|
+
*/
|
|
4896
|
+
export interface ImageRestrictions {
|
|
4897
|
+
/**
|
|
4898
|
+
* List of images this flavor is allowed to launch, with link metadata
|
|
4899
|
+
* @type {Array<CompatibleImage>}
|
|
4900
|
+
* @memberof ImageRestrictions
|
|
4901
|
+
*/
|
|
4902
|
+
'compatible_images'?: Array<CompatibleImage>;
|
|
4903
|
+
/**
|
|
4904
|
+
* Whether the flavor is restricted to a set of images
|
|
4905
|
+
* @type {boolean}
|
|
4906
|
+
* @memberof ImageRestrictions
|
|
4907
|
+
*/
|
|
4908
|
+
'has_image_restrictions'?: boolean;
|
|
4909
|
+
/**
|
|
4910
|
+
* Either \'hard\', \'soft\', or null if no restrictions
|
|
4911
|
+
* @type {string}
|
|
4912
|
+
* @memberof ImageRestrictions
|
|
4913
|
+
*/
|
|
4914
|
+
'restriction_type'?: string;
|
|
4915
|
+
}
|
|
4848
4916
|
/**
|
|
4849
4917
|
*
|
|
4850
4918
|
* @export
|
package/common.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import type { Configuration } from "./configuration";
|
|
17
17
|
import type { RequestArgs } from "./base";
|
|
18
18
|
import type { AxiosInstance, AxiosResponse } from 'axios';
|
|
19
|
-
import { RequiredError } from "./base";
|
|
19
|
+
import { RequiredError } from "./base"; import { applyHyperstackHeaders } from "./hyperstackHeaders";
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
*
|
|
@@ -144,7 +144,7 @@ export const toPathString = function (url: URL) {
|
|
|
144
144
|
*/
|
|
145
145
|
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
|
146
146
|
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH): Promise<R> => {
|
|
147
|
-
const axiosRequestArgs = {...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url};
|
|
147
|
+
const axiosRequestArgs = {...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url}; applyHyperstackHeaders(axiosRequestArgs);
|
|
148
148
|
return axios.request<T, R>(axiosRequestArgs) as Promise<R>;
|
|
149
149
|
};
|
|
150
150
|
}
|
package/dist/api.d.ts
CHANGED
|
@@ -1767,6 +1767,43 @@ export interface CompatibleFlavor {
|
|
|
1767
1767
|
*/
|
|
1768
1768
|
'reason'?: string;
|
|
1769
1769
|
}
|
|
1770
|
+
/**
|
|
1771
|
+
*
|
|
1772
|
+
* @export
|
|
1773
|
+
* @interface CompatibleImage
|
|
1774
|
+
*/
|
|
1775
|
+
export interface CompatibleImage {
|
|
1776
|
+
/**
|
|
1777
|
+
* JSON constraints object
|
|
1778
|
+
* @type {object}
|
|
1779
|
+
* @memberof CompatibleImage
|
|
1780
|
+
*/
|
|
1781
|
+
'constraints'?: object;
|
|
1782
|
+
/**
|
|
1783
|
+
*
|
|
1784
|
+
* @type {number}
|
|
1785
|
+
* @memberof CompatibleImage
|
|
1786
|
+
*/
|
|
1787
|
+
'image_id'?: number;
|
|
1788
|
+
/**
|
|
1789
|
+
*
|
|
1790
|
+
* @type {string}
|
|
1791
|
+
* @memberof CompatibleImage
|
|
1792
|
+
*/
|
|
1793
|
+
'image_name'?: string;
|
|
1794
|
+
/**
|
|
1795
|
+
* Either \'hard\' or \'soft\'
|
|
1796
|
+
* @type {string}
|
|
1797
|
+
* @memberof CompatibleImage
|
|
1798
|
+
*/
|
|
1799
|
+
'link_type'?: string;
|
|
1800
|
+
/**
|
|
1801
|
+
*
|
|
1802
|
+
* @type {string}
|
|
1803
|
+
* @memberof CompatibleImage
|
|
1804
|
+
*/
|
|
1805
|
+
'reason'?: string;
|
|
1806
|
+
}
|
|
1770
1807
|
/**
|
|
1771
1808
|
*
|
|
1772
1809
|
* @export
|
|
@@ -4062,6 +4099,12 @@ export interface FlavorFields {
|
|
|
4062
4099
|
* @memberof FlavorFields
|
|
4063
4100
|
*/
|
|
4064
4101
|
'id'?: number;
|
|
4102
|
+
/**
|
|
4103
|
+
* Image compatibility restrictions for this flavor (flavor → image links)
|
|
4104
|
+
* @type {ImageRestrictions}
|
|
4105
|
+
* @memberof FlavorFields
|
|
4106
|
+
*/
|
|
4107
|
+
'image_restrictions'?: ImageRestrictions;
|
|
4065
4108
|
/**
|
|
4066
4109
|
*
|
|
4067
4110
|
* @type {Array<LableResonse>}
|
|
@@ -4810,6 +4853,31 @@ export interface ImageGetResponse {
|
|
|
4810
4853
|
*/
|
|
4811
4854
|
'type'?: string;
|
|
4812
4855
|
}
|
|
4856
|
+
/**
|
|
4857
|
+
*
|
|
4858
|
+
* @export
|
|
4859
|
+
* @interface ImageRestrictions
|
|
4860
|
+
*/
|
|
4861
|
+
export interface ImageRestrictions {
|
|
4862
|
+
/**
|
|
4863
|
+
* List of images this flavor is allowed to launch, with link metadata
|
|
4864
|
+
* @type {Array<CompatibleImage>}
|
|
4865
|
+
* @memberof ImageRestrictions
|
|
4866
|
+
*/
|
|
4867
|
+
'compatible_images'?: Array<CompatibleImage>;
|
|
4868
|
+
/**
|
|
4869
|
+
* Whether the flavor is restricted to a set of images
|
|
4870
|
+
* @type {boolean}
|
|
4871
|
+
* @memberof ImageRestrictions
|
|
4872
|
+
*/
|
|
4873
|
+
'has_image_restrictions'?: boolean;
|
|
4874
|
+
/**
|
|
4875
|
+
* Either \'hard\', \'soft\', or null if no restrictions
|
|
4876
|
+
* @type {string}
|
|
4877
|
+
* @memberof ImageRestrictions
|
|
4878
|
+
*/
|
|
4879
|
+
'restriction_type'?: string;
|
|
4880
|
+
}
|
|
4813
4881
|
/**
|
|
4814
4882
|
*
|
|
4815
4883
|
* @export
|
package/dist/common.js
CHANGED
|
@@ -24,6 +24,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.createRequestFunction = exports.toPathString = exports.serializeDataIfNeeded = exports.setSearchParams = exports.setOAuthToObject = exports.setBearerAuthToObject = exports.setBasicAuthToObject = exports.setApiKeyToObject = exports.assertParamExists = exports.DUMMY_BASE_URL = void 0;
|
|
26
26
|
const base_1 = require("./base");
|
|
27
|
+
const hyperstackHeaders_1 = require("./hyperstackHeaders");
|
|
27
28
|
/**
|
|
28
29
|
*
|
|
29
30
|
* @export
|
|
@@ -155,6 +156,7 @@ const createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH, confi
|
|
|
155
156
|
return (axios = globalAxios, basePath = BASE_PATH) => {
|
|
156
157
|
var _a;
|
|
157
158
|
const axiosRequestArgs = Object.assign(Object.assign({}, axiosArgs.options), { url: (axios.defaults.baseURL ? '' : (_a = configuration === null || configuration === void 0 ? void 0 : configuration.basePath) !== null && _a !== void 0 ? _a : basePath) + axiosArgs.url });
|
|
159
|
+
(0, hyperstackHeaders_1.applyHyperstackHeaders)(axiosRequestArgs);
|
|
158
160
|
return axios.request(axiosRequestArgs);
|
|
159
161
|
};
|
|
160
162
|
};
|
package/dist/esm/api.d.ts
CHANGED
|
@@ -1767,6 +1767,43 @@ export interface CompatibleFlavor {
|
|
|
1767
1767
|
*/
|
|
1768
1768
|
'reason'?: string;
|
|
1769
1769
|
}
|
|
1770
|
+
/**
|
|
1771
|
+
*
|
|
1772
|
+
* @export
|
|
1773
|
+
* @interface CompatibleImage
|
|
1774
|
+
*/
|
|
1775
|
+
export interface CompatibleImage {
|
|
1776
|
+
/**
|
|
1777
|
+
* JSON constraints object
|
|
1778
|
+
* @type {object}
|
|
1779
|
+
* @memberof CompatibleImage
|
|
1780
|
+
*/
|
|
1781
|
+
'constraints'?: object;
|
|
1782
|
+
/**
|
|
1783
|
+
*
|
|
1784
|
+
* @type {number}
|
|
1785
|
+
* @memberof CompatibleImage
|
|
1786
|
+
*/
|
|
1787
|
+
'image_id'?: number;
|
|
1788
|
+
/**
|
|
1789
|
+
*
|
|
1790
|
+
* @type {string}
|
|
1791
|
+
* @memberof CompatibleImage
|
|
1792
|
+
*/
|
|
1793
|
+
'image_name'?: string;
|
|
1794
|
+
/**
|
|
1795
|
+
* Either \'hard\' or \'soft\'
|
|
1796
|
+
* @type {string}
|
|
1797
|
+
* @memberof CompatibleImage
|
|
1798
|
+
*/
|
|
1799
|
+
'link_type'?: string;
|
|
1800
|
+
/**
|
|
1801
|
+
*
|
|
1802
|
+
* @type {string}
|
|
1803
|
+
* @memberof CompatibleImage
|
|
1804
|
+
*/
|
|
1805
|
+
'reason'?: string;
|
|
1806
|
+
}
|
|
1770
1807
|
/**
|
|
1771
1808
|
*
|
|
1772
1809
|
* @export
|
|
@@ -4062,6 +4099,12 @@ export interface FlavorFields {
|
|
|
4062
4099
|
* @memberof FlavorFields
|
|
4063
4100
|
*/
|
|
4064
4101
|
'id'?: number;
|
|
4102
|
+
/**
|
|
4103
|
+
* Image compatibility restrictions for this flavor (flavor → image links)
|
|
4104
|
+
* @type {ImageRestrictions}
|
|
4105
|
+
* @memberof FlavorFields
|
|
4106
|
+
*/
|
|
4107
|
+
'image_restrictions'?: ImageRestrictions;
|
|
4065
4108
|
/**
|
|
4066
4109
|
*
|
|
4067
4110
|
* @type {Array<LableResonse>}
|
|
@@ -4810,6 +4853,31 @@ export interface ImageGetResponse {
|
|
|
4810
4853
|
*/
|
|
4811
4854
|
'type'?: string;
|
|
4812
4855
|
}
|
|
4856
|
+
/**
|
|
4857
|
+
*
|
|
4858
|
+
* @export
|
|
4859
|
+
* @interface ImageRestrictions
|
|
4860
|
+
*/
|
|
4861
|
+
export interface ImageRestrictions {
|
|
4862
|
+
/**
|
|
4863
|
+
* List of images this flavor is allowed to launch, with link metadata
|
|
4864
|
+
* @type {Array<CompatibleImage>}
|
|
4865
|
+
* @memberof ImageRestrictions
|
|
4866
|
+
*/
|
|
4867
|
+
'compatible_images'?: Array<CompatibleImage>;
|
|
4868
|
+
/**
|
|
4869
|
+
* Whether the flavor is restricted to a set of images
|
|
4870
|
+
* @type {boolean}
|
|
4871
|
+
* @memberof ImageRestrictions
|
|
4872
|
+
*/
|
|
4873
|
+
'has_image_restrictions'?: boolean;
|
|
4874
|
+
/**
|
|
4875
|
+
* Either \'hard\', \'soft\', or null if no restrictions
|
|
4876
|
+
* @type {string}
|
|
4877
|
+
* @memberof ImageRestrictions
|
|
4878
|
+
*/
|
|
4879
|
+
'restriction_type'?: string;
|
|
4880
|
+
}
|
|
4813
4881
|
/**
|
|
4814
4882
|
*
|
|
4815
4883
|
* @export
|
package/dist/esm/common.js
CHANGED
|
@@ -21,6 +21,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
21
21
|
});
|
|
22
22
|
};
|
|
23
23
|
import { RequiredError } from "./base";
|
|
24
|
+
import { applyHyperstackHeaders } from "./hyperstackHeaders";
|
|
24
25
|
/**
|
|
25
26
|
*
|
|
26
27
|
* @export
|
|
@@ -144,6 +145,7 @@ export const createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH
|
|
|
144
145
|
return (axios = globalAxios, basePath = BASE_PATH) => {
|
|
145
146
|
var _a;
|
|
146
147
|
const axiosRequestArgs = Object.assign(Object.assign({}, axiosArgs.options), { url: (axios.defaults.baseURL ? '' : (_a = configuration === null || configuration === void 0 ? void 0 : configuration.basePath) !== null && _a !== void 0 ? _a : basePath) + axiosArgs.url });
|
|
148
|
+
applyHyperstackHeaders(axiosRequestArgs);
|
|
147
149
|
return axios.request(axiosRequestArgs);
|
|
148
150
|
};
|
|
149
151
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Forced Hyperstack client identification headers.
|
|
3
|
+
*
|
|
4
|
+
* Maintained in sdk-generator (util/typescript/hyperstackHeaders.ts) and copied into
|
|
5
|
+
* the generated SDK by the `add-hyperstack-headers` task. Do not edit in the SDK repo.
|
|
6
|
+
*/
|
|
7
|
+
export declare const HYPERSTACK_CLIENT_HEADER: string;
|
|
8
|
+
export declare const USER_AGENT_HEADER: string;
|
|
9
|
+
export declare const HYPERSTACK_CLIENT: string;
|
|
10
|
+
/**
|
|
11
|
+
* User-Agent is a forbidden header name in browsers: XHR and fetch silently drop any
|
|
12
|
+
* attempt to set it. It is therefore only emitted under Node, and browser traffic is
|
|
13
|
+
* identified by Hyperstack-Client alone.
|
|
14
|
+
*/
|
|
15
|
+
export declare const HYPERSTACK_USER_AGENT: string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Forces the identification headers onto axios request args.
|
|
18
|
+
*
|
|
19
|
+
* Any caller-supplied variant is stripped case-insensitively first. Mutates and
|
|
20
|
+
* returns the same object so it can wrap the generated axiosRequestArgs expression.
|
|
21
|
+
*/
|
|
22
|
+
export declare const applyHyperstackHeaders: <T extends {
|
|
23
|
+
headers?: any;
|
|
24
|
+
}>(args: T) => T;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Forced Hyperstack client identification headers.
|
|
5
|
+
*
|
|
6
|
+
* Maintained in sdk-generator (util/typescript/hyperstackHeaders.ts) and copied into
|
|
7
|
+
* the generated SDK by the `add-hyperstack-headers` task. Do not edit in the SDK repo.
|
|
8
|
+
*/
|
|
9
|
+
const SDK_NAME = 'hyperstack-typescript-sdk';
|
|
10
|
+
const SDK_VERSION = 'v1.55.4-alpha';
|
|
11
|
+
export const HYPERSTACK_CLIENT_HEADER = 'Hyperstack-Client';
|
|
12
|
+
export const USER_AGENT_HEADER = 'User-Agent';
|
|
13
|
+
const FORCED = [HYPERSTACK_CLIENT_HEADER.toLowerCase(), USER_AGENT_HEADER.toLowerCase()];
|
|
14
|
+
/** Printable ASCII only, capped at 256 chars. */
|
|
15
|
+
const sanitize = (value) => String(value).replace(/[^\x20-\x7e]/g, '').slice(0, 256);
|
|
16
|
+
const normalizeOs = (value) => {
|
|
17
|
+
const v = String(value || '').toLowerCase();
|
|
18
|
+
if (v.indexOf('darwin') === 0 || v.indexOf('mac') === 0)
|
|
19
|
+
return 'darwin';
|
|
20
|
+
if (v.indexOf('win') === 0)
|
|
21
|
+
return 'windows';
|
|
22
|
+
if (v.indexOf('linux') === 0)
|
|
23
|
+
return 'linux';
|
|
24
|
+
return v.replace(/ /g, '-') || 'unknown';
|
|
25
|
+
};
|
|
26
|
+
const normalizeArch = (value) => {
|
|
27
|
+
const v = String(value || '').toLowerCase();
|
|
28
|
+
if (v === 'x64' || v === 'x86_64' || v === 'amd64')
|
|
29
|
+
return 'x86_64';
|
|
30
|
+
if (v === 'arm64' || v === 'aarch64')
|
|
31
|
+
return 'arm64';
|
|
32
|
+
if (v === 'ia32' || v === 'x86' || v === 'i386')
|
|
33
|
+
return '386';
|
|
34
|
+
return v || 'unknown';
|
|
35
|
+
};
|
|
36
|
+
const proc = typeof process !== 'undefined' ? process : undefined;
|
|
37
|
+
const isNode = !!(proc && proc.versions && proc.versions.node);
|
|
38
|
+
export const HYPERSTACK_CLIENT = sanitize(SDK_NAME + '/' + SDK_VERSION);
|
|
39
|
+
/**
|
|
40
|
+
* User-Agent is a forbidden header name in browsers: XHR and fetch silently drop any
|
|
41
|
+
* attempt to set it. It is therefore only emitted under Node, and browser traffic is
|
|
42
|
+
* identified by Hyperstack-Client alone.
|
|
43
|
+
*/
|
|
44
|
+
export const HYPERSTACK_USER_AGENT = isNode
|
|
45
|
+
? sanitize(HYPERSTACK_CLIENT + ' (Node.js/' + proc.versions.node + '; '
|
|
46
|
+
+ normalizeOs(proc.platform) + '/' + normalizeArch(proc.arch) + ')')
|
|
47
|
+
: undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Forces the identification headers onto axios request args.
|
|
50
|
+
*
|
|
51
|
+
* Any caller-supplied variant is stripped case-insensitively first. Mutates and
|
|
52
|
+
* returns the same object so it can wrap the generated axiosRequestArgs expression.
|
|
53
|
+
*/
|
|
54
|
+
export const applyHyperstackHeaders = function (args) {
|
|
55
|
+
const headers = {};
|
|
56
|
+
const existing = (args && args.headers) || {};
|
|
57
|
+
Object.keys(existing).forEach((key) => {
|
|
58
|
+
if (FORCED.indexOf(key.toLowerCase()) === -1) {
|
|
59
|
+
headers[key] = existing[key];
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
headers[HYPERSTACK_CLIENT_HEADER] = HYPERSTACK_CLIENT;
|
|
63
|
+
if (HYPERSTACK_USER_AGENT) {
|
|
64
|
+
headers[USER_AGENT_HEADER] = HYPERSTACK_USER_AGENT;
|
|
65
|
+
}
|
|
66
|
+
args.headers = headers;
|
|
67
|
+
return args;
|
|
68
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Forced Hyperstack client identification headers.
|
|
3
|
+
*
|
|
4
|
+
* Maintained in sdk-generator (util/typescript/hyperstackHeaders.ts) and copied into
|
|
5
|
+
* the generated SDK by the `add-hyperstack-headers` task. Do not edit in the SDK repo.
|
|
6
|
+
*/
|
|
7
|
+
export declare const HYPERSTACK_CLIENT_HEADER: string;
|
|
8
|
+
export declare const USER_AGENT_HEADER: string;
|
|
9
|
+
export declare const HYPERSTACK_CLIENT: string;
|
|
10
|
+
/**
|
|
11
|
+
* User-Agent is a forbidden header name in browsers: XHR and fetch silently drop any
|
|
12
|
+
* attempt to set it. It is therefore only emitted under Node, and browser traffic is
|
|
13
|
+
* identified by Hyperstack-Client alone.
|
|
14
|
+
*/
|
|
15
|
+
export declare const HYPERSTACK_USER_AGENT: string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Forces the identification headers onto axios request args.
|
|
18
|
+
*
|
|
19
|
+
* Any caller-supplied variant is stripped case-insensitively first. Mutates and
|
|
20
|
+
* returns the same object so it can wrap the generated axiosRequestArgs expression.
|
|
21
|
+
*/
|
|
22
|
+
export declare const applyHyperstackHeaders: <T extends {
|
|
23
|
+
headers?: any;
|
|
24
|
+
}>(args: T) => T;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* Forced Hyperstack client identification headers.
|
|
6
|
+
*
|
|
7
|
+
* Maintained in sdk-generator (util/typescript/hyperstackHeaders.ts) and copied into
|
|
8
|
+
* the generated SDK by the `add-hyperstack-headers` task. Do not edit in the SDK repo.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.applyHyperstackHeaders = exports.HYPERSTACK_USER_AGENT = exports.HYPERSTACK_CLIENT = exports.USER_AGENT_HEADER = exports.HYPERSTACK_CLIENT_HEADER = void 0;
|
|
12
|
+
const SDK_NAME = 'hyperstack-typescript-sdk';
|
|
13
|
+
const SDK_VERSION = 'v1.55.4-alpha';
|
|
14
|
+
exports.HYPERSTACK_CLIENT_HEADER = 'Hyperstack-Client';
|
|
15
|
+
exports.USER_AGENT_HEADER = 'User-Agent';
|
|
16
|
+
const FORCED = [exports.HYPERSTACK_CLIENT_HEADER.toLowerCase(), exports.USER_AGENT_HEADER.toLowerCase()];
|
|
17
|
+
/** Printable ASCII only, capped at 256 chars. */
|
|
18
|
+
const sanitize = (value) => String(value).replace(/[^\x20-\x7e]/g, '').slice(0, 256);
|
|
19
|
+
const normalizeOs = (value) => {
|
|
20
|
+
const v = String(value || '').toLowerCase();
|
|
21
|
+
if (v.indexOf('darwin') === 0 || v.indexOf('mac') === 0)
|
|
22
|
+
return 'darwin';
|
|
23
|
+
if (v.indexOf('win') === 0)
|
|
24
|
+
return 'windows';
|
|
25
|
+
if (v.indexOf('linux') === 0)
|
|
26
|
+
return 'linux';
|
|
27
|
+
return v.replace(/ /g, '-') || 'unknown';
|
|
28
|
+
};
|
|
29
|
+
const normalizeArch = (value) => {
|
|
30
|
+
const v = String(value || '').toLowerCase();
|
|
31
|
+
if (v === 'x64' || v === 'x86_64' || v === 'amd64')
|
|
32
|
+
return 'x86_64';
|
|
33
|
+
if (v === 'arm64' || v === 'aarch64')
|
|
34
|
+
return 'arm64';
|
|
35
|
+
if (v === 'ia32' || v === 'x86' || v === 'i386')
|
|
36
|
+
return '386';
|
|
37
|
+
return v || 'unknown';
|
|
38
|
+
};
|
|
39
|
+
const proc = typeof process !== 'undefined' ? process : undefined;
|
|
40
|
+
const isNode = !!(proc && proc.versions && proc.versions.node);
|
|
41
|
+
exports.HYPERSTACK_CLIENT = sanitize(SDK_NAME + '/' + SDK_VERSION);
|
|
42
|
+
/**
|
|
43
|
+
* User-Agent is a forbidden header name in browsers: XHR and fetch silently drop any
|
|
44
|
+
* attempt to set it. It is therefore only emitted under Node, and browser traffic is
|
|
45
|
+
* identified by Hyperstack-Client alone.
|
|
46
|
+
*/
|
|
47
|
+
exports.HYPERSTACK_USER_AGENT = isNode
|
|
48
|
+
? sanitize(exports.HYPERSTACK_CLIENT + ' (Node.js/' + proc.versions.node + '; '
|
|
49
|
+
+ normalizeOs(proc.platform) + '/' + normalizeArch(proc.arch) + ')')
|
|
50
|
+
: undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Forces the identification headers onto axios request args.
|
|
53
|
+
*
|
|
54
|
+
* Any caller-supplied variant is stripped case-insensitively first. Mutates and
|
|
55
|
+
* returns the same object so it can wrap the generated axiosRequestArgs expression.
|
|
56
|
+
*/
|
|
57
|
+
const applyHyperstackHeaders = function (args) {
|
|
58
|
+
const headers = {};
|
|
59
|
+
const existing = (args && args.headers) || {};
|
|
60
|
+
Object.keys(existing).forEach((key) => {
|
|
61
|
+
if (FORCED.indexOf(key.toLowerCase()) === -1) {
|
|
62
|
+
headers[key] = existing[key];
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
headers[exports.HYPERSTACK_CLIENT_HEADER] = exports.HYPERSTACK_CLIENT;
|
|
66
|
+
if (exports.HYPERSTACK_USER_AGENT) {
|
|
67
|
+
headers[exports.USER_AGENT_HEADER] = exports.HYPERSTACK_USER_AGENT;
|
|
68
|
+
}
|
|
69
|
+
args.headers = headers;
|
|
70
|
+
return args;
|
|
71
|
+
};
|
|
72
|
+
exports.applyHyperstackHeaders = applyHyperstackHeaders;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Forced Hyperstack client identification headers.
|
|
5
|
+
*
|
|
6
|
+
* Maintained in sdk-generator (util/typescript/hyperstackHeaders.ts) and copied into
|
|
7
|
+
* the generated SDK by the `add-hyperstack-headers` task. Do not edit in the SDK repo.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// Module-scoped declaration: this file has exports, so it shadows the global without
|
|
11
|
+
// a TS2451 redeclaration error whether or not @types/node resolves. The file is
|
|
12
|
+
// type-checked under both the SDK's tsconfig and the repo-root one used by ts-node.
|
|
13
|
+
declare const process: any;
|
|
14
|
+
|
|
15
|
+
const SDK_NAME: string = 'hyperstack-typescript-sdk';
|
|
16
|
+
const SDK_VERSION: string = 'v1.55.4-alpha';
|
|
17
|
+
|
|
18
|
+
export const HYPERSTACK_CLIENT_HEADER: string = 'Hyperstack-Client';
|
|
19
|
+
export const USER_AGENT_HEADER: string = 'User-Agent';
|
|
20
|
+
|
|
21
|
+
const FORCED: string[] = [HYPERSTACK_CLIENT_HEADER.toLowerCase(), USER_AGENT_HEADER.toLowerCase()];
|
|
22
|
+
|
|
23
|
+
/** Printable ASCII only, capped at 256 chars. */
|
|
24
|
+
const sanitize = (value: string): string =>
|
|
25
|
+
String(value).replace(/[^\x20-\x7e]/g, '').slice(0, 256);
|
|
26
|
+
|
|
27
|
+
const normalizeOs = (value: string): string => {
|
|
28
|
+
const v: string = String(value || '').toLowerCase();
|
|
29
|
+
if (v.indexOf('darwin') === 0 || v.indexOf('mac') === 0) return 'darwin';
|
|
30
|
+
if (v.indexOf('win') === 0) return 'windows';
|
|
31
|
+
if (v.indexOf('linux') === 0) return 'linux';
|
|
32
|
+
return v.replace(/ /g, '-') || 'unknown';
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const normalizeArch = (value: string): string => {
|
|
36
|
+
const v: string = String(value || '').toLowerCase();
|
|
37
|
+
if (v === 'x64' || v === 'x86_64' || v === 'amd64') return 'x86_64';
|
|
38
|
+
if (v === 'arm64' || v === 'aarch64') return 'arm64';
|
|
39
|
+
if (v === 'ia32' || v === 'x86' || v === 'i386') return '386';
|
|
40
|
+
return v || 'unknown';
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const proc: any = typeof process !== 'undefined' ? process : undefined;
|
|
44
|
+
const isNode: boolean = !!(proc && proc.versions && proc.versions.node);
|
|
45
|
+
|
|
46
|
+
export const HYPERSTACK_CLIENT: string = sanitize(SDK_NAME + '/' + SDK_VERSION);
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* User-Agent is a forbidden header name in browsers: XHR and fetch silently drop any
|
|
50
|
+
* attempt to set it. It is therefore only emitted under Node, and browser traffic is
|
|
51
|
+
* identified by Hyperstack-Client alone.
|
|
52
|
+
*/
|
|
53
|
+
export const HYPERSTACK_USER_AGENT: string | undefined = isNode
|
|
54
|
+
? sanitize(HYPERSTACK_CLIENT + ' (Node.js/' + proc.versions.node + '; '
|
|
55
|
+
+ normalizeOs(proc.platform) + '/' + normalizeArch(proc.arch) + ')')
|
|
56
|
+
: undefined;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Forces the identification headers onto axios request args.
|
|
60
|
+
*
|
|
61
|
+
* Any caller-supplied variant is stripped case-insensitively first. Mutates and
|
|
62
|
+
* returns the same object so it can wrap the generated axiosRequestArgs expression.
|
|
63
|
+
*/
|
|
64
|
+
export const applyHyperstackHeaders = function <T extends { headers?: any }>(args: T): T {
|
|
65
|
+
const headers: any = {};
|
|
66
|
+
const existing: any = (args && args.headers) || {};
|
|
67
|
+
Object.keys(existing).forEach((key: string) => {
|
|
68
|
+
if (FORCED.indexOf(key.toLowerCase()) === -1) {
|
|
69
|
+
headers[key] = existing[key];
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
headers[HYPERSTACK_CLIENT_HEADER] = HYPERSTACK_CLIENT;
|
|
73
|
+
if (HYPERSTACK_USER_AGENT) {
|
|
74
|
+
headers[USER_AGENT_HEADER] = HYPERSTACK_USER_AGENT;
|
|
75
|
+
}
|
|
76
|
+
(args as any).headers = headers;
|
|
77
|
+
return args;
|
|
78
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexgencloud/hyperstack-sdk-typescript",
|
|
3
|
-
"version": "v1.55.
|
|
3
|
+
"version": "v1.55.4-alpha",
|
|
4
4
|
"description": "Leverage the Infrahub API and Hyperstack platform to easily create, manage, and scale powerful GPU virtual machines and their associated resources. Access this SDK to automate the deployment of your workloads and streamline your infrastructure management. To contribute, please raise an issue with a bug report, feature request, feedback, or general inquiry.",
|
|
5
5
|
"author": "OpenAPI-Generator Contributors",
|
|
6
6
|
"repository": {
|