@osdk/client 2.1.0-beta.3 → 2.1.0-beta.4
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 +18 -0
- package/build/browser/Client.d.ts +3 -19
- package/build/browser/Client.d.ts.map +1 -1
- package/build/browser/__unstable/ConjureSupport.js +4 -4
- 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 +1 -1
- package/build/browser/__unstable/createBulkLinksAsyncIterFactory.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.map +1 -1
- package/build/browser/createClient.js +33 -19
- package/build/browser/createClient.js.map +1 -1
- package/build/browser/createMinimalClient.js +1 -1
- package/build/browser/createMinimalClient.js.map +1 -1
- package/build/browser/index.d.ts +0 -1
- package/build/browser/index.d.ts.map +1 -1
- package/build/browser/index.js +0 -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 +3 -3
- package/build/browser/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
- package/build/browser/object/aggregate.js +1 -1
- package/build/browser/object/aggregate.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 +6 -0
- package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.js +2 -2
- package/build/browser/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/browser/object/fetchPage.js +1 -1
- package/build/browser/object/fetchPage.js.map +1 -1
- package/build/browser/objectSet/ObjectSet.test.js +43 -47
- package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js +22 -45
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js +8 -5
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
- package/build/browser/objectSet/createObjectSet.js +2 -5
- package/build/browser/objectSet/createObjectSet.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/esm/Client.d.ts +3 -19
- package/build/esm/Client.d.ts.map +1 -1
- package/build/esm/__unstable/ConjureSupport.js +4 -4
- 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 +1 -1
- package/build/esm/__unstable/createBulkLinksAsyncIterFactory.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.map +1 -1
- package/build/esm/createClient.js +33 -19
- package/build/esm/createClient.js.map +1 -1
- package/build/esm/createMinimalClient.js +1 -1
- package/build/esm/createMinimalClient.js.map +1 -1
- package/build/esm/index.d.ts +0 -1
- package/build/esm/index.d.ts.map +1 -1
- package/build/esm/index.js +0 -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 +3 -3
- package/build/esm/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
- package/build/esm/object/aggregate.js +1 -1
- package/build/esm/object/aggregate.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 +6 -0
- package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.js +2 -2
- package/build/esm/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/esm/object/fetchPage.js +1 -1
- package/build/esm/object/fetchPage.js.map +1 -1
- package/build/esm/objectSet/ObjectSet.test.js +43 -47
- package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js +22 -45
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js +8 -5
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
- package/build/esm/objectSet/createObjectSet.js +2 -5
- package/build/esm/objectSet/createObjectSet.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/package.json +9 -9
|
@@ -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",
|
|
@@ -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,CA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AW,EAAE,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"],"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,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AS,CAAC,CAAC,CAAC;YAC9BI,IAAI,EAAE1D,mBAAmB,CAACkD,UAAU,CAACI,SAAS,CAAC,CAAC,CAAC;UACrD;QACJ;MACJ,CAAC;IACL,CAAC,MACI;MACD,MAAMzB,WAAW,GAAI,UAAU,IAAIqB,UAAU,GACvCA,UAAU,CAACS,QAAQ,GACnBT,UAAU,CAACrB,WAAW;MAC5B,OAAOE,oBAAoB,CAACN,KAAK,EAAEI,WAAW,EAAE,eAAe,CAAC;IACpE;EACJ;EACA,IAAIoB,QAAQ,KAAK,aAAa,EAAE;IAC5B,MAAMW,cAAc,GAAG5B,MAAM,CAACiB,QAAQ,CAAC;IACvC,IAAIE,KAAK,CAACC,OAAO,CAACQ,cAAc,CAAC,EAAE;MAC/B,OAAOpC,iBAAiB,CAACC,KAAK,EAAEmC,cAAc,EAAEX,QAAQ,CAAC;IAC7D,CAAC,MACI,IAAI,OAAO,IAAIW,cAAc,IAAIA,cAAc,CAACP,KAAK,IAAI,IAAI,EAAE;MAChE,OAAO7B,iBAAiB,CAACC,KAAK,EAAEmC,cAAc,CAACP,KAAK,EAAEJ,QAAQ,CAAC;IACnE,CAAC,MACI;MACD,MAAMpB,WAAW,GAAI,UAAU,IAAI+B,cAAc,GAC3CA,cAAc,CAACD,QAAQ,GACvBC,cAAc,CAAC/B,WAAW;MAChC,OAAOE,oBAAoB,CAACN,KAAK,EAAEI,WAAW,EAAE,mBAAmB,CAAC;IACxE;EACJ;EACA,OAAO;IACHlB,IAAI,EAAEsC,QAAQ,CAACY,SAAS,CAAC,CAAC,CAAC;IAC3BpC,KAAK;IACLb,KAAK,EAAEoB,MAAM,CAACiB,QAAQ;EAC1B,CAAC;AACL","ignoreList":[]}
|
|
@@ -42,7 +42,7 @@ export async function aggregate(clientCtx, objectType, objectSet = {
|
|
|
42
42
|
aggregation: body.aggregation
|
|
43
43
|
});
|
|
44
44
|
if (!req.$groupBy) {
|
|
45
|
-
!(result.data.length === 1) ? invariant(false, "no group by clause should mean only one data result") : void 0;
|
|
45
|
+
!(result.data.length === 1) ? process.env.NODE_ENV !== "production" ? invariant(false, "no group by clause should mean only one data result") : invariant(false) : void 0;
|
|
46
46
|
return {
|
|
47
47
|
...aggregationToCountResult(result.data[0]),
|
|
48
48
|
...legacyToModernSingleAggregationResult(result.data[0])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate.js","names":["OntologiesV2","invariant","legacyToModernSingleAggregationResult","modernToLegacyAggregationClause","modernToLegacyGroupByClause","modernToLegacyWhereClause","addUserAgentAndRequestContextHeaders","aggregate","clientCtx","objectType","objectSet","type","req","body","aggregation","$select","groupBy","where","undefined","$groupBy","$where","result","OntologyObjectSets","ontologyRid","data","length","aggregationToCountResult","ret","map","entry","$group","group","aggregateResult","metrics","name","$count","value"],"sources":["aggregate.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 * as OntologiesV2 from \"@osdk/internal.foundry.ontologiesv2\";\nimport invariant from \"tiny-invariant\";\nimport { legacyToModernSingleAggregationResult } from \"../internal/conversions/legacyToModernSingleAggregationResult.js\";\nimport { modernToLegacyAggregationClause } from \"../internal/conversions/modernToLegacyAggregationClause.js\";\nimport { modernToLegacyGroupByClause } from \"../internal/conversions/modernToLegacyGroupByClause.js\";\nimport { modernToLegacyWhereClause } from \"../internal/conversions/modernToLegacyWhereClause.js\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\n/** @internal */\nexport async function aggregate(clientCtx, objectType, objectSet = {\n type: \"base\",\n objectType: objectType[\"apiName\"],\n}, req) {\n const body = {\n aggregation: modernToLegacyAggregationClause(req.$select),\n groupBy: [],\n where: undefined,\n };\n if (req.$groupBy) {\n body.groupBy = modernToLegacyGroupByClause(req.$groupBy);\n }\n if (req.$where) {\n body.where = modernToLegacyWhereClause(req.$where, objectType);\n }\n const result = await OntologiesV2.OntologyObjectSets.aggregate(addUserAgentAndRequestContextHeaders(clientCtx, objectType), await clientCtx.ontologyRid, {\n objectSet,\n groupBy: body.groupBy,\n aggregation: body.aggregation,\n });\n if (!req.$groupBy) {\n invariant(result.data.length === 1, \"no group by clause should mean only one data result\");\n return {\n ...aggregationToCountResult(result.data[0]),\n ...legacyToModernSingleAggregationResult(result.data[0]),\n };\n }\n const ret = result.data\n .map((entry) => {\n return {\n $group: entry.group,\n ...aggregationToCountResult(entry),\n ...legacyToModernSingleAggregationResult(entry),\n };\n }); // fixme\n return ret; // FIXME\n}\nfunction aggregationToCountResult(entry) {\n for (const aggregateResult of entry.metrics) {\n if (aggregateResult.name === \"count\") {\n return { $count: aggregateResult.value };\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,YAAY,MAAM,qCAAqC;AACnE,OAAOC,SAAS,MAAM,gBAAgB;AACtC,SAASC,qCAAqC,QAAQ,kEAAkE;AACxH,SAASC,+BAA+B,QAAQ,4DAA4D;AAC5G,SAASC,2BAA2B,QAAQ,wDAAwD;AACpG,SAASC,yBAAyB,QAAQ,sDAAsD;AAChG,SAASC,oCAAoC,QAAQ,iDAAiD;AACtG;AACA,OAAO,eAAeC,SAASA,CAACC,SAAS,EAAEC,UAAU,EAAEC,SAAS,GAAG;EAC/DC,IAAI,EAAE,MAAM;EACZF,UAAU,EAAEA,UAAU,CAAC,SAAS;AACpC,CAAC,EAAEG,GAAG,EAAE;EACJ,MAAMC,IAAI,GAAG;IACTC,WAAW,EAAEX,+BAA+B,CAACS,GAAG,CAACG,OAAO,CAAC;IACzDC,OAAO,EAAE,EAAE;IACXC,KAAK,EAAEC;EACX,CAAC;EACD,IAAIN,GAAG,CAACO,QAAQ,EAAE;IACdN,IAAI,CAACG,OAAO,GAAGZ,2BAA2B,CAACQ,GAAG,CAACO,QAAQ,CAAC;EAC5D;EACA,IAAIP,GAAG,CAACQ,MAAM,EAAE;IACZP,IAAI,CAACI,KAAK,GAAGZ,yBAAyB,CAACO,GAAG,CAACQ,MAAM,EAAEX,UAAU,CAAC;EAClE;EACA,MAAMY,MAAM,GAAG,MAAMrB,YAAY,CAACsB,kBAAkB,CAACf,SAAS,CAACD,oCAAoC,CAACE,SAAS,EAAEC,UAAU,CAAC,EAAE,MAAMD,SAAS,CAACe,WAAW,EAAE;IACrJb,SAAS;IACTM,OAAO,EAAEH,IAAI,CAACG,OAAO;IACrBF,WAAW,EAAED,IAAI,CAACC;EACtB,CAAC,CAAC;EACF,IAAI,CAACF,GAAG,CAACO,QAAQ,EAAE;IACf,EAAUE,MAAM,CAACG,IAAI,CAACC,MAAM,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"aggregate.js","names":["OntologiesV2","invariant","legacyToModernSingleAggregationResult","modernToLegacyAggregationClause","modernToLegacyGroupByClause","modernToLegacyWhereClause","addUserAgentAndRequestContextHeaders","aggregate","clientCtx","objectType","objectSet","type","req","body","aggregation","$select","groupBy","where","undefined","$groupBy","$where","result","OntologyObjectSets","ontologyRid","data","length","process","env","NODE_ENV","aggregationToCountResult","ret","map","entry","$group","group","aggregateResult","metrics","name","$count","value"],"sources":["aggregate.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 * as OntologiesV2 from \"@osdk/internal.foundry.ontologiesv2\";\nimport invariant from \"tiny-invariant\";\nimport { legacyToModernSingleAggregationResult } from \"../internal/conversions/legacyToModernSingleAggregationResult.js\";\nimport { modernToLegacyAggregationClause } from \"../internal/conversions/modernToLegacyAggregationClause.js\";\nimport { modernToLegacyGroupByClause } from \"../internal/conversions/modernToLegacyGroupByClause.js\";\nimport { modernToLegacyWhereClause } from \"../internal/conversions/modernToLegacyWhereClause.js\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\n/** @internal */\nexport async function aggregate(clientCtx, objectType, objectSet = {\n type: \"base\",\n objectType: objectType[\"apiName\"],\n}, req) {\n const body = {\n aggregation: modernToLegacyAggregationClause(req.$select),\n groupBy: [],\n where: undefined,\n };\n if (req.$groupBy) {\n body.groupBy = modernToLegacyGroupByClause(req.$groupBy);\n }\n if (req.$where) {\n body.where = modernToLegacyWhereClause(req.$where, objectType);\n }\n const result = await OntologiesV2.OntologyObjectSets.aggregate(addUserAgentAndRequestContextHeaders(clientCtx, objectType), await clientCtx.ontologyRid, {\n objectSet,\n groupBy: body.groupBy,\n aggregation: body.aggregation,\n });\n if (!req.$groupBy) {\n invariant(result.data.length === 1, \"no group by clause should mean only one data result\");\n return {\n ...aggregationToCountResult(result.data[0]),\n ...legacyToModernSingleAggregationResult(result.data[0]),\n };\n }\n const ret = result.data\n .map((entry) => {\n return {\n $group: entry.group,\n ...aggregationToCountResult(entry),\n ...legacyToModernSingleAggregationResult(entry),\n };\n }); // fixme\n return ret; // FIXME\n}\nfunction aggregationToCountResult(entry) {\n for (const aggregateResult of entry.metrics) {\n if (aggregateResult.name === \"count\") {\n return { $count: aggregateResult.value };\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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,IAAzFA,SAAS;IACT,OAAO;MACH,GAAG4B,wBAAwB,CAACR,MAAM,CAACG,IAAI,CAAC,CAAC,CAAC,CAAC;MAC3C,GAAGtB,qCAAqC,CAACmB,MAAM,CAACG,IAAI,CAAC,CAAC,CAAC;IAC3D,CAAC;EACL;EACA,MAAMM,GAAG,GAAGT,MAAM,CAACG,IAAI,CAClBO,GAAG,CAAEC,KAAK,IAAK;IAChB,OAAO;MACHC,MAAM,EAAED,KAAK,CAACE,KAAK;MACnB,GAAGL,wBAAwB,CAACG,KAAK,CAAC;MAClC,GAAG9B,qCAAqC,CAAC8B,KAAK;IAClD,CAAC;EACL,CAAC,CAAC,CAAC,CAAC;EACJ,OAAOF,GAAG,CAAC,CAAC;AAChB;AACA,SAASD,wBAAwBA,CAACG,KAAK,EAAE;EACrC,KAAK,MAAMG,eAAe,IAAIH,KAAK,CAACI,OAAO,EAAE;IACzC,IAAID,eAAe,CAACE,IAAI,KAAK,OAAO,EAAE;MAClC,OAAO;QAAEC,MAAM,EAAEH,eAAe,CAACI;MAAM,CAAC;IAC5C;EACJ;AACJ","ignoreList":[]}
|
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { FetchedObjectTypeDefinition } from "../../ontology/OntologyProvider.js";
|
|
3
|
-
import type { InterfaceDefRef, UnderlyingOsdkObject } from "./InternalSymbols.js";
|
|
4
|
-
import type { ObjectHolder } from "./ObjectHolder.js";
|
|
5
|
-
export interface InterfaceHolderOwnProps<Q extends FetchedObjectTypeDefinition> {
|
|
6
|
-
[UnderlyingOsdkObject]: Osdk<Q> & ObjectHolder<Q>;
|
|
7
|
-
[InterfaceDefRef]: InterfaceMetadata;
|
|
8
|
-
}
|
|
9
|
-
export interface InterfaceHolder<Q extends FetchedObjectTypeDefinition> extends InterfaceHolderOwnProps<Q> {
|
|
10
|
-
}
|
|
1
|
+
export {};
|
|
11
2
|
//# sourceMappingURL=InterfaceHolder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InterfaceHolder.d.ts","sourceRoot":"","sources":["../../../../src/object/convertWireToOsdkObjects/InterfaceHolder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InterfaceHolder.d.ts","sourceRoot":"","sources":["../../../../src/object/convertWireToOsdkObjects/InterfaceHolder.ts"],"names":[],"mappings":""}
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import type { ObjectOrInterfaceDefinition, OsdkBase } from "@osdk/api";
|
|
2
|
-
export declare const UnderlyingOsdkObject: unique symbol;
|
|
3
|
-
export declare const ObjectDefRef: unique symbol;
|
|
4
|
-
export declare const InterfaceDefRef: unique symbol;
|
|
5
|
-
/** A symbol for getting the raw data object off of the holder an osdk object proxy points to */
|
|
6
|
-
export declare const RawObject: unique symbol;
|
|
7
|
-
export declare const ClientRef: unique symbol;
|
|
8
|
-
export declare const CachedPropertiesRef: unique symbol;
|
|
9
2
|
export interface HolderBase<T extends ObjectOrInterfaceDefinition> {
|
|
10
3
|
[UnderlyingOsdkObject]: OsdkBase<any>;
|
|
11
4
|
[ObjectDefRef]?: T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalSymbols.d.ts","sourceRoot":"","sources":["../../../../src/object/convertWireToOsdkObjects/InternalSymbols.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,2BAA2B,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"InternalSymbols.d.ts","sourceRoot":"","sources":["../../../../src/object/convertWireToOsdkObjects/InternalSymbols.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,2BAA2B,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAiCvE,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,2BAA2B;IAC/D,CAAC,oBAAoB,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC;IACnB,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;CACvB"}
|
|
@@ -13,11 +13,17 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
/** @internal */
|
|
16
17
|
export const UnderlyingOsdkObject = Symbol("Underlying Object");
|
|
18
|
+
/** @internal */
|
|
17
19
|
export const ObjectDefRef = Symbol("ObjectDefinition");
|
|
20
|
+
/** @internal */
|
|
18
21
|
export const InterfaceDefRef = Symbol("InterfaceDefinition");
|
|
19
22
|
/** A symbol for getting the raw data object off of the holder an osdk object proxy points to */
|
|
23
|
+
/** @internal */
|
|
20
24
|
export const RawObject = Symbol("RawObject");
|
|
25
|
+
/** @internal */
|
|
21
26
|
export const ClientRef = Symbol("ClientRef");
|
|
27
|
+
/** @internal */
|
|
22
28
|
export const CachedPropertiesRef = Symbol("CachedProperties");
|
|
23
29
|
//# sourceMappingURL=InternalSymbols.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalSymbols.js","names":["UnderlyingOsdkObject","Symbol","ObjectDefRef","InterfaceDefRef","RawObject","ClientRef","CachedPropertiesRef"],"sources":["InternalSymbols.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 */\nexport const UnderlyingOsdkObject = Symbol(process.env.MODE !== \"production\" ? \"Underlying Object\" : undefined);\nexport const ObjectDefRef = Symbol(process.env.MODE !== \"production\" ? \"ObjectDefinition\" : undefined);\nexport const InterfaceDefRef = Symbol(process.env.MODE !== \"production\" ? \"InterfaceDefinition\" : undefined);\n/** A symbol for getting the raw data object off of the holder an osdk object proxy points to */\nexport const RawObject = Symbol(process.env.MODE !== \"production\" ? \"RawObject\" : undefined);\nexport const ClientRef = Symbol(process.env.MODE !== \"production\" ? \"ClientRef\" : undefined);\nexport const CachedPropertiesRef = Symbol(process.env.MODE !== \"production\" ? \"CachedProperties\" : undefined);\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,oBAAoB,GAAGC,MAAM,CAAqC,mBAA+B,CAAC;AAC/G,OAAO,MAAMC,YAAY,GAAGD,MAAM,CAAqC,kBAA8B,CAAC;AACtG,OAAO,MAAME,eAAe,GAAGF,MAAM,CAAqC,qBAAiC,CAAC;AAC5G;AACA,OAAO,MAAMG,SAAS,GAAGH,MAAM,CAAqC,WAAuB,CAAC;AAC5F,OAAO,MAAMI,SAAS,GAAGJ,MAAM,CAAqC,WAAuB,CAAC;AAC5F,OAAO,MAAMK,mBAAmB,GAAGL,MAAM,CAAqC,kBAA8B,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"InternalSymbols.js","names":["UnderlyingOsdkObject","Symbol","ObjectDefRef","InterfaceDefRef","RawObject","ClientRef","CachedPropertiesRef"],"sources":["InternalSymbols.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 */\n/** @internal */\nexport const UnderlyingOsdkObject = Symbol(process.env.MODE !== \"production\" ? \"Underlying Object\" : undefined);\n/** @internal */\nexport const ObjectDefRef = Symbol(process.env.MODE !== \"production\" ? \"ObjectDefinition\" : undefined);\n/** @internal */\nexport const InterfaceDefRef = Symbol(process.env.MODE !== \"production\" ? \"InterfaceDefinition\" : undefined);\n/** A symbol for getting the raw data object off of the holder an osdk object proxy points to */\n/** @internal */\nexport const RawObject = Symbol(process.env.MODE !== \"production\" ? \"RawObject\" : undefined);\n/** @internal */\nexport const ClientRef = Symbol(process.env.MODE !== \"production\" ? \"ClientRef\" : undefined);\n/** @internal */\nexport const CachedPropertiesRef = Symbol(process.env.MODE !== \"production\" ? \"CachedProperties\" : undefined);\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,oBAAoB,GAAGC,MAAM,CAAqC,mBAA+B,CAAC;AAC/G;AACA,OAAO,MAAMC,YAAY,GAAGD,MAAM,CAAqC,kBAA8B,CAAC;AACtG;AACA,OAAO,MAAME,eAAe,GAAGF,MAAM,CAAqC,qBAAiC,CAAC;AAC5G;AACA;AACA,OAAO,MAAMG,SAAS,GAAGH,MAAM,CAAqC,WAAuB,CAAC;AAC5F;AACA,OAAO,MAAMI,SAAS,GAAGJ,MAAM,CAAqC,WAAuB,CAAC;AAC5F;AACA,OAAO,MAAMK,mBAAmB,GAAGL,MAAM,CAAqC,kBAA8B,CAAC","ignoreList":[]}
|
|
@@ -39,7 +39,7 @@ export async function convertWireToOsdkObjects(client, objects, interfaceApiName
|
|
|
39
39
|
const ret = [];
|
|
40
40
|
for (const rawObj of objects) {
|
|
41
41
|
const objectDef = await client.ontologyProvider.getObjectDefinition(rawObj.$apiName);
|
|
42
|
-
!objectDef ? invariant(false, `Missing definition for '${rawObj.$apiName}'`) : void 0;
|
|
42
|
+
!objectDef ? process.env.NODE_ENV !== "production" ? invariant(false, `Missing definition for '${rawObj.$apiName}'`) : invariant(false) : void 0;
|
|
43
43
|
// default value for when we are checking an object
|
|
44
44
|
let objProps;
|
|
45
45
|
let conforming = true;
|
|
@@ -99,7 +99,7 @@ function reframeAsObjectInPlace(objectDef, interfaceApiName, rawObj) {
|
|
|
99
99
|
function isConforming(client, def, obj, propsToCheck) {
|
|
100
100
|
for (const propName of propsToCheck) {
|
|
101
101
|
if (def.properties[propName].nullable === false && obj[propName] == null) {
|
|
102
|
-
if (process
|
|
102
|
+
if (process.env.NODE_ENV !== "production") {
|
|
103
103
|
client.logger?.debug({
|
|
104
104
|
obj: {
|
|
105
105
|
$objectType: obj["$objectType"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertWireToOsdkObjects.js","names":["invariant","createOsdkObject","convertWireToOsdkObjects","client","objects","interfaceApiName","forceRemoveRid","selectedProps","strictNonNull","logger","debug","fixObjectPropertiesInPlace","ifaceDef","ontologyProvider","getInterfaceDefinition","undefined","ifaceSelected","Object","keys","properties","ret","rawObj","objectDef","getObjectDefinition","$apiName","objProps","conforming","invariantInterfacesAsViews","apiName","isConforming","reframeAsObjectInPlace","convertInterfacePropNamesToObjectPropNames","Error","osdkObject","$as","push","ifacePropsToMap","map","ifaceProp","interfaceMap","newProps","sptProp","regularProp","entries","value","assign","primaryKeyApiName","$primaryKey","def","obj","propsToCheck","propName","nullable","process","env","NODE_ENV","$objectType","warning","warn","console","error","objs","__rid","$rid","__apiName","__primaryKey","$title","__title"],"sources":["convertWireToOsdkObjects.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\";\nimport { createOsdkObject } from \"./convertWireToOsdkObjects/createOsdkObject.js\";\n/**\n * If interfaceApiName is not undefined, converts the instances of the\n * interface into their respective\n * underlying concrete types and then returns the $as() representation\n * for the consumers.\n *\n * Otherwise just does the conversion\n *\n * May mutate in place for performance reasons. If you need a clean copy,\n * keep it first.\n *\n * However, you must use the returned value, which will be whatever is correct.\n *\n * @internal\n * @param interfaceApiName - if undefined\n */\nexport async function convertWireToOsdkObjects(client, objects, interfaceApiName, forceRemoveRid = false, selectedProps, strictNonNull = false) {\n client.logger?.debug(`START convertWireToOsdkObjects()`);\n fixObjectPropertiesInPlace(objects, forceRemoveRid);\n const ifaceDef = interfaceApiName\n ? await client.ontologyProvider.getInterfaceDefinition(interfaceApiName)\n : undefined;\n const ifaceSelected = ifaceDef\n ? (selectedProps ?? Object.keys(ifaceDef.properties))\n : undefined;\n const ret = [];\n for (const rawObj of objects) {\n const objectDef = await client.ontologyProvider.getObjectDefinition(rawObj.$apiName);\n invariant(objectDef, `Missing definition for '${rawObj.$apiName}'`);\n // default value for when we are checking an object\n let objProps;\n let conforming = true;\n if (ifaceDef && ifaceSelected) {\n // API returns interface spt names but we cache by real values\n invariantInterfacesAsViews(objectDef, ifaceDef.apiName, client);\n conforming &&= isConforming(client, ifaceDef, rawObj, ifaceSelected);\n reframeAsObjectInPlace(objectDef, ifaceDef.apiName, rawObj);\n objProps = convertInterfacePropNamesToObjectPropNames(objectDef, ifaceDef.apiName, ifaceSelected);\n }\n else {\n objProps = selectedProps ?? Object.keys(objectDef.properties);\n }\n conforming &&= isConforming(client, objectDef, rawObj, objProps);\n if (strictNonNull === \"throw\" && !conforming) {\n throw new Error(\"Unable to safely convert objects as some non nullable properties are null\");\n }\n else if (strictNonNull === \"drop\" && !conforming) {\n continue;\n }\n let osdkObject = createOsdkObject(client, objectDef, rawObj);\n if (interfaceApiName)\n osdkObject = osdkObject.$as(interfaceApiName);\n ret.push(osdkObject);\n }\n client.logger?.debug(`END convertWireToOsdkObjects()`);\n return ret;\n}\n/**\n * Utility function that lets us take down selected property names from an interface\n * and convert them to an array of property names on an object.\n */\nfunction convertInterfacePropNamesToObjectPropNames(objectDef, interfaceApiName, ifacePropsToMap) {\n return ifacePropsToMap.map((ifaceProp) => objectDef.interfaceMap[interfaceApiName][ifaceProp]);\n}\n/**\n * Takes a raw object from the wire (contextually as an interface) and\n * updates the fields to reflect the underlying objectDef instead\n * @param objectDef\n * @param interfaceApiName\n * @param client\n * @param rawObj\n */\nfunction reframeAsObjectInPlace(objectDef, interfaceApiName, rawObj) {\n const newProps = {};\n for (const [sptProp, regularProp] of Object.entries(objectDef.interfaceMap[interfaceApiName])) {\n if (sptProp in rawObj) {\n const value = rawObj[sptProp];\n delete rawObj[sptProp];\n if (value !== undefined) {\n newProps[regularProp] = value;\n }\n }\n }\n Object.assign(rawObj, newProps);\n if (!(objectDef.primaryKeyApiName in rawObj)) {\n rawObj[objectDef.primaryKeyApiName] = rawObj.$primaryKey;\n }\n}\nfunction isConforming(client, def, obj, propsToCheck) {\n for (const propName of propsToCheck) {\n if (def.properties[propName].nullable === false && obj[propName] == null) {\n if (process?.env?.NODE_ENV !== \"production\") {\n client.logger?.debug({\n obj: {\n $objectType: obj[\"$objectType\"],\n $primaryKey: obj[\"$primaryKey\"],\n },\n }, `Found object that does not conform to its definition. Expected ${def.apiName}'s ${propName} to not be null.`);\n }\n return false;\n }\n }\n return true;\n}\nfunction invariantInterfacesAsViews(objectDef, interfaceApiName, client) {\n if (objectDef.interfaceMap?.[interfaceApiName] == null) {\n const warning = \"Interfaces are only supported 'as views' but your metadata object is missing the correct information. This suggests your interfaces have not been migrated to the newer version yet and you cannot use this version of the SDK.\";\n if (client.logger) {\n client.logger.warn(warning);\n }\n else {\n // eslint-disable-next-line no-console\n console.error(`WARNING! ${warning}`);\n }\n throw new Error(warning);\n }\n}\nfunction fixObjectPropertiesInPlace(objs, forceRemoveRid) {\n for (const obj of objs) {\n if (forceRemoveRid) {\n delete obj.__rid;\n }\n if (obj.__rid) {\n obj.$rid = obj.__rid;\n delete obj.__rid;\n }\n // Backend returns as __apiName but we want to stick to $ structure\n obj.$apiName = obj.__apiName;\n // for now these are the same but when we start doing interface projections the $objectType will always be underlying and\n // the $apiName will be for the current view (in current designs)\n obj.$objectType = obj.__apiName;\n // copying over for now as its always returned. In the future, this should just be inferred from underlying\n obj.$primaryKey = obj.__primaryKey;\n obj.$title = obj.__title;\n // we don't want people to use these\n delete obj.__apiName;\n delete obj.__primaryKey;\n delete obj.__title;\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,SAASC,gBAAgB,QAAQ,gDAAgD;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,wBAAwBA,CAACC,MAAM,EAAEC,OAAO,EAAEC,gBAAgB,EAAEC,cAAc,GAAG,KAAK,EAAEC,aAAa,EAAEC,aAAa,GAAG,KAAK,EAAE;EAC5IL,MAAM,CAACM,MAAM,EAAEC,KAAK,CAAC,kCAAkC,CAAC;EACxDC,0BAA0B,CAACP,OAAO,EAAEE,cAAc,CAAC;EACnD,MAAMM,QAAQ,GAAGP,gBAAgB,GAC3B,MAAMF,MAAM,CAACU,gBAAgB,CAACC,sBAAsB,CAACT,gBAAgB,CAAC,GACtEU,SAAS;EACf,MAAMC,aAAa,GAAGJ,QAAQ,GACvBL,aAAa,IAAIU,MAAM,CAACC,IAAI,CAACN,QAAQ,CAACO,UAAU,CAAC,GAClDJ,SAAS;EACf,MAAMK,GAAG,GAAG,EAAE;EACd,KAAK,MAAMC,MAAM,IAAIjB,OAAO,EAAE;IAC1B,MAAMkB,SAAS,GAAG,MAAMnB,MAAM,CAACU,gBAAgB,CAACU,mBAAmB,CAACF,MAAM,CAACG,QAAQ,CAAC;IACpF,CAAUF,SAAS,GAAnBtB,SA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ACpB,OAAOf,GAAG,CAACgB,YAAY;IACvB,OAAOhB,GAAG,CAACkB,OAAO;EACtB;AACJ","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"convertWireToOsdkObjects.js","names":["invariant","createOsdkObject","convertWireToOsdkObjects","client","objects","interfaceApiName","forceRemoveRid","selectedProps","strictNonNull","logger","debug","fixObjectPropertiesInPlace","ifaceDef","ontologyProvider","getInterfaceDefinition","undefined","ifaceSelected","Object","keys","properties","ret","rawObj","objectDef","getObjectDefinition","$apiName","process","env","NODE_ENV","objProps","conforming","invariantInterfacesAsViews","apiName","isConforming","reframeAsObjectInPlace","convertInterfacePropNamesToObjectPropNames","Error","osdkObject","$as","push","ifacePropsToMap","map","ifaceProp","interfaceMap","newProps","sptProp","regularProp","entries","value","assign","primaryKeyApiName","$primaryKey","def","obj","propsToCheck","propName","nullable","$objectType","warning","warn","console","error","objs","__rid","$rid","__apiName","__primaryKey","$title","__title"],"sources":["convertWireToOsdkObjects.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\";\nimport { createOsdkObject } from \"./convertWireToOsdkObjects/createOsdkObject.js\";\n/**\n * If interfaceApiName is not undefined, converts the instances of the\n * interface into their respective\n * underlying concrete types and then returns the $as() representation\n * for the consumers.\n *\n * Otherwise just does the conversion\n *\n * May mutate in place for performance reasons. If you need a clean copy,\n * keep it first.\n *\n * However, you must use the returned value, which will be whatever is correct.\n *\n * @internal\n * @param interfaceApiName - if undefined\n */\nexport async function convertWireToOsdkObjects(client, objects, interfaceApiName, forceRemoveRid = false, selectedProps, strictNonNull = false) {\n client.logger?.debug(`START convertWireToOsdkObjects()`);\n fixObjectPropertiesInPlace(objects, forceRemoveRid);\n const ifaceDef = interfaceApiName\n ? await client.ontologyProvider.getInterfaceDefinition(interfaceApiName)\n : undefined;\n const ifaceSelected = ifaceDef\n ? (selectedProps ?? Object.keys(ifaceDef.properties))\n : undefined;\n const ret = [];\n for (const rawObj of objects) {\n const objectDef = await client.ontologyProvider.getObjectDefinition(rawObj.$apiName);\n invariant(objectDef, `Missing definition for '${rawObj.$apiName}'`);\n // default value for when we are checking an object\n let objProps;\n let conforming = true;\n if (ifaceDef && ifaceSelected) {\n // API returns interface spt names but we cache by real values\n invariantInterfacesAsViews(objectDef, ifaceDef.apiName, client);\n conforming &&= isConforming(client, ifaceDef, rawObj, ifaceSelected);\n reframeAsObjectInPlace(objectDef, ifaceDef.apiName, rawObj);\n objProps = convertInterfacePropNamesToObjectPropNames(objectDef, ifaceDef.apiName, ifaceSelected);\n }\n else {\n objProps = selectedProps ?? Object.keys(objectDef.properties);\n }\n conforming &&= isConforming(client, objectDef, rawObj, objProps);\n if (strictNonNull === \"throw\" && !conforming) {\n throw new Error(\"Unable to safely convert objects as some non nullable properties are null\");\n }\n else if (strictNonNull === \"drop\" && !conforming) {\n continue;\n }\n let osdkObject = createOsdkObject(client, objectDef, rawObj);\n if (interfaceApiName)\n osdkObject = osdkObject.$as(interfaceApiName);\n ret.push(osdkObject);\n }\n client.logger?.debug(`END convertWireToOsdkObjects()`);\n return ret;\n}\n/**\n * Utility function that lets us take down selected property names from an interface\n * and convert them to an array of property names on an object.\n */\nfunction convertInterfacePropNamesToObjectPropNames(objectDef, interfaceApiName, ifacePropsToMap) {\n return ifacePropsToMap.map((ifaceProp) => objectDef.interfaceMap[interfaceApiName][ifaceProp]);\n}\n/**\n * Takes a raw object from the wire (contextually as an interface) and\n * updates the fields to reflect the underlying objectDef instead\n * @param objectDef\n * @param interfaceApiName\n * @param client\n * @param rawObj\n */\nfunction reframeAsObjectInPlace(objectDef, interfaceApiName, rawObj) {\n const newProps = {};\n for (const [sptProp, regularProp] of Object.entries(objectDef.interfaceMap[interfaceApiName])) {\n if (sptProp in rawObj) {\n const value = rawObj[sptProp];\n delete rawObj[sptProp];\n if (value !== undefined) {\n newProps[regularProp] = value;\n }\n }\n }\n Object.assign(rawObj, newProps);\n if (!(objectDef.primaryKeyApiName in rawObj)) {\n rawObj[objectDef.primaryKeyApiName] = rawObj.$primaryKey;\n }\n}\nfunction isConforming(client, def, obj, propsToCheck) {\n for (const propName of propsToCheck) {\n if (def.properties[propName].nullable === false && obj[propName] == null) {\n if (process.env.NODE_ENV !== \"production\") {\n client.logger?.debug({\n obj: {\n $objectType: obj[\"$objectType\"],\n $primaryKey: obj[\"$primaryKey\"],\n },\n }, `Found object that does not conform to its definition. Expected ${def.apiName}'s ${propName} to not be null.`);\n }\n return false;\n }\n }\n return true;\n}\nfunction invariantInterfacesAsViews(objectDef, interfaceApiName, client) {\n if (objectDef.interfaceMap?.[interfaceApiName] == null) {\n const warning = \"Interfaces are only supported 'as views' but your metadata object is missing the correct information. This suggests your interfaces have not been migrated to the newer version yet and you cannot use this version of the SDK.\";\n if (client.logger) {\n client.logger.warn(warning);\n }\n else {\n // eslint-disable-next-line no-console\n console.error(`WARNING! ${warning}`);\n }\n throw new Error(warning);\n }\n}\nfunction fixObjectPropertiesInPlace(objs, forceRemoveRid) {\n for (const obj of objs) {\n if (forceRemoveRid) {\n delete obj.__rid;\n }\n if (obj.__rid) {\n obj.$rid = obj.__rid;\n delete obj.__rid;\n }\n // Backend returns as __apiName but we want to stick to $ structure\n obj.$apiName = obj.__apiName;\n // for now these are the same but when we start doing interface projections the $objectType will always be underlying and\n // the $apiName will be for the current view (in current designs)\n obj.$objectType = obj.__apiName;\n // copying over for now as its always returned. In the future, this should just be inferred from underlying\n obj.$primaryKey = obj.__primaryKey;\n obj.$title = obj.__title;\n // we don't want people to use these\n delete obj.__apiName;\n delete obj.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O,KAAK;IAChB;EACJ;EACA,OAAO,IAAI;AACf;AACA,SAASxB,0BAA0BA,CAACR,SAAS,EAAEjB,gBAAgB,EAAEF,MAAM,EAAE;EACrE,IAAImB,SAAS,CAACoB,YAAY,GAAGrC,gBAAgB,CAAC,IAAI,IAAI,EAAE;IACpD,MAAMoD,OAAO,GAAG,iOAAiO;IACjP,IAAItD,MAAM,CAACM,MAAM,EAAE;MACfN,MAAM,CAACM,MAAM,CAACiD,IAAI,CAACD,OAAO,CAAC;IAC/B,CAAC,MACI;MACD;MACAE,OAAO,CAACC,KAAK,CAAC,YAAYH,OAAO,EAAE,CAAC;IACxC;IACA,MAAM,IAAItB,KAAK,CAACsB,OAAO,CAAC;EAC5B;AACJ;AACA,SAAS9C,0BAA0BA,CAACkD,IAAI,EAAEvD,cAAc,EAAE;EACtD,KAAK,MAAM8C,GAAG,IAAIS,IAAI,EAAE;IACpB,IAAIvD,cAAc,EAAE;MAChB,OAAO8C,GAAG,CAACU,KAAK;IACpB;IACA,IAAIV,GAAG,CAACU,KAAK,EAAE;MACXV,GAAG,CAACW,IAAI,GAAGX,GAAG,CAACU,KAAK;MACpB,OAAOV,GAAG,CAACU,KAAK;IACpB;IACA;IACAV,GAAG,CAAC5B,QAAQ,GAAG4B,GAAG,CAACY,SAAS;IAC5B;IACA;IACAZ,GAAG,CAACI,WAAW,GAAGJ,GAAG,CAACY,SAAS;IAC/B;IACAZ,GAAG,CAACF,WAAW,GAAGE,GAAG,CAACa,YAAY;IAClCb,GAAG,CAACc,MAAM,GAAGd,GAAG,CAACe,OAAO;IACxB;IACA,OAAOf,GAAG,CAACY,SAAS;IACpB,OAAOZ,GAAG,CAACa,YAAY;IACvB,OAAOb,GAAG,CAACe,OAAO;EACtB;AACJ","ignoreList":[]}
|
|
@@ -127,7 +127,7 @@ export async function fetchObjectPage(client, objectType, args, objectSet) {
|
|
|
127
127
|
excludeRid: !args?.$includeRid
|
|
128
128
|
}));
|
|
129
129
|
return Promise.resolve({
|
|
130
|
-
data: await convertWireToOsdkObjects(client, r.data, undefined, undefined, args.$select
|
|
130
|
+
data: await convertWireToOsdkObjects(client, r.data, undefined, undefined, args.$select),
|
|
131
131
|
nextPageToken: r.nextPageToken,
|
|
132
132
|
totalCount: r.totalCount
|
|
133
133
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchPage.js","names":["OntologiesV2","addUserAgentAndRequestContextHeaders","convertWireToOsdkObjects","augment","type","properties","apiName","objectSetToSearchJsonV2","objectSet","expectedApiName","existingWhere","undefined","objectType","Error","where","value","fetchInterfacePage","client","interfaceType","args","result","OntologyInterfaces","search","ontologyRid","applyFetchArgs","augmentedProperties","$augment","augmentedSharedPropertyTypes","otherInterfaceTypes","selectedObjectTypes","$__EXPERIMENTAL_selectedObjectTypes","selectedSharedPropertyTypes","$select","preview","data","$includeRid","fetchPageInternal","fetchObjectPage","fetchPageWithErrorsInternal","e","error","fetchPage","fetchPageWithErrors","body","$nextPageToken","pageToken","$pageSize","pageSize","$orderBy","orderBy","fields","Object","entries","map","field","direction","r","OntologyObjectSets","load","select","excludeRid","Promise","resolve","$__EXPERIMENTAL_strictNonNull","nextPageToken","totalCount"],"sources":["fetchPage.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 * as OntologiesV2 from \"@osdk/internal.foundry.ontologiesv2\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\nimport { convertWireToOsdkObjects } from \"./convertWireToOsdkObjects.js\";\nexport function augment(type, ...properties) {\n return { [type.apiName]: properties };\n}\n/** @internal */\nexport function objectSetToSearchJsonV2(objectSet, expectedApiName, existingWhere = undefined) {\n if (objectSet.type === \"base\") {\n if (objectSet.objectType !== expectedApiName) {\n throw new Error(`Expected objectSet.objectType to be ${expectedApiName}, but got ${objectSet.objectType}`);\n }\n return existingWhere;\n }\n if (objectSet.type === \"filter\") {\n return objectSetToSearchJsonV2(objectSet.objectSet, expectedApiName, existingWhere == null ? objectSet.where : {\n type: \"and\",\n value: [existingWhere, objectSet.where],\n });\n }\n throw new Error(`Unsupported objectSet type: ${objectSet.type}`);\n}\nasync function fetchInterfacePage(client, interfaceType, args, objectSet) {\n const result = await OntologiesV2.OntologyInterfaces\n .search(addUserAgentAndRequestContextHeaders(client, interfaceType), await client.ontologyRid, interfaceType.apiName, applyFetchArgs(args, {\n augmentedProperties: args.$augment ?? {},\n augmentedSharedPropertyTypes: {},\n otherInterfaceTypes: [],\n selectedObjectTypes: args.$__EXPERIMENTAL_selectedObjectTypes ?? [],\n selectedSharedPropertyTypes: args.$select ?? [],\n where: objectSetToSearchJsonV2(objectSet, interfaceType.apiName),\n }), { preview: true });\n result.data = await convertWireToOsdkObjects(client, result.data, // drop readonly\n interfaceType.apiName, !args.$includeRid);\n return result;\n}\n/** @internal */\nexport async function fetchPageInternal(client, objectType, objectSet, args = {}) {\n if (objectType.type === \"interface\") {\n return await fetchInterfacePage(client, objectType, args, objectSet); // fixme\n }\n else {\n return await fetchObjectPage(client, objectType, args, objectSet); // fixme\n }\n}\n/** @internal */\nexport async function fetchPageWithErrorsInternal(client, objectType, objectSet, args = {}) {\n try {\n const result = await fetchPageInternal(client, objectType, objectSet, args);\n return { value: result };\n }\n catch (e) {\n if (e instanceof Error) {\n return { error: e };\n }\n return { error: e };\n }\n}\n/**\n * @param client\n * @param objectType\n * @param args\n * @param objectSet\n * @returns\n * @internal\n */\nexport async function fetchPage(client, objectType, args, objectSet = {\n type: \"base\",\n objectType: objectType[\"apiName\"],\n}) {\n return fetchPageInternal(client, objectType, objectSet, args);\n}\n/** @internal */\nexport async function fetchPageWithErrors(client, objectType, args, objectSet = {\n type: \"base\",\n objectType: objectType[\"apiName\"],\n}) {\n return fetchPageWithErrorsInternal(client, objectType, objectSet, args);\n}\nfunction applyFetchArgs(args, body) {\n if (args?.$nextPageToken) {\n body.pageToken = args.$nextPageToken;\n }\n if (args?.$pageSize != null) {\n body.pageSize = args.$pageSize;\n }\n if (args?.$orderBy != null) {\n body.orderBy = {\n fields: Object.entries(args.$orderBy).map(([field, direction]) => ({\n field,\n direction,\n })),\n };\n }\n return body;\n}\n/** @internal */\nexport async function fetchObjectPage(client, objectType, args, objectSet) {\n const r = await OntologiesV2.OntologyObjectSets.load(addUserAgentAndRequestContextHeaders(client, objectType), await client.ontologyRid, applyFetchArgs(args, {\n objectSet,\n // We have to do the following case because LoadObjectSetRequestV2 isn't readonly\n select: (args?.$select ?? []), // FIXME?\n excludeRid: !args?.$includeRid,\n }));\n return Promise.resolve({\n data: await convertWireToOsdkObjects(client, r.data, undefined, undefined, args.$select, args.$__EXPERIMENTAL_strictNonNull),\n nextPageToken: r.nextPageToken,\n totalCount: r.totalCount,\n });\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,YAAY,MAAM,qCAAqC;AACnE,SAASC,oCAAoC,QAAQ,iDAAiD;AACtG,SAASC,wBAAwB,QAAQ,+BAA+B;AACxE,OAAO,SAASC,OAAOA,CAACC,IAAI,EAAE,GAAGC,UAAU,EAAE;EACzC,OAAO;IAAE,CAACD,IAAI,CAACE,OAAO,GAAGD;EAAW,CAAC;AACzC;AACA;AACA,OAAO,SAASE,uBAAuBA,CAACC,SAAS,EAAEC,eAAe,EAAEC,aAAa,GAAGC,SAAS,EAAE;EAC3F,IAAIH,SAAS,CAACJ,IAAI,KAAK,MAAM,EAAE;IAC3B,IAAII,SAAS,CAACI,UAAU,KAAK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,OAAO,CAACC,OAAO,CAAC;IACnB5B,IAAI,EAAE,MAAMhC,wBAAwB,CAACe,MAAM,EAAEuC,CAAC,CAACtB,IAAI,EAAEvB,SAAS,EAAEA,SAAS,EAAEQ,IAAI,CAACa,OAAO,EAAEb,IAAI,CAAC4C,6BAA6B,CAAC;IAC5HC,aAAa,EAAER,CAAC,CAACQ,aAAa;IAC9BC,UAAU,EAAET,CAAC,CAACS;EAClB,CAAC,CAAC;AACN","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"fetchPage.js","names":["OntologiesV2","addUserAgentAndRequestContextHeaders","convertWireToOsdkObjects","augment","type","properties","apiName","objectSetToSearchJsonV2","objectSet","expectedApiName","existingWhere","undefined","objectType","Error","where","value","fetchInterfacePage","client","interfaceType","args","result","OntologyInterfaces","search","ontologyRid","applyFetchArgs","augmentedProperties","$augment","augmentedSharedPropertyTypes","otherInterfaceTypes","selectedObjectTypes","$__EXPERIMENTAL_selectedObjectTypes","selectedSharedPropertyTypes","$select","preview","data","$includeRid","fetchPageInternal","fetchObjectPage","fetchPageWithErrorsInternal","e","error","fetchPage","fetchPageWithErrors","body","$nextPageToken","pageToken","$pageSize","pageSize","$orderBy","orderBy","fields","Object","entries","map","field","direction","r","OntologyObjectSets","load","select","excludeRid","Promise","resolve","nextPageToken","totalCount"],"sources":["fetchPage.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 * as OntologiesV2 from \"@osdk/internal.foundry.ontologiesv2\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\nimport { convertWireToOsdkObjects } from \"./convertWireToOsdkObjects.js\";\nexport function augment(type, ...properties) {\n return { [type.apiName]: properties };\n}\n/** @internal */\nexport function objectSetToSearchJsonV2(objectSet, expectedApiName, existingWhere = undefined) {\n if (objectSet.type === \"base\") {\n if (objectSet.objectType !== expectedApiName) {\n throw new Error(`Expected objectSet.objectType to be ${expectedApiName}, but got ${objectSet.objectType}`);\n }\n return existingWhere;\n }\n if (objectSet.type === \"filter\") {\n return objectSetToSearchJsonV2(objectSet.objectSet, expectedApiName, existingWhere == null ? objectSet.where : {\n type: \"and\",\n value: [existingWhere, objectSet.where],\n });\n }\n throw new Error(`Unsupported objectSet type: ${objectSet.type}`);\n}\nasync function fetchInterfacePage(client, interfaceType, args, objectSet) {\n const result = await OntologiesV2.OntologyInterfaces\n .search(addUserAgentAndRequestContextHeaders(client, interfaceType), await client.ontologyRid, interfaceType.apiName, applyFetchArgs(args, {\n augmentedProperties: args.$augment ?? {},\n augmentedSharedPropertyTypes: {},\n otherInterfaceTypes: [],\n selectedObjectTypes: args.$__EXPERIMENTAL_selectedObjectTypes ?? [],\n selectedSharedPropertyTypes: args.$select ?? [],\n where: objectSetToSearchJsonV2(objectSet, interfaceType.apiName),\n }), { preview: true });\n result.data = await convertWireToOsdkObjects(client, result.data, // drop readonly\n interfaceType.apiName, !args.$includeRid);\n return result;\n}\n/** @internal */\nexport async function fetchPageInternal(client, objectType, objectSet, args = {}) {\n if (objectType.type === \"interface\") {\n return await fetchInterfacePage(client, objectType, args, objectSet); // fixme\n }\n else {\n return await fetchObjectPage(client, objectType, args, objectSet); // fixme\n }\n}\n/** @internal */\nexport async function fetchPageWithErrorsInternal(client, objectType, objectSet, args = {}) {\n try {\n const result = await fetchPageInternal(client, objectType, objectSet, args);\n return { value: result };\n }\n catch (e) {\n if (e instanceof Error) {\n return { error: e };\n }\n return { error: e };\n }\n}\n/**\n * @param client\n * @param objectType\n * @param args\n * @param objectSet\n * @returns\n * @internal\n */\nexport async function fetchPage(client, objectType, args, objectSet = {\n type: \"base\",\n objectType: objectType[\"apiName\"],\n}) {\n return fetchPageInternal(client, objectType, objectSet, args);\n}\n/** @internal */\nexport async function fetchPageWithErrors(client, objectType, args, objectSet = {\n type: \"base\",\n objectType: objectType[\"apiName\"],\n}) {\n return fetchPageWithErrorsInternal(client, objectType, objectSet, args);\n}\nfunction applyFetchArgs(args, body) {\n if (args?.$nextPageToken) {\n body.pageToken = args.$nextPageToken;\n }\n if (args?.$pageSize != null) {\n body.pageSize = args.$pageSize;\n }\n if (args?.$orderBy != null) {\n body.orderBy = {\n fields: Object.entries(args.$orderBy).map(([field, direction]) => ({\n field,\n direction,\n })),\n };\n }\n return body;\n}\n/** @internal */\nexport async function fetchObjectPage(client, objectType, args, objectSet) {\n const r = await OntologiesV2.OntologyObjectSets.load(addUserAgentAndRequestContextHeaders(client, objectType), await client.ontologyRid, applyFetchArgs(args, {\n objectSet,\n // We have to do the following case because LoadObjectSetRequestV2 isn't readonly\n select: (args?.$select ?? []), // FIXME?\n excludeRid: !args?.$includeRid,\n }));\n return Promise.resolve({\n data: await convertWireToOsdkObjects(client, r.data, undefined, undefined, args.$select),\n nextPageToken: r.nextPageToken,\n totalCount: r.totalCount,\n });\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,YAAY,MAAM,qCAAqC;AACnE,SAASC,oCAAoC,QAAQ,iDAAiD;AACtG,SAASC,wBAAwB,QAAQ,+BAA+B;AACxE,OAAO,SAASC,OAAOA,CAACC,IAAI,EAAE,GAAGC,UAAU,EAAE;EACzC,OAAO;IAAE,CAACD,IAAI,CAACE,OAAO,GAAGD;EAAW,CAAC;AACzC;AACA;AACA,OAAO,SAASE,uBAAuBA,CAACC,SAAS,EAAEC,eAAe,EAAEC,aAAa,GAAGC,SAAS,EAAE;EAC3F,IAAIH,SAAS,CAACJ,IAAI,KAAK,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AI,EAAEgB;EACvB,CAAC,CAAC,CAAC;EACH,OAAO0B,OAAO,CAACC,OAAO,CAAC;IACnB5B,IAAI,EAAE,MAAMhC,wBAAwB,CAACe,MAAM,EAAEuC,CAAC,CAACtB,IAAI,EAAEvB,SAAS,EAAEA,SAAS,EAAEQ,IAAI,CAACa,OAAO,CAAC;IACxF+B,aAAa,EAAEP,CAAC,CAACO,aAAa;IAC9BC,UAAU,EAAER,CAAC,CAACQ;EAClB,CAAC,CAAC;AACN","ignoreList":[]}
|
|
@@ -193,33 +193,45 @@ describe("ObjectSet", () => {
|
|
|
193
193
|
}
|
|
194
194
|
});
|
|
195
195
|
describe.each(["fetchPage", "fetchPageWithErrors"])("%s", k => {
|
|
196
|
-
describe("strictNonNull: \"drop\"", () => {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
196
|
+
// describe("strictNonNull: \"drop\"", () => {
|
|
197
|
+
// describe("includeRid: true", () => {
|
|
198
|
+
// it("drops bad data", async () => {
|
|
199
|
+
// const opts = {
|
|
200
|
+
// $__EXPERIMENTAL_strictNonNull: "drop",
|
|
201
|
+
// $includeRid: true,
|
|
202
|
+
// } as const;
|
|
203
|
+
// const result = k === "fetchPage"
|
|
204
|
+
// ? await client(Employee).fetchPage(opts)
|
|
205
|
+
// : (await client(Employee).fetchPageWithErrors(opts)).value!;
|
|
206
|
+
// expect(result.data).toHaveLength(3);
|
|
207
|
+
// expectTypeOf(result.data[0]).branded.toEqualTypeOf<
|
|
208
|
+
// Osdk<Employee, "$rid" | "$all">
|
|
209
|
+
// >();
|
|
210
|
+
// expectTypeOf(result.data[0]).branded.toEqualTypeOf<
|
|
211
|
+
// Employee.OsdkObject<"$rid">
|
|
212
|
+
// >();
|
|
213
|
+
// });
|
|
214
|
+
// });
|
|
215
|
+
// describe("includeRid: false", () => {
|
|
216
|
+
// it("drops bad data", async () => {
|
|
217
|
+
// const opts = {
|
|
218
|
+
// $__EXPERIMENTAL_strictNonNull: "drop",
|
|
219
|
+
// $includeRid: false,
|
|
220
|
+
// } as const;
|
|
221
|
+
// const result = k === "fetchPage"
|
|
222
|
+
// ? await client(Employee).fetchPage(opts)
|
|
223
|
+
// : (await client(Employee).fetchPageWithErrors(opts)).value!;
|
|
224
|
+
// expect(result.data).toHaveLength(3);
|
|
225
|
+
// expectTypeOf(result.data[0]).branded.toEqualTypeOf<Osdk<Employee>>();
|
|
226
|
+
// expectTypeOf(result.data[0]).branded.toEqualTypeOf<
|
|
227
|
+
// Employee.OsdkObject
|
|
228
|
+
// >();
|
|
229
|
+
// expectTypeOf(result.data[0]).branded.toEqualTypeOf<
|
|
230
|
+
// Employee.OsdkObject<never>
|
|
231
|
+
// >();
|
|
232
|
+
// });
|
|
233
|
+
// });
|
|
234
|
+
// });
|
|
223
235
|
describe("strictNonNull: false", () => {
|
|
224
236
|
describe("includeRid: true", () => {
|
|
225
237
|
it("returns bad data", async () => {
|
|
@@ -235,8 +247,7 @@ describe("ObjectSet", () => {
|
|
|
235
247
|
describe("includeRid: false", () => {
|
|
236
248
|
it("returns bad data", async () => {
|
|
237
249
|
const opts = {
|
|
238
|
-
$
|
|
239
|
-
includeRid: false
|
|
250
|
+
$includeRid: false
|
|
240
251
|
};
|
|
241
252
|
const result = k === "fetchPage" ? await client(Employee).fetchPage(opts) : (await client(Employee).fetchPageWithErrors(opts)).value;
|
|
242
253
|
expect(result.data).toHaveLength(4);
|
|
@@ -245,17 +256,11 @@ describe("ObjectSet", () => {
|
|
|
245
256
|
});
|
|
246
257
|
});
|
|
247
258
|
});
|
|
248
|
-
describe("strictNonNull: \"throw\"", () => {
|
|
249
|
-
it("throws when getting bad data", () => {
|
|
250
|
-
expect(() => client(Employee).fetchPage({
|
|
251
|
-
$__EXPERIMENTAL_strictNonNull: "throw"
|
|
252
|
-
})).rejects.toThrowErrorMatchingInlineSnapshot(`[Error: Unable to safely convert objects as some non nullable properties are null]`);
|
|
253
|
-
});
|
|
254
|
-
});
|
|
255
259
|
describe.each(["fetchOne", "fetchOneWithErrors"])("%s", k => {
|
|
256
260
|
describe("strictNonNull: false", () => {
|
|
257
261
|
describe("includeRid: true", () => {
|
|
258
262
|
it("returns bad data", async () => {
|
|
263
|
+
// Look at this
|
|
259
264
|
const opts = {
|
|
260
265
|
$__EXPERIMENTAL_strictNonNull: false,
|
|
261
266
|
$includeRid: true
|
|
@@ -269,7 +274,7 @@ describe("ObjectSet", () => {
|
|
|
269
274
|
it("returns bad data", async () => {
|
|
270
275
|
const opts = {
|
|
271
276
|
$__EXPERIMENTAL_strictNonNull: false,
|
|
272
|
-
includeRid: false
|
|
277
|
+
$includeRid: false
|
|
273
278
|
};
|
|
274
279
|
const result = k === "fetchOne" ? await client(Employee).fetchOne(50033, opts) : (await client(Employee).fetchOneWithErrors(50033, opts)).value;
|
|
275
280
|
expect(result).not.toBeUndefined();
|
|
@@ -278,19 +283,10 @@ describe("ObjectSet", () => {
|
|
|
278
283
|
});
|
|
279
284
|
});
|
|
280
285
|
});
|
|
281
|
-
describe("strictNonNull: \"throw\"", () => {
|
|
282
|
-
it("throws when getting bad data", () => {
|
|
283
|
-
expect(() => client(Employee).fetchPage({
|
|
284
|
-
$__EXPERIMENTAL_strictNonNull: "throw"
|
|
285
|
-
})).rejects.toThrowErrorMatchingInlineSnapshot(`[Error: Unable to safely convert objects as some non nullable properties are null]`);
|
|
286
|
-
});
|
|
287
|
-
});
|
|
288
286
|
describe("conversions", () => {
|
|
289
287
|
describe("strictNonNull: false", () => {
|
|
290
288
|
it("returns bad data", async () => {
|
|
291
|
-
const result = await client(Employee).fetchPage({
|
|
292
|
-
$__EXPERIMENTAL_strictNonNull: false
|
|
293
|
-
});
|
|
289
|
+
const result = await client(Employee).fetchPage({});
|
|
294
290
|
const empNotStrict = result.data[0];
|
|
295
291
|
expectTypeOf(empNotStrict).branded.toEqualTypeOf();
|
|
296
292
|
expectTypeOf(empNotStrict).branded.toEqualTypeOf();
|