@osdk/client 2.31.0 → 2.31.1-main-79f8a6ef302d7f7ea088af42d5b28a87a3bd9871

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/build/browser/Client.js +1 -1
  3. package/build/browser/Client.js.map +1 -1
  4. package/build/browser/util/UserAgent.js +2 -2
  5. package/build/browser/util/UserAgent.js.map +1 -1
  6. package/build/browser/util/toDataValue.js +0 -4
  7. package/build/browser/util/toDataValue.js.map +1 -1
  8. package/build/cjs/{applyStreamingQuery-5GIZD6RX.cjs → applyStreamingQuery-FVDTKPU3.cjs} +9 -9
  9. package/build/cjs/{applyStreamingQuery-5GIZD6RX.cjs.map → applyStreamingQuery-FVDTKPU3.cjs.map} +1 -1
  10. package/build/cjs/{chunk-ESQLPI5C.cjs → chunk-6TNBDB6Y.cjs} +76 -76
  11. package/build/cjs/{chunk-ESQLPI5C.cjs.map → chunk-6TNBDB6Y.cjs.map} +1 -1
  12. package/build/cjs/{chunk-3N4RHZYX.cjs → chunk-BYLFWM65.cjs} +2 -2
  13. package/build/cjs/{chunk-3N4RHZYX.cjs.map → chunk-BYLFWM65.cjs.map} +1 -1
  14. package/build/cjs/{chunk-NEHSDW7Z.cjs → chunk-LTQC64RM.cjs} +45 -53
  15. package/build/cjs/chunk-LTQC64RM.cjs.map +1 -0
  16. package/build/cjs/{chunk-JX5KXEAF.cjs → chunk-ZV5Q5LAB.cjs} +13 -13
  17. package/build/cjs/{chunk-JX5KXEAF.cjs.map → chunk-ZV5Q5LAB.cjs.map} +1 -1
  18. package/build/cjs/index.cjs +11 -11
  19. package/build/cjs/public/experimental.cjs +6 -6
  20. package/build/cjs/public/internal.cjs +7 -7
  21. package/build/cjs/public/observable.cjs +5 -5
  22. package/build/cjs/public/unstable-do-not-use.cjs +14 -14
  23. package/build/esm/Client.js +1 -1
  24. package/build/esm/Client.js.map +1 -1
  25. package/build/esm/util/UserAgent.js +2 -2
  26. package/build/esm/util/UserAgent.js.map +1 -1
  27. package/build/esm/util/toDataValue.js +0 -4
  28. package/build/esm/util/toDataValue.js.map +1 -1
  29. package/build/types/Client.d.ts +1 -1
  30. package/package.json +6 -6
  31. package/build/browser/util/isPoint.js +0 -20
  32. package/build/browser/util/isPoint.js.map +0 -1
  33. package/build/cjs/chunk-NEHSDW7Z.cjs.map +0 -1
  34. package/build/esm/util/isPoint.js +0 -20
  35. package/build/esm/util/isPoint.js.map +0 -1
  36. package/build/types/util/isPoint.d.ts +0 -1
  37. package/build/types/util/isPoint.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @osdk/client
2
2
 
3
+ ## 2.31.1-main-79f8a6ef302d7f7ea088af42d5b28a87a3bd9871
4
+
5
+ ### Patch Changes
6
+
7
+ - 79f8a6e: Stop serializing GeoJSON `Point` geometries into a `"lat,lon"` string when sending object property/parameter values. This broke geoshape values that are Points (the transaction edits and action endpoints rejected `"lat,lon"` with `InvalidTransactionEditPropertyValue` / invalid parameter for `GeoShape`). GeoJSON values are now passed through as objects, which the server accepts for both geoshape and geopoint/geohash targets. The FauxFoundry geohash action-parameter validator now also accepts GeoJSON objects, matching the real server.
8
+ - @osdk/api@2.31.1-main-79f8a6ef302d7f7ea088af42d5b28a87a3bd9871
9
+ - @osdk/client.unstable@2.31.1-main-79f8a6ef302d7f7ea088af42d5b28a87a3bd9871
10
+ - @osdk/generator-converters@2.31.1-main-79f8a6ef302d7f7ea088af42d5b28a87a3bd9871
11
+
3
12
  ## 2.31.0
4
13
 
5
14
  ### Minor Changes
