@esri/hub-common 14.26.1 → 14.27.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 (133) hide show
  1. package/dist/esm/core/EntityEditor.js +4 -0
  2. package/dist/esm/core/EntityEditor.js.map +1 -1
  3. package/dist/esm/core/fetchHubEntity.js +4 -0
  4. package/dist/esm/core/fetchHubEntity.js.map +1 -1
  5. package/dist/esm/core/getTypeFromEntity.js +3 -0
  6. package/dist/esm/core/getTypeFromEntity.js.map +1 -1
  7. package/dist/esm/core/schemas/internal/getEntityEditorSchemas.js +10 -0
  8. package/dist/esm/core/schemas/internal/getEntityEditorSchemas.js.map +1 -1
  9. package/dist/esm/core/schemas/types.js +2 -0
  10. package/dist/esm/core/schemas/types.js.map +1 -1
  11. package/dist/esm/core/types/HubEntityType.js +1 -0
  12. package/dist/esm/core/types/HubEntityType.js.map +1 -1
  13. package/dist/esm/core/types/IHubTemplate.js +1 -0
  14. package/dist/esm/core/types/IHubTemplate.js.map +1 -0
  15. package/dist/esm/core/types/index.js +1 -0
  16. package/dist/esm/core/types/index.js.map +1 -1
  17. package/dist/esm/core/updateHubEntity.js +4 -0
  18. package/dist/esm/core/updateHubEntity.js.map +1 -1
  19. package/dist/esm/discussions/api/types.js.map +1 -1
  20. package/dist/esm/index.js +1 -0
  21. package/dist/esm/index.js.map +1 -1
  22. package/dist/esm/permissions/HubPermissionPolicies.js +2 -0
  23. package/dist/esm/permissions/HubPermissionPolicies.js.map +1 -1
  24. package/dist/esm/permissions/types/Permission.js +2 -0
  25. package/dist/esm/permissions/types/Permission.js.map +1 -1
  26. package/dist/esm/search/_internal/portalSearchItems.js +4 -0
  27. package/dist/esm/search/_internal/portalSearchItems.js.map +1 -1
  28. package/dist/esm/templates/HubTemplate.js +178 -0
  29. package/dist/esm/templates/HubTemplate.js.map +1 -0
  30. package/dist/esm/templates/_internal/TemplateBusinessRules.js +82 -0
  31. package/dist/esm/templates/_internal/TemplateBusinessRules.js.map +1 -0
  32. package/dist/esm/templates/_internal/TemplateSchema.js +8 -0
  33. package/dist/esm/templates/_internal/TemplateSchema.js.map +1 -0
  34. package/dist/esm/templates/_internal/TemplateUiSchemaEdit.js +97 -0
  35. package/dist/esm/templates/_internal/TemplateUiSchemaEdit.js.map +1 -0
  36. package/dist/esm/templates/_internal/computeLinks.js +26 -0
  37. package/dist/esm/templates/_internal/computeLinks.js.map +1 -0
  38. package/dist/esm/templates/_internal/computeProps.js +36 -0
  39. package/dist/esm/templates/_internal/computeProps.js.map +1 -0
  40. package/dist/esm/templates/_internal/getPropertyMap.js +14 -0
  41. package/dist/esm/templates/_internal/getPropertyMap.js.map +1 -0
  42. package/dist/esm/templates/defaults.js +40 -0
  43. package/dist/esm/templates/defaults.js.map +1 -0
  44. package/dist/esm/templates/edit.js +76 -0
  45. package/dist/esm/templates/edit.js.map +1 -0
  46. package/dist/esm/templates/fetch.js +108 -0
  47. package/dist/esm/templates/fetch.js.map +1 -0
  48. package/dist/esm/templates/index.js +5 -0
  49. package/dist/esm/templates/index.js.map +1 -0
  50. package/dist/esm/templates/utils.js +37 -0
  51. package/dist/esm/templates/utils.js.map +1 -0
  52. package/dist/esm/templates/view.js +81 -0
  53. package/dist/esm/templates/view.js.map +1 -0
  54. package/dist/esm/urls/getCardModelUrl.js +11 -11
  55. package/dist/esm/urls/getCardModelUrl.js.map +1 -1
  56. package/dist/node/core/EntityEditor.js +4 -0
  57. package/dist/node/core/EntityEditor.js.map +1 -1
  58. package/dist/node/core/fetchHubEntity.js +6 -2
  59. package/dist/node/core/fetchHubEntity.js.map +1 -1
  60. package/dist/node/core/getTypeFromEntity.js +3 -0
  61. package/dist/node/core/getTypeFromEntity.js.map +1 -1
  62. package/dist/node/core/schemas/internal/getEntityEditorSchemas.js +10 -0
  63. package/dist/node/core/schemas/internal/getEntityEditorSchemas.js.map +1 -1
  64. package/dist/node/core/schemas/types.js +2 -0
  65. package/dist/node/core/schemas/types.js.map +1 -1
  66. package/dist/node/core/types/HubEntityType.js +1 -0
  67. package/dist/node/core/types/HubEntityType.js.map +1 -1
  68. package/dist/node/core/types/IHubTemplate.js +3 -0
  69. package/dist/node/core/types/IHubTemplate.js.map +1 -0
  70. package/dist/node/core/types/index.js +1 -0
  71. package/dist/node/core/types/index.js.map +1 -1
  72. package/dist/node/core/updateHubEntity.js +4 -0
  73. package/dist/node/core/updateHubEntity.js.map +1 -1
  74. package/dist/node/discussions/api/types.js.map +1 -1
  75. package/dist/node/index.js +1 -0
  76. package/dist/node/index.js.map +1 -1
  77. package/dist/node/permissions/HubPermissionPolicies.js +2 -0
  78. package/dist/node/permissions/HubPermissionPolicies.js.map +1 -1
  79. package/dist/node/permissions/types/Permission.js +2 -0
  80. package/dist/node/permissions/types/Permission.js.map +1 -1
  81. package/dist/node/search/_internal/portalSearchItems.js +4 -0
  82. package/dist/node/search/_internal/portalSearchItems.js.map +1 -1
  83. package/dist/node/templates/HubTemplate.js +182 -0
  84. package/dist/node/templates/HubTemplate.js.map +1 -0
  85. package/dist/node/templates/_internal/TemplateBusinessRules.js +85 -0
  86. package/dist/node/templates/_internal/TemplateBusinessRules.js.map +1 -0
  87. package/dist/node/templates/_internal/TemplateSchema.js +11 -0
  88. package/dist/node/templates/_internal/TemplateSchema.js.map +1 -0
  89. package/dist/node/templates/_internal/TemplateUiSchemaEdit.js +100 -0
  90. package/dist/node/templates/_internal/TemplateUiSchemaEdit.js.map +1 -0
  91. package/dist/node/templates/_internal/computeLinks.js +30 -0
  92. package/dist/node/templates/_internal/computeLinks.js.map +1 -0
  93. package/dist/node/templates/_internal/computeProps.js +40 -0
  94. package/dist/node/templates/_internal/computeProps.js.map +1 -0
  95. package/dist/node/templates/_internal/getPropertyMap.js +18 -0
  96. package/dist/node/templates/_internal/getPropertyMap.js.map +1 -0
  97. package/dist/node/templates/defaults.js +43 -0
  98. package/dist/node/templates/defaults.js.map +1 -0
  99. package/dist/node/templates/edit.js +83 -0
  100. package/dist/node/templates/edit.js.map +1 -0
  101. package/dist/node/templates/fetch.js +114 -0
  102. package/dist/node/templates/fetch.js.map +1 -0
  103. package/dist/node/templates/index.js +8 -0
  104. package/dist/node/templates/index.js.map +1 -0
  105. package/dist/node/templates/utils.js +40 -0
  106. package/dist/node/templates/utils.js.map +1 -0
  107. package/dist/node/templates/view.js +84 -0
  108. package/dist/node/templates/view.js.map +1 -0
  109. package/dist/node/urls/getCardModelUrl.js +11 -11
  110. package/dist/node/urls/getCardModelUrl.js.map +1 -1
  111. package/dist/types/core/schemas/types.d.ts +1 -1
  112. package/dist/types/core/types/HubEntity.d.ts +2 -1
  113. package/dist/types/core/types/HubEntityType.d.ts +1 -1
  114. package/dist/types/core/types/IHubTemplate.d.ts +13 -0
  115. package/dist/types/core/types/index.d.ts +1 -0
  116. package/dist/types/discussions/api/types.d.ts +3 -1
  117. package/dist/types/index.d.ts +1 -0
  118. package/dist/types/permissions/types/Permission.d.ts +2 -1
  119. package/dist/types/templates/HubTemplate.d.ts +79 -0
  120. package/dist/types/templates/_internal/TemplateBusinessRules.d.ts +17 -0
  121. package/dist/types/templates/_internal/TemplateSchema.d.ts +4 -0
  122. package/dist/types/templates/_internal/TemplateUiSchemaEdit.d.ts +15 -0
  123. package/dist/types/templates/_internal/computeLinks.d.ts +11 -0
  124. package/dist/types/templates/_internal/computeProps.d.ts +13 -0
  125. package/dist/types/templates/_internal/getPropertyMap.d.ts +8 -0
  126. package/dist/types/templates/defaults.d.ts +14 -0
  127. package/dist/types/templates/edit.d.ts +37 -0
  128. package/dist/types/templates/fetch.d.ts +28 -0
  129. package/dist/types/templates/index.d.ts +4 -0
  130. package/dist/types/templates/utils.d.ts +13 -0
  131. package/dist/types/templates/view.d.ts +19 -0
  132. package/dist/types/urls/getCardModelUrl.d.ts +4 -2
  133. package/package.json +1 -1
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.enrichTemplateSearchResult = exports.convertItemToTemplate = exports.fetchTemplate = void 0;
4
+ const utils_1 = require("../utils");
5
+ const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
6
+ const slugs_1 = require("../items/slugs");
7
+ const models_1 = require("../models");
8
+ const PropertyMapper_1 = require("../core/_internal/PropertyMapper");
9
+ const getPropertyMap_1 = require("./_internal/getPropertyMap");
10
+ const computeProps_1 = require("./_internal/computeProps");
11
+ const get_family_1 = require("../content/get-family");
12
+ const util_1 = require("../util");
13
+ const parseInclude_1 = require("../search/_internal/parseInclude");
14
+ const _enrichments_1 = require("../items/_enrichments");
15
+ const objects_1 = require("../objects");
16
+ const computeLinks_1 = require("./_internal/computeLinks");
17
+ const utils_2 = require("./utils");
18
+ /**
19
+ * @private
20
+ * Fetch a Hub Template backing item by id or slug
21
+ * @param identifier item id or slug
22
+ * @param requestOptions
23
+ */
24
+ async function fetchTemplate(identifier, requestOptions) {
25
+ let getPrms;
26
+ if (utils_1.isGuid(identifier)) {
27
+ getPrms = arcgis_rest_portal_1.getItem(identifier, requestOptions);
28
+ }
29
+ else {
30
+ getPrms = slugs_1.getItemBySlug(identifier, requestOptions);
31
+ }
32
+ return getPrms.then((item) => {
33
+ if (!item)
34
+ return null;
35
+ return convertItemToTemplate(item, requestOptions);
36
+ });
37
+ }
38
+ exports.fetchTemplate = fetchTemplate;
39
+ /**
40
+ * @private
41
+ * Convert a Solution Item into a Hub Template, fetching
42
+ * any additional information that may be required
43
+ * @param item
44
+ * @param auth
45
+ */
46
+ async function convertItemToTemplate(item, requestOptions) {
47
+ const model = await models_1.fetchModelFromItem(item, requestOptions);
48
+ // 1. Create a property mapper between the the template
49
+ // object and item model
50
+ const mapper = new PropertyMapper_1.PropertyMapper(getPropertyMap_1.getPropertyMap());
51
+ // 2. Map the item into an IHubTemplate
52
+ const template = mapper.storeToEntity(model, {});
53
+ // 3. Compute + set various properties on the IHubTemplate
54
+ // that cannot be directly mapped from the item
55
+ return computeProps_1.computeProps(model, template, requestOptions);
56
+ }
57
+ exports.convertItemToTemplate = convertItemToTemplate;
58
+ /**
59
+ * @private
60
+ * Fetch template specific enrichments
61
+ * @param item
62
+ * @param include
63
+ * @param requestOptions
64
+ */
65
+ async function enrichTemplateSearchResult(item, include, requestOptions) {
66
+ const result = {
67
+ access: item.access,
68
+ id: item.id,
69
+ type: item.type,
70
+ name: item.title,
71
+ owner: item.owner,
72
+ typeKeywords: item.typeKeywords,
73
+ tags: item.tags,
74
+ categories: item.categories,
75
+ summary: item.snippet || item.description,
76
+ createdDate: new Date(item.created),
77
+ createdDateSource: "item.created",
78
+ updatedDate: new Date(item.modified),
79
+ updatedDateSource: "item.modified",
80
+ family: get_family_1.getFamily(item.type),
81
+ links: {
82
+ self: "not-implemented",
83
+ siteRelative: "not-implemented",
84
+ thumbnail: "not-implemented",
85
+ workspaceRelative: "not-implemented",
86
+ },
87
+ };
88
+ // 1. optionally enrich the template item with
89
+ // well-known item enrichments
90
+ const DEFAULTS = [];
91
+ // merge default and provided "include" enrichments
92
+ include = [...DEFAULTS, ...include].filter(util_1.unique);
93
+ // Parse the includes into a valid set of enrichments
94
+ const specs = include.map(parseInclude_1.parseInclude);
95
+ // Extract out the low-level enrichments needed
96
+ const enrichments = utils_1.mapBy("enrichment", specs).filter(util_1.unique);
97
+ // fetch the enrichments
98
+ let enriched = {};
99
+ if (enrichments.length) {
100
+ enriched = await _enrichments_1.fetchItemEnrichments(item, enrichments, requestOptions);
101
+ }
102
+ // map the enriched props onto the result
103
+ specs.forEach((spec) => {
104
+ result[spec.prop] = objects_1.getProp(enriched, spec.path);
105
+ });
106
+ // 2. append relevant links onto the search result - these
107
+ // are the same links that get appended to the template entity
108
+ result.links = computeLinks_1.computeLinks(item, requestOptions);
109
+ // 3. append additional template-specific properties
110
+ result.deployedType = utils_2.getDeployedTemplateType(item);
111
+ return result;
112
+ }
113
+ exports.enrichTemplateSearchResult = enrichTemplateSearchResult;
114
+ //# sourceMappingURL=fetch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch.js","sourceR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;IAClB,IAAI,WAAW,CAAC,MAAM,EAAE;QACtB,QAAQ,GAAG,MAAM,mCAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;KAC1E;IACD,yCAAyC;IACzC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACrB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,iBAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,0DAA0D;IAC1D,8DAA8D;IAC9D,MAAM,CAAC,KAAK,GAAG,2BAAY,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAElD,oDAAoD;IACpD,MAAM,CAAC,YAAY,GAAG,+BAAuB,CAAC,IAAI,CAAC,CAAC;IAEpD,OAAO,MAAM,CAAC;AAChB,CAAC;AAvDD,gEAuDC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./HubTemplate"), exports);
5
+ tslib_1.__exportStar(require("./view"), exports);
6
+ tslib_1.__exportStar(require("./fetch"), exports);
7
+ tslib_1.__exportStar(require("./edit"), exports);
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/index.ts"],"names":[],"mappings":";;;AAAA,wDAA8B;AAC9B,iDAAuB;AACvB,kDAAwB;AACxB,iDAAuB"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDeployedTemplateType = void 0;
4
+ const utils_1 = require("../utils");
5
+ const util_1 = require("../util");
6
+ /**
7
+ * We do our best to glean what the solution template
8
+ * is supposed to become when deployed. This util
9
+ * extracts the expected item type from the
10
+ * hubSolutionType typeKeyword on the solution item
11
+ *
12
+ * We use this in various UIs to show the expected
13
+ * type rather than "Solution"
14
+ *
15
+ * @param template
16
+ */
17
+ exports.getDeployedTemplateType = (template) => {
18
+ let deployedType = "Solution";
19
+ // 1. Extract the camelCase item type from the
20
+ // hubSolutionType|<camel-case-item-type> typeKeyword
21
+ const hubSolutionTypeKeyword = template.typeKeywords.find((keyword) => keyword.startsWith("hubSolutionType|"));
22
+ // 2. Attempt to de-camelize the item type
23
+ if (hubSolutionTypeKeyword) {
24
+ const camelizedType = hubSolutionTypeKeyword.split("|")[1];
25
+ deployedType = utils_1.dasherize(camelizedType)
26
+ .split("-")
27
+ .map((str) => util_1.capitalize(str))
28
+ .join(" ");
29
+ // some item types need to be handled separately
30
+ // because they don't follow the standard pattern
31
+ const exceptionMap = {
32
+ storyMap: "StoryMap",
33
+ };
34
+ if (exceptionMap[camelizedType]) {
35
+ deployedType = exceptionMap[camelizedType];
36
+ }
37
+ }
38
+ return deployedType;
39
+ };
40
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/templates/utils.ts"],"names":[],"mappings":";;;AACA,oCAAqC;AACrC,kCAAqC;AAErC;;;;;;;;;;GAUG;AACU,QAAA,uBAAuB,GAAG,CAAC,QAAe,EAAU,EAAE;IACjE,IAAI,YAAY,GAAG,UAAU,CAAC;IAC9B,8CAA8C;IAC9C,qDAAqD;IACrD,MAAM,sBAAsB,GAAG,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,OAAe,EAAE,EAAE,CAC5E,OAAO,CAAC,UAAU,CAAC,kBAAkB,CAAC,CACvC,CAAC;IAEF,0CAA0C;IAC1C,IAAI,sBAAsB,EAAE;QAC1B,MAAM,aAAa,GAAG,sBAAsB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3D,YAAY,GAAG,iBAAS,CAAC,aAAa,CAAC;aACpC,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,iBAAU,CAAC,GAAG,CAAC,CAAC;aAC7B,IAAI,CAAC,GAAG,CAAC,CAAC;QAEb,gDAAgD;QAChD,iDAAiD;QACjD,MAAM,YAAY,GAA2B;YAC3C,QAAQ,EAAE,UAAU;SAErB,CAAC;QAEF,IAAI,YAAY,CAAC,aAAa,CAAC,EAAE;YAC/B,YAAY,GAAG,YAAY,CAAC,aAAa,CAAC,CAAC;SAC5C;KACF;IAED,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC"}
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.templateResultToCardModel = exports.templateToCardModel = void 0;
4
+ const get_family_1 = require("../content/get-family");
5
+ const internalContentUtils_1 = require("../content/_internal/internalContentUtils");
6
+ const getCardModelUrl_1 = require("../urls/getCardModelUrl");
7
+ /**
8
+ * Convert a template entity into a card view model that can
9
+ * be consumed by the suite of hub gallery components
10
+ *
11
+ * @param template template entity
12
+ * @param context auth & portal information
13
+ * @param opts view model options
14
+ */
15
+ exports.templateToCardModel = (template, context, opts) => {
16
+ const { actionLinks = [], baseUrl = "", locale = "en-US", target = "self", } = opts || {};
17
+ const titleUrl = getCardModelUrl_1.getCardModelUrlFromEntity(template, context, target, baseUrl);
18
+ return Object.assign(Object.assign(Object.assign({}, getSharedTemplateCardModel(template, locale)), { actionLinks,
19
+ titleUrl }), (template.thumbnailUrl && { thumbnailUrl: template.thumbnailUrl }));
20
+ };
21
+ /**
22
+ * Convert a template hub search result into a card view model
23
+ * that can be consumed by the suite of hub gallery components
24
+ *
25
+ * @param searchResult hub template search result
26
+ * @param opts view model options
27
+ */
28
+ exports.templateResultToCardModel = (searchResult, opts) => {
29
+ const { actionLinks = [], baseUrl = "", locale = "en-US", target = "self", } = opts || {};
30
+ const titleUrl = getCardModelUrl_1.getCardModelUrlFromResult(searchResult, target, baseUrl);
31
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, getSharedTemplateCardModel(searchResult, locale)), { actionLinks }), (!isNaN(searchResult.index) && { index: searchResult.index })), { titleUrl }), (searchResult.links.thumbnail && {
32
+ thumbnailUrl: searchResult.links.thumbnail,
33
+ }));
34
+ };
35
+ /**
36
+ * Given a template entity OR hub serach result, construct the
37
+ * template's shared card view model properties
38
+ *
39
+ * @param entityOrSearchResult template entity or hub search result
40
+ * @param locale internationalization locale
41
+ */
42
+ const getSharedTemplateCardModel = (entityOrSearchResult, locale) => {
43
+ var _a, _b;
44
+ const additionalInfo = [
45
+ {
46
+ i18nKey: "type",
47
+ value: entityOrSearchResult.type,
48
+ },
49
+ {
50
+ i18nKey: "dateUpdated",
51
+ value: entityOrSearchResult.updatedDate.toLocaleDateString(locale),
52
+ },
53
+ ...(((_a = entityOrSearchResult.tags) === null || _a === void 0 ? void 0 : _a.length) ? [
54
+ {
55
+ i18nKey: "tags",
56
+ value: entityOrSearchResult.tags.join(", "),
57
+ },
58
+ ]
59
+ : []),
60
+ ...(((_b = entityOrSearchResult.categories) === null || _b === void 0 ? void 0 : _b.length) ? [
61
+ {
62
+ i18nKey: "categories",
63
+ value: internalContentUtils_1.getShortenedCategories(entityOrSearchResult.categories).join(", "),
64
+ },
65
+ ]
66
+ : []),
67
+ {
68
+ i18nKey: "dateCreated",
69
+ value: entityOrSearchResult.createdDate.toLocaleDateString(locale),
70
+ },
71
+ ];
72
+ return {
73
+ access: entityOrSearchResult.access,
74
+ badges: [],
75
+ id: entityOrSearchResult.id,
76
+ family: get_family_1.getFamily(entityOrSearchResult.type),
77
+ source: entityOrSearchResult.owner,
78
+ summary: entityOrSearchResult.summary,
79
+ title: entityOrSearchResult.name,
80
+ type: entityOrSearchResult.type,
81
+ additionalInfo,
82
+ };
83
+ };
84
+ //# sourceMappingURL=view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view.js","sourceRoot":"","sources":["../../../src/templates/view.ts"],"names":[],"mappings":";;;AAEA,sDAAkD;AAElD,oFAAmF;AACnF,6DAGiC;AAQjC;;;;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,GAAG;QACrB;YACE,OAAO,EAAE,MAAM;YACf,KAAK,EAAE,oBAAoB,CAAC,IAAI;SACjC;QACD;YACE,OAAO,EAAE,aAAa;YACtB,KAAK,EAAE,oBAAoB,CAAC,WAAW,CAAC,kBAAkB,CAAC,MAAM,CAAC;SACnE;QACD,GAAG,CAAC,OAAA,oBAAoB,CAAC,IAAI,0CAAE,MAAM,EACnC,CAAC,CAAC;YACE;gBACE,OAAO,EAAE,MAAM;gBACf,KAAK,EAAE,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;aAC5C;SACF;YACH,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,OAAA,oBAAoB,CAAC,UAAU,0CAAE,MAAM,EACzC,CAAC,CAAC;YACE;gBACE,OAAO,EAAE,YAAY;gBACrB,KAAK,EAAE,6CAAsB,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC,IAAI,CACjE,IAAI,CACL;aACF;SACF;YACH,CAAC,CAAC,EAAE,CAAC;QACP;YACE,OAAO,EAAE,aAAa;YACtB,KAAK,EAAE,oBAAoB,CAAC,WAAW,CAAC,kBAAkB,CAAC,MAAM,CAAC;SACnE;KACF,CAAC;IAEF,OAAO;QACL,MAAM,EAAE,oBAAoB,CAAC,MAAM;QACnC,MAAM,EAAE,EAAE;QACV,EAAE,EAAE,oBAAoB,CAAC,EAAE;QAC3B,MAAM,EAAE,sBAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC;QAC5C,MAAM,EAAE,oBAAoB,CAAC,KAAK;QAClC,OAAO,EAAE,oBAAoB,CAAC,OAAO;QACrC,KAAK,EAAE,oBAAoB,CAAC,IAAI;QAChC,IAAI,EAAE,oBAAoB,CAAC,IAAI;QAC/B,cAAc;KACf,CAAC;AACJ,CAAC,CAAC"}
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getCardModelUrlFromEntity = exports.getCardModelUrlFromResult = void 0;
4
- const getRelativeWorkspaceUrl_1 = require("../core/getRelativeWorkspaceUrl");
5
- const internalContentUtils_1 = require("../content/_internal/internalContentUtils");
6
- const get_item_home_url_1 = require("./get-item-home-url");
7
4
  /**
8
- * returns a gallery card's title url from a hub search result
5
+ * given a target and hub search result, this util
6
+ * returns a gallery card's title url
9
7
  *
10
8
  * @param result hub search result
11
9
  * @param target context the card should redirect to
@@ -42,7 +40,8 @@ function getCardModelUrlFromResult(result, target, baseUrl) {
42
40
  }
43
41
  exports.getCardModelUrlFromResult = getCardModelUrlFromResult;
44
42
  /**
45
- * returns a gallery card's title url from an entity
43
+ * given a target and hub entity, this util
44
+ * returns a gallery card's title url
46
45
  *
47
46
  * @param entity hub entity
48
47
  * @param context auth & portal information
@@ -50,6 +49,7 @@ exports.getCardModelUrlFromResult = getCardModelUrlFromResult;
50
49
  * @param baseUrl base url to work in conjunction with the target
51
50
  */
