@djangocfg/api 2.1.331 → 2.1.332
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/auth-server.cjs +250 -189
- package/dist/auth-server.cjs.map +1 -1
- package/dist/auth-server.mjs +250 -189
- package/dist/auth-server.mjs.map +1 -1
- package/dist/auth.cjs +249 -188
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.mjs +249 -188
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +248 -187
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +24 -49
- package/dist/clients.d.ts +24 -49
- package/dist/clients.mjs +248 -187
- package/dist/clients.mjs.map +1 -1
- package/dist/index.cjs +332 -234
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +689 -653
- package/dist/index.d.ts +689 -653
- package/dist/index.mjs +332 -234
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/_api/generated/_cfg_accounts/api.ts +29 -82
- package/src/_api/generated/_cfg_accounts/index.ts +4 -4
- package/src/_api/generated/_cfg_centrifugo/api.ts +29 -82
- package/src/_api/generated/_cfg_centrifugo/index.ts +4 -4
- package/src/_api/generated/_cfg_totp/api.ts +29 -82
- package/src/_api/generated/_cfg_totp/index.ts +4 -4
- package/src/_api/generated/client.gen.ts +3 -0
- package/src/_api/generated/helpers/auth.ts +223 -0
- package/src/_api/generated/helpers/index.ts +1 -0
- package/src/_api/generated/index.ts +17 -13
package/dist/clients.d.ts
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { ConsolaInstance } from 'consola';
|
|
2
2
|
|
|
3
|
-
interface StorageAdapter {
|
|
4
|
-
getItem(key: string): string | null;
|
|
5
|
-
setItem(key: string, value: string): void;
|
|
6
|
-
removeItem(key: string): void;
|
|
7
|
-
clear?(): void;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
3
|
interface RequestLog {
|
|
11
4
|
method: string;
|
|
12
5
|
url: string;
|
|
@@ -57,8 +50,6 @@ declare class APILogger {
|
|
|
57
50
|
}
|
|
58
51
|
|
|
59
52
|
interface APIOptions$2 {
|
|
60
|
-
/** Override storage backend (LocalStorage by default; Memory for SSR/tests). */
|
|
61
|
-
storage?: StorageAdapter;
|
|
62
53
|
/** Logger config (defaults to dev-only). */
|
|
63
54
|
logger?: Partial<LoggerConfig>;
|
|
64
55
|
/** Locale for `Accept-Language`. If omitted, auto-detected from cookie/navigator. */
|
|
@@ -69,22 +60,18 @@ interface APIOptions$2 {
|
|
|
69
60
|
withCredentials?: boolean;
|
|
70
61
|
}
|
|
71
62
|
/**
|
|
72
|
-
*
|
|
63
|
+
* Per-group ergonomic facade.
|
|
64
|
+
*
|
|
65
|
+
* Calling `setToken/setApiKey/setLocale/setBaseUrl` proxies to the
|
|
66
|
+
* global `auth` store — the change applies to **every** group's API
|
|
67
|
+
* instance because they share the same HTTP client and interceptor.
|
|
73
68
|
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* - `Authorization: Bearer <jwt>` from storage
|
|
77
|
-
* - `Accept-Language` from `opts.locale` or `NEXT_LOCALE` cookie
|
|
78
|
-
* - `X-API-Key` from `opts.apiKey` or `NEXT_PUBLIC_API_KEY`
|
|
79
|
-
* - `credentials: 'include'` for Django session/CSRF cookies (toggle via opts)
|
|
69
|
+
* Use the global `auth` object directly when you don't need a group
|
|
70
|
+
* facade: `import { auth } from '@your/api'; auth.setToken(jwt);`
|
|
80
71
|
*/
|
|
81
72
|
declare class API$2 {
|
|
82
|
-
private baseUrl;
|
|
83
|
-
private storage;
|
|
84
|
-
private locale;
|
|
85
|
-
private apiKey;
|
|
86
73
|
readonly logger: APILogger;
|
|
87
|
-
constructor(
|
|
74
|
+
constructor(_baseUrl?: string, opts?: APIOptions$2);
|
|
88
75
|
getBaseUrl(): string;
|
|
89
76
|
setBaseUrl(url: string): void;
|
|
90
77
|
getToken(): string | null;
|
|
@@ -100,8 +87,6 @@ declare class API$2 {
|
|
|
100
87
|
}
|
|
101
88
|
|
|
102
89
|
interface APIOptions$1 {
|
|
103
|
-
/** Override storage backend (LocalStorage by default; Memory for SSR/tests). */
|
|
104
|
-
storage?: StorageAdapter;
|
|
105
90
|
/** Logger config (defaults to dev-only). */
|
|
106
91
|
logger?: Partial<LoggerConfig>;
|
|
107
92
|
/** Locale for `Accept-Language`. If omitted, auto-detected from cookie/navigator. */
|
|
@@ -112,22 +97,18 @@ interface APIOptions$1 {
|
|
|
112
97
|
withCredentials?: boolean;
|
|
113
98
|
}
|
|
114
99
|
/**
|
|
115
|
-
*
|
|
100
|
+
* Per-group ergonomic facade.
|
|
116
101
|
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
102
|
+
* Calling `setToken/setApiKey/setLocale/setBaseUrl` proxies to the
|
|
103
|
+
* global `auth` store — the change applies to **every** group's API
|
|
104
|
+
* instance because they share the same HTTP client and interceptor.
|
|
105
|
+
*
|
|
106
|
+
* Use the global `auth` object directly when you don't need a group
|
|
107
|
+
* facade: `import { auth } from '@your/api'; auth.setToken(jwt);`
|
|
123
108
|
*/
|
|
124
109
|
declare class API$1 {
|
|
125
|
-
private baseUrl;
|
|
126
|
-
private storage;
|
|
127
|
-
private locale;
|
|
128
|
-
private apiKey;
|
|
129
110
|
readonly logger: APILogger;
|
|
130
|
-
constructor(
|
|
111
|
+
constructor(_baseUrl?: string, opts?: APIOptions$1);
|
|
131
112
|
getBaseUrl(): string;
|
|
132
113
|
setBaseUrl(url: string): void;
|
|
133
114
|
getToken(): string | null;
|
|
@@ -143,8 +124,6 @@ declare class API$1 {
|
|
|
143
124
|
}
|
|
144
125
|
|
|
145
126
|
interface APIOptions {
|
|
146
|
-
/** Override storage backend (LocalStorage by default; Memory for SSR/tests). */
|
|
147
|
-
storage?: StorageAdapter;
|
|
148
127
|
/** Logger config (defaults to dev-only). */
|
|
149
128
|
logger?: Partial<LoggerConfig>;
|
|
150
129
|
/** Locale for `Accept-Language`. If omitted, auto-detected from cookie/navigator. */
|
|
@@ -155,22 +134,18 @@ interface APIOptions {
|
|
|
155
134
|
withCredentials?: boolean;
|
|
156
135
|
}
|
|
157
136
|
/**
|
|
158
|
-
*
|
|
137
|
+
* Per-group ergonomic facade.
|
|
138
|
+
*
|
|
139
|
+
* Calling `setToken/setApiKey/setLocale/setBaseUrl` proxies to the
|
|
140
|
+
* global `auth` store — the change applies to **every** group's API
|
|
141
|
+
* instance because they share the same HTTP client and interceptor.
|
|
159
142
|
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
* - `Authorization: Bearer <jwt>` from storage
|
|
163
|
-
* - `Accept-Language` from `opts.locale` or `NEXT_LOCALE` cookie
|
|
164
|
-
* - `X-API-Key` from `opts.apiKey` or `NEXT_PUBLIC_API_KEY`
|
|
165
|
-
* - `credentials: 'include'` for Django session/CSRF cookies (toggle via opts)
|
|
143
|
+
* Use the global `auth` object directly when you don't need a group
|
|
144
|
+
* facade: `import { auth } from '@your/api'; auth.setToken(jwt);`
|
|
166
145
|
*/
|
|
167
146
|
declare class API {
|
|
168
|
-
private baseUrl;
|
|
169
|
-
private storage;
|
|
170
|
-
private locale;
|
|
171
|
-
private apiKey;
|
|
172
147
|
readonly logger: APILogger;
|
|
173
|
-
constructor(
|
|
148
|
+
constructor(_baseUrl?: string, opts?: APIOptions);
|
|
174
149
|
getBaseUrl(): string;
|
|
175
150
|
setBaseUrl(url: string): void;
|
|
176
151
|
getToken(): string | null;
|