@osdk/client 2.1.0-beta.30 → 2.1.0-beta.31
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 +18 -0
- package/build/browser/actions/actions.test.js.map +1 -1
- package/build/browser/actions/applyAction.js +1 -1
- package/build/browser/actions/applyAction.js.map +1 -1
- package/build/browser/createClient.js +1 -1
- package/build/browser/createClient.js.map +1 -1
- package/build/browser/createGeotimeSeriesProperty.js +1 -1
- package/build/browser/createGeotimeSeriesProperty.js.map +1 -1
- package/build/browser/createMediaReferenceProperty.js +1 -1
- package/build/browser/createMediaReferenceProperty.js.map +1 -1
- package/build/browser/createTimeseriesProperty.js +1 -1
- package/build/browser/createTimeseriesProperty.js.map +1 -1
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -1
- package/build/browser/internal/conversions/legacyToModernSingleAggregationResult.js.map +1 -1
- package/build/browser/internal/conversions/modernToLegacyAggregationClause.js.map +1 -1
- package/build/browser/internal/conversions/modernToLegacyGroupByClause.js.map +1 -1
- package/build/browser/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
- package/build/browser/object/aggregate.js +1 -1
- package/build/browser/object/aggregate.js.map +1 -1
- package/build/browser/object/aggregate.test.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/browser/object/fetchPage.js +1 -1
- package/build/browser/object/fetchPage.js.map +1 -1
- package/build/browser/object/fetchPage.test.js.map +1 -1
- package/build/browser/object/fetchSingle.js.map +1 -1
- package/build/browser/objectSet/ObjectSetFactory.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
- package/build/browser/objectSet/createObjectSet.js.map +1 -1
- package/build/browser/ontology/loadActionMetadata.js +1 -1
- package/build/browser/ontology/loadActionMetadata.js.map +1 -1
- package/build/browser/ontology/loadFullObjectMetadata.js +1 -1
- package/build/browser/ontology/loadFullObjectMetadata.js.map +1 -1
- package/build/browser/ontology/loadInterfaceMetadata.js +1 -1
- package/build/browser/ontology/loadInterfaceMetadata.js.map +1 -1
- package/build/browser/ontology/loadQueryMetadata.js +1 -1
- package/build/browser/ontology/loadQueryMetadata.js.map +1 -1
- package/build/browser/public-utils/createAndFetchTempObjectSetRid.js +1 -1
- package/build/browser/public-utils/createAndFetchTempObjectSetRid.js.map +1 -1
- package/build/browser/public-utils/hydrateAttachmentFromRid.js +1 -1
- package/build/browser/public-utils/hydrateAttachmentFromRid.js.map +1 -1
- package/build/browser/queries/applyQuery.js +2 -2
- package/build/browser/queries/applyQuery.js.map +1 -1
- package/build/browser/queries/queries.test.js +7 -0
- package/build/browser/queries/queries.test.js.map +1 -1
- package/build/browser/util/UserAgent.js +1 -1
- package/build/browser/util/WireObjectSet.js.map +1 -1
- package/build/browser/util/isOntologyObjectV2.js.map +1 -1
- package/build/browser/util/objectSetUtils.js.map +1 -1
- package/build/browser/util/timeseriesUtils.js.map +1 -1
- package/build/browser/util/toDataValue.js +1 -1
- package/build/browser/util/toDataValue.js.map +1 -1
- package/build/browser/util/toDataValueQueries.js +1 -1
- package/build/browser/util/toDataValueQueries.js.map +1 -1
- package/build/cjs/{chunk-R4DO4ZKB.cjs → chunk-L454XQQ7.cjs} +13 -13
- package/build/cjs/chunk-L454XQQ7.cjs.map +1 -0
- package/build/cjs/{chunk-TCHGLBKJ.cjs → chunk-RDXQTUTR.cjs} +14 -14
- package/build/cjs/chunk-RDXQTUTR.cjs.map +1 -0
- package/build/cjs/index.cjs +44 -44
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/public/internal.cjs +6 -6
- package/build/cjs/public/internal.cjs.map +1 -1
- package/build/cjs/public/unstable-do-not-use.cjs +2 -2
- package/build/esm/actions/actions.test.js.map +1 -1
- package/build/esm/actions/applyAction.js +1 -1
- package/build/esm/actions/applyAction.js.map +1 -1
- package/build/esm/createClient.js +1 -1
- package/build/esm/createClient.js.map +1 -1
- package/build/esm/createGeotimeSeriesProperty.js +1 -1
- package/build/esm/createGeotimeSeriesProperty.js.map +1 -1
- package/build/esm/createMediaReferenceProperty.js +1 -1
- package/build/esm/createMediaReferenceProperty.js.map +1 -1
- package/build/esm/createTimeseriesProperty.js +1 -1
- package/build/esm/createTimeseriesProperty.js.map +1 -1
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -1
- package/build/esm/internal/conversions/legacyToModernSingleAggregationResult.js.map +1 -1
- package/build/esm/internal/conversions/modernToLegacyAggregationClause.js.map +1 -1
- package/build/esm/internal/conversions/modernToLegacyGroupByClause.js.map +1 -1
- package/build/esm/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
- package/build/esm/object/aggregate.js +1 -1
- package/build/esm/object/aggregate.js.map +1 -1
- package/build/esm/object/aggregate.test.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/esm/object/fetchPage.js +1 -1
- package/build/esm/object/fetchPage.js.map +1 -1
- package/build/esm/object/fetchPage.test.js.map +1 -1
- package/build/esm/object/fetchSingle.js.map +1 -1
- package/build/esm/objectSet/ObjectSetFactory.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
- package/build/esm/objectSet/createObjectSet.js.map +1 -1
- package/build/esm/ontology/loadActionMetadata.js +1 -1
- package/build/esm/ontology/loadActionMetadata.js.map +1 -1
- package/build/esm/ontology/loadFullObjectMetadata.js +1 -1
- package/build/esm/ontology/loadFullObjectMetadata.js.map +1 -1
- package/build/esm/ontology/loadInterfaceMetadata.js +1 -1
- package/build/esm/ontology/loadInterfaceMetadata.js.map +1 -1
- package/build/esm/ontology/loadQueryMetadata.js +1 -1
- package/build/esm/ontology/loadQueryMetadata.js.map +1 -1
- package/build/esm/public-utils/createAndFetchTempObjectSetRid.js +1 -1
- package/build/esm/public-utils/createAndFetchTempObjectSetRid.js.map +1 -1
- package/build/esm/public-utils/hydrateAttachmentFromRid.js +1 -1
- package/build/esm/public-utils/hydrateAttachmentFromRid.js.map +1 -1
- package/build/esm/queries/applyQuery.js +2 -2
- package/build/esm/queries/applyQuery.js.map +1 -1
- package/build/esm/queries/queries.test.js +7 -0
- package/build/esm/queries/queries.test.js.map +1 -1
- package/build/esm/util/UserAgent.js +1 -1
- package/build/esm/util/WireObjectSet.js.map +1 -1
- package/build/esm/util/isOntologyObjectV2.js.map +1 -1
- package/build/esm/util/objectSetUtils.js.map +1 -1
- package/build/esm/util/timeseriesUtils.js.map +1 -1
- package/build/esm/util/toDataValue.js +1 -1
- package/build/esm/util/toDataValue.js.map +1 -1
- package/build/esm/util/toDataValueQueries.js +1 -1
- package/build/esm/util/toDataValueQueries.js.map +1 -1
- package/build/types/actions/applyAction.d.ts +1 -1
- package/build/types/util/objectSetUtils.d.ts +1 -1
- package/build/types/util/timeseriesUtils.d.ts +1 -1
- package/package.json +10 -10
- package/build/cjs/chunk-R4DO4ZKB.cjs.map +0 -1
- package/build/cjs/chunk-TCHGLBKJ.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @osdk/client
|
|
2
2
|
|
|
3
|
+
## 2.1.0-beta.31
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- bb8b219: Use new external packages instead of the internal ones.
|
|
8
|
+
- ee6224b: Explicitly type aggregation types in queries.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies [bb8b219]
|
|
13
|
+
- Updated dependencies [81b2fb2]
|
|
14
|
+
- Updated dependencies [ecd4aee]
|
|
15
|
+
- Updated dependencies [ee6224b]
|
|
16
|
+
- Updated dependencies [5fe2c8d]
|
|
17
|
+
- @osdk/generator-converters@2.1.0-beta.31
|
|
18
|
+
- @osdk/api@2.1.0-beta.31
|
|
19
|
+
- @osdk/client.unstable@2.1.0-beta.31
|
|
20
|
+
|
|
3
21
|
## 2.1.0-beta.30
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.test.js","names":["$Actions","$ontologyRid","actionTakesAttachment","actionTakesMedia","createFooInterface","createOffice","createStructPerson","deleteFooInterface","moveOffice","apiServer","stubData","afterAll","beforeAll","describe","expect","expectTypeOf","it","vi","createClient","createAttachmentUpload","ActionValidationError","remapActionResponse","client","customEntryPointClient","listen","close","result","applyAction","officeId","address","capacity","$returnEdits","toEqualTypeOf","toMatchInlineSnapshot","undefinedResult","toBeUndefined","batchApplyAction","clientCreateOfficeMock","fn","newAddress","newCapacity","$validateOnly","fail","e","toBeInstanceOf","validation","toMatchTypeOf","name","city","state","zipcode","attachment","blob","attachmentUploadRequestBody","localAttachment1","filename","fileAttachment","Object","assign","result2","media_reference","mediaReference","deletedInterface","$objectType","$primaryKey","createdInterface","actionResponse","edits","type","deletedLinksCount","deletedObjectsCount","addedObjectCount","modifiedObjectsCount","addedLinksCount","batchActionResponse","remappedActionResponse","remappedBatchActionResponse","actions","keys","toStrictEqual"],"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 $ontologyRid,\n actionTakesAttachment,\n actionTakesMedia,\n createFooInterface,\n createOffice,\n createStructPerson,\n deleteFooInterface,\n moveOffice,\n} from \"@osdk/client.test.ontology\";\nimport type {\n BatchApplyActionResponseV2,\n SyncApplyActionResponseV2,\n} from \"@osdk/internal.foundry.core\";\nimport { apiServer, stubData } from \"@osdk/shared.test\";\nimport {\n afterAll,\n beforeAll,\n describe,\n expect,\n expectTypeOf,\n it,\n vi,\n} 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(\"actions\", () => {\n let client: Client;\n let customEntryPointClient: Client;\n\n beforeAll(async () => {\n apiServer.listen();\n client = createClient(\n \"https://stack.palantir.com\",\n $ontologyRid,\n async () => \"myAccessToken\",\n );\n customEntryPointClient = createClient(\n \"https://stack.palantirCustom.com/foo/first/someStuff\",\n $ontologyRid,\n async () => \"myAccessToken\",\n );\n });\n\n afterAll(() => {\n apiServer.close();\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).toMatchInlineSnapshot(`\n {\n \"addedLinks\": [],\n \"addedObjects\": [\n {\n \"objectType\": \"Office\",\n \"primaryKey\": \"NYC\",\n },\n ],\n \"deletedLinksCount\": 0,\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 newCapacity: 40,\n }, {\n $validateOnly: true,\n });\n expectTypeOf<typeof result>().toEqualTypeOf<ActionValidationResponse>();\n\n expect(result).toMatchInlineSnapshot(`\n {\n \"parameters\": {},\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 customEntryPointClient(moveOffice).applyAction({\n officeId: \"SEA\",\n newAddress: \"456 Pike Place\",\n newCapacity: 40,\n }, {\n $validateOnly: true,\n });\n expectTypeOf<typeof result>().toEqualTypeOf<ActionValidationResponse>();\n\n expect(result).toMatchInlineSnapshot(`\n {\n \"parameters\": {},\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 newCapacity: 40,\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).toMatchInlineSnapshot(`\n {\n \"parameters\": {},\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 const result = await client(actionTakesAttachment).applyAction({\n attachment: \"attachment.rid\",\n });\n\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\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 =\n stubData.attachmentUploadRequestBody[stubData.localAttachment1.filename];\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 const result = await client(actionTakesAttachment).applyAction({\n attachment,\n });\n\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: stubData.mediaReference,\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: 1,\n },\n });\n\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\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: \"UnderlyingObject\",\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).toMatchInlineSnapshot(`\n {\n \"addedLinks\": [],\n \"addedObjects\": [],\n \"deletedLinksCount\": 0,\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 deletedLinksCount: 0,\n deletedObjectsCount: 0,\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 \"deletedLinksCount\": 0,\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 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 \"deletedLinksCount\": 0,\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 \"deleteFooInterface\",\n \"moveOffice\",\n \"promoteEmployee\",\n \"promoteEmployeeObject\",\n ]);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SACEA,QAAQ,EACRC,YAAY,EACZC,qBAAqB,EACrBC,gBAAgB,EAChBC,kBAAkB,EAClBC,YAAY,EACZC,kBAAkB,EAClBC,kBAAkB,EAClBC,UAAU,QACL,4BAA4B;AAKnC,SAASC,SAAS,EAAEC,QAAQ,QAAQ,mBAAmB;AACvD,SACEC,QAAQ,EACR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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;IACFnB,MAAM,CAAC8D,2BAA2B,CAAC,CAAC3C,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,KAAK,CAAC;EACJ,CAAC,CAAC;EACFjB,EAAE,CAAC,wBAAwB,EAAE,YAAY;IACvC,MAAM6D,OAAO,GAAGpB,MAAM,CAACqB,IAAI,CAAC9E,QAAQ,CAAC;IACrCc,MAAM,CAAC+D,OAAO,CAAC,CAACE,aAAa,CAAC,CAC5B,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,cAAc,EACd,yBAAyB,EACzB,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,CACxB,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"actions.test.js","names":["$Actions","$ontologyRid","actionTakesAttachment","actionTakesMedia","createFooInterface","createOffice","createStructPerson","deleteFooInterface","moveOffice","apiServer","stubData","afterAll","beforeAll","describe","expect","expectTypeOf","it","vi","createClient","createAttachmentUpload","ActionValidationError","remapActionResponse","client","customEntryPointClient","listen","close","result","applyAction","officeId","address","capacity","$returnEdits","toEqualTypeOf","toMatchInlineSnapshot","undefinedResult","toBeUndefined","batchApplyAction","clientCreateOfficeMock","fn","newAddress","newCapacity","$validateOnly","fail","e","toBeInstanceOf","validation","toMatchTypeOf","name","city","state","zipcode","attachment","blob","attachmentUploadRequestBody","localAttachment1","filename","fileAttachment","Object","assign","result2","media_reference","mediaReference","deletedInterface","$objectType","$primaryKey","createdInterface","actionResponse","edits","type","deletedLinksCount","deletedObjectsCount","addedObjectCount","modifiedObjectsCount","addedLinksCount","batchActionResponse","remappedActionResponse","remappedBatchActionResponse","actions","keys","toStrictEqual"],"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 $ontologyRid,\n actionTakesAttachment,\n actionTakesMedia,\n createFooInterface,\n createOffice,\n createStructPerson,\n deleteFooInterface,\n moveOffice,\n} from \"@osdk/client.test.ontology\";\nimport type {\n BatchApplyActionResponseV2,\n SyncApplyActionResponseV2,\n} from \"@osdk/foundry.ontologies\";\nimport { apiServer, stubData } from \"@osdk/shared.test\";\nimport {\n afterAll,\n beforeAll,\n describe,\n expect,\n expectTypeOf,\n it,\n vi,\n} 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(\"actions\", () => {\n let client: Client;\n let customEntryPointClient: Client;\n\n beforeAll(async () => {\n apiServer.listen();\n client = createClient(\n \"https://stack.palantir.com\",\n $ontologyRid,\n async () => \"myAccessToken\",\n );\n customEntryPointClient = createClient(\n \"https://stack.palantirCustom.com/foo/first/someStuff\",\n $ontologyRid,\n async () => \"myAccessToken\",\n );\n });\n\n afterAll(() => {\n apiServer.close();\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).toMatchInlineSnapshot(`\n {\n \"addedLinks\": [],\n \"addedObjects\": [\n {\n \"objectType\": \"Office\",\n \"primaryKey\": \"NYC\",\n },\n ],\n \"deletedLinksCount\": 0,\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 newCapacity: 40,\n }, {\n $validateOnly: true,\n });\n expectTypeOf<typeof result>().toEqualTypeOf<ActionValidationResponse>();\n\n expect(result).toMatchInlineSnapshot(`\n {\n \"parameters\": {},\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 customEntryPointClient(moveOffice).applyAction({\n officeId: \"SEA\",\n newAddress: \"456 Pike Place\",\n newCapacity: 40,\n }, {\n $validateOnly: true,\n });\n expectTypeOf<typeof result>().toEqualTypeOf<ActionValidationResponse>();\n\n expect(result).toMatchInlineSnapshot(`\n {\n \"parameters\": {},\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 newCapacity: 40,\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).toMatchInlineSnapshot(`\n {\n \"parameters\": {},\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 const result = await client(actionTakesAttachment).applyAction({\n attachment: \"attachment.rid\",\n });\n\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\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 =\n stubData.attachmentUploadRequestBody[stubData.localAttachment1.filename];\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 const result = await client(actionTakesAttachment).applyAction({\n attachment,\n });\n\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: stubData.mediaReference,\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: 1,\n },\n });\n\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\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: \"UnderlyingObject\",\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).toMatchInlineSnapshot(`\n {\n \"addedLinks\": [],\n \"addedObjects\": [],\n \"deletedLinksCount\": 0,\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 deletedLinksCount: 0,\n deletedObjectsCount: 0,\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 \"deletedLinksCount\": 0,\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 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 \"deletedLinksCount\": 0,\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 \"deleteF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;MACnBC,oBAAoB,EAAE,CAAC;MACvBC,eAAe,EAAE;IACnB;EACF,CAAC;EAEDzD,EAAE,CAAC,+CAA+C,EAAE,MAAM;IACxD,MAAM2D,sBAAsB,GAAGtD,mBAAmB,CAAC6C,cAAc,CAAC;IAClE,MAAMU,2BAA2B,GAAGvD,mBAAmB,CACrDqD,mBACF,CAAC;IACD5D,MAAM,CAAC6D,sBAAsB,CAAC,CAAC1C,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,KAAK,CAAC;IACFnB,MAAM,CAAC8D,2BAA2B,CAAC,CAAC3C,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,KAAK,CAAC;EACJ,CAAC,CAAC;EACFjB,EAAE,CAAC,wBAAwB,EAAE,YAAY;IACvC,MAAM6D,OAAO,GAAGpB,MAAM,CAACqB,IAAI,CAAC9E,QAAQ,CAAC;IACrCc,MAAM,CAAC+D,OAAO,CAAC,CAACE,aAAa,CAAC,CAC5B,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,cAAc,EACd,yBAAyB,EACzB,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,CACxB,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import * as OntologiesV2 from "@osdk/
|
|
17
|
+
import * as OntologiesV2 from "@osdk/foundry.ontologies";
|
|
18
18
|
import invariant from "tiny-invariant";
|
|
19
19
|
import { addUserAgentAndRequestContextHeaders } from "../util/addUserAgentAndRequestContextHeaders.js";
|
|
20
20
|
import { augmentRequestContext } from "../util/augmentRequestContext.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyAction.js","names":["OntologiesV2","invariant","addUserAgentAndRequestContextHeaders","augmentRequestContext","toDataValue","ActionValidationError","applyAction","client","action","parameters","options","clientWithHeaders","finalMethodCall","Array","isArray","response","Actions","applyBatch","ontologyRid","apiName","requests","remapBatchActionParams","returnEdits","$returnEdits","edits","type","remapActionResponse","undefined","apply","remapActionParams","mode","$validateOnly","validation","result","params","parameterMap","key","value","Object","entries","remappedParams","Promise","all","map","param","editResponses","remappedActionResponse","deletedLinksCount","deletedObjectsCount","addedLinks","addedObjects","modifiedObjects","editedObjectTypes","editedObjectTypesSet","Set","edit","push","linkTypeApiNameAtoB","linkTypeApiNameBtoA","aSideObject","bSideObject","add","objectType","primaryKey","process","env","NODE_ENV"],"sources":["applyAction.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n ActionEditResponse,\n ActionMetadata,\n ActionParam,\n ActionReturnTypeForOptions,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n DataValueClientToWire,\n} from \"@osdk/api\";\nimport type {\n BatchApplyActionResponseV2,\n DataValue,\n SyncApplyActionResponseV2,\n} from \"@osdk/internal.foundry.core\";\nimport * as OntologiesV2 from \"@osdk/internal.foundry.ontologiesv2\";\nimport invariant from \"tiny-invariant\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\nimport { augmentRequestContext } from \"../util/augmentRequestContext.js\";\nimport type { NOOP } from \"../util/NOOP.js\";\nimport type { NullableProps } from \"../util/NullableProps.js\";\nimport type { PartialBy } from \"../util/partialBy.js\";\nimport { toDataValue } from \"../util/toDataValue.js\";\nimport { ActionValidationError } from \"./ActionValidationError.js\";\n\ntype BaseType<APD extends Pick<ActionMetadata.Parameter<any>, \"type\">> =\n APD[\"type\"] extends ActionMetadata.DataType.Object<infer TTargetType>\n ? ActionParam.ObjectType<TTargetType>\n : APD[\"type\"] extends ActionMetadata.DataType.ObjectSet<infer TTargetType>\n ? ActionParam.ObjectSetType<TTargetType>\n : APD[\"type\"] extends ActionMetadata.DataType.Struct<infer TStructType>\n ? ActionParam.StructType<TStructType>\n : APD[\"type\"] extends keyof DataValueClientToWire\n ? ActionParam.PrimitiveType<APD[\"type\"]>\n : never;\n\ntype MaybeArrayType<APD extends ActionMetadata.Parameter<any>> =\n APD[\"multiplicity\"] extends true ? Array<BaseType<APD>>\n : BaseType<APD>;\n\ntype NotOptionalParams<X extends ActionParametersDefinition> = {\n [P in keyof X]: MaybeArrayType<X[P]>;\n};\n\nexport type OsdkActionParameters<\n X extends ActionParametersDefinition,\n> = NullableProps<X> extends never ? NotOptionalParams<X>\n : PartialBy<NotOptionalParams<X>, NullableProps<X>>;\n\nexport type CompileTimeActionMetadata<\n T extends ActionDefinition<any>,\n> = NonNullable<T[\"__DefinitionMetadata\"]>;\n\nexport type ActionSignatureFromDef<\n T extends ActionDefinition<any>,\n> = {\n applyAction:\n [CompileTimeActionMetadata<T>[\"signatures\"][\"applyAction\"]] extends [never]\n ? ActionSignature<CompileTimeActionMetadata<T>[\"parameters\"]>\n : CompileTimeActionMetadata<T>[\"signatures\"][\"applyAction\"];\n\n batchApplyAction:\n [CompileTimeActionMetadata<T>[\"signatures\"][\"batchApplyAction\"]] extends\n [never] ? BatchActionSignature<CompileTimeActionMetadata<T>[\"parameters\"]>\n : CompileTimeActionMetadata<T>[\"signatures\"][\"batchApplyAction\"];\n};\n\ntype ActionParametersDefinition = Record<\n any,\n ActionMetadata.Parameter<any>\n>;\n\nexport type ActionSignature<\n X extends Record<any, ActionMetadata.Parameter<any>>,\n> = <\n A extends NOOP<OsdkActionParameters<X>>,\n OP extends ApplyActionOptions,\n>(\n args: A,\n options?: OP,\n) => Promise<\n ActionReturnTypeForOptions<OP>\n>;\n\nexport type BatchActionSignature<\n X extends Record<any, ActionMetadata.Parameter<any>>,\n> = <\n A extends NOOP<OsdkActionParameters<X>>[],\n OP extends ApplyBatchActionOptions,\n>(\n args: A,\n options?: OP,\n) => Promise<\n ActionReturnTypeForOptions<OP>\n>;\n\nexport async function applyAction<\n AD extends ActionDefinition<any>,\n P extends\n | OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>\n | OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>[],\n Op extends P extends OsdkActionParameters<\n CompileTimeActionMetadata<AD>[\"parameters\"]\n >[] ? ApplyBatchActionOptions\n : ApplyActionOptions,\n>(\n client: MinimalClient,\n action: AD,\n parameters?: P,\n options: Op = {} as Op,\n): Promise<\n ActionReturnTypeForOptions<Op>\n> {\n const clientWithHeaders = addUserAgentAndRequestContextHeaders(\n augmentRequestContext(client, _ => ({ finalMethodCall: \"applyAction\" })),\n action,\n );\n if (Array.isArray(parameters)) {\n const response = await OntologiesV2.Actions.applyBatch(\n clientWithHeaders,\n await client.ontologyRid,\n action.apiName,\n {\n requests: parameters\n ? await remapBatchActionParams(parameters, client)\n : [],\n options: {\n returnEdits: options?.$returnEdits ? \"ALL\" : \"NONE\",\n },\n },\n );\n\n const edits = response.edits;\n return (options?.$returnEdits\n ? edits?.type === \"edits\" ? remapActionResponse(response) : edits\n : undefined) as ActionReturnTypeForOptions<Op>;\n } else {\n const response = await OntologiesV2.Actions.apply(\n clientWithHeaders,\n await client.ontologyRid,\n action.apiName,\n {\n parameters: await remapActionParams(\n parameters as OsdkActionParameters<\n CompileTimeActionMetadata<AD>[\"parameters\"]\n >,\n client,\n ),\n options: {\n mode: (options as ApplyActionOptions)?.$validateOnly\n ? \"VALIDATE_ONLY\"\n : \"VALIDATE_AND_EXECUTE\",\n returnEdits: options\n ?.$returnEdits\n ? \"ALL\"\n : \"NONE\",\n },\n },\n );\n\n if ((options as ApplyActionOptions)?.$validateOnly) {\n return response.validation as ActionReturnTypeForOptions<Op>;\n }\n\n if (response.validation?.result === \"INVALID\") {\n throw new ActionValidationError(response.validation);\n }\n\n const edits = response.edits;\n return (options?.$returnEdits\n ? edits?.type === \"edits\" ? remapActionResponse(response) : edits\n : undefined) as ActionReturnTypeForOptions<Op>;\n }\n}\n\nasync function remapActionParams<AD extends ActionDefinition<any>>(\n params:\n | OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>\n | undefined,\n client: MinimalClient,\n): Promise<Record<string, DataValue>> {\n if (params == null) {\n return {};\n }\n\n const parameterMap: { [parameterName: string]: unknown } = {};\n for (const [key, value] of Object.entries(params)) {\n parameterMap[key] = await toDataValue(value, client);\n }\n\n return parameterMap;\n}\n\nasync function remapBatchActionParams<\n AD extends ActionDefinition<any>,\n>(\n params: OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>[],\n client: MinimalClient,\n) {\n const remappedParams = await Promise.all(params.map(\n async param => {\n return { parameters: await remapActionParams<AD>(param, client) };\n },\n ));\n\n return remappedParams;\n}\n\nexport function remapActionResponse(\n response: SyncApplyActionResponseV2 | BatchApplyActionResponseV2,\n): ActionEditResponse | undefined {\n const editResponses = response?.edits;\n if (editResponses?.type === \"edits\") {\n const remappedActionResponse: ActionEditResponse = {\n type: editResponses.type,\n deletedLinksCount: editResponses.deletedLinksCount,\n deletedObjectsCount: editResponses.deletedObjectsCount,\n addedLinks: [],\n addedObjects: [],\n modifiedObjects: [],\n editedObjectTypes: [],\n };\n\n const editedObjectTypesSet = new Set<string>();\n for (const edit of editResponses.edits) {\n if (edit.type === \"addLink\") {\n remappedActionResponse.addedLinks.push(\n {\n linkTypeApiNameAtoB: edit.linkTypeApiNameAtoB,\n linkTypeApiNameBtoA: edit.linkTypeApiNameBtoA,\n aSideObject: edit.aSideObject,\n bSideObject: edit.bSideObject,\n },\n );\n editedObjectTypesSet.add(edit.aSideObject.objectType);\n editedObjectTypesSet.add(edit.bSideObject.objectType);\n } else if (edit.type === \"addObject\") {\n remappedActionResponse.addedObjects.push(\n {\n objectType: edit.objectType,\n primaryKey: edit.primaryKey,\n },\n );\n editedObjectTypesSet.add(edit.objectType);\n } else if (edit.type === \"modifyObject\") {\n remappedActionResponse.modifiedObjects.push({\n objectType: edit.objectType,\n primaryKey: edit.primaryKey,\n });\n editedObjectTypesSet.add(edit.objectType);\n } else {\n invariant(false, \"Unknown edit type\");\n }\n }\n remappedActionResponse.editedObjectTypes = [...editedObjectTypesSet];\n return remappedActionResponse;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiBA,OAAO,KAAKA,YAAY,MAAM,qCAAqC;AACnE,OAAOC,SAAS,MAAM,gBAAgB;AAEtC,SAASC,oCAAoC,QAAQ,iDAAiD;AACtG,SAASC,qBAAqB,QAAQ,kCAAkC;AAIxE,SAASC,WAAW,QAAQ,wBAAwB;AACpD,SAASC,qBAAqB,QAAQ,4BAA4B;AAyElE,OAAO,eAAeC,WAAWA,CAU/BC,MAAqB,EACrBC,MAAU,EACVC,UAAc,EACdC,OAAW,GAAG,CAAC,CAAO,EAGtB;EACA,MAAMC,iBAAiB,GAAGT,oCAAoC,CAC5DC,qBAAqB,CAACI,MAAM,EAAE,OAAM;IAAEK,eAAe,EAAE;EAAc,CAAC,CAAC,CAAC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B,CAAC;IACpE,OAAOP,sBAAsB;EAC/B;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"applyAction.js","names":["OntologiesV2","invariant","addUserAgentAndRequestContextHeaders","augmentRequestContext","toDataValue","ActionValidationError","applyAction","client","action","parameters","options","clientWithHeaders","finalMethodCall","Array","isArray","response","Actions","applyBatch","ontologyRid","apiName","requests","remapBatchActionParams","returnEdits","$returnEdits","edits","type","remapActionResponse","undefined","apply","remapActionParams","mode","$validateOnly","validation","result","params","parameterMap","key","value","Object","entries","remappedParams","Promise","all","map","param","editResponses","remappedActionResponse","deletedLinksCount","deletedObjectsCount","addedLinks","addedObjects","modifiedObjects","editedObjectTypes","editedObjectTypesSet","Set","edit","push","linkTypeApiNameAtoB","linkTypeApiNameBtoA","aSideObject","bSideObject","add","objectType","primaryKey","process","env","NODE_ENV"],"sources":["applyAction.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n ActionEditResponse,\n ActionMetadata,\n ActionParam,\n ActionReturnTypeForOptions,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n DataValueClientToWire,\n} from \"@osdk/api\";\nimport type {\n BatchApplyActionResponseV2,\n DataValue,\n SyncApplyActionResponseV2,\n} from \"@osdk/foundry.ontologies\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\nimport { augmentRequestContext } from \"../util/augmentRequestContext.js\";\nimport type { NOOP } from \"../util/NOOP.js\";\nimport type { NullableProps } from \"../util/NullableProps.js\";\nimport type { PartialBy } from \"../util/partialBy.js\";\nimport { toDataValue } from \"../util/toDataValue.js\";\nimport { ActionValidationError } from \"./ActionValidationError.js\";\n\ntype BaseType<APD extends Pick<ActionMetadata.Parameter<any>, \"type\">> =\n APD[\"type\"] extends ActionMetadata.DataType.Object<infer TTargetType>\n ? ActionParam.ObjectType<TTargetType>\n : APD[\"type\"] extends ActionMetadata.DataType.ObjectSet<infer TTargetType>\n ? ActionParam.ObjectSetType<TTargetType>\n : APD[\"type\"] extends ActionMetadata.DataType.Struct<infer TStructType>\n ? ActionParam.StructType<TStructType>\n : APD[\"type\"] extends keyof DataValueClientToWire\n ? ActionParam.PrimitiveType<APD[\"type\"]>\n : never;\n\ntype MaybeArrayType<APD extends ActionMetadata.Parameter<any>> =\n APD[\"multiplicity\"] extends true ? Array<BaseType<APD>>\n : BaseType<APD>;\n\ntype NotOptionalParams<X extends ActionParametersDefinition> = {\n [P in keyof X]: MaybeArrayType<X[P]>;\n};\n\nexport type OsdkActionParameters<\n X extends ActionParametersDefinition,\n> = NullableProps<X> extends never ? NotOptionalParams<X>\n : PartialBy<NotOptionalParams<X>, NullableProps<X>>;\n\nexport type CompileTimeActionMetadata<\n T extends ActionDefinition<any>,\n> = NonNullable<T[\"__DefinitionMetadata\"]>;\n\nexport type ActionSignatureFromDef<\n T extends ActionDefinition<any>,\n> = {\n applyAction:\n [CompileTimeActionMetadata<T>[\"signatures\"][\"applyAction\"]] extends [never]\n ? ActionSignature<CompileTimeActionMetadata<T>[\"parameters\"]>\n : CompileTimeActionMetadata<T>[\"signatures\"][\"applyAction\"];\n\n batchApplyAction:\n [CompileTimeActionMetadata<T>[\"signatures\"][\"batchApplyAction\"]] extends\n [never] ? BatchActionSignature<CompileTimeActionMetadata<T>[\"parameters\"]>\n : CompileTimeActionMetadata<T>[\"signatures\"][\"batchApplyAction\"];\n};\n\ntype ActionParametersDefinition = Record<\n any,\n ActionMetadata.Parameter<any>\n>;\n\nexport type ActionSignature<\n X extends Record<any, ActionMetadata.Parameter<any>>,\n> = <\n A extends NOOP<OsdkActionParameters<X>>,\n OP extends ApplyActionOptions,\n>(\n args: A,\n options?: OP,\n) => Promise<\n ActionReturnTypeForOptions<OP>\n>;\n\nexport type BatchActionSignature<\n X extends Record<any, ActionMetadata.Parameter<any>>,\n> = <\n A extends NOOP<OsdkActionParameters<X>>[],\n OP extends ApplyBatchActionOptions,\n>(\n args: A,\n options?: OP,\n) => Promise<\n ActionReturnTypeForOptions<OP>\n>;\n\nexport async function applyAction<\n AD extends ActionDefinition<any>,\n P extends\n | OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>\n | OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>[],\n Op extends P extends OsdkActionParameters<\n CompileTimeActionMetadata<AD>[\"parameters\"]\n >[] ? ApplyBatchActionOptions\n : ApplyActionOptions,\n>(\n client: MinimalClient,\n action: AD,\n parameters?: P,\n options: Op = {} as Op,\n): Promise<\n ActionReturnTypeForOptions<Op>\n> {\n const clientWithHeaders = addUserAgentAndRequestContextHeaders(\n augmentRequestContext(client, _ => ({ finalMethodCall: \"applyAction\" })),\n action,\n );\n if (Array.isArray(parameters)) {\n const response = await OntologiesV2.Actions.applyBatch(\n clientWithHeaders,\n await client.ontologyRid,\n action.apiName,\n {\n requests: parameters\n ? await remapBatchActionParams(parameters, client)\n : [],\n options: {\n returnEdits: options?.$returnEdits ? \"ALL\" : \"NONE\",\n },\n },\n );\n\n const edits = response.edits;\n return (options?.$returnEdits\n ? edits?.type === \"edits\" ? remapActionResponse(response) : edits\n : undefined) as ActionReturnTypeForOptions<Op>;\n } else {\n const response = await OntologiesV2.Actions.apply(\n clientWithHeaders,\n await client.ontologyRid,\n action.apiName,\n {\n parameters: await remapActionParams(\n parameters as OsdkActionParameters<\n CompileTimeActionMetadata<AD>[\"parameters\"]\n >,\n client,\n ),\n options: {\n mode: (options as ApplyActionOptions)?.$validateOnly\n ? \"VALIDATE_ONLY\"\n : \"VALIDATE_AND_EXECUTE\",\n returnEdits: options\n ?.$returnEdits\n ? \"ALL\"\n : \"NONE\",\n },\n },\n );\n\n if ((options as ApplyActionOptions)?.$validateOnly) {\n return response.validation as ActionReturnTypeForOptions<Op>;\n }\n\n if (response.validation?.result === \"INVALID\") {\n throw new ActionValidationError(response.validation);\n }\n\n const edits = response.edits;\n return (options?.$returnEdits\n ? edits?.type === \"edits\" ? remapActionResponse(response) : edits\n : undefined) as ActionReturnTypeForOptions<Op>;\n }\n}\n\nasync function remapActionParams<AD extends ActionDefinition<any>>(\n params:\n | OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>\n | undefined,\n client: MinimalClient,\n): Promise<Record<string, DataValue>> {\n if (params == null) {\n return {};\n }\n\n const parameterMap: { [parameterName: string]: unknown } = {};\n for (const [key, value] of Object.entries(params)) {\n parameterMap[key] = await toDataValue(value, client);\n }\n\n return parameterMap;\n}\n\nasync function remapBatchActionParams<\n AD extends ActionDefinition<any>,\n>(\n params: OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>[],\n client: MinimalClient,\n) {\n const remappedParams = await Promise.all(params.map(\n async param => {\n return { parameters: await remapActionParams<AD>(param, client) };\n },\n ));\n\n return remappedParams;\n}\n\nexport function remapActionResponse(\n response: SyncApplyActionResponseV2 | BatchApplyActionResponseV2,\n): ActionEditResponse | undefined {\n const editResponses = response?.edits;\n if (editResponses?.type === \"edits\") {\n const remappedActionResponse: ActionEditResponse = {\n type: editResponses.type,\n deletedLinksCount: editResponses.deletedLinksCount,\n deletedObjectsCount: editResponses.deletedObjectsCount,\n addedLinks: [],\n addedObjects: [],\n modifiedObjects: [],\n editedObjectTypes: [],\n };\n\n const editedObjectTypesSet = new Set<string>();\n for (const edit of editResponses.edits) {\n if (edit.type === \"addLink\") {\n remappedActionResponse.addedLinks.push(\n {\n linkTypeApiNameAtoB: edit.linkTypeApiNameAtoB,\n linkTypeApiNameBtoA: edit.linkTypeApiNameBtoA,\n aSideObject: edit.aSideObject,\n bSideObject: edit.bSideObject,\n },\n );\n editedObjectTypesSet.add(edit.aSideObject.objectType);\n editedObjectTypesSet.add(edit.bSideObject.objectType);\n } else if (edit.type === \"addObject\") {\n remappedActionResponse.addedObjects.push(\n {\n objectType: edit.objectType,\n primaryKey: edit.primaryKey,\n },\n );\n editedObjectTypesSet.add(edit.objectType);\n } else if (edit.type === \"modifyObject\") {\n remappedActionResponse.modifiedObjects.push({\n objectType: edit.objectType,\n primaryKey: edit.primaryKey,\n });\n editedObjectTypesSet.add(edit.objectType);\n } else {\n invariant(false, \"Unknown edit type\");\n }\n }\n remappedActionResponse.editedObjectTypes = [...editedObjectTypesSet];\n return remappedActionResponse;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiBA,OAAO,KAAKA,YAAY,MAAM,0BAA0B;AACxD,OAAOC,SAAS,MAAM,gBAAgB;AAEtC,SAASC,oCAAoC,QAAQ,iDAAiD;AACtG,SAASC,qBAAqB,QAAQ,kCAAkC;AAIxE,SAASC,WAAW,QAAQ,wBAAwB;AACpD,SAASC,qBAAqB,QAAQ,4BAA4B;AAyElE,OAAO,eAAeC,WAAWA,CAU/BC,MAAqB,EACrBC,MAAU,EACVC,UAAc,EACdC,OAAW,GAAG,CAAC,CAAO,EAGtB;EACA,MAAMC,iBAAiB,GAAGT,oCAAoC,CAC5DC,qBAAqB,CAACI,MAAM,EAAE,OAAM;IAAEK,eAAe,EAAE;EAAc,CAAC,CAAC,CAAC,EACxEJ,MACF,CAAC;EACD,IAAIK,KAAK,CAACC,OAAO,CAACL,UAAU,CAAC,EAAE;IAC7B,MAAMM,QAAQ,GAAG,MAAMf,YAAY,CAACgB,OAAO,CAACC,UAAU,CACpDN,iBAAiB,EACjB,MAAMJ,MA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TAL__NOT_SUPPORTED_YET__fetchOneByRid, __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks } from "@osdk/api/unstable";
|
|
18
|
-
import * as OntologiesV2 from "@osdk/
|
|
18
|
+
import * as OntologiesV2 from "@osdk/foundry.ontologies";
|
|
19
19
|
import { symbolClientContext as oldSymbolClientContext } from "@osdk/shared.client";
|
|
20
20
|
import { createBulkLinksAsyncIterFactory } from "./__unstable/createBulkLinksAsyncIterFactory.js";
|
|
21
21
|
import { applyAction } from "./actions/applyAction.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createClient.js","names":["__EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference","__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid","__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks","OntologiesV2","symbolClientContext","oldSymbolClientContext","createBulkLinksAsyncIterFactory","applyAction","additionalContext","createMinimalClient","fetchMetadataInternal","fetchSingle","createObjectSet","applyQuery","ActionInvoker","constructor","clientCtx","actionDef","bind","undefined","batchApplyAction","QueryInvoker","queryDef","executeFunction","createClientInternal","objectSetFactory","baseUrl","ontologyRid","tokenProvider","options","fetchFn","fetch","startsWith","Error","then","fetchMetadata","client","Object","defineProperties","o","type","name","getBulkLinks","fetchOneByRid","objectType","rid","createWithRid","createMediaReference","args","data","fileName","objectTypeApi","propertyTypeApi","MediaReferenceProperties","upload","mediaItemPath","preview","value","createClient"],"sources":["createClient.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n InterfaceDefinition,\n NullabilityAdherence,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n PropertyKeys,\n QueryDefinition,\n SelectArg,\n} from \"@osdk/api\";\nimport type {\n Experiment,\n ExperimentFns,\n MinimalObjectSet,\n} from \"@osdk/api/unstable\";\nimport {\n __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks,\n} from \"@osdk/api/unstable\";\nimport type { ObjectSet as WireObjectSet } from \"@osdk/internal.foundry.core\";\nimport * as OntologiesV2 from \"@osdk/internal.foundry.ontologiesv2\";\nimport { symbolClientContext as oldSymbolClientContext } from \"@osdk/shared.client\";\nimport { createBulkLinksAsyncIterFactory } from \"./__unstable/createBulkLinksAsyncIterFactory.js\";\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.js\";\nimport { applyAction } from \"./actions/applyAction.js\";\nimport { additionalContext, type Client } from \"./Client.js\";\nimport { createMinimalClient } from \"./createMinimalClient.js\";\nimport { fetchMetadataInternal } from \"./fetchMetadata.js\";\nimport type { Logger } from \"./Logger.js\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport { fetchSingle } from \"./object/fetchSingle.js\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport type { ObjectSetFactory } from \"./objectSet/ObjectSetFactory.js\";\nimport { applyQuery } from \"./queries/applyQuery.js\";\nimport type { QuerySignatureFromDef } from \"./queries/types.js\";\n\n// We import it this way to keep compatible with CJS. If we referenced the\n// value of `symbolClientContext` directly, then we would have to a dynamic import\n// in `createClientInternal` which would make it async and a break.\n// Since this is just a string in `@osdk/shared.client2` instead of a symbol,\n// we can safely perform this trick.\ntype newSymbolClientContext =\n // eslint-disable-next-line @typescript-eslint/consistent-type-imports\n typeof import(\"@osdk/shared.client2\").symbolClientContext;\n\nclass ActionInvoker<Q extends ActionDefinition<any>>\n implements ActionSignatureFromDef<Q>\n{\n constructor(\n clientCtx: MinimalClient,\n actionDef: ActionDefinition<any>,\n ) {\n // We type the property as a generic function as binding `applyAction`\n // doesn't return a type thats all that useful anyway\n // The implements covers us for the most part here as this exact type doesn't\n // escape this file\n this.applyAction = applyAction.bind(undefined, clientCtx, actionDef);\n this.batchApplyAction = applyAction.bind(undefined, clientCtx, actionDef);\n }\n\n applyAction: (...args: any[]) => any;\n batchApplyAction: (...args: any[]) => any;\n}\n\nclass QueryInvoker<Q extends QueryDefinition<any>>\n implements QuerySignatureFromDef<Q>\n{\n constructor(\n clientCtx: MinimalClient,\n queryDef: QueryDefinition<any>,\n ) {\n this.executeFunction = applyQuery.bind(undefined, clientCtx, queryDef);\n }\n\n executeFunction: (...args: any[]) => any;\n}\n\n/** @internal */\nexport function createClientInternal(\n objectSetFactory: ObjectSetFactory<any, any>, // first so i can bind\n baseUrl: string,\n ontologyRid: string | Promise<string>,\n tokenProvider: () => Promise<string>,\n options: { logger?: Logger } | undefined = undefined,\n fetchFn: typeof globalThis.fetch = fetch,\n): Client {\n if (typeof ontologyRid === \"string\") {\n if (!ontologyRid.startsWith(\"ri.\")) {\n throw new Error(\"Invalid ontology RID\");\n }\n } else {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n ontologyRid.then((ontologyRid) => {\n if (!ontologyRid.startsWith(\"ri.\")) {\n // FIXME this promise is not await so this just shows up as an unhandled promise rejection\n throw new Error(\"Invalid ontology RID\");\n }\n });\n }\n\n const clientCtx: MinimalClient = createMinimalClient(\n { ontologyRid },\n baseUrl,\n tokenProvider,\n options,\n fetchFn,\n objectSetFactory,\n );\n\n function clientFn<\n T extends\n | ObjectOrInterfaceDefinition\n | ActionDefinition<any>\n | QueryDefinition<any>\n | Experiment<\"2.0.8\">\n | Experiment<\"2.1.0\">,\n >(o: T): T extends ObjectTypeDefinition ? ObjectSet<T>\n : T extends InterfaceDefinition ? MinimalObjectSet<T>\n : T extends ActionDefinition<any> ? ActionSignatureFromDef<T>\n : T extends QueryDefinition<any> ? QuerySignatureFromDef<T>\n : T extends Experiment<\"2.0.8\"> | Experiment<\"2.1.0\">\n ? { invoke: ExperimentFns<T> }\n : never\n {\n if (o.type === \"object\" || o.type === \"interface\") {\n return objectSetFactory(o, clientCtx) as any;\n } else if (o.type === \"action\") {\n return new ActionInvoker(\n clientCtx,\n o,\n ) as (T extends ActionDefinition<any>\n // first `as` to the action definition for our \"real\" typecheck\n ? ActionSignatureFromDef<T>\n : never) as any; // then as any for dealing with the conditional return value\n } else if (o.type === \"query\") {\n return new QueryInvoker(\n clientCtx,\n o,\n ) as (T extends QueryDefinition<any> ? QuerySignatureFromDef<T>\n : never) as any;\n } else if (o.type === \"experiment\") {\n switch (o.name) {\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks.name:\n return {\n getBulkLinks: createBulkLinksAsyncIterFactory(\n clientCtx,\n ),\n } as any;\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid.name:\n return {\n fetchOneByRid: async <\n Q extends ObjectTypeDefinition,\n const L extends PropertyKeys<Q>,\n const R extends boolean,\n const S extends false | \"throw\" = NullabilityAdherence.Default,\n >(\n objectType: Q,\n rid: string,\n options: SelectArg<Q, L, R, S>,\n ) => {\n return await fetchSingle(\n clientCtx,\n objectType,\n options,\n createWithRid(\n rid,\n ),\n ) as Osdk<Q>;\n },\n } as any;\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference.name:\n return {\n createMediaReference: async (args: {\n data: Blob;\n fileName: string;\n objectTypeApi: string;\n propertyTypeApi: string;\n }) => {\n const { data, fileName, objectTypeApi, propertyTypeApi } = args;\n return await OntologiesV2.MediaReferenceProperties.upload(\n clientCtx,\n await clientCtx.ontologyRid,\n objectTypeApi,\n propertyTypeApi,\n data,\n {\n mediaItemPath: fileName,\n preview: true,\n },\n );\n },\n } as any;\n }\n\n throw new Error(\"not implemented\");\n } else {\n throw new Error(\"not implemented\");\n }\n }\n\n const fetchMetadata = fetchMetadataInternal.bind(\n undefined,\n clientCtx,\n );\n\n const symbolClientContext: newSymbolClientContext = \"__osdkClientContext\";\n\n const client: Client = Object.defineProperties<Client>(\n clientFn as Client,\n {\n [oldSymbolClientContext]: {\n value: clientCtx,\n },\n [symbolClientContext]: {\n value: clientCtx,\n },\n [additionalContext]: {\n value: clientCtx,\n },\n fetchMetadata: {\n value: fetchMetadata,\n },\n } satisfies Record<keyof Client, PropertyDescriptor>,\n );\n\n return client;\n}\n\nexport const createClient: (\n baseUrl: string,\n ontologyRid: string | Promise<string>,\n tokenProvider: () => Promise<string>,\n options?: {\n logger?: Logger;\n } | undefined,\n fetchFn?: typeof fetch | undefined,\n) => Client = createClientInternal.bind(\n undefined,\n createObjectSet,\n);\n\nfunction createWithRid(\n rid: string,\n) {\n const withRid: WireObjectSet = {\n type: \"static\",\n \"objects\": [rid],\n };\n\n return withRid;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAmBA,SACEA,uDAAuD,EACvDC,gDAAgD,EAChDC,+CAA+C,QAC1C,oBAAoB;AAE3B,OAAO,KAAKC,YAAY,MAAM,qCAAqC;AACnE,SAASC,mBAAmB,IAAIC,sBAAsB,QAAQ,qBAAqB;AACnF,SAASC,+BAA+B,QAAQ,iDAAiD;AAEjG,SAASC,WAAW,QAAQ,0BAA0B;AACtD,SAASC,iBAAiB,QAAqB,aAAa;AAC5D,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,SAASC,qBAAqB,QAAQ,oBAAoB;AAG1D,SAASC,WAAW,QAAQ,yBAAyB;AACrD,SAASC,eAAe,QAAQ,gCAAgC;AAEhE,SAASC,UAAU,QAAQ,yBAAyB;;AAGpD;AACA;AACA;AACA;AACA;;AAKA,MAAMC,aAAa,CAEnB;EACEC,WAAWA,CACTC,SAAwB,EACxBC,SAAgC,EAChC;I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AAC,iBAAiB,CAAC;IACpC,CAAC,MAAM;MACL,MAAM,IAAIA,KAAK,CAAC,iBAAiB,CAAC;IACpC;EACF,CAAC,EAWC;IACE,CAAC5B,sBAAsB,GAAG;MACxBoD,KAAK,EAAEzC;IACT,CAAC;IACD,CARgD,qBAAqB,GAQ9C;MACrByC,KAAK,EAAEzC;IACT,CAAC;IACD,CAACR,iBAAiB,GAAG;MACnBiD,KAAK,EAAEzC;IACT,CAAC;IACDmB,aAAa,EAAE;MACbsB,KAAK,EAAEtB;IACT;EACF,CACF,CAAC;EAED,OAAOC,MAAM;AACf;AAEA,OAAO,MAAMsB,YAQF,GAAGlC,oBAAoB,CAACN,IAAI,CACrCC,SAAS,EACTP,eACF,CAAC;AAED,SAASkC,aAAaA,CACpBD,GAAW,EACX;EAMA,OAL+B;IAC7BL,IAAI,EAAE,QAAQ;IACd,SAAS,EAAE,CAACK,GAAG;EACjB,CAAC;AAGH","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"createClient.js","names":["__EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference","__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid","__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks","OntologiesV2","symbolClientContext","oldSymbolClientContext","createBulkLinksAsyncIterFactory","applyAction","additionalContext","createMinimalClient","fetchMetadataInternal","fetchSingle","createObjectSet","applyQuery","ActionInvoker","constructor","clientCtx","actionDef","bind","undefined","batchApplyAction","QueryInvoker","queryDef","executeFunction","createClientInternal","objectSetFactory","baseUrl","ontologyRid","tokenProvider","options","fetchFn","fetch","startsWith","Error","then","fetchMetadata","client","Object","defineProperties","o","type","name","getBulkLinks","fetchOneByRid","objectType","rid","createWithRid","createMediaReference","args","data","fileName","objectTypeApi","propertyTypeApi","MediaReferenceProperties","upload","mediaItemPath","preview","value","createClient"],"sources":["createClient.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n InterfaceDefinition,\n NullabilityAdherence,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n PropertyKeys,\n QueryDefinition,\n SelectArg,\n} from \"@osdk/api\";\nimport type {\n Experiment,\n ExperimentFns,\n MinimalObjectSet,\n} from \"@osdk/api/unstable\";\nimport {\n __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks,\n} from \"@osdk/api/unstable\";\nimport type { ObjectSet as WireObjectSet } from \"@osdk/foundry.ontologies\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport { symbolClientContext as oldSymbolClientContext } from \"@osdk/shared.client\";\nimport { createBulkLinksAsyncIterFactory } from \"./__unstable/createBulkLinksAsyncIterFactory.js\";\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.js\";\nimport { applyAction } from \"./actions/applyAction.js\";\nimport { additionalContext, type Client } from \"./Client.js\";\nimport { createMinimalClient } from \"./createMinimalClient.js\";\nimport { fetchMetadataInternal } from \"./fetchMetadata.js\";\nimport type { Logger } from \"./Logger.js\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport { fetchSingle } from \"./object/fetchSingle.js\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport type { ObjectSetFactory } from \"./objectSet/ObjectSetFactory.js\";\nimport { applyQuery } from \"./queries/applyQuery.js\";\nimport type { QuerySignatureFromDef } from \"./queries/types.js\";\n\n// We import it this way to keep compatible with CJS. If we referenced the\n// value of `symbolClientContext` directly, then we would have to a dynamic import\n// in `createClientInternal` which would make it async and a break.\n// Since this is just a string in `@osdk/shared.client2` instead of a symbol,\n// we can safely perform this trick.\ntype newSymbolClientContext =\n // eslint-disable-next-line @typescript-eslint/consistent-type-imports\n typeof import(\"@osdk/shared.client2\").symbolClientContext;\n\nclass ActionInvoker<Q extends ActionDefinition<any>>\n implements ActionSignatureFromDef<Q>\n{\n constructor(\n clientCtx: MinimalClient,\n actionDef: ActionDefinition<any>,\n ) {\n // We type the property as a generic function as binding `applyAction`\n // doesn't return a type thats all that useful anyway\n // The implements covers us for the most part here as this exact type doesn't\n // escape this file\n this.applyAction = applyAction.bind(undefined, clientCtx, actionDef);\n this.batchApplyAction = applyAction.bind(undefined, clientCtx, actionDef);\n }\n\n applyAction: (...args: any[]) => any;\n batchApplyAction: (...args: any[]) => any;\n}\n\nclass QueryInvoker<Q extends QueryDefinition<any>>\n implements QuerySignatureFromDef<Q>\n{\n constructor(\n clientCtx: MinimalClient,\n queryDef: QueryDefinition<any>,\n ) {\n this.executeFunction = applyQuery.bind(undefined, clientCtx, queryDef);\n }\n\n executeFunction: (...args: any[]) => any;\n}\n\n/** @internal */\nexport function createClientInternal(\n objectSetFactory: ObjectSetFactory<any, any>, // first so i can bind\n baseUrl: string,\n ontologyRid: string | Promise<string>,\n tokenProvider: () => Promise<string>,\n options: { logger?: Logger } | undefined = undefined,\n fetchFn: typeof globalThis.fetch = fetch,\n): Client {\n if (typeof ontologyRid === \"string\") {\n if (!ontologyRid.startsWith(\"ri.\")) {\n throw new Error(\"Invalid ontology RID\");\n }\n } else {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n ontologyRid.then((ontologyRid) => {\n if (!ontologyRid.startsWith(\"ri.\")) {\n // FIXME this promise is not await so this just shows up as an unhandled promise rejection\n throw new Error(\"Invalid ontology RID\");\n }\n });\n }\n\n const clientCtx: MinimalClient = createMinimalClient(\n { ontologyRid },\n baseUrl,\n tokenProvider,\n options,\n fetchFn,\n objectSetFactory,\n );\n\n function clientFn<\n T extends\n | ObjectOrInterfaceDefinition\n | ActionDefinition<any>\n | QueryDefinition<any>\n | Experiment<\"2.0.8\">\n | Experiment<\"2.1.0\">,\n >(o: T): T extends ObjectTypeDefinition ? ObjectSet<T>\n : T extends InterfaceDefinition ? MinimalObjectSet<T>\n : T extends ActionDefinition<any> ? ActionSignatureFromDef<T>\n : T extends QueryDefinition<any> ? QuerySignatureFromDef<T>\n : T extends Experiment<\"2.0.8\"> | Experiment<\"2.1.0\">\n ? { invoke: ExperimentFns<T> }\n : never\n {\n if (o.type === \"object\" || o.type === \"interface\") {\n return objectSetFactory(o, clientCtx) as any;\n } else if (o.type === \"action\") {\n return new ActionInvoker(\n clientCtx,\n o,\n ) as (T extends ActionDefinition<any>\n // first `as` to the action definition for our \"real\" typecheck\n ? ActionSignatureFromDef<T>\n : never) as any; // then as any for dealing with the conditional return value\n } else if (o.type === \"query\") {\n return new QueryInvoker(\n clientCtx,\n o,\n ) as (T extends QueryDefinition<any> ? QuerySignatureFromDef<T>\n : never) as any;\n } else if (o.type === \"experiment\") {\n switch (o.name) {\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks.name:\n return {\n getBulkLinks: createBulkLinksAsyncIterFactory(\n clientCtx,\n ),\n } as any;\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid.name:\n return {\n fetchOneByRid: async <\n Q extends ObjectTypeDefinition,\n const L extends PropertyKeys<Q>,\n const R extends boolean,\n const S extends false | \"throw\" = NullabilityAdherence.Default,\n >(\n objectType: Q,\n rid: string,\n options: SelectArg<Q, L, R, S>,\n ) => {\n return await fetchSingle(\n clientCtx,\n objectType,\n options,\n createWithRid(\n rid,\n ),\n ) as Osdk<Q>;\n },\n } as any;\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference.name:\n return {\n createMediaReference: async (args: {\n data: Blob;\n fileName: string;\n objectTypeApi: string;\n propertyTypeApi: string;\n }) => {\n const { data, fileName, objectTypeApi, propertyTypeApi } = args;\n return await OntologiesV2.MediaReferenceProperties.upload(\n clientCtx,\n await clientCtx.ontologyRid,\n objectTypeApi,\n propertyTypeApi,\n data,\n {\n mediaItemPath: fileName,\n preview: true,\n },\n );\n },\n } as any;\n }\n\n throw new Error(\"not implemented\");\n } else {\n throw new Error(\"not implemented\");\n }\n }\n\n const fetchMetadata = fetchMetadataInternal.bind(\n undefined,\n clientCtx,\n );\n\n const symbolClientContext: newSymbolClientContext = \"__osdkClientContext\";\n\n const client: Client = Object.defineProperties<Client>(\n clientFn as Client,\n {\n [oldSymbolClientContext]: {\n value: clientCtx,\n },\n [symbolClientContext]: {\n value: clientCtx,\n },\n [additionalContext]: {\n value: clientCtx,\n },\n fetchMetadata: {\n value: fetchMetadata,\n },\n } satisfies Record<keyof Client, PropertyDescriptor>,\n );\n\n return client;\n}\n\nexport const createClient: (\n baseUrl: string,\n ontologyRid: string | Promise<string>,\n tokenProvider: () => Promise<string>,\n options?: {\n logger?: Logger;\n } | undefined,\n fetchFn?: typeof fetch | undefined,\n) => Client = createClientInternal.bind(\n undefined,\n createObjectSet,\n);\n\nfunction createWithRid(\n rid: string,\n) {\n const withRid: WireObjectSet = {\n type: \"static\",\n \"objects\": [rid],\n };\n\n return withRid;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAmBA,SACEA,uDAAuD,EACvDC,gDAAgD,EAChDC,+CAA+C,QAC1C,oBAAoB;AAE3B,OAAO,KAAKC,YAAY,MAAM,0BAA0B;AACxD,SAASC,mBAAmB,IAAIC,sBAAsB,QAAQ,qBAAqB;AACnF,SAASC,+BAA+B,QAAQ,iDAAiD;AAEjG,SAASC,WAAW,QAAQ,0BAA0B;AACtD,SAASC,iBAAiB,QAAqB,aAAa;AAC5D,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,SAASC,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,CAACkD,wBAAwB,CAACC,MAAM,CACvDtC,SAAS,EACT,MAAMA,SAAS,CAACW,WAAW,EAC3BwB,aAAa,EACbC,eAAe,EACfH,IAAI,EACJ;gBACEM,aAAa,EAAEL,QAAQ;gBACvBM,OAAO,EAAE;cACX,CACF,CAAC;YACH;UACF,CAAC;MACL;MAEA,MAAM,IAAIvB,KAAK,CAAC,iBAAiB,CAAC;IACpC,CAAC,MAAM;MACL,MAAM,IAAIA,KAAK,CAAC,iBAAiB,CAAC;IACpC;EACF,CAAC,EAWC;IACE,CAAC5B,sBAAsB,GAAG;MACxBoD,KAAK,EAAEzC;IACT,CAAC;IACD,CARgD,qBAAqB,GAQ9C;MACrByC,KAAK,EAAEzC;IACT,CAAC;IACD,CAACR,iBAAiB,GAAG;MACnBiD,KAAK,EAAEzC;IACT,CAAC;IACDmB,aAAa,EAAE;MACbsB,KAAK,EAAEtB;IACT;EACF,CACF,CAAC;EAED,OAAOC,MAAM;AACf;AAEA,OAAO,MAAMsB,YAQF,GAAGlC,oBAAoB,CAACN,IAAI,CACrCC,SAAS,EACTP,eACF,CAAC;AAED,SAASkC,aAAaA,CACpBD,GAAW,EACX;EAMA,OAL+B;IAC7BL,IAAI,EAAE,QAAQ;IACd,SAAS,EAAE,CAACK,GAAG;EACjB,CAAC;AAGH","ignoreList":[]}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import * as OntologiesV2 from "@osdk/
|
|
17
|
+
import * as OntologiesV2 from "@osdk/foundry.ontologies";
|
|
18
18
|
import { asyncIterPointsHelper, getTimeRange } from "./util/timeseriesUtils.js";
|
|
19
19
|
export class GeotimeSeriesPropertyImpl {
|
|
20
20
|
#triplet;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createGeotimeSeriesProperty.js","names":["OntologiesV2","asyncIterPointsHelper","getTimeRange","GeotimeSeriesPropertyImpl","triplet","client","constructor","objectApiName","primaryKey","propertyName","initialValue","lastFetchedValue","getLatestValue","latestPointPromise","TimeSeriesValueBankProperties","ontologyRid","then","latestPoint","err","console","error","getAllValues","query","allPoints","point","asyncIterValues","push","streamPointsIterator","streamValues","range","timeseriesPoint"],"sources":["createGeotimeSeriesProperty.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 GeotimeSeriesProperty,\n TimeSeriesPoint,\n TimeSeriesQuery,\n} from \"@osdk/api\";\nimport * as OntologiesV2 from \"@osdk/
|
|
1
|
+
{"version":3,"file":"createGeotimeSeriesProperty.js","names":["OntologiesV2","asyncIterPointsHelper","getTimeRange","GeotimeSeriesPropertyImpl","triplet","client","constructor","objectApiName","primaryKey","propertyName","initialValue","lastFetchedValue","getLatestValue","latestPointPromise","TimeSeriesValueBankProperties","ontologyRid","then","latestPoint","err","console","error","getAllValues","query","allPoints","point","asyncIterValues","push","streamPointsIterator","streamValues","range","timeseriesPoint"],"sources":["createGeotimeSeriesProperty.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 GeotimeSeriesProperty,\n TimeSeriesPoint,\n TimeSeriesQuery,\n} from \"@osdk/api\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport { asyncIterPointsHelper, getTimeRange } from \"./util/timeseriesUtils.js\";\n\nexport class GeotimeSeriesPropertyImpl<T extends GeoJSON.Point>\n implements GeotimeSeriesProperty<T>\n{\n #triplet: [string, any, string];\n #client: MinimalClient;\n lastFetchedValue: TimeSeriesPoint<T> | undefined;\n\n constructor(\n client: MinimalClient,\n objectApiName: string,\n primaryKey: any,\n propertyName: string,\n initialValue?: TimeSeriesPoint<T>,\n ) {\n this.#client = client;\n this.#triplet = [objectApiName, primaryKey, propertyName];\n if (initialValue != null) {\n this.lastFetchedValue = initialValue;\n }\n }\n\n public async getLatestValue(): Promise<TimeSeriesPoint<T> | undefined> {\n const latestPointPromise = OntologiesV2.TimeSeriesValueBankProperties\n .getLatestValue(\n this.#client,\n await this.#client.ontologyRid,\n ...this.#triplet,\n );\n latestPointPromise.then(\n latestPoint => this.lastFetchedValue = latestPoint,\n // eslint-disable-next-line no-console\n err => void console.error(err),\n );\n return latestPointPromise;\n }\n\n public async getAllValues(\n query?: TimeSeriesQuery,\n ): Promise<TimeSeriesPoint<T>[]> {\n const allPoints: Array<TimeSeriesPoint<T>> = [];\n\n for await (const point of this.asyncIterValues(query)) {\n allPoints.push(point);\n }\n return allPoints;\n }\n\n public async *asyncIterValues(\n query?: TimeSeriesQuery,\n ): AsyncGenerator<\n {\n time: any;\n value: T;\n },\n void,\n unknown\n > {\n const streamPointsIterator = await OntologiesV2\n .TimeSeriesValueBankProperties.streamValues(\n this.#client,\n await this.#client.ontologyRid,\n ...this.#triplet,\n query ? { range: getTimeRange(query) } : {},\n );\n\n for await (\n const timeseriesPoint of asyncIterPointsHelper<T>(streamPointsIterator)\n ) {\n yield timeseriesPoint;\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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I,CAAC,CAACvB,MAAM,EACZ,MAAM,IAAI,CAAC,CAACA,MAAM,CAACU,WAAW,EAC9B,GAAG,IAAI,CAAC,CAACX,OAAO,EAChBkB,KAAK,GAAG;MAAEO,KAAK,EAAE3B,YAAY,CAACoB,KAAK;IAAE,CAAC,GAAG,CAAC,CAC5C,CAAC;IAEH,WACE,MAAMQ,eAAe,IAAI7B,qBAAqB,CAAI0B,oBAAoB,CAAC,EACvE;MACA,MAAMG,eAAe;IACvB;EACF;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createMediaReferenceProperty.js","names":["OntologiesV2","MediaReferencePropertyImpl","triplet","client","constructor","args","objectApiName","primaryKey","propertyName","fetchContents","MediaReferenceProperties","getMediaContent","ontologyRid","preview","fetchMetadata","r","getMediaMetadata","path","sizeBytes","Number","mediaType"],"sources":["createMediaReferenceProperty.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 { Media, MediaMetadata } from \"@osdk/api\";\nimport * as OntologiesV2 from \"@osdk/
|
|
1
|
+
{"version":3,"file":"createMediaReferenceProperty.js","names":["OntologiesV2","MediaReferencePropertyImpl","triplet","client","constructor","args","objectApiName","primaryKey","propertyName","fetchContents","MediaReferenceProperties","getMediaContent","ontologyRid","preview","fetchMetadata","r","getMediaMetadata","path","sizeBytes","Number","mediaType"],"sources":["createMediaReferenceProperty.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 { Media, MediaMetadata } from \"@osdk/api\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\n\nexport class MediaReferencePropertyImpl implements Media {\n #triplet: [string, any, string];\n #client: MinimalClient;\n\n constructor(args: {\n client: MinimalClient;\n objectApiName: string;\n primaryKey: any;\n propertyName: string;\n }) {\n const { client, objectApiName, primaryKey, propertyName } = args;\n this.#client = client;\n this.#triplet = [objectApiName, primaryKey, propertyName];\n }\n\n public async fetchContents(): Promise<Response> {\n return OntologiesV2.MediaReferenceProperties.getMediaContent(\n this.#client,\n await this.#client.ontologyRid,\n ...this.#triplet,\n {\n preview: true, // TODO: Can turn this back off when backend is no longer in beta.\n },\n );\n }\n\n public async fetchMetadata(): Promise<MediaMetadata> {\n const r = await OntologiesV2.MediaReferenceProperties.getMediaMetadata(\n this.#client,\n await this.#client.ontologyRid,\n ...this.#triplet,\n {\n preview: true, // TODO: Can turn this back off when backend is no longer in beta.\n },\n );\n return {\n path: r.path as string,\n sizeBytes: Number(r.sizeBytes),\n mediaType: r.mediaType,\n };\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAO,KAAKA,YAAY,MAAM,0BAA0B;AAGxD,OAAO,MAAMC,0BAA0B,CAAkB;EACvD,CAACC,OAAO;EACR,CAACC,MAAM;EAEPC,WAAWA,CAACC,IAKX,EAAE;IACD,MAAM;MAAEF,MAAM;MAAEG,aAAa;MAAEC,UAAU;MAAEC;IAAa,CAAC,GAAGH,IAAI;IAChE,IAAI,CAAC,CAACF,MAAM,GAAGA,MAAM;IACrB,IAAI,CAAC,CAACD,OAAO,GAAG,CAACI,aAAa,EAAEC,UAAU,EAAEC,YAAY,CAAC;EAC3D;EAEA,MAAaC,aAAaA,CAAA,EAAsB;IAC9C,OAAOT,YAAY,CAACU,wBAAwB,CAACC,eAAe,CAC1D,IAAI,CAAC,CAACR,MAAM,EACZ,MAAM,IAAI,CAAC,CAACA,MAAM,CAACS,WAAW,EAC9B,GAAG,IAAI,CAAC,CAACV,OAAO,EAChB;MACEW,OAAO,EAAE,IAAI,CAAE;IACjB,CACF,CAAC;EACH;EAEA,MAAaC,aAAaA,CAAA,EAA2B;IACnD,MAAMC,CAAC,GAAG,MAAMf,YAAY,CAACU,wBAAwB,CAACM,gBAAgB,CACpE,IAAI,CAAC,CAACb,MAAM,EACZ,MAAM,IAAI,CAAC,CAACA,MAAM,CAACS,WAAW,EAC9B,GAAG,IAAI,CAAC,CAACV,OAAO,EAChB;MACEW,OAAO,EAAE,IAAI,CAAE;IACjB,CACF,CAAC;IACD,OAAO;MACLI,IAAI,EAAEF,CAAC,CAACE,IAAc;MACtBC,SAAS,EAAEC,MAAM,CAACJ,CAAC,CAACG,SAAS,CAAC;MAC9BE,SAAS,EAAEL,CAAC,CAACK;IACf,CAAC;EACH;AACF","ignoreList":[]}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import * as OntologiesV2 from "@osdk/
|
|
17
|
+
import * as OntologiesV2 from "@osdk/foundry.ontologies";
|
|
18
18
|
import { asyncIterPointsHelper, getTimeRange } from "./util/timeseriesUtils.js";
|
|
19
19
|
export class TimeSeriesPropertyImpl {
|
|
20
20
|
#triplet;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTimeseriesProperty.js","names":["OntologiesV2","asyncIterPointsHelper","getTimeRange","TimeSeriesPropertyImpl","triplet","client","constructor","objectApiName","primaryKey","propertyName","getFirstPoint","TimeSeriesPropertiesV2","ontologyRid","getLastPoint","getAllPoints","query","allPoints","point","asyncIterPoints","push","streamPointsIterator","streamPoints","range","timeseriesPoint"],"sources":["createTimeseriesProperty.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 TimeSeriesPoint,\n TimeSeriesProperty,\n TimeSeriesQuery,\n} from \"@osdk/api\";\nimport * as OntologiesV2 from \"@osdk/
|
|
1
|
+
{"version":3,"file":"createTimeseriesProperty.js","names":["OntologiesV2","asyncIterPointsHelper","getTimeRange","TimeSeriesPropertyImpl","triplet","client","constructor","objectApiName","primaryKey","propertyName","getFirstPoint","TimeSeriesPropertiesV2","ontologyRid","getLastPoint","getAllPoints","query","allPoints","point","asyncIterPoints","push","streamPointsIterator","streamPoints","range","timeseriesPoint"],"sources":["createTimeseriesProperty.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 TimeSeriesPoint,\n TimeSeriesProperty,\n TimeSeriesQuery,\n} from \"@osdk/api\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport { asyncIterPointsHelper, getTimeRange } from \"./util/timeseriesUtils.js\";\n\nexport class TimeSeriesPropertyImpl<T extends number | string>\n implements TimeSeriesProperty<T>\n{\n #triplet: [string, any, string];\n #client: MinimalClient;\n\n constructor(\n client: MinimalClient,\n objectApiName: string,\n primaryKey: any,\n propertyName: string,\n ) {\n this.#client = client;\n this.#triplet = [objectApiName, primaryKey, propertyName];\n }\n\n public async getFirstPoint(): Promise<TimeSeriesPoint<T>> {\n return OntologiesV2.TimeSeriesPropertiesV2.getFirstPoint(\n this.#client,\n await this.#client.ontologyRid,\n ...this.#triplet,\n ) as Promise<TimeSeriesPoint<T>>;\n }\n\n public async getLastPoint(): Promise<TimeSeriesPoint<T>> {\n return OntologiesV2.TimeSeriesPropertiesV2.getLastPoint(\n this.#client,\n await this.#client.ontologyRid,\n ...this.#triplet,\n ) as Promise<TimeSeriesPoint<T>>;\n }\n\n public async getAllPoints(\n query?: TimeSeriesQuery,\n ): Promise<TimeSeriesPoint<T>[]> {\n const allPoints: Array<TimeSeriesPoint<T>> = [];\n\n for await (const point of this.asyncIterPoints(query)) {\n allPoints.push(point);\n }\n return allPoints;\n }\n\n public async *asyncIterPoints(\n query?: TimeSeriesQuery,\n ): AsyncGenerator<\n {\n time: any;\n value: T;\n },\n void,\n unknown\n > {\n const streamPointsIterator = await OntologiesV2.TimeSeriesPropertiesV2\n .streamPoints(\n this.#client,\n await this.#client.ontologyRid,\n ...this.#triplet,\n query ? { range: getTimeRange(query) } : {},\n );\n\n for await (\n const timeseriesPoint of asyncIterPointsHelper<T>(streamPointsIterator)\n ) {\n yield timeseriesPoint;\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA,OAAO,KAAKA,YAAY,MAAM,0BAA0B;AAExD,SAASC,qBAAqB,EAAEC,YAAY,QAAQ,2BAA2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;IAEH,WACE,MAAMQ,eAAe,IAAItB,qBAAqB,CAAImB,oBAAoB,CAAC,EACvE;MACA,MAAMG,eAAe;IACvB;EACF;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createWithPropertiesObjectSet.js","names":["invariant","modernToLegacyWhereClause","idCounter","createWithPropertiesObjectSet","objectType","objectSet","definitionMap","pivotTo","link","type","where","clause","aggregate","aggregation","opt","splitAggregation","split","length","process","env","NODE_ENV","aggregationPropertyName","aggregationOperation","aggregationOperationDefinition","selectedPropertyApiName","approximatePercentile","percentile","limit","undefined","selectorResult","set","operation","selectProperty","name"],"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/
|
|
1
|
+
{"version":3,"file":"createWithPropertiesObjectSet.js","names":["invariant","modernToLegacyWhereClause","idCounter","createWithPropertiesObjectSet","objectType","objectSet","definitionMap","pivotTo","link","type","where","clause","aggregate","aggregation","opt","splitAggregation","split","length","process","env","NODE_ENV","aggregationPropertyName","aggregationOperation","aggregationOperationDefinition","selectedPropertyApiName","approximatePercentile","percentile","limit","undefined","selectorResult","set","operation","selectProperty","name"],"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\";\n\nconst idCounter = 0;\n\n/** @internal */\nexport function createWithPropertiesObjectSet<\n Q extends ObjectOrInterfaceDefinition,\n>(\n objectType: Q,\n objectSet: WireObjectSet,\n definitionMap: Map<any, DerivedPropertyDefinition>,\n): DerivedProperty.SelectPropertyBuilder<Q, false> {\n const base: DerivedProperty.SelectPropertyBuilder<Q, false> = {\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 selectorResult: DerivedProperty.SelectorResult<any> = { type: {} };\n definitionMap.set(selectorResult, {\n type: \"selection\",\n objectSet: objectSet,\n operation: aggregationOperationDefinition,\n });\n return selectorResult;\n },\n selectProperty: (name) => {\n const selectorResult: DerivedProperty.SelectorResult<any> = { type: {} };\n definitionMap.set(selectorResult, {\n type: \"selection\",\n objectSet: objectSet,\n operation: {\n type: \"get\",\n selectedPropertyApiName: name,\n },\n });\n return selectorResult;\n },\n };\n\n return base;\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;AAEhG,MAAMC,SAAS,GAAG,CAAC;;AAEnB;AACA,OAAO,SAASC,6BAA6BA,CAG3CC,UAAa,EACbC,SAAwB,EACxBC,aAAkD,EACD;EAsFjD,OArF8D;IAC5DC,OAAO,EAAGC,IAAI,IAAK;MACjB,OAAOL,6BAA6B,CAACC,UAAU,EAAE;QAC/CK,IAAI,EAAE,cAAc;QACpBJ,SAAS;QACTG;MACF,CAAC,EAAEF,aAAa,CAAC;IACnB,CAAC;IACDI,KAAK,EAAGC,MAAM,IAAK;MACjB,OAAOR,6BAA6B,CAACC,UAAU,EAAE;QAC/CK,IAAI,EAAE,QAAQ;QACdJ,SAAS,EAAEA,SAAS;QACpBK,KAAK,EA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gC,GAAGsB,oBAAoB,IAFzDtB,SAAS;MAIb;MACA,MAAM6B,cAAmD,GAAG;QAAEpB,IAAI,EAAE,CAAC;MAAE,CAAC;MACxEH,aAAa,CAACwB,GAAG,CAACD,cAAc,EAAE;QAChCpB,IAAI,EAAE,WAAW;QACjBJ,SAAS,EAAEA,SAAS;QACpB0B,SAAS,EAAER;MACb,CAAC,CAAC;MACF,OAAOM,cAAc;IACvB,CAAC;IACDG,cAAc,EAAGC,IAAI,IAAK;MACxB,MAAMJ,cAAmD,GAAG;QAAEpB,IAAI,EAAE,CAAC;MAAE,CAAC;MACxEH,aAAa,CAACwB,GAAG,CAACD,cAAc,EAAE;QAChCpB,IAAI,EAAE,WAAW;QACjBJ,SAAS,EAAEA,SAAS;QACpB0B,SAAS,EAAE;UACTtB,IAAI,EAAE,KAAK;UACXe,uBAAuB,EAAES;QAC3B;MACF,CAAC,CAAC;MACF,OAAOJ,cAAc;IACvB;EACF,CAAC;AAGH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createWithPropertiesObjectSet.test.js","names":["Employee","describe","expect","it","createWithPropertiesObjectSet","map","Map","deriveObjectSet","type","result","base","pivotTo","selectProperty","definition","get","toMatchInlineSnapshot","clause","aggregate","percentile","limit","secondResult","secondDefinition"],"sources":["createWithPropertiesObjectSet.test.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { DerivedProperty } from \"@osdk/api\";\nimport { Employee } from \"@osdk/client.test.ontology\";\nimport type { DerivedPropertyDefinition } from \"@osdk/
|
|
1
|
+
{"version":3,"file":"createWithPropertiesObjectSet.test.js","names":["Employee","describe","expect","it","createWithPropertiesObjectSet","map","Map","deriveObjectSet","type","result","base","pivotTo","selectProperty","definition","get","toMatchInlineSnapshot","clause","aggregate","percentile","limit","secondResult","secondDefinition"],"sources":["createWithPropertiesObjectSet.test.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { DerivedProperty } from \"@osdk/api\";\nimport { Employee } from \"@osdk/client.test.ontology\";\nimport type { DerivedPropertyDefinition } from \"@osdk/foundry.ontologies\";\nimport { describe, expect, it } from \"vitest\";\nimport { createWithPropertiesObjectSet } from \"./createWithPropertiesObjectSet.js\";\n\ndescribe(createWithPropertiesObjectSet, () => {\n it(\"correctly creates basic object set with derived properties\", () => {\n const map = new Map<any, DerivedPropertyDefinition>();\n const deriveObjectSet = createWithPropertiesObjectSet(Employee, {\n type: \"methodInput\",\n }, map);\n\n const clause = {\n \"derivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").selectProperty(\"employeeId\"),\n } satisfies DerivedProperty.Clause<Employee>;\n\n const result = clause[\"derivedPropertyName\"](deriveObjectSet);\n const definition = map.get(result);\n expect(definition).toMatchInlineSnapshot(`\n {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"selectedPropertyApiName\": \"employeeId\",\n \"type\": \"get\",\n },\n \"type\": \"selection\",\n }\n `);\n });\n\n it(\"correctly handles multiple definitions in one clause\", () => {\n const map = new Map<any, DerivedPropertyDefinition>();\n const deriveObjectSet = createWithPropertiesObjectSet(Employee, {\n type: \"methodInput\",\n }, map);\n\n const clause: DerivedProperty.Clause<Employee> = {\n \"derivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"startDate:approximatePercentile\", {\n percentile: 0.5,\n }),\n\n \"secondaryDerivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"fullName:collectSet\", {\n limit: 10,\n }),\n };\n\n const result = clause[\"derivedPropertyName\"](deriveObjectSet);\n const definition = map.get(result);\n\n const secondResult = clause[\"secondaryDerivedPropertyName\"](\n deriveObjectSet,\n );\n const secondDefinition = map.get(secondResult);\n\n expect(definition).toMatchInlineSnapshot(`\n {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"approximatePercentile\": 0.5,\n \"selectedPropertyApiName\": \"startDate\",\n \"type\": \"approximatePercentile\",\n },\n \"type\": \"selection\",\n }\n `);\n\n expect(secondDefinition).toMatchInlineSnapshot(`\n {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"limit\": 10,\n \"selectedPropertyApiName\": \"fullName\",\n \"type\": \"collectSet\",\n },\n \"type\": \"selection\",\n }\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,QAAQ,QAAQ,4BAA4B;AAErD,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,6BAA6B,QAAQ,oCAAoC;AAElFH,QAAQ,CAACG,6BAA6B,EAAE,MAAM;EAC5CD,EAAE,CAAC,4DAA4D,EAAE,MAAM;IACrE,MAAME,GAAG,GAAG,IAAIC,GAA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IACD,MAAMc,gBAAgB,GAAGhB,GAAG,CAACS,GAAG,CAACM,YAAY,CAAC;IAE9ClB,MAAM,CAACW,UAAU,CAAC,CAACE,qBAAqB,CAAC;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC;IAEJb,MAAM,CAACmB,gBAAgB,CAAC,CAACN,qBAAqB,CAAC;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC;EACN,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacyToModernSingleAggregationResult.js","names":["invariant","legacyToModernSingleAggregationResult","entry","metrics","reduce","accumulator","curValue","parts","name","split","length","process","env","NODE_ENV","property","metricType","value"],"sources":["legacyToModernSingleAggregationResult.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 AggregationClause,\n AggregationResultsWithoutGroups,\n ObjectOrInterfaceDefinition,\n} from \"@osdk/api\";\nimport type { AggregateObjectsResponseV2 } from \"@osdk/
|
|
1
|
+
{"version":3,"file":"legacyToModernSingleAggregationResult.js","names":["invariant","legacyToModernSingleAggregationResult","entry","metrics","reduce","accumulator","curValue","parts","name","split","length","process","env","NODE_ENV","property","metricType","value"],"sources":["legacyToModernSingleAggregationResult.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 AggregationClause,\n AggregationResultsWithoutGroups,\n ObjectOrInterfaceDefinition,\n} from \"@osdk/api\";\nimport type { AggregateObjectsResponseV2 } from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport type { ArrayElement } from \"../../util/ArrayElement.js\";\n\n/** @internal */\nexport function legacyToModernSingleAggregationResult<\n Q extends ObjectOrInterfaceDefinition,\n AC extends AggregationClause<Q>,\n>(\n entry: ArrayElement<AggregateObjectsResponseV2[\"data\"]>,\n): AggregationResultsWithoutGroups<Q, AC> {\n return entry.metrics.reduce(\n (accumulator: AggregationResultsWithoutGroups<Q, AC>, curValue) => {\n const parts = curValue.name.split(\".\");\n if (parts[0] === \"count\") {\n return accumulator;\n }\n invariant(\n parts.length === 2,\n \"assumed we were getting a `${key}.${type}`\",\n );\n const property = parts[0] as keyof AggregationResultsWithoutGroups<Q, AC>;\n const metricType = parts[1];\n if (!(property in accumulator)) {\n accumulator[property] = {} as any; // fixme?\n }\n (accumulator[property] as any)[metricType] = curValue.value; // fixme?\n\n return accumulator;\n },\n {} as AggregationResultsWithoutGroups<Q, AC>,\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,OAAOA,SAAS,MAAM,gBAAgB;AAGtC;AACA,OAAO,SAASC,qCAAqCA,CAInDC,KAAuD,EACf;EACxC,OAAOA,KAAK,CAACC,OAAO,CAACC,MAAM,CACzB,CAACC,WAAmD,EAAEC,QAAQ,KAAK;IACjE,MAAMC,KAAK,GAAGD,QAAQ,CAACE,IAAI,CAACC,KAAK,CAAC,GAAG,CAAC;IACtC,IAAIF,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;MACxB,OAAOF,WAAW;IACpB;IACA,EACEE,KAAK,CAACG,MAAM,KAAK,CAAC,IAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBADpBb,SAAS,QAEP,4CAA4C,IAF9CA,SAAS;IAIT,MAAMc,QAAQ,GAAGP,KAAK,CAAC,CAAC,CAAiD;IACzE,MAAMQ,UAAU,GAAGR,KAAK,CAAC,CAAC,CAAC;IAC3B,IAAI,EAAEO,QAAQ,IAAIT,WAAW,CAAC,EAAE;MAC9BA,WAAW,CAACS,QAAQ,CAAC,GAAG,CAAC,CAAQ,CAAC,CAAC;IACrC;IACCT,WAAW,CAACS,QAAQ,CAAC,CAASC,UAAU,CAAC,GAAGT,QAAQ,CAACU,KAAK,CAAC,CAAC;;IAE7D,OAAOX,WAAW;EACpB,CAAC,EACD,CAAC,CACH,CAAC;AACH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modernToLegacyAggregationClause.js","names":["directionFieldMap","dir","undefined","modernToLegacyAggregationClause","select","Object","entries","flatMap","propAndMetric","aggregationType","type","name","direction","colonPos","lastIndexOf","property","slice","metric","field"],"sources":["modernToLegacyAggregationClause.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 { AggregationClause } from \"@osdk/api\";\nimport type { AggregationV2 } from \"@osdk/
|
|
1
|
+
{"version":3,"file":"modernToLegacyAggregationClause.js","names":["directionFieldMap","dir","undefined","modernToLegacyAggregationClause","select","Object","entries","flatMap","propAndMetric","aggregationType","type","name","direction","colonPos","lastIndexOf","property","slice","metric","field"],"sources":["modernToLegacyAggregationClause.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 { AggregationClause } from \"@osdk/api\";\nimport type { AggregationV2 } from \"@osdk/foundry.ontologies\";\n\nconst directionFieldMap = (dir?: \"asc\" | \"desc\" | \"unordered\") =>\n dir === \"asc\" ? \"ASC\" : dir === \"desc\" ? \"DESC\" : undefined;\n\n/** @internal */\nexport function modernToLegacyAggregationClause<\n AC extends AggregationClause<any>,\n>(select: AC) {\n return Object.entries(select).flatMap<AggregationV2>(\n ([propAndMetric, aggregationType]) => {\n if (propAndMetric === \"$count\") {\n return {\n type: \"count\",\n name: \"count\",\n direction: directionFieldMap(aggregationType),\n };\n }\n\n const colonPos = propAndMetric.lastIndexOf(\":\");\n const property = propAndMetric.slice(0, colonPos);\n const metric = propAndMetric.slice(colonPos + 1);\n\n return [\n {\n type: metric as\n | \"approximateDistinct\"\n | \"exactDistinct\"\n | \"min\"\n | \"max\"\n | \"sum\"\n | \"avg\"\n | \"approximateDistinct\"\n | \"exactDistinct\",\n name: `${property}.${metric}`,\n direction: directionFieldMap(aggregationType),\n field: property,\n },\n ];\n },\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,MAAMA,iBAAiB,GAAIC,GAAkC,IAC3DA,GAAG,KAAK,KAAK,GAAG,KAAK,GAAGA,GAAG,KAAK,MAAM,GAAG,MAAM,GAAGC,SAAS;;AAE7D;AACA,OAAO,SAASC,+BAA+BA,CAE7CC,MAAU,EAAE;EACZ,OAAOC,MAAM,CAACC,OAAO,CAACF,MAAM,CAAC,CAACG,OAAO,CACnC,CAAC,CAACC,aAAa,EAAEC,eAAe,CAAC,KAAK;IACpC,IAAID,aAAa,KAAK,QAAQ,EAAE;MAC9B,OAAO;QACLE,IAAI,EAAE,OAAO;QACbC,IAAI,EAAE,OAAO;QACbC,SAAS,EAAEZ,iBAAiB,CAACS,eAAe;MAC9C,CAAC;IACH;IAEA,MAAMI,QAAQ,GAAGL,aAAa,CAACM,WAAW,CAAC,GAAG,CAAC;IAC/C,MAAMC,QAAQ,GAAGP,aAAa,CAACQ,KAAK,CAAC,CAAC,EAAEH,QAAQ,CAAC;IACjD,MAAMI,MAAM,GAAGT,aAAa,CAACQ,KAAK,CAACH,QAAQ,GAAG,CAAC,CAAC;IAEhD,OAAO,CACL;MACEH,IAAI,EAAEO,MAQa;MACnBN,IAAI,EAAE,GAAGI,QAAQ,IAAIE,MAAM,EAAE;MAC7BL,SAAS,EAAEZ,iBAAiB,CAACS,eAAe,CAAC;MAC7CS,KAAK,EAAEH;IACT,CAAC,CACF;EACH,CACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modernToLegacyGroupByClause.js","names":["DurationMapping","modernToLegacyGroupByClause","groupByClause","Object","entries","flatMap","field","type","maxGroupCount","$exactWithLimit","fixedWidth","$fixedWidth","ranges","$ranges","map","range","convertRange","value","$duration","unit","startValue","endValue"],"sources":["modernToLegacyGroupByClause.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 { AllGroupByValues, GroupByClause, GroupByRange } from \"@osdk/api\";\nimport { DurationMapping } from \"@osdk/api\";\nimport type {\n AggregationGroupByV2,\n AggregationRangeV2,\n} from \"@osdk/
|
|
1
|
+
{"version":3,"file":"modernToLegacyGroupByClause.js","names":["DurationMapping","modernToLegacyGroupByClause","groupByClause","Object","entries","flatMap","field","type","maxGroupCount","$exactWithLimit","fixedWidth","$fixedWidth","ranges","$ranges","map","range","convertRange","value","$duration","unit","startValue","endValue"],"sources":["modernToLegacyGroupByClause.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 { AllGroupByValues, GroupByClause, GroupByRange } from \"@osdk/api\";\nimport { DurationMapping } from \"@osdk/api\";\nimport type {\n AggregationGroupByV2,\n AggregationRangeV2,\n} from \"@osdk/foundry.ontologies\";\n\n/** @internal */\nexport function modernToLegacyGroupByClause(\n groupByClause: GroupByClause<any> | undefined,\n) {\n if (!groupByClause) return [];\n\n return Object.entries(\n groupByClause as Record<string, AllGroupByValues>,\n ).flatMap<AggregationGroupByV2>(([field, type]) => {\n if (type === \"exact\") {\n return [{ type, field }];\n } else if (\"$exactWithLimit\" in type) {\n {\n return [\n {\n type: \"exact\",\n field,\n maxGroupCount: type.$exactWithLimit,\n },\n ];\n }\n } else if (\"$fixedWidth\" in type) {\n return [{\n type: \"fixedWidth\",\n field,\n fixedWidth: type.$fixedWidth,\n }];\n } else if (\"$ranges\" in type) {\n return [{\n type: \"ranges\",\n field,\n ranges: type.$ranges.map(range => convertRange(range)),\n }];\n } else if (\"$duration\" in type) {\n return [{\n type: \"duration\",\n field,\n value: type.$duration[0],\n unit: DurationMapping[type.$duration[1]],\n }];\n } else return [];\n });\n}\n\nfunction convertRange(\n range: GroupByRange<number | string>,\n): AggregationRangeV2 {\n return { startValue: range[0], endValue: range[1] };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,eAAe,QAAQ,WAAW;AAM3C;AACA,OAAO,SAASC,2BAA2BA,CACzCC,aAA6C,EAC7C;EACA,IAAI,CAACA,aAAa,EAAE,OAAO,EAAE;EAE7B,OAAOC,MAAM,CAACC,OAAO,CACnBF,aACF,CAAC,CAACG,OAAO,CAAuB,CAAC,CAACC,KAAK,EAAEC,IAAI,CAAC,KAAK;IACjD,IAAIA,IAAI,KAAK,OAAO,EAAE;MACpB,OAAO,CAAC;QAAEA,IAAI;QAAED;MAAM,CAAC,CAAC;IAC1B,CAAC,MAAM,IAAI,iBAAiB,IAAIC,IAAI,EAAE;MACpC;QACE,OAAO,CACL;UACEA,IAAI,EAAE,OAAO;UACbD,KAAK;UACLE,aAAa,EAAED,IAAI,CAACE;QACtB,CAAC,CACF;MACH;IACF,CAAC,MAAM,IAAI,aAAa,IAAIF,IAAI,EAAE;MAChC,OAAO,CAAC;QACNA,IAAI,EAAE,YAAY;QAClBD,KAAK;QACLI,UAAU,EAAEH,IAAI,CAACI;MACnB,CAAC,CAAC;IACJ,CAAC,MAAM,IAAI,SAAS,IAAIJ,IAAI,EAAE;MAC5B,OAAO,CAAC;QACNA,IAAI,EAAE,QAAQ;QACdD,KAAK;QACLM,MAAM,EAAEL,IAAI,CAACM,OAAO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