@marketeer-intelligence/framework-device 0.1.0-alpha.1 → 0.1.0-alpha.10

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.
Files changed (106) hide show
  1. package/README.md +2 -2
  2. package/dist/data-source/MarketIndexTableParaser.d.ts +8 -0
  3. package/dist/data-source/MarketIndexTableParaser.d.ts.map +1 -0
  4. package/dist/data-source/MarketIndexTableParaser.js +62 -0
  5. package/dist/data-source/MarketIndexTableParaser.js.map +1 -0
  6. package/dist/{SecurityTableParaser.d.ts → data-source/SecurityTableParaser.d.ts} +7 -7
  7. package/dist/data-source/SecurityTableParaser.d.ts.map +1 -0
  8. package/dist/{SecurityTableParaser.js → data-source/SecurityTableParaser.js} +71 -71
  9. package/dist/data-source/SecurityTableParaser.js.map +1 -0
  10. package/dist/{StaticWebpageScraper.d.ts → data-source/StaticWebpageScraper.d.ts} +11 -12
  11. package/dist/data-source/StaticWebpageScraper.d.ts.map +1 -0
  12. package/dist/{StaticWebpageScraper.js → data-source/StaticWebpageScraper.js} +49 -50
  13. package/dist/data-source/StaticWebpageScraper.js.map +1 -0
  14. package/dist/{Webpage.d.ts → data-source/Webpage.d.ts} +10 -10
  15. package/dist/data-source/Webpage.d.ts.map +1 -0
  16. package/dist/{Webpage.js → data-source/Webpage.js} +21 -21
  17. package/dist/data-source/Webpage.js.map +1 -0
  18. package/dist/{WebpageBody.d.ts → data-source/WebpageBody.d.ts} +10 -10
  19. package/dist/data-source/WebpageBody.d.ts.map +1 -0
  20. package/dist/{WebpageBody.js → data-source/WebpageBody.js} +33 -33
  21. package/dist/data-source/WebpageBody.js.map +1 -0
  22. package/dist/{WebpageUrl.d.ts → data-source/WebpageUrl.d.ts} +10 -10
  23. package/dist/data-source/WebpageUrl.d.ts.map +1 -0
  24. package/dist/{WebpageUrl.js → data-source/WebpageUrl.js} +38 -38
  25. package/dist/data-source/WebpageUrl.js.map +1 -0
  26. package/dist/data-source/index.d.ts +8 -0
  27. package/dist/data-source/index.d.ts.map +1 -0
  28. package/dist/data-source/index.js +8 -0
  29. package/dist/data-source/index.js.map +1 -0
  30. package/dist/{InstrumentMongoDbCollection.d.ts → data-store/InstrumentMongoDbCollection.d.ts} +12 -11
  31. package/dist/data-store/InstrumentMongoDbCollection.d.ts.map +1 -0
  32. package/dist/{InstrumentMongoDbCollection.js → data-store/InstrumentMongoDbCollection.js} +89 -57
  33. package/dist/data-store/InstrumentMongoDbCollection.js.map +1 -0
  34. package/dist/data-store/MarketIndexMongoDbCollection.d.ts +13 -0
  35. package/dist/data-store/MarketIndexMongoDbCollection.d.ts.map +1 -0
  36. package/dist/data-store/MarketIndexMongoDbCollection.js +83 -0
  37. package/dist/data-store/MarketIndexMongoDbCollection.js.map +1 -0
  38. package/dist/{SecurityMongoDbCollection.d.ts → data-store/SecurityMongoDbCollection.d.ts} +12 -11
  39. package/dist/data-store/SecurityMongoDbCollection.d.ts.map +1 -0
  40. package/dist/{SecurityMongoDbCollection.js → data-store/SecurityMongoDbCollection.js} +88 -66
  41. package/dist/data-store/SecurityMongoDbCollection.js.map +1 -0
  42. package/dist/data-store/index.d.ts +5 -0
  43. package/dist/data-store/index.d.ts.map +1 -0
  44. package/dist/data-store/index.js +5 -0
  45. package/dist/data-store/index.js.map +1 -0
  46. package/dist/index.d.ts +4 -15
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +4 -15
  49. package/dist/index.js.map +1 -1
  50. package/dist/{ConfigureEnvironmentVariables.d.ts → task/ConfigureEnvironmentVariables.d.ts} +9 -9
  51. package/dist/task/ConfigureEnvironmentVariables.d.ts.map +1 -0
  52. package/dist/{ConfigureEnvironmentVariables.js → task/ConfigureEnvironmentVariables.js} +31 -31
  53. package/dist/task/ConfigureEnvironmentVariables.js.map +1 -0
  54. package/dist/task/ConnectToMongoDb.d.ts +9 -0
  55. package/dist/task/ConnectToMongoDb.d.ts.map +1 -0
  56. package/dist/{ConnectToMongoDb.js → task/ConnectToMongoDb.js} +28 -28
  57. package/dist/task/ConnectToMongoDb.js.map +1 -0
  58. package/dist/task/DisconnectFromMongoDb.d.ts +8 -0
  59. package/dist/task/DisconnectFromMongoDb.d.ts.map +1 -0
  60. package/dist/{DisconnectFromMongoDb.js → task/DisconnectFromMongoDb.js} +25 -25
  61. package/dist/task/DisconnectFromMongoDb.js.map +1 -0
  62. package/dist/{MongoDbUri.d.ts → task/MongoDbUri.d.ts} +10 -10
  63. package/dist/task/MongoDbUri.d.ts.map +1 -0
  64. package/dist/{MongoDbUri.js → task/MongoDbUri.js} +38 -38
  65. package/dist/task/MongoDbUri.js.map +1 -0
  66. package/dist/task/index.d.ts +6 -0
  67. package/dist/task/index.d.ts.map +1 -0
  68. package/dist/task/index.js +6 -0
  69. package/dist/task/index.js.map +1 -0
  70. package/package.json +4 -4
  71. package/dist/ConfigureEnvironmentVariables.d.ts.map +0 -1
  72. package/dist/ConfigureEnvironmentVariables.js.map +0 -1
  73. package/dist/ConnectToMongoDb.d.ts +0 -9
  74. package/dist/ConnectToMongoDb.d.ts.map +0 -1
  75. package/dist/ConnectToMongoDb.js.map +0 -1
  76. package/dist/DisconnectFromMongoDb.d.ts +0 -8
  77. package/dist/DisconnectFromMongoDb.d.ts.map +0 -1
  78. package/dist/DisconnectFromMongoDb.js.map +0 -1
  79. package/dist/InstrumentMongoDbCollection.d.ts.map +0 -1
  80. package/dist/InstrumentMongoDbCollection.js.map +0 -1
  81. package/dist/MongoDbUri.d.ts.map +0 -1
  82. package/dist/MongoDbUri.js.map +0 -1
  83. package/dist/SecurityMongoDbCollection.d.ts.map +0 -1
  84. package/dist/SecurityMongoDbCollection.js.map +0 -1
  85. package/dist/SecurityTableParaser.d.ts.map +0 -1
  86. package/dist/SecurityTableParaser.js.map +0 -1
  87. package/dist/StaticWebpageScraper.d.ts.map +0 -1
  88. package/dist/StaticWebpageScraper.js.map +0 -1
  89. package/dist/Webpage.d.ts.map +0 -1
  90. package/dist/Webpage.js.map +0 -1
  91. package/dist/WebpageBody.d.ts.map +0 -1
  92. package/dist/WebpageBody.js.map +0 -1
  93. package/dist/WebpageUrl.d.ts.map +0 -1
  94. package/dist/WebpageUrl.js.map +0 -1
  95. package/dist/dataSource.d.ts +0 -4
  96. package/dist/dataSource.d.ts.map +0 -1
  97. package/dist/dataSource.js +0 -12
  98. package/dist/dataSource.js.map +0 -1
  99. package/dist/dataStore.d.ts +0 -5
  100. package/dist/dataStore.d.ts.map +0 -1
  101. package/dist/dataStore.js +0 -9
  102. package/dist/dataStore.js.map +0 -1
  103. package/dist/task.d.ts +0 -6
  104. package/dist/task.d.ts.map +0 -1
  105. package/dist/task.js +0 -12
  106. package/dist/task.js.map +0 -1
