@cauth/core 0.0.6 → 0.0.8

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +15 -20
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -100,7 +100,7 @@ type FNError = {
100
100
  * @template T - The type of the value.
101
101
  * @template E - The type of the errors, which must extend { type: string; error: Error }.
102
102
  */
103
- type Result$1<T, E extends FNError = FNError> = {
103
+ type Result<T, E extends FNError = FNError> = {
104
104
  success: true;
105
105
  value: T;
106
106
  } | {
@@ -272,19 +272,6 @@ declare const ChangePasswordSchema: z.ZodObject<{
272
272
  }, z.core.$strip>;
273
273
  type ChangePasswordSchemaType = z.infer<typeof ChangePasswordSchema>;
274
274
  //#endregion
275
- //#region src/fn/authenticate.fn.d.ts
276
- type AuthCodeResult = {
277
- id: string;
278
- code: string;
279
- };
280
- type LoginWithCodeResult = {
281
- account: Account;
282
- tokens: Tokens;
283
- };
284
- type VerifyAuthCodeResult = {
285
- isValid: boolean;
286
- };
287
- //#endregion
288
275
  //#region src/cauth.d.ts
289
276
  declare class _CAuth<T extends string[], TContractor extends RoutesContract<any> = RoutesContract<any>> {
290
277
  #private;
@@ -311,7 +298,7 @@ declare class _CAuth<T extends string[], TContractor extends RoutesContract<any>
311
298
  FN: {
312
299
  Login: ({
313
300
  ...args
314
- }: LoginSchemaType) => Promise<Result$1<{
301
+ }: LoginSchemaType) => Promise<Result<{
315
302
  account: Account;
316
303
  tokens: Tokens;
317
304
  }>>;
@@ -323,10 +310,10 @@ declare class _CAuth<T extends string[], TContractor extends RoutesContract<any>
323
310
  }>>;
324
311
  Logout: ({
325
312
  ...args
326
- }: LogoutSchemaType) => Promise<Result<any>>;
313
+ }: LogoutSchemaType) => Promise<Result<unknown>>;
327
314
  Refresh: ({
328
315
  ...args
329
- }: RefreshTokenSchemaType) => Promise<Result$1<{
316
+ }: RefreshTokenSchemaType) => Promise<Result<{
330
317
  account: Account;
331
318
  tokens: Tokens;
332
319
  }>>;
@@ -339,15 +326,23 @@ declare class _CAuth<T extends string[], TContractor extends RoutesContract<any>
339
326
  password?: string;
340
327
  usePassword?: boolean;
341
328
  otpPurpose: OtpPurpose;
342
- }) => Promise<Result<AuthCodeResult>>;
329
+ }) => Promise<Result<{
330
+ id: string;
331
+ code: string;
332
+ }>>;
343
333
  LoginWithOTP: (args: Omit<LoginSchemaType, "password"> & {
344
334
  code: string;
345
- }) => Promise<Result<LoginWithCodeResult>>;
335
+ }) => Promise<Result<{
336
+ account: Account;
337
+ tokens: Tokens;
338
+ }>>;
346
339
  VerifyOTP: (args: {
347
340
  id: string;
348
341
  code: string;
349
342
  otpPurpose: OtpPurpose;
350
- }) => Promise<Result<VerifyAuthCodeResult>>;
343
+ }) => Promise<Result<{
344
+ isValid: boolean;
345
+ }>>;
351
346
  };
352
347
  Tokens: {
353
348
  GenerateRefreshToken: (payload: any) => Promise<string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cauth/core",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",