tonightpass 0.0.48 → 0.0.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/.turbo/turbo-build.log +18 -18
  2. package/CHANGELOG.md +16 -0
  3. package/dist/index.d.mts +129 -79
  4. package/dist/index.d.ts +129 -79
  5. package/dist/index.js +32 -33
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +5 -5
  8. package/dist/index.mjs.map +1 -1
  9. package/package.json +2 -2
  10. package/src/constants/regex.ts +23 -20
  11. package/src/rest/dtos/organizations/create-organization.dto.ts +1 -1
  12. package/src/rest/dtos/organizations/events/carts/create-organization-event-cart.dto.ts +8 -0
  13. package/src/rest/dtos/organizations/events/carts/index.ts +2 -0
  14. package/src/rest/dtos/organizations/events/carts/update-organization-event-cart.dto.ts +3 -0
  15. package/src/rest/dtos/organizations/events/index.ts +4 -1
  16. package/src/rest/dtos/users/update-user.dto.ts +3 -3
  17. package/src/rest/types/careers/index.ts +1 -1
  18. package/src/rest/types/organizations/events/carts/index.ts +42 -0
  19. package/src/rest/types/organizations/events/index.ts +5 -2
  20. package/src/rest/types/organizations/events/styles/index.ts +4 -4
  21. package/src/rest/types/organizations/events/tickets/index.ts +5 -5
  22. package/src/rest/types/organizations/index.ts +11 -6
  23. package/src/rest/types/organizations/members/index.ts +8 -3
  24. package/src/rest/types/users/index.ts +2 -2
  25. package/src/sdk/careers.ts +1 -1
  26. package/src/sdk/organizations/billing/index.ts +14 -9
  27. package/src/sdk/organizations/events/carts/index.ts +50 -0
  28. package/src/sdk/organizations/events/index.ts +18 -7
  29. package/src/sdk/organizations/events/styles/index.ts +9 -7
  30. package/src/sdk/organizations/events/tickets/index.ts +31 -20
  31. package/src/sdk/organizations/index.ts +8 -5
  32. package/src/sdk/organizations/members/index.ts +2 -2
  33. package/src/sdk/users.ts +2 -2
  34. package/tests/index.ts +2 -1
  35. package/tests/regex/index.ts +76 -0
  36. /package/src/rest/dtos/organizations/events/{events → styles}/create-organization-event-style.dto.ts +0 -0
  37. /package/src/rest/dtos/organizations/events/{events → styles}/index.ts +0 -0
  38. /package/src/rest/dtos/organizations/events/{events → styles}/update-organization-event-style.dto.ts +0 -0
@@ -14,7 +14,7 @@ import {
14
14
  ValidateNested,
15
15
  } from "class-validator";
16
16
 
17
- import { NAME_REGEX } from "../../../constants/regex";
17
+ import { REGEX } from "../../../constants/regex";
18
18
  import { UserIdentifier, UserIdentity } from "../../types";
19
19
 
