@tonightpass/react 0.0.75 → 0.0.77
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 +16 -0
- package/dist/index.d.mts +12 -153
- package/dist/index.d.ts +12 -153
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/hooks/useAPI.ts +40 -13
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @tonightpass/react@0.0.
|
|
2
|
+
> @tonightpass/react@0.0.77 build /home/runner/work/tonightpass/tonightpass/packages/react
|
|
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[32m517.00 B[39m
|
|
13
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m2.10 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 102ms
|
|
15
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m338.00 B[39m
|
|
16
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m2.09 KB[39m
|
|
17
|
+
[32mESM[39m ⚡️ Build success in 103ms
|
|
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 2806ms
|
|
20
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m944.00 B[39m
|
|
21
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m944.00 B[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @tonightpass/react
|
|
2
2
|
|
|
3
|
+
## 0.0.77
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`46ce556`](https://github.com/tonightpass/tonightpass/commit/46ce5567a37b62e3f4d9501fcdda07a99e329067)]:
|
|
8
|
+
- tonightpass@0.0.76
|
|
9
|
+
|
|
10
|
+
## 0.0.76
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`4606121`](https://github.com/tonightpass/tonightpass/commit/46061214a2877c105ca9a2f6f1f2a2a6bd222df8) Thanks [@AntoineKM](https://github.com/AntoineKM)! - Add swr config to api hook
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [[`4606121`](https://github.com/tonightpass/tonightpass/commit/46061214a2877c105ca9a2f6f1f2a2a6bd222df8)]:
|
|
17
|
+
- tonightpass@0.0.75
|
|
18
|
+
|
|
3
19
|
## 0.0.75
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,158 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import * as tonightpass from 'tonightpass';
|
|
4
|
-
import { Client, PathsFor, Query, APIRequestOptions } from 'tonightpass';
|
|
1
|
+
import { SWRConfiguration, SWRResponse } from 'swr';
|
|
2
|
+
import { Client, PathsFor, TonightPassAPIError, APIRequestOptions, Query, Endpoints } from 'tonightpass';
|
|
5
3
|
|
|
6
4
|
declare const client: Client;
|
|
7
|
-
|
|
5
|
+
type AnyEndpoint = Endpoints extends infer T ? T : never;
|
|
6
|
+
type ForceAccept<T> = T extends never ? any : T;
|
|
7
|
+
type ResponseType<Path extends PathsFor<"GET">> = ForceAccept<Extract<AnyEndpoint, {
|
|
8
8
|
path: Path;
|
|
9
9
|
method: "GET";
|
|
10
|
-
}>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/oauth2/facebook/callback", void, undefined>, {
|
|
17
|
-
path: Path;
|
|
18
|
-
method: "GET";
|
|
19
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/oauth2/twitter", void, undefined>, {
|
|
20
|
-
path: Path;
|
|
21
|
-
method: "GET";
|
|
22
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/oauth2/twitter/callback", void, undefined>, {
|
|
23
|
-
path: Path;
|
|
24
|
-
method: "GET";
|
|
25
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/careers/categories", tonightpass.CareersCategory[], {
|
|
26
|
-
language?: string;
|
|
27
|
-
}>, {
|
|
28
|
-
path: Path;
|
|
29
|
-
method: "GET";
|
|
30
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/careers/employmentTypes", tonightpass.CareersEmploymentType[], {
|
|
31
|
-
language?: string;
|
|
32
|
-
}>, {
|
|
33
|
-
path: Path;
|
|
34
|
-
method: "GET";
|
|
35
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/careers/jobs", tonightpass.CareersJob[], {
|
|
36
|
-
page?: number;
|
|
37
|
-
pageSize?: number;
|
|
38
|
-
createdAtGte: string;
|
|
39
|
-
createdAtLt?: string;
|
|
40
|
-
updatedAtGte?: string;
|
|
41
|
-
updatedAtLt?: string;
|
|
42
|
-
status?: "ALL" | "ONLINE" | "ARCHIVED";
|
|
43
|
-
content?: boolean;
|
|
44
|
-
titleLike?: string;
|
|
45
|
-
countryCode?: string;
|
|
46
|
-
externalId?: string;
|
|
47
|
-
}>, {
|
|
48
|
-
path: Path;
|
|
49
|
-
method: "GET";
|
|
50
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/careers/jobs/:jobId", tonightpass.CareersJob, {
|
|
51
|
-
jobId: number;
|
|
52
|
-
}>, {
|
|
53
|
-
path: Path;
|
|
54
|
-
method: "GET";
|
|
55
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/careers/offices", tonightpass.CareersOffice[], {
|
|
56
|
-
page?: number;
|
|
57
|
-
pageSize?: number;
|
|
58
|
-
countryCode?: string;
|
|
59
|
-
cityNameLike?: string;
|
|
60
|
-
}>, {
|
|
61
|
-
path: Path;
|
|
62
|
-
method: "GET";
|
|
63
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/health", [tonightpass.Health<"app">, tonightpass.Health<"database">], undefined>, {
|
|
64
|
-
path: Path;
|
|
65
|
-
method: "GET";
|
|
66
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/health/database", tonightpass.Health<"database">, undefined>, {
|
|
67
|
-
path: Path;
|
|
68
|
-
method: "GET";
|
|
69
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/health/http", tonightpass.Health<"app">, undefined>, {
|
|
70
|
-
path: Path;
|
|
71
|
-
method: "GET";
|
|
72
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/orders", tonightpass.ArrayResult<tonightpass.Order>, tonightpass.ArrayOptions<tonightpass.Order>>, {
|
|
73
|
-
path: Path;
|
|
74
|
-
method: "GET";
|
|
75
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/orders/:orderId", tonightpass.Order, undefined>, {
|
|
76
|
-
path: Path;
|
|
77
|
-
method: "GET";
|
|
78
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations", tonightpass.Organization[], undefined>, {
|
|
79
|
-
path: Path;
|
|
80
|
-
method: "GET";
|
|
81
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/:organizationSlug", tonightpass.Organization, undefined>, {
|
|
82
|
-
path: Path;
|
|
83
|
-
method: "GET";
|
|
84
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/:organizationSlug/billing/account", stripe.Stripe.Account, undefined>, {
|
|
85
|
-
path: Path;
|
|
86
|
-
method: "GET";
|
|
87
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/:organizationSlug/billing/link", void, undefined>, {
|
|
88
|
-
path: Path;
|
|
89
|
-
method: "GET";
|
|
90
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/:organizationSlug/billing/dashboard", void, undefined>, {
|
|
91
|
-
path: Path;
|
|
92
|
-
method: "GET";
|
|
93
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/events", tonightpass.ArrayResult<tonightpass.OrganizationEvent>, tonightpass.ArrayOptions<tonightpass.OrganizationEvent>>, {
|
|
94
|
-
path: Path;
|
|
95
|
-
method: "GET";
|
|
96
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/events/suggestions", tonightpass.ArrayResult<tonightpass.OrganizationEvent>, tonightpass.ArrayOptions<tonightpass.OrganizationEvent>>, {
|
|
97
|
-
path: Path;
|
|
98
|
-
method: "GET";
|
|
99
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/events/nearby", tonightpass.ArrayResult<tonightpass.OrganizationEvent>, {
|
|
100
|
-
populate?: string[];
|
|
101
|
-
} & tonightpass.ArrayPaginationOptions & {
|
|
102
|
-
latitude: number;
|
|
103
|
-
longitude: number;
|
|
104
|
-
radius?: number;
|
|
105
|
-
}>, {
|
|
106
|
-
path: Path;
|
|
107
|
-
method: "GET";
|
|
108
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/:organizationSlug/events", tonightpass.ArrayResult<tonightpass.OrganizationEvent>, tonightpass.ArrayOptions<tonightpass.OrganizationEvent>>, {
|
|
109
|
-
path: Path;
|
|
110
|
-
method: "GET";
|
|
111
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/:organizationSlug/events/:eventSlug", tonightpass.OrganizationEvent, undefined>, {
|
|
112
|
-
path: Path;
|
|
113
|
-
method: "GET";
|
|
114
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/events/styles", tonightpass.OrganizationEventStyle[], undefined>, {
|
|
115
|
-
path: Path;
|
|
116
|
-
method: "GET";
|
|
117
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/events/styles/:styleSlug", tonightpass.OrganizationEventStyle, undefined>, {
|
|
118
|
-
path: Path;
|
|
119
|
-
method: "GET";
|
|
120
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/:organizationSlug/events/:eventSlug/tickets", tonightpass.OrganizationEventTicket[], undefined>, {
|
|
121
|
-
path: Path;
|
|
122
|
-
method: "GET";
|
|
123
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/:organizationSlug/events/:eventSlug/tickets/:ticketId", tonightpass.OrganizationEventTicket, undefined>, {
|
|
124
|
-
path: Path;
|
|
125
|
-
method: "GET";
|
|
126
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/members", tonightpass.ArrayResult<tonightpass.OrganizationMember>, tonightpass.ArrayOptions<tonightpass.OrganizationMember>>, {
|
|
127
|
-
path: Path;
|
|
128
|
-
method: "GET";
|
|
129
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/:organizationSlug/members", tonightpass.ArrayResult<tonightpass.OrganizationMember>, tonightpass.ArrayOptions<tonightpass.OrganizationMember>>, {
|
|
130
|
-
path: Path;
|
|
131
|
-
method: "GET";
|
|
132
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/profiles/:username", tonightpass.UserIdentity | tonightpass.OrganizationIdentity, undefined>, {
|
|
133
|
-
path: Path;
|
|
134
|
-
method: "GET";
|
|
135
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/users", tonightpass.User[], undefined>, {
|
|
136
|
-
path: Path;
|
|
137
|
-
method: "GET";
|
|
138
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/users/:userId", tonightpass.User, {
|
|
139
|
-
id: string;
|
|
140
|
-
}>, {
|
|
141
|
-
path: Path;
|
|
142
|
-
method: "GET";
|
|
143
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/users/me", tonightpass.User, undefined>, {
|
|
144
|
-
path: Path;
|
|
145
|
-
method: "GET";
|
|
146
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/users/check/:identifier", {
|
|
147
|
-
exists: boolean;
|
|
148
|
-
identifier: Partial<tonightpass.UserIdentifier>;
|
|
149
|
-
suggestions?: string[];
|
|
150
|
-
}, {
|
|
151
|
-
identifier: boolean;
|
|
152
|
-
suggestions?: boolean;
|
|
153
|
-
}>, {
|
|
154
|
-
path: Path;
|
|
155
|
-
method: "GET";
|
|
156
|
-
}>)["res"], any, any>;
|
|
10
|
+
}>["res"]>;
|
|
11
|
+
type ErrorType<Path extends PathsFor<"GET">> = TonightPassAPIError<ResponseType<Path>>;
|
|
12
|
+
interface UseAPIConfig<Path extends PathsFor<"GET">> extends SWRConfiguration<ResponseType<Path>, ErrorType<Path>> {
|
|
13
|
+
requestOptions?: APIRequestOptions;
|
|
14
|
+
}
|
|
15
|
+
declare function useAPI<Path extends PathsFor<"GET">>(path: Path | null | undefined, query?: Query<Path>, config?: UseAPIConfig<Path>): SWRResponse<ResponseType<Path>, ErrorType<Path>>;
|
|
157
16
|
|
|
158
|
-
export { client, useAPI };
|
|
17
|
+
export { type ErrorType, type ResponseType, type UseAPIConfig, client, useAPI };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,158 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import * as tonightpass from 'tonightpass';
|
|
4
|
-
import { Client, PathsFor, Query, APIRequestOptions } from 'tonightpass';
|
|
1
|
+
import { SWRConfiguration, SWRResponse } from 'swr';
|
|
2
|
+
import { Client, PathsFor, TonightPassAPIError, APIRequestOptions, Query, Endpoints } from 'tonightpass';
|
|
5
3
|
|
|
6
4
|
declare const client: Client;
|
|
7
|
-
|
|
5
|
+
type AnyEndpoint = Endpoints extends infer T ? T : never;
|
|
6
|
+
type ForceAccept<T> = T extends never ? any : T;
|
|
7
|
+
type ResponseType<Path extends PathsFor<"GET">> = ForceAccept<Extract<AnyEndpoint, {
|
|
8
8
|
path: Path;
|
|
9
9
|
method: "GET";
|
|
10
|
-
}>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/oauth2/facebook/callback", void, undefined>, {
|
|
17
|
-
path: Path;
|
|
18
|
-
method: "GET";
|
|
19
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/oauth2/twitter", void, undefined>, {
|
|
20
|
-
path: Path;
|
|
21
|
-
method: "GET";
|
|
22
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/oauth2/twitter/callback", void, undefined>, {
|
|
23
|
-
path: Path;
|
|
24
|
-
method: "GET";
|
|
25
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/careers/categories", tonightpass.CareersCategory[], {
|
|
26
|
-
language?: string;
|
|
27
|
-
}>, {
|
|
28
|
-
path: Path;
|
|
29
|
-
method: "GET";
|
|
30
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/careers/employmentTypes", tonightpass.CareersEmploymentType[], {
|
|
31
|
-
language?: string;
|
|
32
|
-
}>, {
|
|
33
|
-
path: Path;
|
|
34
|
-
method: "GET";
|
|
35
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/careers/jobs", tonightpass.CareersJob[], {
|
|
36
|
-
page?: number;
|
|
37
|
-
pageSize?: number;
|
|
38
|
-
createdAtGte: string;
|
|
39
|
-
createdAtLt?: string;
|
|
40
|
-
updatedAtGte?: string;
|
|
41
|
-
updatedAtLt?: string;
|
|
42
|
-
status?: "ALL" | "ONLINE" | "ARCHIVED";
|
|
43
|
-
content?: boolean;
|
|
44
|
-
titleLike?: string;
|
|
45
|
-
countryCode?: string;
|
|
46
|
-
externalId?: string;
|
|
47
|
-
}>, {
|
|
48
|
-
path: Path;
|
|
49
|
-
method: "GET";
|
|
50
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/careers/jobs/:jobId", tonightpass.CareersJob, {
|
|
51
|
-
jobId: number;
|
|
52
|
-
}>, {
|
|
53
|
-
path: Path;
|
|
54
|
-
method: "GET";
|
|
55
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/careers/offices", tonightpass.CareersOffice[], {
|
|
56
|
-
page?: number;
|
|
57
|
-
pageSize?: number;
|
|
58
|
-
countryCode?: string;
|
|
59
|
-
cityNameLike?: string;
|
|
60
|
-
}>, {
|
|
61
|
-
path: Path;
|
|
62
|
-
method: "GET";
|
|
63
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/health", [tonightpass.Health<"app">, tonightpass.Health<"database">], undefined>, {
|
|
64
|
-
path: Path;
|
|
65
|
-
method: "GET";
|
|
66
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/health/database", tonightpass.Health<"database">, undefined>, {
|
|
67
|
-
path: Path;
|
|
68
|
-
method: "GET";
|
|
69
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/health/http", tonightpass.Health<"app">, undefined>, {
|
|
70
|
-
path: Path;
|
|
71
|
-
method: "GET";
|
|
72
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/orders", tonightpass.ArrayResult<tonightpass.Order>, tonightpass.ArrayOptions<tonightpass.Order>>, {
|
|
73
|
-
path: Path;
|
|
74
|
-
method: "GET";
|
|
75
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/orders/:orderId", tonightpass.Order, undefined>, {
|
|
76
|
-
path: Path;
|
|
77
|
-
method: "GET";
|
|
78
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations", tonightpass.Organization[], undefined>, {
|
|
79
|
-
path: Path;
|
|
80
|
-
method: "GET";
|
|
81
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/:organizationSlug", tonightpass.Organization, undefined>, {
|
|
82
|
-
path: Path;
|
|
83
|
-
method: "GET";
|
|
84
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/:organizationSlug/billing/account", stripe.Stripe.Account, undefined>, {
|
|
85
|
-
path: Path;
|
|
86
|
-
method: "GET";
|
|
87
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/:organizationSlug/billing/link", void, undefined>, {
|
|
88
|
-
path: Path;
|
|
89
|
-
method: "GET";
|
|
90
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/:organizationSlug/billing/dashboard", void, undefined>, {
|
|
91
|
-
path: Path;
|
|
92
|
-
method: "GET";
|
|
93
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/events", tonightpass.ArrayResult<tonightpass.OrganizationEvent>, tonightpass.ArrayOptions<tonightpass.OrganizationEvent>>, {
|
|
94
|
-
path: Path;
|
|
95
|
-
method: "GET";
|
|
96
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/events/suggestions", tonightpass.ArrayResult<tonightpass.OrganizationEvent>, tonightpass.ArrayOptions<tonightpass.OrganizationEvent>>, {
|
|
97
|
-
path: Path;
|
|
98
|
-
method: "GET";
|
|
99
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/events/nearby", tonightpass.ArrayResult<tonightpass.OrganizationEvent>, {
|
|
100
|
-
populate?: string[];
|
|
101
|
-
} & tonightpass.ArrayPaginationOptions & {
|
|
102
|
-
latitude: number;
|
|
103
|
-
longitude: number;
|
|
104
|
-
radius?: number;
|
|
105
|
-
}>, {
|
|
106
|
-
path: Path;
|
|
107
|
-
method: "GET";
|
|
108
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/:organizationSlug/events", tonightpass.ArrayResult<tonightpass.OrganizationEvent>, tonightpass.ArrayOptions<tonightpass.OrganizationEvent>>, {
|
|
109
|
-
path: Path;
|
|
110
|
-
method: "GET";
|
|
111
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/:organizationSlug/events/:eventSlug", tonightpass.OrganizationEvent, undefined>, {
|
|
112
|
-
path: Path;
|
|
113
|
-
method: "GET";
|
|
114
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/events/styles", tonightpass.OrganizationEventStyle[], undefined>, {
|
|
115
|
-
path: Path;
|
|
116
|
-
method: "GET";
|
|
117
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/events/styles/:styleSlug", tonightpass.OrganizationEventStyle, undefined>, {
|
|
118
|
-
path: Path;
|
|
119
|
-
method: "GET";
|
|
120
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/:organizationSlug/events/:eventSlug/tickets", tonightpass.OrganizationEventTicket[], undefined>, {
|
|
121
|
-
path: Path;
|
|
122
|
-
method: "GET";
|
|
123
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/:organizationSlug/events/:eventSlug/tickets/:ticketId", tonightpass.OrganizationEventTicket, undefined>, {
|
|
124
|
-
path: Path;
|
|
125
|
-
method: "GET";
|
|
126
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/members", tonightpass.ArrayResult<tonightpass.OrganizationMember>, tonightpass.ArrayOptions<tonightpass.OrganizationMember>>, {
|
|
127
|
-
path: Path;
|
|
128
|
-
method: "GET";
|
|
129
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/organizations/:organizationSlug/members", tonightpass.ArrayResult<tonightpass.OrganizationMember>, tonightpass.ArrayOptions<tonightpass.OrganizationMember>>, {
|
|
130
|
-
path: Path;
|
|
131
|
-
method: "GET";
|
|
132
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/profiles/:username", tonightpass.UserIdentity | tonightpass.OrganizationIdentity, undefined>, {
|
|
133
|
-
path: Path;
|
|
134
|
-
method: "GET";
|
|
135
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/users", tonightpass.User[], undefined>, {
|
|
136
|
-
path: Path;
|
|
137
|
-
method: "GET";
|
|
138
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/users/:userId", tonightpass.User, {
|
|
139
|
-
id: string;
|
|
140
|
-
}>, {
|
|
141
|
-
path: Path;
|
|
142
|
-
method: "GET";
|
|
143
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/users/me", tonightpass.User, undefined>, {
|
|
144
|
-
path: Path;
|
|
145
|
-
method: "GET";
|
|
146
|
-
}> | Extract<tonightpass.Endpoint<"GET", "/users/check/:identifier", {
|
|
147
|
-
exists: boolean;
|
|
148
|
-
identifier: Partial<tonightpass.UserIdentifier>;
|
|
149
|
-
suggestions?: string[];
|
|
150
|
-
}, {
|
|
151
|
-
identifier: boolean;
|
|
152
|
-
suggestions?: boolean;
|
|
153
|
-
}>, {
|
|
154
|
-
path: Path;
|
|
155
|
-
method: "GET";
|
|
156
|
-
}>)["res"], any, any>;
|
|
10
|
+
}>["res"]>;
|
|
11
|
+
type ErrorType<Path extends PathsFor<"GET">> = TonightPassAPIError<ResponseType<Path>>;
|
|
12
|
+
interface UseAPIConfig<Path extends PathsFor<"GET">> extends SWRConfiguration<ResponseType<Path>, ErrorType<Path>> {
|
|
13
|
+
requestOptions?: APIRequestOptions;
|
|
14
|
+
}
|
|
15
|
+
declare function useAPI<Path extends PathsFor<"GET">>(path: Path | null | undefined, query?: Query<Path>, config?: UseAPIConfig<Path>): SWRResponse<ResponseType<Path>, ErrorType<Path>>;
|
|
157
16
|
|
|
158
|
-
export { client, useAPI };
|
|
17
|
+
export { type ErrorType, type ResponseType, type UseAPIConfig, client, useAPI };
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var a = require('swr');
|
|
4
4
|
var tonightpass = require('tonightpass');
|
|
5
5
|
|
|
6
6
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var a__default = /*#__PURE__*/_interopDefault(a);
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var i=new tonightpass.Client({baseURL:tonightpass.DEFAULT_API_URL});function l(e,t,n){let{requestOptions:r,...o}=n||{};return a__default.default(e?[e,t]:null,async([s,p])=>await i.get(s,p,r),o)}
|
|
11
11
|
|
|
12
|
-
exports.client =
|
|
13
|
-
exports.useAPI =
|
|
12
|
+
exports.client = i;
|
|
13
|
+
exports.useAPI = l;
|
|
14
14
|
//# sourceMappingURL=index.js.map
|
|
15
15
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/useAPI.ts"],"names":["client","Client","DEFAULT_API_URL","useAPI","path","query","
|
|
1
|
+
{"version":3,"sources":["../src/hooks/useAPI.ts"],"names":["client","Client","DEFAULT_API_URL","useAPI","path","query","config","requestOptions","swrConfig","useSWR","fetchPath","fetchQuery"],"mappings":";;;;;;;;;AAWaA,IAAAA,CAAAA,CAAS,IAAIC,kBAAAA,CAAO,CAAE,OAASC,CAAAA,2BAAgB,CAAC,EAmBtD,SAASC,CAAAA,CACdC,CACAC,CAAAA,CAAAA,CACAC,CACkD,CAAA,CAClD,GAAM,CAAE,cAAAC,CAAAA,CAAAA,CAAgB,GAAGC,CAAU,CAAA,CAAIF,CAAU,EAAA,EAUnD,CAAA,OAAOG,mBAILL,CAAO,CAAA,CAACA,CAAMC,CAAAA,CAAK,CAAI,CAAA,IAAA,CAZT,MAAO,CAACK,CAAAA,CAAWC,CAAU,CAAA,GAI1B,MAAMX,CAAAA,CAAO,GAAIU,CAAAA,CAAAA,CAAWC,CAAYJ,CAAAA,CAAc,CAQjCC,CAAAA,CAAS,CACnD","file":"index.js","sourcesContent":["import useSWR, { SWRConfiguration, SWRResponse } from \"swr\";\nimport {\n Endpoints,\n APIRequestOptions,\n Client,\n PathsFor,\n DEFAULT_API_URL,\n TonightPassAPIError,\n Query,\n} from \"tonightpass\";\n\nexport const client = new Client({ baseURL: DEFAULT_API_URL });\n\ntype AnyEndpoint = Endpoints extends infer T ? T : never;\n\ntype ForceAccept<T> = T extends never ? any : T;\n\nexport type ResponseType<Path extends PathsFor<\"GET\">> = ForceAccept<\n Extract<AnyEndpoint, { path: Path; method: \"GET\" }>[\"res\"]\n>;\n\nexport type ErrorType<Path extends PathsFor<\"GET\">> = TonightPassAPIError<\n ResponseType<Path>\n>;\n\nexport interface UseAPIConfig<Path extends PathsFor<\"GET\">>\n extends SWRConfiguration<ResponseType<Path>, ErrorType<Path>> {\n requestOptions?: APIRequestOptions;\n}\n\nexport function useAPI<Path extends PathsFor<\"GET\">>(\n path: Path | null | undefined,\n query?: Query<Path>,\n config?: UseAPIConfig<Path>,\n): SWRResponse<ResponseType<Path>, ErrorType<Path>> {\n const { requestOptions, ...swrConfig } = config || {};\n\n const fetcher = async ([fetchPath, fetchQuery]: [\n Path,\n Query<Path> | undefined,\n ]) => {\n const response = await client.get(fetchPath, fetchQuery, requestOptions);\n return response as unknown as ResponseType<Path>;\n };\n\n return useSWR<\n ResponseType<Path>,\n ErrorType<Path>,\n [Path, Query<Path> | undefined] | null\n >(path ? [path, query] : null, fetcher, swrConfig);\n}\n"]}
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import a from 'swr';
|
|
2
2
|
import { Client, DEFAULT_API_URL } from 'tonightpass';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var i=new Client({baseURL:DEFAULT_API_URL});function l(e,t,n){let{requestOptions:r,...o}=n||{};return a(e?[e,t]:null,async([s,p])=>await i.get(s,p,r),o)}
|
|
5
5
|
|
|
6
|
-
export {
|
|
6
|
+
export { i as client, l as useAPI };
|
|
7
7
|
//# sourceMappingURL=index.mjs.map
|
|
8
8
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/useAPI.ts"],"names":["client","Client","DEFAULT_API_URL","useAPI","path","query","
|
|
1
|
+
{"version":3,"sources":["../src/hooks/useAPI.ts"],"names":["client","Client","DEFAULT_API_URL","useAPI","path","query","config","requestOptions","swrConfig","useSWR","fetchPath","fetchQuery"],"mappings":";;;AAWaA,IAAAA,CAAAA,CAAS,IAAIC,MAAAA,CAAO,CAAE,OAASC,CAAAA,eAAgB,CAAC,EAmBtD,SAASC,CAAAA,CACdC,CACAC,CAAAA,CAAAA,CACAC,CACkD,CAAA,CAClD,GAAM,CAAE,cAAAC,CAAAA,CAAAA,CAAgB,GAAGC,CAAU,CAAA,CAAIF,CAAU,EAAA,EAUnD,CAAA,OAAOG,EAILL,CAAO,CAAA,CAACA,CAAMC,CAAAA,CAAK,CAAI,CAAA,IAAA,CAZT,MAAO,CAACK,CAAAA,CAAWC,CAAU,CAAA,GAI1B,MAAMX,CAAAA,CAAO,GAAIU,CAAAA,CAAAA,CAAWC,CAAYJ,CAAAA,CAAc,CAQjCC,CAAAA,CAAS,CACnD","file":"index.mjs","sourcesContent":["import useSWR, { SWRConfiguration, SWRResponse } from \"swr\";\nimport {\n Endpoints,\n APIRequestOptions,\n Client,\n PathsFor,\n DEFAULT_API_URL,\n TonightPassAPIError,\n Query,\n} from \"tonightpass\";\n\nexport const client = new Client({ baseURL: DEFAULT_API_URL });\n\ntype AnyEndpoint = Endpoints extends infer T ? T : never;\n\ntype ForceAccept<T> = T extends never ? any : T;\n\nexport type ResponseType<Path extends PathsFor<\"GET\">> = ForceAccept<\n Extract<AnyEndpoint, { path: Path; method: \"GET\" }>[\"res\"]\n>;\n\nexport type ErrorType<Path extends PathsFor<\"GET\">> = TonightPassAPIError<\n ResponseType<Path>\n>;\n\nexport interface UseAPIConfig<Path extends PathsFor<\"GET\">>\n extends SWRConfiguration<ResponseType<Path>, ErrorType<Path>> {\n requestOptions?: APIRequestOptions;\n}\n\nexport function useAPI<Path extends PathsFor<\"GET\">>(\n path: Path | null | undefined,\n query?: Query<Path>,\n config?: UseAPIConfig<Path>,\n): SWRResponse<ResponseType<Path>, ErrorType<Path>> {\n const { requestOptions, ...swrConfig } = config || {};\n\n const fetcher = async ([fetchPath, fetchQuery]: [\n Path,\n Query<Path> | undefined,\n ]) => {\n const response = await client.get(fetchPath, fetchQuery, requestOptions);\n return response as unknown as ResponseType<Path>;\n };\n\n return useSWR<\n ResponseType<Path>,\n ErrorType<Path>,\n [Path, Query<Path> | undefined] | null\n >(path ? [path, query] : null, fetcher, swrConfig);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tonightpass/react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.77",
|
|
4
4
|
"description": "@tonightpass react sdk.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"types": "dist/index.d.ts",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"swr": "^2.2.5",
|
|
18
|
-
"tonightpass": "^0.0.
|
|
18
|
+
"tonightpass": "^0.0.76"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"react": "*"
|
package/src/hooks/useAPI.ts
CHANGED
|
@@ -1,24 +1,51 @@
|
|
|
1
|
-
import useSWR, {
|
|
1
|
+
import useSWR, { SWRConfiguration, SWRResponse } from "swr";
|
|
2
2
|
import {
|
|
3
3
|
Endpoints,
|
|
4
4
|
APIRequestOptions,
|
|
5
5
|
Client,
|
|
6
6
|
PathsFor,
|
|
7
|
-
Query,
|
|
8
7
|
DEFAULT_API_URL,
|
|
8
|
+
TonightPassAPIError,
|
|
9
|
+
Query,
|
|
9
10
|
} from "tonightpass";
|
|
10
11
|
|
|
11
12
|
export const client = new Client({ baseURL: DEFAULT_API_URL });
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
type AnyEndpoint = Endpoints extends infer T ? T : never;
|
|
15
|
+
|
|
16
|
+
type ForceAccept<T> = T extends never ? any : T;
|
|
17
|
+
|
|
18
|
+
export type ResponseType<Path extends PathsFor<"GET">> = ForceAccept<
|
|
19
|
+
Extract<AnyEndpoint, { path: Path; method: "GET" }>["res"]
|
|
20
|
+
>;
|
|
21
|
+
|
|
22
|
+
export type ErrorType<Path extends PathsFor<"GET">> = TonightPassAPIError<
|
|
23
|
+
ResponseType<Path>
|
|
24
|
+
>;
|
|
25
|
+
|
|
26
|
+
export interface UseAPIConfig<Path extends PathsFor<"GET">>
|
|
27
|
+
extends SWRConfiguration<ResponseType<Path>, ErrorType<Path>> {
|
|
28
|
+
requestOptions?: APIRequestOptions;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function useAPI<Path extends PathsFor<"GET">>(
|
|
32
|
+
path: Path | null | undefined,
|
|
15
33
|
query?: Query<Path>,
|
|
16
|
-
|
|
17
|
-
)
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
)
|
|
24
|
-
|
|
34
|
+
config?: UseAPIConfig<Path>,
|
|
35
|
+
): SWRResponse<ResponseType<Path>, ErrorType<Path>> {
|
|
36
|
+
const { requestOptions, ...swrConfig } = config || {};
|
|
37
|
+
|
|
38
|
+
const fetcher = async ([fetchPath, fetchQuery]: [
|
|
39
|
+
Path,
|
|
40
|
+
Query<Path> | undefined,
|
|
41
|
+
]) => {
|
|
42
|
+
const response = await client.get(fetchPath, fetchQuery, requestOptions);
|
|
43
|
+
return response as unknown as ResponseType<Path>;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
return useSWR<
|
|
47
|
+
ResponseType<Path>,
|
|
48
|
+
ErrorType<Path>,
|
|
49
|
+
[Path, Query<Path> | undefined] | null
|
|
50
|
+
>(path ? [path, query] : null, fetcher, swrConfig);
|
|
51
|
+
}
|