@marketeer-intelligence/framework-device 0.1.0-alpha.4 → 0.1.0-alpha.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. package/dist/data-source/MarketIndexTableParaser.d.ts +8 -0
  2. package/dist/data-source/MarketIndexTableParaser.d.ts.map +1 -0
  3. package/dist/data-source/MarketIndexTableParaser.js +62 -0
  4. package/dist/data-source/MarketIndexTableParaser.js.map +1 -0
  5. package/dist/data-source/SecurityTableParaser.d.ts +7 -7
  6. package/dist/data-source/SecurityTableParaser.js +71 -71
  7. package/dist/data-source/StaticWebpageScraper.d.ts +11 -11
  8. package/dist/data-source/StaticWebpageScraper.js +49 -49
  9. package/dist/data-source/Webpage.d.ts +10 -10
  10. package/dist/data-source/Webpage.js +21 -21
  11. package/dist/data-source/WebpageBody.d.ts +10 -10
  12. package/dist/data-source/WebpageBody.js +33 -33
  13. package/dist/data-source/WebpageUrl.d.ts +10 -10
  14. package/dist/data-source/WebpageUrl.js +38 -38
  15. package/dist/data-source/index.d.ts +7 -6
  16. package/dist/data-source/index.d.ts.map +1 -1
  17. package/dist/data-source/index.js +7 -6
  18. package/dist/data-source/index.js.map +1 -1
  19. package/dist/data-store/InstrumentMongoDbCollection.d.ts +11 -11
  20. package/dist/data-store/InstrumentMongoDbCollection.js +57 -57
  21. package/dist/data-store/SecurityMongoDbCollection.d.ts +11 -11
  22. package/dist/data-store/SecurityMongoDbCollection.js +66 -66
  23. package/dist/data-store/index.d.ts +3 -3
  24. package/dist/data-store/index.js +3 -3
  25. package/dist/index.d.ts +4 -4
  26. package/dist/index.js +4 -4
  27. package/dist/task/ConfigureEnvironmentVariables.d.ts +9 -9
  28. package/dist/task/ConfigureEnvironmentVariables.js +31 -31
  29. package/dist/task/ConnectToMongoDb.d.ts +8 -8
  30. package/dist/task/ConnectToMongoDb.js +28 -28
  31. package/dist/task/DisconnectFromMongoDb.d.ts +7 -7
  32. package/dist/task/DisconnectFromMongoDb.js +25 -25
  33. package/dist/task/MongoDbUri.d.ts +10 -10
  34. package/dist/task/MongoDbUri.js +38 -38
  35. package/dist/task/index.d.ts +5 -5
  36. package/dist/task/index.js +5 -5
  37. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/data-source/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAE3B,OAAO,EAAC,oBAAoB,EAAC,MAAM,2BAA2B,CAAA;AAC9D,OAAO,EACL,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAC,eAAe,EAAE,OAAO,EAAC,MAAM,cAAc,CAAA;AACrD,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,aAAa,GACd,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,UAAU,EACV,YAAY,GACb,MAAM,iBAAiB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/data-source/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAE3B,OAAO,EAAC,uBAAuB,EAAC,MAAM,8BAA8B,CAAA;AACpE,OAAO,EAAC,oBAAoB,EAAC,MAAM,2BAA2B,CAAA;AAC9D,OAAO,EACL,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAC,eAAe,EAAE,OAAO,EAAC,MAAM,cAAc,CAAA;AACrD,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,aAAa,GACd,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,UAAU,EACV,YAAY,GACb,MAAM,iBAAiB,CAAA"}
