Compare commits

..

5 Commits

Author SHA1 Message Date
eee02f6a56 Connect ns app to api - currently a playground
All checks were successful
CI / main (push) Successful in 5m24s
2025-03-05 21:49:16 +02:00
3dd43deec0 Initial overpass api connections 2025-03-05 21:48:15 +02:00
246debe642 Use certs to serve https 2025-03-05 21:47:45 +02:00
6d03f32009 Initial db config
Plus add cert creation for local development
2025-03-05 21:47:09 +02:00
2433eb53e3 Allow user certs for development on Android 2025-03-05 21:40:54 +02:00
19 changed files with 577 additions and 86 deletions

2
.env Normal file
View File

@ -0,0 +1,2 @@
API_HOST=192.168.0.155
API_PORT=3000

6
.gitignore vendored
View File

@ -41,5 +41,11 @@ Thumbs.db
.nx/cache .nx/cache
.nx/workspace-data .nx/workspace-data
*.sqlite
*.sqlite3
*.sqlite-journal
*.db *.db
*.db-journal *.db-journal
cert.pem
key.pem

View File

@ -0,0 +1,5 @@
DB_HOST=localhost
DB_PORT=5432
DB_NAME=blakus
DB_USER=dev
DB_PASSWORD=dhzVd5s@pazAWG4eKrm@

View File

@ -0,0 +1,22 @@
// Update with your config settings.
/**
* @type { Object.<string, import("knex").Knex.Config> }
*/
module.exports = {
client: 'postgresql',
connection: {
host: process.env.DB_HOST,
port: process.env.DB_PORT,
database: process.env.DB_NAME,
user: process.env.DB_USER,
password: process.env.DB_PASSWORD
},
pool: {
min: 2,
max: 10
},
migrations: {
tableName: 'knex_migrations'
}
};

View File

@ -0,0 +1,35 @@
/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
exports.up = function(knex) {
return knex.schema
.createTable('users', function (table) {
table.uuid('id')
.primary()
.defaultTo(knex.raw(`gen_random_uuid()`));
table.string('first_name', 255)
.notNullable();
table.string('last_name', 255)
.notNullable();
table.string('email', 255)
.unique()
.notNullable();
})
// .createTable('products', function (table) {
// table.increments('id');
// table.decimal('price').notNullable();
// table.string('name', 1000).notNullable();
// });
};
/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
exports.down = function(knex) {
return knex.schema
// .dropTable('products')
.dropTable('users');
};

View File

