@esri/hub-common 14.26.2 → 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 (130) 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/index.js +1 -0
  20. package/dist/esm/index.js.map +1 -1
  21. package/dist/esm/permissions/HubPermissionPolicies.js +2 -0
  22. package/dist/esm/permissions/HubPermissionPolicies.js.map +1 -1
  23. package/dist/esm/permissions/types/Permission.js +2 -0
  24. package/dist/esm/permissions/types/Permission.js.map +1 -1
  25. package/dist/esm/search/_internal/portalSearchItems.js +4 -0
  26. package/dist/esm/search/_internal/portalSearchItems.js.map +1 -1
  27. package/dist/esm/templates/HubTemplate.js +178 -0
  28. package/dist/esm/templates/HubTemplate.js.map +1 -0
  29. package/dist/esm/templates/_internal/TemplateBusinessRules.js +82 -0
  30. package/dist/esm/templates/_internal/TemplateBusinessRules.js.map +1 -0
  31. package/dist/esm/templates/_internal/TemplateSchema.js +8 -0
  32. package/dist/esm/templates/_internal/TemplateSchema.js.map +1 -0
  33. package/dist/esm/templates/_internal/TemplateUiSchemaEdit.js +97 -0
  34. package/dist/esm/templates/_internal/TemplateUiSchemaEdit.js.map +1 -0
  35. package/dist/esm/templates/_internal/computeLinks.js +26 -0
  36. package/dist/esm/templates/_internal/computeLinks.js.map +1 -0
  37. package/dist/esm/templates/_internal/computeProps.js +36 -0
  38. package/dist/esm/templates/_internal/computeProps.js.map +1 -0
  39. package/dist/esm/templates/_internal/getPropertyMap.js +14 -0
  40. package/dist/esm/templates/_internal/getPropertyMap.js.map +1 -0
  41. package/dist/esm/templates/defaults.js +40 -0
  42. package/dist/esm/templates/defaults.js.map +1 -0
  43. package/dist/esm/templates/edit.js +76 -0
  44. package/dist/esm/templates/edit.js.map +1 -0
  45. package/dist/esm/templates/fetch.js +108 -0
  46. package/dist/esm/templates/fetch.js.map +1 -0
  47. package/dist/esm/templates/index.js +5 -0
  48. package/dist/esm/templates/index.js.map +1 -0
  49. package/dist/esm/templates/utils.js +37 -0
  50. package/dist/esm/templates/utils.js.map +1 -0
  51. package/dist/esm/templates/view.js +81 -0
  52. package/dist/esm/templates/view.js.map +1 -0
  53. package/dist/esm/urls/getCardModelUrl.js +11 -11
  54. package/dist/esm/urls/getCardModelUrl.js.map +1 -1
  55. package/dist/node/core/EntityEditor.js +4 -0
  56. package/dist/node/core/EntityEditor.js.map +1 -1
  57. package/dist/node/core/fetchHubEntity.js +6 -2
  58. package/dist/node/core/fetchHubEntity.js.map +1 -1
  59. package/dist/node/core/getTypeFromEntity.js +3 -0
  60. package/dist/node/core/getTypeFromEntity.js.map +1 -1
  61. package/dist/node/core/schemas/internal/getEntityEditorSchemas.js +10 -0
  62. package/dist/node/core/schemas/internal/getEntityEditorSchemas.js.map +1 -1
  63. package/dist/node/core/schemas/types.js +2 -0
  64. package/dist/node/core/schemas/types.js.map +1 -1
  65. package/dist/node/core/types/HubEntityType.js +1 -0
  66. package/dist/node/core/types/HubEntityType.js.map +1 -1
  67. package/dist/node/core/types/IHubTemplate.js +3 -0
  68. package/dist/node/core/types/IHubTemplate.js.map +1 -0
  69. package/dist/node/core/types/index.js +1 -0
  70. package/dist/node/core/types/index.js.map +1 -1
  71. package/dist/node/core/updateHubEntity.js +4 -0
  72. package/dist/node/core/updateHubEntity.js.map +1 -1
  73. package/dist/node/index.js +1 -0
  74. package/dist/node/index.js.map +1 -1
  75. package/dist/node/permissions/HubPermissionPolicies.js +2 -0
  76. package/dist/node/permissions/HubPermissionPolicies.js.map +1 -1
  77. package/dist/node/permissions/types/Permission.js +2 -0
  78. package/dist/node/permissions/types/Permission.js.map +1 -1
  79. package/dist/node/search/_internal/portalSearchItems.js +4 -0
  80. package/dist/node/search/_internal/portalSearchItems.js.map +1 -1
  81. package/dist/node/templates/HubTemplate.js +182 -0
  82. package/dist/node/templates/HubTemplate.js.map +1 -0
  83. package/dist/node/templates/_internal/TemplateBusinessRules.js +85 -0
  84. package/dist/node/templates/_internal/TemplateBusinessRules.js.map +1 -0
  85. package/dist/node/templates/_internal/TemplateSchema.js +11 -0
  86. package/dist/node/templates/_internal/TemplateSchema.js.map +1 -0
  87. package/dist/node/templates/_internal/TemplateUiSchemaEdit.js +100 -0
  88. package/dist/node/templates/_internal/TemplateUiSchemaEdit.js.map +1 -0
  89. package/dist/node/templates/_internal/computeLinks.js +30 -0
  90. package/dist/node/templates/_internal/computeLinks.js.map +1 -0
  91. package/dist/node/templates/_internal/computeProps.js +40 -0
  92. package/dist/node/templates/_internal/computeProps.js.map +1 -0
  93. package/dist/node/templates/_internal/getPropertyMap.js +18 -0
  94. package/dist/node/templates/_internal/getPropertyMap.js.map +1 -0
  95. package/dist/node/templates/defaults.js +43 -0
  96. package/dist/node/templates/defaults.js.map +1 -0
  97. package/dist/node/templates/edit.js +83 -0
  98. package/dist/node/templates/edit.js.map +1 -0
  99. package/dist/node/templates/fetch.js +114 -0
  100. package/dist/node/templates/fetch.js.map +1 -0
  101. package/dist/node/templates/index.js +8 -0
  102. package/dist/node/templates/index.js.map +1 -0
  103. package/dist/node/templates/utils.js +40 -0
  104. package/dist/node/templates/utils.js.map +1 -0
  105. package/dist/node/templates/view.js +84 -0
  106. package/dist/node/templates/view.js.map +1 -0
  107. package/dist/node/urls/getCardModelUrl.js +11 -11
  108. package/dist/node/urls/getCardModelUrl.js.map +1 -1
  109. package/dist/types/core/schemas/types.d.ts +1 -1
  110. package/dist/types/core/types/HubEntity.d.ts +2 -1
  111. package/dist/types/core/types/HubEntityType.d.ts +1 -1
  112. package/dist/types/core/types/IHubTemplate.d.ts +13 -0
  113. package/dist/types/core/types/index.d.ts +1 -0
  114. package/dist/types/index.d.ts +1 -0
  115. package/dist/types/permissions/types/Permission.d.ts +2 -1
  116. package/dist/types/templates/HubTemplate.d.ts +79 -0
  117. package/dist/types/templates/_internal/TemplateBusinessRules.d.ts +17 -0
  118. package/dist/types/templates/_internal/TemplateSchema.d.ts +4 -0
  119. package/dist/types/templates/_internal/TemplateUiSchemaEdit.d.ts +15 -0
  120. package/dist/types/templates/_internal/computeLinks.d.ts +11 -0
  121. package/dist/types/templates/_internal/computeProps.d.ts +13 -0
  122. package/dist/types/templates/_internal/getPropertyMap.d.ts +8 -0
  123. package/dist/types/templates/defaults.d.ts +14 -0
  124. package/dist/types/templates/edit.d.ts +37 -0
  125. package/dist/types/templates/fetch.d.ts +28 -0
  126. package/dist/types/templates/index.d.ts +4 -0
  127. package/dist/types/templates/utils.d.ts +13 -0
  128. package/dist/types/templates/view.d.ts +19 -0
  129. package/dist/types/urls/getCardModelUrl.d.ts +4 -2
  130. package/package.json +1 -1
