@drttix/drt-sdk 0.8.5 → 0.9.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 (50) hide show
  1. package/dist/cjs/src/functions/setBaseURL.js +6 -6
  2. package/dist/cjs/src/generated/portal/core/OpenAPI.js +1 -1
  3. package/dist/cjs/src/generated/portal/index.d.ts +0 -1
  4. package/dist/cjs/src/generated/portal/models/DiscountAccessRequestDto.d.ts +0 -1
  5. package/dist/cjs/src/generated/portal/models/OrderRecalculateRequestDto.d.ts +0 -3
  6. package/dist/cjs/src/generated/portal/models/PatronAccessRequestDto.d.ts +0 -1
  7. package/dist/cjs/src/generated/portal/types.d.ts +0 -1
  8. package/dist/cjs/src/staging/index.d.ts +77 -0
  9. package/dist/cjs/src/staging/index.js +40 -0
  10. package/dist/cjs/src/staging/portal.d.ts +63 -0
  11. package/dist/cjs/src/staging/portal.js +104 -0
  12. package/dist/cjs/src/staging/wrapService.d.ts +15 -0
  13. package/dist/cjs/src/staging/wrapService.js +44 -0
  14. package/dist/cjs/staging.d.ts +1 -0
  15. package/dist/cjs/staging.js +18 -0
  16. package/dist/esm/src/functions/setBaseURL.js +9 -9
  17. package/dist/esm/src/generated/portal/core/OpenAPI.js +1 -1
  18. package/dist/esm/src/generated/portal/index.d.ts +0 -1
  19. package/dist/esm/src/generated/portal/models/DiscountAccessRequestDto.d.ts +0 -1
  20. package/dist/esm/src/generated/portal/models/OrderRecalculateRequestDto.d.ts +0 -3
  21. package/dist/esm/src/generated/portal/models/PatronAccessRequestDto.d.ts +0 -1
  22. package/dist/esm/src/generated/portal/types.d.ts +0 -1
  23. package/dist/esm/src/staging/index.d.ts +77 -0
  24. package/dist/esm/src/staging/index.js +34 -0
  25. package/dist/esm/src/staging/portal.d.ts +63 -0
  26. package/dist/esm/src/staging/portal.js +68 -0
  27. package/dist/esm/src/staging/wrapService.d.ts +15 -0
  28. package/dist/esm/src/staging/wrapService.js +40 -0
  29. package/dist/esm/staging.d.ts +1 -0
  30. package/dist/esm/staging.js +2 -0
  31. package/drt-api-specs.json +5 -5
  32. package/package.json +38 -30
  33. package/src/functions/setBaseURL.ts +21 -21
  34. package/src/generated/portal/core/OpenAPI.ts +31 -31
  35. package/src/generated/portal/index.ts +373 -374
  36. package/src/generated/portal/models/DiscountAccessRequestDto.ts +0 -1
  37. package/src/generated/portal/models/OrderRecalculateRequestDto.ts +0 -3
  38. package/src/generated/portal/models/PatronAccessRequestDto.ts +0 -1
  39. package/src/generated/portal/types.ts +336 -337
  40. package/src/staging/index.ts +39 -0
  41. package/src/staging/portal.ts +73 -0
  42. package/src/staging/wrapService.ts +51 -0
  43. package/staging.ts +2 -0
  44. package/tsconfig.cjs.json +1 -1
  45. package/tsconfig.esm.json +1 -1
  46. package/dist/cjs/src/generated/portal/models/ShowSeatTierPair.d.ts +0 -5
  47. package/dist/cjs/src/generated/portal/models/ShowSeatTierPair.js +0 -2
  48. package/dist/esm/src/generated/portal/models/ShowSeatTierPair.d.ts +0 -5
  49. package/dist/esm/src/generated/portal/models/ShowSeatTierPair.js +0 -1
  50. package/src/generated/portal/models/ShowSeatTierPair.ts +0 -10