@ -26,7 +26,16 @@
} }
}, },
"configurations": { "configurations": {
"development": {}, "development": {
"assets": [
"apps/blakus-api/src/assets",
{
"glob": "**/*",
"input": "apps/blakus-api/certs",
"output": "apps/blakus-api/certs"
}
]
},
"production": { "production": {
"esbuildOptions": { "esbuildOptions": {
"sourcemap": false, "sourcemap": false,
@ -47,7 +56,8 @@
}, },
"configurations": { "configurations": {
"development": { "development": {
"buildTarget": "blakus-api:build:development" "buildTarget": "blakus-api:build:development",
"watch": true
}, },
"production": { "production": {
"buildTarget": "blakus-api:build:production" "buildTarget": "blakus-api:build:production"
@ -59,20 +69,106 @@
"passWithNoTests": true "passWithNoTests": true
} }
}, },
"prisma-generate": { "knex:migrate-make": {
"executor": "nx:run-commands", "executor": "nx:run-commands",
"defaultConfiguration": "development", "defaultConfiguration": "development",
"options": { "options": {
"cwd": "apps/blakus-api", "cwd": "apps/blakus-api",
"commands": ["npx prisma generate"] "command": "npx knex migrate:make farts"
},
"schema": {
"name": {
"type": "string",
"required": true
}
}
},
"knex:migrate-latest": {
"executor": "nx:run-commands",
"defaultConfiguration": "development",
"options": {
"cwd": "apps/blakus-api",
"command": "npx knex migrate:latest"
}, },
"configurations": { "configurations": {
"development": { "development": {},
"envFile": "apps/blakus-api/.env.development" "production": {}
}, }
"production": { },
"envFile": "apps/blakus-api/.env.production" "knex:migrate-rollback": {
"executor": "nx:run-commands",
"defaultConfiguration": "development",
"options": {
"cwd": "apps/blakus-api",
"command": "npx knex migrate:rollback"
},
"configurations": {
"development": {},
"production": {}
}
},
"knex:migrate-up": {
"executor": "nx:run-commands",
"defaultConfiguration": "development",
"options": {
"cwd": "apps/blakus-api",
"command": "npx knex migrate:up"
},
"configurations": {
"development": {},
"production": {}
}
},
"knex:migrate-down": {
"executor": "nx:run-commands",
"defaultConfiguration": "development",
"options": {
"cwd": "apps/blakus-api",
"command": "npx knex migrate:down"
},
"configurations": {
"development": {},
"production": {}
}
},
"knex:seed-make": {
"executor": "nx:run-commands",
"defaultConfiguration": "development",
"options": {
"cwd": "apps/blakus-api",
"command": "npx knex seed:make initial"
},
"schema": {
"name": {
"type": "string",
"required": true
} }
},
"configurations": {
"development": {},
"production": {}
}
},
"knex:seed-run": {
"executor": "nx:run-commands",
"defaultConfiguration": "development",
"options": {
"cwd": "apps/blakus-api",
"command": "npx knex seed:run"
},
"configurations": {
"development": {},
"production": {}
}
},
"certs:generate": {
"executor": "nx:run-commands",
"options": {
"cwd": "apps/blakus-api",
"commands": [
"mkcert -install",
"mkcert -key-file ./certs/key.pem -cert-file ./certs/cert.pem localhost 127.0.0.1 ::1 ${API_HOST}"
]
} }
} }
} }

View File

@ -0,0 +1,37 @@
const { fakerLV : faker } = require('@faker-js/faker');
const USER_COUNT = 500;
const createUser = ({
sex = faker.person.sexType(),
first_name = `${faker.person.firstName(sex)}`,
last_name = faker.person.lastName(sex),
email = faker.internet.email({ lastName: last_name, firstName: first_name }).toLocaleLowerCase(),
} = {}) => {
return {
first_name,
last_name,
email,
}
};
/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
exports.seed = async function(knex) {
// Deletes ALL existing entries
await knex('users').del()
await knex('users').insert([
createUser({
first_name: 'Broks Randolfs',
last_name: 'Gailītis',
email: 'broks.randolfs@gailitis.dev'
}),
createUser({
first_name: 'Ieva',
last_name: 'Gailīte'
}),
...new Array(USER_COUNT).fill(() => createUser()).map((fn, i) => fn(i)),
]);
};

View File

@ -0,0 +1,36 @@
import { FastifyInstance } from 'fastify';
import { OverpassService } from '../services/overpass';
import { OverpassQuerySchema, OverpassQueryType } from '../schemas/overpass';
const overpassService = new OverpassService();
export default async function (fastify: FastifyInstance) {
fastify.get<{ Querystring: OverpassQueryType }>('/blakus', {
schema: {
querystring: OverpassQuerySchema,
response: {
200: {
type: 'array',
items: {
type: 'object',
properties: {
title: { type: 'string' },
amenity: { type: 'string' },
tags: { type: 'object', additionalProperties: true }
}
}
}
}
}
}, async function ({query}) {
const elements = await overpassService.getAmenitiesAroundLocation({
latlon: {
lat: query.lat,
lon: query.lon,
},
amenities: ['restaurant', 'cafe', 'bar', 'pub', 'biergarten', 'fast_food', 'food_court', 'ice_cream']
});
return elements;
});
}

View File

@ -1,8 +1,9 @@
import { FastifyInstance } from 'fastify'; import { FastifyInstance } from 'fastify';
import db from '../../db';
export default async function (fastify: FastifyInstance) { export default async function (fastify: FastifyInstance) {
const users = await db.select('*').from('users');
fastify.get('/', async function () { fastify.get('/', async function () {
return { usersWithPosts: [] }; return { users };
}); });
} }

View File

@ -0,0 +1,10 @@
import { Static, Type } from '@sinclair/typebox'
export const OverpassQuerySchema = Type.Object({
lat: Type.Number(),
lon: Type.Number(),
radius: Type.Optional(Type.Number()),
amenities: Type.Optional(Type.Array(Type.String())),
});
export type OverpassQueryType = Static<typeof OverpassQuerySchema>;

View File

@ -0,0 +1,89 @@
import axios, { AxiosInstance } from 'axios';
type OverpassResult = {
version: number;
generator: string;
osm3s: Record<string, string>;
elements: (NodeElement | WayElement | RelationElement)[];
}
type OverpassLocation = {
lat: number,
lon: number
}
type OverpassElement = {
type: string;
id: number;
tags?: { [key: string]: string }
};
type NodeElement = OverpassElement & OverpassLocation & {
type: 'node';
lat: number;
lon: number;
}
type WayElement = OverpassElement & {
type: 'way';
nodes: number[];
}
type RelationElement = OverpassElement & {
type: 'relation';
members: {
type: 'node' | 'way' | 'relation';
ref: number;
role: string;
}[];
}
function opq(strings, ...expressions) {
let query = '[out:json];\n';
for (let i = 0; i < strings.length; i++) {
query += strings[i];
if (i < expressions.length) query += expressions[i];
}
query += '\nout body;\n>;\nout skel qt;';
return query;
}
export class OverpassService {
private axios: AxiosInstance;
constructor(baseURL = 'https://overpass-api.de/api/') {
this.axios = axios.create({ baseURL });
}
async getAmenitiesAroundLocation({radius = 500, amenities = [], latlon}: {radius?: number, latlon: OverpassLocation, amenities: string[]}) {
if (!latlon || !latlon.lat || !latlon.lon) throw new Error('Invalid location');
const { lat, lon } = latlon;
const query = opq`node(around:${radius}, ${lat}, ${lon})["amenity"~"${amenities.join('|')}"];`;
const result = await this.overpassQuery(query);
return result.elements
.map(({ tags }) => ({ title: tags.name, amenity: tags.amenity, tags}))
.filter(i => amenities.includes(i.amenity)); // query returns some random results. need to look into this
}
async overpassQuery(query: string): Promise<OverpassResult> {
return this.getData('interpreter', { data: query });
}
async getData<T>(endpoint: string, params: Record<string, string>): Promise<T> {
try {
const response = await this.axios.get(endpoint, { params });
return response.data;
} catch (error) {
console.error(`Error fetching data from ${endpoint}:`, error);
throw error;
}
}
}

19
apps/blakus-api/src/db.ts Normal file
View File

@ -0,0 +1,19 @@
import knex from 'knex';
const knexInstance = knex({
client: 'postgresql',
connection: {
database: process.env.DB_NAME,
user: process.env.DB_USER,
password: process.env.DB_PASSWORD
},
pool: {
min: 2,
max: 10
},
migrations: {
tableName: 'knex_migrations'
}
});
export default knexInstance;

View File

@ -1,12 +1,18 @@
import Fastify from 'fastify'; import Fastify from 'fastify';
import fs from 'fs';
import path from 'path';
import { app } from './app/app'; import { app } from './app/app';
const host = process.env.HOST ?? 'localhost'; const host = process.env.API_HOST ?? 'localhost';
const port = process.env.PORT ? Number(process.env.PORT) : 3000; const port = process.env.API_PORT ? Number(process.env.API_PORT) : 3000;
// Instantiate Fastify with some config // Instantiate Fastify with some config
const server = Fastify({ const server = Fastify({
logger: true, logger: true,
https: {
key: fs.readFileSync(path.join(__dirname, '..', 'certs', 'key.pem')),
cert: fs.readFileSync(path.join(__dirname, '..', 'certs', 'cert.pem')),
}
}); });
// Register your application as a normal plugin. // Register your application as a normal plugin.
@ -18,6 +24,6 @@ server.listen({ port, host }, (err) => {
server.log.error(err); server.log.error(err);
process.exit(1); process.exit(1);
} else { } else {
console.log(`[ ready ] http://${host}:${port}`); console.log(`[ ready ] https://${host}:${port}`);
} }
}); });

