@osdk/client 2.45.0 → 2.46.0-main-647d7432d14da0433845faf701ee682e3ebd845b

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 (47) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/build/browser/Client.js +1 -1
  3. package/build/browser/Client.js.map +1 -1
  4. package/build/browser/object/convertWireToOsdkObjects.js +6 -2
  5. package/build/browser/object/convertWireToOsdkObjects.js.map +1 -1
  6. package/build/browser/object/hydrateOsdkObject.js +41 -0
  7. package/build/browser/object/hydrateOsdkObject.js.map +1 -0
  8. package/build/browser/public/unstable-do-not-use.js +1 -0
  9. package/build/browser/public/unstable-do-not-use.js.map +1 -1
  10. package/build/browser/util/UserAgent.js +2 -2
  11. package/build/browser/util/UserAgent.js.map +1 -1
  12. package/build/cjs/{applyStreamingQuery-PSSC2YOQ.cjs → applyStreamingQuery-TWNEY45A.cjs} +9 -9
  13. package/build/cjs/{applyStreamingQuery-PSSC2YOQ.cjs.map → applyStreamingQuery-TWNEY45A.cjs.map} +1 -1
  14. package/build/cjs/{chunk-FEMJRUQG.cjs → chunk-4O6723FC.cjs} +13 -13
  15. package/build/cjs/{chunk-FEMJRUQG.cjs.map → chunk-4O6723FC.cjs.map} +1 -1
  16. package/build/cjs/{chunk-EFTQRJ62.cjs → chunk-NAA6LK6A.cjs} +2 -2
  17. package/build/cjs/{chunk-EFTQRJ62.cjs.map → chunk-NAA6LK6A.cjs.map} +1 -1
  18. package/build/cjs/{chunk-TP5PSFSP.cjs → chunk-YLEWOAPQ.cjs} +80 -80
  19. package/build/cjs/{chunk-TP5PSFSP.cjs.map → chunk-YLEWOAPQ.cjs.map} +1 -1
  20. package/build/cjs/{chunk-KN4SBASU.cjs → chunk-YNHCAO7O.cjs} +50 -49
  21. package/build/cjs/chunk-YNHCAO7O.cjs.map +1 -0
  22. package/build/cjs/index.cjs +11 -11
  23. package/build/cjs/public/experimental.cjs +6 -6
  24. package/build/cjs/public/internal.cjs +7 -7
  25. package/build/cjs/public/observable.cjs +5 -5
  26. package/build/cjs/public/unstable-do-not-use.cjs +40 -15
  27. package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
  28. package/build/cjs/public/unstable-do-not-use.d.cts +24 -5
  29. package/build/esm/Client.js +1 -1
  30. package/build/esm/Client.js.map +1 -1
  31. package/build/esm/object/convertWireToOsdkObjects.js +6 -2
  32. package/build/esm/object/convertWireToOsdkObjects.js.map +1 -1
  33. package/build/esm/object/hydrateOsdkObject.js +41 -0
  34. package/build/esm/object/hydrateOsdkObject.js.map +1 -0
  35. package/build/esm/public/unstable-do-not-use.js +1 -0
  36. package/build/esm/public/unstable-do-not-use.js.map +1 -1
  37. package/build/esm/util/UserAgent.js +2 -2
  38. package/build/esm/util/UserAgent.js.map +1 -1
  39. package/build/types/Client.d.ts +1 -1
  40. package/build/types/object/convertWireToOsdkObjects.d.ts +3 -3
  41. package/build/types/object/convertWireToOsdkObjects.d.ts.map +1 -1
  42. package/build/types/object/hydrateOsdkObject.d.ts +21 -0
  43. package/build/types/object/hydrateOsdkObject.d.ts.map +1 -0
  44. package/build/types/public/unstable-do-not-use.d.ts +1 -0
  45. package/build/types/public/unstable-do-not-use.d.ts.map +1 -1
  46. package/package.json +9 -9
  47. package/build/cjs/chunk-KN4SBASU.cjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @osdk/client
2
2
 
3
+ ## 2.46.0-main-647d7432d14da0433845faf701ee682e3ebd845b
4
+
5
+ ### Minor Changes
6
+
7
+ - c26e051: Add unstable `hydrateOsdkObject` helper to hydrate raw wire objects into OSDK object instances using a caller-supplied map of object definitions.
8
+
9
+ ### Patch Changes
10
+
11
+ - @osdk/api@2.46.0-main-647d7432d14da0433845faf701ee682e3ebd845b
12
+ - @osdk/client.unstable@2.46.0-main-647d7432d14da0433845faf701ee682e3ebd845b
13
+ - @osdk/generator-converters@2.46.0-main-647d7432d14da0433845faf701ee682e3ebd845b
14
+ - @osdk/shared.test@2.31.1-main-647d7432d14da0433845faf701ee682e3ebd845b
15
+
3
16
  ## 2.45.0
4
17
 
5
18
  ### 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.45.0";
24
+ const MaxOsdkVersion = "2.46.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 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 { 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 /**\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\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.45.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;;AA2BA;;AAiIA;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\";\n\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> =\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 /**\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\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.46.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;;AA2BA;;AAiIA;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":[]}
@@ -37,7 +37,7 @@ import { createOsdkObject } from "./convertWireToOsdkObjects/createOsdkObject.js
37
37
  /**
38
38
  * @internal
39
39
  */