package/README.md CHANGED
@@ -1,3 +1,3 @@
1
- # @marketeer-intelligence/infrastructure
1
+ # @marketeer-intelligence/framework-device
2
2
 
3
- > infrastructure layer modules for marketeer-intelligence app
3
+ > framework/device layer modules for marketeer-intelligence app
@@ -0,0 +1,8 @@
1
+ import { IWebpageBodyParser, Feedback, WebpageBody, Instrument } from './index.js';
2
+ export declare class MarketIndexTableParaser implements IWebpageBodyParser<Instrument[]> {
3
+ private constructor();
4
+ private static _instance;
5
+ static create(): MarketIndexTableParaser;
6
+ parse(webpageBody: WebpageBody): Promise<Feedback<Instrument[], Error>>;
7
+ }
8
+ //# sourceMappingURL=MarketIndexTableParaser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarketIndexTableParaser.d.ts","sourceRoot":"","sources":["../../src/data-source/MarketIndexTableParaser.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,EAClB,QAAQ,EAIR,WAAW,EACX,UAAU,EACX,MAAM,YAAY,CAAA;AAYnB,qBAAa,uBACX,YAAW,kBAAkB,CAAC,UAAU,EAAE,CAAC;IAE3C,OAAO;IACP,OAAO,CAAC,MAAM,CAAC,SAAS,CAAyB;IACjD,MAAM,CAAC,MAAM,IAAI,uBAAuB;IAGlC,KAAK,CACT,WAAW,EAAE,WAAW,GACvB,OAAO,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,KAAK,CAAC,CAAC;CA+C1C"}
@@ -0,0 +1,62 @@
1
+ import { Failure, isFailure, Result, Instrument, } from './index.js';
2
+ import { JSDOM } from 'jsdom';
3
+ import { DateTime } from 'luxon';
4
+ function isRowValue(candidate) {
5
+ if (!Array.isArray(candidate))
6
+ return false;
7
+ if (candidate.length !== 5)
8
+ return false;
9
+ return candidate.every(element => typeof element === 'string');
10
+ }
11
+ export class MarketIndexTableParaser {
12
+ constructor() { }
13
+ static _instance;
14
+ static create() {
15
+ return this._instance || (this._instance = new MarketIndexTableParaser());
16
+ }
17
+ async parse(webpageBody) {
18
+ try {
19
+ const dom = new JSDOM(webpageBody.value);
20
+ const tableOrNull = dom.window.document.querySelector('table.h4');
21
+ if (tableOrNull === null) {
22
+ const msg = 'did not find a table element for parsing';
23
+ const error = new Error(msg);
24
+ return Failure.create(error);
25
+ }
26
+ const rows = tableOrNull.querySelectorAll('tbody tr:not([align="center"])');
27
+ const marketIndices = [];
28
+ for (const [index, row] of rows.entries()) {
29
+ const cells = Array.from(row.querySelectorAll('td'));
30
+ const contents = cells.map(cell => cell.textContent === null ? '' : cell.textContent.trim());
31
+ if (!isRowValue(contents)) {
32
+ const reason = 'not an array of 6 strings';
33
+ console.log(`row ${index + 1} is skipped (${reason})`);
34
+ continue;
35
+ }
36
+ const [symbol, name] = contents[0].split(' ');
37
+ const marketIndexValue = {
38
+ isin: contents[1],
39
+ symbol,
40
+ name,
41
+ cfi: contents[3],
42
+ published: DateTime.fromFormat(contents[2], 'yyyy/MM/dd').toISO(),
43
+ };
44
+ const marketIndexOrError = Instrument.create(marketIndexValue);
45
+ if (isFailure(marketIndexOrError)) {
46
+ const { message } = marketIndexOrError.error;
47
+ console.log(`row ${index + 1} is skipped (${message})`);
48
+ continue;
49
+ }
50
+ marketIndices.push(marketIndexOrError.value);
51
+ }
52
+ return Result.create(marketIndices);
53
+ }
54
+ catch (error) {
55
+ if (error instanceof Error) {
56
+ return Failure.create(error);
57
+ }
58
+ throw error;
59
+ }
60
+ }
61
+ }
62
+ //# sourceMappingURL=MarketIndexTableParaser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarketIndexTableParaser.js","sourceRoot":"","sources":["../../src/data-source/MarketIndexTableParaser.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,OAAO,EACP,SAAS,EACT,MAAM,EAEN,UAAU,GACX,MAAM,YAAY,CAAA;AACnB,OAAO,EAAC,KAAK,EAAC,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAA;AAI9B,SAAS,UAAU,CAAC,SAAkB;IACpC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;QAAE,OAAO,KAAK,CAAA;IAC3C,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAA;IACxC,OAAO,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAA;AAChE,CAAC;AAED,MAAM,OAAO,uBAAuB;IAGlC,gBAAuB,CAAC;IAChB,MAAM,CAAC,SAAS,CAAyB;IACjD,MAAM,CAAC,MAAM;QACX,OAAO,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,uBAAuB,EAAE,CAAC,CAAA;IAC3E,CAAC;IACD,KAAK,CAAC,KAAK,CACT,WAAwB;QAExB,IAAI;YACF,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;YACxC,MAAM,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAA;YACjE,IAAI,WAAW,KAAK,IAAI,EAAE;gBACxB,MAAM,GAAG,GAAG,0CAA0C,CAAA;gBACtD,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,CA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C,EAAE;oBACjC,MAAM,EAAC,OAAO,EAAC,GAAG,kBAAkB,CAAC,KAAK,CAAA;oBAC1C,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,GAAG,CAAC,gBAAgB,OAAO,GAAG,CAAC,CAAA;oBACvD,SAAQ;iBACT;gBACD,aAAa,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAA;aAC7C;YACD,OAAO,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA;SACpC;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,8 +1,8 @@
1
- import { Security, IWebpageBodyParser, Feedback, WebpageBody } from './index.js';
2
- export declare class SecurityTableParaser implements IWebpageBodyParser<Security[]> {
3
- private constructor();
4
- private static _instance;
5
- static create(): SecurityTableParaser;
6
- parse(webpageBody: WebpageBody): Promise<Feedback<Security[], Error>>;
7
- }
1
+ import { Security, IWebpageBodyParser, Feedback, WebpageBody } from './index.js';
2
+ export declare class SecurityTableParaser implements IWebpageBodyParser<Security[]> {
3
+ private constructor();
4
+ private static _instance;
5
+ static create(): SecurityTableParaser;
6
+ parse(webpageBody: WebpageBody): Promise<Feedback<Security[], Error>>;
7
+ }
8
8
  //# sourceMappingURL=SecurityTableParaser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SecurityTableParaser.d.ts","sourceRoot":"","sources":["../../src/data-source/SecurityTableParaser.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,kBAAkB,EAClB,QAAQ,EAIR,WAAW,EACZ,MAAM,YAAY,CAAA;AAyBnB,qBAAa,oBAAqB,YAAW,kBAAkB,CAAC,QAAQ,EAAE,CAAC;IACzE,OAAO;IACP,OAAO,CAAC,MAAM,CAAC,SAAS,CAAsB;IAC9C,MAAM,CAAC,MAAM,IAAI,oBAAoB;IAG/B,KAAK,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,CAAC;CA4D5E"}
