@rebasepro/client 0.0.1-canary.4d4fb3e → 0.0.1-canary.ca2cb6e

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/admin.d.ts CHANGED
@@ -13,8 +13,8 @@ export interface RebaseRole {
13
13
  id: string;
14
14
  name: string;
15
15
  isAdmin: boolean;
16
- defaultPermissions: Record<string, any> | null;
17
- config: Record<string, any> | null;
16
+ defaultPermissions: Record<string, unknown> | null;
17
+ config: Record<string, unknown> | null;
18
18
  }
19
19
  export interface CreateAdminOptions {
20
20
  adminPath?: string;
@@ -67,16 +67,16 @@ export declare function createAdmin(transport: Transport, options?: CreateAdminO
67
67
  id: string;
68
68
  name: string;
69
69
  isAdmin?: boolean;
70
- defaultPermissions?: any;
71
- config?: any;
70
+ defaultPermissions?: Record<string, unknown>;
71
+ config?: Record<string, unknown>;
72
72
  }) => Promise<{
73
73
  role: RebaseRole;
74
74
  }>;
75
75
  updateRole: (roleId: string, data: {
76
76
  name?: string;
77
77
  isAdmin?: boolean;
78
- defaultPermissions?: any;
79
- config?: any;
78
+ defaultPermissions?: Record<string, unknown>;
79
+ config?: Record<string, unknown>;
80
80
  }) => Promise<{
81
81
  role: RebaseRole;
82
82
  }>;
package/dist/auth.d.ts CHANGED
@@ -20,7 +20,7 @@ export interface RebaseSession {
20
20
  expiresAt: number;
21
21
  user: RebaseUser;
22
22
  }
