@osdk/client 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/build/js/{chunk-LK4VDWCG.cjs → chunk-CKYBATFN.cjs} +253 -108
  2. package/build/js/chunk-CKYBATFN.cjs.map +1 -0
  3. package/build/js/{chunk-GOBQUVQZ.mjs → chunk-SNGUDELK.mjs} +250 -109
  4. package/build/js/chunk-SNGUDELK.mjs.map +1 -0
  5. package/build/js/index.cjs +82 -33
  6. package/build/js/index.cjs.map +1 -1
  7. package/build/js/index.mjs +78 -30
  8. package/build/js/index.mjs.map +1 -1
  9. package/build/js/public/objects.cjs +3 -3
  10. package/build/js/public/objects.mjs +1 -1
  11. package/build/types/Client.d.ts +4 -4
  12. package/build/types/Definitions.d.ts +4 -5
  13. package/build/types/ObjectSetCreator.d.ts +2 -2
  14. package/build/types/OsdkObjectFrom.d.ts +17 -4
  15. package/build/types/actions/Actions.d.ts +5 -8
  16. package/build/types/createClient.d.ts +1 -1
  17. package/build/types/createMinimalClient.d.ts +1 -1
  18. package/build/types/definitions/LinkDefinitions.d.ts +2 -2
  19. package/build/types/generatedNoCheck/Ontology.d.ts +10 -7
  20. package/build/types/generatedNoCheck/ontology/actions/actionTakesAttachment.d.ts +2 -2
  21. package/build/types/generatedNoCheck/ontology/actions/actionTakesObjectSet.d.ts +2 -2
  22. package/build/types/generatedNoCheck/ontology/actions/createOffice.d.ts +12 -12
  23. package/build/types/generatedNoCheck/ontology/actions/createOfficeAndEmployee.d.ts +17 -17
  24. package/build/types/generatedNoCheck/ontology/actions/moveOffice.d.ts +12 -12
  25. package/build/types/generatedNoCheck/ontology/actions/promoteEmployee.d.ts +6 -6
  26. package/build/types/generatedNoCheck/ontology/actions/promoteEmployeeObject.d.ts +6 -6
  27. package/build/types/generatedNoCheck/ontology/interfaces/FooInterface.d.ts +8 -0
  28. package/build/types/generatedNoCheck/ontology/interfaces.d.ts +1 -1
  29. package/build/types/generatedNoCheck/ontology/objects/Employee.d.ts +11 -4
  30. package/build/types/generatedNoCheck/ontology/objects/ObjectWithTimestampPrimaryKey.d.ts +4 -1
  31. package/build/types/generatedNoCheck/ontology/objects/Office.d.ts +7 -4
  32. package/build/types/generatedNoCheck/ontology/objects/equipment.d.ts +4 -1
  33. package/build/types/generatedNoCheck/ontology/objects/objectTypeWithAllPropertyTypes.d.ts +24 -21
  34. package/build/types/index.d.ts +1 -1
  35. package/build/types/mapping/DataValueMapping.d.ts +39 -0
  36. package/build/types/mapping/PropertyValueMapping.d.ts +47 -0
  37. package/build/types/object/Cache.d.ts +9 -2
  38. package/build/types/object/Cache.test.d.ts +10 -0
  39. package/build/types/object/aggregate.d.ts +4 -2
  40. package/build/types/object/convertWireToOsdkObjects.d.ts +17 -2
  41. package/build/types/object/fetchPage.d.ts +12 -3
  42. package/build/types/objectSet/ObjectSet.d.ts +13 -11
  43. package/build/types/objectSet/createObjectSet.d.ts +4 -2
  44. package/build/types/ontology/OntologyProvider.d.ts +12 -4
  45. package/build/types/ontology/{providers/StandardOntologyProvider.d.ts → StandardOntologyProvider.d.ts} +2 -1
  46. package/build/types/ontology/StandardOntologyProvider.test.d.ts +1 -0
  47. package/build/types/ontology/loadInterfaceDefinition.d.ts +3 -0
  48. package/build/types/query/WhereClause.d.ts +4 -3
  49. package/build/types/query/aggregations/AggregationsClause.d.ts +2 -2
  50. package/build/types/query/aggregations/AggregationsResults.d.ts +1 -1
  51. package/changelog/0.13.0/pr-101.v2.yml +5 -0
  52. package/changelog/0.13.0/pr-102.v2.yml +5 -0
  53. package/changelog/0.13.0/pr-104.v2.yml +5 -0
  54. package/changelog/0.13.0/pr-106.v2.yml +5 -0
  55. package/changelog/0.13.0/pr-107.v2.yml +5 -0
  56. package/changelog/0.13.0/pr-110.v2.yml +5 -0
  57. package/changelog/0.13.0/pr-111.v2.yml +5 -0
  58. package/changelog/0.13.0/pr-112.v2.yml +5 -0
  59. package/changelog/0.13.0/pr-116.v2.yml +5 -0
  60. package/changelog/0.13.0/pr-117.v2.yml +5 -0
  61. package/changelog/0.13.0/pr-120.v2.yml +5 -0
  62. package/changelog/0.13.0/pr-125.v2.yml +5 -0
  63. package/package.json +10 -7
  64. package/build/js/chunk-GOBQUVQZ.mjs.map +0 -1
  65. package/build/js/chunk-LK4VDWCG.cjs.map +0 -1
  66. /package/build/types/{ontology/providers/StandardOntologyProvider.test.d.ts → OsdkObjectFrom.test.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/actions/applyAction.ts","../../src/util/isOntologyObjectV2.ts","../../src/util/WireObjectSet.ts","../../src/util/toDataValue.ts","../../src/actions/ActionValidationError.ts","../../src/actions/createActionInvoker.ts","../../src/createMinimalClient.ts","../../src/ontology/providers/StandardOntologyProvider.ts","../../src/ontology/loadFullObjectMetadata.ts","../../src/util/UserAgent.ts","../../src/ObjectSetCreator.ts","../../src/createClient.ts","../../src/index.ts"],"names":["createOpenApiRequest","client","createClientContext"],"mappings":";;;;;;;;;AAgBA,SAAS,qBAAqB;AAC9B,SAAS,4BAA4B;;;ACD9B,SAAS,mBAAmB,GAAG;AACpC,SAAO,KAAK,OAAO,MAAM,YAAY,OAAO,EAAE,cAAc,YAAY,EAAE,gBAAgB;AAC5F;;;ACFA,IAAM,wBAAwB,oBAAI,IAAI,CAAC,QAAQ,UAAU,aAAa,aAAa,gBAAgB,UAAU,YAAY,OAAO,CAAC;AAC1H,SAAS,gBAAgB,GAAG;AACjC,SAAO,KAAK,QAAQ,OAAO,MAAM,YAAY,sBAAsB,IAAI,EAAE,IAAI;AAC/E;;;ACMO,SAAS,YAAY,OAAO;AACjC,MAAI,SAAS,MAAM;AAEjB,WAAO;AAAA,EACT;AAGA,MAAI,MAAM,QAAQ,KAAK,KAAK,iBAAiB,KAAK;AAChD,WAAO,MAAM,KAAK,OAAO,WAAW;AAAA,EACtC;AAGA,MAAI,aAAa,KAAK,GAAG;AACvB,WAAO,MAAM;AAAA,E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AG,UAAU,OAAO;AACzG,QAAM,CAAC,WAAW,QAAQ,IAAI,uBAAuB,SAAS,UAAU,OAAO,eAAe,wBAAwB,OAAO;AAC7H,QAAM,mBAAmB,UAAQ,oBAAoB,SAAS,SAAS,EAAE,IAAI,KAAK,SAAS,YAAY,IAAI,IAAI,GAAG,SAAS;AAC3H,QAAM,mBAAmB,uBAAuB,WAAW,QAAQ;AACnE,QAAM,SAAS,OAAO,iBAAiB,UAAU;AAAA,IAC/C,WAAW;AAAA,MACT,KAAK,MAAM;AAAA,IACb;AAAA,IACA,SAAS;AAAA,MACP,KAAK,MAAM,uBAAuB,QAAQ,QAAQ;AAAA,IACpD;AAAA,IACA,SAAS;AAAA,MACP,KAAK,MAAM;AAAA,IACb;AAAA,IACA,iCAAiC;AAAA,MAC/B,KAAK,MAAM,CAAC,YAAY,QAAQ;AAC9B,eAAO,gBAAgB,SAAS,YAAY,IAAI,UAAU,KAAK,SAAS,SAAS,EAAE,UAAU,GAAG,WAAW;AAAA,UACzG,MAAM;AAAA,UACN,YAAY,CAAC;AAAA,YACX,MAAM;AAAA,YACN;AAAA,UACF,GAAG;AAAA,YACD,MAAM;AAAA,YACN,WAAW;AAAA,UACb,CAAC;AAAA,QACH,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF,CAAC;AACD,SAAO;AACT;;;ACtDA,SAAS,uBAAAC,4BAA2B;AACpC,SAAS,YAAY","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 { applyActionV2 } from \"@osdk/gateway/requests\";\nimport { createOpenApiRequest } from \"@osdk/shared.net\";\nimport { toDataValue } from \"../util/toDataValue.js\";\nimport { ActionValidationError } from \"./ActionValidationError.js\";\n\n// cannot specify both validateOnly and returnEdits as true\n\nexport async function applyAction(client, action, parameters, options = {}) {\n const response = await applyActionV2(createOpenApiRequest(client.stack, client.fetch), client.ontology.metadata.ontologyApiName, action.apiName, {\n parameters: remapActionParams(parameters),\n options: {\n mode: options?.validateOnly ? \"VALIDATE_ONLY\" : \"VALIDATE_AND_EXECUTE\",\n returnEdits: options?.returnEdits ? \"ALL\" : \"NONE\"\n }\n });\n if (options?.validateOnly) {\n return response.validation;\n }\n if (response.validation?.result === \"INVALID\") {\n throw new ActionValidationError(response.validation);\n }\n return options?.returnEdits ? response.edits : undefined;\n}\nfunction remapActionParams(params) {\n if (params == null) {\n return {};\n }\n const parameterMap = {};\n const remappedParams = Object.entries(params).reduce((acc, [key, value]) => {\n acc[key] = toDataValue(value);\n return acc;\n }, parameterMap);\n return remappedParams;\n}","/*\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 function isOntologyObjectV2(o) {\n return o && typeof o === \"object\" && typeof o.__apiName === \"string\" && o.__primaryKey != null;\n}","/*\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\nconst WIRE_OBJECT_SET_TYPES = new Set([\"base\", \"filter\", \"intersect\", \"reference\", \"searchAround\", \"static\", \"subtract\", \"union\"]);\nexport function isWireObjectSet(o) {\n return o != null && typeof o === \"object\" && WIRE_OBJECT_SET_TYPES.has(o.type);\n}","/*\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 { isAttachment } from \"../object/Attachment.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 */\nexport function toDataValue(value) {\n if (value == null) {\n // typeof null is 'object' so do this first\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 return Array.from(value, toDataValue);\n }\n\n // attachments just send the rid directly\n if (isAttachment(value)) {\n return value.rid;\n }\n\n // objects just send the JSON'd primaryKey\n if (isOntologyObjectV2(value)) {\n return toDataValue(value.__primaryKey);\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 value.definition;\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((acc, [key, structValue]) => {\n acc[key] = toDataValue(structValue);\n return acc;\n }, {});\n }\n\n // expected to pass through - boolean, byte, date, decimal, float, double, integer, long, short, string, timestamp\n return value;\n}\nfunction isObjectSet(o) {\n return o != null && typeof o === \"object\" && isWireObjectSet(o.definition);\n}","/*\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 class ActionValidationError extends Error {\n constructor(validation) {\n super(\"Validation Error\");\n this.validation = validation;\n }\n}","/*\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 { applyAction } from \"./applyAction.js\";\nexport function createActionInvoker(client, action) {\n return function (...args) {\n return applyAction(client, action, ...args);\n };\n}\nexport function createOldActionInvoker(client, ontology) {\n const proxy = new Proxy({}, {\n get: (_target, p, _receiver) => {\n if (typeof p === \"string\") {\n return createActionInvoker(client, ontology.actions[p]);\n }\n return undefined;\n },\n ownKeys(_target) {\n return Object.keys(ontology.actions);\n },\n getOwnPropertyDescriptor(_target, p) {\n if (typeof p === \"string\") {\n return {\n enumerable: ontology.actions[p] != null,\n configurable: true,\n value: proxy[p]\n };\n }\n }\n });\n return proxy;\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 { createClientContext } from \"@osdk/shared.net\";\nimport { createStandardOntologyProviderFactory } from \"./ontology/providers/StandardOntologyProvider.js\";\nimport { USER_AGENT } from \"./util/UserAgent.js\";\nexport function createMinimalClient(metadata, stack, tokenProvider, ontologyCachingOptions = {}, fetchFn = global.fetch) {\n const clientCtx = createClientContext({\n metadata,\n provider: undefined\n }, stack, tokenProvider, USER_AGENT, fetchFn);\n clientCtx.ontology.provider = createStandardOntologyProviderFactory(ontologyCachingOptions)(clientCtx);\n return clientCtx;\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 deepEqual from \"fast-deep-equal\";\nimport { createAsyncCache } from \"../../object/Cache.js\";\nimport { loadFullObjectMetadata } from \"../loadFullObjectMetadata.js\";\nconst alwaysRevalidateDefault = false;\nexport const createStandardOntologyProviderFactory = client => {\n const alwaysRevalidate = client.alwaysRevalidate ?? alwaysRevalidateDefault;\n return client => {\n const objectCache = createAsyncCache(loadFullObjectMetadata);\n return {\n getObjectOrInterfaceDefinition: async apiName => {\n const n = alwaysRevalidate ? await loadFullObjectMetadata(client, apiName) : await objectCache.get(client, apiName);\n if (alwaysRevalidate) {\n const og = objectCache.getOrUndefined(client, apiName);\n if (deepEqual(og, n)) {\n return og; // ! because we can be sure `n` would throw if it were undefined\n } else {\n return objectCache.set(client, apiName, n);\n }\n }\n return n;\n },\n maybeSeed(definition) {\n // not using this for now\n }\n };\n };\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 { getObjectTypeV2, listOutgoingLinkTypesV2 } from \"@osdk/gateway/requests\";\nimport { wireObjectTypeFullMetadataToSdkObjectTypeDefinition } from \"@osdk/generator-converters\";\nimport { createOpenApiRequest } from \"@osdk/shared.net\";\nasync function loadAllOutgoingLinkTypes(client, objtype) {\n const linkTypes = [];\n let pageToken;\n do {\n const result = await listOutgoingLinkTypesV2(createOpenApiRequest(client.stack, client.fetch), client.ontology.metadata.ontologyApiName, objtype, {\n pageToken\n });\n pageToken = result.nextPageToken;\n linkTypes.push(...result.data);\n } while (pageToken != null);\n return linkTypes;\n}\nexport async function loadFullObjectMetadata(client, objtype) {\n const {\n ontologyApiName\n } = client.ontology.metadata;\n const [objectType, linkTypes] = await Promise.all([getObjectTypeV2(createOpenApiRequest(client.stack, client.fetch), ontologyApiName, objtype), loadAllOutgoingLinkTypes(client, objtype)]);\n const full = {\n implementsInterfaces: [],\n // FIXME\n linkTypes,\n objectType,\n sharedPropertyTypeMapping: {} // FIXME\n };\n return wireObjectTypeFullMetadataToSdkObjectTypeDefinition(full, true);\n}","/*\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 = `osdk-client/${process.env.PACKAGE_VERSION}`;","/*\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\n/**\n * A type that creates an object set for each object in the ontology.\n */\n\n/**\n * Create a proxy for the object set creator.\n *\n * @deprecated will be removed when we complete switch to full client(Type) syntax\n *\n * @param client The client to use to create the object sets.\n * @returns A proxy for the object set creator.\n */\nexport function createObjectSetCreator(client, ontology) {\n return new Proxy({}, {\n get: (target, p, receiver) => {\n if (typeof p === \"string\") {\n return client(ontology.objects[p] ?? ontology.interfaces?.[p]);\n }\n return undefined;\n },\n ownKeys(target) {\n return Object.keys(ontology.objects);\n },\n getOwnPropertyDescriptor(target, p) {\n if (typeof p === \"string\") {\n return {\n enumerable: ontology.objects[p] != null,\n configurable: true,\n get: () => client(ontology.objects[p] ?? ontology.interfaces?.[p])\n };\n }\n }\n });\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 { createActionInvoker, createOldActionInvoker } from \"./actions/createActionInvoker.js\";\nimport { createMinimalClient } from \"./createMinimalClient.js\";\nimport { createBaseObjectSet, createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport { createObjectSetCreator } from \"./ObjectSetCreator.js\";\nfunction createFutureClientPlus(metadata, stack, tokenProvider, ontologyCachingOptions = {}, fetchFn = fetch) {\n const clientCtx = createMinimalClient(metadata, stack, tokenProvider, ontologyCachingOptions, fetchFn);\n function clientFn(o) {\n if (o.type === \"object\" || o.type === \"interface\") {\n clientCtx.ontology.provider.maybeSeed(o);\n return createBaseObjectSet(o, clientCtx);\n } else if (o.type === \"action\") {\n clientCtx.ontology.provider.maybeSeed(o);\n return createActionInvoker(clientCtx, o);\n } else {\n throw new Error(\"Unknown definition: \" + JSON.stringify(o));\n }\n }\n return [clientCtx, clientFn];\n}\n\n// Once we migrate everyone off of using the deprecated parts of `Client` we can rename this to `createClient`.\n// For now, its a way to use JUST the new client\nexport function createFutureClient(metadata, stack, tokenProvider, ontologyCachingOptions = {}, fetchFn = fetch) {\n // When `createFutureClient` gets renamed to `createClient`, we\n // should inline this call as its no longer needed to be separate.\n return createFutureClientPlus(metadata, stack, tokenProvider, ontologyCachingOptions, fetchFn)[1];\n}\nexport function createClient(ontology, stack, tokenProvider, ontologyCachingOptions = {}, fetchFn = fetch) {\n const [clientCtx, clientFn] = createFutureClientPlus(ontology.metadata, stack, tokenProvider, ontologyCachingOptions, fetchFn);\n const objectSetFactory = type => createBaseObjectSet(ontology[\"objects\"][type] ?? ontology[\"interfaces\"]?.[type], clientCtx);\n const oldActionInvoker = createOldActionInvoker(clientCtx, ontology);\n const client = Object.defineProperties(clientFn, {\n objectSet: {\n get: () => objectSetFactory\n },\n objects: {\n get: () => createObjectSetCreator(client, ontology)\n },\n actions: {\n get: () => oldActionInvoker\n },\n __UNSTABLE_preexistingObjectSet: {\n get: () => (objectType, rid) => {\n return createObjectSet(ontology[\"interfaces\"]?.[objectType] ?? ontology[\"objects\"][objectType], clientCtx, {\n type: \"intersect\",\n objectSets: [{\n type: \"base\",\n objectType: objectType\n }, {\n type: \"reference\",\n reference: rid\n }]\n });\n }\n }\n });\n return client;\n}","/*\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 { createClient } from \"./createClient.js\";\n// FIXME: Should this be Objects or Object?\nexport * as Objects from \"./object/index.js\";\nexport { createClientContext } from \"@osdk/shared.net\";\nexport { isOk } from \"@osdk/shared.net\";\nexport { ActionValidationError } from \"./actions/ActionValidationError.js\";\nexport { createMinimalClient } from \"./createMinimalClient.js\";"]}
