@thinkingdifferently/core 1.4.0 → 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 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
@@ -46,8 +46,7 @@ var TDClient = class {
46
46
  this.securityKey = securityKey;
47
47
  this.publicKey = publicKey;
48
48
  this.api = import_axios.default.create({
49
- baseURL: "http://localhost:3000/api/v1",
50
- // baseURL: "https://www.thinkingdifferently.dev/api/v1",
49
+ baseURL: "https://www.thinkingdifferently.dev/api/v1",
51
50
  headers: {
52
51
  "X-API-Key": apiKey,
53
52
  "Content-Type": "application/json"
@@ -108,7 +107,6 @@ var TDClient = class {
108
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.
109
108
  // Here's an improved version of the error handling method:
110
109
  handleError(error) {
111
- console.error("[ThinkingDifferently SDK] Raw Error:", error);
112
110
  if (error.response) {
113
111
  const status = error.response.status;
114
112
  const data = error.response.data;
@@ -527,77 +525,6 @@ var ThinkingDifferently = class {
527
525
  this.client
528
526
  );
529
527
  }
530
- async insert(key, data) {
531
- console.log("\n================ INSERT REQUEST ================");
532
- console.log("[SDK] Collection Key:", key);
533
- console.log("[SDK] Incoming Data Type:", typeof data);
534
- try {
535
- if (data instanceof FormData) {
536
- console.log("[SDK] FormData detected");
537
- const payload = new FormData();
538
- payload.append("key", key);
539
- const extractedData = {};
540
- for (const [formKey, value] of data.entries()) {
541
- console.log(`${formKey}:`, value);
542
- if (value instanceof File) {
543
- payload.append(formKey, value);
544
- } else {
545
- extractedData[formKey] = value;
546
- }
547
- }
548
- payload.append(
549
- "data",
550
- JSON.stringify(extractedData)
551
- );
552
- console.log("[SDK] Final Payload:");
553
- for (const [k, v] of payload.entries()) {
554
- console.log(k, v);
555
- }
556
- return this.client.sendDataRequest(
557
- "POST",
558
- payload
559
- );
560
- }
561
- console.log("[SDK] JSON Payload:");
562
- console.log({
563
- key,
564
- data
565
- });
566
- const response = await this.client.sendDataRequest(
567
- "POST",
568
- {
569
- key,
570
- data
571
- }
572
- );
573
- console.log("[SDK] Insert Response:", response);
574
- return response;
575
- } catch (error) {
576
- console.error("[SDK] INSERT ERROR");
577
- console.error(error);
578
- throw error;
579
- }
580
- }
581
- async delete(key, id) {
582
- console.log("\n================ DELETE REQUEST ================");
583
- console.log("[SDK] Collection Key:", key);
584
- console.log("[SDK] Document ID:", id);
585
- try {
586
- const response = await this.client.sendDataRequest(
587
- "DELETE",
588
- {
589
- key,
590
- id
591
- }
592
- );
593
- console.log("[SDK] Delete Response:", response);
594
- return response;
595
- } catch (error) {
596
- console.error("[SDK] DELETE ERROR");
597
- console.error(error);
598
- throw error;
599
- }
600
- }
601
528
  };
602
529
  // Annotate the CommonJS export names for ESM import in node:
603
530
  0 && (module.exports = {
package/dist/index.mjs CHANGED
@@ -7,8 +7,7 @@ var TDClient = class {
7
7
  this.securityKey = securityKey;
8
8
  this.publicKey = publicKey;
9
9
  this.api = axios.create({
10
- baseURL: "http://localhost:3000/api/v1",
11
- // baseURL: "https://www.thinkingdifferently.dev/api/v1",
10
+ baseURL: "https://www.thinkingdifferently.dev/api/v1",
12
11
  headers: {
13
12
  "X-API-Key": apiKey,
14
13
  "Content-Type": "application/json"
@@ -69,7 +68,6 @@ var TDClient = class {
69
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.
70
69
  // Here's an improved version of the error handling method:
71
70
  handleError(error) {
72
- console.error("[ThinkingDifferently SDK] Raw Error:", error);
73
71
  if (error.response) {
74
72
  const status = error.response.status;
75
73
  const data = error.response.data;
@@ -488,77 +486,6 @@ var ThinkingDifferently = class {
488
486
  this.client
489
487
  );
490
488
  }
491
- async insert(key, data) {
492
- console.log("\n================ INSERT REQUEST ================");
493
- console.log("[SDK] Collection Key:", key);
494
- console.log("[SDK] Incoming Data Type:", typeof data);
495
- try {
496
- if (data instanceof FormData) {
497
- console.log("[SDK] FormData detected");
498
- const payload = new FormData();
499
- payload.append("key", key);
500
- const extractedData = {};
501
- for (const [formKey, value] of data.entries()) {
502
- console.log(`${formKey}:`, value);
503
- if (value instanceof File) {
504
- payload.append(formKey, value);
505
- } else {
506
- extractedData[formKey] = value;
507
- }
508
- }
509
- payload.append(
510
- "data",
511
- JSON.stringify(extractedData)
512
- );
513
- console.log("[SDK] Final Payload:");
514
- for (const [k, v] of payload.entries()) {
515
- console.log(k, v);
516
- }
517
- return this.client.sendDataRequest(
518
- "POST",
519
- payload
520
- );
521
- }
522
- console.log("[SDK] JSON Payload:");
523
- console.log({
524
- key,
525
- data
526
- });
527
- const response = await this.client.sendDataRequest(
528
- "POST",
529
- {
530
- key,
531
- data
532
- }
533
- );
534
- console.log("[SDK] Insert Response:", response);
535
- return response;
536
- } catch (error) {
537
- console.error("[SDK] INSERT ERROR");
538
- console.error(error);
539
- throw error;
540
- }
541
- }
542
- async delete(key, id) {
543
- console.log("\n================ DELETE REQUEST ================");
544
- console.log("[SDK] Collection Key:", key);
545
- console.log("[SDK] Document ID:", id);
546
- try {
547
- const response = await this.client.sendDataRequest(
548
- "DELETE",
549
- {
550
- key,
551
- id
552
- }
553
- );
554
- console.log("[SDK] Delete Response:", response);
555
- return response;
556
- } catch (error) {
557
- console.error("[SDK] DELETE ERROR");
558
- console.error(error);
559
- throw error;
560
- }
561
- }
562
489
  };
563
490
  export {
564
491
  AdminAuth,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkingdifferently/core",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "description": "Official SDK for Thinking Differently API",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",