groupdocs-parser-cloud 25.9.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.
- package/lib/{model.d.ts → src/model.d.ts} +37 -0
- package/lib/{model.js → src/model.js} +38 -2
- package/lib/{package_version.js → src/package_version.js} +1 -1
- package/lib/{parser_api.d.ts → src/parser_api.d.ts} +5 -0
- package/lib/{parser_api.js → src/parser_api.js} +27 -0
- package/lib/test/api/test_auth_api.d.ts +1 -0
- package/lib/test/api/test_auth_api.js +45 -0
- package/lib/test/api/test_barcode_api.d.ts +1 -0
- package/lib/test/api/test_barcode_api.js +64 -0
- package/lib/test/api/test_file_api.d.ts +1 -0
- package/lib/test/api/test_file_api.js +95 -0
- package/lib/test/api/test_folder_api.d.ts +1 -0
- package/lib/test/api/test_folder_api.js +84 -0
- package/lib/test/api/test_formats_api.d.ts +1 -0
- package/lib/test/api/test_formats_api.js +60 -0
- package/lib/test/api/test_parser_container_api.d.ts +1 -0
- package/lib/test/api/test_parser_container_api.js +134 -0
- package/lib/test/api/test_parser_image_api.d.ts +1 -0
- package/lib/test/api/test_parser_image_api.js +179 -0
- package/lib/test/api/test_parser_info_api.d.ts +1 -0
- package/lib/test/api/test_parser_info_api.js +112 -0
- package/lib/test/api/test_parser_parse_api.d.ts +1 -0
- package/lib/test/api/test_parser_parse_api.js +184 -0
- package/lib/test/api/test_parser_template_api.d.ts +1 -0
- package/lib/test/api/test_parser_template_api.js +168 -0
- package/lib/test/api/test_parser_text_api.d.ts +1 -0
- package/lib/test/api/test_parser_text_api.js +180 -0
- package/lib/test/api/test_storage_api.d.ts +1 -0
- package/lib/test/api/test_storage_api.js +76 -0
- package/lib/test/test_context.d.ts +30 -0
- package/lib/test/test_context.js +156 -0
- package/lib/test/test_coverage.d.ts +1 -0
- package/lib/test/test_coverage.js +77 -0
- package/lib/test/test_file.d.ts +50 -0
- package/lib/test/test_file.js +92 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- /package/lib/{api_client.d.ts → src/api_client.d.ts} +0 -0
- /package/lib/{api_client.js → src/api_client.js} +0 -0
- /package/lib/{api_error.d.ts → src/api_error.d.ts} +0 -0
- /package/lib/{api_error.js → src/api_error.js} +0 -0
- /package/lib/{auth.d.ts → src/auth.d.ts} +0 -0
- /package/lib/{auth.js → src/auth.js} +0 -0
- /package/lib/{configuration.d.ts → src/configuration.d.ts} +0 -0
- /package/lib/{configuration.js → src/configuration.js} +0 -0
- /package/lib/{package_version.d.ts → src/package_version.d.ts} +0 -0
- /package/lib/{serializer.d.ts → src/serializer.d.ts} +0 -0
- /package/lib/{serializer.js → src/serializer.js} +0 -0
|
@@ -1606,6 +1606,32 @@ export declare class TextStyle {
|
|
|
1606
1606
|
name: string;
|
|
1607
1607
|
constructor(init?: Partial<TextStyle>);
|
|
1608
1608
|
}
|
|
1609
|
+
/**
|
|
1610
|
+
* AI Parse options.
|
|
1611
|
+
*/
|
|
1612
|
+
export declare class AIParseOptions extends ParserOptions {
|
|
1613
|
+
/**
|
|
1614
|
+
* Attribute type map
|
|
1615
|
+
*/
|
|
1616
|
+
static attributeTypeMap: Array<{
|
|
1617
|
+
name: string;
|
|
1618
|
+
baseName: string;
|
|
1619
|
+
type: string;
|
|
1620
|
+
}>;
|
|
1621
|
+
/**
|
|
1622
|
+
* Returns attribute type map
|
|
1623
|
+
*/
|
|
1624
|
+
static getAttributeTypeMap(): {
|
|
1625
|
+
name: string;
|
|
1626
|
+
baseName: string;
|
|
1627
|
+
type: string;
|
|
1628
|
+
}[];
|
|
1629
|
+
/**
|
|
1630
|
+
* User-generated template to extract metadata from the document.
|
|
1631
|
+
*/
|
|
1632
|
+
template: any;
|
|
1633
|
+
constructor(init?: Partial<AIParseOptions>);
|
|
1634
|
+
}
|
|
1609
1635
|
/**
|
|
1610
1636
|
* Barcode options.
|
|
1611
1637
|
*/
|
|
@@ -1862,6 +1888,7 @@ declare const typeMap: {
|
|
|
1862
1888
|
TextPage: typeof TextPage;
|
|
1863
1889
|
TextResult: typeof TextResult;
|
|
1864
1890
|
TextStyle: typeof TextStyle;
|
|
1891
|
+
AIParseOptions: typeof AIParseOptions;
|
|
1865
1892
|
BarcodesOptions: typeof BarcodesOptions;
|
|
1866
1893
|
ContainerOptions: typeof ContainerOptions;
|
|
1867
1894
|
FileVersion: typeof FileVersion;
|
|
@@ -2087,6 +2114,16 @@ export declare class GetInfoRequest {
|
|
|
2087
2114
|
options: InfoOptions;
|
|
2088
2115
|
constructor(options: InfoOptions);
|
|
2089
2116
|
}
|
|
2117
|
+
/**
|
|
2118
|
+
* Request model for AIParse operation.
|
|
2119
|
+
*/
|
|
2120
|
+
export declare class AIParseRequest {
|
|
2121
|
+
/**
|
|
2122
|
+
* Parse options.
|
|
2123
|
+
*/
|
|
2124
|
+
options: AIParseOptions;
|
|
2125
|
+
constructor(options: AIParseOptions);
|
|
2126
|
+
}
|
|
2090
2127
|
/**
|
|
2091
2128
|
* Request model for Barcodes operation.
|
|
2092
2129
|
*/
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
* SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
27
|
-
exports.GetTemplateRequest = exports.DeleteTemplateRequest = exports.CreateTemplateRequest = exports.StorageExistsRequest = exports.ObjectExistsRequest = exports.GetFileVersionsRequest = exports.GetDiscUsageRequest = exports.TextRequest = exports.ParseRequest = exports.ImagesRequest = exports.BarcodesRequest = exports.GetInfoRequest = exports.ContainerRequest = exports.MoveFolderRequest = exports.GetFilesListRequest = exports.DeleteFolderRequest = exports.CreateFolderRequest = exports.CopyFolderRequest = exports.UploadFileRequest = exports.MoveFileRequest = exports.DownloadFileRequest = exports.DeleteFileRequest = exports.CopyFileRequest = exports.typeMap = exports.enumsMap = exports.TextOptions = exports.ParseOptions = exports.InfoOptions = exports.ImagesOptions = exports.FileVersion = void 0;
|
|
26
|
+
exports.BarcodesOptions = exports.AIParseOptions = exports.TextStyle = exports.TextResult = exports.TextPage = exports.TemplateResult = exports.TemplateOptions = exports.Template = exports.TableLayout = exports.Table = exports.StorageFile = exports.StorageExist = exports.Size = exports.Rectangle = exports.Point = exports.ParserOptions = exports.ParseResult = exports.PageTextArea = exports.PageTableAreaCell = exports.PageTableArea = exports.PageArea = exports.Page = exports.ObjectExist = exports.ModelError = exports.InfoResult = exports.ImagesResult = exports.ImagePage = exports.Image = exports.FormattedTextOptions = exports.FormatsResult = exports.Format = exports.FilesUploadResult = exports.FilesList = exports.FileVersions = exports.FileType = exports.FileInfo = exports.FieldPosition = exports.FieldData = exports.Field = exports.ErrorDetails = exports.DiscUsage = exports.DetectorParameters = exports.CreateTemplateOptions = exports.Coordinates = exports.ContainerResult = exports.ContainerItemInfo = exports.ContainerItem = exports.BarcodesResult = exports.BarcodePage = exports.Barcode = void 0;
|
|
27
|
+
exports.GetTemplateRequest = exports.DeleteTemplateRequest = exports.CreateTemplateRequest = exports.StorageExistsRequest = exports.ObjectExistsRequest = exports.GetFileVersionsRequest = exports.GetDiscUsageRequest = exports.TextRequest = exports.ParseRequest = exports.ImagesRequest = exports.BarcodesRequest = exports.AIParseRequest = exports.GetInfoRequest = exports.ContainerRequest = exports.MoveFolderRequest = exports.GetFilesListRequest = exports.DeleteFolderRequest = exports.CreateFolderRequest = exports.CopyFolderRequest = exports.UploadFileRequest = exports.MoveFileRequest = exports.DownloadFileRequest = exports.DeleteFileRequest = exports.CopyFileRequest = exports.typeMap = exports.enumsMap = exports.TextOptions = exports.ParseOptions = exports.InfoOptions = exports.ImagesOptions = exports.FileVersion = exports.ContainerOptions = void 0;
|
|
28
28
|
/**
|
|
29
29
|
* Represents an barcode.
|
|
30
30
|
*/
|
|
@@ -1674,6 +1674,32 @@ TextStyle.attributeTypeMap = [
|
|
|
1674
1674
|
type: "string",
|
|
1675
1675
|
}
|
|
1676
1676
|
];
|
|
1677
|
+
/**
|
|
1678
|
+
* AI Parse options.
|
|
1679
|
+
*/
|
|
1680
|
+
class AIParseOptions extends ParserOptions {
|
|
1681
|
+
/**
|
|
1682
|
+
* Returns attribute type map
|
|
1683
|
+
*/
|
|
1684
|
+
static getAttributeTypeMap() {
|
|
1685
|
+
return super.getAttributeTypeMap().concat(AIParseOptions.attributeTypeMap);
|
|
1686
|
+
}
|
|
1687
|
+
constructor(init) {
|
|
1688
|
+
super(init);
|
|
1689
|
+
Object.assign(this, init);
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
exports.AIParseOptions = AIParseOptions;
|
|
1693
|
+
/**
|
|
1694
|
+
* Attribute type map
|
|
1695
|
+
*/
|
|
1696
|
+
AIParseOptions.attributeTypeMap = [
|
|
1697
|
+
{
|
|
1698
|
+
name: "template",
|
|
1699
|
+
baseName: "template",
|
|
1700
|
+
type: "any",
|
|
1701
|
+
}
|
|
1702
|
+
];
|
|
1677
1703
|
/**
|
|
1678
1704
|
* Barcode options.
|
|
1679
1705
|
*/
|
|
@@ -1935,6 +1961,7 @@ const typeMap = {
|
|
|
1935
1961
|
TextPage,
|
|
1936
1962
|
TextResult,
|
|
1937
1963
|
TextStyle,
|
|
1964
|
+
AIParseOptions,
|
|
1938
1965
|
BarcodesOptions,
|
|
1939
1966
|
ContainerOptions,
|
|
1940
1967
|
FileVersion,
|
|
@@ -2076,6 +2103,15 @@ class GetInfoRequest {
|
|
|
2076
2103
|
}
|
|
2077
2104
|
}
|
|
2078
2105
|
exports.GetInfoRequest = GetInfoRequest;
|
|
2106
|
+
/**
|
|
2107
|
+
* Request model for AIParse operation.
|
|
2108
|
+
*/
|
|
2109
|
+
class AIParseRequest {
|
|
2110
|
+
constructor(options) {
|
|
2111
|
+
this.options = options;
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
exports.AIParseRequest = AIParseRequest;
|
|
2079
2115
|
/**
|
|
2080
2116
|
* Request model for Barcodes operation.
|
|
2081
2117
|
*/
|
|
@@ -163,6 +163,11 @@ export declare class ParseApi {
|
|
|
163
163
|
* @param config Configuration.
|
|
164
164
|
*/
|
|
165
165
|
private constructor();
|
|
166
|
+
/**
|
|
167
|
+
* Extract document data using AI and given template.
|
|
168
|
+
* @param requestObj contains request parameters
|
|
169
|
+
*/
|
|
170
|
+
aIParse(requestObj: model.AIParseRequest): Promise<any>;
|
|
166
171
|
/**
|
|
167
172
|
* Extract barcodes from document.
|
|
168
173
|
* @param requestObj contains request parameters
|
|
@@ -548,6 +548,33 @@ class ParseApi {
|
|
|
548
548
|
constructor(config) {
|
|
549
549
|
this.configuration = config;
|
|
550
550
|
}
|
|
551
|
+
/**
|
|
552
|
+
* Extract document data using AI and given template.
|
|
553
|
+
* @param requestObj contains request parameters
|
|
554
|
+
*/
|
|
555
|
+
aIParse(requestObj) {
|
|
556
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
557
|
+
if (requestObj === null || requestObj === undefined) {
|
|
558
|
+
throw new Error('Required parameter "requestObj" was null or undefined when calling aIParse.');
|
|
559
|
+
}
|
|
560
|
+
const localVarPath = this.configuration.getServerUrl() + "/parser/aiparse";
|
|
561
|
+
const queryParameters = {};
|
|
562
|
+
// verify required parameter 'requestObj.options' is not null or undefined
|
|
563
|
+
if (requestObj.options === null || requestObj.options === undefined) {
|
|
564
|
+
throw new Error('Required parameter "requestObj.options" was null or undefined when calling aIParse.');
|
|
565
|
+
}
|
|
566
|
+
const requestOptions = {
|
|
567
|
+
method: "POST",
|
|
568
|
+
params: queryParameters,
|
|
569
|
+
url: localVarPath,
|
|
570
|
+
responseType: "json",
|
|
571
|
+
data: serializer_1.Serializer.serialize(requestObj.options, requestObj.options.constructor.name === "Object" ? "AIParseOptions" : requestObj.options.constructor.name),
|
|
572
|
+
};
|
|
573
|
+
const response = yield (0, api_client_1.invokeApiMethod)(requestOptions, this.configuration);
|
|
574
|
+
const result = serializer_1.Serializer.deserialize(response.data, "any");
|
|
575
|
+
return Promise.resolve(result);
|
|
576
|
+
});
|
|
577
|
+
}
|
|
551
578
|
/**
|
|
552
579
|
* Extract barcodes from document.
|
|
553
580
|
* @param requestObj contains request parameters
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "mocha";
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
const chai_1 = require("chai");
|
|
27
|
+
require("mocha");
|
|
28
|
+
const configuration_1 = require("../../src/configuration");
|
|
29
|
+
const parser_api_1 = require("../../src/parser_api");
|
|
30
|
+
describe("auth_api", () => {
|
|
31
|
+
describe("test_auth_error", () => {
|
|
32
|
+
it("should throw when app sid not found", () => {
|
|
33
|
+
const settings = require("../test_settings.json");
|
|
34
|
+
const appSid = "test";
|
|
35
|
+
const appKey = "test";
|
|
36
|
+
const config = new configuration_1.Configuration(appSid, appKey);
|
|
37
|
+
config.apiBaseUrl = settings.ApiBaseUrl;
|
|
38
|
+
const infoApi = parser_api_1.InfoApi.fromConfig(config);
|
|
39
|
+
return infoApi.getSupportedFileFormats()
|
|
40
|
+
.catch((error) => {
|
|
41
|
+
(0, chai_1.expect)(error.message).equal("invalid_client");
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "mocha";
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// --------------------------------------------------------------------------------------------------------------------
|
|
3
|
+
// <copyright company="Aspose Pty Ltd">
|
|
4
|
+
// Copyright (c) Aspose Pty Ltd
|
|
5
|
+
// </copyright>
|
|
6
|
+
// <summary>
|
|
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
|
+
// </summary>
|
|
25
|
+
// --------------------------------------------------------------------------------------------------------------------
|
|
26
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
27
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
28
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
29
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
30
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
31
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
32
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const chai_1 = require("chai");
|
|
37
|
+
require("mocha");
|
|
38
|
+
const model_1 = require("../../src/model");
|
|
39
|
+
const TestContext = require("../test_context");
|
|
40
|
+
const test_file_1 = require("../test_file");
|
|
41
|
+
describe("test_parser_barcode_api", () => {
|
|
42
|
+
before(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
|
+
yield TestContext.uploadTestFiles();
|
|
44
|
+
}));
|
|
45
|
+
afterEach(function () {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
yield TestContext.cleanupTempFiles();
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
describe("TestBarcodesApi", () => {
|
|
51
|
+
it("TestGetBarcodes_Docx", () => {
|
|
52
|
+
const barcodesOptions = new model_1.BarcodesOptions();
|
|
53
|
+
barcodesOptions.fileInfo = test_file_1.TestFile.PasswordProtected.ToFileInfo();
|
|
54
|
+
const request = new model_1.BarcodesRequest(barcodesOptions);
|
|
55
|
+
return TestContext.getParseApi().barcodes(request)
|
|
56
|
+
.then((result) => {
|
|
57
|
+
(0, chai_1.expect)(result).not.to.be.null;
|
|
58
|
+
result.barcodes.forEach((barcode) => {
|
|
59
|
+
(0, chai_1.expect)(barcode.value).not.to.be.null;
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "mocha";
|
|
@@ -0,0 +1,95 @@
|
|
|
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
|
+
const chai_1 = require("chai");
|
|
36
|
+
require("mocha");
|
|
37
|
+
const model_1 = require("../../src/model");
|
|
38
|
+
const TestContext = require("../test_context");
|
|
39
|
+
const test_file_1 = require("../test_file");
|
|
40
|
+
describe("file_api", () => {
|
|
41
|
+
before(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
|
+
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = "0";
|
|
43
|
+
yield TestContext.uploadTestFiles();
|
|
44
|
+
}));
|
|
45
|
+
afterEach(function () {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
yield TestContext.cleanupTempFiles();
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
describe("test_file_api", () => {
|
|
51
|
+
it("TestDeleteFile", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
|
+
var testFile = test_file_1.TestFile.FourPages;
|
|
53
|
+
var deleteRequest = new model_1.DeleteFileRequest(testFile.GetPath());
|
|
54
|
+
var existsRequest = new model_1.ObjectExistsRequest(testFile.GetPath());
|
|
55
|
+
var uploadRequest = new model_1.UploadFileRequest(testFile.GetPath(), TestContext.getTestFileBuffer(testFile));
|
|
56
|
+
yield TestContext.getFileApi().deleteFile(deleteRequest);
|
|
57
|
+
var result = yield TestContext.getStorageApi().objectExists(existsRequest);
|
|
58
|
+
(0, chai_1.expect)(result.exists).equal(false);
|
|
59
|
+
yield TestContext.getFileApi().uploadFile(uploadRequest);
|
|
60
|
+
result = yield TestContext.getStorageApi().objectExists(existsRequest);
|
|
61
|
+
(0, chai_1.expect)(result.exists).equal(true);
|
|
62
|
+
}));
|
|
63
|
+
it("TestDownloadFile", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
64
|
+
var testFile = test_file_1.TestFile.FourPages;
|
|
65
|
+
var dlRequest = new model_1.DownloadFileRequest(testFile.GetPath());
|
|
66
|
+
var result = yield TestContext.getFileApi().downloadFile(dlRequest);
|
|
67
|
+
(0, chai_1.expect)(result.length).greaterThan(0);
|
|
68
|
+
}));
|
|
69
|
+
it("TestCopyMoveFile", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
70
|
+
var testFile = test_file_1.TestFile.FourPages;
|
|
71
|
+
// Create temp folder
|
|
72
|
+
var cRequest = new model_1.CreateFolderRequest("temp");
|
|
73
|
+
yield TestContext.getFolderApi().createFolder(cRequest);
|
|
74
|
+
// Copy file
|
|
75
|
+
var destPath = "temp/" + testFile.GetPath();
|
|
76
|
+
var request = new model_1.CopyFileRequest(testFile.GetPath(), destPath);
|
|
77
|
+
yield TestContext.getFileApi().copyFile(request);
|
|
78
|
+
// Check copied file
|
|
79
|
+
var eRequest = new model_1.ObjectExistsRequest(destPath);
|
|
80
|
+
var eResponse = yield TestContext.getStorageApi().objectExists(eRequest);
|
|
81
|
+
(0, chai_1.expect)(eResponse.exists).equals(true);
|
|
82
|
+
// Move file
|
|
83
|
+
var newDestPath = "temp/" + testFile.GetPath().replace("four-pages", "four-pages_1");
|
|
84
|
+
var mRequest = new model_1.MoveFileRequest(destPath, newDestPath);
|
|
85
|
+
yield TestContext.getFileApi().moveFile(mRequest);
|
|
86
|
+
// Check moved file
|
|
87
|
+
eRequest = new model_1.ObjectExistsRequest(newDestPath);
|
|
88
|
+
eResponse = yield TestContext.getStorageApi().objectExists(eRequest);
|
|
89
|
+
(0, chai_1.expect)(eResponse.exists).equals(true);
|
|
90
|
+
// Delete temp folder
|
|
91
|
+
var delRequest = new model_1.DeleteFolderRequest("temp", undefined, true);
|
|
92
|
+
yield TestContext.getFolderApi().deleteFolder(delRequest);
|
|
93
|
+
}));
|
|
94
|
+
});
|
|
95
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "mocha";
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
+
const chai_1 = require("chai");
|
|
36
|
+
require("mocha");
|
|
37
|
+
const model_1 = require("../../src/model");
|
|
38
|
+
const TestContext = require("../test_context");
|
|
39
|
+
describe("folder_api", () => {
|
|
40
|
+
before(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
+
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = "0";
|
|
42
|
+
yield TestContext.uploadTestFiles();
|
|
43
|
+
}));
|
|
44
|
+
afterEach(function () {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
yield TestContext.cleanupTempFiles();
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
describe("test_folder_api", () => {
|
|
50
|
+
it("TestGetFilesList", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
+
var request = new model_1.GetFilesListRequest("words");
|
|
52
|
+
var response = yield TestContext.getFolderApi().getFilesList(request);
|
|
53
|
+
(0, chai_1.expect)(response.value.length).greaterThan(0);
|
|
54
|
+
}));
|
|
55
|
+
it("TestCopyMoveFolder", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
56
|
+
// Create temp folder
|
|
57
|
+
var cRequest = new model_1.CreateFolderRequest("temp");
|
|
58
|
+
yield TestContext.getFolderApi().createFolder(cRequest);
|
|
59
|
+
// Copy folder
|
|
60
|
+
var copyRequest = new model_1.CopyFolderRequest("temp", "temp1");
|
|
61
|
+
yield TestContext.getFolderApi().copyFolder(copyRequest);
|
|
62
|
+
// Check copied folder
|
|
63
|
+
var eRequest = new model_1.ObjectExistsRequest("temp1");
|
|
64
|
+
var eResponse = yield TestContext.getStorageApi().objectExists(eRequest);
|
|
65
|
+
(0, chai_1.expect)(eResponse.exists).equals(true);
|
|
66
|
+
(0, chai_1.expect)(eResponse.isFolder).equals(true);
|
|
67
|
+
// Copy folder
|
|
68
|
+
var moveRequest = new model_1.MoveFolderRequest("temp1", "temp2");
|
|
69
|
+
yield TestContext.getFolderApi().moveFolder(moveRequest);
|
|
70
|
+
// Check moved folder
|
|
71
|
+
eRequest = new model_1.ObjectExistsRequest("temp1");
|
|
72
|
+
eResponse = yield TestContext.getStorageApi().objectExists(eRequest);
|
|
73
|
+
(0, chai_1.expect)(eResponse.exists).equals(false);
|
|
74
|
+
eRequest = new model_1.ObjectExistsRequest("temp2");
|
|
75
|
+
eResponse = yield TestContext.getStorageApi().objectExists(eRequest);
|
|
76
|
+
(0, chai_1.expect)(eResponse.exists).equals(true);
|
|
77
|
+
// Delete temp and temp2 folders
|
|
78
|
+
var delRequest = new model_1.DeleteFolderRequest("temp", undefined, true);
|
|
79
|
+
yield TestContext.getFolderApi().deleteFolder(delRequest);
|
|
80
|
+
delRequest = new model_1.DeleteFolderRequest("temp2", undefined, true);
|
|
81
|
+
yield TestContext.getFolderApi().deleteFolder(delRequest);
|
|
82
|
+
}));
|
|
83
|
+
});
|
|
84
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "mocha";
|
|
@@ -0,0 +1,60 @@
|
|
|
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
|
+
const chai_1 = require("chai");
|
|
36
|
+
require("mocha");
|
|
37
|
+
const TestContext = require("../test_context");
|
|
38
|
+
describe("formats_api", () => {
|
|
39
|
+
before(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
+
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = "0";
|
|
41
|
+
yield TestContext.uploadTestFiles();
|
|
42
|
+
}));
|
|
43
|
+
afterEach(function () {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
yield TestContext.cleanupTempFiles();
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
describe("test_get_supported_file_formats", () => {
|
|
49
|
+
it("should return list of supported formats", () => {
|
|
50
|
+
const infoApi = TestContext.getInfoApi();
|
|
51
|
+
return infoApi.getSupportedFileFormats()
|
|
52
|
+
.then((result) => {
|
|
53
|
+
for (const format of result.formats) {
|
|
54
|
+
(0, chai_1.expect)(format.fileFormat).to.not.equal("");
|
|
55
|
+
(0, chai_1.expect)(format.extension).to.not.equal("");
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "mocha";
|