@osdk/client 2.6.1 → 2.7.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +92 -88
- package/build/browser/Client.js +1 -1
- package/build/browser/Client.js.map +1 -1
- package/build/browser/MinimalClientContext.js.map +1 -1
- package/build/browser/actions/actions.test.js +9 -0
- package/build/browser/actions/actions.test.js.map +1 -1
- package/build/browser/actions/applyAction.js +4 -0
- package/build/browser/actions/applyAction.js.map +1 -1
- package/build/browser/createClient.js +2 -1
- package/build/browser/createClient.js.map +1 -1
- package/build/browser/createMinimalClient.js +1 -0
- package/build/browser/createMinimalClient.js.map +1 -1
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.js +17 -1
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
- package/build/browser/fetchMetadata.test.js +31 -0
- package/build/browser/fetchMetadata.test.js.map +1 -1
- package/build/browser/intellisense.test.js +1 -1
- package/build/browser/intellisense.test.js.map +1 -1
- package/build/browser/object/aggregate.js +1 -0
- package/build/browser/object/aggregate.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/BaseHolder.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.js +3 -0
- package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js +8 -0
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js +95 -3
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.js +18 -6
- package/build/browser/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.test.js +189 -28
- package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/browser/object/fetchPage.js +18 -5
- package/build/browser/object/fetchPage.js.map +1 -1
- package/build/browser/object/fetchPage.test.js.map +1 -1
- package/build/browser/object/formatting/applyPropertyFormatter.js +58 -0
- package/build/browser/object/formatting/applyPropertyFormatter.js.map +1 -0
- package/build/browser/object/formatting/applyPropertyFormatter.test.js +726 -0
- package/build/browser/object/formatting/applyPropertyFormatter.test.js.map +1 -0
- package/build/browser/object/formatting/formatBoolean.js +23 -0
- package/build/browser/object/formatting/formatBoolean.js.map +1 -0
- package/build/browser/object/formatting/formatDateTime.js +158 -0
- package/build/browser/object/formatting/formatDateTime.js.map +1 -0
- package/build/browser/object/formatting/formatNumber.js +242 -0
- package/build/browser/object/formatting/formatNumber.js.map +1 -0
- package/build/browser/object/formatting/propertyFormattingUtils.js +39 -0
- package/build/browser/object/formatting/propertyFormattingUtils.js.map +1 -0
- package/build/browser/object/object.test.js +123 -0
- package/build/browser/object/object.test.js.map +1 -1
- package/build/browser/objectSet/InterfaceObjectSet.test.js +1 -1
- package/build/browser/objectSet/InterfaceObjectSet.test.js.map +1 -1
- package/build/browser/objectSet/ObjectSet.test.js +7 -6
- package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js +2 -2
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js +3 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
- package/build/browser/objectSet/createObjectSet.js +13 -0
- package/build/browser/objectSet/createObjectSet.js.map +1 -1
- package/build/browser/objectSet/fetchLinksPage.js +57 -0
- package/build/browser/objectSet/fetchLinksPage.js.map +1 -0
- package/build/browser/objectSet/fetchLinksPage.test.js +102 -0
- package/build/browser/objectSet/fetchLinksPage.test.js.map +1 -0
- package/build/browser/observable/ListPayload.js.map +1 -1
- package/build/browser/observable/ObjectPayload.js.map +1 -1
- package/build/browser/observable/ObservableClient.js +0 -5
- package/build/browser/observable/ObservableClient.js.map +1 -1
- package/build/browser/observable/internal/ObservableClientImpl.js.map +1 -1
- package/build/browser/observable/internal/Store.test.js +104 -1
- package/build/browser/observable/internal/Store.test.js.map +1 -1
- package/build/browser/observable/internal/actions/OptimisticJob.js +1 -1
- package/build/browser/observable/internal/actions/OptimisticJob.js.map +1 -1
- package/build/browser/observable/internal/base-list/BaseListQuery.js +1 -1
- package/build/browser/observable/internal/base-list/BaseListQuery.js.map +1 -1
- package/build/browser/observable/internal/links/SpecificLinkQuery.js +9 -1
- package/build/browser/observable/internal/links/SpecificLinkQuery.js.map +1 -1
- package/build/browser/observable/internal/list/ListQuery.js +17 -2
- package/build/browser/observable/internal/list/ListQuery.js.map +1 -1
- package/build/browser/observable/internal/objectset/ObjectSetQuery.js +9 -7
- package/build/browser/observable/internal/objectset/ObjectSetQuery.js.map +1 -1
- package/build/browser/observable/internal/utils/rdpFieldOperations.js +46 -25
- package/build/browser/observable/internal/utils/rdpFieldOperations.js.map +1 -1
- package/build/browser/observable/internal/utils/rdpFieldOperations.test.js +172 -0
- package/build/browser/observable/internal/utils/rdpFieldOperations.test.js.map +1 -0
- package/build/browser/ontology/loadActionMetadata.js +3 -1
- package/build/browser/ontology/loadActionMetadata.js.map +1 -1
- package/build/browser/ontology/loadFullObjectMetadata.js +2 -1
- package/build/browser/ontology/loadFullObjectMetadata.js.map +1 -1
- package/build/browser/ontology/loadInterfaceMetadata.js +2 -1
- package/build/browser/ontology/loadInterfaceMetadata.js.map +1 -1
- package/build/browser/public/unstable-do-not-use.js.map +1 -1
- package/build/browser/queries/applyQuery.js +14 -0
- package/build/browser/queries/applyQuery.js.map +1 -1
- package/build/browser/queries/queries.test.js +14 -2
- package/build/browser/queries/queries.test.js.map +1 -1
- package/build/browser/util/UserAgent.js +2 -2
- package/build/browser/util/UserAgent.js.map +1 -1
- package/build/browser/util/toDataValue.js +0 -1
- package/build/browser/util/toDataValue.js.map +1 -1
- package/build/browser/util/toDataValue.test.js +4 -0
- package/build/browser/util/toDataValue.test.js.map +1 -1
- package/build/cjs/{chunk-6SCDLAU2.cjs → chunk-LDTMSHUZ.cjs} +4 -4
- package/build/cjs/{chunk-6SCDLAU2.cjs.map → chunk-LDTMSHUZ.cjs.map} +1 -1
- package/build/cjs/{chunk-BRUBBJUT.cjs → chunk-MZZAHBN6.cjs} +636 -138
- package/build/cjs/chunk-MZZAHBN6.cjs.map +1 -0
- package/build/cjs/{chunk-EHMN4DL4.cjs → chunk-RDZ5NKAI.cjs} +210 -129
- package/build/cjs/chunk-RDZ5NKAI.cjs.map +1 -0
- package/build/cjs/{createClient-DvwysJMX.d.cts → createClient-D5G3qzAO.d.cts} +1 -0
- package/build/cjs/{delay-KIUUJ5NJ.cjs → delay-W2TSML2P.cjs} +4 -4
- package/build/cjs/{delay-KIUUJ5NJ.cjs.map → delay-W2TSML2P.cjs.map} +1 -1
- package/build/cjs/index.cjs +12 -12
- package/build/cjs/index.d.cts +1 -1
- package/build/cjs/public/internal-node.cjs +219 -219
- package/build/cjs/public/internal.cjs +14 -14
- package/build/cjs/public/unstable-do-not-use.cjs +335 -145
- package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
- package/build/cjs/public/unstable-do-not-use.d.cts +9 -9
- package/build/esm/Client.js +1 -1
- package/build/esm/Client.js.map +1 -1
- package/build/esm/MinimalClientContext.js.map +1 -1
- package/build/esm/actions/actions.test.js +9 -0
- package/build/esm/actions/actions.test.js.map +1 -1
- package/build/esm/actions/applyAction.js +4 -0
- package/build/esm/actions/applyAction.js.map +1 -1
- package/build/esm/createClient.js +2 -1
- package/build/esm/createClient.js.map +1 -1
- package/build/esm/createMinimalClient.js +1 -0
- package/build/esm/createMinimalClient.js.map +1 -1
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.js +17 -1
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
- package/build/esm/fetchMetadata.test.js +31 -0
- package/build/esm/fetchMetadata.test.js.map +1 -1
- package/build/esm/intellisense.test.js +1 -1
- package/build/esm/intellisense.test.js.map +1 -1
- package/build/esm/object/aggregate.js +1 -0
- package/build/esm/object/aggregate.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/BaseHolder.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.js +3 -0
- package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js +8 -0
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js +95 -3
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.js +18 -6
- package/build/esm/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.test.js +189 -28
- package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/esm/object/fetchPage.js +18 -5
- package/build/esm/object/fetchPage.js.map +1 -1
- package/build/esm/object/fetchPage.test.js.map +1 -1
- package/build/esm/object/formatting/applyPropertyFormatter.js +58 -0
- package/build/esm/object/formatting/applyPropertyFormatter.js.map +1 -0
- package/build/esm/object/formatting/applyPropertyFormatter.test.js +726 -0
- package/build/esm/object/formatting/applyPropertyFormatter.test.js.map +1 -0
- package/build/esm/object/formatting/formatBoolean.js +23 -0
- package/build/esm/object/formatting/formatBoolean.js.map +1 -0
- package/build/esm/object/formatting/formatDateTime.js +158 -0
- package/build/esm/object/formatting/formatDateTime.js.map +1 -0
- package/build/esm/object/formatting/formatNumber.js +242 -0
- package/build/esm/object/formatting/formatNumber.js.map +1 -0
- package/build/esm/object/formatting/propertyFormattingUtils.js +39 -0
- package/build/esm/object/formatting/propertyFormattingUtils.js.map +1 -0
- package/build/esm/object/object.test.js +123 -0
- package/build/esm/object/object.test.js.map +1 -1
- package/build/esm/objectSet/InterfaceObjectSet.test.js +1 -1
- package/build/esm/objectSet/InterfaceObjectSet.test.js.map +1 -1
- package/build/esm/objectSet/ObjectSet.test.js +7 -6
- package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js +2 -2
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js +3 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
- package/build/esm/objectSet/createObjectSet.js +13 -0
- package/build/esm/objectSet/createObjectSet.js.map +1 -1
- package/build/esm/objectSet/fetchLinksPage.js +57 -0
- package/build/esm/objectSet/fetchLinksPage.js.map +1 -0
- package/build/esm/objectSet/fetchLinksPage.test.js +102 -0
- package/build/esm/objectSet/fetchLinksPage.test.js.map +1 -0
- package/build/esm/observable/ListPayload.js.map +1 -1
- package/build/esm/observable/ObjectPayload.js.map +1 -1
- package/build/esm/observable/ObservableClient.js +0 -5
- package/build/esm/observable/ObservableClient.js.map +1 -1
- package/build/esm/observable/internal/ObservableClientImpl.js.map +1 -1
- package/build/esm/observable/internal/Store.test.js +104 -1
- package/build/esm/observable/internal/Store.test.js.map +1 -1
- package/build/esm/observable/internal/actions/OptimisticJob.js +1 -1
- package/build/esm/observable/internal/actions/OptimisticJob.js.map +1 -1
- package/build/esm/observable/internal/base-list/BaseListQuery.js +1 -1
- package/build/esm/observable/internal/base-list/BaseListQuery.js.map +1 -1
- package/build/esm/observable/internal/links/SpecificLinkQuery.js +9 -1
- package/build/esm/observable/internal/links/SpecificLinkQuery.js.map +1 -1
- package/build/esm/observable/internal/list/ListQuery.js +17 -2
- package/build/esm/observable/internal/list/ListQuery.js.map +1 -1
- package/build/esm/observable/internal/objectset/ObjectSetQuery.js +9 -7
- package/build/esm/observable/internal/objectset/ObjectSetQuery.js.map +1 -1
- package/build/esm/observable/internal/utils/rdpFieldOperations.js +46 -25
- package/build/esm/observable/internal/utils/rdpFieldOperations.js.map +1 -1
- package/build/esm/observable/internal/utils/rdpFieldOperations.test.js +172 -0
- package/build/esm/observable/internal/utils/rdpFieldOperations.test.js.map +1 -0
- package/build/esm/ontology/loadActionMetadata.js +3 -1
- package/build/esm/ontology/loadActionMetadata.js.map +1 -1
- package/build/esm/ontology/loadFullObjectMetadata.js +2 -1
- package/build/esm/ontology/loadFullObjectMetadata.js.map +1 -1
- package/build/esm/ontology/loadInterfaceMetadata.js +2 -1
- package/build/esm/ontology/loadInterfaceMetadata.js.map +1 -1
- package/build/esm/public/unstable-do-not-use.js.map +1 -1
- package/build/esm/queries/applyQuery.js +14 -0
- package/build/esm/queries/applyQuery.js.map +1 -1
- package/build/esm/queries/queries.test.js +14 -2
- package/build/esm/queries/queries.test.js.map +1 -1
- package/build/esm/util/UserAgent.js +2 -2
- package/build/esm/util/UserAgent.js.map +1 -1
- package/build/esm/util/toDataValue.js +0 -1
- package/build/esm/util/toDataValue.js.map +1 -1
- package/build/esm/util/toDataValue.test.js +4 -0
- package/build/esm/util/toDataValue.test.js.map +1 -1
- package/build/types/Client.d.ts +1 -1
- package/build/types/MinimalClientContext.d.ts +1 -0
- package/build/types/MinimalClientContext.d.ts.map +1 -1
- package/build/types/actions/applyAction.d.ts.map +1 -1
- package/build/types/createClient.d.ts +1 -0
- package/build/types/createClient.d.ts.map +1 -1
- package/build/types/object/convertWireToOsdkObjects/InternalSymbols.d.ts +2 -0
- package/build/types/object/convertWireToOsdkObjects/InternalSymbols.d.ts.map +1 -1
- package/build/types/object/convertWireToOsdkObjects.d.ts +4 -4
- package/build/types/object/convertWireToOsdkObjects.d.ts.map +1 -1
- package/build/types/object/fetchPage.d.ts.map +1 -1
- package/build/types/object/formatting/applyPropertyFormatter.d.ts +18 -0
- package/build/types/object/formatting/applyPropertyFormatter.d.ts.map +1 -0
- package/build/types/object/formatting/applyPropertyFormatter.test.d.ts +1 -0
- package/build/types/object/formatting/applyPropertyFormatter.test.d.ts.map +1 -0
- package/build/types/object/formatting/formatBoolean.d.ts +5 -0
- package/build/types/object/formatting/formatBoolean.d.ts.map +1 -0
- package/build/types/object/formatting/formatDateTime.d.ts +6 -0
- package/build/types/object/formatting/formatDateTime.d.ts.map +1 -0
- package/build/types/object/formatting/formatNumber.d.ts +15 -0
- package/build/types/object/formatting/formatNumber.d.ts.map +1 -0
- package/build/types/object/formatting/propertyFormattingUtils.d.ts +10 -0
- package/build/types/object/formatting/propertyFormattingUtils.d.ts.map +1 -0
- package/build/types/object/object.test.d.ts.map +1 -1
- package/build/types/objectSet/fetchLinksPage.d.ts +1 -0
- package/build/types/objectSet/fetchLinksPage.d.ts.map +1 -0
- package/build/types/objectSet/fetchLinksPage.test.d.ts +1 -0
- package/build/types/objectSet/fetchLinksPage.test.d.ts.map +1 -0
- package/build/types/observable/ListPayload.d.ts +3 -2
- package/build/types/observable/ListPayload.d.ts.map +1 -1
- package/build/types/observable/ObjectPayload.d.ts +2 -2
- package/build/types/observable/ObjectPayload.d.ts.map +1 -1
- package/build/types/observable/ObservableClient.d.ts +10 -7
- package/build/types/observable/ObservableClient.d.ts.map +1 -1
- package/build/types/observable/internal/Store.test.d.ts.map +1 -1
- package/build/types/observable/internal/actions/OptimisticJob.d.ts.map +1 -1
- package/build/types/observable/internal/links/SpecificLinkQuery.d.ts.map +1 -1
- package/build/types/observable/internal/list/ListQuery.d.ts.map +1 -1
- package/build/types/observable/internal/objectset/ObjectSetQuery.d.ts.map +1 -1
- package/build/types/observable/internal/utils/rdpFieldOperations.d.ts.map +1 -1
- package/build/types/observable/internal/utils/rdpFieldOperations.test.d.ts +1 -0
- package/build/types/observable/internal/utils/rdpFieldOperations.test.d.ts.map +1 -0
- package/build/types/public/unstable-do-not-use.d.ts +1 -1
- package/build/types/public/unstable-do-not-use.d.ts.map +1 -1
- package/build/types/queries/applyQuery.d.ts.map +1 -1
- package/package.json +14 -14
- package/build/cjs/chunk-BRUBBJUT.cjs.map +0 -1
- package/build/cjs/chunk-EHMN4DL4.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createWithPropertiesObjectSet.js","names":["invariant","modernToLegacyWhereClause","derivedPropertyDefinitionFactory","createWithPropertiesObjectSet","objectType","objectSet","definitionMap","fromBaseObjectSet","pivotTo","link","type","where","clause","rdpNames","Set","keys","aggregate","aggregation","opt","splitAggregation","split","length","process","env","NODE_ENV","aggregationPropertyName","aggregationOperation","aggregationOperationDefinition","selectedPropertyApiName","approximatePercentile","percentile","limit","undefined","wrappedObjectSet","operation","selectorResult","set","selectProperty","name","apiName"],"sources":["createWithPropertiesObjectSet.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { DerivedProperty, ObjectOrInterfaceDefinition } from \"@osdk/api\";\nimport type {\n DerivedPropertyDefinition,\n ObjectSet as WireObjectSet,\n SelectedPropertyOperation,\n} from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport { modernToLegacyWhereClause } from \"../internal/conversions/modernToLegacyWhereClause.js\";\nimport { derivedPropertyDefinitionFactory } from \"./derivedPropertyDefinitionFactory.js\";\n\n/** @internal */\nexport function createWithPropertiesObjectSet<\n Q extends ObjectOrInterfaceDefinition,\n>(\n objectType: Q,\n objectSet: WireObjectSet,\n definitionMap: Map<any, DerivedPropertyDefinition>,\n fromBaseObjectSet: boolean = false,\n):
|
|
1
|
+
{"version":3,"file":"createWithPropertiesObjectSet.js","names":["invariant","modernToLegacyWhereClause","derivedPropertyDefinitionFactory","createWithPropertiesObjectSet","objectType","objectSet","definitionMap","fromBaseObjectSet","pivotTo","link","type","where","clause","rdpNames","Set","keys","aggregate","aggregation","opt","splitAggregation","split","length","process","env","NODE_ENV","aggregationPropertyName","aggregationOperation","aggregationOperationDefinition","selectedPropertyApiName","approximatePercentile","percentile","limit","undefined","wrappedObjectSet","operation","selectorResult","set","selectProperty","name","apiName","constant","double","integer","long","datetime","timestamp"],"sources":["createWithPropertiesObjectSet.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { DerivedProperty, ObjectOrInterfaceDefinition } from \"@osdk/api\";\nimport type {\n DerivedPropertyDefinition,\n ObjectSet as WireObjectSet,\n SelectedPropertyOperation,\n} from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport { modernToLegacyWhereClause } from \"../internal/conversions/modernToLegacyWhereClause.js\";\nimport { derivedPropertyDefinitionFactory } from \"./derivedPropertyDefinitionFactory.js\";\n\ntype WithConstSelect<Q extends ObjectOrInterfaceDefinition> =\n & DerivedProperty.SelectPropertyBuilder<Q, false>\n & {\n constant: DerivedProperty.Builder<Q, true>[\"constant\"];\n };\n\n/** @internal */\nexport function createWithPropertiesObjectSet<\n Q extends ObjectOrInterfaceDefinition,\n>(\n objectType: Q,\n objectSet: WireObjectSet,\n definitionMap: Map<any, DerivedPropertyDefinition>,\n fromBaseObjectSet: boolean = false,\n): WithConstSelect<Q> {\n return {\n pivotTo: (link) => {\n return createWithPropertiesObjectSet(objectType, {\n type: \"searchAround\",\n objectSet,\n link,\n }, definitionMap);\n },\n where: (clause) => {\n const rdpNames = new Set(definitionMap.keys());\n return createWithPropertiesObjectSet(objectType, {\n type: \"filter\",\n objectSet: objectSet,\n where: modernToLegacyWhereClause(clause, objectType, rdpNames),\n }, definitionMap);\n },\n aggregate: (aggregation: string, opt: any) => {\n const splitAggregation = aggregation.split(\":\");\n invariant(\n splitAggregation.length === 2 || splitAggregation[0] === \"$count\",\n \"Invalid aggregation format\",\n );\n const [aggregationPropertyName, aggregationOperation] = splitAggregation;\n let aggregationOperationDefinition: SelectedPropertyOperation;\n switch (aggregationOperation) {\n case \"sum\":\n case \"avg\":\n case \"min\":\n case \"max\":\n case \"exactDistinct\":\n case \"approximateDistinct\":\n aggregationOperationDefinition = {\n type: aggregationOperation,\n selectedPropertyApiName: aggregationPropertyName,\n };\n break;\n case \"approximatePercentile\":\n aggregationOperationDefinition = {\n type: \"approximatePercentile\",\n selectedPropertyApiName: aggregationPropertyName,\n approximatePercentile: opt?.percentile ?? .5,\n };\n break;\n case \"collectSet\":\n case \"collectList\":\n aggregationOperationDefinition = {\n type: aggregationOperation,\n selectedPropertyApiName: aggregationPropertyName,\n limit: opt?.limit ?? 100,\n };\n break;\n case undefined:\n if (aggregationPropertyName === \"$count\") {\n aggregationOperationDefinition = {\n type: \"count\",\n };\n break;\n }\n default:\n invariant(\n false,\n \"Invalid aggregation operation \" + aggregationOperation,\n );\n }\n const wrappedObjectSet: DerivedPropertyDefinition = {\n type: \"selection\",\n objectSet: objectSet,\n operation: aggregationOperationDefinition,\n };\n const selectorResult: DerivedProperty.Definition<any, any> =\n derivedPropertyDefinitionFactory(wrappedObjectSet, definitionMap);\n definitionMap.set(selectorResult, wrappedObjectSet);\n return selectorResult as any;\n },\n selectProperty: (name) => {\n if (fromBaseObjectSet) {\n const wrappedObjectSet: DerivedPropertyDefinition = {\n type: \"property\",\n apiName: name,\n };\n const selectorResult: DerivedProperty.Definition<any, any> =\n derivedPropertyDefinitionFactory(wrappedObjectSet, definitionMap);\n definitionMap.set(selectorResult, wrappedObjectSet);\n return selectorResult as any;\n }\n const wrappedObjectSet: DerivedPropertyDefinition = {\n type: \"selection\",\n objectSet: objectSet,\n operation: {\n type: \"get\",\n selectedPropertyApiName: name,\n },\n };\n const selectorResult: DerivedProperty.Definition<any, any> =\n derivedPropertyDefinitionFactory(wrappedObjectSet, definitionMap);\n definitionMap.set(selectorResult, wrappedObjectSet);\n return selectorResult as any;\n },\n constant: {\n double: (value) => {\n invariant(false, \"Not supported\");\n },\n integer: (value) => {\n invariant(false, \"Not supported\");\n },\n long: (value) => {\n invariant(false, \"Not supported\");\n },\n datetime: (value) => {\n invariant(false, \"Not supported\");\n },\n timestamp: (value) => {\n invariant(false, \"Not supported\");\n },\n },\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,yBAAyB,QAAQ,sDAAsD;AAChG,SAASC,gCAAgC,QAAQ,uCAAuC;AAQxF;AACA,OAAO,SAASC,6BAA6BA,CAG3CC,UAAa,EACbC,SAAwB,EACxBC,aAAkD,EAClDC,iBAA0B,GAAG,KAAK,EACd;EACpB,OAAO;IACLC,OAAO,EAAGC,IAAI,IAAK;MACjB,OAAON,6BAA6B,CAACC,UAAU,EAAE;QAC/CM,IAAI,EAAE,cAAc;QACpBL,SAAS;QACTI;MACF,CAAC,EAAEH,aAAa,CAAC;IACnB,CAAC;IACDK,KAAK,EAAGC,MAAM,IAAK;MACjB,MAAMC,QAAQ,GAAG,IAAIC,GAAG,CAACR,aAAa,CAACS,IAAI,CAAC,CAAC,CAAC;MAC9C,OAAOZ,6BAA6B,CAACC,UAAU,EAAE;QAC/CM,IAAI,EAAE,QAAQ;QACdL,SAAS,EAAEA,SAAS;QACpBM,KAAK,EAAEV,yBAAyB,CAACW,MAAM,EAAER,UAAU,EAAES,QAAQ;MAC/D,CAAC,EAAEP,aAAa,CAAC;IACnB,CAAC;IAC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AAxB,SAAS,QAAQ,eAAe,IAAhCA,SAAS;MACX,CAAC;MACD4C,QAAQ,EAAEA,CAAA,KAAW;QACnBtB,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAAxB,SAAS,QAAQ,eAAe,IAAhCA,SAAS;MACX,CAAC;MACD6C,SAAS,EAAEA,CAAA,KAAW;QACpBvB,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAAxB,SAAS,QAAQ,eAAe,IAAhCA,SAAS;MACX;IACF;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -49,12 +49,14 @@ describe("FetchMetadata", () => {
|
|
|
49
49
|
],
|
|
50
50
|
"interfaceMap": {
|
|
51
51
|
"FooInterface": {
|
|
52
|
+
"fooIdp": "office",
|
|
52
53
|
"fooSpt": "fullName",
|
|
53
54
|
},
|
|
54
55
|
},
|
|
55
56
|
"inverseInterfaceMap": {
|
|
56
57
|
"FooInterface": {
|
|
57
58
|
"fullName": "fooSpt",
|
|
59
|
+
"office": "fooIdp",
|
|
58
60
|
},
|
|
59
61
|
},
|
|
60
62
|
"links": {
|
|
@@ -85,6 +87,7 @@ describe("FetchMetadata", () => {
|
|
|
85
87
|
"multiplicity": false,
|
|
86
88
|
"nullable": true,
|
|
87
89
|
"type": "string",
|
|
90
|
+
"valueFormatting": undefined,
|
|
88
91
|
"valueTypeApiName": undefined,
|
|
89
92
|
},
|
|
90
93
|
"employeeId": {
|
|
@@ -93,6 +96,7 @@ describe("FetchMetadata", () => {
|
|
|
93
96
|
"multiplicity": false,
|
|
94
97
|
"nullable": false,
|
|
95
98
|
"type": "integer",
|
|
99
|
+
"valueFormatting": undefined,
|
|
96
100
|
"valueTypeApiName": undefined,
|
|
97
101
|
},
|
|
98
102
|
"employeeLocation": {
|
|
@@ -101,6 +105,7 @@ describe("FetchMetadata", () => {
|
|
|
101
105
|
"multiplicity": false,
|
|
102
106
|
"nullable": true,
|
|
103
107
|
"type": "geotimeSeriesReference",
|
|
108
|
+
"valueFormatting": undefined,
|
|
104
109
|
"valueTypeApiName": undefined,
|
|
105
110
|
},
|
|
106
111
|
"employeeSensor": {
|
|
@@ -109,6 +114,7 @@ describe("FetchMetadata", () => {
|
|
|
109
114
|
"multiplicity": false,
|
|
110
115
|
"nullable": true,
|
|
111
116
|
"type": "stringTimeseries",
|
|
117
|
+
"valueFormatting": undefined,
|
|
112
118
|
"valueTypeApiName": undefined,
|
|
113
119
|
},
|
|
114
120
|
"employeeStatus": {
|
|
@@ -117,6 +123,16 @@ describe("FetchMetadata", () => {
|
|
|
117
123
|
"multiplicity": false,
|
|
118
124
|
"nullable": true,
|
|
119
125
|
"type": "stringTimeseries",
|
|
126
|
+
"valueFormatting": undefined,
|
|
127
|
+
"valueTypeApiName": undefined,
|
|
128
|
+
},
|
|
129
|
+
"favoriteRestaurants": {
|
|
130
|
+
"description": undefined,
|
|
131
|
+
"displayName": undefined,
|
|
132
|
+
"multiplicity": true,
|
|
133
|
+
"nullable": true,
|
|
134
|
+
"type": "string",
|
|
135
|
+
"valueFormatting": undefined,
|
|
120
136
|
"valueTypeApiName": undefined,
|
|
121
137
|
},
|
|
122
138
|
"fullName": {
|
|
@@ -125,6 +141,7 @@ describe("FetchMetadata", () => {
|
|
|
125
141
|
"multiplicity": false,
|
|
126
142
|
"nullable": true,
|
|
127
143
|
"type": "string",
|
|
144
|
+
"valueFormatting": undefined,
|
|
128
145
|
"valueTypeApiName": undefined,
|
|
129
146
|
},
|
|
130
147
|
"office": {
|
|
@@ -134,6 +151,7 @@ describe("FetchMetadata", () => {
|
|
|
134
151
|
"multiplicity": false,
|
|
135
152
|
"nullable": true,
|
|
136
153
|
"type": "string",
|
|
154
|
+
"valueFormatting": undefined,
|
|
137
155
|
"valueTypeApiName": undefined,
|
|
138
156
|
},
|
|
139
157
|
"skillSet": {
|
|
@@ -142,6 +160,7 @@ describe("FetchMetadata", () => {
|
|
|
142
160
|
"multiplicity": false,
|
|
143
161
|
"nullable": true,
|
|
144
162
|
"type": "string",
|
|
163
|
+
"valueFormatting": undefined,
|
|
145
164
|
"valueTypeApiName": undefined,
|
|
146
165
|
},
|
|
147
166
|
"skillSetEmbedding": {
|
|
@@ -150,6 +169,7 @@ describe("FetchMetadata", () => {
|
|
|
150
169
|
"multiplicity": false,
|
|
151
170
|
"nullable": true,
|
|
152
171
|
"type": "vector",
|
|
172
|
+
"valueFormatting": undefined,
|
|
153
173
|
"valueTypeApiName": undefined,
|
|
154
174
|
},
|
|
155
175
|
"startDate": {
|
|
@@ -158,6 +178,7 @@ describe("FetchMetadata", () => {
|
|
|
158
178
|
"multiplicity": false,
|
|
159
179
|
"nullable": true,
|
|
160
180
|
"type": "datetime",
|
|
181
|
+
"valueFormatting": undefined,
|
|
161
182
|
"valueTypeApiName": undefined,
|
|
162
183
|
},
|
|
163
184
|
},
|
|
@@ -190,12 +211,22 @@ describe("FetchMetadata", () => {
|
|
|
190
211
|
},
|
|
191
212
|
},
|
|
192
213
|
"properties": {
|
|
214
|
+
"fooIdp": {
|
|
215
|
+
"description": "A Foo IDP",
|
|
216
|
+
"displayName": "Foo IDP",
|
|
217
|
+
"multiplicity": false,
|
|
218
|
+
"nullable": true,
|
|
219
|
+
"type": "string",
|
|
220
|
+
"valueFormatting": undefined,
|
|
221
|
+
"valueTypeApiName": undefined,
|
|
222
|
+
},
|
|
193
223
|
"fooSpt": {
|
|
194
224
|
"description": "A foo",
|
|
195
225
|
"displayName": "Foo",
|
|
196
226
|
"multiplicity": false,
|
|
197
227
|
"nullable": true,
|
|
198
228
|
"type": "string",
|
|
229
|
+
"valueFormatting": undefined,
|
|
199
230
|
"valueTypeApiName": undefined,
|
|
200
231
|
},
|
|
201
232
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchMetadata.test.js","names":["$Actions","$Interfaces","$Objects","$Queries","LegacyFauxFoundry","startNodeApiServer","beforeAll","describe","expect","expectTypeOf","it","createClient","client","testSetup","apiServer","close","objectMetadata","fetchMetadata","Employee","toEqualTypeOf","toMatchInlineSnapshot","interfaceMetadata","FooInterface","actionMetadata","moveOffice","queryMetadata","queryAcceptsObject"],"sources":["fetchMetadata.test.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionMetadata,\n InterfaceMetadata,\n ObjectMetadata,\n QueryMetadata,\n} from \"@osdk/api\";\nimport {\n $Actions,\n $Interfaces,\n $Objects,\n $Queries,\n} from \"@osdk/client.test.ontology\";\nimport { LegacyFauxFoundry, startNodeApiServer } from \"@osdk/shared.test\";\nimport { beforeAll, describe, expect, expectTypeOf, it } from \"vitest\";\nimport type { Client } from \"./Client.js\";\nimport { createClient } from \"./createClient.js\";\n\ndescribe(\"FetchMetadata\", () => {\n let client: Client;\n\n beforeAll(() => {\n const testSetup = startNodeApiServer(new LegacyFauxFoundry(), createClient);\n ({ client } = testSetup);\n return () => {\n testSetup.apiServer.close();\n };\n });\n\n it(\"fetches object metadata correctly\", async () => {\n const objectMetadata = await client.fetchMetadata($Objects.Employee);\n\n expectTypeOf(objectMetadata).toEqualTypeOf<\n ObjectMetadata\n >();\n\n expect(objectMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"Employee\",\n \"description\": \"A full-time or part-time \n\n employee of our firm\",\n \"displayName\": \"Employee\",\n \"icon\": {\n \"color\": \"blue\",\n \"name\": \"person\",\n \"type\": \"blueprint\",\n },\n \"implements\": [\n \"FooInterface\",\n ],\n \"interfaceMap\": {\n \"FooInterface\": {\n \"fooSpt\": \"fullName\",\n },\n },\n \"inverseInterfaceMap\": {\n \"FooInterface\": {\n \"fullName\": \"fooSpt\",\n },\n },\n \"links\": {\n \"lead\": {\n \"multiplicity\": false,\n \"targetType\": \"Employee\",\n },\n \"officeLink\": {\n \"multiplicity\": false,\n \"targetType\": \"Office\",\n },\n \"peeps\": {\n \"multiplicity\": true,\n \"targetType\": \"Employee\",\n },\n \"visitedOffices\": {\n \"multiplicity\": true,\n \"targetType\": \"Office\",\n },\n },\n \"pluralDisplayName\": \"Employees\",\n \"primaryKeyApiName\": \"employeeId\",\n \"primaryKeyType\": \"integer\",\n \"properties\": {\n \"class\": {\n \"description\": \"\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n \"valueTypeApiName\": undefined,\n },\n \"employeeId\": {\n \"description\": undefined,\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": false,\n \"type\": \"integer\",\n \"valueTypeApiName\": undefined,\n },\n \"employeeLocation\": {\n \"description\": \"Geotime series reference of the location of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"geotimeSeriesReference\",\n \"valueTypeApiName\": undefined,\n },\n \"employeeSensor\": {\n \"description\": \"TimeSeries sensor of the status of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"stringTimeseries\",\n \"valueTypeApiName\": undefined,\n },\n \"employeeStatus\": {\n \"description\": \"TimeSeries of the status of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"stringTimeseries\",\n \"valueTypeApiName\": undefined,\n },\n \"fullName\": {\n \"description\": undefined,\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n \"valueTypeApiName\": undefined,\n },\n \"office\": {\n \"description\": \"The unique \"ID\" of the employee's \\\\\"primary\\\\\" assigned office.\n This is some more text.\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n \"valueTypeApiName\": undefined,\n },\n \"skillSet\": {\n \"description\": \"The skills of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n \"valueTypeApiName\": undefined,\n },\n \"skillSetEmbedding\": {\n \"description\": \"Vectorized skill set\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"vector\",\n \"valueTypeApiName\": undefined,\n },\n \"startDate\": {\n \"description\": \"The date the employee was hired (most recently, if they were re-hired)\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"datetime\",\n \"valueTypeApiName\": undefined,\n },\n },\n \"rid\": \"ri.ontology.main.object-type.401ac022-89eb-4591-8b7e-0a912b9efb44\",\n \"status\": \"ACTIVE\",\n \"titleProperty\": \"fullName\",\n \"type\": \"object\",\n \"visibility\": \"NORMAL\",\n }\n `);\n });\n\n it(\"fetches interface metadata correctly\", async () => {\n const interfaceMetadata = await client.fetchMetadata(\n $Interfaces.FooInterface,\n );\n\n expectTypeOf(interfaceMetadata).toEqualTypeOf<\n InterfaceMetadata\n >();\n\n expect(interfaceMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"FooInterface\",\n \"description\": \"Interface for Foo\",\n \"displayName\": \"Foo Interface\",\n \"implementedBy\": [\n \"Employee\",\n \"Person\",\n ],\n \"implements\": [],\n \"links\": {\n \"toBar\": {\n \"multiplicity\": true,\n \"targetType\": \"interface\",\n \"targetTypeApiName\": \"BarInterface\",\n },\n },\n \"properties\": {\n \"fooSpt\": {\n \"description\": \"A foo\",\n \"displayName\": \"Foo\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n \"valueTypeApiName\": undefined,\n },\n },\n \"rid\": \"ri.interface.main.interface.1\",\n \"type\": \"interface\",\n }\n `);\n });\n\n it(\"fetches action metadata correctly\", async () => {\n const actionMetadata = await client.fetchMetadata(\n $Actions.moveOffice,\n );\n\n expectTypeOf(actionMetadata).toEqualTypeOf<ActionMetadata>();\n\n expect(actionMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"moveOffice\",\n \"description\": \"Update an office's physical location\",\n \"displayName\": \"move-office\",\n \"modifiedEntities\": {\n \"Office\": {\n \"created\": false,\n \"modified\": true,\n },\n },\n \"parameters\": {\n \"newAddress\": {\n \"description\": \"The office's new physical address (not necessarily shipping address)\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"newCapacity\": {\n \"description\": \"The maximum seated-at-desk capacity of the new office (maximum fire-safe capacity may be higher)\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"integer\",\n },\n \"officeId\": {\n \"description\": undefined,\n \"multiplicity\": false,\n \"nullable\": false,\n \"type\": \"string\",\n },\n \"officeNames\": {\n \"description\": \"A list of all office names\",\n \"multiplicity\": true,\n \"nullable\": true,\n \"type\": \"integer\",\n },\n },\n \"rid\": \"ri.ontology.main.action-type.9f84017d-cf17-4fa8-84c3-8e01e5d594f2\",\n \"status\": \"ACTIVE\",\n \"type\": \"action\",\n }\n `);\n });\n\n it(\"fetches query metadata correctly\", async () => {\n const queryMetadata = await client.fetchMetadata(\n $Queries.queryAcceptsObject,\n );\n\n expectTypeOf(queryMetadata).toEqualTypeOf<QueryMetadata>();\n\n expect(queryMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"queryAcceptsObject\",\n \"description\": \"description of the query that takes object types\",\n \"displayName\": \"QueryAcceptsObject\",\n \"output\": {\n \"nullable\": false,\n \"object\": \"Employee\",\n \"type\": \"object\",\n },\n \"parameters\": {\n \"object\": {\n \"description\": undefined,\n \"nullable\": false,\n \"object\": \"Employee\",\n \"type\": \"object\",\n },\n },\n \"rid\": \"ri.function-registry.main.function.9b55870a-63c7-4d48-8f06-9627c0805968\",\n \"type\": \"query\",\n \"version\": \"0.11.0\",\n }\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SACEA,QAAQ,EACRC,WAAW,EACXC,QAAQ,EACRC,QAAQ,QACH,4BAA4B;AACnC,SAASC,iBAAiB,EAAEC,kBAAkB,QAAQ,mBAAmB;AACzE,SAASC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAEC,EAAE,QAAQ,QAAQ;AAEtE,SAASC,YAAY,QAAQ,mBAAmB;AAEhDJ,QAAQ,CAAC,eAAe,EAAE,MAAM;EAC9B,IAAIK,MAAc;EAElBN,SAAS,CAAC,MAAM;IACd,MAAMO,SAAS,GAAGR,kBAAkB,CAAC,IAAID,iBAAiB,CAAC,CAAC,EAAEO,YAAY,CAAC;IAC3E,CAAC;MAAEC;IAAO,CAAC,GAAGC,SAAS;IACvB,OAAO,MAAM;MACXA,SAAS,CAACC,SAAS,CAACC,KAAK,CAAC,CAAC;IAC7B,CAAC;EACH,CAAC,CAAC;EAEFL,EAAE,CAAC,mCAAmC,EAAE,YAAY;IAClD,MAAMM,cAAc,GAAG,MAAMJ,MAAM,CAACK,aAAa,CAACf,QAAQ,CAACgB,QAAQ,CAAC;IAEpET,YAAY,CAACO,cAAc,CAAC,CAACG,aAAa,CAExC,CAAC;IAEHX,MAAM,CAACQ,cAAc,CAAC,CAACI,qBAAqB,CAAC;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEFV,EAAE,CAAC,sCAAsC,EAAE,YAAY;IACrD,MAAMW,iBAAiB,GAAG,MAAMT,MAAM,CAACK,aAAa,CAClDhB,WAAW,CAACqB,YACd,CAAC;IAEDb,YAAY,CAACY,iBAAiB,CAAC,CAACF,aAAa,CAE3C,CAAC;IAEHX,MAAM,CAACa,iBAAiB,CAAC,CAACD,qBAAqB,CAAC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEFV,EAAE,CAAC,mCAAmC,EAAE,YAAY;IAClD,MAAMa,cAAc,GAAG,MAAMX,MAAM,CAACK,aAAa,CAC/CjB,QAAQ,CAACwB,UACX,CAAC;IAEDf,YAAY,CAACc,cAAc,CAAC,CAACJ,aAAa,CAAiB,CAAC;IAE5DX,MAAM,CAACe,cAAc,CAAC,CAACH,qBAAqB,CAAC;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEFV,EAAE,CAAC,kCAAkC,EAAE,YAAY;IACjD,MAAMe,aAAa,GAAG,MAAMb,MAAM,CAACK,aAAa,CAC9Cd,QAAQ,CAACuB,kBACX,CAAC;IAEDjB,YAAY,CAACgB,aAAa,CAAC,CAACN,aAAa,CAAgB,CAAC;IAE1DX,MAAM,CAACiB,aAAa,CAAC,CAACL,qBAAqB,CAAC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"fetchMetadata.test.js","names":["$Actions","$Interfaces","$Objects","$Queries","LegacyFauxFoundry","startNodeApiServer","beforeAll","describe","expect","expectTypeOf","it","createClient","client","testSetup","apiServer","close","objectMetadata","fetchMetadata","Employee","toEqualTypeOf","toMatchInlineSnapshot","interfaceMetadata","FooInterface","actionMetadata","moveOffice","queryMetadata","queryAcceptsObject"],"sources":["fetchMetadata.test.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionMetadata,\n InterfaceMetadata,\n ObjectMetadata,\n QueryMetadata,\n} from \"@osdk/api\";\nimport {\n $Actions,\n $Interfaces,\n $Objects,\n $Queries,\n} from \"@osdk/client.test.ontology\";\nimport { LegacyFauxFoundry, startNodeApiServer } from \"@osdk/shared.test\";\nimport { beforeAll, describe, expect, expectTypeOf, it } from \"vitest\";\nimport type { Client } from \"./Client.js\";\nimport { createClient } from \"./createClient.js\";\n\ndescribe(\"FetchMetadata\", () => {\n let client: Client;\n\n beforeAll(() => {\n const testSetup = startNodeApiServer(new LegacyFauxFoundry(), createClient);\n ({ client } = testSetup);\n return () => {\n testSetup.apiServer.close();\n };\n });\n\n it(\"fetches object metadata correctly\", async () => {\n const objectMetadata = await client.fetchMetadata($Objects.Employee);\n\n expectTypeOf(objectMetadata).toEqualTypeOf<\n ObjectMetadata\n >();\n\n expect(objectMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"Employee\",\n \"description\": \"A full-time or part-time \n\n employee of our firm\",\n \"displayName\": \"Employee\",\n \"icon\": {\n \"color\": \"blue\",\n \"name\": \"person\",\n \"type\": \"blueprint\",\n },\n \"implements\": [\n \"FooInterface\",\n ],\n \"interfaceMap\": {\n \"FooInterface\": {\n \"fooIdp\": \"office\",\n \"fooSpt\": \"fullName\",\n },\n },\n \"inverseInterfaceMap\": {\n \"FooInterface\": {\n \"fullName\": \"fooSpt\",\n \"office\": \"fooIdp\",\n },\n },\n \"links\": {\n \"lead\": {\n \"multiplicity\": false,\n \"targetType\": \"Employee\",\n },\n \"officeLink\": {\n \"multiplicity\": false,\n \"targetType\": \"Office\",\n },\n \"peeps\": {\n \"multiplicity\": true,\n \"targetType\": \"Employee\",\n },\n \"visitedOffices\": {\n \"multiplicity\": true,\n \"targetType\": \"Office\",\n },\n },\n \"pluralDisplayName\": \"Employees\",\n \"primaryKeyApiName\": \"employeeId\",\n \"primaryKeyType\": \"integer\",\n \"properties\": {\n \"class\": {\n \"description\": \"\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"employeeId\": {\n \"description\": undefined,\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": false,\n \"type\": \"integer\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"employeeLocation\": {\n \"description\": \"Geotime series reference of the location of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"geotimeSeriesReference\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"employeeSensor\": {\n \"description\": \"TimeSeries sensor of the status of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"stringTimeseries\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"employeeStatus\": {\n \"description\": \"TimeSeries of the status of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"stringTimeseries\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"favoriteRestaurants\": {\n \"description\": undefined,\n \"displayName\": undefined,\n \"multiplicity\": true,\n \"nullable\": true,\n \"type\": \"string\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"fullName\": {\n \"description\": undefined,\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"office\": {\n \"description\": \"The unique \"ID\" of the employee's \\\\\"primary\\\\\" assigned office.\n This is some more text.\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"skillSet\": {\n \"description\": \"The skills of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"skillSetEmbedding\": {\n \"description\": \"Vectorized skill set\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"vector\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"startDate\": {\n \"description\": \"The date the employee was hired (most recently, if they were re-hired)\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"datetime\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n },\n \"rid\": \"ri.ontology.main.object-type.401ac022-89eb-4591-8b7e-0a912b9efb44\",\n \"status\": \"ACTIVE\",\n \"titleProperty\": \"fullName\",\n \"type\": \"object\",\n \"visibility\": \"NORMAL\",\n }\n `);\n });\n\n it(\"fetches interface metadata correctly\", async () => {\n const interfaceMetadata = await client.fetchMetadata(\n $Interfaces.FooInterface,\n );\n\n expectTypeOf(interfaceMetadata).toEqualTypeOf<\n InterfaceMetadata\n >();\n\n expect(interfaceMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"FooInterface\",\n \"description\": \"Interface for Foo\",\n \"displayName\": \"Foo Interface\",\n \"implementedBy\": [\n \"Employee\",\n \"Person\",\n ],\n \"implements\": [],\n \"links\": {\n \"toBar\": {\n \"multiplicity\": true,\n \"targetType\": \"interface\",\n \"targetTypeApiName\": \"BarInterface\",\n },\n },\n \"properties\": {\n \"fooIdp\": {\n \"description\": \"A Foo IDP\",\n \"displayName\": \"Foo IDP\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n \"fooSpt\": {\n \"description\": \"A foo\",\n \"displayName\": \"Foo\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n \"valueFormatting\": undefined,\n \"valueTypeApiName\": undefined,\n },\n },\n \"rid\": \"ri.interface.main.interface.1\",\n \"type\": \"interface\",\n }\n `);\n });\n\n it(\"fetches action metadata correctly\", async () => {\n const actionMetadata = await client.fetchMetadata(\n $Actions.moveOffice,\n );\n\n expectTypeOf(actionMetadata).toEqualTypeOf<ActionMetadata>();\n\n expect(actionMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"moveOffice\",\n \"description\": \"Update an office's physical location\",\n \"displayName\": \"move-office\",\n \"modifiedEntities\": {\n \"Office\": {\n \"created\": false,\n \"modified\": true,\n },\n },\n \"parameters\": {\n \"newAddress\": {\n \"description\": \"The office's new physical address (not necessarily shipping address)\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"newCapacity\": {\n \"description\": \"The maximum seated-at-desk capacity of the new office (maximum fire-safe capacity may be higher)\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"integer\",\n },\n \"officeId\": {\n \"description\": undefined,\n \"multiplicity\": false,\n \"nullable\": false,\n \"type\": \"string\",\n },\n \"officeNames\": {\n \"description\": \"A list of all office names\",\n \"multiplicity\": true,\n \"nullable\": true,\n \"type\": \"integer\",\n },\n },\n \"rid\": \"ri.ontology.main.action-type.9f84017d-cf17-4fa8-84c3-8e01e5d594f2\",\n \"status\": \"ACTIVE\",\n \"type\": \"action\",\n }\n `);\n });\n\n it(\"fetches query metadata correctly\", async () => {\n const queryMetadata = await client.fetchMetadata(\n $Queries.queryAcceptsObject,\n );\n\n expectTypeOf(queryMetadata).toEqualTypeOf<QueryMetadata>();\n\n expect(queryMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"queryAcceptsObject\",\n \"description\": \"description of the query that takes object types\",\n \"displayName\": \"QueryAcceptsObject\",\n \"output\": {\n \"nullable\": false,\n \"object\": \"Employee\",\n \"type\": \"object\",\n },\n \"parameters\": {\n \"object\": {\n \"description\": undefined,\n \"nullable\": false,\n \"object\": \"Employee\",\n \"type\": \"object\",\n },\n },\n \"rid\": \"ri.function-registry.main.function.9b55870a-63c7-4d48-8f06-9627c0805968\",\n \"type\": \"query\",\n \"version\": \"0.11.0\",\n }\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SACEA,QAAQ,EACRC,WAAW,EACXC,QAAQ,EACRC,QAAQ,QACH,4BAA4B;AACnC,SAASC,iBAAiB,EAAEC,kBAAkB,QAAQ,mBAAmB;AACzE,SAASC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAEC,EAAE,QAAQ,QAAQ;AAEtE,SAASC,YAAY,QAAQ,mBAAmB;AAEhDJ,QAAQ,CAAC,eAAe,EAAE,MAAM;EAC9B,IAAIK,MAAc;EAElBN,SAAS,CAAC,MAAM;IACd,MAAMO,SAAS,GAAGR,kBAAkB,CAAC,IAAID,iBAAiB,CAAC,CAAC,EAAEO,YAAY,CAAC;IAC3E,CAAC;MAAEC;IAAO,CAAC,GAAGC,SAAS;IACvB,OAAO,MAAM;MACXA,SAAS,CAACC,SAAS,CAACC,KAAK,CAAC,CAAC;IAC7B,CAAC;EACH,CAAC,CAAC;EAEFL,EAAE,CAAC,mCAAmC,EAAE,YAAY;IAClD,MAAMM,cAAc,GAAG,MAAMJ,MAAM,CAACK,aAAa,CAACf,QAAQ,CAACgB,QAAQ,CAAC;IAEpET,YAAY,CAACO,cAAc,CAAC,CAACG,aAAa,CAExC,CAAC;IAEHX,MAAM,CAACQ,cAAc,CAAC,CAACI,qBAAqB,CAAC;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEFV,EAAE,CAAC,sCAAsC,EAAE,YAAY;IACrD,MAAMW,iBAAiB,GAAG,MAAMT,MAAM,CAACK,aAAa,CAClDhB,WAAW,CAACqB,YACd,CAAC;IAEDb,YAAY,CAACY,iBAAiB,CAAC,CAACF,aAAa,CAE3C,CAAC;IAEHX,MAAM,CAACa,iBAAiB,CAAC,CAACD,qBAAqB,CAAC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEFV,EAAE,CAAC,mCAAmC,EAAE,YAAY;IAClD,MAAMa,cAAc,GAAG,MAAMX,MAAM,CAACK,aAAa,CAC/CjB,QAAQ,CAACwB,UACX,CAAC;IAEDf,YAAY,CAACc,cAAc,CAAC,CAACJ,aAAa,CAAiB,CAAC;IAE5DX,MAAM,CAACe,cAAc,CAAC,CAACH,qBAAqB,CAAC;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEFV,EAAE,CAAC,kCAAkC,EAAE,YAAY;IACjD,MAAMe,aAAa,GAAG,MAAMb,MAAM,CAACK,aAAa,CAC9Cd,QAAQ,CAACuB,kBACX,CAAC;IAEDjB,YAAY,CAACgB,aAAa,CAAC,CAACN,aAAa,CAAgB,CAAC;IAE1DX,MAAM,CAACiB,aAAa,CAAC,CAACL,qBAAqB,CAAC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -112,7 +112,7 @@ describe("intellisense", () => {
|
|
|
112
112
|
offset: 15,
|
|
113
113
|
triggerKind: ts.CompletionTriggerKind.Invoked
|
|
114
114
|
});
|
|
115
|
-
expect(resp.body?.entries.map(e => e.name)).toEqual(["class", "employeeId", "employeeLocation", "employeeSensor", "employeeStatus", "fullName", "office", "skillSet", "skillSetEmbedding", "startDate"]);
|
|
115
|
+
expect(resp.body?.entries.map(e => e.name)).toEqual(["class", "employeeId", "employeeLocation", "employeeSensor", "employeeStatus", "favoriteRestaurants", "fullName", "office", "skillSet", "skillSetEmbedding", "startDate"]);
|
|
116
116
|
const {
|
|
117
117
|
resp: resp2
|
|
118
118
|
} = await tsServer.sendQuickInfoRequest({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intellisense.test.js","names":["findUpSync","path","invariant","ts","afterEach","beforeAll","beforeEach","describe","expect","it","vi","startTsServer","rootLogger","hoisted","pino","pinoPretty","EventEmitter","Promise","resolve","level","build","sync","timestampKey","undefined","errorLikeObjectKeys","errorProps","ignore","destination","write","a","at","slice","console","log","packagesDir","clientPackagePath","clientsPackageJson","cwd","import","meta","dirname","process","env","NODE_ENV","join","tsServer","intellisenseFilePath","task","name","sys","fileExists","toBeTruthy","sendOpenRequest","file","stop","timeout","resp","sendQuickInfoRequest","line","offset","body","documentation","toMatchInlineSnapshot","sendCompletionsRequest","triggerKind","CompletionTriggerKind","Invoked","entries","map","e","toEqual","resp2","not","resp3"],"sources":["intellisense.test.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Logger } from \"@osdk/api\";\nimport { findUpSync } from \"find-up\";\nimport * as path from \"node:path\";\nimport invariant from \"tiny-invariant\";\nimport * as ts from \"typescript\";\nimport {\n afterEach,\n beforeAll,\n beforeEach,\n describe,\n expect,\n it,\n vi,\n} from \"vitest\";\nimport type { TsServer } from \"./tsserver.js\";\nimport { startTsServer } from \"./tsserver.js\";\n\n// it needs to be hoisted because its referenced from our mocked WebSocket\n// which must be hoisted to work\nconst rootLogger = await vi.hoisted(async (): Promise<Logger> => {\n const pino = (await import(\"pino\")).pino;\n const pinoPretty = await import(\"pino-pretty\");\n const { EventEmitter } = await import(\"node:events\");\n class PinoConsoleLogDestination extends EventEmitter {\n write(a: string) {\n // remove trailing newline since console.log adds one\n if (a.at(-1) === \"\\n\") a = a.slice(0, -1);\n\n // This lets the test framework aggregate the logs per test, whereas direct to stdout does not\n console.log(a);\n }\n }\n return Promise.resolve(pino(\n { level: \"info\" },\n (pinoPretty.build)({\n sync: true,\n timestampKey: undefined,\n errorLikeObjectKeys: [\"error\", \"err\", \"exception\"],\n errorProps: \"stack,cause,properties\",\n ignore: \"time,hostname,pid\",\n destination: new PinoConsoleLogDestination(),\n }),\n ));\n});\n\ndescribe(\"intellisense\", () => {\n let packagesDir: string;\n let clientPackagePath: string;\n\n beforeAll(() => {\n const clientsPackageJson = findUpSync(\"package.json\", {\n cwd: import.meta.dirname,\n });\n console.log({ clientsPackageJson });\n invariant(clientsPackageJson != null);\n packagesDir = path.join(\n path.dirname(clientsPackageJson),\n \"..\",\n );\n\n clientPackagePath = path.join(packagesDir, \"client\");\n });\n\n let tsServer: TsServer;\n let intellisenseFilePath: string;\n\n beforeEach(async (a) => {\n intellisenseFilePath = path.join(\n clientPackagePath,\n \"src\",\n \"intellisense.test.helpers\",\n `${a.task.name}.ts`,\n );\n\n console.log(intellisenseFilePath);\n\n expect(ts.sys.fileExists(intellisenseFilePath)).toBeTruthy();\n\n tsServer = await startTsServer(rootLogger);\n await tsServer.sendOpenRequest({ file: intellisenseFilePath });\n });\n\n afterEach(async () => {\n tsServer.stop();\n tsServer = undefined as any;\n });\n\n it(\"callsQueryAcceptsObject\", { timeout: 40_000 }, async () => {\n const { resp } = await tsServer.sendQuickInfoRequest({\n file: intellisenseFilePath,\n line: 27,\n offset: 6,\n });\n expect(resp.body?.documentation).toMatchInlineSnapshot(\n `\"(no ontology metadata)\"`,\n );\n });\n\n it(\"showsObjectPropertyJsdoc\", { timeout: 40_000 }, async () => {\n const { resp } = await tsServer.sendQuickInfoRequest({\n file: intellisenseFilePath,\n line: 26,\n offset: 13,\n });\n expect(resp.body?.documentation).toMatchInlineSnapshot(\n `\"description: Geotime series reference of the location of the employee\"`,\n );\n });\n\n it(\"orderBySuggestionIsRight\", { timeout: 40_000 }, async () => {\n const { resp } = await tsServer.sendCompletionsRequest({\n file: intellisenseFilePath,\n line: 29,\n offset: 15,\n triggerKind: ts.CompletionTriggerKind.Invoked,\n });\n expect(resp.body?.entries.map(e => e.name)).toEqual([\n \"class\",\n \"employeeId\",\n \"employeeLocation\",\n \"employeeSensor\",\n \"employeeStatus\",\n \"fullName\",\n \"office\",\n \"skillSet\",\n \"skillSetEmbedding\",\n \"startDate\",\n ]);\n\n const { resp: resp2 } = await tsServer.sendQuickInfoRequest({\n file: intellisenseFilePath,\n line: 33,\n offset: 3,\n });\n expect(resp2.body?.documentation).not.toEqual(\"'(property) $orderBy: any'\");\n\n // order by relevance\n const { resp: resp3 } = await tsServer.sendCompletionsRequest({\n file: intellisenseFilePath,\n line: 39,\n offset: 14,\n triggerKind: ts.CompletionTriggerKind.Invoked,\n });\n\n expect(resp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CAClD,OAAO,EACP,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,QAAQ,EACR,UAAU,EACV,mBAAmB,EACnB,WAAW,CACZ,CAAC;IAEF,MAAM;MAAEd,IAAI,EAAEe;IAAM,CAAC,GAAG,MAAM1B,QAAQ,CAACY,oBAAoB,CAAC;MAC1DJ,IAAI,EAAEP,oBAAoB;MAC1BY,IAAI,EAAE,EAAE;MACRC,MAAM,EAAE;IACV,CAAC,CAAC;IACFnD,MAAM,CAAC+D,KAAK,CAACX,IAAI,EAAEC,aAAa,CAAC,CAACW,GAAG,CAACF,OAAO,CAAC,4BAA4B,CAAC;;IAE3E;IACA,MAAM;MAAEd,IAAI,EAAEiB;IAAM,CAAC,GAAG,MAAM5B,QAAQ,CAACkB,sBAAsB,CAAC;MAC5DV,IAAI,EAAEP,oBAAoB;MAC1BY,IAAI,EAAE,EAAE;MACRC,MAAM,EAAE,EAAE;MACVK,WAAW,EAAE7D,EAAE,CAAC8D,qBAAqB,CAACC;IACxC,CAAC,CAAC;IAEF1D,MAAM,CAACiE,KAAK,CAACb,IAAI,EAAEO,OAAO,CAACC,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACrB,IAAI,CAAC,CAAC,CAACsB,OAAO,CAAC,CACnD,WAAW,CACZ,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"intellisense.test.js","names":["findUpSync","path","invariant","ts","afterEach","beforeAll","beforeEach","describe","expect","it","vi","startTsServer","rootLogger","hoisted","pino","pinoPretty","EventEmitter","Promise","resolve","level","build","sync","timestampKey","undefined","errorLikeObjectKeys","errorProps","ignore","destination","write","a","at","slice","console","log","packagesDir","clientPackagePath","clientsPackageJson","cwd","import","meta","dirname","process","env","NODE_ENV","join","tsServer","intellisenseFilePath","task","name","sys","fileExists","toBeTruthy","sendOpenRequest","file","stop","timeout","resp","sendQuickInfoRequest","line","offset","body","documentation","toMatchInlineSnapshot","sendCompletionsRequest","triggerKind","CompletionTriggerKind","Invoked","entries","map","e","toEqual","resp2","not","resp3"],"sources":["intellisense.test.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Logger } from \"@osdk/api\";\nimport { findUpSync } from \"find-up\";\nimport * as path from \"node:path\";\nimport invariant from \"tiny-invariant\";\nimport * as ts from \"typescript\";\nimport {\n afterEach,\n beforeAll,\n beforeEach,\n describe,\n expect,\n it,\n vi,\n} from \"vitest\";\nimport type { TsServer } from \"./tsserver.js\";\nimport { startTsServer } from \"./tsserver.js\";\n\n// it needs to be hoisted because its referenced from our mocked WebSocket\n// which must be hoisted to work\nconst rootLogger = await vi.hoisted(async (): Promise<Logger> => {\n const pino = (await import(\"pino\")).pino;\n const pinoPretty = await import(\"pino-pretty\");\n const { EventEmitter } = await import(\"node:events\");\n class PinoConsoleLogDestination extends EventEmitter {\n write(a: string) {\n // remove trailing newline since console.log adds one\n if (a.at(-1) === \"\\n\") a = a.slice(0, -1);\n\n // This lets the test framework aggregate the logs per test, whereas direct to stdout does not\n console.log(a);\n }\n }\n return Promise.resolve(pino(\n { level: \"info\" },\n (pinoPretty.build)({\n sync: true,\n timestampKey: undefined,\n errorLikeObjectKeys: [\"error\", \"err\", \"exception\"],\n errorProps: \"stack,cause,properties\",\n ignore: \"time,hostname,pid\",\n destination: new PinoConsoleLogDestination(),\n }),\n ));\n});\n\ndescribe(\"intellisense\", () => {\n let packagesDir: string;\n let clientPackagePath: string;\n\n beforeAll(() => {\n const clientsPackageJson = findUpSync(\"package.json\", {\n cwd: import.meta.dirname,\n });\n console.log({ clientsPackageJson });\n invariant(clientsPackageJson != null);\n packagesDir = path.join(\n path.dirname(clientsPackageJson),\n \"..\",\n );\n\n clientPackagePath = path.join(packagesDir, \"client\");\n });\n\n let tsServer: TsServer;\n let intellisenseFilePath: string;\n\n beforeEach(async (a) => {\n intellisenseFilePath = path.join(\n clientPackagePath,\n \"src\",\n \"intellisense.test.helpers\",\n `${a.task.name}.ts`,\n );\n\n console.log(intellisenseFilePath);\n\n expect(ts.sys.fileExists(intellisenseFilePath)).toBeTruthy();\n\n tsServer = await startTsServer(rootLogger);\n await tsServer.sendOpenRequest({ file: intellisenseFilePath });\n });\n\n afterEach(async () => {\n tsServer.stop();\n tsServer = undefined as any;\n });\n\n it(\"callsQueryAcceptsObject\", { timeout: 40_000 }, async () => {\n const { resp } = await tsServer.sendQuickInfoRequest({\n file: intellisenseFilePath,\n line: 27,\n offset: 6,\n });\n expect(resp.body?.documentation).toMatchInlineSnapshot(\n `\"(no ontology metadata)\"`,\n );\n });\n\n it(\"showsObjectPropertyJsdoc\", { timeout: 40_000 }, async () => {\n const { resp } = await tsServer.sendQuickInfoRequest({\n file: intellisenseFilePath,\n line: 26,\n offset: 13,\n });\n expect(resp.body?.documentation).toMatchInlineSnapshot(\n `\"description: Geotime series reference of the location of the employee\"`,\n );\n });\n\n it(\"orderBySuggestionIsRight\", { timeout: 40_000 }, async () => {\n const { resp } = await tsServer.sendCompletionsRequest({\n file: intellisenseFilePath,\n line: 29,\n offset: 15,\n triggerKind: ts.CompletionTriggerKind.Invoked,\n });\n expect(resp.body?.entries.map(e => e.name)).toEqual([\n \"class\",\n \"employeeId\",\n \"employeeLocation\",\n \"employeeSensor\",\n \"employeeStatus\",\n \"favoriteRestaurants\",\n \"fullName\",\n \"office\",\n \"skillSet\",\n \"skillSetEmbedding\",\n \"startDate\",\n ]);\n\n const { resp: resp2 } = await tsServer.sendQuickInfoRequest({\n file: intellisenseFilePath,\n line: 33,\n offset: 3,\n });\n expect(resp2.body?.documentation).not.toEqual(\"'(property) $orderBy: any'\");\n\n // order by relevance\n const { resp: resp3 } = await tsServer.sendCompletionsRequest({\n file: intellisenseFilePath,\n line: 39,\n offset: 14,\n triggerKind: ts.CompletionTriggerKind.Invoked,\n });\n\n expect(resp3.body?.entries.map(e => e.name)).toEqual([\n \"relevance\",\n ]);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,UAAU,QAAQ,SAAS;AACpC,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,OAAOC,SAAS,MAAM,gBAAgB;AACtC,OAAO,KAAKC,EAAE,MAAM,YAAY;AAChC,SACEC,SAAS,EACTC,SAAS,EACTC,UAAU,EACVC,QAAQ,EACRC,MAAM,EACNC,EAAE,EACFC,EAAE,QACG,QAAQ;AAEf,SAASC,aAAa,QAAQ,eAAe;;AAE7C;AACA;AACA,MAAMC,UAAU,GAAG,MAAMF,EAAE,CAACG,OAAO,CAAC,YAA6B;EAC/D,MAAMC,IAAI,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,EAAEA,IAAI;EACxC,MAAMC,UAAU,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC;EAC9C,MAAM;IAAEC;EAAa,CAAC,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC;EAUpD,OAAOC,OAAO,CAACC,OAAO,CAACJ,IAAI,CACzB;IAAEK,KAAK,EAAE;EAAO,CAAC,EAChBJ,UAAU,CAACK,KAAK,CAAE;IACjBC,IAAI,EAAE,IAAI;IACVC,YAAY,EAAEC,SAAS;IACvBC,mBAAmB,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,WAAW,CAAC;IAClDC,UAAU,EAAE,wBAAwB;IACpCC,MAAM,EAAE,mBAAmB;IAC3BC,WAAW,EAAE,IAjBjB,cAAwCX,YAAY,CAAC;MACnDY,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E;MACVK,WAAW,EAAE7D,EAAE,CAAC8D,qBAAqB,CAACC;IACxC,CAAC,CAAC;IACF1D,MAAM,CAACgD,IAAI,CAACI,IAAI,EAAEO,OAAO,CAACC,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACrB,IAAI,CAAC,CAAC,CAACsB,OAAO,CAAC,CAClD,OAAO,EACP,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,EACrB,UAAU,EACV,QAAQ,EACR,UAAU,EACV,mBAAmB,EACnB,WAAW,CACZ,CAAC;IAEF,MAAM;MAAEd,IAAI,EAAEe;IAAM,CAAC,GAAG,MAAM1B,QAAQ,CAACY,oBAAoB,CAAC;MAC1DJ,IAAI,EAAEP,oBAAoB;MAC1BY,IAAI,EAAE,EAAE;MACRC,MAAM,EAAE;IACV,CAAC,CAAC;IACFnD,MAAM,CAAC+D,KAAK,CAACX,IAAI,EAAEC,aAAa,CAAC,CAACW,GAAG,CAACF,OAAO,CAAC,4BAA4B,CAAC;;IAE3E;IACA,MAAM;MAAEd,IAAI,EAAEiB;IAAM,CAAC,GAAG,MAAM5B,QAAQ,CAACkB,sBAAsB,CAAC;MAC5DV,IAAI,EAAEP,oBAAoB;MAC1BY,IAAI,EAAE,EAAE;MACRC,MAAM,EAAE,EAAE;MACVK,WAAW,EAAE7D,EAAE,CAAC8D,qBAAqB,CAACC;IACxC,CAAC,CAAC;IAEF1D,MAAM,CAACiE,KAAK,CAACb,IAAI,EAAEO,OAAO,CAACC,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACrB,IAAI,CAAC,CAAC,CAACsB,OAAO,CAAC,CACnD,WAAW,CACZ,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate.js","names":["OntologiesV2","invariant","legacyToModernSingleAggregationResult","modernToLegacyAggregationClause","modernToLegacyGroupByClause","addUserAgentAndRequestContextHeaders","resolveBaseObjectSetType","aggregate","clientCtx","objectType","objectSet","req","body","aggregation","$select","groupBy","where","undefined","$groupBy","flushEdits","result","OntologyObjectSets","ontologyRid","transactionId","data","length","process","env","NODE_ENV","aggregationToCountResult","ret","map","entry","$group","group","aggregateResult","metrics","name","$count","value"],"sources":["aggregate.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n AggregateOpts,\n AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy,\n AggregationResultsWithGroups,\n AggregationsResults,\n ObjectOrInterfaceDefinition,\n} from \"@osdk/api\";\nimport type {\n AggregateObjectsRequestV2,\n AggregateObjectsResponseV2,\n ObjectSet,\n} from \"@osdk/foundry.ontologies\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport { legacyToModernSingleAggregationResult } from \"../internal/conversions/legacyToModernSingleAggregationResult.js\";\nimport { modernToLegacyAggregationClause } from \"../internal/conversions/modernToLegacyAggregationClause.js\";\nimport { modernToLegacyGroupByClause } from \"../internal/conversions/modernToLegacyGroupByClause.js\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\nimport type { ArrayElement } from \"../util/ArrayElement.js\";\nimport { resolveBaseObjectSetType } from \"../util/objectSetUtils.js\";\n\n/** @internal */\nexport async function aggregate<\n Q extends ObjectOrInterfaceDefinition,\n AO extends AggregateOpts<Q>,\n>(\n clientCtx: MinimalClient,\n objectType: Q,\n objectSet: ObjectSet = resolveBaseObjectSetType(objectType),\n req: AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy<Q, AO>,\n): Promise<AggregationsResults<Q, AO>> {\n const resolvedObjectSet = resolveBaseObjectSetType(objectType);\n const body: AggregateObjectsRequestV2 = {\n aggregation: modernToLegacyAggregationClause<AO[\"$select\"]>(\n req.$select,\n ),\n groupBy: [],\n where: undefined,\n };\n\n if (req.$groupBy) {\n body.groupBy = modernToLegacyGroupByClause(req.$groupBy);\n }\n\n if (clientCtx.flushEdits != null) {\n await clientCtx.flushEdits();\n }\n\n const result = await OntologiesV2.OntologyObjectSets.aggregate(\n addUserAgentAndRequestContextHeaders(clientCtx, objectType),\n await clientCtx.ontologyRid,\n {\n objectSet,\n groupBy: body.groupBy,\n aggregation: body.aggregation,\n },\n { transactionId: clientCtx.transactionId },\n );\n\n if (!req.$groupBy) {\n invariant(\n result.data.length === 1,\n \"no group by clause should mean only one data result\",\n );\n\n return {\n ...aggregationToCountResult(result.data[0]),\n ...legacyToModernSingleAggregationResult(\n result.data[0],\n ),\n } as any;\n }\n\n const ret: AggregationResultsWithGroups<Q, AO[\"$select\"], any> = result.data\n .map((entry) => {\n return {\n $group: entry.group as any,\n ...aggregationToCountResult(entry),\n ...legacyToModernSingleAggregationResult(entry),\n };\n }) as any; // fixme\n\n return ret as any; // FIXME\n}\n\nfunction aggregationToCountResult(\n entry: ArrayElement<AggregateObjectsResponseV2[\"data\"]>,\n): { $count: number } | undefined {\n for (const aggregateResult of entry.metrics) {\n if (aggregateResult.name === \"count\") {\n return { $count: aggregateResult.value };\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAcA,OAAO,KAAKA,YAAY,MAAM,0BAA0B;AACxD,OAAOC,SAAS,MAAM,gBAAgB;AACtC,SAASC,qCAAqC,QAAQ,kEAAkE;AACxH,SAASC,+BAA+B,QAAQ,4DAA4D;AAC5G,SAASC,2BAA2B,QAAQ,wDAAwD;AAEpG,SAASC,oCAAoC,QAAQ,iDAAiD;AAEtG,SAASC,wBAAwB,QAAQ,2BAA2B;;AAEpE;AACA,OAAO,eAAeC,SAASA,CAI7BC,SAAwB,EACxBC,UAAa,EACbC,SAAoB,GAAGJ,wBAAwB,CAACG,UAAU,CAAC,EAC3DE,GAA0E,EACrC;EACXL,wBAAwB,CAACG,UAAU,CAAC;EAC9D,MAAMG,IAA+B,GAAG;IACtCC,WAAW,EAAEV,+BAA+B,CAC1CQ,GAAG,CAACG,OACN,CAAC;IACDC,OAAO,EAAE,EAAE;IACXC,KAAK,EAAEC;EACT,CAAC;EAED,IAAIN,GAAG,CAACO,QAAQ,EAAE;IAChBN,IAAI,CAACG,OAAO,GAAGX,2BAA2B,CAACO,GAAG,CAACO,QAAQ,CAAC;EAC1D;EAEA,IAAIV,SAAS,CAACW,UAAU,IAAI,IAAI,EAAE;IAChC,MAAMX,SAAS,CAACW,UAAU,CAAC,CAAC;EAC9B;EAEA,MAAMC,MAAM,GAAG,MAAMpB,YAAY,CAACqB,kBAAkB,CAACd,SAAS,CAC5DF,oCAAoC,CAACG,SAAS,EAAEC,UAAU,CAAC,EAC3D,MAAMD,SAAS,CAACc,WAAW,EAC3B;IACEZ,SAAS;IACTK,OAAO,EAAEH,IAAI,CAACG,OAAO;IACrBF,WAAW,EAAED,IAAI,CAACC;EACpB,CAAC,EACD;IAAEU,
|
|
1
|
+
{"version":3,"file":"aggregate.js","names":["OntologiesV2","invariant","legacyToModernSingleAggregationResult","modernToLegacyAggregationClause","modernToLegacyGroupByClause","addUserAgentAndRequestContextHeaders","resolveBaseObjectSetType","aggregate","clientCtx","objectType","objectSet","req","body","aggregation","$select","groupBy","where","undefined","$groupBy","flushEdits","result","OntologyObjectSets","ontologyRid","branch","transactionId","data","length","process","env","NODE_ENV","aggregationToCountResult","ret","map","entry","$group","group","aggregateResult","metrics","name","$count","value"],"sources":["aggregate.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n AggregateOpts,\n AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy,\n AggregationResultsWithGroups,\n AggregationsResults,\n ObjectOrInterfaceDefinition,\n} from \"@osdk/api\";\nimport type {\n AggregateObjectsRequestV2,\n AggregateObjectsResponseV2,\n ObjectSet,\n} from \"@osdk/foundry.ontologies\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport { legacyToModernSingleAggregationResult } from \"../internal/conversions/legacyToModernSingleAggregationResult.js\";\nimport { modernToLegacyAggregationClause } from \"../internal/conversions/modernToLegacyAggregationClause.js\";\nimport { modernToLegacyGroupByClause } from \"../internal/conversions/modernToLegacyGroupByClause.js\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\nimport type { ArrayElement } from \"../util/ArrayElement.js\";\nimport { resolveBaseObjectSetType } from \"../util/objectSetUtils.js\";\n\n/** @internal */\nexport async function aggregate<\n Q extends ObjectOrInterfaceDefinition,\n AO extends AggregateOpts<Q>,\n>(\n clientCtx: MinimalClient,\n objectType: Q,\n objectSet: ObjectSet = resolveBaseObjectSetType(objectType),\n req: AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy<Q, AO>,\n): Promise<AggregationsResults<Q, AO>> {\n const resolvedObjectSet = resolveBaseObjectSetType(objectType);\n const body: AggregateObjectsRequestV2 = {\n aggregation: modernToLegacyAggregationClause<AO[\"$select\"]>(\n req.$select,\n ),\n groupBy: [],\n where: undefined,\n };\n\n if (req.$groupBy) {\n body.groupBy = modernToLegacyGroupByClause(req.$groupBy);\n }\n\n if (clientCtx.flushEdits != null) {\n await clientCtx.flushEdits();\n }\n\n const result = await OntologiesV2.OntologyObjectSets.aggregate(\n addUserAgentAndRequestContextHeaders(clientCtx, objectType),\n await clientCtx.ontologyRid,\n {\n objectSet,\n groupBy: body.groupBy,\n aggregation: body.aggregation,\n },\n { branch: clientCtx.branch, transactionId: clientCtx.transactionId },\n );\n\n if (!req.$groupBy) {\n invariant(\n result.data.length === 1,\n \"no group by clause should mean only one data result\",\n );\n\n return {\n ...aggregationToCountResult(result.data[0]),\n ...legacyToModernSingleAggregationResult(\n result.data[0],\n ),\n } as any;\n }\n\n const ret: AggregationResultsWithGroups<Q, AO[\"$select\"], any> = result.data\n .map((entry) => {\n return {\n $group: entry.group as any,\n ...aggregationToCountResult(entry),\n ...legacyToModernSingleAggregationResult(entry),\n };\n }) as any; // fixme\n\n return ret as any; // FIXME\n}\n\nfunction aggregationToCountResult(\n entry: ArrayElement<AggregateObjectsResponseV2[\"data\"]>,\n): { $count: number } | undefined {\n for (const aggregateResult of entry.metrics) {\n if (aggregateResult.name === \"count\") {\n return { $count: aggregateResult.value };\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAcA,OAAO,KAAKA,YAAY,MAAM,0BAA0B;AACxD,OAAOC,SAAS,MAAM,gBAAgB;AACtC,SAASC,qCAAqC,QAAQ,kEAAkE;AACxH,SAASC,+BAA+B,QAAQ,4DAA4D;AAC5G,SAASC,2BAA2B,QAAQ,wDAAwD;AAEpG,SAASC,oCAAoC,QAAQ,iDAAiD;AAEtG,SAASC,wBAAwB,QAAQ,2BAA2B;;AAEpE;AACA,OAAO,eAAeC,SAASA,CAI7BC,SAAwB,EACxBC,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IAAK;IACd,OAAO;MACLC,MAAM,EAAED,KAAK,CAACE,KAAY;MAC1B,GAAGL,wBAAwB,CAACG,KAAK,CAAC;MAClC,GAAG/B,qCAAqC,CAAC+B,KAAK;IAChD,CAAC;EACH,CAAC,CAAQ,CAAC,CAAC;;EAEb,OAAOF,GAAG,CAAQ,CAAC;AACrB;AAEA,SAASD,wBAAwBA,CAC/BG,KAAuD,EACvB;EAChC,KAAK,MAAMG,eAAe,IAAIH,KAAK,CAACI,OAAO,EAAE;IAC3C,IAAID,eAAe,CAACE,IAAI,KAAK,OAAO,EAAE;MACpC,OAAO;QAAEC,MAAM,EAAEH,eAAe,CAACI;MAAM,CAAC;IAC1C;EACF;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseHolder.js","names":[],"sources":["BaseHolder.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ObjectMetadata,\n ObjectOrInterfaceDefinition,\n ObjectSpecifier,\n} from \"@osdk/api\";\nimport type { InterfaceHolder } from \"./InterfaceHolder.js\";\nimport type {
|
|
1
|
+
{"version":3,"file":"BaseHolder.js","names":[],"sources":["BaseHolder.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ObjectMetadata,\n ObjectOrInterfaceDefinition,\n ObjectSpecifier,\n PropertySecurity,\n} from \"@osdk/api\";\nimport type { FormatPropertyOptions } from \"../formatting/applyPropertyFormatter.js\";\nimport type { InterfaceHolder } from \"./InterfaceHolder.js\";\nimport type {\n PropertySecuritiesRef,\n UnderlyingOsdkObject,\n} from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\n/** @internal */\n\nexport interface BaseHolder {\n readonly [UnderlyingOsdkObject]: ObjectHolder;\n readonly [PropertySecuritiesRef]:\n | { [propName: string]: PropertySecurity[] }\n | undefined;\n\n readonly $apiName: string;\n readonly $objectType: string;\n readonly $primaryKey: string | number;\n readonly $title: string | undefined;\n readonly $objectSpecifier: ObjectSpecifier<any>;\n readonly $propertySecurities: PropertySecurity[];\n\n readonly \"$as\": (\n newDef: string | ObjectOrInterfaceDefinition,\n ) => ObjectHolder | InterfaceHolder;\n\n readonly \"$clone\": (\n newProps?: Record<string, any>,\n ) => this;\n\n readonly \"$__EXPERIMENTAL__NOT_SUPPORTED_YET__metadata\": {\n readonly ObjectMetadata: ObjectMetadata;\n };\n\n readonly \"$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue\": <\n PropertyApiName extends string,\n >(\n propertyApiName: PropertyApiName,\n options?: FormatPropertyOptions,\n ) => string | undefined;\n\n // [key: `$$${string}`]: any;\n // Unlike SimpleOsdkProperties, all of our remaining types are unknown as the full\n // union is basically `any` when you consider the above fields.\n [key: string]: unknown;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InterfaceHolder.js","names":[],"sources":["InterfaceHolder.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { InterfaceMetadata, ObjectMetadata, Osdk } from \"@osdk/api\";\nimport type { BaseHolder } from \"./BaseHolder.js\";\nimport type { InterfaceDefRef } from \"./InternalSymbols.js\";\n\n/** @internal */\nexport interface InterfaceHolder<\n _Q extends Osdk.Instance<any> = never,\n> extends BaseHolder {\n [InterfaceDefRef]: InterfaceMetadata;\n\n readonly \"$__EXPERIMENTAL__NOT_SUPPORTED_YET__metadata\": {\n readonly ObjectMetadata: ObjectMetadata;\n readonly InterfaceMetadata: InterfaceMetadata;\n };\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"InterfaceHolder.js","names":[],"sources":["InterfaceHolder.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { InterfaceMetadata, ObjectMetadata, Osdk } from \"@osdk/api\";\nimport type { FormatPropertyOptions } from \"../formatting/applyPropertyFormatter.js\";\nimport type { BaseHolder } from \"./BaseHolder.js\";\nimport type { InterfaceDefRef } from \"./InternalSymbols.js\";\n\n/** @internal */\nexport interface InterfaceHolder<\n _Q extends Osdk.Instance<any> = never,\n> extends BaseHolder {\n [InterfaceDefRef]: InterfaceMetadata;\n\n readonly \"$__EXPERIMENTAL__NOT_SUPPORTED_YET__metadata\": {\n readonly ObjectMetadata: ObjectMetadata;\n readonly InterfaceMetadata: InterfaceMetadata;\n };\n\n readonly \"$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue\": <\n PropertyApiName extends string,\n >(\n propertyApiName: PropertyApiName,\n options?: FormatPropertyOptions,\n ) => string | undefined;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -25,4 +25,7 @@ export const InterfaceDefRef = Symbol("InterfaceDefinition");
|
|
|
25
25
|
|
|
26
26
|
/** @internal */
|
|
27
27
|
export const ClientRef = Symbol("ClientRef");
|
|
28
|
+
|
|
29
|
+
/** @internal */
|
|
30
|
+
export const PropertySecuritiesRef = Symbol("Property Securities");
|
|
28
31
|
//# sourceMappingURL=InternalSymbols.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalSymbols.js","names":["UnderlyingOsdkObject","Symbol","ObjectDefRef","InterfaceDefRef","ClientRef"],"sources":["InternalSymbols.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ObjectOrInterfaceDefinition, OsdkBase } from \"@osdk/api\";\n\n/** @internal */\nexport const UnderlyingOsdkObject = Symbol(\n process.env.MODE !== \"production\" ? \"Underlying Object\" : undefined,\n);\n\n/** @internal */\nexport const ObjectDefRef = Symbol(\n process.env.MODE !== \"production\" ? \"ObjectDefinition\" : undefined,\n);\n\n/** @internal */\nexport const InterfaceDefRef = Symbol(\n process.env.MODE !== \"production\" ? \"InterfaceDefinition\" : undefined,\n);\n\n/** @internal */\nexport const ClientRef = Symbol(\n process.env.MODE !== \"production\" ? \"ClientRef\" : undefined,\n);\n\nexport interface HolderBase<T extends ObjectOrInterfaceDefinition> {\n [UnderlyingOsdkObject]: OsdkBase<any>;\n [ObjectDefRef]?: T;\n [InterfaceDefRef]?: T;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;
|
|
1
|
+
{"version":3,"file":"InternalSymbols.js","names":["UnderlyingOsdkObject","Symbol","ObjectDefRef","InterfaceDefRef","ClientRef","PropertySecuritiesRef"],"sources":["InternalSymbols.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ObjectOrInterfaceDefinition, OsdkBase } from \"@osdk/api\";\nimport type { PropertySecurities } from \"@osdk/foundry.ontologies\";\n\n/** @internal */\nexport const UnderlyingOsdkObject = Symbol(\n process.env.MODE !== \"production\" ? \"Underlying Object\" : undefined,\n);\n\n/** @internal */\nexport const ObjectDefRef = Symbol(\n process.env.MODE !== \"production\" ? \"ObjectDefinition\" : undefined,\n);\n\n/** @internal */\nexport const InterfaceDefRef = Symbol(\n process.env.MODE !== \"production\" ? \"InterfaceDefinition\" : undefined,\n);\n\n/** @internal */\nexport const ClientRef = Symbol(\n process.env.MODE !== \"production\" ? \"ClientRef\" : undefined,\n);\n\n/** @internal */\nexport const PropertySecuritiesRef = Symbol(\n process.env.MODE !== \"production\" ? \"Property Securities\" : undefined,\n);\n\nexport interface HolderBase<T extends ObjectOrInterfaceDefinition> {\n [UnderlyingOsdkObject]: OsdkBase<any>;\n [ObjectDefRef]?: T;\n [InterfaceDefRef]?: T;\n [PropertySecuritiesRef]?: PropertySecurities[];\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA,OAAO,MAAMA,oBAAoB,GAAGC,MAAM,CACJ,mBACtC,CAAC;;AAED;AACA,OAAO,MAAMC,YAAY,GAAGD,MAAM,CACI,kBACtC,CAAC;;AAED;AACA,OAAO,MAAME,eAAe,GAAGF,MAAM,CACC,qBACtC,CAAC;;AAED;AACA,OAAO,MAAMG,SAAS,GAAGH,MAAM,CACO,WACtC,CAAC;;AAED;AACA,OAAO,MAAMI,qBAAqB,GAAGJ,MAAM,CACL,qBACtC,CAAC","ignoreList":[]}
|
|
@@ -57,6 +57,10 @@ export function createOsdkInterface(underlying, interfaceDef) {
|
|
|
57
57
|
value: clone,
|
|
58
58
|
enumerable: false
|
|
59
59
|
},
|
|
60
|
+
"$propertySecurities": {
|
|
61
|
+
value: underlying.$propertySecurities,
|
|
62
|
+
enumerable: "$propertySecurities" in underlying
|
|
63
|
+
},
|
|
60
64
|
"$__EXPERIMENTAL__NOT_SUPPORTED_YET__metadata": {
|
|
61
65
|
value: {
|
|
62
66
|
"ObjectMetadata": underlying[ObjectDefRef],
|
|
@@ -64,6 +68,10 @@ export function createOsdkInterface(underlying, interfaceDef) {
|
|
|
64
68
|
},
|
|
65
69
|
enumerable: false
|
|
66
70
|
},
|
|
71
|
+
"$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue": {
|
|
72
|
+
value: underlying.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue,
|
|
73
|
+
enumerable: false
|
|
74
|
+
},
|
|
67
75
|
"$link": {
|
|
68
76
|
get: function () {
|
|
69
77
|
return get$linkForInterface(this);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createOsdkInterface.js","names":["extractNamespace","get$linkForInterface","InterfaceDefRef","ObjectDefRef","UnderlyingOsdkObject","createOsdkInterface","underlying","interfaceDef","objApiNamespace","apiName","Object","freeze","defineProperties","value","enumerable","$as","$objectType","$primaryKey","$objectSpecifier","$title","$rid","clone","get","fromEntries","keys","properties","map","p","objDef","apiNamespace","targetPropName","interfaceMap","update","$clone","key","Error","remappedProps","mapProperty","filter","x","propertyName"],"sources":["createOsdkInterface.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { InterfaceMetadata } from \"@osdk/api\";\nimport { extractNamespace } from \"../../internal/conversions/extractNamespace.js\";\nimport type { FetchedObjectTypeDefinition } from \"../../ontology/OntologyProvider.js\";\nimport { get$linkForInterface } from \"./getDollarLink.js\";\nimport type { InterfaceHolder } from \"./InterfaceHolder.js\";\nimport {\n InterfaceDefRef,\n ObjectDefRef,\n UnderlyingOsdkObject,\n} from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\n/** @internal */\nexport function createOsdkInterface<\n Q extends FetchedObjectTypeDefinition,\n>(\n underlying: ObjectHolder,\n interfaceDef: InterfaceMetadata,\n): InterfaceHolder {\n const [objApiNamespace] = extractNamespace(interfaceDef.apiName);\n\n return Object.freeze(\n Object.defineProperties({}, {\n // first to minimize hidden classes\n [UnderlyingOsdkObject]: { value: underlying },\n\n \"$apiName\": { value: interfaceDef.apiName, enumerable: true },\n \"$as\": {\n value: underlying.$as,\n enumerable: false,\n },\n \"$objectType\": {\n value: underlying.$objectType,\n enumerable: \"$objectType\" in underlying,\n },\n \"$primaryKey\": {\n value: underlying.$primaryKey,\n enumerable: \"$primaryKey\" in underlying,\n },\n \"$objectSpecifier\": {\n value: underlying.$objectSpecifier,\n enumerable: \"$objectSpecifier\" in underlying,\n },\n \"$title\": {\n value: underlying.$title,\n enumerable: \"$title\" in underlying,\n },\n \"$rid\": {\n value: (underlying as any).$rid,\n enumerable: \"$rid\" in underlying,\n },\n \"$clone\": {\n value: clone,\n enumerable: false,\n },\n \"$__EXPERIMENTAL__NOT_SUPPORTED_YET__metadata\": {\n value: {\n \"ObjectMetadata\": underlying[ObjectDefRef],\n \"InterfaceMetadata\": interfaceDef,\n },\n enumerable: false,\n },\n\n \"$link\": {\n get: function(this: InterfaceHolder) {\n return get$linkForInterface(this);\n },\n },\n\n [InterfaceDefRef]: { value: interfaceDef },\n\n ...Object.fromEntries(\n Object.keys(interfaceDef.properties).map(p => {\n const objDef = underlying[ObjectDefRef];\n\n const [apiNamespace, apiName] = extractNamespace(p);\n\n const targetPropName = objDef\n .interfaceMap![interfaceDef.apiName][p];\n\n return [apiNamespace === objApiNamespace ? apiName : p, {\n enumerable: targetPropName in underlying,\n value: underlying[targetPropName as keyof typeof underlying],\n }];\n }),\n ),\n }) as InterfaceHolder,\n );\n function clone(update: Record<string, any> | undefined) {\n if (update == null) {\n return underlying.$clone().$as(interfaceDef);\n }\n\n for (const key of Object.keys(update)) {\n if (!(key in interfaceDef.properties)) {\n throw new Error(\n `Invalid property ${key} for interface ${interfaceDef.apiName}`,\n );\n }\n }\n\n const remappedProps = Object.fromEntries(\n Object.keys(update).map(p => mapProperty(p, update[p])).filter(x =>\n x != null\n ),\n );\n\n return underlying.$clone(remappedProps).$as(interfaceDef);\n }\n function mapProperty(propertyName: string, value: any) {\n const objDef = underlying[ObjectDefRef];\n const targetPropName =\n objDef.interfaceMap![interfaceDef.apiName][propertyName];\n // If the underlying object does not implement the SPT, throw errors\n if (targetPropName == null) {\n throw new Error(\n `Cannot clone interface with ${propertyName} as property is not implemented by the underlying object type ${objDef.apiName}`,\n );\n }\n return [targetPropName, value];\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,gBAAgB,QAAQ,gDAAgD;AAEjF,SAASC,oBAAoB,QAAQ,oBAAoB;AAEzD,SACEC,eAAe,EACfC,YAAY,EACZC,oBAAoB,QACf,sBAAsB;AAG7B;AACA,OAAO,SAASC,mBAAmBA,CAGjCC,UAAwB,EACxBC,YAA+B,EACd;EACjB,MAAM,CAACC,eAAe,CAAC,GAAGR,gBAAgB,CAACO,YAAY,CAACE,OAAO,CAAC;EAEhE,OAAOC,MAAM,CAACC,MAAM,CAClBD,MAAM,CAACE,gBAAgB,CAAC,CAAC,CAAC,EAAE;IAC1B;IACA,CAACR,oBAAoB,GAAG;MAAES,KAAK,EAAEP;IAAW,CAAC;IAE7C,UAAU,EAAE;MAAEO,KAAK,EAAEN,YAAY,CAACE,OAAO;MAAEK,UAAU,EAAE;IAAK,CAAC;IAC7D,KAAK,EAAE;MACLD,KAAK,EAAEP,UAAU,CAACS,GAAG;MACrBD,UAAU,EAAE;IACd,CAAC;IACD,aAAa,EAAE;MACbD,KAAK,EAAEP,UAAU,CAACU,WAAW;MAC7BF,UAAU,EAAE,aAAa,IAAIR;IAC/B,CAAC;IACD,aAAa,EAAE;MACbO,KAAK,EAAEP,UAAU,CAACW,WAAW;MAC7BH,UAAU,EAAE,aAAa,IAAIR;IAC/B,CAAC;IACD,kBAAkB,EAAE;MAClBO,KAAK,EAAEP,UAAU,CAACY,gBAAgB;MAClCJ,UAAU,EAAE,kBAAkB,IAAIR;IACpC,CAAC;IACD,QAAQ,EAAE;MACRO,KAAK,EAAEP,UAAU,CAACa,MAAM;MACxBL,UAAU,EAAE,QAAQ,IAAIR;IAC1B,CAAC;IACD,MAAM,EAAE;MACNO,KAAK,EAAGP,UAAU,CAASc,IAAI;MAC/BN,UAAU,EAAE,MAAM,IAAIR;IACxB,CAAC;IACD,QAAQ,EAAE;MACRO,KAAK,EAAEQ,KAAK;MACZP,UAAU,EAAE;IACd,CAAC;IACD,8CAA8C,EAAE;
|
|
1
|
+
{"version":3,"file":"createOsdkInterface.js","names":["extractNamespace","get$linkForInterface","InterfaceDefRef","ObjectDefRef","UnderlyingOsdkObject","createOsdkInterface","underlying","interfaceDef","objApiNamespace","apiName","Object","freeze","defineProperties","value","enumerable","$as","$objectType","$primaryKey","$objectSpecifier","$title","$rid","clone","$propertySecurities","$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue","get","fromEntries","keys","properties","map","p","objDef","apiNamespace","targetPropName","interfaceMap","update","$clone","key","Error","remappedProps","mapProperty","filter","x","propertyName"],"sources":["createOsdkInterface.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { InterfaceMetadata } from \"@osdk/api\";\nimport { extractNamespace } from \"../../internal/conversions/extractNamespace.js\";\nimport type { FetchedObjectTypeDefinition } from \"../../ontology/OntologyProvider.js\";\nimport { get$linkForInterface } from \"./getDollarLink.js\";\nimport type { InterfaceHolder } from \"./InterfaceHolder.js\";\nimport {\n InterfaceDefRef,\n ObjectDefRef,\n UnderlyingOsdkObject,\n} from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\n/** @internal */\nexport function createOsdkInterface<\n Q extends FetchedObjectTypeDefinition,\n>(\n underlying: ObjectHolder,\n interfaceDef: InterfaceMetadata,\n): InterfaceHolder {\n const [objApiNamespace] = extractNamespace(interfaceDef.apiName);\n\n return Object.freeze(\n Object.defineProperties({}, {\n // first to minimize hidden classes\n [UnderlyingOsdkObject]: { value: underlying },\n\n \"$apiName\": { value: interfaceDef.apiName, enumerable: true },\n \"$as\": {\n value: underlying.$as,\n enumerable: false,\n },\n \"$objectType\": {\n value: underlying.$objectType,\n enumerable: \"$objectType\" in underlying,\n },\n \"$primaryKey\": {\n value: underlying.$primaryKey,\n enumerable: \"$primaryKey\" in underlying,\n },\n \"$objectSpecifier\": {\n value: underlying.$objectSpecifier,\n enumerable: \"$objectSpecifier\" in underlying,\n },\n \"$title\": {\n value: underlying.$title,\n enumerable: \"$title\" in underlying,\n },\n \"$rid\": {\n value: (underlying as any).$rid,\n enumerable: \"$rid\" in underlying,\n },\n \"$clone\": {\n value: clone,\n enumerable: false,\n },\n \"$propertySecurities\": {\n value: underlying.$propertySecurities,\n enumerable: \"$propertySecurities\" in underlying,\n },\n \"$__EXPERIMENTAL__NOT_SUPPORTED_YET__metadata\": {\n value: {\n \"ObjectMetadata\": underlying[ObjectDefRef],\n \"InterfaceMetadata\": interfaceDef,\n },\n enumerable: false,\n },\n \"$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue\": {\n value: underlying.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue,\n enumerable: false,\n },\n\n \"$link\": {\n get: function(this: InterfaceHolder) {\n return get$linkForInterface(this);\n },\n },\n\n [InterfaceDefRef]: { value: interfaceDef },\n\n ...Object.fromEntries(\n Object.keys(interfaceDef.properties).map(p => {\n const objDef = underlying[ObjectDefRef];\n\n const [apiNamespace, apiName] = extractNamespace(p);\n\n const targetPropName = objDef\n .interfaceMap![interfaceDef.apiName][p];\n\n return [apiNamespace === objApiNamespace ? apiName : p, {\n enumerable: targetPropName in underlying,\n value: underlying[targetPropName as keyof typeof underlying],\n }];\n }),\n ),\n }) as InterfaceHolder,\n );\n function clone(update: Record<string, any> | undefined) {\n if (update == null) {\n return underlying.$clone().$as(interfaceDef);\n }\n\n for (const key of Object.keys(update)) {\n if (!(key in interfaceDef.properties)) {\n throw new Error(\n `Invalid property ${key} for interface ${interfaceDef.apiName}`,\n );\n }\n }\n\n const remappedProps = Object.fromEntries(\n Object.keys(update).map(p => mapProperty(p, update[p])).filter(x =>\n x != null\n ),\n );\n\n return underlying.$clone(remappedProps).$as(interfaceDef);\n }\n function mapProperty(propertyName: string, value: any) {\n const objDef = underlying[ObjectDefRef];\n const targetPropName =\n objDef.interfaceMap![interfaceDef.apiName][propertyName];\n // If the underlying object does not implement the SPT, throw errors\n if (targetPropName == null) {\n throw new Error(\n `Cannot clone interface with ${propertyName} as property is not implemented by the underlying object type ${objDef.apiName}`,\n );\n }\n return [targetPropName, value];\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,gBAAgB,QAAQ,gDAAgD;AAEjF,SAASC,oBAAoB,QAAQ,oBAAoB;AAEzD,SACEC,eAAe,EACfC,YAAY,EACZC,oBAAoB,QACf,sBAAsB;AAG7B;AACA,OAAO,SAASC,mBAAmBA,CAGjCC,UAAwB,EACxBC,YAA+B,EACd;EACjB,MAAM,CAACC,eAAe,CAAC,GAAGR,gBAAgB,CAACO,YAAY,CAACE,OAAO,CAAC;EAEhE,OAAOC,MAAM,CAACC,MAAM,CAClBD,MAAM,CAACE,gBAAgB,CAAC,CAAC,CAAC,EAAE;IAC1B;IACA,CAACR,oBAAoB,GAAG;MAAES,KAAK,EAAEP;IAAW,CAAC;IAE7C,UAAU,EAAE;MAAEO,KAAK,EAAEN,YAAY,CAACE,OAAO;MAAEK,UAAU,EAAE;IAAK,CAAC;IAC7D,KAAK,EAAE;MACLD,KAAK,EAAEP,UAAU,CAACS,GAAG;MACrBD,UAAU,EAAE;IACd,CAAC;IACD,aAAa,EAAE;MACbD,KAAK,EAAEP,UAA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YAAY,CAAC;IACvC,MAAM6B,cAAc,GAClBF,MAAM,CAACG,YAAY,CAAE1B,YAAY,CAACE,OAAO,CAAC,CAACiC,YAAY,CAAC;IAC1D;IACA,IAAIV,cAAc,IAAI,IAAI,EAAE;MAC1B,MAAM,IAAIK,KAAK,CACb,+BAA+BK,YAAY,iEAAiEZ,MAAM,CAACrB,OAAO,EAC5H,CAAC;IACH;IACA,OAAO,CAACuB,cAAc,EAAEnB,KAAK,CAAC;EAChC;AACF","ignoreList":[]}
|
|
@@ -20,9 +20,10 @@ import { MediaReferencePropertyImpl } from "../../createMediaReferenceProperty.j
|
|
|
20
20
|
import { TimeSeriesPropertyImpl } from "../../createTimeseriesProperty.js";
|
|
21
21
|
import { hydrateAttachmentFromRidInternal } from "../../public-utils/hydrateAttachmentFromRid.js";
|
|
22
22
|
import { createObjectSpecifierFromPrimaryKey } from "../../util/objectSpecifierUtils.js";
|
|
23
|
+
import { applyPropertyFormatter } from "../formatting/applyPropertyFormatter.js";
|
|
23
24
|
import { get$as } from "./getDollarAs.js";
|
|
24
25
|
import { get$link } from "./getDollarLink.js";
|
|
25
|
-
import { ClientRef, ObjectDefRef, UnderlyingOsdkObject } from "./InternalSymbols.js";
|
|
26
|
+
import { ClientRef, ObjectDefRef, PropertySecuritiesRef, UnderlyingOsdkObject } from "./InternalSymbols.js";
|
|
26
27
|
const specialPropertyTypes = new Set(["attachment", "geotimeSeriesReference", "mediaReference", "numericTimeseries", "stringTimeseries", "sensorTimeseries"]);
|
|
27
28
|
|
|
28
29
|
// kept separate so we are not redefining these functions
|
|
@@ -68,6 +69,12 @@ const basePropDefs = {
|
|
|
68
69
|
},
|
|
69
70
|
enumerable: true
|
|
70
71
|
},
|
|
72
|
+
"$propertySecurities": {
|
|
73
|
+
get: function () {
|
|
74
|
+
return this[PropertySecuritiesRef];
|
|
75
|
+
},
|
|
76
|
+
enumerable: true
|
|
77
|
+
},
|
|
71
78
|
"$__EXPERIMENTAL__NOT_SUPPORTED_YET__metadata": {
|
|
72
79
|
get: function () {
|
|
73
80
|
return {
|
|
@@ -75,6 +82,15 @@ const basePropDefs = {
|
|
|
75
82
|
};
|
|
76
83
|
},
|
|
77
84
|
enumerable: false
|
|
85
|
+
},
|
|
86
|
+
"$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue": {
|
|
87
|
+
value: function (propertyApiName, options) {
|
|
88
|
+
const rawObj = this[UnderlyingOsdkObject];
|
|
89
|
+
const def = this[ObjectDefRef];
|
|
90
|
+
const propertyValue = rawObj[propertyApiName];
|
|
91
|
+
return applyPropertyFormatter(propertyValue, def.properties[propertyApiName], rawObj, options);
|
|
92
|
+
},
|
|
93
|
+
enumerable: false
|
|
78
94
|
}
|
|
79
95
|
};
|
|
80
96
|
|
|
@@ -84,14 +100,23 @@ const basePropDefs = {
|
|
|
84
100
|
* @param objectDef
|
|
85
101
|
* @param simpleOsdkProperties
|
|
86
102
|
*/
|
|
87
|
-
export function createOsdkObject(client, objectDef, simpleOsdkProperties, derivedPropertyTypeByName = {}) {
|
|
103
|
+
export function createOsdkObject(client, objectDef, simpleOsdkProperties, derivedPropertyTypeByName = {}, wirePropertySecurities = []) {
|
|
104
|
+
const {
|
|
105
|
+
parsedObject,
|
|
106
|
+
clientPropertySecurities
|
|
107
|
+
} = parseWhenSecuritiesLoaded(wirePropertySecurities, simpleOsdkProperties, objectDef, derivedPropertyTypeByName);
|
|
108
|
+
|
|
88
109
|
// updates the object's "hidden class/map".
|
|
89
|
-
const rawObj =
|
|
110
|
+
const rawObj = parsedObject;
|
|
90
111
|
Object.defineProperties(rawObj, {
|
|
91
112
|
[UnderlyingOsdkObject]: {
|
|
92
113
|
enumerable: false,
|
|
93
114
|
value: simpleOsdkProperties
|
|
94
115
|
},
|
|
116
|
+
[PropertySecuritiesRef]: {
|
|
117
|
+
enumerable: false,
|
|
118
|
+
value: clientPropertySecurities
|
|
119
|
+
},
|
|
95
120
|
[ObjectDefRef]: {
|
|
96
121
|
value: objectDef,
|
|
97
122
|
enumerable: false
|
|
@@ -169,4 +194,71 @@ function createSpecialProperty(client, objectDef, rawObject, p) {
|
|
|
169
194
|
});
|
|
170
195
|
}
|
|
171
196
|
}
|
|
197
|
+
function parseWhenSecuritiesLoaded(wirePropertySecurities, rawObject, objectDef, derivedPropertyTypeByName = {}) {
|
|
198
|
+
if (wirePropertySecurities == null || wirePropertySecurities.length === 0) {
|
|
199
|
+
return {
|
|
200
|
+
parsedObject: rawObject,
|
|
201
|
+
clientPropertySecurities: undefined
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
const parsedObject = {
|
|
205
|
+
...rawObject
|
|
206
|
+
};
|
|
207
|
+
const clientPropertySecurities = {};
|
|
208
|
+
for (const propKey of Object.keys(rawObject)) {
|
|
209
|
+
if (propKey in objectDef.properties || propKey in derivedPropertyTypeByName) {
|
|
210
|
+
const value = rawObject[propKey];
|
|
211
|
+
if (Array.isArray(value)) {
|
|
212
|
+
const newVal = [];
|
|
213
|
+
const newSecurities = [];
|
|
214
|
+
value.forEach(spv => {
|
|
215
|
+
!(typeof spv === "object" && spv != null && "value" in spv && "propertySecurityIndex" in spv) ? process.env.NODE_ENV !== "production" ? invariant(false, "Expected destructured secured property value object in array") : invariant(false) : void 0;
|
|
216
|
+
const securedValue = spv;
|
|
217
|
+
newVal.push(securedValue.value);
|
|
218
|
+
const securityIndex = securedValue.propertySecurityIndex;
|
|
219
|
+
!(securityIndex != null) ? process.env.NODE_ENV !== "production" ? invariant(false, "Expected property security index to be defined") : invariant(false) : void 0;
|
|
220
|
+
!(securityIndex < wirePropertySecurities.length) ? process.env.NODE_ENV !== "production" ? invariant(false, "Expected property security index to be within bounds") : invariant(false) : void 0;
|
|
221
|
+
newSecurities.push(wirePropertySecurities[securityIndex].disjunction.map(wireToClientPropertySecurities));
|
|
222
|
+
});
|
|
223
|
+
parsedObject[propKey] = newVal;
|
|
224
|
+
clientPropertySecurities[propKey] = newSecurities;
|
|
225
|
+
} // Check if this is a secured property value object
|
|
226
|
+
else if (typeof value === "object" && value != null && "value" in value && "propertySecurityIndex" in value) {
|
|
227
|
+
const securedValue = value;
|
|
228
|
+
parsedObject[propKey] = securedValue.value;
|
|
229
|
+
const securityIndex = securedValue.propertySecurityIndex;
|
|
230
|
+
!(securityIndex != null) ? process.env.NODE_ENV !== "production" ? invariant(false, "Expected property security index to be defined") : invariant(false) : void 0;
|
|
231
|
+
!(securityIndex < wirePropertySecurities.length) ? process.env.NODE_ENV !== "production" ? invariant(false, "Expected property security index to be within bounds") : invariant(false) : void 0;
|
|
232
|
+
clientPropertySecurities[propKey] = wirePropertySecurities[securityIndex].disjunction.map(wireToClientPropertySecurities);
|
|
233
|
+
} else {
|
|
234
|
+
// Regular property without security
|
|
235
|
+
parsedObject[propKey] = value;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return {
|
|
240
|
+
parsedObject,
|
|
241
|
+
clientPropertySecurities
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
function wireToClientPropertySecurities(propertySecurity) {
|
|
245
|
+
switch (propertySecurity.type) {
|
|
246
|
+
case "propertyMarkingSummary":
|
|
247
|
+
return {
|
|
248
|
+
type: "propertyMarkings",
|
|
249
|
+
conjunctive: propertySecurity.conjunctive,
|
|
250
|
+
containerConjunctive: propertySecurity.containerConjunctive,
|
|
251
|
+
disjunctive: propertySecurity.disjunctive,
|
|
252
|
+
containerDisjunctive: propertySecurity.containerDisjunctive
|
|
253
|
+
};
|
|
254
|
+
case "errorComputingSecurity":
|
|
255
|
+
return {
|
|
256
|
+
type: "errorComputingSecurity"
|
|
257
|
+
};
|
|
258
|
+
case "unsupportedPolicy":
|
|
259
|
+
return {
|
|
260
|
+
type: "unsupportedPolicy"
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
}
|
|
172
264
|
//# sourceMappingURL=createOsdkObject.js.map
|