@osdk/client 2.1.0-beta.2 → 2.1.0-beta.21
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 +297 -0
- package/build/browser/Client.d.ts +6 -22
- package/build/browser/Client.d.ts.map +1 -1
- package/build/browser/Client.js +3 -1
- package/build/browser/Client.js.map +1 -1
- package/build/browser/MinimalClientContext.d.ts +1 -1
- package/build/browser/MinimalClientContext.d.ts.map +1 -1
- package/build/browser/__unstable/ConjureSupport.js +5 -5
- package/build/browser/__unstable/ConjureSupport.js.map +1 -1
- package/build/browser/__unstable/createBulkLinksAsyncIterFactory.d.ts +1 -6
- package/build/browser/__unstable/createBulkLinksAsyncIterFactory.d.ts.map +1 -1
- package/build/browser/__unstable/createBulkLinksAsyncIterFactory.js +2 -2
- package/build/browser/__unstable/createBulkLinksAsyncIterFactory.js.map +1 -1
- package/build/browser/actions/actions.test.js +28 -0
- package/build/browser/actions/actions.test.js.map +1 -1
- package/build/browser/actions/applyAction.js +1 -1
- package/build/browser/actions/applyAction.js.map +1 -1
- package/build/browser/createClient.d.ts +1 -1
- package/build/browser/createClient.d.ts.map +1 -1
- package/build/browser/createClient.js +41 -19
- package/build/browser/createClient.js.map +1 -1
- package/build/browser/createClient.test.js +24 -0
- package/build/browser/createClient.test.js.map +1 -1
- package/build/browser/createGeotimeSeriesProperty.d.ts +1 -1
- package/build/browser/createGeotimeSeriesProperty.d.ts.map +1 -1
- package/build/browser/createGeotimeSeriesProperty.js +4 -1
- package/build/browser/createGeotimeSeriesProperty.js.map +1 -1
- package/build/browser/createMinimalClient.js +9 -4
- package/build/browser/createMinimalClient.js.map +1 -1
- package/build/browser/createPlatformClient.d.ts +1 -1
- package/build/browser/createPlatformClient.d.ts.map +1 -1
- package/build/browser/createTimeseriesProperty.d.ts.map +1 -1
- package/build/browser/fetchMetadata.test.js +14 -0
- package/build/browser/fetchMetadata.test.js.map +1 -1
- package/build/browser/index.d.ts +2 -2
- package/build/browser/index.d.ts.map +1 -1
- package/build/browser/index.js +1 -1
- package/build/browser/index.js.map +1 -1
- package/build/browser/intellisense.test.js +1 -1
- package/build/browser/intellisense.test.js.map +1 -1
- package/build/browser/internal/conversions/legacyToModernSingleAggregationResult.js +1 -1
- package/build/browser/internal/conversions/legacyToModernSingleAggregationResult.js.map +1 -1
- package/build/browser/internal/conversions/modernToLegacyWhereClause.js +11 -3
- package/build/browser/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
- package/build/browser/internal/conversions/modernToLegacyWhereClause.test.js +208 -7
- package/build/browser/internal/conversions/modernToLegacyWhereClause.test.js.map +1 -1
- package/build/browser/object/AttachmentUpload.d.ts.map +1 -1
- package/build/browser/object/AttachmentUpload.js +5 -7
- package/build/browser/object/AttachmentUpload.js.map +1 -1
- package/build/browser/object/aggregate.js +4 -5
- package/build/browser/object/aggregate.js.map +1 -1
- package/build/browser/object/aggregate.test.js +6 -9
- package/build/browser/object/aggregate.test.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.d.ts +1 -10
- package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.d.ts.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.d.ts +0 -7
- package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.d.ts.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.js +4 -3
- package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js +41 -85
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.test.js +0 -6
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.test.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js +60 -89
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/getDollarAs.js +2 -2
- package/build/browser/object/convertWireToOsdkObjects/getDollarAs.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/getDollarLink.js +14 -38
- package/build/browser/object/convertWireToOsdkObjects/getDollarLink.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.js +42 -6
- package/build/browser/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.test.js +177 -45
- package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/browser/object/fetchPage.d.ts.map +1 -1
- package/build/browser/object/fetchPage.js +34 -23
- package/build/browser/object/fetchPage.js.map +1 -1
- package/build/browser/object/fetchPage.test.js +75 -1
- package/build/browser/object/fetchPage.test.js.map +1 -1
- package/build/browser/object/object.test.d.ts.map +1 -1
- package/build/browser/object/object.test.js +25 -1
- package/build/browser/object/object.test.js.map +1 -1
- package/build/browser/object/timeseries.test.js +10 -0
- package/build/browser/object/timeseries.test.js.map +1 -1
- package/build/browser/objectSet/InterfaceObjectSet.test.d.ts +2 -0
- package/build/browser/objectSet/InterfaceObjectSet.test.d.ts.map +1 -0
- package/build/browser/objectSet/InterfaceObjectSet.test.js +61 -0
- package/build/browser/objectSet/InterfaceObjectSet.test.js.map +1 -0
- package/build/browser/objectSet/ObjectSet.test.js +162 -48
- package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js +136 -74
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js +150 -42
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
- package/build/browser/objectSet/createObjectSet.js +10 -8
- package/build/browser/objectSet/createObjectSet.js.map +1 -1
- package/build/browser/objectSet/toConjureObjectSet.js +2 -0
- package/build/browser/objectSet/toConjureObjectSet.js.map +1 -1
- package/build/browser/ontology/makeConjureContext.d.ts +1 -1
- package/build/browser/ontology/makeConjureContext.d.ts.map +1 -1
- package/build/browser/public/internal.d.ts +4 -0
- package/build/browser/public/internal.d.ts.map +1 -0
- package/build/browser/public/internal.js +19 -0
- package/build/browser/public/internal.js.map +1 -0
- package/build/browser/public-utils/createAndFetchTempObjectSetRid.d.ts +11 -0
- package/build/browser/public-utils/createAndFetchTempObjectSetRid.d.ts.map +1 -0
- package/build/browser/public-utils/createAndFetchTempObjectSetRid.js +32 -0
- package/build/browser/public-utils/createAndFetchTempObjectSetRid.js.map +1 -0
- package/build/browser/public-utils/hydrateAttachmentFromRid.d.ts +10 -0
- package/build/browser/public-utils/hydrateAttachmentFromRid.d.ts.map +1 -0
- package/build/{esm/createAttachmentFromRid.js → browser/public-utils/hydrateAttachmentFromRid.js} +9 -4
- package/build/browser/public-utils/hydrateAttachmentFromRid.js.map +1 -0
- package/build/browser/public-utils/hydrateObjectSetFromRid.d.ts +11 -0
- package/build/browser/public-utils/hydrateObjectSetFromRid.d.ts.map +1 -0
- package/build/browser/public-utils/hydrateObjectSetFromRid.js +37 -0
- package/build/browser/public-utils/hydrateObjectSetFromRid.js.map +1 -0
- package/build/browser/queries/applyQuery.d.ts.map +1 -1
- package/build/browser/queries/applyQuery.js +3 -4
- package/build/browser/queries/applyQuery.js.map +1 -1
- package/build/browser/queries/queries.test.js +30 -2
- package/build/browser/queries/queries.test.js.map +1 -1
- package/build/browser/tsserver.js +1 -1
- package/build/browser/tsserver.js.map +1 -1
- package/build/browser/util/UserAgent.js +1 -1
- package/build/browser/util/UserAgent.js.map +1 -1
- package/build/browser/util/datetimeConverters.d.ts +22 -0
- package/build/browser/util/datetimeConverters.d.ts.map +1 -0
- package/build/browser/util/datetimeConverters.js +55 -0
- package/build/browser/util/datetimeConverters.js.map +1 -0
- package/build/browser/util/datetimeConverters.test.d.ts +2 -0
- package/build/browser/util/datetimeConverters.test.d.ts.map +1 -0
- package/build/browser/util/datetimeConverters.test.js +75 -0
- package/build/browser/util/datetimeConverters.test.js.map +1 -0
- package/build/browser/util/objectSetUtils.d.ts +4 -0
- package/build/browser/util/objectSetUtils.d.ts.map +1 -0
- package/build/browser/util/objectSetUtils.js +25 -0
- package/build/browser/util/objectSetUtils.js.map +1 -0
- package/build/browser/util/timeseriesUtils.d.ts +1 -1
- package/build/browser/util/timeseriesUtils.d.ts.map +1 -1
- package/build/browser/util/timeseriesUtils.js +1 -1
- package/build/browser/util/timeseriesUtils.js.map +1 -1
- package/build/browser/util/toDataValue.js +6 -0
- package/build/browser/util/toDataValue.js.map +1 -1
- package/build/browser/util/toDataValue.test.js +9 -1
- package/build/browser/util/toDataValue.test.js.map +1 -1
- package/build/browser/util/toDataValueQueries.js +6 -0
- package/build/browser/util/toDataValueQueries.js.map +1 -1
- package/build/esm/Client.d.ts +6 -22
- package/build/esm/Client.d.ts.map +1 -1
- package/build/esm/Client.js +3 -1
- package/build/esm/Client.js.map +1 -1
- package/build/esm/MinimalClientContext.d.ts +1 -1
- package/build/esm/MinimalClientContext.d.ts.map +1 -1
- package/build/esm/__unstable/ConjureSupport.js +5 -5
- package/build/esm/__unstable/ConjureSupport.js.map +1 -1
- package/build/esm/__unstable/createBulkLinksAsyncIterFactory.d.ts +1 -6
- package/build/esm/__unstable/createBulkLinksAsyncIterFactory.d.ts.map +1 -1
- package/build/esm/__unstable/createBulkLinksAsyncIterFactory.js +2 -2
- package/build/esm/__unstable/createBulkLinksAsyncIterFactory.js.map +1 -1
- package/build/esm/actions/actions.test.js +28 -0
- package/build/esm/actions/actions.test.js.map +1 -1
- package/build/esm/actions/applyAction.js +1 -1
- package/build/esm/actions/applyAction.js.map +1 -1
- package/build/esm/createClient.d.ts +1 -1
- package/build/esm/createClient.d.ts.map +1 -1
- package/build/esm/createClient.js +41 -19
- package/build/esm/createClient.js.map +1 -1
- package/build/esm/createClient.test.js +24 -0
- package/build/esm/createClient.test.js.map +1 -1
- package/build/esm/createGeotimeSeriesProperty.d.ts +1 -1
- package/build/esm/createGeotimeSeriesProperty.d.ts.map +1 -1
- package/build/esm/createGeotimeSeriesProperty.js +4 -1
- package/build/esm/createGeotimeSeriesProperty.js.map +1 -1
- package/build/esm/createMinimalClient.js +9 -4
- package/build/esm/createMinimalClient.js.map +1 -1
- package/build/esm/createPlatformClient.d.ts +1 -1
- package/build/esm/createPlatformClient.d.ts.map +1 -1
- package/build/esm/createTimeseriesProperty.d.ts.map +1 -1
- package/build/esm/fetchMetadata.test.js +14 -0
- package/build/esm/fetchMetadata.test.js.map +1 -1
- package/build/esm/index.d.ts +2 -2
- package/build/esm/index.d.ts.map +1 -1
- package/build/esm/index.js +1 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/intellisense.test.js +1 -1
- package/build/esm/intellisense.test.js.map +1 -1
- package/build/esm/internal/conversions/legacyToModernSingleAggregationResult.js +1 -1
- package/build/esm/internal/conversions/legacyToModernSingleAggregationResult.js.map +1 -1
- package/build/esm/internal/conversions/modernToLegacyWhereClause.js +11 -3
- package/build/esm/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
- package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js +208 -7
- package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js.map +1 -1
- package/build/esm/object/AttachmentUpload.d.ts.map +1 -1
- package/build/esm/object/AttachmentUpload.js +5 -7
- package/build/esm/object/AttachmentUpload.js.map +1 -1
- package/build/esm/object/aggregate.js +4 -5
- package/build/esm/object/aggregate.js.map +1 -1
- package/build/esm/object/aggregate.test.js +6 -9
- package/build/esm/object/aggregate.test.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.d.ts +1 -10
- package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.d.ts.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.d.ts +0 -7
- package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.d.ts.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.js +4 -3
- package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js +41 -85
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.test.js +0 -6
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.test.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js +60 -89
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/getDollarAs.js +2 -2
- package/build/esm/object/convertWireToOsdkObjects/getDollarAs.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/getDollarLink.js +14 -38
- package/build/esm/object/convertWireToOsdkObjects/getDollarLink.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.js +42 -6
- package/build/esm/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.test.js +177 -45
- package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/esm/object/fetchPage.d.ts.map +1 -1
- package/build/esm/object/fetchPage.js +34 -23
- package/build/esm/object/fetchPage.js.map +1 -1
- package/build/esm/object/fetchPage.test.js +75 -1
- package/build/esm/object/fetchPage.test.js.map +1 -1
- package/build/esm/object/object.test.d.ts.map +1 -1
- package/build/esm/object/object.test.js +25 -1
- package/build/esm/object/object.test.js.map +1 -1
- package/build/esm/object/timeseries.test.js +10 -0
- package/build/esm/object/timeseries.test.js.map +1 -1
- package/build/esm/objectSet/InterfaceObjectSet.test.d.ts +2 -0
- package/build/esm/objectSet/InterfaceObjectSet.test.d.ts.map +1 -0
- package/build/esm/objectSet/InterfaceObjectSet.test.js +61 -0
- package/build/esm/objectSet/InterfaceObjectSet.test.js.map +1 -0
- package/build/esm/objectSet/ObjectSet.test.js +162 -48
- package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js +136 -77
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js +150 -42
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
- package/build/esm/objectSet/createObjectSet.js +10 -8
- package/build/esm/objectSet/createObjectSet.js.map +1 -1
- package/build/esm/objectSet/toConjureObjectSet.js +2 -0
- package/build/esm/objectSet/toConjureObjectSet.js.map +1 -1
- package/build/esm/ontology/makeConjureContext.d.ts +1 -1
- package/build/esm/ontology/makeConjureContext.d.ts.map +1 -1
- package/build/esm/public/internal.d.ts +4 -0
- package/build/esm/public/internal.d.ts.map +1 -0
- package/build/esm/public/internal.js +19 -0
- package/build/esm/public/internal.js.map +1 -0
- package/build/esm/public-utils/createAndFetchTempObjectSetRid.d.ts +11 -0
- package/build/esm/public-utils/createAndFetchTempObjectSetRid.d.ts.map +1 -0
- package/build/esm/public-utils/createAndFetchTempObjectSetRid.js +32 -0
- package/build/esm/public-utils/createAndFetchTempObjectSetRid.js.map +1 -0
- package/build/esm/public-utils/hydrateAttachmentFromRid.d.ts +10 -0
- package/build/esm/public-utils/hydrateAttachmentFromRid.d.ts.map +1 -0
- package/build/{browser/createAttachmentFromRid.js → esm/public-utils/hydrateAttachmentFromRid.js} +9 -4
- package/build/esm/public-utils/hydrateAttachmentFromRid.js.map +1 -0
- package/build/esm/public-utils/hydrateObjectSetFromRid.d.ts +11 -0
- package/build/esm/public-utils/hydrateObjectSetFromRid.d.ts.map +1 -0
- package/build/esm/public-utils/hydrateObjectSetFromRid.js +37 -0
- package/build/esm/public-utils/hydrateObjectSetFromRid.js.map +1 -0
- package/build/esm/queries/applyQuery.d.ts.map +1 -1
- package/build/esm/queries/applyQuery.js +3 -4
- package/build/esm/queries/applyQuery.js.map +1 -1
- package/build/esm/queries/queries.test.js +30 -2
- package/build/esm/queries/queries.test.js.map +1 -1
- package/build/esm/tsserver.js +1 -1
- package/build/esm/tsserver.js.map +1 -1
- package/build/esm/util/UserAgent.js +1 -1
- package/build/esm/util/UserAgent.js.map +1 -1
- package/build/esm/util/datetimeConverters.d.ts +22 -0
- package/build/esm/util/datetimeConverters.d.ts.map +1 -0
- package/build/esm/util/datetimeConverters.js +55 -0
- package/build/esm/util/datetimeConverters.js.map +1 -0
- package/build/esm/util/datetimeConverters.test.d.ts +2 -0
- package/build/esm/util/datetimeConverters.test.d.ts.map +1 -0
- package/build/esm/util/datetimeConverters.test.js +75 -0
- package/build/esm/util/datetimeConverters.test.js.map +1 -0
- package/build/esm/util/objectSetUtils.d.ts +4 -0
- package/build/esm/util/objectSetUtils.d.ts.map +1 -0
- package/build/esm/util/objectSetUtils.js +25 -0
- package/build/esm/util/objectSetUtils.js.map +1 -0
- package/build/esm/util/timeseriesUtils.d.ts +1 -1
- package/build/esm/util/timeseriesUtils.d.ts.map +1 -1
- package/build/esm/util/timeseriesUtils.js +1 -1
- package/build/esm/util/timeseriesUtils.js.map +1 -1
- package/build/esm/util/toDataValue.js +6 -0
- package/build/esm/util/toDataValue.js.map +1 -1
- package/build/esm/util/toDataValue.test.js +9 -1
- package/build/esm/util/toDataValue.test.js.map +1 -1
- package/build/esm/util/toDataValueQueries.js +6 -0
- package/build/esm/util/toDataValueQueries.js.map +1 -1
- package/package.json +23 -19
- package/build/browser/createAttachmentFromRid.d.ts +0 -10
- package/build/browser/createAttachmentFromRid.d.ts.map +0 -1
- package/build/browser/createAttachmentFromRid.js.map +0 -1
- package/build/esm/createAttachmentFromRid.d.ts +0 -10
- package/build/esm/createAttachmentFromRid.d.ts.map +0 -1
- package/build/esm/createAttachmentFromRid.js.map +0 -1
|
@@ -72,6 +72,13 @@ describe("FetchMetadata", () => {
|
|
|
72
72
|
"primaryKeyApiName": "employeeId",
|
|
73
73
|
"primaryKeyType": "integer",
|
|
74
74
|
"properties": {
|
|
75
|
+
"class": {
|
|
76
|
+
"description": "",
|
|
77
|
+
"displayName": undefined,
|
|
78
|
+
"multiplicity": false,
|
|
79
|
+
"nullable": true,
|
|
80
|
+
"type": "string",
|
|
81
|
+
},
|
|
75
82
|
"employeeId": {
|
|
76
83
|
"description": undefined,
|
|
77
84
|
"displayName": undefined,
|
|
@@ -86,6 +93,13 @@ describe("FetchMetadata", () => {
|
|
|
86
93
|
"nullable": true,
|
|
87
94
|
"type": "geotimeSeriesReference",
|
|
88
95
|
},
|
|
96
|
+
"employeeSensor": {
|
|
97
|
+
"description": "TimeSeries sensor of the status of the employee",
|
|
98
|
+
"displayName": undefined,
|
|
99
|
+
"multiplicity": false,
|
|
100
|
+
"nullable": true,
|
|
101
|
+
"type": "sensorTimeseries",
|
|
102
|
+
},
|
|
89
103
|
"employeeStatus": {
|
|
90
104
|
"description": "TimeSeries of the status of the employee",
|
|
91
105
|
"displayName": undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchMetadata.test.js","names":["$Actions","$Interfaces","$Objects","$ontologyRid","$Queries","apiServer","afterAll","beforeAll","describe","expect","expectTypeOf","it","createClient","client","listen","close","objectMetadata","fetchMetadata","Employee","toEqualTypeOf","toMatchInlineSnapshot","interfaceMetadata","FooInterface","actionMetadata","moveOffice","queryMetadata","queryAcceptsObject"],"sources":["fetchMetadata.test.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { $Actions, $Interfaces, $Objects, $ontologyRid, $Queries, } from \"@osdk/client.test.ontology\";\nimport { apiServer } from \"@osdk/shared.test\";\nimport { afterAll, beforeAll, describe, expect, expectTypeOf, it, } from \"vitest\";\nimport { createClient } from \"./createClient.js\";\ndescribe(\"FetchMetadata\", () => {\n let client;\n beforeAll(async () => {\n apiServer.listen();\n client = createClient(\"https://stack.palantir.com\", $ontologyRid, async () => \"myAccessToken\");\n });\n afterAll(() => {\n apiServer.close();\n });\n it(\"fetches object metadata correctly\", async () => {\n const objectMetadata = await client.fetchMetadata($Objects.Employee);\n expectTypeOf(objectMetadata).toEqualTypeOf();\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 },\n \"pluralDisplayName\": \"Employees\",\n \"primaryKeyApiName\": \"employeeId\",\n \"primaryKeyType\": \"integer\",\n \"properties\": {\n \"employeeId\": {\n \"description\": undefined,\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": false,\n \"type\": \"integer\",\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 },\n \"employeeStatus\": {\n \"description\": \"TimeSeries of the status of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"stringTimeseries\",\n },\n \"fullName\": {\n \"description\": undefined,\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\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 },\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 },\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 it(\"fetches interface metadata correctly\", async () => {\n const interfaceMetadata = await client.fetchMetadata($Interfaces.FooInterface);\n expectTypeOf(interfaceMetadata).toEqualTypeOf();\n expect(interfaceMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"FooInterface\",\n \"description\": \"Interface for Foo\",\n \"displayName\": \"Foo Interface\",\n \"implements\": [],\n \"links\": {},\n \"properties\": {\n \"fooSpt\": {\n \"description\": \"A foo\",\n \"displayName\": \"Foo\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n },\n \"rid\": \"ri.interface.main.interface.1\",\n \"type\": \"interface\",\n }\n `);\n });\n it(\"fetches action metadata correctly\", async () => {\n const actionMetadata = await client.fetchMetadata($Actions.moveOffice);\n expectTypeOf(actionMetadata).toEqualTypeOf();\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 it(\"fetches query metadata correctly\", async () => {\n const queryMetadata = await client.fetchMetadata($Queries.queryAcceptsObject);\n expectTypeOf(queryMetadata).toEqualTypeOf();\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;AACA,SAASA,QAAQ,EAAEC,WAAW,EAAEC,QAAQ,EAAEC,YAAY,EAAEC,QAAQ,QAAS,4BAA4B;AACrG,SAASC,SAAS,QAAQ,mBAAmB;AAC7C,SAASC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAEC,EAAE,QAAS,QAAQ;AACjF,SAASC,YAAY,QAAQ,mBAAmB;AAChDJ,QAAQ,CAAC,eAAe,EAAE,MAAM;EAC5B,IAAIK,MAAM;EACVN,SAAS,CAAC,YAAY;IAClBF,SAAS,CAACS,MAAM,CAAC,CAAC;IAClBD,MAAM,GAAGD,YAAY,CAAC,4BAA4B,EAAET,YAAY,EAAE,YAAY,eAAe,CAAC;EAClG,CAAC,CAAC;EACFG,QAAQ,CAAC,MAAM;IACXD,SAAS,CAACU,KAAK,CAAC,CAAC;EACrB,CAAC,CAAC;EACFJ,EAAE,CAAC,mCAAmC,EAAE,YAAY;IAChD,MAAMK,cAAc,GAAG,MAAMH,MAAM,CAACI,aAAa,CAACf,QAAQ,CAACgB,QAAQ,CAAC;IACpER,YAAY,CAACM,cAAc,CAAC,CAACG,aAAa,CAAC,CAAC;IAC5CV,MAAM,CAACO,cAAc,CAAC,CAACI,qBAAqB,CAAC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;EACF,CAAC,CAAC;EACFT,EAAE,CAAC,sCAAsC,EAAE,YAAY;IACnD,MAAMU,iBAAiB,GAAG,MAAMR,MAAM,CAACI,aAAa,CAAChB,WAAW,CAACqB,YAAY,CAAC;IAC9EZ,YAAY,CAACW,iBAAiB,CAAC,CAACF,aAAa,CAAC,CAAC;IAC/CV,MAAM,CAACY,iBAAiB,CAAC,CAACD,qBAAqB,CAAC;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACF,CAAC,CAAC;EACFT,EAAE,CAAC,mCAAmC,EAAE,YAAY;IAChD,MAAMY,cAAc,GAAG,MAAMV,MAAM,CAACI,aAAa,CAACjB,QAAQ,CAACwB,UAAU,CAAC;IACtEd,YAAY,CAACa,cAAc,CAAC,CAACJ,aAAa,CAAC,CAAC;IAC5CV,MAAM,CAACc,cAAc,CAAC,CAACH,qBAAqB,CAAC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;EACF,CAAC,CAAC;EACFT,EAAE,CAAC,kCAAkC,EAAE,YAAY;IAC/C,MAAMc,aAAa,GAAG,MAAMZ,MAAM,CAACI,aAAa,CAACb,QAAQ,CAACsB,kBAAkB,CAAC;IAC7EhB,YAAY,CAACe,aAAa,CAAC,CAACN,aAAa,CAAC,CAAC;IAC3CV,MAAM,CAACgB,aAAa,CAAC,CAACL,qBAAqB,CAAC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACF,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"fetchMetadata.test.js","names":["$Actions","$Interfaces","$Objects","$ontologyRid","$Queries","apiServer","afterAll","beforeAll","describe","expect","expectTypeOf","it","createClient","client","listen","close","objectMetadata","fetchMetadata","Employee","toEqualTypeOf","toMatchInlineSnapshot","interfaceMetadata","FooInterface","actionMetadata","moveOffice","queryMetadata","queryAcceptsObject"],"sources":["fetchMetadata.test.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { $Actions, $Interfaces, $Objects, $ontologyRid, $Queries, } from \"@osdk/client.test.ontology\";\nimport { apiServer } from \"@osdk/shared.test\";\nimport { afterAll, beforeAll, describe, expect, expectTypeOf, it, } from \"vitest\";\nimport { createClient } from \"./createClient.js\";\ndescribe(\"FetchMetadata\", () => {\n let client;\n beforeAll(async () => {\n apiServer.listen();\n client = createClient(\"https://stack.palantir.com\", $ontologyRid, async () => \"myAccessToken\");\n });\n afterAll(() => {\n apiServer.close();\n });\n it(\"fetches object metadata correctly\", async () => {\n const objectMetadata = await client.fetchMetadata($Objects.Employee);\n expectTypeOf(objectMetadata).toEqualTypeOf();\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 },\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 },\n \"employeeId\": {\n \"description\": undefined,\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": false,\n \"type\": \"integer\",\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 },\n \"employeeSensor\": {\n \"description\": \"TimeSeries sensor of the status of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"sensorTimeseries\",\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 },\n \"fullName\": {\n \"description\": undefined,\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\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 },\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 },\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 it(\"fetches interface metadata correctly\", async () => {\n const interfaceMetadata = await client.fetchMetadata($Interfaces.FooInterface);\n expectTypeOf(interfaceMetadata).toEqualTypeOf();\n expect(interfaceMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"FooInterface\",\n \"description\": \"Interface for Foo\",\n \"displayName\": \"Foo Interface\",\n \"implements\": [],\n \"links\": {},\n \"properties\": {\n \"fooSpt\": {\n \"description\": \"A foo\",\n \"displayName\": \"Foo\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n },\n \"rid\": \"ri.interface.main.interface.1\",\n \"type\": \"interface\",\n }\n `);\n });\n it(\"fetches action metadata correctly\", async () => {\n const actionMetadata = await client.fetchMetadata($Actions.moveOffice);\n expectTypeOf(actionMetadata).toEqualTypeOf();\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 it(\"fetches query metadata correctly\", async () => {\n const queryMetadata = await client.fetchMetadata($Queries.queryAcceptsObject);\n expectTypeOf(queryMetadata).toEqualTypeOf();\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;AACA,SAASA,QAAQ,EAAEC,WAAW,EAAEC,QAAQ,EAAEC,YAAY,EAAEC,QAAQ,QAAS,4BAA4B;AACrG,SAASC,SAAS,QAAQ,mBAAmB;AAC7C,SAASC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAEC,EAAE,QAAS,QAAQ;AACjF,SAASC,YAAY,QAAQ,mBAAmB;AAChDJ,QAAQ,CAAC,eAAe,EAAE,MAAM;EAC5B,IAAIK,MAAM;EACVN,SAAS,CAAC,YAAY;IAClBF,SAAS,CAACS,MAAM,CAAC,CAAC;IAClBD,MAAM,GAAGD,YAAY,CAAC,4BAA4B,EAAET,YAAY,EAAE,YAAY,eAAe,CAAC;EAClG,CAAC,CAAC;EACFG,QAAQ,CAAC,MAAM;IACXD,SAAS,CAACU,KAAK,CAAC,CAAC;EACrB,CAAC,CAAC;EACFJ,EAAE,CAAC,mCAAmC,EAAE,YAAY;IAChD,MAAMK,cAAc,GAAG,MAAMH,MAAM,CAACI,aAAa,CAACf,QAAQ,CAACgB,QAAQ,CAAC;IACpER,YAAY,CAACM,cAAc,CAAC,CAACG,aAAa,CAAC,CAAC;IAC5CV,MAAM,CAACO,cAAc,CAAC,CAACI,qBAAqB,CAAC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;EACF,CAAC,CAAC;EACFT,EAAE,CAAC,sCAAsC,EAAE,YAAY;IACnD,MAAMU,iBAAiB,GAAG,MAAMR,MAAM,CAACI,aAAa,CAAChB,WAAW,CAACqB,YAAY,CAAC;IAC9EZ,YAAY,CAACW,iBAAiB,CAAC,CAACF,aAAa,CAAC,CAAC;IAC/CV,MAAM,CAACY,iBAAiB,CAAC,CAACD,qBAAqB,CAAC;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACF,CAAC,CAAC;EACFT,EAAE,CAAC,mCAAmC,EAAE,YAAY;IAChD,MAAMY,cAAc,GAAG,MAAMV,MAAM,CAACI,aAAa,CAACjB,QAAQ,CAACwB,UAAU,CAAC;IACtEd,YAAY,CAACa,cAAc,CAAC,CAACJ,aAAa,CAAC,CAAC;IAC5CV,MAAM,CAACc,cAAc,CAAC,CAACH,qBAAqB,CAAC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;EACF,CAAC,CAAC;EACFT,EAAE,CAAC,kCAAkC,EAAE,YAAY;IAC/C,MAAMc,aAAa,GAAG,MAAMZ,MAAM,CAACI,aAAa,CAACb,QAAQ,CAACsB,kBAAkB,CAAC;IAC7EhB,YAAY,CAACe,aAAa,CAAC,CAACN,aAAa,CAAC,CAAC;IAC3CV,MAAM,CAACgB,aAAa,CAAC,CAACL,qBAAqB,CAAC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACF,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
|
package/build/browser/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export type { ActionEditResponse, ActionReturnTypeForOptions, ActionValidationResponse, ApplyActionOptions, ApplyBatchActionOptions, ObjectSet, Osdk, OsdkObject, PageResult, Result, WhereClause, } from "@osdk/api";
|
|
1
|
+
export type { ActionDefinition, ActionEditResponse, ActionMetadata, ActionParam, ActionReturnTypeForOptions, ActionValidationResponse, ApplyActionOptions, ApplyBatchActionOptions, InterfaceDefinition, ObjectMetadata, ObjectSet, ObjectTypeDefinition, Osdk, OsdkObject, PageResult, PropertyDef, PropertyKeys, PropertyValueWireToClient, QueryDefinition, QueryParam, QueryResult, Result, SingleLinkAccessor, VersionBound, WhereClause, } from "@osdk/api";
|
|
2
2
|
export { isOk } from "@osdk/api";
|
|
3
3
|
export { PalantirApiError } from "@osdk/shared.net.errors";
|
|
4
4
|
export { ActionValidationError } from "./actions/ActionValidationError.js";
|
|
5
5
|
export type { Client } from "./Client.js";
|
|
6
|
-
export { createAttachmentFromRid } from "./createAttachmentFromRid.js";
|
|
7
6
|
export { createClient } from "./createClient.js";
|
|
8
7
|
export { createPlatformClient } from "./createPlatformClient.js";
|
|
9
8
|
export type { PlatformClient } from "./createPlatformClient.js";
|
|
10
9
|
export type { Logger } from "./Logger.js";
|
|
11
10
|
export { createAttachmentUpload } from "./object/AttachmentUpload.js";
|
|
12
11
|
export type { ResultOrError } from "./ResultOrError.js";
|
|
12
|
+
export { extractDate, extractDateInLocalTime, extractDateInUTC, } from "./util/datetimeConverters.js";
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAgBA,YAAY,EACV,kBAAkB,EAClB,0BAA0B,EAC1B,wBAAwB,EACxB,kBAAkB,EAClB,uBAAuB,EACvB,SAAS,EACT,IAAI,EACJ,UAAU,EACV,UAAU,EACV,MAAM,EACN,WAAW,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAgBA,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,0BAA0B,EAC1B,wBAAwB,EACxB,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,cAAc,EACd,SAAS,EACT,oBAAoB,EACpB,IAAI,EACJ,UAAU,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACZ,yBAAyB,EACzB,eAAe,EACf,UAAU,EACV,WAAW,EACX,MAAM,EACN,kBAAkB,EAClB,YAAY,EACZ,WAAW,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,EACL,WAAW,EACX,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,8BAA8B,CAAC"}
|
package/build/browser/index.js
CHANGED
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
export { isOk } from "@osdk/api";
|
|
17
17
|
export { PalantirApiError } from "@osdk/shared.net.errors";
|
|
18
18
|
export { ActionValidationError } from "./actions/ActionValidationError.js";
|
|
19
|
-
export { createAttachmentFromRid } from "./createAttachmentFromRid.js";
|
|
20
19
|
export { createClient } from "./createClient.js";
|
|
21
20
|
export { createPlatformClient } from "./createPlatformClient.js";
|
|
22
21
|
export { createAttachmentUpload } from "./object/AttachmentUpload.js";
|
|
22
|
+
export { extractDate, extractDateInLocalTime, extractDateInUTC } from "./util/datetimeConverters.js";
|
|
23
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["isOk","PalantirApiError","ActionValidationError","
|
|
1
|
+
{"version":3,"file":"index.js","names":["isOk","PalantirApiError","ActionValidationError","createClient","createPlatformClient","createAttachmentUpload","extractDate","extractDateInLocalTime","extractDateInUTC"],"sources":["index.js"],"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 */\nexport { isOk } from \"@osdk/api\";\nexport { PalantirApiError } from \"@osdk/shared.net.errors\";\nexport { ActionValidationError } from \"./actions/ActionValidationError.js\";\nexport { createClient } from \"./createClient.js\";\nexport { createPlatformClient } from \"./createPlatformClient.js\";\nexport { createAttachmentUpload } from \"./object/AttachmentUpload.js\";\nexport { extractDate, extractDateInLocalTime, extractDateInUTC, } from \"./util/datetimeConverters.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,IAAI,QAAQ,WAAW;AAChC,SAASC,gBAAgB,QAAQ,yBAAyB;AAC1D,SAASC,qBAAqB,QAAQ,oCAAoC;AAC1E,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,sBAAsB,QAAQ,8BAA8B;AACrE,SAASC,WAAW,EAAEC,sBAAsB,EAAEC,gBAAgB,QAAS,8BAA8B","ignoreList":[]}
|
|
@@ -52,7 +52,7 @@ describe("intellisense", () => {
|
|
|
52
52
|
const clientsPackageJson = findUpSync("package.json", {
|
|
53
53
|
cwd: import.meta.url
|
|
54
54
|
});
|
|
55
|
-
!(clientsPackageJson != null) ? invariant(false) : void 0;
|
|
55
|
+
!(clientsPackageJson != null) ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
|
|
56
56
|
packagesDir = path.join(path.dirname(clientsPackageJson), "..");
|
|
57
57
|
clientPackagePath = path.join(packagesDir, "client");
|
|
58
58
|
});
|
|
@@ -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","url","join","dirname","tsServer","intellisenseFilePath","task","name","sys","fileExists","toBeTruthy","sendOpenRequest","file","stop","timeout","resp","sendQuickInfoRequest","line","offset","body","documentation","toMatchInlineSnapshot"],"sources":["intellisense.test.js"],"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 */\nimport { findUpSync } from \"find-up\";\nimport * as path from \"node:path\";\nimport invariant from \"tiny-invariant\";\nimport * as ts from \"typescript\";\nimport { afterEach, beforeAll, beforeEach, describe, expect, it, vi, } from \"vitest\";\nimport { startTsServer } from \"./tsserver.js\";\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 () => {\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) {\n // remove trailing newline since console.log adds one\n if (a.at(-1) === \"\\n\")\n a = a.slice(0, -1);\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({ level: \"info\" }, (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});\ndescribe(\"intellisense\", () => {\n let packagesDir;\n let clientPackagePath;\n beforeAll(() => {\n const clientsPackageJson = findUpSync(\"package.json\", {\n cwd: import.meta.url,\n });\n invariant(clientsPackageJson != null);\n packagesDir = path.join(path.dirname(clientsPackageJson), \"..\");\n clientPackagePath = path.join(packagesDir, \"client\");\n });\n let tsServer;\n let intellisenseFilePath;\n beforeEach(async (a) => {\n intellisenseFilePath = path.join(clientPackagePath, \"src\", \"intellisense.test.helpers\", `${a.task.name}.ts`);\n expect(ts.sys.fileExists(intellisenseFilePath)).toBeTruthy();\n tsServer = await startTsServer(rootLogger);\n await tsServer.sendOpenRequest({ file: intellisenseFilePath });\n });\n afterEach(async () => {\n tsServer.stop();\n tsServer = undefined;\n });\n it(\"callsQueryAcceptsObject\", { timeout: 20_000 }, async () => {\n const { resp } = await tsServer.sendQuickInfoRequest({\n file: intellisenseFilePath,\n line: 27,\n offset: 6,\n });\n expect(resp.body?.documentation).toMatchInlineSnapshot(`\"(no ontology metadata)\"`);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,SAAS;AACpC,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,OAAOC,SAAS,MAAM,gBAAgB;AACtC,OAAO,KAAKC,EAAE,MAAM,YAAY;AAChC,SAASC,SAAS,EAAEC,SAAS,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAS,QAAQ;AACpF,SAASC,aAAa,QAAQ,eAAe;AAC7C;AACA;AACA,MAAMC,UAAU,GAAG,MAAMF,EAAE,CAACG,OAAO,CAAC,YAAY;EAC5C,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,CAAC;IAAEK,KAAK,EAAE;EAAO,CAAC,EAAGJ,UAAU,CAACK,KAAK,CAAE;IAC9DC,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,IAfjB,cAAwCX,YAAY,CAAC;MACjDY,KAAKA,CAACC,CAAC,EAAE;QACL;QACA,IAAIA,CAAC,CAACC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,EACjBD,CAAC,GAAGA,CAAC,CAACE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACtB;QACAC,OAAO,CAACC,GAAG,CAACJ,CAAC,CAAC;MAClB;IACJ,CAAC,CAO8C;EAC/C,CAAC,CAAC,CAAC,CAAC;AACR,CAAC,CAAC;AACFtB,QAAQ,CAAC,cAAc,EAAE,MAAM;EAC3B,IAAI2B,WAAW;EACf,IAAIC,iBAAiB;EACrB9B,SAAS,CAAC,MAAM;IACZ,MAAM+B,kBAAkB,GAAGpC,UAAU,CAAC,cAAc,EAAE;MAClDqC,GAAG,EAAEC,MAAM,CAACC,IAAI,CAACC;IACrB,CAAC,CAAC;IACF,EAAUJ,kBAAkB,IAAI,IAAI,
|
|
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","url","process","env","NODE_ENV","join","dirname","tsServer","intellisenseFilePath","task","name","sys","fileExists","toBeTruthy","sendOpenRequest","file","stop","timeout","resp","sendQuickInfoRequest","line","offset","body","documentation","toMatchInlineSnapshot"],"sources":["intellisense.test.js"],"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 */\nimport { findUpSync } from \"find-up\";\nimport * as path from \"node:path\";\nimport invariant from \"tiny-invariant\";\nimport * as ts from \"typescript\";\nimport { afterEach, beforeAll, beforeEach, describe, expect, it, vi, } from \"vitest\";\nimport { startTsServer } from \"./tsserver.js\";\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 () => {\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) {\n // remove trailing newline since console.log adds one\n if (a.at(-1) === \"\\n\")\n a = a.slice(0, -1);\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({ level: \"info\" }, (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});\ndescribe(\"intellisense\", () => {\n let packagesDir;\n let clientPackagePath;\n beforeAll(() => {\n const clientsPackageJson = findUpSync(\"package.json\", {\n cwd: import.meta.url,\n });\n invariant(clientsPackageJson != null);\n packagesDir = path.join(path.dirname(clientsPackageJson), \"..\");\n clientPackagePath = path.join(packagesDir, \"client\");\n });\n let tsServer;\n let intellisenseFilePath;\n beforeEach(async (a) => {\n intellisenseFilePath = path.join(clientPackagePath, \"src\", \"intellisense.test.helpers\", `${a.task.name}.ts`);\n expect(ts.sys.fileExists(intellisenseFilePath)).toBeTruthy();\n tsServer = await startTsServer(rootLogger);\n await tsServer.sendOpenRequest({ file: intellisenseFilePath });\n });\n afterEach(async () => {\n tsServer.stop();\n tsServer = undefined;\n });\n it(\"callsQueryAcceptsObject\", { timeout: 20_000 }, async () => {\n const { resp } = await tsServer.sendQuickInfoRequest({\n file: intellisenseFilePath,\n line: 27,\n offset: 6,\n });\n expect(resp.body?.documentation).toMatchInlineSnapshot(`\"(no ontology metadata)\"`);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,SAAS;AACpC,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,OAAOC,SAAS,MAAM,gBAAgB;AACtC,OAAO,KAAKC,EAAE,MAAM,YAAY;AAChC,SAASC,SAAS,EAAEC,SAAS,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAS,QAAQ;AACpF,SAASC,aAAa,QAAQ,eAAe;AAC7C;AACA;AACA,MAAMC,UAAU,GAAG,MAAMF,EAAE,CAACG,OAAO,CAAC,YAAY;EAC5C,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,CAAC;IAAEK,KAAK,EAAE;EAAO,CAAC,EAAGJ,UAAU,CAACK,KAAK,CAAE;IAC9DC,IAAI,EAAE,IAAI;IACVC,YAAY,EAAEC,SAAS;IACvBC,mBAAmB,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,WAAW,CAAC;IAClDC,UAAU,EAAE,wBAAwB;IACpC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C;IAC5DN,QAAQ,GAAG,MAAMnC,aAAa,CAACC,UAAU,CAAC;IAC1C,MAAMkC,QAAQ,CAACO,eAAe,CAAC;MAAEC,IAAI,EAAEP;IAAqB,CAAC,CAAC;EAClE,CAAC,CAAC;EACF3C,SAAS,CAAC,YAAY;IAClB0C,QAAQ,CAACS,IAAI,CAAC,CAAC;IACfT,QAAQ,GAAGvB,SAAS;EACxB,CAAC,CAAC;EACFd,EAAE,CAAC,yBAAyB,EAAE;IAAE+C,OAAO,EAAE;EAAO,CAAC,EAAE,YAAY;IAC3D,MAAM;MAAEC;IAAK,CAAC,GAAG,MAAMX,QAAQ,CAACY,oBAAoB,CAAC;MACjDJ,IAAI,EAAEP,oBAAoB;MAC1BY,IAAI,EAAE,EAAE;MACRC,MAAM,EAAE;IACZ,CAAC,CAAC;IACFpD,MAAM,CAACiD,IAAI,CAACI,IAAI,EAAEC,aAAa,CAAC,CAACC,qBAAqB,CAAC,0BAA0B,CAAC;EACtF,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
|
|
@@ -21,7 +21,7 @@ export function legacyToModernSingleAggregationResult(entry) {
|
|
|
21
21
|
if (parts[0] === "count") {
|
|
22
22
|
return accumulator;
|
|
23
23
|
}
|
|
24
|
-
!(parts.length === 2) ? invariant(false, "assumed we were getting a `${key}.${type}`") : void 0;
|
|
24
|
+
!(parts.length === 2) ? process.env.NODE_ENV !== "production" ? invariant(false, "assumed we were getting a `${key}.${type}`") : invariant(false) : void 0;
|
|
25
25
|
const property = parts[0];
|
|
26
26
|
const metricType = parts[1];
|
|
27
27
|
if (!(property in accumulator)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacyToModernSingleAggregationResult.js","names":["invariant","legacyToModernSingleAggregationResult","entry","metrics","reduce","accumulator","curValue","parts","name","split","length","property","metricType","value"],"sources":["legacyToModernSingleAggregationResult.js"],"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 */\nimport invariant from \"tiny-invariant\";\n/** @internal */\nexport function legacyToModernSingleAggregationResult(entry) {\n return entry.metrics.reduce((accumulator, curValue) => {\n const parts = curValue.name.split(\".\");\n if (parts[0] === \"count\") {\n return accumulator;\n }\n invariant(parts.length === 2, \"assumed we were getting a `${key}.${type}`\");\n const property = parts[0];\n const metricType = parts[1];\n if (!(property in accumulator)) {\n accumulator[property] = {}; // fixme?\n }\n accumulator[property][metricType] = curValue.value; // fixme?\n return accumulator;\n }, {});\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,SAAS,MAAM,gBAAgB;AACtC;AACA,OAAO,SAASC,qCAAqCA,CAACC,KAAK,EAAE;EACzD,OAAOA,KAAK,CAACC,OAAO,CAACC,MAAM,CAAC,CAACC,WAAW,EAAEC,QAAQ,KAAK;IACnD,MAAMC,KAAK,GAAGD,QAAQ,CAACE,IAAI,CAACC,KAAK,CAAC,GAAG,CAAC;IACtC,IAAIF,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;MACtB,OAAOF,WAAW;IACtB;IACA,EAAUE,KAAK,CAACG,MAAM,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"legacyToModernSingleAggregationResult.js","names":["invariant","legacyToModernSingleAggregationResult","entry","metrics","reduce","accumulator","curValue","parts","name","split","length","process","env","NODE_ENV","property","metricType","value"],"sources":["legacyToModernSingleAggregationResult.js"],"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 */\nimport invariant from \"tiny-invariant\";\n/** @internal */\nexport function legacyToModernSingleAggregationResult(entry) {\n return entry.metrics.reduce((accumulator, curValue) => {\n const parts = curValue.name.split(\".\");\n if (parts[0] === \"count\") {\n return accumulator;\n }\n invariant(parts.length === 2, \"assumed we were getting a `${key}.${type}`\");\n const property = parts[0];\n const metricType = parts[1];\n if (!(property in accumulator)) {\n accumulator[property] = {}; // fixme?\n }\n accumulator[property][metricType] = curValue.value; // fixme?\n return accumulator;\n }, {});\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,SAAS,MAAM,gBAAgB;AACtC;AACA,OAAO,SAASC,qCAAqCA,CAACC,KAAK,EAAE;EACzD,OAAOA,KAAK,CAACC,OAAO,CAACC,MAAM,CAAC,CAACC,WAAW,EAAEC,QAAQ,KAAK;IACnD,MAAMC,KAAK,GAAGD,QAAQ,CAACE,IAAI,CAACC,KAAK,CAAC,GAAG,CAAC;IACtC,IAAIF,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;MACtB,OAAOF,WAAW;IACtB;IACA,EAAUE,KAAK,CAACG,MAAM,KAAK,CAAC,IAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAA5Bb,SAAS,QAAqB,4CAA4C,IAA1EA,SAAS;IACT,MAAMc,QAAQ,GAAGP,KAAK,CAAC,CAAC,CAAC;IACzB,MAAMQ,UAAU,GAAGR,KAAK,CAAC,CAAC,CAAC;IAC3B,IAAI,EAAEO,QAAQ,IAAIT,WAAW,CAAC,EAAE;MAC5BA,WAAW,CAACS,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAChC;IACAT,WAAW,CAACS,QAAQ,CAAC,CAACC,UAAU,CAAC,GAAGT,QAAQ,CAACU,KAAK,CAAC,CAAC;IACpD,OAAOX,WAAW;EACtB,CAAC,EAAE,CAAC,CAAC,CAAC;AACV","ignoreList":[]}
|
|
@@ -74,7 +74,7 @@ function makeGeoFilterPolygon(field, coordinates, filterType) {
|
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
function handleWherePair([field, filter], objectOrInterface) {
|
|
77
|
-
!(filter != null) ? invariant(false, "Defined key values are only allowed when they are not undefined.") : void 0;
|
|
77
|
+
!(filter != null) ? process.env.NODE_ENV !== "production" ? invariant(false, "Defined key values are only allowed when they are not undefined.") : invariant(false) : void 0;
|
|
78
78
|
if (typeof filter === "string" || typeof filter === "number" || typeof filter === "boolean") {
|
|
79
79
|
if (objectOrInterface.type === "interface") {
|
|
80
80
|
const [objApiNamespace] = extractNamespace(objectOrInterface.apiName);
|
|
@@ -93,13 +93,13 @@ function handleWherePair([field, filter], objectOrInterface) {
|
|
|
93
93
|
// If any of the keys start with `$` then they must be the only one.
|
|
94
94
|
// e.g. `where({ name: { $eq: "foo", $ne: "bar" } })` is invalid currently
|
|
95
95
|
const hasDollarSign = keysOfFilter.some(key => key.startsWith("$"));
|
|
96
|
-
!(!hasDollarSign || keysOfFilter.length === 1) ? invariant(false, "WhereClause Filter with multiple clauses isn't allowed") : void 0;
|
|
96
|
+
!(!hasDollarSign || keysOfFilter.length === 1) ? process.env.NODE_ENV !== "production" ? invariant(false, "WhereClause Filter with multiple clauses isn't allowed") : invariant(false) : void 0;
|
|
97
97
|
if (!hasDollarSign) {
|
|
98
98
|
// Future case for structs
|
|
99
99
|
throw new Error(`Unsupported filter. Did you forget to use a $-prefixed filter? (${JSON.stringify(filter)})`);
|
|
100
100
|
}
|
|
101
101
|
const firstKey = keysOfFilter[0];
|
|
102
|
-
!(filter[firstKey] != null) ? invariant(false) : void 0;
|
|
102
|
+
!(filter[firstKey] != null) ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
|
|
103
103
|
if (firstKey === "$ne") {
|
|
104
104
|
return {
|
|
105
105
|
type: "not",
|
|
@@ -147,6 +147,14 @@ function handleWherePair([field, filter], objectOrInterface) {
|
|
|
147
147
|
return makeGeoFilterPolygon(field, coordinates, "intersectsPolygon");
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
|
+
if (firstKey === "$containsAllTerms" || firstKey === "$containsAnyTerm") {
|
|
151
|
+
return {
|
|
152
|
+
type: firstKey.substring(1),
|
|
153
|
+
field,
|
|
154
|
+
value: typeof filter[firstKey] === "string" ? filter[firstKey] : filter[firstKey]["term"],
|
|
155
|
+
fuzzy: typeof filter[firstKey] === "string" ? false : filter[firstKey]["fuzzySearch"] ?? false
|
|
156
|
+
};
|
|
157
|
+
}
|
|
150
158
|
return {
|
|
151
159
|
type: firstKey.substring(1),
|
|
152
160
|
field,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modernToLegacyWhereClause.js","names":["DistanceUnitMapping","invariant","extractNamespace","fqApiName","last","lastIndexOf","undefined","slice","modernToLegacyWhereClause","whereClause","objectOrInterface","type","value","$and","map","clause","$or","$not","parts","Object","entries","length","handleWherePair","v","makeGeoFilterBbox","field","bbox","filterType","topLeft","coordinates","bottomRight","makeGeoFilterPolygon","filter","objApiNamespace","apiName","fieldApiNamespace","fieldShortName","keysOfFilter","keys","hasDollarSign","some","key","startsWith","Error","JSON","stringify","firstKey","withinBody","Array","isArray","$bbox","$distance","$of","center","distance","unit","$polygon","intersectsBody","substring"],"sources":["modernToLegacyWhereClause.js"],"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 */\nimport { DistanceUnitMapping } from \"@osdk/api\";\nimport invariant from \"tiny-invariant\";\nexport function extractNamespace(fqApiName) {\n const last = fqApiName.lastIndexOf(\".\");\n if (last === -1)\n return [undefined, fqApiName];\n return [fqApiName.slice(0, last), fqApiName.slice(last + 1)];\n}\n/** @internal */\nexport function modernToLegacyWhereClause(whereClause, objectOrInterface) {\n if (\"$and\" in whereClause) {\n return {\n type: \"and\",\n value: whereClause.$and.map((clause) => modernToLegacyWhereClause(clause, objectOrInterface)),\n };\n }\n else if (\"$or\" in whereClause) {\n return {\n type: \"or\",\n value: whereClause.$or.map((clause) => modernToLegacyWhereClause(clause, objectOrInterface)),\n };\n }\n else if (\"$not\" in whereClause) {\n return {\n type: \"not\",\n value: modernToLegacyWhereClause(whereClause.$not, objectOrInterface),\n };\n }\n const parts = Object.entries(whereClause);\n if (parts.length === 1) {\n return handleWherePair(parts[0], objectOrInterface);\n }\n return {\n type: \"and\",\n value: parts.map(v => handleWherePair(v, objectOrInterface)),\n };\n}\nfunction makeGeoFilterBbox(field, bbox, filterType) {\n return {\n type: filterType === \"$within\"\n ? \"withinBoundingBox\"\n : \"intersectsBoundingBox\",\n field,\n value: {\n topLeft: {\n type: \"Point\",\n coordinates: [bbox[0], bbox[3]],\n },\n bottomRight: {\n type: \"Point\",\n coordinates: [bbox[2], bbox[1]],\n },\n },\n };\n}\nfunction makeGeoFilterPolygon(field, coordinates, filterType) {\n return {\n type: filterType,\n field,\n value: {\n type: \"Polygon\",\n coordinates,\n },\n };\n}\nfunction handleWherePair([field, filter], objectOrInterface) {\n invariant(filter != null, \"Defined key values are only allowed when they are not undefined.\");\n if (typeof filter === \"string\" || typeof filter === \"number\"\n || typeof filter === \"boolean\") {\n if (objectOrInterface.type === \"interface\") {\n const [objApiNamespace] = extractNamespace(objectOrInterface.apiName);\n const [fieldApiNamespace, fieldShortName] = extractNamespace(field);\n if (fieldApiNamespace == null && objApiNamespace != null) {\n field = `${objApiNamespace}.${fieldShortName}`;\n }\n }\n return {\n type: \"eq\",\n field,\n value: filter,\n };\n }\n const keysOfFilter = Object.keys(filter);\n // If any of the keys start with `$` then they must be the only one.\n // e.g. `where({ name: { $eq: \"foo\", $ne: \"bar\" } })` is invalid currently\n const hasDollarSign = keysOfFilter.some((key) => key.startsWith(\"$\"));\n invariant(!hasDollarSign\n || keysOfFilter.length === 1, \"WhereClause Filter with multiple clauses isn't allowed\");\n if (!hasDollarSign) {\n // Future case for structs\n throw new Error(`Unsupported filter. Did you forget to use a $-prefixed filter? (${JSON.stringify(filter)})`);\n }\n const firstKey = keysOfFilter[0];\n invariant(filter[firstKey] != null);\n if (firstKey === \"$ne\") {\n return {\n type: \"not\",\n value: {\n type: \"eq\",\n field,\n value: filter[firstKey],\n },\n };\n }\n if (firstKey === \"$within\") {\n const withinBody = filter[firstKey];\n if (Array.isArray(withinBody)) {\n return makeGeoFilterBbox(field, withinBody, firstKey);\n }\n else if (\"$bbox\" in withinBody && withinBody.$bbox != null) {\n return makeGeoFilterBbox(field, withinBody.$bbox, firstKey);\n }\n else if ((\"$distance\" in withinBody && \"$of\" in withinBody)\n && withinBody.$distance != null\n && withinBody.$of != null) {\n return {\n type: \"withinDistanceOf\",\n field,\n value: {\n center: Array.isArray(withinBody.$of)\n ? {\n type: \"Point\",\n coordinates: withinBody.$of,\n }\n : withinBody.$of,\n distance: {\n value: withinBody.$distance[0],\n unit: DistanceUnitMapping[withinBody.$distance[1]],\n },\n },\n };\n }\n else {\n const coordinates = (\"$polygon\" in withinBody)\n ? withinBody.$polygon\n : withinBody.coordinates;\n return makeGeoFilterPolygon(field, coordinates, \"withinPolygon\");\n }\n }\n if (firstKey === \"$intersects\") {\n const intersectsBody = filter[firstKey];\n if (Array.isArray(intersectsBody)) {\n return makeGeoFilterBbox(field, intersectsBody, firstKey);\n }\n else if (\"$bbox\" in intersectsBody && intersectsBody.$bbox != null) {\n return makeGeoFilterBbox(field, intersectsBody.$bbox, firstKey);\n }\n else {\n const coordinates = (\"$polygon\" in intersectsBody)\n ? intersectsBody.$polygon\n : intersectsBody.coordinates;\n return makeGeoFilterPolygon(field, coordinates, \"intersectsPolygon\");\n }\n }\n return {\n type: firstKey.substring(1),\n field,\n value: filter[firstKey],\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,mBAAmB,QAAQ,WAAW;AAC/C,OAAOC,SAAS,MAAM,gBAAgB;AACtC,OAAO,SAASC,gBAAgBA,CAACC,SAAS,EAAE;EACxC,MAAMC,IAAI,GAAGD,SAAS,CAACE,WAAW,CAAC,GAAG,CAAC;EACvC,IAAID,IAAI,KAAK,CAAC,CAAC,EACX,OAAO,CAACE,SAAS,EAAEH,SAAS,CAAC;EACjC,OAAO,CAACA,SAAS,CAACI,KAAK,CAAC,CAAC,EAAEH,IAAI,CAAC,EAAED,SAAS,CAACI,KAAK,CAACH,IAAI,GAAG,CAAC,CAAC,CAAC;AAChE;AACA;AACA,OAAO,SAASI,yBAAyBA,CAACC,WAAW,EAAEC,iBAAiB,EAAE;EACtE,IAAI,MAAM,IAAID,WAAW,EAAE;IACvB,OAAO;MACHE,IAAI,EAAE,KAAK;MACXC,KAAK,EAAEH,WAAW,CAACI,IAAI,CAACC,GAAG,CAAEC,MAAM,IAAKP,yBAAyB,CAACO,MAAM,EAAEL,iBAAiB,CAAC;IAChG,CAAC;EACL,CAAC,MACI,IAAI,KAAK,IAAID,WAAW,EAAE;IAC3B,OAAO;MACHE,IAAI,EAAE,IAAI;MACVC,KAAK,EAAEH,WAAW,CAACO,GAAG,CAACF,GAAG,CAAEC,MAAM,IAAKP,yBAAyB,CAACO,MAAM,EAAEL,iBAAiB,CAAC;IAC/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,eAAe,CAAC;IACpE;EACJ;EACA,IAAIiB,QAAQ,KAAK,aAAa,EAAE;IAC5B,MAAMW,cAAc,GAAGzB,MAAM,CAACc,QAAQ,CAAC;IACvC,IAAIE,KAAK,CAACC,OAAO,CAACQ,cAAc,CAAC,EAAE;MAC/B,OAAOjC,iBAAiB,CAACC,KAAK,EAAEgC,cAAc,EAAEX,QAAQ,CAAC;IAC7D,CAAC,MACI,IAAI,OAAO,IAAIW,cAAc,IAAIA,cAAc,CAACP,KAAK,IAAI,IAAI,EAAE;MAChE,OAAO1B,iBAAiB,CAACC,KAAK,EAAEgC,cAAc,CAACP,KAAK,EAAEJ,QAAQ,CAAC;IACnE,CAAC,MACI;MACD,MAAMjB,WAAW,GAAI,UAAU,IAAI4B,cAAc,GAC3CA,cAAc,CAACD,QAAQ,GACvBC,cAAc,CAAC5B,WAAW;MAChC,OAAOE,oBAAoB,CAACN,KAAK,EAAEI,WAAW,EAAE,mBAAmB,CAAC;IACxE;EACJ;EACA,OAAO;IACHlB,IAAI,EAAEmC,QAAQ,CAACY,SAAS,CAAC,CAAC,CAAC;IAC3BjC,KAAK;IACLb,KAAK,EAAEoB,MAAM,CAACc,QAAQ;EAC1B,CAAC;AACL","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"modernToLegacyWhereClause.js","names":["DistanceUnitMapping","invariant","extractNamespace","fqApiName","last","lastIndexOf","undefined","slice","modernToLegacyWhereClause","whereClause","objectOrInterface","type","value","$and","map","clause","$or","$not","parts","Object","entries","length","handleWherePair","v","makeGeoFilterBbox","field","bbox","filterType","topLeft","coordinates","bottomRight","makeGeoFilterPolygon","filter","process","env","NODE_ENV","objApiNamespace","apiName","fieldApiNamespace","fieldShortName","keysOfFilter","keys","hasDollarSign","some","key","startsWith","Error","JSON","stringify","firstKey","withinBody","Array","isArray","$bbox","$distance","$of","center","distance","unit","$polygon","intersectsBody","substring","fuzzy"],"sources":["modernToLegacyWhereClause.js"],"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 */\nimport { DistanceUnitMapping } from \"@osdk/api\";\nimport invariant from \"tiny-invariant\";\nexport function extractNamespace(fqApiName) {\n const last = fqApiName.lastIndexOf(\".\");\n if (last === -1)\n return [undefined, fqApiName];\n return [fqApiName.slice(0, last), fqApiName.slice(last + 1)];\n}\n/** @internal */\nexport function modernToLegacyWhereClause(whereClause, objectOrInterface) {\n if (\"$and\" in whereClause) {\n return {\n type: \"and\",\n value: whereClause.$and.map((clause) => modernToLegacyWhereClause(clause, objectOrInterface)),\n };\n }\n else if (\"$or\" in whereClause) {\n return {\n type: \"or\",\n value: whereClause.$or.map((clause) => modernToLegacyWhereClause(clause, objectOrInterface)),\n };\n }\n else if (\"$not\" in whereClause) {\n return {\n type: \"not\",\n value: modernToLegacyWhereClause(whereClause.$not, objectOrInterface),\n };\n }\n const parts = Object.entries(whereClause);\n if (parts.length === 1) {\n return handleWherePair(parts[0], objectOrInterface);\n }\n return {\n type: \"and\",\n value: parts.map(v => handleWherePair(v, objectOrInterface)),\n };\n}\nfunction makeGeoFilterBbox(field, bbox, filterType) {\n return {\n type: filterType === \"$within\"\n ? \"withinBoundingBox\"\n : \"intersectsBoundingBox\",\n field,\n value: {\n topLeft: {\n type: \"Point\",\n coordinates: [bbox[0], bbox[3]],\n },\n bottomRight: {\n type: \"Point\",\n coordinates: [bbox[2], bbox[1]],\n },\n },\n };\n}\nfunction makeGeoFilterPolygon(field, coordinates, filterType) {\n return {\n type: filterType,\n field,\n value: {\n type: \"Polygon\",\n coordinates,\n },\n };\n}\nfunction handleWherePair([field, filter], objectOrInterface) {\n invariant(filter != null, \"Defined key values are only allowed when they are not undefined.\");\n if (typeof filter === \"string\" || typeof filter === \"number\"\n || typeof filter === \"boolean\") {\n if (objectOrInterface.type === \"interface\") {\n const [objApiNamespace] = extractNamespace(objectOrInterface.apiName);\n const [fieldApiNamespace, fieldShortName] = extractNamespace(field);\n if (fieldApiNamespace == null && objApiNamespace != null) {\n field = `${objApiNamespace}.${fieldShortName}`;\n }\n }\n return {\n type: \"eq\",\n field,\n value: filter,\n };\n }\n const keysOfFilter = Object.keys(filter);\n // If any of the keys start with `$` then they must be the only one.\n // e.g. `where({ name: { $eq: \"foo\", $ne: \"bar\" } })` is invalid currently\n const hasDollarSign = keysOfFilter.some((key) => key.startsWith(\"$\"));\n invariant(!hasDollarSign\n || keysOfFilter.length === 1, \"WhereClause Filter with multiple clauses isn't allowed\");\n if (!hasDollarSign) {\n // Future case for structs\n throw new Error(`Unsupported filter. Did you forget to use a $-prefixed filter? (${JSON.stringify(filter)})`);\n }\n const firstKey = keysOfFilter[0];\n invariant(filter[firstKey] != null);\n if (firstKey === \"$ne\") {\n return {\n type: \"not\",\n value: {\n type: \"eq\",\n field,\n value: filter[firstKey],\n },\n };\n }\n if (firstKey === \"$within\") {\n const withinBody = filter[firstKey];\n if (Array.isArray(withinBody)) {\n return makeGeoFilterBbox(field, withinBody, firstKey);\n }\n else if (\"$bbox\" in withinBody && withinBody.$bbox != null) {\n return makeGeoFilterBbox(field, withinBody.$bbox, firstKey);\n }\n else if ((\"$distance\" in withinBody && \"$of\" in withinBody)\n && withinBody.$distance != null\n && withinBody.$of != null) {\n return {\n type: \"withinDistanceOf\",\n field,\n value: {\n center: Array.isArray(withinBody.$of)\n ? {\n type: \"Point\",\n coordinates: withinBody.$of,\n }\n : withinBody.$of,\n distance: {\n value: withinBody.$distance[0],\n unit: DistanceUnitMapping[withinBody.$distance[1]],\n },\n },\n };\n }\n else {\n const coordinates = (\"$polygon\" in withinBody)\n ? withinBody.$polygon\n : withinBody.coordinates;\n return makeGeoFilterPolygon(field, coordinates, \"withinPolygon\");\n }\n }\n if (firstKey === \"$intersects\") {\n const intersectsBody = filter[firstKey];\n if (Array.isArray(intersectsBody)) {\n return makeGeoFilterBbox(field, intersectsBody, firstKey);\n }\n else if (\"$bbox\" in intersectsBody && intersectsBody.$bbox != null) {\n return makeGeoFilterBbox(field, intersectsBody.$bbox, firstKey);\n }\n else {\n const coordinates = (\"$polygon\" in intersectsBody)\n ? intersectsBody.$polygon\n : intersectsBody.coordinates;\n return makeGeoFilterPolygon(field, coordinates, \"intersectsPolygon\");\n }\n }\n if (firstKey === \"$containsAllTerms\" || firstKey === \"$containsAnyTerm\") {\n return {\n type: firstKey.substring(1),\n field,\n value: typeof filter[firstKey] === \"string\"\n ? filter[firstKey]\n : filter[firstKey][\"term\"],\n fuzzy: typeof filter[firstKey] === \"string\"\n ? false\n : filter[firstKey][\"fuzzySearch\"] ?? false,\n };\n }\n return {\n type: firstKey.substring(1),\n field,\n value: filter[firstKey],\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,mBAAmB,QAAQ,WAAW;AAC/C,OAAOC,SAAS,MAAM,gBAAgB;AACtC,OAAO,SAASC,gBAAgBA,CAACC,SAAS,EAAE;EACxC,MAAMC,IAAI,GAAGD,SAAS,CAACE,WAAW,CAAC,GAAG,CAAC;EACvC,IAAID,IAAI,KAAK,CAAC,CAAC,EACX,OAAO,CAACE,SAAS,EAAEH,SAAS,CAAC;EACjC,OAAO,CAACA,SAAS,CAACI,KAAK,CAAC,CAAC,EAAEH,IAAI,CAAC,EAAED,SAAS,CAACI,KAAK,CAACH,IAAI,GAAG,CAAC,CAAC,CAAC;AAChE;AACA;AACA,OAAO,SAASI,yBAAyBA,CAACC,WAAW,EAAEC,iBAAiB,EAAE;EACtE,IAAI,MAAM,IAAID,WAAW,EAAE;IACvB,OAAO;MACHE,IAAI,E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AS,CAAC,CAAC,CAAC;MAC3BpC,KAAK;MACLb,KAAK,EAAE,OAAOoB,MAAM,CAACiB,QAAQ,CAAC,KAAK,QAAQ,GACrCjB,MAAM,CAACiB,QAAQ,CAAC,GAChBjB,MAAM,CAACiB,QAAQ,CAAC,CAAC,MAAM,CAAC;MAC9Ba,KAAK,EAAE,OAAO9B,MAAM,CAACiB,QAAQ,CAAC,KAAK,QAAQ,GACrC,KAAK,GACLjB,MAAM,CAACiB,QAAQ,CAAC,CAAC,aAAa,CAAC,IAAI;IAC7C,CAAC;EACL;EACA,OAAO;IACHtC,IAAI,EAAEsC,QAAQ,CAACY,SAAS,CAAC,CAAC,CAAC;IAC3BpC,KAAK;IACLb,KAAK,EAAEoB,MAAM,CAACiB,QAAQ;EAC1B,CAAC;AACL","ignoreList":[]}
|
|
@@ -25,7 +25,19 @@ describe(modernToLegacyWhereClause, () => {
|
|
|
25
25
|
prop: 5
|
|
26
26
|
}, {
|
|
27
27
|
type: "interface",
|
|
28
|
-
apiName: "a.Foo"
|
|
28
|
+
apiName: "a.Foo",
|
|
29
|
+
__DefinitionMetadata: {
|
|
30
|
+
type: "interface",
|
|
31
|
+
properties: {
|
|
32
|
+
"prop": {
|
|
33
|
+
type: "integer"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
apiName: "a.Foo",
|
|
37
|
+
displayName: "",
|
|
38
|
+
links: {},
|
|
39
|
+
rid: ""
|
|
40
|
+
}
|
|
29
41
|
});
|
|
30
42
|
expect(r).toMatchInlineSnapshot(`
|
|
31
43
|
{
|
|
@@ -41,7 +53,25 @@ describe(modernToLegacyWhereClause, () => {
|
|
|
41
53
|
foo: 6
|
|
42
54
|
}, {
|
|
43
55
|
type: "interface",
|
|
44
|
-
apiName: "Foo"
|
|
56
|
+
apiName: "Foo",
|
|
57
|
+
__DefinitionMetadata: {
|
|
58
|
+
type: "interface",
|
|
59
|
+
properties: {
|
|
60
|
+
"foo": {
|
|
61
|
+
type: "integer"
|
|
62
|
+
},
|
|
63
|
+
"b.prop": {
|
|
64
|
+
type: "integer"
|
|
65
|
+
},
|
|
66
|
+
"prop": {
|
|
67
|
+
type: "integer"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
apiName: "Foo",
|
|
71
|
+
displayName: "",
|
|
72
|
+
links: {},
|
|
73
|
+
rid: ""
|
|
74
|
+
}
|
|
45
75
|
});
|
|
46
76
|
expect(r).toMatchInlineSnapshot(`
|
|
47
77
|
{
|
|
@@ -67,7 +97,25 @@ describe(modernToLegacyWhereClause, () => {
|
|
|
67
97
|
"a.foo": 6
|
|
68
98
|
}, {
|
|
69
99
|
type: "interface",
|
|
70
|
-
apiName: "a.Foo"
|
|
100
|
+
apiName: "a.Foo",
|
|
101
|
+
__DefinitionMetadata: {
|
|
102
|
+
type: "interface",
|
|
103
|
+
properties: {
|
|
104
|
+
"a.foo": {
|
|
105
|
+
type: "integer"
|
|
106
|
+
},
|
|
107
|
+
"b.prop": {
|
|
108
|
+
type: "integer"
|
|
109
|
+
},
|
|
110
|
+
"prop": {
|
|
111
|
+
type: "integer"
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
apiName: "a.Foo",
|
|
115
|
+
displayName: "",
|
|
116
|
+
links: {},
|
|
117
|
+
rid: ""
|
|
118
|
+
}
|
|
71
119
|
});
|
|
72
120
|
expect(r).toMatchInlineSnapshot(`
|
|
73
121
|
{
|
|
@@ -92,7 +140,25 @@ describe(modernToLegacyWhereClause, () => {
|
|
|
92
140
|
"b.prop": 5
|
|
93
141
|
}, {
|
|
94
142
|
type: "interface",
|
|
95
|
-
apiName: "a.Foo"
|
|
143
|
+
apiName: "a.Foo",
|
|
144
|
+
__DefinitionMetadata: {
|
|
145
|
+
type: "interface",
|
|
146
|
+
properties: {
|
|
147
|
+
"a.foo": {
|
|
148
|
+
type: "integer"
|
|
149
|
+
},
|
|
150
|
+
"b.prop": {
|
|
151
|
+
type: "integer"
|
|
152
|
+
},
|
|
153
|
+
"prop": {
|
|
154
|
+
type: "integer"
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
apiName: "a.Foo",
|
|
158
|
+
displayName: "",
|
|
159
|
+
links: {},
|
|
160
|
+
rid: ""
|
|
161
|
+
}
|
|
96
162
|
})).toMatchInlineSnapshot(`
|
|
97
163
|
{
|
|
98
164
|
"field": "b.prop",
|
|
@@ -107,12 +173,27 @@ describe(modernToLegacyWhereClause, () => {
|
|
|
107
173
|
const r = modernToLegacyWhereClause({
|
|
108
174
|
prop: 5
|
|
109
175
|
}, {
|
|
110
|
-
type: "
|
|
111
|
-
apiName: "a.Foo"
|
|
176
|
+
type: "interface",
|
|
177
|
+
apiName: "a.Foo",
|
|
178
|
+
__DefinitionMetadata: {
|
|
179
|
+
type: "interface",
|
|
180
|
+
properties: {
|
|
181
|
+
"a.foo": {
|
|
182
|
+
type: "integer"
|
|
183
|
+
},
|
|
184
|
+
"prop": {
|
|
185
|
+
type: "integer"
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
apiName: "a.Foo",
|
|
189
|
+
displayName: "",
|
|
190
|
+
links: {},
|
|
191
|
+
rid: ""
|
|
192
|
+
}
|
|
112
193
|
});
|
|
113
194
|
expect(r).toMatchInlineSnapshot(`
|
|
114
195
|
{
|
|
115
|
-
"field": "prop",
|
|
196
|
+
"field": "a.prop",
|
|
116
197
|
"type": "eq",
|
|
117
198
|
"value": 5,
|
|
118
199
|
}
|
|
@@ -509,6 +590,126 @@ describe(modernToLegacyWhereClause, () => {
|
|
|
509
590
|
}
|
|
510
591
|
`);
|
|
511
592
|
});
|
|
593
|
+
it("converts $containsAllTerms correctly if using new type", () => {
|
|
594
|
+
expect(modernToLegacyWhereClause({
|
|
595
|
+
string: {
|
|
596
|
+
$containsAllTerms: {
|
|
597
|
+
term: "test",
|
|
598
|
+
fuzzySearch: true
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
}, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`
|
|
602
|
+
{
|
|
603
|
+
"field": "string",
|
|
604
|
+
"fuzzy": true,
|
|
605
|
+
"type": "containsAllTerms",
|
|
606
|
+
"value": "test",
|
|
607
|
+
}
|
|
608
|
+
`);
|
|
609
|
+
expect(modernToLegacyWhereClause({
|
|
610
|
+
string: {
|
|
611
|
+
$containsAllTerms: {
|
|
612
|
+
term: "test",
|
|
613
|
+
fuzzySearch: false
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
}, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`
|
|
617
|
+
{
|
|
618
|
+
"field": "string",
|
|
619
|
+
"fuzzy": false,
|
|
620
|
+
"type": "containsAllTerms",
|
|
621
|
+
"value": "test",
|
|
622
|
+
}
|
|
623
|
+
`);
|
|
624
|
+
expect(modernToLegacyWhereClause({
|
|
625
|
+
string: {
|
|
626
|
+
$containsAllTerms: {
|
|
627
|
+
term: "test"
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
}, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`
|
|
631
|
+
{
|
|
632
|
+
"field": "string",
|
|
633
|
+
"fuzzy": false,
|
|
634
|
+
"type": "containsAllTerms",
|
|
635
|
+
"value": "test",
|
|
636
|
+
}
|
|
637
|
+
`);
|
|
638
|
+
});
|
|
639
|
+
it("converts $containsAllTerms correctly if using old type", () => {
|
|
640
|
+
expect(modernToLegacyWhereClause({
|
|
641
|
+
string: {
|
|
642
|
+
$containsAllTerms: "test"
|
|
643
|
+
}
|
|
644
|
+
}, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`
|
|
645
|
+
{
|
|
646
|
+
"field": "string",
|
|
647
|
+
"fuzzy": false,
|
|
648
|
+
"type": "containsAllTerms",
|
|
649
|
+
"value": "test",
|
|
650
|
+
}
|
|
651
|
+
`);
|
|
652
|
+
});
|
|
653
|
+
it("converts $containsAnyTerm correctly if using new type", () => {
|
|
654
|
+
expect(modernToLegacyWhereClause({
|
|
655
|
+
string: {
|
|
656
|
+
$containsAnyTerm: {
|
|
657
|
+
term: "test",
|
|
658
|
+
fuzzySearch: true
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
}, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`
|
|
662
|
+
{
|
|
663
|
+
"field": "string",
|
|
664
|
+
"fuzzy": true,
|
|
665
|
+
"type": "containsAnyTerm",
|
|
666
|
+
"value": "test",
|
|
667
|
+
}
|
|
668
|
+
`);
|
|
669
|
+
expect(modernToLegacyWhereClause({
|
|
670
|
+
string: {
|
|
671
|
+
$containsAnyTerm: {
|
|
672
|
+
term: "test",
|
|
673
|
+
fuzzySearch: false
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
}, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`
|
|
677
|
+
{
|
|
678
|
+
"field": "string",
|
|
679
|
+
"fuzzy": false,
|
|
680
|
+
"type": "containsAnyTerm",
|
|
681
|
+
"value": "test",
|
|
682
|
+
}
|
|
683
|
+
`);
|
|
684
|
+
expect(modernToLegacyWhereClause({
|
|
685
|
+
string: {
|
|
686
|
+
$containsAnyTerm: {
|
|
687
|
+
term: "test"
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
}, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`
|
|
691
|
+
{
|
|
692
|
+
"field": "string",
|
|
693
|
+
"fuzzy": false,
|
|
694
|
+
"type": "containsAnyTerm",
|
|
695
|
+
"value": "test",
|
|
696
|
+
}
|
|
697
|
+
`);
|
|
698
|
+
});
|
|
699
|
+
it("converts $containsAnyTerm correctly if using old type", () => {
|
|
700
|
+
expect(modernToLegacyWhereClause({
|
|
701
|
+
string: {
|
|
702
|
+
$containsAnyTerm: "test"
|
|
703
|
+
}
|
|
704
|
+
}, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`
|
|
705
|
+
{
|
|
706
|
+
"field": "string",
|
|
707
|
+
"fuzzy": false,
|
|
708
|
+
"type": "containsAnyTerm",
|
|
709
|
+
"value": "test",
|
|
710
|
+
}
|
|
711
|
+
`);
|
|
712
|
+
});
|
|
512
713
|
});
|
|
513
714
|
describe("multiple checks", () => {
|
|
514
715
|
it("properly handles multiple simple where checks", () => {
|