@@ -0,0 +1,39 @@
1
+ // Staging entry point - exports DRT configured for staging APIs
2
+ // Usage: import { DRT } from '@drttix/drt-sdk/staging';
3
+
4
+ import { shopper } from "../definitions/shopper";
5
+ import { scanner } from "../definitions/scanner";
6
+ import { portalStaging } from "./portal";
7
+ import { init, isReady, getConfig, reset } from "../functions/sdkConfig";
8
+
9
+ // Re-export types
10
+ export { ShopperTypes } from "../definitions/shopper";
11
+ export { ScannerTypes } from "../definitions/scanner";
12
+ export { PortalTypes } from "./portal";
13
+
14
+ /**
15
+ * DRT SDK configured for staging environment.
16
+ *
17
+ * - portal: Uses staging API (https://api.staging.drttix.com/admin-portal)
18
+ * - shopper: Uses production API (unchanged)
19
+ * - scanner: Uses production API (unchanged)
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * import { DRT } from '@drttix/drt-sdk/staging';
24
+ *
25
+ * // Portal calls go to staging
26
+ * const data = await DRT.portal.auth.login({ ... });
27
+ * ```
28
+ */
29
+ export const DRT = {
30
+ shopper,
31
+ scanner,
32
+ portal: portalStaging,
33
+ init,
34
+ isReady,
35
+ getConfig,
36
+ reset,
37
+ };
38
+
39
+ export type DRT = typeof DRT;
@@ -0,0 +1,73 @@
1
+ // Staging portal services - wraps all portal services to use staging API
2
+ import { OpenAPI as PortalOpenAPI } from "../generated/portal/core/OpenAPI";
3
+ import { wrapServiceForStaging, STAGING_URLS } from "./wrapService";
4
+
5
+ import { AccountService } from "../generated/portal";
6
+ import { AccountingService } from "../generated/portal";
7
+ import { AppService } from "../generated/portal";
8
+ import { AuthService } from "../generated/portal";
9
+ import { BookmarkService } from "../generated/portal";
10
+ import { ClientToolsGeneratedEmailsService } from "../generated/portal";
11
+ import { ClientToolsParentLetterService } from "../generated/portal";
12
+ import { ClientToolsPatronDatabaseService } from "../generated/portal";
13
+ import { ClientToolsSeatAssignmentToolService } from "../generated/portal";
14
+ import { ClientToolsStripeOnboardingService } from "../generated/portal";
15
+ import { ClientToolsThemeBuilderService } from "../generated/portal";
16
+ import { ClientToolsThemesLibraryService } from "../generated/portal";
17
+ import { ClientToolsTicketingLinkService } from "../generated/portal";
18
+ import { ClientToolsTicketScanningService } from "../generated/portal";
19
+ import { ClientToolsUnapprovedOrdersService } from "../generated/portal";
20
+ import { ClientToolsWaitlistService } from "../generated/portal";
21
+ import { DashboardService } from "../generated/portal";
22
+ import { FeaturesBlockedSeatsService } from "../generated/portal";
23
+ import { FeaturesCheckoutQuestionsService } from "../generated/portal";
24
+ import { FeaturesDiscountsService } from "../generated/portal";
25
+ import { FeaturesDonationsService } from "../generated/portal";
26
+ import { FeaturesGiftCardsService } from "../generated/portal";
27
+ import { FeaturesGoldenTicketsService } from "../generated/portal";
28
+ import { FeaturesLandingPageService } from "../generated/portal";
29
+ import { FeaturesPriorityService } from "../generated/portal";
30
+ import { FeaturesProductsService } from "../generated/portal";
31
+ import { OrderLookupService } from "../generated/portal";
32
+ import { ReportsService } from "../generated/portal";
33
+ import { SettingsService } from "../generated/portal";
34
+ import { ShowsService } from "../generated/portal";
35
+
36
+ const wrap = <T extends object>(service: T) =>
37
+ wrapServiceForStaging(service, PortalOpenAPI, STAGING_URLS.portal);
38
+
39
+ export const portalStaging = {
40
+ account: wrap(AccountService),
41
+ accounting: wrap(AccountingService),
42
+ app: wrap(AppService),
43
+ auth: wrap(AuthService),
44
+ bookmark: wrap(BookmarkService),
45
+ clienttoolsgeneratedemails: wrap(ClientToolsGeneratedEmailsService),
46
+ clienttoolsparentletter: wrap(ClientToolsParentLetterService),
47
+ clienttoolspatrondatabase: wrap(ClientToolsPatronDatabaseService),
48
+ clienttoolsseatassignmenttool: wrap(ClientToolsSeatAssignmentToolService),
49
+ clienttoolsstripeonboarding: wrap(ClientToolsStripeOnboardingService),
50
+ clienttoolsthemebuilder: wrap(ClientToolsThemeBuilderService),
51
+ clienttoolsthemeslibrary: wrap(ClientToolsThemesLibraryService),
52
+ clienttoolsticketinglink: wrap(ClientToolsTicketingLinkService),
53
+ clienttoolsticketscanning: wrap(ClientToolsTicketScanningService),
54
+ clienttoolsunapprovedorders: wrap(ClientToolsUnapprovedOrdersService),
55
+ clienttoolswaitlist: wrap(ClientToolsWaitlistService),
56
+ dashboard: wrap(DashboardService),
57
+ featuresblockedseats: wrap(FeaturesBlockedSeatsService),
58
+ featurescheckoutquestions: wrap(FeaturesCheckoutQuestionsService),
59
+ featuresdiscounts: wrap(FeaturesDiscountsService),
60
+ featuresdonations: wrap(FeaturesDonationsService),
61
+ featuresgiftcards: wrap(FeaturesGiftCardsService),
62
+ featuresgoldentickets: wrap(FeaturesGoldenTicketsService),
63
+ featureslandingpage: wrap(FeaturesLandingPageService),
64
+ featurespriority: wrap(FeaturesPriorityService),
65
+ featuresproducts: wrap(FeaturesProductsService),
66
+ orderlookup: wrap(OrderLookupService),
67
+ reports: wrap(ReportsService),
68
+ settings: wrap(SettingsService),
69
+ shows: wrap(ShowsService),
70
+ };
71
+
72
+ // Re-export types
73
+ export * as PortalTypes from "../generated/portal/types";
@@ -0,0 +1,51 @@
1
+ // Utility to wrap service classes to use a different OpenAPI BASE URL
2
+ import { OpenAPI as PortalOpenAPI } from "../generated/portal/core/OpenAPI";
3
+
4
+ /**
5
+ * Creates a proxy wrapper around a service class that temporarily
6
+ * swaps the OpenAPI.BASE to a staging URL for each method call.
7
+ *
8
+ * This works because the URL is built synchronously in the request function
9
+ * before any async operations begin.
10
+ */
11
+ export function wrapServiceForStaging<T extends object>(
12
+ ServiceClass: T,
13
+ openAPIConfig: { BASE: string },
14
+ stagingBase: string,
15
+ ): T {
16
+ return new Proxy(ServiceClass, {
17
+ get(target, prop, receiver) {
18
+ const original = Reflect.get(target, prop, receiver);
19
+
20
+ if (typeof original === "function") {
21
+ return function (...args: unknown[]) {
22
+ // Save the original BASE
23
+ const originalBase = openAPIConfig.BASE;
24
+
25
+ // Temporarily set to staging
26
+ openAPIConfig.BASE = stagingBase;
27
+
28
+ try {
29
+ // Call the original method - URL is built synchronously here
30
+ const result = original.apply(target, args);
31
+ return result;
32
+ } finally {
33
+ // Restore original BASE immediately after the sync call
34
+ openAPIConfig.BASE = originalBase;
35
+ }
36
+ };
37
+ }
38
+
39
+ return original;
40
+ },
41
+ });
42
+ }
43
+
44
+ // Staging base URLs
45
+ // Scanner doesn't have a staging
46
+ // TODO: Update shopper to use production URL
47
+ export const STAGING_URLS = {
48
+ portal: "https://api.staging.drttix.com/admin-portal",
49
+ shopper: "https://api.staging.drttix.com/shopper",
50
+ scanner: "https://api.drttix.com/scanner-v3",
51
+ };
package/staging.ts ADDED
@@ -0,0 +1,2 @@
1
+ // Staging entry point re-export
2
+ export * from "./src/staging/index";
package/tsconfig.cjs.json CHANGED
@@ -6,6 +6,6 @@
6
6
  "moduleResolution": "node",
