@mapcreator/api 3.3.7 → 5.0.0-alpha.101
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/LICENSE +29 -29
- package/README.md +86 -63
- package/cjs/api/apiCommon.d.ts +7 -0
- package/cjs/api/apiCommon.d.ts.map +1 -0
- package/cjs/api/apiCommon.js +31 -0
- package/cjs/api/apiCommon.js.map +1 -0
- package/cjs/api/choropleth.d.ts +138 -0
- package/cjs/api/choropleth.d.ts.map +1 -0
- package/cjs/api/choropleth.js +41 -0
- package/cjs/api/choropleth.js.map +1 -0
- package/cjs/api/color.d.ts +16 -0
- package/cjs/api/color.d.ts.map +1 -0
- package/cjs/api/color.js +8 -0
- package/cjs/api/color.js.map +1 -0
- package/cjs/api/dimension.d.ts +25 -0
- package/cjs/api/dimension.d.ts.map +1 -0
- package/cjs/api/dimension.js +14 -0
- package/cjs/api/dimension.js.map +1 -0
- package/cjs/api/dimensionSet.d.ts +15 -0
- package/cjs/api/dimensionSet.d.ts.map +1 -0
- package/cjs/api/dimensionSet.js +7 -0
- package/cjs/api/dimensionSet.js.map +1 -0
- package/cjs/api/feature.d.ts +16 -0
- package/cjs/api/feature.d.ts.map +1 -0
- package/cjs/api/feature.js +8 -0
- package/cjs/api/feature.js.map +1 -0
- package/cjs/api/font.d.ts +32 -0
- package/cjs/api/font.d.ts.map +1 -0
- package/cjs/api/font.js +15 -0
- package/cjs/api/font.js.map +1 -0
- package/cjs/api/fontFamily.d.ts +17 -0
- package/cjs/api/fontFamily.d.ts.map +1 -0
- package/cjs/api/fontFamily.js +17 -0
- package/cjs/api/fontFamily.js.map +1 -0
- package/cjs/api/geocode.d.ts +10 -0
- package/cjs/api/geocode.d.ts.map +1 -0
- package/cjs/api/geocode.js +9 -0
- package/cjs/api/geocode.js.map +1 -0
- package/cjs/api/highlight.d.ts +41 -0
- package/cjs/api/highlight.d.ts.map +1 -0
- package/cjs/api/highlight.js +25 -0
- package/cjs/api/highlight.js.map +1 -0
- package/cjs/api/insetMap.d.ts +37 -0
- package/cjs/api/insetMap.d.ts.map +1 -0
- package/cjs/api/insetMap.js +47 -0
- package/cjs/api/insetMap.js.map +1 -0
- package/cjs/api/job.d.ts +42 -0
- package/cjs/api/job.d.ts.map +1 -0
- package/cjs/api/job.js +71 -0
- package/cjs/api/job.js.map +1 -0
- package/cjs/api/jobResult.d.ts +40 -0
- package/cjs/api/jobResult.d.ts.map +1 -0
- package/cjs/api/jobResult.js +35 -0
- package/cjs/api/jobResult.js.map +1 -0
- package/cjs/api/jobRevision.d.ts +76 -0
- package/cjs/api/jobRevision.d.ts.map +1 -0
- package/cjs/api/jobRevision.js +126 -0
- package/cjs/api/jobRevision.js.map +1 -0
- package/cjs/api/jobShare.d.ts +26 -0
- package/cjs/api/jobShare.d.ts.map +1 -0
- package/cjs/api/jobShare.js +9 -0
- package/cjs/api/jobShare.js.map +1 -0
- package/cjs/api/jobType.d.ts +17 -0
- package/cjs/api/jobType.d.ts.map +1 -0
- package/cjs/api/jobType.js +11 -0
- package/cjs/api/jobType.js.map +1 -0
- package/cjs/api/language.d.ts +17 -0
- package/cjs/api/language.d.ts.map +1 -0
- package/cjs/api/language.js +3 -0
- package/cjs/api/language.js.map +1 -0
- package/cjs/api/layer.d.ts +26 -0
- package/cjs/api/layer.d.ts.map +1 -0
- package/cjs/api/layer.js +14 -0
- package/cjs/api/layer.js.map +1 -0
- package/cjs/api/layerFaq.d.ts +27 -0
- package/cjs/api/layerFaq.d.ts.map +1 -0
- package/cjs/api/layerFaq.js +16 -0
- package/cjs/api/layerFaq.js.map +1 -0
- package/cjs/api/layerGroup.d.ts +16 -0
- package/cjs/api/layerGroup.d.ts.map +1 -0
- package/cjs/api/layerGroup.js +36 -0
- package/cjs/api/layerGroup.js.map +1 -0
- package/cjs/api/mapstyleSet.d.ts +32 -0
- package/cjs/api/mapstyleSet.d.ts.map +1 -0
- package/cjs/api/mapstyleSet.js +28 -0
- package/cjs/api/mapstyleSet.js.map +1 -0
- package/cjs/api/message.d.ts +32 -0
- package/cjs/api/message.d.ts.map +1 -0
- package/cjs/api/message.js +37 -0
- package/cjs/api/message.js.map +1 -0
- package/cjs/api/organisation.d.ts +41 -0
- package/cjs/api/organisation.d.ts.map +1 -0
- package/cjs/api/organisation.js +41 -0
- package/cjs/api/organisation.js.map +1 -0
- package/cjs/api/resources.d.ts +65 -0
- package/cjs/api/resources.d.ts.map +1 -0
- package/cjs/api/resources.js +61 -0
- package/cjs/api/resources.js.map +1 -0
- package/cjs/api/svg.d.ts +21 -0
- package/cjs/api/svg.d.ts.map +1 -0
- package/cjs/api/svg.js +15 -0
- package/cjs/api/svg.js.map +1 -0
- package/cjs/api/svgSet.d.ts +22 -0
- package/cjs/api/svgSet.d.ts.map +1 -0
- package/cjs/api/svgSet.js +25 -0
- package/cjs/api/svgSet.js.map +1 -0
- package/cjs/api/user.d.ts +129 -0
- package/cjs/api/user.d.ts.map +1 -0
- package/cjs/api/user.js +145 -0
- package/cjs/api/user.js.map +1 -0
- package/cjs/index.d.ts +28 -0
- package/cjs/index.d.ts.map +1 -0
- package/cjs/index.js +53 -0
- package/cjs/index.js.map +1 -0
- package/cjs/oauth.d.ts +31 -0
- package/cjs/oauth.d.ts.map +1 -0
- package/cjs/oauth.js +76 -0
- package/cjs/oauth.js.map +1 -0
- package/cjs/utils.d.ts +72 -0
- package/cjs/utils.d.ts.map +1 -0
- package/cjs/utils.js +220 -0
- package/cjs/utils.js.map +1 -0
- package/esm/api/apiCommon.d.ts +7 -0
- package/esm/api/apiCommon.d.ts.map +1 -0
- package/esm/api/apiCommon.js +28 -0
- package/esm/api/apiCommon.js.map +1 -0
- package/esm/api/choropleth.d.ts +138 -0
- package/esm/api/choropleth.d.ts.map +1 -0
- package/esm/api/choropleth.js +34 -0
- package/esm/api/choropleth.js.map +1 -0
- package/esm/api/color.d.ts +16 -0
- package/esm/api/color.d.ts.map +1 -0
- package/esm/api/color.js +5 -0
- package/esm/api/color.js.map +1 -0
- package/esm/api/dimension.d.ts +25 -0
- package/esm/api/dimension.d.ts.map +1 -0
- package/esm/api/dimension.js +11 -0
- package/esm/api/dimension.js.map +1 -0
- package/esm/api/dimensionSet.d.ts +15 -0
- package/esm/api/dimensionSet.d.ts.map +1 -0
- package/esm/api/dimensionSet.js +4 -0
- package/esm/api/dimensionSet.js.map +1 -0
- package/esm/api/feature.d.ts +16 -0
- package/esm/api/feature.d.ts.map +1 -0
- package/esm/api/feature.js +5 -0
- package/esm/api/feature.js.map +1 -0
- package/esm/api/font.d.ts +32 -0
- package/esm/api/font.d.ts.map +1 -0
- package/esm/api/font.js +11 -0
- package/esm/api/font.js.map +1 -0
- package/esm/api/fontFamily.d.ts +17 -0
- package/esm/api/fontFamily.d.ts.map +1 -0
- package/esm/api/fontFamily.js +13 -0
- package/esm/api/fontFamily.js.map +1 -0
- package/esm/api/geocode.d.ts +10 -0
- package/esm/api/geocode.d.ts.map +1 -0
- package/esm/api/geocode.js +6 -0
- package/esm/api/geocode.js.map +1 -0
- package/esm/api/highlight.d.ts +41 -0
- package/esm/api/highlight.d.ts.map +1 -0
- package/esm/api/highlight.js +21 -0
- package/esm/api/highlight.js.map +1 -0
- package/esm/api/insetMap.d.ts +37 -0
- package/esm/api/insetMap.d.ts.map +1 -0
- package/esm/api/insetMap.js +42 -0
- package/esm/api/insetMap.js.map +1 -0
- package/esm/api/job.d.ts +42 -0
- package/esm/api/job.d.ts.map +1 -0
- package/esm/api/job.js +59 -0
- package/esm/api/job.js.map +1 -0
- package/esm/api/jobResult.d.ts +40 -0
- package/esm/api/jobResult.d.ts.map +1 -0
- package/esm/api/jobResult.js +30 -0
- package/esm/api/jobResult.js.map +1 -0
- package/esm/api/jobRevision.d.ts +76 -0
- package/esm/api/jobRevision.d.ts.map +1 -0
- package/esm/api/jobRevision.js +114 -0
- package/esm/api/jobRevision.js.map +1 -0
- package/esm/api/jobShare.d.ts +26 -0
- package/esm/api/jobShare.d.ts.map +1 -0
- package/esm/api/jobShare.js +6 -0
- package/esm/api/jobShare.js.map +1 -0
- package/esm/api/jobType.d.ts +17 -0
- package/esm/api/jobType.d.ts.map +1 -0
- package/esm/api/jobType.js +8 -0
- package/esm/api/jobType.js.map +1 -0
- package/esm/api/language.d.ts +17 -0
- package/esm/api/language.d.ts.map +1 -0
- package/esm/api/language.js +2 -0
- package/esm/api/language.js.map +1 -0
- package/esm/api/layer.d.ts +26 -0
- package/esm/api/layer.d.ts.map +1 -0
- package/esm/api/layer.js +11 -0
- package/esm/api/layer.js.map +1 -0
- package/esm/api/layerFaq.d.ts +27 -0
- package/esm/api/layerFaq.d.ts.map +1 -0
- package/esm/api/layerFaq.js +12 -0
- package/esm/api/layerFaq.js.map +1 -0
- package/esm/api/layerGroup.d.ts +16 -0
- package/esm/api/layerGroup.d.ts.map +1 -0
- package/esm/api/layerGroup.js +33 -0
- package/esm/api/layerGroup.js.map +1 -0
- package/esm/api/mapstyleSet.d.ts +32 -0
- package/esm/api/mapstyleSet.d.ts.map +1 -0
- package/esm/api/mapstyleSet.js +24 -0
- package/esm/api/mapstyleSet.js.map +1 -0
- package/esm/api/message.d.ts +32 -0
- package/esm/api/message.d.ts.map +1 -0
- package/esm/api/message.js +32 -0
- package/esm/api/message.js.map +1 -0
- package/esm/api/organisation.d.ts +41 -0
- package/esm/api/organisation.d.ts.map +1 -0
- package/esm/api/organisation.js +35 -0
- package/esm/api/organisation.js.map +1 -0
- package/esm/api/resources.d.ts +65 -0
- package/esm/api/resources.d.ts.map +1 -0
- package/esm/api/resources.js +55 -0
- package/esm/api/resources.js.map +1 -0
- package/esm/api/svg.d.ts +21 -0
- package/esm/api/svg.d.ts.map +1 -0
- package/esm/api/svg.js +11 -0
- package/esm/api/svg.js.map +1 -0
- package/esm/api/svgSet.d.ts +22 -0
- package/esm/api/svgSet.d.ts.map +1 -0
- package/esm/api/svgSet.js +21 -0
- package/esm/api/svgSet.js.map +1 -0
- package/esm/api/user.d.ts +129 -0
- package/esm/api/user.d.ts.map +1 -0
- package/esm/api/user.js +126 -0
- package/esm/api/user.js.map +1 -0
- package/esm/index.d.ts +28 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +28 -0
- package/esm/index.js.map +1 -0
- package/esm/oauth.d.ts +31 -0
- package/esm/oauth.d.ts.map +1 -0
- package/esm/oauth.js +68 -0
- package/esm/oauth.js.map +1 -0
- package/esm/utils.d.ts +72 -0
- package/esm/utils.d.ts.map +1 -0
- package/esm/utils.js +206 -0
- package/esm/utils.js.map +1 -0
- package/package.json +80 -148
- package/src/README.md +126 -0
- package/src/api/apiCommon.ts +70 -0
- package/src/api/choropleth.ts +228 -0
- package/src/api/color.ts +22 -0
- package/src/api/dimension.ts +44 -0
- package/src/api/dimensionSet.ts +20 -0
- package/src/api/feature.ts +22 -0
- package/src/api/font.ts +57 -0
- package/src/api/fontFamily.ts +43 -0
- package/src/api/geocode.ts +17 -0
- package/src/api/highlight.ts +87 -0
- package/src/api/insetMap.ts +95 -0
- package/src/api/job.ts +130 -0
- package/src/api/jobResult.ts +95 -0
- package/src/api/jobRevision.ts +281 -0
- package/src/api/jobShare.ts +35 -0
- package/src/api/jobType.ts +26 -0
- package/src/api/language.ts +19 -0
- package/src/api/layer.ts +38 -0
- package/src/api/layerFaq.ts +53 -0
- package/src/api/layerGroup.ts +69 -0
- package/src/api/mapstyleSet.ts +70 -0
- package/src/api/message.ts +80 -0
- package/src/api/organisation.ts +96 -0
- package/src/api/resources.ts +153 -0
- package/src/api/svg.ts +33 -0
- package/src/api/svgSet.ts +56 -0
- package/src/api/user.ts +327 -0
- package/src/index.ts +44 -0
- package/src/oauth.ts +90 -0
- package/src/utils.ts +342 -0
- package/dist/ImageHandler.d.ts +0 -56
- package/dist/Mapcreator.d.ts +0 -344
- package/dist/PaginatedResourceListing.d.ts +0 -156
- package/dist/RequestParameters.d.ts +0 -241
- package/dist/ResourceLister.d.ts +0 -155
- package/dist/bundle.browser.js +0 -14645
- package/dist/bundle.browser.min.js +0 -3
- package/dist/bundle.browser.min.js.LICENSE.txt +0 -74
- package/dist/bundle.js +0 -12810
- package/dist/bundle.min.js +0 -3
- package/dist/bundle.min.js.LICENSE.txt +0 -44
- package/dist/enums/DeletedState.d.ts +0 -16
- package/dist/enums/Enum.d.ts +0 -40
- package/dist/enums/JobShareVisibility.d.ts +0 -15
- package/dist/enums/ResultStatus.d.ts +0 -17
- package/dist/enums/index.d.ts +0 -5
- package/dist/errors/AbstractError.d.ts +0 -26
- package/dist/errors/ApiError.d.ts +0 -65
- package/dist/errors/GeoError.d.ts +0 -6
- package/dist/errors/NodeError.d.ts +0 -6
- package/dist/errors/OAuthError.d.ts +0 -17
- package/dist/errors/StaticClassError.d.ts +0 -7
- package/dist/errors/ValidationError.d.ts +0 -125
- package/dist/errors/index.d.ts +0 -8
- package/dist/index.d.ts +0 -27
- package/dist/oauth/CookieFlow.d.ts +0 -25
- package/dist/oauth/DummyFlow.d.ts +0 -19
- package/dist/oauth/ImplicitFlow.d.ts +0 -68
- package/dist/oauth/ImplicitFlowPopup.d.ts +0 -25
- package/dist/oauth/OAuth.d.ts +0 -50
- package/dist/oauth/OAuthToken.d.ts +0 -67
- package/dist/oauth/PasswordFlow.d.ts +0 -56
- package/dist/oauth/StateContainer.d.ts +0 -36
- package/dist/proxy/GeoResourceProxy.d.ts +0 -69
- package/dist/proxy/OrganisationProxy.d.ts +0 -62
- package/dist/proxy/OwnedResourceProxy.d.ts +0 -60
- package/dist/proxy/ResourceProxy.d.ts +0 -32
- package/dist/proxy/SimpleResourceProxy.d.ts +0 -76
- package/dist/proxy/index.d.ts +0 -6
- package/dist/resources/Choropleth.d.ts +0 -20
- package/dist/resources/Color.d.ts +0 -9
- package/dist/resources/Contract.d.ts +0 -7
- package/dist/resources/Dimension.d.ts +0 -7
- package/dist/resources/DimensionSet.d.ts +0 -11
- package/dist/resources/Domain.d.ts +0 -7
- package/dist/resources/DomainLoginMethod.d.ts +0 -7
- package/dist/resources/Faq.d.ts +0 -7
- package/dist/resources/Feature.d.ts +0 -9
- package/dist/resources/Font.d.ts +0 -4
- package/dist/resources/FontFamily.d.ts +0 -11
- package/dist/resources/Highlight.d.ts +0 -4
- package/dist/resources/InsetMap.d.ts +0 -10
- package/dist/resources/Job.d.ts +0 -56
- package/dist/resources/JobResult.d.ts +0 -76
- package/dist/resources/JobRevision.d.ts +0 -64
- package/dist/resources/JobShare.d.ts +0 -15
- package/dist/resources/JobType.d.ts +0 -9
- package/dist/resources/Language.d.ts +0 -4
- package/dist/resources/Layer.d.ts +0 -10
- package/dist/resources/LayerFaq.d.ts +0 -8
- package/dist/resources/LayerGroup.d.ts +0 -14
- package/dist/resources/Mapstyle.d.ts +0 -8
- package/dist/resources/MapstyleSet.d.ts +0 -13
- package/dist/resources/MapstyleSetColor.d.ts +0 -8
- package/dist/resources/Message.d.ts +0 -7
- package/dist/resources/MessageVariant.d.ts +0 -4
- package/dist/resources/Notification.d.ts +0 -4
- package/dist/resources/Organisation.d.ts +0 -99
- package/dist/resources/OrganisationNote.d.ts +0 -17
- package/dist/resources/Permission.d.ts +0 -4
- package/dist/resources/ProductTour.d.ts +0 -10
- package/dist/resources/ProductTourStep.d.ts +0 -7
- package/dist/resources/Role.d.ts +0 -14
- package/dist/resources/Svg.d.ts +0 -4
- package/dist/resources/SvgSet.d.ts +0 -11
- package/dist/resources/Tag.d.ts +0 -9
- package/dist/resources/TagType.d.ts +0 -13
- package/dist/resources/User.d.ts +0 -119
- package/dist/resources/VectorChoropleth.d.ts +0 -4
- package/dist/resources/VectorHighlight.d.ts +0 -4
- package/dist/resources/base/CrudBase.d.ts +0 -66
- package/dist/resources/base/CrudBase.d.ts.map +0 -1
- package/dist/resources/base/CrudSetBase.d.ts +0 -27
- package/dist/resources/base/CrudSetBase.d.ts.map +0 -1
- package/dist/resources/base/CrudSetItemBase.d.ts +0 -19
- package/dist/resources/base/CrudSetItemBase.d.ts.map +0 -1
- package/dist/resources/base/DownloadedResource.d.ts +0 -72
- package/dist/resources/base/DownloadedResource.d.ts.map +0 -1
- package/dist/resources/base/ResourceBase.d.ts +0 -164
- package/dist/resources/base/ResourceBase.d.ts.map +0 -1
- package/dist/resources/index.d.ts +0 -48
- package/dist/storage/CookiesDriver.d.ts +0 -37
- package/dist/storage/DataStoreContract.d.ts +0 -46
- package/dist/storage/DummyDriver.d.ts +0 -15
- package/dist/storage/FileDriver.d.ts +0 -54
- package/dist/storage/LocalStorageDriver.d.ts +0 -13
- package/dist/storage/StorageManager.d.ts +0 -46
- package/dist/traits/HandlesImages.d.ts +0 -15
- package/dist/traits/Injectable.d.ts +0 -60
- package/dist/traits/OwnableResource.d.ts +0 -18
- package/dist/traits/Trait.d.ts +0 -12
- package/dist/utils/Logger.d.ts +0 -55
- package/dist/utils/Singleton.d.ts +0 -9
- package/dist/utils/StaticClass.d.ts +0 -7
- package/dist/utils/Unobservable.d.ts +0 -13
- package/dist/utils/base64.d.ts +0 -12
- package/dist/utils/geo.d.ts +0 -74
- package/dist/utils/hash.d.ts +0 -15
- package/dist/utils/helpers.d.ts +0 -47
- package/dist/utils/node.d.ts +0 -15
- package/dist/utils/reflection.d.ts +0 -43
- package/dist/utils/requests.d.ts +0 -24
- package/dist/utils/uuid.d.ts +0 -19
- package/manual/assets/maps4news.svg +0 -23
- package/manual/building.md +0 -19
- package/manual/css/hide_import.css +0 -3
- package/manual/css/sidebar_fix.css +0 -3
- package/manual/examples.authentication.md +0 -205
- package/manual/examples.md +0 -153
- package/manual/installation.md +0 -33
- package/manual/js/sandbox.js +0 -26
- package/src/ImageHandler.js +0 -134
- package/src/Mapcreator.js +0 -713
- package/src/PaginatedResourceListing.js +0 -300
- package/src/RequestParameters.js +0 -711
- package/src/ResourceLister.js +0 -368
- package/src/enums/DeletedState.js +0 -49
- package/src/enums/Enum.js +0 -130
- package/src/enums/JobShareVisibility.js +0 -43
- package/src/enums/ResultStatus.js +0 -49
- package/src/enums/index.js +0 -36
- package/src/errors/AbstractError.js +0 -70
- package/src/errors/ApiError.js +0 -139
- package/src/errors/GeoError.js +0 -36
- package/src/errors/NodeError.js +0 -36
- package/src/errors/OAuthError.js +0 -71
- package/src/errors/StaticClassError.js +0 -37
- package/src/errors/ValidationError.js +0 -164
- package/src/errors/index.js +0 -39
- package/src/index.js +0 -75
- package/src/oauth/DummyFlow.js +0 -63
- package/src/oauth/ImplicitFlow.js +0 -226
- package/src/oauth/ImplicitFlowPopup.js +0 -124
- package/src/oauth/OAuth.js +0 -131
- package/src/oauth/OAuthToken.js +0 -175
- package/src/oauth/PasswordFlow.js +0 -164
- package/src/oauth/StateContainer.js +0 -111
- package/src/proxy/GeoResourceProxy.js +0 -137
- package/src/proxy/OrganisationProxy.js +0 -149
- package/src/proxy/OwnedResourceProxy.js +0 -148
- package/src/proxy/ResourceProxy.js +0 -101
- package/src/proxy/SimpleResourceProxy.js +0 -188
- package/src/proxy/index.js +0 -37
- package/src/resources/Choropleth.js +0 -66
- package/src/resources/Color.js +0 -46
- package/src/resources/Contract.js +0 -42
- package/src/resources/Dimension.js +0 -42
- package/src/resources/DimensionSet.js +0 -56
- package/src/resources/Domain.js +0 -42
- package/src/resources/DomainLoginMethod.js +0 -42
- package/src/resources/Faq.js +0 -42
- package/src/resources/Feature.js +0 -47
- package/src/resources/Font.js +0 -43
- package/src/resources/FontFamily.js +0 -55
- package/src/resources/Highlight.js +0 -39
- package/src/resources/InsetMap.js +0 -49
- package/src/resources/Job.js +0 -160
- package/src/resources/JobResult.js +0 -184
- package/src/resources/JobRevision.js +0 -201
- package/src/resources/JobShare.js +0 -61
- package/src/resources/JobType.js +0 -50
- package/src/resources/Language.js +0 -51
- package/src/resources/Layer.js +0 -48
- package/src/resources/LayerFaq.js +0 -47
- package/src/resources/LayerGroup.js +0 -57
- package/src/resources/Mapstyle.js +0 -45
- package/src/resources/MapstyleSet.js +0 -65
- package/src/resources/MapstyleSetColor.js +0 -51
- package/src/resources/Message.js +0 -94
- package/src/resources/MessageVariant.js +0 -37
- package/src/resources/Notification.js +0 -39
- package/src/resources/Organisation.js +0 -233
- package/src/resources/OrganisationNote.js +0 -57
- package/src/resources/Permission.js +0 -39
- package/src/resources/ProductTour.js +0 -53
- package/src/resources/ProductTourStep.js +0 -48
- package/src/resources/Role.js +0 -58
- package/src/resources/Svg.js +0 -39
- package/src/resources/SvgSet.js +0 -55
- package/src/resources/Tag.js +0 -50
- package/src/resources/TagType.js +0 -56
- package/src/resources/User.js +0 -251
- package/src/resources/VectorChoropleth.js +0 -40
- package/src/resources/VectorHighlight.js +0 -40
- package/src/resources/base/CrudBase.js +0 -204
- package/src/resources/base/CrudSetBase.js +0 -83
- package/src/resources/base/CrudSetItemBase.js +0 -82
- package/src/resources/base/DownloadedResource.js +0 -165
- package/src/resources/base/ResourceBase.js +0 -484
- package/src/resources/index.js +0 -82
- package/src/storage/CookiesDriver.js +0 -136
- package/src/storage/DataStoreContract.js +0 -111
- package/src/storage/DummyDriver.js +0 -91
- package/src/storage/FileDriver.js +0 -174
- package/src/storage/LocalStorageDriver.js +0 -108
- package/src/storage/StorageManager.js +0 -109
- package/src/traits/HandlesImages.js +0 -50
- package/src/traits/Injectable.js +0 -221
- package/src/traits/OwnableResource.js +0 -56
- package/src/traits/Trait.js +0 -43
- package/src/utils/Logger.js +0 -137
- package/src/utils/Singleton.js +0 -49
- package/src/utils/StaticClass.js +0 -43
- package/src/utils/Unobservable.js +0 -47
- package/src/utils/base64.js +0 -93
- package/src/utils/geo.js +0 -139
- package/src/utils/hash.js +0 -72
- package/src/utils/helpers.js +0 -178
- package/src/utils/node.js +0 -55
- package/src/utils/reflection.js +0 -170
- package/src/utils/requests.js +0 -120
- package/src/utils/uuid.js +0 -68
package/src/api/job.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { ApiJobShare, JobShare, JobShareVisibility } from './jobShare.js';
|
|
2
|
+
import { type JobSearchResult, listJobs } from './apiCommon.js';
|
|
3
|
+
import {
|
|
4
|
+
type ApiCommon,
|
|
5
|
+
type ApiCommonData,
|
|
6
|
+
type ApiError,
|
|
7
|
+
type ApiSuccess,
|
|
8
|
+
type Flatten,
|
|
9
|
+
type Revivers,
|
|
10
|
+
deletedNoneParam,
|
|
11
|
+
request,
|
|
12
|
+
} from '../utils.js';
|
|
13
|
+
|
|
14
|
+
export type Job = {
|
|
15
|
+
id: number;
|
|
16
|
+
jobTypeId: number;
|
|
17
|
+
title: string;
|
|
18
|
+
previewPath: string | undefined;
|
|
19
|
+
createdAt: string;
|
|
20
|
+
star: boolean;
|
|
21
|
+
jobFolderId: number | null;
|
|
22
|
+
userEmail: string | undefined;
|
|
23
|
+
jobFolderName: string | null;
|
|
24
|
+
userId: number;
|
|
25
|
+
orgName: string | undefined;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type ApiJob = {
|
|
29
|
+
data: {
|
|
30
|
+
id: number; // The job id (sortable)
|
|
31
|
+
job_type_id: number; // The id of the job type (searchable)
|
|
32
|
+
user_id: number; // The user id (searchable)
|
|
33
|
+
title: string; // The title of the job (searchable, sortable)
|
|
34
|
+
description: string | null; // The description of the job (searchable, sortable)
|
|
35
|
+
share_token: string | null; // The token used for sharing this job
|
|
36
|
+
autosave_preview_path: string | null; // The preview path of the Job
|
|
37
|
+
job_folder_id: number | null; // TODO: not present in API specification!
|
|
38
|
+
job_folder_name?: string | null; // TODO: not present in API specification!
|
|
39
|
+
star: boolean; // TODO: not present in API specification!
|
|
40
|
+
} & ApiCommonData;
|
|
41
|
+
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
42
|
+
|
|
43
|
+
export type ApiJobData = Flatten<Exclude<ApiJob, ApiError>['data']>;
|
|
44
|
+
|
|
45
|
+
export const jobRevivers: Revivers<ApiJob, Job> = {
|
|
46
|
+
description: undefined,
|
|
47
|
+
share_token: undefined,
|
|
48
|
+
autosave_preview_path: undefined,
|
|
49
|
+
|
|
50
|
+
jobTypeId: () => 9,
|
|
51
|
+
jobFolderName: (data: ApiJobData) => data.job_folder_name ?? null,
|
|
52
|
+
createdAt: (data: ApiJobData) => data.created_at as string,
|
|
53
|
+
previewPath: (data: ApiJobData) => data.autosave_preview_path ?? undefined,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export async function createJob(title: string): Promise<Job> {
|
|
57
|
+
const path = `/v1/jobs`;
|
|
58
|
+
const body = { title, job_type_id: 9 };
|
|
59
|
+
const options = { revivers: jobRevivers };
|
|
60
|
+
|
|
61
|
+
// Technically, the returning `data` will contain only the following fields:
|
|
62
|
+
// Pick<ApiJobData, 'id' | 'job_type_id' | 'user_id' | 'title' | 'created_at' | 'updated_at'>
|
|
63
|
+
|
|
64
|
+
return request<ApiJob, Job>(path, body, null, options);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export async function getJob(jobId: number): Promise<Job> {
|
|
68
|
+
const path = `/v1/jobs/${jobId}`;
|
|
69
|
+
const options = { revivers: jobRevivers };
|
|
70
|
+
|
|
71
|
+
return request<ApiJob, Job>(path, null, null, options);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export async function deleteJob(jobId: number): Promise<Record<string, never>> {
|
|
75
|
+
const path = `/v1/jobs/${jobId}`;
|
|
76
|
+
|
|
77
|
+
return request<ApiCommon, Record<string, never>>(path, null, null, { method: 'DELETE' });
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export async function updateJob(jobId: number, newTitle: string): Promise<Record<string, never>> {
|
|
81
|
+
const path = `/v1/jobs/${jobId}`;
|
|
82
|
+
const body = { title: newTitle };
|
|
83
|
+
|
|
84
|
+
return request<ApiCommon, Record<string, never>>(path, body, null, { method: 'PATCH' });
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export async function updateJobFolder(jobId: number, folderId: number | null): Promise<Record<string, never>> {
|
|
88
|
+
const path = `/v1/jobs/${jobId}`;
|
|
89
|
+
const body = { job_folder_id: folderId };
|
|
90
|
+
|
|
91
|
+
return request<ApiCommon, Record<string, never>>(path, body, null, { method: 'PATCH' });
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export async function starJob(jobId: number, star: boolean): Promise<Record<string, never>> {
|
|
95
|
+
const path = `/v1/jobs/${jobId}`;
|
|
96
|
+
const body = { star };
|
|
97
|
+
|
|
98
|
+
return request<ApiCommon, Record<string, never>>(path, body, null, { method: 'PATCH' });
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export async function generateJobShare(
|
|
102
|
+
jobId: number,
|
|
103
|
+
visibility: JobShareVisibility,
|
|
104
|
+
): Promise<JobShare> {
|
|
105
|
+
const path = `/v1/jobs/${jobId}/share`;
|
|
106
|
+
const body = { visibility };
|
|
107
|
+
|
|
108
|
+
return request<ApiJobShare, JobShare>(path, body);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export async function uploadJobPreview(
|
|
112
|
+
jobId: number,
|
|
113
|
+
preview: Blob,
|
|
114
|
+
): Promise<Record<string, never>> {
|
|
115
|
+
const pathname = `/v1/jobs/${jobId}/preview`;
|
|
116
|
+
const path = `${pathname}?${deletedNoneParam}`;
|
|
117
|
+
const body = new FormData();
|
|
118
|
+
|
|
119
|
+
body.append('preview', preview);
|
|
120
|
+
|
|
121
|
+
return request<ApiCommon, Record<string, never>>(path, body);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export async function listFeaturedJobs(
|
|
125
|
+
title: string,
|
|
126
|
+
page: number,
|
|
127
|
+
options?: Record<string, unknown>,
|
|
128
|
+
): Promise<JobSearchResult> {
|
|
129
|
+
return listJobs(`/v1/jobs/featured`, title, page, options);
|
|
130
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type ApiCommon,
|
|
3
|
+
type ApiCommonData,
|
|
4
|
+
type ApiError,
|
|
5
|
+
type ApiSuccess,
|
|
6
|
+
type Flatten,
|
|
7
|
+
type Revivers,
|
|
8
|
+
deletedNoneParam,
|
|
9
|
+
lastJobRevision,
|
|
10
|
+
request,
|
|
11
|
+
} from '../utils.js';
|
|
12
|
+
|
|
13
|
+
export type JobResult = {
|
|
14
|
+
jobRevisionId: number;
|
|
15
|
+
revision: number;
|
|
16
|
+
status: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type ApiJobResult = {
|
|
20
|
+
data: {
|
|
21
|
+
job_revision_id: number; // The id of the job revision
|
|
22
|
+
revision: number; // The revision number of the job revision
|
|
23
|
+
mapstyle_id: number; // The id of the map style
|
|
24
|
+
interface_version: string; // The version of the interface (searchable, sortable)
|
|
25
|
+
fix: string; //
|
|
26
|
+
status: string; // The status of the job result (searchable, sortable)
|
|
27
|
+
fail_reason: string; // A human-readable reason of why the map failed to process
|
|
28
|
+
process_start: string; // The datetime when the job process started (searchable, sortable)
|
|
29
|
+
process_end: string; // The datetime when the job process ended (searchable, sortable)
|
|
30
|
+
dealt_with: boolean; // Checks if the Support fixed an issue (searchable, sortable)
|
|
31
|
+
bought: boolean; // Checks if the result is bought or not (searchable, sortable)
|
|
32
|
+
subscription_id: number; // The id of the subscription that was active when the map was created
|
|
33
|
+
callback: string; // URL to another API which can finish a map (searchable, sortable)
|
|
34
|
+
last_downloaded: string; // The last time the archive was downloaded (searchable, sortable)
|
|
35
|
+
} & ApiCommonData;
|
|
36
|
+
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
37
|
+
|
|
38
|
+
export type ApiJobResultData = Flatten<Exclude<ApiJobResult, ApiError>['data']>;
|
|
39
|
+
|
|
40
|
+
export const jobResultRevivers: Revivers<ApiJobResult, JobResult> = {
|
|
41
|
+
mapstyle_id: undefined,
|
|
42
|
+
interface_version: undefined,
|
|
43
|
+
fix: undefined,
|
|
44
|
+
fail_reason: undefined,
|
|
45
|
+
process_start: undefined,
|
|
46
|
+
process_end: undefined,
|
|
47
|
+
dealt_with: undefined,
|
|
48
|
+
bought: undefined,
|
|
49
|
+
subscription_id: undefined,
|
|
50
|
+
callback: undefined,
|
|
51
|
+
last_downloaded: undefined,
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export async function uploadJobResultPreview(
|
|
55
|
+
jobId: number,
|
|
56
|
+
blob: Blob,
|
|
57
|
+
): Promise<Record<string, never>> {
|
|
58
|
+
const pathname = `/v1/jobs/${jobId}/revisions/${lastJobRevision}/result/preview`;
|
|
59
|
+
const path = `${pathname}?${deletedNoneParam}`;
|
|
60
|
+
const body = new FormData();
|
|
61
|
+
|
|
62
|
+
body.append('preview', blob);
|
|
63
|
+
|
|
64
|
+
return request<ApiCommon, Record<string, never>>(path, body);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export type JobResultHostedImage = {
|
|
68
|
+
url: string;
|
|
69
|
+
message: string;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export type ApiJobResultHostedImage = {
|
|
73
|
+
data: {
|
|
74
|
+
url: string;
|
|
75
|
+
message: string;
|
|
76
|
+
} & ApiCommonData;
|
|
77
|
+
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
78
|
+
|
|
79
|
+
export type ApiJobResultHostedImageData = Flatten<Exclude<ApiJobResultHostedImage, ApiError>['data']>;
|
|
80
|
+
|
|
81
|
+
export async function uploadJobResultHostedImage(
|
|
82
|
+
jobId: number,
|
|
83
|
+
blob: Blob,
|
|
84
|
+
fileName: string,
|
|
85
|
+
fileType: 'jpg' | 'png' | 'svg',
|
|
86
|
+
): Promise<JobResultHostedImage> {
|
|
87
|
+
const pathname = `/v1/jobs/${jobId}/revisions/${lastJobRevision}/result/hosted-${fileType}`;
|
|
88
|
+
const path = `${pathname}?${deletedNoneParam}`;
|
|
89
|
+
const body = new FormData();
|
|
90
|
+
|
|
91
|
+
body.append(fileType, blob);
|
|
92
|
+
body.append('filename', fileName);
|
|
93
|
+
|
|
94
|
+
return request<ApiJobResultHostedImage, JobResultHostedImage>(path, body);
|
|
95
|
+
}
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import { apiHost, authenticate, getAuthorizationHeaders, token } from '../oauth.js';
|
|
2
|
+
import { type ApiLayerData, type Layer, layerRevivers } from './layer.js';
|
|
3
|
+
import type { ApiMapstyleSetData } from './mapstyleSet.js';
|
|
4
|
+
import type { ApiLanguageData } from './language.js';
|
|
5
|
+
import {
|
|
6
|
+
APIError,
|
|
7
|
+
type ApiCommon,
|
|
8
|
+
type ApiCommonData,
|
|
9
|
+
type ApiError,
|
|
10
|
+
type ApiSuccess,
|
|
11
|
+
type Flatten,
|
|
12
|
+
HTTPError,
|
|
13
|
+
NetworkError,
|
|
14
|
+
type Revivers,
|
|
15
|
+
defaultListHeader,
|
|
16
|
+
deletedNoneParam,
|
|
17
|
+
lastJobRevision,
|
|
18
|
+
request,
|
|
19
|
+
} from '../utils.js';
|
|
20
|
+
|
|
21
|
+
export type FileFormat =
|
|
22
|
+
| 'jpg'
|
|
23
|
+
| 'png'
|
|
24
|
+
| 'svg'
|
|
25
|
+
| 'pdf'
|
|
26
|
+
| 'tiff'
|
|
27
|
+
| 'eps'
|
|
28
|
+
| 'eps_log'
|
|
29
|
+
| 'mp4'
|
|
30
|
+
| 'mov'
|
|
31
|
+
| 'mkv'
|
|
32
|
+
| 'mxf'
|
|
33
|
+
| 'webm'
|
|
34
|
+
| 'jpg_sequence'
|
|
35
|
+
| 'png_sequence'
|
|
36
|
+
| 'web'
|
|
37
|
+
| 'web_download';
|
|
38
|
+
|
|
39
|
+
export type JobRevision = {
|
|
40
|
+
id: number;
|
|
41
|
+
jobId: number;
|
|
42
|
+
revision: number;
|
|
43
|
+
languageCode: string;
|
|
44
|
+
mapstyleSetId: number;
|
|
45
|
+
output: FileFormat;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type ApiJobRevision = {
|
|
49
|
+
data: {
|
|
50
|
+
id: number; // The id of the job revision (sortable)
|
|
51
|
+
job_id: number; // The id of the job related to this revision (searchable, sortable)
|
|
52
|
+
revision: number; // The revision number (searchable, sortable)
|
|
53
|
+
language_code: string; // The language code of the revision (searchable, sortable)
|
|
54
|
+
mapstyle_set_id: number; // The id of the mapstyle set
|
|
55
|
+
archived: boolean; // Whether the revision has been generated (searchable, sortable)
|
|
56
|
+
output: FileFormat; // The output file type
|
|
57
|
+
} & ApiCommonData;
|
|
58
|
+
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
59
|
+
|
|
60
|
+
export type ApiJobRevisionData = Flatten<Exclude<ApiJobRevision, ApiError>['data']>;
|
|
61
|
+
|
|
62
|
+
export const jobRevisionRevivers: Revivers<ApiJobRevision, JobRevision> = {
|
|
63
|
+
archived: undefined,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export async function createJobRevision(
|
|
67
|
+
jobId: number,
|
|
68
|
+
languageCode: string,
|
|
69
|
+
mapstyleSetId: number,
|
|
70
|
+
layers: number[],
|
|
71
|
+
output: FileFormat,
|
|
72
|
+
jobObject: Record<string, unknown>,
|
|
73
|
+
skipValidation?: boolean
|
|
74
|
+
): Promise<JobRevision> {
|
|
75
|
+
const pathname = `/v1/jobs/${jobId}/revisions`;
|
|
76
|
+
const path = `${pathname}?${deletedNoneParam}`;
|
|
77
|
+
const body = {
|
|
78
|
+
language_code: languageCode,
|
|
79
|
+
mapstyle_set_id: mapstyleSetId,
|
|
80
|
+
object: JSON.stringify(jobObject),
|
|
81
|
+
output,
|
|
82
|
+
layers,
|
|
83
|
+
...skipValidation && { skip_validation: skipValidation },
|
|
84
|
+
};
|
|
85
|
+
const options = { revivers: jobRevisionRevivers };
|
|
86
|
+
|
|
87
|
+
return request<ApiJobRevision, JobRevision>(path, body, null, options);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export async function getJobRevision(jobId: number): Promise<JobRevision | undefined> {
|
|
91
|
+
const path = `/v1/jobs/${jobId}/revisions/${lastJobRevision}`;
|
|
92
|
+
const options = { revivers: jobRevisionRevivers };
|
|
93
|
+
|
|
94
|
+
return request<ApiJobRevision, JobRevision>(path, null, null, options).catch(() => undefined);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export async function getJobRevisionObject<JobObject>(jobId: number): Promise<JobObject> {
|
|
98
|
+
const pathname = `/v1/jobs/${jobId}/revisions/${lastJobRevision}/object`;
|
|
99
|
+
const path = `${pathname}?${deletedNoneParam}`;
|
|
100
|
+
|
|
101
|
+
return request<ApiCommon, string>(path).then(JSON.parse) as Promise<JobObject>;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export type JobCanBuild = {
|
|
105
|
+
canBuild: boolean;
|
|
106
|
+
paymentSource: string;
|
|
107
|
+
reason: string | null;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export type ApiJobCanBuild = {
|
|
111
|
+
data: {
|
|
112
|
+
can_build: boolean;
|
|
113
|
+
payment_source: string;
|
|
114
|
+
reason: string | null;
|
|
115
|
+
} & ApiCommonData;
|
|
116
|
+
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
117
|
+
|
|
118
|
+
// Also known as `canBuild()`
|
|
119
|
+
export async function getJobRevisionBuild(jobId: number): Promise<JobCanBuild> {
|
|
120
|
+
const pathname = `/v1/jobs/${jobId}/revisions/${lastJobRevision}/build`;
|
|
121
|
+
const path = `${pathname}?${deletedNoneParam}`;
|
|
122
|
+
|
|
123
|
+
return request<ApiJobCanBuild, JobCanBuild>(path);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export type JobRevisionBuild = {
|
|
127
|
+
jobRevisionId: number;
|
|
128
|
+
revision: number;
|
|
129
|
+
status: string;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export type ApiJobRevisionBuild = {
|
|
133
|
+
data: {
|
|
134
|
+
job_revision_id: number; // The id of the job revision
|
|
135
|
+
status: string; // The status of the job result (searchable, sortable)
|
|
136
|
+
subscription_id: number; // The id of the subscription that was active when the map was created
|
|
137
|
+
process_start: string; // The datetime when the job process started (searchable, sortable)
|
|
138
|
+
process_end: string; // The datetime when the job process ended (searchable, sortable)
|
|
139
|
+
last_downloaded: string; // The last time the archive was downloaded (searchable, sortable)
|
|
140
|
+
bought: boolean; // Checks if the result is bought or not (searchable, sortable)
|
|
141
|
+
revision: number; // The revision number of the job revision
|
|
142
|
+
job_revision: ApiJobRevisionData;
|
|
143
|
+
} & ApiCommonData;
|
|
144
|
+
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
145
|
+
|
|
146
|
+
export type ApiJobRevisionBuildData = Flatten<Exclude<ApiJobRevisionBuild, ApiError>['data']>;
|
|
147
|
+
|
|
148
|
+
export const jobRevisionBuildRevivers: Revivers<ApiJobRevisionBuild, JobRevisionBuild> = {
|
|
149
|
+
subscription_id: undefined,
|
|
150
|
+
process_start: undefined,
|
|
151
|
+
process_end: undefined,
|
|
152
|
+
last_downloaded: undefined,
|
|
153
|
+
bought: undefined,
|
|
154
|
+
job_revision: undefined,
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
export async function registerJobRevisionBuild(
|
|
158
|
+
jobId: number,
|
|
159
|
+
status: string,
|
|
160
|
+
start: Date,
|
|
161
|
+
end: Date,
|
|
162
|
+
): Promise<JobRevisionBuild> {
|
|
163
|
+
const pathname = `/v1/jobs/${jobId}/revisions/${lastJobRevision}/build/register`;
|
|
164
|
+
const path = `${pathname}?${deletedNoneParam}`;
|
|
165
|
+
const body = { status, process_start: start, process_end: end };
|
|
166
|
+
const options = { revivers: jobRevisionBuildRevivers };
|
|
167
|
+
|
|
168
|
+
return request<ApiJobRevisionBuild, JobRevisionBuild>(path, body, null, options);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export async function cloneJobRevision(jobId: number, newTitle?: string): Promise<JobRevision> {
|
|
172
|
+
const pathname = `/v1/jobs/${jobId}/revisions/${lastJobRevision}/clone`;
|
|
173
|
+
const path = `${pathname}?${deletedNoneParam}`;
|
|
174
|
+
const body = { title: newTitle ?? null };
|
|
175
|
+
const options = {
|
|
176
|
+
revivers: {
|
|
177
|
+
...jobRevisionRevivers,
|
|
178
|
+
layers: undefined,
|
|
179
|
+
language: undefined,
|
|
180
|
+
mapstyle_set: undefined,
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
type ApiJobRevisionWithData = {
|
|
185
|
+
data: ApiJobRevisionData & {
|
|
186
|
+
layers: ApiLayerData[];
|
|
187
|
+
language: ApiLanguageData;
|
|
188
|
+
mapstyle_set: ApiMapstyleSetData;
|
|
189
|
+
};
|
|
190
|
+
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
191
|
+
|
|
192
|
+
return request<ApiJobRevisionWithData, JobRevision>(path, body, null, options);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export async function listJobRevisionLayers(jobId: number): Promise<Layer[]> {
|
|
196
|
+
const path = `/v1/jobs/${jobId}/revisions/${lastJobRevision}/layers`;
|
|
197
|
+
const options = { revivers: layerRevivers };
|
|
198
|
+
|
|
199
|
+
type ApiLayerArray = {
|
|
200
|
+
data: ApiLayerData[];
|
|
201
|
+
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
202
|
+
|
|
203
|
+
return request<ApiLayerArray, Layer>(path, null, defaultListHeader, options);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export type JobRevisionOutputUrl = { url: string };
|
|
207
|
+
|
|
208
|
+
export type ApiJobRevisionOutputUrl = {
|
|
209
|
+
data: JobRevisionOutputUrl & ApiCommonData;
|
|
210
|
+
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
211
|
+
|
|
212
|
+
export async function getJobRevisionOutputUrl(jobId: number): Promise<JobRevisionOutputUrl> {
|
|
213
|
+
await createJobRevisionBuild(jobId);
|
|
214
|
+
|
|
215
|
+
const path = `/v1/jobs/${jobId}/revisions/${lastJobRevision}/result/output-url`;
|
|
216
|
+
|
|
217
|
+
return request<ApiJobRevisionOutputUrl, JobRevisionOutputUrl>(path);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export type JobRevisionOutput = { blob: Blob; filename?: string | undefined };
|
|
221
|
+
|
|
222
|
+
export async function getJobRevisionOutput(jobId: number): Promise<JobRevisionOutput> {
|
|
223
|
+
await createJobRevisionBuild(jobId);
|
|
224
|
+
|
|
225
|
+
const href = `${apiHost}/v1/jobs/${jobId}/revisions/${lastJobRevision}/result/output`;
|
|
226
|
+
const headers = getAuthorizationHeaders('GET');
|
|
227
|
+
const response = await fetch(href, { headers, ...!token && { credentials: 'include' } })
|
|
228
|
+
.catch((error: Error) => { throw new NetworkError(error?.message ?? error) });
|
|
229
|
+
|
|
230
|
+
if (response.ok) {
|
|
231
|
+
const blob = await response.blob().catch(() => {
|
|
232
|
+
throw new APIError({ success: false, error: { type: 'TypeError', message: 'Malformed Blob response' } });
|
|
233
|
+
});
|
|
234
|
+
const contentDisposition = response.headers.get('Content-Disposition');
|
|
235
|
+
|
|
236
|
+
if (contentDisposition) {
|
|
237
|
+
const filenameRegex = /filename\*\s*=\s*UTF-8''(.+)/i;
|
|
238
|
+
const filenameMatch = contentDisposition.match(filenameRegex);
|
|
239
|
+
|
|
240
|
+
if (filenameMatch?.[1]) {
|
|
241
|
+
return { blob, filename: filenameMatch[1] };
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
const fallbackRegex = /filename\s*=\s*"([^"]+)"/i;
|
|
245
|
+
const fallbackMatch = contentDisposition.match(fallbackRegex);
|
|
246
|
+
|
|
247
|
+
if (fallbackMatch?.[1]) {
|
|
248
|
+
return { blob, filename: fallbackMatch[1] };
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return { blob };
|
|
253
|
+
} else {
|
|
254
|
+
// eslint-disable-next-line default-case
|
|
255
|
+
switch (response.status) {
|
|
256
|
+
case 401:
|
|
257
|
+
await authenticate();
|
|
258
|
+
break; // NO-OP
|
|
259
|
+
case 403:
|
|
260
|
+
case 404:
|
|
261
|
+
case 406:
|
|
262
|
+
case 429:
|
|
263
|
+
throw new APIError(
|
|
264
|
+
(await response.json().catch(() => ({
|
|
265
|
+
success: false,
|
|
266
|
+
error: { type: 'HttpException', message: response.statusText },
|
|
267
|
+
}))) as ApiError,
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
throw new HTTPError(response);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
async function createJobRevisionBuild(jobId: number, skipValidation?: boolean): Promise<string> {
|
|
276
|
+
const pathname = `/v1/jobs/${jobId}/revisions/${lastJobRevision}/build`;
|
|
277
|
+
const path = `${pathname}?${deletedNoneParam}`;
|
|
278
|
+
const body = skipValidation ? { skip_validation: skipValidation } : null;
|
|
279
|
+
|
|
280
|
+
return request<ApiCommon, string>(path, body, null, { method: 'POST' });
|
|
281
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ApiCommon, type ApiCommonData, type ApiError, type ApiSuccess, type Flatten, request } from '../utils.js';
|
|
2
|
+
|
|
3
|
+
export type JobShareVisibility = 'private' | 'organisation' | 'public';
|
|
4
|
+
|
|
5
|
+
export type JobShare = {
|
|
6
|
+
id: number;
|
|
7
|
+
jobId: number;
|
|
8
|
+
visibility: JobShareVisibility;
|
|
9
|
+
hashKey: string;
|
|
10
|
+
apiUrl: string;
|
|
11
|
+
webUrl: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type ApiJobShare = {
|
|
15
|
+
data: {
|
|
16
|
+
id: number; // The id of the job share (sortable)
|
|
17
|
+
job_id: number; // The id of the job related to this share
|
|
18
|
+
visibility: string; // The visibility of the job share (searchable, sortable)
|
|
19
|
+
hash_key: string; // The hash key of the job share
|
|
20
|
+
apiUrl: string; // TODO: not present in API specification!
|
|
21
|
+
webUrl: string; // TODO: not present in API specification!
|
|
22
|
+
} & ApiCommonData;
|
|
23
|
+
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
24
|
+
|
|
25
|
+
export type ApiJobShareData = Flatten<Exclude<ApiJobShare, ApiError>['data']>;
|
|
26
|
+
|
|
27
|
+
export type ApiJobShareArray = {
|
|
28
|
+
data: ApiJobShareData[];
|
|
29
|
+
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
30
|
+
|
|
31
|
+
export async function deleteJobShare(jobShareId: number): Promise<Record<string, never>> {
|
|
32
|
+
const path = `/v1/jobs/shares/${jobShareId}`;
|
|
33
|
+
|
|
34
|
+
return request<ApiCommon, Record<string, never>>(path, null, null, { method: 'DELETE' });
|
|
35
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ApiCommonData, ApiError, ApiSuccess, Flatten, Revivers } from '../utils.js';
|
|
2
|
+
|
|
3
|
+
export type JobType = {
|
|
4
|
+
id: number;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export type ApiJobType = {
|
|
8
|
+
data: {
|
|
9
|
+
id: number; // The id of the job type (sortable)
|
|
10
|
+
name: string; // The name of the job type (searchable, sortable)
|
|
11
|
+
preview: string | null; // The preview file name of the job type
|
|
12
|
+
description: string | null; // The description of the job type (searchable, sortable)
|
|
13
|
+
components: string | null; // The components of the job type
|
|
14
|
+
order?: number; // TODO: not present in API specification!
|
|
15
|
+
} & ApiCommonData;
|
|
16
|
+
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
17
|
+
|
|
18
|
+
export type ApiJobTypeData = Flatten<Exclude<ApiJobType, ApiError>['data']>;
|
|
19
|
+
|
|
20
|
+
export const jobTypeRevivers: Revivers<ApiJobType, JobType> = {
|
|
21
|
+
name: undefined,
|
|
22
|
+
preview: undefined,
|
|
23
|
+
description: undefined,
|
|
24
|
+
components: undefined,
|
|
25
|
+
order: undefined,
|
|
26
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ApiCommonData, ApiError, ApiSuccess, Flatten } from '../utils.js';
|
|
2
|
+
|
|
3
|
+
export type Language = {
|
|
4
|
+
code: string;
|
|
5
|
+
name: string;
|
|
6
|
+
locale: string;
|
|
7
|
+
interface: boolean;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type ApiLanguage = {
|
|
11
|
+
data: {
|
|
12
|
+
code: string; // The language code
|
|
13
|
+
name: string; // The name of the language (searchable, sortable)
|
|
14
|
+
locale: string; // The locale string for the language (searchable, sortable)
|
|
15
|
+
interface: boolean; // If this language can be used for user interfaces
|
|
16
|
+
} & ApiCommonData;
|
|
17
|
+
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
18
|
+
|
|
19
|
+
export type ApiLanguageData = Flatten<Exclude<ApiLanguage, ApiError>['data']>;
|
package/src/api/layer.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ApiCommonData, ApiError, ApiSuccess, Flatten, Revivers } from '../utils.js';
|
|
2
|
+
|
|
3
|
+
export type Layer = {
|
|
4
|
+
id: number;
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
svg: string | null;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type ApiLayer = {
|
|
11
|
+
data: {
|
|
12
|
+
id: number; // The id of the layer (sortable)
|
|
13
|
+
name: string; // The name of the layer (searchable, sortable)
|
|
14
|
+
path: string; // The path to the layer
|
|
15
|
+
description: string; // The description of the layer (searchable, sortable)
|
|
16
|
+
image: string | null; // The image related to a layer
|
|
17
|
+
svg: string | null; // The svg related to a layer
|
|
18
|
+
scale_min: number; // The minimum scale for the layer (searchable, sortable)
|
|
19
|
+
scale_max: number; // The maximum scale for the layer (searchable, sortable)
|
|
20
|
+
pangaea_ready: boolean; // Whether a layer is prepared for Pangaea (searchable, sortable)
|
|
21
|
+
svg_set_id: number | null; // TODO: not present in API specification!
|
|
22
|
+
pivot: unknown; // TODO: not present in API specification!
|
|
23
|
+
order?: number; // TODO: not present in API specification!
|
|
24
|
+
} & ApiCommonData;
|
|
25
|
+
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
26
|
+
|
|
27
|
+
export type ApiLayerData = Flatten<Exclude<ApiLayer, ApiError>['data']>;
|
|
28
|
+
|
|
29
|
+
export const layerRevivers: Revivers<ApiLayer, Layer> = {
|
|
30
|
+
path: undefined,
|
|
31
|
+
image: undefined,
|
|
32
|
+
scale_min: undefined,
|
|
33
|
+
scale_max: undefined,
|
|
34
|
+
pangaea_ready: undefined,
|
|
35
|
+
svg_set_id: undefined,
|
|
36
|
+
pivot: undefined,
|
|
37
|
+
order: undefined,
|
|
38
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type ApiCommonData,
|
|
3
|
+
type ApiError,
|
|
4
|
+
type ApiSuccess,
|
|
5
|
+
type Flatten,
|
|
6
|
+
type Revivers,
|
|
7
|
+
defaultListHeader,
|
|
8
|
+
getSearchParams,
|
|
9
|
+
request,
|
|
10
|
+
} from '../utils.js';
|
|
11
|
+
|
|
12
|
+
export type LayerFaq = {
|
|
13
|
+
id: number;
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
mediaUrl: string;
|
|
17
|
+
readMoreUrl: string;
|
|
18
|
+
tags: string[];
|
|
19
|
+
layerId: number;
|
|
20
|
+
order?: number;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type ApiLayerFaq = {
|
|
24
|
+
data: {
|
|
25
|
+
id: number; // The id of the layer faq (sortable)
|
|
26
|
+
name: string; // The name of this layer faq (searchable, sortable)
|
|
27
|
+
description: string; // The description of the layer faq (searchable)
|
|
28
|
+
media_url: string; // The image for the faq (searchable)
|
|
29
|
+
read_more_url: string; // A link to a page with more information (searchable)
|
|
30
|
+
tags: string[]; // A list of tags to search in (searchable)
|
|
31
|
+
layer_id: number; // TODO: not present in API specification!
|
|
32
|
+
order?: number; // TODO: not present in API specification!
|
|
33
|
+
} & ApiCommonData;
|
|
34
|
+
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
35
|
+
|
|
36
|
+
export type ApiLayerFaqData = Flatten<Exclude<ApiLayerFaq, ApiError>['data']>;
|
|
37
|
+
|
|
38
|
+
export const layerFaqRevivers: Revivers<ApiLayerFaq, LayerFaq> = {
|
|
39
|
+
order: undefined,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export async function listLayerFaqs(): Promise<LayerFaq[]> {
|
|
43
|
+
const pathname = `/v1/layer-faqs`;
|
|
44
|
+
const query = getSearchParams({ sort: 'order,name' });
|
|
45
|
+
const path = `${pathname}?${query}`;
|
|
46
|
+
const options = { revivers: layerFaqRevivers };
|
|
47
|
+
|
|
48
|
+
type ApiLayerFaqArray = {
|
|
49
|
+
data: ApiLayerFaqData[];
|
|
50
|
+
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
51
|
+
|
|
52
|
+
return request<ApiLayerFaqArray, LayerFaq>(path, null, defaultListHeader, options);
|
|
53
|
+
}
|