@@ -1,72 +1,72 @@
1
- import { Security, Failure, isFailure, Result, } from './index.js';
2
- import { JSDOM } from 'jsdom';
3
- import { DateTime } from 'luxon';
4
- function isRowValue(candidate) {
5
- if (!Array.isArray(candidate))
6
- return false;
7
- if (candidate.length !== 10)
8
- return false;
9
- return candidate.every(element => typeof element === 'string');
10
- }
11
- export class SecurityTableParaser {
12
- constructor() { }
13
- static _instance;
14
- static create() {
15
- return this._instance || (this._instance = new SecurityTableParaser());
16
- }
17
- async parse(webpageBody) {
18
- try {
19
- const dom = new JSDOM(webpageBody.value);
20
- const tableOrNull = dom.window.document.querySelector('table.h4');
21
- if (tableOrNull === null) {
22
- const msg = 'did not find a table element for parsing';
23
- const error = new Error(msg);
24
- return Failure.create(error);
25
- }
26
- const rows = tableOrNull.querySelectorAll('tbody tr:not([align="center"])');
27
- const securities = [];
28
- for (const [index, row] of rows.entries()) {
29
- const cells = Array.from(row.querySelectorAll('td'));
30
- const contents = cells.map(cell => cell.textContent === null ? '' : cell.textContent.trim());
31
- if (!isRowValue(contents)) {
32
- const reason = 'not an array of 10 strings';
33
- console.log(`row ${index + 1} is skipped (${reason})`);
34
- continue;
35
- }
36
- const securityValue = {
37
- instrument: {
38
- isin: contents[1],
39
- symbol: contents[2],
40
- name: contents[3],
41
- cfi: contents[8],
42
- published: DateTime.fromFormat(contents[7], 'yyyy/MM/dd').toISO(),
43
- },
44
- };
45
- const withTypeValue = contents[5] === ''
46
- ? { ...securityValue }
47
- : { ...securityValue, type: contents[5] };
48
- const withMarketValue = contents[4] === ''
49
- ? { ...withTypeValue }
50
- : { ...withTypeValue, market: contents[4] };
51
- const withIndustryValue = contents[6] === ''
52
- ? { ...withMarketValue }
53
- : { ...withMarketValue, industry: contents[6] };
54
- const securityOrError = Security.create(withIndustryValue);
55
- if (isFailure(securityOrError)) {
56
- const { message } = securityOrError.error;
57
- console.log(`row ${index + 1} is skipped (${message})`);
58
- continue;
59
- }
60
- securities.push(securityOrError.value);
61
- }
62
- return Result.create(securities);
63
- }
64
- catch (error) {
65
- if (error instanceof Error) {
66
- return Failure.create(error);
67
- }
68
- throw error;
69
- }
70
- }
71
- }
1
+ import { Security, Failure, isFailure, Result, } from './index.js';
2
+ import { JSDOM } from 'jsdom';
3
+ import { DateTime } from 'luxon';
4
+ function isRowValue(candidate) {
5
+ if (!Array.isArray(candidate))
6
+ return false;
7
+ if (candidate.length !== 10)
8
+ return false;
9
+ return candidate.every(element => typeof element === 'string');
10
+ }
11
+ export class SecurityTableParaser {
12
+ constructor() { }
13
+ static _instance;
14
+ static create() {
15
+ return this._instance || (this._instance = new SecurityTableParaser());
16
+ }
17
+ async parse(webpageBody) {
18
+ try {
19
+ const dom = new JSDOM(webpageBody.value);
20
+ const tableOrNull = dom.window.document.querySelector('table.h4');
21
+ if (tableOrNull === null) {
22
+ const msg = 'did not find a table element for parsing';
23
+ const error = new Error(msg);
24
+ return Failure.create(error);
25
+ }
26
+ const rows = tableOrNull.querySelectorAll('tbody tr:not([align="center"])');
27
+ const securities = [];
28
+ for (const [index, row] of rows.entries()) {
29
+ const cells = Array.from(row.querySelectorAll('td'));
30
+ const contents = cells.map(cell => cell.textContent === null ? '' : cell.textContent.trim());
31
+ if (!isRowValue(contents)) {
32
+ const reason = 'not an array of 10 strings';
33
+ console.log(`row ${index + 1} is skipped (${reason})`);
34
+ continue;
35
+ }
36
+ const securityValue = {
37
+ instrument: {
38
+ isin: contents[1],
39
+ symbol: contents[2],
40
+ name: contents[3],
41
+ cfi: contents[8],
42
+ published: DateTime.fromFormat(contents[7], 'yyyy/MM/dd').toISO(),
43
+ },
44
+ };
45
+ const withTypeValue = contents[5] === ''
46
+ ? { ...securityValue }
47
+ : { ...securityValue, type: contents[5] };
48
+ const withMarketValue = contents[4] === ''
49
+ ? { ...withTypeValue }
50
+ : { ...withTypeValue, market: contents[4] };
51
+ const withIndustryValue = contents[6] === ''
52
+ ? { ...withMarketValue }
53
+ : { ...withMarketValue, industry: contents[6] };
54
+ const securityOrError = Security.create(withIndustryValue);
55
+ if (isFailure(securityOrError)) {
56
+ const { message } = securityOrError.error;
57
+ console.log(`row ${index + 1} is skipped (${message})`);
58
+ continue;
59
+ }
60
+ securities.push(securityOrError.value);
61
+ }
62
+ return Result.create(securities);
63
+ }
64
+ catch (error) {
65
+ if (error instanceof Error) {
66
+ return Failure.create(error);
67
+ }
68
+ throw error;
69
+ }
70
+ }
71
+ }
72
72
  //# sourceMappingURL=SecurityTableParaser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SecurityTableParaser.js","sourceRoot":"","sources":["../../src/data-source/SecurityTableParaser.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAGR,OAAO,EACP,SAAS,EACT,MAAM,GAEP,MAAM,YAAY,CAAA;AACnB,OAAO,EAAC,KAAK,EAAC,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAA;AAiB9B,SAAS,UAAU,CAAC,SAAkB;IACpC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;QAAE,OAAO,KAAK,CAAA;IAC3C,IAAI,SAAS,CAAC,MAAM,KAAK,EAAE;QAAE,OAAO,KAAK,CAAA;IACzC,OAAO,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAA;AAChE,CAAC;AAED,MAAM,OAAO,oBAAoB;IAC/B,gBAAuB,CAAC;IAChB,MAAM,CAAC,SAAS,CAAsB;IAC9C,MAAM,CAAC,MAAM;QACX,OAAO,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC,CAAA;IACxE,CAAC;IACD,KA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AE;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,13 +1,12 @@
