groupdocs-parser-cloud 23.10.0 → 26.2.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.
Files changed (49) hide show
  1. package/LICENSE +1 -1
  2. package/lib/{api_client.d.ts → src/api_client.d.ts} +17 -17
  3. package/lib/{api_client.js → src/api_client.js} +135 -125
  4. package/lib/{api_error.d.ts → src/api_error.d.ts} +56 -56
  5. package/lib/{api_error.js → src/api_error.js} +81 -80
  6. package/lib/{auth.d.ts → src/auth.d.ts} +23 -22
  7. package/lib/{auth.js → src/auth.js} +96 -71
  8. package/lib/{configuration.d.ts → src/configuration.d.ts} +39 -39
  9. package/lib/{configuration.js → src/configuration.js} +56 -55
  10. package/lib/{model.d.ts → src/model.d.ts} +2248 -2206
  11. package/lib/{model.js → src/model.js} +2216 -2169
  12. package/lib/{package_version.d.ts → src/package_version.d.ts} +4 -4
  13. package/lib/{package_version.js → src/package_version.js} +30 -29
  14. package/lib/{parser_api.d.ts → src/parser_api.d.ts} +274 -270
  15. package/lib/{parser_api.js → src/parser_api.js} +930 -893
  16. package/lib/{serializer.d.ts → src/serializer.d.ts} +14 -14
  17. package/lib/{serializer.js → src/serializer.js} +171 -170
  18. package/lib/test/api/test_auth_api.d.ts +1 -0
  19. package/lib/test/api/test_auth_api.js +45 -0
  20. package/lib/test/api/test_barcode_api.d.ts +1 -0
  21. package/lib/test/api/test_barcode_api.js +64 -0
  22. package/lib/test/api/test_file_api.d.ts +1 -0
  23. package/lib/test/api/test_file_api.js +95 -0
  24. package/lib/test/api/test_folder_api.d.ts +1 -0
  25. package/lib/test/api/test_folder_api.js +84 -0
  26. package/lib/test/api/test_formats_api.d.ts +1 -0
  27. package/lib/test/api/test_formats_api.js +60 -0
  28. package/lib/test/api/test_parser_container_api.d.ts +1 -0
  29. package/lib/test/api/test_parser_container_api.js +134 -0
  30. package/lib/test/api/test_parser_image_api.d.ts +1 -0
  31. package/lib/test/api/test_parser_image_api.js +179 -0
  32. package/lib/test/api/test_parser_info_api.d.ts +1 -0
  33. package/lib/test/api/test_parser_info_api.js +112 -0
  34. package/lib/test/api/test_parser_parse_api.d.ts +1 -0
  35. package/lib/test/api/test_parser_parse_api.js +184 -0
  36. package/lib/test/api/test_parser_template_api.d.ts +1 -0
  37. package/lib/test/api/test_parser_template_api.js +168 -0
  38. package/lib/test/api/test_parser_text_api.d.ts +1 -0
  39. package/lib/test/api/test_parser_text_api.js +180 -0
  40. package/lib/test/api/test_storage_api.d.ts +1 -0
  41. package/lib/test/api/test_storage_api.js +76 -0
  42. package/lib/test/test_context.d.ts +30 -0
  43. package/lib/test/test_context.js +156 -0
  44. package/lib/test/test_coverage.d.ts +1 -0
  45. package/lib/test/test_coverage.js +77 -0
  46. package/lib/test/test_file.d.ts +50 -0
  47. package/lib/test/test_file.js +92 -0
  48. package/lib/tsconfig.tsbuildinfo +1 -0
  49. package/package.json +16 -14