20
20
  export class UpdateUserDto {
@@ -76,7 +76,7 @@ class UpdateIdentityDto
76
76
  @IsOptional()
77
77
  @IsString()
78
78
  @Length(2, 32)
79
- @Matches(NAME_REGEX, {
79
+ @Matches(REGEX.NAME, {
80
80
  message: "First name must be composed of letters only",
81
81
  })
82
82
  firstName?: string;
@@ -84,7 +84,7 @@ class UpdateIdentityDto
84
84
  @IsOptional()
85
85
  @IsString()
86
86
  @Length(2, 32)
87
- @Matches(NAME_REGEX, {
87
+ @Matches(REGEX.NAME, {
88
88
  message: "Last name must be composed of letters only",
89
89
  })
90
90
  lastName?: string;
@@ -73,7 +73,7 @@ export type CareersEndpoints =
73
73
  externalId?: string;
74
74
  }
75
75
  >
76
- | Endpoint<"GET", "/careers/jobs/:id", CareersJob, { id: number }>
76
+ | Endpoint<"GET", "/careers/jobs/:jobId", CareersJob, { jobId: number }>
77
77
  | Endpoint<
78
78
  "GET",
79
79
  "/careers/offices",
@@ -0,0 +1,42 @@
1
+ import { OrganizationEvent, OrganizationEventTicket } from "..";
2
+ import { ArrayOptions, ArrayResult } from "../../..";
3
+ import {
4
+ CreateOrganizationEventCartDto,
5
+ UpdateOrganizationEventCartDto,
6
+ } from "../../../../dtos";
7
+ import { Endpoint } from "../../../../endpoints";
8
+
9
+ export type OrganizationEventCart = {
10
+ organizationEvent: OrganizationEvent;
11
+ tickets: OrganizationEventCartTicket[];
12
+ };
13
+
14
+ export type OrganizationEventCartTicket = {
15
+ ticket: OrganizationEventTicket;
16
+ quantity: number;
17
+ };
18
+
19
+ export type OrganizationEventCartEndpoints =
20
+ | Endpoint<
21
+ "GET",
22
+ "/organizations/:organizationSlug/events/:eventSlug/carts",
23
+ ArrayResult<OrganizationEventCart>,
24
+ ArrayOptions<OrganizationEventCart>
25
+ >
26
+ | Endpoint<
27
+ "GET",
28
+ "/organizations/:organizationSlug/events/:eventSlug/carts/:cartId",
29
+ OrganizationEventCart
30
+ >
31
+ | Endpoint<
32
+ "POST",
33
+ "/organizations/:organizationSlug/events/:eventSlug/carts",
34
+ OrganizationEventCart,
35
+ CreateOrganizationEventCartDto
36
+ >
37
+ | Endpoint<
38
+ "PUT",
39
+ "/organizations/:organizationSlug/events/:eventSlug/carts/:cartId",
40
+ OrganizationEventCart,
41
+ UpdateOrganizationEventCartDto
42
+ >;
@@ -1,3 +1,4 @@
1
+ import { OrganizationEventCartEndpoints } from "./carts";
1
2
  import {
2
3
  OrganizationEventStyle,
3
4
  OrganizationEventStyleEndpoints,
@@ -14,6 +15,7 @@ import {
14
15
  } from "../../../dtos";
15
16
  import { Endpoint } from "../../../endpoints";
16
17
 
18
+ export * from "./carts";
17
19
  export * from "./tickets";
18
20
  export * from "./styles";
19
21
 
@@ -87,7 +89,7 @@ export type OrganizationEventEndpoints =
87
89
  >
88
90
  | Endpoint<
89
91
  "GET",
90
- "/organizations/:slug/events",
92
+ "/organizations/:organizationSlug/events",
91
93
  ArrayResult<OrganizationEvent>,
92
94
  ArrayOptions<OrganizationEvent>
93
95
  >
@@ -98,7 +100,7 @@ export type OrganizationEventEndpoints =
98
100
  >
99
101
  | Endpoint<
100
102
  "POST",
101
- "/organizations/:slug/events",
103
+ "/organizations/:organizationSlug/events",
102
104
  OrganizationEvent,
103
105
  CreateOrganizationEventDto
104
106
  >
@@ -114,5 +116,6 @@ export type OrganizationEventEndpoints =
114
116
  OrganizationEvent,
115
117
  null
116
118
  >
119
+ | OrganizationEventCartEndpoints
117
120
  | OrganizationEventStyleEndpoints
118
121
  | OrganizationEventTicketEndpoints;
@@ -2,7 +2,7 @@ import { Base } from "../../..";
2
2
  import {
3
3
  CreateOrganizationEventStyleDto,
4
4
  UpdateOrganizationEventStyleDto,
5
- } from "../../../../dtos/organizations/events/events";
5
+ } from "../../../../dtos/organizations/events/styles";
6
6
  import { Endpoint } from "../../../../endpoints";
7
7
 
8
8
  export type OrganizationEventStyle = Base & {
@@ -24,7 +24,7 @@ export type OrganizationEventStyleEndpoints =
24
24
  | Endpoint<"GET", "/organizations/events/styles", OrganizationEventStyle[]>
25
25
  | Endpoint<
26
26
  "GET",
27
- "/organizations/events/styles/:slug",
27
+ "/organizations/events/styles/:styleSlug",
28
28
  OrganizationEventStyle
29
29
  >
30
30
  | Endpoint<
@@ -35,13 +35,13 @@ export type OrganizationEventStyleEndpoints =
35
35
  >
36
36
  | Endpoint<
37
37
  "PUT",
38
- "/organizations/events/styles/:slug",
38
+ "/organizations/events/styles/:styleSlug",
39
39
  OrganizationEventStyle,
40
40
  UpdateOrganizationEventStyleDto
41
41
  >
42
42
  | Endpoint<
43
43
  "DELETE",
44
- "/organizations/events/styles/:slug",
44
+ "/organizations/events/styles/:styleSlug",
45
45
  OrganizationEventStyle[],
46
46
  null
47
47
  >;
@@ -43,29 +43,29 @@ export enum OrganizationEventTicketCategory {
43
43
  export type OrganizationEventTicketEndpoints =
44
44
  | Endpoint<
45
45
  "GET",
46
- "/organizations/:slug/events/:eventSlug/tickets",
46
+ "/organizations/:organizationSlug/events/:eventSlug/tickets",
47
47
  OrganizationEventTicket[]
48
48
  >
49
49
  | Endpoint<
50
50
  "GET",
51
- "/organizations/:slug/events/:eventSlug/tickets/:ticketId",
51
+ "/organizations/:organizationSlug/events/:eventSlug/tickets/:ticketId",
52
52
  OrganizationEventTicket
53
53
  >
54
54
  | Endpoint<
55
55
  "POST",
56
- "/organizations/:slug/events/:eventSlug/tickets",
56
+ "/organizations/:organizationSlug/events/:eventSlug/tickets",
57
57
  OrganizationEventTicket,
58
58
  CreateOrganizationEventTicketDto
59
59
  >
60
60
  | Endpoint<
61
61
  "PUT",
62
- "/organizations/:slug/events/:eventSlug/tickets/:ticketId",
62
+ "/organizations/:organizationSlug/events/:eventSlug/tickets/:ticketId",
63
63
  OrganizationEventTicket,
64
64
  UpdateOrganizationEventTicketDto
65
65
  >
66
66
  | Endpoint<
67
67
  "DELETE",
68
- "/organizations/:slug/events/:eventSlug/tickets/:ticketId",
68
+ "/organizations/:organizationSlug/events/:eventSlug/tickets/:ticketId",
69
69
  OrganizationEventTicket[],
70
70
  null
71
71
  >;
@@ -53,16 +53,21 @@ export enum OrganizationSocialType {
53
53
 
54
54
  export type OrganizationEndpoints =
55
55
  | Endpoint<"GET", "/organizations", Organization[]>
56
- | Endpoint<"GET", "/organizations/:slug", Organization>
56
+ | Endpoint<"GET", "/organizations/:organizationSlug", Organization>
57
57
  | Endpoint<"POST", "/organizations", Organization, CreateOrganizationDto>
58
- | Endpoint<"PUT", "/organizations/:slug", Organization, UpdateOrganizationDto>
59
- | Endpoint<"DELETE", "/organizations/:slug", Organization, null>
58
+ | Endpoint<
59
+ "PUT",
60
+ "/organizations/:organizationSlug",
61
+ Organization,
62
+ UpdateOrganizationDto
63
+ >
64
+ | Endpoint<"DELETE", "/organizations/:organizationSlug", Organization, null>
60
65
  | Endpoint<
61
66
  "GET",
62
- "/organizations/:slug/billing/account",
67
+ "/organizations/:organizationSlug/billing/account",
63
68
  OrganizationBillingAccount
64
69
  >
65
- | Endpoint<"GET", "/organizations/:slug/billing/link", void>
66
- | Endpoint<"GET", "/organizations/:slug/billing/dashboard", void>
70
+ | Endpoint<"GET", "/organizations/:organizationSlug/billing/link", void>
71
+ | Endpoint<"GET", "/organizations/:organizationSlug/billing/dashboard", void>
67
72
  | OrganizationEventEndpoints
68
73
  | OrganizationMembersEndpoints;
@@ -34,16 +34,21 @@ export type OrganizationMembersEndpoints =
34
34
  ArrayResult<OrganizationMember>,
35
35
  ArrayOptions<OrganizationMember>
36
36
  >
37
- | Endpoint<"DELETE", "/organizations/members/:id", OrganizationMember[], null>
37
+ | Endpoint<
38
+ "DELETE",
39
+ "/organizations/members/:memberId",
40
+ OrganizationMember[],
41
+ null
42
+ >
38
43
  | Endpoint<
39
44
  "GET",
40
- "/organizations/:slug/members",
45
+ "/organizations/:organizationSlug/members",
41
46
  ArrayResult<OrganizationMember>,
42
47
  ArrayOptions<OrganizationMember>
43
48
  >
44
49
  | Endpoint<
45
50
  "POST",
46
- "/organizations/:slug/members",
51
+ "/organizations/:organizationSlug/members",
47
52
  OrganizationMember,
48
53
  CreateOrganizationMemberDto
49
54
  >
@@ -97,7 +97,7 @@ export type UserConnectionClient = {
97
97
 
98
98
  export type UserEndpoints =
99
99
  | Endpoint<"GET", "/users", User[]>
100
- | Endpoint<"GET", "/users/:id", User, { id: string }>
100
+ | Endpoint<"GET", "/users/:userId", User, { id: string }>
101
101
  | Endpoint<"GET", "/users/me", User>
102
102
  | Endpoint<
103
103
  "GET",
@@ -109,4 +109,4 @@ export type UserEndpoints =
109
109
  },
110
110
  { identifier: boolean; suggestions?: boolean }
111
111
  >
112
- | Endpoint<"PUT", "/users/:id", User, UpdateUserDto>;
112
+ | Endpoint<"PUT", "/users/:userId", User, UpdateUserDto>;
@@ -14,7 +14,7 @@ export const careers = sdk((client) => ({
14
14
  jobs: {
15
15
  getAll: async (query?: Query<"/careers/jobs">) =>
16
16
  client.get("/careers/jobs", query),
17
- get: async (id: number) => client.get("/careers/jobs/:id", { id }),
17
+ get: async (jobId: number) => client.get("/careers/jobs/:jobId", { jobId }),
18
18
  },
19
19
  offices: {
20
20
  getAll: async (query?: Query<"/careers/offices">) =>
@@ -2,23 +2,28 @@ import { Client } from "../../../rest";
2
2
  import { isBrowser } from "../../../utils";
3
3
 
4
4
  export const organizationsBilling = (client: Client) => ({
5
- account: async (slug: string) =>
6
- client.get("/organizations/:slug/billing/account", { slug }),
7
- link: (slug: string) => {
5
+ account: async (organizationSlug: string) =>
6
+ client.get("/organizations/:organizationSlug/billing/account", {
7
+ organizationSlug,
8
+ }),
9
+ link: (organizationSlug: string) => {
8
10
  if (isBrowser) {
9
- window.location.href = client.url("/organizations/:slug/billing/link", {
10
- slug,
11
- });
11
+ window.location.href = client.url(
12
+ "/organizations/:organizationSlug/billing/link",
13
+ {
14
+ organizationSlug,
15
+ },
16
+ );
12
17
  } else {
13
18
  throw new Error("Billing link is only available in the browser");
14
19
  }
15
20
  },
16
- dashboard: (slug: string) => {
21
+ dashboard: (organizationSlug: string) => {
17
22
  if (isBrowser) {
18
23
  window.location.href = client.url(
19
- "/organizations/:slug/billing/dashboard",
24
+ "/organizations/:organizationSlug/billing/dashboard",
20
25
  {
21
- slug,
26
+ organizationSlug,
22
27
  },
23
28
  );
24
29
  } else {
@@ -0,0 +1,50 @@
1
+ import {
2
+ Client,
3
+ CreateOrganizationEventCartDto,
4
+ UpdateOrganizationEventCartDto,
5
+ } from "../../../../rest";
6
+
7
+ export const organizationsEventCarts = (client: Client) => ({
8
+ getAll: async (organizationSlug: string, eventSlug: string) =>
9
+ client.get("/organizations/:organizationSlug/events/:eventSlug/carts", {
10
+ organizationSlug,
11
+ eventSlug,
12
+ }),
13
+ get: async (organizationSlug: string, eventSlug: string, cartId: string) =>
14
+ client.get(
15
+ "/organizations/:organizationSlug/events/:eventSlug/carts/:cartId",
16
+ {
17
+ organizationSlug,
18
+ eventSlug,
19
+ cartId,
20
+ },
21
+ ),
22
+ create: async (
23
+ organizationSlug: string,
24
+ eventSlug: string,
25
+ data: CreateOrganizationEventCartDto,
26
+ ) =>
27
+ client.post(
28
+ "/organizations/:organizationSlug/events/:eventSlug/carts",
29
+ data,
30
+ {
31
+ organizationSlug,
32
+ eventSlug,
33
+ },
34
+ ),
35
+ update: async (
36
+ organizationSlug: string,
37
+ eventSlug: string,
38
+ cartId: string,
39
+ data: UpdateOrganizationEventCartDto,
40
+ ) =>
41
+ client.put(
42
+ "/organizations/:organizationSlug/events/:eventSlug/carts/:cartId",
43
+ data,
44
+ {
45
+ organizationSlug,
46
+ eventSlug,
47
+ cartId,
48
+ },
49
+ ),
50
+ });
@@ -1,3 +1,4 @@
1
+ import { organizationsEventCarts } from "./carts";
1
2
  import { organizationsEventsStyles } from "./styles";
2
3
  import { organizationsEventsTickets } from "./tickets";
3
4
  import {
@@ -9,10 +10,19 @@ import {
9
10
  } from "../../../rest";
10
11
 
11
12
  export const organizationsEvents = (client: Client) => ({
12
- getAll: async (slug: string) =>
13
- client.get("/organizations/:slug/events", {
14
- slug,
15
- }),
13
+ getAll: async (
14
+ organizationSlug?: string,
15
+ options?: ArrayOptions<OrganizationEvent>,
16
+ ) => {
17
+ if (organizationSlug) {
18
+ return client.get("/organizations/:organizationSlug/events", {
19
+ organizationSlug,
20
+ ...options,
21
+ });
22
+ } else {
23
+ return client.get("/organizations/events", options);
24
+ }
25
+ },
16
26
  getSuggestions: async (options?: ArrayOptions<OrganizationEvent>) =>
17
27
  client.get("/organizations/events/suggestions", options),
18
28
  getNearby: async (
@@ -27,9 +37,9 @@ export const organizationsEvents = (client: Client) => ({
27
37
  organizationSlug,
28
38
  eventSlug,
29
39
  }),
30
- create: async (slug: string, data: CreateOrganizationEventDto) =>
31
- client.post("/organizations/:slug/events", data, {
32
- slug,
40
+ create: async (organizationSlug: string, data: CreateOrganizationEventDto) =>
41
+ client.post("/organizations/:organizationSlug/events", data, {
42
+ organizationSlug,
33
43
  }),
34
44
  update: async (
35
45
  organizationSlug: string,
@@ -45,6 +55,7 @@ export const organizationsEvents = (client: Client) => ({
45
55
  organizationSlug,
46
56
  eventSlug,
47
57
  }),
58
+ carts: organizationsEventCarts(client),
48
59
  styles: organizationsEventsStyles(client),
49
60
  tickets: organizationsEventsTickets(client),
50
61
  });
@@ -2,16 +2,18 @@ import { Client } from "../../../../rest";
2
2
  import {
3
3
  CreateOrganizationEventStyleDto,
4
4
  UpdateOrganizationEventStyleDto,
5
- } from "../../../../rest/dtos/organizations/events/events";
5
+ } from "../../../../rest/dtos/organizations/events/styles";
6
6
 
7
7
  export const organizationsEventsStyles = (client: Client) => ({
8
8
  getAll: async () => client.get("/organizations/events/styles"),
9
- get: async (slug: string) =>
10
- client.get("/organizations/events/styles/:slug", { slug }),
9
+ get: async (styleSlug: string) =>
10
+ client.get("/organizations/events/styles/:styleSlug", { styleSlug }),
11
11
  create: async (data: CreateOrganizationEventStyleDto) =>
12
12
  client.post("/organizations/events/styles", data),
13
- update: async (slug: string, data: UpdateOrganizationEventStyleDto) =>
14
- client.put("/organizations/events/styles/:slug", data, { slug }),
15
- delete: async (slug: string) =>
16
- client.delete("/organizations/events/styles/:slug", null, { slug }),
13
+ update: async (styleSlug: string, data: UpdateOrganizationEventStyleDto) =>
14
+ client.put("/organizations/events/styles/:styleSlug", data, { styleSlug }),
15
+ delete: async (styleSlug: string) =>
16
+ client.delete("/organizations/events/styles/:styleSlug", null, {
17
+ styleSlug,
18
+ }),
17
19
  });
@@ -5,47 +5,58 @@ import {
5
5
  } from "../../../../rest";
6
6
 
7
7
  export const organizationsEventsTickets = (client: Client) => ({
8
- getAll: async (slug: string, eventSlug: string) =>
9
- client.get("/organizations/:slug/events/:eventSlug/tickets", {
10
- slug,
8
+ getAll: async (organizationSlug: string, eventSlug: string) =>
9
+ client.get("/organizations/:organizationSlug/events/:eventSlug/tickets", {
10
+ organizationSlug,
11
11
  eventSlug,
12
12
  }),
13
- get: async (slug: string, eventSlug: string, ticketId: string) =>
14
- client.get("/organizations/:slug/events/:eventSlug/tickets/:ticketId", {
15
- slug,
16
- eventSlug,
17
- ticketId,
18
- }),
13
+ get: async (organizationSlug: string, eventSlug: string, ticketId: string) =>
14
+ client.get(
15
+ "/organizations/:organizationSlug/events/:eventSlug/tickets/:ticketId",
16
+ {
17
+ organizationSlug,
18
+ eventSlug,
19
+ ticketId,
20
+ },
21
+ ),
19
22
  create: async (
20
- slug: string,
23
+ organizationSlug: string,
21
24
  eventSlug: string,
22
25
  data: CreateOrganizationEventTicketDto,
23
26
  ) =>
24
- client.post("/organizations/:slug/events/:eventSlug/tickets", data, {
25
- slug,
26
- eventSlug,
27
- }),
27
+ client.post(
28
+ "/organizations/:organizationSlug/events/:eventSlug/tickets",
29
+ data,
30
+ {
31
+ organizationSlug,
32
+ eventSlug,
33
+ },
34
+ ),
28
35
  update: async (
29
- slug: string,
36
+ organizationSlug: string,
30
37
  eventSlug: string,
31
38
  ticketId: string,
32
39
  data: UpdateOrganizationEventTicketDto,
33
40
  ) =>
34
41
  client.put(
35
- "/organizations/:slug/events/:eventSlug/tickets/:ticketId",
42
+ "/organizations/:organizationSlug/events/:eventSlug/tickets/:ticketId",
36
43
  data,
37
44
  {
38
- slug,
45
+ organizationSlug,
39
46
  eventSlug,
40
47
  ticketId,
41
48
  },
42
49
  ),
43
- delete: async (slug: string, eventSlug: string, ticketId: string) =>
50
+ delete: async (
51
+ organizationSlug: string,
52
+ eventSlug: string,
53
+ ticketId: string,
54
+ ) =>
44
55
  client.delete(
45
- "/organizations/:slug/events/:eventSlug/tickets/:ticketId",
56
+ "/organizations/:organizationSlug/events/:eventSlug/tickets/:ticketId",
46
57
  null,
47
58
  {
48
- slug,
59
+ organizationSlug,
49
60
  eventSlug,
50
61
  ticketId,
51
62
  },
@@ -6,13 +6,16 @@ import { sdk } from "../builder";
6
6
 
7
7
  export const organizations = sdk((client) => ({
8
8
  getAll: async () => client.get("/organizations"),
9
- get: async (slug: string) => client.get("/organizations/:slug", { slug }),
9
+ get: async (organizationSlug: string) =>
10
+ client.get("/organizations/:organizationSlug", { organizationSlug }),
10
11
  create: async (data: CreateOrganizationDto) =>
11
12
  client.post("/organizations", data),
12
- update: async (slug: string, data: UpdateOrganizationDto) =>
13
- client.put("/organizations/:slug", data, { slug }),
14
- delete: async (slug: string) =>
15
- client.delete("/organizations/:slug", null, { slug }),
13
+ update: async (organizationSlug: string, data: UpdateOrganizationDto) =>
14
+ client.put("/organizations/:organizationSlug", data, { organizationSlug }),
15
+ delete: async (organizationSlug: string) =>
16
+ client.delete("/organizations/:organizationSlug", null, {
17
+ organizationSlug,
18
+ }),
16
19
  billing: organizationsBilling(client),
17
20
  events: organizationsEvents(client),
18
21
  members: organizationsMembers(client),
@@ -2,6 +2,6 @@ import { Client } from "../../../rest";
2
2
 
3
3
  export const organizationsMembers = (client: Client) => ({
4
4
  getAll: async () => client.get("/organizations/members"),
5
- delete: async (id: string) =>
6
- client.delete("/organizations/members/:id", null, { id }),
5
+ delete: async (memberId: string) =>
6
+ client.delete("/organizations/members/:memberId", null, { memberId }),
7
7
  });
package/src/sdk/users.ts CHANGED
@@ -7,6 +7,6 @@ export const users = sdk((client) => ({
7
7
  me: async () => client.get("/users/me"),
8
8
  check: async (identifier: string, suggestions?: boolean) =>
9
9
  client.get("/users/check/:identifier", { identifier, suggestions }),
10
- update: async (id: string, data: UpdateUserDto) =>
11
- client.put("/users/:id", data, { id }),
10
+ update: async (userId: string, data: UpdateUserDto) =>
11
+ client.put("/users/:userId", data, { userId }),
12
12
  }));
package/tests/index.ts CHANGED
@@ -5,10 +5,11 @@ import test from "node:test";
5
5
 
6
6
  import { authTests } from "./auth";
7
7
  import { careersTests } from "./careers";
8
+ import { regexTests } from "./regex";
8
9
  import { usersTests } from "./users";
9
10
  import { TonightPass } from "../src/tonightpass";
10
11
 
11
- const sdkTests = [authTests, careersTests, usersTests];
12
+ const sdkTests = [authTests, careersTests, regexTests, usersTests];
12
13
 
13
14
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
14
15
  // @ts-expect-error
@@ -0,0 +1,76 @@
1
+ import assert from "assert";
2
+ import test from "node:test";
3
+
4
+ import { REGEX } from "../../src";
5
+
6
+ export function regexTests() {
7
+ test("EMAIL regex", () => {
8
+ assert.ok(REGEX.EMAIL.test("example@example.com"));
9
+ assert.ok(!REGEX.EMAIL.test("example@.com"));
10
+ assert.ok(!REGEX.EMAIL.test("example@com"));
11
+ assert.ok(REGEX.EMAIL.test("user.name+tag+sorting@example.com"));
12
+ assert.ok(!REGEX.EMAIL.test("user name@example.com"));
13
+ });
14
+
15
+ test("NAME regex", () => {
16
+ assert.ok(REGEX.NAME.test("John Doe"));
17
+ assert.ok(REGEX.NAME.test("JohnDoe123"));
18
+ assert.ok(!REGEX.NAME.test("John_Doe"));
19
+ assert.ok(!REGEX.NAME.test("John-Doe"));
20
+ assert.ok(!REGEX.NAME.test("JohnDoe!"));
21
+ });
22
+
23
+ test("SLUG regex", () => {
24
+ assert.ok(REGEX.SLUG.test("slug_123"));
25
+ assert.ok(REGEX.SLUG.test("slug.123"));
26
+ assert.ok(!REGEX.SLUG.test("slug-123"));
27
+ assert.ok(!REGEX.SLUG.test("Slug123"));
28
+ assert.ok(!REGEX.SLUG.test("slug#123"));
29
+ });
30
+
31
+ test("PHONE regex", () => {
32
+ assert.ok(REGEX.PHONE.test("+1234567890"));
33
+ assert.ok(REGEX.PHONE.test("+12 345 678 9012"));
34
+ assert.ok(!REGEX.PHONE.test("1234567890"));
35
+ assert.ok(!REGEX.PHONE.test("+1 (234) 567-890"));
36
+ assert.ok(!REGEX.PHONE.test("+12 3456 7890 12 3456"));
37
+ });
38
+
39
+ test("PASSWORD regex", () => {
40
+ assert.ok(REGEX.PASSWORD.test("Password1"));
41
+ assert.ok(REGEX.PASSWORD.test("P@ssword"));
42
+ assert.ok(!REGEX.PASSWORD.test("password1"));
43
+ assert.ok(!REGEX.PASSWORD.test("PASSWORD1"));
44
+ assert.ok(!REGEX.PASSWORD.test("Password"));
45
+ assert.ok(!REGEX.PASSWORD.test("P1"));
46
+ });
47
+
48
+ test("PASSWORD_MIN_LENGTH regex", () => {
49
+ assert.ok(REGEX.PASSWORD_MIN_LENGTH.test("Password1"));
50
+ assert.ok(!REGEX.PASSWORD_MIN_LENGTH.test("Pass1"));
51
+ });
52
+
53
+ test("PASSWORD_UPPERCASE regex", () => {
54
+ assert.ok(REGEX.PASSWORD_UPPERCASE.test("Password"));
55
+ assert.ok(!REGEX.PASSWORD_UPPERCASE.test("password"));
56
+ });
57
+
58
+ test("PASSWORD_LOWERCASE regex", () => {
59
+ assert.ok(REGEX.PASSWORD_LOWERCASE.test("Password"));
60
+ assert.ok(!REGEX.PASSWORD_LOWERCASE.test("PASSWORD"));
61
+ });
62
+
63
+ test("PASSWORD_NUMBER_SPECIAL regex", () => {
64
+ assert.ok(REGEX.PASSWORD_NUMBER_SPECIAL.test("Password1"));
65
+ assert.ok(REGEX.PASSWORD_NUMBER_SPECIAL.test("P@ssword"));
66
+ assert.ok(!REGEX.PASSWORD_NUMBER_SPECIAL.test("Password"));
67
+ });
68
+
69
+ test("IMAGE_URL regex", () => {
70
+ assert.ok(REGEX.IMAGE_URL.test("http://example.com/image.jpg"));
71
+ assert.ok(REGEX.IMAGE_URL.test("https://www.example.com/image.jpeg"));
72
+ assert.ok(!REGEX.IMAGE_URL.test("www.example.com/image.png"));
73
+ assert.ok(!REGEX.IMAGE_URL.test("example.com/image"));
74
+ assert.ok(!REGEX.IMAGE_URL.test("https://example.com/image.txt"));
75
+ });
76
+ }