@qidcloud/sdk 1.2.3 → 1.2.4
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 +1561 -158
- package/dist/index.js +730 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +730 -13
- package/dist/index.mjs.map +1 -1
- package/dist/{index.d.ts → src/index.d.ts} +8 -0
- package/dist/src/modules/auth.d.ts +155 -0
- package/dist/src/modules/billing.d.ts +57 -0
- package/dist/src/modules/db.d.ts +49 -0
- package/dist/src/modules/project.d.ts +112 -0
- package/dist/src/modules/resource.d.ts +25 -0
- package/dist/src/modules/sdk.d.ts +29 -0
- package/dist/{modules → src/modules}/vault.d.ts +26 -14
- package/dist/src/types.d.ts +126 -0
- package/package.json +17 -3
- package/dist/modules/auth.d.ts +0 -27
- package/dist/modules/db.d.ts +0 -21
- package/dist/types.d.ts +0 -46
- package/rollup.config.mjs +0 -26
- package/src/components/QidCloudLogin.tsx +0 -64
- package/src/components/QidSignInButton.tsx +0 -260
- package/src/hooks/useQidAuth.ts +0 -179
- package/src/index.ts +0 -58
- package/src/modules/auth.ts +0 -106
- package/src/modules/db.ts +0 -40
- package/src/modules/edge.ts +0 -98
- package/src/modules/logs.ts +0 -30
- package/src/modules/vault.ts +0 -124
- package/src/types.ts +0 -52
- package/tsconfig.json +0 -31
- /package/dist/{components → src/components}/QidCloudLogin.d.ts +0 -0
- /package/dist/{components → src/components}/QidSignInButton.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useQidAuth.d.ts +0 -0
- /package/dist/{modules → src/modules}/edge.d.ts +0 -0
- /package/dist/{modules → src/modules}/logs.d.ts +0 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { QidCloud } from '../index';
|
|
2
|
+
import { QidBillingInfo, QidTransaction } from '../types';
|
|
3
|
+
export declare class BillingModule {
|
|
4
|
+
private sdk;
|
|
5
|
+
constructor(sdk: QidCloud);
|
|
6
|
+
/**
|
|
7
|
+
* Retrieve all available plans and their pricing
|
|
8
|
+
*/
|
|
9
|
+
getPlans(): Promise<any>;
|
|
10
|
+
/**
|
|
11
|
+
* Get detailed billing and usage info for a project
|
|
12
|
+
*/
|
|
13
|
+
getProjectBillingInfo(userToken: string, tenantId: string): Promise<QidBillingInfo>;
|
|
14
|
+
/**
|
|
15
|
+
* Sync payment status after a successful Razorpay transaction
|
|
16
|
+
* @param paymentId The Razorpay payment ID
|
|
17
|
+
*/
|
|
18
|
+
syncPaymentStatus(userToken: string, paymentId: string): Promise<{
|
|
19
|
+
success: boolean;
|
|
20
|
+
message: string;
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* Get transaction history for the current user
|
|
24
|
+
*/
|
|
25
|
+
getTransactions(userToken: string): Promise<QidTransaction[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Get usage analytics and history
|
|
28
|
+
*/
|
|
29
|
+
getUsageAnalytics(userToken: string): Promise<any>;
|
|
30
|
+
/**
|
|
31
|
+
* Get billing alerts for a specific project
|
|
32
|
+
*/
|
|
33
|
+
getBillingAlerts(userToken: string, tenantId: string): Promise<any[]>;
|
|
34
|
+
/**
|
|
35
|
+
* Create or update a billing alert
|
|
36
|
+
*/
|
|
37
|
+
createBillingAlert(userToken: string, tenantId: string, data: {
|
|
38
|
+
resource: string;
|
|
39
|
+
threshold: number;
|
|
40
|
+
}): Promise<{
|
|
41
|
+
success: boolean;
|
|
42
|
+
}>;
|
|
43
|
+
/**
|
|
44
|
+
* Delete a billing alert
|
|
45
|
+
*/
|
|
46
|
+
deleteBillingAlert(userToken: string, alertId: string): Promise<{
|
|
47
|
+
success: boolean;
|
|
48
|
+
}>;
|
|
49
|
+
/**
|
|
50
|
+
* Generate a consolidated financial report
|
|
51
|
+
*/
|
|
52
|
+
getConsolidatedReport(userToken: string, query?: {
|
|
53
|
+
year?: number;
|
|
54
|
+
startDate?: string;
|
|
55
|
+
endDate?: string;
|
|
56
|
+
}): Promise<any>;
|
|
57
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { QidCloud } from '../index';
|
|
2
|
+
import { QidDbResponse, QidMigration, QidMigrateResult } from '../types';
|
|
3
|
+
export declare class DbModule {
|
|
4
|
+
private sdk;
|
|
5
|
+
constructor(sdk: QidCloud);
|
|
6
|
+
/**
|
|
7
|
+
* Execute a SQL query against the project's enclave database
|
|
8
|
+
* @param sql The SQL query string
|
|
9
|
+
* @param params Parameterized values for the query
|
|
10
|
+
* @param userToken Optional session token for user-scoped access
|
|
11
|
+
*/
|
|
12
|
+
query<T = any>(sql: string, params?: any[], userToken?: string): Promise<QidDbResponse<T>>;
|
|
13
|
+
/**
|
|
14
|
+
* Initialize the project's enclave database schema
|
|
15
|
+
* Useful for first-time project setup
|
|
16
|
+
*/
|
|
17
|
+
setup(userToken?: string): Promise<{
|
|
18
|
+
success: boolean;
|
|
19
|
+
schemaName: string;
|
|
20
|
+
}>;
|
|
21
|
+
/**
|
|
22
|
+
* Run versioned migrations (Django-inspired).
|
|
23
|
+
* Only applies migrations that haven't been applied yet.
|
|
24
|
+
* Tracks applied migrations in a `_qid_migrations` table.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* await qid.db.migrate([
|
|
29
|
+
* { version: '001', name: 'create_users', up: async () => { await qid.db.query('CREATE TABLE ...') } },
|
|
30
|
+
* { version: '002', name: 'add_likes', up: async () => { await qid.db.query('ALTER TABLE ...') } },
|
|
31
|
+
* ]);
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @param migrations Ordered array of migrations to apply
|
|
35
|
+
* @param userToken Optional session token
|
|
36
|
+
* @returns Result with applied/skipped counts
|
|
37
|
+
*/
|
|
38
|
+
migrate(migrations: QidMigration[], userToken?: string): Promise<QidMigrateResult>;
|
|
39
|
+
/**
|
|
40
|
+
* Get the current migration status
|
|
41
|
+
* @param migrations The full list of registered migrations
|
|
42
|
+
* @param userToken Optional session token
|
|
43
|
+
*/
|
|
44
|
+
migrateStatus(migrations: QidMigration[], userToken?: string): Promise<{
|
|
45
|
+
applied: string[];
|
|
46
|
+
pending: string[];
|
|
47
|
+
total: number;
|
|
48
|
+
}>;
|
|
49
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { QidCloud } from '../index';
|
|
2
|
+
import { QidProject, QidProjectSettings } from '../types';
|
|
3
|
+
export declare class ProjectModule {
|
|
4
|
+
private sdk;
|
|
5
|
+
constructor(sdk: QidCloud);
|
|
6
|
+
/**
|
|
7
|
+
* Get all projects owned by the currently authenticated user
|
|
8
|
+
*/
|
|
9
|
+
getMyProjects(userToken: string): Promise<QidProject[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Create a new project
|
|
12
|
+
*/
|
|
13
|
+
createProject(userToken: string, data: {
|
|
14
|
+
name: string;
|
|
15
|
+
tier?: string;
|
|
16
|
+
}): Promise<QidProject>;
|
|
17
|
+
/**
|
|
18
|
+
* Update project basic details (e.g. rename)
|
|
19
|
+
*/
|
|
20
|
+
updateProject(userToken: string, tenantId: string, data: {
|
|
21
|
+
name: string;
|
|
22
|
+
}): Promise<{
|
|
23
|
+
success: boolean;
|
|
24
|
+
}>;
|
|
25
|
+
/**
|
|
26
|
+
* Rotate the API key for a project
|
|
27
|
+
*/
|
|
28
|
+
rotateApiKey(userToken: string, tenantId: string): Promise<{
|
|
29
|
+
success: boolean;
|
|
30
|
+
apiKey: string;
|
|
31
|
+
}>;
|
|
32
|
+
/**
|
|
33
|
+
* Get project specific settings
|
|
34
|
+
*/
|
|
35
|
+
getSettings(userToken: string, tenantId: string): Promise<QidProjectSettings>;
|
|
36
|
+
/**
|
|
37
|
+
* Update project settings
|
|
38
|
+
*/
|
|
39
|
+
updateSettings(userToken: string, tenantId: string, settings: QidProjectSettings): Promise<{
|
|
40
|
+
success: boolean;
|
|
41
|
+
}>;
|
|
42
|
+
/**
|
|
43
|
+
* Invite a new member to the project
|
|
44
|
+
*/
|
|
45
|
+
inviteMember(userToken: string, tenantId: string, data: {
|
|
46
|
+
email: string;
|
|
47
|
+
role: string;
|
|
48
|
+
}): Promise<{
|
|
49
|
+
success: boolean;
|
|
50
|
+
}>;
|
|
51
|
+
/**
|
|
52
|
+
* Remove a member from the project
|
|
53
|
+
*/
|
|
54
|
+
removeMember(userToken: string, tenantId: string, userId: string): Promise<{
|
|
55
|
+
success: boolean;
|
|
56
|
+
}>;
|
|
57
|
+
/**
|
|
58
|
+
* Get all users/members associated with a project
|
|
59
|
+
*/
|
|
60
|
+
getProjectUsers(userToken: string, tenantId: string): Promise<any[]>;
|
|
61
|
+
/**
|
|
62
|
+
* Get all invitations for the currently authenticated user
|
|
63
|
+
*/
|
|
64
|
+
getMyInvitations(userToken: string): Promise<any[]>;
|
|
65
|
+
/**
|
|
66
|
+
* Accept or reject a project invitation
|
|
67
|
+
*/
|
|
68
|
+
handleInvitationAction(userToken: string, tenantId: string, action: 'accept' | 'reject'): Promise<{
|
|
69
|
+
success: boolean;
|
|
70
|
+
}>;
|
|
71
|
+
/**
|
|
72
|
+
* Update a member's permissions within a project
|
|
73
|
+
*/
|
|
74
|
+
updateMemberPermissions(userToken: string, tenantId: string, userId: string, permissions: any): Promise<{
|
|
75
|
+
success: boolean;
|
|
76
|
+
}>;
|
|
77
|
+
/**
|
|
78
|
+
* Update a project user's status (active/suspended)
|
|
79
|
+
*/
|
|
80
|
+
updateProjectUserStatus(userToken: string, tenantId: string, regUserId: string, status: string): Promise<{
|
|
81
|
+
success: boolean;
|
|
82
|
+
}>;
|
|
83
|
+
/**
|
|
84
|
+
* Unlink/Remove a user from the project identity enclave
|
|
85
|
+
*/
|
|
86
|
+
unlinkProjectUser(userToken: string, tenantId: string, regUserId: string): Promise<{
|
|
87
|
+
success: boolean;
|
|
88
|
+
}>;
|
|
89
|
+
/**
|
|
90
|
+
* Generate a new service key for the project
|
|
91
|
+
*/
|
|
92
|
+
generateServiceKey(userToken: string, tenantId: string, data: {
|
|
93
|
+
name: string;
|
|
94
|
+
permissions: any;
|
|
95
|
+
}): Promise<any>;
|
|
96
|
+
/**
|
|
97
|
+
* Revoke an existing service key
|
|
98
|
+
*/
|
|
99
|
+
revokeServiceKey(userToken: string, tenantId: string, keyId: string): Promise<{
|
|
100
|
+
success: boolean;
|
|
101
|
+
}>;
|
|
102
|
+
/**
|
|
103
|
+
* Permanently wipe the project's identity enclave data
|
|
104
|
+
*/
|
|
105
|
+
wipeProjectEnclave(userToken: string, tenantId: string): Promise<{
|
|
106
|
+
success: boolean;
|
|
107
|
+
}>;
|
|
108
|
+
/**
|
|
109
|
+
* Retrieve security and audit logs for the project
|
|
110
|
+
*/
|
|
111
|
+
getProjectSecurityLogs(userToken: string, tenantId: string): Promise<any[]>;
|
|
112
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { QidCloud } from '../index';
|
|
2
|
+
import { QidResourceStatus } from '../types';
|
|
3
|
+
export declare class ResourceModule {
|
|
4
|
+
private sdk;
|
|
5
|
+
constructor(sdk: QidCloud);
|
|
6
|
+
/**
|
|
7
|
+
* Get the status of all resources for a specific tenant
|
|
8
|
+
*/
|
|
9
|
+
getStatus(userToken: string, tenantId: string): Promise<QidResourceStatus[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Provision a new resource type for a project
|
|
12
|
+
* @param resourceType 'database' | 'storage' | 'edge'
|
|
13
|
+
*/
|
|
14
|
+
provision(userToken: string, tenantId: string, resourceType: string): Promise<{
|
|
15
|
+
success: boolean;
|
|
16
|
+
message: string;
|
|
17
|
+
}>;
|
|
18
|
+
/**
|
|
19
|
+
* Dissolve (delete) an existing resource from a project
|
|
20
|
+
*/
|
|
21
|
+
dissolve(userToken: string, tenantId: string, resourceType: string): Promise<{
|
|
22
|
+
success: boolean;
|
|
23
|
+
message: string;
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { QidCloud } from '../index';
|
|
2
|
+
export declare class SdkModule {
|
|
3
|
+
private sdk;
|
|
4
|
+
constructor(sdk: QidCloud);
|
|
5
|
+
/**
|
|
6
|
+
* Get allowed origins for a project
|
|
7
|
+
*/
|
|
8
|
+
getOrigins(userToken: string, tenantId: string): Promise<string[]>;
|
|
9
|
+
/**
|
|
10
|
+
* Add an allowed origin for SDK requests
|
|
11
|
+
*/
|
|
12
|
+
addOrigin(userToken: string, tenantId: string, domain: string): Promise<{
|
|
13
|
+
success: boolean;
|
|
14
|
+
message: string;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* Remove an allowed origin
|
|
18
|
+
*/
|
|
19
|
+
removeOrigin(userToken: string, tenantId: string, domain: string): Promise<{
|
|
20
|
+
success: boolean;
|
|
21
|
+
message: string;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* Test if an origin is allowed
|
|
25
|
+
*/
|
|
26
|
+
testOrigin(userToken: string, tenantId: string, domain: string): Promise<{
|
|
27
|
+
allowed: boolean;
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
@@ -1,31 +1,48 @@
|
|
|
1
1
|
import { QidCloud } from '../index';
|
|
2
|
-
import { QidFile, QidUploadResponse } from '../types';
|
|
2
|
+
import { QidFile, QidUploadResponse, QidUploadOptions } from '../types';
|
|
3
3
|
export declare class VaultModule {
|
|
4
4
|
private sdk;
|
|
5
5
|
constructor(sdk: QidCloud);
|
|
6
6
|
/**
|
|
7
|
-
* Upload a file to the project's secure enclave storage
|
|
8
|
-
*
|
|
7
|
+
* Upload a file to the project's secure enclave storage.
|
|
8
|
+
*
|
|
9
|
+
* Files < 10MB use single-shot upload.
|
|
10
|
+
* Files >= 10MB automatically use chunked upload with progress tracking.
|
|
11
|
+
*
|
|
12
|
+
* @param file The file data (Buffer, Blob, or File)
|
|
9
13
|
* @param fileName Name of the file
|
|
10
14
|
* @param metadata Optional E2EE metadata or custom tags
|
|
11
15
|
* @param userToken Session token for user-scoped storage
|
|
16
|
+
* @param options Upload options (onProgress callback, custom chunk size)
|
|
12
17
|
*/
|
|
13
|
-
upload(file: any, fileName: string, metadata?: any, userToken?: string): Promise<QidUploadResponse>;
|
|
18
|
+
upload(file: any, fileName: string, metadata?: any, userToken?: string, options?: QidUploadOptions): Promise<QidUploadResponse>;
|
|
19
|
+
/**
|
|
20
|
+
* Single-shot upload for small files (< 10MB)
|
|
21
|
+
*/
|
|
22
|
+
private _singleUpload;
|
|
23
|
+
/**
|
|
24
|
+
* Chunked upload for large files (>= 10MB)
|
|
25
|
+
* Flow: init → upload chunks → complete
|
|
26
|
+
*/
|
|
27
|
+
private _chunkedUpload;
|
|
28
|
+
/**
|
|
29
|
+
* Get the status of a chunked upload (for resume support)
|
|
30
|
+
*/
|
|
31
|
+
getUploadStatus(uploadId: string, userToken?: string): Promise<any>;
|
|
32
|
+
/**
|
|
33
|
+
* Resume a partially completed chunked upload
|
|
34
|
+
*/
|
|
35
|
+
resumeUpload(uploadId: string, file: any, userToken?: string, options?: QidUploadOptions): Promise<QidUploadResponse>;
|
|
14
36
|
/**
|
|
15
37
|
* List files in the project enclave
|
|
16
|
-
* @param userToken Session token for user-scoped storage
|
|
17
38
|
*/
|
|
18
39
|
list(userToken?: string): Promise<QidFile[]>;
|
|
19
40
|
/**
|
|
20
41
|
* Download a file from storage
|
|
21
|
-
* @param fileId Unique ID of the file
|
|
22
|
-
* @param userToken Session token for user-scoped storage
|
|
23
42
|
*/
|
|
24
43
|
download(fileId: string, userToken?: string): Promise<ArrayBuffer>;
|
|
25
44
|
/**
|
|
26
45
|
* Delete a file from storage (Soft Delete)
|
|
27
|
-
* @param fileId Unique ID of the file
|
|
28
|
-
* @param userToken Session token for user-scoped storage
|
|
29
46
|
*/
|
|
30
47
|
delete(fileId: string, userToken?: string): Promise<{
|
|
31
48
|
success: boolean;
|
|
@@ -33,13 +50,10 @@ export declare class VaultModule {
|
|
|
33
50
|
}>;
|
|
34
51
|
/**
|
|
35
52
|
* List deleted files in the project enclave (Recycle Bin)
|
|
36
|
-
* @param userToken Session token for user-scoped storage
|
|
37
53
|
*/
|
|
38
54
|
listDeleted(userToken?: string): Promise<QidFile[]>;
|
|
39
55
|
/**
|
|
40
56
|
* Restore a deleted file from the recycle bin
|
|
41
|
-
* @param fileId Unique ID of the file
|
|
42
|
-
* @param userToken Session token for user-scoped storage
|
|
43
57
|
*/
|
|
44
58
|
restore(fileId: string, userToken?: string): Promise<{
|
|
45
59
|
success: boolean;
|
|
@@ -47,8 +61,6 @@ export declare class VaultModule {
|
|
|
47
61
|
}>;
|
|
48
62
|
/**
|
|
49
63
|
* Permanently purge a deleted file
|
|
50
|
-
* @param fileId Unique ID of the file
|
|
51
|
-
* @param userToken Session token for user-scoped storage
|
|
52
64
|
*/
|
|
53
65
|
purge(fileId: string, userToken?: string): Promise<{
|
|
54
66
|
success: boolean;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
export interface QidConfig {
|
|
2
|
+
apiKey: string;
|
|
3
|
+
tenantId?: string;
|
|
4
|
+
baseUrl?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface QidUser {
|
|
7
|
+
userId: string;
|
|
8
|
+
regUserId: string;
|
|
9
|
+
username: string;
|
|
10
|
+
email?: string;
|
|
11
|
+
role: string;
|
|
12
|
+
fullName?: string;
|
|
13
|
+
mfaEnabled?: boolean;
|
|
14
|
+
createdAt?: Date;
|
|
15
|
+
}
|
|
16
|
+
export interface QidSession {
|
|
17
|
+
token: string;
|
|
18
|
+
lastActive: Date;
|
|
19
|
+
ip?: string;
|
|
20
|
+
userAgent?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface QidAuthSession {
|
|
23
|
+
sessionId: string;
|
|
24
|
+
qrData: string;
|
|
25
|
+
expiresAt: number;
|
|
26
|
+
}
|
|
27
|
+
export interface QidDbResponse<T = any> {
|
|
28
|
+
success: boolean;
|
|
29
|
+
data?: T;
|
|
30
|
+
error?: string;
|
|
31
|
+
count?: number;
|
|
32
|
+
meta?: any;
|
|
33
|
+
}
|
|
34
|
+
export interface QidEdgeResponse {
|
|
35
|
+
success: boolean;
|
|
36
|
+
result: any;
|
|
37
|
+
computeTime: string;
|
|
38
|
+
logs?: string[];
|
|
39
|
+
}
|
|
40
|
+
export interface QidFile {
|
|
41
|
+
fileId: string;
|
|
42
|
+
originalName: string;
|
|
43
|
+
mimeType: string;
|
|
44
|
+
size: number;
|
|
45
|
+
createdAt: string;
|
|
46
|
+
clientMetadata?: any;
|
|
47
|
+
}
|
|
48
|
+
export interface QidUploadResponse {
|
|
49
|
+
success: boolean;
|
|
50
|
+
message: string;
|
|
51
|
+
file: {
|
|
52
|
+
id: string;
|
|
53
|
+
name: string;
|
|
54
|
+
url: string;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export interface QidProject {
|
|
58
|
+
_id: string;
|
|
59
|
+
name: string;
|
|
60
|
+
tenantId: string;
|
|
61
|
+
apiKey: string;
|
|
62
|
+
owner: string;
|
|
63
|
+
tier: 'free' | 'pro' | 'elite' | 'enterprise';
|
|
64
|
+
status: 'active' | 'suspended' | 'pending';
|
|
65
|
+
}
|
|
66
|
+
export interface QidProjectSettings {
|
|
67
|
+
displayName?: string;
|
|
68
|
+
allowedOrigins?: string[];
|
|
69
|
+
enclaveConfig?: any;
|
|
70
|
+
}
|
|
71
|
+
export interface QidResourceStatus {
|
|
72
|
+
resourceType: string;
|
|
73
|
+
status: 'active' | 'provisioning' | 'failed' | 'dissolved';
|
|
74
|
+
endpoint?: string;
|
|
75
|
+
details?: any;
|
|
76
|
+
}
|
|
77
|
+
export interface QidBillingInfo {
|
|
78
|
+
plan: string;
|
|
79
|
+
profile: string;
|
|
80
|
+
estimatedMonthly: number;
|
|
81
|
+
estimatedHourly: string;
|
|
82
|
+
infraValueUSD: string;
|
|
83
|
+
currency: string;
|
|
84
|
+
activeEnclaves: string[];
|
|
85
|
+
billingNote?: string;
|
|
86
|
+
}
|
|
87
|
+
export interface QidTransaction {
|
|
88
|
+
transactionId: string;
|
|
89
|
+
amount: number;
|
|
90
|
+
date: string;
|
|
91
|
+
status: string;
|
|
92
|
+
planId: string;
|
|
93
|
+
currency?: string;
|
|
94
|
+
}
|
|
95
|
+
export interface QidBillingAlert {
|
|
96
|
+
_id: string;
|
|
97
|
+
resource: string;
|
|
98
|
+
threshold: number;
|
|
99
|
+
status: string;
|
|
100
|
+
}
|
|
101
|
+
export interface QidMigration {
|
|
102
|
+
version: string;
|
|
103
|
+
name: string;
|
|
104
|
+
up: () => Promise<void>;
|
|
105
|
+
}
|
|
106
|
+
export interface QidMigrateResult {
|
|
107
|
+
success: boolean;
|
|
108
|
+
applied: string[];
|
|
109
|
+
skipped: string[];
|
|
110
|
+
failed?: {
|
|
111
|
+
version: string;
|
|
112
|
+
error: string;
|
|
113
|
+
};
|
|
114
|
+
total: number;
|
|
115
|
+
}
|
|
116
|
+
export interface QidUploadProgress {
|
|
117
|
+
percent: number;
|
|
118
|
+
uploadedChunks: number;
|
|
119
|
+
totalChunks: number;
|
|
120
|
+
uploadedBytes: number;
|
|
121
|
+
totalBytes: number;
|
|
122
|
+
}
|
|
123
|
+
export interface QidUploadOptions {
|
|
124
|
+
onProgress?: (progress: QidUploadProgress) => void;
|
|
125
|
+
chunkSize?: number;
|
|
126
|
+
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qidcloud/sdk",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "The official JavaScript/TypeScript SDK for QidCloud Identity and Enclave Services.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
7
|
+
"types": "dist/src/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist/index.js",
|
|
10
|
+
"dist/index.js.map",
|
|
11
|
+
"dist/index.mjs",
|
|
12
|
+
"dist/index.mjs.map",
|
|
13
|
+
"dist/src",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
8
16
|
"scripts": {
|
|
9
17
|
"build": "rollup -c",
|
|
10
18
|
"watch": "rollup -c -w",
|
|
11
|
-
"test": "
|
|
19
|
+
"test": "jest --runInBand --no-cache"
|
|
12
20
|
},
|
|
13
21
|
"keywords": [],
|
|
14
22
|
"author": "",
|
|
@@ -27,10 +35,16 @@
|
|
|
27
35
|
"@rollup/plugin-commonjs": "^29.0.0",
|
|
28
36
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
29
37
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
38
|
+
"@types/jest": "^30.0.0",
|
|
30
39
|
"@types/node": "^25.2.3",
|
|
31
40
|
"@types/react": "^19.2.13",
|
|
32
41
|
"@types/react-dom": "^19.2.3",
|
|
42
|
+
"axios-mock-adapter": "^2.1.0",
|
|
43
|
+
"jest": "^30.2.0",
|
|
44
|
+
"nock": "^14.0.11",
|
|
33
45
|
"rollup": "^4.57.1",
|
|
46
|
+
"ts-jest": "^29.4.6",
|
|
47
|
+
"ts-node": "^10.9.2",
|
|
34
48
|
"tslib": "^2.8.1",
|
|
35
49
|
"typescript": "^5.9.3"
|
|
36
50
|
}
|
package/dist/modules/auth.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { QidCloud } from '../index';
|
|
2
|
-
import { QidAuthSession, QidUser } from '../types';
|
|
3
|
-
export declare class AuthModule {
|
|
4
|
-
private sdk;
|
|
5
|
-
private socket;
|
|
6
|
-
constructor(sdk: QidCloud);
|
|
7
|
-
/**
|
|
8
|
-
* Initialize a new handshake session for QR login
|
|
9
|
-
*/
|
|
10
|
-
createSession(): Promise<QidAuthSession>;
|
|
11
|
-
/**
|
|
12
|
-
* Listen for authorization events for a specific session
|
|
13
|
-
*/
|
|
14
|
-
listen(sessionId: string, onAuthorized: (token: string) => void, onDenied?: (msg: string) => void): void;
|
|
15
|
-
/**
|
|
16
|
-
* Terminate the session on the server
|
|
17
|
-
*/
|
|
18
|
-
logout(token: string): Promise<void>;
|
|
19
|
-
/**
|
|
20
|
-
* Stop listening and disconnect socket
|
|
21
|
-
*/
|
|
22
|
-
disconnect(): void;
|
|
23
|
-
/**
|
|
24
|
-
* Fetch user profile using a session token
|
|
25
|
-
*/
|
|
26
|
-
getProfile(token: string): Promise<QidUser>;
|
|
27
|
-
}
|
package/dist/modules/db.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { QidCloud } from '../index';
|
|
2
|
-
import { QidDbResponse } from '../types';
|
|
3
|
-
export declare class DbModule {
|
|
4
|
-
private sdk;
|
|
5
|
-
constructor(sdk: QidCloud);
|
|
6
|
-
/**
|
|
7
|
-
* Execute a SQL query against the project's enclave database
|
|
8
|
-
* @param sql The SQL query string
|
|
9
|
-
* @param params Parameterized values for the query
|
|
10
|
-
* @param userToken Optional session token for user-scoped access
|
|
11
|
-
*/
|
|
12
|
-
query<T = any>(sql: string, params?: any[], userToken?: string): Promise<QidDbResponse<T>>;
|
|
13
|
-
/**
|
|
14
|
-
* Initialize the project's enclave database schema
|
|
15
|
-
* Useful for first-time project setup
|
|
16
|
-
*/
|
|
17
|
-
setup(userToken?: string): Promise<{
|
|
18
|
-
success: boolean;
|
|
19
|
-
schemaName: string;
|
|
20
|
-
}>;
|
|
21
|
-
}
|
package/dist/types.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export interface QidConfig {
|
|
2
|
-
apiKey: string;
|
|
3
|
-
tenantId: string;
|
|
4
|
-
baseUrl?: string;
|
|
5
|
-
}
|
|
6
|
-
export interface QidUser {
|
|
7
|
-
userId: string;
|
|
8
|
-
regUserId: string;
|
|
9
|
-
username: string;
|
|
10
|
-
email?: string;
|
|
11
|
-
role: string;
|
|
12
|
-
}
|
|
13
|
-
export interface QidAuthSession {
|
|
14
|
-
sessionId: string;
|
|
15
|
-
qrData: string;
|
|
16
|
-
expiresAt: number;
|
|
17
|
-
}
|
|
18
|
-
export interface QidDbResponse<T = any> {
|
|
19
|
-
success: boolean;
|
|
20
|
-
data?: T;
|
|
21
|
-
error?: string;
|
|
22
|
-
count?: number;
|
|
23
|
-
}
|
|
24
|
-
export interface QidEdgeResponse {
|
|
25
|
-
success: boolean;
|
|
26
|
-
result: any;
|
|
27
|
-
computeTime: string;
|
|
28
|
-
logs?: string[];
|
|
29
|
-
}
|
|
30
|
-
export interface QidFile {
|
|
31
|
-
fileId: string;
|
|
32
|
-
originalName: string;
|
|
33
|
-
mimeType: string;
|
|
34
|
-
size: number;
|
|
35
|
-
createdAt: string;
|
|
36
|
-
clientMetadata?: any;
|
|
37
|
-
}
|
|
38
|
-
export interface QidUploadResponse {
|
|
39
|
-
success: boolean;
|
|
40
|
-
message: string;
|
|
41
|
-
file: {
|
|
42
|
-
id: string;
|
|
43
|
-
name: string;
|
|
44
|
-
url: string;
|
|
45
|
-
};
|
|
46
|
-
}
|
package/rollup.config.mjs
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import typescript from '@rollup/plugin-typescript';
|
|
2
|
-
import resolve from '@rollup/plugin-node-resolve';
|
|
3
|
-
import commonjs from '@rollup/plugin-commonjs';
|
|
4
|
-
import pkg from './package.json' with { type: 'json' };
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
input: 'src/index.ts',
|
|
8
|
-
output: [
|
|
9
|
-
{
|
|
10
|
-
file: pkg.main,
|
|
11
|
-
format: 'cjs',
|
|
12
|
-
sourcemap: true,
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
file: pkg.module,
|
|
16
|
-
format: 'es',
|
|
17
|
-
sourcemap: true,
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
external: [...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {})],
|
|
21
|
-
plugins: [
|
|
22
|
-
resolve(),
|
|
23
|
-
commonjs(),
|
|
24
|
-
typescript({ tsconfig: './tsconfig.json' }),
|
|
25
|
-
],
|
|
26
|
-
};
|