@ngageoint/mage.service 6.2.2
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/bin/mage.service.js +230 -0
- package/bin/migration.js +60 -0
- package/bin/poststop.sh +1 -0
- package/bin/prestart.sh +1 -0
- package/lib/@types/express/index.d.ts +18 -0
- package/lib/@types/geojson-validation/index.d.ts +15 -0
- package/lib/@types/mongodb-migrations/index.d.ts +99 -0
- package/lib/access/index.d.ts +21 -0
- package/lib/access/index.d.ts.map +1 -0
- package/lib/access/index.js +40 -0
- package/lib/access/index.js.map +1 -0
- package/lib/adapters/adapters.controllers.web.d.ts +22 -0
- package/lib/adapters/adapters.controllers.web.d.ts.map +1 -0
- package/lib/adapters/adapters.controllers.web.js +55 -0
- package/lib/adapters/adapters.controllers.web.js.map +1 -0
- package/lib/adapters/adapters.db.mongoose.d.ts +5 -0
- package/lib/adapters/adapters.db.mongoose.d.ts.map +1 -0
- package/lib/adapters/adapters.db.mongoose.js +70 -0
- package/lib/adapters/adapters.db.mongoose.js.map +1 -0
- package/lib/adapters/adapters.simple_id_factory.d.ts +5 -0
- package/lib/adapters/adapters.simple_id_factory.d.ts.map +1 -0
- package/lib/adapters/adapters.simple_id_factory.js +24 -0
- package/lib/adapters/adapters.simple_id_factory.js.map +1 -0
- package/lib/adapters/base/adapters.base.db.mongoose.d.ts +59 -0
- package/lib/adapters/base/adapters.base.db.mongoose.d.ts.map +1 -0
- package/lib/adapters/base/adapters.base.db.mongoose.js +143 -0
- package/lib/adapters/base/adapters.base.db.mongoose.js.map +1 -0
- package/lib/adapters/events/adapters.events.controllers.web.d.ts +14 -0
- package/lib/adapters/events/adapters.events.controllers.web.d.ts.map +1 -0
- package/lib/adapters/events/adapters.events.controllers.web.js +83 -0
- package/lib/adapters/events/adapters.events.controllers.web.js.map +1 -0
- package/lib/adapters/events/adapters.events.db.mongoose.d.ts +27 -0
- package/lib/adapters/events/adapters.events.db.mongoose.d.ts.map +1 -0
- package/lib/adapters/events/adapters.events.db.mongoose.js +127 -0
- package/lib/adapters/events/adapters.events.db.mongoose.js.map +1 -0
- package/lib/adapters/feeds/adapters.feeds.controllers.web.d.ts +25 -0
- package/lib/adapters/feeds/adapters.feeds.controllers.web.d.ts.map +1 -0
- package/lib/adapters/feeds/adapters.feeds.controllers.web.js +234 -0
- package/lib/adapters/feeds/adapters.feeds.controllers.web.js.map +1 -0
- package/lib/adapters/feeds/adapters.feeds.db.mongoose.d.ts +63 -0
- package/lib/adapters/feeds/adapters.feeds.db.mongoose.d.ts.map +1 -0
- package/lib/adapters/feeds/adapters.feeds.db.mongoose.js +199 -0
- package/lib/adapters/feeds/adapters.feeds.db.mongoose.js.map +1 -0
- package/lib/adapters/icons/adapters.icons.content_store.file_system.d.ts +7 -0
- package/lib/adapters/icons/adapters.icons.content_store.file_system.d.ts.map +1 -0
- package/lib/adapters/icons/adapters.icons.content_store.file_system.js +13 -0
- package/lib/adapters/icons/adapters.icons.content_store.file_system.js.map +1 -0
- package/lib/adapters/icons/adapters.icons.controllers.web.d.ts +10 -0
- package/lib/adapters/icons/adapters.icons.controllers.web.d.ts.map +1 -0
- package/lib/adapters/icons/adapters.icons.controllers.web.js +118 -0
- package/lib/adapters/icons/adapters.icons.controllers.web.js.map +1 -0
- package/lib/adapters/icons/adapters.icons.db.mongoose.d.ts +38 -0
- package/lib/adapters/icons/adapters.icons.db.mongoose.d.ts.map +1 -0
- package/lib/adapters/icons/adapters.icons.db.mongoose.js +287 -0
- package/lib/adapters/icons/adapters.icons.db.mongoose.js.map +1 -0
- package/lib/adapters/observations/adapters.observations.attachment_store.file_system.d.ts +29 -0
- package/lib/adapters/observations/adapters.observations.attachment_store.file_system.d.ts.map +1 -0
- package/lib/adapters/observations/adapters.observations.attachment_store.file_system.js +274 -0
- package/lib/adapters/observations/adapters.observations.attachment_store.file_system.js.map +1 -0
- package/lib/adapters/observations/adapters.observations.controllers.web.d.ts +40 -0
- package/lib/adapters/observations/adapters.observations.controllers.web.d.ts.map +1 -0
- package/lib/adapters/observations/adapters.observations.controllers.web.js +196 -0
- package/lib/adapters/observations/adapters.observations.controllers.web.js.map +1 -0
- package/lib/adapters/observations/adapters.observations.db.mongoose.d.ts +30 -0
- package/lib/adapters/observations/adapters.observations.db.mongoose.d.ts.map +1 -0
- package/lib/adapters/observations/adapters.observations.db.mongoose.js +294 -0
- package/lib/adapters/observations/adapters.observations.db.mongoose.js.map +1 -0
- package/lib/adapters/plugins/adapters.plugins.db.mongoose.d.ts +17 -0
- package/lib/adapters/plugins/adapters.plugins.db.mongoose.d.ts.map +1 -0
- package/lib/adapters/plugins/adapters.plugins.db.mongoose.js +59 -0
- package/lib/adapters/plugins/adapters.plugins.db.mongoose.js.map +1 -0
- package/lib/adapters/url_schemes/adapters.url_schemes.plugin.d.ts +38 -0
- package/lib/adapters/url_schemes/adapters.url_schemes.plugin.d.ts.map +1 -0
- package/lib/adapters/url_schemes/adapters.url_schemes.plugin.js +110 -0
- package/lib/adapters/url_schemes/adapters.url_schemes.plugin.js.map +1 -0
- package/lib/adapters/users/adapters.users.controllers.web.d.ts +7 -0
- package/lib/adapters/users/adapters.users.controllers.web.d.ts.map +1 -0
- package/lib/adapters/users/adapters.users.controllers.web.js +37 -0
- package/lib/adapters/users/adapters.users.controllers.web.js.map +1 -0
- package/lib/adapters/users/adapters.users.db.mongoose.d.ts +19 -0
- package/lib/adapters/users/adapters.users.db.mongoose.d.ts.map +1 -0
- package/lib/adapters/users/adapters.users.db.mongoose.js +126 -0
- package/lib/adapters/users/adapters.users.db.mongoose.js.map +1 -0
- package/lib/adapters/web_ui_plugins/adapters.web_ui_plugins.controllers.web.d.ts +3 -0
- package/lib/adapters/web_ui_plugins/adapters.web_ui_plugins.controllers.web.d.ts.map +1 -0
- package/lib/adapters/web_ui_plugins/adapters.web_ui_plugins.controllers.web.js +53 -0
- package/lib/adapters/web_ui_plugins/adapters.web_ui_plugins.controllers.web.js.map +1 -0
- package/lib/api/attachment.d.ts +12 -0
- package/lib/api/attachment.d.ts.map +1 -0
- package/lib/api/attachment.js +81 -0
- package/lib/api/attachment.js.map +1 -0
- package/lib/api/event.d.ts +20 -0
- package/lib/api/event.d.ts.map +1 -0
- package/lib/api/event.js +185 -0
- package/lib/api/event.js.map +1 -0
- package/lib/api/events/location.d.ts +11 -0
- package/lib/api/events/location.d.ts.map +1 -0
- package/lib/api/events/location.js +13 -0
- package/lib/api/events/location.js.map +1 -0
- package/lib/api/events/observation.d.ts +15 -0
- package/lib/api/events/observation.d.ts.map +1 -0
- package/lib/api/events/observation.js +21 -0
- package/lib/api/events/observation.js.map +1 -0
- package/lib/api/feature.d.ts +8 -0
- package/lib/api/feature.d.ts.map +1 -0
- package/lib/api/feature.js +15 -0
- package/lib/api/feature.js.map +1 -0
- package/lib/api/field/attachmentField.d.ts +12 -0
- package/lib/api/field/attachmentField.d.ts.map +1 -0
- package/lib/api/field/attachmentField.js +40 -0
- package/lib/api/field/attachmentField.js.map +1 -0
- package/lib/api/field/checkboxField.d.ts +7 -0
- package/lib/api/field/checkboxField.d.ts.map +1 -0
- package/lib/api/field/checkboxField.js +19 -0
- package/lib/api/field/checkboxField.js.map +1 -0
- package/lib/api/field/dateField.d.ts +8 -0
- package/lib/api/field/dateField.d.ts.map +1 -0
- package/lib/api/field/dateField.js +21 -0
- package/lib/api/field/dateField.js.map +1 -0
- package/lib/api/field/emailField.d.ts +7 -0
- package/lib/api/field/emailField.d.ts.map +1 -0
- package/lib/api/field/emailField.js +19 -0
- package/lib/api/field/emailField.js.map +1 -0
- package/lib/api/field/field.d.ts +12 -0
- package/lib/api/field/field.d.ts.map +1 -0
- package/lib/api/field/field.js +12 -0
- package/lib/api/field/field.js.map +1 -0
- package/lib/api/field/geometryField.d.ts +7 -0
- package/lib/api/field/geometryField.d.ts.map +1 -0
- package/lib/api/field/geometryField.js +35 -0
- package/lib/api/field/geometryField.js.map +1 -0
- package/lib/api/field/index.d.ts +7 -0
- package/lib/api/field/index.d.ts.map +1 -0
- package/lib/api/field/index.js +30 -0
- package/lib/api/field/index.js.map +1 -0
- package/lib/api/field/multiSelectField.d.ts +7 -0
- package/lib/api/field/multiSelectField.d.ts.map +1 -0
- package/lib/api/field/multiSelectField.js +27 -0
- package/lib/api/field/multiSelectField.js.map +1 -0
- package/lib/api/field/numberField.d.ts +7 -0
- package/lib/api/field/numberField.d.ts.map +1 -0
- package/lib/api/field/numberField.js +27 -0
- package/lib/api/field/numberField.js.map +1 -0
- package/lib/api/field/selectField.d.ts +7 -0
- package/lib/api/field/selectField.d.ts.map +1 -0
- package/lib/api/field/selectField.js +22 -0
- package/lib/api/field/selectField.js.map +1 -0
- package/lib/api/field/textField.d.ts +7 -0
- package/lib/api/field/textField.d.ts.map +1 -0
- package/lib/api/field/textField.js +21 -0
- package/lib/api/field/textField.js.map +1 -0
- package/lib/api/form.d.ts +12 -0
- package/lib/api/form.d.ts.map +1 -0
- package/lib/api/form.js +239 -0
- package/lib/api/form.js.map +1 -0
- package/lib/api/icon.d.ts +22 -0
- package/lib/api/icon.d.ts.map +1 -0
- package/lib/api/icon.js +178 -0
- package/lib/api/icon.js.map +1 -0
- package/lib/api/index.d.ts +10 -0
- package/lib/api/index.d.ts.map +1 -0
- package/lib/api/index.js +11 -0
- package/lib/api/index.js.map +1 -0
- package/lib/api/layer.d.ts +14 -0
- package/lib/api/layer.d.ts.map +1 -0
- package/lib/api/layer.js +70 -0
- package/lib/api/layer.js.map +1 -0
- package/lib/api/location.d.ts +14 -0
- package/lib/api/location.d.ts.map +1 -0
- package/lib/api/location.js +35 -0
- package/lib/api/location.js.map +1 -0
- package/lib/api/observation.d.ts +25 -0
- package/lib/api/observation.d.ts.map +1 -0
- package/lib/api/observation.js +224 -0
- package/lib/api/observation.js.map +1 -0
- package/lib/api/user.d.ts +16 -0
- package/lib/api/user.d.ts.map +1 -0
- package/lib/api/user.js +250 -0
- package/lib/api/user.js.map +1 -0
- package/lib/app.api/app.api.errors.d.ts +42 -0
- package/lib/app.api/app.api.errors.d.ts.map +1 -0
- package/lib/app.api/app.api.errors.js +43 -0
- package/lib/app.api/app.api.errors.js.map +1 -0
- package/lib/app.api/app.api.global.d.ts +74 -0
- package/lib/app.api/app.api.global.d.ts.map +1 -0
- package/lib/app.api/app.api.global.js +59 -0
- package/lib/app.api/app.api.global.js.map +1 -0
- package/lib/app.api/events/app.api.events.d.ts +31 -0
- package/lib/app.api/events/app.api.events.d.ts.map +1 -0
- package/lib/app.api/events/app.api.events.js +3 -0
- package/lib/app.api/events/app.api.events.js.map +1 -0
- package/lib/app.api/feeds/app.api.feeds.d.ts +139 -0
- package/lib/app.api/feeds/app.api.feeds.d.ts.map +1 -0
- package/lib/app.api/feeds/app.api.feeds.js +26 -0
- package/lib/app.api/feeds/app.api.feeds.js.map +1 -0
- package/lib/app.api/icons/app.api.icons.d.ts +60 -0
- package/lib/app.api/icons/app.api.icons.d.ts.map +1 -0
- package/lib/app.api/icons/app.api.icons.js +29 -0
- package/lib/app.api/icons/app.api.icons.js.map +1 -0
- package/lib/app.api/observations/app.api.observations.d.ts +126 -0
- package/lib/app.api/observations/app.api.observations.d.ts.map +1 -0
- package/lib/app.api/observations/app.api.observations.js +61 -0
- package/lib/app.api/observations/app.api.observations.js.map +1 -0
- package/lib/app.api/users/app.api.users.d.ts +24 -0
- package/lib/app.api/users/app.api.users.d.ts.map +1 -0
- package/lib/app.api/users/app.api.users.js +3 -0
- package/lib/app.api/users/app.api.users.js.map +1 -0
- package/lib/app.d.ts +38 -0
- package/lib/app.d.ts.map +1 -0
- package/lib/app.impl/events/app.impl.events.d.ts +8 -0
- package/lib/app.impl/events/app.impl.events.d.ts.map +1 -0
- package/lib/app.impl/events/app.impl.events.js +107 -0
- package/lib/app.impl/events/app.impl.events.js.map +1 -0
- package/lib/app.impl/feeds/app.impl.feeds.d.ts +21 -0
- package/lib/app.impl/feeds/app.impl.feeds.d.ts.map +1 -0
- package/lib/app.impl/feeds/app.impl.feeds.js +527 -0
- package/lib/app.impl/feeds/app.impl.feeds.js.map +1 -0
- package/lib/app.impl/icons/app.impl.icons.d.ts +7 -0
- package/lib/app.impl/icons/app.impl.icons.d.ts.map +1 -0
- package/lib/app.impl/icons/app.impl.icons.js +81 -0
- package/lib/app.impl/icons/app.impl.icons.js.map +1 -0
- package/lib/app.impl/observations/app.impl.observations.d.ts +11 -0
- package/lib/app.impl/observations/app.impl.observations.d.ts.map +1 -0
- package/lib/app.impl/observations/app.impl.observations.js +357 -0
- package/lib/app.impl/observations/app.impl.observations.js.map +1 -0
- package/lib/app.impl/users/app.impl.users.d.ts +4 -0
- package/lib/app.impl/users/app.impl.users.d.ts.map +1 -0
- package/lib/app.impl/users/app.impl.users.js +37 -0
- package/lib/app.impl/users/app.impl.users.js.map +1 -0
- package/lib/app.js +507 -0
- package/lib/app.js.map +1 -0
- package/lib/assets/default-icon.png +0 -0
- package/lib/authentication/anonymous.d.ts +6 -0
- package/lib/authentication/anonymous.d.ts.map +1 -0
- package/lib/authentication/anonymous.js +17 -0
- package/lib/authentication/anonymous.js.map +1 -0
- package/lib/authentication/index.d.ts +24 -0
- package/lib/authentication/index.d.ts.map +1 -0
- package/lib/authentication/index.js +104 -0
- package/lib/authentication/index.js.map +1 -0
- package/lib/authentication/ldap.d.ts +2 -0
- package/lib/authentication/ldap.d.ts.map +1 -0
- package/lib/authentication/ldap.js +130 -0
- package/lib/authentication/ldap.js.map +1 -0
- package/lib/authentication/local.d.ts +2 -0
- package/lib/authentication/local.d.ts.map +1 -0
- package/lib/authentication/local.js +77 -0
- package/lib/authentication/local.js.map +1 -0
- package/lib/authentication/oauth.d.ts +2 -0
- package/lib/authentication/oauth.d.ts.map +1 -0
- package/lib/authentication/oauth.js +197 -0
- package/lib/authentication/oauth.js.map +1 -0
- package/lib/authentication/openidconnect.d.ts +2 -0
- package/lib/authentication/openidconnect.d.ts.map +1 -0
- package/lib/authentication/openidconnect.js +148 -0
- package/lib/authentication/openidconnect.js.map +1 -0
- package/lib/authentication/saml.d.ts +2 -0
- package/lib/authentication/saml.d.ts.map +1 -0
- package/lib/authentication/saml.js +287 -0
- package/lib/authentication/saml.js.map +1 -0
- package/lib/authentication/verification.d.ts +33 -0
- package/lib/authentication/verification.d.ts.map +1 -0
- package/lib/authentication/verification.js +144 -0
- package/lib/authentication/verification.js.map +1 -0
- package/lib/config.d.ts +15 -0
- package/lib/config.d.ts.map +1 -0
- package/lib/config.js +20 -0
- package/lib/config.js.map +1 -0
- package/lib/dist-package.json +203 -0
- package/lib/docs/auth/local.yaml +90 -0
- package/lib/docs/geojson.yaml +375 -0
- package/lib/docs/openapi.yaml +4591 -0
- package/lib/entities/authentication/entities.authentication.d.ts +14 -0
- package/lib/entities/authentication/entities.authentication.d.ts.map +1 -0
- package/lib/entities/authentication/entities.authentication.js +3 -0
- package/lib/entities/authentication/entities.authentication.js.map +1 -0
- package/lib/entities/authorization/entities.authorization.d.ts +7 -0
- package/lib/entities/authorization/entities.authorization.d.ts.map +1 -0
- package/lib/entities/authorization/entities.authorization.js +3 -0
- package/lib/entities/authorization/entities.authorization.js.map +1 -0
- package/lib/entities/authorization/entities.permissions.d.ts +143 -0
- package/lib/entities/authorization/entities.permissions.d.ts.map +1 -0
- package/lib/entities/authorization/entities.permissions.js +101 -0
- package/lib/entities/authorization/entities.permissions.js.map +1 -0
- package/lib/entities/entities.domain_events.d.ts +1 -0
- package/lib/entities/entities.domain_events.d.ts.map +1 -0
- package/lib/entities/entities.domain_events.js +20 -0
- package/lib/entities/entities.domain_events.js.map +1 -0
- package/lib/entities/entities.global.d.ts +107 -0
- package/lib/entities/entities.global.d.ts.map +1 -0
- package/lib/entities/entities.global.js +67 -0
- package/lib/entities/entities.global.js.map +1 -0
- package/lib/entities/entities.i18n.d.ts +78 -0
- package/lib/entities/entities.i18n.d.ts.map +1 -0
- package/lib/entities/entities.i18n.js +69 -0
- package/lib/entities/entities.i18n.js.map +1 -0
- package/lib/entities/entities.json_types.d.ts +42 -0
- package/lib/entities/entities.json_types.d.ts.map +1 -0
- package/lib/entities/entities.json_types.js +3 -0
- package/lib/entities/entities.json_types.js.map +1 -0
- package/lib/entities/events/entities.events.d.ts +118 -0
- package/lib/entities/events/entities.events.d.ts.map +1 -0
- package/lib/entities/events/entities.events.forms.d.ts +132 -0
- package/lib/entities/events/entities.events.forms.d.ts.map +1 -0
- package/lib/entities/events/entities.events.forms.js +102 -0
- package/lib/entities/events/entities.events.forms.js.map +1 -0
- package/lib/entities/events/entities.events.js +146 -0
- package/lib/entities/events/entities.events.js.map +1 -0
- package/lib/entities/feeds/entities.feeds.d.ts +340 -0
- package/lib/entities/feeds/entities.feeds.d.ts.map +1 -0
- package/lib/entities/feeds/entities.feeds.js +213 -0
- package/lib/entities/feeds/entities.feeds.js.map +1 -0
- package/lib/entities/icons/entities.icons.d.ts +106 -0
- package/lib/entities/icons/entities.icons.d.ts.map +1 -0
- package/lib/entities/icons/entities.icons.js +26 -0
- package/lib/entities/icons/entities.icons.js.map +1 -0
- package/lib/entities/observations/entities.observations.d.ts +569 -0
- package/lib/entities/observations/entities.observations.d.ts.map +1 -0
- package/lib/entities/observations/entities.observations.fields.attachment.d.ts +5 -0
- package/lib/entities/observations/entities.observations.fields.attachment.d.ts.map +1 -0
- package/lib/entities/observations/entities.observations.fields.attachment.js +24 -0
- package/lib/entities/observations/entities.observations.fields.attachment.js.map +1 -0
- package/lib/entities/observations/entities.observations.fields.checkbox.d.ts +3 -0
- package/lib/entities/observations/entities.observations.fields.checkbox.d.ts.map +1 -0
- package/lib/entities/observations/entities.observations.fields.checkbox.js +17 -0
- package/lib/entities/observations/entities.observations.fields.checkbox.js.map +1 -0
- package/lib/entities/observations/entities.observations.fields.d.ts +20 -0
- package/lib/entities/observations/entities.observations.fields.d.ts.map +1 -0
- package/lib/entities/observations/entities.observations.fields.date.d.ts +3 -0
- package/lib/entities/observations/entities.observations.fields.date.d.ts.map +1 -0
- package/lib/entities/observations/entities.observations.fields.date.js +21 -0
- package/lib/entities/observations/entities.observations.fields.date.js.map +1 -0
- package/lib/entities/observations/entities.observations.fields.email.d.ts +3 -0
- package/lib/entities/observations/entities.observations.fields.email.d.ts.map +1 -0
- package/lib/entities/observations/entities.observations.fields.email.js +20 -0
- package/lib/entities/observations/entities.observations.fields.email.js.map +1 -0
- package/lib/entities/observations/entities.observations.fields.geometry.d.ts +3 -0
- package/lib/entities/observations/entities.observations.fields.geometry.d.ts.map +1 -0
- package/lib/entities/observations/entities.observations.fields.geometry.js +62 -0
- package/lib/entities/observations/entities.observations.fields.geometry.js.map +1 -0
- package/lib/entities/observations/entities.observations.fields.js +37 -0
- package/lib/entities/observations/entities.observations.fields.js.map +1 -0
- package/lib/entities/observations/entities.observations.fields.multiselect.d.ts +3 -0
- package/lib/entities/observations/entities.observations.fields.multiselect.d.ts.map +1 -0
- package/lib/entities/observations/entities.observations.fields.multiselect.js +24 -0
- package/lib/entities/observations/entities.observations.fields.multiselect.js.map +1 -0
- package/lib/entities/observations/entities.observations.fields.numeric.d.ts +3 -0
- package/lib/entities/observations/entities.observations.fields.numeric.d.ts.map +1 -0
- package/lib/entities/observations/entities.observations.fields.numeric.js +24 -0
- package/lib/entities/observations/entities.observations.fields.numeric.js.map +1 -0
- package/lib/entities/observations/entities.observations.fields.required.d.ts +3 -0
- package/lib/entities/observations/entities.observations.fields.required.d.ts.map +1 -0
- package/lib/entities/observations/entities.observations.fields.required.js +14 -0
- package/lib/entities/observations/entities.observations.fields.required.js.map +1 -0
- package/lib/entities/observations/entities.observations.fields.select.d.ts +3 -0
- package/lib/entities/observations/entities.observations.fields.select.d.ts.map +1 -0
- package/lib/entities/observations/entities.observations.fields.select.js +17 -0
- package/lib/entities/observations/entities.observations.fields.select.js.map +1 -0
- package/lib/entities/observations/entities.observations.fields.text.d.ts +3 -0
- package/lib/entities/observations/entities.observations.fields.text.d.ts.map +1 -0
- package/lib/entities/observations/entities.observations.fields.text.js +15 -0
- package/lib/entities/observations/entities.observations.fields.text.js.map +1 -0
- package/lib/entities/observations/entities.observations.js +873 -0
- package/lib/entities/observations/entities.observations.js.map +1 -0
- package/lib/entities/ogcapi-features/entities.ogcapi-features.d.ts +98 -0
- package/lib/entities/ogcapi-features/entities.ogcapi-features.d.ts.map +1 -0
- package/lib/entities/ogcapi-features/entities.ogcapi-features.js +30 -0
- package/lib/entities/ogcapi-features/entities.ogcapi-features.js.map +1 -0
- package/lib/entities/teams/entities.teams.d.ts +26 -0
- package/lib/entities/teams/entities.teams.d.ts.map +1 -0
- package/lib/entities/teams/entities.teams.js +3 -0
- package/lib/entities/teams/entities.teams.js.map +1 -0
- package/lib/entities/users/entities.users.d.ts +66 -0
- package/lib/entities/users/entities.users.d.ts.map +1 -0
- package/lib/entities/users/entities.users.js +10 -0
- package/lib/entities/users/entities.users.js.map +1 -0
- package/lib/environment/env.d.ts +29 -0
- package/lib/environment/env.d.ts.map +1 -0
- package/lib/environment/env.js +106 -0
- package/lib/environment/env.js.map +1 -0
- package/lib/export/csv.d.ts +11 -0
- package/lib/export/csv.d.ts.map +1 -0
- package/lib/export/csv.js +243 -0
- package/lib/export/csv.js.map +1 -0
- package/lib/export/exporter.d.ts +12 -0
- package/lib/export/exporter.d.ts.map +1 -0
- package/lib/export/exporter.js +38 -0
- package/lib/export/exporter.js.map +1 -0
- package/lib/export/exporterFactory.d.ts +11 -0
- package/lib/export/exporterFactory.d.ts.map +1 -0
- package/lib/export/exporterFactory.js +17 -0
- package/lib/export/exporterFactory.js.map +1 -0
- package/lib/export/geojson.d.ts +10 -0
- package/lib/export/geojson.d.ts.map +1 -0
- package/lib/export/geojson.js +167 -0
- package/lib/export/geojson.js.map +1 -0
- package/lib/export/geopackage.d.ts +25 -0
- package/lib/export/geopackage.d.ts.map +1 -0
- package/lib/export/geopackage.js +687 -0
- package/lib/export/geopackage.js.map +1 -0
- package/lib/export/kml.d.ts +10 -0
- package/lib/export/kml.d.ts.map +1 -0
- package/lib/export/kml.js +128 -0
- package/lib/export/kml.js.map +1 -0
- package/lib/export/kmlWriter.d.ts +24 -0
- package/lib/export/kmlWriter.d.ts.map +1 -0
- package/lib/export/kmlWriter.js +431 -0
- package/lib/export/kmlWriter.js.map +1 -0
- package/lib/express.d.ts +9 -0
- package/lib/express.d.ts.map +1 -0
- package/lib/express.js +70 -0
- package/lib/express.js.map +1 -0
- package/lib/format/geoJsonFormat.d.ts +3 -0
- package/lib/format/geoJsonFormat.d.ts.map +1 -0
- package/lib/format/geoJsonFormat.js +65 -0
- package/lib/format/geoJsonFormat.js.map +1 -0
- package/lib/logger.d.ts +2 -0
- package/lib/logger.d.ts.map +1 -0
- package/lib/logger.js +21 -0
- package/lib/logger.js.map +1 -0
- package/lib/main.impl/main.impl.plugins.d.ts +12 -0
- package/lib/main.impl/main.impl.plugins.d.ts.map +1 -0
- package/lib/main.impl/main.impl.plugins.js +41 -0
- package/lib/main.impl/main.impl.plugins.js.map +1 -0
- package/lib/main.impl/plugin_hooks/main.impl.plugin_hooks.events.d.ts +3 -0
- package/lib/main.impl/plugin_hooks/main.impl.plugin_hooks.events.d.ts.map +1 -0
- package/lib/main.impl/plugin_hooks/main.impl.plugin_hooks.events.js +32 -0
- package/lib/main.impl/plugin_hooks/main.impl.plugin_hooks.events.js.map +1 -0
- package/lib/main.impl/plugin_hooks/main.impl.plugin_hooks.feeds.d.ts +4 -0
- package/lib/main.impl/plugin_hooks/main.impl.plugin_hooks.feeds.d.ts.map +1 -0
- package/lib/main.impl/plugin_hooks/main.impl.plugin_hooks.feeds.js +26 -0
- package/lib/main.impl/plugin_hooks/main.impl.plugin_hooks.feeds.js.map +1 -0
- package/lib/main.impl/plugin_hooks/main.impl.plugin_hooks.icons.d.ts +4 -0
- package/lib/main.impl/plugin_hooks/main.impl.plugin_hooks.icons.d.ts.map +1 -0
- package/lib/main.impl/plugin_hooks/main.impl.plugin_hooks.icons.js +41 -0
- package/lib/main.impl/plugin_hooks/main.impl.plugin_hooks.icons.js.map +1 -0
- package/lib/migrate.d.ts +4 -0
- package/lib/migrate.d.ts.map +1 -0
- package/lib/migrate.js +96 -0
- package/lib/migrate.js.map +1 -0
- package/lib/migrations/002-create-user-role.d.ts +4 -0
- package/lib/migrations/002-create-user-role.d.ts.map +1 -0
- package/lib/migrations/002-create-user-role.js +30 -0
- package/lib/migrations/002-create-user-role.js.map +1 -0
- package/lib/migrations/003-create-admin-role.d.ts +4 -0
- package/lib/migrations/003-create-admin-role.d.ts.map +1 -0
- package/lib/migrations/003-create-admin-role.js +31 -0
- package/lib/migrations/003-create-admin-role.js.map +1 -0
- package/lib/migrations/005-create-osm-layer.d.ts +4 -0
- package/lib/migrations/005-create-osm-layer.d.ts.map +1 -0
- package/lib/migrations/005-create-osm-layer.js +51 -0
- package/lib/migrations/005-create-osm-layer.js.map +1 -0
- package/lib/migrations/006-event-teams.d.ts +4 -0
- package/lib/migrations/006-event-teams.d.ts.map +1 -0
- package/lib/migrations/006-event-teams.js +40 -0
- package/lib/migrations/006-event-teams.js.map +1 -0
- package/lib/migrations/007-user-icon.d.ts +4 -0
- package/lib/migrations/007-user-icon.d.ts.map +1 -0
- package/lib/migrations/007-user-icon.js +21 -0
- package/lib/migrations/007-user-icon.js.map +1 -0
- package/lib/migrations/008-create-user-no-edit-role.d.ts +4 -0
- package/lib/migrations/008-create-user-no-edit-role.d.ts.map +1 -0
- package/lib/migrations/008-create-user-no-edit-role.js +34 -0
- package/lib/migrations/008-create-user-no-edit-role.js.map +1 -0
- package/lib/migrations/009-create-manager-role.d.ts +4 -0
- package/lib/migrations/009-create-manager-role.d.ts.map +1 -0
- package/lib/migrations/009-create-manager-role.js +50 -0
- package/lib/migrations/009-create-manager-role.js.map +1 -0
- package/lib/migrations/010-add-user-device-manager-role.d.ts +4 -0
- package/lib/migrations/010-add-user-device-manager-role.d.ts.map +1 -0
- package/lib/migrations/010-add-user-device-manager-role.js +38 -0
- package/lib/migrations/010-add-user-device-manager-role.js.map +1 -0
- package/lib/migrations/011-multiple-forms.d.ts +4 -0
- package/lib/migrations/011-multiple-forms.d.ts.map +1 -0
- package/lib/migrations/011-multiple-forms.js +161 -0
- package/lib/migrations/011-multiple-forms.js.map +1 -0
- package/lib/migrations/012-user-role-remove-delete.d.ts +4 -0
- package/lib/migrations/012-user-role-remove-delete.d.ts.map +1 -0
- package/lib/migrations/012-user-role-remove-delete.js +15 -0
- package/lib/migrations/012-user-role-remove-delete.js.map +1 -0
- package/lib/migrations/013-ensure-event-indexes.d.ts +4 -0
- package/lib/migrations/013-ensure-event-indexes.d.ts.map +1 -0
- package/lib/migrations/013-ensure-event-indexes.js +50 -0
- package/lib/migrations/013-ensure-event-indexes.js.map +1 -0
- package/lib/migrations/014-add-role-update-permission.d.ts +4 -0
- package/lib/migrations/014-add-role-update-permission.d.ts.map +1 -0
- package/lib/migrations/014-add-role-update-permission.js +15 -0
- package/lib/migrations/014-add-role-update-permission.js.map +1 -0
- package/lib/migrations/015-manager-role-add-user-create.d.ts +4 -0
- package/lib/migrations/015-manager-role-add-user-create.d.ts.map +1 -0
- package/lib/migrations/015-manager-role-add-user-create.js +15 -0
- package/lib/migrations/015-manager-role-add-user-create.js.map +1 -0
- package/lib/migrations/016-set-feed-primary-secondary.d.ts +4 -0
- package/lib/migrations/016-set-feed-primary-secondary.d.ts.map +1 -0
- package/lib/migrations/016-set-feed-primary-secondary.js +36 -0
- package/lib/migrations/016-set-feed-primary-secondary.js.map +1 -0
- package/lib/migrations/017-make-layers-available.d.ts +4 -0
- package/lib/migrations/017-make-layers-available.d.ts.map +1 -0
- package/lib/migrations/017-make-layers-available.js +48 -0
- package/lib/migrations/017-make-layers-available.js.map +1 -0
- package/lib/migrations/018-feeds-admin-permissions.d.ts +4 -0
- package/lib/migrations/018-feeds-admin-permissions.d.ts.map +1 -0
- package/lib/migrations/018-feeds-admin-permissions.js +32 -0
- package/lib/migrations/018-feeds-admin-permissions.js.map +1 -0
- package/lib/migrations/018-set-default-password-policy.d.ts +4 -0
- package/lib/migrations/018-set-default-password-policy.d.ts.map +1 -0
- package/lib/migrations/018-set-default-password-policy.js +58 -0
- package/lib/migrations/018-set-default-password-policy.js.map +1 -0
- package/lib/migrations/019-move-user-authentication.d.ts +4 -0
- package/lib/migrations/019-move-user-authentication.d.ts.map +1 -0
- package/lib/migrations/019-move-user-authentication.js +68 -0
- package/lib/migrations/019-move-user-authentication.js.map +1 -0
- package/lib/migrations/020-add-export-permissions.d.ts +4 -0
- package/lib/migrations/020-add-export-permissions.d.ts.map +1 -0
- package/lib/migrations/020-add-export-permissions.js +36 -0
- package/lib/migrations/020-add-export-permissions.js.map +1 -0
- package/lib/migrations/022-copy-auth-from-config-to-db.d.ts +4 -0
- package/lib/migrations/022-copy-auth-from-config-to-db.d.ts.map +1 -0
- package/lib/migrations/022-copy-auth-from-config-to-db.js +86 -0
- package/lib/migrations/022-copy-auth-from-config-to-db.js.map +1 -0
- package/lib/migrations/023-move-local-auth-from-settings.d.ts +4 -0
- package/lib/migrations/023-move-local-auth-from-settings.d.ts.map +1 -0
- package/lib/migrations/023-move-local-auth-from-settings.js +54 -0
- package/lib/migrations/023-move-local-auth-from-settings.js.map +1 -0
- package/lib/migrations/024-link-auth-to-auth-config.d.ts +4 -0
- package/lib/migrations/024-link-auth-to-auth-config.d.ts.map +1 -0
- package/lib/migrations/024-link-auth-to-auth-config.js +59 -0
- package/lib/migrations/024-link-auth-to-auth-config.js.map +1 -0
- package/lib/migrations/025-add-auth-config-permissions.d.ts +4 -0
- package/lib/migrations/025-add-auth-config-permissions.d.ts.map +1 -0
- package/lib/migrations/025-add-auth-config-permissions.js +32 -0
- package/lib/migrations/025-add-auth-config-permissions.js.map +1 -0
- package/lib/migrations/028-move-security-settings-to-secret-store.d.ts +4 -0
- package/lib/migrations/028-move-security-settings-to-secret-store.d.ts.map +1 -0
- package/lib/migrations/028-move-security-settings-to-secret-store.js +59 -0
- package/lib/migrations/028-move-security-settings-to-secret-store.js.map +1 -0
- package/lib/migrations/029-attachment-form-field.d.ts +4 -0
- package/lib/migrations/029-attachment-form-field.d.ts.map +1 -0
- package/lib/migrations/029-attachment-form-field.js +130 -0
- package/lib/migrations/029-attachment-form-field.js.map +1 -0
- package/lib/models/authentication.d.ts +17 -0
- package/lib/models/authentication.d.ts.map +1 -0
- package/lib/models/authentication.js +174 -0
- package/lib/models/authentication.js.map +1 -0
- package/lib/models/authenticationconfiguration.d.ts +15 -0
- package/lib/models/authenticationconfiguration.d.ts.map +1 -0
- package/lib/models/authenticationconfiguration.js +105 -0
- package/lib/models/authenticationconfiguration.js.map +1 -0
- package/lib/models/cappedLocation.d.ts +8 -0
- package/lib/models/cappedLocation.d.ts.map +1 -0
- package/lib/models/cappedLocation.js +78 -0
- package/lib/models/cappedLocation.js.map +1 -0
- package/lib/models/counter.d.ts +3 -0
- package/lib/models/counter.d.ts.map +1 -0
- package/lib/models/counter.js +37 -0
- package/lib/models/counter.js.map +1 -0
- package/lib/models/device.d.ts +14 -0
- package/lib/models/device.d.ts.map +1 -0
- package/lib/models/device.js +220 -0
- package/lib/models/device.js.map +1 -0
- package/lib/models/event.d.ts +75 -0
- package/lib/models/event.d.ts.map +1 -0
- package/lib/models/event.js +839 -0
- package/lib/models/event.js.map +1 -0
- package/lib/models/export.d.ts +18 -0
- package/lib/models/export.d.ts.map +1 -0
- package/lib/models/export.js +107 -0
- package/lib/models/export.js.map +1 -0
- package/lib/models/feature.d.ts +4 -0
- package/lib/models/feature.d.ts.map +1 -0
- package/lib/models/feature.js +43 -0
- package/lib/models/feature.js.map +1 -0
- package/lib/models/icon.d.ts +9 -0
- package/lib/models/icon.d.ts.map +1 -0
- package/lib/models/icon.js +69 -0
- package/lib/models/icon.js.map +1 -0
- package/lib/models/index.d.ts +2 -0
- package/lib/models/index.d.ts.map +1 -0
- package/lib/models/index.js +12 -0
- package/lib/models/index.js.map +1 -0
- package/lib/models/layer.d.ts +13 -0
- package/lib/models/layer.d.ts.map +1 -0
- package/lib/models/layer.js +149 -0
- package/lib/models/layer.js.map +1 -0
- package/lib/models/location.d.ts +8 -0
- package/lib/models/location.d.ts.map +1 -0
- package/lib/models/location.js +96 -0
- package/lib/models/location.js.map +1 -0
- package/lib/models/login.d.ts +4 -0
- package/lib/models/login.d.ts.map +1 -0
- package/lib/models/login.js +90 -0
- package/lib/models/login.js.map +1 -0
- package/lib/models/observation.d.ts +93 -0
- package/lib/models/observation.d.ts.map +1 -0
- package/lib/models/observation.js +461 -0
- package/lib/models/observation.js.map +1 -0
- package/lib/models/role.d.ts +22 -0
- package/lib/models/role.d.ts.map +1 -0
- package/lib/models/role.js +80 -0
- package/lib/models/role.js.map +1 -0
- package/lib/models/setting.d.ts +6 -0
- package/lib/models/setting.d.ts.map +1 -0
- package/lib/models/setting.js +31 -0
- package/lib/models/setting.js.map +1 -0
- package/lib/models/team.d.ts +31 -0
- package/lib/models/team.d.ts.map +1 -0
- package/lib/models/team.js +511 -0
- package/lib/models/team.js.map +1 -0
- package/lib/models/token.d.ts +6 -0
- package/lib/models/token.d.ts.map +1 -0
- package/lib/models/token.js +68 -0
- package/lib/models/token.js.map +1 -0
- package/lib/models/user.d.ts +60 -0
- package/lib/models/user.d.ts.map +1 -0
- package/lib/models/user.js +400 -0
- package/lib/models/user.js.map +1 -0
- package/lib/permissions/permissions.events.d.ts +69 -0
- package/lib/permissions/permissions.events.d.ts.map +1 -0
- package/lib/permissions/permissions.events.js +154 -0
- package/lib/permissions/permissions.events.js.map +1 -0
- package/lib/permissions/permissions.feeds.d.ts +19 -0
- package/lib/permissions/permissions.feeds.d.ts.map +1 -0
- package/lib/permissions/permissions.feeds.js +58 -0
- package/lib/permissions/permissions.feeds.js.map +1 -0
- package/lib/permissions/permissions.icons.d.ts +9 -0
- package/lib/permissions/permissions.icons.d.ts.map +1 -0
- package/lib/permissions/permissions.icons.js +28 -0
- package/lib/permissions/permissions.icons.js.map +1 -0
- package/lib/permissions/permissions.observations.d.ts +14 -0
- package/lib/permissions/permissions.observations.d.ts.map +1 -0
- package/lib/permissions/permissions.observations.js +113 -0
- package/lib/permissions/permissions.observations.js.map +1 -0
- package/lib/permissions/permissions.role-based.base.d.ts +15 -0
- package/lib/permissions/permissions.role-based.base.d.ts.map +1 -0
- package/lib/permissions/permissions.role-based.base.js +14 -0
- package/lib/permissions/permissions.role-based.base.js.map +1 -0
- package/lib/permissions/permissions.users.d.ts +8 -0
- package/lib/permissions/permissions.users.d.ts.map +1 -0
- package/lib/permissions/permissions.users.js +23 -0
- package/lib/permissions/permissions.users.js.map +1 -0
- package/lib/plugins.api/index.d.ts +55 -0
- package/lib/plugins.api/index.d.ts.map +1 -0
- package/lib/plugins.api/index.js +5 -0
- package/lib/plugins.api/index.js.map +1 -0
- package/lib/plugins.api/plugins.api.db.d.ts +7 -0
- package/lib/plugins.api/plugins.api.db.d.ts.map +1 -0
- package/lib/plugins.api/plugins.api.db.js +5 -0
- package/lib/plugins.api/plugins.api.db.js.map +1 -0
- package/lib/plugins.api/plugins.api.events.d.ts +24 -0
- package/lib/plugins.api/plugins.api.events.d.ts.map +1 -0
- package/lib/plugins.api/plugins.api.events.js +5 -0
- package/lib/plugins.api/plugins.api.events.js.map +1 -0
- package/lib/plugins.api/plugins.api.feeds.d.ts +35 -0
- package/lib/plugins.api/plugins.api.feeds.d.ts.map +1 -0
- package/lib/plugins.api/plugins.api.feeds.js +12 -0
- package/lib/plugins.api/plugins.api.feeds.js.map +1 -0
- package/lib/plugins.api/plugins.api.icons.d.ts +21 -0
- package/lib/plugins.api/plugins.api.icons.d.ts.map +1 -0
- package/lib/plugins.api/plugins.api.icons.js +5 -0
- package/lib/plugins.api/plugins.api.icons.js.map +1 -0
- package/lib/plugins.api/plugins.api.observations.d.ts +10 -0
- package/lib/plugins.api/plugins.api.observations.d.ts.map +1 -0
- package/lib/plugins.api/plugins.api.observations.js +11 -0
- package/lib/plugins.api/plugins.api.observations.js.map +1 -0
- package/lib/plugins.api/plugins.api.users.d.ts +4 -0
- package/lib/plugins.api/plugins.api.users.d.ts.map +1 -0
- package/lib/plugins.api/plugins.api.users.js +5 -0
- package/lib/plugins.api/plugins.api.users.js.map +1 -0
- package/lib/plugins.api/plugins.api.web.d.ts +10 -0
- package/lib/plugins.api/plugins.api.web.d.ts.map +1 -0
- package/lib/plugins.api/plugins.api.web.js +3 -0
- package/lib/plugins.api/plugins.api.web.js.map +1 -0
- package/lib/provision/index.d.ts +23 -0
- package/lib/provision/index.d.ts.map +1 -0
- package/lib/provision/index.js +60 -0
- package/lib/provision/index.js.map +1 -0
- package/lib/provision/none.d.ts +3 -0
- package/lib/provision/none.d.ts.map +1 -0
- package/lib/provision/none.js +41 -0
- package/lib/provision/none.js.map +1 -0
- package/lib/provision/strategies/none.d.ts +9 -0
- package/lib/provision/strategies/none.d.ts.map +1 -0
- package/lib/provision/strategies/none.js +25 -0
- package/lib/provision/strategies/none.js.map +1 -0
- package/lib/provision/strategies/uid.d.ts +9 -0
- package/lib/provision/strategies/uid.d.ts.map +1 -0
- package/lib/provision/strategies/uid.js +28 -0
- package/lib/provision/strategies/uid.js.map +1 -0
- package/lib/provision/uid.d.ts +3 -0
- package/lib/provision/uid.d.ts.map +1 -0
- package/lib/provision/uid.js +43 -0
- package/lib/provision/uid.js.map +1 -0
- package/lib/routes/authenticationconfigurations.d.ts +3 -0
- package/lib/routes/authenticationconfigurations.d.ts.map +1 -0
- package/lib/routes/authenticationconfigurations.js +209 -0
- package/lib/routes/authenticationconfigurations.js.map +1 -0
- package/lib/routes/devices.d.ts +3 -0
- package/lib/routes/devices.d.ts.map +1 -0
- package/lib/routes/devices.js +201 -0
- package/lib/routes/devices.js.map +1 -0
- package/lib/routes/events.d.ts +47 -0
- package/lib/routes/events.d.ts.map +1 -0
- package/lib/routes/events.js +495 -0
- package/lib/routes/events.js.map +1 -0
- package/lib/routes/exports.d.ts +3 -0
- package/lib/routes/exports.d.ts.map +1 -0
- package/lib/routes/exports.js +204 -0
- package/lib/routes/exports.js.map +1 -0
- package/lib/routes/imports.d.ts +3 -0
- package/lib/routes/imports.d.ts.map +1 -0
- package/lib/routes/imports.js +41 -0
- package/lib/routes/imports.js.map +1 -0
- package/lib/routes/index.d.ts +3 -0
- package/lib/routes/index.d.ts.map +1 -0
- package/lib/routes/index.js +151 -0
- package/lib/routes/index.js.map +1 -0
- package/lib/routes/layers.d.ts +3 -0
- package/lib/routes/layers.d.ts.map +1 -0
- package/lib/routes/layers.js +433 -0
- package/lib/routes/layers.js.map +1 -0
- package/lib/routes/locations.d.ts +3 -0
- package/lib/routes/locations.d.ts.map +1 -0
- package/lib/routes/locations.js +124 -0
- package/lib/routes/locations.js.map +1 -0
- package/lib/routes/logins.d.ts +3 -0
- package/lib/routes/logins.d.ts.map +1 -0
- package/lib/routes/logins.js +64 -0
- package/lib/routes/logins.js.map +1 -0
- package/lib/routes/observations.d.ts +3 -0
- package/lib/routes/observations.d.ts.map +1 -0
- package/lib/routes/observations.js +363 -0
- package/lib/routes/observations.js.map +1 -0
- package/lib/routes/plugins.d.ts +3 -0
- package/lib/routes/plugins.d.ts.map +1 -0
- package/lib/routes/plugins.js +29 -0
- package/lib/routes/plugins.js.map +1 -0
- package/lib/routes/roles.d.ts +3 -0
- package/lib/routes/roles.d.ts.map +1 -0
- package/lib/routes/roles.js +64 -0
- package/lib/routes/roles.js.map +1 -0
- package/lib/routes/settings.d.ts +3 -0
- package/lib/routes/settings.d.ts.map +1 -0
- package/lib/routes/settings.js +21 -0
- package/lib/routes/settings.js.map +1 -0
- package/lib/routes/setup.d.ts +3 -0
- package/lib/routes/setup.d.ts.map +1 -0
- package/lib/routes/setup.js +90 -0
- package/lib/routes/setup.js.map +1 -0
- package/lib/routes/teams.d.ts +3 -0
- package/lib/routes/teams.d.ts.map +1 -0
- package/lib/routes/teams.js +213 -0
- package/lib/routes/teams.js.map +1 -0
- package/lib/routes/users.d.ts +3 -0
- package/lib/routes/users.d.ts.map +1 -0
- package/lib/routes/users.js +478 -0
- package/lib/routes/users.js.map +1 -0
- package/lib/schedule/export/export-task.d.ts +14 -0
- package/lib/schedule/export/export-task.d.ts.map +1 -0
- package/lib/schedule/export/export-task.js +70 -0
- package/lib/schedule/export/export-task.js.map +1 -0
- package/lib/schedule/index.d.ts +2 -0
- package/lib/schedule/index.d.ts.map +1 -0
- package/lib/schedule/index.js +27 -0
- package/lib/schedule/index.js.map +1 -0
- package/lib/security/key-mgt/key-mgt-factory.d.ts +7 -0
- package/lib/security/key-mgt/key-mgt-factory.d.ts.map +1 -0
- package/lib/security/key-mgt/key-mgt-factory.js +10 -0
- package/lib/security/key-mgt/key-mgt-factory.js.map +1 -0
- package/lib/security/key-mgt/plaintext-key-manager.d.ts +42 -0
- package/lib/security/key-mgt/plaintext-key-manager.d.ts.map +1 -0
- package/lib/security/key-mgt/plaintext-key-manager.js +52 -0
- package/lib/security/key-mgt/plaintext-key-manager.js.map +1 -0
- package/lib/security/responses/data-response.d.ts +13 -0
- package/lib/security/responses/data-response.d.ts.map +1 -0
- package/lib/security/responses/data-response.js +25 -0
- package/lib/security/responses/data-response.js.map +1 -0
- package/lib/security/secret-store-service.d.ts +39 -0
- package/lib/security/secret-store-service.d.ts.map +1 -0
- package/lib/security/secret-store-service.js +94 -0
- package/lib/security/secret-store-service.js.map +1 -0
- package/lib/security/storage/file-system-secret-store.d.ts +17 -0
- package/lib/security/storage/file-system-secret-store.d.ts.map +1 -0
- package/lib/security/storage/file-system-secret-store.js +46 -0
- package/lib/security/storage/file-system-secret-store.js.map +1 -0
- package/lib/security/storage/json-provider.d.ts +6 -0
- package/lib/security/storage/json-provider.d.ts.map +1 -0
- package/lib/security/storage/json-provider.js +17 -0
- package/lib/security/storage/json-provider.js.map +1 -0
- package/lib/security/utilities/secure-property-appender.d.ts +8 -0
- package/lib/security/utilities/secure-property-appender.d.ts.map +1 -0
- package/lib/security/utilities/secure-property-appender.js +39 -0
- package/lib/security/utilities/secure-property-appender.js.map +1 -0
- package/lib/transformers/authenticationconfiguration.d.ts +2 -0
- package/lib/transformers/authenticationconfiguration.d.ts.map +1 -0
- package/lib/transformers/authenticationconfiguration.js +22 -0
- package/lib/transformers/authenticationconfiguration.js.map +1 -0
- package/lib/transformers/export.d.ts +2 -0
- package/lib/transformers/export.d.ts.map +1 -0
- package/lib/transformers/export.js +13 -0
- package/lib/transformers/export.js.map +1 -0
- package/lib/transformers/geojson.d.ts +2 -0
- package/lib/transformers/geojson.d.ts.map +1 -0
- package/lib/transformers/geojson.js +24 -0
- package/lib/transformers/geojson.js.map +1 -0
- package/lib/transformers/layer.d.ts +2 -0
- package/lib/transformers/layer.d.ts.map +1 -0
- package/lib/transformers/layer.js +13 -0
- package/lib/transformers/layer.js.map +1 -0
- package/lib/transformers/observation.d.ts +2 -0
- package/lib/transformers/observation.d.ts.map +1 -0
- package/lib/transformers/observation.js +13 -0
- package/lib/transformers/observation.js.map +1 -0
- package/lib/transformers/pageinfo.d.ts +2 -0
- package/lib/transformers/pageinfo.d.ts.map +1 -0
- package/lib/transformers/pageinfo.js +27 -0
- package/lib/transformers/pageinfo.js.map +1 -0
- package/lib/transformers/user.d.ts +2 -0
- package/lib/transformers/user.d.ts.map +1 -0
- package/lib/transformers/user.js +21 -0
- package/lib/transformers/user.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/upload.d.ts +8 -0
- package/lib/upload.d.ts.map +1 -0
- package/lib/upload.js +30 -0
- package/lib/upload.js.map +1 -0
- package/lib/utilities/authenticationApiAppender.d.ts +10 -0
- package/lib/utilities/authenticationApiAppender.d.ts.map +1 -0
- package/lib/utilities/authenticationApiAppender.js +48 -0
- package/lib/utilities/authenticationApiAppender.js.map +1 -0
- package/lib/utilities/filterParser.d.ts +2 -0
- package/lib/utilities/filterParser.d.ts.map +1 -0
- package/lib/utilities/filterParser.js +87 -0
- package/lib/utilities/filterParser.js.map +1 -0
- package/lib/utilities/geopackage.d.ts +56 -0
- package/lib/utilities/geopackage.d.ts.map +1 -0
- package/lib/utilities/geopackage.js +335 -0
- package/lib/utilities/geopackage.js.map +1 -0
- package/lib/utilities/loader.d.ts +9 -0
- package/lib/utilities/loader.d.ts.map +1 -0
- package/lib/utilities/loader.js +25 -0
- package/lib/utilities/loader.js.map +1 -0
- package/lib/utilities/paging.d.ts +15 -0
- package/lib/utilities/paging.d.ts.map +1 -0
- package/lib/utilities/paging.js +56 -0
- package/lib/utilities/paging.js.map +1 -0
- package/lib/utilities/passwordValidator.d.ts +8 -0
- package/lib/utilities/passwordValidator.d.ts.map +1 -0
- package/lib/utilities/passwordValidator.js +175 -0
- package/lib/utilities/passwordValidator.js.map +1 -0
- package/lib/utilities/pbkdf2.d.ts +6 -0
- package/lib/utilities/pbkdf2.d.ts.map +1 -0
- package/lib/utilities/pbkdf2.js +79 -0
- package/lib/utilities/pbkdf2.js.map +1 -0
- package/lib/utilities/togeojson.d.ts +2 -0
- package/lib/utilities/togeojson.d.ts.map +1 -0
- package/lib/utilities/togeojson.js +308 -0
- package/lib/utilities/togeojson.js.map +1 -0
- package/lib/utilities/waitForMongooseConnection.d.ts +3 -0
- package/lib/utilities/waitForMongooseConnection.d.ts.map +1 -0
- package/lib/utilities/waitForMongooseConnection.js +34 -0
- package/lib/utilities/waitForMongooseConnection.js.map +1 -0
- package/lib/utilities/whitelist.d.ts +2 -0
- package/lib/utilities/whitelist.d.ts.map +1 -0
- package/lib/utilities/whitelist.js +18 -0
- package/lib/utilities/whitelist.js.map +1 -0
- package/lib/views/authentication.pug +10 -0
- package/lib/views/oauth.pug +12 -0
- package/lib/views/observation.pug +137 -0
- package/package.json +203 -0
|
@@ -0,0 +1,873 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
26
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
27
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
28
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
29
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
30
|
+
};
|
|
31
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
32
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
33
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
34
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
35
|
+
};
|
|
36
|
+
var _Observation_validation, _Observation_formEntriesById, _Observation_attachmentsById, _FormEntryValidationError_entryLevelErrors, _FormEntryValidationError_fieldErrors, _ObservationValidationContext_coreAttrsErrors, _ObservationValidationContext_formCountErrors, _ObservationValidationContext_formEntryErrors, _ObservationValidationContext_attachmentErrors, _ObservationValidationContext_totalFormCountError;
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.AttachmentStoreErrorCode = exports.AttachmentStoreError = exports.StagedAttachmentContent = exports.StagedAttachmentContentRef = exports.ObservationRepositoryErrorCode = exports.ObservationRepositoryError = exports.AttachmentNotFoundError = exports.AttachmentAddError = exports.thumbnailIndexForTargetDimension = exports.putAttachmentThumbnailForMinDimension = exports.removeAttachment = exports.patchAttachment = exports.addAttachment = exports.removeFormEntry = exports.attachmentsForField = exports.formEntryForId = exports.ObservationUpdateErrorReason = exports.ObservationUpdateError = exports.validationResultMessage = exports.AttachmentValidationError = exports.AttachmentValidationErrorReason = exports.FormFieldValidationError = exports.FieldConstraintKey = exports.FormEntryValidationErrorReason = exports.FormEntryValidationError = exports.FormCountError = exports.TotalFormCountError = exports.MaxFormsConstraint = exports.MinFormsConstraint = exports.validateObservation = exports.ObservationDomainEventType = exports.Observation = exports.copyImportantFlagAttrs = exports.copyObservationStateAttrs = exports.copyThumbnailAttrs = exports.copyAttachmentAttrs = exports.copyObservationAttrs = void 0;
|
|
39
|
+
const entities_global_1 = require("../entities.global");
|
|
40
|
+
const entities_events_forms_1 = require("../events/entities.events.forms");
|
|
41
|
+
const fields = __importStar(require("./entities.observations.fields"));
|
|
42
|
+
function copyObservationAttrs(from) {
|
|
43
|
+
return {
|
|
44
|
+
id: from.id,
|
|
45
|
+
eventId: from.eventId,
|
|
46
|
+
userId: from.userId,
|
|
47
|
+
deviceId: from.deviceId,
|
|
48
|
+
createdAt: new Date(from.createdAt.getTime()),
|
|
49
|
+
lastModified: new Date(from.lastModified.getTime()),
|
|
50
|
+
attachments: from.attachments.map(copyAttachmentAttrs),
|
|
51
|
+
important: from.important ? copyImportantFlagAttrs(from.important) : undefined,
|
|
52
|
+
favoriteUserIds: Object.freeze([...from.favoriteUserIds]),
|
|
53
|
+
states: Object.freeze(from.states.map(copyObservationStateAttrs)),
|
|
54
|
+
type: 'Feature',
|
|
55
|
+
// meh, these shallow copies are probably fine ... right?
|
|
56
|
+
geometry: Object.freeze(Object.assign({}, from.geometry)),
|
|
57
|
+
properties: Object.assign(Object.assign({}, from.properties), { forms: from.properties.forms.map(x => (Object.assign({}, x))), timestamp: new Date(from.properties.timestamp) })
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
exports.copyObservationAttrs = copyObservationAttrs;
|
|
61
|
+
function copyAttachmentAttrs(from) {
|
|
62
|
+
return {
|
|
63
|
+
id: from.id,
|
|
64
|
+
fieldName: from.fieldName,
|
|
65
|
+
observationFormId: from.observationFormId,
|
|
66
|
+
lastModified: from.lastModified ? new Date(from.lastModified) : undefined,
|
|
67
|
+
contentType: from.contentType,
|
|
68
|
+
name: from.name,
|
|
69
|
+
size: from.size,
|
|
70
|
+
width: from.width,
|
|
71
|
+
height: from.height,
|
|
72
|
+
oriented: from.oriented,
|
|
73
|
+
thumbnails: from.thumbnails.map(copyThumbnailAttrs),
|
|
74
|
+
contentLocator: from.contentLocator
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
exports.copyAttachmentAttrs = copyAttachmentAttrs;
|
|
78
|
+
function copyThumbnailAttrs(from) {
|
|
79
|
+
return {
|
|
80
|
+
minDimension: from.minDimension,
|
|
81
|
+
contentLocator: from.contentLocator,
|
|
82
|
+
contentType: from.contentType,
|
|
83
|
+
name: from.name,
|
|
84
|
+
size: from.size,
|
|
85
|
+
width: from.width,
|
|
86
|
+
height: from.height
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
exports.copyThumbnailAttrs = copyThumbnailAttrs;
|
|
90
|
+
function copyObservationStateAttrs(from) {
|
|
91
|
+
return {
|
|
92
|
+
id: from.id,
|
|
93
|
+
name: from.name,
|
|
94
|
+
userId: from.userId
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
exports.copyObservationStateAttrs = copyObservationStateAttrs;
|
|
98
|
+
function copyImportantFlagAttrs(from) {
|
|
99
|
+
return {
|
|
100
|
+
userId: from.userId,
|
|
101
|
+
description: from.description,
|
|
102
|
+
timestamp: from.timestamp ? new Date(from.timestamp.getTime()) : undefined
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
exports.copyImportantFlagAttrs = copyImportantFlagAttrs;
|
|
106
|
+
/**
|
|
107
|
+
* The intention of this class is to provide a mutation model for observation
|
|
108
|
+
* updates. While `ObservationAttrs` is more just raw the keys and values of
|
|
109
|
+
* observations, this class retains some extra context for validation so
|
|
110
|
+
* the client can make changes to the observation data while receiving
|
|
111
|
+
* validation feedback for every operation performed on the observation.
|
|
112
|
+
* TODO: add domain event tracking to this class
|
|
113
|
+
*/
|
|
114
|
+
class Observation {
|
|
115
|
+
constructor(...args) {
|
|
116
|
+
_Observation_validation.set(this, void 0);
|
|
117
|
+
_Observation_formEntriesById.set(this, void 0);
|
|
118
|
+
_Observation_attachmentsById.set(this, void 0);
|
|
119
|
+
this.type = 'Feature';
|
|
120
|
+
if (args[0] !== ObservationConstructionToken) {
|
|
121
|
+
throw new Error('use a factory function to create an observation instance');
|
|
122
|
+
}
|
|
123
|
+
const attrs = args[1];
|
|
124
|
+
this.mageEvent = args[2];
|
|
125
|
+
this.id = attrs.id;
|
|
126
|
+
this.eventId = attrs.eventId;
|
|
127
|
+
this.userId = attrs.userId;
|
|
128
|
+
this.deviceId = attrs.deviceId;
|
|
129
|
+
this.createdAt = new Date(attrs.createdAt);
|
|
130
|
+
this.lastModified = new Date(attrs.lastModified);
|
|
131
|
+
this.important = attrs.important ? Object.freeze(Object.assign({}, attrs.important)) : undefined;
|
|
132
|
+
const states = attrs.states.length ? attrs.states.map(copyObservationStateAttrs) : [
|
|
133
|
+
{
|
|
134
|
+
id: entities_global_1.PendingEntityId,
|
|
135
|
+
name: 'active',
|
|
136
|
+
userId: attrs.userId
|
|
137
|
+
}
|
|
138
|
+
];
|
|
139
|
+
this.states = Object.freeze(states);
|
|
140
|
+
this.favoriteUserIds = Object.freeze(attrs.favoriteUserIds.slice());
|
|
141
|
+
this.type = 'Feature';
|
|
142
|
+
this.bbox = attrs.bbox;
|
|
143
|
+
this.geometry = attrs.geometry;
|
|
144
|
+
this.attachments = Object.freeze([...attrs.attachments]);
|
|
145
|
+
this.properties = Object.assign({}, attrs.properties);
|
|
146
|
+
__classPrivateFieldSet(this, _Observation_formEntriesById, new Map(this.properties.forms.map(x => [x.id, x])), "f");
|
|
147
|
+
__classPrivateFieldSet(this, _Observation_attachmentsById, new Map(this.attachments.map(x => [x.id, x])), "f");
|
|
148
|
+
__classPrivateFieldSet(this, _Observation_validation, args[3], "f");
|
|
149
|
+
this.pendingEvents = (args[4] || []);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Validate the given observation attributes against the given MAGE event's
|
|
153
|
+
* constraints and forms, and create the corresponding `Observation` instance
|
|
154
|
+
* with the validation result.
|
|
155
|
+
* @param attrs
|
|
156
|
+
* @param mageEvent
|
|
157
|
+
*/
|
|
158
|
+
static evaluate(attrs, mageEvent) {
|
|
159
|
+
return createObservation(attrs, mageEvent);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* TODO: This does not currently do anything besides assigning the
|
|
163
|
+
* `lastModified` timestamp on the updated observation and calling
|
|
164
|
+
* {@link Observation.evaluate()} with the given update attributes.
|
|
165
|
+
* Eventually this should perform the logic to find the differences and
|
|
166
|
+
* produce the domain events resulting from updating the target observation
|
|
167
|
+
* to the update attributes.
|
|
168
|
+
*
|
|
169
|
+
* Return an {@link ObservationUpdateError} if the event IDs on the target
|
|
170
|
+
* and udpate do not match.
|
|
171
|
+
*
|
|
172
|
+
* @param target
|
|
173
|
+
* @param update
|
|
174
|
+
* @returns
|
|
175
|
+
*/
|
|
176
|
+
static assignTo(target, update) {
|
|
177
|
+
if (update.eventId !== target.eventId) {
|
|
178
|
+
return ObservationUpdateError.eventIdMismatch(target.eventId, update.eventId);
|
|
179
|
+
}
|
|
180
|
+
update = Object.assign(Object.assign({}, update), { createdAt: new Date(target.createdAt), lastModified: new Date() });
|
|
181
|
+
const updateAttachments = update.attachments.reduce((updateAttachments, att) => {
|
|
182
|
+
return updateAttachments.set(att.id, att);
|
|
183
|
+
}, new Map());
|
|
184
|
+
const removedAttachments = target.attachments.filter(x => !updateAttachments.has(x.id));
|
|
185
|
+
// TODO: whatever other mods generate events that matter
|
|
186
|
+
const updateEvents = removedAttachments.length ? [AttachmentsRemovedDomainEvent(target, removedAttachments)] : [];
|
|
187
|
+
const pendingEvents = mergePendingDomainEvents(target, updateEvents);
|
|
188
|
+
return createObservation(update, target.mageEvent, pendingEvents);
|
|
189
|
+
}
|
|
190
|
+
get validation() {
|
|
191
|
+
return __classPrivateFieldGet(this, _Observation_validation, "f");
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* This is a convenience accessor for {@link ObservationFeatureProperties.timestamp}.
|
|
195
|
+
*/
|
|
196
|
+
get timestamp() {
|
|
197
|
+
return this.properties.timestamp;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* This is a convenience accessor for {@link ObservationFeatureProperties.forms}.
|
|
201
|
+
*/
|
|
202
|
+
get formEntries() {
|
|
203
|
+
return Array.from(__classPrivateFieldGet(this, _Observation_formEntriesById, "f").values());
|
|
204
|
+
}
|
|
205
|
+
formEntryForId(id) {
|
|
206
|
+
return __classPrivateFieldGet(this, _Observation_formEntriesById, "f").get(id) || null;
|
|
207
|
+
}
|
|
208
|
+
attachmentFor(id) {
|
|
209
|
+
return __classPrivateFieldGet(this, _Observation_attachmentsById, "f").get(id) || null;
|
|
210
|
+
}
|
|
211
|
+
attachmentsForField(fieldName, formEntryId) {
|
|
212
|
+
return attachmentsForField(fieldName, formEntryId, this);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
exports.Observation = Observation;
|
|
216
|
+
_Observation_validation = new WeakMap(), _Observation_formEntriesById = new WeakMap(), _Observation_attachmentsById = new WeakMap();
|
|
217
|
+
var ObservationDomainEventType;
|
|
218
|
+
(function (ObservationDomainEventType) {
|
|
219
|
+
ObservationDomainEventType["AttachmentsRemoved"] = "Observation.AttachmentsRemoved";
|
|
220
|
+
})(ObservationDomainEventType = exports.ObservationDomainEventType || (exports.ObservationDomainEventType = {}));
|
|
221
|
+
function validateObservation(observationAttrs, mageEvent) {
|
|
222
|
+
const validation = validateObservationFormEntries(validateObservationAttachments(validateObservationCoreAttrs(new ObservationValidationContext(observationAttrs, mageEvent))));
|
|
223
|
+
return validation.result();
|
|
224
|
+
}
|
|
225
|
+
exports.validateObservation = validateObservation;
|
|
226
|
+
exports.MinFormsConstraint = Symbol('ObservationValidation.MinForms');
|
|
227
|
+
exports.MaxFormsConstraint = Symbol('ObservationValidation.MaxForms');
|
|
228
|
+
class TotalFormCountError {
|
|
229
|
+
constructor(constraint, constraintCount) {
|
|
230
|
+
this.constraint = constraint;
|
|
231
|
+
this.constraintCount = constraintCount;
|
|
232
|
+
}
|
|
233
|
+
static tooFewFormEntries(mageEvent) {
|
|
234
|
+
return new TotalFormCountError(exports.MinFormsConstraint, Number(mageEvent.minObservationForms));
|
|
235
|
+
}
|
|
236
|
+
static tooManyFormEntries(mageEvent) {
|
|
237
|
+
return new TotalFormCountError(exports.MaxFormsConstraint, Number(mageEvent.maxObservationForms));
|
|
238
|
+
}
|
|
239
|
+
message() {
|
|
240
|
+
if (this.constraint === exports.MinFormsConstraint) {
|
|
241
|
+
return `The event requires at least ${this.constraintCount} form ${this.constraintCount > 1 ? 'entries' : 'entry'}.`;
|
|
242
|
+
}
|
|
243
|
+
return `The event allows at most ${this.constraintCount} form ${this.constraintCount > 1 ? 'entries' : 'entry'}.`;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
exports.TotalFormCountError = TotalFormCountError;
|
|
247
|
+
class FormCountError {
|
|
248
|
+
constructor(constraint, constraintCount, formId, formName) {
|
|
249
|
+
this.constraint = constraint;
|
|
250
|
+
this.constraintCount = constraintCount;
|
|
251
|
+
this.formId = formId;
|
|
252
|
+
this.formName = formName;
|
|
253
|
+
}
|
|
254
|
+
static tooFewEntriesForForm(form) {
|
|
255
|
+
return new FormCountError(exports.MinFormsConstraint, Number(form.min), form.id, form.name);
|
|
256
|
+
}
|
|
257
|
+
static tooManyEntriesForForm(form) {
|
|
258
|
+
return new FormCountError(exports.MaxFormsConstraint, Number(form.max), form.id, form.name);
|
|
259
|
+
}
|
|
260
|
+
message() {
|
|
261
|
+
if (this.constraint === exports.MinFormsConstraint) {
|
|
262
|
+
return `The event requires at least ${this.constraintCount} ${this.formName} form ${this.constraintCount > 1 ? 'entries' : 'entry'}.`;
|
|
263
|
+
}
|
|
264
|
+
return `The event allows at most ${this.constraintCount} ${this.formName} form ${this.constraintCount > 1 ? 'entries' : 'entry'}.`;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
exports.FormCountError = FormCountError;
|
|
268
|
+
class FormEntryValidationError {
|
|
269
|
+
constructor(formEntryId, formEntryPosition) {
|
|
270
|
+
this.formEntryId = formEntryId;
|
|
271
|
+
this.formEntryPosition = formEntryPosition;
|
|
272
|
+
_FormEntryValidationError_entryLevelErrors.set(this, new Set());
|
|
273
|
+
_FormEntryValidationError_fieldErrors.set(this, new Map()
|
|
274
|
+
/**
|
|
275
|
+
* If there is no form reference error, set the form name for convenience
|
|
276
|
+
* when building the validation error message text.
|
|
277
|
+
*/
|
|
278
|
+
);
|
|
279
|
+
/**
|
|
280
|
+
* If there is no form reference error, set the form name for convenience
|
|
281
|
+
* when building the validation error message text.
|
|
282
|
+
*/
|
|
283
|
+
this.formName = null;
|
|
284
|
+
}
|
|
285
|
+
addEntryLevelError(x) {
|
|
286
|
+
__classPrivateFieldGet(this, _FormEntryValidationError_entryLevelErrors, "f").add(x);
|
|
287
|
+
return this;
|
|
288
|
+
}
|
|
289
|
+
addFieldError(x) {
|
|
290
|
+
__classPrivateFieldGet(this, _FormEntryValidationError_fieldErrors, "f").set(x.fieldName, x);
|
|
291
|
+
return this;
|
|
292
|
+
}
|
|
293
|
+
get entryLevelErrors() {
|
|
294
|
+
return new Set(__classPrivateFieldGet(this, _FormEntryValidationError_entryLevelErrors, "f"));
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* This is a map of field names to form field validation errors.
|
|
298
|
+
*/
|
|
299
|
+
get fieldErrors() {
|
|
300
|
+
return new Map(__classPrivateFieldGet(this, _FormEntryValidationError_fieldErrors, "f"));
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
exports.FormEntryValidationError = FormEntryValidationError;
|
|
304
|
+
_FormEntryValidationError_entryLevelErrors = new WeakMap(), _FormEntryValidationError_fieldErrors = new WeakMap();
|
|
305
|
+
var FormEntryValidationErrorReason;
|
|
306
|
+
(function (FormEntryValidationErrorReason) {
|
|
307
|
+
FormEntryValidationErrorReason["FormRef"] = "FormEntryValidationErrorReason.FormRef";
|
|
308
|
+
FormEntryValidationErrorReason["DuplicateId"] = "FormEntryValidationErrorReason.DuplicateId";
|
|
309
|
+
})(FormEntryValidationErrorReason = exports.FormEntryValidationErrorReason || (exports.FormEntryValidationErrorReason = {}));
|
|
310
|
+
var FieldConstraintKey;
|
|
311
|
+
(function (FieldConstraintKey) {
|
|
312
|
+
FieldConstraintKey["Value"] = "value";
|
|
313
|
+
FieldConstraintKey["Min"] = "min";
|
|
314
|
+
FieldConstraintKey["Max"] = "max";
|
|
315
|
+
FieldConstraintKey["Required"] = "required";
|
|
316
|
+
})(FieldConstraintKey = exports.FieldConstraintKey || (exports.FieldConstraintKey = {}));
|
|
317
|
+
class FormFieldValidationError {
|
|
318
|
+
constructor(attrs) {
|
|
319
|
+
this.fieldName = attrs.fieldName;
|
|
320
|
+
this.constraint = attrs.constraint;
|
|
321
|
+
this.message = attrs.message;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* `error` is a readonly accessor alias for `validationRuleKey` for backward
|
|
325
|
+
* compatibility.
|
|
326
|
+
* TODO: verify this is still necessary (NECESSARY?!)
|
|
327
|
+
*/
|
|
328
|
+
get error() {
|
|
329
|
+
return this.constraint;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
exports.FormFieldValidationError = FormFieldValidationError;
|
|
333
|
+
var AttachmentValidationErrorReason;
|
|
334
|
+
(function (AttachmentValidationErrorReason) {
|
|
335
|
+
AttachmentValidationErrorReason["FieldRef"] = "AttachmentValidationErrorReason.FieldRef";
|
|
336
|
+
AttachmentValidationErrorReason["FormEntryRef"] = "AttachmentValidationErrorReason.FormEntryRef";
|
|
337
|
+
AttachmentValidationErrorReason["DuplicateId"] = "AttachmentValidationErrorReason.DuplicateId";
|
|
338
|
+
})(AttachmentValidationErrorReason = exports.AttachmentValidationErrorReason || (exports.AttachmentValidationErrorReason = {}));
|
|
339
|
+
class AttachmentValidationError {
|
|
340
|
+
constructor(reason, message) {
|
|
341
|
+
this.reason = reason;
|
|
342
|
+
this.message = message;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
exports.AttachmentValidationError = AttachmentValidationError;
|
|
346
|
+
function validationResultMessage(result) {
|
|
347
|
+
const { coreAttrsErrors, totalFormCountError, formCountErrors, formEntryErrors, attachmentErrors, } = result;
|
|
348
|
+
const bulletPoint = '\u2022';
|
|
349
|
+
const errList = [];
|
|
350
|
+
for (const message of Object.values(coreAttrsErrors)) {
|
|
351
|
+
errList.push(`${bulletPoint} ${message}`);
|
|
352
|
+
}
|
|
353
|
+
if (totalFormCountError) {
|
|
354
|
+
errList.push(`${bulletPoint} ${totalFormCountError.message()}`);
|
|
355
|
+
}
|
|
356
|
+
for (const [formId, err] of formCountErrors) {
|
|
357
|
+
errList.push(`${bulletPoint} ${err.message()}`);
|
|
358
|
+
}
|
|
359
|
+
for (const [formEntryId, formEntryErr] of formEntryErrors) {
|
|
360
|
+
errList.push(`${bulletPoint} Form entry ${formEntryErr.formEntryPosition + 1} (${formEntryErr.formName}) is invalid.`);
|
|
361
|
+
for (const fieldErr of formEntryErr.fieldErrors.values()) {
|
|
362
|
+
errList.push(` ${bulletPoint} ${fieldErr.message}`);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
for (const [pos, attachmentErr] of attachmentErrors) {
|
|
366
|
+
errList.push(`${bulletPoint} Attachment ${pos + 1} is invalid. ${attachmentErr.message}`);
|
|
367
|
+
}
|
|
368
|
+
return errList.join('\n');
|
|
369
|
+
}
|
|
370
|
+
exports.validationResultMessage = validationResultMessage;
|
|
371
|
+
class ObservationUpdateError extends Error {
|
|
372
|
+
constructor(reason, message) {
|
|
373
|
+
super(message);
|
|
374
|
+
this.reason = reason;
|
|
375
|
+
}
|
|
376
|
+
static eventIdMismatch(expected, actual) {
|
|
377
|
+
return new ObservationUpdateError(ObservationUpdateErrorReason.EventId, `The update event ID ${actual} does not match the target event ID ${expected}.`);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
exports.ObservationUpdateError = ObservationUpdateError;
|
|
381
|
+
var ObservationUpdateErrorReason;
|
|
382
|
+
(function (ObservationUpdateErrorReason) {
|
|
383
|
+
ObservationUpdateErrorReason["EventId"] = "event_id";
|
|
384
|
+
})(ObservationUpdateErrorReason = exports.ObservationUpdateErrorReason || (exports.ObservationUpdateErrorReason = {}));
|
|
385
|
+
function formEntryForId(formEntryId, observation) {
|
|
386
|
+
return observation.properties.forms.find(x => x.id === formEntryId) || null;
|
|
387
|
+
}
|
|
388
|
+
exports.formEntryForId = formEntryForId;
|
|
389
|
+
function attachmentsForField(field, formEntry, observationAttrs) {
|
|
390
|
+
const fieldName = typeof field === 'object' ? field.name : field;
|
|
391
|
+
const formEntryId = typeof formEntry === 'object' && 'id' in formEntry && 'formId' in formEntry ? formEntry.id : formEntry;
|
|
392
|
+
return observationAttrs.attachments.filter(x => x.fieldName === fieldName && x.observationFormId === formEntryId);
|
|
393
|
+
}
|
|
394
|
+
exports.attachmentsForField = attachmentsForField;
|
|
395
|
+
/**
|
|
396
|
+
* Remove the form entry with the given ID and return the resulting
|
|
397
|
+
* (potentially invalid) observation.
|
|
398
|
+
*
|
|
399
|
+
* TODO: add a `FormEntryNotFound` error similar to `removeAttachment()`
|
|
400
|
+
*/
|
|
401
|
+
function removeFormEntry(observation, formEntryId) {
|
|
402
|
+
const mod = copyObservationAttrs(observation);
|
|
403
|
+
const targetPos = observation.formEntries.findIndex(x => x.id === formEntryId);
|
|
404
|
+
mod.properties.forms.splice(targetPos, 1);
|
|
405
|
+
mod.attachments = observation.attachments.filter(x => x.observationFormId !== formEntryId);
|
|
406
|
+
return Observation.assignTo(observation, mod);
|
|
407
|
+
}
|
|
408
|
+
exports.removeFormEntry = removeFormEntry;
|
|
409
|
+
/**
|
|
410
|
+
* Add the given attachment to the given observation. Return a new observation
|
|
411
|
+
* instance with the added attachment, or return an {@link AttachmentAddError}
|
|
412
|
+
* if the given attachment does not reference a valid form entry and field.
|
|
413
|
+
* Note that the returned observation may still have validation errors resulting
|
|
414
|
+
* from the added attachment if the attachment violates the associated form
|
|
415
|
+
* constraints, such as min/max or allowed attachment types.
|
|
416
|
+
* @param observation
|
|
417
|
+
* @param fieldName
|
|
418
|
+
* @param formEntryId
|
|
419
|
+
* @param attrs
|
|
420
|
+
* @returns
|
|
421
|
+
*/
|
|
422
|
+
function addAttachment(observation, attachmentId, fieldName, formEntryId, attrs) {
|
|
423
|
+
const attachment = Object.assign(Object.assign({}, attrs), { id: attachmentId, fieldName, observationFormId: formEntryId, lastModified: new Date() });
|
|
424
|
+
const invalid = validateAttachment(attachment, observation, observation.mageEvent);
|
|
425
|
+
if (invalid) {
|
|
426
|
+
return AttachmentAddError.invalidNewAttachment(invalid);
|
|
427
|
+
}
|
|
428
|
+
const mod = copyObservationAttrs(observation);
|
|
429
|
+
mod.attachments = [...mod.attachments, attachment];
|
|
430
|
+
return Observation.assignTo(observation, mod);
|
|
431
|
+
}
|
|
432
|
+
exports.addAttachment = addAttachment;
|
|
433
|
+
/**
|
|
434
|
+
* Update the attachment for the given ID with the given patch object. Keys
|
|
435
|
+
* that are present in the patch whose values are `undefined` will assign
|
|
436
|
+
* `undefined` to the resulting updated attachment. Keys not present in the
|
|
437
|
+
* patch will have no affect on the resulting updated attachment.
|
|
438
|
+
* @param observation
|
|
439
|
+
* @param attachmentId
|
|
440
|
+
* @param patch
|
|
441
|
+
* @returns
|
|
442
|
+
*/
|
|
443
|
+
function patchAttachment(observation, attachmentId, patch) {
|
|
444
|
+
var _a;
|
|
445
|
+
const targetPos = observation.attachments.findIndex(x => x.id === attachmentId);
|
|
446
|
+
const target = observation.attachments[targetPos];
|
|
447
|
+
if (!target) {
|
|
448
|
+
return new AttachmentNotFoundError(attachmentId);
|
|
449
|
+
}
|
|
450
|
+
const patched = copyAttachmentAttrs(target);
|
|
451
|
+
patched.contentType = patch.hasOwnProperty('contentType') ? patch.contentType : patched.contentType;
|
|
452
|
+
patched.height = patch.hasOwnProperty('height') ? patch.height : patched.height;
|
|
453
|
+
patched.width = patch.hasOwnProperty('width') ? patch.width : patched.width;
|
|
454
|
+
patched.name = patch.hasOwnProperty('name') ? patch.name : patched.name;
|
|
455
|
+
patched.oriented = patch.hasOwnProperty('oriented') ? !!patch.oriented : patched.oriented;
|
|
456
|
+
patched.size = patch.hasOwnProperty('size') ? patch.size : patched.size;
|
|
457
|
+
patched.contentLocator = patch.hasOwnProperty('contentLocator') ? patch.contentLocator : patched.contentLocator;
|
|
458
|
+
patched.thumbnails = patch.hasOwnProperty('thumbnails') ? (_a = patch.thumbnails) === null || _a === void 0 ? void 0 : _a.map(copyThumbnailAttrs) : patched.thumbnails;
|
|
459
|
+
patched.lastModified = new Date();
|
|
460
|
+
const patchedObservation = copyObservationAttrs(observation);
|
|
461
|
+
const before = patchedObservation.attachments.slice(0, targetPos);
|
|
462
|
+
const after = patchedObservation.attachments.slice(targetPos + 1);
|
|
463
|
+
const attachments = before.concat(patched, after);
|
|
464
|
+
patchedObservation.attachments = Object.freeze(attachments);
|
|
465
|
+
patchedObservation.lastModified = new Date(patched.lastModified);
|
|
466
|
+
return Observation.assignTo(observation, patchedObservation);
|
|
467
|
+
}
|
|
468
|
+
exports.patchAttachment = patchAttachment;
|
|
469
|
+
function removeAttachment(observation, attachmentId) {
|
|
470
|
+
const targetPos = observation.attachments.findIndex(x => x.id === attachmentId);
|
|
471
|
+
const target = observation.attachments[targetPos];
|
|
472
|
+
if (!target) {
|
|
473
|
+
return new AttachmentNotFoundError(attachmentId);
|
|
474
|
+
}
|
|
475
|
+
const afterAttrs = copyObservationAttrs(observation);
|
|
476
|
+
const attachments = afterAttrs.attachments.slice();
|
|
477
|
+
attachments.splice(targetPos, 1);
|
|
478
|
+
afterAttrs.attachments = attachments;
|
|
479
|
+
return Observation.assignTo(observation, afterAttrs);
|
|
480
|
+
}
|
|
481
|
+
exports.removeAttachment = removeAttachment;
|
|
482
|
+
/**
|
|
483
|
+
* Add the given thumbnail to the given attachment. If the attachment already
|
|
484
|
+
* has a thumbnail at the same minimum dimension as the given thumbnail,
|
|
485
|
+
* replace the existing thumbnail with the given thumbnail at the same position
|
|
486
|
+
* in the thumbnails array.
|
|
487
|
+
* @param observation
|
|
488
|
+
* @param attachmentId
|
|
489
|
+
* @param thumbnail
|
|
490
|
+
* @returns
|
|
491
|
+
*/
|
|
492
|
+
function putAttachmentThumbnailForMinDimension(observation, attachmentId, thumbnail) {
|
|
493
|
+
const target = observation.attachmentFor(attachmentId);
|
|
494
|
+
if (!target) {
|
|
495
|
+
return new AttachmentNotFoundError(attachmentId);
|
|
496
|
+
}
|
|
497
|
+
const thumbnailsPatch = target.thumbnails.map(copyThumbnailAttrs);
|
|
498
|
+
const targetThumbPos = thumbnailsPatch.findIndex(x => x.minDimension === thumbnail.minDimension);
|
|
499
|
+
const putThumbAttrs = copyThumbnailAttrs(thumbnail);
|
|
500
|
+
if (targetThumbPos >= 0) {
|
|
501
|
+
thumbnailsPatch[targetThumbPos] = putThumbAttrs;
|
|
502
|
+
}
|
|
503
|
+
else {
|
|
504
|
+
thumbnailsPatch.push(putThumbAttrs);
|
|
505
|
+
}
|
|
506
|
+
return patchAttachment(observation, attachmentId, { thumbnails: thumbnailsPatch });
|
|
507
|
+
}
|
|
508
|
+
exports.putAttachmentThumbnailForMinDimension = putAttachmentThumbnailForMinDimension;
|
|
509
|
+
/**
|
|
510
|
+
* Return the index of the thumbnail on the given attachment that best satisfies
|
|
511
|
+
* the given target dimension. That will be the thumbnail with the smallest
|
|
512
|
+
* {@link Attachment.minDimension} greater than the target dimension.
|
|
513
|
+
*/
|
|
514
|
+
function thumbnailIndexForTargetDimension(targetDimension, attachment) {
|
|
515
|
+
if (attachment.thumbnails.length === 0) {
|
|
516
|
+
return void (0);
|
|
517
|
+
}
|
|
518
|
+
return attachment.thumbnails.reduce((best, candidate, index) => {
|
|
519
|
+
if (candidate.minDimension >= targetDimension &&
|
|
520
|
+
(best === undefined || candidate.minDimension < attachment.thumbnails[best].minDimension)) {
|
|
521
|
+
return index;
|
|
522
|
+
}
|
|
523
|
+
return best;
|
|
524
|
+
}, void (0));
|
|
525
|
+
}
|
|
526
|
+
exports.thumbnailIndexForTargetDimension = thumbnailIndexForTargetDimension;
|
|
527
|
+
class AttachmentAddError extends Error {
|
|
528
|
+
constructor(validationErr) {
|
|
529
|
+
super(`Invalid new attachment: ${validationErr.message}`);
|
|
530
|
+
this.validationErr = validationErr;
|
|
531
|
+
}
|
|
532
|
+
static invalidNewAttachment(invalidErr) {
|
|
533
|
+
return new AttachmentAddError(invalidErr);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
exports.AttachmentAddError = AttachmentAddError;
|
|
537
|
+
class AttachmentNotFoundError extends Error {
|
|
538
|
+
constructor(attachmentId) {
|
|
539
|
+
super(`Attachment ID ${attachmentId} does not exist.`);
|
|
540
|
+
this.attachmentId = attachmentId;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
exports.AttachmentNotFoundError = AttachmentNotFoundError;
|
|
544
|
+
class ObservationRepositoryError extends Error {
|
|
545
|
+
constructor(code, message) {
|
|
546
|
+
super(message);
|
|
547
|
+
this.code = code;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
exports.ObservationRepositoryError = ObservationRepositoryError;
|
|
551
|
+
var ObservationRepositoryErrorCode;
|
|
552
|
+
(function (ObservationRepositoryErrorCode) {
|
|
553
|
+
ObservationRepositoryErrorCode["InvalidObservationId"] = "ObservationRepositoryError.InvalidObservationId";
|
|
554
|
+
ObservationRepositoryErrorCode["InvalidObservation"] = "ObservationRepositoryError.InvalidObservation";
|
|
555
|
+
})(ObservationRepositoryErrorCode = exports.ObservationRepositoryErrorCode || (exports.ObservationRepositoryErrorCode = {}));
|
|
556
|
+
class StagedAttachmentContentRef {
|
|
557
|
+
constructor(id) {
|
|
558
|
+
this.id = id;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
exports.StagedAttachmentContentRef = StagedAttachmentContentRef;
|
|
562
|
+
class StagedAttachmentContent extends StagedAttachmentContentRef {
|
|
563
|
+
constructor(id, tempLocation) {
|
|
564
|
+
super(id);
|
|
565
|
+
this.tempLocation = tempLocation;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
exports.StagedAttachmentContent = StagedAttachmentContent;
|
|
569
|
+
class AttachmentStoreError extends Error {
|
|
570
|
+
constructor(errorCode, message) {
|
|
571
|
+
super(message);
|
|
572
|
+
this.errorCode = errorCode;
|
|
573
|
+
this.name = errorCode;
|
|
574
|
+
}
|
|
575
|
+
static invalidAttachmentId(attachmentId, observation) {
|
|
576
|
+
return new AttachmentStoreError(AttachmentStoreErrorCode.InvalidAttachmentId, `observation ${observation.id} has no attachment ${attachmentId}`);
|
|
577
|
+
}
|
|
578
|
+
static invalidThumbnailDimension(minDimension, attachmentId, observation) {
|
|
579
|
+
return new AttachmentStoreError(AttachmentStoreErrorCode.InvalidThumbnailDimension, `attachment ${attachmentId} on observation ${observation.id} has no thumbnail with dimension ${minDimension}`);
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
exports.AttachmentStoreError = AttachmentStoreError;
|
|
583
|
+
var AttachmentStoreErrorCode;
|
|
584
|
+
(function (AttachmentStoreErrorCode) {
|
|
585
|
+
/**
|
|
586
|
+
* The given attachment ID was not found in the given observation's
|
|
587
|
+
* attachment list.
|
|
588
|
+
*/
|
|
589
|
+
AttachmentStoreErrorCode["InvalidAttachmentId"] = "AttachmentStoreError.InvalidAttachmentId";
|
|
590
|
+
AttachmentStoreErrorCode["InvalidThumbnailDimension"] = "AttachmentStoreError.InvalidThumbnailDimension";
|
|
591
|
+
/**
|
|
592
|
+
* The content for the given attachment ID was not found in the attachment
|
|
593
|
+
* store.
|
|
594
|
+
*/
|
|
595
|
+
AttachmentStoreErrorCode["ContentNotFound"] = "AttachmentStoreError.ContentNotFound";
|
|
596
|
+
/**
|
|
597
|
+
* The underlying storage system, e.g. file system, raised an error during
|
|
598
|
+
* some I/O operation.
|
|
599
|
+
*/
|
|
600
|
+
AttachmentStoreErrorCode["StorageError"] = "AttachmentStoreError.StorageError";
|
|
601
|
+
})(AttachmentStoreErrorCode = exports.AttachmentStoreErrorCode || (exports.AttachmentStoreErrorCode = {}));
|
|
602
|
+
const ObservationConstructionToken = Symbol('ObservationConstructor');
|
|
603
|
+
function createObservation(attrs, mageEvent, pendingEvents) {
|
|
604
|
+
attrs = copyObservationAttrs(attrs);
|
|
605
|
+
const validation = validateObservation(attrs, mageEvent);
|
|
606
|
+
return new Observation(ObservationConstructionToken, attrs, mageEvent, validation, pendingEvents);
|
|
607
|
+
}
|
|
608
|
+
function validateObservationCoreAttrs(validation) {
|
|
609
|
+
const { observationAttrs, mageEvent } = validation;
|
|
610
|
+
if (observationAttrs.eventId !== mageEvent.id) {
|
|
611
|
+
validation.addCoreAttrsError('eventId', `The observation event ID ${observationAttrs.eventId} does not match the asserted event ID ${mageEvent.id}.`);
|
|
612
|
+
}
|
|
613
|
+
if (observationAttrs.type !== 'Feature') {
|
|
614
|
+
validation.addCoreAttrsError('type', `The observation GeoJSON type must be 'Feature'.`);
|
|
615
|
+
}
|
|
616
|
+
const invalidGeometry = fields.geometry.GeometryFieldValidation({ title: 'Geometry', id: 0, name: 'geometry', required: true, type: entities_events_forms_1.FormFieldType.Geometry }, observationAttrs.geometry, { succeeded: () => null, failedBecauseTheEntry: reason => reason });
|
|
617
|
+
if (invalidGeometry) {
|
|
618
|
+
validation.addCoreAttrsError('geometry', `The observation geometry ${invalidGeometry}`);
|
|
619
|
+
}
|
|
620
|
+
if (!(observationAttrs.properties.timestamp instanceof Date)) {
|
|
621
|
+
validation.addCoreAttrsError('timestamp', 'The observation requires a valid timestamp.');
|
|
622
|
+
}
|
|
623
|
+
return validation;
|
|
624
|
+
}
|
|
625
|
+
function validateObservationFormEntries(validation) {
|
|
626
|
+
const { observationAttrs, mageEvent } = validation;
|
|
627
|
+
if (!Array.isArray(observationAttrs.properties.forms)) {
|
|
628
|
+
return validation.addCoreAttrsError('forms', 'The observation requires an array of form entries.');
|
|
629
|
+
}
|
|
630
|
+
const activeFormEntryCounts = mageEvent.forms.reduce((activeFormCounts, form) => {
|
|
631
|
+
if (!form.archived) {
|
|
632
|
+
activeFormCounts.set(form.id, 0);
|
|
633
|
+
}
|
|
634
|
+
return activeFormCounts;
|
|
635
|
+
}, new Map());
|
|
636
|
+
const formEntryIds = new Set();
|
|
637
|
+
const formEntryCounts = observationAttrs.properties.forms.reduce((formEntryCounts, formEntry, formEntryPos) => {
|
|
638
|
+
const formEntryError = new FormEntryValidationError(formEntry.id, formEntryPos);
|
|
639
|
+
if (formEntryIds.has(formEntry.id)) {
|
|
640
|
+
formEntryError.addEntryLevelError(FormEntryValidationErrorReason.DuplicateId);
|
|
641
|
+
}
|
|
642
|
+
formEntryIds.add(formEntry.id);
|
|
643
|
+
const form = mageEvent.formFor(formEntry.formId);
|
|
644
|
+
if (form) {
|
|
645
|
+
if (activeFormEntryCounts.has(form.id)) {
|
|
646
|
+
formEntryError.formName = form.name;
|
|
647
|
+
formEntryCounts.set(form.id, (formEntryCounts.get(form.id) || 0) + 1);
|
|
648
|
+
validateFormFieldEntries(formEntry, form, formEntryError, validation);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
else {
|
|
652
|
+
formEntryError.addEntryLevelError(FormEntryValidationErrorReason.FormRef);
|
|
653
|
+
}
|
|
654
|
+
if (formEntryHasErrors(formEntryError)) {
|
|
655
|
+
validation.addFormEntryError(formEntryError);
|
|
656
|
+
}
|
|
657
|
+
return formEntryCounts;
|
|
658
|
+
}, activeFormEntryCounts);
|
|
659
|
+
let totalActiveFormEntryCount = 0;
|
|
660
|
+
for (const [formId, formEntryCount] of formEntryCounts) {
|
|
661
|
+
const form = mageEvent.formFor(formId);
|
|
662
|
+
if (typeof form.min === 'number' && formEntryCount < form.min) {
|
|
663
|
+
validation.addFormCountError(FormCountError.tooFewEntriesForForm(form));
|
|
664
|
+
}
|
|
665
|
+
else if (typeof form.max === 'number' && formEntryCount > form.max) {
|
|
666
|
+
validation.addFormCountError(FormCountError.tooManyEntriesForForm(form));
|
|
667
|
+
}
|
|
668
|
+
totalActiveFormEntryCount += formEntryCount;
|
|
669
|
+
}
|
|
670
|
+
if (typeof mageEvent.minObservationForms === 'number' && totalActiveFormEntryCount < mageEvent.minObservationForms) {
|
|
671
|
+
validation.setTotalFormCountError(TotalFormCountError.tooFewFormEntries(mageEvent));
|
|
672
|
+
}
|
|
673
|
+
else if (typeof mageEvent.maxObservationForms === 'number' && totalActiveFormEntryCount > mageEvent.maxObservationForms) {
|
|
674
|
+
validation.setTotalFormCountError(TotalFormCountError.tooManyFormEntries(mageEvent));
|
|
675
|
+
}
|
|
676
|
+
// TODO: invalidate new form entries that reference archived forms
|
|
677
|
+
return validation;
|
|
678
|
+
}
|
|
679
|
+
function formEntryHasErrors(err) {
|
|
680
|
+
return err.entryLevelErrors.size > 0 || err.fieldErrors.size > 0;
|
|
681
|
+
}
|
|
682
|
+
function validateObservationAttachments(validation) {
|
|
683
|
+
const { observationAttrs, mageEvent } = validation;
|
|
684
|
+
const attachments = observationAttrs.attachments;
|
|
685
|
+
attachments.forEach((x, index) => {
|
|
686
|
+
const invalid = validateAttachment(x, observationAttrs, mageEvent);
|
|
687
|
+
if (invalid) {
|
|
688
|
+
validation.setAttachmentError(index, invalid);
|
|
689
|
+
}
|
|
690
|
+
});
|
|
691
|
+
return validation;
|
|
692
|
+
}
|
|
693
|
+
function validateAttachment(attachment, observation, mageEvent) {
|
|
694
|
+
const formEntry = formEntryForId(attachment.observationFormId, observation);
|
|
695
|
+
if (!formEntry) {
|
|
696
|
+
return new AttachmentValidationError(AttachmentValidationErrorReason.FormEntryRef, `The attachment form entry reference ${attachment.observationFormId} is invalid.`);
|
|
697
|
+
}
|
|
698
|
+
const field = mageEvent.formFieldFor(attachment.fieldName, formEntry.formId);
|
|
699
|
+
if (!field || field.type !== entities_events_forms_1.FormFieldType.Attachment) {
|
|
700
|
+
return new AttachmentValidationError(AttachmentValidationErrorReason.FieldRef, `The attachment field reference ${attachment.fieldName} is invalid.`);
|
|
701
|
+
}
|
|
702
|
+
const dup = observation.attachments.find(x => x.id === attachment.id && x !== attachment);
|
|
703
|
+
if (dup) {
|
|
704
|
+
return new AttachmentValidationError(AttachmentValidationErrorReason.DuplicateId, `The attachment ID ${attachment.id} is not unique on the observation.`);
|
|
705
|
+
}
|
|
706
|
+
return null;
|
|
707
|
+
}
|
|
708
|
+
function FormFieldValidationResult(context) {
|
|
709
|
+
return {
|
|
710
|
+
failedBecauseTheEntry(reason, constraint = FieldConstraintKey.Value) {
|
|
711
|
+
return new FormFieldValidationError({ fieldName: context.field.name, message: `${context.field.title} ${reason}`, constraint: constraint });
|
|
712
|
+
},
|
|
713
|
+
succeeded(parsed) { return parsed; }
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
function validateRequiredThen(rule) {
|
|
717
|
+
return context => {
|
|
718
|
+
const requiredError = fields.required.RequiredFieldValidation(context.field, context.fieldEntry, FormFieldValidationResult(context));
|
|
719
|
+
if (requiredError) {
|
|
720
|
+
return requiredError;
|
|
721
|
+
}
|
|
722
|
+
return rule(context);
|
|
723
|
+
};
|
|
724
|
+
}
|
|
725
|
+
// TODO: these could be improved to be more cleanly comosable in a functional way, e.g., monadic. i'll figure that out eventually
|
|
726
|
+
const FieldTypeValidationRules = {
|
|
727
|
+
// attachments use min/max constraints, not required constraint
|
|
728
|
+
[entities_events_forms_1.FormFieldType.Attachment]: context => fields.attachment.AttachmentFieldValidation(context.field, context.formEntry.id, context.observationAttrs, FormFieldValidationResult(context)),
|
|
729
|
+
[entities_events_forms_1.FormFieldType.CheckBox]: validateRequiredThen(context => fields.checkbox.CheckboxFieldValidation(context.field, context.fieldEntry, FormFieldValidationResult(context))),
|
|
730
|
+
[entities_events_forms_1.FormFieldType.DateTime]: validateRequiredThen(context => fields.date.DateFieldValidation(context.field, context.fieldEntry, FormFieldValidationResult(context))),
|
|
731
|
+
[entities_events_forms_1.FormFieldType.Dropdown]: validateRequiredThen(context => fields.select.SelectFormFieldValidation(context.field, context.fieldEntry, FormFieldValidationResult(context))),
|
|
732
|
+
[entities_events_forms_1.FormFieldType.Email]: validateRequiredThen(context => fields.email.EmailFieldValidation(context.field, context.fieldEntry, FormFieldValidationResult(context))),
|
|
733
|
+
[entities_events_forms_1.FormFieldType.Geometry]: validateRequiredThen(context => fields.geometry.GeometryFieldValidation(context.field, context.fieldEntry, FormFieldValidationResult(context))),
|
|
734
|
+
// TODO: no validation at all? legacy validation code did nothing for hidden fields
|
|
735
|
+
[entities_events_forms_1.FormFieldType.Hidden]: context => null,
|
|
736
|
+
[entities_events_forms_1.FormFieldType.MultiSelectDropdown]: validateRequiredThen(context => fields.multiselect.MultiSelectFormFieldValidation(context.field, context.fieldEntry, FormFieldValidationResult(context))),
|
|
737
|
+
[entities_events_forms_1.FormFieldType.Numeric]: validateRequiredThen(context => fields.numeric.NumericFieldValidation(context.field, context.fieldEntry, FormFieldValidationResult(context))),
|
|
738
|
+
[entities_events_forms_1.FormFieldType.Password]: validateRequiredThen(context => fields.text.TextFieldValidation(context.field, context.fieldEntry, FormFieldValidationResult(context))),
|
|
739
|
+
[entities_events_forms_1.FormFieldType.Radio]: validateRequiredThen(context => fields.select.SelectFormFieldValidation(context.field, context.fieldEntry, FormFieldValidationResult(context))),
|
|
740
|
+
[entities_events_forms_1.FormFieldType.Text]: validateRequiredThen(context => fields.text.TextFieldValidation(context.field, context.fieldEntry, FormFieldValidationResult(context))),
|
|
741
|
+
[entities_events_forms_1.FormFieldType.TextArea]: validateRequiredThen(context => fields.text.TextFieldValidation(context.field, context.fieldEntry, FormFieldValidationResult(context))),
|
|
742
|
+
};
|
|
743
|
+
/**
|
|
744
|
+
* TODO: This retains legacy functionality of only keying of form fields in the
|
|
745
|
+
* event form to validate the values in the form entry. However, this leaves
|
|
746
|
+
* keys in the form entry that do not have a corresponding form field. A
|
|
747
|
+
* client could thus submit an observation with thousands of keys in a fomr
|
|
748
|
+
* entry.
|
|
749
|
+
*/
|
|
750
|
+
function validateFormFieldEntries(formEntry, form, formEntryError, validation) {
|
|
751
|
+
const { mageEvent, observationAttrs } = validation;
|
|
752
|
+
const formFields = form.fields || [];
|
|
753
|
+
const activeFields = formFields.filter(x => !x.archived);
|
|
754
|
+
activeFields.forEach(field => {
|
|
755
|
+
const fieldEntry = formEntry[field.name];
|
|
756
|
+
const fieldValidation = { field, fieldEntry, formEntry, mageEvent, observationAttrs };
|
|
757
|
+
const resultEntry = FieldTypeValidationRules[field.type](fieldValidation);
|
|
758
|
+
if (resultEntry instanceof FormFieldValidationError) {
|
|
759
|
+
formEntryError.addFieldError(resultEntry);
|
|
760
|
+
}
|
|
761
|
+
else if (resultEntry !== void (0)) {
|
|
762
|
+
formEntry[field.name] = resultEntry;
|
|
763
|
+
}
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
class ObservationValidationContext {
|
|
767
|
+
constructor(...args) {
|
|
768
|
+
_ObservationValidationContext_coreAttrsErrors.set(this, void 0);
|
|
769
|
+
_ObservationValidationContext_formCountErrors.set(this, void 0);
|
|
770
|
+
_ObservationValidationContext_formEntryErrors.set(this, void 0);
|
|
771
|
+
_ObservationValidationContext_attachmentErrors.set(this, void 0);
|
|
772
|
+
_ObservationValidationContext_totalFormCountError.set(this, null);
|
|
773
|
+
const [fromOrAttrs, maybeMageEvent] = args;
|
|
774
|
+
if (fromOrAttrs instanceof ObservationValidationContext) {
|
|
775
|
+
this.observationAttrs = fromOrAttrs.observationAttrs;
|
|
776
|
+
this.mageEvent = fromOrAttrs.mageEvent;
|
|
777
|
+
__classPrivateFieldSet(this, _ObservationValidationContext_coreAttrsErrors, new Map(fromOrAttrs.coreAttrsErrors), "f");
|
|
778
|
+
__classPrivateFieldSet(this, _ObservationValidationContext_formEntryErrors, new Map(fromOrAttrs.formEntryErrors), "f");
|
|
779
|
+
__classPrivateFieldSet(this, _ObservationValidationContext_formCountErrors, new Map(fromOrAttrs.formCountErrors), "f");
|
|
780
|
+
__classPrivateFieldSet(this, _ObservationValidationContext_attachmentErrors, new Map(fromOrAttrs.attachmentErrors), "f");
|
|
781
|
+
}
|
|
782
|
+
else {
|
|
783
|
+
this.observationAttrs = fromOrAttrs;
|
|
784
|
+
this.mageEvent = maybeMageEvent;
|
|
785
|
+
__classPrivateFieldSet(this, _ObservationValidationContext_coreAttrsErrors, new Map(), "f");
|
|
786
|
+
__classPrivateFieldSet(this, _ObservationValidationContext_formEntryErrors, new Map(), "f");
|
|
787
|
+
__classPrivateFieldSet(this, _ObservationValidationContext_formCountErrors, new Map(), "f");
|
|
788
|
+
__classPrivateFieldSet(this, _ObservationValidationContext_attachmentErrors, new Map(), "f");
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
addCoreAttrsError(key, message) {
|
|
792
|
+
__classPrivateFieldGet(this, _ObservationValidationContext_coreAttrsErrors, "f").set(key, message);
|
|
793
|
+
return this;
|
|
794
|
+
}
|
|
795
|
+
setTotalFormCountError(x) {
|
|
796
|
+
__classPrivateFieldSet(this, _ObservationValidationContext_totalFormCountError, x, "f");
|
|
797
|
+
return this;
|
|
798
|
+
}
|
|
799
|
+
addFormCountError(x) {
|
|
800
|
+
__classPrivateFieldGet(this, _ObservationValidationContext_formCountErrors, "f").set(x.formId, x);
|
|
801
|
+
return this;
|
|
802
|
+
}
|
|
803
|
+
addFormEntryError(formEntryError) {
|
|
804
|
+
__classPrivateFieldGet(this, _ObservationValidationContext_formEntryErrors, "f").set(formEntryError.formEntryPosition, formEntryError);
|
|
805
|
+
return this;
|
|
806
|
+
}
|
|
807
|
+
setAttachmentError(index, err) {
|
|
808
|
+
__classPrivateFieldGet(this, _ObservationValidationContext_attachmentErrors, "f").set(index, err);
|
|
809
|
+
return this;
|
|
810
|
+
}
|
|
811
|
+
get coreAttrsErrors() {
|
|
812
|
+
return new Map(__classPrivateFieldGet(this, _ObservationValidationContext_coreAttrsErrors, "f"));
|
|
813
|
+
}
|
|
814
|
+
get formCountErrors() {
|
|
815
|
+
return new Map(__classPrivateFieldGet(this, _ObservationValidationContext_formCountErrors, "f"));
|
|
816
|
+
}
|
|
817
|
+
get formEntryErrors() {
|
|
818
|
+
return new Map(__classPrivateFieldGet(this, _ObservationValidationContext_formEntryErrors, "f"));
|
|
819
|
+
}
|
|
820
|
+
get attachmentErrors() {
|
|
821
|
+
return new Map(__classPrivateFieldGet(this, _ObservationValidationContext_attachmentErrors, "f"));
|
|
822
|
+
}
|
|
823
|
+
get totalFormCountError() {
|
|
824
|
+
return __classPrivateFieldGet(this, _ObservationValidationContext_totalFormCountError, "f");
|
|
825
|
+
}
|
|
826
|
+
get hasErrors() {
|
|
827
|
+
return __classPrivateFieldGet(this, _ObservationValidationContext_coreAttrsErrors, "f").size > 0
|
|
828
|
+
|| __classPrivateFieldGet(this, _ObservationValidationContext_totalFormCountError, "f") !== null
|
|
829
|
+
|| __classPrivateFieldGet(this, _ObservationValidationContext_formCountErrors, "f").size > 0
|
|
830
|
+
|| __classPrivateFieldGet(this, _ObservationValidationContext_formEntryErrors, "f").size > 0
|
|
831
|
+
|| __classPrivateFieldGet(this, _ObservationValidationContext_attachmentErrors, "f").size > 0;
|
|
832
|
+
}
|
|
833
|
+
result() {
|
|
834
|
+
const hasErrors = this.hasErrors;
|
|
835
|
+
const coreAttrsErrors = Object.freeze(Object.fromEntries(this.coreAttrsErrors));
|
|
836
|
+
const totalFormCountError = this.totalFormCountError;
|
|
837
|
+
const formCountErrors = Object.freeze(Array.from(this.formCountErrors.entries()));
|
|
838
|
+
const formEntryErrors = Object.freeze(Array.from(this.formEntryErrors.entries()));
|
|
839
|
+
const attachmentErrors = Object.freeze(Array.from(this.attachmentErrors.entries()));
|
|
840
|
+
return Object.freeze({
|
|
841
|
+
hasErrors,
|
|
842
|
+
coreAttrsErrors,
|
|
843
|
+
totalFormCountError,
|
|
844
|
+
formCountErrors,
|
|
845
|
+
formEntryErrors,
|
|
846
|
+
attachmentErrors,
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
_ObservationValidationContext_coreAttrsErrors = new WeakMap(), _ObservationValidationContext_formCountErrors = new WeakMap(), _ObservationValidationContext_formEntryErrors = new WeakMap(), _ObservationValidationContext_attachmentErrors = new WeakMap(), _ObservationValidationContext_totalFormCountError = new WeakMap();
|
|
851
|
+
function AttachmentsRemovedDomainEvent(observation, removedAttachments) {
|
|
852
|
+
return Object.freeze({
|
|
853
|
+
type: ObservationDomainEventType.AttachmentsRemoved,
|
|
854
|
+
removedAttachments: Object.freeze(removedAttachments)
|
|
855
|
+
});
|
|
856
|
+
}
|
|
857
|
+
function mergePendingDomainEvents(from, nextEvents) {
|
|
858
|
+
const removedAttachments = [];
|
|
859
|
+
const merged = [...from.pendingEvents, ...nextEvents].reduce((merged, e) => {
|
|
860
|
+
if (e.type === ObservationDomainEventType.AttachmentsRemoved) {
|
|
861
|
+
removedAttachments.push(...e.removedAttachments);
|
|
862
|
+
return merged;
|
|
863
|
+
}
|
|
864
|
+
else {
|
|
865
|
+
return [...merged, e];
|
|
866
|
+
}
|
|
867
|
+
}, []);
|
|
868
|
+
if (removedAttachments.length) {
|
|
869
|
+
merged.push(AttachmentsRemovedDomainEvent(from, removedAttachments));
|
|
870
|
+
}
|
|
871
|
+
return merged;
|
|
872
|
+
}
|
|
873
|
+
//# sourceMappingURL=entities.observations.js.map
|