@take-out/better-auth-utils 0.4.3 → 0.4.4
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/cjs/createAuthClient.cjs +140 -89
- package/dist/cjs/createAuthClient.native.js +185 -141
- package/dist/cjs/createAuthClient.native.js.map +1 -1
- package/dist/cjs/index.cjs +7 -5
- package/dist/cjs/index.native.js +7 -5
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/server.cjs +57 -42
- package/dist/cjs/server.native.js +137 -92
- package/dist/cjs/server.native.js.map +1 -1
- package/dist/esm/createAuthClient.mjs +126 -77
- package/dist/esm/createAuthClient.mjs.map +1 -1
- package/dist/esm/createAuthClient.native.js +171 -129
- package/dist/esm/createAuthClient.native.js.map +1 -1
- package/dist/esm/server.mjs +45 -32
- package/dist/esm/server.mjs.map +1 -1
- package/dist/esm/server.native.js +125 -82
- package/dist/esm/server.native.js.map +1 -1
- package/package.json +3 -3
|
@@ -5,150 +5,177 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value:
|
|
23
|
+
value: true
|
|
22
24
|
}), mod);
|
|
23
25
|
var createAuthClient_exports = {};
|
|
24
26
|
__export(createAuthClient_exports, {
|
|
25
27
|
createBetterAuthClient: () => createBetterAuthClient
|
|
26
28
|
});
|
|
27
29
|
module.exports = __toCommonJS(createAuthClient_exports);
|
|
28
|
-
var import_helpers = require("@take-out/helpers")
|
|
29
|
-
|
|
30
|
+
var import_helpers = require("@take-out/helpers");
|
|
31
|
+
var import_client = require("better-auth/client");
|
|
30
32
|
function createBetterAuthClient(options) {
|
|
31
33
|
var {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
34
|
+
onAuthStateChange,
|
|
35
|
+
onAuthError,
|
|
36
|
+
createUser,
|
|
37
|
+
storagePrefix = "auth",
|
|
38
|
+
retryDelay = 4e3,
|
|
39
|
+
useJWT = false,
|
|
40
|
+
authCookieNames = ["better-auth.jwt", "better-auth.session_token"],
|
|
41
|
+
...authClientOptions
|
|
42
|
+
} = options;
|
|
43
|
+
var empty = {
|
|
44
|
+
state: "logged-out",
|
|
45
|
+
session: null,
|
|
46
|
+
user: null,
|
|
47
|
+
token: null
|
|
48
|
+
};
|
|
49
|
+
var keysStorage = (0, import_helpers.createStorageValue)(`${storagePrefix}-keys`);
|
|
50
|
+
var stateStorage = (0, import_helpers.createStorageValue)(`${storagePrefix}-state`);
|
|
51
|
+
var createAuthClientWithSession = function (session) {
|
|
52
|
+
return (0, import_client.createAuthClient)({
|
|
53
|
+
...authClientOptions,
|
|
54
|
+
fetchOptions: {
|
|
55
|
+
credentials: "include",
|
|
56
|
+
headers: session ? {
|
|
57
|
+
Authorization: `Bearer ${session}`
|
|
58
|
+
} : void 0
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
var authClient = function () {
|
|
63
|
+
var _keysStorage_get;
|
|
64
|
+
var existingSession = (_keysStorage_get = keysStorage.get()) === null || _keysStorage_get === void 0 ? void 0 : _keysStorage_get.session;
|
|
65
|
+
return existingSession ? createAuthClientWithSession(existingSession) : (0, import_client.createAuthClient)({
|
|
66
|
+
...authClientOptions,
|
|
67
|
+
fetchOptions: {
|
|
68
|
+
credentials: "include"
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}();
|
|
72
|
+
var authState = (0, import_helpers.createEmitter)("authState", stateStorage.get() || empty, {
|
|
73
|
+
comparator: import_helpers.isEqualDeepLite
|
|
74
|
+
});
|
|
75
|
+
var authClientVersion = (0, import_helpers.createEmitter)("authClientVersion", 0);
|
|
76
|
+
var setState = function (update) {
|
|
77
|
+
var current = authState.value;
|
|
78
|
+
var next = {
|
|
79
|
+
...current,
|
|
80
|
+
...update
|
|
81
|
+
};
|
|
82
|
+
stateStorage.set(next);
|
|
83
|
+
authState.emit(next);
|
|
84
|
+
if (next.token && next.session) {
|
|
85
|
+
keysStorage.set({
|
|
81
86
|
token: next.token,
|
|
82
87
|
session: next.session.token
|
|
83
|
-
})
|
|
88
|
+
});
|
|
89
|
+
} else if (next.session) {
|
|
90
|
+
keysStorage.set({
|
|
84
91
|
token: "",
|
|
85
92
|
session: next.session.token
|
|
86
|
-
})
|
|
93
|
+
});
|
|
94
|
+
} else {
|
|
95
|
+
keysStorage.set({
|
|
87
96
|
token: "",
|
|
88
97
|
session: ""
|
|
89
|
-
})
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
onAuthStateChange === null || onAuthStateChange === void 0 ? void 0 : onAuthStateChange(next);
|
|
101
|
+
};
|
|
102
|
+
var setAuthClientToken = async function (props) {
|
|
103
|
+
keysStorage.set(props);
|
|
104
|
+
updateAuthClient(props.session);
|
|
105
|
+
};
|
|
94
106
|
function updateAuthClient(session) {
|
|
95
|
-
authClient = createAuthClientWithSession(session)
|
|
107
|
+
authClient = createAuthClientWithSession(session);
|
|
108
|
+
authClientVersion.emit(Math.random());
|
|
109
|
+
subscribeToAuthEffect();
|
|
96
110
|
}
|
|
97
|
-
var dispose = null
|
|
98
|
-
|
|
111
|
+
var dispose = null;
|
|
112
|
+
var retryTimer = null;
|
|
99
113
|
function subscribeToAuthEffect() {
|
|
100
|
-
dispose
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
114
|
+
dispose === null || dispose === void 0 ? void 0 : dispose();
|
|
115
|
+
dispose = authClient.useSession.subscribe(async function (props) {
|
|
116
|
+
var _keysStorage_get, _authState_value;
|
|
117
|
+
var {
|
|
118
|
+
data: dataGeneric,
|
|
119
|
+
isPending,
|
|
120
|
+
error
|
|
121
|
+
} = props;
|
|
108
122
|
if (error) {
|
|
109
123
|
var _keysStorage_get1;
|
|
110
|
-
onAuthError
|
|
111
|
-
var hasPersistedSession = !!(
|
|
112
|
-
hasPersistedSession
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
124
|
+
onAuthError === null || onAuthError === void 0 ? void 0 : onAuthError(error);
|
|
125
|
+
var hasPersistedSession = !!((_keysStorage_get1 = keysStorage.get()) === null || _keysStorage_get1 === void 0 ? void 0 : _keysStorage_get1.session);
|
|
126
|
+
if (!hasPersistedSession) {
|
|
127
|
+
setState({
|
|
128
|
+
state: "logged-out",
|
|
129
|
+
session: null,
|
|
130
|
+
user: null
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
scheduleAuthRetry(retryDelay);
|
|
117
134
|
return;
|
|
118
135
|
}
|
|
119
|
-
var data = dataGeneric
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
136
|
+
var data = dataGeneric;
|
|
137
|
+
var hasPersistedSession1 = !!((_keysStorage_get = keysStorage.get()) === null || _keysStorage_get === void 0 ? void 0 : _keysStorage_get.session);
|
|
138
|
+
var nextState = isPending ? "loading" : (data === null || data === void 0 ? void 0 : data.session) ? "logged-in" : hasPersistedSession1 && data === void 0 ? "loading" : "logged-out";
|
|
139
|
+
var _data_session;
|
|
140
|
+
var sessionUpdate = nextState === "loading" ? {} : {
|
|
141
|
+
session: (_data_session = data === null || data === void 0 ? void 0 : data.session) !== null && _data_session !== void 0 ? _data_session : null,
|
|
142
|
+
user: (data === null || data === void 0 ? void 0 : data.user) ? createUser ? createUser(data.user) : data.user : null
|
|
143
|
+
};
|
|
144
|
+
var previousSession = (_authState_value = authState.value) === null || _authState_value === void 0 ? void 0 : _authState_value.session;
|
|
145
|
+
var isNewSession = (data === null || data === void 0 ? void 0 : data.session) && (!previousSession || previousSession.id !== data.session.id || previousSession.userId !== data.session.userId);
|
|
129
146
|
setState({
|
|
130
147
|
state: nextState,
|
|
131
148
|
...sessionUpdate
|
|
132
|
-
})
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
149
|
+
});
|
|
150
|
+
if (useJWT && (data === null || data === void 0 ? void 0 : data.session) && (isNewSession || !authState.value.token)) {
|
|
151
|
+
if (isNewSession && authState.value.token) {
|
|
152
|
+
setState({
|
|
153
|
+
token: null
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
getValidToken().then(function (token) {
|
|
157
|
+
if (token) {
|
|
158
|
+
setState({
|
|
159
|
+
token
|
|
160
|
+
});
|
|
161
|
+
}
|
|
137
162
|
});
|
|
138
|
-
}
|
|
163
|
+
}
|
|
139
164
|
});
|
|
140
165
|
}
|
|
141
166
|
function scheduleAuthRetry(delayMs) {
|
|
142
|
-
|
|
143
|
-
|
|
167
|
+
if (retryTimer) clearTimeout(retryTimer);
|
|
168
|
+
retryTimer = setTimeout(function () {
|
|
169
|
+
retryTimer = null;
|
|
170
|
+
subscribeToAuthEffect();
|
|
144
171
|
}, delayMs);
|
|
145
172
|
}
|
|
146
173
|
async function getValidToken() {
|
|
147
|
-
var _res_data
|
|
148
|
-
|
|
174
|
+
var _res_data;
|
|
175
|
+
var res = await authClient.$fetch("/token");
|
|
149
176
|
if (res.error) {
|
|
150
177
|
console.error(`Error fetching token: ${res.error.statusText}`);
|
|
151
|
-
return;
|
|
178
|
+
return void 0;
|
|
152
179
|
}
|
|
153
180
|
return (_res_data = res.data) === null || _res_data === void 0 ? void 0 : _res_data.token;
|
|
154
181
|
}
|
|
@@ -156,59 +183,76 @@ function createBetterAuthClient(options) {
|
|
|
156
183
|
keysStorage.remove();
|
|
157
184
|
};
|
|
158
185
|
function clearAuthCookies() {
|
|
159
|
-
if (
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
186
|
+
if (typeof document === "undefined") return;
|
|
187
|
+
var _iteratorNormalCompletion = true,
|
|
188
|
+
_didIteratorError = false,
|
|
189
|
+
_iteratorError = void 0;
|
|
190
|
+
try {
|
|
191
|
+
for (var _iterator = authCookieNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
192
|
+
var cookieName = _step.value;
|
|
193
|
+
document.cookie = `${cookieName}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`;
|
|
194
|
+
var domain = window.location.hostname;
|
|
195
|
+
document.cookie = `${cookieName}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=${domain}`;
|
|
196
|
+
if (domain.startsWith(".")) {
|
|
197
|
+
document.cookie = `${cookieName}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=${domain.slice(1)}`;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
} catch (err) {
|
|
201
|
+
_didIteratorError = true;
|
|
202
|
+
_iteratorError = err;
|
|
203
|
+
} finally {
|
|
163
204
|
try {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
document.cookie = `${cookieName}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`;
|
|
167
|
-
var domain = window.location.hostname;
|
|
168
|
-
document.cookie = `${cookieName}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=${domain}`, domain.startsWith(".") && (document.cookie = `${cookieName}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=${domain.slice(1)}`);
|
|
205
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
206
|
+
_iterator.return();
|
|
169
207
|
}
|
|
170
|
-
} catch (err) {
|
|
171
|
-
_didIteratorError = !0, _iteratorError = err;
|
|
172
208
|
} finally {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
} finally {
|
|
176
|
-
if (_didIteratorError) throw _iteratorError;
|
|
209
|
+
if (_didIteratorError) {
|
|
210
|
+
throw _iteratorError;
|
|
177
211
|
}
|
|
178
212
|
}
|
|
179
213
|
}
|
|
180
214
|
}
|
|
181
215
|
function clearAllAuth() {
|
|
182
|
-
clearAuthCookies()
|
|
216
|
+
clearAuthCookies();
|
|
217
|
+
clearState();
|
|
183
218
|
}
|
|
184
219
|
var getAuth = function () {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
};
|
|
190
|
-
},
|
|
191
|
-
useAuth = function () {
|
|
192
|
-
return (0, import_helpers.useEmitterValue)(authState) || empty;
|
|
220
|
+
var state = (authState === null || authState === void 0 ? void 0 : authState.value) || empty;
|
|
221
|
+
return {
|
|
222
|
+
...state,
|
|
223
|
+
loggedIn: !!state.session
|
|
193
224
|
};
|
|
225
|
+
};
|
|
226
|
+
var useAuth = function () {
|
|
227
|
+
return (0, import_helpers.useEmitterValue)(authState) || empty;
|
|
228
|
+
};
|
|
194
229
|
function clearState() {
|
|
195
|
-
keysStorage.remove()
|
|
230
|
+
keysStorage.remove();
|
|
231
|
+
stateStorage.remove();
|
|
232
|
+
setState(empty);
|
|
196
233
|
}
|
|
197
|
-
|
|
234
|
+
subscribeToAuthEffect();
|
|
235
|
+
if (typeof window !== "undefined" && window.addEventListener) {
|
|
198
236
|
var cleanup = function () {
|
|
199
|
-
dispose
|
|
237
|
+
dispose === null || dispose === void 0 ? void 0 : dispose();
|
|
238
|
+
if (retryTimer) clearTimeout(retryTimer);
|
|
200
239
|
};
|
|
201
240
|
window.addEventListener("beforeunload", cleanup);
|
|
202
241
|
}
|
|
203
242
|
var proxiedAuthClient = new Proxy(authClient, {
|
|
204
243
|
get(_target, key) {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
(
|
|
210
|
-
|
|
211
|
-
|
|
244
|
+
if (key === "signOut") {
|
|
245
|
+
return function () {
|
|
246
|
+
var _authClient_signOut;
|
|
247
|
+
clearState();
|
|
248
|
+
(_authClient_signOut = authClient.signOut) === null || _authClient_signOut === void 0 ? void 0 : _authClient_signOut.call(authClient);
|
|
249
|
+
if (typeof window !== "undefined") {
|
|
250
|
+
var _window_location_reload, _window_location;
|
|
251
|
+
(_window_location = window.location) === null || _window_location === void 0 ? void 0 : (_window_location_reload = _window_location.reload) === null || _window_location_reload === void 0 ? void 0 : _window_location_reload.call(_window_location);
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
return Reflect.get(authClient, key);
|
|
212
256
|
}
|
|
213
257
|
});
|
|
214
258
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","createAuthClient_exports","__export","createBetterAuthClient","module","exports","import_helpers","require","import_client","options","onAuthStateChange","onAuthError","createUser","storagePrefix","retryDelay","useJWT","authCookieNames","authClientOptions","empty","state","session","user","token","keysStorage","createStorageValue","stateStorage","createAuthClientWithSession","createAuthClient","fetchOptions","credentials","headers","Authorization","authClient","_keysStorage_get","existingSession","get","authState","createEmitter","comparator","isEqualDeepLite","authClientVersion","setState","update","current","next","set","emit","setAuthClientToken","props","updateAuthClient","Math","random","subscribeToAuthEffect","dispose","retryTimer","useSession","subscribe","_authState_value","data","dataGeneric","isPending","error","_keysStorage_get1","hasPersistedSession","scheduleAuthRetry","hasPersistedSession1","nextState","_data_session","sessionUpdate","previousSession","isNewSession","id","userId","getValidToken","then","delayMs","clearTimeout","setTimeout","_res_data","res","$fetch","console","statusText","clearAuthClientToken","remove","clearAuthCookies","document","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","Symbol","iterator","_step","done","cookieName","cookie","domain","window","location","hostname","startsWith","slice","err","return","clearAllAuth","clearState","getAuth","loggedIn"],"sources":["../../src/createAuthClient.ts"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","createAuthClient_exports","__export","createBetterAuthClient","module","exports","import_helpers","require","import_client","options","onAuthStateChange","onAuthError","createUser","storagePrefix","retryDelay","useJWT","authCookieNames","authClientOptions","empty","state","session","user","token","keysStorage","createStorageValue","stateStorage","createAuthClientWithSession","createAuthClient","fetchOptions","credentials","headers","Authorization","authClient","_keysStorage_get","existingSession","get","authState","createEmitter","comparator","isEqualDeepLite","authClientVersion","setState","update","current","next","set","emit","setAuthClientToken","props","updateAuthClient","Math","random","subscribeToAuthEffect","dispose","retryTimer","useSession","subscribe","_authState_value","data","dataGeneric","isPending","error","_keysStorage_get1","hasPersistedSession","scheduleAuthRetry","hasPersistedSession1","nextState","_data_session","sessionUpdate","previousSession","isNewSession","id","userId","getValidToken","then","delayMs","clearTimeout","setTimeout","_res_data","res","$fetch","console","statusText","clearAuthClientToken","remove","clearAuthCookies","document","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","Symbol","iterator","_step","done","cookieName","cookie","domain","window","location","hostname","startsWith","slice","err","return","clearAllAuth","clearState","getAuth","loggedIn","useAuth","useEmitterValue"],"sources":["../../src/createAuthClient.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,wBAAA;AAAAC,QAAA,CAAAD,wBAAA;EAAAE,sBAAA,EAAAA,CAAA,KAAAA;AAAA;AAUAC,MAAA,CAAAC,OAAA,GAAAT,YAMO,CAAAK,wBAAA;AACP,IAAAK,cAAA,GAA+DC,OAAA;AAmFxD,IAAAC,aAAS,GAAAD,OAAA,qBAEsE;AAEpF,SAAMJ,uBAAAM,OAAA;EAAA,IACJ;IAAAC,iBAAA;IAAAC,WAAA;IAAAC,UAAA;IAAAC,aAAA;IAAAC,UAAA;IAAAC,MAAA;IAAAC,eAAA,IACA,mBACA;IACA,GAAAC;EAAgB,IAAAR,OAAA;EAAA,IAChBS,KAAA;IACAC,KAAA,cAAS;IACTC,OAAA;IACAC,IAAG;IACLC,KAAI;EAEJ;EAAgC,IAC9BC,WAAO,OAAAjB,cAAA,CAAAkB,kBAAA,KAAAX,aAAA;EAAA,IACPY,YAAS,OAAAnB,cAAA,CAAAkB,kBAAA,KAAAX,aAAA;EAAA,IACTa,2BAAM,YAAAA,CAAAN,OAAA;IACN,OAAO,IAAAZ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B;QACpB;MACF,UAAI;QACF,IAAAhB,iBAAa;UACX,MAAAC,cAAW;QAEX;MACA;IACE;EAA0B;EAC5B,SACFgB,aAAA;IAAApB,gBACF;IACAqB,UAAO;EAA2B;EAEtC,IAACC,OAAA,YAAAA,CAAA;IAED,IAAAxF,KAAO,IAAAiB,SAAA,aAAAA,SAAA,uBAAAA,SAAA,CAAApC,KAAA,KAAAkB,KAAA;IACL;MACA,GAAAC,KAAA;MACAyF,QAAA,IAAAzF,KAAA,CAAAC;IACA;EAAY;EACZ,IACAyF,OAAA,YAAAA,CAAA;IACA,WAAAvG,cAAA,CAAAwG,eAAA,EAAA1E,SAAA,KAAAlB,KAAA;EAAA;EACA,SACAwF,WAAA;IACAnF,WAAA,CAAA6D,MAAA;IACA3D,YAAA,CAAA2D,MAAA;IACF3C,QAAA,CAAAvB,KAAA;EACF","ignoreList":[]}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -3,15 +3,17 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
7
8
|
get: () => from[key],
|
|
8
9
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
9
10
|
});
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
13
15
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
14
|
-
value:
|
|
16
|
+
value: true
|
|
15
17
|
}), mod);
|
|
16
18
|
var index_exports = {};
|
|
17
19
|
module.exports = __toCommonJS(index_exports);
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -5,15 +5,17 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
|
|
8
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
9
10
|
get: () => from[key],
|
|
10
11
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
11
12
|
});
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
17
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
16
|
-
value:
|
|
18
|
+
value: true
|
|
17
19
|
}), mod);
|
|
18
20
|
var index_exports = {};
|
|
19
21
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","module","exports"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","module","exports"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAP,YAAc,CAAAK,aAAA","ignoreList":[]}
|