@gisatcz/ptr-be-core 0.0.1-dev.1 → 0.0.1-dev.3

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.
Files changed (39) hide show
  1. package/Readme.md +18 -26
  2. package/dist/index.cjs +120 -26252
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.ts +10 -11
  5. package/dist/index.mjs +118 -26253
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/src/api/errors.api.d.ts +18 -0
  8. package/dist/src/api/models.api.d.ts +9 -0
  9. package/dist/src/coding/code.formating.d.ts +0 -1
  10. package/dist/src/coding/code.types.d.ts +1 -2
  11. package/dist/src/logging/logger.d.ts +0 -1
  12. package/dist/src/panther/enums.panther.d.ts +3 -3
  13. package/dist/src/panther/models.edges.d.ts +0 -1
  14. package/dist/src/panther/models.nodes.d.ts +18 -7
  15. package/dist/src/panther/models.nodes.properties.d.ts +41 -3
  16. package/package.json +22 -12
  17. package/.github/workflows/release-dev.yml +0 -34
  18. package/.github/workflows/release.yml +0 -28
  19. package/.github/workflows/version-bump.yml +0 -68
  20. package/barrelsby.json +0 -9
  21. package/dist/index.d.ts.map +0 -1
  22. package/dist/src/coding/code.formating.d.ts.map +0 -1
  23. package/dist/src/coding/code.types.d.ts.map +0 -1
  24. package/dist/src/logging/logger.d.ts.map +0 -1
  25. package/dist/src/panther/enums.panther.d.ts.map +0 -1
  26. package/dist/src/panther/models.edges.d.ts.map +0 -1
  27. package/dist/src/panther/models.nodes.d.ts.map +0 -1
  28. package/dist/src/panther/models.nodes.properties.d.ts.map +0 -1
  29. package/doc/npm-refresh.md +0 -4
  30. package/rollup.config.js +0 -30
  31. package/src/coding/code.formating.ts +0 -104
  32. package/src/coding/code.types.ts +0 -11
  33. package/src/logging/logger.ts +0 -58
  34. package/src/panther/SharedFeature.md +0 -43
  35. package/src/panther/enums.panther.ts +0 -41
  36. package/src/panther/models.edges.ts +0 -20
  37. package/src/panther/models.nodes.properties.ts +0 -31
  38. package/src/panther/models.nodes.ts +0 -55
  39. package/tsconfig.json +0 -51
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Extract message from exception error (try-catch)
3
+ * @param error error from catch block as any
4
+ * @returns
5
+ */
6
+ export declare const messageFromError: (error: any) => string;
7
+ /**
8
+ * We miss a API parameter needed to process action
9
+ */
10
+ export declare class InvalidRequestError extends Error {
11
+ constructor(message: string);
12
+ }
13
+ /**
14
+ * Where client has general authorization issue
15
+ */
16
+ export declare class AuthorizationError extends Error {
17
+ constructor();
18
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Universal API model as resource for endpoint response with body and headers
3
+ * Generic type T is type of body
4
+ * Headers can be null
5
+ */
6
+ export interface ApiEndpointResponse<T> {
7
+ intoBody: T;
8
+ intoHeaders: Record<string, any> | null;
9
+ }
@@ -74,4 +74,3 @@ export declare const randomNumberBetween: (min: number, max: number) => number;
74
74
  * ```
75
75
  */
76
76
  export declare const flattenObject: (obj: any, prefix?: string) => Record<string, any>;
77
- //# sourceMappingURL=code.formating.d.ts.map
@@ -2,5 +2,4 @@ type Nullable<T> = T | null;
2
2
  type Unsure<T> = T | undefined;
3
3
  type Nullish<T> = T | undefined | null;
4
4
  type UsurePromise<T> = Unsure<Promise<T>>;
5
- export { Nullable, Nullish, Unsure, UsurePromise };
6
- //# sourceMappingURL=code.types.d.ts.map
5
+ export type { Nullable, Nullish, Unsure, UsurePromise };
@@ -13,4 +13,3 @@ export declare class AppLogger {
13
13
  static error(message: string, options?: AppLogOptions): void;
14
14
  static appStart(host: string, port: number, options?: AppLogOptions): void;
15
15
  }
16
- //# sourceMappingURL=logger.d.ts.map
@@ -10,7 +10,8 @@ export declare enum UsedNodeLabels {
10
10
  AreaTreeLevel = "areaTreeLevel",// Area tree level node for administrative division
11
11
  Layer = "layer",// Layer node for map layer (layer have a style and a datasource)
12
12
  Style = "style",// Style node for map layer or a feature
13
- Feature = "feature"
13
+ Feature = "feature",// Feature node for map layer,
14
+ Attribute = "attribute"
14
15
  }
15
16
  /**
16
17
  * What datasources we use in the system
@@ -19,7 +20,7 @@ export declare enum UsedDatasourceLabels {
19
20
  Attribute = "attribute",// Column(s) with attribute values
20
21
  Geojson = "geojson",// Geojson for web map
21
22
  WMS = "wms",// WMS online source
22
- COG = "cogBitmap",// COG online source
23
+ COG = "cloudOptimizedGeotiff",// COG online source
23
24
  MVT = "mvt",// MVT (Mapbox Vector Tiles) source
24
25
  XYZ = "xyz",// XYZ tile source
25
26
  CSV = "csv",// CSV data source
@@ -37,4 +38,3 @@ export declare enum UsedEdgeLabels {
37
38
  RelatedTo = "RELATED",// Generic edge for any relation
38
39
  Has = "HAS"
39
40
  }
40
- //# sourceMappingURL=enums.panther.d.ts.map
@@ -15,4 +15,3 @@ export interface GraphEdge {
15
15
  edgeNodes: GraphRelation;
16
16
  properties: Nullable<object>;
17
17
  }
18
- //# sourceMappingURL=models.edges.d.ts.map
@@ -1,6 +1,6 @@
1
- import { Nullable } from "../coding/code.types";
2
- import { HasGeometry, HasInterval, HasLevels, HasConfiguration } from "./models.nodes.properties";
1
+ import { HasGeometry, HasInterval, HasLevels, HasConfiguration, HasUrl, HasBands, HasSpecificName, HasColor, HasUnits } from "./models.nodes.properties";
3
2
  import { UsedNodeLabels, UsedDatasourceLabels } from "./enums.panther";
3
+ import { Nullable } from "../coding/code.types";
4
4
  /**
5
5
  * General graph node - same for all metadatata entities
6
6
  */
@@ -12,6 +12,8 @@ export interface PantherEntity {
12
12
  description: Nullable<string>;
13
13
  lastUpdatedAt: number;
14
14
  }
15
+ export interface MapStyle extends PantherEntity, Partial<HasSpecificName> {
16
+ }
15
17
  /**
16
18
  * Place node - somewhere in the world
17
19
  */
@@ -30,14 +32,19 @@ export interface AreaTreeLevel extends PantherEntity, HasLevels {
30
32
  /**
31
33
  * Datasource with source configuration
32
34
  */
33
- export interface Datasource extends PantherEntity, HasConfiguration {
35
+ export interface Datasource extends PantherEntity, Partial<HasConfiguration & HasUrl & HasBands> {
34
36
  }
35
37
  /**
36
38
  * Application node - main entity in metadata model
37
39
  */
38
- export interface ApplicationNode extends PantherEntity, HasConfiguration {
40
+ export interface ApplicationNode extends PantherEntity, Partial<HasConfiguration> {
41
+ }
42
+ /**
43
+ * Attribute node - describes a property of an entity
44
+ * Like "temperature", "humidity", "population", etc.
45
+ */
46
+ export interface Attribute extends PantherEntity, Partial<HasColor & HasUnits> {
39
47
  }
40
- export { UsedNodeLabels, HasInterval, UsedDatasourceLabels };
41
48
  /**
42
49
  * Represents a full panther entity which extends the basic PantherEntity
43
50
  * and optionally includes geometry, interval, levels, and configuration properties.
@@ -47,7 +54,11 @@ export { UsedNodeLabels, HasInterval, UsedDatasourceLabels };
47
54
  * @extends Partial<HasInterval>
48
55
  * @extends Partial<HasLevels>
49
56
  * @extends Partial<HasConfiguration>
57
+ * @extends Partial<HasUrl>
58
+ * @extends Partial<HasBands>
59
+ * @extends Partial<HasSpecificName>
60
+ * @extends Partial<HasColor>
61
+ * @extends Partial<HasUnits>
50
62
  */
51
- export interface FullPantherEntity extends PantherEntity, Partial<HasGeometry & HasInterval & HasLevels & HasConfiguration> {
63
+ export interface FullPantherEntity extends PantherEntity, Partial<HasGeometry & HasInterval & HasLevels & HasConfiguration & HasUrl & HasBands & HasSpecificName & HasColor & HasUnits> {
52
64
  }
53
- //# sourceMappingURL=models.nodes.d.ts.map
@@ -3,7 +3,7 @@
3
3
  * Example: Period is connected to some time range.
4
4
  */
5
5
  export interface HasInterval {
6
- validUtcIntervalIso: string;
6
+ validIntervalIso: string;
7
7
  validFrom: number;
8
8
  validTo: number;
9
9
  }
@@ -18,7 +18,18 @@ export interface HasConfiguration {
18
18
  */
19
19
  export interface HasGeometry {
20
20
  geometry: any;
21
- bbox: any;
21
+ bbox: number[];
22
+ }
23
+ /**
24
+ * Entity that has bands, e.g. satellite imagery
25
+ * Bands have CSV format - order of values is important.
26
+ * Bands are used to represent different spectral bands in satellite imagery.
27
+ * Each band can have a name and a period (e.g., wavelength).
28
+ */
29
+ export interface HasBands {
30
+ bands: number[];
31
+ bandNames: string[];
32
+ bandPeriods: string[];
22
33
  }
23
34
  /**
24
35
  * Place node - somewhere in the world
@@ -26,4 +37,31 @@ export interface HasGeometry {
26
37
  export interface HasLevels {
27
38
  level: number;
28
39
  }
29
- //# sourceMappingURL=models.nodes.properties.d.ts.map
40
+ /**
41
+ * Entity that has a URL, e.g. a link to a resource or a service.
42
+ * This is used for entities that can be accessed via a URL.
43
+ */
44
+ export interface HasUrl {
45
+ url: string;
46
+ }
47
+ /**
48
+ * Entity that has a specific name, e.g. a unique identifier or a specific title.
49
+ * This is used for entities that need to be identified by a specific name.
50
+ */
51
+ export interface HasSpecificName {
52
+ specificName: string;
53
+ }
54
+ /**
55
+ * Represents an entity that has a color property.
56
+ * The color is defined as a hexadecimal color code.
57
+ */
58
+ export interface HasColor {
59
+ color: string;
60
+ }
61
+ /**
62
+ * Represents an entity that has a unit of measurement.
63
+ */
64
+ export interface HasUnits {
65
+ unit: string;
66
+ valueType: 'string' | 'number' | 'boolean' | 'date' | 'json';
67
+ }
package/package.json CHANGED
@@ -1,27 +1,34 @@
1
1
  {
2
2
  "name": "@gisatcz/ptr-be-core",
3
- "version": "0.0.1-dev.1",
4
- "description": "Testing the core",
5
- "main": "dist/index.cjs",
6
- "module": "dist/index.mjs",
7
- "types": "dist/index.d.ts",
3
+ "version": "0.0.1-dev.3",
4
+ "description": "Shared core library for PTR BE services",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.mjs",
8
+ "types": "./dist/index.d.ts",
9
+ "files": [
10
+ "dist/"
11
+ ],
8
12
  "exports": {
9
13
  ".": {
14
+ "types": "./dist/index.d.ts",
10
15
  "import": "./dist/index.mjs",
11
16
  "require": "./dist/index.cjs",
12
- "types": "./dist/index.d.ts"
17
+ "default": "./dist/index.mjs"
13
18
  }
14
19
  },
15
20
  "scripts": {
21
+ "yalc:publish": "yalc publish",
22
+ "yalc:publish:push": "yalc publish --push",
16
23
  "build:clean": "rm -rf dist .rollup.cache tsconfig.tsbuildinfo",
17
- "build:barrels": "barrelsby -c barrelsby.json",
18
- "build:rollup": "rollup -c",
19
- "build": "npm run build:clean && npm run build:barrels && npm run build:rollup"
24
+ "dev": "npm run build:clean && rollup --config --watch",
25
+ "build": "npm run build:clean && rollup --config",
26
+ "test": "vitest --config vitest.config.ts",
27
+ "pack:check": "npm pack --dry-run"
20
28
  },
21
29
  "author": "",
22
30
  "license": "ISC",
23
31
  "peerDependencies": {
24
- "lodash": "^4.17.21",
25
32
  "luxon": "^3.6.1",
26
33
  "pino": "^9.6.0",
27
34
  "pino-pretty": "^13.0.0"
@@ -31,16 +38,19 @@
31
38
  "@rollup/plugin-json": "^6.1.0",
32
39
  "@rollup/plugin-node-resolve": "^16.0.1",
33
40
  "@rollup/plugin-typescript": "^12.1.2",
34
- "@types/lodash": "^4.17.16",
35
41
  "@types/luxon": "^3.6.2",
36
42
  "@types/node": "^22.15.12",
37
43
  "barrelsby": "^2.8.1",
38
44
  "rollup": "^4.40.2",
45
+ "rollup-plugin-dts": "^6.2.3",
39
46
  "ts-node": "^10.9.2",
40
47
  "tsc-alias": "^1.8.16",
41
48
  "tsconfig-paths": "^4.2.0",
42
49
  "tslib": "^2.8.1",
43
50
  "tsx": "^4.19.4",
44
- "typescript": "^5.8.3"
51
+ "typescript": "^5.9.3",
52
+ "vite": "^6.2.5",
53
+ "vite-tsconfig-paths": "^5.1.4",
54
+ "vitest": "^3.1.1"
45
55
  }
46
56
  }
@@ -1,34 +0,0 @@
1
- name: Build & Publish NPM Package - DEV
2
- description: This workflow builds and publishes the NPM package when a version tag is pushed.
3
-
4
- on:
5
- push:
6
- tags:
7
- - 'v[0-9]+.[0-9]+.[0-9]+-dev.[0-9]+'
8
-
9
- jobs:
10
- build-and-publish:
11
- runs-on: ubuntu-latest
12
-
13
- steps:
14
- - name: Check out repository
15
- uses: actions/checkout@v4
16
-
17
- - name: Setup Node.js environment
18
- uses: actions/setup-node@v4 # Latest version to set up Node.js
19
- with:
20
- node-version: 'lts/*' # Use the latest LTS version of Node.js
21
- registry-url: 'https://registry.npmjs.org/' # Important: Specify the npm registry
22
-
23
- - name: Install dependencies
24
- run: npm install
25
-
26
- - name: Build package
27
- run: npm run build
28
-
29
- - name: Publish to npm
30
- env:
31
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
32
- run: |
33
- # for public packages, include --access public
34
- npm publish --access public --tag dev
@@ -1,28 +0,0 @@
1
- name: Build & Publish NPM Package
2
- description: This workflow builds and publishes the NPM package when a version tag is pushed.
3
-
4
- on:
5
- push:
6
- tags:
7
- - 'v[0-9]+.[0-9]+.[0-9]+'
8
-
9
- jobs:
10
- build-and-publish:
11
- runs-on: ubuntu-latest
12
-
13
- steps:
14
- - name: Check out repository
15
- uses: actions/checkout@v4
16
-
17
- - name: Install dependencies
18
- run: npm install
19
-
20
- - name: Build package
21
- run: npm run build
22
-
23
- - name: Publish to npm
24
- env:
25
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
26
- run: |
27
- # for public packages, include --access public
28
- npm publish --access public
@@ -1,68 +0,0 @@
1
- name: Version bump
2
- description: This workflow bumps the version in package.json and creates a new version tag.
3
-
4
- on:
5
- push:
6
- branches:
7
- - master
8
- - main
9
- - rc
10
- - dev
11
-
12
- jobs:
13
- create-version-tag:
14
- if: ${{ !contains(github.event.head_commit.message, '#skip_next_version') }}
15
- runs-on: ubuntu-latest
16
-
17
- permissions:
18
- contents: write
19
-
20
- steps:
21
- - name: Checkout
22
- uses: actions/checkout@v4.2.2
23
- with:
24
- token: ${{ secrets.GH_TOKEN }}
25
- ref: ${{ github.head_ref }}
26
- fetch-depth: 0
27
-
28
- - name: Set ENVs
29
- run: |
30
- echo "PRERELEASE_SUFFIX=${{ github.head_ref || github.ref_name }}" >> "$GITHUB_ENV"
31
- if [[ "${{ github.head_ref || github.ref_name }}" == "dev" ]]; then echo "PRERELEASE=true" >> "$GITHUB_ENV"; fi
32
- if [[ "${{ github.head_ref || github.ref_name }}" == "rc" ]]; then echo "PRERELEASE=true" >> "$GITHUB_ENV"; fi
33
- if [[ "${{ github.head_ref || github.ref_name }}" == "master" ]]; then echo "PRERELEASE=false" >> "$GITHUB_ENV"; fi
34
- if [[ "${{ github.head_ref || github.ref_name }}" == "main" ]]; then echo "PRERELEASE=false" >> "$GITHUB_ENV"; fi
35
-
36
- - name: Get next version
37
- id: next-version
38
- uses: anothrNick/github-tag-action@1.71.0
39
- env:
40
- GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
41
- WITH_V: true
42
- PRERELEASE: ${{ env.PRERELEASE }}
43
- PRERELEASE_SUFFIX: ${{ env.PRERELEASE_SUFFIX }}
44
- DEFAULT_BUMP: patch
45
- DRY_RUN: true
46
-
47
- - name: Update version in package.json
48
- run: |
49
- sudo chown -R "$(id -u):$(id -g)" .git
50
- git config --local user.email "panterobot@gisat.cz"
51
- git config --local user.name "github-actions[bot]"
52
- npm version ${{ steps.next-version.outputs.new_tag }} -m "Set package.json version to ${{ steps.next-version.outputs.new_tag }} #skip_next_version"
53
-
54
- - name: Push changes
55
- uses: ad-m/github-push-action@v0.8.0
56
- with:
57
- github_token: ${{ secrets.GH_TOKEN }}
58
- branch: ${{ github.ref }}
59
-
60
- - name: Create version tag
61
- uses: anothrNick/github-tag-action@1.71.0
62
- env:
63
- GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
64
- WITH_V: true
65
- PRERELEASE: ${{ env.PRERELEASE }}
66
- PRERELEASE_SUFFIX: ${{ env.PRERELEASE_SUFFIX }}
67
- DEFAULT_BUMP: patch
68
- DRY_RUN: false
package/barrelsby.json DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "directory": ".",
3
- "exclude": ["node_modules", "dist", "coverage", "test", "tests", "spec", "specs"],
4
- "delete": true,
5
- "location": "top",
6
- "barrelName": "index.ts",
7
- "verbose": true
8
- }
9
-
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uCAAuC,CAAC;AACtD,cAAc,4BAA4B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"code.formating.d.ts","sourceRoot":"","sources":["../../../src/coding/code.formating.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,GAAG,EAAE,YAAY,GAAG,YAGjD,CAAA;AAEH;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM,EAAE,aAAqB,CAAA;AAEvE;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,GAAI,KAAK,GAAG,EAAE,UAAsB,CAAA;AAE3E;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM,YAAiB,CAAA;AAG7D;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,GAAG,EAAE,kBAAgB,WAA4C,CAAA;AAE9G;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,GAAI,WAAW,GAAG,EAAE,EAAE,kBAAgB,WAAuF,CAAA;AAEnK;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,UAAU,GAAG,KAAgC,MAAM,EAAE,CAAA;AAEvF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,KAAK,MAAM,EAAE,KAAK,MAAM,WAI3D,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,aAAa,GAAI,KAAK,GAAG,EAAE,eAAW,KAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAUvE,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"code.types.d.ts","sourceRoot":"","sources":["../../../src/coding/code.types.ts"],"names":[],"mappings":"AAAA,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;AAC3B,KAAK,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,CAAA;AAC9B,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,GAAG,IAAI,CAAA;AACtC,KAAK,YAAY,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAA;AAEzC,OAAO,EACH,QAAQ,EACR,OAAO,EACP,MAAM,EACN,YAAY,EACf,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/logging/logger.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAC,MAAM,GAAC,OAAO,CAAA;CACrC,CAAA;AAgBD,qBAAa,SAAS;IACpB,MAAM,CAAC,IAAI,CACT,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,aAAmC;IAK9C,MAAM,CAAC,IAAI,CACT,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,aAAmC;IAK9C,MAAM,CAAC,KAAK,CACV,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,aAAmC;IAK9C,MAAM,CAAC,QAAQ,CACb,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,aAAmC;CAI/C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"enums.panther.d.ts","sourceRoot":"","sources":["../../../src/panther/enums.panther.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,cAAc;IACtB,WAAW,gBAAgB,CAAE,4CAA4C;IACzE,UAAU,eAAe,CAAE,qDAAqD;IAChF,KAAK,UAAU,CAAE,0CAA0C;IAC3D,MAAM,WAAW,CAAE,mCAAmC;IACtD,QAAQ,aAAa,CAAE,6CAA6C;IACpE,aAAa,kBAAkB,CAAE,mDAAmD;IACpF,KAAK,UAAU,CAAE,iEAAiE;IAClF,KAAK,UAAU,CAAE,wCAAwC;IACzD,OAAO,YAAY;CACtB;AAED;;GAEG;AACH,oBAAY,oBAAoB;IAC5B,SAAS,cAAc,CAAI,kCAAkC;IAC7D,OAAO,YAAY,CAAO,sBAAsB;IAChD,GAAG,QAAQ,CAAe,oBAAoB;IAC9C,GAAG,cAAc,CAAS,oBAAoB;IAC9C,GAAG,QAAQ,CAAe,mCAAmC;IAC7D,GAAG,QAAQ,CAAe,kBAAkB;IAC5C,GAAG,QAAQ,CAAe,kBAAkB;IAC5C,OAAO,YAAY,CAAO,sBAAsB;IAChD,SAAS,cAAc,CAAI,wBAAwB;IACnD,OAAO,YAAY,CAAO,0BAA0B;IACpD,IAAI,SAAS,CAAa,uBAAuB;IACjD,GAAG,QAAQ,CAAe,sBAAsB;IAChD,UAAU,eAAe;CAC5B;AAED;;GAEG;AACH,oBAAY,cAAc;IACtB,SAAS,YAAY,CAAE,gCAAgC;IACvD,GAAG,QAAQ;CACd"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"models.edges.d.ts","sourceRoot":"","sources":["../../../src/panther/models.edges.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAEhD;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAG5C;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACtB,MAAM,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,CAAC;IACpC,SAAS,EAAE,aAAa,CAAA;IACxB,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;CAC/B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"models.nodes.d.ts","sourceRoot":"","sources":["../../../src/panther/models.nodes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AACjG,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAEtE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,cAAc,GAAG,oBAAoB,CAAC,CAAC;IAC9D,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,KAAM,SAAQ,aAAa,EAAE,WAAW;CAAI;AAE7D;;GAEG;AACH,MAAM,WAAW,MAAO,SAAQ,aAAa,EAAE,WAAW;CAAI;AAE9D;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,aAAa,EAAE,SAAS;CAAG;AAElE;;GAEG;AACH,MAAM,WAAW,UAAW,SAAQ,aAAa,EAAE,gBAAgB;CAAG;AAEtE;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,aAAa,EAAE,gBAAgB;CAAG;AAE3E,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,oBAAoB,EAAE,CAAA;AAG5D;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAkB,SAAQ,aAAa,EAAE,OAAO,CAAC,WAAW,GAAG,WAAW,GAAG,SAAS,GAAG,gBAAgB,CAAC;CAAI"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"models.nodes.properties.d.ts","sourceRoot":"","sources":["../../../src/panther/models.nodes.properties.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,WAAW;IACxB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAA;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,aAAa,EAAE,MAAM,CAAA;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB,QAAQ,EAAE,GAAG,CAAC;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACtB,KAAK,EAAE,MAAM,CAAC;CACjB"}
@@ -1,4 +0,0 @@
1
-
2
-
3
- npm install lodash luxon pino pino-pretty
4
- npm install --save-dev @types/lodash @types/luxon @types/node barrelsby ts-node tsc-alias tsconfig-paths tsx typescript
package/rollup.config.js DELETED
@@ -1,30 +0,0 @@
1
- import json from '@rollup/plugin-json';
2
- import resolve from '@rollup/plugin-node-resolve';
3
- import commonjs from '@rollup/plugin-commonjs';
4
- import typescript from '@rollup/plugin-typescript';
5
- import { createRequire } from 'module';
6
-
7
- const require = createRequire(import.meta.url); // Creates a require function
8
- const pkg = require('./package.json'); // Loads package.json for configuration
9
- const extensions = ['.js', '.jsx', '.ts', '.tsx'];
10
-
11
- export default [
12
- {
13
- input: 'index.ts',
14
- output: [
15
- {
16
- file: pkg.main,
17
- format: 'cjs',
18
- sourcemap: true,
19
- },
20
- {
21
- file: pkg.module,
22
- format: 'es',
23
- sourcemap: true,
24
- }
25
- ],
26
- plugins: [json(), resolve({ extensions }), commonjs(), typescript({
27
- tsconfig: './tsconfig.json',
28
- })]
29
- }
30
- ];
@@ -1,104 +0,0 @@
1
- import { sortBy } from "lodash"
2
-
3
- /**
4
- * Check if the value in included in enum posibilities.
5
- * @param value Value we need to check
6
- * @param enumEntity Enum type we check againts the value
7
- * @returns Is the value in this enum?
8
- */
9
- export const isInEnum = (value: any, enumEntity: any) => {
10
- const allEnumValues = Object.values(enumEntity) as string[]
11
- return allEnumValues.includes(value)
12
- }
13
-
14
- /**
15
- * Sort array of string elements
16
- * @param rawArray Raw unsorted array of elements
17
- * @returns Sorted string array
18
- */
19
- export const sortStringArray = (rawArray: string[]) => sortBy(rawArray)
20
-
21
- /**
22
- * Remove all duplicity string items from an array
23
- * @param arr Original array with duplicities
24
- * @returns Array of original values
25
- */
26
- export const removeDuplicitiesFromArray = (arr: any[]) => [...new Set(arr)]
27
-
28
- /**
29
- * Check if the string value is not ` "" `
30
- * @param value Value to check
31
- * @returns Boolean result about the truth
32
- */
33
- export const notEmptyString = (value: string) => value !== ""
34
-
35
-
36
- /**
37
- * Return enum values as array of string
38
- * @param enumType Type of the enum from code
39
- * @param separator Optional - separator character
40
- * @returns Array of enum possible values
41
- */
42
- export const enumValuesToString = (enumType: any, separator = ", ") => Object.values(enumType).join(separator)
43
-
44
- /**
45
- * Return enum values as array of string
46
- * @param enumTypes Combination of enum types
47
- * @param separator Optional - separator character
48
- * @returns Array of enum possible values
49
- */
50
- export const enumCombineValuesToString = (enumTypes: any[], separator = ", ") => enumTypes.map(enumType => enumValuesToString(enumType, separator)).join(separator)
51
-
52
- /**
53
- * Return all enum values as array
54
- * @param enumType What array we want to work with
55
- * @returns Array of enum values
56
- */
57
- export const enumValuesToArray = (enumType: any) => Object.values(enumType) as string[]
58
-
59
- /**
60
- * Return random number (integer) between two values
61
- * @param min
62
- * @param max
63
- * @returns
64
- */
65
- export const randomNumberBetween = (min: number, max: number) => {
66
- const minAr = Math.ceil(min)
67
- const maxAr = Math.floor(max)
68
- return Math.floor(Math.random()*(maxAr - minAr + 1) + min)
69
- }
70
-
71
- /**
72
- * Recursively flattens a nested object. The keys of the resulting object
73
- * will be the paths to the original values in the nested object, joined by dots.
74
- *
75
- * @param obj - The object to flatten.
76
- * @param prefix - The prefix to use for the keys in the flattened object. Defaults to an empty string.
77
- * @returns A new object with flattened keys.
78
- *
79
- * @example
80
- * ```typescript
81
- * const nestedObj = {
82
- * a: {
83
- * b: {
84
- * c: 1
85
- * }
86
- * },
87
- * d: 2
88
- * };
89
- * const flatObj = flattenObject(nestedObj);
90
- * console.log(flatObj);
91
- * // Output: { 'a.b.c': 1, 'a.b.d': 2 }
92
- * ```
93
- */
94
- export const flattenObject = (obj: any, prefix = ''): Record<string, any> => {
95
- return Object.keys(obj).reduce((acc: Record<string, any>, key: string) => {
96
- const propName = prefix ? `${prefix}.${key}` : key
97
- if (typeof obj[key] === 'object' && obj[key] !== null && !Array.isArray(obj[key])) {
98
- Object.assign(acc, flattenObject(obj[key], propName))
99
- } else {
100
- acc[propName] = obj[key]
101
- }
102
- return acc
103
- }, {})
104
- }
@@ -1,11 +0,0 @@
1
- type Nullable<T> = T | null
2
- type Unsure<T> = T | undefined
3
- type Nullish<T> = T | undefined | null
4
- type UsurePromise<T> = Unsure<Promise<T>>
5
-
6
- export {
7
- Nullable,
8
- Nullish,
9
- Unsure,
10
- UsurePromise
11
- }
@@ -1,58 +0,0 @@
1
- // logger.ts
2
- import pino, { Logger } from 'pino'
3
- import pretty from 'pino-pretty'
4
-
5
- /**
6
- * @typedef {Object} AppLogOptions
7
- * @property {string} label - The label for the log entry.
8
- * @property {string|number|boolean} [key] - Any extra fields.
9
- */
10
- export type AppLogOptions = {
11
- label: string
12
- [key: string]: string|number|boolean
13
- }
14
-
15
- const DEFAULT_LOG_OPTIONS: AppLogOptions = {
16
- label: 'App'
17
- }
18
-
19
- // create the pretty‐printing stream once
20
- const prettyStream = pretty({
21
- colorize: true,
22
- levelFirst: true,
23
- translateTime: 'yyyy-mm-dd HH:MM:ss'
24
- })
25
-
26
- // create your logger once and for all
27
- const baseLogger: Logger = pino({}, prettyStream)
28
-
29
- export class AppLogger {
30
- static info(
31
- message: string,
32
- options: AppLogOptions = DEFAULT_LOG_OPTIONS,
33
- ) {
34
- baseLogger.info({ ...options, message })
35
- }
36
-
37
- static warn(
38
- message: string,
39
- options: AppLogOptions = DEFAULT_LOG_OPTIONS,
40
- ) {
41
- baseLogger.warn({ ...options, message })
42
- }
43
-
44
- static error(
45
- message: string,
46
- options: AppLogOptions = DEFAULT_LOG_OPTIONS,
47
- ) {
48
- baseLogger.error({ ...options, message })
49
- }
50
-
51
- static appStart(
52
- host: string,
53
- port: number,
54
- options: AppLogOptions = DEFAULT_LOG_OPTIONS,
55
- ) {
56
- AppLogger.info(`Application started on ${host}:${port}`, options)
57
- }
58
- }