@spfn/auth 0.2.0-beta.74 → 0.2.0-beta.80
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/README.md +267 -15
- package/dist/{authenticate-DXVtYh8X.d.ts → authenticate-ofdEmk6x.d.ts} +43 -13
- package/dist/config.d.ts +150 -0
- package/dist/config.js +71 -4
- package/dist/config.js.map +1 -1
- package/dist/errors.d.ts +75 -3
- package/dist/errors.js +50 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +28 -6
- package/dist/index.js +53 -5
- package/dist/index.js.map +1 -1
- package/dist/nextjs/api.js +13 -11
- package/dist/nextjs/api.js.map +1 -1
- package/dist/nextjs/server.d.ts +2 -2
- package/dist/nextjs/server.js +3 -3
- package/dist/nextjs/server.js.map +1 -1
- package/dist/server.d.ts +1040 -42
- package/dist/server.js +1894 -397
- package/dist/server.js.map +1 -1
- package/dist/{session-s_hiXmXC.d.ts → session-CGxgH3C9.d.ts} +1 -1
- package/dist/types-1BMx0OX1.d.ts +84 -0
- package/migrations/0006_easy_hardball.sql +24 -0
- package/migrations/0007_glossy_major_mapleleaf.sql +1 -0
- package/migrations/meta/0006_snapshot.json +1921 -0
- package/migrations/meta/0007_snapshot.json +1916 -0
- package/migrations/meta/_journal.json +15 -1
- package/package.json +29 -27
- package/dist/types-BtksCI9X.d.ts +0 -45
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @spfn/auth - Shared Types
|
|
3
|
+
*
|
|
4
|
+
* Common types and constants used across the auth package
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Supported JWT signature algorithms
|
|
8
|
+
*
|
|
9
|
+
* - ES256: ECDSA with P-256 and SHA-256 (recommended, smaller keys)
|
|
10
|
+
* - RS256: RSA with SHA-256 (fallback, larger keys)
|
|
11
|
+
*/
|
|
12
|
+
declare const KEY_ALGORITHM: readonly ["ES256", "RS256"];
|
|
13
|
+
/**
|
|
14
|
+
* Key algorithm type derived from the const array
|
|
15
|
+
*/
|
|
16
|
+
type KeyAlgorithmType = typeof KEY_ALGORITHM[number];
|
|
17
|
+
/**
|
|
18
|
+
* Invitation status enum values
|
|
19
|
+
* Single source of truth for all invitation statuses
|
|
20
|
+
*/
|
|
21
|
+
declare const INVITATION_STATUSES: readonly ["pending", "accepted", "expired", "cancelled"];
|
|
22
|
+
/**
|
|
23
|
+
* Invitation status type derived from the const array
|
|
24
|
+
*/
|
|
25
|
+
type InvitationStatus = typeof INVITATION_STATUSES[number];
|
|
26
|
+
/**
|
|
27
|
+
* User status enum values
|
|
28
|
+
* Single source of truth for all user statuses
|
|
29
|
+
*
|
|
30
|
+
* - active: Normal operation (default)
|
|
31
|
+
* - inactive: Deactivated (user request, dormant)
|
|
32
|
+
* - suspended: Locked (security incident, ToS violation)
|
|
33
|
+
* - pending_deletion: Deletion requested, within the grace period (recoverable)
|
|
34
|
+
* - deleted: Grace period elapsed and the account was purged (anonymize mode only —
|
|
35
|
+
* hard-delete removes the row instead, so this status never appears for it)
|
|
36
|
+
*/
|
|
37
|
+
declare const USER_STATUSES: readonly ["active", "inactive", "suspended", "pending_deletion", "deleted"];
|
|
38
|
+
/**
|
|
39
|
+
* User status type derived from the const array
|
|
40
|
+
*/
|
|
41
|
+
type UserStatus = typeof USER_STATUSES[number];
|
|
42
|
+
/**
|
|
43
|
+
* Social provider enum values
|
|
44
|
+
* Single source of truth for supported OAuth providers
|
|
45
|
+
*/
|
|
46
|
+
declare const SOCIAL_PROVIDERS: readonly ["google", "apple", "github", "kakao", "naver", "superself"];
|
|
47
|
+
/**
|
|
48
|
+
* Social provider type derived from the const array
|
|
49
|
+
*/
|
|
50
|
+
type SocialProvider = typeof SOCIAL_PROVIDERS[number];
|
|
51
|
+
/**
|
|
52
|
+
* Account deletion request status enum values
|
|
53
|
+
* Single source of truth for `account_deletion_requests.status`
|
|
54
|
+
*
|
|
55
|
+
* - pending: Awaiting the grace period (or immediate purge)
|
|
56
|
+
* - cancelled: User (or admin) recovered the account before purge
|
|
57
|
+
* - completed: The purge ran (row is kept as an audit record, never deleted)
|
|
58
|
+
*/
|
|
59
|
+
declare const ACCOUNT_DELETION_REQUEST_STATUSES: readonly ["pending", "cancelled", "completed"];
|
|
60
|
+
/**
|
|
61
|
+
* Account deletion request status type derived from the const array
|
|
62
|
+
*/
|
|
63
|
+
type AccountDeletionRequestStatus = typeof ACCOUNT_DELETION_REQUEST_STATUSES[number];
|
|
64
|
+
/**
|
|
65
|
+
* Who initiated an account deletion request
|
|
66
|
+
*/
|
|
67
|
+
declare const ACCOUNT_DELETION_REQUESTED_BY: readonly ["self", "admin"];
|
|
68
|
+
/**
|
|
69
|
+
* Account deletion requester type derived from the const array
|
|
70
|
+
*/
|
|
71
|
+
type AccountDeletionRequestedBy = typeof ACCOUNT_DELETION_REQUESTED_BY[number];
|
|
72
|
+
/**
|
|
73
|
+
* Purge strategy enum values
|
|
74
|
+
*
|
|
75
|
+
* - anonymize: Scrub PII, keep the row (status becomes 'deleted') — default
|
|
76
|
+
* - hard-delete: Physically remove the `users` row (cascades to child rows)
|
|
77
|
+
*/
|
|
78
|
+
declare const PURGE_STRATEGIES: readonly ["anonymize", "hard-delete"];
|
|
79
|
+
/**
|
|
80
|
+
* Purge strategy type derived from the const array
|
|
81
|
+
*/
|
|
82
|
+
type PurgeStrategy = typeof PURGE_STRATEGIES[number];
|
|
83
|
+
|
|
84
|
+
export { ACCOUNT_DELETION_REQUEST_STATUSES as A, INVITATION_STATUSES as I, type KeyAlgorithmType as K, PURGE_STRATEGIES as P, SOCIAL_PROVIDERS as S, USER_STATUSES as U, KEY_ALGORITHM as a, ACCOUNT_DELETION_REQUESTED_BY as b, type InvitationStatus as c, type UserStatus as d, type SocialProvider as e, type AccountDeletionRequestStatus as f, type AccountDeletionRequestedBy as g, type PurgeStrategy as h };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
CREATE TABLE "spfn_auth"."account_deletion_requests" (
|
|
2
|
+
"id" bigserial PRIMARY KEY NOT NULL,
|
|
3
|
+
"user_id" bigint,
|
|
4
|
+
"user_public_id" text NOT NULL,
|
|
5
|
+
"requested_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
6
|
+
"purge_scheduled_at" timestamp with time zone NOT NULL,
|
|
7
|
+
"status" text DEFAULT 'pending' NOT NULL,
|
|
8
|
+
"requested_by" text DEFAULT 'self' NOT NULL,
|
|
9
|
+
"reason" text,
|
|
10
|
+
"cancelled_at" timestamp with time zone,
|
|
11
|
+
"completed_at" timestamp with time zone,
|
|
12
|
+
"purge_strategy" text,
|
|
13
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
14
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
15
|
+
);
|
|
16
|
+
--> statement-breakpoint
|
|
17
|
+
ALTER TABLE "spfn_auth"."users" ADD COLUMN "deleted_at" timestamp with time zone;--> statement-breakpoint
|
|
18
|
+
ALTER TABLE "spfn_auth"."users" ADD COLUMN "deleted_by" text;--> statement-breakpoint
|
|
19
|
+
ALTER TABLE "spfn_auth"."account_deletion_requests" ADD CONSTRAINT "account_deletion_requests_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "spfn_auth"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
20
|
+
CREATE INDEX "account_deletion_requests_user_id_idx" ON "spfn_auth"."account_deletion_requests" USING btree ("user_id");--> statement-breakpoint
|
|
21
|
+
CREATE INDEX "account_deletion_requests_status_idx" ON "spfn_auth"."account_deletion_requests" USING btree ("status");--> statement-breakpoint
|
|
22
|
+
CREATE INDEX "account_deletion_requests_purge_scheduled_at_idx" ON "spfn_auth"."account_deletion_requests" USING btree ("purge_scheduled_at");--> statement-breakpoint
|
|
23
|
+
CREATE INDEX "account_deletion_requests_user_public_id_idx" ON "spfn_auth"."account_deletion_requests" USING btree ("user_public_id");--> statement-breakpoint
|
|
24
|
+
CREATE UNIQUE INDEX "account_deletion_requests_user_pending_unique_idx" ON "spfn_auth"."account_deletion_requests" USING btree ("user_id") WHERE "spfn_auth"."account_deletion_requests"."status" = 'pending';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "spfn_auth"."users" DROP CONSTRAINT "email_or_phone_check";
|