@osdk/client 2.2.0-beta.16 → 2.2.0-beta.17
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 +24 -0
- package/build/browser/MinimalClientContext.js.map +1 -1
- package/build/browser/actions/actions.test.js +18 -2
- package/build/browser/actions/actions.test.js.map +1 -1
- package/build/browser/createClient.js.map +1 -1
- package/build/browser/createMinimalClient.js.map +1 -1
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.js +36 -13
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.test.js +133 -0
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -1
- package/build/browser/derivedProperties/derivedPropertyDefinitionFactory.js +94 -0
- package/build/browser/derivedProperties/derivedPropertyDefinitionFactory.js.map +1 -0
- package/build/browser/index.js.map +1 -1
- package/build/browser/intellisense.test.helpers/showsObjectPropertyJsdoc.js +25 -0
- package/build/browser/intellisense.test.helpers/showsObjectPropertyJsdoc.js.map +1 -0
- package/build/browser/intellisense.test.js +12 -0
- package/build/browser/intellisense.test.js.map +1 -1
- package/build/browser/logger/BaseLogger.js.map +1 -1
- package/build/browser/logger/BrowserLogger.js.map +1 -1
- package/build/browser/logger/MinimalLogger.js.map +1 -1
- package/build/browser/logger/TestLogger.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/BaseHolder.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/getDollarLink.js.map +1 -1
- package/build/browser/objectSet/ObjectSet.test.js +1 -6
- package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js +4 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
- package/build/browser/objectSet/createObjectSet.js +1 -1
- package/build/browser/objectSet/createObjectSet.js.map +1 -1
- package/build/browser/observable/internal/BulkObjectLoader.js.map +1 -1
- package/build/browser/observable/internal/ListQuery.js.map +1 -1
- package/build/browser/observable/internal/Query.js.map +1 -1
- package/build/browser/observable/internal/Store.js.map +1 -1
- package/build/browser/observable/internal/testUtils.js +2 -2
- package/build/browser/observable/internal/testUtils.js.map +1 -1
- package/build/browser/queries/applyQuery.js.map +1 -1
- package/build/browser/queries/queries.test.js.map +1 -1
- package/build/browser/tsserver.js.map +1 -1
- package/build/browser/util/UserAgent.js +1 -1
- package/build/browser/util/isPoint.js +20 -0
- package/build/browser/util/isPoint.js.map +1 -0
- package/build/browser/util/toDataValue.js +4 -0
- package/build/browser/util/toDataValue.js.map +1 -1
- package/build/cjs/{chunk-6KYD7ZWT.cjs → chunk-33GHS3X4.cjs} +141 -44
- package/build/cjs/chunk-33GHS3X4.cjs.map +1 -0
- package/build/cjs/{chunk-KAJABLKV.cjs → chunk-37QC7LR3.cjs} +14 -14
- package/build/cjs/{chunk-KAJABLKV.cjs.map → chunk-37QC7LR3.cjs.map} +1 -1
- package/build/cjs/index.cjs +55 -47
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +3 -4
- package/build/cjs/public/internal.cjs +8 -8
- package/build/cjs/public/internal.d.cts +10 -11
- package/build/cjs/public/unstable-do-not-use.cjs +8 -8
- package/build/esm/MinimalClientContext.js.map +1 -1
- package/build/esm/actions/actions.test.js +18 -2
- package/build/esm/actions/actions.test.js.map +1 -1
- package/build/esm/createClient.js.map +1 -1
- package/build/esm/createMinimalClient.js.map +1 -1
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.js +36 -13
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.test.js +133 -0
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -1
- package/build/esm/derivedProperties/derivedPropertyDefinitionFactory.js +94 -0
- package/build/esm/derivedProperties/derivedPropertyDefinitionFactory.js.map +1 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/intellisense.test.helpers/showsObjectPropertyJsdoc.js +25 -0
- package/build/esm/intellisense.test.helpers/showsObjectPropertyJsdoc.js.map +1 -0
- package/build/esm/intellisense.test.js +12 -0
- package/build/esm/intellisense.test.js.map +1 -1
- package/build/esm/logger/BaseLogger.js.map +1 -1
- package/build/esm/logger/BrowserLogger.js.map +1 -1
- package/build/esm/logger/MinimalLogger.js.map +1 -1
- package/build/esm/logger/TestLogger.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/BaseHolder.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/getDollarLink.js.map +1 -1
- package/build/esm/objectSet/ObjectSet.test.js +1 -6
- package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js +4 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
- package/build/esm/objectSet/createObjectSet.js +1 -1
- package/build/esm/objectSet/createObjectSet.js.map +1 -1
- package/build/esm/observable/internal/BulkObjectLoader.js.map +1 -1
- package/build/esm/observable/internal/ListQuery.js.map +1 -1
- package/build/esm/observable/internal/Query.js.map +1 -1
- package/build/esm/observable/internal/Store.js.map +1 -1
- package/build/esm/observable/internal/testUtils.js +2 -2
- package/build/esm/observable/internal/testUtils.js.map +1 -1
- package/build/esm/queries/applyQuery.js.map +1 -1
- package/build/esm/queries/queries.test.js.map +1 -1
- package/build/esm/tsserver.js.map +1 -1
- package/build/esm/util/UserAgent.js +1 -1
- package/build/esm/util/isPoint.js +20 -0
- package/build/esm/util/isPoint.js.map +1 -0
- package/build/esm/util/toDataValue.js +4 -0
- package/build/esm/util/toDataValue.js.map +1 -1
- package/build/types/MinimalClientContext.d.ts +1 -1
- package/build/types/MinimalClientContext.d.ts.map +1 -1
- package/build/types/createClient.d.ts +1 -1
- package/build/types/createClient.d.ts.map +1 -1
- package/build/types/derivedProperties/derivedPropertyDefinitionFactory.d.ts +1 -0
- package/build/types/derivedProperties/derivedPropertyDefinitionFactory.d.ts.map +1 -0
- package/build/types/index.d.ts +1 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/intellisense.test.helpers/showsObjectPropertyJsdoc.d.ts +1 -0
- package/build/types/intellisense.test.helpers/showsObjectPropertyJsdoc.d.ts.map +1 -0
- package/build/types/logger/BaseLogger.d.ts +7 -8
- package/build/types/logger/BaseLogger.d.ts.map +1 -1
- package/build/types/logger/BrowserLogger.d.ts +1 -2
- package/build/types/logger/BrowserLogger.d.ts.map +1 -1
- package/build/types/logger/MinimalLogger.d.ts +2 -2
- package/build/types/logger/MinimalLogger.d.ts.map +1 -1
- package/build/types/logger/TestLogger.d.ts +2 -2
- package/build/types/logger/TestLogger.d.ts.map +1 -1
- package/build/types/observable/internal/BulkObjectLoader.d.ts.map +1 -1
- package/build/types/observable/internal/ListQuery.d.ts.map +1 -1
- package/build/types/observable/internal/Query.d.ts +1 -1
- package/build/types/observable/internal/Query.d.ts.map +1 -1
- package/build/types/observable/internal/Store.d.ts.map +1 -1
- package/build/types/observable/internal/testUtils.d.ts +1 -2
- package/build/types/observable/internal/testUtils.d.ts.map +1 -1
- package/build/types/queries/applyQuery.d.ts +4 -2
- package/build/types/queries/applyQuery.d.ts.map +1 -1
- package/build/types/tsserver.d.ts +1 -1
- package/build/types/tsserver.d.ts.map +1 -1
- package/build/types/util/isPoint.d.ts +1 -0
- package/build/types/util/isPoint.d.ts.map +1 -0
- package/package.json +9 -9
- package/build/browser/logger/Logger.js +0 -2
- package/build/browser/logger/Logger.js.map +0 -1
- package/build/cjs/Logger-a5UcHtrk.d.cts +0 -19
- package/build/cjs/chunk-6KYD7ZWT.cjs.map +0 -1
- package/build/esm/logger/Logger.js +0 -2
- package/build/esm/logger/Logger.js.map +0 -1
- package/build/types/logger/Logger.d.ts +0 -17
- package/build/types/logger/Logger.d.ts.map +0 -1
|
@@ -44,6 +44,22 @@ describe(createWithPropertiesObjectSet, () => {
|
|
|
44
44
|
}
|
|
45
45
|
`);
|
|
46
46
|
});
|
|
47
|
+
it("correctly allows select property off the base object set", () => {
|
|
48
|
+
const map = new Map();
|
|
49
|
+
const deriveObjectSet = createWithPropertiesObjectSet(Employee, {
|
|
50
|
+
type: "methodInput"
|
|
51
|
+
}, map, true);
|
|
52
|
+
const result = {
|
|
53
|
+
"derivedPropertyName": base => base.selectProperty("employeeId")
|
|
54
|
+
}["derivedPropertyName"](deriveObjectSet);
|
|
55
|
+
const definition = map.get(result);
|
|
56
|
+
expect(definition).toMatchInlineSnapshot(`
|
|
57
|
+
{
|
|
58
|
+
"apiName": "employeeId",
|
|
59
|
+
"type": "property",
|
|
60
|
+
}
|
|
61
|
+
`);
|
|
62
|
+
});
|
|
47
63
|
it("correctly handles multiple definitions in one clause", () => {
|
|
48
64
|
const map = new Map();
|
|
49
65
|
const deriveObjectSet = createWithPropertiesObjectSet(Employee, {
|
|
@@ -96,5 +112,122 @@ describe(createWithPropertiesObjectSet, () => {
|
|
|
96
112
|
}
|
|
97
113
|
`);
|
|
98
114
|
});
|
|
115
|
+
describe("expressions", () => {
|
|
116
|
+
it("can handle expressions referencing other property keys", () => {
|
|
117
|
+
const map = new Map();
|
|
118
|
+
const deriveObjectSet = createWithPropertiesObjectSet(Employee, {
|
|
119
|
+
type: "methodInput"
|
|
120
|
+
}, map, true);
|
|
121
|
+
const result = {
|
|
122
|
+
"derivedPropertyName": base => base.pivotTo("lead").selectProperty("employeeId").add(base.selectProperty("employeeId"))
|
|
123
|
+
// "secondaryDerivedPropertyName": (base) =>
|
|
124
|
+
// base.pivotTo("lead").aggregate("employeeId:avg").divide("employeeId", 2),
|
|
125
|
+
}["derivedPropertyName"](deriveObjectSet);
|
|
126
|
+
const definition = map.get(result);
|
|
127
|
+
expect(definition).toMatchInlineSnapshot(`
|
|
128
|
+
{
|
|
129
|
+
"properties": [
|
|
130
|
+
{
|
|
131
|
+
"objectSet": {
|
|
132
|
+
"link": "lead",
|
|
133
|
+
"objectSet": {
|
|
134
|
+
"type": "methodInput",
|
|
135
|
+
},
|
|
136
|
+
"type": "searchAround",
|
|
137
|
+
},
|
|
138
|
+
"operation": {
|
|
139
|
+
"selectedPropertyApiName": "employeeId",
|
|
140
|
+
"type": "get",
|
|
141
|
+
},
|
|
142
|
+
"type": "selection",
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"apiName": "employeeId",
|
|
146
|
+
"type": "property",
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
"type": "add",
|
|
150
|
+
}
|
|
151
|
+
`);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
// TODO: Add test for literal
|
|
155
|
+
it("can handle nested definitions in an expression", () => {
|
|
156
|
+
const map = new Map();
|
|
157
|
+
const deriveObjectSet = createWithPropertiesObjectSet(Employee, {
|
|
158
|
+
type: "methodInput"
|
|
159
|
+
}, map);
|
|
160
|
+
const result = {
|
|
161
|
+
"derivedPropertyName": base => base.pivotTo("lead").selectProperty("employeeId").add(base.pivotTo("lead").selectProperty("employeeId"))
|
|
162
|
+
}["derivedPropertyName"](deriveObjectSet);
|
|
163
|
+
const definition = map.get(result);
|
|
164
|
+
expect(definition).toMatchInlineSnapshot(`
|
|
165
|
+
{
|
|
166
|
+
"properties": [
|
|
167
|
+
{
|
|
168
|
+
"objectSet": {
|
|
169
|
+
"link": "lead",
|
|
170
|
+
"objectSet": {
|
|
171
|
+
"type": "methodInput",
|
|
172
|
+
},
|
|
173
|
+
"type": "searchAround",
|
|
174
|
+
},
|
|
175
|
+
"operation": {
|
|
176
|
+
"selectedPropertyApiName": "employeeId",
|
|
177
|
+
"type": "get",
|
|
178
|
+
},
|
|
179
|
+
"type": "selection",
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"objectSet": {
|
|
183
|
+
"link": "lead",
|
|
184
|
+
"objectSet": {
|
|
185
|
+
"type": "methodInput",
|
|
186
|
+
},
|
|
187
|
+
"type": "searchAround",
|
|
188
|
+
},
|
|
189
|
+
"operation": {
|
|
190
|
+
"selectedPropertyApiName": "employeeId",
|
|
191
|
+
"type": "get",
|
|
192
|
+
},
|
|
193
|
+
"type": "selection",
|
|
194
|
+
},
|
|
195
|
+
],
|
|
196
|
+
"type": "add",
|
|
197
|
+
}
|
|
198
|
+
`);
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
it("handles datetime expressions", () => {
|
|
202
|
+
const map = new Map();
|
|
203
|
+
const deriveObjectSet = createWithPropertiesObjectSet(Employee, {
|
|
204
|
+
type: "methodInput"
|
|
205
|
+
}, map);
|
|
206
|
+
const result = {
|
|
207
|
+
"derivedPropertyName": base => base.pivotTo("lead").selectProperty("startDate").extractPart("MONTHS"),
|
|
208
|
+
"secondaryDerivedPropertyName": base => base.pivotTo("lead").selectProperty("startDate").min(base.pivotTo("lead").selectProperty("startDate"))
|
|
209
|
+
}["derivedPropertyName"](deriveObjectSet);
|
|
210
|
+
const definition = map.get(result);
|
|
211
|
+
expect(definition).toMatchInlineSnapshot(`
|
|
212
|
+
{
|
|
213
|
+
"part": "MONTHS",
|
|
214
|
+
"property": {
|
|
215
|
+
"objectSet": {
|
|
216
|
+
"link": "lead",
|
|
217
|
+
"objectSet": {
|
|
218
|
+
"type": "methodInput",
|
|
219
|
+
},
|
|
220
|
+
"type": "searchAround",
|
|
221
|
+
},
|
|
222
|
+
"operation": {
|
|
223
|
+
"selectedPropertyApiName": "startDate",
|
|
224
|
+
"type": "get",
|
|
225
|
+
},
|
|
226
|
+
"type": "selection",
|
|
227
|
+
},
|
|
228
|
+
"type": "extract",
|
|
229
|
+
}
|
|
230
|
+
`);
|
|
231
|
+
});
|
|
99
232
|
});
|
|
100
233
|
//# sourceMappingURL=createWithPropertiesObjectSet.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createWithPropertiesObjectSet.test.js","names":["Employee","describe","expect","it","createWithPropertiesObjectSet","map","Map","deriveObjectSet","type","result","base","pivotTo","selectProperty","definition","get","toMatchInlineSnapshot","clause","aggregate","percentile","limit","secondResult","secondDefinition"],"sources":["createWithPropertiesObjectSet.test.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { DerivedProperty } from \"@osdk/api\";\nimport { Employee } from \"@osdk/client.test.ontology\";\nimport type { DerivedPropertyDefinition } from \"@osdk/foundry.ontologies\";\nimport { describe, expect, it } from \"vitest\";\nimport { createWithPropertiesObjectSet } from \"./createWithPropertiesObjectSet.js\";\n\ndescribe(createWithPropertiesObjectSet, () => {\n it(\"correctly creates basic object set with derived properties\", () => {\n const map = new Map<any, DerivedPropertyDefinition>();\n const deriveObjectSet = createWithPropertiesObjectSet(Employee, {\n type: \"methodInput\",\n }, map);\n\n const clause = {\n \"derivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").selectProperty(\"employeeId\"),\n } satisfies DerivedProperty.Clause<Employee>;\n\n const result = clause[\"derivedPropertyName\"](deriveObjectSet);\n const definition = map.get(result);\n expect(definition).toMatchInlineSnapshot(`\n {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"selectedPropertyApiName\": \"employeeId\",\n \"type\": \"get\",\n },\n \"type\": \"selection\",\n }\n `);\n });\n\n it(\"correctly handles multiple definitions in one clause\", () => {\n const map = new Map<any, DerivedPropertyDefinition>();\n const deriveObjectSet = createWithPropertiesObjectSet(Employee, {\n type: \"methodInput\",\n }, map);\n\n const clause: DerivedProperty.Clause<Employee> = {\n \"derivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"employeeId:approximatePercentile\", {\n percentile: 0.5,\n }),\n\n \"secondaryDerivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"fullName:collectSet\", {\n limit: 10,\n }),\n };\n\n const result = clause[\"derivedPropertyName\"](deriveObjectSet);\n const definition = map.get(result);\n\n const secondResult = clause[\"secondaryDerivedPropertyName\"](\n deriveObjectSet,\n );\n const secondDefinition = map.get(secondResult);\n\n expect(definition).toMatchInlineSnapshot(`\n {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"approximatePercentile\": 0.5,\n \"selectedPropertyApiName\": \"employeeId\",\n \"type\": \"approximatePercentile\",\n },\n \"type\": \"selection\",\n }\n `);\n\n expect(secondDefinition).toMatchInlineSnapshot(`\n {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"limit\": 10,\n \"selectedPropertyApiName\": \"fullName\",\n \"type\": \"collectSet\",\n },\n \"type\": \"selection\",\n }\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,QAAQ,QAAQ,4BAA4B;AAErD,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,6BAA6B,QAAQ,oCAAoC;AAElFH,QAAQ,CAACG,6BAA6B,EAAE,MAAM;EAC5CD,EAAE,CAAC,4DAA4D,EAAE,MAAM;IACrE,MAAME,GAAG,GAAG,IAAIC,GAAG,CAAiC,CAAC;IACrD,MAAMC,eAAe,GAAGH,6BAA6B,CAACJ,QAAQ,EAAE;MAC9DQ,IAAI,EAAE;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CAAC,CAACE,qBAAqB,CAAC;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC;IAEJb,MAAM,CAACmB,gBAAgB,CAAC,CAACN,qBAAqB,CAAC;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC;EACN,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"createWithPropertiesObjectSet.test.js","names":["Employee","describe","expect","it","createWithPropertiesObjectSet","map","Map","deriveObjectSet","type","result","base","pivotTo","selectProperty","definition","get","toMatchInlineSnapshot","clause","aggregate","percentile","limit","secondResult","secondDefinition","add","extractPart","min"],"sources":["createWithPropertiesObjectSet.test.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { DerivedProperty } from \"@osdk/api\";\nimport { Employee } from \"@osdk/client.test.ontology\";\nimport type { DerivedPropertyDefinition } from \"@osdk/foundry.ontologies\";\nimport { describe, expect, it } from \"vitest\";\nimport { createWithPropertiesObjectSet } from \"./createWithPropertiesObjectSet.js\";\n\ndescribe(createWithPropertiesObjectSet, () => {\n it(\"correctly creates basic object set with derived properties\", () => {\n const map = new Map<any, DerivedPropertyDefinition>();\n const deriveObjectSet = createWithPropertiesObjectSet(Employee, {\n type: \"methodInput\",\n }, map);\n\n const clause = {\n \"derivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").selectProperty(\"employeeId\"),\n } satisfies DerivedProperty.Clause<Employee>;\n\n const result = clause[\"derivedPropertyName\"](deriveObjectSet);\n const definition = map.get(result);\n expect(definition).toMatchInlineSnapshot(`\n {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"selectedPropertyApiName\": \"employeeId\",\n \"type\": \"get\",\n },\n \"type\": \"selection\",\n }\n `);\n });\n\n it(\"correctly allows select property off the base object set\", () => {\n const map = new Map<any, DerivedPropertyDefinition>();\n const deriveObjectSet = createWithPropertiesObjectSet(\n Employee,\n {\n type: \"methodInput\",\n },\n map,\n true,\n );\n\n const clause = {\n \"derivedPropertyName\": (base) => base.selectProperty(\"employeeId\"),\n } satisfies DerivedProperty.Clause<Employee>;\n\n const result = clause[\"derivedPropertyName\"](deriveObjectSet);\n const definition = map.get(result);\n expect(definition).toMatchInlineSnapshot(`\n {\n \"apiName\": \"employeeId\",\n \"type\": \"property\",\n }\n `);\n });\n\n it(\"correctly handles multiple definitions in one clause\", () => {\n const map = new Map<any, DerivedPropertyDefinition>();\n const deriveObjectSet = createWithPropertiesObjectSet(Employee, {\n type: \"methodInput\",\n }, map);\n\n const clause: DerivedProperty.Clause<Employee> = {\n \"derivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"employeeId:approximatePercentile\", {\n percentile: 0.5,\n }),\n\n \"secondaryDerivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"fullName:collectSet\", {\n limit: 10,\n }),\n };\n\n const result = clause[\"derivedPropertyName\"](deriveObjectSet);\n const definition = map.get(result);\n\n const secondResult = clause[\"secondaryDerivedPropertyName\"](\n deriveObjectSet,\n );\n const secondDefinition = map.get(secondResult);\n\n expect(definition).toMatchInlineSnapshot(`\n {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"approximatePercentile\": 0.5,\n \"selectedPropertyApiName\": \"employeeId\",\n \"type\": \"approximatePercentile\",\n },\n \"type\": \"selection\",\n }\n `);\n\n expect(secondDefinition).toMatchInlineSnapshot(`\n {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"limit\": 10,\n \"selectedPropertyApiName\": \"fullName\",\n \"type\": \"collectSet\",\n },\n \"type\": \"selection\",\n }\n `);\n });\n\n describe(\"expressions\", () => {\n it(\"can handle expressions referencing other property keys\", () => {\n const map = new Map<any, DerivedPropertyDefinition>();\n const deriveObjectSet = createWithPropertiesObjectSet(\n Employee,\n {\n type: \"methodInput\",\n },\n map,\n true,\n );\n\n const clause: DerivedProperty.Clause<Employee> = {\n \"derivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").selectProperty(\"employeeId\").add(\n base.selectProperty(\"employeeId\"),\n ),\n // \"secondaryDerivedPropertyName\": (base) =>\n // base.pivotTo(\"lead\").aggregate(\"employeeId:avg\").divide(\"employeeId\", 2),\n };\n\n const result = clause[\"derivedPropertyName\"](deriveObjectSet);\n const definition = map.get(result);\n\n expect(definition).toMatchInlineSnapshot(`\n {\n \"properties\": [\n {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"selectedPropertyApiName\": \"employeeId\",\n \"type\": \"get\",\n },\n \"type\": \"selection\",\n },\n {\n \"apiName\": \"employeeId\",\n \"type\": \"property\",\n },\n ],\n \"type\": \"add\",\n }\n `);\n });\n\n // TODO: Add test for literal\n it(\"can handle nested definitions in an expression\", () => {\n const map = new Map<any, DerivedPropertyDefinition>();\n const deriveObjectSet = createWithPropertiesObjectSet(Employee, {\n type: \"methodInput\",\n }, map);\n\n const clause: DerivedProperty.Clause<Employee> = {\n \"derivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").selectProperty(\"employeeId\").add(\n base.pivotTo(\"lead\").selectProperty(\"employeeId\"),\n ),\n };\n\n const result = clause[\"derivedPropertyName\"](deriveObjectSet);\n const definition = map.get(result);\n\n expect(definition).toMatchInlineSnapshot(`\n {\n \"properties\": [\n {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"selectedPropertyApiName\": \"employeeId\",\n \"type\": \"get\",\n },\n \"type\": \"selection\",\n },\n {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"selectedPropertyApiName\": \"employeeId\",\n \"type\": \"get\",\n },\n \"type\": \"selection\",\n },\n ],\n \"type\": \"add\",\n }\n `);\n });\n });\n\n it(\"handles datetime expressions\", () => {\n const map = new Map<any, DerivedPropertyDefinition>();\n const deriveObjectSet = createWithPropertiesObjectSet(Employee, {\n type: \"methodInput\",\n }, map);\n\n const clause: DerivedProperty.Clause<Employee> = {\n \"derivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").selectProperty(\"startDate\").extractPart(\"MONTHS\"),\n \"secondaryDerivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").selectProperty(\"startDate\").min(\n base.pivotTo(\"lead\").selectProperty(\"startDate\"),\n ),\n };\n\n const result = clause[\"derivedPropertyName\"](deriveObjectSet);\n const definition = map.get(result);\n\n expect(definition).toMatchInlineSnapshot(`\n {\n \"part\": \"MONTHS\",\n \"property\": {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"selectedPropertyApiName\": \"startDate\",\n \"type\": \"get\",\n },\n \"type\": \"selection\",\n },\n \"type\": \"extract\",\n }\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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CAAC,CAACE,qBAAqB,CAAC;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;EAEFZ,EAAE,CAAC,8BAA8B,EAAE,MAAM;IACvC,MAAME,GAAG,GAAG,IAAIC,GAAG,CAAiC,CAAC;IACrD,MAAMC,eAAe,GAAGH,6BAA6B,CAACJ,QAAQ,EAAE;MAC9DQ,IAAI,EAAE;IACR,CAAC,EAAEH,GAAG,CAAC;IAWP,MAAMI,MAAM,GATqC;MAC/C,qBAAqB,EAAGC,IAAI,IAC1BA,IAAI,CAACC,OAAO,CAAC,MAAM,CAAC,CAACC,cAAc,CAAC,WAAW,CAAC,CAACW,WAAW,CAAC,QAAQ,CAAC;MACxE,8BAA8B,EAAGb,IAAI,IACnCA,IAAI,CAACC,OAAO,CAAC,MAAM,CAAC,CAACC,cAAc,CAAC,WAAW,CAAC,CAACY,GAAG,CAClDd,IAAI,CAACC,OAAO,CAAC,MAAM,CAAC,CAACC,cAAc,CAAC,WAAW,CACjD;IACJ,CAAC,CAEqB,qBAAqB,CAAC,CAACL,eAAe,CAAC;IAC7D,MAAMM,UAAU,GAAGR,GAAG,CAACS,GAAG,CAACL,MAAM,CAAC;IAElCP,MAAM,CAACW,UAAU,CAAC,CAACE,qBAAqB,CAAC;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import invariant from "tiny-invariant";
|
|
18
|
+
|
|
19
|
+
/** @internal */
|
|
20
|
+
export function derivedPropertyDefinitionFactory(wireDefinition, definitionMap) {
|
|
21
|
+
const definition = {
|
|
22
|
+
abs() {
|
|
23
|
+
return derivedPropertyDefinitionFactory({
|
|
24
|
+
type: "absoluteValue",
|
|
25
|
+
property: wireDefinition
|
|
26
|
+
}, definitionMap);
|
|
27
|
+
},
|
|
28
|
+
negate() {
|
|
29
|
+
return derivedPropertyDefinitionFactory({
|
|
30
|
+
type: "negate",
|
|
31
|
+
property: wireDefinition
|
|
32
|
+
}, definitionMap);
|
|
33
|
+
},
|
|
34
|
+
max(value) {
|
|
35
|
+
return derivedPropertyDefinitionFactory({
|
|
36
|
+
type: "greatest",
|
|
37
|
+
properties: [wireDefinition, getDefinitionFromMap(value, definitionMap)]
|
|
38
|
+
}, definitionMap);
|
|
39
|
+
},
|
|
40
|
+
min(value) {
|
|
41
|
+
return derivedPropertyDefinitionFactory({
|
|
42
|
+
type: "least",
|
|
43
|
+
properties: [wireDefinition, getDefinitionFromMap(value, definitionMap)]
|
|
44
|
+
}, definitionMap);
|
|
45
|
+
},
|
|
46
|
+
add(value) {
|
|
47
|
+
return derivedPropertyDefinitionFactory({
|
|
48
|
+
type: "add",
|
|
49
|
+
properties: [wireDefinition, getDefinitionFromMap(value, definitionMap)]
|
|
50
|
+
}, definitionMap);
|
|
51
|
+
},
|
|
52
|
+
subtract(value) {
|
|
53
|
+
return derivedPropertyDefinitionFactory({
|
|
54
|
+
"type": "subtract",
|
|
55
|
+
"left": wireDefinition,
|
|
56
|
+
"right": getDefinitionFromMap(value, definitionMap)
|
|
57
|
+
}, definitionMap);
|
|
58
|
+
},
|
|
59
|
+
multiply(value) {
|
|
60
|
+
return derivedPropertyDefinitionFactory({
|
|
61
|
+
type: "multiply",
|
|
62
|
+
properties: [wireDefinition, getDefinitionFromMap(value, definitionMap)]
|
|
63
|
+
}, definitionMap);
|
|
64
|
+
},
|
|
65
|
+
divide(value) {
|
|
66
|
+
return derivedPropertyDefinitionFactory({
|
|
67
|
+
"type": "subtract",
|
|
68
|
+
"left": wireDefinition,
|
|
69
|
+
"right": getDefinitionFromMap(value, definitionMap)
|
|
70
|
+
}, definitionMap);
|
|
71
|
+
},
|
|
72
|
+
extractPart: part => {
|
|
73
|
+
return derivedPropertyDefinitionFactory({
|
|
74
|
+
type: "extract",
|
|
75
|
+
part,
|
|
76
|
+
property: wireDefinition
|
|
77
|
+
}, definitionMap);
|
|
78
|
+
},
|
|
79
|
+
type: {}
|
|
80
|
+
};
|
|
81
|
+
definitionMap.set(definition, wireDefinition);
|
|
82
|
+
return definition;
|
|
83
|
+
}
|
|
84
|
+
const getDefinitionFromMap = (arg, definitionMap) => {
|
|
85
|
+
if (typeof arg === "object") {
|
|
86
|
+
const definition = definitionMap.get(arg);
|
|
87
|
+
!definition ? process.env.NODE_ENV !== "production" ? invariant(false, "Derived Property is not defined") : invariant(false) : void 0;
|
|
88
|
+
return definition;
|
|
89
|
+
} else if (typeof arg === "number") {
|
|
90
|
+
process.env.NODE_ENV !== "production" ? invariant(false, "Literals for derived properties are not yet supported") : invariant(false);
|
|
91
|
+
}
|
|
92
|
+
process.env.NODE_ENV !== "production" ? invariant(false, "Invalid argument type for a derived property") : invariant(false);
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=derivedPropertyDefinitionFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derivedPropertyDefinitionFactory.js","names":["invariant","derivedPropertyDefinitionFactory","wireDefinition","definitionMap","definition","abs","type","property","negate","max","value","properties","getDefinitionFromMap","min","add","subtract","multiply","divide","extractPart","part","set","arg","get","process","env","NODE_ENV"],"sources":["derivedPropertyDefinitionFactory.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { DerivedProperty } from \"@osdk/api\";\nimport type { DerivedPropertyDefinition } from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\n\n/** @internal */\nexport function derivedPropertyDefinitionFactory(\n wireDefinition: DerivedPropertyDefinition,\n definitionMap: Map<any, DerivedPropertyDefinition>,\n): DerivedProperty.NumericPropertyDefinition<any, any> & {\n extractPart: DerivedProperty.DatetimePropertyDefinition<\n any,\n any\n >[\"extractPart\"];\n} {\n const definition: DerivedProperty.NumericPropertyDefinition<any, any> & {\n extractPart: DerivedProperty.DatetimePropertyDefinition<\n any,\n any\n >[\"extractPart\"];\n } = {\n abs() {\n return derivedPropertyDefinitionFactory({\n type: \"absoluteValue\",\n property: wireDefinition,\n }, definitionMap);\n },\n negate() {\n return derivedPropertyDefinitionFactory({\n type: \"negate\",\n property: wireDefinition,\n }, definitionMap);\n },\n max(value) {\n return derivedPropertyDefinitionFactory({\n type: \"greatest\",\n properties: [\n wireDefinition,\n getDefinitionFromMap(value, definitionMap),\n ],\n }, definitionMap);\n },\n min(value) {\n return derivedPropertyDefinitionFactory({\n type: \"least\",\n properties: [\n wireDefinition,\n getDefinitionFromMap(value, definitionMap),\n ],\n }, definitionMap);\n },\n add(\n value,\n ) {\n return derivedPropertyDefinitionFactory({\n type: \"add\",\n properties: [\n wireDefinition,\n getDefinitionFromMap(value, definitionMap),\n ],\n }, definitionMap);\n },\n subtract(\n value,\n ) {\n return derivedPropertyDefinitionFactory({\n \"type\": \"subtract\",\n \"left\": wireDefinition,\n \"right\": getDefinitionFromMap(value, definitionMap),\n }, definitionMap);\n },\n multiply(\n value,\n ) {\n return derivedPropertyDefinitionFactory({\n type: \"multiply\",\n properties: [\n wireDefinition,\n getDefinitionFromMap(value, definitionMap),\n ],\n }, definitionMap);\n },\n divide(\n value,\n ) {\n return derivedPropertyDefinitionFactory({\n \"type\": \"subtract\",\n \"left\": wireDefinition,\n \"right\": getDefinitionFromMap(value, definitionMap),\n }, definitionMap);\n },\n extractPart: (part) => {\n return derivedPropertyDefinitionFactory({\n type: \"extract\",\n part,\n property: wireDefinition,\n }, definitionMap);\n },\n type: {},\n };\n\n definitionMap.set(definition, wireDefinition);\n return definition;\n}\n\nconst getDefinitionFromMap = (\n arg: string | number | DerivedProperty.Definition<any, any>,\n definitionMap: Map<any, DerivedPropertyDefinition>,\n): DerivedPropertyDefinition => {\n if (typeof arg === \"object\") {\n const definition = definitionMap.get(arg);\n invariant(definition, \"Derived Property is not defined\");\n return definition;\n } else if (typeof arg === \"number\") {\n invariant(false, \"Literals for derived properties are not yet supported\");\n }\n invariant(false, \"Invalid argument type for a derived property\");\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAOA,SAAS,MAAM,gBAAgB;;AAEtC;AACA,OAAO,SAASC,gCAAgCA,CAC9CC,cAAyC,EACzCC,aAAkD,EAMlD;EACA,MAAMC,UAKL,GAAG;IACFC,GAAGA,CAAA,EAAG;MACJ,OAAOJ,gCAAgC,CAAC;QACtCK,IAAI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AAC;IACDc,MAAMA,CACJP,KAAK,EACL;MACA,OAAOT,gCAAgC,CAAC;QACtC,MAAM,EAAE,UAAU;QAClB,MAAM,EAAEC,cAAc;QACtB,OAAO,EAAEU,oBAAoB,CAACF,KAAK,EAAEP,aAAa;MACpD,CAAC,EAAEA,aAAa,CAAC;IACnB,CAAC;IACDe,WAAW,EAAGC,IAAI,IAAK;MACrB,OAAOlB,gCAAgC,CAAC;QACtCK,IAAI,EAAE,SAAS;QACfa,IAAI;QACJZ,QAAQ,EAAEL;MACZ,CAAC,EAAEC,aAAa,CAAC;IACnB,CAAC;IACDG,IAAI,EAAE,CAAC;EACT,CAAC;EAEDH,aAAa,CAACiB,GAAG,CAAChB,UAAU,EAAEF,cAAc,CAAC;EAC7C,OAAOE,UAAU;AACnB;AAEA,MAAMQ,oBAAoB,GAAGA,CAC3BS,GAA2D,EAC3DlB,aAAkD,KACpB;EAC9B,IAAI,OAAOkB,GAAG,KAAK,QAAQ,EAAE;IAC3B,MAAMjB,UAAU,GAAGD,aAAa,CAACmB,GAAG,CAACD,GAAG,CAAC;IACzC,CAAUjB,UAAU,GAAAmB,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAApBzB,SAAS,QAAa,iCAAiC,IAAvDA,SAAS;IACT,OAAOI,UAAU;EACnB,CAAC,MAAM,IAAI,OAAOiB,GAAG,KAAK,QAAQ,EAAE;IAClCE,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAAzB,SAAS,QAAQ,uDAAuD,IAAxEA,SAAS;EACX;EACAuB,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAAzB,SAAS,QAAQ,8CAA8C,IAA/DA,SAAS;AACX,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["isOk","PalantirApiError","ActionValidationError","createClient","createPlatformClient","createAttachmentUpload","createObjectSpecifierFromPrimaryKey","extractDate","extractDateInLocalTime","extractDateInUTC"],"sources":["index.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type {\n ActionDefinition,\n ActionEditResponse,\n ActionMetadata,\n ActionParam,\n ActionReturnTypeForOptions,\n ActionValidationResponse,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n InterfaceDefinition,\n ObjectMetadata,\n ObjectSet,\n ObjectSpecifier,\n ObjectTypeDefinition,\n Osdk,\n OsdkObject,\n PageResult,\n PropertyDef,\n PropertyKeys,\n PropertyValueWireToClient,\n QueryDefinition,\n QueryParam,\n QueryResult,\n Result,\n SingleLinkAccessor,\n VersionBound,\n WhereClause,\n} from \"@osdk/api\";\nexport { isOk } from \"@osdk/api\";\nexport { PalantirApiError } from \"@osdk/shared.net.errors\";\n\nexport { ActionValidationError } from \"./actions/ActionValidationError.js\";\nexport type { Client } from \"./Client.js\";\nexport { createClient } from \"./createClient.js\";\nexport { createPlatformClient } from \"./createPlatformClient.js\";\nexport type { PlatformClient } from \"./createPlatformClient.js\";\nexport
|
|
1
|
+
{"version":3,"file":"index.js","names":["isOk","PalantirApiError","ActionValidationError","createClient","createPlatformClient","createAttachmentUpload","createObjectSpecifierFromPrimaryKey","extractDate","extractDateInLocalTime","extractDateInUTC"],"sources":["index.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type {\n ActionDefinition,\n ActionEditResponse,\n ActionMetadata,\n ActionParam,\n ActionReturnTypeForOptions,\n ActionValidationResponse,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n Attachment,\n CompileTimeMetadata,\n InterfaceDefinition,\n Logger,\n ObjectMetadata,\n ObjectSet,\n ObjectSpecifier,\n ObjectTypeDefinition,\n Osdk,\n OsdkObject,\n OsdkObjectPropertyType,\n PageResult,\n PropertyDef,\n PropertyKeys,\n PropertyValueWireToClient,\n QueryDefinition,\n QueryParam,\n QueryResult,\n Range,\n Result,\n SingleLinkAccessor,\n ThreeDimensionalAggregation,\n TwoDimensionalAggregation,\n VersionBound,\n WhereClause,\n} from \"@osdk/api\";\nexport { isOk } from \"@osdk/api\";\nexport { PalantirApiError } from \"@osdk/shared.net.errors\";\n\nexport { ActionValidationError } from \"./actions/ActionValidationError.js\";\nexport type { Client } from \"./Client.js\";\nexport { createClient } from \"./createClient.js\";\nexport { createPlatformClient } from \"./createPlatformClient.js\";\nexport type { PlatformClient } from \"./createPlatformClient.js\";\nexport { createAttachmentUpload } from \"./object/AttachmentUpload.js\";\nexport type { ResultOrError } from \"./ResultOrError.js\";\nexport {\n createObjectSpecifierFromPrimaryKey,\n} from \"./util/objectSpecifierUtils.js\";\n\nexport {\n extractDate,\n extractDateInLocalTime,\n extractDateInUTC,\n} from \"./util/datetimeConverters.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAqCA,SAASA,IAAI,QAAQ,WAAW;AAChC,SAASC,gBAAgB,QAAQ,yBAAyB;AAE1D,SAASC,qBAAqB,QAAQ,oCAAoC;AAE1E,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,oBAAoB,QAAQ,2BAA2B;AAEhE,SAASC,sBAAsB,QAAQ,8BAA8B;AAErE,SACEC,mCAAmC,QAC9B,gCAAgC;AAEvC,SACEC,WAAW,EACXC,sBAAsB,EACtBC,gBAAgB,QACX,8BAA8B","ignoreList":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
// WARNING!
|
|
18
|
+
// WARNING!
|
|
19
|
+
// This file is used for tests that check intellisense. Editing this file by hand will likely
|
|
20
|
+
// break tests that have hard coded line numbers and line offsets.
|
|
21
|
+
|
|
22
|
+
const employee = {};
|
|
23
|
+
employee.employeeLocation;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=showsObjectPropertyJsdoc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"showsObjectPropertyJsdoc.js","names":["employee","employeeLocation"],"sources":["showsObjectPropertyJsdoc.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// WARNING!\n// WARNING!\n// This file is used for tests that check intellisense. Editing this file by hand will likely\n// break tests that have hard coded line numbers and line offsets.\n\nimport type { Osdk } from \"@osdk/api\";\nimport type { Employee } from \"@osdk/client.test.ontology\";\n\nconst employee: Osdk.Instance<Employee> = {} as any;\nemployee.employeeLocation;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAKA,MAAMA,QAAiC,GAAG,CAAC,CAAQ;AACnDA,QAAQ,CAACC,gBAAgB;AAAC","ignoreList":[]}
|
|
@@ -89,5 +89,17 @@ describe("intellisense", () => {
|
|
|
89
89
|
});
|
|
90
90
|
expect(resp.body?.documentation).toMatchInlineSnapshot(`"(no ontology metadata)"`);
|
|
91
91
|
});
|
|
92
|
+
it("showsObjectPropertyJsdoc", {
|
|
93
|
+
timeout: 40_000
|
|
94
|
+
}, async () => {
|
|
95
|
+
const {
|
|
96
|
+
resp
|
|
97
|
+
} = await tsServer.sendQuickInfoRequest({
|
|
98
|
+
file: intellisenseFilePath,
|
|
99
|
+
line: 26,
|
|
100
|
+
offset: 13
|
|
101
|
+
});
|
|
102
|
+
expect(resp.body?.documentation).toMatchInlineSnapshot(`"description: Geotime series reference of the location of the employee"`);
|
|
103
|
+
});
|
|
92
104
|
});
|
|
93
105
|
//# sourceMappingURL=intellisense.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intellisense.test.js","names":["findUpSync","path","invariant","ts","afterEach","beforeAll","beforeEach","describe","expect","it","vi","startTsServer","rootLogger","hoisted","pino","pinoPretty","EventEmitter","Promise","resolve","level","build","sync","timestampKey","undefined","errorLikeObjectKeys","errorProps","ignore","destination","write","a","at","slice","console","log","packagesDir","clientPackagePath","clientsPackageJson","cwd","import","meta","dirname","process","env","NODE_ENV","join","tsServer","intellisenseFilePath","task","name","sys","fileExists","toBeTruthy","sendOpenRequest","file","stop","timeout","resp","sendQuickInfoRequest","line","offset","body","documentation","toMatchInlineSnapshot"],"sources":["intellisense.test.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { findUpSync } from \"find-up\";\nimport * as path from \"node:path\";\nimport invariant from \"tiny-invariant\";\nimport * as ts from \"typescript\";\nimport {\n afterEach,\n beforeAll,\n beforeEach,\n describe,\n expect,\n it,\n vi,\n} from \"vitest\";\nimport type {
|
|
1
|
+
{"version":3,"file":"intellisense.test.js","names":["findUpSync","path","invariant","ts","afterEach","beforeAll","beforeEach","describe","expect","it","vi","startTsServer","rootLogger","hoisted","pino","pinoPretty","EventEmitter","Promise","resolve","level","build","sync","timestampKey","undefined","errorLikeObjectKeys","errorProps","ignore","destination","write","a","at","slice","console","log","packagesDir","clientPackagePath","clientsPackageJson","cwd","import","meta","dirname","process","env","NODE_ENV","join","tsServer","intellisenseFilePath","task","name","sys","fileExists","toBeTruthy","sendOpenRequest","file","stop","timeout","resp","sendQuickInfoRequest","line","offset","body","documentation","toMatchInlineSnapshot"],"sources":["intellisense.test.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Logger } from \"@osdk/api\";\nimport { findUpSync } from \"find-up\";\nimport * as path from \"node:path\";\nimport invariant from \"tiny-invariant\";\nimport * as ts from \"typescript\";\nimport {\n afterEach,\n beforeAll,\n beforeEach,\n describe,\n expect,\n it,\n vi,\n} from \"vitest\";\nimport type { TsServer } from \"./tsserver.js\";\nimport { startTsServer } from \"./tsserver.js\";\n\n// it needs to be hoisted because its referenced from our mocked WebSocket\n// which must be hoisted to work\nconst rootLogger = await vi.hoisted(async (): Promise<Logger> => {\n const pino = (await import(\"pino\")).pino;\n const pinoPretty = await import(\"pino-pretty\");\n const { EventEmitter } = await import(\"node:events\");\n class PinoConsoleLogDestination extends EventEmitter {\n write(a: string) {\n // remove trailing newline since console.log adds one\n if (a.at(-1) === \"\\n\") a = a.slice(0, -1);\n\n // This lets the test framework aggregate the logs per test, whereas direct to stdout does not\n console.log(a);\n }\n }\n return Promise.resolve(pino(\n { level: \"info\" },\n (pinoPretty.build)({\n sync: true,\n timestampKey: undefined,\n errorLikeObjectKeys: [\"error\", \"err\", \"exception\"],\n errorProps: \"stack,cause,properties\",\n ignore: \"time,hostname,pid\",\n destination: new PinoConsoleLogDestination(),\n }),\n ));\n});\n\ndescribe(\"intellisense\", () => {\n let packagesDir: string;\n let clientPackagePath: string;\n\n beforeAll(() => {\n const clientsPackageJson = findUpSync(\"package.json\", {\n cwd: import.meta.dirname,\n });\n console.log({ clientsPackageJson });\n invariant(clientsPackageJson != null);\n packagesDir = path.join(\n path.dirname(clientsPackageJson),\n \"..\",\n );\n\n clientPackagePath = path.join(packagesDir, \"client\");\n });\n\n let tsServer: TsServer;\n let intellisenseFilePath: string;\n\n beforeEach(async (a) => {\n intellisenseFilePath = path.join(\n clientPackagePath,\n \"src\",\n \"intellisense.test.helpers\",\n `${a.task.name}.ts`,\n );\n\n console.log(intellisenseFilePath);\n\n expect(ts.sys.fileExists(intellisenseFilePath)).toBeTruthy();\n\n tsServer = await startTsServer(rootLogger);\n await tsServer.sendOpenRequest({ file: intellisenseFilePath });\n });\n\n afterEach(async () => {\n tsServer.stop();\n tsServer = undefined as any;\n });\n\n it(\"callsQueryAcceptsObject\", { timeout: 40_000 }, async () => {\n const { resp } = await tsServer.sendQuickInfoRequest({\n file: intellisenseFilePath,\n line: 27,\n offset: 6,\n });\n expect(resp.body?.documentation).toMatchInlineSnapshot(\n `\"(no ontology metadata)\"`,\n );\n });\n\n it(\"showsObjectPropertyJsdoc\", { timeout: 40_000 }, async () => {\n const { resp } = await tsServer.sendQuickInfoRequest({\n file: intellisenseFilePath,\n line: 26,\n offset: 13,\n });\n expect(resp.body?.documentation).toMatchInlineSnapshot(\n `\"description: Geotime series reference of the location of the employee\"`,\n );\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,UAAU,QAAQ,SAAS;AACpC,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,OAAOC,SAAS,MAAM,gBAAgB;AACtC,OAAO,KAAKC,EAAE,MAAM,YAAY;AAChC,SACEC,SAAS,EACTC,SAAS,EACTC,UAAU,EACVC,QAAQ,EACRC,MAAM,EACNC,EAAE,EACFC,EAAE,QACG,QAAQ;AAEf,SAASC,aAAa,QAAQ,eAAe;;AAE7C;AACA;AACA,MAAMC,UAAU,GAAG,MAAMF,EAAE,CAACG,OAAO,CAAC,YAA6B;EAC/D,MAAMC,IAAI,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,EAAEA,IAAI;EACxC,MAAMC,UAAU,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC;EAC9C,MAAM;IAAEC;EAAa,CAAC,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC;EAUpD,OAAOC,OAAO,CAACC,OAAO,CAACJ,IAAI,CACzB;IAAEK,KAAK,EA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qBAAqB,CACpD,yEACF,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseLogger.js","names":["noop","levels","trace","debug","info","warn","error","fatal","BaseLogger","factory","constructor","bindings","options","k","level","isLevelEnabled","createLogMethod","child","msgPrefix","filter","x","join","ourLevel"],"sources":["BaseLogger.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Logger } from \"@osdk/api\";\
|
|
1
|
+
{"version":3,"file":"BaseLogger.js","names":["noop","levels","trace","debug","info","warn","error","fatal","BaseLogger","factory","constructor","bindings","options","k","level","isLevelEnabled","createLogMethod","child","msgPrefix","filter","x","join","ourLevel"],"sources":["BaseLogger.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Logger } from \"@osdk/api\";\n\nexport function noop(): any {\n}\n\ninterface LoggerConstructor {\n new(\n bindings: Record<string, any>,\n options?: { level?: string; msgPrefix?: string },\n ): Logger;\n}\n\nconst levels = {\n trace: 10,\n debug: 20,\n info: 30,\n warn: 40,\n error: 50,\n fatal: 60,\n};\n\nexport abstract class BaseLogger implements Logger {\n protected bindings: Record<string, any>;\n protected options: { level?: string; msgPrefix?: string } | undefined;\n #factory: LoggerConstructor;\n\n constructor(\n bindings: Record<string, any>,\n options: { level?: string; msgPrefix?: string } = {},\n factory: LoggerConstructor,\n ) {\n this.bindings = bindings;\n this.options = options;\n this.#factory = factory;\n\n for (\n const k of [\"trace\", \"debug\", \"info\", \"warn\", \"error\", \"fatal\"] as const\n ) {\n if (this.options?.level && !this.isLevelEnabled(k)) {\n continue;\n }\n this[k] = this.createLogMethod(k, bindings);\n }\n }\n\n protected abstract createLogMethod(\n name: \"trace\" | \"debug\" | \"info\" | \"warn\" | \"error\" | \"fatal\",\n bindings: Record<string, any>,\n ): Logger.LogFn;\n\n trace: Logger.LogFn = noop;\n debug: Logger.LogFn = noop;\n warn: Logger.LogFn = noop;\n info: Logger.LogFn = noop;\n error: Logger.LogFn = noop;\n fatal: Logger.LogFn = noop;\n\n child(\n bindings: Record<string, any>,\n options?: { level?: string; msgPrefix?: string },\n ): Logger {\n return new this.#factory({\n ...this.bindings,\n ...bindings,\n }, {\n level: (options ?? this.options)?.level,\n msgPrefix: [this.options?.msgPrefix, options?.msgPrefix].filter(x => x)\n .join(\" \"),\n });\n }\n\n isLevelEnabled(level: string): boolean {\n const ourLevel = (this.options?.level ?? \"info\") as keyof typeof levels;\n\n return level in levels && ourLevel in levels\n && levels[level as keyof typeof levels] >= levels[ourLevel];\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAO,SAASA,IAAIA,CAAA,EAAQ,CAC5B;AASA,MAAMC,MAAM,GAAG;EACbC,KAAK,EAAE,EAAE;EACTC,KAAK,EAAE,EAAE;EACTC,IAAI,EAAE,EAAE;EACRC,IAAI,EAAE,EAAE;EACRC,KAAK,EAAE,EAAE;EACTC,KAAK,EAAE;AACT,CAAC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AAEE,KAAK,IAAI,MAA8B;IAEvE,OAAOA,KAAK,IAAIb,MAAM,IAAIqB,QAAQ,IAAIrB,MAAM,IACvCA,MAAM,CAACa,KAAK,CAAwB,IAAIb,MAAM,CAACqB,QAAQ,CAAC;EAC/D;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserLogger.js","names":["BaseLogger","createStyle","color","levelStyles","debug","error","fatal","info","trace","warn","BrowserLogger","constructor","bindings","options","level","createLogMethod","name","msgs","styles","msgPrefix","push","methodName","args","console","join"],"sources":["BrowserLogger.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Logger } from \"@osdk/api\";\nimport { BaseLogger } from \"./BaseLogger.js\";\
|
|
1
|
+
{"version":3,"file":"BrowserLogger.js","names":["BaseLogger","createStyle","color","levelStyles","debug","error","fatal","info","trace","warn","BrowserLogger","constructor","bindings","options","level","createLogMethod","name","msgs","styles","msgPrefix","push","methodName","args","console","join"],"sources":["BrowserLogger.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Logger } from \"@osdk/api\";\nimport { BaseLogger } from \"./BaseLogger.js\";\nfunction createStyle({ color }: { color: string }) {\n return `color: ${color}; border: 1px solid ${color}; padding: 2px; border-radius: 3px;`;\n}\n\nconst levelStyles = {\n debug: createStyle({\n color: \"LightBlue\",\n }),\n error: createStyle({\n color: \"red\",\n }),\n fatal: createStyle({\n color: \"red\",\n }),\n info: createStyle({\n color: \"green\",\n }),\n trace: createStyle({\n color: \"gray\",\n }),\n warn: createStyle({\n color: \"orange\",\n }),\n};\n\nexport class BrowserLogger extends BaseLogger implements Logger {\n constructor(\n bindings: Record<string, any> = {},\n options: { level?: string; msgPrefix?: string } = {},\n ) {\n super(\n bindings,\n { ...options, level: options.level ?? \"error\" },\n BrowserLogger,\n );\n }\n\n protected createLogMethod(\n name: \"trace\" | \"debug\" | \"info\" | \"warn\" | \"error\" | \"fatal\",\n bindings: Record<string, any>,\n ): Logger.LogFn {\n const msgs: string[] = [`%c${name}%c`];\n const styles: string[] = [levelStyles[name], \"\"];\n\n if (this.options?.msgPrefix) {\n msgs.push(`%c${this.options.msgPrefix}%c`);\n styles.push(\n \"font-style: italic; color: gray\",\n \"\",\n );\n }\n\n if (typeof bindings === \"object\" && \"methodName\" in bindings) {\n msgs.push(`%c.${bindings.methodName}()%c`);\n styles.push(\n \"font-style: italic;color: orchid\",\n \"\",\n );\n }\n\n return (...args: any[]): any => {\n // eslint-disable-next-line no-console\n console[name === \"fatal\" ? \"error\" : name](\n msgs.join(\" \"),\n ...styles,\n ...args,\n );\n };\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,UAAU,QAAQ,iBAAiB;AAC5C,SAASC,WAAWA,CAAC;EAAEC;AAAyB,CAAC,EAAE;EACjD,OAAO,UAAUA,KAAK,uBAAuBA,KAAK,qCAAqC;AACzF;AAEA,MAAMC,WAAW,GAAG;EAClBC,KAAK,EAAEH,WAAW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,CAAC,GAAGE,IAAW,KAAU;MAC9B;MACAC,OAAO,CAACP,IAAI,KAAK,OAAO,GAAG,OAAO,GAAGA,IAAI,CAAC,CACxCC,IAAI,CAACO,IAAI,CAAC,GAAG,CAAC,EACd,GAAGN,MAAM,EACT,GAAGI,IACL,CAAC;IACH,CAAC;EACH;AACF","ignoreList":[0]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MinimalLogger.js","names":["BaseLogger","MinimalLogger","constructor","bindings","options","level","createLogMethod","name","msgs","msgPrefix","push","methodName","args","console","join"],"sources":["MinimalLogger.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {
|
|
1
|
+
{"version":3,"file":"MinimalLogger.js","names":["BaseLogger","MinimalLogger","constructor","bindings","options","level","createLogMethod","name","msgs","msgPrefix","push","methodName","args","console","join"],"sources":["MinimalLogger.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Logger } from \"@osdk/api\";\nimport { BaseLogger } from \"./BaseLogger.js\";\n\nexport class MinimalLogger extends BaseLogger implements Logger {\n constructor(\n bindings: Record<string, any> = {},\n options: { level?: string; msgPrefix?: string } = {},\n ) {\n super(\n bindings,\n { ...options, level: options.level ?? \"error\" },\n MinimalLogger,\n );\n }\n\n createLogMethod(\n name: \"trace\" | \"debug\" | \"info\" | \"warn\" | \"error\" | \"fatal\",\n bindings: Record<string, any>,\n ): Logger.LogFn {\n const msgs: string[] = [name];\n\n if (this.options?.msgPrefix) {\n msgs.push(this.options.msgPrefix);\n }\n\n if (typeof bindings === \"object\" && \"methodName\" in bindings) {\n msgs.push(`.${bindings.methodName}()`);\n }\n\n return (...args: any[]) => {\n // eslint-disable-next-line no-console\n console[name === \"fatal\" ? \"error\" : name](msgs.join(\" \"), ...args);\n };\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,UAAU,QAAQ,iBAAiB;AAE5C,OAAO,MAAMC,aAAa,SAASD,UAAU,CAAmB;EAC9DE,WAAWA,CACTC,QAA6B,GAAG,CAAC,CAAC,EAClCC,OAA+C,GAAG,CAAC,CAAC,EACpD;IACA,KAAK,CACHD,QAAQ,EACR;MAAE,GAAGC,OAAO;MAAEC,KAAK,EAAED,OAAO,CAACC,KAAK,IAAI;IAAQ,CAAC,EAC/CJ,aACF,CAAC;EACH;EAEAK,eAAeA,CACbC,IAA6D,EAC7DJ,QAA6B,EACf;IACd,MAAMK,IAAc,GAAG,CAACD,IAAI,CAAC;IAE7B,IAAI,IAAI,CAACH,OAAO,EAAEK,SAAS,EAAE;MAC3BD,IAAI,CAACE,IAAI,CAAC,IAAI,CAACN,OAAO,CAACK,SAAS,CAAC;IACnC;IAEA,IAAI,OAAON,QAAQ,KAAK,QAAQ,IAAI,YAAY,IAAIA,QAAQ,EAAE;MAC5DK,IAAI,CAACE,IAAI,CAAC,IAAIP,QAAQ,CAACQ,UAAU,IAAI,CAAC;IACxC;IAEA,OAAO,CAAC,GAAGC,IAAW,KAAK;MACzB;MACAC,OAAO,CAACN,IAAI,KAAK,OAAO,GAAG,OAAO,GAAGA,IAAI,CAAC,CAACC,IAAI,CAACM,IAAI,CAAC,GAAG,CAAC,EAAE,GAAGF,IAAI,CAAC;IACrE,CAAC;EACH;AACF","ignoreList":[0]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestLogger.js","names":["Chalk","vi","BaseLogger","chalk","colors","debug","cyan","bgCyan","info","green","bgGreen","trace","gray","bgGray","error","red","bgRed","warn","yellow","bgYellow","fatal","redBright","bgRedBright","TestLogger","constructor","bindings","options","level","createLogMethod","name","msgs","msgPrefix","push","magenta","methodName","fn","console","bind","join"],"sources":["TestLogger.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {
|
|
1
|
+
{"version":3,"file":"TestLogger.js","names":["Chalk","vi","BaseLogger","chalk","colors","debug","cyan","bgCyan","info","green","bgGreen","trace","gray","bgGray","error","red","bgRed","warn","yellow","bgYellow","fatal","redBright","bgRedBright","TestLogger","constructor","bindings","options","level","createLogMethod","name","msgs","msgPrefix","push","magenta","methodName","fn","console","bind","join"],"sources":["TestLogger.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Logger } from \"@osdk/api\";\nimport { Chalk } from \"chalk\";\nimport { vi } from \"vitest\";\nimport { BaseLogger } from \"./BaseLogger.js\";\n\nconst chalk = new Chalk(); // new Chalk({ level: 3 });\n\nconst colors = {\n debug: [chalk.cyan, chalk.bgCyan],\n info: [chalk.green, chalk.bgGreen],\n trace: [chalk.gray, chalk.bgGray],\n error: [chalk.red, chalk.bgRed],\n warn: [chalk.yellow, chalk.bgYellow],\n fatal: [chalk.redBright, chalk.bgRedBright],\n} as const;\n\n/**\n * A logger suitable for using in unit tests.\n * - It uses chalk for colors (Node and browser console.log supports)\n * - Does not rely on async behavior of `pino`.\n */\nexport class TestLogger extends BaseLogger implements Logger {\n constructor(\n bindings: Record<string, any> = {},\n options: { level?: string; msgPrefix?: string } = {},\n ) {\n super(\n bindings,\n { ...options, level: options.level ?? \"error\" },\n TestLogger,\n );\n }\n\n protected createLogMethod(\n name: \"trace\" | \"debug\" | \"info\" | \"warn\" | \"error\" | \"fatal\",\n bindings: Record<string, any>,\n ): Logger.LogFn {\n const msgs: string[] = [colors[name][1](name)];\n\n if (this.options?.msgPrefix) {\n msgs.push(colors[name][0](this.options.msgPrefix));\n }\n\n if (typeof bindings === \"object\" && \"methodName\" in bindings) {\n msgs.push(chalk.magenta(`.${bindings.methodName}()`));\n }\n\n // eslint-disable-next-line no-console\n return vi.fn<Logger.LogFn>(console[name === \"fatal\" ? \"error\" : name].bind(\n console,\n msgs.join(\" \"),\n )) as Logger.LogFn;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,KAAK,QAAQ,OAAO;AAC7B,SAASC,EAAE,QAAQ,QAAQ;AAC3B,SAASC,UAAU,QAAQ,iBAAiB;AAE5C,MAAMC,KAAK,GAAG,IAAIH,KAAK,CAAC,CAAC,CA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AAC8B,OAAO,CAAC,IAAIR,QAAQ,CAACS,UAAU,IAAI,CAAC,CAAC;IACvD;;IAEA;IACA,OAAOjC,EAAE,CAACkC,EAAE,CAAeC,OAAO,CAACP,IAAI,KAAK,OAAO,GAAG,OAAO,GAAGA,IAAI,CAAC,CAACQ,IAAI,CACxED,OAAO,EACPN,IAAI,CAACQ,IAAI,CAAC,GAAG,CACf,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseHolder.js","names":[],"sources":["BaseHolder.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ObjectOrInterfaceDefinition, ObjectSpecifier } from \"@osdk/api\";\nimport type { InterfaceHolder } from \"./InterfaceHolder.js\";\nimport type { UnderlyingOsdkObject } from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\n/** @internal */\n\nexport interface BaseHolder {\n readonly [UnderlyingOsdkObject]: ObjectHolder;\n\n readonly $apiName: string;\n readonly $objectType: string;\n readonly $primaryKey: string | number
|
|
1
|
+
{"version":3,"file":"BaseHolder.js","names":[],"sources":["BaseHolder.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ObjectOrInterfaceDefinition, ObjectSpecifier } from \"@osdk/api\";\nimport type { InterfaceHolder } from \"./InterfaceHolder.js\";\nimport type { UnderlyingOsdkObject } from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\n/** @internal */\n\nexport interface BaseHolder {\n readonly [UnderlyingOsdkObject]: ObjectHolder;\n\n readonly $apiName: string;\n readonly $objectType: string;\n readonly $primaryKey: string | number;\n readonly $title: string | undefined;\n readonly $objectSpecifier: ObjectSpecifier<any>;\n\n readonly \"$as\": (\n newDef: string | ObjectOrInterfaceDefinition,\n ) => ObjectHolder | InterfaceHolder;\n\n readonly \"$clone\": (\n newProps?: Record<string, any>,\n ) => this;\n\n // [key: `$$${string}`]: any;\n // Unlike SimpleOsdkProperties, all of our remaining types are unknown as the full\n // union is basically `any` when you consider the above fields.\n [key: string]: unknown;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDollarLink.js","names":["getWireObjectSet","fetchSingle","fetchSingleWithErrors","ClientRef","ObjectDefRef","UnderlyingOsdkObject","get$link","holder","client","objDef","rawObj","Object","freeze","fromEntries","keys","links","map","linkName","linkDef","objectSet","objectSetFactory","where","primaryKeyApiName","$primaryKey","pivotTo","value","multiplicity","fetchOne","options","fetchOneWithErrors"],"sources":["getDollarLink.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ObjectSet,\n OsdkObjectLinksObject,\n SelectArg,\n WhereClause,\n} from \"@osdk/api\";\nimport { getWireObjectSet } from \"../../objectSet/createObjectSet.js\";\nimport { fetchSingle, fetchSingleWithErrors } from \"../fetchSingle.js\";\nimport {\n ClientRef,\n ObjectDefRef,\n UnderlyingOsdkObject,\n} from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\n/** @internal */\nexport function get$link(\n holder: ObjectHolder,\n): OsdkObjectLinksObject<any> {\n const client = holder[ClientRef];\n const objDef = holder[ObjectDefRef];\n const rawObj = holder[UnderlyingOsdkObject];\n return Object.freeze(Object.fromEntries(\n Object.keys(objDef.links).map(\n (linkName) => {\n const linkDef = objDef.links[linkName as keyof typeof objDef.links];\n const objectSet =\n (client.objectSetFactory(objDef, client) as ObjectSet<any>)\n .where({\n [objDef.primaryKeyApiName]: rawObj.$primaryKey,\n } as WhereClause<any>)\n .pivotTo(linkName);\n\n const value = !linkDef.multiplicity\n ? {\n fetchOne: <A extends SelectArg<any>>(options?: A) =>\n fetchSingle(\n client,\n objDef,\n options ?? {},\n getWireObjectSet(objectSet),\n ),\n fetchOneWithErrors: <A extends SelectArg<any>>(options?: A) =>\n fetchSingleWithErrors(\n client,\n objDef,\n options ?? {},\n getWireObjectSet(objectSet),\n ),\n }
|
|
1
|
+
{"version":3,"file":"getDollarLink.js","names":["getWireObjectSet","fetchSingle","fetchSingleWithErrors","ClientRef","ObjectDefRef","UnderlyingOsdkObject","get$link","holder","client","objDef","rawObj","Object","freeze","fromEntries","keys","links","map","linkName","linkDef","objectSet","objectSetFactory","where","primaryKeyApiName","$primaryKey","pivotTo","value","multiplicity","fetchOne","options","fetchOneWithErrors"],"sources":["getDollarLink.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ObjectSet,\n OsdkObjectLinksObject,\n SelectArg,\n SingleLinkAccessor,\n WhereClause,\n} from \"@osdk/api\";\nimport { getWireObjectSet } from \"../../objectSet/createObjectSet.js\";\nimport { fetchSingle, fetchSingleWithErrors } from \"../fetchSingle.js\";\nimport {\n ClientRef,\n ObjectDefRef,\n UnderlyingOsdkObject,\n} from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\n/** @internal */\nexport function get$link(\n holder: ObjectHolder,\n): OsdkObjectLinksObject<any> {\n const client = holder[ClientRef];\n const objDef = holder[ObjectDefRef];\n const rawObj = holder[UnderlyingOsdkObject];\n return Object.freeze(Object.fromEntries(\n Object.keys(objDef.links).map(\n (linkName) => {\n const linkDef = objDef.links[linkName as keyof typeof objDef.links];\n const objectSet =\n (client.objectSetFactory(objDef, client) as ObjectSet<any>)\n .where({\n [objDef.primaryKeyApiName]: rawObj.$primaryKey,\n } as WhereClause<any>)\n .pivotTo(linkName);\n\n const value = !linkDef.multiplicity\n ? {\n fetchOne: <A extends SelectArg<any, any, any, any>>(\n options?: A,\n ) =>\n fetchSingle(\n client,\n objDef,\n options ?? {},\n getWireObjectSet(objectSet),\n ),\n fetchOneWithErrors: <A extends SelectArg<any, any, any, any>>(\n options?: A,\n ) =>\n fetchSingleWithErrors(\n client,\n objDef,\n options ?? {},\n getWireObjectSet(objectSet),\n ),\n } as SingleLinkAccessor<any>\n : objectSet;\n\n return [linkName, value];\n },\n ),\n ));\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,SAASA,gBAAgB,QA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|
|
402
402
|
});
|
|
403
403
|
});
|
|
404
404
|
describe("Derived Properties Object Set", () => {
|
|
405
|
-
it("does not allow aggregate
|
|
405
|
+
it("does not allow aggregate before a link type is selected", () => {
|
|
406
406
|
client(Employee).withProperties({
|
|
407
407
|
"derivedPropertyName": base =>
|
|
408
408
|
// @ts-expect-error
|
|
409
409
|
base.aggregate("employeeId:exactDistinct")
|
|
410
410
|
});
|
|
411
|
-
client(Employee).withProperties({
|
|
412
|
-
"derivedPropertyName": base =>
|
|
413
|
-
// @ts-expect-error
|
|
414
|
-
base.selectProperty("employeeId")
|
|
415
|
-
});
|
|
416
411
|
});
|
|
417
412
|
it("does not allow selectProperty when a many link was selected at any point", () => {
|
|
418
413
|
client(Employee).withProperties({
|