@limetry/sdk 1.2.55 → 1.2.58

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,2 @@
1
+ export declare const APP_VERSION = "1.2.58";
2
+ //# sourceMappingURL=app-version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-version.d.ts","sourceRoot":"","sources":["../src/app-version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,WAAW,CAAA"}
@@ -0,0 +1,2 @@
1
+ export const APP_VERSION = "1.2.58";
2
+ //# sourceMappingURL=app-version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-version.js","sourceRoot":"","sources":["../src/app-version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAA"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Product, package, website, and schema compatibility for this release.
3
+ */
4
+ export declare const COMPATIBILITY: {
5
+ readonly product: "1.2.58";
6
+ readonly compatibleProduct: ">=1.2.0 <1.3.0";
7
+ readonly packages: {
8
+ readonly "@limetry/ci": {
9
+ readonly version: "1.2.58";
10
+ readonly compatible: ">=1.2.0 <1.3.0";
11
+ };
12
+ readonly "@limetry/cli": {
13
+ readonly version: "1.2.58";
14
+ readonly compatible: ">=1.2.0 <1.3.0";
15
+ };
16
+ readonly "@limetry/mcp": {
17
+ readonly version: "1.2.58";
18
+ readonly compatible: ">=1.2.0 <1.3.0";
19
+ };
20
+ readonly "@limetry/preflight": {
21
+ readonly version: "1.2.58";
22
+ readonly compatible: ">=1.2.0 <1.3.0";
23
+ };
24
+ readonly "@limetry/sdk": {
25
+ readonly version: "1.2.58";
26
+ readonly compatible: ">=1.2.0 <1.3.0";
27
+ };
28
+ readonly "@limetry/shopify": {
29
+ readonly version: "1.2.58";
30
+ readonly compatible: ">=1.2.0 <1.3.0";
31
+ };
32
+ readonly "@limetry/sql": {
33
+ readonly version: "1.2.58";
34
+ readonly compatible: ">=1.2.0 <1.3.0";
35
+ };
36
+ readonly "@limetry/ui": {
37
+ readonly version: "1.2.58";
38
+ readonly compatible: ">=1.2.0 <1.3.0";
39
+ };
40
+ };
41
+ readonly websites: {
42
+ readonly oss: {
43
+ readonly version: "1.2.58";
44
+ readonly compatible: ">=1.2.0 <1.3.0";
45
+ };
46
+ readonly cloud: {
47
+ readonly version: "1.2.58";
48
+ readonly compatible: ">=1.2.0 <1.3.0";
49
+ };
50
+ };
51
+ readonly schemas: {
52
+ readonly "openapi.evaluate": {
53
+ readonly version: "1.0.0";
54
+ readonly compatible: ">=1.0.0 <2.0.0";
55
+ };
56
+ readonly "openapi.custom-gpt": {
57
+ readonly version: "1.0.0";
58
+ readonly compatible: ">=1.0.0 <2.0.0";
59
+ };
60
+ readonly "json.evaluate": {
61
+ readonly version: "1.0.0";
62
+ readonly compatible: ">=1.0.0 <2.0.0";
63
+ };
64
+ };
65
+ };
66
+ //# sourceMappingURL=compatibility.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compatibility.d.ts","sourceRoot":"","sources":["../src/compatibility.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6DhB,CAAA"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Product, package, website, and schema compatibility for this release.
3
+ */
4
+ export const COMPATIBILITY = {
5
+ "product": "1.2.58",
6
+ "compatibleProduct": ">=1.2.0 <1.3.0",
7
+ "packages": {
8
+ "@limetry/ci": {
9
+ "version": "1.2.58",
10
+ "compatible": ">=1.2.0 <1.3.0",
11
+ },
12
+ "@limetry/cli": {
13
+ "version": "1.2.58",
14
+ "compatible": ">=1.2.0 <1.3.0",
15
+ },
16
+ "@limetry/mcp": {
17
+ "version": "1.2.58",
18
+ "compatible": ">=1.2.0 <1.3.0",
19
+ },
20
+ "@limetry/preflight": {
21
+ "version": "1.2.58",
22
+ "compatible": ">=1.2.0 <1.3.0",
23
+ },
24
+ "@limetry/sdk": {
25
+ "version": "1.2.58",
26
+ "compatible": ">=1.2.0 <1.3.0",
27
+ },
28
+ "@limetry/shopify": {
29
+ "version": "1.2.58",
30
+ "compatible": ">=1.2.0 <1.3.0",
31
+ },
32
+ "@limetry/sql": {
33
+ "version": "1.2.58",
34
+ "compatible": ">=1.2.0 <1.3.0",
35
+ },
36
+ "@limetry/ui": {
37
+ "version": "1.2.58",
38
+ "compatible": ">=1.2.0 <1.3.0",
39
+ },
40
+ },
41
+ "websites": {
42
+ "oss": {
43
+ "version": "1.2.58",
44
+ "compatible": ">=1.2.0 <1.3.0",
45
+ },
46
+ "cloud": {
47
+ "version": "1.2.58",
48
+ "compatible": ">=1.2.0 <1.3.0",
49
+ },
50
+ },
51
+ "schemas": {
52
+ "openapi.evaluate": {
53
+ "version": "1.0.0",
54
+ "compatible": ">=1.0.0 <2.0.0",
55
+ },
56
+ "openapi.custom-gpt": {
57
+ "version": "1.0.0",
58
+ "compatible": ">=1.0.0 <2.0.0",
59
+ },
60
+ "json.evaluate": {
61
+ "version": "1.0.0",
62
+ "compatible": ">=1.0.0 <2.0.0",
63
+ },
64
+ },
65
+ };
66
+ //# sourceMappingURL=compatibility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compatibility.js","sourceRoot":"","sources":["../src/compatibility.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,SAAS,EAAE,QAAQ;IACnB,mBAAmB,EAAE,gBAAgB;IACrC,UAAU,EAAE;QACV,aAAa,EAAE;YACb,SAAS,EAAE,QAAQ;YACnB,YAAY,EAAE,gBAAgB;SAC/B;QACD,cAAc,EAAE;YACd,SAAS,EAAE,QAAQ;YACnB,YAAY,EAAE,gBAAgB;SAC/B;QACD,cAAc,EAAE;YACd,SAAS,EAAE,QAAQ;YACnB,YAAY,EAAE,gBAAgB;SAC/B;QACD,oBAAoB,EAAE;YACpB,SAAS,EAAE,QAAQ;YACnB,YAAY,EAAE,gBAAgB;SAC/B;QACD,cAAc,EAAE;YACd,SAAS,EAAE,QAAQ;YACnB,YAAY,EAAE,gBAAgB;SAC/B;QACD,kBAAkB,EAAE;YAClB,SAAS,EAAE,QAAQ;YACnB,YAAY,EAAE,gBAAgB;SAC/B;QACD,cAAc,EAAE;YACd,SAAS,EAAE,QAAQ;YACnB,YAAY,EAAE,gBAAgB;SAC/B;QACD,aAAa,EAAE;YACb,SAAS,EAAE,QAAQ;YACnB,YAAY,EAAE,gBAAgB;SAC/B;KACF;IACD,UAAU,EAAE;QACV,KAAK,EAAE;YACL,SAAS,EAAE,QAAQ;YACnB,YAAY,EAAE,gBAAgB;SAC/B;QACD,OAAO,EAAE;YACP,SAAS,EAAE,QAAQ;YACnB,YAAY,EAAE,gBAAgB;SAC/B;KACF;IACD,SAAS,EAAE;QACT,kBAAkB,EAAE;YAClB,SAAS,EAAE,OAAO;YAClB,YAAY,EAAE,gBAAgB;SAC/B;QACD,oBAAoB,EAAE;YACpB,SAAS,EAAE,OAAO;YAClB,YAAY,EAAE,gBAAgB;SAC/B;QACD,eAAe,EAAE;YACf,SAAS,EAAE,OAAO;YAClB,YAAY,EAAE,gBAAgB;SAC/B;KACF;CACO,CAAA"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Shared {@link PolicyEngine} contract for action-intent evaluation.
3
+ *
4
+ * Adapters (`\@limetry/ci`, `\@limetry/sql`, `\@limetry/shopify`) call
5
+ * `evaluateAction` and must not reimplement policy logic locally.
6
+ */
7
+ /**
8
+ * Shared interface implemented by {@link RemotePolicyEngine} (HTTP).
9
+ *
10
+ * Adapters call `evaluateAction` and must not reimplement policy logic.
11
+ */
12
+ export type PolicyEngine = {
13
+ /**
14
+ * Evaluates an {@link ActionIntent} against the configured policy engine.
15
+ *
16
+ * @param intent - Action intent to evaluate.
17
+ * @returns Promise resolving to an {@link ActionEvaluationResponse}.
18
+ */
19
+ evaluateAction: (intent: import("../types.js").ActionIntent) => Promise<import("../types.js").ActionEvaluationResponse>;
20
+ };
21
+ //# sourceMappingURL=policy-engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy-engine.d.ts","sourceRoot":"","sources":["../../src/engine/policy-engine.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB;;;;;OAKG;IACH,cAAc,EAAE,CACd,MAAM,EAAE,OAAO,aAAa,EAAE,YAAY,KACvC,OAAO,CAAC,OAAO,aAAa,EAAE,wBAAwB,CAAC,CAAA;CAC7D,CAAA"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Shared {@link PolicyEngine} contract for action-intent evaluation.
3
+ *
4
+ * Adapters (`\@limetry/ci`, `\@limetry/sql`, `\@limetry/shopify`) call
5
+ * `evaluateAction` and must not reimplement policy logic locally.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=policy-engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy-engine.js","sourceRoot":"","sources":["../../src/engine/policy-engine.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * HTTPS {@link RemotePolicyEngine} that delegates action evaluation to a Limetry server.
3
+ *
4
+ * Posts intents to `/v1/policy/evaluate` with a Bearer API key. Use
5
+ * {@link createRemoteEngine} to construct an instance from environment variables.
6
+ */
7
+ import type { ActionEvaluationResponse, ActionIntent } from "../types.js";
8
+ /**
9
+ * Construction options for {@link RemotePolicyEngine}.
10
+ */
11
+ export type RemotePolicyEngineOptions = {
12
+ /**
13
+ * Base URL of the Limetry server.
14
+ * Defaults to the hosted cloud API: https://api.limetry.com
15
+ */
16
+ baseUrl?: string;
17
+ /**
18
+ * API key (Bearer token). Generate one with `limetry setup` or from the portal.
19
+ * For self-hosted servers this is your LIMETRY_BEARER_TOKEN value.
20
+ */
21
+ apiKey: string;
22
+ /**
23
+ * Tenant id for server-authoritative policy evaluation.
24
+ */
25
+ tenantId?: string;
26
+ /**
27
+ * Optional fetch override for test mocking or custom transports.
28
+ */
29
+ fetch?: typeof globalThis.fetch;
30
+ };
31
+ /**
32
+ * Policy engine that delegates ActionIntent evaluation to a Limetry server over HTTPS.
33
+ */
34
+ export declare class RemotePolicyEngine {
35
+ private readonly baseUrl;
36
+ private readonly apiKey;
37
+ private readonly tenantId;
38
+ private readonly fetcher;
39
+ /**
40
+ * Creates a remote engine from explicit connection options.
41
+ *
42
+ * Trailing slashes are stripped from `baseUrl`. `tenantId` defaults to
43
+ * `"default"`. `fetch` defaults to `globalThis.fetch`.
44
+ *
45
+ * @param options - Connection and auth options.
46
+ * @throws {@link EngineLoadError} when no `fetch` implementation is available.
47
+ */
48
+ constructor(options: RemotePolicyEngineOptions);
49
+ /**
50
+ * Evaluates an {@link ActionIntent} via `POST /v1/policy/evaluate`.
51
+ *
52
+ * @param intent - Action intent to evaluate; `policy_id` is sent alongside the body.
53
+ * @returns Server {@link ActionEvaluationResponse} (cast from JSON).
54
+ * @throws {@link EngineLoadError} when the HTTP call fails or returns a non-OK status.
55
+ */
56
+ evaluateAction(intent: ActionIntent): Promise<ActionEvaluationResponse>;
57
+ }
58
+ /**
59
+ * Creates a {@link RemotePolicyEngine} using config from the environment.
60
+ *
61
+ * Resolves `apiKey` from `overrides.apiKey`, then `LIMETRY_API_KEY`, then
62
+ * `LIMETRY_BEARER_TOKEN`. Resolves `baseUrl` from `overrides.baseUrl`, then
63
+ * `LIMETRY_BASE_URL`, then the hosted default.
64
+ *
65
+ * @param overrides - Optional partial options merged over environment defaults.
66
+ * @returns Configured {@link RemotePolicyEngine}.
67
+ * @throws {@link EngineLoadError} when no API key can be resolved.
68
+ */
69
+ export declare function createRemoteEngine(overrides?: Partial<RemotePolicyEngineOptions>): RemotePolicyEngine;
70
+ //# sourceMappingURL=remote-engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote-engine.d.ts","sourceRoot":"","sources":["../../src/engine/remote-engine.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EACV,wBAAwB,EACxB,YAAY,EACb,MAAM,aAAa,CAAA;AAEpB;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAA;CAChC,CAAA;AAwCD;;GAEG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAQ;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;IAC/B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;IAEjD;;;;;;;;OAQG;gBACS,OAAO,EAAE,yBAAyB;IAc9C;;;;;;OAMG;IACG,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,wBAAwB,CAAC;CAa9E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,yBAAyB,CAAC,GAAG,kBAAkB,CAiBrG"}
@@ -0,0 +1,104 @@
1
+ /**
2
+ * HTTPS {@link RemotePolicyEngine} that delegates action evaluation to a Limetry server.
3
+ *
4
+ * Posts intents to `/v1/policy/evaluate` with a Bearer API key. Use
5
+ * {@link createRemoteEngine} to construct an instance from environment variables.
6
+ */
7
+ import { EngineLoadError } from "../errors.js";
8
+ /**
9
+ * Default hosted Limetry API origin when `baseUrl` is omitted.
10
+ */
11
+ const DEFAULT_BASE_URL = "https://api.limetry.com";
12
+ /**
13
+ * Posts a JSON body to a Limetry API URL with Bearer authentication.
14
+ *
15
+ * @param fetcher - `fetch` implementation to use.
16
+ * @param url - Absolute request URL.
17
+ * @param apiKey - Bearer token value.
18
+ * @param body - JSON-serializable request body.
19
+ * @returns Parsed JSON response body.
20
+ * @throws {@link EngineLoadError} when the HTTP response is not OK.
21
+ */
22
+ async function doFetch(fetcher, url, apiKey, body) {
23
+ const response = await fetcher(url, {
24
+ method: "POST",
25
+ headers: {
26
+ "Authorization": `Bearer ${apiKey}`,
27
+ "Content-Type": "application/json",
28
+ },
29
+ body: JSON.stringify(body),
30
+ });
31
+ if (!response.ok) {
32
+ const text = await response.text().catch(() => `HTTP ${response.status}`);
33
+ throw new EngineLoadError(`Limetry remote engine error (${response.status}): ${text}`);
34
+ }
35
+ return response.json();
36
+ }
37
+ /**
38
+ * Policy engine that delegates ActionIntent evaluation to a Limetry server over HTTPS.
39
+ */
40
+ export class RemotePolicyEngine {
41
+ baseUrl;
42
+ apiKey;
43
+ tenantId;
44
+ fetcher;
45
+ /**
46
+ * Creates a remote engine from explicit connection options.
47
+ *
48
+ * Trailing slashes are stripped from `baseUrl`. `tenantId` defaults to
49
+ * `"default"`. `fetch` defaults to `globalThis.fetch`.
50
+ *
51
+ * @param options - Connection and auth options.
52
+ * @throws {@link EngineLoadError} when no `fetch` implementation is available.
53
+ */
54
+ constructor(options) {
55
+ this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/$/, "");
56
+ this.apiKey = options.apiKey;
57
+ this.tenantId = options.tenantId ?? "default";
58
+ this.fetcher = options.fetch ?? globalThis.fetch;
59
+ if (!this.fetcher) {
60
+ throw new EngineLoadError("RemotePolicyEngine requires a global fetch implementation. " +
61
+ "Use Node 18+ or pass a fetch polyfill via options.fetch.");
62
+ }
63
+ }
64
+ /**
65
+ * Evaluates an {@link ActionIntent} via `POST /v1/policy/evaluate`.
66
+ *
67
+ * @param intent - Action intent to evaluate; `policy_id` is sent alongside the body.
68
+ * @returns Server {@link ActionEvaluationResponse} (cast from JSON).
69
+ * @throws {@link EngineLoadError} when the HTTP call fails or returns a non-OK status.
70
+ */
71
+ async evaluateAction(intent) {
72
+ const result = await doFetch(this.fetcher, `${this.baseUrl}/v1/policy/evaluate`, this.apiKey, {
73
+ tenant_id: this.tenantId,
74
+ policy_id: intent.policy_id,
75
+ intent,
76
+ });
77
+ return result;
78
+ }
79
+ }
80
+ /**
81
+ * Creates a {@link RemotePolicyEngine} using config from the environment.
82
+ *
83
+ * Resolves `apiKey` from `overrides.apiKey`, then `LIMETRY_API_KEY`, then
84
+ * `LIMETRY_BEARER_TOKEN`. Resolves `baseUrl` from `overrides.baseUrl`, then
85
+ * `LIMETRY_BASE_URL`, then the hosted default.
86
+ *
87
+ * @param overrides - Optional partial options merged over environment defaults.
88
+ * @returns Configured {@link RemotePolicyEngine}.
89
+ * @throws {@link EngineLoadError} when no API key can be resolved.
90
+ */
91
+ export function createRemoteEngine(overrides) {
92
+ const apiKey = overrides?.apiKey ??
93
+ process.env.LIMETRY_API_KEY ??
94
+ process.env.LIMETRY_BEARER_TOKEN;
95
+ if (!apiKey) {
96
+ throw new EngineLoadError("No Limetry API key found. Set LIMETRY_API_KEY or run `limetry setup`.");
97
+ }
98
+ return new RemotePolicyEngine({
99
+ baseUrl: overrides?.baseUrl ?? process.env.LIMETRY_BASE_URL ?? DEFAULT_BASE_URL,
100
+ apiKey,
101
+ ...overrides,
102
+ });
103
+ }
104
+ //# sourceMappingURL=remote-engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote-engine.js","sourceRoot":"","sources":["../../src/engine/remote-engine.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AA8B9C;;GAEG;AACH,MAAM,gBAAgB,GAAG,yBAAyB,CAAA;AAElD;;;;;;;;;GASG;AACH,KAAK,UAAU,OAAO,CACpB,OAAgC,EAChC,GAAW,EACX,MAAc,EACd,IAAa;IAEb,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE;QAClC,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,eAAe,EAAE,UAAU,MAAM,EAAE;YACnC,cAAc,EAAE,kBAAkB;SACnC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;KAC3B,CAAC,CAAA;IAEF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,QAAQ,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;QACzE,MAAM,IAAI,eAAe,CAAC,gCAAgC,QAAQ,CAAC,MAAM,MAAM,IAAI,EAAE,CAAC,CAAA;IACxF,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAA;AACxB,CAAC;AAED;;GAEG;AACH,MAAM,OAAO,kBAAkB;IACZ,OAAO,CAAQ;IACf,MAAM,CAAQ;IACd,QAAQ,CAAQ;IAChB,OAAO,CAAyB;IAEjD;;;;;;;;OAQG;IACH,YAAY,OAAkC;QAC5C,IAAI,CAAC,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,gBAAgB,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;QACvE,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;QAC5B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,SAAS,CAAA;QAC7C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,CAAA;QAEhD,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,IAAI,eAAe,CACvB,6DAA6D;gBAC7D,0DAA0D,CAC3D,CAAA;QACH,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,cAAc,CAAC,MAAoB;QACvC,MAAM,MAAM,GAAG,MAAM,OAAO,CAC1B,IAAI,CAAC,OAAO,EACZ,GAAG,IAAI,CAAC,OAAO,qBAAqB,EACpC,IAAI,CAAC,MAAM,EACX;YACE,SAAS,EAAE,IAAI,CAAC,QAAQ;YACxB,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,MAAM;SACP,CACF,CAAA;QACD,OAAO,MAAkC,CAAA;IAC3C,CAAC;CACF;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,kBAAkB,CAAC,SAA8C;IAC/E,MAAM,MAAM,GACV,SAAS,EAAE,MAAM;QACjB,OAAO,CAAC,GAAG,CAAC,eAAe;QAC3B,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAA;IAElC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,eAAe,CACvB,uEAAuE,CACxE,CAAA;IACH,CAAC;IAED,OAAO,IAAI,kBAAkB,CAAC;QAC5B,OAAO,EAAE,SAAS,EAAE,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,gBAAgB;QAC/E,MAAM;QACN,GAAG,SAAS;KACb,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Error classes thrown by `\@limetry/sdk` engines and payment interception paths.
3
+ *
4
+ * All errors extend {@link LimetryError} and carry a stable `code` string for
5
+ * programmatic handling.
6
+ */
7
+ /**
8
+ * Base error for Limetry SDK failures.
9
+ *
10
+ * Subclasses set a specific `name` and `code`; callers should catch
11
+ * `LimetryError` (or a subclass) rather than comparing message text.
12
+ */
13
+ export declare class LimetryError extends Error {
14
+ /**
15
+ * Stable machine-readable error code (for example `policy_violation`).
16
+ */
17
+ readonly code: string;
18
+ /**
19
+ * Creates a Limetry error with a stable code and human-readable message.
20
+ *
21
+ * @param code - Machine-readable error code.
22
+ * @param message - Human-readable description.
23
+ */
24
+ constructor(code: string, message: string);
25
+ }
26
+ /**
27
+ * Raised when policy evaluation rejects an intent.
28
+ *
29
+ * The `code` is taken from `violation.code` when it is a string; otherwise
30
+ * `"policy_violation"` is used.
31
+ */
32
+ export declare class PolicyViolationError extends LimetryError {
33
+ /**
34
+ * Structured violation payload returned by the evaluating engine.
35
+ */
36
+ readonly violation: Record<string, unknown>;
37
+ /**
38
+ * Creates a policy-violation error from an engine violation object.
39
+ *
40
+ * @param violation - Structured violation payload; `code` is preferred when a string.
41
+ */
42
+ constructor(violation: Record<string, unknown>);
43
+ }
44
+ /**
45
+ * Raised when a client-side velocity circuit breaker blocks a transaction.
46
+ */
47
+ export declare class RateLimitExceededError extends LimetryError {
48
+ /**
49
+ * Configured cooldown window in milliseconds.
50
+ */
51
+ readonly cooldownPeriodMs: number;
52
+ /**
53
+ * Elapsed time since the breaker opened, in milliseconds.
54
+ */
55
+ readonly elapsedMs: number;
56
+ /**
57
+ * Creates a rate-limit error describing cooldown vs elapsed time.
58
+ *
59
+ * @param cooldownPeriodMs - Full cooldown window in milliseconds.
60
+ * @param elapsedMs - Time already elapsed within the cooldown.
61
+ */
62
+ constructor(cooldownPeriodMs: number, elapsedMs: number);
63
+ }
64
+ /**
65
+ * Raised when a remote or local policy engine fails to load or respond.
66
+ *
67
+ * Uses the fixed code `engine_load_error`.
68
+ */
69
+ export declare class EngineLoadError extends LimetryError {
70
+ /**
71
+ * Creates an engine-load failure with the given message.
72
+ *
73
+ * @param message - Human-readable load or transport failure description.
74
+ */
75
+ constructor(message: string);
76
+ }
77
+ /**
78
+ * Raised when payment tool interception cannot proceed safely.
79
+ *
80
+ * Uses the fixed code `payment_interception_error`.
81
+ */
82
+ export declare class PaymentInterceptionError extends LimetryError {
83
+ /**
84
+ * Creates a payment-interception failure with the given message.
85
+ *
86
+ * @param message - Human-readable interception failure description.
87
+ */
88
+ constructor(message: string);
89
+ }
90
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;GAKG;AACH,qBAAa,YAAa,SAAQ,KAAK;IACrC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAErB;;;;;OAKG;gBACS,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAK1C;AAED;;;;;GAKG;AACH,qBAAa,oBAAqB,SAAQ,YAAY;IACpD;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAE3C;;;;OAIG;gBACS,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAO/C;AAED;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,YAAY;IACtD;;OAEG;IACH,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAA;IACjC;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAE1B;;;;;OAKG;gBACS,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CASxD;AAED;;;;GAIG;AACH,qBAAa,eAAgB,SAAQ,YAAY;IAC/C;;;;OAIG;gBACS,OAAO,EAAE,MAAM;CAI5B;AAED;;;;GAIG;AACH,qBAAa,wBAAyB,SAAQ,YAAY;IACxD;;;;OAIG;gBACS,OAAO,EAAE,MAAM;CAI5B"}
package/dist/errors.js ADDED
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Error classes thrown by `\@limetry/sdk` engines and payment interception paths.
3
+ *
4
+ * All errors extend {@link LimetryError} and carry a stable `code` string for
5
+ * programmatic handling.
6
+ */
7
+ /**
8
+ * Base error for Limetry SDK failures.
9
+ *
10
+ * Subclasses set a specific `name` and `code`; callers should catch
11
+ * `LimetryError` (or a subclass) rather than comparing message text.
12
+ */
13
+ export class LimetryError extends Error {
14
+ /**
15
+ * Stable machine-readable error code (for example `policy_violation`).
16
+ */
17
+ code;
18
+ /**
19
+ * Creates a Limetry error with a stable code and human-readable message.
20
+ *
21
+ * @param code - Machine-readable error code.
22
+ * @param message - Human-readable description.
23
+ */
24
+ constructor(code, message) {
25
+ super(message);
26
+ this.name = "LimetryError";
27
+ this.code = code;
28
+ }
29
+ }
30
+ /**
31
+ * Raised when policy evaluation rejects an intent.
32
+ *
33
+ * The `code` is taken from `violation.code` when it is a string; otherwise
34
+ * `"policy_violation"` is used.
35
+ */
36
+ export class PolicyViolationError extends LimetryError {
37
+ /**
38
+ * Structured violation payload returned by the evaluating engine.
39
+ */
40
+ violation;
41
+ /**
42
+ * Creates a policy-violation error from an engine violation object.
43
+ *
44
+ * @param violation - Structured violation payload; `code` is preferred when a string.
45
+ */
46
+ constructor(violation) {
47
+ const code = typeof violation.code === "string" ? violation.code : "policy_violation";
48
+ super(code, `Policy violation: ${code}`);
49
+ this.name = "PolicyViolationError";
50
+ this.violation = violation;
51
+ }
52
+ }
53
+ /**
54
+ * Raised when a client-side velocity circuit breaker blocks a transaction.
55
+ */
56
+ export class RateLimitExceededError extends LimetryError {
57
+ /**
58
+ * Configured cooldown window in milliseconds.
59
+ */
60
+ cooldownPeriodMs;
61
+ /**
62
+ * Elapsed time since the breaker opened, in milliseconds.
63
+ */
64
+ elapsedMs;
65
+ /**
66
+ * Creates a rate-limit error describing cooldown vs elapsed time.
67
+ *
68
+ * @param cooldownPeriodMs - Full cooldown window in milliseconds.
69
+ * @param elapsedMs - Time already elapsed within the cooldown.
70
+ */
71
+ constructor(cooldownPeriodMs, elapsedMs) {
72
+ super("rate_limit_exceeded", `Transaction blocked by client velocity circuit breaker. Cooldown ${cooldownPeriodMs}ms, elapsed ${elapsedMs}ms`);
73
+ this.name = "RateLimitExceededError";
74
+ this.cooldownPeriodMs = cooldownPeriodMs;
75
+ this.elapsedMs = elapsedMs;
76
+ }
77
+ }
78
+ /**
79
+ * Raised when a remote or local policy engine fails to load or respond.
80
+ *
81
+ * Uses the fixed code `engine_load_error`.
82
+ */
83
+ export class EngineLoadError extends LimetryError {
84
+ /**
85
+ * Creates an engine-load failure with the given message.
86
+ *
87
+ * @param message - Human-readable load or transport failure description.
88
+ */
89
+ constructor(message) {
90
+ super("engine_load_error", message);
91
+ this.name = "EngineLoadError";
92
+ }
93
+ }
94
+ /**
95
+ * Raised when payment tool interception cannot proceed safely.
96
+ *
97
+ * Uses the fixed code `payment_interception_error`.
98
+ */
99
+ export class PaymentInterceptionError extends LimetryError {
100
+ /**
101
+ * Creates a payment-interception failure with the given message.
102
+ *
103
+ * @param message - Human-readable interception failure description.
104
+ */
105
+ constructor(message) {
106
+ super("payment_interception_error", message);
107
+ this.name = "PaymentInterceptionError";
108
+ }
109
+ }
110
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;GAKG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IACrC;;OAEG;IACM,IAAI,CAAQ;IAErB;;;;;OAKG;IACH,YAAY,IAAY,EAAE,OAAe;QACvC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,cAAc,CAAA;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,oBAAqB,SAAQ,YAAY;IACpD;;OAEG;IACM,SAAS,CAAyB;IAE3C;;;;OAIG;IACH,YAAY,SAAkC;QAC5C,MAAM,IAAI,GACR,OAAO,SAAS,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,kBAAkB,CAAA;QAC1E,KAAK,CAAC,IAAI,EAAE,qBAAqB,IAAI,EAAE,CAAC,CAAA;QACxC,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAA;QAClC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC5B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,YAAY;IACtD;;OAEG;IACM,gBAAgB,CAAQ;IACjC;;OAEG;IACM,SAAS,CAAQ;IAE1B;;;;;OAKG;IACH,YAAY,gBAAwB,EAAE,SAAiB;QACrD,KAAK,CACH,qBAAqB,EACrB,oEAAoE,gBAAgB,eAAe,SAAS,IAAI,CACjH,CAAA;QACD,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAA;QACpC,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAA;QACxC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC5B,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,eAAgB,SAAQ,YAAY;IAC/C;;;;OAIG;IACH,YAAY,OAAe;QACzB,KAAK,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAA;QACnC,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAA;IAC/B,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,wBAAyB,SAAQ,YAAY;IACxD;;;;OAIG;IACH,YAAY,OAAe;QACzB,KAAK,CAAC,4BAA4B,EAAE,OAAO,CAAC,CAAA;QAC5C,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAA;IACxC,CAAC;CACF"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Public entry for `\@limetry/sdk`.
3
+ *
4
+ * Re-exports policy engine clients, typed policy/intent contracts, privacy
5
+ * helpers for audit projections, and Limetry error classes used by adapters
6
+ * (`\@limetry/ci`, `\@limetry/sql`, `\@limetry/shopify`) and CLI/MCP tooling.
7
+ *
8
+ * @packageDocumentation
9
+ */
10
+ export { APP_VERSION } from "./app-version.js";
11
+ export { COMPATIBILITY } from "./compatibility.js";
12
+ export type { PolicyEngine } from "./engine/policy-engine.js";
13
+ export type { RemotePolicyEngineOptions } from "./engine/remote-engine.js";
14
+ export { createRemoteEngine, RemotePolicyEngine } from "./engine/remote-engine.js";
15
+ export { EngineLoadError, LimetryError, PaymentInterceptionError, PolicyViolationError, RateLimitExceededError, } from "./errors.js";
16
+ export { createSlimActionPolicy, createSlimPolicy, type SlimActionPolicyInput, type SlimPolicyInput, } from "./policy/slim-policy.js";
17
+ export { type AuditIntentProjection, type AuditMode, buildEvaluatedAuditDetails, buildMinimizedAuthorizationRequest, buildMinimizedAuthorizationResponse, buildRecordedAuditDetails, DEFAULT_AUDIT_MODE, isSensitiveKey, projectIntentForAudit, redactActionIntent, redactDetails, redactMetadata, resolveAuditMode, scrubEmbeddedSecrets, scrubResource, } from "./privacy/redact.js";
18
+ export type * from "./types.js";
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,YAAY,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,YAAY,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAA;AAC1E,OAAO,EAAE,kBAAkB,EAAC,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AACjF,OAAO,EACL,eAAe,EACf,YAAY,EACZ,wBAAwB,EACxB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,GACrB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,0BAA0B,EAC1B,kCAAkC,EAClC,mCAAmC,EACnC,yBAAyB,EACzB,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,GACd,MAAM,qBAAqB,CAAA;AAC5B,mBAAmB,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Public entry for `\@limetry/sdk`.
3
+ *
4
+ * Re-exports policy engine clients, typed policy/intent contracts, privacy
5
+ * helpers for audit projections, and Limetry error classes used by adapters
6
+ * (`\@limetry/ci`, `\@limetry/sql`, `\@limetry/shopify`) and CLI/MCP tooling.
7
+ *
8
+ * @packageDocumentation
9
+ */
10
+ export { APP_VERSION } from "./app-version.js";
11
+ export { COMPATIBILITY } from "./compatibility.js";
12
+ export { createRemoteEngine, RemotePolicyEngine } from "./engine/remote-engine.js";
13
+ export { EngineLoadError, LimetryError, PaymentInterceptionError, PolicyViolationError, RateLimitExceededError, } from "./errors.js";
14
+ export { createSlimActionPolicy, createSlimPolicy, } from "./policy/slim-policy.js";
15
+ export { buildEvaluatedAuditDetails, buildMinimizedAuthorizationRequest, buildMinimizedAuthorizationResponse, buildRecordedAuditDetails, DEFAULT_AUDIT_MODE, isSensitiveKey, projectIntentForAudit, redactActionIntent, redactDetails, redactMetadata, resolveAuditMode, scrubEmbeddedSecrets, scrubResource, } from "./privacy/redact.js";
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAGlD,OAAO,EAAE,kBAAkB,EAAC,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AACjF,OAAO,EACL,eAAe,EACf,YAAY,EACZ,wBAAwB,EACxB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,sBAAsB,EACtB,gBAAgB,GAGjB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAGL,0BAA0B,EAC1B,kCAAkC,EAClC,mCAAmC,EACnC,yBAAyB,EACzB,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,GACd,MAAM,qBAAqB,CAAA"}