opticedge-cloud-utils 1.0.15 → 1.0.17
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/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/types/pricecharting.d.ts +36 -0
- package/dist/types/pricecharting.js +2 -0
- package/dist/utils/regex.d.ts +1 -0
- package/dist/utils/regex.js +6 -0
- package/dist/utils/regex.test.d.ts +1 -0
- package/dist/utils/regex.test.js +22 -0
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/types/pricecharting.ts +36 -0
- package/src/utils/regex.test.ts +24 -0
- package/src/utils/regex.ts +3 -0
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export * from './db/mongo';
|
|
|
3
3
|
export * from './db/mongo2';
|
|
4
4
|
export * from './db/mongo3';
|
|
5
5
|
export * from './types/pokemontcg';
|
|
6
|
+
export * from './types/pricecharting';
|
|
6
7
|
export * from './utils/env';
|
|
8
|
+
export * from './utils/regex';
|
|
7
9
|
export * from './utils/secrets';
|
|
8
10
|
export * from './utils/task';
|
package/dist/index.js
CHANGED
|
@@ -19,6 +19,8 @@ __exportStar(require("./db/mongo"), exports);
|
|
|
19
19
|
__exportStar(require("./db/mongo2"), exports);
|
|
20
20
|
__exportStar(require("./db/mongo3"), exports);
|
|
21
21
|
__exportStar(require("./types/pokemontcg"), exports);
|
|
22
|
+
__exportStar(require("./types/pricecharting"), exports);
|
|
22
23
|
__exportStar(require("./utils/env"), exports);
|
|
24
|
+
__exportStar(require("./utils/regex"), exports);
|
|
23
25
|
__exportStar(require("./utils/secrets"), exports);
|
|
24
26
|
__exportStar(require("./utils/task"), exports);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
type PriceChartingPrice = {
|
|
2
|
+
loose: number | null;
|
|
3
|
+
cib: number | null;
|
|
4
|
+
new: number | null;
|
|
5
|
+
graded: number | null;
|
|
6
|
+
boxOnly: number | null;
|
|
7
|
+
manualOnly: number | null;
|
|
8
|
+
bgs10: number | null;
|
|
9
|
+
condition17: number | null;
|
|
10
|
+
condition18: number | null;
|
|
11
|
+
gamestop: number | null;
|
|
12
|
+
gamestopTrade: number | null;
|
|
13
|
+
retailLooseBuy: number | null;
|
|
14
|
+
retailLooseSell: number | null;
|
|
15
|
+
retailCibBuy: number | null;
|
|
16
|
+
retailCibSell: number | null;
|
|
17
|
+
retailNewBuy: number | null;
|
|
18
|
+
retailNewSell: number | null;
|
|
19
|
+
};
|
|
20
|
+
export type PriceChartingCard = {
|
|
21
|
+
id: number;
|
|
22
|
+
consoleName: string;
|
|
23
|
+
productName: string;
|
|
24
|
+
upc: string;
|
|
25
|
+
genre: string;
|
|
26
|
+
tcgId: string;
|
|
27
|
+
asin: string;
|
|
28
|
+
epid: string;
|
|
29
|
+
releaseDate: string;
|
|
30
|
+
price: PriceChartingPrice;
|
|
31
|
+
priceHistory: [PriceChartingPrice];
|
|
32
|
+
salesVolume: number | null;
|
|
33
|
+
salesVolumeHistory: [number | null];
|
|
34
|
+
updatedAt: string;
|
|
35
|
+
};
|
|
36
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function escapeRegex(input: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const regex_1 = require("./regex");
|
|
4
|
+
describe('escapeRegex', () => {
|
|
5
|
+
it('escapes regex special characters', () => {
|
|
6
|
+
const input = 'Pikachu.$^*+?()[]{}|\\';
|
|
7
|
+
const expected = 'Pikachu\\.\\$\\^\\*\\+\\?\\(\\)\\[\\]\\{\\}\\|\\\\';
|
|
8
|
+
expect((0, regex_1.escapeRegex)(input)).toBe(expected);
|
|
9
|
+
});
|
|
10
|
+
it('returns same string if no special characters', () => {
|
|
11
|
+
const input = 'Charmander123';
|
|
12
|
+
expect((0, regex_1.escapeRegex)(input)).toBe('Charmander123');
|
|
13
|
+
});
|
|
14
|
+
it('works with empty string', () => {
|
|
15
|
+
expect((0, regex_1.escapeRegex)('')).toBe('');
|
|
16
|
+
});
|
|
17
|
+
it('does not escape regular alphanumerics or spaces', () => {
|
|
18
|
+
const input = 'Lt. Surge Pikachu';
|
|
19
|
+
const expected = 'Lt\\. Surge Pikachu';
|
|
20
|
+
expect((0, regex_1.escapeRegex)(input)).toBe(expected);
|
|
21
|
+
});
|
|
22
|
+
});
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -3,6 +3,8 @@ export * from './db/mongo'
|
|
|
3
3
|
export * from './db/mongo2'
|
|
4
4
|
export * from './db/mongo3'
|
|
5
5
|
export * from './types/pokemontcg'
|
|
6
|
+
export * from './types/pricecharting'
|
|
6
7
|
export * from './utils/env'
|
|
8
|
+
export * from './utils/regex'
|
|
7
9
|
export * from './utils/secrets'
|
|
8
10
|
export * from './utils/task'
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
type PriceChartingPrice = {
|
|
2
|
+
loose: number | null
|
|
3
|
+
cib: number | null
|
|
4
|
+
new: number | null
|
|
5
|
+
graded: number | null
|
|
6
|
+
boxOnly: number | null
|
|
7
|
+
manualOnly: number | null
|
|
8
|
+
bgs10: number | null
|
|
9
|
+
condition17: number | null
|
|
10
|
+
condition18: number | null
|
|
11
|
+
gamestop: number | null
|
|
12
|
+
gamestopTrade: number | null
|
|
13
|
+
retailLooseBuy: number | null
|
|
14
|
+
retailLooseSell: number | null
|
|
15
|
+
retailCibBuy: number | null
|
|
16
|
+
retailCibSell: number | null
|
|
17
|
+
retailNewBuy: number | null
|
|
18
|
+
retailNewSell: number | null
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type PriceChartingCard = {
|
|
22
|
+
id: number
|
|
23
|
+
consoleName: string
|
|
24
|
+
productName: string
|
|
25
|
+
upc: string
|
|
26
|
+
genre: string
|
|
27
|
+
tcgId: string
|
|
28
|
+
asin: string
|
|
29
|
+
epid: string
|
|
30
|
+
releaseDate: string
|
|
31
|
+
price: PriceChartingPrice
|
|
32
|
+
priceHistory: [PriceChartingPrice]
|
|
33
|
+
salesVolume: number | null
|
|
34
|
+
salesVolumeHistory: [number | null]
|
|
35
|
+
updatedAt: string
|
|
36
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { escapeRegex } from './regex'
|
|
2
|
+
|
|
3
|
+
describe('escapeRegex', () => {
|
|
4
|
+
it('escapes regex special characters', () => {
|
|
5
|
+
const input = 'Pikachu.$^*+?()[]{}|\\'
|
|
6
|
+
const expected = 'Pikachu\\.\\$\\^\\*\\+\\?\\(\\)\\[\\]\\{\\}\\|\\\\'
|
|
7
|
+
expect(escapeRegex(input)).toBe(expected)
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
it('returns same string if no special characters', () => {
|
|
11
|
+
const input = 'Charmander123'
|
|
12
|
+
expect(escapeRegex(input)).toBe('Charmander123')
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
it('works with empty string', () => {
|
|
16
|
+
expect(escapeRegex('')).toBe('')
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
it('does not escape regular alphanumerics or spaces', () => {
|
|
20
|
+
const input = 'Lt. Surge Pikachu'
|
|
21
|
+
const expected = 'Lt\\. Surge Pikachu'
|
|
22
|
+
expect(escapeRegex(input)).toBe(expected)
|
|
23
|
+
})
|
|
24
|
+
})
|