@esri/hub-common 14.98.1 → 14.100.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.
- package/dist/esm/core/EntityEditor.js +4 -0
- package/dist/esm/core/EntityEditor.js.map +1 -1
- package/dist/esm/core/fetchHubEntity.js +4 -0
- package/dist/esm/core/fetchHubEntity.js.map +1 -1
- package/dist/esm/core/getTypeFromEntity.js +3 -0
- package/dist/esm/core/getTypeFromEntity.js.map +1 -1
- package/dist/esm/core/schemas/internal/getEditorSchemas.js +10 -0
- package/dist/esm/core/schemas/internal/getEditorSchemas.js.map +1 -1
- package/dist/esm/core/schemas/types.js +2 -0
- package/dist/esm/core/schemas/types.js.map +1 -1
- package/dist/esm/core/types/HubEntityType.js +1 -0
- package/dist/esm/core/types/HubEntityType.js.map +1 -1
- package/dist/esm/core/types/IHubSurvey.js +1 -0
- package/dist/esm/core/types/IHubSurvey.js.map +1 -0
- package/dist/esm/core/types/index.js +1 -0
- package/dist/esm/core/types/index.js.map +1 -1
- package/dist/esm/discussions/HubDiscussion.js +1 -1
- package/dist/esm/discussions/api/settings/getDefaultEntitySettings.js +1 -0
- package/dist/esm/discussions/api/settings/getDefaultEntitySettings.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/permissions/HubPermissionPolicies.js +2 -0
- package/dist/esm/permissions/HubPermissionPolicies.js.map +1 -1
- package/dist/esm/permissions/types/Permission.js +2 -0
- package/dist/esm/permissions/types/Permission.js.map +1 -1
- package/dist/esm/search/_internal/commonHelpers/getApi.js +1 -1
- package/dist/esm/search/_internal/commonHelpers/getApi.js.map +1 -1
- package/dist/esm/search/_internal/commonHelpers/getOgcApiDefinition.js +10 -5
- package/dist/esm/search/_internal/commonHelpers/getOgcApiDefinition.js.map +1 -1
- package/dist/esm/search/_internal/commonHelpers/shouldUseOgcApi.js +5 -1
- package/dist/esm/search/_internal/commonHelpers/shouldUseOgcApi.js.map +1 -1
- package/dist/esm/search/_internal/hubSearchItemsHelpers/formatOgcItemsResponse.js +18 -0
- package/dist/esm/search/_internal/hubSearchItemsHelpers/formatOgcItemsResponse.js.map +1 -1
- package/dist/esm/search/_internal/hubSearchItemsHelpers/getOgcCollectionUrl.js +5 -0
- package/dist/esm/search/_internal/hubSearchItemsHelpers/getOgcCollectionUrl.js.map +1 -1
- package/dist/esm/search/_internal/hubSearchItemsHelpers/ogcItemToDiscussionPostResult.js +29 -0
- package/dist/esm/search/_internal/hubSearchItemsHelpers/ogcItemToDiscussionPostResult.js.map +1 -0
- package/dist/esm/search/_internal/hubSearchItemsHelpers/ogcItemToSearchResult.js.map +1 -1
- package/dist/esm/search/hubSearch.js +1 -0
- package/dist/esm/search/hubSearch.js.map +1 -1
- package/dist/esm/surveys/HubSurvey.js +130 -0
- package/dist/esm/surveys/HubSurvey.js.map +1 -0
- package/dist/esm/surveys/_internal/SurveyBusinessRules.js +78 -0
- package/dist/esm/surveys/_internal/SurveyBusinessRules.js.map +1 -0
- package/dist/esm/surveys/_internal/SurveySchema.js +18 -0
- package/dist/esm/surveys/_internal/SurveySchema.js.map +1 -0
- package/dist/esm/surveys/_internal/SurveyUiSchemaEdit.js +108 -0
- package/dist/esm/surveys/_internal/SurveyUiSchemaEdit.js.map +1 -0
- package/dist/esm/surveys/_internal/SurveyUiSchemaSettings.js +60 -0
- package/dist/esm/surveys/_internal/SurveyUiSchemaSettings.js.map +1 -0
- package/dist/esm/surveys/_internal/computeProps.js +35 -0
- package/dist/esm/surveys/_internal/computeProps.js.map +1 -0
- package/dist/esm/surveys/_internal/getPropertyMap.js +12 -0
- package/dist/esm/surveys/_internal/getPropertyMap.js.map +1 -0
- package/dist/esm/surveys/constants.js +2 -0
- package/dist/esm/surveys/constants.js.map +1 -0
- package/dist/esm/surveys/defaults.js +9 -0
- package/dist/esm/surveys/defaults.js.map +1 -0
- package/dist/esm/surveys/edit.js +49 -0
- package/dist/esm/surveys/edit.js.map +1 -0
- package/dist/esm/surveys/fetch.js +45 -0
- package/dist/esm/surveys/fetch.js.map +1 -0
- package/dist/esm/surveys/index.js +6 -5
- package/dist/esm/surveys/index.js.map +1 -1
- package/dist/esm/surveys/types.js +1 -0
- package/dist/esm/surveys/types.js.map +1 -0
- package/dist/esm/surveys/utils/decode-form.js +35 -0
- package/dist/esm/surveys/utils/decode-form.js.map +1 -0
- package/dist/esm/surveys/utils/get-form-info-json.js +12 -0
- package/dist/esm/surveys/utils/get-form-info-json.js.map +1 -0
- package/dist/esm/surveys/utils/get-form-json.js +65 -0
- package/dist/esm/surveys/utils/get-form-json.js.map +1 -0
- package/dist/esm/surveys/utils/get-input-feature-service-model.js.map +1 -0
- package/dist/esm/surveys/utils/get-map-question.js +31 -0
- package/dist/esm/surveys/utils/get-map-question.js.map +1 -0
- package/dist/esm/surveys/utils/get-source-feature-service-model-from-fieldworker.js.map +1 -0
- package/dist/esm/surveys/utils/get-stakeholder-model.js.map +1 -0
- package/dist/esm/surveys/utils/get-survey-models.js.map +1 -0
- package/dist/esm/surveys/utils/has-map-question.js +11 -0
- package/dist/esm/surveys/utils/has-map-question.js.map +1 -0
- package/dist/esm/surveys/utils/index.js +16 -0
- package/dist/esm/surveys/utils/index.js.map +1 -0
- package/dist/esm/surveys/utils/is-fieldworker-view.js.map +1 -0
- package/dist/esm/surveys/utils/is-map-question.js +16 -0
- package/dist/esm/surveys/utils/is-map-question.js.map +1 -0
- package/dist/esm/surveys/utils/is-page-question.js +9 -0
- package/dist/esm/surveys/utils/is-page-question.js.map +1 -0
- package/dist/esm/surveys/utils/is-survey123-connect.js +16 -0
- package/dist/esm/surveys/utils/is-survey123-connect.js.map +1 -0
- package/dist/esm/surveys/utils/set-display-map-keyword.js +15 -0
- package/dist/esm/surveys/utils/set-display-map-keyword.js.map +1 -0
- package/dist/esm/surveys/utils/should-display-map.js +10 -0
- package/dist/esm/surveys/utils/should-display-map.js.map +1 -0
- package/dist/node/core/EntityEditor.js +4 -0
- package/dist/node/core/EntityEditor.js.map +1 -1
- package/dist/node/core/fetchHubEntity.js +4 -0
- package/dist/node/core/fetchHubEntity.js.map +1 -1
- package/dist/node/core/getTypeFromEntity.js +3 -0
- package/dist/node/core/getTypeFromEntity.js.map +1 -1
- package/dist/node/core/schemas/internal/getEditorSchemas.js +10 -0
- package/dist/node/core/schemas/internal/getEditorSchemas.js.map +1 -1
- package/dist/node/core/schemas/types.js +2 -0
- package/dist/node/core/schemas/types.js.map +1 -1
- package/dist/node/core/types/HubEntityType.js +1 -0
- package/dist/node/core/types/HubEntityType.js.map +1 -1
- package/dist/node/core/types/IHubSurvey.js +3 -0
- package/dist/node/core/types/IHubSurvey.js.map +1 -0
- package/dist/node/core/types/index.js +1 -0
- package/dist/node/core/types/index.js.map +1 -1
- package/dist/node/discussions/HubDiscussion.js +1 -1
- package/dist/node/discussions/api/settings/getDefaultEntitySettings.js +1 -0
- package/dist/node/discussions/api/settings/getDefaultEntitySettings.js.map +1 -1
- package/dist/node/index.js +1 -1
- package/dist/node/index.js.map +1 -1
- package/dist/node/permissions/HubPermissionPolicies.js +2 -0
- package/dist/node/permissions/HubPermissionPolicies.js.map +1 -1
- package/dist/node/permissions/types/Permission.js +2 -0
- package/dist/node/permissions/types/Permission.js.map +1 -1
- package/dist/node/search/_internal/commonHelpers/getApi.js +1 -1
- package/dist/node/search/_internal/commonHelpers/getApi.js.map +1 -1
- package/dist/node/search/_internal/commonHelpers/getOgcApiDefinition.js +10 -5
- package/dist/node/search/_internal/commonHelpers/getOgcApiDefinition.js.map +1 -1
- package/dist/node/search/_internal/commonHelpers/shouldUseOgcApi.js +5 -1
- package/dist/node/search/_internal/commonHelpers/shouldUseOgcApi.js.map +1 -1
- package/dist/node/search/_internal/hubSearchItemsHelpers/formatOgcItemsResponse.js +19 -1
- package/dist/node/search/_internal/hubSearchItemsHelpers/formatOgcItemsResponse.js.map +1 -1
- package/dist/node/search/_internal/hubSearchItemsHelpers/getOgcCollectionUrl.js +5 -0
- package/dist/node/search/_internal/hubSearchItemsHelpers/getOgcCollectionUrl.js.map +1 -1
- package/dist/node/search/_internal/hubSearchItemsHelpers/ogcItemToDiscussionPostResult.js +33 -0
- package/dist/node/search/_internal/hubSearchItemsHelpers/ogcItemToDiscussionPostResult.js.map +1 -0
- package/dist/node/search/_internal/hubSearchItemsHelpers/ogcItemToSearchResult.js.map +1 -1
- package/dist/node/search/hubSearch.js +1 -0
- package/dist/node/search/hubSearch.js.map +1 -1
- package/dist/node/surveys/HubSurvey.js +134 -0
- package/dist/node/surveys/HubSurvey.js.map +1 -0
- package/dist/node/surveys/_internal/SurveyBusinessRules.js +81 -0
- package/dist/node/surveys/_internal/SurveyBusinessRules.js.map +1 -0
- package/dist/node/surveys/_internal/SurveySchema.js +21 -0
- package/dist/node/surveys/_internal/SurveySchema.js.map +1 -0
- package/dist/node/surveys/_internal/SurveyUiSchemaEdit.js +111 -0
- package/dist/node/surveys/_internal/SurveyUiSchemaEdit.js.map +1 -0
- package/dist/node/surveys/_internal/SurveyUiSchemaSettings.js +63 -0
- package/dist/node/surveys/_internal/SurveyUiSchemaSettings.js.map +1 -0
- package/dist/node/surveys/_internal/computeProps.js +39 -0
- package/dist/node/surveys/_internal/computeProps.js.map +1 -0
- package/dist/node/surveys/_internal/getPropertyMap.js +16 -0
- package/dist/node/surveys/_internal/getPropertyMap.js.map +1 -0
- package/dist/node/surveys/constants.js +5 -0
- package/dist/node/surveys/constants.js.map +1 -0
- package/dist/node/surveys/defaults.js +12 -0
- package/dist/node/surveys/defaults.js.map +1 -0
- package/dist/node/surveys/edit.js +54 -0
- package/dist/node/surveys/edit.js.map +1 -0
- package/dist/node/surveys/fetch.js +50 -0
- package/dist/node/surveys/fetch.js.map +1 -0
- package/dist/node/surveys/index.js +6 -5
- package/dist/node/surveys/index.js.map +1 -1
- package/dist/node/surveys/types.js +3 -0
- package/dist/node/surveys/types.js.map +1 -0
- package/dist/node/surveys/utils/decode-form.js +38 -0
- package/dist/node/surveys/utils/decode-form.js.map +1 -0
- package/dist/node/surveys/utils/get-form-info-json.js +15 -0
- package/dist/node/surveys/utils/get-form-info-json.js.map +1 -0
- package/dist/node/surveys/utils/get-form-json.js +68 -0
- package/dist/node/surveys/utils/get-form-json.js.map +1 -0
- package/dist/node/surveys/utils/get-input-feature-service-model.js.map +1 -0
- package/dist/node/surveys/utils/get-map-question.js +34 -0
- package/dist/node/surveys/utils/get-map-question.js.map +1 -0
- package/dist/node/surveys/utils/get-source-feature-service-model-from-fieldworker.js.map +1 -0
- package/dist/node/surveys/utils/get-stakeholder-model.js.map +1 -0
- package/dist/node/surveys/utils/get-survey-models.js.map +1 -0
- package/dist/node/surveys/utils/has-map-question.js +14 -0
- package/dist/node/surveys/utils/has-map-question.js.map +1 -0
- package/dist/node/surveys/utils/index.js +19 -0
- package/dist/node/surveys/utils/index.js.map +1 -0
- package/dist/node/surveys/utils/is-fieldworker-view.js.map +1 -0
- package/dist/node/surveys/utils/is-map-question.js +19 -0
- package/dist/node/surveys/utils/is-map-question.js.map +1 -0
- package/dist/node/surveys/utils/is-page-question.js +12 -0
- package/dist/node/surveys/utils/is-page-question.js.map +1 -0
- package/dist/node/surveys/utils/is-survey123-connect.js +19 -0
- package/dist/node/surveys/utils/is-survey123-connect.js.map +1 -0
- package/dist/node/surveys/utils/set-display-map-keyword.js +19 -0
- package/dist/node/surveys/utils/set-display-map-keyword.js.map +1 -0
- package/dist/node/surveys/utils/should-display-map.js +13 -0
- package/dist/node/surveys/utils/should-display-map.js.map +1 -0
- package/dist/types/core/schemas/types.d.ts +17 -2
- package/dist/types/core/types/HubEntity.d.ts +2 -1
- package/dist/types/core/types/HubEntityType.d.ts +1 -1
- package/dist/types/core/types/IHubSurvey.d.ts +11 -0
- package/dist/types/core/types/index.d.ts +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/permissions/types/Permission.d.ts +2 -1
- package/dist/types/search/_internal/commonHelpers/getOgcApiDefinition.d.ts +2 -1
- package/dist/types/search/_internal/hubSearchItemsHelpers/formatOgcItemsResponse.d.ts +1 -1
- package/dist/types/search/_internal/hubSearchItemsHelpers/ogcItemToDiscussionPostResult.d.ts +11 -0
- package/dist/types/search/types/IHubCatalog.d.ts +1 -1
- package/dist/types/surveys/HubSurvey.d.ts +50 -0
- package/dist/types/surveys/_internal/SurveyBusinessRules.d.ts +12 -0
- package/dist/types/surveys/_internal/SurveySchema.d.ts +7 -0
- package/dist/types/surveys/_internal/SurveyUiSchemaEdit.d.ts +10 -0
- package/dist/types/surveys/_internal/SurveyUiSchemaSettings.d.ts +10 -0
- package/dist/types/surveys/_internal/computeProps.d.ts +12 -0
- package/dist/types/surveys/_internal/getPropertyMap.d.ts +8 -0
- package/dist/types/surveys/constants.d.ts +1 -0
- package/dist/types/surveys/defaults.d.ts +3 -0
- package/dist/types/surveys/edit.d.ts +17 -0
- package/dist/types/surveys/fetch.d.ts +20 -0
- package/dist/types/surveys/index.d.ts +6 -5
- package/dist/types/surveys/types.d.ts +15 -0
- package/dist/types/surveys/utils/decode-form.d.ts +8 -0
- package/dist/types/surveys/utils/get-form-info-json.d.ts +9 -0
- package/dist/types/surveys/utils/get-form-json.d.ts +8 -0
- package/dist/types/surveys/{get-input-feature-service-model.d.ts → utils/get-input-feature-service-model.d.ts} +1 -1
- package/dist/types/surveys/utils/get-map-question.d.ts +7 -0
- 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
- package/dist/types/surveys/{get-stakeholder-model.d.ts → utils/get-stakeholder-model.d.ts} +1 -1
- package/dist/types/surveys/{get-survey-models.d.ts → utils/get-survey-models.d.ts} +1 -1
- package/dist/types/surveys/utils/has-map-question.d.ts +8 -0
- package/dist/types/surveys/utils/index.d.ts +15 -0
- package/dist/types/surveys/utils/is-map-question.d.ts +7 -0
- package/dist/types/surveys/utils/is-page-question.d.ts +7 -0
- package/dist/types/surveys/utils/is-survey123-connect.d.ts +8 -0
- package/dist/types/surveys/utils/set-display-map-keyword.d.ts +7 -0
- package/dist/types/surveys/utils/should-display-map.d.ts +7 -0
- package/package.json +1 -1
- package/dist/esm/surveys/get-input-feature-service-model.js.map +0 -1
- package/dist/esm/surveys/get-source-feature-service-model-from-fieldworker.js.map +0 -1
- package/dist/esm/surveys/get-stakeholder-model.js.map +0 -1
- package/dist/esm/surveys/get-survey-models.js.map +0 -1
- package/dist/esm/surveys/is-fieldworker-view.js.map +0 -1
- package/dist/node/surveys/get-input-feature-service-model.js.map +0 -1
- package/dist/node/surveys/get-source-feature-service-model-from-fieldworker.js.map +0 -1
- package/dist/node/surveys/get-stakeholder-model.js.map +0 -1
- package/dist/node/surveys/get-survey-models.js.map +0 -1
- package/dist/node/surveys/is-fieldworker-view.js.map +0 -1
- /package/dist/esm/surveys/{get-input-feature-service-model.js → utils/get-input-feature-service-model.js} +0 -0
- /package/dist/esm/surveys/{get-source-feature-service-model-from-fieldworker.js → utils/get-source-feature-service-model-from-fieldworker.js} +0 -0
- /package/dist/esm/surveys/{get-stakeholder-model.js → utils/get-stakeholder-model.js} +0 -0
- /package/dist/esm/surveys/{get-survey-models.js → utils/get-survey-models.js} +0 -0
- /package/dist/esm/surveys/{is-fieldworker-view.js → utils/is-fieldworker-view.js} +0 -0
- /package/dist/node/surveys/{get-input-feature-service-model.js → utils/get-input-feature-service-model.js} +0 -0
- /package/dist/node/surveys/{get-source-feature-service-model-from-fieldworker.js → utils/get-source-feature-service-model-from-fieldworker.js} +0 -0
- /package/dist/node/surveys/{get-stakeholder-model.js → utils/get-stakeholder-model.js} +0 -0
- /package/dist/node/surveys/{get-survey-models.js → utils/get-survey-models.js} +0 -0
- /package/dist/node/surveys/{is-fieldworker-view.js → utils/is-fieldworker-view.js} +0 -0
- /package/dist/types/surveys/{is-fieldworker-view.d.ts → utils/is-fieldworker-view.d.ts} +0 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { HubItemEntity } from "../core/HubItemEntity";
|
|
2
|
+
import { enrichEntity } from "../core/enrichEntity";
|
|
3
|
+
import { getEditorConfig } from "../core/schemas/getEditorConfig";
|
|
4
|
+
import { DEFAULT_SURVEY } from "./defaults";
|
|
5
|
+
import { cloneObject } from "../util";
|
|
6
|
+
import { deleteSurvey, updateSurvey } from "./edit";
|
|
7
|
+
/**
|
|
8
|
+
* Hub Survey Class
|
|
9
|
+
*/
|
|
10
|
+
export class HubSurvey extends HubItemEntity {
|
|
11
|
+
/**
|
|
12
|
+
* Create an instance from a HubSurvey object
|
|
13
|
+
* @param json - JSON object to create a HubSurvey from
|
|
14
|
+
* @param context - ArcGIS context
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
static fromJson(json, context) {
|
|
18
|
+
// merge what we have with the default values
|
|
19
|
+
const pojo = this.applyDefaults(json, context);
|
|
20
|
+
return new HubSurvey(pojo, context);
|
|
21
|
+
}
|
|
22
|
+
static applyDefaults(partialSurvey, context) {
|
|
23
|
+
// ensure we have the orgUrlKey
|
|
24
|
+
if (!partialSurvey.orgUrlKey) {
|
|
25
|
+
partialSurvey.orgUrlKey = context.portal.urlKey;
|
|
26
|
+
}
|
|
27
|
+
// extend the partial over the defaults
|
|
28
|
+
const pojo = Object.assign(Object.assign({}, DEFAULT_SURVEY), partialSurvey);
|
|
29
|
+
return pojo;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Apply a new state to the instance
|
|
33
|
+
* @param changes A partial IHubSurvey
|
|
34
|
+
*/
|
|
35
|
+
update(changes) {
|
|
36
|
+
if (this.isDestroyed) {
|
|
37
|
+
throw new Error("HubSurvey is already destroyed.");
|
|
38
|
+
}
|
|
39
|
+
// merge partial onto existing entity
|
|
40
|
+
this.entity = Object.assign(Object.assign({}, this.entity), changes);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Save the class instance
|
|
44
|
+
*/
|
|
45
|
+
async save() {
|
|
46
|
+
if (this.isDestroyed) {
|
|
47
|
+
throw new Error("HubSurvey is already destroyed.");
|
|
48
|
+
}
|
|
49
|
+
if (this.entity.id) {
|
|
50
|
+
// update it
|
|
51
|
+
this.entity = await updateSurvey(this.entity, this.context.userRequestOptions);
|
|
52
|
+
}
|
|
53
|
+
// call the after save hook on superclass
|
|
54
|
+
await super.afterSave();
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Delete the HubSurvey object from the store
|
|
59
|
+
* set a flag to indicate that it is destroyed
|
|
60
|
+
* @returns a promise
|
|
61
|
+
*/
|
|
62
|
+
async delete() {
|
|
63
|
+
if (this.isDestroyed) {
|
|
64
|
+
throw new Error("HubSurvey is already destroyed.");
|
|
65
|
+
}
|
|
66
|
+
this.isDestroyed = true;
|
|
67
|
+
// Delegate to module fn
|
|
68
|
+
await deleteSurvey(this.entity.id, this.context.userRequestOptions);
|
|
69
|
+
}
|
|
70
|
+
/*
|
|
71
|
+
* Get the editor config for the HubSurvey entity.
|
|
72
|
+
* @param i18nScope translation scope to be interpolated into the uiSchema
|
|
73
|
+
* @param type editor type - corresonds to the returned uiSchema
|
|
74
|
+
*/
|
|
75
|
+
getEditorConfig(i18nScope, type) {
|
|
76
|
+
// delegate to the schema subsystem
|
|
77
|
+
return getEditorConfig(i18nScope, type, this.entity, this.context);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Return the Survey object as an editor object
|
|
81
|
+
* @param editorContext
|
|
82
|
+
* @param include
|
|
83
|
+
* @returns
|
|
84
|
+
*/
|
|
85
|
+
async toEditor(editorContext, include = []) {
|
|
86
|
+
// 1. optionally enrich entity and cast to editor
|
|
87
|
+
const editor = include.length
|
|
88
|
+
? (await enrichEntity(cloneObject(this.entity), include, this.context.hubRequestOptions))
|
|
89
|
+
: cloneObject(this.entity);
|
|
90
|
+
// 2. Apply transforms to relevant entity values so they
|
|
91
|
+
// can be consumed by the editor
|
|
92
|
+
return editor;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Load the Survey object from the editor object
|
|
96
|
+
* @param editor
|
|
97
|
+
* @param editorContext
|
|
98
|
+
* @returns IHubSurvey
|
|
99
|
+
*/
|
|
100
|
+
async fromEditor(editor, editorContext) {
|
|
101
|
+
var _a;
|
|
102
|
+
// Setting the thumbnailCache will ensure that
|
|
103
|
+
// the thumbnail is updated on next save
|
|
104
|
+
if (editor._thumbnail) {
|
|
105
|
+
if (editor._thumbnail.blob) {
|
|
106
|
+
this.thumbnailCache = {
|
|
107
|
+
file: editor._thumbnail.blob,
|
|
108
|
+
filename: editor._thumbnail.fileName,
|
|
109
|
+
clear: false,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
this.thumbnailCache = {
|
|
114
|
+
clear: true,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
delete editor._thumbnail;
|
|
119
|
+
// convert back to an entity. Apply any reverse transforms used in
|
|
120
|
+
// of the toEditor method
|
|
121
|
+
const entity = cloneObject(editor);
|
|
122
|
+
// copy the location extent up one level
|
|
123
|
+
entity.extent = (_a = editor.location) === null || _a === void 0 ? void 0 : _a.extent;
|
|
124
|
+
// Save, which will also create new content if new
|
|
125
|
+
this.entity = entity;
|
|
126
|
+
await this.save();
|
|
127
|
+
return this.entity;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=HubSurvey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HubSurvey.js","sourceRoot":"","sources":["../../../src/surveys/HubSurvey.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAGlE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAM5C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,OAAO,EAAE,YAAY,EAAE,YAAY,EAA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;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,WAAW,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"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* survey Permission Policies
|
|
3
|
+
* These define the requirements any user must meet to perform related actions
|
|
4
|
+
* @private
|
|
5
|
+
*/
|
|
6
|
+
export const SurveyPermissions = [
|
|
7
|
+
"hub:survey",
|
|
8
|
+
"hub:survey:create",
|
|
9
|
+
"hub:survey:delete",
|
|
10
|
+
"hub:survey:edit",
|
|
11
|
+
"hub:survey:view",
|
|
12
|
+
"hub:survey:workspace",
|
|
13
|
+
"hub:survey:workspace:dashboard",
|
|
14
|
+
"hub:survey:workspace:details",
|
|
15
|
+
"hub:survey:workspace:settings",
|
|
16
|
+
"hub:survey:workspace:collaborators",
|
|
17
|
+
"hub:survey:manage",
|
|
18
|
+
];
|
|
19
|
+
/**
|
|
20
|
+
* Survey permission policies
|
|
21
|
+
* @private
|
|
22
|
+
*/
|
|
23
|
+
export const SurveyPermissionPolicies = [
|
|
24
|
+
{
|
|
25
|
+
permission: "hub:survey",
|
|
26
|
+
services: ["portal"],
|
|
27
|
+
// gated for now
|
|
28
|
+
availability: ["alpha"],
|
|
29
|
+
environments: ["devext", "qaext"],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
permission: "hub:survey:view",
|
|
33
|
+
dependencies: ["hub:survey"],
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
permission: "hub:survey:create",
|
|
37
|
+
authenticated: true,
|
|
38
|
+
dependencies: ["hub:survey"],
|
|
39
|
+
entityEdit: true,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
permission: "hub:survey:edit",
|
|
43
|
+
authenticated: true,
|
|
44
|
+
dependencies: ["hub:survey"],
|
|
45
|
+
entityEdit: true,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
permission: "hub:survey:delete",
|
|
49
|
+
authenticated: true,
|
|
50
|
+
dependencies: ["hub:survey"],
|
|
51
|
+
entityOwner: true,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
permission: "hub:survey:workspace",
|
|
55
|
+
dependencies: ["hub:feature:workspace"],
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
permission: "hub:survey:workspace:dashboard",
|
|
59
|
+
dependencies: ["hub:survey:workspace", "hub:survey:view"],
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
permission: "hub:survey:workspace:details",
|
|
63
|
+
dependencies: ["hub:survey:workspace", "hub:survey:edit"],
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
permission: "hub:survey:workspace:settings",
|
|
67
|
+
dependencies: ["hub:survey:workspace", "hub:survey:edit"],
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
permission: "hub:survey:workspace:collaborators",
|
|
71
|
+
dependencies: ["hub:survey:workspace", "hub:survey:edit"],
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
permission: "hub:survey:manage",
|
|
75
|
+
dependencies: ["hub:survey:edit"],
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
//# sourceMappingURL=SurveyBusinessRules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SurveyBusinessRules.js","sourceRoot":"","sources":["../../../../src/surveys/_internal/SurveyBusinessRules.ts"],"names":[],"mappings":"AAEA;;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1D;IACD;QACE,UAAU,EAAE,oCAAoC;QAChD,YAAY,EAAE,CAAC,sBAAsB,EAAE,iBAAiB,CAAC;KAC1D;IACD;QACE,UAAU,EAAE,mBAAmB;QAC/B,YAAY,EAAE,CAAC,iBAAiB,CAAC;KAClC;CACF,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { HubItemEntitySchema } from "../../core/schemas/shared/HubItemEntitySchema";
|
|
2
|
+
export const SurveyEditorTypes = [
|
|
3
|
+
"hub:survey:edit",
|
|
4
|
+
"hub:survey:settings",
|
|
5
|
+
];
|
|
6
|
+
/**
|
|
7
|
+
* defines the JSON schema for a Survey entity's editable fields
|
|
8
|
+
*/
|
|
9
|
+
export const SurveySchema = Object.assign(Object.assign({}, HubItemEntitySchema), { properties: Object.assign({ displayMap: {
|
|
10
|
+
type: "boolean",
|
|
11
|
+
enum: [true, false],
|
|
12
|
+
default: false,
|
|
13
|
+
}, hasMapQuestion: {
|
|
14
|
+
type: "boolean",
|
|
15
|
+
enum: [true, false],
|
|
16
|
+
default: false,
|
|
17
|
+
} }, HubItemEntitySchema.properties) });
|
|
18
|
+
//# sourceMappingURL=SurveySchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SurveySchema.js","sourceRoot":"","sources":["../../../../src/surveys/_internal/SurveySchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AAIpF,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,iBAAiB;IACjB,qBAAqB;CACb,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAyB,gCAC7C,mBAAmB,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,mBAAmB,CAAC,UAAU,IAEZ,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { getCategoryItems } from "../../core/schemas/internal/getCategoryItems";
|
|
2
|
+
import { getTagItems } from "../../core/schemas/internal/getTagItems";
|
|
3
|
+
import { getThumbnailUiSchemaElement } from "../../core/schemas/internal/getThumbnailUiSchemaElement";
|
|
4
|
+
/**
|
|
5
|
+
* @private
|
|
6
|
+
* constructs the complete edit uiSchema for Hub Survey.
|
|
7
|
+
* This defines how the schema properties should be
|
|
8
|
+
* rendered in the survey editing experience
|
|
9
|
+
*/
|
|
10
|
+
export const buildUiSchema = async (i18nScope, options, context) => {
|
|
11
|
+
return {
|
|
12
|
+
type: "Layout",
|
|
13
|
+
elements: [
|
|
14
|
+
{
|
|
15
|
+
type: "Section",
|
|
16
|
+
labelKey: `${i18nScope}.sections.basicInfo.label`,
|
|
17
|
+
elements: [
|
|
18
|
+
{
|
|
19
|
+
labelKey: `${i18nScope}.fields.name.label`,
|
|
20
|
+
scope: "/properties/name",
|
|
21
|
+
type: "Control",
|
|
22
|
+
options: {
|
|
23
|
+
messages: [
|
|
24
|
+
{
|
|
25
|
+
type: "ERROR",
|
|
26
|
+
keyword: "required",
|
|
27
|
+
icon: true,
|
|
28
|
+
labelKey: `${i18nScope}.fields.name.requiredError`,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: "ERROR",
|
|
32
|
+
keyword: "maxLength",
|
|
33
|
+
icon: true,
|
|
34
|
+
labelKey: `shared.fields.title.maxLengthError`,
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
labelKey: `${i18nScope}.fields.description.label`,
|
|
41
|
+
scope: "/properties/description",
|
|
42
|
+
type: "Control",
|
|
43
|
+
options: {
|
|
44
|
+
control: "hub-field-input-rich-text",
|
|
45
|
+
type: "textarea",
|
|
46
|
+
helperText: {
|
|
47
|
+
labelKey: `${i18nScope}.fields.description.helperText`,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
labelKey: `${i18nScope}.fields.summary.label`,
|
|
53
|
+
scope: "/properties/summary",
|
|
54
|
+
type: "Control",
|
|
55
|
+
options: {
|
|
56
|
+
control: "hub-field-input-input",
|
|
57
|
+
type: "textarea",
|
|
58
|
+
rows: 4,
|
|
59
|
+
helperText: {
|
|
60
|
+
labelKey: `${i18nScope}.fields.summary.helperText`,
|
|
61
|
+
},
|
|
62
|
+
messages: [
|
|
63
|
+
{
|
|
64
|
+
type: "ERROR",
|
|
65
|
+
keyword: "maxLength",
|
|
66
|
+
icon: true,
|
|
67
|
+
labelKey: `shared.fields.purpose.maxLengthError`,
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
type: "Section",
|
|
76
|
+
labelKey: `${i18nScope}.sections.searchDiscoverability.label`,
|
|
77
|
+
elements: [
|
|
78
|
+
{
|
|
79
|
+
labelKey: `${i18nScope}.fields.tags.label`,
|
|
80
|
+
scope: "/properties/tags",
|
|
81
|
+
type: "Control",
|
|
82
|
+
options: {
|
|
83
|
+
control: "hub-field-input-combobox",
|
|
84
|
+
items: await getTagItems(options.tags, context.portal.id, context.hubRequestOptions),
|
|
85
|
+
allowCustomValues: true,
|
|
86
|
+
selectionMode: "multiple",
|
|
87
|
+
placeholderIcon: "label",
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
labelKey: `${i18nScope}.fields.categories.label`,
|
|
92
|
+
scope: "/properties/categories",
|
|
93
|
+
type: "Control",
|
|
94
|
+
options: {
|
|
95
|
+
control: "hub-field-input-combobox",
|
|
96
|
+
items: await getCategoryItems(context.portal.id, context.hubRequestOptions),
|
|
97
|
+
allowCustomValues: false,
|
|
98
|
+
selectionMode: "multiple",
|
|
99
|
+
placeholderIcon: "select-category",
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
getThumbnailUiSchemaElement(i18nScope, options.thumbnail, options.thumbnailUrl),
|
|
103
|
+
],
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
//# sourceMappingURL=SurveyUiSchemaEdit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SurveyUiSchemaEdit.js","sourceRoot":"","sources":["../../../../src/surveys/_internal/SurveyUiSchemaEdit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,yDAAyD,CAAC;AAItG;;;;;GAKG;AACH,MAAM,CAAC,MAAM,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;oCACb,OAAO,EAAE,WAAW;oCACpB,IAAI,EAAE,IAAI;oCACV,QAAQ,EAAE,oCAAoC;iCAC/C;6BACF;yBACF;qBACF;oBACD;wBAC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P,OAAO,EAAE,0BAA0B;4BACnC,KAAK,EAAE,MAAM,gBAAgB,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,2BAA2B,CACzB,SAAS,EACT,OAAO,CAAC,SAAS,EACjB,OAAO,CAAC,YAAY,CACrB;iBACF;aACF;SACF;KACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { UiSchemaMessageTypes, UiSchemaRuleEffects, } from "../../core/schemas/types";
|
|
2
|
+
/**
|
|
3
|
+
* @private
|
|
4
|
+
* settings uiSchema for Hub Survey - this
|
|
5
|
+
* defines how the schema properties should be
|
|
6
|
+
* rendered in the Survey settings experience
|
|
7
|
+
*/
|
|
8
|
+
export const buildUiSchema = async (i18nScope, options, context) => {
|
|
9
|
+
return {
|
|
10
|
+
type: "Layout",
|
|
11
|
+
elements: [
|
|
12
|
+
{
|
|
13
|
+
type: "Section",
|
|
14
|
+
labelKey: `${i18nScope}.sections.settings.label`,
|
|
15
|
+
elements: [
|
|
16
|
+
{
|
|
17
|
+
labelKey: `${i18nScope}.fields.displayMap.label`,
|
|
18
|
+
scope: "/properties/displayMap",
|
|
19
|
+
type: "Control",
|
|
20
|
+
rule: {
|
|
21
|
+
effect: UiSchemaRuleEffects.DISABLE,
|
|
22
|
+
condition: {
|
|
23
|
+
scope: "/properties/hasMapQuestion",
|
|
24
|
+
schema: { const: false },
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
options: {
|
|
28
|
+
control: "hub-field-input-tile-select",
|
|
29
|
+
type: "radio",
|
|
30
|
+
labels: [
|
|
31
|
+
`{{${i18nScope}.fields.displayMap.enabled.label:translate}}`,
|
|
32
|
+
`{{${i18nScope}.fields.displayMap.disabled.label:translate}}`,
|
|
33
|
+
],
|
|
34
|
+
descriptions: [
|
|
35
|
+
`{{${i18nScope}.fields.displayMap.enabled.description:translate}}`,
|
|
36
|
+
`{{${i18nScope}.fields.displayMap.disabled.description:translate}}`,
|
|
37
|
+
],
|
|
38
|
+
icons: ["sidecar", "form-elements"],
|
|
39
|
+
layout: "horizontal",
|
|
40
|
+
messages: options.hasMapQuestion
|
|
41
|
+
? []
|
|
42
|
+
: [
|
|
43
|
+
{
|
|
44
|
+
type: UiSchemaMessageTypes.custom,
|
|
45
|
+
display: "notice",
|
|
46
|
+
keyword: "mapQuestion",
|
|
47
|
+
titleKey: `${i18nScope}.fields.displayMap.notice.title`,
|
|
48
|
+
labelKey: `${i18nScope}.fields.displayMap.notice.message`,
|
|
49
|
+
allowShowBeforeInteract: true,
|
|
50
|
+
alwaysShow: true,
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=SurveyUiSchemaSettings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SurveyUiSchemaSettings.js","sourceRoot":"","sources":["../../../../src/surveys/_internal/SurveyUiSchemaSettings.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAGlC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,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,mBAAmB,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,oBAAoB,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,35 @@
|
|
|
1
|
+
import { computeBaseProps } from "../../core/_internal/computeBaseProps";
|
|
2
|
+
import { getItemThumbnailUrl } from "../../resources/get-item-thumbnail-url";
|
|
3
|
+
import { isDiscussable } from "../../discussions/utils";
|
|
4
|
+
import { hasMapQuestion } from "../utils/has-map-question";
|
|
5
|
+
import { shouldDisplayMap } from "../utils/should-display-map";
|
|
6
|
+
/**
|
|
7
|
+
* Given a model and a Survey object, set various computed properties that can't be directly mapped
|
|
8
|
+
* @private
|
|
9
|
+
* @param model
|
|
10
|
+
* @param survey
|
|
11
|
+
* @param requestOptions
|
|
12
|
+
* @returns an IHubSurvey object
|
|
13
|
+
*/
|
|
14
|
+
export function computeProps(model, survey, requestOptions) {
|
|
15
|
+
let token;
|
|
16
|
+
if (requestOptions.authentication) {
|
|
17
|
+
const session = requestOptions.authentication;
|
|
18
|
+
token = session.token;
|
|
19
|
+
}
|
|
20
|
+
// compute base properties on survey object
|
|
21
|
+
survey = computeBaseProps(model.item, survey);
|
|
22
|
+
// thumbnail url
|
|
23
|
+
survey.thumbnailUrl = getItemThumbnailUrl(model.item, requestOptions, token);
|
|
24
|
+
// Handle Dates
|
|
25
|
+
survey.createdDate = new Date(model.item.created);
|
|
26
|
+
survey.createdDateSource = "item.created";
|
|
27
|
+
survey.updatedDate = new Date(model.item.modified);
|
|
28
|
+
survey.updatedDateSource = "item.modified";
|
|
29
|
+
survey.isDiscussable = isDiscussable(survey);
|
|
30
|
+
survey.hasMapQuestion = hasMapQuestion(model.formJSON.questions);
|
|
31
|
+
survey.displayMap = shouldDisplayMap(model.item);
|
|
32
|
+
// cast b/c this takes a partial but returns a full object
|
|
33
|
+
return survey;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=computeProps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computeProps.js","sourceRoot":"","sources":["../../../../src/surveys/_internal/computeProps.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAGzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D;;;;;;;GAOG;AACH,MAAM,UAAU,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,gBAAgB,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAE9C,gBAAgB;IAChB,MAAM,CAAC,YAAY,GAAG,mBAAmB,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,aAAa,CAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,CAAC,cAAc,GAAG,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACjE,MAAM,CAAC,UAAU,GAAG,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAEjD,0DAA0D;IAC1D,OAAO,MAAoB,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getBasePropertyMap } from "../../core/_internal/getBasePropertyMap";
|
|
2
|
+
/**
|
|
3
|
+
* Returns an Array of IPropertyMap objects
|
|
4
|
+
* that define the projection of properties from a IModel to an IHubSurvey object
|
|
5
|
+
* @returns an IPropertyMap array
|
|
6
|
+
* @private
|
|
7
|
+
*/
|
|
8
|
+
export function getPropertyMap() {
|
|
9
|
+
const map = getBasePropertyMap();
|
|
10
|
+
return map;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=getPropertyMap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPropertyMap.js","sourceRoot":"","sources":["../../../../src/surveys/_internal/getPropertyMap.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE7E;;;;;GAKG;AACH,MAAM,UAAU,cAAc;IAC5B,MAAM,GAAG,GAAG,kBAAkB,EAAE,CAAC;IACjC,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/surveys/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../src/surveys/defaults.ts"],"names":[],"mappings":"AAEA,0CAA0C;AAC1C,MAAM,CAAC,MAAM,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,49 @@
|
|
|
1
|
+
import { getItem, removeItem, } from "@esri/arcgis-rest-portal";
|
|
2
|
+
import { PropertyMapper } from "../core/_internal/PropertyMapper";
|
|
3
|
+
import { computeProps } from "./_internal/computeProps";
|
|
4
|
+
import { getPropertyMap } from "./_internal/getPropertyMap";
|
|
5
|
+
import { setDiscussableKeyword } from "../discussions/utils";
|
|
6
|
+
import { setDisplayMapKeyword } from "./utils/set-display-map-keyword";
|
|
7
|
+
import { updateModel } from "../models";
|
|
8
|
+
import { getFormJson } from "./utils/get-form-json";
|
|
9
|
+
/**
|
|
10
|
+
* @private
|
|
11
|
+
* Update a Hub Survey obejct
|
|
12
|
+
* @param survey the survey to update
|
|
13
|
+
* @param requestOptions user request options
|
|
14
|
+
* @returns promise that resolves a IHubSurvey
|
|
15
|
+
*/
|
|
16
|
+
export async function updateSurvey(survey, requestOptions) {
|
|
17
|
+
survey.typeKeywords = setDiscussableKeyword(survey.typeKeywords, survey.isDiscussable);
|
|
18
|
+
survey.typeKeywords = setDisplayMapKeyword(survey.typeKeywords, survey.displayMap);
|
|
19
|
+
// get the backing item
|
|
20
|
+
const item = await getItem(survey.id, requestOptions);
|
|
21
|
+
const model = { item };
|
|
22
|
+
model.formJSON = await getFormJson(item, requestOptions);
|
|
23
|
+
// create the PropertyMapper
|
|
24
|
+
const mapper = new PropertyMapper(getPropertyMap());
|
|
25
|
+
// Note: Although we are fetching the model, and applying changes onto it,
|
|
26
|
+
// we are not attempting to handle "concurrent edit" conflict resolution
|
|
27
|
+
// but this is where we would apply that sort of logic
|
|
28
|
+
const modelToUpdate = mapper.entityToStore(survey, model);
|
|
29
|
+
// update the backing item
|
|
30
|
+
const updatedModel = await updateModel(modelToUpdate, requestOptions);
|
|
31
|
+
// now map back into a survey and return that
|
|
32
|
+
let updatedSurvey = mapper.storeToEntity(updatedModel, survey);
|
|
33
|
+
updatedSurvey = computeProps(model, updatedSurvey, requestOptions);
|
|
34
|
+
// the casting is needed because modelToObject returns a `Partial<T>`
|
|
35
|
+
// where as this function returns a `T`
|
|
36
|
+
return updatedSurvey;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @private
|
|
40
|
+
* Remove a Hub Survey object
|
|
41
|
+
* @param id
|
|
42
|
+
* @param requestOptions
|
|
43
|
+
*/
|
|
44
|
+
export async function deleteSurvey(id, requestOptions) {
|
|
45
|
+
const ro = Object.assign(Object.assign({}, requestOptions), { id });
|
|
46
|
+
await removeItem(ro);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=edit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit.js","sourceRoot":"","sources":["../../../src/surveys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CAAC;IACtE,6CAA6C;IAC7C,IAAI,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAC/D,aAAa,GAAG,YAAY,CAAC,KAAK,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC;IACnE,qEAAqE;IACrE,uCAAuC;IACvC,OAAO,aAA2B,CAAC;AACrC,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,EAAU,EACV,cAAmC;IAEnC,MAAM,EAAE,GAAG,gCAAK,cAAc,GAAK,EAAE,EAAE,EAAE,CAAsB,CAAC;IAChE,MAAM,UAAU,CAAC,EAAE,CAAC,CAAC;IACrB,OAAO;AACT,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { getItem } from "@esri/arcgis-rest-portal";
|
|
2
|
+
import { PropertyMapper } from "../core/_internal/PropertyMapper";
|
|
3
|
+
import { computeProps } from "./_internal/computeProps";
|
|
4
|
+
import { getPropertyMap } from "./_internal/getPropertyMap";
|
|
5
|
+
import { getFormJson } from "./utils/get-form-json";
|
|
6
|
+
import { isGuid } from "../utils/is-guid";
|
|
7
|
+
import { getItemBySlug } from "../items/slugs";
|
|
8
|
+
/**
|
|
9
|
+
* @private
|
|
10
|
+
* Get a Survey entity by id or slug
|
|
11
|
+
* @param identifier item id or slug
|
|
12
|
+
* @param requestOptions request options
|
|
13
|
+
* @returns a promise that resolves a IHubSurvey object
|
|
14
|
+
*/
|
|
15
|
+
export async function fetchSurvey(identifier, requestOptions) {
|
|
16
|
+
let getPrms;
|
|
17
|
+
if (isGuid(identifier)) {
|
|
18
|
+
// get item by id
|
|
19
|
+
getPrms = getItem(identifier, requestOptions);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
getPrms = getItemBySlug(identifier, requestOptions);
|
|
23
|
+
}
|
|
24
|
+
return getPrms.then((item) => {
|
|
25
|
+
if (!item)
|
|
26
|
+
return null;
|
|
27
|
+
return convertItemToSurvey(item, requestOptions);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @private
|
|
32
|
+
* Convert a Hub Survey Item into a Hub Survey entity, fetching any additional
|
|
33
|
+
* information that may be required
|
|
34
|
+
* @param item the Survey item
|
|
35
|
+
* @param auth request options
|
|
36
|
+
* @returns a promise that resolves a IHubSurvey object
|
|
37
|
+
*/
|
|
38
|
+
export async function convertItemToSurvey(item, requestOptions) {
|
|
39
|
+
const model = { item };
|
|
40
|
+
model.formJSON = await getFormJson(item, requestOptions);
|
|
41
|
+
const mapper = new PropertyMapper(getPropertyMap());
|
|
42
|
+
const survey = mapper.storeToEntity(model, {});
|
|
43
|
+
return computeProps(model, survey, requestOptions);
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=fetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../src/surveys/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAGnD,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,UAAkB,EAClB,cAAkC;IAElC,IAAI,OAAO,CAAC;IACZ,IAAI,MAAM,CAAC,UAAU,CAAC,EAAE;QACtB,iBAAiB;QACjB,OAAO,GAAG,OAAO,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;KAC/C;SAAM;QACL,OAAO,GAAG,aAAa,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;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,IAAW,EACX,cAAkC;IAElC,MAAM,KAAK,GAAW,EAAE,IAAI,EAAE,CAAC;IAC/B,KAAK,CAAC,QAAQ,GAAG,MAAM,WAAW,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IACzD,MAAM,MAAM,GAAG,IAAI,cAAc,CAC/B,cAAc,EAAE,CACjB,CAAC;IACF,MAAM,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,CAAe,CAAC;IAC7D,OAAO,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./
|
|
1
|
+
export * from "./HubSurvey";
|
|
2
|
+
export * from "./edit";
|
|
3
|
+
export * from "./fetch";
|
|
4
|
+
export * from "./constants";
|
|
5
|
+
export * from "./types";
|
|
6
|
+
export * from "./utils";
|
|
6
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/surveys/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/surveys/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/surveys/types.ts"],"names":[],"mappings":""}
|