@learncard/helpers 1.0.20 → 1.1.1
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/helpers.cjs.development.js +46 -2
- package/dist/helpers.cjs.development.js.map +2 -2
- package/dist/helpers.cjs.production.min.js +1 -1
- package/dist/helpers.cjs.production.min.js.map +3 -3
- package/dist/helpers.d.ts +6 -0
- package/dist/helpers.esm.js +46 -2
- package/dist/helpers.esm.js.map +2 -2
- package/package.json +3 -2
package/dist/helpers.d.ts
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
// Generated by dts-bundle-generator v6.13.0
|
2
2
|
|
3
|
+
import { DataTransformer } from '@trpc/server';
|
4
|
+
|
3
5
|
declare const JWEValidator: z.ZodObject<{
|
4
6
|
protected: z.ZodString;
|
5
7
|
iv: z.ZodString;
|
@@ -165,5 +167,9 @@ export type JWE = z.infer<typeof JWEValidator>;
|
|
165
167
|
export declare const isHex: (str: string) => boolean;
|
166
168
|
/** Determines whether or not an object is an encrypted JWE */
|
167
169
|
export declare const isEncrypted: (item: Record<string, any>) => item is JWE;
|
170
|
+
/**
|
171
|
+
* tRPC data transformer that handles RegExp serialization/deserialization
|
172
|
+
*/
|
173
|
+
export declare const RegExpTransformer: DataTransformer;
|
168
174
|
|
169
175
|
export {};
|
package/dist/helpers.esm.js
CHANGED
@@ -100,6 +100,7 @@ var require_types_cjs_development = __commonJS({
|
|
100
100
|
LCNNotificationTypeEnumValidator: () => LCNNotificationTypeEnumValidator,
|
101
101
|
LCNNotificationValidator: () => LCNNotificationValidator,
|
102
102
|
LCNProfileConnectionStatusEnum: () => LCNProfileConnectionStatusEnum,
|
103
|
+
LCNProfileDisplayValidator: () => LCNProfileDisplayValidator,
|
103
104
|
LCNProfileQueryValidator: () => LCNProfileQueryValidator,
|
104
105
|
LCNProfileValidator: () => LCNProfileValidator,
|
105
106
|
LCNSigningAuthorityForUserValidator: () => LCNSigningAuthorityForUserValidator,
|
@@ -3905,6 +3906,19 @@ var require_types_cjs_development = __commonJS({
|
|
3905
3906
|
})
|
3906
3907
|
);
|
3907
3908
|
var StringQuery = mod.string().or(mod.object({ $in: mod.string().array() })).or(mod.object({ $regex: RegExpValidator }));
|
3909
|
+
var LCNProfileDisplayValidator = mod.object({
|
3910
|
+
backgroundColor: mod.string().optional(),
|
3911
|
+
backgroundImage: mod.string().optional(),
|
3912
|
+
fadeBackgroundImage: mod.boolean().optional(),
|
3913
|
+
repeatBackgroundImage: mod.boolean().optional(),
|
3914
|
+
fontColor: mod.string().optional(),
|
3915
|
+
accentColor: mod.string().optional(),
|
3916
|
+
accentFontColor: mod.string().optional(),
|
3917
|
+
idBackgroundImage: mod.string().optional(),
|
3918
|
+
fadeIdBackgroundImage: mod.boolean().optional(),
|
3919
|
+
idBackgroundColor: mod.string().optional(),
|
3920
|
+
repeatIdBackgroundImage: mod.boolean().optional()
|
3921
|
+
});
|
3908
3922
|
var LCNProfileValidator = mod.object({
|
3909
3923
|
profileId: mod.string().min(3).max(40),
|
3910
3924
|
displayName: mod.string().default(""),
|
@@ -3917,7 +3931,8 @@ var require_types_cjs_development = __commonJS({
|
|
3917
3931
|
websiteLink: mod.string().optional(),
|
3918
3932
|
isServiceProfile: mod.boolean().default(false).optional(),
|
3919
3933
|
type: mod.string().optional(),
|
3920
|
-
notificationsWebhook: mod.string().url().startsWith("http").optional()
|
3934
|
+
notificationsWebhook: mod.string().url().startsWith("http").optional(),
|
3935
|
+
display: LCNProfileDisplayValidator.optional()
|
3921
3936
|
});
|
3922
3937
|
var LCNProfileQueryValidator = mod.object({
|
3923
3938
|
profileId: StringQuery,
|
@@ -3984,7 +3999,8 @@ var require_types_cjs_development = __commonJS({
|
|
3984
3999
|
var BoostRecipientValidator = mod.object({
|
3985
4000
|
to: LCNProfileValidator,
|
3986
4001
|
from: mod.string(),
|
3987
|
-
received: mod.string().optional()
|
4002
|
+
received: mod.string().optional(),
|
4003
|
+
uri: mod.string().optional()
|
3988
4004
|
});
|
3989
4005
|
var PaginatedBoostRecipientsValidator = PaginationResponseValidator.extend({
|
3990
4006
|
records: BoostRecipientValidator.array()
|
@@ -4188,7 +4204,35 @@ var isHex = /* @__PURE__ */ __name((str) => /^[0-9a-f]+$/i.test(str), "isHex");
|
|
4188
4204
|
var isEncrypted = /* @__PURE__ */ __name((item) => {
|
4189
4205
|
return import_types.JWEValidator.safeParse(item).success;
|
4190
4206
|
}, "isEncrypted");
|
4207
|
+
var RegExpTransformer = {
|
4208
|
+
serialize(object) {
|
4209
|
+
return JSON.stringify(object, (_key, value) => {
|
4210
|
+
if (value instanceof RegExp)
|
4211
|
+
return value.toString();
|
4212
|
+
return value;
|
4213
|
+
});
|
4214
|
+
},
|
4215
|
+
deserialize(object) {
|
4216
|
+
if (typeof object !== "string")
|
4217
|
+
return object;
|
4218
|
+
return JSON.parse(object, (_key, value) => {
|
4219
|
+
if (typeof value === "string") {
|
4220
|
+
const match = value.match(/^\/(.*)\/([gimsuy]*)$/);
|
4221
|
+
if (match) {
|
4222
|
+
try {
|
4223
|
+
return new RegExp(match[1], match[2]);
|
4224
|
+
} catch (error) {
|
4225
|
+
console.warn(`Failed to parse RegExp: ${error}`);
|
4226
|
+
return value;
|
4227
|
+
}
|
4228
|
+
}
|
4229
|
+
}
|
4230
|
+
return value;
|
4231
|
+
});
|
4232
|
+
}
|
4233
|
+
};
|
4191
4234
|
export {
|
4235
|
+
RegExpTransformer,
|
4192
4236
|
isEncrypted,
|
4193
4237
|
isHex
|
4194
4238
|
};
|