@@ -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;;;;;;;GAOG;AACU,QAAA,mBAAmB,GAAsC,CACpE,QAAsB,EACtB,OAAuB,EACvB,IAA8B,EACX,EAAE;IACrB,MAAM,EACJ,WAAW,GAAG,EAAE,EAChB,OAAO,GAAG,EAAE,EACZ,MAAM,GAAG,OAAO,EAChB,MAAM,GAAG,MAAM,GAChB,GAAG,IAAI,IAAI,EAAE,CAAC;IAEf,MAAM,QAAQ,GAAG,2CAAyB,CACxC,QAAQ,EACR,OAAO,EACP,MAAM,EACN,OAAO,CACR,CAAC;IAEF,qDACK,0BAA0B,CAAC,QAAQ,EAAE,MAAM,CAAC,KAC/C,WAAW;QACX,QAAQ,KACL,CAAC,QAAQ,CAAC,YAAY,IAAI,EAAE,YAAY,EAAE,QAAQ,CAAC,YAAY,EAAE,CAAC,EACrE;AACJ,CAAC,CAAC;AAEF;;;;;;GAMG;A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,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,EACx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BACV,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";
@@ -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>;
@@ -0,0 +1,28 @@
1
+ import { IRequestOptions } from "@esri/arcgis-rest-request";
2
+ import { IHubTemplate } from "../core/types/IHubTemplate";
3
+ import { IHubRequestOptions } from "../types";
4
+ import { IItem } from "@esri/arcgis-rest-portal";
5
+ import { IHubSearchResult } from "../search/types";
6
+ /**
7
+ * @private
8
+ * Fetch a Hub Template backing item by id or slug
9
+ * @param identifier item id or slug
10
+ * @param requestOptions
11
+ */
12
+ export declare function fetchTemplate(identifier: string, requestOptions: IRequestOptions): Promise<IHubTemplate>;
13
+ /**
14
+ * @private
15
+ * Convert a Solution Item into a Hub Template, fetching
16
+ * any additional information that may be required
17
+ * @param item
18
+ * @param auth
19
+ */
20
+ export declare function convertItemToTemplate(item: IItem, requestOptions: IRequestOptions): Promise<IHubTemplate>;
21
+ /**
22
+ * @private
23
+ * Fetch template specific enrichments
24
+ * @param item
25
+ * @param include
26
+ * @param requestOptions
27
+ */
28
+ export declare function enrichTemplateSearchResult(item: IItem, include: string[], requestOptions: IHubRequestOptions): Promise<IHubSearchResult>;
@@ -0,0 +1,4 @@
1
+ export * from "./HubTemplate";
2
+ export * from "./view";
3
+ export * from "./fetch";
4
+ export * from "./edit";
@@ -0,0 +1,13 @@
1
+ import { IItem } from "@esri/arcgis-rest-types";
2
+ /**
3
+ * We do our best to glean what the solution template
4
+ * is supposed to become when deployed. This util
5
+ * extracts the expected item type from the
6
+ * hubSolutionType typeKeyword on the solution item
7
+ *
8
+ * We use this in various UIs to show the expected
9
+ * type rather than "Solution"
10
+ *
11
+ * @param template
12
+ */
13
+ export declare const getDeployedTemplateType: (template: IItem) => string;
@@ -0,0 +1,19 @@
1
+ import { IHubTemplate } from "../core/types/IHubTemplate";
2
+ import { ResultToCardModelFn, EntityToCardModelFn } from "../core/types/IHubCardViewModel";
3
+ /**
4
+ * Convert a template entity into a card view model that can
5
+ * be consumed by the suite of hub gallery components
6
+ *
7
+ * @param template template entity
8
+ * @param context auth & portal information
9
+ * @param opts view model options
10
+ */
11
+ export declare const templateToCardModel: EntityToCardModelFn<IHubTemplate>;
12
+ /**
13
+ * Convert a template hub search result into a card view model
14
+ * that can be consumed by the suite of hub gallery components
15
+ *
16
+ * @param searchResult hub template search result
17
+ * @param opts view model options
18
+ */
19
+ export declare const templateResultToCardModel: ResultToCardModelFn;
@@ -3,7 +3,8 @@ import { HubEntity } from "../core/types/HubEntity";
3
3
  import { CardModelTarget } from "../core/types/IHubCardViewModel";
4
4
  import { IHubSearchResult } from "../search/types/IHubSearchResult";
5
5
  /**
6
- * returns a gallery card's title url from a hub search result
6
+ * given a target and hub search result, this util
7
+ * returns a gallery card's title url
7
8
  *
8
9
  * @param result hub search result
9
10
  * @param target context the card should redirect to
@@ -11,7 +12,8 @@ import { IHubSearchResult } from "../search/types/IHubSearchResult";
11
12
  */
12
13
  export declare function getCardModelUrlFromResult(result: IHubSearchResult, target: CardModelTarget, baseUrl?: string): string;
13
14
  /**
14
- * returns a gallery card's title url from an entity
15
+ * given a target and hub entity, this util
16
+ * returns a gallery card's title url
15
17
  *
16
18
  * @param entity hub entity
17
19
  * @param context auth & portal information
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/hub-common",
3
- "version": "14.26.2",
3
+ "version": "14.27.0",
4
4
  "description": "Common TypeScript types and utility functions for @esri/hub.js.",
5
5
  "main": "dist/node/index.js",
6
6
  "module": "dist/esm/index.js",