@drttix/drt-sdk 0.6.5 → 0.7.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.
Files changed (49) hide show
  1. package/azure-pipelines.yml +15 -6
  2. package/demo/default.html +2 -1
  3. package/demo/test.html +529 -102
  4. package/demo/with-base.html +10 -8
  5. package/dist/bundle/drt-sdk.js +1 -0
  6. package/dist/cjs/index.d.ts +5 -0
  7. package/dist/cjs/index.js +5 -0
  8. package/dist/cjs/src/generated/portal/core/OpenAPI.js +1 -1
  9. package/dist/cjs/src/generated/portal/core/request.js +3 -1
  10. package/dist/cjs/src/generated/portal/services/AccountService.d.ts +12 -2
  11. package/dist/cjs/src/generated/portal/services/AccountService.js +26 -2
  12. package/dist/cjs/src/generated/portal/services/AuthService.d.ts +2 -1
  13. package/dist/cjs/src/generated/portal/services/AuthService.js +5 -1
  14. package/dist/cjs/src/generated/portal/services/FeaturesBlockedSeatsService.d.ts +10 -7
  15. package/dist/cjs/src/generated/portal/services/FeaturesBlockedSeatsService.js +19 -7
  16. package/dist/cjs/src/generated/portal/services/OrderLookupService.d.ts +4 -3
  17. package/dist/cjs/src/generated/portal/services/OrderLookupService.js +7 -3
  18. package/dist/cjs/src/generated/scanner/core/request.d.ts +7 -10
  19. package/dist/cjs/src/generated/scanner/core/request.js +56 -37
  20. package/dist/cjs/src/generated/shopper/core/request.js +3 -1
  21. package/dist/cjs/src/scripts/build-all.js +9 -1
  22. package/dist/esm/index.d.ts +5 -0
  23. package/dist/esm/index.js +5 -0
  24. package/dist/esm/src/generated/portal/core/OpenAPI.js +1 -1
  25. package/dist/esm/src/generated/portal/core/request.js +3 -1
  26. package/dist/esm/src/generated/portal/services/AccountService.d.ts +12 -2
  27. package/dist/esm/src/generated/portal/services/AccountService.js +26 -2
  28. package/dist/esm/src/generated/portal/services/AuthService.d.ts +2 -1
  29. package/dist/esm/src/generated/portal/services/AuthService.js +5 -1
  30. package/dist/esm/src/generated/portal/services/FeaturesBlockedSeatsService.d.ts +10 -7
  31. package/dist/esm/src/generated/portal/services/FeaturesBlockedSeatsService.js +19 -7
  32. package/dist/esm/src/generated/portal/services/OrderLookupService.d.ts +4 -3
  33. package/dist/esm/src/generated/portal/services/OrderLookupService.js +7 -3
  34. package/dist/esm/src/generated/scanner/core/request.d.ts +7 -10
  35. package/dist/esm/src/generated/scanner/core/request.js +58 -39
  36. package/dist/esm/src/generated/shopper/core/request.js +3 -1
  37. package/dist/esm/src/scripts/build-all.js +9 -1
  38. package/index.ts +5 -0
  39. package/package.json +3 -1
  40. package/src/custom/custom-request.txt +7 -2
  41. package/src/generated/portal/core/OpenAPI.ts +1 -1
  42. package/src/generated/portal/core/request.ts +7 -2
  43. package/src/generated/portal/services/AccountService.ts +30 -1
  44. package/src/generated/portal/services/AuthService.ts +7 -1
  45. package/src/generated/portal/services/FeaturesBlockedSeatsService.ts +23 -6
  46. package/src/generated/portal/services/OrderLookupService.ts +7 -2
  47. package/src/generated/scanner/core/request.ts +331 -266
  48. package/src/generated/shopper/core/request.ts +7 -2
  49. package/src/scripts/build-all.ts +14 -1
@@ -154,10 +154,15 @@ export const getHeaders = async (
154
154
  resolve(options, config.HEADERS),
155
155
  ]);
156
156
 
157
+ // Filter out undefined/null values from options.headers first
158
+ const optionsHeaders = Object.fromEntries(
159
+ Object.entries(options.headers || {}).filter(([_, value]) => isDefined(value))
160
+ );
161
+
157
162
  const headers = Object.entries({
158
163
  Accept: "application/json",
159
- ...additionalHeaders,
160
- ...options.headers,
164
+ ...optionsHeaders,
165
+ ...additionalHeaders, // config.HEADERS takes precedence when set (for DRT.init())
161
166
  })
162
167
  .filter(([_, value]) => isDefined(value))
163
168
  .reduce(
@@ -62,12 +62,15 @@ for (const spec of specs) {
62
62
  });
63
63
  }
64
64
 
65
- // After generating all clients and definitions, replace request.ts for shopper and portal only
65
+ // After generating all clients and definitions, replace request.ts for all services
66
66
  const customRequestPath = path.resolve('src/custom/custom-request.txt');
67
67
  const shopperRequestPath = path.resolve(
68
68
  'src/generated/shopper/core/request.ts',
69
69
  );
70
70
  const portalRequestPath = path.resolve('src/generated/portal/core/request.ts');
71
+ const scannerRequestPath = path.resolve(
72
+ 'src/generated/scanner/core/request.ts',
73
+ );
71
74
 
72
75
  const customRequestContent = fs.readFileSync(customRequestPath, 'utf-8');
73
76
 
@@ -77,6 +80,9 @@ console.log('✅ Replaced shopper/core/request.ts with custom-request.txt');
77
80
  fs.writeFileSync(portalRequestPath, customRequestContent);
78
81
  console.log('✅ Replaced portal/core/request.ts with custom-request.txt');
79
82
 
83
+ fs.writeFileSync(scannerRequestPath, customRequestContent);
84
+ console.log('✅ Replaced scanner/core/request.ts with custom-request.txt');
85
+
80
86
  // --- Generate index.ts
81
87
  console.log(`🧩 Generating DRT index...`);
82
88
 
@@ -89,6 +95,9 @@ for (const spec of specs) {
89
95
  lines.push(`import { ${name} } from "./src/definitions/${name}";`);
90
96
  }
91
97
  lines.push(`import { setBaseUrlsOnce } from "./src/functions/setBaseURL";`);
98
+ lines.push(
99
+ `import { init, isReady, getConfig, reset } from "./src/functions/sdkConfig";`,
100
+ );
92
101
  lines.push('');
93
102
 
94
103
  // Re-export type namespaces for easy access
@@ -106,6 +115,10 @@ lines.push('export const DRT = {');
106
115
  for (const spec of specs) {
107
116
  lines.push(` ${spec.name.toLowerCase()},`);
108
117
  }
118
+ lines.push(' init,');
119
+ lines.push(' isReady,');
120
+ lines.push(' getConfig,');
121
+ lines.push(' reset,');
109
122
  lines.push('};');
110
123
  lines.push('');
111
124
  lines.push('setBaseUrlsOnce();');