7
7
  "declaration": true
8
8
  },
9
- "include": ["index.ts", "src/**/*.ts"],
9
+ "include": ["index.ts", "staging.ts", "src/**/*.ts"],
10
10
  "exclude": ["dist", "node_modules"]
11
11
  }
package/tsconfig.esm.json CHANGED
@@ -6,6 +6,6 @@
6
6
  "moduleResolution": "node",
7
7
  "declaration": true
8
8
  },
9
- "include": ["index.ts", "src/**/*.ts"],
9
+ "include": ["index.ts", "staging.ts", "src/**/*.ts"],
10
10
  "exclude": ["dist", "node_modules"]
11
11
  }
@@ -1,5 +0,0 @@
1
- export type ShowSeatTierPair = {
2
- showId: number;
3
- seatId: number;
4
- tierId: number;
5
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +0,0 @@
1
- export type ShowSeatTierPair = {
2
- showId: number;
3
- seatId: number;
4
- tierId: number;
5
- };
@@ -1,10 +0,0 @@
1
- /* generated using openapi-typescript-codegen -- do not edit */
2
- /* istanbul ignore file */
3
- /* tslint:disable */
4
- /* eslint-disable */
5
- export type ShowSeatTierPair = {
6
- showId: number;
7
- seatId: number;
8
- tierId: number;
9
- };
10
-