@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,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TemplatePermissionPolicies = exports.TemplatePermissions = exports.TemplateDefaultFeatures = void 0;
4
+ /**
5
+ * Default features for a Template. These are the features
6
+ * that can be enabled / disabled by the entity owner
7
+ */
8
+ exports.TemplateDefaultFeatures = {};
9
+ /**
10
+ * @private
11
+ * Template permissions: these define the requirements
12
+ * any user must meet to perform related actions
13
+ */
14
+ exports.TemplatePermissions = [
15
+ "hub:template",
16
+ "hub:template:create",
17
+ "hub:template:delete",
18
+ "hub:template:edit",
19
+ "hub:template:manage",
20
+ "hub:template:view",
21
+ "hub:template:workspace:overview",
22
+ "hub:template:workspace:details",
23
+ "hub:template:workspace:dashboard",
24
+ "hub:template:workspace:collaborators",
25
+ "hub:template:workspace:settings",
26
+ ];
27
+ /**
28
+ * @private
29
+ * Template permission policies
30
+ */
31
+ exports.TemplatePermissionPolicies = [
32
+ {
33
+ permission: "hub:template",
34
+ availability: ["alpha"],
35
+ services: ["portal"],
36
+ },
37
+ {
38
+ permission: "hub:template:create",
39
+ dependencies: ["hub:template"],
40
+ authenticated: true,
41
+ privileges: ["portal:user:createItem"],
42
+ },
43
+ {
44
+ permission: "hub:template:delete",
45
+ dependencies: ["hub:template"],
46
+ authenticated: true,
47
+ entityOwner: true,
48
+ },
49
+ {
50
+ permission: "hub:template:view",
51
+ dependencies: ["hub:template"],
52
+ },
53
+ {
54
+ permission: "hub:template:edit",
55
+ dependencies: ["hub:template"],
56
+ authenticated: true,
57
+ entityEdit: true,
58
+ },
59
+ {
60
+ permission: "hub:template:manage",
61
+ dependencies: ["hub:template:edit"],
62
+ },
63
+ {
64
+ permission: "hub:template:workspace:overview",
65
+ dependencies: ["hub:template:view"],
66
+ },
67
+ {
68
+ permission: "hub:template:workspace:details",
69
+ dependencies: ["hub:template:manage"],
70
+ },
71
+ {
72
+ permission: "hub:template:workspace:dashboard",
73
+ dependencies: ["hub:template:manage"],
74
+ },
75
+ {
76
+ permission: "hub:template:workspace:collaborators",
77
+ dependencies: ["hub:template:manage"],
78
+ },
79
+ {
80
+ permission: "hub:template:workspace:settings",
81
+ dependencies: ["hub:template:manage"],
82
+ entityOwner: true,
83
+ },
84
+ ];
85
+ //# sourceMappingURL=TemplateBusinessRules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TemplateBusinessRules.js","sourceRoot":"","sources":["../../../../src/templates/_internal/TemplateBusinessRules.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACU,QAAA,uBAAuB,GAAkB,EAAE,CAAC;AAEzD;;;;GAIG;AACU,QAAA,mBAAmB,GAAG;IACjC,cAAc;IACd,qBAAqB;IACrB,qBAAqB;IACrB,mBAAmB;IACnB,qBAAqB;IACrB,mBAAmB;IACnB,iCAAiC;IACjC,gCAAgC;IAChC,kCAAkC;IAClC,sCAAsC;IACtC,iCAAiC;CACzB,CAAC;AAEX;;;GAGG;AACU,QAAA,0BAA0B,GAAwB;IAC7D;QACE,UAAU,EAAE,cAAc;QAC1B,YAAY,EAAE,CAAC,OAAO,CAAC;QACvB,QAAQ,EAAE,CAAC,QAAQ,CAAC;KACrB;IACD;QACE,UAAU,EAAE,qBAAqB;QACjC,YAAY,EAAE,CAAC,cAAc,CAAC;QAC9B,aAAa,EAAE,IAAI;QACnB,UAAU,EAAE,CAAC,wBAAwB,CAAC;KACvC;IACD;QACE,UAAU,EAAE,qBAAqB;QACjC,YAAY,EAAE,CAAC,cAAc,CAAC;QAC9B,aAAa,EAAE,IAAI;QACnB,WAAW,EAAE,IAAI;KAClB;IACD;QACE,UAAU,EAAE,mBAAmB;QAC/B,YAAY,EAAE,CAAC,cAAc,CAAC;KAC/B;IACD;QACE,UAAU,EAAE,mBAAmB;QAC/B,YAAY,EAAE,CAAC,cAAc,CAAC;QAC9B,aAAa,EAAE,IAAI;QACnB,UAAU,EAAE,IAAI;KACjB;IACD;QACE,UAAU,EAAE,qBAAqB;QACjC,YAAY,EAAE,CAAC,mBAAmB,CAAC;KACpC;IACD;QACE,UAAU,EAAE,iCAAiC;QAC7C,YAAY,EAAE,CAAC,mBAAmB,CAAC;KACpC;IACD;QACE,UAAU,EAAE,gCAAgC;QAC5C,YAAY,EAAE,CAAC,qBAAqB,CAAC;KACtC;IACD;QACE,UAAU,EAAE,kCAAkC;QAC9C,YAAY,EAAE,CAAC,qBAAqB,CAAC;KACtC;IACD;QACE,UAAU,EAAE,sCAAsC;QAClD,YAAY,EAAE,CAAC,qBAAqB,CAAC;KACtC;IACD;QACE,UAAU,EAAE,iCAAiC;QAC7C,YAAY,EAAE,CAAC,qBAAqB,CAAC;QACrC,WAAW,EAAE,IAAI;KAClB;CACF,CAAC"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TemplateSchema = exports.TemplateEditorTypes = void 0;
4
+ const HubItemEntitySchema_1 = require("../../core/schemas/shared/HubItemEntitySchema");
5
+ exports.TemplateEditorTypes = ["hub:template:edit"];
6
+ exports.TemplateSchema = Object.assign(Object.assign({}, HubItemEntitySchema_1.HubItemEntitySchema), { properties: Object.assign(Object.assign({}, HubItemEntitySchema_1.HubItemEntitySchema.properties), { previewUrl: {
7
+ type: "string",
8
+ if: { minLength: 1 },
9
+ then: { format: "uri" },
10
+ } }) });
11
+ //# sourceMappingURL=TemplateSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TemplateSchema.js","sourceRoot":"","sources":["../../../../src/templates/_internal/TemplateSchema.ts"],"names":[],"mappings":";;;AACA,uFAAoF;AAIvE,QAAA,mBAAmB,GAAG,CAAC,mBAAmB,CAAU,CAAC;AAErD,QAAA,cAAc,GAAyB,gCAC/C,yCAAmB,KACtB,UAAU,kCACL,yCAAmB,CAAC,UAAU,KACjC,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE;YACpB,IAAI,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;SACxB,MAEoB,CAAC"}
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildUiSchema = void 0;
4
+ const types_1 = require("../../core/schemas/types");
5
+ /**
6
+ * @private
7
+ * constructs the complete edit uiSchema for Hub Templates.
8
+ * This defines how the schema properties should be rendered
9
+ * in the template editing experience.
10
+ *
11
+ * @param i18nScope
12
+ * @param entity
13
+ * @param context
14
+ * @returns
15
+ */
16
+ exports.buildUiSchema = async (i18nScope, entity, context) => {
17
+ return {
18
+ type: "Layout",
19
+ elements: [
20
+ {
21
+ type: "Section",
22
+ labelKey: `${i18nScope}.sections.basicInfo.label`,
23
+ elements: [
24
+ {
25
+ type: "Control",
26
+ scope: "/properties/name",
27
+ labelKey: `${i18nScope}.fields.name.label`,
28
+ options: {
29
+ messages: [
30
+ {
31
+ type: types_1.UiSchemaMessageTypes.error,
32
+ keyword: "required",
33
+ icon: true,
34
+ labelKey: `${i18nScope}.fields.name.requiredError`,
35
+ },
36
+ ],
37
+ },
38
+ },
39
+ {
40
+ type: "Control",
41
+ scope: "/properties/previewUrl",
42
+ labelKey: `${i18nScope}.fields.previewUrl.label`,
43
+ options: {
44
+ helperText: {
45
+ labelKey: `${i18nScope}.fields.previewUrl.helperText`,
46
+ },
47
+ messages: [
48
+ {
49
+ type: "ERROR",
50
+ keyword: "if",
51
+ hidden: true,
52
+ },
53
+ ],
54
+ },
55
+ },
56
+ {
57
+ labelKey: `${i18nScope}.fields.summary.label`,
58
+ scope: "/properties/summary",
59
+ type: "Control",
60
+ options: {
61
+ control: "hub-field-input-input",
62
+ type: "textarea",
63
+ helperText: {
64
+ labelKey: `${i18nScope}.fields.summary.helperText`,
65
+ },
66
+ },
67
+ },
68
+ {
69
+ labelKey: `${i18nScope}.fields.description.label`,
70
+ scope: "/properties/description",
71
+ type: "Control",
72
+ options: {
73
+ control: "hub-field-input-input",
74
+ type: "textarea",
75
+ helperText: {
76
+ labelKey: `${i18nScope}.fields.description.helperText`,
77
+ },
78
+ },
79
+ },
80
+ {
81
+ labelKey: `${i18nScope}.fields.thumbnail.label`,
82
+ scope: "/properties/_thumbnail",
83
+ type: "Control",
84
+ options: {
85
+ control: "hub-field-input-image-picker",
86
+ imgSrc: entity.thumbnailUrl,
87
+ maxWidth: 727,
88
+ maxHeight: 484,
89
+ aspectRatio: 1.5,
90
+ helperText: {
91
+ labelKey: `${i18nScope}.fields.thumbnail.helperText`,
92
+ },
93
+ },
94
+ },
95
+ ],
96
+ },
97
+ ],
98
+ };
99
+ };
100
+ //# sourceMappingURL=TemplateUiSchemaEdit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TemplateUiSchemaEdit.js","sourceRoot":"","sources":["../../../../src/templates/_internal/TemplateUiSchemaEdit.ts"],"names":[],"mappings":";;;AACA,oDAA2E;AAG3E;;;;;;;;;;GAUG;AACU,QAAA,aAAa,GAAG,KAAK,EAChC,SAAiB,EACjB,MAAoB,EACpB,OAAuB,EACH,EAAE;IACtB,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,SAAS;gBACf,QAAQ,EAAE,GAAG,SAAS,2BAA2B;gBACjD,QAAQ,EAAE;oBACR;wBACE,IAAI,EAAE,SAAS;wBACf,KAAK,EAAE,kBAAkB;wBACzB,QAAQ,EAAE,GAAG,SAAS,oBAAoB;wBAC1C,OAAO,EAAE;4BACP,QAAQ,EAAE;gCACR;oCACE,IAAI,EAAE,4BAAoB,CAAC,KAAK;oCAChC,OAAO,EAAE,UAAU;oCACnB,IAAI,EAAE,IAAI;oCACV,QAAQ,EAAE,GAAG,SAAS,4BAA4B;iCACnD;6BACF;yBACF;qBACF;oBACD;wBACE,IAAI,EAAE,SAAS;wBACf,KAAK,EAAE,wBAAwB;wBAC/B,QAAQ,EAAE,GAAG,SAAS,0BAA0B;wBAChD,OAAO,EAAE;4BACP,UAAU,EAAE;gCACV,QAAQ,EAAE,GAAG,SAAS,+BAA+B;6BACtD;4BACD,QAAQ,EAAE;gCACR;oCACE,IAAI,EAAE,OAAO;oCACb,OAAO,EAAE,IAAI;oCACb,MAAM,EAAE,IAAI;iCACb;6BACF;yBACF;qBACF;oBACD;wBACE,QAAQ,EAAE,GAAG,SAAS,uBAAuB;wBAC7C,KAAK,EAAE,qBAAqB;wBAC5B,IAAI,EAAE,SAAS;wBACf,OAAO,EAAE;4BACP,OAAO,EAAE,uBAAuB;4BAChC,IAAI,EAAE,UAAU;4BAChB,UAAU,EAAE;gCACV,QAAQ,EAAE,GAAG,SAAS,4BAA4B;6BACnD;yBACF;qBACF;oBACD;wBACE,QAAQ,EAAE,GAAG,SAAS,2BAA2B;wBACjD,KAAK,EAAE,yBAAyB;wBAChC,IAAI,EAAE,SAAS;wBACf,OAAO,EAAE;4BACP,OAAO,EAAE,uBAAuB;4BAChC,IAAI,EAAE,UAAU;4BAChB,UAAU,EAAE;gCACV,QAAQ,EAAE,GAAG,SAAS,gCAAgC;6BACvD;yBACF;qBACF;oBACD;wBACE,QAAQ,EAAE,GAAG,SAAS,yBAAyB;wBAC/C,KAAK,EAAE,wBAAwB;wBAC/B,IAAI,EAAE,SAAS;wBACf,OAAO,EAAE;4BACP,OAAO,EAAE,8BAA8B;4BACvC,MAAM,EAAE,MAAM,CAAC,YAAY;4BAC3B,QAAQ,EAAE,GAAG;4BACb,SAAS,EAAE,GAAG;4BACd,WAAW,EAAE,GAAG;4BAChB,UAAU,EAAE;gCACV,QAAQ,EAAE,GAAG,SAAS,8BAA8B;6BACrD;yBACF;qBACF;iBACF;aACF;SACF;KACF,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.computeLinks = void 0;
4
+ const urls_1 = require("../../urls");
5
+ const items_1 = require("../../items");
6
+ const internalContentUtils_1 = require("../../content/_internal/internalContentUtils");
7
+ const getRelativeWorkspaceUrl_1 = require("../../core/getRelativeWorkspaceUrl");
8
+ const get_item_thumbnail_url_1 = require("../../resources/get-item-thumbnail-url");
9
+ /**
10
+ * Compute the links that get appended to a Hub Template
11
+ * search result and entity
12
+ *
13
+ * @param item
14
+ * @param requestOptions
15
+ */
16
+ function computeLinks(item, requestOptions) {
17
+ let token;
18
+ if (requestOptions.authentication) {
19
+ const session = requestOptions.authentication;
20
+ token = session.token;
21
+ }
22
+ return {
23
+ self: urls_1.getItemHomeUrl(item.id, requestOptions),
24
+ siteRelative: internalContentUtils_1.getHubRelativeUrl(item.type, items_1.getItemIdentifier(item), item.typeKeywords),
25
+ workspaceRelative: getRelativeWorkspaceUrl_1.getRelativeWorkspaceUrl(item.type, items_1.getItemIdentifier(item)),
26
+ thumbnail: get_item_thumbnail_url_1.getItemThumbnailUrl(item, requestOptions, token),
27
+ };
28
+ }
29
+ exports.computeLinks = computeLinks;
30
+ //# sourceMappingURL=computeLinks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computeLinks.js","sourceRoot":"","sources":["../../../../src/templates/_internal/computeLinks.ts"],"names":[],"mappings":";;;AAGA,qCAA4C;AAE5C,uCAAgD;AAChD,uFAAiF;AACjF,gFAA6E;AAC7E,mFAA6E;AAE7E;;;;;;GAMG;AACH,SAAgB,YAAY,CAC1B,IAAW,EACX,cAA+B;IAE/B,IAAI,KAAa,CAAC;IAClB,IAAI,cAAc,CAAC,cAAc,EAAE;QACjC,MAAM,OAAO,GAAgB,cAAc,CAAC,cAA6B,CAAC;QAC1E,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;KACvB;IAED,OAAO;QACL,IAAI,EAAE,qBAAc,CAAC,IAAI,CAAC,EAAE,EAAE,cAAc,CAAC;QAC7C,YAAY,EAAE,wCAAiB,CAC7B,IAAI,CAAC,IAAI,EACT,yBAAiB,CAAC,IAAI,CAAC,EACvB,IAAI,CAAC,YAAY,CAClB;QACD,iBAAiB,EAAE,iDAAuB,CACxC,IAAI,CAAC,IAAI,EACT,yBAAiB,CAAC,IAAI,CAAC,CACxB;QACD,SAAS,EAAE,4CAAmB,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,CAAC;KAC5D,CAAC;AACJ,CAAC;AAvBD,oCAuBC"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.computeProps = void 0;
4
+ const utils_1 = require("../../discussions/utils");
5
+ const processEntityFeatures_1 = require("../../permissions/_internal/processEntityFeatures");
6
+ const TemplateBusinessRules_1 = require("./TemplateBusinessRules");
7
+ const computeLinks_1 = require("./computeLinks");
8
+ const objects_1 = require("../../objects");
9
+ const utils_2 = require("../utils");
10
+ /**
11
+ * @private
12
+ * Given a model and a template, set various computed
13
+ * properties on the template that can't be directly
14
+ * mapped from the model
15
+ * @param model
16
+ * @param template
17
+ * @param requestOptions
18
+ */
19
+ function computeProps(model, template, requestOptions) {
20
+ // 1. compute relevant template links
21
+ template.links = computeLinks_1.computeLinks(model.item, requestOptions);
22
+ // 2. append the template's thumbnail url at the top-level
23
+ template.thumbnailUrl = template.links.thumbnail;
24
+ // 3. compute relevant template dates
25
+ template.createdDate = new Date(model.item.created);
26
+ template.createdDateSource = "item.created";
27
+ template.updatedDate = new Date(model.item.modified);
28
+ template.updatedDateSource = "item.modified";
29
+ // 4. determine whether the template is discussable
30
+ template.isDiscussable = utils_1.isDiscussable(template);
31
+ // 5. process features that can be disabled by the entity owner
32
+ template.features = processEntityFeatures_1.processEntityFeatures(objects_1.getProp(model, "data.settings.features") || {}, TemplateBusinessRules_1.TemplateDefaultFeatures);
33
+ // 6. compute additional template-specific properties
34
+ template.isDeployed = (objects_1.getProp(model, "item.typeKeywords") || []).includes("Deployed");
35
+ template.deployedType = utils_2.getDeployedTemplateType(model.item);
36
+ // 7. cast b/c this takes a partial but returns a full template
37
+ return template;
38
+ }
39
+ exports.computeProps = computeProps;
40
+ //# sourceMappingURL=computeProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computeProps.js","sourceRoot":"","sources":["../../../../src/templates/_internal/computeProps.ts"],"names":[],"mappings":";;;AACA,mDAAwD;AACxD,6FAA0F;AAE1F,mEAAkE;AAElE,iDAA8C;AAC9C,2CAAwC;AACxC,oCAAmD;AAEnD;;;;;;;;GAQG;AACH,SAAgB,YAAY,CAC1B,KAAa,EACb,QAA+B,EAC/B,cAA+B;IAE/B,qCAAqC;IACrC,QAAQ,CAAC,KAAK,GAAG,2BAAY,CAAC,KAAK,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAE1D,0DAA0D;IAC1D,QAAQ,CAAC,YAAY,GAAG,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC;IAEjD,qCAAqC;IACrC,QAAQ,CAAC,WAAW,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpD,QAAQ,CAAC,iBAAiB,GAAG,cAAc,CAAC;IAC5C,QAAQ,CAAC,WAAW,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACrD,QAAQ,CAAC,iBAAiB,GAAG,eAAe,CAAC;IAE7C,mDAAmD;IACnD,QAAQ,CAAC,aAAa,GAAG,qBAAa,CAAC,QAAQ,CAAC,CAAC;IAEjD,+DAA+D;IAC/D,QAAQ,CAAC,QAAQ,GAAG,6CAAqB,CACvC,iBAAO,CAAC,KAAK,EAAE,wBAAwB,CAAC,IAAI,EAAE,EAC9C,+CAAuB,CACxB,CAAC;IAEF,qDAAqD;IACrD,QAAQ,CAAC,UAAU,GAAG,CAAC,iBAAO,CAAC,KAAK,EAAE,mBAAmB,CAAC,IAAI,EAAE,CAAC,CAAC,QAAQ,CACxE,UAAU,CACX,CAAC;IACF,QAAQ,CAAC,YAAY,GAAG,+BAAuB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE5D,+DAA+D;IAC/D,OAAO,QAAwB,CAAC;AAClC,CAAC;AAlCD,oCAkCC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPropertyMap = void 0;
4
+ const getBasePropertyMap_1 = require("../../core/_internal/getBasePropertyMap");
5
+ /**
6
+ * @private
7
+ * Returns an Array of IPropertyMap objects that
8
+ * define the projection of properties from an
9
+ * IModel to an IHubTemplate
10
+ */
11
+ function getPropertyMap() {
12
+ const map = getBasePropertyMap_1.getBasePropertyMap();
13
+ // IHubTemplate specific mappings
14
+ map.push({ entityKey: "previewUrl", storeKey: "item.properties.previewUrl" });
15
+ return map;
16
+ }
17
+ exports.getPropertyMap = getPropertyMap;
18
+ //# sourceMappingURL=getPropertyMap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPropertyMap.js","sourceRoot":"","sources":["../../../../src/templates/_internal/getPropertyMap.ts"],"names":[],"mappings":";;;AAAA,gFAA6E;AAG7E;;;;;GAKG;AACH,SAAgB,cAAc;IAC5B,MAAM,GAAG,GAAG,uCAAkB,EAAE,CAAC;IAEjC,iCAAiC;IACjC,GAAG,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,4BAA4B,EAAE,CAAC,CAAC;IAE9E,OAAO,GAAG,CAAC;AACb,CAAC;AAPD,wCAOC"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_TEMPLATE_MODEL = exports.DEFAULT_TEMPLATE = exports.HUB_TEMPLATE_ITEM_TYPE = void 0;
4
+ const TemplateBusinessRules_1 = require("./_internal/TemplateBusinessRules");
5
+ /**
6
+ * NOTE: this file provides default values for new
7
+ * Hub Template creation; however, we have no immediate
8
+ * plans to allow template creation from the context of
9
+ * our application. Scaffolding these defaults for
10
+ * potential future implementation
11
+ */
12
+ exports.HUB_TEMPLATE_ITEM_TYPE = "Solution";
13
+ /** Default values for a new IHubTemplate */
14
+ exports.DEFAULT_TEMPLATE = {
15
+ schemaVersion: 1,
16
+ catalog: { schemaVersion: 0 },
17
+ name: "",
18
+ tags: [],
19
+ typeKeywords: [exports.HUB_TEMPLATE_ITEM_TYPE],
20
+ view: {},
21
+ permissions: [],
22
+ features: TemplateBusinessRules_1.TemplateDefaultFeatures,
23
+ };
24
+ /** Default values for a new HubTemplate Model (backing item) */
25
+ exports.DEFAULT_TEMPLATE_MODEL = {
26
+ item: {
27
+ type: exports.HUB_TEMPLATE_ITEM_TYPE,
28
+ title: "",
29
+ description: "",
30
+ snippet: "",
31
+ tags: [],
32
+ typeKeywords: [exports.HUB_TEMPLATE_ITEM_TYPE],
33
+ properties: {
34
+ slug: "",
35
+ schemaVersion: 1,
36
+ },
37
+ },
38
+ data: {
39
+ permissions: [],
40
+ view: {},
41
+ },
42
+ };
43
+ //# sourceMappingURL=defaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../src/templates/defaults.ts"],"names":[],"mappings":";;;AACA,6EAA4E;AAG5E;;;;;;GAMG;AAEU,QAAA,sBAAsB,GAAG,UAAU,CAAC;AAEjD,4CAA4C;AAC/B,QAAA,gBAAgB,GAA0B;IACrD,aAAa,EAAE,CAAC;IAChB,OAAO,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE;IAC7B,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,EAAE;IACR,YAAY,EAAE,CAAC,8BAAsB,CAAC;IACtC,IAAI,EAAE,EAAE;IACR,WAAW,EAAE,EAAE;IACf,QAAQ,EAAE,+CAAuB;CAClC,CAAC;AAEF,gEAAgE;AACnD,QAAA,sBAAsB,GAAW;IAC5C,IAAI,EAAE;QACJ,IAAI,EAAE,8BAAsB;QAC5B,KAAK,EAAE,EAAE;QACT,WAAW,EAAE,EAAE;QACf,OAAO,EAAE,EAAE;QACX,IAAI,EAAE,EAAE;QACR,YAAY,EAAE,CAAC,8BAAsB,CAAC;QACtC,UAAU,EAAE;YACV,IAAI,EAAE,EAAE;YACR,aAAa,EAAE,CAAC;SACjB;KACF;IACD,IAAI,EAAE;QACJ,WAAW,EAAE,EAAE;QACf,IAAI,EAAE,EAAE;KACT;CACmB,CAAC"}
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteTemplate = exports.editorToTemplate = exports.updateTemplate = exports.createTemplate = void 0;
4
+ const slugs_1 = require("../items/slugs");
5
+ const discussions_1 = require("../discussions");
6
+ const PropertyMapper_1 = require("../core/_internal/PropertyMapper");
7
+ const util_1 = require("../util");
8
+ const models_1 = require("../models");
9
+ const getPropertyMap_1 = require("./_internal/getPropertyMap");
10
+ const computeProps_1 = require("./_internal/computeProps");
11
+ const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
12
+ /**
13
+ * @private
14
+ * Creates a Hub Template's backing Solution item and returns
15
+ * the created entity
16
+ *
17
+ * NOTE: We have no immediate plans to allow template creation
18
+ * from the context of the Hub application, but scaffolding
19
+ * this util for potential future implementation. For now,
20
+ * we will throw an error
21
+ * @param partialTemplate
22
+ * @param requestOptions
23
+ */
24
+ function createTemplate(partialTemplate, requestOptions) {
25
+ throw new Error("Template creation is not currently supported from the context of Hub");
26
+ }
27
+ exports.createTemplate = createTemplate;
28
+ /**
29
+ * @private
30
+ * Updates a Hub Template's backing item and returns
31
+ * the updated entity
32
+ * @param template
33
+ * @param requestOptions
34
+ */
35
+ async function updateTemplate(template, requestOptions) {
36
+ // 1. Verify the slug is unique, excluding the current template
37
+ template.slug = await slugs_1.getUniqueSlug({ slug: template.slug, existingId: template.id }, requestOptions);
38
+ // 2. Update relevant typeKeywords
39
+ template.typeKeywords = discussions_1.setDiscussableKeyword(template.typeKeywords, template.isDiscussable);
40
+ // 3. Fetch the backing model (item + data)
41
+ const model = await models_1.getModel(template.id, requestOptions);
42
+ // 4. Create a property mapper between the template
43
+ // object and item model
44
+ const mapper = new PropertyMapper_1.PropertyMapper(getPropertyMap_1.getPropertyMap());
45
+ // 5. Create item model from updated template object, using
46
+ // the existing model as a starting point
47
+ const modelToUpdate = mapper.entityToStore(template, model);
48
+ // 6. Update the backing item
49
+ const updatedModel = await models_1.updateModel(modelToUpdate, requestOptions);
50
+ // 7. Map the item back into an IHubTemplate
51
+ const updatedTemplate = mapper.storeToEntity(updatedModel, template);
52
+ // 8. Compute + set various properties on the IHubTemplate
53
+ // that cannot be directly mapped from the item
54
+ template = computeProps_1.computeProps(model, updatedTemplate, requestOptions);
55
+ return updatedTemplate;
56
+ }
57
+ exports.updateTemplate = updateTemplate;
58
+ /**
59
+ * Convert an IHubTemplateEditor back into a IHubTemplate
60
+ * @param editor
61
+ * @param portal
62
+ */
63
+ function editorToTemplate(editor, portal) {
64
+ // 1. cast editor to IHubTemplate
65
+ const template = util_1.cloneObject(editor);
66
+ // 2. ensure there's an org url key
67
+ template.orgUrlKey = editor.orgUrlKey ? editor.orgUrlKey : portal.urlKey;
68
+ return template;
69
+ }
70
+ exports.editorToTemplate = editorToTemplate;
71
+ /**
72
+ * @private
73
+ * Remove a Hub Template's backing item
74
+ * @param id
75
+ * @param requestOptions
76
+ */
77
+ async function deleteTemplate(id, requestOptions) {
78
+ const ro = Object.assign(Object.assign({}, requestOptions), { id });
79
+ await arcgis_rest_portal_1.removeItem(ro);
80
+ return;
81
+ }
82
+ exports.deleteTemplate = deleteTemplate;
83
+ //# sourceMappingURL=edit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit.js","sourceRoot":"","sources":["../../../src/templates/edit.ts"],"names":[],"mappings":";;;AAEA,0CAA+C;AAC/C,gDAAuD;AACvD,qEAAkE;AAElE,kCAAsC;AACtC,sCAAkD;AAClD,+DAA4D;AAC5D,2DAAwD;AACxD,iEAIkC;AAElC;;;;;;;;;;;GAWG;AACH,SAAgB,cAAc,CAC5B,eAAsC,EACtC,cAAmC;IAEnC,MAAM,IAAI,KAAK,CACb,sEAAsE,CACvE,CAAC;AACJ,CAAC;AAPD,wCAOC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,cAAc,CAClC,QAAsB,EACtB,cAAmC;IAEnC,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,GAAG,MAAM,qBAAa,CACjC,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,EAAE,EAChD,cAAc,CACf,CAAC;IAEF,kCAAkC;IAClC,QAAQ,CAAC,YAAY,GAAG,mCAAqB,CAC3C,QAAQ,CAAC,YAAY,EACrB,QAAQ,CAAC,aAAa,CACvB,CAAC;IAEF,2CAA2C;IAC3C,MAAM,KAAK,GAAG,MAAM,iBAAQ,CAAC,QAAQ,CAAC,EAAE,EAAE,cAAc,CAAC,CAAC;IAE1D,mDAAmD;IACnD,wBAAwB;IACxB,MAAM,MAAM,GAAG,IAAI,+BAAc,CAC/B,+BAAc,EAAE,CACjB,CAAC;IAEF,2DAA2D;IAC3D,yCAAyC;IACzC,MAAM,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAE5D,6BAA6B;IAC7B,MAAM,YAAY,GAAG,MAAM,oBAAW,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;IAEtE,4CAA4C;IAC5C,MAAM,eAAe,GAAG,MAAM,CAAC,aAAa,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;IAErE,0DAA0D;IAC1D,+CAA+C;IAC/C,QAAQ,GAAG,2BAAY,CAAC,KAAK,EAAE,eAAe,EAAE,cAAc,CAAC,CAAC;IAEhE,OAAO,eAA+B,CAAC;AACzC,CAAC;AAxCD,wCAwCC;AAED;;;;GAIG;AACH,SAAgB,gBAAgB,CAC9B,MAA0B,EAC1B,MAAe;IAEf,iCAAiC;IACjC,MAAM,QAAQ,GAAG,kBAAW,CAAC,MAAM,CAAiB,CAAC;IAErD,mCAAmC;IACnC,QAAQ,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;IAEzE,OAAO,QAAQ,CAAC;AAClB,CAAC;AAXD,4CAWC;AAED;;;;;GAKG;AACI,KAAK,UAAU,cAAc,CAClC,EAAU,EACV,cAAmC;IAEnC,MAAM,EAAE,GAAG,gCAAK,cAAc,GAAK,EAAE,EAAE,EAAE,CAAsB,CAAC;IAChE,MAAM,+BAAU,CAAC,EAAE,CAAC,CAAC;IAErB,OAAO;AACT,CAAC;AARD,wCAQC"}
@@ -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","sourceRoot":"","sources":["../../../src/templates/fetch.ts"],"names":[],"mappings":"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"}
@@ -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"}