@osdk/maker 0.14.0-beta.5 → 0.14.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.
Files changed (105) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +86 -22
  3. package/build/browser/api/action/DefaultFormat.js +2 -0
  4. package/build/browser/api/action/DefaultFormat.js.map +1 -0
  5. package/build/browser/api/action/TableConfiguration.js +2 -0
  6. package/build/browser/api/action/TableConfiguration.js.map +1 -0
  7. package/build/browser/api/defineAction.js.map +1 -1
  8. package/build/browser/api/defineCreateInterfaceObjectAction.js +9 -1
  9. package/build/browser/api/defineCreateInterfaceObjectAction.js.map +1 -1
  10. package/build/browser/api/defineCreateObjectAction.js +7 -3
  11. package/build/browser/api/defineCreateObjectAction.js.map +1 -1
  12. package/build/browser/api/defineCreateOrModifyObjectAction.js +6 -3
  13. package/build/browser/api/defineCreateOrModifyObjectAction.js.map +1 -1
  14. package/build/browser/api/defineDeleteInterfaceObjectAction.js +53 -0
  15. package/build/browser/api/defineDeleteInterfaceObjectAction.js.map +1 -0
  16. package/build/browser/api/defineLink.js +5 -13
  17. package/build/browser/api/defineLink.js.map +1 -1
  18. package/build/browser/api/defineModifyInterfaceObjectAction.js +8 -0
  19. package/build/browser/api/defineModifyInterfaceObjectAction.js.map +1 -1
  20. package/build/browser/api/defineModifyObjectAction.js +4 -2
  21. package/build/browser/api/defineModifyObjectAction.js.map +1 -1
  22. package/build/browser/api/defineObject.js +94 -3
  23. package/build/browser/api/defineObject.js.map +1 -1
  24. package/build/browser/api/links/LinkType.js.map +1 -1
  25. package/build/browser/api/object/ObjectType.js.map +1 -1
  26. package/build/browser/api/object/ObjectTypeDatasourceDefinition.js.map +1 -1
  27. package/build/browser/api/object/ObjectTypeDefinition.js.map +1 -1
  28. package/build/browser/api/test/actions.test.js +3216 -2363
  29. package/build/browser/api/test/actions.test.js.map +1 -1
  30. package/build/browser/api/test/objects.test.js +1109 -12
  31. package/build/browser/api/test/objects.test.js.map +1 -1
  32. package/build/browser/cli/main.js +1 -1
  33. package/build/browser/conversion/toMarketplace/convertDatasourceDefinition.js +3 -2
  34. package/build/browser/conversion/toMarketplace/convertDatasourceDefinition.js.map +1 -1
  35. package/build/browser/conversion/toMarketplace/convertLink.js +109 -24
  36. package/build/browser/conversion/toMarketplace/convertLink.js.map +1 -1
  37. package/build/browser/conversion/toMarketplace/convertObject.js +81 -4
  38. package/build/browser/conversion/toMarketplace/convertObject.js.map +1 -1
  39. package/build/browser/index.js +1 -0
  40. package/build/browser/index.js.map +1 -1
  41. package/build/cjs/index.cjs +471 -201
  42. package/build/cjs/index.cjs.map +1 -1
  43. package/build/cjs/index.d.cts +154 -102
  44. package/build/esm/api/action/DefaultFormat.js +2 -0
  45. package/build/esm/api/action/DefaultFormat.js.map +1 -0
  46. package/build/esm/api/action/TableConfiguration.js +2 -0
  47. package/build/esm/api/action/TableConfiguration.js.map +1 -0
  48. package/build/esm/api/defineAction.js.map +1 -1
  49. package/build/esm/api/defineCreateInterfaceObjectAction.js +9 -1
  50. package/build/esm/api/defineCreateInterfaceObjectAction.js.map +1 -1
  51. package/build/esm/api/defineCreateObjectAction.js +7 -3
  52. package/build/esm/api/defineCreateObjectAction.js.map +1 -1
  53. package/build/esm/api/defineCreateOrModifyObjectAction.js +6 -3
  54. package/build/esm/api/defineCreateOrModifyObjectAction.js.map +1 -1
  55. package/build/esm/api/defineDeleteInterfaceObjectAction.js +53 -0
  56. package/build/esm/api/defineDeleteInterfaceObjectAction.js.map +1 -0
  57. package/build/esm/api/defineLink.js +5 -13
  58. package/build/esm/api/defineLink.js.map +1 -1
  59. package/build/esm/api/defineModifyInterfaceObjectAction.js +8 -0
  60. package/build/esm/api/defineModifyInterfaceObjectAction.js.map +1 -1
  61. package/build/esm/api/defineModifyObjectAction.js +4 -2
  62. package/build/esm/api/defineModifyObjectAction.js.map +1 -1
  63. package/build/esm/api/defineObject.js +94 -3
  64. package/build/esm/api/defineObject.js.map +1 -1
  65. package/build/esm/api/links/LinkType.js.map +1 -1
  66. package/build/esm/api/object/ObjectType.js.map +1 -1
  67. package/build/esm/api/object/ObjectTypeDatasourceDefinition.js.map +1 -1
  68. package/build/esm/api/object/ObjectTypeDefinition.js.map +1 -1
  69. package/build/esm/api/test/actions.test.js +3216 -2363
  70. package/build/esm/api/test/actions.test.js.map +1 -1
  71. package/build/esm/api/test/objects.test.js +1109 -12
  72. package/build/esm/api/test/objects.test.js.map +1 -1
  73. package/build/esm/cli/main.js +1 -1
  74. package/build/esm/conversion/toMarketplace/convertDatasourceDefinition.js +3 -2
  75. package/build/esm/conversion/toMarketplace/convertDatasourceDefinition.js.map +1 -1
  76. package/build/esm/conversion/toMarketplace/convertLink.js +109 -24
  77. package/build/esm/conversion/toMarketplace/convertLink.js.map +1 -1
  78. package/build/esm/conversion/toMarketplace/convertObject.js +81 -4
  79. package/build/esm/conversion/toMarketplace/convertObject.js.map +1 -1
  80. package/build/esm/index.js +1 -0
  81. package/build/esm/index.js.map +1 -1
  82. package/build/types/api/action/DefaultFormat.d.ts +1 -0
  83. package/build/types/api/action/DefaultFormat.d.ts.map +1 -0
  84. package/build/types/api/action/TableConfiguration.d.ts +8 -0
  85. package/build/types/api/action/TableConfiguration.d.ts.map +1 -0
  86. package/build/types/api/defineAction.d.ts +8 -4
  87. package/build/types/api/defineAction.d.ts.map +1 -1
  88. package/build/types/api/defineCreateObjectAction.d.ts.map +1 -1
  89. package/build/types/api/defineDeleteInterfaceObjectAction.d.ts +3 -0
  90. package/build/types/api/defineDeleteInterfaceObjectAction.d.ts.map +1 -0
  91. package/build/types/api/defineLink.d.ts.map +1 -1
  92. package/build/types/api/defineObject.d.ts.map +1 -1
  93. package/build/types/api/links/LinkType.d.ts +7 -7
  94. package/build/types/api/object/ObjectType.d.ts +1 -1
  95. package/build/types/api/object/ObjectType.d.ts.map +1 -1
  96. package/build/types/api/object/ObjectTypeDatasourceDefinition.d.ts +41 -1
  97. package/build/types/api/object/ObjectTypeDatasourceDefinition.d.ts.map +1 -1
  98. package/build/types/api/object/ObjectTypeDefinition.d.ts +1 -1
  99. package/build/types/api/object/ObjectTypeDefinition.d.ts.map +1 -1
  100. package/build/types/conversion/toMarketplace/convertLink.d.ts +6 -0
  101. package/build/types/conversion/toMarketplace/convertLink.d.ts.map +1 -1
  102. package/build/types/conversion/toMarketplace/convertObject.d.ts.map +1 -1
  103. package/build/types/index.d.ts +1 -0
  104. package/build/types/index.d.ts.map +1 -1
  105. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"defineCreateObjectAction.js","names":["convertMappingValue","convertValidationRule","createDefaultParameterOrdering","createParameters","defineAction","isPropertyParameter","kebab","validateActionParameters","validateParameterOrdering","defineCreateObjectAction","def","Object","keys","objectType","properties","apiName","propertyParameters","filter","id","type","parameterNames","Set","parameterConfiguration","forEach","param","add","actionApiName","split","pop","parameterOrdering","parameters","mappings","fromEntries","entries","nonParameterMappings","map","value","displayName","status","entities","affectedInterfaceTypes","affectedObjectTypes","affectedLinkTypes","typeGroups","rules","addObjectRule","objectTypeId","propertyValues","p","parameterId","structFieldValues","actionLevelValidation","validation","defaultFormat","enableLayoutSwitch","displayAndFormat","sections","section","submissionMetadata"],"sources":["defineCreateObjectAction.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 { convertMappingValue } from \"../conversion/toMarketplace/convertMappingValue.js\";\nimport { type ActionType } from \"./action/ActionType.js\";\nimport type { ActionTypeUserDefinition } from \"./defineAction.js\";\nimport {\n convertValidationRule,\n createDefaultParameterOrdering,\n createParameters,\n defineAction,\n isPropertyParameter,\n kebab,\n validateActionParameters,\n validateParameterOrdering,\n} from \"./defineAction.js\";\n\nexport function defineCreateObjectAction(\n def: ActionTypeUserDefinition,\n): ActionType {\n validateActionParameters(\n def,\n Object.keys(def.objectType.properties ?? {}),\n def.objectType.apiName,\n );\n const propertyParameters = Object.keys(def.objectType.properties ?? {})\n .filter(\n id => isPropertyParameter(def, id, def.objectType.properties?.[id].type!),\n );\n const parameterNames = new Set(propertyParameters);\n Object.keys(def.parameterConfiguration ?? {}).forEach(param =>\n parameterNames.add(param)\n );\n const actionApiName = def.apiName\n ?? `create-object-${\n kebab(def.objectType.apiName.split(\".\").pop() ?? def.objectType.apiName)\n }`;\n if (def.parameterOrdering) {\n validateParameterOrdering(\n def.parameterOrdering,\n parameterNames,\n actionApiName,\n );\n }\n const parameters = createParameters(\n def,\n def.objectType.properties ?? {},\n parameterNames,\n );\n const mappings = Object.fromEntries(\n Object.entries(def.nonParameterMappings ?? {}).map((\n [id, value],\n ) => [id, convertMappingValue(value)]),\n );\n\n return defineAction({\n apiName: actionApiName,\n displayName: def.displayName ?? `Create ${def.objectType.displayName}`,\n parameters: parameters,\n status: def.status ?? \"active\",\n entities: {\n affectedInterfaceTypes: [],\n affectedObjectTypes: [def.objectType.apiName],\n affectedLinkTypes: [],\n typeGroups: [],\n },\n rules: [{\n type: \"addObjectRule\",\n addObjectRule: {\n objectTypeId: def.objectType.apiName,\n propertyValues: {\n ...Object.fromEntries(\n propertyParameters.map(\n p => [p, { type: \"parameterId\", parameterId: p }],\n ),\n ),\n ...mappings,\n },\n structFieldValues: {},\n },\n }],\n parameterOrdering: def.parameterOrdering\n ?? createDefaultParameterOrdering(\n def,\n Object.keys(def.objectType.properties ?? {}),\n parameters,\n ),\n ...(def.actionLevelValidation\n ? {\n validation: convertValidationRule(\n def.actionLevelValidation,\n parameters,\n ),\n }\n : {}),\n ...(def.defaultFormat && { defaultFormat: def.defaultFormat }),\n ...(def.enableLayoutSwitch\n && { enableLayoutSwitch: def.enableLayoutSwitch }),\n ...(def.displayAndFormat && { displayAndFormat: def.displayAndFormat }),\n ...(def.sections\n && {\n sections: Object.fromEntries(\n def.sections.map(section => [section.id, section]),\n ),\n }),\n ...(def.submissionMetadata\n && { submissionMetadata: def.submissionMetadata }),\n });\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,mBAAmB,QAAQ,oDAAoD;AAGxF,SACEC,qBAAqB,EACrBC,8BAA8B,EAC9BC,gBAAgB,EAChBC,YAAY,EACZC,mBAAmB,EACnBC,KAAK,EACLC,wBAAwB,EACxBC,yBAAyB,QACpB,mBAAmB;AAE1B,OAAO,SAASC,wBAAwBA,CACtCC,GAA6B,EACjB;EACZH,wBAAwB,CACtBG,GAAG,EACHC,MAAM,CAACC,IAAI,CAACF,GAAG,CAACG,UAAU,CAACC,UAAU,IAAI,CAAC,CAAC,CAAC,EAC5CJ,GAAG,CAACG,UAAU,CAACE,OACjB,CAAC;EACD,MAAMC,kBAAkB,GAAGL,MAAM,CAACC,IAAI,CAACF,GAAG,CAACG,UAAU,CAACC,UAAU,IAAI,CAAC,CAAC,CAAC,CACpEG,MAAM,CACLC,EAAE,IAAIb,mBAAmB,CAACK,GAAG,EAAEQ,EAAE,EAAER,GAAG,CAACG,UAAU,CAACC,UAAU,GAAGI,EAAE,CAAC,CAACC,IAAK,CAC1E,CAAC;EACH,MAAMC,cAAc,GAAG,IAAIC,GAAG,CAACL,kBAAkB,CAAC;EAClDL,MAAM,CAACC,IAAI,CAACF,GAAG,CAACY,sBAAsB,IAAI,CAAC,CAAC,CAAC,CAACC,OAAO,CAACC,KAAK,IACzDJ,cAAc,CAACK,GAAG,CAACD,KAAK,CAC1B,CAAC;EACD,MAAME,aAAa,GAAGhB,GAAG,CAACK,OAAO,IAC5B,iBACDT,KAAK,CAACI,GAAG,CAACG,UAAU,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AAC,IAAI,CAACA,CAAC,EAAE;YAAE7B,IAAI,EAAE,aAAa;YAAE8B,WAAW,EAAED;UAAE,CAAC,CAClD,CACF,CAAC;UACD,GAAGjB;QACL,CAAC;QACDmB,iBAAiB,EAAE,CAAC;MACtB;IACF,CAAC,CAAC;IACFrB,iBAAiB,EAAEnB,GAAG,CAACmB,iBAAiB,IACnC3B,8BAA8B,CAC/BQ,GAAG,EACHC,MAAM,CAACC,IAAI,CAACF,GAAG,CAACG,UAAU,CAACC,UAAU,IAAI,CAAC,CAAC,CAAC,EAC5CgB,UACF,CAAC;IACH,IAAIpB,GAAG,CAACyC,qBAAqB,GACzB;MACAC,UAAU,EAAEnD,qBAAqB,CAC/BS,GAAG,CAACyC,qBAAqB,EACzBrB,UACF;IACF,CAAC,GACC,CAAC,CAAC,CAAC;IACP,IAAIpB,GAAG,CAAC2C,aAAa,IAAI;MAAEA,aAAa,EAAE3C,GAAG,CAAC2C;IAAc,CAAC,CAAC;IAC9D,IAAI3C,GAAG,CAAC4C,kBAAkB,IACrB;MAAEA,kBAAkB,EAAE5C,GAAG,CAAC4C;IAAmB,CAAC,CAAC;IACpD,IAAI5C,GAAG,CAAC6C,gBAAgB,IAAI;MAAEA,gBAAgB,EAAE7C,GAAG,CAAC6C;IAAiB,CAAC,CAAC;IACvE,IAAI7C,GAAG,CAAC8C,QAAQ,IACX;MACDA,QAAQ,EAAE7C,MAAM,CAACqB,WAAW,CAC1BtB,GAAG,CAAC8C,QAAQ,CAACrB,GAAG,CAACsB,OAAO,IAAI,CAACA,OAAO,CAACvC,EAAE,EAAEuC,OAAO,CAAC,CACnD;IACF,CAAC,CAAC;IACJ,IAAI/C,GAAG,CAACgD,kBAAkB,IACrB;MAAEA,kBAAkB,EAAEhD,GAAG,CAACgD;IAAmB,CAAC;EACrD,CAAC,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"defineCreateObjectAction.js","names":["convertMappingValue","convertValidationRule","createDefaultParameterOrdering","createParameters","defineAction","isPropertyParameter","kebab","validateActionParameters","validateParameterOrdering","isStruct","defineCreateObjectAction","def","Object","keys","objectType","properties","apiName","propertiesWithDerivedDatasources","datasources","filter","ds","type","flatMap","propertyMapping","propertyParameters","id","includes","parameterNames","Set","parameterConfiguration","forEach","param","add","actionApiName","split","pop","parameterOrdering","parameters","mappings","fromEntries","entries","nonParameterMappings","map","value","displayName","status","entities","affectedInterfaceTypes","affectedObjectTypes","affectedLinkTypes","typeGroups","rules","addObjectRule","objectTypeId","propertyValues","p","parameterId","structFieldValues","actionLevelValidation","validation","defaultFormat","enableLayoutSwitch","tableConfiguration","displayAndFormat","table","sections","section","submissionMetadata"],"sources":["defineCreateObjectAction.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 { convertMappingValue } from \"../conversion/toMarketplace/convertMappingValue.js\";\nimport { type ActionType } from \"./action/ActionType.js\";\nimport type { ActionTypeUserDefinition } from \"./defineAction.js\";\nimport {\n convertValidationRule,\n createDefaultParameterOrdering,\n createParameters,\n defineAction,\n isPropertyParameter,\n kebab,\n validateActionParameters,\n validateParameterOrdering,\n} from \"./defineAction.js\";\nimport { isStruct } from \"./properties/PropertyTypeType.js\";\n\nexport function defineCreateObjectAction(\n def: ActionTypeUserDefinition,\n): ActionType {\n validateActionParameters(\n def,\n Object.keys(def.objectType.properties ?? {}),\n def.objectType.apiName,\n );\n const propertiesWithDerivedDatasources = (def.objectType.datasources ?? [])\n .filter(ds => ds.type === \"derived\").flatMap(ds =>\n Object.keys(ds.propertyMapping)\n );\n const propertyParameters = Object.keys(def.objectType.properties ?? {})\n .filter(\n id =>\n isPropertyParameter(def, id, def.objectType.properties?.[id].type!)\n && !isStruct(def.objectType.properties?.[id].type!)\n && !propertiesWithDerivedDatasources.includes(id),\n );\n const parameterNames = new Set(propertyParameters);\n Object.keys(def.parameterConfiguration ?? {}).forEach(param =>\n parameterNames.add(param)\n );\n const actionApiName = def.apiName\n ?? `create-object-${\n kebab(def.objectType.apiName.split(\".\").pop() ?? def.objectType.apiName)\n }`;\n if (def.parameterOrdering) {\n validateParameterOrdering(\n def.parameterOrdering,\n parameterNames,\n actionApiName,\n );\n }\n const parameters = createParameters(\n def,\n def.objectType.properties ?? {},\n parameterNames,\n );\n const mappings = Object.fromEntries(\n Object.entries(def.nonParameterMappings ?? {}).map((\n [id, value],\n ) => [id, convertMappingValue(value)]),\n );\n\n return defineAction({\n apiName: actionApiName,\n displayName: def.displayName ?? `Create ${def.objectType.displayName}`,\n parameters: parameters,\n status: def.status ?? \"active\",\n entities: {\n affectedInterfaceTypes: [],\n affectedObjectTypes: [def.objectType.apiName],\n affectedLinkTypes: [],\n typeGroups: [],\n },\n rules: [{\n type: \"addObjectRule\",\n addObjectRule: {\n objectTypeId: def.objectType.apiName,\n propertyValues: {\n ...Object.fromEntries(\n propertyParameters.map(\n p => [p, { type: \"parameterId\", parameterId: p }],\n ),\n ),\n ...mappings,\n },\n structFieldValues: {},\n },\n }],\n parameterOrdering: def.parameterOrdering\n ?? createDefaultParameterOrdering(\n def,\n Object.keys(def.objectType.properties ?? {}),\n parameters,\n ),\n ...(def.actionLevelValidation\n ? {\n validation: convertValidationRule(\n def.actionLevelValidation,\n parameters,\n ),\n }\n : {}),\n ...(def.defaultFormat && { defaultFormat: def.defaultFormat }),\n ...(def.enableLayoutSwitch\n && { enableLayoutSwitch: def.enableLayoutSwitch }),\n ...(def.tableConfiguration && {\n displayAndFormat: {\n table: def.tableConfiguration,\n },\n }),\n ...(def.sections\n && {\n sections: Object.fromEntries(\n def.sections.map(section => [section.id, section]),\n ),\n }),\n ...(def.submissionMetadata\n && { submissionMetadata: def.submissionMetadata }),\n });\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,mBAAmB,QAAQ,oDAAoD;AAGxF,SACEC,qBAAqB,EACrBC,8BAA8B,EAC9BC,gBAAgB,EAChBC,YAAY,EACZC,mBAAmB,EACnBC,KAAK,EACLC,wBAAwB,EACxBC,yBAAyB,QACpB,mBAAmB;AAC1B,SAASC,QAAQ,QAAQ,kCAAkC;AAE3D,OAAO,SAASC,wBAAwBA,CACtCC,GAA6B,EACjB;EACZJ,wBAAwB,CACtBI,GAAG,EACHC,MAAM,CAACC,IAAI,CAACF,GAAG,CAACG,UAAU,CAACC,UAAU,IAAI,CAAC,CAAC,CAAC,EAC5CJ,GAAG,CAACG,UAAU,CAACE,OACjB,CAAC;EACD,MAAMC,gCAAgC,GAAG,CAACN,GAAG,CAACG,UAAU,CAACI,WAAW,IAAI,EAAE,EACvEC,MAAM,CAACC,EAAE,IAAIA,EAAE,CAACC,IAAI,KAAK,SAAS,CAAC,CAACC,OAAO,CAACF,EAAE,IAC7CR,MAAM,CAACC,IAAI,CAACO,EAAE,CAACG,eAAe,CAChC,CAAC;EACH,MAAMC,kBAAkB,GAAGZ,MAAM,CAACC,IAAI,CAACF,GAAG,CAACG,UAAU,CAACC,UAAU,IAAI,CAAC,CAAC,CAAC,CACpEI,MAAM,CACLM,EAAE,IACApB,mBAAmB,CAACM,GAAG,EAAEc,EAAE,EAAEd,GAAG,CAACG,UAAU,CAACC,UAAU,GAAGU,EAAE,CAAC,CAACJ,IAAK,CAAC,IAChE,CAACZ,QAAQ,CAACE,GAAG,CAACG,UAAU,CAACC,UAAU,GAAGU,EAAE,CAAC,CAACJ,IAAK,CAAC,IAChD,CAACJ,gCAAgC,CAACS,QAAQ,CAACD,EAAE,CACpD,CAAC;EACH,MAAME,cAAc,GAAG,IA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O,IAAI,CAACA,OAAO,CAACzC,EAAE,EAAEyC,OAAO,CAAC,CACnD;IACF,CAAC,CAAC;IACJ,IAAIvD,GAAG,CAACwD,kBAAkB,IACrB;MAAEA,kBAAkB,EAAExD,GAAG,CAACwD;IAAmB,CAAC;EACrD,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -19,7 +19,8 @@ import { convertValidationRule, CREATE_OR_MODIFY_OBJECT_PARAMETER, createDefault
19
19
  import { isStruct } from "./properties/PropertyTypeType.js";
20
20
  export function defineCreateOrModifyObjectAction(def) {
21
21
  validateActionParameters(def, Object.keys(def.objectType.properties ?? {}), def.objectType.apiName);
22
- const propertyParameters = Object.keys(def.objectType.properties ?? {}).filter(id => !Object.keys(def.nonParameterMappings ?? {}).includes(id) && !def.excludedProperties?.includes(id) && !isStruct(def.objectType.properties?.[id].type) && id !== def.objectType.primaryKeyPropertyApiName);
22
+ const propertiesWithDerivedDatasources = (def.objectType.datasources ?? []).filter(ds => ds.type === "derived").flatMap(ds => Object.keys(ds.propertyMapping));
23
+ const propertyParameters = Object.keys(def.objectType.properties ?? {}).filter(id => !Object.keys(def.nonParameterMappings ?? {}).includes(id) && !def.excludedProperties?.includes(id) && !isStruct(def.objectType.properties?.[id].type) && id !== def.objectType.primaryKeyPropertyApiName && !propertiesWithDerivedDatasources.includes(id));
23
24
  const parameterNames = new Set(propertyParameters);
24
25
  Object.keys(def.parameterConfiguration ?? {}).forEach(param => parameterNames.add(param));
25
26
  parameterNames.add(CREATE_OR_MODIFY_OBJECT_PARAMETER);
@@ -78,8 +79,10 @@ export function defineCreateOrModifyObjectAction(def) {
78
79
  ...(def.enableLayoutSwitch && {
79
80
  enableLayoutSwitch: def.enableLayoutSwitch
80
81
  }),
81
- ...(def.displayAndFormat && {
82
- displayAndFormat: def.displayAndFormat
82
+ ...(def.tableConfiguration && {
83
+ displayAndFormat: {
84
+ table: def.tableConfiguration
85
+ }
83
86
  }),
84
87
  ...(def.sections && {
85
88
  sections: Object.fromEntries(def.sections.map(section => [section.id, section]))
@@ -1 +1 @@
1
- {"version":3,"file":"defineCreateOrModifyObjectAction.js","names":["convertMappingValue","convertValidationRule","CREATE_OR_MODIFY_OBJECT_PARAMETER","createDefaultParameterOrdering","createParameters","defineAction","kebab","validateActionParameters","validateParameterOrdering","isStruct","defineCreateOrModifyObjectAction","def","Object","keys","objectType","properties","apiName","propertyParameters","filter","id","nonParameterMappings","includes","excludedProperties","type","primaryKeyPropertyApiName","parameterNames","Set","parameterConfiguration","forEach","param","add","actionApiName","split","pop","parameterOrdering","unshift","parameters","p","defaultValue","undefined","objectParameterPropertyValue","parameterId","propertyTypeId","mappings","fromEntries","entries","map","value","displayName","status","rules","addOrModifyObjectRuleV2","objectToModify","propertyValues","structFieldValues","entities","affectedInterfaceTypes","affectedObjectTypes","affectedLinkTypes","typeGroups","actionLevelValidation","validation","defaultFormat","enableLayoutSwitch","displayAndFormat","sections","section","submissionMetadata"],"sources":["defineCreateOrModifyObjectAction.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 { convertMappingValue } from \"../conversion/toMarketplace/convertMappingValue.js\";\nimport { type ActionType } from \"./action/ActionType.js\";\nimport type { ActionTypeUserDefinition } from \"./defineAction.js\";\nimport {\n convertValidationRule,\n CREATE_OR_MODIFY_OBJECT_PARAMETER,\n createDefaultParameterOrdering,\n createParameters,\n defineAction,\n kebab,\n validateActionParameters,\n validateParameterOrdering,\n} from \"./defineAction.js\";\nimport { isStruct } from \"./properties/PropertyTypeType.js\";\n\nexport function defineCreateOrModifyObjectAction(\n def: ActionTypeUserDefinition,\n): ActionType {\n validateActionParameters(\n def,\n Object.keys(def.objectType.properties ?? {}),\n def.objectType.apiName,\n );\n const propertyParameters = Object.keys(def.objectType.properties ?? {})\n .filter(\n id =>\n !Object.keys(def.nonParameterMappings ?? {}).includes(id)\n && !def.excludedProperties?.includes(id)\n && !isStruct(def.objectType.properties?.[id].type!)\n && id !== def.objectType.primaryKeyPropertyApiName,\n );\n const parameterNames = new Set(propertyParameters);\n Object.keys(def.parameterConfiguration ?? {}).forEach(param =>\n parameterNames.add(param)\n );\n parameterNames.add(CREATE_OR_MODIFY_OBJECT_PARAMETER);\n const actionApiName = def.apiName\n ?? `create-or-modify-${\n kebab(def.objectType.apiName.split(\".\").pop() ?? def.objectType.apiName)\n }`;\n if (def.parameterOrdering) {\n if (!def.parameterOrdering.includes(CREATE_OR_MODIFY_OBJECT_PARAMETER)) {\n def.parameterOrdering.unshift(CREATE_OR_MODIFY_OBJECT_PARAMETER);\n }\n validateParameterOrdering(\n def.parameterOrdering,\n parameterNames,\n actionApiName,\n );\n }\n const parameters = createParameters(\n def,\n def.objectType.properties ?? {},\n parameterNames,\n );\n parameters.forEach(\n p => {\n if (\n p.id !== CREATE_OR_MODIFY_OBJECT_PARAMETER\n && p.defaultValue === undefined\n ) {\n p.defaultValue = {\n type: \"objectParameterPropertyValue\",\n objectParameterPropertyValue: {\n parameterId: CREATE_OR_MODIFY_OBJECT_PARAMETER,\n propertyTypeId: p.id,\n },\n };\n }\n },\n );\n const mappings = Object.fromEntries(\n Object.entries(def.nonParameterMappings ?? {}).map((\n [id, value],\n ) => [id, convertMappingValue(value)]),\n );\n\n return defineAction({\n apiName: actionApiName,\n displayName: def.displayName\n ?? `Create or Modify ${def.objectType.displayName}`,\n parameters: parameters,\n status: def.status ?? \"active\",\n rules: [{\n type: \"addOrModifyObjectRuleV2\",\n addOrModifyObjectRuleV2: {\n objectToModify: CREATE_OR_MODIFY_OBJECT_PARAMETER,\n propertyValues: {\n ...Object.fromEntries(\n propertyParameters.map(\n p => [p, { type: \"parameterId\", parameterId: p }],\n ),\n ),\n ...mappings,\n },\n structFieldValues: {},\n },\n }],\n entities: {\n affectedInterfaceTypes: [],\n affectedObjectTypes: [def.objectType.apiName],\n affectedLinkTypes: [],\n typeGroups: [],\n },\n parameterOrdering: def.parameterOrdering\n ?? createDefaultParameterOrdering(\n def,\n Object.keys(def.objectType.properties ?? {}),\n parameters,\n CREATE_OR_MODIFY_OBJECT_PARAMETER,\n ),\n ...(def.actionLevelValidation\n ? {\n validation: convertValidationRule(\n def.actionLevelValidation,\n parameters,\n ),\n }\n : {}),\n ...(def.defaultFormat && { defaultFormat: def.defaultFormat }),\n ...(def.enableLayoutSwitch\n && { enableLayoutSwitch: def.enableLayoutSwitch }),\n ...(def.displayAndFormat && { displayAndFormat: def.displayAndFormat }),\n ...(def.sections\n && {\n sections: Object.fromEntries(\n def.sections.map(section => [section.id, section]),\n ),\n }),\n ...(def.submissionMetadata\n && { submissionMetadata: def.submissionMetadata }),\n });\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,mBAAmB,QAAQ,oDAAoD;AAGxF,SACEC,qBAAqB,EACrBC,iCAAiC,EACjCC,8BAA8B,EAC9BC,gBAAgB,EAChBC,YAAY,EACZC,KAAK,EACLC,wBAAwB,EACxBC,yBAAyB,QACpB,mBAAmB;AAC1B,SAASC,QAAQ,QAAQ,kCAAkC;AAE3D,OAAO,SAASC,gCAAgCA,CAC9CC,GAA6B,EACjB;EACZJ,wBAAwB,CACtBI,GAAG,EACHC,MAAM,CAACC,IAAI,CAACF,GAAG,CAACG,UAAU,CAACC,UAAU,IAAI,CAAC,CAAC,CAAC,EAC5CJ,GAAG,CAACG,UAAU,CAACE,OACjB,CAAC;EACD,MAAMC,kBAAkB,GAAGL,MAAM,CAACC,IAAI,CAACF,GAAG,CAACG,UAAU,CAACC,UAAU,I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E;MAC1BC,mBAAmB,EAAE,CAAC9C,GAAG,CAACG,UAAU,CAACE,OAAO,CAAC;MAC7C0C,iBAAiB,EAAE,EAAE;MACrBC,UAAU,EAAE;IACd,CAAC;IACDzB,iBAAiB,EAAEvB,GAAG,CAACuB,iBAAiB,IACnC/B,8BAA8B,CAC/BQ,GAAG,EACHC,MAAM,CAACC,IAAI,CAACF,GAAG,CAACG,UAAU,CAACC,UAAU,IAAI,CAAC,CAAC,CAAC,EAC5CqB,UAAU,EACVlC,iCACF,CAAC;IACH,IAAIS,GAAG,CAACiD,qBAAqB,GACzB;MACAC,UAAU,EAAE5D,qBAAqB,CAC/BU,GAAG,CAACiD,qBAAqB,EACzBxB,UACF;IACF,CAAC,GACC,CAAC,CAAC,CAAC;IACP,IAAIzB,GAAG,CAACmD,aAAa,IAAI;MAAEA,aAAa,EAAEnD,GAAG,CAACmD;IAAc,CAAC,CAAC;IAC9D,IAAInD,GAAG,CAACoD,kBAAkB,IACrB;MAAEA,kBAAkB,EAAEpD,GAAG,CAACoD;IAAmB,CAAC,CAAC;IACpD,IAAIpD,GAAG,CAACqD,gBAAgB,IAAI;MAAEA,gBAAgB,EAAErD,GAAG,CAACqD;IAAiB,CAAC,CAAC;IACvE,IAAIrD,GAAG,CAACsD,QAAQ,IACX;MACDA,QAAQ,EAAErD,MAAM,CAACgC,WAAW,CAC1BjC,GAAG,CAACsD,QAAQ,CAACnB,GAAG,CAACoB,OAAO,IAAI,CAACA,OAAO,CAAC/C,EAAE,EAAE+C,OAAO,CAAC,CACnD;IACF,CAAC,CAAC;IACJ,IAAIvD,GAAG,CAACwD,kBAAkB,IACrB;MAAEA,kBAAkB,EAAExD,GAAG,CAACwD;IAAmB,CAAC;EACrD,CAAC,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"defineCreateOrModifyObjectAction.js","names":["convertMappingValue","convertValidationRule","CREATE_OR_MODIFY_OBJECT_PARAMETER","createDefaultParameterOrdering","createParameters","defineAction","kebab","validateActionParameters","validateParameterOrdering","isStruct","defineCreateOrModifyObjectAction","def","Object","keys","objectType","properties","apiName","propertiesWithDerivedDatasources","datasources","filter","ds","type","flatMap","propertyMapping","propertyParameters","id","nonParameterMappings","includes","excludedProperties","primaryKeyPropertyApiName","parameterNames","Set","parameterConfiguration","forEach","param","add","actionApiName","split","pop","parameterOrdering","unshift","parameters","p","defaultValue","undefined","objectParameterPropertyValue","parameterId","propertyTypeId","mappings","fromEntries","entries","map","value","displayName","status","rules","addOrModifyObjectRuleV2","objectToModify","propertyValues","structFieldValues","entities","affectedInterfaceTypes","affectedObjectTypes","affectedLinkTypes","typeGroups","actionLevelValidation","validation","defaultFormat","enableLayoutSwitch","tableConfiguration","displayAndFormat","table","sections","section","submissionMetadata"],"sources":["defineCreateOrModifyObjectAction.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 { convertMappingValue } from \"../conversion/toMarketplace/convertMappingValue.js\";\nimport { type ActionType } from \"./action/ActionType.js\";\nimport type { ActionTypeUserDefinition } from \"./defineAction.js\";\nimport {\n convertValidationRule,\n CREATE_OR_MODIFY_OBJECT_PARAMETER,\n createDefaultParameterOrdering,\n createParameters,\n defineAction,\n kebab,\n validateActionParameters,\n validateParameterOrdering,\n} from \"./defineAction.js\";\nimport { isStruct } from \"./properties/PropertyTypeType.js\";\n\nexport function defineCreateOrModifyObjectAction(\n def: ActionTypeUserDefinition,\n): ActionType {\n validateActionParameters(\n def,\n Object.keys(def.objectType.properties ?? {}),\n def.objectType.apiName,\n );\n const propertiesWithDerivedDatasources = (def.objectType.datasources ?? [])\n .filter(ds => ds.type === \"derived\").flatMap(ds =>\n Object.keys(ds.propertyMapping)\n );\n const propertyParameters = Object.keys(def.objectType.properties ?? {})\n .filter(\n id =>\n !Object.keys(def.nonParameterMappings ?? {}).includes(id)\n && !def.excludedProperties?.includes(id)\n && !isStruct(def.objectType.properties?.[id].type!)\n && id !== def.objectType.primaryKeyPropertyApiName\n && !propertiesWithDerivedDatasources.includes(id),\n );\n const parameterNames = new Set(propertyParameters);\n Object.keys(def.parameterConfiguration ?? {}).forEach(param =>\n parameterNames.add(param)\n );\n parameterNames.add(CREATE_OR_MODIFY_OBJECT_PARAMETER);\n const actionApiName = def.apiName\n ?? `create-or-modify-${\n kebab(def.objectType.apiName.split(\".\").pop() ?? def.objectType.apiName)\n }`;\n if (def.parameterOrdering) {\n if (!def.parameterOrdering.includes(CREATE_OR_MODIFY_OBJECT_PARAMETER)) {\n def.parameterOrdering.unshift(CREATE_OR_MODIFY_OBJECT_PARAMETER);\n }\n validateParameterOrdering(\n def.parameterOrdering,\n parameterNames,\n actionApiName,\n );\n }\n const parameters = createParameters(\n def,\n def.objectType.properties ?? {},\n parameterNames,\n );\n parameters.forEach(\n p => {\n if (\n p.id !== CREATE_OR_MODIFY_OBJECT_PARAMETER\n && p.defaultValue === undefined\n ) {\n p.defaultValue = {\n type: \"objectParameterPropertyValue\",\n objectParameterPropertyValue: {\n parameterId: CREATE_OR_MODIFY_OBJECT_PARAMETER,\n propertyTypeId: p.id,\n },\n };\n }\n },\n );\n const mappings = Object.fromEntries(\n Object.entries(def.nonParameterMappings ?? {}).map((\n [id, value],\n ) => [id, convertMappingValue(value)]),\n );\n\n return defineAction({\n apiName: actionApiName,\n displayName: def.displayName\n ?? `Create or Modify ${def.objectType.displayName}`,\n parameters: parameters,\n status: def.status ?? \"active\",\n rules: [{\n type: \"addOrModifyObjectRuleV2\",\n addOrModifyObjectRuleV2: {\n objectToModify: CREATE_OR_MODIFY_OBJECT_PARAMETER,\n propertyValues: {\n ...Object.fromEntries(\n propertyParameters.map(\n p => [p, { type: \"parameterId\", parameterId: p }],\n ),\n ),\n ...mappings,\n },\n structFieldValues: {},\n },\n }],\n entities: {\n affectedInterfaceTypes: [],\n affectedObjectTypes: [def.objectType.apiName],\n affectedLinkTypes: [],\n typeGroups: [],\n },\n parameterOrdering: def.parameterOrdering\n ?? createDefaultParameterOrdering(\n def,\n Object.keys(def.objectType.properties ?? {}),\n parameters,\n CREATE_OR_MODIFY_OBJECT_PARAMETER,\n ),\n ...(def.actionLevelValidation\n ? {\n validation: convertValidationRule(\n def.actionLevelValidation,\n parameters,\n ),\n }\n : {}),\n ...(def.defaultFormat && { defaultFormat: def.defaultFormat }),\n ...(def.enableLayoutSwitch\n && { enableLayoutSwitch: def.enableLayoutSwitch }),\n ...(def.tableConfiguration && {\n displayAndFormat: {\n table: def.tableConfiguration,\n },\n }),\n ...(def.sections\n && {\n sections: Object.fromEntries(\n def.sections.map(section => [section.id, section]),\n ),\n }),\n ...(def.submissionMetadata\n && { submissionMetadata: def.submissionMetadata }),\n });\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,mBAAmB,QAAQ,oDAAoD;AAGxF,SACEC,qBAAqB,EACrBC,iCAAiC,EACjCC,8BAA8B,EAC9BC,gBAAgB,EAChBC,YAAY,EACZC,KAAK,EACLC,wBAAwB,EACxBC,yBAAyB,QACpB,mBAAmB;AAC1B,SAASC,QAAQ,QAAQ,kCAAkC;AAE3D,OAAO,SAASC,gCAAgCA,CAC9CC,GAA6B,EACjB;EACZJ,wBAAwB,CACtBI,GAAG,EACHC,MAAM,CAACC,IAAI,CAACF,GAAG,CAACG,UAAU,CAACC,UAAU,IAAI,CAAC,CAAC,CAAC,EAC5CJ,GAAG,CAACG,UAAU,CAACE,OACjB,CAAC;EACD,MAAMC,gCAAgC,GAAG,CAACN,GAAG,CAACG,UAAU,CAACI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rB,GAAG,CAACsB,OAAO,IAAI,CAACA,OAAO,CAAChD,EAAE,EAAEgD,OAAO,CAAC,CACnD;IACF,CAAC,CAAC;IACJ,IAAI9D,GAAG,CAAC+D,kBAAkB,IACrB;MAAEA,kBAAkB,EAAE/D,GAAG,CAAC+D;IAAmB,CAAC;EACrD,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -0,0 +1,53 @@
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 { defineAction, kebab } from "./defineAction.js";
18
+ export function defineDeleteInterfaceObjectAction(def) {
19
+ return defineAction({
20
+ apiName: def.apiName ?? `delete-interface-object-${kebab(def.interfaceType.apiName.split(".").pop() ?? def.interfaceType.apiName)}`,
21
+ displayName: def.displayName ?? `Delete ${def.interfaceType.displayMetadata.displayName}`,
22
+ parameters: [{
23
+ id: "objectToDeleteParameter",
24
+ displayName: "Delete object",
25
+ type: {
26
+ type: "interfaceReference",
27
+ interfaceReference: {
28
+ interfaceTypeRid: def.interfaceType.apiName
29
+ }
30
+ },
31
+ validation: {
32
+ required: true,
33
+ allowedValues: {
34
+ type: "interfaceObjectQuery"
35
+ }
36
+ }
37
+ }],
38
+ status: def.status ?? "active",
39
+ rules: [{
40
+ type: "deleteObjectRule",
41
+ deleteObjectRule: {
42
+ objectToDelete: "objectToDeleteParameter"
43
+ }
44
+ }],
45
+ entities: {
46
+ affectedInterfaceTypes: [],
47
+ affectedObjectTypes: [def.interfaceType.apiName],
48
+ affectedLinkTypes: [],
49
+ typeGroups: []
50
+ }
51
+ });
52
+ }
53
+ //# sourceMappingURL=defineDeleteInterfaceObjectAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defineDeleteInterfaceObjectAction.js","names":["defineAction","kebab","defineDeleteInterfaceObjectAction","def","apiName","interfaceType","split","pop","displayName","displayMetadata","parameters","id","type","interfaceReference","interfaceTypeRid","validation","required","allowedValues","status","rules","deleteObjectRule","objectToDelete","entities","affectedInterfaceTypes","affectedObjectTypes","affectedLinkTypes","typeGroups"],"sources":["defineDeleteInterfaceObjectAction.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 { ActionType } from \"./action/ActionType.js\";\nimport type { InterfaceActionTypeUserDefinition } from \"./defineAction.js\";\nimport { defineAction, kebab } from \"./defineAction.js\";\n\nexport function defineDeleteInterfaceObjectAction(\n def: InterfaceActionTypeUserDefinition,\n): ActionType {\n return defineAction({\n apiName: def.apiName\n ?? `delete-interface-object-${\n kebab(\n def.interfaceType.apiName.split(\".\").pop()\n ?? def.interfaceType.apiName,\n )\n }`,\n displayName: def.displayName\n ?? `Delete ${def.interfaceType.displayMetadata.displayName}`,\n parameters: [\n {\n id: \"objectToDeleteParameter\",\n displayName: \"Delete object\",\n type: {\n type: \"interfaceReference\",\n interfaceReference: { interfaceTypeRid: def.interfaceType.apiName },\n },\n validation: {\n required: true,\n allowedValues: { type: \"interfaceObjectQuery\" },\n },\n },\n ],\n status: def.status ?? \"active\",\n rules: [{\n type: \"deleteObjectRule\",\n deleteObjectRule: {\n objectToDelete: \"objectToDeleteParameter\",\n },\n }],\n entities: {\n affectedInterfaceTypes: [],\n affectedObjectTypes: [def.interfaceType.apiName],\n affectedLinkTypes: [],\n typeGroups: [],\n },\n });\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,YAAY,EAAEC,KAAK,QAAQ,mBAAmB;AAEvD,OAAO,SAASC,iCAAiCA,CAC/CC,GAAsC,EAC1B;EACZ,OAAOH,YAAY,CAAC;IAClBI,OAAO,EAAED,GAAG,CAACC,OAAO,IACf,2BACDH,KAAK,CACHE,GAAG,CAACE,aAAa,CAACD,OAAO,CAACE,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAAC,CAAC,IACrCJ,GAAG,CAACE,aAAa,CAACD,OACzB,CAAC,EACD;IACJI,WAAW,EAAEL,GAAG,CAACK,WAAW,IACvB,UAAUL,GAAG,CAACE,aAAa,CAACI,eAAe,CAACD,WAAW,EAAE;IAC9DE,UAAU,EAAE,CACV;MACEC,EAAE,EAAE,yBAAyB;MAC7BH,WAAW,EAAE,eAAe;MAC5BI,IAAI,EAAE;QACJA,IAAI,EAAE,oBAAoB;QAC1BC,kBAAkB,EAAE;UAAEC,gBAAgB,EAAEX,GAAG,CAACE,aAAa,CAACD;QAAQ;MACpE,CAAC;MACDW,UAAU,EAAE;QACVC,QAAQ,EAAE,IAAI;QACdC,aAAa,EAAE;UAAEL,IAAI,EAAE;QAAuB;MAChD;IACF,CAAC,CACF;IACDM,MAAM,EAAEf,GAAG,CAACe,MAAM,IAAI,QAAQ;IAC9BC,KAAK,EAAE,CAAC;MACNP,IAAI,EAAE,kBAAkB;MACxBQ,gBAAgB,EAAE;QAChBC,cAAc,EAAE;MAClB;IACF,CAAC,CAAC;IACFC,QAAQ,EAAE;MACRC,sBAAsB,EAAE,EAAE;MAC1BC,mBAAmB,EAAE,CAACrB,GAAG,CAACE,aAAa,CAACD,OAAO,CAAC;MAChDqB,iBAAiB,EAAE,EAAE;MACrBC,UAAU,EAAE;IACd;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -14,23 +14,14 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import invariant from "tiny-invariant";
18
17
  import { OntologyEntityTypeEnum } from "./common/OntologyEntityTypeEnum.js";
19
18
  import { convertToPluralDisplayName, uppercaseFirstLetter } from "./defineObject.js";
20
19
  import { updateOntology } from "./defineOntology.js";
21
- const typeIdPattern = /([a-z][a-z0-9\\-]*)/;
22
20
  export function defineLink(linkDefinition) {
23
- if ("one" in linkDefinition) {
24
- const foreignKey = linkDefinition.toMany.object.properties?.[linkDefinition.manyForeignKeyProperty];
25
- !(foreignKey !== undefined) ? process.env.NODE_ENV !== "production" ? invariant(false, `Foreign key ${linkDefinition.manyForeignKeyProperty} on link ${linkDefinition.apiName} does not exist on object ${linkDefinition.toMany.object.apiName}}`) : invariant(false) : void 0;
26
- !typeIdPattern.test(linkDefinition.apiName) ? process.env.NODE_ENV !== "production" ? invariant(false, `Top level link api names are expected to match the regex pattern ([a-z][a-z0-9\\-]*) ${linkDefinition.apiName} does not match`) : invariant(false) : void 0;
27
- const typesMatch = foreignKey.type === linkDefinition.one.object.properties?.[linkDefinition.one.object.primaryKeyPropertyApiName].type;
28
- !typesMatch ? process.env.NODE_ENV !== "production" ? invariant(false, `Link ${linkDefinition.apiName} has type mismatch between the one side's primary key and the foreign key on the many side`) : invariant(false) : void 0;
29
- }
30
- if ("intermediaryObjectType" in linkDefinition) {
31
- !("one" in linkDefinition.many.linkToIntermediary && linkDefinition.many.linkToIntermediary.one.object.apiName === linkDefinition.many.object.apiName && linkDefinition.many.linkToIntermediary.toMany.object.apiName === linkDefinition.intermediaryObjectType.apiName) ? process.env.NODE_ENV !== "production" ? invariant(false, `LinkTypeA ${linkDefinition.many.linkToIntermediary.apiName} must be a many to one link from intermediary object ${linkDefinition.intermediaryObjectType.apiName} to objectA ${linkDefinition.many.object.apiName}`) : invariant(false) : void 0;
32
- !("one" in linkDefinition.toMany.linkToIntermediary && linkDefinition.toMany.linkToIntermediary.one.object.apiName === linkDefinition.toMany.object.apiName && linkDefinition.toMany.linkToIntermediary.toMany.object.apiName === linkDefinition.intermediaryObjectType.apiName) ? process.env.NODE_ENV !== "production" ? invariant(false, `LinkTypeB ${linkDefinition.toMany.linkToIntermediary.apiName} must be a many to one link from intermediary object ${linkDefinition.intermediaryObjectType.apiName} to objectB ${linkDefinition.toMany.object.apiName}`) : invariant(false) : void 0;
33
- }
21
+ // NOTE: we would normally do validation here, but because of circular dependencies
22
+ // we have to wait to validate until everything has been defined. The code for validation
23
+ // was moved to convertLink.ts.
24
+
34
25
  let fullLinkDefinition;
35
26
  if ("one" in linkDefinition) {
36
27
  fullLinkDefinition = {
@@ -54,6 +45,7 @@ export function defineLink(linkDefinition) {
54
45
  const linkType = {
55
46
  cardinality: "one" in linkDefinition ? linkDefinition.cardinality : undefined,
56
47
  ...fullLinkDefinition,
48
+ apiName: linkDefinition.apiName,
57
49
  __type: OntologyEntityTypeEnum.LINK_TYPE
58
50
  };
59
51
  updateOntology(linkType);
@@ -1 +1 @@
1
- {"version":3,"file":"defineLink.js","names":["invariant","OntologyEntityTypeEnum","convertToPluralDisplayName","uppercaseFirstLetter","updateOntology","typeIdPattern","defineLink","linkDefinition","foreignKey","toMany","object","properties","manyForeignKeyProperty","undefined","process","env","NODE_ENV","apiName","test","typesMatch","type","one","primaryKeyPropertyApiName","many","linkToIntermediary","intermediaryObjectType","fullLinkDefinition","convertUserOneToManyLinkDefinition","convertUserIntermediaryLinkDefinition","convertUserManyToManyLinkDefinition","linkType","cardinality","__type","LINK_TYPE","oneToMany","metadata","convertLinkTypeMetadata","manyToMany","intermediary","displayMetadata","displayName","pluralDisplayName","visibility","groupDisplayName","typeClasses"],"sources":["defineLink.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 { LinkTypeMetadata } from \"@osdk/client.unstable\";\nimport invariant from \"tiny-invariant\";\nimport { OntologyEntityTypeEnum } from \"./common/OntologyEntityTypeEnum.js\";\nimport {\n convertToPluralDisplayName,\n uppercaseFirstLetter,\n} from \"./defineObject.js\";\nimport { updateOntology } from \"./defineOntology.js\";\nimport type {\n IntermediaryObjectLinkReference,\n IntermediaryObjectLinkReferenceUserDefinition,\n LinkType,\n LinkTypeDefinition,\n LinkTypeMetadataUserDefinition,\n ManyToManyObjectLinkReference,\n ManyToManyObjectLinkReferenceUserDefinition,\n OneToManyObjectLinkReference,\n OneToManyObjectLinkReferenceUserDefinition,\n} from \"./links/LinkType.js\";\n\nconst typeIdPattern = /([a-z][a-z0-9\\\\-]*)/;\n\nexport function defineLink(\n linkDefinition: LinkTypeDefinition,\n): LinkType {\n if (\"one\" in linkDefinition) {\n const foreignKey = linkDefinition.toMany.object.properties\n ?.[linkDefinition.manyForeignKeyProperty];\n invariant(\n foreignKey !== undefined,\n `Foreign key ${linkDefinition.manyForeignKeyProperty} on link ${linkDefinition.apiName} does not exist on object ${linkDefinition.toMany.object.apiName}}`,\n );\n\n invariant(\n typeIdPattern.test(linkDefinition.apiName),\n `Top level link api names are expected to match the regex pattern ([a-z][a-z0-9\\\\-]*) ${linkDefinition.apiName} does not match`,\n );\n\n const typesMatch = foreignKey.type\n === linkDefinition.one.object.properties\n ?.[linkDefinition.one.object.primaryKeyPropertyApiName].type;\n invariant(\n typesMatch,\n `Link ${linkDefinition.apiName} has type mismatch between the one side's primary key and the foreign key on the many side`,\n );\n }\n if (\"intermediaryObjectType\" in linkDefinition) {\n invariant(\n \"one\" in linkDefinition.many.linkToIntermediary\n && linkDefinition.many.linkToIntermediary.one.object.apiName\n === linkDefinition.many.object.apiName\n && linkDefinition.many.linkToIntermediary.toMany.object.apiName\n === linkDefinition.intermediaryObjectType.apiName,\n `LinkTypeA ${linkDefinition.many.linkToIntermediary.apiName} must be a many to one link from intermediary object ${linkDefinition.intermediaryObjectType.apiName} to objectA ${linkDefinition.many.object.apiName}`,\n );\n invariant(\n \"one\" in linkDefinition.toMany.linkToIntermediary\n && linkDefinition.toMany.linkToIntermediary.one.object.apiName\n === linkDefinition.toMany.object.apiName\n && linkDefinition.toMany.linkToIntermediary.toMany.object.apiName\n === linkDefinition.intermediaryObjectType.apiName,\n `LinkTypeB ${linkDefinition.toMany.linkToIntermediary.apiName} must be a many to one link from intermediary object ${linkDefinition.intermediaryObjectType.apiName} to objectB ${linkDefinition.toMany.object.apiName}`,\n );\n }\n let fullLinkDefinition;\n if (\"one\" in linkDefinition) {\n fullLinkDefinition = {\n ...linkDefinition,\n one: convertUserOneToManyLinkDefinition(linkDefinition.one),\n toMany: convertUserOneToManyLinkDefinition(linkDefinition.toMany),\n };\n } else if (\"intermediaryObjectType\" in linkDefinition) {\n fullLinkDefinition = {\n ...linkDefinition,\n many: convertUserIntermediaryLinkDefinition(\n linkDefinition.many,\n ),\n toMany: convertUserIntermediaryLinkDefinition(\n linkDefinition.toMany,\n ),\n };\n } else {\n fullLinkDefinition = {\n ...linkDefinition,\n many: convertUserManyToManyLinkDefinition(linkDefinition.many),\n toMany: convertUserManyToManyLinkDefinition(linkDefinition.toMany),\n };\n }\n const linkType: LinkType = {\n cardinality: \"one\" in linkDefinition\n ? linkDefinition.cardinality\n : undefined,\n ...fullLinkDefinition,\n __type: OntologyEntityTypeEnum.LINK_TYPE,\n };\n updateOntology(linkType);\n return linkType;\n}\n\nfunction convertUserOneToManyLinkDefinition(\n oneToMany: OneToManyObjectLinkReferenceUserDefinition,\n): OneToManyObjectLinkReference {\n return {\n ...oneToMany,\n metadata: convertLinkTypeMetadata(oneToMany.metadata),\n };\n}\n\nfunction convertUserManyToManyLinkDefinition(\n manyToMany: ManyToManyObjectLinkReferenceUserDefinition,\n): ManyToManyObjectLinkReference {\n return {\n ...manyToMany,\n metadata: convertLinkTypeMetadata(manyToMany.metadata),\n };\n}\n\nfunction convertUserIntermediaryLinkDefinition(\n intermediary: IntermediaryObjectLinkReferenceUserDefinition,\n): IntermediaryObjectLinkReference {\n return {\n ...intermediary,\n metadata: convertLinkTypeMetadata(intermediary.metadata),\n };\n}\n\nfunction convertLinkTypeMetadata(\n metadata: LinkTypeMetadataUserDefinition,\n): LinkTypeMetadata {\n return {\n apiName: metadata.apiName,\n displayMetadata: {\n displayName: metadata.displayName\n ?? uppercaseFirstLetter(metadata.apiName),\n pluralDisplayName: metadata.pluralDisplayName\n ?? convertToPluralDisplayName(metadata.apiName),\n visibility: metadata.visibility ?? \"NORMAL\",\n groupDisplayName: metadata.groupDisplayName ?? \"\",\n },\n typeClasses: [],\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,sBAAsB,QAAQ,oCAAoC;AAC3E,SACEC,0BAA0B,EAC1BC,oBAAoB,QACf,mBAAmB;AAC1B,SAASC,cAAc,QAAQ,qBAAqB;AAapD,MAAMC,aAAa,GAAG,qBAAqB;AAE3C,OAAO,SAASC,UAAUA,CACxBC,cAAkC,EACxB;EACV,IAAI,KAAK,IAAIA,cAAc,EAAE;IAC3B,MAAMC,UAAU,GAAGD,cAAc,CAACE,MAAM,CAACC,MAAM,CAACC,UAAU,GACrDJ,cAAc,CAACK,sBAAsB,CAAC;IAC3C,EACEJ,UAAU,KAAKK,SAAS,IAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAD1BhB,SAAS,QAEP,eAAeO,cAAc,CAACK,sBAAsB,YAAYL,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,MAAM,EAAE/B,sBAAsB,CAACgC;EACjC,CAAC;EACD7B,cAAc,CAAC0B,QAAQ,CAAC;EACxB,OAAOA,QAAQ;AACjB;AAEA,SAASH,kCAAkCA,CACzCO,SAAqD,EACvB;EAC9B,OAAO;IACL,GAAGA,SAAS;IACZC,QAAQ,EAAEC,uBAAuB,CAACF,SAAS,CAACC,QAAQ;EACtD,CAAC;AACH;AAEA,SAASN,mCAAmCA,CAC1CQ,UAAuD,EACxB;EAC/B,OAAO;IACL,GAAGA,UAAU;IACbF,QAAQ,EAAEC,uBAAuB,CAACC,UAAU,CAACF,QAAQ;EACvD,CAAC;AACH;AAEA,SAASP,qCAAqCA,CAC5CU,YAA2D,EAC1B;EACjC,OAAO;IACL,GAAGA,YAAY;IACfH,QAAQ,EAAEC,uBAAuB,CAACE,YAAY,CAACH,QAAQ;EACzD,CAAC;AACH;AAEA,SAASC,uBAAuBA,CAC9BD,QAAwC,EACtB;EAClB,OAAO;IACLlB,OAAO,EAAEkB,QAAQ,CAAClB,OAAO;IACzBsB,eAAe,EAAE;MACfC,WAAW,EAAEL,QAAQ,CAACK,WAAW,IAC5BrC,oBAAoB,CAACgC,QAAQ,CAAClB,OAAO,CAAC;MAC3CwB,iBAAiB,EAAEN,QAAQ,CAACM,iBAAiB,IACxCvC,0BAA0B,CAACiC,QAAQ,CAAClB,OAAO,CAAC;MACjDyB,UAAU,EAAEP,QAAQ,CAACO,UAAU,IAAI,QAAQ;MAC3CC,gBAAgB,EAAER,QAAQ,CAACQ,gBAAgB,IAAI;IACjD,CAAC;IACDC,WAAW,EAAE;EACf,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"defineLink.js","names":["OntologyEntityTypeEnum","convertToPluralDisplayName","uppercaseFirstLetter","updateOntology","defineLink","linkDefinition","fullLinkDefinition","one","convertUserOneToManyLinkDefinition","toMany","many","convertUserIntermediaryLinkDefinition","convertUserManyToManyLinkDefinition","linkType","cardinality","undefined","apiName","__type","LINK_TYPE","oneToMany","metadata","convertLinkTypeMetadata","manyToMany","intermediary","displayMetadata","displayName","pluralDisplayName","visibility","groupDisplayName","typeClasses"],"sources":["defineLink.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 { LinkTypeMetadata } from \"@osdk/client.unstable\";\nimport { OntologyEntityTypeEnum } from \"./common/OntologyEntityTypeEnum.js\";\nimport {\n convertToPluralDisplayName,\n uppercaseFirstLetter,\n} from \"./defineObject.js\";\nimport { updateOntology } from \"./defineOntology.js\";\nimport type {\n IntermediaryObjectLinkReference,\n IntermediaryObjectLinkReferenceUserDefinition,\n LinkType,\n LinkTypeDefinition,\n LinkTypeMetadataUserDefinition,\n ManyToManyObjectLinkReference,\n ManyToManyObjectLinkReferenceUserDefinition,\n OneToManyObjectLinkReference,\n OneToManyObjectLinkReferenceUserDefinition,\n} from \"./links/LinkType.js\";\n\nexport function defineLink(\n linkDefinition: LinkTypeDefinition,\n): LinkType {\n // NOTE: we would normally do validation here, but because of circular dependencies\n // we have to wait to validate until everything has been defined. The code for validation\n // was moved to convertLink.ts.\n\n let fullLinkDefinition;\n if (\"one\" in linkDefinition) {\n fullLinkDefinition = {\n ...linkDefinition,\n one: convertUserOneToManyLinkDefinition(linkDefinition.one),\n toMany: convertUserOneToManyLinkDefinition(linkDefinition.toMany),\n };\n } else if (\"intermediaryObjectType\" in linkDefinition) {\n fullLinkDefinition = {\n ...linkDefinition,\n many: convertUserIntermediaryLinkDefinition(\n linkDefinition.many,\n ),\n toMany: convertUserIntermediaryLinkDefinition(\n linkDefinition.toMany,\n ),\n };\n } else {\n fullLinkDefinition = {\n ...linkDefinition,\n many: convertUserManyToManyLinkDefinition(linkDefinition.many),\n toMany: convertUserManyToManyLinkDefinition(linkDefinition.toMany),\n };\n }\n const linkType: LinkType = {\n cardinality: \"one\" in linkDefinition\n ? linkDefinition.cardinality\n : undefined,\n ...fullLinkDefinition,\n apiName: linkDefinition.apiName,\n __type: OntologyEntityTypeEnum.LINK_TYPE,\n };\n updateOntology(linkType);\n return linkType;\n}\n\nfunction convertUserOneToManyLinkDefinition(\n oneToMany: OneToManyObjectLinkReferenceUserDefinition,\n): OneToManyObjectLinkReference {\n return {\n ...oneToMany,\n metadata: convertLinkTypeMetadata(oneToMany.metadata),\n };\n}\n\nfunction convertUserManyToManyLinkDefinition(\n manyToMany: ManyToManyObjectLinkReferenceUserDefinition,\n): ManyToManyObjectLinkReference {\n return {\n ...manyToMany,\n metadata: convertLinkTypeMetadata(manyToMany.metadata),\n };\n}\n\nfunction convertUserIntermediaryLinkDefinition(\n intermediary: IntermediaryObjectLinkReferenceUserDefinition,\n): IntermediaryObjectLinkReference {\n return {\n ...intermediary,\n metadata: convertLinkTypeMetadata(intermediary.metadata),\n };\n}\n\nfunction convertLinkTypeMetadata(\n metadata: LinkTypeMetadataUserDefinition,\n): LinkTypeMetadata {\n return {\n apiName: metadata.apiName,\n displayMetadata: {\n displayName: metadata.displayName\n ?? uppercaseFirstLetter(metadata.apiName),\n pluralDisplayName: metadata.pluralDisplayName\n ?? convertToPluralDisplayName(metadata.apiName),\n visibility: metadata.visibility ?? \"NORMAL\",\n groupDisplayName: metadata.groupDisplayName ?? \"\",\n },\n typeClasses: [],\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,sBAAsB,QAAQ,oCAAoC;AAC3E,SACEC,0BAA0B,EAC1BC,oBAAoB,QACf,mBAAmB;AAC1B,SAASC,cAAc,QAAQ,qBAA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AQ;EACvD,CAAC;AACH;AAEA,SAAST,qCAAqCA,CAC5CY,YAA2D,EAC1B;EACjC,OAAO;IACL,GAAGA,YAAY;IACfH,QAAQ,EAAEC,uBAAuB,CAACE,YAAY,CAACH,QAAQ;EACzD,CAAC;AACH;AAEA,SAASC,uBAAuBA,CAC9BD,QAAwC,EACtB;EAClB,OAAO;IACLJ,OAAO,EAAEI,QAAQ,CAACJ,OAAO;IACzBQ,eAAe,EAAE;MACfC,WAAW,EAAEL,QAAQ,CAACK,WAAW,IAC5BvB,oBAAoB,CAACkB,QAAQ,CAACJ,OAAO,CAAC;MAC3CU,iBAAiB,EAAEN,QAAQ,CAACM,iBAAiB,IACxCzB,0BAA0B,CAACmB,QAAQ,CAACJ,OAAO,CAAC;MACjDW,UAAU,EAAEP,QAAQ,CAACO,UAAU,IAAI,QAAQ;MAC3CC,gBAAgB,EAAER,QAAQ,CAACQ,gBAAgB,IAAI;IACjD,CAAC;IACDC,WAAW,EAAE;EACf,CAAC;AACH","ignoreList":[]}
@@ -62,9 +62,17 @@ export function defineModifyInterfaceObjectAction(def) {
62
62
  ...(def.actionLevelValidation ? {
63
63
  validation: convertValidationRule(def.actionLevelValidation, parameters)
64
64
  } : {}),
65
+ ...(def.defaultFormat && {
66
+ defaultFormat: def.defaultFormat
67
+ }),
65
68
  ...(def.enableLayoutSwitch && {
66
69
  enableLayoutSwitch: def.enableLayoutSwitch
67
70
  }),
71
+ ...(def.tableConfiguration && {
72
+ displayAndFormat: {
73
+ table: def.tableConfiguration
74
+ }
75
+ }),
68
76
  ...(def.sections && {
69
77
  sections: Object.fromEntries(def.sections.map(section => [section.id, section]))
70
78
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"defineModifyInterfaceObjectAction.js","names":["convertMappingValue","addNamespaceToActionDefinition","convertValidationRule","createDefaultParameterOrdering","createParameters","defineAction","getInterfaceParameterName","isPropertyParameter","kebab","MODIFY_INTERFACE_OBJECT_PARAMETER","validateActionParameters","validateParameterOrdering","getFlattenedInterfaceProperties","defineModifyInterfaceObjectAction","def","allProperties","interfaceType","Object","keys","apiName","propertyParameters","filter","sharedPropertyType","type","parameterNames","Set","parameterConfiguration","forEach","param","add","actionApiName","split","pop","objectType","undefined","parameterOrdering","includes","unshift","parameters","fromEntries","entries","map","id","prop","required","mappings","nonParameterMappings","value","displayName","displayMetadata","status","entities","affectedInterfaceTypes","affectedObjectTypes","affectedLinkTypes","typeGroups","rules","modifyInterfaceRule","interfaceObjectToModifyParameter","sharedPropertyValues","parameterId","actionLevelValidation","validation","enableLayoutSwitch","sections","section","submissionMetadata"],"sources":["defineModifyInterfaceObjectAction.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 { convertMappingValue } from \"../conversion/toMarketplace/convertMappingValue.js\";\nimport { type ActionType } from \"./action/ActionType.js\";\nimport type { InterfaceActionTypeUserDefinition } from \"./defineAction.js\";\nimport {\n addNamespaceToActionDefinition,\n convertValidationRule,\n createDefaultParameterOrdering,\n createParameters,\n defineAction,\n getInterfaceParameterName,\n isPropertyParameter,\n kebab,\n MODIFY_INTERFACE_OBJECT_PARAMETER,\n validateActionParameters,\n validateParameterOrdering,\n} from \"./defineAction.js\";\nimport { getFlattenedInterfaceProperties } from \"./interface/getFlattenedInterfaceProperties.js\";\n\nexport function defineModifyInterfaceObjectAction(\n def: InterfaceActionTypeUserDefinition,\n): ActionType {\n addNamespaceToActionDefinition(def);\n const allProperties = getFlattenedInterfaceProperties(def.interfaceType);\n validateActionParameters(\n def,\n Object.keys(allProperties),\n def.interfaceType.apiName,\n );\n const propertyParameters = Object.keys(allProperties).filter(apiName =>\n isPropertyParameter(\n def,\n apiName,\n allProperties[apiName].sharedPropertyType.type,\n )\n );\n const parameterNames = new Set(propertyParameters);\n Object.keys(def.parameterConfiguration ?? {}).forEach(param =>\n parameterNames.add(\n getInterfaceParameterName(def, param),\n )\n );\n parameterNames.add(MODIFY_INTERFACE_OBJECT_PARAMETER);\n const actionApiName = def.apiName ?? `modify-${\n kebab(\n def.interfaceType.apiName.split(\".\").pop() ?? def.interfaceType.apiName,\n )\n }${\n def.objectType === undefined\n ? \"\"\n : `-${\n kebab(\n def.objectType.apiName.split(\".\").pop() ?? def.objectType.apiName,\n )\n }`\n }`;\n if (def.parameterOrdering) {\n if (!def.parameterOrdering.includes(MODIFY_INTERFACE_OBJECT_PARAMETER)) {\n def.parameterOrdering.unshift(MODIFY_INTERFACE_OBJECT_PARAMETER);\n }\n validateParameterOrdering(\n def.parameterOrdering,\n parameterNames,\n actionApiName,\n );\n }\n const parameters = createParameters(\n def,\n Object.fromEntries(\n Object.entries(allProperties).map((\n [id, prop],\n ) => [id, prop.sharedPropertyType]),\n ),\n parameterNames,\n Object.fromEntries(\n Object.entries(allProperties).map(([id, prop]) => [id, prop.required]),\n ),\n );\n const mappings = Object.fromEntries(\n Object.entries(def.nonParameterMappings ?? {}).map((\n [id, value],\n ) => [id, convertMappingValue(value)]),\n );\n\n return defineAction({\n apiName: actionApiName,\n displayName: def.displayName\n ?? `Modify ${def.interfaceType.displayMetadata.displayName}`,\n parameters: parameters,\n status: def.status ?? (def.interfaceType.status.type !== \"deprecated\"\n ? def.interfaceType.status.type\n : def.interfaceType.status),\n entities: {\n affectedInterfaceTypes: [def.interfaceType.apiName],\n affectedObjectTypes: [],\n affectedLinkTypes: [],\n typeGroups: [],\n },\n rules: [\n {\n type: \"modifyInterfaceRule\",\n modifyInterfaceRule: {\n interfaceObjectToModifyParameter: \"interfaceObjectToModifyParameter\",\n sharedPropertyValues: {\n ...Object.fromEntries(\n propertyParameters.map(\n id => [id, { type: \"parameterId\", parameterId: id }],\n ),\n ),\n ...mappings,\n },\n },\n },\n ],\n parameterOrdering: def.parameterOrdering\n ?? createDefaultParameterOrdering(\n def,\n Object.keys(allProperties),\n parameters,\n MODIFY_INTERFACE_OBJECT_PARAMETER,\n ),\n ...(def.actionLevelValidation\n ? {\n validation: convertValidationRule(\n def.actionLevelValidation,\n parameters,\n ),\n }\n : {}),\n ...(def.enableLayoutSwitch\n && { enableLayoutSwitch: def.enableLayoutSwitch }),\n ...(def.sections\n && {\n sections: Object.fromEntries(\n def.sections.map(section => [section.id, section]),\n ),\n }),\n ...(def.submissionMetadata\n && { submissionMetadata: def.submissionMetadata }),\n });\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,mBAAmB,QAAQ,oDAAoD;AAGxF,SACEC,8BAA8B,EAC9BC,qBAAqB,EACrBC,8BAA8B,EAC9BC,gBAAgB,EAChBC,YAAY,EACZC,yBAAyB,EACzBC,mBAAmB,EACnBC,KAAK,EACLC,iCAAiC,EACjCC,wBAAwB,EACxBC,yBAAyB,QACpB,mBAAmB;AAC1B,SAASC,+BAA+B,QAAQ,gDAAgD;AAEhG,OAAO,SAASC,iCAAiCA,CAC/CC,GAAsC,EAC1B;EACZb,8BAA8B,CAACa,GAAG,CAAC;EACnC,MAAMC,aAAa,GAAGH,+BAA+B,CAACE,GAAG,CAACE,aAAa,CAAC;EACxEN,wBAAwB,CACtBI,GAAG,EACHG,MAAM,CAACC,IAAI,CAACH,aAAa,CAAC,EAC1BD,GAAG,CAACE,aAAa,CAACG,OACpB,CAAC;EACD,MAAMC,kBAAkB,GAAGH,MAAM,CAACC,IAAI,CAACH,aAAa,CAAC,CAACM,MAAM,CAACF,OAAO,IAClEZ,mBAAmB,CACjBO,GAAG,EACHK,OAAO,EACPJ,aAAa,CAACI,OAAO,CAAC,CAACG,kBAAkB,CAAC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ACpBC,EAAE,IAAI,CAACA,EAAE,EAAE;YAAEnB,IAAI,EAAE,aAAa;YAAEqC,WAAW,EAAElB;UAAG,CAAC,CACrD,CACF,CAAC;UACD,GAAGG;QACL;MACF;IACF,CAAC,CACF;IACDV,iBAAiB,EAAErB,GAAG,CAACqB,iBAAiB,IACnChC,8BAA8B,CAC/BW,GAAG,EACHG,MAAM,CAACC,IAAI,CAACH,aAAa,CAAC,EAC1BuB,UAAU,EACV7B,iCACF,CAAC;IACH,IAAIK,GAAG,CAAC+C,qBAAqB,GACzB;MACAC,UAAU,EAAE5D,qBAAqB,CAC/BY,GAAG,CAAC+C,qBAAqB,EACzBvB,UACF;IACF,CAAC,GACC,CAAC,CAAC,CAAC;IACP,IAAIxB,GAAG,CAACiD,kBAAkB,IACrB;MAAEA,kBAAkB,EAAEjD,GAAG,CAACiD;IAAmB,CAAC,CAAC;IACpD,IAAIjD,GAAG,CAACkD,QAAQ,IACX;MACDA,QAAQ,EAAE/C,MAAM,CAACsB,WAAW,CAC1BzB,GAAG,CAACkD,QAAQ,CAACvB,GAAG,CAACwB,OAAO,IAAI,CAACA,OAAO,CAACvB,EAAE,EAAEuB,OAAO,CAAC,CACnD;IACF,CAAC,CAAC;IACJ,IAAInD,GAAG,CAACoD,kBAAkB,IACrB;MAAEA,kBAAkB,EAAEpD,GAAG,CAACoD;IAAmB,CAAC;EACrD,CAAC,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"defineModifyInterfaceObjectAction.js","names":["convertMappingValue","addNamespaceToActionDefinition","convertValidationRule","createDefaultParameterOrdering","createParameters","defineAction","getInterfaceParameterName","isPropertyParameter","kebab","MODIFY_INTERFACE_OBJECT_PARAMETER","validateActionParameters","validateParameterOrdering","getFlattenedInterfaceProperties","defineModifyInterfaceObjectAction","def","allProperties","interfaceType","Object","keys","apiName","propertyParameters","filter","sharedPropertyType","type","parameterNames","Set","parameterConfiguration","forEach","param","add","actionApiName","split","pop","objectType","undefined","parameterOrdering","includes","unshift","parameters","fromEntries","entries","map","id","prop","required","mappings","nonParameterMappings","value","displayName","displayMetadata","status","entities","affectedInterfaceTypes","affectedObjectTypes","affectedLinkTypes","typeGroups","rules","modifyInterfaceRule","interfaceObjectToModifyParameter","sharedPropertyValues","parameterId","actionLevelValidation","validation","defaultFormat","enableLayoutSwitch","tableConfiguration","displayAndFormat","table","sections","section","submissionMetadata"],"sources":["defineModifyInterfaceObjectAction.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 { convertMappingValue } from \"../conversion/toMarketplace/convertMappingValue.js\";\nimport { type ActionType } from \"./action/ActionType.js\";\nimport type { InterfaceActionTypeUserDefinition } from \"./defineAction.js\";\nimport {\n addNamespaceToActionDefinition,\n convertValidationRule,\n createDefaultParameterOrdering,\n createParameters,\n defineAction,\n getInterfaceParameterName,\n isPropertyParameter,\n kebab,\n MODIFY_INTERFACE_OBJECT_PARAMETER,\n validateActionParameters,\n validateParameterOrdering,\n} from \"./defineAction.js\";\nimport { getFlattenedInterfaceProperties } from \"./interface/getFlattenedInterfaceProperties.js\";\n\nexport function defineModifyInterfaceObjectAction(\n def: InterfaceActionTypeUserDefinition,\n): ActionType {\n addNamespaceToActionDefinition(def);\n const allProperties = getFlattenedInterfaceProperties(def.interfaceType);\n validateActionParameters(\n def,\n Object.keys(allProperties),\n def.interfaceType.apiName,\n );\n const propertyParameters = Object.keys(allProperties).filter(apiName =>\n isPropertyParameter(\n def,\n apiName,\n allProperties[apiName].sharedPropertyType.type,\n )\n );\n const parameterNames = new Set(propertyParameters);\n Object.keys(def.parameterConfiguration ?? {}).forEach(param =>\n parameterNames.add(\n getInterfaceParameterName(def, param),\n )\n );\n parameterNames.add(MODIFY_INTERFACE_OBJECT_PARAMETER);\n const actionApiName = def.apiName ?? `modify-${\n kebab(\n def.interfaceType.apiName.split(\".\").pop() ?? def.interfaceType.apiName,\n )\n }${\n def.objectType === undefined\n ? \"\"\n : `-${\n kebab(\n def.objectType.apiName.split(\".\").pop() ?? def.objectType.apiName,\n )\n }`\n }`;\n if (def.parameterOrdering) {\n if (!def.parameterOrdering.includes(MODIFY_INTERFACE_OBJECT_PARAMETER)) {\n def.parameterOrdering.unshift(MODIFY_INTERFACE_OBJECT_PARAMETER);\n }\n validateParameterOrdering(\n def.parameterOrdering,\n parameterNames,\n actionApiName,\n );\n }\n const parameters = createParameters(\n def,\n Object.fromEntries(\n Object.entries(allProperties).map((\n [id, prop],\n ) => [id, prop.sharedPropertyType]),\n ),\n parameterNames,\n Object.fromEntries(\n Object.entries(allProperties).map(([id, prop]) => [id, prop.required]),\n ),\n );\n const mappings = Object.fromEntries(\n Object.entries(def.nonParameterMappings ?? {}).map((\n [id, value],\n ) => [id, convertMappingValue(value)]),\n );\n\n return defineAction({\n apiName: actionApiName,\n displayName: def.displayName\n ?? `Modify ${def.interfaceType.displayMetadata.displayName}`,\n parameters: parameters,\n status: def.status ?? (def.interfaceType.status.type !== \"deprecated\"\n ? def.interfaceType.status.type\n : def.interfaceType.status),\n entities: {\n affectedInterfaceTypes: [def.interfaceType.apiName],\n affectedObjectTypes: [],\n affectedLinkTypes: [],\n typeGroups: [],\n },\n rules: [\n {\n type: \"modifyInterfaceRule\",\n modifyInterfaceRule: {\n interfaceObjectToModifyParameter: \"interfaceObjectToModifyParameter\",\n sharedPropertyValues: {\n ...Object.fromEntries(\n propertyParameters.map(\n id => [id, { type: \"parameterId\", parameterId: id }],\n ),\n ),\n ...mappings,\n },\n },\n },\n ],\n parameterOrdering: def.parameterOrdering\n ?? createDefaultParameterOrdering(\n def,\n Object.keys(allProperties),\n parameters,\n MODIFY_INTERFACE_OBJECT_PARAMETER,\n ),\n ...(def.actionLevelValidation\n ? {\n validation: convertValidationRule(\n def.actionLevelValidation,\n parameters,\n ),\n }\n : {}),\n ...(def.defaultFormat && { defaultFormat: def.defaultFormat }),\n ...(def.enableLayoutSwitch\n && { enableLayoutSwitch: def.enableLayoutSwitch }),\n ...(def.tableConfiguration && {\n displayAndFormat: {\n table: def.tableConfiguration,\n },\n }),\n ...(def.sections\n && {\n sections: Object.fromEntries(\n def.sections.map(section => [section.id, section]),\n ),\n }),\n ...(def.submissionMetadata\n && { submissionMetadata: def.submissionMetadata }),\n });\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,mBAAmB,QAAQ,oDAAoD;AAGxF,SACEC,8BAA8B,EAC9BC,qBAAqB,EACrBC,8BAA8B,EAC9BC,gBAAgB,EAChBC,YAAY,EACZC,yBAAyB,EACzBC,mBAAmB,EACnBC,KAAK,EACLC,iCAAiC,EACjCC,wBAAwB,EACxBC,yBAAyB,QACpB,mBAAmB;AAC1B,SAASC,+BAA+B,QAAQ,gDAAgD;AAEhG,OAAO,SAASC,iCAAiCA,CAC/CC,GAAsC,EAC1B;EACZb,8BAA8B,CAACa,GAAG,CAAC;EACnC,MAAMC,aAAa,GAAGH,+BAA+B,CAACE,GAAG,CAACE,aAAa,CAAC;EACxEN,wBAAwB,CACtBI,GAAG,EACHG,MAAM,CAACC,IAAI,CAACH,aAAa,CAAC,EAC1BD,GAAG,CAACE,aAAa,CAACG,OACpB,CAAC;EACD,MAAMC,kBAAkB,GAAGH,MAAM,CAACC,IAAI,CAACH,aAAa,CAAC,CAACM,MAAM,CAACF,OAAO,IAClEZ,mBAAmB,CACjBO,GAAG,EACHK,OAAO,EACPJ,aAAa,CAACI,OAAO,CAAC,CAACG,kBAAkB,CAACC,IAC5C,CACF,CAAC;EACD,MAA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,EAAE;YAAEnB,IAAI,EAAE,aAAa;YAAEqC,WAAW,EAAElB;UAAG,CAAC,CACrD,CACF,CAAC;UACD,GAAGG;QACL;MACF;IACF,CAAC,CACF;IACDV,iBAAiB,EAAErB,GAAG,CAACqB,iBAAiB,IACnChC,8BAA8B,CAC/BW,GAAG,EACHG,MAAM,CAACC,IAAI,CAACH,aAAa,CAAC,EAC1BuB,UAAU,EACV7B,iCACF,CAAC;IACH,IAAIK,GAAG,CAAC+C,qBAAqB,GACzB;MACAC,UAAU,EAAE5D,qBAAqB,CAC/BY,GAAG,CAAC+C,qBAAqB,EACzBvB,UACF;IACF,CAAC,GACC,CAAC,CAAC,CAAC;IACP,IAAIxB,GAAG,CAACiD,aAAa,IAAI;MAAEA,aAAa,EAAEjD,GAAG,CAACiD;IAAc,CAAC,CAAC;IAC9D,IAAIjD,GAAG,CAACkD,kBAAkB,IACrB;MAAEA,kBAAkB,EAAElD,GAAG,CAACkD;IAAmB,CAAC,CAAC;IACpD,IAAIlD,GAAG,CAACmD,kBAAkB,IAAI;MAC5BC,gBAAgB,EAAE;QAChBC,KAAK,EAAErD,GAAG,CAACmD;MACb;IACF,CAAC,CAAC;IACF,IAAInD,GAAG,CAACsD,QAAQ,IACX;MACDA,QAAQ,EAAEnD,MAAM,CAACsB,WAAW,CAC1BzB,GAAG,CAACsD,QAAQ,CAAC3B,GAAG,CAAC4B,OAAO,IAAI,CAACA,OAAO,CAAC3B,EAAE,EAAE2B,OAAO,CAAC,CACnD;IACF,CAAC,CAAC;IACJ,IAAIvD,GAAG,CAACwD,kBAAkB,IACrB;MAAEA,kBAAkB,EAAExD,GAAG,CAACwD;IAAmB,CAAC;EACrD,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -77,8 +77,10 @@ export function defineModifyObjectAction(def) {
77
77
  ...(def.enableLayoutSwitch && {
78
78
  enableLayoutSwitch: def.enableLayoutSwitch
79
79
  }),
80
- ...(def.displayAndFormat && {
81
- displayAndFormat: def.displayAndFormat
80
+ ...(def.tableConfiguration && {
81
+ displayAndFormat: {
82
+ table: def.tableConfiguration
83
+ }
82
84
  }),
83
85
  ...(def.sections && {
84
86
  sections: Object.fromEntries(def.sections.map(section => [section.id, section]))
@@ -1 +1 @@
1
- {"version":3,"file":"defineModifyObjectAction.js","names":["convertMappingValue","convertValidationRule","createDefaultParameterOrdering","createParameters","defineAction","isPropertyParameter","kebab","MODIFY_OBJECT_PARAMETER","validateActionParameters","validateParameterOrdering","defineModifyObjectAction","def","Object","keys","objectType","properties","apiName","propertyParameters","filter","id","type","primaryKeyPropertyApiName","parameterNames","Set","parameterConfiguration","forEach","param","add","actionApiName","split","pop","parameterOrdering","includes","unshift","parameters","p","defaultValue","undefined","objectParameterPropertyValue","parameterId","propertyTypeId","mappings","fromEntries","entries","nonParameterMappings","map","value","displayName","status","rules","modifyObjectRule","objectToModify","propertyValues","structFieldValues","entities","affectedInterfaceTypes","affectedObjectTypes","affectedLinkTypes","typeGroups","actionLevelValidation","validation","defaultFormat","enableLayoutSwitch","displayAndFormat","sections","section","submissionMetadata"],"sources":["defineModifyObjectAction.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 { convertMappingValue } from \"../conversion/toMarketplace/convertMappingValue.js\";\nimport { type ActionType } from \"./action/ActionType.js\";\nimport type { ActionTypeUserDefinition } from \"./defineAction.js\";\nimport {\n convertValidationRule,\n createDefaultParameterOrdering,\n createParameters,\n defineAction,\n isPropertyParameter,\n kebab,\n MODIFY_OBJECT_PARAMETER,\n validateActionParameters,\n validateParameterOrdering,\n} from \"./defineAction.js\";\n\nexport function defineModifyObjectAction(\n def: ActionTypeUserDefinition,\n): ActionType {\n validateActionParameters(\n def,\n Object.keys(def.objectType.properties ?? {}),\n def.objectType.apiName,\n );\n const propertyParameters = Object.keys(def.objectType.properties ?? {})\n .filter(\n id =>\n isPropertyParameter(def, id, def.objectType.properties?.[id].type!)\n && id !== def.objectType.primaryKeyPropertyApiName,\n );\n const parameterNames = new Set(propertyParameters);\n Object.keys(def.parameterConfiguration ?? {}).forEach(param =>\n parameterNames.add(param)\n );\n parameterNames.add(MODIFY_OBJECT_PARAMETER);\n const actionApiName = def.apiName\n ?? `modify-object-${\n kebab(def.objectType.apiName.split(\".\").pop() ?? def.objectType.apiName)\n }`;\n if (def.parameterOrdering) {\n if (!def.parameterOrdering.includes(MODIFY_OBJECT_PARAMETER)) {\n def.parameterOrdering.unshift(MODIFY_OBJECT_PARAMETER);\n }\n validateParameterOrdering(\n def.parameterOrdering,\n parameterNames,\n actionApiName,\n );\n }\n const parameters = createParameters(\n def,\n def.objectType.properties ?? {},\n parameterNames,\n );\n parameters.forEach(\n p => {\n if (p.id !== MODIFY_OBJECT_PARAMETER && p.defaultValue === undefined) {\n p.defaultValue = {\n type: \"objectParameterPropertyValue\",\n objectParameterPropertyValue: {\n parameterId: MODIFY_OBJECT_PARAMETER,\n propertyTypeId: p.id,\n },\n };\n }\n },\n );\n\n const mappings = Object.fromEntries(\n Object.entries(def.nonParameterMappings ?? {}).map((\n [id, value],\n ) => [id, convertMappingValue(value)]),\n );\n\n return defineAction({\n apiName: actionApiName,\n displayName: def.displayName ?? `Modify ${def.objectType.displayName}`,\n parameters: parameters,\n status: def.status ?? \"active\",\n rules: [{\n type: \"modifyObjectRule\",\n modifyObjectRule: {\n objectToModify: MODIFY_OBJECT_PARAMETER,\n propertyValues: {\n ...Object.fromEntries(\n propertyParameters.map(\n p => [p, { type: \"parameterId\", parameterId: p }],\n ),\n ),\n ...mappings,\n },\n structFieldValues: {},\n },\n }],\n entities: {\n affectedInterfaceTypes: [],\n affectedObjectTypes: [def.objectType.apiName],\n affectedLinkTypes: [],\n typeGroups: [],\n },\n parameterOrdering: def.parameterOrdering\n ?? createDefaultParameterOrdering(\n def,\n Object.keys(def.objectType.properties ?? {}),\n parameters,\n MODIFY_OBJECT_PARAMETER,\n ),\n ...(def.actionLevelValidation\n ? {\n validation: convertValidationRule(\n def.actionLevelValidation,\n parameters,\n ),\n }\n : {}),\n ...(def.defaultFormat && { defaultFormat: def.defaultFormat }),\n ...(def.enableLayoutSwitch\n && { enableLayoutSwitch: def.enableLayoutSwitch }),\n ...(def.displayAndFormat && { displayAndFormat: def.displayAndFormat }),\n ...(def.sections\n && {\n sections: Object.fromEntries(\n def.sections.map(section => [section.id, section]),\n ),\n }),\n ...(def.submissionMetadata\n && { submissionMetadata: def.submissionMetadata }),\n });\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,mBAAmB,QAAQ,oDAAoD;AAGxF,SACEC,qBAAqB,EACrBC,8BAA8B,EAC9BC,gBAAgB,EAChBC,YAAY,EACZC,mBAAmB,EACnBC,KAAK,EACLC,uBAAuB,EACvBC,wBAAwB,EACxBC,yBAAyB,QACpB,mBAAmB;AAE1B,OAAO,SAASC,wBAAwBA,CACtCC,GAA6B,EACjB;EACZH,wBAAwB,CACtBG,GAAG,EACHC,MAAM,CAACC,IAAI,CAACF,GAAG,CAACG,UAAU,CAACC,UAAU,IAAI,CAAC,CAAC,CAAC,EAC5CJ,GAAG,CAACG,UAAU,CAACE,OACjB,CAAC;EACD,MAAMC,kBAAkB,GAAGL,MAAM,CAACC,IAAI,CAACF,GAAG,CAACG,UAAU,CAACC,UAAU,IAAI,CAAC,CAAC,CAAC,CACpEG,MAAM,CACLC,EAAE,IACAd,mBAAmB,CAACM,GAAG,EAAEQ,EAAE,EAAER,GAAG,CAACG,UAAU,CAACC,UAAU,GAAGI,EAA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AAC,EAC5CmB,UAAU,EACV3B,uBACF,CAAC;IACH,IAAII,GAAG,CAACgD,qBAAqB,GACzB;MACAC,UAAU,EAAE3D,qBAAqB,CAC/BU,GAAG,CAACgD,qBAAqB,EACzBzB,UACF;IACF,CAAC,GACC,CAAC,CAAC,CAAC;IACP,IAAIvB,GAAG,CAACkD,aAAa,IAAI;MAAEA,aAAa,EAAElD,GAAG,CAACkD;IAAc,CAAC,CAAC;IAC9D,IAAIlD,GAAG,CAACmD,kBAAkB,IACrB;MAAEA,kBAAkB,EAAEnD,GAAG,CAACmD;IAAmB,CAAC,CAAC;IACpD,IAAInD,GAAG,CAACoD,gBAAgB,IAAI;MAAEA,gBAAgB,EAAEpD,GAAG,CAACoD;IAAiB,CAAC,CAAC;IACvE,IAAIpD,GAAG,CAACqD,QAAQ,IACX;MACDA,QAAQ,EAAEpD,MAAM,CAAC8B,WAAW,CAC1B/B,GAAG,CAACqD,QAAQ,CAACnB,GAAG,CAACoB,OAAO,IAAI,CAACA,OAAO,CAAC9C,EAAE,EAAE8C,OAAO,CAAC,CACnD;IACF,CAAC,CAAC;IACJ,IAAItD,GAAG,CAACuD,kBAAkB,IACrB;MAAEA,kBAAkB,EAAEvD,GAAG,CAACuD;IAAmB,CAAC;EACrD,CAAC,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"defineModifyObjectAction.js","names":["convertMappingValue","convertValidationRule","createDefaultParameterOrdering","createParameters","defineAction","isPropertyParameter","kebab","MODIFY_OBJECT_PARAMETER","validateActionParameters","validateParameterOrdering","defineModifyObjectAction","def","Object","keys","objectType","properties","apiName","propertyParameters","filter","id","type","primaryKeyPropertyApiName","parameterNames","Set","parameterConfiguration","forEach","param","add","actionApiName","split","pop","parameterOrdering","includes","unshift","parameters","p","defaultValue","undefined","objectParameterPropertyValue","parameterId","propertyTypeId","mappings","fromEntries","entries","nonParameterMappings","map","value","displayName","status","rules","modifyObjectRule","objectToModify","propertyValues","structFieldValues","entities","affectedInterfaceTypes","affectedObjectTypes","affectedLinkTypes","typeGroups","actionLevelValidation","validation","defaultFormat","enableLayoutSwitch","tableConfiguration","displayAndFormat","table","sections","section","submissionMetadata"],"sources":["defineModifyObjectAction.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 { convertMappingValue } from \"../conversion/toMarketplace/convertMappingValue.js\";\nimport { type ActionType } from \"./action/ActionType.js\";\nimport type { ActionTypeUserDefinition } from \"./defineAction.js\";\nimport {\n convertValidationRule,\n createDefaultParameterOrdering,\n createParameters,\n defineAction,\n isPropertyParameter,\n kebab,\n MODIFY_OBJECT_PARAMETER,\n validateActionParameters,\n validateParameterOrdering,\n} from \"./defineAction.js\";\n\nexport function defineModifyObjectAction(\n def: ActionTypeUserDefinition,\n): ActionType {\n validateActionParameters(\n def,\n Object.keys(def.objectType.properties ?? {}),\n def.objectType.apiName,\n );\n const propertyParameters = Object.keys(def.objectType.properties ?? {})\n .filter(\n id =>\n isPropertyParameter(def, id, def.objectType.properties?.[id].type!)\n && id !== def.objectType.primaryKeyPropertyApiName,\n );\n const parameterNames = new Set(propertyParameters);\n Object.keys(def.parameterConfiguration ?? {}).forEach(param =>\n parameterNames.add(param)\n );\n parameterNames.add(MODIFY_OBJECT_PARAMETER);\n const actionApiName = def.apiName\n ?? `modify-object-${\n kebab(def.objectType.apiName.split(\".\").pop() ?? def.objectType.apiName)\n }`;\n if (def.parameterOrdering) {\n if (!def.parameterOrdering.includes(MODIFY_OBJECT_PARAMETER)) {\n def.parameterOrdering.unshift(MODIFY_OBJECT_PARAMETER);\n }\n validateParameterOrdering(\n def.parameterOrdering,\n parameterNames,\n actionApiName,\n );\n }\n const parameters = createParameters(\n def,\n def.objectType.properties ?? {},\n parameterNames,\n );\n parameters.forEach(\n p => {\n if (p.id !== MODIFY_OBJECT_PARAMETER && p.defaultValue === undefined) {\n p.defaultValue = {\n type: \"objectParameterPropertyValue\",\n objectParameterPropertyValue: {\n parameterId: MODIFY_OBJECT_PARAMETER,\n propertyTypeId: p.id,\n },\n };\n }\n },\n );\n\n const mappings = Object.fromEntries(\n Object.entries(def.nonParameterMappings ?? {}).map((\n [id, value],\n ) => [id, convertMappingValue(value)]),\n );\n\n return defineAction({\n apiName: actionApiName,\n displayName: def.displayName ?? `Modify ${def.objectType.displayName}`,\n parameters: parameters,\n status: def.status ?? \"active\",\n rules: [{\n type: \"modifyObjectRule\",\n modifyObjectRule: {\n objectToModify: MODIFY_OBJECT_PARAMETER,\n propertyValues: {\n ...Object.fromEntries(\n propertyParameters.map(\n p => [p, { type: \"parameterId\", parameterId: p }],\n ),\n ),\n ...mappings,\n },\n structFieldValues: {},\n },\n }],\n entities: {\n affectedInterfaceTypes: [],\n affectedObjectTypes: [def.objectType.apiName],\n affectedLinkTypes: [],\n typeGroups: [],\n },\n parameterOrdering: def.parameterOrdering\n ?? createDefaultParameterOrdering(\n def,\n Object.keys(def.objectType.properties ?? {}),\n parameters,\n MODIFY_OBJECT_PARAMETER,\n ),\n ...(def.actionLevelValidation\n ? {\n validation: convertValidationRule(\n def.actionLevelValidation,\n parameters,\n ),\n }\n : {}),\n ...(def.defaultFormat && { defaultFormat: def.defaultFormat }),\n ...(def.enableLayoutSwitch\n && { enableLayoutSwitch: def.enableLayoutSwitch }),\n ...(def.tableConfiguration && {\n displayAndFormat: {\n table: def.tableConfiguration,\n },\n }),\n ...(def.sections\n && {\n sections: Object.fromEntries(\n def.sections.map(section => [section.id, section]),\n ),\n }),\n ...(def.submissionMetadata\n && { submissionMetadata: def.submissionMetadata }),\n });\n}\n"],"mappings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,QAAQ,EAAEtD,MAAM,CAAC8B,WAAW,CAC1B/B,GAAG,CAACuD,QAAQ,CAACrB,GAAG,CAACsB,OAAO,IAAI,CAACA,OAAO,CAAChD,EAAE,EAAEgD,OAAO,CAAC,CACnD;IACF,CAAC,CAAC;IACJ,IAAIxD,GAAG,CAACyD,kBAAkB,IACrB;MAAEA,kBAAkB,EAAEzD,GAAG,CAACyD;IAAmB,CAAC;EACrD,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -15,8 +15,9 @@
15
15
  */
16
16
 
17
17
  import invariant from "tiny-invariant";
18
+ import { getObject } from "../conversion/toMarketplace/convertLink.js";
18
19
  import { OntologyEntityTypeEnum } from "./common/OntologyEntityTypeEnum.js";
19
- import { addNamespaceIfNone, namespace, ontologyDefinition, updateOntology } from "./defineOntology.js";
20
+ import { addNamespaceIfNone, importedTypes, namespace, ontologyDefinition, updateOntology } from "./defineOntology.js";
20
21
  import { getFlattenedInterfaceProperties } from "./interface/getFlattenedInterfaceProperties.js";
21
22
  import { isExotic } from "./properties/PropertyTypeType.js";
22
23
  // From https://stackoverflow.com/a/79288714
@@ -35,8 +36,16 @@ export function defineObject(objectDef) {
35
36
  !propertyApiNames.includes(objectDef.titlePropertyApiName) ? process.env.NODE_ENV !== "production" ? invariant(false, `Title property ${objectDef.titlePropertyApiName} is not defined on object ${objectDef.apiName}`) : invariant(false) : void 0;
36
37
  !propertyApiNames.includes(objectDef.primaryKeyPropertyApiName) ? process.env.NODE_ENV !== "production" ? invariant(false, `Primary key property ${objectDef.primaryKeyPropertyApiName} does not exist on object ${objectDef.apiName}`) : invariant(false) : void 0;
37
38
  !!objectDef.properties?.[objectDef.primaryKeyPropertyApiName]?.editOnly ? process.env.NODE_ENV !== "production" ? invariant(false, `Primary key property ${objectDef.primaryKeyPropertyApiName} on object ${objectDef.apiName} cannot be edit-only`) : invariant(false) : void 0;
38
- const retentionPeriod = objectDef.datasource?.retentionPeriod;
39
- !(retentionPeriod === undefined || ISO_8601_DURATION.test(retentionPeriod)) ? process.env.NODE_ENV !== "production" ? invariant(false, `Retention period "${retentionPeriod}" on object "${objectDef.apiName}" is not a valid ISO 8601 duration string`) : invariant(false) : void 0;
39
+ const retentionPeriods = (objectDef.datasources ?? []).filter(ds => ds.type === "stream").map(ds => ds.retentionPeriod);
40
+ retentionPeriods.forEach(retentionPeriod => {
41
+ !(retentionPeriod === undefined || ISO_8601_DURATION.test(retentionPeriod)) ? process.env.NODE_ENV !== "production" ? invariant(false, `Retention period "${retentionPeriod}" on object "${objectDef.apiName}" is not a valid ISO 8601 duration string`) : invariant(false) : void 0;
42
+ });
43
+ const baseDatasources = (objectDef.datasources ?? []).filter(ds => ["dataset", "stream", "restrictedView"].includes(ds.type));
44
+ !(baseDatasources.length <= 1) ? process.env.NODE_ENV !== "production" ? invariant(false, `Object ${objectDef.apiName} has more than one base datasource (got: [${baseDatasources.map(ds => ds.type).join(", ")}])`) : invariant(false) : void 0;
45
+ const derivedDatasources = (objectDef.datasources ?? []).filter(ds => ds.type === "derived");
46
+ if (derivedDatasources.length > 0) {
47
+ derivedDatasources.forEach(ds => validateDerivedDatasource(objectDef, ds));
48
+ }
40
49
 
41
50
  // Validate that if object status is experimental, no property can have a status of active
42
51
  if (objectDef.status === "experimental") {
@@ -129,4 +138,86 @@ function convertUserObjectPropertyType(apiName, property) {
129
138
  type: property.type
130
139
  };
131
140
  }
141
+ function validateDerivedDatasource(objectDef, datasource) {
142
+ // there should be at least one link
143
+ !(datasource.linkDefinition.length > 0) ? process.env.NODE_ENV !== "production" ? invariant(false, `Derived datasource for object '${objectDef.apiName}' must have at least one link.`) : invariant(false) : void 0;
144
+
145
+ // all of the links references should exist
146
+ datasource.linkDefinition.forEach(link => {
147
+ const linkApiName = link.linkType.apiName;
148
+ !(ontologyDefinition[OntologyEntityTypeEnum.LINK_TYPE][linkApiName] !== undefined || importedTypes[OntologyEntityTypeEnum.LINK_TYPE][linkApiName] !== undefined) ? process.env.NODE_ENV !== "production" ? invariant(false, `Link type '${linkApiName}' used in derived datasource for object '${objectDef.apiName}' is not defined.`) : invariant(false) : void 0;
149
+ });
150
+
151
+ // all of the properties references on the source object should exist
152
+ Object.keys(datasource.propertyMapping).forEach(prop => {
153
+ !(objectDef.properties?.[prop] !== undefined) ? process.env.NODE_ENV !== "production" ? invariant(false, `Property '${prop}' used in derived datasource for object '${objectDef.apiName}' is not defined.`) : invariant(false) : void 0;
154
+ });
155
+ const isLinkedProperties = typeof Object.values(datasource.propertyMapping)[0] === "string";
156
+ if (isLinkedProperties) {
157
+ validateLinkedProperties(datasource, objectDef);
158
+ } else {
159
+ validateAggregations(datasource, objectDef);
160
+ }
161
+ }
162
+ function validateLinkedProperties(datasource) {
163
+ const foreignProperties = Object.values(datasource.propertyMapping);
164
+ // the foreign property must exist in the final object in the link chain
165
+ const finalObject = getObject(datasource.linkDefinition.at(-1).linkType.toMany.object).object;
166
+ foreignProperties.forEach(prop => {
167
+ !(finalObject.properties?.find(p => p.apiName === prop) !== undefined) ? process.env.NODE_ENV !== "production" ? invariant(false, `Property '${prop}' on object '${finalObject.apiName}' is not defined`) : invariant(false) : void 0;
168
+ });
169
+ }
170
+ function validateAggregations(datasource, objectDef) {
171
+ const props = datasource.propertyMapping;
172
+ Object.entries(props).forEach(([propName, agg]) => {
173
+ // TODO(dpaquin): check that the property type matches the foreign property type,
174
+ // for collectList/collectSet and maybe min/max too?
175
+ const property = objectDef.properties[propName];
176
+ switch (agg.type) {
177
+ case "collectList":
178
+ case "collectSet":
179
+ // property's type is collectible
180
+ !isCollectible(property) ? process.env.NODE_ENV !== "production" ? invariant(false, `Property '${propName}' on object '${objectDef.apiName}' is not collectible`) : invariant(false) : void 0;
181
+ // limit <= 100
182
+ !(agg.limit <= 100) ? process.env.NODE_ENV !== "production" ? invariant(false, `[Error] Limit for collection '${propName}' on object '${objectDef.apiName}' is greater than 100`) : invariant(false) : void 0;
183
+ break;
184
+ case "avg":
185
+ case "sum":
186
+ // property's type is numeric
187
+ !isNumeric(property.type) ? process.env.NODE_ENV !== "production" ? invariant(false, `Property '${propName}' on object '${objectDef.apiName}' is not numeric`) : invariant(false) : void 0;
188
+ break;
189
+ case "min":
190
+ case "max":
191
+ case "approximateCardinality":
192
+ case "exactCardinality":
193
+ // property's type is primitive
194
+ !isPrimitive(property.type) ? process.env.NODE_ENV !== "production" ? invariant(false, `Property '${propName}' on object '${objectDef.apiName}' is not primitive`) : invariant(false) : void 0;
195
+ break;
196
+ default:
197
+ break;
198
+ }
199
+
200
+ // if a foreign property is referenced, it must exist in the final object
201
+ if (agg.type !== "count") {
202
+ const foreignProperty = agg.property;
203
+ const finalObject = getObject(datasource.linkDefinition.at(-1).linkType.toMany.object).object;
204
+ !(finalObject.properties?.find(p => p.apiName === foreignProperty) !== undefined) ? process.env.NODE_ENV !== "production" ? invariant(false, `Property '${foreignProperty}' on object '${finalObject.apiName}' is not defined`) : invariant(false) : void 0;
205
+ }
206
+ });
207
+ }
208
+ function isCollectible(property) {
209
+ if (!(property.array ?? false)) {
210
+ return false;
211
+ }
212
+ const typeType = typeof property.type === "string" ? property.type : property.type.type;
213
+ return ["boolean", "byte", "date", "double", "float", "geohash", "geoshape", "integer", "long", "mediareference", "short", "string", "struct", "timestamp"].includes(typeType);
214
+ }
215
+ function isNumeric(type) {
216
+ const typeType = typeof type === "string" ? type : type.type;
217
+ return ["byte", "double", "float", "integer", "long", "short"].includes(typeType);
218
+ }
219
+ function isPrimitive(type) {
220
+ const typeType = typeof type === "string" ? type : type.type;
221
+ return ["boolean", "byte", "date", "double", "float", "integer", "long", "short", "string", "timestamp"].includes(typeType);
222
+ }
132
223
  //# sourceMappingURL=defineObject.js.map