1
- import { Feedback, IValueObject, IWebpageScraper, WebpageUrlValue } from './index.js';
2
- import { WebpageBody } from './WebpageBody.js';
3
- export interface IWebpageBodyParser<DATA> {
4
- parse(webpageBody: WebpageBody): Promise<Feedback<DATA, Error>>;
5
- }
6
- export declare class StaticWebpageScraper<DATA> implements IWebpageScraper<DATA> {
7
- private _url;
8
- private bodyParser;
9
- private constructor();
10
- static create<DATA>(url: IValueObject<WebpageUrlValue>, bodyParser: IWebpageBodyParser<DATA>): StaticWebpageScraper<DATA>;
11
- scrapPage(): Promise<Feedback<DATA, Error>>;
12
- }
1
+ import { Feedback, IValueObject, IWebpageScraper, WebpageUrlValue, WebpageBody } from './index.js';
2
+ export interface IWebpageBodyParser<DATA> {
3
+ parse(webpageBody: WebpageBody): Promise<Feedback<DATA, Error>>;
4
+ }
5
+ export declare class StaticWebpageScraper<DATA> implements IWebpageScraper<DATA> {
6
+ private _url;
7
+ private bodyParser;
8
+ private constructor();
9
+ static create<DATA>(url: IValueObject<WebpageUrlValue>, bodyParser: IWebpageBodyParser<DATA>): StaticWebpageScraper<DATA>;
10
+ scrapPage(): Promise<Feedback<DATA, Error>>;
11
+ }
13
12
  //# sourceMappingURL=StaticWebpageScraper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StaticWebpageScraper.d.ts","sourceRoot":"","sources":["../../src/data-source/StaticWebpageScraper.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,eAAe,EACf,WAAW,EAEZ,MAAM,YAAY,CAAA;AAInB,MAAM,WAAW,kBAAkB,CAAC,IAAI;IACtC,KAAK,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAA;CAChE;AAED,qBAAa,oBAAoB,CAAC,IAAI,CAAE,YAAW,eAAe,CAAC,IAAI,CAAC;IAEpE,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,UAAU;IAFpB,OAAO;IAIP,MAAM,CAAC,MAAM,CAAC,IAAI,EAChB,GAAG,EAAE,YAAY,CAAC,eAAe,CAAC,EAClC,UAAU,EAAE,kBAAkB,CAAC,IAAI,CAAC,GACnC,oBAAoB,CAAC,IAAI,CAAC;IAGvB,SAAS,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;CAoClD"}
