diff --git a/.github/actions/init-npm/action.yaml b/.github/actions/init-npm/action.yaml new file mode 100644 index 0000000..76e1c89 --- /dev/null +++ b/.github/actions/init-npm/action.yaml @@ -0,0 +1,21 @@ +name: init-npm +description: 'Initialize the repo with npm and install all the dependencies' +inputs: + node-version: + description: 'Node.js version' + required: true + default: '20.x' +runs: + using: composite + steps: + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ inputs.node-version }} + cache: npm + - name: Install TS Project dependencies + shell: bash + run: npm ci + - name: build + shell: bash + run: npm run build diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml new file mode 100644 index 0000000..0cbcf8e --- /dev/null +++ b/.github/dependabot.yaml @@ -0,0 +1,53 @@ +# yaml-language-server: $schema=https://json.schemastore.org/dependabot-2.0.json +version: 2 +updates: + # deps + - package-ecosystem: npm + target-branch: 'master' + schedule: + interval: weekly + allow: + - dependency-type: production + directory: / + commit-message: + prefix: 'deps' + groups: + map-colonies: + patterns: + - '@map-colonies/*' + opentelemetry: + patterns: + - '@opentelemetry/*' + patch: + update-types: + - patch + # dev-deps + - package-ecosystem: npm + schedule: + interval: weekly + allow: + - dependency-type: development + directory: / + commit-message: + prefix: 'deps' + groups: + map-colonies: + patterns: + - '@map-colonies/*' + opentelemetry: + patterns: + - '@opentelemetry/*' + types: + patterns: + - '@types/*' + dev-patch: + update-types: + - patch + + # github deps + - package-ecosystem: github-actions + schedule: + interval: weekly + commit-message: + prefix: 'ci' + directory: '/' diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..d78b45e --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,22 @@ +name: publish + +on: + workflow_dispatch: + release: + types: [published] + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write # allow GITHUB_TOKEN to publish packages + steps: + - uses: actions/checkout@v4 + - name: Init nodejs + uses: ./.github/actions/init-npm + with: + node-version: 20.x + - uses: JS-DevTools/npm-publish@v3 + with: + token: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/publish_package.yml b/.github/workflows/publish_package.yml deleted file mode 100644 index 87aecb9..0000000 --- a/.github/workflows/publish_package.yml +++ /dev/null @@ -1,56 +0,0 @@ -on: - push: - branches: - - master - paths-ignore: - - '.github/**' - - '.gitignore' - - 'CHANGELOG.md' - - 'commitlint.config.js' - - 'tsbuildconfig.json' - - '.prettierrc.json' - - '.prettierignore' - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - name: Check out TS Project Git repository - uses: actions/checkout@v2 - - - name: Set up Node - uses: actions/setup-node@v1 - with: - node-version: 18 - - - name: Install Node.js dependencies - run: npm i - - - name: Run lint - run: npm run lint - - - name: Run format - run: npm run format - - - name: Build project - run: npm run build - - - name: setup git config - run: | - git config --global user.email "mapcolonies@gmail.com" - git config --global user.name "mapcolonies" - - - name: Bump new version - run: npm run release - - - name: Push git tag - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ github.ref }} - tags: true - - - name: Push to NPM - uses: JS-DevTools/npm-publish@v1 - with: - token: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml new file mode 100644 index 0000000..d4137b7 --- /dev/null +++ b/.github/workflows/pull-request.yaml @@ -0,0 +1,53 @@ +name: pull_request + +on: [pull_request, workflow_dispatch] + +jobs: + eslint: + name: Run TS Project eslint + runs-on: ubuntu-latest + + strategy: + matrix: + node: [20.x, 22.x] + + steps: + - name: Check out TS Project Git repository + uses: actions/checkout@v4 + + - name: Init nodejs + uses: ./.github/actions/init-npm + with: + node-version: ${{ matrix.node }} + + - name: Run TS Project linters + uses: wearerequired/lint-action@v2 + with: + github_token: ${{ secrets.github_token }} + # Enable linters + eslint: true + prettier: true + eslint_extensions: ts + + tests: + name: Run Tests + runs-on: ubuntu-latest + + strategy: + matrix: + node: [20.x, 22.x] + + steps: + - name: Check out TS Project Git repository + uses: actions/checkout@v4 + + - name: Init nodejs + uses: ./.github/actions/init-npm + + - name: Run tests + run: npm run test + + - uses: actions/upload-artifact@v4 + with: + name: Test Reporters ${{ matrix.node }} + path: ./reports/** diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml deleted file mode 100644 index c35752d..0000000 --- a/.github/workflows/pull_request.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: pull_request - -on: [pull_request] - -jobs: - tests: - name: Run Tests - runs-on: ubuntu-latest - strategy: - matrix: - node: [18.x] - - steps: - - name: Check out Git repository - uses: actions/checkout@v2 - - - name: Set up Node.js - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node }} - - - name: Install Node.js dependencies - run: npm ci - - - name: Run tests - run: npm run test - - - uses: actions/upload-artifact@v2 - with: - name: Test Reporters - path: reports/** - - eslint: - name: Run TS Project eslint - runs-on: ubuntu-latest - - steps: - - name: Check out TS Project Git repository - uses: actions/checkout@v2 - - - name: Set up Node.js - uses: actions/setup-node@v1 - with: - node-version: 18 - - - name: Install TS Project dependencies - run: npm install - - - name: Run TS Project linters - uses: wearerequired/lint-action@v1 - with: - github_token: ${{ secrets.github_token }} - # Enable linters - eslint: true - prettier: true - eslint_extensions: ts diff --git a/.github/workflows/release-on-tag-push.yaml b/.github/workflows/release-on-tag-push.yaml deleted file mode 100644 index 7983ef5..0000000 --- a/.github/workflows/release-on-tag-push.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: "Publish release on tag push" - -on: - push: - tags: - - "v*" - -jobs: - publish_release: - runs-on: ubuntu-latest - steps: - - name: Checkout code for CHANGELOG.md - uses: actions/checkout@v2 - - - name: Publish Release to Github - uses: softprops/action-gh-release@v1 - with: - body_path: CHANGELOG.md - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml new file mode 100644 index 0000000..ad5a653 --- /dev/null +++ b/.github/workflows/release-please.yaml @@ -0,0 +1,24 @@ +name: release-please + +on: + push: + branches: + - master + +permissions: + contents: write + pull-requests: write + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: google-github-actions/release-please-action@v4 + with: + # this assumes that you have created a personal access token + # (PAT) and configured it as a GitHub action secret named + # `MY_RELEASE_PLEASE_TOKEN` (this secret name is not important). + token: ${{ secrets.GH_PAT }} + # this is a built-in strategy in release-please, see "Action Inputs" + # for more options + release-type: node diff --git a/.github/workflows/typedoc.yaml b/.github/workflows/typedoc.yaml new file mode 100644 index 0000000..5b2bd6e --- /dev/null +++ b/.github/workflows/typedoc.yaml @@ -0,0 +1,52 @@ +# Simple workflow for deploying static content to GitHub Pages +name: Deploy typedoc to Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: ["master"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Single deploy job since we're just deploying + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + - name: Install TS Project dependencies + run: npm ci + - name: build docs + run: npx typedoc + - name: Setup Pages + uses: actions/configure-pages@v5 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + # Upload docs directory + path: './docs' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/package-lock.json b/package-lock.json index a5e462d..36e0635 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "1.3.4", "license": "ISC", "dependencies": { + "@types/geojson": "^7946.0.16", "@types/mime-types": "^2.1.1", "copyfiles": "^2.4.1", "epsg-index": "^1.3.0", @@ -1666,6 +1667,12 @@ "@babel/types": "^7.20.7" } }, + "node_modules/@types/geojson": { + "version": "7946.0.16", + "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.16.tgz", + "integrity": "sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==", + "license": "MIT" + }, "node_modules/@types/graceful-fs": { "version": "4.1.6", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.6.tgz", diff --git a/package.json b/package.json index 44011d9..d144884 100644 --- a/package.json +++ b/package.json @@ -68,6 +68,7 @@ "typescript": "^4.2.4" }, "dependencies": { + "@types/geojson": "^7946.0.16", "@types/mime-types": "^2.1.1", "copyfiles": "^2.4.1", "epsg-index": "^1.3.0", diff --git a/src/enums/common/metadata/productType.ts b/src/enums/common/metadata/productType.ts new file mode 100644 index 0000000..8327861 --- /dev/null +++ b/src/enums/common/metadata/productType.ts @@ -0,0 +1,20 @@ +export enum ProductType { + ORTHOPHOTO = 'Orthophoto', + ORTHOPHOTO_HISTORY = 'OrthophotoHistory', + ORTHOPHOTO_BEST = 'OrthophotoBest', + RASTER_MAP = 'RasterMap', + RASTER_MAP_BEST = 'RasterMapBest', + RASTER_AID = 'RasterAid', + RASTER_AID_BEST = 'RasterAidBest', + RASTER_VECTOR = 'RasterVector', + RASTER_VECTOR_BEST = 'RasterVectorBest', + VECTOR_BEST = 'VectorBest', + DTM = 'DTM', + DSM = 'DSM', + QUANTIZED_MESH_DTM = 'QuantizedMeshDTM', + QUANTIZED_MESH_DSM = 'QuantizedMeshDSM', + QUANTIZED_MESH_DTM_BEST = 'QuantizedMeshDTMBest', + QUANTIZED_MESH_DSM_BEST = 'QuantizedMeshDSMBest', + PHOTO_REALISTIC_3D = '3DPhotoRealistic', + POINT_CLOUD = 'PointCloud', +} diff --git a/src/enums/common/metadata/recordStatus.ts b/src/enums/common/metadata/recordStatus.ts new file mode 100644 index 0000000..b1afc6b --- /dev/null +++ b/src/enums/common/metadata/recordStatus.ts @@ -0,0 +1,4 @@ +export enum RecordStatus { + PUBLISHED = 'PUBLISHED', + UNPUBLISHED = 'UNPUBLISHED', +} diff --git a/src/enums/common/metadata/recordType.ts b/src/enums/common/metadata/recordType.ts new file mode 100644 index 0000000..c579405 --- /dev/null +++ b/src/enums/common/metadata/recordType.ts @@ -0,0 +1,6 @@ +export enum RecordType { + RECORD_RASTER = 'RECORD_RASTER', + RECORD_3D = 'RECORD_3D', + RECORD_DEM = 'RECORD_DEM', + RECORD_ALL = 'RECORD_ALL', +} diff --git a/src/index.ts b/src/index.ts index 3a622c4..eb4797e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,8 @@ export * from './enums/common/domain'; export * from './enums/common/artifact'; +export * from './enums/common/metadata/productType'; +export * from './enums/common/metadata/recordStatus'; +export * from './enums/common/metadata/recordType'; export * from './enums/geo/epsg'; export * from './helpers/mime'; +export * from './interfaces/common/metadata'; diff --git a/src/interfaces/common/metadata.ts b/src/interfaces/common/metadata.ts new file mode 100644 index 0000000..346b536 --- /dev/null +++ b/src/interfaces/common/metadata.ts @@ -0,0 +1,18 @@ +import { GeoJSON } from 'geojson'; +import { ProductType } from '../../enums/common/metadata/productType'; +import { RecordType } from '../../enums/common/metadata/recordType'; + +export interface IMetadataCommonModel { + // PROFILES COMMON FIELDS + type: RecordType; + classification: string; + productName: string; + description?: string; + srsName?: string; + producerName?: string; + sensors: string[]; + region: string[]; + footprint: GeoJSON; + productId: string; + productType: ProductType; +}