@osdk/api 2.1.0-beta.28 → 2.1.0-beta.29

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.
Files changed (52) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/browser/OsdkObjectFrom.js.map +1 -1
  3. package/build/browser/aggregate/AggregatableKeys.js.map +1 -1
  4. package/build/browser/derivedProperties/DerivedProperty.js +17 -0
  5. package/build/browser/derivedProperties/DerivedProperty.js.map +1 -0
  6. package/build/browser/derivedProperties/WithPropertiesAggregationOptions.js +2 -0
  7. package/build/browser/derivedProperties/WithPropertiesAggregationOptions.js.map +1 -0
  8. package/build/browser/index.js.map +1 -1
  9. package/build/browser/object/FetchPageResult.js.map +1 -1
  10. package/build/browser/objectSet/ObjectSet.js.map +1 -1
  11. package/build/browser/objectSet/ObjectSet.test.js +155 -0
  12. package/build/browser/objectSet/ObjectSet.test.js.map +1 -0
  13. package/build/browser/ontology/ObjectOrInterface.js +16 -1
  14. package/build/browser/ontology/ObjectOrInterface.js.map +1 -1
  15. package/build/browser/ontology/SimplePropertyDef.js +17 -0
  16. package/build/browser/ontology/SimplePropertyDef.js.map +1 -0
  17. package/build/browser/ontology/SimplePropertyDef.test.js +48 -0
  18. package/build/browser/ontology/SimplePropertyDef.test.js.map +1 -0
  19. package/build/cjs/{ObjectSet-BjJpOctW.d.cts → ObjectSet-0c-4-xgY.d.cts} +128 -25
  20. package/build/cjs/index.cjs.map +1 -1
  21. package/build/cjs/index.d.cts +2 -2
  22. package/build/cjs/public/unstable.cjs.map +1 -1
  23. package/build/cjs/public/unstable.d.cts +2 -2
  24. package/build/esm/OsdkObjectFrom.js.map +1 -1
  25. package/build/esm/aggregate/AggregatableKeys.js.map +1 -1
  26. package/build/esm/derivedProperties/DerivedProperty.js +17 -0
  27. package/build/esm/derivedProperties/DerivedProperty.js.map +1 -0
  28. package/build/esm/derivedProperties/WithPropertiesAggregationOptions.js +2 -0
  29. package/build/esm/derivedProperties/WithPropertiesAggregationOptions.js.map +1 -0
  30. package/build/esm/index.js.map +1 -1
  31. package/build/esm/object/FetchPageResult.js.map +1 -1
  32. package/build/esm/objectSet/ObjectSet.js.map +1 -1
  33. package/build/esm/objectSet/ObjectSet.test.js +155 -0
  34. package/build/esm/objectSet/ObjectSet.test.js.map +1 -0
  35. package/build/esm/ontology/ObjectOrInterface.js +16 -1
  36. package/build/esm/ontology/ObjectOrInterface.js.map +1 -1
  37. package/build/esm/ontology/SimplePropertyDef.js +17 -0
  38. package/build/esm/ontology/SimplePropertyDef.js.map +1 -0
  39. package/build/esm/ontology/SimplePropertyDef.test.js +48 -0
  40. package/build/esm/ontology/SimplePropertyDef.test.js.map +1 -0
  41. package/build/types/OsdkObjectFrom.d.ts +7 -4
  42. package/build/types/aggregate/AggregatableKeys.d.ts +9 -2
  43. package/build/types/derivedProperties/DerivedProperty.d.ts +42 -0
  44. package/build/types/derivedProperties/WithPropertiesAggregationOptions.d.ts +4 -0
  45. package/build/types/index.d.ts +1 -0
  46. package/build/types/object/FetchPageResult.d.ts +5 -3
  47. package/build/types/objectSet/ObjectSet.d.ts +62 -17
  48. package/build/types/objectSet/ObjectSet.test.d.ts +1 -0
  49. package/build/types/ontology/ObjectOrInterface.d.ts +14 -1
  50. package/build/types/ontology/SimplePropertyDef.d.ts +18 -0
  51. package/build/types/ontology/SimplePropertyDef.test.d.ts +1 -0
  52. package/package.json +1 -1
