@gitgov/core 1.9.0 → 1.10.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.
@@ -334,7 +334,7 @@ interface ExecutionRecord<TMetadata = object> {
334
334
  /**
335
335
  * Canonical schema for feedback records - structured conversation about work
336
336
  */
337
- interface FeedbackRecord {
337
+ interface FeedbackRecord<TMetadata = object> {
338
338
  /**
339
339
  * Unique identifier for the feedback entry
340
340
  */
@@ -377,6 +377,13 @@ interface FeedbackRecord {
377
377
  * Optional. The ID of another feedback record that this one resolves or responds to
378
378
  */
379
379
  resolvesFeedbackId?: string;
380
+ /**
381
+ * Optional structured data for machine consumption.
382
+ * Use this field for domain-specific data that needs to be programmatically processed.
383
+ * Common use cases: waiver details (fingerprint, ruleId, file, line), approval context, assignment metadata.
384
+ *
385
+ */
386
+ metadata?: TMetadata;
380
387
  }
381
388
 
382
389
  /**
@@ -772,7 +779,7 @@ type index$m_EmbeddedMetadataRecord<T extends GitGovRecordPayload> = EmbeddedMet
772
779
  type index$m_ExecutionPayload = ExecutionPayload;
773
780
  type index$m_ExecutionRecord<TMetadata = object> = ExecutionRecord<TMetadata>;
774
781
  type index$m_FeedbackPayload = FeedbackPayload;
775
- type index$m_FeedbackRecord = FeedbackRecord;
782
+ type index$m_FeedbackRecord<TMetadata = object> = FeedbackRecord<TMetadata>;
776
783
  type index$m_GitGovActorRecord = GitGovActorRecord;
777
784
  type index$m_GitGovAgentRecord = GitGovAgentRecord;
778
785
  type index$m_GitGovChangelogRecord = GitGovChangelogRecord;
@@ -3810,12 +3817,14 @@ declare function createChangelogRecord(payload: Partial<ChangelogRecord>): Chang
3810
3817
  declare function loadChangelogRecord(data: unknown): GitGovChangelogRecord;
3811
3818
 
3812
3819
  /**
3813
- * Creates a complete FeedbackRecord with validation
3820
+ * Creates a complete FeedbackRecord with validation.
3821
+ *
3822
+ * The factory is generic to preserve the metadata type for compile-time safety.
3814
3823
  *
3815
- * @param payload - Partial FeedbackRecord payload
3816
- * @returns FeedbackRecord - The validated FeedbackRecord
3824
+ * @param payload - Partial FeedbackRecord payload with optional typed metadata
3825
+ * @returns FeedbackRecord<TMetadata> - The validated FeedbackRecord with preserved metadata type
3817
3826
  */
3818
- declare function createFeedbackRecord(payload: Partial<FeedbackRecord>): FeedbackRecord;
3827
+ declare function createFeedbackRecord<TMetadata extends object = object>(payload: Partial<FeedbackRecord<TMetadata>>): FeedbackRecord<TMetadata>;
3819
3828
  /**
3820
3829
  * Loads and validates an existing FeedbackRecord from untrusted data.
3821
3830
  * Used by RecordStore to validate records when reading from disk.
@@ -5811,6 +5820,18 @@ declare const Schemas: {
5811
5820
  description: string;
5812
5821
  examples: string[];
5813
5822
  };
5823
+ metadata: {
5824
+ type: string;
5825
+ additionalProperties: boolean;
5826
+ description: string;
5827
+ examples: {
5828
+ fingerprint: string;
5829
+ ruleId: string;
5830
+ file: string;
5831
+ line: number;
5832
+ expiresAt: string;
5833
+ }[];
5834
+ };
5814
5835
  };
5815
5836
  examples: ({
5816
5837
  id: string;
@@ -7642,6 +7663,18 @@ declare function getSchema(name: SchemaName): {
7642
7663
  description: string;
7643
7664
  examples: string[];
7644
7665
  };
7666
+ metadata: {
7667
+ type: string;
7668
+ additionalProperties: boolean;
7669
+ description: string;
7670
+ examples: {
7671
+ fingerprint: string;
7672
+ ruleId: string;
7673
+ file: string;
7674
+ line: number;
7675
+ expiresAt: string;
7676
+ }[];
7677
+ };
7645
7678
  };
7646
7679
  examples: ({
7647
7680
  id: string;
package/dist/src/index.js CHANGED
@@ -1634,6 +1634,20 @@ var feedback_record_schema_default = {
1634
1634
  examples: [
1635
1635
  "1752788100-feedback-blocking-rest-api"
1636
1636
  ]
1637
+ },
1638
+ metadata: {
1639
+ type: "object",
1640
+ additionalProperties: true,
1641
+ description: "Optional structured data for machine consumption.\nUse this field for domain-specific data that needs to be programmatically processed.\nCommon use cases: waiver details (fingerprint, ruleId, file, line), approval context, assignment metadata.\n",
1642
+ examples: [
1643
+ {
1644
+ fingerprint: "abc123def456",
1645
+ ruleId: "PII-001",
1646
+ file: "src/user.ts",
1647
+ line: 42,
1648
+ expiresAt: "2025-12-31T23:59:59Z"
1649
+ }
1650
+ ]
1637
1651
  }
1638
1652
  },
1639
1653
  examples: [
@@ -4101,7 +4115,7 @@ function createFeedbackRecord(payload) {
4101
4115
  content: payload.content || "",
4102
4116
  assignee: payload.assignee,
4103
4117
  resolvesFeedbackId: payload.resolvesFeedbackId,
4104
- ...payload
4118
+ metadata: payload.metadata
4105
4119
  };
4106
4120
  const validation = validateFeedbackRecordDetailed(feedback);
4107
4121
  if (!validation.isValid) {