@@ -1,71 +1,96 @@
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 api_client_1 = require("./api_client");
35
- /**
36
- * Implements OAuth authentication
37
- */
38
- class OAuth {
39
- /**
40
- * Apply authentication settings to header and query params
41
- */
42
- applyToRequest(requestOptions, configuration) {
43
- return __awaiter(this, void 0, void 0, function* () {
44
- if (this.accessToken == null) {
45
- yield this._requestToken(configuration);
46
- }
47
- if (requestOptions && requestOptions.headers) {
48
- requestOptions.headers.Authorization = "Bearer " + this.accessToken;
49
- }
50
- return Promise.resolve();
51
- });
52
- }
53
- _requestToken(configuration) {
54
- return __awaiter(this, void 0, void 0, function* () {
55
- const requestOptions = {
56
- method: "POST",
57
- json: true,
58
- uri: configuration.apiBaseUrl + "/connect/token",
59
- form: {
60
- grant_type: "client_credentials",
61
- client_id: configuration.appSid,
62
- client_secret: configuration.appKey,
63
- },
64
- };
65
- const response = yield api_client_1.invokeApiMethod(requestOptions, configuration, true);
66
- this.accessToken = response.body.access_token;
67
- return Promise.resolve();
68
- });
69
- }
70
- }
71
- exports.OAuth = OAuth;
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.OAuth = void 0;
36
+ const jwt = require("jsonwebtoken");
37
+ const api_client_1 = require("./api_client");
38
+ const qs = require("qs");
39
+ /**
40
+ * Implements OAuth authentication
41
+ */
42
+ class OAuth {
43
+ /**
44
+ * Apply authentication settings to header and query params
45
+ */
46
+ applyToRequest(requestOptions, configuration) {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ if (this.accessToken == null || !this.isTokenValid()) {
49
+ yield this._requestToken(configuration);
50
+ }
51
+ if (requestOptions && requestOptions.headers) {
52
+ requestOptions.headers.Authorization = "Bearer " + this.accessToken;
53
+ }
54
+ return Promise.resolve();
55
+ });
56
+ }
57
+ _requestToken(configuration) {
58
+ return __awaiter(this, void 0, void 0, function* () {
59
+ const requestOptions = {
60
+ method: "post",
61
+ headers: { "content-type": "application/x-www-form-urlencoded" },
62
+ maxBodyLength: Infinity,
63
+ url: configuration.apiBaseUrl + "/connect/token",
64
+ data: qs.stringify({
65
+ grant_type: "client_credentials",
66
+ client_id: configuration.appSid,
67
+ client_secret: configuration.appKey,
68
+ }),
69
+ };
70
+ const response = yield (0, api_client_1.invokeApiMethod)(requestOptions, configuration, true);
71
+ this.accessToken = response.data.access_token;
72
+ return Promise.resolve();
73
+ });
74
+ }
75
+ isTokenValid() {
76
+ try {
77
+ const decodedToken = jwt.decode(this.accessToken);
78
+ if (!decodedToken) {
79
+ console.log("Invalid token.");
80
+ return;
81
+ }
82
+ const expirationTime = decodedToken.exp;
83
+ const currentTime = Math.floor(Date.now() / 1000);
84
+ if (currentTime <= expirationTime) {
85
+ return true;
86
+ }
87
+ else {
88
+ return false;
89
+ }
90
+ }
91
+ catch (error) {
92
+ return false;
93
+ }
94
+ }
95
+ }
96
+ exports.OAuth = OAuth;
@@ -1,39 +1,39 @@
1
- import { IAuthentication } from "./auth";
2
- /**
3
- * Words API configuration
4
- */
5
- export declare class Configuration {
6
- /**
7
- * Authentication
8
- */
9
- authentication: IAuthentication;
10
- /**
11
- * Application identifier (App SID)
12
- */
13
- appSid: string;
14
- /**
15
- * Application private key (App Key)
16
- */
17
- appKey: string;
18
- /**
19
- * API base URL, default is 'https://api.groupdocs.cloud'
20
- */
21
- apiBaseUrl: string;
22
- /**
23
- * Gets or sets the API version
24
- */
25
- apiVersion: string;
26
- /**
27
- * When enabled all requests and responses are logged to console
28
- */
29
- debugging: boolean;
30
- /**
31
- * @param appSid Application identifier (App SID)
32
- * @param appKey Application private key (App Key)
33
- */
34
- constructor(appSid: string, appKey: string);
35
- /**
36
- * Returns server url e.g "https://api.groupdocs.cloud/1.0"
37
- */
38
- getServerUrl(): string;
39
- }
1
+ import { IAuthentication } from "./auth";
2
+ /**
3
+ * Words API configuration
4
+ */
5
+ export declare class Configuration {
6
+ /**
7
+ * Authentication
8
+ */
9
+ authentication: IAuthentication;
10
+ /**
11
+ * Application identifier (App SID)
12
+ */
13
+ appSid: string;
14
+ /**
15
+ * Application private key (App Key)
16
+ */
17
+ appKey: string;
18
+ /**
19
+ * API base URL, default is 'https://api.groupdocs.cloud'
20
+ */
21
+ apiBaseUrl: string;
22
+ /**
23
+ * Gets or sets the API version
24
+ */
25
+ apiVersion: string;
26
+ /**
27
+ * When enabled all requests and responses are logged to console
28
+ */
29
+ debugging: boolean;
30
+ /**
31
+ * @param appSid Application identifier (App SID)
32
+ * @param appKey Application private key (App Key)
33
+ */
34
+ constructor(appSid: string, appKey: string);
35
+ /**
36
+ * Returns server url e.g "https://api.groupdocs.cloud/1.0"
37
+ */
38
+ getServerUrl(): string;
39
+ }
@@ -1,55 +1,56 @@
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
- const auth_1 = require("./auth");
27
- /**
28
- * Words API configuration
29
- */
30
- class Configuration {
31
- /**
32
- * @param appSid Application identifier (App SID)
33
- * @param appKey Application private key (App Key)
34
- */
35
- constructor(appSid, appKey) {
36
- /**
37
- * API base URL, default is 'https://api.groupdocs.cloud'
38
- */
39
- this.apiBaseUrl = "https://api.groupdocs.cloud";
40
- /**
41
- * Gets or sets the API version
42
- */
43
- this.apiVersion = "/v1.0";
44
- this.appSid = appSid;
45
- this.appKey = appKey;
46
- this.authentication = new auth_1.OAuth();
47
- }
48
- /**
49
- * Returns server url e.g "https://api.groupdocs.cloud/1.0"
50
- */
51
- getServerUrl() {
52
- return this.apiBaseUrl + this.apiVersion;
53
- }
54
- }
55
- exports.Configuration = Configuration;
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.Configuration = void 0;
27
+ const auth_1 = require("./auth");
28
+ /**
29
+ * Words API configuration
30
+ */
31
+ class Configuration {
32
+ /**
33
+ * @param appSid Application identifier (App SID)
34
+ * @param appKey Application private key (App Key)
35
+ */
36
+ constructor(appSid, appKey) {
37
+ /**
38
+ * API base URL, default is 'https://api.groupdocs.cloud'
39
+ */
40
+ this.apiBaseUrl = "https://api-qa.groupdocs.cloud";
41
+ /**
42
+ * Gets or sets the API version
43
+ */
44
+ this.apiVersion = "/v1.0";
45
+ this.appSid = appSid;
46
+ this.appKey = appKey;
47
+ this.authentication = new auth_1.OAuth();
48
+ }
49
+ /**
50
+ * Returns server url e.g "https://api.groupdocs.cloud/1.0"
51
+ */
52
+ getServerUrl() {
53
+ return this.apiBaseUrl + this.apiVersion;
54
+ }
55
+ }
56
+ exports.Configuration = Configuration;