@oxy-hq/sdk 2.5.0 → 2.6.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.
- package/README.md +1 -1
- package/dist/index.cjs +8 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +206 -10
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +206 -10
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/index.mjs.map +1 -1
- package/dist/{react-CVdWXcu8.mjs → react-5HGW_0oy.mjs} +24 -24
- package/dist/react-5HGW_0oy.mjs.map +1 -0
- package/dist/{react-BeweGSYF.cjs → react-BAiiXftp.cjs} +29 -29
- package/dist/react-BAiiXftp.cjs.map +1 -0
- package/dist/{react-BnpR8VRJ.d.mts → react-DnBdQ8dG.d.cts} +16 -16
- package/dist/react-DnBdQ8dG.d.cts.map +1 -0
- package/dist/{react-BnpR8VRJ.d.cts → react-DnBdQ8dG.d.mts} +16 -16
- package/dist/react-DnBdQ8dG.d.mts.map +1 -0
- package/dist/shell.cjs +3 -3
- package/dist/shell.cjs.map +1 -1
- package/dist/shell.d.cts +3 -3
- package/dist/shell.d.mts +3 -3
- package/dist/shell.mjs +3 -3
- package/dist/shell.mjs.map +1 -1
- package/package.json +8 -8
- package/dist/react-BeweGSYF.cjs.map +0 -1
- package/dist/react-BnpR8VRJ.d.cts.map +0 -1
- package/dist/react-BnpR8VRJ.d.mts.map +0 -1
- package/dist/react-CVdWXcu8.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @oxy-hq/sdk
|
|
2
2
|
|
|
3
|
-
React SDK for building **
|
|
3
|
+
React SDK for building **custom-app bundles** on the [Oxy](https://oxygen-hq.com)
|
|
4
4
|
platform. A bundle is a normal Vite + React app that reads from its linked oxy
|
|
5
5
|
project — raw SQL, the semantic layer, agents, and procedures — through a
|
|
6
6
|
small set of hooks, plus a couple of drop-in components.
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @oxy/sdk - TypeScript SDK for Oxy data platform
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3
|
-
const require_react = require('./react-
|
|
3
|
+
const require_react = require('./react-BAiiXftp.cjs');
|
|
4
4
|
|
|
5
5
|
//#region src/anomalies.ts
|
|
6
6
|
/**
|
|
@@ -83,14 +83,14 @@ var AnomaliesClient = class {
|
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
//#endregion
|
|
86
|
-
//#region src/
|
|
86
|
+
//#region src/custom-app/debug.ts
|
|
87
87
|
/**
|
|
88
88
|
* Fetch the server-side diagnostic snapshot for this bundle. Pair with
|
|
89
|
-
* `
|
|
89
|
+
* `loadCustomAppManifest()` — pass its result here. Logs the
|
|
90
90
|
* snapshot through the SDK logger so it appears in the bundle's
|
|
91
91
|
* console at info level.
|
|
92
92
|
*/
|
|
93
|
-
async function
|
|
93
|
+
async function getCustomAppDebug(resolved) {
|
|
94
94
|
const log = require_react.getOxyAppLogger();
|
|
95
95
|
const { apiBaseUrl, orgSlug, appSlug } = resolved;
|
|
96
96
|
const url = `${apiBaseUrl}/api/customer-apps/${encodeURIComponent(orgSlug)}/${encodeURIComponent(appSlug)}/debug`;
|
|
@@ -240,12 +240,12 @@ exports.OxyAnswer = require_react.OxyAnswer;
|
|
|
240
240
|
exports.OxyApiError = require_react.OxyApiError;
|
|
241
241
|
exports.OxyAppProvider = require_react.OxyAppProvider;
|
|
242
242
|
exports.OxyChat = require_react.OxyChat;
|
|
243
|
-
exports.
|
|
243
|
+
exports._resetCustomAppManifestCacheForTest = require_react._resetCustomAppManifestCacheForTest;
|
|
244
244
|
exports.apiErrorFromResponse = require_react.apiErrorFromResponse;
|
|
245
|
-
exports.
|
|
245
|
+
exports.getCustomAppDebug = getCustomAppDebug;
|
|
246
246
|
exports.getOxyAppLogger = require_react.getOxyAppLogger;
|
|
247
|
-
exports.
|
|
248
|
-
exports.
|
|
247
|
+
exports.interpretCustomAppError = require_react.interpretCustomAppError;
|
|
248
|
+
exports.loadCustomAppManifest = require_react.loadCustomAppManifest;
|
|
249
249
|
exports.readInjectedAppConfig = require_react.readInjectedAppConfig;
|
|
250
250
|
exports.setOxyAppLogger = require_react.setOxyAppLogger;
|
|
251
251
|
exports.useAgentRun = require_react.useAgentRun;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["getOxyAppLogger"],"sources":["../src/anomalies.ts","../src/customer-app/debug.ts","../src/metricTree.ts"],"sourcesContent":["// Anomaly inbox types + client. Surfaces the `/semantic/anomalies*`\n// endpoints — list, scan, status, explain — so SDK consumers can render\n// the same inbox the Oxy IDE uses.\n\nimport type { OxyConfig } from \"./config\";\nimport type { ExplainResult } from \"./metricTree\";\n\n// ── Types ────────────────────────────────────────────────────────────────────\n\nexport type AnomalyStatus = \"new\" | \"acknowledged\" | \"dismissed\";\nexport type AnomalySeverity = \"low\" | \"medium\" | \"high\";\n\n/**\n * One row in the anomaly inbox. Detected by `oxy-metric-monitoring` per\n * `.monitor.yml` entry; upserted by repeat scans so unresolved anomalies\n * stay visible without piling up duplicates.\n */\nexport interface Anomaly {\n id: string;\n workspace_id: string;\n measure: string;\n time_dimension: string;\n granularity: string;\n period_start: string;\n period_end: string;\n observed: number;\n expected: number;\n lower_bound: number;\n upper_bound: number;\n z_score: number;\n severity: AnomalySeverity | string;\n status: AnomalyStatus | string;\n label?: string | null;\n /** Cached ExplainResult — populated by `POST /anomalies/:id/explain`. */\n explain_cache?: ExplainResult | null;\n explain_cached_at?: string | null;\n detected_at: string;\n updated_at: string;\n}\n\nexport interface ListAnomaliesOptions {\n status?: AnomalyStatus | string;\n /** Max rows (server caps at 500, defaults to 100). */\n limit?: number;\n}\n\nexport interface ListAnomaliesResponse {\n anomalies: Anomaly[];\n}\n\nexport interface ScanOptions {\n /** Override the reference \"now\" date (YYYY-MM-DD) — useful for demos. */\n as_of?: string;\n}\n\nexport interface ScanResponse {\n monitors_scanned: number;\n monitors_failed: number;\n anomalies_persisted: number;\n}\n\n// ── Client ───────────────────────────────────────────────────────────────────\n\nexport type RequestFn = <T>(endpoint: string, options?: RequestInit) => Promise<T>;\n\n/**\n * Client for `/semantic/anomalies*`. Construct via `OxyClient.anomalies`\n * rather than instantiating directly — the getter wires the request helper\n * so auth, timeout, and branch propagation come along for free.\n *\n * @example\n * ```typescript\n * const { anomalies } = await client.anomalies.list({ status: \"new\" });\n * for (const a of anomalies) {\n * console.log(a.label ?? a.measure, a.severity, a.z_score.toFixed(2));\n * }\n * ```\n */\nexport class AnomaliesClient {\n private readonly request: RequestFn;\n private readonly config: OxyConfig;\n\n constructor(config: OxyConfig, request: RequestFn) {\n this.config = config;\n this.request = request;\n }\n\n private path(suffix: string): string {\n return `/${this.config.projectId}/semantic/anomalies${suffix}`;\n }\n\n private buildQuery(extra: Record<string, string> = {}): string {\n const params: Record<string, string> = { ...extra };\n if (this.config.branch) params.branch = this.config.branch;\n const qs = new URLSearchParams(params).toString();\n return qs ? `?${qs}` : \"\";\n }\n\n /**\n * List anomalies in the inbox, newest first.\n *\n * @example\n * ```typescript\n * // Open / unresolved anomalies only\n * const { anomalies } = await client.anomalies.list({ status: \"new\" });\n * ```\n */\n async list(options: ListAnomaliesOptions = {}): Promise<ListAnomaliesResponse> {\n const extra: Record<string, string> = {};\n if (options.status) extra.status = options.status;\n if (options.limit) extra.limit = String(options.limit);\n // No trailing slash before the query — axum 307-redirects \"/anomalies/\"\n // to \"/anomalies\", and the redirect fails CORS preflight in browsers.\n return this.request<ListAnomaliesResponse>(this.path(this.buildQuery(extra)));\n }\n\n /**\n * Trigger a full scan. Iterates every `.monitor.yml` entry in the\n * workspace, runs the detector, and upserts matching rows into the\n * inbox. Returns counts of scanned / failed / persisted.\n *\n * @example\n * ```typescript\n * // Scan against a known-good reference date (matches the seed dataset)\n * const result = await client.anomalies.scan({ as_of: \"2025-12-15\" });\n * console.log(`${result.anomalies_persisted} anomalies detected`);\n * ```\n */\n async scan(options: ScanOptions = {}): Promise<ScanResponse> {\n const extra: Record<string, string> = {};\n if (options.as_of) extra.as_of = options.as_of;\n return this.request<ScanResponse>(this.path(`/scan${this.buildQuery(extra)}`), {\n method: \"POST\"\n });\n }\n\n /**\n * Update an anomaly's status (acknowledge / dismiss / re-open).\n */\n async updateStatus(anomalyId: string, status: AnomalyStatus): Promise<Anomaly> {\n const query = this.buildQuery();\n return this.request<Anomaly>(this.path(`/${encodeURIComponent(anomalyId)}/status${query}`), {\n method: \"POST\",\n body: JSON.stringify({ status })\n });\n }\n\n /**\n * Run the metric-tree `explain` for an anomaly and cache the result on\n * the row. Subsequent calls return the cached `ExplainResult` instantly.\n */\n async explain(anomalyId: string): Promise<ExplainResult> {\n const query = this.buildQuery();\n return this.request<ExplainResult>(\n this.path(`/${encodeURIComponent(anomalyId)}/explain${query}`),\n { method: \"POST\" }\n );\n }\n}\n","// Bundle-side accessor for the server's diagnostic snapshot.\n//\n// `GET /api/customer-apps/<org>/<app>/debug` returns a structured\n// snapshot of what oxy currently sees about a registered customer\n// app: the app row, bundle dir resolution, and parsed manifest (or\n// parse error). Useful when a bundle isn't loading what you expected\n// and you want to verify what the server actually sees — without\n// needing terminal access.\n//\n// The `products` field on the snapshot is a legacy artifact carried\n// for server-side compatibility; in v2 the bundle owns its queries\n// via `useQuery` and the field is always empty for v2 manifests.\n\nimport { getOxyAppLogger } from \"./logger\";\nimport type { ResolvedCustomerAppManifest } from \"./manifest\";\n\n/** Untyped at the boundary — keep it loose so server-side schema\n * additions don't break older bundles. Stable enough for inspection\n * but not a contract clients should depend on field-by-field. */\nexport interface CustomerAppDebugSnapshot {\n org_slug: string;\n app_slug: string;\n app: {\n id: string;\n slug: string;\n name: string;\n status: string;\n source_type: string;\n project_id: string;\n branch: string;\n };\n bundle_dir: string | null;\n bundle_dir_exists: boolean;\n /** Raw parsed manifest from the server — kept loose so schema additions don't break older bundles. */\n manifest: Record<string, unknown> | null;\n manifest_error: string | null;\n products: Array<{ name: string; producer: string }>;\n}\n\n/**\n * Fetch the server-side diagnostic snapshot for this bundle. Pair with\n * `loadCustomerAppManifest()` — pass its result here. Logs the\n * snapshot through the SDK logger so it appears in the bundle's\n * console at info level.\n */\nexport async function getCustomerAppDebug(\n resolved: ResolvedCustomerAppManifest\n): Promise<CustomerAppDebugSnapshot> {\n const log = getOxyAppLogger();\n const { apiBaseUrl, orgSlug, appSlug } = resolved;\n const url =\n `${apiBaseUrl}/api/customer-apps/` +\n `${encodeURIComponent(orgSlug)}/${encodeURIComponent(appSlug)}/debug`;\n\n log.log(\"debug\", \"fetching debug snapshot\", { url });\n const res = await fetch(url, { credentials: \"same-origin\" });\n if (!res.ok) {\n const detail = await res.text().catch(() => \"\");\n throw new Error(\n `Failed to fetch debug snapshot (HTTP ${res.status}): ${detail || res.statusText}`\n );\n }\n const snapshot = (await res.json()) as CustomerAppDebugSnapshot;\n log.log(\"info\", \"debug snapshot\", snapshot as unknown as Record<string, unknown>);\n return snapshot;\n}\n","// Metric-tree types + client. Mirrors `airlayer::engine::metric_tree*`\n// over the `/<project_id>/semantic/metric-tree*` HTTP endpoints. Serde\n// emits snake_case so these field names match the wire format verbatim.\n\nimport type { OxyConfig } from \"./config\";\n\n// ── Tree ──────────────────────────────────────────────────────────────────────\n\nexport type EdgeKind = \"component\" | \"driver\";\nexport type DriverDirection = \"positive\" | \"negative\" | \"unknown\";\nexport type DriverStrength = \"strong\" | \"moderate\" | \"weak\";\nexport type DriverConfidence = \"high\" | \"medium\" | \"low\";\nexport type DriverForm = \"linear\" | \"log-log\" | \"log-linear\" | \"linear-log\";\n\nexport interface MetricNode {\n id: string;\n view: string;\n measure: string;\n label: string;\n description?: string | null;\n measure_type: string;\n is_composite: boolean;\n expr?: string | null;\n}\n\nexport interface MetricEdge {\n from: string;\n to: string;\n kind: EdgeKind;\n /** Sign of a component edge; omitted (defaults to +1) for most edges. */\n sign?: number;\n direction: DriverDirection;\n strength: DriverStrength;\n confidence: DriverConfidence;\n coefficient?: number | null;\n form: DriverForm;\n intercept?: number | null;\n lag?: number | null;\n description?: string | null;\n refs?: string[] | null;\n}\n\nexport interface MetricTree {\n nodes: MetricNode[];\n edges: MetricEdge[];\n root?: string | null;\n}\n\n// ── Sensitivity ──────────────────────────────────────────────────────────────\n\nexport interface SensitivityDriver {\n measure: string;\n path: string[];\n edge_kind: string;\n effective_coefficient?: number | null;\n form?: DriverForm | null;\n direction: DriverDirection;\n strength: DriverStrength;\n lag?: number | null;\n description?: string | null;\n}\n\nexport interface SensitivityResult {\n target: string;\n drivers: SensitivityDriver[];\n}\n\n// ── Predict ──────────────────────────────────────────────────────────────────\n\nexport interface PredictChange {\n measure: string;\n delta: number;\n}\n\nexport interface PredictImpact {\n measure: string;\n estimated_delta: number;\n confidence: string;\n path: string[];\n form: DriverForm;\n lag?: number | null;\n}\n\nexport interface PredictResult {\n inputs: PredictChange[];\n impacts: PredictImpact[];\n}\n\n// ── Explain (RCA) ────────────────────────────────────────────────────────────\n\nexport type SplitKind =\n | { type: \"component\"; child_measure: string }\n | { type: \"dimension\"; dimension: string; value: string }\n | { type: \"uniform_degradation\"; dimension: string; num_elements: number }\n | { type: \"cross_cutting\"; dimension: string; value: string; measures: string[] };\n\nexport interface ExplainSibling {\n split: SplitKind;\n measure: string;\n delta: number;\n root_fraction: number;\n}\n\nexport interface ExplainNode {\n split: SplitKind;\n measure: string;\n filters: unknown[];\n delta: number;\n concentration: number;\n root_fraction: number;\n siblings?: ExplainSibling[];\n dimension_count?: number;\n children?: ExplainNode[];\n}\n\nexport interface DriverAttribution {\n driver_measure: string;\n driver_previous: number;\n driver_current: number;\n driver_delta: number;\n coefficient?: number;\n form: DriverForm;\n estimated_target_impact?: number;\n description?: string;\n}\n\nexport type ExplainWarning =\n | {\n type: \"simpsons_paradox\";\n dimension: string;\n aggregate_delta: number;\n segment_directions: [string, number][];\n }\n | {\n type: \"opposing_offset\";\n component_a: string;\n component_b: string;\n delta_a: number;\n delta_b: number;\n }\n | {\n type: \"non_additive_dimension_split\";\n measure: string;\n measure_type: string;\n dimension: string;\n };\n\nexport interface ExplainConfigOverride {\n deep?: boolean;\n max_depth?: number;\n coverage_threshold?: number;\n}\n\nexport interface ExplainRequest {\n target: string;\n time_dimension: string;\n current_period: [string, string];\n previous_period: [string, string];\n config?: ExplainConfigOverride;\n}\n\nexport interface ExplainResult {\n target: string;\n target_delta: number;\n target_previous: number;\n target_current: number;\n time_dimension: string;\n current_period: [string, string];\n previous_period: [string, string];\n nodes: ExplainNode[];\n coverage: number;\n driver_attribution?: DriverAttribution[];\n alternatives?: unknown[];\n warnings?: ExplainWarning[];\n}\n\n// ── Opportunity ──────────────────────────────────────────────────────────────\n\nexport interface SegmentOpportunity {\n segment: string;\n current_value: number;\n volume: number;\n benchmark: number;\n gap: number;\n /** Match-the-best upside in measure units. */\n upside: number;\n}\n\nexport interface DimensionOpportunity {\n dimension: string;\n cardinality: number;\n /** \"best_peer\" or \"p75\". */\n benchmark_basis: string;\n total_upside: number;\n segments: SegmentOpportunity[];\n other_segments_skipped: number;\n}\n\nexport interface SkippedDimension {\n dimension: string;\n reason: string;\n}\n\nexport interface OpportunityRequest {\n target: string;\n time_dimension: string;\n period: [string, string];\n}\n\nexport interface OpportunityResult {\n target: string;\n period: [string, string];\n overall_value: number;\n /** \"value_share\" (additive) or \"equal\" (ratios). */\n weight_basis: string;\n dimensions: DimensionOpportunity[];\n skipped_dimensions: SkippedDimension[];\n downstream: PredictImpact[];\n}\n\n// ── Client ───────────────────────────────────────────────────────────────────\n\n/**\n * Shape of the inner request helper exposed by `OxyClient`. The metric-tree\n * client reuses it to inherit auth headers, timeout, baseUrl, and project\n * scoping rather than reimplementing fetch end-to-end.\n */\nexport type RequestFn = <T>(endpoint: string, options?: RequestInit) => Promise<T>;\n\n/**\n * Client for the `/semantic/metric-tree*` endpoints. Surfaces the four\n * airlayer metric-tree analyses (tree introspection, sensitivity, predict,\n * explain, opportunity) over typed methods.\n *\n * Construction is internal to {@link OxyClient} — call `client.metricTree`\n * to access an instance rather than building one yourself.\n *\n * @example\n * ```typescript\n * const client = await OxyClient.create({ projectId: \"...\", apiKey: \"...\" });\n * const tree = await client.metricTree.getTree();\n * const drivers = await client.metricTree.getSensitivity(\"orders.net_revenue\");\n * ```\n */\nexport class MetricTreeClient {\n private readonly request: RequestFn;\n private readonly config: OxyConfig;\n\n constructor(config: OxyConfig, request: RequestFn) {\n this.config = config;\n this.request = request;\n }\n\n private path(suffix: string): string {\n return `/${this.config.projectId}/semantic/metric-tree${suffix}`;\n }\n\n private buildQuery(extra: Record<string, string> = {}): string {\n const params: Record<string, string> = { ...extra };\n if (this.config.branch) params.branch = this.config.branch;\n const qs = new URLSearchParams(params).toString();\n return qs ? `?${qs}` : \"\";\n }\n\n /**\n * Fetch the full metric tree, or the subtree rooted at `root`.\n *\n * @param root - Optional fully-qualified measure id to root the tree at.\n * @returns Nodes (measures) and edges (component / driver relationships).\n *\n * @example\n * ```typescript\n * const tree = await client.metricTree.getTree();\n * const subtree = await client.metricTree.getTree(\"orders.net_revenue\");\n * ```\n */\n async getTree(root?: string): Promise<MetricTree> {\n const query = this.buildQuery(root ? { root } : {});\n return this.request<MetricTree>(this.path(query));\n }\n\n /**\n * Rank the declared drivers of a measure by influence.\n *\n * @param measureId - Fully-qualified measure id (`view.measure`).\n *\n * @example\n * ```typescript\n * const sensitivity = await client.metricTree.getSensitivity(\"orders.net_revenue\");\n * for (const driver of sensitivity.drivers) {\n * console.log(driver.measure, driver.direction, driver.strength);\n * }\n * ```\n */\n async getSensitivity(measureId: string): Promise<SensitivityResult> {\n const query = this.buildQuery();\n return this.request<SensitivityResult>(\n this.path(`/${encodeURIComponent(measureId)}/sensitivity${query}`)\n );\n }\n\n /**\n * Propagate hypothetical `(measure, delta)` changes upward through the\n * tree. Returns the estimated impact on every downstream measure.\n *\n * @example\n * ```typescript\n * const result = await client.metricTree.predict([\n * { measure: \"marketing_spend.total_spend\", delta: 10000 },\n * ]);\n * ```\n */\n async predict(changes: PredictChange[]): Promise<PredictResult> {\n const query = this.buildQuery();\n return this.request<PredictResult>(this.path(`/predict${query}`), {\n method: \"POST\",\n body: JSON.stringify({ changes })\n });\n }\n\n /**\n * Period-over-period root-cause decomposition. Recursively splits the\n * target measure by components and dimensions until the move concentrates.\n *\n * @example\n * ```typescript\n * const result = await client.metricTree.explain({\n * target: \"financials.operating_profit\",\n * time_dimension: \"financials.month\",\n * current_period: [\"2025-09-01\", \"2025-09-30\"],\n * previous_period: [\"2025-08-01\", \"2025-08-31\"],\n * });\n * ```\n */\n async explain(request: ExplainRequest): Promise<ExplainResult> {\n const query = this.buildQuery();\n return this.request<ExplainResult>(this.path(`/explain${query}`), {\n method: \"POST\",\n body: JSON.stringify(request)\n });\n }\n\n /**\n * Size the upside opportunity for a measure by finding underperforming\n * segments. Skips high-cardinality dimensions and trims the long tail.\n *\n * @example\n * ```typescript\n * const result = await client.metricTree.findOpportunities({\n * target: \"orders.net_revenue\",\n * time_dimension: \"orders.order_date\",\n * period: [\"2025-09-01\", \"2025-09-30\"],\n * });\n * for (const dim of result.dimensions) {\n * console.log(dim.dimension, \"+\", dim.total_upside);\n * }\n * ```\n */\n async findOpportunities(request: OpportunityRequest): Promise<OpportunityResult> {\n const query = this.buildQuery();\n return this.request<OpportunityResult>(this.path(`/opportunity${query}`), {\n method: \"POST\",\n body: JSON.stringify(request)\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA8EA,IAAa,kBAAb,MAA6B;CAI3B,YAAY,QAAmB,SAAoB;EACjD,KAAK,SAAS;EACd,KAAK,UAAU;CACjB;CAEA,AAAQ,KAAK,QAAwB;EACnC,OAAO,IAAI,KAAK,OAAO,UAAU,qBAAqB;CACxD;CAEA,AAAQ,WAAW,QAAgC,CAAC,GAAW;EAC7D,MAAM,SAAiC,EAAE,GAAG,MAAM;EAClD,IAAI,KAAK,OAAO,QAAQ,OAAO,S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E,QAAQ,CAAC;EAClC,CAAC;CACH;;;;;;;;;;;;;;;CAgBA,MAAM,QAAQ,SAAiD;EAC7D,MAAM,QAAQ,KAAK,WAAW;EAC9B,OAAO,KAAK,QAAuB,KAAK,KAAK,WAAW,OAAO,GAAG;GAChE,QAAQ;GACR,MAAM,KAAK,UAAU,OAAO;EAC9B,CAAC;CACH;;;;;;;;;;;;;;;;;CAkBA,MAAM,kBAAkB,SAAyD;EAC/E,MAAM,QAAQ,KAAK,WAAW;EAC9B,OAAO,KAAK,QAA2B,KAAK,KAAK,eAAe,OAAO,GAAG;GACxE,QAAQ;GACR,MAAM,KAAK,UAAU,OAAO;EAC9B,CAAC;CACH;AACF"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["getOxyAppLogger"],"sources":["../src/anomalies.ts","../src/custom-app/debug.ts","../src/metricTree.ts"],"sourcesContent":["// Anomaly inbox types + client. Surfaces the `/semantic/anomalies*`\n// endpoints — list, scan, status, explain — so SDK consumers can render\n// the same inbox the Oxy IDE uses.\n\nimport type { OxyConfig } from \"./config\";\nimport type { ExplainResult } from \"./metricTree\";\n\n// ── Types ────────────────────────────────────────────────────────────────────\n\nexport type AnomalyStatus = \"new\" | \"acknowledged\" | \"dismissed\";\nexport type AnomalySeverity = \"low\" | \"medium\" | \"high\";\n\n/**\n * One row in the anomaly inbox. Detected by `oxy-metric-monitoring` per\n * `.monitor.yml` entry; upserted by repeat scans so unresolved anomalies\n * stay visible without piling up duplicates.\n */\nexport interface Anomaly {\n id: string;\n workspace_id: string;\n measure: string;\n time_dimension: string;\n granularity: string;\n period_start: string;\n period_end: string;\n observed: number;\n expected: number;\n lower_bound: number;\n upper_bound: number;\n z_score: number;\n severity: AnomalySeverity | string;\n status: AnomalyStatus | string;\n label?: string | null;\n /** Cached ExplainResult — populated by `POST /anomalies/:id/explain`. */\n explain_cache?: ExplainResult | null;\n explain_cached_at?: string | null;\n detected_at: string;\n updated_at: string;\n}\n\nexport interface ListAnomaliesOptions {\n status?: AnomalyStatus | string;\n /** Max rows (server caps at 500, defaults to 100). */\n limit?: number;\n}\n\nexport interface ListAnomaliesResponse {\n anomalies: Anomaly[];\n}\n\nexport interface ScanOptions {\n /** Override the reference \"now\" date (YYYY-MM-DD) — useful for demos. */\n as_of?: string;\n}\n\nexport interface ScanResponse {\n monitors_scanned: number;\n monitors_failed: number;\n anomalies_persisted: number;\n}\n\n// ── Client ───────────────────────────────────────────────────────────────────\n\nexport type RequestFn = <T>(endpoint: string, options?: RequestInit) => Promise<T>;\n\n/**\n * Client for `/semantic/anomalies*`. Construct via `OxyClient.anomalies`\n * rather than instantiating directly — the getter wires the request helper\n * so auth, timeout, and branch propagation come along for free.\n *\n * @example\n * ```typescript\n * const { anomalies } = await client.anomalies.list({ status: \"new\" });\n * for (const a of anomalies) {\n * console.log(a.label ?? a.measure, a.severity, a.z_score.toFixed(2));\n * }\n * ```\n */\nexport class AnomaliesClient {\n private readonly request: RequestFn;\n private readonly config: OxyConfig;\n\n constructor(config: OxyConfig, request: RequestFn) {\n this.config = config;\n this.request = request;\n }\n\n private path(suffix: string): string {\n return `/${this.config.projectId}/semantic/anomalies${suffix}`;\n }\n\n private buildQuery(extra: Record<string, string> = {}): string {\n const params: Record<string, string> = { ...extra };\n if (this.config.branch) params.branch = this.config.branch;\n const qs = new URLSearchParams(params).toString();\n return qs ? `?${qs}` : \"\";\n }\n\n /**\n * List anomalies in the inbox, newest first.\n *\n * @example\n * ```typescript\n * // Open / unresolved anomalies only\n * const { anomalies } = await client.anomalies.list({ status: \"new\" });\n * ```\n */\n async list(options: ListAnomaliesOptions = {}): Promise<ListAnomaliesResponse> {\n const extra: Record<string, string> = {};\n if (options.status) extra.status = options.status;\n if (options.limit) extra.limit = String(options.limit);\n // No trailing slash before the query — axum 307-redirects \"/anomalies/\"\n // to \"/anomalies\", and the redirect fails CORS preflight in browsers.\n return this.request<ListAnomaliesResponse>(this.path(this.buildQuery(extra)));\n }\n\n /**\n * Trigger a full scan. Iterates every `.monitor.yml` entry in the\n * workspace, runs the detector, and upserts matching rows into the\n * inbox. Returns counts of scanned / failed / persisted.\n *\n * @example\n * ```typescript\n * // Scan against a known-good reference date (matches the seed dataset)\n * const result = await client.anomalies.scan({ as_of: \"2025-12-15\" });\n * console.log(`${result.anomalies_persisted} anomalies detected`);\n * ```\n */\n async scan(options: ScanOptions = {}): Promise<ScanResponse> {\n const extra: Record<string, string> = {};\n if (options.as_of) extra.as_of = options.as_of;\n return this.request<ScanResponse>(this.path(`/scan${this.buildQuery(extra)}`), {\n method: \"POST\"\n });\n }\n\n /**\n * Update an anomaly's status (acknowledge / dismiss / re-open).\n */\n async updateStatus(anomalyId: string, status: AnomalyStatus): Promise<Anomaly> {\n const query = this.buildQuery();\n return this.request<Anomaly>(this.path(`/${encodeURIComponent(anomalyId)}/status${query}`), {\n method: \"POST\",\n body: JSON.stringify({ status })\n });\n }\n\n /**\n * Run the metric-tree `explain` for an anomaly and cache the result on\n * the row. Subsequent calls return the cached `ExplainResult` instantly.\n */\n async explain(anomalyId: string): Promise<ExplainResult> {\n const query = this.buildQuery();\n return this.request<ExplainResult>(\n this.path(`/${encodeURIComponent(anomalyId)}/explain${query}`),\n { method: \"POST\" }\n );\n }\n}\n","// Bundle-side accessor for the server's diagnostic snapshot.\n//\n// `GET /api/customer-apps/<org>/<app>/debug` returns a structured\n// snapshot of what oxy currently sees about a registered customer\n// app: the app row, bundle dir resolution, and parsed manifest (or\n// parse error). Useful when a bundle isn't loading what you expected\n// and you want to verify what the server actually sees — without\n// needing terminal access.\n//\n// The `products` field on the snapshot is a legacy artifact carried\n// for server-side compatibility; in v2 the bundle owns its queries\n// via `useQuery` and the field is always empty for v2 manifests.\n\nimport { getOxyAppLogger } from \"./logger\";\nimport type { ResolvedCustomAppManifest } from \"./manifest\";\n\n/** Untyped at the boundary — keep it loose so server-side schema\n * additions don't break older bundles. Stable enough for inspection\n * but not a contract clients should depend on field-by-field. */\nexport interface CustomAppDebugSnapshot {\n org_slug: string;\n app_slug: string;\n app: {\n id: string;\n slug: string;\n name: string;\n status: string;\n source_type: string;\n project_id: string;\n branch: string;\n };\n bundle_dir: string | null;\n bundle_dir_exists: boolean;\n /** Raw parsed manifest from the server — kept loose so schema additions don't break older bundles. */\n manifest: Record<string, unknown> | null;\n manifest_error: string | null;\n products: Array<{ name: string; producer: string }>;\n}\n\n/**\n * Fetch the server-side diagnostic snapshot for this bundle. Pair with\n * `loadCustomAppManifest()` — pass its result here. Logs the\n * snapshot through the SDK logger so it appears in the bundle's\n * console at info level.\n */\nexport async function getCustomAppDebug(\n resolved: ResolvedCustomAppManifest\n): Promise<CustomAppDebugSnapshot> {\n const log = getOxyAppLogger();\n const { apiBaseUrl, orgSlug, appSlug } = resolved;\n const url =\n `${apiBaseUrl}/api/customer-apps/` +\n `${encodeURIComponent(orgSlug)}/${encodeURIComponent(appSlug)}/debug`;\n\n log.log(\"debug\", \"fetching debug snapshot\", { url });\n const res = await fetch(url, { credentials: \"same-origin\" });\n if (!res.ok) {\n const detail = await res.text().catch(() => \"\");\n throw new Error(\n `Failed to fetch debug snapshot (HTTP ${res.status}): ${detail || res.statusText}`\n );\n }\n const snapshot = (await res.json()) as CustomAppDebugSnapshot;\n log.log(\"info\", \"debug snapshot\", snapshot as unknown as Record<string, unknown>);\n return snapshot;\n}\n","// Metric-tree types + client. Mirrors `airlayer::engine::metric_tree*`\n// over the `/<project_id>/semantic/metric-tree*` HTTP endpoints. Serde\n// emits snake_case so these field names match the wire format verbatim.\n\nimport type { OxyConfig } from \"./config\";\n\n// ── Tree ──────────────────────────────────────────────────────────────────────\n\nexport type EdgeKind = \"component\" | \"driver\";\nexport type DriverDirection = \"positive\" | \"negative\" | \"unknown\";\nexport type DriverStrength = \"strong\" | \"moderate\" | \"weak\";\nexport type DriverConfidence = \"high\" | \"medium\" | \"low\";\nexport type DriverForm = \"linear\" | \"log-log\" | \"log-linear\" | \"linear-log\";\n\nexport interface MetricNode {\n id: string;\n view: string;\n measure: string;\n label: string;\n description?: string | null;\n measure_type: string;\n is_composite: boolean;\n expr?: string | null;\n}\n\nexport interface MetricEdge {\n from: string;\n to: string;\n kind: EdgeKind;\n /** Sign of a component edge; omitted (defaults to +1) for most edges. */\n sign?: number;\n direction: DriverDirection;\n strength: DriverStrength;\n confidence: DriverConfidence;\n coefficient?: number | null;\n form: DriverForm;\n intercept?: number | null;\n lag?: number | null;\n description?: string | null;\n refs?: string[] | null;\n}\n\nexport interface MetricTree {\n nodes: MetricNode[];\n edges: MetricEdge[];\n root?: string | null;\n}\n\n// ── Sensitivity ──────────────────────────────────────────────────────────────\n\nexport interface SensitivityDriver {\n measure: string;\n path: string[];\n edge_kind: string;\n effective_coefficient?: number | null;\n form?: DriverForm | null;\n direction: DriverDirection;\n strength: DriverStrength;\n lag?: number | null;\n description?: string | null;\n}\n\nexport interface SensitivityResult {\n target: string;\n drivers: SensitivityDriver[];\n}\n\n// ── Predict ──────────────────────────────────────────────────────────────────\n\nexport interface PredictChange {\n measure: string;\n delta: number;\n}\n\nexport interface PredictImpact {\n measure: string;\n estimated_delta: number;\n confidence: string;\n path: string[];\n form: DriverForm;\n lag?: number | null;\n}\n\nexport interface PredictResult {\n inputs: PredictChange[];\n impacts: PredictImpact[];\n}\n\n// ── Explain (RCA) ────────────────────────────────────────────────────────────\n\nexport type SplitKind =\n | { type: \"component\"; child_measure: string }\n | { type: \"dimension\"; dimension: string; value: string }\n | { type: \"uniform_degradation\"; dimension: string; num_elements: number }\n | { type: \"cross_cutting\"; dimension: string; value: string; measures: string[] };\n\nexport interface ExplainSibling {\n split: SplitKind;\n measure: string;\n delta: number;\n root_fraction: number;\n}\n\nexport interface ExplainNode {\n split: SplitKind;\n measure: string;\n filters: unknown[];\n delta: number;\n concentration: number;\n root_fraction: number;\n siblings?: ExplainSibling[];\n dimension_count?: number;\n children?: ExplainNode[];\n}\n\nexport interface DriverAttribution {\n driver_measure: string;\n driver_previous: number;\n driver_current: number;\n driver_delta: number;\n coefficient?: number;\n form: DriverForm;\n estimated_target_impact?: number;\n description?: string;\n}\n\nexport type ExplainWarning =\n | {\n type: \"simpsons_paradox\";\n dimension: string;\n aggregate_delta: number;\n segment_directions: [string, number][];\n }\n | {\n type: \"opposing_offset\";\n component_a: string;\n component_b: string;\n delta_a: number;\n delta_b: number;\n }\n | {\n type: \"non_additive_dimension_split\";\n measure: string;\n measure_type: string;\n dimension: string;\n };\n\nexport interface ExplainConfigOverride {\n deep?: boolean;\n max_depth?: number;\n coverage_threshold?: number;\n}\n\nexport interface ExplainRequest {\n target: string;\n time_dimension: string;\n current_period: [string, string];\n previous_period: [string, string];\n config?: ExplainConfigOverride;\n}\n\nexport interface ExplainResult {\n target: string;\n target_delta: number;\n target_previous: number;\n target_current: number;\n time_dimension: string;\n current_period: [string, string];\n previous_period: [string, string];\n nodes: ExplainNode[];\n coverage: number;\n driver_attribution?: DriverAttribution[];\n alternatives?: unknown[];\n warnings?: ExplainWarning[];\n}\n\n// ── Opportunity ──────────────────────────────────────────────────────────────\n\nexport interface SegmentOpportunity {\n segment: string;\n current_value: number;\n volume: number;\n benchmark: number;\n gap: number;\n /** Match-the-best upside in measure units. */\n upside: number;\n}\n\nexport interface DimensionOpportunity {\n dimension: string;\n cardinality: number;\n /** \"best_peer\" or \"p75\". */\n benchmark_basis: string;\n total_upside: number;\n segments: SegmentOpportunity[];\n other_segments_skipped: number;\n}\n\nexport interface SkippedDimension {\n dimension: string;\n reason: string;\n}\n\nexport interface OpportunityRequest {\n target: string;\n time_dimension: string;\n period: [string, string];\n}\n\nexport interface OpportunityResult {\n target: string;\n period: [string, string];\n overall_value: number;\n /** \"value_share\" (additive) or \"equal\" (ratios). */\n weight_basis: string;\n dimensions: DimensionOpportunity[];\n skipped_dimensions: SkippedDimension[];\n downstream: PredictImpact[];\n}\n\n// ── Client ───────────────────────────────────────────────────────────────────\n\n/**\n * Shape of the inner request helper exposed by `OxyClient`. The metric-tree\n * client reuses it to inherit auth headers, timeout, baseUrl, and project\n * scoping rather than reimplementing fetch end-to-end.\n */\nexport type RequestFn = <T>(endpoint: string, options?: RequestInit) => Promise<T>;\n\n/**\n * Client for the `/semantic/metric-tree*` endpoints. Surfaces the four\n * airlayer metric-tree analyses (tree introspection, sensitivity, predict,\n * explain, opportunity) over typed methods.\n *\n * Construction is internal to {@link OxyClient} — call `client.metricTree`\n * to access an instance rather than building one yourself.\n *\n * @example\n * ```typescript\n * const client = await OxyClient.create({ projectId: \"...\", apiKey: \"...\" });\n * const tree = await client.metricTree.getTree();\n * const drivers = await client.metricTree.getSensitivity(\"orders.net_revenue\");\n * ```\n */\nexport class MetricTreeClient {\n private readonly request: RequestFn;\n private readonly config: OxyConfig;\n\n constructor(config: OxyConfig, request: RequestFn) {\n this.config = config;\n this.request = request;\n }\n\n private path(suffix: string): string {\n return `/${this.config.projectId}/semantic/metric-tree${suffix}`;\n }\n\n private buildQuery(extra: Record<string, string> = {}): string {\n const params: Record<string, string> = { ...extra };\n if (this.config.branch) params.branch = this.config.branch;\n const qs = new URLSearchParams(params).toString();\n return qs ? `?${qs}` : \"\";\n }\n\n /**\n * Fetch the full metric tree, or the subtree rooted at `root`.\n *\n * @param root - Optional fully-qualified measure id to root the tree at.\n * @returns Nodes (measures) and edges (component / driver relationships).\n *\n * @example\n * ```typescript\n * const tree = await client.metricTree.getTree();\n * const subtree = await client.metricTree.getTree(\"orders.net_revenue\");\n * ```\n */\n async getTree(root?: string): Promise<MetricTree> {\n const query = this.buildQuery(root ? { root } : {});\n return this.request<MetricTree>(this.path(query));\n }\n\n /**\n * Rank the declared drivers of a measure by influence.\n *\n * @param measureId - Fully-qualified measure id (`view.measure`).\n *\n * @example\n * ```typescript\n * const sensitivity = await client.metricTree.getSensitivity(\"orders.net_revenue\");\n * for (const driver of sensitivity.drivers) {\n * console.log(driver.measure, driver.direction, driver.strength);\n * }\n * ```\n */\n async getSensitivity(measureId: string): Promise<SensitivityResult> {\n const query = this.buildQuery();\n return this.request<SensitivityResult>(\n this.path(`/${encodeURIComponent(measureId)}/sensitivity${query}`)\n );\n }\n\n /**\n * Propagate hypothetical `(measure, delta)` changes upward through the\n * tree. Returns the estimated impact on every downstream measure.\n *\n * @example\n * ```typescript\n * const result = await client.metricTree.predict([\n * { measure: \"marketing_spend.total_spend\", delta: 10000 },\n * ]);\n * ```\n */\n async predict(changes: PredictChange[]): Promise<PredictResult> {\n const query = this.buildQuery();\n return this.request<PredictResult>(this.path(`/predict${query}`), {\n method: \"POST\",\n body: JSON.stringify({ changes })\n });\n }\n\n /**\n * Period-over-period root-cause decomposition. Recursively splits the\n * target measure by components and dimensions until the move concentrates.\n *\n * @example\n * ```typescript\n * const result = await client.metricTree.explain({\n * target: \"financials.operating_profit\",\n * time_dimension: \"financials.month\",\n * current_period: [\"2025-09-01\", \"2025-09-30\"],\n * previous_period: [\"2025-08-01\", \"2025-08-31\"],\n * });\n * ```\n */\n async explain(request: ExplainRequest): Promise<ExplainResult> {\n const query = this.buildQuery();\n return this.request<ExplainResult>(this.path(`/explain${query}`), {\n method: \"POST\",\n body: JSON.stringify(request)\n });\n }\n\n /**\n * Size the upside opportunity for a measure by finding underperforming\n * segments. Skips high-cardinality dimensions and trims the long tail.\n *\n * @example\n * ```typescript\n * const result = await client.metricTree.findOpportunities({\n * target: \"orders.net_revenue\",\n * time_dimension: \"orders.order_date\",\n * period: [\"2025-09-01\", \"2025-09-30\"],\n * });\n * for (const dim of result.dimensions) {\n * console.log(dim.dimension, \"+\", dim.total_upside);\n * }\n * ```\n */\n async findOpportunities(request: OpportunityRequest): Promise<OpportunityResult> {\n const query = this.buildQuery();\n return this.request<OpportunityResult>(this.path(`/opportunity${query}`), {\n method: \"POST\",\n body: JSON.stringify(request)\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA8EA,IAAa,kBAAb,MAA6B;CAI3B,YAAY,QAAmB,SAAoB;EACjD,KAAK,SAAS;EACd,KAAK,UAAU;CACjB;CAEA,AAAQ,KAAK,QAAwB;EACnC,OAAO,IAAI,KAAK,OAAO,UAA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kD;EAC9D,MAAM,QAAQ,KAAK,WAAW;EAC9B,OAAO,KAAK,QAAuB,KAAK,KAAK,WAAW,OAAO,GAAG;GAChE,QAAQ;GACR,MAAM,KAAK,UAAU,EAAE,QAAQ,CAAC;EAClC,CAAC;CACH;;;;;;;;;;;;;;;CAgBA,MAAM,QAAQ,SAAiD;EAC7D,MAAM,QAAQ,KAAK,WAAW;EAC9B,OAAO,KAAK,QAAuB,KAAK,KAAK,WAAW,OAAO,GAAG;GAChE,QAAQ;GACR,MAAM,KAAK,UAAU,OAAO;EAC9B,CAAC;CACH;;;;;;;;;;;;;;;;;CAkBA,MAAM,kBAAkB,SAAyD;EAC/E,MAAM,QAAQ,KAAK,WAAW;EAC9B,OAAO,KAAK,QAA2B,KAAK,KAAK,eAAe,OAAO,GAAG;GACxE,QAAQ;GACR,MAAM,KAAK,UAAU,OAAO;EAC9B,CAAC;CACH;AACF"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { A as UseSemanticQueryOpts, B as
|
|
2
|
+
import { A as UseSemanticQueryOpts, B as CustomAppErrorReport, C as UseProcedureRunInput, D as UseQueryOpts, E as UseQueryInput, F as useProcedureRun, G as OxyAppFunctionManifest, H as apiErrorFromResponse, I as useQuery, J as _resetCustomAppManifestCacheForTest, K as OxyAppManifest, L as useResolvedManifest, M as useAgentRun, N as useFunction, O as UseQueryResult, P as useOxyApp, R as useSemanticQuery, S as UseFunctionResult, T as UseProcedureRunResult, U as interpretCustomAppError, V as OxyApiError, W as LoadManifestOptions, Y as loadCustomAppManifest, _ as SemanticFilter, a as AppFetcher, b as UseAgentRunInput, c as OxyAppProvider, d as OxyChatProps, f as ProcedureProgress, g as SemanticDateRangeOp, h as SemanticArrayOp, i as AgentSqlArtifact, j as UseSemanticQueryResult, k as UseSemanticQueryInput, l as OxyAppProviderProps, m as ProcedureRunState, n as AgentRunEvent, o as OxyAnswer, p as ProcedureResult, q as ResolvedCustomAppManifest, r as AgentRunState, s as OxyAnswerProps, t as AgentArtifact, u as OxyChat, v as SemanticScalarOp, w as UseProcedureRunOpts, x as UseAgentRunResult, y as SemanticTimeDimension, z as useTrackEvent } from "./react-DnBdQ8dG.cjs";
|
|
3
3
|
//#region src/config.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Configuration for the Oxy SDK
|
|
@@ -432,11 +432,11 @@ declare class AnomaliesClient {
|
|
|
432
432
|
explain(anomalyId: string): Promise<ExplainResult>;
|
|
433
433
|
}
|
|
434
434
|
//#endregion
|
|
435
|
-
//#region src/
|
|
435
|
+
//#region src/custom-app/debug.d.ts
|
|
436
436
|
/** Untyped at the boundary — keep it loose so server-side schema
|
|
437
437
|
* additions don't break older bundles. Stable enough for inspection
|
|
438
438
|
* but not a contract clients should depend on field-by-field. */
|
|
439
|
-
interface
|
|
439
|
+
interface CustomAppDebugSnapshot {
|
|
440
440
|
org_slug: string;
|
|
441
441
|
app_slug: string;
|
|
442
442
|
app: {
|
|
@@ -460,13 +460,13 @@ interface CustomerAppDebugSnapshot {
|
|
|
460
460
|
}
|
|
461
461
|
/**
|
|
462
462
|
* Fetch the server-side diagnostic snapshot for this bundle. Pair with
|
|
463
|
-
* `
|
|
463
|
+
* `loadCustomAppManifest()` — pass its result here. Logs the
|
|
464
464
|
* snapshot through the SDK logger so it appears in the bundle's
|
|
465
465
|
* console at info level.
|
|
466
466
|
*/
|
|
467
|
-
declare function
|
|
467
|
+
declare function getCustomAppDebug(resolved: ResolvedCustomAppManifest): Promise<CustomAppDebugSnapshot>;
|
|
468
468
|
//#endregion
|
|
469
|
-
//#region src/
|
|
469
|
+
//#region src/custom-app/function-context.d.ts
|
|
470
470
|
/**
|
|
471
471
|
* The request passed as the first argument to a function's default export.
|
|
472
472
|
*
|
|
@@ -486,6 +486,24 @@ interface OxyFunctionUser {
|
|
|
486
486
|
id: string;
|
|
487
487
|
email: string;
|
|
488
488
|
orgId: string;
|
|
489
|
+
/**
|
|
490
|
+
* The caller's role **within this app**, derived server-side from app
|
|
491
|
+
* membership (with org-owner / Oxy-staff break-glass). Absent when they hold
|
|
492
|
+
* no membership.
|
|
493
|
+
*
|
|
494
|
+
* This is the value to gate a privileged surface on — it cannot be forged by
|
|
495
|
+
* the client, unlike a query param or a client-side flag:
|
|
496
|
+
*
|
|
497
|
+
* ```ts
|
|
498
|
+
* if (ctx.user.appRole !== "admin") {
|
|
499
|
+
* return Response.json({ error: "forbidden" }, { status: 403 });
|
|
500
|
+
* }
|
|
501
|
+
* ```
|
|
502
|
+
*
|
|
503
|
+
* Note it is deliberately NOT the org role: an app admin administers one app
|
|
504
|
+
* without holding org-Admin (which also carries billing and member management).
|
|
505
|
+
*/
|
|
506
|
+
appRole?: "admin" | "member";
|
|
489
507
|
}
|
|
490
508
|
/** Result of a `ctx.fetch` call. */
|
|
491
509
|
interface OxyFetchResult {
|
|
@@ -539,6 +557,25 @@ interface EmailSendInput {
|
|
|
539
557
|
* background (retried) sends become exactly-once once it does.
|
|
540
558
|
*/
|
|
541
559
|
idempotencyKey?: string;
|
|
560
|
+
/**
|
|
561
|
+
* Files to attach. Max 20 per send, and **10 MiB decoded in total** — SES
|
|
562
|
+
* caps a whole message near 40 MB, so for anything larger store the file with
|
|
563
|
+
* {@link OxyStorageApi} and email a presigned link instead of inlining it.
|
|
564
|
+
*/
|
|
565
|
+
attachments?: EmailAttachment[];
|
|
566
|
+
}
|
|
567
|
+
/** One attachment on {@link EmailSendInput}. */
|
|
568
|
+
interface EmailAttachment {
|
|
569
|
+
/** Filename shown to the recipient. Required; path separators are stripped. */
|
|
570
|
+
filename: string;
|
|
571
|
+
/** File bytes, **base64-encoded** (the only way binary crosses the isolate boundary). */
|
|
572
|
+
content: string;
|
|
573
|
+
/** MIME type; defaults to `application/octet-stream`. */
|
|
574
|
+
contentType?: string;
|
|
575
|
+
/** Render inline (e.g. an image referenced as `cid:<contentId>`) instead of as a download. */
|
|
576
|
+
inline?: boolean;
|
|
577
|
+
/** Content-ID for an inline part, referenced from the HTML body as `cid:<contentId>`. */
|
|
578
|
+
contentId?: string;
|
|
542
579
|
}
|
|
543
580
|
/** Result of a successful `ctx.email.send`. */
|
|
544
581
|
interface EmailSendResult {
|
|
@@ -549,6 +586,164 @@ interface EmailSendResult {
|
|
|
549
586
|
interface OxyEmailApi {
|
|
550
587
|
send(input: EmailSendInput): Promise<EmailSendResult>;
|
|
551
588
|
}
|
|
589
|
+
/** Input to `ctx.storage.getUploadUrl`. */
|
|
590
|
+
interface StorageUploadUrlInput {
|
|
591
|
+
/**
|
|
592
|
+
* Destination path inside the app's silo, e.g. `"uploads/q1-report.pdf"`.
|
|
593
|
+
* Segments are sanitized server-side and cannot escape the silo. Omit to use
|
|
594
|
+
* `filename`, which is placed under `uploads/`.
|
|
595
|
+
*/
|
|
596
|
+
pathname?: string;
|
|
597
|
+
/** Shorthand for `pathname: "uploads/<filename>"`. */
|
|
598
|
+
filename?: string;
|
|
599
|
+
/** MIME type; bound into the presigned PUT signature. Inferred when omitted. */
|
|
600
|
+
contentType?: string;
|
|
601
|
+
/**
|
|
602
|
+
* Exact byte length of the upload, bound into the signature — S3 rejects a
|
|
603
|
+
* body of any other size. Capped by the server's upload ceiling (100 MiB by
|
|
604
|
+
* default).
|
|
605
|
+
*/
|
|
606
|
+
contentLength: number;
|
|
607
|
+
/** Presign lifetime in seconds (default 900; max 604800 — SigV4's own limit). */
|
|
608
|
+
expiresInSeconds?: number;
|
|
609
|
+
}
|
|
610
|
+
/** A minted presigned upload. */
|
|
611
|
+
interface StorageUploadUrl {
|
|
612
|
+
/** Presigned PUT — the browser uploads the file bytes directly to this URL. */
|
|
613
|
+
url: string;
|
|
614
|
+
/**
|
|
615
|
+
* The stored key. Record it (e.g. on a row in your warehouse) — it is how you
|
|
616
|
+
* fetch, list or link to the asset later. A random suffix is added so two
|
|
617
|
+
* people uploading `report.pdf` don't collide.
|
|
618
|
+
*/
|
|
619
|
+
key: string;
|
|
620
|
+
/** ISO-8601 expiry of the presigned URL. */
|
|
621
|
+
expiresAt: string;
|
|
622
|
+
}
|
|
623
|
+
/** A minted presigned download. */
|
|
624
|
+
interface StorageDownloadUrl {
|
|
625
|
+
url: string;
|
|
626
|
+
expiresAt: string;
|
|
627
|
+
}
|
|
628
|
+
/** One asset in the app's silo. */
|
|
629
|
+
interface StorageObject {
|
|
630
|
+
key: string;
|
|
631
|
+
size: number;
|
|
632
|
+
contentType?: string | null;
|
|
633
|
+
/** ISO-8601. */
|
|
634
|
+
lastModified?: string | null;
|
|
635
|
+
}
|
|
636
|
+
/** One page of {@link OxyStorageApi.list}. */
|
|
637
|
+
interface StorageListPage {
|
|
638
|
+
objects: StorageObject[];
|
|
639
|
+
/** Pass back as `cursor` to fetch the next page; `null` when complete. */
|
|
640
|
+
cursor: string | null;
|
|
641
|
+
hasMore: boolean;
|
|
642
|
+
}
|
|
643
|
+
/** Options for {@link OxyStorageApi.put}. */
|
|
644
|
+
interface StoragePutOptions {
|
|
645
|
+
/** MIME type. Inferred from the pathname's extension when omitted. */
|
|
646
|
+
contentType?: string;
|
|
647
|
+
/**
|
|
648
|
+
* How `body` is encoded. `"base64"` is what makes **binary** generated assets
|
|
649
|
+
* (PDF, PNG, Parquet) possible — a UTF-8 string would corrupt them.
|
|
650
|
+
*/
|
|
651
|
+
encoding?: "utf8" | "base64";
|
|
652
|
+
/** Append a short random component before the extension to avoid collisions. */
|
|
653
|
+
addRandomSuffix?: boolean;
|
|
654
|
+
/**
|
|
655
|
+
* Replace an existing asset at this path. Defaults to `false` — writing over
|
|
656
|
+
* an asset by accident is worse than an error, so this is opt-in.
|
|
657
|
+
*/
|
|
658
|
+
allowOverwrite?: boolean;
|
|
659
|
+
/** `Cache-Control: max-age=<seconds>` stored on the object. */
|
|
660
|
+
cacheControlMaxAge?: number;
|
|
661
|
+
}
|
|
662
|
+
/** Result of a `put` (and of `copy`). */
|
|
663
|
+
interface StoragePutResult {
|
|
664
|
+
key: string;
|
|
665
|
+
size: number;
|
|
666
|
+
contentType: string;
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* `ctx.storage` — this app's **asset store**, covering both kinds of file an app
|
|
670
|
+
* produces, in one silo (`customer-app-storage/<app_id>/`):
|
|
671
|
+
*
|
|
672
|
+
* - **Uploaded** — a human picks a file; `getUploadUrl` mints a presigned PUT and
|
|
673
|
+
* the browser uploads **straight to S3**, so uploads aren't bounded by the
|
|
674
|
+
* request-body limit and the bytes never pass through your function.
|
|
675
|
+
* - **Generated** — your function produces the file (a rendered PDF, a CSV
|
|
676
|
+
* export, a chart PNG) and writes it with `put`, using
|
|
677
|
+
* `{ encoding: "base64" }` for binary.
|
|
678
|
+
*
|
|
679
|
+
* Gated by the fail-closed `storage.read` / `storage.write` capabilities in
|
|
680
|
+
* `oxy-app.json`. Every asset is private; reads are always presigned and
|
|
681
|
+
* time-boxed. Keys are confined to your app — another app's key is rejected.
|
|
682
|
+
*
|
|
683
|
+
* ```ts
|
|
684
|
+
* // Uploaded: mint a URL, browser PUTs to it, then record `key`.
|
|
685
|
+
* const { url, key } = await ctx.storage.getUploadUrl({
|
|
686
|
+
* filename: "q1-report.pdf", contentType: "application/pdf", contentLength: size,
|
|
687
|
+
* });
|
|
688
|
+
*
|
|
689
|
+
* // Generated: write a CSV your function just built.
|
|
690
|
+
* const { key } = await ctx.storage.put("generated/jan.csv", csv);
|
|
691
|
+
*
|
|
692
|
+
* // Either way: email a link that outlives the request.
|
|
693
|
+
* const { url: link } = await ctx.storage.getDownloadUrl(key, {
|
|
694
|
+
* expiresInSeconds: 604800, download: true,
|
|
695
|
+
* });
|
|
696
|
+
* ```
|
|
697
|
+
*/
|
|
698
|
+
interface OxyStorageApi {
|
|
699
|
+
/** Mint a presigned PUT for a browser upload (requires `storage.write`). */
|
|
700
|
+
getUploadUrl(input: StorageUploadUrlInput): Promise<StorageUploadUrl>;
|
|
701
|
+
/**
|
|
702
|
+
* Mint a presigned GET (requires `storage.read`). `download: true` forces a
|
|
703
|
+
* save-as via `Content-Disposition`, which is what an emailed link wants.
|
|
704
|
+
*/
|
|
705
|
+
getDownloadUrl(key: string, opts?: {
|
|
706
|
+
expiresInSeconds?: number;
|
|
707
|
+
download?: boolean;
|
|
708
|
+
}): Promise<StorageDownloadUrl>;
|
|
709
|
+
/**
|
|
710
|
+
* Write a generated asset (requires `storage.write`). Capped at 6 MiB — for
|
|
711
|
+
* anything larger, mint a presigned upload URL and stream to it.
|
|
712
|
+
*/
|
|
713
|
+
put(pathname: string, body: string, opts?: StoragePutOptions): Promise<StoragePutResult>;
|
|
714
|
+
/** Read an asset back; `null` when absent (requires `storage.read`). */
|
|
715
|
+
get(key: string, opts?: {
|
|
716
|
+
encoding?: "utf8" | "base64";
|
|
717
|
+
}): Promise<{
|
|
718
|
+
body: string;
|
|
719
|
+
contentType: string | null;
|
|
720
|
+
size: number;
|
|
721
|
+
encoding: string;
|
|
722
|
+
} | null>;
|
|
723
|
+
/** Metadata without the body; `null` when absent (requires `storage.read`). */
|
|
724
|
+
head(key: string): Promise<StorageObject | null>;
|
|
725
|
+
/**
|
|
726
|
+
* One page of assets (requires `storage.read`). Paginated deliberately — pass
|
|
727
|
+
* the returned `cursor` back to walk a large silo without loading it all.
|
|
728
|
+
*/
|
|
729
|
+
list(opts?: {
|
|
730
|
+
prefix?: string;
|
|
731
|
+
limit?: number;
|
|
732
|
+
cursor?: string;
|
|
733
|
+
}): Promise<StorageListPage>;
|
|
734
|
+
/**
|
|
735
|
+
* Delete one or many assets (requires `storage.write`). Idempotent — deleting
|
|
736
|
+
* an absent key is a no-op success. `deleted` is the number of keys **accepted**
|
|
737
|
+
* for deletion (an absent key counts too), not a count of keys that existed.
|
|
738
|
+
*/
|
|
739
|
+
delete(keyOrKeys: string | string[]): Promise<{
|
|
740
|
+
deleted: number;
|
|
741
|
+
}>;
|
|
742
|
+
/** Server-side copy within the app's silo (requires `storage.write`). */
|
|
743
|
+
copy(fromKey: string, toPathname: string, opts?: {
|
|
744
|
+
allowOverwrite?: boolean;
|
|
745
|
+
}): Promise<StoragePutResult>;
|
|
746
|
+
}
|
|
552
747
|
/**
|
|
553
748
|
* The data-plane context passed as the second argument to a function's default
|
|
554
749
|
* export. Mirrors the host-assembled `ctx` (`__buildCtx` in `runtime.rs`);
|
|
@@ -574,14 +769,15 @@ interface OxyFunctionContext {
|
|
|
574
769
|
semantic: OxySemanticApi;
|
|
575
770
|
airway: OxyAirwayApi;
|
|
576
771
|
email: OxyEmailApi;
|
|
772
|
+
storage: OxyStorageApi;
|
|
577
773
|
}
|
|
578
774
|
/** Signature of a function's default export: `export default async (req, ctx) => Response`. */
|
|
579
775
|
type OxyFunctionHandler = (req: OxyFunctionRequest, ctx: OxyFunctionContext) => Promise<Response> | Response;
|
|
580
776
|
//#endregion
|
|
581
|
-
//#region src/
|
|
777
|
+
//#region src/custom-app/inject.d.ts
|
|
582
778
|
/**
|
|
583
779
|
* Shape of `window.__OXY_APP__` written by oxy at serve time.
|
|
584
|
-
* Consumed by `
|
|
780
|
+
* Consumed by `loadCustomAppManifest` as the authoritative identity
|
|
585
781
|
* source (overrides any hints in `oxy-app.json`).
|
|
586
782
|
*/
|
|
587
783
|
interface OxyInjectedAppConfig {
|
|
@@ -607,7 +803,7 @@ declare global {
|
|
|
607
803
|
*/
|
|
608
804
|
declare function readInjectedAppConfig(): OxyInjectedAppConfig | undefined;
|
|
609
805
|
//#endregion
|
|
610
|
-
//#region src/
|
|
806
|
+
//#region src/custom-app/logger.d.ts
|
|
611
807
|
type OxyAppLogLevel = "debug" | "info" | "warn" | "error";
|
|
612
808
|
interface OxyAppLogger {
|
|
613
809
|
log(level: OxyAppLogLevel, msg: string, ctx?: Record<string, unknown>): void;
|
|
@@ -617,5 +813,5 @@ declare function setOxyAppLogger(logger: OxyAppLogger | null): void;
|
|
|
617
813
|
/** Used by the SDK internals; not part of the public surface. */
|
|
618
814
|
declare function getOxyAppLogger(): OxyAppLogger;
|
|
619
815
|
//#endregion
|
|
620
|
-
export { type AgentArtifact, type AgentRunEvent, type AgentRunState, type AgentSqlArtifact, AnomaliesClient, type Anomaly, type AnomalySeverity, type AnomalyStatus, type AppFetcher, type
|
|
816
|
+
export { type AgentArtifact, type AgentRunEvent, type AgentRunState, type AgentSqlArtifact, AnomaliesClient, type Anomaly, type AnomalySeverity, type AnomalyStatus, type AppFetcher, type CustomAppDebugSnapshot, type CustomAppErrorReport, type DimensionOpportunity, type DriverAttribution, type DriverConfidence, type DriverDirection, type DriverForm, type DriverStrength, type EdgeKind, type EmailAttachment, type EmailSendInput, type EmailSendResult, type ExplainConfigOverride, type ExplainNode, type ExplainRequest, type ExplainResult, type ExplainSibling, type ExplainWarning, type ListAnomaliesOptions, type ListAnomaliesResponse, type LoadManifestOptions, type MetricEdge, type MetricNode, type MetricTree, MetricTreeClient, type OpportunityRequest, type OpportunityResult, type OxyAirwayApi, OxyAnswer, type OxyAnswerProps, OxyApiError, type OxyAppFunctionManifest, type OxyAppLogLevel, type OxyAppLogger, type OxyAppManifest, OxyAppProvider, type OxyAppProviderProps, OxyChat, type OxyChatProps, type OxyEmailApi, type OxyFetchResult, type OxyFunctionContext, type OxyFunctionHandler, type OxyFunctionRequest, type OxyFunctionRow, type OxyFunctionUser, type OxyInjectedAppConfig, type OxySecretsApi, type OxySemanticApi, type OxyStorageApi, type OxyWarehouseApi, type PredictChange, type PredictImpact, type PredictResult, type ProcedureProgress, type ProcedureResult, type ProcedureRunState, type ResolvedCustomAppManifest, type ScanOptions, type ScanResponse, type SegmentOpportunity, type SemanticArrayOp, type SemanticDateRangeOp, type SemanticFilter, type SemanticScalarOp, type SemanticTimeDimension, type SensitivityDriver, type SensitivityResult, type SkippedDimension, type SplitKind, type StorageDownloadUrl, type StorageListPage, type StorageObject, type StoragePutOptions, type StoragePutResult, type StorageUploadUrl, type StorageUploadUrlInput, type UseAgentRunInput, type UseAgentRunResult, type UseFunctionResult, type UseProcedureRunInput, type UseProcedureRunOpts, type UseProcedureRunResult, type UseQueryInput, type UseQueryOpts, type UseQueryResult, type UseSemanticQueryInput, type UseSemanticQueryOpts, type UseSemanticQueryResult, _resetCustomAppManifestCacheForTest, apiErrorFromResponse, getCustomAppDebug, getOxyAppLogger, interpretCustomAppError, loadCustomAppManifest, readInjectedAppConfig, setOxyAppLogger, useAgentRun, useFunction, useOxyApp, useProcedureRun, useQuery, useResolvedManifest, useSemanticQuery, useTrackEvent };
|
|
621
817
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/config.ts","../src/metricTree.ts","../src/anomalies.ts","../src/
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/config.ts","../src/metricTree.ts","../src/anomalies.ts","../src/custom-app/debug.ts","../src/custom-app/function-context.ts","../src/custom-app/inject.ts","../src/custom-app/logger.ts"],"mappings":";;;;;;UAGiB;;;;EAIf;;;;EAKA;;;;EAKA;;;;EAKA;;;;EAKA;;;;;;;EAQA;;;;;EAMA;;;;KCjCU;KACA;KACA;KACA;KACA;UAEK;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA,MAAM;;EAEN;EACA,WAAW;EACX,UAAU;EACV,YAAY;EACZ;EACA,MAAM;EACN;EACA;EACA;EACA;;UAGe;EACf,OAAO;EACP,OAAO;EACP;;UAKe;EACf;EACA;EACA;EACA;EACA,OAAO;EACP,WAAW;EACX,UAAU;EACV;EACA;;UAGe;EACf;EACA,SAAS;;UAKM;EACf;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA,MAAM;EACN;;UAGe;EACf,QAAQ;EACR,SAAS;;KAKC;EACN;EAAmB;;EACnB;EAAmB;EAAmB;;EACtC;EAA6B;EAAmB;;EAChD;EAAuB;EAAmB;EAAe;;UAE9C;EACf,OAAO;EACP;EACA;EACA;;UAGe;EACf,OAAO;EACP;EACA;EACA;EACA;EACA;EACA,WAAW;EACX;EACA,WAAW;;UAGI;EACf;EACA;EACA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