@esri/solution-common 1.1.4 → 1.3.1

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 (60) hide show
  1. package/dist/esm/generalHelpers.d.ts +12 -1
  2. package/dist/esm/generalHelpers.js +22 -0
  3. package/dist/esm/generalHelpers.js.map +1 -1
  4. package/dist/esm/interfaces.d.ts +32 -1
  5. package/dist/esm/interfaces.js.map +1 -1
  6. package/dist/esm/migrations/upgrade-two-dot-five.js +13 -4
  7. package/dist/esm/migrations/upgrade-two-dot-five.js.map +1 -1
  8. package/dist/esm/restHelpers.d.ts +58 -5
  9. package/dist/esm/restHelpers.js +145 -9
  10. package/dist/esm/restHelpers.js.map +1 -1
  11. package/dist/esm/restHelpersGet.js +1 -1
  12. package/dist/esm/restHelpersGet.js.map +1 -1
  13. package/dist/esm/templatization.js +3 -0
  14. package/dist/esm/templatization.js.map +1 -1
  15. package/dist/node/completeItem.js +3 -2
  16. package/dist/node/completeItem.js.map +1 -1
  17. package/dist/node/deleteHelpers/deleteGroupIfEmpty.js +2 -1
  18. package/dist/node/deleteHelpers/deleteGroupIfEmpty.js.map +1 -1
  19. package/dist/node/deleteHelpers/deleteSolutionContents.js +6 -5
  20. package/dist/node/deleteHelpers/deleteSolutionContents.js.map +1 -1
  21. package/dist/node/deleteHelpers/deleteSolutionFolder.js +2 -1
  22. package/dist/node/deleteHelpers/deleteSolutionFolder.js.map +1 -1
  23. package/dist/node/deleteHelpers/deleteSolutionItem.js +3 -2
  24. package/dist/node/deleteHelpers/deleteSolutionItem.js.map +1 -1
  25. package/dist/node/deleteHelpers/reconstructBuildOrderIds.js +2 -1
  26. package/dist/node/deleteHelpers/reconstructBuildOrderIds.js.map +1 -1
  27. package/dist/node/deleteHelpers/removeItems.js +5 -4
  28. package/dist/node/deleteHelpers/removeItems.js.map +1 -1
  29. package/dist/node/deleteSolution.js +3 -2
  30. package/dist/node/deleteSolution.js.map +1 -1
  31. package/dist/node/generalHelpers.d.ts +12 -1
  32. package/dist/node/generalHelpers.js +24 -1
  33. package/dist/node/generalHelpers.js.map +1 -1
  34. package/dist/node/getDeletableSolutionInfo.js +3 -2
  35. package/dist/node/getDeletableSolutionInfo.js.map +1 -1
  36. package/dist/node/getSolutionSummary.js +4 -3
  37. package/dist/node/getSolutionSummary.js.map +1 -1
  38. package/dist/node/interfaces.d.ts +32 -1
  39. package/dist/node/interfaces.js.map +1 -1
  40. package/dist/node/libConnectors.js +2 -1
  41. package/dist/node/libConnectors.js.map +1 -1
  42. package/dist/node/migrations/upgrade-two-dot-five.js +13 -4
  43. package/dist/node/migrations/upgrade-two-dot-five.js.map +1 -1
  44. package/dist/node/resources/copyAssociatedFiles.js +2 -1
  45. package/dist/node/resources/copyAssociatedFiles.js.map +1 -1
  46. package/dist/node/restHelpers.d.ts +58 -5
  47. package/dist/node/restHelpers.js +152 -10
  48. package/dist/node/restHelpers.js.map +1 -1
  49. package/dist/node/restHelpersGet.js +1 -1
  50. package/dist/node/restHelpersGet.js.map +1 -1
  51. package/dist/node/templatization.js +3 -0
  52. package/dist/node/templatization.js.map +1 -1
  53. package/dist/umd/common.umd.js +319 -128
  54. package/dist/umd/common.umd.js.map +1 -1
  55. package/dist/umd/common.umd.min.js +4 -4
  56. package/dist/umd/common.umd.min.js.map +1 -1
  57. package/dist/umd/generalHelpers.d.ts +12 -1
  58. package/dist/umd/interfaces.d.ts +32 -1
  59. package/dist/umd/restHelpers.d.ts +58 -5
  60. package/package.json +23 -23
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { ICreateItemFromTemplateResponse, IDatasourceInfo, IItemTemplate } from "./interfaces";
16
+ import { ICreateItemFromTemplateResponse, IDatasourceInfo, IItemTemplate, IStringValuePair } from "./interfaces";
17
17
  import { Sanitizer } from "./libConnectors";