@@ -0,0 +1,155 @@
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 { describe, expectTypeOf, it, test, vi } from "vitest";
18
+ const Employee = {
19
+ type: "object",
20
+ apiName: "Employee"
21
+ };
22
+ describe("ObjectSet", () => {
23
+ const fauxObjectSet = {
24
+ where: vi.fn(() => {
25
+ return fauxObjectSet;
26
+ }),
27
+ withProperties: vi.fn(() => {
28
+ return fauxObjectSet;
29
+ }),
30
+ fetchPage: vi.fn(() => Promise.resolve()),
31
+ asyncIter: vi.fn(() => {
32
+ return {};
33
+ })
34
+ };
35
+ describe("normal", () => {
36
+ test("select none", async () => {
37
+ await fauxObjectSet.fetchPage();
38
+ expectTypeOf().toEqualTypeOf();
39
+ });
40
+ test("select one", async () => {
41
+ await fauxObjectSet.fetchPage({
42
+ "$select": ["fullName"]
43
+ });
44
+ expectTypeOf().toEqualTypeOf();
45
+ });
46
+ });
47
+ describe(".withProperties", () => {
48
+ test("single property", async () => {
49
+ const withA = fauxObjectSet.withProperties({
50
+ "a": base => {
51
+ return base.pivotTo("lead").aggregate("class:exactDistinct");
52
+ }
53
+ });
54
+ expectTypeOf(withA).toEqualTypeOf();
55
+ await withA.fetchPage();
56
+ expectTypeOf().toEqualTypeOf();
57
+ expectTypeOf().toEqualTypeOf();
58
+ });
59
+ test("multiple properties", async () => {
60
+ const withFamily = fauxObjectSet.withProperties({
61
+ "mom": base => base.pivotTo("lead").aggregate("$count"),
62
+ "dad": base => base.pivotTo("lead").selectProperty("fullName"),
63
+ "sister": base => base.pivotTo("lead").aggregate("class:collectList")
64
+ });
65
+ expectTypeOf(withFamily).toEqualTypeOf();
66
+ await withFamily.fetchPage();
67
+ expectTypeOf().toEqualTypeOf();
68
+ expectTypeOf().toEqualTypeOf();
69
+ expectTypeOf().toEqualTypeOf();
70
+ expectTypeOf().toEqualTypeOf();
71
+ });
72
+ describe("called in succession", () => {
73
+ test("independently", () => {
74
+ const withMom = fauxObjectSet.withProperties({
75
+ "mom": base => base.pivotTo("lead").aggregate("$count")
76
+ });
77
+ const withParents = withMom.withProperties({
78
+ "dad": base => base.pivotTo("lead").selectProperty("fullName")
79
+ });
80
+ expectTypeOf(withParents).toEqualTypeOf();
81
+ });
82
+ test.todo("with calculated properties");
83
+ });
84
+ describe("fetch functions return correct Osdk.Instance", () => {
85
+ const withFamily = fauxObjectSet.withProperties({
86
+ "mom": base => base.pivotTo("lead").aggregate("$count"),
87
+ "dad": base => base.pivotTo("lead").selectProperty("fullName"),
88
+ "sister": base => base.pivotTo("lead").aggregate("class:collectList")
89
+ });
90
+ it("works with .where", async () => {
91
+ const where = withFamily.where({
92
+ "mom": 1
93
+ });
94
+ await where.fetchPage();
95
+ expectTypeOf().toEqualTypeOf();
96
+ expectTypeOf().toEqualTypeOf();
97
+ });
98
+ it("works with .async", () => {
99
+ withFamily.asyncIter();
100
+ expectTypeOf().toEqualTypeOf();
101
+ });
102
+ it("Works with no select", async () => {
103
+ await withFamily.fetchPage();
104
+ expectTypeOf().toEqualTypeOf();
105
+ });
106
+ it("Works with selecting all RDPs", async () => {
107
+ await withFamily.fetchPage({
108
+ $select: ["mom", "dad", "sister"]
109
+ });
110
+ expectTypeOf().toEqualTypeOf();
111
+ expectTypeOf().toEqualTypeOf();
112
+ });
113
+ it("Works with selecting some RDPs", async () => {
114
+ await withFamily.fetchPage({
115
+ $select: ["mom"]
116
+ });
117
+ expectTypeOf().toEqualTypeOf();
118
+ });
119
+ it("Works with selecting all non-RDP's", async () => {
120
+ await withFamily.fetchPage({
121
+ $select: ["class", "fullName"]
122
+ });
123
+ expectTypeOf().toEqualTypeOf();
124
+ expectTypeOf().toEqualTypeOf();
125
+ });
126
+ it("Works with selecting some non-RDP's", async () => {
127
+ await withFamily.fetchPage({
128
+ $select: ["class"]
129
+ });
130
+ expectTypeOf().toEqualTypeOf();
131
+ });
132
+ it("Works with selecting a mix", async () => {
133
+ await withFamily.fetchPage({
134
+ $select: ["class", "mom"]
135
+ });
136
+ expectTypeOf().toEqualTypeOf();
137
+ });
138
+ });
139
+ it("allows extracting the type", () => {
140
+ fauxObjectSet.withProperties({
141
+ "mom": base => base.pivotTo("lead").aggregate("$count")
142
+ });
143
+ expectTypeOf().toEqualTypeOf();
144
+ fauxObjectSet.withProperties({
145
+ "mom": base => base.pivotTo("lead").aggregate("$count")
146
+ });
147
+ });
148
+ it("Defining the Type", () => {
149
+ fauxObjectSet.withProperties({
150
+ "mom": base => base.pivotTo("lead").aggregate("$count")
151
+ });
152
+ });
153
+ });
154
+ });
155
+ //# sourceMappingURL=ObjectSet.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ObjectSet.test.js","names":["describe","expectTypeOf","it","test","vi","Employee","type","apiName","fauxObjectSet","where","fn","withProperties","fetchPage","Promise","resolve","asyncIter","toEqualTypeOf","withA","base","pivotTo","aggregate","withFamily","selectProperty","withMom","withParents","todo","$select"],"sources":["ObjectSet.test.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { describe, expectTypeOf, it, test, vi } from \"vitest\";\n\nimport type {\n ObjectMetadata as $ObjectMetadata,\n ObjectSet as $ObjectSet,\n ObjectTypeDefinition as $ObjectTypeDefinition,\n Osdk,\n PropertyDef as $PropertyDef,\n PropertyKeys,\n PropertyValueWireToClient as $PropType,\n SingleLinkAccessor as $SingleLinkAccessor,\n} from \"../index.js\";\n\nnamespace Employee {\n export type PropertyKeys =\n | \"fullName\"\n | \"class\";\n\n export interface Links {\n readonly lead: $SingleLinkAccessor<Employee>;\n readonly peeps: Employee.ObjectSet;\n }\n\n export interface Props {\n readonly class: $PropType[\"string\"] | undefined;\n readonly fullName: $PropType[\"string\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Employee, Employee.ObjectSet> {}\n}\n\ninterface Employee extends $ObjectTypeDefinition {\n type: \"object\";\n apiName: \"Employee\";\n __DefinitionMetadata?: {\n objectSet: Employee.ObjectSet;\n props: Employee.Props;\n linksType: Employee.Links;\n strictProps: Employee.StrictProps;\n apiName: \"Employee\";\n description: \"A full-time or part-time \\n\\n employee of our firm\";\n displayName: \"Employee\";\n icon: {\n type: \"blueprint\";\n color: \"blue\";\n name: \"person\";\n };\n implements: [\"FooInterface\"];\n interfaceMap: {\n FooInterface: {\n fooSpt: \"fullName\";\n };\n };\n inverseInterfaceMap: {\n FooInterface: {\n fullName: \"fooSpt\";\n };\n };\n links: {\n lead: $ObjectMetadata.Link<Employee, false>;\n peeps: $ObjectMetadata.Link<Employee, true>;\n };\n pluralDisplayName: \"Employees\";\n primaryKeyApiName: \"employeeId\";\n primaryKeyType: \"integer\";\n properties: {\n class: $PropertyDef<\"string\", \"nullable\", \"single\">;\n fullName: $PropertyDef<\"string\", \"nullable\", \"single\">;\n };\n rid: \"ri.ontology.main.object-type.401ac022-89eb-4591-8b7e-0a912b9efb44\";\n status: \"ACTIVE\";\n titleProperty: \"fullName\";\n type: \"object\";\n visibility: \"NORMAL\";\n };\n}\n\nconst Employee: Employee = {\n type: \"object\",\n apiName: \"Employee\",\n};\n\ndescribe(\"ObjectSet\", () => {\n const fauxObjectSet = {\n where: vi.fn(() => {\n return fauxObjectSet;\n }),\n withProperties: vi.fn(() => {\n return fauxObjectSet;\n }),\n fetchPage: vi.fn(() => Promise.resolve()),\n asyncIter: vi.fn(() => {\n return {};\n }),\n } as any as Employee.ObjectSet;\n\n describe(\"normal\", () => {\n test(\"select none\", async () => {\n const result = await fauxObjectSet.fetchPage();\n expectTypeOf<typeof result.data[0]>().toEqualTypeOf<\n Osdk.Instance<Employee, never>\n >();\n });\n\n test(\"select one\", async () => {\n const result = await fauxObjectSet.fetchPage({ \"$select\": [\"fullName\"] });\n expectTypeOf<typeof result.data[0]>().toEqualTypeOf<\n Osdk.Instance<Employee, never, \"fullName\">\n >();\n });\n });\n\n describe(\".withProperties\", () => {\n test(\"single property\", async () => {\n const withA = fauxObjectSet.withProperties({\n \"a\": (base) => {\n return base.pivotTo(\"lead\").aggregate(\"class:exactDistinct\");\n },\n });\n\n expectTypeOf(withA).toEqualTypeOf<\n $ObjectSet<Employee, {\n a: \"integer\" | undefined;\n }>\n >();\n\n const withAResults = await withA.fetchPage();\n\n expectTypeOf<typeof withAResults[\"data\"][0]>().toEqualTypeOf<\n Osdk.Instance<Employee, never, PropertyKeys<Employee>, {\n a: \"integer\" | undefined;\n }>\n >();\n\n expectTypeOf<typeof withAResults[\"data\"][0][\"a\"]>()\n .toEqualTypeOf<number | undefined>();\n });\n\n test(\"multiple properties\", async () => {\n const withFamily = fauxObjectSet.withProperties({\n \"mom\": (base) => base.pivotTo(\"lead\").aggregate(\"$count\"),\n \"dad\": (base) => base.pivotTo(\"lead\").selectProperty(\"fullName\"),\n \"sister\": (base) => base.pivotTo(\"lead\").aggregate(\"class:collectList\"),\n });\n expectTypeOf(withFamily).toEqualTypeOf<\n $ObjectSet<Employee, {\n mom: \"integer\" | undefined;\n dad: \"string\" | undefined;\n sister: \"string\"[] | undefined;\n }>\n >();\n\n const withFamilyResults = await withFamily.fetchPage();\n\n expectTypeOf<typeof withFamilyResults[\"data\"][0]>().toEqualTypeOf<\n Osdk.Instance<Employee, never, PropertyKeys<Employee>, {\n mom: \"integer\" | undefined;\n dad: \"string\" | undefined;\n sister: \"string\"[] | undefined;\n }>\n >();\n\n expectTypeOf<typeof withFamilyResults[\"data\"][0][\"mom\"]>()\n .toEqualTypeOf<number | undefined>();\n expectTypeOf<typeof withFamilyResults[\"data\"][0][\"dad\"]>()\n .toEqualTypeOf<string | undefined>();\n expectTypeOf<typeof withFamilyResults[\"data\"][0][\"sister\"]>()\n .toEqualTypeOf<string[] | undefined>();\n });\n\n describe(\"called in succession\", () => {\n test(\"independently\", () => {\n const withMom = fauxObjectSet.withProperties({\n \"mom\": (base) => base.pivotTo(\"lead\").aggregate(\"$count\"),\n });\n\n const withParents = withMom.withProperties({\n \"dad\": (base) => base.pivotTo(\"lead\").selectProperty(\"fullName\"),\n });\n\n expectTypeOf(withParents).toEqualTypeOf<\n $ObjectSet<Employee, {\n mom: \"integer\" | undefined;\n dad: \"string\" | undefined;\n }>\n >();\n });\n\n test.todo(\"with calculated properties\");\n });\n\n describe(\"fetch functions return correct Osdk.Instance\", () => {\n const withFamily = fauxObjectSet.withProperties({\n \"mom\": (base) => base.pivotTo(\"lead\").aggregate(\"$count\"),\n \"dad\": (base) => base.pivotTo(\"lead\").selectProperty(\"fullName\"),\n \"sister\": (base) => base.pivotTo(\"lead\").aggregate(\"class:collectList\"),\n });\n\n it(\"works with .where\", async () => {\n const where = withFamily.where({ \"mom\": 1 });\n const whereResults = await where.fetchPage();\n\n expectTypeOf<typeof where>().toEqualTypeOf<typeof withFamily>();\n expectTypeOf<typeof whereResults[\"data\"][0]>()\n .toEqualTypeOf<\n Osdk.Instance<Employee, never, PropertyKeys<Employee>, {\n mom: \"integer\" | undefined;\n dad: \"string\" | undefined;\n sister: \"string\"[] | undefined;\n }>\n >();\n });\n\n it(\"works with .async\", () => {\n const asyncIter = withFamily.asyncIter();\n expectTypeOf<typeof asyncIter>().toEqualTypeOf<\n AsyncIterableIterator<\n Osdk.Instance<Employee, never, PropertyKeys<Employee>, {\n mom: \"integer\" | undefined;\n dad: \"string\" | undefined;\n sister: \"string\"[] | undefined;\n }>\n >\n >();\n });\n\n it(\"Works with no select\", async () => {\n const withFamilyResults = await withFamily.fetchPage();\n\n expectTypeOf<typeof withFamilyResults[\"data\"][0]>()\n .toEqualTypeOf<\n Osdk.Instance<Employee, never, PropertyKeys<Employee>, {\n mom: \"integer\" | undefined;\n dad: \"string\" | undefined;\n sister: \"string\"[] | undefined;\n }>\n >();\n });\n\n it(\"Works with selecting all RDPs\", async () => {\n const withFamilyResults = await withFamily.fetchPage({\n $select: [\"mom\", \"dad\", \"sister\"],\n });\n\n expectTypeOf<typeof withFamilyResults[\"data\"][0]>()\n .toEqualTypeOf<\n Osdk.Instance<Employee, never, never, {\n mom: \"integer\" | undefined;\n dad: \"string\" | undefined;\n sister: \"string\"[] | undefined;\n }>\n >();\n\n expectTypeOf<typeof withFamilyResults[\"data\"][0][\"mom\"]>()\n .toEqualTypeOf<number | undefined>();\n });\n\n it(\"Works with selecting some RDPs\", async () => {\n const withFamilyResults = await withFamily.fetchPage({\n $select: [\"mom\"],\n });\n\n expectTypeOf<typeof withFamilyResults[\"data\"][0]>()\n .toEqualTypeOf<\n Osdk.Instance<Employee, never, never, {\n mom: \"integer\" | undefined;\n }>\n >();\n });\n\n it(\"Works with selecting all non-RDP's\", async () => {\n const withFamilyResults = await withFamily.fetchPage({\n $select: [\"class\", \"fullName\"],\n });\n\n expectTypeOf<typeof withFamilyResults[\"data\"][0]>()\n .toEqualTypeOf<\n Osdk.Instance<Employee, never, PropertyKeys<Employee>, {}>\n >();\n expectTypeOf<typeof withFamilyResults[\"data\"][0][\"class\"]>()\n .toEqualTypeOf<\n string | undefined\n >();\n });\n\n it(\"Works with selecting some non-RDP's\", async () => {\n const withFamilyResults = await withFamily.fetchPage({\n $select: [\"class\"],\n });\n\n expectTypeOf<typeof withFamilyResults[\"data\"][0]>()\n .toEqualTypeOf<\n Osdk.Instance<Employee, never, \"class\", {}>\n >();\n });\n\n it(\"Works with selecting a mix\", async () => {\n const withFamilyResults = await withFamily.fetchPage({\n $select: [\"class\", \"mom\"],\n });\n\n expectTypeOf<typeof withFamilyResults[\"data\"][0]>()\n .toEqualTypeOf<\n Osdk.Instance<\n Employee,\n never,\n \"class\",\n { mom: \"integer\" | undefined }\n >\n >();\n });\n });\n\n it(\"allows extracting the type\", () => {\n const objectSet = fauxObjectSet.withProperties({\n \"mom\": (base) => base.pivotTo(\"lead\").aggregate(\"$count\"),\n });\n\n type ObjectSetType = typeof objectSet;\n\n expectTypeOf<ObjectSetType>().toEqualTypeOf<\n $ObjectSet<Employee, {\n mom: \"integer\" | undefined;\n }>\n >();\n\n const objectSet2 = fauxObjectSet.withProperties({\n \"mom\": (base) => base.pivotTo(\"lead\").aggregate(\"$count\"),\n }) satisfies ObjectSetType;\n });\n\n it(\"Defining the Type\", () => {\n type ObjectSetType = $ObjectSet<\n Employee,\n {\n mom: \"integer\" | undefined;\n }\n >;\n\n fauxObjectSet.withProperties({\n \"mom\": (base) => base.pivotTo(\"lead\").aggregate(\"$count\"),\n }) satisfies ObjectSetType;\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,EAAEC,IAAI,EAAEC,EAAE,QAAQ,QAAQ;AA8E7D,MAAMC,QAAkB,GAAG;EACzBC,IAAI,EAAE,QAAQ;EACdC,OAAO,EAAE;AACX,CAAC;AAEDP,QAAQ,CAAC,WAAW,EAAE,MAAM;EAC1B,MAAMQ,aAAa,GAAG;IACpBC,KAAK,EAAEL,EAAE,CAACM,EAAE,CAAC,MAAM;MACjB,OAAOF,aAAa;IACtB,CAAC,CAAC;IACFG,cAAc,EAAEP,EAAE,CAACM,EAAE,CAAC,MAAM;MAC1B,OAAOF,aAAa;IACtB,CAAC,CAAC;IACFI,SAAS,EAAER,EAAE,CAACM,EAAE,CAAC,MAAMG,OAAO,CAACC,OAAO,CAAC,CAAC,CAAC;IACzCC,SAAS,EAAEX,EAAE,CAACM,EAAE,CAAC,MAAM;MACrB,OAAO,CAAC,CAAC;IACX,CAAC;EACH,CAA8B;EAE9BV,QAAQ,CAAC,QAAQ,EAAE,MAAM;IACvBG,IAAI,CAAC,aAAa,EAAE,YAAY;MACf,MAAMK,aAAa,CAACI,SAAS,CAAC,CAAC;MAC9CX,YAAY,CAAwB,CAA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ir 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
+ export let ObjectOrInterfaceDefinition;
2
17
  //# sourceMappingURL=ObjectOrInterface.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ObjectOrInterface.js","names":[],"sources":["ObjectOrInterface.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 { InterfaceDefinition } from \"./InterfaceDefinition.js\";\nimport type { ObjectTypeDefinition } from \"./ObjectTypeDefinition.js\";\n\nexport type ObjectOrInterfaceDefinition =\n | ObjectTypeDefinition\n | InterfaceDefinition;\n\nexport type PropertyKeys<\n O extends ObjectOrInterfaceDefinition,\n> = keyof NonNullable<O[\"__DefinitionMetadata\"]>[\"properties\"] & string;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"ObjectOrInterface.js","names":["ObjectOrInterfaceDefinition"],"sources":["ObjectOrInterface.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 { InterfaceDefinition } from \"./InterfaceDefinition.js\";\nimport type { ObjectTypeDefinition } from \"./ObjectTypeDefinition.js\";\nimport type { SimplePropertyDef } from \"./SimplePropertyDef.js\";\n\nexport type ObjectOrInterfaceDefinition =\n | ObjectTypeDefinition\n | InterfaceDefinition;\n\nexport namespace ObjectOrInterfaceDefinition {\n export type WithDerivedProperties<\n K extends ObjectOrInterfaceDefinition,\n D extends Record<string, SimplePropertyDef>,\n > = {\n __DefinitionMetadata: {\n properties: {\n [T in keyof D]: SimplePropertyDef.ToPropertyDef<D[T]>;\n };\n props: {\n [T in keyof D]: SimplePropertyDef.ToRuntimeProperty<D[T]>;\n };\n };\n } & K;\n}\n\nexport type PropertyKeys<\n O extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> =\n & (keyof NonNullable<O[\"__DefinitionMetadata\"]>[\"properties\"] | keyof RDPs)\n & string;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAdA,WAwBiBA,2BAA2B","ignoreList":[]}
