@absolutejs/auth 0.2.4 → 0.2.5

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 (37) hide show
  1. package/.prettierignore +4 -0
  2. package/.prettierrc.json +9 -0
  3. package/dist/index.js +1 -1
  4. package/package.json +2 -8
  5. package/src/authorize.ts +119 -0
  6. package/src/callback.ts +127 -0
  7. package/src/constants.ts +13 -0
  8. package/src/index.ts +88 -0
  9. package/src/logout.ts +39 -0
  10. package/src/protectRoute.ts +33 -0
  11. package/src/providers.ts +109 -0
  12. package/src/refresh.ts +63 -0
  13. package/src/revoke.ts +61 -0
  14. package/src/sessionStore.ts +10 -0
  15. package/src/status.ts +100 -0
  16. package/src/typeGuards.ts +32 -0
  17. package/src/types.ts +78 -0
  18. package/src/utils.ts +55 -0
  19. package/tsconfig.json +17 -0
  20. package/dist/example/components/AuthOptions.d.ts +0 -1
  21. package/dist/example/components/Example.d.ts +0 -1
  22. package/dist/example/components/Head.d.ts +0 -6
  23. package/dist/example/components/Modal.d.ts +0 -8
  24. package/dist/example/components/Navbar.d.ts +0 -10
  25. package/dist/example/components/NotAuthorized.d.ts +0 -1
  26. package/dist/example/components/Protected.d.ts +0 -1
  27. package/dist/example/db/migrate.d.ts +0 -1
  28. package/dist/example/db/schema.d.ts +0 -248
  29. package/dist/example/hooks/useAuthStatus.d.ts +0 -19
  30. package/dist/example/indexes/ExampleIndex.d.ts +0 -1
  31. package/dist/example/indexes/NotAuthorizedIndex.d.ts +0 -1
  32. package/dist/example/indexes/ProtectedIndex.d.ts +0 -1
  33. package/dist/example/server.d.ts +0 -1
  34. package/dist/example/utils/networking.d.ts +0 -1
  35. package/dist/example/utils/pageUtils.d.ts +0 -2
  36. package/dist/example/utils/styles.d.ts +0 -15
  37. package/dist/example/utils/userUtils.d.ts +0 -36
