@marketeer-intelligence/framework-device 0.1.0-alpha.4 → 0.1.0-alpha.6
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/data-source/MarketIndexTableParaser.d.ts +8 -0
- package/dist/data-source/MarketIndexTableParaser.d.ts.map +1 -0
- package/dist/data-source/MarketIndexTableParaser.js +62 -0
- package/dist/data-source/MarketIndexTableParaser.js.map +1 -0
- package/dist/data-source/SecurityTableParaser.d.ts +7 -7
- package/dist/data-source/SecurityTableParaser.js +71 -71
- package/dist/data-source/StaticWebpageScraper.d.ts +11 -11
- package/dist/data-source/StaticWebpageScraper.js +49 -49
- package/dist/data-source/Webpage.d.ts +10 -10
- package/dist/data-source/Webpage.js +21 -21
- package/dist/data-source/WebpageBody.d.ts +10 -10
- package/dist/data-source/WebpageBody.js +33 -33
- package/dist/data-source/WebpageUrl.d.ts +10 -10
- package/dist/data-source/WebpageUrl.js +38 -38
- package/dist/data-source/index.d.ts +7 -6
- package/dist/data-source/index.d.ts.map +1 -1
- package/dist/data-source/index.js +7 -6
- package/dist/data-source/index.js.map +1 -1
- package/dist/data-store/InstrumentMongoDbCollection.d.ts +11 -11
- package/dist/data-store/InstrumentMongoDbCollection.js +57 -57
- package/dist/data-store/MarketIndexMongoDbCollection.d.ts +12 -0
- package/dist/data-store/MarketIndexMongoDbCollection.d.ts.map +1 -0
- package/dist/data-store/MarketIndexMongoDbCollection.js +58 -0
- package/dist/data-store/MarketIndexMongoDbCollection.js.map +1 -0
- package/dist/data-store/SecurityMongoDbCollection.d.ts +11 -11
- package/dist/data-store/SecurityMongoDbCollection.js +66 -66
- package/dist/data-store/index.d.ts +4 -3
- package/dist/data-store/index.d.ts.map +1 -1
- package/dist/data-store/index.js +4 -3
- package/dist/data-store/index.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/task/ConfigureEnvironmentVariables.d.ts +9 -9
- package/dist/task/ConfigureEnvironmentVariables.js +31 -31
- package/dist/task/ConnectToMongoDb.d.ts +8 -8
- package/dist/task/ConnectToMongoDb.js +28 -28
- package/dist/task/DisconnectFromMongoDb.d.ts +7 -7
- package/dist/task/DisconnectFromMongoDb.js +25 -25
- package/dist/task/MongoDbUri.d.ts +10 -10
- package/dist/task/MongoDbUri.js +38 -38
- package/dist/task/index.d.ts +5 -5
- package/dist/task/index.js +5 -5
- 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 {
|
3
|
-
export {
|
4
|
-
export {
|
5
|
-
export {
|
6
|
-
export {
|
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
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { IStorable, Instrument, Status } from './index.js';
|
2
|
+
export declare class MarketIndexMongoDbCollection implements IStorable<Instrument[]> {
|
3
|
+
private readonly _name;
|
4
|
+
private readonly _schema;
|
5
|
+
private _model;
|
6
|
+
private constructor();
|
7
|
+
private static _instance;
|
8
|
+
static create(): MarketIndexMongoDbCollection;
|
9
|
+
upsert(marketIndex: Instrument): Promise<Status<Error>>;
|
10
|
+
store(marketIndices: Instrument[]): Promise<Status<Error>>;
|
11
|
+
}
|
12
|
+
//# sourceMappingURL=MarketIndexMongoDbCollection.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"MarketIndexMongoDbCollection.d.ts","sourceRoot":"","sources":["../../src/data-store/MarketIndexMongoDbCollection.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,UAAU,EAEV,MAAM,EAEP,MAAM,YAAY,CAAA;AAenB,qBAAa,4BAA6B,YAAW,SAAS,CAAC,UAAU,EAAE,CAAC;IAC1E,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmB;IACzC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAarB;IACH,OAAO,CAAC,MAAM,CAA0C;IACxD,OAAO;IAMP,OAAO,CAAC,MAAM,CAAC,SAAS,CAA8B;IACtD,MAAM,CAAC,MAAM,IAAI,4BAA4B;IAKvC,MAAM,CAAC,WAAW,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAgBvD,KAAK,CAAC,aAAa,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;CAmBjE"}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import { Failure, Success, } from './index.js';
|
2
|
+
import { Schema as MongooseSchema, model as mongooseModel, } from 'mongoose';
|
3
|
+
export class MarketIndexMongoDbCollection {
|
4
|
+
_name = 'market-indices';
|
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 MarketIndexMongoDbCollection()));
|
22
|
+
}
|
23
|
+
async upsert(marketIndex) {
|
24
|
+
try {
|
25
|
+
await this._model.updateOne({ isin: marketIndex.value.isin }, { $set: marketIndex.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(marketIndices) {
|
37
|
+
try {
|
38
|
+
for (const [index, marketIndex] of marketIndices.entries()) {
|
39
|
+
try {
|
40
|
+
await this.upsert(marketIndex);
|
41
|
+
}
|
42
|
+
catch (error) {
|
43
|
+
console.log(`market index #${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
|
+
//# sourceMappingURL=MarketIndexMongoDbCollection.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"MarketIndexMongoDbCollection.js","sourceRoot":"","sources":["../../src/data-store/MarketIndexMongoDbCollection.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAKP,OAAO,GACR,MAAM,YAAY,CAAA;AACnB,OAAO,EAGL,MAAM,IAAI,cAAc,EACxB,KAAK,IAAI,aAAa,GACvB,MAAM,UAAU,CAAA;AASjB,MAAM,OAAO,4BAA4B;IACtB,KAAK,GAAG,gBAAgB,CAAA;IACxB,OAAO,GACtB,IAAI,cAAc,CAChB;QACE,IAAI,EAAE,EAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAC;QAClD,MAAM,EAAE,EAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAC;QACpD,IAAI,EAAE,EAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAC;QACpC,GAAG,EAAE,EAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAC;QACnC,SAAS,EAAE,EAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAC;KAC1C,EACD;QACE,UAAU,EAAE,IAAI,CAAC,KAAK;QACtB,UAAU,EAAE,IAAI;KACjB,CACF,CAAA;IACK,MAAM,CAA0C;IACxD;QACE,IAAI,CAAC,MAAM,GAAG,aAAa,CACzB,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,OAAO,CACb,CAAA;IACH,CAAC;IACO,MAAM,CAAC,SAAS,CAA8B;IACtD,MAAM,CAAC,MAAM;QACX,OAAO,CACL,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,4BAA4B,EAAE,CAAC,CACxE,CAAA;IACH,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,WAAuB;QAClC,IAAI;YACF,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,CACzB,EAAC,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,IAAI,EAAC,EAC9B,EAAC,IAAI,EAAE,WAAW,CAAC,KAAK,EAAC,EACzB,EAAC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAC,CAC1B,CAAA;YACD,OAAO,OAAO,CAAC,MAAM,EAAE,CAAA;SACxB;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,KAAK,YAAY,KAAK,EAAE;gBAC1B,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;aAC7B;YACD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;YAClB,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC,CAAA;SAClD;IACH,CAAC;IACD,KAAK,CAAC,KAAK,CAAC,aAA2B;QACrC,IAAI;YACF,KAAK,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,IAAI,aAAa,CAAC,OAAO,EAAE,EAAE;gBAC1D,IAAI;oBACF,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;iBAC/B;gBAAC,OAAO,KAAK,EAAE;oBACd,OAAO,CAAC,GAAG,CAAC,iBAAiB,KAAK,GAAG,CAAC,aAAa,CAAC,CAAA;oBACpD,OAAO,CAAC,GAAG,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;oBAC3D,SAAQ;iBACT;aACF;YACD,OAAO,OAAO,CAAC,MAAM,EAAE,CAAA;SACxB;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,KAAK,YAAY,KAAK,EAAE;gBAC1B,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;aAC7B;YACD,MAAM,KAAK,CAAA;SACZ;IACH,CAAC;CACF"}
|
@@ -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,5 @@
|
|
1
|
-
export * from '../index.js';
|
2
|
-
export { InstrumentMongoDbCollection } from './InstrumentMongoDbCollection.js';
|
3
|
-
export {
|
1
|
+
export * from '../index.js';
|
2
|
+
export { InstrumentMongoDbCollection } from './InstrumentMongoDbCollection.js';
|
3
|
+
export { MarketIndexMongoDbCollection } from './MarketIndexMongoDbCollection.js';
|
4
|
+
export { SecurityMongoDbCollection } from './SecurityMongoDbCollection.js';
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/data-store/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAE3B,OAAO,EAAC,2BAA2B,EAAC,MAAM,kCAAkC,CAAA;AAC5E,OAAO,EAAC,yBAAyB,EAAC,MAAM,gCAAgC,CAAA"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/data-store/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAE3B,OAAO,EAAC,2BAA2B,EAAC,MAAM,kCAAkC,CAAA;AAC5E,OAAO,EAAC,4BAA4B,EAAC,MAAM,mCAAmC,CAAA;AAC9E,OAAO,EAAC,yBAAyB,EAAC,MAAM,gCAAgC,CAAA"}
|
package/dist/data-store/index.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
export * from '../index.js';
|
2
|
-
export { InstrumentMongoDbCollection } from './InstrumentMongoDbCollection.js';
|
3
|
-
export {
|
1
|
+
export * from '../index.js';
|
2
|
+
export { InstrumentMongoDbCollection } from './InstrumentMongoDbCollection.js';
|
3
|
+
export { MarketIndexMongoDbCollection } from './MarketIndexMongoDbCollection.js';
|
4
|
+
export { SecurityMongoDbCollection } from './SecurityMongoDbCollection.js';
|
4
5
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data-store/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAE3B,OAAO,EAAC,2BAA2B,EAAC,MAAM,kCAAkC,CAAA;AAC5E,OAAO,EAAC,yBAAyB,EAAC,MAAM,gCAAgC,CAAA"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data-store/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAE3B,OAAO,EAAC,2BAA2B,EAAC,MAAM,kCAAkC,CAAA;AAC5E,OAAO,EAAC,4BAA4B,EAAC,MAAM,mCAAmC,CAAA;AAC9E,OAAO,EAAC,yBAAyB,EAAC,MAAM,gCAAgC,CAAA"}
|
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
|