@esri/hub-common 14.98.0 → 14.99.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 (226) 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/getEditorSchemas.js +10 -0
  8. package/dist/esm/core/schemas/internal/getEditorSchemas.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/IHubSurvey.js +1 -0
  14. package/dist/esm/core/types/IHubSurvey.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/discussions/HubDiscussion.js +1 -1
  18. package/dist/esm/discussions/api/settings/getDefaultEntitySettings.js +1 -0
  19. package/dist/esm/discussions/api/settings/getDefaultEntitySettings.js.map +1 -1
  20. package/dist/esm/index.js +1 -1
  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/sites/HubSites.js +1 -0
  27. package/dist/esm/sites/HubSites.js.map +1 -1
  28. package/dist/esm/sites/_internal/ensureBaseTelemetry.js +21 -0
  29. package/dist/esm/sites/_internal/ensureBaseTelemetry.js.map +1 -0
  30. package/dist/esm/sites/upgrade-site-schema.js +2 -0
  31. package/dist/esm/sites/upgrade-site-schema.js.map +1 -1
  32. package/dist/esm/surveys/HubSurvey.js +130 -0
  33. package/dist/esm/surveys/HubSurvey.js.map +1 -0
  34. package/dist/esm/surveys/_internal/SurveyBusinessRules.js +73 -0
  35. package/dist/esm/surveys/_internal/SurveyBusinessRules.js.map +1 -0
  36. package/dist/esm/surveys/_internal/SurveySchema.js +18 -0
  37. package/dist/esm/surveys/_internal/SurveySchema.js.map +1 -0
  38. package/dist/esm/surveys/_internal/SurveyUiSchemaEdit.js +108 -0
  39. package/dist/esm/surveys/_internal/SurveyUiSchemaEdit.js.map +1 -0
  40. package/dist/esm/surveys/_internal/SurveyUiSchemaSettings.js +60 -0
  41. package/dist/esm/surveys/_internal/SurveyUiSchemaSettings.js.map +1 -0
  42. package/dist/esm/surveys/_internal/computeProps.js +35 -0
  43. package/dist/esm/surveys/_internal/computeProps.js.map +1 -0
  44. package/dist/esm/surveys/_internal/getPropertyMap.js +12 -0
  45. package/dist/esm/surveys/_internal/getPropertyMap.js.map +1 -0
  46. package/dist/esm/surveys/constants.js +2 -0
  47. package/dist/esm/surveys/constants.js.map +1 -0
  48. package/dist/esm/surveys/defaults.js +9 -0
  49. package/dist/esm/surveys/defaults.js.map +1 -0
  50. package/dist/esm/surveys/edit.js +49 -0
  51. package/dist/esm/surveys/edit.js.map +1 -0
  52. package/dist/esm/surveys/fetch.js +45 -0
  53. package/dist/esm/surveys/fetch.js.map +1 -0
  54. package/dist/esm/surveys/index.js +6 -5
  55. package/dist/esm/surveys/index.js.map +1 -1
  56. package/dist/esm/surveys/types.js +1 -0
  57. package/dist/esm/surveys/types.js.map +1 -0
  58. package/dist/esm/surveys/utils/decode-form.js +35 -0
  59. package/dist/esm/surveys/utils/decode-form.js.map +1 -0
  60. package/dist/esm/surveys/utils/get-form-info-json.js +12 -0
  61. package/dist/esm/surveys/utils/get-form-info-json.js.map +1 -0
  62. package/dist/esm/surveys/utils/get-form-json.js +65 -0
  63. package/dist/esm/surveys/utils/get-form-json.js.map +1 -0
  64. package/dist/esm/surveys/utils/get-input-feature-service-model.js.map +1 -0
  65. package/dist/esm/surveys/utils/get-map-question.js +31 -0
  66. package/dist/esm/surveys/utils/get-map-question.js.map +1 -0
  67. package/dist/esm/surveys/utils/get-source-feature-service-model-from-fieldworker.js.map +1 -0
  68. package/dist/esm/surveys/utils/get-stakeholder-model.js.map +1 -0
  69. package/dist/esm/surveys/utils/get-survey-models.js.map +1 -0
  70. package/dist/esm/surveys/utils/has-map-question.js +11 -0
  71. package/dist/esm/surveys/utils/has-map-question.js.map +1 -0
  72. package/dist/esm/surveys/utils/index.js +16 -0
  73. package/dist/esm/surveys/utils/index.js.map +1 -0
  74. package/dist/esm/surveys/utils/is-fieldworker-view.js.map +1 -0
  75. package/dist/esm/surveys/utils/is-map-question.js +16 -0
  76. package/dist/esm/surveys/utils/is-map-question.js.map +1 -0
  77. package/dist/esm/surveys/utils/is-page-question.js +9 -0
  78. package/dist/esm/surveys/utils/is-page-question.js.map +1 -0
  79. package/dist/esm/surveys/utils/is-survey123-connect.js +16 -0
  80. package/dist/esm/surveys/utils/is-survey123-connect.js.map +1 -0
  81. package/dist/esm/surveys/utils/set-display-map-keyword.js +15 -0
  82. package/dist/esm/surveys/utils/set-display-map-keyword.js.map +1 -0
  83. package/dist/esm/surveys/utils/should-display-map.js +10 -0
  84. package/dist/esm/surveys/utils/should-display-map.js.map +1 -0
  85. package/dist/node/core/EntityEditor.js +4 -0
  86. package/dist/node/core/EntityEditor.js.map +1 -1
  87. package/dist/node/core/fetchHubEntity.js +4 -0
  88. package/dist/node/core/fetchHubEntity.js.map +1 -1
  89. package/dist/node/core/getTypeFromEntity.js +3 -0
  90. package/dist/node/core/getTypeFromEntity.js.map +1 -1
  91. package/dist/node/core/schemas/internal/getEditorSchemas.js +10 -0
  92. package/dist/node/core/schemas/internal/getEditorSchemas.js.map +1 -1
  93. package/dist/node/core/schemas/types.js +2 -0
  94. package/dist/node/core/schemas/types.js.map +1 -1
  95. package/dist/node/core/types/HubEntityType.js +1 -0
  96. package/dist/node/core/types/HubEntityType.js.map +1 -1
  97. package/dist/node/core/types/IHubSurvey.js +3 -0
  98. package/dist/node/core/types/IHubSurvey.js.map +1 -0
  99. package/dist/node/core/types/index.js +1 -0
  100. package/dist/node/core/types/index.js.map +1 -1
  101. package/dist/node/discussions/HubDiscussion.js +1 -1
  102. package/dist/node/discussions/api/settings/getDefaultEntitySettings.js +1 -0
  103. package/dist/node/discussions/api/settings/getDefaultEntitySettings.js.map +1 -1
  104. package/dist/node/index.js +1 -1
  105. package/dist/node/index.js.map +1 -1
  106. package/dist/node/permissions/HubPermissionPolicies.js +2 -0
  107. package/dist/node/permissions/HubPermissionPolicies.js.map +1 -1
  108. package/dist/node/permissions/types/Permission.js +2 -0
  109. package/dist/node/permissions/types/Permission.js.map +1 -1
  110. package/dist/node/sites/HubSites.js +1 -0
  111. package/dist/node/sites/HubSites.js.map +1 -1
  112. package/dist/node/sites/_internal/ensureBaseTelemetry.js +25 -0
  113. package/dist/node/sites/_internal/ensureBaseTelemetry.js.map +1 -0
  114. package/dist/node/sites/upgrade-site-schema.js +2 -0
  115. package/dist/node/sites/upgrade-site-schema.js.map +1 -1
  116. package/dist/node/surveys/HubSurvey.js +134 -0
  117. package/dist/node/surveys/HubSurvey.js.map +1 -0
  118. package/dist/node/surveys/_internal/SurveyBusinessRules.js +76 -0
  119. package/dist/node/surveys/_internal/SurveyBusinessRules.js.map +1 -0
  120. package/dist/node/surveys/_internal/SurveySchema.js +21 -0
  121. package/dist/node/surveys/_internal/SurveySchema.js.map +1 -0
  122. package/dist/node/surveys/_internal/SurveyUiSchemaEdit.js +111 -0
  123. package/dist/node/surveys/_internal/SurveyUiSchemaEdit.js.map +1 -0
  124. package/dist/node/surveys/_internal/SurveyUiSchemaSettings.js +63 -0
  125. package/dist/node/surveys/_internal/SurveyUiSchemaSettings.js.map +1 -0
  126. package/dist/node/surveys/_internal/computeProps.js +39 -0
  127. package/dist/node/surveys/_internal/computeProps.js.map +1 -0
  128. package/dist/node/surveys/_internal/getPropertyMap.js +16 -0
  129. package/dist/node/surveys/_internal/getPropertyMap.js.map +1 -0
  130. package/dist/node/surveys/constants.js +5 -0
  131. package/dist/node/surveys/constants.js.map +1 -0
  132. package/dist/node/surveys/defaults.js +12 -0
  133. package/dist/node/surveys/defaults.js.map +1 -0
  134. package/dist/node/surveys/edit.js +54 -0
  135. package/dist/node/surveys/edit.js.map +1 -0
  136. package/dist/node/surveys/fetch.js +50 -0
  137. package/dist/node/surveys/fetch.js.map +1 -0
  138. package/dist/node/surveys/index.js +6 -5
  139. package/dist/node/surveys/index.js.map +1 -1
  140. package/dist/node/surveys/types.js +3 -0
  141. package/dist/node/surveys/types.js.map +1 -0
  142. package/dist/node/surveys/utils/decode-form.js +38 -0
  143. package/dist/node/surveys/utils/decode-form.js.map +1 -0
  144. package/dist/node/surveys/utils/get-form-info-json.js +15 -0
  145. package/dist/node/surveys/utils/get-form-info-json.js.map +1 -0
  146. package/dist/node/surveys/utils/get-form-json.js +68 -0
  147. package/dist/node/surveys/utils/get-form-json.js.map +1 -0
  148. package/dist/node/surveys/utils/get-input-feature-service-model.js.map +1 -0
  149. package/dist/node/surveys/utils/get-map-question.js +34 -0
  150. package/dist/node/surveys/utils/get-map-question.js.map +1 -0
  151. package/dist/node/surveys/utils/get-source-feature-service-model-from-fieldworker.js.map +1 -0
  152. package/dist/node/surveys/utils/get-stakeholder-model.js.map +1 -0
  153. package/dist/node/surveys/utils/get-survey-models.js.map +1 -0
  154. package/dist/node/surveys/utils/has-map-question.js +14 -0
  155. package/dist/node/surveys/utils/has-map-question.js.map +1 -0
  156. package/dist/node/surveys/utils/index.js +19 -0
  157. package/dist/node/surveys/utils/index.js.map +1 -0
  158. package/dist/node/surveys/utils/is-fieldworker-view.js.map +1 -0
  159. package/dist/node/surveys/utils/is-map-question.js +19 -0
  160. package/dist/node/surveys/utils/is-map-question.js.map +1 -0
  161. package/dist/node/surveys/utils/is-page-question.js +12 -0
  162. package/dist/node/surveys/utils/is-page-question.js.map +1 -0
  163. package/dist/node/surveys/utils/is-survey123-connect.js +19 -0
  164. package/dist/node/surveys/utils/is-survey123-connect.js.map +1 -0
  165. package/dist/node/surveys/utils/set-display-map-keyword.js +19 -0
  166. package/dist/node/surveys/utils/set-display-map-keyword.js.map +1 -0
  167. package/dist/node/surveys/utils/should-display-map.js +13 -0
  168. package/dist/node/surveys/utils/should-display-map.js.map +1 -0
  169. package/dist/types/core/schemas/types.d.ts +17 -2
  170. package/dist/types/core/types/HubEntity.d.ts +2 -1
  171. package/dist/types/core/types/HubEntityType.d.ts +1 -1
  172. package/dist/types/core/types/IHubSurvey.d.ts +11 -0
  173. package/dist/types/core/types/index.d.ts +1 -0
  174. package/dist/types/index.d.ts +1 -1
  175. package/dist/types/permissions/types/Permission.d.ts +2 -1
  176. package/dist/types/sites/_internal/ensureBaseTelemetry.d.ts +9 -0
  177. package/dist/types/surveys/HubSurvey.d.ts +50 -0
  178. package/dist/types/surveys/_internal/SurveyBusinessRules.d.ts +12 -0
  179. package/dist/types/surveys/_internal/SurveySchema.d.ts +7 -0
  180. package/dist/types/surveys/_internal/SurveyUiSchemaEdit.d.ts +10 -0
  181. package/dist/types/surveys/_internal/SurveyUiSchemaSettings.d.ts +10 -0
  182. package/dist/types/surveys/_internal/computeProps.d.ts +12 -0
  183. package/dist/types/surveys/_internal/getPropertyMap.d.ts +8 -0
  184. package/dist/types/surveys/constants.d.ts +1 -0
  185. package/dist/types/surveys/defaults.d.ts +3 -0
  186. package/dist/types/surveys/edit.d.ts +17 -0
  187. package/dist/types/surveys/fetch.d.ts +20 -0
  188. package/dist/types/surveys/index.d.ts +6 -5
  189. package/dist/types/surveys/types.d.ts +15 -0
  190. package/dist/types/surveys/utils/decode-form.d.ts +8 -0
  191. package/dist/types/surveys/utils/get-form-info-json.d.ts +9 -0
  192. package/dist/types/surveys/utils/get-form-json.d.ts +8 -0
  193. package/dist/types/surveys/{get-input-feature-service-model.d.ts → utils/get-input-feature-service-model.d.ts} +1 -1
  194. package/dist/types/surveys/utils/get-map-question.d.ts +7 -0
  195. package/dist/types/surveys/{get-source-feature-service-model-from-fieldworker.d.ts → utils/get-source-feature-service-model-from-fieldworker.d.ts} +1 -1
  196. package/dist/types/surveys/{get-stakeholder-model.d.ts → utils/get-stakeholder-model.d.ts} +1 -1
  197. package/dist/types/surveys/{get-survey-models.d.ts → utils/get-survey-models.d.ts} +1 -1
  198. package/dist/types/surveys/utils/has-map-question.d.ts +8 -0
  199. package/dist/types/surveys/utils/index.d.ts +15 -0
  200. package/dist/types/surveys/utils/is-map-question.d.ts +7 -0
  201. package/dist/types/surveys/utils/is-page-question.d.ts +7 -0
  202. package/dist/types/surveys/utils/is-survey123-connect.d.ts +8 -0
  203. package/dist/types/surveys/utils/set-display-map-keyword.d.ts +7 -0
  204. package/dist/types/surveys/utils/should-display-map.d.ts +7 -0
  205. package/package.json +1 -1
  206. package/dist/esm/surveys/get-input-feature-service-model.js.map +0 -1
  207. package/dist/esm/surveys/get-source-feature-service-model-from-fieldworker.js.map +0 -1
  208. package/dist/esm/surveys/get-stakeholder-model.js.map +0 -1
  209. package/dist/esm/surveys/get-survey-models.js.map +0 -1
  210. package/dist/esm/surveys/is-fieldworker-view.js.map +0 -1
  211. package/dist/node/surveys/get-input-feature-service-model.js.map +0 -1
  212. package/dist/node/surveys/get-source-feature-service-model-from-fieldworker.js.map +0 -1
  213. package/dist/node/surveys/get-stakeholder-model.js.map +0 -1
  214. package/dist/node/surveys/get-survey-models.js.map +0 -1
  215. package/dist/node/surveys/is-fieldworker-view.js.map +0 -1
  216. /package/dist/esm/surveys/{get-input-feature-service-model.js → utils/get-input-feature-service-model.js} +0 -0
  217. /package/dist/esm/surveys/{get-source-feature-service-model-from-fieldworker.js → utils/get-source-feature-service-model-from-fieldworker.js} +0 -0
  218. /package/dist/esm/surveys/{get-stakeholder-model.js → utils/get-stakeholder-model.js} +0 -0
  219. /package/dist/esm/surveys/{get-survey-models.js → utils/get-survey-models.js} +0 -0
  220. /package/dist/esm/surveys/{is-fieldworker-view.js → utils/is-fieldworker-view.js} +0 -0
  221. /package/dist/node/surveys/{get-input-feature-service-model.js → utils/get-input-feature-service-model.js} +0 -0
  222. /package/dist/node/surveys/{get-source-feature-service-model-from-fieldworker.js → utils/get-source-feature-service-model-from-fieldworker.js} +0 -0
  223. /package/dist/node/surveys/{get-stakeholder-model.js → utils/get-stakeholder-model.js} +0 -0
  224. /package/dist/node/surveys/{get-survey-models.js → utils/get-survey-models.js} +0 -0
  225. /package/dist/node/surveys/{is-fieldworker-view.js → utils/is-fieldworker-view.js} +0 -0
  226. /package/dist/types/surveys/{is-fieldworker-view.d.ts → utils/is-fieldworker-view.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"upgrade-site-schema.js","sourceRoot":"","sources":["../../../src/sites/upgrade-site-schema.ts"],"names":[],"mappings":";;;AACA,wCAAqC;AACrC,+DAA4D;AAC5D,uEAAkE;AAClE,uFAAkF;AAClF,iEAA6D;AAC7D,6FAAsF;AACtF,qEAAiE;AACjE,2EAAsE;AACtE,mGAA4F;AAC5F,sHAAmH;AACnH,qFAAgF;AAChF,qEAAkE;AAElE;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,KAAa;IAC7C,wDAAwD;IACxD,wDAAwD;IACxD,kEAAkE;IAClE,wBAAwB;IACxB,kEAAkE;IAClE,IAAI,iBAAO,CAAC,KAAK,EAAE,+BAA+B,CAAC,KAAK,yCAAmB,EAAE;QAC3E,sCAAsC;QACtC,KAAK,GAAG,qCAAgB,CAAC,KAAK,CAAC,CAAC;QAChC,KAAK,GAAG,qDAAwB,CAAC,KAAK,CAAC,CAAC;QACxC,KAAK,GAAG,gCAAc,CAAC,KAAK,CAAC,CAAC;QAC9B,KAAK,GAAG,yDAAyB,CAAC,KAAK,CAAC,CAAC;QACzC,KAAK,GAAG,oCAAgB,CAAS,KAAK,CAAC,CAAC;QACxC,KAAK,GAAG,yCAAkB,CAAC,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,CAAC;KACxC;IAED,+BAA+B;IAC/B,KAAK,GAAG,qCAAiB,CAAC,KAAK,CAAC,CAAC;IACjC,KAAK,GAAG,yCAAmB,CAAC,KAAK,CAAC,CAAC;IACnC,OAAO,KAAK,CAAC;AACf,CAAC;AAvBD,8CAuBC"}
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HubSurvey = void 0;
4
+ const HubItemEntity_1 = require("../core/HubItemEntity");
5
+ const enrichEntity_1 = require("../core/enrichEntity");
6
+ const getEditorConfig_1 = require("../core/schemas/getEditorConfig");
7
+ const defaults_1 = require("./defaults");
8
+ const util_1 = require("../util");
9
+ const edit_1 = require("./edit");
10
+ /**
11
+ * Hub Survey Class
12
+ */
13
+ class HubSurvey extends HubItemEntity_1.HubItemEntity {
14
+ /**
15
+ * Create an instance from a HubSurvey object
16
+ * @param json - JSON object to create a HubSurvey from
17
+ * @param context - ArcGIS context
18
+ * @returns
19
+ */
20
+ static fromJson(json, context) {
21
+ // merge what we have with the default values
22
+ const pojo = this.applyDefaults(json, context);
23
+ return new HubSurvey(pojo, context);
24
+ }
25
+ static applyDefaults(partialSurvey, context) {
26
+ // ensure we have the orgUrlKey
27
+ if (!partialSurvey.orgUrlKey) {
28
+ partialSurvey.orgUrlKey = context.portal.urlKey;
29
+ }
30
+ // extend the partial over the defaults
31
+ const pojo = Object.assign(Object.assign({}, defaults_1.DEFAULT_SURVEY), partialSurvey);
32
+ return pojo;
33
+ }
34
+ /**
35
+ * Apply a new state to the instance
36
+ * @param changes A partial IHubSurvey
37
+ */
38
+ update(changes) {
39
+ if (this.isDestroyed) {
40
+ throw new Error("HubSurvey is already destroyed.");
41
+ }
42
+ // merge partial onto existing entity
43
+ this.entity = Object.assign(Object.assign({}, this.entity), changes);
44
+ }
45
+ /**
46
+ * Save the class instance
47
+ */
48
+ async save() {
49
+ if (this.isDestroyed) {
50
+ throw new Error("HubSurvey is already destroyed.");
51
+ }
52
+ if (this.entity.id) {
53
+ // update it
54
+ this.entity = await edit_1.updateSurvey(this.entity, this.context.userRequestOptions);
55
+ }
56
+ // call the after save hook on superclass
57
+ await super.afterSave();
58
+ return;
59
+ }
60
+ /**
61
+ * Delete the HubSurvey object from the store
62
+ * set a flag to indicate that it is destroyed
63
+ * @returns a promise
64
+ */
65
+ async delete() {
66
+ if (this.isDestroyed) {
67
+ throw new Error("HubSurvey is already destroyed.");
68
+ }
69
+ this.isDestroyed = true;
70
+ // Delegate to module fn
71
+ await edit_1.deleteSurvey(this.entity.id, this.context.userRequestOptions);
72
+ }
73
+ /*
74
+ * Get the editor config for the HubSurvey entity.
75
+ * @param i18nScope translation scope to be interpolated into the uiSchema
76
+ * @param type editor type - corresonds to the returned uiSchema
77
+ */
78
+ getEditorConfig(i18nScope, type) {
79
+ // delegate to the schema subsystem
80
+ return getEditorConfig_1.getEditorConfig(i18nScope, type, this.entity, this.context);
81
+ }
82
+ /**
83
+ * Return the Survey object as an editor object
84
+ * @param editorContext
85
+ * @param include
86
+ * @returns
87
+ */
88
+ async toEditor(editorContext, include = []) {
89
+ // 1. optionally enrich entity and cast to editor
90
+ const editor = include.length
91
+ ? (await enrichEntity_1.enrichEntity(util_1.cloneObject(this.entity), include, this.context.hubRequestOptions))
92
+ : util_1.cloneObject(this.entity);
93
+ // 2. Apply transforms to relevant entity values so they
94
+ // can be consumed by the editor
95
+ return editor;
96
+ }
97
+ /**
98
+ * Load the Survey object from the editor object
99
+ * @param editor
100
+ * @param editorContext
101
+ * @returns IHubSurvey
102
+ */
103
+ async fromEditor(editor, editorContext) {
104
+ var _a;
105
+ // Setting the thumbnailCache will ensure that
106
+ // the thumbnail is updated on next save
107
+ if (editor._thumbnail) {
108
+ if (editor._thumbnail.blob) {
109
+ this.thumbnailCache = {
110
+ file: editor._thumbnail.blob,
111
+ filename: editor._thumbnail.fileName,
112
+ clear: false,
113
+ };
114
+ }
115
+ else {
116
+ this.thumbnailCache = {
117
+ clear: true,
118
+ };
119
+ }
120
+ }
121
+ delete editor._thumbnail;
122
+ // convert back to an entity. Apply any reverse transforms used in
123
+ // of the toEditor method
124
+ const entity = util_1.cloneObject(editor);
125
+ // copy the location extent up one level
126
+ entity.extent = (_a = editor.location) === null || _a === void 0 ? void 0 : _a.extent;
127
+ // Save, which will also create new content if new
128
+ this.entity = entity;
129
+ await this.save();
130
+ return this.entity;
131
+ }
132
+ }
133
+ exports.HubSurvey = HubSurvey;
134
+ //# sourceMappingURL=HubSurvey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HubSurvey.js","sourceRoot":"","sources":["../../../src/surveys/HubSurvey.ts"],"names":[],"mappings":";;;AACA,yDAAsD;AAEtD,uDAAoD;AACpD,qEAAkE;AAGlE,yCAA4C;AAM5C,kCAAsC;AAEtC,iCAAoD;AAEpD;;GAEG;AACH,MAAa,SACX,SAAQ,6BAAyB;IAGjC;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CACb,IAAyB,EACzB,OAAuB;QAEvB,6CAA6C;QAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC/C,OAAO,IAAI,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;IAEO,MAAM,CAAC,aAAa,CAC1B,aAAkC,EAClC,OAAuB;QAEvB,+BAA+B;QAC/B,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE;YAC5B,aAAa,CAAC,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;SACjD;QACD,uCAAuC;QACvC,MAAM,IAAI,GAAG,gCAAK,yBAAc,GAAK,aAAa,CAAgB,CAAC;QACnE,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,OAA4B;QACjC,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;SACpD;QACD,qCAAqC;QACrC,IAAI,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,CAAE,kBAAW,CAAC,IAAI,CAAC,MAAM,CAAsB,CAAC;QAEnD,wDAAwD;QACxD,gCAAgC;QAChC,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,UAAU,CACd,MAAuB,EACvB,aAAoC;;QAEpC,8CAA8C;QAC9C,wCAAwC;QACxC,IAAI,MAAM,CAAC,UAAU,EAAE;YACrB,IAAI,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE;gBAC1B,IAAI,CAAC,cAAc,GAAG;oBACpB,IAAI,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI;oBAC5B,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,QAAQ;oBACpC,KAAK,EAAE,KAAK;iBACb,CAAC;aACH;iBAAM;gBACL,IAAI,CAAC,cAAc,GAAG;oBACpB,KAAK,EAAE,IAAI;iBACZ,CAAC;aACH;SACF;QAED,OAAO,MAAM,CAAC,UAAU,CAAC;QAEzB,kEAAkE;QAClE,yBAAyB;QACzB,MAAM,MAAM,GAAG,kBAAW,CAAC,MAAM,CAAe,CAAC;QAEjD,wCAAwC;QACxC,MAAM,CAAC,MAAM,SAAG,MAAM,CAAC,QAAQ,0CAAE,MAAM,CAAC;QAExC,kDAAkD;QAClD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QAElB,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AA9JD,8BA8JC"}
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SurveyPermissionPolicies = exports.SurveyPermissions = void 0;
4
+ /**
5
+ * survey Permission Policies
6
+ * These define the requirements any user must meet to perform related actions
7
+ * @private
8
+ */
9
+ exports.SurveyPermissions = [
10
+ "hub:survey",
11
+ "hub:survey:create",
12
+ "hub:survey:delete",
13
+ "hub:survey:edit",
14
+ "hub:survey:view",
15
+ "hub:survey:workspace",
16
+ "hub:survey:workspace:dashboard",
17
+ "hub:survey:workspace:details",
18
+ "hub:survey:workspace:settings",
19
+ "hub:survey:manage",
20
+ ];
21
+ /**
22
+ * Survey permission policies
23
+ * @private
24
+ */
25
+ exports.SurveyPermissionPolicies = [
26
+ {
27
+ permission: "hub:survey",
28
+ services: ["portal"],
29
+ // gated for now
30
+ availability: ["alpha"],
31
+ environments: ["devext", "qaext"],
32
+ },
33
+ {
34
+ permission: "hub:survey:view",
35
+ dependencies: ["hub:survey"],
36
+ },
37
+ {
38
+ permission: "hub:survey:create",
39
+ authenticated: true,
40
+ dependencies: ["hub:survey"],
41
+ entityEdit: true,
42
+ },
43
+ {
44
+ permission: "hub:survey:edit",
45
+ authenticated: true,
46
+ dependencies: ["hub:survey"],
47
+ entityEdit: true,
48
+ },
49
+ {
50
+ permission: "hub:survey:delete",
51
+ authenticated: true,
52
+ dependencies: ["hub:survey"],
53
+ entityOwner: true,
54
+ },
55
+ {
56
+ permission: "hub:survey:workspace",
57
+ dependencies: ["hub:feature:workspace"],
58
+ },
59
+ {
60
+ permission: "hub:survey:workspace:dashboard",
61
+ dependencies: ["hub:survey:workspace", "hub:survey:view"],
62
+ },
63
+ {
64
+ permission: "hub:survey:workspace:details",
65
+ dependencies: ["hub:survey:workspace", "hub:survey:edit"],
66
+ },
67
+ {
68
+ permission: "hub:survey:workspace:settings",
69
+ dependencies: ["hub:survey:workspace", "hub:survey:edit"],
70
+ },
71
+ {
72
+ permission: "hub:survey:manage",
73
+ dependencies: ["hub:survey:edit"],
74
+ },
75
+ ];
76
+ //# sourceMappingURL=SurveyBusinessRules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SurveyBusinessRules.js","sourceRoot":"","sources":["../../../../src/surveys/_internal/SurveyBusinessRules.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACU,QAAA,iBAAiB,GAAG;IAC/B,YAAY;IACZ,mBAAmB;IACnB,mBAAmB;IACnB,iBAAiB;IACjB,iBA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(exports, "__esModule", { value: true });
3
+ exports.SurveySchema = exports.SurveyEditorTypes = void 0;
4
+ const HubItemEntitySchema_1 = require("../../core/schemas/shared/HubItemEntitySchema");
5
+ exports.SurveyEditorTypes = [
6
+ "hub:survey:edit",
7
+ "hub:survey:settings",
8
+ ];
9
+ /**
10
+ * defines the JSON schema for a Survey entity's editable fields
11
+ */
12
+ exports.SurveySchema = Object.assign(Object.assign({}, HubItemEntitySchema_1.HubItemEntitySchema), { properties: Object.assign({ displayMap: {
13
+ type: "boolean",
14
+ enum: [true, false],
15
+ default: false,
16
+ }, hasMapQuestion: {
17
+ type: "boolean",
18
+ enum: [true, false],
19
+ default: false,
20
+ } }, HubItemEntitySchema_1.HubItemEntitySchema.properties) });
21
+ //# sourceMappingURL=SurveySchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SurveySchema.js","sourceRoot":"","sources":["../../../../src/surveys/_internal/SurveySchema.ts"],"names":[],"mappings":";;;AAAA,uFAAoF;AAIvE,QAAA,iBAAiB,GAAG;IAC/B,iBAAiB;IACjB,qBAAqB;CACb,CAAC;AAEX;;GAEG;AACU,QAAA,YAAY,GAAyB,gCAC7C,yCAAmB,KACtB,UAAU,kBACR,UAAU,EAAE;YACV,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC;YACnB,OAAO,EAAE,KAAK;SACf,EACD,cAAc,EAAE;YACd,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC;YACnB,OAAO,EAAE,KAAK;SACf,IACE,yCAAmB,CAAC,UAAU,IAEZ,CAAC"}
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildUiSchema = void 0;
4
+ const getCategoryItems_1 = require("../../core/schemas/internal/getCategoryItems");
5
+ const getTagItems_1 = require("../../core/schemas/internal/getTagItems");
6
+ const getThumbnailUiSchemaElement_1 = require("../../core/schemas/internal/getThumbnailUiSchemaElement");
7
+ /**
8
+ * @private
9
+ * constructs the complete edit uiSchema for Hub Survey.
10
+ * This defines how the schema properties should be
11
+ * rendered in the survey editing experience
12
+ */
13
+ exports.buildUiSchema = async (i18nScope, options, context) => {
14
+ return {
15
+ type: "Layout",
16
+ elements: [
17
+ {
18
+ type: "Section",
19
+ labelKey: `${i18nScope}.sections.basicInfo.label`,
20
+ elements: [
21
+ {
22
+ labelKey: `${i18nScope}.fields.name.label`,
23
+ scope: "/properties/name",
24
+ type: "Control",
25
+ options: {
26
+ messages: [
27
+ {
28
+ type: "ERROR",
29
+ keyword: "required",
30
+ icon: true,
31
+ labelKey: `${i18nScope}.fields.name.requiredError`,
32
+ },
33
+ {
34
+ type: "ERROR",
35
+ keyword: "maxLength",
36
+ icon: true,
37
+ labelKey: `shared.fields.title.maxLengthError`,
38
+ },
39
+ ],
40
+ },
41
+ },
42
+ {
43
+ labelKey: `${i18nScope}.fields.description.label`,
44
+ scope: "/properties/description",
45
+ type: "Control",
46
+ options: {
47
+ control: "hub-field-input-rich-text",
48
+ type: "textarea",
49
+ helperText: {
50
+ labelKey: `${i18nScope}.fields.description.helperText`,
51
+ },
52
+ },
53
+ },
54
+ {
55
+ labelKey: `${i18nScope}.fields.summary.label`,
56
+ scope: "/properties/summary",
57
+ type: "Control",
58
+ options: {
59
+ control: "hub-field-input-input",
60
+ type: "textarea",
61
+ rows: 4,
62
+ helperText: {
63
+ labelKey: `${i18nScope}.fields.summary.helperText`,
64
+ },
65
+ messages: [
66
+ {
67
+ type: "ERROR",
68
+ keyword: "maxLength",
69
+ icon: true,
70
+ labelKey: `shared.fields.purpose.maxLengthError`,
71
+ },
72
+ ],
73
+ },
74
+ },
75
+ ],
76
+ },
77
+ {
78
+ type: "Section",
79
+ labelKey: `${i18nScope}.sections.searchDiscoverability.label`,
80
+ elements: [
81
+ {
82
+ labelKey: `${i18nScope}.fields.tags.label`,
83
+ scope: "/properties/tags",
84
+ type: "Control",
85
+ options: {
86
+ control: "hub-field-input-combobox",
87
+ items: await getTagItems_1.getTagItems(options.tags, context.portal.id, context.hubRequestOptions),
88
+ allowCustomValues: true,
89
+ selectionMode: "multiple",
90
+ placeholderIcon: "label",
91
+ },
92
+ },
93
+ {
94
+ labelKey: `${i18nScope}.fields.categories.label`,
95
+ scope: "/properties/categories",
96
+ type: "Control",
97
+ options: {
98
+ control: "hub-field-input-combobox",
99
+ items: await getCategoryItems_1.getCategoryItems(context.portal.id, context.hubRequestOptions),
100
+ allowCustomValues: false,
101
+ selectionMode: "multiple",
102
+ placeholderIcon: "select-category",
103
+ },
104
+ },
105
+ getThumbnailUiSchemaElement_1.getThumbnailUiSchemaElement(i18nScope, options.thumbnail, options.thumbnailUrl),
106
+ ],
107
+ },
108
+ ],
109
+ };
110
+ };
111
+ //# sourceMappingURL=SurveyUiSchemaEdit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SurveyUiSchemaEdit.js","sourceRoot":"","sources":["../../../../src/surveys/_internal/SurveyUiSchemaEdit.ts"],"names":[],"mappings":";;;AACA,mFAAgF;AAChF,yEAAsE;AACtE,yGAAsG;AAItG;;;;;GAKG;AACU,QAAA,aAAa,GAAG,KAAK,EAChC,SAAiB,EACjB,OAA4B,EAC5B,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,QAAQ,EAAE,GAAG,SAAS,oBAAoB;wBAC1C,KAAK,EAAE,kBAAkB;wBACzB,IAAI,EAAE,SAAS;wBACf,OAAO,EAAE;4BACP,QAAQ,EAAE;gCACR;oCACE,IAAI,EAAE,OAAO;oCACb,OAAO,EAAE,UAAU;oCACnB,IAAI,EAAE,IAAI;oCACV,QAAQ,EAAE,GAAG,SAAS,4BAA4B;iCACnD;gCACD;oCACE,IAAI,EAAE,OAAO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wBACE,QAAQ,EAAE,GAAG,SAAS,0BAA0B;wBAChD,KAAK,EAAE,wBAAwB;wBAC/B,IAAI,EAAE,SAAS;wBACf,OAAO,EAAE;4BACP,OAAO,EAAE,0BAA0B;4BACnC,KAAK,EAAE,MAAM,mCAAgB,CAC3B,OAAO,CAAC,MAAM,CAAC,EAAE,EACjB,OAAO,CAAC,iBAAiB,CAC1B;4BACD,iBAAiB,EAAE,KAAK;4BACxB,aAAa,EAAE,UAAU;4BACzB,eAAe,EAAE,iBAAiB;yBACnC;qBACF;oBACD,yDAA2B,CACzB,SAAS,EACT,OAAO,CAAC,SAAS,EACjB,OAAO,CAAC,YAAY,CACrB;iBACF;aACF;SACF;KACF,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,63 @@
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
+ * settings uiSchema for Hub Survey - this
8
+ * defines how the schema properties should be
9
+ * rendered in the Survey settings experience
10
+ */
11
+ exports.buildUiSchema = async (i18nScope, options, context) => {
12
+ return {
13
+ type: "Layout",
14
+ elements: [
15
+ {
16
+ type: "Section",
17
+ labelKey: `${i18nScope}.sections.settings.label`,
18
+ elements: [
19
+ {
20
+ labelKey: `${i18nScope}.fields.displayMap.label`,
21
+ scope: "/properties/displayMap",
22
+ type: "Control",
23
+ rule: {
24
+ effect: types_1.UiSchemaRuleEffects.DISABLE,
25
+ condition: {
26
+ scope: "/properties/hasMapQuestion",
27
+ schema: { const: false },
28
+ },
29
+ },
30
+ options: {
31
+ control: "hub-field-input-tile-select",
32
+ type: "radio",
33
+ labels: [
34
+ `{{${i18nScope}.fields.displayMap.enabled.label:translate}}`,
35
+ `{{${i18nScope}.fields.displayMap.disabled.label:translate}}`,
36
+ ],
37
+ descriptions: [
38
+ `{{${i18nScope}.fields.displayMap.enabled.description:translate}}`,
39
+ `{{${i18nScope}.fields.displayMap.disabled.description:translate}}`,
40
+ ],
41
+ icons: ["sidecar", "form-elements"],
42
+ layout: "horizontal",
43
+ messages: options.hasMapQuestion
44
+ ? []
45
+ : [
46
+ {
47
+ type: types_1.UiSchemaMessageTypes.custom,
48
+ display: "notice",
49
+ keyword: "mapQuestion",
50
+ titleKey: `${i18nScope}.fields.displayMap.notice.title`,
51
+ labelKey: `${i18nScope}.fields.displayMap.notice.message`,
52
+ allowShowBeforeInteract: true,
53
+ alwaysShow: true,
54
+ },
55
+ ],
56
+ },
57
+ },
58
+ ],
59
+ },
60
+ ],
61
+ };
62
+ };
63
+ //# sourceMappingURL=SurveyUiSchemaSettings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SurveyUiSchemaSettings.js","sourceRoot":"","sources":["../../../../src/surveys/_internal/SurveyUiSchemaSettings.ts"],"names":[],"mappings":";;;AAEA,oDAIkC;AAGlC;;;;;GAKG;AACU,QAAA,aAAa,GAAG,KAAK,EAChC,SAAiB,EACjB,OAA4B,EAC5B,OAAuB,EACH,EAAE;IACtB,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,SAAS;gBACf,QAAQ,EAAE,GAAG,SAAS,0BAA0B;gBAChD,QAAQ,EAAE;oBACR;wBACE,QAAQ,EAAE,GAAG,SAAS,0BAA0B;wBAChD,KAAK,EAAE,wBAAwB;wBAC/B,IAAI,EAAE,SAAS;wBACf,IAAI,EAAE;4BACJ,MAAM,EAAE,2BAAmB,CAAC,OAAO;4BACnC,SAAS,EAAE;gCACT,KAAK,EAAE,4BAA4B;gCACnC,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE;6BACzB;yBACF;wBACD,OAAO,EAAE;4BACP,OAAO,EAAE,6BAA6B;4BACtC,IAAI,EAAE,OAAO;4BACb,MAAM,EAAE;gCACN,KAAK,SAAS,8CAA8C;gCAC5D,KAAK,SAAS,+CAA+C;6BAC9D;4BACD,YAAY,EAAE;gCACZ,KAAK,SAAS,oDAAoD;gCAClE,KAAK,SAAS,qDAAqD;6BACpE;4BACD,KAAK,EAAE,CAAC,SAAS,EAAE,eAAe,CAAC;4BACnC,MAAM,EAAE,YAAY;4BACpB,QAAQ,EAAG,OAAsB,CAAC,cAAc;gCAC9C,CAAC,CAAC,EAAE;gCACJ,CAAC,CAAC;oCACE;wCACE,IAAI,EAAE,4BAAoB,CAAC,MAAM;wCACjC,OAAO,EAAE,QAAQ;wCACjB,OAAO,EAAE,aAAa;wCACtB,QAAQ,EAAE,GAAG,SAAS,iCAAiC;wCACvD,QAAQ,EAAE,GAAG,SAAS,mCAAmC;wCACzD,uBAAuB,EAAE,IAAI;wCAC7B,UAAU,EAAE,IAAI;qCACjB;iCACF;yBACN;qBACF;iBACF;aACF;SACF;KACF,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.computeProps = void 0;
4
+ const computeBaseProps_1 = require("../../core/_internal/computeBaseProps");
5
+ const get_item_thumbnail_url_1 = require("../../resources/get-item-thumbnail-url");
6
+ const utils_1 = require("../../discussions/utils");
7
+ const has_map_question_1 = require("../utils/has-map-question");
8
+ const should_display_map_1 = require("../utils/should-display-map");
9
+ /**
10
+ * Given a model and a Survey object, set various computed properties that can't be directly mapped
11
+ * @private
12
+ * @param model
13
+ * @param survey
14
+ * @param requestOptions
15
+ * @returns an IHubSurvey object
16
+ */
17
+ function computeProps(model, survey, requestOptions) {
18
+ let token;
19
+ if (requestOptions.authentication) {
20
+ const session = requestOptions.authentication;
21
+ token = session.token;
22
+ }
23
+ // compute base properties on survey object
24
+ survey = computeBaseProps_1.computeBaseProps(model.item, survey);
25
+ // thumbnail url
26
+ survey.thumbnailUrl = get_item_thumbnail_url_1.getItemThumbnailUrl(model.item, requestOptions, token);
27
+ // Handle Dates
28
+ survey.createdDate = new Date(model.item.created);
29
+ survey.createdDateSource = "item.created";
30
+ survey.updatedDate = new Date(model.item.modified);
31
+ survey.updatedDateSource = "item.modified";
32
+ survey.isDiscussable = utils_1.isDiscussable(survey);
33
+ survey.hasMapQuestion = has_map_question_1.hasMapQuestion(model.formJSON.questions);
34
+ survey.displayMap = should_display_map_1.shouldDisplayMap(model.item);
35
+ // cast b/c this takes a partial but returns a full object
36
+ return survey;
37
+ }
38
+ exports.computeProps = computeProps;
39
+ //# sourceMappingURL=computeProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computeProps.js","sourceRoot":"","sources":["../../../../src/surveys/_internal/computeProps.ts"],"names":[],"mappings":";;;AAEA,4EAAyE;AAGzE,mFAA6E;AAC7E,mDAAwD;AACxD,gEAA2D;AAC3D,oEAA+D;AAE/D;;;;;;;GAOG;AACH,SAAgB,YAAY,CAC1B,KAAa,EACb,MAA2B,EAC3B,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;IACD,2CAA2C;IAC3C,MAAM,GAAG,mCAAgB,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAE9C,gBAAgB;IAChB,MAAM,CAAC,YAAY,GAAG,4CAAmB,CAAC,KAAK,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,CAAC,CAAC;IAE7E,eAAe;IACf,MAAM,CAAC,WAAW,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAClD,MAAM,CAAC,iBAAiB,GAAG,cAAc,CAAC;IAC1C,MAAM,CAAC,WAAW,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACnD,MAAM,CAAC,iBAAiB,GAAG,eAAe,CAAC;IAC3C,MAAM,CAAC,aAAa,GAAG,qBAAa,CAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,CAAC,cAAc,GAAG,iCAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACjE,MAAM,CAAC,UAAU,GAAG,qCAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAEjD,0DAA0D;IAC1D,OAAO,MAAoB,CAAC;AAC9B,CAAC;AA3BD,oCA2BC"}
@@ -0,0 +1,16 @@
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
+ * Returns an Array of IPropertyMap objects
7
+ * that define the projection of properties from a IModel to an IHubSurvey object
8
+ * @returns an IPropertyMap array
9
+ * @private
10
+ */
11
+ function getPropertyMap() {
12
+ const map = getBasePropertyMap_1.getBasePropertyMap();
13
+ return map;
14
+ }
15
+ exports.getPropertyMap = getPropertyMap;
16
+ //# sourceMappingURL=getPropertyMap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPropertyMap.js","sourceRoot":"","sources":["../../../../src/surveys/_internal/getPropertyMap.ts"],"names":[],"mappings":";;;AACA,gFAA6E;AAE7E;;;;;GAKG;AACH,SAAgB,cAAc;IAC5B,MAAM,GAAG,GAAG,uCAAkB,EAAE,CAAC;IACjC,OAAO,GAAG,CAAC;AACb,CAAC;AAHD,wCAGC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MAP_SURVEY_TYPEKEYWORD = void 0;
4
+ exports.MAP_SURVEY_TYPEKEYWORD = "hubMapSurvey";
5
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/surveys/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,sBAAsB,GAAG,cAAc,CAAC"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_SURVEY = void 0;
4
+ /** Default values for a new IHubSurvey */
5
+ exports.DEFAULT_SURVEY = {
6
+ schemaVersion: 1,
7
+ catalog: { schemaVersion: 0 },
8
+ name: "",
9
+ tags: [],
10
+ typeKeywords: [],
11
+ };
12
+ //# sourceMappingURL=defaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../src/surveys/defaults.ts"],"names":[],"mappings":";;;AAEA,0CAA0C;AAC7B,QAAA,cAAc,GAAwB;IACjD,aAAa,EAAE,CAAC;IAChB,OAAO,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE;IAC7B,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,EAAE;IACR,YAAY,EAAE,EAAE;CACjB,CAAC"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteSurvey = exports.updateSurvey = void 0;
4
+ const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
5
+ const PropertyMapper_1 = require("../core/_internal/PropertyMapper");
6
+ const computeProps_1 = require("./_internal/computeProps");
7
+ const getPropertyMap_1 = require("./_internal/getPropertyMap");
8
+ const utils_1 = require("../discussions/utils");
9
+ const set_display_map_keyword_1 = require("./utils/set-display-map-keyword");
10
+ const models_1 = require("../models");
11
+ const get_form_json_1 = require("./utils/get-form-json");
12
+ /**
13
+ * @private
14
+ * Update a Hub Survey obejct
15
+ * @param survey the survey to update
16
+ * @param requestOptions user request options
17
+ * @returns promise that resolves a IHubSurvey
18
+ */
19
+ async function updateSurvey(survey, requestOptions) {
20
+ survey.typeKeywords = utils_1.setDiscussableKeyword(survey.typeKeywords, survey.isDiscussable);
21
+ survey.typeKeywords = set_display_map_keyword_1.setDisplayMapKeyword(survey.typeKeywords, survey.displayMap);
22
+ // get the backing item
23
+ const item = await arcgis_rest_portal_1.getItem(survey.id, requestOptions);
24
+ const model = { item };
25
+ model.formJSON = await get_form_json_1.getFormJson(item, requestOptions);
26
+ // create the PropertyMapper
27
+ const mapper = new PropertyMapper_1.PropertyMapper(getPropertyMap_1.getPropertyMap());
28
+ // Note: Although we are fetching the model, and applying changes onto it,
29
+ // we are not attempting to handle "concurrent edit" conflict resolution
30
+ // but this is where we would apply that sort of logic
31
+ const modelToUpdate = mapper.entityToStore(survey, model);
32
+ // update the backing item
33
+ const updatedModel = await models_1.updateModel(modelToUpdate, requestOptions);
34
+ // now map back into a survey and return that
35
+ let updatedSurvey = mapper.storeToEntity(updatedModel, survey);
36
+ updatedSurvey = computeProps_1.computeProps(model, updatedSurvey, requestOptions);
37
+ // the casting is needed because modelToObject returns a `Partial<T>`
38
+ // where as this function returns a `T`
39
+ return updatedSurvey;
40
+ }
41
+ exports.updateSurvey = updateSurvey;
42
+ /**
43
+ * @private
44
+ * Remove a Hub Survey object
45
+ * @param id
46
+ * @param requestOptions
47
+ */
48
+ async function deleteSurvey(id, requestOptions) {
49
+ const ro = Object.assign(Object.assign({}, requestOptions), { id });
50
+ await arcgis_rest_portal_1.removeItem(ro);
51
+ return;
52
+ }
53
+ exports.deleteSurvey = deleteSurvey;
54
+ //# sourceMappingURL=edit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit.js","sourceRoot":"","sources":["../../../src/surveys/edit.ts"],"names":[],"mappings":";;;AACA,iEAIkC;AAClC,qEAAkE;AAClE,2DAAwD;AACxD,+DAA4D;AAE5D,gDAA6D;AAC7D,6EAAuE;AACvE,sCAAwC;AAExC,yDAAoD;AAEpD;;;;;;GAMG;AACI,KAAK,UAAU,YAAY,CAChC,MAAkB,EAClB,cAAmC;IAEnC,MAAM,CAAC,YAAY,GAAG,6BAAqB,CACzC,MAAM,CAAC,YAAY,EACnB,MAAM,CAAC,aAAa,CACrB,CAAC;IACF,MAAM,CAAC,YAAY,GAAG,8CAAoB,CACxC,MAAM,CAAC,YAAY,EACnB,MAAM,CAAC,UAAU,CAClB,CAAC;IACF,uBAAuB;IACvB,MAAM,IAAI,GAAG,MAAM,4BAAO,CAAC,MAAM,CAAC,EAAE,EAAE,cAAc,CAAC,CAAC;IACtD,MAAM,KAAK,GAAW,EAAE,IAAI,EAAE,CAAC;IAC/B,KAAK,CAAC,QAAQ,GAAG,MAAM,2BAAW,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IACzD,4BAA4B;IAC5B,MAAM,MAAM,GAAG,IAAI,+BAAc,CAC/B,+BAAc,EAAE,CACjB,CAAC;IACF,0EAA0E;IAC1E,wEAAwE;IACxE,sDAAsD;IACtD,MAAM,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC1D,0BAA0B;IAC1B,MAAM,YAAY,GAAG,MAAM,oBAAW,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;IACtE,6CAA6C;IAC7C,IAAI,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAC/D,aAAa,GAAG,2BAAY,CAAC,KAAK,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC;IACnE,qEAAqE;IACrE,uCAAuC;IACvC,OAAO,aAA2B,CAAC;AACrC,CAAC;AAhCD,oCAgCC;AAED;;;;;GAKG;AACI,KAAK,UAAU,YAAY,CAChC,EAAU,EACV,cAAmC;IAEnC,MAAM,EAAE,GAAG,gCAAK,cAAc,GAAK,EAAE,EAAE,EAAE,CAAsB,CAAC;IAChE,MAAM,+BAAU,CAAC,EAAE,CAAC,CAAC;IACrB,OAAO;AACT,CAAC;AAPD,oCAOC"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertItemToSurvey = exports.fetchSurvey = void 0;
4
+ const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
5
+ const PropertyMapper_1 = require("../core/_internal/PropertyMapper");
6
+ const computeProps_1 = require("./_internal/computeProps");
7
+ const getPropertyMap_1 = require("./_internal/getPropertyMap");
8
+ const get_form_json_1 = require("./utils/get-form-json");
9
+ const is_guid_1 = require("../utils/is-guid");
10
+ const slugs_1 = require("../items/slugs");
11
+ /**
12
+ * @private
13
+ * Get a Survey entity by id or slug
14
+ * @param identifier item id or slug
15
+ * @param requestOptions request options
16
+ * @returns a promise that resolves a IHubSurvey object
17
+ */
18
+ async function fetchSurvey(identifier, requestOptions) {
19
+ let getPrms;
20
+ if (is_guid_1.isGuid(identifier)) {
21
+ // get item by id
22
+ getPrms = arcgis_rest_portal_1.getItem(identifier, requestOptions);
23
+ }
24
+ else {
25
+ getPrms = slugs_1.getItemBySlug(identifier, requestOptions);
26
+ }
27
+ return getPrms.then((item) => {
28
+ if (!item)
29
+ return null;
30
+ return convertItemToSurvey(item, requestOptions);
31
+ });
32
+ }
33
+ exports.fetchSurvey = fetchSurvey;
34
+ /**
35
+ * @private
36
+ * Convert a Hub Survey Item into a Hub Survey entity, fetching any additional
37
+ * information that may be required
38
+ * @param item the Survey item
39
+ * @param auth request options
40
+ * @returns a promise that resolves a IHubSurvey object
41
+ */
42
+ async function convertItemToSurvey(item, requestOptions) {
43
+ const model = { item };
44
+ model.formJSON = await get_form_json_1.getFormJson(item, requestOptions);
45
+ const mapper = new PropertyMapper_1.PropertyMapper(getPropertyMap_1.getPropertyMap());
46
+ const survey = mapper.storeToEntity(model, {});
47
+ return computeProps_1.computeProps(model, survey, requestOptions);
48
+ }
49
+ exports.convertItemToSurvey = convertItemToSurvey;
50
+ //# sourceMappingURL=fetch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../src/surveys/fetch.ts"],"names":[],"mappings":";;;AAAA,iEAAmD;AAGnD,qEAAkE;AAClE,2DAAwD;AACxD,+DAA4D;AAC5D,yDAAoD;AACpD,8CAA0C;AAE1C,0CAA+C;AAE/C;;;;;;GAMG;AACI,KAAK,UAAU,WAAW,CAC/B,UAAkB,EAClB,cAAkC;IAElC,IAAI,OAAO,CAAC;IACZ,IAAI,gBAAM,CAAC,UAAU,CAAC,EAAE;QACtB,iBAAiB;QACjB,OAAO,GAAG,4BAAO,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;KAC/C;SAAM;QACL,OAAO,GAAG,qBAAa,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;KACrD;IACD,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;QAC3B,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC;QACvB,OAAO,mBAAmB,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;AACL,CAAC;AAfD,kCAeC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,mBAAmB,CACvC,IAAW,EACX,cAAkC;IAElC,MAAM,KAAK,GAAW,EAAE,IAAI,EAAE,CAAC;IAC/B,KAAK,CAAC,QAAQ,GAAG,MAAM,2BAAW,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IACzD,MAAM,MAAM,GAAG,IAAI,+BAAc,CAC/B,+BAAc,EAAE,CACjB,CAAC;IACF,MAAM,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,CAAe,CAAC;IAC7D,OAAO,2BAAY,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC;AACrD,CAAC;AAXD,kDAWC"}