@m5kdev/backend 0.3.4 → 0.4.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/dist/src/modules/ai/ai.prompt.d.ts +2 -3
- package/dist/src/modules/ai/ai.service.d.ts +10 -11
- package/dist/src/modules/auth/auth.repository.d.ts +5 -0
- package/dist/src/modules/auth/auth.repository.js +95 -0
- package/dist/src/modules/auth/auth.service.d.ts +6 -1
- package/dist/src/modules/auth/auth.service.js +45 -0
- package/dist/src/modules/auth/auth.trpc.d.ts +31 -11
- package/dist/src/modules/auth/auth.trpc.js +20 -0
- package/dist/src/types.d.ts +31 -11
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type { AiModel } from "@m5kdev/commons/modules/ai/ai.constants";
|
|
2
1
|
export declare class Prompt<C extends Record<string, string>> {
|
|
3
2
|
prompt: string;
|
|
4
3
|
name?: string;
|
|
5
4
|
type: "text" | "chat";
|
|
6
5
|
config?: {
|
|
7
|
-
model?:
|
|
6
|
+
model?: string;
|
|
8
7
|
temperature?: number;
|
|
9
8
|
supported_languages?: string[];
|
|
10
9
|
};
|
|
@@ -15,7 +14,7 @@ export declare class Prompt<C extends Record<string, string>> {
|
|
|
15
14
|
name?: string;
|
|
16
15
|
type?: "text" | "chat";
|
|
17
16
|
config?: {
|
|
18
|
-
model?:
|
|
17
|
+
model?: string;
|
|
19
18
|
temperature?: number;
|
|
20
19
|
supported_languages?: string[];
|
|
21
20
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type AiEmbeddingModel, type AiModel } from "@m5kdev/commons/modules/ai/ai.constants";
|
|
2
1
|
import { arrayToPseudoXML } from "@m5kdev/commons/modules/ai/ai.utils";
|
|
3
2
|
import type { Mastra } from "@mastra/core";
|
|
4
3
|
import type { FullOutput, MastraModelOutput } from "@mastra/core/stream";
|
|
@@ -7,12 +6,12 @@ import type { OpenRouterProvider } from "@openrouter/ai-sdk-provider";
|
|
|
7
6
|
import { generateObject, generateText } from "ai";
|
|
8
7
|
import type Replicate from "replicate";
|
|
9
8
|
import type { ZodType, z } from "zod";
|
|
10
|
-
import type { AiUsageRepository, AiUsageRow } from "./ai.repository";
|
|
11
|
-
import type { IdeogramV3GenerateInput, IdeogramV3GenerateOutput } from "./ideogram/ideogram.dto";
|
|
12
|
-
import type { IdeogramService } from "./ideogram/ideogram.service";
|
|
13
9
|
import type { User } from "../auth/auth.lib";
|
|
14
10
|
import type { ServerResultAsync } from "../base/base.dto";
|
|
15
11
|
import { BaseService } from "../base/base.service";
|
|
12
|
+
import type { AiUsageRepository, AiUsageRow } from "./ai.repository";
|
|
13
|
+
import type { IdeogramV3GenerateInput, IdeogramV3GenerateOutput } from "./ideogram/ideogram.dto";
|
|
14
|
+
import type { IdeogramService } from "./ideogram/ideogram.service";
|
|
16
15
|
type MastraAgent = ReturnType<Mastra["getAgent"]>;
|
|
17
16
|
type MastraAgentGenerateOptions = Parameters<MastraAgent["generate"]>[1];
|
|
18
17
|
type MessageListInput = {
|
|
@@ -40,8 +39,8 @@ export declare class AIService<MastraInstance extends Mastra> extends BaseServic
|
|
|
40
39
|
replicate?: Replicate;
|
|
41
40
|
});
|
|
42
41
|
getMastra(): MastraInstance;
|
|
43
|
-
prepareModel(model:
|
|
44
|
-
prepareEmbeddingModel(model:
|
|
42
|
+
prepareModel(model: string): any;
|
|
43
|
+
prepareEmbeddingModel(model: string): any;
|
|
45
44
|
agentUse(agent: string, options: MastraAgentGenerateOptions & {
|
|
46
45
|
prompt?: string;
|
|
47
46
|
messages?: MessageListInput;
|
|
@@ -81,26 +80,26 @@ export declare class AIService<MastraInstance extends Mastra> extends BaseServic
|
|
|
81
80
|
}): ServerResultAsync<FullOutput<any> & {
|
|
82
81
|
object: z.infer<T>;
|
|
83
82
|
}>;
|
|
84
|
-
embedDocument(value: string, options?: Parameters<ReturnType<typeof MDocument.fromText>["chunk"]>[0], type?: "text" | "markdown" | "html" | "json", model?:
|
|
83
|
+
embedDocument(value: string, options?: Parameters<ReturnType<typeof MDocument.fromText>["chunk"]>[0], type?: "text" | "markdown" | "html" | "json", model?: string): ServerResultAsync<{
|
|
85
84
|
embeddings: number[][];
|
|
86
85
|
chunks: {
|
|
87
86
|
text: string;
|
|
88
87
|
}[];
|
|
89
88
|
}>;
|
|
90
|
-
embed(text: string, model?:
|
|
89
|
+
embed(text: string, model?: string): ServerResultAsync<{
|
|
91
90
|
embedding: number[];
|
|
92
91
|
}>;
|
|
93
92
|
embedMany(chunks: {
|
|
94
93
|
text: string;
|
|
95
|
-
}[], model?:
|
|
94
|
+
}[], model?: string): ServerResultAsync<{
|
|
96
95
|
embeddings: number[][];
|
|
97
96
|
}>;
|
|
98
97
|
generateText(params: Omit<Parameters<typeof generateText>[0], "model"> & {
|
|
99
|
-
model:
|
|
98
|
+
model: string;
|
|
100
99
|
removeMDash?: boolean;
|
|
101
100
|
}): ServerResultAsync<string>;
|
|
102
101
|
generateObject<T extends ZodType>(params: Omit<Parameters<typeof generateObject<T>>[0], "model" | "schema"> & {
|
|
103
|
-
model:
|
|
102
|
+
model: string;
|
|
104
103
|
schema: T;
|
|
105
104
|
}): ServerResultAsync<z.infer<T>>;
|
|
106
105
|
generateReplicate(model: Parameters<Replicate["run"]>[0], options: Parameters<Replicate["run"]>[1]): ServerResultAsync<object>;
|
|
@@ -2344,15 +2344,20 @@ type Schema = typeof schema;
|
|
|
2344
2344
|
type Orm = LibSQLDatabase<Schema>;
|
|
2345
2345
|
type UserRow = typeof auth.users.$inferSelect;
|
|
2346
2346
|
export declare class AuthRepository extends BaseRepository<Orm, Schema, Record<string, never>> {
|
|
2347
|
+
private getOrganizationMetadataForMember;
|
|
2347
2348
|
getUserWaitlistCount(userId: string, tx?: Orm): ServerResultAsync<number>;
|
|
2348
2349
|
getOnboarding(userId: string, tx?: Orm): ServerResultAsync<number>;
|
|
2349
2350
|
setOnboarding(userId: string, onboarding: number, tx?: Orm): ServerResultAsync<number>;
|
|
2350
2351
|
getPreferences(userId: string, tx?: Orm): ServerResultAsync<Record<string, unknown>>;
|
|
2351
2352
|
setPreferences(userId: string, preferences: Record<string, unknown>, tx?: Orm): ServerResultAsync<Record<string, unknown>>;
|
|
2353
|
+
getOrganizationPreferences(userId: string, organizationId: string, tx?: Orm): ServerResultAsync<Record<string, unknown>>;
|
|
2354
|
+
setOrganizationPreferences(userId: string, organizationId: string, preferences: Record<string, unknown>, tx?: Orm): ServerResultAsync<Record<string, unknown>>;
|
|
2352
2355
|
getMetadata(userId: string, tx?: Orm): ServerResultAsync<Record<string, unknown>>;
|
|
2353
2356
|
setMetadata(userId: string, metadata: Record<string, unknown>, tx?: Orm): ServerResultAsync<Record<string, unknown>>;
|
|
2354
2357
|
getFlags(userId: string, tx?: Orm): ServerResultAsync<string[]>;
|
|
2358
|
+
getOrganizationFlags(userId: string, organizationId: string, tx?: Orm): ServerResultAsync<string[]>;
|
|
2355
2359
|
setFlags(userId: string, flags: string[], tx?: Orm): ServerResultAsync<string[]>;
|
|
2360
|
+
setOrganizationFlags(userId: string, organizationId: string, flags: string[], tx?: Orm): ServerResultAsync<string[]>;
|
|
2356
2361
|
listAdminWaitlist(tx?: Orm): ServerResultAsync<WaitlistOutput[]>;
|
|
2357
2362
|
listWaitlist(userId: string, tx?: Orm): ServerResultAsync<Waitlist[]>;
|
|
2358
2363
|
addToWaitlist(email: string, tx?: Orm): ServerResultAsync<WaitlistOutput>;
|
|
@@ -8,7 +8,50 @@ const uuid_1 = require("uuid");
|
|
|
8
8
|
const auth = tslib_1.__importStar(require("./auth.db"));
|
|
9
9
|
const base_repository_1 = require("../base/base.repository");
|
|
10
10
|
const schema = { ...auth };
|
|
11
|
+
function parseOrganizationMetadata(metadata) {
|
|
12
|
+
if (!metadata)
|
|
13
|
+
return {};
|
|
14
|
+
if (typeof metadata === "string") {
|
|
15
|
+
try {
|
|
16
|
+
const parsed = JSON.parse(metadata);
|
|
17
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
18
|
+
return parsed;
|
|
19
|
+
}
|
|
20
|
+
return {};
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return {};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (typeof metadata === "object" && !Array.isArray(metadata)) {
|
|
27
|
+
return metadata;
|
|
28
|
+
}
|
|
29
|
+
return {};
|
|
30
|
+
}
|
|
31
|
+
function normalizeOrganizationPreferences(value) {
|
|
32
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
33
|
+
return value;
|
|
34
|
+
}
|
|
35
|
+
return {};
|
|
36
|
+
}
|
|
37
|
+
function normalizeOrganizationFlags(value) {
|
|
38
|
+
if (!Array.isArray(value))
|
|
39
|
+
return [];
|
|
40
|
+
return value.filter((item) => typeof item === "string");
|
|
41
|
+
}
|
|
11
42
|
class AuthRepository extends base_repository_1.BaseRepository {
|
|
43
|
+
async getOrganizationMetadataForMember(userId, organizationId, tx) {
|
|
44
|
+
const db = tx ?? this.orm;
|
|
45
|
+
const [organization] = await db
|
|
46
|
+
.select({ metadata: this.schema.organizations.metadata })
|
|
47
|
+
.from(this.schema.organizations)
|
|
48
|
+
.innerJoin(this.schema.members, (0, drizzle_orm_1.eq)(this.schema.members.organizationId, this.schema.organizations.id))
|
|
49
|
+
.where((0, drizzle_orm_1.and)((0, drizzle_orm_1.eq)(this.schema.organizations.id, organizationId), (0, drizzle_orm_1.eq)(this.schema.members.userId, userId)))
|
|
50
|
+
.limit(1);
|
|
51
|
+
if (!organization)
|
|
52
|
+
return null;
|
|
53
|
+
return parseOrganizationMetadata(organization.metadata);
|
|
54
|
+
}
|
|
12
55
|
async getUserWaitlistCount(userId, tx) {
|
|
13
56
|
return this.throwableAsync(async () => {
|
|
14
57
|
const db = tx ?? this.orm;
|
|
@@ -68,6 +111,32 @@ class AuthRepository extends base_repository_1.BaseRepository {
|
|
|
68
111
|
return (0, neverthrow_1.ok)(preferences);
|
|
69
112
|
});
|
|
70
113
|
}
|
|
114
|
+
async getOrganizationPreferences(userId, organizationId, tx) {
|
|
115
|
+
return this.throwableAsync(async () => {
|
|
116
|
+
const metadata = await this.getOrganizationMetadataForMember(userId, organizationId, tx);
|
|
117
|
+
if (!metadata)
|
|
118
|
+
return this.error("FORBIDDEN");
|
|
119
|
+
return (0, neverthrow_1.ok)(normalizeOrganizationPreferences(metadata.preferences));
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
async setOrganizationPreferences(userId, organizationId, preferences, tx) {
|
|
123
|
+
return this.throwableAsync(async () => {
|
|
124
|
+
const db = tx ?? this.orm;
|
|
125
|
+
const metadata = await this.getOrganizationMetadataForMember(userId, organizationId, tx);
|
|
126
|
+
if (!metadata)
|
|
127
|
+
return this.error("FORBIDDEN");
|
|
128
|
+
await db
|
|
129
|
+
.update(this.schema.organizations)
|
|
130
|
+
.set({
|
|
131
|
+
metadata: JSON.stringify({
|
|
132
|
+
...metadata,
|
|
133
|
+
preferences,
|
|
134
|
+
}),
|
|
135
|
+
})
|
|
136
|
+
.where((0, drizzle_orm_1.eq)(this.schema.organizations.id, organizationId));
|
|
137
|
+
return (0, neverthrow_1.ok)(preferences);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
71
140
|
async getMetadata(userId, tx) {
|
|
72
141
|
return this.throwableAsync(async () => {
|
|
73
142
|
const db = tx ?? this.orm;
|
|
@@ -117,6 +186,14 @@ class AuthRepository extends base_repository_1.BaseRepository {
|
|
|
117
186
|
return (0, neverthrow_1.ok)(json);
|
|
118
187
|
});
|
|
119
188
|
}
|
|
189
|
+
async getOrganizationFlags(userId, organizationId, tx) {
|
|
190
|
+
return this.throwableAsync(async () => {
|
|
191
|
+
const metadata = await this.getOrganizationMetadataForMember(userId, organizationId, tx);
|
|
192
|
+
if (!metadata)
|
|
193
|
+
return this.error("FORBIDDEN");
|
|
194
|
+
return (0, neverthrow_1.ok)(normalizeOrganizationFlags(metadata.flags));
|
|
195
|
+
});
|
|
196
|
+
}
|
|
120
197
|
async setFlags(userId, flags, tx) {
|
|
121
198
|
return this.throwableAsync(async () => {
|
|
122
199
|
const db = tx ?? this.orm;
|
|
@@ -127,6 +204,24 @@ class AuthRepository extends base_repository_1.BaseRepository {
|
|
|
127
204
|
return (0, neverthrow_1.ok)(flags);
|
|
128
205
|
});
|
|
129
206
|
}
|
|
207
|
+
async setOrganizationFlags(userId, organizationId, flags, tx) {
|
|
208
|
+
return this.throwableAsync(async () => {
|
|
209
|
+
const db = tx ?? this.orm;
|
|
210
|
+
const metadata = await this.getOrganizationMetadataForMember(userId, organizationId, tx);
|
|
211
|
+
if (!metadata)
|
|
212
|
+
return this.error("FORBIDDEN");
|
|
213
|
+
await db
|
|
214
|
+
.update(this.schema.organizations)
|
|
215
|
+
.set({
|
|
216
|
+
metadata: JSON.stringify({
|
|
217
|
+
...metadata,
|
|
218
|
+
flags,
|
|
219
|
+
}),
|
|
220
|
+
})
|
|
221
|
+
.where((0, drizzle_orm_1.eq)(this.schema.organizations.id, organizationId));
|
|
222
|
+
return (0, neverthrow_1.ok)(flags);
|
|
223
|
+
});
|
|
224
|
+
}
|
|
130
225
|
async listAdminWaitlist(tx) {
|
|
131
226
|
return this.throwableAsync(async () => {
|
|
132
227
|
const db = tx ?? this.orm;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AccountClaim, AccountClaimMagicLinkOutput, AccountClaimOutput, Waitlist, WaitlistOutput } from "./auth.dto";
|
|
2
|
-
import type { User } from "./auth.lib";
|
|
2
|
+
import type { Context, User } from "./auth.lib";
|
|
3
3
|
import type { AuthRepository } from "./auth.repository";
|
|
4
4
|
import type { ServerResultAsync } from "../base/base.dto";
|
|
5
5
|
import { BaseService } from "../base/base.service";
|
|
@@ -15,6 +15,7 @@ export declare class AuthService extends BaseService<{
|
|
|
15
15
|
auth: AuthRepository;
|
|
16
16
|
}, AuthServiceDependencies> {
|
|
17
17
|
private getBillingService;
|
|
18
|
+
private getActiveOrganizationId;
|
|
18
19
|
getUserWaitlistCount({ user }: {
|
|
19
20
|
user: User;
|
|
20
21
|
}): ServerResultAsync<number>;
|
|
@@ -30,6 +31,8 @@ export declare class AuthService extends BaseService<{
|
|
|
30
31
|
setPreferences(preferences: Record<string, unknown>, { user }: {
|
|
31
32
|
user: User;
|
|
32
33
|
}): ServerResultAsync<Record<string, unknown>>;
|
|
34
|
+
getOrganizationPreferences(ctx: Context): ServerResultAsync<Record<string, unknown>>;
|
|
35
|
+
setOrganizationPreferences(preferences: Record<string, unknown>, ctx: Context): ServerResultAsync<Record<string, unknown>>;
|
|
33
36
|
getMetadata({ user }: {
|
|
34
37
|
user: User;
|
|
35
38
|
}): ServerResultAsync<Record<string, unknown>>;
|
|
@@ -39,9 +42,11 @@ export declare class AuthService extends BaseService<{
|
|
|
39
42
|
getFlags({ user }: {
|
|
40
43
|
user: User;
|
|
41
44
|
}): ServerResultAsync<string[]>;
|
|
45
|
+
getOrganizationFlags(ctx: Context): ServerResultAsync<string[]>;
|
|
42
46
|
setFlags(flags: string[], { user }: {
|
|
43
47
|
user: User;
|
|
44
48
|
}): ServerResultAsync<string[]>;
|
|
49
|
+
setOrganizationFlags(flags: string[], ctx: Context): ServerResultAsync<string[]>;
|
|
45
50
|
listAdminWaitlist(): ServerResultAsync<WaitlistOutput[]>;
|
|
46
51
|
listWaitlist({ user }: {
|
|
47
52
|
user: User;
|
|
@@ -10,6 +10,13 @@ class AuthService extends base_service_1.BaseService {
|
|
|
10
10
|
return null;
|
|
11
11
|
return this.service.billing;
|
|
12
12
|
}
|
|
13
|
+
getActiveOrganizationId(ctx) {
|
|
14
|
+
const organizationId = ctx.session.activeOrganizationId;
|
|
15
|
+
if (!organizationId) {
|
|
16
|
+
return this.repository.auth.error("FORBIDDEN", "No active organization");
|
|
17
|
+
}
|
|
18
|
+
return (0, neverthrow_1.ok)(organizationId);
|
|
19
|
+
}
|
|
13
20
|
async getUserWaitlistCount({ user }) {
|
|
14
21
|
if (user.role === "admin")
|
|
15
22
|
return (0, neverthrow_1.ok)(0);
|
|
@@ -38,6 +45,25 @@ class AuthService extends base_service_1.BaseService {
|
|
|
38
45
|
});
|
|
39
46
|
return this.repository.auth.setPreferences(user.id, preferences);
|
|
40
47
|
}
|
|
48
|
+
async getOrganizationPreferences(ctx) {
|
|
49
|
+
const organizationId = this.getActiveOrganizationId(ctx);
|
|
50
|
+
if (organizationId.isErr())
|
|
51
|
+
return (0, neverthrow_1.err)(organizationId.error);
|
|
52
|
+
return this.repository.auth.getOrganizationPreferences(ctx.user.id, organizationId.value);
|
|
53
|
+
}
|
|
54
|
+
async setOrganizationPreferences(preferences, ctx) {
|
|
55
|
+
const organizationId = this.getActiveOrganizationId(ctx);
|
|
56
|
+
if (organizationId.isErr())
|
|
57
|
+
return (0, neverthrow_1.err)(organizationId.error);
|
|
58
|
+
(0, posthog_1.posthogCapture)({
|
|
59
|
+
distinctId: ctx.user.id,
|
|
60
|
+
event: "organization_preferences_set",
|
|
61
|
+
properties: {
|
|
62
|
+
organizationId: organizationId.value,
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
return this.repository.auth.setOrganizationPreferences(ctx.user.id, organizationId.value, preferences);
|
|
66
|
+
}
|
|
41
67
|
async getMetadata({ user }) {
|
|
42
68
|
return this.repository.auth.getMetadata(user.id);
|
|
43
69
|
}
|
|
@@ -51,6 +77,12 @@ class AuthService extends base_service_1.BaseService {
|
|
|
51
77
|
async getFlags({ user }) {
|
|
52
78
|
return this.repository.auth.getFlags(user.id);
|
|
53
79
|
}
|
|
80
|
+
async getOrganizationFlags(ctx) {
|
|
81
|
+
const organizationId = this.getActiveOrganizationId(ctx);
|
|
82
|
+
if (organizationId.isErr())
|
|
83
|
+
return (0, neverthrow_1.err)(organizationId.error);
|
|
84
|
+
return this.repository.auth.getOrganizationFlags(ctx.user.id, organizationId.value);
|
|
85
|
+
}
|
|
54
86
|
async setFlags(flags, { user }) {
|
|
55
87
|
(0, posthog_1.posthogCapture)({
|
|
56
88
|
distinctId: user.id,
|
|
@@ -58,6 +90,19 @@ class AuthService extends base_service_1.BaseService {
|
|
|
58
90
|
});
|
|
59
91
|
return this.repository.auth.setFlags(user.id, flags);
|
|
60
92
|
}
|
|
93
|
+
async setOrganizationFlags(flags, ctx) {
|
|
94
|
+
const organizationId = this.getActiveOrganizationId(ctx);
|
|
95
|
+
if (organizationId.isErr())
|
|
96
|
+
return (0, neverthrow_1.err)(organizationId.error);
|
|
97
|
+
(0, posthog_1.posthogCapture)({
|
|
98
|
+
distinctId: ctx.user.id,
|
|
99
|
+
event: "organization_flags_set",
|
|
100
|
+
properties: {
|
|
101
|
+
organizationId: organizationId.value,
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
return this.repository.auth.setOrganizationFlags(ctx.user.id, organizationId.value, flags);
|
|
105
|
+
}
|
|
61
106
|
async listAdminWaitlist() {
|
|
62
107
|
return this.repository.auth.listAdminWaitlist();
|
|
63
108
|
}
|
|
@@ -65,13 +65,13 @@ export declare function createAuthTRPC({ router, publicProcedure, privateProcedu
|
|
|
65
65
|
email?: string | undefined;
|
|
66
66
|
};
|
|
67
67
|
output: {
|
|
68
|
-
email: string;
|
|
69
|
-
url: string;
|
|
70
68
|
id: string;
|
|
69
|
+
email: string;
|
|
71
70
|
createdAt: Date;
|
|
72
|
-
userId: string;
|
|
73
71
|
expiresAt: Date | null;
|
|
72
|
+
userId: string;
|
|
74
73
|
claimId: string;
|
|
74
|
+
url: string;
|
|
75
75
|
};
|
|
76
76
|
meta: any;
|
|
77
77
|
}>;
|
|
@@ -80,13 +80,13 @@ export declare function createAuthTRPC({ router, publicProcedure, privateProcedu
|
|
|
80
80
|
claimId: string;
|
|
81
81
|
};
|
|
82
82
|
output: {
|
|
83
|
-
email: string;
|
|
84
|
-
url: string;
|
|
85
83
|
id: string;
|
|
84
|
+
email: string;
|
|
86
85
|
createdAt: Date;
|
|
87
|
-
userId: string;
|
|
88
86
|
expiresAt: Date | null;
|
|
87
|
+
userId: string;
|
|
89
88
|
claimId: string;
|
|
89
|
+
url: string;
|
|
90
90
|
}[];
|
|
91
91
|
meta: any;
|
|
92
92
|
}>;
|
|
@@ -138,9 +138,9 @@ export declare function createAuthTRPC({ router, publicProcedure, privateProcedu
|
|
|
138
138
|
listAdminWaitlist: import("@trpc/server").TRPCQueryProcedure<{
|
|
139
139
|
input: void;
|
|
140
140
|
output: {
|
|
141
|
-
email: string | null;
|
|
142
141
|
name: string | null;
|
|
143
142
|
id: string;
|
|
143
|
+
email: string | null;
|
|
144
144
|
createdAt: Date;
|
|
145
145
|
updatedAt: Date | null;
|
|
146
146
|
status: string;
|
|
@@ -152,9 +152,9 @@ export declare function createAuthTRPC({ router, publicProcedure, privateProcedu
|
|
|
152
152
|
email: string;
|
|
153
153
|
};
|
|
154
154
|
output: {
|
|
155
|
-
email: string | null;
|
|
156
155
|
name: string | null;
|
|
157
156
|
id: string;
|
|
157
|
+
email: string | null;
|
|
158
158
|
createdAt: Date;
|
|
159
159
|
updatedAt: Date | null;
|
|
160
160
|
status: string;
|
|
@@ -183,9 +183,9 @@ export declare function createAuthTRPC({ router, publicProcedure, privateProcedu
|
|
|
183
183
|
id: string;
|
|
184
184
|
};
|
|
185
185
|
output: {
|
|
186
|
-
email: string | null;
|
|
187
186
|
name: string | null;
|
|
188
187
|
id: string;
|
|
188
|
+
email: string | null;
|
|
189
189
|
createdAt: Date;
|
|
190
190
|
updatedAt: Date | null;
|
|
191
191
|
status: string;
|
|
@@ -197,9 +197,9 @@ export declare function createAuthTRPC({ router, publicProcedure, privateProcedu
|
|
|
197
197
|
id: string;
|
|
198
198
|
};
|
|
199
199
|
output: {
|
|
200
|
-
email: string | null;
|
|
201
200
|
name: string | null;
|
|
202
201
|
id: string;
|
|
202
|
+
email: string | null;
|
|
203
203
|
createdAt: Date;
|
|
204
204
|
updatedAt: Date | null;
|
|
205
205
|
status: string;
|
|
@@ -211,9 +211,9 @@ export declare function createAuthTRPC({ router, publicProcedure, privateProcedu
|
|
|
211
211
|
email: string;
|
|
212
212
|
};
|
|
213
213
|
output: {
|
|
214
|
-
email: string | null;
|
|
215
214
|
name: string | null;
|
|
216
215
|
id: string;
|
|
216
|
+
email: string | null;
|
|
217
217
|
createdAt: Date;
|
|
218
218
|
updatedAt: Date | null;
|
|
219
219
|
status: string;
|
|
@@ -240,6 +240,16 @@ export declare function createAuthTRPC({ router, publicProcedure, privateProcedu
|
|
|
240
240
|
output: Record<string, unknown>;
|
|
241
241
|
meta: any;
|
|
242
242
|
}>;
|
|
243
|
+
getOrganizationPreferences: import("@trpc/server").TRPCQueryProcedure<{
|
|
244
|
+
input: void;
|
|
245
|
+
output: Record<string, unknown>;
|
|
246
|
+
meta: any;
|
|
247
|
+
}>;
|
|
248
|
+
setOrganizationPreferences: import("@trpc/server").TRPCMutationProcedure<{
|
|
249
|
+
input: Record<string, unknown>;
|
|
250
|
+
output: Record<string, unknown>;
|
|
251
|
+
meta: any;
|
|
252
|
+
}>;
|
|
243
253
|
getMetadata: import("@trpc/server").TRPCQueryProcedure<{
|
|
244
254
|
input: void;
|
|
245
255
|
output: Record<string, unknown>;
|
|
@@ -255,11 +265,21 @@ export declare function createAuthTRPC({ router, publicProcedure, privateProcedu
|
|
|
255
265
|
output: string[];
|
|
256
266
|
meta: any;
|
|
257
267
|
}>;
|
|
268
|
+
getOrganizationFlags: import("@trpc/server").TRPCQueryProcedure<{
|
|
269
|
+
input: void;
|
|
270
|
+
output: string[];
|
|
271
|
+
meta: any;
|
|
272
|
+
}>;
|
|
258
273
|
setFlags: import("@trpc/server").TRPCMutationProcedure<{
|
|
259
274
|
input: string[];
|
|
260
275
|
output: string[];
|
|
261
276
|
meta: any;
|
|
262
277
|
}>;
|
|
278
|
+
setOrganizationFlags: import("@trpc/server").TRPCMutationProcedure<{
|
|
279
|
+
input: string[];
|
|
280
|
+
output: string[];
|
|
281
|
+
meta: any;
|
|
282
|
+
}>;
|
|
263
283
|
validateWaitlistCode: import("@trpc/server").TRPCQueryProcedure<{
|
|
264
284
|
input: {
|
|
265
285
|
code: string;
|
|
@@ -127,6 +127,17 @@ function createAuthTRPC({ router, publicProcedure, privateProcedure: procedure,
|
|
|
127
127
|
.mutation(async ({ ctx, input }) => {
|
|
128
128
|
return (0, trpc_1.handleTRPCResult)(await authService.setPreferences(input, ctx));
|
|
129
129
|
}),
|
|
130
|
+
getOrganizationPreferences: procedure
|
|
131
|
+
.output(zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()))
|
|
132
|
+
.query(async ({ ctx }) => {
|
|
133
|
+
return (0, trpc_1.handleTRPCResult)(await authService.getOrganizationPreferences(ctx));
|
|
134
|
+
}),
|
|
135
|
+
setOrganizationPreferences: procedure
|
|
136
|
+
.input(zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()))
|
|
137
|
+
.output(zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()))
|
|
138
|
+
.mutation(async ({ ctx, input }) => {
|
|
139
|
+
return (0, trpc_1.handleTRPCResult)(await authService.setOrganizationPreferences(input, ctx));
|
|
140
|
+
}),
|
|
130
141
|
getMetadata: procedure.output(zod_1.z.record(zod_1.z.string(), zod_1.z.unknown())).query(async ({ ctx }) => {
|
|
131
142
|
return (0, trpc_1.handleTRPCResult)(await authService.getMetadata(ctx));
|
|
132
143
|
}),
|
|
@@ -139,12 +150,21 @@ function createAuthTRPC({ router, publicProcedure, privateProcedure: procedure,
|
|
|
139
150
|
getFlags: procedure.output(zod_1.z.array(zod_1.z.string())).query(async ({ ctx }) => {
|
|
140
151
|
return (0, trpc_1.handleTRPCResult)(await authService.getFlags(ctx));
|
|
141
152
|
}),
|
|
153
|
+
getOrganizationFlags: procedure.output(zod_1.z.array(zod_1.z.string())).query(async ({ ctx }) => {
|
|
154
|
+
return (0, trpc_1.handleTRPCResult)(await authService.getOrganizationFlags(ctx));
|
|
155
|
+
}),
|
|
142
156
|
setFlags: procedure
|
|
143
157
|
.input(zod_1.z.array(zod_1.z.string()))
|
|
144
158
|
.output(zod_1.z.array(zod_1.z.string()))
|
|
145
159
|
.mutation(async ({ ctx, input }) => {
|
|
146
160
|
return (0, trpc_1.handleTRPCResult)(await authService.setFlags(input, ctx));
|
|
147
161
|
}),
|
|
162
|
+
setOrganizationFlags: procedure
|
|
163
|
+
.input(zod_1.z.array(zod_1.z.string()))
|
|
164
|
+
.output(zod_1.z.array(zod_1.z.string()))
|
|
165
|
+
.mutation(async ({ ctx, input }) => {
|
|
166
|
+
return (0, trpc_1.handleTRPCResult)(await authService.setOrganizationFlags(input, ctx));
|
|
167
|
+
}),
|
|
148
168
|
validateWaitlistCode: publicProcedure
|
|
149
169
|
.input(zod_1.z.object({
|
|
150
170
|
code: zod_1.z.string(),
|
package/dist/src/types.d.ts
CHANGED
|
@@ -74,13 +74,13 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(trpcM
|
|
|
74
74
|
email?: string | undefined;
|
|
75
75
|
};
|
|
76
76
|
output: {
|
|
77
|
-
email: string;
|
|
78
|
-
url: string;
|
|
79
77
|
id: string;
|
|
78
|
+
email: string;
|
|
80
79
|
createdAt: Date;
|
|
81
|
-
userId: string;
|
|
82
80
|
expiresAt: Date | null;
|
|
81
|
+
userId: string;
|
|
83
82
|
claimId: string;
|
|
83
|
+
url: string;
|
|
84
84
|
};
|
|
85
85
|
meta: any;
|
|
86
86
|
}>;
|
|
@@ -89,13 +89,13 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(trpcM
|
|
|
89
89
|
claimId: string;
|
|
90
90
|
};
|
|
91
91
|
output: {
|
|
92
|
-
email: string;
|
|
93
|
-
url: string;
|
|
94
92
|
id: string;
|
|
93
|
+
email: string;
|
|
95
94
|
createdAt: Date;
|
|
96
|
-
userId: string;
|
|
97
95
|
expiresAt: Date | null;
|
|
96
|
+
userId: string;
|
|
98
97
|
claimId: string;
|
|
98
|
+
url: string;
|
|
99
99
|
}[];
|
|
100
100
|
meta: any;
|
|
101
101
|
}>;
|
|
@@ -147,9 +147,9 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(trpcM
|
|
|
147
147
|
listAdminWaitlist: import("@trpc/server").TRPCQueryProcedure<{
|
|
148
148
|
input: void;
|
|
149
149
|
output: {
|
|
150
|
-
email: string | null;
|
|
151
150
|
name: string | null;
|
|
152
151
|
id: string;
|
|
152
|
+
email: string | null;
|
|
153
153
|
createdAt: Date;
|
|
154
154
|
updatedAt: Date | null;
|
|
155
155
|
status: string;
|
|
@@ -161,9 +161,9 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(trpcM
|
|
|
161
161
|
email: string;
|
|
162
162
|
};
|
|
163
163
|
output: {
|
|
164
|
-
email: string | null;
|
|
165
164
|
name: string | null;
|
|
166
165
|
id: string;
|
|
166
|
+
email: string | null;
|
|
167
167
|
createdAt: Date;
|
|
168
168
|
updatedAt: Date | null;
|
|
169
169
|
status: string;
|
|
@@ -192,9 +192,9 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(trpcM
|
|
|
192
192
|
id: string;
|
|
193
193
|
};
|
|
194
194
|
output: {
|
|
195
|
-
email: string | null;
|
|
196
195
|
name: string | null;
|
|
197
196
|
id: string;
|
|
197
|
+
email: string | null;
|
|
198
198
|
createdAt: Date;
|
|
199
199
|
updatedAt: Date | null;
|
|
200
200
|
status: string;
|
|
@@ -206,9 +206,9 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(trpcM
|
|
|
206
206
|
id: string;
|
|
207
207
|
};
|
|
208
208
|
output: {
|
|
209
|
-
email: string | null;
|
|
210
209
|
name: string | null;
|
|
211
210
|
id: string;
|
|
211
|
+
email: string | null;
|
|
212
212
|
createdAt: Date;
|
|
213
213
|
updatedAt: Date | null;
|
|
214
214
|
status: string;
|
|
@@ -220,9 +220,9 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(trpcM
|
|
|
220
220
|
email: string;
|
|
221
221
|
};
|
|
222
222
|
output: {
|
|
223
|
-
email: string | null;
|
|
224
223
|
name: string | null;
|
|
225
224
|
id: string;
|
|
225
|
+
email: string | null;
|
|
226
226
|
createdAt: Date;
|
|
227
227
|
updatedAt: Date | null;
|
|
228
228
|
status: string;
|
|
@@ -249,6 +249,16 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(trpcM
|
|
|
249
249
|
output: Record<string, unknown>;
|
|
250
250
|
meta: any;
|
|
251
251
|
}>;
|
|
252
|
+
getOrganizationPreferences: import("@trpc/server").TRPCQueryProcedure<{
|
|
253
|
+
input: void;
|
|
254
|
+
output: Record<string, unknown>;
|
|
255
|
+
meta: any;
|
|
256
|
+
}>;
|
|
257
|
+
setOrganizationPreferences: import("@trpc/server").TRPCMutationProcedure<{
|
|
258
|
+
input: Record<string, unknown>;
|
|
259
|
+
output: Record<string, unknown>;
|
|
260
|
+
meta: any;
|
|
261
|
+
}>;
|
|
252
262
|
getMetadata: import("@trpc/server").TRPCQueryProcedure<{
|
|
253
263
|
input: void;
|
|
254
264
|
output: Record<string, unknown>;
|
|
@@ -264,11 +274,21 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(trpcM
|
|
|
264
274
|
output: string[];
|
|
265
275
|
meta: any;
|
|
266
276
|
}>;
|
|
277
|
+
getOrganizationFlags: import("@trpc/server").TRPCQueryProcedure<{
|
|
278
|
+
input: void;
|
|
279
|
+
output: string[];
|
|
280
|
+
meta: any;
|
|
281
|
+
}>;
|
|
267
282
|
setFlags: import("@trpc/server").TRPCMutationProcedure<{
|
|
268
283
|
input: string[];
|
|
269
284
|
output: string[];
|
|
270
285
|
meta: any;
|
|
271
286
|
}>;
|
|
287
|
+
setOrganizationFlags: import("@trpc/server").TRPCMutationProcedure<{
|
|
288
|
+
input: string[];
|
|
289
|
+
output: string[];
|
|
290
|
+
meta: any;
|
|
291
|
+
}>;
|
|
272
292
|
validateWaitlistCode: import("@trpc/server").TRPCQueryProcedure<{
|
|
273
293
|
input: {
|
|
274
294
|
code: string;
|