@osdk/maker-experimental 0.6.0-beta.4 → 0.6.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/build/browser/api/defineOntologyV2.js +9 -3
  3. package/build/browser/api/defineOntologyV2.js.map +1 -1
  4. package/build/browser/cli/generateBackingDataset.js +250 -0
  5. package/build/browser/cli/generateBackingDataset.js.map +1 -0
  6. package/build/browser/cli/main.js +60 -7
  7. package/build/browser/cli/main.js.map +1 -1
  8. package/build/browser/cli/marketplaceSerialization/BlockGeneratorResult.js.map +1 -1
  9. package/build/browser/conversion/toMarketplace/convertLink.js +9 -4
  10. package/build/browser/conversion/toMarketplace/convertLink.js.map +1 -1
  11. package/build/browser/util/generateRid.js +10 -4
  12. package/build/browser/util/generateRid.js.map +1 -1
  13. package/build/cjs/{ActionTypeShapeExtractor-5IVLHAPH.cjs → ActionTypeShapeExtractor-UWC4CVHX.cjs} +4 -4
  14. package/build/cjs/{ActionTypeShapeExtractor-5IVLHAPH.cjs.map → ActionTypeShapeExtractor-UWC4CVHX.cjs.map} +1 -1
  15. package/build/cjs/{chunk-AWYOBJ25.cjs → chunk-JC573VYW.cjs} +13 -6
  16. package/build/cjs/chunk-JC573VYW.cjs.map +1 -0
  17. package/build/cjs/index.cjs +278 -41
  18. package/build/cjs/index.cjs.map +1 -1
  19. package/build/cjs/index.d.cts +6 -1
  20. package/build/esm/api/defineOntologyV2.js +9 -3
  21. package/build/esm/api/defineOntologyV2.js.map +1 -1
  22. package/build/esm/cli/generateBackingDataset.js +250 -0
  23. package/build/esm/cli/generateBackingDataset.js.map +1 -0
  24. package/build/esm/cli/main.js +60 -7
  25. package/build/esm/cli/main.js.map +1 -1
  26. package/build/esm/cli/marketplaceSerialization/BlockGeneratorResult.js.map +1 -1
  27. package/build/esm/conversion/toMarketplace/convertLink.js +9 -4
  28. package/build/esm/conversion/toMarketplace/convertLink.js.map +1 -1
  29. package/build/esm/util/generateRid.js +10 -4
  30. package/build/esm/util/generateRid.js.map +1 -1
  31. package/build/types/api/defineOntologyV2.d.ts +6 -1
  32. package/build/types/api/defineOntologyV2.d.ts.map +1 -1
  33. package/build/types/cli/generateBackingDataset.d.ts +16 -0
  34. package/build/types/cli/generateBackingDataset.d.ts.map +1 -0
  35. package/build/types/cli/main.d.ts.map +1 -1
  36. package/build/types/cli/marketplaceSerialization/BlockGeneratorResult.d.ts +2 -2
  37. package/build/types/cli/marketplaceSerialization/BlockGeneratorResult.d.ts.map +1 -1
  38. package/build/types/conversion/toMarketplace/convertLink.d.ts.map +1 -1
  39. package/build/types/util/generateRid.d.ts +4 -2
  40. package/build/types/util/generateRid.d.ts.map +1 -1
  41. package/package.json +4 -4
  42. package/build/browser/api/overall.test.js +0 -713
  43. package/build/browser/api/overall.test.js.map +0 -1
  44. package/build/browser/conversion/toMarketplace/shapeExtractors/ActionTypeShapeExtractor.test.js +0 -562
  45. package/build/browser/conversion/toMarketplace/shapeExtractors/ActionTypeShapeExtractor.test.js.map +0 -1
  46. package/build/browser/conversion/toMarketplace/shapeExtractors/ObjectTypeShapeExtractor.test.js +0 -677
  47. package/build/browser/conversion/toMarketplace/shapeExtractors/ObjectTypeShapeExtractor.test.js.map +0 -1
  48. package/build/cjs/chunk-AWYOBJ25.cjs.map +0 -1
  49. package/build/esm/api/overall.test.js +0 -713
  50. package/build/esm/api/overall.test.js.map +0 -1
  51. package/build/esm/conversion/toMarketplace/shapeExtractors/ActionTypeShapeExtractor.test.js +0 -562
  52. package/build/esm/conversion/toMarketplace/shapeExtractors/ActionTypeShapeExtractor.test.js.map +0 -1
  53. package/build/esm/conversion/toMarketplace/shapeExtractors/ObjectTypeShapeExtractor.test.js +0 -677
  54. package/build/esm/conversion/toMarketplace/shapeExtractors/ObjectTypeShapeExtractor.test.js.map +0 -1
  55. package/build/types/api/overall.test.d.ts +0 -1
  56. package/build/types/api/overall.test.d.ts.map +0 -1
  57. package/build/types/conversion/toMarketplace/shapeExtractors/ActionTypeShapeExtractor.test.d.ts +0 -1
  58. package/build/types/conversion/toMarketplace/shapeExtractors/ActionTypeShapeExtractor.test.d.ts.map +0 -1
  59. package/build/types/conversion/toMarketplace/shapeExtractors/ObjectTypeShapeExtractor.test.d.ts +0 -1
  60. package/build/types/conversion/toMarketplace/shapeExtractors/ObjectTypeShapeExtractor.test.d.ts.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"overall.test.js","names":["defineCreateObjectAction","defineObject","defineOntology","dumpOntologyFullMetadata","beforeEach","describe","expect","it","defineImportObject","importedObject","apiName","properties","id","type","name","foo","displayName","pluralDisplayName","titlePropertyApiName","primaryKeyPropertyApiName","objectType","parameterOrdering","parameterConfiguration","customParameterType","objectReference","objectTypeId","defaultValue","objectParameterPropertyValue","parameterId","propertyTypeId","ontology","toMatchInlineSnapshot","importedOntology"],"sources":["overall.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 {\n defineCreateObjectAction,\n defineObject,\n defineOntology,\n dumpOntologyFullMetadata,\n} from \"@osdk/maker\";\nimport { beforeEach, describe, expect, it } from \"vitest\";\nimport { defineImportObject } from \"./importObjectType.js\";\n\ndescribe(\"Experimental Test Suite\", () => {\n beforeEach(async () => {\n await defineOntology(\"com.palantir.\", () => {}, \"/tmp/\");\n });\n\n describe(\"Imports\", () => {\n it(\"Imported object types as action parameters are properly defined\", () => {\n const importedObject = defineImportObject({\n apiName: \"myImport\",\n properties: {\n id: { type: \"string\" },\n name: { type: \"string\" },\n },\n });\n const foo = defineObject({\n apiName: \"foo\",\n displayName: \"Foo\",\n pluralDisplayName: \"Foos\",\n titlePropertyApiName: \"id\",\n primaryKeyPropertyApiName: \"id\",\n properties: {\n \"id\": { type: \"string\" },\n \"date\": { type: \"date\" },\n \"team\": { type: \"string\" },\n },\n });\n defineCreateObjectAction({\n objectType: foo,\n parameterOrdering: [\"ref\", \"team\", \"id\", \"date\"],\n parameterConfiguration: {\n \"ref\": {\n customParameterType: {\n type: \"objectReference\",\n objectReference: {\n objectTypeId: importedObject.apiName,\n },\n },\n },\n \"team\": {\n defaultValue: {\n type: \"objectParameterPropertyValue\",\n objectParameterPropertyValue: {\n parameterId: \"ref\",\n propertyTypeId: \"foo\",\n },\n },\n },\n },\n });\n expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`\n {\n \"actionTypes\": {\n \"com.palantir.create-object-foo\": {\n \"actionType\": {\n \"actionTypeLogic\": {\n \"logic\": {\n \"rules\": [\n {\n \"addObjectRule\": {\n \"objectTypeId\": \"com.palantir.foo\",\n \"propertyValues\": {\n \"date\": {\n \"parameterId\": \"date\",\n \"type\": \"parameterId\",\n },\n \"id\": {\n \"parameterId\": \"id\",\n \"type\": \"parameterId\",\n },\n \"team\": {\n \"parameterId\": \"team\",\n \"type\": \"parameterId\",\n },\n },\n \"structFieldValues\": {},\n },\n \"type\": \"addObjectRule\",\n },\n ],\n },\n \"validation\": {\n \"actionTypeLevelValidation\": {\n \"rules\": {\n \"0\": {\n \"condition\": {\n \"true\": {},\n \"type\": \"true\",\n },\n \"displayMetadata\": {\n \"failureMessage\": \"\",\n \"typeClasses\": [],\n },\n },\n },\n },\n \"parameterValidations\": {\n \"date\": {\n \"conditionalOverrides\": [],\n \"defaultValidation\": {\n \"display\": {\n \"renderHint\": {\n \"dateTimePicker\": {},\n \"type\": \"dateTimePicker\",\n },\n \"visibility\": {\n \"editable\": {},\n \"type\": \"editable\",\n },\n },\n \"validation\": {\n \"allowedValues\": {\n \"datetime\": {\n \"datetime\": {\n \"maximum\": undefined,\n \"minimum\": undefined,\n },\n \"type\": \"datetime\",\n },\n \"type\": \"datetime\",\n },\n \"required\": {\n \"notRequired\": {},\n \"type\": \"notRequired\",\n },\n },\n },\n },\n \"id\": {\n \"conditionalOverrides\": [],\n \"defaultValidation\": {\n \"display\": {\n \"renderHint\": {\n \"textInput\": {},\n \"type\": \"textInput\",\n },\n \"visibility\": {\n \"editable\": {},\n \"type\": \"editable\",\n },\n },\n \"validation\": {\n \"allowedValues\": {\n \"text\": {\n \"text\": {},\n \"type\": \"text\",\n },\n \"type\": \"text\",\n },\n \"required\": {\n \"notRequired\": {},\n \"type\": \"notRequired\",\n },\n },\n },\n },\n \"ref\": {\n \"conditionalOverrides\": [],\n \"defaultValidation\": {\n \"display\": {\n \"renderHint\": {\n \"dropdown\": {},\n \"type\": \"dropdown\",\n },\n \"visibility\": {\n \"editable\": {},\n \"type\": \"editable\",\n },\n },\n \"validation\": {\n \"allowedValues\": {\n \"objectQuery\": {\n \"objectQuery\": {},\n \"type\": \"objectQuery\",\n },\n \"type\": \"objectQuery\",\n },\n \"required\": {\n \"notRequired\": {},\n \"type\": \"notRequired\",\n },\n },\n },\n },\n \"team\": {\n \"conditionalOverrides\": [],\n \"defaultValidation\": {\n \"display\": {\n \"prefill\": {\n \"objectParameterPropertyValue\": {\n \"parameterId\": \"ref\",\n \"propertyTypeId\": \"foo\",\n },\n \"type\": \"objectParameterPropertyValue\",\n },\n \"renderHint\": {\n \"textInput\": {},\n \"type\": \"textInput\",\n },\n \"visibility\": {\n \"editable\": {},\n \"type\": \"editable\",\n },\n },\n \"validation\": {\n \"allowedValues\": {\n \"text\": {\n \"text\": {},\n \"type\": \"text\",\n },\n \"type\": \"text\",\n },\n \"required\": {\n \"notRequired\": {},\n \"type\": \"notRequired\",\n },\n },\n },\n },\n },\n \"sectionValidations\": {},\n },\n },\n \"metadata\": {\n \"apiName\": \"com.palantir.create-object-foo\",\n \"displayMetadata\": {\n \"configuration\": {\n \"defaultLayout\": \"FORM\",\n \"displayAndFormat\": {\n \"table\": {\n \"columnWidthByParameterRid\": {},\n \"enableFileImport\": true,\n \"fitHorizontally\": false,\n \"frozenColumnCount\": 0,\n \"rowHeightInLines\": 1,\n },\n },\n \"enableLayoutUserSwitch\": false,\n },\n \"description\": \"\",\n \"displayName\": \"Create Foo\",\n \"icon\": {\n \"blueprint\": {\n \"color\": \"#000000\",\n \"locator\": \"edit\",\n },\n \"type\": \"blueprint\",\n },\n \"successMessage\": [],\n \"typeClasses\": [],\n },\n \"entities\": {\n \"affectedInterfaceTypes\": [],\n \"affectedLinkTypes\": [],\n \"affectedObjectTypes\": [\n \"com.palantir.foo\",\n ],\n \"typeGroups\": [],\n },\n \"formContentOrdering\": [],\n \"parameterOrdering\": [\n \"ref\",\n \"team\",\n \"id\",\n \"date\",\n ],\n \"parameters\": {\n \"date\": {\n \"displayMetadata\": {\n \"description\": \"\",\n \"displayName\": \"Date\",\n \"typeClasses\": [],\n },\n \"id\": \"date\",\n \"type\": {\n \"date\": {},\n \"type\": \"date\",\n },\n },\n \"id\": {\n \"displayMetadata\": {\n \"description\": \"\",\n \"displayName\": \"Id\",\n \"typeClasses\": [],\n },\n \"id\": \"id\",\n \"type\": {\n \"string\": {},\n \"type\": \"string\",\n },\n },\n \"ref\": {\n \"displayMetadata\": {\n \"description\": \"\",\n \"displayName\": \"Ref\",\n \"typeClasses\": [],\n },\n \"id\": \"ref\",\n \"type\": {\n \"objectReference\": {\n \"objectTypeId\": \"myImport\",\n },\n \"type\": \"objectReference\",\n },\n },\n \"team\": {\n \"displayMetadata\": {\n \"description\": \"\",\n \"displayName\": \"Team\",\n \"typeClasses\": [],\n },\n \"id\": \"team\",\n \"type\": {\n \"string\": {},\n \"type\": \"string\",\n },\n },\n },\n \"sections\": {},\n \"status\": {\n \"active\": {},\n \"type\": \"active\",\n },\n },\n },\n },\n },\n \"blockPermissionInformation\": {\n \"actionTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n },\n \"interfaceTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {\n \"com.palantir.foo\": {\n \"datasources\": [\n {\n \"datasource\": {\n \"datasetV2\": {\n \"datasetRid\": \"com.palantir.foo\",\n \"propertyMapping\": {\n \"date\": {\n \"column\": \"date\",\n \"type\": \"column\",\n },\n \"id\": {\n \"column\": \"id\",\n \"type\": \"column\",\n },\n \"team\": {\n \"column\": \"team\",\n \"type\": \"column\",\n },\n },\n },\n \"type\": \"datasetV2\",\n },\n \"datasourceName\": \"com.palantir.foo\",\n \"editsConfiguration\": {\n \"onlyAllowPrivilegedEdits\": false,\n },\n \"redacted\": false,\n },\n ],\n \"entityMetadata\": {\n \"aliases\": [],\n \"arePatchesEnabled\": false,\n },\n \"objectType\": {\n \"allImplementsInterfaces\": {},\n \"apiName\": \"com.palantir.foo\",\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"Foo\",\n \"groupDisplayName\": undefined,\n \"icon\": {\n \"blueprint\": {\n \"color\": \"#2D72D2\",\n \"locator\": \"cube\",\n },\n \"type\": \"blueprint\",\n },\n \"pluralDisplayName\": \"Foos\",\n \"visibility\": \"NORMAL\",\n },\n \"implementsInterfaces2\": [],\n \"primaryKeys\": [\n \"id\",\n ],\n \"propertyTypes\": {\n \"date\": {\n \"apiName\": \"date\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"Date\",\n \"visibility\": \"NORMAL\",\n },\n \"indexedForSearch\": true,\n \"inlineAction\": undefined,\n \"ruleSetBinding\": undefined,\n \"sharedPropertyTypeApiName\": undefined,\n \"sharedPropertyTypeRid\": undefined,\n \"status\": {\n \"active\": {},\n \"type\": \"active\",\n },\n \"type\": {\n \"date\": {},\n \"type\": \"date\",\n },\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\",\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\",\n },\n ],\n \"valueType\": undefined,\n },\n \"id\": {\n \"apiName\": \"id\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"Id\",\n \"visibility\": \"NORMAL\",\n },\n \"indexedForSearch\": true,\n \"inlineAction\": undefined,\n \"ruleSetBinding\": undefined,\n \"sharedPropertyTypeApiName\": undefined,\n \"sharedPropertyTypeRid\": undefined,\n \"status\": {\n \"active\": {},\n \"type\": \"active\",\n },\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": false,\n \"supportsEfficientLeadingWildcard\": false,\n \"supportsExactMatching\": true,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\",\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\",\n },\n ],\n \"valueType\": undefined,\n },\n \"team\": {\n \"apiName\": \"team\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"Team\",\n \"visibility\": \"NORMAL\",\n },\n \"indexedForSearch\": true,\n \"inlineAction\": undefined,\n \"ruleSetBinding\": undefined,\n \"sharedPropertyTypeApiName\": undefined,\n \"sharedPropertyTypeRid\": undefined,\n \"status\": {\n \"active\": {},\n \"type\": \"active\",\n },\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": false,\n \"supportsEfficientLeadingWildcard\": false,\n \"supportsExactMatching\": true,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\",\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\",\n },\n ],\n \"valueType\": undefined,\n },\n },\n \"redacted\": false,\n \"status\": {\n \"active\": {},\n \"type\": \"active\",\n },\n \"titlePropertyTypeRid\": \"id\",\n },\n \"propertySecurityGroupPackagingVersion\": {\n \"type\": \"v2\",\n \"v2\": {},\n },\n },\n },\n \"sharedPropertyTypes\": {},\n }\n `);\n expect(dumpOntologyFullMetadata().importedOntology).toMatchInlineSnapshot(\n `\n {\n \"actionTypes\": {},\n \"blockPermissionInformation\": {\n \"actionTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n },\n \"interfaceTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {\n \"myImport\": {\n \"datasources\": [\n {\n \"datasource\": {\n \"datasetV2\": {\n \"datasetRid\": \"myImport\",\n \"propertyMapping\": {\n \"id\": {\n \"column\": \"id\",\n \"type\": \"column\",\n },\n \"name\": {\n \"column\": \"name\",\n \"type\": \"column\",\n },\n },\n },\n \"type\": \"datasetV2\",\n },\n \"datasourceName\": \"myImport\",\n \"editsConfiguration\": {\n \"onlyAllowPrivilegedEdits\": false,\n },\n \"redacted\": false,\n },\n ],\n \"entityMetadata\": {\n \"aliases\": [],\n \"arePatchesEnabled\": false,\n },\n \"objectType\": {\n \"allImplementsInterfaces\": {},\n \"apiName\": \"myImport\",\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"MyImport\",\n \"groupDisplayName\": undefined,\n \"icon\": {\n \"blueprint\": {\n \"color\": \"#2D72D2\",\n \"locator\": \"cube\",\n },\n \"type\": \"blueprint\",\n },\n \"pluralDisplayName\": \"MyImports\",\n \"visibility\": \"NORMAL\",\n },\n \"implementsInterfaces2\": [],\n \"primaryKeys\": [\n \"id\",\n ],\n \"propertyTypes\": {\n \"id\": {\n \"apiName\": \"id\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"Id\",\n \"visibility\": \"NORMAL\",\n },\n \"indexedForSearch\": true,\n \"inlineAction\": undefined,\n \"ruleSetBinding\": undefined,\n \"sharedPropertyTypeApiName\": undefined,\n \"sharedPropertyTypeRid\": undefined,\n \"status\": {\n \"active\": {},\n \"type\": \"active\",\n },\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": false,\n \"supportsEfficientLeadingWildcard\": false,\n \"supportsExactMatching\": true,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\",\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\",\n },\n ],\n \"valueType\": undefined,\n },\n \"name\": {\n \"apiName\": \"name\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"Name\",\n \"visibility\": \"NORMAL\",\n },\n \"indexedForSearch\": true,\n \"inlineAction\": undefined,\n \"ruleSetBinding\": undefined,\n \"sharedPropertyTypeApiName\": undefined,\n \"sharedPropertyTypeRid\": undefined,\n \"status\": {\n \"active\": {},\n \"type\": \"active\",\n },\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": false,\n \"supportsEfficientLeadingWildcard\": false,\n \"supportsExactMatching\": true,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\",\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\",\n },\n ],\n \"valueType\": undefined,\n },\n },\n \"redacted\": false,\n \"status\": {\n \"active\": {},\n \"type\": \"active\",\n },\n \"titlePropertyTypeRid\": \"id\",\n },\n \"propertySecurityGroupPackagingVersion\": {\n \"type\": \"v2\",\n \"v2\": {},\n },\n },\n },\n \"sharedPropertyTypes\": {},\n }\n `,\n );\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,wBAAwB,EACxBC,YAAY,EACZC,cAAc,EACdC,wBAAwB,QACnB,aAAa;AACpB,SAASC,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AACzD,SAASC,kBAAkB,QAAQ,uBAAuB;AAE1DH,QAAQ,CAAC,yBAAyB,EAAE,MAAM;EACxCD,UAAU,CAAC,YAAY;IACrB,MAAMF,cAAc,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC;EAC1D,CAAC,CAAC;EAEFG,QAAQ,CAAC,SAAS,EAAE,MAAM;IACxBE,EAAE,CAAC,iEAAiE,EAAE,MAAM;MAC1E,MAAME,cAAc,GAAGD,kBAAkB,CAAC;QACxCE,OAAO,EAAE,UAAU;QACnBC,UAAU,EAAE;UACVC,EAAE,EAAE;YAAEC,IAAI,EAAE;UAAS,CAAC;UACtBC,IAAI,EAAE;YAAED,IAAI,EAAE;UAAS;QACzB;MACF,CAAC,CAAC;MACF,MAAME,GAAG,GAAGd,YAAY,CAAC;QACvBS,OAAO,EAAE,KAAK;QACdM,WAAW,EAAE,KAAK;QAClBC,iBAAiB,EAAE,MAAM;QACzBC,oBAAoB,EAAE,IAAI;QAC1BC,yBAAyB,EAAE,IAAI;QAC/BR,UAAU,EAAE;UACV,IAAI,EAAE;YAAEE,IAAI,EAAE;UAAS,CAAC;UACxB,MAAM,EAAE;YAAEA,IAAI,EAAE;UAAO,CAAC;UACxB,MAAM,EAAE;YAAEA,IAAI,EAAE;UAAS;QAC3B;MACF,CAAC,CAAC;MACFb,wBAAwB,CAAC;QACvBoB,UAAU,EAAEL,GAAG;QACfM,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC;QAChDC,sBAAsB,EAAE;UACtB,KAAK,EAAE;YACLC,mBAAmB,EAAE;cACnBV,IAAI,EAAE,iBAAiB;cACvBW,eAAe,EAAE;gBACfC,YAAY,EAAEhB,cAAc,CAACC;cAC/B;YACF;UACF,CAAC;UACD,MAAM,EAAE;YACNgB,YAAY,EAAE;cACZb,IAAI,EAAE,8BAA8B;cACpCc,4BAA4B,EAAE;gBAC5BC,WAAW,EAAE,KAAK;gBAClBC,cAAc,EAAE;cAClB;YACF;UACF;QACF;MACF,CAAC,CAAC;MACFvB,MAAM,CAACH,wBAAwB,CAAC,CAAC,CAAC2B,QAAQ,CAAC,CAACC,qBAAqB,CAAC;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC;MACFzB,MAAM,CAACH,wBAAwB,CAAC,CAAC,CAAC6B,gBAAgB,CAAC,CAACD,qBAAqB,CACvE;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OACM,CAAC;IACH,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1,562 +0,0 @@
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
- import { describe, expect, it } from "vitest";
18
- import { ActionTypeShapeExtractor } from "./ActionTypeShapeExtractor.js";
19
-
20
- // Mock BiMap implementation for testing
21
- class MockBiMap {
22
- constructor(entries) {
23
- this.forward = new Map(entries);
24
- this.backward = new Map(entries.map(([k, v]) => [v, k]));
25
- }
26
- asMap() {
27
- return this.forward;
28
- }
29
- get(key) {
30
- return this.forward.get(key);
31
- }
32
- put(key, value) {
33
- this.forward.set(key, value);
34
- this.backward.set(value, key);
35
- }
36
- inverse() {
37
- return new MockBiMap(Array.from(this.backward.entries()));
38
- }
39
- entries() {
40
- return this.forward.entries();
41
- }
42
- }
43
-
44
- // Helper to create a mock OntologyRidGenerator
45
- function createMockRidGenerator(overrides = {}) {
46
- return {
47
- getActionTypeRids: () => new MockBiMap([]),
48
- getParameterRidAndIds: () => new Map(),
49
- getInterfaceRids: () => new MockBiMap([]),
50
- getSharedPropertyTypeRids: () => new MockBiMap([]),
51
- getInterfaceLinkTypeRids: () => new MockBiMap([]),
52
- getInterfacePropertyTypeRids: () => new MockBiMap([]),
53
- getPropertyTypeRids: () => new MockBiMap([]),
54
- getDatasourceLocators: () => new MockBiMap([]),
55
- getFilesDatasourceLocators: () => new MockBiMap([]),
56
- getGeotimeSeriesIntegrationRids: () => new MockBiMap([]),
57
- getTimeSeriesSyncs: () => new MockBiMap([]),
58
- getColumnShapes: () => new MockBiMap([]),
59
- getObjectTypeRids: () => new MockBiMap([]),
60
- getLinkTypeRids: () => new MockBiMap([]),
61
- getGroupIds: () => new MockBiMap([]),
62
- getConsumedValueTypeReferences: () => new MockBiMap([]),
63
- getProducedValueTypeReferences: () => new Map(),
64
- valueTypeMappingForReference: () => ({
65
- input: "",
66
- output: ""
67
- }),
68
- hashString: input => input,
69
- generateRid: key => key,
70
- generateRidForInterface: apiName => `interface.${apiName}`,
71
- generateRidForInterfaceLinkType: (apiName, interfaceTypeApiName) => `interface-link.${interfaceTypeApiName}.${apiName}`,
72
- generateRidForObjectType: apiName => `object.${apiName}`,
73
- generateRidForValueType: (apiName, version) => ({
74
- rid: `vt.${apiName}.${version}`,
75
- versionId: version
76
- }),
77
- generateRidForTimeSeriesSync: name => `ts.${name}`,
78
- generateRidForLinkType: linkTypeId => `link.${linkTypeId}`,
79
- generateRidForGeotimeSeriesIntegration: name => `geotime.${name}`,
80
- generateRidForActionType: apiName => `action.${apiName}`,
81
- generateRidForParameter: (actionTypeApiName, parameterId) => `param.${actionTypeApiName}.${parameterId}`,
82
- generateSptRid: apiName => `spt.${apiName}`,
83
- generatePropertyRid: (apiName, objectTypeApiName) => `prop.${objectTypeApiName}.${apiName}`,
84
- generateInterfacePropertyTypeRid: (apiName, interfaceTypeApiName) => `interface-prop.${interfaceTypeApiName}.${apiName}`,
85
- generateStructFieldRid: (propertyApiName, apiName) => `struct-field.${propertyApiName}.${apiName}`,
86
- generateLocator: dataSetName => ({
87
- rid: `dataset.${dataSetName}`,
88
- branchId: "main"
89
- }),
90
- generateStreamLocator: streamName => ({
91
- streamLocatorRid: `stream.${streamName}`,
92
- branchId: "main"
93
- }),
94
- generateRestrictedViewLocator: restrictedViewName => ({
95
- rid: `restricted-view.${restrictedViewName}`
96
- }),
97
- generateMediaSetViewLocator: mediaSetViewName => ({
98
- mediaSetRid: `media-set.${mediaSetViewName}`,
99
- mediaSetViewRid: `media-set-view.${mediaSetViewName}`,
100
- mediaSetBranchRid: `media-set-branch.${mediaSetViewName}`
101
- }),
102
- toBlockInternalId: readableId => {
103
- return readableId;
104
- },
105
- getObjectTypeIds: () => new MockBiMap([]),
106
- generateObjectTypeId: objectTypeApiName => objectTypeApiName.replace(/\./g, "-").toLowerCase(),
107
- generateDatasourceRid: datasourceName => `ri.ontology.main.datasource.${datasourceName}`,
108
- generateValidationRuleRid: (actionTypeApiName, index) => `validation-rule.${actionTypeApiName}.${index}`,
109
- generateSectionRid: sectionId => `ri.ontology-metadata.temp.section.${sectionId}`,
110
- generatePropertySecurityGroupRid: groupName => `ri.ontology-metadata.temp.property-security-group.${groupName}`,
111
- ...overrides
112
- };
113
- }
114
- describe("ActionTypeShapeExtractor", () => {
115
- describe("constructor", () => {
116
- it("should create extractor without randomness key", () => {
117
- const extractor = new ActionTypeShapeExtractor();
118
- expect(extractor).toBeDefined();
119
- });
120
- it("should create extractor with randomness key", () => {
121
- const extractor = new ActionTypeShapeExtractor();
122
- expect(extractor).toBeDefined();
123
- });
124
- });
125
- describe("extract", () => {
126
- it("should extract basic action type with parameters", () => {
127
- const ridGenerator = createMockRidGenerator({
128
- getActionTypeRids: () => new MockBiMap([["action-type-createTask", "ri.ontology.main.action-type.create-task"]])
129
- });
130
- const extractor = new ActionTypeShapeExtractor();
131
- const result = extractor.extract({
132
- actionType: {
133
- metadata: {
134
- rid: "ri.ontology.main.action-type.create-task",
135
- apiName: "createTask",
136
- displayMetadata: {
137
- displayName: "Create Task",
138
- description: "Creates a new task in the system",
139
- visibility: "NORMAL",
140
- icon: {
141
- type: "blueprint",
142
- blueprint: {
143
- locator: "add",
144
- color: "#2D72D2"
145
- }
146
- }
147
- },
148
- status: {
149
- type: "active",
150
- active: {}
151
- },
152
- parameters: {
153
- title: {
154
- displayMetadata: {
155
- displayName: "Title",
156
- description: "The task title",
157
- visibility: "NORMAL"
158
- },
159
- type: {
160
- type: "string",
161
- string: {
162
- isLongText: false,
163
- supportsExactMatching: true
164
- }
165
- },
166
- required: true
167
- },
168
- priority: {
169
- displayMetadata: {
170
- displayName: "Priority",
171
- description: "Task priority level",
172
- visibility: "NORMAL"
173
- },
174
- type: {
175
- type: "integer",
176
- integer: {}
177
- },
178
- required: false
179
- }
180
- }
181
- }
182
- },
183
- parameterIds: {
184
- title: "title",
185
- priority: "priority"
186
- }
187
- }, ridGenerator, {
188
- actionParameterIds: {},
189
- actionParameters: {},
190
- actionTypes: {},
191
- datasourceColumns: {},
192
- datasources: {},
193
- filesDatasources: {},
194
- functions: {},
195
- geotimeSeriesSyncs: {},
196
- groupIds: {},
197
- interfaceLinkTypes: {},
198
- interfacePropertyTypes: {},
199
- interfaceTypes: {},
200
- linkTypeIds: {},
201
- linkTypes: {},
202
- markings: {},
203
- objectTypeIds: {},
204
- objectTypes: {},
205
- propertyTypeIds: {},
206
- propertyTypes: {},
207
- sharedPropertyTypes: {},
208
- timeSeriesSyncs: {},
209
- valueTypes: {},
210
- webhooks: {},
211
- workshopModules: {}
212
- });
213
-
214
- // Should have output shapes for action type and parameters
215
- expect(result.outputShapes.size).toBe(3); // action + 2 parameters
216
- expect(result.outputShapes.has("action-type-createTask")).toBe(true);
217
- const actionShape = result.outputShapes.get("action-type-createTask");
218
- expect(actionShape).toBeDefined();
219
- expect(actionShape?.type).toBe("action");
220
- if (actionShape?.type === "action") {
221
- expect(actionShape.action.about.fallbackTitle).toBe("Create Task");
222
- expect(actionShape.action.about.fallbackDescription).toBe("Creates a new task in the system");
223
- expect(actionShape.action.parameters).toEqual({});
224
- expect(actionShape.action.parametersV2).toHaveLength(2);
225
- }
226
-
227
- // Check parameter shapes
228
- const titleParamShape = result.outputShapes.get("action-createTask-parameter-title");
229
- expect(titleParamShape).toBeDefined();
230
- expect(titleParamShape?.type).toBe("actionParameter");
231
- if (titleParamShape?.type === "actionParameter") {
232
- expect(titleParamShape.actionParameter.about.fallbackTitle).toBe("Title");
233
- expect(titleParamShape.actionParameter.about.fallbackDescription).toBe("The task title");
234
- expect(titleParamShape.actionParameter.actionType).toBe("action-type-createTask");
235
- }
236
- });
237
- it("should extract action type without parameters", () => {
238
- const ridGenerator = createMockRidGenerator({
239
- getActionTypeRids: () => new MockBiMap([["action-type-refresh", "ri.ontology.main.action-type.refresh"]])
240
- });
241
- const extractor = new ActionTypeShapeExtractor();
242
- const result = extractor.extract({
243
- actionType: {
244
- metadata: {
245
- rid: "ri.ontology.main.action-type.refresh",
246
- apiName: "refresh",
247
- displayMetadata: {
248
- displayName: "Refresh",
249
- description: "Refreshes the current view",
250
- visibility: "NORMAL",
251
- icon: {
252
- type: "blueprint",
253
- blueprint: {
254
- locator: "refresh",
255
- color: "#2D72D2"
256
- }
257
- }
258
- },
259
- status: {
260
- type: "active",
261
- active: {}
262
- },
263
- parameters: {}
264
- }
265
- },
266
- parameterIds: {}
267
- }, ridGenerator, {
268
- actionParameterIds: {},
269
- actionParameters: {},
270
- actionTypes: {},
271
- datasourceColumns: {},
272
- datasources: {},
273
- filesDatasources: {},
274
- functions: {},
275
- geotimeSeriesSyncs: {},
276
- groupIds: {},
277
- interfaceLinkTypes: {},
278
- interfacePropertyTypes: {},
279
- interfaceTypes: {},
280
- linkTypeIds: {},
281
- linkTypes: {},
282
- markings: {},
283
- objectTypeIds: {},
284
- objectTypes: {},
285
- propertyTypeIds: {},
286
- propertyTypes: {},
287
- sharedPropertyTypes: {},
288
- timeSeriesSyncs: {},
289
- valueTypes: {},
290
- webhooks: {},
291
- workshopModules: {}
292
- });
293
-
294
- // Should have only action type shape, no parameters
295
- expect(result.outputShapes.size).toBe(1);
296
- expect(result.outputShapes.has("action-type-refresh")).toBe(true);
297
- const actionShape = result.outputShapes.get("action-type-refresh");
298
- expect(actionShape).toBeDefined();
299
- expect(actionShape?.type).toBe("action");
300
- if (actionShape?.type === "action") {
301
- expect(actionShape.action.parametersV2).toHaveLength(0);
302
- }
303
- });
304
- it("should return empty shapes if action has no readable ID", () => {
305
- // RidGenerator without the action RID mapping
306
- const ridGenerator = createMockRidGenerator();
307
- const extractor = new ActionTypeShapeExtractor();
308
- const result = extractor.extract({
309
- actionType: {
310
- metadata: {
311
- rid: "ri.ontology.main.action-type.unknown",
312
- apiName: "unknown",
313
- displayMetadata: {
314
- displayName: "Unknown",
315
- visibility: "NORMAL",
316
- icon: {
317
- type: "blueprint",
318
- blueprint: {
319
- locator: "help",
320
- color: "#2D72D2"
321
- }
322
- }
323
- },
324
- status: {
325
- type: "active",
326
- active: {}
327
- },
328
- parameters: {}
329
- }
330
- },
331
- parameterIds: {}
332
- }, ridGenerator, {
333
- actionParameterIds: {},
334
- actionParameters: {},
335
- actionTypes: {},
336
- datasourceColumns: {},
337
- datasources: {},
338
- filesDatasources: {},
339
- functions: {},
340
- geotimeSeriesSyncs: {},
341
- groupIds: {},
342
- interfaceLinkTypes: {},
343
- interfacePropertyTypes: {},
344
- interfaceTypes: {},
345
- linkTypeIds: {},
346
- linkTypes: {},
347
- markings: {},
348
- objectTypeIds: {},
349
- objectTypes: {},
350
- propertyTypeIds: {},
351
- propertyTypes: {},
352
- sharedPropertyTypes: {},
353
- timeSeriesSyncs: {},
354
- valueTypes: {},
355
- webhooks: {},
356
- workshopModules: {}
357
- });
358
-
359
- // Should return empty shapes
360
- expect(result.inputShapes.size).toBe(0);
361
- expect(result.outputShapes.size).toBe(0);
362
- expect(result.inputShapeMetadata.size).toBe(0);
363
- });
364
- it("should handle action with multiple parameters", () => {
365
- const ridGenerator = createMockRidGenerator({
366
- getActionTypeRids: () => new MockBiMap([["action-type-complexAction", "ri.ontology.main.action-type.complex"]])
367
- });
368
- const extractor = new ActionTypeShapeExtractor();
369
- const result = extractor.extract({
370
- actionType: {
371
- metadata: {
372
- rid: "ri.ontology.main.action-type.complex",
373
- apiName: "complexAction",
374
- displayMetadata: {
375
- displayName: "Complex Action",
376
- description: "An action with many parameters",
377
- visibility: "NORMAL",
378
- icon: {
379
- type: "blueprint",
380
- blueprint: {
381
- locator: "cog",
382
- color: "#2D72D2"
383
- }
384
- }
385
- },
386
- status: {
387
- type: "active",
388
- active: {}
389
- },
390
- parameters: {
391
- param1: {
392
- displayMetadata: {
393
- displayName: "Parameter 1",
394
- visibility: "NORMAL"
395
- },
396
- type: {
397
- type: "string",
398
- string: {
399
- isLongText: false,
400
- supportsExactMatching: true
401
- }
402
- },
403
- required: true
404
- },
405
- param2: {
406
- displayMetadata: {
407
- displayName: "Parameter 2",
408
- visibility: "NORMAL"
409
- },
410
- type: {
411
- type: "boolean",
412
- boolean: {}
413
- },
414
- required: false
415
- },
416
- param3: {
417
- displayMetadata: {
418
- displayName: "Parameter 3",
419
- visibility: "NORMAL"
420
- },
421
- type: {
422
- type: "double",
423
- double: {}
424
- },
425
- required: false
426
- }
427
- }
428
- }
429
- },
430
- parameterIds: {
431
- param1: "param1",
432
- param2: "param2",
433
- param3: "param3"
434
- }
435
- }, ridGenerator, {
436
- actionParameterIds: {},
437
- actionParameters: {},
438
- actionTypes: {},
439
- datasourceColumns: {},
440
- datasources: {},
441
- filesDatasources: {},
442
- functions: {},
443
- geotimeSeriesSyncs: {},
444
- groupIds: {},
445
- interfaceLinkTypes: {},
446
- interfacePropertyTypes: {},
447
- interfaceTypes: {},
448
- linkTypeIds: {},
449
- linkTypes: {},
450
- markings: {},
451
- objectTypeIds: {},
452
- objectTypes: {},
453
- propertyTypeIds: {},
454
- propertyTypes: {},
455
- sharedPropertyTypes: {},
456
- timeSeriesSyncs: {},
457
- valueTypes: {},
458
- webhooks: {},
459
- workshopModules: {}
460
- });
461
-
462
- // Should have action + 3 parameters
463
- expect(result.outputShapes.size).toBe(4);
464
- expect(result.outputShapes.has("action-type-complexAction")).toBe(true);
465
- expect(result.outputShapes.has("action-complexAction-parameter-param1")).toBe(true);
466
- expect(result.outputShapes.has("action-complexAction-parameter-param2")).toBe(true);
467
- expect(result.outputShapes.has("action-complexAction-parameter-param3")).toBe(true);
468
- const actionShape = result.outputShapes.get("action-type-complexAction");
469
- if (actionShape?.type === "action") {
470
- expect(actionShape.action.parametersV2).toHaveLength(3);
471
- }
472
- });
473
- it("should apply randomness key through toBlockInternalId", () => {
474
- const ridGenerator = createMockRidGenerator({
475
- getActionTypeRids: () => new MockBiMap([["action-type-testAction", "ri.ontology.main.action-type.test"]]),
476
- toBlockInternalId: readableId => {
477
- // Simulate adding randomness
478
- return `${readableId}-with-randomness`;
479
- }
480
- });
481
- const extractor = new ActionTypeShapeExtractor();
482
- const result = extractor.extract({
483
- actionType: {
484
- metadata: {
485
- rid: "ri.ontology.main.action-type.test",
486
- apiName: "testAction",
487
- displayMetadata: {
488
- displayName: "Test Action",
489
- visibility: "NORMAL",
490
- icon: {
491
- type: "blueprint",
492
- blueprint: {
493
- locator: "beaker",
494
- color: "#2D72D2"
495
- }
496
- }
497
- },
498
- status: {
499
- type: "active",
500
- active: {}
501
- },
502
- parameters: {
503
- input: {
504
- displayMetadata: {
505
- displayName: "Input",
506
- visibility: "NORMAL"
507
- },
508
- type: {
509
- type: "string",
510
- string: {
511
- isLongText: false,
512
- supportsExactMatching: true
513
- }
514
- },
515
- required: true
516
- }
517
- }
518
- }
519
- },
520
- parameterIds: {
521
- input: "input"
522
- }
523
- }, ridGenerator, {
524
- actionParameterIds: {},
525
- actionParameters: {},
526
- actionTypes: {},
527
- datasourceColumns: {},
528
- datasources: {},
529
- filesDatasources: {},
530
- functions: {},
531
- geotimeSeriesSyncs: {},
532
- groupIds: {},
533
- interfaceLinkTypes: {},
534
- interfacePropertyTypes: {},
535
- interfaceTypes: {},
536
- linkTypeIds: {},
537
- linkTypes: {},
538
- markings: {},
539
- objectTypeIds: {},
540
- objectTypes: {},
541
- propertyTypeIds: {},
542
- propertyTypes: {},
543
- sharedPropertyTypes: {},
544
- timeSeriesSyncs: {},
545
- valueTypes: {},
546
- webhooks: {},
547
- workshopModules: {}
548
- });
549
- const actionShape = result.outputShapes.get("action-type-testAction");
550
- if (actionShape?.type === "action") {
551
- // Parameters should have randomness applied
552
- expect(actionShape.action.parametersV2[0]).toContain("with-randomness");
553
- }
554
- const paramShape = result.outputShapes.get("action-type-testAction-parameter-input");
555
- if (paramShape?.type === "actionParameter") {
556
- // Action type reference should have randomness applied
557
- expect(paramShape.actionParameter.actionType).toContain("with-randomness");
558
- }
559
- });
560
- });
561
- });
562
- //# sourceMappingURL=ActionTypeShapeExtractor.test.js.map