@@ -1,7 +1,8 @@
1
- export * from '../index.js';
2
- export { SecurityTableParaser } from './SecurityTableParaser.js';
3
- export { StaticWebpageScraper, } from './StaticWebpageScraper.js';
4
- export { Webpage } from './Webpage.js';
5
- export { isWebpageBodyValue, WebpageBody, isWebpageBody, } from './WebpageBody.js';
6
- export { isWebpageUrlValue, WebpageUrl, isWebpageUrl, } from './WebpageUrl.js';
1
+ export * from '../index.js';
2
+ export { MarketIndexTableParaser } from './MarketIndexTableParaser.js';
3
+ export { SecurityTableParaser } from './SecurityTableParaser.js';
4
+ export { StaticWebpageScraper, } from './StaticWebpageScraper.js';
5
+ export { Webpage } from './Webpage.js';
6
+ export { isWebpageBodyValue, WebpageBody, isWebpageBody, } from './WebpageBody.js';
7
+ export { isWebpageUrlValue, WebpageUrl, isWebpageUrl, } from './WebpageUrl.js';
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data-source/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAE3B,OAAO,EAAC,oBAAoB,EAAC,MAAM,2BAA2B,CAAA;AAC9D,OAAO,EAEL,oBAAoB,GACrB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAkB,OAAO,EAAC,MAAM,cAAc,CAAA;AACrD,OAAO,EAEL,kBAAkB,EAClB,WAAW,EACX,aAAa,GACd,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAEL,iBAAiB,EACjB,UAAU,EACV,YAAY,GACb,MAAM,iBAAiB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data-source/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAE3B,OAAO,EAAC,uBAAuB,EAAC,MAAM,8BAA8B,CAAA;AACpE,OAAO,EAAC,oBAAoB,EAAC,MAAM,2BAA2B,CAAA;AAC9D,OAAO,EAEL,oBAAoB,GACrB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAkB,OAAO,EAAC,MAAM,cAAc,CAAA;AACrD,OAAO,EAEL,kBAAkB,EAClB,WAAW,EACX,aAAa,GACd,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAEL,iBAAiB,EACjB,UAAU,EACV,YAAY,GACb,MAAM,iBAAiB,CAAA"}
@@ -1,12 +1,12 @@
1
- import { IStorable, Instrument, Status } from './index.js';
2
- export declare class InstrumentMongoDbCollection implements IStorable<Instrument[]> {
3
- private readonly _name;
4
- private readonly _schema;
5
- private _model;
6
- private constructor();
7
- private static _instance;
8
- static create(): InstrumentMongoDbCollection;
9
- upsert(instrument: Instrument): Promise<Status<Error>>;
10
- store(instruments: Instrument[]): Promise<Status<Error>>;
11
- }
1
+ import { IStorable, Instrument, Status } from './index.js';
2
+ export declare class InstrumentMongoDbCollection implements IStorable<Instrument[]> {
3
+ private readonly _name;
4
+ private readonly _schema;
5
+ private _model;
6
+ private constructor();
7
+ private static _instance;
8
+ static create(): InstrumentMongoDbCollection;
9
+ upsert(instrument: Instrument): Promise<Status<Error>>;
10
+ store(instruments: Instrument[]): Promise<Status<Error>>;
11
+ }
12
12
  //# sourceMappingURL=InstrumentMongoDbCollection.d.ts.map
