Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
362aa1a
fix: helm sync with boilerplate
vitaligi Mar 10, 2026
d7fa93e
build: add dependencies
vitaligi Mar 10, 2026
dbb0b3c
chore: define configurations
vitaligi Mar 10, 2026
d45b641
feat: implement info endpoint with minor api changes
vitaligi Mar 10, 2026
0887639
refactor: inject gdal-async into gdal file handler and other changes
vitaligi Mar 12, 2026
ca5f3df
fix: rename resolutionDegrees to resolutionDegree
vitaligi Mar 12, 2026
3d97721
refactor: pr comments
vitaligi Mar 12, 2026
8da9e91
refactor: stricter validation on srs name
vitaligi Mar 15, 2026
985298d
refactor: stricter validations on objects
vitaligi Mar 15, 2026
0bad12c
refactor: use static method to get srs
vitaligi Mar 15, 2026
0a578d3
fix: dataset var shadowing
vitaligi Mar 16, 2026
5f7c9fe
refactor: revert to support additional metadata records
vitaligi Mar 17, 2026
75d8e5f
feat: info validations (MAPCO-10133) (#23)
vitaligi Mar 26, 2026
f7f8a5c
build: move epsg-index to dependencies
vitaligi Mar 26, 2026
6c7c11a
refactor: pr comment improved log handler
vitaligi Mar 26, 2026
a89878f
chore: sync with boilerplate
vitaligi Mar 26, 2026
5257981
chore: sync with boilerplate
vitaligi Mar 26, 2026
14950b4
refactor: import types
vitaligi Mar 26, 2026
0de3c06
refactor: modify fileHandler interface to include handler name
vitaligi Mar 26, 2026
255cdfd
refactor: define error messages for validations
vitaligi Mar 26, 2026
9831a7b
refactor: add logs
vitaligi Mar 26, 2026
973860f
refactor: pr comments organize validations
vitaligi Mar 26, 2026
fd99b7f
chore: pr comment modify info response schema
vitaligi Mar 26, 2026
f0cc37a
fix: validate against configured format
vitaligi Mar 30, 2026
f3154b1
chore: remove unnecessary space in start:dev script
vitaligi Apr 6, 2026
3f9ff2f
fix: missing type
vitaligi Apr 6, 2026
4af957c
fix: correctly swap input and output coordinate order
vitaligi Apr 6, 2026
ecacf51
refactor: change overview count validation schema and remove pixel sc…
vitaligi Apr 6, 2026
c139da9
refactor: use custom error to throw 422 error
vitaligi Apr 13, 2026
729191c
build: add geographiclib-geodesic
vitaligi Apr 13, 2026
b20fc4c
build: update @map-colonies/schemas
vitaligi Apr 13, 2026
0764ce8
refactor: resolution calculation
vitaligi Apr 13, 2026
a02d22b
docs: add readme file
vitaligi Apr 13, 2026
a92bbec
test: setup test configurations and vitest and OpenAPI validation
vitaligi Apr 14, 2026
e08933b
test: remove boilerplate tests files
vitaligi Apr 14, 2026
3584c16
test: add info endpoint
vitaligi Apr 14, 2026
23b47e1
chore: set correct service name
vitaligi Apr 14, 2026
c641073
style: format and remove disable eslint rule
vitaligi Apr 14, 2026
60e58b5
test: fix test tmp dir location for ci
vitaligi Apr 14, 2026
a02622e
test: tmp dir setup and teardown
vitaligi Apr 14, 2026
3be9bea
test: organize imports in info
vitaligi Apr 14, 2026
2ff1d6c
test: remove unused boilerplate unit tests
vitaligi Apr 14, 2026
12112e1
refactor: move hasKey into utility module
vitaligi Apr 16, 2026
721f8d6
test: add unit tests for InfoManager functionality
vitaligi Apr 16, 2026
dbbb36c
test: add unit tests for GDALHandler functionality
vitaligi Apr 16, 2026
fb3e7e8
refactor: pr comment
vitaligi Apr 16, 2026
67492f0
chore: pr comment service description in package.json
vitaligi Apr 16, 2026
f0d2636
test: remove unnecessary todo
vitaligi Apr 16, 2026
91bc714
chore: rename chart references from ts-server-boilerplate to dem-gateway
vitaligi Apr 19, 2026
0237977
chore: update catalog-info.yaml
vitaligi Apr 19, 2026
2f5cff6
docs: remove todo
vitaligi Apr 19, 2026
5caa5f5
refactor: pr comment
vitaligi Apr 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Temp folder
tmp

# Logs
logs
*.log
Expand Down Expand Up @@ -111,3 +114,5 @@ dist
# Jest
jest_html_reporters.html
reports

config/local*.json
89 changes: 32 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,47 @@
# Map Colonies typescript service template

----------------------------------

This is a basic repo template for building new MapColonies web services in Typescript.

> [!IMPORTANT]
> To regenerate the types on openapi change run the command `npm run generate:openapi-types`.

> [!WARNING]
> After creating a new repo based on this template, you should delete the CODEOWNERS file.
# dem-gateway

Gateway for DEM resources manipulation

## Development
When in development you should use the command `npm run start:dev`. The main benefits are that it enables offline mode for the config package, and source map support for NodeJS errors.

### Template Features:

- eslint configuration by [@map-colonies/eslint-config](https://github.com/MapColonies/eslint-config)

- prettier configuration by [@map-colonies/prettier-config](https://github.com/MapColonies/prettier-config)

- jest

- .nvmrc

- Multi stage production-ready Dockerfile

- commitlint

- git hooks

- logging by [@map-colonies/js-logger](https://github.com/MapColonies/js-logger)

- OpenAPI request validation

- config load with [node-config](https://www.npmjs.com/package/node-config)

- Tracing and metrics by [@map-colonies/telemetry](https://github.com/MapColonies/telemetry)

- github templates

- bug report
When in development you should use the command `npm run start:dev`. The main benefits are that it enables offline mode for the config package, and source map support for NodeJS errors.

- feature request
### Adding a New Handler

- pull request
Before all, check if existing handlers can fulfill your need. For example, [`gdal handler`](src/info//fileHandlers/gdal.ts) can handle most of raster file formats.

- github actions
Add a new file handler under `src/info/fileHandlers`. The file should contain a class implementing the `FileHandler` interface.
Verify that OpenAPI spec supports the file format associated with the new handler. OpenAPI validates input file formats through a RegEx pattern.

- on pull_request
Add a new or record into the [default.json](config/default.json) under `application.supportedFormatsMap` in the form of:

- LGTM
```json
{
...
"application": {
...
"supportedFormatsMap": {
...
"formatName": "drivername"
},
...
}
}

- test
```
This configuration is used to map common format names into a given file handler internal name. For example, the gdal handler maps formats into gdal's internal driver name.

- lint
Finally, since DI is utilized a new record for the new handler should be added in [containerConfig.ts](src/containerConfig.ts):

- snyk
```javascript
const dependencies: InjectionObject<unknown>[] = [
...
{ token: 'FileHandler', provider: { useClass: NewHandler } }
];
```

## API

Checkout the OpenAPI spec [here](/openapi3.yaml)

## Installation
Expand All @@ -74,51 +57,43 @@ npm install
Clone the project

```bash

git clone https://link-to-project

```

Go to the project directory

```bash

cd my-project

```

Install dependencies

```bash

npm install

```

Start the server

```bash

npm run start

```

## Running Tests

To run tests, run the following command

```bash

npm run test

```

To only run unit tests:

```bash
npm run test:unit
```

To only run integration tests:

```bash
npm run test:integration
```
12 changes: 6 additions & 6 deletions catalog-info.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: ts-server-boilerplate
description: A boilerplate github repo for a REST API service in NodeJS for MapColonies
name: dem-gateway
description: Gateway for DEM resources manipulation
annotations:
github.com/project-slug: MapColonies/ts-server-boilerplate
github.com/project-slug: MapColonies/dem-gateway
tags:
- nodejs
- typescript
- expressjs
- boilerplate
- dem
spec:
type: service
lifecycle: production
owner: DevInfra
system: boilerplate
owner: DEM
system: dem-ingestion
34 changes: 32 additions & 2 deletions config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
},
"shared": {},
"logger": {
"level": "info",
"prettyPrint": false
"prettyPrint": false,
"opentelemetryOptions": {
"enabled": false
}
}
},
"server": {
Expand All @@ -29,5 +31,33 @@
"options": null
}
}
},
"storageExplorer": {
Comment thread
asafmas-rnd marked this conversation as resolved.
"sourceDir": "",
"displayNameDir": "layerSources",
"validFileExtensions": ["tif"]
},
"jobnik": {
"baseUrl": "http://localhost:3000"
},
"application": {
"validation": {
"blockSize": 256,
"compression": "LZW",
"resolutionDegree": { "min": 0.00000009060870470168063430786, "max": 0.08982 },
"resolutionMeter": { "min": 0.01, "max": 10000 },
"supportedSrsIds": [
4326, 32601, 32602, 32603, 32604, 32605, 32606, 32607, 32608, 32609, 32610, 32611, 32612, 32613, 32614, 32615, 32616, 32617, 32618, 32619,
32620, 32621, 32622, 32623, 32624, 32625, 32626, 32627, 32628, 32629, 32630, 32631, 32632, 32633, 32634, 32635, 32636, 32637, 32638, 32639,
32640, 32641, 32642, 32643, 32644, 32645, 32646, 32647, 32648, 32649, 32650, 32651, 32652, 32653, 32654, 32655, 32656, 32657, 32658, 32659,
32660, 32701, 32702, 32703, 32704, 32705, 32706, 32707, 32708, 32709, 32710, 32711, 32712, 32713, 32714, 32715, 32716, 32717, 32718, 32719,
32720, 32721, 32722, 32723, 32724, 32725, 32726, 32727, 32728, 32729, 32730, 32731, 32732, 32733, 32734, 32735, 32736, 32737, 32738, 32739,
32740, 32741, 32742, 32743, 32744, 32745, 32746, 32747, 32748, 32749, 32750, 32751, 32752, 32753, 32754, 32755, 32756, 32757, 32758, 32759,
32760
]
},
"supportedFormatsMap": {
"geotiff": "gtiff"
}
}
}
6 changes: 5 additions & 1 deletion config/test.json
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
{}
{
"storageExplorer": {
"sourceDir": "/"
}
}
4 changes: 2 additions & 2 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: ts-server-boilerplate
description: A Helm chart for ts-server-boilerplate service
name: dem-gateway
description: A Helm chart for dem-gateway service
type: application
version: 1.0.0
appVersion: 1.0.0
Expand Down
28 changes: 14 additions & 14 deletions helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "ts-server-boilerplate.name" -}}
{{- define "dem-gateway.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

Expand All @@ -10,7 +10,7 @@ Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "ts-server-boilerplate.fullname" -}}
{{- define "dem-gateway.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
Expand All @@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name.
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "ts-server-boilerplate.chart" -}}
{{- define "dem-gateway.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "ts-server-boilerplate.labels" -}}
helm.sh/chart: {{ include "ts-server-boilerplate.chart" . }}
{{ include "ts-server-boilerplate.selectorLabels" . }}
{{- define "dem-gateway.labels" -}}
helm.sh/chart: {{ include "dem-gateway.chart" . }}
{{ include "dem-gateway.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
Expand All @@ -46,23 +46,23 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
{{/*
Returns the tag of the chart.
*/}}
{{- define "ts-server-boilerplate.tag" -}}
{{- define "dem-gateway.tag" -}}
{{- default (printf "v%s" .Chart.AppVersion) .Values.image.tag }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "ts-server-boilerplate.selectorLabels" -}}
app.kubernetes.io/name: {{ include "ts-server-boilerplate.name" . }}
{{- define "dem-gateway.selectorLabels" -}}
app.kubernetes.io/name: {{ include "dem-gateway.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{ include "mclabels.selectorLabels" . }}
{{- end }}

{{/*
Returns the cloud provider name from global if exists or from the chart's values, defaults to minikube
*/}}
{{- define "ts-server-boilerplate.cloudProviderFlavor" -}}
{{- define "dem-gateway.cloudProviderFlavor" -}}
{{- if .Values.global.cloudProvider.flavor }}
{{- .Values.global.cloudProvider.flavor -}}
{{- else if .Values.cloudProvider -}}
Expand All @@ -75,7 +75,7 @@ Returns the cloud provider name from global if exists or from the chart's values
{{/*
Returns the cloud provider docker registry url from global if exists or from the chart's values
*/}}
{{- define "ts-server-boilerplate.cloudProviderDockerRegistryUrl" -}}
{{- define "dem-gateway.cloudProviderDockerRegistryUrl" -}}
{{- if .Values.global.cloudProvider.dockerRegistryUrl }}
{{- printf "%s/" .Values.global.cloudProvider.dockerRegistryUrl -}}
{{- else if .Values.cloudProvider.dockerRegistryUrl -}}
Expand All @@ -87,7 +87,7 @@ Returns the cloud provider docker registry url from global if exists or from the
{{/*
Returns the cloud provider image pull secret name from global if exists or from the chart's values
*/}}
{{- define "ts-server-boilerplate.cloudProviderImagePullSecretName" -}}
{{- define "dem-gateway.cloudProviderImagePullSecretName" -}}
{{- if .Values.global.cloudProvider.imagePullSecretName }}
{{- .Values.global.cloudProvider.imagePullSecretName -}}
{{- else if .Values.cloudProvider.imagePullSecretName -}}
Expand All @@ -98,7 +98,7 @@ Returns the cloud provider image pull secret name from global if exists or from
{{/*
Returns the tracing url from global if exists or from the chart's values
*/}}
{{- define "ts-server-boilerplate.tracingUrl" -}}
{{- define "dem-gateway.tracingUrl" -}}
{{- if .Values.global.tracing.url }}
{{- .Values.global.tracing.url -}}
{{- else if .Values.cloudProvider -}}
Expand All @@ -109,7 +109,7 @@ Returns the tracing url from global if exists or from the chart's values
{{/*
Returns the tracing url from global if exists or from the chart's values
*/}}
{{- define "ts-server-boilerplate.metricsUrl" -}}
{{- define "dem-gateway.metricsUrl" -}}
{{- if .Values.global.metrics.url }}
{{- .Values.global.metrics.url -}}
{{- else -}}
Expand Down
6 changes: 3 additions & 3 deletions helm/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{- $tracingUrl := include "ts-server-boilerplate.tracingUrl" . -}}
{{- $metricsUrl := include "ts-server-boilerplate.metricsUrl" . -}}
{{- $tracingUrl := include "dem-gateway.tracingUrl" . -}}
{{- $metricsUrl := include "dem-gateway.metricsUrl" . -}}
{{- if .Values.enabled -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-configmap" (include "ts-server-boilerplate.fullname" .) }}
name: {{ printf "%s-configmap" (include "dem-gateway.fullname" .) }}
data:
REQUEST_PAYLOAD_LIMIT: {{ .Values.env.requestPayloadLimit | quote }}
RESPONSE_COMPRESSION_ENABLED: {{ .Values.env.responseCompressionEnabled | quote }}
Expand Down
Loading
Loading