@embark-black-book/api-contract 0.1.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/README.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  Generated TypeScript contract types and endpoint client methods for Embark Black Book APIs.
4
4
 
5
+ ## Base URL Requirement
6
+
7
+ `baseUrl` must already be the API root. The client appends endpoint paths directly to this value.
8
+
9
+ - Use: `http://localhost:1337/api`
10
+ - Do not use: `http://localhost:1337`
11
+
12
+ ```ts
13
+ const baseUrl = "http://localhost:1337/api";
14
+ ```
15
+
5
16
  ## Import Types
6
17
 
7
18
  ```ts
@@ -141,6 +152,55 @@ async function createCategory(baseUrl: string, token?: string) {
141
152
  }
142
153
  ```
143
154
 
155
+ ## Auth Refresh Helpers
156
+
157
+ Use dedicated auth helpers for local login, logout, and refresh flows.
158
+
159
+ ```ts
160
+ import {
161
+ authLocalJson,
162
+ authLogoutJson,
163
+ authRefreshJson,
164
+ type AuthRefreshResponse,
165
+ } from "@embark-black-book/api-contract";
166
+
167
+ async function refreshAuth(baseUrl: string, refreshToken: string) {
168
+ const parsed = await authRefreshJson({
169
+ baseUrl,
170
+ refreshToken,
171
+ });
172
+
173
+ const payload: AuthRefreshResponse | null = parsed.data;
174
+ return payload;
175
+ }
176
+ ```
177
+
178
+ `authRefreshJson` requires `refreshToken` (not access token) and throws `ApiResponseError` for non-2xx responses.
179
+
180
+ ## Refresh Utilities
181
+
182
+ Optional utilities are exported to help app-level refresh policy code stay consistent.
183
+
184
+ ```ts
185
+ import {
186
+ computeRefreshWindowDecision,
187
+ createSingleFlightRefresh,
188
+ } from "@embark-black-book/api-contract";
189
+
190
+ const refreshOnce = createSingleFlightRefresh(async (token: string) => {
191
+ return refreshAuth("http://localhost:1337/api", token);
192
+ });
193
+
194
+ const decision = computeRefreshWindowDecision({
195
+ expiresAtMs: Date.now() + 120_000,
196
+ refreshBeforeExpiryMs: 60_000,
197
+ });
198
+
199
+ if (decision.shouldRefresh) {
200
+ await refreshOnce("refresh-token-value");
201
+ }
202
+ ```
203
+
144
204
  ## Call Endpoint Without Token
145
205
 
