@arizeai/phoenix-client 7.5.0 → 7.7.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/CHANGELOG.md +781 -0
- package/README.md +27 -3
- package/dist/esm/__generated__/api/v1.d.ts +749 -203
- package/dist/esm/__generated__/api/v1.d.ts.map +1 -1
- package/dist/esm/constants/serverRequirements.d.ts +2 -0
- package/dist/esm/constants/serverRequirements.d.ts.map +1 -1
- package/dist/esm/constants/serverRequirements.js +14 -0
- package/dist/esm/constants/serverRequirements.js.map +1 -1
- package/dist/esm/projects/index.d.ts +1 -0
- package/dist/esm/projects/index.d.ts.map +1 -1
- package/dist/esm/projects/index.js +1 -0
- package/dist/esm/projects/index.js.map +1 -1
- package/dist/esm/projects/setProjectRetentionPolicy.d.ts +49 -0
- package/dist/esm/projects/setProjectRetentionPolicy.d.ts.map +1 -0
- package/dist/esm/projects/setProjectRetentionPolicy.js +52 -0
- package/dist/esm/projects/setProjectRetentionPolicy.js.map +1 -0
- package/dist/esm/prompts/deletePrompt.d.ts +39 -0
- package/dist/esm/prompts/deletePrompt.d.ts.map +1 -0
- package/dist/esm/prompts/deletePrompt.js +52 -0
- package/dist/esm/prompts/deletePrompt.js.map +1 -0
- package/dist/esm/prompts/index.d.ts +1 -0
- package/dist/esm/prompts/index.d.ts.map +1 -1
- package/dist/esm/prompts/index.js +1 -0
- package/dist/esm/prompts/index.js.map +1 -1
- package/dist/esm/testing/reporter-format.d.ts.map +1 -1
- package/dist/esm/testing/reporter-format.js +13 -3
- package/dist/esm/testing/reporter-format.js.map +1 -1
- package/dist/esm/traces/getTraces.d.ts +1 -1
- package/dist/esm/traces/getTraces.d.ts.map +1 -1
- package/dist/esm/traces/index.d.ts +1 -0
- package/dist/esm/traces/index.d.ts.map +1 -1
- package/dist/esm/traces/index.js +1 -0
- package/dist/esm/traces/index.js.map +1 -1
- package/dist/esm/traces/transferTraces.d.ts +56 -0
- package/dist/esm/traces/transferTraces.d.ts.map +1 -0
- package/dist/esm/traces/transferTraces.js +56 -0
- package/dist/esm/traces/transferTraces.js.map +1 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/types/prompts.d.ts +9 -0
- package/dist/esm/types/prompts.d.ts.map +1 -1
- package/dist/esm/types/prompts.js.map +1 -1
- package/dist/esm/users/getCurrentUser.d.ts +25 -0
- package/dist/esm/users/getCurrentUser.d.ts.map +1 -0
- package/dist/esm/users/getCurrentUser.js +30 -0
- package/dist/esm/users/getCurrentUser.js.map +1 -0
- package/dist/esm/users/index.d.ts +2 -0
- package/dist/esm/users/index.d.ts.map +1 -0
- package/dist/esm/users/index.js +2 -0
- package/dist/esm/users/index.js.map +1 -0
- package/dist/esm/utils/resolvePromptIdentifier.d.ts +17 -0
- package/dist/esm/utils/resolvePromptIdentifier.d.ts.map +1 -0
- package/dist/esm/utils/resolvePromptIdentifier.js +36 -0
- package/dist/esm/utils/resolvePromptIdentifier.js.map +1 -0
- package/dist/src/__generated__/api/v1.d.ts +749 -203
- package/dist/src/__generated__/api/v1.d.ts.map +1 -1
- package/dist/src/constants/serverRequirements.d.ts +2 -0
- package/dist/src/constants/serverRequirements.d.ts.map +1 -1
- package/dist/src/constants/serverRequirements.js +15 -1
- package/dist/src/constants/serverRequirements.js.map +1 -1
- package/dist/src/projects/index.d.ts +1 -0
- package/dist/src/projects/index.d.ts.map +1 -1
- package/dist/src/projects/index.js +1 -0
- package/dist/src/projects/index.js.map +1 -1
- package/dist/src/projects/setProjectRetentionPolicy.d.ts +49 -0
- package/dist/src/projects/setProjectRetentionPolicy.d.ts.map +1 -0
- package/dist/src/projects/setProjectRetentionPolicy.js +59 -0
- package/dist/src/projects/setProjectRetentionPolicy.js.map +1 -0
- package/dist/src/prompts/deletePrompt.d.ts +39 -0
- package/dist/src/prompts/deletePrompt.d.ts.map +1 -0
- package/dist/src/prompts/deletePrompt.js +55 -0
- package/dist/src/prompts/deletePrompt.js.map +1 -0
- package/dist/src/prompts/index.d.ts +1 -0
- package/dist/src/prompts/index.d.ts.map +1 -1
- package/dist/src/prompts/index.js +1 -0
- package/dist/src/prompts/index.js.map +1 -1
- package/dist/src/testing/reporter-format.d.ts.map +1 -1
- package/dist/src/testing/reporter-format.js +13 -3
- package/dist/src/testing/reporter-format.js.map +1 -1
- package/dist/src/traces/getTraces.d.ts +1 -1
- package/dist/src/traces/getTraces.d.ts.map +1 -1
- package/dist/src/traces/index.d.ts +1 -0
- package/dist/src/traces/index.d.ts.map +1 -1
- package/dist/src/traces/index.js +1 -0
- package/dist/src/traces/index.js.map +1 -1
- package/dist/src/traces/transferTraces.d.ts +56 -0
- package/dist/src/traces/transferTraces.d.ts.map +1 -0
- package/dist/src/traces/transferTraces.js +59 -0
- package/dist/src/traces/transferTraces.js.map +1 -0
- package/dist/src/types/prompts.d.ts +9 -0
- package/dist/src/types/prompts.d.ts.map +1 -1
- package/dist/src/types/prompts.js.map +1 -1
- package/dist/src/users/getCurrentUser.d.ts +25 -0
- package/dist/src/users/getCurrentUser.d.ts.map +1 -0
- package/dist/src/users/getCurrentUser.js +36 -0
- package/dist/src/users/getCurrentUser.js.map +1 -0
- package/dist/src/users/index.d.ts +2 -0
- package/dist/src/users/index.d.ts.map +1 -0
- package/dist/src/users/index.js +18 -0
- package/dist/src/users/index.js.map +1 -0
- package/dist/src/utils/resolvePromptIdentifier.d.ts +17 -0
- package/dist/src/utils/resolvePromptIdentifier.d.ts.map +1 -0
- package/dist/src/utils/resolvePromptIdentifier.js +39 -0
- package/dist/src/utils/resolvePromptIdentifier.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docs/overview.mdx +8 -4
- package/docs/projects.mdx +71 -0
- package/docs/prompts.mdx +19 -1
- package/docs/traces.mdx +28 -2
- package/docs/users.mdx +44 -0
- package/package.json +16 -12
- package/src/__generated__/api/v1.ts +749 -203
- package/src/constants/serverRequirements.ts +16 -0
- package/src/projects/index.ts +1 -0
- package/src/projects/setProjectRetentionPolicy.ts +80 -0
- package/src/prompts/deletePrompt.ts +70 -0
- package/src/prompts/index.ts +1 -0
- package/src/testing/reporter-format.ts +13 -3
- package/src/traces/getTraces.ts +1 -1
- package/src/traces/index.ts +1 -0
- package/src/traces/transferTraces.ts +89 -0
- package/src/types/prompts.ts +10 -0
- package/src/users/getCurrentUser.ts +39 -0
- package/src/users/index.ts +1 -0
- package/src/utils/resolvePromptIdentifier.ts +41 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/traces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,iDAA+B;AAC/B,8CAA4B;AAC5B,wDAAsC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/traces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,iDAA+B;AAC/B,8CAA4B;AAC5B,wDAAsC;AACtC,mDAAiC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { ClientFn } from "../types/core";
|
|
2
|
+
/**
|
|
3
|
+
* Parameters for moving traces to another project.
|
|
4
|
+
*/
|
|
5
|
+
export interface TransferTracesParams extends ClientFn {
|
|
6
|
+
/**
|
|
7
|
+
* Trace GlobalIDs or OpenTelemetry trace IDs to move. All traces must
|
|
8
|
+
* currently belong to the same source project.
|
|
9
|
+
*/
|
|
10
|
+
traceIdentifiers: string[];
|
|
11
|
+
/**
|
|
12
|
+
* The destination project name or GlobalID.
|
|
13
|
+
*/
|
|
14
|
+
destinationProjectIdentifier: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The result of moving traces to another project.
|
|
18
|
+
*/
|
|
19
|
+
export interface TransferTracesResult {
|
|
20
|
+
/** The number of distinct traces moved. */
|
|
21
|
+
transferredTraceCount: number;
|
|
22
|
+
/** The destination project's GlobalID. */
|
|
23
|
+
destinationProjectId: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Move traces from one project to another.
|
|
27
|
+
*
|
|
28
|
+
* This operation re-parents the traces; it does not copy them. After the move,
|
|
29
|
+
* the traces no longer appear in their original project. Every trace must
|
|
30
|
+
* currently belong to the same source project.
|
|
31
|
+
*
|
|
32
|
+
* @param params - The parameters for moving traces.
|
|
33
|
+
* @param params.traceIdentifiers - Trace GlobalIDs or OpenTelemetry trace IDs to move.
|
|
34
|
+
* @param params.destinationProjectIdentifier - The destination project name or GlobalID.
|
|
35
|
+
* @returns The number of traces moved and the destination project's GlobalID.
|
|
36
|
+
* @throws {RangeError} If no trace identifiers are provided.
|
|
37
|
+
* @throws {HttpError} If a trace or destination project is missing, the traces
|
|
38
|
+
* belong to multiple source projects, or the transfer otherwise fails.
|
|
39
|
+
*
|
|
40
|
+
* @requires Phoenix server >= 20.4.0
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* import { transferTraces } from "@arizeai/phoenix-client/traces";
|
|
45
|
+
*
|
|
46
|
+
* const result = await transferTraces({
|
|
47
|
+
* traceIdentifiers: ["8f3a...", "VHJhY2U6Mg=="],
|
|
48
|
+
* destinationProjectIdentifier: "production",
|
|
49
|
+
* });
|
|
50
|
+
*
|
|
51
|
+
* console.log(result.transferredTraceCount);
|
|
52
|
+
* console.log(result.destinationProjectId);
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function transferTraces({ client: _client, traceIdentifiers, destinationProjectIdentifier, }: TransferTracesParams): Promise<TransferTracesResult>;
|
|
56
|
+
//# sourceMappingURL=transferTraces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transferTraces.d.ts","sourceRoot":"","sources":["../../../src/traces/transferTraces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG9C;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,QAAQ;IACpD;;;OAGG;IACH,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B;;OAEG;IACH,4BAA4B,EAAE,MAAM,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,2CAA2C;IAC3C,qBAAqB,EAAE,MAAM,CAAC;IAC9B,0CAA0C;IAC1C,oBAAoB,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,cAAc,CAAC,EACnC,MAAM,EAAE,OAAO,EACf,gBAAgB,EAChB,4BAA4B,GAC7B,EAAE,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAwBtD"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transferTraces = transferTraces;
|
|
4
|
+
const client_1 = require("../client");
|
|
5
|
+
const serverRequirements_1 = require("../constants/serverRequirements");
|
|
6
|
+
const serverVersionUtils_1 = require("../utils/serverVersionUtils");
|
|
7
|
+
/**
|
|
8
|
+
* Move traces from one project to another.
|
|
9
|
+
*
|
|
10
|
+
* This operation re-parents the traces; it does not copy them. After the move,
|
|
11
|
+
* the traces no longer appear in their original project. Every trace must
|
|
12
|
+
* currently belong to the same source project.
|
|
13
|
+
*
|
|
14
|
+
* @param params - The parameters for moving traces.
|
|
15
|
+
* @param params.traceIdentifiers - Trace GlobalIDs or OpenTelemetry trace IDs to move.
|
|
16
|
+
* @param params.destinationProjectIdentifier - The destination project name or GlobalID.
|
|
17
|
+
* @returns The number of traces moved and the destination project's GlobalID.
|
|
18
|
+
* @throws {RangeError} If no trace identifiers are provided.
|
|
19
|
+
* @throws {HttpError} If a trace or destination project is missing, the traces
|
|
20
|
+
* belong to multiple source projects, or the transfer otherwise fails.
|
|
21
|
+
*
|
|
22
|
+
* @requires Phoenix server >= 20.4.0
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* import { transferTraces } from "@arizeai/phoenix-client/traces";
|
|
27
|
+
*
|
|
28
|
+
* const result = await transferTraces({
|
|
29
|
+
* traceIdentifiers: ["8f3a...", "VHJhY2U6Mg=="],
|
|
30
|
+
* destinationProjectIdentifier: "production",
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* console.log(result.transferredTraceCount);
|
|
34
|
+
* console.log(result.destinationProjectId);
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
async function transferTraces({ client: _client, traceIdentifiers, destinationProjectIdentifier, }) {
|
|
38
|
+
if (traceIdentifiers.length === 0) {
|
|
39
|
+
throw new RangeError("At least one trace identifier is required");
|
|
40
|
+
}
|
|
41
|
+
const client = _client !== null && _client !== void 0 ? _client : (0, client_1.createClient)();
|
|
42
|
+
await (0, serverVersionUtils_1.ensureServerCapability)({ client, requirement: serverRequirements_1.TRANSFER_TRACES });
|
|
43
|
+
const { data, error } = await client.POST("/v1/traces/transfer", {
|
|
44
|
+
body: {
|
|
45
|
+
trace_identifiers: traceIdentifiers,
|
|
46
|
+
destination_project_identifier: destinationProjectIdentifier,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
if (error)
|
|
50
|
+
throw error;
|
|
51
|
+
if (!(data === null || data === void 0 ? void 0 : data.data)) {
|
|
52
|
+
throw new Error("Failed to transfer traces: no data returned");
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
transferredTraceCount: data.data.transferred_trace_count,
|
|
56
|
+
destinationProjectId: data.data.destination_project_id,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=transferTraces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transferTraces.js","sourceRoot":"","sources":["../../../src/traces/transferTraces.ts"],"names":[],"mappings":";;;AAAA,sCAAyC;AACzC,wEAAkE;AAElE,oEAAqE;AA2BrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACI,KAAK,yBAAyB,EACnC,MAAM,EAAE,OAAO,EACf,gBAAgB,EAChB,4BAA4B,GACP;IACrB,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,UAAU,CAAC,2CAA2C,CAAC,CAAC;IACpE,CAAC;IAED,MAAM,MAAM,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,IAAA,qBAAY,GAAE,CAAC;IACzC,MAAM,IAAA,2CAAsB,EAAC,EAAE,MAAM,EAAE,WAAW,EAAE,oCAAe,EAAE,CAAC,CAAC;IAEvE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,qBAAqB,EAAE;QAC/D,IAAI,EAAE;YACJ,iBAAiB,EAAE,gBAAgB;YACnC,8BAA8B,EAAE,4BAA4B;SAC7D;KACF,CAAC,CAAC;IAEH,IAAI,KAAK;QAAE,MAAM,KAAK,CAAC;IACvB,IAAI,EAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAA,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACjE,CAAC;IAED,OAAO;QACL,qBAAqB,EAAE,IAAI,CAAC,IAAI,CAAC,uBAAuB;QACxD,oBAAoB,EAAE,IAAI,CAAC,IAAI,CAAC,sBAAsB;KACvD,CAAC;AACJ,CAAC"}
|
|
@@ -44,6 +44,15 @@ export interface GetPromptByTagSelector {
|
|
|
44
44
|
* Can be a prompt id, a prompt name, a prompt version id, or a prompt name + tag.
|
|
45
45
|
*/
|
|
46
46
|
export type PromptSelector = GetPromptByIdSelector | GetPromptByNameSelector | GetPromptByVersionSelector | GetPromptByTagSelector;
|
|
47
|
+
/**
|
|
48
|
+
* A selector for a prompt as a whole, rather than for one of its versions.
|
|
49
|
+
*
|
|
50
|
+
* Narrower than {@link PromptSelector}: a version id or a name + tag picks out a
|
|
51
|
+
* single version, which is not what operations on the prompt itself act on. Use
|
|
52
|
+
* this wherever the API needs the `{prompt_identifier}` path segment — the name
|
|
53
|
+
* and the prompt id are the two things the Phoenix REST API accepts there.
|
|
54
|
+
*/
|
|
55
|
+
export type PromptIdentifier = GetPromptByIdSelector | GetPromptByNameSelector;
|
|
47
56
|
/**
|
|
48
57
|
* The prompt data needed to create a prompt.
|
|
49
58
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/types/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAC3B,QAAQ,GACR,cAAc,GACd,WAAW,GACX,QAAQ,GACR,UAAU,GACV,KAAK,GACL,QAAQ,GACR,KAAK,GACL,UAAU,GACV,WAAW,GACX,MAAM,GACN,UAAU,GACV,YAAY,CAAC;AAEjB;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAC1B,SAAS,GACT,cAAc,GACd,QAAQ,GACR,WAAW,GACX,WAAW,CAAC;AAEhB;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,QAAQ,GAAG,IAAI,GAAG,MAAM,CAAC;AAEtE;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,GACtB,qBAAqB,GACrB,uBAAuB,GACvB,0BAA0B,GAC1B,sBAAsB,CAAC;AAE3B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AU,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC,CAAC;AAEnE;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/E,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,IAAI,aAAa,CAEvE;AAED,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,UAAU,GACf,IAAI,IAAI,kBAAkB,CAE5B;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,CACxC,UAAU,CAAC,SAAS,CAAC,CAAC,aAAa,CAAC,CAAC,aAAa,CAAC,CACpD,CAAC;AACF;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAC9B,UAAU,CAAC,SAAS,CAAC,CAAC,gCAAgC,CAAC,CAAC;AAE1D;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../src/types/prompts.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../src/types/prompts.ts"],"names":[],"mappings":";;;;AAqLA,yBAAgC,IAAgB;IAC9C,OAAO,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC;AAC7B,CAAC;AAED,8BACE,IAAgB;IAEhB,OAAO,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { components } from "../__generated__/api/v1";
|
|
2
|
+
import type { ClientFn } from "../types/core";
|
|
3
|
+
/** The user profile returned for the current Phoenix client credentials. */
|
|
4
|
+
export type CurrentUser = components["schemas"]["GetViewerResponseBody"]["data"];
|
|
5
|
+
/**
|
|
6
|
+
* Get the currently authenticated user.
|
|
7
|
+
*
|
|
8
|
+
* When authentication is disabled, Phoenix returns an anonymous user with
|
|
9
|
+
* `auth_method: "ANONYMOUS"`.
|
|
10
|
+
*
|
|
11
|
+
* @param params - The parameters for fetching the current user.
|
|
12
|
+
* @param params.client - An optional Phoenix client instance.
|
|
13
|
+
* @returns The current user's generated API profile shape.
|
|
14
|
+
* @throws {HttpError} If the request is not authenticated or is forbidden.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { getCurrentUser } from "@arizeai/phoenix-client/users";
|
|
19
|
+
*
|
|
20
|
+
* const user = await getCurrentUser();
|
|
21
|
+
* console.log(user.auth_method);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function getCurrentUser({ client: _client, }?: ClientFn): Promise<CurrentUser>;
|
|
25
|
+
//# sourceMappingURL=getCurrentUser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCurrentUser.d.ts","sourceRoot":"","sources":["../../../src/users/getCurrentUser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,4EAA4E;AAC5E,MAAM,MAAM,WAAW,GACrB,UAAU,CAAC,SAAS,CAAC,CAAC,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,cAAc,CAAC,EACnC,MAAM,EAAE,OAAO,GAChB,GAAE,QAAa,GAAG,OAAO,CAAC,WAAW,CAAC,CAOtC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getCurrentUser = getCurrentUser;
|
|
7
|
+
const tiny_invariant_1 = __importDefault(require("tiny-invariant"));
|
|
8
|
+
const client_1 = require("../client");
|
|
9
|
+
/**
|
|
10
|
+
* Get the currently authenticated user.
|
|
11
|
+
*
|
|
12
|
+
* When authentication is disabled, Phoenix returns an anonymous user with
|
|
13
|
+
* `auth_method: "ANONYMOUS"`.
|
|
14
|
+
*
|
|
15
|
+
* @param params - The parameters for fetching the current user.
|
|
16
|
+
* @param params.client - An optional Phoenix client instance.
|
|
17
|
+
* @returns The current user's generated API profile shape.
|
|
18
|
+
* @throws {HttpError} If the request is not authenticated or is forbidden.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { getCurrentUser } from "@arizeai/phoenix-client/users";
|
|
23
|
+
*
|
|
24
|
+
* const user = await getCurrentUser();
|
|
25
|
+
* console.log(user.auth_method);
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
async function getCurrentUser({ client: _client, } = {}) {
|
|
29
|
+
const client = _client !== null && _client !== void 0 ? _client : (0, client_1.createClient)();
|
|
30
|
+
const { data, error } = await client.GET("/v1/user");
|
|
31
|
+
if (error)
|
|
32
|
+
throw error;
|
|
33
|
+
(0, tiny_invariant_1.default)(data === null || data === void 0 ? void 0 : data.data, "Failed to get current user");
|
|
34
|
+
return data.data;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=getCurrentUser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCurrentUser.js","sourceRoot":"","sources":["../../../src/users/getCurrentUser.ts"],"names":[],"mappings":";;;;;;AAAA,oEAAuC;AAGvC,sCAAyC;AAOzC;;;;;;;;;;;;;;;;;;GAkBG;AACI,KAAK,yBAAyB,EACnC,MAAM,EAAE,OAAO,GAChB,GAAa,EAAE;IACd,MAAM,MAAM,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,IAAA,qBAAY,GAAE,CAAC;IACzC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAErD,IAAI,KAAK;QAAE,MAAM,KAAK,CAAC;IACvB,IAAA,wBAAS,EAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,EAAE,4BAA4B,CAAC,CAAC;IACpD,OAAO,IAAI,CAAC,IAAI,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/users/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./getCurrentUser"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/users/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PromptIdentifier } from "../types/prompts";
|
|
2
|
+
/**
|
|
3
|
+
* Resolve a prompt-level selector to the `{prompt_identifier}` path segment the
|
|
4
|
+
* Phoenix REST API expects.
|
|
5
|
+
*
|
|
6
|
+
* Version-level selectors are rejected rather than silently widened: structural
|
|
7
|
+
* typing lets a `{ name, tag }` or `{ versionId }` value reach a
|
|
8
|
+
* {@link PromptIdentifier} parameter, and quietly dropping the version would
|
|
9
|
+
* point the caller at the whole prompt instead of the version they named.
|
|
10
|
+
*
|
|
11
|
+
* @param prompt - the prompt, selected by `name` or by `promptId`
|
|
12
|
+
* @returns The identifier to interpolate into the request path.
|
|
13
|
+
* @throws An error if the selector is empty, or selects a version rather than a
|
|
14
|
+
* prompt.
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolvePromptIdentifier(prompt: PromptIdentifier): string;
|
|
17
|
+
//# sourceMappingURL=resolvePromptIdentifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolvePromptIdentifier.d.ts","sourceRoot":"","sources":["../../../src/utils/resolvePromptIdentifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAwBxE"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolvePromptIdentifier = resolvePromptIdentifier;
|
|
4
|
+
/**
|
|
5
|
+
* Resolve a prompt-level selector to the `{prompt_identifier}` path segment the
|
|
6
|
+
* Phoenix REST API expects.
|
|
7
|
+
*
|
|
8
|
+
* Version-level selectors are rejected rather than silently widened: structural
|
|
9
|
+
* typing lets a `{ name, tag }` or `{ versionId }` value reach a
|
|
10
|
+
* {@link PromptIdentifier} parameter, and quietly dropping the version would
|
|
11
|
+
* point the caller at the whole prompt instead of the version they named.
|
|
12
|
+
*
|
|
13
|
+
* @param prompt - the prompt, selected by `name` or by `promptId`
|
|
14
|
+
* @returns The identifier to interpolate into the request path.
|
|
15
|
+
* @throws An error if the selector is empty, or selects a version rather than a
|
|
16
|
+
* prompt.
|
|
17
|
+
*/
|
|
18
|
+
function resolvePromptIdentifier(prompt) {
|
|
19
|
+
if ("versionId" in prompt) {
|
|
20
|
+
throw new Error("A prompt version id selects a single version, not a prompt. Select the prompt by name or promptId.");
|
|
21
|
+
}
|
|
22
|
+
if ("tag" in prompt) {
|
|
23
|
+
throw new Error("A tag selects a single version, not a prompt. Select the prompt by name or promptId.");
|
|
24
|
+
}
|
|
25
|
+
if ("promptId" in prompt) {
|
|
26
|
+
if (!prompt.promptId) {
|
|
27
|
+
throw new Error("promptId must be a non-empty prompt id.");
|
|
28
|
+
}
|
|
29
|
+
return prompt.promptId;
|
|
30
|
+
}
|
|
31
|
+
if ("name" in prompt) {
|
|
32
|
+
if (!prompt.name) {
|
|
33
|
+
throw new Error("name must be a non-empty prompt name.");
|
|
34
|
+
}
|
|
35
|
+
return prompt.name;
|
|
36
|
+
}
|
|
37
|
+
throw new Error("A prompt must be selected by either name or promptId.");
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=resolvePromptIdentifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolvePromptIdentifier.js","sourceRoot":"","sources":["../../../src/utils/resolvePromptIdentifier.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;GAaG;AACH,iCAAwC,MAAwB;IAC9D,IAAI,WAAW,IAAI,MAAM,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,oGAAoG,CACrG,CAAC;IACJ,CAAC;IACD,IAAI,KAAK,IAAI,MAAM,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACb,sFAAsF,CACvF,CAAC;IACJ,CAAC;IACD,IAAI,UAAU,IAAI,MAAM,EAAE,CAAC;QACzB,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAC7D,CAAC;QACD,OAAO,MAAM,CAAC,QAAQ,CAAC;IACzB,CAAC;IACD,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC;QACrB,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;AAC3E,CAAC"}
|