@osdk/client 2.6.1 → 2.7.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +92 -88
- package/build/browser/Client.js +1 -1
- package/build/browser/Client.js.map +1 -1
- package/build/browser/MinimalClientContext.js.map +1 -1
- package/build/browser/actions/actions.test.js +9 -0
- package/build/browser/actions/actions.test.js.map +1 -1
- package/build/browser/actions/applyAction.js +4 -0
- package/build/browser/actions/applyAction.js.map +1 -1
- package/build/browser/createClient.js +2 -1
- package/build/browser/createClient.js.map +1 -1
- package/build/browser/createMinimalClient.js +1 -0
- package/build/browser/createMinimalClient.js.map +1 -1
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.js +17 -1
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
- package/build/browser/fetchMetadata.test.js +31 -0
- package/build/browser/fetchMetadata.test.js.map +1 -1
- package/build/browser/intellisense.test.js +1 -1
- package/build/browser/intellisense.test.js.map +1 -1
- package/build/browser/object/aggregate.js +1 -0
- package/build/browser/object/aggregate.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/BaseHolder.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.js +3 -0
- package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js +8 -0
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js +95 -3
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.js +18 -6
- package/build/browser/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.test.js +189 -28
- package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/browser/object/fetchPage.js +18 -5
- package/build/browser/object/fetchPage.js.map +1 -1
- package/build/browser/object/fetchPage.test.js.map +1 -1
- package/build/browser/object/formatting/applyPropertyFormatter.js +58 -0
- package/build/browser/object/formatting/applyPropertyFormatter.js.map +1 -0
- package/build/browser/object/formatting/applyPropertyFormatter.test.js +726 -0
- package/build/browser/object/formatting/applyPropertyFormatter.test.js.map +1 -0
- package/build/browser/object/formatting/formatBoolean.js +23 -0
- package/build/browser/object/formatting/formatBoolean.js.map +1 -0
- package/build/browser/object/formatting/formatDateTime.js +158 -0
- package/build/browser/object/formatting/formatDateTime.js.map +1 -0
- package/build/browser/object/formatting/formatNumber.js +242 -0
- package/build/browser/object/formatting/formatNumber.js.map +1 -0
- package/build/browser/object/formatting/propertyFormattingUtils.js +39 -0
- package/build/browser/object/formatting/propertyFormattingUtils.js.map +1 -0
- package/build/browser/object/object.test.js +123 -0
- package/build/browser/object/object.test.js.map +1 -1
- package/build/browser/objectSet/InterfaceObjectSet.test.js +1 -1
- package/build/browser/objectSet/InterfaceObjectSet.test.js.map +1 -1
- package/build/browser/objectSet/ObjectSet.test.js +7 -6
- package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js +2 -2
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js +3 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
- package/build/browser/objectSet/createObjectSet.js +13 -0
- package/build/browser/objectSet/createObjectSet.js.map +1 -1
- package/build/browser/objectSet/fetchLinksPage.js +57 -0
- package/build/browser/objectSet/fetchLinksPage.js.map +1 -0
- package/build/browser/objectSet/fetchLinksPage.test.js +102 -0
- package/build/browser/objectSet/fetchLinksPage.test.js.map +1 -0
- package/build/browser/observable/ListPayload.js.map +1 -1
- package/build/browser/observable/ObjectPayload.js.map +1 -1
- package/build/browser/observable/ObservableClient.js +0 -5
- package/build/browser/observable/ObservableClient.js.map +1 -1
- package/build/browser/observable/internal/ObservableClientImpl.js.map +1 -1
- package/build/browser/observable/internal/Store.test.js +104 -1
- package/build/browser/observable/internal/Store.test.js.map +1 -1
- package/build/browser/observable/internal/actions/OptimisticJob.js +1 -1
- package/build/browser/observable/internal/actions/OptimisticJob.js.map +1 -1
- package/build/browser/observable/internal/base-list/BaseListQuery.js +1 -1
- package/build/browser/observable/internal/base-list/BaseListQuery.js.map +1 -1
- package/build/browser/observable/internal/links/SpecificLinkQuery.js +9 -1
- package/build/browser/observable/internal/links/SpecificLinkQuery.js.map +1 -1
- package/build/browser/observable/internal/list/ListQuery.js +17 -2
- package/build/browser/observable/internal/list/ListQuery.js.map +1 -1
- package/build/browser/observable/internal/objectset/ObjectSetQuery.js +9 -7
- package/build/browser/observable/internal/objectset/ObjectSetQuery.js.map +1 -1
- package/build/browser/observable/internal/utils/rdpFieldOperations.js +46 -25
- package/build/browser/observable/internal/utils/rdpFieldOperations.js.map +1 -1
- package/build/browser/observable/internal/utils/rdpFieldOperations.test.js +172 -0
- package/build/browser/observable/internal/utils/rdpFieldOperations.test.js.map +1 -0
- package/build/browser/ontology/loadActionMetadata.js +3 -1
- package/build/browser/ontology/loadActionMetadata.js.map +1 -1
- package/build/browser/ontology/loadFullObjectMetadata.js +2 -1
- package/build/browser/ontology/loadFullObjectMetadata.js.map +1 -1
- package/build/browser/ontology/loadInterfaceMetadata.js +2 -1
- package/build/browser/ontology/loadInterfaceMetadata.js.map +1 -1
- package/build/browser/public/unstable-do-not-use.js.map +1 -1
- package/build/browser/queries/applyQuery.js +14 -0
- package/build/browser/queries/applyQuery.js.map +1 -1
- package/build/browser/queries/queries.test.js +14 -2
- package/build/browser/queries/queries.test.js.map +1 -1
- package/build/browser/util/UserAgent.js +2 -2
- package/build/browser/util/UserAgent.js.map +1 -1
- package/build/browser/util/toDataValue.js +0 -1
- package/build/browser/util/toDataValue.js.map +1 -1
- package/build/browser/util/toDataValue.test.js +4 -0
- package/build/browser/util/toDataValue.test.js.map +1 -1
- package/build/cjs/{chunk-6SCDLAU2.cjs → chunk-LDTMSHUZ.cjs} +4 -4
- package/build/cjs/{chunk-6SCDLAU2.cjs.map → chunk-LDTMSHUZ.cjs.map} +1 -1
- package/build/cjs/{chunk-BRUBBJUT.cjs → chunk-MZZAHBN6.cjs} +636 -138
- package/build/cjs/chunk-MZZAHBN6.cjs.map +1 -0
- package/build/cjs/{chunk-EHMN4DL4.cjs → chunk-RDZ5NKAI.cjs} +210 -129
- package/build/cjs/chunk-RDZ5NKAI.cjs.map +1 -0
- package/build/cjs/{createClient-DvwysJMX.d.cts → createClient-D5G3qzAO.d.cts} +1 -0
- package/build/cjs/{delay-KIUUJ5NJ.cjs → delay-W2TSML2P.cjs} +4 -4
- package/build/cjs/{delay-KIUUJ5NJ.cjs.map → delay-W2TSML2P.cjs.map} +1 -1
- package/build/cjs/index.cjs +12 -12
- package/build/cjs/index.d.cts +1 -1
- package/build/cjs/public/internal-node.cjs +219 -219
- package/build/cjs/public/internal.cjs +14 -14
- package/build/cjs/public/unstable-do-not-use.cjs +335 -145
- package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
- package/build/cjs/public/unstable-do-not-use.d.cts +9 -9
- package/build/esm/Client.js +1 -1
- package/build/esm/Client.js.map +1 -1
- package/build/esm/MinimalClientContext.js.map +1 -1
- package/build/esm/actions/actions.test.js +9 -0
- package/build/esm/actions/actions.test.js.map +1 -1
- package/build/esm/actions/applyAction.js +4 -0
- package/build/esm/actions/applyAction.js.map +1 -1
- package/build/esm/createClient.js +2 -1
- package/build/esm/createClient.js.map +1 -1
- package/build/esm/createMinimalClient.js +1 -0
- package/build/esm/createMinimalClient.js.map +1 -1
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.js +17 -1
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
- package/build/esm/fetchMetadata.test.js +31 -0
- package/build/esm/fetchMetadata.test.js.map +1 -1
- package/build/esm/intellisense.test.js +1 -1
- package/build/esm/intellisense.test.js.map +1 -1
- package/build/esm/object/aggregate.js +1 -0
- package/build/esm/object/aggregate.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/BaseHolder.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.js +3 -0
- package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js +8 -0
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js +95 -3
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.js +18 -6
- package/build/esm/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.test.js +189 -28
- package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/esm/object/fetchPage.js +18 -5
- package/build/esm/object/fetchPage.js.map +1 -1
- package/build/esm/object/fetchPage.test.js.map +1 -1
- package/build/esm/object/formatting/applyPropertyFormatter.js +58 -0
- package/build/esm/object/formatting/applyPropertyFormatter.js.map +1 -0
- package/build/esm/object/formatting/applyPropertyFormatter.test.js +726 -0
- package/build/esm/object/formatting/applyPropertyFormatter.test.js.map +1 -0
- package/build/esm/object/formatting/formatBoolean.js +23 -0
- package/build/esm/object/formatting/formatBoolean.js.map +1 -0
- package/build/esm/object/formatting/formatDateTime.js +158 -0
- package/build/esm/object/formatting/formatDateTime.js.map +1 -0
- package/build/esm/object/formatting/formatNumber.js +242 -0
- package/build/esm/object/formatting/formatNumber.js.map +1 -0
- package/build/esm/object/formatting/propertyFormattingUtils.js +39 -0
- package/build/esm/object/formatting/propertyFormattingUtils.js.map +1 -0
- package/build/esm/object/object.test.js +123 -0
- package/build/esm/object/object.test.js.map +1 -1
- package/build/esm/objectSet/InterfaceObjectSet.test.js +1 -1
- package/build/esm/objectSet/InterfaceObjectSet.test.js.map +1 -1
- package/build/esm/objectSet/ObjectSet.test.js +7 -6
- package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js +2 -2
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js +3 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
- package/build/esm/objectSet/createObjectSet.js +13 -0
- package/build/esm/objectSet/createObjectSet.js.map +1 -1
- package/build/esm/objectSet/fetchLinksPage.js +57 -0
- package/build/esm/objectSet/fetchLinksPage.js.map +1 -0
- package/build/esm/objectSet/fetchLinksPage.test.js +102 -0
- package/build/esm/objectSet/fetchLinksPage.test.js.map +1 -0
- package/build/esm/observable/ListPayload.js.map +1 -1
- package/build/esm/observable/ObjectPayload.js.map +1 -1
- package/build/esm/observable/ObservableClient.js +0 -5
- package/build/esm/observable/ObservableClient.js.map +1 -1
- package/build/esm/observable/internal/ObservableClientImpl.js.map +1 -1
- package/build/esm/observable/internal/Store.test.js +104 -1
- package/build/esm/observable/internal/Store.test.js.map +1 -1
- package/build/esm/observable/internal/actions/OptimisticJob.js +1 -1
- package/build/esm/observable/internal/actions/OptimisticJob.js.map +1 -1
- package/build/esm/observable/internal/base-list/BaseListQuery.js +1 -1
- package/build/esm/observable/internal/base-list/BaseListQuery.js.map +1 -1
- package/build/esm/observable/internal/links/SpecificLinkQuery.js +9 -1
- package/build/esm/observable/internal/links/SpecificLinkQuery.js.map +1 -1
- package/build/esm/observable/internal/list/ListQuery.js +17 -2
- package/build/esm/observable/internal/list/ListQuery.js.map +1 -1
- package/build/esm/observable/internal/objectset/ObjectSetQuery.js +9 -7
- package/build/esm/observable/internal/objectset/ObjectSetQuery.js.map +1 -1
- package/build/esm/observable/internal/utils/rdpFieldOperations.js +46 -25
- package/build/esm/observable/internal/utils/rdpFieldOperations.js.map +1 -1
- package/build/esm/observable/internal/utils/rdpFieldOperations.test.js +172 -0
- package/build/esm/observable/internal/utils/rdpFieldOperations.test.js.map +1 -0
- package/build/esm/ontology/loadActionMetadata.js +3 -1
- package/build/esm/ontology/loadActionMetadata.js.map +1 -1
- package/build/esm/ontology/loadFullObjectMetadata.js +2 -1
- package/build/esm/ontology/loadFullObjectMetadata.js.map +1 -1
- package/build/esm/ontology/loadInterfaceMetadata.js +2 -1
- package/build/esm/ontology/loadInterfaceMetadata.js.map +1 -1
- package/build/esm/public/unstable-do-not-use.js.map +1 -1
- package/build/esm/queries/applyQuery.js +14 -0
- package/build/esm/queries/applyQuery.js.map +1 -1
- package/build/esm/queries/queries.test.js +14 -2
- package/build/esm/queries/queries.test.js.map +1 -1
- package/build/esm/util/UserAgent.js +2 -2
- package/build/esm/util/UserAgent.js.map +1 -1
- package/build/esm/util/toDataValue.js +0 -1
- package/build/esm/util/toDataValue.js.map +1 -1
- package/build/esm/util/toDataValue.test.js +4 -0
- package/build/esm/util/toDataValue.test.js.map +1 -1
- package/build/types/Client.d.ts +1 -1
- package/build/types/MinimalClientContext.d.ts +1 -0
- package/build/types/MinimalClientContext.d.ts.map +1 -1
- package/build/types/actions/applyAction.d.ts.map +1 -1
- package/build/types/createClient.d.ts +1 -0
- package/build/types/createClient.d.ts.map +1 -1
- package/build/types/object/convertWireToOsdkObjects/InternalSymbols.d.ts +2 -0
- package/build/types/object/convertWireToOsdkObjects/InternalSymbols.d.ts.map +1 -1
- package/build/types/object/convertWireToOsdkObjects.d.ts +4 -4
- package/build/types/object/convertWireToOsdkObjects.d.ts.map +1 -1
- package/build/types/object/fetchPage.d.ts.map +1 -1
- package/build/types/object/formatting/applyPropertyFormatter.d.ts +18 -0
- package/build/types/object/formatting/applyPropertyFormatter.d.ts.map +1 -0
- package/build/types/object/formatting/applyPropertyFormatter.test.d.ts +1 -0
- package/build/types/object/formatting/applyPropertyFormatter.test.d.ts.map +1 -0
- package/build/types/object/formatting/formatBoolean.d.ts +5 -0
- package/build/types/object/formatting/formatBoolean.d.ts.map +1 -0
- package/build/types/object/formatting/formatDateTime.d.ts +6 -0
- package/build/types/object/formatting/formatDateTime.d.ts.map +1 -0
- package/build/types/object/formatting/formatNumber.d.ts +15 -0
- package/build/types/object/formatting/formatNumber.d.ts.map +1 -0
- package/build/types/object/formatting/propertyFormattingUtils.d.ts +10 -0
- package/build/types/object/formatting/propertyFormattingUtils.d.ts.map +1 -0
- package/build/types/object/object.test.d.ts.map +1 -1
- package/build/types/objectSet/fetchLinksPage.d.ts +1 -0
- package/build/types/objectSet/fetchLinksPage.d.ts.map +1 -0
- package/build/types/objectSet/fetchLinksPage.test.d.ts +1 -0
- package/build/types/objectSet/fetchLinksPage.test.d.ts.map +1 -0
- package/build/types/observable/ListPayload.d.ts +3 -2
- package/build/types/observable/ListPayload.d.ts.map +1 -1
- package/build/types/observable/ObjectPayload.d.ts +2 -2
- package/build/types/observable/ObjectPayload.d.ts.map +1 -1
- package/build/types/observable/ObservableClient.d.ts +10 -7
- package/build/types/observable/ObservableClient.d.ts.map +1 -1
- package/build/types/observable/internal/Store.test.d.ts.map +1 -1
- package/build/types/observable/internal/actions/OptimisticJob.d.ts.map +1 -1
- package/build/types/observable/internal/links/SpecificLinkQuery.d.ts.map +1 -1
- package/build/types/observable/internal/list/ListQuery.d.ts.map +1 -1
- package/build/types/observable/internal/objectset/ObjectSetQuery.d.ts.map +1 -1
- package/build/types/observable/internal/utils/rdpFieldOperations.d.ts.map +1 -1
- package/build/types/observable/internal/utils/rdpFieldOperations.test.d.ts +1 -0
- package/build/types/observable/internal/utils/rdpFieldOperations.test.d.ts.map +1 -0
- package/build/types/public/unstable-do-not-use.d.ts +1 -1
- package/build/types/public/unstable-do-not-use.d.ts.map +1 -1
- package/build/types/queries/applyQuery.d.ts.map +1 -1
- package/package.json +14 -14
- package/build/cjs/chunk-BRUBBJUT.cjs.map +0 -1
- package/build/cjs/chunk-EHMN4DL4.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,122 +1,126 @@
|
|
|
1
1
|
# @osdk/client
|
|
2
2
|
|
|
3
|
-
## 2.
|
|
3
|
+
## 2.7.0-beta.10
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- db44f6b: Add property security metadata to objects when requested
|
|
8
|
+
- 266b901: Fix queries that return arrays of objects.
|
|
4
9
|
|
|
5
10
|
### Patch Changes
|
|
6
11
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
- @osdk/
|
|
11
|
-
- @osdk/
|
|
12
|
-
|
|
12
|
+
- Updated dependencies [db44f6b]
|
|
13
|
+
- Updated dependencies [24a1e29]
|
|
14
|
+
- @osdk/api@2.7.0-beta.10
|
|
15
|
+
- @osdk/client.unstable@2.7.0-beta.10
|
|
16
|
+
- @osdk/generator-converters@2.7.0-beta.10
|
|
17
|
+
|
|
18
|
+
## 2.7.0-beta.9
|
|
13
19
|
|
|
14
|
-
|
|
20
|
+
### Minor Changes
|
|
21
|
+
|
|
22
|
+
- 6b27d8a: fix sorting strategy initialization for ListQuery and ObjectSetQuery
|
|
15
23
|
|
|
16
24
|
### Patch Changes
|
|
17
25
|
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
- 486ef7e: Deprecate multiplicity in query params/outputs
|
|
24
|
-
- ea077c6: Change asType to narrowToType
|
|
25
|
-
- 507ec7f: Allows top level filters with an implied and clause to support a combination of a not and and clause
|
|
26
|
-
- c5a3815: Add new auto fetch more behavior to useOsdkObjects
|
|
27
|
-
- 5a9cd8f: Remove NULL_VALUE from @osdk/api for RC
|
|
28
|
-
- 61eb5b0: Add heartbeat to object set subscriptions
|
|
29
|
-
- 9961f06: fix order by via key stabilization
|
|
30
|
-
- e7bf02a: Add RDP support to React toolkit
|
|
31
|
-
- a1ffb20: Use new ephemeral media upload endpoint.
|
|
32
|
-
- b959085: Fix nested array query param type handling
|
|
33
|
-
- af4f3bf: Remove the following features for RC:
|
|
34
|
-
- Property formatting
|
|
35
|
-
- Branching
|
|
36
|
-
- Constant RDPs
|
|
26
|
+
- Updated dependencies [8381ac2]
|
|
27
|
+
- Updated dependencies [c95f3bc]
|
|
28
|
+
- @osdk/client.unstable@2.7.0-beta.9
|
|
29
|
+
- @osdk/api@2.7.0-beta.9
|
|
30
|
+
- @osdk/generator-converters@2.7.0-beta.9
|
|
37
31
|
|
|
38
|
-
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
-
|
|
43
|
-
- Updated dependencies [322c5bc]
|
|
44
|
-
- Updated dependencies [322c5bc]
|
|
45
|
-
- Updated dependencies [b313525]
|
|
46
|
-
- Updated dependencies [3fbb596]
|
|
47
|
-
- Updated dependencies [f7ae38a]
|
|
48
|
-
- Updated dependencies [486ef7e]
|
|
49
|
-
- Updated dependencies [ea077c6]
|
|
50
|
-
- Updated dependencies [3d7dc0a]
|
|
51
|
-
- Updated dependencies [7fd788b]
|
|
52
|
-
- Updated dependencies [2556c64]
|
|
53
|
-
- Updated dependencies [5a9cd8f]
|
|
54
|
-
- Updated dependencies [b307201]
|
|
55
|
-
- Updated dependencies [e7bf02a]
|
|
56
|
-
- Updated dependencies [a1ffb20]
|
|
57
|
-
- Updated dependencies [b959085]
|
|
58
|
-
- Updated dependencies [af4f3bf]
|
|
59
|
-
- Updated dependencies [e62c692]
|
|
60
|
-
- @osdk/api@2.6.0
|
|
61
|
-
- @osdk/client.unstable@2.6.0
|
|
62
|
-
- @osdk/generator-converters@2.6.0
|
|
63
|
-
- @osdk/shared.client.impl@1.6.0
|
|
64
|
-
- @osdk/shared.net.errors@2.6.0
|
|
65
|
-
- @osdk/shared.net.fetch@1.6.0
|
|
32
|
+
## 2.7.0-beta.8
|
|
33
|
+
|
|
34
|
+
### Minor Changes
|
|
35
|
+
|
|
36
|
+
- c6124eb: Add ability to flush edits to transactions
|
|
66
37
|
|
|
67
|
-
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- @osdk/api@2.7.0-beta.8
|
|
41
|
+
- @osdk/client.unstable@2.7.0-beta.8
|
|
42
|
+
- @osdk/generator-converters@2.7.0-beta.8
|
|
43
|
+
|
|
44
|
+
## 2.7.0-beta.7
|
|
45
|
+
|
|
46
|
+
### Minor Changes
|
|
47
|
+
|
|
48
|
+
- adca853: fix fetchMore behavior
|
|
49
|
+
- 0b0be9f: fix object spread related bug by using createOsdkObject
|
|
68
50
|
|
|
69
51
|
### Patch Changes
|
|
70
52
|
|
|
71
|
-
- @osdk/api@2.
|
|
72
|
-
- @osdk/client.unstable@2.
|
|
73
|
-
- @osdk/generator-converters@2.
|
|
53
|
+
- @osdk/api@2.7.0-beta.7
|
|
54
|
+
- @osdk/client.unstable@2.7.0-beta.7
|
|
55
|
+
- @osdk/generator-converters@2.7.0-beta.7
|
|
56
|
+
|
|
57
|
+
## 2.7.0-beta.6
|
|
58
|
+
|
|
59
|
+
### Minor Changes
|
|
74
60
|
|
|
75
|
-
|
|
61
|
+
- c332598: Adds experimental platform API hooks to fetch Foundry users
|
|
62
|
+
- 0b2cd91: fix SimplePropertyDef issue, wire RDPs through, update names
|
|
76
63
|
|
|
77
64
|
### Patch Changes
|
|
78
65
|
|
|
79
|
-
- Updated dependencies [
|
|
80
|
-
- @osdk/api@2.
|
|
81
|
-
- @osdk/client.unstable@2.
|
|
82
|
-
- @osdk/generator-converters@2.
|
|
66
|
+
- Updated dependencies [c9ca08d]
|
|
67
|
+
- @osdk/api@2.7.0-beta.6
|
|
68
|
+
- @osdk/client.unstable@2.7.0-beta.6
|
|
69
|
+
- @osdk/generator-converters@2.7.0-beta.6
|
|
70
|
+
|
|
71
|
+
## 2.7.0-beta.5
|
|
72
|
+
|
|
73
|
+
### Minor Changes
|
|
83
74
|
|
|
84
|
-
|
|
75
|
+
- dc33f68: Add Transaction ID to Queries
|
|
85
76
|
|
|
86
77
|
### Patch Changes
|
|
87
78
|
|
|
88
|
-
-
|
|
89
|
-
- @osdk/
|
|
90
|
-
- @osdk/
|
|
79
|
+
- Updated dependencies [dc33f68]
|
|
80
|
+
- @osdk/generator-converters@2.7.0-beta.5
|
|
81
|
+
- @osdk/api@2.7.0-beta.5
|
|
82
|
+
- @osdk/client.unstable@2.7.0-beta.5
|
|
91
83
|
|
|
92
|
-
## 2.
|
|
84
|
+
## 2.7.0-beta.4
|
|
85
|
+
|
|
86
|
+
### Minor Changes
|
|
87
|
+
|
|
88
|
+
- 1e3c147: Add experimental_asyncIterLinks method on object sets
|
|
93
89
|
|
|
94
90
|
### Patch Changes
|
|
95
91
|
|
|
96
|
-
-
|
|
97
|
-
-
|
|
98
|
-
- @osdk/
|
|
99
|
-
- @osdk/
|
|
100
|
-
|
|
92
|
+
- Updated dependencies [1e3c147]
|
|
93
|
+
- @osdk/api@2.7.0-beta.4
|
|
94
|
+
- @osdk/client.unstable@2.7.0-beta.4
|
|
95
|
+
- @osdk/generator-converters@2.7.0-beta.4
|
|
96
|
+
|
|
97
|
+
## 2.7.0-beta.3
|
|
101
98
|
|
|
102
|
-
|
|
99
|
+
### Minor Changes
|
|
100
|
+
|
|
101
|
+
- a23784c: wire action edit response types through for useOsdkAction
|
|
102
|
+
- f0a57a5: Use new interface property fields to include interface property types in codegen
|
|
103
103
|
|
|
104
104
|
### Patch Changes
|
|
105
105
|
|
|
106
|
-
-
|
|
107
|
-
-
|
|
108
|
-
-
|
|
109
|
-
-
|
|
110
|
-
-
|
|
106
|
+
- Updated dependencies [448763f]
|
|
107
|
+
- Updated dependencies [f0a57a5]
|
|
108
|
+
- @osdk/api@2.7.0-beta.3
|
|
109
|
+
- @osdk/generator-converters@2.7.0-beta.3
|
|
110
|
+
- @osdk/client.unstable@2.7.0-beta.3
|
|
111
|
+
|
|
112
|
+
## 2.7.0-beta.2
|
|
113
|
+
|
|
114
|
+
### Minor Changes
|
|
115
|
+
|
|
116
|
+
- 03db734: Move platform SDK deps to pnpm catalog
|
|
117
|
+
- c8da6b7: fix useLinks sorting strategy initialization
|
|
118
|
+
|
|
119
|
+
### Patch Changes
|
|
111
120
|
|
|
112
|
-
-
|
|
113
|
-
-
|
|
114
|
-
|
|
115
|
-
- @osdk/shared.client.impl@1.6.0-rc.2
|
|
116
|
-
- @osdk/shared.net.errors@2.6.0-rc.2
|
|
117
|
-
- @osdk/shared.net.fetch@1.6.0-rc.2
|
|
118
|
-
- @osdk/client.unstable@2.6.0-rc.14
|
|
119
|
-
- @osdk/api@2.6.0-rc.14
|
|
121
|
+
- @osdk/api@2.7.0-beta.2
|
|
122
|
+
- @osdk/client.unstable@2.7.0-beta.2
|
|
123
|
+
- @osdk/generator-converters@2.7.0-beta.2
|
|
120
124
|
|
|
121
125
|
## 2.6.0-beta.13
|
|
122
126
|
|
package/build/browser/Client.js
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
export const additionalContext = Symbol("additionalContext");
|
|
22
22
|
|
|
23
23
|
// BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.
|
|
24
|
-
const MaxOsdkVersion = "2.
|
|
24
|
+
const MaxOsdkVersion = "2.7.0";
|
|
25
25
|
// END: THIS IS GENERATED CODE. DO NOT EDIT.
|
|
26
26
|
|
|
27
27
|
const ErrorMessage = Symbol("ErrorMessage");
|
|
@@ -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\"> | 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.
|
|
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.7.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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MinimalClientContext.js","names":[],"sources":["MinimalClientContext.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 { Logger } from \"@osdk/api\";\nimport type { SharedClientContext } from \"@osdk/shared.client2\";\nimport type {\n convertWireToOsdkObjects,\n convertWireToOsdkObjects2,\n} from \"./object/convertWireToOsdkObjects.js\";\nimport type { ObjectSetFactory } from \"./objectSet/ObjectSetFactory.js\";\nimport type { OntologyProvider } from \"./ontology/OntologyProvider.js\";\n\ndeclare const tag: unique symbol;\n\nexport type ClientCacheKey = {} & { readonly [tag]: void };\n\nexport type RequestContext = {\n finalMethodCall?: string;\n};\n\nexport interface MinimalClient extends SharedClientContext {\n ontologyRid: string | Promise<string>;\n ontologyProvider: OntologyProvider;\n logger?: Logger;\n /** @internal */\n objectSetFactory: ObjectSetFactory<any, any>;\n /** @internal */\n objectFactory: typeof convertWireToOsdkObjects;\n /** @internal */\n objectFactory2: typeof convertWireToOsdkObjects2;\n /** @internal */\n\n transactionId?: string;\n flushEdits?: () => Promise<void>;\n\n clientCacheKey: ClientCacheKey;\n requestContext: RequestContext;\n narrowTypeInterfaceOrObjectMapping: Record<string, \"object\" | \"interface\">;\n}\n\nexport type MinimalClientParams = {\n metadata: MinimalClientMetadata;\n provider: OntologyProvider;\n};\n\nexport interface MinimalClientMetadata {\n ontologyRid: string | Promise<string>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"MinimalClientContext.js","names":[],"sources":["MinimalClientContext.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 { Logger } from \"@osdk/api\";\nimport type { SharedClientContext } from \"@osdk/shared.client2\";\nimport type {\n convertWireToOsdkObjects,\n convertWireToOsdkObjects2,\n} from \"./object/convertWireToOsdkObjects.js\";\nimport type { ObjectSetFactory } from \"./objectSet/ObjectSetFactory.js\";\nimport type { OntologyProvider } from \"./ontology/OntologyProvider.js\";\n\ndeclare const tag: unique symbol;\n\nexport type ClientCacheKey = {} & { readonly [tag]: void };\n\nexport type RequestContext = {\n finalMethodCall?: string;\n};\n\nexport interface MinimalClient extends SharedClientContext {\n ontologyRid: string | Promise<string>;\n ontologyProvider: OntologyProvider;\n logger?: Logger;\n branch?: string;\n /** @internal */\n objectSetFactory: ObjectSetFactory<any, any>;\n /** @internal */\n objectFactory: typeof convertWireToOsdkObjects;\n /** @internal */\n objectFactory2: typeof convertWireToOsdkObjects2;\n /** @internal */\n\n transactionId?: string;\n flushEdits?: () => Promise<void>;\n\n clientCacheKey: ClientCacheKey;\n requestContext: RequestContext;\n narrowTypeInterfaceOrObjectMapping: Record<string, \"object\" | \"interface\">;\n}\n\nexport type MinimalClientParams = {\n metadata: MinimalClientMetadata;\n provider: OntologyProvider;\n};\n\nexport interface MinimalClientMetadata {\n ontologyRid: string | Promise<string>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -299,6 +299,15 @@ describe.each(["https://stack.palantir.com", "https://stack.palantirCustom.com/f
|
|
|
299
299
|
"type": "edits"
|
|
300
300
|
});
|
|
301
301
|
});
|
|
302
|
+
it("nullable parameters work with nullish coalescing", () => {
|
|
303
|
+
client(createOffice).applyAction;
|
|
304
|
+
expectTypeOf().toMatchTypeOf();
|
|
305
|
+
const address = {
|
|
306
|
+
officeId: "HQ",
|
|
307
|
+
address: null
|
|
308
|
+
}.address ?? "address";
|
|
309
|
+
expect(address).toBe("address");
|
|
310
|
+
});
|
|
302
311
|
});
|
|
303
312
|
describe("ActionResponse remapping", () => {
|
|
304
313
|
const actionResponse = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.test.js","names":["$Actions","actionTakesAttachment","actionTakesMedia","addGeoshape","createFooInterface","createOffice","createStructPerson","deleteBarInterface","deleteFooInterface","Employee","moveOffice","LegacyFauxFoundry","MockOntologiesV2","startNodeApiServer","stubData","beforeAll","describe","expect","expectTypeOf","it","vi","createClient","createAttachmentUpload","ActionValidationError","remapActionResponse","each","baseUrl","client","apiServer","testSetup","close","result","applyAction","officeId","address","capacity","$returnEdits","toEqualTypeOf","toMatchObject","undefinedResult","toBeUndefined","batchApplyAction","clientCreateOfficeMock","fn","newAddress","newCapacity","$validateOnly","fail","e","toBeInstanceOf","validation","toMatchTypeOf","name","city","state","zipcode","boundary","use","Actions","apply","submissionCriteria","parameters","attachment","blob","Blob","JSON","stringify","fileAttachment","Object","assign","result2","media_reference","actionRequestMediaUpload","geoshapeParam","type","coordinates","geohashParam","deletedInterface","$objectType","$primaryKey","createdInterface","apiName","actionResponse","edits","deletedLinksCount","deletedObjectsCount","addedObjectCount","modifiedObjectsCount","addedLinksCount","batchActionResponse","remappedActionResponse","remappedBatchActionResponse","toMatchInlineSnapshot","actions","keys","toStrictEqual","wrapper","example","Promise","resolve"],"sources":["actions.test.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionEditResponse,\n ActionValidationResponse,\n AttachmentUpload,\n MediaReference,\n} from \"@osdk/api\";\nimport {\n $Actions,\n actionTakesAttachment,\n actionTakesMedia,\n addGeoshape,\n createFooInterface,\n createOffice,\n createStructPerson,\n deleteBarInterface,\n deleteFooInterface,\n Employee,\n moveOffice,\n} from \"@osdk/client.test.ontology\";\nimport type {\n BatchApplyActionResponseV2,\n SyncApplyActionResponseV2,\n} from \"@osdk/foundry.ontologies\";\nimport type { SetupServer } from \"@osdk/shared.test\";\nimport {\n LegacyFauxFoundry,\n MockOntologiesV2,\n startNodeApiServer,\n stubData,\n} from \"@osdk/shared.test\";\nimport { beforeAll, describe, expect, expectTypeOf, it, vi } from \"vitest\";\nimport type { Client } from \"../Client.js\";\nimport { createClient } from \"../createClient.js\";\nimport { createAttachmentUpload } from \"../object/AttachmentUpload.js\";\nimport { ActionValidationError } from \"./ActionValidationError.js\";\nimport { remapActionResponse } from \"./applyAction.js\";\n\ndescribe.each([\n \"https://stack.palantir.com\",\n \"https://stack.palantirCustom.com/foo/first/someStuff\",\n])(\"actions for %s\", (baseUrl) => {\n let client: Client;\n let apiServer: SetupServer;\n\n beforeAll(() => {\n const testSetup = startNodeApiServer(\n new LegacyFauxFoundry(baseUrl),\n createClient,\n );\n ({ client, apiServer } = testSetup);\n\n return () => {\n apiServer.close();\n };\n });\n\n it(\"conditionally returns the edits\", async () => {\n const result = await client(createOffice).applyAction({\n officeId: \"NYC\",\n address: \"123 Main Street\",\n capacity: 100,\n }, { $returnEdits: true });\n\n expectTypeOf<typeof result>().toEqualTypeOf<ActionEditResponse>();\n expect(result).toMatchObject(\n {\n \"addedLinks\": [],\n \"addedObjects\": [\n {\n \"objectType\": \"Office\",\n \"primaryKey\": \"NYC\",\n },\n ],\n \"deletedLinks\": [],\n \"deletedLinksCount\": 0,\n \"deletedObjects\": [],\n \"deletedObjectsCount\": 0,\n \"editedObjectTypes\": [\n \"Office\",\n ],\n \"modifiedObjects\": [],\n \"type\": \"edits\",\n },\n );\n\n // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression\n const undefinedResult = await client(createOffice).applyAction({\n officeId: \"NYC\",\n address: \"123 Main Street\",\n capacity: 100,\n });\n\n expectTypeOf<typeof undefinedResult>().toEqualTypeOf<undefined>();\n expect(undefinedResult).toBeUndefined();\n\n const clientCreateOffice = client(createOffice).batchApplyAction;\n const clientCreateOfficeMock: typeof clientCreateOffice = vi.fn();\n void clientCreateOfficeMock([{\n officeId: \"NYC\",\n address: \"123 Main Street\",\n capacity: 100,\n }], { $returnEdits: true });\n });\n\n it(\"returns validation directly on validateOnly mode\", async () => {\n const result = await client(moveOffice).applyAction({\n officeId: \"SEA\",\n newAddress: \"456 Pike Place\",\n // intentionally using a string to trigger validation errors\n newCapacity: \"40\" as unknown as number,\n }, {\n $validateOnly: true,\n });\n expectTypeOf<typeof result>().toEqualTypeOf<ActionValidationResponse>();\n\n expect(result).toMatchObject(\n {\n \"parameters\": {\n \"newCapacity\": {\n \"evaluatedConstraints\": [],\n \"required\": false,\n \"result\": \"INVALID\",\n },\n },\n \"result\": \"INVALID\",\n \"submissionCriteria\": [],\n },\n );\n });\n\n it(\"returns validation directly on validateOnly mode, with custom entry point in URL\", async () => {\n const result = await client(moveOffice).applyAction({\n officeId: \"SEA\",\n newAddress: \"456 Pike Place\",\n // intentionally using a string to trigger validation failure\n newCapacity: \"40\" as unknown as number,\n }, {\n $validateOnly: true,\n });\n expectTypeOf<typeof result>().toEqualTypeOf<ActionValidationResponse>();\n\n expect(result).toMatchObject(\n {\n \"parameters\": {\n \"newCapacity\": {\n \"evaluatedConstraints\": [],\n \"required\": false,\n \"result\": \"INVALID\",\n },\n },\n \"result\": \"INVALID\",\n \"submissionCriteria\": [],\n },\n );\n });\n\n it(\"throws on validation errors\", async () => {\n try {\n const result = await client(moveOffice).applyAction({\n officeId: \"SEA\",\n newAddress: \"456 Pike Place\",\n // intentionally using a string to trigger validation failure\n newCapacity: \"40\" as unknown as number,\n }, {\n $returnEdits: true,\n });\n expect.fail(\"Should not reach here\");\n } catch (e) {\n expect(e).toBeInstanceOf(ActionValidationError);\n expect((e as ActionValidationError).validation).toMatchObject(\n {\n \"parameters\": {\n \"newCapacity\": {\n \"evaluatedConstraints\": [],\n \"required\": false,\n \"result\": \"INVALID\",\n },\n },\n \"result\": \"INVALID\",\n \"submissionCriteria\": [],\n },\n );\n }\n });\n\n it(\"Accepts structs\", async () => {\n const clientBoundActionTakesStruct = client(createStructPerson).applyAction;\n type InferredParamType = Parameters<\n typeof clientBoundActionTakesStruct\n >[0];\n expectTypeOf<\n {\n name: string;\n address: { city: string; state: string; zipcode: number };\n }\n >()\n .toMatchTypeOf<\n InferredParamType\n >();\n\n const result = await client(createStructPerson).applyAction({\n name: \"testMan\",\n address: { city: \"NYC\", state: \"NY\", zipcode: 12345 },\n });\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\n });\n\n it(\"Accepts attachments\", async () => {\n const clientBoundActionTakesAttachment = client(\n actionTakesAttachment,\n ).applyAction;\n\n type InferredParamType = Parameters<\n typeof clientBoundActionTakesAttachment\n >[0];\n\n expectTypeOf<{ attachment: string | AttachmentUpload }>().toMatchTypeOf<\n InferredParamType\n >();\n\n const clientBoundBatchActionTakesAttachment = client(\n actionTakesAttachment,\n ).batchApplyAction;\n type InferredBatchParamType = Parameters<\n typeof clientBoundBatchActionTakesAttachment\n >[0];\n\n expectTypeOf<{\n attachment: string | AttachmentUpload;\n }[]>().toMatchTypeOf<InferredBatchParamType>();\n\n await apiServer.boundary(async () => {\n apiServer.use(MockOntologiesV2.Actions.apply(baseUrl, (info) => {\n return {\n validation: {\n result: \"VALID\",\n submissionCriteria: [],\n parameters: {},\n },\n };\n }));\n\n // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression\n const result = await client(actionTakesAttachment).applyAction({\n attachment: \"ri.some.rid\",\n });\n\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\n })();\n });\n\n it(\"Accepts attachment uploads\", async () => {\n const clientBoundActionTakesAttachment = client(\n actionTakesAttachment,\n ).applyAction;\n type InferredParamType = Parameters<\n typeof clientBoundActionTakesAttachment\n >[0];\n const clientBoundBatchActionTakesAttachment = client(\n actionTakesAttachment,\n ).batchApplyAction;\n type InferredBatchParamType = Parameters<\n typeof clientBoundBatchActionTakesAttachment\n >[0];\n\n expectTypeOf<\n {\n attachment:\n | string\n | AttachmentUpload\n | Blob & { readonly name: string };\n }\n >().toMatchTypeOf<\n InferredParamType\n >();\n expectTypeOf<\n {\n attachment:\n | string\n | AttachmentUpload\n | Blob & { readonly name: string };\n }[]\n >().toMatchTypeOf<\n InferredBatchParamType\n >();\n\n const blob = new Blob([JSON.stringify({ name: \"Hello World\" }, null, 2)]);\n\n const attachment = createAttachmentUpload(blob, \"file1.txt\");\n\n // Mimics the Web file API (https://developer.mozilla.org/en-US/docs/Web/API/File). The File constructor is only available in Node 19.2.0 and above\n const fileAttachment = Object.assign(blob, { name: \"file1.txt\" });\n\n // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression\n const result = await client(actionTakesAttachment).applyAction({\n attachment,\n });\n\n // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression\n const result2 = await client(actionTakesAttachment).applyAction({\n attachment: fileAttachment,\n });\n\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\n\n expectTypeOf<typeof result2>().toEqualTypeOf<undefined>();\n expect(result2).toBeUndefined();\n });\n\n it(\"Accepts media reference\", async () => {\n const clientBoundActionTakesMedia = client(\n actionTakesMedia,\n ).applyAction;\n type InferredParamType = Parameters<\n typeof clientBoundActionTakesMedia\n >[0];\n\n expectTypeOf<\n {\n media_reference: MediaReference;\n }\n >().toMatchTypeOf<\n InferredParamType\n >();\n\n const result = await client(actionTakesMedia).applyAction({\n media_reference:\n stubData.actionRequestMediaUpload.parameters.media_reference,\n });\n\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\n });\n\n it(\"Accepts geoshapes\", async () => {\n const clientBoundActionTakesMedia = client(\n addGeoshape,\n ).applyAction;\n type InferredParamType = Parameters<\n typeof clientBoundActionTakesMedia\n >[0];\n\n expectTypeOf<\n {\n geoshapeParam: GeoJSON.GeoJSON;\n geohashParam: GeoJSON.Point;\n }\n >().toMatchTypeOf<\n InferredParamType\n >();\n\n const result = await client(addGeoshape).applyAction({\n geoshapeParam: {\n type: \"Polygon\",\n coordinates: [\n [\n [\n -97.86567863752134,\n 38.418052586871624,\n ],\n [\n -97.86567863752134,\n 35.410223767370525,\n ],\n [\n -91.98573135442845,\n 35.410223767370525,\n ],\n [\n -91.98573135442845,\n 38.418052586871624,\n ],\n [\n -97.86567863752134,\n 38.418052586871624,\n ],\n ],\n ],\n },\n geohashParam: {\n type: \"Point\",\n coordinates: [-79.4382042508868, 40.917859676842255],\n },\n });\n\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\n });\n\n it(\"Accepts interfaces\", async () => {\n const clientBoundTakesInterface = client(\n deleteFooInterface,\n ).applyAction;\n\n type InferredParamType = Parameters<\n typeof clientBoundTakesInterface\n >[0];\n\n expectTypeOf<\n {\n deletedInterface: {\n $objectType: \"Employee\" | \"Person\";\n $primaryKey: string | number;\n };\n }\n >().toMatchTypeOf<\n InferredParamType\n >();\n\n const clientBoundBatchActionTakesInterface = client(\n deleteFooInterface,\n ).batchApplyAction;\n type InferredBatchParamType = Parameters<\n typeof clientBoundBatchActionTakesInterface\n >[0];\n\n expectTypeOf<{\n deletedInterface: {\n $objectType: \"Employee\" | \"Person\";\n $primaryKey: string | number;\n };\n }[]>().toMatchTypeOf<InferredBatchParamType>();\n\n const result = await client(deleteFooInterface).applyAction({\n deletedInterface: {\n $objectType: \"Employee\",\n $primaryKey: 50030,\n },\n });\n\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\n });\n it(\"Accepts interfaces if implementing object types unknown\", async () => {\n const clientBoundTakesInterface = client(\n deleteBarInterface,\n ).applyAction;\n\n type InferredParamType = Parameters<\n typeof clientBoundTakesInterface\n >[0];\n\n expectTypeOf<\n {\n deletedInterface: {\n $objectType: string;\n $primaryKey: string | number;\n };\n }\n >().toMatchTypeOf<\n InferredParamType\n >();\n\n const clientBoundBatchActionTakesInterface = client(\n deleteBarInterface,\n ).batchApplyAction;\n type InferredBatchParamType = Parameters<\n typeof clientBoundBatchActionTakesInterface\n >[0];\n\n expectTypeOf<{\n deletedInterface: {\n $objectType: string;\n $primaryKey: string | number;\n };\n }[]>().toMatchTypeOf<InferredBatchParamType>();\n });\n it(\"Accepts object type refs\", async () => {\n const clientBoundTakesObjectType = client(\n createFooInterface,\n ).applyAction;\n\n type InferredParamType = Parameters<\n typeof clientBoundTakesObjectType\n >[0];\n\n expectTypeOf<\n {\n createdInterface: string;\n }\n >().toMatchTypeOf<\n InferredParamType\n >();\n\n const clientBoundBatchActionTakesObjectType = client(\n createFooInterface,\n ).batchApplyAction;\n type InferredBatchParamType = Parameters<\n typeof clientBoundBatchActionTakesObjectType\n >[0];\n\n expectTypeOf<{\n createdInterface: string;\n }[]>().toMatchTypeOf<InferredBatchParamType>();\n\n const result = await client(createFooInterface).applyAction({\n createdInterface: Employee.apiName,\n });\n\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\n });\n it(\"conditionally returns edits in batch mode\", async () => {\n const result = await client(moveOffice).batchApplyAction([\n {\n officeId: \"SEA\",\n newAddress: \"456 Good Place\",\n newCapacity: 40,\n },\n {\n officeId: \"NYC\",\n newAddress: \"123 Main Street\",\n newCapacity: 80,\n },\n ], { $returnEdits: true });\n\n expect(result).toMatchObject(\n {\n \"addedLinks\": [],\n \"addedObjects\": [],\n \"deletedLinks\": [],\n \"deletedLinksCount\": 0,\n \"deletedObjects\": [],\n \"deletedObjectsCount\": 0,\n \"editedObjectTypes\": [\n \"Office\",\n ],\n \"modifiedObjects\": [\n {\n \"objectType\": \"Office\",\n \"primaryKey\": \"SEA\",\n },\n {\n \"objectType\": \"Office\",\n \"primaryKey\": \"NYC\",\n },\n ],\n \"type\": \"edits\",\n },\n );\n });\n});\n\ndescribe(\"ActionResponse remapping\", () => {\n const actionResponse: SyncApplyActionResponseV2 = {\n edits: {\n type: \"edits\",\n edits: [{\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n \"type\": \"addObject\",\n }, {\n \"objectType\": \"Contractor\",\n \"primaryKey\": \"Contractor1\",\n \"type\": \"modifyObject\",\n }, {\n \"aSideObject\": { \"primaryKey\": \"key1\", \"objectType\": \"Office\" },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n \"bSideObject\": { \"primaryKey\": \"key2\", \"objectType\": \"Employee\" },\n \"type\": \"addLink\",\n }, {\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n \"type\": \"deleteObject\",\n }, {\n \"aSideObject\": { \"primaryKey\": \"key1\", \"objectType\": \"Office\" },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n \"bSideObject\": { \"primaryKey\": \"key2\", \"objectType\": \"Employee\" },\n \"type\": \"deleteLink\",\n }],\n deletedLinksCount: 0,\n deletedObjectsCount: 1,\n addedObjectCount: 1,\n modifiedObjectsCount: 1,\n addedLinksCount: 1,\n },\n };\n\n const batchActionResponse: BatchApplyActionResponseV2 = {\n edits: {\n type: \"edits\",\n edits: [{\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n \"type\": \"addObject\",\n }, {\n \"objectType\": \"Contractor\",\n \"primaryKey\": \"Contractor1\",\n \"type\": \"modifyObject\",\n }, {\n \"aSideObject\": { \"primaryKey\": \"key1\", \"objectType\": \"Office\" },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n \"bSideObject\": { \"primaryKey\": \"key2\", \"objectType\": \"Employee\" },\n \"type\": \"addLink\",\n }],\n deletedLinksCount: 0,\n deletedObjectsCount: 0,\n addedObjectCount: 1,\n modifiedObjectsCount: 1,\n addedLinksCount: 1,\n },\n };\n\n it(\"Correctly unpacks edits and editedObjectTypes\", () => {\n const remappedActionResponse = remapActionResponse(actionResponse);\n const remappedBatchActionResponse = remapActionResponse(\n batchActionResponse,\n );\n expect(remappedActionResponse).toMatchInlineSnapshot(`\n {\n \"addedLinks\": [\n {\n \"aSideObject\": {\n \"objectType\": \"Office\",\n \"primaryKey\": \"key1\",\n },\n \"bSideObject\": {\n \"objectType\": \"Employee\",\n \"primaryKey\": \"key2\",\n },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n },\n ],\n \"addedObjects\": [\n {\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n },\n ],\n \"deletedLinks\": [\n {\n \"aSideObject\": {\n \"objectType\": \"Office\",\n \"primaryKey\": \"key1\",\n },\n \"bSideObject\": {\n \"objectType\": \"Employee\",\n \"primaryKey\": \"key2\",\n },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n },\n ],\n \"deletedLinksCount\": 0,\n \"deletedObjects\": [\n {\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n },\n ],\n \"deletedObjectsCount\": 1,\n \"editedObjectTypes\": [\n \"Developer\",\n \"Contractor\",\n \"Office\",\n \"Employee\",\n ],\n \"modifiedObjects\": [\n {\n \"objectType\": \"Contractor\",\n \"primaryKey\": \"Contractor1\",\n },\n ],\n \"type\": \"edits\",\n }\n `);\n expect(remappedBatchActionResponse).toMatchInlineSnapshot(`\n {\n \"addedLinks\": [\n {\n \"aSideObject\": {\n \"objectType\": \"Office\",\n \"primaryKey\": \"key1\",\n },\n \"bSideObject\": {\n \"objectType\": \"Employee\",\n \"primaryKey\": \"key2\",\n },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n },\n ],\n \"addedObjects\": [\n {\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n },\n ],\n \"deletedLinks\": [],\n \"deletedLinksCount\": 0,\n \"deletedObjects\": [],\n \"deletedObjectsCount\": 0,\n \"editedObjectTypes\": [\n \"Developer\",\n \"Contractor\",\n \"Office\",\n \"Employee\",\n ],\n \"modifiedObjects\": [\n {\n \"objectType\": \"Contractor\",\n \"primaryKey\": \"Contractor1\",\n },\n ],\n \"type\": \"edits\",\n }\n `);\n });\n it(\"actions are enumerable\", async () => {\n const actions = Object.keys($Actions);\n expect(actions).toStrictEqual([\n \"actionTakesAttachment\",\n \"actionTakesMedia\",\n \"actionTakesObjectSet\",\n \"addGeoshape\",\n \"createFooInterface\",\n \"createOffice\",\n \"createOfficeAndEmployee\",\n \"createStructPerson\",\n \"deleteBarInterface\",\n \"deleteFooInterface\",\n \"editTodo\",\n \"moveOffice\",\n \"promoteEmployee\",\n \"promoteEmployeeObject\",\n ]);\n });\n});\n\nfunction wrapper<R>(fn: () => R): typeof fn {\n return () => fn();\n}\n\nasync function example() {\n await wrapper(async () => Promise.resolve(\"hi\"))();\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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AAY,EAAE,MAAM;UAAE,YAAY,EAAE;QAAW,CAAC;QACjE,MAAM,EAAE;MACV,CAAC,CAAC;MACFC,iBAAiB,EAAE,CAAC;MACpBC,mBAAmB,EAAE,CAAC;MACtBC,gBAAgB,EAAE,CAAC;MACnBC,oBAAoB,EAAE,CAAC;MACvBC,eAAe,EAAE;IACnB;EACF,CAAC;EAEDrE,EAAE,CAAC,+CAA+C,EAAE,MAAM;IACxD,MAAMuE,sBAAsB,GAAGlE,mBAAmB,CAAC0D,cAAc,CAAC;IAClE,MAAMS,2BAA2B,GAAGnE,mBAAmB,CACrDiE,mBACF,CAAC;IACDxE,MAAM,CAACyE,sBAAsB,CAAC,CAACE,qBAAqB,CAAC;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;IACF3E,MAAM,CAAC0E,2BAA2B,CAAC,CAACC,qBAAqB,CAAC;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EACFzE,EAAE,CAAC,wBAAwB,EAAE,YAAY;IACvC,MAAM0E,OAAO,GAAGzB,MAAM,CAAC0B,IAAI,CAAC9F,QAAQ,CAAC;IACrCiB,MAAM,CAAC4E,OAAO,CAAC,CAACE,aAAa,CAAC,CAC5B,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,yBAAyB,EACzB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,CACxB,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,SAASC,OAAOA,CAAIrD,EAAW,EAAa;EAC1C,OAAO,MAAMA,EAAE,CAAC,CAAC;AACnB;AAEA,eAAesD,OAAOA,CAAA,EAAG;EACvB,MAAMD,OAAO,CAAC,YAAYE,OAAO,CAACC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpD","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"actions.test.js","names":["$Actions","actionTakesAttachment","actionTakesMedia","addGeoshape","createFooInterface","createOffice","createStructPerson","deleteBarInterface","deleteFooInterface","Employee","moveOffice","LegacyFauxFoundry","MockOntologiesV2","startNodeApiServer","stubData","beforeAll","describe","expect","expectTypeOf","it","vi","createClient","createAttachmentUpload","ActionValidationError","remapActionResponse","each","baseUrl","client","apiServer","testSetup","close","result","applyAction","officeId","address","capacity","$returnEdits","toEqualTypeOf","toMatchObject","undefinedResult","toBeUndefined","batchApplyAction","clientCreateOfficeMock","fn","newAddress","newCapacity","$validateOnly","fail","e","toBeInstanceOf","validation","toMatchTypeOf","name","city","state","zipcode","boundary","use","Actions","apply","submissionCriteria","parameters","attachment","blob","Blob","JSON","stringify","fileAttachment","Object","assign","result2","media_reference","actionRequestMediaUpload","geoshapeParam","type","coordinates","geohashParam","deletedInterface","$objectType","$primaryKey","createdInterface","apiName","toBe","actionResponse","edits","deletedLinksCount","deletedObjectsCount","addedObjectCount","modifiedObjectsCount","addedLinksCount","batchActionResponse","remappedActionResponse","remappedBatchActionResponse","toMatchInlineSnapshot","actions","keys","toStrictEqual","wrapper","example","Promise","resolve"],"sources":["actions.test.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionEditResponse,\n ActionValidationResponse,\n AttachmentUpload,\n MediaReference,\n} from \"@osdk/api\";\nimport {\n $Actions,\n actionTakesAttachment,\n actionTakesMedia,\n addGeoshape,\n createFooInterface,\n createOffice,\n createStructPerson,\n deleteBarInterface,\n deleteFooInterface,\n Employee,\n moveOffice,\n} from \"@osdk/client.test.ontology\";\nimport type {\n BatchApplyActionResponseV2,\n SyncApplyActionResponseV2,\n} from \"@osdk/foundry.ontologies\";\nimport type { SetupServer } from \"@osdk/shared.test\";\nimport {\n LegacyFauxFoundry,\n MockOntologiesV2,\n startNodeApiServer,\n stubData,\n} from \"@osdk/shared.test\";\nimport { beforeAll, describe, expect, expectTypeOf, it, vi } from \"vitest\";\nimport type { Client } from \"../Client.js\";\nimport { createClient } from \"../createClient.js\";\nimport { createAttachmentUpload } from \"../object/AttachmentUpload.js\";\nimport { ActionValidationError } from \"./ActionValidationError.js\";\nimport { remapActionResponse } from \"./applyAction.js\";\n\ndescribe.each([\n \"https://stack.palantir.com\",\n \"https://stack.palantirCustom.com/foo/first/someStuff\",\n])(\"actions for %s\", (baseUrl) => {\n let client: Client;\n let apiServer: SetupServer;\n\n beforeAll(() => {\n const testSetup = startNodeApiServer(\n new LegacyFauxFoundry(baseUrl),\n createClient,\n );\n ({ client, apiServer } = testSetup);\n\n return () => {\n apiServer.close();\n };\n });\n\n it(\"conditionally returns the edits\", async () => {\n const result = await client(createOffice).applyAction({\n officeId: \"NYC\",\n address: \"123 Main Street\",\n capacity: 100,\n }, { $returnEdits: true });\n\n expectTypeOf<typeof result>().toEqualTypeOf<ActionEditResponse>();\n expect(result).toMatchObject(\n {\n \"addedLinks\": [],\n \"addedObjects\": [\n {\n \"objectType\": \"Office\",\n \"primaryKey\": \"NYC\",\n },\n ],\n \"deletedLinks\": [],\n \"deletedLinksCount\": 0,\n \"deletedObjects\": [],\n \"deletedObjectsCount\": 0,\n \"editedObjectTypes\": [\n \"Office\",\n ],\n \"modifiedObjects\": [],\n \"type\": \"edits\",\n },\n );\n\n // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression\n const undefinedResult = await client(createOffice).applyAction({\n officeId: \"NYC\",\n address: \"123 Main Street\",\n capacity: 100,\n });\n\n expectTypeOf<typeof undefinedResult>().toEqualTypeOf<undefined>();\n expect(undefinedResult).toBeUndefined();\n\n const clientCreateOffice = client(createOffice).batchApplyAction;\n const clientCreateOfficeMock: typeof clientCreateOffice = vi.fn();\n void clientCreateOfficeMock([{\n officeId: \"NYC\",\n address: \"123 Main Street\",\n capacity: 100,\n }], { $returnEdits: true });\n });\n\n it(\"returns validation directly on validateOnly mode\", async () => {\n const result = await client(moveOffice).applyAction({\n officeId: \"SEA\",\n newAddress: \"456 Pike Place\",\n // intentionally using a string to trigger validation errors\n newCapacity: \"40\" as unknown as number,\n }, {\n $validateOnly: true,\n });\n expectTypeOf<typeof result>().toEqualTypeOf<ActionValidationResponse>();\n\n expect(result).toMatchObject(\n {\n \"parameters\": {\n \"newCapacity\": {\n \"evaluatedConstraints\": [],\n \"required\": false,\n \"result\": \"INVALID\",\n },\n },\n \"result\": \"INVALID\",\n \"submissionCriteria\": [],\n },\n );\n });\n\n it(\"returns validation directly on validateOnly mode, with custom entry point in URL\", async () => {\n const result = await client(moveOffice).applyAction({\n officeId: \"SEA\",\n newAddress: \"456 Pike Place\",\n // intentionally using a string to trigger validation failure\n newCapacity: \"40\" as unknown as number,\n }, {\n $validateOnly: true,\n });\n expectTypeOf<typeof result>().toEqualTypeOf<ActionValidationResponse>();\n\n expect(result).toMatchObject(\n {\n \"parameters\": {\n \"newCapacity\": {\n \"evaluatedConstraints\": [],\n \"required\": false,\n \"result\": \"INVALID\",\n },\n },\n \"result\": \"INVALID\",\n \"submissionCriteria\": [],\n },\n );\n });\n\n it(\"throws on validation errors\", async () => {\n try {\n const result = await client(moveOffice).applyAction({\n officeId: \"SEA\",\n newAddress: \"456 Pike Place\",\n // intentionally using a string to trigger validation failure\n newCapacity: \"40\" as unknown as number,\n }, {\n $returnEdits: true,\n });\n expect.fail(\"Should not reach here\");\n } catch (e) {\n expect(e).toBeInstanceOf(ActionValidationError);\n expect((e as ActionValidationError).validation).toMatchObject(\n {\n \"parameters\": {\n \"newCapacity\": {\n \"evaluatedConstraints\": [],\n \"required\": false,\n \"result\": \"INVALID\",\n },\n },\n \"result\": \"INVALID\",\n \"submissionCriteria\": [],\n },\n );\n }\n });\n\n it(\"Accepts structs\", async () => {\n const clientBoundActionTakesStruct = client(createStructPerson).applyAction;\n type InferredParamType = Parameters<\n typeof clientBoundActionTakesStruct\n >[0];\n expectTypeOf<\n {\n name: string;\n address: { city: string; state: string; zipcode: number };\n }\n >()\n .toMatchTypeOf<\n InferredParamType\n >();\n\n const result = await client(createStructPerson).applyAction({\n name: \"testMan\",\n address: { city: \"NYC\", state: \"NY\", zipcode: 12345 },\n });\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\n });\n\n it(\"Accepts attachments\", async () => {\n const clientBoundActionTakesAttachment = client(\n actionTakesAttachment,\n ).applyAction;\n\n type InferredParamType = Parameters<\n typeof clientBoundActionTakesAttachment\n >[0];\n\n expectTypeOf<{ attachment: string | AttachmentUpload }>().toMatchTypeOf<\n InferredParamType\n >();\n\n const clientBoundBatchActionTakesAttachment = client(\n actionTakesAttachment,\n ).batchApplyAction;\n type InferredBatchParamType = Parameters<\n typeof clientBoundBatchActionTakesAttachment\n >[0];\n\n expectTypeOf<{\n attachment: string | AttachmentUpload;\n }[]>().toMatchTypeOf<InferredBatchParamType>();\n\n await apiServer.boundary(async () => {\n apiServer.use(MockOntologiesV2.Actions.apply(baseUrl, (info) => {\n return {\n validation: {\n result: \"VALID\",\n submissionCriteria: [],\n parameters: {},\n },\n };\n }));\n\n // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression\n const result = await client(actionTakesAttachment).applyAction({\n attachment: \"ri.some.rid\",\n });\n\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\n })();\n });\n\n it(\"Accepts attachment uploads\", async () => {\n const clientBoundActionTakesAttachment = client(\n actionTakesAttachment,\n ).applyAction;\n type InferredParamType = Parameters<\n typeof clientBoundActionTakesAttachment\n >[0];\n const clientBoundBatchActionTakesAttachment = client(\n actionTakesAttachment,\n ).batchApplyAction;\n type InferredBatchParamType = Parameters<\n typeof clientBoundBatchActionTakesAttachment\n >[0];\n\n expectTypeOf<\n {\n attachment:\n | string\n | AttachmentUpload\n | Blob & { readonly name: string };\n }\n >().toMatchTypeOf<\n InferredParamType\n >();\n expectTypeOf<\n {\n attachment:\n | string\n | AttachmentUpload\n | Blob & { readonly name: string };\n }[]\n >().toMatchTypeOf<\n InferredBatchParamType\n >();\n\n const blob = new Blob([JSON.stringify({ name: \"Hello World\" }, null, 2)]);\n\n const attachment = createAttachmentUpload(blob, \"file1.txt\");\n\n // Mimics the Web file API (https://developer.mozilla.org/en-US/docs/Web/API/File). The File constructor is only available in Node 19.2.0 and above\n const fileAttachment = Object.assign(blob, { name: \"file1.txt\" });\n\n // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression\n const result = await client(actionTakesAttachment).applyAction({\n attachment,\n });\n\n // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression\n const result2 = await client(actionTakesAttachment).applyAction({\n attachment: fileAttachment,\n });\n\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\n\n expectTypeOf<typeof result2>().toEqualTypeOf<undefined>();\n expect(result2).toBeUndefined();\n });\n\n it(\"Accepts media reference\", async () => {\n const clientBoundActionTakesMedia = client(\n actionTakesMedia,\n ).applyAction;\n type InferredParamType = Parameters<\n typeof clientBoundActionTakesMedia\n >[0];\n\n expectTypeOf<\n {\n media_reference: MediaReference;\n }\n >().toMatchTypeOf<\n InferredParamType\n >();\n\n const result = await client(actionTakesMedia).applyAction({\n media_reference:\n stubData.actionRequestMediaUpload.parameters.media_reference,\n });\n\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\n });\n\n it(\"Accepts geoshapes\", async () => {\n const clientBoundActionTakesMedia = client(\n addGeoshape,\n ).applyAction;\n type InferredParamType = Parameters<\n typeof clientBoundActionTakesMedia\n >[0];\n\n expectTypeOf<\n {\n geoshapeParam: GeoJSON.GeoJSON;\n geohashParam: GeoJSON.Point;\n }\n >().toMatchTypeOf<\n InferredParamType\n >();\n\n const result = await client(addGeoshape).applyAction({\n geoshapeParam: {\n type: \"Polygon\",\n coordinates: [\n [\n [\n -97.86567863752134,\n 38.418052586871624,\n ],\n [\n -97.86567863752134,\n 35.410223767370525,\n ],\n [\n -91.98573135442845,\n 35.410223767370525,\n ],\n [\n -91.98573135442845,\n 38.418052586871624,\n ],\n [\n -97.86567863752134,\n 38.418052586871624,\n ],\n ],\n ],\n },\n geohashParam: {\n type: \"Point\",\n coordinates: [-79.4382042508868, 40.917859676842255],\n },\n });\n\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\n });\n\n it(\"Accepts interfaces\", async () => {\n const clientBoundTakesInterface = client(\n deleteFooInterface,\n ).applyAction;\n\n type InferredParamType = Parameters<\n typeof clientBoundTakesInterface\n >[0];\n\n expectTypeOf<\n {\n deletedInterface: {\n $objectType: \"Employee\" | \"Person\";\n $primaryKey: string | number;\n };\n }\n >().toMatchTypeOf<\n InferredParamType\n >();\n\n const clientBoundBatchActionTakesInterface = client(\n deleteFooInterface,\n ).batchApplyAction;\n type InferredBatchParamType = Parameters<\n typeof clientBoundBatchActionTakesInterface\n >[0];\n\n expectTypeOf<{\n deletedInterface: {\n $objectType: \"Employee\" | \"Person\";\n $primaryKey: string | number;\n };\n }[]>().toMatchTypeOf<InferredBatchParamType>();\n\n const result = await client(deleteFooInterface).applyAction({\n deletedInterface: {\n $objectType: \"Employee\",\n $primaryKey: 50030,\n },\n });\n\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\n });\n it(\"Accepts interfaces if implementing object types unknown\", async () => {\n const clientBoundTakesInterface = client(\n deleteBarInterface,\n ).applyAction;\n\n type InferredParamType = Parameters<\n typeof clientBoundTakesInterface\n >[0];\n\n expectTypeOf<\n {\n deletedInterface: {\n $objectType: string;\n $primaryKey: string | number;\n };\n }\n >().toMatchTypeOf<\n InferredParamType\n >();\n\n const clientBoundBatchActionTakesInterface = client(\n deleteBarInterface,\n ).batchApplyAction;\n type InferredBatchParamType = Parameters<\n typeof clientBoundBatchActionTakesInterface\n >[0];\n\n expectTypeOf<{\n deletedInterface: {\n $objectType: string;\n $primaryKey: string | number;\n };\n }[]>().toMatchTypeOf<InferredBatchParamType>();\n });\n it(\"Accepts object type refs\", async () => {\n const clientBoundTakesObjectType = client(\n createFooInterface,\n ).applyAction;\n\n type InferredParamType = Parameters<\n typeof clientBoundTakesObjectType\n >[0];\n\n expectTypeOf<\n {\n createdInterface: string;\n }\n >().toMatchTypeOf<\n InferredParamType\n >();\n\n const clientBoundBatchActionTakesObjectType = client(\n createFooInterface,\n ).batchApplyAction;\n type InferredBatchParamType = Parameters<\n typeof clientBoundBatchActionTakesObjectType\n >[0];\n\n expectTypeOf<{\n createdInterface: string;\n }[]>().toMatchTypeOf<InferredBatchParamType>();\n\n const result = await client(createFooInterface).applyAction({\n createdInterface: Employee.apiName,\n });\n\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\n });\n it(\"conditionally returns edits in batch mode\", async () => {\n const result = await client(moveOffice).batchApplyAction([\n {\n officeId: \"SEA\",\n newAddress: \"456 Good Place\",\n newCapacity: 40,\n },\n {\n officeId: \"NYC\",\n newAddress: \"123 Main Street\",\n newCapacity: 80,\n },\n ], { $returnEdits: true });\n\n expect(result).toMatchObject(\n {\n \"addedLinks\": [],\n \"addedObjects\": [],\n \"deletedLinks\": [],\n \"deletedLinksCount\": 0,\n \"deletedObjects\": [],\n \"deletedObjectsCount\": 0,\n \"editedObjectTypes\": [\n \"Office\",\n ],\n \"modifiedObjects\": [\n {\n \"objectType\": \"Office\",\n \"primaryKey\": \"SEA\",\n },\n {\n \"objectType\": \"Office\",\n \"primaryKey\": \"NYC\",\n },\n ],\n \"type\": \"edits\",\n },\n );\n });\n\n it(\"nullable parameters work with nullish coalescing\", () => {\n const clientBoundAction = client(\n createOffice,\n ).applyAction;\n\n type InferredParamType = Parameters<\n typeof clientBoundAction\n >[0];\n\n expectTypeOf<\n {\n officeId: string;\n address: string | null;\n capacity: number | null;\n }\n >().toMatchTypeOf<\n InferredParamType\n >();\n\n const params: InferredParamType = { officeId: \"HQ\", address: null };\n\n const address: string = params.address ?? \"address\";\n expect(address).toBe(\"address\");\n });\n});\n\ndescribe(\"ActionResponse remapping\", () => {\n const actionResponse: SyncApplyActionResponseV2 = {\n edits: {\n type: \"edits\",\n edits: [{\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n \"type\": \"addObject\",\n }, {\n \"objectType\": \"Contractor\",\n \"primaryKey\": \"Contractor1\",\n \"type\": \"modifyObject\",\n }, {\n \"aSideObject\": { \"primaryKey\": \"key1\", \"objectType\": \"Office\" },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n \"bSideObject\": { \"primaryKey\": \"key2\", \"objectType\": \"Employee\" },\n \"type\": \"addLink\",\n }, {\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n \"type\": \"deleteObject\",\n }, {\n \"aSideObject\": { \"primaryKey\": \"key1\", \"objectType\": \"Office\" },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n \"bSideObject\": { \"primaryKey\": \"key2\", \"objectType\": \"Employee\" },\n \"type\": \"deleteLink\",\n }],\n deletedLinksCount: 0,\n deletedObjectsCount: 1,\n addedObjectCount: 1,\n modifiedObjectsCount: 1,\n addedLinksCount: 1,\n },\n };\n\n const batchActionResponse: BatchApplyActionResponseV2 = {\n edits: {\n type: \"edits\",\n edits: [{\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n \"type\": \"addObject\",\n }, {\n \"objectType\": \"Contractor\",\n \"primaryKey\": \"Contractor1\",\n \"type\": \"modifyObject\",\n }, {\n \"aSideObject\": { \"primaryKey\": \"key1\", \"objectType\": \"Office\" },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n \"bSideObject\": { \"primaryKey\": \"key2\", \"objectType\": \"Employee\" },\n \"type\": \"addLink\",\n }],\n deletedLinksCount: 0,\n deletedObjectsCount: 0,\n addedObjectCount: 1,\n modifiedObjectsCount: 1,\n addedLinksCount: 1,\n },\n };\n\n it(\"Correctly unpacks edits and editedObjectTypes\", () => {\n const remappedActionResponse = remapActionResponse(actionResponse);\n const remappedBatchActionResponse = remapActionResponse(\n batchActionResponse,\n );\n expect(remappedActionResponse).toMatchInlineSnapshot(`\n {\n \"addedLinks\": [\n {\n \"aSideObject\": {\n \"objectType\": \"Office\",\n \"primaryKey\": \"key1\",\n },\n \"bSideObject\": {\n \"objectType\": \"Employee\",\n \"primaryKey\": \"key2\",\n },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n },\n ],\n \"addedObjects\": [\n {\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n },\n ],\n \"deletedLinks\": [\n {\n \"aSideObject\": {\n \"objectType\": \"Office\",\n \"primaryKey\": \"key1\",\n },\n \"bSideObject\": {\n \"objectType\": \"Employee\",\n \"primaryKey\": \"key2\",\n },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n },\n ],\n \"deletedLinksCount\": 0,\n \"deletedObjects\": [\n {\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n },\n ],\n \"deletedObjectsCount\": 1,\n \"editedObjectTypes\": [\n \"Developer\",\n \"Contractor\",\n \"Office\",\n \"Employee\",\n ],\n \"modifiedObjects\": [\n {\n \"objectType\": \"Contractor\",\n \"primaryKey\": \"Contractor1\",\n },\n ],\n \"type\": \"edits\",\n }\n `);\n expect(remappedBatchActionResponse).toMatchInlineSnapshot(`\n {\n \"addedLinks\": [\n {\n \"aSideObject\": {\n \"objectType\": \"Office\",\n \"primaryKey\": \"key1\",\n },\n \"bSideObject\": {\n \"objectType\": \"Employee\",\n \"primaryKey\": \"key2\",\n },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n },\n ],\n \"addedObjects\": [\n {\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n },\n ],\n \"deletedLinks\": [],\n \"deletedLinksCount\": 0,\n \"deletedObjects\": [],\n \"deletedObjectsCount\": 0,\n \"editedObjectTypes\": [\n \"Developer\",\n \"Contractor\",\n \"Office\",\n \"Employee\",\n ],\n \"modifiedObjects\": [\n {\n \"objectType\": \"Contractor\",\n \"primaryKey\": \"Contractor1\",\n },\n ],\n \"type\": \"edits\",\n }\n `);\n });\n it(\"actions are enumerable\", async () => {\n const actions = Object.keys($Actions);\n expect(actions).toStrictEqual([\n \"actionTakesAttachment\",\n \"actionTakesMedia\",\n \"actionTakesObjectSet\",\n \"addGeoshape\",\n \"createFooInterface\",\n \"createOffice\",\n \"createOfficeAndEmployee\",\n \"createStructPerson\",\n \"deleteBarInterface\",\n \"deleteFooInterface\",\n \"editTodo\",\n \"moveOffice\",\n \"promoteEmployee\",\n \"promoteEmployeeObject\",\n ]);\n });\n});\n\nfunction wrapper<R>(fn: () => R): typeof fn {\n return () => fn();\n}\n\nasync function example() {\n await wrapper(async () =>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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EACF1E,EAAE,CAAC,wBAAwB,EAAE,YAAY;IACvC,MAAM2E,OAAO,GAAG1B,MAAM,CAAC2B,IAAI,CAAC/F,QAAQ,CAAC;IACrCiB,MAAM,CAAC6E,OAAO,CAAC,CAACE,aAAa,CAAC,CAC5B,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,yBAAyB,EACzB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,CACxB,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,SAASC,OAAOA,CAAItD,EAAW,EAAa;EAC1C,OAAO,MAAMA,EAAE,CAAC,CAAC;AACnB;AAEA,eAAeuD,OAAOA,CAAA,EAAG;EACvB,MAAMD,OAAO,CAAC,YAAYE,OAAO,CAACC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpD","ignoreList":[]}
|
|
@@ -29,6 +29,8 @@ export async function applyAction(client, action, parameters, options = {}) {
|
|
|
29
29
|
options: {
|
|
30
30
|
returnEdits: options?.$returnEdits ? "ALL" : "NONE"
|
|
31
31
|
}
|
|
32
|
+
}, {
|
|
33
|
+
branch: client.branch
|
|
32
34
|
});
|
|
33
35
|
const edits = response.edits;
|
|
34
36
|
return options?.$returnEdits ? edits?.type === "edits" ? remapActionResponse(response) : edits : undefined;
|
|
@@ -39,6 +41,8 @@ export async function applyAction(client, action, parameters, options = {}) {
|
|
|
39
41
|
mode: options?.$validateOnly ? "VALIDATE_ONLY" : "VALIDATE_AND_EXECUTE",
|
|
40
42
|
returnEdits: options?.$returnEdits ? "ALL_V2_WITH_DELETIONS" : "NONE"
|
|
41
43
|
}
|
|
44
|
+
}, {
|
|
45
|
+
branch: client.branch
|
|
42
46
|
});
|
|
43
47
|
if (options?.$validateOnly) {
|
|
44
48
|
return response.validation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyAction.js","names":["OntologiesV2","addUserAgentAndRequestContextHeaders","augmentRequestContext","toDataValue","ActionValidationError","applyAction","client","action","parameters","options","clientWithHeaders","finalMethodCall","Array","isArray","response","Actions","applyBatch","ontologyRid","apiName","requests","remapBatchActionParams","ontologyProvider","getActionDefinition","returnEdits","$returnEdits","edits","type","remapActionResponse","undefined","apply","remapActionParams","mode","$validateOnly","validation","result","params","actionMetadata","parameterMap","key","value","Object","entries","remappedParams","Promise","all","map","param","editResponses","remappedActionResponse","deletedLinksCount","deletedObjectsCount","addedLinks","deletedLinks","addedObjects","deletedObjects","modifiedObjects","editedObjectTypes","editedObjectTypesSet","Set","edit","osdkEdit","linkTypeApiNameAtoB","linkTypeApiNameBtoA","aSideObject","bSideObject","push","add","objectType","primaryKey","process","env","NODE_ENV","console","warn","JSON","stringify"],"sources":["applyAction.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 ActionEditResponse,\n ActionMetadata,\n ActionParam,\n ActionReturnTypeForOptions,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n CompileTimeMetadata as CompileTimeActionMetadata,\n DataValueClientToWire,\n} from \"@osdk/api\";\nimport type {\n BatchApplyActionResponseV2,\n DataValue,\n SyncApplyActionResponseV2,\n} from \"@osdk/foundry.ontologies\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\nimport { augmentRequestContext } from \"../util/augmentRequestContext.js\";\nimport type { NOOP } from \"../util/NOOP.js\";\nimport type { NullableProps } from \"../util/NullableProps.js\";\nimport type { PartialBy } from \"../util/partialBy.js\";\nimport { toDataValue } from \"../util/toDataValue.js\";\nimport { ActionValidationError } from \"./ActionValidationError.js\";\n\ntype BaseType<APD extends Pick<ActionMetadata.Parameter<any>, \"type\">> =\n APD[\"type\"] extends ActionMetadata.DataType.Object<infer TTargetType>\n ? ActionParam.ObjectType<TTargetType>\n : APD[\"type\"] extends ActionMetadata.DataType.ObjectSet<infer TTargetType>\n ? ActionParam.ObjectSetType<TTargetType>\n : APD[\"type\"] extends ActionMetadata.DataType.Struct<infer TStructType>\n ? ActionParam.StructType<TStructType>\n : APD[\"type\"] extends keyof DataValueClientToWire\n ? ActionParam.PrimitiveType<APD[\"type\"]>\n : never;\n\ntype MaybeArrayType<APD extends ActionMetadata.Parameter<any>> =\n APD[\"multiplicity\"] extends true ? Array<BaseType<APD>>\n : BaseType<APD>;\n\ntype NotOptionalParams<X extends ActionParametersDefinition> = {\n [P in keyof X]: MaybeArrayType<X[P]>;\n};\n\nexport type OsdkActionParameters<\n X extends ActionParametersDefinition,\n> = NullableProps<X> extends never ? NotOptionalParams<X>\n : PartialBy<NotOptionalParams<X>, NullableProps<X>>;\n\nexport type ActionSignatureFromDef<\n T extends ActionDefinition<any>,\n> = {\n applyAction:\n [CompileTimeActionMetadata<T>[\"signatures\"][\"applyAction\"]] extends [never]\n ? ActionSignature<CompileTimeActionMetadata<T>[\"parameters\"]>\n : CompileTimeActionMetadata<T>[\"signatures\"][\"applyAction\"];\n\n batchApplyAction:\n [CompileTimeActionMetadata<T>[\"signatures\"][\"batchApplyAction\"]] extends\n [never] ? BatchActionSignature<CompileTimeActionMetadata<T>[\"parameters\"]>\n : CompileTimeActionMetadata<T>[\"signatures\"][\"batchApplyAction\"];\n};\n\ntype ActionParametersDefinition = Record<\n any,\n ActionMetadata.Parameter<any>\n>;\n\nexport type ActionSignature<\n X extends Record<any, ActionMetadata.Parameter<any>>,\n> = <\n A extends NOOP<OsdkActionParameters<X>>,\n OP extends ApplyActionOptions,\n>(\n args: A,\n options?: OP,\n) => Promise<\n ActionReturnTypeForOptions<OP>\n>;\n\nexport type BatchActionSignature<\n X extends Record<any, ActionMetadata.Parameter<any>>,\n> = <\n A extends NOOP<OsdkActionParameters<X>>[],\n OP extends ApplyBatchActionOptions,\n>(\n args: A,\n options?: OP,\n) => Promise<\n ActionReturnTypeForOptions<OP>\n>;\n\nexport async function applyAction<\n AD extends ActionDefinition<any>,\n P extends\n | OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>\n | OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>[],\n Op extends P extends OsdkActionParameters<\n CompileTimeActionMetadata<AD>[\"parameters\"]\n >[] ? ApplyBatchActionOptions\n : ApplyActionOptions,\n>(\n client: MinimalClient,\n action: AD,\n parameters?: P,\n options: Op = {} as Op,\n): Promise<\n ActionReturnTypeForOptions<Op>\n> {\n const clientWithHeaders = addUserAgentAndRequestContextHeaders(\n augmentRequestContext(client, _ => ({ finalMethodCall: \"applyAction\" })),\n action,\n );\n if (Array.isArray(parameters)) {\n const response = await OntologiesV2.Actions.applyBatch(\n clientWithHeaders,\n await client.ontologyRid,\n action.apiName,\n {\n requests: parameters\n ? await remapBatchActionParams(\n parameters,\n client,\n await client.ontologyProvider.getActionDefinition(action.apiName),\n )\n : [],\n options: {\n returnEdits: options?.$returnEdits ? \"ALL\" : \"NONE\",\n },\n },\n );\n\n const edits = response.edits;\n return (options?.$returnEdits\n ? edits?.type === \"edits\" ? remapActionResponse(response) : edits\n : undefined) as ActionReturnTypeForOptions<Op>;\n } else {\n const response = await OntologiesV2.Actions.apply(\n clientWithHeaders,\n await client.ontologyRid,\n action.apiName,\n {\n parameters: await remapActionParams(\n parameters as OsdkActionParameters<\n CompileTimeActionMetadata<AD>[\"parameters\"]\n >,\n client,\n await client.ontologyProvider.getActionDefinition(action.apiName),\n ),\n options: {\n mode: (options as ApplyActionOptions)?.$validateOnly\n ? \"VALIDATE_ONLY\"\n : \"VALIDATE_AND_EXECUTE\",\n returnEdits: options\n ?.$returnEdits\n ? \"ALL_V2_WITH_DELETIONS\"\n : \"NONE\",\n },\n },\n );\n\n if ((options as ApplyActionOptions)?.$validateOnly) {\n return response.validation as ActionReturnTypeForOptions<Op>;\n }\n\n if (response.validation && response.validation?.result === \"INVALID\") {\n const validation = response.validation;\n throw new ActionValidationError(validation);\n }\n\n const edits = response.edits;\n return (options?.$returnEdits\n ? edits?.type === \"edits\" ? remapActionResponse(response) : edits\n : undefined) as ActionReturnTypeForOptions<Op>;\n }\n}\n\nasync function remapActionParams<AD extends ActionDefinition<any>>(\n params:\n | OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>\n | undefined,\n client: MinimalClient,\n actionMetadata: ActionMetadata,\n): Promise<Record<string, DataValue>> {\n if (params == null) {\n return {};\n }\n\n const parameterMap: { [parameterName: string]: unknown } = {};\n for (const [key, value] of Object.entries(params)) {\n parameterMap[key] = await toDataValue(value, client, actionMetadata);\n }\n\n return parameterMap;\n}\n\nasync function remapBatchActionParams<\n AD extends ActionDefinition<any>,\n>(\n params: OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>[],\n client: MinimalClient,\n actionMetadata: ActionMetadata,\n) {\n const remappedParams = await Promise.all(params.map(\n async param => {\n return {\n parameters: await remapActionParams<AD>(param, client, actionMetadata),\n };\n },\n ));\n\n return remappedParams;\n}\n\nexport function remapActionResponse(\n response: SyncApplyActionResponseV2 | BatchApplyActionResponseV2,\n): ActionEditResponse | undefined {\n const editResponses = response?.edits;\n if (editResponses?.type === \"edits\") {\n const remappedActionResponse: ActionEditResponse = {\n type: editResponses.type,\n deletedLinksCount: editResponses.deletedLinksCount,\n deletedObjectsCount: editResponses.deletedObjectsCount,\n addedLinks: [],\n deletedLinks: [],\n addedObjects: [],\n deletedObjects: [],\n modifiedObjects: [],\n editedObjectTypes: [],\n };\n\n const editedObjectTypesSet = new Set<string>();\n for (const edit of editResponses.edits) {\n if (edit.type === \"addLink\" || edit.type === \"deleteLink\") {\n const osdkEdit = {\n linkTypeApiNameAtoB: edit.linkTypeApiNameAtoB,\n linkTypeApiNameBtoA: edit.linkTypeApiNameBtoA,\n aSideObject: edit.aSideObject,\n bSideObject: edit.bSideObject,\n };\n edit.type === \"addLink\"\n ? remappedActionResponse.addedLinks.push(\n osdkEdit,\n )\n : remappedActionResponse.deletedLinks?.push(osdkEdit);\n editedObjectTypesSet.add(edit.aSideObject.objectType);\n editedObjectTypesSet.add(edit.bSideObject.objectType);\n } else if (\n edit.type === \"addObject\" || edit.type === \"deleteObject\"\n || edit.type === \"modifyObject\"\n ) {\n const osdkEdit = {\n objectType: edit.objectType,\n primaryKey: edit.primaryKey,\n };\n if (edit.type === \"addObject\") {\n remappedActionResponse.addedObjects.push(osdkEdit);\n } else if (edit.type === \"deleteObject\") {\n remappedActionResponse.deletedObjects?.push(osdkEdit);\n } else if (edit.type === \"modifyObject\") {\n remappedActionResponse.modifiedObjects.push(osdkEdit);\n }\n editedObjectTypesSet.add(edit.objectType);\n } else {\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line no-console\n console.warn(\n `Unexpected edit type: ${JSON.stringify(edit)}`,\n );\n }\n }\n }\n remappedActionResponse.editedObjectTypes = [...editedObjectTypesSet];\n return remappedActionResponse;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkBA,OAAO,KAAKA,YAAY,MAAM,0B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ACI,YAAY,EAAEa,IAAI,CAACL,QAAQ,CAAC;QACvDH,oBAAoB,CAACS,GAAG,CAACP,IAAI,CAACI,WAAW,CAACI,UAAU,CAAC;QACrDV,oBAAoB,CAACS,GAAG,CAACP,IAAI,CAACK,WAAW,CAACG,UAAU,CAAC;MACvD,CAAC,MAAM,IACLR,IAAI,CAACjC,IAAI,KAAK,WAAW,IAAIiC,IAAI,CAACjC,IAAI,KAAK,cAAc,IACtDiC,IAAI,CAACjC,IAAI,KAAK,cAAc,EAC/B;QACA,MAAMkC,QAAQ,GAAG;UACfO,UAAU,EAAER,IAAI,CAACQ,UAAU;UAC3BC,UAAU,EAAET,IAAI,CAACS;QACnB,CAAC;QACD,IAAIT,IAAI,CAACjC,IAAI,KAAK,WAAW,EAAE;UAC7BsB,sBAAsB,CAACK,YAAY,CAACY,IAAI,CAACL,QAAQ,CAAC;QACpD,CAAC,MAAM,IAAID,IAAI,CAACjC,IAAI,KAAK,cAAc,EAAE;UACvCsB,sBAAsB,CAACM,cAAc,EAAEW,IAAI,CAACL,QAAQ,CAAC;QACvD,CAAC,MAAM,IAAID,IAAI,CAACjC,IAAI,KAAK,cAAc,EAAE;UACvCsB,sBAAsB,CAACO,eAAe,CAACU,IAAI,CAACL,QAAQ,CAAC;QACvD;QACAH,oBAAoB,CAACS,GAAG,CAACP,IAAI,CAACQ,UAAU,CAAC;MAC3C,CAAC,MAAM;QACL,IAAIE,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;UACzC;UACAC,OAAO,CAACC,IAAI,CACV,yBAAyBC,IAAI,CAACC,SAAS,CAAChB,IAAI,CAAC,EAC/C,CAAC;QACH;MACF;IACF;IACAX,sBAAsB,CAACQ,iBAAiB,GAAG,CAAC,GAAGC,oBAAoB,CAAC;IACpE,OAAOT,sBAAsB;EAC/B;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"applyAction.js","names":["OntologiesV2","addUserAgentAndRequestContextHeaders","augmentRequestContext","toDataValue","ActionValidationError","applyAction","client","action","parameters","options","clientWithHeaders","finalMethodCall","Array","isArray","response","Actions","applyBatch","ontologyRid","apiName","requests","remapBatchActionParams","ontologyProvider","getActionDefinition","returnEdits","$returnEdits","branch","edits","type","remapActionResponse","undefined","apply","remapActionParams","mode","$validateOnly","validation","result","params","actionMetadata","parameterMap","key","value","Object","entries","remappedParams","Promise","all","map","param","editResponses","remappedActionResponse","deletedLinksCount","deletedObjectsCount","addedLinks","deletedLinks","addedObjects","deletedObjects","modifiedObjects","editedObjectTypes","editedObjectTypesSet","Set","edit","osdkEdit","linkTypeApiNameAtoB","linkTypeApiNameBtoA","aSideObject","bSideObject","push","add","objectType","primaryKey","process","env","NODE_ENV","console","warn","JSON","stringify"],"sources":["applyAction.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 ActionEditResponse,\n ActionMetadata,\n ActionParam,\n ActionReturnTypeForOptions,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n CompileTimeMetadata as CompileTimeActionMetadata,\n DataValueClientToWire,\n} from \"@osdk/api\";\nimport type {\n BatchApplyActionResponseV2,\n DataValue,\n SyncApplyActionResponseV2,\n} from \"@osdk/foundry.ontologies\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\nimport { augmentRequestContext } from \"../util/augmentRequestContext.js\";\nimport type { NOOP } from \"../util/NOOP.js\";\nimport type { NullableProps } from \"../util/NullableProps.js\";\nimport type { PartialBy } from \"../util/partialBy.js\";\nimport { toDataValue } from \"../util/toDataValue.js\";\nimport { ActionValidationError } from \"./ActionValidationError.js\";\n\ntype BaseType<APD extends Pick<ActionMetadata.Parameter<any>, \"type\">> =\n APD[\"type\"] extends ActionMetadata.DataType.Object<infer TTargetType>\n ? ActionParam.ObjectType<TTargetType>\n : APD[\"type\"] extends ActionMetadata.DataType.ObjectSet<infer TTargetType>\n ? ActionParam.ObjectSetType<TTargetType>\n : APD[\"type\"] extends ActionMetadata.DataType.Struct<infer TStructType>\n ? ActionParam.StructType<TStructType>\n : APD[\"type\"] extends keyof DataValueClientToWire\n ? ActionParam.PrimitiveType<APD[\"type\"]>\n : never;\n\ntype MaybeArrayType<APD extends ActionMetadata.Parameter<any>> =\n APD[\"multiplicity\"] extends true ? Array<BaseType<APD>>\n : BaseType<APD>;\n\ntype NotOptionalParams<X extends ActionParametersDefinition> = {\n [P in keyof X]: MaybeArrayType<X[P]>;\n};\n\nexport type OsdkActionParameters<\n X extends ActionParametersDefinition,\n> = NullableProps<X> extends never ? NotOptionalParams<X>\n : PartialBy<NotOptionalParams<X>, NullableProps<X>>;\n\nexport type ActionSignatureFromDef<\n T extends ActionDefinition<any>,\n> = {\n applyAction:\n [CompileTimeActionMetadata<T>[\"signatures\"][\"applyAction\"]] extends [never]\n ? ActionSignature<CompileTimeActionMetadata<T>[\"parameters\"]>\n : CompileTimeActionMetadata<T>[\"signatures\"][\"applyAction\"];\n\n batchApplyAction:\n [CompileTimeActionMetadata<T>[\"signatures\"][\"batchApplyAction\"]] extends\n [never] ? BatchActionSignature<CompileTimeActionMetadata<T>[\"parameters\"]>\n : CompileTimeActionMetadata<T>[\"signatures\"][\"batchApplyAction\"];\n};\n\ntype ActionParametersDefinition = Record<\n any,\n ActionMetadata.Parameter<any>\n>;\n\nexport type ActionSignature<\n X extends Record<any, ActionMetadata.Parameter<any>>,\n> = <\n A extends NOOP<OsdkActionParameters<X>>,\n OP extends ApplyActionOptions,\n>(\n args: A,\n options?: OP,\n) => Promise<\n ActionReturnTypeForOptions<OP>\n>;\n\nexport type BatchActionSignature<\n X extends Record<any, ActionMetadata.Parameter<any>>,\n> = <\n A extends NOOP<OsdkActionParameters<X>>[],\n OP extends ApplyBatchActionOptions,\n>(\n args: A,\n options?: OP,\n) => Promise<\n ActionReturnTypeForOptions<OP>\n>;\n\nexport async function applyAction<\n AD extends ActionDefinition<any>,\n P extends\n | OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>\n | OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>[],\n Op extends P extends OsdkActionParameters<\n CompileTimeActionMetadata<AD>[\"parameters\"]\n >[] ? ApplyBatchActionOptions\n : ApplyActionOptions,\n>(\n client: MinimalClient,\n action: AD,\n parameters?: P,\n options: Op = {} as Op,\n): Promise<\n ActionReturnTypeForOptions<Op>\n> {\n const clientWithHeaders = addUserAgentAndRequestContextHeaders(\n augmentRequestContext(client, _ => ({ finalMethodCall: \"applyAction\" })),\n action,\n );\n if (Array.isArray(parameters)) {\n const response = await OntologiesV2.Actions.applyBatch(\n clientWithHeaders,\n await client.ontologyRid,\n action.apiName,\n {\n requests: parameters\n ? await remapBatchActionParams(\n parameters,\n client,\n await client.ontologyProvider.getActionDefinition(action.apiName),\n )\n : [],\n options: {\n returnEdits: options?.$returnEdits ? \"ALL\" : \"NONE\",\n },\n },\n { branch: client.branch },\n );\n\n const edits = response.edits;\n return (options?.$returnEdits\n ? edits?.type === \"edits\" ? remapActionResponse(response) : edits\n : undefined) as ActionReturnTypeForOptions<Op>;\n } else {\n const response = await OntologiesV2.Actions.apply(\n clientWithHeaders,\n await client.ontologyRid,\n action.apiName,\n {\n parameters: await remapActionParams(\n parameters as OsdkActionParameters<\n CompileTimeActionMetadata<AD>[\"parameters\"]\n >,\n client,\n await client.ontologyProvider.getActionDefinition(action.apiName),\n ),\n options: {\n mode: (options as ApplyActionOptions)?.$validateOnly\n ? \"VALIDATE_ONLY\"\n : \"VALIDATE_AND_EXECUTE\",\n returnEdits: options\n ?.$returnEdits\n ? \"ALL_V2_WITH_DELETIONS\"\n : \"NONE\",\n },\n },\n { branch: client.branch },\n );\n\n if ((options as ApplyActionOptions)?.$validateOnly) {\n return response.validation as ActionReturnTypeForOptions<Op>;\n }\n\n if (response.validation && response.validation?.result === \"INVALID\") {\n const validation = response.validation;\n throw new ActionValidationError(validation);\n }\n\n const edits = response.edits;\n return (options?.$returnEdits\n ? edits?.type === \"edits\" ? remapActionResponse(response) : edits\n : undefined) as ActionReturnTypeForOptions<Op>;\n }\n}\n\nasync function remapActionParams<AD extends ActionDefinition<any>>(\n params:\n | OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>\n | undefined,\n client: MinimalClient,\n actionMetadata: ActionMetadata,\n): Promise<Record<string, DataValue>> {\n if (params == null) {\n return {};\n }\n\n const parameterMap: { [parameterName: string]: unknown } = {};\n for (const [key, value] of Object.entries(params)) {\n parameterMap[key] = await toDataValue(value, client, actionMetadata);\n }\n\n return parameterMap;\n}\n\nasync function remapBatchActionParams<\n AD extends ActionDefinition<any>,\n>(\n params: OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>[],\n client: MinimalClient,\n actionMetadata: ActionMetadata,\n) {\n const remappedParams = await Promise.all(params.map(\n async param => {\n return {\n parameters: await remapActionParams<AD>(param, client, actionMetadata),\n };\n },\n ));\n\n return remappedParams;\n}\n\nexport function remapActionResponse(\n response: SyncApplyActionResponseV2 | BatchApplyActionResponseV2,\n): ActionEditResponse | undefined {\n const editResponses = response?.edits;\n if (editResponses?.type === \"edits\") {\n const remappedActionResponse: ActionEditResponse = {\n type: editResponses.type,\n deletedLinksCount: editResponses.deletedLinksCount,\n deletedObjectsCount: editResponses.deletedObjectsCount,\n addedLinks: [],\n deletedLinks: [],\n addedObjects: [],\n deletedObjects: [],\n modifiedObjects: [],\n editedObjectTypes: [],\n };\n\n const editedObjectTypesSet = new Set<string>();\n for (const edit of editResponses.edits) {\n if (edit.type === \"addLink\" || edit.type === \"deleteLink\") {\n const osdkEdit = {\n linkTypeApiNameAtoB: edit.linkTypeApiNameAtoB,\n linkTypeApiNameBtoA: edit.linkTypeApiNameBtoA,\n aSideObject: edit.aSideObject,\n bSideObject: edit.bSideObject,\n };\n edit.type === \"addLink\"\n ? remappedActionResponse.addedLinks.push(\n osdkEdit,\n )\n : remappedActionResponse.deletedLinks?.push(osdkEdit);\n editedObjectTypesSet.add(edit.aSideObject.objectType);\n editedObjectTypesSet.add(edit.bSideObject.objectType);\n } else if (\n edit.type === \"addObject\" || edit.type === \"deleteObject\"\n || edit.type === \"modifyObject\"\n ) {\n const osdkEdit = {\n objectType: edit.objectType,\n primaryKey: edit.primaryKey,\n };\n if (edit.type === \"addObject\") {\n remappedActionResponse.addedObjects.push(osdkEdit);\n } else if (edit.type === \"deleteObject\") {\n remappedActionResponse.deletedObjects?.push(osdkEdit);\n } else if (edit.type === \"modifyObject\") {\n remappedActionResponse.modifiedObjects.push(osdkEdit);\n }\n editedObjectTypesSet.add(edit.objectType);\n } else {\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line no-console\n console.warn(\n `Unexpected edit type: ${JSON.stringify(edit)}`,\n );\n }\n }\n }\n remappedActionResponse.editedObjectTypes = [...editedObjectTypesSet];\n return remappedActionResponse;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkBA,OAAO,KAAKA,YAAY,MAAM,0BAA0B;AAExD,SAASC,oCAAoC,QAAQ,iDAAiD;AACtG,SAASC,qBAAqB,QAAQ,kCAAkC;AAIxE,SAASC,WAAW,QAAQ,wBAAwB;AACpD,SAASC,qBAAqB,QAAQ,4BAA4B;AAqElE,OAAO,eAAeC,WAAWA,CAU/BC,MAAqB,EACrBC,MAAU,EACVC,UAAc,EACdC,OAAW,GAAG,CAAC,CAAO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S,GAAG,CAACP,IAAI,CAACK,WAAW,CAACG,UAAU,CAAC;MACvD,CAAC,MAAM,IACLR,IAAI,CAACjC,IAAI,KAAK,WAAW,IAAIiC,IAAI,CAACjC,IAAI,KAAK,cAAc,IACtDiC,IAAI,CAACjC,IAAI,KAAK,cAAc,EAC/B;QACA,MAAMkC,QAAQ,GAAG;UACfO,UAAU,EAAER,IAAI,CAACQ,UAAU;UAC3BC,UAAU,EAAET,IAAI,CAACS;QACnB,CAAC;QACD,IAAIT,IAAI,CAACjC,IAAI,KAAK,WAAW,EAAE;UAC7BsB,sBAAsB,CAACK,YAAY,CAACY,IAAI,CAACL,QAAQ,CAAC;QACpD,CAAC,MAAM,IAAID,IAAI,CAACjC,IAAI,KAAK,cAAc,EAAE;UACvCsB,sBAAsB,CAACM,cAAc,EAAEW,IAAI,CAACL,QAAQ,CAAC;QACvD,CAAC,MAAM,IAAID,IAAI,CAACjC,IAAI,KAAK,cAAc,EAAE;UACvCsB,sBAAsB,CAACO,eAAe,CAACU,IAAI,CAACL,QAAQ,CAAC;QACvD;QACAH,oBAAoB,CAACS,GAAG,CAACP,IAAI,CAACQ,UAAU,CAAC;MAC3C,CAAC,MAAM;QACL,IAAIE,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;UACzC;UACAC,OAAO,CAACC,IAAI,CACV,yBAAyBC,IAAI,CAACC,SAAS,CAAChB,IAAI,CAAC,EAC/C,CAAC;QACH;MACF;IACF;IACAX,sBAAsB,CAACQ,iBAAiB,GAAG,CAAC,GAAGC,oBAAoB,CAAC;IACpE,OAAOT,sBAAsB;EAC/B;AACF","ignoreList":[]}
|
|
@@ -71,7 +71,8 @@ export function createClientInternal(objectSetFactory, transactionRid, flushEdit
|
|
|
71
71
|
...options,
|
|
72
72
|
logger: options?.logger ?? new MinimalLogger(),
|
|
73
73
|
transactionId: transactionRid,
|
|
74
|
-
flushEdits
|
|
74
|
+
flushEdits,
|
|
75
|
+
branch: options?.branch
|
|
75
76
|
}, fetchFn, objectSetFactory);
|
|
76
77
|
return createClientFromContext(clientCtx);
|
|
77
78
|
}
|