@nexgencloud/hyperstack-sdk-typescript 1.54.7-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 +231 -0
- package/common.ts +2 -2
- package/dist/api.d.ts +187 -0
- package/dist/api.js +76 -0
- package/dist/common.js +2 -0
- package/dist/esm/api.d.ts +187 -0
- package/dist/esm/api.js +76 -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
|
@@ -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.
|
|
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": {
|