@shipfox/api-workspaces 2.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 +2 -0
- package/.turbo/turbo-type$colon$emit.log +1 -0
- package/.turbo/turbo-type.log +1 -0
- package/CHANGELOG.md +97 -0
- package/LICENSE +21 -0
- package/README.md +87 -0
- package/dist/config.d.ts +12 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +58 -0
- package/dist/config.js.map +1 -0
- package/dist/core/entities/index.d.ts +4 -0
- package/dist/core/entities/index.d.ts.map +1 -0
- package/dist/core/entities/index.js +3 -0
- package/dist/core/entities/index.js.map +1 -0
- package/dist/core/entities/invitation.d.ts +14 -0
- package/dist/core/entities/invitation.d.ts.map +1 -0
- package/dist/core/entities/invitation.js +3 -0
- package/dist/core/entities/invitation.js.map +1 -0
- package/dist/core/entities/membership.d.ts +10 -0
- package/dist/core/entities/membership.d.ts.map +1 -0
- package/dist/core/entities/membership.js +3 -0
- package/dist/core/entities/membership.js.map +1 -0
- package/dist/core/entities/workspace.d.ts +10 -0
- package/dist/core/entities/workspace.d.ts.map +1 -0
- package/dist/core/entities/workspace.js +3 -0
- package/dist/core/entities/workspace.js.map +1 -0
- package/dist/core/errors.d.ts +52 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +104 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/index.d.ts +8 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +6 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/invitations.d.ts +51 -0
- package/dist/core/invitations.d.ts.map +1 -0
- package/dist/core/invitations.js +136 -0
- package/dist/core/invitations.js.map +1 -0
- package/dist/core/memberships.d.ts +9 -0
- package/dist/core/memberships.d.ts.map +1 -0
- package/dist/core/memberships.js +13 -0
- package/dist/core/memberships.js.map +1 -0
- package/dist/core/workspaces.d.ts +40 -0
- package/dist/core/workspaces.d.ts.map +1 -0
- package/dist/core/workspaces.js +85 -0
- package/dist/core/workspaces.js.map +1 -0
- package/dist/db/db.d.ts +1253 -0
- package/dist/db/db.d.ts.map +1 -0
- package/dist/db/db.js +24 -0
- package/dist/db/db.js.map +1 -0
- package/dist/db/index.d.ts +10 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +10 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/invitations.d.ts +47 -0
- package/dist/db/invitations.d.ts.map +1 -0
- package/dist/db/invitations.js +107 -0
- package/dist/db/invitations.js.map +1 -0
- package/dist/db/memberships.d.ts +44 -0
- package/dist/db/memberships.d.ts.map +1 -0
- package/dist/db/memberships.js +75 -0
- package/dist/db/memberships.js.map +1 -0
- package/dist/db/schema/common.d.ts +2 -0
- package/dist/db/schema/common.d.ts.map +1 -0
- package/dist/db/schema/common.js +4 -0
- package/dist/db/schema/common.js.map +1 -0
- package/dist/db/schema/invitations.d.ts +199 -0
- package/dist/db/schema/invitations.d.ts.map +1 -0
- package/dist/db/schema/invitations.js +47 -0
- package/dist/db/schema/invitations.js.map +1 -0
- package/dist/db/schema/memberships.d.ts +131 -0
- package/dist/db/schema/memberships.d.ts.map +1 -0
- package/dist/db/schema/memberships.js +35 -0
- package/dist/db/schema/memberships.js.map +1 -0
- package/dist/db/schema/outbox.d.ts +195 -0
- package/dist/db/schema/outbox.d.ts.map +1 -0
- package/dist/db/schema/outbox.js +5 -0
- package/dist/db/schema/outbox.js.map +1 -0
- package/dist/db/schema/workspaces.d.ts +115 -0
- package/dist/db/schema/workspaces.d.ts.map +1 -0
- package/dist/db/schema/workspaces.js +32 -0
- package/dist/db/schema/workspaces.js.map +1 -0
- package/dist/db/workspaces.d.ts +20 -0
- package/dist/db/workspaces.d.ts.map +1 -0
- package/dist/db/workspaces.js +53 -0
- package/dist/db/workspaces.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/metrics/index.d.ts +2 -0
- package/dist/metrics/index.d.ts.map +1 -0
- package/dist/metrics/index.js +3 -0
- package/dist/metrics/index.js.map +1 -0
- package/dist/metrics/instance.d.ts +8 -0
- package/dist/metrics/instance.d.ts.map +1 -0
- package/dist/metrics/instance.js +41 -0
- package/dist/metrics/instance.js.map +1 -0
- package/dist/metrics/service.d.ts +2 -0
- package/dist/metrics/service.d.ts.map +1 -0
- package/dist/metrics/service.js +26 -0
- package/dist/metrics/service.js.map +1 -0
- package/dist/presentation/dto/index.d.ts +4 -0
- package/dist/presentation/dto/index.d.ts.map +1 -0
- package/dist/presentation/dto/index.js +5 -0
- package/dist/presentation/dto/index.js.map +1 -0
- package/dist/presentation/dto/invitation.d.ts +4 -0
- package/dist/presentation/dto/invitation.d.ts.map +1 -0
- package/dist/presentation/dto/invitation.js +15 -0
- package/dist/presentation/dto/invitation.js.map +1 -0
- package/dist/presentation/dto/membership.d.ts +5 -0
- package/dist/presentation/dto/membership.d.ts.map +1 -0
- package/dist/presentation/dto/membership.js +23 -0
- package/dist/presentation/dto/membership.js.map +1 -0
- package/dist/presentation/dto/workspace.d.ts +4 -0
- package/dist/presentation/dto/workspace.d.ts.map +1 -0
- package/dist/presentation/dto/workspace.js +12 -0
- package/dist/presentation/dto/workspace.js.map +1 -0
- package/dist/presentation/e2eRoutes/create-invitation.d.ts +2 -0
- package/dist/presentation/e2eRoutes/create-invitation.d.ts.map +1 -0
- package/dist/presentation/e2eRoutes/create-invitation.js +39 -0
- package/dist/presentation/e2eRoutes/create-invitation.js.map +1 -0
- package/dist/presentation/e2eRoutes/create-workspace.d.ts +2 -0
- package/dist/presentation/e2eRoutes/create-workspace.d.ts.map +1 -0
- package/dist/presentation/e2eRoutes/create-workspace.js +27 -0
- package/dist/presentation/e2eRoutes/create-workspace.js.map +1 -0
- package/dist/presentation/e2eRoutes/index.d.ts +3 -0
- package/dist/presentation/e2eRoutes/index.d.ts.map +1 -0
- package/dist/presentation/e2eRoutes/index.js +11 -0
- package/dist/presentation/e2eRoutes/index.js.map +1 -0
- package/dist/presentation/index.d.ts +2 -0
- package/dist/presentation/index.d.ts.map +1 -0
- package/dist/presentation/index.js +3 -0
- package/dist/presentation/index.js.map +1 -0
- package/dist/presentation/routes/index.d.ts +3 -0
- package/dist/presentation/routes/index.d.ts.map +1 -0
- package/dist/presentation/routes/index.js +23 -0
- package/dist/presentation/routes/index.js.map +1 -0
- package/dist/presentation/routes/invitations/accept.d.ts +2 -0
- package/dist/presentation/routes/invitations/accept.d.ts.map +1 -0
- package/dist/presentation/routes/invitations/accept.js +67 -0
- package/dist/presentation/routes/invitations/accept.js.map +1 -0
- package/dist/presentation/routes/invitations/create.d.ts +2 -0
- package/dist/presentation/routes/invitations/create.d.ts.map +1 -0
- package/dist/presentation/routes/invitations/create.js +66 -0
- package/dist/presentation/routes/invitations/create.js.map +1 -0
- package/dist/presentation/routes/invitations/index.d.ts +4 -0
- package/dist/presentation/routes/invitations/index.d.ts.map +1 -0
- package/dist/presentation/routes/invitations/index.js +19 -0
- package/dist/presentation/routes/invitations/index.js.map +1 -0
- package/dist/presentation/routes/invitations/list.d.ts +2 -0
- package/dist/presentation/routes/invitations/list.d.ts.map +1 -0
- package/dist/presentation/routes/invitations/list.js +58 -0
- package/dist/presentation/routes/invitations/list.js.map +1 -0
- package/dist/presentation/routes/invitations/preview.d.ts +2 -0
- package/dist/presentation/routes/invitations/preview.d.ts.map +1 -0
- package/dist/presentation/routes/invitations/preview.js +47 -0
- package/dist/presentation/routes/invitations/preview.js.map +1 -0
- package/dist/presentation/routes/invitations/revoke.d.ts +2 -0
- package/dist/presentation/routes/invitations/revoke.d.ts.map +1 -0
- package/dist/presentation/routes/invitations/revoke.js +66 -0
- package/dist/presentation/routes/invitations/revoke.js.map +1 -0
- package/dist/presentation/routes/members/index.d.ts +3 -0
- package/dist/presentation/routes/members/index.d.ts.map +1 -0
- package/dist/presentation/routes/members/index.js +8 -0
- package/dist/presentation/routes/members/index.js.map +1 -0
- package/dist/presentation/routes/members/list.d.ts +2 -0
- package/dist/presentation/routes/members/list.d.ts.map +1 -0
- package/dist/presentation/routes/members/list.js +58 -0
- package/dist/presentation/routes/members/list.js.map +1 -0
- package/dist/presentation/routes/members/remove.d.ts +2 -0
- package/dist/presentation/routes/members/remove.d.ts.map +1 -0
- package/dist/presentation/routes/members/remove.js +71 -0
- package/dist/presentation/routes/members/remove.js.map +1 -0
- package/dist/presentation/routes/workspaces/create.d.ts +2 -0
- package/dist/presentation/routes/workspaces/create.d.ts.map +1 -0
- package/dist/presentation/routes/workspaces/create.js +36 -0
- package/dist/presentation/routes/workspaces/create.js.map +1 -0
- package/dist/presentation/routes/workspaces/index.d.ts +3 -0
- package/dist/presentation/routes/workspaces/index.d.ts.map +1 -0
- package/dist/presentation/routes/workspaces/index.js +4 -0
- package/dist/presentation/routes/workspaces/index.js.map +1 -0
- package/dist/presentation/routes/workspaces/list.d.ts +2 -0
- package/dist/presentation/routes/workspaces/list.d.ts.map +1 -0
- package/dist/presentation/routes/workspaces/list.js +32 -0
- package/dist/presentation/routes/workspaces/list.js.map +1 -0
- package/dist/presentation/subscribers/index.d.ts +2 -0
- package/dist/presentation/subscribers/index.d.ts.map +1 -0
- package/dist/presentation/subscribers/index.js +3 -0
- package/dist/presentation/subscribers/index.js.map +1 -0
- package/dist/presentation/subscribers/on-invitation-send-requested.d.ts +3 -0
- package/dist/presentation/subscribers/on-invitation-send-requested.d.ts.map +1 -0
- package/dist/presentation/subscribers/on-invitation-send-requested.js +16 -0
- package/dist/presentation/subscribers/on-invitation-send-requested.js.map +1 -0
- package/dist/tsconfig.test.tsbuildinfo +1 -0
- package/drizzle/0000_initial.sql +9 -0
- package/drizzle/0001_memberships_invitations.sql +30 -0
- package/drizzle/0002_membership_user_snapshots.sql +40 -0
- package/drizzle/0003_outgoing_enchantress.sql +16 -0
- package/drizzle/meta/0000_snapshot.json +80 -0
- package/drizzle/meta/0001_snapshot.json +705 -0
- package/drizzle/meta/0003_snapshot.json +442 -0
- package/drizzle/meta/_journal.json +34 -0
- package/drizzle.config.ts +7 -0
- package/package.json +71 -0
- package/src/config.ts +51 -0
- package/src/core/entities/index.ts +3 -0
- package/src/core/entities/invitation.ts +13 -0
- package/src/core/entities/membership.ts +9 -0
- package/src/core/entities/workspace.ts +10 -0
- package/src/core/errors.ts +118 -0
- package/src/core/index.ts +35 -0
- package/src/core/invitations.test.ts +251 -0
- package/src/core/invitations.ts +191 -0
- package/src/core/memberships.test.ts +77 -0
- package/src/core/memberships.ts +17 -0
- package/src/core/workspaces.test.ts +72 -0
- package/src/core/workspaces.ts +126 -0
- package/src/db/db.ts +24 -0
- package/src/db/index.ts +43 -0
- package/src/db/invitations.test.ts +204 -0
- package/src/db/invitations.ts +235 -0
- package/src/db/memberships.test.ts +107 -0
- package/src/db/memberships.ts +139 -0
- package/src/db/schema/common.ts +5 -0
- package/src/db/schema/invitations.ts +47 -0
- package/src/db/schema/memberships.ts +39 -0
- package/src/db/schema/outbox.ts +4 -0
- package/src/db/schema/workspaces.ts +33 -0
- package/src/db/workspaces.test.ts +114 -0
- package/src/db/workspaces.ts +81 -0
- package/src/index.test.ts +25 -0
- package/src/index.ts +43 -0
- package/src/metrics/index.ts +1 -0
- package/src/metrics/instance.test.ts +74 -0
- package/src/metrics/instance.ts +57 -0
- package/src/metrics/service.ts +26 -0
- package/src/presentation/dto/index.ts +3 -0
- package/src/presentation/dto/invitation.ts +16 -0
- package/src/presentation/dto/membership.ts +27 -0
- package/src/presentation/dto/workspace.ts +13 -0
- package/src/presentation/e2eRoutes/create-invitation.ts +44 -0
- package/src/presentation/e2eRoutes/create-workspace.ts +30 -0
- package/src/presentation/e2eRoutes/index.ts +8 -0
- package/src/presentation/index.ts +1 -0
- package/src/presentation/routes/index.ts +23 -0
- package/src/presentation/routes/invitations/accept.test.ts +154 -0
- package/src/presentation/routes/invitations/accept.ts +70 -0
- package/src/presentation/routes/invitations/create.test.ts +99 -0
- package/src/presentation/routes/invitations/create.ts +60 -0
- package/src/presentation/routes/invitations/index.ts +17 -0
- package/src/presentation/routes/invitations/list.test.ts +94 -0
- package/src/presentation/routes/invitations/list.ts +53 -0
- package/src/presentation/routes/invitations/preview.test.ts +140 -0
- package/src/presentation/routes/invitations/preview.ts +46 -0
- package/src/presentation/routes/invitations/revoke.test.ts +99 -0
- package/src/presentation/routes/invitations/revoke.ts +64 -0
- package/src/presentation/routes/members/index.ts +5 -0
- package/src/presentation/routes/members/list.test.ts +95 -0
- package/src/presentation/routes/members/list.ts +53 -0
- package/src/presentation/routes/members/remove.test.ts +110 -0
- package/src/presentation/routes/members/remove.ts +66 -0
- package/src/presentation/routes/workspaces/create.test.ts +87 -0
- package/src/presentation/routes/workspaces/create.ts +36 -0
- package/src/presentation/routes/workspaces/index.ts +2 -0
- package/src/presentation/routes/workspaces/list.test.ts +56 -0
- package/src/presentation/routes/workspaces/list.ts +29 -0
- package/src/presentation/subscribers/index.ts +1 -0
- package/src/presentation/subscribers/invitation-send-requested.test.ts +64 -0
- package/src/presentation/subscribers/on-invitation-send-requested.ts +15 -0
- package/test/env.ts +8 -0
- package/test/factories/index.ts +3 -0
- package/test/factories/membership.ts +24 -0
- package/test/factories/user.ts +15 -0
- package/test/factories/workspace.ts +18 -0
- package/test/globalSetup.ts +15 -0
- package/test/index.ts +3 -0
- package/test/routes.ts +255 -0
- package/test/setup.ts +17 -0
- package/tsconfig.build.json +9 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +3 -0
- package/tsconfig.test.json +8 -0
- package/vitest.config.ts +11 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { uuidv7PrimaryKey } from '@shipfox/node-drizzle';
|
|
2
|
+
import { index, text, timestamp, uniqueIndex, uuid } from 'drizzle-orm/pg-core';
|
|
3
|
+
import { pgTable } from './common.js';
|
|
4
|
+
import { workspaces } from './workspaces.js';
|
|
5
|
+
export const invitations = pgTable('invitations', {
|
|
6
|
+
id: uuidv7PrimaryKey(),
|
|
7
|
+
workspaceId: uuid('workspace_id').notNull().references(()=>workspaces.id, {
|
|
8
|
+
onDelete: 'cascade'
|
|
9
|
+
}),
|
|
10
|
+
email: text('email').notNull(),
|
|
11
|
+
hashedToken: text('hashed_token').notNull(),
|
|
12
|
+
expiresAt: timestamp('expires_at', {
|
|
13
|
+
withTimezone: true
|
|
14
|
+
}).notNull(),
|
|
15
|
+
acceptedAt: timestamp('accepted_at', {
|
|
16
|
+
withTimezone: true
|
|
17
|
+
}),
|
|
18
|
+
acceptedByUserId: uuid('accepted_by_user_id'),
|
|
19
|
+
invitedByUserId: uuid('invited_by_user_id').notNull(),
|
|
20
|
+
invitedByDisplay: text('invited_by_display'),
|
|
21
|
+
createdAt: timestamp('created_at', {
|
|
22
|
+
withTimezone: true
|
|
23
|
+
}).notNull().defaultNow(),
|
|
24
|
+
updatedAt: timestamp('updated_at', {
|
|
25
|
+
withTimezone: true
|
|
26
|
+
}).notNull().defaultNow()
|
|
27
|
+
}, (table)=>[
|
|
28
|
+
uniqueIndex('workspaces_invitations_hashed_token_unique').on(table.hashedToken),
|
|
29
|
+
index('workspaces_invitations_workspace_email_idx').on(table.workspaceId, table.email)
|
|
30
|
+
]);
|
|
31
|
+
export function toInvitation(row) {
|
|
32
|
+
return {
|
|
33
|
+
id: row.id,
|
|
34
|
+
workspaceId: row.workspaceId,
|
|
35
|
+
email: row.email,
|
|
36
|
+
hashedToken: row.hashedToken,
|
|
37
|
+
expiresAt: row.expiresAt,
|
|
38
|
+
acceptedAt: row.acceptedAt,
|
|
39
|
+
acceptedByUserId: row.acceptedByUserId,
|
|
40
|
+
invitedByUserId: row.invitedByUserId,
|
|
41
|
+
invitedByDisplay: row.invitedByDisplay,
|
|
42
|
+
createdAt: row.createdAt,
|
|
43
|
+
updatedAt: row.updatedAt
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=invitations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/db/schema/invitations.ts"],"sourcesContent":["import {uuidv7PrimaryKey} from '@shipfox/node-drizzle';\nimport {index, text, timestamp, uniqueIndex, uuid} from 'drizzle-orm/pg-core';\nimport type {Invitation} from '#core/entities/invitation.js';\nimport {pgTable} from './common.js';\nimport {workspaces} from './workspaces.js';\n\nexport const invitations = pgTable(\n 'invitations',\n {\n id: uuidv7PrimaryKey(),\n workspaceId: uuid('workspace_id')\n .notNull()\n .references(() => workspaces.id, {onDelete: 'cascade'}),\n email: text('email').notNull(),\n hashedToken: text('hashed_token').notNull(),\n expiresAt: timestamp('expires_at', {withTimezone: true}).notNull(),\n acceptedAt: timestamp('accepted_at', {withTimezone: true}),\n acceptedByUserId: uuid('accepted_by_user_id'),\n invitedByUserId: uuid('invited_by_user_id').notNull(),\n invitedByDisplay: text('invited_by_display'),\n createdAt: timestamp('created_at', {withTimezone: true}).notNull().defaultNow(),\n updatedAt: timestamp('updated_at', {withTimezone: true}).notNull().defaultNow(),\n },\n (table) => [\n uniqueIndex('workspaces_invitations_hashed_token_unique').on(table.hashedToken),\n index('workspaces_invitations_workspace_email_idx').on(table.workspaceId, table.email),\n ],\n);\n\nexport type InvitationDb = typeof invitations.$inferSelect;\nexport type InvitationCreateDb = typeof invitations.$inferInsert;\n\nexport function toInvitation(row: InvitationDb): Invitation {\n return {\n id: row.id,\n workspaceId: row.workspaceId,\n email: row.email,\n hashedToken: row.hashedToken,\n expiresAt: row.expiresAt,\n acceptedAt: row.acceptedAt,\n acceptedByUserId: row.acceptedByUserId,\n invitedByUserId: row.invitedByUserId,\n invitedByDisplay: row.invitedByDisplay,\n createdAt: row.createdAt,\n updatedAt: row.updatedAt,\n };\n}\n"],"names":["uuidv7PrimaryKey","index","text","timestamp","uniqueIndex","uuid","pgTable","workspaces","invitations","id","workspaceId","notNull","references","onDelete","email","hashedToken","expiresAt","withTimezone","acceptedAt","acceptedByUserId","invitedByUserId","invitedByDisplay","createdAt","defaultNow","updatedAt","table","on","toInvitation","row"],"mappings":"AAAA,SAAQA,gBAAgB,QAAO,wBAAwB;AACvD,SAAQC,KAAK,EAAEC,IAAI,EAAEC,SAAS,EAAEC,WAAW,EAAEC,IAAI,QAAO,sBAAsB;AAE9E,SAAQC,OAAO,QAAO,cAAc;AACpC,SAAQC,UAAU,QAAO,kBAAkB;AAE3C,OAAO,MAAMC,cAAcF,QACzB,eACA;IACEG,IAAIT;IACJU,aAAaL,KAAK,gBACfM,OAAO,GACPC,UAAU,CAAC,IAAML,WAAWE,EAAE,EAAE;QAACI,UAAU;IAAS;IACvDC,OAAOZ,KAAK,SAASS,OAAO;IAC5BI,aAAab,KAAK,gBAAgBS,OAAO;IACzCK,WAAWb,UAAU,cAAc;QAACc,cAAc;IAAI,GAAGN,OAAO;IAChEO,YAAYf,UAAU,eAAe;QAACc,cAAc;IAAI;IACxDE,kBAAkBd,KAAK;IACvBe,iBAAiBf,KAAK,sBAAsBM,OAAO;IACnDU,kBAAkBnB,KAAK;IACvBoB,WAAWnB,UAAU,cAAc;QAACc,cAAc;IAAI,GAAGN,OAAO,GAAGY,UAAU;IAC7EC,WAAWrB,UAAU,cAAc;QAACc,cAAc;IAAI,GAAGN,OAAO,GAAGY,UAAU;AAC/E,GACA,CAACE,QAAU;QACTrB,YAAY,8CAA8CsB,EAAE,CAACD,MAAMV,WAAW;QAC9Ed,MAAM,8CAA8CyB,EAAE,CAACD,MAAMf,WAAW,EAAEe,MAAMX,KAAK;KACtF,EACD;AAKF,OAAO,SAASa,aAAaC,GAAiB;IAC5C,OAAO;QACLnB,IAAImB,IAAInB,EAAE;QACVC,aAAakB,IAAIlB,WAAW;QAC5BI,OAAOc,IAAId,KAAK;QAChBC,aAAaa,IAAIb,WAAW;QAC5BC,WAAWY,IAAIZ,SAAS;QACxBE,YAAYU,IAAIV,UAAU;QAC1BC,kBAAkBS,IAAIT,gBAAgB;QACtCC,iBAAiBQ,IAAIR,eAAe;QACpCC,kBAAkBO,IAAIP,gBAAgB;QACtCC,WAAWM,IAAIN,SAAS;QACxBE,WAAWI,IAAIJ,SAAS;IAC1B;AACF"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { Membership } from '#core/entities/membership.js';
|
|
2
|
+
export declare const memberships: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
3
|
+
name: "memberships";
|
|
4
|
+
schema: undefined;
|
|
5
|
+
columns: {
|
|
6
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
7
|
+
name: "id";
|
|
8
|
+
tableName: "memberships";
|
|
9
|
+
dataType: "string";
|
|
10
|
+
columnType: "PgUUID";
|
|
11
|
+
data: string;
|
|
12
|
+
driverParam: string;
|
|
13
|
+
notNull: true;
|
|
14
|
+
hasDefault: true;
|
|
15
|
+
isPrimaryKey: true;
|
|
16
|
+
isAutoincrement: false;
|
|
17
|
+
hasRuntimeDefault: false;
|
|
18
|
+
enumValues: undefined;
|
|
19
|
+
baseColumn: never;
|
|
20
|
+
identity: undefined;
|
|
21
|
+
generated: undefined;
|
|
22
|
+
}, {}, {}>;
|
|
23
|
+
userId: import("drizzle-orm/pg-core").PgColumn<{
|
|
24
|
+
name: "user_id";
|
|
25
|
+
tableName: "memberships";
|
|
26
|
+
dataType: "string";
|
|
27
|
+
columnType: "PgUUID";
|
|
28
|
+
data: string;
|
|
29
|
+
driverParam: string;
|
|
30
|
+
notNull: true;
|
|
31
|
+
hasDefault: false;
|
|
32
|
+
isPrimaryKey: false;
|
|
33
|
+
isAutoincrement: false;
|
|
34
|
+
hasRuntimeDefault: false;
|
|
35
|
+
enumValues: undefined;
|
|
36
|
+
baseColumn: never;
|
|
37
|
+
identity: undefined;
|
|
38
|
+
generated: undefined;
|
|
39
|
+
}, {}, {}>;
|
|
40
|
+
userEmail: import("drizzle-orm/pg-core").PgColumn<{
|
|
41
|
+
name: "user_email";
|
|
42
|
+
tableName: "memberships";
|
|
43
|
+
dataType: "string";
|
|
44
|
+
columnType: "PgText";
|
|
45
|
+
data: string;
|
|
46
|
+
driverParam: string;
|
|
47
|
+
notNull: true;
|
|
48
|
+
hasDefault: false;
|
|
49
|
+
isPrimaryKey: false;
|
|
50
|
+
isAutoincrement: false;
|
|
51
|
+
hasRuntimeDefault: false;
|
|
52
|
+
enumValues: [string, ...string[]];
|
|
53
|
+
baseColumn: never;
|
|
54
|
+
identity: undefined;
|
|
55
|
+
generated: undefined;
|
|
56
|
+
}, {}, {}>;
|
|
57
|
+
userName: import("drizzle-orm/pg-core").PgColumn<{
|
|
58
|
+
name: "user_name";
|
|
59
|
+
tableName: "memberships";
|
|
60
|
+
dataType: "string";
|
|
61
|
+
columnType: "PgText";
|
|
62
|
+
data: string;
|
|
63
|
+
driverParam: string;
|
|
64
|
+
notNull: false;
|
|
65
|
+
hasDefault: false;
|
|
66
|
+
isPrimaryKey: false;
|
|
67
|
+
isAutoincrement: false;
|
|
68
|
+
hasRuntimeDefault: false;
|
|
69
|
+
enumValues: [string, ...string[]];
|
|
70
|
+
baseColumn: never;
|
|
71
|
+
identity: undefined;
|
|
72
|
+
generated: undefined;
|
|
73
|
+
}, {}, {}>;
|
|
74
|
+
workspaceId: import("drizzle-orm/pg-core").PgColumn<{
|
|
75
|
+
name: "workspace_id";
|
|
76
|
+
tableName: "memberships";
|
|
77
|
+
dataType: "string";
|
|
78
|
+
columnType: "PgUUID";
|
|
79
|
+
data: string;
|
|
80
|
+
driverParam: string;
|
|
81
|
+
notNull: true;
|
|
82
|
+
hasDefault: false;
|
|
83
|
+
isPrimaryKey: false;
|
|
84
|
+
isAutoincrement: false;
|
|
85
|
+
hasRuntimeDefault: false;
|
|
86
|
+
enumValues: undefined;
|
|
87
|
+
baseColumn: never;
|
|
88
|
+
identity: undefined;
|
|
89
|
+
generated: undefined;
|
|
90
|
+
}, {}, {}>;
|
|
91
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
92
|
+
name: "created_at";
|
|
93
|
+
tableName: "memberships";
|
|
94
|
+
dataType: "date";
|
|
95
|
+
columnType: "PgTimestamp";
|
|
96
|
+
data: Date;
|
|
97
|
+
driverParam: string;
|
|
98
|
+
notNull: true;
|
|
99
|
+
hasDefault: true;
|
|
100
|
+
isPrimaryKey: false;
|
|
101
|
+
isAutoincrement: false;
|
|
102
|
+
hasRuntimeDefault: false;
|
|
103
|
+
enumValues: undefined;
|
|
104
|
+
baseColumn: never;
|
|
105
|
+
identity: undefined;
|
|
106
|
+
generated: undefined;
|
|
107
|
+
}, {}, {}>;
|
|
108
|
+
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
109
|
+
name: "updated_at";
|
|
110
|
+
tableName: "memberships";
|
|
111
|
+
dataType: "date";
|
|
112
|
+
columnType: "PgTimestamp";
|
|
113
|
+
data: Date;
|
|
114
|
+
driverParam: string;
|
|
115
|
+
notNull: true;
|
|
116
|
+
hasDefault: true;
|
|
117
|
+
isPrimaryKey: false;
|
|
118
|
+
isAutoincrement: false;
|
|
119
|
+
hasRuntimeDefault: false;
|
|
120
|
+
enumValues: undefined;
|
|
121
|
+
baseColumn: never;
|
|
122
|
+
identity: undefined;
|
|
123
|
+
generated: undefined;
|
|
124
|
+
}, {}, {}>;
|
|
125
|
+
};
|
|
126
|
+
dialect: "pg";
|
|
127
|
+
}>;
|
|
128
|
+
export type MembershipDb = typeof memberships.$inferSelect;
|
|
129
|
+
export type MembershipCreateDb = typeof memberships.$inferInsert;
|
|
130
|
+
export declare function toMembership(row: MembershipDb): Membership;
|
|
131
|
+
//# sourceMappingURL=memberships.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memberships.d.ts","sourceRoot":"","sources":["../../../src/db/schema/memberships.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,8BAA8B,CAAC;AAI7D,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBvB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,OAAO,WAAW,CAAC,YAAY,CAAC;AAC3D,MAAM,MAAM,kBAAkB,GAAG,OAAO,WAAW,CAAC,YAAY,CAAC;AAEjE,wBAAgB,YAAY,CAAC,GAAG,EAAE,YAAY,GAAG,UAAU,CAU1D"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { uuidv7PrimaryKey } from '@shipfox/node-drizzle';
|
|
2
|
+
import { index, text, timestamp, uniqueIndex, uuid } from 'drizzle-orm/pg-core';
|
|
3
|
+
import { pgTable } from './common.js';
|
|
4
|
+
import { workspaces } from './workspaces.js';
|
|
5
|
+
export const memberships = pgTable('memberships', {
|
|
6
|
+
id: uuidv7PrimaryKey(),
|
|
7
|
+
userId: uuid('user_id').notNull(),
|
|
8
|
+
userEmail: text('user_email').notNull(),
|
|
9
|
+
userName: text('user_name'),
|
|
10
|
+
workspaceId: uuid('workspace_id').notNull().references(()=>workspaces.id, {
|
|
11
|
+
onDelete: 'cascade'
|
|
12
|
+
}),
|
|
13
|
+
createdAt: timestamp('created_at', {
|
|
14
|
+
withTimezone: true
|
|
15
|
+
}).notNull().defaultNow(),
|
|
16
|
+
updatedAt: timestamp('updated_at', {
|
|
17
|
+
withTimezone: true
|
|
18
|
+
}).notNull().defaultNow()
|
|
19
|
+
}, (table)=>[
|
|
20
|
+
uniqueIndex('workspaces_memberships_user_workspace_unique').on(table.userId, table.workspaceId),
|
|
21
|
+
index('workspaces_memberships_workspace_id_idx').on(table.workspaceId)
|
|
22
|
+
]);
|
|
23
|
+
export function toMembership(row) {
|
|
24
|
+
return {
|
|
25
|
+
id: row.id,
|
|
26
|
+
userId: row.userId,
|
|
27
|
+
userEmail: row.userEmail,
|
|
28
|
+
userName: row.userName,
|
|
29
|
+
workspaceId: row.workspaceId,
|
|
30
|
+
createdAt: row.createdAt,
|
|
31
|
+
updatedAt: row.updatedAt
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=memberships.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/db/schema/memberships.ts"],"sourcesContent":["import {uuidv7PrimaryKey} from '@shipfox/node-drizzle';\nimport {index, text, timestamp, uniqueIndex, uuid} from 'drizzle-orm/pg-core';\nimport type {Membership} from '#core/entities/membership.js';\nimport {pgTable} from './common.js';\nimport {workspaces} from './workspaces.js';\n\nexport const memberships = pgTable(\n 'memberships',\n {\n id: uuidv7PrimaryKey(),\n userId: uuid('user_id').notNull(),\n userEmail: text('user_email').notNull(),\n userName: text('user_name'),\n workspaceId: uuid('workspace_id')\n .notNull()\n .references(() => workspaces.id, {onDelete: 'cascade'}),\n createdAt: timestamp('created_at', {withTimezone: true}).notNull().defaultNow(),\n updatedAt: timestamp('updated_at', {withTimezone: true}).notNull().defaultNow(),\n },\n (table) => [\n uniqueIndex('workspaces_memberships_user_workspace_unique').on(table.userId, table.workspaceId),\n index('workspaces_memberships_workspace_id_idx').on(table.workspaceId),\n ],\n);\n\nexport type MembershipDb = typeof memberships.$inferSelect;\nexport type MembershipCreateDb = typeof memberships.$inferInsert;\n\nexport function toMembership(row: MembershipDb): Membership {\n return {\n id: row.id,\n userId: row.userId,\n userEmail: row.userEmail,\n userName: row.userName,\n workspaceId: row.workspaceId,\n createdAt: row.createdAt,\n updatedAt: row.updatedAt,\n };\n}\n"],"names":["uuidv7PrimaryKey","index","text","timestamp","uniqueIndex","uuid","pgTable","workspaces","memberships","id","userId","notNull","userEmail","userName","workspaceId","references","onDelete","createdAt","withTimezone","defaultNow","updatedAt","table","on","toMembership","row"],"mappings":"AAAA,SAAQA,gBAAgB,QAAO,wBAAwB;AACvD,SAAQC,KAAK,EAAEC,IAAI,EAAEC,SAAS,EAAEC,WAAW,EAAEC,IAAI,QAAO,sBAAsB;AAE9E,SAAQC,OAAO,QAAO,cAAc;AACpC,SAAQC,UAAU,QAAO,kBAAkB;AAE3C,OAAO,MAAMC,cAAcF,QACzB,eACA;IACEG,IAAIT;IACJU,QAAQL,KAAK,WAAWM,OAAO;IAC/BC,WAAWV,KAAK,cAAcS,OAAO;IACrCE,UAAUX,KAAK;IACfY,aAAaT,KAAK,gBACfM,OAAO,GACPI,UAAU,CAAC,IAAMR,WAAWE,EAAE,EAAE;QAACO,UAAU;IAAS;IACvDC,WAAWd,UAAU,cAAc;QAACe,cAAc;IAAI,GAAGP,OAAO,GAAGQ,UAAU;IAC7EC,WAAWjB,UAAU,cAAc;QAACe,cAAc;IAAI,GAAGP,OAAO,GAAGQ,UAAU;AAC/E,GACA,CAACE,QAAU;QACTjB,YAAY,gDAAgDkB,EAAE,CAACD,MAAMX,MAAM,EAAEW,MAAMP,WAAW;QAC9Fb,MAAM,2CAA2CqB,EAAE,CAACD,MAAMP,WAAW;KACtE,EACD;AAKF,OAAO,SAASS,aAAaC,GAAiB;IAC5C,OAAO;QACLf,IAAIe,IAAIf,EAAE;QACVC,QAAQc,IAAId,MAAM;QAClBE,WAAWY,IAAIZ,SAAS;QACxBC,UAAUW,IAAIX,QAAQ;QACtBC,aAAaU,IAAIV,WAAW;QAC5BG,WAAWO,IAAIP,SAAS;QACxBG,WAAWI,IAAIJ,SAAS;IAC1B;AACF"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
export declare const workspacesOutbox: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
2
|
+
name: "outbox";
|
|
3
|
+
schema: undefined;
|
|
4
|
+
columns: {
|
|
5
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
6
|
+
name: "id";
|
|
7
|
+
tableName: "outbox";
|
|
8
|
+
dataType: "string";
|
|
9
|
+
columnType: "PgUUID";
|
|
10
|
+
data: string;
|
|
11
|
+
driverParam: string;
|
|
12
|
+
notNull: true;
|
|
13
|
+
hasDefault: true;
|
|
14
|
+
isPrimaryKey: true;
|
|
15
|
+
isAutoincrement: false;
|
|
16
|
+
hasRuntimeDefault: false;
|
|
17
|
+
enumValues: undefined;
|
|
18
|
+
baseColumn: never;
|
|
19
|
+
identity: undefined;
|
|
20
|
+
generated: undefined;
|
|
21
|
+
}, {}, {}>;
|
|
22
|
+
eventType: import("drizzle-orm/pg-core").PgColumn<{
|
|
23
|
+
name: "event_type";
|
|
24
|
+
tableName: "outbox";
|
|
25
|
+
dataType: "string";
|
|
26
|
+
columnType: "PgText";
|
|
27
|
+
data: string;
|
|
28
|
+
driverParam: string;
|
|
29
|
+
notNull: true;
|
|
30
|
+
hasDefault: false;
|
|
31
|
+
isPrimaryKey: false;
|
|
32
|
+
isAutoincrement: false;
|
|
33
|
+
hasRuntimeDefault: false;
|
|
34
|
+
enumValues: [string, ...string[]];
|
|
35
|
+
baseColumn: never;
|
|
36
|
+
identity: undefined;
|
|
37
|
+
generated: undefined;
|
|
38
|
+
}, {}, {}>;
|
|
39
|
+
orderingKey: import("drizzle-orm/pg-core").PgColumn<{
|
|
40
|
+
name: "ordering_key";
|
|
41
|
+
tableName: "outbox";
|
|
42
|
+
dataType: "string";
|
|
43
|
+
columnType: "PgText";
|
|
44
|
+
data: string;
|
|
45
|
+
driverParam: string;
|
|
46
|
+
notNull: false;
|
|
47
|
+
hasDefault: false;
|
|
48
|
+
isPrimaryKey: false;
|
|
49
|
+
isAutoincrement: false;
|
|
50
|
+
hasRuntimeDefault: false;
|
|
51
|
+
enumValues: [string, ...string[]];
|
|
52
|
+
baseColumn: never;
|
|
53
|
+
identity: undefined;
|
|
54
|
+
generated: undefined;
|
|
55
|
+
}, {}, {}>;
|
|
56
|
+
payload: import("drizzle-orm/pg-core").PgColumn<{
|
|
57
|
+
name: "payload";
|
|
58
|
+
tableName: "outbox";
|
|
59
|
+
dataType: "json";
|
|
60
|
+
columnType: "PgJsonb";
|
|
61
|
+
data: unknown;
|
|
62
|
+
driverParam: unknown;
|
|
63
|
+
notNull: true;
|
|
64
|
+
hasDefault: false;
|
|
65
|
+
isPrimaryKey: false;
|
|
66
|
+
isAutoincrement: false;
|
|
67
|
+
hasRuntimeDefault: false;
|
|
68
|
+
enumValues: undefined;
|
|
69
|
+
baseColumn: never;
|
|
70
|
+
identity: undefined;
|
|
71
|
+
generated: undefined;
|
|
72
|
+
}, {}, {}>;
|
|
73
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
74
|
+
name: "created_at";
|
|
75
|
+
tableName: "outbox";
|
|
76
|
+
dataType: "date";
|
|
77
|
+
columnType: "PgTimestamp";
|
|
78
|
+
data: Date;
|
|
79
|
+
driverParam: string;
|
|
80
|
+
notNull: true;
|
|
81
|
+
hasDefault: true;
|
|
82
|
+
isPrimaryKey: false;
|
|
83
|
+
isAutoincrement: false;
|
|
84
|
+
hasRuntimeDefault: false;
|
|
85
|
+
enumValues: undefined;
|
|
86
|
+
baseColumn: never;
|
|
87
|
+
identity: undefined;
|
|
88
|
+
generated: undefined;
|
|
89
|
+
}, {}, {}>;
|
|
90
|
+
dispatchedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
91
|
+
name: "dispatched_at";
|
|
92
|
+
tableName: "outbox";
|
|
93
|
+
dataType: "date";
|
|
94
|
+
columnType: "PgTimestamp";
|
|
95
|
+
data: Date;
|
|
96
|
+
driverParam: string;
|
|
97
|
+
notNull: false;
|
|
98
|
+
hasDefault: false;
|
|
99
|
+
isPrimaryKey: false;
|
|
100
|
+
isAutoincrement: false;
|
|
101
|
+
hasRuntimeDefault: false;
|
|
102
|
+
enumValues: undefined;
|
|
103
|
+
baseColumn: never;
|
|
104
|
+
identity: undefined;
|
|
105
|
+
generated: undefined;
|
|
106
|
+
}, {}, {}>;
|
|
107
|
+
dispatchAttempts: import("drizzle-orm/pg-core").PgColumn<{
|
|
108
|
+
name: "dispatch_attempts";
|
|
109
|
+
tableName: "outbox";
|
|
110
|
+
dataType: "number";
|
|
111
|
+
columnType: "PgInteger";
|
|
112
|
+
data: number;
|
|
113
|
+
driverParam: string | number;
|
|
114
|
+
notNull: true;
|
|
115
|
+
hasDefault: true;
|
|
116
|
+
isPrimaryKey: false;
|
|
117
|
+
isAutoincrement: false;
|
|
118
|
+
hasRuntimeDefault: false;
|
|
119
|
+
enumValues: undefined;
|
|
120
|
+
baseColumn: never;
|
|
121
|
+
identity: undefined;
|
|
122
|
+
generated: undefined;
|
|
123
|
+
}, {}, {}>;
|
|
124
|
+
nextDispatchAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
125
|
+
name: "next_dispatch_at";
|
|
126
|
+
tableName: "outbox";
|
|
127
|
+
dataType: "date";
|
|
128
|
+
columnType: "PgTimestamp";
|
|
129
|
+
data: Date;
|
|
130
|
+
driverParam: string;
|
|
131
|
+
notNull: true;
|
|
132
|
+
hasDefault: true;
|
|
133
|
+
isPrimaryKey: false;
|
|
134
|
+
isAutoincrement: false;
|
|
135
|
+
hasRuntimeDefault: false;
|
|
136
|
+
enumValues: undefined;
|
|
137
|
+
baseColumn: never;
|
|
138
|
+
identity: undefined;
|
|
139
|
+
generated: undefined;
|
|
140
|
+
}, {}, {}>;
|
|
141
|
+
lastDispatchError: import("drizzle-orm/pg-core").PgColumn<{
|
|
142
|
+
name: "last_dispatch_error";
|
|
143
|
+
tableName: "outbox";
|
|
144
|
+
dataType: "json";
|
|
145
|
+
columnType: "PgJsonb";
|
|
146
|
+
data: unknown;
|
|
147
|
+
driverParam: unknown;
|
|
148
|
+
notNull: false;
|
|
149
|
+
hasDefault: false;
|
|
150
|
+
isPrimaryKey: false;
|
|
151
|
+
isAutoincrement: false;
|
|
152
|
+
hasRuntimeDefault: false;
|
|
153
|
+
enumValues: undefined;
|
|
154
|
+
baseColumn: never;
|
|
155
|
+
identity: undefined;
|
|
156
|
+
generated: undefined;
|
|
157
|
+
}, {}, {}>;
|
|
158
|
+
lastDispatchFailedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
159
|
+
name: "last_dispatch_failed_at";
|
|
160
|
+
tableName: "outbox";
|
|
161
|
+
dataType: "date";
|
|
162
|
+
columnType: "PgTimestamp";
|
|
163
|
+
data: Date;
|
|
164
|
+
driverParam: string;
|
|
165
|
+
notNull: false;
|
|
166
|
+
hasDefault: false;
|
|
167
|
+
isPrimaryKey: false;
|
|
168
|
+
isAutoincrement: false;
|
|
169
|
+
hasRuntimeDefault: false;
|
|
170
|
+
enumValues: undefined;
|
|
171
|
+
baseColumn: never;
|
|
172
|
+
identity: undefined;
|
|
173
|
+
generated: undefined;
|
|
174
|
+
}, {}, {}>;
|
|
175
|
+
deadLetteredAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
176
|
+
name: "dead_lettered_at";
|
|
177
|
+
tableName: "outbox";
|
|
178
|
+
dataType: "date";
|
|
179
|
+
columnType: "PgTimestamp";
|
|
180
|
+
data: Date;
|
|
181
|
+
driverParam: string;
|
|
182
|
+
notNull: false;
|
|
183
|
+
hasDefault: false;
|
|
184
|
+
isPrimaryKey: false;
|
|
185
|
+
isAutoincrement: false;
|
|
186
|
+
hasRuntimeDefault: false;
|
|
187
|
+
enumValues: undefined;
|
|
188
|
+
baseColumn: never;
|
|
189
|
+
identity: undefined;
|
|
190
|
+
generated: undefined;
|
|
191
|
+
}, {}, {}>;
|
|
192
|
+
};
|
|
193
|
+
dialect: "pg";
|
|
194
|
+
}>;
|
|
195
|
+
//# sourceMappingURL=outbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outbox.d.ts","sourceRoot":"","sources":["../../../src/db/schema/outbox.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA6B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/db/schema/outbox.ts"],"sourcesContent":["import {createOutboxTable} from '@shipfox/node-outbox';\nimport {pgTable} from './common.js';\n\nexport const workspacesOutbox = createOutboxTable(pgTable);\n"],"names":["createOutboxTable","pgTable","workspacesOutbox"],"mappings":"AAAA,SAAQA,iBAAiB,QAAO,uBAAuB;AACvD,SAAQC,OAAO,QAAO,cAAc;AAEpC,OAAO,MAAMC,mBAAmBF,kBAAkBC,SAAS"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { Workspace } from '#core/entities/workspace.js';
|
|
2
|
+
export declare const workspaceStatusEnum: import("drizzle-orm/pg-core").PgEnum<["active", "suspended", "deleted"]>;
|
|
3
|
+
export declare const workspaces: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
4
|
+
name: "workspaces";
|
|
5
|
+
schema: undefined;
|
|
6
|
+
columns: {
|
|
7
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
8
|
+
name: "id";
|
|
9
|
+
tableName: "workspaces";
|
|
10
|
+
dataType: "string";
|
|
11
|
+
columnType: "PgUUID";
|
|
12
|
+
data: string;
|
|
13
|
+
driverParam: string;
|
|
14
|
+
notNull: true;
|
|
15
|
+
hasDefault: true;
|
|
16
|
+
isPrimaryKey: true;
|
|
17
|
+
isAutoincrement: false;
|
|
18
|
+
hasRuntimeDefault: false;
|
|
19
|
+
enumValues: undefined;
|
|
20
|
+
baseColumn: never;
|
|
21
|
+
identity: undefined;
|
|
22
|
+
generated: undefined;
|
|
23
|
+
}, {}, {}>;
|
|
24
|
+
name: import("drizzle-orm/pg-core").PgColumn<{
|
|
25
|
+
name: "name";
|
|
26
|
+
tableName: "workspaces";
|
|
27
|
+
dataType: "string";
|
|
28
|
+
columnType: "PgText";
|
|
29
|
+
data: string;
|
|
30
|
+
driverParam: string;
|
|
31
|
+
notNull: true;
|
|
32
|
+
hasDefault: false;
|
|
33
|
+
isPrimaryKey: false;
|
|
34
|
+
isAutoincrement: false;
|
|
35
|
+
hasRuntimeDefault: false;
|
|
36
|
+
enumValues: [string, ...string[]];
|
|
37
|
+
baseColumn: never;
|
|
38
|
+
identity: undefined;
|
|
39
|
+
generated: undefined;
|
|
40
|
+
}, {}, {}>;
|
|
41
|
+
status: import("drizzle-orm/pg-core").PgColumn<{
|
|
42
|
+
name: "status";
|
|
43
|
+
tableName: "workspaces";
|
|
44
|
+
dataType: "string";
|
|
45
|
+
columnType: "PgEnumColumn";
|
|
46
|
+
data: "active" | "suspended" | "deleted";
|
|
47
|
+
driverParam: string;
|
|
48
|
+
notNull: true;
|
|
49
|
+
hasDefault: true;
|
|
50
|
+
isPrimaryKey: false;
|
|
51
|
+
isAutoincrement: false;
|
|
52
|
+
hasRuntimeDefault: false;
|
|
53
|
+
enumValues: ["active", "suspended", "deleted"];
|
|
54
|
+
baseColumn: never;
|
|
55
|
+
identity: undefined;
|
|
56
|
+
generated: undefined;
|
|
57
|
+
}, {}, {}>;
|
|
58
|
+
settings: import("drizzle-orm/pg-core").PgColumn<{
|
|
59
|
+
name: "settings";
|
|
60
|
+
tableName: "workspaces";
|
|
61
|
+
dataType: "json";
|
|
62
|
+
columnType: "PgJsonb";
|
|
63
|
+
data: unknown;
|
|
64
|
+
driverParam: unknown;
|
|
65
|
+
notNull: true;
|
|
66
|
+
hasDefault: true;
|
|
67
|
+
isPrimaryKey: false;
|
|
68
|
+
isAutoincrement: false;
|
|
69
|
+
hasRuntimeDefault: false;
|
|
70
|
+
enumValues: undefined;
|
|
71
|
+
baseColumn: never;
|
|
72
|
+
identity: undefined;
|
|
73
|
+
generated: undefined;
|
|
74
|
+
}, {}, {}>;
|
|
75
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
76
|
+
name: "created_at";
|
|
77
|
+
tableName: "workspaces";
|
|
78
|
+
dataType: "date";
|
|
79
|
+
columnType: "PgTimestamp";
|
|
80
|
+
data: Date;
|
|
81
|
+
driverParam: string;
|
|
82
|
+
notNull: true;
|
|
83
|
+
hasDefault: true;
|
|
84
|
+
isPrimaryKey: false;
|
|
85
|
+
isAutoincrement: false;
|
|
86
|
+
hasRuntimeDefault: false;
|
|
87
|
+
enumValues: undefined;
|
|
88
|
+
baseColumn: never;
|
|
89
|
+
identity: undefined;
|
|
90
|
+
generated: undefined;
|
|
91
|
+
}, {}, {}>;
|
|
92
|
+
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
93
|
+
name: "updated_at";
|
|
94
|
+
tableName: "workspaces";
|
|
95
|
+
dataType: "date";
|
|
96
|
+
columnType: "PgTimestamp";
|
|
97
|
+
data: Date;
|
|
98
|
+
driverParam: string;
|
|
99
|
+
notNull: true;
|
|
100
|
+
hasDefault: true;
|
|
101
|
+
isPrimaryKey: false;
|
|
102
|
+
isAutoincrement: false;
|
|
103
|
+
hasRuntimeDefault: false;
|
|
104
|
+
enumValues: undefined;
|
|
105
|
+
baseColumn: never;
|
|
106
|
+
identity: undefined;
|
|
107
|
+
generated: undefined;
|
|
108
|
+
}, {}, {}>;
|
|
109
|
+
};
|
|
110
|
+
dialect: "pg";
|
|
111
|
+
}>;
|
|
112
|
+
export type WorkspaceDb = typeof workspaces.$inferSelect;
|
|
113
|
+
export type WorkspaceCreateDb = typeof workspaces.$inferInsert;
|
|
114
|
+
export declare function toWorkspace(row: WorkspaceDb): Workspace;
|
|
115
|
+
//# sourceMappingURL=workspaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspaces.d.ts","sourceRoot":"","sources":["../../../src/db/schema/workspaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,SAAS,EAAkB,MAAM,6BAA6B,CAAC;AAG5E,eAAO,MAAM,mBAAmB,0EAI9B,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOrB,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,OAAO,UAAU,CAAC,YAAY,CAAC;AACzD,MAAM,MAAM,iBAAiB,GAAG,OAAO,UAAU,CAAC,YAAY,CAAC;AAE/D,wBAAgB,WAAW,CAAC,GAAG,EAAE,WAAW,GAAG,SAAS,CASvD"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { uuidv7PrimaryKey } from '@shipfox/node-drizzle';
|
|
2
|
+
import { jsonb, pgEnum, text, timestamp } from 'drizzle-orm/pg-core';
|
|
3
|
+
import { pgTable } from './common.js';
|
|
4
|
+
export const workspaceStatusEnum = pgEnum('workspaces_workspace_status', [
|
|
5
|
+
'active',
|
|
6
|
+
'suspended',
|
|
7
|
+
'deleted'
|
|
8
|
+
]);
|
|
9
|
+
export const workspaces = pgTable('workspaces', {
|
|
10
|
+
id: uuidv7PrimaryKey(),
|
|
11
|
+
name: text('name').notNull(),
|
|
12
|
+
status: workspaceStatusEnum('status').notNull().default('active'),
|
|
13
|
+
settings: jsonb('settings').notNull().default({}),
|
|
14
|
+
createdAt: timestamp('created_at', {
|
|
15
|
+
withTimezone: true
|
|
16
|
+
}).notNull().defaultNow(),
|
|
17
|
+
updatedAt: timestamp('updated_at', {
|
|
18
|
+
withTimezone: true
|
|
19
|
+
}).notNull().defaultNow()
|
|
20
|
+
});
|
|
21
|
+
export function toWorkspace(row) {
|
|
22
|
+
return {
|
|
23
|
+
id: row.id,
|
|
24
|
+
name: row.name,
|
|
25
|
+
status: row.status,
|
|
26
|
+
settings: row.settings,
|
|
27
|
+
createdAt: row.createdAt,
|
|
28
|
+
updatedAt: row.updatedAt
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=workspaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/db/schema/workspaces.ts"],"sourcesContent":["import {uuidv7PrimaryKey} from '@shipfox/node-drizzle';\nimport {jsonb, pgEnum, text, timestamp} from 'drizzle-orm/pg-core';\nimport type {Workspace, WorkspaceStatus} from '#core/entities/workspace.js';\nimport {pgTable} from './common.js';\n\nexport const workspaceStatusEnum = pgEnum('workspaces_workspace_status', [\n 'active',\n 'suspended',\n 'deleted',\n]);\n\nexport const workspaces = pgTable('workspaces', {\n id: uuidv7PrimaryKey(),\n name: text('name').notNull(),\n status: workspaceStatusEnum('status').notNull().default('active'),\n settings: jsonb('settings').notNull().default({}),\n createdAt: timestamp('created_at', {withTimezone: true}).notNull().defaultNow(),\n updatedAt: timestamp('updated_at', {withTimezone: true}).notNull().defaultNow(),\n});\n\nexport type WorkspaceDb = typeof workspaces.$inferSelect;\nexport type WorkspaceCreateDb = typeof workspaces.$inferInsert;\n\nexport function toWorkspace(row: WorkspaceDb): Workspace {\n return {\n id: row.id,\n name: row.name,\n status: row.status as WorkspaceStatus,\n settings: row.settings as Record<string, unknown>,\n createdAt: row.createdAt,\n updatedAt: row.updatedAt,\n };\n}\n"],"names":["uuidv7PrimaryKey","jsonb","pgEnum","text","timestamp","pgTable","workspaceStatusEnum","workspaces","id","name","notNull","status","default","settings","createdAt","withTimezone","defaultNow","updatedAt","toWorkspace","row"],"mappings":"AAAA,SAAQA,gBAAgB,QAAO,wBAAwB;AACvD,SAAQC,KAAK,EAAEC,MAAM,EAAEC,IAAI,EAAEC,SAAS,QAAO,sBAAsB;AAEnE,SAAQC,OAAO,QAAO,cAAc;AAEpC,OAAO,MAAMC,sBAAsBJ,OAAO,+BAA+B;IACvE;IACA;IACA;CACD,EAAE;AAEH,OAAO,MAAMK,aAAaF,QAAQ,cAAc;IAC9CG,IAAIR;IACJS,MAAMN,KAAK,QAAQO,OAAO;IAC1BC,QAAQL,oBAAoB,UAAUI,OAAO,GAAGE,OAAO,CAAC;IACxDC,UAAUZ,MAAM,YAAYS,OAAO,GAAGE,OAAO,CAAC,CAAC;IAC/CE,WAAWV,UAAU,cAAc;QAACW,cAAc;IAAI,GAAGL,OAAO,GAAGM,UAAU;IAC7EC,WAAWb,UAAU,cAAc;QAACW,cAAc;IAAI,GAAGL,OAAO,GAAGM,UAAU;AAC/E,GAAG;AAKH,OAAO,SAASE,YAAYC,GAAgB;IAC1C,OAAO;QACLX,IAAIW,IAAIX,EAAE;QACVC,MAAMU,IAAIV,IAAI;QACdE,QAAQQ,IAAIR,MAAM;QAClBE,UAAUM,IAAIN,QAAQ;QACtBC,WAAWK,IAAIL,SAAS;QACxBG,WAAWE,IAAIF,SAAS;IAC1B;AACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Workspace, WorkspaceStatus } from '#core/entities/workspace.js';
|
|
2
|
+
export interface CreateWorkspaceParams {
|
|
3
|
+
name: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function createWorkspace(params: CreateWorkspaceParams): Promise<Workspace>;
|
|
6
|
+
export interface UpdateWorkspaceParams {
|
|
7
|
+
id: string;
|
|
8
|
+
name?: string | undefined;
|
|
9
|
+
status?: WorkspaceStatus | undefined;
|
|
10
|
+
settings?: Record<string, unknown> | undefined;
|
|
11
|
+
}
|
|
12
|
+
export declare function updateWorkspace(params: UpdateWorkspaceParams): Promise<Workspace | undefined>;
|
|
13
|
+
export declare function getWorkspaceById(id: string): Promise<Workspace | undefined>;
|
|
14
|
+
export interface WorkspaceServiceMetrics {
|
|
15
|
+
activeWorkspaces: number;
|
|
16
|
+
memberships: number;
|
|
17
|
+
openInvitations: number;
|
|
18
|
+
}
|
|
19
|
+
export declare function getWorkspaceServiceMetrics(): Promise<WorkspaceServiceMetrics>;
|
|
20
|
+
//# sourceMappingURL=workspaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspaces.d.ts","sourceRoot":"","sources":["../../src/db/workspaces.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,SAAS,EAAE,eAAe,EAAC,MAAM,6BAA6B,CAAC;AAO5E,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAsB,eAAe,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,SAAS,CAAC,CAYvF;AAED,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;CAChD;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAehC;AAED,wBAAsB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAKjF;AAED,MAAM,WAAW,uBAAuB;IACtC,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,wBAAsB,0BAA0B,IAAI,OAAO,CAAC,uBAAuB,CAAC,CAenF"}
|