@osdk/client 2.2.0-beta.7 → 2.2.0-beta.9

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 (253) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/build/browser/Client.js.map +1 -1
  3. package/build/browser/createClient.js +11 -4
  4. package/build/browser/createClient.js.map +1 -1
  5. package/build/browser/createMinimalClient.js +2 -2
  6. package/build/browser/createMinimalClient.js.map +1 -1
  7. package/build/browser/index.js +1 -0
  8. package/build/browser/index.js.map +1 -1
  9. package/build/browser/object/SimpleOsdkProperties.js +2 -0
  10. package/build/browser/object/SimpleOsdkProperties.js.map +1 -0
  11. package/build/browser/object/convertWireToOsdkObjects/BaseHolder.js +2 -0
  12. package/build/browser/object/convertWireToOsdkObjects/BaseHolder.js.map +1 -0
  13. package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.js.map +1 -1
  14. package/build/browser/object/convertWireToOsdkObjects/ObjectHolder.js.map +1 -1
  15. package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js +25 -0
  16. package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
  17. package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js +10 -3
  18. package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
  19. package/build/browser/object/convertWireToOsdkObjects/getDollarAs.js.map +1 -1
  20. package/build/browser/object/convertWireToOsdkObjects/getDollarLink.js.map +1 -1
  21. package/build/browser/object/convertWireToOsdkObjects.js +12 -3
  22. package/build/browser/object/convertWireToOsdkObjects.js.map +1 -1
  23. package/build/browser/object/convertWireToOsdkObjects.test.js +7 -3
  24. package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
  25. package/build/browser/object/createObjectSpecifierFromPrimaryKey.js +20 -0
  26. package/build/browser/object/createObjectSpecifierFromPrimaryKey.js.map +1 -0
  27. package/build/browser/object/fetchPage.js +13 -1
  28. package/build/browser/object/fetchPage.js.map +1 -1
  29. package/build/browser/object/fetchPage.test.js +56 -2
  30. package/build/browser/object/fetchPage.test.js.map +1 -1
  31. package/build/browser/object/object.test.js +109 -0
  32. package/build/browser/object/object.test.js.map +1 -1
  33. package/build/browser/objectSet/InterfaceObjectSet.test.js +18 -2
  34. package/build/browser/objectSet/InterfaceObjectSet.test.js.map +1 -1
  35. package/build/browser/objectSet/ObjectSet.test.js +104 -100
  36. package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
  37. package/build/browser/objectSet/ObjectSetListenerWebsocket.js +18 -14
  38. package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
  39. package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js +2 -0
  40. package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
  41. package/build/browser/objectSet/createObjectSet.js.map +1 -1
  42. package/build/browser/observable/ListPayload.js.map +1 -1
  43. package/build/browser/observable/ObjectPayload.js.map +1 -1
  44. package/build/browser/observable/ObservableClient.js.map +1 -1
  45. package/build/browser/observable/internal/ActionApplication.js +29 -29
  46. package/build/browser/observable/internal/ActionApplication.js.map +1 -1
  47. package/build/browser/observable/internal/CacheKey.js +1 -1
  48. package/build/browser/observable/internal/CacheKey.js.map +1 -1
  49. package/build/browser/observable/internal/CacheKeys.js +2 -2
  50. package/build/browser/observable/internal/CacheKeys.js.map +1 -1
  51. package/build/browser/observable/internal/{ChangedObjects.js → Changes.js} +20 -9
  52. package/build/browser/observable/internal/Changes.js.map +1 -0
  53. package/build/browser/observable/internal/Layer.js +3 -0
  54. package/build/browser/observable/internal/Layer.js.map +1 -1
  55. package/build/browser/observable/internal/ListQuery.js +411 -170
  56. package/build/browser/observable/internal/ListQuery.js.map +1 -1
  57. package/build/browser/observable/internal/ObjectQuery.js +32 -16
  58. package/build/browser/observable/internal/ObjectQuery.js.map +1 -1
  59. package/build/browser/observable/internal/ObservableClientImpl.js +4 -12
  60. package/build/browser/observable/internal/ObservableClientImpl.js.map +1 -1
  61. package/build/browser/observable/internal/OptimisticJob.js.map +1 -1
  62. package/build/browser/observable/internal/OrderByCanonicalizer.js +73 -0
  63. package/build/browser/observable/internal/OrderByCanonicalizer.js.map +1 -0
  64. package/build/browser/observable/internal/OrderByCanonicalizer.test.js +78 -0
  65. package/build/browser/observable/internal/OrderByCanonicalizer.test.js.map +1 -0
  66. package/build/browser/observable/internal/Query.js +64 -31
  67. package/build/browser/observable/internal/Query.js.map +1 -1
  68. package/build/browser/observable/internal/RefCounts.js +7 -2
  69. package/build/browser/observable/internal/RefCounts.js.map +1 -1
  70. package/build/browser/observable/internal/SimpleWhereClause.js +2 -0
  71. package/build/browser/observable/internal/SimpleWhereClause.js.map +1 -0
  72. package/build/browser/observable/internal/Store.js +84 -267
  73. package/build/browser/observable/internal/Store.js.map +1 -1
  74. package/build/browser/observable/internal/Store.test.js +264 -247
  75. package/build/browser/observable/internal/Store.test.js.map +1 -1
  76. package/build/browser/observable/internal/WhereClauseCanonicalizer.js +11 -3
  77. package/build/browser/observable/internal/WhereClauseCanonicalizer.js.map +1 -1
  78. package/build/browser/observable/internal/objectMatchesWhereClause.js.map +1 -1
  79. package/build/browser/observable/internal/objectMatchesWhereClause.test.js.map +1 -1
  80. package/build/browser/observable/internal/testUtils.js +82 -18
  81. package/build/browser/observable/internal/testUtils.js.map +1 -1
  82. package/build/browser/public/unstable-do-not-use.js.map +1 -1
  83. package/build/browser/queries/applyQuery.js +33 -1
  84. package/build/browser/queries/applyQuery.js.map +1 -1
  85. package/build/browser/queries/queries.test.js +26 -5
  86. package/build/browser/queries/queries.test.js.map +1 -1
  87. package/build/browser/util/UserAgent.js +1 -1
  88. package/build/browser/util/toDataValueQueries.js +17 -0
  89. package/build/browser/util/toDataValueQueries.js.map +1 -1
  90. package/build/cjs/{Client-C8K3E1vH.d.cts → Client-DBTcM9gB.d.cts} +1 -1
  91. package/build/cjs/{chunk-JPENHIJB.cjs → chunk-EY52J5Z4.cjs} +25 -15
  92. package/build/cjs/chunk-EY52J5Z4.cjs.map +1 -0
  93. package/build/cjs/{chunk-IU47QMYO.cjs → chunk-MCQVHD2F.cjs} +32 -28
  94. package/build/cjs/chunk-MCQVHD2F.cjs.map +1 -0
  95. package/build/cjs/chunk-T4NIFYZS.cjs +14 -0
  96. package/build/cjs/chunk-T4NIFYZS.cjs.map +1 -0
  97. package/build/cjs/index.cjs +154 -73
  98. package/build/cjs/index.cjs.map +1 -1
  99. package/build/cjs/index.d.cts +6 -4
  100. package/build/cjs/public/internal.cjs +6 -6
  101. package/build/cjs/public/internal.d.cts +1 -1
  102. package/build/cjs/public/unstable-do-not-use.cjs +683 -539
  103. package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
  104. package/build/cjs/public/unstable-do-not-use.d.cts +28 -27
  105. package/build/esm/Client.js.map +1 -1
  106. package/build/esm/createClient.js +11 -4
  107. package/build/esm/createClient.js.map +1 -1
  108. package/build/esm/createMinimalClient.js +2 -2
  109. package/build/esm/createMinimalClient.js.map +1 -1
  110. package/build/esm/index.js +1 -0
  111. package/build/esm/index.js.map +1 -1
  112. package/build/esm/object/SimpleOsdkProperties.js +2 -0
  113. package/build/esm/object/SimpleOsdkProperties.js.map +1 -0
  114. package/build/esm/object/convertWireToOsdkObjects/BaseHolder.js +2 -0
  115. package/build/esm/object/convertWireToOsdkObjects/BaseHolder.js.map +1 -0
  116. package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.js.map +1 -1
  117. package/build/esm/object/convertWireToOsdkObjects/ObjectHolder.js.map +1 -1
  118. package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js +25 -0
  119. package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
  120. package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js +10 -3
  121. package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
  122. package/build/esm/object/convertWireToOsdkObjects/getDollarAs.js.map +1 -1
  123. package/build/esm/object/convertWireToOsdkObjects/getDollarLink.js.map +1 -1
  124. package/build/esm/object/convertWireToOsdkObjects.js +12 -3
  125. package/build/esm/object/convertWireToOsdkObjects.js.map +1 -1
  126. package/build/esm/object/convertWireToOsdkObjects.test.js +7 -3
  127. package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
  128. package/build/esm/object/createObjectSpecifierFromPrimaryKey.js +20 -0
  129. package/build/esm/object/createObjectSpecifierFromPrimaryKey.js.map +1 -0
  130. package/build/esm/object/fetchPage.js +13 -1
  131. package/build/esm/object/fetchPage.js.map +1 -1
  132. package/build/esm/object/fetchPage.test.js +56 -2
  133. package/build/esm/object/fetchPage.test.js.map +1 -1
  134. package/build/esm/object/object.test.js +109 -0
  135. package/build/esm/object/object.test.js.map +1 -1
  136. package/build/esm/objectSet/InterfaceObjectSet.test.js +18 -2
  137. package/build/esm/objectSet/InterfaceObjectSet.test.js.map +1 -1
  138. package/build/esm/objectSet/ObjectSet.test.js +104 -100
  139. package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
  140. package/build/esm/objectSet/ObjectSetListenerWebsocket.js +18 -14
  141. package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
  142. package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js +2 -0
  143. package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
  144. package/build/esm/objectSet/createObjectSet.js.map +1 -1
  145. package/build/esm/observable/ListPayload.js.map +1 -1
  146. package/build/esm/observable/ObjectPayload.js.map +1 -1
  147. package/build/esm/observable/ObservableClient.js.map +1 -1
  148. package/build/esm/observable/internal/ActionApplication.js +29 -29
  149. package/build/esm/observable/internal/ActionApplication.js.map +1 -1
  150. package/build/esm/observable/internal/CacheKey.js +1 -1
  151. package/build/esm/observable/internal/CacheKey.js.map +1 -1
  152. package/build/esm/observable/internal/CacheKeys.js +2 -2
  153. package/build/esm/observable/internal/CacheKeys.js.map +1 -1
  154. package/build/esm/observable/internal/{ChangedObjects.js → Changes.js} +20 -9
  155. package/build/esm/observable/internal/Changes.js.map +1 -0
  156. package/build/esm/observable/internal/Layer.js +3 -0
  157. package/build/esm/observable/internal/Layer.js.map +1 -1
  158. package/build/esm/observable/internal/ListQuery.js +411 -170
  159. package/build/esm/observable/internal/ListQuery.js.map +1 -1
  160. package/build/esm/observable/internal/ObjectQuery.js +32 -16
  161. package/build/esm/observable/internal/ObjectQuery.js.map +1 -1
  162. package/build/esm/observable/internal/ObservableClientImpl.js +4 -12
  163. package/build/esm/observable/internal/ObservableClientImpl.js.map +1 -1
  164. package/build/esm/observable/internal/OptimisticJob.js.map +1 -1
  165. package/build/esm/observable/internal/OrderByCanonicalizer.js +73 -0
  166. package/build/esm/observable/internal/OrderByCanonicalizer.js.map +1 -0
  167. package/build/esm/observable/internal/OrderByCanonicalizer.test.js +78 -0
  168. package/build/esm/observable/internal/OrderByCanonicalizer.test.js.map +1 -0
  169. package/build/esm/observable/internal/Query.js +64 -31
  170. package/build/esm/observable/internal/Query.js.map +1 -1
  171. package/build/esm/observable/internal/RefCounts.js +7 -2
  172. package/build/esm/observable/internal/RefCounts.js.map +1 -1
  173. package/build/esm/observable/internal/SimpleWhereClause.js +2 -0
  174. package/build/esm/observable/internal/SimpleWhereClause.js.map +1 -0
  175. package/build/esm/observable/internal/Store.js +84 -267
  176. package/build/esm/observable/internal/Store.js.map +1 -1
  177. package/build/esm/observable/internal/Store.test.js +264 -247
  178. package/build/esm/observable/internal/Store.test.js.map +1 -1
  179. package/build/esm/observable/internal/WhereClauseCanonicalizer.js +11 -3
  180. package/build/esm/observable/internal/WhereClauseCanonicalizer.js.map +1 -1
  181. package/build/esm/observable/internal/objectMatchesWhereClause.js.map +1 -1
  182. package/build/esm/observable/internal/objectMatchesWhereClause.test.js.map +1 -1
  183. package/build/esm/observable/internal/testUtils.js +82 -18
  184. package/build/esm/observable/internal/testUtils.js.map +1 -1
  185. package/build/esm/public/unstable-do-not-use.js.map +1 -1
  186. package/build/esm/queries/applyQuery.js +33 -1
  187. package/build/esm/queries/applyQuery.js.map +1 -1
  188. package/build/esm/queries/queries.test.js +26 -5
  189. package/build/esm/queries/queries.test.js.map +1 -1
  190. package/build/esm/util/UserAgent.js +1 -1
  191. package/build/esm/util/toDataValueQueries.js +17 -0
  192. package/build/esm/util/toDataValueQueries.js.map +1 -1
  193. package/build/types/Client.d.ts +1 -1
  194. package/build/types/Client.d.ts.map +1 -1
  195. package/build/types/createClient.d.ts.map +1 -1
  196. package/build/types/index.d.ts +2 -1
  197. package/build/types/index.d.ts.map +1 -1
  198. package/build/types/object/SimpleOsdkProperties.d.ts +1 -0
  199. package/build/types/object/SimpleOsdkProperties.d.ts.map +1 -0
  200. package/build/types/object/convertWireToOsdkObjects/BaseHolder.d.ts +1 -0
  201. package/build/types/object/convertWireToOsdkObjects/BaseHolder.d.ts.map +1 -0
  202. package/build/types/object/convertWireToOsdkObjects.d.ts +8 -1
  203. package/build/types/object/convertWireToOsdkObjects.d.ts.map +1 -1
  204. package/build/types/object/createObjectSpecifierFromPrimaryKey.d.ts +2 -0
  205. package/build/types/object/createObjectSpecifierFromPrimaryKey.d.ts.map +1 -0
  206. package/build/types/object/object.test.d.ts.map +1 -1
  207. package/build/types/objectSet/ObjectSet.test.d.ts.map +1 -1
  208. package/build/types/observable/ListPayload.d.ts +5 -9
  209. package/build/types/observable/ListPayload.d.ts.map +1 -1
  210. package/build/types/observable/ObjectPayload.d.ts +4 -7
  211. package/build/types/observable/ObjectPayload.d.ts.map +1 -1
  212. package/build/types/observable/ObservableClient.d.ts +27 -11
  213. package/build/types/observable/ObservableClient.d.ts.map +1 -1
  214. package/build/types/observable/internal/ActionApplication.d.ts.map +1 -1
  215. package/build/types/observable/internal/CacheKeys.d.ts +1 -1
  216. package/build/types/observable/internal/CacheKeys.d.ts.map +1 -1
  217. package/build/types/observable/internal/Changes.d.ts +15 -0
  218. package/build/types/observable/internal/Changes.d.ts.map +1 -0
  219. package/build/types/observable/internal/Layer.d.ts +1 -0
  220. package/build/types/observable/internal/Layer.d.ts.map +1 -1
  221. package/build/types/observable/internal/ListQuery.d.ts +59 -14
  222. package/build/types/observable/internal/ListQuery.d.ts.map +1 -1
  223. package/build/types/observable/internal/ObjectQuery.d.ts +5 -6
  224. package/build/types/observable/internal/ObjectQuery.d.ts.map +1 -1
  225. package/build/types/observable/internal/OptimisticJob.d.ts +1 -1
  226. package/build/types/observable/internal/OptimisticJob.d.ts.map +1 -1
  227. package/build/types/observable/internal/OrderByCanonicalizer.d.ts +12 -0
  228. package/build/types/observable/internal/OrderByCanonicalizer.d.ts.map +1 -0
  229. package/build/types/observable/internal/OrderByCanonicalizer.test.d.ts +1 -0
  230. package/build/types/observable/internal/OrderByCanonicalizer.test.d.ts.map +1 -0
  231. package/build/types/observable/internal/Query.d.ts +39 -4
  232. package/build/types/observable/internal/Query.d.ts.map +1 -1
  233. package/build/types/observable/internal/RefCounts.d.ts.map +1 -1
  234. package/build/types/observable/internal/SimpleWhereClause.d.ts +2 -0
  235. package/build/types/observable/internal/SimpleWhereClause.d.ts.map +1 -0
  236. package/build/types/observable/internal/Store.d.ts +19 -43
  237. package/build/types/observable/internal/Store.d.ts.map +1 -1
  238. package/build/types/observable/internal/WhereClauseCanonicalizer.d.ts +2 -1
  239. package/build/types/observable/internal/WhereClauseCanonicalizer.d.ts.map +1 -1
  240. package/build/types/observable/internal/objectMatchesWhereClause.d.ts +4 -2
  241. package/build/types/observable/internal/objectMatchesWhereClause.d.ts.map +1 -1
  242. package/build/types/observable/internal/testUtils.d.ts +39 -9
  243. package/build/types/observable/internal/testUtils.d.ts.map +1 -1
  244. package/build/types/public/unstable-do-not-use.d.ts +1 -4
  245. package/build/types/public/unstable-do-not-use.d.ts.map +1 -1
  246. package/build/types/queries/applyQuery.d.ts.map +1 -1
  247. package/package.json +13 -11
  248. package/build/browser/observable/internal/ChangedObjects.js.map +0 -1
  249. package/build/cjs/chunk-IU47QMYO.cjs.map +0 -1
  250. package/build/cjs/chunk-JPENHIJB.cjs.map +0 -1
  251. package/build/esm/observable/internal/ChangedObjects.js.map +0 -1
  252. package/build/types/observable/internal/ChangedObjects.d.ts +0 -11
  253. package/build/types/observable/internal/ChangedObjects.d.ts.map +0 -1