@@ -1,58 +1,58 @@
1
- import { Failure, Success, } from './index.js';
2
- import { Schema as MongooseSchema, model as mongooseModel, } from 'mongoose';
3
- export class InstrumentMongoDbCollection {
4
- _name = 'instruments';
5
- _schema = new MongooseSchema({
6
- isin: { type: String, required: true, unique: true },
7
- symbol: { type: String, required: true, unique: true },
8
- name: { type: String, required: true },
9
- cfi: { type: String, required: true },
10
- published: { type: String, required: true },
11
- }, {
12
- collection: this._name,
13
- timestamps: true,
14
- });
15
- _model;
16
- constructor() {
17
- this._model = mongooseModel(this._name, this._schema);
18
- }
19
- static _instance;
20
- static create() {
21
- return (this._instance || (this._instance = new InstrumentMongoDbCollection()));
22
- }
23
- async upsert(instrument) {
24
- try {
25
- await this._model.updateOne({ isin: instrument.value.isin }, { $set: instrument.value }, { upsert: true, new: true });
26
- return Success.create();
27
- }
28
- catch (error) {
29
- if (error instanceof Error) {
30
- return Failure.create(error);
31
- }
32
- console.log(error);
33
- return Failure.create(new Error('unknown error'));
34
- }
35
- }
36
- async store(instruments) {
37
- try {
38
- for (const [index, instrument] of instruments.entries()) {
39
- try {
40
- await this.upsert(instrument);
41
- }
42
- catch (error) {
43
- console.log(`instrument #${index + 1} is skipped`);
44
- console.log(error instanceof Error ? error.message : error);
45
- continue;
46
- }
47
- }
48
- return Success.create();
49
- }
50
- catch (error) {
51
- if (error instanceof Error) {
52
- return Failure.create(error);
53
- }
54
- throw error;
55
- }
56
- }
57
- }
1
+ import { Failure, Success, } from './index.js';
2
+ import { Schema as MongooseSchema, model as mongooseModel, } from 'mongoose';
3
+ export class InstrumentMongoDbCollection {
4
+ _name = 'instruments';
5
+ _schema = new MongooseSchema({
6
+ isin: { type: String, required: true, unique: true },
7
+ symbol: { type: String, required: true, unique: true },
8
+ name: { type: String, required: true },
9
+ cfi: { type: String, required: true },
10
+ published: { type: String, required: true },
11
+ }, {
12
+ collection: this._name,
13
+ timestamps: true,
14
+ });
15
+ _model;
16
+ constructor() {
17
+ this._model = mongooseModel(this._name, this._schema);
18
+ }
19
+ static _instance;
20
+ static create() {
21
+ return (this._instance || (this._instance = new InstrumentMongoDbCollection()));
22
+ }
23
+ async upsert(instrument) {
24
+ try {
25
+ await this._model.updateOne({ isin: instrument.value.isin }, { $set: instrument.value }, { upsert: true, new: true });
26
+ return Success.create();
27
+ }
28
+ catch (error) {
29
+ if (error instanceof Error) {
30
+ return Failure.create(error);
31
+ }
32
+ console.log(error);
33
+ return Failure.create(new Error('unknown error'));
34
+ }
35
+ }
36
+ async store(instruments) {
37
+ try {
38
+ for (const [index, instrument] of instruments.entries()) {
39
+ try {
40
+ await this.upsert(instrument);
41
+ }
42
+ catch (error) {
43
+ console.log(`instrument #${index + 1} is skipped`);
44
+ console.log(error instanceof Error ? error.message : error);
45
+ continue;
46
+ }
47
+ }
48
+ return Success.create();
49
+ }
50
+ catch (error) {
51
+ if (error instanceof Error) {
52
+ return Failure.create(error);
53
+ }
54
+ throw error;
55
+ }
56
+ }
57
+ }
58
58
  //# sourceMappingURL=InstrumentMongoDbCollection.js.map
@@ -1,12 +1,12 @@
1
- import { IStorable, Security, Status } from './index.js';
2
- export declare class SecurityMongoDbCollection implements IStorable<Security[]> {
3
- private readonly _name;
4
- private readonly _schema;
5
- private _model;
6
- private constructor();
7
- private static _instance;
8
- static create(): SecurityMongoDbCollection;
9
- upsert(security: Security): Promise<Status<Error>>;
10
- store(securities: Security[]): Promise<Status<Error>>;
11
- }
1
+ import { IStorable, Security, Status } from './index.js';
2
+ export declare class SecurityMongoDbCollection implements IStorable<Security[]> {
3
+ private readonly _name;
4
+ private readonly _schema;
5
+ private _model;
6
+ private constructor();
7
+ private static _instance;
8
+ static create(): SecurityMongoDbCollection;
9
+ upsert(security: Security): Promise<Status<Error>>;
10
+ store(securities: Security[]): Promise<Status<Error>>;
11
+ }
12
12
  //# sourceMappingURL=SecurityMongoDbCollection.d.ts.map
