Skip to content

Commit

Permalink
fix: fix types for lib-prom
Browse files Browse the repository at this point in the history
  • Loading branch information
awlayton committed Nov 18, 2024
1 parent 317be12 commit bb3ef00
Show file tree
Hide file tree
Showing 42 changed files with 1,279 additions and 1,298 deletions.
725 changes: 367 additions & 358 deletions oada/.yarn/releases/yarn-4.5.0.cjs → oada/.yarn/releases/yarn-4.5.1.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion oada/.yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ packageExtensions:
peerDependencies:
oauth2orize: "*"

yarnPath: .yarn/releases/yarn-4.5.0.cjs
yarnPath: .yarn/releases/yarn-4.5.1.cjs
18 changes: 6 additions & 12 deletions oada/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,12 @@ import noSecrets from 'eslint-plugin-no-secrets';
import node from 'eslint-plugin-n';
import notice from 'eslint-plugin-notice';
import optimizeRegex from 'eslint-plugin-optimize-regex';
import prettier from 'eslint-config-prettier';
import promise from 'eslint-plugin-promise';
import regexp from 'eslint-plugin-regexp';
import security from 'eslint-plugin-security';
import sonarjs from 'eslint-plugin-sonarjs';
import unicorn from 'eslint-plugin-unicorn';
import xo from 'eslint-config-xo';
import xoTypescript from 'eslint-config-xo-typescript';
import xoTypescript from 'eslint-config-xo-typescript/space';

const __filename = fileURLToPath(import.meta.url);