@@ -1,5 +1,5 @@
1
- import { ObjectOrInterfaceDefinition, PropertyKeys, Augment, Osdk, ObjectTypeDefinition, PrimaryKeyType, ActionDefinition, WhereClause } from '@osdk/api';
2
- import { A as ActionSignatureFromDef, C as Client } from '../Client-C8K3E1vH.cjs';
1
+ import { ObjectOrInterfaceDefinition, PropertyKeys, Augment, ObjectTypeDefinition, Osdk, PrimaryKeyType, InterfaceDefinition, ActionDefinition, WhereClause } from '@osdk/api';
2
+ import { A as ActionSignatureFromDef, C as Client } from '../Client-DBTcM9gB.cjs';
3
3
  import '@osdk/shared.client';
4
4
  import '@osdk/api/unstable';
5
5
  import '@osdk/shared.client2';
@@ -10,32 +10,28 @@ type Canonical<T> = T & {
10
10
  __canonical: true;
11
11
  };
12
12
 
13
- interface ObjectPayload {
14
- object: Osdk.Instance<ObjectTypeDefinition> | undefined;
15
- isOptimistic: boolean;
16
- status: Status;
17
- lastUpdated: number;
18
- }
19
-
20
13
  interface OptimisticBuilder {
21
14
  updateObject: <T extends ObjectTypeDefinition>(value: Osdk.Instance<T>) => this;
22
15
  createObject: <T extends ObjectTypeDefinition>(type: T, primaryKey: PrimaryKeyType<T>, properties: Pick<Osdk.Instance<T>, PropertyKeys<T>>) => this;
23
16
  }
24
17
 
25
- type SubFn<X> = (x: X | undefined) => void;
26
-
27
18
  type Status = "init" | "loading" | "loaded" | "error";
19
+ interface Observer<T> {
20
+ next: (value: T) => void;
21
+ error: (err: any) => void;
22
+ complete: () => void;
23
+ }
28
24
  interface CommonObserveOptions {
29
25
  dedupeInterval?: number;
30
26
  }
31
27
  interface ObserveOptions {
32
28
  mode?: "offline" | "force";
33
29
  }
34
- type OrderBy<Q extends ObjectTypeDefinition> = {
30
+ type OrderBy<Q extends ObjectTypeDefinition | InterfaceDefinition> = {
35
31
  [K in PropertyKeys<Q>]?: "asc" | "desc" | undefined;
36
32
  };
37
- interface ObserveListOptions<Q extends ObjectTypeDefinition> extends CommonObserveOptions, ObserveOptions {
38
- objectType: Q["apiName"] | Q;
33
+ interface ObserveListOptions<Q extends ObjectTypeDefinition | InterfaceDefinition> extends CommonObserveOptions, ObserveOptions {
34
+ type: Pick<Q, "apiName" | "type">;
39
35
  where?: WhereClause<Q>;
40
36
  pageSize?: number;
41
37
  orderBy?: OrderBy<Q>;
@@ -43,29 +39,34 @@ interface ObserveListOptions<Q extends ObjectTypeDefinition> extends CommonObser
43
39
  expectedLength?: number;
44
40
  streamUpdates?: boolean;
45
41
  }
42
+ interface ObserveObjectArgs<T extends ObjectTypeDefinition> {
43
+ object: Osdk.Instance<T> | undefined;
44
+ isOptimistic: boolean;
45
+ status: Status;
46
+ lastUpdated: number;
47
+ }
48
+ interface ObserveObjectsArgs<T extends ObjectTypeDefinition | InterfaceDefinition> {
49
+ resolvedList: Array<Osdk.Instance<T>>;
50
+ isOptimistic: boolean;
51
+ lastUpdated: number;
52
+ fetchMore: () => Promise<unknown>;
53
+ hasMore: boolean;
54
+ status: Status;
55
+ }
46
56
  declare namespace ObservableClient {
47
57
  interface ApplyActionOptions {
48
58
  optimisticUpdate?: (ctx: OptimisticBuilder) => void;
49
59
  }
50
60
  }
51
61
  interface ObservableClient {
52
- observeObject<T extends ObjectTypeDefinition>(apiName: T["apiName"] | T, pk: PrimaryKeyType<T>, options: ObserveOptions, subFn: SubFn<ObjectPayload>): Unsubscribable;
53
- observeList<T extends ObjectTypeDefinition>(options: ObserveListOptions<T>, subFn: SubFn<ListPayload>): Unsubscribable;
62
+ observeObject<T extends ObjectTypeDefinition>(apiName: T["apiName"] | T, pk: PrimaryKeyType<T>, options: ObserveOptions, subFn: Observer<ObserveObjectArgs<T>>): Unsubscribable;
63
+ observeList<T extends ObjectTypeDefinition | InterfaceDefinition>(options: ObserveListOptions<T>, subFn: Observer<ObserveObjectsArgs<T>>): Unsubscribable;
54
64
  applyAction: <Q extends ActionDefinition<any>>(action: Q, args: Parameters<ActionSignatureFromDef<Q>["applyAction"]>[0], opts?: ObservableClient.ApplyActionOptions) => Promise<unknown>;
55
- canonicalizeWhereClause: <T extends ObjectTypeDefinition>(where: WhereClause<T>) => Canonical<WhereClause<T>>;
65
+ canonicalizeWhereClause: <T extends ObjectTypeDefinition | InterfaceDefinition>(where: WhereClause<T>) => Canonical<WhereClause<T>>;
56
66
  }
57
67
  declare function createObservableClient(client: Client): ObservableClient;
58
68
  interface Unsubscribable {
59
69
  unsubscribe: () => void;
60
70
  }
61
71
 
62
- interface ListPayload {
63
- resolvedList: Array<Osdk.Instance<any, never, string>>;
64
- isOptimistic: boolean;
65
- lastUpdated: number;
66
- fetchMore: () => Promise<unknown>;
67
- hasMore: boolean;
68
- status: Status;
69
- }
70
-
71
- export { ActionSignatureFromDef, type ListPayload, type ObjectPayload, ObservableClient, type Unsubscribable, augment, createObservableClient };
72
+ export { ActionSignatureFromDef, ObservableClient, type ObserveObjectArgs, type ObserveObjectsArgs, type Observer, type Unsubscribable, augment, createObservableClient };
@@ -1 +1 @@
1
- {"version":3,"file":"Client.js","names":["additionalContext","Symbol","MaxOsdkVersion","ErrorMessage"],"sources":["Client.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 {\n ActionDefinition,\n ActionMetadata,\n CompileTimeMetadata,\n InterfaceDefinition,\n InterfaceMetadata,\n ObjectMetadata,\n ObjectSet,\n ObjectTypeDefinition,\n QueryDefinition,\n QueryMetadata,\n VersionBound,\n} from \"@osdk/api\";\nimport type {\n Experiment,\n ExperimentFns,\n MinimalObjectSet,\n} from \"@osdk/api/unstable\";\nimport type { SharedClient } from \"@osdk/shared.client2\";\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.js\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport type { QuerySignatureFromDef } from \"./queries/types.js\";\nimport type { SatisfiesSemver } from \"./SatisfiesSemver.js\";\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\ntype OldSharedClient = import(\"@osdk/shared.client\").SharedClient;\n\nexport type CheckVersionBound<Q> = Q extends VersionBound<infer V> ? (\n SatisfiesSemver<V, MaxOsdkVersion> extends true ? Q\n : Q & {\n [ErrorMessage]:\n `Your SDK requires a semver compatible version with ${V}. You have ${MaxOsdkVersion}. Update your package.json`;\n }\n )\n : Q;\n\nexport interface Client extends SharedClient, OldSharedClient {\n <Q extends ObjectTypeDefinition>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"] ? ObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n <Q extends (InterfaceDefinition)>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"] ? MinimalObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n <Q extends ActionDefinition<any>>(\n o: Q,\n ): ActionSignatureFromDef<Q>;\n\n <Q extends QueryDefinition<any>>(\n o: Q,\n ): QuerySignatureFromDef<Q>;\n\n <Q extends Experiment<\"2.0.8\"> | Experiment<\"2.1.0\">>(\n experiment: Q,\n ): ExperimentFns<Q>;\n\n fetchMetadata<\n Q extends (\n | ObjectTypeDefinition\n | InterfaceDefinition\n | ActionDefinition<any>\n | QueryDefinition<any>\n ),\n >(o: Q): Promise<\n Q extends ObjectTypeDefinition ? ObjectMetadata\n : Q extends InterfaceDefinition ? InterfaceMetadata\n : Q extends ActionDefinition<any> ? ActionMetadata\n : Q extends QueryDefinition<any> ? QueryMetadata\n : never\n >;\n\n /** @internal */\n [additionalContext]: MinimalClient;\n}\n\n// DO NOT EXPORT FROM PACKAGE\n/** @internal */\nexport const additionalContext: unique symbol = Symbol(\"additionalContext\");\n\n// BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.\nconst MaxOsdkVersion = \"2.2.0\";\n// END: THIS IS GENERATED CODE. DO NOT EDIT.\nexport type MaxOsdkVersion = typeof MaxOsdkVersion;\nconst ErrorMessage: unique symbol = Symbol(\"ErrorMessage\");\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA0BA;;AAsDA;AACA;AACA,OAAO,MAAMA,iBAAgC,GAAGC,MAAM,CAAC,mBAAmB,CAAC;;AAE3E;AACA,MAAMC,cAAc,GAAG,OAAO;AAC9B;;AAEA,MAAMC,YAA2B,GAAGF,MAAM,CAAC,cAAc,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Client.js","names":["additionalContext","Symbol","MaxOsdkVersion","ErrorMessage"],"sources":["Client.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 {\n ActionDefinition,\n ActionMetadata,\n CompileTimeMetadata,\n InterfaceDefinition,\n InterfaceMetadata,\n ObjectMetadata,\n ObjectSet,\n ObjectTypeDefinition,\n QueryDefinition,\n QueryMetadata,\n VersionBound,\n} from \"@osdk/api\";\nimport type {\n Experiment,\n ExperimentFns,\n MinimalObjectSet,\n} from \"@osdk/api/unstable\";\nimport type { SharedClient } from \"@osdk/shared.client2\";\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.js\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport type { QuerySignatureFromDef } from \"./queries/types.js\";\nimport type { SatisfiesSemver } from \"./SatisfiesSemver.js\";\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\ntype OldSharedClient = import(\"@osdk/shared.client\").SharedClient;\n\nexport type CheckVersionBound<Q> = Q extends VersionBound<infer V> ? (\n SatisfiesSemver<V, MaxOsdkVersion> extends true ? Q\n : Q & {\n [ErrorMessage]:\n `Your SDK requires a semver compatible version with ${V}. You have ${MaxOsdkVersion}. Update your package.json`;\n }\n )\n : Q;\n\nexport interface Client extends SharedClient, OldSharedClient {\n <Q extends ObjectTypeDefinition>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"] ? ObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n <Q extends (InterfaceDefinition)>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"] ? MinimalObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n <Q extends ActionDefinition<any>>(\n o: Q,\n ): ActionSignatureFromDef<Q>;\n\n <Q extends QueryDefinition<any>>(\n o: Q,\n ): QuerySignatureFromDef<Q>;\n\n <Q extends Experiment<\"2.0.8\"> | Experiment<\"2.1.0\"> | Experiment<\"2.2.0\">>(\n experiment: Q,\n ): ExperimentFns<Q>;\n\n fetchMetadata<\n Q extends (\n | ObjectTypeDefinition\n | InterfaceDefinition\n | ActionDefinition<any>\n | QueryDefinition<any>\n ),\n >(o: Q): Promise<\n Q extends ObjectTypeDefinition ? ObjectMetadata\n : Q extends InterfaceDefinition ? InterfaceMetadata\n : Q extends ActionDefinition<any> ? ActionMetadata\n : Q extends QueryDefinition<any> ? QueryMetadata\n : never\n >;\n\n /** @internal */\n [additionalContext]: MinimalClient;\n}\n\n// DO NOT EXPORT FROM PACKAGE\n/** @internal */\nexport const additionalContext: unique symbol = Symbol(\"additionalContext\");\n\n// BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.\nconst MaxOsdkVersion = \"2.2.0\";\n// END: THIS IS GENERATED CODE. DO NOT EDIT.\nexport type MaxOsdkVersion = typeof MaxOsdkVersion;\nconst ErrorMessage: unique symbol = Symbol(\"ErrorMessage\");\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA0BA;;AAsDA;AACA;AACA,OAAO,MAAMA,iBAAgC,GAAGC,MAAM,CAAC,mBAAmB,CAAC;;AAE3E;AACA,MAAMC,cAAc,GAAG,OAAO;AAC9B;;AAEA,MAAMC,YAA2B,GAAGF,MAAM,CAAC,cAAc,CAAC","ignoreList":[]}
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference, __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid, __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks } from "@osdk/api/unstable";
17
+ import { __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference, __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid, __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid, __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks } from "@osdk/api/unstable";
18
18
  import * as OntologiesV2 from "@osdk/foundry.ontologies";
19
19
  import { symbolClientContext as oldSymbolClientContext } from "@osdk/shared.client";
20
20
  import { createBulkLinksAsyncIterFactory } from "./__unstable/createBulkLinksAsyncIterFactory.js";
@@ -22,6 +22,7 @@ import { applyAction } from "./actions/applyAction.js";
22
22
  import { additionalContext } from "./Client.js";
23
23
  import { createMinimalClient } from "./createMinimalClient.js";
24
24
  import { fetchMetadataInternal } from "./fetchMetadata.js";
25
+ import { fetchPage } from "./object/fetchPage.js";
25
26
  import { fetchSingle } from "./object/fetchSingle.js";
26
27
  import { createObjectSet } from "./objectSet/createObjectSet.js";
27
28
  import { applyQuery } from "./queries/applyQuery.js";
@@ -85,7 +86,7 @@ baseUrl, ontologyRid, tokenProvider, options = undefined, fetchFn = fetch) {
85
86
  case __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid.name:
86
87
  return {
87
88
  fetchOneByRid: async (objectType, rid, options) => {
88
- return await fetchSingle(clientCtx, objectType, options, createWithRid(rid));
89
+ return await fetchSingle(clientCtx, objectType, options, createWithRid([rid]));
89
90
  }
90
91
  };
91
92
  case __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference.name:
@@ -103,6 +104,12 @@ baseUrl, ontologyRid, tokenProvider, options = undefined, fetchFn = fetch) {
103
104
  });
