@truecodeio/sdk-core 0.2.6 → 0.2.8
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 +36 -17
- package/dist/client.d.ts +232 -0
- package/dist/index.d.ts +108 -0
- package/dist/index.js +142 -0
- package/dist/index.js.map +1 -0
- package/package.json +20 -10
- package/CHANGELOG.md +0 -43
- package/eslint.config.js +0 -8
- package/src/client.ts +0 -24
- package/src/index.ts +0 -37
- package/tsconfig.json +0 -14
|
@@ -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,26 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
83
83
|
output: void;
|
|
84
84
|
meta: object;
|
|
85
85
|
}>;
|
|
86
|
-
|
|
86
|
+
updateCampaign: import('@trpc/server').TRPCMutationProcedure<{
|
|
87
|
+
input: {
|
|
88
|
+
id: string;
|
|
89
|
+
name?: string | undefined;
|
|
90
|
+
status?: string | undefined;
|
|
91
|
+
templateId?: string | undefined;
|
|
92
|
+
};
|
|
93
|
+
output: {
|
|
94
|
+
id: string;
|
|
95
|
+
name: string;
|
|
96
|
+
organizationId: string;
|
|
97
|
+
templateId: string;
|
|
98
|
+
createdBy: string;
|
|
99
|
+
createdAt: Date;
|
|
100
|
+
updatedAt: Date;
|
|
101
|
+
status: string;
|
|
102
|
+
};
|
|
103
|
+
meta: object;
|
|
104
|
+
}>;
|
|
105
|
+
getTemplates: import('@trpc/server').TRPCQueryProcedure<{
|
|
87
106
|
input: void;
|
|
88
107
|
output: {
|
|
89
108
|
id: string;
|
|
@@ -97,7 +116,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
97
116
|
}[];
|
|
98
117
|
meta: object;
|
|
99
118
|
}>;
|
|
100
|
-
getTemplate: import(
|
|
119
|
+
getTemplate: import('@trpc/server').TRPCQueryProcedure<{
|
|
101
120
|
input: {
|
|
102
121
|
id: string;
|
|
103
122
|
};
|
|
@@ -113,7 +132,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
113
132
|
};
|
|
114
133
|
meta: object;
|
|
115
134
|
}>;
|
|
116
|
-
templateCreate: import(
|
|
135
|
+
templateCreate: import('@trpc/server').TRPCMutationProcedure<{
|
|
117
136
|
input: {
|
|
118
137
|
name: string;
|
|
119
138
|
content: unknown;
|
|
@@ -132,7 +151,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
132
151
|
} | undefined;
|
|
133
152
|
meta: object;
|
|
134
153
|
}>;
|
|
135
|
-
templateUpdate: import(
|
|
154
|
+
templateUpdate: import('@trpc/server').TRPCMutationProcedure<{
|
|
136
155
|
input: {
|
|
137
156
|
id: string;
|
|
138
157
|
name?: string | undefined;
|
|
@@ -151,7 +170,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
151
170
|
};
|
|
152
171
|
meta: object;
|
|
153
172
|
}>;
|
|
154
|
-
templateDelete: import(
|
|
173
|
+
templateDelete: import('@trpc/server').TRPCMutationProcedure<{
|
|
155
174
|
input: {
|
|
156
175
|
id: string;
|
|
157
176
|
};
|
|
@@ -167,17 +186,17 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
167
186
|
};
|
|
168
187
|
meta: object;
|
|
169
188
|
}>;
|
|
170
|
-
inviteUser: import(
|
|
189
|
+
inviteUser: import('@trpc/server').TRPCMutationProcedure<{
|
|
171
190
|
input: {
|
|
172
191
|
email: string;
|
|
173
192
|
redirectTo?: string | undefined;
|
|
174
193
|
};
|
|
175
194
|
output: {
|
|
176
|
-
user: import(
|
|
195
|
+
user: import('@supabase/supabase-js').AuthUser;
|
|
177
196
|
};
|
|
178
197
|
meta: object;
|
|
179
198
|
}>;
|
|
180
|
-
getUsers: import(
|
|
199
|
+
getUsers: import('@trpc/server').TRPCQueryProcedure<{
|
|
181
200
|
input: void;
|
|
182
201
|
output: {
|
|
183
202
|
id: string;
|
|
@@ -189,7 +208,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
189
208
|
}[];
|
|
190
209
|
meta: object;
|
|
191
210
|
}>;
|
|
192
|
-
getEligibleCampaign: import(
|
|
211
|
+
getEligibleCampaign: import('@trpc/server').TRPCQueryProcedure<{
|
|
193
212
|
input: void;
|
|
194
213
|
output: {
|
|
195
214
|
id: string;
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
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
|
+
updateCampaign: import('@trpc/server').TRPCMutationProcedure<{
|
|
90
|
+
input: {
|
|
91
|
+
id: string;
|
|
92
|
+
name?: string | undefined;
|
|
93
|
+
status?: string | undefined;
|
|
94
|
+
templateId?: string | undefined;
|
|
95
|
+
};
|
|
96
|
+
output: {
|
|
97
|
+
id: string;
|
|
98
|
+
name: string;
|
|
99
|
+
organizationId: string;
|
|
100
|
+
templateId: string;
|
|
101
|
+
createdBy: string;
|
|
102
|
+
createdAt: Date;
|
|
103
|
+
updatedAt: Date;
|
|
104
|
+
status: string;
|
|
105
|
+
};
|
|
106
|
+
meta: object;
|
|
107
|
+
}>;
|
|
108
|
+
getTemplates: import('@trpc/server').TRPCQueryProcedure<{
|
|
109
|
+
input: void;
|
|
110
|
+
output: {
|
|
111
|
+
id: string;
|
|
112
|
+
name: string;
|
|
113
|
+
organizationId: string;
|
|
114
|
+
content: unknown;
|
|
115
|
+
createdBy: string;
|
|
116
|
+
createdAt: Date;
|
|
117
|
+
updatedAt: Date;
|
|
118
|
+
status: string;
|
|
119
|
+
}[];
|
|
120
|
+
meta: object;
|
|
121
|
+
}>;
|
|
122
|
+
getTemplate: import('@trpc/server').TRPCQueryProcedure<{
|
|
123
|
+
input: {
|
|
124
|
+
id: string;
|
|
125
|
+
};
|
|
126
|
+
output: {
|
|
127
|
+
id: string;
|
|
128
|
+
name: string;
|
|
129
|
+
organizationId: string;
|
|
130
|
+
content: unknown;
|
|
131
|
+
createdBy: string;
|
|
132
|
+
createdAt: Date;
|
|
133
|
+
updatedAt: Date;
|
|
134
|
+
status: string;
|
|
135
|
+
};
|
|
136
|
+
meta: object;
|
|
137
|
+
}>;
|
|
138
|
+
templateCreate: import('@trpc/server').TRPCMutationProcedure<{
|
|
139
|
+
input: {
|
|
140
|
+
name: string;
|
|
141
|
+
content: unknown;
|
|
142
|
+
createdAt?: Date | undefined;
|
|
143
|
+
updatedAt?: Date | undefined;
|
|
144
|
+
};
|
|
145
|
+
output: {
|
|
146
|
+
id: string;
|
|
147
|
+
name: string;
|
|
148
|
+
createdAt: Date;
|
|
149
|
+
updatedAt: Date;
|
|
150
|
+
organizationId: string;
|
|
151
|
+
content: unknown;
|
|
152
|
+
createdBy: string;
|
|
153
|
+
status: string;
|
|
154
|
+
} | undefined;
|
|
155
|
+
meta: object;
|
|
156
|
+
}>;
|
|
157
|
+
templateUpdate: import('@trpc/server').TRPCMutationProcedure<{
|
|
158
|
+
input: {
|
|
159
|
+
id: string;
|
|
160
|
+
name?: string | undefined;
|
|
161
|
+
content?: unknown;
|
|
162
|
+
status?: string | undefined;
|
|
163
|
+
};
|
|
164
|
+
output: {
|
|
165
|
+
id: string;
|
|
166
|
+
name: string;
|
|
167
|
+
organizationId: string;
|
|
168
|
+
content: unknown;
|
|
169
|
+
createdBy: string;
|
|
170
|
+
createdAt: Date;
|
|
171
|
+
updatedAt: Date;
|
|
172
|
+
status: string;
|
|
173
|
+
};
|
|
174
|
+
meta: object;
|
|
175
|
+
}>;
|
|
176
|
+
templateDelete: import('@trpc/server').TRPCMutationProcedure<{
|
|
177
|
+
input: {
|
|
178
|
+
id: string;
|
|
179
|
+
};
|
|
180
|
+
output: {
|
|
181
|
+
id: string;
|
|
182
|
+
name: string;
|
|
183
|
+
createdAt: Date;
|
|
184
|
+
updatedAt: Date;
|
|
185
|
+
organizationId: string;
|
|
186
|
+
content: unknown;
|
|
187
|
+
createdBy: string;
|
|
188
|
+
status: string;
|
|
189
|
+
};
|
|
190
|
+
meta: object;
|
|
191
|
+
}>;
|
|
192
|
+
inviteUser: import('@trpc/server').TRPCMutationProcedure<{
|
|
193
|
+
input: {
|
|
194
|
+
email: string;
|
|
195
|
+
redirectTo?: string | undefined;
|
|
196
|
+
};
|
|
197
|
+
output: {
|
|
198
|
+
user: import('@supabase/supabase-js').AuthUser;
|
|
199
|
+
};
|
|
200
|
+
meta: object;
|
|
201
|
+
}>;
|
|
202
|
+
getUsers: import('@trpc/server').TRPCQueryProcedure<{
|
|
203
|
+
input: void;
|
|
204
|
+
output: {
|
|
205
|
+
id: string;
|
|
206
|
+
email: string;
|
|
207
|
+
name: string | null;
|
|
208
|
+
avatarUrl: string | null;
|
|
209
|
+
role: "admin" | "member";
|
|
210
|
+
createdAt: Date;
|
|
211
|
+
}[];
|
|
212
|
+
meta: object;
|
|
213
|
+
}>;
|
|
214
|
+
getEligibleCampaign: import('@trpc/server').TRPCQueryProcedure<{
|
|
215
|
+
input: void;
|
|
216
|
+
output: {
|
|
217
|
+
id: string;
|
|
218
|
+
template: {
|
|
219
|
+
id: string;
|
|
220
|
+
name: string;
|
|
221
|
+
organizationId: string;
|
|
222
|
+
content: unknown;
|
|
223
|
+
createdBy: string;
|
|
224
|
+
createdAt: Date;
|
|
225
|
+
updatedAt: Date;
|
|
226
|
+
status: string;
|
|
227
|
+
};
|
|
228
|
+
} | null;
|
|
229
|
+
meta: object;
|
|
230
|
+
}>;
|
|
231
|
+
}>>>;
|
|
232
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
type ClientOptions = {
|
|
2
|
+
apiKey: string;
|
|
3
|
+
};
|
|
4
|
+
export declare const createBokoClient: (options: ClientOptions) => {
|
|
5
|
+
getEligibleCampaign: () => Promise<{
|
|
6
|
+
template: {
|
|
7
|
+
content: Readonly<{
|
|
8
|
+
id: string;
|
|
9
|
+
type: "root";
|
|
10
|
+
name: string;
|
|
11
|
+
isCollapsed: boolean;
|
|
12
|
+
props: Readonly<{
|
|
13
|
+
color: string;
|
|
14
|
+
}>;
|
|
15
|
+
children: readonly Readonly<{
|
|
16
|
+
id: string;
|
|
17
|
+
type: "row";
|
|
18
|
+
name: string;
|
|
19
|
+
isCollapsed: boolean;
|
|
20
|
+
props: Readonly<{
|
|
21
|
+
padding: Readonly<{
|
|
22
|
+
top: number;
|
|
23
|
+
right: number;
|
|
24
|
+
bottom: number;
|
|
25
|
+
left: number;
|
|
26
|
+
}>;
|
|
27
|
+
gap: number;
|
|
28
|
+
background: Readonly<{
|
|
29
|
+
color: string;
|
|
30
|
+
}>;
|
|
31
|
+
alignment: Readonly<{
|
|
32
|
+
horizontal: "default" | "start" | "center" | "end";
|
|
33
|
+
}>;
|
|
34
|
+
}>;
|
|
35
|
+
children: readonly Readonly<{
|
|
36
|
+
id: string;
|
|
37
|
+
type: "column";
|
|
38
|
+
name: string;
|
|
39
|
+
isCollapsed: boolean;
|
|
40
|
+
props: Readonly<{
|
|
41
|
+
flexChildSize: "default" | "equal" | "none";
|
|
42
|
+
alignment: Readonly<{
|
|
43
|
+
vertical: "start" | "center" | "end";
|
|
44
|
+
}>;
|
|
45
|
+
}>;
|
|
46
|
+
children: readonly (Readonly<{
|
|
47
|
+
id: string;
|
|
48
|
+
type: "spacer";
|
|
49
|
+
name: string;
|
|
50
|
+
isCollapsed: boolean;
|
|
51
|
+
props: Readonly<{
|
|
52
|
+
size: number;
|
|
53
|
+
}>;
|
|
54
|
+
}> | Readonly<{
|
|
55
|
+
id: string;
|
|
56
|
+
type: "text";
|
|
57
|
+
name: string;
|
|
58
|
+
isCollapsed: boolean;
|
|
59
|
+
props: Readonly<{
|
|
60
|
+
content: string;
|
|
61
|
+
type: "paragraph" | "heading-1" | "heading-2" | "heading-3" | "heading-4" | "heading-5" | "heading-6";
|
|
62
|
+
}>;
|
|
63
|
+
}> | Readonly<{
|
|
64
|
+
id: string;
|
|
65
|
+
type: "button";
|
|
66
|
+
name: string;
|
|
67
|
+
isCollapsed: boolean;
|
|
68
|
+
props: Readonly<{
|
|
69
|
+
title: string;
|
|
70
|
+
background: Readonly<{
|
|
71
|
+
color: Readonly<{
|
|
72
|
+
default: string;
|
|
73
|
+
hover: string;
|
|
74
|
+
}>;
|
|
75
|
+
}>;
|
|
76
|
+
text: Readonly<{
|
|
77
|
+
color: Readonly<{
|
|
78
|
+
default: string;
|
|
79
|
+
hover: string;
|
|
80
|
+
}>;
|
|
81
|
+
}>;
|
|
82
|
+
padding: Readonly<{
|
|
83
|
+
top: number;
|
|
84
|
+
right: number;
|
|
85
|
+
bottom: number;
|
|
86
|
+
left: number;
|
|
87
|
+
}>;
|
|
88
|
+
borderRadius: number;
|
|
89
|
+
fontSize: number;
|
|
90
|
+
fontWeight: number;
|
|
91
|
+
}>;
|
|
92
|
+
}>)[];
|
|
93
|
+
}>[];
|
|
94
|
+
}>[];
|
|
95
|
+
}>;
|
|
96
|
+
id: string;
|
|
97
|
+
name: string;
|
|
98
|
+
organizationId: string;
|
|
99
|
+
createdBy: string;
|
|
100
|
+
createdAt: Date;
|
|
101
|
+
updatedAt: Date;
|
|
102
|
+
status: string;
|
|
103
|
+
};
|
|
104
|
+
id: string;
|
|
105
|
+
} | null>;
|
|
106
|
+
};
|
|
107
|
+
export type EligibleCampaign = NonNullable<Awaited<ReturnType<ReturnType<typeof createBokoClient>["getEligibleCampaign"]>>>;
|
|
108
|
+
export {};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { createTRPCClient as r, httpBatchLink as a } from "@trpc/client";
|
|
2
|
+
import l from "superjson";
|
|
3
|
+
import { z as e } from "zod";
|
|
4
|
+
const i = ({ apiKey: n }) => r({
|
|
5
|
+
links: [
|
|
6
|
+
a({
|
|
7
|
+
transformer: l,
|
|
8
|
+
url: "https://boko-server-0d640b8d4fbf.herokuapp.com",
|
|
9
|
+
headers: () => ({
|
|
10
|
+
Authorization: `ApiKey ${n}`
|
|
11
|
+
})
|
|
12
|
+
})
|
|
13
|
+
]
|
|
14
|
+
}), d = 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
|
+
}).readonly()
|
|
22
|
+
}).readonly(), c = 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
|
+
}).readonly()
|
|
39
|
+
}).readonly(), s = 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
|
+
background: e.object({
|
|
47
|
+
color: e.object({
|
|
48
|
+
default: e.string(),
|
|
49
|
+
hover: e.string()
|
|
50
|
+
}).readonly()
|
|
51
|
+
}).readonly(),
|
|
52
|
+
text: e.object({
|
|
53
|
+
color: e.object({
|
|
54
|
+
default: e.string(),
|
|
55
|
+
hover: e.string()
|
|
56
|
+
}).readonly()
|
|
57
|
+
}).readonly(),
|
|
58
|
+
padding: e.object({
|
|
59
|
+
top: e.number(),
|
|
60
|
+
right: e.number(),
|
|
61
|
+
bottom: e.number(),
|
|
62
|
+
left: e.number()
|
|
63
|
+
}).readonly(),
|
|
64
|
+
borderRadius: e.number(),
|
|
65
|
+
fontSize: e.number().min(8).max(72).default(16),
|
|
66
|
+
fontWeight: e.number().min(100).max(900).multipleOf(100).default(400)
|
|
67
|
+
}).readonly()
|
|
68
|
+
}).readonly(), m = e.enum(["default", "equal", "none"]), p = e.enum(["start", "center", "end"]), b = e.object({
|
|
69
|
+
id: e.string(),
|
|
70
|
+
type: e.literal("column"),
|
|
71
|
+
name: e.string(),
|
|
72
|
+
isCollapsed: e.boolean(),
|
|
73
|
+
props: e.object({
|
|
74
|
+
flexChildSize: m,
|
|
75
|
+
alignment: e.object({
|
|
76
|
+
vertical: p
|
|
77
|
+
}).readonly()
|
|
78
|
+
}).readonly(),
|
|
79
|
+
children: e.array(
|
|
80
|
+
e.lazy(() => e.union([s, c, d]))
|
|
81
|
+
).readonly()
|
|
82
|
+
}).readonly(), g = e.enum([
|
|
83
|
+
"default",
|
|
84
|
+
"start",
|
|
85
|
+
"center",
|
|
86
|
+
"end"
|
|
87
|
+
]), u = e.object({
|
|
88
|
+
id: e.string(),
|
|
89
|
+
type: e.literal("row"),
|
|
90
|
+
name: e.string(),
|
|
91
|
+
isCollapsed: e.boolean(),
|
|
92
|
+
props: e.object({
|
|
93
|
+
padding: e.object({
|
|
94
|
+
top: e.number(),
|
|
95
|
+
right: e.number(),
|
|
96
|
+
bottom: e.number(),
|
|
97
|
+
left: e.number()
|
|
98
|
+
}).readonly(),
|
|
99
|
+
gap: e.number(),
|
|
100
|
+
background: e.object({
|
|
101
|
+
color: e.string()
|
|
102
|
+
}).readonly(),
|
|
103
|
+
alignment: e.object({
|
|
104
|
+
horizontal: g
|
|
105
|
+
}).readonly()
|
|
106
|
+
}).readonly(),
|
|
107
|
+
children: e.array(
|
|
108
|
+
e.lazy(() => b)
|
|
109
|
+
).readonly()
|
|
110
|
+
}).readonly(), y = e.object({
|
|
111
|
+
id: e.string(),
|
|
112
|
+
type: e.literal("root"),
|
|
113
|
+
name: e.string(),
|
|
114
|
+
isCollapsed: e.boolean(),
|
|
115
|
+
props: e.object({
|
|
116
|
+
color: e.string()
|
|
117
|
+
}).readonly(),
|
|
118
|
+
children: e.array(
|
|
119
|
+
e.lazy(() => u)
|
|
120
|
+
).readonly()
|
|
121
|
+
}).readonly(), C = (n) => {
|
|
122
|
+
const o = i({
|
|
123
|
+
apiKey: n.apiKey
|
|
124
|
+
});
|
|
125
|
+
return {
|
|
126
|
+
getEligibleCampaign: async () => {
|
|
127
|
+
const t = await o.getEligibleCampaign.query();
|
|
128
|
+
return t ? {
|
|
129
|
+
...t,
|
|
130
|
+
template: {
|
|
131
|
+
...t.template,
|
|
132
|
+
// TODO: Do we need to parse the content here or on procedure level?
|
|
133
|
+
content: y.parse(t.template.content)
|
|
134
|
+
}
|
|
135
|
+
} : null;
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
export {
|
|
140
|
+
C as createBokoClient
|
|
141
|
+
};
|
|
142
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/client.ts","../../../node_modules/.pnpm/@truecodeio+domain-shared@0.1.6/node_modules/@truecodeio/domain-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\n .object({\n id: z.string(),\n type: z.literal(\"spacer\"),\n name: z.string(),\n isCollapsed: z.boolean(),\n props: z\n .object({\n size: z.number(),\n })\n .readonly(),\n })\n .readonly();\n\nexport const textNodeSchema = z\n .object({\n id: z.string(),\n type: z.literal(\"text\"),\n name: z.string(),\n isCollapsed: z.boolean(),\n props: z\n .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 .readonly(),\n })\n .readonly();\n\nexport const buttonNodeSchema = z\n .object({\n id: z.string(),\n type: z.literal(\"button\"),\n name: z.string(),\n isCollapsed: z.boolean(),\n props: z\n .object({\n title: z.string(),\n background: z\n .object({\n color: z\n .object({\n default: z.string(),\n hover: z.string(),\n })\n .readonly(),\n })\n .readonly(),\n text: z\n .object({\n color: z\n .object({\n default: z.string(),\n hover: z.string(),\n })\n .readonly(),\n })\n .readonly(),\n padding: z\n .object({\n top: z.number(),\n right: z.number(),\n bottom: z.number(),\n left: z.number(),\n })\n .readonly(),\n borderRadius: z.number(),\n fontSize: z.number().min(8).max(72).default(16),\n fontWeight: z.number().min(100).max(900).multipleOf(100).default(400),\n })\n .readonly(),\n })\n .readonly();\n\nexport const flexChildSizeSchema = z.enum([\"default\", \"equal\", \"none\"]);\n\nexport const verticalAlignmentSchema = z.enum([\"start\", \"center\", \"end\"]);\n\nexport const columnNodeSchema = z\n .object({\n id: z.string(),\n type: z.literal(\"column\"),\n name: z.string(),\n isCollapsed: z.boolean(),\n props: z\n .object({\n flexChildSize: flexChildSizeSchema,\n alignment: z\n .object({\n vertical: verticalAlignmentSchema,\n })\n .readonly(),\n })\n .readonly(),\n children: z\n .array(\n z.lazy(() => {\n return z.union([buttonNodeSchema, textNodeSchema, spacerNodeSchema]);\n }),\n )\n .readonly(),\n })\n .readonly();\n\nexport const horizontalAlignmentSchema = z.enum([\n \"default\",\n \"start\",\n \"center\",\n \"end\",\n]);\n\nexport const rowNodeSchema = z\n .object({\n id: z.string(),\n type: z.literal(\"row\"),\n name: z.string(),\n isCollapsed: z.boolean(),\n props: z\n .object({\n padding: z\n .object({\n top: z.number(),\n right: z.number(),\n bottom: z.number(),\n left: z.number(),\n })\n .readonly(),\n gap: z.number(),\n background: z\n .object({\n color: z.string(),\n })\n .readonly(),\n alignment: z\n .object({\n horizontal: horizontalAlignmentSchema,\n })\n .readonly(),\n })\n .readonly(),\n children: z\n .array(\n z.lazy(() => {\n return columnNodeSchema;\n }),\n )\n .readonly(),\n })\n .readonly();\n\nexport const rootNodeSchema = z\n .object({\n id: z.string(),\n type: z.literal(\"root\"),\n name: z.string(),\n isCollapsed: z.boolean(),\n props: z\n .object({\n color: z.string(),\n })\n .readonly(),\n children: z\n .array(\n z.lazy(() => {\n return rowNodeSchema;\n }),\n )\n .readonly(),\n })\n .readonly();\n\nexport type ButtonNodeT = z.infer<typeof buttonNodeSchema>;\n\nexport type RootNodeT = z.infer<typeof rootNodeSchema>;\n\nexport type RowNodeT = z.infer<typeof rowNodeSchema>;\n\nexport type ColumnNodeT = z.infer<typeof columnNodeSchema>;\n\nexport type TextNodeT = z.infer<typeof textNodeSchema>;\n\nexport type SpacerNodeT = z.infer<typeof spacerNodeSchema>;\n\nexport type NodeT =\n | RootNodeT\n | RowNodeT\n | ColumnNodeT\n | ButtonNodeT\n | TextNodeT\n | SpacerNodeT;\n\ntype ChildrenNonContainableNodeT = ButtonNodeT | TextNodeT | SpacerNodeT;\n\nexport type ChildrenContainableNodeT = Exclude<\n NodeT,\n ChildrenNonContainableNodeT\n>;\n\nexport type ChildrenNodeT = Exclude<NodeT, RootNodeT>;\n\nexport type NodeByTypeT = {\n [N in NodeT as N[\"type\"]]: N;\n};\n","import { createClient } from \"./client.ts\";\nimport { rootNodeSchema } from \"@truecodeio/domain-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","flexChildSizeSchema","verticalAlignmentSchema","columnNodeSchema","horizontalAlignmentSchema","rowNodeSchema","rootNodeSchema","createBokoClient","options","client","eligibleCampaign"],"mappings":";;;AAQO,MAAMA,IAAe,CAAC,EAAE,QAAAC,QACtBC,EAA4B;AAAA,EACjC,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mB,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.8",
|
|
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
|
-
"@trpc/client": "^11.4.
|
|
9
|
-
"@trpc/server": "11.4.
|
|
10
|
-
"@truecodeio/
|
|
15
|
+
"@trpc/client": "^11.4.3",
|
|
16
|
+
"@trpc/server": "11.4.3",
|
|
17
|
+
"@truecodeio/domain-shared": "^0.1.6",
|
|
11
18
|
"superjson": "^2.2.2",
|
|
12
|
-
"zod": "^
|
|
19
|
+
"zod": "^4.0.5"
|
|
13
20
|
},
|
|
14
21
|
"devDependencies": {
|
|
15
|
-
"typescript-eslint": "^8.
|
|
16
|
-
"
|
|
17
|
-
"
|
|
22
|
+
"typescript-eslint": "^8.38.0",
|
|
23
|
+
"vite": "^7.0.5",
|
|
24
|
+
"vite-plugin-dts": "^4.5.4",
|
|
25
|
+
"@boko/eslint-config": "1.0.0",
|
|
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,43 +0,0 @@
|
|
|
1
|
-
# @boko/sdk-core
|
|
2
|
-
|
|
3
|
-
## 0.2.6
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- Update client-shared
|
|
8
|
-
|
|
9
|
-
## 0.2.5
|
|
10
|
-
|
|
11
|
-
### Patch Changes
|
|
12
|
-
|
|
13
|
-
- Add main field in package.json
|
|
14
|
-
|
|
15
|
-
## 0.2.4
|
|
16
|
-
|
|
17
|
-
### Patch Changes
|
|
18
|
-
|
|
19
|
-
- Remove workspace dependencies
|
|
20
|
-
|
|
21
|
-
## 0.2.3
|
|
22
|
-
|
|
23
|
-
### Patch Changes
|
|
24
|
-
|
|
25
|
-
- Bump dependencies; Add app-router-types.
|
|
26
|
-
|
|
27
|
-
## 0.2.2
|
|
28
|
-
|
|
29
|
-
### Patch Changes
|
|
30
|
-
|
|
31
|
-
- change package name
|
|
32
|
-
|
|
33
|
-
## 0.2.1
|
|
34
|
-
|
|
35
|
-
### Patch Changes
|
|
36
|
-
|
|
37
|
-
- Override access property
|
|
38
|
-
|
|
39
|
-
## 0.2.0
|
|
40
|
-
|
|
41
|
-
### Minor Changes
|
|
42
|
-
|
|
43
|
-
- 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/index.ts";
|
|
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,14 +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
|
-
}
|
|
12
|
-
},
|
|
13
|
-
"include": ["src"]
|
|
14
|
-
}
|