@osdk/api 2.2.1 → 2.3.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -50
- package/build/browser/OsdkBase.js.map +1 -1
- package/build/browser/OsdkObjectFrom.test.js +1 -0
- package/build/browser/OsdkObjectFrom.test.js.map +1 -1
- package/build/browser/derivedProperties/DerivedProperty.js +1 -16
- package/build/browser/derivedProperties/DerivedProperty.js.map +1 -1
- package/build/browser/derivedProperties/Expressions.js +2 -0
- package/build/browser/derivedProperties/Expressions.js.map +1 -0
- package/build/browser/index.js.map +1 -1
- package/build/browser/mapping/DataValueMapping.js.map +1 -1
- package/build/browser/object/Media.js.map +1 -1
- package/build/browser/objectSet/ObjectSet.test.js +210 -4
- package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
- package/build/browser/ontology/ObjectOrInterface.js.map +1 -1
- package/build/cjs/{ObjectSet-BdwzHn1A.d.cts → ObjectSet-C67LQ5JX.d.cts} +64 -12
- package/build/cjs/index.d.cts +4 -4
- package/build/cjs/public/unstable.d.cts +2 -2
- package/build/esm/OsdkBase.js.map +1 -1
- package/build/esm/OsdkObjectFrom.test.js +1 -0
- package/build/esm/OsdkObjectFrom.test.js.map +1 -1
- package/build/esm/derivedProperties/DerivedProperty.js +1 -16
- package/build/esm/derivedProperties/DerivedProperty.js.map +1 -1
- package/build/esm/derivedProperties/Expressions.js +2 -0
- package/build/esm/derivedProperties/Expressions.js.map +1 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/mapping/DataValueMapping.js.map +1 -1
- package/build/esm/object/Media.js.map +1 -1
- package/build/esm/objectSet/ObjectSet.test.js +210 -4
- package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
- package/build/esm/ontology/ObjectOrInterface.js.map +1 -1
- package/build/types/OsdkBase.d.ts +9 -9
- package/build/types/OsdkBase.d.ts.map +1 -1
- package/build/types/derivedProperties/DerivedProperty.d.ts +32 -6
- package/build/types/derivedProperties/DerivedProperty.d.ts.map +1 -1
- package/build/types/derivedProperties/Expressions.d.ts +53 -0
- package/build/types/derivedProperties/Expressions.d.ts.map +1 -0
- package/build/types/index.d.ts +2 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/mapping/DataValueMapping.d.ts +2 -2
- package/build/types/mapping/DataValueMapping.d.ts.map +1 -1
- package/build/types/object/Media.d.ts +8 -0
- package/build/types/object/Media.d.ts.map +1 -1
- package/build/types/objectSet/ObjectSet.test.d.ts.map +1 -1
- package/build/types/ontology/ObjectOrInterface.d.ts +2 -2
- package/build/types/ontology/ObjectOrInterface.d.ts.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,69 +1,40 @@
|
|
|
1
1
|
# @osdk/api
|
|
2
2
|
|
|
3
|
-
## 2.
|
|
3
|
+
## 2.3.0-beta.10
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## 2.3.0-beta.9
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
## 2.3.0-beta.8
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
### Minor Changes
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
- 12d599f: Export ObjectIdentifiers to ensure Osdk.Instance can be used with typeof
|
|
12
12
|
|
|
13
|
-
-
|
|
14
|
-
- c6bee50: Removes ObjectSpecifier from OsdkBase
|
|
15
|
-
- 7416ce4: Adds deleted objects and links returned from applyAction
|
|
16
|
-
- 7170fd1: Fix generics for fetchPageByRid
|
|
17
|
-
- 12843cb: Add ability to load all underlying properties of an interface.
|
|
18
|
-
- 18ba34f: Adds the ability to generate and execute functions at pinned versions
|
|
19
|
-
- 6abf078: Fixes aggregation types for datetime to include collectList and collectSet
|
|
20
|
-
- f82767c: Allow using aggregation operations for boolean property types
|
|
21
|
-
- 56aa502: Improves exposed APIs
|
|
22
|
-
- 0e874b1: Exporting more entities from functions package.
|
|
23
|
-
- abe4897: Removes support for boolean primary keys
|
|
24
|
-
- 63b2e63: Update Platform SDK Dependencies
|
|
25
|
-
- cddfbf9: Adds default value option to group by
|
|
26
|
-
- 7416ce4: Update Platform SDK Dependencies
|
|
27
|
-
- 23ea0e4: Fix type break.
|
|
28
|
-
- 26c2d95: Add experimental function to load page of objects by rid.
|
|
29
|
-
- 488b51c: Add support for using aggregations and GeoJSON types from runtime derived properties
|
|
30
|
-
- 71462e9: Updates aggregation types to support operations on additional property types
|
|
31
|
-
- fccd9ac: "Allow selecting derived properties"
|
|
32
|
-
- 5665b18: Remove selection RDPs from the API
|
|
33
|
-
- 46cede4: Fix include all properties flag.
|
|
34
|
-
- 761e69d: Added type safety to createMediaReference
|
|
35
|
-
- 889e84b: Release
|
|
36
|
-
- a6e5f89: Changes count, exactDistinct, and approximateDistinct to be non-nullable
|
|
37
|
-
- ed69666: Update conjure-lite to 0.7.1
|
|
38
|
-
- 4183a55: Refactor OsdkBase to avoid breaks with type not being discoverable
|
|
39
|
-
- 70b4464: Fix types for RDPs
|
|
40
|
-
- 791e655: Add support for geoshape and geohash action parameters.
|
|
41
|
-
- 317b555: Release
|
|
42
|
-
- 63b2e63: Supports generating queries for entrySet function types
|
|
43
|
-
- a146ce4: Cleanup RDP API
|
|
44
|
-
- 3d0ab11: Add protection for dropping unsupported enums instead of throwing"
|
|
45
|
-
- 805df40: Fix interface action types.
|
|
46
|
-
- 5467a0f: Fix orderBy argument on object load methods
|
|
47
|
-
- 63b2e63: Adds ObjectSpecifiers to generated OSDK objects
|
|
13
|
+
## 2.3.0-beta.7
|
|
48
14
|
|
|
49
|
-
|
|
15
|
+
### Minor Changes
|
|
50
16
|
|
|
51
|
-
|
|
17
|
+
- f8db93d: improve media upload (beta)
|
|
52
18
|
|
|
53
|
-
-
|
|
19
|
+
## 2.3.0-beta.6
|
|
54
20
|
|
|
55
|
-
## 2.
|
|
21
|
+
## 2.3.0-beta.5
|
|
56
22
|
|
|
57
|
-
###
|
|
23
|
+
### Minor Changes
|
|
58
24
|
|
|
59
|
-
-
|
|
25
|
+
- e8c4aed: Fixes breaks introduced between 2.1 and 2.2
|
|
60
26
|
|
|
61
|
-
## 2.
|
|
27
|
+
## 2.3.0-beta.4
|
|
62
28
|
|
|
63
|
-
###
|
|
29
|
+
### Minor Changes
|
|
30
|
+
|
|
31
|
+
- 43c5547: Add 'getMediaReference' method to Media
|
|
32
|
+
- ef46ed6: Add protection for dropping unsupported enums instead of throwing"
|
|
33
|
+
- 3b5ccaa: Fix orderBy argument on object load methods
|
|
34
|
+
|
|
35
|
+
## 2.3.0-beta.3
|
|
64
36
|
|
|
65
|
-
-
|
|
66
|
-
- a146ce4: Cleanup RDP API
|
|
37
|
+
## 2.3.0-beta.2
|
|
67
38
|
|
|
68
39
|
## 2.2.0-beta.23
|
|
69
40
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OsdkBase.js","names":[],"sources":["OsdkBase.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 { PropertyValueWireToClient } from \"./mapping/PropertyValueMapping.js\";\nimport type { ObjectOrInterfaceDefinition } from \"./ontology/ObjectOrInterface.js\";\nimport type { ObjectSpecifier } from \"./ontology/ObjectSpecifier.js\";\nimport type { ObjectTypeDefinition } from \"./ontology/ObjectTypeDefinition.js\";\nimport type { PrimaryKeyTypes } from \"./ontology/PrimaryKeyTypes.js\";\nimport type { OsdkObjectPrimaryKeyType } from \"./OsdkObjectPrimaryKeyType.js\";\n\nexport
|
|
1
|
+
{"version":3,"file":"OsdkBase.js","names":[],"sources":["OsdkBase.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 { PropertyValueWireToClient } from \"./mapping/PropertyValueMapping.js\";\nimport type { ObjectOrInterfaceDefinition } from \"./ontology/ObjectOrInterface.js\";\nimport type { ObjectSpecifier } from \"./ontology/ObjectSpecifier.js\";\nimport type { ObjectTypeDefinition } from \"./ontology/ObjectTypeDefinition.js\";\nimport type { PrimaryKeyTypes } from \"./ontology/PrimaryKeyTypes.js\";\nimport type { OsdkObjectPrimaryKeyType } from \"./OsdkObjectPrimaryKeyType.js\";\n\nexport type ObjectIdentifiers<\n Q extends ObjectOrInterfaceDefinition,\n> = {\n readonly $apiName: Q[\"apiName\"];\n\n readonly $primaryKey: PrimaryKeyType<Q>;\n};\n\nexport type OsdkBase<\n Q extends ObjectOrInterfaceDefinition,\n> = ObjectIdentifiers<Q> & {\n readonly $objectSpecifier: ObjectSpecifier<Q>;\n\n readonly $objectType: string;\n\n readonly $title: string | undefined;\n};\n\nexport type PrimaryKeyType<Q extends ObjectOrInterfaceDefinition> =\n & (Q extends ObjectTypeDefinition ? OsdkObjectPrimaryKeyType<Q>\n : unknown)\n // if the type is `unknown` then the next line will\n // restrict it down to all valid primary key types\n & PropertyValueWireToClient[PrimaryKeyTypes];\n"],"mappings":"","ignoreList":[]}
|
|
@@ -104,6 +104,7 @@ describe("ExtractOptions", () => {
|
|
|
104
104
|
it("defaults to last argument exactly if specified", () => {
|
|
105
105
|
expectTypeOf().branded.toEqualTypeOf();
|
|
106
106
|
});
|
|
107
|
+
it("Is assignable to Record<string, unknown>", () => {});
|
|
107
108
|
});
|
|
108
109
|
describe("Osdk<>", () => {
|
|
109
110
|
it("defaults to second argument never if omitted", () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OsdkObjectFrom.test.js","names":["describe","expectTypeOf","it","createMockObjectSet","toEqualTypeOf","branded","fauxObjectSet","fetchPage"],"sources":["OsdkObjectFrom.test.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { describe, expectTypeOf, it } from \"vitest\";\nimport type { NullabilityAdherence } from \"./object/FetchPageArgs.js\";\nimport { createMockObjectSet } from \"./objectSet/ObjectSet.test.js\";\nimport type { ExtractOptions, Osdk } from \"./OsdkObjectFrom.js\";\n\ndescribe(\"ExtractOptions\", () => {\n describe(\"NullabilityAdherence Generic\", () => {\n it(\"does not add $notStrict for any\", () => {\n expectTypeOf<ExtractOptions<any, any>>()\n .toEqualTypeOf<never>();\n });\n\n it(\"does not add $notStrict for never\", () => {\n expectTypeOf<ExtractOptions<any, never>>()\n .toEqualTypeOf<never>();\n });\n\n it(\"does not add $notStrict for false\", () => {\n expectTypeOf<ExtractOptions<any, false>>()\n .toEqualTypeOf<never>();\n });\n\n it(\"does not add $notStrict for throw\", () => {\n expectTypeOf<ExtractOptions<any, \"throw\">>()\n .toEqualTypeOf<never>();\n });\n\n it(\"does not add $notStrict for drop\", () => {\n expectTypeOf<ExtractOptions<any, \"drop\">>()\n .toEqualTypeOf<never>();\n });\n\n it(\"does not add $notStrict for drop | throw\", () => {\n expectTypeOf<ExtractOptions<any, \"drop\" | \"throw\">>()\n .toEqualTypeOf<never>();\n });\n\n it(\"does not add $notStrict for drop | false\", () => {\n expectTypeOf<ExtractOptions<any, \"drop\" | false>>()\n .toEqualTypeOf<never>();\n });\n it(\"does not add $notStrict for false | throw\", () => {\n expectTypeOf<ExtractOptions<any, false | \"throw\">>()\n .toEqualTypeOf<never>();\n });\n\n it(\"does not add $notStrict for drop | throw | false\", () => {\n expectTypeOf<ExtractOptions<any, \"drop\" | \"throw\" | false>>()\n .toEqualTypeOf<never>();\n });\n\n it(\"does not add $notStrict for NullabilityAdherence\", () => {\n expectTypeOf<ExtractOptions<any, NullabilityAdherence>>()\n .toEqualTypeOf<never>();\n });\n });\n\n describe(\"Rid Generic\", () => {\n it(\"does not add $rid for false\", () => {\n expectTypeOf<ExtractOptions<false, any>>().toEqualTypeOf<never>();\n });\n\n it(\"does add $rid for true\", () => {\n expectTypeOf<ExtractOptions<true, any>>().toEqualTypeOf<\"$rid\">();\n });\n\n it(\"does not add $rid for any\", () => {\n expectTypeOf<ExtractOptions<any, any>>().toEqualTypeOf<never>();\n });\n\n it(\"does not add $rid for never\", () => {\n expectTypeOf<ExtractOptions<never, any>>().toEqualTypeOf<never>();\n });\n\n it(\"does not add $rid for boolean\", () => {\n expectTypeOf<ExtractOptions<boolean, any>>().toEqualTypeOf<never>();\n });\n\n it(\"does not add $rid for true | false\", () => {\n expectTypeOf<ExtractOptions<true | false, any>>().toEqualTypeOf<never>();\n });\n });\n\n type quickAndDirty = {\n apiName: \"Foo\";\n type: \"object\";\n __DefinitionMetadata: {\n props: {\n name: string;\n foo: number | undefined;\n };\n strictProps: {\n name: string;\n foo: number;\n };\n apiName: \"Foo\";\n displayName: \"\";\n interfaceMap: {};\n inverseInterfaceMap: {};\n links: {};\n pluralDisplayName: \"\";\n primaryKeyApiName: \"\";\n primaryKeyType: \"string\";\n properties: {\n name: {\n type: \"string\";\n };\n foo: {\n type: \"integer\";\n };\n };\n rid: \"\";\n status: \"ACTIVE\";\n titleProperty: \"name\";\n type: \"object\";\n icon: undefined;\n visibility: undefined;\n description: undefined;\n };\n };\n\n describe(\"Osdk.Instance\", () => {\n it(\"defaults to second argument never if omitted\", () => {\n type toCheck = Osdk.Instance<quickAndDirty>;\n expectTypeOf<toCheck>().toEqualTypeOf<\n Osdk.Instance<quickAndDirty, never>\n >();\n\n // ensure its the normal props\n expectTypeOf<Pick<toCheck, \"name\" | \"foo\">>().toEqualTypeOf<\n quickAndDirty[\"__DefinitionMetadata\"][\"props\"]\n >();\n });\n\n it(\"defaults to second argument never if never\", () => {\n type toCheck = Osdk.Instance<quickAndDirty, never>;\n expectTypeOf<toCheck>().toEqualTypeOf<\n Osdk.Instance<quickAndDirty, never>\n >();\n // ensure its the normal props\n expectTypeOf<Pick<toCheck, \"name\" | \"foo\">>().toEqualTypeOf<\n quickAndDirty[\"__DefinitionMetadata\"][\"props\"]\n >();\n });\n\n it(\"defaults to second argument never if any\", () => {\n type toCheck = Osdk.Instance<quickAndDirty, any>;\n expectTypeOf<toCheck>().branded.toEqualTypeOf<\n Osdk.Instance<quickAndDirty, never>\n >();\n // ensure its the normal props\n expectTypeOf<Pick<toCheck, \"name\" | \"foo\">>().toEqualTypeOf<\n quickAndDirty[\"__DefinitionMetadata\"][\"props\"]\n >();\n });\n\n it(\"Cannot use $notStrict\", () => {\n // @ts-expect-error\n type toCheck = Osdk.Instance<quickAndDirty, \"$notStrict\">;\n\n expectTypeOf<toCheck>().branded\n // @ts-expect-error\n .toEqualTypeOf<Osdk.Instance<quickAndDirty, \"$notStrict\">>();\n // ensure its not the strict type\n expectTypeOf<Pick<toCheck, \"name\" | \"foo\">>().toEqualTypeOf<\n quickAndDirty[\"__DefinitionMetadata\"][\"props\"]\n >();\n });\n\n it(\"defaults to last argument all props if never\", () => {\n expectTypeOf<Osdk.Instance<quickAndDirty, never, never>>().branded\n .toEqualTypeOf<\n Osdk.Instance<quickAndDirty, never, \"name\" | \"foo\">\n >();\n });\n\n it(\"defaults to last argument all props if any\", () => {\n expectTypeOf<Osdk.Instance<quickAndDirty, never, any>>().branded\n .toEqualTypeOf<\n Osdk.Instance<quickAndDirty, never, \"name\" | \"foo\">\n >();\n });\n\n it(\"defaults to last argument exactly if specified\", () => {\n expectTypeOf<Osdk.Instance<quickAndDirty, never, \"name\">>().branded\n .toEqualTypeOf<\n Osdk.Instance<quickAndDirty, never, \"name\">\n >();\n });\n });\n\n describe(\"Osdk<>\", () => {\n it(\"defaults to second argument never if omitted\", () => {\n type toCheck = Osdk<quickAndDirty>;\n expectTypeOf<toCheck>().toEqualTypeOf<\n Osdk.Instance<quickAndDirty, never>\n >();\n\n // expect no rid\n expectTypeOf<keyof toCheck & \"$rid\">().toEqualTypeOf<never>();\n\n // ensure its the normal props\n expectTypeOf<Pick<toCheck, \"name\" | \"foo\">>().toEqualTypeOf<\n quickAndDirty[\"__DefinitionMetadata\"][\"props\"]\n >();\n });\n\n it(\"returns $rid if only thing specified\", () => {\n type toCheck = Osdk<quickAndDirty, \"$rid\">;\n expectTypeOf<toCheck>().toEqualTypeOf<\n Osdk.Instance<quickAndDirty, \"$rid\">\n >();\n\n // expect rid\n expectTypeOf<keyof toCheck & \"$rid\">().toEqualTypeOf<\"$rid\">();\n\n // ensure its the normal props\n expectTypeOf<Pick<toCheck, \"name\" | \"foo\">>().toEqualTypeOf<\n quickAndDirty[\"__DefinitionMetadata\"][\"props\"]\n >();\n });\n\n it(\"handles legacy properly: $rid and name\", () => {\n type toCheck = Osdk<quickAndDirty, \"$rid\" | \"name\">;\n expectTypeOf<toCheck>().toEqualTypeOf<\n Osdk.Instance<quickAndDirty, \"$rid\", \"name\">\n >();\n\n // expect rid\n expectTypeOf<keyof toCheck & \"$rid\">().toEqualTypeOf<\"$rid\">();\n\n // ensure its the strict type\n expectTypeOf<Pick<toCheck, \"name\">>().toEqualTypeOf<{\n name: quickAndDirty[\"__DefinitionMetadata\"][\"strictProps\"][\"name\"];\n }>();\n });\n\n it(\"handles legacy properly: $rid and $all\", () => {\n type toCheck = Osdk<quickAndDirty, \"$rid\" | \"$all\">;\n expectTypeOf<toCheck>().branded.toEqualTypeOf<\n Osdk.Instance<quickAndDirty, \"$rid\", \"name\" | \"foo\">\n >();\n\n // expect rid\n expectTypeOf<keyof toCheck & \"$rid\">().toEqualTypeOf<\"$rid\">();\n\n // ensure its the normal props\n expectTypeOf<Pick<toCheck, \"name\" | \"foo\">>().toEqualTypeOf<\n quickAndDirty[\"__DefinitionMetadata\"][\"props\"]\n >();\n });\n\n it(\"handles legacy properly: just $all\", () => {\n type toCheck = Osdk<quickAndDirty, \"$all\">;\n expectTypeOf<toCheck>().branded.toEqualTypeOf<\n Osdk.Instance<quickAndDirty, never, \"name\" | \"foo\">\n >();\n\n // expect no rid\n expectTypeOf<keyof toCheck & \"$rid\">().toEqualTypeOf<never>();\n\n // ensure its the normal props\n expectTypeOf<Pick<toCheck, \"name\" | \"foo\">>().toEqualTypeOf<\n quickAndDirty[\"__DefinitionMetadata\"][\"props\"]\n >();\n });\n\n it(\"defaults to second argument never if never\", () => {\n type toCheck = Osdk<quickAndDirty, never>;\n expectTypeOf<toCheck>().toEqualTypeOf<\n Osdk.Instance<quickAndDirty, never>\n >();\n // ensure its the normal props\n expectTypeOf<Pick<toCheck, \"name\" | \"foo\">>().toEqualTypeOf<\n quickAndDirty[\"__DefinitionMetadata\"][\"props\"]\n >();\n\n // expect no rid\n expectTypeOf<keyof toCheck & \"$rid\">().toEqualTypeOf<never>();\n });\n\n it(\"defaults to second argument never if any\", () => {\n type toCheck = Osdk<quickAndDirty, any>;\n expectTypeOf<toCheck>().branded.toEqualTypeOf<\n Osdk.Instance<quickAndDirty, never>\n >();\n // ensure its the normal props\n expectTypeOf<Pick<toCheck, \"name\" | \"foo\">>().toEqualTypeOf<\n quickAndDirty[\"__DefinitionMetadata\"][\"props\"]\n >();\n\n // expect no rid\n expectTypeOf<keyof toCheck & \"$rid\">().toEqualTypeOf<never>();\n });\n\n it(\"Does not use $notStrict if requested with old type\", () => {\n type toCheck = Osdk<quickAndDirty, \"$notStrict\">;\n expectTypeOf<toCheck>().branded\n .toEqualTypeOf<Osdk.Instance<quickAndDirty, never>>();\n // ensure its not the strict type\n expectTypeOf<Pick<toCheck, \"name\" | \"foo\">>().toEqualTypeOf<\n quickAndDirty[\"__DefinitionMetadata\"][\"props\"]\n >();\n\n // expect no rid\n expectTypeOf<keyof toCheck & \"$rid\">().toEqualTypeOf<never>();\n });\n\n it(\"defaults to last argument all props if never\", () => {\n expectTypeOf<Osdk<quickAndDirty, never, never>>().branded\n .toEqualTypeOf<\n Osdk.Instance<quickAndDirty, never, \"name\" | \"foo\">\n >();\n });\n\n it(\"defaults to last argument all props if any\", () => {\n expectTypeOf<Osdk<quickAndDirty, never, any>>().branded\n .toEqualTypeOf<\n Osdk.Instance<quickAndDirty, never, \"name\" | \"foo\">\n >();\n });\n\n it(\"defaults to last argument exactly if specified\", () => {\n expectTypeOf<Osdk<quickAndDirty, never, \"name\">>()\n .toEqualTypeOf<\n Osdk.Instance<quickAndDirty, never, \"name\">\n >();\n });\n });\n\n describe(\"Inferred return types from fetchPage work\", () => {\n const fauxObjectSet = createMockObjectSet<quickAndDirty>();\n\n it(\"is not $notStrict\", async () => {\n const page = await fauxObjectSet.fetchPage();\n\n expectTypeOf<typeof page[\"data\"]>().branded\n .toEqualTypeOf<\n Osdk.Instance<quickAndDirty>[]\n >();\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,EAAEC,YAAY,EAAEC,EAAE,QAAQ,QAAQ;AAEnD,SAASC,mBAAmB,QAAQ,+BAA+B;AAGnEH,QAAQ,CAAC,gBAAgB,EAAE,MAAM;EAC/BA,QAAQ,CAAC,8BAA8B,EAAE,MAAM;IAC7CE,EAAE,CAAC,iCAAiC,EAAE,MAAM;MAC1CD,YAAY,CAA2B,CAAC,CACrCG,aAAa,CAAQ,CAAC;IAC3B,C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rDD,YAAY,CAAkC,CAAC,CAACI,OAAO,CACpDD,aAAa,CAEZ,CAAC;IACP,CAAC,CAAC;IAEFF,EAAE,CAAC,gDAAgD,EAAE,MAAM;MACzDD,YAAY,CAAqC,CAAC,CAC/CG,aAAa,CAEZ,CAAC;IACP,CAAC,CAAC;EACJ,CAAC,CAAC;EAEFJ,QAAQ,CAAC,2CAA2C,EAAE,MAAM;IAC1D,MAAMM,aAAa,GAAGH,mBAAmB,CAAgB,CAAC;IAE1DD,EAAE,CAAC,mBAAmB,EAAE,YAAY;MACrB,MAAMI,aAAa,CAACC,SAAS,CAAC,CAAC;MAE5CN,YAAY,CAAsB,CAAC,CAACI,OAAO,CACxCD,aAAa,CAEZ,CAAC;IACP,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"OsdkObjectFrom.test.js","names":["describe","expectTypeOf","it","createMockObjectSet","toEqualTypeOf","branded","fauxObjectSet","fetchPage"],"sources":["OsdkObjectFrom.test.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { describe, expectTypeOf, it } from \"vitest\";\nimport type { NullabilityAdherence } from \"./object/FetchPageArgs.js\";\nimport { createMockObjectSet } from \"./objectSet/ObjectSet.test.js\";\nimport type { ExtractOptions, Osdk } from \"./OsdkObjectFrom.js\";\n\ndescribe(\"ExtractOptions\", () => {\n describe(\"NullabilityAdherence Generic\", () => {\n it(\"does not add $notStrict for any\", () => {\n expectTypeOf<ExtractOptions<any, any>>()\n .toEqualTypeOf<never>();\n });\n\n it(\"does not add $notStrict for never\", () => {\n expectTypeOf<ExtractOptions<any, never>>()\n .toEqualTypeOf<never>();\n });\n\n it(\"does not add $notStrict for false\", () => {\n expectTypeOf<ExtractOptions<any, false>>()\n .toEqualTypeOf<never>();\n });\n\n it(\"does not add $notStrict for throw\", () => {\n expectTypeOf<ExtractOptions<any, \"throw\">>()\n .toEqualTypeOf<never>();\n });\n\n it(\"does not add $notStrict for drop\", () => {\n expectTypeOf<ExtractOptions<any, \"drop\">>()\n .toEqualTypeOf<never>();\n });\n\n it(\"does not add $notStrict for drop | throw\", () => {\n expectTypeOf<ExtractOptions<any, \"drop\" | \"throw\">>()\n .toEqualTypeOf<never>();\n });\n\n it(\"does not add $notStrict for drop | false\", () => {\n expectTypeOf<ExtractOptions<any, \"drop\" | false>>()\n .toEqualTypeOf<never>();\n });\n it(\"does not add $notStrict for false | throw\", () => {\n expectTypeOf<ExtractOptions<any, false | \"throw\">>()\n .toEqualTypeOf<never>();\n });\n\n it(\"does not add $notStrict for drop | throw | false\", () => {\n expectTypeOf<ExtractOptions<any, \"drop\" | \"throw\" | false>>()\n .toEqualTypeOf<never>();\n });\n\n it(\"does not add $notStrict for NullabilityAdherence\", () => {\n expectTypeOf<ExtractOptions<any, NullabilityAdherence>>()\n .toEqualTypeOf<never>();\n });\n });\n\n describe(\"Rid Generic\", () => {\n it(\"does not add $rid for false\", () => {\n expectTypeOf<ExtractOptions<false, any>>().toEqualTypeOf<never>();\n });\n\n it(\"does add $rid for true\", () => {\n expectTypeOf<ExtractOptions<true, any>>().toEqualTypeOf<\"$rid\">();\n });\n\n it(\"does not add $rid for any\", () => {\n expectTypeOf<ExtractOptions<any, any>>().toEqualTypeOf<never>();\n });\n\n it(\"does not add $rid for never\", () => {\n expectTypeOf<ExtractOptions<never, any>>().toEqualTypeOf<never>();\n });\n\n it(\"does not add $rid for boolean\", () => {\n expectTypeOf<ExtractOptions<boolean, any>>().toEqualTypeOf<never>();\n });\n\n it(\"does not add $rid for true | false\", () => {\n expectTypeOf<ExtractOptions<true | false, any>>().toEqualTypeOf<never>();\n });\n });\n\n type quickAndDirty = {\n apiName: \"Foo\";\n type: \"object\";\n __DefinitionMetadata: {\n props: {\n name: string;\n foo: number | undefined;\n };\n strictProps: {\n name: string;\n foo: number;\n };\n apiName: \"Foo\";\n displayName: \"\";\n interfaceMap: {};\n inverseInterfaceMap: {};\n links: {};\n pluralDisplayName: \"\";\n primaryKeyApiName: \"\";\n primaryKeyType: \"string\";\n properties: {\n name: {\n type: \"string\";\n };\n foo: {\n type: \"integer\";\n };\n };\n rid: \"\";\n status: \"ACTIVE\";\n titleProperty: \"name\";\n type: \"object\";\n icon: undefined;\n visibility: undefined;\n description: undefined;\n };\n };\n\n describe(\"Osdk.Instance\", () => {\n it(\"defaults to second argument never if omitted\", () => {\n type toCheck = Osdk.Instance<quickAndDirty>;\n expectTypeOf<toCheck>().toEqualTypeOf<\n Osdk.Instance<quickAndDirty, never>\n >();\n\n // ensure its the normal props\n expectTypeOf<Pick<toCheck, \"name\" | \"foo\">>().toEqualTypeOf<\n quickAndDirty[\"__DefinitionMetadata\"][\"props\"]\n >();\n });\n\n it(\"defaults to second argument never if never\", () => {\n type toCheck = Osdk.Instance<quickAndDirty, never>;\n expectTypeOf<toCheck>().toEqualTypeOf<\n Osdk.Instance<quickAndDirty, never>\n >();\n // ensure its the normal props\n expectTypeOf<Pick<toCheck, \"name\" | \"foo\">>().toEqualTypeOf<\n quickAndDirty[\"__DefinitionMetadata\"][\"props\"]\n >();\n });\n\n it(\"defaults to second argument never if any\", () => {\n type toCheck = Osdk.Instance<quickAndDirty, any>;\n expectTypeOf<toCheck>().branded.toEqualTypeOf<\n Osdk.Instance<quickAndDirty, never>\n >();\n // ensure its the normal props\n expectTypeOf<Pick<toCheck, \"name\" | \"foo\">>().toEqualTypeOf<\n quickAndDirty[\"__DefinitionMetadata\"][\"props\"]\n >();\n });\n\n it(\"Cannot use $notStrict\", () => {\n // @ts-expect-error\n type toCheck = Osdk.Instance<quickAndDirty, \"$notStrict\">;\n\n expectTypeOf<toCheck>().branded\n // @ts-expect-error\n .toEqualTypeOf<Osdk.Instance<quickAndDirty, \"$notStrict\">>();\n // ensure its not the strict type\n expectTypeOf<Pick<toCheck, \"name\" | \"foo\">>().toEqualTypeOf<\n quickAndDirty[\"__DefinitionMetadata\"][\"props\"]\n >();\n });\n\n it(\"defaults to last argument all props if never\", () => {\n expectTypeOf<Osdk.Instance<quickAndDirty, never, never>>().branded\n .toEqualTypeOf<\n Osdk.Instance<quickAndDirty, never, \"name\" | \"foo\">\n >();\n });\n\n it(\"defaults to last argument all props if any\", () => {\n expectTypeOf<Osdk.Instance<quickAndDirty, never, any>>().branded\n .toEqualTypeOf<\n Osdk.Instance<quickAndDirty, never, \"name\" | \"foo\">\n >();\n });\n\n it(\"defaults to last argument exactly if specified\", () => {\n expectTypeOf<Osdk.Instance<quickAndDirty, never, \"name\">>().branded\n .toEqualTypeOf<\n Osdk.Instance<quickAndDirty, never, \"name\">\n >();\n });\n\n it(\"Is assignable to Record<string, unknown>\", () => {\n // We encountered a break where this stopped being assignable. We need to continue to support this assignment.\n const a = {} as Osdk.Instance<quickAndDirty>;\n a as Record<string, unknown>;\n });\n });\n\n describe(\"Osdk<>\", () => {\n it(\"defaults to second argument never if omitted\", () => {\n type toCheck = Osdk<quickAndDirty>;\n expectTypeOf<toCheck>().toEqualTypeOf<\n Osdk.Instance<quickAndDirty, never>\n >();\n\n // expect no rid\n expectTypeOf<keyof toCheck & \"$rid\">().toEqualTypeOf<never>();\n\n // ensure its the normal props\n expectTypeOf<Pick<toCheck, \"name\" | \"foo\">>().toEqualTypeOf<\n quickAndDirty[\"__DefinitionMetadata\"][\"props\"]\n >();\n });\n\n it(\"returns $rid if only thing specified\", () => {\n type toCheck = Osdk<quickAndDirty, \"$rid\">;\n expectTypeOf<toCheck>().toEqualTypeOf<\n Osdk.Instance<quickAndDirty, \"$rid\">\n >();\n\n // expect rid\n expectTypeOf<keyof toCheck & \"$rid\">().toEqualTypeOf<\"$rid\">();\n\n // ensure its the normal props\n expectTypeOf<Pick<toCheck, \"name\" | \"foo\">>().toEqualTypeOf<\n quickAndDirty[\"__DefinitionMetadata\"][\"props\"]\n >();\n });\n\n it(\"handles legacy properly: $rid and name\", () => {\n type toCheck = Osdk<quickAndDirty, \"$rid\" | \"name\">;\n expectTypeOf<toCheck>().toEqualTypeOf<\n Osdk.Instance<quickAndDirty, \"$rid\", \"name\">\n >();\n\n // expect rid\n expectTypeOf<keyof toCheck & \"$rid\">().toEqualTypeOf<\"$rid\">();\n\n // ensure its the strict type\n expectTypeOf<Pick<toCheck, \"name\">>().toEqualTypeOf<{\n name: quickAndDirty[\"__DefinitionMetadata\"][\"strictProps\"][\"name\"];\n }>();\n });\n\n it(\"handles legacy properly: $rid and $all\", () => {\n type toCheck = Osdk<quickAndDirty, \"$rid\" | \"$all\">;\n expectTypeOf<toCheck>().branded.toEqualTypeOf<\n Osdk.Instance<quickAndDirty, \"$rid\", \"name\" | \"foo\">\n >();\n\n // expect rid\n expectTypeOf<keyof toCheck & \"$rid\">().toEqualTypeOf<\"$rid\">();\n\n // ensure its the normal props\n expectTypeOf<Pick<toCheck, \"name\" | \"foo\">>().toEqualTypeOf<\n quickAndDirty[\"__DefinitionMetadata\"][\"props\"]\n >();\n });\n\n it(\"handles legacy properly: just $all\", () => {\n type toCheck = Osdk<quickAndDirty, \"$all\">;\n expectTypeOf<toCheck>().branded.toEqualTypeOf<\n Osdk.Instance<quickAndDirty, never, \"name\" | \"foo\">\n >();\n\n // expect no rid\n expectTypeOf<keyof toCheck & \"$rid\">().toEqualTypeOf<never>();\n\n // ensure its the normal props\n expectTypeOf<Pick<toCheck, \"name\" | \"foo\">>().toEqualTypeOf<\n quickAndDirty[\"__DefinitionMetadata\"][\"props\"]\n >();\n });\n\n it(\"defaults to second argument never if never\", () => {\n type toCheck = Osdk<quickAndDirty, never>;\n expectTypeOf<toCheck>().toEqualTypeOf<\n Osdk.Instance<quickAndDirty, never>\n >();\n // ensure its the normal props\n expectTypeOf<Pick<toCheck, \"name\" | \"foo\">>().toEqualTypeOf<\n quickAndDirty[\"__DefinitionMetadata\"][\"props\"]\n >();\n\n // expect no rid\n expectTypeOf<keyof toCheck & \"$rid\">().toEqualTypeOf<never>();\n });\n\n it(\"defaults to second argument never if any\", () => {\n type toCheck = Osdk<quickAndDirty, any>;\n expectTypeOf<toCheck>().branded.toEqualTypeOf<\n Osdk.Instance<quickAndDirty, never>\n >();\n // ensure its the normal props\n expectTypeOf<Pick<toCheck, \"name\" | \"foo\">>().toEqualTypeOf<\n quickAndDirty[\"__DefinitionMetadata\"][\"props\"]\n >();\n\n // expect no rid\n expectTypeOf<keyof toCheck & \"$rid\">().toEqualTypeOf<never>();\n });\n\n it(\"Does not use $notStrict if requested with old type\", () => {\n type toCheck = Osdk<quickAndDirty, \"$notStrict\">;\n expectTypeOf<toCheck>().branded\n .toEqualTypeOf<Osdk.Instance<quickAndDirty, never>>();\n // ensure its not the strict type\n expectTypeOf<Pick<toCheck, \"name\" | \"foo\">>().toEqualTypeOf<\n quickAndDirty[\"__DefinitionMetadata\"][\"props\"]\n >();\n\n // expect no rid\n expectTypeOf<keyof toCheck & \"$rid\">().toEqualTypeOf<never>();\n });\n\n it(\"defaults to last argument all props if never\", () => {\n expectTypeOf<Osdk<quickAndDirty, never, never>>().branded\n .toEqualTypeOf<\n Osdk.Instance<quickAndDirty, never, \"name\" | \"foo\">\n >();\n });\n\n it(\"defaults to last argument all props if any\", () => {\n expectTypeOf<Osdk<quickAndDirty, never, any>>().branded\n .toEqualTypeOf<\n Osdk.Instance<quickAndDirty, never, \"name\" | \"foo\">\n >();\n });\n\n it(\"defaults to last argument exactly if specified\", () => {\n expectTypeOf<Osdk<quickAndDirty, never, \"name\">>()\n .toEqualTypeOf<\n Osdk.Instance<quickAndDirty, never, \"name\">\n >();\n });\n });\n\n describe(\"Inferred return types from fetchPage work\", () => {\n const fauxObjectSet = createMockObjectSet<quickAndDirty>();\n\n it(\"is not $notStrict\", async () => {\n const page = await fauxObjectSet.fetchPage();\n\n expectTypeOf<typeof page[\"data\"]>().branded\n .toEqualTypeOf<\n Osdk.Instance<quickAndDirty>[]\n >();\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,EAAEC,YAAY,EAAEC,EAAE,QAAQ,QAAQ;AAEnD,SAASC,mBAAmB,QAAQ,+BAA+B;AAGnEH,QAAQ,CAAC,gBAAgB,EAAE,MAAM;EAC/BA,QAAQ,CAAC,8BAA8B,EAAE,MAAM;IAC7CE,EAAE,CAAC,iCAAiC,EAAE,MAAM;MAC1CD,YAAY,CAA2B,CAAC,CACrCG,aAAa,CAAQ,CAAC;IAC3B,CAAC,CAAC;IAEFF,EAAE,CAAC,mCAAmC,EAAE,MAAM;MAC5CD,YAAY,CAA6B,CAAC,CACvCG,aAAa,CAAQ,CAAC;IAC3B,CAAC,CAAC;IAEFF,EAAE,CAAC,mCAAmC,EAAE,MAAM;MAC5CD,YAAY,CAA6B,CAAC,CACvCG,aAAa,CAAQ,CAAC;IAC3B,CAAC,CAAC;IAEFF,EAAE,CAAC,mCAAmC,EAAE,MAAM;MAC5CD,YAAY,CAA+B,CAAC,CACzCG,aAAa,CAAQ,CAAC;IAC3B,CAAC,CAAC;IAEFF,EAAE,CAAC,kCAAkC,EAAE,MAAM;MAC3CD,YAAY,CAA8B,CAAC,CACxCG,aAAa,CAAQ,CAAC;IAC3B,CAAC,CAAC;IAEFF,EAAE,CAAC,0CAA0C,EAAE,MAAM;MACnDD,YAAY,CAAwC,CAAC,CAClDG,aAAa,CAAQ,CAAC;IAC3B,CAAC,CAAC;IAEFF,EAAE,CAAC,0CAA0C,EAAE,MAAM;MACnDD,YAAY,CAAsC,CAAC,CAChDG,aAAa,CAAQ,CAAC;IAC3B,CAAC,CAAC;IACFF,EAA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D,YAAY,CAAU,CAAC,CAACI,OAAO,CAACD,aAAa,CAE3C,CAAC;MACH;MACAH,YAAY,CAAgC,CAAC,CAACG,aAAa,CAEzD,CAAC;;MAEH;MACAH,YAAY,CAAyB,CAAC,CAACG,aAAa,CAAQ,CAAC;IAC/D,CAAC,CAAC;IAEFF,EAAE,CAAC,oDAAoD,EAAE,MAAM;MAE7DD,YAAY,CAAU,CAAC,CAACI,OAAO,CAC5BD,aAAa,CAAsC,CAAC;MACvD;MACAH,YAAY,CAAgC,CAAC,CAACG,aAAa,CAEzD,CAAC;;MAEH;MACAH,YAAY,CAAyB,CAAC,CAACG,aAAa,CAAQ,CAAC;IAC/D,CAAC,CAAC;IAEFF,EAAE,CAAC,8CAA8C,EAAE,MAAM;MACvDD,YAAY,CAAoC,CAAC,CAACI,OAAO,CACtDD,aAAa,CAEZ,CAAC;IACP,CAAC,CAAC;IAEFF,EAAE,CAAC,4CAA4C,EAAE,MAAM;MACrDD,YAAY,CAAkC,CAAC,CAACI,OAAO,CACpDD,aAAa,CAEZ,CAAC;IACP,CAAC,CAAC;IAEFF,EAAE,CAAC,gDAAgD,EAAE,MAAM;MACzDD,YAAY,CAAqC,CAAC,CAC/CG,aAAa,CAEZ,CAAC;IACP,CAAC,CAAC;EACJ,CAAC,CAAC;EAEFJ,QAAQ,CAAC,2CAA2C,EAAE,MAAM;IAC1D,MAAMM,aAAa,GAAGH,mBAAmB,CAAgB,CAAC;IAE1DD,EAAE,CAAC,mBAAmB,EAAE,YAAY;MACrB,MAAMI,aAAa,CAACC,SAAS,CAAC,CAAC;MAE5CN,YAAY,CAAsB,CAAC,CAACI,OAAO,CACxCD,aAAa,CAEZ,CAAC;IACP,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -13,20 +13,5 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export let DerivedProperty;
|
|
17
|
-
// readonly selectProperty: <R extends PropertyKeys<Q>>(
|
|
18
|
-
// propertyName: R,
|
|
19
|
-
// ) => DefinitionForType<
|
|
20
|
-
// Q,
|
|
21
|
-
// SimplePropertyDef.Make<
|
|
22
|
-
// CompileTimeMetadata<Q>["properties"][R]["type"],
|
|
23
|
-
// CompileTimeMetadata<Q>["properties"][R]["nullable"] extends true
|
|
24
|
-
// ? "nullable"
|
|
25
|
-
// : "non-nullable",
|
|
26
|
-
// CompileTimeMetadata<Q>["properties"][R]["multiplicity"] extends true
|
|
27
|
-
// ? "array"
|
|
28
|
-
// : "single"
|
|
29
|
-
// >
|
|
30
|
-
// >;
|
|
31
|
-
// };
|
|
16
|
+
export let DerivedProperty;
|
|
32
17
|
//# sourceMappingURL=DerivedProperty.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DerivedProperty.js","names":["DerivedProperty"],"sources":["DerivedProperty.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 { ValidAggregationKeys } from \"../aggregate/AggregatableKeys.js\";\nimport type { WhereClause } from \"../aggregate/WhereClause.js\";\nimport type {\n ObjectOrInterfaceDefinition,\n} from \"../ontology/ObjectOrInterface.js\";\nimport type { CompileTimeMetadata } from \"../ontology/ObjectTypeDefinition.js\";\nimport type { SimplePropertyDef } from \"../ontology/SimplePropertyDef.js\";\nimport type { LinkedType, LinkNames } from \"../util/LinkUtils.js\";\nimport type {\n CollectWithPropAggregations,\n MinMaxWithPropAggregateOption,\n} from \"./WithPropertiesAggregationOptions.js\";\n\ndeclare const DerivedPropertyDefinitionBrand: unique symbol;\n\nexport namespace DerivedProperty {\n export interface Definition<\n T extends SimplePropertyDef,\n Q extends ObjectOrInterfaceDefinition,\n > {\n readonly [DerivedPropertyDefinitionBrand]: true;\n }\n\n export type Clause<\n Q extends ObjectOrInterfaceDefinition,\n > = {\n [key: string]: DerivedPropertyCreator<Q, SimplePropertyDef>;\n };\n\n interface BaseBuilder<\n Q extends ObjectOrInterfaceDefinition,\n CONSTRAINED extends boolean,\n > extends Filterable<Q, CONSTRAINED>, Pivotable<Q, CONSTRAINED> {\n }\n\n export interface Builder<\n Q extends ObjectOrInterfaceDefinition,\n CONSTRAINED extends boolean,\n > extends BaseBuilder<Q, CONSTRAINED> {\n }\n\n export interface AggregateBuilder<\n Q extends ObjectOrInterfaceDefinition,\n CONSTRAINED extends boolean,\n > extends BaseBuilder<Q, CONSTRAINED>, Aggregatable<Q> {\n }\n\n
|
|
1
|
+
{"version":3,"file":"DerivedProperty.js","names":["DerivedProperty"],"sources":["DerivedProperty.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 { ValidAggregationKeys } from \"../aggregate/AggregatableKeys.js\";\nimport type { WhereClause } from \"../aggregate/WhereClause.js\";\nimport type {\n ObjectOrInterfaceDefinition,\n PropertyKeys,\n} from \"../ontology/ObjectOrInterface.js\";\nimport type { CompileTimeMetadata } from \"../ontology/ObjectTypeDefinition.js\";\nimport type { SimplePropertyDef } from \"../ontology/SimplePropertyDef.js\";\nimport type { LinkedType, LinkNames } from \"../util/LinkUtils.js\";\nimport type {\n DatetimeExpressions,\n DefinitionForType,\n NumericExpressions,\n} from \"./Expressions.js\";\nimport type {\n CollectWithPropAggregations,\n MinMaxWithPropAggregateOption,\n} from \"./WithPropertiesAggregationOptions.js\";\n\ndeclare const DerivedPropertyDefinitionBrand: unique symbol;\n\nexport namespace DerivedProperty {\n export interface Definition<\n T extends SimplePropertyDef,\n Q extends ObjectOrInterfaceDefinition,\n > {\n readonly [DerivedPropertyDefinitionBrand]: true;\n }\n\n export interface NumericPropertyDefinition<\n T extends SimplePropertyDef,\n Q extends ObjectOrInterfaceDefinition,\n > extends Definition<T, Q>, NumericExpressions<Q, T> {}\n\n export interface DatetimePropertyDefinition<\n T extends SimplePropertyDef,\n Q extends ObjectOrInterfaceDefinition,\n > extends Definition<T, Q>, DatetimeExpressions<Q, T> {}\n\n export type Clause<\n Q extends ObjectOrInterfaceDefinition,\n > = {\n [key: string]: DerivedPropertyCreator<Q, SimplePropertyDef>;\n };\n\n interface BaseBuilder<\n Q extends ObjectOrInterfaceDefinition,\n CONSTRAINED extends boolean,\n > extends Filterable<Q, CONSTRAINED>, Pivotable<Q, CONSTRAINED> {\n }\n\n export interface Builder<\n Q extends ObjectOrInterfaceDefinition,\n CONSTRAINED extends boolean,\n > extends BaseBuilder<Q, CONSTRAINED>, Selectable<Q>, Constant<Q> {\n }\n\n export interface AggregateBuilder<\n Q extends ObjectOrInterfaceDefinition,\n CONSTRAINED extends boolean,\n > extends BaseBuilder<Q, CONSTRAINED>, Aggregatable<Q> {\n }\n\n export interface SelectPropertyBuilder<\n Q extends ObjectOrInterfaceDefinition,\n CONSTRAINED extends boolean,\n > extends AggregateBuilder<Q, CONSTRAINED>, Selectable<Q> {\n }\n\n export type ValidParts = \"DAYS\" | \"MONTHS\" | \"QUARTERS\" | \"YEARS\";\n}\n\nexport type DerivedPropertyCreator<\n Q extends ObjectOrInterfaceDefinition,\n T extends SimplePropertyDef,\n> = (\n baseObjectSet: DerivedProperty.Builder<Q, false>,\n) =>\n | DerivedProperty.Definition<T, Q>\n | DerivedProperty.NumericPropertyDefinition<T, Q>\n | DerivedProperty.DatetimePropertyDefinition<T, Q>;\n\ntype BuilderTypeFromConstraint<\n Q extends ObjectOrInterfaceDefinition,\n CONSTRAINED extends boolean,\n> = CONSTRAINED extends true ? DerivedProperty.AggregateBuilder<Q, true>\n : DerivedProperty.SelectPropertyBuilder<Q, false>;\n\ntype Filterable<\n Q extends ObjectOrInterfaceDefinition,\n CONSTRAINED extends boolean,\n> = {\n readonly where: (\n clause: WhereClause<Q>,\n ) => BuilderTypeFromConstraint<Q, CONSTRAINED>;\n};\n\ntype Pivotable<\n Q extends ObjectOrInterfaceDefinition,\n CONSTRAINED extends boolean,\n> = {\n readonly pivotTo: <L extends LinkNames<Q>>(\n type: L,\n ) => CONSTRAINED extends true\n ? DerivedProperty.AggregateBuilder<LinkedType<Q, L>, true>\n : NonNullable<CompileTimeMetadata<Q>[\"links\"][L][\"multiplicity\"]> extends\n true ? DerivedProperty.AggregateBuilder<LinkedType<Q, L>, true>\n : DerivedProperty.SelectPropertyBuilder<LinkedType<Q, L>, false>;\n};\n\ntype Constant<Q extends ObjectOrInterfaceDefinition> = {\n readonly constant: {\n readonly double: (\n value: number,\n ) => DerivedProperty.NumericPropertyDefinition<\n SimplePropertyDef.Make<\"double\", \"non-nullable\", \"single\">,\n Q\n >;\n\n readonly integer: (\n value: number,\n ) => DerivedProperty.NumericPropertyDefinition<\n SimplePropertyDef.Make<\"integer\", \"non-nullable\", \"single\">,\n Q\n >;\n readonly long: (\n value: string,\n ) => DerivedProperty.NumericPropertyDefinition<\n SimplePropertyDef.Make<\"long\", \"non-nullable\", \"single\">,\n Q\n >;\n\n readonly datetime: (\n value: string,\n ) => DerivedProperty.DatetimePropertyDefinition<\n SimplePropertyDef.Make<\"datetime\", \"non-nullable\", \"single\">,\n Q\n >;\n readonly timestamp: (\n value: string,\n ) => DerivedProperty.DatetimePropertyDefinition<\n SimplePropertyDef.Make<\"timestamp\", \"non-nullable\", \"single\">,\n Q\n >;\n };\n};\n\ntype Aggregatable<\n Q extends ObjectOrInterfaceDefinition,\n> = {\n readonly aggregate: <\n V extends ValidAggregationKeys<\n Q,\n \"withPropertiesAggregate\"\n >,\n >(\n aggregationSpecifier: V,\n opts?: V extends `${any}:${infer P}`\n ? P extends CollectWithPropAggregations ? { limit: number }\n : P extends \"approximatePercentile\" ? { percentile: number }\n : never\n : never,\n ) => DefinitionForType<\n Q,\n V extends `${infer N}:${infer P}`\n ? P extends CollectWithPropAggregations ? SimplePropertyDef.Make<\n CompileTimeMetadata<Q>[\"properties\"][N][\"type\"],\n \"nullable\",\n \"array\"\n >\n : P extends MinMaxWithPropAggregateOption ? SimplePropertyDef.Make<\n CompileTimeMetadata<Q>[\"properties\"][N][\"type\"],\n \"nullable\",\n \"single\"\n >\n : P extends \"approximateDistinct\" | \"exactDistinct\"\n ? SimplePropertyDef.Make<\n \"integer\",\n \"non-nullable\",\n \"single\"\n >\n : SimplePropertyDef.Make<\n \"double\",\n \"nullable\",\n \"single\"\n >\n : V extends \"$count\" ? SimplePropertyDef.Make<\n \"integer\",\n \"non-nullable\",\n \"single\"\n >\n : never\n >;\n};\n\ntype Selectable<Q extends ObjectOrInterfaceDefinition> = {\n readonly selectProperty: <R extends PropertyKeys<Q>>(\n propertyName: R,\n ) => DefinitionForType<\n Q,\n SimplePropertyDef.Make<\n CompileTimeMetadata<Q>[\"properties\"][R][\"type\"],\n CompileTimeMetadata<Q>[\"properties\"][R][\"nullable\"] extends true\n ? \"nullable\"\n : \"non-nullable\",\n CompileTimeMetadata<Q>[\"properties\"][R][\"multiplicity\"] extends true\n ? \"array\"\n : \"single\"\n >\n >;\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAdA,WAqCiBA,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Expressions.js","names":[],"sources":["Expressions.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ObjectOrInterfaceDefinition,\n PropertyKeys,\n} from \"../ontology/ObjectOrInterface.js\";\nimport type { CompileTimeMetadata } from \"../ontology/ObjectTypeDefinition.js\";\nimport type { SimplePropertyDef } from \"../ontology/SimplePropertyDef.js\";\nimport type { WirePropertyTypes } from \"../ontology/WirePropertyTypes.js\";\nimport type { DerivedProperty } from \"./DerivedProperty.js\";\n\ntype WithPropertiesNumerics =\n | \"integer\"\n | \"double\"\n | \"float\"\n | \"short\"\n | \"long\";\n\ntype WithPropertiesDatetime =\n | \"datetime\"\n | \"timestamp\";\n\nexport type DefinitionForType<\n Q extends ObjectOrInterfaceDefinition,\n T extends SimplePropertyDef,\n> = SimplePropertyDef.ExtractMultiplicity<T> extends \"array\"\n ? DerivedProperty.Definition<T, Q>\n : SimplePropertyDef.ExtractWirePropertyType<T> extends WithPropertiesNumerics\n ? DerivedProperty.NumericPropertyDefinition<T, Q>\n : SimplePropertyDef.ExtractWirePropertyType<T> extends WithPropertiesDatetime\n ? DerivedProperty.DatetimePropertyDefinition<T, Q>\n : DerivedProperty.Definition<T, Q>;\n\ntype NumericExpressionArg<Q extends ObjectOrInterfaceDefinition> =\n | number\n | DerivedProperty.NumericPropertyDefinition<any, Q>;\n\ntype ReturnTypeForNumericMethod<\n Q extends ObjectOrInterfaceDefinition,\n LEFT extends WirePropertyTypes,\n RIGHT extends WirePropertyTypes,\n> = \"double\" extends (LEFT | RIGHT) ? DerivedProperty.NumericPropertyDefinition<\n SimplePropertyDef.Make<\"double\", \"non-nullable\", \"single\">,\n Q\n >\n : \"float\" extends (LEFT | RIGHT) ? DerivedProperty.NumericPropertyDefinition<\n SimplePropertyDef.Make<\"double\", \"non-nullable\", \"single\">,\n Q\n >\n : \"long\" extends (LEFT | RIGHT) ? DerivedProperty.NumericPropertyDefinition<\n SimplePropertyDef.Make<\"long\", \"non-nullable\", \"single\">,\n Q\n >\n : DerivedProperty.NumericPropertyDefinition<\n SimplePropertyDef.Make<\"integer\", \"non-nullable\", \"single\">,\n Q\n >;\n\ntype ReturnTypeForDatetimeMethod<\n Q extends ObjectOrInterfaceDefinition,\n LEFT extends WirePropertyTypes,\n RIGHT extends WirePropertyTypes,\n> = \"timestamp\" extends (LEFT | RIGHT)\n ? DerivedProperty.DatetimePropertyDefinition<\n SimplePropertyDef.Make<\"timestamp\", \"non-nullable\", \"single\">,\n Q\n >\n : DerivedProperty.DatetimePropertyDefinition<\n SimplePropertyDef.Make<\"datetime\", \"non-nullable\", \"single\">,\n Q\n >;\n\ntype ExtractWirePropertyTypeFromNumericArg<\n Q extends ObjectOrInterfaceDefinition,\n ARG extends NumericExpressionArg<Q>,\n> = ARG extends number ? \"double\"\n : ARG extends DerivedProperty.NumericPropertyDefinition<infer T, Q>\n ? T extends SimplePropertyDef ? SimplePropertyDef.ExtractWirePropertyType<T>\n : never\n : ARG extends PropertyKeys.Filtered<Q, WithPropertiesNumerics>\n ? NonNullable<CompileTimeMetadata<Q>[\"properties\"][ARG][\"type\"]>\n : never;\n\nexport type NumericExpressions<\n Q extends ObjectOrInterfaceDefinition,\n LEFT_PROPERTY_TYPE extends SimplePropertyDef,\n> = {\n readonly add: <A extends NumericExpressionArg<Q>>(\n value: A,\n ) => ReturnTypeForNumericMethod<\n Q,\n SimplePropertyDef.ExtractWirePropertyType<LEFT_PROPERTY_TYPE>,\n ExtractWirePropertyTypeFromNumericArg<Q, A>\n >;\n\n readonly subtract: <A extends NumericExpressionArg<Q>>(\n value: A,\n ) => ReturnTypeForNumericMethod<\n Q,\n SimplePropertyDef.ExtractWirePropertyType<LEFT_PROPERTY_TYPE>,\n ExtractWirePropertyTypeFromNumericArg<Q, A>\n >;\n\n readonly multiply: <A extends NumericExpressionArg<Q>>(\n value: A,\n ) => ReturnTypeForNumericMethod<\n Q,\n SimplePropertyDef.ExtractWirePropertyType<LEFT_PROPERTY_TYPE>,\n ExtractWirePropertyTypeFromNumericArg<Q, A>\n >;\n\n readonly divide: <A extends NumericExpressionArg<Q>>(\n value: A,\n ) => ReturnTypeForNumericMethod<\n Q,\n SimplePropertyDef.ExtractWirePropertyType<LEFT_PROPERTY_TYPE>,\n ExtractWirePropertyTypeFromNumericArg<Q, A>\n >;\n\n readonly abs: () => DerivedProperty.NumericPropertyDefinition<\n LEFT_PROPERTY_TYPE,\n Q\n >;\n\n readonly negate: () => DerivedProperty.NumericPropertyDefinition<\n LEFT_PROPERTY_TYPE,\n Q\n >;\n\n readonly max: <A extends NumericExpressionArg<Q>>(\n value: A,\n ) => ReturnTypeForNumericMethod<\n Q,\n SimplePropertyDef.ExtractWirePropertyType<LEFT_PROPERTY_TYPE>,\n ExtractWirePropertyTypeFromNumericArg<Q, A>\n >;\n\n readonly min: <A extends NumericExpressionArg<Q>>(\n value: A,\n ) => ReturnTypeForNumericMethod<\n Q,\n SimplePropertyDef.ExtractWirePropertyType<LEFT_PROPERTY_TYPE>,\n ExtractWirePropertyTypeFromNumericArg<Q, A>\n >;\n};\n\ntype DatetimeExpressionArg<Q extends ObjectOrInterfaceDefinition> =\n DerivedProperty.DatetimePropertyDefinition<any, Q>;\n\ntype ExtractPropertyTypeFromDatetimeArg<\n Q extends ObjectOrInterfaceDefinition,\n ARG extends DatetimeExpressionArg<Q>,\n> = ARG extends DerivedProperty.DatetimePropertyDefinition<infer T, Q>\n ? T extends SimplePropertyDef ? SimplePropertyDef.ExtractWirePropertyType<T>\n : never\n : ARG extends PropertyKeys.Filtered<Q, WithPropertiesDatetime>\n ? NonNullable<CompileTimeMetadata<Q>[\"properties\"][ARG][\"type\"]>\n : never;\n\nexport type DatetimeExpressions<\n Q extends ObjectOrInterfaceDefinition,\n LEFT_PROPERTY_TYPE extends SimplePropertyDef,\n> = {\n readonly min: <A extends DatetimeExpressionArg<Q>>(\n value: A,\n ) => ReturnTypeForDatetimeMethod<\n Q,\n SimplePropertyDef.ExtractWirePropertyType<LEFT_PROPERTY_TYPE>,\n ExtractPropertyTypeFromDatetimeArg<Q, A>\n >;\n readonly max: (\n value: DatetimeExpressionArg<Q>,\n ) => ReturnTypeForDatetimeMethod<\n Q,\n SimplePropertyDef.ExtractWirePropertyType<LEFT_PROPERTY_TYPE>,\n ExtractPropertyTypeFromDatetimeArg<Q, typeof value>\n >;\n readonly extractPart: (\n value: DerivedProperty.ValidParts,\n ) => DerivedProperty.Definition<\n SimplePropertyDef.Make<\"string\", \"non-nullable\", \"single\">,\n Q\n >;\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["DistanceUnitMapping","DurationMapping","isOk","TimeseriesDurationMapping"],"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 { ActionReturnTypeForOptions } from \"./actions/ActionReturnTypeForOptions.js\";\nexport type {\n ActionEditResponse,\n ActionParam,\n ActionValidationResponse,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n} from \"./actions/Actions.js\";\nexport type { ValidAggregationKeys } from \"./aggregate/AggregatableKeys.js\";\nexport type { AggregateOpts } from \"./aggregate/AggregateOpts.js\";\nexport type { AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy } from \"./aggregate/AggregateOptsThatErrors.js\";\nexport type { AggregationResultsWithGroups } from \"./aggregate/AggregationResultsWithGroups.js\";\nexport type { AggregationResultsWithoutGroups } from \"./aggregate/AggregationResultsWithoutGroups.js\";\nexport type { AggregationClause } from \"./aggregate/AggregationsClause.js\";\nexport type { AggregationsResults } from \"./aggregate/AggregationsResults.js\";\nexport type { GeoFilterOptions } from \"./aggregate/GeoFilter.js\";\nexport { DistanceUnitMapping } from \"./aggregate/WhereClause.js\";\nexport type {\n GeoFilter_Intersects,\n GeoFilter_Within,\n PossibleWhereClauseFilters,\n WhereClause,\n} from \"./aggregate/WhereClause.js\";\nexport type { OsdkObjectPropertyType } from \"./Definitions.js\";\nexport type {\n OsdkObjectLinksObject,\n SingleLinkAccessor,\n} from \"./definitions/LinkDefinitions.js\";\nexport type { DerivedProperty } from \"./derivedProperties/DerivedProperty.js\";\nexport { DurationMapping } from \"./groupby/GroupByClause.js\";\nexport type {\n AllGroupByValues,\n GroupByClause,\n GroupByRange,\n} from \"./groupby/GroupByClause.js\";\nexport type {\n AllowedBucketKeyTypes,\n AllowedBucketTypes,\n DataValueClientToWire,\n DataValueWireToClient,\n} from \"./mapping/DataValueMapping.js\";\nexport type {\n PropertyValueWireToClient,\n} from \"./mapping/PropertyValueMapping.js\";\nexport type { Attachment, AttachmentUpload } from \"./object/Attachment.js\";\nexport type {\n AsyncIterArgs,\n Augment,\n Augments,\n FetchPageArgs,\n NullabilityAdherence,\n SelectArg,\n SelectArgToKeys,\n} from \"./object/FetchPageArgs.js\";\nexport type {\n FetchPageResult,\n SingleOsdkResult,\n} from \"./object/FetchPageResult.js\";\nexport type {
|
|
1
|
+
{"version":3,"file":"index.js","names":["DistanceUnitMapping","DurationMapping","isOk","TimeseriesDurationMapping"],"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 { ActionReturnTypeForOptions } from \"./actions/ActionReturnTypeForOptions.js\";\nexport type {\n ActionEditResponse,\n ActionParam,\n ActionValidationResponse,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n} from \"./actions/Actions.js\";\nexport type { ValidAggregationKeys } from \"./aggregate/AggregatableKeys.js\";\nexport type { AggregateOpts } from \"./aggregate/AggregateOpts.js\";\nexport type { AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy } from \"./aggregate/AggregateOptsThatErrors.js\";\nexport type { AggregationResultsWithGroups } from \"./aggregate/AggregationResultsWithGroups.js\";\nexport type { AggregationResultsWithoutGroups } from \"./aggregate/AggregationResultsWithoutGroups.js\";\nexport type { AggregationClause } from \"./aggregate/AggregationsClause.js\";\nexport type { AggregationsResults } from \"./aggregate/AggregationsResults.js\";\nexport type { GeoFilterOptions } from \"./aggregate/GeoFilter.js\";\nexport { DistanceUnitMapping } from \"./aggregate/WhereClause.js\";\nexport type {\n GeoFilter_Intersects,\n GeoFilter_Within,\n PossibleWhereClauseFilters,\n WhereClause,\n} from \"./aggregate/WhereClause.js\";\nexport type { OsdkObjectPropertyType } from \"./Definitions.js\";\nexport type {\n OsdkObjectLinksObject,\n SingleLinkAccessor,\n} from \"./definitions/LinkDefinitions.js\";\nexport type { DerivedProperty } from \"./derivedProperties/DerivedProperty.js\";\nexport { DurationMapping } from \"./groupby/GroupByClause.js\";\nexport type {\n AllGroupByValues,\n GroupByClause,\n GroupByRange,\n} from \"./groupby/GroupByClause.js\";\nexport type {\n AllowedBucketKeyTypes,\n AllowedBucketTypes,\n DataValueClientToWire,\n DataValueWireToClient,\n} from \"./mapping/DataValueMapping.js\";\nexport type {\n PropertyValueWireToClient,\n} from \"./mapping/PropertyValueMapping.js\";\nexport type { Attachment, AttachmentUpload } from \"./object/Attachment.js\";\nexport type {\n AsyncIterArgs,\n Augment,\n Augments,\n FetchPageArgs,\n NullabilityAdherence,\n SelectArg,\n SelectArgToKeys,\n} from \"./object/FetchPageArgs.js\";\nexport type {\n FetchPageResult,\n SingleOsdkResult,\n} from \"./object/FetchPageResult.js\";\nexport type {\n Media,\n MediaMetadata,\n MediaReference,\n MediaUpload,\n} from \"./object/Media.js\";\nexport { isOk } from \"./object/Result.js\";\nexport type { Result } from \"./object/Result.js\";\nexport type { BaseObjectSet } from \"./objectSet/BaseObjectSet.js\";\nexport type { ObjectSet } from \"./objectSet/ObjectSet.js\";\nexport type { ObjectSetSubscription } from \"./objectSet/ObjectSetListener.js\";\nexport type {\n ActionDefinition,\n ActionMetadata,\n} from \"./ontology/ActionDefinition.js\";\nexport type {\n InterfaceDefinition,\n InterfaceMetadata,\n} from \"./ontology/InterfaceDefinition.js\";\nexport type {\n ObjectOrInterfaceDefinition,\n PropertyKeys,\n} from \"./ontology/ObjectOrInterface.js\";\nexport type { ObjectSpecifier } from \"./ontology/ObjectSpecifier.js\";\nexport type {\n CompileTimeMetadata,\n ObjectMetadata,\n ObjectTypeDefinition,\n PropertyDef,\n VersionBound,\n} from \"./ontology/ObjectTypeDefinition.js\";\nexport type { OntologyMetadata } from \"./ontology/OntologyMetadata.js\";\nexport type { PrimaryKeyTypes } from \"./ontology/PrimaryKeyTypes.js\";\nexport type {\n ObjectQueryDataType,\n ObjectSetQueryDataType,\n QueryDataTypeDefinition,\n QueryDefinition,\n QueryMetadata,\n QueryParameterDefinition,\n ThreeDimensionalQueryAggregationDefinition,\n TwoDimensionalQueryAggregationDefinition,\n} from \"./ontology/QueryDefinition.js\";\nexport type {\n BaseWirePropertyTypes,\n WirePropertyTypes,\n} from \"./ontology/WirePropertyTypes.js\";\nexport type {\n ObjectIdentifiers,\n OsdkBase,\n PrimaryKeyType,\n} from \"./OsdkBase.js\";\nexport type { OsdkObject } from \"./OsdkObject.js\";\nexport type { ConvertProps, Osdk } from \"./OsdkObjectFrom.js\";\nexport type { PageResult } from \"./PageResult.js\";\nexport type {\n Range,\n ThreeDimensionalAggregation,\n TwoDimensionalAggregation,\n} from \"./queries/Aggregations.js\";\nexport type { QueryParam, QueryResult } from \"./queries/Queries.js\";\nexport { TimeseriesDurationMapping } from \"./timeseries/timeseries.js\";\nexport type {\n GeotimeSeriesProperty,\n TimeSeriesPoint,\n TimeSeriesProperty,\n TimeSeriesQuery,\n} from \"./timeseries/timeseries.js\";\nexport type { LinkedType, LinkNames } from \"./util/LinkUtils.js\";\nexport {};\nexport type { Logger } from \"./Logger.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkBA,SAASA,mBAAmB,QAAQ,4BAA4B;AAahE,SAASC,eAAe,QAAQ,4BAA4B;AAmC5D,SAASC,IAAI,QAAQ,oBAAoB;AAuDzC,SAASC,yBAAyB,QAAQ,4BAA4B;AAQtE","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataValueMapping.js","names":[],"sources":["DataValueMapping.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 { Attachment, AttachmentUpload } from \"../object/Attachment.js\";\nimport type { MediaReference } from \"../object/Media.js\";\n\n/**\n * Map from the DataValue type to the typescript type that we return\n */\nexport interface DataValueWireToClient {\n attachment: Attachment;\n boolean: boolean;\n byte: number;\n datetime: string;\n date: string;\n decimal: string;\n float: number;\n double: number;\n integer: number;\n long: string;\n marking: string;\n null: null;\n short: number;\n string: string;\n timestamp: string;\n mediaReference: MediaReference;\n twoDimensionalAggregation: {\n key: AllowedBucketKeyTypes;\n value: AllowedBucketTypes;\n }[];\n threeDimensionalAggregation: {\n key: AllowedBucketKeyTypes;\n groups: { key: AllowedBucketKeyTypes; value: AllowedBucketTypes }[];\n }[];\n struct: Record<string, any>;\n set: Set<any>;\n objectType: string;\n geohash: GeoJSON.Point;\n geoshape: GeoJSON.GeoJSON;\n}\n\n/**\n * Map from the DataValue type to the typescript type that we accept\n */\nexport interface DataValueClientToWire {\n attachment: string | AttachmentUpload | Blob & { readonly name: string };\n boolean: boolean;\n byte: number;\n datetime: string;\n date: string;\n decimal: string | number;\n float: number;\n double: number;\n integer: number;\n long: string | number;\n marking: string;\n null: null;\n short: number;\n string: string;\n timestamp: string;\n set: Set<any>;\n mediaReference: MediaReference;\n twoDimensionalAggregation: {\n key: AllowedBucketKeyTypes;\n value: AllowedBucketTypes;\n }[];\n threeDimensionalAggregation: {\n key: AllowedBucketKeyTypes;\n groups: { key: AllowedBucketKeyTypes; value: AllowedBucketTypes }[];\n }[];\n struct: Record<string, any>;\n objectType: string;\n geohash: GeoJSON.Point;\n geoshape: GeoJSON.GeoJSON;\n}\n\nexport type AllowedBucketTypes = string | number | boolean;\nexport type AllowedBucketKeyTypes =\n | AllowedBucketTypes\n | {\n startValue: AllowedBucketTypes;\n endValue: AllowedBucketTypes;\n };\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"DataValueMapping.js","names":[],"sources":["DataValueMapping.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 { Attachment, AttachmentUpload } from \"../object/Attachment.js\";\nimport type { MediaReference, MediaUpload } from \"../object/Media.js\";\n\n/**\n * Map from the DataValue type to the typescript type that we return\n */\nexport interface DataValueWireToClient {\n attachment: Attachment;\n boolean: boolean;\n byte: number;\n datetime: string;\n date: string;\n decimal: string;\n float: number;\n double: number;\n integer: number;\n long: string;\n marking: string;\n null: null;\n short: number;\n string: string;\n timestamp: string;\n mediaReference: MediaReference;\n twoDimensionalAggregation: {\n key: AllowedBucketKeyTypes;\n value: AllowedBucketTypes;\n }[];\n threeDimensionalAggregation: {\n key: AllowedBucketKeyTypes;\n groups: { key: AllowedBucketKeyTypes; value: AllowedBucketTypes }[];\n }[];\n struct: Record<string, any>;\n set: Set<any>;\n objectType: string;\n geohash: GeoJSON.Point;\n geoshape: GeoJSON.GeoJSON;\n}\n\n/**\n * Map from the DataValue type to the typescript type that we accept\n */\nexport interface DataValueClientToWire {\n attachment: string | AttachmentUpload | Blob & { readonly name: string };\n boolean: boolean;\n byte: number;\n datetime: string;\n date: string;\n decimal: string | number;\n float: number;\n double: number;\n integer: number;\n long: string | number;\n marking: string;\n null: null;\n short: number;\n string: string;\n timestamp: string;\n set: Set<any>;\n mediaReference: MediaReference | MediaUpload;\n twoDimensionalAggregation: {\n key: AllowedBucketKeyTypes;\n value: AllowedBucketTypes;\n }[];\n threeDimensionalAggregation: {\n key: AllowedBucketKeyTypes;\n groups: { key: AllowedBucketKeyTypes; value: AllowedBucketTypes }[];\n }[];\n struct: Record<string, any>;\n objectType: string;\n geohash: GeoJSON.Point;\n geoshape: GeoJSON.GeoJSON;\n}\n\nexport type AllowedBucketTypes = string | number | boolean;\nexport type AllowedBucketKeyTypes =\n | AllowedBucketTypes\n | {\n startValue: AllowedBucketTypes;\n endValue: AllowedBucketTypes;\n };\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Media.js","names":[],"sources":["Media.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\nexport interface Media {\n /**\n * Fetches metadata for media reference property\n */\n fetchMetadata(): Promise<MediaMetadata>;\n /**\n * Fetches content of a media reference property\n */\n fetchContents(): Promise<Response>;\n /**\n * Returns the media reference\n */\n getMediaReference(): MediaReference;\n}\n\n/**\n * Unique identifier of a media item in Foundry.\n */\nexport interface MediaReference {\n mimeType: string;\n reference: {\n type: \"mediaSetViewItem\";\n mediaSetViewItem: {\n mediaItemRid: string;\n mediaSetRid: string;\n mediaSetViewRid: string;\n };\n };\n}\n\n/**\n * Metadata of a media item\n */\nexport interface MediaMetadata {\n path?: string;\n sizeBytes: number;\n mediaType: string;\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Media.js","names":[],"sources":["Media.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\nexport interface Media {\n /**\n * Fetches metadata for media reference property\n */\n fetchMetadata(): Promise<MediaMetadata>;\n /**\n * Fetches content of a media reference property\n */\n fetchContents(): Promise<Response>;\n /**\n * Returns the media reference\n */\n getMediaReference(): MediaReference;\n}\n\n/**\n * Unique identifier of a media item in Foundry.\n */\nexport interface MediaReference {\n mimeType: string;\n reference: {\n type: \"mediaSetViewItem\";\n mediaSetViewItem: {\n mediaItemRid: string;\n mediaSetRid: string;\n mediaSetViewRid: string;\n readToken?: string;\n };\n };\n}\n\n/**\n * Object for uploading Media\n */\nexport interface MediaUpload {\n readonly path: string;\n readonly data: Blob;\n}\n\n/**\n * Metadata of a media item\n */\nexport interface MediaMetadata {\n path?: string;\n sizeBytes: number;\n mediaType: string;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -151,7 +151,7 @@ describe("ObjectSet", () => {
|
|
|
151
151
|
});
|
|
152
152
|
it("can be sub-selected", () => {
|
|
153
153
|
fauxObjectSet.withProperties({
|
|
154
|
-
"derivedPropertyName": base => base.pivotTo("lead").
|
|
154
|
+
"derivedPropertyName": base => base.pivotTo("lead").selectProperty("employeeId")
|
|
155
155
|
}).fetchOne(3, {
|
|
156
156
|
$select: ["derivedPropertyName"]
|
|
157
157
|
});
|
|
@@ -159,7 +159,7 @@ describe("ObjectSet", () => {
|
|
|
159
159
|
test("multiple properties", async () => {
|
|
160
160
|
const withFamily = fauxObjectSet.withProperties({
|
|
161
161
|
"mom": base => base.pivotTo("lead").aggregate("$count"),
|
|
162
|
-
"dad": base => base.pivotTo("lead").
|
|
162
|
+
"dad": base => base.pivotTo("lead").selectProperty("fullName"),
|
|
163
163
|
"sister": base => base.pivotTo("lead").aggregate("class:collectList")
|
|
164
164
|
});
|
|
165
165
|
expectTypeOf(withFamily).toEqualTypeOf();
|
|
@@ -175,7 +175,7 @@ describe("ObjectSet", () => {
|
|
|
175
175
|
"mom": base => base.pivotTo("lead").aggregate("$count")
|
|
176
176
|
});
|
|
177
177
|
const withParents = withMom.withProperties({
|
|
178
|
-
"dad": base => base.pivotTo("lead").
|
|
178
|
+
"dad": base => base.pivotTo("lead").selectProperty("fullName")
|
|
179
179
|
});
|
|
180
180
|
expectTypeOf(withParents).toEqualTypeOf();
|
|
181
181
|
});
|
|
@@ -194,6 +194,7 @@ describe("ObjectSet", () => {
|
|
|
194
194
|
it("collectToSet, collectToList, selectProperty, and numeric aggregations are nullable", async () => {
|
|
195
195
|
const withAggregations = fauxObjectSet.withProperties({
|
|
196
196
|
"collectSet": base => base.pivotTo("lead").aggregate("class:collectSet"),
|
|
197
|
+
"select": base => base.pivotTo("lead").selectProperty("fullName"),
|
|
197
198
|
"collectList": base => base.pivotTo("lead").aggregate("class:collectList"),
|
|
198
199
|
"min": base => base.pivotTo("lead").aggregate("employeeId:max"),
|
|
199
200
|
"max": base => base.pivotTo("lead").aggregate("employeeId:min"),
|
|
@@ -208,6 +209,7 @@ describe("ObjectSet", () => {
|
|
|
208
209
|
describe("fetch functions return correct Osdk.Instance", () => {
|
|
209
210
|
const withFamily = fauxObjectSet.withProperties({
|
|
210
211
|
"mom": base => base.pivotTo("lead").aggregate("$count"),
|
|
212
|
+
"dad": base => base.pivotTo("lead").selectProperty("fullName"),
|
|
211
213
|
"sister": base => base.pivotTo("lead").aggregate("class:collectList")
|
|
212
214
|
});
|
|
213
215
|
it("works with .where", async () => {
|
|
@@ -242,7 +244,7 @@ describe("ObjectSet", () => {
|
|
|
242
244
|
});
|
|
243
245
|
it("Works with selecting all RDPs", async () => {
|
|
244
246
|
await withFamily.fetchPage({
|
|
245
|
-
$select: ["mom", "sister"]
|
|
247
|
+
$select: ["mom", "dad", "sister"]
|
|
246
248
|
});
|
|
247
249
|
expectTypeOf().toEqualTypeOf();
|
|
248
250
|
expectTypeOf().toEqualTypeOf();
|
|
@@ -348,6 +350,11 @@ describe("ObjectSet", () => {
|
|
|
348
350
|
expectTypeOf(result.sumNumber).toEqualTypeOf();
|
|
349
351
|
expectTypeOf(result.avgNumber).toEqualTypeOf();
|
|
350
352
|
});
|
|
353
|
+
it("Merged object type is equivalent to original", () => {
|
|
354
|
+
// should be assignable. testing explicitly due to break in 2.2 release.
|
|
355
|
+
|
|
356
|
+
expectTypeOf().branded.toEqualTypeOf();
|
|
357
|
+
});
|
|
351
358
|
});
|
|
352
359
|
describe("aggregate", () => {
|
|
353
360
|
it("has correct aggregation keys", () => {
|
|
@@ -365,5 +372,204 @@ describe("ObjectSet", () => {
|
|
|
365
372
|
});
|
|
366
373
|
});
|
|
367
374
|
});
|
|
375
|
+
describe("expressions", () => {
|
|
376
|
+
"Test all property types";
|
|
377
|
+
|
|
378
|
+
describe("numeric expressions", () => {
|
|
379
|
+
it("provides correct methods off of selected numeric derived property definitions", () => {
|
|
380
|
+
fauxObjectSet.withProperties({
|
|
381
|
+
"myProp1": base => {
|
|
382
|
+
const selectedInteger = base.pivotTo("lead").selectProperty("employeeId");
|
|
383
|
+
expectTypeOf(selectedInteger).toEqualTypeOf;
|
|
384
|
+
selectedInteger.add(1);
|
|
385
|
+
selectedInteger.subtract(1);
|
|
386
|
+
selectedInteger.multiply(1);
|
|
387
|
+
selectedInteger.divide(1);
|
|
388
|
+
selectedInteger.abs();
|
|
389
|
+
selectedInteger.negate();
|
|
390
|
+
selectedInteger.max(1);
|
|
391
|
+
selectedInteger.min(1);
|
|
392
|
+
|
|
393
|
+
// @ts-expect-error
|
|
394
|
+
selectedInteger.extractPart("1");
|
|
395
|
+
expectTypeOf(base.pivotTo("lead").selectProperty("performanceScore")).toEqualTypeOf();
|
|
396
|
+
expectTypeOf(base.pivotTo("lead").selectProperty("rank")).toEqualTypeOf();
|
|
397
|
+
expectTypeOf(base.pivotTo("lead").selectProperty("yearsOfExperience")).toEqualTypeOf();
|
|
398
|
+
expectTypeOf(base.pivotTo("lead").selectProperty("hourlyRate")).toEqualTypeOf();
|
|
399
|
+
return selectedInteger;
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
});
|
|
403
|
+
it("provides correct methods off of selection definitions", () => {
|
|
404
|
+
fauxObjectSet.withProperties({
|
|
405
|
+
"myProp1": base => {
|
|
406
|
+
const selectedInteger = base.pivotTo("lead").selectProperty("employeeId");
|
|
407
|
+
expectTypeOf(selectedInteger).toEqualTypeOf;
|
|
408
|
+
selectedInteger.add(1);
|
|
409
|
+
selectedInteger.subtract(1);
|
|
410
|
+
selectedInteger.multiply(1);
|
|
411
|
+
selectedInteger.divide(1);
|
|
412
|
+
selectedInteger.abs();
|
|
413
|
+
selectedInteger.negate();
|
|
414
|
+
selectedInteger.max(1);
|
|
415
|
+
selectedInteger.min(1);
|
|
416
|
+
|
|
417
|
+
// @ts-expect-error
|
|
418
|
+
selectedInteger.extractPart("1");
|
|
419
|
+
expectTypeOf(base.pivotTo("lead").selectProperty("performanceScore")).toEqualTypeOf();
|
|
420
|
+
expectTypeOf(base.pivotTo("lead").selectProperty("rank")).toEqualTypeOf();
|
|
421
|
+
expectTypeOf(base.pivotTo("lead").selectProperty("yearsOfExperience")).toEqualTypeOf();
|
|
422
|
+
expectTypeOf(base.pivotTo("lead").selectProperty("hourlyRate")).toEqualTypeOf();
|
|
423
|
+
return selectedInteger;
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
});
|
|
427
|
+
it("provides correct methods off of aggregated properties", () => {
|
|
428
|
+
fauxObjectSet.withProperties({
|
|
429
|
+
"myProp1": base => {
|
|
430
|
+
const maxAggregation = base.pivotTo("lead").aggregate("employeeId:max");
|
|
431
|
+
expectTypeOf(maxAggregation).toEqualTypeOf;
|
|
432
|
+
maxAggregation.add(1);
|
|
433
|
+
maxAggregation.subtract(1);
|
|
434
|
+
maxAggregation.multiply(1);
|
|
435
|
+
maxAggregation.divide(1);
|
|
436
|
+
maxAggregation.abs();
|
|
437
|
+
maxAggregation.negate();
|
|
438
|
+
maxAggregation.max(1);
|
|
439
|
+
maxAggregation.min(1);
|
|
440
|
+
expectTypeOf(base.pivotTo("peeps").aggregate("employeeId:sum")).toEqualTypeOf();
|
|
441
|
+
expectTypeOf(base.pivotTo("peeps").aggregate("employeeId:avg")).toEqualTypeOf();
|
|
442
|
+
expectTypeOf(base.pivotTo("peeps").aggregate("employeeId:min")).toEqualTypeOf();
|
|
443
|
+
const collectList = base.pivotTo("peeps").aggregate("employeeId:collectList");
|
|
444
|
+
expectTypeOf(collectList).toEqualTypeOf();
|
|
445
|
+
|
|
446
|
+
// @ts-expect-error
|
|
447
|
+
collectList.plus(1);
|
|
448
|
+
expectTypeOf(base.pivotTo("peeps").aggregate("employeeId:collectList")).toEqualTypeOf();
|
|
449
|
+
return maxAggregation;
|
|
450
|
+
}
|
|
451
|
+
});
|
|
452
|
+
});
|
|
453
|
+
it("correctly coerces numeric types", () => {
|
|
454
|
+
fauxObjectSet.withProperties({
|
|
455
|
+
"myProp1": base => {
|
|
456
|
+
const intAndLong = base.pivotTo("lead").selectProperty("employeeId").add(base.selectProperty("yearsOfExperience")).add(base.selectProperty("employeeId"));
|
|
457
|
+
expectTypeOf(intAndLong).toEqualTypeOf();
|
|
458
|
+
const intAndDouble = base.pivotTo("lead").selectProperty("employeeId").add(base.selectProperty("performanceScore")).add(base.selectProperty("employeeId"));
|
|
459
|
+
expectTypeOf(intAndDouble).toEqualTypeOf();
|
|
460
|
+
const longAndDouble = base.pivotTo("lead").selectProperty("yearsOfExperience").add(base.selectProperty("performanceScore")).add(base.selectProperty("yearsOfExperience"));
|
|
461
|
+
expectTypeOf(longAndDouble).toEqualTypeOf();
|
|
462
|
+
const longAndLong = base.pivotTo("lead").selectProperty("yearsOfExperience").add(base.selectProperty("yearsOfExperience"));
|
|
463
|
+
expectTypeOf(longAndLong).toEqualTypeOf();
|
|
464
|
+
const intAndInt = base.pivotTo("lead").selectProperty("employeeId").add(base.selectProperty("employeeId"));
|
|
465
|
+
expectTypeOf(intAndInt).toEqualTypeOf();
|
|
466
|
+
const intLongDoubleChain = base.pivotTo("lead").selectProperty("employeeId").add(base.selectProperty("yearsOfExperience")).add(base.selectProperty("employeeId")).add(base.selectProperty("performanceScore")).add(base.selectProperty("employeeId"));
|
|
467
|
+
expectTypeOf(intLongDoubleChain).toEqualTypeOf();
|
|
468
|
+
const shortAndIntReturnsInt = base.pivotTo("lead").selectProperty("rank").add(base.selectProperty("employeeId"));
|
|
469
|
+
expectTypeOf(shortAndIntReturnsInt).toEqualTypeOf();
|
|
470
|
+
const shortAndFloatReturnsDouble = base.pivotTo("lead").selectProperty("rank").add(base.selectProperty("hourlyRate"));
|
|
471
|
+
expectTypeOf(shortAndFloatReturnsDouble).toEqualTypeOf();
|
|
472
|
+
return intLongDoubleChain;
|
|
473
|
+
}
|
|
474
|
+
});
|
|
475
|
+
});
|
|
476
|
+
it("allows adding number literals as a double", () => {
|
|
477
|
+
fauxObjectSet.withProperties({
|
|
478
|
+
"myProp1": base => {
|
|
479
|
+
const plus = base.pivotTo("lead").selectProperty("employeeId").add(1);
|
|
480
|
+
expectTypeOf(plus).toEqualTypeOf();
|
|
481
|
+
return plus;
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
});
|
|
485
|
+
it("allows adding literals via base.constant", () => {
|
|
486
|
+
fauxObjectSet.withProperties({
|
|
487
|
+
"myProp1": base => {
|
|
488
|
+
const plus = base.pivotTo("lead").selectProperty("employeeId").add(base.constant.double(1));
|
|
489
|
+
expectTypeOf(plus).toEqualTypeOf();
|
|
490
|
+
const intPlusIntReturnsInt = base.pivotTo("lead").selectProperty("employeeId").add(base.constant.integer(1));
|
|
491
|
+
expectTypeOf(intPlusIntReturnsInt).toEqualTypeOf();
|
|
492
|
+
return plus;
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
});
|
|
496
|
+
it("allows correctly typed nested property definitions", () => {
|
|
497
|
+
fauxObjectSet.withProperties({
|
|
498
|
+
"myProp1": base => {
|
|
499
|
+
const nested = base.pivotTo("lead").selectProperty("employeeId").add(base.pivotTo("peeps").aggregate("employeeId:sum"));
|
|
500
|
+
expectTypeOf(nested).toEqualTypeOf();
|
|
501
|
+
return nested;
|
|
502
|
+
}
|
|
503
|
+
});
|
|
504
|
+
});
|
|
505
|
+
it("allows correctly types property keys off the linked OT", () => {
|
|
506
|
+
fauxObjectSet.withProperties({
|
|
507
|
+
"myProp1": base => {
|
|
508
|
+
const nested = base.pivotTo("lead").selectProperty("employeeId").add(base.selectProperty("performanceScore"));
|
|
509
|
+
expectTypeOf(nested).toEqualTypeOf();
|
|
510
|
+
return nested;
|
|
511
|
+
}
|
|
512
|
+
});
|
|
513
|
+
});
|
|
514
|
+
|
|
515
|
+
// it("allows correctly types property keys off the base OT", () => {});
|
|
516
|
+
});
|
|
517
|
+
describe("datetime expressions", () => {
|
|
518
|
+
it("provides correct methods off of datetime selections", () => {
|
|
519
|
+
fauxObjectSet.withProperties({
|
|
520
|
+
"myProp1": base => {
|
|
521
|
+
const selectedDatetime = base.pivotTo("lead").selectProperty("dateOfJoining");
|
|
522
|
+
expectTypeOf(selectedDatetime).toEqualTypeOf();
|
|
523
|
+
selectedDatetime.max(base.selectProperty("dateOfJoining"));
|
|
524
|
+
selectedDatetime.min(base.selectProperty("lastUpdated"));
|
|
525
|
+
expectTypeOf(base.pivotTo("lead").selectProperty("lastUpdated")).toEqualTypeOf();
|
|
526
|
+
return selectedDatetime;
|
|
527
|
+
}
|
|
528
|
+
});
|
|
529
|
+
});
|
|
530
|
+
it("correctly coerces datetime types", () => {
|
|
531
|
+
fauxObjectSet.withProperties({
|
|
532
|
+
"myProp1": base => {
|
|
533
|
+
const max = base.pivotTo("lead").selectProperty("dateOfJoining").max(base.selectProperty("lastUpdated"));
|
|
534
|
+
expectTypeOf(max).toEqualTypeOf();
|
|
535
|
+
const min = base.pivotTo("lead").selectProperty("dateOfJoining").min(base.selectProperty("dateOfJoining"));
|
|
536
|
+
expectTypeOf(min).toEqualTypeOf();
|
|
537
|
+
return max;
|
|
538
|
+
}
|
|
539
|
+
});
|
|
540
|
+
});
|
|
541
|
+
it("allows adding literals via base.constant", () => {
|
|
542
|
+
fauxObjectSet.withProperties({
|
|
543
|
+
"myProp1": base => {
|
|
544
|
+
const dateAndDateReturnDate = base.pivotTo("lead").selectProperty("dateOfJoining").min(base.constant.datetime("2025-01-01T00:00:00Z"));
|
|
545
|
+
expectTypeOf(dateAndDateReturnDate).toEqualTypeOf();
|
|
546
|
+
const dateAndTimeReturnTime = base.pivotTo("lead").selectProperty("dateOfJoining").min(base.constant.timestamp("2025-01-01T00:00:00Z"));
|
|
547
|
+
expectTypeOf(dateAndTimeReturnTime).toEqualTypeOf();
|
|
548
|
+
return dateAndTimeReturnTime;
|
|
549
|
+
}
|
|
550
|
+
});
|
|
551
|
+
});
|
|
552
|
+
it("allows correctly typed nested property definitions", () => {
|
|
553
|
+
fauxObjectSet.withProperties({
|
|
554
|
+
"myProp1": base => {
|
|
555
|
+
const nested = base.pivotTo("lead").selectProperty("dateOfJoining").min(base.pivotTo("lead").pivotTo("lead").selectProperty("lastUpdated"));
|
|
556
|
+
expectTypeOf(nested).toEqualTypeOf();
|
|
557
|
+
return nested;
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
});
|
|
561
|
+
it("allows correctly typed property keys off the linked OT", () => {
|
|
562
|
+
fauxObjectSet.withProperties({
|
|
563
|
+
"myProp1": base => {
|
|
564
|
+
const nested = base.pivotTo("lead").selectProperty("dateOfJoining").min(base.selectProperty("lastUpdated"));
|
|
565
|
+
expectTypeOf(nested).toEqualTypeOf();
|
|
566
|
+
return nested;
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
});
|
|
570
|
+
|
|
571
|
+
// it("allows correctly typed property keys off the base OT", () => {});
|
|
572
|
+
});
|
|
573
|
+
});
|
|
368
574
|
});
|
|
369
575
|
//# sourceMappingURL=ObjectSet.test.js.map
|