@shware/analytics 0.1.1 → 0.1.3
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/index.d.mts +5 -2
- package/dist/index.mjs +11 -4
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -28,6 +28,7 @@ declare function setVisitor(properties: VisitorProperties): Promise<Visitor>;
|
|
|
28
28
|
|
|
29
29
|
declare const createTrackEventSchema: z.ZodObject<{
|
|
30
30
|
name: z.ZodString;
|
|
31
|
+
visitor_id: z.ZodBigInt;
|
|
31
32
|
tags: z.ZodObject<{
|
|
32
33
|
os: z.ZodOptional<z.ZodString>;
|
|
33
34
|
os_name: z.ZodOptional<z.ZodString>;
|
|
@@ -113,8 +114,9 @@ declare const createTrackEventSchema: z.ZodObject<{
|
|
|
113
114
|
utm_term?: string | undefined;
|
|
114
115
|
utm_content?: string | undefined;
|
|
115
116
|
}>;
|
|
116
|
-
properties: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
|
|
117
|
+
properties: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>, Record<string, string | number | boolean | null>, Record<string, string | number | boolean | null>>;
|
|
117
118
|
}, "strip", z.ZodTypeAny, {
|
|
119
|
+
visitor_id: bigint;
|
|
118
120
|
name: string;
|
|
119
121
|
tags: {
|
|
120
122
|
os?: string | undefined;
|
|
@@ -147,6 +149,7 @@ declare const createTrackEventSchema: z.ZodObject<{
|
|
|
147
149
|
};
|
|
148
150
|
properties: Record<string, string | number | boolean | null>;
|
|
149
151
|
}, {
|
|
152
|
+
visitor_id: bigint;
|
|
150
153
|
name: string;
|
|
151
154
|
tags: {
|
|
152
155
|
os?: string | undefined;
|
|
@@ -181,7 +184,7 @@ declare const createTrackEventSchema: z.ZodObject<{
|
|
|
181
184
|
}>;
|
|
182
185
|
declare const createVisitorSchema: z.ZodObject<{
|
|
183
186
|
device_id: z.ZodString;
|
|
184
|
-
properties: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
|
|
187
|
+
properties: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>, Record<string, string | number | boolean | null>, Record<string, string | number | boolean | null>>;
|
|
185
188
|
}, "strip", z.ZodTypeAny, {
|
|
186
189
|
device_id: string;
|
|
187
190
|
properties: Record<string, string | number | boolean | null>;
|
package/dist/index.mjs
CHANGED
|
@@ -92,6 +92,7 @@ function track(name, properties, trackOptions = defaultOptions) {
|
|
|
92
92
|
|
|
93
93
|
const createTrackEventSchema = z.object({
|
|
94
94
|
name: z.string().trim().min(1).max(64),
|
|
95
|
+
visitor_id: z.coerce.bigint(),
|
|
95
96
|
tags: z.object({
|
|
96
97
|
os: z.string().optional(),
|
|
97
98
|
os_name: z.string().optional(),
|
|
@@ -123,15 +124,21 @@ const createTrackEventSchema = z.object({
|
|
|
123
124
|
}),
|
|
124
125
|
properties: z.record(
|
|
125
126
|
z.string().trim().min(1).max(128),
|
|
126
|
-
z.union([z.string(), z.number(), z.boolean(), z.null()])
|
|
127
|
-
)
|
|
127
|
+
z.union([z.string().max(512), z.number(), z.boolean(), z.null()])
|
|
128
|
+
).refine((data) => Object.keys(data).length <= 64)
|
|
128
129
|
});
|
|
129
130
|
const createVisitorSchema = z.object({
|
|
130
131
|
device_id: z.string().trim().min(1).max(36),
|
|
131
132
|
properties: z.record(
|
|
132
133
|
z.string().trim().min(1).max(128),
|
|
133
|
-
z.union([z.string(), z.number(), z.boolean(), z.null()])
|
|
134
|
-
)
|
|
134
|
+
z.union([z.string().max(512), z.number(), z.boolean(), z.null()])
|
|
135
|
+
).refine((data) => Object.keys(data).length <= 64)
|
|
136
|
+
});
|
|
137
|
+
z.object({
|
|
138
|
+
properties: z.record(
|
|
139
|
+
z.string().trim().min(1).max(128),
|
|
140
|
+
z.union([z.string().max(512), z.number(), z.boolean(), z.null()])
|
|
141
|
+
).refine((data) => Object.keys(data).length <= 64)
|
|
135
142
|
});
|
|
136
143
|
|
|
137
144
|
export { createTrackEventSchema, createVisitorSchema, getVisitor, setVisitor, setupAnalytics, track };
|