@oxy-hq/sdk 2.11.0 → 2.13.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 +44 -4
- package/dist/function-context-D8eyZuw_.d.cts +720 -0
- package/dist/function-context-D8eyZuw_.d.cts.map +1 -0
- package/dist/function-context-D8eyZuw_.d.mts +720 -0
- package/dist/function-context-D8eyZuw_.d.mts.map +1 -0
- package/dist/index.cjs +217 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +499 -638
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +499 -638
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +215 -12
- package/dist/index.mjs.map +1 -1
- package/dist/ops.cjs +85 -0
- package/dist/ops.cjs.map +1 -0
- package/dist/ops.d.cts +61 -0
- package/dist/ops.d.cts.map +1 -0
- package/dist/ops.d.mts +61 -0
- package/dist/ops.d.mts.map +1 -0
- package/dist/ops.mjs +79 -0
- package/dist/ops.mjs.map +1 -0
- package/dist/{react-riTxd9ce.cjs → react-CkAQg9wB.cjs} +72 -7
- package/dist/react-CkAQg9wB.cjs.map +1 -0
- package/dist/{react-DqnINwTi.mjs → react-Cq3xULOr.mjs} +72 -7
- package/dist/react-Cq3xULOr.mjs.map +1 -0
- package/dist/{react-CLONxcnA.d.cts → react-D-Sf973d.d.cts} +94 -2
- package/dist/react-D-Sf973d.d.cts.map +1 -0
- package/dist/{react-CLONxcnA.d.mts → react-D-Sf973d.d.mts} +94 -2
- package/dist/react-D-Sf973d.d.mts.map +1 -0
- package/dist/shell.cjs +68 -4
- package/dist/shell.cjs.map +1 -1
- package/dist/shell.d.cts +62 -7
- package/dist/shell.d.cts.map +1 -1
- package/dist/shell.d.mts +62 -7
- package/dist/shell.d.mts.map +1 -1
- package/dist/shell.mjs +66 -5
- package/dist/shell.mjs.map +1 -1
- package/package.json +13 -2
- package/dist/react-CLONxcnA.d.cts.map +0 -1
- package/dist/react-CLONxcnA.d.mts.map +0 -1
- package/dist/react-DqnINwTi.mjs.map +0 -1
- package/dist/react-riTxd9ce.cjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function-context-D8eyZuw_.d.mts","names":[],"sources":["../src/custom-app/function-context.ts"],"mappings":"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"}
|
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-CkAQg9wB.cjs');
|
|
4
4
|
let react = require("react");
|
|
5
5
|
react = require_react.__toESM(react, 1);
|
|
6
6
|
|
|
@@ -388,14 +388,69 @@ function useSensitivity(measureId, opts = {}) {
|
|
|
388
388
|
* Propagate hypothetical `(measure, delta)` changes upward through the
|
|
389
389
|
* tree and return the estimated impact on every downstream measure — a
|
|
390
390
|
* pure metric-tree walk, no warehouse query. Pass `null` to stay idle.
|
|
391
|
+
*
|
|
392
|
+
* Because it is database-free it can only use the coefficients it is GIVEN.
|
|
393
|
+
* Without `opts.coefficients` from {@link useBaseline}, every driver edge
|
|
394
|
+
* whose `.view.yml` declares no `coefficient:` contributes nothing and its
|
|
395
|
+
* downstream measures are simply absent from `impacts` — no error, no
|
|
396
|
+
* refusal. Without `opts.values`, multiplicative component edges come back
|
|
397
|
+
* `unquantifiable` rather than sized.
|
|
391
398
|
*/
|
|
392
399
|
function usePredict(changes, opts = {}) {
|
|
393
400
|
const { projectId, fetcher } = require_react.useOxyApp();
|
|
394
401
|
const enabled = opts.enabled !== false;
|
|
402
|
+
const { values, coefficients } = opts;
|
|
403
|
+
const body = {
|
|
404
|
+
changes,
|
|
405
|
+
...values ? { values } : {},
|
|
406
|
+
...coefficients?.length ? { coefficients } : {}
|
|
407
|
+
};
|
|
395
408
|
return useMetricTreeEndpoint(projectId && changes ? JSON.stringify({
|
|
396
409
|
projectId,
|
|
397
|
-
|
|
398
|
-
}) : null, (signal) => postJson(fetcher, `${metricTreePath(projectId)}/predict`,
|
|
410
|
+
body
|
|
411
|
+
}) : null, (signal) => postJson(fetcher, `${metricTreePath(projectId)}/predict`, body, signal), enabled);
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Value a scenario's starting point, and measure the coefficients it needs.
|
|
415
|
+
*
|
|
416
|
+
* Two warehouse reads: the current value of every node reachable from
|
|
417
|
+
* `request.roots`, and — for driver edges declaring no `coefficient:` — a fit
|
|
418
|
+
* over the window. Both are expensive, which is why they live here and not in
|
|
419
|
+
* {@link usePredict}: predict is database-free by design so it can re-run per
|
|
420
|
+
* keystroke, and it CANNOT measure a coefficient itself.
|
|
421
|
+
*
|
|
422
|
+
* That is the whole reason to call this. Feed `data.values` and `data.fitted`
|
|
423
|
+
* into `usePredict`; omit them and an undeclared edge propagates nothing.
|
|
424
|
+
* Pass `null` to stay idle until levers and a period are chosen.
|
|
425
|
+
*/
|
|
426
|
+
function useBaseline(request, opts = {}) {
|
|
427
|
+
const { projectId, fetcher } = require_react.useOxyApp();
|
|
428
|
+
const enabled = opts.enabled !== false;
|
|
429
|
+
return useMetricTreeEndpoint(projectId && request ? JSON.stringify({
|
|
430
|
+
projectId,
|
|
431
|
+
request
|
|
432
|
+
}) : null, (signal) => postJson(fetcher, `${metricTreePath(projectId)}/baseline`, request, signal), enabled);
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Bucketed history for the levers and everything downstream, plus the forward
|
|
436
|
+
* curve the forecaster expects next — the scenario's time axis.
|
|
437
|
+
*
|
|
438
|
+
* One warehouse query, so it belongs on a window change, not on a lever edit.
|
|
439
|
+
* It returns the BASELINE curve only: the scenario's second curve is
|
|
440
|
+
* arithmetic over this and a `usePredict` result — a proportional shift
|
|
441
|
+
* landing `lag` buckets in — composed client-side precisely so editing a lever
|
|
442
|
+
* costs no query.
|
|
443
|
+
*
|
|
444
|
+
* Treat a series with a `refusal` as a stated absence: it must not render as a
|
|
445
|
+
* flat forward line. Pass `null` to stay idle.
|
|
446
|
+
*/
|
|
447
|
+
function useProjection(request, opts = {}) {
|
|
448
|
+
const { projectId, fetcher } = require_react.useOxyApp();
|
|
449
|
+
const enabled = opts.enabled !== false;
|
|
450
|
+
return useMetricTreeEndpoint(projectId && request ? JSON.stringify({
|
|
451
|
+
projectId,
|
|
452
|
+
request
|
|
453
|
+
}) : null, (signal) => postJson(fetcher, `${metricTreePath(projectId)}/projection`, request, signal), enabled);
|
|
399
454
|
}
|
|
400
455
|
/**
|
|
401
456
|
* Period-over-period root-cause decomposition: recursively splits the
|
|
@@ -556,9 +611,9 @@ function useWorldModelGraph(opts = {}) {
|
|
|
556
611
|
* to stay idle until an entity is chosen.
|
|
557
612
|
*/
|
|
558
613
|
function useWorldModelInstances(entityId, opts = {}) {
|
|
559
|
-
const { projectId, fetcher } = require_react.useOxyApp();
|
|
614
|
+
const { projectId, appId, fetcher } = require_react.useOxyApp();
|
|
560
615
|
const enabled = opts.enabled !== false;
|
|
561
|
-
const { search, limit } = opts;
|
|
616
|
+
const { search, limit, scope } = opts;
|
|
562
617
|
const [data, setData] = react.useState(null);
|
|
563
618
|
const [loading, setLoading] = react.useState(enabled && !!projectId && !!entityId);
|
|
564
619
|
const [error, setError] = react.useState(null);
|
|
@@ -575,6 +630,10 @@ function useWorldModelInstances(entityId, opts = {}) {
|
|
|
575
630
|
const params = new URLSearchParams({ entity: entityId });
|
|
576
631
|
if (search) params.set("search", search);
|
|
577
632
|
if (limit != null) params.set("limit", String(limit));
|
|
633
|
+
if (scope) {
|
|
634
|
+
params.set("scope", scope);
|
|
635
|
+
if (appId) params.set("app", appId);
|
|
636
|
+
}
|
|
578
637
|
fetcher(`${worldModelPath(projectId)}/instances?${params}`, {
|
|
579
638
|
method: "GET",
|
|
580
639
|
signal: ctrl.signal
|
|
@@ -601,7 +660,9 @@ function useWorldModelInstances(entityId, opts = {}) {
|
|
|
601
660
|
entityId,
|
|
602
661
|
search,
|
|
603
662
|
limit,
|
|
604
|
-
fetcher
|
|
663
|
+
fetcher,
|
|
664
|
+
scope,
|
|
665
|
+
appId
|
|
605
666
|
]);
|
|
606
667
|
return {
|
|
607
668
|
data,
|
|
@@ -818,9 +879,10 @@ function useWorldModel() {
|
|
|
818
879
|
//#endregion
|
|
819
880
|
//#region src/metricTree.ts
|
|
820
881
|
/**
|
|
821
|
-
* Client for the `/semantic/metric-tree*` endpoints. Surfaces the
|
|
822
|
-
*
|
|
823
|
-
*
|
|
882
|
+
* Client for the `/semantic/metric-tree*` endpoints. Surfaces the airlayer
|
|
883
|
+
* metric-tree analyses — tree introspection, sensitivity, explain, opportunity
|
|
884
|
+
* — plus the three legs of scenario forecasting (`baseline` levels,
|
|
885
|
+
* `predict` propagation, `projection` curves) over typed methods.
|
|
824
886
|
*
|
|
825
887
|
* Construction is internal to {@link OxyClient} — call `client.metricTree`
|
|
826
888
|
* to access an instance rather than building one yourself.
|
|
@@ -880,9 +942,50 @@ var MetricTreeClient = class {
|
|
|
880
942
|
return this.request(this.path(`/${encodeURIComponent(measureId)}/sensitivity${query}`));
|
|
881
943
|
}
|
|
882
944
|
/**
|
|
945
|
+
* Value a change's starting point, and measure the coefficients it needs.
|
|
946
|
+
*
|
|
947
|
+
* Two warehouse reads: the current value of every node reachable from
|
|
948
|
+
* `roots`, and — for driver edges that declare no `coefficient:` — a fit
|
|
949
|
+
* over the window. Both are expensive, which is why they live here and not
|
|
950
|
+
* in `predict`: `predict` is database-free by design so it can re-run per
|
|
951
|
+
* keystroke, and it CANNOT measure a coefficient itself.
|
|
952
|
+
*
|
|
953
|
+
* That is the whole reason to call this. Pass `fitted` back into `predict`
|
|
954
|
+
* and an undeclared edge propagates; omit it and `predict` has nothing to
|
|
955
|
+
* multiply by, so the impact is simply absent — no error, no refusal, just a
|
|
956
|
+
* downstream measure that never appears.
|
|
957
|
+
*
|
|
958
|
+
* @example
|
|
959
|
+
* ```typescript
|
|
960
|
+
* const baseline = await client.metricTree.getBaseline({
|
|
961
|
+
* roots: ["marketing_spend.total_spend"],
|
|
962
|
+
* time_dimension: "orders.order_date",
|
|
963
|
+
* period: ["2025-09-01", "2025-09-30"],
|
|
964
|
+
* });
|
|
965
|
+
* const result = await client.metricTree.predict(
|
|
966
|
+
* [{ measure: "marketing_spend.total_spend", delta: 10000 }],
|
|
967
|
+
* { values: baseline.values, coefficients: baseline.fitted }
|
|
968
|
+
* );
|
|
969
|
+
* ```
|
|
970
|
+
*/
|
|
971
|
+
async getBaseline(request) {
|
|
972
|
+
const query = this.buildQuery();
|
|
973
|
+
return this.request(this.path(`/baseline${query}`), {
|
|
974
|
+
method: "POST",
|
|
975
|
+
body: JSON.stringify(request)
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
/**
|
|
883
979
|
* Propagate hypothetical `(measure, delta)` changes upward through the
|
|
884
980
|
* tree. Returns the estimated impact on every downstream measure.
|
|
885
981
|
*
|
|
982
|
+
* Database-free, so it re-runs cheaply — and so it can only use
|
|
983
|
+
* coefficients it is GIVEN. Without `options.coefficients` from
|
|
984
|
+
* {@link getBaseline}, every edge whose `.view.yml` declares no
|
|
985
|
+
* `coefficient:` contributes nothing and its downstream measures are
|
|
986
|
+
* silently missing from `impacts`. Without `options.values`, multiplicative
|
|
987
|
+
* component edges come back `unquantifiable` rather than sized.
|
|
988
|
+
*
|
|
886
989
|
* @example
|
|
887
990
|
* ```typescript
|
|
888
991
|
* const result = await client.metricTree.predict([
|
|
@@ -890,11 +993,51 @@ var MetricTreeClient = class {
|
|
|
890
993
|
* ]);
|
|
891
994
|
* ```
|
|
892
995
|
*/
|
|
893
|
-
async predict(changes) {
|
|
996
|
+
async predict(changes, options = {}) {
|
|
894
997
|
const query = this.buildQuery();
|
|
895
998
|
return this.request(this.path(`/predict${query}`), {
|
|
896
999
|
method: "POST",
|
|
897
|
-
body: JSON.stringify({
|
|
1000
|
+
body: JSON.stringify({
|
|
1001
|
+
changes,
|
|
1002
|
+
...options.values ? { values: options.values } : {},
|
|
1003
|
+
...options.coefficients?.length ? { coefficients: options.coefficients } : {}
|
|
1004
|
+
})
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
/**
|
|
1008
|
+
* Draw the scenario's time axis: bucketed history for the levers and
|
|
1009
|
+
* everything downstream, plus the forward curve the detector's own model
|
|
1010
|
+
* expects next.
|
|
1011
|
+
*
|
|
1012
|
+
* The third leg of scenario forecasting. {@link getBaseline} gives levels
|
|
1013
|
+
* and coefficients, {@link predict} propagates a change with no database at
|
|
1014
|
+
* all, and this gives time — one warehouse query, so treat it like the
|
|
1015
|
+
* baseline: fetch on a window change, not on a lever edit.
|
|
1016
|
+
*
|
|
1017
|
+
* **Returns the BASELINE curve only.** The scenario's second curve is
|
|
1018
|
+
* arithmetic over this and a `predict` result — a proportional shift landing
|
|
1019
|
+
* `lag` buckets in — and is composed client-side deliberately, so editing a
|
|
1020
|
+
* lever costs no query.
|
|
1021
|
+
*
|
|
1022
|
+
* @example
|
|
1023
|
+
* ```typescript
|
|
1024
|
+
* const projection = await client.metricTree.getProjection({
|
|
1025
|
+
* roots: ["marketing_spend.total_spend"],
|
|
1026
|
+
* time_dimension: "orders.order_date",
|
|
1027
|
+
* period: ["2024-09-01", "2025-08-31"],
|
|
1028
|
+
* granularity: "day",
|
|
1029
|
+
* horizon: 30,
|
|
1030
|
+
* });
|
|
1031
|
+
* for (const series of projection.series) {
|
|
1032
|
+
* if (series.refusal) console.warn(series.measure, series.refusal);
|
|
1033
|
+
* }
|
|
1034
|
+
* ```
|
|
1035
|
+
*/
|
|
1036
|
+
async getProjection(request) {
|
|
1037
|
+
const query = this.buildQuery();
|
|
1038
|
+
return this.request(this.path(`/projection${query}`), {
|
|
1039
|
+
method: "POST",
|
|
1040
|
+
body: JSON.stringify(request)
|
|
898
1041
|
});
|
|
899
1042
|
}
|
|
900
1043
|
/**
|
|
@@ -943,6 +1086,66 @@ var MetricTreeClient = class {
|
|
|
943
1086
|
}
|
|
944
1087
|
};
|
|
945
1088
|
|
|
1089
|
+
//#endregion
|
|
1090
|
+
//#region src/peerCohort.ts
|
|
1091
|
+
/**
|
|
1092
|
+
* Client for the `/semantic/cohort` endpoint. Surfaces airlayer's peer-cohort
|
|
1093
|
+
* benchmarking — comparing an entity's subjects against their declared peers
|
|
1094
|
+
* on a measure, with exclusions explained rather than silently dropped.
|
|
1095
|
+
*
|
|
1096
|
+
* Construction is internal to {@link OxyClient} — call `client.peerCohort`
|
|
1097
|
+
* to access an instance rather than building one yourself.
|
|
1098
|
+
*
|
|
1099
|
+
* @example
|
|
1100
|
+
* ```typescript
|
|
1101
|
+
* const client = await OxyClient.create({ projectId: "...", apiKey: "..." });
|
|
1102
|
+
* const result = await client.peerCohort.resolve({
|
|
1103
|
+
* entity: "restaurant_id",
|
|
1104
|
+
* measure: "orders.net_revenue",
|
|
1105
|
+
* time_dimension: "orders.order_date",
|
|
1106
|
+
* period: ["2025-09-01", "2025-09-30"],
|
|
1107
|
+
* });
|
|
1108
|
+
* for (const excluded of result.excluded) {
|
|
1109
|
+
* console.warn(excluded.key, excluded.reason);
|
|
1110
|
+
* }
|
|
1111
|
+
* ```
|
|
1112
|
+
*/
|
|
1113
|
+
var PeerCohortClient = class {
|
|
1114
|
+
constructor(config, request) {
|
|
1115
|
+
this.config = config;
|
|
1116
|
+
this.request = request;
|
|
1117
|
+
}
|
|
1118
|
+
path(suffix) {
|
|
1119
|
+
return `/${this.config.projectId}${suffix}`;
|
|
1120
|
+
}
|
|
1121
|
+
buildQuery(extra = {}) {
|
|
1122
|
+
const params = { ...extra };
|
|
1123
|
+
if (this.config.branch) params.branch = this.config.branch;
|
|
1124
|
+
const qs = new URLSearchParams(params).toString();
|
|
1125
|
+
return qs ? `?${qs}` : "";
|
|
1126
|
+
}
|
|
1127
|
+
/**
|
|
1128
|
+
* Resolve a subject's peer cohort and every peer's comparison against it.
|
|
1129
|
+
*
|
|
1130
|
+
* @example
|
|
1131
|
+
* ```typescript
|
|
1132
|
+
* const result = await client.peerCohort.resolve({
|
|
1133
|
+
* entity: "restaurant_id",
|
|
1134
|
+
* measure: "orders.net_revenue",
|
|
1135
|
+
* time_dimension: "orders.order_date",
|
|
1136
|
+
* period: ["2025-09-01", "2025-09-30"],
|
|
1137
|
+
* });
|
|
1138
|
+
* ```
|
|
1139
|
+
*/
|
|
1140
|
+
async resolve(request) {
|
|
1141
|
+
const query = this.buildQuery();
|
|
1142
|
+
return this.request(this.path(`/semantic/cohort${query}`), {
|
|
1143
|
+
method: "POST",
|
|
1144
|
+
body: JSON.stringify(request)
|
|
1145
|
+
});
|
|
1146
|
+
}
|
|
1147
|
+
};
|
|
1148
|
+
|
|
946
1149
|
//#endregion
|
|
947
1150
|
exports.AnomaliesClient = AnomaliesClient;
|
|
948
1151
|
exports.MetricTreeClient = MetricTreeClient;
|
|
@@ -950,6 +1153,7 @@ exports.OxyAnswer = require_react.OxyAnswer;
|
|
|
950
1153
|
exports.OxyApiError = require_react.OxyApiError;
|
|
951
1154
|
exports.OxyAppProvider = require_react.OxyAppProvider;
|
|
952
1155
|
exports.OxyChat = require_react.OxyChat;
|
|
1156
|
+
exports.PeerCohortClient = PeerCohortClient;
|
|
953
1157
|
exports.WorldModelScopeUnsupportedError = WorldModelScopeUnsupportedError;
|
|
954
1158
|
exports._resetCustomAppManifestCacheForTest = require_react._resetCustomAppManifestCacheForTest;
|
|
955
1159
|
exports.apiErrorFromResponse = require_react.apiErrorFromResponse;
|
|
@@ -964,6 +1168,7 @@ exports.readInjectedAppConfig = require_react.readInjectedAppConfig;
|
|
|
964
1168
|
exports.readJsonSseStream = readJsonSseStream;
|
|
965
1169
|
exports.setOxyAppLogger = require_react.setOxyAppLogger;
|
|
966
1170
|
exports.useAgentRun = require_react.useAgentRun;
|
|
1171
|
+
exports.useBaseline = useBaseline;
|
|
967
1172
|
exports.useDistribution = useDistribution;
|
|
968
1173
|
exports.useExplain = useExplain;
|
|
969
1174
|
exports.useFunction = require_react.useFunction;
|
|
@@ -973,6 +1178,7 @@ exports.useOpportunity = useOpportunity;
|
|
|
973
1178
|
exports.useOxyApp = require_react.useOxyApp;
|
|
974
1179
|
exports.usePredict = usePredict;
|
|
975
1180
|
exports.useProcedureRun = require_react.useProcedureRun;
|
|
1181
|
+
exports.useProjection = useProjection;
|
|
976
1182
|
exports.useQuery = require_react.useQuery;
|
|
977
1183
|
exports.useResolvedManifest = require_react.useResolvedManifest;
|
|
978
1184
|
exports.useSemanticQuery = require_react.useSemanticQuery;
|