bigal 12.1.4 → 13.0.0-beta1
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/.devcontainer/devcontainer.json +16 -0
- package/.husky/pre-commit +4 -0
- package/.prettierrc.cjs +34 -0
- package/CHANGELOG.md +9 -0
- package/dist/index.cjs +2626 -0
- package/dist/index.d.cts +892 -0
- package/dist/index.d.mts +892 -0
- package/dist/index.d.ts +892 -0
- package/dist/index.mjs +2605 -0
- package/eslint.config.mjs +25 -0
- package/package.json +46 -37
- package/tsconfig.build.json +7 -0
- package/Entity.d.ts +0 -16
- package/Entity.js +0 -13
- package/Entity.js.map +0 -1
- package/IReadonlyRepository.d.ts +0 -36
- package/IReadonlyRepository.js +0 -3
- package/IReadonlyRepository.js.map +0 -1
- package/IRepository.d.ts +0 -99
- package/IRepository.js +0 -3
- package/IRepository.js.map +0 -1
- package/ReadonlyRepository.d.ts +0 -69
- package/ReadonlyRepository.js +0 -687
- package/ReadonlyRepository.js.map +0 -1
- package/Repository.d.ts +0 -69
- package/Repository.js +0 -171
- package/Repository.js.map +0 -1
- package/SqlHelper.d.ts +0 -144
- package/SqlHelper.js +0 -1081
- package/SqlHelper.js.map +0 -1
- package/decorators/ColumnBaseOptions.d.ts +0 -10
- package/decorators/ColumnBaseOptions.js +0 -3
- package/decorators/ColumnBaseOptions.js.map +0 -1
- package/decorators/ColumnCollectionOptions.d.ts +0 -15
- package/decorators/ColumnCollectionOptions.js +0 -3
- package/decorators/ColumnCollectionOptions.js.map +0 -1
- package/decorators/ColumnModelOptions.d.ts +0 -7
- package/decorators/ColumnModelOptions.js +0 -3
- package/decorators/ColumnModelOptions.js.map +0 -1
- package/decorators/ColumnTypeOptions.d.ts +0 -21
- package/decorators/ColumnTypeOptions.js +0 -3
- package/decorators/ColumnTypeOptions.js.map +0 -1
- package/decorators/TableOptions.d.ts +0 -14
- package/decorators/TableOptions.js +0 -3
- package/decorators/TableOptions.js.map +0 -1
- package/decorators/column.d.ts +0 -9
- package/decorators/column.js +0 -93
- package/decorators/column.js.map +0 -1
- package/decorators/createDateColumn.d.ts +0 -6
- package/decorators/createDateColumn.js +0 -50
- package/decorators/createDateColumn.js.map +0 -1
- package/decorators/index.d.ts +0 -6
- package/decorators/index.js +0 -23
- package/decorators/index.js.map +0 -1
- package/decorators/primaryColumn.d.ts +0 -8
- package/decorators/primaryColumn.js +0 -66
- package/decorators/primaryColumn.js.map +0 -1
- package/decorators/table.d.ts +0 -5
- package/decorators/table.js +0 -40
- package/decorators/table.js.map +0 -1
- package/decorators/updateDateColumn.d.ts +0 -6
- package/decorators/updateDateColumn.js +0 -51
- package/decorators/updateDateColumn.js.map +0 -1
- package/decorators/versionColumn.d.ts +0 -6
- package/decorators/versionColumn.js +0 -51
- package/decorators/versionColumn.js.map +0 -1
- package/errors/QueryError.d.ts +0 -8
- package/errors/QueryError.js +0 -13
- package/errors/QueryError.js.map +0 -1
- package/errors/index.d.ts +0 -1
- package/errors/index.js +0 -18
- package/errors/index.js.map +0 -1
- package/index.d.ts +0 -35
- package/index.js +0 -220
- package/index.js.map +0 -1
- package/metadata/ColumnBaseMetadata.d.ts +0 -93
- package/metadata/ColumnBaseMetadata.js +0 -19
- package/metadata/ColumnBaseMetadata.js.map +0 -1
- package/metadata/ColumnCollectionMetadata.d.ts +0 -36
- package/metadata/ColumnCollectionMetadata.js +0 -63
- package/metadata/ColumnCollectionMetadata.js.map +0 -1
- package/metadata/ColumnMetadata.d.ts +0 -4
- package/metadata/ColumnMetadata.js +0 -3
- package/metadata/ColumnMetadata.js.map +0 -1
- package/metadata/ColumnModelMetadata.d.ts +0 -18
- package/metadata/ColumnModelMetadata.js +0 -43
- package/metadata/ColumnModelMetadata.js.map +0 -1
- package/metadata/ColumnModifierMetadata.d.ts +0 -46
- package/metadata/ColumnModifierMetadata.js +0 -3
- package/metadata/ColumnModifierMetadata.js.map +0 -1
- package/metadata/ColumnTypeMetadata.d.ts +0 -43
- package/metadata/ColumnTypeMetadata.js +0 -26
- package/metadata/ColumnTypeMetadata.js.map +0 -1
- package/metadata/MetadataStorage.d.ts +0 -13
- package/metadata/MetadataStorage.js +0 -19
- package/metadata/MetadataStorage.js.map +0 -1
- package/metadata/ModelMetadata.d.ts +0 -36
- package/metadata/ModelMetadata.js +0 -81
- package/metadata/ModelMetadata.js.map +0 -1
- package/metadata/index.d.ts +0 -10
- package/metadata/index.js +0 -33
- package/metadata/index.js.map +0 -1
- package/query/Comparer.d.ts +0 -1
- package/query/Comparer.js +0 -3
- package/query/Comparer.js.map +0 -1
- package/query/CountArgs.d.ts +0 -7
- package/query/CountArgs.js +0 -3
- package/query/CountArgs.js.map +0 -1
- package/query/CountResult.d.ts +0 -5
- package/query/CountResult.js +0 -3
- package/query/CountResult.js.map +0 -1
- package/query/CreateOptions.d.ts +0 -9
- package/query/CreateOptions.js +0 -3
- package/query/CreateOptions.js.map +0 -1
- package/query/CreateUpdateOptions.d.ts +0 -4
- package/query/CreateUpdateOptions.js +0 -3
- package/query/CreateUpdateOptions.js.map +0 -1
- package/query/DeleteOptions.d.ts +0 -12
- package/query/DeleteOptions.js +0 -3
- package/query/DeleteOptions.js.map +0 -1
- package/query/DestroyResult.d.ts +0 -5
- package/query/DestroyResult.js +0 -3
- package/query/DestroyResult.js.map +0 -1
- package/query/DoNotReturnRecords.d.ts +0 -3
- package/query/DoNotReturnRecords.js +0 -3
- package/query/DoNotReturnRecords.js.map +0 -1
- package/query/FindArgs.d.ts +0 -6
- package/query/FindArgs.js +0 -3
- package/query/FindArgs.js.map +0 -1
- package/query/FindOneArgs.d.ts +0 -11
- package/query/FindOneArgs.js +0 -3
- package/query/FindOneArgs.js.map +0 -1
- package/query/FindOneResult.d.ts +0 -12
- package/query/FindOneResult.js +0 -3
- package/query/FindOneResult.js.map +0 -1
- package/query/FindResult.d.ts +0 -15
- package/query/FindResult.js +0 -3
- package/query/FindResult.js.map +0 -1
- package/query/OnConflictOptions.d.ts +0 -25
- package/query/OnConflictOptions.js +0 -3
- package/query/OnConflictOptions.js.map +0 -1
- package/query/PaginateOptions.d.ts +0 -4
- package/query/PaginateOptions.js +0 -3
- package/query/PaginateOptions.js.map +0 -1
- package/query/PopulateArgs.d.ts +0 -13
- package/query/PopulateArgs.js +0 -3
- package/query/PopulateArgs.js.map +0 -1
- package/query/ReturnSelect.d.ts +0 -5
- package/query/ReturnSelect.js +0 -3
- package/query/ReturnSelect.js.map +0 -1
- package/query/Sort.d.ts +0 -15
- package/query/Sort.js +0 -3
- package/query/Sort.js.map +0 -1
- package/query/WhereQuery.d.ts +0 -21
- package/query/WhereQuery.js +0 -3
- package/query/WhereQuery.js.map +0 -1
- package/query/index.d.ts +0 -15
- package/query/index.js +0 -32
- package/query/index.js.map +0 -1
- package/types/ClassLike.d.ts +0 -8
- package/types/ClassLike.js +0 -3
- package/types/ClassLike.js.map +0 -1
- package/types/CreateUpdateParams.d.ts +0 -9
- package/types/CreateUpdateParams.js +0 -3
- package/types/CreateUpdateParams.js.map +0 -1
- package/types/EntityPrimitiveOrId.d.ts +0 -2
- package/types/EntityPrimitiveOrId.js +0 -3
- package/types/EntityPrimitiveOrId.js.map +0 -1
- package/types/ExcludeEntityCollections.d.ts +0 -5
- package/types/ExcludeEntityCollections.js +0 -3
- package/types/ExcludeEntityCollections.js.map +0 -1
- package/types/ExcludeFunctions.d.ts +0 -4
- package/types/ExcludeFunctions.js +0 -3
- package/types/ExcludeFunctions.js.map +0 -1
- package/types/GetValueType.d.ts +0 -1
- package/types/GetValueType.js +0 -3
- package/types/GetValueType.js.map +0 -1
- package/types/IncludeFunctions.d.ts +0 -4
- package/types/IncludeFunctions.js +0 -3
- package/types/IncludeFunctions.js.map +0 -1
- package/types/IsValueOfType.d.ts +0 -1
- package/types/IsValueOfType.js +0 -3
- package/types/IsValueOfType.js.map +0 -1
- package/types/OmitEntityCollections.d.ts +0 -7
- package/types/OmitEntityCollections.js +0 -3
- package/types/OmitEntityCollections.js.map +0 -1
- package/types/OmitFunctions.d.ts +0 -7
- package/types/OmitFunctions.js +0 -3
- package/types/OmitFunctions.js.map +0 -1
- package/types/PickAsType.d.ts +0 -3
- package/types/PickAsType.js +0 -3
- package/types/PickAsType.js.map +0 -1
- package/types/PickByValueType.d.ts +0 -5
- package/types/PickByValueType.js +0 -3
- package/types/PickByValueType.js.map +0 -1
- package/types/PickFunctions.d.ts +0 -4
- package/types/PickFunctions.js +0 -3
- package/types/PickFunctions.js.map +0 -1
- package/types/Populated.d.ts +0 -9
- package/types/Populated.js +0 -3
- package/types/Populated.js.map +0 -1
- package/types/QueryResult.d.ts +0 -9
- package/types/QueryResult.js +0 -3
- package/types/QueryResult.js.map +0 -1
- package/types/QueryResultOptionalPopulated.d.ts +0 -9
- package/types/QueryResultOptionalPopulated.js +0 -3
- package/types/QueryResultOptionalPopulated.js.map +0 -1
- package/types/QueryResultPopulated.d.ts +0 -9
- package/types/QueryResultPopulated.js +0 -3
- package/types/QueryResultPopulated.js.map +0 -1
- package/types/index.d.ts +0 -17
- package/types/index.js +0 -34
- package/types/index.js.map +0 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { defaultConfig } from 'eslint-config-decent';
|
|
2
|
+
import tsEslint from 'typescript-eslint';
|
|
3
|
+
|
|
4
|
+
export default tsEslint.config(
|
|
5
|
+
...defaultConfig(),
|
|
6
|
+
{
|
|
7
|
+
files: ['**/*.mjs'],
|
|
8
|
+
rules: {
|
|
9
|
+
'@typescript-eslint/no-unsafe-call': 'off',
|
|
10
|
+
'@typescript-eslint/no-unsafe-member-access': 'off',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
files: ['**/*.ts'],
|
|
15
|
+
rules: {
|
|
16
|
+
'@typescript-eslint/no-invalid-void-type': 'off',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
files: ['tests/**/*.ts'],
|
|
21
|
+
rules: {
|
|
22
|
+
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
);
|
package/package.json
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bigal",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.0-beta1",
|
|
4
4
|
"description": "A fast and lightweight orm for postgres and node.js, written in typescript.",
|
|
5
|
-
"main": "index.
|
|
6
|
-
"
|
|
5
|
+
"main": "./dist/index.cjs",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.mjs"
|
|
14
|
+
},
|
|
15
|
+
"require": {
|
|
16
|
+
"types": "./dist/index.d.cts",
|
|
17
|
+
"default": "./dist/index.cjs"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
7
21
|
"keywords": [
|
|
8
22
|
"orm",
|
|
9
23
|
"postgres",
|
|
@@ -19,66 +33,61 @@
|
|
|
19
33
|
"node": ">=18"
|
|
20
34
|
},
|
|
21
35
|
"dependencies": {
|
|
22
|
-
"@types/lodash": "^4.17.0",
|
|
23
|
-
"@types/pg": "^8.11.4",
|
|
24
36
|
"lodash": "^4.17.21",
|
|
25
|
-
"pg": "^8.
|
|
26
|
-
"postgres-pool": "^
|
|
37
|
+
"pg": "^8.12.0",
|
|
38
|
+
"postgres-pool": "^9.0.0-beta2"
|
|
27
39
|
},
|
|
28
40
|
"devDependencies": {
|
|
29
41
|
"@faker-js/faker": "^8.4.1",
|
|
30
|
-
"@types/chai": "^4.3.
|
|
31
|
-
"@types/
|
|
42
|
+
"@types/chai": "^4.3.16",
|
|
43
|
+
"@types/lodash": "^4.17.6",
|
|
44
|
+
"@types/mocha": "10.0.7",
|
|
32
45
|
"@types/node": ">=20",
|
|
33
|
-
"@
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"eslint": "^
|
|
37
|
-
"eslint-config-airbnb-base": "^15.0.0",
|
|
38
|
-
"eslint-config-airbnb-typescript": "^18.0.0",
|
|
39
|
-
"eslint-config-prettier": "^9.1.0",
|
|
40
|
-
"eslint-plugin-import": "^2.29.1",
|
|
41
|
-
"eslint-plugin-jsdoc": "^48.2.3",
|
|
42
|
-
"eslint-plugin-mocha": "10.4.1",
|
|
43
|
-
"eslint-plugin-prettier": "^5.1.3",
|
|
44
|
-
"eslint-plugin-promise": "^6.1.1",
|
|
45
|
-
"eslint-plugin-security": "^2.1.1",
|
|
46
|
+
"@types/pg": "^8.11.6",
|
|
47
|
+
"chai": "^5.1.1",
|
|
48
|
+
"eslint": "^9.6.0",
|
|
49
|
+
"eslint-config-decent": "^1.2.2",
|
|
46
50
|
"husky": "^9.0.11",
|
|
47
|
-
"lint-staged": "^15.2.
|
|
48
|
-
"markdownlint-cli": "^0.
|
|
49
|
-
"mocha": "^10.
|
|
51
|
+
"lint-staged": "^15.2.7",
|
|
52
|
+
"markdownlint-cli": "^0.41.0",
|
|
53
|
+
"mocha": "^10.5.2",
|
|
50
54
|
"npm-run-all": "^4.1.5",
|
|
51
55
|
"pinst": "^3.0.0",
|
|
52
|
-
"prettier": "^3.2
|
|
53
|
-
"rimraf": "^5.0.5",
|
|
56
|
+
"prettier": "^3.3.2",
|
|
54
57
|
"strict-event-emitter-types": "^2.0.0",
|
|
55
58
|
"ts-mockito": "^2.6.1",
|
|
56
59
|
"ts-node": "^10.9.2",
|
|
57
|
-
"typescript": "^5.
|
|
60
|
+
"typescript": "^5.5.3",
|
|
61
|
+
"typescript-eslint": "^8.0.0-alpha.39",
|
|
62
|
+
"unbuild": "^2.0.0"
|
|
58
63
|
},
|
|
59
64
|
"scripts": {
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"test": "mocha -r ts-node/register tests/**/*.tests.ts",
|
|
65
|
+
"build": "unbuild",
|
|
66
|
+
"check:types": "tsc --noEmit --skipLibCheck",
|
|
67
|
+
"test": "mocha --loader=ts-node/esm tests/**/*.tests.ts",
|
|
64
68
|
"lint:markdown": "prettier --write '*.md' '!(node_modules|dist)/**/*.md' && markdownlint '*.md' '!(node_modules|dist)/**/*.md' --config=.github/linters/.markdown-lint.yml --fix",
|
|
65
|
-
"lint:code": "eslint --fix
|
|
69
|
+
"lint:code": "eslint --fix",
|
|
66
70
|
"lint": "run-p lint:*",
|
|
67
71
|
"lint-staged": "lint-staged",
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"prepublishOnly": "if [ -d \"src\" ]; then echo \"Please use: npm run dist\" && exit 125; fi && pinst --disable",
|
|
72
|
+
"beta": "npm publish --tag beta",
|
|
73
|
+
"prepublishOnly": "npm run lint && npm run test && npm run build && pinst --disable",
|
|
71
74
|
"postpublish": "pinst --enable",
|
|
72
75
|
"prepare": "husky"
|
|
73
76
|
},
|
|
74
77
|
"lint-staged": {
|
|
75
78
|
"*.md": [
|
|
76
|
-
"prettier --write",
|
|
79
|
+
"prettier --write --cache",
|
|
77
80
|
"markdownlint --config=.github/linters/.markdown-lint.yml --fix"
|
|
78
81
|
],
|
|
79
82
|
"*.js": [
|
|
80
83
|
"eslint --fix"
|
|
81
84
|
],
|
|
85
|
+
"*.cjs": [
|
|
86
|
+
"eslint --fix"
|
|
87
|
+
],
|
|
88
|
+
"*.mjs": [
|
|
89
|
+
"eslint --fix"
|
|
90
|
+
],
|
|
82
91
|
"*.ts": [
|
|
83
92
|
"eslint --fix"
|
|
84
93
|
]
|
package/Entity.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { CreateUpdateParams } from './types';
|
|
2
|
-
export type EntityFieldValue = boolean[] | Date | number[] | Record<string, unknown> | string[] | boolean | number | string | unknown | null;
|
|
3
|
-
export declare abstract class Entity {
|
|
4
|
-
abstract id: unknown;
|
|
5
|
-
static beforeCreate(values: CreateUpdateParams<Entity>): CreateUpdateParams<Entity> | Promise<CreateUpdateParams<Entity>>;
|
|
6
|
-
static beforeUpdate(values: CreateUpdateParams<Entity>): CreateUpdateParams<Entity> | Promise<CreateUpdateParams<Entity>>;
|
|
7
|
-
}
|
|
8
|
-
export interface NotEntityBrand {
|
|
9
|
-
_notEntityBrand: void;
|
|
10
|
-
}
|
|
11
|
-
export type NotEntity<T> = NotEntityBrand & T;
|
|
12
|
-
export interface EntityStatic<T extends Entity> {
|
|
13
|
-
beforeCreate?: (values: CreateUpdateParams<any>) => CreateUpdateParams<any> | Promise<CreateUpdateParams<any>>;
|
|
14
|
-
beforeUpdate?: (values: CreateUpdateParams<any>) => CreateUpdateParams<any> | Promise<CreateUpdateParams<any>>;
|
|
15
|
-
new (): T;
|
|
16
|
-
}
|
package/Entity.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Entity = void 0;
|
|
4
|
-
class Entity {
|
|
5
|
-
static beforeCreate(values) {
|
|
6
|
-
return values;
|
|
7
|
-
}
|
|
8
|
-
static beforeUpdate(values) {
|
|
9
|
-
return values;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.Entity = Entity;
|
|
13
|
-
//# sourceMappingURL=Entity.js.map
|
package/Entity.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Entity.js","sourceRoot":"./","sources":["Entity.ts"],"names":[],"mappings":";;;AAKA,MAAsB,MAAM;IAGnB,MAAM,CAAC,YAAY,CAAC,MAAkC;QAC3D,OAAO,MAAM,CAAC;IAChB,CAAC;IAEM,MAAM,CAAC,YAAY,CAAC,MAAkC;QAC3D,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAVD,wBAUC"}
|
package/IReadonlyRepository.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { Entity } from './Entity';
|
|
2
|
-
import type { ModelMetadata } from './metadata';
|
|
3
|
-
import type { CountResult, FindArgs, FindOneArgs, FindOneResult, FindResult, WhereQuery } from './query';
|
|
4
|
-
import type { CountArgs } from './query/CountArgs';
|
|
5
|
-
import type { QueryResult } from './types';
|
|
6
|
-
export interface IReadonlyRepository<T extends Entity> {
|
|
7
|
-
readonly model: ModelMetadata<T>;
|
|
8
|
-
/**
|
|
9
|
-
* Gets a single object
|
|
10
|
-
* @param {object} [args] - Arguments
|
|
11
|
-
* @param {string[]} [args.select] - Array of model property names to return from the query.
|
|
12
|
-
* @param {object} [args.where] - Object representing the where query
|
|
13
|
-
* @param {string|object|string[]|object[]} [args.sort] - Property name(s) to sort by
|
|
14
|
-
* @param {object} [args.pool] - Override the db pool to use for the query
|
|
15
|
-
*/
|
|
16
|
-
findOne<K extends string & keyof T, TReturn = QueryResult<Pick<T, K | 'id'>>>(args: FindOneArgs<T, K> | WhereQuery<T>): FindOneResult<T, TReturn>;
|
|
17
|
-
/**
|
|
18
|
-
* Gets a collection of objects
|
|
19
|
-
* @param {object} [args] - Arguments
|
|
20
|
-
* @param {string[]} [args.select] - Array of model property names to return from the query.
|
|
21
|
-
* @param {object} [args.where] - Object representing the where query
|
|
22
|
-
* @param {string|object|string[]|object[]} [args.sort] - Property name(s) to sort by
|
|
23
|
-
* @param {string|number} [args.skip] - Number of records to skip
|
|
24
|
-
* @param {string|number} [args.limit] - Number of results to return
|
|
25
|
-
* @param {object} [args.pool] - Override the db pool to use for the query
|
|
26
|
-
*/
|
|
27
|
-
find<K extends string & keyof T, TReturn = QueryResult<Pick<T, K | 'id'>>>(args: FindArgs<T, K> | WhereQuery<T>): FindResult<T, TReturn>;
|
|
28
|
-
/**
|
|
29
|
-
* Gets a count of rows matching the where query
|
|
30
|
-
* @param {object} [args] - Arguments
|
|
31
|
-
* @param {object} [args.where] - Object representing the where query
|
|
32
|
-
* @param {object} [args.pool] - Override the db pool to use for the query
|
|
33
|
-
* @returns {number} Number of records matching the where criteria
|
|
34
|
-
*/
|
|
35
|
-
count(args?: CountArgs<T> | WhereQuery<T>): CountResult<T>;
|
|
36
|
-
}
|
package/IReadonlyRepository.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IReadonlyRepository.js","sourceRoot":"./","sources":["IReadonlyRepository.ts"],"names":[],"mappings":""}
|
package/IRepository.d.ts
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import type { Entity } from './Entity';
|
|
2
|
-
import type { IReadonlyRepository } from './IReadonlyRepository';
|
|
3
|
-
import type { CreateUpdateOptions, //
|
|
4
|
-
DeleteOptions, DestroyResult, DoNotReturnRecords, ReturnSelect, WhereQuery } from './query';
|
|
5
|
-
import type { CreateOptions } from './query/CreateOptions';
|
|
6
|
-
import type { OnConflictOptions } from './query/OnConflictOptions';
|
|
7
|
-
import type { CreateUpdateParams, QueryResult } from './types';
|
|
8
|
-
export interface IRepository<T extends Entity> extends IReadonlyRepository<T> {
|
|
9
|
-
/**
|
|
10
|
-
* Creates an object using the specified values
|
|
11
|
-
* @param {object} values - Values to insert as multiple new objects.
|
|
12
|
-
* @param {object} [options]
|
|
13
|
-
* @param {string[]} [options.returnSelect] - Array of model property names to return from the query.
|
|
14
|
-
* @param {object} [options.onConflict] - Options to handle conflicts due to a unique constraint or exclusion constraint error during insert
|
|
15
|
-
* @returns {object}
|
|
16
|
-
*/
|
|
17
|
-
create(values: CreateUpdateParams<T>, options?: OnConflictOptions<T> | (Partial<OnConflictOptions<T>> & ReturnSelect<T>)): Promise<QueryResult<T>>;
|
|
18
|
-
/**
|
|
19
|
-
* Creates an object or objects using the specified values
|
|
20
|
-
* @param {object|object[]} values - Values to insert as multiple new objects.
|
|
21
|
-
* @param {object} options
|
|
22
|
-
* @param {boolean} options.returnRecords - Determines if inserted records should be returned
|
|
23
|
-
* @param {object} [options.onConflict] - Options to handle conflicts due to a unique constraint or exclusion constraint error during insert
|
|
24
|
-
* @returns {void}
|
|
25
|
-
*/
|
|
26
|
-
create(values: CreateUpdateParams<T> | CreateUpdateParams<T>[], options: DoNotReturnRecords & Partial<OnConflictOptions<T>>): Promise<void>;
|
|
27
|
-
/**
|
|
28
|
-
* Creates objects using the specified values
|
|
29
|
-
* @param {object[]} values - Values to insert as multiple new objects.
|
|
30
|
-
* @param {object} [options]
|
|
31
|
-
* @param {object} [options.onConflict] - Options to handle conflicts due to a unique constraint or exclusion constraint error during insert
|
|
32
|
-
* @param {string[]} [options.returnSelect] - Array of model property names to return from the query.
|
|
33
|
-
* @returns {object[]}
|
|
34
|
-
*/
|
|
35
|
-
create(values: CreateUpdateParams<T>[], options?: (OnConflictOptions<T> & Partial<ReturnSelect<T>>) | (Partial<OnConflictOptions<T>> & ReturnSelect<T>)): Promise<QueryResult<T>[]>;
|
|
36
|
-
/**
|
|
37
|
-
* Creates an object using the specified values
|
|
38
|
-
* @param {object|object[]} values - Values to insert as a new object. If an array is specified, multiple rows will be inserted
|
|
39
|
-
* @param {object} [options]
|
|
40
|
-
* @param {boolean} [options.returnRecords=true] - Determines if inserted records should be returned
|
|
41
|
-
* @param {string[]} [options.returnSelect] - Array of model property names to return from the query.
|
|
42
|
-
* @param {object} [options.onConflict] - Options to handle conflicts due to a unique constraint or exclusion constraint error during insert
|
|
43
|
-
* @returns {object|object[]|void} Return value from the db
|
|
44
|
-
*/
|
|
45
|
-
create(values: CreateUpdateParams<T> | CreateUpdateParams<T>[], options?: CreateOptions<T>): Promise<QueryResult<T> | QueryResult<T>[] | void>;
|
|
46
|
-
/**
|
|
47
|
-
* Updates object(s) matching the where query, with the specified values
|
|
48
|
-
* @param {object} where - Object representing the where query
|
|
49
|
-
* @param {object} values - Values to update
|
|
50
|
-
* @param {object} options
|
|
51
|
-
* @param {boolean} options.returnRecords - Determines if inserted records should be returned
|
|
52
|
-
* @param {{returnRecords: false}} options
|
|
53
|
-
* @returns {void}
|
|
54
|
-
*/
|
|
55
|
-
update(where: WhereQuery<T>, values: CreateUpdateParams<T>, options: DoNotReturnRecords): Promise<void>;
|
|
56
|
-
/**
|
|
57
|
-
* Updates object(s) matching the where query, with the specified values
|
|
58
|
-
* @param {object} where - Object representing the where query
|
|
59
|
-
* @param {object} values - Values to update
|
|
60
|
-
* @param {object} [options] - Values to update
|
|
61
|
-
* @param {string[]} [options.returnSelect] - Array of model property names to return from the query.
|
|
62
|
-
* @returns {object[]}
|
|
63
|
-
*/
|
|
64
|
-
update(where: WhereQuery<T>, values: CreateUpdateParams<T>, options?: ReturnSelect<T>): Promise<QueryResult<T>[]>;
|
|
65
|
-
/**
|
|
66
|
-
* Updates object(s) matching the where query, with the specified values
|
|
67
|
-
* @param {object} where - Object representing the where query
|
|
68
|
-
* @param {object} values - Values to update
|
|
69
|
-
* @param {object} [options]
|
|
70
|
-
* @param {boolean} [options.returnRecords=true] - Determines if inserted records should be returned
|
|
71
|
-
* @param {string[]} [options.returnSelect] - Array of model property names to return from the query.
|
|
72
|
-
* @returns {object[]|void} Return values from the db or `true` if returnRecords=false
|
|
73
|
-
*/
|
|
74
|
-
update(where: WhereQuery<T>, values: CreateUpdateParams<T>, options?: CreateUpdateOptions<T>): Promise<QueryResult<T>[] | void>;
|
|
75
|
-
/**
|
|
76
|
-
* Destroys object(s) matching the where query
|
|
77
|
-
* @param {object} [where] - Object representing the where query
|
|
78
|
-
* @returns {void}
|
|
79
|
-
*/
|
|
80
|
-
destroy(where?: WhereQuery<T>): DestroyResult<T, void>;
|
|
81
|
-
/**
|
|
82
|
-
* Destroys object(s) matching the where query
|
|
83
|
-
* @param {object} where - Object representing the where query
|
|
84
|
-
* @param {object} options - Determines if inserted records should be returned
|
|
85
|
-
* @param {boolean} [options.returnRecords] - Determines if inserted records should be returned
|
|
86
|
-
* @param {string[]} [options.returnSelect] - Array of model property names to return from the query.
|
|
87
|
-
* @returns {object[]}
|
|
88
|
-
*/
|
|
89
|
-
destroy(where: WhereQuery<T>, options: DeleteOptions<T>): DestroyResult<T, QueryResult<T>[]>;
|
|
90
|
-
/**
|
|
91
|
-
* Destroys object(s) matching the where query
|
|
92
|
-
* @param {object} where - Object representing the where query
|
|
93
|
-
* @param {object} [options]
|
|
94
|
-
* @param {boolean} [options.returnRecords=false] - Determines if inserted records should be returned
|
|
95
|
-
* @param {string[]} [options.returnSelect] - Array of model property names to return from the query.
|
|
96
|
-
* @returns {object[]|void} `void` or records affected if returnRecords=true
|
|
97
|
-
*/
|
|
98
|
-
destroy<TOptions extends DeleteOptions<T> = DeleteOptions<T>>(where: WhereQuery<T>, options?: TOptions): DestroyResult<T, TOptions extends DeleteOptions<T> ? void : QueryResult<T>[]>;
|
|
99
|
-
}
|
package/IRepository.js
DELETED
package/IRepository.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IRepository.js","sourceRoot":"./","sources":["IRepository.ts"],"names":[],"mappings":""}
|
package/ReadonlyRepository.d.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import type { Pool } from 'postgres-pool';
|
|
2
|
-
import type { Entity, EntityStatic } from './Entity';
|
|
3
|
-
import type { IReadonlyRepository } from './IReadonlyRepository';
|
|
4
|
-
import type { IRepository } from './IRepository';
|
|
5
|
-
import type { ModelMetadata } from './metadata';
|
|
6
|
-
import type { CountResult, FindArgs, FindOneArgs, FindOneResult, FindResult, OrderBy, WhereQuery, SortObject } from './query';
|
|
7
|
-
import type { CountArgs } from './query/CountArgs';
|
|
8
|
-
import type { QueryResult, PickFunctions } from './types';
|
|
9
|
-
export interface IRepositoryOptions<T extends Entity> {
|
|
10
|
-
modelMetadata: ModelMetadata<T>;
|
|
11
|
-
type: EntityStatic<T>;
|
|
12
|
-
repositoriesByModelNameLowered: Record<string, IReadonlyRepository<Entity> | IRepository<Entity>>;
|
|
13
|
-
pool: Pool;
|
|
14
|
-
readonlyPool?: Pool;
|
|
15
|
-
}
|
|
16
|
-
interface Populate {
|
|
17
|
-
propertyName: string;
|
|
18
|
-
where?: WhereQuery<Entity>;
|
|
19
|
-
select?: string[];
|
|
20
|
-
sort?: SortObject<Entity> | string;
|
|
21
|
-
skip?: number;
|
|
22
|
-
limit?: number;
|
|
23
|
-
pool?: Pool;
|
|
24
|
-
}
|
|
25
|
-
export declare class ReadonlyRepository<T extends Entity> implements IReadonlyRepository<T> {
|
|
26
|
-
private readonly _modelMetadata;
|
|
27
|
-
protected _type: EntityStatic<T>;
|
|
28
|
-
protected _pool: Pool;
|
|
29
|
-
protected _readonlyPool: Pool;
|
|
30
|
-
protected _repositoriesByModelNameLowered: Record<string, IReadonlyRepository<Entity> | IRepository<Entity>>;
|
|
31
|
-
protected _floatProperties: string[];
|
|
32
|
-
protected _intProperties: string[];
|
|
33
|
-
constructor({ modelMetadata, type, pool, readonlyPool, repositoriesByModelNameLowered }: IRepositoryOptions<T>);
|
|
34
|
-
get model(): ModelMetadata<T>;
|
|
35
|
-
/**
|
|
36
|
-
* Gets a single object
|
|
37
|
-
* @param {object} [args] - Arguments
|
|
38
|
-
* @param {string[]} [args.select] - Array of model property names to return from the query.
|
|
39
|
-
* @param {object} [args.where] - Object representing the where query
|
|
40
|
-
* @param {string|object} [args.sort] - Property name(s) to sort by
|
|
41
|
-
*/
|
|
42
|
-
findOne<K extends string & keyof T, TReturn = QueryResult<Pick<T, K | keyof PickFunctions<T> | 'id'>>>(args?: FindOneArgs<T, K> | WhereQuery<T>): FindOneResult<T, TReturn>;
|
|
43
|
-
/**
|
|
44
|
-
* Gets a collection of objects
|
|
45
|
-
* @param {object} [args] - Arguments
|
|
46
|
-
* @param {string[]} [args.select] - Array of model property names to return from the query.
|
|
47
|
-
* @param {object} [args.where] - Object representing the where query
|
|
48
|
-
* @param {string|object} [args.sort] - Property name(s) to sort by
|
|
49
|
-
* @param {string|number} [args.skip] - Number of records to skip
|
|
50
|
-
* @param {string|number} [args.limit] - Number of results to return
|
|
51
|
-
*/
|
|
52
|
-
find<K extends string & keyof T, TReturn = QueryResult<Pick<T, K | keyof PickFunctions<T> | 'id'>>>(args?: FindArgs<T, K> | WhereQuery<T>): FindResult<T, TReturn>;
|
|
53
|
-
/**
|
|
54
|
-
* Gets a count of rows matching the where query
|
|
55
|
-
* @param {object} [args] - Arguments
|
|
56
|
-
* @param {object} [args.where] - Object representing the where query
|
|
57
|
-
* @param {object} [args.pool] - Override the db pool to use for the query
|
|
58
|
-
* @returns {number} Number of records matching the where criteria
|
|
59
|
-
*/
|
|
60
|
-
count(args?: CountArgs<T> | WhereQuery<T>): CountResult<T>;
|
|
61
|
-
protected _buildInstance(row: Partial<QueryResult<T>>): QueryResult<T>;
|
|
62
|
-
protected _buildInstances(rows: Partial<QueryResult<T>>[]): QueryResult<T>[];
|
|
63
|
-
protected _convertSortsToOrderBy(sorts: SortObject<T> | string): OrderBy<T>[];
|
|
64
|
-
protected populateFields(entities: QueryResult<T>[], populates: Populate[]): Promise<void>;
|
|
65
|
-
private populateSingleAssociation;
|
|
66
|
-
private populateOneManyCollection;
|
|
67
|
-
private populateManyManyCollection;
|
|
68
|
-
}
|
|
69
|
-
export {};
|