@@ -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.31.0";
24
+ const MaxOsdkVersion = "2.31.1";
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 Experiment,\n ExperimentFns,\n MinimalObjectSet,\n} from \"@osdk/api/unstable\";\nimport type { SharedClient } from \"@osdk/shared.client2\";\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.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> = Q extends VersionBound<infer V> ? (\n SatisfiesSemver<V, MaxOsdkVersion> extends true ? Q\n : Q & {\n [ErrorMessage]:\n `Your SDK requires a semver compatible version with ${V}. You have ${MaxOsdkVersion}. Update your package.json`;\n }\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\"] ? 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\"] ? 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>>(\n o: Q,\n ): 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>>(\n o: Q,\n ): QuerySignatureFromDef<Q>;\n\n /**\n * @param experiment - The experiment marker that gates an unstable feature.\n * @example\n * ```ts\n * const ref = await client(__EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference)\n * .createMediaReference({ data: blob, fileName: \"media.mp4\", objectType: Employee, propertyType: \"photo\" });\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.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): Promise<\n Q extends ObjectTypeDefinition ? ObjectMetadata\n : Q extends InterfaceDefinition ? InterfaceMetadata\n : Q extends ActionDefinition<any> ? ActionMetadata\n : Q extends QueryDefinition<any> ? 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.31.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;;AA0BA;;AA8HA;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":[]}
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 Experiment,\n ExperimentFns,\n MinimalObjectSet,\n} from \"@osdk/api/unstable\";\nimport type { SharedClient } from \"@osdk/shared.client2\";\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.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> = Q extends VersionBound<infer V> ? (\n SatisfiesSemver<V, MaxOsdkVersion> extends true ? Q\n : Q & {\n [ErrorMessage]:\n `Your SDK requires a semver compatible version with ${V}. You have ${MaxOsdkVersion}. Update your package.json`;\n }\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\"] ? 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\"] ? 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>>(\n o: Q,\n ): 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>>(\n o: Q,\n ): QuerySignatureFromDef<Q>;\n\n /**\n * @param experiment - The experiment marker that gates an unstable feature.\n * @example\n * ```ts\n * const ref = await client(__EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference)\n * .createMediaReference({ data: blob, fileName: \"media.mp4\", objectType: Employee, propertyType: \"photo\" });\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.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): Promise<\n Q extends ObjectTypeDefinition ? ObjectMetadata\n : Q extends InterfaceDefinition ? InterfaceMetadata\n : Q extends ActionDefinition<any> ? ActionMetadata\n : Q extends QueryDefinition<any> ? 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.31.1\";\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;;AA0BA;;AA8HA;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":[]}
@@ -14,6 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- export const USER_AGENT = `osdk-client/${"2.31.0"}`;
18
- export const OBSERVABLE_USER_AGENT = `osdk-observable-client/${"2.31.0"}`;
17
+ export const USER_AGENT = `osdk-client/${"2.31.1-main-79f8a6ef302d7f7ea088af42d5b28a87a3bd9871"}`;
18
+ export const OBSERVABLE_USER_AGENT = `osdk-observable-client/${"2.31.1-main-79f8a6ef302d7f7ea088af42d5b28a87a3bd9871"}`;
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 =\n `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,yBAA4C;AAC9E,OAAO,MAAMC,qBAA6B,GACxC,oCAAuD","ignoreList":[]}
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 =\n `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,GACxC,kFAAuD","ignoreList":[]}
@@ -23,7 +23,6 @@ import { isScenarioClient } from "../scenarios/ScenarioClient.js";
23
23
  import { isInterfaceActionParam } from "./interfaceUtils.js";
24
24
  import { isObjectSpecifiersObject } from "./isObjectSpecifiersObject.js";
25
25
  import { isOntologyObjectV2 } from "./isOntologyObjectV2.js";
26
- import { isPoint } from "./isPoint.js";
27
26
  import { isWireObjectSet } from "./WireObjectSet.js";
28
27
 
