@osdk/client 2.86.0 → 2.87.0-main-093d27c6330ed4fbed1349c33134906fcd5f47d2
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 +15 -0
- package/build/browser/Client.js +1 -1
- package/build/browser/Client.js.map +1 -1
- package/build/browser/agents/createAgentSession.js +3 -1
- package/build/browser/agents/createAgentSession.js.map +1 -1
- package/build/browser/agents/sendEventToAgentSession.js +58 -0
- package/build/browser/agents/sendEventToAgentSession.js.map +1 -0
- package/build/browser/public/experimental.js +1 -0
- package/build/browser/public/experimental.js.map +1 -1
- package/build/browser/public/internal.js +1 -0
- package/build/browser/public/internal.js.map +1 -1
- package/build/browser/public-utils/getClientBranch.js +23 -0
- package/build/browser/public-utils/getClientBranch.js.map +1 -0
- package/build/browser/util/UserAgent.js +2 -2
- package/build/browser/util/UserAgent.js.map +1 -1
- package/build/cjs/{applyStreamingQuery-2LSIOHH5.cjs → applyStreamingQuery-LE7U2277.cjs} +8 -8
- package/build/cjs/{applyStreamingQuery-2LSIOHH5.cjs.map → applyStreamingQuery-LE7U2277.cjs.map} +1 -1
- package/build/cjs/{chunk-FECRJMBV.cjs → chunk-3MYESV6A.cjs} +15 -15
- package/build/cjs/{chunk-FECRJMBV.cjs.map → chunk-3MYESV6A.cjs.map} +1 -1
- package/build/cjs/{chunk-ISNVL6H6.cjs → chunk-HE4E2RNU.cjs} +83 -83
- package/build/cjs/{chunk-ISNVL6H6.cjs.map → chunk-HE4E2RNU.cjs.map} +1 -1
- package/build/cjs/{chunk-V7IPOI6P.cjs → chunk-L7AGREGU.cjs} +121 -78
- package/build/cjs/chunk-L7AGREGU.cjs.map +1 -0
- package/build/cjs/{chunk-4CRQKKQ7.cjs → chunk-PEUMJXQ6.cjs} +2 -2
- package/build/cjs/{chunk-4CRQKKQ7.cjs.map → chunk-PEUMJXQ6.cjs.map} +1 -1
- package/build/cjs/{chunk-B6EDRQGB.cjs → chunk-TRPD3DUV.cjs} +5 -5
- package/build/cjs/{chunk-B6EDRQGB.cjs.map → chunk-TRPD3DUV.cjs.map} +1 -1
- package/build/cjs/{chunk-SPQMYDX4.cjs → chunk-WCS3H2IO.cjs} +8 -8
- package/build/cjs/{chunk-SPQMYDX4.cjs.map → chunk-WCS3H2IO.cjs.map} +1 -1
- package/build/cjs/index.cjs +12 -12
- package/build/cjs/public/experimental.cjs +15 -10
- package/build/cjs/public/experimental.cjs.map +1 -1
- package/build/cjs/public/experimental.d.cts +1 -1
- package/build/cjs/public/internal.cjs +15 -9
- package/build/cjs/public/internal.cjs.map +1 -1
- package/build/cjs/public/internal.d.cts +4 -1
- package/build/cjs/public/observable.cjs +6 -6
- package/build/cjs/public/unstable-do-not-use.cjs +17 -17
- package/build/esm/Client.js +1 -1
- package/build/esm/Client.js.map +1 -1
- package/build/esm/agents/createAgentSession.js +3 -1
- package/build/esm/agents/createAgentSession.js.map +1 -1
- package/build/esm/agents/sendEventToAgentSession.js +58 -0
- package/build/esm/agents/sendEventToAgentSession.js.map +1 -0
- package/build/esm/public/experimental.js +1 -0
- package/build/esm/public/experimental.js.map +1 -1
- package/build/esm/public/internal.js +1 -0
- package/build/esm/public/internal.js.map +1 -1
- package/build/esm/public-utils/getClientBranch.js +23 -0
- package/build/esm/public-utils/getClientBranch.js.map +1 -0
- package/build/esm/util/UserAgent.js +2 -2
- package/build/esm/util/UserAgent.js.map +1 -1
- package/build/types/Client.d.ts +1 -1
- package/build/types/agents/createAgentSession.d.ts.map +1 -1
- package/build/types/agents/sendEventToAgentSession.d.ts +4 -0
- package/build/types/agents/sendEventToAgentSession.d.ts.map +1 -0
- package/build/types/public/experimental.d.ts +2 -1
- package/build/types/public/experimental.d.ts.map +1 -1
- package/build/types/public/internal.d.ts +1 -0
- package/build/types/public/internal.d.ts.map +1 -1
- package/build/types/public-utils/getClientBranch.d.ts +3 -0
- package/build/types/public-utils/getClientBranch.d.ts.map +1 -0
- package/package.json +8 -8
- package/build/cjs/chunk-V7IPOI6P.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @osdk/client
|
|
2
2
|
|
|
3
|
+
## 2.87.0-main-093d27c6330ed4fbed1349c33134906fcd5f47d2
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 093d27c: Add experimental support for sending events to agent sessions.
|
|
8
|
+
- 9c93e57: Export getClientBranch from @osdk/client/internal. Inherit the OSDK client's global branch in WorkshopModule and support an explicit branchRid in BaseWorkshopModule, including navigation back to main.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies [093d27c]
|
|
13
|
+
- @osdk/api@2.87.0-main-093d27c6330ed4fbed1349c33134906fcd5f47d2
|
|
14
|
+
- @osdk/generator-converters@2.87.0-main-093d27c6330ed4fbed1349c33134906fcd5f47d2
|
|
15
|
+
- @osdk/shared.test@2.58.1-main-093d27c6330ed4fbed1349c33134906fcd5f47d2
|
|
16
|
+
- @osdk/client.unstable@2.87.0-main-093d27c6330ed4fbed1349c33134906fcd5f47d2
|
|
17
|
+
|
|
3
18
|
## 2.86.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
package/build/browser/Client.js
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
export const additionalContext = Symbol("additionalContext");
|
|
22
22
|
|
|
23
23
|
// BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.
|
|
24
|
-
const MaxOsdkVersion = "2.
|
|
24
|
+
const MaxOsdkVersion = "2.87.0";
|
|
25
25
|
// END: THIS IS GENERATED CODE. DO NOT EDIT.
|
|
26
26
|
|
|
27
27
|
const ErrorMessage = Symbol("ErrorMessage");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Client.js","names":["additionalContext","Symbol","MaxOsdkVersion","ErrorMessage"],"sources":["Client.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n ActionMetadata,\n CompileTimeMetadata,\n InterfaceDefinition,\n InterfaceMetadata,\n ObjectMetadata,\n ObjectSet,\n ObjectTypeDefinition,\n QueryDefinition,\n QueryMetadata,\n VersionBound,\n} from \"@osdk/api\";\nimport type {\n AgentDefinition,\n Experiment,\n ExperimentFns,\n MinimalObjectSet,\n} from \"@osdk/api/unstable\";\nimport type { SharedClient } from \"@osdk/shared.client2\";\n\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.js\";\nimport type { AgentSignatureFromDef } from \"./agents/types.js\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport type { QuerySignatureFromDef } from \"./queries/types.js\";\nimport type { SatisfiesSemver } from \"./SatisfiesSemver.js\";\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\ntype OldSharedClient = import(\"@osdk/shared.client\").SharedClient;\n\nexport type CheckVersionBound<Q> =\n Q extends VersionBound<infer V>\n ? SatisfiesSemver<V, MaxOsdkVersion> extends true\n ? Q\n : Q & {\n [ErrorMessage]: `Your SDK requires a semver compatible version with ${V}. You have ${MaxOsdkVersion}. Update your package.json`;\n }\n : Q;\n\nexport interface Client extends SharedClient, OldSharedClient {\n /**\n * Returns the operation surface for the given ontology definition. The shape of the\n * returned value is dispatched on what kind of definition is passed:\n * - object type → the object set type for that ontology object (typically a generated extension of {@link ObjectSet})\n * - interface → a {@link MinimalObjectSet} for the interface\n * - action → a callable with `applyAction` / `batchApplyAction`\n * - query → a callable with `executeFunction`\n * - experiment → the unstable feature surface for that experiment\n *\n * @param o - The object type definition to wrap.\n * @example\n * ```ts\n * const employees = await client(Employee).fetchPage({ $pageSize: 30 });\n * const employee = await client(Employee).fetchOne(12345);\n * ```\n * @returns an object set scoped to all objects of this type.\n */\n <Q extends ObjectTypeDefinition>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"]\n ? ObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n /**\n * @param o - The interface definition to wrap.\n * @example\n * ```ts\n * const page = await client(MyInterface).fetchPage({ $pageSize: 30 });\n * ```\n * @returns a minimal object set over all objects implementing the interface.\n */\n <Q extends InterfaceDefinition>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"]\n ? MinimalObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n /**\n * @param o - The action definition to invoke.\n * @example\n * ```ts\n * const result = await client(createEmployee).applyAction(\n * { name: \"Jane\", department: \"Engineering\" },\n * { $returnEdits: true },\n * );\n * ```\n * @returns a callable for applying (or batch-applying) the action.\n */\n <Q extends ActionDefinition<any>>(o: Q): ActionSignatureFromDef<Q>;\n\n /**\n * @param o - The query definition to invoke.\n * @example\n * ```ts\n * const result = await client(getEmployeeCount).executeFunction({ department: \"Engineering\" });\n * ```\n * @returns a callable for executing the query function.\n */\n <Q extends QueryDefinition<any>>(o: Q): QuerySignatureFromDef<Q>;\n\n /** @beta */\n <Q extends AgentDefinition<unknown>>(o: Q): AgentSignatureFromDef<Q>;\n\n /**\n * @param experiment - The experiment marker that gates an unstable feature.\n * @example\n * ```ts\n * const employee = await client(__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid)\n * .fetchOneByRid(Employee, \"ri.phonograph2-objects.main.object.1234\");\n * ```\n * @returns the experiment-specific function surface.\n */\n <\n Q extends\n | Experiment<\"2.0.8\">\n | Experiment<\"2.1.0\">\n | Experiment<\"2.59.0\">\n | Experiment<\"2.2.0\">\n | Experiment<\"2.8.0\">\n | Experiment<\"2.19.0\">,\n >(\n experiment: Q,\n ): ExperimentFns<Q>;\n\n /**\n * Fetches runtime metadata for the given ontology definition. The returned shape\n * is dispatched on the kind of definition passed: {@link ObjectMetadata},\n * {@link InterfaceMetadata}, {@link ActionMetadata}, or {@link QueryMetadata}.\n * @param o - The object type, interface, action, or query definition to look up.\n * @example\n * ```ts\n * const meta = await client.fetchMetadata(Employee);\n * console.log(meta.displayName, meta.description);\n * ```\n * @returns a promise resolving to the metadata for the given definition.\n */\n fetchMetadata<\n Q extends\n | ObjectTypeDefinition\n | InterfaceDefinition\n | ActionDefinition<any>\n | QueryDefinition<any>,\n >(\n o: Q,\n ): Promise<\n Q extends ObjectTypeDefinition\n ? ObjectMetadata\n : Q extends InterfaceDefinition\n ? InterfaceMetadata\n : Q extends ActionDefinition<any>\n ? ActionMetadata\n : Q extends QueryDefinition<any>\n ? QueryMetadata\n : never\n >;\n\n /** @internal */\n [additionalContext]: MinimalClient;\n}\n\n// DO NOT EXPORT FROM PACKAGE\n/** @internal */\nexport const additionalContext: unique symbol = Symbol(\"additionalContext\");\n\n// BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.\nconst MaxOsdkVersion = \"2.
|
|
1
|
+
{"version":3,"file":"Client.js","names":["additionalContext","Symbol","MaxOsdkVersion","ErrorMessage"],"sources":["Client.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n ActionMetadata,\n CompileTimeMetadata,\n InterfaceDefinition,\n InterfaceMetadata,\n ObjectMetadata,\n ObjectSet,\n ObjectTypeDefinition,\n QueryDefinition,\n QueryMetadata,\n VersionBound,\n} from \"@osdk/api\";\nimport type {\n AgentDefinition,\n Experiment,\n ExperimentFns,\n MinimalObjectSet,\n} from \"@osdk/api/unstable\";\nimport type { SharedClient } from \"@osdk/shared.client2\";\n\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.js\";\nimport type { AgentSignatureFromDef } from \"./agents/types.js\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport type { QuerySignatureFromDef } from \"./queries/types.js\";\nimport type { SatisfiesSemver } from \"./SatisfiesSemver.js\";\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\ntype OldSharedClient = import(\"@osdk/shared.client\").SharedClient;\n\nexport type CheckVersionBound<Q> =\n Q extends VersionBound<infer V>\n ? SatisfiesSemver<V, MaxOsdkVersion> extends true\n ? Q\n : Q & {\n [ErrorMessage]: `Your SDK requires a semver compatible version with ${V}. You have ${MaxOsdkVersion}. Update your package.json`;\n }\n : Q;\n\nexport interface Client extends SharedClient, OldSharedClient {\n /**\n * Returns the operation surface for the given ontology definition. The shape of the\n * returned value is dispatched on what kind of definition is passed:\n * - object type → the object set type for that ontology object (typically a generated extension of {@link ObjectSet})\n * - interface → a {@link MinimalObjectSet} for the interface\n * - action → a callable with `applyAction` / `batchApplyAction`\n * - query → a callable with `executeFunction`\n * - experiment → the unstable feature surface for that experiment\n *\n * @param o - The object type definition to wrap.\n * @example\n * ```ts\n * const employees = await client(Employee).fetchPage({ $pageSize: 30 });\n * const employee = await client(Employee).fetchOne(12345);\n * ```\n * @returns an object set scoped to all objects of this type.\n */\n <Q extends ObjectTypeDefinition>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"]\n ? ObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n /**\n * @param o - The interface definition to wrap.\n * @example\n * ```ts\n * const page = await client(MyInterface).fetchPage({ $pageSize: 30 });\n * ```\n * @returns a minimal object set over all objects implementing the interface.\n */\n <Q extends InterfaceDefinition>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"]\n ? MinimalObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n /**\n * @param o - The action definition to invoke.\n * @example\n * ```ts\n * const result = await client(createEmployee).applyAction(\n * { name: \"Jane\", department: \"Engineering\" },\n * { $returnEdits: true },\n * );\n * ```\n * @returns a callable for applying (or batch-applying) the action.\n */\n <Q extends ActionDefinition<any>>(o: Q): ActionSignatureFromDef<Q>;\n\n /**\n * @param o - The query definition to invoke.\n * @example\n * ```ts\n * const result = await client(getEmployeeCount).executeFunction({ department: \"Engineering\" });\n * ```\n * @returns a callable for executing the query function.\n */\n <Q extends QueryDefinition<any>>(o: Q): QuerySignatureFromDef<Q>;\n\n /** @beta */\n <Q extends AgentDefinition<unknown>>(o: Q): AgentSignatureFromDef<Q>;\n\n /**\n * @param experiment - The experiment marker that gates an unstable feature.\n * @example\n * ```ts\n * const employee = await client(__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid)\n * .fetchOneByRid(Employee, \"ri.phonograph2-objects.main.object.1234\");\n * ```\n * @returns the experiment-specific function surface.\n */\n <\n Q extends\n | Experiment<\"2.0.8\">\n | Experiment<\"2.1.0\">\n | Experiment<\"2.59.0\">\n | Experiment<\"2.2.0\">\n | Experiment<\"2.8.0\">\n | Experiment<\"2.19.0\">,\n >(\n experiment: Q,\n ): ExperimentFns<Q>;\n\n /**\n * Fetches runtime metadata for the given ontology definition. The returned shape\n * is dispatched on the kind of definition passed: {@link ObjectMetadata},\n * {@link InterfaceMetadata}, {@link ActionMetadata}, or {@link QueryMetadata}.\n * @param o - The object type, interface, action, or query definition to look up.\n * @example\n * ```ts\n * const meta = await client.fetchMetadata(Employee);\n * console.log(meta.displayName, meta.description);\n * ```\n * @returns a promise resolving to the metadata for the given definition.\n */\n fetchMetadata<\n Q extends\n | ObjectTypeDefinition\n | InterfaceDefinition\n | ActionDefinition<any>\n | QueryDefinition<any>,\n >(\n o: Q,\n ): Promise<\n Q extends ObjectTypeDefinition\n ? ObjectMetadata\n : Q extends InterfaceDefinition\n ? InterfaceMetadata\n : Q extends ActionDefinition<any>\n ? ActionMetadata\n : Q extends QueryDefinition<any>\n ? QueryMetadata\n : never\n >;\n\n /** @internal */\n [additionalContext]: MinimalClient;\n}\n\n// DO NOT EXPORT FROM PACKAGE\n/** @internal */\nexport const additionalContext: unique symbol = Symbol(\"additionalContext\");\n\n// BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.\nconst MaxOsdkVersion = \"2.87.0\";\n// END: THIS IS GENERATED CODE. DO NOT EDIT.\nexport type MaxOsdkVersion = typeof MaxOsdkVersion;\nconst ErrorMessage: unique symbol = Symbol(\"ErrorMessage\");\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA6BA;;AAqIA;AACA;AACA,OAAO,MAAMA,iBAAgC,GAAGC,MAAM,CAAC,mBAAmB,CAAC;;AAE3E;AACA,MAAMC,cAAc,GAAG,QAAQ;AAC/B;;AAEA,MAAMC,YAA2B,GAAGF,MAAM,CAAC,cAAc,CAAC","ignoreList":[]}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
import * as Sessions from "@osdk/foundry.agents/AgentSession";
|
|
18
18
|
import { addUserAgentHeader } from "../util/addUserAgentHeader.js";
|
|
19
19
|
import { toDataValueAgents } from "../util/toDataValueAgents.js";
|
|
20
|
+
import { sendEventToAgentSession } from "./sendEventToAgentSession.js";
|
|
20
21
|
export async function createAgentSession(client, agent, args) {
|
|
21
22
|
if (client.scenarioRid != null) {
|
|
22
23
|
throw new Error("Agent sessions are not supported in scenarios");
|
|
@@ -46,7 +47,8 @@ export async function createAgentSession(client, agent, args) {
|
|
|
46
47
|
preview: true
|
|
47
48
|
});
|
|
48
49
|
return {
|
|
49
|
-
id: response.id
|
|
50
|
+
id: response.id,
|
|
51
|
+
experimental_sendEvent: (event, options) => sendEventToAgentSession(clientWithHeaders, response.id, agentDefinition.eventDefinitions, event, options)
|
|
50
52
|
};
|
|
51
53
|
}
|
|
52
54
|
//# sourceMappingURL=createAgentSession.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAgentSession.js","names":["Sessions","addUserAgentHeader","toDataValueAgents","createAgentSession","client","agent","args","scenarioRid","Error","transactionId","branch","clientWithHeaders","ontologyRid","agentDefinition","ontologyProvider","getAgentDefinition","apiName","version","convertedArguments","type","fields","argumentDefinitions","response","create","ontology","agentApiName","agentVersion","arguments","preview","id"],"sources":["createAgentSession.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { AgentDefinition, AgentSession } from \"@osdk/api/unstable\";\nimport * as Sessions from \"@osdk/foundry.agents/AgentSession\";\n\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { addUserAgentHeader } from \"../util/addUserAgentHeader.js\";\nimport { toDataValueAgents } from \"../util/toDataValueAgents.js\";\nimport type { AgentSignatureFromDef } from \"./types.js\";\n\nexport async function createAgentSession<D extends AgentDefinition<unknown>>(\n client: MinimalClient,\n agent: D,\n args?: Parameters<AgentSignatureFromDef<D>[\"experimental_createSession\"]>[0],\n): Promise<AgentSession> {\n if (client.scenarioRid != null) {\n throw new Error(\"Agent sessions are not supported in scenarios\");\n }\n if (client.transactionId != null) {\n throw new Error(\"Agent sessions are not supported in transactions\");\n }\n if (client.branch != null) {\n throw new Error(\"Agent sessions are not supported on branches\");\n }\n const clientWithHeaders = addUserAgentHeader(client, agent);\n const ontologyRid = await client.ontologyRid;\n const agentDefinition = await client.ontologyProvider.getAgentDefinition(\n agent.apiName,\n agent.version,\n );\n const convertedArguments = await toDataValueAgents(args ?? {}, client, {\n type: \"struct\",\n fields: agentDefinition.argumentDefinitions,\n });\n const response = await Sessions.create(\n clientWithHeaders,\n {\n agent: {\n type: \"agentApiName\",\n ontology: ontologyRid,\n agentApiName: agent.apiName,\n },\n agentVersion: agent.version,\n arguments: convertedArguments,\n },\n { preview: true },\n );\n return { id: response.id
|
|
1
|
+
{"version":3,"file":"createAgentSession.js","names":["Sessions","addUserAgentHeader","toDataValueAgents","sendEventToAgentSession","createAgentSession","client","agent","args","scenarioRid","Error","transactionId","branch","clientWithHeaders","ontologyRid","agentDefinition","ontologyProvider","getAgentDefinition","apiName","version","convertedArguments","type","fields","argumentDefinitions","response","create","ontology","agentApiName","agentVersion","arguments","preview","id","experimental_sendEvent","event","options","eventDefinitions"],"sources":["createAgentSession.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { AgentDefinition, AgentSession } from \"@osdk/api/unstable\";\nimport * as Sessions from \"@osdk/foundry.agents/AgentSession\";\n\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { addUserAgentHeader } from \"../util/addUserAgentHeader.js\";\nimport { toDataValueAgents } from \"../util/toDataValueAgents.js\";\nimport { sendEventToAgentSession } from \"./sendEventToAgentSession.js\";\nimport type { AgentSignatureFromDef } from \"./types.js\";\n\nexport async function createAgentSession<D extends AgentDefinition<unknown>>(\n client: MinimalClient,\n agent: D,\n args?: Parameters<AgentSignatureFromDef<D>[\"experimental_createSession\"]>[0],\n): Promise<AgentSession> {\n if (client.scenarioRid != null) {\n throw new Error(\"Agent sessions are not supported in scenarios\");\n }\n if (client.transactionId != null) {\n throw new Error(\"Agent sessions are not supported in transactions\");\n }\n if (client.branch != null) {\n throw new Error(\"Agent sessions are not supported on branches\");\n }\n const clientWithHeaders = addUserAgentHeader(client, agent);\n const ontologyRid = await client.ontologyRid;\n const agentDefinition = await client.ontologyProvider.getAgentDefinition(\n agent.apiName,\n agent.version,\n );\n const convertedArguments = await toDataValueAgents(args ?? {}, client, {\n type: \"struct\",\n fields: agentDefinition.argumentDefinitions,\n });\n const response = await Sessions.create(\n clientWithHeaders,\n {\n agent: {\n type: \"agentApiName\",\n ontology: ontologyRid,\n agentApiName: agent.apiName,\n },\n agentVersion: agent.version,\n arguments: convertedArguments,\n },\n { preview: true },\n );\n return {\n id: response.id,\n experimental_sendEvent: (event, options) =>\n sendEventToAgentSession(\n clientWithHeaders,\n response.id,\n agentDefinition.eventDefinitions,\n event,\n options,\n ),\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAO,KAAKA,QAAQ,MAAM,mCAAmC;AAG7D,SAASC,kBAAkB,QAAQ,+BAA+B;AAClE,SAASC,iBAAiB,QAAQ,8BAA8B;AAChE,SAASC,uBAAuB,QAAQ,8BAA8B;AAGtE,OAAO,eAAeC,kBAAkBA,CACtCC,MAAqB,EACrBC,KAAQ,EACRC,IAA4E,EACrD;EACvB,IAAIF,MAAM,CAACG,WAAW,IAAI,IAAI,EAAE;IAC9B,MAAM,IAAIC,KAAK,CAAC,+CAA+C,CAAC;EAClE;EACA,IAAIJ,MAAM,CAACK,aAAa,IAAI,IAAI,EAAE;IAChC,MAAM,IAAID,KAAK,CAAC,kDAAkD,CAAC;EACrE;EACA,IAAIJ,MAAM,CAACM,MAAM,IAAI,IAAI,EAAE;IACzB,MAAM,IAAIF,KAAK,CAAC,8CAA8C,CAAC;EACjE;EACA,MAAMG,iBAAiB,GAAGX,kBAAkB,CAACI,MAAM,EAAEC,KAAK,CAAC;EAC3D,MAAMO,WAAW,GAAG,MAAMR,MAAM,CAACQ,WAAW;EAC5C,MAAMC,eAAe,GAAG,MAAMT,MAAM,CAACU,gBAAgB,CAACC,kBAAkB,CACtEV,KAAK,CAACW,OAAO,EACbX,KAAK,CAACY,OACR,CAAC;EACD,MAAMC,kBAAkB,GAAG,MAAMjB,iBAAiB,CAACK,IAAI,IAAI,CAAC,CAAC,EAAEF,MAAM,EAAE;IACrEe,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAEP,eAAe,CAACQ;EAC1B,CAAC,CAAC;EACF,MAAMC,QAAQ,GAAG,MAAMvB,QAAQ,CAACwB,MAAM,CACpCZ,iBAAiB,EACjB;IACEN,KAAK,EAAE;MACLc,IAAI,EAAE,cAAc;MACpBK,QAAQ,EAAEZ,WAAW;MACrBa,YAAY,EAAEpB,KAAK,CAACW;IACtB,CAAC;IACDU,YAAY,EAAErB,KAAK,CAACY,OAAO;IAC3BU,SAAS,EAAET;EACb,CAAC,EACD;IAAEU,OAAO,EAAE;EAAK,CAClB,CAAC;EACD,OAAO;IACLC,EAAE,EAAEP,QAAQ,CAACO,EAAE;IACfC,sBAAsB,EAAEA,CAACC,KAAK,EAAEC,OAAO,KACrC9B,uBAAuB,CACrBS,iBAAiB,EACjBW,QAAQ,CAACO,EAAE,EACXhB,eAAe,CAACoB,gBAAgB,EAChCF,KAAK,EACLC,OACF;EACJ,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { AgentSendEventTimeoutError } from "@osdk/api/unstable";
|
|
18
|
+
import * as Sessions from "@osdk/foundry.agents/AgentSession";
|
|
19
|
+
import { toDataValueAgents } from "../util/toDataValueAgents.js";
|
|
20
|
+
export async function sendEventToAgentSession(client, sessionId, eventDefinitions, event, options) {
|
|
21
|
+
const keys = Object.keys(event);
|
|
22
|
+
if (keys.length !== 1) {
|
|
23
|
+
throw new Error("experimental_sendEvent requires exactly one event");
|
|
24
|
+
}
|
|
25
|
+
const eventType = keys[0];
|
|
26
|
+
const timeoutMs = options?.$timeoutMs ?? 30_000;
|
|
27
|
+
if (!Number.isFinite(timeoutMs) || timeoutMs < 0) {
|
|
28
|
+
throw new Error("$timeoutMs must be a finite non-negative number");
|
|
29
|
+
}
|
|
30
|
+
const deadline = Date.now() + timeoutMs;
|
|
31
|
+
const pollIntervalMs = options?.$pollIntervalMs ?? 1000;
|
|
32
|
+
if (!Number.isFinite(pollIntervalMs) || pollIntervalMs <= 0) {
|
|
33
|
+
throw new Error("$pollIntervalMs must be a finite positive number");
|
|
34
|
+
}
|
|
35
|
+
const id = globalThis.crypto.randomUUID();
|
|
36
|
+
const payloadType = eventDefinitions.find(definition => definition.eventType === eventType)?.payloadType;
|
|
37
|
+
const payload = payloadType ? await toDataValueAgents(event[eventType], client, payloadType) : event[eventType];
|
|
38
|
+
for (;;) {
|
|
39
|
+
const response = await Sessions.sendEvent(client, sessionId, {
|
|
40
|
+
event: {
|
|
41
|
+
id,
|
|
42
|
+
eventType,
|
|
43
|
+
payload
|
|
44
|
+
}
|
|
45
|
+
}, {
|
|
46
|
+
preview: true
|
|
47
|
+
});
|
|
48
|
+
if (response.result.type === "accepted") {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const remainingMs = deadline - Date.now();
|
|
52
|
+
if (remainingMs <= 0) {
|
|
53
|
+
throw new AgentSendEventTimeoutError();
|
|
54
|
+
}
|
|
55
|
+
await new Promise(resolve => setTimeout(resolve, pollIntervalMs));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=sendEventToAgentSession.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendEventToAgentSession.js","names":["AgentSendEventTimeoutError","Sessions","toDataValueAgents","sendEventToAgentSession","client","sessionId","eventDefinitions","event","options","keys","Object","length","Error","eventType","timeoutMs","$timeoutMs","Number","isFinite","deadline","Date","now","pollIntervalMs","$pollIntervalMs","id","globalThis","crypto","randomUUID","payloadType","find","definition","payload","response","sendEvent","preview","result","type","remainingMs","Promise","resolve","setTimeout"],"sources":["sendEventToAgentSession.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n type AgentSendEventOptions,\n AgentSendEventTimeoutError,\n} from \"@osdk/api/unstable\";\nimport type { AgentDefinitionVersion } from \"@osdk/foundry.agents\";\nimport * as Sessions from \"@osdk/foundry.agents/AgentSession\";\n\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { toDataValueAgents } from \"../util/toDataValueAgents.js\";\n\ndeclare const process: {\n env: { TARGET: \"browser\" | \"node\" | undefined };\n};\n\nexport async function sendEventToAgentSession(\n client: MinimalClient,\n sessionId: string,\n eventDefinitions: AgentDefinitionVersion[\"eventDefinitions\"],\n event: Record<string, unknown>,\n options?: AgentSendEventOptions,\n): Promise<void> {\n const keys = Object.keys(event);\n if (keys.length !== 1) {\n throw new Error(\"experimental_sendEvent requires exactly one event\");\n }\n const eventType = keys[0];\n\n const timeoutMs = options?.$timeoutMs ?? 30_000;\n if (!Number.isFinite(timeoutMs) || timeoutMs < 0) {\n throw new Error(\"$timeoutMs must be a finite non-negative number\");\n }\n const deadline = Date.now() + timeoutMs;\n\n const pollIntervalMs = options?.$pollIntervalMs ?? 1000;\n if (!Number.isFinite(pollIntervalMs) || pollIntervalMs <= 0) {\n throw new Error(\"$pollIntervalMs must be a finite positive number\");\n }\n\n const id =\n process.env.TARGET === \"browser\"\n ? globalThis.crypto.randomUUID()\n : (await import(\"node:crypto\")).randomUUID();\n\n const payloadType = eventDefinitions.find(\n (definition) => definition.eventType === eventType,\n )?.payloadType;\n const payload = payloadType\n ? await toDataValueAgents(event[eventType], client, payloadType)\n : event[eventType];\n\n for (;;) {\n const response = await Sessions.sendEvent(\n client,\n sessionId,\n { event: { id, eventType, payload } },\n { preview: true },\n );\n\n if (response.result.type === \"accepted\") {\n return;\n }\n\n const remainingMs = deadline - Date.now();\n if (remainingMs <= 0) {\n throw new AgentSendEventTimeoutError();\n }\n\n await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAEEA,0BAA0B,QACrB,oBAAoB;AAE3B,OAAO,KAAKC,QAAQ,MAAM,mCAAmC;AAG7D,SAASC,iBAAiB,QAAQ,8BAA8B;AAMhE,OAAO,eAAeC,uBAAuBA,CAC3CC,MAAqB,EACrBC,SAAiB,EACjBC,gBAA4D,EAC5DC,KAA8B,EAC9BC,OAA+B,EAChB;EACf,MAAMC,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACF,KAAK,CAAC;EAC/B,IAAIE,IAAI,CAACE,MAAM,KAAK,CAAC,EAAE;IACrB,MAAM,IAAIC,KAAK,CAAC,mDAAmD,CAAC;EACtE;EACA,MAAMC,SAAS,GAAGJ,IAAI,CAAC,CAAC,CAAC;EAEzB,MAAMK,SAAS,GAAGN,OAAO,EAAEO,UAAU,IAAI,MAAM;EAC/C,IAAI,CAACC,MAAM,CAACC,QAAQ,CAACH,SAAS,CAAC,IAAIA,SAAS,GAAG,CAAC,EAAE;IAChD,MAAM,IAAIF,KAAK,CAAC,iDAAiD,CAAC;EACpE;EACA,MAAMM,QAAQ,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC,GAAGN,SAAS;EAEvC,MAAMO,cAAc,GAAGb,OAAO,EAAEc,eAAe,IAAI,IAAI;EACvD,IAAI,CAACN,MAAM,CAACC,QAAQ,CAACI,cAAc,CAAC,IAAIA,cAAc,IAAI,CAAC,EAAE;IAC3D,MAAM,IAAIT,KAAK,CAAC,kDAAkD,CAAC;EACrE;EAEA,MAAMW,EAAE,GAEFC,UAAU,CAACC,MAAM,CAACC,UAAU,CAAC,CACa;EAEhD,MAAMC,WAAW,GAAGrB,gBAAgB,CAACsB,IAAI,CACtCC,UAAU,IAAKA,UAAU,CAAChB,SAAS,KAAKA,SAC3C,CAAC,EAAEc,WAAW;EACd,MAAMG,OAAO,GAAGH,WAAW,GACvB,MAAMzB,iBAAiB,CAACK,KAAK,CAACM,SAAS,CAAC,EAAET,MAAM,EAAEuB,WAAW,CAAC,GAC9DpB,KAAK,CAACM,SAAS,CAAC;EAEpB,SAAS;IACP,MAAMkB,QAAQ,GAAG,MAAM9B,QAAQ,CAAC+B,SAAS,CACvC5B,MAAM,EACNC,SAAS,EACT;MAAEE,KAAK,EAAE;QAAEgB,EAAE;QAAEV,SAAS;QAAEiB;MAAQ;IAAE,CAAC,EACrC;MAAEG,OAAO,EAAE;IAAK,CAClB,CAAC;IAED,IAAIF,QAAQ,CAACG,MAAM,CAACC,IAAI,KAAK,UAAU,EAAE;MACvC;IACF;IAEA,MAAMC,WAAW,GAAGlB,QAAQ,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC;IACzC,IAAIgB,WAAW,IAAI,CAAC,EAAE;MACpB,MAAM,IAAIpC,0BAA0B,CAAC,CAAC;IACxC;IAEA,MAAM,IAAIqC,OAAO,CAAEC,OAAO,IAAKC,UAAU,CAACD,OAAO,EAAEjB,cAAc,CAAC,CAAC;EACrE;AACF","ignoreList":[]}
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
export { AgentSendEventTimeoutError } from "@osdk/api/unstable";
|
|
17
18
|
export { createClientWithTransaction } from "../createClient.js";
|
|
18
19
|
export { createClientFromWriteableClient } from "../createClientFromWriteableClient.js";
|
|
19
20
|
export { createScenario } from "../scenarios/createScenario.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experimental.js","names":["createClientWithTransaction","createClientFromWriteableClient","createScenario","withScenario"],"sources":["experimental.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type {
|
|
1
|
+
{"version":3,"file":"experimental.js","names":["AgentSendEventTimeoutError","createClientWithTransaction","createClientFromWriteableClient","createScenario","withScenario"],"sources":["experimental.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type {\n AgentDefinition,\n AgentSendEventOptions,\n AgentSession,\n} from \"@osdk/api/unstable\";\n\nexport { AgentSendEventTimeoutError } from \"@osdk/api/unstable\";\n\nexport { createClientWithTransaction } from \"../createClient.js\";\nexport { createClientFromWriteableClient } from \"../createClientFromWriteableClient.js\";\n\nexport { createScenario } from \"../scenarios/createScenario.js\";\nexport type { EXPERIMENTAL_ScenarioClient } from \"../scenarios/ScenarioClient.js\";\nexport { withScenario } from \"../scenarios/withScenario.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SAASA,0BAA0B,QAAQ,oBAAoB;AAE/D,SAASC,2BAA2B,QAAQ,oBAAoB;AAChE,SAASC,+BAA+B,QAAQ,uCAAuC;AAEvF,SAASC,cAAc,QAAQ,gCAAgC;AAE/D,SAASC,YAAY,QAAQ,8BAA8B","ignoreList":[]}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
export { createMediaFromReference } from "../createMediaFromReference.js";
|
|
18
18
|
export { createAndFetchTempObjectSetRid } from "../public-utils/createAndFetchTempObjectSetRid.js";
|
|
19
|
+
export { getClientBranch } from "../public-utils/getClientBranch.js";
|
|
19
20
|
export { hydrateAttachmentFromRid } from "../public-utils/hydrateAttachmentFromRid.js";
|
|
20
21
|
export { hydrateObjectSetFromObjectRids } from "../public-utils/hydrateObjectSetFromObjectRids.js";
|
|
21
22
|
export { hydrateObjectSetFromRid } from "../public-utils/hydrateObjectSetFromRid.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","names":["createMediaFromReference","createAndFetchTempObjectSetRid","hydrateAttachmentFromRid","hydrateObjectSetFromObjectRids","hydrateObjectSetFromRid","BrowserLogger","MinimalLogger"],"sources":["internal.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { createMediaFromReference } from \"../createMediaFromReference.js\";\nexport { createAndFetchTempObjectSetRid } from \"../public-utils/createAndFetchTempObjectSetRid.js\";\nexport { hydrateAttachmentFromRid } from \"../public-utils/hydrateAttachmentFromRid.js\";\nexport { hydrateObjectSetFromObjectRids } from \"../public-utils/hydrateObjectSetFromObjectRids.js\";\nexport { hydrateObjectSetFromRid } from \"../public-utils/hydrateObjectSetFromRid.js\";\n\nexport { BrowserLogger } from \"../logger/BrowserLogger.js\";\nexport { MinimalLogger } from \"../logger/MinimalLogger.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,wBAAwB,QAAQ,gCAAgC;AACzE,SAASC,8BAA8B,QAAQ,mDAAmD;AAClG,SAASC,wBAAwB,QAAQ,6CAA6C;AACtF,SAASC,8BAA8B,QAAQ,mDAAmD;AAClG,SAASC,uBAAuB,QAAQ,4CAA4C;AAEpF,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,aAAa,QAAQ,4BAA4B","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"internal.js","names":["createMediaFromReference","createAndFetchTempObjectSetRid","getClientBranch","hydrateAttachmentFromRid","hydrateObjectSetFromObjectRids","hydrateObjectSetFromRid","BrowserLogger","MinimalLogger"],"sources":["internal.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { createMediaFromReference } from \"../createMediaFromReference.js\";\nexport { createAndFetchTempObjectSetRid } from \"../public-utils/createAndFetchTempObjectSetRid.js\";\nexport { getClientBranch } from \"../public-utils/getClientBranch.js\";\nexport { hydrateAttachmentFromRid } from \"../public-utils/hydrateAttachmentFromRid.js\";\nexport { hydrateObjectSetFromObjectRids } from \"../public-utils/hydrateObjectSetFromObjectRids.js\";\nexport { hydrateObjectSetFromRid } from \"../public-utils/hydrateObjectSetFromRid.js\";\n\nexport { BrowserLogger } from \"../logger/BrowserLogger.js\";\nexport { MinimalLogger } from \"../logger/MinimalLogger.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,wBAAwB,QAAQ,gCAAgC;AACzE,SAASC,8BAA8B,QAAQ,mDAAmD;AAClG,SAASC,eAAe,QAAQ,oCAAoC;AACpE,SAASC,wBAAwB,QAAQ,6CAA6C;AACtF,SAASC,8BAA8B,QAAQ,mDAAmD;AAClG,SAASC,uBAAuB,QAAQ,4CAA4C;AAEpF,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,aAAa,QAAQ,4BAA4B","ignoreList":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { additionalContext } from "../Client.js";
|
|
18
|
+
|
|
19
|
+
/** Returns the global branch resolved when the client was created, or undefined for main. */
|
|
20
|
+
export function getClientBranch(client) {
|
|
21
|
+
return client[additionalContext].branch;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=getClientBranch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getClientBranch.js","names":["additionalContext","getClientBranch","client","branch"],"sources":["getClientBranch.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { additionalContext, type Client } from \"../Client.js\";\n\n/** Returns the global branch resolved when the client was created, or undefined for main. */\nexport function getClientBranch(client: Client): string | undefined {\n return client[additionalContext].branch;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,iBAAiB,QAAqB,cAAc;;AAE7D;AACA,OAAO,SAASC,eAAeA,CAACC,MAAc,EAAsB;EAClE,OAAOA,MAAM,CAACF,iBAAiB,CAAC,CAACG,MAAM;AACzC","ignoreList":[]}
|
|
@@ -14,6 +14,6 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
export const USER_AGENT = `osdk-client/${"2.
|
|
18
|
-
export const OBSERVABLE_USER_AGENT = `osdk-observable-client/${"2.
|
|
17
|
+
export const USER_AGENT = `osdk-client/${"2.87.0-main-093d27c6330ed4fbed1349c33134906fcd5f47d2"}`;
|
|
18
|
+
export const OBSERVABLE_USER_AGENT = `osdk-observable-client/${"2.87.0-main-093d27c6330ed4fbed1349c33134906fcd5f47d2"}`;
|
|
19
19
|
//# sourceMappingURL=UserAgent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserAgent.js","names":["USER_AGENT","OBSERVABLE_USER_AGENT"],"sources":["UserAgent.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const USER_AGENT: string = `osdk-client/${process.env.PACKAGE_VERSION}`;\nexport const OBSERVABLE_USER_AGENT: string = `osdk-observable-client/${process.env.PACKAGE_VERSION}`;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,UAAkB,GAAG,
|
|
1
|
+
{"version":3,"file":"UserAgent.js","names":["USER_AGENT","OBSERVABLE_USER_AGENT"],"sources":["UserAgent.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const USER_AGENT: string = `osdk-client/${process.env.PACKAGE_VERSION}`;\nexport const OBSERVABLE_USER_AGENT: string = `osdk-observable-client/${process.env.PACKAGE_VERSION}`;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,UAAkB,GAAG,uEAA4C;AAC9E,OAAO,MAAMC,qBAA6B,GAAG,kFAAuD","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunk3MYESV6A_cjs = require('./chunk-3MYESV6A.cjs');
|
|
4
|
+
var chunkPEUMJXQ6_cjs = require('./chunk-PEUMJXQ6.cjs');
|
|
5
5
|
var chunkNJFXSQ4X_cjs = require('./chunk-NJFXSQ4X.cjs');
|
|
6
6
|
require('./chunk-Q7SFCCGT.cjs');
|
|
7
7
|
|
|
@@ -17,19 +17,19 @@ async function* applyStreamingQuery(client, query, params) {
|
|
|
17
17
|
if (client.flushEdits != null) {
|
|
18
18
|
await client.flushEdits();
|
|
19
19
|
}
|
|
20
|
-
const response = await streamingExecute(
|
|
20
|
+
const response = await streamingExecute(chunkPEUMJXQ6_cjs.addUserAgentHeader(client, query), query.apiName, {
|
|
21
21
|
ontology: await client.ontologyRid,
|
|
22
|
-
parameters: params ? await
|
|
22
|
+
parameters: params ? await chunk3MYESV6A_cjs.remapQueryParams(params, client, qd.parameters) : {},
|
|
23
23
|
version: query.isFixedVersion ? query.version : void 0,
|
|
24
24
|
branch: client.branch
|
|
25
25
|
}, {
|
|
26
26
|
transactionId: client.transactionId,
|
|
27
27
|
preview: true
|
|
28
28
|
});
|
|
29
|
-
const definitions = await
|
|
29
|
+
const definitions = await chunk3MYESV6A_cjs.getRequiredDefinitions(qd.output, client);
|
|
30
30
|
for await (const event of response) {
|
|
31
31
|
if (event.type !== "data") continue;
|
|
32
|
-
const remapped = await
|
|
32
|
+
const remapped = await chunk3MYESV6A_cjs.remapQueryResponse(client, qd.output, event.value, definitions);
|
|
33
33
|
if (qd.output.type === "array" && Array.isArray(remapped)) {
|
|
34
34
|
for (const item of remapped) {
|
|
35
35
|
yield item;
|
|
@@ -41,5 +41,5 @@ async function* applyStreamingQuery(client, query, params) {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
exports.applyStreamingQuery = applyStreamingQuery;
|
|
44
|
-
//# sourceMappingURL=applyStreamingQuery-
|
|
45
|
-
//# sourceMappingURL=applyStreamingQuery-
|
|
44
|
+
//# sourceMappingURL=applyStreamingQuery-LE7U2277.cjs.map
|
|
45
|
+
//# sourceMappingURL=applyStreamingQuery-LE7U2277.cjs.map
|
package/build/cjs/{applyStreamingQuery-2LSIOHH5.cjs.map → applyStreamingQuery-LE7U2277.cjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../node_modules/.pnpm/@osdk+foundry.functions@2.83.0/node_modules/@osdk/foundry.functions/build/esm/v2/public/Query.js","../../src/queries/applyStreamingQuery.ts"],"names":["foundryPlatformFetch","addUserAgentHeader","remapQueryParams","getRequiredDefinitions","remapQueryResponse"],"mappings":";;;;;;;;AAgFA,IAAM,oBAAoB,CAAC,CAAA,EAAG,4CAAA,EAA8C,CAAA,IAAI,mBAAmB,CAAA;AA2B5F,SAAS,gBAAA,CAAiB,SAAS,IAAA,EAAM;AAC9C,EAAA,OAAOA,sCAAA,CAAsB,IAAA,EAAM,iBAAA,EAAmB,GAAG,IAAI,CAAA;AAC/D;;;AC1FA,gBAAuB,mBAAA,CAAoB,MAAA,EAAQ,KAAA,EAAO,MAAA,EAAQ;AAChE,EAAA,MAAM,EAAA,GAAK,MAAM,MAAA,CAAO,gBAAA,CAAiB,kBAAA,CAAmB,KAAA,CAAM,OAAA,EAAS,KAAA,CAAM,cAAA,GAAiB,KAAA,CAAM,OAAA,GAAU,MAAS,CAAA;AAC3H,EAAA,IAAI,MAAA,CAAO,cAAc,IAAA,EAAM;AAC7B,IAAA,MAAM,OAAO,UAAA,EAAW;AAAA,EAC1B;AACA,EAAA,MAAM,QAAA,GAAW,MAAgB,gBAAA,CAAiBC,oCAAA,CAAmB,QAAQ,KAAK,CAAA,EAAG,MAAM,OAAA,EAAS;AAAA,IAClG,QAAA,EAAU,MAAM,MAAA,CAAO,WAAA;AAAA,IACvB,UAAA,EAAY,SAAS,MAAMC,kCAAA,CAAiB,QAAQ,MAAA,EAAQ,EAAA,CAAG,UAAU,CAAA,GAAI,EAAC;AAAA,IAC9E,OAAA,EAAS,KAAA,CAAM,cAAA,GAAiB,KAAA,CAAM,OAAA,GAAU,MAAA;AAAA,IAChD,QAAQ,MAAA,CAAO;AAAA,GACjB,EAAG;AAAA,IACD,eAAe,MAAA,CAAO,aAAA;AAAA,IACtB,OAAA,EAAS;AAAA,GACV,CAAA;AACD,EAAA,MAAM,WAAA,GAAc,MAAMC,wCAAA,CAAuB,EAAA,CAAG,QAAQ,MAAM,CAAA;AAClE,EAAA,WAAA,MAAiB,SAAS,QAAA,EAAU;AAClC,IAAA,IAAI,KAAA,CAAM,SAAS,MAAA,EAAQ;AAC3B,IAAA,MAAM,QAAA,GAAW,MAAMC,oCAAA,CAAmB,MAAA,EAAQ,GAAG,MAAA,EAAQ,KAAA,CAAM,OAAO,WAAW,CAAA;AACrF,IAAA,IAAI,GAAG,MAAA,CAAO,IAAA,KAAS,WAAW,KAAA,CAAM,OAAA,CAAQ,QAAQ,CAAA,EAAG;AACzD,MAAA,KAAA,MAAW,QAAQ,QAAA,EAAU;AAC3B,QAAA,MAAM,IAAA;AAAA,MACR;AAAA,IACF,CAAA,MAAO;AACL,MAAA,MAAM,QAAA;AAAA,IACR;AAAA,EACF;AACF","file":"applyStreamingQuery-2LSIOHH5.cjs","sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { foundryPlatformFetch as $foundryPlatformFetch } from \"@osdk/shared.net.platformapi\";\n//\nconst _get = [0, \"/v2/functions/queries/{0}\", 2];\n/**\n * Gets a specific query type with the given API name. By default, this returns the highest semantic\n * version of the query, excluding pre-release versions. To resolve the most recently published version\n * instead, including pre-release versions, set `latestVersionResolution` to `PUBLISH_TIME`.\n *\n * @beta\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/{queryApiName}\n */\nexport function get($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _get, ...args);\n}\nconst _getByRid = [0, \"/v2/functions/queries/getByRid\", 2];\n/**\n * Gets a specific query type with the given RID. By default, this gets the latest version of the query.\n *\n * @beta\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/getByRid\n */\nexport function getByRid($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _getByRid, ...args);\n}\nconst _getByRidBatch = [1, \"/v2/functions/queries/getByRidBatch\", 3];\n/**\n * Gets a list of query types by RID in bulk. By default, this gets the latest version of each query.\n *\n * Queries are filtered from the response if they don't exist or the requesting token lacks the required\n * permissions.\n *\n * The maximum batch size for this endpoint is 100.\n *\n * @beta\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/getByRidBatch\n */\nexport function getByRidBatch($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _getByRidBatch, ...args);\n}\nconst _execute = [1, \"/v2/functions/queries/{0}/execute\", 7];\n/**\n * Executes a Query and returns the result as a single JSON object. By default, this executes\n * the highest semantic version of the query, excluding pre-release versions. To resolve the\n * most recently published version instead, including pre-release versions, set\n * `latestVersionResolution` to `PUBLISH_TIME`.\n *\n * This endpoint executes global (non-ontology-scoped) query functions. For ontology-scoped\n * functions, use the equivalent endpoint under\n * `/v2/ontologies/{ontology}/queries/{queryApiName}/execute`. For streaming or incremental\n * result delivery, use `streamingExecute`.\n *\n * @beta\n *\n * Required Scopes: [api:functions-execute]\n * URL: /v2/functions/queries/{queryApiName}/execute\n */\nexport function execute($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _execute, ...args);\n}\nconst _streamingExecute = [1, \"/v2/functions/queries/{0}/streamingExecute\", 7,, \"text/event-stream\"];\n/**\n * Executes a Query and returns results as a Server-Sent Events (`text/event-stream`) stream.\n * By default, this executes the highest semantic version of the query, excluding pre-release\n * versions. To resolve the most recently published version instead, including pre-release\n * versions, set `latestVersionResolution` to `PUBLISH_TIME`.\n *\n * This endpoint supports all Query functions. Each SSE event's `data` field is a JSON-encoded\n * `StreamingExecuteQueryResponse` – either a data batch (`type: data`) carrying one or more\n * result values, or an error (`type: error`) emitted before stream termination if execution\n * fails. Non-streaming functions emit a single data event containing the entire result;\n * streaming functions emit a data event per batch as results become available.\n *\n * Per the Server-Sent Events specification, each event is terminated by a blank line:\n *\n * ```\n * data: {\"type\":\"data\",\"value\":[{\"productId\":\"SKU-001\",\"price\":29.99}]}\n *\n * data: {\"type\":\"error\",\"errorCode\":\"INVALID_ARGUMENT\",\"errorName\":\"QueryRuntimeError\",\"errorInstanceId\":\"3f8a9c7b-2e4d-4a1f-9b8c-7d6e5f4a3b2c\",\"errorDescription\":\"Division by zero\",\"parameters\":{}}\n *\n * ```\n *\n * @beta\n *\n * Required Scopes: [api:functions-execute]\n * URL: /v2/functions/queries/{queryApiName}/streamingExecute\n */\nexport function streamingExecute($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _streamingExecute, ...args);\n}\nconst _streamingExecuteEvents = [1, \"/v2/functions/queries/{0}/streamingExecuteEvents\", 7,, \"text/event-stream\"];\n/**\n * Executes a Query and returns results as a Server-Sent Events (`text/event-stream`) stream.\n * By default, this executes the highest semantic version of the query, excluding pre-release\n * versions. To resolve the most recently published version instead, including pre-release\n * versions, set `latestVersionResolution` to `PUBLISH_TIME`.\n *\n * This endpoint supports all Query functions. Each SSE event's `data` field is a JSON-encoded\n * `StreamingExecuteQueryResponse` – either a data batch (`type: data`) carrying one or more\n * result values, or an error (`type: error`) emitted before stream termination if execution\n * fails. Non-streaming functions emit a single data event containing the entire result;\n * streaming functions emit a data event per batch as results become available.\n *\n * Per the Server-Sent Events specification, each event is terminated by a blank line:\n *\n * ```\n * data: {\"type\":\"data\",\"value\":[{\"productId\":\"SKU-001\",\"price\":29.99}]}\n *\n * data: {\"type\":\"error\",\"errorCode\":\"INVALID_ARGUMENT\",\"errorName\":\"QueryRuntimeError\",\"errorInstanceId\":\"3f8a9c7b-2e4d-4a1f-9b8c-7d6e5f4a3b2c\",\"errorDescription\":\"Division by zero\",\"parameters\":{}}\n *\n * ```\n *\n * @alpha\n *\n * Required Scopes: [api:functions-execute]\n * URL: /v2/functions/queries/{queryApiName}/streamingExecuteEvents\n */\nexport function streamingExecuteEvents($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _streamingExecuteEvents, ...args);\n}\nconst _executeAsync = [1, \"/v2/functions/queries/{0}/executeAsync\", 7];\n/**\n * Submits a Query for asynchronous execution. Returns either an execution ID\n * for polling, or the complete result if execution finished immediately.\n *\n * Use the Execution resource's getResult endpoint to poll for the\n * result of a submitted execution.\n *\n * @alpha\n *\n * Required Scopes: [api:functions-execute]\n * URL: /v2/functions/queries/{queryApiName}/executeAsync\n */\nexport function executeAsync($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _executeAsync, ...args);\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as Functions from \"@osdk/foundry.functions/Query\";\nimport { addUserAgentHeader } from \"../util/addUserAgentHeader.js\";\nimport { getRequiredDefinitions, remapQueryParams, remapQueryResponse } from \"./applyQuery.js\";\nexport async function* applyStreamingQuery(client, query, params) {\n const qd = await client.ontologyProvider.getQueryDefinition(query.apiName, query.isFixedVersion ? query.version : undefined);\n if (client.flushEdits != null) {\n await client.flushEdits();\n }\n const response = await Functions.streamingExecute(addUserAgentHeader(client, query), query.apiName, {\n ontology: await client.ontologyRid,\n parameters: params ? await remapQueryParams(params, client, qd.parameters) : {},\n version: query.isFixedVersion ? query.version : undefined,\n branch: client.branch\n }, {\n transactionId: client.transactionId,\n preview: true\n });\n const definitions = await getRequiredDefinitions(qd.output, client);\n for await (const event of response) {\n if (event.type !== \"data\") continue;\n const remapped = await remapQueryResponse(client, qd.output, event.value, definitions);\n if (qd.output.type === \"array\" && Array.isArray(remapped)) {\n for (const item of remapped) {\n yield item;\n }\n } else {\n yield remapped;\n }\n }\n}"]}
|
|
1
|
+
{"version":3,"sources":["../../../../node_modules/.pnpm/@osdk+foundry.functions@2.83.0/node_modules/@osdk/foundry.functions/build/esm/v2/public/Query.js","../../src/queries/applyStreamingQuery.ts"],"names":["foundryPlatformFetch","addUserAgentHeader","remapQueryParams","getRequiredDefinitions","remapQueryResponse"],"mappings":";;;;;;;;AAgFA,IAAM,oBAAoB,CAAC,CAAA,EAAG,4CAAA,EAA8C,CAAA,IAAI,mBAAmB,CAAA;AA2B5F,SAAS,gBAAA,CAAiB,SAAS,IAAA,EAAM;AAC9C,EAAA,OAAOA,sCAAA,CAAsB,IAAA,EAAM,iBAAA,EAAmB,GAAG,IAAI,CAAA;AAC/D;;;AC1FA,gBAAuB,mBAAA,CAAoB,MAAA,EAAQ,KAAA,EAAO,MAAA,EAAQ;AAChE,EAAA,MAAM,EAAA,GAAK,MAAM,MAAA,CAAO,gBAAA,CAAiB,kBAAA,CAAmB,KAAA,CAAM,OAAA,EAAS,KAAA,CAAM,cAAA,GAAiB,KAAA,CAAM,OAAA,GAAU,MAAS,CAAA;AAC3H,EAAA,IAAI,MAAA,CAAO,cAAc,IAAA,EAAM;AAC7B,IAAA,MAAM,OAAO,UAAA,EAAW;AAAA,EAC1B;AACA,EAAA,MAAM,QAAA,GAAW,MAAgB,gBAAA,CAAiBC,oCAAA,CAAmB,QAAQ,KAAK,CAAA,EAAG,MAAM,OAAA,EAAS;AAAA,IAClG,QAAA,EAAU,MAAM,MAAA,CAAO,WAAA;AAAA,IACvB,UAAA,EAAY,SAAS,MAAMC,kCAAA,CAAiB,QAAQ,MAAA,EAAQ,EAAA,CAAG,UAAU,CAAA,GAAI,EAAC;AAAA,IAC9E,OAAA,EAAS,KAAA,CAAM,cAAA,GAAiB,KAAA,CAAM,OAAA,GAAU,MAAA;AAAA,IAChD,QAAQ,MAAA,CAAO;AAAA,GACjB,EAAG;AAAA,IACD,eAAe,MAAA,CAAO,aAAA;AAAA,IACtB,OAAA,EAAS;AAAA,GACV,CAAA;AACD,EAAA,MAAM,WAAA,GAAc,MAAMC,wCAAA,CAAuB,EAAA,CAAG,QAAQ,MAAM,CAAA;AAClE,EAAA,WAAA,MAAiB,SAAS,QAAA,EAAU;AAClC,IAAA,IAAI,KAAA,CAAM,SAAS,MAAA,EAAQ;AAC3B,IAAA,MAAM,QAAA,GAAW,MAAMC,oCAAA,CAAmB,MAAA,EAAQ,GAAG,MAAA,EAAQ,KAAA,CAAM,OAAO,WAAW,CAAA;AACrF,IAAA,IAAI,GAAG,MAAA,CAAO,IAAA,KAAS,WAAW,KAAA,CAAM,OAAA,CAAQ,QAAQ,CAAA,EAAG;AACzD,MAAA,KAAA,MAAW,QAAQ,QAAA,EAAU;AAC3B,QAAA,MAAM,IAAA;AAAA,MACR;AAAA,IACF,CAAA,MAAO;AACL,MAAA,MAAM,QAAA;AAAA,IACR;AAAA,EACF;AACF","file":"applyStreamingQuery-LE7U2277.cjs","sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { foundryPlatformFetch as $foundryPlatformFetch } from \"@osdk/shared.net.platformapi\";\n//\nconst _get = [0, \"/v2/functions/queries/{0}\", 2];\n/**\n * Gets a specific query type with the given API name. By default, this returns the highest semantic\n * version of the query, excluding pre-release versions. To resolve the most recently published version\n * instead, including pre-release versions, set `latestVersionResolution` to `PUBLISH_TIME`.\n *\n * @beta\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/{queryApiName}\n */\nexport function get($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _get, ...args);\n}\nconst _getByRid = [0, \"/v2/functions/queries/getByRid\", 2];\n/**\n * Gets a specific query type with the given RID. By default, this gets the latest version of the query.\n *\n * @beta\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/getByRid\n */\nexport function getByRid($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _getByRid, ...args);\n}\nconst _getByRidBatch = [1, \"/v2/functions/queries/getByRidBatch\", 3];\n/**\n * Gets a list of query types by RID in bulk. By default, this gets the latest version of each query.\n *\n * Queries are filtered from the response if they don't exist or the requesting token lacks the required\n * permissions.\n *\n * The maximum batch size for this endpoint is 100.\n *\n * @beta\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/getByRidBatch\n */\nexport function getByRidBatch($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _getByRidBatch, ...args);\n}\nconst _execute = [1, \"/v2/functions/queries/{0}/execute\", 7];\n/**\n * Executes a Query and returns the result as a single JSON object. By default, this executes\n * the highest semantic version of the query, excluding pre-release versions. To resolve the\n * most recently published version instead, including pre-release versions, set\n * `latestVersionResolution` to `PUBLISH_TIME`.\n *\n * This endpoint executes global (non-ontology-scoped) query functions. For ontology-scoped\n * functions, use the equivalent endpoint under\n * `/v2/ontologies/{ontology}/queries/{queryApiName}/execute`. For streaming or incremental\n * result delivery, use `streamingExecute`.\n *\n * @beta\n *\n * Required Scopes: [api:functions-execute]\n * URL: /v2/functions/queries/{queryApiName}/execute\n */\nexport function execute($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _execute, ...args);\n}\nconst _streamingExecute = [1, \"/v2/functions/queries/{0}/streamingExecute\", 7,, \"text/event-stream\"];\n/**\n * Executes a Query and returns results as a Server-Sent Events (`text/event-stream`) stream.\n * By default, this executes the highest semantic version of the query, excluding pre-release\n * versions. To resolve the most recently published version instead, including pre-release\n * versions, set `latestVersionResolution` to `PUBLISH_TIME`.\n *\n * This endpoint supports all Query functions. Each SSE event's `data` field is a JSON-encoded\n * `StreamingExecuteQueryResponse` – either a data batch (`type: data`) carrying one or more\n * result values, or an error (`type: error`) emitted before stream termination if execution\n * fails. Non-streaming functions emit a single data event containing the entire result;\n * streaming functions emit a data event per batch as results become available.\n *\n * Per the Server-Sent Events specification, each event is terminated by a blank line:\n *\n * ```\n * data: {\"type\":\"data\",\"value\":[{\"productId\":\"SKU-001\",\"price\":29.99}]}\n *\n * data: {\"type\":\"error\",\"errorCode\":\"INVALID_ARGUMENT\",\"errorName\":\"QueryRuntimeError\",\"errorInstanceId\":\"3f8a9c7b-2e4d-4a1f-9b8c-7d6e5f4a3b2c\",\"errorDescription\":\"Division by zero\",\"parameters\":{}}\n *\n * ```\n *\n * @beta\n *\n * Required Scopes: [api:functions-execute]\n * URL: /v2/functions/queries/{queryApiName}/streamingExecute\n */\nexport function streamingExecute($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _streamingExecute, ...args);\n}\nconst _streamingExecuteEvents = [1, \"/v2/functions/queries/{0}/streamingExecuteEvents\", 7,, \"text/event-stream\"];\n/**\n * Executes a Query and returns results as a Server-Sent Events (`text/event-stream`) stream.\n * By default, this executes the highest semantic version of the query, excluding pre-release\n * versions. To resolve the most recently published version instead, including pre-release\n * versions, set `latestVersionResolution` to `PUBLISH_TIME`.\n *\n * This endpoint supports all Query functions. Each SSE event's `data` field is a JSON-encoded\n * `StreamingExecuteQueryResponse` – either a data batch (`type: data`) carrying one or more\n * result values, or an error (`type: error`) emitted before stream termination if execution\n * fails. Non-streaming functions emit a single data event containing the entire result;\n * streaming functions emit a data event per batch as results become available.\n *\n * Per the Server-Sent Events specification, each event is terminated by a blank line:\n *\n * ```\n * data: {\"type\":\"data\",\"value\":[{\"productId\":\"SKU-001\",\"price\":29.99}]}\n *\n * data: {\"type\":\"error\",\"errorCode\":\"INVALID_ARGUMENT\",\"errorName\":\"QueryRuntimeError\",\"errorInstanceId\":\"3f8a9c7b-2e4d-4a1f-9b8c-7d6e5f4a3b2c\",\"errorDescription\":\"Division by zero\",\"parameters\":{}}\n *\n * ```\n *\n * @alpha\n *\n * Required Scopes: [api:functions-execute]\n * URL: /v2/functions/queries/{queryApiName}/streamingExecuteEvents\n */\nexport function streamingExecuteEvents($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _streamingExecuteEvents, ...args);\n}\nconst _executeAsync = [1, \"/v2/functions/queries/{0}/executeAsync\", 7];\n/**\n * Submits a Query for asynchronous execution. Returns either an execution ID\n * for polling, or the complete result if execution finished immediately.\n *\n * Use the Execution resource's getResult endpoint to poll for the\n * result of a submitted execution.\n *\n * @alpha\n *\n * Required Scopes: [api:functions-execute]\n * URL: /v2/functions/queries/{queryApiName}/executeAsync\n */\nexport function executeAsync($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _executeAsync, ...args);\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as Functions from \"@osdk/foundry.functions/Query\";\nimport { addUserAgentHeader } from \"../util/addUserAgentHeader.js\";\nimport { getRequiredDefinitions, remapQueryParams, remapQueryResponse } from \"./applyQuery.js\";\nexport async function* applyStreamingQuery(client, query, params) {\n const qd = await client.ontologyProvider.getQueryDefinition(query.apiName, query.isFixedVersion ? query.version : undefined);\n if (client.flushEdits != null) {\n await client.flushEdits();\n }\n const response = await Functions.streamingExecute(addUserAgentHeader(client, query), query.apiName, {\n ontology: await client.ontologyRid,\n parameters: params ? await remapQueryParams(params, client, qd.parameters) : {},\n version: query.isFixedVersion ? query.version : undefined,\n branch: client.branch\n }, {\n transactionId: client.transactionId,\n preview: true\n });\n const definitions = await getRequiredDefinitions(qd.output, client);\n for await (const event of response) {\n if (event.type !== \"data\") continue;\n const remapped = await remapQueryResponse(client, qd.output, event.value, definitions);\n if (qd.output.type === \"array\" && Array.isArray(remapped)) {\n for (const item of remapped) {\n yield item;\n }\n } else {\n yield remapped;\n }\n }\n}"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkPEUMJXQ6_cjs = require('./chunk-PEUMJXQ6.cjs');
|
|
4
4
|
var chunkNJFXSQ4X_cjs = require('./chunk-NJFXSQ4X.cjs');
|
|
5
5
|
var invariant = require('tiny-invariant');
|
|
6
6
|
|
|
@@ -36,7 +36,7 @@ function extractPrimaryKeyFromObjectSpecifier(ObjectSpecifier) {
|
|
|
36
36
|
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.86.0/node_modules/@osdk/foundry.ontologies/build/esm/v2/public/Query.js
|
|
37
37
|
var _execute = [1, "/v2/ontologies/{0}/queries/{1}/execute", 7];
|
|
38
38
|
function execute($ctx, ...args) {
|
|
39
|
-
return
|
|
39
|
+
return chunkPEUMJXQ6_cjs.foundryPlatformFetch($ctx, _execute, ...args);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
// src/object/mediaUpload.ts
|
|
@@ -89,13 +89,13 @@ async function toDataValueQueries(value, client, desiredType) {
|
|
|
89
89
|
switch (desiredType.type) {
|
|
90
90
|
case "attachment": {
|
|
91
91
|
if (isAttachmentUpload(value)) {
|
|
92
|
-
const attachment = await
|
|
92
|
+
const attachment = await chunkPEUMJXQ6_cjs.upload(client, value.data, {
|
|
93
93
|
filename: value.name
|
|
94
94
|
});
|
|
95
95
|
return attachment.rid;
|
|
96
96
|
}
|
|
97
97
|
if (isAttachmentFile(value)) {
|
|
98
|
-
const attachment = await
|
|
98
|
+
const attachment = await chunkPEUMJXQ6_cjs.upload(client, value, {
|
|
99
99
|
filename: value.name
|
|
100
100
|
});
|
|
101
101
|
return attachment.rid;
|
|
@@ -150,11 +150,11 @@ async function toDataValueQueries(value, client, desiredType) {
|
|
|
150
150
|
}
|
|
151
151
|
case "objectSet":
|
|
152
152
|
case "interfaceObjectSet": {
|
|
153
|
-
if (
|
|
154
|
-
return
|
|
153
|
+
if (chunkPEUMJXQ6_cjs.isWireObjectSet(value)) {
|
|
154
|
+
return chunkPEUMJXQ6_cjs.normalizeInterfaceLinkSearchArounds(client, value);
|
|
155
155
|
}
|
|
156
|
-
if (
|
|
157
|
-
return
|
|
156
|
+
if (chunkPEUMJXQ6_cjs.isObjectSet(value)) {
|
|
157
|
+
return chunkPEUMJXQ6_cjs.normalizeInterfaceLinkSearchArounds(client, chunkPEUMJXQ6_cjs.getWireObjectSet(value));
|
|
158
158
|
}
|
|
159
159
|
break;
|
|
160
160
|
}
|
|
@@ -199,7 +199,7 @@ async function applyQuery(client, query, params) {
|
|
|
199
199
|
if (client.flushEdits != null) {
|
|
200
200
|
await client.flushEdits();
|
|
201
201
|
}
|
|
202
|
-
const response = await execute(
|
|
202
|
+
const response = await execute(chunkPEUMJXQ6_cjs.addUserAgentHeader(client, query), await client.ontologyRid, query.apiName, {
|
|
203
203
|
parameters: params ? await remapQueryParams(params, client, (await qd).parameters) : {}
|
|
204
204
|
}, {
|
|
205
205
|
version: query.isFixedVersion ? query.version : void 0,
|
|
@@ -243,10 +243,10 @@ async function remapQueryResponse(client, responseDataType, responseValue, defin
|
|
|
243
243
|
return responseValue;
|
|
244
244
|
}
|
|
245
245
|
case "attachment": {
|
|
246
|
-
return
|
|
246
|
+
return chunkPEUMJXQ6_cjs.hydrateAttachmentFromRidInternal(client, responseValue);
|
|
247
247
|
}
|
|
248
248
|
case "mediaReference": {
|
|
249
|
-
return
|
|
249
|
+
return chunkPEUMJXQ6_cjs.createMediaFromReferenceInternal(client, responseValue);
|
|
250
250
|
}
|
|
251
251
|
case "object": {
|
|
252
252
|
const def = definitions.get(responseDataType.object);
|
|
@@ -268,7 +268,7 @@ async function remapQueryResponse(client, responseDataType, responseValue, defin
|
|
|
268
268
|
throw new Error(`Missing definition for ${responseDataType.objectSet}`);
|
|
269
269
|
}
|
|
270
270
|
if (typeof responseValue === "string") {
|
|
271
|
-
return
|
|
271
|
+
return chunkPEUMJXQ6_cjs.createObjectSet(def, client, {
|
|
272
272
|
type: "intersect",
|
|
273
273
|
objectSets: [{
|
|
274
274
|
type: "base",
|
|
@@ -279,7 +279,7 @@ async function remapQueryResponse(client, responseDataType, responseValue, defin
|
|
|
279
279
|
}]
|
|
280
280
|
});
|
|
281
281
|
}
|
|
282
|
-
return
|
|
282
|
+
return chunkPEUMJXQ6_cjs.createObjectSet(def, client, responseValue);
|
|
283
283
|
}
|
|
284
284
|
case "struct": {
|
|
285
285
|
for (const [key, subtype] of Object.entries(responseDataType.struct)) {
|
|
@@ -462,5 +462,5 @@ exports.isMediaUpload = isMediaUpload;
|
|
|
462
462
|
exports.isObjectSpecifiersObject = isObjectSpecifiersObject;
|
|
463
463
|
exports.remapQueryParams = remapQueryParams;
|
|
464
464
|
exports.remapQueryResponse = remapQueryResponse;
|
|
465
|
-
//# sourceMappingURL=chunk-
|
|
466
|
-
//# sourceMappingURL=chunk-
|
|
465
|
+
//# sourceMappingURL=chunk-3MYESV6A.cjs.map
|
|
466
|
+
//# sourceMappingURL=chunk-3MYESV6A.cjs.map
|