opticedge-cloud-utils 1.0.16 → 1.0.18
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 +1 -0
- package/dist/index.js +1 -0
- package/dist/types/pokemontcg.d.ts +6 -1
- 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 +1 -0
- package/src/types/pokemontcg.ts +6 -1
- package/src/types/pricecharting.ts +31 -31
- package/src/utils/regex.test.ts +24 -0
- package/src/utils/regex.ts +3 -0
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -21,5 +21,6 @@ __exportStar(require("./db/mongo3"), exports);
|
|
|
21
21
|
__exportStar(require("./types/pokemontcg"), exports);
|
|
22
22
|
__exportStar(require("./types/pricecharting"), exports);
|
|
23
23
|
__exportStar(require("./utils/env"), exports);
|
|
24
|
+
__exportStar(require("./utils/regex"), exports);
|
|
24
25
|
__exportStar(require("./utils/secrets"), exports);
|
|
25
26
|
__exportStar(require("./utils/task"), exports);
|
|
@@ -122,7 +122,12 @@ export type PokemonTCGCard = {
|
|
|
122
122
|
export type PokemonPriceHistory = {
|
|
123
123
|
_id: string;
|
|
124
124
|
card_id: string;
|
|
125
|
-
card_data:
|
|
125
|
+
card_data: {
|
|
126
|
+
name: string;
|
|
127
|
+
number: string;
|
|
128
|
+
setName: string;
|
|
129
|
+
setSeries: string;
|
|
130
|
+
};
|
|
126
131
|
pricehistory: [
|
|
127
132
|
{
|
|
128
133
|
date: string;
|
|
@@ -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
package/src/types/pokemontcg.ts
CHANGED
|
@@ -125,7 +125,12 @@ export type PokemonTCGCard = {
|
|
|
125
125
|
export type PokemonPriceHistory = {
|
|
126
126
|
_id: string
|
|
127
127
|
card_id: string
|
|
128
|
-
card_data:
|
|
128
|
+
card_data: {
|
|
129
|
+
name: string
|
|
130
|
+
number: string
|
|
131
|
+
setName: string
|
|
132
|
+
setSeries: string
|
|
133
|
+
}
|
|
129
134
|
pricehistory: [
|
|
130
135
|
{
|
|
131
136
|
date: string
|
|
@@ -1,36 +1,36 @@
|
|
|
1
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
|
|
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
19
|
}
|
|
20
20
|
|
|
21
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]
|
|
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
35
|
updatedAt: string
|
|
36
|
-
}
|
|
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
|
+
})
|