1
+ {"version":3,"sources":["../../src/actions/applyAction.ts","../../src/util/isOntologyObjectV2.ts","../../src/util/toDataValue.ts","../../src/actions/ActionValidationError.ts","../../src/actions/createActionInvoker.ts","../../src/createMinimalClient.ts","../../src/ontology/StandardOntologyProvider.ts","../../src/ontology/loadFullObjectMetadata.ts","../../src/ontology/loadInterfaceDefinition.ts","../../src/util/UserAgent.ts","../../src/ObjectSetCreator.ts","../../src/createClient.ts","../../src/index.ts"],"names":["listInterfaceTypes","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","wireObjectTypeFullMetadataToSdkObjectTypeDefinition","createOpenApiRequest","client","createClientContext"],"mappings":";;;;;;;;;;;;;AAgBA,SAAS,qBAAqB;AAC9B,SAAS,4BAA4B;;;ACD9B,SAAS,mBAAmB,GAAG;AACpC,SAAO,KAAK,OAAO,MAAM,YAAY,OAAO,EAAE,cAAc,YAAY,EAAE,gBAAgB;AAC5F;;;ACQO,SA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;AAAA,YACN,WAAW;AAAA,UACb,CAAC;AAAA,QACH,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF,CAAC;AACD,SAAO;AACT;;;ACtDA,SAAS,uBAAAC,4BAA2B;AACpC,SAAS,YAAY","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 { applyActionV2 } from \"@osdk/gateway/requests\";\nimport { createOpenApiRequest } from \"@osdk/shared.net\";\nimport { toDataValue } from \"../util/toDataValue.js\";\nimport { ActionValidationError } from \"./ActionValidationError.js\";\n\n// cannot specify both validateOnly and returnEdits as true\n\nexport async function applyAction(client, action, parameters, options = {}) {\n const response = await applyActionV2(createOpenApiRequest(client.stack, client.fetch), client.ontology.metadata.ontologyApiName, action.apiName, {\n parameters: remapActionParams(parameters),\n options: {\n mode: options?.validateOnly ? \"VALIDATE_ONLY\" : \"VALIDATE_AND_EXECUTE\",\n returnEdits: options?.returnEdits ? \"ALL\" : \"NONE\"\n }\n });\n if (options?.validateOnly) {\n return response.validation;\n }\n if (response.validation?.result === \"INVALID\") {\n throw new ActionValidationError(response.validation);\n }\n return options?.returnEdits ? response.edits : undefined;\n}\nfunction remapActionParams(params) {\n if (params == null) {\n return {};\n }\n const parameterMap = {};\n const remappedParams = Object.entries(params).reduce((acc, [key, value]) => {\n acc[key] = toDataValue(value);\n return acc;\n }, parameterMap);\n return remappedParams;\n}","/*\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 function isOntologyObjectV2(o) {\n return o && typeof o === \"object\" && typeof o.__apiName === \"string\" && o.__primaryKey != null;\n}","/*\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 { isAttachment } from \"../object/Attachment.js\";\nimport { getWireObjectSet, isObjectSet } from \"../objectSet/createObjectSet.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 */\nexport function toDataValue(value) {\n if (value == null) {\n // typeof null is 'object' so do this first\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 return Array.from(value, toDataValue);\n }\n\n // attachments just send the rid directly\n if (isAttachment(value)) {\n return value.rid;\n }\n\n // objects just send the JSON'd primaryKey\n if (isOntologyObjectV2(value)) {\n return toDataValue(value.__primaryKey);\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 // 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((acc, [key, structValue]) => {\n acc[key] = toDataValue(structValue);\n return acc;\n }, {});\n }\n\n // expected to pass through - boolean, byte, date, decimal, float, double, integer, long, short, string, timestamp\n return value;\n}","/*\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 class ActionValidationError extends Error {\n constructor(validation) {\n super(\"Validation Error\");\n this.validation = validation;\n }\n}","/*\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 { applyAction } from \"./applyAction.js\";\nexport function createActionInvoker(client, action) {\n return function (...args) {\n return applyAction(client, action, ...args);\n };\n}\nexport function createOldActionInvoker(client, ontology) {\n const proxy = new Proxy({}, {\n get: (_target, p, _receiver) => {\n if (typeof p === \"string\") {\n return createActionInvoker(client, ontology.actions[p]);\n }\n return undefined;\n },\n ownKeys(_target) {\n return Object.keys(ontology.actions);\n },\n getOwnPropertyDescriptor(_target, p) {\n if (typeof p === \"string\") {\n return {\n enumerable: ontology.actions[p] != null,\n configurable: true,\n value: proxy[p]\n };\n }\n }\n });\n return proxy;\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 { createClientContext } from \"@osdk/shared.net\";\nimport { createStandardOntologyProviderFactory } from \"./ontology/StandardOntologyProvider.js\";\nimport { USER_AGENT } from \"./util/UserAgent.js\";\nexport function createMinimalClient(metadata, stack, tokenProvider, ontologyCachingOptions = {}, fetchFn = global.fetch) {\n const clientCtx = createClientContext({\n metadata,\n provider: undefined\n }, stack, tokenProvider, USER_AGENT, fetchFn);\n clientCtx.ontology.provider = createStandardOntologyProviderFactory(ontologyCachingOptions)(clientCtx);\n return clientCtx;\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 { getOntologyFullMetadata, listInterfaceTypes } from \"@osdk/gateway/requests\";\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition, wireObjectTypeFullMetadataToSdkObjectTypeDefinition } from \"@osdk/generator-converters\";\nimport { createOpenApiRequest } from \"@osdk/shared.net\";\nimport deepEqual from \"fast-deep-equal\";\nimport { createAsyncCache } from \"../object/Cache.js\";\nimport { loadFullObjectMetadata } from \"./loadFullObjectMetadata.js\";\nimport { loadInterfaceDefinition } from \"./loadInterfaceDefinition.js\";\nconst alwaysRevalidateDefault = false;\n\n// SLLLLLLOOOOOOOWWWW\nasync function fullOntologyLoad(client) {\n return await Promise.all([listInterfaceTypes(createOpenApiRequest(client.stack, client.fetch), client.ontology.metadata.ontologyApiName, {\n pageSize: 200,\n preview: true\n }), getOntologyFullMetadata(createOpenApiRequest(client.stack, client.fetch), client.ontology.metadata.ontologyApiName)]);\n}\nexport const USE_FULL_ONTOLOGY = false;\nexport const createStandardOntologyProviderFactory = client => {\n const alwaysRevalidate = client.alwaysRevalidate ?? alwaysRevalidateDefault;\n return client => {\n let fullCache;\n async function initLocalCache(client, skipCache) {\n if (skipCache) {\n return await fullOntologyLoad(client);\n }\n if (!fullCache) {\n fullCache = fullOntologyLoad(client);\n }\n return await fullCache;\n }\n async function loadObject(client, key, skipCache = false) {\n if (USE_FULL_ONTOLOGY) {\n const fullCacheLocal = await initLocalCache(client, skipCache);\n return {\n ...wireObjectTypeFullMetadataToSdkObjectTypeDefinition(fullCacheLocal[1].objectTypes[key], true),\n implements: fullCacheLocal[0].data.map(i => i.apiName)\n };\n } else {\n return await loadFullObjectMetadata(client, key);\n }\n }\n async function loadInterface(client, key, skipCache = false) {\n if (USE_FULL_ONTOLOGY) {\n const fullCacheLocal = await initLocalCache(client, skipCache);\n return __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(fullCacheLocal[1].interfaceTypes[key], true);\n } else {\n return loadInterfaceDefinition(client, key);\n }\n }\n function makeGetter(fn) {\n const cache = createAsyncCache((client, key) => fn(client, key, false));\n return async apiName => {\n const n = alwaysRevalidate ? await fn(client, apiName, true) : await cache.get(client, apiName);\n if (alwaysRevalidate) {\n const og = cache.getOrUndefined(client, apiName);\n if (deepEqual(og, n)) {\n return og; // ! because we can be sure `n` would throw if it were undefined\n } else {\n return cache.set(client, apiName, n);\n }\n }\n return n;\n };\n }\n return {\n getObjectDefinition: makeGetter(loadObject),\n getInterfaceDefinition: makeGetter(loadInterface),\n maybeSeed(definition) {\n // not using this for now\n }\n };\n };\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 { getObjectTypeV2, listInterfaceTypes, listOutgoingLinkTypesV2 } from \"@osdk/gateway/requests\";\nimport { wireObjectTypeFullMetadataToSdkObjectTypeDefinition } from \"@osdk/generator-converters\";\nimport { createOpenApiRequest } from \"@osdk/shared.net\";\nimport invariant from \"tiny-invariant\";\nimport { loadAllOntologies } from \"../generated/ontology-metadata/api/OntologyMetadataService/loadAllOntologies.js\";\nimport { loadOntologyEntities } from \"../generated/ontology-metadata/api/OntologyMetadataService/loadOntologyEntities.js\";\nasync function loadAllOutgoingLinkTypes(client, objtype) {\n const linkTypes = [];\n let pageToken;\n do {\n const result = await listOutgoingLinkTypesV2(createOpenApiRequest(client.stack, client.fetch), client.ontology.metadata.ontologyApiName, objtype, {\n pageToken\n });\n pageToken = result.nextPageToken;\n linkTypes.push(...result.data);\n } while (pageToken != null);\n return linkTypes;\n}\nfunction makeConjureContext(client, servicePath) {\n const baseUrl = client.stack.startsWith(\"https://\") ? client.stack : `https://${client.stack}`;\n return {\n baseUrl,\n servicePath,\n fetchFn: client.fetch,\n tokenProvider: async () => await client.tokenProvider()\n };\n}\nexport async function loadFullObjectMetadata(client, objtype) {\n const {\n ontologyApiName\n } = client.ontology.metadata;\n const conjureCtx = makeConjureContext(client, \"/ontology-metadata/api\");\n const [objectType, linkTypes, interfaceTypes, metadata] = await Promise.all([getObjectTypeV2(createOpenApiRequest(client.stack, client.fetch), ontologyApiName, objtype), loadAllOutgoingLinkTypes(client, objtype), listInterfaceTypes(createOpenApiRequest(client.stack, client.fetch), ontologyApiName, {\n pageSize: 200,\n preview: true\n }), await loadAllOntologies(conjureCtx, {})]);\n const sharedPropertyTypeMapping = await loadSptMap(conjureCtx, metadata, client.ontology.metadata.ontologyRid, objectType.rid);\n const full = {\n implementsInterfaces: interfaceTypes.data.map(i => i.apiName),\n linkTypes,\n objectType,\n sharedPropertyTypeMapping\n };\n\n // TODO: reuse the loaded interface data!\n return wireObjectTypeFullMetadataToSdkObjectTypeDefinition(full, true);\n}\nasync function loadSptMap(ctx, ontologyMetadata, ontologyRid, objectRid) {\n const ontologyVersion = ontologyMetadata.ontologies[ontologyRid].currentOntologyVersion;\n const body = {\n objectTypeVersions: {\n [objectRid]: ontologyVersion\n },\n linkTypeVersions: {},\n loadRedacted: false,\n includeObjectTypesWithoutSearchableDatasources: true\n };\n const entities = await loadOntologyEntities(ctx, body);\n const objectType = entities.objectTypes[objectRid];\n !objectType ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"object type should be loaded\") : invariant(false) : void 0;\n const sptMap = {};\n for (const property of Object.values(objectType.propertyTypes)) {\n if (property.sharedPropertyTypeApiName && property.apiName) {\n sptMap[property.sharedPropertyTypeApiName] = property.apiName;\n }\n }\n return sptMap;\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 { getInterfaceType } from \"@osdk/gateway/requests\";\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from \"@osdk/generator-converters\";\nimport { createOpenApiRequest } from \"@osdk/shared.net\";\nexport async function loadInterfaceDefinition(client, objtype) {\n const {\n ontologyApiName\n } = client.ontology.metadata;\n const r = await getInterfaceType(createOpenApiRequest(client.stack, client.fetch), ontologyApiName, objtype, {\n preview: true\n });\n return __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(r, true);\n}","/*\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 = `osdk-client/${process.env.PACKAGE_VERSION}`;","/*\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\n/**\n * A type that creates an object set for each object in the ontology.\n */\n\n/**\n * Create a proxy for the object set creator.\n *\n * @deprecated will be removed when we complete switch to full client(Type) syntax\n *\n * @param client The client to use to create the object sets.\n * @returns A proxy for the object set creator.\n */\nexport function createObjectSetCreator(client, ontology) {\n return new Proxy({}, {\n get: (target, p, receiver) => {\n if (typeof p === \"string\") {\n return client(ontology.objects[p] ?? ontology.interfaces?.[p]);\n }\n return undefined;\n },\n ownKeys(target) {\n return Object.keys(ontology.objects);\n },\n getOwnPropertyDescriptor(target, p) {\n if (typeof p === \"string\") {\n return {\n enumerable: ontology.objects[p] != null,\n configurable: true,\n get: () => client(ontology.objects[p] ?? ontology.interfaces?.[p])\n };\n }\n }\n });\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 { createActionInvoker, createOldActionInvoker } from \"./actions/createActionInvoker.js\";\nimport { createMinimalClient } from \"./createMinimalClient.js\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport { createObjectSetCreator } from \"./ObjectSetCreator.js\";\nfunction createFutureClientPlus(metadata, stack, tokenProvider, ontologyCachingOptions = {}, fetchFn = fetch) {\n const clientCtx = createMinimalClient(metadata, stack, tokenProvider, ontologyCachingOptions, fetchFn);\n function clientFn(o) {\n if (o.type === \"object\" || o.type === \"interface\") {\n clientCtx.ontology.provider.maybeSeed(o);\n return createObjectSet(o, clientCtx);\n } else if (o.type === \"action\") {\n clientCtx.ontology.provider.maybeSeed(o);\n return createActionInvoker(clientCtx, o);\n } else {\n throw new Error(\"Unknown definition: \" + JSON.stringify(o));\n }\n }\n return [clientCtx, clientFn];\n}\n\n// Once we migrate everyone off of using the deprecated parts of `Client` we can rename this to `createClient`.\n// For now, its a way to use JUST the new client\nexport function createFutureClient(metadata, stack, tokenProvider, ontologyCachingOptions = {}, fetchFn = fetch) {\n // When `createFutureClient` gets renamed to `createClient`, we\n // should inline this call as its no longer needed to be separate.\n return createFutureClientPlus(metadata, stack, tokenProvider, ontologyCachingOptions, fetchFn)[1];\n}\nexport function createClient(ontology, stack, tokenProvider, ontologyCachingOptions = {}, fetchFn = fetch) {\n const [clientCtx, clientFn] = createFutureClientPlus(ontology.metadata, stack, tokenProvider, ontologyCachingOptions, fetchFn);\n const objectSetFactory = type => createObjectSet(ontology[\"objects\"][type] ?? ontology[\"interfaces\"]?.[type], clientCtx);\n const oldActionInvoker = createOldActionInvoker(clientCtx, ontology);\n const client = Object.defineProperties(clientFn, {\n objectSet: {\n get: () => objectSetFactory\n },\n objects: {\n get: () => createObjectSetCreator(client, ontology)\n },\n actions: {\n get: () => oldActionInvoker\n },\n __UNSTABLE_preexistingObjectSet: {\n get: () => (objectType, rid) => {\n return createObjectSet(ontology[\"interfaces\"]?.[objectType] ?? ontology[\"objects\"][objectType], clientCtx, {\n type: \"intersect\",\n objectSets: [{\n type: \"base\",\n objectType: objectType\n }, {\n type: \"reference\",\n reference: rid\n }]\n });\n }\n }\n });\n return client;\n}","/*\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 { createClient } from \"./createClient.js\";\n// FIXME: Should this be Objects or Object?\nexport * as Objects from \"./object/index.js\";\nexport { createClientContext } from \"@osdk/shared.net\";\nexport { isOk } from \"@osdk/shared.net\";\nexport { ActionValidationError } from \"./actions/ActionValidationError.js\";\nexport { createMinimalClient } from \"./createMinimalClient.js\";"]}
@@ -1,22 +1,17 @@
1
- import { createObjectSet, createAsyncCache, createBaseObjectSet, isAttachment } from './chunk-GOBQUVQZ.mjs';
2
- export { object_exports as Objects } from './chunk-GOBQUVQZ.mjs';
3
- import { getObjectTypeV2, applyActionV2, listOutgoingLinkTypesV2 } from '@osdk/gateway/requests';
1
+ import { createObjectSet, createAsyncCache, isAttachment, isWireObjectSet, isObjectSet, getWireObjectSet, loadAllOntologies, loadOntologyEntities } from './chunk-SNGUDELK.mjs';
2
+ export { object_exports as Objects } from './chunk-SNGUDELK.mjs';
3
+ import { applyActionV2, getObjectTypeV2, listInterfaceTypes, getInterfaceType, listOutgoingLinkTypesV2 } from '@osdk/gateway/requests';
4
4
  import { createClientContext, createOpenApiRequest } from '@osdk/shared.net';