@@ -0,0 +1,17 @@
1
+ /*
2
+ * Copyright 2023 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
+ export let SimplePropertyDef;
17
+ //# sourceMappingURL=SimplePropertyDef.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SimplePropertyDef.js","names":["SimplePropertyDef"],"sources":["SimplePropertyDef.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 { GetClientPropertyValueFromWire } from \"../mapping/PropertyValueMapping.js\";\nimport type { ObjectMetadata, PropertyDef } from \"./ObjectTypeDefinition.js\";\nimport type { WirePropertyTypes } from \"./WirePropertyTypes.js\";\n\nexport type SimplePropertyDef =\n | WirePropertyTypes\n | undefined\n | Array<WirePropertyTypes>;\n\nexport namespace SimplePropertyDef {\n export type Make<\n T extends WirePropertyTypes,\n N extends boolean | undefined,\n M extends boolean | undefined,\n > =\n // while it is cleaner to just do this as the union of two conditionals, it\n // actually makes it so that it can't be derived inline which we want\n // to keep things simple so instead of :\n // | (P[\"multiplicity\"] extends true ? Array<P[\"type\"]> : P[\"type\"])\n // | (P[\"nullable\"] extends true ? undefined : never);\n // we do:\n M extends true ? N extends true ? Array<T> | undefined\n : Array<T>\n : N extends true ? T | undefined\n : T;\n\n export type FromPropertyMetadata<\n P extends ObjectMetadata.Property,\n > = Make<P[\"type\"], P[\"nullable\"], P[\"multiplicity\"]>;\n\n // exported for testing\n export type ExtractMultiplicity<\n T extends\n | WirePropertyTypes\n | undefined\n | Array<WirePropertyTypes>,\n > = NonNullable<T> extends Array<any> ? \"array\" : \"single\";\n\n // exported for testing\n export type ExtractWirePropertyType<\n T extends SimplePropertyDef,\n > = T extends Array<infer Z> ? NonNullable<Z> : NonNullable<T>;\n\n // exported for testing\n export type ExtractNullable<\n T extends SimplePropertyDef,\n > = [undefined] extends [T] ? \"nullable\"\n : [[undefined]] extends [T] ? \"nullable\"\n : \"non-nullable\";\n\n export type ToPropertyDef<S extends SimplePropertyDef> = PropertyDef<\n SimplePropertyDef.ExtractWirePropertyType<S>,\n SimplePropertyDef.ExtractNullable<S>,\n SimplePropertyDef.ExtractMultiplicity<S>\n >;\n\n export type ExtractRuntimeBaseType<S extends SimplePropertyDef> =\n GetClientPropertyValueFromWire<\n SimplePropertyDef.ExtractWirePropertyType<S>\n >;\n\n export type ToRuntimeProperty<S extends SimplePropertyDef> =\n ExtractMultiplicity<S> extends \"array\"\n ? ExtractNullable<S> extends \"nullable\"\n ? Array<ExtractRuntimeBaseType<S>> | undefined\n : Array<ExtractRuntimeBaseType<S>>\n : ExtractNullable<S> extends \"nullable\"\n ? ExtractRuntimeBaseType<S> | undefined\n : ExtractRuntimeBaseType<S>;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAdA,WAyBiBA,iBAAiB","ignoreList":[]}
@@ -0,0 +1,48 @@
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 { describe, expectTypeOf, it, test } from "vitest";
18
+ describe("Type conversion", () => {
19
+ test("SimplePropertyDef.ExtractMultiplicity", () => {
20
+ expectTypeOf().toEqualTypeOf();
21
+ expectTypeOf().toEqualTypeOf();
22
+ expectTypeOf().toEqualTypeOf();
23
+ expectTypeOf().toEqualTypeOf();
24
+ });
25
+ test("SimplePropertyDef.ExtractNullable", () => {
26
+ expectTypeOf().toEqualTypeOf();
27
+ expectTypeOf().toEqualTypeOf();
28
+ expectTypeOf().toEqualTypeOf();
29
+ expectTypeOf().toEqualTypeOf();
30
+ });
31
+ test("SimplePropertyDef.ExtractWirePropertyType", () => {
32
+ expectTypeOf().toEqualTypeOf();
33
+ expectTypeOf().toEqualTypeOf();
34
+ expectTypeOf().toEqualTypeOf();
35
+ expectTypeOf().toEqualTypeOf();
36
+ });
37
+ it("SimplePropertyDef.FromPropertyMetadata", () => {
38
+ expectTypeOf().toEqualTypeOf();
39
+ expectTypeOf().toEqualTypeOf();
40
+ expectTypeOf().toEqualTypeOf();
41
+ expectTypeOf().toEqualTypeOf();
42
+ });
43
+ test(".ToRuntimeProperty", () => {
44
+ expectTypeOf().toEqualTypeOf();
45
+ expectTypeOf().toEqualTypeOf();
46
+ });
47
+ });
48
+ //# sourceMappingURL=SimplePropertyDef.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SimplePropertyDef.test.js","names":["describe","expectTypeOf","it","test","toEqualTypeOf"],"sources":["SimplePropertyDef.test.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { describe, expectTypeOf, it, test } from \"vitest\";\nimport type { PropertyDef } from \"./ObjectTypeDefinition.js\";\nimport type { SimplePropertyDef } from \"./SimplePropertyDef.js\";\n\ndescribe(\"Type conversion\", () => {\n test(\"SimplePropertyDef.ExtractMultiplicity\", () => {\n expectTypeOf<SimplePropertyDef.ExtractMultiplicity<\"string\"[]>>()\n .toEqualTypeOf<\"array\">();\n expectTypeOf<\n SimplePropertyDef.ExtractMultiplicity<\"string\"[] | undefined>\n >()\n .toEqualTypeOf<\"array\">();\n\n expectTypeOf<SimplePropertyDef.ExtractMultiplicity<\"string\">>()\n .toEqualTypeOf<\"single\">();\n expectTypeOf<SimplePropertyDef.ExtractMultiplicity<\"string\" | undefined>>()\n .toEqualTypeOf<\"single\">();\n });\n\n test(\"SimplePropertyDef.ExtractNullable\", () => {\n expectTypeOf<SimplePropertyDef.ExtractNullable<\"string\"[]>>()\n .toEqualTypeOf<\"non-nullable\">();\n expectTypeOf<SimplePropertyDef.ExtractNullable<\"string\"[] | undefined>>()\n .toEqualTypeOf<\"nullable\">();\n expectTypeOf<SimplePropertyDef.ExtractNullable<\"string\">>()\n .toEqualTypeOf<\"non-nullable\">();\n expectTypeOf<SimplePropertyDef.ExtractNullable<\"string\" | undefined>>()\n .toEqualTypeOf<\"nullable\">();\n });\n\n test(\"SimplePropertyDef.ExtractWirePropertyType\", () => {\n expectTypeOf<SimplePropertyDef.ExtractWirePropertyType<\"string\"[]>>()\n .toEqualTypeOf<\"string\">();\n expectTypeOf<\n SimplePropertyDef.ExtractWirePropertyType<\"string\"[] | undefined>\n >()\n .toEqualTypeOf<\"string\">();\n expectTypeOf<SimplePropertyDef.ExtractWirePropertyType<\"string\">>()\n .toEqualTypeOf<\"string\">();\n expectTypeOf<\n SimplePropertyDef.ExtractWirePropertyType<\"string\" | undefined>\n >()\n .toEqualTypeOf<\"string\">();\n });\n\n it(\"SimplePropertyDef.FromPropertyMetadata\", () => {\n expectTypeOf<\n SimplePropertyDef.FromPropertyMetadata<\n PropertyDef<\"string\", \"nullable\", \"array\">\n >\n >()\n .toEqualTypeOf<\"string\"[] | undefined>();\n\n expectTypeOf<\n SimplePropertyDef.FromPropertyMetadata<\n PropertyDef<\"string\", \"non-nullable\", \"array\">\n >\n >()\n .toEqualTypeOf<\"string\"[]>();\n\n expectTypeOf<\n SimplePropertyDef.FromPropertyMetadata<\n PropertyDef<\"string\", \"non-nullable\", \"single\">\n >\n >()\n .toEqualTypeOf<\"string\">();\n\n expectTypeOf<\n SimplePropertyDef.FromPropertyMetadata<\n PropertyDef<\"string\", \"nullable\", \"single\">\n >\n >()\n .toEqualTypeOf<\"string\" | undefined>();\n });\n\n test(\".ToRuntimeProperty\", () => {\n expectTypeOf<SimplePropertyDef.ToRuntimeProperty<\"string\">>()\n .toEqualTypeOf<string>();\n\n expectTypeOf<SimplePropertyDef.ToRuntimeProperty<\"string\" | undefined>>()\n .toEqualTypeOf<string | undefined>();\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,EAAEC,IAAI,QAAQ,QAAQ;AAIzDH,QAAQ,CAAC,iBAAiB,EAAE,MAAM;EAChCG,IAAI,CAAC,uCAAuC,EAAE,MAAM;IAClDF,YAAY,CAAoD,CAAC,CAC9DG,aAAa,CAAU,CAAC;IAC3BH,YAAY,CAEV,CAAC,CACAG,aAAa,CAAU,CAAC;IAE3BH,YAAY,CAAkD,CAAC,CAC5DG,aAAa,CAAW,CAAC;IAC5BH,YAAY,CAA8D,CAAC,CACxEG,aAAa,CAAW,CAAC;EAC9B,CAAC,CAAC;EAEFD,IAAI,CAAC,mCAAmC,EAAE,MAAM;IAC9CF,YAAY,CAAgD,CAAC,CAC1DG,aAAa,CAAiB,CAAC;IAClCH,YAAY,CAA4D,CAAC,CACtEG,aAAa,CAAa,CAAC;IAC9BH,YAAY,CAA8C,CAAC,CACxDG,aAAa,CAAiB,CAAC;IAClCH,YAAY,CAA0D,CAAC,CACpEG,aAAa,CAAa,CAAC;EAChC,CAAC,CAAC;EAEFD,IAAI,CAAC,2CAA2C,EAAE,MAAM;IACtDF,YAAY,CAAwD,CAAC,CAClEG,aAAa,CAAW,CAAC;IAC5BH,YAAY,CAEV,CAAC,CACAG,aAAa,CAAW,CAAC;IAC5BH,YAAY,CAAsD,CAAC,CAChEG,aAAa,CAAW,CAAC;IAC5BH,YAAY,CAEV,CAAC,CACAG,aAAa,CAAW,CAAC;EAC9B,CAAC,CAAC;EAEFF,EAAE,CAAC,wCAAwC,EAAE,MAAM;IACjDD,YAAY,CAIV,CAAC,CACAG,aAAa,CAAyB,CAAC;IAE1CH,YAAY,CAIV,CAAC,CACAG,aAAa,CAAa,CAAC;IAE9BH,YAAY,CAIV,CAAC,CACAG,aAAa,CAAW,CAAC;IAE5BH,YAAY,CAIV,CAAC,CACAG,aAAa,CAAuB,CAAC;EAC1C,CAAC,CAAC;EAEFD,IAAI,CAAC,oBAAoB,EAAE,MAAM;IAC/BF,YAAY,CAAgD,CAAC,CAC1DG,aAAa,CAAS,CAAC;IAE1BH,YAAY,CAA4D,CAAC,CACtEG,aAAa,CAAqB,CAAC;EACxC,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -4,6 +4,7 @@ import type { UnionIfTrue } from "./object/FetchPageResult.js";
4
4
  import type { InterfaceDefinition } from "./ontology/InterfaceDefinition.js";
5
5
  import type { ObjectOrInterfaceDefinition, PropertyKeys } from "./ontology/ObjectOrInterface.js";
6
6
  import type { CompileTimeMetadata, ObjectTypeDefinition } from "./ontology/ObjectTypeDefinition.js";
7
+ import type { SimplePropertyDef } from "./ontology/SimplePropertyDef.js";
7
8
  import type { OsdkBase } from "./OsdkBase.js";
8
9
  type SpecialOsdkPropParams = "$all" | "$rid" | "$strict" | "$notStrict";
9
10
  type ValidOsdkPropParams<Q extends ObjectOrInterfaceDefinition> = SpecialOsdkPropParams | PropertyKeys<Q>;
@@ -50,8 +51,9 @@ type ExtractPropsKeysFromOldPropsStyle<
50
51
  export type IsAny<T> = unknown extends T ? [keyof T] extends [never] ? false : true : false;
51
52
  export type GetPropsKeys<
52
53
  Q extends ObjectOrInterfaceDefinition,
53
- P extends PropertyKeys<Q>
54
- > = IsNever<P> extends true ? PropertyKeys<Q> : IsAny<P> extends true ? PropertyKeys<Q> : P;
54
+ P extends PropertyKeys<Q>,
55
+ N extends boolean = false
56
+ > = IsNever<P> extends true ? N extends true ? never : PropertyKeys<Q> : IsAny<P> extends true ? PropertyKeys<Q> : P;
55
57
  /**
56
58
  * Use `Osdk.Instance` or `YourType.OsdkInstance`
57
59
  */