29
28
  /**
@@ -87,9 +86,6 @@ export async function toDataValue(value, client, actionMetadata) {
87
86
  if (isObjectSpecifiersObject(value)) {
88
87
  return await toDataValue(value.$primaryKey, client, actionMetadata);
89
88
  }
90
- if (isPoint(value)) {
91
- return await toDataValue(`${value.coordinates[1]},${value.coordinates[0]}`, client, actionMetadata);
92
- }
93
89
 
94
90
  // object set (the rid as a string (passes through the last return), or the ObjectSet definition directly)
95
91
  if (isWireObjectSet(value)) {
@@ -1 +1 @@
1
- {"version":3,"file":"toDataValue.js","names":["MediaSets","Attachments","isAttachmentFile","isAttachmentUpload","isMedia","isMediaReference","isMediaUpload","getWireObjectSet","isObjectSet","isScenarioClient","isInterfaceActionParam","isObjectSpecifiersObject","isOntologyObjectV2","isPoint","isWireObjectSet","toDataValue","value","client","actionMetadata","Array","isArray","Set","values","from","some","dataValue","converted","push","promiseArray","innerValue","Promise","all","attachment","upload","data","filename","name","rid","mediaRef","uploadMedia","fileName","preview","getMediaReference","__primaryKey","$primaryKey","coordinates","objectTypeApiName","$objectType","primaryKeyValue","getScenarioReference","Object","entries","reduce","promisedAcc","key","structValue","acc","resolve"],"sources":["toDataValue.ts"],"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 */\n\nimport type { ActionMetadata } from \"@osdk/api\";\nimport { MediaSets } from \"@osdk/foundry.mediasets\";\nimport { type DataValue } from \"@osdk/foundry.ontologies\";\nimport * as Attachments from \"@osdk/foundry.ontologies/Attachment\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport {\n isAttachmentFile,\n isAttachmentUpload,\n} from \"../object/AttachmentUpload.js\";\nimport {\n isMedia,\n isMediaReference,\n isMediaUpload,\n} from \"../object/mediaUpload.js\";\nimport { getWireObjectSet, isObjectSet } from \"../objectSet/createObjectSet.js\";\nimport { isScenarioClient } from \"../scenarios/ScenarioClient.js\";\nimport { isInterfaceActionParam } from \"./interfaceUtils.js\";\nimport { isObjectSpecifiersObject } from \"./isObjectSpecifiersObject.js\";\nimport { isOntologyObjectV2 } from \"./isOntologyObjectV2.js\";\nimport { isPoint } from \"./isPoint.js\";\nimport { isWireObjectSet } from \"./WireObjectSet.js\";\n\n/**\n * Marshall user-facing data into the wire DataValue type\n *\n * @see DataValue for the expected payloads\n * @internal\n */\nexport async function toDataValue(\n value: unknown,\n client: MinimalClient,\n actionMetadata: ActionMetadata,\n): Promise<DataValue> {\n if (value == null) {\n // typeof null is 'object' so do this first\n // Sending null over the wire clears the data, whereas undefined is dropped at request time.\n return value;\n }\n\n // arrays and sets are both sent over the wire as arrays\n if (Array.isArray(value) || value instanceof Set) {\n const values = Array.from(value);\n if (\n values.some((dataValue) =>\n isAttachmentUpload(dataValue) || isAttachmentFile(dataValue)\n )\n ) {\n const converted = [];\n for (const value of values) {\n converted.push(await toDataValue(value, client, actionMetadata));\n }\n return converted;\n }\n const promiseArray = Array.from(\n value,\n async (innerValue) =>\n await toDataValue(innerValue, client, actionMetadata),\n );\n return Promise.all(promiseArray);\n }\n\n // For uploads, we need to upload ourselves first to get the RID of the attachment\n if (isAttachmentUpload(value)) {\n const attachment = await Attachments.upload(\n client,\n value.data,\n {\n filename: value.name,\n },\n );\n return await toDataValue(attachment.rid, client, actionMetadata);\n }\n\n if (isAttachmentFile(value)) {\n const attachment = await Attachments.upload(\n client,\n value,\n {\n filename: value.name as string,\n },\n );\n return await toDataValue(attachment.rid, client, actionMetadata);\n }\n\n if (isMediaUpload(value)) {\n const mediaRef = await MediaSets.uploadMedia(\n client,\n value.data,\n {\n filename: value.fileName,\n preview: true,\n },\n );\n return await toDataValue(mediaRef, client, actionMetadata);\n }\n\n if (isMedia(value)) {\n return value.getMediaReference();\n }\n\n if (isMediaReference(value)) {\n return value;\n }\n\n // objects just send the JSON'd primaryKey\n if (isOntologyObjectV2(value)) {\n return await toDataValue(value.__primaryKey, client, actionMetadata);\n }\n\n if (isObjectSpecifiersObject(value)) {\n return await toDataValue(value.$primaryKey, client, actionMetadata);\n }\n\n if (isPoint(value)) {\n return await toDataValue(\n `${value.coordinates[1]},${value.coordinates[0]}`,\n client,\n actionMetadata,\n );\n }\n\n // object set (the rid as a string (passes through the last return), or the ObjectSet definition directly)\n if (isWireObjectSet(value)) {\n return value;\n }\n if (isObjectSet(value)) {\n return getWireObjectSet(value);\n }\n\n if (isInterfaceActionParam(value)) {\n return {\n objectTypeApiName: value.$objectType,\n primaryKeyValue: value.$primaryKey,\n };\n }\n\n if (isScenarioClient(value)) {\n return value.getScenarioReference();\n }\n\n // TODO (during queries implementation)\n // two dimensional aggregation\n // three dimensional aggregation\n\n // struct\n if (typeof value === \"object\") {\n return Object.entries(value).reduce(\n async (promisedAcc, [key, structValue]) => {\n const acc = await promisedAcc;\n acc[key] = await toDataValue(structValue, client, actionMetadata);\n return acc;\n },\n Promise.resolve({} as { [key: string]: DataValue }),\n );\n }\n\n // expected to pass through - boolean, byte, date, decimal, float, double, integer, long, short, string, timestamp, object type reference\n return value;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,SAAS,QAAQ,yBAAyB;AAEnD,OAAO,KAAKC,WAAW,MAAM,qCAAqC;AAElE,SACEC,gBAAgB,EAChBC,kBAAkB,QACb,+BAA+B;AACtC,SACEC,OAAO,EACPC,gBAAgB,EAChBC,aAAa,QACR,0BAA0B;AACjC,SAASC,gBAAgB,EAAEC,WAAW,QAAQ,iCAAiC;AAC/E,SAASC,gBAAgB,QAAQ,gCAAgC;AACjE,SAASC,sBAAsB,QAAQ,qBAAqB;AAC5D,SAASC,wBAAwB,QAAQ,+BAA+B;AACxE,SAASC,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,OAAO,QAAQ,cAAc;AACtC,SAASC,eAAe,QAAQ,oBAAoB;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,WAAWA,CAC/BC,KAAc,EACdC,MAAqB,EACrBC,cAA8B,EACV;EACpB,IAAIF,KAAK,IAAI,IAAI,EAAE;IACjB;IACA;IACA,OAAOA,KAAK;EACd;;EAEA;EACA,IAAIG,KAAK,CAACC,OAAO,CAACJ,KAAK,CAAC,IAAIA,KAAK,YAAYK,GAAG,EAAE;IAChD,MAAMC,MAAM,GAAGH,KAAK,CAACI,IAAI,CAACP,KAAK,CAAC;IAChC,IACEM,MAAM,CAACE,IAAI,CAAEC,SAAS,IACpBtB,kBAAkB,CAACsB,SAAS,CAAC,IAAIvB,gBAAgB,CAACuB,SAAS,CAC7D,CAAC,EACD;MACA,MAAMC,SAAS,GAAG,EAAE;MACpB,KAAK,MAAMV,KAAK,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G,EAAEC,WAAW,CAAC,KAAK;MACzC,MAAMC,GAAG,GAAG,MAAMH,WAAW;MAC7BG,GAAG,CAACF,GAAG,CAAC,GAAG,MAAMvC,WAAW,CAACwC,WAAW,EAAEtC,MAAM,EAAEC,cAAc,CAAC;MACjE,OAAOsC,GAAG;IACZ,CAAC,EACD1B,OAAO,CAAC2B,OAAO,CAAC,CAAC,CAAiC,CACpD,CAAC;EACH;;EAEA;EACA,OAAOzC,KAAK;AACd","ignoreList":[]}
1
+ {"version":3,"file":"toDataValue.js","names":["MediaSets","Attachments","isAttachmentFile","isAttachmentUpload","isMedia","isMediaReference","isMediaUpload","getWireObjectSet","isObjectSet","isScenarioClient","isInterfaceActionParam","isObjectSpecifiersObject","isOntologyObjectV2","isWireObjectSet","toDataValue","value","client","actionMetadata","Array","isArray","Set","values","from","some","dataValue","converted","push","promiseArray","innerValue","Promise","all","attachment","upload","data","filename","name","rid","mediaRef","uploadMedia","fileName","preview","getMediaReference","__primaryKey","$primaryKey","objectTypeApiName","$objectType","primaryKeyValue","getScenarioReference","Object","entries","reduce","promisedAcc","key","structValue","acc","resolve"],"sources":["toDataValue.ts"],"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 */\n\nimport type { ActionMetadata } from \"@osdk/api\";\nimport { MediaSets } from \"@osdk/foundry.mediasets\";\nimport { type DataValue } from \"@osdk/foundry.ontologies\";\nimport * as Attachments from \"@osdk/foundry.ontologies/Attachment\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport {\n isAttachmentFile,\n isAttachmentUpload,\n} from \"../object/AttachmentUpload.js\";\nimport {\n isMedia,\n isMediaReference,\n isMediaUpload,\n} from \"../object/mediaUpload.js\";\nimport { getWireObjectSet, isObjectSet } from \"../objectSet/createObjectSet.js\";\nimport { isScenarioClient } from \"../scenarios/ScenarioClient.js\";\nimport { isInterfaceActionParam } from \"./interfaceUtils.js\";\nimport { isObjectSpecifiersObject } from \"./isObjectSpecifiersObject.js\";\nimport { isOntologyObjectV2 } from \"./isOntologyObjectV2.js\";\nimport { isWireObjectSet } from \"./WireObjectSet.js\";\n\n/**\n * Marshall user-facing data into the wire DataValue type\n *\n * @see DataValue for the expected payloads\n * @internal\n */\nexport async function toDataValue(\n value: unknown,\n client: MinimalClient,\n actionMetadata: ActionMetadata,\n): Promise<DataValue> {\n if (value == null) {\n // typeof null is 'object' so do this first\n // Sending null over the wire clears the data, whereas undefined is dropped at request time.\n return value;\n }\n\n // arrays and sets are both sent over the wire as arrays\n if (Array.isArray(value) || value instanceof Set) {\n const values = Array.from(value);\n if (\n values.some((dataValue) =>\n isAttachmentUpload(dataValue) || isAttachmentFile(dataValue)\n )\n ) {\n const converted = [];\n for (const value of values) {\n converted.push(await toDataValue(value, client, actionMetadata));\n }\n return converted;\n }\n const promiseArray = Array.from(\n value,\n async (innerValue) =>\n await toDataValue(innerValue, client, actionMetadata),\n );\n return Promise.all(promiseArray);\n }\n\n // For uploads, we need to upload ourselves first to get the RID of the attachment\n if (isAttachmentUpload(value)) {\n const attachment = await Attachments.upload(\n client,\n value.data,\n {\n filename: value.name,\n },\n );\n return await toDataValue(attachment.rid, client, actionMetadata);\n }\n\n if (isAttachmentFile(value)) {\n const attachment = await Attachments.upload(\n client,\n value,\n {\n filename: value.name as string,\n },\n );\n return await toDataValue(attachment.rid, client, actionMetadata);\n }\n\n if (isMediaUpload(value)) {\n const mediaRef = await MediaSets.uploadMedia(\n client,\n value.data,\n {\n filename: value.fileName,\n preview: true,\n },\n );\n return await toDataValue(mediaRef, client, actionMetadata);\n }\n\n if (isMedia(value)) {\n return value.getMediaReference();\n }\n\n if (isMediaReference(value)) {\n return value;\n }\n\n // objects just send the JSON'd primaryKey\n if (isOntologyObjectV2(value)) {\n return await toDataValue(value.__primaryKey, client, actionMetadata);\n }\n\n if (isObjectSpecifiersObject(value)) {\n return await toDataValue(value.$primaryKey, client, actionMetadata);\n }\n\n // object set (the rid as a string (passes through the last return), or the ObjectSet definition directly)\n if (isWireObjectSet(value)) {\n return value;\n }\n if (isObjectSet(value)) {\n return getWireObjectSet(value);\n }\n\n if (isInterfaceActionParam(value)) {\n return {\n objectTypeApiName: value.$objectType,\n primaryKeyValue: value.$primaryKey,\n };\n }\n\n if (isScenarioClient(value)) {\n return value.getScenarioReference();\n }\n\n // TODO (during queries implementation)\n // two dimensional aggregation\n // three dimensional aggregation\n\n // struct\n if (typeof value === \"object\") {\n return Object.entries(value).reduce(\n async (promisedAcc, [key, structValue]) => {\n const acc = await promisedAcc;\n acc[key] = await toDataValue(structValue, client, actionMetadata);\n return acc;\n },\n Promise.resolve({} as { [key: string]: DataValue }),\n );\n }\n\n // expected to pass through - boolean, byte, date, decimal, float, double, integer, long, short, string, timestamp, object type reference\n return value;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,SAAS,QAAQ,yBAAyB;AAEnD,OAAO,KAAKC,WAAW,MAAM,qCAAqC;AAElE,SACEC,gBAAgB,EAChBC,kBAAkB,QACb,+BAA+B;AACtC,SACEC,OAAO,EACPC,gBAAgB,EAChBC,aAAa,QACR,0BAA0B;AACjC,SAASC,gBAAgB,EAAEC,WAAW,QAAQ,iCAAiC;AAC/E,SAASC,gBAAgB,QAAQ,gCAAgC;AACjE,SAASC,sBAAsB,QAAQ,qBAAqB;AAC5D,SAASC,wBAAwB,QAAQ,+BAA+B;AACxE,SAASC,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,eAAe,QAAQ,oBAAoB;;AAEp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AAC4B;IACzB,CAAC;EACH;EAEA,IAAIlC,gBAAgB,CAACM,KAAK,CAAC,EAAE;IAC3B,OAAOA,KAAK,CAACgC,oBAAoB,CAAC,CAAC;EACrC;;EAEA;EACA;EACA;;EAEA;EACA,IAAI,OAAOhC,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAOiC,MAAM,CAACC,OAAO,CAAClC,KAAK,CAAC,CAACmC,MAAM,CACjC,OAAOC,WAAW,EAAE,CAACC,GAAG,EAAEC,WAAW,CAAC,KAAK;MACzC,MAAMC,GAAG,GAAG,MAAMH,WAAW;MAC7BG,GAAG,CAACF,GAAG,CAAC,GAAG,MAAMtC,WAAW,CAACuC,WAAW,EAAErC,MAAM,EAAEC,cAAc,CAAC;MACjE,OAAOqC,GAAG;IACZ,CAAC,EACDzB,OAAO,CAAC0B,OAAO,CAAC,CAAC,CAAiC,CACpD,CAAC;EACH;;EAEA;EACA,OAAOxC,KAAK;AACd","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkJX5KXEAF_cjs = require('./chunk-JX5KXEAF.cjs');
4
- var chunk3N4RHZYX_cjs = require('./chunk-3N4RHZYX.cjs');
3
+ var chunkZV5Q5LAB_cjs = require('./chunk-ZV5Q5LAB.cjs');
4
+ var chunkBYLFWM65_cjs = require('./chunk-BYLFWM65.cjs');
5
5
  require('./chunk-ROJIXXGF.cjs');
6
6
  var chunkH6PXPU6F_cjs = require('./chunk-H6PXPU6F.cjs');
7
7
  require('./chunk-Q7SFCCGT.cjs');
@@ -18,11 +18,11 @@ async function* applyStreamingQuery(client, query, params) {
18
18
  if (client.flushEdits != null) {
19
19
  await client.flushEdits();
20
20
  }
21
- const response = await streamingExecute(chunk3N4RHZYX_cjs.addUserAgentAndRequestContextHeaders(chunk3N4RHZYX_cjs.augmentRequestContext(client, (_) => ({
21
+ const response = await streamingExecute(chunkBYLFWM65_cjs.addUserAgentAndRequestContextHeaders(chunkBYLFWM65_cjs.augmentRequestContext(client, (_) => ({
22
22
  finalMethodCall: "applyStreamingQuery"
23
23
  })), query), query.apiName, {
24
24
  ontology: await client.ontologyRid,
25
- parameters: params ? await chunkJX5KXEAF_cjs.remapQueryParams(params, client, qd.parameters) : {},
25
+ parameters: params ? await chunkZV5Q5LAB_cjs.remapQueryParams(params, client, qd.parameters) : {},
26
26
  version: query.isFixedVersion ? query.version : void 0,
27
27
  branch: client.branch
28
28
  }, {
@@ -32,15 +32,15 @@ async function* applyStreamingQuery(client, query, params) {
32
32
  if (response.body == null) {
33
33
  throw new Error("streamingExecute returned no response body");
34
34
  }
35
- const definitions = await chunkJX5KXEAF_cjs.getRequiredDefinitions(qd.output, client);
35
+ const definitions = await chunkZV5Q5LAB_cjs.getRequiredDefinitions(qd.output, client);
36
36
  const reader = response.body.getReader();
37
- for await (const line of chunkJX5KXEAF_cjs.parseNdjsonStream(chunkJX5KXEAF_cjs.iterateReadableStream(reader))) {
37
+ for await (const line of chunkZV5Q5LAB_cjs.parseNdjsonStream(chunkZV5Q5LAB_cjs.iterateReadableStream(reader))) {
38
38
  if (line.type === "error") {
39
39
  const err = new Error(`${line.errorName} (${line.errorCode}) [${line.errorInstanceId}]: ${line.errorDescription ?? ""}`);
40
40
  Object.assign(err, line);
41
41
  throw err;
42
42
  }
43
- const remapped = await chunkJX5KXEAF_cjs.remapQueryResponse(client, qd.output, line.value, definitions);
43
+ const remapped = await chunkZV5Q5LAB_cjs.remapQueryResponse(client, qd.output, line.value, definitions);
44
44
  if (qd.output.type === "array" && Array.isArray(remapped)) {
45
45
  for (const item of remapped) {
46
46
  yield item;
@@ -52,5 +52,5 @@ async function* applyStreamingQuery(client, query, params) {
52
52
  }
53
53
 
54
54
  exports.applyStreamingQuery = applyStreamingQuery;
55
- //# sourceMappingURL=applyStreamingQuery-5GIZD6RX.cjs.map
56
- //# sourceMappingURL=applyStreamingQuery-5GIZD6RX.cjs.map
55
+ //# sourceMappingURL=applyStreamingQuery-FVDTKPU3.cjs.map
56
+ //# sourceMappingURL=applyStreamingQuery-FVDTKPU3.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../node_modules/.pnpm/@osdk+foundry.functions@2.63.0/node_modules/@osdk/foundry.functions/build/esm/public/Query.js","../../src/queries/applyStreamingQuery.ts"],"names":["foundryPlatformFetch","addUserAgentAndRequestContextHeaders","augmentRequestContext","remapQueryParams","getRequiredDefinitions","parseNdjsonStream","iterateReadableStream","remapQueryResponse"],"mappings":";;;;;;;;;AA2EA,IAAM,oBAAoB,CAAC,CAAA,EAAG,4CAAA,EAA8C,CAAA,IAAI,0BAA0B,CAAA;AAiCnG,SAAS,gBAAA,CAAiB,SAAS,IAAA,EAAM;AAC9C,EAAA,OAAOA,sCAAA,CAAsB,IAAA,EAAM,iBAAA,EAAmB,GAAG,IAAI,CAAA;AAC/D;;;ACzFA,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,WAAW,MAAgB,gBAAA,CAAiBC,sDAAA,CAAqCC,uCAAA,CAAsB,QAAQ,CAAA,CAAA,MAAM;AAAA,IACzH,eAAA,EAAiB;AAAA,GACnB,CAAE,CAAA,EAAG,KAAK,CAAA,EAAG,MAAM,OAAA,EAAS;AAAA,IAC1B,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,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ingQuery-5GIZD6RX.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 gets the latest version of the query.\n *\n * @alpha\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 * @alpha\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 * @alpha\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 using the given parameters. By default, this executes the latest version of the query.\n *\n * This endpoint is maintained for backward compatibility only.\n *\n * For all new implementations, use the `streamingExecute` endpoint, which supports all function types\n * and provides enhanced functionality.\n *\n * @alpha\n *\n * Required Scopes: [api:functions-read]\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,, \"application/octet-stream\"];\n/**\n * Executes a Query using the given parameters, returning results as an NDJSON stream. By default, this executes the latest version of the query.\n *\n * This endpoint supports all Query functions. The endpoint name 'streamingExecute' refers to the NDJSON\n * streaming response format. Both streaming and non-streaming functions can use this endpoint.\n * Non-streaming functions return a single-line NDJSON response, while streaming functions return multi-line NDJSON responses.\n * This is the recommended endpoint for all query execution.\n *\n * The response is returned as a binary stream in NDJSON (Newline Delimited JSON) format, where each line\n * is a StreamingExecuteQueryResponse containing either a data batch or an error.\n *\n * For a function returning a list of 5 records with a batch size of 3, the response stream would contain\n * two lines. The first line contains the first 3 items, and the second line contains the remaining 2 items:\n *\n * ```\n * {\"type\":\"data\",\"value\":[{\"productId\":\"SKU-001\",\"price\":29.99},{\"productId\":\"SKU-002\",\"price\":49.99},{\"productId\":\"SKU-003\",\"price\":19.99}]}\n * {\"type\":\"data\",\"value\":[{\"productId\":\"SKU-004\",\"price\":39.99},{\"productId\":\"SKU-005\",\"price\":59.99}]}\n * ```\n *\n * Each line is a separate JSON object followed by a newline character. Clients should parse the stream\n * line-by-line to process results as they arrive. If an error occurs during execution, the stream will\n * contain an error line:\n *\n * ```\n * {\"type\":\"error\",\"errorCode\":\"INVALID_ARGUMENT\",\"errorName\":\"QueryRuntimeError\",\"errorInstanceId\":\"3f8a9c7b-2e4d-4a1f-9b8c-7d6e5f4a3b2c\",\"errorDescription\":\"Division by zero\",\"parameters\":{}}\n * ```\n *\n * @alpha\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/{queryApiName}/streamingExecute\n */\nexport function streamingExecute($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _streamingExecute, ...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 { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\nimport { augmentRequestContext } from \"../util/augmentRequestContext.js\";\nimport { iterateReadableStream, parseNdjsonStream } from \"../util/streamutils.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(addUserAgentAndRequestContextHeaders(augmentRequestContext(client, _ => ({\n finalMethodCall: \"applyStreamingQuery\"\n })), 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 if (response.body == null) {\n throw new Error(\"streamingExecute returned no response body\");\n }\n const definitions = await getRequiredDefinitions(qd.output, client);\n const reader = response.body.getReader();\n for await (const line of parseNdjsonStream(iterateReadableStream(reader))) {\n if (line.type === \"error\") {\n const err = new Error(`${line.errorName} (${line.errorCode}) [${line.errorInstanceId}]: ${line.errorDescription ?? \"\"}`);\n Object.assign(err, line);\n throw err;\n }\n const remapped = await remapQueryResponse(client, qd.output, line.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.63.0/node_modules/@osdk/foundry.functions/build/esm/public/Query.js","../../src/queries/applyStreamingQuery.ts"],"names":["foundryPlatformFetch","addUserAgentAndRequestContextHeaders","augmentRequestContext","remapQueryParams","getRequiredDefinitions","parseNdjsonStream","iterateReadableStream","remapQueryResponse"],"mappings":";;;;;;;;;AA2EA,IAAM,oBAAoB,CAAC,CAAA,EAAG,4CAAA,EAA8C,CAAA,IAAI,0BAA0B,CAAA;AAiCnG,SAAS,gBAAA,CAAiB,SAAS,IAAA,EAAM;AAC9C,EAAA,OAAOA,sCAAA,CAAsB,IAAA,EAAM,iBAAA,EAAmB,GAAG,IAAI,CAAA;AAC/D;;;ACzFA,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,WAAW,MAAgB,gBAAA,CAAiBC,sDAAA,CAAqCC,uCAAA,CAAsB,QAAQ,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,MAAA,EAAQ,IAAA,CAAK,OAAO,WAAW,CAAA;AACpF,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-FVDTKPU3.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 gets the latest version of the query.\n *\n * @alpha\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 * @alpha\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 * @alpha\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 using the given parameters. By default, this executes the latest version of the query.\n *\n * This endpoint is maintained for backward compatibility only.\n *\n * For all new implementations, use the `streamingExecute` endpoint, which supports all function types\n * and provides enhanced functionality.\n *\n * @alpha\n *\n * Required Scopes: [api:functions-read]\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,, \"application/octet-stream\"];\n/**\n * Executes a Query using the given parameters, returning results as an NDJSON stream. By default, this executes the latest version of the query.\n *\n * This endpoint supports all Query functions. The endpoint name 'streamingExecute' refers to the NDJSON\n * streaming response format. Both streaming and non-streaming functions can use this endpoint.\n * Non-streaming functions return a single-line NDJSON response, while streaming functions return multi-line NDJSON responses.\n * This is the recommended endpoint for all query execution.\n *\n * The response is returned as a binary stream in NDJSON (Newline Delimited JSON) format, where each line\n * is a StreamingExecuteQueryResponse containing either a data batch or an error.\n *\n * For a function returning a list of 5 records with a batch size of 3, the response stream would contain\n * two lines. The first line contains the first 3 items, and the second line contains the remaining 2 items:\n *\n * ```\n * {\"type\":\"data\",\"value\":[{\"productId\":\"SKU-001\",\"price\":29.99},{\"productId\":\"SKU-002\",\"price\":49.99},{\"productId\":\"SKU-003\",\"price\":19.99}]}\n * {\"type\":\"data\",\"value\":[{\"productId\":\"SKU-004\",\"price\":39.99},{\"productId\":\"SKU-005\",\"price\":59.99}]}\n * ```\n *\n * Each line is a separate JSON object followed by a newline character. Clients should parse the stream\n * line-by-line to process results as they arrive. If an error occurs during execution, the stream will\n * contain an error line:\n *\n * ```\n * {\"type\":\"error\",\"errorCode\":\"INVALID_ARGUMENT\",\"errorName\":\"QueryRuntimeError\",\"errorInstanceId\":\"3f8a9c7b-2e4d-4a1f-9b8c-7d6e5f4a3b2c\",\"errorDescription\":\"Division by zero\",\"parameters\":{}}\n * ```\n *\n * @alpha\n *\n * Required Scopes: [api:functions-read]\n * URL: /v2/functions/queries/{queryApiName}/streamingExecute\n */\nexport function streamingExecute($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _streamingExecute, ...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 { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\nimport { augmentRequestContext } from \"../util/augmentRequestContext.js\";\nimport { iterateReadableStream, parseNdjsonStream } from \"../util/streamutils.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(addUserAgentAndRequestContextHeaders(augmentRequestContext(client, _ => ({\n finalMethodCall: \"applyStreamingQuery\"\n })), 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 if (response.body == null) {\n throw new Error(\"streamingExecute returned no response body\");\n }\n const definitions = await getRequiredDefinitions(qd.output, client);\n const reader = response.body.getReader();\n for await (const line of parseNdjsonStream(iterateReadableStream(reader))) {\n if (line.type === \"error\") {\n const err = new Error(`${line.errorName} (${line.errorCode}) [${line.errorInstanceId}]: ${line.errorDescription ?? \"\"}`);\n Object.assign(err, line);\n throw err;\n }\n const remapped = await remapQueryResponse(client, qd.output, line.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}"]}