@openparser/lineage 1.0.2

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.
Files changed (67) hide show
  1. package/CHANGELOG.md +89 -0
  2. package/LICENSE +201 -0
  3. package/README.md +211 -0
  4. package/dist/activity.d.ts +74 -0
  5. package/dist/activity.d.ts.map +1 -0
  6. package/dist/approval.d.ts +24 -0
  7. package/dist/approval.d.ts.map +1 -0
  8. package/dist/builder.d.ts +48 -0
  9. package/dist/builder.d.ts.map +1 -0
  10. package/dist/common.d.ts +34 -0
  11. package/dist/common.d.ts.map +1 -0
  12. package/dist/confidence.d.ts +61 -0
  13. package/dist/confidence.d.ts.map +1 -0
  14. package/dist/derivation.d.ts +163 -0
  15. package/dist/derivation.d.ts.map +1 -0
  16. package/dist/document.d.ts +412 -0
  17. package/dist/document.d.ts.map +1 -0
  18. package/dist/entity.d.ts +126 -0
  19. package/dist/entity.d.ts.map +1 -0
  20. package/dist/fields.d.ts +76 -0
  21. package/dist/fields.d.ts.map +1 -0
  22. package/dist/index.d.ts +21 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +870 -0
  25. package/dist/labels.d.ts +11 -0
  26. package/dist/labels.d.ts.map +1 -0
  27. package/dist/profile/grounding.d.ts +34 -0
  28. package/dist/profile/grounding.d.ts.map +1 -0
  29. package/dist/profile/index.d.ts +14 -0
  30. package/dist/profile/index.d.ts.map +1 -0
  31. package/dist/profile/index.js +1298 -0
  32. package/dist/profile/labels.d.ts +10 -0
  33. package/dist/profile/labels.d.ts.map +1 -0
  34. package/dist/profile/recognition.d.ts +70 -0
  35. package/dist/profile/recognition.d.ts.map +1 -0
  36. package/dist/profile/transform-validation.d.ts +250 -0
  37. package/dist/profile/transform-validation.d.ts.map +1 -0
  38. package/dist/prov.d.ts +40 -0
  39. package/dist/prov.d.ts.map +1 -0
  40. package/dist/relation.d.ts +27 -0
  41. package/dist/relation.d.ts.map +1 -0
  42. package/dist/traverse.d.ts +12 -0
  43. package/dist/traverse.d.ts.map +1 -0
  44. package/dist/validate.d.ts +14 -0
  45. package/dist/validate.d.ts.map +1 -0
  46. package/lineage.schema.json +625 -0
  47. package/package.json +71 -0
  48. package/src/activity.ts +65 -0
  49. package/src/approval.ts +28 -0
  50. package/src/builder.ts +129 -0
  51. package/src/common.ts +58 -0
  52. package/src/confidence.ts +72 -0
  53. package/src/derivation.ts +81 -0
  54. package/src/document.ts +82 -0
  55. package/src/entity.ts +87 -0
  56. package/src/fields.ts +163 -0
  57. package/src/index.ts +123 -0
  58. package/src/labels.ts +13 -0
  59. package/src/profile/grounding.ts +74 -0
  60. package/src/profile/index.ts +67 -0
  61. package/src/profile/labels.ts +28 -0
  62. package/src/profile/recognition.ts +149 -0
  63. package/src/profile/transform-validation.ts +1379 -0
  64. package/src/prov.ts +205 -0
  65. package/src/relation.ts +32 -0
  66. package/src/traverse.ts +91 -0
  67. package/src/validate.ts +221 -0