5
5
  export { createClientContext, isOk } from '@osdk/shared.net';
6
+ import { wireObjectTypeFullMetadataToSdkObjectTypeDefinition, __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from '@osdk/generator-converters';
6
7
  import deepEqual from 'fast-deep-equal';
7
- import { wireObjectTypeFullMetadataToSdkObjectTypeDefinition } from '@osdk/generator-converters';
8
+ import invariant from 'tiny-invariant';
8
9
 
9
10
  // src/util/isOntologyObjectV2.ts
10
11
  function isOntologyObjectV2(o) {
11
12
  return o && typeof o === "object" && typeof o.__apiName === "string" && o.__primaryKey != null;
12
13
  }
13
14
 
14
- // src/util/WireObjectSet.ts
15
- var WIRE_OBJECT_SET_TYPES = /* @__PURE__ */ new Set(["base", "filter", "intersect", "reference", "searchAround", "static", "subtract", "union"]);
16
- function isWireObjectSet(o) {
17
- return o != null && typeof o === "object" && WIRE_OBJECT_SET_TYPES.has(o.type);
18
- }
19
-
20
15
  // src/util/toDataValue.ts
21
16
  function toDataValue(value) {
22
17
  if (value == null) {
@@ -35,7 +30,7 @@ function toDataValue(value) {
35
30
  return value;
36
31
  }
37
32
  if (isObjectSet(value)) {
38
- return value.definition;
33
+ return getWireObjectSet(value);
39
34
  }
40
35
  if (typeof value === "object") {
41
36
  return Object.entries(value).reduce((acc, [key, structValue]) => {
@@ -45,9 +40,6 @@ function toDataValue(value) {
45
40
  }
46
41
  return value;
47
42
  }
48
- function isObjectSet(o) {
49
- return o != null && typeof o === "object" && isWireObjectSet(o.definition);
50
- }
51
43
 
52
44
  // src/actions/ActionValidationError.ts
53
45
  var ActionValidationError = class extends Error {
@@ -127,41 +119,97 @@ async function loadAllOutgoingLinkTypes(client, objtype) {
127
119
  } while (pageToken != null);
128
120
  return linkTypes;
129
121
  }
122
+ function makeConjureContext(client, servicePath) {
123
+ const baseUrl = client.stack.startsWith("https://") ? client.stack : `https://${client.stack}`;
124
+ return {
125
+ baseUrl,
126
+ servicePath,
127
+ fetchFn: client.fetch,
128
+ tokenProvider: async () => await client.tokenProvider()
129
+ };
130
+ }
130
131
  async function loadFullObjectMetadata(client, objtype) {
131
132
  const {
132
133
  ontologyApiName
133
134
  } = client.ontology.metadata;
134
- const [objectType, linkTypes] = await Promise.all([getObjectTypeV2(createOpenApiRequest(client.stack, client.fetch), ontologyApiName, objtype), loadAllOutgoingLinkTypes(client, objtype)]);
135
+ const conjureCtx = makeConjureContext(client, "/ontology-metadata/api");
136
+ const [objectType, linkTypes, interfaceTypes, metadata] = await Promise.all([getObjectTypeV2(createOpenApiRequest(client.stack, client.fetch), ontologyApiName, objtype), loadAllOutgoingLinkTypes(client, objtype), listInterfaceTypes(createOpenApiRequest(client.stack, client.fetch), ontologyApiName, {
137
+ pageSize: 200,
138
+ preview: true
139
+ }), await loadAllOntologies(conjureCtx, {})]);
140
+ const sharedPropertyTypeMapping = await loadSptMap(conjureCtx, metadata, client.ontology.metadata.ontologyRid, objectType.rid);
135
141
  const full = {
136
- implementsInterfaces: [],
137
- // FIXME
142
+ implementsInterfaces: interfaceTypes.data.map((i) => i.apiName),
138
143
  linkTypes,
139
144
  objectType,
140
- sharedPropertyTypeMapping: {}
141
- // FIXME
145
+ sharedPropertyTypeMapping
142
146
  };
143
147
  return wireObjectTypeFullMetadataToSdkObjectTypeDefinition(full, true);
144
148
  }
149
+ async function loadSptMap(ctx, ontologyMetadata, ontologyRid, objectRid) {
150
+ const ontologyVersion = ontologyMetadata.ontologies[ontologyRid].currentOntologyVersion;
151
+ const body = {
152
+ objectTypeVersions: {
153
+ [objectRid]: ontologyVersion
154
+ },
155
+ linkTypeVersions: {},
156
+ loadRedacted: false,
157
+ includeObjectTypesWithoutSearchableDatasources: true
158
+ };
159
+ const entities = await loadOntologyEntities(ctx, body);
160
+ const objectType = entities.objectTypes[objectRid];
161
+ !objectType ? process.env.NODE_ENV !== "production" ? invariant(false, "object type should be loaded") : invariant(false) : void 0;
162
+ const sptMap = {};
163
+ for (const property of Object.values(objectType.propertyTypes)) {
164
+ if (property.sharedPropertyTypeApiName && property.apiName) {
165
+ sptMap[property.sharedPropertyTypeApiName] = property.apiName;
166
+ }
167
+ }
168
+ return sptMap;
169
+ }
170
+ async function loadInterfaceDefinition(client, objtype) {
171
+ const {
172
+ ontologyApiName
173
+ } = client.ontology.metadata;
174
+ const r = await getInterfaceType(createOpenApiRequest(client.stack, client.fetch), ontologyApiName, objtype, {
175
+ preview: true
176
+ });
177
+ return __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(r, true);
178
+ }
145
179
 
146
- // src/ontology/providers/StandardOntologyProvider.ts
180
+ // src/ontology/StandardOntologyProvider.ts
147
181
  var alwaysRevalidateDefault = false;
148
182
  var createStandardOntologyProviderFactory = (client) => {
149
183
  const alwaysRevalidate = client.alwaysRevalidate ?? alwaysRevalidateDefault;
150
184
  return (client2) => {
151
- const objectCache = createAsyncCache(loadFullObjectMetadata);
152
- return {
153
- getObjectOrInterfaceDefinition: async (apiName) => {
154
- const n = alwaysRevalidate ? await loadFullObjectMetadata(client2, apiName) : await objectCache.get(client2, apiName);
185
+ async function loadObject(client3, key, skipCache = false) {
186
+ {
187
+ return await loadFullObjectMetadata(client3, key);
188
+ }
189
+ }
190
+ async function loadInterface(client3, key, skipCache = false) {
191
+ {
192
+ return loadInterfaceDefinition(client3, key);
193
+ }
194
+ }
195
+ function makeGetter(fn) {
196
+ const cache = createAsyncCache((client3, key) => fn(client3, key, false));
197
+ return async (apiName) => {
198
+ const n = alwaysRevalidate ? await fn(client2, apiName, true) : await cache.get(client2, apiName);
155
199
  if (alwaysRevalidate) {
156
- const og = objectCache.getOrUndefined(client2, apiName);
200
+ const og = cache.getOrUndefined(client2, apiName);
157
201
  if (deepEqual(og, n)) {
158
202
  return og;
159
203
  } else {
160
- return objectCache.set(client2, apiName, n);
204
+ return cache.set(client2, apiName, n);
161
205
  }
162
206
  }
163
207
  return n;
164
- },
208
+ };
209
+ }
210
+ return {
211
+ getObjectDefinition: makeGetter(loadObject),
212
+ getInterfaceDefinition: makeGetter(loadInterface),
165
213
  maybeSeed(definition) {
166
214
  }
167
215
  };
@@ -169,7 +217,7 @@ var createStandardOntologyProviderFactory = (client) => {
169
217
  };
170
218
 
171
219
  // src/util/UserAgent.ts
172
- var USER_AGENT = `osdk-client/${"0.11.0"}`;
220
+ var USER_AGENT = `osdk-client/${"0.13.0"}`;
173
221
 
174
222
  // src/createMinimalClient.ts
175
223
  function createMinimalClient(metadata, stack, tokenProvider, ontologyCachingOptions = {}, fetchFn = global.fetch) {
@@ -211,7 +259,7 @@ function createFutureClientPlus(metadata, stack, tokenProvider, ontologyCachingO
211
259
  function clientFn(o) {
212
260
  if (o.type === "object" || o.type === "interface") {
213
261
  clientCtx.ontology.provider.maybeSeed(o);
214
- return createBaseObjectSet(o, clientCtx);
262
+ return createObjectSet(o, clientCtx);
215
263
  } else if (o.type === "action") {
216
264
  clientCtx.ontology.provider.maybeSeed(o);
217
265
  return createActionInvoker(clientCtx, o);
@@ -223,7 +271,7 @@ function createFutureClientPlus(metadata, stack, tokenProvider, ontologyCachingO
223
271
  }
224
272
  function createClient(ontology, stack, tokenProvider, ontologyCachingOptions = {}, fetchFn = fetch) {
225
273
  const [clientCtx, clientFn] = createFutureClientPlus(ontology.metadata, stack, tokenProvider, ontologyCachingOptions, fetchFn);
226
- const objectSetFactory = (type) => createBaseObjectSet(ontology["objects"][type] ?? ontology["interfaces"]?.[type], clientCtx);
274
+ const objectSetFactory = (type) => createObjectSet(ontology["objects"][type] ?? ontology["interfaces"]?.[type], clientCtx);
227
275
  const oldActionInvoker = createOldActionInvoker(clientCtx, ontology);
228
276
  const client = Object.defineProperties(clientFn, {
229
277
  objectSet: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/actions/applyAction.ts","../../src/util/isOntologyObjectV2.ts","../../src/util/WireObjectSet.ts","../../src/util/toDataValue.ts","../../src/actions/ActionValidationError.ts","../../src/actions/createActionInvoker.ts","../../src/createMinimalClient.ts","../../src/ontology/providers/StandardOntologyProvider.ts","../../src/ontology/loadFullObjectMetadata.ts","../../src/util/UserAgent.ts","../../src/ObjectSetCreator.ts","../../src/createClient.ts","../../src/index.ts"],"names":["createOpenApiRequest","client","createClientContext"],"mappings":";;;;;;;;;AAgBA,SAAS,qBAAqB;AAC9B,SAAS,4BAA4B;;;ACD9B,SAAS,mBAAmB,GAAG;AACpC,SAAO,KAAK,OAAO,MAAM,YAAY,OAAO,EAAE,cAAc,YAAY,EAAE,gBAAgB;AAC5F;;;ACFA,IAAM,wBAAwB,oBAAI,IAAI,CAAC,QAAQ,UAAU,aAAa,aAAa,gBAAgB,UAAU,YAAY,OAAO,CAAC;AAC1H,SAAS,gBAAgB,GAAG;AACjC,SAAO,KAAK,QAAQ,OAAO,MAAM,YAAY,sBAAsB,IAAI,EAAE,IAAI;AAC/E;;;ACMO,SAAS,YAAY,OAAO;AACjC,MAAI,SAAS,MAAM;AAEjB,WAAO;AAAA,EACT;AAGA,MAAI,MAAM,QAAQ,KAAK,KAAK,iBAAiB,KAAK;AAChD,WAAO,MAAM,KAAK,OAAO,WAAW;AAAA,EACtC;AAGA,MAAI,aAAa,KAAK,GAAG;AACvB,WAAO,MAAM;AAAA,EACf;AAGA,MAAI,mBAAmB,KAAK,GAAG;AAC7B,WAAO,YAAY,MAAM,YAAY;AAAA,EACvC;AAGA,MAAI,gBAAgB,KAAK,GAAG;AAC1B,WAAO;AAAA,EACT;AACA,MAAI,YAAY,KAAK,GAAG;AACtB,WAAO,MAAM;AAAA,EACf;AAOA,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO,OAAO,QAAQ,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,WAAW,MAAM;AAC/D,UAAI,GAAG,IAAI,YAAY,WAAW;AAClC,aAAO;AAAA,IACT,GAAG,CAAC,CAAC;AAAA,EACP;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QAAQ;AAAA,IACpD;AAAA,IACA,SAAS;AAAA,MACP,KAAK,MAAM;AAAA,IACb;AAAA,IACA,iCAAiC;AAAA,MAC/B,KAAK,MAAM,CAAC,YAAY,QAAQ;AAC9B,eAAO,gBAAgB,SAAS,YAAY,IAAI,UAAU,KAAK,SAAS,SAAS,EAAE,UAAU,GAAG,WAAW;AAAA,UACzG,MAAM;AAAA,UACN,YAAY,CAAC;AAAA,YACX,MAAM;AAAA,YACN;AAAA,UACF,GAAG;AAAA,YACD,MAAM;AAAA,YACN,WAAW;AAAA,UACb,CAAC;AAAA,QACH,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF,CAAC;AACD,SAAO;AACT;;;ACtDA,SAAS,uBAAAC,4BAA2B;AACpC,SAAS,YAAY","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 { applyActionV2 } from \"@osdk/gateway/requests\";\nimport { createOpenApiRequest } from \"@osdk/shared.net\";\nimport { toDataValue } from \"../util/toDataValue.js\";\nimport { ActionValidationError } from \"./ActionValidationError.js\";\n\n// cannot specify both validateOnly and returnEdits as true\n\nexport async function applyAction(client, action, parameters, options = {}) {\n const response = await applyActionV2(createOpenApiRequest(client.stack, client.fetch), client.ontology.metadata.ontologyApiName, action.apiName, {\n parameters: remapActionParams(parameters),\n options: {\n mode: options?.validateOnly ? \"VALIDATE_ONLY\" : \"VALIDATE_AND_EXECUTE\",\n returnEdits: options?.returnEdits ? \"ALL\" : \"NONE\"\n }\n });\n if (options?.validateOnly) {\n return response.validation;\n }\n if (response.validation?.result === \"INVALID\") {\n throw new ActionValidationError(response.validation);\n }\n return options?.returnEdits ? response.edits : undefined;\n}\nfunction remapActionParams(params) {\n if (params == null) {\n return {};\n }\n const parameterMap = {};\n const remappedParams = Object.entries(params).reduce((acc, [key, value]) => {\n acc[key] = toDataValue(value);\n return acc;\n }, parameterMap);\n return remappedParams;\n}","/*\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 function isOntologyObjectV2(o) {\n return o && typeof o === \"object\" && typeof o.__apiName === \"string\" && o.__primaryKey != null;\n}","/*\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\nconst WIRE_OBJECT_SET_TYPES = new Set([\"base\", \"filter\", \"intersect\", \"reference\", \"searchAround\", \"static\", \"subtract\", \"union\"]);\nexport function isWireObjectSet(o) {\n return o != null && typeof o === \"object\" && WIRE_OBJECT_SET_TYPES.has(o.type);\n}","/*\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 { isAttachment } from \"../object/Attachment.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 */\nexport function toDataValue(value) {\n if (value == null) {\n // typeof null is 'object' so do this first\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 return Array.from(value, toDataValue);\n }\n\n // attachments just send the rid directly\n if (isAttachment(value)) {\n return value.rid;\n }\n\n // objects just send the JSON'd primaryKey\n if (isOntologyObjectV2(value)) {\n return toDataValue(value.__primaryKey);\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 value.definition;\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((acc, [key, structValue]) => {\n acc[key] = toDataValue(structValue);\n return acc;\n }, {});\n }\n\n // expected to pass through - boolean, byte, date, decimal, float, double, integer, long, short, string, timestamp\n return value;\n}\nfunction isObjectSet(o) {\n return o != null && typeof o === \"object\" && isWireObjectSet(o.definition);\n}","/*\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 class ActionValidationError extends Error {\n constructor(validation) {\n super(\"Validation Error\");\n this.validation = validation;\n }\n}","/*\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 { applyAction } from \"./applyAction.js\";\nexport function createActionInvoker(client, action) {\n return function (...args) {\n return applyAction(client, action, ...args);\n };\n}\nexport function createOldActionInvoker(client, ontology) {\n const proxy = new Proxy({}, {\n get: (_target, p, _receiver) => {\n if (typeof p === \"string\") {\n return createActionInvoker(client, ontology.actions[p]);\n }\n return undefined;\n },\n ownKeys(_target) {\n return Object.keys(ontology.actions);\n },\n getOwnPropertyDescriptor(_target, p) {\n if (typeof p === \"string\") {\n return {\n enumerable: ontology.actions[p] != null,\n configurable: true,\n value: proxy[p]\n };\n }\n }\n });\n return proxy;\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 { createClientContext } from \"@osdk/shared.net\";\nimport { createStandardOntologyProviderFactory } from \"./ontology/providers/StandardOntologyProvider.js\";\nimport { USER_AGENT } from \"./util/UserAgent.js\";\nexport function createMinimalClient(metadata, stack, tokenProvider, ontologyCachingOptions = {}, fetchFn = global.fetch) {\n const clientCtx = createClientContext({\n metadata,\n provider: undefined\n }, stack, tokenProvider, USER_AGENT, fetchFn);\n clientCtx.ontology.provider = createStandardOntologyProviderFactory(ontologyCachingOptions)(clientCtx);\n return clientCtx;\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 deepEqual from \"fast-deep-equal\";\nimport { createAsyncCache } from \"../../object/Cache.js\";\nimport { loadFullObjectMetadata } from \"../loadFullObjectMetadata.js\";\nconst alwaysRevalidateDefault = false;\nexport const createStandardOntologyProviderFactory = client => {\n const alwaysRevalidate = client.alwaysRevalidate ?? alwaysRevalidateDefault;\n return client => {\n const objectCache = createAsyncCache(loadFullObjectMetadata);\n return {\n getObjectOrInterfaceDefinition: async apiName => {\n const n = alwaysRevalidate ? await loadFullObjectMetadata(client, apiName) : await objectCache.get(client, apiName);\n if (alwaysRevalidate) {\n const og = objectCache.getOrUndefined(client, apiName);\n if (deepEqual(og, n)) {\n return og; // ! because we can be sure `n` would throw if it were undefined\n } else {\n return objectCache.set(client, apiName, n);\n }\n }\n return n;\n },\n maybeSeed(definition) {\n // not using this for now\n }\n };\n };\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 { getObjectTypeV2, listOutgoingLinkTypesV2 } from \"@osdk/gateway/requests\";\nimport { wireObjectTypeFullMetadataToSdkObjectTypeDefinition } from \"@osdk/generator-converters\";\nimport { createOpenApiRequest } from \"@osdk/shared.net\";\nasync function loadAllOutgoingLinkTypes(client, objtype) {\n const linkTypes = [];\n let pageToken;\n do {\n const result = await listOutgoingLinkTypesV2(createOpenApiRequest(client.stack, client.fetch), client.ontology.metadata.ontologyApiName, objtype, {\n pageToken\n });\n pageToken = result.nextPageToken;\n linkTypes.push(...result.data);\n } while (pageToken != null);\n return linkTypes;\n}\nexport async function loadFullObjectMetadata(client, objtype) {\n const {\n ontologyApiName\n } = client.ontology.metadata;\n const [objectType, linkTypes] = await Promise.all([getObjectTypeV2(createOpenApiRequest(client.stack, client.fetch), ontologyApiName, objtype), loadAllOutgoingLinkTypes(client, objtype)]);\n const full = {\n implementsInterfaces: [],\n // FIXME\n linkTypes,\n objectType,\n sharedPropertyTypeMapping: {} // FIXME\n };\n return wireObjectTypeFullMetadataToSdkObjectTypeDefinition(full, true);\n}","/*\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 = `osdk-client/${process.env.PACKAGE_VERSION}`;","/*\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\n/**\n * A type that creates an object set for each object in the ontology.\n */\n\n/**\n * Create a proxy for the object set creator.\n *\n * @deprecated will be removed when we complete switch to full client(Type) syntax\n *\n * @param client The client to use to create the object sets.\n * @returns A proxy for the object set creator.\n */\nexport function createObjectSetCreator(client, ontology) {\n return new Proxy({}, {\n get: (target, p, receiver) => {\n if (typeof p === \"string\") {\n return client(ontology.objects[p] ?? ontology.interfaces?.[p]);\n }\n return undefined;\n },\n ownKeys(target) {\n return Object.keys(ontology.objects);\n },\n getOwnPropertyDescriptor(target, p) {\n if (typeof p === \"string\") {\n return {\n enumerable: ontology.objects[p] != null,\n configurable: true,\n get: () => client(ontology.objects[p] ?? ontology.interfaces?.[p])\n };\n }\n }\n });\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 { createActionInvoker, createOldActionInvoker } from \"./actions/createActionInvoker.js\";\nimport { createMinimalClient } from \"./createMinimalClient.js\";\nimport { createBaseObjectSet, createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport { createObjectSetCreator } from \"./ObjectSetCreator.js\";\nfunction createFutureClientPlus(metadata, stack, tokenProvider, ontologyCachingOptions = {}, fetchFn = fetch) {\n const clientCtx = createMinimalClient(metadata, stack, tokenProvider, ontologyCachingOptions, fetchFn);\n function clientFn(o) {\n if (o.type === \"object\" || o.type === \"interface\") {\n clientCtx.ontology.provider.maybeSeed(o);\n return createBaseObjectSet(o, clientCtx);\n } else if (o.type === \"action\") {\n clientCtx.ontology.provider.maybeSeed(o);\n return createActionInvoker(clientCtx, o);\n } else {\n throw new Error(\"Unknown definition: \" + JSON.stringify(o));\n }\n }\n return [clientCtx, clientFn];\n}\n\n// Once we migrate everyone off of using the deprecated parts of `Client` we can rename this to `createClient`.\n// For now, its a way to use JUST the new client\nexport function createFutureClient(metadata, stack, tokenProvider, ontologyCachingOptions = {}, fetchFn = fetch) {\n // When `createFutureClient` gets renamed to `createClient`, we\n // should inline this call as its no longer needed to be separate.\n return createFutureClientPlus(metadata, stack, tokenProvider, ontologyCachingOptions, fetchFn)[1];\n}\nexport function createClient(ontology, stack, tokenProvider, ontologyCachingOptions = {}, fetchFn = fetch) {\n const [clientCtx, clientFn] = createFutureClientPlus(ontology.metadata, stack, tokenProvider, ontologyCachingOptions, fetchFn);\n const objectSetFactory = type => createBaseObjectSet(ontology[\"objects\"][type] ?? ontology[\"interfaces\"]?.[type], clientCtx);\n const oldActionInvoker = createOldActionInvoker(clientCtx, ontology);\n const client = Object.defineProperties(clientFn, {\n objectSet: {\n get: () => objectSetFactory\n },\n objects: {\n get: () => createObjectSetCreator(client, ontology)\n },\n actions: {\n get: () => oldActionInvoker\n },\n __UNSTABLE_preexistingObjectSet: {\n get: () => (objectType, rid) => {\n return createObjectSet(ontology[\"interfaces\"]?.[objectType] ?? ontology[\"objects\"][objectType], clientCtx, {\n type: \"intersect\",\n objectSets: [{\n type: \"base\",\n objectType: objectType\n }, {\n type: \"reference\",\n reference: rid\n }]\n });\n }\n }\n });\n return client;\n}","/*\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 { createClient } from \"./createClient.js\";\n// FIXME: Should this be Objects or Object?\nexport * as Objects from \"./object/index.js\";\nexport { createClientContext } from \"@osdk/shared.net\";\nexport { isOk } from \"@osdk/shared.net\";\nexport { ActionValidationError } from \"./actions/ActionValidationError.js\";\nexport { createMinimalClient } from \"./createMinimalClient.js\";"]}
1
+ {"version":3,"sources":["../../src/actions/applyAction.ts","../../src/util/isOntologyObjectV2.ts","../../src/util/toDataValue.ts","../../src/actions/ActionValidationError.ts","../../src/actions/createActionInvoker.ts","../../src/createMinimalClient.ts","../../src/ontology/StandardOntologyProvider.ts","../../src/ontology/loadFullObjectMetadata.ts","../../src/ontology/loadInterfaceDefinition.ts","../../src/util/UserAgent.ts","../../src/ObjectSetCreator.ts","../../src/createClient.ts","../../src/index.ts"],"names":["listInterfaceTypes","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","wireObjectTypeFullMetadataToSdkObjectTypeDefinition","createOpenApiRequest","client","createClientContext"],"mappings":";;;;;;;;;;;;;AAgBA,SAAS,qBAAqB;AAC9B,SAAS,4BAA4B;;;ACD9B,SAAS,mBAAmB,GAAG;AACpC,SAAO,KAAK,OAAO,MAAM,YAAY,OAAO,EAAE,cAAc,YAAY,EAAE,gBAAgB;AAC5F;;;ACQO,SAAS,YAAY,OAAO;AACjC,MAAI,SAAS,MAAM;AAEjB,WAAO;AAAA,EACT;AAGA,MAAI,MAAM,QAAQ,KAAK,KAAK,iBAAiB,KAAK;AAChD,WAAO,MAAM,KAAK,OAAO,WAAW;AAAA,EACtC;AAGA,MAAI,aAAa,KAAK,GAAG;AACvB,WAAO,MAAM;AAAA,EACf;AAGA,MAAI,mBAAmB,KAAK,GAAG;AAC7B,WAAO,YAAY,MAAM,YAAY;AAAA,EACvC;AAGA,MAAI,gBAAgB,KAAK,GAAG;AAC1B,WAAO;AAAA,EACT;AACA,MAAI,YAAY,KAAK,GAAG;AACtB,WAA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AAC,CAAC;AAAA,IAC5D;AAAA,EACF;AACA,SAAO,CAAC,WAAW,QAAQ;AAC7B;AASO,SAAS,aAAa,UAAU,OAAO,eAAe,yBAAyB,CAAC,GAAG,UAAU,OAAO;AACzG,QAAM,CAAC,WAAW,QAAQ,IAAI,uBAAuB,SAAS,UAAU,OAAO,eAAe,wBAAwB,OAAO;AAC7H,QAAM,mBAAmB,UAAQ,gBAAgB,SAAS,SAAS,EAAE,IAAI,KAAK,SAAS,YAAY,IAAI,IAAI,GAAG,SAAS;AACvH,QAAM,mBAAmB,uBAAuB,WAAW,QAAQ;AACnE,QAAM,SAAS,OAAO,iBAAiB,UAAU;AAAA,IAC/C,WAAW;AAAA,MACT,KAAK,MAAM;AAAA,IACb;AAAA,IACA,SAAS;AAAA,MACP,KAAK,MAAM,uBAAuB,QAAQ,QAAQ;AAAA,IACpD;AAAA,IACA,SAAS;AAAA,MACP,KAAK,MAAM;AAAA,IACb;AAAA,IACA,iCAAiC;AAAA,MAC/B,KAAK,MAAM,CAAC,YAAY,QAAQ;AAC9B,eAAO,gBAAgB,SAAS,YAAY,IAAI,UAAU,KAAK,SAAS,SAAS,EAAE,UAAU,GAAG,WAAW;AAAA,UACzG,MAAM;AAAA,UACN,YAAY,CAAC;AAAA,YACX,MAAM;AAAA,YACN;AAAA,UACF,GAAG;AAAA,YACD,MAAM;AAAA,YACN,WAAW;AAAA,UACb,CAAC;AAAA,QACH,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF,CAAC;AACD,SAAO;AACT;;;ACtDA,SAAS,uBAAAC,4BAA2B;AACpC,SAAS,YAAY","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 { applyActionV2 } from \"@osdk/gateway/requests\";\nimport { createOpenApiRequest } from \"@osdk/shared.net\";\nimport { toDataValue } from \"../util/toDataValue.js\";\nimport { ActionValidationError } from \"./ActionValidationError.js\";\n\n// cannot specify both validateOnly and returnEdits as true\n\nexport async function applyAction(client, action, parameters, options = {}) {\n const response = await applyActionV2(createOpenApiRequest(client.stack, client.fetch), client.ontology.metadata.ontologyApiName, action.apiName, {\n parameters: remapActionParams(parameters),\n options: {\n mode: options?.validateOnly ? \"VALIDATE_ONLY\" : \"VALIDATE_AND_EXECUTE\",\n returnEdits: options?.returnEdits ? \"ALL\" : \"NONE\"\n }\n });\n if (options?.validateOnly) {\n return response.validation;\n }\n if (response.validation?.result === \"INVALID\") {\n throw new ActionValidationError(response.validation);\n }\n return options?.returnEdits ? response.edits : undefined;\n}\nfunction remapActionParams(params) {\n if (params == null) {\n return {};\n }\n const parameterMap = {};\n const remappedParams = Object.entries(params).reduce((acc, [key, value]) => {\n acc[key] = toDataValue(value);\n return acc;\n }, parameterMap);\n return remappedParams;\n}","/*\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 function isOntologyObjectV2(o) {\n return o && typeof o === \"object\" && typeof o.__apiName === \"string\" && o.__primaryKey != null;\n}","/*\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 { isAttachment } from \"../object/Attachment.js\";\nimport { getWireObjectSet, isObjectSet } from \"../objectSet/createObjectSet.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 */\nexport function toDataValue(value) {\n if (value == null) {\n // typeof null is 'object' so do this first\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 return Array.from(value, toDataValue);\n }\n\n // attachments just send the rid directly\n if (isAttachment(value)) {\n return value.rid;\n }\n\n // objects just send the JSON'd primaryKey\n if (isOntologyObjectV2(value)) {\n return toDataValue(value.__primaryKey);\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 // 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((acc, [key, structValue]) => {\n acc[key] = toDataValue(structValue);\n return acc;\n }, {});\n }\n\n // expected to pass through - boolean, byte, date, decimal, float, double, integer, long, short, string, timestamp\n return value;\n}","/*\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 class ActionValidationError extends Error {\n constructor(validation) {\n super(\"Validation Error\");\n this.validation = validation;\n }\n}","/*\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 { applyAction } from \"./applyAction.js\";\nexport function createActionInvoker(client, action) {\n return function (...args) {\n return applyAction(client, action, ...args);\n };\n}\nexport function createOldActionInvoker(client, ontology) {\n const proxy = new Proxy({}, {\n get: (_target, p, _receiver) => {\n if (typeof p === \"string\") {\n return createActionInvoker(client, ontology.actions[p]);\n }\n return undefined;\n },\n ownKeys(_target) {\n return Object.keys(ontology.actions);\n },\n getOwnPropertyDescriptor(_target, p) {\n if (typeof p === \"string\") {\n return {\n enumerable: ontology.actions[p] != null,\n configurable: true,\n value: proxy[p]\n };\n }\n }\n });\n return proxy;\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 { createClientContext } from \"@osdk/shared.net\";\nimport { createStandardOntologyProviderFactory } from \"./ontology/StandardOntologyProvider.js\";\nimport { USER_AGENT } from \"./util/UserAgent.js\";\nexport function createMinimalClient(metadata, stack, tokenProvider, ontologyCachingOptions = {}, fetchFn = global.fetch) {\n const clientCtx = createClientContext({\n metadata,\n provider: undefined\n }, stack, tokenProvider, USER_AGENT, fetchFn);\n clientCtx.ontology.provider = createStandardOntologyProviderFactory(ontologyCachingOptions)(clientCtx);\n return clientCtx;\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 { getOntologyFullMetadata, listInterfaceTypes } from \"@osdk/gateway/requests\";\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition, wireObjectTypeFullMetadataToSdkObjectTypeDefinition } from \"@osdk/generator-converters\";\nimport { createOpenApiRequest } from \"@osdk/shared.net\";\nimport deepEqual from \"fast-deep-equal\";\nimport { createAsyncCache } from \"../object/Cache.js\";\nimport { loadFullObjectMetadata } from \"./loadFullObjectMetadata.js\";\nimport { loadInterfaceDefinition } from \"./loadInterfaceDefinition.js\";\nconst alwaysRevalidateDefault = false;\n\n// SLLLLLLOOOOOOOWWWW\nasync function fullOntologyLoad(client) {\n return await Promise.all([listInterfaceTypes(createOpenApiRequest(client.stack, client.fetch), client.ontology.metadata.ontologyApiName, {\n pageSize: 200,\n preview: true\n }), getOntologyFullMetadata(createOpenApiRequest(client.stack, client.fetch), client.ontology.metadata.ontologyApiName)]);\n}\nexport const USE_FULL_ONTOLOGY = false;\nexport const createStandardOntologyProviderFactory = client => {\n const alwaysRevalidate = client.alwaysRevalidate ?? alwaysRevalidateDefault;\n return client => {\n let fullCache;\n async function initLocalCache(client, skipCache) {\n if (skipCache) {\n return await fullOntologyLoad(client);\n }\n if (!fullCache) {\n fullCache = fullOntologyLoad(client);\n }\n return await fullCache;\n }\n async function loadObject(client, key, skipCache = false) {\n if (USE_FULL_ONTOLOGY) {\n const fullCacheLocal = await initLocalCache(client, skipCache);\n return {\n ...wireObjectTypeFullMetadataToSdkObjectTypeDefinition(fullCacheLocal[1].objectTypes[key], true),\n implements: fullCacheLocal[0].data.map(i => i.apiName)\n };\n } else {\n return await loadFullObjectMetadata(client, key);\n }\n }\n async function loadInterface(client, key, skipCache = false) {\n if (USE_FULL_ONTOLOGY) {\n const fullCacheLocal = await initLocalCache(client, skipCache);\n return __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(fullCacheLocal[1].interfaceTypes[key], true);\n } else {\n return loadInterfaceDefinition(client, key);\n }\n }\n function makeGetter(fn) {\n const cache = createAsyncCache((client, key) => fn(client, key, false));\n return async apiName => {\n const n = alwaysRevalidate ? await fn(client, apiName, true) : await cache.get(client, apiName);\n if (alwaysRevalidate) {\n const og = cache.getOrUndefined(client, apiName);\n if (deepEqual(og, n)) {\n return og; // ! because we can be sure `n` would throw if it were undefined\n } else {\n return cache.set(client, apiName, n);\n }\n }\n return n;\n };\n }\n return {\n getObjectDefinition: makeGetter(loadObject),\n getInterfaceDefinition: makeGetter(loadInterface),\n maybeSeed(definition) {\n // not using this for now\n }\n };\n };\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 { getObjectTypeV2, listInterfaceTypes, listOutgoingLinkTypesV2 } from \"@osdk/gateway/requests\";\nimport { wireObjectTypeFullMetadataToSdkObjectTypeDefinition } from \"@osdk/generator-converters\";\nimport { createOpenApiRequest } from \"@osdk/shared.net\";\nimport invariant from \"tiny-invariant\";\nimport { loadAllOntologies } from \"../generated/ontology-metadata/api/OntologyMetadataService/loadAllOntologies.js\";\nimport { loadOntologyEntities } from \"../generated/ontology-metadata/api/OntologyMetadataService/loadOntologyEntities.js\";\nasync function loadAllOutgoingLinkTypes(client, objtype) {\n const linkTypes = [];\n let pageToken;\n do {\n const result = await listOutgoingLinkTypesV2(createOpenApiRequest(client.stack, client.fetch), client.ontology.metadata.ontologyApiName, objtype, {\n pageToken\n });\n pageToken = result.nextPageToken;\n linkTypes.push(...result.data);\n } while (pageToken != null);\n return linkTypes;\n}\nfunction makeConjureContext(client, servicePath) {\n const baseUrl = client.stack.startsWith(\"https://\") ? client.stack : `https://${client.stack}`;\n return {\n baseUrl,\n servicePath,\n fetchFn: client.fetch,\n tokenProvider: async () => await client.tokenProvider()\n };\n}\nexport async function loadFullObjectMetadata(client, objtype) {\n const {\n ontologyApiName\n } = client.ontology.metadata;\n const conjureCtx = makeConjureContext(client, \"/ontology-metadata/api\");\n const [objectType, linkTypes, interfaceTypes, metadata] = await Promise.all([getObjectTypeV2(createOpenApiRequest(client.stack, client.fetch), ontologyApiName, objtype), loadAllOutgoingLinkTypes(client, objtype), listInterfaceTypes(createOpenApiRequest(client.stack, client.fetch), ontologyApiName, {\n pageSize: 200,\n preview: true\n }), await loadAllOntologies(conjureCtx, {})]);\n const sharedPropertyTypeMapping = await loadSptMap(conjureCtx, metadata, client.ontology.metadata.ontologyRid, objectType.rid);\n const full = {\n implementsInterfaces: interfaceTypes.data.map(i => i.apiName),\n linkTypes,\n objectType,\n sharedPropertyTypeMapping\n };\n\n // TODO: reuse the loaded interface data!\n return wireObjectTypeFullMetadataToSdkObjectTypeDefinition(full, true);\n}\nasync function loadSptMap(ctx, ontologyMetadata, ontologyRid, objectRid) {\n const ontologyVersion = ontologyMetadata.ontologies[ontologyRid].currentOntologyVersion;\n const body = {\n objectTypeVersions: {\n [objectRid]: ontologyVersion\n },\n linkTypeVersions: {},\n loadRedacted: false,\n includeObjectTypesWithoutSearchableDatasources: true\n };\n const entities = await loadOntologyEntities(ctx, body);\n const objectType = entities.objectTypes[objectRid];\n !objectType ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"object type should be loaded\") : invariant(false) : void 0;\n const sptMap = {};\n for (const property of Object.values(objectType.propertyTypes)) {\n if (property.sharedPropertyTypeApiName && property.apiName) {\n sptMap[property.sharedPropertyTypeApiName] = property.apiName;\n }\n }\n return sptMap;\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 { getInterfaceType } from \"@osdk/gateway/requests\";\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from \"@osdk/generator-converters\";\nimport { createOpenApiRequest } from \"@osdk/shared.net\";\nexport async function loadInterfaceDefinition(client, objtype) {\n const {\n ontologyApiName\n } = client.ontology.metadata;\n const r = await getInterfaceType(createOpenApiRequest(client.stack, client.fetch), ontologyApiName, objtype, {\n preview: true\n });\n return __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(r, true);\n}","/*\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 = `osdk-client/${process.env.PACKAGE_VERSION}`;","/*\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\n/**\n * A type that creates an object set for each object in the ontology.\n */\n\n/**\n * Create a proxy for the object set creator.\n *\n * @deprecated will be removed when we complete switch to full client(Type) syntax\n *\n * @param client The client to use to create the object sets.\n * @returns A proxy for the object set creator.\n */\nexport function createObjectSetCreator(client, ontology) {\n return new Proxy({}, {\n get: (target, p, receiver) => {\n if (typeof p === \"string\") {\n return client(ontology.objects[p] ?? ontology.interfaces?.[p]);\n }\n return undefined;\n },\n ownKeys(target) {\n return Object.keys(ontology.objects);\n },\n getOwnPropertyDescriptor(target, p) {\n if (typeof p === \"string\") {\n return {\n enumerable: ontology.objects[p] != null,\n configurable: true,\n get: () => client(ontology.objects[p] ?? ontology.interfaces?.[p])\n };\n }\n }\n });\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 { createActionInvoker, createOldActionInvoker } from \"./actions/createActionInvoker.js\";\nimport { createMinimalClient } from \"./createMinimalClient.js\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport { createObjectSetCreator } from \"./ObjectSetCreator.js\";\nfunction createFutureClientPlus(metadata, stack, tokenProvider, ontologyCachingOptions = {}, fetchFn = fetch) {\n const clientCtx = createMinimalClient(metadata, stack, tokenProvider, ontologyCachingOptions, fetchFn);\n function clientFn(o) {\n if (o.type === \"object\" || o.type === \"interface\") {\n clientCtx.ontology.provider.maybeSeed(o);\n return createObjectSet(o, clientCtx);\n } else if (o.type === \"action\") {\n clientCtx.ontology.provider.maybeSeed(o);\n return createActionInvoker(clientCtx, o);\n } else {\n throw new Error(\"Unknown definition: \" + JSON.stringify(o));\n }\n }\n return [clientCtx, clientFn];\n}\n\n// Once we migrate everyone off of using the deprecated parts of `Client` we can rename this to `createClient`.\n// For now, its a way to use JUST the new client\nexport function createFutureClient(metadata, stack, tokenProvider, ontologyCachingOptions = {}, fetchFn = fetch) {\n // When `createFutureClient` gets renamed to `createClient`, we\n // should inline this call as its no longer needed to be separate.\n return createFutureClientPlus(metadata, stack, tokenProvider, ontologyCachingOptions, fetchFn)[1];\n}\nexport function createClient(ontology, stack, tokenProvider, ontologyCachingOptions = {}, fetchFn = fetch) {\n const [clientCtx, clientFn] = createFutureClientPlus(ontology.metadata, stack, tokenProvider, ontologyCachingOptions, fetchFn);\n const objectSetFactory = type => createObjectSet(ontology[\"objects\"][type] ?? ontology[\"interfaces\"]?.[type], clientCtx);\n const oldActionInvoker = createOldActionInvoker(clientCtx, ontology);\n const client = Object.defineProperties(clientFn, {\n objectSet: {\n get: () => objectSetFactory\n },\n objects: {\n get: () => createObjectSetCreator(client, ontology)\n },\n actions: {\n get: () => oldActionInvoker\n },\n __UNSTABLE_preexistingObjectSet: {\n get: () => (objectType, rid) => {\n return createObjectSet(ontology[\"interfaces\"]?.[objectType] ?? ontology[\"objects\"][objectType], clientCtx, {\n type: \"intersect\",\n objectSets: [{\n type: \"base\",\n objectType: objectType\n }, {\n type: \"reference\",\n reference: rid\n }]\n });\n }\n }\n });\n return client;\n}","/*\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 { createClient } from \"./createClient.js\";\n// FIXME: Should this be Objects or Object?\nexport * as Objects from \"./object/index.js\";\nexport { createClientContext } from \"@osdk/shared.net\";\nexport { isOk } from \"@osdk/shared.net\";\nexport { ActionValidationError } from \"./actions/ActionValidationError.js\";\nexport { createMinimalClient } from \"./createMinimalClient.js\";"]}
@@ -1,16 +1,16 @@
1
1
  'use strict';
2
2
 
3
- var chunkLK4VDWCG_cjs = require('../chunk-LK4VDWCG.cjs');
3
+ var chunkCKYBATFN_cjs = require('../chunk-CKYBATFN.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, 'aggregate', {
8
8
  enumerable: true,
9
- get: function () { return chunkLK4VDWCG_cjs.aggregate; }
9
+ get: function () { return chunkCKYBATFN_cjs.aggregate; }
10
10
  });
11
11
  Object.defineProperty(exports, 'fetchPage', {
12
12
  enumerable: true,
13
- get: function () { return chunkLK4VDWCG_cjs.fetchPage; }
13
+ get: function () { return chunkCKYBATFN_cjs.fetchPage; }
14
14
  });
15
15
  //# sourceMappingURL=out.js.map
16
16
  //# sourceMappingURL=objects.cjs.map
@@ -1,3 +1,3 @@
1
- export { aggregate, fetchPage } from '../chunk-GOBQUVQZ.mjs';
1
+ export { aggregate, fetchPage } from '../chunk-SNGUDELK.mjs';
2
2
  //# sourceMappingURL=out.js.map
3
3
  //# sourceMappingURL=objects.mjs.map
@@ -1,10 +1,10 @@
1
- import type { ActionDefinition, ObjectOrInterfaceDefinition, ObjectOrInterfaceDefinitionFrom, ObjectOrInterfaceKeysFrom, ObjectTypeKeysFrom, OntologyDefinition } from "@osdk/api";
1
+ import type { ActionDefinition, InterfaceDefinition, ObjectOrInterfaceDefinition, ObjectOrInterfaceDefinitionFrom, ObjectOrInterfaceKeysFrom, ObjectTypeDefinition, ObjectTypeKeysFrom, OntologyDefinition } from "@osdk/api";
2
2
  import type { Actions, ActionSignatureFromDef } from "./actions/Actions.js";
3
- import type { BaseObjectSet, ObjectSet } from "./objectSet/ObjectSet.js";
3
+ import type { MinimalObjectSet, ObjectSet } from "./objectSet/ObjectSet.js";
4
4
  import type { ObjectSetCreator } from "./ObjectSetCreator.js";
5
5
  export interface Client<O extends OntologyDefinition<any>> extends FutureClient {
6
6
  /** @deprecated use client(MyType) */
7
- objectSet: <const K extends ObjectOrInterfaceKeysFrom<O>>(type: K) => BaseObjectSet<ObjectOrInterfaceDefinitionFrom<O, K>>;
7
+ objectSet: <const K extends ObjectOrInterfaceKeysFrom<O>>(type: K) => ObjectSet<ObjectOrInterfaceDefinitionFrom<O, K>>;
8
8
  /** @deprecated use client(MyType) */
9
9
  objects: ObjectSetCreator<O>;
10
10
  /** @deprecated use client(myAction) */
@@ -12,5 +12,5 @@ export interface Client<O extends OntologyDefinition<any>> extends FutureClient
12
12
  __UNSTABLE_preexistingObjectSet<const K extends ObjectTypeKeysFrom<O>>(type: K, rid: string): ObjectSet<ObjectOrInterfaceDefinitionFrom<O, K>>;
13
13
  }
14
14
  export interface FutureClient {
15
- <Q extends ObjectOrInterfaceDefinition | ActionDefinition<any, any, any>>(o: Q): Q extends ObjectOrInterfaceDefinition ? ObjectSet<Q> : Q extends ActionDefinition<any, any, any> ? ActionSignatureFromDef<Q> : never;
15
+ <Q extends ObjectOrInterfaceDefinition | ActionDefinition<any, any, any>>(o: Q): Q extends ObjectTypeDefinition<any> ? ObjectSet<Q> : Q extends InterfaceDefinition<any, any> ? MinimalObjectSet<Q> : Q extends ActionDefinition<any, any, any> ? ActionSignatureFromDef<Q> : never;
16
16
  }
@@ -1,12 +1,11 @@
1
- import type { ObjectTypePropertyDefinition, WirePropertyTypes } from "@osdk/api";
2
- import type { Attachment } from "./object/Attachment.js";
1
+ import type { ObjectTypePropertyDefinition } from "@osdk/api";
2
+ import type { PropertyValueWireToClient } from "./mapping/PropertyValueMapping.js";
3
3
  type MaybeArray<T extends {
4
4
  multiplicity?: boolean | undefined;
5
5
  }, U> = T["multiplicity"] extends true ? Array<U> : U;
6
6
  type MaybeNullable<T extends ObjectTypePropertyDefinition, U> = T["nullable"] extends true ? U | undefined : U;
7
7
  type Raw<T> = T extends Array<any> ? T[0] : T;
8
8
  type Converted<T> = T extends Array<any> ? T[1] : T;
9
- type HydrationConversions<T extends ObjectTypePropertyDefinition> = T["type"] extends "attachment" ? Attachment : WirePropertyTypes[T["type"]];
10
- export type OsdkObjectPropertyType<T extends ObjectTypePropertyDefinition> = MaybeNullable<T, MaybeArray<T, Converted<HydrationConversions<T>>>>;
11
- export type OsdkObjectRawPropertyType<T extends ObjectTypePropertyDefinition> = MaybeNullable<T, MaybeArray<T, Raw<WirePropertyTypes[T["type"]]>>>;
9
+ export type OsdkObjectPropertyType<T extends ObjectTypePropertyDefinition> = MaybeNullable<T, MaybeArray<T, Converted<PropertyValueWireToClient[T["type"]]>>>;
10
+ export type OsdkObjectRawPropertyType<T extends ObjectTypePropertyDefinition> = MaybeNullable<T, MaybeArray<T, Raw<PropertyValueWireToClient[T["type"]]>>>;
12
11
  export {};
@@ -1,11 +1,11 @@
1
1
  import type { ObjectOrInterfaceDefinitionFrom, ObjectOrInterfaceKeysFrom, OntologyDefinition } from "@osdk/api";
2
2
  import type { Client } from "./Client.js";
3
- import type { BaseObjectSet } from "./objectSet/ObjectSet.js";
3
+ import type { ObjectSet } from "./objectSet/ObjectSet.js";
4
4
  /**
5
5
  * A type that creates an object set for each object in the ontology.
6
6
  */
7
7
  export type ObjectSetCreator<O extends OntologyDefinition<any>> = {
8
- [T in ObjectOrInterfaceKeysFrom<O>]: BaseObjectSet<ObjectOrInterfaceDefinitionFrom<O, T>>;
8
+ [T in ObjectOrInterfaceKeysFrom<O>]: ObjectSet<ObjectOrInterfaceDefinitionFrom<O, T>>;
9
9
  };
10
10
  /**
11
11
  * Create a proxy for the object set creator.
@@ -1,8 +1,19 @@
1
- import type { InterfaceDefinition, ObjectTypeDefinition, WirePropertyTypes } from "@osdk/api";
1
+ import type { InterfaceDefinition, ObjectOrInterfaceDefinition, ObjectTypeDefinition } from "@osdk/api";
2
2
  import type { OsdkObjectPropertyType } from "./Definitions.js";
3
3
  import type { OsdkObjectLinksObject } from "./definitions/LinkDefinitions.js";
4
- export type OsdkObjectPrimaryKeyType<O extends ObjectTypeDefinition<any>> = WirePropertyTypes[O["primaryKeyType"]];
5
- export type Osdk<Q extends ObjectTypeDefinition<any> | InterfaceDefinition<any, any>, P extends keyof Q["properties"] | "$all" = "$all", R extends boolean = false> = {
4
+ import type { PropertyValueWireToClient } from "./mapping/PropertyValueMapping.js";
5
+ export type OsdkObjectPrimaryKeyType<O extends ObjectTypeDefinition<any>> = PropertyValueWireToClient[O["primaryKeyType"]];
6
+ /**
7
+ * DO NOT EXPORT FROM PACKAGE
8
+ * @param FROM - the interface or object type to convert from
9
+ * @param TO - the interface or object type to convert to
10
+ * @param P - the property(s) to convert
11
+ */
12
+ export type ConvertProps<FROM extends ObjectTypeDefinition<any> | InterfaceDefinition<any, any>, TO extends ValidToFrom<FROM>, P extends string = "$all"> = TO extends ObjectTypeDefinition<any> ? ((NonNullable<TO["inverseSpts"]>[P extends "$all" ? keyof FROM["properties"] extends keyof TO["inverseSpts"] ? keyof FROM["properties"] : never : P])) : TO extends InterfaceDefinition<any> ? P extends "$all" ? "$all" : FROM extends ObjectTypeDefinition<any> ? P extends keyof FROM["spts"] ? NonNullable<FROM["spts"]>[P] : never : never : never;
13
+ /** DO NOT EXPORT FROM PACKAGE */
14
+ export type ValidToFrom<FROM extends ObjectOrInterfaceDefinition> = FROM extends InterfaceDefinition<any, any> ? ObjectTypeDefinition<any> | InterfaceDefinition<any, any> : InterfaceDefinition<any, any>;
15
+ type UnderlyingProps<Q extends ObjectOrInterfaceDefinition, P extends string, Z extends string, NEWQ extends ValidToFrom<Q>> = Z & Q extends InterfaceDefinition<any, any> ? NEWQ extends ObjectTypeDefinition<any> ? ConvertProps<Q, NEWQ, P> : Z : Z;
16
+ export type Osdk<Q extends ObjectTypeDefinition<any> | InterfaceDefinition<any, any>, P extends string = "$all", R extends boolean = false, Z extends string = P> = {
6
17
  [PP in keyof Q["properties"] as (P extends "$all" ? PP : PP extends P ? PP : never)]: OsdkObjectPropertyType<Q["properties"][PP]>;
7
18
  } & {
8
19
  /** @deprecated use $apiName */
@@ -16,7 +27,9 @@ export type Osdk<Q extends ObjectTypeDefinition<any> | InterfaceDefinition<any,
16
27
  __primaryKey: Q extends ObjectTypeDefinition<any> ? OsdkObjectPrimaryKeyType<Q> : unknown;
17
28
  $primaryKey: Q extends ObjectTypeDefinition<any> ? OsdkObjectPrimaryKeyType<Q> : unknown;
18
29
  $link: Q extends ObjectTypeDefinition<any> ? OsdkObjectLinksObject<Q> : never;
30
+ $as: <NEWQ extends ValidToFrom<Q>>(type: NEWQ) => Osdk<NEWQ, ConvertProps<Q, NEWQ, P>, R, UnderlyingProps<Q, P, Z, NEWQ>>;
19
31
  } & (R extends true ? {
20
32
  $rid: string;
21
33
  } : {});
22
- export type OsdkObjectOrInterfaceFrom<Q extends ObjectTypeDefinition<any> | InterfaceDefinition<any, any>, P extends keyof Q["properties"] | "$all" = "$all", R extends boolean = false> = Osdk<Q, P, R>;
34
+ export type OsdkObjectOrInterfaceFrom<Q extends ObjectTypeDefinition<any> | InterfaceDefinition<any, any>, P extends string = "$all", R extends boolean = false> = Osdk<Q, P, R>;
35
+ export {};