@truecodeio/sdk-core 0.2.5 → 0.2.7
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/{src → dist}/app-router-types.d.ts +17 -17
- package/dist/client.d.ts +213 -0
- package/dist/index.d.ts +79 -0
- package/dist/index.js +108 -0
- package/dist/index.js.map +1 -0
- package/package.json +15 -5
- package/CHANGELOG.md +0 -37
- package/eslint.config.js +0 -8
- package/src/client.ts +0 -24
- package/src/index.ts +0 -37
- package/tsconfig.json +0 -15
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const appRouter: import(
|
|
1
|
+
declare const appRouter: import('@trpc/server').TRPCBuiltRouter<{
|
|
2
2
|
ctx: {
|
|
3
3
|
session: {
|
|
4
4
|
type: "api_key";
|
|
@@ -15,17 +15,17 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
15
15
|
} | null;
|
|
16
16
|
};
|
|
17
17
|
meta: object;
|
|
18
|
-
errorShape: import(
|
|
18
|
+
errorShape: import('@trpc/server').TRPCDefaultErrorShape;
|
|
19
19
|
transformer: true;
|
|
20
|
-
}, import(
|
|
21
|
-
health: import(
|
|
20
|
+
}, import('@trpc/server').TRPCDecorateCreateRouterOptions<{
|
|
21
|
+
health: import('@trpc/server').TRPCQueryProcedure<{
|
|
22
22
|
input: void;
|
|
23
23
|
output: {
|
|
24
24
|
status: string;
|
|
25
25
|
};
|
|
26
26
|
meta: object;
|
|
27
27
|
}>;
|
|
28
|
-
getProfile: import(
|
|
28
|
+
getProfile: import('@trpc/server').TRPCQueryProcedure<{
|
|
29
29
|
input: void;
|
|
30
30
|
output: {
|
|
31
31
|
organizations: {
|
|
@@ -43,7 +43,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
43
43
|
};
|
|
44
44
|
meta: object;
|
|
45
45
|
}>;
|
|
46
|
-
getCampaigns: import(
|
|
46
|
+
getCampaigns: import('@trpc/server').TRPCQueryProcedure<{
|
|
47
47
|
input: void;
|
|
48
48
|
output: {
|
|
49
49
|
id: string;
|
|
@@ -57,7 +57,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
57
57
|
}[];
|
|
58
58
|
meta: object;
|
|
59
59
|
}>;
|
|
60
|
-
getCampaign: import(
|
|
60
|
+
getCampaign: import('@trpc/server').TRPCQueryProcedure<{
|
|
61
61
|
input: {
|
|
62
62
|
id: string;
|
|
63
63
|
};
|
|
@@ -73,7 +73,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
73
73
|
};
|
|
74
74
|
meta: object;
|
|
75
75
|
}>;
|
|
76
|
-
createCampaign: import(
|
|
76
|
+
createCampaign: import('@trpc/server').TRPCMutationProcedure<{
|
|
77
77
|
input: {
|
|
78
78
|
name: string;
|
|
79
79
|
templateId: string;
|
|
@@ -83,7 +83,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
83
83
|
output: void;
|
|
84
84
|
meta: object;
|
|
85
85
|
}>;
|
|
86
|
-
getTemplates: import(
|
|
86
|
+
getTemplates: import('@trpc/server').TRPCQueryProcedure<{
|
|
87
87
|
input: void;
|
|
88
88
|
output: {
|
|
89
89
|
id: string;
|
|
@@ -97,7 +97,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
97
97
|
}[];
|
|
98
98
|
meta: object;
|
|
99
99
|
}>;
|
|
100
|
-
getTemplate: import(
|
|
100
|
+
getTemplate: import('@trpc/server').TRPCQueryProcedure<{
|
|
101
101
|
input: {
|
|
102
102
|
id: string;
|
|
103
103
|
};
|
|
@@ -113,7 +113,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
113
113
|
};
|
|
114
114
|
meta: object;
|
|
115
115
|
}>;
|
|
116
|
-
templateCreate: import(
|
|
116
|
+
templateCreate: import('@trpc/server').TRPCMutationProcedure<{
|
|
117
117
|
input: {
|
|
118
118
|
name: string;
|
|
119
119
|
content: unknown;
|
|
@@ -132,7 +132,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
132
132
|
} | undefined;
|
|
133
133
|
meta: object;
|
|
134
134
|
}>;
|
|
135
|
-
templateUpdate: import(
|
|
135
|
+
templateUpdate: import('@trpc/server').TRPCMutationProcedure<{
|
|
136
136
|
input: {
|
|
137
137
|
id: string;
|
|
138
138
|
name?: string | undefined;
|
|
@@ -151,7 +151,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
151
151
|
};
|
|
152
152
|
meta: object;
|
|
153
153
|
}>;
|
|
154
|
-
templateDelete: import(
|
|
154
|
+
templateDelete: import('@trpc/server').TRPCMutationProcedure<{
|
|
155
155
|
input: {
|
|
156
156
|
id: string;
|
|
157
157
|
};
|
|
@@ -167,17 +167,17 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
167
167
|
};
|
|
168
168
|
meta: object;
|
|
169
169
|
}>;
|
|
170
|
-
inviteUser: import(
|
|
170
|
+
inviteUser: import('@trpc/server').TRPCMutationProcedure<{
|
|
171
171
|
input: {
|
|
172
172
|
email: string;
|
|
173
173
|
redirectTo?: string | undefined;
|
|
174
174
|
};
|
|
175
175
|
output: {
|
|
176
|
-
user: import(
|
|
176
|
+
user: import('@supabase/supabase-js').AuthUser;
|
|
177
177
|
};
|
|
178
178
|
meta: object;
|
|
179
179
|
}>;
|
|
180
|
-
getUsers: import(
|
|
180
|
+
getUsers: import('@trpc/server').TRPCQueryProcedure<{
|
|
181
181
|
input: void;
|
|
182
182
|
output: {
|
|
183
183
|
id: string;
|
|
@@ -189,7 +189,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
189
189
|
}[];
|
|
190
190
|
meta: object;
|
|
191
191
|
}>;
|
|
192
|
-
getEligibleCampaign: import(
|
|
192
|
+
getEligibleCampaign: import('@trpc/server').TRPCQueryProcedure<{
|
|
193
193
|
input: void;
|
|
194
194
|
output: {
|
|
195
195
|
id: string;
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
type ClientConfig = {
|
|
2
|
+
apiKey: string;
|
|
3
|
+
};
|
|
4
|
+
export declare const createClient: ({ apiKey }: ClientConfig) => import('@trpc/client').TRPCClient<import('@trpc/server').TRPCBuiltRouter<{
|
|
5
|
+
ctx: {
|
|
6
|
+
session: {
|
|
7
|
+
type: "api_key";
|
|
8
|
+
organizationId: string;
|
|
9
|
+
user?: undefined;
|
|
10
|
+
} | {
|
|
11
|
+
type: "bearer";
|
|
12
|
+
user: {
|
|
13
|
+
id: string;
|
|
14
|
+
organizationId: string;
|
|
15
|
+
role: "admin" | "member";
|
|
16
|
+
};
|
|
17
|
+
organizationId?: undefined;
|
|
18
|
+
} | null;
|
|
19
|
+
};
|
|
20
|
+
meta: object;
|
|
21
|
+
errorShape: import('@trpc/server').TRPCDefaultErrorShape;
|
|
22
|
+
transformer: true;
|
|
23
|
+
}, import('@trpc/server').TRPCDecorateCreateRouterOptions<{
|
|
24
|
+
health: import('@trpc/server').TRPCQueryProcedure<{
|
|
25
|
+
input: void;
|
|
26
|
+
output: {
|
|
27
|
+
status: string;
|
|
28
|
+
};
|
|
29
|
+
meta: object;
|
|
30
|
+
}>;
|
|
31
|
+
getProfile: import('@trpc/server').TRPCQueryProcedure<{
|
|
32
|
+
input: void;
|
|
33
|
+
output: {
|
|
34
|
+
organizations: {
|
|
35
|
+
organizationId: string;
|
|
36
|
+
role: "admin" | "member";
|
|
37
|
+
name: string;
|
|
38
|
+
lastAccessed: Date;
|
|
39
|
+
}[];
|
|
40
|
+
id: string;
|
|
41
|
+
email: string;
|
|
42
|
+
name: string | null;
|
|
43
|
+
avatarUrl: string | null;
|
|
44
|
+
createdAt: Date;
|
|
45
|
+
updatedAt: Date;
|
|
46
|
+
};
|
|
47
|
+
meta: object;
|
|
48
|
+
}>;
|
|
49
|
+
getCampaigns: import('@trpc/server').TRPCQueryProcedure<{
|
|
50
|
+
input: void;
|
|
51
|
+
output: {
|
|
52
|
+
id: string;
|
|
53
|
+
name: string;
|
|
54
|
+
organizationId: string;
|
|
55
|
+
templateId: string;
|
|
56
|
+
createdBy: string;
|
|
57
|
+
createdAt: Date;
|
|
58
|
+
updatedAt: Date;
|
|
59
|
+
status: string;
|
|
60
|
+
}[];
|
|
61
|
+
meta: object;
|
|
62
|
+
}>;
|
|
63
|
+
getCampaign: import('@trpc/server').TRPCQueryProcedure<{
|
|
64
|
+
input: {
|
|
65
|
+
id: string;
|
|
66
|
+
};
|
|
67
|
+
output: {
|
|
68
|
+
id: string;
|
|
69
|
+
name: string;
|
|
70
|
+
organizationId: string;
|
|
71
|
+
templateId: string;
|
|
72
|
+
createdBy: string;
|
|
73
|
+
createdAt: Date;
|
|
74
|
+
updatedAt: Date;
|
|
75
|
+
status: string;
|
|
76
|
+
};
|
|
77
|
+
meta: object;
|
|
78
|
+
}>;
|
|
79
|
+
createCampaign: import('@trpc/server').TRPCMutationProcedure<{
|
|
80
|
+
input: {
|
|
81
|
+
name: string;
|
|
82
|
+
templateId: string;
|
|
83
|
+
createdAt?: Date | undefined;
|
|
84
|
+
updatedAt?: Date | undefined;
|
|
85
|
+
};
|
|
86
|
+
output: void;
|
|
87
|
+
meta: object;
|
|
88
|
+
}>;
|
|
89
|
+
getTemplates: import('@trpc/server').TRPCQueryProcedure<{
|
|
90
|
+
input: void;
|
|
91
|
+
output: {
|
|
92
|
+
id: string;
|
|
93
|
+
name: string;
|
|
94
|
+
organizationId: string;
|
|
95
|
+
content: unknown;
|
|
96
|
+
createdBy: string;
|
|
97
|
+
createdAt: Date;
|
|
98
|
+
updatedAt: Date;
|
|
99
|
+
status: string;
|
|
100
|
+
}[];
|
|
101
|
+
meta: object;
|
|
102
|
+
}>;
|
|
103
|
+
getTemplate: import('@trpc/server').TRPCQueryProcedure<{
|
|
104
|
+
input: {
|
|
105
|
+
id: string;
|
|
106
|
+
};
|
|
107
|
+
output: {
|
|
108
|
+
id: string;
|
|
109
|
+
name: string;
|
|
110
|
+
organizationId: string;
|
|
111
|
+
content: unknown;
|
|
112
|
+
createdBy: string;
|
|
113
|
+
createdAt: Date;
|
|
114
|
+
updatedAt: Date;
|
|
115
|
+
status: string;
|
|
116
|
+
};
|
|
117
|
+
meta: object;
|
|
118
|
+
}>;
|
|
119
|
+
templateCreate: import('@trpc/server').TRPCMutationProcedure<{
|
|
120
|
+
input: {
|
|
121
|
+
name: string;
|
|
122
|
+
content: unknown;
|
|
123
|
+
createdAt?: Date | undefined;
|
|
124
|
+
updatedAt?: Date | undefined;
|
|
125
|
+
};
|
|
126
|
+
output: {
|
|
127
|
+
id: string;
|
|
128
|
+
name: string;
|
|
129
|
+
createdAt: Date;
|
|
130
|
+
updatedAt: Date;
|
|
131
|
+
organizationId: string;
|
|
132
|
+
content: unknown;
|
|
133
|
+
createdBy: string;
|
|
134
|
+
status: string;
|
|
135
|
+
} | undefined;
|
|
136
|
+
meta: object;
|
|
137
|
+
}>;
|
|
138
|
+
templateUpdate: import('@trpc/server').TRPCMutationProcedure<{
|
|
139
|
+
input: {
|
|
140
|
+
id: string;
|
|
141
|
+
name?: string | undefined;
|
|
142
|
+
content?: unknown;
|
|
143
|
+
status?: string | undefined;
|
|
144
|
+
};
|
|
145
|
+
output: {
|
|
146
|
+
id: string;
|
|
147
|
+
name: string;
|
|
148
|
+
organizationId: string;
|
|
149
|
+
content: unknown;
|
|
150
|
+
createdBy: string;
|
|
151
|
+
createdAt: Date;
|
|
152
|
+
updatedAt: Date;
|
|
153
|
+
status: string;
|
|
154
|
+
};
|
|
155
|
+
meta: object;
|
|
156
|
+
}>;
|
|
157
|
+
templateDelete: import('@trpc/server').TRPCMutationProcedure<{
|
|
158
|
+
input: {
|
|
159
|
+
id: string;
|
|
160
|
+
};
|
|
161
|
+
output: {
|
|
162
|
+
id: string;
|
|
163
|
+
name: string;
|
|
164
|
+
createdAt: Date;
|
|
165
|
+
updatedAt: Date;
|
|
166
|
+
organizationId: string;
|
|
167
|
+
content: unknown;
|
|
168
|
+
createdBy: string;
|
|
169
|
+
status: string;
|
|
170
|
+
};
|
|
171
|
+
meta: object;
|
|
172
|
+
}>;
|
|
173
|
+
inviteUser: import('@trpc/server').TRPCMutationProcedure<{
|
|
174
|
+
input: {
|
|
175
|
+
email: string;
|
|
176
|
+
redirectTo?: string | undefined;
|
|
177
|
+
};
|
|
178
|
+
output: {
|
|
179
|
+
user: import('@supabase/supabase-js').AuthUser;
|
|
180
|
+
};
|
|
181
|
+
meta: object;
|
|
182
|
+
}>;
|
|
183
|
+
getUsers: import('@trpc/server').TRPCQueryProcedure<{
|
|
184
|
+
input: void;
|
|
185
|
+
output: {
|
|
186
|
+
id: string;
|
|
187
|
+
email: string;
|
|
188
|
+
name: string | null;
|
|
189
|
+
avatarUrl: string | null;
|
|
190
|
+
role: "admin" | "member";
|
|
191
|
+
createdAt: Date;
|
|
192
|
+
}[];
|
|
193
|
+
meta: object;
|
|
194
|
+
}>;
|
|
195
|
+
getEligibleCampaign: import('@trpc/server').TRPCQueryProcedure<{
|
|
196
|
+
input: void;
|
|
197
|
+
output: {
|
|
198
|
+
id: string;
|
|
199
|
+
template: {
|
|
200
|
+
id: string;
|
|
201
|
+
name: string;
|
|
202
|
+
organizationId: string;
|
|
203
|
+
content: unknown;
|
|
204
|
+
createdBy: string;
|
|
205
|
+
createdAt: Date;
|
|
206
|
+
updatedAt: Date;
|
|
207
|
+
status: string;
|
|
208
|
+
};
|
|
209
|
+
} | null;
|
|
210
|
+
meta: object;
|
|
211
|
+
}>;
|
|
212
|
+
}>>>;
|
|
213
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
type ClientOptions = {
|
|
2
|
+
apiKey: string;
|
|
3
|
+
};
|
|
4
|
+
export declare const createBokoClient: (options: ClientOptions) => {
|
|
5
|
+
getEligibleCampaign: () => Promise<{
|
|
6
|
+
template: {
|
|
7
|
+
content: {
|
|
8
|
+
id: string;
|
|
9
|
+
type: "root";
|
|
10
|
+
name: string;
|
|
11
|
+
isCollapsed: boolean;
|
|
12
|
+
props: {
|
|
13
|
+
color: string;
|
|
14
|
+
};
|
|
15
|
+
children: {
|
|
16
|
+
id: string;
|
|
17
|
+
type: "row";
|
|
18
|
+
name: string;
|
|
19
|
+
isCollapsed: boolean;
|
|
20
|
+
props: {
|
|
21
|
+
padding: {
|
|
22
|
+
top: number;
|
|
23
|
+
right: number;
|
|
24
|
+
bottom: number;
|
|
25
|
+
left: number;
|
|
26
|
+
};
|
|
27
|
+
gap: number;
|
|
28
|
+
background: {
|
|
29
|
+
color: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
children: {
|
|
33
|
+
id: string;
|
|
34
|
+
type: "column";
|
|
35
|
+
name: string;
|
|
36
|
+
isCollapsed: boolean;
|
|
37
|
+
props: Record<string, unknown>;
|
|
38
|
+
children: ({
|
|
39
|
+
id: string;
|
|
40
|
+
type: "spacer";
|
|
41
|
+
name: string;
|
|
42
|
+
isCollapsed: boolean;
|
|
43
|
+
props: {
|
|
44
|
+
size: number;
|
|
45
|
+
};
|
|
46
|
+
} | {
|
|
47
|
+
id: string;
|
|
48
|
+
type: "text";
|
|
49
|
+
name: string;
|
|
50
|
+
isCollapsed: boolean;
|
|
51
|
+
props: {
|
|
52
|
+
type: "paragraph" | "heading-1" | "heading-2" | "heading-3" | "heading-4" | "heading-5" | "heading-6";
|
|
53
|
+
content: string;
|
|
54
|
+
};
|
|
55
|
+
} | {
|
|
56
|
+
id: string;
|
|
57
|
+
type: "button";
|
|
58
|
+
name: string;
|
|
59
|
+
isCollapsed: boolean;
|
|
60
|
+
props: {
|
|
61
|
+
title: string;
|
|
62
|
+
};
|
|
63
|
+
})[];
|
|
64
|
+
}[];
|
|
65
|
+
}[];
|
|
66
|
+
};
|
|
67
|
+
id: string;
|
|
68
|
+
name: string;
|
|
69
|
+
organizationId: string;
|
|
70
|
+
createdBy: string;
|
|
71
|
+
createdAt: Date;
|
|
72
|
+
updatedAt: Date;
|
|
73
|
+
status: string;
|
|
74
|
+
};
|
|
75
|
+
id: string;
|
|
76
|
+
} | null>;
|
|
77
|
+
};
|
|
78
|
+
export type EligibleCampaign = NonNullable<Awaited<ReturnType<ReturnType<typeof createBokoClient>["getEligibleCampaign"]>>>;
|
|
79
|
+
export {};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { createTRPCClient as o, httpBatchLink as a } from "@trpc/client";
|
|
2
|
+
import i from "superjson";
|
|
3
|
+
import { z as e } from "zod";
|
|
4
|
+
const l = ({ apiKey: r }) => o({
|
|
5
|
+
links: [
|
|
6
|
+
a({
|
|
7
|
+
transformer: i,
|
|
8
|
+
url: "https://boko-server-0d640b8d4fbf.herokuapp.com",
|
|
9
|
+
headers: () => ({
|
|
10
|
+
Authorization: `ApiKey ${r}`
|
|
11
|
+
})
|
|
12
|
+
})
|
|
13
|
+
]
|
|
14
|
+
}), s = e.object({
|
|
15
|
+
id: e.string(),
|
|
16
|
+
type: e.literal("spacer"),
|
|
17
|
+
name: e.string(),
|
|
18
|
+
isCollapsed: e.boolean(),
|
|
19
|
+
props: e.object({
|
|
20
|
+
size: e.number()
|
|
21
|
+
})
|
|
22
|
+
}), p = e.object({
|
|
23
|
+
id: e.string(),
|
|
24
|
+
type: e.literal("text"),
|
|
25
|
+
name: e.string(),
|
|
26
|
+
isCollapsed: e.boolean(),
|
|
27
|
+
props: e.object({
|
|
28
|
+
content: e.string(),
|
|
29
|
+
type: e.enum([
|
|
30
|
+
"paragraph",
|
|
31
|
+
"heading-1",
|
|
32
|
+
"heading-2",
|
|
33
|
+
"heading-3",
|
|
34
|
+
"heading-4",
|
|
35
|
+
"heading-5",
|
|
36
|
+
"heading-6"
|
|
37
|
+
])
|
|
38
|
+
})
|
|
39
|
+
}), c = e.object({
|
|
40
|
+
id: e.string(),
|
|
41
|
+
type: e.literal("button"),
|
|
42
|
+
name: e.string(),
|
|
43
|
+
isCollapsed: e.boolean(),
|
|
44
|
+
props: e.object({
|
|
45
|
+
title: e.string()
|
|
46
|
+
})
|
|
47
|
+
}), g = e.object({
|
|
48
|
+
id: e.string(),
|
|
49
|
+
type: e.literal("column"),
|
|
50
|
+
name: e.string(),
|
|
51
|
+
isCollapsed: e.boolean(),
|
|
52
|
+
props: e.record(e.string(), e.unknown()),
|
|
53
|
+
children: e.array(
|
|
54
|
+
e.lazy(() => e.union([c, p, s]))
|
|
55
|
+
)
|
|
56
|
+
}), m = e.object({
|
|
57
|
+
id: e.string(),
|
|
58
|
+
type: e.literal("row"),
|
|
59
|
+
name: e.string(),
|
|
60
|
+
isCollapsed: e.boolean(),
|
|
61
|
+
props: e.object({
|
|
62
|
+
padding: e.object({
|
|
63
|
+
top: e.number(),
|
|
64
|
+
right: e.number(),
|
|
65
|
+
bottom: e.number(),
|
|
66
|
+
left: e.number()
|
|
67
|
+
}),
|
|
68
|
+
gap: e.number(),
|
|
69
|
+
background: e.object({
|
|
70
|
+
color: e.string()
|
|
71
|
+
})
|
|
72
|
+
}),
|
|
73
|
+
children: e.array(
|
|
74
|
+
e.lazy(() => g)
|
|
75
|
+
)
|
|
76
|
+
}), b = e.object({
|
|
77
|
+
id: e.string(),
|
|
78
|
+
type: e.literal("root"),
|
|
79
|
+
name: e.string(),
|
|
80
|
+
isCollapsed: e.boolean(),
|
|
81
|
+
props: e.object({
|
|
82
|
+
color: e.string()
|
|
83
|
+
}),
|
|
84
|
+
children: e.array(
|
|
85
|
+
e.lazy(() => m)
|
|
86
|
+
)
|
|
87
|
+
}), y = (r) => {
|
|
88
|
+
const n = l({
|
|
89
|
+
apiKey: r.apiKey
|
|
90
|
+
});
|
|
91
|
+
return {
|
|
92
|
+
getEligibleCampaign: async () => {
|
|
93
|
+
const t = await n.getEligibleCampaign.query();
|
|
94
|
+
return t ? {
|
|
95
|
+
...t,
|
|
96
|
+
template: {
|
|
97
|
+
...t.template,
|
|
98
|
+
// TODO: Do we need to parse the content here or on procedure level?
|
|
99
|
+
content: b.parse(t.template.content)
|
|
100
|
+
}
|
|
101
|
+
} : null;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
export {
|
|
106
|
+
y as createBokoClient
|
|
107
|
+
};
|
|
108
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/client.ts","../../../node_modules/.pnpm/@truecodeio+client-shared@0.1.5/node_modules/@truecodeio/client-shared/src/schemas/tree-nodes/index.ts","../src/index.ts"],"sourcesContent":["import { createTRPCClient, httpBatchLink } from \"@trpc/client\";\nimport superjson from \"superjson\";\nimport type { AppRouter } from \"./app-router-types\";\n\ntype ClientConfig = {\n apiKey: string;\n};\n\nexport const createClient = ({ apiKey }: ClientConfig) => {\n return createTRPCClient<AppRouter>({\n links: [\n httpBatchLink({\n transformer: superjson,\n url: __SERVER_URL__,\n headers: () => {\n return {\n Authorization: `ApiKey ${apiKey}`,\n };\n },\n }),\n ],\n });\n};\n","import { z } from \"zod\";\n\nexport const spacerNodeSchema = z.object({\n id: z.string(),\n type: z.literal(\"spacer\"),\n name: z.string(),\n isCollapsed: z.boolean(),\n props: z.object({\n size: z.number(),\n }),\n});\n\nexport const textNodeSchema = z.object({\n id: z.string(),\n type: z.literal(\"text\"),\n name: z.string(),\n isCollapsed: z.boolean(),\n props: z.object({\n content: z.string(),\n type: z.enum([\n \"paragraph\",\n \"heading-1\",\n \"heading-2\",\n \"heading-3\",\n \"heading-4\",\n \"heading-5\",\n \"heading-6\",\n ]),\n }),\n});\n\nexport const buttonNodeSchema = z.object({\n id: z.string(),\n type: z.literal(\"button\"),\n name: z.string(),\n isCollapsed: z.boolean(),\n props: z.object({\n title: z.string(),\n }),\n});\n\nexport const columnNodeSchema = z.object({\n id: z.string(),\n type: z.literal(\"column\"),\n name: z.string(),\n isCollapsed: z.boolean(),\n props: z.record(z.string(), z.unknown()),\n children: z.array(\n z.lazy(() => {\n return z.union([buttonNodeSchema, textNodeSchema, spacerNodeSchema]);\n }),\n ),\n});\n\nexport const rowNodeSchema = z.object({\n id: z.string(),\n type: z.literal(\"row\"),\n name: z.string(),\n isCollapsed: z.boolean(),\n props: z.object({\n padding: z.object({\n top: z.number(),\n right: z.number(),\n bottom: z.number(),\n left: z.number(),\n }),\n gap: z.number(),\n background: z.object({\n color: z.string(),\n }),\n }),\n children: z.array(\n z.lazy(() => {\n return columnNodeSchema;\n }),\n ),\n});\n\nexport const rootNodeSchema = z.object({\n id: z.string(),\n type: z.literal(\"root\"),\n name: z.string(),\n isCollapsed: z.boolean(),\n props: z.object({\n color: z.string(),\n }),\n children: z.array(\n z.lazy(() => {\n return rowNodeSchema;\n }),\n ),\n});\n\nexport type NodeT =\n | z.infer<typeof rootNodeSchema>\n | z.infer<typeof rowNodeSchema>\n | z.infer<typeof columnNodeSchema>\n | z.infer<typeof buttonNodeSchema>\n | z.infer<typeof textNodeSchema>\n | z.infer<typeof spacerNodeSchema>;\n","import { createClient } from \"./client.ts\";\nimport { rootNodeSchema } from \"@truecodeio/client-shared/schemas/tree-nodes/index.ts\";\n\ntype ClientOptions = {\n apiKey: string;\n};\n\nexport const createBokoClient = (options: ClientOptions) => {\n const client = createClient({\n apiKey: options.apiKey,\n });\n\n return {\n getEligibleCampaign: async () => {\n const eligibleCampaign = await client.getEligibleCampaign.query();\n\n if (!eligibleCampaign) {\n return null;\n }\n\n return {\n ...eligibleCampaign,\n template: {\n ...eligibleCampaign.template,\n // TODO: Do we need to parse the content here or on procedure level?\n content: rootNodeSchema.parse(eligibleCampaign.template.content),\n },\n };\n },\n };\n};\n\nexport type EligibleCampaign = NonNullable<\n Awaited<\n ReturnType<ReturnType<typeof createBokoClient>[\"getEligibleCampaign\"]>\n >\n>;\n"],"names":["createClient","apiKey","createTRPCClient","httpBatchLink","superjson","spacerNodeSchema","z","textNodeSchema","buttonNodeSchema","columnNodeSchema","rowNodeSchema","rootNodeSchema","createBokoClient","options","client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AA,IACL,qBAAqB,YAAY;AAC/B,YAAME,IAAmB,MAAMD,EAAO,oBAAoB,MAAA;AAE1D,aAAKC,IAIE;AAAA,QACL,GAAGA;AAAA,QACH,UAAU;AAAA,UACR,GAAGA,EAAiB;AAAA;AAAA,UAEpB,SAASJ,EAAe,MAAMI,EAAiB,SAAS,OAAO;AAAA,QAAA;AAAA,MACjE,IATO;AAAA,IAUT;AAAA,EACF;AAEJ;","x_google_ignoreList":[1]}
|
package/package.json
CHANGED
|
@@ -1,22 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truecodeio/sdk-core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"
|
|
6
|
-
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"import": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
7
14
|
"dependencies": {
|
|
8
15
|
"@trpc/client": "^11.4.2",
|
|
9
16
|
"@trpc/server": "11.4.2",
|
|
10
|
-
"@truecodeio/client-shared": "^0.1.
|
|
17
|
+
"@truecodeio/client-shared": "^0.1.5",
|
|
11
18
|
"superjson": "^2.2.2",
|
|
12
19
|
"zod": "^3.25.67"
|
|
13
20
|
},
|
|
14
21
|
"devDependencies": {
|
|
15
|
-
"typescript-eslint": "^8.
|
|
22
|
+
"typescript-eslint": "^8.35.0",
|
|
23
|
+
"vite": "^7.0.0",
|
|
24
|
+
"vite-plugin-dts": "^4.4.0",
|
|
16
25
|
"@boko/eslint-config": "1.0.0",
|
|
17
26
|
"@boko/tsconfig": "^1.0.0"
|
|
18
27
|
},
|
|
19
28
|
"scripts": {
|
|
29
|
+
"build": "vite build",
|
|
20
30
|
"format:prettier:fix:all": "prettier --cache --write ./src",
|
|
21
31
|
"lint:eslint:fix:all": "eslint --cache --fix ./src",
|
|
22
32
|
"lint:typescript": "tsc --noEmit"
|
package/CHANGELOG.md
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# @boko/sdk-core
|
|
2
|
-
|
|
3
|
-
## 0.2.5
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- Add main field in package.json
|
|
8
|
-
|
|
9
|
-
## 0.2.4
|
|
10
|
-
|
|
11
|
-
### Patch Changes
|
|
12
|
-
|
|
13
|
-
- Remove workspace dependencies
|
|
14
|
-
|
|
15
|
-
## 0.2.3
|
|
16
|
-
|
|
17
|
-
### Patch Changes
|
|
18
|
-
|
|
19
|
-
- Bump dependencies; Add app-router-types.
|
|
20
|
-
|
|
21
|
-
## 0.2.2
|
|
22
|
-
|
|
23
|
-
### Patch Changes
|
|
24
|
-
|
|
25
|
-
- change package name
|
|
26
|
-
|
|
27
|
-
## 0.2.1
|
|
28
|
-
|
|
29
|
-
### Patch Changes
|
|
30
|
-
|
|
31
|
-
- Override access property
|
|
32
|
-
|
|
33
|
-
## 0.2.0
|
|
34
|
-
|
|
35
|
-
### Minor Changes
|
|
36
|
-
|
|
37
|
-
- Init packages
|
package/eslint.config.js
DELETED
package/src/client.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { createTRPCClient, httpBatchLink } from "@trpc/client";
|
|
2
|
-
import superjson from "superjson";
|
|
3
|
-
import type { AppRouter } from "./app-router-types";
|
|
4
|
-
|
|
5
|
-
type ClientConfig = {
|
|
6
|
-
apiKey: string;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export const createClient = ({ apiKey }: ClientConfig) => {
|
|
10
|
-
return createTRPCClient<AppRouter>({
|
|
11
|
-
links: [
|
|
12
|
-
httpBatchLink({
|
|
13
|
-
transformer: superjson,
|
|
14
|
-
// TODO: during build time, this SHOULD be replaced with the actual server URL
|
|
15
|
-
url: "http://localhost:3000",
|
|
16
|
-
headers: () => {
|
|
17
|
-
return {
|
|
18
|
-
Authorization: `ApiKey ${apiKey}`,
|
|
19
|
-
};
|
|
20
|
-
},
|
|
21
|
-
}),
|
|
22
|
-
],
|
|
23
|
-
});
|
|
24
|
-
};
|
package/src/index.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { createClient } from "./client.ts";
|
|
2
|
-
import { rootNodeSchema } from "@truecodeio/client-shared/schemas/tree-nodes";
|
|
3
|
-
|
|
4
|
-
type ClientOptions = {
|
|
5
|
-
apiKey: string;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export const createBokoClient = (options: ClientOptions) => {
|
|
9
|
-
const client = createClient({
|
|
10
|
-
apiKey: options.apiKey,
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
return {
|
|
14
|
-
getEligibleCampaign: async () => {
|
|
15
|
-
const eligibleCampaign = await client.getEligibleCampaign.query();
|
|
16
|
-
|
|
17
|
-
if (!eligibleCampaign) {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return {
|
|
22
|
-
...eligibleCampaign,
|
|
23
|
-
template: {
|
|
24
|
-
...eligibleCampaign.template,
|
|
25
|
-
// TODO: Do we need to parse the content here or on procedure level?
|
|
26
|
-
content: rootNodeSchema.parse(eligibleCampaign.template.content),
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export type EligibleCampaign = NonNullable<
|
|
34
|
-
Awaited<
|
|
35
|
-
ReturnType<ReturnType<typeof createBokoClient>["getEligibleCampaign"]>
|
|
36
|
-
>
|
|
37
|
-
>;
|
package/tsconfig.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "@boko/tsconfig",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"allowImportingTsExtensions": true,
|
|
5
|
-
"moduleResolution": "bundler",
|
|
6
|
-
"module": "ES2022",
|
|
7
|
-
"paths": {
|
|
8
|
-
"@boko/sdk-core/*": ["./src/*"],
|
|
9
|
-
"@boko/server": ["../../apps/server/src"],
|
|
10
|
-
"@boko/server/*": ["../../apps/server/src/*"],
|
|
11
|
-
"@truecodeio/client-shared/*": ["../client-shared/src/*"]
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
"include": ["src"]
|
|
15
|
-
}
|