Expand All @@ -57,36 +55,33 @@ const compat = new FlatCompat({

export default typescript.config(
js.configs.recommended,
...typescript.configs.recommended,
...typescript.configs.recommendedTypeChecked,
node.configs['flat/recommended'],
security.configs.recommended,
sonarjs.configs.recommended,
unicorn.configs['flat/recommended'],
regexp.configs['flat/recommended'],
promise.configs['flat/recommended'],
...xoTypescript,
...fixupConfigRules(
compat.extends(
// 'plugin:github/recommended',
'plugin:promise/recommended',
'plugin:github/recommended',
'plugin:github/typescript',
'plugin:optimize-regex/recommended',
'plugin:import/recommended',
'plugin:ava/recommended',
),
...xo,
),
{
files: ['**/*.{c,m,}ts'],
extends: [
...fixupConfigRules(
compat.extends(
// 'plugin:github/typescript',
//'plugin:github/typescript',
'plugin:import/typescript',
),
...xoTypescript,
),
],
},
prettier,
{
ignores: [
'**/__virtual__/',
Expand All @@ -104,7 +99,6 @@ export default typescript.config(
{
plugins: {
// 'github': fixupPluginRules(github),
'promise': fixupPluginRules(promise),
'optimize-regex': fixupPluginRules(optimizeRegex),
'no-constructor-bind': noConstructorBind,
'import': fixupPluginRules(_import),
Expand Down
8 changes: 4 additions & 4 deletions oada/libs/lib-arangodb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"deep-equal": "^2.2.3",
"flat": "^6.0.1",
"json-ptr": "^3.1.1",
"tslib": "2.7.0"
"tslib": "2.8.1"
},
"devDependencies": {
"@ava/typescript": "^5.0.0",
Expand All @@ -75,9 +75,9 @@
"@types/deep-equal": "^1.0.4",
"@types/flat": "^5.0.5",
"@types/json-pointer": "^1.0.34",
"@types/node": "^22.7.5",
"ava": "6.1.3",
"type-fest": "^4.26.1"
"@types/node": "^22.9.0",
"ava": "6.2.0",
"type-fest": "^4.27.0"
},
"volta": {
"node": "22.5.1"
Expand Down
3 changes: 3 additions & 0 deletions oada/libs/lib-arangodb/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@ export interface Graph {
* @todo actually validate format?
*/

// eslint-disable-next-line sonarjs/no-empty-function
export function collection(_value: unknown): asserts _value is Collection {}

export const { config, schema } = await libConfig({
arangodbImport: {
connectionString: {
doc: 'URI for connecting to arangodb',
format: 'url',
// eslint-disable-next-line sonarjs/no-clear-text-protocols
default: 'http://arangodb:8529',
env: 'ARANGODB_IMPORT_URL',
arg: 'arangodb-import-url',
Expand Down Expand Up @@ -102,6 +104,7 @@ export const { config, schema } = await libConfig({
connectionString: {
doc: 'URI for connecting to arangodb',
format: 'url',
// eslint-disable-next-line sonarjs/no-clear-text-protocols
default: 'http://arangodb:8529',
env: 'ARANGODB_URL',
},
Expand Down
2 changes: 2 additions & 0 deletions oada/libs/lib-arangodb/src/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class DatabaseWrapper extends Database {
let tries = 0;
while (++tries) {
try {
// eslint-disable-next-line no-await-in-loop
const res = await super.query<T>(query, { profile, ...options });
if (trace.enabled) {
const { query: aql, ...rest } = query;
Expand All @@ -64,6 +65,7 @@ class DatabaseWrapper extends Database {
`Retrying query due to deadlock (retry #${tries})`,
);

// eslint-disable-next-line no-await-in-loop
await setTimeout(deadlockDelay);
continue;
}
Expand Down
2 changes: 2 additions & 0 deletions oada/libs/lib-arangodb/src/libs/exampledocs/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* limitations under the License.
*/

/* eslint-disable sonarjs/no-hardcoded-credentials */

import type { User } from '../users.js';

export default [
Expand Down
2 changes: 1 addition & 1 deletion oada/libs/lib-arangodb/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import { type Except } from 'type-fest';

export type Selector<T> = T extends { _id?: infer I | undefined }
export type Selector<T> = T extends { _id?: infer I }
? I | { _id: I }
: never;

Expand Down
1 change: 1 addition & 0 deletions oada/libs/lib-arangodb/test/resources.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ test('should find parents based on resource id', async (t) => {
const p = await resources.getParents('/resources:default:resources_rock_123');
t.plan(3);

// eslint-disable-next-line no-unreachable-loop
for await (const parent of p) {
t.is(parent.path, '/rocks-index/90j2klfdjss');
t.is(parent.resource_id, 'resources/default:resources_rocks_123');
Expand Down
2 changes: 1 addition & 1 deletion oada/libs/lib-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"debug": "^4.3.7",
"dotenv": "^16.4.5",
"json5": "^2.2.3",
"tslib": "2.7.0",
"tslib": "2.8.1",
"yaml": "^2.6.0"
},
"devDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions oada/libs/lib-kafka/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@
"eventemitter3": "^5.0.1",
"kafkajs": "^2.2.4",
"ksuid": "^3.0.0",
"tslib": "2.7.0",
"uuid": "^10.0.0"
"tslib": "2.8.1",
"uuid": "^11.0.3"
},
"devDependencies": {
"@ava/typescript": "^5.0.0",
"@types/convict": "^6.1.6",
"@types/debug": "^4.1.12",
"@types/node": "^22.7.5",
"@types/node": "^22.9.0",
"@types/uuid": "^10.0.0",
"ava": "6.1.3"
"ava": "6.2.0"
},
"volta": {
"node": "22.5.1"
Expand Down
10 changes: 5 additions & 5 deletions oada/libs/lib-prom/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oada/lib-prom",
"version": "4.0.0",
"version": "4.0.1",
"description": "OADA Prometheus library",
"main": "./dist/index.js",
"type": "module",
Expand Down Expand Up @@ -37,14 +37,14 @@
"dependencies": {
"@oada/lib-config": "workspace:^",
"prom-client": "^15.1.3",
"tslib": "2.7.0"
"tslib": "2.8.1"
},
"devDependencies": {
"@ava/typescript": "^5.0.0",
"@types/convict": "^6.1.6",
"@types/node": "^22.7.5",
"@types/ws": "^8.5.12",
"ava": "6.1.3",
"@types/node": "^22.9.0",
"@types/ws": "^8.5.13",
"ava": "6.2.0",
"fastify-plugin": "^5.0.1"
},
"volta": {
Expand Down
2 changes: 1 addition & 1 deletion oada/libs/lib-prom/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export interface PseudoMetricConfiguration<T extends string> {
help: string;
labels?: Record<T, string>;
collect?: (this: PseudoMetric<T>) => void | Promise<void>;
registers: MetricConfiguration<T>['registers'];
registers?: MetricConfiguration<T>['registers'];
}

/**
Expand Down
26 changes: 13 additions & 13 deletions oada/libs/models/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions oada/libs/models/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@
"dependencies": {
"@oada/types": "^4.0.0",
"@qlever-llc/interface2class": "^1.1.0",
"tslib": "2.7.0",
"type-fest": "^4.26.1",
"tslib": "2.8.1",
"type-fest": "^4.27.0",
"xksuid": "^0.0.4"
},
"volta": {
"node": "22.5.1"
},
"devDependencies": {
"@types/node": "^22.7.5",
"jose": "^5.9.4"
"@types/node": "^22.9.0",
"jose": "^5.9.6"
}
}
2 changes: 1 addition & 1 deletion oada/libs/models/src/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function destructure<T, R extends [...unknown[]]>(
a.push(argument[property]);
}

// eslint-disable-next-line @typescript-eslint/no-unsafe-call
super(argument, ...a);
}
} as unknown as Class<T, [Partial<T>]>;
Expand Down
Loading

0 comments on commit bb3ef00

Please sign in to comment.