order3000 0.3.0 → 0.4.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/dist/client.cjs CHANGED
@@ -34,6 +34,9 @@ class TokenManager {
34
34
  console.log("refreshToken 1");
35
35
  if (this.refreshPromise) return this.refreshPromise;
36
36
  console.log("refreshToken 2");
37
+ console.log("[SDK TOKEN] Requesting token from:", this.tokenEndpoint);
38
+ console.log("[SDK TOKEN] Using clientId:", this.clientId);
39
+ console.log("[SDK TOKEN] Secret length:", this.clientSecret?.length);
37
40
  this.refreshPromise = got.post(this.tokenEndpoint, {
38
41
  json: { clientId: this.clientId, clientSecret: this.clientSecret },
39
42
  responseType: "json",
@@ -41,10 +44,18 @@ class TokenManager {
41
44
  retry: { limit: 3 }
42
45
  }).then((response) => {
43
46
  console.log("refreshToken 3");
47
+ console.log("[SDK TOKEN] Token received successfully");
44
48
  this.accessToken = response.body.accessToken;
45
49
  this.tokenExpiresAt = Date.now() + response.body.expiresIn * 1e3;
46
50
  this.setDefaultTenantId();
47
51
  return this.accessToken;
52
+ }).catch((error) => {
53
+ console.log("[SDK TOKEN] Token request failed:", error.message);
54
+ if (error.response) {
55
+ console.log("[SDK TOKEN] Response status:", error.response.statusCode);
56
+ console.log("[SDK TOKEN] Response body:", error.response.body);
57
+ }
58
+ throw error;
48
59
  }).finally(() => {
49
60
  console.log("refreshToken 4");
50
61
  this.refreshPromise = null;
@@ -78,8 +89,10 @@ class BaseResource {
78
89
  async request(method, path, data) {
79
90
  const token = await this.tokenManager.getToken();
80
91
  const tenantId = this.tokenManager.getTenantId();
92
+ const url = `${this.baseUrl}/tenants/${tenantId}${this.resourcePath}${path}`;
93
+ console.log(`[SDK] Making ${method} request to: ${url}`);
81
94
  return got(
82
- `${this.baseUrl}/tenants/${tenantId}${this.resourcePath}${path}`,
95
+ url,
83
96
  {
84
97
  method,
85
98
  json: data,
package/dist/client.d.cts CHANGED
@@ -86,8 +86,10 @@ interface components {
86
86
  * @description UUID of existing customer profile if available
87
87
  */
88
88
  customerId: string | null;
89
- /** @description Full name of the customer making the reservation */
90
- customerName: string;
89
+ /** @description First name of the customer making the reservation */
90
+ customerFirstName: string;
91
+ /** @description Last name of the customer making the reservation */
92
+ customerLastName: string;
91
93
  /**
92
94
  * Format: email
93
95
  * @description Email address for reservation confirmations and updates
@@ -138,8 +140,10 @@ interface components {
138
140
  * @description Link to customer profile if exists
139
141
  */
140
142
  customerId: string | null;
141
- /** @description Full name of the customer */
142
- customerName: string;
143
+ /** @description First name of the customer */
144
+ customerFirstName: string;
145
+ /** @description Last name of the customer */
146
+ customerLastName: string;
143
147
  /** @description Customer email address */
144
148
  customerEmail: string | null;
145
149
  /** @description Customer phone number */
@@ -198,9 +202,9 @@ interface components {
198
202
  /** @description Preferred seating location */
199
203
  tablePreference: string | null;
200
204
  /** @description User ID who created the reservation */
201
- createdBy: string;
205
+ createdBy: string | null;
202
206
  /** @description User ID who last updated the reservation */
203
- updatedBy: string;
207
+ updatedBy: string | null;
204
208
  /**
205
209
  * Format: date-time
206
210
  * @description Reservation creation timestamp
@@ -240,8 +244,10 @@ interface components {
240
244
  * @description Link to customer profile if exists
241
245
  */
242
246
  customerId: string | null;
243
- /** @description Full name of the customer */
244
- customerName: string;
247
+ /** @description First name of the customer */
248
+ customerFirstName: string;
249
+ /** @description Last name of the customer */
250
+ customerLastName: string;
245
251
  /** @description Customer email address */
246
252
  customerEmail: string | null;
247
253
  /** @description Customer phone number */
@@ -300,9 +306,9 @@ interface components {
300
306
  /** @description Preferred seating location */
301
307
  tablePreference: string | null;
302
308
  /** @description User ID who created the reservation */
303
- createdBy: string;
309
+ createdBy: string | null;
304
310
  /** @description User ID who last updated the reservation */
305
- updatedBy: string;
311
+ updatedBy: string | null;
306
312
  /**
307
313
  * Format: date-time
308
314
  * @description Reservation creation timestamp
package/dist/client.d.mts CHANGED
@@ -86,8 +86,10 @@ interface components {
86
86
  * @description UUID of existing customer profile if available
87
87
  */
88
88
  customerId: string | null;
89
- /** @description Full name of the customer making the reservation */
90
- customerName: string;
89
+ /** @description First name of the customer making the reservation */
90
+ customerFirstName: string;
91
+ /** @description Last name of the customer making the reservation */
92
+ customerLastName: string;
91
93
  /**
92
94
  * Format: email
93
95
  * @description Email address for reservation confirmations and updates
@@ -138,8 +140,10 @@ interface components {
138
140
  * @description Link to customer profile if exists
139
141
  */
140
142
  customerId: string | null;
141
- /** @description Full name of the customer */
142
- customerName: string;
143
+ /** @description First name of the customer */
144
+ customerFirstName: string;
145
+ /** @description Last name of the customer */
146
+ customerLastName: string;
143
147
  /** @description Customer email address */
144
148
  customerEmail: string | null;
145
149
  /** @description Customer phone number */
@@ -198,9 +202,9 @@ interface components {
198
202
  /** @description Preferred seating location */
199
203
  tablePreference: string | null;
200
204
  /** @description User ID who created the reservation */
201
- createdBy: string;
205
+ createdBy: string | null;
202
206
  /** @description User ID who last updated the reservation */
203
- updatedBy: string;
207
+ updatedBy: string | null;
204
208
  /**
205
209
  * Format: date-time
206
210
  * @description Reservation creation timestamp
@@ -240,8 +244,10 @@ interface components {
240
244
  * @description Link to customer profile if exists
241
245
  */
242
246
  customerId: string | null;
243
- /** @description Full name of the customer */
244
- customerName: string;
247
+ /** @description First name of the customer */
248
+ customerFirstName: string;
249
+ /** @description Last name of the customer */
250
+ customerLastName: string;
245
251
  /** @description Customer email address */
246
252
  customerEmail: string | null;
247
253
  /** @description Customer phone number */
@@ -300,9 +306,9 @@ interface components {
300
306
  /** @description Preferred seating location */
301
307
  tablePreference: string | null;
302
308
  /** @description User ID who created the reservation */
303
- createdBy: string;
309
+ createdBy: string | null;
304
310
  /** @description User ID who last updated the reservation */
305
- updatedBy: string;
311
+ updatedBy: string | null;
306
312
  /**
307
313
  * Format: date-time
308
314
  * @description Reservation creation timestamp
package/dist/client.mjs CHANGED
@@ -32,6 +32,9 @@ class TokenManager {
32
32
  console.log("refreshToken 1");
33
33
  if (this.refreshPromise) return this.refreshPromise;
34
34
  console.log("refreshToken 2");
35
+ console.log("[SDK TOKEN] Requesting token from:", this.tokenEndpoint);
36
+ console.log("[SDK TOKEN] Using clientId:", this.clientId);
37
+ console.log("[SDK TOKEN] Secret length:", this.clientSecret?.length);
35
38
  this.refreshPromise = got.post(this.tokenEndpoint, {
36
39
  json: { clientId: this.clientId, clientSecret: this.clientSecret },
37
40
  responseType: "json",
@@ -39,10 +42,18 @@ class TokenManager {
39
42
  retry: { limit: 3 }
40
43
  }).then((response) => {
41
44
  console.log("refreshToken 3");
45
+ console.log("[SDK TOKEN] Token received successfully");
42
46
  this.accessToken = response.body.accessToken;
43
47
  this.tokenExpiresAt = Date.now() + response.body.expiresIn * 1e3;
44
48
  this.setDefaultTenantId();
45
49
  return this.accessToken;
50
+ }).catch((error) => {
51
+ console.log("[SDK TOKEN] Token request failed:", error.message);
52
+ if (error.response) {
53
+ console.log("[SDK TOKEN] Response status:", error.response.statusCode);
54
+ console.log("[SDK TOKEN] Response body:", error.response.body);
55
+ }
56
+ throw error;
46
57
  }).finally(() => {
47
58
  console.log("refreshToken 4");
48
59
  this.refreshPromise = null;
@@ -76,8 +87,10 @@ class BaseResource {
76
87
  async request(method, path, data) {
77
88
  const token = await this.tokenManager.getToken();
78
89
  const tenantId = this.tokenManager.getTenantId();
90
+ const url = `${this.baseUrl}/tenants/${tenantId}${this.resourcePath}${path}`;
91
+ console.log(`[SDK] Making ${method} request to: ${url}`);
79
92
  return got(
80
- `${this.baseUrl}/tenants/${tenantId}${this.resourcePath}${path}`,
93
+ url,
81
94
  {
82
95
  method,
83
96
  json: data,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "order3000",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "order3000 node.js sdk",
5
5
  "main": "./dist/client.cjs",
6
6
  "module": "./dist/client.mjs",