@configura/web-api-auth 3.0.0-alpha.0 → 3.0.0-alpha.2
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/dist/CatalogueAuthAPI.d.ts +22 -1
- package/dist/CatalogueAuthAPI.js +44 -57
- package/package.json +2 -2
|
@@ -61,12 +61,21 @@ export interface DtoErrorResponse {
|
|
|
61
61
|
eventId?: string;
|
|
62
62
|
}
|
|
63
63
|
/** ExportFormat - Format of the exported product, identical to the format's file extension. */
|
|
64
|
-
export declare type DtoExportFormat = "glb" | "gltf" | "fbx" | "dwg" | "cmdrw" | "cmfav" | "cmsym";
|
|
64
|
+
export declare type DtoExportFormat = "glb" | "gltf" | "fbx" | "dwg" | "cmdrw" | "cmfav" | "cmsym" | "obj";
|
|
65
65
|
export declare const dtoExportFormatNames: DtoExportFormat[];
|
|
66
66
|
/** Orientation */
|
|
67
67
|
export interface DtoOrientation {
|
|
68
|
+
/**
|
|
69
|
+
* radians
|
|
70
|
+
*/
|
|
68
71
|
yaw: number;
|
|
72
|
+
/**
|
|
73
|
+
* radians
|
|
74
|
+
*/
|
|
69
75
|
pitch: number;
|
|
76
|
+
/**
|
|
77
|
+
* radians
|
|
78
|
+
*/
|
|
70
79
|
roll: number;
|
|
71
80
|
}
|
|
72
81
|
/** Point */
|
|
@@ -104,9 +113,21 @@ export interface DtoTargetCameraArgs {
|
|
|
104
113
|
target?: DtoPoint;
|
|
105
114
|
direction?: DtoVector;
|
|
106
115
|
normal?: DtoVector;
|
|
116
|
+
/**
|
|
117
|
+
* radians
|
|
118
|
+
*/
|
|
107
119
|
yaw?: number;
|
|
120
|
+
/**
|
|
121
|
+
* radians
|
|
122
|
+
*/
|
|
108
123
|
pitch?: number;
|
|
124
|
+
/**
|
|
125
|
+
* radians
|
|
126
|
+
*/
|
|
109
127
|
roll?: number;
|
|
128
|
+
/**
|
|
129
|
+
* radians
|
|
130
|
+
*/
|
|
110
131
|
fov?: number;
|
|
111
132
|
nearClip?: number;
|
|
112
133
|
minHeight?: number;
|
package/dist/CatalogueAuthAPI.js
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// WARNING: This file was auto generated by the code in web-rnd/tygen.
|
|
3
3
|
// Do not commit manual changes to this file.
|
|
4
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
7
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
8
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
9
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
10
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
4
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
5
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
6
|
};
|
|
@@ -20,66 +11,62 @@ exports.DTO_OPERATION_ID_TO_DEBIT_GROUP = exports.CatalogueAuthAPI = exports.Dto
|
|
|
20
11
|
const package_json_1 = __importDefault(require("../package.json"));
|
|
21
12
|
const http_1 = __importDefault(require("http"));
|
|
22
13
|
const https_1 = __importDefault(require("https"));
|
|
23
|
-
exports.dtoExportFormatNames = ["glb", "gltf", "fbx", "dwg", "cmdrw", "cmfav", "cmsym"];
|
|
14
|
+
exports.dtoExportFormatNames = ["glb", "gltf", "fbx", "dwg", "cmdrw", "cmfav", "cmsym", "obj"];
|
|
24
15
|
exports.dtoRenderFormatNames = ["jpg", "png"];
|
|
25
16
|
class DtoAPIError extends Error {
|
|
26
17
|
}
|
|
27
18
|
exports.DtoAPIError = DtoAPIError;
|
|
28
19
|
class CatalogueAuthAPI {
|
|
29
|
-
fetch(url, options) {
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
reject(Error(obj.error));
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
resolve(obj);
|
|
52
|
-
}
|
|
20
|
+
async fetch(url, options) {
|
|
21
|
+
return new Promise((resolve, reject) => {
|
|
22
|
+
const body = options.body;
|
|
23
|
+
if (options.method === "POST" && body) {
|
|
24
|
+
options.headers["Content-Type"] = "application/json;charset=utf-8";
|
|
25
|
+
options.headers["Content-Length"] = body.length.toString();
|
|
26
|
+
}
|
|
27
|
+
const reqFn = url.startsWith("https") ? https_1.default.request : http_1.default.request;
|
|
28
|
+
const req = reqFn(url, options, res => {
|
|
29
|
+
let data = "";
|
|
30
|
+
res.setEncoding("utf8");
|
|
31
|
+
res.on("data", chunk => {
|
|
32
|
+
data += `${chunk}`;
|
|
33
|
+
});
|
|
34
|
+
res.on("end", () => {
|
|
35
|
+
try {
|
|
36
|
+
const obj = JSON.parse(data);
|
|
37
|
+
if ("error" in obj) {
|
|
38
|
+
reject(Error(obj.error));
|
|
53
39
|
}
|
|
54
|
-
|
|
55
|
-
|
|
40
|
+
else {
|
|
41
|
+
resolve(obj);
|
|
56
42
|
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
43
|
+
}
|
|
44
|
+
catch (e) {
|
|
45
|
+
reject(e);
|
|
46
|
+
}
|
|
61
47
|
});
|
|
62
|
-
if (options.method === "POST" && body) {
|
|
63
|
-
req.write(options.body);
|
|
64
|
-
}
|
|
65
|
-
req.end();
|
|
66
48
|
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
throw new Error("missing auth");
|
|
49
|
+
req.on("error", e => {
|
|
50
|
+
reject(e);
|
|
51
|
+
});
|
|
52
|
+
if (options.method === "POST" && body) {
|
|
53
|
+
req.write(options.body);
|
|
73
54
|
}
|
|
74
|
-
|
|
75
|
-
const options = {
|
|
76
|
-
method: "POST",
|
|
77
|
-
headers: { "X-API-Key": this.auth.secretToken || "", "X-SDK-Version": package_json_1.default.version },
|
|
78
|
-
body: JSON.stringify(body),
|
|
79
|
-
};
|
|
80
|
-
return this.fetch(this.auth.endpoint + url, options);
|
|
55
|
+
req.end();
|
|
81
56
|
});
|
|
82
57
|
}
|
|
58
|
+
async postAuthorize(body) {
|
|
59
|
+
if (this.auth === undefined) {
|
|
60
|
+
throw new Error("missing auth");
|
|
61
|
+
}
|
|
62
|
+
const url = `/v2/authorize`;
|
|
63
|
+
const options = {
|
|
64
|
+
method: "POST",
|
|
65
|
+
headers: { "X-API-Key": this.auth.secretToken || "", "X-SDK-Version": package_json_1.default.version },
|
|
66
|
+
body: JSON.stringify(body),
|
|
67
|
+
};
|
|
68
|
+
return this.fetch(this.auth.endpoint + url, options);
|
|
69
|
+
}
|
|
83
70
|
}
|
|
84
71
|
exports.CatalogueAuthAPI = CatalogueAuthAPI;
|
|
85
72
|
exports.DTO_OPERATION_ID_TO_DEBIT_GROUP = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@configura/web-api-auth",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
"publishConfig": {
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "5b72d2813b949b3ccef8f1864382b9153593962b"
|
|
25
25
|
}
|