@shipfox/api-workspaces 11.0.0 → 12.0.0
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 +34 -0
- package/README.md +27 -4
- 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/errors.d.ts +3 -0
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +6 -0
- package/dist/core/errors.js.map +1 -1
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/invitations.js +1 -1
- package/dist/core/invitations.js.map +1 -1
- package/dist/core/rate-limit.d.ts +39 -0
- package/dist/core/rate-limit.d.ts.map +1 -0
- package/dist/core/rate-limit.js +70 -0
- package/dist/core/rate-limit.js.map +1 -0
- package/dist/core/workspaces.d.ts +7 -0
- package/dist/core/workspaces.d.ts.map +1 -1
- package/dist/core/workspaces.js +42 -4
- package/dist/core/workspaces.js.map +1 -1
- package/dist/db/db.d.ts +320 -0
- package/dist/db/db.d.ts.map +1 -1
- package/dist/db/db.js +3 -1
- package/dist/db/db.js.map +1 -1
- package/dist/db/index.d.ts +4 -1
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +3 -1
- package/dist/db/index.js.map +1 -1
- package/dist/db/memberships.d.ts +1 -0
- package/dist/db/memberships.d.ts.map +1 -1
- package/dist/db/memberships.js +2 -0
- package/dist/db/memberships.js.map +1 -1
- package/dist/db/rate-limits.d.ts +9 -0
- package/dist/db/rate-limits.d.ts.map +1 -0
- package/dist/db/rate-limits.js +43 -0
- package/dist/db/rate-limits.js.map +1 -0
- package/dist/db/schema/rate-limits.d.ts +145 -0
- package/dist/db/schema/rate-limits.d.ts.map +1 -0
- package/dist/db/schema/rate-limits.js +25 -0
- package/dist/db/schema/rate-limits.js.map +1 -0
- 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 +5 -2
- package/dist/db/schema/workspaces.js.map +1 -1
- package/dist/db/workspaces.d.ts +11 -1
- package/dist/db/workspaces.d.ts.map +1 -1
- package/dist/db/workspaces.js +12 -3
- package/dist/db/workspaces.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/metrics/instance.d.ts +6 -0
- package/dist/metrics/instance.d.ts.map +1 -1
- package/dist/metrics/instance.js +12 -0
- package/dist/metrics/instance.js.map +1 -1
- package/dist/presentation/dto/membership.d.ts.map +1 -1
- package/dist/presentation/dto/membership.js +1 -0
- package/dist/presentation/dto/membership.js.map +1 -1
- package/dist/presentation/dto/workspace.d.ts.map +1 -1
- package/dist/presentation/dto/workspace.js +1 -0
- package/dist/presentation/dto/workspace.js.map +1 -1
- package/dist/presentation/e2eRoutes/create-workspace.d.ts.map +1 -1
- package/dist/presentation/e2eRoutes/create-workspace.js +11 -1
- package/dist/presentation/e2eRoutes/create-workspace.js.map +1 -1
- package/dist/presentation/routes/index.d.ts.map +1 -1
- package/dist/presentation/routes/index.js +3 -1
- package/dist/presentation/routes/index.js.map +1 -1
- package/dist/presentation/routes/rate-limit.d.ts +3 -0
- package/dist/presentation/routes/rate-limit.d.ts.map +1 -0
- package/dist/presentation/routes/rate-limit.js +42 -0
- package/dist/presentation/routes/rate-limit.js.map +1 -0
- package/dist/presentation/routes/workspaces/create.d.ts.map +1 -1
- package/dist/presentation/routes/workspaces/create.js +11 -1
- package/dist/presentation/routes/workspaces/create.js.map +1 -1
- package/dist/presentation/routes/workspaces/index.d.ts +2 -0
- package/dist/presentation/routes/workspaces/index.d.ts.map +1 -1
- package/dist/presentation/routes/workspaces/index.js +2 -0
- package/dist/presentation/routes/workspaces/index.js.map +1 -1
- package/dist/presentation/routes/workspaces/slug-availability.d.ts +2 -0
- package/dist/presentation/routes/workspaces/slug-availability.d.ts.map +1 -0
- package/dist/presentation/routes/workspaces/slug-availability.js +31 -0
- package/dist/presentation/routes/workspaces/slug-availability.js.map +1 -0
- package/dist/presentation/routes/workspaces/update.d.ts +2 -0
- package/dist/presentation/routes/workspaces/update.d.ts.map +1 -0
- package/dist/presentation/routes/workspaces/update.js +49 -0
- package/dist/presentation/routes/workspaces/update.js.map +1 -0
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/drizzle/0000_initial.sql +2 -0
- package/drizzle/0003_dapper_talos.sql +13 -0
- package/drizzle/meta/0000_snapshot.json +23 -1
- package/drizzle/meta/0003_snapshot.json +689 -0
- package/drizzle/meta/_journal.json +7 -0
- package/package.json +14 -12
- package/src/core/entities/workspace.ts +1 -0
- package/src/core/errors.ts +7 -0
- package/src/core/index.ts +3 -0
- package/src/core/invitations.ts +1 -1
- package/src/core/rate-limit.test.ts +113 -0
- package/src/core/rate-limit.ts +119 -0
- package/src/core/workspaces.test.ts +9 -0
- package/src/core/workspaces.ts +47 -3
- package/src/db/db.ts +2 -0
- package/src/db/index.ts +10 -0
- package/src/db/memberships.ts +3 -0
- package/src/db/rate-limits.test.ts +74 -0
- package/src/db/rate-limits.ts +59 -0
- package/src/db/schema/rate-limits.ts +27 -0
- package/src/db/schema/workspaces.ts +7 -2
- package/src/db/workspaces.ts +21 -1
- package/src/index.test.ts +2 -0
- package/src/index.ts +1 -0
- package/src/metrics/instance.ts +26 -0
- package/src/presentation/dto/membership.ts +1 -0
- package/src/presentation/dto/workspace.ts +1 -0
- package/src/presentation/e2eRoutes/create-workspace.ts +9 -1
- package/src/presentation/inter-module.test.ts +22 -4
- package/src/presentation/routes/index.ts +8 -1
- package/src/presentation/routes/rate-limit.ts +45 -0
- package/src/presentation/routes/workspaces/create.test.ts +33 -3
- package/src/presentation/routes/workspaces/create.ts +9 -1
- package/src/presentation/routes/workspaces/index.ts +2 -0
- package/src/presentation/routes/workspaces/list.test.ts +1 -0
- package/src/presentation/routes/workspaces/slug-availability.test.ts +159 -0
- package/src/presentation/routes/workspaces/slug-availability.ts +30 -0
- package/src/presentation/routes/workspaces/update.test.ts +114 -0
- package/src/presentation/routes/workspaces/update.ts +41 -0
- package/test/env.ts +1 -0
- package/test/factories/workspace.ts +3 -1
- package/test/globalSetup.ts +1 -1
- package/test/routes.ts +18 -4
- package/tsconfig.build.tsbuildinfo +1 -1
package/drizzle/0000_initial.sql
CHANGED
|
@@ -41,6 +41,7 @@ CREATE TABLE "workspaces_outbox" (
|
|
|
41
41
|
CREATE TABLE "workspaces_workspaces" (
|
|
42
42
|
"id" uuid PRIMARY KEY DEFAULT uuidv7() NOT NULL,
|
|
43
43
|
"name" text NOT NULL,
|
|
44
|
+
"slug" text NOT NULL,
|
|
44
45
|
"status" "workspaces_workspace_status" DEFAULT 'active' NOT NULL,
|
|
45
46
|
"settings" jsonb DEFAULT '{}'::jsonb NOT NULL,
|
|
46
47
|
"created_by" uuid,
|
|
@@ -54,5 +55,6 @@ CREATE UNIQUE INDEX "workspaces_invitations_hashed_token_unique" ON "workspaces_
|
|
|
54
55
|
CREATE INDEX "workspaces_invitations_workspace_email_idx" ON "workspaces_invitations" USING btree ("workspace_id","email");--> statement-breakpoint
|
|
55
56
|
CREATE UNIQUE INDEX "workspaces_memberships_user_workspace_unique" ON "workspaces_memberships" USING btree ("user_id","workspace_id");--> statement-breakpoint
|
|
56
57
|
CREATE INDEX "workspaces_memberships_workspace_id_idx" ON "workspaces_memberships" USING btree ("workspace_id");--> statement-breakpoint
|
|
58
|
+
CREATE UNIQUE INDEX "workspaces_slug_unique" ON "workspaces_workspaces" USING btree ("slug");--> statement-breakpoint
|
|
57
59
|
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
|
|
58
60
|
CREATE INDEX "workspaces_outbox_dispatched_retention_idx" ON "workspaces_outbox" USING btree ("dispatched_at","id") WHERE "dispatched_at" IS NOT NULL;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
CREATE TABLE "workspaces_rate_limits" (
|
|
2
|
+
"action" text NOT NULL,
|
|
3
|
+
"scope" text NOT NULL,
|
|
4
|
+
"identifier_hmac" text NOT NULL,
|
|
5
|
+
"window_start" timestamp with time zone NOT NULL,
|
|
6
|
+
"count" integer DEFAULT 1 NOT NULL,
|
|
7
|
+
"expires_at" timestamp with time zone NOT NULL,
|
|
8
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
9
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
10
|
+
);
|
|
11
|
+
--> statement-breakpoint
|
|
12
|
+
CREATE UNIQUE INDEX "workspaces_rate_limits_window_unique" ON "workspaces_rate_limits" USING btree ("action","scope","identifier_hmac","window_start");--> statement-breakpoint
|
|
13
|
+
CREATE INDEX "workspaces_rate_limits_expires_at_idx" ON "workspaces_rate_limits" USING btree ("expires_at");--> statement-breakpoint
|
|
@@ -389,6 +389,12 @@
|
|
|
389
389
|
"primaryKey": false,
|
|
390
390
|
"notNull": true
|
|
391
391
|
},
|
|
392
|
+
"slug": {
|
|
393
|
+
"name": "slug",
|
|
394
|
+
"type": "text",
|
|
395
|
+
"primaryKey": false,
|
|
396
|
+
"notNull": true
|
|
397
|
+
},
|
|
392
398
|
"status": {
|
|
393
399
|
"name": "status",
|
|
394
400
|
"type": "workspaces_workspace_status",
|
|
@@ -425,7 +431,23 @@
|
|
|
425
431
|
"default": "now()"
|
|
426
432
|
}
|
|
427
433
|
},
|
|
428
|
-
"indexes": {
|
|
434
|
+
"indexes": {
|
|
435
|
+
"workspaces_slug_unique": {
|
|
436
|
+
"name": "workspaces_slug_unique",
|
|
437
|
+
"columns": [
|
|
438
|
+
{
|
|
439
|
+
"expression": "slug",
|
|
440
|
+
"isExpression": false,
|
|
441
|
+
"asc": true,
|
|
442
|
+
"nulls": "last"
|
|
443
|
+
}
|
|
444
|
+
],
|
|
445
|
+
"isUnique": true,
|
|
446
|
+
"concurrently": false,
|
|
447
|
+
"method": "btree",
|
|
448
|
+
"with": {}
|
|
449
|
+
}
|
|
450
|
+
},
|
|
429
451
|
"foreignKeys": {},
|
|
430
452
|
"compositePrimaryKeys": {},
|
|
431
453
|
"uniqueConstraints": {},
|