@@ -1,51 +1,50 @@
1
- import { Failure, isFailure, } from './index.js';
2
- import got from 'got';
3
- import iconv from 'iconv-lite';
4
- import { WebpageBody } from './WebpageBody.js';
5
- export class StaticWebpageScraper {
6
- _url;
7
- bodyParser;
8
- constructor(_url, bodyParser) {
9
- this._url = _url;
10
- this.bodyParser = bodyParser;
11
- }
12
- static create(url, bodyParser) {
13
- return new StaticWebpageScraper(url, bodyParser);
14
- }
15
- async scrapPage() {
16
- try {
17
- const response = await got(this._url.value, { responseType: 'buffer' });
18
- if (response.statusCode !== 200) {
19
- const { statusCode } = response;
20
- const statusMessage = response.statusMessage || 'status message is unavailable';
21
- const msg = `${statusCode}: ${statusMessage}`;
22
- const error = new Error(msg);
23
- return Failure.create(error);
24
- }
25
- const contentType = typeof response.headers['content-type'] === 'string'
26
- ? response.headers['content-type'].toLowerCase()
27
- : undefined;
28
- const encoding = contentType === undefined || !contentType.includes('charset=')
29
- ? 'utf-8'
30
- : contentType.split('charset=')[1].split(';')[0];
31
- if (!iconv.encodingExists(encoding)) {
32
- const msg = `${this._url.value} is encoded with unsupported "${encoding}" encoding`;
33
- const error = new Error(msg);
34
- return Failure.create(error);
35
- }
36
- const decoded = iconv.decode(response.body, encoding);
37
- const webpageBodyOrError = WebpageBody.create(decoded);
38
- if (isFailure(webpageBodyOrError))
39
- return webpageBodyOrError;
40
- const { value: webpageBody } = webpageBodyOrError;
41
- return await this.bodyParser.parse(webpageBody);
42
- }
43
- catch (error) {
44
- if (error instanceof Error) {
45
- return Failure.create(error);
46
- }
47
- throw error;
48
- }
49
- }
50
- }
1
+ import { Failure, WebpageBody, isFailure, } from './index.js';
2
+ import got from 'got';
3
+ import iconv from 'iconv-lite';
4
+ export class StaticWebpageScraper {
5
+ _url;
6
+ bodyParser;
7
+ constructor(_url, bodyParser) {
8
+ this._url = _url;
9
+ this.bodyParser = bodyParser;
10
+ }
11
+ static create(url, bodyParser) {
12
+ return new StaticWebpageScraper(url, bodyParser);
13
+ }
14
+ async scrapPage() {
15
+ try {
16
+ const response = await got(this._url.value, { responseType: 'buffer' });
17
+ if (response.statusCode !== 200) {
18
+ const { statusCode } = response;
19
+ const statusMessage = response.statusMessage || 'status message is unavailable';
20
+ const msg = `${statusCode}: ${statusMessage}`;
21
+ const error = new Error(msg);
22
+ return Failure.create(error);
23
+ }
24
+ const contentType = typeof response.headers['content-type'] === 'string'
25
+ ? response.headers['content-type'].toLowerCase()
26
+ : undefined;
27
+ const encoding = contentType === undefined || !contentType.includes('charset=')
28
+ ? 'utf-8'
29
+ : contentType.split('charset=')[1].split(';')[0];
30
+ if (!iconv.encodingExists(encoding)) {
31
+ const msg = `${this._url.value} is encoded with unsupported "${encoding}" encoding`;
32
+ const error = new Error(msg);
33
+ return Failure.create(error);
34
+ }
35
+ const decoded = iconv.decode(response.body, encoding);
36
+ const webpageBodyOrError = WebpageBody.create(decoded);
37
+ if (isFailure(webpageBodyOrError))
38
+ return webpageBodyOrError;
39
+ const { value: webpageBody } = webpageBodyOrError;
40
+ return await this.bodyParser.parse(webpageBody);
41
+ }
42
+ catch (error) {
43
+ if (error instanceof Error) {
44
+ return Failure.create(error);
45
+ }
46
+ throw error;
47
+ }
48
+ }
49
+ }
51
50
  //# sourceMappingURL=StaticWebpageScraper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file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AAC,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC;gBAC5D,CAAC,CAAC,OAAO;gBACT,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;YACpD,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE;gBACnC,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,iCAAiC,QAAQ,YAAY,CAAA;gBACnF,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,CAAA;gBAC5B,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;aAC7B;YACD,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;YACrD,MAAM,kBAAkB,GAAG,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;YACtD,IAAI,SAAS,CAAC,kBAAkB,CAAC;gBAAE,OAAO,kBAAkB,CAAA;YAC5D,MAAM,EAAC,KAAK,EAAE,WAAW,EAAC,GAAG,kBAAkB,CAAA;YAC/C,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;SAChD;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,11 +1,11 @@
