@better-auth/telemetry 1.3.28
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/.turbo/turbo-build.log +13 -0
- package/LICENSE.md +17 -0
- package/build.config.ts +10 -0
- package/dist/index.cjs +564 -0
- package/dist/index.d.cts +262 -0
- package/dist/index.d.mts +262 -0
- package/dist/index.d.ts +262 -0
- package/dist/index.mjs +561 -0
- package/package.json +41 -0
- package/src/detectors/detect-auth-config.ts +198 -0
- package/src/detectors/detect-database.ts +22 -0
- package/src/detectors/detect-framework.ts +23 -0
- package/src/detectors/detect-project-info.ts +18 -0
- package/src/detectors/detect-runtime.ts +31 -0
- package/src/detectors/detect-system-info.ts +209 -0
- package/src/index.ts +88 -0
- package/src/project-id.ts +27 -0
- package/src/telemetry.test.ts +321 -0
- package/src/types.ts +72 -0
- package/src/utils/hash.ts +9 -0
- package/src/utils/id.ts +5 -0
- package/src/utils/import-util.ts +3 -0
- package/src/utils/package-json.ts +74 -0
- package/tsconfig.json +9 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
interface DetectionInfo {
|
|
2
|
+
name: string;
|
|
3
|
+
version: string | null;
|
|
4
|
+
}
|
|
5
|
+
interface SystemInfo {
|
|
6
|
+
systemPlatform: string;
|
|
7
|
+
systemRelease: string;
|
|
8
|
+
systemArchitecture: string;
|
|
9
|
+
cpuCount: number;
|
|
10
|
+
cpuModel: string | null;
|
|
11
|
+
cpuSpeed: number | null;
|
|
12
|
+
memory: number;
|
|
13
|
+
isDocker: boolean;
|
|
14
|
+
isTTY: boolean;
|
|
15
|
+
isWSL: boolean;
|
|
16
|
+
isCI: boolean;
|
|
17
|
+
}
|
|
18
|
+
interface AuthConfigInfo {
|
|
19
|
+
options: any;
|
|
20
|
+
plugins: string[];
|
|
21
|
+
}
|
|
22
|
+
interface ProjectInfo {
|
|
23
|
+
isGit: boolean;
|
|
24
|
+
packageManager: DetectionInfo | null;
|
|
25
|
+
}
|
|
26
|
+
interface TelemetryEvent {
|
|
27
|
+
type: string;
|
|
28
|
+
anonymousId?: string;
|
|
29
|
+
payload: Record<string, any>;
|
|
30
|
+
}
|
|
31
|
+
interface TelemetryContext {
|
|
32
|
+
customTrack?: (event: TelemetryEvent) => Promise<void>;
|
|
33
|
+
database?: string;
|
|
34
|
+
adapter?: string;
|
|
35
|
+
skipTestCheck?: boolean;
|
|
36
|
+
}
|
|
37
|
+
interface BetterAuthOptions {
|
|
38
|
+
baseURL?: string;
|
|
39
|
+
appName?: string;
|
|
40
|
+
telemetry?: {
|
|
41
|
+
enabled?: boolean;
|
|
42
|
+
debug?: boolean;
|
|
43
|
+
};
|
|
44
|
+
emailVerification?: any;
|
|
45
|
+
emailAndPassword?: any;
|
|
46
|
+
socialProviders?: Record<string, any>;
|
|
47
|
+
plugins?: Array<{
|
|
48
|
+
id: string | symbol;
|
|
49
|
+
}>;
|
|
50
|
+
user?: any;
|
|
51
|
+
verification?: any;
|
|
52
|
+
session?: any;
|
|
53
|
+
account?: any;
|
|
54
|
+
hooks?: any;
|
|
55
|
+
secondaryStorage?: any;
|
|
56
|
+
advanced?: any;
|
|
57
|
+
trustedOrigins?: any;
|
|
58
|
+
rateLimit?: any;
|
|
59
|
+
onAPIError?: any;
|
|
60
|
+
logger?: any;
|
|
61
|
+
databaseHooks?: any;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
declare function getTelemetryAuthConfig(options: BetterAuthOptions, context?: TelemetryContext): {
|
|
65
|
+
database: string | undefined;
|
|
66
|
+
adapter: string | undefined;
|
|
67
|
+
emailVerification: {
|
|
68
|
+
sendVerificationEmail: boolean;
|
|
69
|
+
sendOnSignUp: boolean;
|
|
70
|
+
sendOnSignIn: boolean;
|
|
71
|
+
autoSignInAfterVerification: boolean;
|
|
72
|
+
expiresIn: any;
|
|
73
|
+
onEmailVerification: boolean;
|
|
74
|
+
afterEmailVerification: boolean;
|
|
75
|
+
};
|
|
76
|
+
emailAndPassword: {
|
|
77
|
+
enabled: boolean;
|
|
78
|
+
disableSignUp: boolean;
|
|
79
|
+
requireEmailVerification: boolean;
|
|
80
|
+
maxPasswordLength: any;
|
|
81
|
+
minPasswordLength: any;
|
|
82
|
+
sendResetPassword: boolean;
|
|
83
|
+
resetPasswordTokenExpiresIn: any;
|
|
84
|
+
onPasswordReset: boolean;
|
|
85
|
+
password: {
|
|
86
|
+
hash: boolean;
|
|
87
|
+
verify: boolean;
|
|
88
|
+
};
|
|
89
|
+
autoSignIn: boolean;
|
|
90
|
+
revokeSessionsOnPasswordReset: boolean;
|
|
91
|
+
};
|
|
92
|
+
socialProviders: ({
|
|
93
|
+
id?: undefined;
|
|
94
|
+
mapProfileToUser?: undefined;
|
|
95
|
+
disableDefaultScope?: undefined;
|
|
96
|
+
disableIdTokenSignIn?: undefined;
|
|
97
|
+
disableImplicitSignUp?: undefined;
|
|
98
|
+
disableSignUp?: undefined;
|
|
99
|
+
getUserInfo?: undefined;
|
|
100
|
+
overrideUserInfoOnSignIn?: undefined;
|
|
101
|
+
prompt?: undefined;
|
|
102
|
+
verifyIdToken?: undefined;
|
|
103
|
+
scope?: undefined;
|
|
104
|
+
refreshAccessToken?: undefined;
|
|
105
|
+
} | {
|
|
106
|
+
id: string;
|
|
107
|
+
mapProfileToUser: boolean;
|
|
108
|
+
disableDefaultScope: boolean;
|
|
109
|
+
disableIdTokenSignIn: boolean;
|
|
110
|
+
disableImplicitSignUp: any;
|
|
111
|
+
disableSignUp: any;
|
|
112
|
+
getUserInfo: boolean;
|
|
113
|
+
overrideUserInfoOnSignIn: boolean;
|
|
114
|
+
prompt: any;
|
|
115
|
+
verifyIdToken: boolean;
|
|
116
|
+
scope: any;
|
|
117
|
+
refreshAccessToken: boolean;
|
|
118
|
+
})[];
|
|
119
|
+
plugins: string[] | undefined;
|
|
120
|
+
user: {
|
|
121
|
+
modelName: any;
|
|
122
|
+
fields: any;
|
|
123
|
+
additionalFields: any;
|
|
124
|
+
changeEmail: {
|
|
125
|
+
enabled: any;
|
|
126
|
+
sendChangeEmailVerification: boolean;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
verification: {
|
|
130
|
+
modelName: any;
|
|
131
|
+
disableCleanup: any;
|
|
132
|
+
fields: any;
|
|
133
|
+
};
|
|
134
|
+
session: {
|
|
135
|
+
modelName: any;
|
|
136
|
+
additionalFields: any;
|
|
137
|
+
cookieCache: {
|
|
138
|
+
enabled: any;
|
|
139
|
+
maxAge: any;
|
|
140
|
+
};
|
|
141
|
+
disableSessionRefresh: any;
|
|
142
|
+
expiresIn: any;
|
|
143
|
+
fields: any;
|
|
144
|
+
freshAge: any;
|
|
145
|
+
preserveSessionInDatabase: any;
|
|
146
|
+
storeSessionInDatabase: any;
|
|
147
|
+
updateAge: any;
|
|
148
|
+
};
|
|
149
|
+
account: {
|
|
150
|
+
modelName: any;
|
|
151
|
+
fields: any;
|
|
152
|
+
encryptOAuthTokens: any;
|
|
153
|
+
updateAccountOnSignIn: any;
|
|
154
|
+
accountLinking: {
|
|
155
|
+
enabled: any;
|
|
156
|
+
trustedProviders: any;
|
|
157
|
+
updateUserInfoOnLink: any;
|
|
158
|
+
allowUnlinkingAll: any;
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
hooks: {
|
|
162
|
+
after: boolean;
|
|
163
|
+
before: boolean;
|
|
164
|
+
};
|
|
165
|
+
secondaryStorage: boolean;
|
|
166
|
+
advanced: {
|
|
167
|
+
cookiePrefix: boolean;
|
|
168
|
+
cookies: boolean;
|
|
169
|
+
crossSubDomainCookies: {
|
|
170
|
+
domain: boolean;
|
|
171
|
+
enabled: any;
|
|
172
|
+
additionalCookies: any;
|
|
173
|
+
};
|
|
174
|
+
database: {
|
|
175
|
+
useNumberId: boolean;
|
|
176
|
+
generateId: any;
|
|
177
|
+
defaultFindManyLimit: any;
|
|
178
|
+
};
|
|
179
|
+
useSecureCookies: any;
|
|
180
|
+
ipAddress: {
|
|
181
|
+
disableIpTracking: any;
|
|
182
|
+
ipAddressHeaders: any;
|
|
183
|
+
};
|
|
184
|
+
disableCSRFCheck: any;
|
|
185
|
+
cookieAttributes: {
|
|
186
|
+
expires: any;
|
|
187
|
+
secure: any;
|
|
188
|
+
sameSite: any;
|
|
189
|
+
domain: boolean;
|
|
190
|
+
path: any;
|
|
191
|
+
httpOnly: any;
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
trustedOrigins: any;
|
|
195
|
+
rateLimit: {
|
|
196
|
+
storage: any;
|
|
197
|
+
modelName: any;
|
|
198
|
+
window: any;
|
|
199
|
+
customStorage: boolean;
|
|
200
|
+
enabled: any;
|
|
201
|
+
max: any;
|
|
202
|
+
};
|
|
203
|
+
onAPIError: {
|
|
204
|
+
errorURL: any;
|
|
205
|
+
onError: boolean;
|
|
206
|
+
throw: any;
|
|
207
|
+
};
|
|
208
|
+
logger: {
|
|
209
|
+
disabled: any;
|
|
210
|
+
level: any;
|
|
211
|
+
log: boolean;
|
|
212
|
+
};
|
|
213
|
+
databaseHooks: {
|
|
214
|
+
user: {
|
|
215
|
+
create: {
|
|
216
|
+
after: boolean;
|
|
217
|
+
before: boolean;
|
|
218
|
+
};
|
|
219
|
+
update: {
|
|
220
|
+
after: boolean;
|
|
221
|
+
before: boolean;
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
session: {
|
|
225
|
+
create: {
|
|
226
|
+
after: boolean;
|
|
227
|
+
before: boolean;
|
|
228
|
+
};
|
|
229
|
+
update: {
|
|
230
|
+
after: boolean;
|
|
231
|
+
before: boolean;
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
account: {
|
|
235
|
+
create: {
|
|
236
|
+
after: boolean;
|
|
237
|
+
before: boolean;
|
|
238
|
+
};
|
|
239
|
+
update: {
|
|
240
|
+
after: boolean;
|
|
241
|
+
before: boolean;
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
verification: {
|
|
245
|
+
create: {
|
|
246
|
+
after: boolean;
|
|
247
|
+
before: boolean;
|
|
248
|
+
};
|
|
249
|
+
update: {
|
|
250
|
+
after: boolean;
|
|
251
|
+
before: boolean;
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
declare function createTelemetry(options: BetterAuthOptions, context?: TelemetryContext): Promise<{
|
|
258
|
+
publish: (event: TelemetryEvent) => Promise<void>;
|
|
259
|
+
}>;
|
|
260
|
+
|
|
261
|
+
export { createTelemetry, getTelemetryAuthConfig };
|
|
262
|
+
export type { AuthConfigInfo, BetterAuthOptions, DetectionInfo, ProjectInfo, SystemInfo, TelemetryContext, TelemetryEvent };
|