@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
|
@@ -14,29 +14,32 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
import { createOsdkObject } from "../../../object/convertWireToOsdkObjects/createOsdkObject.js";
|
|
18
|
+
import { ClientRef, ObjectDefRef, UnderlyingOsdkObject } from "../../../object/convertWireToOsdkObjects/InternalSymbols.js";
|
|
17
19
|
export function extractRdpFieldNames(rdpConfig) {
|
|
18
20
|
if (!rdpConfig) {
|
|
19
21
|
return new Set();
|
|
20
22
|
}
|
|
21
23
|
return new Set(Object.keys(rdpConfig));
|
|
22
24
|
}
|
|
23
|
-
function deleteField(obj, field) {
|
|
24
|
-
delete obj[field];
|
|
25
|
-
}
|
|
26
|
-
function setField(obj, field, value) {
|
|
27
|
-
obj[field] = value;
|
|
28
|
-
}
|
|
29
25
|
function stripRdpFields(value, rdpFields) {
|
|
30
26
|
if (rdpFields.size === 0) {
|
|
31
27
|
return value;
|
|
32
28
|
}
|
|
33
|
-
const
|
|
34
|
-
|
|
29
|
+
const underlying = value[UnderlyingOsdkObject];
|
|
30
|
+
const objectDef = value[ObjectDefRef];
|
|
31
|
+
const newProps = {
|
|
32
|
+
$apiName: underlying.$apiName,
|
|
33
|
+
$objectType: underlying.$objectType,
|
|
34
|
+
$primaryKey: underlying.$primaryKey,
|
|
35
|
+
$title: underlying.$title
|
|
35
36
|
};
|
|
36
|
-
for (const
|
|
37
|
-
|
|
37
|
+
for (const key of Object.keys(underlying)) {
|
|
38
|
+
if (key in objectDef.properties && !rdpFields.has(key)) {
|
|
39
|
+
newProps[key] = underlying[key];
|
|
40
|
+
}
|
|
38
41
|
}
|
|
39
|
-
return
|
|
42
|
+
return createOsdkObject(value[ClientRef], objectDef, newProps);
|
|
40
43
|
}
|
|
41
44
|
function isSuperset(superset, subset) {
|
|
42
45
|
for (const field of subset) {
|
|
@@ -46,17 +49,24 @@ function isSuperset(superset, subset) {
|
|
|
46
49
|
}
|
|
47
50
|
return true;
|
|
48
51
|
}
|
|
49
|
-
function
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
+
function filterToRdpFields(value, rdpFieldsToKeep, sourceRdpFields) {
|
|
53
|
+
const underlying = value[UnderlyingOsdkObject];
|
|
54
|
+
const objectDef = value[ObjectDefRef];
|
|
55
|
+
const newProps = {
|
|
56
|
+
$apiName: underlying.$apiName,
|
|
57
|
+
$objectType: underlying.$objectType,
|
|
58
|
+
$primaryKey: underlying.$primaryKey,
|
|
59
|
+
$title: underlying.$title
|
|
52
60
|
};
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
61
|
+
for (const key of Object.keys(underlying)) {
|
|
62
|
+
if (key in objectDef.properties) {
|
|
63
|
+
const isRdpField = sourceRdpFields.has(key);
|
|
64
|
+
if (!isRdpField || rdpFieldsToKeep.has(key)) {
|
|
65
|
+
newProps[key] = underlying[key];
|
|
66
|
+
}
|
|
57
67
|
}
|
|
58
68
|
}
|
|
59
|
-
return
|
|
69
|
+
return createOsdkObject(value[ClientRef], objectDef, newProps);
|
|
60
70
|
}
|
|
61
71
|
export function mergeObjectFields(sourceValue, sourceRdpFields, targetRdpFields, targetCurrentValue) {
|
|
62
72
|
if (targetRdpFields.size === 0) {
|
|
@@ -66,18 +76,29 @@ export function mergeObjectFields(sourceValue, sourceRdpFields, targetRdpFields,
|
|
|
66
76
|
if (sourceRdpFields.size === targetRdpFields.size) {
|
|
67
77
|
return sourceValue;
|
|
68
78
|
}
|
|
69
|
-
return
|
|
79
|
+
return filterToRdpFields(sourceValue, targetRdpFields, sourceRdpFields);
|
|
70
80
|
}
|
|
71
|
-
const
|
|
72
|
-
|
|
81
|
+
const sourceUnderlying = sourceValue[UnderlyingOsdkObject];
|
|
82
|
+
const objectDef = sourceValue[ObjectDefRef];
|
|
83
|
+
const newProps = {
|
|
84
|
+
$apiName: sourceUnderlying.$apiName,
|
|
85
|
+
$objectType: sourceUnderlying.$objectType,
|
|
86
|
+
$primaryKey: sourceUnderlying.$primaryKey,
|
|
87
|
+
$title: sourceUnderlying.$title
|
|
73
88
|
};
|
|
89
|
+
for (const key of Object.keys(sourceUnderlying)) {
|
|
90
|
+
if (key in objectDef.properties && (!sourceRdpFields.has(key) || targetRdpFields.has(key))) {
|
|
91
|
+
newProps[key] = sourceUnderlying[key];
|
|
92
|
+
}
|
|
93
|
+
}
|
|
74
94
|
if (targetCurrentValue) {
|
|
95
|
+
const targetUnderlying = targetCurrentValue[UnderlyingOsdkObject];
|
|
75
96
|
for (const field of targetRdpFields) {
|
|
76
|
-
if (!sourceRdpFields.has(field) && field in
|
|
77
|
-
|
|
97
|
+
if (!sourceRdpFields.has(field) && field in targetUnderlying) {
|
|
98
|
+
newProps[field] = targetUnderlying[field];
|
|
78
99
|
}
|
|
79
100
|
}
|
|
80
101
|
}
|
|
81
|
-
return
|
|
102
|
+
return createOsdkObject(sourceValue[ClientRef], objectDef, newProps);
|
|
82
103
|
}
|
|
83
104
|
//# sourceMappingURL=rdpFieldOperations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rdpFieldOperations.js","names":["extractRdpFieldNames","rdpConfig","Set","Object","keys","
|
|
1
|
+
{"version":3,"file":"rdpFieldOperations.js","names":["createOsdkObject","ClientRef","ObjectDefRef","UnderlyingOsdkObject","extractRdpFieldNames","rdpConfig","Set","Object","keys","stripRdpFields","value","rdpFields","size","underlying","objectDef","newProps","$apiName","$objectType","$primaryKey","$title","key","properties","has","isSuperset","superset","subset","field","filterToRdpFields","rdpFieldsToKeep","sourceRdpFields","isRdpField","mergeObjectFields","sourceValue","targetRdpFields","targetCurrentValue","sourceUnderlying","targetUnderlying"],"sources":["rdpFieldOperations.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 { createOsdkObject } from \"../../../object/convertWireToOsdkObjects/createOsdkObject.js\";\nimport {\n ClientRef,\n ObjectDefRef,\n UnderlyingOsdkObject,\n} from \"../../../object/convertWireToOsdkObjects/InternalSymbols.js\";\nimport type { ObjectHolder } from \"../../../object/convertWireToOsdkObjects/ObjectHolder.js\";\nimport type { SimpleOsdkProperties } from \"../../../object/SimpleOsdkProperties.js\";\nimport type { Canonical } from \"../Canonical.js\";\nimport type { Rdp } from \"../RdpCanonicalizer.js\";\n\nexport function extractRdpFieldNames(\n rdpConfig: Canonical<Rdp> | undefined,\n): ReadonlySet<string> {\n if (!rdpConfig) {\n return new Set();\n }\n return new Set(Object.keys(rdpConfig));\n}\n\nfunction stripRdpFields(\n value: ObjectHolder,\n rdpFields: ReadonlySet<string>,\n): ObjectHolder {\n if (rdpFields.size === 0) {\n return value;\n }\n\n const underlying = value[UnderlyingOsdkObject] as SimpleOsdkProperties;\n const objectDef = value[ObjectDefRef];\n\n const newProps: SimpleOsdkProperties = {\n $apiName: underlying.$apiName,\n $objectType: underlying.$objectType,\n $primaryKey: underlying.$primaryKey,\n $title: underlying.$title,\n };\n\n for (const key of Object.keys(underlying)) {\n if (key in objectDef.properties && !rdpFields.has(key)) {\n newProps[key] = underlying[key];\n }\n }\n\n return createOsdkObject(value[ClientRef], objectDef, newProps);\n}\n\nfunction isSuperset(\n superset: ReadonlySet<string>,\n subset: ReadonlySet<string>,\n): boolean {\n for (const field of subset) {\n if (!superset.has(field)) {\n return false;\n }\n }\n return true;\n}\n\nfunction filterToRdpFields(\n value: ObjectHolder,\n rdpFieldsToKeep: ReadonlySet<string>,\n sourceRdpFields: ReadonlySet<string>,\n): ObjectHolder {\n const underlying = value[UnderlyingOsdkObject] as SimpleOsdkProperties;\n const objectDef = value[ObjectDefRef];\n\n const newProps: SimpleOsdkProperties = {\n $apiName: underlying.$apiName,\n $objectType: underlying.$objectType,\n $primaryKey: underlying.$primaryKey,\n $title: underlying.$title,\n };\n\n for (const key of Object.keys(underlying)) {\n if (key in objectDef.properties) {\n const isRdpField = sourceRdpFields.has(key);\n if (!isRdpField || rdpFieldsToKeep.has(key)) {\n newProps[key] = underlying[key];\n }\n }\n }\n\n return createOsdkObject(value[ClientRef], objectDef, newProps);\n}\n\nexport function mergeObjectFields(\n sourceValue: ObjectHolder,\n sourceRdpFields: ReadonlySet<string>,\n targetRdpFields: ReadonlySet<string>,\n targetCurrentValue: ObjectHolder | undefined,\n): ObjectHolder {\n if (targetRdpFields.size === 0) {\n return stripRdpFields(sourceValue, sourceRdpFields);\n }\n\n if (isSuperset(sourceRdpFields, targetRdpFields)) {\n if (sourceRdpFields.size === targetRdpFields.size) {\n return sourceValue;\n }\n return filterToRdpFields(sourceValue, targetRdpFields, sourceRdpFields);\n }\n\n const sourceUnderlying =\n sourceValue[UnderlyingOsdkObject] as SimpleOsdkProperties;\n const objectDef = sourceValue[ObjectDefRef];\n\n const newProps: SimpleOsdkProperties = {\n $apiName: sourceUnderlying.$apiName,\n $objectType: sourceUnderlying.$objectType,\n $primaryKey: sourceUnderlying.$primaryKey,\n $title: sourceUnderlying.$title,\n };\n\n for (const key of Object.keys(sourceUnderlying)) {\n if (\n key in objectDef.properties\n && (!sourceRdpFields.has(key) || targetRdpFields.has(key))\n ) {\n newProps[key] = sourceUnderlying[key];\n }\n }\n\n if (targetCurrentValue) {\n const targetUnderlying =\n targetCurrentValue[UnderlyingOsdkObject] as SimpleOsdkProperties;\n for (const field of targetRdpFields) {\n if (!sourceRdpFields.has(field) && field in targetUnderlying) {\n newProps[field] = targetUnderlying[field];\n }\n }\n }\n\n return createOsdkObject(\n sourceValue[ClientRef],\n objectDef,\n newProps,\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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ensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { describe, expect, it } from "vitest";
|
|
18
|
+
import { createOsdkObject } from "../../../object/convertWireToOsdkObjects/createOsdkObject.js";
|
|
19
|
+
import { ClientRef, ObjectDefRef, UnderlyingOsdkObject } from "../../../object/convertWireToOsdkObjects/InternalSymbols.js";
|
|
20
|
+
import { InterfaceDefinitions } from "../../../ontology/OntologyProvider.js";
|
|
21
|
+
import { extractRdpFieldNames, mergeObjectFields } from "./rdpFieldOperations.js";
|
|
22
|
+
const mockClient = {};
|
|
23
|
+
const employeeObjectDef = {
|
|
24
|
+
apiName: "Employee",
|
|
25
|
+
type: "object",
|
|
26
|
+
primaryKeyApiName: "employeeId",
|
|
27
|
+
primaryKeyType: "integer",
|
|
28
|
+
titleProperty: "fullName",
|
|
29
|
+
rid: "",
|
|
30
|
+
displayName: "",
|
|
31
|
+
description: undefined,
|
|
32
|
+
icon: undefined,
|
|
33
|
+
visibility: undefined,
|
|
34
|
+
pluralDisplayName: "",
|
|
35
|
+
status: "ACTIVE",
|
|
36
|
+
interfaceMap: {},
|
|
37
|
+
inverseInterfaceMap: {},
|
|
38
|
+
links: {},
|
|
39
|
+
implements: [],
|
|
40
|
+
[InterfaceDefinitions]: {},
|
|
41
|
+
properties: {
|
|
42
|
+
employeeId: {
|
|
43
|
+
type: "integer"
|
|
44
|
+
},
|
|
45
|
+
fullName: {
|
|
46
|
+
type: "string"
|
|
47
|
+
},
|
|
48
|
+
office: {
|
|
49
|
+
type: "string"
|
|
50
|
+
},
|
|
51
|
+
rdpField1: {
|
|
52
|
+
type: "string"
|
|
53
|
+
},
|
|
54
|
+
rdpField2: {
|
|
55
|
+
type: "double"
|
|
56
|
+
},
|
|
57
|
+
rdpField3: {
|
|
58
|
+
type: "string"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
function createTestObject(props) {
|
|
63
|
+
return createOsdkObject(mockClient, employeeObjectDef, {
|
|
64
|
+
...{
|
|
65
|
+
$apiName: "Employee",
|
|
66
|
+
$objectType: "Employee",
|
|
67
|
+
$primaryKey: 50030,
|
|
68
|
+
$title: "John Doe"
|
|
69
|
+
},
|
|
70
|
+
...props
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function assertValidObjectHolder(obj) {
|
|
74
|
+
expect(obj[UnderlyingOsdkObject]).toBeDefined();
|
|
75
|
+
expect(obj[ObjectDefRef]).toBeDefined();
|
|
76
|
+
expect(obj[ClientRef]).toBeDefined();
|
|
77
|
+
expect(obj[ClientRef]).toBe(mockClient);
|
|
78
|
+
expect(obj[ObjectDefRef]).toBe(employeeObjectDef);
|
|
79
|
+
expect(Object.isFrozen(obj)).toBe(true);
|
|
80
|
+
}
|
|
81
|
+
function getUnderlyingProps(obj) {
|
|
82
|
+
return obj[UnderlyingOsdkObject];
|
|
83
|
+
}
|
|
84
|
+
describe("rdpFieldOperations", () => {
|
|
85
|
+
it("extractRdpFieldNames returns empty set for undefined", () => {
|
|
86
|
+
expect(extractRdpFieldNames(undefined)).toEqual(new Set());
|
|
87
|
+
});
|
|
88
|
+
it("mergeObjectFields returns same object when source has no rdp fields", () => {
|
|
89
|
+
const source = createTestObject({
|
|
90
|
+
employeeId: 50030,
|
|
91
|
+
fullName: "John Doe"
|
|
92
|
+
});
|
|
93
|
+
const result = mergeObjectFields(source, new Set(), new Set(), undefined);
|
|
94
|
+
expect(result).toBe(source);
|
|
95
|
+
});
|
|
96
|
+
it("mergeObjectFields strips rdp fields from source", () => {
|
|
97
|
+
const source = createTestObject({
|
|
98
|
+
employeeId: 50030,
|
|
99
|
+
fullName: "John Doe",
|
|
100
|
+
rdpField1: "rdp-value-1",
|
|
101
|
+
rdpField2: 42
|
|
102
|
+
});
|
|
103
|
+
const result = mergeObjectFields(source, new Set(["rdpField1", "rdpField2"]), new Set(), undefined);
|
|
104
|
+
assertValidObjectHolder(result);
|
|
105
|
+
const underlying = getUnderlyingProps(result);
|
|
106
|
+
expect(underlying.employeeId).toBe(50030);
|
|
107
|
+
expect(underlying.fullName).toBe("John Doe");
|
|
108
|
+
expect(underlying.rdpField1).toBeUndefined();
|
|
109
|
+
expect(underlying.rdpField2).toBeUndefined();
|
|
110
|
+
});
|
|
111
|
+
it("mergeObjectFields returns source unchanged when rdp field sets are equal", () => {
|
|
112
|
+
const source = createTestObject({
|
|
113
|
+
employeeId: 50030,
|
|
114
|
+
rdpField1: "value",
|
|
115
|
+
rdpField2: 42
|
|
116
|
+
});
|
|
117
|
+
const rdpFields = new Set(["rdpField1", "rdpField2"]);
|
|
118
|
+
const result = mergeObjectFields(source, rdpFields, rdpFields, undefined);
|
|
119
|
+
expect(result).toBe(source);
|
|
120
|
+
});
|
|
121
|
+
it("mergeObjectFields filters to target rdp fields when source is strict superset", () => {
|
|
122
|
+
const source = createTestObject({
|
|
123
|
+
employeeId: 50030,
|
|
124
|
+
fullName: "John Doe",
|
|
125
|
+
rdpField1: "value1",
|
|
126
|
+
rdpField2: 42,
|
|
127
|
+
rdpField3: "value3"
|
|
128
|
+
});
|
|
129
|
+
const result = mergeObjectFields(source, new Set(["rdpField1", "rdpField2", "rdpField3"]), new Set(["rdpField1"]), undefined);
|
|
130
|
+
assertValidObjectHolder(result);
|
|
131
|
+
const underlying = getUnderlyingProps(result);
|
|
132
|
+
expect(underlying.employeeId).toBe(50030);
|
|
133
|
+
expect(underlying.fullName).toBe("John Doe");
|
|
134
|
+
expect(underlying.rdpField1).toBe("value1");
|
|
135
|
+
expect(underlying.rdpField2).toBeUndefined();
|
|
136
|
+
expect(underlying.rdpField3).toBeUndefined();
|
|
137
|
+
});
|
|
138
|
+
it("mergeObjectFields merges source and target rdp fields", () => {
|
|
139
|
+
const source = createTestObject({
|
|
140
|
+
employeeId: 50030,
|
|
141
|
+
fullName: "John Doe",
|
|
142
|
+
office: "NYC",
|
|
143
|
+
rdpField1: "source-rdp1"
|
|
144
|
+
});
|
|
145
|
+
const target = createTestObject({
|
|
146
|
+
employeeId: 50030,
|
|
147
|
+
rdpField2: 999
|
|
148
|
+
});
|
|
149
|
+
const result = mergeObjectFields(source, new Set(["rdpField1"]), new Set(["rdpField1", "rdpField2"]), target);
|
|
150
|
+
assertValidObjectHolder(result);
|
|
151
|
+
const underlying = getUnderlyingProps(result);
|
|
152
|
+
expect(underlying.employeeId).toBe(50030);
|
|
153
|
+
expect(underlying.fullName).toBe("John Doe");
|
|
154
|
+
expect(underlying.office).toBe("NYC");
|
|
155
|
+
expect(underlying.rdpField1).toBe("source-rdp1");
|
|
156
|
+
expect(underlying.rdpField2).toBe(999);
|
|
157
|
+
});
|
|
158
|
+
it("mergeObjectFields handles undefined target", () => {
|
|
159
|
+
const source = createTestObject({
|
|
160
|
+
employeeId: 50030,
|
|
161
|
+
fullName: "John Doe",
|
|
162
|
+
rdpField1: "source-rdp1"
|
|
163
|
+
});
|
|
164
|
+
const result = mergeObjectFields(source, new Set(["rdpField1"]), new Set(["rdpField1", "rdpField2"]), undefined);
|
|
165
|
+
assertValidObjectHolder(result);
|
|
166
|
+
const underlying = getUnderlyingProps(result);
|
|
167
|
+
expect(underlying.employeeId).toBe(50030);
|
|
168
|
+
expect(underlying.rdpField1).toBe("source-rdp1");
|
|
169
|
+
expect(underlying.rdpField2).toBeUndefined();
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
//# sourceMappingURL=rdpFieldOperations.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rdpFieldOperations.test.js","names":["describe","expect","it","createOsdkObject","ClientRef","ObjectDefRef","UnderlyingOsdkObject","InterfaceDefinitions","extractRdpFieldNames","mergeObjectFields","mockClient","employeeObjectDef","apiName","type","primaryKeyApiName","primaryKeyType","titleProperty","rid","displayName","description","undefined","icon","visibility","pluralDisplayName","status","interfaceMap","inverseInterfaceMap","links","implements","properties","employeeId","fullName","office","rdpField1","rdpField2","rdpField3","createTestObject","props","$apiName","$objectType","$primaryKey","$title","assertValidObjectHolder","obj","toBeDefined","toBe","Object","isFrozen","getUnderlyingProps","toEqual","Set","source","result","underlying","toBeUndefined","rdpFields","target"],"sources":["rdpFieldOperations.test.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 { describe, expect, it } from \"vitest\";\nimport type { MinimalClient } from \"../../../MinimalClientContext.js\";\nimport { createOsdkObject } from \"../../../object/convertWireToOsdkObjects/createOsdkObject.js\";\nimport {\n ClientRef,\n ObjectDefRef,\n UnderlyingOsdkObject,\n} from \"../../../object/convertWireToOsdkObjects/InternalSymbols.js\";\nimport type { ObjectHolder } from \"../../../object/convertWireToOsdkObjects/ObjectHolder.js\";\nimport type { SimpleOsdkProperties } from \"../../../object/SimpleOsdkProperties.js\";\nimport type { FetchedObjectTypeDefinition } from \"../../../ontology/OntologyProvider.js\";\nimport { InterfaceDefinitions } from \"../../../ontology/OntologyProvider.js\";\nimport {\n extractRdpFieldNames,\n mergeObjectFields,\n} from \"./rdpFieldOperations.js\";\n\nconst mockClient = {} as MinimalClient;\n\nconst employeeObjectDef = {\n apiName: \"Employee\",\n type: \"object\",\n primaryKeyApiName: \"employeeId\",\n primaryKeyType: \"integer\",\n titleProperty: \"fullName\",\n rid: \"\",\n displayName: \"\",\n description: undefined,\n icon: undefined,\n visibility: undefined,\n pluralDisplayName: \"\",\n status: \"ACTIVE\",\n interfaceMap: {},\n inverseInterfaceMap: {},\n links: {},\n implements: [],\n [InterfaceDefinitions]: {},\n properties: {\n employeeId: { type: \"integer\" },\n fullName: { type: \"string\" },\n office: { type: \"string\" },\n rdpField1: { type: \"string\" },\n rdpField2: { type: \"double\" },\n rdpField3: { type: \"string\" },\n },\n} satisfies FetchedObjectTypeDefinition;\n\nfunction createTestObject(\n props: Partial<SimpleOsdkProperties>,\n): ObjectHolder {\n const defaultProps: SimpleOsdkProperties = {\n $apiName: \"Employee\",\n $objectType: \"Employee\",\n $primaryKey: 50030,\n $title: \"John Doe\",\n };\n return createOsdkObject(mockClient, employeeObjectDef, {\n ...defaultProps,\n ...props,\n });\n}\n\nfunction assertValidObjectHolder(obj: ObjectHolder): void {\n expect(obj[UnderlyingOsdkObject]).toBeDefined();\n expect(obj[ObjectDefRef]).toBeDefined();\n expect(obj[ClientRef]).toBeDefined();\n expect(obj[ClientRef]).toBe(mockClient);\n expect(obj[ObjectDefRef]).toBe(employeeObjectDef);\n expect(Object.isFrozen(obj)).toBe(true);\n}\n\nfunction getUnderlyingProps(obj: ObjectHolder): SimpleOsdkProperties {\n return obj[UnderlyingOsdkObject] as SimpleOsdkProperties;\n}\n\ndescribe(\"rdpFieldOperations\", () => {\n it(\"extractRdpFieldNames returns empty set for undefined\", () => {\n expect(extractRdpFieldNames(undefined)).toEqual(new Set());\n });\n\n it(\"mergeObjectFields returns same object when source has no rdp fields\", () => {\n const source = createTestObject({\n employeeId: 50030,\n fullName: \"John Doe\",\n });\n\n const result = mergeObjectFields(source, new Set(), new Set(), undefined);\n\n expect(result).toBe(source);\n });\n\n it(\"mergeObjectFields strips rdp fields from source\", () => {\n const source = createTestObject({\n employeeId: 50030,\n fullName: \"John Doe\",\n rdpField1: \"rdp-value-1\",\n rdpField2: 42,\n });\n\n const result = mergeObjectFields(\n source,\n new Set([\"rdpField1\", \"rdpField2\"]),\n new Set(),\n undefined,\n );\n\n assertValidObjectHolder(result);\n const underlying = getUnderlyingProps(result);\n expect(underlying.employeeId).toBe(50030);\n expect(underlying.fullName).toBe(\"John Doe\");\n expect(underlying.rdpField1).toBeUndefined();\n expect(underlying.rdpField2).toBeUndefined();\n });\n\n it(\"mergeObjectFields returns source unchanged when rdp field sets are equal\", () => {\n const source = createTestObject({\n employeeId: 50030,\n rdpField1: \"value\",\n rdpField2: 42,\n });\n const rdpFields = new Set([\"rdpField1\", \"rdpField2\"]);\n\n const result = mergeObjectFields(source, rdpFields, rdpFields, undefined);\n\n expect(result).toBe(source);\n });\n\n it(\"mergeObjectFields filters to target rdp fields when source is strict superset\", () => {\n const source = createTestObject({\n employeeId: 50030,\n fullName: \"John Doe\",\n rdpField1: \"value1\",\n rdpField2: 42,\n rdpField3: \"value3\",\n });\n\n const result = mergeObjectFields(\n source,\n new Set([\"rdpField1\", \"rdpField2\", \"rdpField3\"]),\n new Set([\"rdpField1\"]),\n undefined,\n );\n\n assertValidObjectHolder(result);\n const underlying = getUnderlyingProps(result);\n expect(underlying.employeeId).toBe(50030);\n expect(underlying.fullName).toBe(\"John Doe\");\n expect(underlying.rdpField1).toBe(\"value1\");\n expect(underlying.rdpField2).toBeUndefined();\n expect(underlying.rdpField3).toBeUndefined();\n });\n\n it(\"mergeObjectFields merges source and target rdp fields\", () => {\n const source = createTestObject({\n employeeId: 50030,\n fullName: \"John Doe\",\n office: \"NYC\",\n rdpField1: \"source-rdp1\",\n });\n const target = createTestObject({\n employeeId: 50030,\n rdpField2: 999,\n });\n\n const result = mergeObjectFields(\n source,\n new Set([\"rdpField1\"]),\n new Set([\"rdpField1\", \"rdpField2\"]),\n target,\n );\n\n assertValidObjectHolder(result);\n const underlying = getUnderlyingProps(result);\n expect(underlying.employeeId).toBe(50030);\n expect(underlying.fullName).toBe(\"John Doe\");\n expect(underlying.office).toBe(\"NYC\");\n expect(underlying.rdpField1).toBe(\"source-rdp1\");\n expect(underlying.rdpField2).toBe(999);\n });\n\n it(\"mergeObjectFields handles undefined target\", () => {\n const source = createTestObject({\n employeeId: 50030,\n fullName: \"John Doe\",\n rdpField1: \"source-rdp1\",\n });\n\n const result = mergeObjectFields(\n source,\n new Set([\"rdpField1\"]),\n new Set([\"rdpField1\", \"rdpField2\"]),\n undefined,\n );\n\n assertValidObjectHolder(result);\n const underlying = getUnderlyingProps(result);\n expect(underlying.employeeId).toBe(50030);\n expect(underlying.rdpField1).toBe(\"source-rdp1\");\n expect(underlying.rdpField2).toBeUndefined();\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAE7C,SAASC,gBAAgB,QAAQ,8DAA8D;AAC/F,SACEC,SAAS,EACTC,YAAY,EACZC,oBAAoB,QACf,6DAA6D;AAIpE,SAASC,oBAAoB,QAAQ,uCAAuC;AAC5E,SACEC,oBAAoB,EACpBC,iBAAiB,QACZ,yBAAyB;AAEhC,MAAMC,UAAU,GAAG,CAAC,CAAkB;AAEtC,MAAMC,iBAAiB,GAAG;EACxBC,OAAO,EAAE,UAAU;EACnBC,IAAI,EAAE,QAAQ;EACdC,iBAAiB,EAAE,YAAY;EAC/BC,cAAc,EAAE,SAAS;EACzBC,aAAa,EAAE,UAAU;EACzBC,GAAG,EAAE,EAAE;EACPC,WAAW,EAAE,EAAE;EACfC,WAAW,EAAEC,SAAS;EACtBC,IAAI,EAAED,SAAS;EACfE,UAAU,EAAEF,SAAS;EACrBG,iBAAiB,EAAE,EAAE;EACrBC,MAAM,EAAE,QAAQ;EAChBC,YAAY,EAAE,CAAC,CAAC;EAChBC,mBAAmB,EA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CAAC;IAChD5C,MAAM,CAACoD,UAAU,CAACnB,SAAS,CAAC,CAACW,IAAI,CAAC,GAAG,CAAC;EACxC,CAAC,CAAC;EAEF3C,EAAE,CAAC,4CAA4C,EAAE,MAAM;IACrD,MAAMiD,MAAM,GAAGf,gBAAgB,CAAC;MAC9BN,UAAU,EAAE,KAAK;MACjBC,QAAQ,EAAE,UAAU;MACpBE,SAAS,EAAE;IACb,CAAC,CAAC;IAEF,MAAMmB,MAAM,GAAG3C,iBAAiB,CAC9B0C,MAAM,EACN,IAAID,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC,EACtB,IAAIA,GAAG,CAAC,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,EACnC9B,SACF,CAAC;IAEDsB,uBAAuB,CAACU,MAAM,CAAC;IAC/B,MAAMC,UAAU,GAAGL,kBAAkB,CAACI,MAAM,CAAC;IAC7CnD,MAAM,CAACoD,UAAU,CAACvB,UAAU,CAAC,CAACe,IAAI,CAAC,KAAK,CAAC;IACzC5C,MAAM,CAACoD,UAAU,CAACpB,SAAS,CAAC,CAACY,IAAI,CAAC,aAAa,CAAC;IAChD5C,MAAM,CAACoD,UAAU,CAACnB,SAAS,CAAC,CAACoB,aAAa,CAAC,CAAC;EAC9C,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -17,7 +17,9 @@
|
|
|
17
17
|
import * as OntologiesV2 from "@osdk/foundry.ontologies";
|
|
18
18
|
import { wireActionTypeV2ToSdkActionMetadata } from "@osdk/generator-converters";
|
|
19
19
|
export async function loadActionMetadata(client, actionType) {
|
|
20
|
-
const r = await OntologiesV2.ActionTypesV2.get(client, await client.ontologyRid, actionType
|
|
20
|
+
const r = await OntologiesV2.ActionTypesV2.get(client, await client.ontologyRid, actionType, {
|
|
21
|
+
branch: client.branch
|
|
22
|
+
});
|
|
21
23
|
return wireActionTypeV2ToSdkActionMetadata(r);
|
|
22
24
|
}
|
|
23
25
|
//# sourceMappingURL=loadActionMetadata.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadActionMetadata.js","names":["OntologiesV2","wireActionTypeV2ToSdkActionMetadata","loadActionMetadata","client","actionType","r","ActionTypesV2","get","ontologyRid"],"sources":["loadActionMetadata.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ActionMetadata } from \"@osdk/api\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport {\n wireActionTypeV2ToSdkActionMetadata,\n} from \"@osdk/generator-converters\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\n\nexport async function loadActionMetadata(\n client: MinimalClient,\n actionType: string,\n): Promise<ActionMetadata> {\n const r = await OntologiesV2.ActionTypesV2.get(\n client,\n await client.ontologyRid,\n actionType,\n );\n\n return wireActionTypeV2ToSdkActionMetadata(r);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAO,KAAKA,YAAY,MAAM,0BAA0B;AACxD,SACEC,mCAAmC,QAC9B,4BAA4B;AAGnC,OAAO,eAAeC,kBAAkBA,CACtCC,MAAqB,EACrBC,UAAkB,EACO;EACzB,MAAMC,CAAC,GAAG,MAAML,YAAY,CAACM,aAAa,CAACC,GAAG,CAC5CJ,MAAM,EACN,MAAMA,MAAM,CAACK,WAAW,EACxBJ,
|
|
1
|
+
{"version":3,"file":"loadActionMetadata.js","names":["OntologiesV2","wireActionTypeV2ToSdkActionMetadata","loadActionMetadata","client","actionType","r","ActionTypesV2","get","ontologyRid","branch"],"sources":["loadActionMetadata.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ActionMetadata } from \"@osdk/api\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport {\n wireActionTypeV2ToSdkActionMetadata,\n} from \"@osdk/generator-converters\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\n\nexport async function loadActionMetadata(\n client: MinimalClient,\n actionType: string,\n): Promise<ActionMetadata> {\n const r = await OntologiesV2.ActionTypesV2.get(\n client,\n await client.ontologyRid,\n actionType,\n { branch: client.branch },\n );\n\n return wireActionTypeV2ToSdkActionMetadata(r);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAO,KAAKA,YAAY,MAAM,0BAA0B;AACxD,SACEC,mCAAmC,QAC9B,4BAA4B;AAGnC,OAAO,eAAeC,kBAAkBA,CACtCC,MAAqB,EACrBC,UAAkB,EACO;EACzB,MAAMC,CAAC,GAAG,MAAML,YAAY,CAACM,aAAa,CAACC,GAAG,CAC5CJ,MAAM,EACN,MAAMA,MAAM,CAACK,WAAW,EACxBJ,UAAU,EACV;IAAEK,MAAM,EAAEN,MAAM,CAACM;EAAO,CAC1B,CAAC;EAED,OAAOR,mCAAmC,CAACI,CAAC,CAAC;AAC/C","ignoreList":[]}
|
|
@@ -18,7 +18,8 @@ import * as OntologiesV2 from "@osdk/foundry.ontologies";
|
|
|
18
18
|
import { wireObjectTypeFullMetadataToSdkObjectMetadata } from "@osdk/generator-converters";
|
|
19
19
|
export async function loadFullObjectMetadata(client, objectType) {
|
|
20
20
|
const full = await OntologiesV2.ObjectTypesV2.getFullMetadata(client, await client.ontologyRid, objectType, {
|
|
21
|
-
preview: true
|
|
21
|
+
preview: true,
|
|
22
|
+
branch: client.branch
|
|
22
23
|
});
|
|
23
24
|
const ret = wireObjectTypeFullMetadataToSdkObjectMetadata(full, true);
|
|
24
25
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadFullObjectMetadata.js","names":["OntologiesV2","wireObjectTypeFullMetadataToSdkObjectMetadata","loadFullObjectMetadata","client","objectType","full","ObjectTypesV2","getFullMetadata","ontologyRid","preview","ret"],"sources":["loadFullObjectMetadata.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ObjectMetadata } from \"@osdk/api\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport { wireObjectTypeFullMetadataToSdkObjectMetadata } from \"@osdk/generator-converters\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\n\nexport async function loadFullObjectMetadata(\n client: MinimalClient,\n objectType: string,\n): Promise<ObjectMetadata & { rid: string }> {\n const full = await OntologiesV2.ObjectTypesV2.getFullMetadata(\n client,\n await client.ontologyRid,\n objectType,\n { preview: true },\n );\n const ret = wireObjectTypeFullMetadataToSdkObjectMetadata(full, true);\n return { ...ret };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAO,KAAKA,YAAY,MAAM,0BAA0B;AACxD,SAASC,6CAA6C,QAAQ,4BAA4B;AAG1F,OAAO,eAAeC,sBAAsBA,CAC1CC,MAAqB,EACrBC,UAAkB,EACyB;EAC3C,MAAMC,IAAI,GAAG,MAAML,YAAY,CAACM,aAAa,CAACC,eAAe,CAC3DJ,MAAM,EACN,MAAMA,MAAM,CAACK,WAAW,EACxBJ,UAAU,EACV;IAAEK,OAAO,EAAE;
|
|
1
|
+
{"version":3,"file":"loadFullObjectMetadata.js","names":["OntologiesV2","wireObjectTypeFullMetadataToSdkObjectMetadata","loadFullObjectMetadata","client","objectType","full","ObjectTypesV2","getFullMetadata","ontologyRid","preview","branch","ret"],"sources":["loadFullObjectMetadata.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ObjectMetadata } from \"@osdk/api\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport { wireObjectTypeFullMetadataToSdkObjectMetadata } from \"@osdk/generator-converters\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\n\nexport async function loadFullObjectMetadata(\n client: MinimalClient,\n objectType: string,\n): Promise<ObjectMetadata & { rid: string }> {\n const full = await OntologiesV2.ObjectTypesV2.getFullMetadata(\n client,\n await client.ontologyRid,\n objectType,\n { preview: true, branch: client.branch },\n );\n const ret = wireObjectTypeFullMetadataToSdkObjectMetadata(full, true);\n return { ...ret };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAO,KAAKA,YAAY,MAAM,0BAA0B;AACxD,SAASC,6CAA6C,QAAQ,4BAA4B;AAG1F,OAAO,eAAeC,sBAAsBA,CAC1CC,MAAqB,EACrBC,UAAkB,EACyB;EAC3C,MAAMC,IAAI,GAAG,MAAML,YAAY,CAACM,aAAa,CAACC,eAAe,CAC3DJ,MAAM,EACN,MAAMA,MAAM,CAACK,WAAW,EACxBJ,UAAU,EACV;IAAEK,OAAO,EAAE,IAAI;IAAEC,MAAM,EAAEP,MAAM,CAACO;EAAO,CACzC,CAAC;EACD,MAAMC,GAAG,GAAGV,6CAA6C,CAACI,IAAI,EAAE,IAAI,CAAC;EACrE,OAAO;IAAE,GAAGM;EAAI,CAAC;AACnB","ignoreList":[]}
|
|
@@ -18,7 +18,8 @@ import * as OntologiesV2 from "@osdk/foundry.ontologies";
|
|
|
18
18
|
import { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from "@osdk/generator-converters";
|
|
19
19
|
export async function loadInterfaceMetadata(client, objectType) {
|
|
20
20
|
const r = await OntologiesV2.OntologyInterfaces.get(client, await client.ontologyRid, objectType, {
|
|
21
|
-
preview: true
|
|
21
|
+
preview: true,
|
|
22
|
+
branch: client.branch
|
|
22
23
|
});
|
|
23
24
|
return __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(r, true);
|
|
24
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadInterfaceMetadata.js","names":["OntologiesV2","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","loadInterfaceMetadata","client","objectType","r","OntologyInterfaces","get","ontologyRid","preview"],"sources":["loadInterfaceMetadata.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 * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from \"@osdk/generator-converters\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\n\nexport async function loadInterfaceMetadata(\n client: MinimalClient,\n objectType: string,\n): Promise<InterfaceMetadata> {\n const r = await OntologiesV2.OntologyInterfaces.get(\n client,\n await client.ontologyRid,\n objectType,\n { preview: true },\n );\n\n return __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(r, true);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAO,KAAKA,YAAY,MAAM,0BAA0B;AACxD,SAASC,mDAAmD,QAAQ,4BAA4B;AAGhG,OAAO,eAAeC,qBAAqBA,CACzCC,MAAqB,EACrBC,UAAkB,EACU;EAC5B,MAAMC,CAAC,GAAG,MAAML,YAAY,CAACM,kBAAkB,CAACC,GAAG,CACjDJ,MAAM,EACN,MAAMA,MAAM,CAACK,WAAW,EACxBJ,UAAU,EACV;IAAEK,OAAO,EAAE;
|
|
1
|
+
{"version":3,"file":"loadInterfaceMetadata.js","names":["OntologiesV2","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","loadInterfaceMetadata","client","objectType","r","OntologyInterfaces","get","ontologyRid","preview","branch"],"sources":["loadInterfaceMetadata.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 * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from \"@osdk/generator-converters\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\n\nexport async function loadInterfaceMetadata(\n client: MinimalClient,\n objectType: string,\n): Promise<InterfaceMetadata> {\n const r = await OntologiesV2.OntologyInterfaces.get(\n client,\n await client.ontologyRid,\n objectType,\n { preview: true, branch: client.branch },\n );\n\n return __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(r, true);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAO,KAAKA,YAAY,MAAM,0BAA0B;AACxD,SAASC,mDAAmD,QAAQ,4BAA4B;AAGhG,OAAO,eAAeC,qBAAqBA,CACzCC,MAAqB,EACrBC,UAAkB,EACU;EAC5B,MAAMC,CAAC,GAAG,MAAML,YAAY,CAACM,kBAAkB,CAACC,GAAG,CACjDJ,MAAM,EACN,MAAMA,MAAM,CAACK,WAAW,EACxBJ,UAAU,EACV;IAAEK,OAAO,EAAE,IAAI;IAAEC,MAAM,EAAEP,MAAM,CAACO;EAAO,CACzC,CAAC;EAED,OAAOT,mDAAmD,CAACI,CAAC,EAAE,IAAI,CAAC;AACrE","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unstable-do-not-use.js","names":["augment","computeObjectSetCacheKey","createObservableClient","getMetaTagContent","getOsdkConfig","createClientWithTransaction"],"sources":["unstable-do-not-use.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { augment } from \"../object/fetchPage.js\";\n\n// THIS IS NOT THE FINAL NAME DO NOT SHIP LIKE THIS\nexport type { ActionSignatureFromDef } from \"../actions/applyAction.js\";\nexport { computeObjectSetCacheKey } from \"../observable/computeObjectSetCacheKey.js\";\nexport { createObservableClient } from \"../observable/ObservableClient.js\";\nexport type {\n ObservableClient,\n ObserveAggregationArgs,\n
|
|
1
|
+
{"version":3,"file":"unstable-do-not-use.js","names":["augment","computeObjectSetCacheKey","createObservableClient","getMetaTagContent","getOsdkConfig","createClientWithTransaction"],"sources":["unstable-do-not-use.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { augment } from \"../object/fetchPage.js\";\n\n// THIS IS NOT THE FINAL NAME DO NOT SHIP LIKE THIS\nexport type { ActionSignatureFromDef } from \"../actions/applyAction.js\";\nexport { computeObjectSetCacheKey } from \"../observable/computeObjectSetCacheKey.js\";\nexport { createObservableClient } from \"../observable/ObservableClient.js\";\nexport type {\n ObservableClient,\n ObserveAggregationArgs,\n ObserveObjectCallbackArgs,\n ObserveObjectsCallbackArgs,\n ObserveObjectSetArgs,\n Unsubscribable,\n} from \"../observable/ObservableClient.js\";\nexport type { Observer } from \"../observable/ObservableClient/common.js\";\nexport type { ObserveLinks } from \"../observable/ObservableClient/ObserveLink.js\";\nexport {\n getMetaTagContent,\n getOsdkConfig,\n} from \"../public-utils/osdkConfig.js\";\nexport type { OsdkConfig } from \"../public-utils/osdkConfig.js\";\n\nexport { createClientWithTransaction } from \"../createClient.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAQ,wBAAwB;;AAEhD;;AAEA,SAASC,wBAAwB,QAAQ,2CAA2C;AACpF,SAASC,sBAAsB,QAAQ,mCAAmC;AAW1E,SACEC,iBAAiB,EACjBC,aAAa,QACR,+BAA+B;AAGtC,SAASC,2BAA2B,QAAQ,oBAAoB","ignoreList":[]}
|
|
@@ -188,6 +188,12 @@ async function getRequiredDefinitions(dataType, client) {
|
|
|
188
188
|
result.set(dataType.objectSet, objectDef);
|
|
189
189
|
break;
|
|
190
190
|
}
|
|
191
|
+
case "interfaceObjectSet":
|
|
192
|
+
{
|
|
193
|
+
const interfaceDef = await client.ontologyProvider.getInterfaceDefinition(dataType.objectSet);
|
|
194
|
+
result.set(dataType.objectSet, interfaceDef);
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
191
197
|
case "object":
|
|
192
198
|
{
|
|
193
199
|
const objectDef = await client.ontologyProvider.getObjectDefinition(dataType.object);
|
|
@@ -204,6 +210,10 @@ async function getRequiredDefinitions(dataType, client) {
|
|
|
204
210
|
{
|
|
205
211
|
return getRequiredDefinitions(dataType.set, client);
|
|
206
212
|
}
|
|
213
|
+
case "array":
|
|
214
|
+
{
|
|
215
|
+
return getRequiredDefinitions(dataType.array, client);
|
|
216
|
+
}
|
|
207
217
|
case "map":
|
|
208
218
|
{
|
|
209
219
|
const types = [dataType.keyType, dataType.valueType];
|
|
@@ -239,6 +249,10 @@ async function getRequiredDefinitions(dataType, client) {
|
|
|
239
249
|
case "twoDimensionalAggregation":
|
|
240
250
|
case "union":
|
|
241
251
|
break;
|
|
252
|
+
default:
|
|
253
|
+
{
|
|
254
|
+
break;
|
|
255
|
+
}
|
|
242
256
|
}
|
|
243
257
|
return result;
|
|
244
258
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyQuery.js","names":["OntologiesV2","invariant","createObjectSet","hydrateAttachmentFromRidInternal","addUserAgentAndRequestContextHeaders","augmentRequestContext","createObjectSpecifierFromInterfaceSpecifier","createObjectSpecifierFromPrimaryKey","toDataValueQueries","applyQuery","client","query","params","qd","ontologyProvider","getQueryDefinition","apiName","isFixedVersion","version","undefined","flushEdits","response","Queries","execute","finalMethodCall","ontologyRid","parameters","remapQueryParams","transactionId","objectOutputDefs","getRequiredDefinitions","output","remappedResponse","remapQueryResponse","value","paramTypes","parameterMap","key","Object","entries","responseDataType","responseValue","definitions","nullable","Error","type","i","length","array","set","def","get","object","createQueryObjectResponse","interface","createQueryInterfaceResponse","objectSet","objectSets","objectType","reference","subtype","struct","requiresConversion","map","Array","isArray","process","env","NODE_ENV","entry","keyType","getObjectSpecifier","valueType","result","groups","push","subResult","subKey","dataType","Map","objectDef","getObjectDefinition","interfaceDef","getInterfaceDefinition","types","allDefs","Promise","all","defs","structValues","values","some","primaryKey","objectTypeApiName","$apiName","$title","$objectType","$primaryKey","$objectSpecifier","interfaceSpecifier","primaryKeyValue"],"sources":["applyQuery.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 AllowedBucketKeyTypes,\n AllowedBucketTypes,\n CompileTimeMetadata,\n InterfaceDefinition,\n ObjectOrInterfaceDefinition,\n ObjectTypeDefinition,\n OsdkBase,\n PrimaryKeyType,\n QueryDataTypeDefinition,\n QueryDefinition,\n QueryMetadata,\n QueryParameterDefinition,\n} from \"@osdk/api\";\nimport type { DataValue } from \"@osdk/foundry.ontologies\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { createObjectSet } from \"../objectSet/createObjectSet.js\";\nimport { hydrateAttachmentFromRidInternal } from \"../public-utils/hydrateAttachmentFromRid.js\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\nimport { augmentRequestContext } from \"../util/augmentRequestContext.js\";\nimport {\n createObjectSpecifierFromInterfaceSpecifier,\n createObjectSpecifierFromPrimaryKey,\n} from \"../util/objectSpecifierUtils.js\";\nimport { toDataValueQueries } from \"../util/toDataValueQueries.js\";\nimport type { QueryParameterType, QueryReturnType } from \"./types.js\";\n\nexport async function applyQuery<\n QD extends QueryDefinition<any>,\n P extends QueryParameterType<CompileTimeMetadata<QD>[\"parameters\"]>,\n>(\n client: MinimalClient,\n query: QD,\n params?: P,\n): Promise<\n QueryReturnType<CompileTimeMetadata<QD>[\"output\"]>\n> {\n // We fire and forget so if a function has no parameters we don't unnecessarily load all metadata\n const qd: Promise<QueryMetadata> = client.ontologyProvider.getQueryDefinition(\n query.apiName,\n query.isFixedVersion ? query.version : undefined,\n );\n\n if (client.flushEdits != null) {\n await client.flushEdits();\n }\n\n const response = await OntologiesV2.Queries.execute(\n addUserAgentAndRequestContextHeaders(\n augmentRequestContext(client, _ => ({ finalMethodCall: \"applyQuery\" })),\n query,\n ),\n await client.ontologyRid,\n query.apiName,\n {\n parameters: params\n ? await remapQueryParams(\n params as { [parameterId: string]: any },\n client,\n (await qd).parameters,\n )\n : {},\n },\n {\n version: query.isFixedVersion ? query.version : undefined,\n transactionId: client.transactionId,\n },\n );\n\n const objectOutputDefs = await getRequiredDefinitions(\n (await qd).output,\n client,\n );\n const remappedResponse = await remapQueryResponse(\n client,\n (await qd).output,\n response.value,\n objectOutputDefs,\n );\n return remappedResponse as QueryReturnType<CompileTimeMetadata<QD>[\"output\"]>;\n}\n\nasync function remapQueryParams(\n params: { [parameterId: string]: any },\n client: MinimalClient,\n paramTypes: Record<string, QueryParameterDefinition<any>>,\n): Promise<{ [parameterId: string]: any }> {\n const parameterMap: { [parameterName: string]: unknown } = {};\n for (const [key, value] of Object.entries(params)) {\n parameterMap[key] = await toDataValueQueries(\n value,\n client,\n paramTypes[key],\n );\n }\n return parameterMap;\n}\n\nasync function remapQueryResponse<\n Q extends ObjectTypeDefinition,\n T extends QueryDataTypeDefinition<Q | never>,\n>(\n client: MinimalClient,\n responseDataType: T,\n responseValue: DataValue,\n definitions: Map<string, ObjectOrInterfaceDefinition>,\n): Promise<QueryReturnType<T>> {\n // handle null responses\n if (responseValue == null) {\n if (responseDataType.nullable) {\n return undefined as unknown as QueryReturnType<typeof responseDataType>;\n } else {\n throw new Error(\"Got null response when nullable was not allowed\");\n }\n }\n\n switch (responseDataType.type) {\n case \"union\": {\n throw new Error(\"Union return types are not yet supported\");\n }\n\n case \"array\": {\n for (let i = 0; i < responseValue.length; i++) {\n responseValue[i] = await remapQueryResponse(\n client,\n responseDataType.array,\n responseValue[i],\n definitions,\n );\n }\n\n return responseValue as QueryReturnType<typeof responseDataType>;\n }\n\n case \"set\": {\n for (let i = 0; i < responseValue.length; i++) {\n responseValue[i] = await remapQueryResponse(\n client,\n responseDataType.set,\n responseValue[i],\n definitions,\n );\n }\n\n return responseValue as QueryReturnType<typeof responseDataType>;\n }\n\n case \"attachment\": {\n return hydrateAttachmentFromRidInternal(\n client,\n responseValue,\n ) as QueryReturnType<\n typeof responseDataType\n >;\n }\n\n case \"object\": {\n const def = definitions.get(responseDataType.object);\n if (!def || def.type !== \"object\") {\n throw new Error(\n `Missing definition for ${responseDataType.object}`,\n );\n }\n return createQueryObjectResponse(\n responseValue,\n def,\n ) as QueryReturnType<\n typeof responseDataType\n >;\n }\n\n case \"interface\": {\n const def = definitions.get(responseDataType.interface);\n if (!def || def.type !== \"interface\") {\n throw new Error(\n `Missing definition for ${responseDataType.interface}`,\n );\n }\n\n return createQueryInterfaceResponse(\n responseValue,\n def,\n ) as QueryReturnType<\n typeof responseDataType\n >;\n }\n\n case \"objectSet\": {\n const def = definitions.get(responseDataType.objectSet);\n if (!def) {\n throw new Error(\n `Missing definition for ${responseDataType.objectSet}`,\n );\n }\n if (typeof responseValue === \"string\") {\n return createObjectSet(def, client, {\n type: \"intersect\",\n objectSets: [\n { type: \"base\", objectType: responseDataType.objectSet },\n { type: \"reference\", reference: responseValue },\n ],\n }) as QueryReturnType<typeof responseDataType>;\n }\n\n return createObjectSet(\n def,\n client,\n responseValue,\n ) as QueryReturnType<\n typeof responseDataType\n >;\n }\n\n case \"struct\": {\n // figure out what keys need to be fixed up\n for (const [key, subtype] of Object.entries(responseDataType.struct)) {\n if (requiresConversion(subtype)) {\n responseValue[key] = await remapQueryResponse(\n client,\n subtype,\n responseValue[key],\n definitions,\n );\n }\n }\n\n return responseValue as QueryReturnType<typeof responseDataType>;\n }\n\n case \"map\": {\n const map = {} as any;\n\n invariant(Array.isArray(responseValue), \"Expected array entry\");\n for (const entry of responseValue) {\n invariant(entry.key != null, \"Expected key\");\n invariant(entry.value != null, \"Expected value\");\n const key = responseDataType.keyType.type === \"object\"\n ? getObjectSpecifier(\n entry.key,\n responseDataType.keyType.object,\n definitions,\n )\n : entry.key;\n const value = await remapQueryResponse(\n client,\n responseDataType.valueType,\n entry.value,\n definitions,\n );\n map[key] = value;\n }\n return map;\n }\n\n case \"twoDimensionalAggregation\": {\n const result: {\n key: AllowedBucketKeyTypes;\n value: AllowedBucketTypes;\n }[] = [];\n for (const { key, value } of responseValue.groups) {\n result.push({ key, value });\n }\n return result as QueryReturnType<typeof responseDataType>;\n }\n\n case \"threeDimensionalAggregation\": {\n const result: {\n key: AllowedBucketKeyTypes;\n groups: { key: AllowedBucketKeyTypes; value: AllowedBucketTypes }[];\n }[] = [];\n for (const { key, groups } of responseValue.groups) {\n const subResult: { key: any; value: any }[] = [];\n for (const { key: subKey, value } of groups) {\n subResult.push({ key: subKey, value });\n }\n result.push({ key, groups: subResult });\n }\n return result as QueryReturnType<typeof responseDataType>;\n }\n }\n\n return responseValue as QueryReturnType<typeof responseDataType>;\n}\n\nasync function getRequiredDefinitions(\n dataType: QueryDataTypeDefinition,\n client: MinimalClient,\n): Promise<Map<string, ObjectOrInterfaceDefinition>> {\n const result = new Map<string, ObjectOrInterfaceDefinition>();\n switch (dataType.type) {\n case \"objectSet\": {\n const objectDef = await client.ontologyProvider.getObjectDefinition(\n dataType.objectSet,\n );\n result.set(dataType.objectSet, objectDef);\n break;\n }\n case \"object\": {\n const objectDef = await client.ontologyProvider.getObjectDefinition(\n dataType.object,\n );\n result.set(dataType.object, objectDef);\n break;\n }\n\n case \"interface\": {\n const interfaceDef = await client.ontologyProvider.getInterfaceDefinition(\n dataType.interface,\n );\n result.set(dataType.interface, interfaceDef);\n break;\n }\n\n case \"set\": {\n return getRequiredDefinitions(dataType.set, client);\n }\n\n case \"map\": {\n const types = [dataType.keyType, dataType.valueType];\n\n const allDefs = await Promise.all(\n types.map(value => getRequiredDefinitions(value, client)),\n );\n\n for (const defs of allDefs) {\n for (const [type, objectDef] of defs) {\n result.set(type, objectDef);\n }\n }\n break;\n }\n\n case \"struct\": {\n const structValues = Object.values(dataType.struct);\n\n const allDefs = await Promise.all(\n structValues.map(value => getRequiredDefinitions(value, client)),\n );\n\n for (const defs of allDefs) {\n for (const [type, objectDef] of defs) {\n result.set(type, objectDef);\n }\n }\n break;\n }\n case \"attachment\":\n case \"boolean\":\n case \"date\":\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n case \"string\":\n case \"threeDimensionalAggregation\":\n case \"timestamp\":\n case \"twoDimensionalAggregation\":\n case \"union\":\n break;\n }\n\n return result;\n}\nfunction requiresConversion(dataType: QueryDataTypeDefinition) {\n switch (dataType.type) {\n case \"boolean\":\n case \"date\":\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n case \"string\":\n case \"timestamp\":\n return false;\n\n case \"union\":\n return true;\n\n case \"struct\":\n return Object.values(dataType.struct).some(requiresConversion);\n\n case \"set\":\n return requiresConversion(dataType.set);\n\n case \"attachment\":\n case \"objectSet\":\n case \"twoDimensionalAggregation\":\n case \"threeDimensionalAggregation\":\n case \"object\":\n return true;\n\n default:\n return false;\n }\n}\n\nfunction getObjectSpecifier(\n primaryKey: any,\n objectTypeApiName: string,\n definitions: Map<string, ObjectOrInterfaceDefinition>,\n): string {\n const def = definitions.get(objectTypeApiName);\n if (!def || def.type !== \"object\") {\n throw new Error(\n `Missing definition for ${objectTypeApiName}`,\n );\n }\n return createObjectSpecifierFromPrimaryKey(\n def,\n primaryKey,\n );\n}\n\nexport function createQueryObjectResponse<\n Q extends ObjectTypeDefinition,\n>(\n primaryKey: PrimaryKeyType<Q>,\n objectDef: Q,\n): OsdkBase<Q> {\n return {\n $apiName: objectDef.apiName,\n $title: undefined,\n $objectType: objectDef.apiName,\n $primaryKey: primaryKey,\n $objectSpecifier: createObjectSpecifierFromPrimaryKey(\n objectDef,\n primaryKey,\n ),\n };\n}\n\nexport function createQueryInterfaceResponse<\n Q extends InterfaceDefinition,\n>(\n interfaceSpecifier: {\n objectTypeApiName: string;\n primaryKeyValue: PrimaryKeyType<Q>;\n },\n interfaceDef: Q,\n): OsdkBase<Q> {\n return {\n $apiName: interfaceDef.apiName,\n $title: undefined,\n $objectType: interfaceSpecifier.objectTypeApiName,\n $primaryKey: interfaceSpecifier.primaryKeyValue,\n $objectSpecifier: createObjectSpecifierFromInterfaceSpecifier(\n interfaceDef,\n interfaceSpecifier,\n ),\n };\n}\n"],"mappings":"AAAA;AACA;AAC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K;MACR,OAAOA,kBAAkB,CAACgB,QAAQ,CAAC7B,GAAG,CAAC;IAEzC,KAAK,YAAY;IACjB,KAAK,WAAW;IAChB,KAAK,2BAA2B;IAChC,KAAK,6BAA6B;IAClC,KAAK,QAAQ;MACX,OAAO,IAAI;IAEb;MACE,OAAO,KAAK;EAChB;AACF;AAEA,SAASsB,kBAAkBA,CACzBqB,UAAe,EACfC,iBAAyB,EACzBnD,WAAqD,EAC7C;EACR,MAAMQ,GAAG,GAAGR,WAAW,CAACS,GAAG,CAAC0C,iBAAiB,CAAC;EAC9C,IAAI,CAAC3C,GAAG,IAAIA,GAAG,CAACL,IAAI,KAAK,QAAQ,EAAE;IACjC,MAAM,IAAID,KAAK,CACb,0BAA0BiD,iBAAiB,EAC7C,CAAC;EACH;EACA,OAAOtF,mCAAmC,CACxC2C,GAAG,EACH0C,UACF,CAAC;AACH;AAEA,OAAO,SAASvC,yBAAyBA,CAGvCuC,UAA6B,EAC7BZ,SAAY,EACC;EACb,OAAO;IACLc,QAAQ,EAAEd,SAAS,CAAChE,OAAO;IAC3B+E,MAAM,EAAE5E,SAAS;IACjB6E,WAAW,EAAEhB,SAAS,CAAChE,OAAO;IAC9BiF,WAAW,EAAEL,UAAU;IACvBM,gBAAgB,EAAE3F,mCAAmC,CACnDyE,SAAS,EACTY,UACF;EACF,CAAC;AACH;AAEA,OAAO,SAASrC,4BAA4BA,CAG1C4C,kBAGC,EACDjB,YAAe,EACF;EACb,OAAO;IACLY,QAAQ,EAAEZ,YAAY,CAAClE,OAAO;IAC9B+E,MAAM,EAAE5E,SAAS;IACjB6E,WAAW,EAAEG,kBAAkB,CAACN,iBAAiB;IACjDI,WAAW,EAAEE,kBAAkB,CAACC,eAAe;IAC/CF,gBAAgB,EAAE5F,2CAA2C,CAC3D4E,YAAY,EACZiB,kBACF;EACF,CAAC;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"applyQuery.js","names":["OntologiesV2","invariant","createObjectSet","hydrateAttachmentFromRidInternal","addUserAgentAndRequestContextHeaders","augmentRequestContext","createObjectSpecifierFromInterfaceSpecifier","createObjectSpecifierFromPrimaryKey","toDataValueQueries","applyQuery","client","query","params","qd","ontologyProvider","getQueryDefinition","apiName","isFixedVersion","version","undefined","flushEdits","response","Queries","execute","finalMethodCall","ontologyRid","parameters","remapQueryParams","transactionId","objectOutputDefs","getRequiredDefinitions","output","remappedResponse","remapQueryResponse","value","paramTypes","parameterMap","key","Object","entries","responseDataType","responseValue","definitions","nullable","Error","type","i","length","array","set","def","get","object","createQueryObjectResponse","interface","createQueryInterfaceResponse","objectSet","objectSets","objectType","reference","subtype","struct","requiresConversion","map","Array","isArray","process","env","NODE_ENV","entry","keyType","getObjectSpecifier","valueType","result","groups","push","subResult","subKey","dataType","Map","objectDef","getObjectDefinition","interfaceDef","getInterfaceDefinition","types","allDefs","Promise","all","defs","structValues","values","some","primaryKey","objectTypeApiName","$apiName","$title","$objectType","$primaryKey","$objectSpecifier","interfaceSpecifier","primaryKeyValue"],"sources":["applyQuery.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 AllowedBucketKeyTypes,\n AllowedBucketTypes,\n CompileTimeMetadata,\n InterfaceDefinition,\n ObjectOrInterfaceDefinition,\n ObjectTypeDefinition,\n OsdkBase,\n PrimaryKeyType,\n QueryDataTypeDefinition,\n QueryDefinition,\n QueryMetadata,\n QueryParameterDefinition,\n} from \"@osdk/api\";\nimport type { DataValue } from \"@osdk/foundry.ontologies\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { createObjectSet } from \"../objectSet/createObjectSet.js\";\nimport { hydrateAttachmentFromRidInternal } from \"../public-utils/hydrateAttachmentFromRid.js\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\nimport { augmentRequestContext } from \"../util/augmentRequestContext.js\";\nimport {\n createObjectSpecifierFromInterfaceSpecifier,\n createObjectSpecifierFromPrimaryKey,\n} from \"../util/objectSpecifierUtils.js\";\nimport { toDataValueQueries } from \"../util/toDataValueQueries.js\";\nimport type { QueryParameterType, QueryReturnType } from \"./types.js\";\n\nexport async function applyQuery<\n QD extends QueryDefinition<any>,\n P extends QueryParameterType<CompileTimeMetadata<QD>[\"parameters\"]>,\n>(\n client: MinimalClient,\n query: QD,\n params?: P,\n): Promise<\n QueryReturnType<CompileTimeMetadata<QD>[\"output\"]>\n> {\n // We fire and forget so if a function has no parameters we don't unnecessarily load all metadata\n const qd: Promise<QueryMetadata> = client.ontologyProvider.getQueryDefinition(\n query.apiName,\n query.isFixedVersion ? query.version : undefined,\n );\n\n if (client.flushEdits != null) {\n await client.flushEdits();\n }\n\n const response = await OntologiesV2.Queries.execute(\n addUserAgentAndRequestContextHeaders(\n augmentRequestContext(client, _ => ({ finalMethodCall: \"applyQuery\" })),\n query,\n ),\n await client.ontologyRid,\n query.apiName,\n {\n parameters: params\n ? await remapQueryParams(\n params as { [parameterId: string]: any },\n client,\n (await qd).parameters,\n )\n : {},\n },\n {\n version: query.isFixedVersion ? query.version : undefined,\n transactionId: client.transactionId,\n },\n );\n\n const objectOutputDefs = await getRequiredDefinitions(\n (await qd).output,\n client,\n );\n const remappedResponse = await remapQueryResponse(\n client,\n (await qd).output,\n response.value,\n objectOutputDefs,\n );\n return remappedResponse as QueryReturnType<CompileTimeMetadata<QD>[\"output\"]>;\n}\n\nasync function remapQueryParams(\n params: { [parameterId: string]: any },\n client: MinimalClient,\n paramTypes: Record<string, QueryParameterDefinition<any>>,\n): Promise<{ [parameterId: string]: any }> {\n const parameterMap: { [parameterName: string]: unknown } = {};\n for (const [key, value] of Object.entries(params)) {\n parameterMap[key] = await toDataValueQueries(\n value,\n client,\n paramTypes[key],\n );\n }\n return parameterMap;\n}\n\nasync function remapQueryResponse<\n Q extends ObjectTypeDefinition,\n T extends QueryDataTypeDefinition<Q | never>,\n>(\n client: MinimalClient,\n responseDataType: T,\n responseValue: DataValue,\n definitions: Map<string, ObjectOrInterfaceDefinition>,\n): Promise<QueryReturnType<T>> {\n // handle null responses\n if (responseValue == null) {\n if (responseDataType.nullable) {\n return undefined as unknown as QueryReturnType<typeof responseDataType>;\n } else {\n throw new Error(\"Got null response when nullable was not allowed\");\n }\n }\n\n switch (responseDataType.type) {\n case \"union\": {\n throw new Error(\"Union return types are not yet supported\");\n }\n\n case \"array\": {\n for (let i = 0; i < responseValue.length; i++) {\n responseValue[i] = await remapQueryResponse(\n client,\n responseDataType.array,\n responseValue[i],\n definitions,\n );\n }\n\n return responseValue as QueryReturnType<typeof responseDataType>;\n }\n\n case \"set\": {\n for (let i = 0; i < responseValue.length; i++) {\n responseValue[i] = await remapQueryResponse(\n client,\n responseDataType.set,\n responseValue[i],\n definitions,\n );\n }\n\n return responseValue as QueryReturnType<typeof responseDataType>;\n }\n\n case \"attachment\": {\n return hydrateAttachmentFromRidInternal(\n client,\n responseValue,\n ) as QueryReturnType<\n typeof responseDataType\n >;\n }\n\n case \"object\": {\n const def = definitions.get(responseDataType.object);\n if (!def || def.type !== \"object\") {\n throw new Error(\n `Missing definition for ${responseDataType.object}`,\n );\n }\n return createQueryObjectResponse(\n responseValue,\n def,\n ) as QueryReturnType<\n typeof responseDataType\n >;\n }\n\n case \"interface\": {\n const def = definitions.get(responseDataType.interface);\n if (!def || def.type !== \"interface\") {\n throw new Error(\n `Missing definition for ${responseDataType.interface}`,\n );\n }\n\n return createQueryInterfaceResponse(\n responseValue,\n def,\n ) as QueryReturnType<\n typeof responseDataType\n >;\n }\n\n case \"objectSet\": {\n const def = definitions.get(responseDataType.objectSet);\n if (!def) {\n throw new Error(\n `Missing definition for ${responseDataType.objectSet}`,\n );\n }\n if (typeof responseValue === \"string\") {\n return createObjectSet(def, client, {\n type: \"intersect\",\n objectSets: [\n { type: \"base\", objectType: responseDataType.objectSet },\n { type: \"reference\", reference: responseValue },\n ],\n }) as QueryReturnType<typeof responseDataType>;\n }\n\n return createObjectSet(\n def,\n client,\n responseValue,\n ) as QueryReturnType<\n typeof responseDataType\n >;\n }\n\n case \"struct\": {\n // figure out what keys need to be fixed up\n for (const [key, subtype] of Object.entries(responseDataType.struct)) {\n if (requiresConversion(subtype)) {\n responseValue[key] = await remapQueryResponse(\n client,\n subtype,\n responseValue[key],\n definitions,\n );\n }\n }\n\n return responseValue as QueryReturnType<typeof responseDataType>;\n }\n\n case \"map\": {\n const map = {} as any;\n\n invariant(Array.isArray(responseValue), \"Expected array entry\");\n for (const entry of responseValue) {\n invariant(entry.key != null, \"Expected key\");\n invariant(entry.value != null, \"Expected value\");\n const key = responseDataType.keyType.type === \"object\"\n ? getObjectSpecifier(\n entry.key,\n responseDataType.keyType.object,\n definitions,\n )\n : entry.key;\n const value = await remapQueryResponse(\n client,\n responseDataType.valueType,\n entry.value,\n definitions,\n );\n map[key] = value;\n }\n return map;\n }\n\n case \"twoDimensionalAggregation\": {\n const result: {\n key: AllowedBucketKeyTypes;\n value: AllowedBucketTypes;\n }[] = [];\n for (const { key, value } of responseValue.groups) {\n result.push({ key, value });\n }\n return result as QueryReturnType<typeof responseDataType>;\n }\n\n case \"threeDimensionalAggregation\": {\n const result: {\n key: AllowedBucketKeyTypes;\n groups: { key: AllowedBucketKeyTypes; value: AllowedBucketTypes }[];\n }[] = [];\n for (const { key, groups } of responseValue.groups) {\n const subResult: { key: any; value: any }[] = [];\n for (const { key: subKey, value } of groups) {\n subResult.push({ key: subKey, value });\n }\n result.push({ key, groups: subResult });\n }\n return result as QueryReturnType<typeof responseDataType>;\n }\n }\n\n return responseValue as QueryReturnType<typeof responseDataType>;\n}\n\nasync function getRequiredDefinitions(\n dataType: QueryDataTypeDefinition,\n client: MinimalClient,\n): Promise<Map<string, ObjectOrInterfaceDefinition>> {\n const result = new Map<string, ObjectOrInterfaceDefinition>();\n switch (dataType.type) {\n case \"objectSet\": {\n const objectDef = await client.ontologyProvider.getObjectDefinition(\n dataType.objectSet,\n );\n result.set(dataType.objectSet, objectDef);\n break;\n }\n case \"interfaceObjectSet\": {\n const interfaceDef = await client.ontologyProvider.getInterfaceDefinition(\n dataType.objectSet,\n );\n result.set(dataType.objectSet, interfaceDef);\n break;\n }\n case \"object\": {\n const objectDef = await client.ontologyProvider.getObjectDefinition(\n dataType.object,\n );\n result.set(dataType.object, objectDef);\n break;\n }\n\n case \"interface\": {\n const interfaceDef = await client.ontologyProvider.getInterfaceDefinition(\n dataType.interface,\n );\n result.set(dataType.interface, interfaceDef);\n break;\n }\n\n case \"set\": {\n return getRequiredDefinitions(dataType.set, client);\n }\n case \"array\": {\n return getRequiredDefinitions(dataType.array, client);\n }\n\n case \"map\": {\n const types = [dataType.keyType, dataType.valueType];\n\n const allDefs = await Promise.all(\n types.map(value => getRequiredDefinitions(value, client)),\n );\n\n for (const defs of allDefs) {\n for (const [type, objectDef] of defs) {\n result.set(type, objectDef);\n }\n }\n break;\n }\n\n case \"struct\": {\n const structValues = Object.values(dataType.struct);\n\n const allDefs = await Promise.all(\n structValues.map(value => getRequiredDefinitions(value, client)),\n );\n\n for (const defs of allDefs) {\n for (const [type, objectDef] of defs) {\n result.set(type, objectDef);\n }\n }\n break;\n }\n case \"attachment\":\n case \"boolean\":\n case \"date\":\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n case \"string\":\n case \"threeDimensionalAggregation\":\n case \"timestamp\":\n case \"twoDimensionalAggregation\":\n case \"union\":\n break;\n default: {\n const _: never = dataType;\n break;\n }\n }\n\n return result;\n}\nfunction requiresConversion(dataType: QueryDataTypeDefinition) {\n switch (dataType.type) {\n case \"boolean\":\n case \"date\":\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n case \"string\":\n case \"timestamp\":\n return false;\n\n case \"union\":\n return true;\n\n case \"struct\":\n return Object.values(dataType.struct).some(requiresConversion);\n\n case \"set\":\n return requiresConversion(dataType.set);\n\n case \"attachment\":\n case \"objectSet\":\n case \"twoDimensionalAggregation\":\n case \"threeDimensionalAggregation\":\n case \"object\":\n return true;\n\n default:\n return false;\n }\n}\n\nfunction getObjectSpecifier(\n primaryKey: any,\n objectTypeApiName: string,\n definitions: Map<string, ObjectOrInterfaceDefinition>,\n): string {\n const def = definitions.get(objectTypeApiName);\n if (!def || def.type !== \"object\") {\n throw new Error(\n `Missing definition for ${objectTypeApiName}`,\n );\n }\n return createObjectSpecifierFromPrimaryKey(\n def,\n primaryKey,\n );\n}\n\nexport function createQueryObjectResponse<\n Q extends ObjectTypeDefinition,\n>(\n primaryKey: PrimaryKeyType<Q>,\n objectDef: Q,\n): OsdkBase<Q> {\n return {\n $apiName: objectDef.apiName,\n $title: undefined,\n $objectType: objectDef.apiName,\n $primaryKey: primaryKey,\n $objectSpecifier: createObjectSpecifierFromPrimaryKey(\n objectDef,\n primaryKey,\n ),\n };\n}\n\nexport function createQueryInterfaceResponse<\n Q extends InterfaceDefinition,\n>(\n interfaceSpecifier: {\n objectTypeApiName: string;\n primaryKeyValue: PrimaryKeyType<Q>;\n },\n interfaceDef: Q,\n): OsdkBase<Q> {\n return {\n $apiName: interfaceDef.apiName,\n $title: undefined,\n $objectType: interfaceSpecifier.objectTypeApiName,\n $primaryKey: interfaceSpecifier.primaryKeyValue,\n $objectSpecifier: createObjectSpecifierFromInterfaceSpecifier(\n interfaceDef,\n interfaceSpecifier,\n ),\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiBA,OAAO,KAAKA,YAAY,MAAM,0BAA0B;A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