@molecule/app-svelte 3.5.0 → 3.6.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/README.md +226 -72
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/live-store.d.ts +0 -8
- package/dist/hooks/live-store.d.ts.map +1 -1
- package/dist/hooks/live-store.js +0 -13
- package/dist/hooks/maybe-readable.d.ts +36 -0
- package/dist/hooks/maybe-readable.d.ts.map +1 -0
- package/dist/hooks/maybe-readable.js +36 -0
- package/dist/hooks/useAIModels.d.ts +8 -2
- package/dist/hooks/useAIModels.d.ts.map +1 -1
- package/dist/hooks/useAIModels.js +44 -17
- package/dist/hooks/useAuth.d.ts +10 -4
- package/dist/hooks/useAuth.d.ts.map +1 -1
- package/dist/hooks/useAuth.js +39 -13
- package/dist/hooks/useForm.d.ts +11 -3
- package/dist/hooks/useForm.d.ts.map +1 -1
- package/dist/hooks/useForm.js +89 -57
- package/dist/hooks/useHttp.d.ts +28 -22
- package/dist/hooks/useHttp.d.ts.map +1 -1
- package/dist/hooks/useHttp.js +67 -96
- package/dist/hooks/useOAuth.d.ts +23 -7
- package/dist/hooks/useOAuth.d.ts.map +1 -1
- package/dist/hooks/useOAuth.js +51 -18
- package/dist/hooks/useOptimisticValue.d.ts +11 -4
- package/dist/hooks/useOptimisticValue.d.ts.map +1 -1
- package/dist/hooks/useOptimisticValue.js +40 -49
- package/dist/hooks/usePush.d.ts +7 -3
- package/dist/hooks/usePush.d.ts.map +1 -1
- package/dist/hooks/usePush.js +26 -6
- package/dist/hooks/useRouter.d.ts +13 -7
- package/dist/hooks/useRouter.d.ts.map +1 -1
- package/dist/hooks/useRouter.js +39 -18
- package/dist/hooks/useStorage.d.ts +22 -9
- package/dist/hooks/useStorage.d.ts.map +1 -1
- package/dist/hooks/useStorage.js +146 -69
- package/dist/hooks/useStore.d.ts +14 -7
- package/dist/hooks/useStore.d.ts.map +1 -1
- package/dist/hooks/useStore.js +46 -9
- package/dist/hooks/useTranslation.d.ts +6 -2
- package/dist/hooks/useTranslation.d.ts.map +1 -1
- package/dist/hooks/useTranslation.js +11 -6
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/link/Link.svelte +33 -0
- package/dist/link/Link.svelte.d.ts +12 -0
- package/dist/link/Link.svelte.d.ts.map +1 -0
- package/dist/link/index.d.ts +23 -0
- package/dist/link/index.d.ts.map +1 -0
- package/dist/link/index.js +22 -0
- package/dist/link/types.d.ts +26 -0
- package/dist/link/types.d.ts.map +1 -0
- package/dist/link/types.js +6 -0
- package/dist/stores/chat.d.ts +4 -3
- package/dist/stores/chat.d.ts.map +1 -1
- package/dist/stores/chat.js +14 -15
- package/package.json +3 -3
package/dist/hooks/useHttp.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { type Readable } from 'svelte/store';
|
|
7
7
|
import type { RequestConfig } from '@molecule/app-http';
|
|
8
|
+
import { type MaybeReadable } from './maybe-readable.js';
|
|
8
9
|
/** State for async HTTP operations. */
|
|
9
10
|
export interface UseHttpState<T> {
|
|
10
11
|
data: T | null;
|
|
@@ -54,17 +55,22 @@ export interface UseHttpOptions<T> extends RequestConfig {
|
|
|
54
55
|
* HTTP requests with state management, React's `useHttp` in Svelte's idiom:
|
|
55
56
|
* call it during component init under `setMoleculeContext({ http })`.
|
|
56
57
|
*
|
|
58
|
+
* Every argument may be a plain value or a readable store of one (a store
|
|
59
|
+
* holding `undefined` means the argument was omitted): `method`, `url` and the
|
|
60
|
+
* request options are read at the moment `execute` runs, so setting the `url`
|
|
61
|
+
* store retargets the next `execute` on the same component, the way React's
|
|
62
|
+
* re-render does. `immediate` is read on mount only — its request runs once per
|
|
63
|
+
* component even when the arguments change later.
|
|
64
|
+
*
|
|
57
65
|
* The newest request owns the displayed state: an older response answering
|
|
58
66
|
* after a newer `execute` or `reset` cannot touch it (callbacks still report
|
|
59
67
|
* every request's own outcome). A failure resolves `null` — it never rejects
|
|
60
68
|
* to the caller. `reset` takes ownership too, so a request it superseded
|
|
61
|
-
* cannot repopulate the state.
|
|
62
|
-
* options are read at call time. `immediate` runs its request once per host,
|
|
63
|
-
* on mount only, even when the host re-mounts the hook with new arguments.
|
|
69
|
+
* cannot repopulate the state.
|
|
64
70
|
*
|
|
65
|
-
* @param method - HTTP method.
|
|
66
|
-
* @param url - Request URL.
|
|
67
|
-
* @param options - Request options, read at call time.
|
|
71
|
+
* @param method - HTTP method (or a store of it).
|
|
72
|
+
* @param url - Request URL (or a store of it).
|
|
73
|
+
* @param options - Request options, read at call time (or a store of them).
|
|
68
74
|
* @returns Request state as stores and the controls.
|
|
69
75
|
* @example
|
|
70
76
|
* ```svelte
|
|
@@ -78,45 +84,45 @@ export interface UseHttpOptions<T> extends RequestConfig {
|
|
|
78
84
|
* {:else}<UserList users={$data} />{/if}
|
|
79
85
|
* ```
|
|
80
86
|
*/
|
|
81
|
-
export declare function useHttp<T>(method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'
|
|
87
|
+
export declare function useHttp<T>(method: MaybeReadable<'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'>, url: MaybeReadable<string>, options?: MaybeReadable<UseHttpOptions<T> | undefined>): UseHttpResult<T>;
|
|
82
88
|
/**
|
|
83
89
|
* GET requests, React's `useGet` in Svelte's idiom.
|
|
84
90
|
*
|
|
85
|
-
* @param url - Request URL to fetch from.
|
|
86
|
-
* @param options - HTTP request options including callbacks and request config.
|
|
91
|
+
* @param url - Request URL to fetch from (or a store of it).
|
|
92
|
+
* @param options - HTTP request options including callbacks and request config (or a store of them).
|
|
87
93
|
* @returns Request state as stores and the controls.
|
|
88
94
|
*/
|
|
89
|
-
export declare function useGet<T>(url: string
|
|
95
|
+
export declare function useGet<T>(url: MaybeReadable<string>, options?: MaybeReadable<UseHttpOptions<T> | undefined>): UseHttpResult<T>;
|
|
90
96
|
/**
|
|
91
97
|
* POST requests, React's `usePost` in Svelte's idiom.
|
|
92
98
|
*
|
|
93
|
-
* @param url - Request URL to post to.
|
|
94
|
-
* @param options - HTTP request options including body data and callbacks.
|
|
99
|
+
* @param url - Request URL to post to (or a store of it).
|
|
100
|
+
* @param options - HTTP request options including body data and callbacks (or a store of them).
|
|
95
101
|
* @returns Request state as stores and the controls.
|
|
96
102
|
*/
|
|
97
|
-
export declare function usePost<T>(url: string
|
|
103
|
+
export declare function usePost<T>(url: MaybeReadable<string>, options?: MaybeReadable<UseHttpOptions<T> | undefined>): UseHttpResult<T>;
|
|
98
104
|
/**
|
|
99
105
|
* PUT requests, React's `usePut` in Svelte's idiom.
|
|
100
106
|
*
|
|
101
|
-
* @param url - Request URL to send the PUT request to.
|
|
102
|
-
* @param options - HTTP request options including body
|
|
107
|
+
* @param url - Request URL to send the PUT request to (or a store of it).
|
|
108
|
+
* @param options - HTTP request options including the replacement body (or a store of them).
|
|
103
109
|
* @returns Request state as stores and the controls.
|
|
104
110
|
*/
|
|
105
|
-
export declare function usePut<T>(url: string
|
|
111
|
+
export declare function usePut<T>(url: MaybeReadable<string>, options?: MaybeReadable<UseHttpOptions<T> | undefined>): UseHttpResult<T>;
|
|
106
112
|
/**
|
|
107
113
|
* PATCH requests, React's `usePatch` in Svelte's idiom.
|
|
108
114
|
*
|
|
109
|
-
* @param url - Request URL to send the
|
|
110
|
-
* @param options - HTTP request options including partial body
|
|
115
|
+
* @param url - Request URL to send the partial body to (or a store of it).
|
|
116
|
+
* @param options - HTTP request options including the partial body (or a store of them).
|
|
111
117
|
* @returns Request state as stores and the controls.
|
|
112
118
|
*/
|
|
113
|
-
export declare function usePatch<T>(url: string
|
|
119
|
+
export declare function usePatch<T>(url: MaybeReadable<string>, options?: MaybeReadable<UseHttpOptions<T> | undefined>): UseHttpResult<T>;
|
|
114
120
|
/**
|
|
115
121
|
* DELETE requests, React's `useDelete` in Svelte's idiom.
|
|
116
122
|
*
|
|
117
|
-
* @param url - Request URL of the resource to delete.
|
|
118
|
-
* @param options - HTTP request options including callbacks.
|
|
123
|
+
* @param url - Request URL of the resource to delete (or a store of it).
|
|
124
|
+
* @param options - HTTP request options including callbacks (or a store of them).
|
|
119
125
|
* @returns Request state as stores and the controls.
|
|
120
126
|
*/
|
|
121
|
-
export declare function useDelete<T>(url: string
|
|
127
|
+
export declare function useDelete<T>(url: MaybeReadable<string>, options?: MaybeReadable<UseHttpOptions<T> | undefined>): UseHttpResult<T>;
|
|
122
128
|
//# sourceMappingURL=useHttp.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHttp.d.ts","sourceRoot":"","sources":["../../src/hooks/useHttp.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,
|
|
1
|
+
{"version":3,"file":"useHttp.d.ts","sourceRoot":"","sources":["../../src/hooks/useHttp.ts"],"names":[],"mappings":"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"}
|
package/dist/hooks/useHttp.js
CHANGED
|
@@ -4,27 +4,31 @@
|
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
import { onDestroy } from 'svelte';
|
|
7
|
-
import { writable } from 'svelte/store';
|
|
7
|
+
import { get, writable } from 'svelte/store';
|
|
8
8
|
import { t } from '@molecule/app-i18n';
|
|
9
9
|
import { useHttpClient } from '../context.js';
|
|
10
10
|
import { fieldStore } from './live-store.js';
|
|
11
|
-
|
|
12
|
-
let handoff = null;
|
|
11
|
+
import { toReadable } from './maybe-readable.js';
|
|
13
12
|
/**
|
|
14
13
|
* HTTP requests with state management, React's `useHttp` in Svelte's idiom:
|
|
15
14
|
* call it during component init under `setMoleculeContext({ http })`.
|
|
16
15
|
*
|
|
16
|
+
* Every argument may be a plain value or a readable store of one (a store
|
|
17
|
+
* holding `undefined` means the argument was omitted): `method`, `url` and the
|
|
18
|
+
* request options are read at the moment `execute` runs, so setting the `url`
|
|
19
|
+
* store retargets the next `execute` on the same component, the way React's
|
|
20
|
+
* re-render does. `immediate` is read on mount only — its request runs once per
|
|
21
|
+
* component even when the arguments change later.
|
|
22
|
+
*
|
|
17
23
|
* The newest request owns the displayed state: an older response answering
|
|
18
24
|
* after a newer `execute` or `reset` cannot touch it (callbacks still report
|
|
19
25
|
* every request's own outcome). A failure resolves `null` — it never rejects
|
|
20
26
|
* to the caller. `reset` takes ownership too, so a request it superseded
|
|
21
|
-
* cannot repopulate the state.
|
|
22
|
-
* options are read at call time. `immediate` runs its request once per host,
|
|
23
|
-
* on mount only, even when the host re-mounts the hook with new arguments.
|
|
27
|
+
* cannot repopulate the state.
|
|
24
28
|
*
|
|
25
|
-
* @param method - HTTP method.
|
|
26
|
-
* @param url - Request URL.
|
|
27
|
-
* @param options - Request options, read at call time.
|
|
29
|
+
* @param method - HTTP method (or a store of it).
|
|
30
|
+
* @param url - Request URL (or a store of it).
|
|
31
|
+
* @param options - Request options, read at call time (or a store of them).
|
|
28
32
|
* @returns Request state as stores and the controls.
|
|
29
33
|
* @example
|
|
30
34
|
* ```svelte
|
|
@@ -40,110 +44,78 @@ let handoff = null;
|
|
|
40
44
|
*/
|
|
41
45
|
export function useHttp(method, url, options) {
|
|
42
46
|
const client = useHttpClient();
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
};
|
|
56
|
-
if (adopted)
|
|
57
|
-
adopted.dead = false;
|
|
58
|
-
// The displayed state starts from the lane's last published state (what
|
|
59
|
-
// React's single instance kept), or from the initial one; the lane mirrors
|
|
60
|
-
// exactly what the store shows, so a replacing mount reads the same values.
|
|
61
|
-
const initialState = {
|
|
62
|
-
data: adopted ? lane.state.data : null,
|
|
63
|
-
loading: adopted ? lane.state.loading : immediate,
|
|
64
|
-
error: adopted ? lane.state.error : null,
|
|
65
|
-
};
|
|
66
|
-
const state = writable(initialState);
|
|
67
|
-
lane.state = { ...initialState };
|
|
68
|
-
lane.sink = {
|
|
69
|
-
patch: (next) => {
|
|
70
|
-
if (next.data !== undefined) {
|
|
71
|
-
lane.state.data = next.data;
|
|
72
|
-
state.update((current) => ({ ...current, data: next.data }));
|
|
73
|
-
}
|
|
74
|
-
// Read once into locals: the narrowed type is lost inside the updater
|
|
75
|
-
// closure (`state.update` runs later).
|
|
76
|
-
const loading = next.loading;
|
|
77
|
-
if (loading !== undefined) {
|
|
78
|
-
lane.state.loading = loading;
|
|
79
|
-
state.update((current) => ({ ...current, loading }));
|
|
80
|
-
}
|
|
81
|
-
const error = next.error;
|
|
82
|
-
if (error !== undefined) {
|
|
83
|
-
lane.state.error = error;
|
|
84
|
-
state.update((current) => ({ ...current, error }));
|
|
85
|
-
}
|
|
86
|
-
},
|
|
47
|
+
const methodStore = toReadable(method);
|
|
48
|
+
const urlStore = toReadable(url);
|
|
49
|
+
const optionsStore = toReadable(options);
|
|
50
|
+
const immediate = get(optionsStore)?.immediate ?? false;
|
|
51
|
+
const state = writable({
|
|
52
|
+
data: null,
|
|
53
|
+
loading: immediate,
|
|
54
|
+
error: null,
|
|
55
|
+
});
|
|
56
|
+
/** Applies one state patch; `undefined` fields are left alone. */
|
|
57
|
+
const patch = (next) => {
|
|
58
|
+
state.update((current) => ({ ...current, ...next }));
|
|
87
59
|
};
|
|
60
|
+
// React's mounted flag: false once the component is gone, so a late answer
|
|
61
|
+
// settles quietly (no state write, no callback) as it does there.
|
|
62
|
+
let mounted = true;
|
|
88
63
|
onDestroy(() => {
|
|
89
|
-
|
|
90
|
-
lane.dead = true;
|
|
91
|
-
// Offer the lane to a mount in the same turn (React's re-render); the
|
|
92
|
-
// timer clears it when no replacement adopted, so a mount after a settled
|
|
93
|
-
// teardown starts fresh.
|
|
94
|
-
handoff = lane;
|
|
95
|
-
const offered = lane;
|
|
96
|
-
setTimeout(() => {
|
|
97
|
-
if (handoff === offered)
|
|
98
|
-
handoff = null;
|
|
99
|
-
}, 0);
|
|
64
|
+
mounted = false;
|
|
100
65
|
});
|
|
66
|
+
// The newest request owns the state. Without this, an older request that
|
|
67
|
+
// answers after a newer one (a slow first load, then a refetch) overwrote the
|
|
68
|
+
// newer data and cleared `loading` while the newer request was still in flight.
|
|
69
|
+
// `reset` takes ownership too, so a request it superseded cannot repopulate.
|
|
70
|
+
let latestRequest = 0;
|
|
101
71
|
const execute = async () => {
|
|
102
|
-
if (
|
|
72
|
+
if (!mounted)
|
|
103
73
|
return null;
|
|
104
74
|
// Options describe the request being sent, read at call time; method/url/
|
|
105
75
|
// client decide WHICH request execute performs.
|
|
106
|
-
const
|
|
107
|
-
const
|
|
76
|
+
const currentMethod = get(methodStore);
|
|
77
|
+
const currentUrl = get(urlStore);
|
|
78
|
+
const { immediate: _immediate, onSuccess, onError, ...requestConfig } = get(optionsStore) ?? {};
|
|
79
|
+
const request = ++latestRequest;
|
|
108
80
|
// Callbacks report THIS request's outcome (a submit's onSuccess still
|
|
109
81
|
// runs); only the newest request may change what the hook shows.
|
|
110
|
-
const ownsState = () =>
|
|
111
|
-
|
|
82
|
+
const ownsState = () => mounted && request === latestRequest;
|
|
83
|
+
patch({ loading: true, error: null });
|
|
112
84
|
try {
|
|
113
85
|
let response;
|
|
114
|
-
switch (
|
|
86
|
+
switch (currentMethod) {
|
|
115
87
|
case 'GET':
|
|
116
|
-
response = await client.get(
|
|
88
|
+
response = await client.get(currentUrl, requestConfig);
|
|
117
89
|
break;
|
|
118
90
|
case 'POST':
|
|
119
|
-
response = await client.post(
|
|
91
|
+
response = await client.post(currentUrl, requestConfig.data, requestConfig);
|
|
120
92
|
break;
|
|
121
93
|
case 'PUT':
|
|
122
|
-
response = await client.put(
|
|
94
|
+
response = await client.put(currentUrl, requestConfig.data, requestConfig);
|
|
123
95
|
break;
|
|
124
96
|
case 'PATCH':
|
|
125
|
-
response = await client.patch(
|
|
97
|
+
response = await client.patch(currentUrl, requestConfig.data, requestConfig);
|
|
126
98
|
break;
|
|
127
99
|
case 'DELETE':
|
|
128
|
-
response = await client.delete(
|
|
100
|
+
response = await client.delete(currentUrl, requestConfig);
|
|
129
101
|
break;
|
|
130
102
|
default:
|
|
131
|
-
throw new Error(t('svelte.error.unsupportedMethod', { method }, {
|
|
103
|
+
throw new Error(t('svelte.error.unsupportedMethod', { method: currentMethod }, {
|
|
132
104
|
defaultValue: 'Unsupported method: {{method}}',
|
|
133
105
|
}));
|
|
134
106
|
}
|
|
135
|
-
if (
|
|
107
|
+
if (mounted) {
|
|
136
108
|
if (ownsState())
|
|
137
|
-
|
|
109
|
+
patch({ data: response.data, loading: false, error: null });
|
|
138
110
|
onSuccess?.(response.data);
|
|
139
111
|
}
|
|
140
112
|
return response.data;
|
|
141
113
|
}
|
|
142
114
|
catch (error) {
|
|
143
115
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
144
|
-
if (
|
|
116
|
+
if (mounted) {
|
|
145
117
|
if (ownsState())
|
|
146
|
-
|
|
118
|
+
patch({ data: null, loading: false, error: err });
|
|
147
119
|
onError?.(err);
|
|
148
120
|
}
|
|
149
121
|
return null;
|
|
@@ -151,13 +123,12 @@ export function useHttp(method, url, options) {
|
|
|
151
123
|
};
|
|
152
124
|
const reset = () => {
|
|
153
125
|
// reset takes ownership: a request it superseded cannot repopulate.
|
|
154
|
-
|
|
155
|
-
|
|
126
|
+
latestRequest++;
|
|
127
|
+
patch({ data: null, loading: false, error: null });
|
|
156
128
|
};
|
|
157
|
-
// Execute immediately if requested — mount only, once per
|
|
158
|
-
// historical contract.
|
|
159
|
-
if (immediate
|
|
160
|
-
lane.ranImmediate = true;
|
|
129
|
+
// Execute immediately if requested — mount only, once per component, the
|
|
130
|
+
// option's historical contract: an argument change never repeats it.
|
|
131
|
+
if (immediate) {
|
|
161
132
|
void execute();
|
|
162
133
|
}
|
|
163
134
|
return {
|
|
@@ -171,8 +142,8 @@ export function useHttp(method, url, options) {
|
|
|
171
142
|
/**
|
|
172
143
|
* GET requests, React's `useGet` in Svelte's idiom.
|
|
173
144
|
*
|
|
174
|
-
* @param url - Request URL to fetch from.
|
|
175
|
-
* @param options - HTTP request options including callbacks and request config.
|
|
145
|
+
* @param url - Request URL to fetch from (or a store of it).
|
|
146
|
+
* @param options - HTTP request options including callbacks and request config (or a store of them).
|
|
176
147
|
* @returns Request state as stores and the controls.
|
|
177
148
|
*/
|
|
178
149
|
export function useGet(url, options) {
|
|
@@ -181,8 +152,8 @@ export function useGet(url, options) {
|
|
|
181
152
|
/**
|
|
182
153
|
* POST requests, React's `usePost` in Svelte's idiom.
|
|
183
154
|
*
|
|
184
|
-
* @param url - Request URL to post to.
|
|
185
|
-
* @param options - HTTP request options including body data and callbacks.
|
|
155
|
+
* @param url - Request URL to post to (or a store of it).
|
|
156
|
+
* @param options - HTTP request options including body data and callbacks (or a store of them).
|
|
186
157
|
* @returns Request state as stores and the controls.
|
|
187
158
|
*/
|
|
188
159
|
export function usePost(url, options) {
|
|
@@ -191,8 +162,8 @@ export function usePost(url, options) {
|
|
|
191
162
|
/**
|
|
192
163
|
* PUT requests, React's `usePut` in Svelte's idiom.
|
|
193
164
|
*
|
|
194
|
-
* @param url - Request URL to send the PUT request to.
|
|
195
|
-
* @param options - HTTP request options including body
|
|
165
|
+
* @param url - Request URL to send the PUT request to (or a store of it).
|
|
166
|
+
* @param options - HTTP request options including the replacement body (or a store of them).
|
|
196
167
|
* @returns Request state as stores and the controls.
|
|
197
168
|
*/
|
|
198
169
|
export function usePut(url, options) {
|
|
@@ -201,8 +172,8 @@ export function usePut(url, options) {
|
|
|
201
172
|
/**
|
|
202
173
|
* PATCH requests, React's `usePatch` in Svelte's idiom.
|
|
203
174
|
*
|
|
204
|
-
* @param url - Request URL to send the
|
|
205
|
-
* @param options - HTTP request options including partial body
|
|
175
|
+
* @param url - Request URL to send the partial body to (or a store of it).
|
|
176
|
+
* @param options - HTTP request options including the partial body (or a store of them).
|
|
206
177
|
* @returns Request state as stores and the controls.
|
|
207
178
|
*/
|
|
208
179
|
export function usePatch(url, options) {
|
|
@@ -211,8 +182,8 @@ export function usePatch(url, options) {
|
|
|
211
182
|
/**
|
|
212
183
|
* DELETE requests, React's `useDelete` in Svelte's idiom.
|
|
213
184
|
*
|
|
214
|
-
* @param url - Request URL of the resource to delete.
|
|
215
|
-
* @param options - HTTP request options including callbacks.
|
|
185
|
+
* @param url - Request URL of the resource to delete (or a store of it).
|
|
186
|
+
* @param options - HTTP request options including callbacks (or a store of them).
|
|
216
187
|
* @returns Request state as stores and the controls.
|
|
217
188
|
*/
|
|
218
189
|
export function useDelete(url, options) {
|
package/dist/hooks/useOAuth.d.ts
CHANGED
|
@@ -27,12 +27,19 @@
|
|
|
27
27
|
*
|
|
28
28
|
* @module
|
|
29
29
|
*/
|
|
30
|
+
import { type MaybeReadable } from './maybe-readable.js';
|
|
30
31
|
/**
|
|
31
32
|
* Return type for useOAuth hook.
|
|
32
33
|
*/
|
|
33
34
|
export interface UseOAuthReturn {
|
|
34
|
-
/**
|
|
35
|
-
|
|
35
|
+
/**
|
|
36
|
+
* The configured provider names (React's `string[]`), read live: each read
|
|
37
|
+
* returns the list the current config holds, and a read in markup or
|
|
38
|
+
* `$derived` re-runs when a config store changes. Read it off the result
|
|
39
|
+
* (`oauth.providers`); a destructured copy keeps the list of the moment it
|
|
40
|
+
* was taken.
|
|
41
|
+
*/
|
|
42
|
+
readonly providers: string[];
|
|
36
43
|
/** Builds the provider's initiation URL (provider encoded as one path segment). */
|
|
37
44
|
getOAuthUrl: (provider: string) => string;
|
|
38
45
|
/** Full-page redirect to the provider (default). The opener page navigates away. */
|
|
@@ -78,19 +85,28 @@ export interface UseOAuthConfig {
|
|
|
78
85
|
* when the callback is running inside a popup we opened, relaying the result
|
|
79
86
|
* to the opener instead.
|
|
80
87
|
*
|
|
81
|
-
*
|
|
88
|
+
* The config may be a plain value or a readable store of one (a store holding
|
|
89
|
+
* `undefined` means no config): every field — the provider list, the URL
|
|
90
|
+
* pieces, the callbacks, the `navigate` option — is read at the moment it is
|
|
91
|
+
* used, so setting the store retargets the next `getOAuthUrl`/`redirect`/popup
|
|
92
|
+
* flow on the same component, the way React's re-render does. `providers` is
|
|
93
|
+
* React's `string[]`, read live (see {@link UseOAuthReturn.providers}). The
|
|
94
|
+
* callback exchange, when it finds a `code` in the URL, runs once with the
|
|
95
|
+
* config the hook was called with.
|
|
96
|
+
*
|
|
97
|
+
* @param config - Optional OAuth configuration override (or a store of it).
|
|
82
98
|
* @returns OAuth helpers: providers, getOAuthUrl, redirect, and loginViaPopup.
|
|
83
99
|
* @example
|
|
84
100
|
* ```svelte
|
|
85
101
|
* <script>
|
|
86
102
|
* import { useOAuth } from '@molecule/app-svelte'
|
|
87
|
-
* const
|
|
103
|
+
* const oauth = useOAuth()
|
|
88
104
|
* </script>
|
|
89
105
|
*
|
|
90
|
-
* {#each providers as provider}
|
|
91
|
-
* <button onclick={() => loginViaPopup(provider)}>Login with {provider}</button>
|
|
106
|
+
* {#each oauth.providers as provider}
|
|
107
|
+
* <button onclick={() => oauth.loginViaPopup(provider)}>Login with {provider}</button>
|
|
92
108
|
* {/each}
|
|
93
109
|
* ```
|
|
94
110
|
*/
|
|
95
|
-
export declare function useOAuth(config?: UseOAuthConfig): UseOAuthReturn;
|
|
111
|
+
export declare function useOAuth(config?: MaybeReadable<UseOAuthConfig | undefined>): UseOAuthReturn;
|
|
96
112
|
//# sourceMappingURL=useOAuth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOAuth.d.ts","sourceRoot":"","sources":["../../src/hooks/useOAuth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;
|
|
1
|
+
{"version":3,"file":"useOAuth.d.ts","sourceRoot":"","sources":["../../src/hooks/useOAuth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AASH,OAAO,EAAE,KAAK,aAAa,EAAc,MAAM,qBAAqB,CAAA;AAiCpE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,CAAA;IAC5B,mFAAmF;IACnF,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAA;IACzC,oFAAoF;IACpF,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC;;;;;OAKG;IACH,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;CAC1C;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,0EAA0E;IAC1E,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;IACzB,2DAA2D;IAC3D,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,kFAAkF;IAClF,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,uCAAuC;IACvC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,cAAc,GAAG,SAAS,CAAC,GAAG,cAAc,CAqU3F"}
|
package/dist/hooks/useOAuth.js
CHANGED
|
@@ -28,8 +28,11 @@
|
|
|
28
28
|
* @module
|
|
29
29
|
*/
|
|
30
30
|
import { onDestroy } from 'svelte';
|
|
31
|
+
import { createSubscriber } from 'svelte/reactivity';
|
|
32
|
+
import { get } from 'svelte/store';
|
|
31
33
|
import { t } from '@molecule/app-i18n';
|
|
32
34
|
import { useAuthClient } from '../context.js';
|
|
35
|
+
import { toReadable } from './maybe-readable.js';
|
|
33
36
|
/** What `onError` gets when the server gives no reason of its own. */
|
|
34
37
|
const oauthFailed = () => t('svelte.error.oauthFailed', undefined, { defaultValue: 'OAuth login failed' });
|
|
35
38
|
/**
|
|
@@ -51,32 +54,55 @@ const OAUTH_POPUP_TIMEOUT_MS = 5 * 60 * 1000;
|
|
|
51
54
|
* when the callback is running inside a popup we opened, relaying the result
|
|
52
55
|
* to the opener instead.
|
|
53
56
|
*
|
|
54
|
-
*
|
|
57
|
+
* The config may be a plain value or a readable store of one (a store holding
|
|
58
|
+
* `undefined` means no config): every field — the provider list, the URL
|
|
59
|
+
* pieces, the callbacks, the `navigate` option — is read at the moment it is
|
|
60
|
+
* used, so setting the store retargets the next `getOAuthUrl`/`redirect`/popup
|
|
61
|
+
* flow on the same component, the way React's re-render does. `providers` is
|
|
62
|
+
* React's `string[]`, read live (see {@link UseOAuthReturn.providers}). The
|
|
63
|
+
* callback exchange, when it finds a `code` in the URL, runs once with the
|
|
64
|
+
* config the hook was called with.
|
|
65
|
+
*
|
|
66
|
+
* @param config - Optional OAuth configuration override (or a store of it).
|
|
55
67
|
* @returns OAuth helpers: providers, getOAuthUrl, redirect, and loginViaPopup.
|
|
56
68
|
* @example
|
|
57
69
|
* ```svelte
|
|
58
70
|
* <script>
|
|
59
71
|
* import { useOAuth } from '@molecule/app-svelte'
|
|
60
|
-
* const
|
|
72
|
+
* const oauth = useOAuth()
|
|
61
73
|
* </script>
|
|
62
74
|
*
|
|
63
|
-
* {#each providers as provider}
|
|
64
|
-
* <button onclick={() => loginViaPopup(provider)}>Login with {provider}</button>
|
|
75
|
+
* {#each oauth.providers as provider}
|
|
76
|
+
* <button onclick={() => oauth.loginViaPopup(provider)}>Login with {provider}</button>
|
|
65
77
|
* {/each}
|
|
66
78
|
* ```
|
|
67
79
|
*/
|
|
68
80
|
export function useOAuth(config) {
|
|
69
81
|
const authClient = useAuthClient();
|
|
82
|
+
const configStore = toReadable(config);
|
|
83
|
+
const current = () => get(configStore);
|
|
70
84
|
// Whether the component is mounted, read when a flow settles.
|
|
71
85
|
let mounted = true;
|
|
72
86
|
onDestroy(() => {
|
|
73
87
|
mounted = false;
|
|
74
88
|
});
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
89
|
+
// `providers` is read live, like React's re-rendered array: a read inside markup or an
|
|
90
|
+
// effect subscribes the config store (a plain config's constant store never notifies),
|
|
91
|
+
// so a changed config re-runs it. The store's synchronous first call is the value the
|
|
92
|
+
// read already returns, not a change.
|
|
93
|
+
const trackConfig = createSubscriber((update) => {
|
|
94
|
+
let started = false;
|
|
95
|
+
const unsubscribe = configStore.subscribe(() => {
|
|
96
|
+
if (started)
|
|
97
|
+
update();
|
|
98
|
+
});
|
|
99
|
+
started = true;
|
|
100
|
+
return unsubscribe;
|
|
101
|
+
});
|
|
79
102
|
const getOAuthUrl = (provider) => {
|
|
103
|
+
const now = current();
|
|
104
|
+
const baseURL = now?.baseURL ?? '';
|
|
105
|
+
const oauthEndpoint = now?.oauthEndpoint ?? '/oauth';
|
|
80
106
|
// Encode the provider as a single path segment so a (future) caller passing an
|
|
81
107
|
// untrusted value can never inject a path/query/scheme into the opened URL —
|
|
82
108
|
// defense-in-depth on top of the upstream static provider allowlist. Plain
|
|
@@ -125,9 +151,9 @@ export function useOAuth(config) {
|
|
|
125
151
|
}
|
|
126
152
|
return false;
|
|
127
153
|
};
|
|
128
|
-
const navigateOption = config?.navigate;
|
|
129
154
|
/** Leaves the page for the provider: the `navigate` option, else a full-page navigation. */
|
|
130
155
|
const leaveFor = (url) => {
|
|
156
|
+
const navigateOption = current()?.navigate;
|
|
131
157
|
if (navigateOption)
|
|
132
158
|
navigateOption(url);
|
|
133
159
|
else
|
|
@@ -203,13 +229,13 @@ export function useOAuth(config) {
|
|
|
203
229
|
if (!mounted)
|
|
204
230
|
return;
|
|
205
231
|
if (ok)
|
|
206
|
-
|
|
232
|
+
current()?.onSuccess?.();
|
|
207
233
|
else
|
|
208
|
-
|
|
234
|
+
current()?.onError?.(oauthFailed());
|
|
209
235
|
});
|
|
210
236
|
}
|
|
211
237
|
else if (mounted) {
|
|
212
|
-
|
|
238
|
+
current()?.onError?.(typeof data.error === 'string' ? data.error : oauthFailed());
|
|
213
239
|
}
|
|
214
240
|
};
|
|
215
241
|
window.addEventListener('message', onMessage);
|
|
@@ -285,7 +311,11 @@ export function useOAuth(config) {
|
|
|
285
311
|
/* best-effort */
|
|
286
312
|
}
|
|
287
313
|
};
|
|
288
|
-
// Exchange code for session
|
|
314
|
+
// Exchange code for session, with the config the hook was called with
|
|
315
|
+
// (React's mount effect reads its config once).
|
|
316
|
+
const configNow = current();
|
|
317
|
+
const baseURL = configNow?.baseURL ?? '';
|
|
318
|
+
const loginEndpoint = configNow?.loginEndpoint ?? '/users/log-in/oauth';
|
|
289
319
|
const exchangeCode = async () => {
|
|
290
320
|
try {
|
|
291
321
|
const response = await fetch(`${baseURL}${loginEndpoint}`, {
|
|
@@ -310,7 +340,7 @@ export function useOAuth(config) {
|
|
|
310
340
|
return;
|
|
311
341
|
}
|
|
312
342
|
if (mounted)
|
|
313
|
-
|
|
343
|
+
configNow?.onError?.(error);
|
|
314
344
|
return;
|
|
315
345
|
}
|
|
316
346
|
// A body that is not JSON carries no user; the token comes from the header.
|
|
@@ -336,9 +366,9 @@ export function useOAuth(config) {
|
|
|
336
366
|
if (!mounted)
|
|
337
367
|
return;
|
|
338
368
|
if (ok)
|
|
339
|
-
|
|
369
|
+
configNow?.onSuccess?.();
|
|
340
370
|
else
|
|
341
|
-
|
|
371
|
+
configNow?.onError?.(oauthFailed());
|
|
342
372
|
}
|
|
343
373
|
catch (err) {
|
|
344
374
|
const error = err instanceof Error ? err.message : oauthFailed();
|
|
@@ -347,7 +377,7 @@ export function useOAuth(config) {
|
|
|
347
377
|
return;
|
|
348
378
|
}
|
|
349
379
|
if (mounted)
|
|
350
|
-
|
|
380
|
+
configNow?.onError?.(error);
|
|
351
381
|
}
|
|
352
382
|
};
|
|
353
383
|
void exchangeCode();
|
|
@@ -355,7 +385,10 @@ export function useOAuth(config) {
|
|
|
355
385
|
}
|
|
356
386
|
}
|
|
357
387
|
return {
|
|
358
|
-
providers
|
|
388
|
+
get providers() {
|
|
389
|
+
trackConfig();
|
|
390
|
+
return current()?.oauthProviders ?? [];
|
|
391
|
+
},
|
|
359
392
|
getOAuthUrl,
|
|
360
393
|
redirect,
|
|
361
394
|
loginViaPopup,
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { type Readable } from 'svelte/store';
|
|
8
8
|
import type { OptimisticValueOptions } from '@molecule/app-state';
|
|
9
|
+
import { type MaybeReadable } from './maybe-readable.js';
|
|
9
10
|
/**
|
|
10
11
|
* What {@link useOptimisticValue} returns: the state to render as readable
|
|
11
12
|
* stores and the two ways to change it (the same names React returns).
|
|
@@ -38,21 +39,27 @@ export interface UseOptimisticValueResult<T> {
|
|
|
38
39
|
* a favorite flag and its count, in the SAME value. Let commit reject on
|
|
39
40
|
* failure: a catch that returns old data hides the failure.
|
|
40
41
|
*
|
|
41
|
-
*
|
|
42
|
+
* The options may be a plain value or a readable store of one: setting the
|
|
43
|
+
* store applies the new server value (and the new `commit`, `equals` and
|
|
44
|
+
* `onError`) on the same component, the way React's re-render does — the
|
|
45
|
+
* controller, and any save it is running, survive the change.
|
|
46
|
+
*
|
|
47
|
+
* @param options - The server's current value and how to save a change (or a store of them).
|
|
42
48
|
* @returns The value to render, whether a save is pending, the newest failure,
|
|
43
49
|
* and `set`/`update`.
|
|
44
50
|
* @example
|
|
45
51
|
* ```svelte
|
|
46
52
|
* <script>
|
|
47
53
|
* import { useOptimisticValue } from '@molecule/app-svelte'
|
|
48
|
-
*
|
|
54
|
+
* // `value` is the store; the result itself is not, so take the store out to read it with `$`.
|
|
55
|
+
* const { value: star, update } = useOptimisticValue({
|
|
49
56
|
* value: { starred: repository.starred, stars: repository.stars },
|
|
50
57
|
* commit: async (next) => { /* save and return the server's value * },
|
|
51
58
|
* })
|
|
52
59
|
* </script>
|
|
53
60
|
*
|
|
54
|
-
* <button aria-pressed={$star.
|
|
61
|
+
* <button aria-pressed={$star.starred} onclick={() => update((on) => ({ ...on, starred: !on.starred }))}>
|
|
55
62
|
* ```
|
|
56
63
|
*/
|
|
57
|
-
export declare const useOptimisticValue: <T>(options: OptimisticValueOptions<T
|
|
64
|
+
export declare const useOptimisticValue: <T>(options: MaybeReadable<OptimisticValueOptions<T>>) => UseOptimisticValueResult<T>;
|
|
58
65
|
//# sourceMappingURL=useOptimisticValue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOptimisticValue.d.ts","sourceRoot":"","sources":["../../src/hooks/useOptimisticValue.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,
|
|
1
|
+
{"version":3,"file":"useOptimisticValue.d.ts","sourceRoot":"","sources":["../../src/hooks/useOptimisticValue.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAO,KAAK,QAAQ,EAAY,MAAM,cAAc,CAAA;AAE3D,OAAO,KAAK,EAAE,sBAAsB,EAAwB,MAAM,qBAAqB,CAAA;AAIvF,OAAO,EAAE,KAAK,aAAa,EAAc,MAAM,qBAAqB,CAAA;AAEpE;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB,CAAC,CAAC;IACzC,2BAA2B;IAC3B,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAA;IAClB,4CAA4C;IAC5C,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;IAC1B,wCAAwC;IACxC,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;IACxB,yEAAyE;IACzE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAA;IACtB,6EAA6E;IAC7E,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,CAAA;CAC5C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,kBAAkB,GAAI,CAAC,EAClC,SAAS,aAAa,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,KAChD,wBAAwB,CAAC,CAAC,CA6C5B,CAAA"}
|