@teamnovu/kit-shopware-api-client 0.0.15 → 0.2.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/CHANGELOG.md +16 -0
- package/dist/error.d.ts +16 -56
- package/dist/index.mjs +1142 -273
- package/package.json +12 -3
- package/docs/index.md +0 -161
- package/docs/info.json +0 -3
- package/src/client.ts +0 -236
- package/src/error.ts +0 -42
- package/src/eventEmitter.ts +0 -159
- package/src/index.ts +0 -3
- package/src/query.ts +0 -39
- package/src/types.ts +0 -69
- package/tsconfig.json +0 -12
- package/vite.config.js +0 -27
package/src/types.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
export type HttpMethod = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE'
|
|
2
|
-
|
|
3
|
-
// Extract URL parameters from a URL pattern
|
|
4
|
-
type ExtractUrlParams<URL extends string> = URL extends `${infer _Start}/{${infer Param}}${infer Rest}`
|
|
5
|
-
? Param | ExtractUrlParams<Rest>
|
|
6
|
-
: never
|
|
7
|
-
|
|
8
|
-
// Create a record type of required URL parameters
|
|
9
|
-
type UrlParamsRecord<URL extends string> = {
|
|
10
|
-
[K in ExtractUrlParams<URL>]: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export type Operation<Operations, OperationKey extends keyof Operations> = Operations[OperationKey]
|
|
14
|
-
export type OperationProp<
|
|
15
|
-
Operations,
|
|
16
|
-
OperationKey extends keyof Operations,
|
|
17
|
-
Prop extends string,
|
|
18
|
-
> = Operation<Operations, OperationKey> extends { [K in Prop]?: unknown }
|
|
19
|
-
? Operation<Operations, OperationKey>[Prop]
|
|
20
|
-
: never
|
|
21
|
-
|
|
22
|
-
export type InferParameters<T extends string> = UrlParamsRecord<ExtractUrlFromOperation<T>>
|
|
23
|
-
|
|
24
|
-
type OperationKey<Operations> = keyof Operations & string
|
|
25
|
-
type ExtractUrlFromOperation<K extends string> = K extends `${string} ${string} ${infer U}` ? U : never
|
|
26
|
-
|
|
27
|
-
export type OperationOptions<
|
|
28
|
-
Operations,
|
|
29
|
-
K extends OperationKey<Operations>,
|
|
30
|
-
> = Omit<RequestInit, 'body' | 'method'> & {
|
|
31
|
-
body?: OperationProp<Operations, K, 'body'>
|
|
32
|
-
} &
|
|
33
|
-
(UrlParamsRecord<ExtractUrlFromOperation<K>> extends infer T
|
|
34
|
-
? (keyof T extends never ? { params?: void } : { params: T })
|
|
35
|
-
: never)
|
|
36
|
-
& {
|
|
37
|
-
query?: Record<string, unknown>
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface ShopwareClientOptions {
|
|
41
|
-
baseURL: string
|
|
42
|
-
apiKey: string
|
|
43
|
-
includeSeoUrls?: boolean
|
|
44
|
-
language?: string
|
|
45
|
-
headers?: HeadersInit
|
|
46
|
-
requestInitDefaults?: RequestInit
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* If true, the context token will be reflected in the response headers.
|
|
50
|
-
* @default true
|
|
51
|
-
*/
|
|
52
|
-
reflectContextToken?: boolean
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* If provided, it will be used as the context token.
|
|
56
|
-
* If reflectContextToken is true, this token will be used only until the first response
|
|
57
|
-
* sends a new context token.
|
|
58
|
-
* @default undefined
|
|
59
|
-
*/
|
|
60
|
-
contextToken?: string
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* The vue-query queryClientKey of the QueryClient that holds all queries
|
|
64
|
-
* made through this client. If not set, the default QueryClient is used.
|
|
65
|
-
* @default undefined
|
|
66
|
-
*/
|
|
67
|
-
queryClientId?: string
|
|
68
|
-
|
|
69
|
-
}
|
package/tsconfig.json
DELETED
package/vite.config.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { resolve } from 'path'
|
|
2
|
-
import { defineConfig } from 'vite'
|
|
3
|
-
import dts from 'vite-plugin-dts'
|
|
4
|
-
import pkg from './package.json'
|
|
5
|
-
|
|
6
|
-
export default defineConfig({
|
|
7
|
-
plugins: [dts()],
|
|
8
|
-
root: resolve(__dirname),
|
|
9
|
-
esbuild: {
|
|
10
|
-
keepNames: true,
|
|
11
|
-
},
|
|
12
|
-
build: {
|
|
13
|
-
emptyOutDir: false,
|
|
14
|
-
lib: {
|
|
15
|
-
formats: ['es'],
|
|
16
|
-
// Could also be a dictionary or array of multiple entry points
|
|
17
|
-
entry: {
|
|
18
|
-
index: resolve(__dirname, 'src/index.ts'),
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
rollupOptions: {
|
|
22
|
-
// make sure to externalize deps that shouldn't be bundled
|
|
23
|
-
// into your library
|
|
24
|
-
external: ['vue', ...Object.keys(pkg.dependencies ?? {})],
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
})
|