@@ -1,67 +1,67 @@
1
- import { Failure, Success, } from './index.js';
2
- import { Schema as MongooseSchema, model as mongooseModel, } from 'mongoose';
3
- export class SecurityMongoDbCollection {
4
- _name = 'securities';
5
- _schema = new MongooseSchema({
6
- instrument: {
7
- type: {
8
- isin: { type: String, required: true, unique: true },
9
- symbol: { type: String, required: true, unique: true },
10
- name: { type: String, required: true },
11
- cfi: { type: String, required: true },
12
- published: { type: String, required: true },
13
- },
14
- required: true,
15
- unique: true,
16
- },
17
- type: { type: String, required: false },
18
- market: { type: String, required: false },
19
- industry: { type: String, required: false },
20
- }, {
21
- collection: this._name,
22
- timestamps: true,
23
- });
24
- _model;
25
- constructor() {
26
- this._model = mongooseModel(this._name, this._schema);
27
- }
28
- static _instance;
29
- static create() {
30
- return this._instance || (this._instance = new SecurityMongoDbCollection());
31
- }
32
- async upsert(security) {
33
- try {
34
- await this._model.updateOne({ 'instrument.isin': security.value.instrument.isin }, { $set: security.value }, { upsert: true, new: true });
35
- return Success.create();
36
- }
37
- catch (error) {
38
- if (error instanceof Error) {
39
- return Failure.create(error);
40
- }
41
- console.log(error);
42
- return Failure.create(new Error('unknown error'));
43
- }
44
- }
45
- async store(securities) {
46
- try {
47
- for (const [index, security] of securities.entries()) {
48
- try {
49
- await this.upsert(security);
50
- }
51
- catch (error) {
52
- console.log(`security #${index + 1} is skipped`);
53
- console.log(error instanceof Error ? error.message : error);
54
- continue;
55
- }
56
- }
57
- return Success.create();
58
- }
59
- catch (error) {
60
- if (error instanceof Error) {
61
- return Failure.create(error);
62
- }
63
- throw error;
64
- }
65
- }
66
- }
1
+ import { Failure, Success, } from './index.js';
2
+ import { Schema as MongooseSchema, model as mongooseModel, } from 'mongoose';
3
+ export class SecurityMongoDbCollection {
4
+ _name = 'securities';
5
+ _schema = new MongooseSchema({
6
+ instrument: {
7
+ type: {
8
+ isin: { type: String, required: true, unique: true },
9
+ symbol: { type: String, required: true, unique: true },
10
+ name: { type: String, required: true },
11
+ cfi: { type: String, required: true },
12
+ published: { type: String, required: true },
13
+ },
14
+ required: true,
15
+ unique: true,
16
+ },
17
+ type: { type: String, required: false },
18
+ market: { type: String, required: false },
19
+ industry: { type: String, required: false },
20
+ }, {
21
+ collection: this._name,
22
+ timestamps: true,
23
+ });
24
+ _model;
25
+ constructor() {
26
+ this._model = mongooseModel(this._name, this._schema);
27
+ }
28
+ static _instance;
29
+ static create() {
30
+ return this._instance || (this._instance = new SecurityMongoDbCollection());
31
+ }
32
+ async upsert(security) {
33
+ try {
34
+ await this._model.updateOne({ 'instrument.isin': security.value.instrument.isin }, { $set: security.value }, { upsert: true, new: true });
35
+ return Success.create();
36
+ }
37
+ catch (error) {
38
+ if (error instanceof Error) {
39
+ return Failure.create(error);
40
+ }
41
+ console.log(error);
42
+ return Failure.create(new Error('unknown error'));
43
+ }
44
+ }
45
+ async store(securities) {
46
+ try {
47
+ for (const [index, security] of securities.entries()) {
48
+ try {
49
+ await this.upsert(security);
50
+ }
51
+ catch (error) {
52
+ console.log(`security #${index + 1} is skipped`);
53
+ console.log(error instanceof Error ? error.message : error);
54
+ continue;
55
+ }
56
+ }
57
+ return Success.create();
58
+ }
59
+ catch (error) {
60
+ if (error instanceof Error) {
61
+ return Failure.create(error);
62
+ }
63
+ throw error;
64
+ }
65
+ }
66
+ }
67
67
  //# sourceMappingURL=SecurityMongoDbCollection.js.map
