@shipfox/api-workspaces 7.1.0 → 9.0.1
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 +1 -1
- package/CHANGELOG.md +47 -0
- package/README.md +1 -5
- package/dist/core/entities/workspace.d.ts +1 -0
- package/dist/core/entities/workspace.d.ts.map +1 -1
- package/dist/core/entities/workspace.js.map +1 -1
- package/dist/core/workspaces.d.ts +3 -0
- package/dist/core/workspaces.d.ts.map +1 -1
- package/dist/core/workspaces.js +6 -1
- package/dist/core/workspaces.js.map +1 -1
- package/dist/db/db.d.ts +34 -0
- package/dist/db/db.d.ts.map +1 -1
- package/dist/db/schema/common.d.ts.map +1 -1
- package/dist/db/schema/common.js +1 -1
- package/dist/db/schema/common.js.map +1 -1
- package/dist/db/schema/workspaces.d.ts +17 -0
- package/dist/db/schema/workspaces.d.ts.map +1 -1
- package/dist/db/schema/workspaces.js +3 -1
- package/dist/db/schema/workspaces.js.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/presentation/inter-module.d.ts.map +1 -1
- package/dist/presentation/inter-module.js +15 -1
- package/dist/presentation/inter-module.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/drizzle/0000_initial.sql +50 -1
- package/drizzle/meta/0000_snapshot.json +377 -3
- package/drizzle/meta/_journal.json +0 -28
- package/package.json +18 -19
- package/src/core/entities/workspace.ts +1 -0
- package/src/core/workspaces.ts +9 -1
- package/src/db/schema/common.ts +1 -3
- package/src/db/schema/workspaces.ts +3 -1
- package/src/index.ts +1 -1
- package/src/presentation/inter-module.test.ts +71 -0
- package/src/presentation/inter-module.ts +15 -1
- package/test/factories/workspace.ts +1 -0
- package/test/globalSetup.ts +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/drizzle/0001_memberships_invitations.sql +0 -30
- package/drizzle/0002_membership_user_snapshots.sql +0 -40
- package/drizzle/0003_outgoing_enchantress.sql +0 -16
- package/drizzle/0004_tired_talon.sql +0 -1
- package/drizzle/meta/0001_snapshot.json +0 -705
- package/drizzle/meta/0003_snapshot.json +0 -442
- package/drizzle/meta/0004_snapshot.json +0 -448
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
CREATE TABLE "workspaces_invitations" (
|
|
2
|
-
"id" uuid PRIMARY KEY DEFAULT uuidv7() NOT NULL,
|
|
3
|
-
"workspace_id" uuid NOT NULL,
|
|
4
|
-
"email" text NOT NULL,
|
|
5
|
-
"hashed_token" text NOT NULL,
|
|
6
|
-
"expires_at" timestamp with time zone NOT NULL,
|
|
7
|
-
"accepted_at" timestamp with time zone,
|
|
8
|
-
"accepted_by_user_id" uuid,
|
|
9
|
-
"invited_by_user_id" uuid NOT NULL,
|
|
10
|
-
"invited_by_display" text,
|
|
11
|
-
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
12
|
-
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
13
|
-
);
|
|
14
|
-
--> statement-breakpoint
|
|
15
|
-
CREATE TABLE "workspaces_memberships" (
|
|
16
|
-
"id" uuid PRIMARY KEY DEFAULT uuidv7() NOT NULL,
|
|
17
|
-
"user_id" uuid NOT NULL,
|
|
18
|
-
"user_email" text NOT NULL,
|
|
19
|
-
"user_name" text,
|
|
20
|
-
"workspace_id" uuid NOT NULL,
|
|
21
|
-
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
22
|
-
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
23
|
-
);
|
|
24
|
-
--> statement-breakpoint
|
|
25
|
-
ALTER TABLE "workspaces_invitations" ADD CONSTRAINT "workspaces_invitations_workspace_id_workspaces_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspaces"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
26
|
-
ALTER TABLE "workspaces_memberships" ADD CONSTRAINT "workspaces_memberships_workspace_id_workspaces_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspaces"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
27
|
-
CREATE UNIQUE INDEX "workspaces_invitations_hashed_token_unique" ON "workspaces_invitations" USING btree ("hashed_token");--> statement-breakpoint
|
|
28
|
-
CREATE INDEX "workspaces_invitations_workspace_email_idx" ON "workspaces_invitations" USING btree ("workspace_id","email");--> statement-breakpoint
|
|
29
|
-
CREATE UNIQUE INDEX "workspaces_memberships_user_workspace_unique" ON "workspaces_memberships" USING btree ("user_id","workspace_id");--> statement-breakpoint
|
|
30
|
-
CREATE INDEX "workspaces_memberships_workspace_id_idx" ON "workspaces_memberships" USING btree ("workspace_id");
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
ALTER TABLE "workspaces_memberships" ADD COLUMN IF NOT EXISTS "user_email" text;--> statement-breakpoint
|
|
2
|
-
ALTER TABLE "workspaces_memberships" ADD COLUMN IF NOT EXISTS "user_name" text;--> statement-breakpoint
|
|
3
|
-
DO $$
|
|
4
|
-
BEGIN
|
|
5
|
-
IF to_regclass('public.workspaces_users') IS NOT NULL THEN
|
|
6
|
-
UPDATE "workspaces_memberships" memberships
|
|
7
|
-
SET
|
|
8
|
-
"user_email" = users."email",
|
|
9
|
-
"user_name" = users."name"
|
|
10
|
-
FROM "workspaces_users" users
|
|
11
|
-
WHERE memberships."user_id" = users."id"
|
|
12
|
-
AND memberships."user_email" IS NULL;
|
|
13
|
-
END IF;
|
|
14
|
-
END $$;--> statement-breakpoint
|
|
15
|
-
UPDATE "workspaces_memberships"
|
|
16
|
-
SET "user_email" = 'user-' || "user_id"::text || '@example.local'
|
|
17
|
-
WHERE "user_email" IS NULL;--> statement-breakpoint
|
|
18
|
-
ALTER TABLE "workspaces_memberships" ALTER COLUMN "user_email" SET NOT NULL;--> statement-breakpoint
|
|
19
|
-
DO $$
|
|
20
|
-
DECLARE
|
|
21
|
-
constraint_name text;
|
|
22
|
-
table_name text;
|
|
23
|
-
BEGIN
|
|
24
|
-
FOR constraint_name, table_name IN
|
|
25
|
-
SELECT tc.constraint_name, tc.table_name
|
|
26
|
-
FROM information_schema.table_constraints tc
|
|
27
|
-
JOIN information_schema.key_column_usage kcu
|
|
28
|
-
ON tc.constraint_name = kcu.constraint_name
|
|
29
|
-
AND tc.table_schema = kcu.table_schema
|
|
30
|
-
JOIN information_schema.constraint_column_usage ccu
|
|
31
|
-
ON ccu.constraint_name = tc.constraint_name
|
|
32
|
-
AND ccu.table_schema = tc.table_schema
|
|
33
|
-
WHERE tc.constraint_type = 'FOREIGN KEY'
|
|
34
|
-
AND tc.table_schema = 'public'
|
|
35
|
-
AND tc.table_name IN ('workspaces_memberships', 'workspaces_invitations')
|
|
36
|
-
AND ccu.table_name = 'workspaces_users'
|
|
37
|
-
LOOP
|
|
38
|
-
EXECUTE format('ALTER TABLE %I DROP CONSTRAINT %I', table_name, constraint_name);
|
|
39
|
-
END LOOP;
|
|
40
|
-
END $$;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
CREATE TABLE "workspaces_outbox" (
|
|
2
|
-
"id" uuid PRIMARY KEY DEFAULT uuidv7() NOT NULL,
|
|
3
|
-
"event_type" text NOT NULL,
|
|
4
|
-
"ordering_key" text,
|
|
5
|
-
"payload" jsonb NOT NULL,
|
|
6
|
-
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
7
|
-
"dispatched_at" timestamp with time zone,
|
|
8
|
-
"dispatch_attempts" integer DEFAULT 0 NOT NULL,
|
|
9
|
-
"next_dispatch_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
10
|
-
"last_dispatch_error" jsonb,
|
|
11
|
-
"last_dispatch_failed_at" timestamp with time zone,
|
|
12
|
-
"dead_lettered_at" timestamp with time zone
|
|
13
|
-
);
|
|
14
|
-
--> statement-breakpoint
|
|
15
|
-
CREATE INDEX "workspaces_outbox_pending_idx" ON "workspaces_outbox" USING btree ("next_dispatch_at","created_at") WHERE "dispatched_at" IS NULL AND "dead_lettered_at" IS NULL;--> statement-breakpoint
|
|
16
|
-
CREATE INDEX "workspaces_outbox_dispatched_retention_idx" ON "workspaces_outbox" USING btree ("dispatched_at","id") WHERE "dispatched_at" IS NOT NULL;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ALTER TABLE "workspaces_invitations" ADD COLUMN "revoked_at" timestamp with time zone;
|