104
105
  }
105
106
  };
107
+ case __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid.name:
108
+ return {
109
+ fetchPageByRid: async (objectOrInterfaceType, rids, options = {}) => {
110
+ return await fetchPage(clientCtx, objectOrInterfaceType, options, createWithRid(rids));
111
+ }
112
+ };
106
113
  }
107
114
  throw new Error("not implemented");
108
115
  } else {
@@ -125,10 +132,10 @@ baseUrl, ontologyRid, tokenProvider, options = undefined, fetchFn = fetch) {
125
132
  return client;
126
133
  }
127
134
  export const createClient = createClientInternal.bind(undefined, createObjectSet);
128
- function createWithRid(rid) {
135
+ function createWithRid(rids) {
129
136
  return {
130
137
  type: "static",
131
- "objects": [rid]
138
+ "objects": rids
132
139
  };
133
140
  }
134
141
  //# sourceMappingURL=createClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createClient.js","names":["__EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference","__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid","__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks","OntologiesV2","symbolClientContext","oldSymbolClientContext","createBulkLinksAsyncIterFactory","applyAction","additionalContext","createMinimalClient","fetchMetadataInternal","fetchSingle","createObjectSet","applyQuery","ActionInvoker","constructor","clientCtx","actionDef","bind","undefined","batchApplyAction","QueryInvoker","queryDef","executeFunction","createClientInternal","objectSetFactory","baseUrl","ontologyRid","tokenProvider","options","fetchFn","fetch","startsWith","Error","then","fetchMetadata","client","Object","defineProperties","o","type","name","getBulkLinks","fetchOneByRid","objectType","rid","createWithRid","createMediaReference","args","data","fileName","propertyType","MediaReferenceProperties","upload","apiName","mediaItemPath","preview","value","createClient"],"sources":["createClient.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n FilteredPropertyKeys,\n InterfaceDefinition,\n NullabilityAdherence,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n PropertyKeys,\n QueryDefinition,\n SelectArg,\n} from \"@osdk/api\";\nimport type {\n Experiment,\n ExperimentFns,\n MinimalObjectSet,\n} from \"@osdk/api/unstable\";\nimport {\n __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks,\n} from \"@osdk/api/unstable\";\nimport type { ObjectSet as WireObjectSet } from \"@osdk/foundry.ontologies\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport { symbolClientContext as oldSymbolClientContext } from \"@osdk/shared.client\";\nimport { createBulkLinksAsyncIterFactory } from \"./__unstable/createBulkLinksAsyncIterFactory.js\";\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.js\";\nimport { applyAction } from \"./actions/applyAction.js\";\nimport { additionalContext, type Client } from \"./Client.js\";\nimport { createMinimalClient } from \"./createMinimalClient.js\";\nimport { fetchMetadataInternal } from \"./fetchMetadata.js\";\nimport type { Logger } from \"./Logger.js\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport { fetchSingle } from \"./object/fetchSingle.js\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport type { ObjectSetFactory } from \"./objectSet/ObjectSetFactory.js\";\nimport { applyQuery } from \"./queries/applyQuery.js\";\nimport type { QuerySignatureFromDef } from \"./queries/types.js\";\n\n// We import it this way to keep compatible with CJS. If we referenced the\n// value of `symbolClientContext` directly, then we would have to a dynamic import\n// in `createClientInternal` which would make it async and a break.\n// Since this is just a string in `@osdk/shared.client2` instead of a symbol,\n// we can safely perform this trick.\ntype newSymbolClientContext =\n // eslint-disable-next-line @typescript-eslint/consistent-type-imports\n typeof import(\"@osdk/shared.client2\").symbolClientContext;\n\nclass ActionInvoker<Q extends ActionDefinition<any>>\n implements ActionSignatureFromDef<Q>\n{\n constructor(\n clientCtx: MinimalClient,\n actionDef: ActionDefinition<any>,\n ) {\n // We type the property as a generic function as binding `applyAction`\n // doesn't return a type thats all that useful anyway\n // The implements covers us for the most part here as this exact type doesn't\n // escape this file\n this.applyAction = applyAction.bind(undefined, clientCtx, actionDef);\n this.batchApplyAction = applyAction.bind(undefined, clientCtx, actionDef);\n }\n\n applyAction: (...args: any[]) => any;\n batchApplyAction: (...args: any[]) => any;\n}\n\nclass QueryInvoker<Q extends QueryDefinition<any>>\n implements QuerySignatureFromDef<Q>\n{\n constructor(\n clientCtx: MinimalClient,\n queryDef: QueryDefinition<any>,\n ) {\n this.executeFunction = applyQuery.bind(undefined, clientCtx, queryDef);\n }\n\n executeFunction: (...args: any[]) => any;\n}\n\n/** @internal */\nexport function createClientInternal(\n objectSetFactory: ObjectSetFactory<any, any>, // first so i can bind\n baseUrl: string,\n ontologyRid: string | Promise<string>,\n tokenProvider: () => Promise<string>,\n options: { logger?: Logger } | undefined = undefined,\n fetchFn: typeof globalThis.fetch = fetch,\n): Client {\n if (typeof ontologyRid === \"string\") {\n if (!ontologyRid.startsWith(\"ri.\")) {\n throw new Error(\"Invalid ontology RID\");\n }\n } else {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n ontologyRid.then((ontologyRid) => {\n if (!ontologyRid.startsWith(\"ri.\")) {\n // FIXME this promise is not await so this just shows up as an unhandled promise rejection\n throw new Error(\"Invalid ontology RID\");\n }\n });\n }\n\n const clientCtx: MinimalClient = createMinimalClient(\n { ontologyRid },\n baseUrl,\n tokenProvider,\n options,\n fetchFn,\n objectSetFactory,\n );\n\n function clientFn<\n T extends\n | ObjectOrInterfaceDefinition\n | ActionDefinition<any>\n | QueryDefinition<any>\n | Experiment<\"2.0.8\">\n | Experiment<\"2.1.0\">,\n >(o: T): T extends ObjectTypeDefinition ? ObjectSet<T>\n : T extends InterfaceDefinition ? MinimalObjectSet<T>\n : T extends ActionDefinition<any> ? ActionSignatureFromDef<T>\n : T extends QueryDefinition<any> ? QuerySignatureFromDef<T>\n : T extends Experiment<\"2.0.8\"> | Experiment<\"2.1.0\">\n ? { invoke: ExperimentFns<T> }\n : never\n {\n if (o.type === \"object\" || o.type === \"interface\") {\n return objectSetFactory(o, clientCtx) as any;\n } else if (o.type === \"action\") {\n return new ActionInvoker(\n clientCtx,\n o,\n ) as (T extends ActionDefinition<any>\n // first `as` to the action definition for our \"real\" typecheck\n ? ActionSignatureFromDef<T>\n : never) as any; // then as any for dealing with the conditional return value\n } else if (o.type === \"query\") {\n return new QueryInvoker(\n clientCtx,\n o,\n ) as (T extends QueryDefinition<any> ? QuerySignatureFromDef<T>\n : never) as any;\n } else if (o.type === \"experiment\") {\n switch (o.name) {\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks.name:\n return {\n getBulkLinks: createBulkLinksAsyncIterFactory(\n clientCtx,\n ),\n } as any;\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid.name:\n return {\n fetchOneByRid: async <\n Q extends ObjectTypeDefinition,\n const L extends PropertyKeys<Q>,\n const R extends boolean,\n const S extends false | \"throw\" = NullabilityAdherence.Default,\n >(\n objectType: Q,\n rid: string,\n options: SelectArg<Q, L, R, S>,\n ) => {\n return await fetchSingle(\n clientCtx,\n objectType,\n options,\n createWithRid(\n rid,\n ),\n ) as Osdk<Q>;\n },\n } as any;\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference.name:\n return {\n createMediaReference: async <\n Q extends ObjectTypeDefinition,\n const L extends FilteredPropertyKeys<Q, \"mediaReference\">,\n >(args: {\n data: Blob;\n fileName: string;\n objectType: Q;\n propertyType: L;\n }) => {\n const { data, fileName, objectType, propertyType } = args;\n return await OntologiesV2.MediaReferenceProperties.upload(\n clientCtx,\n await clientCtx.ontologyRid,\n objectType.apiName,\n propertyType as string,\n data,\n {\n mediaItemPath: fileName,\n preview: true,\n },\n );\n },\n } as any;\n }\n\n throw new Error(\"not implemented\");\n } else {\n throw new Error(\"not implemented\");\n }\n }\n\n const fetchMetadata = fetchMetadataInternal.bind(\n undefined,\n clientCtx,\n );\n\n const symbolClientContext: newSymbolClientContext = \"__osdkClientContext\";\n\n const client: Client = Object.defineProperties<Client>(\n clientFn as Client,\n {\n [oldSymbolClientContext]: {\n value: clientCtx,\n },\n [symbolClientContext]: {\n value: clientCtx,\n },\n [additionalContext]: {\n value: clientCtx,\n },\n fetchMetadata: {\n value: fetchMetadata,\n },\n } satisfies Record<keyof Client, PropertyDescriptor>,\n );\n\n return client;\n}\n\nexport const createClient: (\n baseUrl: string,\n ontologyRid: string | Promise<string>,\n tokenProvider: () => Promise<string>,\n options?: {\n logger?: Logger;\n } | undefined,\n fetchFn?: typeof fetch | undefined,\n) => Client = createClientInternal.bind(\n undefined,\n createObjectSet,\n);\n\nfunction createWithRid(\n rid: string,\n) {\n const withRid: WireObjectSet = {\n type: \"static\",\n \"objects\": [rid],\n };\n\n return withRid;\n}\n"],"mappings":"AAAA;AAC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Client.js","names":["__EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference","__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid","__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid","__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks","OntologiesV2","symbolClientContext","oldSymbolClientContext","createBulkLinksAsyncIterFactory","applyAction","additionalContext","createMinimalClient","fetchMetadataInternal","fetchPage","fetchSingle","createObjectSet","applyQuery","ActionInvoker","constructor","clientCtx","actionDef","bind","undefined","batchApplyAction","QueryInvoker","queryDef","executeFunction","createClientInternal","objectSetFactory","baseUrl","ontologyRid","tokenProvider","options","fetchFn","fetch","startsWith","Error","then","fetchMetadata","client","Object","defineProperties","o","type","name","getBulkLinks","fetchOneByRid","objectType","rid","createWithRid","createMediaReference","args","data","fileName","propertyType","MediaReferenceProperties","upload","apiName","mediaItemPath","preview","fetchPageByRid","objectOrInterfaceType","rids","value","createClient"],"sources":["createClient.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n FetchPageArgs,\n FilteredPropertyKeys,\n InterfaceDefinition,\n NullabilityAdherence,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n PropertyKeys,\n QueryDefinition,\n SelectArg,\n} from \"@osdk/api\";\nimport type {\n Experiment,\n ExperimentFns,\n MinimalObjectSet,\n} from \"@osdk/api/unstable\";\nimport {\n __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks,\n} from \"@osdk/api/unstable\";\nimport type { ObjectSet as WireObjectSet } from \"@osdk/foundry.ontologies\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport { symbolClientContext as oldSymbolClientContext } from \"@osdk/shared.client\";\nimport { createBulkLinksAsyncIterFactory } from \"./__unstable/createBulkLinksAsyncIterFactory.js\";\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.js\";\nimport { applyAction } from \"./actions/applyAction.js\";\nimport { additionalContext, type Client } from \"./Client.js\";\nimport { createMinimalClient } from \"./createMinimalClient.js\";\nimport { fetchMetadataInternal } from \"./fetchMetadata.js\";\nimport type { Logger } from \"./Logger.js\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport { fetchPage } from \"./object/fetchPage.js\";\nimport { fetchSingle } from \"./object/fetchSingle.js\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport type { ObjectSetFactory } from \"./objectSet/ObjectSetFactory.js\";\nimport { applyQuery } from \"./queries/applyQuery.js\";\nimport type { QuerySignatureFromDef } from \"./queries/types.js\";\n\n// We import it this way to keep compatible with CJS. If we referenced the\n// value of `symbolClientContext` directly, then we would have to a dynamic import\n// in `createClientInternal` which would make it async and a break.\n// Since this is just a string in `@osdk/shared.client2` instead of a symbol,\n// we can safely perform this trick.\ntype newSymbolClientContext =\n // eslint-disable-next-line @typescript-eslint/consistent-type-imports\n typeof import(\"@osdk/shared.client2\").symbolClientContext;\n\nclass ActionInvoker<Q extends ActionDefinition<any>>\n implements ActionSignatureFromDef<Q>\n{\n constructor(\n clientCtx: MinimalClient,\n actionDef: ActionDefinition<any>,\n ) {\n // We type the property as a generic function as binding `applyAction`\n // doesn't return a type thats all that useful anyway\n // The implements covers us for the most part here as this exact type doesn't\n // escape this file\n this.applyAction = applyAction.bind(undefined, clientCtx, actionDef);\n this.batchApplyAction = applyAction.bind(undefined, clientCtx, actionDef);\n }\n\n applyAction: (...args: any[]) => any;\n batchApplyAction: (...args: any[]) => any;\n}\n\nclass QueryInvoker<Q extends QueryDefinition<any>>\n implements QuerySignatureFromDef<Q>\n{\n constructor(\n clientCtx: MinimalClient,\n queryDef: QueryDefinition<any>,\n ) {\n this.executeFunction = applyQuery.bind(undefined, clientCtx, queryDef);\n }\n\n executeFunction: (...args: any[]) => any;\n}\n\n/** @internal */\nexport function createClientInternal(\n objectSetFactory: ObjectSetFactory<any, any>, // first so i can bind\n baseUrl: string,\n ontologyRid: string | Promise<string>,\n tokenProvider: () => Promise<string>,\n options: { logger?: Logger } | undefined = undefined,\n fetchFn: typeof globalThis.fetch = fetch,\n): Client {\n if (typeof ontologyRid === \"string\") {\n if (!ontologyRid.startsWith(\"ri.\")) {\n throw new Error(\"Invalid ontology RID\");\n }\n } else {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n ontologyRid.then((ontologyRid) => {\n if (!ontologyRid.startsWith(\"ri.\")) {\n // FIXME this promise is not await so this just shows up as an unhandled promise rejection\n throw new Error(\"Invalid ontology RID\");\n }\n });\n }\n\n const clientCtx: MinimalClient = createMinimalClient(\n { ontologyRid },\n baseUrl,\n tokenProvider,\n options,\n fetchFn,\n objectSetFactory,\n );\n\n function clientFn<\n T extends\n | ObjectOrInterfaceDefinition\n | ActionDefinition<any>\n | QueryDefinition<any>\n | Experiment<\"2.0.8\">\n | Experiment<\"2.1.0\">,\n >(o: T): T extends ObjectTypeDefinition ? ObjectSet<T>\n : T extends InterfaceDefinition ? MinimalObjectSet<T>\n : T extends ActionDefinition<any> ? ActionSignatureFromDef<T>\n : T extends QueryDefinition<any> ? QuerySignatureFromDef<T>\n : T extends Experiment<\"2.0.8\"> | Experiment<\"2.1.0\">\n ? { invoke: ExperimentFns<T> }\n : never\n {\n if (o.type === \"object\" || o.type === \"interface\") {\n return objectSetFactory(o, clientCtx) as any;\n } else if (o.type === \"action\") {\n return new ActionInvoker(\n clientCtx,\n o,\n ) as (T extends ActionDefinition<any>\n // first `as` to the action definition for our \"real\" typecheck\n ? ActionSignatureFromDef<T>\n : never) as any; // then as any for dealing with the conditional return value\n } else if (o.type === \"query\") {\n return new QueryInvoker(\n clientCtx,\n o,\n ) as (T extends QueryDefinition<any> ? QuerySignatureFromDef<T>\n : never) as any;\n } else if (o.type === \"experiment\") {\n switch (o.name) {\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks.name:\n return {\n getBulkLinks: createBulkLinksAsyncIterFactory(\n clientCtx,\n ),\n } as any;\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid.name:\n return {\n fetchOneByRid: async <\n Q extends ObjectTypeDefinition,\n const L extends PropertyKeys<Q>,\n const R extends boolean,\n const S extends false | \"throw\" = NullabilityAdherence.Default,\n >(\n objectType: Q,\n rid: string,\n options: SelectArg<Q, L, R, S>,\n ) => {\n return await fetchSingle(\n clientCtx,\n objectType,\n options,\n createWithRid(\n [rid],\n ),\n ) as Osdk<Q>;\n },\n } as any;\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference.name:\n return {\n createMediaReference: async <\n Q extends ObjectTypeDefinition,\n const L extends FilteredPropertyKeys<Q, \"mediaReference\">,\n >(args: {\n data: Blob;\n fileName: string;\n objectType: Q;\n propertyType: L;\n }) => {\n const { data, fileName, objectType, propertyType } = args;\n return await OntologiesV2.MediaReferenceProperties.upload(\n clientCtx,\n await clientCtx.ontologyRid,\n objectType.apiName,\n propertyType as string,\n data,\n {\n mediaItemPath: fileName,\n preview: true,\n },\n );\n },\n } as any;\n\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid.name:\n return {\n fetchPageByRid: async <\n Q extends ObjectOrInterfaceDefinition,\n const L extends PropertyKeys<Q>,\n const R extends boolean,\n const S extends false | \"throw\" = NullabilityAdherence.Default,\n >(\n objectOrInterfaceType: Q,\n rids: string[],\n options: FetchPageArgs<Q, L, R, any, S> = {},\n ) => {\n return await fetchPage(\n clientCtx,\n objectOrInterfaceType,\n options,\n createWithRid(rids),\n );\n },\n } as any;\n }\n\n throw new Error(\"not implemented\");\n } else {\n throw new Error(\"not implemented\");\n }\n }\n\n const fetchMetadata = fetchMetadataInternal.bind(\n undefined,\n clientCtx,\n );\n\n const symbolClientContext: newSymbolClientContext = \"__osdkClientContext\";\n\n const client: Client = Object.defineProperties<Client>(\n clientFn as Client,\n {\n [oldSymbolClientContext]: {\n value: clientCtx,\n },\n [symbolClientContext]: {\n value: clientCtx,\n },\n [additionalContext]: {\n value: clientCtx,\n },\n fetchMetadata: {\n value: fetchMetadata,\n },\n } satisfies Record<keyof Client, PropertyDescriptor>,\n );\n\n return client;\n}\n\nexport const createClient: (\n baseUrl: string,\n ontologyRid: string | Promise<string>,\n tokenProvider: () => Promise<string>,\n options?: {\n logger?: Logger;\n } | undefined,\n fetchFn?: typeof fetch | undefined,\n) => Client = createClientInternal.bind(\n undefined,\n createObjectSet,\n);\n\nfunction createWithRid(\n rids: string[],\n) {\n const withRid: WireObjectSet = {\n type: \"static\",\n \"objects\": rids,\n };\n\n return withRid;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAqBA,SACEA,uDAAuD,EACvDC,gDAAgD,EAChDC,iDAAiD,EACjDC,+CAA+C,QAC1C,oBAAoB;AAE3B,OAAO,KAAKC,YAAY,MAAM,0BAA0B;AACxD,SAASC,mBAAmB,IAAIC,sBAAsB,QAAQ,qBAAqB;AACnF,SAASC,+BAA+B,QAAQ,iDAAiD;AAEjG,SAASC,WAAW,QAAQ,0BAA0B;AACtD,SAASC,iBAAiB,QAAqB,aAAa;AAC5D,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,SAASC,qBAAqB,QAAQ,oBAAoB;AAG1D,SAASC,SAAS,QAAQ,uBAAuB;AACjD,SAASC,W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ACvDrC,SAAS,EACT,MAAMA,SAAS,CAACW,WAAW,EAC3BiB,UAAU,CAACU,OAAO,EAClBH,YAAY,EACZF,IAAI,EACJ;gBACEM,aAAa,EAAEL,QAAQ;gBACvBM,OAAO,EAAE;cACX,CACF,CAAC;YACH;UACF,CAAC;QAEH,KAAKxD,iDAAiD,CAACyC,IAAI;UACzD,OAAO;YACLgB,cAAc,EAAE,MAAAA,CAMdC,qBAAwB,EACxBC,IAAc,EACd9B,OAAuC,GAAG,CAAC,CAAC,KACzC;cACH,OAAO,MAAMnB,SAAS,CACpBM,SAAS,EACT0C,qBAAqB,EACrB7B,OAAO,EACPiB,aAAa,CAACa,IAAI,CACpB,CAAC;YACH;UACF,CAAC;MACL;MAEA,MAAM,IAAI1B,KAAK,CAAC,iBAAiB,CAAC;IACpC,CAAC,MAAM;MACL,MAAM,IAAIA,KAAK,CAAC,iBAAiB,CAAC;IACpC;EACF,CAAC,EAWC;IACE,CAAC7B,sBAAsB,GAAG;MACxBwD,KAAK,EAAE5C;IACT,CAAC;IACD,CARgD,qBAAqB,GAQ9C;MACrB4C,KAAK,EAAE5C;IACT,CAAC;IACD,CAACT,iBAAiB,GAAG;MACnBqD,KAAK,EAAE5C;IACT,CAAC;IACDmB,aAAa,EAAE;MACbyB,KAAK,EAAEzB;IACT;EACF,CACF,CAAC;EAED,OAAOC,MAAM;AACf;AAEA,OAAO,MAAMyB,YAQF,GAAGrC,oBAAoB,CAACN,IAAI,CACrCC,SAAS,EACTP,eACF,CAAC;AAED,SAASkC,aAAaA,CACpBa,IAAc,EACd;EAMA,OAL+B;IAC7BnB,IAAI,EAAE,QAAQ;IACd,SAAS,EAAEmB;EACb,CAAC;AAGH","ignoreList":[]}
@@ -21,7 +21,7 @@ import { createStandardOntologyProviderFactory } from "./ontology/StandardOntolo
21
21
  import { USER_AGENT } from "./util/UserAgent.js";
22
22
 
23
23
  /** @internal */
24
- export function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory = createObjectSet) {
24
+ export function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory = createObjectSet, createOntologyProviderFactory = createStandardOntologyProviderFactory) {
25
25
  if (process.env.NODE_ENV !== "production") {
26
26
  try {
27
27
  new URL(baseUrl);
@@ -43,7 +43,7 @@ export function createMinimalClient(metadata, baseUrl, tokenProvider, options =
43
43
  requestContext: {}
44
44
  };
45
45
  return Object.freeze(Object.assign(minimalClient, {
46
- ontologyProvider: createStandardOntologyProviderFactory(options)(minimalClient)
46
+ ontologyProvider: createOntologyProviderFactory(options)(minimalClient)
47
47
  }));
48
48
  }
49
49
  //# sourceMappingURL=createMinimalClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createMinimalClient.js","names":["createSharedClientContext","convertWireToOsdkObjects","convertWireToOsdkObjects2","createObjectSet","createStandardOntologyProviderFactory","USER_AGENT","createMinimalClient","metadata","baseUrl","tokenProvider","options","fetchFn","global","fetch","objectSetFactory","process","env","NODE_ENV","URL","e","hint","startsWith","Error","processedBaseUrl","pathname","endsWith","minimalClient","toString","objectFactory","objectFactory2","ontologyRid","logger","clientCacheKey","requestContext","Object","freeze","assign","ontologyProvider"],"sources":["createMinimalClient.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 { createSharedClientContext } from \"@osdk/shared.client.impl\";\nimport type { Logger } from \"./Logger.js\";\nimport type {\n ClientCacheKey,\n MinimalClient,\n MinimalClientParams,\n} from \"./MinimalClientContext.js\";\nimport {\n convertWireToOsdkObjects,\n convertWireToOsdkObjects2,\n} from \"./object/convertWireToOsdkObjects.js\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport type { ObjectSetFactory } from \"./objectSet/ObjectSetFactory.js\";\nimport {\n createStandardOntologyProviderFactory,\n type OntologyCachingOptions,\n} from \"./ontology/StandardOntologyProvider.js\";\nimport { USER_AGENT } from \"./util/UserAgent.js\";\n\n/** @internal */\nexport function createMinimalClient(\n metadata: MinimalClientParams[\"metadata\"],\n baseUrl: string,\n tokenProvider: () => Promise<string>,\n options: OntologyCachingOptions & { logger?: Logger } = {},\n fetchFn: (\n input: Request | URL | string,\n init?: RequestInit | undefined,\n ) => Promise<Response> = global.fetch,\n objectSetFactory: ObjectSetFactory<any, any> = createObjectSet,\n) {\n if (process.env.NODE_ENV !== \"production\") {\n try {\n new URL(baseUrl);\n } catch (e) {\n const hint =\n !baseUrl.startsWith(\"http://\") || !baseUrl.startsWith(\"https://\")\n ? \". Did you forget to add 'http://' or 'https://'?\"\n : \"\";\n throw new Error(`Invalid stack URL: ${baseUrl}${hint}`);\n }\n }\n const processedBaseUrl = new URL(baseUrl);\n processedBaseUrl.pathname += processedBaseUrl.pathname.endsWith(\"/\")\n ? \"\"\n : \"/\";\n const minimalClient: MinimalClient = {\n ...createSharedClientContext(\n processedBaseUrl.toString(),\n tokenProvider,\n USER_AGENT,\n fetchFn,\n ),\n objectSetFactory,\n objectFactory: convertWireToOsdkObjects,\n objectFactory2: convertWireToOsdkObjects2,\n ontologyRid: metadata.ontologyRid,\n logger: options.logger,\n clientCacheKey: {} as ClientCacheKey,\n requestContext: {},\n } satisfies Omit<\n MinimalClient,\n \"ontologyProvider\"\n > as any;\n\n return Object.freeze(Object.assign(minimalClient, {\n ontologyProvider: createStandardOntologyProviderFactory(\n options,\n )(minimalClient),\n }));\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,yBAA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ACpCC,cAAc,EAAE,CAAC;EACnB,CAGQ;EAER,OAAOC,MAAM,CAACC,MAAM,CAACD,MAAM,CAACE,MAAM,CAACV,aAAa,EAAE;IAChDW,gBAAgB,EAAEjC,qCAAqC,CACrDM,OACF,CAAC,CAACgB,aAAa;EACjB,CAAC,CAAC,CAAC;AACL","ignoreList":[]}
1
+ {"version":3,"file":"createMinimalClient.js","names":["createSharedClientContext","convertWireToOsdkObjects","convertWireToOsdkObjects2","createObjectSet","createStandardOntologyProviderFactory","USER_AGENT","createMinimalClient","metadata","baseUrl","tokenProvider","options","fetchFn","global","fetch","objectSetFactory","createOntologyProviderFactory","process","env","NODE_ENV","URL","e","hint","startsWith","Error","processedBaseUrl","pathname","endsWith","minimalClient","toString","objectFactory","objectFactory2","ontologyRid","logger","clientCacheKey","requestContext","Object","freeze","assign","ontologyProvider"],"sources":["createMinimalClient.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 { createSharedClientContext } from \"@osdk/shared.client.impl\";\nimport type { Logger } from \"./Logger.js\";\nimport type {\n ClientCacheKey,\n MinimalClient,\n MinimalClientParams,\n} from \"./MinimalClientContext.js\";\nimport {\n convertWireToOsdkObjects,\n convertWireToOsdkObjects2,\n} from \"./object/convertWireToOsdkObjects.js\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport type { ObjectSetFactory } from \"./objectSet/ObjectSetFactory.js\";\nimport type { OntologyProvider } from \"./ontology/OntologyProvider.js\";\nimport {\n createStandardOntologyProviderFactory,\n type OntologyCachingOptions,\n} from \"./ontology/StandardOntologyProvider.js\";\nimport { USER_AGENT } from \"./util/UserAgent.js\";\n\n/** @internal */\nexport function createMinimalClient(\n metadata: MinimalClientParams[\"metadata\"],\n baseUrl: string,\n tokenProvider: () => Promise<string>,\n options: OntologyCachingOptions & { logger?: Logger } = {},\n fetchFn: (\n input: Request | URL | string,\n init?: RequestInit | undefined,\n ) => Promise<Response> = global.fetch,\n objectSetFactory: ObjectSetFactory<any, any> = createObjectSet,\n createOntologyProviderFactory: (\n a: OntologyCachingOptions & { logger?: Logger },\n ) => (minimalClient: MinimalClient) => OntologyProvider =\n createStandardOntologyProviderFactory,\n) {\n if (process.env.NODE_ENV !== \"production\") {\n try {\n new URL(baseUrl);\n } catch (e) {\n const hint =\n !baseUrl.startsWith(\"http://\") || !baseUrl.startsWith(\"https://\")\n ? \". Did you forget to add 'http://' or 'https://'?\"\n : \"\";\n throw new Error(`Invalid stack URL: ${baseUrl}${hint}`);\n }\n }\n const processedBaseUrl = new URL(baseUrl);\n processedBaseUrl.pathname += processedBaseUrl.pathname.endsWith(\"/\")\n ? \"\"\n : \"/\";\n const minimalClient: MinimalClient = {\n ...createSharedClientContext(\n processedBaseUrl.toString(),\n tokenProvider,\n USER_AGENT,\n fetchFn,\n ),\n objectSetFactory,\n objectFactory: convertWireToOsdkObjects,\n objectFactory2: convertWireToOsdkObjects2,\n ontologyRid: metadata.ontologyRid,\n logger: options.logger,\n clientCacheKey: {} as ClientCacheKey,\n requestContext: {},\n } satisfies Omit<\n MinimalClient,\n \"ontologyProvider\"\n > as any;\n\n return Object.freeze(Object.assign(minimalClient, {\n ontologyProvider: createOntologyProviderFactory(\n options,\n )(minimalClient),\n }));\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,yBAAyB,QAAQ,0BAA0B;AAOpE,SACEC,wBAAwB,EACxBC,yBAAyB,QACpB,sCAAsC;AAC7C,SAASC,e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,CAACC,MAAM,CAACD,MAAM,CAACE,MAAM,CAACV,aAAa,EAAE;IAChDW,gBAAgB,EAAEvB,6BAA6B,CAC7CL,OACF,CAAC,CAACiB,aAAa;EACjB,CAAC,CAAC,CAAC;AACL","ignoreList":[]}
@@ -20,5 +20,6 @@ export { ActionValidationError } from "./actions/ActionValidationError.js";
20
20
  export { createClient } from "./createClient.js";
21
21
  export { createPlatformClient } from "./createPlatformClient.js";
22
22
  export { createAttachmentUpload } from "./object/AttachmentUpload.js";
23
+ export { createObjectSpecifierFromPrimaryKey } from "./object/createObjectSpecifierFromPrimaryKey.js";
23
24
  export { extractDate, extractDateInLocalTime, extractDateInUTC } from "./util/datetimeConverters.js";
24
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["isOk","PalantirApiError","ActionValidationError","createClient","createPlatformClient","createAttachmentUpload","extractDate","extractDateInLocalTime","extractDateInUTC"],"sources":["index.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type {\n ActionDefinition,\n ActionEditResponse,\n ActionMetadata,\n ActionParam,\n ActionReturnTypeForOptions,\n ActionValidationResponse,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n InterfaceDefinition,\n ObjectMetadata,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n OsdkObject,\n PageResult,\n PropertyDef,\n PropertyKeys,\n PropertyValueWireToClient,\n QueryDefinition,\n QueryParam,\n QueryResult,\n Result,\n SingleLinkAccessor,\n VersionBound,\n WhereClause,\n} from \"@osdk/api\";\nexport { isOk } from \"@osdk/api\";\nexport { PalantirApiError } from \"@osdk/shared.net.errors\";\n\nexport { ActionValidationError } from \"./actions/ActionValidationError.js\";\nexport type { Client } from \"./Client.js\";\nexport { createClient } from \"./createClient.js\";\nexport { createPlatformClient } from \"./createPlatformClient.js\";\nexport type { PlatformClient } from \"./createPlatformClient.js\";\nexport type { Logger } from \"./Logger.js\";\nexport { createAttachmentUpload } from \"./object/AttachmentUpload.js\";\nexport type { ResultOrError } from \"./ResultOrError.js\";\n\nexport {\n extractDate,\n extractDateInLocalTime,\n extractDateInUTC,\n} from \"./util/datetimeConverters.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA6BA,SAASA,IAAI,QAAQ,WAAW;AAChC,SAASC,gBAAgB,QAAQ,yBAAyB;AAE1D,SAASC,qBAAqB,QAAQ,oCAAoC;AAE1E,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,oBAAoB,QAAQ,2BAA2B;AAGhE,SAASC,sBAAsB,QAAQ,8BAA8B;AAGrE,SACEC,WAAW,EACXC,sBAAsB,EACtBC,gBAAgB,QACX,8BAA8B","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["isOk","PalantirApiError","ActionValidationError","createClient","createPlatformClient","createAttachmentUpload","createObjectSpecifierFromPrimaryKey","extractDate","extractDateInLocalTime","extractDateInUTC"],"sources":["index.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type {\n ActionDefinition,\n ActionEditResponse,\n ActionMetadata,\n ActionParam,\n ActionReturnTypeForOptions,\n ActionValidationResponse,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n InterfaceDefinition,\n ObjectMetadata,\n ObjectSet,\n ObjectSpecifier,\n ObjectTypeDefinition,\n Osdk,\n OsdkObject,\n PageResult,\n PropertyDef,\n PropertyKeys,\n PropertyValueWireToClient,\n QueryDefinition,\n QueryParam,\n QueryResult,\n Result,\n SingleLinkAccessor,\n VersionBound,\n WhereClause,\n} from \"@osdk/api\";\nexport { isOk } from \"@osdk/api\";\nexport { PalantirApiError } from \"@osdk/shared.net.errors\";\n\nexport { ActionValidationError } from \"./actions/ActionValidationError.js\";\nexport type { Client } from \"./Client.js\";\nexport { createClient } from \"./createClient.js\";\nexport { createPlatformClient } from \"./createPlatformClient.js\";\nexport type { PlatformClient } from \"./createPlatformClient.js\";\nexport type { Logger } from \"./Logger.js\";\nexport { createAttachmentUpload } from \"./object/AttachmentUpload.js\";\nexport { createObjectSpecifierFromPrimaryKey } from \"./object/createObjectSpecifierFromPrimaryKey.js\";\nexport type { ResultOrError } from \"./ResultOrError.js\";\n\nexport {\n extractDate,\n extractDateInLocalTime,\n extractDateInUTC,\n} from \"./util/datetimeConverters.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA8BA,SAASA,IAAI,QAAQ,WAAW;AAChC,SAASC,gBAAgB,QAAQ,yBAAyB;AAE1D,SAASC,qBAAqB,QAAQ,oCAAoC;AAE1E,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,oBAAoB,QAAQ,2BAA2B;AAGhE,SAASC,sBAAsB,QAAQ,8BAA8B;AACrE,SAASC,mCAAmC,QAAQ,iDAAiD;AAGrG,SACEC,WAAW,EACXC,sBAAsB,EACtBC,gBAAgB,QACX,8BAA8B","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=SimpleOsdkProperties.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SimpleOsdkProperties.js","names":[],"sources":["SimpleOsdkProperties.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\n/**\n * Represents a \"pure\" object from the wire that has its special properties with\n * $ prefix and is ready to be converted to an Osdk object.\n *\n * This object intentionally does not have any generics attached to keep it simple\n * to use.\n *\n * @internal\n */\nexport interface SimpleOsdkProperties {\n $apiName: string;\n $objectType: string;\n $primaryKey: string | number | boolean;\n $title: string | undefined;\n\n [key: string]:\n | string\n | Array<string>\n | number\n | Array<number>\n | boolean\n | Array<boolean>\n | undefined;\n}\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=BaseHolder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseHolder.js","names":[],"sources":["BaseHolder.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ObjectOrInterfaceDefinition, ObjectSpecifier } from \"@osdk/api\";\nimport type { InterfaceHolder } from \"./InterfaceHolder.js\";\nimport type { UnderlyingOsdkObject } from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\n/** @internal */\n\nexport interface BaseHolder {\n readonly [UnderlyingOsdkObject]: ObjectHolder;\n\n readonly $apiName: string;\n readonly $objectType: string;\n readonly $primaryKey: string | number | boolean;\n readonly $title: string | undefined;\n readonly $objectSpecifier: ObjectSpecifier<any>;\n\n readonly \"$as\": (\n newDef: string | ObjectOrInterfaceDefinition,\n ) => ObjectHolder | InterfaceHolder;\n\n readonly \"$clone\": (\n newProps?: Record<string, any>,\n ) => this;\n\n // [key: `$$${string}`]: any;\n // Unlike SimpleOsdkProperties, all of our remaining types are unknown as the full\n // union is basically `any` when you consider the above fields.\n [key: string]: unknown;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"InterfaceHolder.js","names":[],"sources":["InterfaceHolder.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 { InterfaceMetadata, Osdk } from \"@osdk/api\";\nimport type { FetchedObjectTypeDefinition } from \"../../ontology/OntologyProvider.js\";\nimport type {\n InterfaceDefRef,\n UnderlyingOsdkObject,\n} from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\n/** @internal */\nexport interface InterfaceHolder<\n Q extends FetchedObjectTypeDefinition,\n> {\n [UnderlyingOsdkObject]: Osdk<Q> & ObjectHolder<Q>;\n [InterfaceDefRef]: InterfaceMetadata;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"InterfaceHolder.js","names":[],"sources":["InterfaceHolder.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 { InterfaceMetadata, Osdk } from \"@osdk/api\";\nimport type { BaseHolder } from \"./BaseHolder.js\";\nimport type { InterfaceDefRef } from \"./InternalSymbols.js\";\n\n/** @internal */\nexport interface InterfaceHolder<\n _Q extends Osdk.Instance<any> = never,\n> extends BaseHolder {\n [InterfaceDefRef]: InterfaceMetadata;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"ObjectHolder.js","names":[],"sources":["ObjectHolder.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 { Osdk } from \"@osdk/api\";\nimport type { MinimalClient } from \"../../MinimalClientContext.js\";\nimport type { FetchedObjectTypeDefinition } from \"../../ontology/OntologyProvider.js\";\nimport type { DollarAsFn } from \"./getDollarAs.js\";\nimport type { get$link } from \"./getDollarLink.js\";\nimport type {\n ClientRef,\n ObjectDefRef,\n UnderlyingOsdkObject,\n} from \"./InternalSymbols.js\";\n\n/** @internal */\nexport interface ObjectHolder<Q extends FetchedObjectTypeDefinition> {\n readonly [UnderlyingOsdkObject]: Osdk<Q>;\n readonly [ObjectDefRef]: FetchedObjectTypeDefinition;\n readonly [ClientRef]: MinimalClient;\n readonly \"$as\": DollarAsFn;\n readonly \"$link\": ReturnType<typeof get$link>;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"ObjectHolder.js","names":[],"sources":["ObjectHolder.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 { Osdk } from \"@osdk/api\";\nimport type { MinimalClient } from \"../../MinimalClientContext.js\";\nimport type { FetchedObjectTypeDefinition } from \"../../ontology/OntologyProvider.js\";\nimport type { BaseHolder } from \"./BaseHolder.js\";\nimport type { get$link } from \"./getDollarLink.js\";\nimport type { ClientRef, ObjectDefRef } from \"./InternalSymbols.js\";\n\n/**\n * @internal\n *\n * The unused generic parameter `_Q` can be used as an added check when casting.\n * That is its only purpose\n */\nexport interface ObjectHolder<_Q extends Osdk.Instance<any> = never>\n extends BaseHolder\n{\n readonly [ObjectDefRef]: FetchedObjectTypeDefinition;\n readonly [ClientRef]: MinimalClient;\n\n readonly \"$link\": ReturnType<typeof get$link>;\n}\n"],"mappings":"","ignoreList":[]}
@@ -48,6 +48,10 @@ export function createOsdkInterface(underlying, interfaceDef) {
48
48
  value: underlying.$rid,
49
49
  enumerable: "$rid" in underlying
50
50
  },
51
+ "$clone": {
52
+ value: clone,
53
+ enumerable: false
54
+ },
51
55
  [InterfaceDefRef]: {
52
56
  value: interfaceDef
53
57
  },
@@ -61,5 +65,26 @@ export function createOsdkInterface(underlying, interfaceDef) {
61
65
  }];
62
66
  }))
