@igris-security/sdk 0.1.0

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.
@@ -0,0 +1,14 @@
1
+ import type { IgrisConfig, McpConfig, McpConfigOptions } from "./types";
2
+ import { VirtualKeysResource } from "./resources/virtual-keys";
3
+ import { PoliciesResource } from "./resources/policies";
4
+ import { AuditEventsResource } from "./resources/audit-events";
5
+ export declare class Igris {
6
+ private apiKey;
7
+ private baseUrl;
8
+ readonly virtualKeys: VirtualKeysResource;
9
+ readonly policies: PoliciesResource;
10
+ readonly auditEvents: AuditEventsResource;
11
+ constructor(config: IgrisConfig);
12
+ getMcpConfig(virtualKeySlug: string, options?: McpConfigOptions): McpConfig;
13
+ }
14
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAExE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAI/D,qBAAa,KAAK;IACjB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAS;IAExB,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAC;IAC1C,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAC;gBAE9B,MAAM,EAAE,WAAW;IAU/B,YAAY,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,SAAS;CAG/E"}
package/dist/client.js ADDED
@@ -0,0 +1,24 @@
1
+ import { buildMcpConfig } from "./config";
2
+ import { VirtualKeysResource } from "./resources/virtual-keys";
3
+ import { PoliciesResource } from "./resources/policies";
4
+ import { AuditEventsResource } from "./resources/audit-events";
5
+ const DEFAULT_BASE_URL = "https://gateway.igris.dev";
6
+ export class Igris {
7
+ apiKey;
8
+ baseUrl;
9
+ virtualKeys;
10
+ policies;
11
+ auditEvents;
12
+ constructor(config) {
13
+ this.apiKey = config.apiKey;
14
+ const base = (config.baseUrl ?? DEFAULT_BASE_URL).replace(/\/$/, "");
15
+ this.baseUrl = base;
16
+ this.virtualKeys = new VirtualKeysResource(base, config.apiKey);
17
+ this.policies = new PoliciesResource(base, config.apiKey);
18
+ this.auditEvents = new AuditEventsResource(base, config.apiKey);
19
+ }
20
+ getMcpConfig(virtualKeySlug, options = {}) {
21
+ return buildMcpConfig(this.apiKey, this.baseUrl, virtualKeySlug, options);
22
+ }
23
+ }
24
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,gBAAgB,GAAG,2BAA2B,CAAC;AAErD,MAAM,OAAO,KAAK;IACT,MAAM,CAAS;IACf,OAAO,CAAS;IAEf,WAAW,CAAsB;IACjC,QAAQ,CAAmB;IAC3B,WAAW,CAAsB;IAE1C,YAAY,MAAmB;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,MAAM,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,IAAI,gBAAgB,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACrE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QAEpB,IAAI,CAAC,WAAW,GAAG,IAAI,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QAChE,IAAI,CAAC,QAAQ,GAAG,IAAI,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QAC1D,IAAI,CAAC,WAAW,GAAG,IAAI,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IACjE,CAAC;IAED,YAAY,CAAC,cAAsB,EAAE,UAA4B,EAAE;QAClE,OAAO,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;IAC3E,CAAC;CACD"}
@@ -0,0 +1,3 @@
1
+ import type { McpConfig, McpConfigOptions } from "./types";
2
+ export declare function buildMcpConfig(apiKey: string, baseUrl: string, virtualKeySlug: string, options?: McpConfigOptions): McpConfig;
3
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG3D,wBAAgB,cAAc,CAC7B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,EACtB,OAAO,GAAE,gBAAqB,GAC5B,SAAS,CAMX"}
package/dist/config.js ADDED
@@ -0,0 +1,9 @@
1
+ import { buildIgrisHeaders } from "./utils/headers";
2
+ export function buildMcpConfig(apiKey, baseUrl, virtualKeySlug, options = {}) {
3
+ const base = baseUrl.replace(/\/$/, "");
4
+ return {
5
+ url: `${base}/v1/mcp/${virtualKeySlug}`,
6
+ headers: buildIgrisHeaders(apiKey, options),
7
+ };
8
+ }
9
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,MAAM,UAAU,cAAc,CAC7B,MAAc,EACd,OAAe,EACf,cAAsB,EACtB,UAA4B,EAAE;IAE9B,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACxC,OAAO;QACN,GAAG,EAAE,GAAG,IAAI,WAAW,cAAc,EAAE;QACvC,OAAO,EAAE,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC;KAC3C,CAAC;AACH,CAAC"}
@@ -0,0 +1,9 @@
1
+ export { Igris } from "./client";
2
+ export { buildMcpConfig } from "./config";
3
+ export { generateTraceId } from "./utils/trace";
4
+ export { buildIgrisHeaders } from "./utils/headers";
5
+ export { VirtualKeysResource } from "./resources/virtual-keys";
6
+ export { PoliciesResource } from "./resources/policies";
7
+ export { AuditEventsResource } from "./resources/audit-events";
8
+ export type * from "./types";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,mBAAmB,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ export { Igris } from "./client";
2
+ export { buildMcpConfig } from "./config";
3
+ export { generateTraceId } from "./utils/trace";
4
+ export { buildIgrisHeaders } from "./utils/headers";
5
+ export { VirtualKeysResource } from "./resources/virtual-keys";
6
+ export { PoliciesResource } from "./resources/policies";
7
+ export { AuditEventsResource } from "./resources/audit-events";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { AuditEvent, PaginatedResponse } from "../types";
2
+ export declare class AuditEventsResource {
3
+ private baseUrl;
4
+ private apiKey;
5
+ constructor(baseUrl: string, apiKey: string);
6
+ private headers;
7
+ list(params?: {
8
+ userId?: string;
9
+ traceId?: string;
10
+ virtualKey?: string;
11
+ limit?: number;
12
+ offset?: number;
13
+ }): Promise<PaginatedResponse<AuditEvent>>;
14
+ }
15
+ //# sourceMappingURL=audit-events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-events.d.ts","sourceRoot":"","sources":["../../src/resources/audit-events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE9D,qBAAa,mBAAmB;IAE9B,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,MAAM;gBADN,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM;IAGvB,OAAO,CAAC,OAAO;IAOT,IAAI,CAAC,MAAM,CAAC,EAAE;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;KAChB,GAAG,OAAO,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;CAW1C"}
@@ -0,0 +1,32 @@
1
+ export class AuditEventsResource {
2
+ baseUrl;
3
+ apiKey;
4
+ constructor(baseUrl, apiKey) {
5
+ this.baseUrl = baseUrl;
6
+ this.apiKey = apiKey;
7
+ }
8
+ headers() {
9
+ return {
10
+ Authorization: `Bearer ${this.apiKey}`,
11
+ "Content-Type": "application/json",
12
+ };
13
+ }
14
+ async list(params) {
15
+ const url = new URL(`${this.baseUrl}/api/v1/audit-events`);
16
+ if (params?.userId)
17
+ url.searchParams.set("userId", params.userId);
18
+ if (params?.traceId)
19
+ url.searchParams.set("traceId", params.traceId);
20
+ if (params?.virtualKey)
21
+ url.searchParams.set("virtualKey", params.virtualKey);
22
+ if (params?.limit)
23
+ url.searchParams.set("limit", String(params.limit));
24
+ if (params?.offset)
25
+ url.searchParams.set("offset", String(params.offset));
26
+ const res = await fetch(url.toString(), { headers: this.headers() });
27
+ if (!res.ok)
28
+ throw new Error(`Failed to list audit events: ${res.status}`);
29
+ return res.json();
30
+ }
31
+ }
32
+ //# sourceMappingURL=audit-events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-events.js","sourceRoot":"","sources":["../../src/resources/audit-events.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,mBAAmB;IAEtB;IACA;IAFT,YACS,OAAe,EACf,MAAc;QADd,YAAO,GAAP,OAAO,CAAQ;QACf,WAAM,GAAN,MAAM,CAAQ;IACpB,CAAC;IAEI,OAAO;QACd,OAAO;YACN,aAAa,EAAE,UAAU,IAAI,CAAC,MAAM,EAAE;YACtC,cAAc,EAAE,kBAAkB;SAClC,CAAC;IACH,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,MAMV;QACA,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,sBAAsB,CAAC,CAAC;QAC3D,IAAI,MAAM,EAAE,MAAM;YAAE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QAClE,IAAI,MAAM,EAAE,OAAO;YAAE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QACrE,IAAI,MAAM,EAAE,UAAU;YAAE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;QAC9E,IAAI,MAAM,EAAE,KAAK;YAAE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACvE,IAAI,MAAM,EAAE,MAAM;YAAE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;QAC1E,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACrE,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;QAC3E,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;IACnB,CAAC;CACD"}
@@ -0,0 +1,12 @@
1
+ import type { Policy, PaginatedResponse } from "../types";
2
+ export declare class PoliciesResource {
3
+ private baseUrl;
4
+ private apiKey;
5
+ constructor(baseUrl: string, apiKey: string);
6
+ private headers;
7
+ list(params?: {
8
+ virtualKeySlug?: string;
9
+ }): Promise<PaginatedResponse<Policy>>;
10
+ get(id: string): Promise<Policy>;
11
+ }
12
+ //# sourceMappingURL=policies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policies.d.ts","sourceRoot":"","sources":["../../src/resources/policies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE1D,qBAAa,gBAAgB;IAE3B,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,MAAM;gBADN,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM;IAGvB,OAAO,CAAC,OAAO;IAOT,IAAI,CAAC,MAAM,CAAC,EAAE;QACnB,cAAc,CAAC,EAAE,MAAM,CAAC;KACxB,GAAG,OAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAQhC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAQtC"}
@@ -0,0 +1,33 @@
1
+ export class PoliciesResource {
2
+ baseUrl;
3
+ apiKey;
4
+ constructor(baseUrl, apiKey) {
5
+ this.baseUrl = baseUrl;
6
+ this.apiKey = apiKey;
7
+ }
8
+ headers() {
9
+ return {
10
+ Authorization: `Bearer ${this.apiKey}`,
11
+ "Content-Type": "application/json",
12
+ };
13
+ }
14
+ async list(params) {
15
+ const url = new URL(`${this.baseUrl}/api/v1/policies`);
16
+ if (params?.virtualKeySlug)
17
+ url.searchParams.set("virtualKeySlug", params.virtualKeySlug);
18
+ const res = await fetch(url.toString(), { headers: this.headers() });
19
+ if (!res.ok)
20
+ throw new Error(`Failed to list policies: ${res.status}`);
21
+ return res.json();
22
+ }
23
+ async get(id) {
24
+ const res = await fetch(`${this.baseUrl}/api/v1/policies/${encodeURIComponent(id)}`, {
25
+ headers: this.headers(),
26
+ });
27
+ if (!res.ok)
28
+ throw new Error(`Failed to get policy: ${res.status}`);
29
+ const json = await res.json();
30
+ return json.data ?? json;
31
+ }
32
+ }
33
+ //# sourceMappingURL=policies.js.map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G,CAAC,IAAI,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;IAC1B,CAAC;CACD"}
@@ -0,0 +1,10 @@
1
+ import type { VirtualKey, PaginatedResponse } from "../types";
2
+ export declare class VirtualKeysResource {
3
+ private baseUrl;
4
+ private apiKey;
5
+ constructor(baseUrl: string, apiKey: string);
6
+ private headers;
7
+ list(): Promise<PaginatedResponse<VirtualKey>>;
8
+ get(slug: string): Promise<VirtualKey>;
9
+ }
10
+ //# sourceMappingURL=virtual-keys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"virtual-keys.d.ts","sourceRoot":"","sources":["../../src/resources/virtual-keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE9D,qBAAa,mBAAmB;IAE9B,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,MAAM;gBADN,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM;IAGvB,OAAO,CAAC,OAAO;IAOT,IAAI,IAAI,OAAO,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAQ9C,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;CAQ5C"}
@@ -0,0 +1,32 @@
1
+ export class VirtualKeysResource {
2
+ baseUrl;
3
+ apiKey;
4
+ constructor(baseUrl, apiKey) {
5
+ this.baseUrl = baseUrl;
6
+ this.apiKey = apiKey;
7
+ }
8
+ headers() {
9
+ return {
10
+ Authorization: `Bearer ${this.apiKey}`,
11
+ "Content-Type": "application/json",
12
+ };
13
+ }
14
+ async list() {
15
+ const res = await fetch(`${this.baseUrl}/api/v1/virtual-keys`, {
16
+ headers: this.headers(),
17
+ });
18
+ if (!res.ok)
19
+ throw new Error(`Failed to list virtual keys: ${res.status}`);
20
+ return res.json();
21
+ }
22
+ async get(slug) {
23
+ const res = await fetch(`${this.baseUrl}/api/v1/virtual-keys/${encodeURIComponent(slug)}`, {
24
+ headers: this.headers(),
25
+ });
26
+ if (!res.ok)
27
+ throw new Error(`Failed to get virtual key: ${res.status}`);
28
+ const json = await res.json();
29
+ return json.data ?? json;
30
+ }
31
+ }
32
+ //# sourceMappingURL=virtual-keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"virtual-keys.js","sourceRoot":"","sources":["../../src/resources/virtual-keys.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,mBAAmB;IAEtB;IACA;IAFT,YACS,OAAe,EACf,MAAc;QADd,YAAO,GAAP,OAAO,CAAQ;QACf,WAAM,GAAN,MAAM,CAAQ;IACpB,CAAC;IAEI,OAAO;QACd,OAAO;YACN,aAAa,EAAE,UAAU,IAAI,CAAC,MAAM,EAAE;YACtC,cAAc,EAAE,kBAAkB;SAClC,CAAC;IACH,CAAC;IAED,KAAK,CAAC,IAAI;QACT,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,OAAO,sBAAsB,EAAE;YAC9D,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE;SACvB,CAAC,CAAC;QACH,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;QAC3E,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,IAAY;QACrB,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,OAAO,wBAAwB,kBAAkB,CAAC,IAAI,CAAC,EAAE,EAAE;YAC1F,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE;SACvB,CAAC,CAAC;QACH,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;QACzE,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;IAC1B,CAAC;CACD"}
@@ -0,0 +1,53 @@
1
+ export interface IgrisConfig {
2
+ apiKey: string;
3
+ baseUrl?: string;
4
+ }
5
+ export interface McpConfigOptions {
6
+ user?: string;
7
+ traceId?: string;
8
+ metadata?: Record<string, string | number | boolean>;
9
+ }
10
+ export interface McpConfig {
11
+ url: string;
12
+ headers: Record<string, string>;
13
+ }
14
+ export interface VirtualKey {
15
+ id: string;
16
+ slug: string;
17
+ name: string;
18
+ upstreamUrl: string;
19
+ authType: string;
20
+ enabled: boolean;
21
+ createdAt: string;
22
+ }
23
+ export interface Policy {
24
+ id: string;
25
+ name: string;
26
+ virtualKeySlug: string | null;
27
+ rules: PolicyRule[];
28
+ enabled: boolean;
29
+ createdAt: string;
30
+ }
31
+ export interface PolicyRule {
32
+ tool: string;
33
+ action: "allow" | "deny" | "alert";
34
+ conditions?: Record<string, unknown>;
35
+ rate_limit?: number;
36
+ }
37
+ export interface AuditEvent {
38
+ id: string;
39
+ type: string;
40
+ toolName: string | null;
41
+ policyAction: string | null;
42
+ userId: string | null;
43
+ traceId: string | null;
44
+ virtualKeySlug: string | null;
45
+ timestamp: string;
46
+ }
47
+ export interface PaginatedResponse<T> {
48
+ data: T[];
49
+ total: number;
50
+ limit: number;
51
+ offset: number;
52
+ }
53
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAA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AK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CACf"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import type { McpConfigOptions } from "../types";
2
+ export declare function buildIgrisHeaders(apiKey: string, options: McpConfigOptions): Record<string, string>;
3
+ //# sourceMappingURL=headers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"headers.d.ts","sourceRoot":"","sources":["../../src/utils/headers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAGjD,wBAAgB,iBAAiB,CAChC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,gBAAgB,GACvB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAexB"}
@@ -0,0 +1,15 @@
1
+ import { generateTraceId } from "./trace";
2
+ export function buildIgrisHeaders(apiKey, options) {
3
+ const headers = {
4
+ Authorization: `Bearer ${apiKey}`,
5
+ "X-Igris-Trace-Id": options.traceId ?? generateTraceId(),
6
+ };
7
+ if (options.user) {
8
+ headers["X-Igris-User"] = options.user;
9
+ }
10
+ if (options.metadata && Object.keys(options.metadata).length > 0) {
11
+ headers["X-Igris-Metadata"] = JSON.stringify(options.metadata);
12
+ }
13
+ return headers;
14
+ }
15
+ //# sourceMappingURL=headers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"headers.js","sourceRoot":"","sources":["../../src/utils/headers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,UAAU,iBAAiB,CAChC,MAAc,EACd,OAAyB;IAEzB,MAAM,OAAO,GAA2B;QACvC,aAAa,EAAE,UAAU,MAAM,EAAE;QACjC,kBAAkB,EAAE,OAAO,CAAC,OAAO,IAAI,eAAe,EAAE;KACxD,CAAC;IAEF,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QAClB,OAAO,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IACxC,CAAC;IAED,IAAI,OAAO,CAAC,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClE,OAAO,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function generateTraceId(): string;
2
+ //# sourceMappingURL=trace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../src/utils/trace.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,IAAI,MAAM,CAOxC"}
@@ -0,0 +1,9 @@
1
+ export function generateTraceId() {
2
+ const bytes = new Uint8Array(8);
3
+ crypto.getRandomValues(bytes);
4
+ const hex = Array.from(bytes)
5
+ .map((b) => b.toString(16).padStart(2, "0"))
6
+ .join("");
7
+ return `ig_trace_${hex}`;
8
+ }
9
+ //# sourceMappingURL=trace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace.js","sourceRoot":"","sources":["../../src/utils/trace.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,eAAe;IAC9B,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAC9B,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;SAC3B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;SAC3C,IAAI,CAAC,EAAE,CAAC,CAAC;IACX,OAAO,YAAY,GAAG,EAAE,CAAC;AAC1B,CAAC"}
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@igris-security/sdk",
3
+ "version": "0.1.0",
4
+ "description": "Igris SDK — TypeScript client for the Igris MCP Gateway",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md"
18
+ ],
19
+ "scripts": {
20
+ "test": "bun test",
21
+ "typecheck": "tsc --noEmit",
22
+ "build": "rm -rf dist && tsc -p tsconfig.build.json"
23
+ },
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "https://github.com/cybertron288/igris.git",
30
+ "directory": "packages/sdk"
31
+ },
32
+ "license": "MIT",
33
+ "keywords": [
34
+ "igris",
35
+ "mcp",
36
+ "gateway",
37
+ "ai",
38
+ "governance",
39
+ "sdk"
40
+ ]
41
+ }