146
206
  ```ts
@@ -0,0 +1,38 @@
1
+ import type {
2
+ AuthLocalResponse,
3
+ AuthLogoutResponse,
4
+ AuthRefreshResponse,
5
+ GeneratedApiClient,
6
+ } from "./generated/api-client";
7
+ import type { ParsedApiResponse } from "./api-response-helpers";
8
+
9
+ export type AuthLocalRequestOptions = Parameters<
10
+ GeneratedApiClient["createAuthLocal"]
11
+ >[0];
12
+
13
+ export type AuthLogoutRequestOptions = Parameters<
14
+ GeneratedApiClient["createAuthLogout"]
15
+ >[0];
16
+
17
+ export type AuthRefreshRequestOptions = Omit<
18
+ Parameters<GeneratedApiClient["createAuthRefresh"]>[0],
19
+ "token"
20
+ > & {
21
+ /** Refresh token used for /auth/refresh. */
22
+ refreshToken: string;
23
+ };
24
+
25
+ export declare function authLocalJson(
26
+ options: AuthLocalRequestOptions,
27
+ client?: GeneratedApiClient
28
+ ): Promise<ParsedApiResponse<AuthLocalResponse>>;
29
+
30
+ export declare function authLogoutJson(
31
+ options: AuthLogoutRequestOptions,
32
+ client?: GeneratedApiClient
33
+ ): Promise<ParsedApiResponse<AuthLogoutResponse>>;
34
+
35
+ export declare function authRefreshJson(
36
+ options: AuthRefreshRequestOptions,
37
+ client?: GeneratedApiClient
38
+ ): Promise<ParsedApiResponse<AuthRefreshResponse>>;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ const { apiClient } = require("./generated/api-client");
4
+ const {
5
+ parseApiResponse,
6
+ requireApiResponseOk,
7
+ } = require("./api-response-helpers");
8
+
9
+ async function authLocalJson(options, client) {
10
+ const resolvedClient = client || apiClient;
11
+ const response = await resolvedClient.createAuthLocal(options);
12
+ return requireApiResponseOk(response);
13
+ }
14
+
15
+ async function authLogoutJson(options, client) {
16
+ const resolvedClient = client || apiClient;
17
+ const response = await resolvedClient.createAuthLogout(options);
18
+ return parseApiResponse(response);
19
+ }
20
+
21
+ async function authRefreshJson(options, client) {
22
+ const resolvedClient = client || apiClient;
23
+ const { refreshToken, ...rest } = options;
24
+ const response = await resolvedClient.createAuthRefresh({
25
+ ...rest,
26
+ token: refreshToken,
27
+ });
28
+ return requireApiResponseOk(response);
29
+ }
30
+
31
+ module.exports = {
32
+ authLocalJson,
33
+ authLogoutJson,
34
+ authRefreshJson,
35
+ };
@@ -0,0 +1,24 @@
1
+ export interface RefreshWindowOptions {
2
+ expiresAtMs: number;
3
+ nowMs?: number;
4
+ refreshBeforeExpiryMs?: number;
5
+ }
6
+
7
+ export interface RefreshWindowDecision {
8
+ shouldRefresh: boolean;
9
+ nowMs: number;
10
+ expiresAtMs: number;
11
+ refreshAtMs: number;
12
+ timeToExpiryMs: number;
13
+ }
14
+
15
+ export declare function computeRefreshWindowDecision(
16
+ options: RefreshWindowOptions
17
+ ): RefreshWindowDecision;
18
+
19
+ export declare function createSingleFlightRefresh<
20
+ TArgs extends unknown[],
21
+ TResult
22
+ >(
23
+ refreshFn: (...args: TArgs) => Promise<TResult>
24
+ ): (...args: TArgs) => Promise<TResult>;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ function computeRefreshWindowDecision(options) {
4
+ if (!options || typeof options !== "object") {
5
+ throw new Error("computeRefreshWindowDecision requires options.");
6
+ }
7
+
8
+ const expiresAtMs = Number(options.expiresAtMs);
9
+ if (!Number.isFinite(expiresAtMs)) {
10
+ throw new Error("expiresAtMs must be a finite number.");
11
+ }
12
+
13
+ const nowMs =
14
+ options.nowMs === undefined ? Date.now() : Number(options.nowMs);
15
+ if (!Number.isFinite(nowMs)) {
16
+ throw new Error("nowMs must be a finite number when provided.");
17
+ }
18
+
19
+ const refreshBeforeExpiryMs =
20
+ options.refreshBeforeExpiryMs === undefined
21
+ ? 60_000
22
+ : Number(options.refreshBeforeExpiryMs);
23
+ if (!Number.isFinite(refreshBeforeExpiryMs) || refreshBeforeExpiryMs < 0) {
24
+ throw new Error(
25
+ "refreshBeforeExpiryMs must be a finite number greater than or equal to 0."
26
+ );
27
+ }
28
+
29
+ const refreshAtMs = expiresAtMs - refreshBeforeExpiryMs;
30
+ const shouldRefresh = nowMs >= refreshAtMs;
31
+
32
+ return {
33
+ shouldRefresh,
34
+ nowMs,
35
+ expiresAtMs,
36
+ refreshAtMs,
37
+ timeToExpiryMs: expiresAtMs - nowMs,
38
+ };
39
+ }
40
+
41
+ function createSingleFlightRefresh(refreshFn) {
42
+ if (typeof refreshFn !== "function") {
43
+ throw new Error("createSingleFlightRefresh requires a function.");
44
+ }
45
+
46
+ let inFlight = null;
47
+
48
+ return function singleFlightRefresh(...args) {
49
+ if (!inFlight) {
50
+ inFlight = Promise.resolve()
51
+ .then(() => refreshFn(...args))
52
+ .finally(() => {
53
+ inFlight = null;
54
+ });
55
+ }
56
+
57
+ return inFlight;
58
+ };
59
+ }
60
+
61
+ module.exports = {
62
+ computeRefreshWindowDecision,
63
+ createSingleFlightRefresh,
64
+ };
@@ -42,6 +42,11 @@ export interface ApiParameters {
42
42
  locale?: string | string[];
43
43
  }
44
44
 
45
+ export type AuthLocalRequest = { identifier: string; password: string; };
46
+ export type AuthLocalResponse = { jwt: string; refreshToken?: string; user: { id: number; documentId: string; username: string; email: string; provider: string; confirmed: boolean; blocked: boolean; role?: number | { id: unknown; name: unknown; description: unknown; type: unknown; createdAt: unknown; updatedAt: unknown; }; createdAt: string; updatedAt: string; publishedAt: string; }; };
47
+ export type AuthLogoutResponse = null;
48
+ export type AuthRefreshResponse = { jwt: string; refreshToken?: string; user: { id: number; documentId: string; username: string; email: string; provider: string; confirmed: boolean; blocked: boolean; role?: number | { id: unknown; name: unknown; description: unknown; type: unknown; createdAt: unknown; updatedAt: unknown; }; createdAt: string; updatedAt: string; publishedAt: string; }; };
49
+
45
50
  export type ApiClientDefinition = { name: string; group: string; method: string; pathTemplate: string; pathParams: string[]; hasBody: boolean; queryParams: string[] };
46
51
 
47
52
  export type ApiClientHookRequestContext = {
@@ -219,7 +224,7 @@ export interface GeneratedApiClient {
219
224
  fetchImpl?: typeof fetch;
220
225
  pathParams?: Record<string, string | number>;
221
226
  query?: Record<string, unknown>;
222
- body?: unknown;
227
+ body?: AuthLocalRequest;
223
228
  }): Promise<Response>;
224
229
  createAuthLocalRegister(options: {
225
230
  baseUrl: string;
@@ -252,7 +257,8 @@ export interface GeneratedApiClient {
252
257
  }): Promise<Response>;
253
258
  createAuthRefresh(options: {
254
259
  baseUrl: string;
255
- token?: string;
260
+ /** Refresh token passed as Authorization: Bearer <token> for /auth/refresh. */
261
+ token: string;
256
262
  headers?: Record<string, string>;
257
263
  signal?: AbortSignal;
258
264
  fetchImpl?: typeof fetch;
@@ -427,6 +433,16 @@ export interface GeneratedApiClient {
427
433
  pathParams?: Record<string, string | number>;
428
434
  query?: ApiParameters;
429
435
  body?: unknown;
436
+ }): Promise<Response>;
437
+ createCreditCardDefaultPercentage(options: {
438
+ baseUrl: string;
439
+ token?: string;
440
+ headers?: Record<string, string>;
441
+ signal?: AbortSignal;
442
+ fetchImpl?: typeof fetch;
443
+ pathParams?: Record<string, string | number>;
444
+ query?: ApiParameters;
445
+ body?: unknown;
430
446
  }): Promise<Response>;
431
447
  createDestinationEpic(options: {
432
448
  baseUrl: string;
@@ -1335,6 +1351,17 @@ export interface GeneratedApiClient {
1335
1351
  "id": string | number;
1336
1352
  };
1337
1353
  query?: ApiParameters;
1354
+ }): Promise<Response>;
1355
+ deleteAuthSessionBySessionId(options: {
1356
+ baseUrl: string;
1357
+ token?: string;
1358
+ headers?: Record<string, string>;
1359
+ signal?: AbortSignal;
1360
+ fetchImpl?: typeof fetch;
1361
+ pathParams: {
1362
+ "sessionId": string | number;
1363
+ };
1364
+ query?: Record<string, unknown>;
1338
1365
  }): Promise<Response>;
1339
1366
  deleteBlackbookGuideline(options: {
1340
1367
  baseUrl: string;
@@ -1507,6 +1534,26 @@ export interface GeneratedApiClient {
1507
1534
  "id": string | number;
1508
1535
  };
1509
1536
  query?: ApiParameters;
1537
+ }): Promise<Response>;
1538
+ deleteCreditCardDefaultPercentageById(options: {
1539
+ baseUrl: string;
1540
+ token?: string;
1541
+ headers?: Record<string, string>;
1542
+ signal?: AbortSignal;
1543
+ fetchImpl?: typeof fetch;
1544
+ pathParams: {
1545
+ "id": string | number;
1546
+ };
1547
+ query?: ApiParameters;
1548
+ }): Promise<Response>;
1549
+ deleteCreditCardMerchantToolSideNote(options: {
1550
+ baseUrl: string;
1551
+ token?: string;
1552
+ headers?: Record<string, string>;
1553
+ signal?: AbortSignal;
1554
+ fetchImpl?: typeof fetch;
1555
+ pathParams?: Record<string, string | number>;
1556
+ query?: ApiParameters;
1510
1557
  }): Promise<Response>;
1511
1558
  deleteDefaultDirectorySearch(options: {
1512
1559
  baseUrl: string;
@@ -2642,6 +2689,15 @@ export interface GeneratedApiClient {
2642
2689
  fetchImpl?: typeof fetch;
2643
2690
  pathParams?: Record<string, string | number>;
2644
2691
  query?: ApiParameters;
2692
+ }): Promise<Response>;
2693
+ getAuthSessions(options: {
2694
+ baseUrl: string;
2695
+ token?: string;
2696
+ headers?: Record<string, string>;
2697
+ signal?: AbortSignal;
2698
+ fetchImpl?: typeof fetch;
2699
+ pathParams?: Record<string, string | number>;
2700
+ query?: Record<string, unknown>;
2645
2701
  }): Promise<Response>;
2646
2702
  getBlackbookGuidelines(options: {
2647
2703
  baseUrl: string;
@@ -2700,6 +2756,17 @@ export interface GeneratedApiClient {
2700
2756
  fetchImpl?: typeof fetch;
2701
2757
  pathParams?: Record<string, string | number>;
2702
2758
  query?: ApiParameters;
2759
+ }): Promise<Response>;
2760
+ getCompaniesCompanyPacSearchByQuery(options: {
2761
+ baseUrl: string;
2762
+ token?: string;
2763
+ headers?: Record<string, string>;
2764
+ signal?: AbortSignal;
2765
+ fetchImpl?: typeof fetch;
2766
+ pathParams: {
2767
+ "query": string | number;
2768
+ };
2769
+ query?: Record<string, unknown>;
2703
2770
  }): Promise<Response>;
2704
2771
  getCompaniesGroundPartnerById(options: {
2705
2772
  baseUrl: string;
@@ -3001,7 +3068,7 @@ export interface GeneratedApiClient {
3001
3068
  pathParams?: Record<string, string | number>;
3002
3069
  query?: ApiParameters;
3003
3070
  }): Promise<Response>;
3004
- getConnect(.*)(options: {
3071
+ getConnect(options: {
3005
3072
  baseUrl: string;
3006
3073
  token?: string;
3007
3074
  headers?: Record<string, string>;
@@ -3089,6 +3156,35 @@ export interface GeneratedApiClient {
3089
3156
  fetchImpl?: typeof fetch;
3090
3157
  pathParams?: Record<string, string | number>;
3091
3158
  query?: ApiParameters;
3159
+ }): Promise<Response>;
3160
+ getCreditCardDefaultPercentageById(options: {
3161
+ baseUrl: string;
3162
+ token?: string;
3163
+ headers?: Record<string, string>;
3164
+ signal?: AbortSignal;
3165
+ fetchImpl?: typeof fetch;
3166
+ pathParams: {
3167
+ "id": string | number;
3168
+ };
3169
+ query?: ApiParameters;
3170
+ }): Promise<Response>;
3171
+ getCreditCardDefaultPercentages(options: {
3172
+ baseUrl: string;
3173
+ token?: string;
3174
+ headers?: Record<string, string>;
3175
+ signal?: AbortSignal;
3176
+ fetchImpl?: typeof fetch;
3177
+ pathParams?: Record<string, string | number>;
3178
+ query?: ApiParameters;
3179
+ }): Promise<Response>;
3180
+ getCreditCardMerchantToolSideNote(options: {
3181
+ baseUrl: string;
3182
+ token?: string;
3183
+ headers?: Record<string, string>;
3184
+ signal?: AbortSignal;
3185
+ fetchImpl?: typeof fetch;
3186
+ pathParams?: Record<string, string | number>;
3187
+ query?: ApiParameters;
3092
3188
  }): Promise<Response>;
3093
3189
  getDefaultDirectorySearch(options: {
3094
3190
  baseUrl: string;
@@ -3119,7 +3215,7 @@ export interface GeneratedApiClient {
3119
3215
  pathParams?: Record<string, string | number>;
3120
3216
  query?: ApiParameters;
3121
3217
  }): Promise<Response>;
3122
- getDestinationEpicsListAllLevelByIncludeInactive?(options: {
3218
+ getDestinationEpicsListAllLevelByIncludeInactive(options: {
3123
3219
  baseUrl: string;
3124
3220
  token?: string;
3125
3221
  headers?: Record<string, string>;
@@ -4692,6 +4788,15 @@ export interface GeneratedApiClient {
4692
4788
  fetchImpl?: typeof fetch;
4693
4789
  pathParams?: Record<string, string | number>;
4694
4790
  query?: ApiParameters;
4791
+ }): Promise<Response>;
4792
+ getUploadFilesPage(options: {
4793
+ baseUrl: string;
4794
+ token?: string;
4795
+ headers?: Record<string, string>;
4796
+ signal?: AbortSignal;
4797
+ fetchImpl?: typeof fetch;
4798
+ pathParams?: Record<string, string | number>;
4799
+ query?: ApiParameters;
4695
4800
  }): Promise<Response>;
4696
4801
  getUsefulLinkById(options: {
4697
4802
  baseUrl: string;
@@ -5042,6 +5147,16 @@ export interface GeneratedApiClient {
5042
5147
  pathParams?: Record<string, string | number>;
5043
5148
  query?: ApiParameters;
5044
5149
  body?: unknown;
5150
+ }): Promise<Response>;
5151
+ putCreditCardMerchantToolSideNote(options: {
5152
+ baseUrl: string;
5153
+ token?: string;
5154
+ headers?: Record<string, string>;
5155
+ signal?: AbortSignal;
5156
+ fetchImpl?: typeof fetch;
5157
+ pathParams?: Record<string, string | number>;
5158
+ query?: ApiParameters;
5159
+ body?: unknown;
5045
5160
  }): Promise<Response>;
5046
5161
  putDefaultDirectorySearch(options: {
5047
5162
  baseUrl: string;
@@ -5426,6 +5541,18 @@ export interface GeneratedApiClient {
5426
5541
  };
5427
5542
  query?: ApiParameters;
5428
5543
  body?: unknown;
5544
+ }): Promise<Response>;
5545
+ updateCreditCardDefaultPercentageById(options: {
5546
+ baseUrl: string;
5547
+ token?: string;
5548
+ headers?: Record<string, string>;
5549
+ signal?: AbortSignal;
5550
+ fetchImpl?: typeof fetch;
5551
+ pathParams: {
5552
+ "id": string | number;
5553
+ };
5554
+ query?: ApiParameters;
5555
+ body?: unknown;
5429
5556
  }): Promise<Response>;
5430
5557
  updateDestinationEpicById(options: {
5431
5558
  baseUrl: string;
@@ -6293,7 +6420,7 @@ export interface GeneratedApiClient {
6293
6420
  }): Promise<Response>;
6294
6421
  }
6295
6422
 
6296
- export type ApiClientGroupName = "accordion" | "accordionCategory" | "accordionItem" | "address" | "addressType" | "album" | "albumEmbeddedVideoItem" | "albumItem" | "albumPdfItem" | "aliasedDestination" | "announcement" | "answerOption" | "auth" | "authorizationType" | "blackbookGuideline" | "calendarItem" | "chartbrewReport" | "company" | "companyAlternateName" | "companyGdsId" | "companyHistory" | "companyQuestionAnswer" | "companyRelationship" | "companyStatuse" | "companySubType" | "companyType" | "companyTypeQuestionXref" | "companyVerification" | "connect" | "contentTypeBuilder" | "country" | "countrysubdivision" | "defaultDirectorySearch" | "destinationEpic" | "destinationLink" | "destinationMajor" | "destinationMinor" | "email" | "emailAddress" | "emailAddressType" | "eventSpace" | "eventSpaceLayout" | "eventType" | "externalEmailTemplate" | "footerContent" | "footerLegalMenu" | "footerMenu" | "gdsType" | "geographySearchItem" | "hawkSearchErrorLog" | "hawkSearchReindice" | "helpPage" | "heroImage" | "homePageButton" | "i18n" | "ingredient" | "landingPage" | "landingPageLink" | "landingPageVideo" | "language" | "layoutType" | "loyaltyProgram" | "loyaltyProgramCompany" | "loyaltyProgramContact" | "loyaltyProgramLink" | "loyaltyProgramVideo" | "mediaCategory" | "menuItem" | "meta" | "muxFolder" | "muxVideo" | "navigation" | "newsArticle" | "newsArticleGroup" | "newsArticleGroupCategory" | "newsArticleGroupCategoryTopic" | "newsArticleLink" | "people" | "peopleAtCompany" | "phoneNumber" | "phoneNumberType" | "policy" | "prefixe" | "primaryContactType" | "productRoadmap" | "pronoun" | "publicationNote" | "question" | "questionType" | "releaseNote" | "rss" | "rssFeed" | "savedFavoriteList" | "savedFavoriteListCompany" | "schemaVisualizer" | "shortcut" | "socialMedia" | "socialMediaType" | "special" | "sponsorship" | "sponsorshipAlsoInterestedIn" | "sponsorshipLocation" | "sponsorshipStatuse" | "suffixe" | "tag" | "trainingCourse" | "trainingLink" | "trainingModule" | "trainingVideoItem" | "upload" | "usefulLink" | "user" | "userAcceptedPolicy" | "usersPermission" | "vrLink";
6423
+ export type ApiClientGroupName = "accordion" | "accordionCategory" | "accordionItem" | "address" | "addressType" | "album" | "albumEmbeddedVideoItem" | "albumItem" | "albumPdfItem" | "aliasedDestination" | "announcement" | "answerOption" | "auth" | "authorizationType" | "blackbookGuideline" | "calendarItem" | "chartbrewReport" | "company" | "companyAlternateName" | "companyGdsId" | "companyHistory" | "companyQuestionAnswer" | "companyRelationship" | "companyStatuse" | "companySubType" | "companyType" | "companyTypeQuestionXref" | "companyVerification" | "connect" | "contentTypeBuilder" | "country" | "countrysubdivision" | "creditCardDefaultPercentage" | "creditCardMerchantToolSideNote" | "defaultDirectorySearch" | "destinationEpic" | "destinationLink" | "destinationMajor" | "destinationMinor" | "email" | "emailAddress" | "emailAddressType" | "eventSpace" | "eventSpaceLayout" | "eventType" | "externalEmailTemplate" | "footerContent" | "footerLegalMenu" | "footerMenu" | "gdsType" | "geographySearchItem" | "hawkSearchErrorLog" | "hawkSearchReindice" | "helpPage" | "heroImage" | "homePageButton" | "i18n" | "ingredient" | "landingPage" | "landingPageLink" | "landingPageVideo" | "language" | "layoutType" | "loyaltyProgram" | "loyaltyProgramCompany" | "loyaltyProgramContact" | "loyaltyProgramLink" | "loyaltyProgramVideo" | "mediaCategory" | "menuItem" | "meta" | "muxFolder" | "muxVideo" | "navigation" | "newsArticle" | "newsArticleGroup" | "newsArticleGroupCategory" | "newsArticleGroupCategoryTopic" | "newsArticleLink" | "people" | "peopleAtCompany" | "phoneNumber" | "phoneNumberType" | "policy" | "prefixe" | "primaryContactType" | "productRoadmap" | "pronoun" | "publicationNote" | "question" | "questionType" | "releaseNote" | "rss" | "rssFeed" | "savedFavoriteList" | "savedFavoriteListCompany" | "schemaVisualizer" | "shortcut" | "socialMedia" | "socialMediaType" | "special" | "sponsorship" | "sponsorshipAlsoInterestedIn" | "sponsorshipLocation" | "sponsorshipStatuse" | "suffixe" | "tag" | "trainingCourse" | "trainingLink" | "trainingModule" | "trainingVideoItem" | "upload" | "usefulLink" | "user" | "userAcceptedPolicy" | "usersPermission" | "vrLink";
6297
6424
 
6298
6425
  export interface GeneratedApiClientGroups {
6299
6426
  accordion: Pick<GeneratedApiClient,
@@ -6402,8 +6529,10 @@ export interface GeneratedApiClientGroups {
6402
6529
  "createAuthRefresh" |
6403
6530
  "createAuthResetPassword" |
6404
6531
  "createAuthSendEmailConfirmation" |
6532
+ "deleteAuthSessionBySessionId" |
6405
6533
  "getAuthCallbackByProvider" |
6406
6534
  "getAuthEmailConfirmation" |
6535
+ "getAuthSessions" |
6407
6536
  never
6408
6537
  >;
6409
6538
  authorizationType: Pick<GeneratedApiClient,
@@ -6441,6 +6570,7 @@ export interface GeneratedApiClientGroups {
6441
6570
  "createCompany" |
6442
6571
  "deleteCompanyById" |
6443
6572
  "getCompanies" |
6573
+ "getCompaniesCompanyPacSearchByQuery" |
6444
6574
  "getCompaniesGroundPartnerById" |
6445
6575
  "getCompaniesSecurityById" |
6446
6576
  "getCompaniesTransientCommissionByEpic" |
@@ -6537,7 +6667,7 @@ export interface GeneratedApiClientGroups {
6537
6667
  never
6538
6668
  >;
6539
6669
  connect: Pick<GeneratedApiClient,
6540
- "getConnect(.*)" |
6670
+ "getConnect" |
6541
6671
  never
6542
6672
  >;
6543
6673
  contentTypeBuilder: Pick<GeneratedApiClient,
@@ -6563,6 +6693,20 @@ export interface GeneratedApiClientGroups {
6563
6693
  "updateCountrysubdivisionById" |
6564
6694
  never
6565
6695
  >;
6696
+ creditCardDefaultPercentage: Pick<GeneratedApiClient,
6697
+ "createCreditCardDefaultPercentage" |
6698
+ "deleteCreditCardDefaultPercentageById" |
6699
+ "getCreditCardDefaultPercentageById" |
6700
+ "getCreditCardDefaultPercentages" |
6701
+ "updateCreditCardDefaultPercentageById" |
6702
+ never
6703
+ >;
6704
+ creditCardMerchantToolSideNote: Pick<GeneratedApiClient,
6705
+ "deleteCreditCardMerchantToolSideNote" |
6706
+ "getCreditCardMerchantToolSideNote" |
6707
+ "putCreditCardMerchantToolSideNote" |
6708
+ never
6709
+ >;
6566
6710
  defaultDirectorySearch: Pick<GeneratedApiClient,
6567
6711
  "deleteDefaultDirectorySearch" |
6568
6712
  "getDefaultDirectorySearch" |
@@ -6574,7 +6718,7 @@ export interface GeneratedApiClientGroups {
6574
6718
  "deleteDestinationEpicById" |
6575
6719
  "getDestinationEpicById" |
6576
6720
  "getDestinationEpics" |
6577
- "getDestinationEpicsListAllLevelByIncludeInactive?" |
6721
+ "getDestinationEpicsListAllLevelByIncludeInactive" |
6578
6722
  "getDestinationEpicsSearchByValueAndIncludeInactive" |
6579
6723
  "updateDestinationEpicById" |
6580
6724
  never
@@ -7188,6 +7332,7 @@ export interface GeneratedApiClientGroups {
7188
7332
  "deleteUploadFileById" |
7189
7333
  "getUploadFileById" |
7190
7334
  "getUploadFiles" |
7335
+ "getUploadFilesPage" |
7191
7336
  never
7192
7337
  >;
7193
7338
  usefulLink: Pick<GeneratedApiClient,
@@ -406,6 +406,18 @@ const endpointDefinitions = [
406
406
  "populate"
407
407
  ]
408
408
  },
409
+ {
410
+ "name": "createCreditCardDefaultPercentage",
411
+ "group": "creditCardDefaultPercentage",
412
+ "method": "POST",
413
+ "pathTemplate": "/credit-card-default-percentages",
414
+ "pathParams": [],
415
+ "hasBody": true,
416
+ "queryParams": [
417
+ "fields",
418
+ "populate"
419
+ ]
420
+ },
409
421
  {
410
422
  "name": "createDestinationEpic",
411
423
  "group": "destinationEpic",
@@ -1503,6 +1515,17 @@ const endpointDefinitions = [
1503
1515
  "filters"
1504
1516
  ]
1505
1517
  },
1518
+ {
1519
+ "name": "deleteAuthSessionBySessionId",
1520
+ "group": "auth",
1521
+ "method": "DELETE",
1522
+ "pathTemplate": "/auth/sessions/{sessionId}",
1523
+ "pathParams": [
1524
+ "sessionId"
1525
+ ],
1526
+ "hasBody": false,
1527
+ "queryParams": []
1528
+ },
1506
1529
  {
1507
1530
  "name": "deleteBlackbookGuideline",
1508
1531
  "group": "blackbookGuideline",
@@ -1737,6 +1760,33 @@ const endpointDefinitions = [
1737
1760
  "filters"
1738
1761
  ]
1739
1762
  },
1763
+ {
1764
+ "name": "deleteCreditCardDefaultPercentageById",
1765
+ "group": "creditCardDefaultPercentage",
1766
+ "method": "DELETE",
1767
+ "pathTemplate": "/credit-card-default-percentages/{id}",
1768
+ "pathParams": [
1769
+ "id"
1770
+ ],
1771
+ "hasBody": false,
1772
+ "queryParams": [
1773
+ "fields",
1774
+ "populate",
1775
+ "filters"
1776
+ ]
1777
+ },
1778
+ {
1779
+ "name": "deleteCreditCardMerchantToolSideNote",
1780
+ "group": "creditCardMerchantToolSideNote",
1781
+ "method": "DELETE",
1782
+ "pathTemplate": "/credit-card-merchant-tool-side-note",
1783
+ "pathParams": [],
1784
+ "hasBody": false,
1785
+ "queryParams": [
1786
+ "fields",
1787
+ "populate"
1788
+ ]
1789
+ },
1740
1790
  {
1741
1791
  "name": "deleteDefaultDirectorySearch",
1742
1792
  "group": "defaultDirectorySearch",
@@ -3322,6 +3372,15 @@ const endpointDefinitions = [
3322
3372
  "populate"
3323
3373
  ]
3324
3374
  },
3375
+ {
3376
+ "name": "getAuthSessions",
3377
+ "group": "auth",
3378
+ "method": "GET",
3379
+ "pathTemplate": "/auth/sessions",
3380
+ "pathParams": [],
3381
+ "hasBody": false,
3382
+ "queryParams": []
3383
+ },
3325
3384
  {
3326
3385
  "name": "getBlackbookGuidelines",
3327
3386
  "group": "blackbookGuideline",
@@ -3415,6 +3474,17 @@ const endpointDefinitions = [
3415
3474
  "populate"
3416
3475
  ]
3417
3476
  },
3477
+ {
3478
+ "name": "getCompaniesCompanyPacSearchByQuery",
3479
+ "group": "company",
3480
+ "method": "GET",
3481
+ "pathTemplate": "/companies/company-pac-search/{query}",
3482
+ "pathParams": [
3483
+ "query"
3484
+ ],
3485
+ "hasBody": false,
3486
+ "queryParams": []
3487
+ },
3418
3488
  {
3419
3489
  "name": "getCompaniesGroundPartnerById",
3420
3490
  "group": "company",
@@ -3833,7 +3903,7 @@ const endpointDefinitions = [
3833
3903
  ]
3834
3904
  },
3835
3905
  {
3836
- "name": "getConnect(.*)",
3906
+ "name": "getConnect",
3837
3907
  "group": "connect",
3838
3908
  "method": "GET",
3839
3909
  "pathTemplate": "/connect/(.*)",
@@ -3947,6 +4017,51 @@ const endpointDefinitions = [
3947
4017
  "populate"
3948
4018
  ]
3949
4019
  },
4020
+ {
4021
+ "name": "getCreditCardDefaultPercentageById",
4022
+ "group": "creditCardDefaultPercentage",
4023
+ "method": "GET",
4024
+ "pathTemplate": "/credit-card-default-percentages/{id}",
4025
+ "pathParams": [
4026
+ "id"
4027
+ ],
4028
+ "hasBody": false,
4029
+ "queryParams": [
4030
+ "fields",
4031
+ "populate",
4032
+ "filters",
4033
+ "sort"
4034
+ ]
4035
+ },
4036
+ {
4037
+ "name": "getCreditCardDefaultPercentages",
4038
+ "group": "creditCardDefaultPercentage",
4039
+ "method": "GET",
4040
+ "pathTemplate": "/credit-card-default-percentages",
4041
+ "pathParams": [],
4042
+ "hasBody": false,
4043
+ "queryParams": [
4044
+ "fields",
4045
+ "filters",
4046
+ "_q",
4047
+ "pagination",
4048
+ "sort",
4049
+ "populate"
4050
+ ]
4051
+ },
4052
+ {
4053
+ "name": "getCreditCardMerchantToolSideNote",
4054
+ "group": "creditCardMerchantToolSideNote",
4055
+ "method": "GET",
4056
+ "pathTemplate": "/credit-card-merchant-tool-side-note",
4057
+ "pathParams": [],
4058
+ "hasBody": false,
4059
+ "queryParams": [
4060
+ "fields",
4061
+ "populate",
4062
+ "filters"
4063
+ ]
4064
+ },
3950
4065
  {
3951
4066
  "name": "getDefaultDirectorySearch",
3952
4067
  "group": "defaultDirectorySearch",
@@ -3993,7 +4108,7 @@ const endpointDefinitions = [
3993
4108
  ]
3994
4109
  },
3995
4110
  {
3996
- "name": "getDestinationEpicsListAllLevelByIncludeInactive?",
4111
+ "name": "getDestinationEpicsListAllLevelByIncludeInactive",
3997
4112
  "group": "destinationEpic",
3998
4113
  "method": "GET",
3999
4114
  "pathTemplate": "/destination-epics/list-all-levels/{includeInactive?}",
@@ -6375,6 +6490,21 @@ const endpointDefinitions = [
6375
6490
  "filters"
6376
6491
  ]
6377
6492
  },
6493
+ {
6494
+ "name": "getUploadFilesPage",
6495
+ "group": "upload",
6496
+ "method": "GET",
6497
+ "pathTemplate": "/upload/files/page",
6498
+ "pathParams": [],
6499
+ "hasBody": false,
6500
+ "queryParams": [
6501
+ "fields",
6502
+ "populate",
6503
+ "sort",
6504
+ "pagination",
6505
+ "filters"
6506
+ ]
6507
+ },
6378
6508
  {
6379
6509
  "name": "getUsefulLinkById",
6380
6510
  "group": "usefulLink",
@@ -6779,6 +6909,18 @@ const endpointDefinitions = [
6779
6909
  "populate"
6780
6910
  ]
6781
6911
  },
6912
+ {
6913
+ "name": "putCreditCardMerchantToolSideNote",
6914
+ "group": "creditCardMerchantToolSideNote",
6915
+ "method": "PUT",
6916
+ "pathTemplate": "/credit-card-merchant-tool-side-note",
6917
+ "pathParams": [],
6918
+ "hasBody": true,
6919
+ "queryParams": [
6920
+ "fields",
6921
+ "populate"
6922
+ ]
6923
+ },
6782
6924
  {
6783
6925
  "name": "putDefaultDirectorySearch",
6784
6926
  "group": "defaultDirectorySearch",
@@ -7229,6 +7371,20 @@ const endpointDefinitions = [
7229
7371
  "populate"
7230
7372
  ]
7231
7373
  },
7374
+ {
7375
+ "name": "updateCreditCardDefaultPercentageById",
7376
+ "group": "creditCardDefaultPercentage",
7377
+ "method": "PUT",
7378
+ "pathTemplate": "/credit-card-default-percentages/{id}",
7379
+ "pathParams": [
7380
+ "id"
7381
+ ],
7382
+ "hasBody": true,
7383
+ "queryParams": [
7384
+ "fields",
7385
+ "populate"
7386
+ ]
7387
+ },
7232
7388
  {
7233
7389
  "name": "updateDestinationEpicById",
7234
7390
  "group": "destinationEpic",
@@ -397,6 +397,19 @@ export interface ApiCountrysubdivision extends ApiBaseEntity {
397
397
  publishedAt: string;
398
398
  }
399
399
 
400
+ export interface ApiCreditCardDefaultPercentage extends ApiBaseEntity {
401
+ Name?: string;
402
+ Rank?: number;
403
+ Fee?: number;
404
+ publishedAt: string;
405
+ }
406
+
407
+ export interface ApiCreditCardMerchantToolSideNote extends ApiBaseEntity {
408
+ Notes?: string;
409
+ CalculatorNotes?: string;
410
+ publishedAt: string;
411
+ }
412
+
400
413
  export interface ApiDefaultDirectorySearch extends ApiBaseEntity {
401
414
  SearchText?: string;
402
415
  publishedAt: string;
@@ -663,7 +676,7 @@ export interface ApiIngredient extends ApiBaseEntity {
663
676
 
664
677
  export interface ApiLandingPage extends ApiBaseEntity {
665
678
  Title?: string;
666
- Key?: "home" | "loyalty-programs" | "destinations" | "interests" | "travel-products" | "calendar" | "specials" | "commissions" | "financial" | "company-resources" | "training";
679
+ Key?: "home" | "loyalty-programs" | "destinations" | "interests" | "travel-products" | "calendar" | "specials" | "commissions" | "financial" | "company-resources" | "training" | "credit-card-merchant-tool";
667
680
  IsActive: boolean | null;
668
681
  Notes?: string;
669
682
  publishedAt: string;
@@ -1203,6 +1216,27 @@ export interface ApiTrainingVideoItem extends ApiBaseEntity {
1203
1216
  Course?: ApiTrainingCourse;
1204
1217
  }
1205
1218
 
1219
+ export interface ApiUpload extends ApiBaseEntity {
1220
+ name: string;
1221
+ alternativeText?: string | null;
1222
+ caption?: string | null;
1223
+ width?: number;
1224
+ height?: number;
1225
+ formats?: Record<string, unknown>;
1226
+ hash: string;
1227
+ ext?: string;
1228
+ mime: string;
1229
+ size: number;
1230
+ url: string;
1231
+ previewUrl?: string | null;
1232
+ folder?: number;
1233
+ folderPath: string;
1234
+ provider: string;
1235
+ provider_metadata?: Record<string, unknown> | null;
1236
+ createdBy?: number;
1237
+ updatedBy?: number;
1238
+ }
1239
+
1206
1240
  export interface ApiUsefulLink extends ApiBaseEntity {
1207
1241
  URL?: string;
1208
1242
  DisplayText?: string;
@@ -1228,4 +1262,4 @@ export interface ApiVrLink extends ApiBaseEntity {
1228
1262
  MediaCategory?: ApiMediaCategory;
1229
1263
  }
1230
1264
 
1231
- export type ApiEntity = ApiMedia | ApiUsersPermissionsRole | ApiUsersPermissionsUser | ApiAccordion | ApiAccordionCategory | ApiAccordionItem | ApiAddress | ApiAddressType | ApiAlbum | ApiAlbumEmbeddedVideoItem | ApiAlbumItem | ApiAlbumPdfItem | ApiAliasedDestination | ApiAnnouncement | ApiAnswerOption | ApiAuthorizationType | ApiBlackbookGuideline | ApiCalendarItem | ApiChartbrewReport | ApiCompany | ApiCompanyAlternateName | ApiCompanyGdsId | ApiCompanyHistory | ApiCompanyQuestionAnswer | ApiCompanyRelationship | ApiCompanyStatuse | ApiCompanySubType | ApiCompanyType | ApiCompanyTypeQuestionXref | ApiCompanyVerification | ApiContentTypeBuilder | ApiCountry | ApiCountrysubdivision | ApiDefaultDirectorySearch | ApiDestinationEpic | ApiDestinationLink | ApiDestinationMajor | ApiDestinationMinor | ApiEmailAddress | ApiEmailAddressType | ApiEventSpace | ApiEventSpaceLayout | ApiEventType | ApiExternalEmailTemplate | ApiFooterContent | ApiFooterLegalMenu | ApiFooterMenu | ApiGdsType | ApiGeographySearchItem | ApiHawkSearchErrorLog | ApiHawkSearchReindice | ApiHelpPage | ApiHeroImage | ApiHomePageButton | ApiIngredient | ApiLandingPage | ApiLandingPageLink | ApiLandingPageVideo | ApiLanguage | ApiLayoutType | ApiLoyaltyProgram | ApiLoyaltyProgramCompany | ApiLoyaltyProgramContact | ApiLoyaltyProgramLink | ApiLoyaltyProgramVideo | ApiMediaCategory | ApiMenuItem | ApiMuxFolder | ApiMuxVideo | ApiNavigation | ApiNewsArticle | ApiNewsArticleGroup | ApiNewsArticleGroupCategory | ApiNewsArticleGroupCategoryTopic | ApiNewsArticleLink | ApiPeople | ApiPeopleAtCompany | ApiPhoneNumber | ApiPhoneNumberType | ApiPolicy | ApiPrefixe | ApiPrimaryContactType | ApiProductRoadmap | ApiPronoun | ApiPublicationNote | ApiQuestion | ApiQuestionType | ApiReleaseNote | ApiRssFeed | ApiSavedFavoriteList | ApiSavedFavoriteListCompany | ApiShortcut | ApiSocialMedia | ApiSocialMediaType | ApiSpecial | ApiSponsorship | ApiSponsorshipAlsoInterestedIn | ApiSponsorshipLocation | ApiSponsorshipStatuse | ApiSuffixe | ApiTag | ApiTrainingCourse | ApiTrainingLink | ApiTrainingModule | ApiTrainingVideoItem | ApiUsefulLink | ApiUserAcceptedPolicy | ApiVrLink;
1265
+ export type ApiEntity = ApiMedia | ApiUsersPermissionsRole | ApiUsersPermissionsUser | ApiAccordion | ApiAccordionCategory | ApiAccordionItem | ApiAddress | ApiAddressType | ApiAlbum | ApiAlbumEmbeddedVideoItem | ApiAlbumItem | ApiAlbumPdfItem | ApiAliasedDestination | ApiAnnouncement | ApiAnswerOption | ApiAuthorizationType | ApiBlackbookGuideline | ApiCalendarItem | ApiChartbrewReport | ApiCompany | ApiCompanyAlternateName | ApiCompanyGdsId | ApiCompanyHistory | ApiCompanyQuestionAnswer | ApiCompanyRelationship | ApiCompanyStatuse | ApiCompanySubType | ApiCompanyType | ApiCompanyTypeQuestionXref | ApiCompanyVerification | ApiContentTypeBuilder | ApiCountry | ApiCountrysubdivision | ApiCreditCardDefaultPercentage | ApiCreditCardMerchantToolSideNote | ApiDefaultDirectorySearch | ApiDestinationEpic | ApiDestinationLink | ApiDestinationMajor | ApiDestinationMinor | ApiEmailAddress | ApiEmailAddressType | ApiEventSpace | ApiEventSpaceLayout | ApiEventType | ApiExternalEmailTemplate | ApiFooterContent | ApiFooterLegalMenu | ApiFooterMenu | ApiGdsType | ApiGeographySearchItem | ApiHawkSearchErrorLog | ApiHawkSearchReindice | ApiHelpPage | ApiHeroImage | ApiHomePageButton | ApiIngredient | ApiLandingPage | ApiLandingPageLink | ApiLandingPageVideo | ApiLanguage | ApiLayoutType | ApiLoyaltyProgram | ApiLoyaltyProgramCompany | ApiLoyaltyProgramContact | ApiLoyaltyProgramLink | ApiLoyaltyProgramVideo | ApiMediaCategory | ApiMenuItem | ApiMuxFolder | ApiMuxVideo | ApiNavigation | ApiNewsArticle | ApiNewsArticleGroup | ApiNewsArticleGroupCategory | ApiNewsArticleGroupCategoryTopic | ApiNewsArticleLink | ApiPeople | ApiPeopleAtCompany | ApiPhoneNumber | ApiPhoneNumberType | ApiPolicy | ApiPrefixe | ApiPrimaryContactType | ApiProductRoadmap | ApiPronoun | ApiPublicationNote | ApiQuestion | ApiQuestionType | ApiReleaseNote | ApiRssFeed | ApiSavedFavoriteList | ApiSavedFavoriteListCompany | ApiShortcut | ApiSocialMedia | ApiSocialMediaType | ApiSpecial | ApiSponsorship | ApiSponsorshipAlsoInterestedIn | ApiSponsorshipLocation | ApiSponsorshipStatuse | ApiSuffixe | ApiTag | ApiTrainingCourse | ApiTrainingLink | ApiTrainingModule | ApiTrainingVideoItem | ApiUpload | ApiUsefulLink | ApiUserAcceptedPolicy | ApiVrLink;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  export * from './generated/api-types';
2
2
  export * from './generated/api-client';
3
3
  export * from './api-response-helpers';
4
+ export * from './auth-helpers';
5
+ export * from './auth-refresh-utils';
package/dist/index.js CHANGED
@@ -2,8 +2,12 @@
2
2
 
3
3
  const apiClient = require("./generated/api-client");
4
4
  const responseHelpers = require("./api-response-helpers");
5
+ const authHelpers = require("./auth-helpers");
6
+ const authRefreshUtils = require("./auth-refresh-utils");
5
7
 
6
8
  module.exports = {
7
9
  ...apiClient,
8
10
  ...responseHelpers,
11
+ ...authHelpers,
12
+ ...authRefreshUtils,
9
13
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embark-black-book/api-contract",
3
- "version": "0.1.0",
3
+ "version": "0.4.0",
4
4
  "description": "Type contract package generated from Blackbook by Embark Strapi OpenAPI",
5
5
  "license": "UNLICENSED",
6
6
  "exports": {