18
18
  /**
19
19
  * Returns a URL with a query parameter appended
@@ -222,6 +222,17 @@ export declare function getProp(obj: {
222
222
  * @return Array of the values plucked from the object; only defined values are returned
223
223
  */
224
224
  export declare function getProps(obj: any, props: string[]): any;
225
+ /**
226
+ * Get a property out of a deeply nested object
227
+ * Does not handle anything but nested object graph
228
+ *
229
+ * @param obj Object to retrieve value from
230
+ * @param path Path into an object, e.g., "data.values.webmap", where "data" is a top-level property
231
+ * in obj
232
+ * @param defaultV Optional value to use if any part of path--including final value--is undefined
233
+ * @return Value at end of path
234
+ */
235
+ export declare function getPropWithDefault(obj: IStringValuePair, path: string, defaultV?: any): any;
225
236
  /**
226
237
  * Updates a list of the items dependencies if more are found in the
227
238
  * provided value.
@@ -431,7 +431,7 @@ export interface IItemTemplate {
431
431
  * Function signatures for use in a function lookup array.
432
432
  */
433
433
  export interface IItemTemplateConversions {
434
- convertItemToTemplate(solutionItemId: string, itemInfo: any, authentication: UserSession, templateDictionary?: any): Promise<IItemTemplate>;
434
+ convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: UserSession, srcAuthentication: UserSession, templateDictionary?: any): Promise<IItemTemplate>;
435
435
  createItemFromTemplate(template: IItemTemplate, templateDictionary: any, destinationAuthentication: UserSession, itemProgressCallback: IItemProgressCallback): Promise<ICreateItemFromTemplateResponse>;
436
436
  postProcessDependencies?(templates: IItemTemplate[], clonedSolutionsResponse: ICreateItemFromTemplateResponse[], authentication: UserSession, templateDictionary: any): Promise<any>;
437
437
  }
