@esri/solution-common 1.3.1 → 1.3.4
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/esm/resources/convert-item-resource-to-storage-resource.d.ts +4 -2
- package/dist/esm/resources/convert-item-resource-to-storage-resource.js +24 -2
- package/dist/esm/resources/convert-item-resource-to-storage-resource.js.map +1 -1
- package/dist/node/resources/convert-item-resource-to-storage-resource.d.ts +4 -2
- package/dist/node/resources/convert-item-resource-to-storage-resource.js +24 -2
- package/dist/node/resources/convert-item-resource-to-storage-resource.js.map +1 -1
- package/dist/umd/common.umd.js +53 -32
- package/dist/umd/common.umd.js.map +1 -1
- package/dist/umd/common.umd.min.js +3 -3
- package/dist/umd/common.umd.min.js.map +1 -1
- package/dist/umd/resources/convert-item-resource-to-storage-resource.d.ts +4 -2
- package/package.json +2 -2
|
@@ -13,18 +13,20 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { SolutionResourceType } from "./solution-resource";
|
|
16
17
|
/**
|
|
17
18
|
* Generates a folder and filename for storing a copy of an item's resource in a storage item.
|
|
18
19
|
*
|
|
19
20
|
* @param prefix Base prefix for resource
|
|
20
|
-
* @param storageVersion Version of the Solution template
|
|
21
21
|
* @param sourceResourceFilename Either filename or folder/filename to resource
|
|
22
|
+
* @param storageVersion Version of the Solution template
|
|
23
|
+
* @param storageFileType Optional argument that when supplied will control the how the prefix is created
|
|
22
24
|
* @return Folder and filename for storage; folder is the itemID plus ("_" + storageFolder) if storageFolder
|
|
23
25
|
* exists plus ("_" + part of sourceResourceFilename before "/" if that separator exists);
|
|
24
26
|
* file is sourceResourceFilename
|
|
25
27
|
* @see convertStorageResourceToItemResource
|
|
26
28
|
*/
|
|
27
|
-
export declare function convertItemResourceToStorageResource(prefix: string, sourceResourceFilename: string, storageVersion?: number): {
|
|
29
|
+
export declare function convertItemResourceToStorageResource(prefix: string, sourceResourceFilename: string, storageVersion?: number, storageFileType?: SolutionResourceType): {
|
|
28
30
|
folder: string;
|
|
29
31
|
filename: string;
|
|
30
32
|
};
|
|
@@ -13,18 +13,40 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { SolutionResourceType } from "./solution-resource";
|
|
16
17
|
/**
|
|
17
18
|
* Generates a folder and filename for storing a copy of an item's resource in a storage item.
|
|
18
19
|
*
|
|
19
20
|
* @param prefix Base prefix for resource
|
|
20
|
-
* @param storageVersion Version of the Solution template
|
|
21
21
|
* @param sourceResourceFilename Either filename or folder/filename to resource
|
|
22
|
+
* @param storageVersion Version of the Solution template
|
|
23
|
+
* @param storageFileType Optional argument that when supplied will control the how the prefix is created
|
|
22
24
|
* @return Folder and filename for storage; folder is the itemID plus ("_" + storageFolder) if storageFolder
|
|
23
25
|
* exists plus ("_" + part of sourceResourceFilename before "/" if that separator exists);
|
|
24
26
|
* file is sourceResourceFilename
|
|
25
27
|
* @see convertStorageResourceToItemResource
|
|
26
28
|
*/
|
|
27
|
-
export function convertItemResourceToStorageResource(prefix, sourceResourceFilename, storageVersion = 0) {
|
|
29
|
+
export function convertItemResourceToStorageResource(prefix, sourceResourceFilename, storageVersion = 0, storageFileType) {
|
|
30
|
+
/* istanbul ignore else */
|
|
31
|
+
if (storageFileType !== undefined) {
|
|
32
|
+
switch (storageFileType) {
|
|
33
|
+
case SolutionResourceType.data:
|
|
34
|
+
prefix = `${prefix}_info_data`;
|
|
35
|
+
break;
|
|
36
|
+
case SolutionResourceType.fakezip:
|
|
37
|
+
prefix = `${prefix}_info_dataz`;
|
|
38
|
+
break;
|
|
39
|
+
case SolutionResourceType.info:
|
|
40
|
+
prefix = `${prefix}_info`;
|
|
41
|
+
break;
|
|
42
|
+
case SolutionResourceType.metadata:
|
|
43
|
+
prefix = `${prefix}_info_metadata`;
|
|
44
|
+
break;
|
|
45
|
+
case SolutionResourceType.thumbnail:
|
|
46
|
+
prefix = `${prefix}_info_thumbnail`;
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
28
50
|
let folder = prefix;
|
|
29
51
|
let filename = sourceResourceFilename;
|
|
30
52
|
const iLastSlash = filename.lastIndexOf("/");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-item-resource-to-storage-resource.js","sourceRoot":"","sources":["../../../src/resources/convert-item-resource-to-storage-resource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH
|
|
1
|
+
{"version":3,"file":"convert-item-resource-to-storage-resource.js","sourceRoot":"","sources":["../../../src/resources/convert-item-resource-to-storage-resource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,oCAAoC,CAClD,MAAc,EACd,sBAA8B,EAC9B,cAAc,GAAG,CAAC,EAClB,eAAsC;IAKtC,0BAA0B;IAC1B,IAAI,eAAe,KAAK,SAAS,EAAE;QACjC,QAAQ,eAAe,EAAE;YACvB,KAAK,oBAAoB,CAAC,IAAI;gBAC5B,MAAM,GAAG,GAAG,MAAM,YAAY,CAAC;gBAC/B,MAAM;YACR,KAAK,oBAAoB,CAAC,OAAO;gBAC/B,MAAM,GAAG,GAAG,MAAM,aAAa,CAAC;gBAChC,MAAM;YACR,KAAK,oBAAoB,CAAC,IAAI;gBAC5B,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC;gBAC1B,MAAM;YACR,KAAK,oBAAoB,CAAC,QAAQ;gBAChC,MAAM,GAAG,GAAG,MAAM,gBAAgB,CAAC;gBACnC,MAAM;YACR,KAAK,oBAAoB,CAAC,SAAS;gBACjC,MAAM,GAAG,GAAG,MAAM,iBAAiB,CAAC;gBACpC,MAAM;SACT;KACF;IAED,IAAI,MAAM,GAAG,MAAM,CAAC;IACpB,IAAI,QAAQ,GAAG,sBAAsB,CAAC;IACtC,MAAM,UAAU,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC7C,IAAI,UAAU,IAAI,CAAC,EAAE;QACnB,IAAI,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;QAC7C,IAAI,cAAc,KAAK,CAAC,EAAE;YACxB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;YACpC,MAAM,IAAI,GAAG,GAAG,OAAO,CAAC;SACzB;aAAM;YACL,MAAM,IAAI,GAAG,GAAG,OAAO,CAAC;SACzB;QACD,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;KAC5C;IAED,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -13,18 +13,20 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { SolutionResourceType } from "./solution-resource";
|
|
16
17
|
/**
|
|
17
18
|
* Generates a folder and filename for storing a copy of an item's resource in a storage item.
|
|
18
19
|
*
|
|
19
20
|
* @param prefix Base prefix for resource
|
|
20
|
-
* @param storageVersion Version of the Solution template
|
|
21
21
|
* @param sourceResourceFilename Either filename or folder/filename to resource
|
|
22
|
+
* @param storageVersion Version of the Solution template
|
|
23
|
+
* @param storageFileType Optional argument that when supplied will control the how the prefix is created
|
|
22
24
|
* @return Folder and filename for storage; folder is the itemID plus ("_" + storageFolder) if storageFolder
|
|
23
25
|
* exists plus ("_" + part of sourceResourceFilename before "/" if that separator exists);
|
|
24
26
|
* file is sourceResourceFilename
|
|
25
27
|
* @see convertStorageResourceToItemResource
|
|
26
28
|
*/
|
|
27
|
-
export declare function convertItemResourceToStorageResource(prefix: string, sourceResourceFilename: string, storageVersion?: number): {
|
|
29
|
+
export declare function convertItemResourceToStorageResource(prefix: string, sourceResourceFilename: string, storageVersion?: number, storageFileType?: SolutionResourceType): {
|
|
28
30
|
folder: string;
|
|
29
31
|
filename: string;
|
|
30
32
|
};
|
|
@@ -16,18 +16,40 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.convertItemResourceToStorageResource = void 0;
|
|
19
|
+
const solution_resource_1 = require("./solution-resource");
|
|
19
20
|
/**
|
|
20
21
|
* Generates a folder and filename for storing a copy of an item's resource in a storage item.
|
|
21
22
|
*
|
|
22
23
|
* @param prefix Base prefix for resource
|
|
23
|
-
* @param storageVersion Version of the Solution template
|
|
24
24
|
* @param sourceResourceFilename Either filename or folder/filename to resource
|
|
25
|
+
* @param storageVersion Version of the Solution template
|
|
26
|
+
* @param storageFileType Optional argument that when supplied will control the how the prefix is created
|
|
25
27
|
* @return Folder and filename for storage; folder is the itemID plus ("_" + storageFolder) if storageFolder
|
|
26
28
|
* exists plus ("_" + part of sourceResourceFilename before "/" if that separator exists);
|
|
27
29
|
* file is sourceResourceFilename
|
|
28
30
|
* @see convertStorageResourceToItemResource
|
|
29
31
|
*/
|
|
30
|
-
function convertItemResourceToStorageResource(prefix, sourceResourceFilename, storageVersion = 0) {
|
|
32
|
+
function convertItemResourceToStorageResource(prefix, sourceResourceFilename, storageVersion = 0, storageFileType) {
|
|
33
|
+
/* istanbul ignore else */
|
|
34
|
+
if (storageFileType !== undefined) {
|
|
35
|
+
switch (storageFileType) {
|
|
36
|
+
case solution_resource_1.SolutionResourceType.data:
|
|
37
|
+
prefix = `${prefix}_info_data`;
|
|
38
|
+
break;
|
|
39
|
+
case solution_resource_1.SolutionResourceType.fakezip:
|
|
40
|
+
prefix = `${prefix}_info_dataz`;
|
|
41
|
+
break;
|
|
42
|
+
case solution_resource_1.SolutionResourceType.info:
|
|
43
|
+
prefix = `${prefix}_info`;
|
|
44
|
+
break;
|
|
45
|
+
case solution_resource_1.SolutionResourceType.metadata:
|
|
46
|
+
prefix = `${prefix}_info_metadata`;
|
|
47
|
+
break;
|
|
48
|
+
case solution_resource_1.SolutionResourceType.thumbnail:
|
|
49
|
+
prefix = `${prefix}_info_thumbnail`;
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
31
53
|
let folder = prefix;
|
|
32
54
|
let filename = sourceResourceFilename;
|
|
33
55
|
const iLastSlash = filename.lastIndexOf("/");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-item-resource-to-storage-resource.js","sourceRoot":"","sources":["../../../src/resources/convert-item-resource-to-storage-resource.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH
|
|
1
|
+
{"version":3,"file":"convert-item-resource-to-storage-resource.js","sourceRoot":"","sources":["../../../src/resources/convert-item-resource-to-storage-resource.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,2DAA2D;AAE3D;;;;;;;;;;;GAWG;AACH,SAAgB,oCAAoC,CAClD,MAAc,EACd,sBAA8B,EAC9B,cAAc,GAAG,CAAC,EAClB,eAAsC;IAKtC,0BAA0B;IAC1B,IAAI,eAAe,KAAK,SAAS,EAAE;QACjC,QAAQ,eAAe,EAAE;YACvB,KAAK,wCAAoB,CAAC,IAAI;gBAC5B,MAAM,GAAG,GAAG,MAAM,YAAY,CAAC;gBAC/B,MAAM;YACR,KAAK,wCAAoB,CAAC,OAAO;gBAC/B,MAAM,GAAG,GAAG,MAAM,aAAa,CAAC;gBAChC,MAAM;YACR,KAAK,wCAAoB,CAAC,IAAI;gBAC5B,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC;gBAC1B,MAAM;YACR,KAAK,wCAAoB,CAAC,QAAQ;gBAChC,MAAM,GAAG,GAAG,MAAM,gBAAgB,CAAC;gBACnC,MAAM;YACR,KAAK,wCAAoB,CAAC,SAAS;gBACjC,MAAM,GAAG,GAAG,MAAM,iBAAiB,CAAC;gBACpC,MAAM;SACT;KACF;IAED,IAAI,MAAM,GAAG,MAAM,CAAC;IACpB,IAAI,QAAQ,GAAG,sBAAsB,CAAC;IACtC,MAAM,UAAU,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC7C,IAAI,UAAU,IAAI,CAAC,EAAE;QACnB,IAAI,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;QAC7C,IAAI,cAAc,KAAK,CAAC,EAAE;YACxB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;YACpC,MAAM,IAAI,GAAG,GAAG,OAAO,CAAC;SACzB;aAAM;YACL,MAAM,IAAI,GAAG,GAAG,OAAO,CAAC;SACzB;QACD,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;KAC5C;IAED,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AAC9B,CAAC;AA7CD,oFA6CC"}
|
package/dist/umd/common.umd.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/solution-common - v1.3.
|
|
2
|
+
* @esri/solution-common - v1.3.4 - Apache-2.0
|
|
3
3
|
* Copyright (c) 2018-2022 Esri, Inc.
|
|
4
|
-
* Thu
|
|
4
|
+
* Thu Mar 03 2022 17:21:13 GMT-0800 (Pacific Standard Time)
|
|
5
5
|
*
|
|
6
6
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
* you may not use this file except in compliance with the License.
|
|
@@ -13605,6 +13605,34 @@
|
|
|
13605
13605
|
}
|
|
13606
13606
|
}
|
|
13607
13607
|
|
|
13608
|
+
/** @license
|
|
13609
|
+
* Copyright 2020 Esri
|
|
13610
|
+
*
|
|
13611
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13612
|
+
* you may not use this file except in compliance with the License.
|
|
13613
|
+
* You may obtain a copy of the License at
|
|
13614
|
+
*
|
|
13615
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13616
|
+
*
|
|
13617
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13618
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13619
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13620
|
+
* See the License for the specific language governing permissions and
|
|
13621
|
+
* limitations under the License.
|
|
13622
|
+
*/
|
|
13623
|
+
/**
|
|
13624
|
+
* Denotes type information for a SolutionResource
|
|
13625
|
+
*/
|
|
13626
|
+
exports.SolutionResourceType = void 0;
|
|
13627
|
+
(function (SolutionResourceType) {
|
|
13628
|
+
SolutionResourceType[SolutionResourceType["thumbnail"] = 0] = "thumbnail";
|
|
13629
|
+
SolutionResourceType[SolutionResourceType["metadata"] = 1] = "metadata";
|
|
13630
|
+
SolutionResourceType[SolutionResourceType["resource"] = 2] = "resource";
|
|
13631
|
+
SolutionResourceType[SolutionResourceType["data"] = 3] = "data";
|
|
13632
|
+
SolutionResourceType[SolutionResourceType["fakezip"] = 4] = "fakezip";
|
|
13633
|
+
SolutionResourceType[SolutionResourceType["info"] = 5] = "info";
|
|
13634
|
+
})(exports.SolutionResourceType || (exports.SolutionResourceType = {}));
|
|
13635
|
+
|
|
13608
13636
|
/** @license
|
|
13609
13637
|
* Copyright 2020 Esri
|
|
13610
13638
|
*
|
|
@@ -13624,14 +13652,35 @@
|
|
|
13624
13652
|
* Generates a folder and filename for storing a copy of an item's resource in a storage item.
|
|
13625
13653
|
*
|
|
13626
13654
|
* @param prefix Base prefix for resource
|
|
13627
|
-
* @param storageVersion Version of the Solution template
|
|
13628
13655
|
* @param sourceResourceFilename Either filename or folder/filename to resource
|
|
13656
|
+
* @param storageVersion Version of the Solution template
|
|
13657
|
+
* @param storageFileType Optional argument that when supplied will control the how the prefix is created
|
|
13629
13658
|
* @return Folder and filename for storage; folder is the itemID plus ("_" + storageFolder) if storageFolder
|
|
13630
13659
|
* exists plus ("_" + part of sourceResourceFilename before "/" if that separator exists);
|
|
13631
13660
|
* file is sourceResourceFilename
|
|
13632
13661
|
* @see convertStorageResourceToItemResource
|
|
13633
13662
|
*/
|
|
13634
|
-
function convertItemResourceToStorageResource(prefix, sourceResourceFilename, storageVersion = 0) {
|
|
13663
|
+
function convertItemResourceToStorageResource(prefix, sourceResourceFilename, storageVersion = 0, storageFileType) {
|
|
13664
|
+
/* istanbul ignore else */
|
|
13665
|
+
if (storageFileType !== undefined) {
|
|
13666
|
+
switch (storageFileType) {
|
|
13667
|
+
case exports.SolutionResourceType.data:
|
|
13668
|
+
prefix = `${prefix}_info_data`;
|
|
13669
|
+
break;
|
|
13670
|
+
case exports.SolutionResourceType.fakezip:
|
|
13671
|
+
prefix = `${prefix}_info_dataz`;
|
|
13672
|
+
break;
|
|
13673
|
+
case exports.SolutionResourceType.info:
|
|
13674
|
+
prefix = `${prefix}_info`;
|
|
13675
|
+
break;
|
|
13676
|
+
case exports.SolutionResourceType.metadata:
|
|
13677
|
+
prefix = `${prefix}_info_metadata`;
|
|
13678
|
+
break;
|
|
13679
|
+
case exports.SolutionResourceType.thumbnail:
|
|
13680
|
+
prefix = `${prefix}_info_thumbnail`;
|
|
13681
|
+
break;
|
|
13682
|
+
}
|
|
13683
|
+
}
|
|
13635
13684
|
let folder = prefix;
|
|
13636
13685
|
let filename = sourceResourceFilename;
|
|
13637
13686
|
const iLastSlash = filename.lastIndexOf("/");
|
|
@@ -14650,34 +14699,6 @@
|
|
|
14650
14699
|
});
|
|
14651
14700
|
}
|
|
14652
14701
|
|
|
14653
|
-
/** @license
|
|
14654
|
-
* Copyright 2020 Esri
|
|
14655
|
-
*
|
|
14656
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
14657
|
-
* you may not use this file except in compliance with the License.
|
|
14658
|
-
* You may obtain a copy of the License at
|
|
14659
|
-
*
|
|
14660
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14661
|
-
*
|
|
14662
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
14663
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14664
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14665
|
-
* See the License for the specific language governing permissions and
|
|
14666
|
-
* limitations under the License.
|
|
14667
|
-
*/
|
|
14668
|
-
/**
|
|
14669
|
-
* Denotes type information for a SolutionResource
|
|
14670
|
-
*/
|
|
14671
|
-
exports.SolutionResourceType = void 0;
|
|
14672
|
-
(function (SolutionResourceType) {
|
|
14673
|
-
SolutionResourceType[SolutionResourceType["thumbnail"] = 0] = "thumbnail";
|
|
14674
|
-
SolutionResourceType[SolutionResourceType["metadata"] = 1] = "metadata";
|
|
14675
|
-
SolutionResourceType[SolutionResourceType["resource"] = 2] = "resource";
|
|
14676
|
-
SolutionResourceType[SolutionResourceType["data"] = 3] = "data";
|
|
14677
|
-
SolutionResourceType[SolutionResourceType["fakezip"] = 4] = "fakezip";
|
|
14678
|
-
SolutionResourceType[SolutionResourceType["info"] = 5] = "info";
|
|
14679
|
-
})(exports.SolutionResourceType || (exports.SolutionResourceType = {}));
|
|
14680
|
-
|
|
14681
14702
|
/** @license
|
|
14682
14703
|
* Copyright 2020 Esri
|
|
14683
14704
|
*
|