@esri/solution-file 5.2.1 → 5.2.3

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/README.md CHANGED
@@ -1,16 +1,13 @@
1
1
  [![npm status][npm-img]][npm-url]
2
2
  [![Build status][travis-img]][travis-url]
3
3
  [![gzip bundle size][gzip-img]][npm-url]
4
- [![Coverage status][coverage-img]][coverage-url]
5
4
  [![Apache 2.0 licensed][license-img]][license-url]
6
5
 
7
6
  [npm-img]: https://img.shields.io/npm/v/@esri/solution-simple-types.svg?style=round-square&color=blue
8
7
  [npm-url]: https://www.npmjs.com/package/@esri/solution-simple-types
9
- [travis-img]: https://img.shields.io/travis/Esri/solution.js/develop.svg
8
+ [travis-img]: https://img.shields.io/travis/com/Esri/solution.js/develop.svg
10
9
  [travis-url]: https://travis-ci.org/Esri/solution.js
11
- [gzip-img]: https://img.badgesize.io/https://unpkg.com/@esri/solution-simple-types/dist/umd/simple-types.umd.min.js?compression=gzip
12
- [coverage-img]: https://coveralls.io/repos/github/Esri/solution.js/badge.svg
13
- [coverage-url]: https://coveralls.io/github/Esri/solution.js
10
+ [gzip-img]: https://img.badgesize.io/https://unpkg.com/@esri/solution-simple-types/dist/esm/index.js?compression=gzip
14
11
  [license-img]: https://img.shields.io/badge/license-Apache%202.0-blue.svg
15
12
  [license-url]: #license
16
13
 
@@ -18,7 +15,7 @@
18
15
 