View File

@ -3,8 +3,10 @@
"compilerOptions": { "compilerOptions": {
"outDir": "../../dist/out-tsc", "outDir": "../../dist/out-tsc",
"module": "commonjs", "module": "commonjs",
"types": ["node"] "types": ["node"],
"allowJs": true,
"esModuleInterop": true
}, },
"include": ["src/**/*.ts"], "include": ["src/**/*.ts", "src/**/*.js"],
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"] "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
} }

View File

@ -24,7 +24,8 @@
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/AppTheme" android:theme="@style/AppTheme"
android:hardwareAccelerated="true"> android:hardwareAccelerated="true"
android:networkSecurityConfig="@xml/network_security_config">
<provider <provider
android:name="androidx.core.content.FileProvider" android:name="androidx.core.content.FileProvider"

View File

@ -0,0 +1,8 @@
<network-security-config>
<debug-overrides>
<trust-anchors>
<!-- Trust user added CAs while debuggable only -->
<certificates src="user" />
</trust-anchors>
</debug-overrides>
</network-security-config>

View File

@ -47,7 +47,7 @@ export class HelloWorldModel extends Observable {
private _message: string; private _message: string;
private _items: BlakusItem[]; private _items: BlakusItem[];
private _locationServiceBaseURL = 'https://api.kartes.lv/v3/KVDM_mwwKi/' private _locationServiceBaseURL = 'https://api.kartes.lv/v3/KVDM_mwwKi/'
private _overpassBaseURL = 'https://overpass-api.de/api/'; private _blakusBaseURL = 'https://192.168.0.155:3000';
constructor() { constructor() {
super(); super();
@ -93,45 +93,21 @@ export class HelloWorldModel extends Observable {
return result; return result;
} }
overpassQuery(query: string) { getBlakus(params = new URLSearchParams()) {
const url = new URL(`interpreter?data=${encodeURIComponent(query)}`, this._overpassBaseURL).toString(); const url = new URL(`blakus?${params.toString()}`, this._blakusBaseURL).toString();
console.log('overpass query', url) console.log('blakus query', url)
return Http.getJSON<OverpassResult>(url) return Http.getJSON<OverpassResult["elements"]>(url)
} }
async getOverpassAmenities({latitude, longitude}: Location) { async getOverpassAmenities({latitude, longitude}: Location) {
const radius = 1000; // meters const params = new URLSearchParams();
const query = ` params.set('lat', latitude.toString());
[out:json][timeout:25]; params.set('lon', longitude.toString());
node["amenity"](around:${radius}, ${latitude}, ${longitude});
out tags;
`;
const result = await this.overpassQuery(query);
console.log('yep');
console.log(Array.from(new Set(result.elements.map(el => el.tags['amenity']))));
}
async getOverpassInfo({latitude, longitude}: Location) { const result = await this.getBlakus(params);
console.log(result);
const radius = 1000; // meters this.items = result.map(({ tags }) => ({ title: tags.name, amenity: tags.amenity, tags}))
const amenities = ['restaurant', 'cafe', 'bar', 'pub', 'biergarten', 'fast_food', 'food_court', 'ice_cream']; // .filter(i => amenities.includes(i.amenity));
const query = `
[out:json];
node(around:${radius}, ${latitude}, ${longitude})["amenity"~"${amenities.join('|')}"];
out body;
>;
out skel qt;
`;
const result = await this.overpassQuery(query);
this.items = result.elements
.map(({ tags }) => ({ title: tags.name, amenity: tags.amenity, tags}))
.filter(i => amenities.includes(i.amenity)); // query returns some random results. need to look into this
console.log(localize('app.name'))
console.log(result.elements);
} }
async postalPolygons(country = 'LV', code: string, mode: 'isolate' | 'collect' | 'union' = 'union') { async postalPolygons(country = 'LV', code: string, mode: 'isolate' | 'collect' | 'union' = 'union') {
@ -152,13 +128,7 @@ export class HelloWorldModel extends Observable {
async onLocationTap() { async onLocationTap() {
const location = await DeviceLocation.getDeviceLocation(); const location = await DeviceLocation.getDeviceLocation();
await this.getOverpassInfo(location); await this.getOverpassAmenities(location);
// await this.getOverpassAmenities(location);
// const { index } = await this.reverseGeocode(location);
// const [country, code] = index.split('-');
// await this.postalPolygons(country, code);
} }
onTap() { onTap() {

192
package-lock.json generated
View File

@ -12,14 +12,17 @@
"@fastify/autoload": "~6.0.3", "@fastify/autoload": "~6.0.3",
"@fastify/sensible": "~6.0.2", "@fastify/sensible": "~6.0.2",
"@nativescript/core": "~8.8.0", "@nativescript/core": "~8.8.0",
"@sinclair/typebox": "^0.34.28",
"axios": "^1.6.0", "axios": "^1.6.0",
"fastify": "~5.2.1", "fastify": "~5.2.1",
"fastify-plugin": "~5.0.1", "fastify-plugin": "~5.0.1",
"knex": "^3.1.0", "knex": "^3.1.0",
"pg": "^8.13.3",
"sqlite3": "^5.1.7" "sqlite3": "^5.1.7"
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.8.0", "@eslint/js": "^9.8.0",
"@faker-js/faker": "^9.5.1",
"@nativescript/nx": "^20.3.0", "@nativescript/nx": "^20.3.0",
"@nativescript/types": "~8.8.0", "@nativescript/types": "~8.8.0",
"@nativescript/webpack": "~5.0.0", "@nativescript/webpack": "~5.0.0",
@ -34,7 +37,6 @@
"@swc/core": "~1.5.7", "@swc/core": "~1.5.7",
"@swc/helpers": "~0.5.11", "@swc/helpers": "~0.5.11",
"@types/jest": "^29.5.12", "@types/jest": "^29.5.12",
"@types/knex": "^0.15.2",
"@types/node": "~18.16.9", "@types/node": "~18.16.9",
"ajv": "^8.17.1", "ajv": "^8.17.1",
"esbuild": "^0.19.2", "esbuild": "^0.19.2",
@ -45,7 +47,7 @@
"nx": "20.4.6", "nx": "20.4.6",
"prettier": "^2.6.2", "prettier": "^2.6.2",
"ts-jest": "^29.1.0", "ts-jest": "^29.1.0",
"ts-node": "10.9.1", "ts-node": "^10.9.1",
"tslib": "^2.3.0", "tslib": "^2.3.0",
"typescript": "~5.7.2", "typescript": "~5.7.2",
"typescript-eslint": "^8.19.0" "typescript-eslint": "^8.19.0"
@ -2630,6 +2632,23 @@
"node": "^18.18.0 || ^20.9.0 || >=21.1.0" "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
} }
}, },
"node_modules/@faker-js/faker": {
"version": "9.5.1",
"resolved": "https://registry.npmjs.org/@faker-js/faker/-/faker-9.5.1.tgz",
"integrity": "sha512-0fzMEDxkExR2cn731kpDaCCnBGBUOIXEi2S1N5l8Hltp6aPf4soTMJ+g4k8r2sI5oB+rpwIW8Uy/6jkwGpnWPg==",
"dev": true,
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/fakerjs"
}
],
"license": "MIT",
"engines": {
"node": ">=18.0.0",
"npm": ">=9.0.0"
}
},
"node_modules/@fastify/ajv-compiler": { "node_modules/@fastify/ajv-compiler": {
"version": "4.0.2", "version": "4.0.2",
"resolved": "https://registry.npmjs.org/@fastify/ajv-compiler/-/ajv-compiler-4.0.2.tgz", "resolved": "https://registry.npmjs.org/@fastify/ajv-compiler/-/ajv-compiler-4.0.2.tgz",
@ -3062,6 +3081,13 @@
"node": "^14.15.0 || ^16.10.0 || >=18.0.0" "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
} }
}, },
"node_modules/@jest/schemas/node_modules/@sinclair/typebox": {
"version": "0.27.8",
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz",
"integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==",
"dev": true,
"license": "MIT"
},
"node_modules/@jest/source-map": { "node_modules/@jest/source-map": {
"version": "29.6.3", "version": "29.6.3",
"resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.6.3.tgz", "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.6.3.tgz",
@ -4252,10 +4278,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/@sinclair/typebox": { "node_modules/@sinclair/typebox": {
"version": "0.27.8", "version": "0.34.28",
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.34.28.tgz",
"integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", "integrity": "sha512-e2B9vmvaa5ym5hWgCHw5CstP54au6AOLXrhZErLsOyyRzuWJtXl/8TszKtc5x8rw/b+oY7HKS9m9iRI53RK0WQ==",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/@sinonjs/commons": { "node_modules/@sinonjs/commons": {
@ -4670,13 +4695,6 @@
"@babel/types": "^7.20.7" "@babel/types": "^7.20.7"
} }
}, },
"node_modules/@types/bluebird": {
"version": "3.5.42",
"resolved": "https://registry.npmjs.org/@types/bluebird/-/bluebird-3.5.42.tgz",
"integrity": "sha512-Jhy+MWRlro6UjVi578V/4ZGNfeCOcNCp0YaFNIUGFKlImowqwb1O/22wDVk3FDGMLqxdpOV3qQHD5fPEH4hK6A==",
"dev": true,
"license": "MIT"
},
"node_modules/@types/eslint": { "node_modules/@types/eslint": {
"version": "9.6.1", "version": "9.6.1",
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.1.tgz", "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.1.tgz",
@ -4761,17 +4779,6 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/@types/knex": {
"version": "0.15.2",
"resolved": "https://registry.npmjs.org/@types/knex/-/knex-0.15.2.tgz",
"integrity": "sha512-mw8OT8v+FK0SsgDdmio2XSkEM/yLD7ybFtiqW7I65EDTlr2aZtG+p9FhryErpNJDJ2FEXgQhe3JVBG0Gh7YbvQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/bluebird": "*",
"@types/node": "*"
}
},
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "18.16.20", "version": "18.16.20",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.20.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.20.tgz",
@ -11660,12 +11667,101 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/pg": {
"version": "8.13.3",
"resolved": "https://registry.npmjs.org/pg/-/pg-8.13.3.tgz",
"integrity": "sha512-P6tPt9jXbL9HVu/SSRERNYaYG++MjnscnegFh9pPHihfoBSujsrka0hyuymMzeJKFWrcG8wvCKy8rCe8e5nDUQ==",
"license": "MIT",
"dependencies": {
"pg-connection-string": "^2.7.0",
"pg-pool": "^3.7.1",
"pg-protocol": "^1.7.1",
"pg-types": "^2.1.0",
"pgpass": "1.x"
},
"engines": {
"node": ">= 8.0.0"
},
"optionalDependencies": {
"pg-cloudflare": "^1.1.1"
},
"peerDependencies": {
"pg-native": ">=3.0.1"
},
"peerDependenciesMeta": {
"pg-native": {
"optional": true
}
}
},
"node_modules/pg-cloudflare": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.1.1.tgz",
"integrity": "sha512-xWPagP/4B6BgFO+EKz3JONXv3YDgvkbVrGw2mTo3D6tVDQRh1e7cqVGvyR3BE+eQgAvx1XhW/iEASj4/jCWl3Q==",
"license": "MIT",
"optional": true
},
"node_modules/pg-connection-string": { "node_modules/pg-connection-string": {
"version": "2.6.2", "version": "2.6.2",
"resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.6.2.tgz", "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.6.2.tgz",
"integrity": "sha512-ch6OwaeaPYcova4kKZ15sbJ2hKb/VP48ZD2gE7i1J+L4MspCtBMAx8nMgz7bksc7IojCIIWuEhHibSMFH8m8oA==", "integrity": "sha512-ch6OwaeaPYcova4kKZ15sbJ2hKb/VP48ZD2gE7i1J+L4MspCtBMAx8nMgz7bksc7IojCIIWuEhHibSMFH8m8oA==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/pg-int8": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz",
"integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==",
"license": "ISC",
"engines": {
"node": ">=4.0.0"
}
},
"node_modules/pg-pool": {
"version": "3.7.1",
"resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.7.1.tgz",
"integrity": "sha512-xIOsFoh7Vdhojas6q3596mXFsR8nwBQBXX5JiV7p9buEVAGqYL4yFzclON5P9vFrpu1u7Zwl2oriyDa89n0wbw==",
"license": "MIT",
"peerDependencies": {
"pg": ">=8.0"
}
},
"node_modules/pg-protocol": {
"version": "1.7.1",
"resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.7.1.tgz",
"integrity": "sha512-gjTHWGYWsEgy9MsY0Gp6ZJxV24IjDqdpTW7Eh0x+WfJLFsm/TJx1MzL6T0D88mBvkpxotCQ6TwW6N+Kko7lhgQ==",
"license": "MIT"
},
"node_modules/pg-types": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz",
"integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==",
"license": "MIT",
"dependencies": {
"pg-int8": "1.0.1",
"postgres-array": "~2.0.0",
"postgres-bytea": "~1.0.0",
"postgres-date": "~1.0.4",
"postgres-interval": "^1.1.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/pg/node_modules/pg-connection-string": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.7.0.tgz",
"integrity": "sha512-PI2W9mv53rXJQEOb8xNR8lH7Hr+EKa6oJa38zsK0S/ky2er16ios1wLKhZyxzD7jUReiWokc9WK5nxSnC7W1TA==",
"license": "MIT"
},
"node_modules/pgpass": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz",
"integrity": "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==",
"license": "MIT",
"dependencies": {
"split2": "^4.1.0"
}
},
"node_modules/picocolors": { "node_modules/picocolors": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
@ -11965,6 +12061,45 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/postgres-array": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz",
"integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==",
"license": "MIT",
"engines": {
"node": ">=4"
}
},
"node_modules/postgres-bytea": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.0.tgz",
"integrity": "sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w==",
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/postgres-date": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz",
"integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==",
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/postgres-interval": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz",
"integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==",
"license": "MIT",
"dependencies": {
"xtend": "^4.0.0"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/prebuild-install": { "node_modules/prebuild-install": {
"version": "7.1.3", "version": "7.1.3",
"resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.3.tgz", "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.3.tgz",
@ -14613,6 +14748,15 @@
"node": ">=8.0" "node": ">=8.0"
} }
}, },
"node_modules/xtend": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==",
"license": "MIT",
"engines": {
"node": ">=0.4"
}
},
"node_modules/y18n": { "node_modules/y18n": {
"version": "5.0.8", "version": "5.0.8",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",

View File

@ -6,6 +6,7 @@
"private": true, "private": true,
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.8.0", "@eslint/js": "^9.8.0",
"@faker-js/faker": "^9.5.1",
"@nativescript/nx": "^20.3.0", "@nativescript/nx": "^20.3.0",
"@nativescript/types": "~8.8.0", "@nativescript/types": "~8.8.0",
"@nativescript/webpack": "~5.0.0", "@nativescript/webpack": "~5.0.0",
@ -20,7 +21,6 @@
"@swc/core": "~1.5.7", "@swc/core": "~1.5.7",
"@swc/helpers": "~0.5.11", "@swc/helpers": "~0.5.11",
"@types/jest": "^29.5.12", "@types/jest": "^29.5.12",
"@types/knex": "^0.15.2",
"@types/node": "~18.16.9", "@types/node": "~18.16.9",
"ajv": "^8.17.1", "ajv": "^8.17.1",
"esbuild": "^0.19.2", "esbuild": "^0.19.2",
@ -31,7 +31,7 @@
"nx": "20.4.6", "nx": "20.4.6",
"prettier": "^2.6.2", "prettier": "^2.6.2",
"ts-jest": "^29.1.0", "ts-jest": "^29.1.0",
"ts-node": "10.9.1", "ts-node": "^10.9.1",
"tslib": "^2.3.0", "tslib": "^2.3.0",
"typescript": "~5.7.2", "typescript": "~5.7.2",
"typescript-eslint": "^8.19.0" "typescript-eslint": "^8.19.0"
@ -40,10 +40,12 @@
"@fastify/autoload": "~6.0.3", "@fastify/autoload": "~6.0.3",
"@fastify/sensible": "~6.0.2", "@fastify/sensible": "~6.0.2",
"@nativescript/core": "~8.8.0", "@nativescript/core": "~8.8.0",
"@sinclair/typebox": "^0.34.28",
"axios": "^1.6.0", "axios": "^1.6.0",
"fastify": "~5.2.1", "fastify": "~5.2.1",
"fastify-plugin": "~5.0.1", "fastify-plugin": "~5.0.1",
"knex": "^3.1.0", "knex": "^3.1.0",
"pg": "^8.13.3",
"sqlite3": "^5.1.7" "sqlite3": "^5.1.7"
}, },
"nativescript-nx": { "nativescript-nx": {