@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,11 @@
1
+ import type { Activity } from './activity.js';
2
+ /**
3
+ * Display label for an activity: an explicit `name` when a producer set one,
4
+ * otherwise the raw `type`.
5
+ *
6
+ * `type` is an open string. Core `lineage@1` does not map vendor activity types
7
+ * to presentation copy — OpenParser-friendly names live in
8
+ * `@openparser/lineage/openparser`.
9
+ */
10
+ export declare function activityLabel(activity: Activity): string;
11
+ //# sourceMappingURL=labels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../src/labels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAExD"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Whether a field's evidence is sufficient, as the OpenParser profile defines it.
3
+ *
4
+ * `lineage@1` records what a value was derived from; it takes no position on when
5
+ * that is enough, because "enough" depends on what the producer was able to
6
+ * resolve. OpenParser answers it with one attribute on the producer derivation —
7
+ * the source ids the model named that could not be resolved to a region — so the
8
+ * rule reads a `openparser:` key and belongs here rather than in the protocol.
9
+ */
10
+ import type { Derivation } from '../derivation.js';
11
+ import type { LineageDocument } from '../document.js';
12
+ /** Whether a field is backed by source evidence, partially backed, or unbacked. */
13
+ export type GroundingStatus = 'grounded' | 'partial' | 'ungrounded';
14
+ export type FieldGrounding = {
15
+ status: GroundingStatus;
16
+ /** Source ids the producer cited but could not resolve to a region. */
17
+ droppedSourceIds: string[];
18
+ };
19
+ /** Source ids the producer named but could not resolve to a region. */
20
+ export declare function droppedSourceIds(producer: Derivation | undefined): string[];
21
+ /**
22
+ * Grounding is read off the graph rather than stored: the evidence a value
23
+ * actually reaches, less the sources its producer could not resolve.
24
+ *
25
+ * Callers that already walked to the evidence pass the count, since how far a
26
+ * given consumer follows the graph is its own business.
27
+ */
28
+ export declare function groundingStatus(options: {
29
+ evidenceCount: number;
30
+ droppedSourceIds: string[];
31
+ }): GroundingStatus;
32
+ /** Grounding for the field at a JSON Pointer, walking the graph to its evidence. */
33
+ export declare function fieldGrounding(doc: LineageDocument, pointer: string): FieldGrounding | undefined;
34
+ //# sourceMappingURL=grounding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grounding.d.ts","sourceRoot":"","sources":["../../src/profile/grounding.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAMnD,mFAAmF;AACnF,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,SAAS,GAAG,YAAY,CAAC;AAEpE,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,eAAe,CAAC;IACxB,uEAAuE;IACvE,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAC;AAEF,uEAAuE;AACvE,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,UAAU,GAAG,SAAS,GAAG,MAAM,EAAE,CAG3E;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE;IACvC,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B,GAAG,eAAe,CAGlB;AAiBD,oFAAoF;AACpF,wBAAgB,cAAc,CAAC,GAAG,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAUhG"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The OpenParser profile of `lineage@1`, published as `@openparser/lineage/openparser`.
3
+ *
4
+ * `lineage@1` is a vendor-neutral record of where values came from. Anything that
5
+ * depends on how OpenParser in particular scores an OCR word, or on an
6
+ * `openparser:` attribute, lives here — so the protocol surface stays readable as
7
+ * a protocol, and a producer that is not OpenParser is never asked to adopt our
8
+ * conventions to use it.
9
+ */
10
+ export { activityLabel } from './labels.js';
11
+ export { droppedSourceIds, fieldGrounding, groundingStatus, type FieldGrounding, type GroundingStatus, } from './grounding.js';
12
+ export { CITED_RECOGNITION_METHOD, CONTEXT_BLEND_WEIGHT, REGION_RECOGNITION_METHOD, aggregateCitedWordConfidences, annotateWordsWithCitation, citedSpanInText, downwardBlendCitedMinimum, type CitedWordAggregate, type ScoredWord, } from './recognition.js';
13
+ export { DATE_SOURCE_CATALOG_ID, DATE_SOURCE_CATALOG_V1, DATE_SOURCE_CATALOG_VERSION, FORMAT_ONLY_DATE_TARGETS, MAX_TRANSFORM_INTENT_PARAMETER_BYTES, MAX_TRANSFORM_PROOF_BYTES, TRANSFORM_DOCS_ANCHORS, TRANSFORM_OPERATIONS, TRANSFORM_PROOF_ATTRIBUTE, TRANSFORM_PROOF_OPERAND_KEYS, TRANSFORM_VALIDATORS, TRANSFORM_VERIFICATION_DOCS, TransformClaimSchema, TransformIntentSchema, TransformProofClassSchema, TransformProofSchema, dateTimeFormatIssue, formatOnlyDateTimeParameters, isTrustedTransformDocsHref, parseTransformProof, transformValidatorDescriptor, trustedDateSourceFormats, trustedIntentParametersFitProof, trustedTransformDocsHref, verifyTransform, type DateTimeKind, type TransformClaim, type TransformIntent, type TransformOperation, type TransformProof, type TransformProofClass, type TransformValidatorDescriptor, type TransformVerificationResult, } from './transform-validation.js';
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/profile/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,KAAK,cAAc,EACnB,KAAK,eAAe,GACrB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,yBAAyB,EACzB,6BAA6B,EAC7B,yBAAyB,EACzB,eAAe,EACf,yBAAyB,EACzB,KAAK,kBAAkB,EACvB,KAAK,UAAU,GAChB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,2BAA2B,EAC3B,wBAAwB,EACxB,oCAAoC,EACpC,yBAAyB,EACzB,sBAAsB,EACtB,oBAAoB,EACpB,yBAAyB,EACzB,4BAA4B,EAC5B,oBAAoB,EACpB,2BAA2B,EAC3B,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACnB,4BAA4B,EAC5B,0BAA0B,EAC1B,mBAAmB,EACnB,4BAA4B,EAC5B,wBAAwB,EACxB,+BAA+B,EAC/B,wBAAwB,EACxB,eAAe,EACf,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,4BAA4B,EACjC,KAAK,2BAA2B,GACjC,MAAM,wBAAwB,CAAC"}