@@ -1,4 +1,4 @@
1
- export * from '../index.js';
2
- export { InstrumentMongoDbCollection } from './InstrumentMongoDbCollection.js';
3
- export { SecurityMongoDbCollection } from './SecurityMongoDbCollection.js';
1
+ export * from '../index.js';
2
+ export { InstrumentMongoDbCollection } from './InstrumentMongoDbCollection.js';
3
+ export { SecurityMongoDbCollection } from './SecurityMongoDbCollection.js';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- export * from '../index.js';
2
- export { InstrumentMongoDbCollection } from './InstrumentMongoDbCollection.js';
3
- export { SecurityMongoDbCollection } from './SecurityMongoDbCollection.js';
1
+ export * from '../index.js';
2
+ export { InstrumentMongoDbCollection } from './InstrumentMongoDbCollection.js';
3
+ export { SecurityMongoDbCollection } from './SecurityMongoDbCollection.js';
4
4
  //# sourceMappingURL=index.js.map
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export * from '@marketeer-intelligence/infrastructure';
2
- export * from './data-source/index.js';
3
- export * from './data-store/index.js';
4
- export * from './task/index.js';
1
+ export * from '@marketeer-intelligence/infrastructure';
2
+ export * from './data-source/index.js';
3
+ export * from './data-store/index.js';
4
+ export * from './task/index.js';
5
5
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- export * from '@marketeer-intelligence/infrastructure';
2
- export * from './data-source/index.js';
3
- export * from './data-store/index.js';
4
- export * from './task/index.js';
1
+ export * from '@marketeer-intelligence/infrastructure';
2
+ export * from './data-source/index.js';
3
+ export * from './data-store/index.js';
4
+ export * from './task/index.js';
5
5
  //# sourceMappingURL=index.js.map
@@ -1,10 +1,10 @@
1
- import { IRunnable, Status } from './index.js';
2
- export declare class ConfigureEnvironmentVariables implements IRunnable {
3
- private _configured;
4
- private constructor();
5
- private static _instance;
6
- static create(): ConfigureEnvironmentVariables;
7
- get configured(): boolean;
8
- run(): Promise<Status<Error>>;
9
- }
1
+ import { IRunnable, Status } from './index.js';
2
+ export declare class ConfigureEnvironmentVariables implements IRunnable {
3
+ private _configured;
4
+ private constructor();
5
+ private static _instance;
6
+ static create(): ConfigureEnvironmentVariables;
7
+ get configured(): boolean;
8
+ run(): Promise<Status<Error>>;
9
+ }
10
10
  //# sourceMappingURL=ConfigureEnvironmentVariables.d.ts.map