1
- import { Feedback, IFetchable } from './index.js';
2
- export interface IWebpageScraper<DATA> {
3
- scrapPage(): Promise<Feedback<DATA, Error>>;
4
- }
5
- export declare class Webpage<DATA> implements IFetchable<DATA> {
6
- private scraper;
7
- private constructor();
8
- static create<DATA>(scraper: IWebpageScraper<DATA>): Webpage<DATA>;
9
- fetchData(): Promise<Feedback<DATA, Error>>;
10
- }
1
+ import { Feedback, IFetchable } from './index.js';
2
+ export interface IWebpageScraper<DATA> {
3
+ scrapPage(): Promise<Feedback<DATA, Error>>;
4
+ }
5
+ export declare class Webpage<DATA> implements IFetchable<DATA> {
6
+ private scraper;
7
+ private constructor();
8
+ static create<DATA>(scraper: IWebpageScraper<DATA>): Webpage<DATA>;
9
+ fetchData(): Promise<Feedback<DATA, Error>>;
10
+ }
11
11
  //# sourceMappingURL=Webpage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Webpage.d.ts","sourceRoot":"","sources":["../../src/data-source/Webpage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,QAAQ,EAAE,UAAU,EAAC,MAAM,YAAY,CAAA;AAExD,MAAM,WAAW,eAAe,CAAC,IAAI;IACnC,SAAS,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAA;CAC5C;AAED,qBAAa,OAAO,CAAC,IAAI,CAAE,YAAW,UAAU,CAAC,IAAI,CAAC;IAChC,OAAO,CAAC,OAAO;IAAnC,OAAO;IACP,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,eAAe,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAG5D,SAAS,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;CAUlD"}
