tonightpass 0.0.7 → 0.0.9
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 +89 -14
- package/dist/index.d.ts +89 -14
- package/dist/index.js +38 -32
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/rest/dtos/index.ts +1 -0
- package/src/rest/dtos/organizations/create-organization.dto.ts +51 -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/auth/index.ts +2 -2
- package/src/rest/types/organizations/index.ts +9 -0
- package/src/rest/types/profiles/index.ts +1 -1
- package/src/sdk/auth.ts +2 -2
- 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.9 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
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
13
|
-
[32mCJS[39m [1mdist/index.js.map [22m[
|
|
14
|
-
[32mCJS[39m ⚡️ Build success in
|
|
15
|
-
[32mESM[39m [1mdist/index.mjs [22m[
|
|
16
|
-
[32mESM[39m [1mdist/index.mjs.map [22m[
|
|
17
|
-
[32mESM[39m ⚡️ Build success in
|
|
12
|
+
[32mCJS[39m [1mdist/index.js [22m[32m8.86 KB[39m
|
|
13
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m28.90 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 303ms
|
|
15
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m7.79 KB[39m
|
|
16
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m28.90 KB[39m
|
|
17
|
+
[32mESM[39m ⚡️ Build success in 304ms
|
|
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 2532ms
|
|
20
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m21.71 KB[39m
|
|
21
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m21.71 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# tonightpass
|
|
2
2
|
|
|
3
|
+
## 0.0.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`8f8bd1b`](https://github.com/tonightpass/tonightpass/commit/8f8bd1b21c684389c44c7b9ef4be3452061260e1) Thanks [@AntoineKM](https://github.com/AntoineKM)! - Add organizations sdk
|
|
8
|
+
|
|
9
|
+
## 0.0.8
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`d009e78`](https://github.com/tonightpass/tonightpass/commit/d009e7808d5874915dc7a40e244330a8c164cdff) Thanks [@AntoineKM](https://github.com/AntoineKM)! - Fix empty auth post requests
|
|
14
|
+
|
|
3
15
|
## 0.0.7
|
|
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;
|
|
@@ -114,7 +114,7 @@ type UserEndpoints = Endpoint<"GET", "/users", User[]> | Endpoint<"GET", "/users
|
|
|
114
114
|
suggestions?: boolean;
|
|
115
115
|
}> | Endpoint<"PUT", "/users/:id", User, UpdateUserDto>;
|
|
116
116
|
|
|
117
|
-
type AuthEndpoints = Endpoint<"POST", "/auth/sign-up", User, CreateUserDto> | Endpoint<"POST", "/auth/sign-in", User, SignInUserDto> | Endpoint<"POST", "/auth/sign-out",
|
|
117
|
+
type AuthEndpoints = Endpoint<"POST", "/auth/sign-up", User, CreateUserDto> | Endpoint<"POST", "/auth/sign-in", User, SignInUserDto> | Endpoint<"POST", "/auth/sign-out", null, null> | Endpoint<"POST", "/auth/refresh-token", null, null>;
|
|
118
118
|
|
|
119
119
|
type CareersOffice = {
|
|
120
120
|
id: number | null;
|
|
@@ -251,6 +251,7 @@ declare enum OrganizationMemberRole {
|
|
|
251
251
|
ADMINISTRATOR = 2,
|
|
252
252
|
OWNER = 3
|
|
253
253
|
}
|
|
254
|
+
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
255
|
|
|
255
256
|
type Event = {
|
|
256
257
|
title: string;
|
|
@@ -376,7 +377,7 @@ interface Profile {
|
|
|
376
377
|
type: "user" | "organization";
|
|
377
378
|
displayName: string;
|
|
378
379
|
description: string;
|
|
379
|
-
|
|
380
|
+
avatarUrl?: string;
|
|
380
381
|
bannerUrl?: string;
|
|
381
382
|
metadata: ProfileMetadata;
|
|
382
383
|
createdAt: Date;
|
|
@@ -410,6 +411,23 @@ declare enum Language {
|
|
|
410
411
|
EN = "en"
|
|
411
412
|
}
|
|
412
413
|
|
|
414
|
+
declare class CreateOrganizationDto {
|
|
415
|
+
slug: string;
|
|
416
|
+
identity: CreateOrganizationIdentityDto;
|
|
417
|
+
members: OrganizationMember[];
|
|
418
|
+
location?: Location;
|
|
419
|
+
}
|
|
420
|
+
declare class CreateOrganizationIdentityDto {
|
|
421
|
+
displayName: string;
|
|
422
|
+
description: string;
|
|
423
|
+
avatarUrl?: string;
|
|
424
|
+
bannerUrl?: string;
|
|
425
|
+
socialLinks: OrganizationSocialLink[];
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
declare class UpdateOrganizationDto extends CreateOrganizationDto {
|
|
429
|
+
}
|
|
430
|
+
|
|
413
431
|
declare class CreateUserDto {
|
|
414
432
|
identifier: UserIdentifier;
|
|
415
433
|
password: string;
|
|
@@ -420,7 +438,7 @@ declare class CreateUserIdentituDto {
|
|
|
420
438
|
firstName: string;
|
|
421
439
|
lastName: string;
|
|
422
440
|
gender: UserIdentityGender;
|
|
423
|
-
|
|
441
|
+
avatarUrl?: string;
|
|
424
442
|
birthDate: Date;
|
|
425
443
|
}
|
|
426
444
|
|
|
@@ -439,12 +457,12 @@ declare class UpdateIdentifierDto implements Partial<Pick<UserIdentifier, "email
|
|
|
439
457
|
phoneNumber?: string;
|
|
440
458
|
username?: string;
|
|
441
459
|
}
|
|
442
|
-
declare class UpdateIdentityDto implements Partial<Pick<UserIdentity, "firstName" | "lastName" | "displayName" | "description" | "
|
|
460
|
+
declare class UpdateIdentityDto implements Partial<Pick<UserIdentity, "firstName" | "lastName" | "displayName" | "description" | "avatarUrl" | "bannerUrl" | "gender" | "birthDate">> {
|
|
443
461
|
firstName?: string;
|
|
444
462
|
lastName?: string;
|
|
445
463
|
displayName?: string;
|
|
446
464
|
description?: string;
|
|
447
|
-
|
|
465
|
+
avatarUrl?: string | undefined;
|
|
448
466
|
bannerUrl?: string | undefined;
|
|
449
467
|
gender?: string;
|
|
450
468
|
birthDate?: Date;
|
|
@@ -515,6 +533,12 @@ declare class Client {
|
|
|
515
533
|
}> | Extract<Endpoint<"GET", "/health/http", Health<"app">>, {
|
|
516
534
|
path: Path;
|
|
517
535
|
method: "GET";
|
|
536
|
+
}> | Extract<Endpoint<"GET", "/organizations", Organization[]>, {
|
|
537
|
+
path: Path;
|
|
538
|
+
method: "GET";
|
|
539
|
+
}> | Extract<Endpoint<"GET", "/organizations/:id", Organization>, {
|
|
540
|
+
path: Path;
|
|
541
|
+
method: "GET";
|
|
518
542
|
}> | Extract<ProfileEndpoints, {
|
|
519
543
|
path: Path;
|
|
520
544
|
method: "GET";
|
|
@@ -551,10 +575,13 @@ declare class Client {
|
|
|
551
575
|
}> | Extract<Endpoint<"POST", "/auth/sign-in", User, SignInUserDto>, {
|
|
552
576
|
path: Path;
|
|
553
577
|
method: "POST";
|
|
554
|
-
}> | Extract<Endpoint<"POST", "/auth/sign-out",
|
|
578
|
+
}> | Extract<Endpoint<"POST", "/auth/sign-out", null, null>, {
|
|
579
|
+
path: Path;
|
|
580
|
+
method: "POST";
|
|
581
|
+
}> | Extract<Endpoint<"POST", "/auth/refresh-token", null, null>, {
|
|
555
582
|
path: Path;
|
|
556
583
|
method: "POST";
|
|
557
|
-
}> | Extract<Endpoint<"POST", "/
|
|
584
|
+
}> | Extract<Endpoint<"POST", "/organizations", Organization, CreateOrganizationDto>, {
|
|
558
585
|
path: Path;
|
|
559
586
|
method: "POST";
|
|
560
587
|
}>)["res"]>;
|
|
@@ -563,10 +590,13 @@ declare class Client {
|
|
|
563
590
|
}>["path"]>(path: Path, body: Extract<Endpoints, {
|
|
564
591
|
path: Path;
|
|
565
592
|
method: "PUT";
|
|
566
|
-
}>["body"], query?: Query<Path>, options?: APIRequestOptions): Promise<Extract<Endpoint<"PUT", "/
|
|
593
|
+
}>["body"], query?: Query<Path>, options?: APIRequestOptions): Promise<(Extract<Endpoint<"PUT", "/organizations/:id", Organization, UpdateOrganizationDto>, {
|
|
567
594
|
path: Path;
|
|
568
595
|
method: "PUT";
|
|
569
|
-
}>
|
|
596
|
+
}> | Extract<Endpoint<"PUT", "/users/:id", User, UpdateUserDto>, {
|
|
597
|
+
path: Path;
|
|
598
|
+
method: "PUT";
|
|
599
|
+
}>)["res"]>;
|
|
570
600
|
patch<Path extends Extract<Endpoints, {
|
|
571
601
|
method: "PATCH";
|
|
572
602
|
}>["path"]>(path: Path, body: Extract<Endpoints, {
|
|
@@ -575,10 +605,36 @@ declare class Client {
|
|
|
575
605
|
}>["body"], query?: Query<Path>, options?: APIRequestOptions): Promise<never>;
|
|
576
606
|
delete<Path extends Extract<Endpoints, {
|
|
577
607
|
method: "DELETE";
|
|
578
|
-
}>["path"]>(path: Path, query?: Query<Path>, options?: APIRequestOptions): Promise<
|
|
608
|
+
}>["path"]>(path: Path, query?: Query<Path>, options?: APIRequestOptions): Promise<Extract<Endpoint<"DELETE", "/organizations/:id", boolean>, {
|
|
609
|
+
path: Path;
|
|
610
|
+
method: "DELETE";
|
|
611
|
+
}>["res"]>;
|
|
579
612
|
private requester;
|
|
580
613
|
}
|
|
581
614
|
|
|
615
|
+
declare const auth: (client: Client) => {
|
|
616
|
+
signIn: (data: SignInUserDto) => Promise<User>;
|
|
617
|
+
signUp: (data: CreateUserDto) => Promise<User>;
|
|
618
|
+
signOut: () => Promise<null>;
|
|
619
|
+
refreshToken: () => Promise<null>;
|
|
620
|
+
};
|
|
621
|
+
|
|
622
|
+
declare const careers: (client: Client) => {
|
|
623
|
+
categories: {
|
|
624
|
+
getAll: (query?: Query<"/careers/categories">) => Promise<CareersCategory[]>;
|
|
625
|
+
};
|
|
626
|
+
employmentTypes: {
|
|
627
|
+
getAll: (query?: Query<"/careers/employmentTypes">) => Promise<CareersEmploymentType[]>;
|
|
628
|
+
};
|
|
629
|
+
jobs: {
|
|
630
|
+
getAll: (query?: Query<"/careers/jobs">) => Promise<CareersJob[]>;
|
|
631
|
+
get: (id: number) => Promise<CareersJob>;
|
|
632
|
+
};
|
|
633
|
+
offices: {
|
|
634
|
+
getAll: (query?: Query<"/careers/offices">) => Promise<CareersOffice[]>;
|
|
635
|
+
};
|
|
636
|
+
};
|
|
637
|
+
|
|
582
638
|
declare function sdk<T>(builder: (client: Client) => T): (client: Client) => T;
|
|
583
639
|
|
|
584
640
|
declare const health: (client: Client) => {
|
|
@@ -586,6 +642,18 @@ declare const health: (client: Client) => {
|
|
|
586
642
|
http: () => Promise<Health<"app">>;
|
|
587
643
|
};
|
|
588
644
|
|
|
645
|
+
declare const organizations: (client: Client) => {
|
|
646
|
+
getAll: () => Promise<Organization[]>;
|
|
647
|
+
get: (id: string) => Promise<Organization>;
|
|
648
|
+
create: (data: CreateOrganizationDto) => Promise<Organization>;
|
|
649
|
+
update: (id: string, data: UpdateOrganizationDto) => Promise<Organization>;
|
|
650
|
+
delete: (id: string) => Promise<boolean>;
|
|
651
|
+
};
|
|
652
|
+
|
|
653
|
+
declare const profiles: (client: Client) => {
|
|
654
|
+
get: (username: string) => Promise<UserIdentity>;
|
|
655
|
+
};
|
|
656
|
+
|
|
589
657
|
declare const users: (client: Client) => {
|
|
590
658
|
getAll: () => Promise<User[]>;
|
|
591
659
|
get: (id: string) => Promise<User[]>;
|
|
@@ -603,8 +671,8 @@ declare class TonightPass {
|
|
|
603
671
|
readonly auth: {
|
|
604
672
|
signIn: (data: SignInUserDto) => Promise<User>;
|
|
605
673
|
signUp: (data: CreateUserDto) => Promise<User>;
|
|
606
|
-
signOut: () => Promise<
|
|
607
|
-
refreshToken: () => Promise<
|
|
674
|
+
signOut: () => Promise<null>;
|
|
675
|
+
refreshToken: () => Promise<null>;
|
|
608
676
|
};
|
|
609
677
|
readonly careers: {
|
|
610
678
|
categories: {
|
|
@@ -625,6 +693,13 @@ declare class TonightPass {
|
|
|
625
693
|
database: () => Promise<Health<"database">>;
|
|
626
694
|
http: () => Promise<Health<"app">>;
|
|
627
695
|
};
|
|
696
|
+
readonly organizations: {
|
|
697
|
+
getAll: () => Promise<Organization[]>;
|
|
698
|
+
get: (id: string) => Promise<Organization>;
|
|
699
|
+
create: (data: CreateOrganizationDto) => Promise<Organization>;
|
|
700
|
+
update: (id: string, data: UpdateOrganizationDto) => Promise<Organization>;
|
|
701
|
+
delete: (id: string) => Promise<boolean>;
|
|
702
|
+
};
|
|
628
703
|
readonly profiles: {
|
|
629
704
|
get: (username: string) => Promise<UserIdentity>;
|
|
630
705
|
};
|
|
@@ -644,4 +719,4 @@ declare class TonightPass {
|
|
|
644
719
|
|
|
645
720
|
declare const isBrowser: boolean;
|
|
646
721
|
|
|
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 };
|
|
722
|
+
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, 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;
|
|
@@ -114,7 +114,7 @@ type UserEndpoints = Endpoint<"GET", "/users", User[]> | Endpoint<"GET", "/users
|
|
|
114
114
|
suggestions?: boolean;
|
|
115
115
|
}> | Endpoint<"PUT", "/users/:id", User, UpdateUserDto>;
|
|
116
116
|
|
|
117
|
-
type AuthEndpoints = Endpoint<"POST", "/auth/sign-up", User, CreateUserDto> | Endpoint<"POST", "/auth/sign-in", User, SignInUserDto> | Endpoint<"POST", "/auth/sign-out",
|
|
117
|
+
type AuthEndpoints = Endpoint<"POST", "/auth/sign-up", User, CreateUserDto> | Endpoint<"POST", "/auth/sign-in", User, SignInUserDto> | Endpoint<"POST", "/auth/sign-out", null, null> | Endpoint<"POST", "/auth/refresh-token", null, null>;
|
|
118
118
|
|
|
119
119
|
type CareersOffice = {
|
|
120
120
|
id: number | null;
|
|
@@ -251,6 +251,7 @@ declare enum OrganizationMemberRole {
|
|
|
251
251
|
ADMINISTRATOR = 2,
|
|
252
252
|
OWNER = 3
|
|
253
253
|
}
|
|
254
|
+
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
255
|
|
|
255
256
|
type Event = {
|
|
256
257
|
title: string;
|
|
@@ -376,7 +377,7 @@ interface Profile {
|
|
|
376
377
|
type: "user" | "organization";
|
|
377
378
|
displayName: string;
|
|
378
379
|
description: string;
|
|
379
|
-
|
|
380
|
+
avatarUrl?: string;
|
|
380
381
|
bannerUrl?: string;
|
|
381
382
|
metadata: ProfileMetadata;
|
|
382
383
|
createdAt: Date;
|
|
@@ -410,6 +411,23 @@ declare enum Language {
|
|
|
410
411
|
EN = "en"
|
|
411
412
|
}
|
|
412
413
|
|
|
414
|
+
declare class CreateOrganizationDto {
|
|
415
|
+
slug: string;
|
|
416
|
+
identity: CreateOrganizationIdentityDto;
|
|
417
|
+
members: OrganizationMember[];
|
|
418
|
+
location?: Location;
|
|
419
|
+
}
|
|
420
|
+
declare class CreateOrganizationIdentityDto {
|
|
421
|
+
displayName: string;
|
|
422
|
+
description: string;
|
|
423
|
+
avatarUrl?: string;
|
|
424
|
+
bannerUrl?: string;
|
|
425
|
+
socialLinks: OrganizationSocialLink[];
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
declare class UpdateOrganizationDto extends CreateOrganizationDto {
|
|
429
|
+
}
|
|
430
|
+
|
|
413
431
|
declare class CreateUserDto {
|
|
414
432
|
identifier: UserIdentifier;
|
|
415
433
|
password: string;
|
|
@@ -420,7 +438,7 @@ declare class CreateUserIdentituDto {
|
|
|
420
438
|
firstName: string;
|
|
421
439
|
lastName: string;
|
|
422
440
|
gender: UserIdentityGender;
|
|
423
|
-
|
|
441
|
+
avatarUrl?: string;
|
|
424
442
|
birthDate: Date;
|
|
425
443
|
}
|
|
426
444
|
|
|
@@ -439,12 +457,12 @@ declare class UpdateIdentifierDto implements Partial<Pick<UserIdentifier, "email
|
|
|
439
457
|
phoneNumber?: string;
|
|
440
458
|
username?: string;
|
|
441
459
|
}
|
|
442
|
-
declare class UpdateIdentityDto implements Partial<Pick<UserIdentity, "firstName" | "lastName" | "displayName" | "description" | "
|
|
460
|
+
declare class UpdateIdentityDto implements Partial<Pick<UserIdentity, "firstName" | "lastName" | "displayName" | "description" | "avatarUrl" | "bannerUrl" | "gender" | "birthDate">> {
|
|
443
461
|
firstName?: string;
|
|
444
462
|
lastName?: string;
|
|
445
463
|
displayName?: string;
|
|
446
464
|
description?: string;
|
|
447
|
-
|
|
465
|
+
avatarUrl?: string | undefined;
|
|
448
466
|
bannerUrl?: string | undefined;
|
|
449
467
|
gender?: string;
|
|
450
468
|
birthDate?: Date;
|
|
@@ -515,6 +533,12 @@ declare class Client {
|
|
|
515
533
|
}> | Extract<Endpoint<"GET", "/health/http", Health<"app">>, {
|
|
516
534
|
path: Path;
|
|
517
535
|
method: "GET";
|
|
536
|
+
}> | Extract<Endpoint<"GET", "/organizations", Organization[]>, {
|
|
537
|
+
path: Path;
|
|
538
|
+
method: "GET";
|
|
539
|
+
}> | Extract<Endpoint<"GET", "/organizations/:id", Organization>, {
|
|
540
|
+
path: Path;
|
|
541
|
+
method: "GET";
|
|
518
542
|
}> | Extract<ProfileEndpoints, {
|
|
519
543
|
path: Path;
|
|
520
544
|
method: "GET";
|
|
@@ -551,10 +575,13 @@ declare class Client {
|
|
|
551
575
|
}> | Extract<Endpoint<"POST", "/auth/sign-in", User, SignInUserDto>, {
|
|
552
576
|
path: Path;
|
|
553
577
|
method: "POST";
|
|
554
|
-
}> | Extract<Endpoint<"POST", "/auth/sign-out",
|
|
578
|
+
}> | Extract<Endpoint<"POST", "/auth/sign-out", null, null>, {
|
|
579
|
+
path: Path;
|
|
580
|
+
method: "POST";
|
|
581
|
+
}> | Extract<Endpoint<"POST", "/auth/refresh-token", null, null>, {
|
|
555
582
|
path: Path;
|
|
556
583
|
method: "POST";
|
|
557
|
-
}> | Extract<Endpoint<"POST", "/
|
|
584
|
+
}> | Extract<Endpoint<"POST", "/organizations", Organization, CreateOrganizationDto>, {
|
|
558
585
|
path: Path;
|
|
559
586
|
method: "POST";
|
|
560
587
|
}>)["res"]>;
|
|
@@ -563,10 +590,13 @@ declare class Client {
|
|
|
563
590
|
}>["path"]>(path: Path, body: Extract<Endpoints, {
|
|
564
591
|
path: Path;
|
|
565
592
|
method: "PUT";
|
|
566
|
-
}>["body"], query?: Query<Path>, options?: APIRequestOptions): Promise<Extract<Endpoint<"PUT", "/
|
|
593
|
+
}>["body"], query?: Query<Path>, options?: APIRequestOptions): Promise<(Extract<Endpoint<"PUT", "/organizations/:id", Organization, UpdateOrganizationDto>, {
|
|
567
594
|
path: Path;
|
|
568
595
|
method: "PUT";
|
|
569
|
-
}>
|
|
596
|
+
}> | Extract<Endpoint<"PUT", "/users/:id", User, UpdateUserDto>, {
|
|
597
|
+
path: Path;
|
|
598
|
+
method: "PUT";
|
|
599
|
+
}>)["res"]>;
|
|
570
600
|
patch<Path extends Extract<Endpoints, {
|
|
571
601
|
method: "PATCH";
|
|
572
602
|
}>["path"]>(path: Path, body: Extract<Endpoints, {
|
|
@@ -575,10 +605,36 @@ declare class Client {
|
|
|
575
605
|
}>["body"], query?: Query<Path>, options?: APIRequestOptions): Promise<never>;
|
|
576
606
|
delete<Path extends Extract<Endpoints, {
|
|
577
607
|
method: "DELETE";
|
|
578
|
-
}>["path"]>(path: Path, query?: Query<Path>, options?: APIRequestOptions): Promise<
|
|
608
|
+
}>["path"]>(path: Path, query?: Query<Path>, options?: APIRequestOptions): Promise<Extract<Endpoint<"DELETE", "/organizations/:id", boolean>, {
|
|
609
|
+
path: Path;
|
|
610
|
+
method: "DELETE";
|
|
611
|
+
}>["res"]>;
|
|
579
612
|
private requester;
|
|
580
613
|
}
|
|
581
614
|
|
|
615
|
+
declare const auth: (client: Client) => {
|
|
616
|
+
signIn: (data: SignInUserDto) => Promise<User>;
|
|
617
|
+
signUp: (data: CreateUserDto) => Promise<User>;
|
|
618
|
+
signOut: () => Promise<null>;
|
|
619
|
+
refreshToken: () => Promise<null>;
|
|
620
|
+
};
|
|
621
|
+
|
|
622
|
+
declare const careers: (client: Client) => {
|
|
623
|
+
categories: {
|
|
624
|
+
getAll: (query?: Query<"/careers/categories">) => Promise<CareersCategory[]>;
|
|
625
|
+
};
|
|
626
|
+
employmentTypes: {
|
|
627
|
+
getAll: (query?: Query<"/careers/employmentTypes">) => Promise<CareersEmploymentType[]>;
|
|
628
|
+
};
|
|
629
|
+
jobs: {
|
|
630
|
+
getAll: (query?: Query<"/careers/jobs">) => Promise<CareersJob[]>;
|
|
631
|
+
get: (id: number) => Promise<CareersJob>;
|
|
632
|
+
};
|
|
633
|
+
offices: {
|
|
634
|
+
getAll: (query?: Query<"/careers/offices">) => Promise<CareersOffice[]>;
|
|
635
|
+
};
|
|
636
|
+
};
|
|
637
|
+
|
|
582
638
|
declare function sdk<T>(builder: (client: Client) => T): (client: Client) => T;
|
|
583
639
|
|
|
584
640
|
declare const health: (client: Client) => {
|
|
@@ -586,6 +642,18 @@ declare const health: (client: Client) => {
|
|
|
586
642
|
http: () => Promise<Health<"app">>;
|
|
587
643
|
};
|
|
588
644
|
|
|
645
|
+
declare const organizations: (client: Client) => {
|
|
646
|
+
getAll: () => Promise<Organization[]>;
|
|
647
|
+
get: (id: string) => Promise<Organization>;
|
|
648
|
+
create: (data: CreateOrganizationDto) => Promise<Organization>;
|
|
649
|
+
update: (id: string, data: UpdateOrganizationDto) => Promise<Organization>;
|
|
650
|
+
delete: (id: string) => Promise<boolean>;
|
|
651
|
+
};
|
|
652
|
+
|
|
653
|
+
declare const profiles: (client: Client) => {
|
|
654
|
+
get: (username: string) => Promise<UserIdentity>;
|
|
655
|
+
};
|
|
656
|
+
|
|
589
657
|
declare const users: (client: Client) => {
|
|
590
658
|
getAll: () => Promise<User[]>;
|
|
591
659
|
get: (id: string) => Promise<User[]>;
|
|
@@ -603,8 +671,8 @@ declare class TonightPass {
|
|
|
603
671
|
readonly auth: {
|
|
604
672
|
signIn: (data: SignInUserDto) => Promise<User>;
|
|
605
673
|
signUp: (data: CreateUserDto) => Promise<User>;
|
|
606
|
-
signOut: () => Promise<
|
|
607
|
-
refreshToken: () => Promise<
|
|
674
|
+
signOut: () => Promise<null>;
|
|
675
|
+
refreshToken: () => Promise<null>;
|
|
608
676
|
};
|
|
609
677
|
readonly careers: {
|
|
610
678
|
categories: {
|
|
@@ -625,6 +693,13 @@ declare class TonightPass {
|
|
|
625
693
|
database: () => Promise<Health<"database">>;
|
|
626
694
|
http: () => Promise<Health<"app">>;
|
|
627
695
|
};
|
|
696
|
+
readonly organizations: {
|
|
697
|
+
getAll: () => Promise<Organization[]>;
|
|
698
|
+
get: (id: string) => Promise<Organization>;
|
|
699
|
+
create: (data: CreateOrganizationDto) => Promise<Organization>;
|
|
700
|
+
update: (id: string, data: UpdateOrganizationDto) => Promise<Organization>;
|
|
701
|
+
delete: (id: string) => Promise<boolean>;
|
|
702
|
+
};
|
|
628
703
|
readonly profiles: {
|
|
629
704
|
get: (username: string) => Promise<UserIdentity>;
|
|
630
705
|
};
|
|
@@ -644,4 +719,4 @@ declare class TonightPass {
|
|
|
644
719
|
|
|
645
720
|
declare const isBrowser: boolean;
|
|
646
721
|
|
|
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 };
|
|
722
|
+
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, 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,51 @@
|
|
|
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 te = 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 te__default = /*#__PURE__*/_interopDefault(te);
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var W=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var n=(t,e,o,r)=>{for(var s=r>1?void 0:r?K(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&&W(e,o,s),s};var D="https://api.tonightpass.com";var he=/^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$/,xe=/((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/,A=/(^[\p{L}\d'\\.\s\\-]*$)/u,Ee=/^[a-z\d]+(?:(\.|-|_)[a-z\d]+)*$/,ye=/\$2[abxy]?\$\d{1,2}\$[A-Za-z\d\\./]{53}/,Pe=/^\s*(?:\+?(\d{1,3}))?([-. (]*(\d{3})[-. )]*)?((\d{3})[-. ]*(\d{2,4})(?:[-.x ]*(\d+))?)\s*$/,be=/(((http:\/\/www)|(http:\/\/)|(www))[-a-zA-Z0-9@:%_\\+.~#?&//=]+)\.(jpg|jpeg|gif|png|bmp|tiff|tga|svg)/i;var l=class{slug;identity;members;location};n([classValidator.IsString(),classValidator.IsNotEmpty()],l.prototype,"slug",2),n([classValidator.IsObject()],l.prototype,"identity",2),n([classValidator.IsArray()],l.prototype,"members",2),n([classValidator.IsObject()],l.prototype,"location",2);var f=class{displayName;description;avatarUrl;bannerUrl;socialLinks};n([classValidator.IsString(),classValidator.IsNotEmpty()],f.prototype,"displayName",2),n([classValidator.IsString(),classValidator.IsNotEmpty()],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 N=class extends l{};var G=class{identifier;password;identity;addresses};var z=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(A,{message:"First name must be composed of letters only"})],d.prototype,"firstName",2),n([classValidator.IsOptional(),classValidator.IsString(),classValidator.Length(2,50),classValidator.Matches(A,{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 R=typeof window<"u";var re=te__default.default.create({headers:{"Content-Type":"application/json",Accept:"application/json",...!R&&{"User-Agent":"tonightpass-api-client"}},responseType:"json",transformRequest:[function(t){return JSON.stringify(t)}],withCredentials:R}),j=async(t,e)=>re(t,{...e}).then(r=>r).catch(r=>{throw r.data});var oe=(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))(oe||{});var se=(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))(se||{}),ne=(a=>(a.Music="music",a.Dress="dress",a.Sport="sport",a.Food="food",a.Art="art",a))(ne||{});var ie=(m=>(m.Facebook="facebook",m.Twitter="twitter",m.Instagram="instagram",m.Linkedin="linkedin",m.Youtube="youtube",m.Website="website",m))(ie||{}),ae=(s=>(s[s.EMPLOYEE=0]="EMPLOYEE",s[s.MANAGER=1]="MANAGER",s[s.ADMINISTRATOR=2]="ADMINISTRATOR",s[s.OWNER=3]="OWNER",s))(ae||{});var pe=(a=>(a.Authentication="authentication",a.OrganizationInvite="organization_invite",a.PasswordRecovery="password_recovery",a.EmailValidation="email_validation",a.PhoneValidation="phone_validation",a))(pe||{});var me=(r=>(r[r.USER=0]="USER",r[r.DEVELOPER=8]="DEVELOPER",r[r.ADMINISTRATOR=10]="ADMINISTRATOR",r))(me||{});var de=(u=>(u.Created="created",u.Cancelled="cancelled",u.Completed="completed",u.Pending="pending",u.Confirmed="confirmed",u.Declined="declined",u.Refunded="refunded",u.PartiallyRefunded="partially_refunded",u.Expired="expired",u))(de||{});var ce=(r=>(r.EUR="EUR",r.USD="USD",r.GBP="GBP",r))(ce||{}),ue=(o=>(o.FR="fr",o.EN="en",o))(ue||{});var O=class extends Error{constructor(o,r){super(r.message);this.response=o;this.data=r;this.status=o.status;}status},P=class{options;url;constructor(e){this.options=e,this.url=(o,r)=>{let s=this.options.baseURL||D;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 L=await j(m,{method:e,data:r,...a}),b=L.data;if(!b.success)throw new O(L,b);return b.data}};function x(t){return t}var Q=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 F=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 H=t=>({database:async()=>t.get("/health/database"),http:async()=>t.get("/health/http")});var V=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 $=t=>({get:async e=>t.get("/profiles/:username",{username:e})});var B=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 X=class{client;auth;careers;health;organizations;profiles;users;constructor(e){this.client=new P(e),this.auth=Q(this.client),this.careers=F(this.client),this.health=H(this.client),this.organizations=V(this.client),this.profiles=$(this.client),this.users=B(this.client);}};
|
|
14
14
|
|
|
15
|
-
exports.BCRYPT_HASH =
|
|
15
|
+
exports.BCRYPT_HASH = ye;
|
|
16
16
|
exports.Client = P;
|
|
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.
|
|
17
|
+
exports.CreateOrganizationDto = l;
|
|
18
|
+
exports.CreateUserDto = G;
|
|
19
|
+
exports.Currency = ce;
|
|
20
|
+
exports.DEFAULT_API_URL = D;
|
|
21
|
+
exports.EMAIL_REGEX = he;
|
|
22
|
+
exports.EventStyleType = ne;
|
|
23
|
+
exports.EventTicketCategory = oe;
|
|
24
|
+
exports.EventType = se;
|
|
25
|
+
exports.IMAGE_URL_REGEX = be;
|
|
26
|
+
exports.Language = ue;
|
|
27
|
+
exports.NAME_REGEX = A;
|
|
28
|
+
exports.OrderStatus = de;
|
|
29
|
+
exports.OrganizationMemberRole = ae;
|
|
30
|
+
exports.OrganizationSocialType = ie;
|
|
31
|
+
exports.PASSWORD_REGEX = xe;
|
|
32
|
+
exports.PHONE_NUMBER_REGEX = Pe;
|
|
33
|
+
exports.SLUG_REGEX = Ee;
|
|
34
|
+
exports.SignInUserDto = z;
|
|
35
|
+
exports.TonightPass = X;
|
|
36
|
+
exports.TonightPassAPIError = O;
|
|
37
|
+
exports.UpdateOrganizationDto = N;
|
|
38
|
+
exports.UpdateUserDto = E;
|
|
39
|
+
exports.UserRole = me;
|
|
40
|
+
exports.UserTokenType = pe;
|
|
41
|
+
exports.auth = Q;
|
|
42
|
+
exports.careers = F;
|
|
43
|
+
exports.health = H;
|
|
44
|
+
exports.isBrowser = R;
|
|
45
|
+
exports.organizations = V;
|
|
46
|
+
exports.profiles = $;
|
|
47
|
+
exports.request = j;
|
|
48
|
+
exports.sdk = x;
|
|
49
|
+
exports.users = B;
|
|
44
50
|
//# sourceMappingURL=out.js.map
|
|
45
51
|
//# 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,iBAAAC,EACA,YAAAC,EACA,SAAAC,EACA,UAAAC,EACA,WAAAC,EACA,aAAAC,EACA,aAAAC,EACA,kBAAAC,MACK,kBAKA,IAAMC,EAAN,KAAoB,CAKzB,WAMA,SAMA,QACF,EAbEC,EAAA,CAJCV,EAAW,EACXD,EAAS,EACTS,EAAe,EACfZ,EAAK,IAAMe,CAAmB,GAJpBF,EAKX,0BAMAC,EAAA,CAJCV,EAAW,EACXD,EA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-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\", undefined),\n refreshToken: async () => client.post(\"/auth/refresh-token\", undefined),\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/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/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/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","IsArray","IsNotEmpty","IsObject","IsString","IsUrl","CreateOrganizationDto","__decorateClass","CreateOrganizationIdentityDto","UpdateOrganizationDto","CreateUserDto","SignInUserDto","Type","IsDateString","IsEmail","IsOptional","IsPhoneNumber","Length","Matches","MaxLength","MinLength","ValidateNested","UpdateUserDto","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","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,WAAAC,EACA,cAAAC,EACA,YAAAC,EACA,YAAAC,EACA,SAAAC,MACK,kBAQA,IAAMC,EAAN,KAA4B,CAGjC,KAGA,SAGA,QAGA,QACF,EAVEC,EAAA,CAFCH,EAAS,EACTF,EAAW,GAFDI,EAGX,oBAGAC,EAAA,CADCJ,EAAS,GALCG,EAMX,wBAGAC,EAAA,CADCN,EAAQ,GAREK,EASX,uBAGAC,EAAA,CADCJ,EAAS,GAXCG,EAYX,wBAGF,IAAME,EAAN,KAAoC,CAGlC,YAIA,YAKA,UAKA,UAGA,WACF,EAlBED,EAAA,CAFCH,EAAS,EACTF,EAAW,GAFRM,EAGJ,2BAIAD,EAAA,CAFCH,EAAS,EACTF,EAAW,GANRM,EAOJ,2BAKAD,EAAA,CAHCF,EAAM,CACL,UAAW,CAAC,OAAQ,OAAO,CAC7B,CAAC,GAXGG,EAYJ,yBAKAD,EAAA,CAHCF,EAAM,CACL,UAAW,CAAC,OAAQ,OAAO,CAC7B,CAAC,GAhBGG,EAiBJ,yBAGAD,EAAA,CADCN,EAAQ,GAnBLO,EAoBJ,2BC/CK,IAAMC,EAAN,cAAoCH,CAAsB,CAAC,ECA3D,IAAMI,EAAN,KAAoB,CACzB,WACA,SACA,SAC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,EAAO,IAAI,sBAAuB,CAAE,SAAAM,CAAS,CAAC,CAClD,GCFO,IAAMC,EAAaP,IAAY,CACpC,OAAQ,SAAYA,EAAO,IAAI,QAAQ,EACvC,IAAK,MAAOE,GAAeF,EAAO,IAAI,SAAU,CAAE,GAAAE,CAAG,CAAC,EACtD,GAAI,SAAYF,EAAO,IAAI,WAAW,EACtC,MAAO,MAAOQ,EAAoBC,IAChCT,EAAO,IAAI,2BAA4B,CAAE,WAAAQ,EAAY,YAAAC,CAAY,CAAC,EACpE,OAAQ,MAAOP,EAAY/B,IACzB6B,EAAO,IAAI,aAAc7B,EAAM,CAAE,GAAA+B,CAAG,CAAC,CACzC,GCRO,IAAMQ,EAAN,KAAkB,CACP,OAEA,KACA,QACA,OACA,cACA,SACA,MAEhB,YAAYpC,EAAwB,CAClC,KAAK,OAAS,IAAIe,EAAOf,CAAO,EAEhC,KAAK,KAAOyB,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 IsArray,\n IsNotEmpty,\n IsObject,\n IsString,\n IsUrl,\n} from \"class-validator\";\n\nimport {\n Location,\n OrganizationMember,\n OrganizationSocialLink,\n} from \"../../types\";\n\nexport class CreateOrganizationDto {\n @IsString()\n @IsNotEmpty()\n slug: string;\n\n @IsObject()\n identity: CreateOrganizationIdentityDto;\n\n @IsArray()\n members: OrganizationMember[];\n\n @IsObject()\n location?: Location;\n}\n\nclass CreateOrganizationIdentityDto {\n @IsString()\n @IsNotEmpty()\n displayName: string;\n\n @IsString()\n @IsNotEmpty()\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","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 { 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 createdAt: Date;\n};\n\nexport enum OrganizationMemberRole {\n EMPLOYEE = 0,\n MANAGER = 1,\n ADMINISTRATOR = 2,\n OWNER = 3,\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 { 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, IsNotEmpty, IsObject, IsArray, IsUrl, IsOptional, ValidateNested, MinLength, MaxLength, IsEmail, IsPhoneNumber, Length, Matches, IsDateString } from 'class-validator';
|
|
2
3
|
import { Type } from 'class-transformer';
|
|
3
|
-
import
|
|
4
|
-
import $ from 'redaxios';
|
|
4
|
+
import te from 'redaxios';
|
|
5
5
|
import { pathcat } from 'pathcat';
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var W=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var n=(t,e,o,r)=>{for(var s=r>1?void 0:r?K(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&&W(e,o,s),s};var D="https://api.tonightpass.com";var he=/^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$/,xe=/((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/,A=/(^[\p{L}\d'\\.\s\\-]*$)/u,Ee=/^[a-z\d]+(?:(\.|-|_)[a-z\d]+)*$/,ye=/\$2[abxy]?\$\d{1,2}\$[A-Za-z\d\\./]{53}/,Pe=/^\s*(?:\+?(\d{1,3}))?([-. (]*(\d{3})[-. )]*)?((\d{3})[-. ]*(\d{2,4})(?:[-.x ]*(\d+))?)\s*$/,be=/(((http:\/\/www)|(http:\/\/)|(www))[-a-zA-Z0-9@:%_\\+.~#?&//=]+)\.(jpg|jpeg|gif|png|bmp|tiff|tga|svg)/i;var l=class{slug;identity;members;location};n([IsString(),IsNotEmpty()],l.prototype,"slug",2),n([IsObject()],l.prototype,"identity",2),n([IsArray()],l.prototype,"members",2),n([IsObject()],l.prototype,"location",2);var f=class{displayName;description;avatarUrl;bannerUrl;socialLinks};n([IsString(),IsNotEmpty()],f.prototype,"displayName",2),n([IsString(),IsNotEmpty()],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 N=class extends l{};var G=class{identifier;password;identity;addresses};var z=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(A,{message:"First name must be composed of letters only"})],d.prototype,"firstName",2),n([IsOptional(),IsString(),Length(2,50),Matches(A,{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 R=typeof window<"u";var re=te.create({headers:{"Content-Type":"application/json",Accept:"application/json",...!R&&{"User-Agent":"tonightpass-api-client"}},responseType:"json",transformRequest:[function(t){return JSON.stringify(t)}],withCredentials:R}),j=async(t,e)=>re(t,{...e}).then(r=>r).catch(r=>{throw r.data});var oe=(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))(oe||{});var se=(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))(se||{}),ne=(a=>(a.Music="music",a.Dress="dress",a.Sport="sport",a.Food="food",a.Art="art",a))(ne||{});var ie=(m=>(m.Facebook="facebook",m.Twitter="twitter",m.Instagram="instagram",m.Linkedin="linkedin",m.Youtube="youtube",m.Website="website",m))(ie||{}),ae=(s=>(s[s.EMPLOYEE=0]="EMPLOYEE",s[s.MANAGER=1]="MANAGER",s[s.ADMINISTRATOR=2]="ADMINISTRATOR",s[s.OWNER=3]="OWNER",s))(ae||{});var pe=(a=>(a.Authentication="authentication",a.OrganizationInvite="organization_invite",a.PasswordRecovery="password_recovery",a.EmailValidation="email_validation",a.PhoneValidation="phone_validation",a))(pe||{});var me=(r=>(r[r.USER=0]="USER",r[r.DEVELOPER=8]="DEVELOPER",r[r.ADMINISTRATOR=10]="ADMINISTRATOR",r))(me||{});var de=(u=>(u.Created="created",u.Cancelled="cancelled",u.Completed="completed",u.Pending="pending",u.Confirmed="confirmed",u.Declined="declined",u.Refunded="refunded",u.PartiallyRefunded="partially_refunded",u.Expired="expired",u))(de||{});var ce=(r=>(r.EUR="EUR",r.USD="USD",r.GBP="GBP",r))(ce||{}),ue=(o=>(o.FR="fr",o.EN="en",o))(ue||{});var O=class extends Error{constructor(o,r){super(r.message);this.response=o;this.data=r;this.status=o.status;}status},P=class{options;url;constructor(e){this.options=e,this.url=(o,r)=>{let s=this.options.baseURL||D;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 L=await j(m,{method:e,data:r,...a}),b=L.data;if(!b.success)throw new O(L,b);return b.data}};function x(t){return t}var Q=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 F=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 H=t=>({database:async()=>t.get("/health/database"),http:async()=>t.get("/health/http")});var V=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 $=t=>({get:async e=>t.get("/profiles/:username",{username:e})});var B=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 X=class{client;auth;careers;health;organizations;profiles;users;constructor(e){this.client=new P(e),this.auth=Q(this.client),this.careers=F(this.client),this.health=H(this.client),this.organizations=V(this.client),this.profiles=$(this.client),this.users=B(this.client);}};
|
|
8
8
|
|
|
9
|
-
export {
|
|
9
|
+
export { ye as BCRYPT_HASH, P as Client, l as CreateOrganizationDto, G as CreateUserDto, ce as Currency, D as DEFAULT_API_URL, he as EMAIL_REGEX, ne as EventStyleType, oe as EventTicketCategory, se as EventType, be as IMAGE_URL_REGEX, ue as Language, A as NAME_REGEX, de as OrderStatus, ae as OrganizationMemberRole, ie as OrganizationSocialType, xe as PASSWORD_REGEX, Pe as PHONE_NUMBER_REGEX, Ee as SLUG_REGEX, z as SignInUserDto, X as TonightPass, O as TonightPassAPIError, N as UpdateOrganizationDto, E as UpdateUserDto, me as UserRole, pe as UserTokenType, Q as auth, F as careers, H as health, R as isBrowser, V as organizations, $ as profiles, j as request, x as sdk, B 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":"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,iBAAAC,EACA,YAAAC,EACA,SAAAC,EACA,UAAAC,EACA,WAAAC,EACA,aAAAC,EACA,aAAAC,EACA,kBAAAC,MACK,kBAKA,IAAMC,EAAN,KAAoB,CAKzB,WAMA,SAMA,QACF,EAbEC,EAAA,CAJCV,EAAW,EACXD,EAAS,EACTS,EAAe,EACfZ,EAAK,IAAMe,CAAmB,GAJpBF,EAKX,0BAMAC,EAAA,CAJCV,EAAW,EACXD,EAAS,EACTS,EAAe,EACfZ,EAAK,IAAMgB,CAAiB,GAVlBH,EAWX,wBAMAC,EAAA,CAJCV,EAAW,EACXE,EAAS,EACTK,EAAU,CAAC,EACXD,EAAU,GAAG,GAhBHG,EAiBX,wBAGF,IAAME,EAAN,KAGA,CAIE,MAKA,YAKA,QACF,EAXED,EAAA,CAHCV,EAAW,EACXE,EAAS,EACTJ,EAAQ,GANLa,EAOJ,qBAKAD,EAAA,CAHCV,EAAW,EACXE,EAAS,EACTD,EAAc,GAXXU,EAYJ,2BAKAD,EAAA,CAHCV,EAAW,EACXE,EAAS,EACTK,EAAU,CAAC,GAhBRI,EAiBJ,wBAGF,IAAMC,EAAN,KAeA,CAOE,UAQA,SAKA,YAKA,YAIA,kBAIA,UAGA,OAIA,SACF,EAlCEF,EAAA,CAN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ACA,KAAM,CACJ,OAAQ,MAAOA,GACbO,EAAO,IAAI,gBAAiBP,CAAK,EACnC,IAAK,MAAOS,GAAeF,EAAO,IAAI,oBAAqB,CAAE,GAAAE,CAAG,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\", undefined),\n refreshToken: async () => client.post(\"/auth/refresh-token\", undefined),\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/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/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/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","IsArray","IsNotEmpty","IsObject","IsString","IsUrl","CreateOrganizationDto","__decorateClass","CreateOrganizationIdentityDto","UpdateOrganizationDto","CreateUserDto","SignInUserDto","Type","IsDateString","IsEmail","IsOptional","IsPhoneNumber","Length","Matches","MaxLength","MinLength","ValidateNested","UpdateUserDto","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","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,WAAAC,EACA,cAAAC,EACA,YAAAC,EAC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B,CAClC,KAAK,OAAS,IAAIe,EAAOf,CAAO,EAEhC,KAAK,KAAOyB,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 IsArray,\n IsNotEmpty,\n IsObject,\n IsString,\n IsUrl,\n} from \"class-validator\";\n\nimport {\n Location,\n OrganizationMember,\n OrganizationSocialLink,\n} from \"../../types\";\n\nexport class CreateOrganizationDto {\n @IsString()\n @IsNotEmpty()\n slug: string;\n\n @IsObject()\n identity: CreateOrganizationIdentityDto;\n\n @IsArray()\n members: OrganizationMember[];\n\n @IsObject()\n location?: Location;\n}\n\nclass CreateOrganizationIdentityDto {\n @IsString()\n @IsNotEmpty()\n displayName: string;\n\n @IsString()\n @IsNotEmpty()\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","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 { 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 createdAt: Date;\n};\n\nexport enum OrganizationMemberRole {\n EMPLOYEE = 0,\n MANAGER = 1,\n ADMINISTRATOR = 2,\n OWNER = 3,\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 { 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
package/src/rest/dtos/index.ts
CHANGED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IsArray,
|
|
3
|
+
IsNotEmpty,
|
|
4
|
+
IsObject,
|
|
5
|
+
IsString,
|
|
6
|
+
IsUrl,
|
|
7
|
+
} from "class-validator";
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
Location,
|
|
11
|
+
OrganizationMember,
|
|
12
|
+
OrganizationSocialLink,
|
|
13
|
+
} from "../../types";
|
|
14
|
+
|
|
15
|
+
export class CreateOrganizationDto {
|
|
16
|
+
@IsString()
|
|
17
|
+
@IsNotEmpty()
|
|
18
|
+
slug: string;
|
|
19
|
+
|
|
20
|
+
@IsObject()
|
|
21
|
+
identity: CreateOrganizationIdentityDto;
|
|
22
|
+
|
|
23
|
+
@IsArray()
|
|
24
|
+
members: OrganizationMember[];
|
|
25
|
+
|
|
26
|
+
@IsObject()
|
|
27
|
+
location?: Location;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
class CreateOrganizationIdentityDto {
|
|
31
|
+
@IsString()
|
|
32
|
+
@IsNotEmpty()
|
|
33
|
+
displayName: string;
|
|
34
|
+
|
|
35
|
+
@IsString()
|
|
36
|
+
@IsNotEmpty()
|
|
37
|
+
description: string;
|
|
38
|
+
|
|
39
|
+
@IsUrl({
|
|
40
|
+
protocols: ["http", "https"],
|
|
41
|
+
})
|
|
42
|
+
avatarUrl?: string;
|
|
43
|
+
|
|
44
|
+
@IsUrl({
|
|
45
|
+
protocols: ["http", "https"],
|
|
46
|
+
})
|
|
47
|
+
bannerUrl?: string;
|
|
48
|
+
|
|
49
|
+
@IsArray()
|
|
50
|
+
socialLinks: OrganizationSocialLink[];
|
|
51
|
+
}
|
|
@@ -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;
|
|
@@ -5,5 +5,5 @@ import { User } from "../users";
|
|
|
5
5
|
export type AuthEndpoints =
|
|
6
6
|
| Endpoint<"POST", "/auth/sign-up", User, CreateUserDto>
|
|
7
7
|
| Endpoint<"POST", "/auth/sign-in", User, SignInUserDto>
|
|
8
|
-
| Endpoint<"POST", "/auth/sign-out",
|
|
9
|
-
| Endpoint<"POST", "/auth/refresh-token",
|
|
8
|
+
| Endpoint<"POST", "/auth/sign-out", null, null>
|
|
9
|
+
| Endpoint<"POST", "/auth/refresh-token", null, null>;
|
|
@@ -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";
|
|
@@ -52,3 +54,10 @@ export enum OrganizationMemberRole {
|
|
|
52
54
|
ADMINISTRATOR = 2,
|
|
53
55
|
OWNER = 3,
|
|
54
56
|
}
|
|
57
|
+
|
|
58
|
+
export type OrganizationEndpoints =
|
|
59
|
+
| Endpoint<"GET", "/organizations", Organization[]>
|
|
60
|
+
| Endpoint<"GET", "/organizations/:id", Organization>
|
|
61
|
+
| Endpoint<"POST", "/organizations", Organization, CreateOrganizationDto>
|
|
62
|
+
| Endpoint<"PUT", "/organizations/:id", Organization, UpdateOrganizationDto>
|
|
63
|
+
| Endpoint<"DELETE", "/organizations/:id", boolean>;
|
package/src/sdk/auth.ts
CHANGED
|
@@ -4,6 +4,6 @@ import { CreateUserDto, SignInUserDto } from "../rest";
|
|
|
4
4
|
export const auth = sdk((client) => ({
|
|
5
5
|
signIn: async (data: SignInUserDto) => client.post("/auth/sign-in", data),
|
|
6
6
|
signUp: async (data: CreateUserDto) => client.post("/auth/sign-up", data),
|
|
7
|
-
signOut: async () => client.post("/auth/sign-out",
|
|
8
|
-
refreshToken: async () => client.post("/auth/refresh-token",
|
|
7
|
+
signOut: async () => client.post("/auth/sign-out", null),
|
|
8
|
+
refreshToken: async () => client.post("/auth/refresh-token", null),
|
|
9
9
|
}));
|
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
|
}
|