63
67
  }));
68
+ function clone(update) {
69
+ if (update == null) {
70
+ return underlying.$clone().$as(interfaceDef);
71
+ }
72
+ for (const key of Object.keys(update)) {
73
+ if (!(key in interfaceDef.properties)) {
74
+ throw new Error(`Invalid property ${key} for interface ${interfaceDef.apiName}`);
75
+ }
76
+ }
77
+ const remappedProps = Object.fromEntries(Object.keys(update).map(p => mapProperty(p, update[p])).filter(x => x != null));
78
+ return underlying.$clone(remappedProps).$as(interfaceDef);
79
+ }
80
+ function mapProperty(propertyName, value) {
81
+ const objDef = underlying[ObjectDefRef];
82
+ const targetPropName = objDef.interfaceMap[interfaceDef.apiName][propertyName];
83
+ // If the underlying object does not implement the SPT, throw errors
84
+ if (targetPropName == null) {
85
+ throw new Error(`Cannot clone interface with ${propertyName} as property is not implemented by the underlying object type ${objDef.apiName}`);
86
+ }
87
+ return [targetPropName, value];
88
+ }
64
89
  }
65
90
  //# sourceMappingURL=createOsdkInterface.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createOsdkInterface.js","names":["extractNamespace","InterfaceDefRef","ObjectDefRef","UnderlyingOsdkObject","createOsdkInterface","underlying","interfaceDef","objApiNamespace","apiName","Object","freeze","defineProperties","value","enumerable","$as","$objectType","$primaryKey","$title","$rid","fromEntries","keys","properties","map","p","objDef","apiNamespace","targetPropName","interfaceMap"],"sources":["createOsdkInterface.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 { InterfaceMetadata, Osdk } from \"@osdk/api\";\nimport { extractNamespace } from \"../../internal/conversions/modernToLegacyWhereClause.js\";\nimport type { FetchedObjectTypeDefinition } from \"../../ontology/OntologyProvider.js\";\nimport type { InterfaceHolder } from \"./InterfaceHolder.js\";\nimport {\n InterfaceDefRef,\n ObjectDefRef,\n UnderlyingOsdkObject,\n} from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\n/** @internal */\nexport function createOsdkInterface<\n Q extends FetchedObjectTypeDefinition,\n>(\n underlying: Osdk<Q> & ObjectHolder<Q>,\n interfaceDef: InterfaceMetadata,\n) {\n const [objApiNamespace] = extractNamespace(interfaceDef.apiName);\n\n return Object.freeze(\n Object.defineProperties({}, {\n // first to minimize hidden classes\n [UnderlyingOsdkObject]: { value: underlying },\n\n \"$apiName\": { value: interfaceDef.apiName, enumerable: true },\n \"$as\": {\n value: underlying.$as,\n enumerable: false,\n },\n \"$objectType\": {\n value: underlying.$objectType,\n enumerable: \"$objectType\" in underlying,\n },\n \"$primaryKey\": {\n value: underlying.$primaryKey,\n enumerable: \"$primaryKey\" in underlying,\n },\n \"$title\": {\n value: underlying.$title,\n enumerable: \"$title\" in underlying,\n },\n \"$rid\": {\n value: (underlying as any).$rid,\n enumerable: \"$rid\" in underlying,\n },\n\n [InterfaceDefRef]: { value: interfaceDef },\n\n ...Object.fromEntries(\n Object.keys(interfaceDef.properties).map(p => {\n const objDef = underlying[ObjectDefRef];\n\n const [apiNamespace, apiName] = extractNamespace(p);\n\n const targetPropName = objDef\n .interfaceMap![interfaceDef.apiName][p];\n\n return [apiNamespace === objApiNamespace ? apiName : p, {\n enumerable: targetPropName in underlying,\n value: underlying[targetPropName as keyof typeof underlying],\n }];\n }),\n ),\n }) as InterfaceHolder<any> & Osdk<any>,\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,gBAAgB,QA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AgB,CAACuB,CAAC,CAAC;MAEnD,MAAMG,cAAc,GAAGF,MAAM,CAC1BG,YAAY,CAAErB,YAAY,CAACE,OAAO,CAAC,CAACe,CAAC,CAAC;MAEzC,OAAO,CAACE,YAAY,KAAKlB,eAAe,GAAGC,OAAO,GAAGe,CAAC,EAAE;QACtDV,UAAU,EAAEa,cAAc,IAAIrB,UAAU;QACxCO,KAAK,EAAEP,UAAU,CAACqB,cAAc;MAClC,CAAC,CAAC;IACJ,CAAC,CACH;EACF,CAAC,CACH,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"createOsdkInterface.js","names":["extractNamespace","InterfaceDefRef","ObjectDefRef","UnderlyingOsdkObject","createOsdkInterface","underlying","interfaceDef","objApiNamespace","apiName","Object","freeze","defineProperties","value","enumerable","$as","$objectType","$primaryKey","$title","$rid","clone","fromEntries","keys","properties","map","p","objDef","apiNamespace","targetPropName","interfaceMap","update","$clone","key","Error","remappedProps","mapProperty","filter","x","propertyName"],"sources":["createOsdkInterface.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 { InterfaceMetadata } from \"@osdk/api\";\nimport { extractNamespace } from \"../../internal/conversions/modernToLegacyWhereClause.js\";\nimport type { FetchedObjectTypeDefinition } from \"../../ontology/OntologyProvider.js\";\nimport type { InterfaceHolder } from \"./InterfaceHolder.js\";\nimport {\n InterfaceDefRef,\n ObjectDefRef,\n UnderlyingOsdkObject,\n} from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\n/** @internal */\nexport function createOsdkInterface<\n Q extends FetchedObjectTypeDefinition,\n>(\n underlying: ObjectHolder,\n interfaceDef: InterfaceMetadata,\n): InterfaceHolder {\n const [objApiNamespace] = extractNamespace(interfaceDef.apiName);\n\n return Object.freeze(\n Object.defineProperties({}, {\n // first to minimize hidden classes\n [UnderlyingOsdkObject]: { value: underlying },\n\n \"$apiName\": { value: interfaceDef.apiName, enumerable: true },\n \"$as\": {\n value: underlying.$as,\n enumerable: false,\n },\n \"$objectType\": {\n value: underlying.$objectType,\n enumerable: \"$objectType\" in underlying,\n },\n \"$primaryKey\": {\n value: underlying.$primaryKey,\n enumerable: \"$primaryKey\" in underlying,\n },\n \"$title\": {\n value: underlying.$title,\n enumerable: \"$title\" in underlying,\n },\n \"$rid\": {\n value: (underlying as any).$rid,\n enumerable: \"$rid\" in underlying,\n },\n \"$clone\": {\n value: clone,\n enumerable: false,\n },\n\n [InterfaceDefRef]: { value: interfaceDef },\n\n ...Object.fromEntries(\n Object.keys(interfaceDef.properties).map(p => {\n const objDef = underlying[ObjectDefRef];\n\n const [apiNamespace, apiName] = extractNamespace(p);\n\n const targetPropName = objDef\n .interfaceMap![interfaceDef.apiName][p];\n\n return [apiNamespace === objApiNamespace ? apiName : p, {\n enumerable: targetPropName in underlying,\n value: underlying[targetPropName as keyof typeof underlying],\n }];\n }),\n ),\n }) as InterfaceHolder,\n );\n function clone(update: Record<string, any> | undefined) {\n if (update == null) {\n return underlying.$clone().$as(interfaceDef);\n }\n\n for (const key of Object.keys(update)) {\n if (!(key in interfaceDef.properties)) {\n throw new Error(\n `Invalid property ${key} for interface ${interfaceDef.apiName}`,\n );\n }\n }\n\n const remappedProps = Object.fromEntries(\n Object.keys(update).map(p => mapProperty(p, update[p])).filter(x =>\n x != null\n ),\n );\n\n return underlying.$clone(remappedProps).$as(interfaceDef);\n }\n function mapProperty(propertyName: string, value: any) {\n const objDef = underlying[ObjectDefRef];\n const targetPropName =\n objDef.interfaceMap![interfaceDef.apiName][propertyName];\n // If the underlying object does not implement the SPT, throw errors\n if (targetPropName == null) {\n throw new Error(\n `Cannot clone interface with ${propertyName} as property is not implemented by the underlying object type ${objDef.apiName}`,\n );\n }\n return [targetPropName, value];\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,gBAAgB,QAAQ,yDAAyD;AAG1F,SACEC,eAAe,EACfC,YAAY,EACZC,oBAAoB,QACf,sBAAsB;AAG7B;AACA,OAAO,SAASC,mBAAmBA,CAGjCC,UAAwB,EACxBC,YAA+B,EACd;EACjB,MAAM,CAACC,eAAe,CAAC,GAAGP,gBAAgB,CAACM,YAAY,CAACE,OAAO,CAAC;EAEhE,OAAOC,MAAM,CAACC,MAAM,CAClBD,MAAM,CAACE,gBAAgB,CAAC,CAAC,CAAC,EAAE;IAC1B;IACA,CAACR,oBAAoB,GAAG;MAAES,KAAK,EAAEP;IAAW,CAAC;IAE7C,UAAU,EAAE;MAAEO,KAAK,EAAEN,YAAY,CAACE,OAAO;MAAEK,UAAU,EAAE;IAAK,CAAC;IAC7D,KAAK,EAAE;MACLD,KAAK,EAAEP,UAAU,CAACS,GAAG;MACrBD,UAAU,EAAE;IACd,CAAC;IACD,aAAa,EAAE;MACbD,KAAK,EAAEP,UAAU,CAACU,WAAW;MAC7BF,UAAU,EAAE,aAAa,IAAIR;IAC/B,CAAC;IACD,aAAa,EAAE;MACbO,KAAK,EAAEP,UAAU,CAACW,WAAW;MAC7BH,UAAU,EAAE,aAAa,IAAIR;IAC/B,CAAC;IACD,QAAQ,EAAE;MACRO,KAAK,EAAEP,UAAU,CAACY,MAAM;MACxBJ,UAAU,EAAE,QAAQ,IAAIR;IAC1B,CAAC;IACD,MAAM,EAAE;MACNO,KAAK,EAAGP,UAAU,CAASa,IAAI;MAC/BL,UAAU,EAAE,MAAM,IAAIR;IACxB,CAAC;IACD,QAAQ,EAAE;MACRO,KAAK,EAAEO,KAAK;M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W,MAAM,CAACC,CAAC,IAC9DA,CAAC,IAAI,IACP,CACF,CAAC;IAED,OAAO/B,UAAU,CAACyB,MAAM,CAACG,aAAa,CAAC,CAACnB,GAAG,CAACR,YAAY,CAAC;EAC3D;EACA,SAAS4B,WAAWA,CAACG,YAAoB,EAAEzB,KAAU,EAAE;IACrD,MAAMa,MAAM,GAAGpB,UAAU,CAACH,YAAY,CAAC;IACvC,MAAMyB,cAAc,GAClBF,MAAM,CAACG,YAAY,CAAEtB,YAAY,CAACE,OAAO,CAAC,CAAC6B,YAAY,CAAC;IAC1D;IACA,IAAIV,cAAc,IAAI,IAAI,EAAE;MAC1B,MAAM,IAAIK,KAAK,CACb,+BAA+BK,YAAY,iEAAiEZ,MAAM,CAACjB,OAAO,EAC5H,CAAC;IACH;IACA,OAAO,CAACmB,cAAc,EAAEf,KAAK,CAAC;EAChC;AACF","ignoreList":[]}