@@ -1,248 +0,0 @@
1
- import { NeonHttpDatabase } from 'drizzle-orm/neon-http';
2
- export declare const users: import("drizzle-orm/pg-core").PgTableWithColumns<{
3
- name: "users";
4
- schema: undefined;
5
- columns: {
6
- given_name: import("drizzle-orm/pg-core").PgColumn<{
7
- name: "given_name";
8
- tableName: "users";
9
- dataType: "string";
10
- columnType: "PgVarchar";
11
- data: string;
12
- driverParam: string;
13
- notNull: false;
14
- hasDefault: false;
15
- isPrimaryKey: false;
16
- isAutoincrement: false;
17
- hasRuntimeDefault: false;
18
- enumValues: [string, ...string[]];
19
- baseColumn: never;
20
- identity: undefined;
21
- generated: undefined;
22
- }, {}, {
23
- length: 255;
24
- }>;
25
- family_name: import("drizzle-orm/pg-core").PgColumn<{
26
- name: "family_name";
27
- tableName: "users";
28
- dataType: "string";
29
- columnType: "PgVarchar";
30
- data: string;
31
- driverParam: string;
32
- notNull: false;
33
- hasDefault: false;
34
- isPrimaryKey: false;
35
- isAutoincrement: false;
36
- hasRuntimeDefault: false;
37
- enumValues: [string, ...string[]];
38
- baseColumn: never;
39
- identity: undefined;
40
- generated: undefined;
41
- }, {}, {
42
- length: 255;
43
- }>;
44
- email: import("drizzle-orm/pg-core").PgColumn<{
45
- name: "email";
46
- tableName: "users";
47
- dataType: "string";
48
- columnType: "PgVarchar";
49
- data: string;
50
- driverParam: string;
51
- notNull: false;
52
- hasDefault: false;
53
- isPrimaryKey: false;
54
- isAutoincrement: false;
55
- hasRuntimeDefault: false;
56
- enumValues: [string, ...string[]];
57
- baseColumn: never;
58
- identity: undefined;
59
- generated: undefined;
60
- }, {}, {
61
- length: 255;
62
- }>;
63
- created_at: import("drizzle-orm/pg-core").PgColumn<{
64
- name: "created_at";
65
- tableName: "users";
66
- dataType: "date";
67
- columnType: "PgTimestamp";
68
- data: Date;
69
- driverParam: string;
70
- notNull: true;
71
- hasDefault: true;
72
- isPrimaryKey: false;
73
- isAutoincrement: false;
74
- hasRuntimeDefault: false;
75
- enumValues: undefined;
76
- baseColumn: never;
77
- identity: undefined;
78
- generated: undefined;
79
- }, {}, {}>;
80
- auth_sub: import("drizzle-orm/pg-core").PgColumn<{
81
- name: "auth_sub";
82
- tableName: "users";
83
- dataType: "string";
84
- columnType: "PgVarchar";
85
- data: string;
86
- driverParam: string;
87
- notNull: true;
88
- hasDefault: false;
89
- isPrimaryKey: true;
90
- isAutoincrement: false;
91
- hasRuntimeDefault: false;
92
- enumValues: [string, ...string[]];
93
- baseColumn: never;
94
- identity: undefined;
95
- generated: undefined;
96
- }, {}, {
97
- length: 255;
98
- }>;
99
- picture: import("drizzle-orm/pg-core").PgColumn<{
100
- name: "picture";
101
- tableName: "users";
102
- dataType: "string";
103
- columnType: "PgVarchar";
104
- data: string;
105
- driverParam: string;
106
- notNull: false;
107
- hasDefault: false;
108
- isPrimaryKey: false;
109
- isAutoincrement: false;
110
- hasRuntimeDefault: false;
111
- enumValues: [string, ...string[]];
112
- baseColumn: never;
113
- identity: undefined;
114
- generated: undefined;
115
- }, {}, {
116
- length: 255;
117
- }>;
118
- };
119
- dialect: "pg";
120
- }>;
121
- export declare const schema: {
122
- users: import("drizzle-orm/pg-core").PgTableWithColumns<{
123
- name: "users";
124
- schema: undefined;
125
- columns: {
126
- given_name: import("drizzle-orm/pg-core").PgColumn<{
127
- name: "given_name";
128
- tableName: "users";
129
- dataType: "string";
130
- columnType: "PgVarchar";
131
- data: string;
132
- driverParam: string;
133
- notNull: false;
134
- hasDefault: false;
135
- isPrimaryKey: false;
136
- isAutoincrement: false;
137
- hasRuntimeDefault: false;
138
- enumValues: [string, ...string[]];
139
- baseColumn: never;
140
- identity: undefined;
141
- generated: undefined;
142
- }, {}, {
143
- length: 255;
144
- }>;
145
- family_name: import("drizzle-orm/pg-core").PgColumn<{
146
- name: "family_name";
147
- tableName: "users";
148
- dataType: "string";
149
- columnType: "PgVarchar";
150
- data: string;
151
- driverParam: string;
152
- notNull: false;
153
- hasDefault: false;
154
- isPrimaryKey: false;
155
- isAutoincrement: false;
156
- hasRuntimeDefault: false;
157
- enumValues: [string, ...string[]];
158
- baseColumn: never;
159
- identity: undefined;
160
- generated: undefined;
161
- }, {}, {
162
- length: 255;
163
- }>;
164
- email: import("drizzle-orm/pg-core").PgColumn<{
165
- name: "email";
166
- tableName: "users";
167
- dataType: "string";
168
- columnType: "PgVarchar";
169
- data: string;
170
- driverParam: string;
171
- notNull: false;
172
- hasDefault: false;
173
- isPrimaryKey: false;
174
- isAutoincrement: false;
175
- hasRuntimeDefault: false;
176
- enumValues: [string, ...string[]];
177
- baseColumn: never;
178
- identity: undefined;
179
- generated: undefined;
180
- }, {}, {
181
- length: 255;
182
- }>;
183
- created_at: import("drizzle-orm/pg-core").PgColumn<{
184
- name: "created_at";
185
- tableName: "users";
186
- dataType: "date";
187
- columnType: "PgTimestamp";
188
- data: Date;
189
- driverParam: string;
190
- notNull: true;
191
- hasDefault: true;
192
- isPrimaryKey: false;
193
- isAutoincrement: false;
194
- hasRuntimeDefault: false;
195
- enumValues: undefined;
196
- baseColumn: never;
197
- identity: undefined;
198
- generated: undefined;
199
- }, {}, {}>;
200
- auth_sub: import("drizzle-orm/pg-core").PgColumn<{
201
- name: "auth_sub";
202
- tableName: "users";
203
- dataType: "string";
204
- columnType: "PgVarchar";
205
- data: string;
206
- driverParam: string;
207
- notNull: true;
208
- hasDefault: false;
209
- isPrimaryKey: true;
210
- isAutoincrement: false;
211
- hasRuntimeDefault: false;
212
- enumValues: [string, ...string[]];
213
- baseColumn: never;
214
- identity: undefined;
215
- generated: undefined;
216
- }, {}, {
217
- length: 255;
218
- }>;
219
- picture: import("drizzle-orm/pg-core").PgColumn<{
220
- name: "picture";
221
- tableName: "users";
222
- dataType: "string";
223
- columnType: "PgVarchar";
224
- data: string;
225
- driverParam: string;
226
- notNull: false;
227
- hasDefault: false;
228
- isPrimaryKey: false;
229
- isAutoincrement: false;
230
- hasRuntimeDefault: false;
231
- enumValues: [string, ...string[]];
232
- baseColumn: never;
233
- identity: undefined;
234
- generated: undefined;
235
- }, {}, {
236
- length: 255;
237
- }>;
238
- };
239
- dialect: "pg";
240
- }>;
241
- };
242
- export type schemaType = typeof schema;
243
- export type User = typeof users.$inferSelect;
244
- export type NewUser = typeof users.$inferInsert;
245
- export type DatabaseFunctionProps = {
246
- db: NeonHttpDatabase<schemaType>;
247
- schema: schemaType;
248
- };
@@ -1,19 +0,0 @@
1
- export declare const useAuthStatus: () => {
2
- handleLogOut: () => Promise<void>;
3
- setUser: import("react").Dispatch<import("react").SetStateAction<{
4
- given_name: string | null;
5
- family_name: string | null;
6
- email: string | null;
7
- created_at: Date;
8
- auth_sub: string;
9
- picture: string | null;
10
- } | undefined>>;
11
- user: {
12
- given_name: string | null;
13
- family_name: string | null;
14
- email: string | null;
15
- created_at: Date;
16
- auth_sub: string;
17
- picture: string | null;
18
- } | undefined;
19
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export declare const getLocalIPAddress: () => string;
@@ -1,2 +0,0 @@
1
- import type { ComponentType } from 'react';
2
- export declare const handlePageRequest: (pageComponent: ComponentType, index: string) => Promise<Response>;
@@ -1,15 +0,0 @@
1
- import { CSSProperties } from 'react';
2
- export declare const styleReset = "\n * {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n font-weight: inherit;\n }\n";
3
- export declare const bodyDefault: CSSProperties;
4
- export declare const mainDefault: CSSProperties;
5
- export declare const htmlDefault: CSSProperties;
6
- type ButtonStyleProps = {
7
- backgroundColor?: string;
8
- color?: string;
9
- width?: string;
10
- };
11
- export declare const buttonStyle: ({ backgroundColor, color, width }: ButtonStyleProps) => CSSProperties;
12
- export declare const authContainerStyle: CSSProperties;
13
- export declare const textButtonStyle: CSSProperties;
14
- export declare const contentStyle: CSSProperties;
15
- export {};
@@ -1,36 +0,0 @@
1
- import type { DatabaseFunctionProps, NewUser } from '../db/schema';
2
- import { UserFunctionProps } from '../../src/types';
3
- export declare const getDBUser: ({ authSub, db, schema }: DatabaseFunctionProps & {
4
- authSub: string;
5
- }) => Promise<{
6
- given_name: string | null;
7
- family_name: string | null;
8
- email: string | null;
9
- created_at: Date;
10
- auth_sub: string;
11
- picture: string | null;
12
- } | null>;
13
- export declare const createDBUser: ({ auth_sub, given_name, family_name, email, picture, db, schema }: DatabaseFunctionProps & NewUser) => Promise<{
14
- given_name: string | null;
15
- family_name: string | null;
16
- email: string | null;
17
- created_at: Date;
18
- auth_sub: string;
19
- picture: string | null;
20
- }>;
21
- export declare const createUser: ({ decodedIdToken, authProvider, db, schema }: UserFunctionProps & DatabaseFunctionProps) => Promise<{
22
- given_name: string | null;
23
- family_name: string | null;
24
- email: string | null;
25
- created_at: Date;
26
- auth_sub: string;
27
- picture: string | null;
28
- }>;
29
- export declare const getUser: ({ decodedIdToken, authProvider, db, schema }: UserFunctionProps & DatabaseFunctionProps) => Promise<{
30
- given_name: string | null;
31
- family_name: string | null;
32
- email: string | null;
33
- created_at: Date;
34
- auth_sub: string;
35
- picture: string | null;
36
- } | null>;