dgc-core 0.0.0-stage → 2.0.0
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/README.md +84 -2
- package/dist/auth.d.ts +7 -0
- package/dist/auth.js +23 -0
- package/dist/chunk.d.ts +1 -0
- package/dist/chunk.js +37 -0
- package/dist/constants/card-languages.json +12 -0
- package/dist/constants/card.d.ts +4 -0
- package/dist/constants/card.js +16 -0
- package/dist/constants/giveaway.d.ts +2 -0
- package/dist/constants/giveaway.js +5 -0
- package/dist/constants/payment.d.ts +3 -0
- package/dist/constants/payment.js +7 -0
- package/dist/db/mongo.d.ts +5 -0
- package/dist/db/mongo.js +40 -0
- package/dist/db/mongo2.d.ts +5 -0
- package/dist/db/mongo2.js +36 -0
- package/dist/db/mongo3.d.ts +8 -0
- package/dist/db/mongo3.js +61 -0
- package/dist/enums/card.d.ts +74 -0
- package/dist/enums/card.js +85 -0
- package/dist/enums/giveaway.d.ts +61 -0
- package/dist/enums/giveaway.js +75 -0
- package/dist/enums/rc.d.ts +16 -0
- package/dist/enums/rc.js +21 -0
- package/dist/enums/user.d.ts +7 -0
- package/dist/enums/user.js +11 -0
- package/dist/env.d.ts +1 -0
- package/dist/env.js +13 -0
- package/dist/giveaways/credit-award.d.ts +25 -0
- package/dist/giveaways/credit-award.js +73 -0
- package/dist/giveaways/domain.d.ts +64 -0
- package/dist/giveaways/domain.js +293 -0
- package/dist/giveaways/entry-id.d.ts +4 -0
- package/dist/giveaways/entry-id.js +15 -0
- package/dist/giveaways/giveaway-repository.d.ts +278 -0
- package/dist/giveaways/giveaway-repository.js +1329 -0
- package/dist/giveaways/index.d.ts +7 -0
- package/dist/giveaways/index.js +22 -0
- package/dist/giveaways/schemas.d.ts +123 -0
- package/dist/giveaways/schemas.js +142 -0
- package/dist/giveaways/types.d.ts +1 -0
- package/dist/giveaways/types.js +2 -0
- package/dist/http-error.d.ts +5 -0
- package/dist/http-error.js +12 -0
- package/dist/id.d.ts +7 -0
- package/dist/id.js +43 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +38 -0
- package/dist/logger.d.ts +8 -0
- package/dist/logger.js +53 -0
- package/dist/number.d.ts +1 -0
- package/dist/number.js +6 -0
- package/dist/parser.d.ts +3 -0
- package/dist/parser.js +24 -0
- package/dist/pricecharting.d.ts +29 -0
- package/dist/pricecharting.js +167 -0
- package/dist/pub.d.ts +1 -0
- package/dist/pub.js +36 -0
- package/dist/regex.d.ts +12 -0
- package/dist/regex.js +22 -0
- package/dist/retry.d.ts +13 -0
- package/dist/retry.js +134 -0
- package/dist/secrets.d.ts +8 -0
- package/dist/secrets.js +22 -0
- package/dist/task.d.ts +12 -0
- package/dist/task.js +103 -0
- package/dist/tw/utils.d.ts +1 -0
- package/dist/tw/utils.js +19 -0
- package/dist/tw/wallet.d.ts +1 -0
- package/dist/tw/wallet.js +57 -0
- package/dist/types/blockchain.d.ts +5 -0
- package/dist/types/blockchain.js +2 -0
- package/dist/types/card.d.ts +104 -0
- package/dist/types/card.js +2 -0
- package/dist/types/embedding.d.ts +6 -0
- package/dist/types/embedding.js +2 -0
- package/dist/types/env.d.ts +1 -0
- package/dist/types/env.js +2 -0
- package/dist/types/giveaway.d.ts +304 -0
- package/dist/types/giveaway.js +2 -0
- package/dist/types/index.d.ts +20 -0
- package/dist/types/index.js +36 -0
- package/dist/types/instant.d.ts +46 -0
- package/dist/types/instant.js +5 -0
- package/dist/types/notification.d.ts +17 -0
- package/dist/types/notification.js +2 -0
- package/dist/types/payment.d.ts +1 -0
- package/dist/types/payment.js +2 -0
- package/dist/types/pokemontcg.d.ts +97 -0
- package/dist/types/pokemontcg.js +2 -0
- package/dist/types/pricecharting.d.ts +86 -0
- package/dist/types/pricecharting.js +2 -0
- package/dist/types/rc.d.ts +40 -0
- package/dist/types/rc.js +2 -0
- package/dist/types/user.d.ts +62 -0
- package/dist/types/user.js +2 -0
- package/dist/types/x-credit.d.ts +9 -0
- package/dist/types/x-credit.js +2 -0
- package/dist/validator.d.ts +4 -0
- package/dist/validator.js +11 -0
- package/package.json +72 -4
package/README.md
CHANGED
|
@@ -1,3 +1,85 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dgc-core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Shared DGC contracts, business rules and backend helpers. This package combines
|
|
4
|
+
`opticedge-types` and `opticedge-cloud-utils` without depending on either package.
|
|
5
|
+
|
|
6
|
+
## Imports
|
|
7
|
+
|
|
8
|
+
Use the package root in server code:
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import { connectToMongo3, GiveawayRepository, HttpError } from 'dgc-core'
|
|
12
|
+
import type { FbUser, GiveawayEntry } from 'dgc-core'
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Use `dgc-core/types` in browser components, mobile clients and other shared code:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { UserCollectorType } from 'dgc-core/types'
|
|
19
|
+
import type { GiveawayPublic, GiveawayEntryStatus } from 'dgc-core/types'
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The types entry includes the existing enums and constants as well as TypeScript
|
|
23
|
+
contracts. It loads no Node builtins, MongoDB or Google Cloud SDKs. The root also
|
|
24
|
+
exports those contracts, alongside server helpers, and loads server dependencies.
|
|
25
|
+
Browser code must use the types entry even when it only needs a runtime enum.
|
|
26
|
+
|
|
27
|
+
In a Next.js application, keep root imports in server modules and add `dgc-core`
|
|
28
|
+
to `serverExternalPackages` if the application previously externalized
|
|
29
|
+
`opticedge-cloud-utils`.
|
|
30
|
+
|
|
31
|
+
## Migrating
|
|
32
|
+
|
|
33
|
+
| Previous import | New import |
|
|
34
|
+
| ------------------------------------------- | ------------------------------ |
|
|
35
|
+
| `opticedge-cloud-utils` | `dgc-core` |
|
|
36
|
+
| `opticedge-types` in browser or shared code | `dgc-core/types` |
|
|
37
|
+
| `opticedge-types` in server code | `dgc-core/types` or `dgc-core` |
|
|
38
|
+
|
|
39
|
+
Replace the two previous dependencies with `dgc-core`. Build and test each
|
|
40
|
+
consumer after updating its imports, mocks and lockfile. Build and publish this
|
|
41
|
+
package through the existing release process before using `dgc-core@1.0.0` in a
|
|
42
|
+
fresh registry installation. Existing source repositories and published package
|
|
43
|
+
versions remain independent until their consumers migrate.
|
|
44
|
+
|
|
45
|
+
## Included code
|
|
46
|
+
|
|
47
|
+
- Contracts for Firebase users, cards, grading, payments, notifications and
|
|
48
|
+
giveaways, plus the existing enums and constants.
|
|
49
|
+
- MongoDB connection helpers, including connection caching per URI in
|
|
50
|
+
`connectToMongo3` and retry after a failed connection.
|
|
51
|
+
- Cloud Tasks, Pub/Sub, Secret Manager and request verification helpers.
|
|
52
|
+
- Retry, logging, parsing, validation, IDs, HTTP errors and other existing
|
|
53
|
+
backend utilities.
|
|
54
|
+
- Giveaway validation, lifecycle and entry rules, winner assignment, CSV export
|
|
55
|
+
and the transactional MongoDB repository.
|
|
56
|
+
|
|
57
|
+
Giveaway services instantiate `new GiveawayRepository(database, client)` using
|
|
58
|
+
their own connection. Configuration, authentication, HTTP handlers and delivery
|
|
59
|
+
adapters stay in the application. Collection and index provisioning stays in
|
|
60
|
+
`dgc-db-ops`.
|
|
61
|
+
|
|
62
|
+
Giveaway documents use MongoDB ObjectIds, serialized as 24-character hexadecimal
|
|
63
|
+
strings in APIs; entry IDs use 12 decimal characters and preserve leading zeros.
|
|
64
|
+
Firebase `userId` identifies each entrant. Collector type is informational and
|
|
65
|
+
never changes eligibility. Administrative entry and winner records contain
|
|
66
|
+
personal information and require authorized access; use `GiveawayPublic` for
|
|
67
|
+
public app responses. `DomainError` and `HttpError` refer to the same constructor.
|
|
68
|
+
|
|
69
|
+
## Development
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
npm ci
|
|
73
|
+
npm run build
|
|
74
|
+
npm test
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Build before running the package entry tests so they inspect the same compiled
|
|
78
|
+
files consumers use. The existing utility and giveaway tests remain, with
|
|
79
|
+
additional checks for the public root export, the browser import boundary and
|
|
80
|
+
compiled TypeScript contracts. Tests use local fixtures and mocks; they do not
|
|
81
|
+
send notifications or connect to a live database.
|
|
82
|
+
|
|
83
|
+
## Giveaway MVP v2
|
|
84
|
+
|
|
85
|
+
One ticket per Firebase account, one winner per giveaway, saved random/manual selection and explicit confirmation. Physical address and contact number are collected at claim only. Credit rewards snapshot `creditAmount` and use `fulfillGiveawayCredits` to atomically change Firebase `instantCredits` plus a permanent per-giveaway marker. Status reads reconcile without issuing credits. See dgc-giveaways/docs/api.md and integration.md for contracts and release order.
|
package/dist/auth.d.ts
ADDED
package/dist/auth.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.verifyRequest = verifyRequest;
|
|
4
|
+
const google_auth_library_1 = require("google-auth-library");
|
|
5
|
+
async function verifyRequest(req, options) {
|
|
6
|
+
const authHeader = req.headers['authorization'];
|
|
7
|
+
if (!authHeader || !authHeader.startsWith('Bearer ')) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
const token = authHeader.split(' ')[1];
|
|
11
|
+
const client = new google_auth_library_1.OAuth2Client();
|
|
12
|
+
try {
|
|
13
|
+
const ticket = await client.verifyIdToken({
|
|
14
|
+
idToken: token,
|
|
15
|
+
audience: options.allowedAudience
|
|
16
|
+
});
|
|
17
|
+
const payload = ticket.getPayload();
|
|
18
|
+
return payload?.email === options.allowedServiceAccount;
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
}
|
package/dist/chunk.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function chunkByBytes(arr: any[], maxBytes?: number): any[][];
|
package/dist/chunk.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.chunkByBytes = chunkByBytes;
|
|
5
|
+
function chunkByBytes(arr, maxBytes = 700000) {
|
|
6
|
+
// 700KB safe default
|
|
7
|
+
const chunks = [];
|
|
8
|
+
let current = [];
|
|
9
|
+
let curBytes = 0;
|
|
10
|
+
for (const item of arr) {
|
|
11
|
+
const s = JSON.stringify(item);
|
|
12
|
+
const b = Buffer.byteLength(s, 'utf8');
|
|
13
|
+
// if a single item exceeds maxBytes, push it alone (or skip)
|
|
14
|
+
if (b > maxBytes) {
|
|
15
|
+
// optionally log and skip - here we'll push as its own chunk
|
|
16
|
+
if (current.length) {
|
|
17
|
+
chunks.push(current);
|
|
18
|
+
current = [];
|
|
19
|
+
curBytes = 0;
|
|
20
|
+
}
|
|
21
|
+
chunks.push([item]);
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
if (curBytes + b > maxBytes) {
|
|
25
|
+
chunks.push(current);
|
|
26
|
+
current = [item];
|
|
27
|
+
curBytes = b;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
current.push(item);
|
|
31
|
+
curBytes += b;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (current.length)
|
|
35
|
+
chunks.push(current);
|
|
36
|
+
return chunks;
|
|
37
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PENDING_GRADING = exports.POST_GRADING_ELIGIBLE_GRADING_TYPES = exports.ON_DEMAND_ELIGIBLE_GRADING_TYPES = void 0;
|
|
4
|
+
const card_1 = require("../enums/card");
|
|
5
|
+
exports.ON_DEMAND_ELIGIBLE_GRADING_TYPES = [
|
|
6
|
+
card_1.CardGradingType.DEEP_2024,
|
|
7
|
+
card_1.CardGradingType.DEEP,
|
|
8
|
+
card_1.CardGradingType.INSTANT,
|
|
9
|
+
card_1.CardGradingType.DEEP_INSTANT
|
|
10
|
+
];
|
|
11
|
+
exports.POST_GRADING_ELIGIBLE_GRADING_TYPES = [
|
|
12
|
+
card_1.CardGradingType.DEEP,
|
|
13
|
+
card_1.CardGradingType.INSTANT,
|
|
14
|
+
card_1.CardGradingType.DEEP_INSTANT
|
|
15
|
+
];
|
|
16
|
+
exports.PENDING_GRADING = -1;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Db, Collection, Document } from 'mongodb';
|
|
2
|
+
export declare function connectToMongo(uri: string, dbName: string): Promise<void>;
|
|
3
|
+
export declare function getDb(): Db;
|
|
4
|
+
export declare function getCollection<T extends Document = Document>(name: string): Collection<T>;
|
|
5
|
+
export declare function closeMongo(): Promise<void>;
|
package/dist/db/mongo.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.connectToMongo = connectToMongo;
|
|
4
|
+
exports.getDb = getDb;
|
|
5
|
+
exports.getCollection = getCollection;
|
|
6
|
+
exports.closeMongo = closeMongo;
|
|
7
|
+
const mongodb_1 = require("mongodb");
|
|
8
|
+
let client;
|
|
9
|
+
let db;
|
|
10
|
+
let connectPromise;
|
|
11
|
+
async function connectToMongo(uri, dbName) {
|
|
12
|
+
if (db)
|
|
13
|
+
return; // already connected
|
|
14
|
+
if (!connectPromise) {
|
|
15
|
+
connectPromise = (async () => {
|
|
16
|
+
client = new mongodb_1.MongoClient(uri);
|
|
17
|
+
await client.connect();
|
|
18
|
+
db = client.db(dbName);
|
|
19
|
+
})();
|
|
20
|
+
}
|
|
21
|
+
await connectPromise;
|
|
22
|
+
}
|
|
23
|
+
function getDb() {
|
|
24
|
+
if (!db)
|
|
25
|
+
throw new Error('Mongo not initialized. Call connectToMongo(...) first.');
|
|
26
|
+
return db;
|
|
27
|
+
}
|
|
28
|
+
function getCollection(name) {
|
|
29
|
+
if (!db)
|
|
30
|
+
throw new Error('Mongo not initialized');
|
|
31
|
+
return db.collection(name);
|
|
32
|
+
}
|
|
33
|
+
async function closeMongo() {
|
|
34
|
+
if (!client)
|
|
35
|
+
return;
|
|
36
|
+
await client.close();
|
|
37
|
+
client = undefined;
|
|
38
|
+
db = undefined;
|
|
39
|
+
connectPromise = undefined;
|
|
40
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Db, Collection, Document } from 'mongodb';
|
|
2
|
+
export declare function connectToMongo2(uri: string): Promise<void>;
|
|
3
|
+
export declare function getDb2(dbName: string): Db;
|
|
4
|
+
export declare function getCollection2<T extends Document = Document>(dbName: string, collectionName: string): Collection<T>;
|
|
5
|
+
export declare function closeMongo2(): Promise<void>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.connectToMongo2 = connectToMongo2;
|
|
4
|
+
exports.getDb2 = getDb2;
|
|
5
|
+
exports.getCollection2 = getCollection2;
|
|
6
|
+
exports.closeMongo2 = closeMongo2;
|
|
7
|
+
// Multi DB safe util
|
|
8
|
+
const mongodb_1 = require("mongodb");
|
|
9
|
+
let client;
|
|
10
|
+
let connectPromise;
|
|
11
|
+
async function connectToMongo2(uri) {
|
|
12
|
+
if (client)
|
|
13
|
+
return; // already connected
|
|
14
|
+
if (!connectPromise) {
|
|
15
|
+
connectPromise = (async () => {
|
|
16
|
+
client = new mongodb_1.MongoClient(uri);
|
|
17
|
+
await client.connect();
|
|
18
|
+
})();
|
|
19
|
+
}
|
|
20
|
+
await connectPromise;
|
|
21
|
+
}
|
|
22
|
+
function getDb2(dbName) {
|
|
23
|
+
if (!client)
|
|
24
|
+
throw new Error('Mongo not initialized');
|
|
25
|
+
return client.db(dbName);
|
|
26
|
+
}
|
|
27
|
+
function getCollection2(dbName, collectionName) {
|
|
28
|
+
return getDb2(dbName).collection(collectionName);
|
|
29
|
+
}
|
|
30
|
+
async function closeMongo2() {
|
|
31
|
+
if (!client)
|
|
32
|
+
return;
|
|
33
|
+
await client.close();
|
|
34
|
+
client = undefined;
|
|
35
|
+
connectPromise = undefined;
|
|
36
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MongoClient, Db, Collection, Document } from 'mongodb';
|
|
2
|
+
export declare function connectToMongo3(uri: string): Promise<MongoClient>;
|
|
3
|
+
export declare function getDb3(uri: string, dbName: string): Db;
|
|
4
|
+
export declare function getCollection3<T extends Document = Document>(uri: string, dbName: string, collectionName: string): Collection<T>;
|
|
5
|
+
export declare function closeMongo3(uri: string): Promise<void>;
|
|
6
|
+
export declare function closeAllMongo3(): Promise<void>;
|
|
7
|
+
export declare const __mongoClients: Map<string, MongoClient>;
|
|
8
|
+
export declare const __connectPromises: Map<string, Promise<void>>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.__connectPromises = exports.__mongoClients = void 0;
|
|
4
|
+
exports.connectToMongo3 = connectToMongo3;
|
|
5
|
+
exports.getDb3 = getDb3;
|
|
6
|
+
exports.getCollection3 = getCollection3;
|
|
7
|
+
exports.closeMongo3 = closeMongo3;
|
|
8
|
+
exports.closeAllMongo3 = closeAllMongo3;
|
|
9
|
+
// Multi cluster safe util
|
|
10
|
+
const mongodb_1 = require("mongodb");
|
|
11
|
+
const clients = new Map();
|
|
12
|
+
const connectPromises = new Map();
|
|
13
|
+
async function connectToMongo3(uri) {
|
|
14
|
+
if (!connectPromises.has(uri)) {
|
|
15
|
+
const client = new mongodb_1.MongoClient(uri);
|
|
16
|
+
const promise = Promise.resolve().then(async () => {
|
|
17
|
+
try {
|
|
18
|
+
await client.connect();
|
|
19
|
+
clients.set(uri, client);
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
connectPromises.delete(uri);
|
|
23
|
+
try {
|
|
24
|
+
await client.close();
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
// Preserve the original connection failure if cleanup also fails.
|
|
28
|
+
}
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
connectPromises.set(uri, promise);
|
|
33
|
+
}
|
|
34
|
+
await connectPromises.get(uri);
|
|
35
|
+
return clients.get(uri);
|
|
36
|
+
}
|
|
37
|
+
function getDb3(uri, dbName) {
|
|
38
|
+
const client = clients.get(uri);
|
|
39
|
+
if (!client) {
|
|
40
|
+
throw new Error(`Mongo client not initialized`);
|
|
41
|
+
}
|
|
42
|
+
return client.db(dbName);
|
|
43
|
+
}
|
|
44
|
+
function getCollection3(uri, dbName, collectionName) {
|
|
45
|
+
return getDb3(uri, dbName).collection(collectionName);
|
|
46
|
+
}
|
|
47
|
+
async function closeMongo3(uri) {
|
|
48
|
+
const client = clients.get(uri);
|
|
49
|
+
if (client) {
|
|
50
|
+
await client.close();
|
|
51
|
+
}
|
|
52
|
+
clients.delete(uri);
|
|
53
|
+
connectPromises.delete(uri);
|
|
54
|
+
}
|
|
55
|
+
async function closeAllMongo3() {
|
|
56
|
+
await Promise.all(Array.from(clients.values()).map(client => client.close()));
|
|
57
|
+
clients.clear();
|
|
58
|
+
connectPromises.clear();
|
|
59
|
+
}
|
|
60
|
+
exports.__mongoClients = clients;
|
|
61
|
+
exports.__connectPromises = connectPromises;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export declare enum TradingCardType {
|
|
2
|
+
POKEMON = "pokemon",
|
|
3
|
+
LORCANA = "lorcana",
|
|
4
|
+
MAGIC = "magic",
|
|
5
|
+
YUGIOH = "yugioh",
|
|
6
|
+
DIGIMON = "digimon",
|
|
7
|
+
DRAGON_BALL = "dragon_ball",
|
|
8
|
+
ONE_PIECE = "one_piece",
|
|
9
|
+
STAR_WARS = "star_wars",
|
|
10
|
+
MARVEL = "marvel",
|
|
11
|
+
GARBAGE_PAIL = "garbage_pail",
|
|
12
|
+
OTHER_TCG = "other_tcg",
|
|
13
|
+
OTHER_NON_TCG = "other"
|
|
14
|
+
}
|
|
15
|
+
export declare enum SportsCardType {
|
|
16
|
+
BASEBALL = "baseball",
|
|
17
|
+
BASKETBALL = "basketball",
|
|
18
|
+
FOOTBALL = "football",
|
|
19
|
+
HOCKEY = "hockey",
|
|
20
|
+
SOCCER = "soccer",
|
|
21
|
+
RACING = "racing",
|
|
22
|
+
WRESTLING = "wrestling",
|
|
23
|
+
UFC = "ufc",
|
|
24
|
+
BOXING = "boxing",
|
|
25
|
+
GOLF = "golf",
|
|
26
|
+
TENNIS = "tennis"
|
|
27
|
+
}
|
|
28
|
+
export type CardType = TradingCardType | SportsCardType;
|
|
29
|
+
export declare enum CardCategory {
|
|
30
|
+
TRADING = "trading",
|
|
31
|
+
SPORTS = "sports"
|
|
32
|
+
}
|
|
33
|
+
export declare enum CardApprovalStatus {
|
|
34
|
+
Rescan = -2,
|
|
35
|
+
Pending = -1,
|
|
36
|
+
Failed = 0,
|
|
37
|
+
Approved = 1,
|
|
38
|
+
PendingInstant = 3,
|
|
39
|
+
Approving = 999
|
|
40
|
+
}
|
|
41
|
+
export declare enum CardRejectType {
|
|
42
|
+
INVALID_CARD = "Invalid card",
|
|
43
|
+
FAKE_HIGHRISK = "Fake - High Risk",
|
|
44
|
+
REPEAT = "Repeat",
|
|
45
|
+
MODEL_FAILURE = "Model failure"
|
|
46
|
+
}
|
|
47
|
+
export declare enum CardRescanType {
|
|
48
|
+
ENVIRONMENT_LOW_SCORE = "Environment - Low Score",
|
|
49
|
+
ACCURACY_LOW_SCORE = "Accuracy - Low Score",
|
|
50
|
+
ENVIRONMENT_LIGHTING = "Environment - Lighting",
|
|
51
|
+
ENVIRONMENT_ARTEFACTS = "Environment - Artefacts",
|
|
52
|
+
CARD_IN_SLAB_SLEEVE = "Card in Slab/Sleeve",
|
|
53
|
+
CARD_OBSTRUCTION = "Card - Obstruction",
|
|
54
|
+
CARD_ARTIFACTS = "CARD-ARTIFACTS",
|
|
55
|
+
SCAN_PROCESS_FAILURE = "Scan Process Failure"
|
|
56
|
+
}
|
|
57
|
+
export declare enum CardGradingType {
|
|
58
|
+
DEEP_2024 = 0,
|
|
59
|
+
DEEP = 1,
|
|
60
|
+
ADDED = 2,
|
|
61
|
+
SOLD = 3,
|
|
62
|
+
INSTANT = 4,
|
|
63
|
+
DEEP_INSTANT = 5,
|
|
64
|
+
CARD_CENTERING = 6
|
|
65
|
+
}
|
|
66
|
+
export declare enum CardInstantGradeType {
|
|
67
|
+
OVERALL = 0,
|
|
68
|
+
SUBGRADES = 1,
|
|
69
|
+
OVERALL_TO_SUBGRADES = 2
|
|
70
|
+
}
|
|
71
|
+
export declare enum CardVersions {
|
|
72
|
+
DEFAULT = "0.0",
|
|
73
|
+
VERSION_1_0 = "1.0"
|
|
74
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CardVersions = exports.CardInstantGradeType = exports.CardGradingType = exports.CardRescanType = exports.CardRejectType = exports.CardApprovalStatus = exports.CardCategory = exports.SportsCardType = exports.TradingCardType = void 0;
|
|
4
|
+
var TradingCardType;
|
|
5
|
+
(function (TradingCardType) {
|
|
6
|
+
TradingCardType["POKEMON"] = "pokemon";
|
|
7
|
+
TradingCardType["LORCANA"] = "lorcana";
|
|
8
|
+
TradingCardType["MAGIC"] = "magic";
|
|
9
|
+
TradingCardType["YUGIOH"] = "yugioh";
|
|
10
|
+
TradingCardType["DIGIMON"] = "digimon";
|
|
11
|
+
TradingCardType["DRAGON_BALL"] = "dragon_ball";
|
|
12
|
+
TradingCardType["ONE_PIECE"] = "one_piece";
|
|
13
|
+
TradingCardType["STAR_WARS"] = "star_wars";
|
|
14
|
+
TradingCardType["MARVEL"] = "marvel";
|
|
15
|
+
TradingCardType["GARBAGE_PAIL"] = "garbage_pail";
|
|
16
|
+
TradingCardType["OTHER_TCG"] = "other_tcg";
|
|
17
|
+
TradingCardType["OTHER_NON_TCG"] = "other";
|
|
18
|
+
})(TradingCardType || (exports.TradingCardType = TradingCardType = {}));
|
|
19
|
+
var SportsCardType;
|
|
20
|
+
(function (SportsCardType) {
|
|
21
|
+
SportsCardType["BASEBALL"] = "baseball";
|
|
22
|
+
SportsCardType["BASKETBALL"] = "basketball";
|
|
23
|
+
SportsCardType["FOOTBALL"] = "football";
|
|
24
|
+
SportsCardType["HOCKEY"] = "hockey";
|
|
25
|
+
SportsCardType["SOCCER"] = "soccer";
|
|
26
|
+
SportsCardType["RACING"] = "racing";
|
|
27
|
+
SportsCardType["WRESTLING"] = "wrestling";
|
|
28
|
+
SportsCardType["UFC"] = "ufc";
|
|
29
|
+
SportsCardType["BOXING"] = "boxing";
|
|
30
|
+
SportsCardType["GOLF"] = "golf";
|
|
31
|
+
SportsCardType["TENNIS"] = "tennis";
|
|
32
|
+
})(SportsCardType || (exports.SportsCardType = SportsCardType = {}));
|
|
33
|
+
var CardCategory;
|
|
34
|
+
(function (CardCategory) {
|
|
35
|
+
CardCategory["TRADING"] = "trading";
|
|
36
|
+
CardCategory["SPORTS"] = "sports";
|
|
37
|
+
})(CardCategory || (exports.CardCategory = CardCategory = {}));
|
|
38
|
+
var CardApprovalStatus;
|
|
39
|
+
(function (CardApprovalStatus) {
|
|
40
|
+
CardApprovalStatus[CardApprovalStatus["Rescan"] = -2] = "Rescan";
|
|
41
|
+
CardApprovalStatus[CardApprovalStatus["Pending"] = -1] = "Pending";
|
|
42
|
+
CardApprovalStatus[CardApprovalStatus["Failed"] = 0] = "Failed";
|
|
43
|
+
CardApprovalStatus[CardApprovalStatus["Approved"] = 1] = "Approved";
|
|
44
|
+
CardApprovalStatus[CardApprovalStatus["PendingInstant"] = 3] = "PendingInstant";
|
|
45
|
+
CardApprovalStatus[CardApprovalStatus["Approving"] = 999] = "Approving";
|
|
46
|
+
})(CardApprovalStatus || (exports.CardApprovalStatus = CardApprovalStatus = {}));
|
|
47
|
+
var CardRejectType;
|
|
48
|
+
(function (CardRejectType) {
|
|
49
|
+
CardRejectType["INVALID_CARD"] = "Invalid card";
|
|
50
|
+
CardRejectType["FAKE_HIGHRISK"] = "Fake - High Risk";
|
|
51
|
+
CardRejectType["REPEAT"] = "Repeat";
|
|
52
|
+
CardRejectType["MODEL_FAILURE"] = "Model failure";
|
|
53
|
+
})(CardRejectType || (exports.CardRejectType = CardRejectType = {}));
|
|
54
|
+
var CardRescanType;
|
|
55
|
+
(function (CardRescanType) {
|
|
56
|
+
CardRescanType["ENVIRONMENT_LOW_SCORE"] = "Environment - Low Score";
|
|
57
|
+
CardRescanType["ACCURACY_LOW_SCORE"] = "Accuracy - Low Score";
|
|
58
|
+
CardRescanType["ENVIRONMENT_LIGHTING"] = "Environment - Lighting";
|
|
59
|
+
CardRescanType["ENVIRONMENT_ARTEFACTS"] = "Environment - Artefacts";
|
|
60
|
+
CardRescanType["CARD_IN_SLAB_SLEEVE"] = "Card in Slab/Sleeve";
|
|
61
|
+
CardRescanType["CARD_OBSTRUCTION"] = "Card - Obstruction";
|
|
62
|
+
CardRescanType["CARD_ARTIFACTS"] = "CARD-ARTIFACTS";
|
|
63
|
+
CardRescanType["SCAN_PROCESS_FAILURE"] = "Scan Process Failure";
|
|
64
|
+
})(CardRescanType || (exports.CardRescanType = CardRescanType = {}));
|
|
65
|
+
var CardGradingType;
|
|
66
|
+
(function (CardGradingType) {
|
|
67
|
+
CardGradingType[CardGradingType["DEEP_2024"] = 0] = "DEEP_2024";
|
|
68
|
+
CardGradingType[CardGradingType["DEEP"] = 1] = "DEEP";
|
|
69
|
+
CardGradingType[CardGradingType["ADDED"] = 2] = "ADDED";
|
|
70
|
+
CardGradingType[CardGradingType["SOLD"] = 3] = "SOLD";
|
|
71
|
+
CardGradingType[CardGradingType["INSTANT"] = 4] = "INSTANT";
|
|
72
|
+
CardGradingType[CardGradingType["DEEP_INSTANT"] = 5] = "DEEP_INSTANT";
|
|
73
|
+
CardGradingType[CardGradingType["CARD_CENTERING"] = 6] = "CARD_CENTERING";
|
|
74
|
+
})(CardGradingType || (exports.CardGradingType = CardGradingType = {}));
|
|
75
|
+
var CardInstantGradeType;
|
|
76
|
+
(function (CardInstantGradeType) {
|
|
77
|
+
CardInstantGradeType[CardInstantGradeType["OVERALL"] = 0] = "OVERALL";
|
|
78
|
+
CardInstantGradeType[CardInstantGradeType["SUBGRADES"] = 1] = "SUBGRADES";
|
|
79
|
+
CardInstantGradeType[CardInstantGradeType["OVERALL_TO_SUBGRADES"] = 2] = "OVERALL_TO_SUBGRADES";
|
|
80
|
+
})(CardInstantGradeType || (exports.CardInstantGradeType = CardInstantGradeType = {}));
|
|
81
|
+
var CardVersions;
|
|
82
|
+
(function (CardVersions) {
|
|
83
|
+
CardVersions["DEFAULT"] = "0.0";
|
|
84
|
+
CardVersions["VERSION_1_0"] = "1.0";
|
|
85
|
+
})(CardVersions || (exports.CardVersions = CardVersions = {}));
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/** Stable string values are shared by MongoDB records, APIs and browser code. */
|
|
2
|
+
export declare enum GiveawayStatus {
|
|
3
|
+
Draft = "draft",
|
|
4
|
+
Scheduled = "scheduled",
|
|
5
|
+
Live = "live",
|
|
6
|
+
Closed = "closed",
|
|
7
|
+
AwaitingClaim = "awaiting_claim",
|
|
8
|
+
Completed = "completed",
|
|
9
|
+
Cancelled = "cancelled",
|
|
10
|
+
Archived = "archived"
|
|
11
|
+
}
|
|
12
|
+
export declare enum GiveawayCategory {
|
|
13
|
+
Products = "products",
|
|
14
|
+
Credits = "credits"
|
|
15
|
+
}
|
|
16
|
+
export declare enum GiveawaySelectionMethod {
|
|
17
|
+
Random = "random",
|
|
18
|
+
Manual = "manual"
|
|
19
|
+
}
|
|
20
|
+
export declare enum GiveawayWinnerStatus {
|
|
21
|
+
AwaitingClaim = "awaiting_claim",
|
|
22
|
+
AwaitingDispatch = "awaiting_dispatch",
|
|
23
|
+
Dispatched = "dispatched",
|
|
24
|
+
Delivered = "delivered",
|
|
25
|
+
Processing = "processing",
|
|
26
|
+
Credited = "credited",
|
|
27
|
+
Failed = "failed"
|
|
28
|
+
}
|
|
29
|
+
export declare enum GiveawayNotificationKind {
|
|
30
|
+
Launch = "launch",
|
|
31
|
+
Closing = "closing",
|
|
32
|
+
Results = "results"
|
|
33
|
+
}
|
|
34
|
+
export declare enum GiveawayNotificationAudience {
|
|
35
|
+
All = "all",
|
|
36
|
+
Entrants = "entrants"
|
|
37
|
+
}
|
|
38
|
+
export declare enum GiveawayNotificationStatus {
|
|
39
|
+
Pending = "pending",
|
|
40
|
+
Delivering = "delivering",
|
|
41
|
+
Sent = "sent",
|
|
42
|
+
Failed = "failed"
|
|
43
|
+
}
|
|
44
|
+
export declare enum GiveawayNotificationDeliveryStatus {
|
|
45
|
+
Pending = "pending",
|
|
46
|
+
Queued = "queued"
|
|
47
|
+
}
|
|
48
|
+
export declare enum GiveawayTicketResult {
|
|
49
|
+
Pending = "pending",
|
|
50
|
+
Won = "won",
|
|
51
|
+
NotSelected = "not_selected"
|
|
52
|
+
}
|
|
53
|
+
export declare enum GiveawayAction {
|
|
54
|
+
Publish = "publish",
|
|
55
|
+
Schedule = "schedule",
|
|
56
|
+
Cancel = "cancel",
|
|
57
|
+
Archive = "archive"
|
|
58
|
+
}
|
|
59
|
+
export declare enum GiveawayNotificationChannel {
|
|
60
|
+
Push = "push"
|
|
61
|
+
}
|