@mirafive/protocol 0.0.0-stage → 2.0.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/package.json CHANGED
@@ -1,6 +1,65 @@
1
1
  {
2
2
  "name": "@mirafive/protocol",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "2.0.1",
4
+ "description": "The MIRA FIVE wire format: event and batch types, limits, eventIdFor and the helpers every MIRA FIVE SDK shares. No dependencies.",
5
+ "keywords": [
6
+ "analytics",
7
+ "attribution",
8
+ "mira-five",
9
+ "mirafive",
10
+ "protocol",
11
+ "schema"
12
+ ],
13
+ "homepage": "https://github.com/mirafive/protocol#readme",
14
+ "bugs": {
15
+ "url": "https://github.com/mirafive/protocol/issues"
16
+ },
17
+ "license": "MIT",
18
+ "author": "Cloo GmbH <hallo@mirafive.io> (https://mirafive.io)",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/mirafive/protocol.git"
22
+ },
23
+ "bin": {
24
+ "mirafive-validate": "./dist/cli.js"
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "fixtures",
29
+ "schema"
30
+ ],
31
+ "type": "module",
32
+ "sideEffects": false,
33
+ "main": "./dist/index.js",
34
+ "types": "./dist/index.d.ts",
35
+ "exports": {
36
+ ".": {
37
+ "types": "./dist/index.d.ts",
38
+ "default": "./dist/index.js"
39
+ },
40
+ "./batch.schema.json": "./schema/batch.schema.json",
41
+ "./package.json": "./package.json",
42
+ "./fixtures/*": "./fixtures/*"
43
+ },
44
+ "publishConfig": {
45
+ "access": "public",
46
+ "provenance": true
47
+ },
48
+ "scripts": {
49
+ "build": "bun run build.ts",
50
+ "check": "bun run format:check && bun run lint && bun run typecheck && bun run test && bun run build",
51
+ "format": "oxfmt",
52
+ "format:check": "oxfmt --check",
53
+ "lint": "oxlint",
54
+ "test": "bun test",
55
+ "typecheck": "bun check"
56
+ },
57
+ "devDependencies": {
58
+ "@types/bun": "^1.4.4",
59
+ "oxfmt": "^0.77.0",
60
+ "oxlint": "^1.92.0",
61
+ "oxlint-tsgolint": "^7.0.2006",
62
+ "typescript": "^7.0.2"
63
+ },
64
+ "packageManager": "bun@1.4.4"
65
+ }
@@ -0,0 +1,444 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "key": {
6
+ "type": "string",
7
+ "maxLength": 100
8
+ },
9
+ "sent_at": {
10
+ "type": "string",
11
+ "format": "date-time",
12
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
13
+ },
14
+ "stream": {
15
+ "type": "string",
16
+ "minLength": 1,
17
+ "maxLength": 64
18
+ },
19
+ "seq": {
20
+ "type": "integer",
21
+ "exclusiveMinimum": 0,
22
+ "maximum": 2147483647
23
+ },
24
+ "events": {
25
+ "minItems": 1,
26
+ "maxItems": 100,
27
+ "type": "array",
28
+ "items": {
29
+ "type": "object",
30
+ "properties": {
31
+ "event_id": {
32
+ "type": "string",
33
+ "format": "uuid",
34
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
35
+ },
36
+ "type": {
37
+ "type": "string",
38
+ "enum": ["track", "page", "screen", "identify", "group"]
39
+ },
40
+ "event": {
41
+ "type": "string",
42
+ "minLength": 1,
43
+ "maxLength": 120,
44
+ "pattern": "^\\P{Cc}+$"
45
+ },
46
+ "timestamp": {
47
+ "type": "string",
48
+ "format": "date-time",
49
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
50
+ },
51
+ "anonymous_id": {
52
+ "type": "string",
53
+ "maxLength": 200
54
+ },
55
+ "user_id": {
56
+ "type": "string",
57
+ "maxLength": 200
58
+ },
59
+ "session_id": {
60
+ "type": "string",
61
+ "maxLength": 200
62
+ },
63
+ "group_id": {
64
+ "type": "string",
65
+ "maxLength": 200
66
+ },
67
+ "properties": {
68
+ "default": {},
69
+ "type": "object",
70
+ "propertyNames": {
71
+ "type": "string",
72
+ "minLength": 1,
73
+ "maxLength": 100
74
+ },
75
+ "additionalProperties": {
76
+ "anyOf": [
77
+ {
78
+ "type": "string",
79
+ "maxLength": 2048
80
+ },
81
+ {
82
+ "type": "number"
83
+ },
84
+ {
85
+ "type": "boolean"
86
+ },
87
+ {
88
+ "type": "null"
89
+ },
90
+ {
91
+ "maxItems": 50,
92
+ "type": "array",
93
+ "items": {
94
+ "anyOf": [
95
+ {
96
+ "type": "string",
97
+ "maxLength": 2048
98
+ },
99
+ {
100
+ "type": "number"
101
+ },
102
+ {
103
+ "type": "boolean"
104
+ }
105
+ ]
106
+ }
107
+ }
108
+ ]
109
+ }
110
+ },
111
+ "traits": {
112
+ "type": "object",
113
+ "propertyNames": {
114
+ "type": "string",
115
+ "minLength": 1,
116
+ "maxLength": 100
117
+ },
118
+ "additionalProperties": {
119
+ "anyOf": [
120
+ {
121
+ "type": "string",
122
+ "maxLength": 2048
123
+ },
124
+ {
125
+ "type": "number"
126
+ },
127
+ {
128
+ "type": "boolean"
129
+ },
130
+ {
131
+ "type": "null"
132
+ },
133
+ {
134
+ "maxItems": 50,
135
+ "type": "array",
136
+ "items": {
137
+ "anyOf": [
138
+ {
139
+ "type": "string",
140
+ "maxLength": 2048
141
+ },
142
+ {
143
+ "type": "number"
144
+ },
145
+ {
146
+ "type": "boolean"
147
+ }
148
+ ]
149
+ }
150
+ }
151
+ ]
152
+ }
153
+ },
154
+ "external_ids": {
155
+ "type": "object",
156
+ "propertyNames": {
157
+ "type": "string",
158
+ "enum": [
159
+ "stripe_customer",
160
+ "revenuecat_app_user",
161
+ "shopify_customer",
162
+ "shopware_customer"
163
+ ]
164
+ },
165
+ "additionalProperties": {
166
+ "type": "string",
167
+ "minLength": 1,
168
+ "maxLength": 200
169
+ }
170
+ },
171
+ "revenue": {
172
+ "type": "object",
173
+ "properties": {
174
+ "amount": {
175
+ "type": "integer",
176
+ "minimum": -1000000000000000,
177
+ "maximum": 1000000000000000
178
+ },
179
+ "currency": {
180
+ "type": "string",
181
+ "minLength": 3,
182
+ "maxLength": 3
183
+ },
184
+ "entry_id": {
185
+ "type": "string",
186
+ "maxLength": 200
187
+ },
188
+ "kind": {
189
+ "type": "string",
190
+ "enum": ["charge", "subscription_payment", "refund", "dispute", "dispute_won"]
191
+ },
192
+ "fee": {
193
+ "type": "integer",
194
+ "minimum": -1000000000000000,
195
+ "maximum": 1000000000000000
196
+ },
197
+ "tax": {
198
+ "type": "integer",
199
+ "minimum": -1000000000000000,
200
+ "maximum": 1000000000000000
201
+ },
202
+ "refund_of": {
203
+ "type": "string",
204
+ "maxLength": 200
205
+ },
206
+ "product": {
207
+ "type": "string",
208
+ "maxLength": 200
209
+ },
210
+ "subscription": {
211
+ "type": "object",
212
+ "properties": {
213
+ "id": {
214
+ "type": "string",
215
+ "minLength": 1,
216
+ "maxLength": 200
217
+ },
218
+ "interval": {
219
+ "default": "month",
220
+ "type": "string",
221
+ "enum": ["day", "week", "month", "year"]
222
+ },
223
+ "interval_count": {
224
+ "default": 1,
225
+ "type": "integer",
226
+ "minimum": 1,
227
+ "maximum": 36
228
+ },
229
+ "period_start": {
230
+ "type": "string",
231
+ "format": "date-time",
232
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
233
+ },
234
+ "period_end": {
235
+ "type": "string",
236
+ "format": "date-time",
237
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
238
+ }
239
+ },
240
+ "required": ["id"]
241
+ }
242
+ },
243
+ "required": ["amount", "currency"]
244
+ },
245
+ "context": {
246
+ "default": {},
247
+ "type": "object",
248
+ "properties": {
249
+ "page": {
250
+ "type": "object",
251
+ "properties": {
252
+ "url": {
253
+ "type": "string",
254
+ "maxLength": 4096
255
+ },
256
+ "referrer": {
257
+ "type": "string",
258
+ "maxLength": 4096
259
+ },
260
+ "title": {
261
+ "type": "string",
262
+ "maxLength": 2048
263
+ }
264
+ }
265
+ },
266
+ "app": {
267
+ "type": "object",
268
+ "properties": {
269
+ "name": {
270
+ "type": "string",
271
+ "maxLength": 2048
272
+ },
273
+ "version": {
274
+ "type": "string",
275
+ "maxLength": 2048
276
+ },
277
+ "build": {
278
+ "type": "string",
279
+ "maxLength": 2048
280
+ },
281
+ "namespace": {
282
+ "type": "string",
283
+ "maxLength": 2048
284
+ }
285
+ }
286
+ },
287
+ "device": {
288
+ "type": "object",
289
+ "properties": {
290
+ "type": {
291
+ "type": "string",
292
+ "enum": ["desktop", "mobile", "tablet", "tv", "other"]
293
+ },
294
+ "manufacturer": {
295
+ "type": "string",
296
+ "maxLength": 2048
297
+ },
298
+ "model": {
299
+ "type": "string",
300
+ "maxLength": 2048
301
+ }
302
+ }
303
+ },
304
+ "os": {
305
+ "type": "object",
306
+ "properties": {
307
+ "name": {
308
+ "type": "string",
309
+ "maxLength": 2048
310
+ },
311
+ "version": {
312
+ "type": "string",
313
+ "maxLength": 2048
314
+ }
315
+ }
316
+ },
317
+ "screen": {
318
+ "type": "object",
319
+ "properties": {
320
+ "width": {
321
+ "type": "integer",
322
+ "minimum": 0,
323
+ "maximum": 20000
324
+ },
325
+ "height": {
326
+ "type": "integer",
327
+ "minimum": 0,
328
+ "maximum": 20000
329
+ },
330
+ "density": {
331
+ "type": "number",
332
+ "exclusiveMinimum": 0,
333
+ "maximum": 10
334
+ }
335
+ }
336
+ },
337
+ "viewport": {
338
+ "type": "object",
339
+ "properties": {
340
+ "width": {
341
+ "type": "integer",
342
+ "minimum": 0,
343
+ "maximum": 20000
344
+ },
345
+ "height": {
346
+ "type": "integer",
347
+ "minimum": 0,
348
+ "maximum": 20000
349
+ }
350
+ }
351
+ },
352
+ "locale": {
353
+ "type": "string",
354
+ "maxLength": 35
355
+ },
356
+ "languages": {
357
+ "maxItems": 10,
358
+ "type": "array",
359
+ "items": {
360
+ "type": "string",
361
+ "maxLength": 35
362
+ }
363
+ },
364
+ "timezone": {
365
+ "type": "string",
366
+ "maxLength": 64
367
+ },
368
+ "location": {
369
+ "type": "object",
370
+ "properties": {
371
+ "latitude": {
372
+ "type": "number",
373
+ "minimum": -90,
374
+ "maximum": 90
375
+ },
376
+ "longitude": {
377
+ "type": "number",
378
+ "minimum": -180,
379
+ "maximum": 180
380
+ }
381
+ },
382
+ "required": ["latitude", "longitude"]
383
+ },
384
+ "library": {
385
+ "type": "object",
386
+ "properties": {
387
+ "name": {
388
+ "type": "string",
389
+ "maxLength": 50
390
+ },
391
+ "version": {
392
+ "type": "string",
393
+ "maxLength": 30
394
+ }
395
+ },
396
+ "required": ["name", "version"]
397
+ },
398
+ "ip": {
399
+ "type": "string",
400
+ "maxLength": 45
401
+ },
402
+ "user_agent": {
403
+ "type": "string",
404
+ "maxLength": 1024
405
+ }
406
+ }
407
+ },
408
+ "consent": {
409
+ "default": {
410
+ "analytics": "unknown",
411
+ "marketing": "unknown"
412
+ },
413
+ "anyOf": [
414
+ {
415
+ "type": "object",
416
+ "properties": {
417
+ "analytics": {
418
+ "type": "string",
419
+ "enum": ["granted", "denied", "unknown"]
420
+ },
421
+ "marketing": {
422
+ "default": "unknown",
423
+ "type": "string",
424
+ "enum": ["granted", "denied", "unknown"]
425
+ }
426
+ },
427
+ "required": ["analytics"]
428
+ },
429
+ {
430
+ "type": "string",
431
+ "const": "not_applicable"
432
+ }
433
+ ]
434
+ }
435
+ },
436
+ "required": ["event_id", "type", "event"]
437
+ }
438
+ }
439
+ },
440
+ "required": ["events"],
441
+ "$id": "https://mirafive.io/schema/batch.schema.json",
442
+ "title": "MIRA FIVE batch",
443
+ "description": "A batch of events for POST https://events.mirafive.io/v1/batch (Authorization: Bearer <key>). Generated from the ingest's own schema."
444
+ }