groupdocs-parser-cloud 23.10.0 → 25.9.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.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2003-2019 Aspose Pty Ltd
3
+ Copyright (c) Aspose Pty Ltd
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,17 +1,17 @@
1
- import request = require("request");
2
- import { Configuration } from "./configuration";
3
- /**
4
- * Invoke api method
5
- * @param requestOptions Request parameters
6
- * @param config Configuration
7
- * @param skipAuth If enabled, auth is not applied to request
8
- */
9
- export declare function invokeApiMethod(requestOptions: request.Options, config: Configuration, skipAuth?: boolean): Promise<request.RequestResponse>;
10
- /**
11
- * Add parameter to query
12
- * @param url url
13
- * @param queryParameters queryParameters
14
- * @param parameterName parameterName
15
- * @param parameterValue parameterValue
16
- */
17
- export declare function addQueryParameterToUrl(url: any, queryParameters: any, parameterName: any, parameterValue: any): any;
1
+ import { AxiosResponse, RawAxiosRequestConfig } from "axios";
2
+ import { Configuration } from "./configuration";
3
+ /**
4
+ * Invoke api method
5
+ * @param requestOptions Request parameters
6
+ * @param config Configuration
7
+ * @param skipAuth If enabled, auth is not applied to request
8
+ */
9
+ export declare function invokeApiMethod(requestOptions: RawAxiosRequestConfig, config: Configuration, skipAuth?: boolean): Promise<AxiosResponse>;
10
+ /**
11
+ * Add parameter to query
12
+ * @param url url
13
+ * @param queryParameters queryParameters
14
+ * @param parameterName parameterName
15
+ * @param parameterValue parameterValue
16
+ */
17
+ export declare function addQueryParameterToUrl(url: any, queryParameters: any, parameterName: any, parameterValue: any): any;
package/lib/api_client.js CHANGED
@@ -1,125 +1,135 @@
1
- "use strict";
2
- /*
3
- * The MIT License (MIT)
4
- *
5
- * Copyright (c) 2003-2019 Aspose Pty Ltd
6
- *
7
- * Permission is hereby granted, free of charge, to any person obtaining a copy
8
- * of this software and associated documentation files (the "Software"), to deal
9
- * in the Software without restriction, including without limitation the rights
10
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- * copies of the Software, and to permit persons to whom the Software is
12
- * furnished to do so, subject to the following conditions:
13
- *
14
- * The above copyright notice and this permission notice shall be included in all
15
- * copies or substantial portions of the Software.
16
- *
17
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- * SOFTWARE.
24
- */
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- return new (P || (P = Promise))(function (resolve, reject) {
27
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
28
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
29
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
30
- step((generator = generator.apply(thisArg, _arguments || [])).next());
31
- });
32
- };
33
- Object.defineProperty(exports, "__esModule", { value: true });
34
- const request = require("request");
35
- const requestDebug = require("request-debug");
36
- const package_version_1 = require("./package_version");
37
- /**
38
- * Invoke api method
39
- * @param requestOptions Request parameters
40
- * @param config Configuration
41
- * @param skipAuth If enabled, auth is not applied to request
42
- */
43
- function invokeApiMethod(requestOptions, config, skipAuth) {
44
- return __awaiter(this, void 0, void 0, function* () {
45
- return yield invokeApiMethodInternal(requestOptions, config, skipAuth);
46
- });
47
- }
48
- exports.invokeApiMethod = invokeApiMethod;
49
- /**
50
- * Add parameter to query
51
- * @param url url
52
- * @param queryParameters queryParameters
53
- * @param parameterName parameterName
54
- * @param parameterValue parameterValue
55
- */
56
- function addQueryParameterToUrl(url, queryParameters, parameterName, parameterValue) {
57
- if (parameterValue !== undefined) {
58
- if (url.indexOf("{" + parameterName + "}") >= 0) {
59
- url = url.replace("{" + parameterName + "}", String(parameterValue));
60
- }
61
- else {
62
- queryParameters[parameterName] = String(parameterValue);
63
- }
64
- }
65
- else {
66
- url = url.replace("/{" + parameterName + "}", "");
67
- }
68
- return url;
69
- }
70
- exports.addQueryParameterToUrl = addQueryParameterToUrl;
71
- /**
72
- * Invoke api method
73
- * @param requestOptions request parameters
74
- * @param config Configuration
75
- * @param skipAuth If enabled, auth is not applied to request
76
- */
77
- function invokeApiMethodInternal(requestOptions, config, skipAuth) {
78
- return __awaiter(this, void 0, void 0, function* () {
79
- if (config.debugging === true) {
80
- requestDebug(request, (type, data) => {
81
- const toLog = {};
82
- toLog[type] = data;
83
- console.log(JSON.stringify(toLog, undefined, 2));
84
- });
85
- }
86
- if (!requestOptions.headers) {
87
- requestOptions.headers = {};
88
- }
89
- requestOptions.headers["x-groupdocs-client"] = "node.js sdk";
90
- requestOptions.headers["x-groupdocs-client-version"] = package_version_1.PackageVersion;
91
- const auth = config.authentication;
92
- if (!skipAuth) {
93
- yield auth.applyToRequest(requestOptions, config);
94
- }
95
- return new Promise((resolve, reject) => {
96
- request(requestOptions, (error, response) => __awaiter(this, void 0, void 0, function* () {
97
- if (error) {
98
- reject(error);
99
- }
100
- else {
101
- if (response.statusCode >= 200 && response.statusCode <= 299) {
102
- resolve(response);
103
- }
104
- else {
105
- try {
106
- let bodyContent = response.body;
107
- if (bodyContent instanceof Buffer) {
108
- bodyContent = JSON.parse(bodyContent.toString("utf8"));
109
- }
110
- if (bodyContent.error) {
111
- reject({ message: bodyContent.error, code: response.statusCode });
112
- }
113
- else if (bodyContent.Error) {
114
- reject({ message: bodyContent.Error.Message, code: response.statusCode });
115
- }
116
- }
117
- catch (error) {
118
- reject({ message: "Error while parse server error: " + error });
119
- }
120
- }
121
- }
122
- }));
123
- });
124
- });
125
- }
1
+ "use strict";
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) Aspose Pty Ltd
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ exports.invokeApiMethod = invokeApiMethod;
36
+ exports.addQueryParameterToUrl = addQueryParameterToUrl;
37
+ const axios_1 = require("axios");
38
+ const package_version_1 = require("./package_version");
39
+ /**
40
+ * Invoke api method
41
+ * @param requestOptions Request parameters
42
+ * @param config Configuration
43
+ * @param skipAuth If enabled, auth is not applied to request
44
+ */
45
+ function invokeApiMethod(requestOptions, config, skipAuth) {
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ return yield invokeApiMethodInternal(requestOptions, config, skipAuth);
48
+ });
49
+ }
50
+ /**
51
+ * Add parameter to query
52
+ * @param url url
53
+ * @param queryParameters queryParameters
54
+ * @param parameterName parameterName
55
+ * @param parameterValue parameterValue
56
+ */
57
+ function addQueryParameterToUrl(url, queryParameters, parameterName, parameterValue) {
58
+ if (parameterValue !== undefined) {
59
+ if (url.indexOf("{" + parameterName + "}") >= 0) {
60
+ url = url.replace("{" + parameterName + "}", String(parameterValue));
61
+ }
62
+ else {
63
+ queryParameters[parameterName] = String(parameterValue);
64
+ }
65
+ }
66
+ else {
67
+ url = url.replace("/{" + parameterName + "}", "");
68
+ }
69
+ return url;
70
+ }
71
+ /**
72
+ * Invoke api method
73
+ * @param requestOptions request parameters
74
+ * @param config Configuration
75
+ * @param skipAuth If enabled, auth is not applied to request
76
+ */
77
+ function invokeApiMethodInternal(requestOptions, config, skipAuth) {
78
+ return __awaiter(this, void 0, void 0, function* () {
79
+ // if (config.debugging === true) {
80
+ // requestDebug(request, (type, data) => {
81
+ // const toLog = {};
82
+ // toLog[type] = data;
83
+ // console.log(JSON.stringify(toLog, undefined, 2));
84
+ // });
85
+ // }
86
+ if (!requestOptions.headers) {
87
+ requestOptions.headers = {};
88
+ }
89
+ requestOptions.headers["x-groupdocs-client"] = "node.js sdk";
90
+ requestOptions.headers["x-groupdocs-client-version"] = package_version_1.PackageVersion;
91
+ const auth = config.authentication;
92
+ if (!skipAuth) {
93
+ yield auth.applyToRequest(requestOptions, config);
94
+ }
95
+ return new Promise((resolve, reject) => {
96
+ (0, axios_1.default)(requestOptions)
97
+ .then((response) => {
98
+ if (response.status >= 200 && response.status <= 299) {
99
+ resolve(response);
100
+ }
101
+ else {
102
+ reject({ message: response.data, code: response.status });
103
+ }
104
+ })
105
+ .catch((error) => {
106
+ try {
107
+ const response = error.response;
108
+ let bodyContent = response.data;
109
+ if (bodyContent instanceof Buffer) {
110
+ bodyContent = JSON.parse(bodyContent.toString("utf8"));
111
+ }
112
+ if (bodyContent.error) {
113
+ if (bodyContent.error.message) {
114
+ reject({ message: bodyContent.error.message, code: bodyContent.error.code });
115
+ }
116
+ else {
117
+ reject({ message: bodyContent.error, code: response.status });
118
+ }
119
+ }
120
+ else {
121
+ if (bodyContent.message) {
122
+ reject({ message: bodyContent.message, code: bodyContent.code });
123
+ }
124
+ else {
125
+ reject({ message: bodyContent, code: response.status });
126
+ }
127
+ }
128
+ }
129
+ catch (error) {
130
+ reject({ message: "Error while parse server error: " + error });
131
+ }
132
+ });
133
+ });
134
+ });
135
+ }
@@ -1,56 +1,56 @@
1
- /**
2
- * Describes API error.
3
- */
4
- export declare class ApiError {
5
- /**
6
- * Attribute type map
7
- */
8
- static attributeTypeMap: Array<{
9
- name: string;
10
- baseName: string;
11
- type: string;
12
- }>;
13
- /**
14
- * Returns attribute type map
15
- */
16
- static getAttributeTypeMap(): {
17
- name: string;
18
- baseName: string;
19
- type: string;
20
- }[];
21
- /**
22
- * Error.
23
- */
24
- error: Error;
25
- constructor(init?: Partial<ApiError>);
26
- }
27
- /**
28
- * Error.
29
- */
30
- export declare class Error {
31
- /**
32
- * Attribute type map
33
- */
34
- static attributeTypeMap: Array<{
35
- name: string;
36
- baseName: string;
37
- type: string;
38
- }>;
39
- /**
40
- * Returns attribute type map
41
- */
42
- static getAttributeTypeMap(): {
43
- name: string;
44
- baseName: string;
45
- type: string;
46
- }[];
47
- /**
48
- * Error code.
49
- */
50
- code: string;
51
- /**
52
- * Error message
53
- */
54
- message: string;
55
- constructor(init?: Partial<Error>);
56
- }
1
+ /**
2
+ * Describes API error.
3
+ */
4
+ export declare class ApiError {
5
+ /**
6
+ * Attribute type map
7
+ */
8
+ static attributeTypeMap: Array<{
9
+ name: string;
10
+ baseName: string;
11
+ type: string;
12
+ }>;
13
+ /**
14
+ * Returns attribute type map
15
+ */
16
+ static getAttributeTypeMap(): {
17
+ name: string;
18
+ baseName: string;
19
+ type: string;
20
+ }[];
21
+ /**
22
+ * Error.
23
+ */
24
+ error: Error;
25
+ constructor(init?: Partial<ApiError>);
26
+ }
27
+ /**
28
+ * Error.
29
+ */
30
+ export declare class Error {
31
+ /**
32
+ * Attribute type map
33
+ */
34
+ static attributeTypeMap: Array<{
35
+ name: string;
36
+ baseName: string;
37
+ type: string;
38
+ }>;
39
+ /**
40
+ * Returns attribute type map
41
+ */
42
+ static getAttributeTypeMap(): {
43
+ name: string;
44
+ baseName: string;
45
+ type: string;
46
+ }[];
47
+ /**
48
+ * Error code.
49
+ */
50
+ code: string;
51
+ /**
52
+ * Error message
53
+ */
54
+ message: string;
55
+ constructor(init?: Partial<Error>);
56
+ }
package/lib/api_error.js CHANGED
@@ -1,80 +1,81 @@
1
- "use strict";
2
- /*
3
- * The MIT License (MIT)
4
- *
5
- * Copyright (c) 2003-2019 Aspose Pty Ltd
6
- *
7
- * Permission is hereby granted, free of charge, to any person obtaining a copy
8
- * of this software and associated documentation files (the "Software"), to deal
9
- * in the Software without restriction, including without limitation the rights
10
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- * copies of the Software, and to permit persons to whom the Software is
12
- * furnished to do so, subject to the following conditions:
13
- *
14
- * The above copyright notice and this permission notice shall be included in all
15
- * copies or substantial portions of the Software.
16
- *
17
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- * SOFTWARE.
24
- */
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- /**
27
- * Describes API error.
28
- */
29
- class ApiError {
30
- constructor(init) {
31
- Object.assign(this, init);
32
- }
33
- /**
34
- * Returns attribute type map
35
- */
36
- static getAttributeTypeMap() {
37
- return ApiError.attributeTypeMap;
38
- }
39
- }
40
- /**
41
- * Attribute type map
42
- */
43
- ApiError.attributeTypeMap = [
44
- {
45
- name: "error",
46
- baseName: "error",
47
- type: "Error",
48
- }
49
- ];
50
- exports.ApiError = ApiError;
51
- /**
52
- * Error.
53
- */
54
- class Error {
55
- constructor(init) {
56
- Object.assign(this, init);
57
- }
58
- /**
59
- * Returns attribute type map
60
- */
61
- static getAttributeTypeMap() {
62
- return Error.attributeTypeMap;
63
- }
64
- }
65
- /**
66
- * Attribute type map
67
- */
68
- Error.attributeTypeMap = [
69
- {
70
- name: "code",
71
- baseName: "code",
72
- type: "string",
73
- },
74
- {
75
- name: "message",
76
- baseName: "message",
77
- type: "string",
78
- }
79
- ];
80
- exports.Error = Error;
1
+ "use strict";
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) Aspose Pty Ltd
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.Error = exports.ApiError = void 0;
27
+ /**
28
+ * Describes API error.
29
+ */
30
+ class ApiError {
31
+ /**
32
+ * Returns attribute type map
33
+ */
34
+ static getAttributeTypeMap() {
35
+ return ApiError.attributeTypeMap;
36
+ }
37
+ constructor(init) {
38
+ Object.assign(this, init);
39
+ }
40
+ }
41
+ exports.ApiError = ApiError;
42
+ /**
43
+ * Attribute type map
44
+ */
45
+ ApiError.attributeTypeMap = [
46
+ {
47
+ name: "error",
48
+ baseName: "error",
49
+ type: "Error",
50
+ }
51
+ ];
52
+ /**
53
+ * Error.
54
+ */
55
+ class Error {
56
+ /**
57
+ * Returns attribute type map
58
+ */
59
+ static getAttributeTypeMap() {
60
+ return Error.attributeTypeMap;
61
+ }
62
+ constructor(init) {
63
+ Object.assign(this, init);
64
+ }
65
+ }
66
+ exports.Error = Error;
67
+ /**
68
+ * Attribute type map
69
+ */
70
+ Error.attributeTypeMap = [
71
+ {
72
+ name: "code",
73
+ baseName: "code",
74
+ type: "string",
75
+ },
76
+ {
77
+ name: "message",
78
+ baseName: "message",
79
+ type: "string",
80
+ }
81
+ ];
package/lib/auth.d.ts CHANGED
@@ -1,22 +1,23 @@
1
- import request = require("request");
2
- import { Configuration } from "./configuration";
3
- /**
4
- * Authentication logic for api calls
5
- */
6
- export interface IAuthentication {
7
- /**
8
- * Apply authentication settings to header and query params.
9
- */
10
- applyToRequest(requestOptions: request.Options, configuration: Configuration): void;
11
- }
12
- /**
13
- * Implements OAuth authentication
14
- */
15
- export declare class OAuth implements IAuthentication {
16
- private accessToken;
17
- /**
18
- * Apply authentication settings to header and query params
19
- */
20
- applyToRequest(requestOptions: request.Options, configuration: Configuration): Promise<void>;
21
- private _requestToken;
22
- }
1
+ import { RawAxiosRequestConfig } from "axios";
2
+ import { Configuration } from "./configuration";
3
+ /**
4
+ * Authentication logic for api calls
5
+ */
6
+ export interface IAuthentication {
7
+ /**
8
+ * Apply authentication settings to header and query params.
9
+ */
10
+ applyToRequest(requestOptions: RawAxiosRequestConfig, configuration: Configuration): void;
11
+ }
12
+ /**
13
+ * Implements OAuth authentication
14
+ */
15
+ export declare class OAuth implements IAuthentication {
16
+ private accessToken;
17
+ /**
18
+ * Apply authentication settings to header and query params
19
+ */
20
+ applyToRequest(requestOptions: RawAxiosRequestConfig, configuration: Configuration): Promise<void>;
21
+ private _requestToken;
22
+ private isTokenValid;
23
+ }