@theshelf/database 0.0.1 → 0.0.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.
- package/dist/Database.d.ts +2 -2
- package/dist/Database.js +1 -1
- package/dist/definitions/interfaces.d.ts +1 -1
- package/dist/definitions/types.d.ts +1 -1
- package/dist/errors/NotConnected.d.ts +1 -1
- package/dist/errors/NotConnected.js +1 -1
- package/dist/errors/RecordNotCreated.d.ts +1 -1
- package/dist/errors/RecordNotCreated.js +1 -1
- package/dist/errors/RecordNotDeleted.d.ts +1 -1
- package/dist/errors/RecordNotDeleted.js +1 -1
- package/dist/errors/RecordNotFound.d.ts +1 -1
- package/dist/errors/RecordNotFound.js +1 -1
- package/dist/errors/RecordNotUpdated.d.ts +1 -1
- package/dist/errors/RecordNotUpdated.js +1 -1
- package/dist/errors/RecordsNotDeleted.d.ts +1 -1
- package/dist/errors/RecordsNotDeleted.js +1 -1
- package/dist/errors/RecordsNotUpdated.d.ts +1 -1
- package/dist/errors/RecordsNotUpdated.js +1 -1
- package/dist/errors/UnknownImplementation.d.ts +1 -1
- package/dist/errors/UnknownImplementation.js +1 -1
- package/dist/implementation.d.ts +1 -1
- package/dist/implementation.js +3 -3
- package/dist/implementations/memory/Memory.d.ts +2 -2
- package/dist/implementations/memory/Memory.js +4 -4
- package/dist/implementations/memory/create.d.ts +1 -1
- package/dist/implementations/memory/create.js +1 -1
- package/dist/implementations/mongodb/MongoDb.d.ts +2 -2
- package/dist/implementations/mongodb/MongoDb.js +9 -9
- package/dist/implementations/mongodb/create.d.ts +1 -1
- package/dist/implementations/mongodb/create.js +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.js +10 -10
- package/package.json +1 -2
package/dist/Database.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Driver } from './definitions/interfaces';
|
|
2
|
-
import type { RecordData, RecordField, RecordId, RecordQuery, RecordSort, RecordType } from './definitions/types';
|
|
1
|
+
import type { Driver } from './definitions/interfaces.js';
|
|
2
|
+
import type { RecordData, RecordField, RecordId, RecordQuery, RecordSort, RecordType } from './definitions/types.js';
|
|
3
3
|
export default class Database implements Driver {
|
|
4
4
|
#private;
|
|
5
5
|
constructor(driver: Driver);
|
package/dist/Database.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RecordData, RecordField, RecordId, RecordQuery, RecordSort, RecordType } from './types';
|
|
1
|
+
import type { RecordData, RecordField, RecordId, RecordQuery, RecordSort, RecordType } from './types.js';
|
|
2
2
|
export interface Driver {
|
|
3
3
|
get connected(): boolean;
|
|
4
4
|
connect(): Promise<void>;
|
package/dist/implementation.d.ts
CHANGED
package/dist/implementation.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import UnknownImplementation from './errors/UnknownImplementation';
|
|
2
|
-
import createMemoryDb from './implementations/memory/create';
|
|
3
|
-
import createMongoDb from './implementations/mongodb/create';
|
|
1
|
+
import UnknownImplementation from './errors/UnknownImplementation.js';
|
|
2
|
+
import createMemoryDb from './implementations/memory/create.js';
|
|
3
|
+
import createMongoDb from './implementations/mongodb/create.js';
|
|
4
4
|
const implementations = new Map([
|
|
5
5
|
['memory', createMemoryDb],
|
|
6
6
|
['mongodb', createMongoDb],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Driver } from '../../definitions/interfaces';
|
|
2
|
-
import type { QueryStatement, RecordData, RecordSort } from '../../definitions/types';
|
|
1
|
+
import type { Driver } from '../../definitions/interfaces.js';
|
|
2
|
+
import type { QueryStatement, RecordData, RecordSort } from '../../definitions/types.js';
|
|
3
3
|
export default class Memory implements Driver {
|
|
4
4
|
#private;
|
|
5
5
|
recordId: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { LogicalOperators, QueryOperators, SortDirections } from '../../definitions/constants';
|
|
2
|
-
import NotConnected from '../../errors/NotConnected';
|
|
3
|
-
import RecordNotFound from '../../errors/RecordNotFound';
|
|
4
|
-
import RecordNotUpdated from '../../errors/RecordNotUpdated';
|
|
1
|
+
import { LogicalOperators, QueryOperators, SortDirections } from '../../definitions/constants.js';
|
|
2
|
+
import NotConnected from '../../errors/NotConnected.js';
|
|
3
|
+
import RecordNotFound from '../../errors/RecordNotFound.js';
|
|
4
|
+
import RecordNotUpdated from '../../errors/RecordNotUpdated.js';
|
|
5
5
|
const OPERATORS = {
|
|
6
6
|
[QueryOperators.EQUALS]: '==',
|
|
7
7
|
[QueryOperators.GREATER_THAN]: '>',
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import Memory from './Memory';
|
|
1
|
+
import Memory from './Memory.js';
|
|
2
2
|
export default function create(): Memory;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Driver } from '../../definitions/interfaces';
|
|
2
|
-
import type { RecordData, RecordField, RecordId, RecordQuery, RecordSort, RecordType } from '../../definitions/types';
|
|
1
|
+
import type { Driver } from '../../definitions/interfaces.js';
|
|
2
|
+
import type { RecordData, RecordField, RecordId, RecordQuery, RecordSort, RecordType } from '../../definitions/types.js';
|
|
3
3
|
export default class MongoDB implements Driver {
|
|
4
4
|
#private;
|
|
5
5
|
constructor(connectionString: string, databaseName: string);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/* eslint @typescript-eslint/no-explicit-any: "off" */
|
|
2
2
|
import { MongoClient } from 'mongodb';
|
|
3
|
-
import { ID, LogicalOperators, QueryOperators, SortDirections } from '../../definitions/constants';
|
|
4
|
-
import DatabaseError from '../../errors/DatabaseError';
|
|
5
|
-
import NotConnected from '../../errors/NotConnected';
|
|
6
|
-
import RecordNotCreated from '../../errors/RecordNotCreated';
|
|
7
|
-
import RecordNotDeleted from '../../errors/RecordNotDeleted';
|
|
8
|
-
import RecordNotFound from '../../errors/RecordNotFound';
|
|
9
|
-
import RecordNotUpdated from '../../errors/RecordNotUpdated';
|
|
10
|
-
import RecordsNotDeleted from '../../errors/RecordsNotDeleted';
|
|
11
|
-
import RecordsNotUpdated from '../../errors/RecordsNotUpdated';
|
|
3
|
+
import { ID, LogicalOperators, QueryOperators, SortDirections } from '../../definitions/constants.js';
|
|
4
|
+
import DatabaseError from '../../errors/DatabaseError.js';
|
|
5
|
+
import NotConnected from '../../errors/NotConnected.js';
|
|
6
|
+
import RecordNotCreated from '../../errors/RecordNotCreated.js';
|
|
7
|
+
import RecordNotDeleted from '../../errors/RecordNotDeleted.js';
|
|
8
|
+
import RecordNotFound from '../../errors/RecordNotFound.js';
|
|
9
|
+
import RecordNotUpdated from '../../errors/RecordNotUpdated.js';
|
|
10
|
+
import RecordsNotDeleted from '../../errors/RecordsNotDeleted.js';
|
|
11
|
+
import RecordsNotUpdated from '../../errors/RecordsNotUpdated.js';
|
|
12
12
|
const UNKNOWN_ERROR = 'Unknown error';
|
|
13
13
|
const OPERATORS = {
|
|
14
14
|
[QueryOperators.EQUALS]: '$eq',
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import MongoDb from './MongoDb';
|
|
1
|
+
import MongoDb from './MongoDb.js';
|
|
2
2
|
export default function create(): MongoDb;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import Database from './Database';
|
|
1
|
+
import Database from './Database.js';
|
|
2
2
|
declare const database: Database;
|
|
3
|
-
export * from './definitions/constants';
|
|
4
|
-
export * from './definitions/types';
|
|
5
|
-
export { default as DatabaseError } from './errors/DatabaseError';
|
|
6
|
-
export { default as NotConnected } from './errors/NotConnected';
|
|
7
|
-
export { default as RecordNotCreated } from './errors/RecordNotCreated';
|
|
8
|
-
export { default as RecordNotDeleted } from './errors/RecordNotDeleted';
|
|
9
|
-
export { default as RecordNotFound } from './errors/RecordNotFound';
|
|
10
|
-
export { default as RecordNotUpdated } from './errors/RecordNotUpdated';
|
|
3
|
+
export * from './definitions/constants.js';
|
|
4
|
+
export * from './definitions/types.js';
|
|
5
|
+
export { default as DatabaseError } from './errors/DatabaseError.js';
|
|
6
|
+
export { default as NotConnected } from './errors/NotConnected.js';
|
|
7
|
+
export { default as RecordNotCreated } from './errors/RecordNotCreated.js';
|
|
8
|
+
export { default as RecordNotDeleted } from './errors/RecordNotDeleted.js';
|
|
9
|
+
export { default as RecordNotFound } from './errors/RecordNotFound.js';
|
|
10
|
+
export { default as RecordNotUpdated } from './errors/RecordNotUpdated.js';
|
|
11
11
|
export type { Database };
|
|
12
12
|
export default database;
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import Database from './Database';
|
|
2
|
-
import implementation from './implementation';
|
|
1
|
+
import Database from './Database.js';
|
|
2
|
+
import implementation from './implementation.js';
|
|
3
3
|
const database = new Database(implementation);
|
|
4
|
-
export * from './definitions/constants';
|
|
5
|
-
export * from './definitions/types';
|
|
6
|
-
export { default as DatabaseError } from './errors/DatabaseError';
|
|
7
|
-
export { default as NotConnected } from './errors/NotConnected';
|
|
8
|
-
export { default as RecordNotCreated } from './errors/RecordNotCreated';
|
|
9
|
-
export { default as RecordNotDeleted } from './errors/RecordNotDeleted';
|
|
10
|
-
export { default as RecordNotFound } from './errors/RecordNotFound';
|
|
11
|
-
export { default as RecordNotUpdated } from './errors/RecordNotUpdated';
|
|
4
|
+
export * from './definitions/constants.js';
|
|
5
|
+
export * from './definitions/types.js';
|
|
6
|
+
export { default as DatabaseError } from './errors/DatabaseError.js';
|
|
7
|
+
export { default as NotConnected } from './errors/NotConnected.js';
|
|
8
|
+
export { default as RecordNotCreated } from './errors/RecordNotCreated.js';
|
|
9
|
+
export { default as RecordNotDeleted } from './errors/RecordNotDeleted.js';
|
|
10
|
+
export { default as RecordNotFound } from './errors/RecordNotFound.js';
|
|
11
|
+
export { default as RecordNotUpdated } from './errors/RecordNotUpdated.js';
|
|
12
12
|
export default database;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theshelf/database",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "tsc",
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
"types": "dist/index.d.ts",
|
|
20
20
|
"exports": "./dist/index.js",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@theshelf/errors": "*",
|
|
23
22
|
"mongodb": "7.0.0",
|
|
24
23
|
"sanitize-html": "2.17.0"
|
|
25
24
|
}
|