@naturalcycles/backend-lib 9.37.0 → 9.38.0
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/dist/db/httpDB.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { CommonDB, CommonDBOptions, CommonDBSaveOptions, CommonDBSupport, DBQuery, RunQueryResult } from '@naturalcycles/db-lib';
|
|
2
2
|
import { BaseCommonDB } from '@naturalcycles/db-lib';
|
|
3
3
|
import type { FetcherOptions } from '@naturalcycles/js-lib/http';
|
|
4
|
-
import type { JsonSchemaRootObject } from '@naturalcycles/js-lib/json-schema';
|
|
5
4
|
import type { ObjectWithId } from '@naturalcycles/js-lib/types';
|
|
5
|
+
import type { JsonSchema } from '@naturalcycles/nodejs-lib/ajv';
|
|
6
6
|
export interface HttpDBCfg extends FetcherOptions {
|
|
7
7
|
baseUrl: string;
|
|
8
8
|
}
|
|
@@ -17,7 +17,7 @@ export declare class HttpDB extends BaseCommonDB implements CommonDB {
|
|
|
17
17
|
private fetcher;
|
|
18
18
|
ping(): Promise<void>;
|
|
19
19
|
getTables(): Promise<string[]>;
|
|
20
|
-
getTableSchema<ROW extends ObjectWithId>(table: string): Promise<
|
|
20
|
+
getTableSchema<ROW extends ObjectWithId>(table: string): Promise<JsonSchema<ROW>>;
|
|
21
21
|
resetCache(table?: string): Promise<void>;
|
|
22
22
|
getByIds<ROW extends ObjectWithId>(table: string, ids: ROW['id'][], opt?: CommonDBOptions): Promise<ROW[]>;
|
|
23
23
|
runQuery<ROW extends ObjectWithId>(query: DBQuery<ROW>, opt?: CommonDBOptions): Promise<RunQueryResult<ROW>>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturalcycles/backend-lib",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "9.
|
|
4
|
+
"version": "9.38.0",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@sentry/node": "^10"
|
|
7
7
|
},
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@sentry/node": "^10",
|
|
30
30
|
"@types/ejs": "^3",
|
|
31
31
|
"fastify": "^5",
|
|
32
|
-
"@naturalcycles/dev-lib": "
|
|
32
|
+
"@naturalcycles/dev-lib": "18.4.2"
|
|
33
33
|
},
|
|
34
34
|
"exports": {
|
|
35
35
|
".": "./dist/index.js",
|
package/src/db/httpDB.ts
CHANGED
|
@@ -9,8 +9,8 @@ import type {
|
|
|
9
9
|
import { BaseCommonDB, commonDBFullSupport } from '@naturalcycles/db-lib'
|
|
10
10
|
import type { Fetcher, FetcherOptions } from '@naturalcycles/js-lib/http'
|
|
11
11
|
import { getFetcher } from '@naturalcycles/js-lib/http'
|
|
12
|
-
import type { JsonSchemaRootObject } from '@naturalcycles/js-lib/json-schema'
|
|
13
12
|
import type { ObjectWithId } from '@naturalcycles/js-lib/types'
|
|
13
|
+
import type { JsonSchema } from '@naturalcycles/nodejs-lib/ajv'
|
|
14
14
|
|
|
15
15
|
export interface HttpDBCfg extends FetcherOptions {
|
|
16
16
|
baseUrl: string
|
|
@@ -51,9 +51,7 @@ export class HttpDB extends BaseCommonDB implements CommonDB {
|
|
|
51
51
|
return await this.fetcher.get(`tables`)
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
override async getTableSchema<ROW extends ObjectWithId>(
|
|
55
|
-
table: string,
|
|
56
|
-
): Promise<JsonSchemaRootObject<ROW>> {
|
|
54
|
+
override async getTableSchema<ROW extends ObjectWithId>(table: string): Promise<JsonSchema<ROW>> {
|
|
57
55
|
return await this.fetcher.get(`${table}/schema`)
|
|
58
56
|
}
|
|
59
57
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { _lazyValue } from '@naturalcycles/js-lib'
|
|
2
|
-
import type { JsonSchema } from '@naturalcycles/js-lib/json-schema'
|
|
3
2
|
import type { StringMap } from '@naturalcycles/js-lib/types'
|
|
4
|
-
import { AjvSchema } from '@naturalcycles/nodejs-lib/ajv'
|
|
3
|
+
import { AjvSchema, type JsonSchema } from '@naturalcycles/nodejs-lib/ajv'
|
|
5
4
|
import { fs2 } from '@naturalcycles/nodejs-lib/fs2'
|
|
6
5
|
import { yaml2 } from '@naturalcycles/nodejs-lib/yaml2'
|
|
7
6
|
import { resourcesDir } from '../paths.cnst.js'
|