40
- export async function convertWireToOsdkObjects(client, objects, interfaceApiName, derivedPropertyTypeByName, propertySecurities, forceRemoveRid = false, selectedProps, strictNonNull = false, interfaceToObjectTypeMappings = {}, interfaceToObjectTypeMappingsV2 = {}) {
40
+ export async function convertWireToOsdkObjects(client, objects, interfaceApiName, derivedPropertyTypeByName, propertySecurities, forceRemoveRid = false, selectedProps, strictNonNull = false, interfaceToObjectTypeMappings = {}, interfaceToObjectTypeMappingsV2 = {}, objectDefsByApiName) {
41
41
  fixObjectPropertiesInPlace(objects, forceRemoveRid);
42
42
 
43
43
  // prefer V2 mappings if non-empty, otherwise fall back to V1
@@ -45,7 +45,11 @@ export async function convertWireToOsdkObjects(client, objects, interfaceApiName
45
45
  const isInterfaceScoped = Object.keys(effectiveMappings).length > 0;
46
46
  const ret = [];
47
47
  for (const rawObj of objects) {
48
- const objectDef = await client.ontologyProvider.getObjectDefinition(rawObj.$apiName);
48
+ // If caller supplied object definitions, use them exclusively instead of
49
+ // hitting the ontology provider - a missing entry is an error rather than a
50
+ // fallback. Only when no map is provided do we defer to the provider, so
51
+ // existing behavior is preserved.
52
+ const objectDef = objectDefsByApiName != null ? objectDefsByApiName[rawObj.$apiName] : await client.ontologyProvider.getObjectDefinition(rawObj.$apiName);
49
53
  !objectDef ? process.env.NODE_ENV !== "production" ? invariant(false, `Missing definition for '${rawObj.$apiName}'`) : invariant(false) : void 0;
50
54
  const interfaceToObjMapping = interfaceApiName && isInterfaceScoped ? effectiveMappings[interfaceApiName][rawObj.$apiName] : undefined;
51
55
  const ifaceSelected = interfaceApiName && interfaceToObjMapping ? selectedProps ? Object.keys(interfaceToObjMapping).filter(val => {
@@ -1 +1 @@
1
- {"version":3,"file":"convertWireToOsdkObjects.js","names":["invariant","createOsdkObject","convertWireToOsdkObjects","client","objects","interfaceApiName","derivedPropertyTypeByName","propertySecurities","forceRemoveRid","selectedProps","strictNonNull","interfaceToObjectTypeMappings","interfaceToObjectTypeMappingsV2","fixObjectPropertiesInPlace","effectiveMappings","Object","keys","length","convertInterfaceToObjectTypeMappingsV2ToV1","isInterfaceScoped","ret","rawObj","objectDef","ontologyProvider","getObjectDefinition","$apiName","process","env","NODE_ENV","interfaceToObjMapping","undefined","ifaceSelected","filter","val","includes","values","primaryKeyApiName","objProps","conforming","invariantInterfacesAsViews","properties","isConforming","Error","osdkObject","$as","push","def","obj","propsToCheck","propName","nullable","logger","debug","$objectType","$primaryKey","apiName","interfaceMap","warning","warn","console","error","objs","__rid","$rid","__score","$score","__apiName","__primaryKey","$title","__title","mappingsV2","fromEntries","entries","map","objectTypeMappingsV2","objectTypeName","propertyMappings","impl","type","interfaceProp","propertyApiName"],"sources":["convertWireToOsdkObjects.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 InterfaceMetadata,\n NullabilityAdherence,\n ObjectMetadata,\n} from \"@osdk/api\";\nimport type {\n InterfacePropertyLocalPropertyImplementation,\n InterfaceToObjectTypeMappings,\n InterfaceToObjectTypeMappingsV2,\n InterfaceTypeApiName,\n OntologyObjectV2,\n PropertySecurities,\n} from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\n\nimport type { DerivedPropertyRuntimeMetadata } from \"../derivedProperties/derivedPropertyRuntimeMetadata.js\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { type FetchedObjectTypeDefinition } from \"../ontology/OntologyProvider.js\";\nimport { createOsdkObject } from \"./convertWireToOsdkObjects/createOsdkObject.js\";\nimport type { InterfaceHolder } from \"./convertWireToOsdkObjects/InterfaceHolder.js\";\nimport type { ObjectHolder } from \"./convertWireToOsdkObjects/ObjectHolder.js\";\nimport type { SimpleOsdkProperties } from \"./SimpleOsdkProperties.js\";\n\n/**\n * If interfaceApiName is not undefined, converts the instances of the\n * interface into their respective\n * underlying concrete types and then returns the $as() representation\n * for the consumers.\n *\n * Otherwise just does the conversion\n *\n * May mutate in place for performance reasons. If you need a clean copy,\n * keep it first.\n *\n * However, you must use the returned value, which will be whatever is correct.\n *\n * @internal\n * @param interfaceApiName - if undefined\n */\nexport async function convertWireToOsdkObjects(\n client: MinimalClient,\n objects: OntologyObjectV2[],\n interfaceApiName: string,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n propertySecurities: PropertySecurities[] | undefined,\n forceRemoveRid?: boolean,\n selectedProps?: ReadonlyArray<string>,\n strictNonNull?: NullabilityAdherence,\n interfaceToObjectTypeMappings?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappings\n >,\n interfaceToObjectTypeMappingsV2?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappingsV2\n >\n): Promise<Array<InterfaceHolder>>;\nexport async function convertWireToOsdkObjects(\n client: MinimalClient,\n objects: OntologyObjectV2[],\n interfaceApiName: undefined,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n propertySecurities: PropertySecurities[] | undefined,\n forceRemoveRid?: boolean,\n selectedProps?: ReadonlyArray<string>,\n strictNonNull?: NullabilityAdherence,\n interfaceToObjectTypeMappings?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappings\n >,\n interfaceToObjectTypeMappingsV2?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappingsV2\n >\n): Promise<Array<ObjectHolder>>;\nexport async function convertWireToOsdkObjects(\n client: MinimalClient,\n objects: OntologyObjectV2[],\n interfaceApiName: string | undefined,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n propertySecurities: PropertySecurities[] | undefined,\n forceRemoveRid?: boolean,\n selectedProps?: ReadonlyArray<string>,\n strictNonNull?: NullabilityAdherence,\n interfaceToObjectTypeMappings?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappings\n >,\n interfaceToObjectTypeMappingsV2?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappingsV2\n >\n): Promise<Array<ObjectHolder | InterfaceHolder>>;\n/**\n * @internal\n */\nexport async function convertWireToOsdkObjects(\n client: MinimalClient,\n objects: OntologyObjectV2[],\n interfaceApiName: string | undefined,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n propertySecurities: PropertySecurities[] | undefined,\n forceRemoveRid: boolean = false,\n selectedProps?: ReadonlyArray<string>,\n strictNonNull: NullabilityAdherence = false,\n interfaceToObjectTypeMappings: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappings\n > = {},\n interfaceToObjectTypeMappingsV2: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappingsV2\n > = {}\n): Promise<Array<ObjectHolder | InterfaceHolder>> {\n fixObjectPropertiesInPlace(objects, forceRemoveRid);\n\n // prefer V2 mappings if non-empty, otherwise fall back to V1\n const effectiveMappings =\n Object.keys(interfaceToObjectTypeMappingsV2).length > 0\n ? convertInterfaceToObjectTypeMappingsV2ToV1(\n interfaceToObjectTypeMappingsV2\n )\n : interfaceToObjectTypeMappings;\n\n const isInterfaceScoped = Object.keys(effectiveMappings).length > 0;\n const ret = [];\n for (const rawObj of objects) {\n const objectDef = await client.ontologyProvider.getObjectDefinition(\n rawObj.$apiName\n );\n invariant(objectDef, `Missing definition for '${rawObj.$apiName}'`);\n\n const interfaceToObjMapping =\n interfaceApiName && isInterfaceScoped\n ? effectiveMappings[interfaceApiName as InterfaceTypeApiName][\n rawObj.$apiName\n ]\n : undefined;\n\n const ifaceSelected =\n interfaceApiName && interfaceToObjMapping\n ? selectedProps\n ? Object.keys(interfaceToObjMapping).filter((val) => {\n selectedProps?.includes(interfaceToObjMapping[val]);\n })\n : [\n ...Object.values(interfaceToObjMapping),\n objectDef.primaryKeyApiName,\n ]\n : undefined;\n\n // default value for when we are checking an object\n let objProps;\n\n let conforming = true;\n if (interfaceApiName && ifaceSelected) {\n invariantInterfacesAsViews(objectDef, interfaceApiName, client);\n\n objProps = ifaceSelected;\n } else {\n objProps = selectedProps ?? Object.keys(objectDef.properties);\n }\n\n conforming &&= isConforming(client, objectDef, rawObj, objProps);\n\n if (strictNonNull === \"throw\" && !conforming) {\n throw new Error(\n \"Unable to safely convert objects as some non nullable properties are null\"\n );\n } else if (strictNonNull === \"drop\" && !conforming) {\n continue;\n }\n\n let osdkObject: ObjectHolder | InterfaceHolder = createOsdkObject(\n client,\n objectDef,\n rawObj,\n derivedPropertyTypeByName,\n propertySecurities\n );\n if (interfaceApiName && isInterfaceScoped)\n osdkObject = osdkObject.$as(interfaceApiName);\n\n ret.push(osdkObject);\n }\n\n return ret;\n}\n\nfunction isConforming(\n client: MinimalClient,\n def: InterfaceMetadata | ObjectMetadata,\n obj: OntologyObjectV2,\n propsToCheck: readonly string[]\n) {\n for (const propName of propsToCheck) {\n if (\n propName in def.properties &&\n def.properties[propName].nullable === false &&\n obj[propName] == null\n ) {\n if (process.env.NODE_ENV !== \"production\") {\n client.logger?.debug(\n {\n obj: {\n $apiName: obj.$apiName,\n $objectType: obj.$objectType,\n $primaryKey: obj.$primaryKey,\n },\n },\n `Found object that does not conform to its definition. Expected ${def.apiName}'s ${propName} to not be null.`\n );\n }\n return false;\n }\n }\n return true;\n}\n\nfunction invariantInterfacesAsViews(\n objectDef: FetchedObjectTypeDefinition,\n interfaceApiName: string,\n client: MinimalClient\n): asserts objectDef is typeof objectDef & { interfaceMap: {} } {\n if (objectDef.interfaceMap?.[interfaceApiName] == null) {\n const warning =\n \"Interfaces are only supported 'as views' but your metadata object is missing the correct information. This suggests your interfaces have not been migrated to the newer version yet and you cannot use this version of the SDK.\";\n if (client.logger) {\n client.logger.warn(warning);\n } else {\n // eslint-disable-next-line no-console\n console.error(`WARNING! ${warning}`);\n }\n throw new Error(warning);\n }\n}\n\nfunction fixObjectPropertiesInPlace(\n objs: OntologyObjectV2[],\n forceRemoveRid: boolean\n): asserts objs is SimpleOsdkProperties[] {\n for (const obj of objs) {\n if (forceRemoveRid) {\n delete obj.__rid;\n }\n\n if (obj.__rid) {\n obj.$rid = obj.__rid;\n delete obj.__rid;\n }\n\n if (obj.__score) {\n obj.$score = obj.__score;\n delete obj.__score;\n }\n\n // Backend returns as __apiName but we want to stick to $ structure\n obj.$apiName ??= obj.__apiName;\n\n // for now these are the same but when we start doing interface projections the $objectType will always be underlying and\n // the $apiName will be for the current view (in current designs)\n obj.$objectType = obj.$apiName;\n\n // copying over for now as its always returned. In the future, this should just be inferred from underlying\n obj.$primaryKey ??= obj.__primaryKey;\n obj.$title ??= obj.__title;\n\n // we don't want people to use these\n delete obj.__apiName;\n delete obj.__primaryKey;\n delete obj.__title;\n }\n}\n\n/**\n * Converts interfaceToObjectTypeMappingsV2 format to the V1 format.\n * V2 format: { interfaceProp: { type: \"localPropertyImplementation\", propertyApiName: \"objectProp\" } }\n * V1 format: { interfaceProp: \"objectProp\" }\n */\nfunction convertInterfaceToObjectTypeMappingsV2ToV1(\n mappingsV2: Record<InterfaceTypeApiName, InterfaceToObjectTypeMappingsV2>\n): Record<InterfaceTypeApiName, InterfaceToObjectTypeMappings> {\n return Object.fromEntries(\n Object.entries(mappingsV2).map(\n ([interfaceApiName, objectTypeMappingsV2]) => [\n interfaceApiName,\n Object.fromEntries(\n Object.entries(objectTypeMappingsV2).map(\n ([objectTypeName, propertyMappings]) => [\n objectTypeName,\n Object.fromEntries(\n Object.entries(propertyMappings)\n .filter(\n ([, impl]) => impl.type === \"localPropertyImplementation\"\n )\n .map(([interfaceProp, impl]) => [\n interfaceProp,\n (impl as InterfacePropertyLocalPropertyImplementation)\n .propertyApiName,\n ])\n ),\n ]\n )\n ),\n ]\n )\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAeA,OAAOA,SAAS,MAAM,gBAAgB;AAKtC,SAASC,gBAAgB,QAAQ,gDAAgD;;AAKjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAuDA;AACA;AACA;AACA,OAAO,eAAeC,wBAAwBA,CAC5CC,MAAqB,EACrBC,OAA2B,EAC3BC,gBAAoC,EACpCC,yBAAyD,EACzDC,kBAAoD,EACpDC,cAAuB,GAAG,KAAK,EAC/BC,aAAqC,EACrCC,aAAmC,GAAG,KAAK,EAC3CC,6BAGC,GAAG,CAAC,CAAC,EACNC,+BAGC,GAAG,CAAC,CAAC,EAC0C;EAChDC,0BAA0B,CAACT,OAAO,EAAEI,cAAc,CAAC;;EAEnD;EACA,MAAMM,iBAAiB,GACrBC,MAAM,CAACC,IAAI,CAACJ,+BAA+B,CAAC,CAACK,MAAM,GAAG,CAAC,GACnDC,0CAA0C,CACxCN,+BACF,CAAC,GACDD,6BAA6B;EAEnC,MAAMQ,iBAAiB,GAAGJ,MAAM,CAACC,IAAI,CAACF,iBAAiB,CAAC,CAACG,MAAM,GAAG,CAAC;EACnE,MAAMG,GAAG,GAAG,EAAE;EACd,KAAK,MAAMC,MAAM,IAAIjB,OAAO,EAAE;IAC5B,MAAMkB,SAAS,GAAG,MAAMnB,MAAM,CAACoB,gBAAgB,CAACC,mBAAmB,CACjEH,MAAM,CAACI,QACT,CAAC;IACD,CAAUH,SAAS,GAAAI,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAnB5B,SAAS,QAAY,2BAA2BqB,MAA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yD,OAAO,CAACI,gBAAgB,CAAC,CAC7B5C,MAAM,CACL,CAAC,GAAG6C,IAAI,CAAC,KAAKA,IAAI,CAACC,IAAI,KAAK,6BAC9B,CAAC,CACAL,GAAG,CAAC,CAAC,CAACM,aAAa,EAAEF,IAAI,CAAC,KAAK,CAC9BE,aAAa,EACZF,IAAI,CACFG,eAAe,CACnB,CACL,CAAC,CAEL,CACF,CAAC,CAEL,CACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"convertWireToOsdkObjects.js","names":["invariant","createOsdkObject","convertWireToOsdkObjects","client","objects","interfaceApiName","derivedPropertyTypeByName","propertySecurities","forceRemoveRid","selectedProps","strictNonNull","interfaceToObjectTypeMappings","interfaceToObjectTypeMappingsV2","objectDefsByApiName","fixObjectPropertiesInPlace","effectiveMappings","Object","keys","length","convertInterfaceToObjectTypeMappingsV2ToV1","isInterfaceScoped","ret","rawObj","objectDef","$apiName","ontologyProvider","getObjectDefinition","process","env","NODE_ENV","interfaceToObjMapping","undefined","ifaceSelected","filter","val","includes","values","primaryKeyApiName","objProps","conforming","invariantInterfacesAsViews","properties","isConforming","Error","osdkObject","$as","push","def","obj","propsToCheck","propName","nullable","logger","debug","$objectType","$primaryKey","apiName","interfaceMap","warning","warn","console","error","objs","__rid","$rid","__score","$score","__apiName","__primaryKey","$title","__title","mappingsV2","fromEntries","entries","map","objectTypeMappingsV2","objectTypeName","propertyMappings","impl","type","interfaceProp","propertyApiName"],"sources":["convertWireToOsdkObjects.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 InterfaceMetadata,\n NullabilityAdherence,\n ObjectMetadata,\n} from \"@osdk/api\";\nimport type {\n InterfacePropertyLocalPropertyImplementation,\n InterfaceToObjectTypeMappings,\n InterfaceToObjectTypeMappingsV2,\n InterfaceTypeApiName,\n OntologyObjectV2,\n PropertySecurities,\n} from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\n\nimport type { DerivedPropertyRuntimeMetadata } from \"../derivedProperties/derivedPropertyRuntimeMetadata.js\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { type FetchedObjectTypeDefinition } from \"../ontology/OntologyProvider.js\";\nimport { createOsdkObject } from \"./convertWireToOsdkObjects/createOsdkObject.js\";\nimport type { InterfaceHolder } from \"./convertWireToOsdkObjects/InterfaceHolder.js\";\nimport type { ObjectHolder } from \"./convertWireToOsdkObjects/ObjectHolder.js\";\nimport type { SimpleOsdkProperties } from \"./SimpleOsdkProperties.js\";\n\n/**\n * If interfaceApiName is not undefined, converts the instances of the\n * interface into their respective\n * underlying concrete types and then returns the $as() representation\n * for the consumers.\n *\n * Otherwise just does the conversion\n *\n * May mutate in place for performance reasons. If you need a clean copy,\n * keep it first.\n *\n * However, you must use the returned value, which will be whatever is correct.\n *\n * @internal\n * @param interfaceApiName - if undefined\n */\nexport async function convertWireToOsdkObjects(\n client: MinimalClient,\n objects: OntologyObjectV2[],\n interfaceApiName: string,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n propertySecurities: PropertySecurities[] | undefined,\n forceRemoveRid?: boolean,\n selectedProps?: ReadonlyArray<string>,\n strictNonNull?: NullabilityAdherence,\n interfaceToObjectTypeMappings?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappings\n >,\n interfaceToObjectTypeMappingsV2?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappingsV2\n >,\n objectDefsByApiName?: Record<string, ObjectMetadata>\n): Promise<Array<InterfaceHolder>>;\nexport async function convertWireToOsdkObjects(\n client: MinimalClient,\n objects: OntologyObjectV2[],\n interfaceApiName: undefined,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n propertySecurities: PropertySecurities[] | undefined,\n forceRemoveRid?: boolean,\n selectedProps?: ReadonlyArray<string>,\n strictNonNull?: NullabilityAdherence,\n interfaceToObjectTypeMappings?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappings\n >,\n interfaceToObjectTypeMappingsV2?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappingsV2\n >,\n objectDefsByApiName?: Record<string, ObjectMetadata>\n): Promise<Array<ObjectHolder>>;\nexport async function convertWireToOsdkObjects(\n client: MinimalClient,\n objects: OntologyObjectV2[],\n interfaceApiName: string | undefined,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n propertySecurities: PropertySecurities[] | undefined,\n forceRemoveRid?: boolean,\n selectedProps?: ReadonlyArray<string>,\n strictNonNull?: NullabilityAdherence,\n interfaceToObjectTypeMappings?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappings\n >,\n interfaceToObjectTypeMappingsV2?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappingsV2\n >,\n objectDefsByApiName?: Record<string, ObjectMetadata>\n): Promise<Array<ObjectHolder | InterfaceHolder>>;\n/**\n * @internal\n */\nexport async function convertWireToOsdkObjects(\n client: MinimalClient,\n objects: OntologyObjectV2[],\n interfaceApiName: string | undefined,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n propertySecurities: PropertySecurities[] | undefined,\n forceRemoveRid: boolean = false,\n selectedProps?: ReadonlyArray<string>,\n strictNonNull: NullabilityAdherence = false,\n interfaceToObjectTypeMappings: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappings\n > = {},\n interfaceToObjectTypeMappingsV2: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappingsV2\n > = {},\n objectDefsByApiName?: Record<string, ObjectMetadata>\n): Promise<Array<ObjectHolder | InterfaceHolder>> {\n fixObjectPropertiesInPlace(objects, forceRemoveRid);\n\n // prefer V2 mappings if non-empty, otherwise fall back to V1\n const effectiveMappings =\n Object.keys(interfaceToObjectTypeMappingsV2).length > 0\n ? convertInterfaceToObjectTypeMappingsV2ToV1(\n interfaceToObjectTypeMappingsV2\n )\n : interfaceToObjectTypeMappings;\n\n const isInterfaceScoped = Object.keys(effectiveMappings).length > 0;\n const ret = [];\n for (const rawObj of objects) {\n // If caller supplied object definitions, use them exclusively instead of\n // hitting the ontology provider - a missing entry is an error rather than a\n // fallback. Only when no map is provided do we defer to the provider, so\n // existing behavior is preserved.\n const objectDef = (\n objectDefsByApiName != null\n ? objectDefsByApiName[rawObj.$apiName]\n : await client.ontologyProvider.getObjectDefinition(rawObj.$apiName)\n ) as FetchedObjectTypeDefinition;\n invariant(objectDef, `Missing definition for '${rawObj.$apiName}'`);\n\n const interfaceToObjMapping =\n interfaceApiName && isInterfaceScoped\n ? effectiveMappings[interfaceApiName as InterfaceTypeApiName][\n rawObj.$apiName\n ]\n : undefined;\n\n const ifaceSelected =\n interfaceApiName && interfaceToObjMapping\n ? selectedProps\n ? Object.keys(interfaceToObjMapping).filter((val) => {\n selectedProps?.includes(interfaceToObjMapping[val]);\n })\n : [\n ...Object.values(interfaceToObjMapping),\n objectDef.primaryKeyApiName,\n ]\n : undefined;\n\n // default value for when we are checking an object\n let objProps;\n\n let conforming = true;\n if (interfaceApiName && ifaceSelected) {\n invariantInterfacesAsViews(objectDef, interfaceApiName, client);\n\n objProps = ifaceSelected;\n } else {\n objProps = selectedProps ?? Object.keys(objectDef.properties);\n }\n\n conforming &&= isConforming(client, objectDef, rawObj, objProps);\n\n if (strictNonNull === \"throw\" && !conforming) {\n throw new Error(\n \"Unable to safely convert objects as some non nullable properties are null\"\n );\n } else if (strictNonNull === \"drop\" && !conforming) {\n continue;\n }\n\n let osdkObject: ObjectHolder | InterfaceHolder = createOsdkObject(\n client,\n objectDef,\n rawObj,\n derivedPropertyTypeByName,\n propertySecurities\n );\n if (interfaceApiName && isInterfaceScoped)\n osdkObject = osdkObject.$as(interfaceApiName);\n\n ret.push(osdkObject);\n }\n\n return ret;\n}\n\nfunction isConforming(\n client: MinimalClient,\n def: InterfaceMetadata | ObjectMetadata,\n obj: OntologyObjectV2,\n propsToCheck: readonly string[]\n) {\n for (const propName of propsToCheck) {\n if (\n propName in def.properties &&\n def.properties[propName].nullable === false &&\n obj[propName] == null\n ) {\n if (process.env.NODE_ENV !== \"production\") {\n client.logger?.debug(\n {\n obj: {\n $apiName: obj.$apiName,\n $objectType: obj.$objectType,\n $primaryKey: obj.$primaryKey,\n },\n },\n `Found object that does not conform to its definition. Expected ${def.apiName}'s ${propName} to not be null.`\n );\n }\n return false;\n }\n }\n return true;\n}\n\nfunction invariantInterfacesAsViews(\n objectDef: FetchedObjectTypeDefinition,\n interfaceApiName: string,\n client: MinimalClient\n): asserts objectDef is typeof objectDef & { interfaceMap: {} } {\n if (objectDef.interfaceMap?.[interfaceApiName] == null) {\n const warning =\n \"Interfaces are only supported 'as views' but your metadata object is missing the correct information. This suggests your interfaces have not been migrated to the newer version yet and you cannot use this version of the SDK.\";\n if (client.logger) {\n client.logger.warn(warning);\n } else {\n // eslint-disable-next-line no-console\n console.error(`WARNING! ${warning}`);\n }\n throw new Error(warning);\n }\n}\n\nfunction fixObjectPropertiesInPlace(\n objs: OntologyObjectV2[],\n forceRemoveRid: boolean\n): asserts objs is SimpleOsdkProperties[] {\n for (const obj of objs) {\n if (forceRemoveRid) {\n delete obj.__rid;\n }\n\n if (obj.__rid) {\n obj.$rid = obj.__rid;\n delete obj.__rid;\n }\n\n if (obj.__score) {\n obj.$score = obj.__score;\n delete obj.__score;\n }\n\n // Backend returns as __apiName but we want to stick to $ structure\n obj.$apiName ??= obj.__apiName;\n\n // for now these are the same but when we start doing interface projections the $objectType will always be underlying and\n // the $apiName will be for the current view (in current designs)\n obj.$objectType = obj.$apiName;\n\n // copying over for now as its always returned. In the future, this should just be inferred from underlying\n obj.$primaryKey ??= obj.__primaryKey;\n obj.$title ??= obj.__title;\n\n // we don't want people to use these\n delete obj.__apiName;\n delete obj.__primaryKey;\n delete obj.__title;\n }\n}\n\n/**\n * Converts interfaceToObjectTypeMappingsV2 format to the V1 format.\n * V2 format: { interfaceProp: { type: \"localPropertyImplementation\", propertyApiName: \"objectProp\" } }\n * V1 format: { interfaceProp: \"objectProp\" }\n */\nfunction convertInterfaceToObjectTypeMappingsV2ToV1(\n mappingsV2: Record<InterfaceTypeApiName, InterfaceToObjectTypeMappingsV2>\n): Record<InterfaceTypeApiName, InterfaceToObjectTypeMappings> {\n return Object.fromEntries(\n Object.entries(mappingsV2).map(\n ([interfaceApiName, objectTypeMappingsV2]) => [\n interfaceApiName,\n Object.fromEntries(\n Object.entries(objectTypeMappingsV2).map(\n ([objectTypeName, propertyMappings]) => [\n objectTypeName,\n Object.fromEntries(\n Object.entries(propertyMappings)\n .filter(\n ([, impl]) => impl.type === \"localPropertyImplementation\"\n )\n .map(([interfaceProp, impl]) => [\n interfaceProp,\n (impl as InterfacePropertyLocalPropertyImplementation)\n .propertyApiName,\n ])\n ),\n ]\n )\n ),\n ]\n )\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAeA,OAAOA,SAAS,MAAM,gBAAgB;AAKtC,SAASC,gBAAgB,QAAQ,gDAAgD;;AAKjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA0DA;AACA;AACA;AACA,OAAO,eAAeC,wBAAwBA,CAC5CC,MAAqB,EACrBC,OAA2B,EAC3BC,gBAAoC,EACpCC,yBAAyD,EACzDC,kBAAoD,EACpDC,cAAuB,GAAG,KAAK,EAC/BC,aAAqC,EACrCC,aAAmC,GAAG,KAAK,EAC3CC,6BAGC,GAAG,CAAC,CAAC,EACNC,+BAGC,GAAG,CAAC,CAAC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B,QAAQ;;IAE9B;IACAwB,GAAG,CAACO,WAAW,KAAKP,GAAG,CAACoB,YAAY;IACpCpB,GAAG,CAACqB,MAAM,KAAKrB,GAAG,CAACsB,OAAO;;IAE1B;IACA,OAAOtB,GAAG,CAACmB,SAAS;IACpB,OAAOnB,GAAG,CAACoB,YAAY;IACvB,OAAOpB,GAAG,CAACsB,OAAO;EACpB;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA,SAASnD,0CAA0CA,CACjDoD,UAAyE,EACZ;EAC7D,OAAOvD,MAAM,CAACwD,WAAW,CACvBxD,MAAM,CAACyD,OAAO,CAACF,UAAU,CAAC,CAACG,GAAG,CAC5B,CAAC,CAACrE,gBAAgB,EAAEsE,oBAAoB,CAAC,KAAK,CAC5CtE,gBAAgB,EAChBW,MAAM,CAACwD,WAAW,CAChBxD,MAAM,CAACyD,OAAO,CAACE,oBAAoB,CAAC,CAACD,GAAG,CACtC,CAAC,CAACE,cAAc,EAAEC,gBAAgB,CAAC,KAAK,CACtCD,cAAc,EACd5D,MAAM,CAACwD,WAAW,CAChBxD,MAAM,CAACyD,OAAO,CAACI,gBAAgB,CAAC,CAC7B5C,MAAM,CACL,CAAC,GAAG6C,IAAI,CAAC,KAAKA,IAAI,CAACC,IAAI,KAAK,6BAC9B,CAAC,CACAL,GAAG,CAAC,CAAC,CAACM,aAAa,EAAEF,IAAI,CAAC,KAAK,CAC9BE,aAAa,EACZF,IAAI,CACFG,eAAe,CACnB,CACL,CAAC,CAEL,CACF,CAAC,CAEL,CACF,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,41 @@
1
+ /*
2
+ * Copyright 2024 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
+ import { convertWireToOsdkObjects } from "./convertWireToOsdkObjects.js";
19
+
20
+ /**
21
+ * Hydrates raw wire objects into OSDK object instances.
22
+ *
23
+ * When supplied, the `objectDefsByApiName` map (object type api name -> object
24
+ * definition) is used exclusively to resolve each object's type, avoiding calls
25
+ * to the ontology provider; an object whose api name is missing from the map
26
+ * throws. When the map is omitted, definitions are resolved via the ontology
27
+ * provider network call.
28
+ *
29
+ * Unstable API. Do not depend on this outside of experimental usage.
30
+ *
31
+ * @param client - the OSDK client
32
+ * @param objects - the raw wire objects to hydrate
33
+ * @param objectDefsByApiName - optional map of object type api name to its
34
+ * definition. When provided, every object's api name must be present.
35
+ * @param propertySecurities - optional property securities for the objects
36
+ */
37
+ // oxlint-disable-next-line require-await -- intentionally async
38
+ export async function hydrateOsdkObject(client, objects, objectDefsByApiName, propertySecurities) {
39
+ return convertWireToOsdkObjects(client[additionalContext], objects, /* interfaceApiName */undefined, /* derivedPropertyTypeByName */{}, propertySecurities, /* forceRemoveRid */undefined, /* selectedProps */undefined, /* strictNonNull */undefined, /* interfaceToObjectTypeMappings */undefined, /* interfaceToObjectTypeMappingsV2 */undefined, objectDefsByApiName);
40
+ }
41
+ //# sourceMappingURL=hydrateOsdkObject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydrateOsdkObject.js","names":["additionalContext","convertWireToOsdkObjects","hydrateOsdkObject","client","objects","objectDefsByApiName","propertySecurities","undefined"],"sources":["hydrateOsdkObject.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 { ObjectMetadata, Osdk } from \"@osdk/api\";\nimport type {\n OntologyObjectV2,\n PropertySecurities,\n} from \"@osdk/foundry.ontologies\";\n\nimport type { Client } from \"../Client.js\";\nimport { additionalContext } from \"../Client.js\";\nimport { convertWireToOsdkObjects } from \"./convertWireToOsdkObjects.js\";\n\n/**\n * Hydrates raw wire objects into OSDK object instances.\n *\n * When supplied, the `objectDefsByApiName` map (object type api name -> object\n * definition) is used exclusively to resolve each object's type, avoiding calls\n * to the ontology provider; an object whose api name is missing from the map\n * throws. When the map is omitted, definitions are resolved via the ontology\n * provider network call.\n *\n * Unstable API. Do not depend on this outside of experimental usage.\n *\n * @param client - the OSDK client\n * @param objects - the raw wire objects to hydrate\n * @param objectDefsByApiName - optional map of object type api name to its\n * definition. When provided, every object's api name must be present.\n * @param propertySecurities - optional property securities for the objects\n */\n// oxlint-disable-next-line require-await -- intentionally async\nexport async function hydrateOsdkObject(\n client: Client,\n objects: OntologyObjectV2[],\n objectDefsByApiName?: Record<string, ObjectMetadata>,\n propertySecurities?: PropertySecurities[]\n): Promise<Array<Osdk.Instance<any>>> {\n return convertWireToOsdkObjects(\n client[additionalContext],\n objects,\n /* interfaceApiName */ undefined,\n /* derivedPropertyTypeByName */ {},\n propertySecurities,\n /* forceRemoveRid */ undefined,\n /* selectedProps */ undefined,\n /* strictNonNull */ undefined,\n /* interfaceToObjectTypeMappings */ undefined,\n /* interfaceToObjectTypeMappingsV2 */ undefined,\n objectDefsByApiName\n ) as unknown as Promise<Array<Osdk.Instance<any>>>;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,SAASA,iBAAiB,QAAQ,cAAc;AAChD,SAASC,wBAAwB,QAAQ,+BAA+B;;AAExE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,iBAAiBA,CACrCC,MAAc,EACdC,OAA2B,EAC3BC,mBAAoD,EACpDC,kBAAyC,EACL;EACpC,OAAOL,wBAAwB,CAC7BE,MAAM,CAACH,iBAAiB,CAAC,EACzBI,OAAO,EACP,sBAAuBG,SAAS,EAChC,+BAAgC,CAAC,CAAC,EAClCD,kBAAkB,EAClB,oBAAqBC,SAAS,EAC9B,mBAAoBA,SAAS,EAC7B,mBAAoBA,SAAS,EAC7B,mCAAoCA,SAAS,EAC7C,qCAAsCA,SAAS,EAC/CF,mBACF,CAAC;AACH","ignoreList":[]}
@@ -15,6 +15,7 @@
15
15
  */
16
16
 
17
17
  export { augment } from "../object/fetchPage.js";
18
+ export { hydrateOsdkObject } from "../object/hydrateOsdkObject.js";
18
19
  export { getWireObjectSet, isObjectSet } from "../objectSet/createObjectSet.js";
19
20
  export { getMetaTagContent, getOsdkConfig } from "../public-utils/osdkConfig.js";
20
21
  export { createClientWithSubscriptionConnection, createClientWithTransaction } from "../createClient.js";
@@ -1 +1 @@
1
- {"version":3,"file":"unstable-do-not-use.js","names":["augment","getWireObjectSet","isObjectSet","getMetaTagContent","getOsdkConfig","createClientWithSubscriptionConnection","createClientWithTransaction","createScenario","withScenario","applyShapeTransformations","applyShapeTransformationsToArray","buildObjectSetFromLinkDefByType","getLinkQueryOptions","createObservableClient"],"sources":["unstable-do-not-use.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 { augment } from \"../object/fetchPage.js\";\nexport { getWireObjectSet, isObjectSet } from \"../objectSet/createObjectSet.js\";\n\nexport {\n getMetaTagContent,\n getOsdkConfig,\n} from \"../public-utils/osdkConfig.js\";\nexport type { OsdkConfig } from \"../public-utils/osdkConfig.js\";\n\nexport {\n createClientWithSubscriptionConnection,\n createClientWithTransaction,\n} from \"../createClient.js\";\nexport type {\n CreateSubscriptionConnectionFn,\n SubscriptionConnection,\n} from \"../SubscriptionConnection.js\";\n\nexport { createScenario } from \"../scenarios/createScenario.js\";\nexport type { EXPERIMENTAL_ScenarioClient } from \"../scenarios/ScenarioClient.js\";\nexport { withScenario } from \"../scenarios/withScenario.js\";\n\nexport {\n applyShapeTransformations,\n applyShapeTransformationsToArray,\n buildObjectSetFromLinkDefByType,\n getLinkQueryOptions,\n} from \"../shapes/index.js\";\n\n/** @deprecated Import from `@osdk/client/observable` instead. */\nexport type { ActionSignatureFromDef } from \"../actions/applyAction.js\";\n/** @deprecated Import from `@osdk/client/observable` instead. */\nexport { createObservableClient } from \"../observable/ObservableClient.js\";\n/** @deprecated Import from `@osdk/client/observable` instead. */\nexport type {\n CacheEntry,\n CacheSnapshot,\n CanonicalizedOptions,\n CanonicalizeOptionsInput,\n ObservableClient,\n ObserveAggregationArgs,\n ObserveFunctionCallbackArgs,\n ObserveFunctionOptions,\n ObserveObjectCallbackArgs,\n ObserveObjectsCallbackArgs,\n ObserveObjectSetArgs,\n Unsubscribable,\n} from \"../observable/ObservableClient.js\";\n/** @deprecated Import from `@osdk/client/observable` instead. */\nexport type { Observer } from \"../observable/ObservableClient/common.js\";\n/** @deprecated Import from `@osdk/client/observable` instead. */\nexport type { ObserveLinks } from \"../observable/ObservableClient/ObserveLink.js\";\n/** @deprecated Import from `@osdk/client/observable` instead. */\nexport type { QueryParameterType, QueryReturnType } from \"../queries/types.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAQ,wBAAwB;AAChD,SAASC,gBAAgB,EAAEC,WAAW,QAAQ,iCAAiC;AAE/E,SACEC,iBAAiB,EACjBC,aAAa,QACR,+BAA+B;AAGtC,SACEC,sCAAsC,EACtCC,2BAA2B,QACtB,oBAAoB;AAM3B,SAASC,cAAc,QAAQ,gCAAgC;AAE/D,SAASC,YAAY,QAAQ,8BAA8B;AAE3D,SACEC,yBAAyB,EACzBC,gCAAgC,EAChCC,+BAA+B,EAC/BC,mBAAmB,QACd,oBAAoB;;AAE3B;;AAEA;AACA,SAASC,sBAAsB,QAAQ,mCAAmC;AAC1E;;AAeA;;AAEA;;AAEA","ignoreList":[]}
1
+ {"version":3,"file":"unstable-do-not-use.js","names":["augment","hydrateOsdkObject","getWireObjectSet","isObjectSet","getMetaTagContent","getOsdkConfig","createClientWithSubscriptionConnection","createClientWithTransaction","createScenario","withScenario","applyShapeTransformations","applyShapeTransformationsToArray","buildObjectSetFromLinkDefByType","getLinkQueryOptions","createObservableClient"],"sources":["unstable-do-not-use.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 { augment } from \"../object/fetchPage.js\";\nexport { hydrateOsdkObject } from \"../object/hydrateOsdkObject.js\";\nexport { getWireObjectSet, isObjectSet } from \"../objectSet/createObjectSet.js\";\n\nexport {\n getMetaTagContent,\n getOsdkConfig,\n} from \"../public-utils/osdkConfig.js\";\nexport type { OsdkConfig } from \"../public-utils/osdkConfig.js\";\n\nexport {\n createClientWithSubscriptionConnection,\n createClientWithTransaction,\n} from \"../createClient.js\";\nexport type {\n CreateSubscriptionConnectionFn,\n SubscriptionConnection,\n} from \"../SubscriptionConnection.js\";\n\nexport { createScenario } from \"../scenarios/createScenario.js\";\nexport type { EXPERIMENTAL_ScenarioClient } from \"../scenarios/ScenarioClient.js\";\nexport { withScenario } from \"../scenarios/withScenario.js\";\n\nexport {\n applyShapeTransformations,\n applyShapeTransformationsToArray,\n buildObjectSetFromLinkDefByType,\n getLinkQueryOptions,\n} from \"../shapes/index.js\";\n\n/** @deprecated Import from `@osdk/client/observable` instead. */\nexport type { ActionSignatureFromDef } from \"../actions/applyAction.js\";\n/** @deprecated Import from `@osdk/client/observable` instead. */\nexport { createObservableClient } from \"../observable/ObservableClient.js\";\n/** @deprecated Import from `@osdk/client/observable` instead. */\nexport type {\n CacheEntry,\n CacheSnapshot,\n CanonicalizedOptions,\n CanonicalizeOptionsInput,\n ObservableClient,\n ObserveAggregationArgs,\n ObserveFunctionCallbackArgs,\n ObserveFunctionOptions,\n ObserveObjectCallbackArgs,\n ObserveObjectsCallbackArgs,\n ObserveObjectSetArgs,\n Unsubscribable,\n} from \"../observable/ObservableClient.js\";\n/** @deprecated Import from `@osdk/client/observable` instead. */\nexport type { Observer } from \"../observable/ObservableClient/common.js\";\n/** @deprecated Import from `@osdk/client/observable` instead. */\nexport type { ObserveLinks } from \"../observable/ObservableClient/ObserveLink.js\";\n/** @deprecated Import from `@osdk/client/observable` instead. */\nexport type { QueryParameterType, QueryReturnType } from \"../queries/types.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAQ,wBAAwB;AAChD,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,gBAAgB,EAAEC,WAAW,QAAQ,iCAAiC;AAE/E,SACEC,iBAAiB,EACjBC,aAAa,QACR,+BAA+B;AAGtC,SACEC,sCAAsC,EACtCC,2BAA2B,QACtB,oBAAoB;AAM3B,SAASC,cAAc,QAAQ,gCAAgC;AAE/D,SAASC,YAAY,QAAQ,8BAA8B;AAE3D,SACEC,yBAAyB,EACzBC,gCAAgC,EAChCC,+BAA+B,EAC/BC,mBAAmB,QACd,oBAAoB;;AAE3B;;AAEA;AACA,SAASC,sBAAsB,QAAQ,mCAAmC;AAC1E;;AAeA;;AAEA;;AAEA","ignoreList":[]}
@@ -14,6 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- export const USER_AGENT = `osdk-client/${"2.45.0"}`;
18
- export const OBSERVABLE_USER_AGENT = `osdk-observable-client/${"2.45.0"}`;
17
+ export const USER_AGENT = `osdk-client/${"2.46.0-main-647d7432d14da0433845faf701ee682e3ebd845b"}`;
18
+ export const OBSERVABLE_USER_AGENT = `osdk-observable-client/${"2.46.0-main-647d7432d14da0433845faf701ee682e3ebd845b"}`;
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,yBAA4C;AAC9E,OAAO,MAAMC,qBAA6B,GAAG,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 = `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 chunkFEMJRUQG_cjs = require('./chunk-FEMJRUQG.cjs');
4
- var chunkEFTQRJ62_cjs = require('./chunk-EFTQRJ62.cjs');
3
+ var chunk4O6723FC_cjs = require('./chunk-4O6723FC.cjs');
4
+ var chunkNAA6LK6A_cjs = require('./chunk-NAA6LK6A.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(chunkEFTQRJ62_cjs.addUserAgentAndRequestContextHeaders(chunkEFTQRJ62_cjs.augmentRequestContext(client, (_) => ({
21
+ const response = await streamingExecute(chunkNAA6LK6A_cjs.addUserAgentAndRequestContextHeaders(chunkNAA6LK6A_cjs.augmentRequestContext(client, (_) => ({
22
22
  finalMethodCall: "applyStreamingQuery"
23
23
  })), query), query.apiName, {
24
24
  ontology: await client.ontologyRid,
25
- parameters: params ? await chunkFEMJRUQG_cjs.remapQueryParams(params, client, qd.parameters) : {},
25
+ parameters: params ? await chunk4O6723FC_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 chunkFEMJRUQG_cjs.getRequiredDefinitions(qd.output, client);
35
+ const definitions = await chunk4O6723FC_cjs.getRequiredDefinitions(qd.output, client);
36
36
  const reader = response.body.getReader();
37
- for await (const line of chunkFEMJRUQG_cjs.parseNdjsonStream(chunkFEMJRUQG_cjs.iterateReadableStream(reader))) {
37
+ for await (const line of chunk4O6723FC_cjs.parseNdjsonStream(chunk4O6723FC_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 chunkFEMJRUQG_cjs.remapQueryResponse(client, qd.output, line.value, definitions);
43
+ const remapped = await chunk4O6723FC_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-PSSC2YOQ.cjs.map
56
- //# sourceMappingURL=applyStreamingQuery-PSSC2YOQ.cjs.map
55
+ //# sourceMappingURL=applyStreamingQuery-TWNEY45A.cjs.map
56
+ //# sourceMappingURL=applyStreamingQuery-TWNEY45A.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,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A,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-PSSC2YOQ.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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,MAAA,MAAA,CAAO,MAAA,CAAO,KAAK,IAAI,CAAA;AACvB,MAAA,MAAM,GAAA;AAAA,IACR;AACA,IAAA,MAAM,QAAA,GAAW,MAAMC,oCAAA,CAAmB,MAAA,EAAQ,GAAG,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-TWNEY45A.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,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkEFTQRJ62_cjs = require('./chunk-EFTQRJ62.cjs');
3
+ var chunkNAA6LK6A_cjs = require('./chunk-NAA6LK6A.cjs');
4
4
  var chunkROJIXXGF_cjs = require('./chunk-ROJIXXGF.cjs');
5
5
  var chunkH6PXPU6F_cjs = require('./chunk-H6PXPU6F.cjs');
6
6
  var invariant = require('tiny-invariant');
@@ -184,13 +184,13 @@ async function toDataValueQueries(value, client, desiredType) {
184
184
  switch (desiredType.type) {
185
185
  case "attachment": {
186
186
  if (isAttachmentUpload(value)) {
187
- const attachment = await chunkEFTQRJ62_cjs.upload(client, value.data, {
187
+ const attachment = await chunkNAA6LK6A_cjs.upload(client, value.data, {
188
188
  filename: value.name
189
189
  });
190
190
  return attachment.rid;
191
191
  }
192
192
  if (isAttachmentFile(value)) {
193
- const attachment = await chunkEFTQRJ62_cjs.upload(client, value, {
193
+ const attachment = await chunkNAA6LK6A_cjs.upload(client, value, {
194
194
  filename: value.name
195
195
  });
196
196
  return attachment.rid;
@@ -246,11 +246,11 @@ async function toDataValueQueries(value, client, desiredType) {
246
246
  }
247
247
  case "objectSet":
248
248
  case "interfaceObjectSet": {
249
- if (chunkEFTQRJ62_cjs.isWireObjectSet(value)) {
249
+ if (chunkNAA6LK6A_cjs.isWireObjectSet(value)) {
250
250
  return value;
251
251
  }
252
- if (chunkEFTQRJ62_cjs.isObjectSet(value)) {
253
- return chunkEFTQRJ62_cjs.getWireObjectSet(value);
252
+ if (chunkNAA6LK6A_cjs.isObjectSet(value)) {
253
+ return chunkNAA6LK6A_cjs.getWireObjectSet(value);
254
254
  }
255
255
  break;
256
256
  }
@@ -295,7 +295,7 @@ async function applyQuery(client, query, params) {
295
295
  if (client.flushEdits != null) {
296
296
  await client.flushEdits();
297
297
  }
298
- const response = await execute(chunkEFTQRJ62_cjs.addUserAgentAndRequestContextHeaders(chunkEFTQRJ62_cjs.augmentRequestContext(client, (_) => ({
298
+ const response = await execute(chunkNAA6LK6A_cjs.addUserAgentAndRequestContextHeaders(chunkNAA6LK6A_cjs.augmentRequestContext(client, (_) => ({
299
299
  finalMethodCall: "applyQuery"
300
300
  })), query), await client.ontologyRid, query.apiName, {
301
301
  parameters: params ? await remapQueryParams(params, client, (await qd).parameters) : {}
@@ -341,10 +341,10 @@ async function remapQueryResponse(client, responseDataType, responseValue, defin
341
341
  return responseValue;
342
342
  }
343
343
  case "attachment": {
344
- return chunkEFTQRJ62_cjs.hydrateAttachmentFromRidInternal(client, responseValue);
344
+ return chunkNAA6LK6A_cjs.hydrateAttachmentFromRidInternal(client, responseValue);
345
345
  }
346
346
  case "mediaReference": {
347
- return chunkEFTQRJ62_cjs.createMediaFromReferenceInternal(client, responseValue);
347
+ return chunkNAA6LK6A_cjs.createMediaFromReferenceInternal(client, responseValue);
348
348
  }
349
349
  case "object": {
350
350
  const def = definitions.get(responseDataType.object);
@@ -366,7 +366,7 @@ async function remapQueryResponse(client, responseDataType, responseValue, defin
366
366
  throw new Error(`Missing definition for ${responseDataType.objectSet}`);
367
367
  }
368
368
  if (typeof responseValue === "string") {
369
- return chunkEFTQRJ62_cjs.createObjectSet(def, client, {
369
+ return chunkNAA6LK6A_cjs.createObjectSet(def, client, {
370
370
  type: "intersect",
371
371
  objectSets: [{
372
372
  type: "base",
@@ -377,7 +377,7 @@ async function remapQueryResponse(client, responseDataType, responseValue, defin
377
377
  }]
378
378
  });
379
379
  }
380
- return chunkEFTQRJ62_cjs.createObjectSet(def, client, responseValue);
380
+ return chunkNAA6LK6A_cjs.createObjectSet(def, client, responseValue);
381
381
  }
382
382
  case "struct": {
383
383
  for (const [key, subtype] of Object.entries(responseDataType.struct)) {
@@ -562,5 +562,5 @@ exports.parseNdjsonStream = parseNdjsonStream;
562
562
  exports.parseStreamedResponse = parseStreamedResponse;
563
563
  exports.remapQueryParams = remapQueryParams;
564
564
  exports.remapQueryResponse = remapQueryResponse;
565
- //# sourceMappingURL=chunk-FEMJRUQG.cjs.map
566
- //# sourceMappingURL=chunk-FEMJRUQG.cjs.map
565
+ //# sourceMappingURL=chunk-4O6723FC.cjs.map
566
+ //# sourceMappingURL=chunk-4O6723FC.cjs.map