@defarm/sdk 0.1.4 → 0.1.5

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/modules.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { DefarmHttpClient } from "./client.js";
2
- import { AuthResponse, Circuit, DisclosureRequest, DisclosureResponse, Event, Item, ReceiptSummary } from "./types.js";
2
+ import { AuthResponse, Circuit, DisclosureRequest, DisclosureResponse, Event, Item, PartnerIntakeResponse, ReceiptSummary } from "./types.js";
3
3
  export declare class AuthApi {
4
4
  private readonly http;
5
5
  constructor(http: DefarmHttpClient);
@@ -33,6 +33,12 @@ export declare class ItemsApi {
33
33
  list(circuitId?: string): Promise<Item[]>;
34
34
  show(id: string): Promise<unknown>;
35
35
  create(payload: Record<string, unknown>): Promise<unknown>;
36
+ createViaIngestion(payload: {
37
+ source_circuit_id: string;
38
+ item: Record<string, unknown>;
39
+ auto_create_circuit?: boolean;
40
+ fallback_to_source_circuit?: boolean;
41
+ }): Promise<PartnerIntakeResponse>;
36
42
  update(id: string, payload: Record<string, unknown>): Promise<unknown>;
37
43
  }
38
44
  export declare class EventsApi {
package/dist/modules.js CHANGED
@@ -65,6 +65,14 @@ export class ItemsApi {
65
65
  async create(payload) {
66
66
  return this.http.request("POST", "/api/items", payload);
67
67
  }
68
+ async createViaIngestion(payload) {
69
+ return this.http.request("POST", "/v1/partner/ingestions", {
70
+ source_circuit_id: payload.source_circuit_id,
71
+ auto_create_circuit: payload.auto_create_circuit ?? false,
72
+ fallback_to_source_circuit: payload.fallback_to_source_circuit ?? true,
73
+ items: [payload.item],
74
+ });
75
+ }
68
76
  async update(id, payload) {
69
77
  return this.http.request("PUT", `/api/items/${id}`, payload);
70
78
  }
package/dist/types.d.ts CHANGED
@@ -43,6 +43,54 @@ export interface Item {
43
43
  status: string;
44
44
  metadata?: Record<string, unknown>;
45
45
  }
46
+ export interface PartnerIntakeRoute {
47
+ route_type: string;
48
+ route_value: string;
49
+ circuit_id?: string;
50
+ rows: number;
51
+ status: string;
52
+ items: number;
53
+ }
54
+ export interface PartnerIntakeItem {
55
+ dfid?: string;
56
+ url?: string;
57
+ partner_reference?: string;
58
+ asset_reference?: {
59
+ identifier_type: string;
60
+ value: string;
61
+ };
62
+ routes: PartnerIntakeRoute[];
63
+ }
64
+ export interface PartnerIntakeError {
65
+ row_index?: number;
66
+ partner_reference?: string;
67
+ reason_code: string;
68
+ message: string;
69
+ value_chain?: string;
70
+ identifier_type?: string;
71
+ identifier_value?: string;
72
+ }
73
+ export interface PartnerIntakeResponse {
74
+ dry_run?: boolean;
75
+ ingestion_id?: string;
76
+ summary: {
77
+ status: string;
78
+ total_rows: number;
79
+ processed_rows: number;
80
+ unresolved_rows: number;
81
+ routes: number;
82
+ items: number;
83
+ created_circuits: number;
84
+ impacted_circuits: number;
85
+ items_created: number;
86
+ items_enriched: number;
87
+ events_detected?: number;
88
+ warnings?: string[];
89
+ };
90
+ items: PartnerIntakeItem[];
91
+ errors: PartnerIntakeError[];
92
+ routes: PartnerIntakeRoute[];
93
+ }
46
94
  export interface Event {
47
95
  id: string;
48
96
  event_type: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defarm/sdk",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "DeFarm SDK for CLI and partner integrations",
5
5
  "license": "MIT",
6
6
  "repository": {