@@ -1,22 +1,22 @@
1
- import { Failure } from './index.js';
2
- export class Webpage {
3
- scraper;
4
- constructor(scraper) {
5
- this.scraper = scraper;
6
- }
7
- static create(scraper) {
8
- return new Webpage(scraper);
9
- }
10
- async fetchData() {
11
- try {
12
- return await this.scraper.scrapPage();
13
- }
14
- catch (error) {
15
- if (error instanceof Error) {
16
- return Failure.create(error);
17
- }
18
- throw error;
19
- }
20
- }
21
- }
1
+ import { Failure } from './index.js';
2
+ export class Webpage {
3
+ scraper;
4
+ constructor(scraper) {
5
+ this.scraper = scraper;
6
+ }
7
+ static create(scraper) {
8
+ return new Webpage(scraper);
9
+ }
10
+ async fetchData() {
11
+ try {
12
+ return await this.scraper.scrapPage();
13
+ }
14
+ catch (error) {
15
+ if (error instanceof Error) {
16
+ return Failure.create(error);
17
+ }
18
+ throw error;
19
+ }
20
+ }
21
+ }
22
22
  //# sourceMappingURL=Webpage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Webpage.js","sourceRoot":"","sources":["../../src/data-source/Webpage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAuB,MAAM,YAAY,CAAA;AAMxD,MAAM,OAAO,OAAO;IACU;IAA5B,YAA4B,OAA8B;QAA9B,YAAO,GAAP,OAAO,CAAuB;IAAG,CAAC;IAC9D,MAAM,CAAC,MAAM,CAAO,OAA8B;QAChD,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,CAAA;IAC7B,CAAC;IACD,KAAK,CAAC,SAAS;QACb,IAAI;YACF,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAA;SACtC;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,11 +1,11 @@
1
- import { Feedback, IValueObject } from './index.js';
2
- export type WebpageBodyValue = Readonly<string>;
3
- export declare function isWebpageBodyValue(candidate: unknown): candidate is WebpageBodyValue;
4
- export declare class WebpageBody implements IValueObject<WebpageBodyValue> {
5
- private _value;
6
- private constructor();
7
- static create(candidate: unknown): Feedback<WebpageBody, Error>;
8
- get value(): WebpageBodyValue;
9
- }
10
- export declare function isWebpageBody(candidate: unknown): candidate is WebpageBody;
1
+ import { Feedback, IValueObject } from './index.js';
2
+ export type WebpageBodyValue = Readonly<string>;
3
+ export declare function isWebpageBodyValue(candidate: unknown): candidate is WebpageBodyValue;
4
+ export declare class WebpageBody implements IValueObject<WebpageBodyValue> {
5
+ private _value;
6
+ private constructor();
7
+ static create(candidate: unknown): Feedback<WebpageBody, Error>;
8
+ get value(): WebpageBodyValue;
9
+ }
10
+ export declare function isWebpageBody(candidate: unknown): candidate is WebpageBody;
11
11
  //# sourceMappingURL=WebpageBody.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebpageBody.d.ts","sourceRoot":"","sources":["../../src/data-source/WebpageBody.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,QAAQ,EAAE,YAAY,EAAS,MAAM,YAAY,CAAA;AAElE,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAA;AAE/C,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,OAAO,GACjB,SAAS,IAAI,gBAAgB,CAE/B;AAED,qBAAa,WAAY,YAAW,YAAY,CAAC,gBAAgB,CAAC;IAC5C,OAAO,CAAC,MAAM;IAAlC,OAAO;IACP,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,GAAG,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC;IAgB/D,IAAI,KAAK,IAAI,gBAAgB,CAE5B;CACF;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,OAAO,GAAG,SAAS,IAAI,WAAW,CAE1E"}
