@thinkingdifferently/core 1.4.1 → 1.4.2
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.mts +0 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -72
- package/dist/index.mjs +0 -72
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -140,8 +140,6 @@ declare class ThinkingDifferently {
|
|
|
140
140
|
*/
|
|
141
141
|
verifyJwt(token: string, publicKey?: string): any;
|
|
142
142
|
collection(name: string): QueryBuilder;
|
|
143
|
-
insert(key: string, data: any): Promise<any>;
|
|
144
|
-
delete(key: string, id: string): Promise<any>;
|
|
145
143
|
}
|
|
146
144
|
|
|
147
145
|
export { AdminAuth, AuthModule, type CredentialParams, type GetOptions, type LoginResponse, type SDKConfig, TDClient, ThinkingDifferently };
|
package/dist/index.d.ts
CHANGED
|
@@ -140,8 +140,6 @@ declare class ThinkingDifferently {
|
|
|
140
140
|
*/
|
|
141
141
|
verifyJwt(token: string, publicKey?: string): any;
|
|
142
142
|
collection(name: string): QueryBuilder;
|
|
143
|
-
insert(key: string, data: any): Promise<any>;
|
|
144
|
-
delete(key: string, id: string): Promise<any>;
|
|
145
143
|
}
|
|
146
144
|
|
|
147
145
|
export { AdminAuth, AuthModule, type CredentialParams, type GetOptions, type LoginResponse, type SDKConfig, TDClient, ThinkingDifferently };
|
package/dist/index.js
CHANGED
|
@@ -107,7 +107,6 @@ var TDClient = class {
|
|
|
107
107
|
// 4. **Documentation and Guidelines**: Encourage backend developers to follow a consistent error response format through documentation and guidelines. This can help ensure that errors are structured properly, making it easier for the SDK to handle them effectively.
|
|
108
108
|
// Here's an improved version of the error handling method:
|
|
109
109
|
handleError(error) {
|
|
110
|
-
console.error("[ThinkingDifferently SDK] Raw Error:", error);
|
|
111
110
|
if (error.response) {
|
|
112
111
|
const status = error.response.status;
|
|
113
112
|
const data = error.response.data;
|
|
@@ -526,77 +525,6 @@ var ThinkingDifferently = class {
|
|
|
526
525
|
this.client
|
|
527
526
|
);
|
|
528
527
|
}
|
|
529
|
-
async insert(key, data) {
|
|
530
|
-
console.log("\n================ INSERT REQUEST ================");
|
|
531
|
-
console.log("[SDK] Collection Key:", key);
|
|
532
|
-
console.log("[SDK] Incoming Data Type:", typeof data);
|
|
533
|
-
try {
|
|
534
|
-
if (data instanceof FormData) {
|
|
535
|
-
console.log("[SDK] FormData detected");
|
|
536
|
-
const payload = new FormData();
|
|
537
|
-
payload.append("key", key);
|
|
538
|
-
const extractedData = {};
|
|
539
|
-
for (const [formKey, value] of data.entries()) {
|
|
540
|
-
console.log(`${formKey}:`, value);
|
|
541
|
-
if (value instanceof File) {
|
|
542
|
-
payload.append(formKey, value);
|
|
543
|
-
} else {
|
|
544
|
-
extractedData[formKey] = value;
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
payload.append(
|
|
548
|
-
"data",
|
|
549
|
-
JSON.stringify(extractedData)
|
|
550
|
-
);
|
|
551
|
-
console.log("[SDK] Final Payload:");
|
|
552
|
-
for (const [k, v] of payload.entries()) {
|
|
553
|
-
console.log(k, v);
|
|
554
|
-
}
|
|
555
|
-
return this.client.sendDataRequest(
|
|
556
|
-
"POST",
|
|
557
|
-
payload
|
|
558
|
-
);
|
|
559
|
-
}
|
|
560
|
-
console.log("[SDK] JSON Payload:");
|
|
561
|
-
console.log({
|
|
562
|
-
key,
|
|
563
|
-
data
|
|
564
|
-
});
|
|
565
|
-
const response = await this.client.sendDataRequest(
|
|
566
|
-
"POST",
|
|
567
|
-
{
|
|
568
|
-
key,
|
|
569
|
-
data
|
|
570
|
-
}
|
|
571
|
-
);
|
|
572
|
-
console.log("[SDK] Insert Response:", response);
|
|
573
|
-
return response;
|
|
574
|
-
} catch (error) {
|
|
575
|
-
console.error("[SDK] INSERT ERROR");
|
|
576
|
-
console.error(error);
|
|
577
|
-
throw error;
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
async delete(key, id) {
|
|
581
|
-
console.log("\n================ DELETE REQUEST ================");
|
|
582
|
-
console.log("[SDK] Collection Key:", key);
|
|
583
|
-
console.log("[SDK] Document ID:", id);
|
|
584
|
-
try {
|
|
585
|
-
const response = await this.client.sendDataRequest(
|
|
586
|
-
"DELETE",
|
|
587
|
-
{
|
|
588
|
-
key,
|
|
589
|
-
id
|
|
590
|
-
}
|
|
591
|
-
);
|
|
592
|
-
console.log("[SDK] Delete Response:", response);
|
|
593
|
-
return response;
|
|
594
|
-
} catch (error) {
|
|
595
|
-
console.error("[SDK] DELETE ERROR");
|
|
596
|
-
console.error(error);
|
|
597
|
-
throw error;
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
528
|
};
|
|
601
529
|
// Annotate the CommonJS export names for ESM import in node:
|
|
602
530
|
0 && (module.exports = {
|
package/dist/index.mjs
CHANGED
|
@@ -68,7 +68,6 @@ var TDClient = class {
|
|
|
68
68
|
// 4. **Documentation and Guidelines**: Encourage backend developers to follow a consistent error response format through documentation and guidelines. This can help ensure that errors are structured properly, making it easier for the SDK to handle them effectively.
|
|
69
69
|
// Here's an improved version of the error handling method:
|
|
70
70
|
handleError(error) {
|
|
71
|
-
console.error("[ThinkingDifferently SDK] Raw Error:", error);
|
|
72
71
|
if (error.response) {
|
|
73
72
|
const status = error.response.status;
|
|
74
73
|
const data = error.response.data;
|
|
@@ -487,77 +486,6 @@ var ThinkingDifferently = class {
|
|
|
487
486
|
this.client
|
|
488
487
|
);
|
|
489
488
|
}
|
|
490
|
-
async insert(key, data) {
|
|
491
|
-
console.log("\n================ INSERT REQUEST ================");
|
|
492
|
-
console.log("[SDK] Collection Key:", key);
|
|
493
|
-
console.log("[SDK] Incoming Data Type:", typeof data);
|
|
494
|
-
try {
|
|
495
|
-
if (data instanceof FormData) {
|
|
496
|
-
console.log("[SDK] FormData detected");
|
|
497
|
-
const payload = new FormData();
|
|
498
|
-
payload.append("key", key);
|
|
499
|
-
const extractedData = {};
|
|
500
|
-
for (const [formKey, value] of data.entries()) {
|
|
501
|
-
console.log(`${formKey}:`, value);
|
|
502
|
-
if (value instanceof File) {
|
|
503
|
-
payload.append(formKey, value);
|
|
504
|
-
} else {
|
|
505
|
-
extractedData[formKey] = value;
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
payload.append(
|
|
509
|
-
"data",
|
|
510
|
-
JSON.stringify(extractedData)
|
|
511
|
-
);
|
|
512
|
-
console.log("[SDK] Final Payload:");
|
|
513
|
-
for (const [k, v] of payload.entries()) {
|
|
514
|
-
console.log(k, v);
|
|
515
|
-
}
|
|
516
|
-
return this.client.sendDataRequest(
|
|
517
|
-
"POST",
|
|
518
|
-
payload
|
|
519
|
-
);
|
|
520
|
-
}
|
|
521
|
-
console.log("[SDK] JSON Payload:");
|
|
522
|
-
console.log({
|
|
523
|
-
key,
|
|
524
|
-
data
|
|
525
|
-
});
|
|
526
|
-
const response = await this.client.sendDataRequest(
|
|
527
|
-
"POST",
|
|
528
|
-
{
|
|
529
|
-
key,
|
|
530
|
-
data
|
|
531
|
-
}
|
|
532
|
-
);
|
|
533
|
-
console.log("[SDK] Insert Response:", response);
|
|
534
|
-
return response;
|
|
535
|
-
} catch (error) {
|
|
536
|
-
console.error("[SDK] INSERT ERROR");
|
|
537
|
-
console.error(error);
|
|
538
|
-
throw error;
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
async delete(key, id) {
|
|
542
|
-
console.log("\n================ DELETE REQUEST ================");
|
|
543
|
-
console.log("[SDK] Collection Key:", key);
|
|
544
|
-
console.log("[SDK] Document ID:", id);
|
|
545
|
-
try {
|
|
546
|
-
const response = await this.client.sendDataRequest(
|
|
547
|
-
"DELETE",
|
|
548
|
-
{
|
|
549
|
-
key,
|
|
550
|
-
id
|
|
551
|
-
}
|
|
552
|
-
);
|
|
553
|
-
console.log("[SDK] Delete Response:", response);
|
|
554
|
-
return response;
|
|
555
|
-
} catch (error) {
|
|
556
|
-
console.error("[SDK] DELETE ERROR");
|
|
557
|
-
console.error(error);
|
|
558
|
-
throw error;
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
489
|
};
|
|
562
490
|
export {
|
|
563
491
|
AdminAuth,
|