23
- export type AuthChangeEvent = 'SIGNED_IN' | 'SIGNED_OUT' | 'TOKEN_REFRESHED' | 'USER_UPDATED';
23
+ export type AuthChangeEvent = "SIGNED_IN" | "SIGNED_OUT" | "TOKEN_REFRESHED" | "USER_UPDATED";
24
24
  export interface AuthConfig {
25
25
  needsSetup: boolean;
26
26
  registrationEnabled: boolean;
@@ -55,6 +55,72 @@ export declare function createAuth(transport: Transport, options?: CreateAuthOpt
55
55
  accessToken: string;
56
56
  refreshToken: string;
57
57
  }>;
58
+ signInWithLinkedin: (code: string, redirectUri: string) => Promise<{
59
+ user: RebaseUser;
60
+ accessToken: string;
61
+ refreshToken: string;
62
+ }>;
63
+ signInWithOAuth: (providerId: string, payload: Record<string, unknown>) => Promise<{
64
+ user: RebaseUser;
65
+ accessToken: string;
66
+ refreshToken: string;
67
+ }>;
68
+ signInWithGitHub: (code: string, redirectUri: string) => Promise<{
69
+ user: RebaseUser;
70
+ accessToken: string;
71
+ refreshToken: string;
72
+ }>;
73
+ signInWithMicrosoft: (code: string, redirectUri: string) => Promise<{
74
+ user: RebaseUser;
75
+ accessToken: string;
76
+ refreshToken: string;
77
+ }>;
78
+ signInWithApple: (code: string, redirectUri: string, user?: {
79
+ name?: {
80
+ firstName?: string;
81
+ lastName?: string;
82
+ };
83
+ email?: string;
84
+ }) => Promise<{
85
+ user: RebaseUser;
86
+ accessToken: string;
87
+ refreshToken: string;
88
+ }>;
89
+ signInWithFacebook: (code: string, redirectUri: string) => Promise<{
90
+ user: RebaseUser;
91
+ accessToken: string;
92
+ refreshToken: string;
93
+ }>;
94
+ signInWithTwitter: (code: string, redirectUri: string, codeVerifier: string) => Promise<{
95
+ user: RebaseUser;
96
+ accessToken: string;
97
+ refreshToken: string;
98
+ }>;
99
+ signInWithDiscord: (code: string, redirectUri: string) => Promise<{
100
+ user: RebaseUser;
101
+ accessToken: string;
102
+ refreshToken: string;
103
+ }>;
104
+ signInWithGitLab: (code: string, redirectUri: string) => Promise<{
105
+ user: RebaseUser;
106
+ accessToken: string;
107
+ refreshToken: string;
108
+ }>;
109
+ signInWithBitbucket: (code: string, redirectUri: string) => Promise<{
110
+ user: RebaseUser;
111
+ accessToken: string;
112
+ refreshToken: string;
113
+ }>;
114
+ signInWithSlack: (code: string, redirectUri: string) => Promise<{
115
+ user: RebaseUser;
116
+ accessToken: string;
117
+ refreshToken: string;
118
+ }>;
119
+ signInWithSpotify: (code: string, redirectUri: string) => Promise<{
120
+ user: RebaseUser;
121
+ accessToken: string;
122
+ refreshToken: string;
123
+ }>;
58
124
  signOut: () => Promise<void>;
59
125
  refreshSession: () => Promise<RebaseSession>;
60
126
  getUser: () => Promise<RebaseUser>;
@@ -8,12 +8,12 @@ import { FilterOperator, QueryBuilder } from "./query_builder";
8
8
  *
9
9
  * Additionally it exposes fluent query builder methods like `.where()`, `.orderBy()`.
10
10
  */
11
- export interface CollectionClient<M extends Record<string, any> = any> extends CollectionAccessor<M> {
12
- where(column: keyof M & string, operator: FilterOperator, value: any): QueryBuilder<M>;
11
+ export interface CollectionClient<M extends Record<string, unknown> = Record<string, unknown>> extends CollectionAccessor<M> {
12
+ where(column: keyof M & string, operator: FilterOperator, value: unknown): QueryBuilder<M>;
13
13
  orderBy(column: keyof M & string, ascending?: "asc" | "desc"): QueryBuilder<M>;
14
14
  limit(count: number): QueryBuilder<M>;
15
15
  offset(count: number): QueryBuilder<M>;
16
16
  search(searchString: string): QueryBuilder<M>;
17
17
  include(...relations: string[]): QueryBuilder<M>;
18
18
  }
19
- export declare function createCollectionClient<M extends Record<string, any> = any>(transport: Transport, slug: string, ws?: RebaseWebSocketClient): CollectionClient<M>;
19
+ export declare function createCollectionClient<M extends Record<string, unknown> = Record<string, unknown>>(transport: Transport, slug: string, ws?: RebaseWebSocketClient): CollectionClient<M>;
package/dist/cron.d.ts ADDED
@@ -0,0 +1,25 @@
1
+ import { Transport } from "./transport";
2
+ import type { CronJobStatus, CronJobLogEntry } from "@rebasepro/types";
3
+ export interface CreateCronOptions {
4
+ cronPath?: string;
5
+ }
6
+ export declare function createCron(transport: Transport, options?: CreateCronOptions): {
7
+ listJobs: () => Promise<{
8
+ jobs: CronJobStatus[];
9
+ }>;
10
+ getJob: (jobId: string) => Promise<{
11
+ job: CronJobStatus;
12
+ }>;
13
+ triggerJob: (jobId: string) => Promise<{
14
+ log: CronJobLogEntry;
15
+ job: CronJobStatus;
16
+ }>;
17
+ getJobLogs: (jobId: string, options?: {
18
+ limit?: number;
19
+ }) => Promise<{
20
+ logs: CronJobLogEntry[];
21
+ }>;
22
+ toggleJob: (jobId: string, enabled: boolean) => Promise<{
23
+ job: CronJobStatus;
24
+ }>;
25
+ };
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.d.ts CHANGED
@@ -1,37 +1,42 @@
1
1
  import { RebaseClientConfig } from "./transport";
2
2
  import { createAuth, CreateAuthOptions } from "./auth";
3
3
  import { createAdmin, CreateAdminOptions } from "./admin";
4
+ import { createCron, CreateCronOptions } from "./cron";
4
5
  import { CollectionClient } from "./collection";
5
6
  export * from "./transport";
6
7
  export * from "./auth";
7
8
  export * from "./admin";
9
+ export * from "./cron";
8
10
  export * from "./collection";
9
11
  export * from "./websocket";
10
12
  export * from "./storage";
13
+ export * from "./reviver";
11
14
  export interface CreateRebaseClientOptions extends RebaseClientConfig {
12
15
  auth?: CreateAuthOptions;
13
16
  admin?: CreateAdminOptions;
17
+ cron?: CreateCronOptions;
14
18
  }
15
19
  import { RebaseWebSocketClient } from "./websocket";
16
20
  import { RebaseClient as BaseRebaseClient, RebaseData, StorageSource } from "@rebasepro/types";
17
- export type RebaseClient<DB = any> = BaseRebaseClient<DB> & {
21
+ export type RebaseClient<DB = Record<string, unknown>> = BaseRebaseClient<DB> & {
18
22
  setToken: (token: string | null) => void;
19
23
  setAuthTokenGetter: (getter: () => Promise<string | null>) => void;
20
24
  setOnUnauthorized: (handler: () => Promise<boolean>) => void;
21
25
  resolveToken: () => Promise<string | null>;
22
26
  auth: ReturnType<typeof createAuth>;
23
27
  admin: ReturnType<typeof createAdmin>;
28
+ cron: ReturnType<typeof createCron>;
24
29
  ws?: RebaseWebSocketClient;
25
30
  storage?: StorageSource;
26
- call: <T = any>(endpoint: string, payload?: any) => Promise<T>;
31
+ call: <T = unknown>(endpoint: string, payload?: unknown) => Promise<T>;
27
32
  data: RebaseData & {
28
33
  collection<K extends keyof DB>(slug: Extract<K, string>): CollectionClient<DB[K] extends {
29
- Row: infer R extends Record<string, any>;
30
- } ? R : any>;
34
+ Row: infer R extends Record<string, unknown>;
35
+ } ? R : Record<string, unknown>>;
31
36
  } & {
32
37
  [K in keyof DB]: CollectionClient<DB[K] extends {
33
- Row: infer R extends Record<string, any>;
34
- } ? R : any>;
38
+ Row: infer R extends Record<string, unknown>;
39
+ } ? R : Record<string, unknown>>;
35
40
  };
36
41
  };
37
- export declare function createRebaseClient<DB = any>(options: CreateRebaseClientOptions): RebaseClient<DB>;
42
+ export declare function createRebaseClient<DB = Record<string, unknown>>(options: CreateRebaseClientOptions): RebaseClient<DB>;