@esri/hub-common 18.12.2 → 18.13.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 +0 -4
- package/dist/esm/core/EntityEditor.js.map +1 -1
- package/dist/esm/core/fetchHubEntity.js +0 -4
- package/dist/esm/core/fetchHubEntity.js.map +1 -1
- package/dist/esm/core/getTypeFromEntity.js +11 -6
- package/dist/esm/core/getTypeFromEntity.js.map +1 -1
- package/dist/esm/core/schemas/internal/getEditorSchemas.js +0 -10
- package/dist/esm/core/schemas/internal/getEditorSchemas.js.map +1 -1
- package/dist/esm/core/schemas/types.js +0 -2
- package/dist/esm/core/schemas/types.js.map +1 -1
- package/dist/esm/core/types/index.js +0 -1
- package/dist/esm/core/types/index.js.map +1 -1
- package/dist/esm/core/updateHubEntity.js +0 -4
- package/dist/esm/core/updateHubEntity.js.map +1 -1
- package/dist/esm/permissions/HubPermissionPolicies.js +0 -2
- package/dist/esm/permissions/HubPermissionPolicies.js.map +1 -1
- package/dist/esm/permissions/types/Permission.js +0 -2
- package/dist/esm/permissions/types/Permission.js.map +1 -1
- package/dist/esm/surveys/index.js +0 -5
- package/dist/esm/surveys/index.js.map +1 -1
- package/dist/esm/surveys/utils/index.js +0 -10
- package/dist/esm/surveys/utils/index.js.map +1 -1
- package/dist/node/core/EntityEditor.js +0 -4
- package/dist/node/core/EntityEditor.js.map +1 -1
- package/dist/node/core/fetchHubEntity.js +6 -10
- package/dist/node/core/fetchHubEntity.js.map +1 -1
- package/dist/node/core/getTypeFromEntity.js +11 -6
- package/dist/node/core/getTypeFromEntity.js.map +1 -1
- package/dist/node/core/schemas/internal/getEditorSchemas.js +0 -10
- package/dist/node/core/schemas/internal/getEditorSchemas.js.map +1 -1
- package/dist/node/core/schemas/types.js +0 -2
- package/dist/node/core/schemas/types.js.map +1 -1
- package/dist/node/core/types/index.js +0 -1
- package/dist/node/core/types/index.js.map +1 -1
- package/dist/node/core/updateHubEntity.js +0 -4
- package/dist/node/core/updateHubEntity.js.map +1 -1
- package/dist/node/permissions/HubPermissionPolicies.js +0 -2
- package/dist/node/permissions/HubPermissionPolicies.js.map +1 -1
- package/dist/node/permissions/types/Permission.js +0 -2
- package/dist/node/permissions/types/Permission.js.map +1 -1
- package/dist/node/surveys/index.js +0 -5
- package/dist/node/surveys/index.js.map +1 -1
- package/dist/node/surveys/utils/index.js +0 -10
- package/dist/node/surveys/utils/index.js.map +1 -1
- package/dist/types/core/schemas/types.d.ts +2 -2
- package/dist/types/core/types/HubEntity.d.ts +1 -2
- package/dist/types/core/types/index.d.ts +0 -1
- package/dist/types/permissions/types/Permission.d.ts +1 -2
- package/dist/types/surveys/index.d.ts +0 -5
- package/dist/types/surveys/utils/index.d.ts +0 -10
- package/package.json +1 -1
- package/dist/esm/core/types/IHubSurvey.js +0 -1
- package/dist/esm/core/types/IHubSurvey.js.map +0 -1
- package/dist/esm/surveys/HubSurvey.js +0 -155
- package/dist/esm/surveys/HubSurvey.js.map +0 -1
- package/dist/esm/surveys/_internal/SurveyBusinessRules.js +0 -124
- package/dist/esm/surveys/_internal/SurveyBusinessRules.js.map +0 -1
- package/dist/esm/surveys/_internal/SurveySchema.js +0 -18
- package/dist/esm/surveys/_internal/SurveySchema.js.map +0 -1
- package/dist/esm/surveys/_internal/SurveyUiSchemaEdit.js +0 -144
- package/dist/esm/surveys/_internal/SurveyUiSchemaEdit.js.map +0 -1
- package/dist/esm/surveys/_internal/SurveyUiSchemaSettings.js +0 -73
- package/dist/esm/surveys/_internal/SurveyUiSchemaSettings.js.map +0 -1
- package/dist/esm/surveys/_internal/computeProps.js +0 -30
- package/dist/esm/surveys/_internal/computeProps.js.map +0 -1
- package/dist/esm/surveys/_internal/getPropertyMap.js +0 -12
- package/dist/esm/surveys/_internal/getPropertyMap.js.map +0 -1
- package/dist/esm/surveys/constants.js +0 -2
- package/dist/esm/surveys/constants.js.map +0 -1
- package/dist/esm/surveys/defaults.js +0 -9
- package/dist/esm/surveys/defaults.js.map +0 -1
- package/dist/esm/surveys/edit.js +0 -49
- package/dist/esm/surveys/edit.js.map +0 -1
- package/dist/esm/surveys/fetch.js +0 -45
- package/dist/esm/surveys/fetch.js.map +0 -1
- package/dist/esm/surveys/types.js +0 -1
- package/dist/esm/surveys/types.js.map +0 -1
- package/dist/esm/surveys/utils/decode-form.js +0 -35
- package/dist/esm/surveys/utils/decode-form.js.map +0 -1
- package/dist/esm/surveys/utils/get-form-info-json.js +0 -12
- package/dist/esm/surveys/utils/get-form-info-json.js.map +0 -1
- package/dist/esm/surveys/utils/get-form-json.js +0 -69
- package/dist/esm/surveys/utils/get-form-json.js.map +0 -1
- package/dist/esm/surveys/utils/get-map-question.js +0 -31
- package/dist/esm/surveys/utils/get-map-question.js.map +0 -1
- package/dist/esm/surveys/utils/has-map-question.js +0 -11
- package/dist/esm/surveys/utils/has-map-question.js.map +0 -1
- package/dist/esm/surveys/utils/is-map-question.js +0 -16
- package/dist/esm/surveys/utils/is-map-question.js.map +0 -1
- package/dist/esm/surveys/utils/is-page-question.js +0 -9
- package/dist/esm/surveys/utils/is-page-question.js.map +0 -1
- package/dist/esm/surveys/utils/is-survey123-connect.js +0 -16
- package/dist/esm/surveys/utils/is-survey123-connect.js.map +0 -1
- package/dist/esm/surveys/utils/set-display-map-keyword.js +0 -15
- package/dist/esm/surveys/utils/set-display-map-keyword.js.map +0 -1
- package/dist/esm/surveys/utils/should-display-map.js +0 -10
- package/dist/esm/surveys/utils/should-display-map.js.map +0 -1
- package/dist/node/core/types/IHubSurvey.js +0 -3
- package/dist/node/core/types/IHubSurvey.js.map +0 -1
- package/dist/node/surveys/HubSurvey.js +0 -159
- package/dist/node/surveys/HubSurvey.js.map +0 -1
- package/dist/node/surveys/_internal/SurveyBusinessRules.js +0 -127
- package/dist/node/surveys/_internal/SurveyBusinessRules.js.map +0 -1
- package/dist/node/surveys/_internal/SurveySchema.js +0 -21
- package/dist/node/surveys/_internal/SurveySchema.js.map +0 -1
- package/dist/node/surveys/_internal/SurveyUiSchemaEdit.js +0 -147
- package/dist/node/surveys/_internal/SurveyUiSchemaEdit.js.map +0 -1
- package/dist/node/surveys/_internal/SurveyUiSchemaSettings.js +0 -76
- package/dist/node/surveys/_internal/SurveyUiSchemaSettings.js.map +0 -1
- package/dist/node/surveys/_internal/computeProps.js +0 -34
- package/dist/node/surveys/_internal/computeProps.js.map +0 -1
- package/dist/node/surveys/_internal/getPropertyMap.js +0 -16
- package/dist/node/surveys/_internal/getPropertyMap.js.map +0 -1
- package/dist/node/surveys/constants.js +0 -5
- package/dist/node/surveys/constants.js.map +0 -1
- package/dist/node/surveys/defaults.js +0 -12
- package/dist/node/surveys/defaults.js.map +0 -1
- package/dist/node/surveys/edit.js +0 -54
- package/dist/node/surveys/edit.js.map +0 -1
- package/dist/node/surveys/fetch.js +0 -50
- package/dist/node/surveys/fetch.js.map +0 -1
- package/dist/node/surveys/types.js +0 -3
- package/dist/node/surveys/types.js.map +0 -1
- package/dist/node/surveys/utils/decode-form.js +0 -38
- package/dist/node/surveys/utils/decode-form.js.map +0 -1
- package/dist/node/surveys/utils/get-form-info-json.js +0 -15
- package/dist/node/surveys/utils/get-form-info-json.js.map +0 -1
- package/dist/node/surveys/utils/get-form-json.js +0 -72
- package/dist/node/surveys/utils/get-form-json.js.map +0 -1
- package/dist/node/surveys/utils/get-map-question.js +0 -34
- package/dist/node/surveys/utils/get-map-question.js.map +0 -1
- package/dist/node/surveys/utils/has-map-question.js +0 -14
- package/dist/node/surveys/utils/has-map-question.js.map +0 -1
- package/dist/node/surveys/utils/is-map-question.js +0 -19
- package/dist/node/surveys/utils/is-map-question.js.map +0 -1
- package/dist/node/surveys/utils/is-page-question.js +0 -12
- package/dist/node/surveys/utils/is-page-question.js.map +0 -1
- package/dist/node/surveys/utils/is-survey123-connect.js +0 -19
- package/dist/node/surveys/utils/is-survey123-connect.js.map +0 -1
- package/dist/node/surveys/utils/set-display-map-keyword.js +0 -19
- package/dist/node/surveys/utils/set-display-map-keyword.js.map +0 -1
- package/dist/node/surveys/utils/should-display-map.js +0 -13
- package/dist/node/surveys/utils/should-display-map.js.map +0 -1
- package/dist/types/core/types/IHubSurvey.d.ts +0 -11
- package/dist/types/surveys/HubSurvey.d.ts +0 -57
- package/dist/types/surveys/_internal/SurveyBusinessRules.d.ts +0 -12
- package/dist/types/surveys/_internal/SurveySchema.d.ts +0 -7
- package/dist/types/surveys/_internal/SurveyUiSchemaEdit.d.ts +0 -10
- package/dist/types/surveys/_internal/SurveyUiSchemaSettings.d.ts +0 -10
- package/dist/types/surveys/_internal/computeProps.d.ts +0 -12
- package/dist/types/surveys/_internal/getPropertyMap.d.ts +0 -8
- package/dist/types/surveys/constants.d.ts +0 -1
- package/dist/types/surveys/defaults.d.ts +0 -3
- package/dist/types/surveys/edit.d.ts +0 -17
- package/dist/types/surveys/fetch.d.ts +0 -20
- package/dist/types/surveys/types.d.ts +0 -15
- package/dist/types/surveys/utils/decode-form.d.ts +0 -8
- package/dist/types/surveys/utils/get-form-info-json.d.ts +0 -9
- package/dist/types/surveys/utils/get-form-json.d.ts +0 -8
- package/dist/types/surveys/utils/get-map-question.d.ts +0 -7
- package/dist/types/surveys/utils/has-map-question.d.ts +0 -8
- package/dist/types/surveys/utils/is-map-question.d.ts +0 -7
- package/dist/types/surveys/utils/is-page-question.d.ts +0 -7
- package/dist/types/surveys/utils/is-survey123-connect.d.ts +0 -8
- package/dist/types/surveys/utils/set-display-map-keyword.d.ts +0 -7
- package/dist/types/surveys/utils/should-display-map.d.ts +0 -7
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.computeProps = void 0;
|
|
4
|
-
const computeItemProps_1 = require("../../core/_internal/computeItemProps");
|
|
5
|
-
const get_item_thumbnail_url_1 = require("../../resources/get-item-thumbnail-url");
|
|
6
|
-
const has_map_question_1 = require("../utils/has-map-question");
|
|
7
|
-
const should_display_map_1 = require("../utils/should-display-map");
|
|
8
|
-
/**
|
|
9
|
-
* Given a model and a Survey object, set various computed properties that can't be directly mapped
|
|
10
|
-
* @private
|
|
11
|
-
* @param model
|
|
12
|
-
* @param survey
|
|
13
|
-
* @param requestOptions
|
|
14
|
-
* @returns an IHubSurvey object
|
|
15
|
-
*/
|
|
16
|
-
function computeProps(model, survey, requestOptions) {
|
|
17
|
-
var _a;
|
|
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 = computeItemProps_1.computeItemProps(model.item, survey);
|
|
25
|
-
// thumbnail url
|
|
26
|
-
survey.thumbnailUrl = get_item_thumbnail_url_1.getItemThumbnailUrl(model.item, requestOptions, token);
|
|
27
|
-
// map props
|
|
28
|
-
survey.hasMapQuestion = has_map_question_1.hasMapQuestion(((_a = model.formJSON) === null || _a === void 0 ? void 0 : _a.questions) || []);
|
|
29
|
-
survey.displayMap = should_display_map_1.shouldDisplayMap(model.item);
|
|
30
|
-
// cast b/c this takes a partial but returns a full object
|
|
31
|
-
return survey;
|
|
32
|
-
}
|
|
33
|
-
exports.computeProps = computeProps;
|
|
34
|
-
//# sourceMappingURL=computeProps.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"computeProps.js","sourceRoot":"","sources":["../../../../src/surveys/_internal/computeProps.ts"],"names":[],"mappings":";;;AAEA,4EAAyE;AAGzE,mFAA6E;AAC7E,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,GACX,cAAc,CAAC,cAAuC,CAAC;QACzD,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,YAAY;IACZ,MAAM,CAAC,cAAc,GAAG,iCAAc,CAAC,OAAA,KAAK,CAAC,QAAQ,0CAAE,SAAS,KAAI,EAAE,CAAC,CAAC;IACxE,MAAM,CAAC,UAAU,GAAG,qCAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAEjD,0DAA0D;IAC1D,OAAO,MAAoB,CAAC;AAC9B,CAAC;AAvBD,oCAuBC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/surveys/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,sBAAsB,GAAG,cAAc,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,54 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,50 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/surveys/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.decodeForm = void 0;
|
|
4
|
-
const get_prop_1 = require("../../objects/get-prop");
|
|
5
|
-
const set_prop_1 = require("../../objects/set-prop");
|
|
6
|
-
const util_1 = require("../../util");
|
|
7
|
-
const is_page_question_1 = require("./is-page-question");
|
|
8
|
-
/**
|
|
9
|
-
* Decodes certain properties of the Survey Form json into html
|
|
10
|
-
* @param {IS123FormJSON} form
|
|
11
|
-
*/
|
|
12
|
-
exports.decodeForm = (form) => {
|
|
13
|
-
const target = util_1.cloneObject(form);
|
|
14
|
-
const props = [
|
|
15
|
-
"header.content",
|
|
16
|
-
"subHeader.content",
|
|
17
|
-
"footer.content",
|
|
18
|
-
"settings.thankYouScreenContent",
|
|
19
|
-
];
|
|
20
|
-
props.forEach((prop) => {
|
|
21
|
-
if (get_prop_1.getProp(target, prop)) {
|
|
22
|
-
set_prop_1.setProp(prop, decodeURIComponent(get_prop_1.getProp(target, prop)), target);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
const toDecoded = (question) => {
|
|
26
|
-
const decode = (q) => {
|
|
27
|
-
if (q.description) {
|
|
28
|
-
q.description = decodeURIComponent(q.description);
|
|
29
|
-
}
|
|
30
|
-
return q;
|
|
31
|
-
};
|
|
32
|
-
return !is_page_question_1.isPageQuestion(question)
|
|
33
|
-
? decode(question)
|
|
34
|
-
: Object.assign(Object.assign({}, question), { questions: question.questions.map(decode) });
|
|
35
|
-
};
|
|
36
|
-
return Object.assign(Object.assign({}, target), { questions: (target.questions || []).map(toDecoded) });
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=decode-form.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decode-form.js","sourceRoot":"","sources":["../../../../src/surveys/utils/decode-form.ts"],"names":[],"mappings":";;;AAAA,qDAAiD;AACjD,qDAAiD;AACjD,qCAAyC;AAEzC,yDAAoD;AAEpD;;;GAGG;AACU,QAAA,UAAU,GAAG,CAAC,IAAmB,EAAE,EAAE;IAChD,MAAM,MAAM,GAAG,kBAAW,CAAC,IAAI,CAAC,CAAC;IACjC,MAAM,KAAK,GAAG;QACZ,gBAAgB;QAChB,mBAAmB;QACnB,gBAAgB;QAChB,gCAAgC;KACjC,CAAC;IACF,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACrB,IAAI,kBAAO,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE;YACzB,kBAAO,CAAC,IAAI,EAAE,kBAAkB,CAAC,kBAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;SAClE;IACH,CAAC,CAAC,CAAC;IACH,MAAM,SAAS,GAAG,CAAC,QAAuB,EAAE,EAAE;QAC5C,MAAM,MAAM,GAAG,CAAC,CAAgB,EAAE,EAAE;YAClC,IAAI,CAAC,CAAC,WAAW,EAAE;gBACjB,CAAC,CAAC,WAAW,GAAG,kBAAkB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;aACnD;YACD,OAAO,CAAC,CAAC;QACX,CAAC,CAAC;QACF,OAAO,CAAC,iCAAc,CAAC,QAAQ,CAAC;YAC9B,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;YAClB,CAAC,iCAAM,QAAQ,KAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,GAAE,CAAC;IACjE,CAAC,CAAC;IACF,uCACK,MAAM,KACT,SAAS,EAAE,CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,IAClD;AACJ,CAAC,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFormInfoJson = void 0;
|
|
4
|
-
const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
|
|
5
|
-
/**
|
|
6
|
-
* This returns the /info/forminfo.json which simply has the form name and type.
|
|
7
|
-
* We need the name so we can make the getFormInfo call
|
|
8
|
-
* @param {string} id
|
|
9
|
-
* @param {IRequestOptions} requestOptions
|
|
10
|
-
* @returns {Promise}
|
|
11
|
-
*/
|
|
12
|
-
exports.getFormInfoJson = (id, requestOptions) => {
|
|
13
|
-
return arcgis_rest_portal_1.getItemInfo(id, Object.assign({ fileName: "forminfo.json", readAs: "json" }, requestOptions));
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=get-form-info-json.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-form-info-json.js","sourceRoot":"","sources":["../../../../src/surveys/utils/get-form-info-json.ts"],"names":[],"mappings":";;;AAAA,iEAAuD;AAGvD;;;;;;GAMG;AACU,QAAA,eAAe,GAAG,CAC7B,EAAU,EACV,cAA+B,EAC/B,EAAE;IACF,OAAO,gCAAW,CAAC,EAAE,kBACnB,QAAQ,EAAE,eAAe,EACzB,MAAM,EAAE,MAAM,IACX,cAAc,EACjB,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFormJson = void 0;
|
|
4
|
-
const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
|
|
5
|
-
const get_form_info_json_1 = require("./get-form-info-json");
|
|
6
|
-
const is_survey123_connect_1 = require("./is-survey123-connect");
|
|
7
|
-
const decode_form_1 = require("./decode-form");
|
|
8
|
-
const is_draft_1 = require("./is-draft");
|
|
9
|
-
/**
|
|
10
|
-
* Given a Survey Item, return the form json, if it exists.
|
|
11
|
-
* @param {IItem} the survey item
|
|
12
|
-
* @param {IGetItemInfoOptions} requestOptions
|
|
13
|
-
* @returns {Promise}
|
|
14
|
-
*/
|
|
15
|
-
exports.getFormJson = async (item, requestOptions) => {
|
|
16
|
-
if (is_draft_1.isDraft(item)) {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
const { name } = await get_form_info_json_1.getFormInfoJson(item.id, requestOptions);
|
|
20
|
-
let promise;
|
|
21
|
-
if (is_survey123_connect_1.isSurvey123Connect(item)) {
|
|
22
|
-
// survey123 connect does not have a <name>.json file, instead
|
|
23
|
-
// that configuration is split between <name>.webform & <name>.info
|
|
24
|
-
promise = Promise.all([
|
|
25
|
-
arcgis_rest_portal_1.getItemInfo(item.id, Object.assign({ fileName: `${name}.webform`, readAs: "json" }, requestOptions)),
|
|
26
|
-
arcgis_rest_portal_1.getItemInfo(item.id, Object.assign({ fileName: `${name}.info`, readAs: "json" }, requestOptions)),
|
|
27
|
-
]).then(([webform, info]) => {
|
|
28
|
-
// webform contains questions
|
|
29
|
-
const { surveyFormJson = {} } = webform;
|
|
30
|
-
// other settings come from info
|
|
31
|
-
// const { webformInfo: { settings } } = info;
|
|
32
|
-
const {
|
|
33
|
-
// webformInfo only exists if settings have been
|
|
34
|
-
// managed/changed from the s123 web application.
|
|
35
|
-
// Disabling survey submissions from the ArcGISSurvey123Connect
|
|
36
|
-
// desktop application does not disable survey submissions from
|
|
37
|
-
// the web UI. Therefore, just default to open when the survey settings
|
|
38
|
-
// have not been changed from the s123 web application.
|
|
39
|
-
webformInfo = {
|
|
40
|
-
settings: {
|
|
41
|
-
openStatusInfo: {
|
|
42
|
-
status: "open",
|
|
43
|
-
schedule: {
|
|
44
|
-
end: null,
|
|
45
|
-
status: null,
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
multiSubmissionInfo: {
|
|
49
|
-
maxAllowed: 0,
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
}, } = info;
|
|
53
|
-
const { settings } = webformInfo;
|
|
54
|
-
// combine relevant parts
|
|
55
|
-
return Object.assign(Object.assign({}, surveyFormJson), { settings });
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
promise = arcgis_rest_portal_1.getItemInfo(item.id, Object.assign({ fileName: `${name}.json`, readAs: "json" }, requestOptions));
|
|
60
|
-
}
|
|
61
|
-
return promise.then((form) => {
|
|
62
|
-
// response may be null... so check...
|
|
63
|
-
if (form) {
|
|
64
|
-
// form's have some properties which may contain html, these will
|
|
65
|
-
// be run thru encodeURIComponent, so we decode it here for use
|
|
66
|
-
// in our template
|
|
67
|
-
form = decode_form_1.decodeForm(form);
|
|
68
|
-
}
|
|
69
|
-
return form;
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
|
-
//# sourceMappingURL=get-form-json.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-form-json.js","sourceRoot":"","sources":["../../../../src/surveys/utils/get-form-json.ts"],"names":[],"mappings":";;;AAAA,iEAIkC;AAClC,6DAAuD;AACvD,iEAA4D;AAC5D,+CAA2C;AAC3C,yCAAqC;AAErC;;;;;GAKG;AACU,QAAA,WAAW,GAAG,KAAK,EAC9B,IAAW,EACX,cAAmC,EACnC,EAAE;IACF,IAAI,kBAAO,CAAC,IAAI,CAAC,EAAE;QACjB,OAAO,IAAI,CAAC;KACb;IACD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,oCAAe,CAAC,IAAI,CAAC,EAAE,EAAE,cAAc,CAAC,CAAC;IAChE,IAAI,OAAO,CAAC;IACZ,IAAI,yCAAkB,CAAC,IAAI,CAAC,EAAE;QAC5B,8DAA8D;QAC9D,mEAAmE;QACnE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC;YACpB,gCAAW,CAAC,IAAI,CAAC,EAAE,kBACjB,QAAQ,EAAE,GAAG,IAAI,UAAU,EAC3B,MAAM,EAAE,MAAM,IACX,cAAc,EACjB;YACF,gCAAW,CAAC,IAAI,CAAC,EAAE,kBACjB,QAAQ,EAAE,GAAG,IAAI,OAAO,EACxB,MAAM,EAAE,MAAM,IACX,cAAc,EACjB;SACH,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;YAC1B,6BAA6B;YAC7B,MAAM,EAAE,cAAc,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC;YACxC,gCAAgC;YAChC,8CAA8C;YAC9C,MAAM;YACJ,gDAAgD;YAChD,iDAAiD;YACjD,+DAA+D;YAC/D,+DAA+D;YAC/D,uEAAuE;YACvE,uDAAuD;YACvD,WAAW,GAAG;gBACZ,QAAQ,EAAE;oBACR,cAAc,EAAE;wBACd,MAAM,EAAE,MAAM;wBACd,QAAQ,EAAE;4BACR,GAAG,EAAE,IAAI;4BACT,MAAM,EAAE,IAAI;yBACb;qBACF;oBACD,mBAAmB,EAAE;wBACnB,UAAU,EAAE,CAAC;qBACd;iBACF;aACF,GACF,GAAG,IAAI,CAAC;YACT,MAAM,EAAE,QAAQ,EAAE,GAAG,WAAW,CAAC;YACjC,yBAAyB;YACzB,uCAAY,cAAc,KAAE,QAAQ,IAAG;QACzC,CAAC,CAAC,CAAC;KACJ;SAAM;QACL,OAAO,GAAG,gCAAW,CAAC,IAAI,CAAC,EAAE,kBAC3B,QAAQ,EAAE,GAAG,IAAI,OAAO,EACxB,MAAM,EAAE,MAAM,IACX,cAAc,EACjB,CAAC;KACJ;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;QAC3B,sCAAsC;QACtC,IAAI,IAAI,EAAE;YACR,iEAAiE;YACjE,+DAA+D;YAC/D,kBAAkB;YAClB,IAAI,GAAG,wBAAU,CAAC,IAAI,CAAC,CAAC;SACzB;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getMapQuestion = void 0;
|
|
4
|
-
const is_map_question_1 = require("./is-map-question");
|
|
5
|
-
const is_page_question_1 = require("./is-page-question");
|
|
6
|
-
/**
|
|
7
|
-
* Gets the map question from an Array of questions
|
|
8
|
-
* @param {Array} questions An array of questions
|
|
9
|
-
* @returns {Object}
|
|
10
|
-
*/
|
|
11
|
-
exports.getMapQuestion = (questions) => {
|
|
12
|
-
const [head, ...tail] = questions;
|
|
13
|
-
return getMapQuestionRecur(head, tail);
|
|
14
|
-
};
|
|
15
|
-
const getMapQuestionRecur = (head, tail) => {
|
|
16
|
-
let result;
|
|
17
|
-
if (!head) {
|
|
18
|
-
result = null;
|
|
19
|
-
}
|
|
20
|
-
else if (is_map_question_1.isMapQuestion(head)) {
|
|
21
|
-
result = head;
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
if (is_page_question_1.isPageQuestion(head)) {
|
|
25
|
-
result = exports.getMapQuestion(head.questions);
|
|
26
|
-
}
|
|
27
|
-
if (!result && tail.length) {
|
|
28
|
-
const [h, ...t] = tail;
|
|
29
|
-
result = getMapQuestionRecur(h, t);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
//# sourceMappingURL=get-map-question.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-map-question.js","sourceRoot":"","sources":["../../../../src/surveys/utils/get-map-question.ts"],"names":[],"mappings":";;;AACA,uDAAkD;AAClD,yDAAoD;AAEpD;;;;GAIG;AACU,QAAA,cAAc,GAAG,CAAC,SAA0B,EAAiB,EAAE;IAC1E,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;IAClC,OAAO,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACzC,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,IAAmB,EAAE,IAAS,EAAiB,EAAE;IAC5E,IAAI,MAAM,CAAC;IACX,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,GAAG,IAAI,CAAC;KACf;SAAM,IAAI,+BAAa,CAAC,IAAI,CAAC,EAAE;QAC9B,MAAM,GAAG,IAAI,CAAC;KACf;SAAM;QACL,IAAI,iCAAc,CAAC,IAAI,CAAC,EAAE;YACxB,MAAM,GAAG,sBAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SACzC;QACD,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,EAAE;YAC1B,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;YACvB,MAAM,GAAG,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SACpC;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasMapQuestion = void 0;
|
|
4
|
-
const get_map_question_1 = require("./get-map-question");
|
|
5
|
-
/**
|
|
6
|
-
* Determines if the given Array of questions contains
|
|
7
|
-
* a map question
|
|
8
|
-
* @param {Array} questions An array of questions
|
|
9
|
-
* @returns {boolean}
|
|
10
|
-
*/
|
|
11
|
-
exports.hasMapQuestion = (questions) => {
|
|
12
|
-
return Boolean(get_map_question_1.getMapQuestion(questions));
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=has-map-question.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"has-map-question.js","sourceRoot":"","sources":["../../../../src/surveys/utils/has-map-question.ts"],"names":[],"mappings":";;;AACA,yDAAoD;AAEpD;;;;;GAKG;AACU,QAAA,cAAc,GAAG,CAAC,SAA0B,EAAE,EAAE;IAC3D,OAAO,OAAO,CAAC,iCAAc,CAAC,SAAS,CAAC,CAAC,CAAC;AAC5C,CAAC,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isMapQuestion = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Determines if the given question is a map question
|
|
6
|
-
* @param {Object} question A question object
|
|
7
|
-
* @returns {boolean}
|
|
8
|
-
*/
|
|
9
|
-
exports.isMapQuestion = (question) => {
|
|
10
|
-
const { type, maps = [], defaultMap } = question;
|
|
11
|
-
const types = [
|
|
12
|
-
"esriQuestionTypeGeoPoint",
|
|
13
|
-
"esriQuestionTypePolyline",
|
|
14
|
-
"esriQuestionTypePolygon",
|
|
15
|
-
];
|
|
16
|
-
const isType = types.includes(type);
|
|
17
|
-
return isType && (maps.length > 0 || Boolean(defaultMap));
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=is-map-question.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-map-question.js","sourceRoot":"","sources":["../../../../src/surveys/utils/is-map-question.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACU,QAAA,aAAa,GAAG,CAAC,QAAuB,EAAE,EAAE;IACvD,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,EAAE,EAAE,UAAU,EAAE,GAAG,QAAQ,CAAC;IACjD,MAAM,KAAK,GAAG;QACZ,0BAA0B;QAC1B,0BAA0B;QAC1B,yBAAyB;KAC1B,CAAC;IACF,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACpC,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;AAC5D,CAAC,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isPageQuestion = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Determines if the given question is actually a page of questions
|
|
6
|
-
* @param {Object} question A question object
|
|
7
|
-
* @returns {boolean}
|
|
8
|
-
*/
|
|
9
|
-
exports.isPageQuestion = (question) => {
|
|
10
|
-
return question.type === "esriQuestionTypePage";
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=is-page-question.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-page-question.js","sourceRoot":"","sources":["../../../../src/surveys/utils/is-page-question.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACU,QAAA,cAAc,GAAG,CAAC,QAAuB,EAAE,EAAE;IACxD,OAAO,QAAQ,CAAC,IAAI,KAAK,sBAAsB,CAAC;AAClD,CAAC,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isSurvey123Connect = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Returns true if the given Form item is a Survey123 Connect
|
|
6
|
-
* survey
|
|
7
|
-
* @param {IItem} formItem The Form item
|
|
8
|
-
* @returns {boolean}
|
|
9
|
-
*/
|
|
10
|
-
exports.isSurvey123Connect = (formItem) => {
|
|
11
|
-
var _a;
|
|
12
|
-
const results = false;
|
|
13
|
-
if (formItem) {
|
|
14
|
-
const typeKeywords = (_a = formItem.typeKeywords) !== null && _a !== void 0 ? _a : [];
|
|
15
|
-
return typeKeywords.includes("Survey123 Connect");
|
|
16
|
-
}
|
|
17
|
-
return results;
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=is-survey123-connect.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-survey123-connect.js","sourceRoot":"","sources":["../../../../src/surveys/utils/is-survey123-connect.ts"],"names":[],"mappings":";;;AAEA;;;;;GAKG;AACU,QAAA,kBAAkB,GAAG,CAAC,QAAe,EAAE,EAAE;;IACpD,MAAM,OAAO,GAAG,KAAK,CAAC;IACtB,IAAI,QAAQ,EAAE;QACZ,MAAM,YAAY,SAAG,QAAQ,CAAC,YAAY,mCAAI,EAAE,CAAC;QACjD,OAAO,YAAY,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;KACnD;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setDisplayMapKeyword = void 0;
|
|
4
|
-
const constants_1 = require("../constants");
|
|
5
|
-
/**
|
|
6
|
-
* Adds or removes MAP_SURVEY_TYPEKEYWORD type keyword and returns the updated list
|
|
7
|
-
* @param {IGroup|IHubContent|IHubItemEntity} subject
|
|
8
|
-
* @param {boolean} displayMap
|
|
9
|
-
* @returns {string[]} updated list of type keywords
|
|
10
|
-
*/
|
|
11
|
-
function setDisplayMapKeyword(typeKeywords, displayMap) {
|
|
12
|
-
const updatedTypeKeywords = (typeKeywords || []).filter((typeKeyword) => typeKeyword !== constants_1.MAP_SURVEY_TYPEKEYWORD);
|
|
13
|
-
if (displayMap) {
|
|
14
|
-
updatedTypeKeywords.push(constants_1.MAP_SURVEY_TYPEKEYWORD);
|
|
15
|
-
}
|
|
16
|
-
return updatedTypeKeywords;
|
|
17
|
-
}
|
|
18
|
-
exports.setDisplayMapKeyword = setDisplayMapKeyword;
|
|
19
|
-
//# sourceMappingURL=set-display-map-keyword.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"set-display-map-keyword.js","sourceRoot":"","sources":["../../../../src/surveys/utils/set-display-map-keyword.ts"],"names":[],"mappings":";;;AAAA,4CAAsD;AAEtD;;;;;GAKG;AACH,SAAgB,oBAAoB,CAClC,YAAsB,EACtB,UAAmB;IAEnB,MAAM,mBAAmB,GAAG,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,MAAM,CACrD,CAAC,WAAmB,EAAE,EAAE,CAAC,WAAW,KAAK,kCAAsB,CAChE,CAAC;IACF,IAAI,UAAU,EAAE;QACd,mBAAmB,CAAC,IAAI,CAAC,kCAAsB,CAAC,CAAC;KAClD;IACD,OAAO,mBAAmB,CAAC;AAC7B,CAAC;AAXD,oDAWC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.shouldDisplayMap = void 0;
|
|
4
|
-
const constants_1 = require("../constants");
|
|
5
|
-
/**
|
|
6
|
-
* Determines the display mode of the given survey
|
|
7
|
-
* @param {Object} formItem A Form item
|
|
8
|
-
* @returns {boolean}
|
|
9
|
-
*/
|
|
10
|
-
exports.shouldDisplayMap = (item) => {
|
|
11
|
-
return (item.type === "Form" && item.typeKeywords.includes(constants_1.MAP_SURVEY_TYPEKEYWORD));
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=should-display-map.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"should-display-map.js","sourceRoot":"","sources":["../../../../src/surveys/utils/should-display-map.ts"],"names":[],"mappings":";;;AACA,4CAAsD;AAEtD;;;;GAIG;AACU,QAAA,gBAAgB,GAAG,CAAC,IAAW,EAAE,EAAE;IAC9C,OAAO,CACL,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,kCAAsB,CAAC,CAC3E,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { IWithPermissions } from "../traits";
|
|
2
|
-
import { IHubItemEntity, IHubItemEntityEditor } from "./IHubItemEntity";
|
|
3
|
-
/**
|
|
4
|
-
* Defines properties of Hub Survey object
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
export interface IHubSurvey extends IHubItemEntity, IWithPermissions {
|
|
8
|
-
hasMapQuestion: boolean;
|
|
9
|
-
displayMap: boolean;
|
|
10
|
-
}
|
|
11
|
-
export declare type IHubSurveyEditor = IHubItemEntityEditor<IHubSurvey> & {};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { IArcGISContext } from "../types/IArcGISContext";
|
|
2
|
-
import { HubItemEntity } from "../core/HubItemEntity";
|
|
3
|
-
import { IWithEditorBehavior } from "../core/behaviors/IWithEditorBehavior";
|
|
4
|
-
import { IEditorConfig } from "../core/schemas/types";
|
|
5
|
-
import { HubEntityEditor, IEntityEditorContext } from "../core/types/HubEntityEditor";
|
|
6
|
-
import { IHubSurvey } from "../core/types/IHubSurvey";
|
|
7
|
-
import { SurveyEditorType } from "./_internal/SurveySchema";
|
|
8
|
-
/**
|
|
9
|
-
* Hub Survey Class
|
|
10
|
-
*/
|
|
11
|
-
export declare class HubSurvey extends HubItemEntity<IHubSurvey> implements IWithEditorBehavior {
|
|
12
|
-
/**
|
|
13
|
-
* Create an instance from a HubSurvey object
|
|
14
|
-
* @param json - JSON object to create a HubSurvey from
|
|
15
|
-
* @param context - ArcGIS context
|
|
16
|
-
* @returns
|
|
17
|
-
*/
|
|
18
|
-
static fromJson(json: Partial<IHubSurvey>, context: IArcGISContext): HubSurvey;
|
|
19
|
-
/**
|
|
20
|
-
* Fetch a Survey from the backing store and return a HubSurvey instance.
|
|
21
|
-
* @param identifier - Identifier of the survey to load
|
|
22
|
-
* @param context
|
|
23
|
-
* @returns
|
|
24
|
-
*/
|
|
25
|
-
static fetch(identifier: string, context: IArcGISContext): Promise<HubSurvey>;
|
|
26
|
-
private static applyDefaults;
|
|
27
|
-
/**
|
|
28
|
-
* Apply a new state to the instance
|
|
29
|
-
* @param changes A partial IHubSurvey
|
|
30
|
-
*/
|
|
31
|
-
update(changes: Partial<IHubSurvey>): void;
|
|
32
|
-
/**
|
|
33
|
-
* Save the class instance
|
|
34
|
-
*/
|
|
35
|
-
save(): Promise<void>;
|
|
36
|
-
/**
|
|
37
|
-
* Delete the HubSurvey object from the store
|
|
38
|
-
* set a flag to indicate that it is destroyed
|
|
39
|
-
* @returns a promise
|
|
40
|
-
*/
|
|
41
|
-
delete(): Promise<void>;
|
|
42
|
-
getEditorConfig(i18nScope: string, type: SurveyEditorType): Promise<IEditorConfig>;
|
|
43
|
-
/**
|
|
44
|
-
* Return the Survey object as an editor object
|
|
45
|
-
* @param editorContext
|
|
46
|
-
* @param include
|
|
47
|
-
* @returns
|
|
48
|
-
*/
|
|
49
|
-
toEditor(editorContext?: IEntityEditorContext, include?: string[]): Promise<HubEntityEditor>;
|
|
50
|
-
/**
|
|
51
|
-
* Load the Survey object from the editor object
|
|
52
|
-
* @param editor
|
|
53
|
-
* @param editorContext
|
|
54
|
-
* @returns IHubSurvey
|
|
55
|
-
*/
|
|
56
|
-
fromEditor(editor: HubEntityEditor, _editorContext?: IEntityEditorContext): Promise<IHubSurvey>;
|
|
57
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { IPermissionPolicy } from "../../permissions/types/IPermissionPolicy";
|
|
2
|
-
/**
|
|
3
|
-
* survey Permission Policies
|
|
4
|
-
* These define the requirements any user must meet to perform related actions
|
|
5
|
-
* @private
|
|
6
|
-
*/
|
|
7
|
-
export declare const SurveyPermissions: readonly ["hub:survey", "hub:survey:create", "hub:survey:delete", "hub:survey:edit", "hub:survey:view", "hub:survey:view:related", "hub:survey:owner", "hub:survey:canChangeAccess", "hub:survey:workspace", "hub:survey:workspace:dashboard", "hub:survey:workspace:details", "hub:survey:workspace:settings", "hub:survey:workspace:collaborators", "hub:survey:manage"];
|
|
8
|
-
/**
|
|
9
|
-
* Survey permission policies
|
|
10
|
-
* @private
|
|
11
|
-
*/
|
|
12
|
-
export declare const SurveyPermissionPolicies: IPermissionPolicy[];
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { IConfigurationSchema } from "../../core/schemas/types";
|
|
2
|
-
export declare type SurveyEditorType = (typeof SurveyEditorTypes)[number];
|
|
3
|
-
export declare const SurveyEditorTypes: readonly ["hub:survey:edit", "hub:survey:settings"];
|
|
4
|
-
/**
|
|
5
|
-
* defines the JSON schema for a Survey entity's editable fields
|
|
6
|
-
*/
|
|
7
|
-
export declare const SurveySchema: IConfigurationSchema;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { IArcGISContext } from "../../types/IArcGISContext";
|
|
2
|
-
import { IUiSchema } from "../../core/schemas/types";
|
|
3
|
-
import { IHubSurvey } from "../../core/types/IHubSurvey";
|
|
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 declare const buildUiSchema: (i18nScope: string, options: Partial<IHubSurvey>, context: IArcGISContext) => Promise<IUiSchema>;
|