@osdk/client 2.2.0-beta.15 → 2.2.0-beta.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/build/browser/MinimalClientContext.js.map +1 -1
- package/build/browser/actions/actions.test.js +18 -2
- package/build/browser/actions/actions.test.js.map +1 -1
- package/build/browser/createClient.js.map +1 -1
- package/build/browser/createMinimalClient.js.map +1 -1
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.js +36 -13
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.test.js +133 -0
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -1
- package/build/browser/derivedProperties/derivedPropertyDefinitionFactory.js +94 -0
- package/build/browser/derivedProperties/derivedPropertyDefinitionFactory.js.map +1 -0
- package/build/browser/index.js.map +1 -1
- package/build/browser/intellisense.test.helpers/showsObjectPropertyJsdoc.js +25 -0
- package/build/browser/intellisense.test.helpers/showsObjectPropertyJsdoc.js.map +1 -0
- package/build/browser/intellisense.test.js +12 -0
- package/build/browser/intellisense.test.js.map +1 -1
- package/build/browser/logger/BaseLogger.js.map +1 -1
- package/build/browser/logger/BrowserLogger.js.map +1 -1
- package/build/browser/logger/MinimalLogger.js.map +1 -1
- package/build/browser/logger/TestLogger.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/BaseHolder.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/getDollarLink.js.map +1 -1
- package/build/browser/objectSet/ObjectSet.test.js +1 -6
- package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js +4 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
- package/build/browser/objectSet/createObjectSet.js +1 -1
- package/build/browser/objectSet/createObjectSet.js.map +1 -1
- package/build/browser/observable/internal/BulkObjectLoader.js.map +1 -1
- package/build/browser/observable/internal/ListQuery.js.map +1 -1
- package/build/browser/observable/internal/Query.js.map +1 -1
- package/build/browser/observable/internal/Store.js.map +1 -1
- package/build/browser/observable/internal/testUtils.js +2 -2
- package/build/browser/observable/internal/testUtils.js.map +1 -1
- package/build/browser/queries/applyQuery.js.map +1 -1
- package/build/browser/queries/queries.test.js.map +1 -1
- package/build/browser/tsserver.js.map +1 -1
- package/build/browser/util/UserAgent.js +1 -1
- package/build/browser/util/isPoint.js +20 -0
- package/build/browser/util/isPoint.js.map +1 -0
- package/build/browser/util/toDataValue.js +4 -0
- package/build/browser/util/toDataValue.js.map +1 -1
- package/build/cjs/{chunk-6KYD7ZWT.cjs → chunk-33GHS3X4.cjs} +141 -44
- package/build/cjs/chunk-33GHS3X4.cjs.map +1 -0
- package/build/cjs/{chunk-KAJABLKV.cjs → chunk-37QC7LR3.cjs} +14 -14
- package/build/cjs/{chunk-KAJABLKV.cjs.map → chunk-37QC7LR3.cjs.map} +1 -1
- package/build/cjs/index.cjs +55 -47
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +3 -4
- package/build/cjs/public/internal.cjs +8 -8
- package/build/cjs/public/internal.d.cts +10 -11
- package/build/cjs/public/unstable-do-not-use.cjs +8 -8
- package/build/esm/MinimalClientContext.js.map +1 -1
- package/build/esm/actions/actions.test.js +18 -2
- package/build/esm/actions/actions.test.js.map +1 -1
- package/build/esm/createClient.js.map +1 -1
- package/build/esm/createMinimalClient.js.map +1 -1
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.js +36 -13
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.test.js +133 -0
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -1
- package/build/esm/derivedProperties/derivedPropertyDefinitionFactory.js +94 -0
- package/build/esm/derivedProperties/derivedPropertyDefinitionFactory.js.map +1 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/intellisense.test.helpers/showsObjectPropertyJsdoc.js +25 -0
- package/build/esm/intellisense.test.helpers/showsObjectPropertyJsdoc.js.map +1 -0
- package/build/esm/intellisense.test.js +12 -0
- package/build/esm/intellisense.test.js.map +1 -1
- package/build/esm/logger/BaseLogger.js.map +1 -1
- package/build/esm/logger/BrowserLogger.js.map +1 -1
- package/build/esm/logger/MinimalLogger.js.map +1 -1
- package/build/esm/logger/TestLogger.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/BaseHolder.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/getDollarLink.js.map +1 -1
- package/build/esm/objectSet/ObjectSet.test.js +1 -6
- package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js +4 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
- package/build/esm/objectSet/createObjectSet.js +1 -1
- package/build/esm/objectSet/createObjectSet.js.map +1 -1
- package/build/esm/observable/internal/BulkObjectLoader.js.map +1 -1
- package/build/esm/observable/internal/ListQuery.js.map +1 -1
- package/build/esm/observable/internal/Query.js.map +1 -1
- package/build/esm/observable/internal/Store.js.map +1 -1
- package/build/esm/observable/internal/testUtils.js +2 -2
- package/build/esm/observable/internal/testUtils.js.map +1 -1
- package/build/esm/queries/applyQuery.js.map +1 -1
- package/build/esm/queries/queries.test.js.map +1 -1
- package/build/esm/tsserver.js.map +1 -1
- package/build/esm/util/UserAgent.js +1 -1
- package/build/esm/util/isPoint.js +20 -0
- package/build/esm/util/isPoint.js.map +1 -0
- package/build/esm/util/toDataValue.js +4 -0
- package/build/esm/util/toDataValue.js.map +1 -1
- package/build/types/MinimalClientContext.d.ts +1 -1
- package/build/types/MinimalClientContext.d.ts.map +1 -1
- package/build/types/createClient.d.ts +1 -1
- package/build/types/createClient.d.ts.map +1 -1
- package/build/types/derivedProperties/derivedPropertyDefinitionFactory.d.ts +1 -0
- package/build/types/derivedProperties/derivedPropertyDefinitionFactory.d.ts.map +1 -0
- package/build/types/index.d.ts +1 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/intellisense.test.helpers/showsObjectPropertyJsdoc.d.ts +1 -0
- package/build/types/intellisense.test.helpers/showsObjectPropertyJsdoc.d.ts.map +1 -0
- package/build/types/logger/BaseLogger.d.ts +7 -8
- package/build/types/logger/BaseLogger.d.ts.map +1 -1
- package/build/types/logger/BrowserLogger.d.ts +1 -2
- package/build/types/logger/BrowserLogger.d.ts.map +1 -1
- package/build/types/logger/MinimalLogger.d.ts +2 -2
- package/build/types/logger/MinimalLogger.d.ts.map +1 -1
- package/build/types/logger/TestLogger.d.ts +2 -2
- package/build/types/logger/TestLogger.d.ts.map +1 -1
- package/build/types/observable/internal/BulkObjectLoader.d.ts.map +1 -1
- package/build/types/observable/internal/ListQuery.d.ts.map +1 -1
- package/build/types/observable/internal/Query.d.ts +1 -1
- package/build/types/observable/internal/Query.d.ts.map +1 -1
- package/build/types/observable/internal/Store.d.ts.map +1 -1
- package/build/types/observable/internal/testUtils.d.ts +1 -2
- package/build/types/observable/internal/testUtils.d.ts.map +1 -1
- package/build/types/queries/applyQuery.d.ts +4 -2
- package/build/types/queries/applyQuery.d.ts.map +1 -1
- package/build/types/tsserver.d.ts +1 -1
- package/build/types/tsserver.d.ts.map +1 -1
- package/build/types/util/isPoint.d.ts +1 -0
- package/build/types/util/isPoint.d.ts.map +1 -0
- package/package.json +10 -10
- package/build/browser/logger/Logger.js +0 -2
- package/build/browser/logger/Logger.js.map +0 -1
- package/build/cjs/Logger-a5UcHtrk.d.cts +0 -19
- package/build/cjs/chunk-6KYD7ZWT.cjs.map +0 -1
- package/build/esm/logger/Logger.js +0 -2
- package/build/esm/logger/Logger.js.map +0 -1
- package/build/types/logger/Logger.d.ts +0 -17
- package/build/types/logger/Logger.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @osdk/client
|
|
2
2
|
|
|
3
|
+
## 2.2.0-beta.17
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b61e9f5: Make Query Map Types Optional
|
|
8
|
+
- abe4897: Removes support for boolean primary keys
|
|
9
|
+
- 5a12181: Quick fix for geohash params.
|
|
10
|
+
- 430dee3: JSdoc for object properties are generated
|
|
11
|
+
- 70b4464: Fix types for RDPs
|
|
12
|
+
- 791e655: Add support for geoshape and geohash action parameters.
|
|
13
|
+
- 751e5b3: Use client as peer dep in functions package.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [c6bee50]
|
|
18
|
+
- Updated dependencies [6eeb423]
|
|
19
|
+
- Updated dependencies [abe4897]
|
|
20
|
+
- Updated dependencies [70b4464]
|
|
21
|
+
- Updated dependencies [37f8e60]
|
|
22
|
+
- Updated dependencies [791e655]
|
|
23
|
+
- @osdk/api@2.2.0-beta.17
|
|
24
|
+
- @osdk/client.unstable@2.2.0-beta.17
|
|
25
|
+
- @osdk/generator-converters@2.2.0-beta.17
|
|
26
|
+
|
|
27
|
+
## 2.2.0-beta.16
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [395ae07]
|
|
32
|
+
- @osdk/client.unstable@2.2.0-beta.16
|
|
33
|
+
- @osdk/api@2.2.0-beta.16
|
|
34
|
+
- @osdk/generator-converters@2.2.0-beta.16
|
|
35
|
+
|
|
3
36
|
## 2.2.0-beta.15
|
|
4
37
|
|
|
5
38
|
### Minor Changes
|
|
@@ -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 {
|
|
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\n clientCacheKey: ClientCacheKey;\n requestContext: RequestContext;\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":[]}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { $Actions, actionTakesAttachment, actionTakesMedia, createFooInterface, createOffice, createStructPerson, deleteBarInterface, deleteFooInterface, Employee, moveOffice } from "@osdk/client.test.ontology";
|
|
17
|
+
import { $Actions, actionTakesAttachment, actionTakesMedia, addGeoshape, createFooInterface, createOffice, createStructPerson, deleteBarInterface, deleteFooInterface, Employee, moveOffice } from "@osdk/client.test.ontology";
|
|
18
18
|
import { LegacyFauxFoundry, MockOntologiesV2, startNodeApiServer, stubData } from "@osdk/shared.test";
|
|
19
19
|
import { beforeAll, describe, expect, expectTypeOf, it, vi } from "vitest";
|
|
20
20
|
import { createClient } from "../createClient.js";
|
|
@@ -222,6 +222,22 @@ describe.each(["https://stack.palantir.com", "https://stack.palantirCustom.com/f
|
|
|
222
222
|
expectTypeOf().toEqualTypeOf();
|
|
223
223
|
expect(result).toBeUndefined();
|
|
224
224
|
});
|
|
225
|
+
it("Accepts geoshapes", async () => {
|
|
226
|
+
client(addGeoshape).applyAction;
|
|
227
|
+
expectTypeOf().toMatchTypeOf();
|
|
228
|
+
const result = await client(addGeoshape).applyAction({
|
|
229
|
+
geoshapeParam: {
|
|
230
|
+
type: "Polygon",
|
|
231
|
+
coordinates: [[[-97.86567863752134, 38.418052586871624], [-97.86567863752134, 35.410223767370525], [-91.98573135442845, 35.410223767370525], [-91.98573135442845, 38.418052586871624], [-97.86567863752134, 38.418052586871624]]]
|
|
232
|
+
},
|
|
233
|
+
geohashParam: {
|
|
234
|
+
type: "Point",
|
|
235
|
+
coordinates: [-79.4382042508868, 40.917859676842255]
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
expectTypeOf().toEqualTypeOf();
|
|
239
|
+
expect(result).toBeUndefined();
|
|
240
|
+
});
|
|
225
241
|
it("Accepts interfaces", async () => {
|
|
226
242
|
client(deleteFooInterface).applyAction;
|
|
227
243
|
expectTypeOf().toMatchTypeOf();
|
|
@@ -469,7 +485,7 @@ describe("ActionResponse remapping", () => {
|
|
|
469
485
|
});
|
|
470
486
|
it("actions are enumerable", async () => {
|
|
471
487
|
const actions = Object.keys($Actions);
|
|
472
|
-
expect(actions).toStrictEqual(["actionTakesAttachment", "actionTakesMedia", "actionTakesObjectSet", "createFooInterface", "createOffice", "createOfficeAndEmployee", "createStructPerson", "deleteBarInterface", "deleteFooInterface", "editTodo", "moveOffice", "promoteEmployee", "promoteEmployeeObject"]);
|
|
488
|
+
expect(actions).toStrictEqual(["actionTakesAttachment", "actionTakesMedia", "actionTakesObjectSet", "addGeoshape", "createFooInterface", "createOffice", "createOfficeAndEmployee", "createStructPerson", "deleteBarInterface", "deleteFooInterface", "editTodo", "moveOffice", "promoteEmployee", "promoteEmployeeObject"]);
|
|
473
489
|
});
|
|
474
490
|
});
|
|
475
491
|
function wrapper(fn) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.test.js","names":["$Actions","actionTakesAttachment","actionTakesMedia","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","deletedInterface","$objectType","$primaryKey","createdInterface","apiName","actionResponse","edits","type","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 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 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 \"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;AACA;AACA;AACA;AACA;AACA;;AAQA,SACEA,QAAQ,EACRC,qBAAqB,EACrBC,gBAAgB,EAChBC,kBAAkB,EAClBC,YAAY,EACZC,kBAAkB,EAClBC,kBAAkB,EAClBC,kBAAkB,EAClBC,QAAQ,EACRC,UAAU,QACL,4BAA4B;AAMnC,SACEC,iBAAiB,EACjBC,gBAAgB,EAChBC,kBAAkB,EAClBC,QAAQ,QACH,mBAAmB;AAC1B,SAASC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAEC,EAAE,EAAEC,EAAE,QAAQ,QAAQ;AAE1E,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,sBAAsB,QAAQ,+BAA+B;AACtE,SAASC,qBAAqB,QAAQ,4BAA4B;AAClE,SAASC,mBAAmB,QAAQ,kBAAkB;AAEtDR,QAAQ,CAACS,IAAI,CAAC,CACZ,4BAA4B,EAC5B,sDAAsD,CACvD,CAAC,CAAC,gBAAgB,EAAGC,OAAO,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,oBAAoB,EAAE,CAAC;MACvBC,eAAe,EAAE;IACnB;EACF,CAAC;EAEDlE,EAAE,CAAC,+CAA+C,EAAE,MAAM;IACxD,MAAMoE,sBAAsB,GAAG/D,mBAAmB,CAACsD,cAAc,CAAC;IAClE,MAAMU,2BAA2B,GAAGhE,mBAAmB,CACrD8D,mBACF,CAAC;IACDrE,MAAM,CAACsE,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;IACFxE,MAAM,CAACuE,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;EACFtE,EAAE,CAAC,wBAAwB,EAAE,YAAY;IACvC,MAAMuE,OAAO,GAAGtB,MAAM,CAACuB,IAAI,CAAC1F,QAAQ,CAAC;IACrCgB,MAAM,CAACyE,OAAO,CAAC,CAACE,aAAa,CAAC,CAC5B,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,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,CAAIlD,EAAW,EAAa;EAC1C,OAAO,MAAMA,EAAE,CAAC,CAAC;AACnB;AAEA,eAAemD,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","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;AACA;AACA;AACA;AACA;AACA;;AAQA,SACEA,QAAQ,EACRC,qBAAqB,EACrBC,gBAAgB,EAChBC,WAAW,EACXC,kBAAkB,EAClBC,YAAY,EACZC,kBAAkB,EAClBC,kBAAkB,EAClBC,kBAAkB,EAClBC,QAAQ,EACRC,UAAU,QACL,4BAA4B;AAMnC,SACEC,iBAAiB,EACjBC,gBAAgB,EAChBC,kBAAkB,EAClBC,QAAQ,QACH,mBAAmB;AAC1B,SAASC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAEC,EAAE,EAAEC,EAAE,QAAQ,QAAQ;A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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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createClient.js","names":["__EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference","__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid","__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid","__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks","OntologiesV2","symbolClientContext","oldSymbolClientContext","createBulkLinksAsyncIterFactory","applyAction","additionalContext","createMinimalClient","fetchMetadataInternal","MinimalLogger","fetchPage","fetchSingle","createObjectSet","applyQuery","ActionInvoker","constructor","clientCtx","actionDef","bind","undefined","batchApplyAction","QueryInvoker","queryDef","executeFunction","createClientInternal","objectSetFactory","baseUrl","ontologyRid","tokenProvider","options","fetchFn","fetch","startsWith","Error","then","logger","fetchMetadata","client","Object","defineProperties","o","type","name","getBulkLinks","fetchOneByRid","objectType","rid","createWithRid","createMediaReference","args","data","fileName","propertyType","MediaReferenceProperties","upload","apiName","mediaItemPath","preview","fetchPageByRid","objectOrInterfaceType","rids","value","createClient"],"sources":["createClient.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n FetchPageArgs,\n FilteredPropertyKeys,\n InterfaceDefinition,\n NullabilityAdherence,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n PropertyKeys,\n QueryDefinition,\n SelectArg,\n} from \"@osdk/api\";\nimport type {\n Experiment,\n ExperimentFns,\n MinimalObjectSet,\n} from \"@osdk/api/unstable\";\nimport {\n __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks,\n} from \"@osdk/api/unstable\";\nimport type { ObjectSet as WireObjectSet } from \"@osdk/foundry.ontologies\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport { symbolClientContext as oldSymbolClientContext } from \"@osdk/shared.client\";\nimport { createBulkLinksAsyncIterFactory } from \"./__unstable/createBulkLinksAsyncIterFactory.js\";\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.js\";\nimport { applyAction } from \"./actions/applyAction.js\";\nimport { additionalContext, type Client } from \"./Client.js\";\nimport { createMinimalClient } from \"./createMinimalClient.js\";\nimport { fetchMetadataInternal } from \"./fetchMetadata.js\";\nimport { type Logger } from \"./logger/Logger.js\";\nimport { MinimalLogger } from \"./logger/MinimalLogger.js\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport { fetchPage } from \"./object/fetchPage.js\";\nimport { fetchSingle } from \"./object/fetchSingle.js\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport type { ObjectSetFactory } from \"./objectSet/ObjectSetFactory.js\";\nimport { applyQuery } from \"./queries/applyQuery.js\";\nimport type { QuerySignatureFromDef } from \"./queries/types.js\";\n\n// We import it this way to keep compatible with CJS. If we referenced the\n// value of `symbolClientContext` directly, then we would have to a dynamic import\n// in `createClientInternal` which would make it async and a break.\n// Since this is just a string in `@osdk/shared.client2` instead of a symbol,\n// we can safely perform this trick.\ntype newSymbolClientContext =\n // eslint-disable-next-line @typescript-eslint/consistent-type-imports\n typeof import(\"@osdk/shared.client2\").symbolClientContext;\n\nclass ActionInvoker<Q extends ActionDefinition<any>>\n implements ActionSignatureFromDef<Q>\n{\n constructor(\n clientCtx: MinimalClient,\n actionDef: ActionDefinition<any>,\n ) {\n // We type the property as a generic function as binding `applyAction`\n // doesn't return a type thats all that useful anyway\n // The implements covers us for the most part here as this exact type doesn't\n // escape this file\n this.applyAction = applyAction.bind(undefined, clientCtx, actionDef);\n this.batchApplyAction = applyAction.bind(undefined, clientCtx, actionDef);\n }\n\n applyAction: (...args: any[]) => any;\n batchApplyAction: (...args: any[]) => any;\n}\n\nclass QueryInvoker<Q extends QueryDefinition<any>>\n implements QuerySignatureFromDef<Q>\n{\n constructor(\n clientCtx: MinimalClient,\n queryDef: QueryDefinition<any>,\n ) {\n this.executeFunction = applyQuery.bind(undefined, clientCtx, queryDef);\n }\n\n executeFunction: (...args: any[]) => any;\n}\n\n/** @internal */\nexport function createClientInternal(\n objectSetFactory: ObjectSetFactory<any, any>, // first so i can bind\n baseUrl: string,\n ontologyRid: string | Promise<string>,\n tokenProvider: () => Promise<string>,\n options: { logger?: Logger } | undefined = undefined,\n fetchFn: typeof globalThis.fetch = fetch,\n): Client {\n if (typeof ontologyRid === \"string\") {\n if (!ontologyRid.startsWith(\"ri.\")) {\n throw new Error(\"Invalid ontology RID\");\n }\n } else {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n ontologyRid.then((ontologyRid) => {\n if (!ontologyRid.startsWith(\"ri.\")) {\n // FIXME this promise is not await so this just shows up as an unhandled promise rejection\n throw new Error(\"Invalid ontology RID\");\n }\n });\n }\n\n const clientCtx: MinimalClient = createMinimalClient(\n { ontologyRid },\n baseUrl,\n tokenProvider,\n { ...options, logger: options?.logger ?? new MinimalLogger() },\n fetchFn,\n objectSetFactory,\n );\n\n function clientFn<\n T extends\n | ObjectOrInterfaceDefinition\n | ActionDefinition<any>\n | QueryDefinition<any>\n | Experiment<\"2.0.8\">\n | Experiment<\"2.1.0\">,\n >(o: T): T extends ObjectTypeDefinition ? ObjectSet<T>\n : T extends InterfaceDefinition ? MinimalObjectSet<T>\n : T extends ActionDefinition<any> ? ActionSignatureFromDef<T>\n : T extends QueryDefinition<any> ? QuerySignatureFromDef<T>\n : T extends Experiment<\"2.0.8\"> | Experiment<\"2.1.0\">\n ? { invoke: ExperimentFns<T> }\n : never\n {\n if (o.type === \"object\" || o.type === \"interface\") {\n return objectSetFactory(o, clientCtx) as any;\n } else if (o.type === \"action\") {\n return new ActionInvoker(\n clientCtx,\n o,\n ) as (T extends ActionDefinition<any>\n // first `as` to the action definition for our \"real\" typecheck\n ? ActionSignatureFromDef<T>\n : never) as any; // then as any for dealing with the conditional return value\n } else if (o.type === \"query\") {\n return new QueryInvoker(\n clientCtx,\n o,\n ) as (T extends QueryDefinition<any> ? QuerySignatureFromDef<T>\n : never) as any;\n } else if (o.type === \"experiment\") {\n switch (o.name) {\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks.name:\n return {\n getBulkLinks: createBulkLinksAsyncIterFactory(\n clientCtx,\n ),\n } as any;\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid.name:\n return {\n fetchOneByRid: async <\n Q extends ObjectTypeDefinition,\n const L extends PropertyKeys<Q>,\n const R extends boolean,\n const S extends false | \"throw\" = NullabilityAdherence.Default,\n >(\n objectType: Q,\n rid: string,\n options: SelectArg<Q, L, R, S>,\n ) => {\n return await fetchSingle(\n clientCtx,\n objectType,\n options,\n createWithRid(\n [rid],\n ),\n ) as Osdk<Q>;\n },\n } as any;\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference.name:\n return {\n createMediaReference: async <\n Q extends ObjectTypeDefinition,\n const L extends FilteredPropertyKeys<Q, \"mediaReference\">,\n >(args: {\n data: Blob;\n fileName: string;\n objectType: Q;\n propertyType: L;\n }) => {\n const { data, fileName, objectType, propertyType } = args;\n return await OntologiesV2.MediaReferenceProperties.upload(\n clientCtx,\n await clientCtx.ontologyRid,\n objectType.apiName,\n propertyType as string,\n data,\n {\n mediaItemPath: fileName,\n preview: true,\n },\n );\n },\n } as any;\n\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid.name:\n return {\n fetchPageByRid: async <\n Q extends ObjectOrInterfaceDefinition,\n const L extends PropertyKeys<Q>,\n const R extends boolean,\n const S extends false | \"throw\" = NullabilityAdherence.Default,\n >(\n objectOrInterfaceType: Q,\n rids: string[],\n options: FetchPageArgs<Q, L, R, any, S> = {},\n ) => {\n return await fetchPage(\n clientCtx,\n objectOrInterfaceType,\n options,\n createWithRid(rids),\n );\n },\n } as any;\n }\n\n throw new Error(\"not implemented\");\n } else {\n throw new Error(\"not implemented\");\n }\n }\n\n const fetchMetadata = fetchMetadataInternal.bind(\n undefined,\n clientCtx,\n );\n\n const symbolClientContext: newSymbolClientContext = \"__osdkClientContext\";\n\n const client: Client = Object.defineProperties<Client>(\n clientFn as Client,\n {\n [oldSymbolClientContext]: {\n value: clientCtx,\n },\n [symbolClientContext]: {\n value: clientCtx,\n },\n [additionalContext]: {\n value: clientCtx,\n },\n fetchMetadata: {\n value: fetchMetadata,\n },\n } satisfies Record<keyof Client, PropertyDescriptor>,\n );\n\n return client;\n}\n\nexport const createClient: (\n baseUrl: string,\n ontologyRid: string | Promise<string>,\n tokenProvider: () => Promise<string>,\n options?: {\n logger?: Logger;\n } | undefined,\n fetchFn?: typeof fetch | undefined,\n) => Client = createClientInternal.bind(\n undefined,\n createObjectSet,\n);\n\nfunction createWithRid(\n rids: string[],\n) {\n const withRid: WireObjectSet = {\n type: \"static\",\n \"objects\": rids,\n };\n\n return withRid;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAqBA,SACEA,uDAAuD,EACvDC,gDAAgD,EAChDC,iDAAiD,EACjDC,+CAA+C,QAC1C,oBAAoB;AAE3B,OAAO,KAAKC,YAAY,MAAM,0BAA0B;AACxD,SAASC,mBAAmB,IAAIC,sBAAsB,QAAQ,qBAAqB;AACnF,SAASC,+BAA+B,QAAQ,iDAAiD;AAEjG,SAASC,WAAW,QAAQ,0BAA0B;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AASmC,aAAaA,CACpBa,IAAc,EACd;EAMA,OAL+B;IAC7BnB,IAAI,EAAE,QAAQ;IACd,SAAS,EAAEmB;EACb,CAAC;AAGH","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"createClient.js","names":["__EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference","__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid","__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid","__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks","OntologiesV2","symbolClientContext","oldSymbolClientContext","createBulkLinksAsyncIterFactory","applyAction","additionalContext","createMinimalClient","fetchMetadataInternal","MinimalLogger","fetchPage","fetchSingle","createObjectSet","applyQuery","ActionInvoker","constructor","clientCtx","actionDef","bind","undefined","batchApplyAction","QueryInvoker","queryDef","executeFunction","createClientInternal","objectSetFactory","baseUrl","ontologyRid","tokenProvider","options","fetchFn","fetch","startsWith","Error","then","logger","fetchMetadata","client","Object","defineProperties","o","type","name","getBulkLinks","fetchOneByRid","objectType","rid","createWithRid","createMediaReference","args","data","fileName","propertyType","MediaReferenceProperties","upload","apiName","mediaItemPath","preview","fetchPageByRid","objectOrInterfaceType","rids","value","createClient"],"sources":["createClient.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n FetchPageArgs,\n FilteredPropertyKeys,\n InterfaceDefinition,\n Logger,\n NullabilityAdherence,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n PropertyKeys,\n QueryDefinition,\n SelectArg,\n} from \"@osdk/api\";\nimport type {\n Experiment,\n ExperimentFns,\n MinimalObjectSet,\n} from \"@osdk/api/unstable\";\nimport {\n __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks,\n} from \"@osdk/api/unstable\";\nimport type { ObjectSet as WireObjectSet } from \"@osdk/foundry.ontologies\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport { symbolClientContext as oldSymbolClientContext } from \"@osdk/shared.client\";\nimport { createBulkLinksAsyncIterFactory } from \"./__unstable/createBulkLinksAsyncIterFactory.js\";\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.js\";\nimport { applyAction } from \"./actions/applyAction.js\";\nimport { additionalContext, type Client } from \"./Client.js\";\nimport { createMinimalClient } from \"./createMinimalClient.js\";\nimport { fetchMetadataInternal } from \"./fetchMetadata.js\";\nimport { MinimalLogger } from \"./logger/MinimalLogger.js\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport { fetchPage } from \"./object/fetchPage.js\";\nimport { fetchSingle } from \"./object/fetchSingle.js\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport type { ObjectSetFactory } from \"./objectSet/ObjectSetFactory.js\";\nimport { applyQuery } from \"./queries/applyQuery.js\";\nimport type { QuerySignatureFromDef } from \"./queries/types.js\";\n\n// We import it this way to keep compatible with CJS. If we referenced the\n// value of `symbolClientContext` directly, then we would have to a dynamic import\n// in `createClientInternal` which would make it async and a break.\n// Since this is just a string in `@osdk/shared.client2` instead of a symbol,\n// we can safely perform this trick.\ntype newSymbolClientContext =\n // eslint-disable-next-line @typescript-eslint/consistent-type-imports\n typeof import(\"@osdk/shared.client2\").symbolClientContext;\n\nclass ActionInvoker<Q extends ActionDefinition<any>>\n implements ActionSignatureFromDef<Q>\n{\n constructor(\n clientCtx: MinimalClient,\n actionDef: ActionDefinition<any>,\n ) {\n // We type the property as a generic function as binding `applyAction`\n // doesn't return a type thats all that useful anyway\n // The implements covers us for the most part here as this exact type doesn't\n // escape this file\n this.applyAction = applyAction.bind(undefined, clientCtx, actionDef);\n this.batchApplyAction = applyAction.bind(undefined, clientCtx, actionDef);\n }\n\n applyAction: (...args: any[]) => any;\n batchApplyAction: (...args: any[]) => any;\n}\n\nclass QueryInvoker<Q extends QueryDefinition<any>>\n implements QuerySignatureFromDef<Q>\n{\n constructor(\n clientCtx: MinimalClient,\n queryDef: QueryDefinition<any>,\n ) {\n this.executeFunction = applyQuery.bind(undefined, clientCtx, queryDef);\n }\n\n executeFunction: (...args: any[]) => any;\n}\n\n/** @internal */\nexport function createClientInternal(\n objectSetFactory: ObjectSetFactory<any, any>, // first so i can bind\n baseUrl: string,\n ontologyRid: string | Promise<string>,\n tokenProvider: () => Promise<string>,\n options: { logger?: Logger } | undefined = undefined,\n fetchFn: typeof globalThis.fetch = fetch,\n): Client {\n if (typeof ontologyRid === \"string\") {\n if (!ontologyRid.startsWith(\"ri.\")) {\n throw new Error(\"Invalid ontology RID\");\n }\n } else {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n ontologyRid.then((ontologyRid) => {\n if (!ontologyRid.startsWith(\"ri.\")) {\n // FIXME this promise is not await so this just shows up as an unhandled promise rejection\n throw new Error(\"Invalid ontology RID\");\n }\n });\n }\n\n const clientCtx: MinimalClient = createMinimalClient(\n { ontologyRid },\n baseUrl,\n tokenProvider,\n { ...options, logger: options?.logger ?? new MinimalLogger() },\n fetchFn,\n objectSetFactory,\n );\n\n function clientFn<\n T extends\n | ObjectOrInterfaceDefinition\n | ActionDefinition<any>\n | QueryDefinition<any>\n | Experiment<\"2.0.8\">\n | Experiment<\"2.1.0\">,\n >(o: T): T extends ObjectTypeDefinition ? ObjectSet<T>\n : T extends InterfaceDefinition ? MinimalObjectSet<T>\n : T extends ActionDefinition<any> ? ActionSignatureFromDef<T>\n : T extends QueryDefinition<any> ? QuerySignatureFromDef<T>\n : T extends Experiment<\"2.0.8\"> | Experiment<\"2.1.0\">\n ? { invoke: ExperimentFns<T> }\n : never\n {\n if (o.type === \"object\" || o.type === \"interface\") {\n return objectSetFactory(o, clientCtx) as any;\n } else if (o.type === \"action\") {\n return new ActionInvoker(\n clientCtx,\n o,\n ) as (T extends ActionDefinition<any>\n // first `as` to the action definition for our \"real\" typecheck\n ? ActionSignatureFromDef<T>\n : never) as any; // then as any for dealing with the conditional return value\n } else if (o.type === \"query\") {\n return new QueryInvoker(\n clientCtx,\n o,\n ) as (T extends QueryDefinition<any> ? QuerySignatureFromDef<T>\n : never) as any;\n } else if (o.type === \"experiment\") {\n switch (o.name) {\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks.name:\n return {\n getBulkLinks: createBulkLinksAsyncIterFactory(\n clientCtx,\n ),\n } as any;\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid.name:\n return {\n fetchOneByRid: async <\n Q extends ObjectTypeDefinition,\n const L extends PropertyKeys<Q>,\n const R extends boolean,\n const S extends false | \"throw\" = NullabilityAdherence.Default,\n >(\n objectType: Q,\n rid: string,\n options: SelectArg<Q, L, R, S>,\n ) => {\n return await fetchSingle(\n clientCtx,\n objectType,\n options,\n createWithRid(\n [rid],\n ),\n ) as Osdk<Q>;\n },\n } as any;\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference.name:\n return {\n createMediaReference: async <\n Q extends ObjectTypeDefinition,\n const L extends FilteredPropertyKeys<Q, \"mediaReference\">,\n >(args: {\n data: Blob;\n fileName: string;\n objectType: Q;\n propertyType: L;\n }) => {\n const { data, fileName, objectType, propertyType } = args;\n return await OntologiesV2.MediaReferenceProperties.upload(\n clientCtx,\n await clientCtx.ontologyRid,\n objectType.apiName,\n propertyType as string,\n data,\n {\n mediaItemPath: fileName,\n preview: true,\n },\n );\n },\n } as any;\n\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid.name:\n return {\n fetchPageByRid: async <\n Q extends ObjectOrInterfaceDefinition,\n const L extends PropertyKeys<Q>,\n const R extends boolean,\n const S extends false | \"throw\" = NullabilityAdherence.Default,\n >(\n objectOrInterfaceType: Q,\n rids: string[],\n options: FetchPageArgs<Q, L, R, any, S> = {},\n ) => {\n return await fetchPage(\n clientCtx,\n objectOrInterfaceType,\n options,\n createWithRid(rids),\n );\n },\n } as any;\n }\n\n throw new Error(\"not implemented\");\n } else {\n throw new Error(\"not implemented\");\n }\n }\n\n const fetchMetadata = fetchMetadataInternal.bind(\n undefined,\n clientCtx,\n );\n\n const symbolClientContext: newSymbolClientContext = \"__osdkClientContext\";\n\n const client: Client = Object.defineProperties<Client>(\n clientFn as Client,\n {\n [oldSymbolClientContext]: {\n value: clientCtx,\n },\n [symbolClientContext]: {\n value: clientCtx,\n },\n [additionalContext]: {\n value: clientCtx,\n },\n fetchMetadata: {\n value: fetchMetadata,\n },\n } satisfies Record<keyof Client, PropertyDescriptor>,\n );\n\n return client;\n}\n\nexport const createClient: (\n baseUrl: string,\n ontologyRid: string | Promise<string>,\n tokenProvider: () => Promise<string>,\n options?: {\n logger?: Logger;\n } | undefined,\n fetchFn?: typeof fetch | undefined,\n) => Client = createClientInternal.bind(\n undefined,\n createObjectSet,\n);\n\nfunction createWithRid(\n rids: string[],\n) {\n const withRid: WireObjectSet = {\n type: \"static\",\n \"objects\": rids,\n };\n\n return withRid;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAsBA,SACEA,uDAAuD,EACvDC,gDAAgD,EAChDC,iDAAiD,EACjDC,+CAA+C,QAC1C,oBAAoB;AAE3B,OAAO,KAAKC,YAAY,MAAM,0BAA0B;AACxD,SAASC,mBAAmB,IAAIC,sBAAsB,QAAQ,qBAAqB;AACnF,SAASC,+BAA+B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oB,CAACN,IAAI,CACrCC,SAAS,EACTP,eACF,CAAC;AAED,SAASmC,aAAaA,CACpBa,IAAc,EACd;EAMA,OAL+B;IAC7BnB,IAAI,EAAE,QAAQ;IACd,SAAS,EAAEmB;EACb,CAAC;AAGH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createMinimalClient.js","names":["createSharedClientContext","convertWireToOsdkObjects","convertWireToOsdkObjects2","createObjectSet","createStandardOntologyProviderFactory","USER_AGENT","createMinimalClient","metadata","baseUrl","tokenProvider","options","fetchFn","global","fetch","objectSetFactory","createOntologyProviderFactory","process","env","NODE_ENV","URL","e","hint","startsWith","Error","processedBaseUrl","pathname","endsWith","minimalClient","toString","objectFactory","objectFactory2","ontologyRid","logger","clientCacheKey","requestContext","Object","freeze","assign","ontologyProvider"],"sources":["createMinimalClient.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {
|
|
1
|
+
{"version":3,"file":"createMinimalClient.js","names":["createSharedClientContext","convertWireToOsdkObjects","convertWireToOsdkObjects2","createObjectSet","createStandardOntologyProviderFactory","USER_AGENT","createMinimalClient","metadata","baseUrl","tokenProvider","options","fetchFn","global","fetch","objectSetFactory","createOntologyProviderFactory","process","env","NODE_ENV","URL","e","hint","startsWith","Error","processedBaseUrl","pathname","endsWith","minimalClient","toString","objectFactory","objectFactory2","ontologyRid","logger","clientCacheKey","requestContext","Object","freeze","assign","ontologyProvider"],"sources":["createMinimalClient.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Logger } from \"@osdk/api\";\nimport { createSharedClientContext } from \"@osdk/shared.client.impl\";\nimport type {\n ClientCacheKey,\n MinimalClient,\n MinimalClientParams,\n} from \"./MinimalClientContext.js\";\nimport {\n convertWireToOsdkObjects,\n convertWireToOsdkObjects2,\n} from \"./object/convertWireToOsdkObjects.js\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport type { ObjectSetFactory } from \"./objectSet/ObjectSetFactory.js\";\nimport type { OntologyProvider } from \"./ontology/OntologyProvider.js\";\nimport {\n createStandardOntologyProviderFactory,\n type OntologyCachingOptions,\n} from \"./ontology/StandardOntologyProvider.js\";\nimport { USER_AGENT } from \"./util/UserAgent.js\";\n\n/** @internal */\nexport function createMinimalClient(\n metadata: MinimalClientParams[\"metadata\"],\n baseUrl: string,\n tokenProvider: () => Promise<string>,\n options: OntologyCachingOptions & { logger?: Logger } = {},\n fetchFn: (\n input: Request | URL | string,\n init?: RequestInit | undefined,\n ) => Promise<Response> = global.fetch,\n objectSetFactory: ObjectSetFactory<any, any> = createObjectSet,\n createOntologyProviderFactory: (\n a: OntologyCachingOptions & { logger?: Logger },\n ) => (minimalClient: MinimalClient) => OntologyProvider =\n createStandardOntologyProviderFactory,\n) {\n if (process.env.NODE_ENV !== \"production\") {\n try {\n new URL(baseUrl);\n } catch (e) {\n const hint =\n !baseUrl.startsWith(\"http://\") || !baseUrl.startsWith(\"https://\")\n ? \". Did you forget to add 'http://' or 'https://'?\"\n : \"\";\n throw new Error(`Invalid stack URL: ${baseUrl}${hint}`);\n }\n }\n const processedBaseUrl = new URL(baseUrl);\n processedBaseUrl.pathname += processedBaseUrl.pathname.endsWith(\"/\")\n ? \"\"\n : \"/\";\n const minimalClient: MinimalClient = {\n ...createSharedClientContext(\n processedBaseUrl.toString(),\n tokenProvider,\n USER_AGENT,\n fetchFn,\n ),\n objectSetFactory,\n objectFactory: convertWireToOsdkObjects,\n objectFactory2: convertWireToOsdkObjects2,\n ontologyRid: metadata.ontologyRid,\n logger: options.logger,\n clientCacheKey: {} as ClientCacheKey,\n requestContext: {},\n } satisfies Omit<\n MinimalClient,\n \"ontologyProvider\"\n > as any;\n\n return Object.freeze(Object.assign(minimalClient, {\n ontologyProvider: createOntologyProviderFactory(\n options,\n )(minimalClient),\n }));\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,yBAAyB,QAAQ,0BAA0B;AAMpE,SACEC,wBAAwB,EACxBC,yBAAyB,QACpB,sCAAsC;AAC7C,SAASC,eAAe,QAAQ,gCAAgC;AAGhE,SACEC,qCAAqC,QAEhC,wCAAwC;AAC/C,SAASC,UAAU,QAAQ,qBAAqB;;AAEhD;AACA,OAAO,SAASC,mBAAmBA,CACjCC,QAAyC,EACzCC,OAAe,EACfC,aAAoC,EACpCC,OAAqD,GAAG,CAAC,CAAC,EAC1DC,OAGsB,GAAGC,MAAM,CAACC,KAAK,EACrCC,gBAA4C,GAAGX,eAAe,EAC9DY,6BAEuD,GACrDX,qCAAqC,EACvC;EACA,IAAIY,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzC,IAAI;MACF,IAAIC,GAAG,CAACX,OAAO,CAAC;IAClB,CAAC,CAAC,OAAOY,CAAC,EAAE;MACV,MAAMC,IAAI,GACR,CAACb,OAAO,CAACc,UAAU,CAAC,SAAS,CAAC,IAAI,CAACd,OAAO,CAACc,UAAU,CAAC,UAAU,CAAC,GAC7D,kDAAkD,GAClD,EAAE;MACR,MAAM,IAAIC,KAAK,CAAC,sBAAsBf,OAAO,GAAGa,IAAI,EAAE,CAAC;IACzD;EACF;EACA,MAAMG,gBAAgB,GAAG,IAAIL,GAAG,CAACX,OAAO,CAAC;EACzCgB,gBAAgB,CAACC,QAAQ,IAAID,gBAAgB,CAACC,QAAQ,CAACC,QAAQ,CAAC,GAAG,CAAC,GAChE,EAAE,GACF,GAAG;EACP,MAAMC,aAA4B,GAAG;IACnC,GAAG3B,yBAAyB,CAC1BwB,gBAAgB,CAACI,QAAQ,CAAC,CAAC,EAC3BnB,aAAa,EACbJ,UAAU,EACVM,OACF,CAAC;IACDG,gBAAgB;IAChBe,aAAa,EAAE5B,wBAAwB;IACvC6B,cAAc,EAAE5B,yBAAyB;IACzC6B,WAAW,EAAExB,QAAQ,CAACwB,WAAW;IACjCC,MAAM,EAAEtB,OAAO,CAACsB,MAAM;IACtBC,cAAc,EAAE,CAAC,CAAmB;IACpCC,cAAc,EAAE,CAAC;EACnB,CAGQ;EAER,OAAOC,MAAM,CAACC,MAAM,CAACD,MAAM,CAACE,MAAM,CAACV,aAAa,EAAE;IAChDW,gBAAgB,EAAEvB,6BAA6B,CAC7CL,OACF,CAAC,CAACiB,aAAa;EACjB,CAAC,CAAC,CAAC;AACL","ignoreList":[]}
|
|
@@ -16,10 +16,9 @@
|
|
|
16
16
|
|
|
17
17
|
import invariant from "tiny-invariant";
|
|
18
18
|
import { modernToLegacyWhereClause } from "../internal/conversions/modernToLegacyWhereClause.js";
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
import { derivedPropertyDefinitionFactory } from "./derivedPropertyDefinitionFactory.js";
|
|
21
20
|
/** @internal */
|
|
22
|
-
export function createWithPropertiesObjectSet(objectType, objectSet, definitionMap) {
|
|
21
|
+
export function createWithPropertiesObjectSet(objectType, objectSet, definitionMap, fromBaseObjectSet = false) {
|
|
23
22
|
return {
|
|
24
23
|
pivotTo: link => {
|
|
25
24
|
return createWithPropertiesObjectSet(objectType, {
|
|
@@ -77,29 +76,53 @@ export function createWithPropertiesObjectSet(objectType, objectSet, definitionM
|
|
|
77
76
|
default:
|
|
78
77
|
process.env.NODE_ENV !== "production" ? invariant(false, "Invalid aggregation operation " + aggregationOperation) : invariant(false);
|
|
79
78
|
}
|
|
80
|
-
const
|
|
81
|
-
type: {}
|
|
82
|
-
};
|
|
83
|
-
definitionMap.set(selectorResult, {
|
|
79
|
+
const wrappedObjectSet = {
|
|
84
80
|
type: "selection",
|
|
85
81
|
objectSet: objectSet,
|
|
86
82
|
operation: aggregationOperationDefinition
|
|
87
|
-
}
|
|
83
|
+
};
|
|
84
|
+
const selectorResult = derivedPropertyDefinitionFactory(wrappedObjectSet, definitionMap);
|
|
85
|
+
definitionMap.set(selectorResult, wrappedObjectSet);
|
|
88
86
|
return selectorResult;
|
|
89
87
|
},
|
|
90
88
|
selectProperty: name => {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
89
|
+
if (fromBaseObjectSet) {
|
|
90
|
+
const wrappedObjectSet = {
|
|
91
|
+
type: "property",
|
|
92
|
+
apiName: name
|
|
93
|
+
};
|
|
94
|
+
const selectorResult = derivedPropertyDefinitionFactory(wrappedObjectSet, definitionMap);
|
|
95
|
+
definitionMap.set(selectorResult, wrappedObjectSet);
|
|
96
|
+
return selectorResult;
|
|
97
|
+
}
|
|
98
|
+
const wrappedObjectSet = {
|
|
95
99
|
type: "selection",
|
|
96
100
|
objectSet: objectSet,
|
|
97
101
|
operation: {
|
|
98
102
|
type: "get",
|
|
99
103
|
selectedPropertyApiName: name
|
|
100
104
|
}
|
|
101
|
-
}
|
|
105
|
+
};
|
|
106
|
+
const selectorResult = derivedPropertyDefinitionFactory(wrappedObjectSet, definitionMap);
|
|
107
|
+
definitionMap.set(selectorResult, wrappedObjectSet);
|
|
102
108
|
return selectorResult;
|
|
109
|
+
},
|
|
110
|
+
constant: {
|
|
111
|
+
double: () => {
|
|
112
|
+
process.env.NODE_ENV !== "production" ? invariant(false, "Not supported") : invariant(false);
|
|
113
|
+
},
|
|
114
|
+
integer: () => {
|
|
115
|
+
process.env.NODE_ENV !== "production" ? invariant(false, "Not supported") : invariant(false);
|
|
116
|
+
},
|
|
117
|
+
long: () => {
|
|
118
|
+
process.env.NODE_ENV !== "production" ? invariant(false, "Not supported") : invariant(false);
|
|
119
|
+
},
|
|
120
|
+
datetime: () => {
|
|
121
|
+
process.env.NODE_ENV !== "production" ? invariant(false, "Not supported") : invariant(false);
|
|
122
|
+
},
|
|
123
|
+
timestamp: () => {
|
|
124
|
+
process.env.NODE_ENV !== "production" ? invariant(false, "Not supported") : invariant(false);
|
|
125
|
+
}
|
|
103
126
|
}
|
|
104
127
|
};
|
|
105
128
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createWithPropertiesObjectSet.js","names":["invariant","modernToLegacyWhereClause","
|
|
1
|
+
{"version":3,"file":"createWithPropertiesObjectSet.js","names":["invariant","modernToLegacyWhereClause","derivedPropertyDefinitionFactory","createWithPropertiesObjectSet","objectType","objectSet","definitionMap","fromBaseObjectSet","pivotTo","link","type","where","clause","aggregate","aggregation","opt","splitAggregation","split","length","process","env","NODE_ENV","aggregationPropertyName","aggregationOperation","aggregationOperationDefinition","selectedPropertyApiName","approximatePercentile","percentile","limit","undefined","wrappedObjectSet","operation","selectorResult","set","selectProperty","name","apiName","constant","double","integer","long","datetime","timestamp"],"sources":["createWithPropertiesObjectSet.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 { DerivedProperty, ObjectOrInterfaceDefinition } from \"@osdk/api\";\nimport type {\n DerivedPropertyDefinition,\n ObjectSet as WireObjectSet,\n SelectedPropertyOperation,\n} from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport { modernToLegacyWhereClause } from \"../internal/conversions/modernToLegacyWhereClause.js\";\nimport { derivedPropertyDefinitionFactory } from \"./derivedPropertyDefinitionFactory.js\";\n\ntype WithConstSelect<Q extends ObjectOrInterfaceDefinition> =\n & DerivedProperty.SelectPropertyBuilder<Q, false>\n & {\n constant: DerivedProperty.Builder<Q, true>[\"constant\"];\n };\n\n/** @internal */\nexport function createWithPropertiesObjectSet<\n Q extends ObjectOrInterfaceDefinition,\n>(\n objectType: Q,\n objectSet: WireObjectSet,\n definitionMap: Map<any, DerivedPropertyDefinition>,\n fromBaseObjectSet: boolean = false,\n): WithConstSelect<Q> {\n return {\n pivotTo: (link) => {\n return createWithPropertiesObjectSet(objectType, {\n type: \"searchAround\",\n objectSet,\n link,\n }, definitionMap);\n },\n where: (clause) => {\n return createWithPropertiesObjectSet(objectType, {\n type: \"filter\",\n objectSet: objectSet,\n where: modernToLegacyWhereClause(clause, objectType),\n }, definitionMap);\n },\n aggregate: (aggregation: string, opt: any) => {\n const splitAggregation = aggregation.split(\":\");\n invariant(\n splitAggregation.length === 2 || splitAggregation[0] === \"$count\",\n \"Invalid aggregation format\",\n );\n const [aggregationPropertyName, aggregationOperation] = splitAggregation;\n let aggregationOperationDefinition: SelectedPropertyOperation;\n switch (aggregationOperation) {\n case \"sum\":\n case \"avg\":\n case \"min\":\n case \"max\":\n case \"exactDistinct\":\n case \"approximateDistinct\":\n aggregationOperationDefinition = {\n type: aggregationOperation,\n selectedPropertyApiName: aggregationPropertyName,\n };\n break;\n case \"approximatePercentile\":\n aggregationOperationDefinition = {\n type: \"approximatePercentile\",\n selectedPropertyApiName: aggregationPropertyName,\n approximatePercentile: opt?.percentile ?? .5,\n };\n break;\n case \"collectSet\":\n case \"collectList\":\n aggregationOperationDefinition = {\n type: aggregationOperation,\n selectedPropertyApiName: aggregationPropertyName,\n limit: opt?.limit ?? 100,\n };\n break;\n case undefined:\n if (aggregationPropertyName === \"$count\") {\n aggregationOperationDefinition = {\n type: \"count\",\n };\n break;\n }\n default:\n invariant(\n false,\n \"Invalid aggregation operation \" + aggregationOperation,\n );\n }\n const wrappedObjectSet: DerivedPropertyDefinition = {\n type: \"selection\",\n objectSet: objectSet,\n operation: aggregationOperationDefinition,\n };\n const selectorResult: DerivedProperty.Definition<any, any> =\n derivedPropertyDefinitionFactory(wrappedObjectSet, definitionMap);\n definitionMap.set(selectorResult, wrappedObjectSet);\n return selectorResult as any;\n },\n selectProperty: (name) => {\n if (fromBaseObjectSet) {\n const wrappedObjectSet: DerivedPropertyDefinition = {\n type: \"property\",\n apiName: name,\n };\n const selectorResult: DerivedProperty.Definition<any, any> =\n derivedPropertyDefinitionFactory(wrappedObjectSet, definitionMap);\n definitionMap.set(selectorResult, wrappedObjectSet);\n return selectorResult as any;\n }\n const wrappedObjectSet: DerivedPropertyDefinition = {\n type: \"selection\",\n objectSet: objectSet,\n operation: {\n type: \"get\",\n selectedPropertyApiName: name,\n },\n };\n const selectorResult: DerivedProperty.Definition<any, any> =\n derivedPropertyDefinitionFactory(wrappedObjectSet, definitionMap);\n definitionMap.set(selectorResult, wrappedObjectSet);\n return selectorResult as any;\n },\n constant: {\n double: (value) => {\n invariant(false, \"Not supported\");\n },\n integer: (value) => {\n invariant(false, \"Not supported\");\n },\n long: (value) => {\n invariant(false, \"Not supported\");\n },\n datetime: (value) => {\n invariant(false, \"Not supported\");\n },\n timestamp: (value) => {\n invariant(false, \"Not supported\");\n },\n },\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,yBAAyB,QAAQ,sDAAsD;AAChG,SAASC,gCAAgC,QAA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