@@ -1,32 +1,32 @@
1
- import { Failure, Success } from './index.js';
2
- import dotenv from 'dotenv-safe';
3
- export class ConfigureEnvironmentVariables {
4
- _configured;
5
- constructor() {
6
- this._configured = false;
7
- }
8
- static _instance;
9
- static create() {
10
- return (this._instance || (this._instance = new ConfigureEnvironmentVariables()));
11
- }
12
- get configured() {
13
- return this._configured;
14
- }
15
- async run() {
16
- try {
17
- if (!this._configured) {
18
- dotenv.config();
19
- this._configured = true;
20
- console.log('environment variables have been loaded');
21
- }
22
- return Success.create();
23
- }
24
- catch (error) {
25
- if (error instanceof Error) {
26
- return Failure.create(error);
27
- }
28
- throw error;
29
- }
30
- }
31
- }
1
+ import { Failure, Success } from './index.js';
2
+ import dotenv from 'dotenv-safe';
3
+ export class ConfigureEnvironmentVariables {
4
+ _configured;
5
+ constructor() {
6
+ this._configured = false;
7
+ }
8
+ static _instance;
9
+ static create() {
10
+ return (this._instance || (this._instance = new ConfigureEnvironmentVariables()));
11
+ }
12
+ get configured() {
13
+ return this._configured;
14
+ }
15
+ async run() {
16
+ try {
17
+ if (!this._configured) {
18
+ dotenv.config();
19
+ this._configured = true;
20
+ console.log('environment variables have been loaded');
21
+ }
22
+ return Success.create();
23
+ }
24
+ catch (error) {
25
+ if (error instanceof Error) {
26
+ return Failure.create(error);
27
+ }
28
+ throw error;
29
+ }
30
+ }
31
+ }
32
32
  //# sourceMappingURL=ConfigureEnvironmentVariables.js.map
@@ -1,9 +1,9 @@
1
- import { IRunnable, MongoDbUri, Status } from './index.js';
2
- export declare class ConnectToMongoDb implements IRunnable {
3
- private _uri;
4
- private constructor();
5
- private static _instance;
6
- static create(uri: MongoDbUri): ConnectToMongoDb;
7
- run(): Promise<Status<Error>>;
8
- }
1
+ import { IRunnable, MongoDbUri, Status } from './index.js';
2
+ export declare class ConnectToMongoDb implements IRunnable {
3
+ private _uri;
4
+ private constructor();
5
+ private static _instance;
6
+ static create(uri: MongoDbUri): ConnectToMongoDb;
7
+ run(): Promise<Status<Error>>;
8
+ }
9
9
  //# sourceMappingURL=ConnectToMongoDb.d.ts.map
@@ -1,29 +1,29 @@
1
- import { Failure, Success } from './index.js';
2
- import mongoose from 'mongoose';
3
- export class ConnectToMongoDb {
4
- _uri;
5
- constructor(_uri) {
6
- this._uri = _uri;
7
- }
8
- static _instance;
9
- static create(uri) {
10
- return this._instance || (this._instance = new ConnectToMongoDb(uri));
11
- }
12
- async run() {
13
- try {
14
- if (mongoose.connection.readyState !== mongoose.ConnectionStates.connected) {
15
- mongoose.set('strictQuery', false);
16
- await mongoose.connect(this._uri.value);
17
- console.log('connected to MongoDb');
18
- }
19
- return Success.create();
20
- }
21
- catch (error) {
22
- if (error instanceof Error) {
23
- return Failure.create(error);
24
- }
25
- throw error;
26
- }
27
- }
28
- }
1
+ import { Failure, Success } from './index.js';
2
+ import mongoose from 'mongoose';
3
+ export class ConnectToMongoDb {
4
+ _uri;
5
+ constructor(_uri) {
6
+ this._uri = _uri;
7
+ }
8
+ static _instance;
9
+ static create(uri) {
10
+ return this._instance || (this._instance = new ConnectToMongoDb(uri));
11
+ }
12
+ async run() {
13
+ try {
14
+ if (mongoose.connection.readyState !== mongoose.ConnectionStates.connected) {
15
+ mongoose.set('strictQuery', false);
16
+ await mongoose.connect(this._uri.value);
17
+ console.log('connected to MongoDb');
18
+ }
19
+ return Success.create();
20
+ }
21
+ catch (error) {
22
+ if (error instanceof Error) {
23
+ return Failure.create(error);
24
+ }
25
+ throw error;
26
+ }
27
+ }
28
+ }
29
29
  //# sourceMappingURL=ConnectToMongoDb.js.map
