@opexa/portal-sdk 0.0.1

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 (50) hide show
  1. package/README.md +1591 -0
  2. package/dist/graphql/account.service.d.ts +24 -0
  3. package/dist/graphql/announcement.d.ts +29 -0
  4. package/dist/graphql/auth.service.d.ts +16 -0
  5. package/dist/graphql/bet-record.d.ts +71 -0
  6. package/dist/graphql/bonus.d.ts +43 -0
  7. package/dist/graphql/cashback.d.ts +22 -0
  8. package/dist/graphql/deposit.d.ts +94 -0
  9. package/dist/graphql/file.d.ts +38 -0
  10. package/dist/graphql/file.service.d.ts +11 -0
  11. package/dist/graphql/game.d.ts +84 -0
  12. package/dist/graphql/game.service.d.ts +14 -0
  13. package/dist/graphql/index.d.ts +23 -0
  14. package/dist/graphql/member.d.ts +182 -0
  15. package/dist/graphql/platform.d.ts +38 -0
  16. package/dist/graphql/points.d.ts +22 -0
  17. package/dist/graphql/portal.service.d.ts +9 -0
  18. package/dist/graphql/promo.d.ts +35 -0
  19. package/dist/graphql/report.service.d.ts +18 -0
  20. package/dist/graphql/session.d.ts +25 -0
  21. package/dist/graphql/static.service.d.ts +12 -0
  22. package/dist/graphql/transaction.d.ts +26 -0
  23. package/dist/graphql/types.d.ts +93 -0
  24. package/dist/graphql/wallet.d.ts +14 -0
  25. package/dist/graphql/wallet.service.d.ts +30 -0
  26. package/dist/graphql/withdrawal.d.ts +106 -0
  27. package/dist/index.d.ts +4 -0
  28. package/dist/index.js +1007 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/index.mjs +2916 -0
  31. package/dist/index.mjs.map +1 -0
  32. package/dist/logger.d.ts +15 -0
  33. package/dist/object-id.d.ts +1 -0
  34. package/dist/object-type.d.ts +9 -0
  35. package/dist/sdk.d.ts +228 -0
  36. package/dist/session-service.d.ts +25 -0
  37. package/dist/transformer.d.ts +52 -0
  38. package/dist/types.d.ts +839 -0
  39. package/dist/utils/add-days.d.ts +1 -0
  40. package/dist/utils/add-minutes.d.ts +1 -0
  41. package/dist/utils/clone-date.d.ts +1 -0
  42. package/dist/utils/gql.d.ts +1 -0
  43. package/dist/utils/graphql-client.d.ts +29 -0
  44. package/dist/utils/http-error.d.ts +6 -0
  45. package/dist/utils/is-after.d.ts +4 -0
  46. package/dist/utils/parse-decimal.d.ts +2 -0
  47. package/dist/utils/sha256.d.ts +1 -0
  48. package/dist/utils/sub-minutes.d.ts +1 -0
  49. package/dist/utils/types.d.ts +5 -0
  50. package/package.json +81 -0