19
16
  > Manages the creation and deployment of item types that contain files for [`@esri/solution-*`](https://github.com/Esri/solution.js).
20
17
 
21
- ### [API Reference](https://esri.github.io/solution.js/api/simple-types/)
18
+ ### [API Reference](https://esri.github.io/solution.js/modules/simple_types_src.html)
22
19
 
23
20
  ### Issues
24
21
 
@@ -36,7 +33,7 @@ Esri welcomes contributions from anyone and everyone. Please see our [guidelines
36
33
 
37
34
  ### License
38
35
 
39
- Copyright © 2018-2020 Esri
36
+ Copyright © 2018 Esri
40
37
 
41
38
  Licensed under the Apache License, Version 2.0 (the "License");
42
39
  you may not use this file except in compliance with the License.
@@ -22,11 +22,10 @@ import * as common from "@esri/solution-common";
22
22
  /**
23
23
  * Converts a file item into a template.
24
24
  *
25
- * @param solutionItemId The solution to contain the template
26
25
  * @param itemInfo Info about the item
27
26
  * @param destAuthentication Credentials for requests to the destination organization
28
27
  * @param srcAuthentication Credentials for requests to source items
29
28
  * @returns A promise that will resolve when the template has been created
30
29
  */
31
- export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: common.UserSession, srcAuthentication: common.UserSession): Promise<common.IItemTemplate>;
30
+ export declare function convertItemToTemplate(itemInfo: any, destAuthentication: common.UserSession, srcAuthentication: common.UserSession): Promise<common.IItemTemplate>;
32
31
  export declare function createItemFromTemplate(template: common.IItemTemplate, templateDictionary: any, destinationAuthentication: common.UserSession, itemProgressCallback: common.IItemProgressCallback): Promise<common.ICreateItemFromTemplateResponse>;
package/dist/esm/file.js CHANGED
@@ -23,13 +23,12 @@ import * as common from "@esri/solution-common";
23
23
  /**
24
24
  * Converts a file item into a template.
25
25
  *
26
- * @param solutionItemId The solution to contain the template
27
26
  * @param itemInfo Info about the item
28
27
  * @param destAuthentication Credentials for requests to the destination organization
29
28
  * @param srcAuthentication Credentials for requests to source items
30
29
  * @returns A promise that will resolve when the template has been created
31
30
  */
32
- export function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication) {
31
+ export function convertItemToTemplate(itemInfo, destAuthentication, srcAuthentication) {
33
32
  return new Promise(resolve => {
34
33
  // Init template
35
34
  const itemTemplate = common.createInitializedItemTemplate(itemInfo);
@@ -1 +1 @@
1
- {"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;GAIG;AAEH,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAEhD,wHAAwH;AAExH;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CACnC,cAAsB,EACtB,QAAa,EACb,kB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BACN,IAAI,EAAE,eAAe;oBACrB,EAAE,EAAE,cAAc,CAAC,EAAE;oBACrB,IAAI,EAAE,eAAe,CAAC,IAAI;oBAC1B,WAAW,EAAE,KAAK;iBACnB,CAAC,CAAC;aACJ;QACH,CAAC,EACD,GAAG,EAAE;YACH,oBAAoB,CAClB,QAAQ,CAAC,MAAM,EACf,MAAM,CAAC,mBAAmB,CAAC,MAAM,EACjC,CAAC,CACF,CAAC;YACF,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,uBAAuB;QACvF,CAAC,CACF,CAAC;IACN,CAAC,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/solution-file",
3
- "version": "5.2.1",
3
+ "version": "5.2.3",
4
4
  "description": "Manages the creation and deployment of item types that contain files for @esri/solution.js.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -23,11 +23,11 @@
23
23
  "@esri/arcgis-rest-portal": "^3.7.0",
24
24
  "@esri/arcgis-rest-request": "^3.7.0",
25
25
  "@esri/arcgis-rest-service-admin": "^3.7.0",
26
- "@esri/hub-common": "^14.74.1",
26
+ "@esri/hub-common": "^14.97.0",
27
27
  "@esri/hub-initiatives": "^14.0.0",
28
28
  "@esri/hub-sites": "^14.2.2",
29
29
  "@esri/hub-teams": "^14.1.0",
30
- "@esri/solution-common": "^5.2.1",
30
+ "@esri/solution-common": "^5.2.3",
31
31
  "@types/jasmine": "^5.1.4",
32
32
  "fetch-mock": "^7.7.3",
33
33
  "jasmine": "^5.1.0",
@@ -88,5 +88,5 @@
88
88
  "esri",
89
89
  "ES6"
90
90
  ],
91
- "gitHead": "0f2bb444de46482baa42621310bc4e8d94bcd11a"
91
+ "gitHead": "bcf0907f47cf8a2970f8da38f8e1e2a4ac7beccb"
92
92
  }
@@ -1,32 +0,0 @@
1
- /** @license
2
- * Copyright 2018 Esri
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- /**
17
- * Manages the creation and deployment of item types that contain files.
18
- *
19
- * @module file
20
- */
21
- import * as common from "@esri/solution-common";
22
- /**
23
- * Converts a file item into a template.
24
- *
25
- * @param solutionItemId The solution to contain the template
26
- * @param itemInfo Info about the item
27
- * @param destAuthentication Credentials for requests to the destination organization
28
- * @param srcAuthentication Credentials for requests to source items
29
- * @returns A promise that will resolve when the template has been created
30
- */
31
- export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: common.UserSession, srcAuthentication: common.UserSession): Promise<common.IItemTemplate>;
32
- export declare function createItemFromTemplate(template: common.IItemTemplate, templateDictionary: any, destinationAuthentication: common.UserSession, itemProgressCallback: common.IItemProgressCallback): Promise<common.ICreateItemFromTemplateResponse>;
package/dist/cjs/file.js DELETED
@@ -1,134 +0,0 @@
1
- "use strict";
2
- /** @license
3
- * Copyright 2018 Esri
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.createItemFromTemplate = exports.convertItemToTemplate = void 0;
19
- const tslib_1 = require("tslib");
20
- /**
21
- * Manages the creation and deployment of item types that contain files.
22
- *
23
- * @module file
24
- */
25
- const common = tslib_1.__importStar(require("@esri/solution-common"));
26
- // ------------------------------------------------------------------------------------------------------------------ //
27
- /**
28
- * Converts a file item into a template.
29
- *
30
- * @param solutionItemId The solution to contain the template
31
- * @param itemInfo Info about the item
32
- * @param destAuthentication Credentials for requests to the destination organization
33
- * @param srcAuthentication Credentials for requests to source items
34
- * @returns A promise that will resolve when the template has been created
35
- */
36
- function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication) {
37
- return new Promise(resolve => {
38
- // Init template
39
- const itemTemplate = common.createInitializedItemTemplate(itemInfo);
40
- // Templatize item info property values
41
- itemTemplate.item.id = common.templatizeTerm(itemTemplate.item.id, itemTemplate.item.id, ".itemId");
42
- // Request file
43
- const dataPromise = new Promise(dataResolve => {
44
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
45
- common
46
- .getItemDataAsFile(itemTemplate.itemId, itemTemplate.item.name, srcAuthentication)
47
- .then(response => {
48
- if (!response || response.size === 0) {
49
- dataResolve(null);
50
- }
51
- else {
52
- dataResolve(response);
53
- }
54
- });
55
- });
56
- // Request related items
57
- const relatedPromise = Promise.resolve({});
58
- // Errors are handled as resolved empty values; this means that there's no `reject` clause to handle, hence:
59
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
60
- Promise.all([dataPromise, relatedPromise]).then(responses => {
61
- const [itemDataResponse] = responses;
62
- if (itemDataResponse) {
63
- const resource = common.convertBlobToSupportableResource(itemDataResponse, itemTemplate.item.name);
64
- itemTemplate.properties[resource.filename] = resource.mimeType;
65
- const storageName = common.convertItemResourceToStorageResource(itemTemplate.itemId, resource.blob.name, common.SolutionTemplateFormatVersion, (resource.blob.name === resource.filename
66
- ? common.SolutionResourceType.data
67
- : common.SolutionResourceType.fakezip));
68
- // Add the data file to the template so that it can be uploaded with the other resources in the solution
69
- const dataFile = {
70
- itemId: itemTemplate.itemId,
71
- file: resource.blob,
72
- folder: storageName.folder,
73
- filename: storageName.filename
74
- };
75
- itemTemplate.dataFile = dataFile;
76
- // Update the template's resources
77
- itemTemplate.resources.push(storageName.folder + "/" + storageName.filename);
78
- resolve(itemTemplate);
79
- }
80
- else {
81
- resolve(itemTemplate);
82
- }
83
- });
84
- });
85
- }
86
- exports.convertItemToTemplate = convertItemToTemplate;
87
- function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
88
- return new Promise(resolve => {
89
- // Interrupt process if progress callback returns `false`
90
- if (!itemProgressCallback(template.itemId, common.EItemProgressStatus.Started, 0)) {
91
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Ignored, 0);
92
- resolve(common.generateEmptyCreationResponse(template.type));
93
- return;
94
- }
95
- // Replace the templatized symbols in a copy of the template
96
- let newItemTemplate = common.cloneObject(template);
97
- newItemTemplate = common.replaceInTemplate(newItemTemplate, templateDictionary);
98
- /* istanbul ignore else */
99
- if (template.item.thumbnail) {
100
- newItemTemplate.item.thumbnail = template.item.thumbnail;
101
- }
102
- // Create the item, then update its URL with its new id
103
- common
104
- .createItemWithData(newItemTemplate.item, newItemTemplate.data, destinationAuthentication, templateDictionary.folderId)
105
- .then(createResponse => {
106
- // Interrupt process if progress callback returns `false`
107
- if (!itemProgressCallback(template.itemId, common.EItemProgressStatus.Created, template.estimatedDeploymentCostFactor / 2, createResponse.id)) {
108
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Cancelled, 0);
109
- common
110
- .removeItem(createResponse.id, destinationAuthentication)
111
- .then(() => resolve(common.generateEmptyCreationResponse(template.type)), () => resolve(common.generateEmptyCreationResponse(template.type)));
112
- }
113
- else {
114
- // Add the new item to the settings
115
- newItemTemplate.itemId = createResponse.id;
116
- templateDictionary[template.itemId] = {
117
- itemId: createResponse.id
118
- };
119
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor / 2, createResponse.id);
120
- resolve({
121
- item: newItemTemplate,
122
- id: createResponse.id,
123
- type: newItemTemplate.type,
124
- postProcess: false
125
- });
126
- }
127
- }, () => {
128
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Failed, 0);
129
- resolve(common.generateEmptyCreationResponse(template.type)); // fails to create item
130
- });
131
- });
132
- }
133
- exports.createItemFromTemplate = createItemFromTemplate;
134
- //# sourceMappingURL=file.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/file.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH;;;;GAIG;AAEH,sEAAgD;AAEhD,wHAAwH;AAExH;;;;;;;;GAQG;AACH,SAAgB,qBAAqB,CACnC,cAAsB,EACtB,QAAa,EACb,kBAAsC,EACtC,iBAAqC;IAErC,OAAO,IAAI,OAAO,CAAuB,OAAO,CAAC,EAAE;QACjD,gBAAgB;QAChB,MAAM,YAAY,GAAyB,MAAM,CAAC,6BAA6B,CAC7E,QAAQ,CACT,CAAC;QAEF,uCAAuC;QACvC,YAAY,CAAC,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,cAAc,CAC1C,YAAY,CAAC,IAAI,CAAC,EAAE,EACpB,YAAY,CAAC,IAAI,CAAC,EAAE,EACpB,SAAS,CACV,CAAC;QAEF,eAAe;QACf,MAAM,WAAW,GAAG,IAAI,OAAO,CAAO,WAAW,CAAC,EAAE;YAClD,mEAAmE;YACnE,MAAM;iBACH,iBAAiB,CAChB,YAAY,CAAC,MAAM,EACnB,YAAY,CAAC,IAAI,CAAC,IAAI,EACtB,iBAAiB,CAClB;iBACA,IAAI,CAAC,QAAQ,CAAC,EAAE;gBACf,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,IAAI,KAAK,CAAC,EAAE;oBACpC,WAAW,CAAC,IAAI,CAAC,CAAC;iBACnB;qBAAM;oBACL,WAAW,CAAC,QAAQ,CAAC,CAAC;iBACvB;YACH,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;QAEH,wBAAwB;QACxB,MAAM,cAAc,GAAG,OAAO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apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- /**
17
- * Manages the creation and deployment of item types that contain files.
18
- *
19
- * @module file
20
- */
21
- export * from "./file";
package/dist/cjs/index.js DELETED
@@ -1,25 +0,0 @@
1
- "use strict";
2
- /** @license
3
- * Copyright 2018 Esri
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- const tslib_1 = require("tslib");
19
- /**
20
- * Manages the creation and deployment of item types that contain files.
21
- *
22
- * @module file
23
- */
24
- tslib_1.__exportStar(require("./file"), exports);
25
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;;;GAIG;AAEH,iDAAuB"}