@@ -1,8 +1,8 @@
1
- import { IRunnable, Status } from './index.js';
2
- export declare class DisconnectFromMongoDb implements IRunnable {
3
- private constructor();
4
- private static _instance;
5
- static create(): DisconnectFromMongoDb;
6
- run(): Promise<Status<Error>>;
7
- }
1
+ import { IRunnable, Status } from './index.js';
2
+ export declare class DisconnectFromMongoDb implements IRunnable {
3
+ private constructor();
4
+ private static _instance;
5
+ static create(): DisconnectFromMongoDb;
6
+ run(): Promise<Status<Error>>;
7
+ }
8
8
  //# sourceMappingURL=DisconnectFromMongoDb.d.ts.map
@@ -1,26 +1,26 @@
1
- import { Failure, Success } from './index.js';
2
- import mongoose from 'mongoose';
3
- export class DisconnectFromMongoDb {
4
- constructor() { }
5
- static _instance;
6
- static create() {
7
- return this._instance || (this._instance = new DisconnectFromMongoDb());
8
- }
9
- async run() {
10
- try {
11
- if (mongoose.connection.readyState === mongoose.ConnectionStates.connected) {
12
- await mongoose.disconnect();
13
- await mongoose.connection.close();
14
- console.log('disconnected from MongoDb');
15
- }
16
- return Success.create();
17
- }
18
- catch (error) {
19
- if (error instanceof Error) {
20
- return Failure.create(error);
21
- }
22
- throw error;
23
- }
24
- }
25
- }
1
+ import { Failure, Success } from './index.js';
2
+ import mongoose from 'mongoose';
3
+ export class DisconnectFromMongoDb {
4
+ constructor() { }
5
+ static _instance;
6
+ static create() {
7
+ return this._instance || (this._instance = new DisconnectFromMongoDb());
8
+ }
9
+ async run() {
10
+ try {
11
+ if (mongoose.connection.readyState === mongoose.ConnectionStates.connected) {
12
+ await mongoose.disconnect();
13
+ await mongoose.connection.close();
14
+ console.log('disconnected from MongoDb');
15
+ }
16
+ return Success.create();
17
+ }
18
+ catch (error) {
19
+ if (error instanceof Error) {
20
+ return Failure.create(error);
21
+ }
22
+ throw error;
23
+ }
24
+ }
25
+ }
26
26
  //# sourceMappingURL=DisconnectFromMongoDb.js.map
@@ -1,11 +1,11 @@
1
- import { Feedback, IValueObject } from './index.js';
2
- export type MongoDbUriValue = Readonly<string>;
3
- export declare function isMongoDbUriValue(candidate: unknown): candidate is MongoDbUriValue;
4
- export declare class MongoDbUri implements IValueObject<MongoDbUriValue> {
5
- private _value;
6
- private constructor();
7
- static create(candidate: unknown): Feedback<MongoDbUri, Error>;
8
- get value(): MongoDbUriValue;
9
- }
10
- export declare function isMongoDbUri(candidate: unknown): candidate is MongoDbUri;
1
+ import { Feedback, IValueObject } from './index.js';
2
+ export type MongoDbUriValue = Readonly<string>;
3
+ export declare function isMongoDbUriValue(candidate: unknown): candidate is MongoDbUriValue;
4
+ export declare class MongoDbUri implements IValueObject<MongoDbUriValue> {
5
+ private _value;
6
+ private constructor();
7
+ static create(candidate: unknown): Feedback<MongoDbUri, Error>;
8
+ get value(): MongoDbUriValue;
9
+ }
10
+ export declare function isMongoDbUri(candidate: unknown): candidate is MongoDbUri;
11
11
  //# sourceMappingURL=MongoDbUri.d.ts.map