@@ -64,8 +66,9 @@ export declare namespace Osdk {
64
66
  type Instance<
65
67
  Q extends ObjectOrInterfaceDefinition,
66
68
  OPTIONS extends never | "$rid" = never,
67
- P extends PropertyKeys<Q> = PropertyKeys<Q>
68
- > = OsdkBase<Q> & Pick<CompileTimeMetadata<Q>["props"], GetPropsKeys<Q, P>> & {
69
+ P extends PropertyKeys<Q> = PropertyKeys<Q>,
70
+ R extends Record<string, SimplePropertyDef> = {}
71
+ > = OsdkBase<Q> & Pick<CompileTimeMetadata<Q>["props"], GetPropsKeys<Q, P, [R] extends [{}] ? false : true>> & ([R] extends [never] ? {} : { [A in keyof R] : SimplePropertyDef.ToRuntimeProperty<R[A]> }) & {
69
72
  readonly $link: Q extends { linksType?: any } ? Q["linksType"] : Q extends ObjectTypeDefinition ? OsdkObjectLinksObject<Q> : never;
70
73
  readonly $as: <NEW_Q extends ValidToFrom<Q>>(type: NEW_Q | string) => Osdk.Instance<NEW_Q, OPTIONS, ConvertProps<Q, NEW_Q, P>>;
71
74
  readonly $clone: <NEW_PROPS extends PropertyKeys<Q>>(updatedObject?: Osdk.Instance<Q, any, NEW_PROPS> | { [K in NEW_PROPS]? : CompileTimeMetadata<Q>["props"][K] }) => Osdk.Instance<Q, OPTIONS, P | NEW_PROPS>;
@@ -1,9 +1,16 @@
1
+ import type { NumericWithPropAggregateOption, StringWithPropAggregateOption } from "../derivedProperties/WithPropertiesAggregationOptions.js";
1
2
  import type { GetWirePropertyValueFromClient } from "../mapping/PropertyValueMapping.js";
2
3
  import type { ObjectOrInterfaceDefinition, PropertyKeys } from "../ontology/ObjectOrInterface.js";
3
4
  import type { CompileTimeMetadata } from "../ontology/ObjectTypeDefinition.js";
4
5
  export type StringAggregateOption = "approximateDistinct" | "exactDistinct";
5
6
  export type NumericAggregateOption = "min" | "max" | "sum" | "avg" | "approximateDistinct" | "exactDistinct";
6
- type AGG_FOR_TYPE<T> = number extends T ? NumericAggregateOption : string extends T ? StringAggregateOption : never;
7
- export type ValidAggregationKeys<Q extends ObjectOrInterfaceDefinition> = keyof ({ [KK in AggregatableKeys<Q> as `${KK & string}:${AGG_FOR_TYPE<GetWirePropertyValueFromClient<CompileTimeMetadata<Q>["properties"][KK]["type"]>>}`]? : any } & { $count?: any });
7
+ type AGG_FOR_TYPE<
8
+ T,
9
+ U extends boolean
10
+ > = number extends T ? U extends true ? NumericAggregateOption : NumericWithPropAggregateOption : string extends T ? U extends true ? StringAggregateOption : StringWithPropAggregateOption : never;
11
+ export type ValidAggregationKeys<
12
+ Q extends ObjectOrInterfaceDefinition,
13
+ R extends "aggregate" | "withPropertiesAggregate" = "aggregate"
14
+ > = keyof ({ [KK in AggregatableKeys<Q> as `${KK & string}:${AGG_FOR_TYPE<GetWirePropertyValueFromClient<CompileTimeMetadata<Q>["properties"][KK]["type"]>, R extends "aggregate" ? true : false>}`]? : any } & { $count?: any });
8
15
  export type AggregatableKeys<Q extends ObjectOrInterfaceDefinition> = keyof { [P in PropertyKeys<Q>] : any };
9
16
  export {};
@@ -0,0 +1,42 @@
1
+ import type { ValidAggregationKeys } from "../aggregate/AggregatableKeys.js";
2
+ import type { WhereClause } from "../aggregate/WhereClause.js";
3
+ import type { ObjectOrInterfaceDefinition, PropertyKeys } from "../ontology/ObjectOrInterface.js";
4
+ import type { CompileTimeMetadata } from "../ontology/ObjectTypeDefinition.js";
5
+ import type { SimplePropertyDef } from "../ontology/SimplePropertyDef.js";
6
+ import type { LinkedType, LinkNames } from "../util/LinkUtils.js";
7
+ import type { CollectWithPropAggregations } from "./WithPropertiesAggregationOptions.js";
8
+ export declare namespace DerivedProperty {
9
+ type SelectorResult<T extends SimplePropertyDef> = { type: T };
10
+ type Clause<Q extends ObjectOrInterfaceDefinition> = { [key: string]: Selector<Q, SimplePropertyDef> };
11
+ type Selector<
12
+ Q extends ObjectOrInterfaceDefinition,
13
+ T extends SimplePropertyDef
14
+ > = (baseObjectSet: DerivedProperty.Builder<Q, false>) => SelectorResult<T>;
15
+ interface Builder<
16
+ Q extends ObjectOrInterfaceDefinition,
17
+ CONSTRAINED extends boolean
18
+ > extends Filterable<Q, CONSTRAINED>, Pivotable<Q, CONSTRAINED> {}
19
+ interface AggregateBuilder<
20
+ Q extends ObjectOrInterfaceDefinition,
21
+ CONSTRAINED extends boolean
22
+ > extends Builder<Q, CONSTRAINED>, Aggregatable<Q> {}
23
+ interface SelectPropertyBuilder<
24
+ Q extends ObjectOrInterfaceDefinition,
25
+ CONSTRAINED extends boolean
26
+ > extends AggregateBuilder<Q, CONSTRAINED>, Selectable<Q> {}
27
+ }
28
+ type BuilderTypeFromConstraint<
29
+ Q extends ObjectOrInterfaceDefinition,
30
+ CONSTRAINED extends boolean
31
+ > = CONSTRAINED extends true ? DerivedProperty.AggregateBuilder<Q, true> : DerivedProperty.SelectPropertyBuilder<Q, false>;
32
+ type Filterable<
33
+ Q extends ObjectOrInterfaceDefinition,
34
+ CONSTRAINED extends boolean
35
+ > = { readonly where: (clause: WhereClause<Q>) => BuilderTypeFromConstraint<Q, CONSTRAINED> };
36
+ type Pivotable<
37
+ Q extends ObjectOrInterfaceDefinition,
38
+ CONSTRAINED extends boolean
39
+ > = { readonly pivotTo: <L extends LinkNames<Q>>(type: L) => CONSTRAINED extends true ? DerivedProperty.AggregateBuilder<LinkedType<Q, L>, true> : NonNullable<CompileTimeMetadata<Q>["links"][L]["multiplicity"]> extends true ? DerivedProperty.AggregateBuilder<LinkedType<Q, L>, true> : DerivedProperty.SelectPropertyBuilder<LinkedType<Q, L>, false> };
40
+ type Aggregatable<Q extends ObjectOrInterfaceDefinition> = { readonly aggregate: <V extends ValidAggregationKeys<Q, "withPropertiesAggregate">>(aggregationSpecifier: V, opts?: V extends `${any}:${infer P}` ? P extends CollectWithPropAggregations ? { limit: number } : P extends "approximatePercentile" ? { percentile: number } : never : never) => DerivedProperty.SelectorResult<V extends `${infer N}:${infer P}` ? P extends CollectWithPropAggregations ? Array<CompileTimeMetadata<Q>["properties"][N]["type"]> | undefined : P extends "approximateDistinct" | "exactDistinct" | "$count" ? "integer" | undefined : "double" | undefined : V extends "$count" ? "integer" | undefined : never> };
41
+ type Selectable<Q extends ObjectOrInterfaceDefinition> = { readonly selectProperty: <R extends PropertyKeys<Q>>(propertyName: R) => DerivedProperty.SelectorResult<SimplePropertyDef.Make<CompileTimeMetadata<Q>["properties"][R]["type"], CompileTimeMetadata<Q>["properties"][R]["nullable"], CompileTimeMetadata<Q>["properties"][R]["multiplicity"]>> };
42
+ export {};
@@ -0,0 +1,4 @@
1
+ export type CollectWithPropAggregations = "collectSet" | "collectList";
2
+ export type BaseWithPropAggregations = "approximateDistinct" | "exactDistinct" | "approximatePercentile";
3
+ export type StringWithPropAggregateOption = BaseWithPropAggregations | CollectWithPropAggregations;
4
+ export type NumericWithPropAggregateOption = "min" | "max" | "sum" | "avg" | BaseWithPropAggregations | CollectWithPropAggregations;
@@ -12,6 +12,7 @@ export { DistanceUnitMapping } from "./aggregate/WhereClause.js";
12
12
  export type { GeoFilter_Intersects, GeoFilter_Within, PossibleWhereClauseFilters, WhereClause } from "./aggregate/WhereClause.js";
13
13
  export type { OsdkObjectPropertyType } from "./Definitions.js";
14
14
  export type { OsdkObjectLinksObject, SingleLinkAccessor } from "./definitions/LinkDefinitions.js";
15
+ export type { DerivedProperty } from "./derivedProperties/DerivedProperty.js";
15
16
  export { DurationMapping } from "./groupby/GroupByClause.js";
16
17
  export type { AllGroupByValues, GroupByClause, GroupByRange } from "./groupby/GroupByClause.js";
17
18
  export type { AllowedBucketKeyTypes, AllowedBucketTypes, DataValueClientToWire, DataValueWireToClient } from "./mapping/DataValueMapping.js";
@@ -1,4 +1,5 @@
1
1
  import type { ObjectOrInterfaceDefinition, PropertyKeys } from "../ontology/ObjectOrInterface.js";
2
+ import type { SimplePropertyDef } from "../ontology/SimplePropertyDef.js";
2
3
  import type { ExtractOptions, IsNever, Osdk } from "../OsdkObjectFrom.js";
3
4
  import type { PageResult } from "../PageResult.js";
4
5
  import type { NullabilityAdherence } from "./FetchPageArgs.js";
@@ -30,8 +31,9 @@ export type FetchPageResult<
30
31
  */
31
32
  export type SingleOsdkResult<
32
33
  Q extends ObjectOrInterfaceDefinition,
33
- L extends PropertyKeys<Q>,
34
+ L extends PropertyKeys<Q> | (keyof RDPs & string),
34
35
  R extends boolean,
35
- S extends NullabilityAdherence
36
- > = Osdk.Instance<Q, ExtractOptions<R, S>, L>;
36
+ S extends NullabilityAdherence,
37
+ RDPs extends Record<string, SimplePropertyDef> = {}
38
+ > = Osdk.Instance<Q, ExtractOptions<R, S>, PropertyKeys<Q> extends L ? PropertyKeys<Q> : PropertyKeys<Q> & L, { [K in Extract<keyof RDPs, L>] : RDPs[K] }>;
37
39
  export type IsAny<T> = unknown extends T ? [keyof T] extends [never] ? false : true : false;
@@ -2,19 +2,31 @@ import type { AggregateOpts } from "../aggregate/AggregateOpts.js";
2
2
  import type { AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy } from "../aggregate/AggregateOptsThatErrors.js";
3
3
  import type { AggregationsResults } from "../aggregate/AggregationsResults.js";
4
4
  import type { WhereClause } from "../aggregate/WhereClause.js";
5
+ import type { DerivedProperty } from "../derivedProperties/DerivedProperty.js";
5
6
  import type { AsyncIterArgs, Augments, FetchPageArgs, NullabilityAdherence, SelectArg } from "../object/FetchPageArgs.js";
6
- import type { SingleOsdkResult } from "../object/FetchPageResult.js";
7
7
  import type { Result } from "../object/Result.js";
8
- import type { InterfaceDefinition } from "../ontology/InterfaceDefinition.js";
9
8
  import type { ObjectOrInterfaceDefinition, PropertyKeys } from "../ontology/ObjectOrInterface.js";
10
9
  import type { CompileTimeMetadata, ObjectTypeDefinition } from "../ontology/ObjectTypeDefinition.js";
10
+ import type { SimplePropertyDef } from "../ontology/SimplePropertyDef.js";
11
11
  import type { PrimaryKeyType } from "../OsdkBase.js";
12
12
  import type { ExtractOptions, Osdk } from "../OsdkObjectFrom.js";
13
13
  import type { PageResult } from "../PageResult.js";
14
14
  import type { LinkedType, LinkNames } from "../util/LinkUtils.js";
15
15
  import type { BaseObjectSet } from "./BaseObjectSet.js";
16
16
  import type { ObjectSetListener, ObjectSetListenerOptions } from "./ObjectSetListener.js";
17
- export interface MinimalObjectSet<Q extends ObjectOrInterfaceDefinition> extends BaseObjectSet<Q> {
17
+ type MergeObjectSet<
18
+ Q extends ObjectOrInterfaceDefinition,
19
+ D extends ObjectSet<Q> | Record<string, SimplePropertyDef> = {}
20
+ > = D extends Record<string, SimplePropertyDef> ? ObjectOrInterfaceDefinition.WithDerivedProperties<Q, D> : Q;
21
+ type ExtractRdp<D extends ObjectSet<any, any> | Record<string, SimplePropertyDef>> = D extends Record<string, SimplePropertyDef> ? D : {};
22
+ export interface MinimalObjectSet<
23
+ Q extends ObjectOrInterfaceDefinition,
24
+ RDPs extends Record<string, SimplePropertyDef> = {}
25
+ > extends BaseObjectSet<Q>, FetchPage<Q, RDPs>, AsyncIter<Q, RDPs>, Where<Q, RDPs> {}
26
+ interface FetchPage<
27
+ Q extends ObjectOrInterfaceDefinition,
28
+ RDPs extends Record<string, SimplePropertyDef> = {}
29
+ > {
18
30
  /**
19
31
  * Gets a page of objects of this type, with a result wrapper
20
32
  * @param args - Args to specify next page token and page size, if applicable
@@ -28,11 +40,11 @@ export interface MinimalObjectSet<Q extends ObjectOrInterfaceDefinition> extends
28
40
  * @returns a page of objects
29
41
  */
30
42
  readonly fetchPage: <
31
- L extends PropertyKeys<Q>,
43
+ L extends PropertyKeys<Q, RDPs>,
32
44
  R extends boolean,
33
45
  const A extends Augments,
34
46
  S extends NullabilityAdherence = NullabilityAdherence.Default
35
- >(args?: FetchPageArgs<Q, L, R, A, S>) => Promise<PageResult<PropertyKeys<Q> extends L ? Osdk.Instance<Q, ExtractOptions<R, S>> : Osdk.Instance<Q, ExtractOptions<R, S>, L>>>;
47
+ >(args?: FetchPageArgs<Q, L, R, A, S>) => Promise<PageResult<Osdk.Instance<Q, ExtractOptions<R, S>, PropertyKeys<Q> extends L ? PropertyKeys<Q> : PropertyKeys<Q> & L, { [K in Extract<keyof RDPs, L>] : RDPs[K] }>>>;
36
48
  /**
37
49
  * Gets a page of objects of this type, with a result wrapper
38
50
  * @param args - Args to specify next page token and page size, if applicable
@@ -48,11 +60,16 @@ export interface MinimalObjectSet<Q extends ObjectOrInterfaceDefinition> extends
48
60
  * @returns a page of objects, wrapped in a result wrapper
49
61
  */
50
62
  readonly fetchPageWithErrors: <
51
- L extends PropertyKeys<Q>,
63
+ L extends PropertyKeys<Q, RDPs>,
52
64
  R extends boolean,
53
65
  const A extends Augments,
54
66
  S extends NullabilityAdherence = NullabilityAdherence.Default
55
- >(args?: FetchPageArgs<Q, L, R, A, S>) => Promise<Result<PageResult<Osdk.Instance<Q, ExtractOptions<R, S>, L>>>>;
67
+ >(args?: FetchPageArgs<Q, L, R, A, S>) => Promise<Result<PageResult<Osdk.Instance<Q, ExtractOptions<R, S>, PropertyKeys<Q> extends L ? PropertyKeys<Q> : PropertyKeys<Q> & L, { [K in Extract<keyof RDPs, L>] : RDPs[K] }>>>>;
68
+ }
69
+ interface Where<
70
+ Q extends ObjectOrInterfaceDefinition,
71
+ RDPs extends Record<string, SimplePropertyDef> = {}
72
+ > {
56
73
  /**
57
74
  * Allows you to filter an object set with a given clause
58
75
  * @param clause - Takes a filter clause
@@ -63,7 +80,12 @@ export interface MinimalObjectSet<Q extends ObjectOrInterfaceDefinition> extends
63
80
  });
64
81
  * @returns an objectSet
65
82
  */
66
- readonly where: (clause: WhereClause<Q>) => this;
83
+ readonly where: (clause: WhereClause<MergeObjectSet<Q, RDPs>>) => this;
84
+ }
85
+ interface AsyncIter<
86
+ Q extends ObjectOrInterfaceDefinition,
87
+ RDPs extends Record<string, SimplePropertyDef> = {}
88
+ > {
67
89
  /**
68
90
  * Returns an async iterator to load all objects of this type
69
91
  * @example
@@ -73,17 +95,23 @@ export interface MinimalObjectSet<Q extends ObjectOrInterfaceDefinition> extends
73
95
  * @returns an async iterator to load all objects
74
96
  */
75
97
  readonly asyncIter: <
76
- L extends PropertyKeys<Q>,
98
+ L extends PropertyKeys<Q, RDPs>,
77
99
  R extends boolean,
78
100
  const A extends Augments,
79
101
  S extends NullabilityAdherence = NullabilityAdherence.Default
80
- >(args?: AsyncIterArgs<Q, L, R, A, S>) => AsyncIterableIterator<SingleOsdkResult<Q, L, R, S>>;
102
+ >(args?: AsyncIterArgs<Q, L, R, A, S>) => AsyncIterableIterator<Osdk.Instance<Q, ExtractOptions<R, S>, PropertyKeys<Q> extends L ? PropertyKeys<Q> : PropertyKeys<Q> & L, { [K in Extract<keyof RDPs, L>] : RDPs[K] }>>;
103
+ }
104
+ interface WithProperties<
105
+ Q extends ObjectOrInterfaceDefinition = any,
106
+ RDPs extends Record<string, SimplePropertyDef> = {}
107
+ > {
108
+ readonly withProperties: <NEW extends Record<string, SimplePropertyDef>>(clause: { [K in keyof NEW] : DerivedProperty.Selector<Q, NEW[K]> }) => ObjectSet<Q, { [NN in keyof NEW | keyof RDPs] : NN extends keyof NEW ? NEW[NN] : NN extends keyof RDPs ? RDPs[NN] : never }>;
81
109
  }
82
- export interface InterfaceObjectSet<Q extends InterfaceDefinition> extends MinimalObjectSet<Q> {}
83
110
  export interface ObjectSet<
84
111
  Q extends ObjectOrInterfaceDefinition = any,
85
- _UNUSED = any
86
- > extends MinimalObjectSet<Q> {
112
+ UNUSED_OR_RDP extends ObjectSet<Q, any> | Record<string, SimplePropertyDef> = ObjectSet<Q, any>
113
+ > extends ObjectSetCleanedTypes<Q, ExtractRdp<UNUSED_OR_RDP>, MergeObjectSet<Q, UNUSED_OR_RDP>> {}
114
+ interface Aggregate<Q extends ObjectOrInterfaceDefinition> {
87
115
  /**
88
116
  * Aggregate on a field in an object type
89
117
  * @param req - an aggregation request where you can select fields and choose how to aggregate, e.g., max, min, avg, and also choose
@@ -108,6 +136,8 @@ export interface ObjectSet<
108
136
  * @returns aggregation results, sorted in the groups based on the groupBy clause (if applicable)
109
137
  */
110
138
  readonly aggregate: <AO extends AggregateOpts<Q>>(req: AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy<Q, AO>) => Promise<AggregationsResults<Q, AO>>;
139
+ }
140
+ interface SetArithmetic<Q extends ObjectOrInterfaceDefinition> {
111
141
  /**
112
142
  * Unions object sets together
113
143
  * @param objectSets - objectSets you want to union with
@@ -138,28 +168,37 @@ export interface ObjectSet<
138
168
  * @returns the subtract object set
139
169
  */
140
170
  readonly subtract: (...objectSets: ReadonlyArray<CompileTimeMetadata<Q>["objectSet"]>) => this;
171
+ }
172
+ interface PivotTo<Q extends ObjectOrInterfaceDefinition> {
141
173
  /**
142
174
  * Pivots the object set over to all its linked objects of the specified type
143
175
  * @param type - The linked object type you want to pivot to
144
176
  * @returns an object set of the specified linked type
145
177
  */
146
178
  readonly pivotTo: <L extends LinkNames<Q>>(type: L) => CompileTimeMetadata<LinkedType<Q, L>>["objectSet"];
179
+ }
180
+ interface FetchOne<
181
+ Q extends ObjectOrInterfaceDefinition,
182
+ RDPs extends Record<string, SimplePropertyDef>
183
+ > {
147
184
  /**
148
185
  * Fetches one object with the specified primary key, without a result wrapper
149
186
  */
150
187
  readonly fetchOne: Q extends ObjectTypeDefinition ? <
151
- const L extends PropertyKeys<Q>,
188
+ const L extends PropertyKeys<Q, RDPs>,
152
189
  const R extends boolean,
153
190
  const S extends false | "throw" = NullabilityAdherence.Default
154
- >(primaryKey: PrimaryKeyType<Q>, options?: SelectArg<Q, L, R, S>) => Promise<Osdk.Instance<Q, ExtractOptions<R, S>, L>> : never;
191
+ >(primaryKey: PrimaryKeyType<Q>, options?: SelectArg<Q, L, R, S>) => Promise<Osdk.Instance<Q, ExtractOptions<R, S>, PropertyKeys<Q> extends L ? PropertyKeys<Q> : PropertyKeys<Q> & L, { [K in Extract<keyof RDPs, L>] : RDPs[K] }>> : never;
155
192
  /**
156
193
  * Fetches one object with the specified primary key, with a result wrapper
157
194
  */
158
195
  readonly fetchOneWithErrors: Q extends ObjectTypeDefinition ? <
159
- L extends PropertyKeys<Q>,
196
+ L extends PropertyKeys<Q, RDPs>,
160
197
  R extends boolean,
161
198
  S extends false | "throw" = NullabilityAdherence.Default
162
- >(primaryKey: PrimaryKeyType<Q>, options?: SelectArg<Q, L, R, S>) => Promise<Result<Osdk.Instance<Q, ExtractOptions<R, S>, L>>> : never;
199
+ >(primaryKey: PrimaryKeyType<Q>, options?: SelectArg<Q, L, R, S>) => Promise<Result<Osdk.Instance<Q, ExtractOptions<R, S>, PropertyKeys<Q> extends L ? PropertyKeys<Q> : PropertyKeys<Q> & L, { [K in Extract<keyof RDPs, L>] : RDPs[K] }>>> : never;
200
+ }
201
+ interface Subscribe<Q extends ObjectOrInterfaceDefinition> {
163
202
  /**
164
203
  * Request updates when the objects in an object set are added, updated, or removed.
165
204
  * @param listener - The handlers to be executed during the lifecycle of the subscription.
@@ -168,3 +207,9 @@ export interface ObjectSet<
168
207
  */
169
208
  readonly subscribe: <const P extends PropertyKeys<Q>>(listener: ObjectSetListener<Q, P>, opts?: ObjectSetListenerOptions<Q, P>) => { unsubscribe: () => void };
170
209
  }
210
+ interface ObjectSetCleanedTypes<
211
+ Q extends ObjectOrInterfaceDefinition,
212
+ D extends Record<string, SimplePropertyDef>,
213
+ MERGED extends ObjectOrInterfaceDefinition
214
+ > extends MinimalObjectSet<Q, D>, WithProperties<Q, D>, Aggregate<MERGED>, SetArithmetic<MERGED>, PivotTo<MERGED>, FetchOne<Q, D>, Subscribe<MERGED> {}
215
+ export {};
@@ -0,0 +1 @@
1
+ export {};