52
51
  function getCardModelUrlFromEntity(entity, context, target, baseUrl) {
52
+ var _a, _b, _c, _d, _e, _f;
53
53
  let titleUrl;
54
54
  if (target === "event") {
55
55
  titleUrl = "#";
@@ -61,17 +61,17 @@ function getCardModelUrlFromEntity(entity, context, target, baseUrl) {
61
61
  switch (entity.type) {
62
62
  default:
63
63
  titleUrl = {
64
- self: get_item_home_url_1.getItemHomeUrl(entity.id, context.hubRequestOptions),
64
+ self: (_a = entity.links) === null || _a === void 0 ? void 0 : _a.self,
65
65
  siteRelative: baseUrl
66
- ? `${baseUrl}${internalContentUtils_1.getHubRelativeUrl(entity.type, entity.id)}`
67
- : internalContentUtils_1.getHubRelativeUrl(entity.type, entity.id),
66
+ ? `${baseUrl}${((_b = entity.links) === null || _b === void 0 ? void 0 : _b.siteRelative) || ""}`
67
+ : (_c = entity.links) === null || _c === void 0 ? void 0 : _c.siteRelative,
68
68
  workspaceRelative: baseUrl
69
- ? `${baseUrl}${getRelativeWorkspaceUrl_1.getRelativeWorkspaceUrl(entity.type, entity.id)}`
70
- : getRelativeWorkspaceUrl_1.getRelativeWorkspaceUrl(entity.type, entity.id),
69
+ ? `${baseUrl}${((_d = entity.links) === null || _d === void 0 ? void 0 : _d.workspaceRelative) || ""}`
70
+ : (_e = entity.links) === null || _e === void 0 ? void 0 : _e.workspaceRelative,
71
71
  }[target];
72
72
  break;
73
73
  case "Hub Site Application":
74
- titleUrl = get_item_home_url_1.getItemHomeUrl(entity.id, context.hubRequestOptions);
74
+ titleUrl = (_f = entity.links) === null || _f === void 0 ? void 0 : _f.self;
75
75
  break;
76
76
  }
77
77
  }
@@ -1 +1 @@
1
- {"version":3,"file":"getCardModelUrl.js","sourceRoot":"","sources":["../../../src/urls/getCardModelUrl.ts"],"names":[],"mappings":";;;AACA,6EAA0E;AAC1E,oFAA8E;AAI9E,2DAAqD;AAErD;;;;;;GAMG;AACH,SAAgB,yBAAyB,CACvC,MAAwB,EACxB,MAAuB,EACvB,OAAgB;;IAEhB,IAAI,QAAQ,CAAC;IAEb,IAAI,MAAM,KAAK,OAAO,EAAE;QACtB,QAAQ,GAAG,GAAG,CAAC;KAChB;SAAM,IAAI,MAAM,KAAK,MAAM,EAAE;QAC5B,QAAQ,GAAG,SAAS,CAAC;KACtB;SAAM;QACL,QAAQ,MAAM,CAAC,IAAI,EAAE;YACnB;gBACE,QAAQ,GAAG;oBACT,IAAI,QAAE,MAAM,CAAC,KAAK,0CAAE,IAAI;oBACxB,YAAY,EAAE,OAAO;wBACnB,CAAC,CAAC,GAAG,OAAO,GAAG,OAAA,MAAM,CAAC,KAAK,0CAAE,YAAY,KAAI,EAAE,EAAE;wBACjD,CAAC,OAAC,MAAM,CAAC,KAAK,0CAAE,YAAY;oBAC9B,iBAAiB,EAAE,OAAO;wBACxB,CAAC,CAAC,GAAG,OAAO,GAAG,OAAA,MAAM,CAAC,KAAK,0CAAE,iBAAiB,KAAI,EAAE,EAAE;wBACtD,CAAC,OAAC,MAAM,CAAC,KAAK,0CAAE,iBAAiB;iBACpC,CAAC,MAAM,CAAC,CAAC;gBACV,MAAM;Y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,QAAQ,GAAG,SAAS,CAAC;KACtB;SAAM;QACL,QAAQ,MAAM,CAAC,IAAI,EAAE;YACnB;gBACE,QAAQ,GAAG;oBACT,IAAI,QAAE,MAAM,CAAC,KAAK,0CAAE,IAAI;oBACxB,YAAY,EAAE,OAAO;wBACnB,CAAC,CAAC,GAAG,OAAO,GAAG,OAAA,MAAM,CAAC,KAAK,0CAAE,YAAY,KAAI,EAAE,EAAE;wBACjD,CAAC,OAAC,MAAM,CAAC,KAAK,0CAAE,YAAY;oBAC9B,iBAAiB,EAAE,OAAO;wBACxB,CAAC,CAAC,GAAG,OAAO,GAAG,OAAA,MAAM,CAAC,KAAK,0CAAE,iBAAiB,KAAI,EAAE,EAAE;wBACtD,CAAC,OAAC,MAAM,CAAC,KAAK,0CAAE,iBAAiB;iBACpC,CAAC,MAAM,CAAC,CAAC;gBACV,MAAM;YACR,KAAK,sBAAsB;gBACzB,QAAQ,SAAG,MAAM,CAAC,KAAK,0CAAE,IAAI,CAAC;gBAC9B,MAAM;SACT;KACF;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAhCD,8DAgCC"}
@@ -5,7 +5,7 @@ import Ajv from "ajv";
5
5
  * to the supported/defined uiSchema configurations
6
6
  */
7
7
  export declare type EditorType = (typeof validEditorTypes)[number];
8
- export declare const validEditorTypes: readonly ["hub:project:create", "hub:project:edit", "hub:content:edit", "hub:content:settings", "hub:content:discussions", "hub:initiative:edit", "hub:initiative:create", "hub:site:edit", "hub:site:create", "hub:site:followers", "hub:site:discussions", "hub:discussion:edit", "hub:discussion:create", "hub:discussion:settings", "hub:page:edit", "hub:group:edit", "hub:group:settings", "hub:group:discussions", "hub:initiativeTemplate:edit"];
8
+ export declare const validEditorTypes: readonly ["hub:project:create", "hub:project:edit", "hub:content:edit", "hub:content:settings", "hub:content:discussions", "hub:initiative:edit", "hub:initiative:create", "hub:site:edit", "hub:site:create", "hub:site:followers", "hub:site:discussions", "hub:discussion:edit", "hub:discussion:create", "hub:discussion:settings", "hub:page:edit", "hub:template:edit", "hub:group:edit", "hub:group:settings", "hub:group:discussions", "hub:initiativeTemplate:edit"];
9
9
  export declare enum UiSchemaRuleEffects {
10
10
  SHOW = "SHOW",
11
11
  HIDE = "HIDE",
@@ -4,4 +4,5 @@ import { IHubProject } from "./IHubProject";
4
4
  import { IHubSite } from "./IHubSite";
5
5
  import { IHubDiscussion } from "./IHubDiscussion";
6
6
  import { IHubGroup } from "./IHubGroup";
7
- export declare type HubEntity = IHubSite | IHubProject | IHubDiscussion | IHubInitiative | IHubPage | IHubGroup;
7
+ import { IHubTemplate } from "./IHubTemplate";
8
+ export declare type HubEntity = IHubSite | IHubProject | IHubDiscussion | IHubInitiative | IHubPage | IHubGroup | IHubTemplate;
@@ -1,2 +1,2 @@
1
- export declare const HUB_ENTITY_TYPES: readonly ["site", "project", "initiative", "initiativeTemplate", "page", "discussion", "content", "org", "group"];
1
+ export declare const HUB_ENTITY_TYPES: readonly ["site", "project", "initiative", "initiativeTemplate", "page", "discussion", "content", "org", "group", "template"];
2
2
  export declare type HubEntityType = (typeof HUB_ENTITY_TYPES)[number];
@@ -0,0 +1,13 @@
1
+ import { IWithSlug } from "../traits";
2
+ import { IHubItemEntity, IHubItemEntityEditor } from "./IHubItemEntity";
3
+ /** Defines the properties of a Hub Template entity */
4
+ export interface IHubTemplate extends IHubItemEntity, IWithSlug {
5
+ previewUrl: string;
6
+ isDeployed: boolean;
7
+ deployedType: string;
8
+ }
9
+ /**
10
+ * This type redefines the IHubTemplate interface in such a way
11
+ * that it can be consumed by the entity editor.
12
+ */
13
+ export declare type IHubTemplateEditor = IHubItemEntityEditor<IHubTemplate> & {};
@@ -17,6 +17,7 @@ export * from "./IHubLayout";
17
17
  export * from "./IHubLocation";
18
18
  export * from "./IHubPage";
19
19
  export * from "./IHubProject";
20
+ export * from "./IHubTemplate";
20
21
  export * from "./IHubSite";
21
22
  export * from "./IHubSiteTheme";
22
23
  export * from "./IHubTimeline";
@@ -803,8 +803,10 @@ export interface IFetchChannel {
803
803
  * @extends {Partial<IWithSorting<ChannelSort>>}
804
804
  * @extends {Partial<IWithTimeQueries>}
805
805
  * @extends {Partial<IWithFiltering<ChannelFilter>>}
806
+ * @extends {Partial<IWithAuthor>}
807
+ * @extends {Partial<IWithEditor>}
806
808
  */
807
- export interface ISearchChannels extends Partial<IPagingParams>, Partial<IWithSorting<ChannelSort>>, Partial<IWithTimeQueries>, Partial<IWithFiltering<ChannelFilter>> {
809
+ export interface ISearchChannels extends Partial<IPagingParams>, Partial<IWithSorting<ChannelSort>>, Partial<IWithTimeQueries>, Partial<IWithFiltering<ChannelFilter>>, Partial<IWithAuthor>, Partial<IWithEditor> {
808
810
  groups?: string[];
809
811
  access?: SharingAccess[];
810
812
  relations?: ChannelRelation[];
@@ -26,6 +26,7 @@ export * from "./resources";
26
26
  export * from "./search";
27
27
  export * from "./sites";
28
28
  export * from "./surveys";
29
+ export * from "./templates";
29
30
  export * from "./types";
30
31
  export * from "./urls";
31
32
  export * from "./users";
@@ -7,6 +7,7 @@ import { GroupPermissions } from "../../groups/_internal/GroupBusinessRules";
7
7
  import { PagePermissions } from "../../pages/_internal/PageBusinessRules";
8
8
  import { PlatformPermissions } from "../PlatformPermissionPolicies";
9
9
  import { InitiativeTemplatePermissions } from "../../initiative-templates/_internal/InitiativeTemplateBusinessRules";
10
+ import { TemplatePermissions } from "../../templates/_internal/TemplateBusinessRules";
10
11
  /**
11
12
  * Defines the values for Permissions
12
13
  * It's critical that the arrays defined in the modules use `as const`
@@ -16,7 +17,7 @@ declare const TempPermissions: string[];
16
17
  /**
17
18
  * Defines the possible values for Permissions
18
19
  */
19
- export declare type Permission = (typeof SitePermissions)[number] | (typeof ProjectPermissions)[number] | (typeof InitiativePermissions)[number] | (typeof ContentPermissions)[number] | (typeof GroupPermissions)[number] | (typeof PagePermissions)[number] | (typeof PlatformPermissions)[number] | (typeof TempPermissions)[number] | (typeof DiscussionPermissions)[number] | (typeof InitiativeTemplatePermissions)[number];
20
+ export declare type Permission = (typeof SitePermissions)[number] | (typeof ProjectPermissions)[number] | (typeof InitiativePermissions)[number] | (typeof ContentPermissions)[number] | (typeof GroupPermissions)[number] | (typeof PagePermissions)[number] | (typeof PlatformPermissions)[number] | (typeof TempPermissions)[number] | (typeof DiscussionPermissions)[number] | (typeof InitiativeTemplatePermissions)[number] | (typeof TemplatePermissions)[number];
20
21
  /**
21
22
  * Validate a Permission
22
23
  * @param permission
@@ -0,0 +1,79 @@
1
+ import { IArcGISContext } from "../ArcGISContext";
2
+ import { IEditorConfig } from "../core/behaviors/IWithEditorBehavior";
3
+ import { HubItemEntity } from "../core/HubItemEntity";
4
+ import { IHubTemplate, IHubTemplateEditor } from "../core/types/IHubTemplate";
5
+ import { TemplateEditorType } from "./_internal/TemplateSchema";
6
+ import { IEntityEditorContext } from "../core/types";
7
+ /**
8
+ * Hub Template Class - this class encapsulates the standard
9
+ * operations for a "Solution" item despite the Hub team not
10
+ * "owning" this item type. Our primary goal is to allow
11
+ * editing of the item's meta information, manage sharing, etc.
12
+ */
13
+ export declare class HubTemplate extends HubItemEntity<IHubTemplate> {
14
+ /**
15
+ * Private constructor to allow for future
16
+ * template-specific logic
17
+ * @param template
18
+ * @param context
19
+ */
20
+ private constructor();
21
+ /**
22
+ * Create an HubTemplate instance from an IHubTemplate object
23
+ * @param json - JSON object to create a HubTemplate from
24
+ * @param context - ArcGIS context
25
+ * @returns
26
+ */
27
+ static fromJson(json: Partial<IHubTemplate>, context: IArcGISContext): HubTemplate;
28
+ /**
29
+ * Create a new HubTemplate, returning a HubTemplate instance.
30
+ * This does not automatically persist the Template into
31
+ * the backing store unless save is set to true
32
+ *
33
+ * NOTE: we have no immediate plans to allow template creation
34
+ * from the context of the Hub application, but scaffolding this
35
+ * method for potential future implementation. The underlying
36
+ * createTemplate function will throw an error if attempted.
37
+ * @param partialTemplate
38
+ * @param context
39
+ * @param save
40
+ */
41
+ static create(partialTemplate: Partial<IHubTemplate>, context: IArcGISContext, save?: boolean): Promise<HubTemplate>;
42
+ /**
43
+ * Fetch a HubTemplate from the backing store and return
44
+ * a HubTemplate instance
45
+ * @param identifier
46
+ * @param context
47
+ */
48
+ static fetch(identifier: string, context: IArcGISContext): Promise<HubTemplate>;
49
+ /**
50
+ * Given a partial Template, apply defaults to
51
+ * it to ensure that a baseline of properties are set
52
+ * @param partialTemplate
53
+ * @param context
54
+ */
55
+ private static applyDefaults;
56
+ getEditorConfig(i18nScope: string, type: TemplateEditorType): Promise<IEditorConfig>;
57
+ /**
58
+ * Transform template entity into an editor object
59
+ * @param editorContext
60
+ */
61
+ toEditor(editorContext?: IEntityEditorContext, include?: string[]): Promise<IHubTemplateEditor>;
62
+ /**
63
+ * Transform editor values into a template entity
64
+ * @param editor
65
+ */
66
+ fromEditor(editor: IHubTemplateEditor): Promise<IHubTemplate>;
67
+ /**
68
+ * Update the instance's internal entity state
69
+ * @param changes
70
+ */
71
+ update(changes: Partial<IHubTemplate>): void;
72
+ /** Save the HubTemplate to the backing store */
73
+ save(): Promise<void>;
74
+ /**
75
+ * Delete the Hub Template's backing item and set a flag
76
+ * indicating it's been destroyed
77
+ */
78
+ delete(): Promise<void>;
79
+ }
@@ -0,0 +1,17 @@
1
+ import { IFeatureFlags, IPermissionPolicy } from "../../permissions/types";
2
+ /**
3
+ * Default features for a Template. These are the features
4
+ * that can be enabled / disabled by the entity owner
5
+ */
6
+ export declare const TemplateDefaultFeatures: IFeatureFlags;
7
+ /**
8
+ * @private
9
+ * Template permissions: these define the requirements
10
+ * any user must meet to perform related actions
11
+ */
12
+ export declare const TemplatePermissions: readonly ["hub:template", "hub:template:create", "hub:template:delete", "hub:template:edit", "hub:template:manage", "hub:template:view", "hub:template:workspace:overview", "hub:template:workspace:details", "hub:template:workspace:dashboard", "hub:template:workspace:collaborators", "hub:template:workspace:settings"];
13
+ /**
14
+ * @private
15
+ * Template permission policies
16
+ */
17
+ export declare const TemplatePermissionPolicies: IPermissionPolicy[];
@@ -0,0 +1,4 @@
1
+ import { IConfigurationSchema } from "../../core";
2
+ export declare type TemplateEditorType = (typeof TemplateEditorTypes)[number];
3
+ export declare const TemplateEditorTypes: readonly ["hub:template:edit"];
4
+ export declare const TemplateSchema: IConfigurationSchema;
@@ -0,0 +1,15 @@
1
+ import { IArcGISContext } from "../../ArcGISContext";
2
+ import { IUiSchema } from "../../core/schemas/types";
3
+ import { IHubTemplate } from "../../core/types/IHubTemplate";
4
+ /**
5
+ * @private
6
+ * constructs the complete edit uiSchema for Hub Templates.
7
+ * This defines how the schema properties should be rendered
8
+ * in the template editing experience.
9
+ *
10
+ * @param i18nScope
11
+ * @param entity
12
+ * @param context
13
+ * @returns
14
+ */
15
+ export declare const buildUiSchema: (i18nScope: string, entity: IHubTemplate, context: IArcGISContext) => Promise<IUiSchema>;
@@ -0,0 +1,11 @@
1
+ import { IItem } from "@esri/arcgis-rest-types";
2
+ import { IRequestOptions } from "@esri/arcgis-rest-request";
3
+ import { IHubEntityLinks } from "../../core/types";
4
+ /**
5
+ * Compute the links that get appended to a Hub Template
6
+ * search result and entity
7
+ *
8
+ * @param item
9
+ * @param requestOptions
10
+ */
11
+ export declare function computeLinks(item: IItem, requestOptions: IRequestOptions): IHubEntityLinks;
@@ -0,0 +1,13 @@
1
+ import { IRequestOptions } from "@esri/arcgis-rest-request";
2
+ import { IModel } from "../../types";
3
+ import { IHubTemplate } from "../../core/types/IHubTemplate";
4
+ /**
5
+ * @private
6
+ * Given a model and a template, set various computed
7
+ * properties on the template that can't be directly
8
+ * mapped from the model
9
+ * @param model
10
+ * @param template
11
+ * @param requestOptions
12
+ */
13
+ export declare function computeProps(model: IModel, template: Partial<IHubTemplate>, requestOptions: IRequestOptions): IHubTemplate;
@@ -0,0 +1,8 @@
1
+ import { IPropertyMap } from "../../core/_internal/PropertyMapper";
2
+ /**
3
+ * @private
4
+ * Returns an Array of IPropertyMap objects that
5
+ * define the projection of properties from an
6
+ * IModel to an IHubTemplate
7
+ */
8
+ export declare function getPropertyMap(): IPropertyMap[];
@@ -0,0 +1,14 @@
1
+ import { IHubTemplate } from "../core/types/IHubTemplate";
2
+ import { IModel } from "../types";
3
+ /**
4
+ * NOTE: this file provides default values for new
5
+ * Hub Template creation; however, we have no immediate
6
+ * plans to allow template creation from the context of
7
+ * our application. Scaffolding these defaults for
8
+ * potential future implementation
9
+ */
10
+ export declare const HUB_TEMPLATE_ITEM_TYPE = "Solution";
11
+ /** Default values for a new IHubTemplate */
12
+ export declare const DEFAULT_TEMPLATE: Partial<IHubTemplate>;
13
+ /** Default values for a new HubTemplate Model (backing item) */
14
+ export declare const DEFAULT_TEMPLATE_MODEL: IModel;
@@ -0,0 +1,37 @@
1
+ import { IUserRequestOptions } from "@esri/arcgis-rest-auth";
2
+ import { IHubTemplate, IHubTemplateEditor } from "../core/types/IHubTemplate";
3
+ import { IPortal } from "@esri/arcgis-rest-portal";
4
+ /**
5
+ * @private
6
+ * Creates a Hub Template's backing Solution item and returns
7
+ * the created entity
8
+ *
9
+ * NOTE: We have no immediate plans to allow template creation
10
+ * from the context of the Hub application, but scaffolding
11
+ * this util for potential future implementation. For now,
12
+ * we will throw an error
13
+ * @param partialTemplate
14
+ * @param requestOptions
15
+ */
16
+ export declare function createTemplate(partialTemplate: Partial<IHubTemplate>, requestOptions: IUserRequestOptions): Promise<IHubTemplate>;
17
+ /**
18
+ * @private
19
+ * Updates a Hub Template's backing item and returns
20
+ * the updated entity
21
+ * @param template
22
+ * @param requestOptions
23
+ */
24
+ export declare function updateTemplate(template: IHubTemplate, requestOptions: IUserRequestOptions): Promise<IHubTemplate>;
25
+ /**
26
+ * Convert an IHubTemplateEditor back into a IHubTemplate
27
+ * @param editor
28
+ * @param portal
29
+ */
30
+ export declare function editorToTemplate(editor: IHubTemplateEditor, portal: IPortal): IHubTemplate;
31
+ /**
32
+ * @private
33
+ * Remove a Hub Template's backing item
34
+ * @param id
35
+ * @param requestOptions
36
+ */
37
+ export declare function deleteTemplate(id: string, requestOptions: IUserRequestOptions): Promise<void>;