@@ -0,0 +1 @@
1
+ export declare function addDays(date: Date, days: number): Date;
@@ -0,0 +1 @@
1
+ export declare function addMinutes(date: Date, minutes: number): Date;
@@ -0,0 +1 @@
1
+ export declare function cloneDate(date: Date): Date;
@@ -0,0 +1 @@
1
+ export declare function gql(strings: TemplateStringsArray, ...values: unknown[]): string;
@@ -0,0 +1,29 @@
1
+ import { HttpError } from './http-error';
2
+ import { GenericObject } from './types';
3
+
4
+ export type GraphQLClientMiddleware = (request: Request) => Request | Promise<Request>;
5
+ export interface GraphQLClientFetchOptions extends Omit<RequestInit, 'body' | 'method'> {
6
+ }
7
+ export interface GraphQLClientConfig {
8
+ middlewares?: GraphQLClientMiddleware[];
9
+ fetchOptions?: GraphQLClientFetchOptions;
10
+ }
11
+ export type GraphQLClientResponse<Data> = {
12
+ ok: true;
13
+ data: Data;
14
+ } | {
15
+ ok: false;
16
+ error: HttpError;
17
+ };
18
+ export declare class GraphQLClient {
19
+ private url;
20
+ private options;
21
+ private middlewares;
22
+ constructor(url: string, config?: GraphQLClientConfig);
23
+ request<Data>(query: string, variables?: GenericObject): Promise<GraphQLClientResponse<Data>>;
24
+ /** Single file upload */
25
+ upload<Data>(query: string, variables: GenericObject): Promise<GraphQLClientResponse<Data>>;
26
+ private runMiddlewares;
27
+ private static createUploadBody;
28
+ private static extractFiles;
29
+ }
@@ -0,0 +1,6 @@
1
+ export type HttpErrorCode = 'HttpBadRequest' | 'HttpUnauthorized' | 'HttpForbidden' | 'HttpNotFound' | 'HttpRequestTimeout' | 'HttpTooManyRequests' | 'HttpInternalServerError' | 'HttpServiceUnavailable';
2
+ export interface HttpError {
3
+ code: HttpErrorCode;
4
+ message: string;
5
+ }
6
+ export declare function createHttpError(statusCode: number, message?: string): HttpError;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * is `date1` after `date2`?
3
+ */
4
+ export declare function isAfter(date1: Date, date2: Date): boolean;
@@ -0,0 +1,2 @@
1
+ export declare function parseDecimal(value: unknown): number | undefined;
2
+ export declare function parseDecimal(value: unknown, fallback: number): number;
@@ -0,0 +1 @@
1
+ export declare function sha256(input: string): Promise<string>;
@@ -0,0 +1 @@
1
+ export declare function subMinutes(date: Date, minutes: number): Date;
@@ -0,0 +1,5 @@
1
+ export type GenericObject = Record<string, any>;
2
+ export type Pretty<T extends GenericObject> = {} & {
3
+ [K in keyof T]: T[K];
4
+ };
5
+ export type Assign<Target extends GenericObject, Source extends GenericObject> = Pretty<Source & Omit<Target, keyof Source>>;
package/package.json ADDED
@@ -0,0 +1,81 @@
1
+ {
2
+ "name": "@opexa/portal-sdk",
3
+ "type": "module",
4
+ "version": "0.0.1",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "typings": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "require": "./dist/index.js",
11
+ "import": "./dist/index.mjs",
12
+ "types": "./dist/index.d.ts"
13
+ },
14
+ "./package.json": "./package.json"
15
+ },
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "files": [
20
+ "dist"
21
+ ],
22
+ "scripts": {
23
+ "dev": "vite",
24
+ "build": "vite build --mode library",
25
+ "test": "vitest",
26
+ "release": "release-it"
27
+ },
28
+ "dependencies": {
29
+ "@opexa/object-id": "0.1.6"
30
+ },
31
+ "devDependencies": {
32
+ "@ark-ui/react": "3.5.0",
33
+ "@faker-js/faker": "8.4.1",
34
+ "@fontsource/fira-code": "5.0.18",
35
+ "@fontsource/inter": "5.0.18",
36
+ "@types/node": "20.14.9",
37
+ "@types/react": "18.3.3",
38
+ "@types/react-dom": "18.3.0",
39
+ "@untitled-theme/icons-react": "0.10.1",
40
+ "@vitejs/plugin-react-swc": "3.7.0",
41
+ "autoprefixer": "10.4.19",
42
+ "clsx": "2.1.1",
43
+ "date-fns": "3.6.0",
44
+ "msw": "2.3.1",
45
+ "postcss": "8.4.39",
46
+ "prettier": "3.3.2",
47
+ "prettier-plugin-svelte": "3.2.5",
48
+ "prettier-plugin-tailwindcss": "0.6.5",
49
+ "react": "18.3.1",
50
+ "react-dom": "18.3.1",
51
+ "react-router-dom": "6.24.0",
52
+ "release-it": "17.4.1",
53
+ "shiki": "1.10.1",
54
+ "tailwind-variants": "0.2.1",
55
+ "tailwindcss": "3.4.4",
56
+ "typescript": "5.5.3",
57
+ "vite": "5.3.3",
58
+ "vite-plugin-dts": "3.9.1",
59
+ "vite-plugin-node-polyfills": "0.22.0",
60
+ "vite-tsconfig-paths": "4.3.2",
61
+ "vitest": "1.6.0",
62
+ "zod": "3.23.8"
63
+ },
64
+ "release-it": {
65
+ "git": {
66
+ "commitMessage": "chore: release ${npm.name} v${version}",
67
+ "tagName": "${npm.name}@${version}"
68
+ },
69
+ "github": {
70
+ "release": false
71
+ },
72
+ "hooks": {
73
+ "before:init": [
74
+ "pnpm test"
75
+ ],
76
+ "after:bump": [
77
+ "pnpm build"
78
+ ]
79
+ }
80
+ }
81
+ }