@ngageoint/mage.service 6.3.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +76 -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 +151 -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 +26 -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 +69 -0
- package/lib/adapters/feeds/adapters.feeds.db.mongoose.d.ts.map +1 -0
- package/lib/adapters/feeds/adapters.feeds.db.mongoose.js +206 -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 +39 -0
- package/lib/adapters/icons/adapters.icons.db.mongoose.d.ts.map +1 -0
- package/lib/adapters/icons/adapters.icons.db.mongoose.js +295 -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 +295 -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 +39 -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 +133 -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 +73 -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 +81 -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 +61 -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 +506 -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 +201 -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 +108 -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 +107 -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 +580 -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 +26 -0
- package/lib/environment/env.d.ts.map +1 -0
- package/lib/environment/env.js +136 -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 +79 -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 +73 -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 +64 -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 +43 -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 +64 -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 +55 -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 +39 -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 +102 -0
- package/lib/models/authentication.d.ts.map +1 -0
- package/lib/models/authentication.js +148 -0
- package/lib/models/authentication.js.map +1 -0
- package/lib/models/authenticationconfiguration.d.ts +196 -0
- package/lib/models/authenticationconfiguration.d.ts.map +1 -0
- package/lib/models/authenticationconfiguration.js +102 -0
- package/lib/models/authenticationconfiguration.js.map +1 -0
- package/lib/models/cappedLocation.d.ts +59 -0
- package/lib/models/cappedLocation.d.ts.map +1 -0
- package/lib/models/cappedLocation.js +76 -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 +131 -0
- package/lib/models/device.d.ts.map +1 -0
- package/lib/models/device.js +205 -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 +831 -0
- package/lib/models/event.js.map +1 -0
- package/lib/models/export.d.ts +263 -0
- package/lib/models/export.d.ts.map +1 -0
- package/lib/models/export.js +105 -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 +41 -0
- package/lib/models/feature.js.map +1 -0
- package/lib/models/icon.d.ts +44 -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 +82 -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 +95 -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 +88 -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 +457 -0
- package/lib/models/observation.js.map +1 -0
- package/lib/models/role.d.ts +21 -0
- package/lib/models/role.d.ts.map +1 -0
- package/lib/models/role.js +78 -0
- package/lib/models/role.js.map +1 -0
- package/lib/models/setting.d.ts +53 -0
- package/lib/models/setting.d.ts.map +1 -0
- package/lib/models/setting.js +29 -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 +518 -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 +405 -0
- package/lib/models/user.js.map +1 -0
- package/lib/permissions/permissions.events.d.ts +65 -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 +262 -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 +206 -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 +368 -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 +19 -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 +201 -0
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13
|
+
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");
|
|
14
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
var _FileSystemAttachmentStore_instances, _FileSystemAttachmentStore_saveContent, _FileSystemAttachmentStore_baseDirIsAncestorOf;
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.FileSystemAttachmentStoreInitError = exports.intializeAttachmentStore = exports.FileSystemAttachmentStore = void 0;
|
|
22
|
+
const fs_1 = __importDefault(require("fs"));
|
|
23
|
+
const path_1 = __importDefault(require("path"));
|
|
24
|
+
const stream_1 = __importDefault(require("stream"));
|
|
25
|
+
const util_1 = __importDefault(require("util"));
|
|
26
|
+
const uniqid_1 = __importDefault(require("uniqid"));
|
|
27
|
+
const entities_observations_1 = require("../../entities/observations/entities.observations");
|
|
28
|
+
const mime_types_1 = __importDefault(require("mime-types"));
|
|
29
|
+
class FileSystemAttachmentStore {
|
|
30
|
+
constructor(token, baseDirPath, pendingDirPath) {
|
|
31
|
+
this.baseDirPath = baseDirPath;
|
|
32
|
+
this.pendingDirPath = pendingDirPath;
|
|
33
|
+
_FileSystemAttachmentStore_instances.add(this);
|
|
34
|
+
if (token !== FileSystemAttachmentStoreConstructorToken) {
|
|
35
|
+
throw new FileSystemAttachmentStoreInitError('use the factory function');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
stagePendingContent() {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
const id = (0, uniqid_1.default)();
|
|
41
|
+
const tempPath = path_1.default.join(this.pendingDirPath, id);
|
|
42
|
+
const tempLocation = fs_1.default.createWriteStream(tempPath);
|
|
43
|
+
return new entities_observations_1.StagedAttachmentContent(id, tempLocation);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
saveContent(content, attachmentId, observation) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
const attachment = observation.attachmentFor(attachmentId);
|
|
49
|
+
if (!attachment) {
|
|
50
|
+
return entities_observations_1.AttachmentStoreError.invalidAttachmentId(attachmentId, observation);
|
|
51
|
+
}
|
|
52
|
+
const saveRelPath = relativeWritePathForAttachment(attachment, observation);
|
|
53
|
+
const savePath = path_1.default.join(this.baseDirPath, saveRelPath);
|
|
54
|
+
const savedSize = yield __classPrivateFieldGet(this, _FileSystemAttachmentStore_instances, "m", _FileSystemAttachmentStore_saveContent).call(this, content, savePath);
|
|
55
|
+
if (typeof savedSize !== 'number') {
|
|
56
|
+
return savedSize;
|
|
57
|
+
}
|
|
58
|
+
if (!attachment.contentLocator || attachment.size !== savedSize) {
|
|
59
|
+
return { contentLocator: saveRelPath, size: savedSize };
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
saveThumbnailContent(content, minDimension, attachmentId, observation) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
const attachment = observation.attachmentFor(attachmentId);
|
|
67
|
+
if (!attachment) {
|
|
68
|
+
return entities_observations_1.AttachmentStoreError.invalidAttachmentId(attachmentId, observation);
|
|
69
|
+
}
|
|
70
|
+
const thumbnailPos = attachment.thumbnails.findIndex(x => x.minDimension === minDimension);
|
|
71
|
+
const thumbnail = attachment.thumbnails[thumbnailPos];
|
|
72
|
+
if (!thumbnail) {
|
|
73
|
+
return entities_observations_1.AttachmentStoreError.invalidThumbnailDimension(minDimension, attachmentId, observation);
|
|
74
|
+
}
|
|
75
|
+
const saveRelPath = relativeWritePathForThumbnail(thumbnail, attachment, observation);
|
|
76
|
+
const savePath = path_1.default.join(this.baseDirPath, saveRelPath);
|
|
77
|
+
const savedSize = yield __classPrivateFieldGet(this, _FileSystemAttachmentStore_instances, "m", _FileSystemAttachmentStore_saveContent).call(this, content, savePath);
|
|
78
|
+
if (typeof savedSize !== 'number') {
|
|
79
|
+
return savedSize;
|
|
80
|
+
}
|
|
81
|
+
if (!thumbnail.contentLocator || thumbnail.size !== savedSize) {
|
|
82
|
+
const savedThumbnail = (0, entities_observations_1.copyThumbnailAttrs)(thumbnail);
|
|
83
|
+
savedThumbnail.contentLocator = saveRelPath;
|
|
84
|
+
savedThumbnail.size = savedSize;
|
|
85
|
+
return savedThumbnail;
|
|
86
|
+
}
|
|
87
|
+
return null;
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
readContent(attachmentId, observation, range = { start: 0 }) {
|
|
91
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
92
|
+
const attachment = observation.attachmentFor(attachmentId);
|
|
93
|
+
if (!attachment) {
|
|
94
|
+
return Promise.resolve(entities_observations_1.AttachmentStoreError.invalidAttachmentId(attachmentId, observation));
|
|
95
|
+
}
|
|
96
|
+
const contentRelPath = relativeReadPathForAttachment(attachment, observation);
|
|
97
|
+
const contentPath = path_1.default.join(this.baseDirPath, contentRelPath);
|
|
98
|
+
try {
|
|
99
|
+
const fd = yield util_1.default.promisify(fs_1.default.open)(contentPath, 'r');
|
|
100
|
+
return fs_1.default.createReadStream(contentPath, Object.assign(Object.assign({}, range), { fd }));
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
console.error(`error reading attachment content`, contentPath, err);
|
|
104
|
+
return new entities_observations_1.AttachmentStoreError(entities_observations_1.AttachmentStoreErrorCode.StorageError, `error reading attachment ${attachmentId} on observation ${observation.id}`);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
readThumbnailContent(minDimension, attachmentId, observation) {
|
|
109
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
110
|
+
const attachment = observation.attachmentFor(attachmentId);
|
|
111
|
+
if (!attachment) {
|
|
112
|
+
return entities_observations_1.AttachmentStoreError.invalidAttachmentId(attachmentId, observation);
|
|
113
|
+
}
|
|
114
|
+
const thumbnail = attachment.thumbnails.find(x => x.minDimension === minDimension);
|
|
115
|
+
if (!thumbnail) {
|
|
116
|
+
return entities_observations_1.AttachmentStoreError.invalidThumbnailDimension(minDimension, attachmentId, observation);
|
|
117
|
+
}
|
|
118
|
+
const contentRelPath = relativeReadPathForThumbnail(thumbnail, attachment, observation);
|
|
119
|
+
const contentPath = path_1.default.join(this.baseDirPath, contentRelPath);
|
|
120
|
+
try {
|
|
121
|
+
const fd = yield util_1.default.promisify(fs_1.default.open)(contentPath, 'r');
|
|
122
|
+
return fs_1.default.createReadStream(contentPath, { fd });
|
|
123
|
+
}
|
|
124
|
+
catch (err) {
|
|
125
|
+
console.error(`error reading attachment thumbnail content`, contentPath, err);
|
|
126
|
+
return new entities_observations_1.AttachmentStoreError(entities_observations_1.AttachmentStoreErrorCode.StorageError, `error reading thumbnail ${minDimension} of attachment ${attachmentId} on observation ${observation.id}`);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
deleteContent(attachment, observation) {
|
|
131
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
132
|
+
const attachmentOnObservation = observation.attachmentFor(attachment.id);
|
|
133
|
+
const thumbnails = attachment.thumbnails;
|
|
134
|
+
const contentRelPath = relativeReadPathForAttachment(attachment, observation);
|
|
135
|
+
const contentPath = path_1.default.join(this.baseDirPath, contentRelPath);
|
|
136
|
+
const rm = (path) => __awaiter(this, void 0, void 0, function* () {
|
|
137
|
+
if (!__classPrivateFieldGet(this, _FileSystemAttachmentStore_instances, "m", _FileSystemAttachmentStore_baseDirIsAncestorOf).call(this, path)) {
|
|
138
|
+
throw new Error(`cannot remove path ${path} because it is not a descendant of store base dir ${this.baseDirPath}`);
|
|
139
|
+
}
|
|
140
|
+
return yield util_1.default.promisify(fs_1.default.rm)(path);
|
|
141
|
+
});
|
|
142
|
+
const err = yield rm(contentPath).then(() => null, err => err);
|
|
143
|
+
if (err) {
|
|
144
|
+
// TODO: maybe instead move on and try to delete thumbnails too
|
|
145
|
+
const message = `error deleting content for attachment ${attachment} on observation ${observation.id}`;
|
|
146
|
+
console.error(message, err);
|
|
147
|
+
return new entities_observations_1.AttachmentStoreError(entities_observations_1.AttachmentStoreErrorCode.StorageError, `${message}: ${String(err)}`);
|
|
148
|
+
}
|
|
149
|
+
const thumbRemoves = yield Promise.all(thumbnails.map(thumb => {
|
|
150
|
+
const thumbRelPath = relativeReadPathForThumbnail(thumb, attachment, observation);
|
|
151
|
+
const thumbPath = path_1.default.join(this.baseDirPath, thumbRelPath);
|
|
152
|
+
return rm(thumbPath).then(() => ({ thumb, success: true }), err => {
|
|
153
|
+
console.error(`error deleting thumbnail ${thumb.minDimension} for attachment ${attachment} on observation ${observation.id} @ ${thumbPath}`, err);
|
|
154
|
+
return { thumb, success: false };
|
|
155
|
+
});
|
|
156
|
+
}));
|
|
157
|
+
const thumbUpdate = thumbRemoves.reduce((thumbUpdate, thumbRemove) => {
|
|
158
|
+
const { success, thumb } = thumbRemove;
|
|
159
|
+
if (success && thumb.contentLocator) {
|
|
160
|
+
const updatedThumb = Object.assign(Object.assign({}, (0, entities_observations_1.copyThumbnailAttrs)(thumb)), { contentLocator: undefined });
|
|
161
|
+
thumbUpdate = { isNecessary: true, thumbnails: thumbUpdate.thumbnails.concat(updatedThumb) };
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
thumbUpdate = { isNecessary: thumbUpdate.isNecessary, thumbnails: thumbUpdate.thumbnails.concat(thumb) };
|
|
165
|
+
}
|
|
166
|
+
return thumbUpdate;
|
|
167
|
+
}, { isNecessary: false, thumbnails: [] });
|
|
168
|
+
if (attachmentOnObservation && (attachment.contentLocator || thumbUpdate.isNecessary)) {
|
|
169
|
+
return { contentLocator: undefined, thumbnails: thumbUpdate.thumbnails };
|
|
170
|
+
}
|
|
171
|
+
return null;
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
exports.FileSystemAttachmentStore = FileSystemAttachmentStore;
|
|
176
|
+
_FileSystemAttachmentStore_instances = new WeakSet(), _FileSystemAttachmentStore_saveContent = function _FileSystemAttachmentStore_saveContent(content, dest) {
|
|
177
|
+
const destResolved = path_1.default.resolve(dest);
|
|
178
|
+
if (!__classPrivateFieldGet(this, _FileSystemAttachmentStore_instances, "m", _FileSystemAttachmentStore_baseDirIsAncestorOf).call(this, destResolved)) {
|
|
179
|
+
return Promise.resolve(new entities_observations_1.AttachmentStoreError(entities_observations_1.AttachmentStoreErrorCode.StorageError, `content destination ${dest} is not a descendent of base dir ${this.baseDirPath}`));
|
|
180
|
+
}
|
|
181
|
+
const destBaseDirPath = path_1.default.dirname(destResolved);
|
|
182
|
+
const mkdir = () => util_1.default.promisify(fs_1.default.mkdir)(destBaseDirPath, { recursive: true }).then(_ => void (0));
|
|
183
|
+
const statSize = ((path) => util_1.default.promisify(fs_1.default.stat)(path).then(x => x.size));
|
|
184
|
+
if (content instanceof entities_observations_1.StagedAttachmentContentRef) {
|
|
185
|
+
const move = util_1.default.promisify(fs_1.default.rename);
|
|
186
|
+
const tempPath = path_1.default.join(this.pendingDirPath, content.id);
|
|
187
|
+
return mkdir()
|
|
188
|
+
.then(_ => move(tempPath, dest))
|
|
189
|
+
.then(_ => statSize(dest), err => {
|
|
190
|
+
const message = `error moving staged content ${tempPath} to ${dest}`;
|
|
191
|
+
console.error(message, err);
|
|
192
|
+
return new entities_observations_1.AttachmentStoreError(entities_observations_1.AttachmentStoreErrorCode.StorageError, message);
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
const pipe = util_1.default.promisify(stream_1.default.pipeline);
|
|
196
|
+
return mkdir()
|
|
197
|
+
.then(_ => fs_1.default.createWriteStream(dest))
|
|
198
|
+
.then(dest => pipe(content, dest))
|
|
199
|
+
.then(_ => statSize(dest), err => {
|
|
200
|
+
const message = `error saving source stream to path ${dest}`;
|
|
201
|
+
console.error(message, err);
|
|
202
|
+
return new entities_observations_1.AttachmentStoreError(entities_observations_1.AttachmentStoreErrorCode.StorageError, message);
|
|
203
|
+
});
|
|
204
|
+
}, _FileSystemAttachmentStore_baseDirIsAncestorOf = function _FileSystemAttachmentStore_baseDirIsAncestorOf(testPath) {
|
|
205
|
+
return path_1.default.relative(testPath, this.baseDirPath).split(path_1.default.sep).every(x => x === '..');
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* Create the directories for an attachment store at the given path if they
|
|
209
|
+
* do not exist. Return a file system attachment store that stores content
|
|
210
|
+
* under the given base directory. Return an error if there was an error
|
|
211
|
+
* creating the required directories.
|
|
212
|
+
* @param baseDirPath
|
|
213
|
+
* @returns {@link FileSystemAttachmentStore} or {@link FileSystemAttachmentStoreInitError}
|
|
214
|
+
*/
|
|
215
|
+
function intializeAttachmentStore(baseDirPath) {
|
|
216
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
217
|
+
const mkdir = util_1.default.promisify(fs_1.default.mkdir);
|
|
218
|
+
baseDirPath = path_1.default.resolve(baseDirPath);
|
|
219
|
+
const pendingDirPath = path_1.default.resolve(baseDirPath, 'pending');
|
|
220
|
+
yield mkdir(pendingDirPath, { recursive: true }).catch(err => {
|
|
221
|
+
console.error(`error creating attachment store base direcgtory ${baseDirPath}:`, err);
|
|
222
|
+
return new FileSystemAttachmentStoreInitError(`error creating attachment store base direcgtory ${baseDirPath}: ${String(err)}`);
|
|
223
|
+
});
|
|
224
|
+
return new FileSystemAttachmentStore(FileSystemAttachmentStoreConstructorToken, baseDirPath, pendingDirPath);
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
exports.intializeAttachmentStore = intializeAttachmentStore;
|
|
228
|
+
class FileSystemAttachmentStoreInitError extends Error {
|
|
229
|
+
}
|
|
230
|
+
exports.FileSystemAttachmentStoreInitError = FileSystemAttachmentStoreInitError;
|
|
231
|
+
/**
|
|
232
|
+
* Return a path relative to the store's base directory suitable to write the
|
|
233
|
+
* file for the given attachment's main content bytes. If the attachment has
|
|
234
|
+
* a {@link Attachment.contentLocator contentLocator}, simply return that as
|
|
235
|
+
* the relative path. Otherwise, construct a relative path based on the
|
|
236
|
+
* property values of the attachment and its parent observation.
|
|
237
|
+
* @returns `string`
|
|
238
|
+
*/
|
|
239
|
+
function relativeWritePathForAttachment(attachment, observation) {
|
|
240
|
+
if (attachment.contentLocator) {
|
|
241
|
+
return attachment.contentLocator;
|
|
242
|
+
}
|
|
243
|
+
const created = observation.createdAt;
|
|
244
|
+
const ext = mime_types_1.default.extension(attachment.contentType || '');
|
|
245
|
+
const baseDirPath = path_1.default.join(`event-${observation.eventId}`, String(created.getUTCFullYear()), String(created.getUTCMonth() + 1).padStart(2, '0'), String(created.getUTCDate()).padStart(2, '0'), observation.id, attachment.id + (ext ? `.${ext}` : ''));
|
|
246
|
+
return baseDirPath;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* If the attachment has a non-empty {@link Attachment.contentLocator | `contentLocator`},
|
|
250
|
+
* return that. Otherwise, return the presumed path based on the observation
|
|
251
|
+
* and attachment attributes.
|
|
252
|
+
*/
|
|
253
|
+
function relativeReadPathForAttachment(attachment, observation) {
|
|
254
|
+
if (attachment.contentLocator) {
|
|
255
|
+
return attachment.contentLocator;
|
|
256
|
+
}
|
|
257
|
+
return relativeWritePathForAttachment(attachment, observation);
|
|
258
|
+
}
|
|
259
|
+
function relativeWritePathForThumbnail(thumbnail, attachment, observation) {
|
|
260
|
+
if (thumbnail.contentLocator) {
|
|
261
|
+
return thumbnail.contentLocator;
|
|
262
|
+
}
|
|
263
|
+
const basePath = relativeWritePathForAttachment(attachment, observation);
|
|
264
|
+
const pathParts = path_1.default.parse(basePath);
|
|
265
|
+
return path_1.default.join(pathParts.dir, `${pathParts.name}-${thumbnail.minDimension}${pathParts.ext}`);
|
|
266
|
+
}
|
|
267
|
+
function relativeReadPathForThumbnail(thumbnail, attachment, observation) {
|
|
268
|
+
if (thumbnail.contentLocator) {
|
|
269
|
+
return thumbnail.contentLocator;
|
|
270
|
+
}
|
|
271
|
+
return relativeWritePathForThumbnail(thumbnail, attachment, observation);
|
|
272
|
+
}
|
|
273
|
+
const FileSystemAttachmentStoreConstructorToken = Symbol('FileSystemAttachmentStoreConstructorToken');
|
|
274
|
+
//# sourceMappingURL=adapters.observations.attachment_store.file_system.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapters.observations.attachment_store.file_system.js","sourceRoot":"","sources":["../../../src/adapters/observations/adapters.observations.attachment_store.file_system.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,4CAAmB;AACnB,gDAAuB;AACvB,oDAA2B;AAC3B,gDAAuB;AACvB,oDAA2B;AAC3B,6FAAgV;AAChV,4DAA6B;AAE7B,MAAa,yBAAyB;IAEpC,YAAY,KAAa,EAAW,WAAmB,EAAW,cAAsB;QAApD,gBAAW,GAAX,WAAW,CAAQ;QAAW,mBAAc,GAAd,cAAc,CAAQ;;QACtF,IAAI,KAAK,KAAK,yCAAyC,EAAE;YACvD,MAAM,IAAI,kCAAkC,CAAC,0BAA0B,CAAC,CAAA;SACzE;IACH,CAAC;IAEK,mBAAmB;;YACvB,MAAM,EAAE,GAAG,IAAA,gBAAM,GAAE,CAAA;YACnB,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC,CAAA;YACnD,MAAM,YAAY,GAAG,YAAE,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAA;YACnD,OAAO,IAAI,+CAAuB,CAAC,EAAE,EAAE,YAAY,CAAC,CAAA;QACtD,CAAC;KAAA;IA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I,IAAI,SAAS,CAAC,YAAY,GAAG,SAAS,CAAC,GAAG,EAAE,CAAC,CAAA;AAChG,CAAC;AAED,SAAS,4BAA4B,CAAC,SAAoB,EAAE,UAAsB,EAAE,WAAwB;IAC1G,IAAI,SAAS,CAAC,cAAc,EAAE;QAC5B,OAAO,SAAS,CAAC,cAAc,CAAA;KAChC;IACD,OAAO,6BAA6B,CAAC,SAAS,EAAE,UAAU,EAAE,WAAW,CAAC,CAAA;AAC1E,CAAC;AAED,MAAM,yCAAyC,GAAG,MAAM,CAAC,2CAA2C,CAAC,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { AllocateObservationId, ExoAttachment, ExoObservation, ObservationRequest, ReadAttachmentContent, SaveObservation, StoreAttachmentContent } from '../../app.api/observations/app.api.observations';
|
|
3
|
+
import { AttachmentStore, EventScopedObservationRepository, ObservationState } from '../../entities/observations/entities.observations';
|
|
4
|
+
import { MageEvent, MageEventId } from '../../entities/events/entities.events';
|
|
5
|
+
import busboy from 'busboy';
|
|
6
|
+
declare module 'express-serve-static-core' {
|
|
7
|
+
interface Request {
|
|
8
|
+
attachmentUpload: busboy.Busboy | null;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export interface ObservationAppLayer {
|
|
12
|
+
allocateObservationId: AllocateObservationId;
|
|
13
|
+
saveObservation: SaveObservation;
|
|
14
|
+
storeAttachmentContent: StoreAttachmentContent;
|
|
15
|
+
readAttachmentContent: ReadAttachmentContent;
|
|
16
|
+
}
|
|
17
|
+
export interface ObservationWebAppRequestFactory {
|
|
18
|
+
<Params extends object>(req: express.Request, params?: Params): Params & ObservationRequest<unknown>;
|
|
19
|
+
}
|
|
20
|
+
export interface EnsureEventScope {
|
|
21
|
+
(eventId: MageEventId): Promise<null | {
|
|
22
|
+
mageEvent: MageEvent;
|
|
23
|
+
observationRepository: EventScopedObservationRepository;
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
26
|
+
export declare function ObservationRoutes(app: ObservationAppLayer, attachmentStore: AttachmentStore, createAppRequest: ObservationWebAppRequestFactory): express.Router;
|
|
27
|
+
export type WebObservation = Omit<ExoObservation, 'attachments' | 'state'> & {
|
|
28
|
+
url: string;
|
|
29
|
+
state?: WebObservationState;
|
|
30
|
+
attachments: WebAttachment[];
|
|
31
|
+
};
|
|
32
|
+
export type WebObservationState = ObservationState & {
|
|
33
|
+
url: string;
|
|
34
|
+
};
|
|
35
|
+
export type WebAttachment = ExoAttachment & {
|
|
36
|
+
url?: string;
|
|
37
|
+
};
|
|
38
|
+
export declare function jsonForObservation(o: ExoObservation, baseUrl: string): WebObservation;
|
|
39
|
+
export declare function jsonForAttachment(a: ExoAttachment, observationUrl: string): WebAttachment;
|
|
40
|
+
//# sourceMappingURL=adapters.observations.controllers.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapters.observations.controllers.web.d.ts","sourceRoot":"","sources":["../../../src/adapters/observations/adapters.observations.controllers.web.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAE7B,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAgC,cAAc,EAAqB,kBAAkB,EAAE,qBAAqB,EAAgC,eAAe,EAA0B,sBAAsB,EAAiC,MAAM,iDAAiD,CAAA;AAChV,OAAO,EAAE,eAAe,EAAE,gCAAgC,EAAE,gBAAgB,EAAE,MAAM,mDAAmD,CAAA;AACvI,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,MAAM,MAAM,QAAQ,CAAA;AAG3B,OAAO,QAAQ,2BAA2B,CAAC;IACzC,UAAU,OAAO;QACf,gBAAgB,EAAE,MAAM,CAAC,MAAM,GAAG,IAAI,CAAA;KACvC;CACF;AAED,MAAM,WAAW,mBAAmB;IAClC,qBAAqB,EAAE,qBAAqB,CAAA;IAC5C,eAAe,EAAE,eAAe,CAAA;IAChC,sBAAsB,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t(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.jsonForAttachment = exports.jsonForObservation = exports.ObservationRoutes = void 0;
|
|
16
|
+
const express_1 = __importDefault(require("express"));
|
|
17
|
+
const adapters_controllers_web_1 = require("../adapters.controllers.web");
|
|
18
|
+
const busboy_1 = __importDefault(require("busboy"));
|
|
19
|
+
const app_api_errors_1 = require("../../app.api/app.api.errors");
|
|
20
|
+
function ObservationRoutes(app, attachmentStore, createAppRequest) {
|
|
21
|
+
const routes = express_1.default.Router().use(express_1.default.json());
|
|
22
|
+
routes.route('/id')
|
|
23
|
+
.post((req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const appReq = createAppRequest(req);
|
|
25
|
+
const appRes = yield app.allocateObservationId(appReq);
|
|
26
|
+
const id = appRes.success;
|
|
27
|
+
const path = `${req.baseUrl}/${id}`;
|
|
28
|
+
if (id) {
|
|
29
|
+
// TODO: add location header? kind of a gray area restfully speaking
|
|
30
|
+
return res.status(201).location(path).json({
|
|
31
|
+
id,
|
|
32
|
+
eventId: appReq.context.mageEvent.id,
|
|
33
|
+
url: `${req.getRoot()}${path}`
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
next(appRes.error);
|
|
37
|
+
}));
|
|
38
|
+
routes.route('/:observationId/attachments/:attachmentId')
|
|
39
|
+
.put((req, res, next) => {
|
|
40
|
+
/*
|
|
41
|
+
encapsulate the busboy init in a middleware so the request can
|
|
42
|
+
fail-fast when busboy throws a validation error
|
|
43
|
+
*/
|
|
44
|
+
try {
|
|
45
|
+
req.attachmentUpload = (0, busboy_1.default)({
|
|
46
|
+
headers: req.headers,
|
|
47
|
+
limits: { files: 1, fields: 0 }
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
console.error('error initializing attachment upload\n', req.params, '\nheaders:\n', req.headers, '\n', err);
|
|
52
|
+
return res.status(400).json({ message: err instanceof Error ? err.message : String(err) });
|
|
53
|
+
}
|
|
54
|
+
next();
|
|
55
|
+
}, (req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
const afterUploadStreamEvent = 'afterUploadStream';
|
|
57
|
+
const sendInvalidRequestStructure = () => next((0, app_api_errors_1.invalidInput)(`request must contain only one file part named 'attachment'`));
|
|
58
|
+
const afterUploadStream = (finishResponse) => {
|
|
59
|
+
var _a, _b;
|
|
60
|
+
if ((_a = req.attachmentUpload) === null || _a === void 0 ? void 0 : _a.listenerCount(afterUploadStreamEvent)) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if ((_b = req.attachmentUpload) === null || _b === void 0 ? void 0 : _b.writable) {
|
|
64
|
+
return void (req.attachmentUpload.on(afterUploadStreamEvent, finishResponse));
|
|
65
|
+
}
|
|
66
|
+
finishResponse();
|
|
67
|
+
};
|
|
68
|
+
const { observationId, attachmentId } = req.params;
|
|
69
|
+
req.pipe(req.attachmentUpload
|
|
70
|
+
.on('file', (fieldName, stream, info) => __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
if (fieldName !== 'attachment') {
|
|
72
|
+
// per busboy docs, drain the file stream and move on
|
|
73
|
+
console.error(`unexpected file entry '${fieldName}' uploading attachment ${attachmentId} on observation ${observationId}`);
|
|
74
|
+
stream.resume();
|
|
75
|
+
return afterUploadStream(sendInvalidRequestStructure);
|
|
76
|
+
}
|
|
77
|
+
const content = {
|
|
78
|
+
bytes: stream,
|
|
79
|
+
mediaType: info.mimeType,
|
|
80
|
+
name: info.filename,
|
|
81
|
+
};
|
|
82
|
+
const appReqParams = { observationId, attachmentId, content };
|
|
83
|
+
const appReq = createAppRequest(req, appReqParams);
|
|
84
|
+
const appRes = yield app.storeAttachmentContent(appReq);
|
|
85
|
+
if (appRes.success) {
|
|
86
|
+
const obs = appRes.success;
|
|
87
|
+
const attachment = obs.attachments.find(x => x.id === appReq.attachmentId);
|
|
88
|
+
const attachmentJson = jsonForAttachment(attachment, `${qualifiedBaseUrl(req)}/${observationId}`);
|
|
89
|
+
console.info(`successfully stored attachment ${attachmentId} on observation ${observationId}`);
|
|
90
|
+
return void (afterUploadStream(() => res.json(attachmentJson)));
|
|
91
|
+
}
|
|
92
|
+
if (appRes.error) {
|
|
93
|
+
const error = appRes.error;
|
|
94
|
+
afterUploadStream(() => next(error));
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
afterUploadStream(sendInvalidRequestStructure);
|
|
98
|
+
}
|
|
99
|
+
/*
|
|
100
|
+
per busboy docs, drain the stream and ignore the contents; necessary
|
|
101
|
+
for the busboy stream to terminate properly
|
|
102
|
+
*/
|
|
103
|
+
stream.resume();
|
|
104
|
+
}))
|
|
105
|
+
.on('field', (fieldName, content, info) => {
|
|
106
|
+
console.error(`unexpected field ${fieldName} uploading attachment ${attachmentId} on observation ${observationId}`);
|
|
107
|
+
afterUploadStream(sendInvalidRequestStructure);
|
|
108
|
+
})
|
|
109
|
+
.on('filesLimit', () => {
|
|
110
|
+
console.error(`too many file parts in upload request for attachment ${attachmentId} on observation ${observationId}`);
|
|
111
|
+
afterUploadStream(sendInvalidRequestStructure);
|
|
112
|
+
})
|
|
113
|
+
.on('fieldsLimit', () => {
|
|
114
|
+
console.error(`too many field parts in upload request for attachment ${attachmentId} on observation ${observationId}`);
|
|
115
|
+
afterUploadStream(sendInvalidRequestStructure);
|
|
116
|
+
})
|
|
117
|
+
.on('close', () => {
|
|
118
|
+
var _a, _b;
|
|
119
|
+
(_a = req.attachmentUpload) === null || _a === void 0 ? void 0 : _a.emit(afterUploadStreamEvent);
|
|
120
|
+
(_b = req.attachmentUpload) === null || _b === void 0 ? void 0 : _b.removeAllListeners();
|
|
121
|
+
}));
|
|
122
|
+
}))
|
|
123
|
+
.get((req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
124
|
+
const minDimension = parseInt(String(req.query.size), 10) || undefined;
|
|
125
|
+
const contentRange = req.headers.range ?
|
|
126
|
+
req.headers.range.replace(/bytes=/i, '').split('-').map(x => parseInt(x, 10)).filter(x => typeof x === 'number' && !Number.isNaN(x)) : [];
|
|
127
|
+
const appReq = createAppRequest(req, {
|
|
128
|
+
observationId: req.params.observationId,
|
|
129
|
+
attachmentId: req.params.attachmentId,
|
|
130
|
+
minDimension,
|
|
131
|
+
contentRange: contentRange.length === 2 ? { start: contentRange[0], end: contentRange[1] } : undefined
|
|
132
|
+
});
|
|
133
|
+
const appRes = yield app.readAttachmentContent(appReq);
|
|
134
|
+
if (appRes.error) {
|
|
135
|
+
return next(appRes.error);
|
|
136
|
+
}
|
|
137
|
+
const content = appRes.success;
|
|
138
|
+
if (!content) {
|
|
139
|
+
return res.status(500).json({ message: 'unknown application response' });
|
|
140
|
+
}
|
|
141
|
+
const { bytesRange } = content;
|
|
142
|
+
const headers = {
|
|
143
|
+
'content-type': String(content.attachment.contentType),
|
|
144
|
+
'content-length': String(bytesRange ? bytesRange.end - bytesRange.start + 1 : content.attachment.size)
|
|
145
|
+
};
|
|
146
|
+
if (bytesRange) {
|
|
147
|
+
headers['content-range'] = `bytes ${bytesRange.start}-${bytesRange.end}/${content.attachment.size || '*'}`;
|
|
148
|
+
}
|
|
149
|
+
return content.bytes.pipe(res.writeHead(bytesRange ? 206 : 200, headers));
|
|
150
|
+
}))
|
|
151
|
+
.delete((req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
152
|
+
// TODO: this should go away when ios app is fixed to stop sending delete requests
|
|
153
|
+
res.sendStatus(204);
|
|
154
|
+
}));
|
|
155
|
+
routes.route('/:observationId')
|
|
156
|
+
.put((req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
157
|
+
const body = req.body;
|
|
158
|
+
const observationId = req.params.observationId;
|
|
159
|
+
if (body.hasOwnProperty('id') && body.id !== observationId) {
|
|
160
|
+
return res.status(400).json({ message: 'Body observation ID does not match path observation ID' });
|
|
161
|
+
}
|
|
162
|
+
const mod = {
|
|
163
|
+
id: observationId,
|
|
164
|
+
type: 'Feature',
|
|
165
|
+
geometry: req.body.geometry,
|
|
166
|
+
properties: {
|
|
167
|
+
timestamp: new Date(body.properties.timestamp),
|
|
168
|
+
forms: body.properties.forms
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
const appReq = createAppRequest(req, { observation: mod });
|
|
172
|
+
if (body.hasOwnProperty('eventId') && body.eventId !== appReq.context.mageEvent.id) {
|
|
173
|
+
return res.status(400).json({ message: 'Body event ID does not match path event ID' });
|
|
174
|
+
}
|
|
175
|
+
const appRes = yield app.saveObservation(appReq);
|
|
176
|
+
if (appRes.success) {
|
|
177
|
+
return res.json(jsonForObservation(appRes.success, `${qualifiedBaseUrl(req)}`));
|
|
178
|
+
}
|
|
179
|
+
next(appRes.error);
|
|
180
|
+
}));
|
|
181
|
+
return routes.use(adapters_controllers_web_1.compatibilityMageAppErrorHandler);
|
|
182
|
+
}
|
|
183
|
+
exports.ObservationRoutes = ObservationRoutes;
|
|
184
|
+
function jsonForObservation(o, baseUrl) {
|
|
185
|
+
const obsUrl = `${baseUrl}/${o.id}`;
|
|
186
|
+
return Object.assign(Object.assign({}, o), { url: obsUrl, state: o.state ? Object.assign(Object.assign({}, o.state), { url: `${obsUrl}/states/${o.state.id}` }) : void (0), attachments: o.attachments.map(a => jsonForAttachment(a, obsUrl)) });
|
|
187
|
+
}
|
|
188
|
+
exports.jsonForObservation = jsonForObservation;
|
|
189
|
+
function jsonForAttachment(a, observationUrl) {
|
|
190
|
+
return Object.assign(Object.assign({}, a), { url: a.contentStored ? `${observationUrl}/attachments/${a.id}` : void (0) });
|
|
191
|
+
}
|
|
192
|
+
exports.jsonForAttachment = jsonForAttachment;
|
|
193
|
+
function qualifiedBaseUrl(req) {
|
|
194
|
+
return req.getRoot() + req.baseUrl;
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=adapters.observations.controllers.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapters.observations.controllers.web.js","sourceRoot":"","sources":["../../../src/adapters/observations/adapters.observations.controllers.web.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sDAA6B;AAC7B,0EAA8E;AAI9E,oDAA2B;AAC3B,iEAA2D;AAuB3D,SAAgB,iBAAiB,CAAC,GAAwB,EAAE,eAAgC,EAAE,gBAAiD;IAE7I,MAAM,MAAM,GAAG,iBAAO,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,iBAAO,CAAC,IAAI,EAAE,CAAC,CAAA;IAEnD,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;SAChB,IAAI,CAAC,CAAO,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAC7B,MAAM,MAAM,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAA;QACpC,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAA;QACtD,MAAM,EAAE,GAAG,MAAM,CAAC,OAAO,CAAA;QACzB,MAAM,IAAI,GAAG,GAAG,GAAG,CAAC,OAAO,IAAI,EAAE,EAAE,CAAA;QACnC,IAAI,EAAE,EAAE;YACN,oEAAoE;YACpE,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;gBACzC,EAAE;gBACF,OAAO,EAAE,MAAM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AAK,CAAC,CAAA;IACpB,CAAC,CAAA,CAAC,CAAA;IAEJ,OAAO,MAAM,CAAC,GAAG,CAAC,2DAAgC,CAAC,CAAA;AACrD,CAAC;AAzKD,8CAyKC;AAgBD,SAAgB,kBAAkB,CAAC,CAAiB,EAAE,OAAe;IACnE,MAAM,MAAM,GAAG,GAAG,OAAO,IAAI,CAAC,CAAC,EAAE,EAAE,CAAA;IACnC,uCACK,CAAC,KACJ,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,iCAAM,CAAC,CAAC,KAAK,KAAE,GAAG,EAAE,GAAG,MAAM,WAAW,CAAC,CAAC,KAAK,CAAC,EAAY,EAAE,IAAG,CAAC,CAAC,KAAI,CAAC,CAAC,CAAC,EAC1F,WAAW,EAAE,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,IAClE;AACH,CAAC;AARD,gDAQC;AAED,SAAgB,iBAAiB,CAAC,CAAgB,EAAE,cAAsB;IACxE,uCAAY,CAAC,KAAE,GAAG,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,cAAc,gBAAgB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAI,CAAC,CAAC,CAAC,IAAE;AAC3F,CAAC;AAFD,8CAEC;AAED,SAAS,gBAAgB,CAAC,GAAoB;IAC5C,OAAO,GAAG,CAAC,OAAO,EAAE,GAAG,GAAG,CAAC,OAAO,CAAA;AACpC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { MageEvent, MageEventId } from '../../entities/events/entities.events';
|
|
3
|
+
import { AttachmentId, AttachmentNotFoundError, AttachmentPatchAttrs, EventScopedObservationRepository, FormEntryId, Observation, ObservationAttrs, ObservationId, ObservationRepositoryError, ObservationRepositoryForEvent } from '../../entities/observations/entities.observations';
|
|
4
|
+
import { BaseMongooseRepository } from '../base/adapters.base.db.mongoose';
|
|
5
|
+
import mongoose from 'mongoose';
|
|
6
|
+
import * as legacy from '../../models/observation';
|
|
7
|
+
import { MageEventDocument } from '../../models/event';
|
|
8
|
+
import { PageOf, PagingParameters } from '../../entities/entities.global';
|
|
9
|
+
import { MongooseMageEventRepository } from '../events/adapters.events.db.mongoose';
|
|
10
|
+
import { EventEmitter } from 'events';
|
|
11
|
+
export type ObservationIdDocument = mongoose.Document;
|
|
12
|
+
export type ObservationIdModel = mongoose.Model<ObservationIdDocument>;
|
|
13
|
+
export declare class MongooseObservationRepository extends BaseMongooseRepository<legacy.ObservationDocument, legacy.ObservationModel, ObservationAttrs> implements EventScopedObservationRepository {
|
|
14
|
+
readonly eventLookup: (eventId: MageEventId) => Promise<MageEvent | null>;
|
|
15
|
+
readonly domainEvents: EventEmitter;
|
|
16
|
+
readonly eventScope: MageEventId;
|
|
17
|
+
readonly idModel: ObservationIdModel;
|
|
18
|
+
constructor(eventDoc: Pick<MageEventDocument, 'id' | 'collectionName'>, eventLookup: (eventId: MageEventId) => Promise<MageEvent | null>, domainEvents: EventEmitter);
|
|
19
|
+
allocateObservationId(): Promise<ObservationId>;
|
|
20
|
+
save(observation: Observation): Promise<Observation | ObservationRepositoryError>;
|
|
21
|
+
findById(id: ObservationId): Promise<Observation | null>;
|
|
22
|
+
findLatest(): Promise<ObservationAttrs | null>;
|
|
23
|
+
findLastModifiedAfter(timestamp: number, paging: PagingParameters): Promise<PageOf<Observation>>;
|
|
24
|
+
patchAttachment(observation: Observation, attachmentId: AttachmentId, patch: AttachmentPatchAttrs): Promise<Observation | AttachmentNotFoundError | null>;
|
|
25
|
+
nextFormEntryIds(count?: number): Promise<FormEntryId[]>;
|
|
26
|
+
nextAttachmentIds(count?: number): Promise<AttachmentId[]>;
|
|
27
|
+
}
|
|
28
|
+
export declare const createObservationRepositoryFactory: (eventRepo: MongooseMageEventRepository, domainEvents: EventEmitter) => ObservationRepositoryForEvent;
|
|
29
|
+
export declare function docToEntity(doc: legacy.ObservationDocument, eventId: MageEventId): ObservationAttrs;
|
|
30
|
+
//# sourceMappingURL=adapters.observations.db.mongoose.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapters.observations.db.mongoose.d.ts","sourceRoot":"","sources":["../../../src/adapters/observations/adapters.observations.db.mongoose.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAuB,MAAM,uCAAuC,CAAA;AACnG,OAAO,EAA2C,YAAY,EAAE,uBAAuB,EAAE,oBAAoB,EAAwB,gCAAgC,EAAa,WAAW,EAAE,WAAW,EAAE,gBAAgB,EAAE,aAAa,EAA4B,0BAA0B,EAAkC,6BAA6B,EAAgD,MAAM,mDAAmD,CAAA;AACzc,OAAO,EAAE,sBAAsB,EAAmB,MAAM,mCAAmC,CAAA;AAC3F,OAAO,QAAQ,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACzE,OAAO,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAA;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAErC,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC,QAAQ,CAAA;AACrD,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAA;AAEtE,qBAAa,6BAA8B,SAAQ,sBAAsB,CAAC,MAAM,CAAC,mBAAmB,EAAE,MAAM,CAAC,gBAAgB,EAAE,gBAAgB,CAAE,YAAW,gCAAgC;IAKlH,QAAQ,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IA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