@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.
- package/dist/cjs/src/functions/setBaseURL.js +6 -6
- package/dist/cjs/src/generated/portal/core/OpenAPI.js +1 -1
- package/dist/cjs/src/generated/portal/index.d.ts +0 -1
- package/dist/cjs/src/generated/portal/models/DiscountAccessRequestDto.d.ts +0 -1
- package/dist/cjs/src/generated/portal/models/OrderRecalculateRequestDto.d.ts +0 -3
- package/dist/cjs/src/generated/portal/models/PatronAccessRequestDto.d.ts +0 -1
- package/dist/cjs/src/generated/portal/types.d.ts +0 -1
- package/dist/cjs/src/staging/index.d.ts +77 -0
- package/dist/cjs/src/staging/index.js +40 -0
- package/dist/cjs/src/staging/portal.d.ts +63 -0
- package/dist/cjs/src/staging/portal.js +104 -0
- package/dist/cjs/src/staging/wrapService.d.ts +15 -0
- package/dist/cjs/src/staging/wrapService.js +44 -0
- package/dist/cjs/staging.d.ts +1 -0
- package/dist/cjs/staging.js +18 -0
- package/dist/esm/src/functions/setBaseURL.js +9 -9
- package/dist/esm/src/generated/portal/core/OpenAPI.js +1 -1
- package/dist/esm/src/generated/portal/index.d.ts +0 -1
- package/dist/esm/src/generated/portal/models/DiscountAccessRequestDto.d.ts +0 -1
- package/dist/esm/src/generated/portal/models/OrderRecalculateRequestDto.d.ts +0 -3
- package/dist/esm/src/generated/portal/models/PatronAccessRequestDto.d.ts +0 -1
- package/dist/esm/src/generated/portal/types.d.ts +0 -1
- package/dist/esm/src/staging/index.d.ts +77 -0
- package/dist/esm/src/staging/index.js +34 -0
- package/dist/esm/src/staging/portal.d.ts +63 -0
- package/dist/esm/src/staging/portal.js +68 -0
- package/dist/esm/src/staging/wrapService.d.ts +15 -0
- package/dist/esm/src/staging/wrapService.js +40 -0
- package/dist/esm/staging.d.ts +1 -0
- package/dist/esm/staging.js +2 -0
- package/drt-api-specs.json +5 -5
- package/package.json +38 -30
- package/src/functions/setBaseURL.ts +21 -21
- package/src/generated/portal/core/OpenAPI.ts +31 -31
- package/src/generated/portal/index.ts +373 -374
- package/src/generated/portal/models/DiscountAccessRequestDto.ts +0 -1
- package/src/generated/portal/models/OrderRecalculateRequestDto.ts +0 -3
- package/src/generated/portal/models/PatronAccessRequestDto.ts +0 -1
- package/src/generated/portal/types.ts +336 -337
- package/src/staging/index.ts +39 -0
- package/src/staging/portal.ts +73 -0
- package/src/staging/wrapService.ts +51 -0
- package/staging.ts +2 -0
- package/tsconfig.cjs.json +1 -1
- package/tsconfig.esm.json +1 -1
- package/dist/cjs/src/generated/portal/models/ShowSeatTierPair.d.ts +0 -5
- package/dist/cjs/src/generated/portal/models/ShowSeatTierPair.js +0 -2
- package/dist/esm/src/generated/portal/models/ShowSeatTierPair.d.ts +0 -5
- package/dist/esm/src/generated/portal/models/ShowSeatTierPair.js +0 -1
- 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
package/tsconfig.cjs.json
CHANGED
package/tsconfig.esm.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|