@oxy-hq/sdk 2.12.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/dist/index.cjs +62 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +163 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +163 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +62 -2
- package/dist/index.mjs.map +1 -1
- package/dist/{react-DcT-mUPj.cjs → react-CkAQg9wB.cjs} +65 -5
- package/dist/react-CkAQg9wB.cjs.map +1 -0
- package/dist/{react-BXGyzgz0.mjs → react-Cq3xULOr.mjs} +65 -5
- package/dist/react-Cq3xULOr.mjs.map +1 -0
- package/dist/{react-DW7Z96sD.d.mts → react-D-Sf973d.d.cts} +87 -2
- package/dist/react-D-Sf973d.d.cts.map +1 -0
- package/dist/{react-DW7Z96sD.d.cts → react-D-Sf973d.d.mts} +87 -2
- package/dist/react-D-Sf973d.d.mts.map +1 -0
- package/dist/shell.cjs +35 -1
- package/dist/shell.cjs.map +1 -1
- package/dist/shell.d.cts +25 -2
- package/dist/shell.d.cts.map +1 -1
- package/dist/shell.d.mts +25 -2
- package/dist/shell.d.mts.map +1 -1
- package/dist/shell.mjs +34 -2
- package/dist/shell.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/react-BXGyzgz0.mjs.map +0 -1
- package/dist/react-DW7Z96sD.d.cts.map +0 -1
- package/dist/react-DW7Z96sD.d.mts.map +0 -1
- package/dist/react-DcT-mUPj.cjs.map +0 -1
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
|
|
|
@@ -1086,6 +1086,66 @@ var MetricTreeClient = class {
|
|
|
1086
1086
|
}
|
|
1087
1087
|
};
|
|
1088
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
|
+
|
|
1089
1149
|
//#endregion
|
|
1090
1150
|
exports.AnomaliesClient = AnomaliesClient;
|
|
1091
1151
|
exports.MetricTreeClient = MetricTreeClient;
|
|
@@ -1093,6 +1153,7 @@ exports.OxyAnswer = require_react.OxyAnswer;
|
|
|
1093
1153
|
exports.OxyApiError = require_react.OxyApiError;
|
|
1094
1154
|
exports.OxyAppProvider = require_react.OxyAppProvider;
|
|
1095
1155
|
exports.OxyChat = require_react.OxyChat;
|
|
1156
|
+
exports.PeerCohortClient = PeerCohortClient;
|
|
1096
1157
|
exports.WorldModelScopeUnsupportedError = WorldModelScopeUnsupportedError;
|
|
1097
1158
|
exports._resetCustomAppManifestCacheForTest = require_react._resetCustomAppManifestCacheForTest;
|
|
1098
1159
|
exports.apiErrorFromResponse = require_react.apiErrorFromResponse;
|