tonightpass 0.0.8 → 0.0.10
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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +99 -13
- package/dist/index.d.ts +99 -13
- package/dist/index.js +40 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/rest/dtos/index.ts +1 -0
- package/src/rest/dtos/organizations/create-organization.dto.ts +67 -0
- package/src/rest/dtos/organizations/index.ts +2 -0
- package/src/rest/dtos/organizations/update-organization.dto.ts +3 -0
- package/src/rest/dtos/users/create-user.dto.ts +1 -1
- package/src/rest/dtos/users/update-user.dto.ts +2 -2
- package/src/rest/endpoints.ts +2 -0
- package/src/rest/types/organizations/index.ts +21 -4
- package/src/rest/types/profiles/index.ts +1 -1
- package/src/sdk/index.ts +4 -0
- package/src/sdk/organizations.ts +12 -0
- package/src/tonightpass.ts +3 -5
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> tonightpass@0.0.
|
|
2
|
+
> tonightpass@0.0.10 build /home/runner/work/tonightpass/tonightpass/packages/node
|
|
3
3
|
> tsup
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
[34mCLI[39m Target: esnext
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
11
|
[34mESM[39m Build start
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
12
|
+
[32mCJS[39m [1mdist/index.js [22m[32m9.22 KB[39m
|
|
13
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m29.73 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 248ms
|
|
15
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m8.06 KB[39m
|
|
16
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m29.73 KB[39m
|
|
17
|
+
[32mESM[39m ⚡️ Build success in 249ms
|
|
18
18
|
[34mDTS[39m Build start
|
|
19
|
-
[32mDTS[39m ⚡️ Build success in
|
|
20
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
21
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[
|
|
19
|
+
[32mDTS[39m ⚡️ Build success in 2609ms
|
|
20
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m22.03 KB[39m
|
|
21
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m22.03 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# tonightpass
|
|
2
2
|
|
|
3
|
+
## 0.0.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#218](https://github.com/tonightpass/tonightpass/pull/218) [`d4d27fb`](https://github.com/tonightpass/tonightpass/commit/d4d27fb683212d88bf4c4650ce33ab376c23f445) Thanks [@AntoineKM](https://github.com/AntoineKM)! - Fix Organization types and dtos
|
|
8
|
+
|
|
9
|
+
## 0.0.9
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`8f8bd1b`](https://github.com/tonightpass/tonightpass/commit/8f8bd1b21c684389c44c7b9ef4be3452061260e1) Thanks [@AntoineKM](https://github.com/AntoineKM)! - Add organizations sdk
|
|
14
|
+
|
|
3
15
|
## 0.0.8
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -31,7 +31,7 @@ type Endpoint<M extends Options["method"], Path extends string, Res, Body = unde
|
|
|
31
31
|
res: Res;
|
|
32
32
|
body: Body;
|
|
33
33
|
};
|
|
34
|
-
type Endpoints = AuthEndpoints | CareersEndpoints | HealthEndpoints | ProfileEndpoints | UserEndpoints;
|
|
34
|
+
type Endpoints = AuthEndpoints | CareersEndpoints | HealthEndpoints | OrganizationEndpoints | ProfileEndpoints | UserEndpoints;
|
|
35
35
|
|
|
36
36
|
type User = {
|
|
37
37
|
id: string;
|
|
@@ -243,14 +243,22 @@ declare enum OrganizationSocialType {
|
|
|
243
243
|
type OrganizationMember = {
|
|
244
244
|
user: User;
|
|
245
245
|
role: OrganizationMemberRole;
|
|
246
|
+
status: OrganizationMemberStatus;
|
|
247
|
+
updatedAt: Date;
|
|
246
248
|
createdAt: Date;
|
|
247
249
|
};
|
|
250
|
+
declare enum OrganizationMemberStatus {
|
|
251
|
+
PENDING = "pending",
|
|
252
|
+
ACCEPTED = "accepted",
|
|
253
|
+
REJECTED = "rejected"
|
|
254
|
+
}
|
|
248
255
|
declare enum OrganizationMemberRole {
|
|
249
|
-
|
|
250
|
-
MANAGER =
|
|
251
|
-
ADMINISTRATOR =
|
|
252
|
-
OWNER =
|
|
256
|
+
MEMBER = "member",
|
|
257
|
+
MANAGER = "manager",
|
|
258
|
+
ADMINISTRATOR = "admin",
|
|
259
|
+
OWNER = "owner"
|
|
253
260
|
}
|
|
261
|
+
type OrganizationEndpoints = Endpoint<"GET", "/organizations", Organization[]> | Endpoint<"GET", "/organizations/:id", Organization> | Endpoint<"POST", "/organizations", Organization, CreateOrganizationDto> | Endpoint<"PUT", "/organizations/:id", Organization, UpdateOrganizationDto> | Endpoint<"DELETE", "/organizations/:id", boolean>;
|
|
254
262
|
|
|
255
263
|
type Event = {
|
|
256
264
|
title: string;
|
|
@@ -376,7 +384,7 @@ interface Profile {
|
|
|
376
384
|
type: "user" | "organization";
|
|
377
385
|
displayName: string;
|
|
378
386
|
description: string;
|
|
379
|
-
|
|
387
|
+
avatarUrl?: string;
|
|
380
388
|
bannerUrl?: string;
|
|
381
389
|
metadata: ProfileMetadata;
|
|
382
390
|
createdAt: Date;
|
|
@@ -410,6 +418,27 @@ declare enum Language {
|
|
|
410
418
|
EN = "en"
|
|
411
419
|
}
|
|
412
420
|
|
|
421
|
+
declare class CreateOrganizationDto {
|
|
422
|
+
slug?: string;
|
|
423
|
+
identity: CreateOrganizationIdentityDto;
|
|
424
|
+
members: OrganizationMemberDto[];
|
|
425
|
+
location?: Location;
|
|
426
|
+
}
|
|
427
|
+
declare class CreateOrganizationIdentityDto {
|
|
428
|
+
displayName: string;
|
|
429
|
+
description: string;
|
|
430
|
+
avatarUrl?: string;
|
|
431
|
+
bannerUrl?: string;
|
|
432
|
+
socialLinks?: OrganizationSocialLink[];
|
|
433
|
+
}
|
|
434
|
+
declare class OrganizationMemberDto {
|
|
435
|
+
user: string;
|
|
436
|
+
role: OrganizationMemberRole;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
declare class UpdateOrganizationDto extends CreateOrganizationDto {
|
|
440
|
+
}
|
|
441
|
+
|
|
413
442
|
declare class CreateUserDto {
|
|
414
443
|
identifier: UserIdentifier;
|
|
415
444
|
password: string;
|
|
@@ -420,7 +449,7 @@ declare class CreateUserIdentituDto {
|
|
|
420
449
|
firstName: string;
|
|
421
450
|
lastName: string;
|
|
422
451
|
gender: UserIdentityGender;
|
|
423
|
-
|
|
452
|
+
avatarUrl?: string;
|
|
424
453
|
birthDate: Date;
|
|
425
454
|
}
|
|
426
455
|
|
|
@@ -439,12 +468,12 @@ declare class UpdateIdentifierDto implements Partial<Pick<UserIdentifier, "email
|
|
|
439
468
|
phoneNumber?: string;
|
|
440
469
|
username?: string;
|
|
441
470
|
}
|
|
442
|
-
declare class UpdateIdentityDto implements Partial<Pick<UserIdentity, "firstName" | "lastName" | "displayName" | "description" | "
|
|
471
|
+
declare class UpdateIdentityDto implements Partial<Pick<UserIdentity, "firstName" | "lastName" | "displayName" | "description" | "avatarUrl" | "bannerUrl" | "gender" | "birthDate">> {
|
|
443
472
|
firstName?: string;
|
|
444
473
|
lastName?: string;
|
|
445
474
|
displayName?: string;
|
|
446
475
|
description?: string;
|
|
447
|
-
|
|
476
|
+
avatarUrl?: string | undefined;
|
|
448
477
|
bannerUrl?: string | undefined;
|
|
449
478
|
gender?: string;
|
|
450
479
|
birthDate?: Date;
|
|
@@ -515,6 +544,12 @@ declare class Client {
|
|
|
515
544
|
}> | Extract<Endpoint<"GET", "/health/http", Health<"app">>, {
|
|
516
545
|
path: Path;
|
|
517
546
|
method: "GET";
|
|
547
|
+
}> | Extract<Endpoint<"GET", "/organizations", Organization[]>, {
|
|
548
|
+
path: Path;
|
|
549
|
+
method: "GET";
|
|
550
|
+
}> | Extract<Endpoint<"GET", "/organizations/:id", Organization>, {
|
|
551
|
+
path: Path;
|
|
552
|
+
method: "GET";
|
|
518
553
|
}> | Extract<ProfileEndpoints, {
|
|
519
554
|
path: Path;
|
|
520
555
|
method: "GET";
|
|
@@ -557,16 +592,22 @@ declare class Client {
|
|
|
557
592
|
}> | Extract<Endpoint<"POST", "/auth/refresh-token", null, null>, {
|
|
558
593
|
path: Path;
|
|
559
594
|
method: "POST";
|
|
595
|
+
}> | Extract<Endpoint<"POST", "/organizations", Organization, CreateOrganizationDto>, {
|
|
596
|
+
path: Path;
|
|
597
|
+
method: "POST";
|
|
560
598
|
}>)["res"]>;
|
|
561
599
|
put<Path extends Extract<Endpoints, {
|
|
562
600
|
method: "PUT";
|
|
563
601
|
}>["path"]>(path: Path, body: Extract<Endpoints, {
|
|
564
602
|
path: Path;
|
|
565
603
|
method: "PUT";
|
|
566
|
-
}>["body"], query?: Query<Path>, options?: APIRequestOptions): Promise<Extract<Endpoint<"PUT", "/
|
|
604
|
+
}>["body"], query?: Query<Path>, options?: APIRequestOptions): Promise<(Extract<Endpoint<"PUT", "/organizations/:id", Organization, UpdateOrganizationDto>, {
|
|
567
605
|
path: Path;
|
|
568
606
|
method: "PUT";
|
|
569
|
-
}>
|
|
607
|
+
}> | Extract<Endpoint<"PUT", "/users/:id", User, UpdateUserDto>, {
|
|
608
|
+
path: Path;
|
|
609
|
+
method: "PUT";
|
|
610
|
+
}>)["res"]>;
|
|
570
611
|
patch<Path extends Extract<Endpoints, {
|
|
571
612
|
method: "PATCH";
|
|
572
613
|
}>["path"]>(path: Path, body: Extract<Endpoints, {
|
|
@@ -575,10 +616,36 @@ declare class Client {
|
|
|
575
616
|
}>["body"], query?: Query<Path>, options?: APIRequestOptions): Promise<never>;
|
|
576
617
|
delete<Path extends Extract<Endpoints, {
|
|
577
618
|
method: "DELETE";
|
|
578
|
-
}>["path"]>(path: Path, query?: Query<Path>, options?: APIRequestOptions): Promise<
|
|
619
|
+
}>["path"]>(path: Path, query?: Query<Path>, options?: APIRequestOptions): Promise<Extract<Endpoint<"DELETE", "/organizations/:id", boolean>, {
|
|
620
|
+
path: Path;
|
|
621
|
+
method: "DELETE";
|
|
622
|
+
}>["res"]>;
|
|
579
623
|
private requester;
|
|
580
624
|
}
|
|
581
625
|
|
|
626
|
+
declare const auth: (client: Client) => {
|
|
627
|
+
signIn: (data: SignInUserDto) => Promise<User>;
|
|
628
|
+
signUp: (data: CreateUserDto) => Promise<User>;
|
|
629
|
+
signOut: () => Promise<null>;
|
|
630
|
+
refreshToken: () => Promise<null>;
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
declare const careers: (client: Client) => {
|
|
634
|
+
categories: {
|
|
635
|
+
getAll: (query?: Query<"/careers/categories">) => Promise<CareersCategory[]>;
|
|
636
|
+
};
|
|
637
|
+
employmentTypes: {
|
|
638
|
+
getAll: (query?: Query<"/careers/employmentTypes">) => Promise<CareersEmploymentType[]>;
|
|
639
|
+
};
|
|
640
|
+
jobs: {
|
|
641
|
+
getAll: (query?: Query<"/careers/jobs">) => Promise<CareersJob[]>;
|
|
642
|
+
get: (id: number) => Promise<CareersJob>;
|
|
643
|
+
};
|
|
644
|
+
offices: {
|
|
645
|
+
getAll: (query?: Query<"/careers/offices">) => Promise<CareersOffice[]>;
|
|
646
|
+
};
|
|
647
|
+
};
|
|
648
|
+
|
|
582
649
|
declare function sdk<T>(builder: (client: Client) => T): (client: Client) => T;
|
|
583
650
|
|
|
584
651
|
declare const health: (client: Client) => {
|
|
@@ -586,6 +653,18 @@ declare const health: (client: Client) => {
|
|
|
586
653
|
http: () => Promise<Health<"app">>;
|
|
587
654
|
};
|
|
588
655
|
|
|
656
|
+
declare const organizations: (client: Client) => {
|
|
657
|
+
getAll: () => Promise<Organization[]>;
|
|
658
|
+
get: (id: string) => Promise<Organization>;
|
|
659
|
+
create: (data: CreateOrganizationDto) => Promise<Organization>;
|
|
660
|
+
update: (id: string, data: UpdateOrganizationDto) => Promise<Organization>;
|
|
661
|
+
delete: (id: string) => Promise<boolean>;
|
|
662
|
+
};
|
|
663
|
+
|
|
664
|
+
declare const profiles: (client: Client) => {
|
|
665
|
+
get: (username: string) => Promise<UserIdentity>;
|
|
666
|
+
};
|
|
667
|
+
|
|
589
668
|
declare const users: (client: Client) => {
|
|
590
669
|
getAll: () => Promise<User[]>;
|
|
591
670
|
get: (id: string) => Promise<User[]>;
|
|
@@ -625,6 +704,13 @@ declare class TonightPass {
|
|
|
625
704
|
database: () => Promise<Health<"database">>;
|
|
626
705
|
http: () => Promise<Health<"app">>;
|
|
627
706
|
};
|
|
707
|
+
readonly organizations: {
|
|
708
|
+
getAll: () => Promise<Organization[]>;
|
|
709
|
+
get: (id: string) => Promise<Organization>;
|
|
710
|
+
create: (data: CreateOrganizationDto) => Promise<Organization>;
|
|
711
|
+
update: (id: string, data: UpdateOrganizationDto) => Promise<Organization>;
|
|
712
|
+
delete: (id: string) => Promise<boolean>;
|
|
713
|
+
};
|
|
628
714
|
readonly profiles: {
|
|
629
715
|
get: (username: string) => Promise<UserIdentity>;
|
|
630
716
|
};
|
|
@@ -644,4 +730,4 @@ declare class TonightPass {
|
|
|
644
730
|
|
|
645
731
|
declare const isBrowser: boolean;
|
|
646
732
|
|
|
647
|
-
export { type APIRequestOptions, type APIResponse, type AuthEndpoints, BCRYPT_HASH, type CareersCategory, type CareersEmploymentType, type CareersEndpoints, type CareersJob, type CareersOffice, Client, type ClientOptions, CreateUserDto, Currency, DEFAULT_API_URL, EMAIL_REGEX, type Endpoint, type Endpoints, type ErroredAPIResponse, type Event, type EventStyle, EventStyleType, type EventTicket, EventTicketCategory, type EventTicketType, EventType, type Health, type HealthEndpoints, IMAGE_URL_REGEX, Language, type Location, NAME_REGEX, type Order, type OrderItem, OrderStatus, type Organization, type OrganizationIdentity, type OrganizationMember, OrganizationMemberRole, type OrganizationSocialLink, OrganizationSocialType, PASSWORD_REGEX, PHONE_NUMBER_REGEX, type PathsFor, type Profile, type ProfileEndpoints, type ProfileMetadata, type PromoCode, SLUG_REGEX, SignInUserDto, type SuccessfulAPIResponse, TonightPass, TonightPassAPIError, UpdateUserDto, type User, type UserConnection, type UserConnectionClient, type UserConnectionDevice, type UserConnectionOS, type UserEndpoints, type UserIdentifier, type UserIdentity, type UserIdentityGender, type UserPreferences, UserRole, type UserToken, UserTokenType, health, isBrowser, request, sdk, users };
|
|
733
|
+
export { type APIRequestOptions, type APIResponse, type AuthEndpoints, BCRYPT_HASH, type CareersCategory, type CareersEmploymentType, type CareersEndpoints, type CareersJob, type CareersOffice, Client, type ClientOptions, CreateOrganizationDto, CreateUserDto, Currency, DEFAULT_API_URL, EMAIL_REGEX, type Endpoint, type Endpoints, type ErroredAPIResponse, type Event, type EventStyle, EventStyleType, type EventTicket, EventTicketCategory, type EventTicketType, EventType, type Health, type HealthEndpoints, IMAGE_URL_REGEX, Language, type Location, NAME_REGEX, type Order, type OrderItem, OrderStatus, type Organization, type OrganizationEndpoints, type OrganizationIdentity, type OrganizationMember, OrganizationMemberRole, OrganizationMemberStatus, type OrganizationSocialLink, OrganizationSocialType, PASSWORD_REGEX, PHONE_NUMBER_REGEX, type PathsFor, type Profile, type ProfileEndpoints, type ProfileMetadata, type PromoCode, SLUG_REGEX, SignInUserDto, type SuccessfulAPIResponse, TonightPass, TonightPassAPIError, UpdateOrganizationDto, UpdateUserDto, type User, type UserConnection, type UserConnectionClient, type UserConnectionDevice, type UserConnectionOS, type UserEndpoints, type UserIdentifier, type UserIdentity, type UserIdentityGender, type UserPreferences, UserRole, type UserToken, UserTokenType, auth, careers, health, isBrowser, organizations, profiles, request, sdk, users };
|
package/dist/index.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ type Endpoint<M extends Options["method"], Path extends string, Res, Body = unde
|
|
|
31
31
|
res: Res;
|
|
32
32
|
body: Body;
|
|
33
33
|
};
|
|
34
|
-
type Endpoints = AuthEndpoints | CareersEndpoints | HealthEndpoints | ProfileEndpoints | UserEndpoints;
|
|
34
|
+
type Endpoints = AuthEndpoints | CareersEndpoints | HealthEndpoints | OrganizationEndpoints | ProfileEndpoints | UserEndpoints;
|
|
35
35
|
|
|
36
36
|
type User = {
|
|
37
37
|
id: string;
|
|
@@ -243,14 +243,22 @@ declare enum OrganizationSocialType {
|
|
|
243
243
|
type OrganizationMember = {
|
|
244
244
|
user: User;
|
|
245
245
|
role: OrganizationMemberRole;
|
|
246
|
+
status: OrganizationMemberStatus;
|
|
247
|
+
updatedAt: Date;
|
|
246
248
|
createdAt: Date;
|
|
247
249
|
};
|
|
250
|
+
declare enum OrganizationMemberStatus {
|
|
251
|
+
PENDING = "pending",
|
|
252
|
+
ACCEPTED = "accepted",
|
|
253
|
+
REJECTED = "rejected"
|
|
254
|
+
}
|
|
248
255
|
declare enum OrganizationMemberRole {
|
|
249
|
-
|
|
250
|
-
MANAGER =
|
|
251
|
-
ADMINISTRATOR =
|
|
252
|
-
OWNER =
|
|
256
|
+
MEMBER = "member",
|
|
257
|
+
MANAGER = "manager",
|
|
258
|
+
ADMINISTRATOR = "admin",
|
|
259
|
+
OWNER = "owner"
|
|
253
260
|
}
|
|
261
|
+
type OrganizationEndpoints = Endpoint<"GET", "/organizations", Organization[]> | Endpoint<"GET", "/organizations/:id", Organization> | Endpoint<"POST", "/organizations", Organization, CreateOrganizationDto> | Endpoint<"PUT", "/organizations/:id", Organization, UpdateOrganizationDto> | Endpoint<"DELETE", "/organizations/:id", boolean>;
|
|
254
262
|
|
|
255
263
|
type Event = {
|
|
256
264
|
title: string;
|
|
@@ -376,7 +384,7 @@ interface Profile {
|
|
|
376
384
|
type: "user" | "organization";
|
|
377
385
|
displayName: string;
|
|
378
386
|
description: string;
|
|
379
|
-
|
|
387
|
+
avatarUrl?: string;
|
|
380
388
|
bannerUrl?: string;
|
|
381
389
|
metadata: ProfileMetadata;
|
|
382
390
|
createdAt: Date;
|
|
@@ -410,6 +418,27 @@ declare enum Language {
|
|
|
410
418
|
EN = "en"
|
|
411
419
|
}
|
|
412
420
|
|
|
421
|
+
declare class CreateOrganizationDto {
|
|
422
|
+
slug?: string;
|
|
423
|
+
identity: CreateOrganizationIdentityDto;
|
|
424
|
+
members: OrganizationMemberDto[];
|
|
425
|
+
location?: Location;
|
|
426
|
+
}
|
|
427
|
+
declare class CreateOrganizationIdentityDto {
|
|
428
|
+
displayName: string;
|
|
429
|
+
description: string;
|
|
430
|
+
avatarUrl?: string;
|
|
431
|
+
bannerUrl?: string;
|
|
432
|
+
socialLinks?: OrganizationSocialLink[];
|
|
433
|
+
}
|
|
434
|
+
declare class OrganizationMemberDto {
|
|
435
|
+
user: string;
|
|
436
|
+
role: OrganizationMemberRole;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
declare class UpdateOrganizationDto extends CreateOrganizationDto {
|
|
440
|
+
}
|
|
441
|
+
|
|
413
442
|
declare class CreateUserDto {
|
|
414
443
|
identifier: UserIdentifier;
|
|
415
444
|
password: string;
|
|
@@ -420,7 +449,7 @@ declare class CreateUserIdentituDto {
|
|
|
420
449
|
firstName: string;
|
|
421
450
|
lastName: string;
|
|
422
451
|
gender: UserIdentityGender;
|
|
423
|
-
|
|
452
|
+
avatarUrl?: string;
|
|
424
453
|
birthDate: Date;
|
|
425
454
|
}
|
|
426
455
|
|
|
@@ -439,12 +468,12 @@ declare class UpdateIdentifierDto implements Partial<Pick<UserIdentifier, "email
|
|
|
439
468
|
phoneNumber?: string;
|
|
440
469
|
username?: string;
|
|
441
470
|
}
|
|
442
|
-
declare class UpdateIdentityDto implements Partial<Pick<UserIdentity, "firstName" | "lastName" | "displayName" | "description" | "
|
|
471
|
+
declare class UpdateIdentityDto implements Partial<Pick<UserIdentity, "firstName" | "lastName" | "displayName" | "description" | "avatarUrl" | "bannerUrl" | "gender" | "birthDate">> {
|
|
443
472
|
firstName?: string;
|
|
444
473
|
lastName?: string;
|
|
445
474
|
displayName?: string;
|
|
446
475
|
description?: string;
|
|
447
|
-
|
|
476
|
+
avatarUrl?: string | undefined;
|
|
448
477
|
bannerUrl?: string | undefined;
|
|
449
478
|
gender?: string;
|
|
450
479
|
birthDate?: Date;
|
|
@@ -515,6 +544,12 @@ declare class Client {
|
|
|
515
544
|
}> | Extract<Endpoint<"GET", "/health/http", Health<"app">>, {
|
|
516
545
|
path: Path;
|
|
517
546
|
method: "GET";
|
|
547
|
+
}> | Extract<Endpoint<"GET", "/organizations", Organization[]>, {
|
|
548
|
+
path: Path;
|
|
549
|
+
method: "GET";
|
|
550
|
+
}> | Extract<Endpoint<"GET", "/organizations/:id", Organization>, {
|
|
551
|
+
path: Path;
|
|
552
|
+
method: "GET";
|
|
518
553
|
}> | Extract<ProfileEndpoints, {
|
|
519
554
|
path: Path;
|
|
520
555
|
method: "GET";
|
|
@@ -557,16 +592,22 @@ declare class Client {
|
|
|
557
592
|
}> | Extract<Endpoint<"POST", "/auth/refresh-token", null, null>, {
|
|
558
593
|
path: Path;
|
|
559
594
|
method: "POST";
|
|
595
|
+
}> | Extract<Endpoint<"POST", "/organizations", Organization, CreateOrganizationDto>, {
|
|
596
|
+
path: Path;
|
|
597
|
+
method: "POST";
|
|
560
598
|
}>)["res"]>;
|
|
561
599
|
put<Path extends Extract<Endpoints, {
|
|
562
600
|
method: "PUT";
|
|
563
601
|
}>["path"]>(path: Path, body: Extract<Endpoints, {
|
|
564
602
|
path: Path;
|
|
565
603
|
method: "PUT";
|
|
566
|
-
}>["body"], query?: Query<Path>, options?: APIRequestOptions): Promise<Extract<Endpoint<"PUT", "/
|
|
604
|
+
}>["body"], query?: Query<Path>, options?: APIRequestOptions): Promise<(Extract<Endpoint<"PUT", "/organizations/:id", Organization, UpdateOrganizationDto>, {
|
|
567
605
|
path: Path;
|
|
568
606
|
method: "PUT";
|
|
569
|
-
}>
|
|
607
|
+
}> | Extract<Endpoint<"PUT", "/users/:id", User, UpdateUserDto>, {
|
|
608
|
+
path: Path;
|
|
609
|
+
method: "PUT";
|
|
610
|
+
}>)["res"]>;
|
|
570
611
|
patch<Path extends Extract<Endpoints, {
|
|
571
612
|
method: "PATCH";
|
|
572
613
|
}>["path"]>(path: Path, body: Extract<Endpoints, {
|
|
@@ -575,10 +616,36 @@ declare class Client {
|
|
|
575
616
|
}>["body"], query?: Query<Path>, options?: APIRequestOptions): Promise<never>;
|
|
576
617
|
delete<Path extends Extract<Endpoints, {
|
|
577
618
|
method: "DELETE";
|
|
578
|
-
}>["path"]>(path: Path, query?: Query<Path>, options?: APIRequestOptions): Promise<
|
|
619
|
+
}>["path"]>(path: Path, query?: Query<Path>, options?: APIRequestOptions): Promise<Extract<Endpoint<"DELETE", "/organizations/:id", boolean>, {
|
|
620
|
+
path: Path;
|
|
621
|
+
method: "DELETE";
|
|
622
|
+
}>["res"]>;
|
|
579
623
|
private requester;
|
|
580
624
|
}
|
|
581
625
|
|
|
626
|
+
declare const auth: (client: Client) => {
|
|
627
|
+
signIn: (data: SignInUserDto) => Promise<User>;
|
|
628
|
+
signUp: (data: CreateUserDto) => Promise<User>;
|
|
629
|
+
signOut: () => Promise<null>;
|
|
630
|
+
refreshToken: () => Promise<null>;
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
declare const careers: (client: Client) => {
|
|
634
|
+
categories: {
|
|
635
|
+
getAll: (query?: Query<"/careers/categories">) => Promise<CareersCategory[]>;
|
|
636
|
+
};
|
|
637
|
+
employmentTypes: {
|
|
638
|
+
getAll: (query?: Query<"/careers/employmentTypes">) => Promise<CareersEmploymentType[]>;
|
|
639
|
+
};
|
|
640
|
+
jobs: {
|
|
641
|
+
getAll: (query?: Query<"/careers/jobs">) => Promise<CareersJob[]>;
|
|
642
|
+
get: (id: number) => Promise<CareersJob>;
|
|
643
|
+
};
|
|
644
|
+
offices: {
|
|
645
|
+
getAll: (query?: Query<"/careers/offices">) => Promise<CareersOffice[]>;
|
|
646
|
+
};
|
|
647
|
+
};
|
|
648
|
+
|
|
582
649
|
declare function sdk<T>(builder: (client: Client) => T): (client: Client) => T;
|
|
583
650
|
|
|
584
651
|
declare const health: (client: Client) => {
|
|
@@ -586,6 +653,18 @@ declare const health: (client: Client) => {
|
|
|
586
653
|
http: () => Promise<Health<"app">>;
|
|
587
654
|
};
|
|
588
655
|
|
|
656
|
+
declare const organizations: (client: Client) => {
|
|
657
|
+
getAll: () => Promise<Organization[]>;
|
|
658
|
+
get: (id: string) => Promise<Organization>;
|
|
659
|
+
create: (data: CreateOrganizationDto) => Promise<Organization>;
|
|
660
|
+
update: (id: string, data: UpdateOrganizationDto) => Promise<Organization>;
|
|
661
|
+
delete: (id: string) => Promise<boolean>;
|
|
662
|
+
};
|
|
663
|
+
|
|
664
|
+
declare const profiles: (client: Client) => {
|
|
665
|
+
get: (username: string) => Promise<UserIdentity>;
|
|
666
|
+
};
|
|
667
|
+
|
|
589
668
|
declare const users: (client: Client) => {
|
|
590
669
|
getAll: () => Promise<User[]>;
|
|
591
670
|
get: (id: string) => Promise<User[]>;
|
|
@@ -625,6 +704,13 @@ declare class TonightPass {
|
|
|
625
704
|
database: () => Promise<Health<"database">>;
|
|
626
705
|
http: () => Promise<Health<"app">>;
|
|
627
706
|
};
|
|
707
|
+
readonly organizations: {
|
|
708
|
+
getAll: () => Promise<Organization[]>;
|
|
709
|
+
get: (id: string) => Promise<Organization>;
|
|
710
|
+
create: (data: CreateOrganizationDto) => Promise<Organization>;
|
|
711
|
+
update: (id: string, data: UpdateOrganizationDto) => Promise<Organization>;
|
|
712
|
+
delete: (id: string) => Promise<boolean>;
|
|
713
|
+
};
|
|
628
714
|
readonly profiles: {
|
|
629
715
|
get: (username: string) => Promise<UserIdentity>;
|
|
630
716
|
};
|
|
@@ -644,4 +730,4 @@ declare class TonightPass {
|
|
|
644
730
|
|
|
645
731
|
declare const isBrowser: boolean;
|
|
646
732
|
|
|
647
|
-
export { type APIRequestOptions, type APIResponse, type AuthEndpoints, BCRYPT_HASH, type CareersCategory, type CareersEmploymentType, type CareersEndpoints, type CareersJob, type CareersOffice, Client, type ClientOptions, CreateUserDto, Currency, DEFAULT_API_URL, EMAIL_REGEX, type Endpoint, type Endpoints, type ErroredAPIResponse, type Event, type EventStyle, EventStyleType, type EventTicket, EventTicketCategory, type EventTicketType, EventType, type Health, type HealthEndpoints, IMAGE_URL_REGEX, Language, type Location, NAME_REGEX, type Order, type OrderItem, OrderStatus, type Organization, type OrganizationIdentity, type OrganizationMember, OrganizationMemberRole, type OrganizationSocialLink, OrganizationSocialType, PASSWORD_REGEX, PHONE_NUMBER_REGEX, type PathsFor, type Profile, type ProfileEndpoints, type ProfileMetadata, type PromoCode, SLUG_REGEX, SignInUserDto, type SuccessfulAPIResponse, TonightPass, TonightPassAPIError, UpdateUserDto, type User, type UserConnection, type UserConnectionClient, type UserConnectionDevice, type UserConnectionOS, type UserEndpoints, type UserIdentifier, type UserIdentity, type UserIdentityGender, type UserPreferences, UserRole, type UserToken, UserTokenType, health, isBrowser, request, sdk, users };
|
|
733
|
+
export { type APIRequestOptions, type APIResponse, type AuthEndpoints, BCRYPT_HASH, type CareersCategory, type CareersEmploymentType, type CareersEndpoints, type CareersJob, type CareersOffice, Client, type ClientOptions, CreateOrganizationDto, CreateUserDto, Currency, DEFAULT_API_URL, EMAIL_REGEX, type Endpoint, type Endpoints, type ErroredAPIResponse, type Event, type EventStyle, EventStyleType, type EventTicket, EventTicketCategory, type EventTicketType, EventType, type Health, type HealthEndpoints, IMAGE_URL_REGEX, Language, type Location, NAME_REGEX, type Order, type OrderItem, OrderStatus, type Organization, type OrganizationEndpoints, type OrganizationIdentity, type OrganizationMember, OrganizationMemberRole, OrganizationMemberStatus, type OrganizationSocialLink, OrganizationSocialType, PASSWORD_REGEX, PHONE_NUMBER_REGEX, type PathsFor, type Profile, type ProfileEndpoints, type ProfileMetadata, type PromoCode, SLUG_REGEX, SignInUserDto, type SuccessfulAPIResponse, TonightPass, TonightPassAPIError, UpdateOrganizationDto, UpdateUserDto, type User, type UserConnection, type UserConnectionClient, type UserConnectionDevice, type UserConnectionOS, type UserEndpoints, type UserIdentifier, type UserIdentity, type UserIdentityGender, type UserPreferences, UserRole, type UserToken, UserTokenType, auth, careers, health, isBrowser, organizations, profiles, request, sdk, users };
|
package/dist/index.js
CHANGED
|
@@ -1,45 +1,52 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('reflect-metadata');
|
|
4
|
-
var classTransformer = require('class-transformer');
|
|
5
4
|
var classValidator = require('class-validator');
|
|
6
|
-
var
|
|
5
|
+
var classTransformer = require('class-transformer');
|
|
6
|
+
var he = require('redaxios');
|
|
7
7
|
var pathcat = require('pathcat');
|
|
8
8
|
|
|
9
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var he__default = /*#__PURE__*/_interopDefault(he);
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var Z=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var n=(t,e,o,r)=>{for(var s=r>1?void 0:r?J(e,o):e,a=t.length-1,m;a>=0;a--)(m=t[a])&&(s=(r?m(e,o,s):m(s))||s);return r&&s&&Z(e,o,s),s};var k="https://api.tonightpass.com";var be=/^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$/,Ae=/((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/,I=/(^[\p{L}\d'\\.\s\\-]*$)/u,Re=/^[a-z\d]+(?:(\.|-|_)[a-z\d]+)*$/,Ue=/\$2[abxy]?\$\d{1,2}\$[A-Za-z\d\\./]{53}/,Ie=/^\s*(?:\+?(\d{1,3}))?([-. (]*(\d{3})[-. )]*)?((\d{3})[-. ]*(\d{2,4})(?:[-.x ]*(\d+))?)\s*$/,Oe=/(((http:\/\/www)|(http:\/\/)|(www))[-a-zA-Z0-9@:%_\\+.~#?&//=]+)\.(jpg|jpeg|gif|png|bmp|tiff|tga|svg)/i;var ee=(c=>(c.ENTRY="entry",c.PACKAGE="package",c.MEAL="meal",c.DRINK="drink",c.PARKING="parking",c.ACCOMMODATION="accommodation",c.CAMPING="camping",c.LOCKER="locker",c.SHUTTLE="shuttle",c.OTHER="other",c))(ee||{});var te=(i=>(i.Clubbing="clubbing",i.Concert="concert",i.Afterwork="afterwork",i.DancingLunch="dancing_lunch",i.Diner="diner",i.Garden="garden",i.AfterBeach="after_beach",i.Festival="festival",i.Spectacle="spectacle",i.Cruise="cruise",i.OutsideAnimation="outside_animation",i.Sport="sport",i.Match="match",i.Seminar="seminar",i.Conference="conference",i.WellnessDay="wellness_day",i.Workshop="workshop",i.TradeFair="trade_fair",i.ConsumerShow="consumer_show",i.Membership="membership",i))(te||{}),re=(a=>(a.Music="music",a.Dress="dress",a.Sport="sport",a.Food="food",a.Art="art",a))(re||{});var oe=(m=>(m.Facebook="facebook",m.Twitter="twitter",m.Instagram="instagram",m.Linkedin="linkedin",m.Youtube="youtube",m.Website="website",m))(oe||{}),ne=(r=>(r.PENDING="pending",r.ACCEPTED="accepted",r.REJECTED="rejected",r))(ne||{}),O=(s=>(s.MEMBER="member",s.MANAGER="manager",s.ADMINISTRATOR="admin",s.OWNER="owner",s))(O||{});var se=(a=>(a.Authentication="authentication",a.OrganizationInvite="organization_invite",a.PasswordRecovery="password_recovery",a.EmailValidation="email_validation",a.PhoneValidation="phone_validation",a))(se||{});var ie=(r=>(r[r.USER=0]="USER",r[r.DEVELOPER=8]="DEVELOPER",r[r.ADMINISTRATOR=10]="ADMINISTRATOR",r))(ie||{});var ae=(l=>(l.Created="created",l.Cancelled="cancelled",l.Completed="completed",l.Pending="pending",l.Confirmed="confirmed",l.Declined="declined",l.Refunded="refunded",l.PartiallyRefunded="partially_refunded",l.Expired="expired",l))(ae||{});var pe=(r=>(r.EUR="EUR",r.USD="USD",r.GBP="GBP",r))(pe||{}),me=(o=>(o.FR="fr",o.EN="en",o))(me||{});var u=class{slug;identity;members;location};n([classValidator.IsString(),classValidator.Length(1,128)],u.prototype,"slug",2),n([classValidator.IsObject()],u.prototype,"identity",2),n([classValidator.IsArray(),classValidator.ArrayMinSize(1)],u.prototype,"members",2),n([classValidator.IsObject()],u.prototype,"location",2);var f=class{displayName;description;avatarUrl;bannerUrl;socialLinks};n([classValidator.IsString(),classValidator.IsNotEmpty(),classValidator.Length(1,32)],f.prototype,"displayName",2),n([classValidator.IsString(),classValidator.IsNotEmpty(),classValidator.Length(16,1024)],f.prototype,"description",2),n([classValidator.IsUrl({protocols:["http","https"]})],f.prototype,"avatarUrl",2),n([classValidator.IsUrl({protocols:["http","https"]})],f.prototype,"bannerUrl",2),n([classValidator.IsArray()],f.prototype,"socialLinks",2);var y=class{user;role};n([classValidator.IsString(),classValidator.IsNotEmpty()],y.prototype,"user",2),n([classValidator.IsEnum(O),classValidator.IsNotEmpty()],y.prototype,"role",2);var T=class extends u{};var _=class{identifier;password;identity;addresses};var M=class{identifier;password};var E=class{identifier;identity;password};n([classValidator.IsOptional(),classValidator.IsObject(),classValidator.ValidateNested(),classTransformer.Type(()=>h)],E.prototype,"identifier",2),n([classValidator.IsOptional(),classValidator.IsObject(),classValidator.ValidateNested(),classTransformer.Type(()=>d)],E.prototype,"identity",2),n([classValidator.IsOptional(),classValidator.IsString(),classValidator.MinLength(6),classValidator.MaxLength(130)],E.prototype,"password",2);var h=class{email;phoneNumber;username};n([classValidator.IsOptional(),classValidator.IsString(),classValidator.IsEmail()],h.prototype,"email",2),n([classValidator.IsOptional(),classValidator.IsString(),classValidator.IsPhoneNumber()],h.prototype,"phoneNumber",2),n([classValidator.IsOptional(),classValidator.IsString(),classValidator.MinLength(3)],h.prototype,"username",2);var d=class{firstName;lastName;displayName;description;avatarUrl;bannerUrl;gender;birthDate};n([classValidator.IsOptional(),classValidator.IsString(),classValidator.Length(2,50),classValidator.Matches(I,{message:"First name must be composed of letters only"})],d.prototype,"firstName",2),n([classValidator.IsOptional(),classValidator.IsString(),classValidator.Length(2,50),classValidator.Matches(I,{message:"Last name must be composed of letters only"})],d.prototype,"lastName",2),n([classValidator.IsOptional(),classValidator.IsString(),classValidator.Length(1,32)],d.prototype,"displayName",2),n([classValidator.IsOptional(),classValidator.IsString(),classValidator.Length(15,500)],d.prototype,"description",2),n([classValidator.IsOptional(),classValidator.IsUrl()],d.prototype,"avatarUrl",2),n([classValidator.IsOptional(),classValidator.IsUrl()],d.prototype,"bannerUrl",2),n([classValidator.IsOptional()],d.prototype,"gender",2),n([classValidator.IsOptional(),classValidator.IsDateString()],d.prototype,"birthDate",2);var D=typeof window<"u";var xe=he__default.default.create({headers:{"Content-Type":"application/json",Accept:"application/json",...!D&&{"User-Agent":"tonightpass-api-client"}},responseType:"json",transformRequest:[function(t){return JSON.stringify(t)}],withCredentials:D}),H=async(t,e)=>xe(t,{...e}).then(r=>r).catch(r=>{throw r.data});var C=class extends Error{constructor(o,r){super(r.message);this.response=o;this.data=r;this.status=o.status;}status},R=class{options;url;constructor(e){this.options=e,this.url=(o,r)=>{let s=this.options.baseURL||k;return pathcat.pathcat(s,o,r)};}setOptions(e){this.options=e;}async get(e,o,r){return this.requester("GET",e,void 0,o,r)}async post(e,o,r,s){return this.requester("POST",e,o,r,s)}async put(e,o,r,s){return this.requester("PUT",e,o,r,s)}async patch(e,o,r,s){return this.requester("PATCH",e,o,r,s)}async delete(e,o,r){return this.requester("DELETE",e,void 0,o,r)}async requester(e,o,r,s={},a={}){let m=this.url(o,s);if(r!==void 0&&e==="GET")throw new Error("Cannot send a GET request with a body");let w=await H(m,{method:e,data:r,...a}),U=w.data;if(!U.success)throw new C(w,U);return U.data}};function x(t){return t}var B=t=>({signIn:async e=>t.post("/auth/sign-in",e),signUp:async e=>t.post("/auth/sign-up",e),signOut:async()=>t.post("/auth/sign-out",null),refreshToken:async()=>t.post("/auth/refresh-token",null)});var V=t=>({categories:{getAll:async e=>t.get("/careers/categories",e)},employmentTypes:{getAll:async e=>t.get("/careers/employmentTypes",e)},jobs:{getAll:async e=>t.get("/careers/jobs",e),get:async e=>t.get("/careers/jobs/:id",{id:e})},offices:{getAll:async e=>t.get("/careers/offices",e)}});var $=t=>({database:async()=>t.get("/health/database"),http:async()=>t.get("/health/http")});var X=t=>({getAll:async()=>t.get("/organizations"),get:async e=>t.get("/organizations/:id",{id:e}),create:async e=>t.post("/organizations",e),update:async(e,o)=>t.put("/organizations/:id",o,{id:e}),delete:async e=>t.delete("/organizations/:id",{id:e})});var W=t=>({get:async e=>t.get("/profiles/:username",{username:e})});var K=t=>({getAll:async()=>t.get("/users"),get:async e=>t.get("/users",{id:e}),me:async()=>t.get("/users/me"),check:async(e,o)=>t.get("/users/check/:identifier",{identifier:e,suggestions:o}),update:async(e,o)=>t.put("/users/:id",o,{id:e})});var Y=class{client;auth;careers;health;organizations;profiles;users;constructor(e){this.client=new R(e),this.auth=B(this.client),this.careers=V(this.client),this.health=$(this.client),this.organizations=X(this.client),this.profiles=W(this.client),this.users=K(this.client);}};
|
|
14
14
|
|
|
15
|
-
exports.BCRYPT_HASH =
|
|
16
|
-
exports.Client =
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
19
|
-
exports.
|
|
20
|
-
exports.
|
|
21
|
-
exports.
|
|
22
|
-
exports.
|
|
23
|
-
exports.
|
|
24
|
-
exports.
|
|
25
|
-
exports.
|
|
26
|
-
exports.
|
|
27
|
-
exports.
|
|
28
|
-
exports.
|
|
29
|
-
exports.
|
|
30
|
-
exports.
|
|
31
|
-
exports.
|
|
32
|
-
exports.
|
|
33
|
-
exports.
|
|
34
|
-
exports.
|
|
35
|
-
exports.
|
|
36
|
-
exports.
|
|
37
|
-
exports.
|
|
38
|
-
exports.
|
|
39
|
-
exports.
|
|
40
|
-
exports.
|
|
41
|
-
exports.
|
|
42
|
-
exports.
|
|
43
|
-
exports.
|
|
15
|
+
exports.BCRYPT_HASH = Ue;
|
|
16
|
+
exports.Client = R;
|
|
17
|
+
exports.CreateOrganizationDto = u;
|
|
18
|
+
exports.CreateUserDto = _;
|
|
19
|
+
exports.Currency = pe;
|
|
20
|
+
exports.DEFAULT_API_URL = k;
|
|
21
|
+
exports.EMAIL_REGEX = be;
|
|
22
|
+
exports.EventStyleType = re;
|
|
23
|
+
exports.EventTicketCategory = ee;
|
|
24
|
+
exports.EventType = te;
|
|
25
|
+
exports.IMAGE_URL_REGEX = Oe;
|
|
26
|
+
exports.Language = me;
|
|
27
|
+
exports.NAME_REGEX = I;
|
|
28
|
+
exports.OrderStatus = ae;
|
|
29
|
+
exports.OrganizationMemberRole = O;
|
|
30
|
+
exports.OrganizationMemberStatus = ne;
|
|
31
|
+
exports.OrganizationSocialType = oe;
|
|
32
|
+
exports.PASSWORD_REGEX = Ae;
|
|
33
|
+
exports.PHONE_NUMBER_REGEX = Ie;
|
|
34
|
+
exports.SLUG_REGEX = Re;
|
|
35
|
+
exports.SignInUserDto = M;
|
|
36
|
+
exports.TonightPass = Y;
|
|
37
|
+
exports.TonightPassAPIError = C;
|
|
38
|
+
exports.UpdateOrganizationDto = T;
|
|
39
|
+
exports.UpdateUserDto = E;
|
|
40
|
+
exports.UserRole = ie;
|
|
41
|
+
exports.UserTokenType = se;
|
|
42
|
+
exports.auth = B;
|
|
43
|
+
exports.careers = V;
|
|
44
|
+
exports.health = $;
|
|
45
|
+
exports.isBrowser = D;
|
|
46
|
+
exports.organizations = X;
|
|
47
|
+
exports.profiles = W;
|
|
48
|
+
exports.request = H;
|
|
49
|
+
exports.sdk = x;
|
|
50
|
+
exports.users = K;
|
|
44
51
|
//# sourceMappingURL=out.js.map
|
|
45
52
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/constants/api.ts","../src/constants/regex.ts","../src/rest/dtos/index.ts","../src/rest/dtos/users/create-user.dto.ts","../src/rest/dtos/users/sign-in-user.dto.ts","../src/rest/dtos/users/update-user.dto.ts","../src/rest/request/request.ts","../src/utils/index.ts","../src/rest/types/event/ticket/index.ts","../src/rest/types/event/index.ts","../src/rest/types/organizations/index.ts","../src/rest/types/token/index.ts","../src/rest/types/users/index.ts","../src/rest/types/order/index.ts","../src/rest/types/index.ts","../src/rest/client.ts","../src/sdk/builder.ts","../src/sdk/health.ts","../src/sdk/users.ts","../src/sdk/auth.ts","../src/sdk/careers.ts","../src/sdk/profiles.ts","../src/tonightpass.ts"],"names":["DEFAULT_API_URL","EMAIL_REGEX","PASSWORD_REGEX","NAME_REGEX","SLUG_REGEX","BCRYPT_HASH","PHONE_NUMBER_REGEX","IMAGE_URL_REGEX","CreateUserDto","SignInUserDto","Type","IsDateString","IsEmail","IsObject","IsOptional","IsPhoneNumber","IsString","IsUrl","Length","Matches","MaxLength","MinLength","ValidateNested","UpdateUserDto","__decorateClass","UpdateIdentifierDto","UpdateIdentityDto","axios","isBrowser","instance","data","request","url","options","response","error","EventTicketCategory","EventType","EventStyleType","OrganizationSocialType","OrganizationMemberRole","UserTokenType","UserRole","OrderStatus","Currency","Language","pathcat","TonightPassAPIError","Client","path","params","baseURL","query","body","method","result","sdk","builder","health","client","users","id","identifier","suggestions","auth","careers","profiles","username","TonightPass"],"mappings":"wMAAO,IAAMA,EAAkB,8BCAxB,IAAMC,GAAc,2CAGdC,GACX,yDAGWC,EAAa,2BAGbC,GAAa,kCAGbC,GAAc,0CAEdC,GACX,6FAEWC,GACX,yGCnBF,MAAO,mBCEA,IAAMC,EAAN,KAAoB,CACzB,WACA,SACA,SACA,SACF,ECPO,IAAMC,EAAN,KAAoB,CACzB,WACA,QACF,ECHA,OAAS,QAAAC,MAAY,oBACrB,OACE,gBAAAC,EACA,WAAAC,EACA,YAAAC,EACA,cAAAC,EACA,i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K,KAAO+B,EAAK,KAAK,MAAM,EAC5B,KAAK,QAAUC,EAAQ,KAAK,MAAM,EAClC,KAAK,OAASP,EAAO,KAAK,MAAM,EAChC,KAAK,SAAWQ,EAAS,KAAK,MAAM,EACpC,KAAK,MAAQN,EAAM,KAAK,MAAM,CAChC,CACF","sourcesContent":["export const DEFAULT_API_URL = \"https://api.tonightpass.com\";\n","export const EMAIL_REGEX = /^[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,4}$/;\n\n// checks if a password has at least one uppercase letter and a number or special character\nexport const PASSWORD_REGEX =\n /((?=.*\\d)|(?=.*\\W+))(?![.\\n])(?=.*[A-Z])(?=.*[a-z]).*$/;\n\n// checks if a string has only letters, numbers, spaces, apostrophes, dots and dashes\nexport const NAME_REGEX = /(^[\\p{L}\\d'\\\\.\\s\\\\-]*$)/u;\n\n// checks if a string is a valid slug, useful for usernames\nexport const SLUG_REGEX = /^[a-z\\d]+(?:(\\.|-|_)[a-z\\d]+)*$/;\n\n// validates if passwords are valid bcrypt hashes\nexport const BCRYPT_HASH = /\\$2[abxy]?\\$\\d{1,2}\\$[A-Za-z\\d\\\\./]{53}/;\n\nexport const PHONE_NUMBER_REGEX =\n /^\\s*(?:\\+?(\\d{1,3}))?([-. (]*(\\d{3})[-. )]*)?((\\d{3})[-. ]*(\\d{2,4})(?:[-.x ]*(\\d+))?)\\s*$/;\n\nexport const IMAGE_URL_REGEX =\n /(((http:\\/\\/www)|(http:\\/\\/)|(www))[-a-zA-Z0-9@:%_\\\\+.~#?&//=]+)\\.(jpg|jpeg|gif|png|bmp|tiff|tga|svg)/i;\n","import \"reflect-metadata\";\n\nexport * from \"./users\";\n","import { Location, UserIdentifier, UserIdentityGender } from \"../../types\";\n\nexport class CreateUserDto {\n identifier: UserIdentifier;\n password: string;\n identity: CreateUserIdentituDto;\n addresses: Location[];\n}\n\nclass CreateUserIdentituDto {\n firstName: string;\n lastName: string;\n gender: UserIdentityGender;\n profilePictureUrl?: string;\n birthDate: Date;\n}\n","export class SignInUserDto {\n identifier: string;\n password: string;\n}\n","import { Type } from \"class-transformer\";\nimport {\n IsDateString,\n IsEmail,\n IsObject,\n IsOptional,\n IsPhoneNumber,\n IsString,\n IsUrl,\n Length,\n Matches,\n MaxLength,\n MinLength,\n ValidateNested,\n} from \"class-validator\";\n\nimport { NAME_REGEX } from \"../../../constants/regex\";\nimport { UserIdentifier, UserIdentity } from \"../../types\";\n\nexport class UpdateUserDto {\n @IsOptional()\n @IsObject()\n @ValidateNested()\n @Type(() => UpdateIdentifierDto)\n identifier?: UpdateIdentifierDto;\n\n @IsOptional()\n @IsObject()\n @ValidateNested()\n @Type(() => UpdateIdentityDto)\n identity?: UpdateIdentityDto;\n\n @IsOptional()\n @IsString()\n @MinLength(6)\n @MaxLength(130)\n password?: string;\n}\n\nclass UpdateIdentifierDto\n implements\n Partial<Pick<UserIdentifier, \"email\" | \"phoneNumber\" | \"username\">>\n{\n @IsOptional()\n @IsString()\n @IsEmail()\n email?: string;\n\n @IsOptional()\n @IsString()\n @IsPhoneNumber()\n phoneNumber?: string;\n\n @IsOptional()\n @IsString()\n @MinLength(3)\n username?: string;\n}\n\nclass UpdateIdentityDto\n implements\n Partial<\n Pick<\n UserIdentity,\n | \"firstName\"\n | \"lastName\"\n | \"displayName\"\n | \"description\"\n | \"profilePictureUrl\"\n | \"bannerUrl\"\n | \"gender\"\n | \"birthDate\"\n >\n >\n{\n @IsOptional()\n @IsString()\n @Length(2, 50)\n @Matches(NAME_REGEX, {\n message: \"First name must be composed of letters only\",\n })\n firstName?: string;\n\n @IsOptional()\n @IsString()\n @Length(2, 50)\n @Matches(NAME_REGEX, {\n message: \"Last name must be composed of letters only\",\n })\n lastName?: string;\n\n @IsOptional()\n @IsString()\n @Length(1, 32)\n displayName?: string;\n\n @IsOptional()\n @IsString()\n @Length(15, 500)\n description?: string;\n\n @IsOptional()\n @IsUrl()\n profilePictureUrl?: string | undefined;\n\n @IsOptional()\n @IsUrl()\n bannerUrl?: string | undefined;\n\n @IsOptional()\n gender?: string;\n\n @IsOptional()\n @IsDateString()\n birthDate?: Date;\n}\n","import axios, { Options, Response } from \"redaxios\";\n\nimport { isBrowser } from \"../../utils\";\nimport { APIResponse, ErroredAPIResponse } from \"../endpoints\";\n\nconst instance = axios.create({\n headers: {\n \"Content-Type\": \"application/json\",\n Accept: \"application/json\",\n ...(!isBrowser && { \"User-Agent\": \"tonightpass-api-client\" }),\n },\n responseType: \"json\",\n transformRequest: [\n function (data) {\n return JSON.stringify(data);\n },\n ],\n withCredentials: isBrowser,\n});\n\nexport interface APIRequestOptions extends Options {}\n\nexport const request = async <T>(url: string, options?: Options) => {\n const response = instance<APIResponse<T>>(url, { ...options })\n .then((response) => response)\n .catch((error: Response<ErroredAPIResponse>) => {\n throw error.data;\n });\n\n return response;\n};\n","export const isBrowser = typeof window !== \"undefined\";\n","import { Currency } from \"../..\";\n\nexport type EventTicket = {\n id: string;\n name: string;\n description?: string;\n price: number;\n displayPrice: number;\n quantity: number;\n type: EventTicketType;\n category: EventTicketCategory;\n currency: Currency;\n vatRate: number;\n externalId?: string;\n isVisible: boolean;\n isFeesIncluded: boolean;\n startAt: Date;\n endAt: Date;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type EventTicketType = \"e-ticket\" | \"other\";\n\nexport enum EventTicketCategory {\n ENTRY = \"entry\",\n PACKAGE = \"package\",\n MEAL = \"meal\",\n DRINK = \"drink\",\n PARKING = \"parking\",\n ACCOMMODATION = \"accommodation\",\n CAMPING = \"camping\",\n LOCKER = \"locker\",\n SHUTTLE = \"shuttle\",\n OTHER = \"other\",\n}\n","import { EventTicket } from \"./ticket\";\nimport { Location } from \"..\";\nimport { Organization } from \"../organizations\";\n\nexport * from \"./ticket\";\n\nexport type Event = {\n title: string;\n description: string;\n slug: string;\n organization: Organization;\n type: EventType;\n public: boolean;\n flyers: string[];\n trailers: string[];\n location: Location;\n tickets: EventTicket[];\n styles: EventStyle[];\n startAt: Date;\n endAt: Date;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport enum EventType {\n Clubbing = \"clubbing\",\n Concert = \"concert\",\n Afterwork = \"afterwork\",\n DancingLunch = \"dancing_lunch\",\n Diner = \"diner\",\n Garden = \"garden\",\n AfterBeach = \"after_beach\",\n Festival = \"festival\",\n Spectacle = \"spectacle\",\n Cruise = \"cruise\",\n OutsideAnimation = \"outside_animation\",\n Sport = \"sport\",\n Match = \"match\",\n Seminar = \"seminar\",\n Conference = \"conference\",\n WellnessDay = \"wellness_day\",\n Workshop = \"workshop\",\n TradeFair = \"trade_fair\",\n ConsumerShow = \"consumer_show\",\n Membership = \"membership\",\n}\n\nexport type EventStyle = {\n type: EventStyleType;\n emoji: string;\n name: string;\n};\n\nexport enum EventStyleType {\n Music = \"music\",\n Dress = \"dress\",\n Sport = \"sport\",\n Food = \"food\",\n Art = \"art\",\n}\n","import { Location, Profile, ProfileMetadata } from \"..\";\nimport { Event } from \"../event\";\nimport { EventTicket } from \"../event/ticket\";\nimport { User } from \"../users\";\n\nexport type Organization = {\n id: string;\n slug: string;\n identity: OrganizationIdentity;\n members: OrganizationMember[];\n location?: Location;\n events: Event[];\n savedTickets: EventTicket[];\n verified: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type OrganizationIdentity = Profile & {\n socialLinks: OrganizationSocialLink[];\n\n metadata: ProfileMetadata & {\n eventsCount: number;\n viewsCount: number;\n membersCount: number;\n };\n};\n\nexport type OrganizationSocialLink = {\n type: OrganizationSocialType;\n url: string;\n};\n\nexport enum OrganizationSocialType {\n Facebook = \"facebook\",\n Twitter = \"twitter\",\n Instagram = \"instagram\",\n Linkedin = \"linkedin\",\n Youtube = \"youtube\",\n Website = \"website\",\n}\n\nexport type OrganizationMember = {\n user: User;\n role: OrganizationMemberRole;\n createdAt: Date;\n};\n\nexport enum OrganizationMemberRole {\n EMPLOYEE = 0,\n MANAGER = 1,\n ADMINISTRATOR = 2,\n OWNER = 3,\n}\n","export type UserToken = {\n id: string;\n type: UserTokenType;\n value: string;\n createdAt: Date;\n expiresAt: Date;\n};\n\nexport enum UserTokenType {\n Authentication = \"authentication\",\n OrganizationInvite = \"organization_invite\",\n PasswordRecovery = \"password_recovery\",\n EmailValidation = \"email_validation\",\n PhoneValidation = \"phone_validation\",\n}\n","import { Currency, Language, Location, Profile, ProfileMetadata } from \"..\";\nimport { UpdateUserDto } from \"../../dtos\";\nimport { Endpoint } from \"../../endpoints\";\n\nexport type User = {\n id: string;\n identifier: UserIdentifier;\n password: string;\n identity: UserIdentity;\n role: UserRole;\n addresses: Location[];\n preferences: UserPreferences;\n connections: UserConnection[];\n verified: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type UserIdentifier = {\n email?: string;\n phoneNumber?: string;\n username: string;\n\n [key: string]: string | undefined;\n};\n\nexport type UserIdentity = Profile & {\n firstName: string;\n lastName: string;\n fullName: string;\n gender: UserIdentityGender;\n birthDate: Date;\n\n metadata: ProfileMetadata & {\n followingCount: number;\n hasPassPlus: boolean;\n idValid: boolean;\n };\n};\n\nexport enum UserRole {\n USER = 0,\n DEVELOPER = 8,\n ADMINISTRATOR = 10,\n}\n\nexport type UserIdentityGender =\n | \"male\"\n | \"female\"\n | \"non-binary\"\n | \"gender-fluid\"\n | \"neutral\"\n | \"other\"\n | string;\n\nexport type UserPreferences = {\n language: Language;\n currency: Currency;\n notifications: {\n email: {\n newsletter: boolean;\n message: boolean;\n };\n push: {\n message: boolean;\n };\n };\n};\n\nexport type UserConnection = {\n ip: string;\n os: UserConnectionOS;\n device: UserConnectionDevice;\n client: UserConnectionClient;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type UserConnectionOS = {\n name: string;\n version: string;\n};\n\nexport type UserConnectionDevice = {\n type: string;\n brand: string;\n};\n\nexport type UserConnectionClient = {\n name: string;\n version: string;\n};\n\nexport type UserEndpoints =\n | Endpoint<\"GET\", \"/users\", User[]>\n | Endpoint<\"GET\", \"/users/:id\", User, { id: string }>\n | Endpoint<\"GET\", \"/users/me\", User>\n | Endpoint<\n \"GET\",\n \"/users/check/:identifier\",\n {\n exists: boolean;\n identifier: UserIdentifier;\n suggestions?: string[];\n },\n { identifier: boolean; suggestions?: boolean }\n >\n | Endpoint<\"PUT\", \"/users/:id\", User, UpdateUserDto>;\n","import { Currency } from \"..\";\nimport { Event, EventTicket } from \"../event\";\nimport { User } from \"../users\";\n\nexport enum OrderStatus {\n Created = \"created\",\n Cancelled = \"cancelled\",\n Completed = \"completed\",\n Pending = \"pending\",\n Confirmed = \"confirmed\",\n Declined = \"declined\",\n Refunded = \"refunded\",\n PartiallyRefunded = \"partially_refunded\",\n Expired = \"expired\",\n}\n\nexport type OrderItem = {\n id: string;\n ticket: EventTicket;\n isUsed: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type Order = {\n id: string;\n owner: User;\n members: User[];\n status: OrderStatus;\n event: Event;\n items: OrderItem[];\n promoCode?: PromoCode;\n total: number;\n currency: Currency;\n createdAt: Date;\n};\n\nexport type PromoCode = {\n id: string;\n code: string;\n used: number;\n discount: number;\n isActive: boolean;\n expirationAt: Date;\n createdAt: Date;\n};\n","export * from \"./auth\";\nexport * from \"./careers\";\nexport * from \"./event\";\nexport * from \"./health\";\nexport * from \"./organizations\";\nexport * from \"./token\";\nexport * from \"./users\";\nexport * from \"./order\";\nexport * from \"./profiles\";\n\nexport type Location = {\n name?: string;\n address: string;\n zipCode: string;\n city: string;\n country: string;\n geometry?: {\n latitude: number;\n longitude: number;\n };\n};\n\n// Currency\nexport enum Currency {\n EUR = \"EUR\",\n USD = \"USD\",\n GBP = \"GBP\",\n}\n\n// I18n\nexport enum Language {\n FR = \"fr\",\n EN = \"en\",\n}\n","import { ParamValue, Query, pathcat } from \"pathcat\";\nimport { Options, Response } from \"redaxios\";\n\nimport { APIResponse, Endpoints, ErroredAPIResponse } from \"./endpoints\";\nimport { APIRequestOptions, request } from \"./request\";\nimport { DEFAULT_API_URL } from \"../constants\";\n\nexport type PathsFor<M extends Options[\"method\"]> = Extract<\n Endpoints,\n { method: M }\n>[\"path\"];\n\nexport class TonightPassAPIError<T> extends Error {\n public readonly status: number;\n\n constructor(\n public readonly response: Response<APIResponse<T>>,\n public readonly data: ErroredAPIResponse,\n ) {\n super(data.message);\n\n this.status = response.status;\n }\n}\n\nexport interface ClientOptions {\n readonly baseURL: string;\n}\n\nexport class Client {\n private options;\n public readonly url;\n\n constructor(options: ClientOptions) {\n this.options = options;\n this.url = (path: string, params: Record<string, ParamValue>) => {\n const baseURL = this.options.baseURL || DEFAULT_API_URL;\n return pathcat(baseURL, path, params);\n };\n }\n\n setOptions(options: ClientOptions) {\n this.options = options;\n }\n\n async get<Path extends PathsFor<\"GET\">>(\n path: Path,\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"GET\" }>[\"res\"]\n >(\"GET\", path, undefined, query, options);\n }\n\n async post<Path extends Extract<Endpoints, { method: \"POST\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"POST\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"POST\" }>[\"res\"]\n >(\"POST\", path, body, query, options);\n }\n\n async put<Path extends Extract<Endpoints, { method: \"PUT\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"PUT\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"PUT\" }>[\"res\"]\n >(\"PUT\", path, body, query, options);\n }\n\n async patch<Path extends Extract<Endpoints, { method: \"PATCH\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"PATCH\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"PATCH\" }>[\"res\"]\n >(\"PATCH\", path, body, query, options);\n }\n\n async delete<Path extends Extract<Endpoints, { method: \"DELETE\" }>[\"path\"]>(\n path: Path,\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"DELETE\" }>[\"res\"]\n >(\"DELETE\", path, undefined, query, options);\n }\n\n private async requester<T>(\n method: Options[\"method\"],\n path: string,\n body: unknown,\n query: Query<string> = {},\n options: APIRequestOptions = {},\n ) {\n const url = this.url(path, query);\n\n if (body !== undefined) {\n if (method === \"GET\") {\n throw new Error(\"Cannot send a GET request with a body\");\n }\n }\n\n const response: Response<APIResponse<T>> = await request<T>(url, {\n method,\n data: body,\n ...options,\n });\n\n const result = response.data;\n\n if (!result.success) {\n throw new TonightPassAPIError<T>(response, result);\n }\n\n return result.data;\n }\n}\n","import { Client } from \"../rest\";\n\nexport function sdk<T>(builder: (client: Client) => T) {\n return builder;\n}\n","import { sdk } from \"./builder\";\n\nexport const health = sdk((client) => ({\n database: async () => client.get(\"/health/database\"),\n http: async () => client.get(\"/health/http\"),\n}));\n","import { sdk } from \"./builder\";\nimport { UpdateUserDto } from \"../rest\";\n\nexport const users = sdk((client) => ({\n getAll: async () => client.get(\"/users\"),\n get: async (id: string) => client.get(\"/users\", { id }),\n me: async () => client.get(\"/users/me\"),\n check: async (identifier: string, suggestions?: boolean) =>\n client.get(\"/users/check/:identifier\", { identifier, suggestions }),\n update: async (id: string, data: UpdateUserDto) =>\n client.put(\"/users/:id\", data, { id }),\n}));\n","import { sdk } from \"./builder\";\nimport { CreateUserDto, SignInUserDto } from \"../rest\";\n\nexport const auth = sdk((client) => ({\n signIn: async (data: SignInUserDto) => client.post(\"/auth/sign-in\", data),\n signUp: async (data: CreateUserDto) => client.post(\"/auth/sign-up\", data),\n signOut: async () => client.post(\"/auth/sign-out\", null),\n refreshToken: async () => client.post(\"/auth/refresh-token\", null),\n}));\n","import { Query } from \"pathcat\";\n\nimport { sdk } from \"./builder\";\n\nexport const careers = sdk((client) => ({\n categories: {\n getAll: async (query?: Query<\"/careers/categories\">) =>\n client.get(\"/careers/categories\", query),\n },\n employmentTypes: {\n getAll: async (query?: Query<\"/careers/employmentTypes\">) =>\n client.get(\"/careers/employmentTypes\", query),\n },\n jobs: {\n getAll: async (query?: Query<\"/careers/jobs\">) =>\n client.get(\"/careers/jobs\", query),\n get: async (id: number) => client.get(\"/careers/jobs/:id\", { id }),\n },\n offices: {\n getAll: async (query?: Query<\"/careers/offices\">) =>\n client.get(\"/careers/offices\", query),\n },\n}));\n","import { sdk } from \"./builder\";\n\nexport const profiles = sdk((client) => ({\n get: async (username: string) =>\n client.get(\"/profiles/:username\", { username }),\n}));\n","import { Client, ClientOptions } from \"./rest\";\nimport { auth } from \"./sdk/auth\";\nimport { careers } from \"./sdk/careers\";\nimport { health } from \"./sdk/health\";\nimport { profiles } from \"./sdk/profiles\";\nimport { users } from \"./sdk/users\";\n\nexport class TonightPass {\n public readonly client: Client;\n\n public readonly auth;\n public readonly careers;\n public readonly health;\n public readonly profiles;\n public readonly users;\n\n constructor(options: ClientOptions) {\n this.client = new Client(options);\n\n this.auth = auth(this.client);\n this.careers = careers(this.client);\n this.health = health(this.client);\n this.profiles = profiles(this.client);\n this.users = users(this.client);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/constants/api.ts","../src/constants/regex.ts","../src/rest/dtos/index.ts","../src/rest/dtos/organizations/create-organization.dto.ts","../src/rest/types/event/ticket/index.ts","../src/rest/types/event/index.ts","../src/rest/types/organizations/index.ts","../src/rest/types/token/index.ts","../src/rest/types/users/index.ts","../src/rest/types/order/index.ts","../src/rest/types/index.ts","../src/rest/dtos/organizations/update-organization.dto.ts","../src/rest/dtos/users/create-user.dto.ts","../src/rest/dtos/users/sign-in-user.dto.ts","../src/rest/dtos/users/update-user.dto.ts","../src/rest/request/request.ts","../src/utils/index.ts","../src/rest/client.ts","../src/sdk/builder.ts","../src/sdk/auth.ts","../src/sdk/careers.ts","../src/sdk/health.ts","../src/sdk/organizations.ts","../src/sdk/profiles.ts","../src/sdk/users.ts","../src/tonightpass.ts"],"names":["DEFAULT_API_URL","EMAIL_REGEX","PASSWORD_REGEX","NAME_REGEX","SLUG_REGEX","BCRYPT_HASH","PHONE_NUMBER_REGEX","IMAGE_URL_REGEX","ArrayMinSize","IsArray","IsEnum","IsNotEmpty","IsObject","IsString","IsUrl","Length","EventTicketCategory","EventType","EventStyleType","OrganizationSocialType","OrganizationMemberStatus","OrganizationMemberRole","UserTokenType","UserRole","OrderStatus","Currency","Language","CreateOrganizationDto","__decorateClass","CreateOrganizationIdentityDto","OrganizationMemberDto","UpdateOrganizationDto","CreateUserDto","SignInUserDto","Type","IsDateString","IsEmail","IsOptional","IsPhoneNumber","Matches","MaxLength","MinLength","ValidateNested","UpdateUserDto","UpdateIdentifierDto","UpdateIdentityDto","axios","isBrowser","instance","data","request","url","options","response","error","pathcat","TonightPassAPIError","Client","path","params","baseURL","query","body","method","result","sdk","builder","auth","client","careers","id","health","organizations","profiles","username","users","identifier","suggestions","TonightPass"],"mappings":"wMAAO,IAAMA,EAAkB,8BCAxB,IAAMC,GAAc,2CAGdC,GACX,yDAGWC,EAAa,2BAGbC,GAAa,kCAGbC,GAAc,0CAEdC,GACX,6FAEWC,GACX,yGCnBF,MAAO,mBCAP,OACE,gBAAAC,GACA,WAAAC,EACA,UAAAC,GACA,cAAAC,EACA,YAAAC,EACA,YAAAC,EACA,SAAAC,EACA,UAAAC,MACK,kBCeA,IAAKC,QACVA,EAAA,MAAQ,QACRA,EAAA,QAAU,UACVA,EAAA,KAAO,OACPA,EAAA,MAAQ,QACRA,EAAA,QAAU,UACVA,EAAA,cAAgB,gBAChBA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,QAAU,UACVA,EAAA,MAAQ,QAVEA,QAAA,ICAL,IAAKC,QACVA,EAAA,SAAW,WACXA,EAAA,QAAU,UACVA,EAAA,UAAY,YACZA,EAAA,aAAe,gBACfA,EAAA,MAAQ,QACRA,EAAA,OAAS,SACTA,EAA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AK,MAAM,EAClC,KAAK,OAASE,EAAO,KAAK,MAAM,EAChC,KAAK,cAAgBC,EAAc,KAAK,MAAM,EAC9C,KAAK,SAAWC,EAAS,KAAK,MAAM,EACpC,KAAK,MAAQE,EAAM,KAAK,MAAM,CAChC,CACF","sourcesContent":["export const DEFAULT_API_URL = \"https://api.tonightpass.com\";\n","export const EMAIL_REGEX = /^[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,4}$/;\n\n// checks if a password has at least one uppercase letter and a number or special character\nexport const PASSWORD_REGEX =\n /((?=.*\\d)|(?=.*\\W+))(?![.\\n])(?=.*[A-Z])(?=.*[a-z]).*$/;\n\n// checks if a string has only letters, numbers, spaces, apostrophes, dots and dashes\nexport const NAME_REGEX = /(^[\\p{L}\\d'\\\\.\\s\\\\-]*$)/u;\n\n// checks if a string is a valid slug, useful for usernames\nexport const SLUG_REGEX = /^[a-z\\d]+(?:(\\.|-|_)[a-z\\d]+)*$/;\n\n// validates if passwords are valid bcrypt hashes\nexport const BCRYPT_HASH = /\\$2[abxy]?\\$\\d{1,2}\\$[A-Za-z\\d\\\\./]{53}/;\n\nexport const PHONE_NUMBER_REGEX =\n /^\\s*(?:\\+?(\\d{1,3}))?([-. (]*(\\d{3})[-. )]*)?((\\d{3})[-. ]*(\\d{2,4})(?:[-.x ]*(\\d+))?)\\s*$/;\n\nexport const IMAGE_URL_REGEX =\n /(((http:\\/\\/www)|(http:\\/\\/)|(www))[-a-zA-Z0-9@:%_\\\\+.~#?&//=]+)\\.(jpg|jpeg|gif|png|bmp|tiff|tga|svg)/i;\n","import \"reflect-metadata\";\n\nexport * from \"./organizations\";\nexport * from \"./users\";\n","import {\n ArrayMinSize,\n IsArray,\n IsEnum,\n IsNotEmpty,\n IsObject,\n IsString,\n IsUrl,\n Length,\n} from \"class-validator\";\n\nimport {\n Location,\n OrganizationMemberRole,\n OrganizationSocialLink,\n} from \"../../types\";\n\nexport class CreateOrganizationDto {\n @IsString()\n @Length(1, 128)\n slug?: string;\n\n @IsObject()\n identity: CreateOrganizationIdentityDto;\n\n @IsArray()\n @ArrayMinSize(1)\n members: OrganizationMemberDto[];\n\n @IsObject()\n location?: Location;\n}\n\nclass CreateOrganizationIdentityDto {\n @IsString()\n @IsNotEmpty()\n @Length(1, 32)\n displayName: string;\n\n @IsString()\n @IsNotEmpty()\n @Length(16, 1024)\n description: string;\n\n @IsUrl({\n protocols: [\"http\", \"https\"],\n })\n avatarUrl?: string;\n\n @IsUrl({\n protocols: [\"http\", \"https\"],\n })\n bannerUrl?: string;\n\n @IsArray()\n socialLinks?: OrganizationSocialLink[];\n}\n\nclass OrganizationMemberDto {\n @IsString()\n @IsNotEmpty()\n user: string;\n\n @IsEnum(OrganizationMemberRole)\n @IsNotEmpty()\n role: OrganizationMemberRole;\n}\n","import { Currency } from \"../..\";\n\nexport type EventTicket = {\n id: string;\n name: string;\n description?: string;\n price: number;\n displayPrice: number;\n quantity: number;\n type: EventTicketType;\n category: EventTicketCategory;\n currency: Currency;\n vatRate: number;\n externalId?: string;\n isVisible: boolean;\n isFeesIncluded: boolean;\n startAt: Date;\n endAt: Date;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type EventTicketType = \"e-ticket\" | \"other\";\n\nexport enum EventTicketCategory {\n ENTRY = \"entry\",\n PACKAGE = \"package\",\n MEAL = \"meal\",\n DRINK = \"drink\",\n PARKING = \"parking\",\n ACCOMMODATION = \"accommodation\",\n CAMPING = \"camping\",\n LOCKER = \"locker\",\n SHUTTLE = \"shuttle\",\n OTHER = \"other\",\n}\n","import { EventTicket } from \"./ticket\";\nimport { Location } from \"..\";\nimport { Organization } from \"../organizations\";\n\nexport * from \"./ticket\";\n\nexport type Event = {\n title: string;\n description: string;\n slug: string;\n organization: Organization;\n type: EventType;\n public: boolean;\n flyers: string[];\n trailers: string[];\n location: Location;\n tickets: EventTicket[];\n styles: EventStyle[];\n startAt: Date;\n endAt: Date;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport enum EventType {\n Clubbing = \"clubbing\",\n Concert = \"concert\",\n Afterwork = \"afterwork\",\n DancingLunch = \"dancing_lunch\",\n Diner = \"diner\",\n Garden = \"garden\",\n AfterBeach = \"after_beach\",\n Festival = \"festival\",\n Spectacle = \"spectacle\",\n Cruise = \"cruise\",\n OutsideAnimation = \"outside_animation\",\n Sport = \"sport\",\n Match = \"match\",\n Seminar = \"seminar\",\n Conference = \"conference\",\n WellnessDay = \"wellness_day\",\n Workshop = \"workshop\",\n TradeFair = \"trade_fair\",\n ConsumerShow = \"consumer_show\",\n Membership = \"membership\",\n}\n\nexport type EventStyle = {\n type: EventStyleType;\n emoji: string;\n name: string;\n};\n\nexport enum EventStyleType {\n Music = \"music\",\n Dress = \"dress\",\n Sport = \"sport\",\n Food = \"food\",\n Art = \"art\",\n}\n","import { Location, Profile, ProfileMetadata } from \"..\";\nimport { CreateOrganizationDto, UpdateOrganizationDto } from \"../../dtos\";\nimport { Endpoint } from \"../../endpoints\";\nimport { Event } from \"../event\";\nimport { EventTicket } from \"../event/ticket\";\nimport { User } from \"../users\";\n\nexport type Organization = {\n id: string;\n slug: string;\n identity: OrganizationIdentity;\n members: OrganizationMember[];\n location?: Location;\n events: Event[];\n savedTickets: EventTicket[];\n verified: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type OrganizationIdentity = Profile & {\n socialLinks: OrganizationSocialLink[];\n\n metadata: ProfileMetadata & {\n eventsCount: number;\n viewsCount: number;\n membersCount: number;\n };\n};\n\nexport type OrganizationSocialLink = {\n type: OrganizationSocialType;\n url: string;\n};\n\nexport enum OrganizationSocialType {\n Facebook = \"facebook\",\n Twitter = \"twitter\",\n Instagram = \"instagram\",\n Linkedin = \"linkedin\",\n Youtube = \"youtube\",\n Website = \"website\",\n}\n\nexport type OrganizationMember = {\n user: User;\n role: OrganizationMemberRole;\n status: OrganizationMemberStatus;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport enum OrganizationMemberStatus {\n PENDING = \"pending\",\n ACCEPTED = \"accepted\",\n REJECTED = \"rejected\",\n}\n\nexport enum OrganizationMemberRole {\n MEMBER = \"member\",\n MANAGER = \"manager\",\n ADMINISTRATOR = \"admin\",\n OWNER = \"owner\",\n}\n\nexport type OrganizationEndpoints =\n | Endpoint<\"GET\", \"/organizations\", Organization[]>\n | Endpoint<\"GET\", \"/organizations/:id\", Organization>\n | Endpoint<\"POST\", \"/organizations\", Organization, CreateOrganizationDto>\n | Endpoint<\"PUT\", \"/organizations/:id\", Organization, UpdateOrganizationDto>\n | Endpoint<\"DELETE\", \"/organizations/:id\", boolean>;\n","export type UserToken = {\n id: string;\n type: UserTokenType;\n value: string;\n createdAt: Date;\n expiresAt: Date;\n};\n\nexport enum UserTokenType {\n Authentication = \"authentication\",\n OrganizationInvite = \"organization_invite\",\n PasswordRecovery = \"password_recovery\",\n EmailValidation = \"email_validation\",\n PhoneValidation = \"phone_validation\",\n}\n","import { Currency, Language, Location, Profile, ProfileMetadata } from \"..\";\nimport { UpdateUserDto } from \"../../dtos\";\nimport { Endpoint } from \"../../endpoints\";\n\nexport type User = {\n id: string;\n identifier: UserIdentifier;\n password: string;\n identity: UserIdentity;\n role: UserRole;\n addresses: Location[];\n preferences: UserPreferences;\n connections: UserConnection[];\n verified: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type UserIdentifier = {\n email?: string;\n phoneNumber?: string;\n username: string;\n\n [key: string]: string | undefined;\n};\n\nexport type UserIdentity = Profile & {\n firstName: string;\n lastName: string;\n fullName: string;\n gender: UserIdentityGender;\n birthDate: Date;\n\n metadata: ProfileMetadata & {\n followingCount: number;\n hasPassPlus: boolean;\n idValid: boolean;\n };\n};\n\nexport enum UserRole {\n USER = 0,\n DEVELOPER = 8,\n ADMINISTRATOR = 10,\n}\n\nexport type UserIdentityGender =\n | \"male\"\n | \"female\"\n | \"non-binary\"\n | \"gender-fluid\"\n | \"neutral\"\n | \"other\"\n | string;\n\nexport type UserPreferences = {\n language: Language;\n currency: Currency;\n notifications: {\n email: {\n newsletter: boolean;\n message: boolean;\n };\n push: {\n message: boolean;\n };\n };\n};\n\nexport type UserConnection = {\n ip: string;\n os: UserConnectionOS;\n device: UserConnectionDevice;\n client: UserConnectionClient;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type UserConnectionOS = {\n name: string;\n version: string;\n};\n\nexport type UserConnectionDevice = {\n type: string;\n brand: string;\n};\n\nexport type UserConnectionClient = {\n name: string;\n version: string;\n};\n\nexport type UserEndpoints =\n | Endpoint<\"GET\", \"/users\", User[]>\n | Endpoint<\"GET\", \"/users/:id\", User, { id: string }>\n | Endpoint<\"GET\", \"/users/me\", User>\n | Endpoint<\n \"GET\",\n \"/users/check/:identifier\",\n {\n exists: boolean;\n identifier: UserIdentifier;\n suggestions?: string[];\n },\n { identifier: boolean; suggestions?: boolean }\n >\n | Endpoint<\"PUT\", \"/users/:id\", User, UpdateUserDto>;\n","import { Currency } from \"..\";\nimport { Event, EventTicket } from \"../event\";\nimport { User } from \"../users\";\n\nexport enum OrderStatus {\n Created = \"created\",\n Cancelled = \"cancelled\",\n Completed = \"completed\",\n Pending = \"pending\",\n Confirmed = \"confirmed\",\n Declined = \"declined\",\n Refunded = \"refunded\",\n PartiallyRefunded = \"partially_refunded\",\n Expired = \"expired\",\n}\n\nexport type OrderItem = {\n id: string;\n ticket: EventTicket;\n isUsed: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type Order = {\n id: string;\n owner: User;\n members: User[];\n status: OrderStatus;\n event: Event;\n items: OrderItem[];\n promoCode?: PromoCode;\n total: number;\n currency: Currency;\n createdAt: Date;\n};\n\nexport type PromoCode = {\n id: string;\n code: string;\n used: number;\n discount: number;\n isActive: boolean;\n expirationAt: Date;\n createdAt: Date;\n};\n","export * from \"./auth\";\nexport * from \"./careers\";\nexport * from \"./event\";\nexport * from \"./health\";\nexport * from \"./organizations\";\nexport * from \"./token\";\nexport * from \"./users\";\nexport * from \"./order\";\nexport * from \"./profiles\";\n\nexport type Location = {\n name?: string;\n address: string;\n zipCode: string;\n city: string;\n country: string;\n geometry?: {\n latitude: number;\n longitude: number;\n };\n};\n\n// Currency\nexport enum Currency {\n EUR = \"EUR\",\n USD = \"USD\",\n GBP = \"GBP\",\n}\n\n// I18n\nexport enum Language {\n FR = \"fr\",\n EN = \"en\",\n}\n","import { CreateOrganizationDto } from \"./create-organization.dto\";\n\nexport class UpdateOrganizationDto extends CreateOrganizationDto {}\n","import { Location, UserIdentifier, UserIdentityGender } from \"../../types\";\n\nexport class CreateUserDto {\n identifier: UserIdentifier;\n password: string;\n identity: CreateUserIdentituDto;\n addresses: Location[];\n}\n\nclass CreateUserIdentituDto {\n firstName: string;\n lastName: string;\n gender: UserIdentityGender;\n avatarUrl?: string;\n birthDate: Date;\n}\n","export class SignInUserDto {\n identifier: string;\n password: string;\n}\n","import { Type } from \"class-transformer\";\nimport {\n IsDateString,\n IsEmail,\n IsObject,\n IsOptional,\n IsPhoneNumber,\n IsString,\n IsUrl,\n Length,\n Matches,\n MaxLength,\n MinLength,\n ValidateNested,\n} from \"class-validator\";\n\nimport { NAME_REGEX } from \"../../../constants/regex\";\nimport { UserIdentifier, UserIdentity } from \"../../types\";\n\nexport class UpdateUserDto {\n @IsOptional()\n @IsObject()\n @ValidateNested()\n @Type(() => UpdateIdentifierDto)\n identifier?: UpdateIdentifierDto;\n\n @IsOptional()\n @IsObject()\n @ValidateNested()\n @Type(() => UpdateIdentityDto)\n identity?: UpdateIdentityDto;\n\n @IsOptional()\n @IsString()\n @MinLength(6)\n @MaxLength(130)\n password?: string;\n}\n\nclass UpdateIdentifierDto\n implements\n Partial<Pick<UserIdentifier, \"email\" | \"phoneNumber\" | \"username\">>\n{\n @IsOptional()\n @IsString()\n @IsEmail()\n email?: string;\n\n @IsOptional()\n @IsString()\n @IsPhoneNumber()\n phoneNumber?: string;\n\n @IsOptional()\n @IsString()\n @MinLength(3)\n username?: string;\n}\n\nclass UpdateIdentityDto\n implements\n Partial<\n Pick<\n UserIdentity,\n | \"firstName\"\n | \"lastName\"\n | \"displayName\"\n | \"description\"\n | \"avatarUrl\"\n | \"bannerUrl\"\n | \"gender\"\n | \"birthDate\"\n >\n >\n{\n @IsOptional()\n @IsString()\n @Length(2, 50)\n @Matches(NAME_REGEX, {\n message: \"First name must be composed of letters only\",\n })\n firstName?: string;\n\n @IsOptional()\n @IsString()\n @Length(2, 50)\n @Matches(NAME_REGEX, {\n message: \"Last name must be composed of letters only\",\n })\n lastName?: string;\n\n @IsOptional()\n @IsString()\n @Length(1, 32)\n displayName?: string;\n\n @IsOptional()\n @IsString()\n @Length(15, 500)\n description?: string;\n\n @IsOptional()\n @IsUrl()\n avatarUrl?: string | undefined;\n\n @IsOptional()\n @IsUrl()\n bannerUrl?: string | undefined;\n\n @IsOptional()\n gender?: string;\n\n @IsOptional()\n @IsDateString()\n birthDate?: Date;\n}\n","import axios, { Options, Response } from \"redaxios\";\n\nimport { isBrowser } from \"../../utils\";\nimport { APIResponse, ErroredAPIResponse } from \"../endpoints\";\n\nconst instance = axios.create({\n headers: {\n \"Content-Type\": \"application/json\",\n Accept: \"application/json\",\n ...(!isBrowser && { \"User-Agent\": \"tonightpass-api-client\" }),\n },\n responseType: \"json\",\n transformRequest: [\n function (data) {\n return JSON.stringify(data);\n },\n ],\n withCredentials: isBrowser,\n});\n\nexport interface APIRequestOptions extends Options {}\n\nexport const request = async <T>(url: string, options?: Options) => {\n const response = instance<APIResponse<T>>(url, { ...options })\n .then((response) => response)\n .catch((error: Response<ErroredAPIResponse>) => {\n throw error.data;\n });\n\n return response;\n};\n","export const isBrowser = typeof window !== \"undefined\";\n","import { ParamValue, Query, pathcat } from \"pathcat\";\nimport { Options, Response } from \"redaxios\";\n\nimport { APIResponse, Endpoints, ErroredAPIResponse } from \"./endpoints\";\nimport { APIRequestOptions, request } from \"./request\";\nimport { DEFAULT_API_URL } from \"../constants\";\n\nexport type PathsFor<M extends Options[\"method\"]> = Extract<\n Endpoints,\n { method: M }\n>[\"path\"];\n\nexport class TonightPassAPIError<T> extends Error {\n public readonly status: number;\n\n constructor(\n public readonly response: Response<APIResponse<T>>,\n public readonly data: ErroredAPIResponse,\n ) {\n super(data.message);\n\n this.status = response.status;\n }\n}\n\nexport interface ClientOptions {\n readonly baseURL: string;\n}\n\nexport class Client {\n private options;\n public readonly url;\n\n constructor(options: ClientOptions) {\n this.options = options;\n this.url = (path: string, params: Record<string, ParamValue>) => {\n const baseURL = this.options.baseURL || DEFAULT_API_URL;\n return pathcat(baseURL, path, params);\n };\n }\n\n setOptions(options: ClientOptions) {\n this.options = options;\n }\n\n async get<Path extends PathsFor<\"GET\">>(\n path: Path,\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"GET\" }>[\"res\"]\n >(\"GET\", path, undefined, query, options);\n }\n\n async post<Path extends Extract<Endpoints, { method: \"POST\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"POST\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"POST\" }>[\"res\"]\n >(\"POST\", path, body, query, options);\n }\n\n async put<Path extends Extract<Endpoints, { method: \"PUT\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"PUT\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"PUT\" }>[\"res\"]\n >(\"PUT\", path, body, query, options);\n }\n\n async patch<Path extends Extract<Endpoints, { method: \"PATCH\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"PATCH\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"PATCH\" }>[\"res\"]\n >(\"PATCH\", path, body, query, options);\n }\n\n async delete<Path extends Extract<Endpoints, { method: \"DELETE\" }>[\"path\"]>(\n path: Path,\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"DELETE\" }>[\"res\"]\n >(\"DELETE\", path, undefined, query, options);\n }\n\n private async requester<T>(\n method: Options[\"method\"],\n path: string,\n body: unknown,\n query: Query<string> = {},\n options: APIRequestOptions = {},\n ) {\n const url = this.url(path, query);\n\n if (body !== undefined) {\n if (method === \"GET\") {\n throw new Error(\"Cannot send a GET request with a body\");\n }\n }\n\n const response: Response<APIResponse<T>> = await request<T>(url, {\n method,\n data: body,\n ...options,\n });\n\n const result = response.data;\n\n if (!result.success) {\n throw new TonightPassAPIError<T>(response, result);\n }\n\n return result.data;\n }\n}\n","import { Client } from \"../rest\";\n\nexport function sdk<T>(builder: (client: Client) => T) {\n return builder;\n}\n","import { sdk } from \"./builder\";\nimport { CreateUserDto, SignInUserDto } from \"../rest\";\n\nexport const auth = sdk((client) => ({\n signIn: async (data: SignInUserDto) => client.post(\"/auth/sign-in\", data),\n signUp: async (data: CreateUserDto) => client.post(\"/auth/sign-up\", data),\n signOut: async () => client.post(\"/auth/sign-out\", null),\n refreshToken: async () => client.post(\"/auth/refresh-token\", null),\n}));\n","import { Query } from \"pathcat\";\n\nimport { sdk } from \"./builder\";\n\nexport const careers = sdk((client) => ({\n categories: {\n getAll: async (query?: Query<\"/careers/categories\">) =>\n client.get(\"/careers/categories\", query),\n },\n employmentTypes: {\n getAll: async (query?: Query<\"/careers/employmentTypes\">) =>\n client.get(\"/careers/employmentTypes\", query),\n },\n jobs: {\n getAll: async (query?: Query<\"/careers/jobs\">) =>\n client.get(\"/careers/jobs\", query),\n get: async (id: number) => client.get(\"/careers/jobs/:id\", { id }),\n },\n offices: {\n getAll: async (query?: Query<\"/careers/offices\">) =>\n client.get(\"/careers/offices\", query),\n },\n}));\n","import { sdk } from \"./builder\";\n\nexport const health = sdk((client) => ({\n database: async () => client.get(\"/health/database\"),\n http: async () => client.get(\"/health/http\"),\n}));\n","import { sdk } from \"./builder\";\nimport { CreateOrganizationDto, UpdateOrganizationDto } from \"../rest\";\n\nexport const organizations = sdk((client) => ({\n getAll: async () => client.get(\"/organizations\"),\n get: async (id: string) => client.get(\"/organizations/:id\", { id }),\n create: async (data: CreateOrganizationDto) =>\n client.post(\"/organizations\", data),\n update: async (id: string, data: UpdateOrganizationDto) =>\n client.put(\"/organizations/:id\", data, { id }),\n delete: async (id: string) => client.delete(\"/organizations/:id\", { id }),\n}));\n","import { sdk } from \"./builder\";\n\nexport const profiles = sdk((client) => ({\n get: async (username: string) =>\n client.get(\"/profiles/:username\", { username }),\n}));\n","import { sdk } from \"./builder\";\nimport { UpdateUserDto } from \"../rest\";\n\nexport const users = sdk((client) => ({\n getAll: async () => client.get(\"/users\"),\n get: async (id: string) => client.get(\"/users\", { id }),\n me: async () => client.get(\"/users/me\"),\n check: async (identifier: string, suggestions?: boolean) =>\n client.get(\"/users/check/:identifier\", { identifier, suggestions }),\n update: async (id: string, data: UpdateUserDto) =>\n client.put(\"/users/:id\", data, { id }),\n}));\n","import { Client, ClientOptions } from \"./rest\";\nimport { auth, careers, health, organizations, profiles, users } from \"./sdk\";\n\nexport class TonightPass {\n public readonly client: Client;\n\n public readonly auth;\n public readonly careers;\n public readonly health;\n public readonly organizations;\n public readonly profiles;\n public readonly users;\n\n constructor(options: ClientOptions) {\n this.client = new Client(options);\n\n this.auth = auth(this.client);\n this.careers = careers(this.client);\n this.health = health(this.client);\n this.organizations = organizations(this.client);\n this.profiles = profiles(this.client);\n this.users = users(this.client);\n }\n}\n"]}
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
+
import { IsString, Length, IsObject, IsArray, ArrayMinSize, IsNotEmpty, IsUrl, IsEnum, IsOptional, ValidateNested, MinLength, MaxLength, IsEmail, IsPhoneNumber, Matches, IsDateString } from 'class-validator';
|
|
2
3
|
import { Type } from 'class-transformer';
|
|
3
|
-
import
|
|
4
|
-
import $ from 'redaxios';
|
|
4
|
+
import he from 'redaxios';
|
|
5
5
|
import { pathcat } from 'pathcat';
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var Z=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var n=(t,e,o,r)=>{for(var s=r>1?void 0:r?J(e,o):e,a=t.length-1,m;a>=0;a--)(m=t[a])&&(s=(r?m(e,o,s):m(s))||s);return r&&s&&Z(e,o,s),s};var k="https://api.tonightpass.com";var be=/^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$/,Ae=/((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/,I=/(^[\p{L}\d'\\.\s\\-]*$)/u,Re=/^[a-z\d]+(?:(\.|-|_)[a-z\d]+)*$/,Ue=/\$2[abxy]?\$\d{1,2}\$[A-Za-z\d\\./]{53}/,Ie=/^\s*(?:\+?(\d{1,3}))?([-. (]*(\d{3})[-. )]*)?((\d{3})[-. ]*(\d{2,4})(?:[-.x ]*(\d+))?)\s*$/,Oe=/(((http:\/\/www)|(http:\/\/)|(www))[-a-zA-Z0-9@:%_\\+.~#?&//=]+)\.(jpg|jpeg|gif|png|bmp|tiff|tga|svg)/i;var ee=(c=>(c.ENTRY="entry",c.PACKAGE="package",c.MEAL="meal",c.DRINK="drink",c.PARKING="parking",c.ACCOMMODATION="accommodation",c.CAMPING="camping",c.LOCKER="locker",c.SHUTTLE="shuttle",c.OTHER="other",c))(ee||{});var te=(i=>(i.Clubbing="clubbing",i.Concert="concert",i.Afterwork="afterwork",i.DancingLunch="dancing_lunch",i.Diner="diner",i.Garden="garden",i.AfterBeach="after_beach",i.Festival="festival",i.Spectacle="spectacle",i.Cruise="cruise",i.OutsideAnimation="outside_animation",i.Sport="sport",i.Match="match",i.Seminar="seminar",i.Conference="conference",i.WellnessDay="wellness_day",i.Workshop="workshop",i.TradeFair="trade_fair",i.ConsumerShow="consumer_show",i.Membership="membership",i))(te||{}),re=(a=>(a.Music="music",a.Dress="dress",a.Sport="sport",a.Food="food",a.Art="art",a))(re||{});var oe=(m=>(m.Facebook="facebook",m.Twitter="twitter",m.Instagram="instagram",m.Linkedin="linkedin",m.Youtube="youtube",m.Website="website",m))(oe||{}),ne=(r=>(r.PENDING="pending",r.ACCEPTED="accepted",r.REJECTED="rejected",r))(ne||{}),O=(s=>(s.MEMBER="member",s.MANAGER="manager",s.ADMINISTRATOR="admin",s.OWNER="owner",s))(O||{});var se=(a=>(a.Authentication="authentication",a.OrganizationInvite="organization_invite",a.PasswordRecovery="password_recovery",a.EmailValidation="email_validation",a.PhoneValidation="phone_validation",a))(se||{});var ie=(r=>(r[r.USER=0]="USER",r[r.DEVELOPER=8]="DEVELOPER",r[r.ADMINISTRATOR=10]="ADMINISTRATOR",r))(ie||{});var ae=(l=>(l.Created="created",l.Cancelled="cancelled",l.Completed="completed",l.Pending="pending",l.Confirmed="confirmed",l.Declined="declined",l.Refunded="refunded",l.PartiallyRefunded="partially_refunded",l.Expired="expired",l))(ae||{});var pe=(r=>(r.EUR="EUR",r.USD="USD",r.GBP="GBP",r))(pe||{}),me=(o=>(o.FR="fr",o.EN="en",o))(me||{});var u=class{slug;identity;members;location};n([IsString(),Length(1,128)],u.prototype,"slug",2),n([IsObject()],u.prototype,"identity",2),n([IsArray(),ArrayMinSize(1)],u.prototype,"members",2),n([IsObject()],u.prototype,"location",2);var f=class{displayName;description;avatarUrl;bannerUrl;socialLinks};n([IsString(),IsNotEmpty(),Length(1,32)],f.prototype,"displayName",2),n([IsString(),IsNotEmpty(),Length(16,1024)],f.prototype,"description",2),n([IsUrl({protocols:["http","https"]})],f.prototype,"avatarUrl",2),n([IsUrl({protocols:["http","https"]})],f.prototype,"bannerUrl",2),n([IsArray()],f.prototype,"socialLinks",2);var y=class{user;role};n([IsString(),IsNotEmpty()],y.prototype,"user",2),n([IsEnum(O),IsNotEmpty()],y.prototype,"role",2);var T=class extends u{};var _=class{identifier;password;identity;addresses};var M=class{identifier;password};var E=class{identifier;identity;password};n([IsOptional(),IsObject(),ValidateNested(),Type(()=>h)],E.prototype,"identifier",2),n([IsOptional(),IsObject(),ValidateNested(),Type(()=>d)],E.prototype,"identity",2),n([IsOptional(),IsString(),MinLength(6),MaxLength(130)],E.prototype,"password",2);var h=class{email;phoneNumber;username};n([IsOptional(),IsString(),IsEmail()],h.prototype,"email",2),n([IsOptional(),IsString(),IsPhoneNumber()],h.prototype,"phoneNumber",2),n([IsOptional(),IsString(),MinLength(3)],h.prototype,"username",2);var d=class{firstName;lastName;displayName;description;avatarUrl;bannerUrl;gender;birthDate};n([IsOptional(),IsString(),Length(2,50),Matches(I,{message:"First name must be composed of letters only"})],d.prototype,"firstName",2),n([IsOptional(),IsString(),Length(2,50),Matches(I,{message:"Last name must be composed of letters only"})],d.prototype,"lastName",2),n([IsOptional(),IsString(),Length(1,32)],d.prototype,"displayName",2),n([IsOptional(),IsString(),Length(15,500)],d.prototype,"description",2),n([IsOptional(),IsUrl()],d.prototype,"avatarUrl",2),n([IsOptional(),IsUrl()],d.prototype,"bannerUrl",2),n([IsOptional()],d.prototype,"gender",2),n([IsOptional(),IsDateString()],d.prototype,"birthDate",2);var D=typeof window<"u";var xe=he.create({headers:{"Content-Type":"application/json",Accept:"application/json",...!D&&{"User-Agent":"tonightpass-api-client"}},responseType:"json",transformRequest:[function(t){return JSON.stringify(t)}],withCredentials:D}),H=async(t,e)=>xe(t,{...e}).then(r=>r).catch(r=>{throw r.data});var C=class extends Error{constructor(o,r){super(r.message);this.response=o;this.data=r;this.status=o.status;}status},R=class{options;url;constructor(e){this.options=e,this.url=(o,r)=>{let s=this.options.baseURL||k;return pathcat(s,o,r)};}setOptions(e){this.options=e;}async get(e,o,r){return this.requester("GET",e,void 0,o,r)}async post(e,o,r,s){return this.requester("POST",e,o,r,s)}async put(e,o,r,s){return this.requester("PUT",e,o,r,s)}async patch(e,o,r,s){return this.requester("PATCH",e,o,r,s)}async delete(e,o,r){return this.requester("DELETE",e,void 0,o,r)}async requester(e,o,r,s={},a={}){let m=this.url(o,s);if(r!==void 0&&e==="GET")throw new Error("Cannot send a GET request with a body");let w=await H(m,{method:e,data:r,...a}),U=w.data;if(!U.success)throw new C(w,U);return U.data}};function x(t){return t}var B=t=>({signIn:async e=>t.post("/auth/sign-in",e),signUp:async e=>t.post("/auth/sign-up",e),signOut:async()=>t.post("/auth/sign-out",null),refreshToken:async()=>t.post("/auth/refresh-token",null)});var V=t=>({categories:{getAll:async e=>t.get("/careers/categories",e)},employmentTypes:{getAll:async e=>t.get("/careers/employmentTypes",e)},jobs:{getAll:async e=>t.get("/careers/jobs",e),get:async e=>t.get("/careers/jobs/:id",{id:e})},offices:{getAll:async e=>t.get("/careers/offices",e)}});var $=t=>({database:async()=>t.get("/health/database"),http:async()=>t.get("/health/http")});var X=t=>({getAll:async()=>t.get("/organizations"),get:async e=>t.get("/organizations/:id",{id:e}),create:async e=>t.post("/organizations",e),update:async(e,o)=>t.put("/organizations/:id",o,{id:e}),delete:async e=>t.delete("/organizations/:id",{id:e})});var W=t=>({get:async e=>t.get("/profiles/:username",{username:e})});var K=t=>({getAll:async()=>t.get("/users"),get:async e=>t.get("/users",{id:e}),me:async()=>t.get("/users/me"),check:async(e,o)=>t.get("/users/check/:identifier",{identifier:e,suggestions:o}),update:async(e,o)=>t.put("/users/:id",o,{id:e})});var Y=class{client;auth;careers;health;organizations;profiles;users;constructor(e){this.client=new R(e),this.auth=B(this.client),this.careers=V(this.client),this.health=$(this.client),this.organizations=X(this.client),this.profiles=W(this.client),this.users=K(this.client);}};
|
|
8
8
|
|
|
9
|
-
export {
|
|
9
|
+
export { Ue as BCRYPT_HASH, R as Client, u as CreateOrganizationDto, _ as CreateUserDto, pe as Currency, k as DEFAULT_API_URL, be as EMAIL_REGEX, re as EventStyleType, ee as EventTicketCategory, te as EventType, Oe as IMAGE_URL_REGEX, me as Language, I as NAME_REGEX, ae as OrderStatus, O as OrganizationMemberRole, ne as OrganizationMemberStatus, oe as OrganizationSocialType, Ae as PASSWORD_REGEX, Ie as PHONE_NUMBER_REGEX, Re as SLUG_REGEX, M as SignInUserDto, Y as TonightPass, C as TonightPassAPIError, T as UpdateOrganizationDto, E as UpdateUserDto, ie as UserRole, se as UserTokenType, B as auth, V as careers, $ as health, D as isBrowser, X as organizations, W as profiles, H as request, x as sdk, K as users };
|
|
10
10
|
//# sourceMappingURL=out.js.map
|
|
11
11
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/constants/api.ts","../src/constants/regex.ts","../src/rest/dtos/index.ts","../src/rest/dtos/users/create-user.dto.ts","../src/rest/dtos/users/sign-in-user.dto.ts","../src/rest/dtos/users/update-user.dto.ts","../src/rest/request/request.ts","../src/utils/index.ts","../src/rest/types/event/ticket/index.ts","../src/rest/types/event/index.ts","../src/rest/types/organizations/index.ts","../src/rest/types/token/index.ts","../src/rest/types/users/index.ts","../src/rest/types/order/index.ts","../src/rest/types/index.ts","../src/rest/client.ts","../src/sdk/builder.ts","../src/sdk/health.ts","../src/sdk/users.ts","../src/sdk/auth.ts","../src/sdk/careers.ts","../src/sdk/profiles.ts","../src/tonightpass.ts"],"names":["DEFAULT_API_URL","EMAIL_REGEX","PASSWORD_REGEX","NAME_REGEX","SLUG_REGEX","BCRYPT_HASH","PHONE_NUMBER_REGEX","IMAGE_URL_REGEX","CreateUserDto","SignInUserDto","Type","IsDateString","IsEmail","IsObject","IsOptional","IsPhoneNumber","IsString","IsUrl","Length","Matches","MaxLength","MinLength","ValidateNested","UpdateUserDto","__decorateClass","UpdateIdentifierDto","UpdateIdentityDto","axios","isBrowser","instance","data","request","url","options","response","error","EventTicketCategory","EventType","EventStyleType","OrganizationSocialType","OrganizationMemberRole","UserTokenType","UserRole","OrderStatus","Currency","Language","pathcat","TonightPassAPIError","Client","path","params","baseURL","query","body","method","result","sdk","builder","health","client","users","id","identifier","suggestions","auth","careers","profiles","username","TonightPass"],"mappings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G,CAAC,CACnE,EACA,QAAS,CACP,OAAQ,MAAOT,GACbO,EAAO,IAAI,mBAAoBP,CAAK,CACxC,CACF,GCpBO,IAAMc,EAAgBP,IAAY,CACvC,IAAK,MAAOQ,GACVR,EAAO,IAAI,sBAAuB,CAAE,SAAAQ,CAAS,CAAC,CAClD,GCEO,IAAMC,EAAN,KAAkB,CACP,OAEA,KACA,QACA,OACA,SACA,MAEhB,YAAYnC,EAAwB,CAClC,KAAK,OAAS,IAAIe,EAAOf,CAAO,EAEhC,KAAK,KAAO+B,EAAK,KAAK,MAAM,EAC5B,KAAK,QAAUC,EAAQ,KAAK,MAAM,EAClC,KAAK,OAASP,EAAO,KAAK,MAAM,EAChC,KAAK,SAAWQ,EAAS,KAAK,MAAM,EACpC,KAAK,MAAQN,EAAM,KAAK,MAAM,CAChC,CACF","sourcesContent":["export const DEFAULT_API_URL = \"https://api.tonightpass.com\";\n","export const EMAIL_REGEX = /^[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,4}$/;\n\n// checks if a password has at least one uppercase letter and a number or special character\nexport const PASSWORD_REGEX =\n /((?=.*\\d)|(?=.*\\W+))(?![.\\n])(?=.*[A-Z])(?=.*[a-z]).*$/;\n\n// checks if a string has only letters, numbers, spaces, apostrophes, dots and dashes\nexport const NAME_REGEX = /(^[\\p{L}\\d'\\\\.\\s\\\\-]*$)/u;\n\n// checks if a string is a valid slug, useful for usernames\nexport const SLUG_REGEX = /^[a-z\\d]+(?:(\\.|-|_)[a-z\\d]+)*$/;\n\n// validates if passwords are valid bcrypt hashes\nexport const BCRYPT_HASH = /\\$2[abxy]?\\$\\d{1,2}\\$[A-Za-z\\d\\\\./]{53}/;\n\nexport const PHONE_NUMBER_REGEX =\n /^\\s*(?:\\+?(\\d{1,3}))?([-. (]*(\\d{3})[-. )]*)?((\\d{3})[-. ]*(\\d{2,4})(?:[-.x ]*(\\d+))?)\\s*$/;\n\nexport const IMAGE_URL_REGEX =\n /(((http:\\/\\/www)|(http:\\/\\/)|(www))[-a-zA-Z0-9@:%_\\\\+.~#?&//=]+)\\.(jpg|jpeg|gif|png|bmp|tiff|tga|svg)/i;\n","import \"reflect-metadata\";\n\nexport * from \"./users\";\n","import { Location, UserIdentifier, UserIdentityGender } from \"../../types\";\n\nexport class CreateUserDto {\n identifier: UserIdentifier;\n password: string;\n identity: CreateUserIdentituDto;\n addresses: Location[];\n}\n\nclass CreateUserIdentituDto {\n firstName: string;\n lastName: string;\n gender: UserIdentityGender;\n profilePictureUrl?: string;\n birthDate: Date;\n}\n","export class SignInUserDto {\n identifier: string;\n password: string;\n}\n","import { Type } from \"class-transformer\";\nimport {\n IsDateString,\n IsEmail,\n IsObject,\n IsOptional,\n IsPhoneNumber,\n IsString,\n IsUrl,\n Length,\n Matches,\n MaxLength,\n MinLength,\n ValidateNested,\n} from \"class-validator\";\n\nimport { NAME_REGEX } from \"../../../constants/regex\";\nimport { UserIdentifier, UserIdentity } from \"../../types\";\n\nexport class UpdateUserDto {\n @IsOptional()\n @IsObject()\n @ValidateNested()\n @Type(() => UpdateIdentifierDto)\n identifier?: UpdateIdentifierDto;\n\n @IsOptional()\n @IsObject()\n @ValidateNested()\n @Type(() => UpdateIdentityDto)\n identity?: UpdateIdentityDto;\n\n @IsOptional()\n @IsString()\n @MinLength(6)\n @MaxLength(130)\n password?: string;\n}\n\nclass UpdateIdentifierDto\n implements\n Partial<Pick<UserIdentifier, \"email\" | \"phoneNumber\" | \"username\">>\n{\n @IsOptional()\n @IsString()\n @IsEmail()\n email?: string;\n\n @IsOptional()\n @IsString()\n @IsPhoneNumber()\n phoneNumber?: string;\n\n @IsOptional()\n @IsString()\n @MinLength(3)\n username?: string;\n}\n\nclass UpdateIdentityDto\n implements\n Partial<\n Pick<\n UserIdentity,\n | \"firstName\"\n | \"lastName\"\n | \"displayName\"\n | \"description\"\n | \"profilePictureUrl\"\n | \"bannerUrl\"\n | \"gender\"\n | \"birthDate\"\n >\n >\n{\n @IsOptional()\n @IsString()\n @Length(2, 50)\n @Matches(NAME_REGEX, {\n message: \"First name must be composed of letters only\",\n })\n firstName?: string;\n\n @IsOptional()\n @IsString()\n @Length(2, 50)\n @Matches(NAME_REGEX, {\n message: \"Last name must be composed of letters only\",\n })\n lastName?: string;\n\n @IsOptional()\n @IsString()\n @Length(1, 32)\n displayName?: string;\n\n @IsOptional()\n @IsString()\n @Length(15, 500)\n description?: string;\n\n @IsOptional()\n @IsUrl()\n profilePictureUrl?: string | undefined;\n\n @IsOptional()\n @IsUrl()\n bannerUrl?: string | undefined;\n\n @IsOptional()\n gender?: string;\n\n @IsOptional()\n @IsDateString()\n birthDate?: Date;\n}\n","import axios, { Options, Response } from \"redaxios\";\n\nimport { isBrowser } from \"../../utils\";\nimport { APIResponse, ErroredAPIResponse } from \"../endpoints\";\n\nconst instance = axios.create({\n headers: {\n \"Content-Type\": \"application/json\",\n Accept: \"application/json\",\n ...(!isBrowser && { \"User-Agent\": \"tonightpass-api-client\" }),\n },\n responseType: \"json\",\n transformRequest: [\n function (data) {\n return JSON.stringify(data);\n },\n ],\n withCredentials: isBrowser,\n});\n\nexport interface APIRequestOptions extends Options {}\n\nexport const request = async <T>(url: string, options?: Options) => {\n const response = instance<APIResponse<T>>(url, { ...options })\n .then((response) => response)\n .catch((error: Response<ErroredAPIResponse>) => {\n throw error.data;\n });\n\n return response;\n};\n","export const isBrowser = typeof window !== \"undefined\";\n","import { Currency } from \"../..\";\n\nexport type EventTicket = {\n id: string;\n name: string;\n description?: string;\n price: number;\n displayPrice: number;\n quantity: number;\n type: EventTicketType;\n category: EventTicketCategory;\n currency: Currency;\n vatRate: number;\n externalId?: string;\n isVisible: boolean;\n isFeesIncluded: boolean;\n startAt: Date;\n endAt: Date;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type EventTicketType = \"e-ticket\" | \"other\";\n\nexport enum EventTicketCategory {\n ENTRY = \"entry\",\n PACKAGE = \"package\",\n MEAL = \"meal\",\n DRINK = \"drink\",\n PARKING = \"parking\",\n ACCOMMODATION = \"accommodation\",\n CAMPING = \"camping\",\n LOCKER = \"locker\",\n SHUTTLE = \"shuttle\",\n OTHER = \"other\",\n}\n","import { EventTicket } from \"./ticket\";\nimport { Location } from \"..\";\nimport { Organization } from \"../organizations\";\n\nexport * from \"./ticket\";\n\nexport type Event = {\n title: string;\n description: string;\n slug: string;\n organization: Organization;\n type: EventType;\n public: boolean;\n flyers: string[];\n trailers: string[];\n location: Location;\n tickets: EventTicket[];\n styles: EventStyle[];\n startAt: Date;\n endAt: Date;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport enum EventType {\n Clubbing = \"clubbing\",\n Concert = \"concert\",\n Afterwork = \"afterwork\",\n DancingLunch = \"dancing_lunch\",\n Diner = \"diner\",\n Garden = \"garden\",\n AfterBeach = \"after_beach\",\n Festival = \"festival\",\n Spectacle = \"spectacle\",\n Cruise = \"cruise\",\n OutsideAnimation = \"outside_animation\",\n Sport = \"sport\",\n Match = \"match\",\n Seminar = \"seminar\",\n Conference = \"conference\",\n WellnessDay = \"wellness_day\",\n Workshop = \"workshop\",\n TradeFair = \"trade_fair\",\n ConsumerShow = \"consumer_show\",\n Membership = \"membership\",\n}\n\nexport type EventStyle = {\n type: EventStyleType;\n emoji: string;\n name: string;\n};\n\nexport enum EventStyleType {\n Music = \"music\",\n Dress = \"dress\",\n Sport = \"sport\",\n Food = \"food\",\n Art = \"art\",\n}\n","import { Location, Profile, ProfileMetadata } from \"..\";\nimport { Event } from \"../event\";\nimport { EventTicket } from \"../event/ticket\";\nimport { User } from \"../users\";\n\nexport type Organization = {\n id: string;\n slug: string;\n identity: OrganizationIdentity;\n members: OrganizationMember[];\n location?: Location;\n events: Event[];\n savedTickets: EventTicket[];\n verified: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type OrganizationIdentity = Profile & {\n socialLinks: OrganizationSocialLink[];\n\n metadata: ProfileMetadata & {\n eventsCount: number;\n viewsCount: number;\n membersCount: number;\n };\n};\n\nexport type OrganizationSocialLink = {\n type: OrganizationSocialType;\n url: string;\n};\n\nexport enum OrganizationSocialType {\n Facebook = \"facebook\",\n Twitter = \"twitter\",\n Instagram = \"instagram\",\n Linkedin = \"linkedin\",\n Youtube = \"youtube\",\n Website = \"website\",\n}\n\nexport type OrganizationMember = {\n user: User;\n role: OrganizationMemberRole;\n createdAt: Date;\n};\n\nexport enum OrganizationMemberRole {\n EMPLOYEE = 0,\n MANAGER = 1,\n ADMINISTRATOR = 2,\n OWNER = 3,\n}\n","export type UserToken = {\n id: string;\n type: UserTokenType;\n value: string;\n createdAt: Date;\n expiresAt: Date;\n};\n\nexport enum UserTokenType {\n Authentication = \"authentication\",\n OrganizationInvite = \"organization_invite\",\n PasswordRecovery = \"password_recovery\",\n EmailValidation = \"email_validation\",\n PhoneValidation = \"phone_validation\",\n}\n","import { Currency, Language, Location, Profile, ProfileMetadata } from \"..\";\nimport { UpdateUserDto } from \"../../dtos\";\nimport { Endpoint } from \"../../endpoints\";\n\nexport type User = {\n id: string;\n identifier: UserIdentifier;\n password: string;\n identity: UserIdentity;\n role: UserRole;\n addresses: Location[];\n preferences: UserPreferences;\n connections: UserConnection[];\n verified: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type UserIdentifier = {\n email?: string;\n phoneNumber?: string;\n username: string;\n\n [key: string]: string | undefined;\n};\n\nexport type UserIdentity = Profile & {\n firstName: string;\n lastName: string;\n fullName: string;\n gender: UserIdentityGender;\n birthDate: Date;\n\n metadata: ProfileMetadata & {\n followingCount: number;\n hasPassPlus: boolean;\n idValid: boolean;\n };\n};\n\nexport enum UserRole {\n USER = 0,\n DEVELOPER = 8,\n ADMINISTRATOR = 10,\n}\n\nexport type UserIdentityGender =\n | \"male\"\n | \"female\"\n | \"non-binary\"\n | \"gender-fluid\"\n | \"neutral\"\n | \"other\"\n | string;\n\nexport type UserPreferences = {\n language: Language;\n currency: Currency;\n notifications: {\n email: {\n newsletter: boolean;\n message: boolean;\n };\n push: {\n message: boolean;\n };\n };\n};\n\nexport type UserConnection = {\n ip: string;\n os: UserConnectionOS;\n device: UserConnectionDevice;\n client: UserConnectionClient;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type UserConnectionOS = {\n name: string;\n version: string;\n};\n\nexport type UserConnectionDevice = {\n type: string;\n brand: string;\n};\n\nexport type UserConnectionClient = {\n name: string;\n version: string;\n};\n\nexport type UserEndpoints =\n | Endpoint<\"GET\", \"/users\", User[]>\n | Endpoint<\"GET\", \"/users/:id\", User, { id: string }>\n | Endpoint<\"GET\", \"/users/me\", User>\n | Endpoint<\n \"GET\",\n \"/users/check/:identifier\",\n {\n exists: boolean;\n identifier: UserIdentifier;\n suggestions?: string[];\n },\n { identifier: boolean; suggestions?: boolean }\n >\n | Endpoint<\"PUT\", \"/users/:id\", User, UpdateUserDto>;\n","import { Currency } from \"..\";\nimport { Event, EventTicket } from \"../event\";\nimport { User } from \"../users\";\n\nexport enum OrderStatus {\n Created = \"created\",\n Cancelled = \"cancelled\",\n Completed = \"completed\",\n Pending = \"pending\",\n Confirmed = \"confirmed\",\n Declined = \"declined\",\n Refunded = \"refunded\",\n PartiallyRefunded = \"partially_refunded\",\n Expired = \"expired\",\n}\n\nexport type OrderItem = {\n id: string;\n ticket: EventTicket;\n isUsed: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type Order = {\n id: string;\n owner: User;\n members: User[];\n status: OrderStatus;\n event: Event;\n items: OrderItem[];\n promoCode?: PromoCode;\n total: number;\n currency: Currency;\n createdAt: Date;\n};\n\nexport type PromoCode = {\n id: string;\n code: string;\n used: number;\n discount: number;\n isActive: boolean;\n expirationAt: Date;\n createdAt: Date;\n};\n","export * from \"./auth\";\nexport * from \"./careers\";\nexport * from \"./event\";\nexport * from \"./health\";\nexport * from \"./organizations\";\nexport * from \"./token\";\nexport * from \"./users\";\nexport * from \"./order\";\nexport * from \"./profiles\";\n\nexport type Location = {\n name?: string;\n address: string;\n zipCode: string;\n city: string;\n country: string;\n geometry?: {\n latitude: number;\n longitude: number;\n };\n};\n\n// Currency\nexport enum Currency {\n EUR = \"EUR\",\n USD = \"USD\",\n GBP = \"GBP\",\n}\n\n// I18n\nexport enum Language {\n FR = \"fr\",\n EN = \"en\",\n}\n","import { ParamValue, Query, pathcat } from \"pathcat\";\nimport { Options, Response } from \"redaxios\";\n\nimport { APIResponse, Endpoints, ErroredAPIResponse } from \"./endpoints\";\nimport { APIRequestOptions, request } from \"./request\";\nimport { DEFAULT_API_URL } from \"../constants\";\n\nexport type PathsFor<M extends Options[\"method\"]> = Extract<\n Endpoints,\n { method: M }\n>[\"path\"];\n\nexport class TonightPassAPIError<T> extends Error {\n public readonly status: number;\n\n constructor(\n public readonly response: Response<APIResponse<T>>,\n public readonly data: ErroredAPIResponse,\n ) {\n super(data.message);\n\n this.status = response.status;\n }\n}\n\nexport interface ClientOptions {\n readonly baseURL: string;\n}\n\nexport class Client {\n private options;\n public readonly url;\n\n constructor(options: ClientOptions) {\n this.options = options;\n this.url = (path: string, params: Record<string, ParamValue>) => {\n const baseURL = this.options.baseURL || DEFAULT_API_URL;\n return pathcat(baseURL, path, params);\n };\n }\n\n setOptions(options: ClientOptions) {\n this.options = options;\n }\n\n async get<Path extends PathsFor<\"GET\">>(\n path: Path,\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"GET\" }>[\"res\"]\n >(\"GET\", path, undefined, query, options);\n }\n\n async post<Path extends Extract<Endpoints, { method: \"POST\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"POST\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"POST\" }>[\"res\"]\n >(\"POST\", path, body, query, options);\n }\n\n async put<Path extends Extract<Endpoints, { method: \"PUT\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"PUT\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"PUT\" }>[\"res\"]\n >(\"PUT\", path, body, query, options);\n }\n\n async patch<Path extends Extract<Endpoints, { method: \"PATCH\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"PATCH\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"PATCH\" }>[\"res\"]\n >(\"PATCH\", path, body, query, options);\n }\n\n async delete<Path extends Extract<Endpoints, { method: \"DELETE\" }>[\"path\"]>(\n path: Path,\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"DELETE\" }>[\"res\"]\n >(\"DELETE\", path, undefined, query, options);\n }\n\n private async requester<T>(\n method: Options[\"method\"],\n path: string,\n body: unknown,\n query: Query<string> = {},\n options: APIRequestOptions = {},\n ) {\n const url = this.url(path, query);\n\n if (body !== undefined) {\n if (method === \"GET\") {\n throw new Error(\"Cannot send a GET request with a body\");\n }\n }\n\n const response: Response<APIResponse<T>> = await request<T>(url, {\n method,\n data: body,\n ...options,\n });\n\n const result = response.data;\n\n if (!result.success) {\n throw new TonightPassAPIError<T>(response, result);\n }\n\n return result.data;\n }\n}\n","import { Client } from \"../rest\";\n\nexport function sdk<T>(builder: (client: Client) => T) {\n return builder;\n}\n","import { sdk } from \"./builder\";\n\nexport const health = sdk((client) => ({\n database: async () => client.get(\"/health/database\"),\n http: async () => client.get(\"/health/http\"),\n}));\n","import { sdk } from \"./builder\";\nimport { UpdateUserDto } from \"../rest\";\n\nexport const users = sdk((client) => ({\n getAll: async () => client.get(\"/users\"),\n get: async (id: string) => client.get(\"/users\", { id }),\n me: async () => client.get(\"/users/me\"),\n check: async (identifier: string, suggestions?: boolean) =>\n client.get(\"/users/check/:identifier\", { identifier, suggestions }),\n update: async (id: string, data: UpdateUserDto) =>\n client.put(\"/users/:id\", data, { id }),\n}));\n","import { sdk } from \"./builder\";\nimport { CreateUserDto, SignInUserDto } from \"../rest\";\n\nexport const auth = sdk((client) => ({\n signIn: async (data: SignInUserDto) => client.post(\"/auth/sign-in\", data),\n signUp: async (data: CreateUserDto) => client.post(\"/auth/sign-up\", data),\n signOut: async () => client.post(\"/auth/sign-out\", null),\n refreshToken: async () => client.post(\"/auth/refresh-token\", null),\n}));\n","import { Query } from \"pathcat\";\n\nimport { sdk } from \"./builder\";\n\nexport const careers = sdk((client) => ({\n categories: {\n getAll: async (query?: Query<\"/careers/categories\">) =>\n client.get(\"/careers/categories\", query),\n },\n employmentTypes: {\n getAll: async (query?: Query<\"/careers/employmentTypes\">) =>\n client.get(\"/careers/employmentTypes\", query),\n },\n jobs: {\n getAll: async (query?: Query<\"/careers/jobs\">) =>\n client.get(\"/careers/jobs\", query),\n get: async (id: number) => client.get(\"/careers/jobs/:id\", { id }),\n },\n offices: {\n getAll: async (query?: Query<\"/careers/offices\">) =>\n client.get(\"/careers/offices\", query),\n },\n}));\n","import { sdk } from \"./builder\";\n\nexport const profiles = sdk((client) => ({\n get: async (username: string) =>\n client.get(\"/profiles/:username\", { username }),\n}));\n","import { Client, ClientOptions } from \"./rest\";\nimport { auth } from \"./sdk/auth\";\nimport { careers } from \"./sdk/careers\";\nimport { health } from \"./sdk/health\";\nimport { profiles } from \"./sdk/profiles\";\nimport { users } from \"./sdk/users\";\n\nexport class TonightPass {\n public readonly client: Client;\n\n public readonly auth;\n public readonly careers;\n public readonly health;\n public readonly profiles;\n public readonly users;\n\n constructor(options: ClientOptions) {\n this.client = new Client(options);\n\n this.auth = auth(this.client);\n this.careers = careers(this.client);\n this.health = health(this.client);\n this.profiles = profiles(this.client);\n this.users = users(this.client);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/constants/api.ts","../src/constants/regex.ts","../src/rest/dtos/index.ts","../src/rest/dtos/organizations/create-organization.dto.ts","../src/rest/types/event/ticket/index.ts","../src/rest/types/event/index.ts","../src/rest/types/organizations/index.ts","../src/rest/types/token/index.ts","../src/rest/types/users/index.ts","../src/rest/types/order/index.ts","../src/rest/types/index.ts","../src/rest/dtos/organizations/update-organization.dto.ts","../src/rest/dtos/users/create-user.dto.ts","../src/rest/dtos/users/sign-in-user.dto.ts","../src/rest/dtos/users/update-user.dto.ts","../src/rest/request/request.ts","../src/utils/index.ts","../src/rest/client.ts","../src/sdk/builder.ts","../src/sdk/auth.ts","../src/sdk/careers.ts","../src/sdk/health.ts","../src/sdk/organizations.ts","../src/sdk/profiles.ts","../src/sdk/users.ts","../src/tonightpass.ts"],"names":["DEFAULT_API_URL","EMAIL_REGEX","PASSWORD_REGEX","NAME_REGEX","SLUG_REGEX","BCRYPT_HASH","PHONE_NUMBER_REGEX","IMAGE_URL_REGEX","ArrayMinSize","IsArray","IsEnum","IsNotEmpty","IsObject","IsString","IsUrl","Length","EventTicketCategory","EventType","EventStyleType","OrganizationSocialType","OrganizationMemberStatus","OrganizationMemberRole","UserTokenType","UserRole","OrderStatus","Currency","Language","CreateOrganizationDto","__decorateClass","CreateOrganizationIdentityDto","OrganizationMemberDto","UpdateOrganizationDto","CreateUserDto","SignInUserDto","Type","IsDateString","IsEmail","IsOptional","IsPhoneNumber","Matches","MaxLength","MinLength","ValidateNested","UpdateUserDto","UpdateIdentifierDto","UpdateIdentityDto","axios","isBrowser","instance","data","request","url","options","response","error","pathcat","TonightPassAPIError","Client","path","params","baseURL","query","body","method","result","sdk","builder","auth","client","careers","id","health","organizations","profiles","username","users","identifier","suggestions","TonightPass"],"mappings":"wMAAO,IAAMA,EAAkB,8BCAxB,IAAMC,GAAc,2CAGdC,GACX,yDAGWC,EAAa,2BAGbC,GAAa,kCAGbC,GAAc,0CAEdC,GACX,6FAEWC,GACX,yGCnBF,MAAO,mBCAP,OACE,gBAAAC,GACA,WAAAC,EACA,UAAAC,GACA,cAAAC,EACA,YAAAC,EACA,YAAAC,EACA,SAAAC,EACA,UAAAC,MACK,kBCeA,IAAKC,QACVA,EA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AE,WAAAQ,EAAY,YAAAC,CAAY,CAAC,EACpE,OAAQ,MAAOP,EAAYrB,IACzBmB,EAAO,IAAI,aAAcnB,EAAM,CAAE,GAAAqB,CAAG,CAAC,CACzC,GCRO,IAAMQ,EAAN,KAAkB,CACP,OAEA,KACA,QACA,OACA,cACA,SACA,MAEhB,YAAY1B,EAAwB,CAClC,KAAK,OAAS,IAAIK,EAAOL,CAAO,EAEhC,KAAK,KAAOe,EAAK,KAAK,MAAM,EAC5B,KAAK,QAAUE,EAAQ,KAAK,MAAM,EAClC,KAAK,OAASE,EAAO,KAAK,MAAM,EAChC,KAAK,cAAgBC,EAAc,KAAK,MAAM,EAC9C,KAAK,SAAWC,EAAS,KAAK,MAAM,EACpC,KAAK,MAAQE,EAAM,KAAK,MAAM,CAChC,CACF","sourcesContent":["export const DEFAULT_API_URL = \"https://api.tonightpass.com\";\n","export const EMAIL_REGEX = /^[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,4}$/;\n\n// checks if a password has at least one uppercase letter and a number or special character\nexport const PASSWORD_REGEX =\n /((?=.*\\d)|(?=.*\\W+))(?![.\\n])(?=.*[A-Z])(?=.*[a-z]).*$/;\n\n// checks if a string has only letters, numbers, spaces, apostrophes, dots and dashes\nexport const NAME_REGEX = /(^[\\p{L}\\d'\\\\.\\s\\\\-]*$)/u;\n\n// checks if a string is a valid slug, useful for usernames\nexport const SLUG_REGEX = /^[a-z\\d]+(?:(\\.|-|_)[a-z\\d]+)*$/;\n\n// validates if passwords are valid bcrypt hashes\nexport const BCRYPT_HASH = /\\$2[abxy]?\\$\\d{1,2}\\$[A-Za-z\\d\\\\./]{53}/;\n\nexport const PHONE_NUMBER_REGEX =\n /^\\s*(?:\\+?(\\d{1,3}))?([-. (]*(\\d{3})[-. )]*)?((\\d{3})[-. ]*(\\d{2,4})(?:[-.x ]*(\\d+))?)\\s*$/;\n\nexport const IMAGE_URL_REGEX =\n /(((http:\\/\\/www)|(http:\\/\\/)|(www))[-a-zA-Z0-9@:%_\\\\+.~#?&//=]+)\\.(jpg|jpeg|gif|png|bmp|tiff|tga|svg)/i;\n","import \"reflect-metadata\";\n\nexport * from \"./organizations\";\nexport * from \"./users\";\n","import {\n ArrayMinSize,\n IsArray,\n IsEnum,\n IsNotEmpty,\n IsObject,\n IsString,\n IsUrl,\n Length,\n} from \"class-validator\";\n\nimport {\n Location,\n OrganizationMemberRole,\n OrganizationSocialLink,\n} from \"../../types\";\n\nexport class CreateOrganizationDto {\n @IsString()\n @Length(1, 128)\n slug?: string;\n\n @IsObject()\n identity: CreateOrganizationIdentityDto;\n\n @IsArray()\n @ArrayMinSize(1)\n members: OrganizationMemberDto[];\n\n @IsObject()\n location?: Location;\n}\n\nclass CreateOrganizationIdentityDto {\n @IsString()\n @IsNotEmpty()\n @Length(1, 32)\n displayName: string;\n\n @IsString()\n @IsNotEmpty()\n @Length(16, 1024)\n description: string;\n\n @IsUrl({\n protocols: [\"http\", \"https\"],\n })\n avatarUrl?: string;\n\n @IsUrl({\n protocols: [\"http\", \"https\"],\n })\n bannerUrl?: string;\n\n @IsArray()\n socialLinks?: OrganizationSocialLink[];\n}\n\nclass OrganizationMemberDto {\n @IsString()\n @IsNotEmpty()\n user: string;\n\n @IsEnum(OrganizationMemberRole)\n @IsNotEmpty()\n role: OrganizationMemberRole;\n}\n","import { Currency } from \"../..\";\n\nexport type EventTicket = {\n id: string;\n name: string;\n description?: string;\n price: number;\n displayPrice: number;\n quantity: number;\n type: EventTicketType;\n category: EventTicketCategory;\n currency: Currency;\n vatRate: number;\n externalId?: string;\n isVisible: boolean;\n isFeesIncluded: boolean;\n startAt: Date;\n endAt: Date;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type EventTicketType = \"e-ticket\" | \"other\";\n\nexport enum EventTicketCategory {\n ENTRY = \"entry\",\n PACKAGE = \"package\",\n MEAL = \"meal\",\n DRINK = \"drink\",\n PARKING = \"parking\",\n ACCOMMODATION = \"accommodation\",\n CAMPING = \"camping\",\n LOCKER = \"locker\",\n SHUTTLE = \"shuttle\",\n OTHER = \"other\",\n}\n","import { EventTicket } from \"./ticket\";\nimport { Location } from \"..\";\nimport { Organization } from \"../organizations\";\n\nexport * from \"./ticket\";\n\nexport type Event = {\n title: string;\n description: string;\n slug: string;\n organization: Organization;\n type: EventType;\n public: boolean;\n flyers: string[];\n trailers: string[];\n location: Location;\n tickets: EventTicket[];\n styles: EventStyle[];\n startAt: Date;\n endAt: Date;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport enum EventType {\n Clubbing = \"clubbing\",\n Concert = \"concert\",\n Afterwork = \"afterwork\",\n DancingLunch = \"dancing_lunch\",\n Diner = \"diner\",\n Garden = \"garden\",\n AfterBeach = \"after_beach\",\n Festival = \"festival\",\n Spectacle = \"spectacle\",\n Cruise = \"cruise\",\n OutsideAnimation = \"outside_animation\",\n Sport = \"sport\",\n Match = \"match\",\n Seminar = \"seminar\",\n Conference = \"conference\",\n WellnessDay = \"wellness_day\",\n Workshop = \"workshop\",\n TradeFair = \"trade_fair\",\n ConsumerShow = \"consumer_show\",\n Membership = \"membership\",\n}\n\nexport type EventStyle = {\n type: EventStyleType;\n emoji: string;\n name: string;\n};\n\nexport enum EventStyleType {\n Music = \"music\",\n Dress = \"dress\",\n Sport = \"sport\",\n Food = \"food\",\n Art = \"art\",\n}\n","import { Location, Profile, ProfileMetadata } from \"..\";\nimport { CreateOrganizationDto, UpdateOrganizationDto } from \"../../dtos\";\nimport { Endpoint } from \"../../endpoints\";\nimport { Event } from \"../event\";\nimport { EventTicket } from \"../event/ticket\";\nimport { User } from \"../users\";\n\nexport type Organization = {\n id: string;\n slug: string;\n identity: OrganizationIdentity;\n members: OrganizationMember[];\n location?: Location;\n events: Event[];\n savedTickets: EventTicket[];\n verified: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type OrganizationIdentity = Profile & {\n socialLinks: OrganizationSocialLink[];\n\n metadata: ProfileMetadata & {\n eventsCount: number;\n viewsCount: number;\n membersCount: number;\n };\n};\n\nexport type OrganizationSocialLink = {\n type: OrganizationSocialType;\n url: string;\n};\n\nexport enum OrganizationSocialType {\n Facebook = \"facebook\",\n Twitter = \"twitter\",\n Instagram = \"instagram\",\n Linkedin = \"linkedin\",\n Youtube = \"youtube\",\n Website = \"website\",\n}\n\nexport type OrganizationMember = {\n user: User;\n role: OrganizationMemberRole;\n status: OrganizationMemberStatus;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport enum OrganizationMemberStatus {\n PENDING = \"pending\",\n ACCEPTED = \"accepted\",\n REJECTED = \"rejected\",\n}\n\nexport enum OrganizationMemberRole {\n MEMBER = \"member\",\n MANAGER = \"manager\",\n ADMINISTRATOR = \"admin\",\n OWNER = \"owner\",\n}\n\nexport type OrganizationEndpoints =\n | Endpoint<\"GET\", \"/organizations\", Organization[]>\n | Endpoint<\"GET\", \"/organizations/:id\", Organization>\n | Endpoint<\"POST\", \"/organizations\", Organization, CreateOrganizationDto>\n | Endpoint<\"PUT\", \"/organizations/:id\", Organization, UpdateOrganizationDto>\n | Endpoint<\"DELETE\", \"/organizations/:id\", boolean>;\n","export type UserToken = {\n id: string;\n type: UserTokenType;\n value: string;\n createdAt: Date;\n expiresAt: Date;\n};\n\nexport enum UserTokenType {\n Authentication = \"authentication\",\n OrganizationInvite = \"organization_invite\",\n PasswordRecovery = \"password_recovery\",\n EmailValidation = \"email_validation\",\n PhoneValidation = \"phone_validation\",\n}\n","import { Currency, Language, Location, Profile, ProfileMetadata } from \"..\";\nimport { UpdateUserDto } from \"../../dtos\";\nimport { Endpoint } from \"../../endpoints\";\n\nexport type User = {\n id: string;\n identifier: UserIdentifier;\n password: string;\n identity: UserIdentity;\n role: UserRole;\n addresses: Location[];\n preferences: UserPreferences;\n connections: UserConnection[];\n verified: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type UserIdentifier = {\n email?: string;\n phoneNumber?: string;\n username: string;\n\n [key: string]: string | undefined;\n};\n\nexport type UserIdentity = Profile & {\n firstName: string;\n lastName: string;\n fullName: string;\n gender: UserIdentityGender;\n birthDate: Date;\n\n metadata: ProfileMetadata & {\n followingCount: number;\n hasPassPlus: boolean;\n idValid: boolean;\n };\n};\n\nexport enum UserRole {\n USER = 0,\n DEVELOPER = 8,\n ADMINISTRATOR = 10,\n}\n\nexport type UserIdentityGender =\n | \"male\"\n | \"female\"\n | \"non-binary\"\n | \"gender-fluid\"\n | \"neutral\"\n | \"other\"\n | string;\n\nexport type UserPreferences = {\n language: Language;\n currency: Currency;\n notifications: {\n email: {\n newsletter: boolean;\n message: boolean;\n };\n push: {\n message: boolean;\n };\n };\n};\n\nexport type UserConnection = {\n ip: string;\n os: UserConnectionOS;\n device: UserConnectionDevice;\n client: UserConnectionClient;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type UserConnectionOS = {\n name: string;\n version: string;\n};\n\nexport type UserConnectionDevice = {\n type: string;\n brand: string;\n};\n\nexport type UserConnectionClient = {\n name: string;\n version: string;\n};\n\nexport type UserEndpoints =\n | Endpoint<\"GET\", \"/users\", User[]>\n | Endpoint<\"GET\", \"/users/:id\", User, { id: string }>\n | Endpoint<\"GET\", \"/users/me\", User>\n | Endpoint<\n \"GET\",\n \"/users/check/:identifier\",\n {\n exists: boolean;\n identifier: UserIdentifier;\n suggestions?: string[];\n },\n { identifier: boolean; suggestions?: boolean }\n >\n | Endpoint<\"PUT\", \"/users/:id\", User, UpdateUserDto>;\n","import { Currency } from \"..\";\nimport { Event, EventTicket } from \"../event\";\nimport { User } from \"../users\";\n\nexport enum OrderStatus {\n Created = \"created\",\n Cancelled = \"cancelled\",\n Completed = \"completed\",\n Pending = \"pending\",\n Confirmed = \"confirmed\",\n Declined = \"declined\",\n Refunded = \"refunded\",\n PartiallyRefunded = \"partially_refunded\",\n Expired = \"expired\",\n}\n\nexport type OrderItem = {\n id: string;\n ticket: EventTicket;\n isUsed: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type Order = {\n id: string;\n owner: User;\n members: User[];\n status: OrderStatus;\n event: Event;\n items: OrderItem[];\n promoCode?: PromoCode;\n total: number;\n currency: Currency;\n createdAt: Date;\n};\n\nexport type PromoCode = {\n id: string;\n code: string;\n used: number;\n discount: number;\n isActive: boolean;\n expirationAt: Date;\n createdAt: Date;\n};\n","export * from \"./auth\";\nexport * from \"./careers\";\nexport * from \"./event\";\nexport * from \"./health\";\nexport * from \"./organizations\";\nexport * from \"./token\";\nexport * from \"./users\";\nexport * from \"./order\";\nexport * from \"./profiles\";\n\nexport type Location = {\n name?: string;\n address: string;\n zipCode: string;\n city: string;\n country: string;\n geometry?: {\n latitude: number;\n longitude: number;\n };\n};\n\n// Currency\nexport enum Currency {\n EUR = \"EUR\",\n USD = \"USD\",\n GBP = \"GBP\",\n}\n\n// I18n\nexport enum Language {\n FR = \"fr\",\n EN = \"en\",\n}\n","import { CreateOrganizationDto } from \"./create-organization.dto\";\n\nexport class UpdateOrganizationDto extends CreateOrganizationDto {}\n","import { Location, UserIdentifier, UserIdentityGender } from \"../../types\";\n\nexport class CreateUserDto {\n identifier: UserIdentifier;\n password: string;\n identity: CreateUserIdentituDto;\n addresses: Location[];\n}\n\nclass CreateUserIdentituDto {\n firstName: string;\n lastName: string;\n gender: UserIdentityGender;\n avatarUrl?: string;\n birthDate: Date;\n}\n","export class SignInUserDto {\n identifier: string;\n password: string;\n}\n","import { Type } from \"class-transformer\";\nimport {\n IsDateString,\n IsEmail,\n IsObject,\n IsOptional,\n IsPhoneNumber,\n IsString,\n IsUrl,\n Length,\n Matches,\n MaxLength,\n MinLength,\n ValidateNested,\n} from \"class-validator\";\n\nimport { NAME_REGEX } from \"../../../constants/regex\";\nimport { UserIdentifier, UserIdentity } from \"../../types\";\n\nexport class UpdateUserDto {\n @IsOptional()\n @IsObject()\n @ValidateNested()\n @Type(() => UpdateIdentifierDto)\n identifier?: UpdateIdentifierDto;\n\n @IsOptional()\n @IsObject()\n @ValidateNested()\n @Type(() => UpdateIdentityDto)\n identity?: UpdateIdentityDto;\n\n @IsOptional()\n @IsString()\n @MinLength(6)\n @MaxLength(130)\n password?: string;\n}\n\nclass UpdateIdentifierDto\n implements\n Partial<Pick<UserIdentifier, \"email\" | \"phoneNumber\" | \"username\">>\n{\n @IsOptional()\n @IsString()\n @IsEmail()\n email?: string;\n\n @IsOptional()\n @IsString()\n @IsPhoneNumber()\n phoneNumber?: string;\n\n @IsOptional()\n @IsString()\n @MinLength(3)\n username?: string;\n}\n\nclass UpdateIdentityDto\n implements\n Partial<\n Pick<\n UserIdentity,\n | \"firstName\"\n | \"lastName\"\n | \"displayName\"\n | \"description\"\n | \"avatarUrl\"\n | \"bannerUrl\"\n | \"gender\"\n | \"birthDate\"\n >\n >\n{\n @IsOptional()\n @IsString()\n @Length(2, 50)\n @Matches(NAME_REGEX, {\n message: \"First name must be composed of letters only\",\n })\n firstName?: string;\n\n @IsOptional()\n @IsString()\n @Length(2, 50)\n @Matches(NAME_REGEX, {\n message: \"Last name must be composed of letters only\",\n })\n lastName?: string;\n\n @IsOptional()\n @IsString()\n @Length(1, 32)\n displayName?: string;\n\n @IsOptional()\n @IsString()\n @Length(15, 500)\n description?: string;\n\n @IsOptional()\n @IsUrl()\n avatarUrl?: string | undefined;\n\n @IsOptional()\n @IsUrl()\n bannerUrl?: string | undefined;\n\n @IsOptional()\n gender?: string;\n\n @IsOptional()\n @IsDateString()\n birthDate?: Date;\n}\n","import axios, { Options, Response } from \"redaxios\";\n\nimport { isBrowser } from \"../../utils\";\nimport { APIResponse, ErroredAPIResponse } from \"../endpoints\";\n\nconst instance = axios.create({\n headers: {\n \"Content-Type\": \"application/json\",\n Accept: \"application/json\",\n ...(!isBrowser && { \"User-Agent\": \"tonightpass-api-client\" }),\n },\n responseType: \"json\",\n transformRequest: [\n function (data) {\n return JSON.stringify(data);\n },\n ],\n withCredentials: isBrowser,\n});\n\nexport interface APIRequestOptions extends Options {}\n\nexport const request = async <T>(url: string, options?: Options) => {\n const response = instance<APIResponse<T>>(url, { ...options })\n .then((response) => response)\n .catch((error: Response<ErroredAPIResponse>) => {\n throw error.data;\n });\n\n return response;\n};\n","export const isBrowser = typeof window !== \"undefined\";\n","import { ParamValue, Query, pathcat } from \"pathcat\";\nimport { Options, Response } from \"redaxios\";\n\nimport { APIResponse, Endpoints, ErroredAPIResponse } from \"./endpoints\";\nimport { APIRequestOptions, request } from \"./request\";\nimport { DEFAULT_API_URL } from \"../constants\";\n\nexport type PathsFor<M extends Options[\"method\"]> = Extract<\n Endpoints,\n { method: M }\n>[\"path\"];\n\nexport class TonightPassAPIError<T> extends Error {\n public readonly status: number;\n\n constructor(\n public readonly response: Response<APIResponse<T>>,\n public readonly data: ErroredAPIResponse,\n ) {\n super(data.message);\n\n this.status = response.status;\n }\n}\n\nexport interface ClientOptions {\n readonly baseURL: string;\n}\n\nexport class Client {\n private options;\n public readonly url;\n\n constructor(options: ClientOptions) {\n this.options = options;\n this.url = (path: string, params: Record<string, ParamValue>) => {\n const baseURL = this.options.baseURL || DEFAULT_API_URL;\n return pathcat(baseURL, path, params);\n };\n }\n\n setOptions(options: ClientOptions) {\n this.options = options;\n }\n\n async get<Path extends PathsFor<\"GET\">>(\n path: Path,\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"GET\" }>[\"res\"]\n >(\"GET\", path, undefined, query, options);\n }\n\n async post<Path extends Extract<Endpoints, { method: \"POST\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"POST\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"POST\" }>[\"res\"]\n >(\"POST\", path, body, query, options);\n }\n\n async put<Path extends Extract<Endpoints, { method: \"PUT\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"PUT\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"PUT\" }>[\"res\"]\n >(\"PUT\", path, body, query, options);\n }\n\n async patch<Path extends Extract<Endpoints, { method: \"PATCH\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"PATCH\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"PATCH\" }>[\"res\"]\n >(\"PATCH\", path, body, query, options);\n }\n\n async delete<Path extends Extract<Endpoints, { method: \"DELETE\" }>[\"path\"]>(\n path: Path,\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"DELETE\" }>[\"res\"]\n >(\"DELETE\", path, undefined, query, options);\n }\n\n private async requester<T>(\n method: Options[\"method\"],\n path: string,\n body: unknown,\n query: Query<string> = {},\n options: APIRequestOptions = {},\n ) {\n const url = this.url(path, query);\n\n if (body !== undefined) {\n if (method === \"GET\") {\n throw new Error(\"Cannot send a GET request with a body\");\n }\n }\n\n const response: Response<APIResponse<T>> = await request<T>(url, {\n method,\n data: body,\n ...options,\n });\n\n const result = response.data;\n\n if (!result.success) {\n throw new TonightPassAPIError<T>(response, result);\n }\n\n return result.data;\n }\n}\n","import { Client } from \"../rest\";\n\nexport function sdk<T>(builder: (client: Client) => T) {\n return builder;\n}\n","import { sdk } from \"./builder\";\nimport { CreateUserDto, SignInUserDto } from \"../rest\";\n\nexport const auth = sdk((client) => ({\n signIn: async (data: SignInUserDto) => client.post(\"/auth/sign-in\", data),\n signUp: async (data: CreateUserDto) => client.post(\"/auth/sign-up\", data),\n signOut: async () => client.post(\"/auth/sign-out\", null),\n refreshToken: async () => client.post(\"/auth/refresh-token\", null),\n}));\n","import { Query } from \"pathcat\";\n\nimport { sdk } from \"./builder\";\n\nexport const careers = sdk((client) => ({\n categories: {\n getAll: async (query?: Query<\"/careers/categories\">) =>\n client.get(\"/careers/categories\", query),\n },\n employmentTypes: {\n getAll: async (query?: Query<\"/careers/employmentTypes\">) =>\n client.get(\"/careers/employmentTypes\", query),\n },\n jobs: {\n getAll: async (query?: Query<\"/careers/jobs\">) =>\n client.get(\"/careers/jobs\", query),\n get: async (id: number) => client.get(\"/careers/jobs/:id\", { id }),\n },\n offices: {\n getAll: async (query?: Query<\"/careers/offices\">) =>\n client.get(\"/careers/offices\", query),\n },\n}));\n","import { sdk } from \"./builder\";\n\nexport const health = sdk((client) => ({\n database: async () => client.get(\"/health/database\"),\n http: async () => client.get(\"/health/http\"),\n}));\n","import { sdk } from \"./builder\";\nimport { CreateOrganizationDto, UpdateOrganizationDto } from \"../rest\";\n\nexport const organizations = sdk((client) => ({\n getAll: async () => client.get(\"/organizations\"),\n get: async (id: string) => client.get(\"/organizations/:id\", { id }),\n create: async (data: CreateOrganizationDto) =>\n client.post(\"/organizations\", data),\n update: async (id: string, data: UpdateOrganizationDto) =>\n client.put(\"/organizations/:id\", data, { id }),\n delete: async (id: string) => client.delete(\"/organizations/:id\", { id }),\n}));\n","import { sdk } from \"./builder\";\n\nexport const profiles = sdk((client) => ({\n get: async (username: string) =>\n client.get(\"/profiles/:username\", { username }),\n}));\n","import { sdk } from \"./builder\";\nimport { UpdateUserDto } from \"../rest\";\n\nexport const users = sdk((client) => ({\n getAll: async () => client.get(\"/users\"),\n get: async (id: string) => client.get(\"/users\", { id }),\n me: async () => client.get(\"/users/me\"),\n check: async (identifier: string, suggestions?: boolean) =>\n client.get(\"/users/check/:identifier\", { identifier, suggestions }),\n update: async (id: string, data: UpdateUserDto) =>\n client.put(\"/users/:id\", data, { id }),\n}));\n","import { Client, ClientOptions } from \"./rest\";\nimport { auth, careers, health, organizations, profiles, users } from \"./sdk\";\n\nexport class TonightPass {\n public readonly client: Client;\n\n public readonly auth;\n public readonly careers;\n public readonly health;\n public readonly organizations;\n public readonly profiles;\n public readonly users;\n\n constructor(options: ClientOptions) {\n this.client = new Client(options);\n\n this.auth = auth(this.client);\n this.careers = careers(this.client);\n this.health = health(this.client);\n this.organizations = organizations(this.client);\n this.profiles = profiles(this.client);\n this.users = users(this.client);\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tonightpass",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "@tonightpass sdk and tools.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"reflect-metadata": "^0.2.1"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@types/node": "20.12.
|
|
24
|
+
"@types/node": "20.12.4",
|
|
25
25
|
"tsx": "^4.7.1",
|
|
26
26
|
"typescript": "^5.0.0"
|
|
27
27
|
},
|
package/src/rest/dtos/index.ts
CHANGED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ArrayMinSize,
|
|
3
|
+
IsArray,
|
|
4
|
+
IsEnum,
|
|
5
|
+
IsNotEmpty,
|
|
6
|
+
IsObject,
|
|
7
|
+
IsString,
|
|
8
|
+
IsUrl,
|
|
9
|
+
Length,
|
|
10
|
+
} from "class-validator";
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
Location,
|
|
14
|
+
OrganizationMemberRole,
|
|
15
|
+
OrganizationSocialLink,
|
|
16
|
+
} from "../../types";
|
|
17
|
+
|
|
18
|
+
export class CreateOrganizationDto {
|
|
19
|
+
@IsString()
|
|
20
|
+
@Length(1, 128)
|
|
21
|
+
slug?: string;
|
|
22
|
+
|
|
23
|
+
@IsObject()
|
|
24
|
+
identity: CreateOrganizationIdentityDto;
|
|
25
|
+
|
|
26
|
+
@IsArray()
|
|
27
|
+
@ArrayMinSize(1)
|
|
28
|
+
members: OrganizationMemberDto[];
|
|
29
|
+
|
|
30
|
+
@IsObject()
|
|
31
|
+
location?: Location;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
class CreateOrganizationIdentityDto {
|
|
35
|
+
@IsString()
|
|
36
|
+
@IsNotEmpty()
|
|
37
|
+
@Length(1, 32)
|
|
38
|
+
displayName: string;
|
|
39
|
+
|
|
40
|
+
@IsString()
|
|
41
|
+
@IsNotEmpty()
|
|
42
|
+
@Length(16, 1024)
|
|
43
|
+
description: string;
|
|
44
|
+
|
|
45
|
+
@IsUrl({
|
|
46
|
+
protocols: ["http", "https"],
|
|
47
|
+
})
|
|
48
|
+
avatarUrl?: string;
|
|
49
|
+
|
|
50
|
+
@IsUrl({
|
|
51
|
+
protocols: ["http", "https"],
|
|
52
|
+
})
|
|
53
|
+
bannerUrl?: string;
|
|
54
|
+
|
|
55
|
+
@IsArray()
|
|
56
|
+
socialLinks?: OrganizationSocialLink[];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
class OrganizationMemberDto {
|
|
60
|
+
@IsString()
|
|
61
|
+
@IsNotEmpty()
|
|
62
|
+
user: string;
|
|
63
|
+
|
|
64
|
+
@IsEnum(OrganizationMemberRole)
|
|
65
|
+
@IsNotEmpty()
|
|
66
|
+
role: OrganizationMemberRole;
|
|
67
|
+
}
|
|
@@ -66,7 +66,7 @@ class UpdateIdentityDto
|
|
|
66
66
|
| "lastName"
|
|
67
67
|
| "displayName"
|
|
68
68
|
| "description"
|
|
69
|
-
| "
|
|
69
|
+
| "avatarUrl"
|
|
70
70
|
| "bannerUrl"
|
|
71
71
|
| "gender"
|
|
72
72
|
| "birthDate"
|
|
@@ -101,7 +101,7 @@ class UpdateIdentityDto
|
|
|
101
101
|
|
|
102
102
|
@IsOptional()
|
|
103
103
|
@IsUrl()
|
|
104
|
-
|
|
104
|
+
avatarUrl?: string | undefined;
|
|
105
105
|
|
|
106
106
|
@IsOptional()
|
|
107
107
|
@IsUrl()
|
package/src/rest/endpoints.ts
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
AuthEndpoints,
|
|
5
5
|
CareersEndpoints,
|
|
6
6
|
HealthEndpoints,
|
|
7
|
+
OrganizationEndpoints,
|
|
7
8
|
ProfileEndpoints,
|
|
8
9
|
UserEndpoints,
|
|
9
10
|
} from "./types";
|
|
@@ -39,5 +40,6 @@ export type Endpoints =
|
|
|
39
40
|
| AuthEndpoints
|
|
40
41
|
| CareersEndpoints
|
|
41
42
|
| HealthEndpoints
|
|
43
|
+
| OrganizationEndpoints
|
|
42
44
|
| ProfileEndpoints
|
|
43
45
|
| UserEndpoints;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Location, Profile, ProfileMetadata } from "..";
|
|
2
|
+
import { CreateOrganizationDto, UpdateOrganizationDto } from "../../dtos";
|
|
3
|
+
import { Endpoint } from "../../endpoints";
|
|
2
4
|
import { Event } from "../event";
|
|
3
5
|
import { EventTicket } from "../event/ticket";
|
|
4
6
|
import { User } from "../users";
|
|
@@ -43,12 +45,27 @@ export enum OrganizationSocialType {
|
|
|
43
45
|
export type OrganizationMember = {
|
|
44
46
|
user: User;
|
|
45
47
|
role: OrganizationMemberRole;
|
|
48
|
+
status: OrganizationMemberStatus;
|
|
49
|
+
updatedAt: Date;
|
|
46
50
|
createdAt: Date;
|
|
47
51
|
};
|
|
48
52
|
|
|
53
|
+
export enum OrganizationMemberStatus {
|
|
54
|
+
PENDING = "pending",
|
|
55
|
+
ACCEPTED = "accepted",
|
|
56
|
+
REJECTED = "rejected",
|
|
57
|
+
}
|
|
58
|
+
|
|
49
59
|
export enum OrganizationMemberRole {
|
|
50
|
-
|
|
51
|
-
MANAGER =
|
|
52
|
-
ADMINISTRATOR =
|
|
53
|
-
OWNER =
|
|
60
|
+
MEMBER = "member",
|
|
61
|
+
MANAGER = "manager",
|
|
62
|
+
ADMINISTRATOR = "admin",
|
|
63
|
+
OWNER = "owner",
|
|
54
64
|
}
|
|
65
|
+
|
|
66
|
+
export type OrganizationEndpoints =
|
|
67
|
+
| Endpoint<"GET", "/organizations", Organization[]>
|
|
68
|
+
| Endpoint<"GET", "/organizations/:id", Organization>
|
|
69
|
+
| Endpoint<"POST", "/organizations", Organization, CreateOrganizationDto>
|
|
70
|
+
| Endpoint<"PUT", "/organizations/:id", Organization, UpdateOrganizationDto>
|
|
71
|
+
| Endpoint<"DELETE", "/organizations/:id", boolean>;
|
package/src/sdk/index.ts
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { sdk } from "./builder";
|
|
2
|
+
import { CreateOrganizationDto, UpdateOrganizationDto } from "../rest";
|
|
3
|
+
|
|
4
|
+
export const organizations = sdk((client) => ({
|
|
5
|
+
getAll: async () => client.get("/organizations"),
|
|
6
|
+
get: async (id: string) => client.get("/organizations/:id", { id }),
|
|
7
|
+
create: async (data: CreateOrganizationDto) =>
|
|
8
|
+
client.post("/organizations", data),
|
|
9
|
+
update: async (id: string, data: UpdateOrganizationDto) =>
|
|
10
|
+
client.put("/organizations/:id", data, { id }),
|
|
11
|
+
delete: async (id: string) => client.delete("/organizations/:id", { id }),
|
|
12
|
+
}));
|
package/src/tonightpass.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { Client, ClientOptions } from "./rest";
|
|
2
|
-
import { auth } from "./sdk
|
|
3
|
-
import { careers } from "./sdk/careers";
|
|
4
|
-
import { health } from "./sdk/health";
|
|
5
|
-
import { profiles } from "./sdk/profiles";
|
|
6
|
-
import { users } from "./sdk/users";
|
|
2
|
+
import { auth, careers, health, organizations, profiles, users } from "./sdk";
|
|
7
3
|
|
|
8
4
|
export class TonightPass {
|
|
9
5
|
public readonly client: Client;
|
|
@@ -11,6 +7,7 @@ export class TonightPass {
|
|
|
11
7
|
public readonly auth;
|
|
12
8
|
public readonly careers;
|
|
13
9
|
public readonly health;
|
|
10
|
+
public readonly organizations;
|
|
14
11
|
public readonly profiles;
|
|
15
12
|
public readonly users;
|
|
16
13
|
|
|
@@ -20,6 +17,7 @@ export class TonightPass {
|
|
|
20
17
|
this.auth = auth(this.client);
|
|
21
18
|
this.careers = careers(this.client);
|
|
22
19
|
this.health = health(this.client);
|
|
20
|
+
this.organizations = organizations(this.client);
|
|
23
21
|
this.profiles = profiles(this.client);
|
|
24
22
|
this.users = users(this.client);
|
|
25
23
|
}
|