@omerikanec/api-client-demo 0.0.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/home/home.ts CHANGED
@@ -16,8 +16,7 @@ import type {
16
16
  } from '@tanstack/react-query';
17
17
 
18
18
  import type {
19
- ActivityFeedResponse,
20
- HomeResponse
19
+ ActivityFeedResponse
21
20
  } from '../api.schemas';
22
21
 
23
22
 
@@ -121,96 +120,3 @@ export function useActivityFeedRetrieve<TData = Awaited<ReturnType<typeof activi
121
120
 
122
121
 
123
122
 
124
- /**
125
- * Возвращает избранные новости (до 3), ближайшие мероприятия (до 5) и избранные галереи (до 2).
126
- * @summary Данные для главной страницы
127
- */
128
- export type homeRetrieveResponse200 = {
129
- data: HomeResponse
130
- status: 200
131
- }
132
-
133
- export type homeRetrieveResponseSuccess = (homeRetrieveResponse200) & {
134
- headers: Headers;
135
- };
136
- ;
137
-
138
- export type homeRetrieveResponse = (homeRetrieveResponseSuccess)
139
-
140
- export const getHomeRetrieveUrl = () => {
141
-
142
-
143
-
144
-
145
- return `/api/home/`
146
- }
147
-
148
- export const homeRetrieve = async ( options?: RequestInit): Promise<homeRetrieveResponse> => {
149
-
150
- const res = await fetch(getHomeRetrieveUrl(),
151
- {
152
- ...options,
153
- method: 'GET'
154
-
155
-
156
- }
157
- )
158
-
159
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
160
-
161
- const data: homeRetrieveResponse['data'] = body ? JSON.parse(body) : {}
162
- return { data, status: res.status, headers: res.headers } as homeRetrieveResponse
163
- }
164
-
165
-
166
-
167
-
168
-
169
- export const getHomeRetrieveQueryKey = () => {
170
- return [
171
- `/api/home/`
172
- ] as const;
173
- }
174
-
175
-
176
- export const getHomeRetrieveQueryOptions = <TData = Awaited<ReturnType<typeof homeRetrieve>>, TError = unknown>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof homeRetrieve>>, TError, TData>, fetch?: RequestInit}
177
- ) => {
178
-
179
- const {query: queryOptions, fetch: fetchOptions} = options ?? {};
180
-
181
- const queryKey = queryOptions?.queryKey ?? getHomeRetrieveQueryKey();
182
-
183
-
184
-
185
- const queryFn: QueryFunction<Awaited<ReturnType<typeof homeRetrieve>>> = ({ signal }) => homeRetrieve({ signal, ...fetchOptions });
186
-
187
-
188
-
189
-
190
-
191
- return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof homeRetrieve>>, TError, TData> & { queryKey: QueryKey }
192
- }
193
-
194
- export type HomeRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof homeRetrieve>>>
195
- export type HomeRetrieveQueryError = unknown
196
-
197
-
198
- /**
199
- * @summary Данные для главной страницы
200
- */
201
-
202
- export function useHomeRetrieve<TData = Awaited<ReturnType<typeof homeRetrieve>>, TError = unknown>(
203
- options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof homeRetrieve>>, TError, TData>, fetch?: RequestInit}
204
-
205
- ): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
206
-
207
- const queryOptions = getHomeRetrieveQueryOptions(options)
208
-
209
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
210
-
211
- return { ...query, queryKey: queryOptions.queryKey };
212
- }
213
-
214
-
215
-
216
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omerikanec/api-client-demo",
3
- "version": "0.0.1",
3
+ "version": "2.0.0",
4
4
  "description": "Auto-generated typed API client",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -21,7 +21,8 @@
21
21
  "dist",
22
22
  "impact-report.json",
23
23
  "impact-report.html",
24
- "CHANGELOG.md"
24
+ "CHANGELOG.md",
25
+ "postinstall.js"
25
26
  ],
26
27
  "publishConfig": {
27
28
  "registry": "https://registry.npmjs.org",
@@ -30,6 +31,9 @@
30
31
  "engines": {
31
32
  "node": ">=18"
32
33
  },
34
+ "scripts": {
35
+ "postinstall": "node postinstall.js 2>/dev/null || true"
36
+ },
33
37
  "peerDependencies": {
34
38
  "@tanstack/react-query": ">=4.0.0",
35
39
  "react": ">=17.0.0"
package/postinstall.js ADDED
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env node
2
+ const path = require('path');
3
+
4
+ try {
5
+ const pkgDir = __dirname;
6
+ const htmlReport = path.join(pkgDir, 'impact-report.html');
7
+ const jsonReport = path.join(pkgDir, 'impact-report.json');
8
+ const changelog = path.join(pkgDir, 'CHANGELOG.md');
9
+
10
+ const lines = [];
11
+ lines.push('');
12
+ lines.push(' ⚠ @omerikanec/api-client-demo@new — BREAKING CHANGES');
13
+ lines.push('');
14
+
15
+ lines.push(' Full details:');
16
+ lines.push(' HTML report : ' + htmlReport);
17
+ lines.push(' JSON report : ' + jsonReport);
18
+ lines.push(' Changelog : ' + changelog);
19
+ lines.push('');
20
+ lines.push(' Open the HTML report in your browser for a visual overview.');
21
+ lines.push('');
22
+
23
+ console.log(lines.join('\n'));
24
+ } catch {}