@@ -439,6 +439,9 @@ export interface IItemTemplateConversions {
439
439
  * Structure for mapping from item type to module with type-specific template-handling code
440
440
  */
441
441
  export declare type moduleHandler = IItemTemplateConversions | undefined | null;
442
+ /**
443
+ * Mapping from an AGO item type to the code handling that type.
444
+ */
442
445
  export interface IItemTypeModuleMap {
443
446
  [itemType: string]: moduleHandler;
444
447
  }
@@ -450,9 +453,15 @@ export interface IItemUpdate {
450
453
  */
451
454
  [key: string]: any;
452
455
  }
456
+ /**
457
+ * Type with key access to lists of strings
458
+ */
453
459
  export interface IKeyedListsOfStrings {
454
460
  [key: string]: string[];
455
461
  }
462
+ /**
463
+ * Type with key access to strings
464
+ */
456
465
  export interface IMimeTypes {
457
466
  [key: string]: string;
458
467
  }
@@ -510,10 +519,16 @@ export interface IQuickCaptureDatasource {
510
519
  */
511
520
  url: number;
512
521
  }
522
+ /**
523
+ * A mapping between a relationship type and the list of item ids using that relationship.
524
+ */
513
525
  export interface IRelatedItems {
514
526
  relationshipType: string;
515
527
  relatedItemIds: string[];
516
528
  }
529
+ /**
530
+ * Summary of a resource.
531
+ */
517
532
  export interface IResource {
518
533
  resource: string;
519
534
  created: number;
@@ -583,6 +598,9 @@ export interface ISolutionProgressEvent {
583
598
  */
584
599
  data?: any;
585
600
  }
601
+ /**
602
+ * Information about a resource to be copied into an item.
603
+ */
586
604
  export interface ISourceFile {
587
605
  /**
588
606
  * The portal item id, e.g., "4efe5f693de34620934787ead6693f19", that supplies the resource
@@ -796,6 +814,9 @@ export interface ISurvey123CreateResult {
796
814
  */
797
815
  export interface IZipCopyResults extends IZipInfo, ICopyResults {
798
816
  }
817
+ /**
818
+ * Information about a zipped file.
819
+ */
799
820
  export interface IZipInfo {
800
821
  /**
801
822
  * Zip's filename
@@ -810,3 +831,13 @@ export interface IZipInfo {
810
831
  */
811
832
  filelist: any[];
812
833
  }
834
+ export interface IVelocityTitle {
835
+ /**
836
+ * The current label for the object
837
+ */
838
+ label: string;
839
+ /**
840
+ * Existing titles that have been used in the org
841
+ */
842
+ titles: string[];
843
+ }
@@ -14,17 +14,17 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { IAddFolderResponse, IAddGroupResponse, IAdditionalSearchOptions, ICreateItemResponse, ICreateServiceResult, IDependency, IExtent, IFeatureServiceProperties, IFolderStatusResponse, IGroup, IGroupAdd, IItem, IItemTemplate, IItemUpdate, IPostProcessArgs, IRelatedItems, ISpatialReference, IStatusResponse, ItemRelationshipType, IUpdate, IUpdateItemResponse, UserSession } from "./interfaces";
17
+ import { IUserSessionOptions } from "@esri/arcgis-rest-auth";
17
18
  import { IPagingParams, ISearchOptions, ISearchResult, SearchQueryBuilder } from "@esri/arcgis-rest-portal";
18
19
  import { IParams } from "@esri/arcgis-rest-request";
19
20
  export { request as rest_request } from "@esri/arcgis-rest-request";
20
21
  /**
21
- * Searches for items matching a query and that the caller has access to.
22
+ * Creates a UserSession via a function so that the global arcgisSolution variable can access authentication.
22
23
  *
23
- * @param search Search string (e.g., "q=redlands+map")
24
- * @return Promise resolving with search results
25
- * @see https://developers.arcgis.com/rest/users-groups-and-items/search.htm
24
+ * @param options See https://esri.github.io/arcgis-rest-js/api/auth/IUserSessionOptions/
25
+ * @return UserSession
26
26
  */
27
- export declare function searchItems(search: string | ISearchOptions | SearchQueryBuilder): Promise<ISearchResult<IItem>>;
27
+ export declare function getUserSession(options?: IUserSessionOptions): UserSession;
28
28
  /**
29
29
  * Adds a forward relationship between two items.
30
30
  *
@@ -76,6 +76,13 @@ export declare function addToServiceDefinition(url: string, options: any, skipRe
76
76
  * @return A promise that will resolve when the request has completed
77
77
  */
78
78
  export declare function checkRequestStatus(result: any, authentication: any): Promise<void>;
79
+ /**
80
+ * Converts a general search into an ISearchOptions structure.
81
+ *
82
+ * @param search Search specified in one of three ways
83
+ * @return Recast search
84
+ */
85
+ export declare function convertToISearchOptions(search: string | ISearchOptions | SearchQueryBuilder): ISearchOptions;
79
86
  /**
80
87
  * Simple validate function to ensure all coordinates are numbers
81
88
  * In some cases orgs can have null or undefined coordinate values associated with the org extent
@@ -300,6 +307,23 @@ export declare function removeItem(itemId: string, authentication: UserSession):
300
307
  * @return A promise that will resolve with the result of the request
301
308
  */
302
309
  export declare function removeItemOrGroup(itemId: string, authentication: UserSession): Promise<IStatusResponse>;
310
+ /**
311
+ * Searches for items matching a query and that the caller has access to.
312
+ *
313
+ * @param search Search string (e.g., "q=redlands+map") or a more detailed structure that can include authentication
314
+ * @return Promise resolving with search results
315
+ * @see https://developers.arcgis.com/rest/users-groups-and-items/search.htm
316
+ */
317
+ export declare function searchItems(search: string | ISearchOptions | SearchQueryBuilder): Promise<ISearchResult<IItem>>;
318
+ /**
319
+ * Searches for items matching a query and that the caller has access to, continuing recursively until done.
320
+ *
321
+ * @param search Search string (e.g., "q=redlands+map") or a more detailed structure that can include authentication
322
+ * @param accumulatedResponse Response built from previous requests
323
+ * @return Promise resolving with search results
324
+ * @see https://developers.arcgis.com/rest/users-groups-and-items/search.htm
325
+ */
326
+ export declare function searchAllItems(search: string | ISearchOptions | SearchQueryBuilder, accumulatedResponse?: ISearchResult<IItem>): Promise<ISearchResult<IItem>>;
303
327
  /**
304
328
  * Searches for groups matching criteria.
305
329
  *
@@ -323,6 +347,22 @@ export declare function searchGroups(searchString: string, authentication: UserS
323
347
  * @return A promise that will resolve with all groups that meet the search criteria
324
348
  */
325
349
  export declare function searchAllGroups(searchString: string, authentication: UserSession, groups?: IGroup[], inPagingParams?: IPagingParams): Promise<IGroup[]>;
350
+ /**
351
+ * Searches for group contents matching criteria recursively.
352
+ *
353
+ * @param groupId Group whose contents are to be searched
354
+ * @param searchString Text for which to search, e.g., 'redlands+map', 'type:"Web Map" -type:"Web Mapping Application"'
355
+ * @param authentication Credentials for the request to AGO
356
+ * @param additionalSearchOptions Adjustments to search, such as tranche size and categories of interest; categories
357
+ * are supplied as an array: each array element consists of one or more categories to be ORed; array elements are ANDed
358
+ * @param portalUrl Rest Url of the portal to perform the search
359
+ * @param accumulatedResponse Response built from previous requests
360
+ * @return A promise that will resolve with a structure with a tranche of results and
361
+ * describing how many items are available
362
+ * @see https://developers.arcgis.com/rest/users-groups-and-items/group-content-search.htm
363
+ * @see https://developers.arcgis.com/rest/users-groups-and-items/search-reference.htm
364
+ */
365
+ export declare function searchGroupAllContents(groupId: string, searchString: string, authentication: UserSession, additionalSearchOptions?: IAdditionalSearchOptions, portalUrl?: string, accumulatedResponse?: ISearchResult<IItem>): Promise<ISearchResult<IItem>>;
326
366
  /**
327
367
  * Searches for group contents matching criteria.
328
368
  *
@@ -383,6 +423,19 @@ export declare function shareItem(groupId: string, id: string, destinationAuthen
383
423
  * @return
384
424
  */
385
425
  export declare function updateItem(itemInfo: IItemUpdate, authentication: UserSession, folderId?: string, additionalParams?: any): Promise<IUpdateItemResponse>;
426
+ /**
427
+ * Updates a group.
428
+ *
429
+ * @param groupInfo The base info of a group; note that this content will be serialized, which doesn't work
430
+ * for binary content
431
+ * @param authentication Credentials for request
432
+ * @param additionalParams Updates that are put under the `params` property, which is not serialized
433
+ * @return A Promise that will resolve with the success/failure status of the request
434
+ */
435
+ export declare function updateGroup(groupInfo: IGroup, authentication: UserSession, additionalParams?: any): Promise<{
436
+ success: boolean;
437
+ groupId: string;
438
+ }>;
386
439
  /**
387
440
  * Updates an item.
388
441
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/solution-common",
3
- "version": "1.1.4",
3
+ "version": "1.3.1",
4
4
  "description": "Provides general helper functions for @esri/solution.js.",
5
5
  "main": "dist/node/index.js",
6
6
  "unpkg": "dist/umd/common.umd.min.js",
@@ -13,36 +13,36 @@
13
13
  "dist/**"
14
14
  ],
15
15
  "devDependencies": {
16
- "@esri/arcgis-rest-auth": "3.4.2",
17
- "@esri/arcgis-rest-feature-layer": "3.4.2",
18
- "@esri/arcgis-rest-portal": "3.4.2",
19
- "@esri/arcgis-rest-request": "3.4.2",
20
- "@esri/arcgis-rest-service-admin": "3.4.2",
21
- "@esri/hub-common": "9.2.0",
22
- "@esri/hub-initiatives": "9.2.0",
23
- "@esri/hub-sites": "9.2.0",
24
- "@esri/hub-teams": "9.2.0",
16
+ "@esri/arcgis-rest-auth": "3.4.3",
17
+ "@esri/arcgis-rest-feature-layer": "3.4.3",
18
+ "@esri/arcgis-rest-portal": "3.4.3",
19
+ "@esri/arcgis-rest-request": "3.4.3",
20
+ "@esri/arcgis-rest-service-admin": "3.4.3",
21
+ "@esri/hub-common": "9.15.0",
22
+ "@esri/hub-initiatives": "9.15.0",
23
+ "@esri/hub-sites": "9.15.0",
24
+ "@esri/hub-teams": "9.15.0",
25
25
  "@types/adlib": "^3.0.1",
26
- "rollup": "^1.22.0"
26
+ "rollup": "^2.60.0"
27
27
  },
28
28
  "peerDependencies": {
29
- "@esri/arcgis-rest-auth": "3.4.2",
30
- "@esri/arcgis-rest-feature-layer": "3.4.2",
31
- "@esri/arcgis-rest-portal": "3.4.2",
32
- "@esri/arcgis-rest-request": "3.4.2",
33
- "@esri/arcgis-rest-service-admin": "3.4.2",
34
- "@esri/hub-common": "9.2.0",
35
- "@esri/hub-initiatives": "9.2.0",
36
- "@esri/hub-sites": "9.2.0",
37
- "@esri/hub-teams": "9.2.0"
29
+ "@esri/arcgis-rest-auth": "3.4.3",
30
+ "@esri/arcgis-rest-feature-layer": "3.4.3",
31
+ "@esri/arcgis-rest-portal": "3.4.3",
32
+ "@esri/arcgis-rest-request": "3.4.3",
33
+ "@esri/arcgis-rest-service-admin": "3.4.3",
34
+ "@esri/hub-common": "9.15.0",
35
+ "@esri/hub-initiatives": "9.15.0",
36
+ "@esri/hub-sites": "9.15.0",
37
+ "@esri/hub-teams": "9.15.0"
38
38
  },
39
39
  "dependencies": {
40
40
  "@esri/arcgis-html-sanitizer": "2.8.0",
41
41
  "@types/lodash.isplainobject": "^4.0.6",
42
42
  "adlib": "3.0.7",
43
- "jszip": "3.7.0",
43
+ "jszip": "3.7.1",
44
44
  "lodash.isplainobject": "^4.0.6",
45
- "tslib": "^1.13.0",
45
+ "tslib": "1.13.0",
46
46
  "xss": "^1.0.6"
47
47
  },
48
48
  "scripts": {
@@ -95,5 +95,5 @@
95
95
  "esri",
96
96
  "ES6"
97
97
  ],
98
- "gitHead": "85775515ebd9e68d836d60ea1aa99ebdcde7771e"
98
+ "gitHead": "70c45e0eb9c745f7dbc0f8b6ce3654921cca11a0"
99
99
  }