@@ -0,0 +1,625 @@
1
+ {
2
+ "$id": "https://docs.openparser.dev/schemas/lineage/v1/schema.json",
3
+ "title": "lineage@1",
4
+ "description": "Complete data-derivation DAG wire format.",
5
+ "$comment": "Shape only. Graph validation additionally requires that every id reference resolves, that each derived entity has exactly one producer, that entity dependencies are acyclic, that member_of targets are collections, and that activity timestamps are ordered.",
6
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
7
+ "type": "object",
8
+ "properties": {
9
+ "format": {
10
+ "type": "string",
11
+ "const": "lineage@1"
12
+ },
13
+ "id": {
14
+ "$ref": "#/$defs/__schema0"
15
+ },
16
+ "profiles": {
17
+ "maxItems": 64,
18
+ "type": "array",
19
+ "items": {
20
+ "$ref": "#/$defs/__schema1"
21
+ }
22
+ },
23
+ "entities": {
24
+ "default": {},
25
+ "type": "object",
26
+ "propertyNames": {
27
+ "$ref": "#/$defs/__schema0"
28
+ },
29
+ "additionalProperties": {
30
+ "type": "object",
31
+ "properties": {
32
+ "kind": {
33
+ "type": "string",
34
+ "enum": ["value", "artifact", "evidence", "decision", "collection"]
35
+ },
36
+ "name": {
37
+ "type": "string",
38
+ "minLength": 1,
39
+ "maxLength": 512
40
+ },
41
+ "value": {
42
+ "$ref": "#/$defs/__schema2"
43
+ },
44
+ "path": {
45
+ "type": "string",
46
+ "maxLength": 2048,
47
+ "pattern": "^(?:\\/(?:[^~/]|~0|~1)*)*$"
48
+ },
49
+ "schema": {
50
+ "type": "object",
51
+ "propertyNames": {
52
+ "type": "string"
53
+ },
54
+ "additionalProperties": {
55
+ "$ref": "#/$defs/__schema2"
56
+ }
57
+ },
58
+ "locator": {
59
+ "type": "object",
60
+ "properties": {
61
+ "uri": {
62
+ "type": "string",
63
+ "minLength": 1,
64
+ "maxLength": 4096
65
+ },
66
+ "mediaType": {
67
+ "type": "string",
68
+ "minLength": 1,
69
+ "maxLength": 256
70
+ },
71
+ "digest": {
72
+ "$ref": "#/$defs/__schema3"
73
+ },
74
+ "attributes": {
75
+ "$ref": "#/$defs/__schema4"
76
+ }
77
+ },
78
+ "required": ["uri"],
79
+ "additionalProperties": false
80
+ },
81
+ "selector": {
82
+ "type": "object",
83
+ "properties": {
84
+ "type": {
85
+ "type": "string",
86
+ "minLength": 1,
87
+ "maxLength": 128
88
+ },
89
+ "value": {
90
+ "$ref": "#/$defs/__schema2"
91
+ },
92
+ "attributes": {
93
+ "$ref": "#/$defs/__schema4"
94
+ }
95
+ },
96
+ "required": ["type", "value"],
97
+ "additionalProperties": false
98
+ },
99
+ "digest": {
100
+ "$ref": "#/$defs/__schema3"
101
+ },
102
+ "confidence": {
103
+ "maxItems": 64,
104
+ "type": "array",
105
+ "items": {
106
+ "$ref": "#/$defs/__schema5"
107
+ }
108
+ },
109
+ "approvals": {
110
+ "maxItems": 64,
111
+ "type": "array",
112
+ "items": {
113
+ "$ref": "#/$defs/__schema19"
114
+ }
115
+ },
116
+ "attributions": {
117
+ "maxItems": 64,
118
+ "type": "array",
119
+ "items": {
120
+ "$ref": "#/$defs/__schema20"
121
+ }
122
+ },
123
+ "attributes": {
124
+ "$ref": "#/$defs/__schema4"
125
+ }
126
+ },
127
+ "required": ["kind"],
128
+ "additionalProperties": false
129
+ }
130
+ },
131
+ "activities": {
132
+ "default": {},
133
+ "type": "object",
134
+ "propertyNames": {
135
+ "$ref": "#/$defs/__schema0"
136
+ },
137
+ "additionalProperties": {
138
+ "type": "object",
139
+ "properties": {
140
+ "type": {
141
+ "type": "string",
142
+ "minLength": 1,
143
+ "maxLength": 256
144
+ },
145
+ "name": {
146
+ "type": "string",
147
+ "minLength": 1,
148
+ "maxLength": 512
149
+ },
150
+ "status": {
151
+ "type": "string",
152
+ "enum": ["scheduled", "started", "ended", "failed", "cancelled"]
153
+ },
154
+ "startedAt": {
155
+ "$ref": "#/$defs/__schema21"
156
+ },
157
+ "endedAt": {
158
+ "$ref": "#/$defs/__schema21"
159
+ },
160
+ "implementation": {
161
+ "type": "object",
162
+ "properties": {
163
+ "type": {
164
+ "type": "string",
165
+ "minLength": 1,
166
+ "maxLength": 128
167
+ },
168
+ "name": {
169
+ "type": "string",
170
+ "minLength": 1,
171
+ "maxLength": 512
172
+ },
173
+ "version": {
174
+ "type": "string",
175
+ "minLength": 1,
176
+ "maxLength": 128
177
+ },
178
+ "uri": {
179
+ "type": "string",
180
+ "minLength": 1,
181
+ "maxLength": 4096
182
+ },
183
+ "attributes": {
184
+ "$ref": "#/$defs/__schema4"
185
+ }
186
+ },
187
+ "additionalProperties": false
188
+ },
189
+ "parameters": {
190
+ "type": "object",
191
+ "propertyNames": {
192
+ "type": "string",
193
+ "minLength": 1
194
+ },
195
+ "additionalProperties": {
196
+ "$ref": "#/$defs/__schema2"
197
+ }
198
+ },
199
+ "associations": {
200
+ "maxItems": 64,
201
+ "type": "array",
202
+ "items": {
203
+ "$ref": "#/$defs/__schema22"
204
+ }
205
+ },
206
+ "attributes": {
207
+ "$ref": "#/$defs/__schema4"
208
+ }
209
+ },
210
+ "required": ["type"],
211
+ "additionalProperties": false
212
+ }
213
+ },
214
+ "agents": {
215
+ "default": {},
216
+ "type": "object",
217
+ "propertyNames": {
218
+ "$ref": "#/$defs/__schema0"
219
+ },
220
+ "additionalProperties": {
221
+ "type": "object",
222
+ "properties": {
223
+ "type": {
224
+ "type": "string",
225
+ "minLength": 1,
226
+ "maxLength": 128
227
+ },
228
+ "name": {
229
+ "type": "string",
230
+ "minLength": 1,
231
+ "maxLength": 512
232
+ },
233
+ "attributes": {
234
+ "$ref": "#/$defs/__schema4"
235
+ }
236
+ },
237
+ "additionalProperties": false
238
+ }
239
+ },
240
+ "derivations": {
241
+ "default": [],
242
+ "maxItems": 100000,
243
+ "type": "array",
244
+ "items": {
245
+ "$ref": "#/$defs/__schema23"
246
+ }
247
+ },
248
+ "relations": {
249
+ "default": [],
250
+ "maxItems": 100000,
251
+ "type": "array",
252
+ "items": {
253
+ "$ref": "#/$defs/__schema25"
254
+ }
255
+ },
256
+ "outputs": {
257
+ "default": [],
258
+ "maxItems": 10000,
259
+ "type": "array",
260
+ "items": {
261
+ "$ref": "#/$defs/__schema0"
262
+ }
263
+ },
264
+ "attributes": {
265
+ "$ref": "#/$defs/__schema4"
266
+ }
267
+ },
268
+ "required": ["format"],
269
+ "additionalProperties": false,
270
+ "$defs": {
271
+ "__schema0": {
272
+ "type": "string",
273
+ "minLength": 1,
274
+ "maxLength": 512
275
+ },
276
+ "__schema1": {
277
+ "type": "string",
278
+ "minLength": 1,
279
+ "maxLength": 1024
280
+ },
281
+ "__schema2": {
282
+ "anyOf": [
283
+ {
284
+ "type": "string"
285
+ },
286
+ {
287
+ "type": "number"
288
+ },
289
+ {
290
+ "type": "boolean"
291
+ },
292
+ {
293
+ "type": "null"
294
+ },
295
+ {
296
+ "type": "array",
297
+ "items": {
298
+ "$ref": "#/$defs/__schema2"
299
+ }
300
+ },
301
+ {
302
+ "type": "object",
303
+ "propertyNames": {
304
+ "type": "string"
305
+ },
306
+ "additionalProperties": {
307
+ "$ref": "#/$defs/__schema2"
308
+ }
309
+ }
310
+ ]
311
+ },
312
+ "__schema3": {
313
+ "type": "object",
314
+ "properties": {
315
+ "algorithm": {
316
+ "type": "string",
317
+ "minLength": 1,
318
+ "maxLength": 64
319
+ },
320
+ "value": {
321
+ "type": "string",
322
+ "minLength": 1,
323
+ "maxLength": 512
324
+ }
325
+ },
326
+ "required": ["algorithm", "value"],
327
+ "additionalProperties": false
328
+ },
329
+ "__schema4": {
330
+ "type": "object",
331
+ "propertyNames": {
332
+ "type": "string",
333
+ "minLength": 1
334
+ },
335
+ "additionalProperties": {
336
+ "$ref": "#/$defs/__schema2"
337
+ }
338
+ },
339
+ "__schema5": {
340
+ "type": "object",
341
+ "properties": {
342
+ "score": {
343
+ "$ref": "#/$defs/__schema6"
344
+ },
345
+ "scale": {
346
+ "$ref": "#/$defs/__schema7"
347
+ },
348
+ "kind": {
349
+ "$ref": "#/$defs/__schema10"
350
+ },
351
+ "scope": {
352
+ "$ref": "#/$defs/__schema11"
353
+ },
354
+ "granularity": {
355
+ "$ref": "#/$defs/__schema12"
356
+ },
357
+ "calibrated": {
358
+ "$ref": "#/$defs/__schema13"
359
+ },
360
+ "sources": {
361
+ "$ref": "#/$defs/__schema14"
362
+ },
363
+ "method": {
364
+ "$ref": "#/$defs/__schema16"
365
+ },
366
+ "sampleCount": {
367
+ "$ref": "#/$defs/__schema17"
368
+ },
369
+ "attributes": {
370
+ "$ref": "#/$defs/__schema18"
371
+ }
372
+ },
373
+ "required": ["score", "scale", "kind", "scope"],
374
+ "additionalProperties": false
375
+ },
376
+ "__schema6": {
377
+ "type": "number"
378
+ },
379
+ "__schema7": {
380
+ "type": "object",
381
+ "properties": {
382
+ "min": {
383
+ "$ref": "#/$defs/__schema8"
384
+ },
385
+ "max": {
386
+ "$ref": "#/$defs/__schema9"
387
+ }
388
+ },
389
+ "required": ["min", "max"],
390
+ "additionalProperties": false
391
+ },
392
+ "__schema8": {
393
+ "type": "number"
394
+ },
395
+ "__schema9": {
396
+ "type": "number"
397
+ },
398
+ "__schema10": {
399
+ "type": "string",
400
+ "enum": ["reported", "derived", "assessed"]
401
+ },
402
+ "__schema11": {
403
+ "type": "string",
404
+ "minLength": 1,
405
+ "maxLength": 128
406
+ },
407
+ "__schema12": {
408
+ "type": "string",
409
+ "minLength": 1,
410
+ "maxLength": 128
411
+ },
412
+ "__schema13": {
413
+ "default": false,
414
+ "type": "boolean"
415
+ },
416
+ "__schema14": {
417
+ "maxItems": 256,
418
+ "type": "array",
419
+ "items": {
420
+ "$ref": "#/$defs/__schema15"
421
+ }
422
+ },
423
+ "__schema15": {
424
+ "type": "object",
425
+ "properties": {
426
+ "type": {
427
+ "type": "string",
428
+ "enum": ["entity", "activity", "agent"]
429
+ },
430
+ "id": {
431
+ "$ref": "#/$defs/__schema0"
432
+ }
433
+ },
434
+ "required": ["type", "id"],
435
+ "additionalProperties": false
436
+ },
437
+ "__schema16": {
438
+ "type": "string",
439
+ "minLength": 1,
440
+ "maxLength": 256
441
+ },
442
+ "__schema17": {
443
+ "type": "integer",
444
+ "exclusiveMinimum": 0,
445
+ "maximum": 9007199254740991
446
+ },
447
+ "__schema18": {
448
+ "$ref": "#/$defs/__schema4"
449
+ },
450
+ "__schema19": {
451
+ "type": "object",
452
+ "properties": {
453
+ "agent": {
454
+ "$ref": "#/$defs/__schema0"
455
+ },
456
+ "at": {
457
+ "type": "string",
458
+ "format": "date-time",
459
+ "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))$"
460
+ },
461
+ "note": {
462
+ "type": "string",
463
+ "minLength": 1,
464
+ "maxLength": 2000
465
+ },
466
+ "attributes": {
467
+ "$ref": "#/$defs/__schema4"
468
+ }
469
+ },
470
+ "required": ["agent", "at"],
471
+ "additionalProperties": false
472
+ },
473
+ "__schema20": {
474
+ "type": "object",
475
+ "properties": {
476
+ "agent": {
477
+ "$ref": "#/$defs/__schema0"
478
+ },
479
+ "role": {
480
+ "type": "string",
481
+ "minLength": 1,
482
+ "maxLength": 128
483
+ },
484
+ "attributes": {
485
+ "$ref": "#/$defs/__schema4"
486
+ }
487
+ },
488
+ "required": ["agent"],
489
+ "additionalProperties": false
490
+ },
491
+ "__schema21": {
492
+ "type": "string",
493
+ "maxLength": 64,
494
+ "format": "date-time",
495
+ "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)))$"
496
+ },
497
+ "__schema22": {
498
+ "type": "object",
499
+ "properties": {
500
+ "agent": {
501
+ "$ref": "#/$defs/__schema0"
502
+ },
503
+ "role": {
504
+ "type": "string",
505
+ "minLength": 1,
506
+ "maxLength": 128
507
+ },
508
+ "attributes": {
509
+ "$ref": "#/$defs/__schema4"
510
+ }
511
+ },
512
+ "required": ["agent"],
513
+ "additionalProperties": false
514
+ },
515
+ "__schema23": {
516
+ "type": "object",
517
+ "properties": {
518
+ "id": {
519
+ "$ref": "#/$defs/__schema0"
520
+ },
521
+ "output": {
522
+ "$ref": "#/$defs/__schema0"
523
+ },
524
+ "activity": {
525
+ "$ref": "#/$defs/__schema0"
526
+ },
527
+ "inputs": {
528
+ "default": [],
529
+ "maxItems": 1024,
530
+ "type": "array",
531
+ "items": {
532
+ "$ref": "#/$defs/__schema24"
533
+ }
534
+ },
535
+ "transformation": {
536
+ "type": "object",
537
+ "properties": {
538
+ "type": {
539
+ "type": "string",
540
+ "minLength": 1,
541
+ "maxLength": 128
542
+ },
543
+ "description": {
544
+ "type": "string",
545
+ "minLength": 1,
546
+ "maxLength": 4096
547
+ },
548
+ "expression": {
549
+ "type": "string",
550
+ "minLength": 1,
551
+ "maxLength": 8192
552
+ },
553
+ "masking": {
554
+ "type": "boolean"
555
+ },
556
+ "attributes": {
557
+ "$ref": "#/$defs/__schema4"
558
+ }
559
+ },
560
+ "additionalProperties": false
561
+ },
562
+ "confidence": {
563
+ "$ref": "#/$defs/__schema5"
564
+ },
565
+ "attributes": {
566
+ "$ref": "#/$defs/__schema4"
567
+ }
568
+ },
569
+ "required": ["output", "activity"],
570
+ "additionalProperties": false
571
+ },
572
+ "__schema24": {
573
+ "type": "object",
574
+ "properties": {
575
+ "entity": {
576
+ "$ref": "#/$defs/__schema0"
577
+ },
578
+ "role": {
579
+ "type": "string",
580
+ "minLength": 1,
581
+ "maxLength": 128
582
+ },
583
+ "effect": {
584
+ "default": "direct",
585
+ "type": "string",
586
+ "enum": ["direct", "indirect"]
587
+ },
588
+ "confidence": {
589
+ "$ref": "#/$defs/__schema5"
590
+ },
591
+ "attributes": {
592
+ "$ref": "#/$defs/__schema4"
593
+ }
594
+ },
595
+ "required": ["entity"],
596
+ "additionalProperties": false
597
+ },
598
+ "__schema25": {
599
+ "type": "object",
600
+ "properties": {
601
+ "type": {
602
+ "$ref": "#/$defs/__schema26"
603
+ },
604
+ "source": {
605
+ "$ref": "#/$defs/__schema0"
606
+ },
607
+ "target": {
608
+ "$ref": "#/$defs/__schema0"
609
+ },
610
+ "attributes": {
611
+ "$ref": "#/$defs/__schema27"
612
+ }
613
+ },
614
+ "required": ["type", "source", "target"],
615
+ "additionalProperties": false
616
+ },
617
+ "__schema26": {
618
+ "type": "string",
619
+ "enum": ["member_of", "specialization_of", "alternate_of"]
620
+ },
621
+ "__schema27": {
622
+ "$ref": "#/$defs/__schema4"
623
+ }
624
+ }
625
+ }
package/package.json ADDED
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "@openparser/lineage",
3
+ "version": "1.0.2",
4
+ "description": "Zod schemas, validation, and helpers for lineage@1 complete data-derivation DAGs",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "sideEffects": false,
9
+ "engines": {
10
+ "node": ">=20"
11
+ },
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "bun": "./src/index.ts",
16
+ "import": "./dist/index.js",
17
+ "default": "./dist/index.js"
18
+ },
19
+ "./openparser": {
20
+ "types": "./dist/profile/index.d.ts",
21
+ "bun": "./src/profile/index.ts",
22
+ "import": "./dist/profile/index.js",
23
+ "default": "./dist/profile/index.js"
24
+ },
25
+ "./schema.json": "./lineage.schema.json"
26
+ },
27
+ "files": [
28
+ "dist",
29
+ "src",
30
+ "!src/**/*.test.ts",
31
+ "lineage.schema.json",
32
+ "CHANGELOG.md",
33
+ "README.md",
34
+ "LICENSE"
35
+ ],
36
+ "scripts": {},
37
+ "dependencies": {
38
+ "decimal.js": "10.6.0",
39
+ "luxon": "3.7.2",
40
+ "zod": "^4.4.3"
41
+ },
42
+ "devDependencies": {
43
+ "@types/luxon": "3.7.4",
44
+ "esbuild": "^0.25.12",
45
+ "prettier": "3.8.1",
46
+ "typescript": "^6.0.3"
47
+ },
48
+ "publishConfig": {
49
+ "access": "public"
50
+ },
51
+ "author": {
52
+ "name": "EigenPal",
53
+ "email": "support@eigenpal.com",
54
+ "url": "https://openparser.dev"
55
+ },
56
+ "repository": {
57
+ "type": "git",
58
+ "url": "git+https://github.com/eigenpal/openparser.git",
59
+ "directory": "packages/lineage"
60
+ },
61
+ "homepage": "https://docs.openparser.dev",
62
+ "license": "Apache-2.0",
63
+ "keywords": [
64
+ "lineage",
65
+ "provenance",
66
+ "prov",
67
+ "dag",
68
+ "zod",
69
+ "openparser"
70
+ ]
71
+ }