@osdk/client 2.3.0-beta.5 → 2.3.0-beta.7
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 +30 -0
- package/build/browser/actions/ActionValidationError.js.map +1 -1
- package/build/browser/actions/applyAction.js +9 -8
- package/build/browser/actions/applyAction.js.map +1 -1
- package/build/browser/createClient.js +8 -1
- package/build/browser/createClient.js.map +1 -1
- package/build/browser/logger/BaseLogger.js +1 -1
- package/build/browser/logger/BaseLogger.js.map +1 -1
- package/build/browser/object/mediaUpload.js +3 -0
- package/build/browser/object/mediaUpload.js.map +1 -1
- package/build/browser/observable/ObservableClient.js +17 -1
- package/build/browser/observable/ObservableClient.js.map +1 -1
- package/build/browser/observable/OptimisticBuilder.js.map +1 -1
- package/build/browser/observable/internal/ActionApplication.js +31 -30
- package/build/browser/observable/internal/ActionApplication.js.map +1 -1
- package/build/browser/observable/internal/Changes.js +5 -1
- package/build/browser/observable/internal/Changes.js.map +1 -1
- package/build/browser/observable/internal/ListQuery.js +24 -22
- package/build/browser/observable/internal/ListQuery.js.map +1 -1
- package/build/browser/observable/internal/ObjectQuery.js +30 -1
- package/build/browser/observable/internal/ObjectQuery.js.map +1 -1
- package/build/browser/observable/internal/ObservableClientImpl.js +1 -2
- package/build/browser/observable/internal/ObservableClientImpl.js.map +1 -1
- package/build/browser/observable/internal/OptimisticJob.js +8 -0
- package/build/browser/observable/internal/OptimisticJob.js.map +1 -1
- package/build/browser/observable/internal/Query.js +2 -2
- package/build/browser/observable/internal/Query.js.map +1 -1
- package/build/browser/observable/internal/Store.js +4 -0
- package/build/browser/observable/internal/Store.js.map +1 -1
- package/build/browser/observable/internal/Store.test.js +45 -5
- package/build/browser/observable/internal/Store.test.js.map +1 -1
- package/build/browser/observable/internal/testUtils.js.map +1 -1
- package/build/browser/observable/internal/tombstone.js +18 -0
- package/build/browser/observable/internal/tombstone.js.map +1 -0
- package/build/browser/util/UserAgent.js +2 -1
- package/build/browser/util/UserAgent.js.map +1 -1
- package/build/browser/util/extractRdpDefinition.js +2 -0
- package/build/browser/util/extractRdpDefinition.js.map +1 -1
- package/build/browser/util/toDataValue.js +20 -10
- package/build/browser/util/toDataValue.js.map +1 -1
- package/build/browser/util/toDataValue.test.js +50 -11
- package/build/browser/util/toDataValue.test.js.map +1 -1
- package/build/cjs/chunk-BITDNXFO.cjs +1804 -0
- package/build/cjs/chunk-BITDNXFO.cjs.map +1 -0
- package/build/cjs/{chunk-MZ4JZQUU.cjs → chunk-HTPVXLYY.cjs} +649 -42
- package/build/cjs/chunk-HTPVXLYY.cjs.map +1 -0
- package/build/cjs/index.cjs +16 -1769
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +4 -3
- package/build/cjs/public/internal.cjs +7 -8
- package/build/cjs/public/internal.cjs.map +1 -1
- package/build/cjs/public/unstable-do-not-use.cjs +182 -123
- package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
- package/build/cjs/public/unstable-do-not-use.d.cts +2 -1
- package/build/esm/actions/ActionValidationError.js.map +1 -1
- package/build/esm/actions/applyAction.js +9 -8
- package/build/esm/actions/applyAction.js.map +1 -1
- package/build/esm/createClient.js +8 -1
- package/build/esm/createClient.js.map +1 -1
- package/build/esm/logger/BaseLogger.js +1 -1
- package/build/esm/logger/BaseLogger.js.map +1 -1
- package/build/esm/object/mediaUpload.js +3 -0
- package/build/esm/object/mediaUpload.js.map +1 -1
- package/build/esm/observable/ObservableClient.js +17 -1
- package/build/esm/observable/ObservableClient.js.map +1 -1
- package/build/esm/observable/OptimisticBuilder.js.map +1 -1
- package/build/esm/observable/internal/ActionApplication.js +31 -30
- package/build/esm/observable/internal/ActionApplication.js.map +1 -1
- package/build/esm/observable/internal/Changes.js +5 -1
- package/build/esm/observable/internal/Changes.js.map +1 -1
- package/build/esm/observable/internal/ListQuery.js +24 -22
- package/build/esm/observable/internal/ListQuery.js.map +1 -1
- package/build/esm/observable/internal/ObjectQuery.js +30 -1
- package/build/esm/observable/internal/ObjectQuery.js.map +1 -1
- package/build/esm/observable/internal/ObservableClientImpl.js +1 -2
- package/build/esm/observable/internal/ObservableClientImpl.js.map +1 -1
- package/build/esm/observable/internal/OptimisticJob.js +8 -0
- package/build/esm/observable/internal/OptimisticJob.js.map +1 -1
- package/build/esm/observable/internal/Query.js +2 -2
- package/build/esm/observable/internal/Query.js.map +1 -1
- package/build/esm/observable/internal/Store.js +4 -0
- package/build/esm/observable/internal/Store.js.map +1 -1
- package/build/esm/observable/internal/Store.test.js +45 -5
- package/build/esm/observable/internal/Store.test.js.map +1 -1
- package/build/esm/observable/internal/testUtils.js.map +1 -1
- package/build/esm/observable/internal/tombstone.js +18 -0
- package/build/esm/observable/internal/tombstone.js.map +1 -0
- package/build/esm/util/UserAgent.js +2 -1
- package/build/esm/util/UserAgent.js.map +1 -1
- package/build/esm/util/extractRdpDefinition.js +2 -0
- package/build/esm/util/extractRdpDefinition.js.map +1 -1
- package/build/esm/util/toDataValue.js +20 -10
- package/build/esm/util/toDataValue.js.map +1 -1
- package/build/esm/util/toDataValue.test.js +50 -11
- package/build/esm/util/toDataValue.test.js.map +1 -1
- package/build/types/actions/ActionValidationError.d.ts +1 -1
- package/build/types/actions/ActionValidationError.d.ts.map +1 -1
- package/build/types/actions/applyAction.d.ts.map +1 -1
- package/build/types/createClient.d.ts.map +1 -1
- package/build/types/object/mediaUpload.d.ts +2 -1
- package/build/types/object/mediaUpload.d.ts.map +1 -1
- package/build/types/observable/ObservableClient.d.ts +2 -2
- package/build/types/observable/ObservableClient.d.ts.map +1 -1
- package/build/types/observable/OptimisticBuilder.d.ts +1 -0
- package/build/types/observable/OptimisticBuilder.d.ts.map +1 -1
- package/build/types/observable/internal/ActionApplication.d.ts +1 -1
- package/build/types/observable/internal/ActionApplication.d.ts.map +1 -1
- package/build/types/observable/internal/Changes.d.ts +2 -0
- package/build/types/observable/internal/Changes.d.ts.map +1 -1
- package/build/types/observable/internal/ListQuery.d.ts.map +1 -1
- package/build/types/observable/internal/ObjectQuery.d.ts +1 -0
- package/build/types/observable/internal/ObjectQuery.d.ts.map +1 -1
- package/build/types/observable/internal/OptimisticJob.d.ts.map +1 -1
- package/build/types/observable/internal/Store.d.ts +2 -1
- package/build/types/observable/internal/Store.d.ts.map +1 -1
- package/build/types/observable/internal/testUtils.d.ts +1 -1
- package/build/types/observable/internal/testUtils.d.ts.map +1 -1
- package/build/types/observable/internal/tombstone.d.ts +1 -0
- package/build/types/observable/internal/tombstone.d.ts.map +1 -0
- package/build/types/util/UserAgent.d.ts +1 -0
- package/build/types/util/UserAgent.d.ts.map +1 -1
- package/package.json +11 -11
- package/build/cjs/chunk-C5D7744G.cjs +0 -615
- package/build/cjs/chunk-C5D7744G.cjs.map +0 -1
- package/build/cjs/chunk-MZ4JZQUU.cjs.map +0 -1
- package/build/cjs/chunk-T4NIFYZS.cjs +0 -14
- package/build/cjs/chunk-T4NIFYZS.cjs.map +0 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export const tombstone = undefined;
|
|
18
|
+
//# sourceMappingURL=tombstone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tombstone.js","names":["tombstone","undefined"],"sources":["tombstone.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\nexport const tombstone: undefined = undefined;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,SAAoB,GAAGC,SAAS","ignoreList":[]}
|
|
@@ -14,5 +14,6 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
export const USER_AGENT = `osdk-client/${"2.3.0-beta.
|
|
17
|
+
export const USER_AGENT = `osdk-client/${"2.3.0-beta.7"}`;
|
|
18
|
+
export const OBSERVABLE_USER_AGENT = `osdk-observable-client/${"2.3.0-beta.7"}`;
|
|
18
19
|
//# sourceMappingURL=UserAgent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserAgent.js","names":["USER_AGENT"],"sources":["UserAgent.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const USER_AGENT: string = `osdk-client/${process.env.PACKAGE_VERSION}`;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,UAAkB,GAAG,+BAA4C","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"UserAgent.js","names":["USER_AGENT","OBSERVABLE_USER_AGENT"],"sources":["UserAgent.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const USER_AGENT: string = `osdk-client/${process.env.PACKAGE_VERSION}`;\nexport const OBSERVABLE_USER_AGENT: string =\n `osdk-observable-client/${process.env.PACKAGE_VERSION}`;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,UAAkB,GAAG,+BAA4C;AAC9E,OAAO,MAAMC,qBAA6B,GACxC,0CAAuD","ignoreList":[]}
|
|
@@ -144,6 +144,8 @@ async function extractRdpDefinitionInternal(clientCtx, objectSet, methodInputObj
|
|
|
144
144
|
definitions: {}
|
|
145
145
|
};
|
|
146
146
|
// We don't have to worry about new object sets being added and doing a runtime break and breaking people since the OSDK is always constructing these.
|
|
147
|
+
case "interfaceLinkSearchAround":
|
|
148
|
+
process.env.NODE_ENV !== "production" ? invariant(false, `Unsupported object set type for Runtime Derived Properties`) : invariant(false);
|
|
147
149
|
default:
|
|
148
150
|
process.env.NODE_ENV !== "production" ? invariant(false, `Unsupported object set type for Runtime Derived Properties`) : invariant(false);
|
|
149
151
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractRdpDefinition.js","names":["invariant","extractRdpDefinition","clientCtx","objectSet","extractRdpDefinitionInternal","undefined","definitions","methodInputObjectType","type","childObjectType","objDef","ontologyProvider","getObjectDefinition","linkDef","links","link","process","env","NODE_ENV","targetType","name","definition","Object","entries","derivedProperties","selectedOrCollectedPropertyType","operation","operationLevelObjectType","properties","selectedPropertyApiName","objectType","interfaceType","objectSets","objectSetTypes","Promise","all","map","os","reduce","acc","keys","length","firstValidChildObjectType","find","every"],"sources":["extractRdpDefinition.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 { ObjectSet } from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport type { DerivedPropertyRuntimeMetadata } from \"../derivedProperties/derivedPropertyRuntimeMetadata.js\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\n\nexport async function extractRdpDefinition(\n clientCtx: MinimalClient,\n objectSet: ObjectSet,\n): Promise<\n DerivedPropertyRuntimeMetadata\n> {\n return (await extractRdpDefinitionInternal(\n clientCtx,\n objectSet,\n undefined,\n )).definitions;\n}\n\n/* @internal\n* Returns a tuple of the derived property definitions and the object type that the derived property is defined on.\n*/\nasync function extractRdpDefinitionInternal(\n clientCtx: MinimalClient,\n objectSet: ObjectSet,\n methodInputObjectType: string | undefined,\n): Promise<\n {\n definitions: DerivedPropertyRuntimeMetadata;\n childObjectType?: string;\n }\n> {\n switch (objectSet.type) {\n case \"searchAround\": {\n const { definitions, childObjectType } =\n await extractRdpDefinitionInternal(\n clientCtx,\n objectSet.objectSet,\n methodInputObjectType,\n );\n\n if (childObjectType === undefined || childObjectType === \"\") {\n return { definitions: {} };\n }\n const objDef = await clientCtx.ontologyProvider.getObjectDefinition(\n childObjectType,\n );\n const linkDef = objDef.links[objectSet.link];\n invariant(linkDef, `Missing link definition for '${objectSet.link}'`);\n return {\n definitions,\n childObjectType: objDef.links[objectSet.link].targetType,\n };\n }\n case \"withProperties\": {\n // These are the definitions and current object type for all object set operations prior to the definition (e.g. filter, pivotTo, etc.)\n const { definitions, childObjectType } =\n await extractRdpDefinitionInternal(\n clientCtx,\n objectSet.objectSet,\n methodInputObjectType,\n );\n if (childObjectType === undefined || childObjectType === \"\") {\n return { definitions: {} };\n }\n\n for (\n const [name, definition] of Object.entries(objectSet.derivedProperties)\n ) {\n if (definition.type !== \"selection\") {\n definitions[name] = {\n selectedOrCollectedPropertyType: undefined,\n definition,\n };\n continue;\n }\n\n switch (definition.operation.type) {\n case \"collectList\":\n case \"collectSet\":\n case \"get\":\n // This is the object set construction for the derived property definition construction. We pass in childObjectType so that when we reach MethodInputObjectSet, we know where to start looking.\n const { childObjectType: operationLevelObjectType } =\n await extractRdpDefinitionInternal(\n clientCtx,\n definition.objectSet,\n childObjectType,\n );\n if (\n operationLevelObjectType === undefined\n || operationLevelObjectType === \"\"\n ) {\n return { definitions: {} };\n }\n const objDef = await clientCtx.ontologyProvider.getObjectDefinition(\n operationLevelObjectType,\n );\n\n definitions[name] = {\n selectedOrCollectedPropertyType:\n objDef.properties[definition.operation.selectedPropertyApiName],\n definition,\n };\n break;\n\n default:\n definitions[name] = {\n selectedOrCollectedPropertyType: undefined,\n definition,\n };\n }\n }\n return { definitions, childObjectType };\n }\n case \"methodInput\":\n return { definitions: {}, childObjectType: methodInputObjectType };\n case \"base\":\n return { definitions: {}, childObjectType: objectSet.objectType };\n case \"interfaceBase\":\n return { definitions: {}, childObjectType: objectSet.interfaceType };\n case \"filter\":\n case \"asBaseObjectTypes\":\n case \"asType\":\n case \"nearestNeighbors\":\n return extractRdpDefinitionInternal(\n clientCtx,\n objectSet.objectSet,\n methodInputObjectType,\n );\n // These will throw in OSS so we should throw here so no request is made\n case \"intersect\":\n case \"subtract\":\n case \"union\":\n const objectSets = objectSet.objectSets;\n const objectSetTypes = await Promise.all(\n objectSets.map((os) =>\n extractRdpDefinitionInternal(\n clientCtx,\n os,\n methodInputObjectType,\n )\n ),\n );\n\n const definitions = objectSetTypes.reduce(\n (acc, { definitions }) => ({ ...acc, ...definitions }),\n {},\n );\n invariant(\n Object.keys(definitions).length === 0,\n \"Object sets combined using intersect, subtract, or union must not contain any derived property definitions\",\n );\n\n const firstValidChildObjectType = objectSetTypes.find(\n ({ childObjectType }) => childObjectType != null,\n )?.childObjectType;\n invariant(\n objectSetTypes.every(\n ({ childObjectType }) =>\n childObjectType === firstValidChildObjectType\n || childObjectType == null,\n ),\n \"All object sets in an intersect, subtract, or union must have the same child object type\",\n );\n\n return {\n definitions: {},\n childObjectType: firstValidChildObjectType,\n };\n case \"static\":\n case \"reference\":\n // Static and reference object sets are always intersected with a base object set, so we can just return no child object type.\n return { definitions: {} };\n // We don't have to worry about new object sets being added and doing a runtime break and breaking people since the OSDK is always constructing these.\n default:\n const _: never = objectSet;\n invariant(\n false,\n `Unsupported object set type for Runtime Derived Properties`,\n );\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,SAAS,MAAM,gBAAgB;AAItC,OAAO,eAAeC,oBAAoBA,CACxCC,SAAwB,EACxBC,SAAoB,EAGpB;EACA,OAAO,CAAC,MAAMC,4BAA4B,CACxCF,SAAS,EACTC,SAAS,EACTE,SACF,CAAC,EAAEC,WAAW;AAChB;;AAEA;AACA;AACA;AACA,eAAeF,4BAA4BA,CACzCF,SAAwB,EACxBC,SAAoB,EACpBI,qBAAyC,EAMzC;EACA,QAAQJ,SAAS,CAACK,IAAI;IACpB,KAAK,cAAc;MAAE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B,UAAU,GAAG7B,SAAS,CAAC6B,UAAU;MACvC,MAAMC,cAAc,GAAG,MAAMC,OAAO,CAACC,GAAG,CACtCH,UAAU,CAACI,GAAG,CAAEC,EAAE,IAChBjC,4BAA4B,CAC1BF,SAAS,EACTmC,EAAE,EACF9B,qBACF,CACF,CACF,CAAC;MAED,MAAMD,WAAW,GAAG2B,cAAc,CAACK,MAAM,CACvC,CAACC,GAAG,EAAE;QAAEjC;MAAY,CAAC,MAAM;QAAE,GAAGiC,GAAG;QAAE,GAAGjC;MAAY,CAAC,CAAC,EACtD,CAAC,CACH,CAAC;MACD,EACEgB,MAAM,CAACkB,IAAI,CAAClC,WAAW,CAAC,CAACmC,MAAM,KAAK,CAAC,IAAAzB,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBADvClB,SAAS,QAEP,4GAA4G,IAF9GA,SAAS;MAKT,MAAM0C,yBAAyB,GAAGT,cAAc,CAACU,IAAI,CACnD,CAAC;QAAElC;MAAgB,CAAC,KAAKA,eAAe,IAAI,IAC9C,CAAC,EAAEA,eAAe;MAClB,CACEwB,cAAc,CAACW,KAAK,CAClB,CAAC;QAAEnC;MAAgB,CAAC,KAClBA,eAAe,KAAKiC,yBAAyB,IAC1CjC,eAAe,IAAI,IAC1B,CAAC,GAAAO,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBALHlB,SAAS,QAMP,0FAA0F,IAN5FA,SAAS;MAST,OAAO;QACLM,WAAW,EAAE,CAAC,CAAC;QACfG,eAAe,EAAEiC;MACnB,CAAC;IACH,KAAK,QAAQ;IACb,KAAK,WAAW;MACd;MACA,OAAO;QAAEpC,WAAW,EAAE,CAAC;MAAE,CAAC;IAC5B;IACA;MAEEU,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAAlB,SAAS,QAEP,4DAA4D,IAF9DA,SAAS;EAIb;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"extractRdpDefinition.js","names":["invariant","extractRdpDefinition","clientCtx","objectSet","extractRdpDefinitionInternal","undefined","definitions","methodInputObjectType","type","childObjectType","objDef","ontologyProvider","getObjectDefinition","linkDef","links","link","process","env","NODE_ENV","targetType","name","definition","Object","entries","derivedProperties","selectedOrCollectedPropertyType","operation","operationLevelObjectType","properties","selectedPropertyApiName","objectType","interfaceType","objectSets","objectSetTypes","Promise","all","map","os","reduce","acc","keys","length","firstValidChildObjectType","find","every"],"sources":["extractRdpDefinition.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 { ObjectSet } from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport type { DerivedPropertyRuntimeMetadata } from \"../derivedProperties/derivedPropertyRuntimeMetadata.js\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\n\nexport async function extractRdpDefinition(\n clientCtx: MinimalClient,\n objectSet: ObjectSet,\n): Promise<\n DerivedPropertyRuntimeMetadata\n> {\n return (await extractRdpDefinitionInternal(\n clientCtx,\n objectSet,\n undefined,\n )).definitions;\n}\n\n/* @internal\n* Returns a tuple of the derived property definitions and the object type that the derived property is defined on.\n*/\nasync function extractRdpDefinitionInternal(\n clientCtx: MinimalClient,\n objectSet: ObjectSet,\n methodInputObjectType: string | undefined,\n): Promise<\n {\n definitions: DerivedPropertyRuntimeMetadata;\n childObjectType?: string;\n }\n> {\n switch (objectSet.type) {\n case \"searchAround\": {\n const { definitions, childObjectType } =\n await extractRdpDefinitionInternal(\n clientCtx,\n objectSet.objectSet,\n methodInputObjectType,\n );\n\n if (childObjectType === undefined || childObjectType === \"\") {\n return { definitions: {} };\n }\n const objDef = await clientCtx.ontologyProvider.getObjectDefinition(\n childObjectType,\n );\n const linkDef = objDef.links[objectSet.link];\n invariant(linkDef, `Missing link definition for '${objectSet.link}'`);\n return {\n definitions,\n childObjectType: objDef.links[objectSet.link].targetType,\n };\n }\n case \"withProperties\": {\n // These are the definitions and current object type for all object set operations prior to the definition (e.g. filter, pivotTo, etc.)\n const { definitions, childObjectType } =\n await extractRdpDefinitionInternal(\n clientCtx,\n objectSet.objectSet,\n methodInputObjectType,\n );\n if (childObjectType === undefined || childObjectType === \"\") {\n return { definitions: {} };\n }\n\n for (\n const [name, definition] of Object.entries(objectSet.derivedProperties)\n ) {\n if (definition.type !== \"selection\") {\n definitions[name] = {\n selectedOrCollectedPropertyType: undefined,\n definition,\n };\n continue;\n }\n\n switch (definition.operation.type) {\n case \"collectList\":\n case \"collectSet\":\n case \"get\":\n // This is the object set construction for the derived property definition construction. We pass in childObjectType so that when we reach MethodInputObjectSet, we know where to start looking.\n const { childObjectType: operationLevelObjectType } =\n await extractRdpDefinitionInternal(\n clientCtx,\n definition.objectSet,\n childObjectType,\n );\n if (\n operationLevelObjectType === undefined\n || operationLevelObjectType === \"\"\n ) {\n return { definitions: {} };\n }\n const objDef = await clientCtx.ontologyProvider.getObjectDefinition(\n operationLevelObjectType,\n );\n\n definitions[name] = {\n selectedOrCollectedPropertyType:\n objDef.properties[definition.operation.selectedPropertyApiName],\n definition,\n };\n break;\n\n default:\n definitions[name] = {\n selectedOrCollectedPropertyType: undefined,\n definition,\n };\n }\n }\n return { definitions, childObjectType };\n }\n case \"methodInput\":\n return { definitions: {}, childObjectType: methodInputObjectType };\n case \"base\":\n return { definitions: {}, childObjectType: objectSet.objectType };\n case \"interfaceBase\":\n return { definitions: {}, childObjectType: objectSet.interfaceType };\n case \"filter\":\n case \"asBaseObjectTypes\":\n case \"asType\":\n case \"nearestNeighbors\":\n return extractRdpDefinitionInternal(\n clientCtx,\n objectSet.objectSet,\n methodInputObjectType,\n );\n // These will throw in OSS so we should throw here so no request is made\n case \"intersect\":\n case \"subtract\":\n case \"union\":\n const objectSets = objectSet.objectSets;\n const objectSetTypes = await Promise.all(\n objectSets.map((os) =>\n extractRdpDefinitionInternal(\n clientCtx,\n os,\n methodInputObjectType,\n )\n ),\n );\n\n const definitions = objectSetTypes.reduce(\n (acc, { definitions }) => ({ ...acc, ...definitions }),\n {},\n );\n invariant(\n Object.keys(definitions).length === 0,\n \"Object sets combined using intersect, subtract, or union must not contain any derived property definitions\",\n );\n\n const firstValidChildObjectType = objectSetTypes.find(\n ({ childObjectType }) => childObjectType != null,\n )?.childObjectType;\n invariant(\n objectSetTypes.every(\n ({ childObjectType }) =>\n childObjectType === firstValidChildObjectType\n || childObjectType == null,\n ),\n \"All object sets in an intersect, subtract, or union must have the same child object type\",\n );\n\n return {\n definitions: {},\n childObjectType: firstValidChildObjectType,\n };\n case \"static\":\n case \"reference\":\n // Static and reference object sets are always intersected with a base object set, so we can just return no child object type.\n return { definitions: {} };\n // We don't have to worry about new object sets being added and doing a runtime break and breaking people since the OSDK is always constructing these.\n case \"interfaceLinkSearchAround\":\n invariant(\n false,\n `Unsupported object set type for Runtime Derived Properties`,\n );\n default:\n const _: never = objectSet;\n invariant(\n false,\n `Unsupported object set type for Runtime Derived Properties`,\n );\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,SAAS,MAAM,gBAAgB;AAItC,OAAO,eAAeC,oBAAoBA,CACxCC,SAAwB,EACxBC,SAAoB,EAGpB;EACA,OAAO,CAAC,MAAMC,4BAA4B,CACxCF,SAAS,EACTC,SAAS,EACTE,SACF,CAAC,EAAEC,WAAW;AAChB;;AAEA;AACA;AACA;AACA,eAAeF,4BAA4BA,CACzCF,SAAwB,EACxBC,SAAoB,EACpBI,qBAAyC,EAMzC;EACA,QAAQJ,SAAS,CAACK,IAAI;IACpB,KAAK,cAAc;MAAE;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S;EAIb;AACF","ignoreList":[]}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import * as OntologiesV2 from "@osdk/foundry.ontologies";
|
|
18
18
|
import { isAttachmentFile, isAttachmentUpload } from "../object/AttachmentUpload.js";
|
|
19
|
-
import { isMediaReference } from "../object/mediaUpload.js";
|
|
19
|
+
import { isMediaReference, isMediaUpload } from "../object/mediaUpload.js";
|
|
20
20
|
import { getWireObjectSet, isObjectSet } from "../objectSet/createObjectSet.js";
|
|
21
21
|
import { isInterfaceActionParam } from "./interfaceUtils.js";
|
|
22
22
|
import { isObjectSpecifiersObject } from "./isObjectSpecifiersObject.js";
|
|
@@ -30,7 +30,7 @@ import { isWireObjectSet } from "./WireObjectSet.js";
|
|
|
30
30
|
* @see DataValue for the expected payloads
|
|
31
31
|
* @internal
|
|
32
32
|
*/
|
|
33
|
-
export async function toDataValue(value, client) {
|
|
33
|
+
export async function toDataValue(value, client, actionMetadata) {
|
|
34
34
|
if (value == null) {
|
|
35
35
|
// typeof null is 'object' so do this first
|
|
36
36
|
return value;
|
|
@@ -42,11 +42,11 @@ export async function toDataValue(value, client) {
|
|
|
42
42
|
if (values.some(dataValue => isAttachmentUpload(dataValue) || isAttachmentFile(dataValue))) {
|
|
43
43
|
const converted = [];
|
|
44
44
|
for (const value of values) {
|
|
45
|
-
converted.push(await toDataValue(value, client));
|
|
45
|
+
converted.push(await toDataValue(value, client, actionMetadata));
|
|
46
46
|
}
|
|
47
47
|
return converted;
|
|
48
48
|
}
|
|
49
|
-
const promiseArray = Array.from(value, async innerValue => await toDataValue(innerValue, client));
|
|
49
|
+
const promiseArray = Array.from(value, async innerValue => await toDataValue(innerValue, client, actionMetadata));
|
|
50
50
|
return Promise.all(promiseArray);
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -55,24 +55,34 @@ export async function toDataValue(value, client) {
|
|
|
55
55
|
const attachment = await OntologiesV2.Attachments.upload(client, value.data, {
|
|
56
56
|
filename: value.name
|
|
57
57
|
});
|
|
58
|
-
return await toDataValue(attachment.rid, client);
|
|
58
|
+
return await toDataValue(attachment.rid, client, actionMetadata);
|
|
59
59
|
}
|
|
60
60
|
if (isAttachmentFile(value)) {
|
|
61
61
|
const attachment = await OntologiesV2.Attachments.upload(client, value, {
|
|
62
62
|
filename: value.name
|
|
63
63
|
});
|
|
64
|
-
return await toDataValue(attachment.rid, client);
|
|
64
|
+
return await toDataValue(attachment.rid, client, actionMetadata);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// new media item upload interface, very similar to how attachments work above
|
|
68
|
+
|
|
69
|
+
if (isMediaUpload(value)) {
|
|
70
|
+
const mediaRef = await OntologiesV2.MediaReferenceProperties.uploadMedia(client, await client.ontologyRid, actionMetadata.apiName, value.data, {
|
|
71
|
+
mediaItemPath: value.path,
|
|
72
|
+
preview: true
|
|
73
|
+
});
|
|
74
|
+
return await toDataValue(mediaRef, client, actionMetadata);
|
|
65
75
|
}
|
|
66
76
|
|
|
67
77
|
// objects just send the JSON'd primaryKey
|
|
68
78
|
if (isOntologyObjectV2(value)) {
|
|
69
|
-
return await toDataValue(value.__primaryKey, client);
|
|
79
|
+
return await toDataValue(value.__primaryKey, client, actionMetadata);
|
|
70
80
|
}
|
|
71
81
|
if (isObjectSpecifiersObject(value)) {
|
|
72
|
-
return await toDataValue(value.$primaryKey, client);
|
|
82
|
+
return await toDataValue(value.$primaryKey, client, actionMetadata);
|
|
73
83
|
}
|
|
74
84
|
if (isPoint(value)) {
|
|
75
|
-
return await toDataValue(value.coordinates.
|
|
85
|
+
return await toDataValue(`${value.coordinates[1]},${value.coordinates[0]}`, client, actionMetadata);
|
|
76
86
|
}
|
|
77
87
|
|
|
78
88
|
// object set (the rid as a string (passes through the last return), or the ObjectSet definition directly)
|
|
@@ -100,7 +110,7 @@ export async function toDataValue(value, client) {
|
|
|
100
110
|
if (typeof value === "object") {
|
|
101
111
|
return Object.entries(value).reduce(async (promisedAcc, [key, structValue]) => {
|
|
102
112
|
const acc = await promisedAcc;
|
|
103
|
-
acc[key] = await toDataValue(structValue, client);
|
|
113
|
+
acc[key] = await toDataValue(structValue, client, actionMetadata);
|
|
104
114
|
return acc;
|
|
105
115
|
}, Promise.resolve({}));
|
|
106
116
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toDataValue.js","names":["OntologiesV2","isAttachmentFile","isAttachmentUpload","isMediaReference","getWireObjectSet","isObjectSet","isInterfaceActionParam","isObjectSpecifiersObject","isOntologyObjectV2","isPoint","isWireObjectSet","toDataValue","value","client","Array","isArray","Set","values","from","some","dataValue","converted","push","promiseArray","innerValue","Promise","all","attachment","Attachments","upload","data","filename","name","rid","__primaryKey","$primaryKey","coordinates","
|
|
1
|
+
{"version":3,"file":"toDataValue.js","names":["OntologiesV2","isAttachmentFile","isAttachmentUpload","isMediaReference","isMediaUpload","getWireObjectSet","isObjectSet","isInterfaceActionParam","isObjectSpecifiersObject","isOntologyObjectV2","isPoint","isWireObjectSet","toDataValue","value","client","actionMetadata","Array","isArray","Set","values","from","some","dataValue","converted","push","promiseArray","innerValue","Promise","all","attachment","Attachments","upload","data","filename","name","rid","mediaRef","MediaReferenceProperties","uploadMedia","ontologyRid","apiName","mediaItemPath","path","preview","__primaryKey","$primaryKey","coordinates","objectTypeApiName","$objectType","primaryKeyValue","Object","entries","reduce","promisedAcc","key","structValue","acc","resolve"],"sources":["toDataValue.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 { ActionMetadata } from \"@osdk/api\";\nimport { type DataValue } from \"@osdk/foundry.ontologies\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport {\n isAttachmentFile,\n isAttachmentUpload,\n} from \"../object/AttachmentUpload.js\";\nimport { isMediaReference, isMediaUpload } from \"../object/mediaUpload.js\";\nimport { getWireObjectSet, isObjectSet } from \"../objectSet/createObjectSet.js\";\nimport { isInterfaceActionParam } from \"./interfaceUtils.js\";\nimport { isObjectSpecifiersObject } from \"./isObjectSpecifiersObject.js\";\nimport { isOntologyObjectV2 } from \"./isOntologyObjectV2.js\";\nimport { isPoint } from \"./isPoint.js\";\nimport { isWireObjectSet } from \"./WireObjectSet.js\";\n\n/**\n * Marshall user-facing data into the wire DataValue type\n *\n * @see DataValue for the expected payloads\n * @internal\n */\nexport async function toDataValue(\n value: unknown,\n client: MinimalClient,\n actionMetadata: ActionMetadata,\n): Promise<DataValue> {\n if (value == null) {\n // typeof null is 'object' so do this first\n return value;\n }\n\n // arrays and sets are both sent over the wire as arrays\n if (Array.isArray(value) || value instanceof Set) {\n const values = Array.from(value);\n if (\n values.some((dataValue) =>\n isAttachmentUpload(dataValue) || isAttachmentFile(dataValue)\n )\n ) {\n const converted = [];\n for (const value of values) {\n converted.push(await toDataValue(value, client, actionMetadata));\n }\n return converted;\n }\n const promiseArray = Array.from(\n value,\n async (innerValue) =>\n await toDataValue(innerValue, client, actionMetadata),\n );\n return Promise.all(promiseArray);\n }\n\n // For uploads, we need to upload ourselves first to get the RID of the attachment\n if (isAttachmentUpload(value)) {\n const attachment = await OntologiesV2.Attachments.upload(\n client,\n value.data,\n {\n filename: value.name,\n },\n );\n return await toDataValue(attachment.rid, client, actionMetadata);\n }\n\n if (isAttachmentFile(value)) {\n const attachment = await OntologiesV2.Attachments.upload(\n client,\n value,\n {\n filename: value.name as string,\n },\n );\n return await toDataValue(attachment.rid, client, actionMetadata);\n }\n\n // new media item upload interface, very similar to how attachments work above\n\n if (isMediaUpload(value)) {\n const mediaRef = await OntologiesV2.MediaReferenceProperties\n .uploadMedia(\n client,\n await client.ontologyRid,\n actionMetadata.apiName,\n value.data,\n {\n mediaItemPath: value.path,\n preview: true,\n },\n );\n return await toDataValue(mediaRef, client, actionMetadata);\n }\n\n // objects just send the JSON'd primaryKey\n if (isOntologyObjectV2(value)) {\n return await toDataValue(value.__primaryKey, client, actionMetadata);\n }\n\n if (isObjectSpecifiersObject(value)) {\n return await toDataValue(value.$primaryKey, client, actionMetadata);\n }\n\n if (isPoint(value)) {\n return await toDataValue(\n `${value.coordinates[1]},${value.coordinates[0]}`,\n client,\n actionMetadata,\n );\n }\n\n // object set (the rid as a string (passes through the last return), or the ObjectSet definition directly)\n if (isWireObjectSet(value)) {\n return value;\n }\n if (isObjectSet(value)) {\n return getWireObjectSet(value);\n }\n\n if (isMediaReference(value)) {\n return value;\n }\n\n if (isInterfaceActionParam(value)) {\n return {\n objectTypeApiName: value.$objectType,\n primaryKeyValue: value.$primaryKey,\n };\n }\n\n // TODO (during queries implementation)\n // two dimensional aggregation\n // three dimensional aggregation\n\n // struct\n if (typeof value === \"object\") {\n return Object.entries(value).reduce(\n async (promisedAcc, [key, structValue]) => {\n const acc = await promisedAcc;\n acc[key] = await toDataValue(structValue, client, actionMetadata);\n return acc;\n },\n Promise.resolve({} as { [key: string]: DataValue }),\n );\n }\n\n // expected to pass through - boolean, byte, date, decimal, float, double, integer, long, short, string, timestamp, object type reference\n return value;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAO,KAAKA,YAAY,MAAM,0BAA0B;AAExD,SACEC,gBAAgB,EAChBC,kBAAkB,QACb,+BAA+B;AACtC,SAASC,gBAAgB,EAAEC,aAAa,QAAQ,0BAA0B;AAC1E,SAASC,gBAAgB,EAAEC,WAAW,QAAQ,iCAAiC;AAC/E,SAASC,sBAAsB,QAAQ,qBAAqB;AAC5D,SAASC,wBAAwB,Q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AK,CAAC,EAAE;IAC1B,OAAOA,KAAK;EACd;EACA,IAAIP,WAAW,CAACO,KAAK,CAAC,EAAE;IACtB,OAAOR,gBAAgB,CAACQ,KAAK,CAAC;EAChC;EAEA,IAAIV,gBAAgB,CAACU,KAAK,CAAC,EAAE;IAC3B,OAAOA,KAAK;EACd;EAEA,IAAIN,sBAAsB,CAACM,KAAK,CAAC,EAAE;IACjC,OAAO;MACLkC,iBAAiB,EAAElC,KAAK,CAACmC,WAAW;MACpCC,eAAe,EAAEpC,KAAK,CAACgC;IACzB,CAAC;EACH;;EAEA;EACA;EACA;;EAEA;EACA,IAAI,OAAOhC,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAOqC,MAAM,CAACC,OAAO,CAACtC,KAAK,CAAC,CAACuC,MAAM,CACjC,OAAOC,WAAW,EAAE,CAACC,GAAG,EAAEC,WAAW,CAAC,KAAK;MACzC,MAAMC,GAAG,GAAG,MAAMH,WAAW;MAC7BG,GAAG,CAACF,GAAG,CAAC,GAAG,MAAM1C,WAAW,CAAC2C,WAAW,EAAEzC,MAAM,EAAEC,cAAc,CAAC;MACjE,OAAOyC,GAAG;IACZ,CAAC,EACD7B,OAAO,CAAC8B,OAAO,CAAC,CAAC,CAAiC,CACpD,CAAC;EACH;;EAEA;EACA,OAAO5C,KAAK;AACd","ignoreList":[]}
|
|
@@ -15,25 +15,35 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { Employee, Task } from "@osdk/client.test.ontology";
|
|
18
|
-
import { LegacyFauxFoundry, startNodeApiServer, stubData } from "@osdk/shared.test";
|
|
18
|
+
import { LegacyFauxFoundry, MockOntologiesV2, startNodeApiServer, stubData } from "@osdk/shared.test";
|
|
19
19
|
import { beforeAll, describe, expect, it, vi } from "vitest";
|
|
20
20
|
import { createClient } from "../createClient.js";
|
|
21
21
|
import { createMinimalClient } from "../createMinimalClient.js";
|
|
22
22
|
import { createAttachmentUpload } from "../object/AttachmentUpload.js";
|
|
23
|
+
import { isMediaReference } from "../object/mediaUpload.js";
|
|
23
24
|
import { getWireObjectSet } from "../objectSet/createObjectSet.js";
|
|
24
25
|
import { toDataValue } from "./toDataValue.js";
|
|
25
26
|
describe(toDataValue, () => {
|
|
26
27
|
let client;
|
|
27
28
|
let clientCtx;
|
|
29
|
+
let mockActionMetadata;
|
|
30
|
+
let apiServer;
|
|
28
31
|
vi.fn();
|
|
29
32
|
beforeAll(() => {
|
|
30
33
|
const testSetup = startNodeApiServer(new LegacyFauxFoundry(), createClient);
|
|
31
34
|
({
|
|
32
35
|
client
|
|
33
36
|
} = testSetup);
|
|
37
|
+
apiServer = testSetup.apiServer;
|
|
34
38
|
clientCtx = createMinimalClient({
|
|
35
39
|
ontologyRid: testSetup.fauxFoundry.defaultOntologyRid
|
|
36
40
|
}, testSetup.fauxFoundry.baseUrl, testSetup.auth, {});
|
|
41
|
+
|
|
42
|
+
// toDataValue only needs the apiName right now, update this if that changes
|
|
43
|
+
|
|
44
|
+
mockActionMetadata = {
|
|
45
|
+
apiName: "createUnstructuredImageExampleObject"
|
|
46
|
+
};
|
|
37
47
|
return () => {
|
|
38
48
|
testSetup.apiServer.close();
|
|
39
49
|
};
|
|
@@ -48,7 +58,7 @@ describe(toDataValue, () => {
|
|
|
48
58
|
string: "string",
|
|
49
59
|
timestamp: "2024-01-01T00:00:00Z"
|
|
50
60
|
};
|
|
51
|
-
const convertedBasic = await toDataValue(basic, clientCtx);
|
|
61
|
+
const convertedBasic = await toDataValue(basic, clientCtx, mockActionMetadata);
|
|
52
62
|
expect(convertedBasic).toEqual(basic);
|
|
53
63
|
});
|
|
54
64
|
it("recursively converts arrays and sets into array types", async () => {
|
|
@@ -59,7 +69,7 @@ describe(toDataValue, () => {
|
|
|
59
69
|
attachment,
|
|
60
70
|
attachmentArray,
|
|
61
71
|
attachmentSet
|
|
62
|
-
}, clientCtx);
|
|
72
|
+
}, clientCtx, mockActionMetadata);
|
|
63
73
|
expect(recursiveConversion).toEqual({
|
|
64
74
|
attachment: "rid",
|
|
65
75
|
attachmentArray: ["rid"],
|
|
@@ -71,7 +81,7 @@ describe(toDataValue, () => {
|
|
|
71
81
|
inner: {
|
|
72
82
|
attachment: "rid"
|
|
73
83
|
}
|
|
74
|
-
}, clientCtx);
|
|
84
|
+
}, clientCtx, mockActionMetadata);
|
|
75
85
|
expect(recursiveConversion).toEqual({
|
|
76
86
|
inner: {
|
|
77
87
|
attachment: "rid"
|
|
@@ -80,12 +90,12 @@ describe(toDataValue, () => {
|
|
|
80
90
|
});
|
|
81
91
|
it("maps an ontology object into just its primary key", async () => {
|
|
82
92
|
const employee = stubData.employee1;
|
|
83
|
-
const ontologyConversion = await toDataValue(employee, clientCtx);
|
|
93
|
+
const ontologyConversion = await toDataValue(employee, clientCtx, mockActionMetadata);
|
|
84
94
|
expect(ontologyConversion).toEqual(stubData.employee1.__primaryKey);
|
|
85
95
|
});
|
|
86
96
|
it("maps an ontology object into just its primary key with osdk wrapper", async () => {
|
|
87
97
|
const task = await client(Employee).fetchOne(50030);
|
|
88
|
-
const ontologyConversion = await toDataValue(task, clientCtx);
|
|
98
|
+
const ontologyConversion = await toDataValue(task, clientCtx, mockActionMetadata);
|
|
89
99
|
expect(ontologyConversion).toEqual(task.$primaryKey);
|
|
90
100
|
});
|
|
91
101
|
it("passes through object set definitions", async () => {
|
|
@@ -107,9 +117,9 @@ describe(toDataValue, () => {
|
|
|
107
117
|
},
|
|
108
118
|
}
|
|
109
119
|
`;
|
|
110
|
-
const objectSetConversion = await toDataValue(clientObjectSet, clientCtx);
|
|
120
|
+
const objectSetConversion = await toDataValue(clientObjectSet, clientCtx, mockActionMetadata);
|
|
111
121
|
expect(objectSetConversion).toMatchInlineSnapshot(expected);
|
|
112
|
-
const definitionConversion = await toDataValue(definition, clientCtx);
|
|
122
|
+
const definitionConversion = await toDataValue(definition, clientCtx, mockActionMetadata);
|
|
113
123
|
expect(definitionConversion).toMatchInlineSnapshot(expected);
|
|
114
124
|
});
|
|
115
125
|
it("converts blob attachment uploads correctly", async () => {
|
|
@@ -117,7 +127,7 @@ describe(toDataValue, () => {
|
|
|
117
127
|
"hi": "mom"
|
|
118
128
|
})]);
|
|
119
129
|
const attachmentUpload = createAttachmentUpload(blob, "file1.txt");
|
|
120
|
-
const converted = await toDataValue(attachmentUpload, clientCtx);
|
|
130
|
+
const converted = await toDataValue(attachmentUpload, clientCtx, mockActionMetadata);
|
|
121
131
|
expect(converted).toMatch(/ri\.attachments.main.attachment\.[a-z0-9\-]+/i);
|
|
122
132
|
});
|
|
123
133
|
it("converts file attachment uploads correctly", async () => {
|
|
@@ -129,9 +139,38 @@ describe(toDataValue, () => {
|
|
|
129
139
|
}), {
|
|
130
140
|
name: "file1.txt"
|
|
131
141
|
});
|
|
132
|
-
const converted = await toDataValue(file, clientCtx);
|
|
142
|
+
const converted = await toDataValue(file, clientCtx, mockActionMetadata);
|
|
133
143
|
expect(converted).toMatch(/ri\.attachments.main.attachment\.[a-z0-9\-]+/i);
|
|
134
144
|
});
|
|
145
|
+
it("converts media uploads correctly", async () => {
|
|
146
|
+
const file = {
|
|
147
|
+
data: new Blob([JSON.stringify({
|
|
148
|
+
name: "Hello World"
|
|
149
|
+
}, null, 2)], {
|
|
150
|
+
type: "application/json"
|
|
151
|
+
}),
|
|
152
|
+
path: "file.txt"
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
// TODO: Mock MediaUpload properly in FauxFoundry
|
|
156
|
+
apiServer.boundary(async () => {
|
|
157
|
+
apiServer.use(MockOntologiesV2.MediaReferenceProperties.uploadMedia("https://stack.palantir.com", () => {
|
|
158
|
+
return {
|
|
159
|
+
mimeType: "application/json",
|
|
160
|
+
reference: {
|
|
161
|
+
type: "mediaSetViewItem",
|
|
162
|
+
mediaSetViewItem: {
|
|
163
|
+
mediaItemRid: "media-item-rid",
|
|
164
|
+
mediaSetRid: "media-set-rid",
|
|
165
|
+
mediaSetViewRid: "media-set-view-rid"
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
}));
|
|
170
|
+
const converted = await toDataValue(file, clientCtx, mockActionMetadata);
|
|
171
|
+
expect(isMediaReference(converted)).toBe(true);
|
|
172
|
+
});
|
|
173
|
+
});
|
|
135
174
|
it("converts media reference correctly", async () => {
|
|
136
175
|
const mediaReference = {
|
|
137
176
|
mimeType: "application/json",
|
|
@@ -144,7 +183,7 @@ describe(toDataValue, () => {
|
|
|
144
183
|
}
|
|
145
184
|
}
|
|
146
185
|
};
|
|
147
|
-
const converted = await toDataValue(mediaReference, clientCtx);
|
|
186
|
+
const converted = await toDataValue(mediaReference, clientCtx, mockActionMetadata);
|
|
148
187
|
expect(converted).toEqual(mediaReference);
|
|
149
188
|
});
|
|
150
189
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toDataValue.test.js","names":["Employee","Task","LegacyFauxFoundry","startNodeApiServer","stubData","beforeAll","describe","expect","it","vi","createClient","createMinimalClient","createAttachmentUpload","getWireObjectSet","toDataValue","client","clientCtx","fn","testSetup","ontologyRid","fauxFoundry","defaultOntologyRid","baseUrl","auth","apiServer","close","basic","null","undefined","boolean","date","integer","string","timestamp","convertedBasic","toEqual","attachment","attachmentArray","attachmentSet","Set","recursiveConversion","inner","employee","employee1","ontologyConversion","__primaryKey","task","fetchOne","$primaryKey","clientObjectSet","where","id","definition","expected","objectSetConversion","toMatchInlineSnapshot","definitionConversion","blob","Blob","JSON","stringify","attachmentUpload","converted","toMatch","file","Object","assign","name","type","mediaReference","mimeType","reference","mediaSetViewItem","mediaItemRid","mediaSetRid","mediaSetViewRid"],"sources":["toDataValue.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 { Employee, Task } from \"@osdk/client.test.ontology\";\nimport type { MediaReference } from \"@osdk/foundry.core\";\nimport {\n LegacyFauxFoundry,\n startNodeApiServer,\n stubData,\n} from \"@osdk/shared.test\";\nimport type { MockedFunction } from \"vitest\";\nimport { beforeAll, describe, expect, it, vi } from \"vitest\";\nimport type { Client } from \"../Client.js\";\nimport { createClient } from \"../createClient.js\";\nimport { createMinimalClient } from \"../createMinimalClient.js\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { createAttachmentUpload } from \"../object/AttachmentUpload.js\";\nimport { getWireObjectSet } from \"../objectSet/createObjectSet.js\";\nimport { toDataValue } from \"./toDataValue.js\";\n\ndescribe(toDataValue, () => {\n let client: Client;\n let clientCtx: MinimalClient;\n\n const mockFetch: MockedFunction<typeof globalThis.fetch> = vi.fn();\n\n beforeAll(() => {\n const testSetup = startNodeApiServer(new LegacyFauxFoundry(), createClient);\n ({ client } = testSetup);\n\n clientCtx = createMinimalClient(\n { ontologyRid: testSetup.fauxFoundry.defaultOntologyRid },\n testSetup.fauxFoundry.baseUrl,\n testSetup.auth,\n {},\n );\n\n return () => {\n testSetup.apiServer.close();\n };\n });\n\n it(\"converts passthrough values correctly\", async () => {\n // basic pass through types\n const basic = {\n null: undefined,\n boolean: false,\n date: \"2024-01-01\",\n integer: 0,\n string: \"string\",\n timestamp: \"2024-01-01T00:00:00Z\",\n };\n const convertedBasic = await toDataValue(basic, clientCtx);\n expect(convertedBasic).toEqual(basic);\n });\n\n it(\"recursively converts arrays and sets into array types\", async () => {\n const attachment = \"rid\";\n const attachmentArray = [attachment];\n const attachmentSet = new Set(attachmentArray);\n\n const recursiveConversion = await toDataValue({\n attachment,\n attachmentArray,\n attachmentSet,\n }, clientCtx);\n\n expect(recursiveConversion).toEqual({\n attachment: \"rid\",\n attachmentArray: [\"rid\"],\n attachmentSet: [\"rid\"],\n });\n });\n\n it(\"recursively handles structs\", async () => {\n const struct = {\n inner: {\n attachment: \"rid\",\n },\n };\n\n const recursiveConversion = await toDataValue(struct, clientCtx);\n\n expect(recursiveConversion).toEqual({\n inner: { attachment: \"rid\" },\n });\n });\n\n it(\"maps an ontology object into just its primary key\", async () => {\n const employee = stubData.employee1;\n const ontologyConversion = await toDataValue(employee, clientCtx);\n expect(ontologyConversion).toEqual(\n stubData.employee1.__primaryKey,\n );\n });\n\n it(\"maps an ontology object into just its primary key with osdk wrapper\", async () => {\n const task = await client(Employee).fetchOne(50030);\n const ontologyConversion = await toDataValue(task, clientCtx);\n expect(ontologyConversion).toEqual(\n task.$primaryKey,\n );\n });\n\n it(\"passes through object set definitions\", async () => {\n const clientObjectSet = client(Task).where({ id: 0 });\n const definition = getWireObjectSet(clientObjectSet);\n\n const expected = `\n {\n \"objectSet\": {\n \"objectType\": \"Task\",\n \"type\": \"base\",\n },\n \"type\": \"filter\",\n \"where\": {\n \"field\": \"id\",\n \"type\": \"eq\",\n \"value\": 0,\n },\n }\n `;\n const objectSetConversion = await toDataValue(clientObjectSet, clientCtx);\n expect(objectSetConversion).toMatchInlineSnapshot(\n expected,\n );\n\n const definitionConversion = await toDataValue(definition, clientCtx);\n expect(definitionConversion).toMatchInlineSnapshot(expected);\n });\n\n it(\"converts blob attachment uploads correctly\", async () => {\n const blob = new Blob([JSON.stringify({ \"hi\": \"mom\" })]);\n const attachmentUpload = createAttachmentUpload(blob, \"file1.txt\");\n const converted = await toDataValue(attachmentUpload, clientCtx);\n\n expect(converted).toMatch(/ri\\.attachments.main.attachment\\.[a-z0-9\\-]+/i);\n });\n\n it(\"converts file attachment uploads correctly\", async () => {\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 file = Object.assign(\n new Blob([\n JSON.stringify({ name: \"Hello World\" }, null, 2),\n ], {\n type: \"application/json\",\n }),\n { name: \"file1.txt\" },\n );\n\n const converted = await toDataValue(file, clientCtx);\n expect(converted).toMatch(/ri\\.attachments.main.attachment\\.[a-z0-9\\-]+/i);\n });\n\n it(\"converts media reference correctly\", async () => {\n const mediaReference: MediaReference = {\n mimeType: \"application/json\",\n reference: {\n type: \"mediaSetViewItem\",\n mediaSetViewItem: {\n mediaItemRid: \"media-item-rid\",\n mediaSetRid: \"media-set-rid\",\n mediaSetViewRid: \"media-set-view-rid\",\n },\n },\n };\n\n const converted = await toDataValue(mediaReference, clientCtx);\n expect(converted).toEqual(mediaReference);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,EAAEC,IAAI,QAAQ,4BAA4B;AAE3D,SACEC,iBAAiB,EACjBC,kBAAkB,EAClBC,QAAQ,QACH,mBAAmB;AAE1B,SAASC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ,QAAQ;AAE5D,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,mBAAmB,QAAQ,2BAA2B;AAE/D,SAASC,sBAAsB,QAAQ,+BAA+B;AACtE,SAASC,gBAAgB,QAAQ,iCAAiC;AAClE,SAASC,WAAW,QAAQ,kBAAkB;AAE9CR,QAAQ,CAACQ,WAAW,EAAE,MAAM;EAC1B,IAAIC,MAAc;EAClB,IAAIC,SAAwB;EAE+BP,EAAE,CAACQ,EAAE,CAAC,CAAC;EAElEZ,SAAS,CAAC,MAAM;IACd,MAAMa,SAAS,GAAGf,kBAAkB,CAAC,IAAID,iBAAiB,CAAC,CAAC,EAAEQ,YAAY,CAAC;IAC3E,CAAC;MAAEK;IAAO,CAAC,GAAGG,SAAS;IAEvBF,SAAS,GAAGL,mBAAmB,CAC7B;MAAEQ,WAAW,EAAED,SAAS,CAACE,WAAW,CAACC;IAAmB,CAAC,EACzDH,SAAS,CAACE,WAAW,CAACE,OAAO,EAC7BJ,SAAS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B,OAAO,CAACkC,cAAc,CAAC;EAC3C,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"toDataValue.test.js","names":["Employee","Task","LegacyFauxFoundry","MockOntologiesV2","startNodeApiServer","stubData","beforeAll","describe","expect","it","vi","createClient","createMinimalClient","createAttachmentUpload","isMediaReference","getWireObjectSet","toDataValue","client","clientCtx","mockActionMetadata","apiServer","fn","testSetup","ontologyRid","fauxFoundry","defaultOntologyRid","baseUrl","auth","apiName","close","basic","null","undefined","boolean","date","integer","string","timestamp","convertedBasic","toEqual","attachment","attachmentArray","attachmentSet","Set","recursiveConversion","inner","employee","employee1","ontologyConversion","__primaryKey","task","fetchOne","$primaryKey","clientObjectSet","where","id","definition","expected","objectSetConversion","toMatchInlineSnapshot","definitionConversion","blob","Blob","JSON","stringify","attachmentUpload","converted","toMatch","file","Object","assign","name","type","data","path","boundary","use","MediaReferenceProperties","uploadMedia","mimeType","reference","mediaSetViewItem","mediaItemRid","mediaSetRid","mediaSetViewRid","toBe","mediaReference"],"sources":["toDataValue.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 { ActionMetadata, MediaUpload } from \"@osdk/api\";\nimport { Employee, Task } from \"@osdk/client.test.ontology\";\nimport type { MediaReference } from \"@osdk/foundry.core\";\nimport type { SetupServer } from \"@osdk/shared.test\";\nimport {\n LegacyFauxFoundry,\n MockOntologiesV2,\n startNodeApiServer,\n stubData,\n} from \"@osdk/shared.test\";\nimport type { MockedFunction } from \"vitest\";\nimport { beforeAll, describe, expect, it, vi } from \"vitest\";\nimport type { Client } from \"../Client.js\";\nimport { createClient } from \"../createClient.js\";\nimport { createMinimalClient } from \"../createMinimalClient.js\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { createAttachmentUpload } from \"../object/AttachmentUpload.js\";\nimport { isMediaReference } from \"../object/mediaUpload.js\";\nimport { getWireObjectSet } from \"../objectSet/createObjectSet.js\";\nimport { toDataValue } from \"./toDataValue.js\";\n\ndescribe(toDataValue, () => {\n let client: Client;\n let clientCtx: MinimalClient;\n let mockActionMetadata: ActionMetadata;\n let apiServer: SetupServer;\n\n const mockFetch: MockedFunction<typeof globalThis.fetch> = vi.fn();\n\n beforeAll(() => {\n const testSetup = startNodeApiServer(new LegacyFauxFoundry(), createClient);\n ({ client } = testSetup);\n\n apiServer = testSetup.apiServer;\n\n clientCtx = createMinimalClient(\n { ontologyRid: testSetup.fauxFoundry.defaultOntologyRid },\n testSetup.fauxFoundry.baseUrl,\n testSetup.auth,\n {},\n );\n\n // toDataValue only needs the apiName right now, update this if that changes\n const fakeActionMetadata = {\n apiName: \"createUnstructuredImageExampleObject\",\n };\n mockActionMetadata = fakeActionMetadata as ActionMetadata;\n\n return () => {\n testSetup.apiServer.close();\n };\n });\n\n it(\"converts passthrough values correctly\", async () => {\n // basic pass through types\n const basic = {\n null: undefined,\n boolean: false,\n date: \"2024-01-01\",\n integer: 0,\n string: \"string\",\n timestamp: \"2024-01-01T00:00:00Z\",\n };\n const convertedBasic = await toDataValue(\n basic,\n clientCtx,\n mockActionMetadata,\n );\n expect(convertedBasic).toEqual(basic);\n });\n\n it(\"recursively converts arrays and sets into array types\", async () => {\n const attachment = \"rid\";\n const attachmentArray = [attachment];\n const attachmentSet = new Set(attachmentArray);\n\n const recursiveConversion = await toDataValue(\n {\n attachment,\n attachmentArray,\n attachmentSet,\n },\n clientCtx,\n mockActionMetadata,\n );\n\n expect(recursiveConversion).toEqual({\n attachment: \"rid\",\n attachmentArray: [\"rid\"],\n attachmentSet: [\"rid\"],\n });\n });\n\n it(\"recursively handles structs\", async () => {\n const struct = {\n inner: {\n attachment: \"rid\",\n },\n };\n\n const recursiveConversion = await toDataValue(\n struct,\n clientCtx,\n mockActionMetadata,\n );\n\n expect(recursiveConversion).toEqual({\n inner: { attachment: \"rid\" },\n });\n });\n\n it(\"maps an ontology object into just its primary key\", async () => {\n const employee = stubData.employee1;\n const ontologyConversion = await toDataValue(\n employee,\n clientCtx,\n mockActionMetadata,\n );\n expect(ontologyConversion).toEqual(\n stubData.employee1.__primaryKey,\n );\n });\n\n it(\"maps an ontology object into just its primary key with osdk wrapper\", async () => {\n const task = await client(Employee).fetchOne(50030);\n const ontologyConversion = await toDataValue(\n task,\n clientCtx,\n mockActionMetadata,\n );\n expect(ontologyConversion).toEqual(\n task.$primaryKey,\n );\n });\n\n it(\"passes through object set definitions\", async () => {\n const clientObjectSet = client(Task).where({ id: 0 });\n const definition = getWireObjectSet(clientObjectSet);\n\n const expected = `\n {\n \"objectSet\": {\n \"objectType\": \"Task\",\n \"type\": \"base\",\n },\n \"type\": \"filter\",\n \"where\": {\n \"field\": \"id\",\n \"type\": \"eq\",\n \"value\": 0,\n },\n }\n `;\n const objectSetConversion = await toDataValue(\n clientObjectSet,\n clientCtx,\n mockActionMetadata,\n );\n expect(objectSetConversion).toMatchInlineSnapshot(\n expected,\n );\n\n const definitionConversion = await toDataValue(\n definition,\n clientCtx,\n mockActionMetadata,\n );\n expect(definitionConversion).toMatchInlineSnapshot(expected);\n });\n\n it(\"converts blob attachment uploads correctly\", async () => {\n const blob = new Blob([JSON.stringify({ \"hi\": \"mom\" })]);\n const attachmentUpload = createAttachmentUpload(blob, \"file1.txt\");\n const converted = await toDataValue(\n attachmentUpload,\n clientCtx,\n mockActionMetadata,\n );\n\n expect(converted).toMatch(/ri\\.attachments.main.attachment\\.[a-z0-9\\-]+/i);\n });\n\n it(\"converts file attachment uploads correctly\", async () => {\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 file = Object.assign(\n new Blob([\n JSON.stringify({ name: \"Hello World\" }, null, 2),\n ], {\n type: \"application/json\",\n }),\n { name: \"file1.txt\" },\n );\n\n const converted = await toDataValue(file, clientCtx, mockActionMetadata);\n expect(converted).toMatch(/ri\\.attachments.main.attachment\\.[a-z0-9\\-]+/i);\n });\n\n it(\"converts media uploads correctly\", async () => {\n const file: MediaUpload = {\n data: new Blob([\n JSON.stringify({ name: \"Hello World\" }, null, 2),\n ], {\n type: \"application/json\",\n }),\n path: \"file.txt\",\n };\n\n // TODO: Mock MediaUpload properly in FauxFoundry\n apiServer.boundary(async () => {\n apiServer.use(\n MockOntologiesV2.MediaReferenceProperties.uploadMedia(\n \"https://stack.palantir.com\",\n () => {\n return {\n mimeType: \"application/json\",\n reference: {\n type: \"mediaSetViewItem\",\n mediaSetViewItem: {\n mediaItemRid: \"media-item-rid\",\n mediaSetRid: \"media-set-rid\",\n mediaSetViewRid: \"media-set-view-rid\",\n },\n },\n };\n },\n ),\n );\n const converted = await toDataValue(file, clientCtx, mockActionMetadata);\n expect(isMediaReference(converted)).toBe(true);\n });\n });\n\n it(\"converts media reference correctly\", async () => {\n const mediaReference: MediaReference = {\n mimeType: \"application/json\",\n reference: {\n type: \"mediaSetViewItem\",\n mediaSetViewItem: {\n mediaItemRid: \"media-item-rid\",\n mediaSetRid: \"media-set-rid\",\n mediaSetViewRid: \"media-set-view-rid\",\n },\n },\n };\n\n const converted = await toDataValue(\n mediaReference,\n clientCtx,\n mockActionMetadata,\n );\n expect(converted).toEqual(mediaReference);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,QAAQ,EAAEC,IAAI,QAAQ,4BAA4B;AAG3D,SACEC,iBAAiB,EACjBC,gBAAgB,EAChBC,kBAAkB,EAClBC,QAAQ,QACH,mBAAmB;AAE1B,SA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