@@ -39,6 +39,7 @@ const basePropDefs = {
39
39
  },
40
40
  "$clone": {
41
41
  value: function (update) {
42
+ // I think `rawObj` is the same thing as `this` and can be removed?
42
43
  const rawObj = this[UnderlyingOsdkObject];
43
44
  const def = this[ObjectDefRef];
44
45
  if (update == null) {
@@ -61,13 +62,19 @@ const basePropDefs = {
61
62
  }
62
63
  };
63
64
 
64
- /** @internal */
65
- export function createOsdkObject(client, objectDef, rawObj) {
65
+ /**
66
+ * @internal
67
+ * @param client
68
+ * @param objectDef
69
+ * @param simpleOsdkProperties
70
+ */
71
+ export function createOsdkObject(client, objectDef, simpleOsdkProperties) {
66
72
  // updates the object's "hidden class/map".
73
+ const rawObj = simpleOsdkProperties;
67
74
  Object.defineProperties(rawObj, {
68
75
  [UnderlyingOsdkObject]: {
69
76
  enumerable: false,
70
- value: rawObj
77
+ value: simpleOsdkProperties
71
78
  },
72
79
  [ObjectDefRef]: {
73
80
  value: objectDef,
@@ -1 +1 @@
1
- {"version":3,"file":"createOsdkObject.js","names":["invariant","GeotimeSeriesPropertyImpl","MediaReferencePropertyImpl","TimeSeriesPropertyImpl","hydrateAttachmentFromRidInternal","get$as","get$link","ClientRef","ObjectDefRef","UnderlyingOsdkObject","specialPropertyTypes","Set","basePropDefs","get","value","update","rawObj","def","createOsdkObject","primaryKeyApiName","Error","apiName","titleProperty","$title","newObject","client","objectDef","Object","defineProperties","enumerable","propKey","keys","properties","type","has","createSpecialProperty","freeze","rawObject","p","rawValue","propDef","process","env","NODE_ENV","Array","isArray","map","a","rid","time","timestamp","coordinates","position","undefined","objectApiName","primaryKey","propertyName"],"sources":["createOsdkObject.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 { ObjectTypeDefinition, Osdk } from \"@osdk/api\";\nimport type { OntologyObjectV2 } from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport { GeotimeSeriesPropertyImpl } from \"../../createGeotimeSeriesProperty.js\";\nimport { MediaReferencePropertyImpl } from \"../../createMediaReferenceProperty.js\";\nimport { TimeSeriesPropertyImpl } from \"../../createTimeseriesProperty.js\";\nimport type { MinimalClient } from \"../../MinimalClientContext.js\";\nimport type { FetchedObjectTypeDefinition } from \"../../ontology/OntologyProvider.js\";\nimport { hydrateAttachmentFromRidInternal } from \"../../public-utils/hydrateAttachmentFromRid.js\";\nimport { get$as } from \"./getDollarAs.js\";\nimport { get$link } from \"./getDollarLink.js\";\nimport {\n ClientRef,\n ObjectDefRef,\n UnderlyingOsdkObject,\n} from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\ninterface InternalOsdkInstance {\n [ObjectDefRef]: FetchedObjectTypeDefinition;\n [ClientRef]: MinimalClient;\n}\n\nconst specialPropertyTypes = new Set(\n [\n \"attachment\",\n \"geotimeSeriesReference\",\n \"mediaReference\",\n \"numericTimeseries\",\n \"stringTimeseries\",\n \"sensorTimeseries\",\n ],\n);\n\n// kept separate so we are not redefining these functions\n// every time an object is created.\nconst basePropDefs = {\n \"$as\": {\n get: function(this: InternalOsdkInstance) {\n return get$as(this[ObjectDefRef]);\n },\n },\n \"$link\": {\n get: function(this: InternalOsdkInstance & ObjectHolder<any>) {\n return get$link(this);\n },\n },\n \"$clone\": {\n value: function(\n this: InternalOsdkInstance & ObjectHolder<any>,\n update: Record<string, any> | undefined,\n ) {\n const rawObj = this[UnderlyingOsdkObject];\n const def = this[ObjectDefRef];\n\n if (update == null) {\n return createOsdkObject(this[ClientRef], def, { ...rawObj });\n }\n\n if (\n def.primaryKeyApiName in update\n && rawObj[def.primaryKeyApiName] !== update[def.primaryKeyApiName]\n ) {\n throw new Error(\n `Cannot update ${def.apiName} object with differing primary key values `,\n );\n }\n\n if (def.titleProperty in update && !(\"$title\" in update)) {\n update.$title = update[def.titleProperty];\n }\n\n const newObject = { ...this[UnderlyingOsdkObject], ...update };\n return createOsdkObject(this[ClientRef], this[ObjectDefRef], newObject);\n },\n },\n};\n\n/** @internal */\nexport function createOsdkObject<\n Q extends FetchedObjectTypeDefinition,\n>(\n client: MinimalClient,\n objectDef: Q,\n rawObj: OntologyObjectV2,\n): Osdk<ObjectTypeDefinition, any> {\n // updates the object's \"hidden class/map\".\n Object.defineProperties(rawObj, {\n [UnderlyingOsdkObject]: {\n enumerable: false,\n value: rawObj,\n },\n [ObjectDefRef]: { value: objectDef, enumerable: false },\n [ClientRef]: { value: client, enumerable: false },\n ...basePropDefs,\n });\n\n // Assign the special values\n for (const propKey of Object.keys(rawObj)) {\n if (\n propKey in objectDef.properties\n && typeof (objectDef.properties[propKey].type) === \"string\"\n && specialPropertyTypes.has(objectDef.properties[propKey].type)\n ) {\n rawObj[propKey] = createSpecialProperty(\n client,\n objectDef,\n rawObj as any,\n propKey,\n );\n }\n }\n\n return Object.freeze(rawObj) as Osdk<ObjectTypeDefinition, any>;\n}\n\nfunction createSpecialProperty(\n client: MinimalClient,\n objectDef: FetchedObjectTypeDefinition,\n rawObject: Osdk.Instance<any>,\n p: keyof typeof rawObject & string | symbol,\n) {\n const rawValue = rawObject[p as any];\n const propDef = objectDef.properties[p as any];\n if (process.env.NODE_ENV !== \"production\") {\n invariant(\n propDef != null && typeof propDef.type === \"string\"\n && specialPropertyTypes.has(propDef.type),\n );\n }\n {\n {\n {\n {\n if (propDef.type === \"attachment\") {\n if (Array.isArray(rawValue)) {\n return rawValue.map(a =>\n hydrateAttachmentFromRidInternal(client, a.rid)\n );\n }\n return hydrateAttachmentFromRidInternal(client, rawValue.rid);\n }\n\n if (\n propDef.type === \"numericTimeseries\"\n || propDef.type === \"stringTimeseries\"\n || propDef.type === \"sensorTimeseries\"\n ) {\n return new TimeSeriesPropertyImpl<\n (typeof propDef)[\"type\"] extends \"numericTimeseries\" ? number\n : (typeof propDef)[\"type\"] extends \"stringTimeseries\" ? string\n : number | string\n >(\n client,\n objectDef.apiName,\n rawObject[objectDef.primaryKeyApiName as string],\n p as string,\n );\n }\n\n if (propDef.type === \"geotimeSeriesReference\") {\n return new GeotimeSeriesPropertyImpl<GeoJSON.Point>(\n client,\n objectDef.apiName,\n rawObject[objectDef.primaryKeyApiName as string],\n p as string,\n rawValue.type === \"geotimeSeriesValue\"\n ? {\n time: rawValue.timestamp,\n value: {\n type: \"Point\",\n coordinates: rawValue.position,\n },\n }\n : undefined,\n );\n }\n if (propDef.type === \"mediaReference\") {\n return new MediaReferencePropertyImpl({\n client,\n objectApiName: objectDef.apiName,\n primaryKey: rawObject[objectDef.primaryKeyApiName as string],\n propertyName: p as string,\n });\n }\n }\n }\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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MAAM,EACNC,SAAS,CAACL,OAAO,EACjBgB,SAAS,CAACX,SAAS,CAACP,iBAAiB,CAAW,EAChDmB,CAAC,EACDC,QAAQ,CAACN,IAAI,KAAK,oBAAoB,GAClC;cACAgB,IAAI,EAAEV,QAAQ,CAACW,SAAS;cACxBpC,KAAK,EAAE;gBACLmB,IAAI,EAAE,OAAO;gBACbkB,WAAW,EAAEZ,QAAQ,CAACa;cACxB;YACF,CAAC,GACCC,SACN,CAAC;UACH;UACA,IAAIb,OAAO,CAACP,IAAI,KAAK,gBAAgB,EAAE;YACrC,OAAO,IAAI/B,0BAA0B,CAAC;cACpCuB,MAAM;cACN6B,aAAa,EAAE5B,SAAS,CAACL,OAAO;cAChCkC,UAAU,EAAElB,SAAS,CAACX,SAAS,CAACP,iBAAiB,CAAW;cAC5DqC,YAAY,EAAElB;YAChB,CAAC,CAAC;UACJ;QACF;MACF;IACF;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"createOsdkObject.js","names":["invariant","GeotimeSeriesPropertyImpl","MediaReferencePropertyImpl","TimeSeriesPropertyImpl","hydrateAttachmentFromRidInternal","get$as","get$link","ClientRef","ObjectDefRef","UnderlyingOsdkObject","specialPropertyTypes","Set","basePropDefs","get","value","update","rawObj","def","createOsdkObject","primaryKeyApiName","Error","apiName","titleProperty","$title","newObject","client","objectDef","simpleOsdkProperties","Object","defineProperties","enumerable","propKey","keys","properties","type","has","createSpecialProperty","freeze","rawObject","p","rawValue","propDef","process","env","NODE_ENV","Array","isArray","map","a","rid","time","timestamp","coordinates","position","undefined","objectApiName","primaryKey","propertyName"],"sources":["createOsdkObject.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, ReferenceValue } from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport { GeotimeSeriesPropertyImpl } from \"../../createGeotimeSeriesProperty.js\";\nimport { MediaReferencePropertyImpl } from \"../../createMediaReferenceProperty.js\";\nimport { TimeSeriesPropertyImpl } from \"../../createTimeseriesProperty.js\";\nimport type { MinimalClient } from \"../../MinimalClientContext.js\";\nimport type { FetchedObjectTypeDefinition } from \"../../ontology/OntologyProvider.js\";\nimport { hydrateAttachmentFromRidInternal } from \"../../public-utils/hydrateAttachmentFromRid.js\";\nimport type { SimpleOsdkProperties } from \"../SimpleOsdkProperties.js\";\nimport { get$as } from \"./getDollarAs.js\";\nimport { get$link } from \"./getDollarLink.js\";\nimport {\n ClientRef,\n ObjectDefRef,\n UnderlyingOsdkObject,\n} from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\nconst specialPropertyTypes = new Set(\n [\n \"attachment\",\n \"geotimeSeriesReference\",\n \"mediaReference\",\n \"numericTimeseries\",\n \"stringTimeseries\",\n \"sensorTimeseries\",\n ],\n);\n\n// kept separate so we are not redefining these functions\n// every time an object is created.\nconst basePropDefs = {\n \"$as\": {\n get: function(this: ObjectHolder) {\n return get$as(this[ObjectDefRef]);\n },\n },\n \"$link\": {\n get: function(this: ObjectHolder) {\n return get$link(this);\n },\n },\n \"$clone\": {\n value: function(\n this: ObjectHolder,\n update: Record<string, any> | undefined,\n ) {\n // I think `rawObj` is the same thing as `this` and can be removed?\n const rawObj = this[UnderlyingOsdkObject] as SimpleOsdkProperties;\n const def = this[ObjectDefRef];\n\n if (update == null) {\n return createOsdkObject(this[ClientRef], def, { ...rawObj });\n }\n\n if (\n def.primaryKeyApiName in update\n && rawObj[def.primaryKeyApiName] !== update[def.primaryKeyApiName]\n ) {\n throw new Error(\n `Cannot update ${def.apiName} object with differing primary key values `,\n );\n }\n\n if (def.titleProperty in update && !(\"$title\" in update)) {\n update.$title = update[def.titleProperty];\n }\n\n const newObject = { ...this[UnderlyingOsdkObject], ...update };\n return createOsdkObject(this[ClientRef], this[ObjectDefRef], newObject);\n },\n },\n};\n\n/**\n * @internal\n * @param client\n * @param objectDef\n * @param simpleOsdkProperties\n */\nexport function createOsdkObject(\n client: MinimalClient,\n objectDef: FetchedObjectTypeDefinition,\n simpleOsdkProperties: SimpleOsdkProperties,\n): ObjectHolder {\n // updates the object's \"hidden class/map\".\n const rawObj = simpleOsdkProperties as ObjectHolder;\n Object.defineProperties(\n rawObj,\n {\n [UnderlyingOsdkObject]: {\n enumerable: false,\n value: simpleOsdkProperties,\n },\n [ObjectDefRef]: { value: objectDef, enumerable: false },\n [ClientRef]: { value: client, enumerable: false },\n ...basePropDefs,\n } satisfies Record<keyof ObjectHolder, PropertyDescriptor>,\n );\n\n // Assign the special values\n for (const propKey of Object.keys(rawObj)) {\n if (\n propKey in objectDef.properties\n && typeof (objectDef.properties[propKey].type) === \"string\"\n && specialPropertyTypes.has(objectDef.properties[propKey].type)\n ) {\n rawObj[propKey] = createSpecialProperty(\n client,\n objectDef,\n rawObj,\n propKey,\n );\n }\n }\n\n return Object.freeze(rawObj);\n}\n\nfunction createSpecialProperty(\n client: MinimalClient,\n objectDef: FetchedObjectTypeDefinition,\n rawObject: ObjectHolder,\n p: keyof typeof rawObject & string | symbol,\n) {\n const rawValue = rawObject[p as any];\n const propDef = objectDef.properties[p as any];\n if (process.env.NODE_ENV !== \"production\") {\n invariant(\n propDef != null && typeof propDef.type === \"string\"\n && specialPropertyTypes.has(propDef.type),\n );\n }\n {\n {\n {\n {\n if (propDef.type === \"attachment\") {\n if (Array.isArray(rawValue)) {\n return rawValue.map(a =>\n hydrateAttachmentFromRidInternal(client, a.rid)\n );\n }\n return hydrateAttachmentFromRidInternal(\n client,\n (rawValue as Attachment).rid,\n );\n }\n\n if (\n propDef.type === \"numericTimeseries\"\n || propDef.type === \"stringTimeseries\"\n || propDef.type === \"sensorTimeseries\"\n ) {\n return new TimeSeriesPropertyImpl<\n (typeof propDef)[\"type\"] extends \"numericTimeseries\" ? number\n : (typeof propDef)[\"type\"] extends \"stringTimeseries\" ? string\n : number | string\n >(\n client,\n objectDef.apiName,\n rawObject[objectDef.primaryKeyApiName as string],\n p as string,\n );\n }\n\n if (propDef.type === \"geotimeSeriesReference\") {\n return new GeotimeSeriesPropertyImpl<GeoJSON.Point>(\n client,\n objectDef.apiName,\n rawObject[objectDef.primaryKeyApiName as string],\n p as string,\n (rawValue as ReferenceValue).type === \"geotimeSeriesValue\"\n ? {\n time: (rawValue as ReferenceValue).timestamp,\n value: {\n type: \"Point\",\n coordinates: (rawValue as ReferenceValue).position,\n },\n }\n : undefined,\n );\n }\n if (propDef.type === \"mediaReference\") {\n return new MediaReferencePropertyImpl({\n client,\n objectApiName: objectDef.apiName,\n primaryKey: rawObject[objectDef.primaryKeyApiName as string],\n propertyName: p as string,\n });\n }\n }\n }\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,yBAAyB,QAAQ,sCAAsC;AAChF,SAASC,0BAA0B,QAAQ,uCAAuC;AAClF,SAASC,sBAAsB,QAAQ,mCAAmC;AAG1E,SAASC,gCAAgC,QAAQ,gDAAgD;AAEjG,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SACEC,SAAS,EACTC,YAAY,EACZC,oBAAoB,QACf,sBAAsB;AAG7B,MAAMC,oBAAoB,GAAG,IAAIC,GAAG,CAClC,CACE,YAAY,EACZ,wBAAwB,EACxB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,CAEtB,CAAC;;AAED;AACA;AACA,MAAMC,YAAY,GAAG;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AACL,OAAO;cAChCmC,UAAU,EAAElB,SAAS,CAACZ,SAAS,CAACP,iBAAiB,CAAW;cAC5DsC,YAAY,EAAElB;YAChB,CAAC,CAAC;UACJ;QACF;MACF;IACF;EACF;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"getDollarAs.js","names":["InterfaceDefinitions","createSimpleCache","createOsdkInterface","UnderlyingOsdkObject","get$as","WeakMap","$asFactory","get","osdkObjectToInterfaceView","Map","objDef","targetMinDef","targetInterfaceApiName","apiName","interfaceMap","Error","type","def","underlying","existing","deref","osdkInterface","set","WeakRef"],"sources":["getDollarAs.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 { ObjectOrInterfaceDefinition, Osdk, OsdkBase } from \"@osdk/api\";\nimport {\n type FetchedObjectTypeDefinition,\n InterfaceDefinitions,\n} from \"../../ontology/OntologyProvider.js\";\nimport { createSimpleCache } from \"../SimpleCache.js\";\nimport { createOsdkInterface } from \"./createOsdkInterface.js\";\nimport type { InterfaceHolder } from \"./InterfaceHolder.js\";\nimport { UnderlyingOsdkObject } from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\n/** @internal */\nexport type DollarAsFn = <\n Q extends FetchedObjectTypeDefinition,\n NEW_Q extends ObjectOrInterfaceDefinition,\n>(\n this: Osdk<any> & (InterfaceHolder<Q> | ObjectHolder<Q>),\n newDef: string | NEW_Q,\n) => OsdkBase<any>;\n\nexport const get$as: (key: FetchedObjectTypeDefinition) => DollarAsFn =\n createSimpleCache<\n FetchedObjectTypeDefinition,\n DollarAsFn\n >(new WeakMap(), $asFactory).get;\n\nconst osdkObjectToInterfaceView = createSimpleCache(\n new WeakMap<\n OsdkBase<any>,\n Map<string, WeakRef<OsdkBase<any>>>\n >(),\n () =>\n new Map<\n /* interface api name */ string,\n /* $as'd object */ WeakRef<OsdkBase<any>>\n >(),\n);\n\nfunction $asFactory(\n objDef: FetchedObjectTypeDefinition,\n): DollarAsFn {\n // We use the exact same logic for both the interface rep and the underlying rep\n\n return function $as<\n NEW_Q extends ObjectOrInterfaceDefinition,\n >(\n this: OsdkBase<any> & { [UnderlyingOsdkObject]: any },\n targetMinDef: NEW_Q | string,\n ): OsdkBase<any> {\n let targetInterfaceApiName: string;\n\n if (typeof targetMinDef === \"string\") {\n if (targetMinDef === objDef.apiName) {\n return this[UnderlyingOsdkObject];\n }\n\n // this is sufficient to determine if we implement the interface\n if (objDef.interfaceMap?.[targetMinDef] == null) {\n throw new Error(\n `Object does not implement interface '${targetMinDef}'.`,\n );\n }\n\n targetInterfaceApiName = targetMinDef;\n } else if (targetMinDef.apiName === objDef.apiName) {\n return this[UnderlyingOsdkObject];\n } else {\n if (targetMinDef.type === \"object\") {\n throw new Error(\n `'${targetMinDef.apiName}' is not an interface nor is it '${objDef.apiName}', which is the object type.`,\n );\n }\n targetInterfaceApiName = targetMinDef.apiName;\n }\n\n const def = objDef[InterfaceDefinitions][targetInterfaceApiName];\n if (!def) {\n throw new Error(\n `Object does not implement interface '${targetInterfaceApiName}'.`,\n );\n }\n\n const underlying = this[UnderlyingOsdkObject];\n\n const existing = osdkObjectToInterfaceView\n .get(underlying)\n .get(targetInterfaceApiName)?.deref();\n if (existing) return existing;\n\n const osdkInterface = createOsdkInterface(underlying, def.def);\n osdkObjectToInterfaceView.get(underlying).set(\n targetInterfaceApiName,\n new WeakRef(osdkInterface),\n );\n return osdkInterface;\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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,IAAIF,KAAK,CACb,wCAAwCH,sBAAsB,IAChE,CAAC;IACH;IAEA,MAAMM,UAAU,GAAG,IAAI,CAACf,oBAAoB,CAAC;IAE7C,MAAMgB,QAAQ,GAAGX,yBAAyB,CACvCD,GAAG,CAACW,UAAU,CAAC,CACfX,GAAG,CAACK,sBAAsB,CAAC,EAAEQ,KAAK,CAAC,CAAC;IACvC,IAAID,QAAQ,EAAE,OAAOA,QAAQ;IAE7B,MAAME,aAAa,GAAGnB,mBAAmB,CAACgB,UAAU,EAAED,GAAG,CAACA,GAAG,CAAC;IAC9DT,yBAAyB,CAACD,GAAG,CAACW,UAAU,CAAC,CAACI,GAAG,CAC3CV,sBAAsB,EACtB,IAAIW,OAAO,CAACF,aAAa,CAC3B,CAAC;IACD,OAAOA,aAAa;EACtB,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"getDollarAs.js","names":["InterfaceDefinitions","createSimpleCache","createOsdkInterface","UnderlyingOsdkObject","get$as","WeakMap","$asFactory","get","osdkObjectToInterfaceView","Map","objDef","targetMinDef","targetInterfaceApiName","apiName","interfaceMap","Error","type","def","underlying","existing","deref","osdkInterface","set","WeakRef"],"sources":["getDollarAs.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 { ObjectOrInterfaceDefinition, OsdkBase } from \"@osdk/api\";\nimport {\n type FetchedObjectTypeDefinition,\n InterfaceDefinitions,\n} from \"../../ontology/OntologyProvider.js\";\nimport { createSimpleCache } from \"../SimpleCache.js\";\nimport { createOsdkInterface } from \"./createOsdkInterface.js\";\nimport type { InterfaceHolder } from \"./InterfaceHolder.js\";\nimport { UnderlyingOsdkObject } from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\n/** @internal */\nexport type DollarAsFn = <\n Q extends FetchedObjectTypeDefinition,\n NEW_Q extends ObjectOrInterfaceDefinition,\n>(\n this: InterfaceHolder | ObjectHolder,\n newDef: string | NEW_Q,\n) => OsdkBase<any>;\n\nexport const get$as: (key: FetchedObjectTypeDefinition) => DollarAsFn =\n createSimpleCache<\n FetchedObjectTypeDefinition,\n DollarAsFn\n >(new WeakMap(), $asFactory).get;\n\nconst osdkObjectToInterfaceView = createSimpleCache(\n new WeakMap<\n OsdkBase<any>,\n Map<string, WeakRef<OsdkBase<any>>>\n >(),\n () =>\n new Map<\n /* interface api name */ string,\n /* $as'd object */ WeakRef<OsdkBase<any>>\n >(),\n);\n\nfunction $asFactory(\n objDef: FetchedObjectTypeDefinition,\n): DollarAsFn {\n // We use the exact same logic for both the interface rep and the underlying rep\n\n return function $as<\n NEW_Q extends ObjectOrInterfaceDefinition,\n >(\n this: OsdkBase<any> & { [UnderlyingOsdkObject]: any },\n targetMinDef: NEW_Q | string,\n ): OsdkBase<any> {\n let targetInterfaceApiName: string;\n\n if (typeof targetMinDef === \"string\") {\n if (targetMinDef === objDef.apiName) {\n return this[UnderlyingOsdkObject];\n }\n\n // this is sufficient to determine if we implement the interface\n if (objDef.interfaceMap?.[targetMinDef] == null) {\n throw new Error(\n `Object does not implement interface '${targetMinDef}'.`,\n );\n }\n\n targetInterfaceApiName = targetMinDef;\n } else if (targetMinDef.apiName === objDef.apiName) {\n return this[UnderlyingOsdkObject];\n } else {\n if (targetMinDef.type === \"object\") {\n throw new Error(\n `'${targetMinDef.apiName}' is not an interface nor is it '${objDef.apiName}', which is the object type.`,\n );\n }\n targetInterfaceApiName = targetMinDef.apiName;\n }\n\n const def = objDef[InterfaceDefinitions][targetInterfaceApiName];\n if (!def) {\n throw new Error(\n `Object does not implement interface '${targetInterfaceApiName}'.`,\n );\n }\n\n const underlying = this[UnderlyingOsdkObject];\n\n const existing = osdkObjectToInterfaceView\n .get(underlying)\n .get(targetInterfaceApiName)?.deref();\n if (existing) return existing;\n\n const osdkInterface = createOsdkInterface(underlying, def.def);\n osdkObjectToInterfaceView.get(underlying).set(\n targetInterfaceApiName,\n new WeakRef(osdkInterface),\n );\n return osdkInterface;\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAEEA,oBAAoB,QACf,oCAAoC;AAC3C,SAASC,iBAAiB,QAAQ,mBAAmB;AACrD,SAASC,mBAAmB,QAAQ,0BAA0B;AAE9D,SAASC,oBAAoB,QAAQ,sBAAsB;;AAG3D;;AASA,OAAO,MAAMC,MAAwD,GACnEH,iBAAiB,CAGf,IAAII,OAAO,CAAC,CAAC,EAAEC,UAAU,CAAC,CAACC,GAAG;AAElC,MAAMC,yBAAyB,GAAGP,iBAAiB,CACjD,IAAII,OAAO,CAGT,CAAC,EACH,MACE,IAAII,GAAG,CAGL,CACN,CAAC;AAED,SAASH,UAAUA,CACjBI,MAAmC,EACvB;EACZ;;EAEA,OAAO,UAILC,YAA4B,EACb;IACf,IAAIC,sBAA8B;IAElC,IAAI,OAAOD,YAAY,KAAK,QAAQ,EAAE;MACpC,IAAIA,YAAY,KAAKD,MAAM,CAACG,OAAO,EAAE;QACnC,OAAO,IAAI,CAACV,oBAAoB,CAAC;MACnC;;MAEA;MACA,IAAIO,MAAM,CAACI,YAAY,GAAGH,YAAY,CAAC,IAAI,IAAI,EAAE;QAC/C,MAAM,IAAII,KAAK,CACb,wCAAwCJ,YAAY,IACtD,CAAC;MACH;MAEAC,sBAAsB,GAAGD,YAAY;IACvC,CAAC,MAAM,IAAIA,YAAY,CAACE,OAAO,KAAKH,MAAM,CAACG,OAAO,EAAE;MAClD,OAAO,IAAI,CAACV,oBAAoB,CAAC;IACnC,CAAC,MAAM;MACL,IAAIQ,YAAY,CAACK,IAAI,KAAK,QAAQ,EAAE;QAClC,MAAM,IAAID,KAAK,CACb,IAAIJ,YAAY,CAACE,OAAO,oCAAoCH,MAAM,CAACG,OAAO,8BAC5E,CAAC;MACH;MACAD,sBAAsB,GAAGD,YAAY,CAACE,OAAO;IAC/C;IAEA,MAAMI,GAAG,GAAGP,MAAM,CAACV,oBAAoB,CAAC,CAACY,sBAAsB,CAAC;IAChE,IAAI,CAACK,GAAG,EAAE;MACR,MAAM,IAAIF,KAAK,CACb,wCAAwCH,sBAAsB,IAChE,CAAC;IACH;IAEA,MAAMM,UAAU,GAAG,IAAI,CAACf,oBAAoB,CAAC;IAE7C,MAAMgB,QAAQ,GAAGX,yBAAyB,CACvCD,GAAG,CAACW,UAAU,CAAC,CACfX,GAAG,CAACK,sBAAsB,CAAC,EAAEQ,KAAK,CAAC,CAAC;IACvC,IAAID,QAAQ,EAAE,OAAOA,QAAQ;IAE7B,MAAME,aAAa,GAAGnB,mBAAmB,CAACgB,UAAU,EAAED,GAAG,CAACA,GAAG,CAAC;IAC9DT,yBAAyB,CAACD,GAAG,CAACW,UAAU,CAAC,CAACI,GAAG,CAC3CV,sBAAsB,EACtB,IAAIW,OAAO,CAACF,aAAa,CAC3B,CAAC;IACD,OAAOA,aAAa;EACtB,CAAC;AACH","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"getDollarLink.js","names":["getWireObjectSet","fetchSingle","fetchSingleWithErrors","ClientRef","ObjectDefRef","UnderlyingOsdkObject","get$link","holder","client","objDef","rawObj","Object","freeze","fromEntries","keys","links","map","linkName","linkDef","objectSet","objectSetFactory","where","primaryKeyApiName","$primaryKey","pivotTo","value","multiplicity","fetchOne","options","fetchOneWithErrors"],"sources":["getDollarLink.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ObjectSet,\n ObjectTypeDefinition,\n OsdkObjectLinksObject,\n SelectArg,\n WhereClause,\n} from \"@osdk/api\";\nimport { getWireObjectSet } from \"../../objectSet/createObjectSet.js\";\nimport { fetchSingle, fetchSingleWithErrors } from \"../fetchSingle.js\";\nimport {\n ClientRef,\n ObjectDefRef,\n UnderlyingOsdkObject,\n} from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\n/** @internal */\nexport function get$link(\n holder: ObjectHolder<any>,\n): OsdkObjectLinksObject<any> {\n const client = holder[ClientRef];\n const objDef = holder[ObjectDefRef];\n const rawObj = holder[UnderlyingOsdkObject];\n return Object.freeze(Object.fromEntries(\n Object.keys(objDef.links).map(\n (linkName) => {\n const linkDef = objDef.links[linkName as keyof typeof objDef.links];\n const objectSet =\n (client.objectSetFactory(objDef, client) as ObjectSet<any>)\n .where({\n [objDef.primaryKeyApiName]: rawObj.$primaryKey,\n } as WhereClause<ObjectTypeDefinition>)\n .pivotTo(linkName);\n\n const value = !linkDef.multiplicity\n ? {\n fetchOne: <A extends SelectArg<any>>(options?: A) =>\n fetchSingle(\n client,\n objDef,\n options ?? {},\n getWireObjectSet(objectSet),\n ),\n fetchOneWithErrors: <A extends SelectArg<any>>(options?: A) =>\n fetchSingleWithErrors(\n client,\n objDef,\n options ?? {},\n getWireObjectSet(objectSet),\n ),\n }\n : objectSet;\n\n return [linkName, value];\n },\n ),\n ));\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,SAASA,gBAAgB,QAAQ,oCAAoC;AACrE,SAASC,WAAW,EAAEC,qBAAqB,QAAQ,mBAAmB;AACtE,SACEC,SAAS,EACTC,YAAY,EACZC,oBAAoB,QACf,sBAAsB;AAG7B;AACA,OAAO,SAASC,QAAQA,CACtBC,MAAyB,EACG;EAC5B,MAAMC,MAAM,GAAGD,MAAM,CAACJ,SAAS,CAAC;EAChC,MAAMM,MAAM,GAAGF,MAAM,CAACH,YAAY,CAAC;EACnC,MAAMM,MAAM,GAAGH,MAAM,CAACF,oBAAoB,CAAC;EAC3C,OAAOM,MAAM,CAACC,MAAM,CAACD,MAAM,CAACE,WAAW,CACrCF,MAAM,CAACG,IAAI,CAACL,MAAM,CAACM,KAAK,CAAC,CAACC,GAAG,CAC1BC,QAAQ,IAAK;IACZ,MAAMC,OAAO,GAAGT,MAAM,CAACM,KAAK,CAACE,QAAQ,CAA8B;IACnE,MAAME,SAAS,GACZX,MAAM,CAACY,gBAAgB,CAACX,MAAM,EAAED,MAAM,CAAC,CACrCa,KAAK,CAAC;MACL,CAACZ,MAAM,CAACa,iBAAiB,GAAGZ,MAAM,CAACa;IACrC,CAAsC,CAAC,CACtCC,OAAO,CAACP,QAAQ,CAAC;IAEtB,MAAMQ,KAAK,GAAG,CAACP,OAAO,CAACQ,YAAY,GAC/B;MACAC,QAAQ,EAA6BC,OAAW,IAC9C3B,WAAW,CACTO,MAAM,EACNC,MAAM,EACNmB,OAAO,IAAI,CAAC,CAAC,EACb5B,gBAAgB,CAACmB,SAAS,CAC5B,CAAC;MACHU,kBAAkB,EAA6BD,OAAW,IACxD1B,qBAAqB,CACnBM,MAAM,EACNC,MAAM,EACNmB,OAAO,IAAI,CAAC,CAAC,EACb5B,gBAAgB,CAACmB,SAAS,CAC5B;IACJ,CAAC,GACCA,SAAS;IAEb,OAAO,CAACF,QAAQ,EAAEQ,KAAK,CAAC;EAC1B,CACF,CACF,CAAC,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"getDollarLink.js","names":["getWireObjectSet","fetchSingle","fetchSingleWithErrors","ClientRef","ObjectDefRef","UnderlyingOsdkObject","get$link","holder","client","objDef","rawObj","Object","freeze","fromEntries","keys","links","map","linkName","linkDef","objectSet","objectSetFactory","where","primaryKeyApiName","$primaryKey","pivotTo","value","multiplicity","fetchOne","options","fetchOneWithErrors"],"sources":["getDollarLink.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ObjectSet,\n OsdkObjectLinksObject,\n SelectArg,\n WhereClause,\n} from \"@osdk/api\";\nimport { getWireObjectSet } from \"../../objectSet/createObjectSet.js\";\nimport { fetchSingle, fetchSingleWithErrors } from \"../fetchSingle.js\";\nimport {\n ClientRef,\n ObjectDefRef,\n UnderlyingOsdkObject,\n} from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\n/** @internal */\nexport function get$link(\n holder: ObjectHolder,\n): OsdkObjectLinksObject<any> {\n const client = holder[ClientRef];\n const objDef = holder[ObjectDefRef];\n const rawObj = holder[UnderlyingOsdkObject];\n return Object.freeze(Object.fromEntries(\n Object.keys(objDef.links).map(\n (linkName) => {\n const linkDef = objDef.links[linkName as keyof typeof objDef.links];\n const objectSet =\n (client.objectSetFactory(objDef, client) as ObjectSet<any>)\n .where({\n [objDef.primaryKeyApiName]: rawObj.$primaryKey,\n } as WhereClause<any>)\n .pivotTo(linkName);\n\n const value = !linkDef.multiplicity\n ? {\n fetchOne: <A extends SelectArg<any>>(options?: A) =>\n fetchSingle(\n client,\n objDef,\n options ?? {},\n getWireObjectSet(objectSet),\n ),\n fetchOneWithErrors: <A extends SelectArg<any>>(options?: A) =>\n fetchSingleWithErrors(\n client,\n objDef,\n options ?? {},\n getWireObjectSet(objectSet),\n ),\n }\n : objectSet;\n\n return [linkName, value];\n },\n ),\n ));\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SAASA,gBAAgB,QAAQ,oCAAoC;AACrE,SAASC,WAAW,EAAEC,qBAAqB,QAAQ,mBAAmB;AACtE,SACEC,SAAS,EACTC,YAAY,EACZC,oBAAoB,QACf,sBAAsB;AAG7B;AACA,OAAO,SAASC,QAAQA,CACtBC,MAAoB,EACQ;EAC5B,MAAMC,MAAM,GAAGD,MAAM,CAACJ,SAAS,CAAC;EAChC,MAAMM,MAAM,GAAGF,MAAM,CAACH,YAAY,CAAC;EACnC,MAAMM,MAAM,GAAGH,MAAM,CAACF,oBAAoB,CAAC;EAC3C,OAAOM,MAAM,CAACC,MAAM,CAACD,MAAM,CAACE,WAAW,CACrCF,MAAM,CAACG,IAAI,CAACL,MAAM,CAACM,KAAK,CAAC,CAACC,GAAG,CAC1BC,QAAQ,IAAK;IACZ,MAAMC,OAAO,GAAGT,MAAM,CAACM,KAAK,CAACE,QAAQ,CAA8B;IACnE,MAAME,SAAS,GACZX,MAAM,CAACY,gBAAgB,CAACX,MAAM,EAAED,MAAM,CAAC,CACrCa,KAAK,CAAC;MACL,CAACZ,MAAM,CAACa,iBAAiB,GAAGZ,MAAM,CAACa;IACrC,CAAqB,CAAC,CACrBC,OAAO,CAACP,QAAQ,CAAC;IAEtB,MAAMQ,KAAK,GAAG,CAACP,OAAO,CAACQ,YAAY,GAC/B;MACAC,QAAQ,EAA6BC,OAAW,IAC9C3B,WAAW,CACTO,MAAM,EACNC,MAAM,EACNmB,OAAO,IAAI,CAAC,CAAC,EACb5B,gBAAgB,CAACmB,SAAS,CAC5B,CAAC;MACHU,kBAAkB,EAA6BD,OAAW,IACxD1B,qBAAqB,CACnBM,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