@@ -1,34 +1,34 @@
1
- import { Failure, Result } from './index.js';
2
- export function isWebpageBodyValue(candidate) {
3
- return typeof candidate === 'string';
4
- }
5
- export class WebpageBody {
6
- _value;
7
- constructor(_value) {
8
- this._value = _value;
9
- }
10
- static create(candidate) {
11
- try {
12
- if (!isWebpageBodyValue(candidate)) {
13
- const msg = 'invalid WebpageBody creation value';
14
- const error = new Error(msg);
15
- return Failure.create(error);
16
- }
17
- const webpageBody = new WebpageBody(candidate);
18
- return Result.create(webpageBody);
19
- }
20
- catch (error) {
21
- if (error instanceof Error) {
22
- return Failure.create(error);
23
- }
24
- throw error;
25
- }
26
- }
27
- get value() {
28
- return this._value;
29
- }
30
- }
31
- export function isWebpageBody(candidate) {
32
- return candidate instanceof WebpageBody;
33
- }
1
+ import { Failure, Result } from './index.js';
2
+ export function isWebpageBodyValue(candidate) {
3
+ return typeof candidate === 'string';
4
+ }
5
+ export class WebpageBody {
6
+ _value;
7
+ constructor(_value) {
8
+ this._value = _value;
9
+ }
10
+ static create(candidate) {
11
+ try {
12
+ if (!isWebpageBodyValue(candidate)) {
13
+ const msg = 'invalid WebpageBody creation value';
14
+ const error = new Error(msg);
15
+ return Failure.create(error);
16
+ }
17
+ const webpageBody = new WebpageBody(candidate);
18
+ return Result.create(webpageBody);
19
+ }
20
+ catch (error) {
21
+ if (error instanceof Error) {
22
+ return Failure.create(error);
23
+ }
24
+ throw error;
25
+ }
26
+ }
27
+ get value() {
28
+ return this._value;
29
+ }
30
+ }
31
+ export function isWebpageBody(candidate) {
32
+ return candidate instanceof WebpageBody;
33
+ }
34
34
  //# sourceMappingURL=WebpageBody.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebpageBody.js","sourceRoot":"","sources":["../../src/data-source/WebpageBody.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAA0B,MAAM,EAAC,MAAM,YAAY,CAAA;AAIlE,MAAM,UAAU,kBAAkB,CAChC,SAAkB;IAElB,OAAO,OAAO,SAAS,KAAK,QAAQ,CAAA;AACtC,CAAC;AAED,MAAM,OAAO,WAAW;IACM;IAA5B,YAA4B,MAAwB;QAAxB,WAAM,GAAN,MAAM,CAAkB;IAAG,CAAC;IACxD,MAAM,CAAC,MAAM,CAAC,SAAkB;QAC9B,IAAI;YACF,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,EAAE;gBAClC,MAAM,GAAG,GAAG,oCAAoC,CAAA;gBAChD,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,CAAA;gBAC5B,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;aAC7B;YACD,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,SAAS,CAAC,CAAA;YAC9C,OAAO,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;SAClC;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;IACD,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;CACF;AAED,MAAM,UAAU,aAAa,CAAC,SAAkB;IAC9C,OAAO,SAAS,YAAY,WAAW,CAAA;AACzC,CAAC"}
@@ -1,11 +1,11 @@
1
- import { Feedback, IValueObject } from '@marketeer-intelligence/infrastructure';
2
- export type WebpageUrlValue = Readonly<string>;
3
- export declare function isWebpageUrlValue(candidate: unknown): candidate is WebpageUrlValue;
4
- export declare class WebpageUrl implements IValueObject<WebpageUrlValue> {
5
- private _value;
6
- private constructor();
7
- static create(candidate: unknown): Feedback<WebpageUrl, Error>;
8
- get value(): WebpageUrlValue;
9
- }
10
- export declare function isWebpageUrl(candidate: unknown): candidate is WebpageUrl;
1
+ import { Feedback, IValueObject } from './index.js';
2
+ export type WebpageUrlValue = Readonly<string>;
3
+ export declare function isWebpageUrlValue(candidate: unknown): candidate is WebpageUrlValue;
4
+ export declare class WebpageUrl implements IValueObject<WebpageUrlValue> {
5
+ private _value;
6
+ private constructor();
7
+ static create(candidate: unknown): Feedback<WebpageUrl, Error>;
8
+ get value(): WebpageUrlValue;
9
+ }
10
+ export declare function isWebpageUrl(candidate: unknown): candidate is WebpageUrl;
11
11
  //# sourceMappingURL=WebpageUrl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebpageUrl.d.ts","sourceRoot":"","sources":["../../src/data-source/WebpageUrl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,QAAQ,EAAU,YAAY,EAAC,MAAM,YAAY,CAAA;AAElE,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAA;AAK9C,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,OAAO,GACjB,SAAS,IAAI,eAAe,CAI9B;AAED,qBAAa,UAAW,YAAW,YAAY,CAAC,eAAe,CAAC;IAC1C,OAAO,CAAC,MAAM;IAAlC,OAAO;IACP,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,GAAG,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC;IAgB9D,IAAI,KAAK,IAAI,eAAe,CAE3B;CACF;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,OAAO,GAAG,SAAS,IAAI,UAAU,CAExE"}