cognite-toolkit 0.7.30__py3-none-any.whl → 0.7.51__py3-none-any.whl

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 (281) hide show
  1. cognite_toolkit/_cdf.py +5 -6
  2. cognite_toolkit/_cdf_tk/apps/__init__.py +2 -0
  3. cognite_toolkit/_cdf_tk/apps/_core_app.py +7 -1
  4. cognite_toolkit/_cdf_tk/apps/_download_app.py +2 -2
  5. cognite_toolkit/_cdf_tk/apps/_dump_app.py +1 -1
  6. cognite_toolkit/_cdf_tk/apps/_import_app.py +41 -0
  7. cognite_toolkit/_cdf_tk/apps/_migrate_app.py +183 -8
  8. cognite_toolkit/_cdf_tk/builders/_function.py +81 -9
  9. cognite_toolkit/_cdf_tk/builders/_raw.py +1 -1
  10. cognite_toolkit/_cdf_tk/client/_resource_base.py +187 -0
  11. cognite_toolkit/_cdf_tk/client/_toolkit_client.py +44 -12
  12. cognite_toolkit/_cdf_tk/client/api/agents.py +107 -0
  13. cognite_toolkit/_cdf_tk/client/api/annotations.py +129 -0
  14. cognite_toolkit/_cdf_tk/client/api/assets.py +130 -0
  15. cognite_toolkit/_cdf_tk/client/api/containers.py +132 -0
  16. cognite_toolkit/_cdf_tk/client/api/data_models.py +137 -0
  17. cognite_toolkit/_cdf_tk/client/api/datasets.py +141 -0
  18. cognite_toolkit/_cdf_tk/client/api/events.py +129 -0
  19. cognite_toolkit/_cdf_tk/client/api/extraction_pipelines.py +148 -0
  20. cognite_toolkit/_cdf_tk/client/api/filemetadata.py +176 -0
  21. cognite_toolkit/_cdf_tk/client/api/function_schedules.py +115 -0
  22. cognite_toolkit/_cdf_tk/client/api/functions.py +113 -0
  23. cognite_toolkit/_cdf_tk/client/api/graphql_data_models.py +167 -0
  24. cognite_toolkit/_cdf_tk/client/api/groups.py +121 -0
  25. cognite_toolkit/_cdf_tk/client/api/hosted_extractor_destinations.py +131 -0
  26. cognite_toolkit/_cdf_tk/client/api/hosted_extractor_jobs.py +122 -0
  27. cognite_toolkit/_cdf_tk/client/api/hosted_extractor_mappings.py +129 -0
  28. cognite_toolkit/_cdf_tk/client/api/hosted_extractor_sources.py +136 -0
  29. cognite_toolkit/_cdf_tk/client/api/hosted_extractors.py +23 -0
  30. cognite_toolkit/_cdf_tk/client/api/infield.py +40 -35
  31. cognite_toolkit/_cdf_tk/client/api/instances.py +139 -0
  32. cognite_toolkit/_cdf_tk/client/api/labels.py +125 -0
  33. cognite_toolkit/_cdf_tk/client/api/{canvas.py → legacy/canvas.py} +16 -8
  34. cognite_toolkit/_cdf_tk/client/api/{charts.py → legacy/charts.py} +1 -1
  35. cognite_toolkit/_cdf_tk/client/api/{extended_data_modeling.py → legacy/extended_data_modeling.py} +1 -1
  36. cognite_toolkit/_cdf_tk/client/api/{extended_files.py → legacy/extended_files.py} +2 -2
  37. cognite_toolkit/_cdf_tk/client/api/{extended_functions.py → legacy/extended_functions.py} +9 -9
  38. cognite_toolkit/_cdf_tk/client/api/{extended_raw.py → legacy/extended_raw.py} +1 -1
  39. cognite_toolkit/_cdf_tk/client/api/{extended_timeseries.py → legacy/extended_timeseries.py} +5 -2
  40. cognite_toolkit/_cdf_tk/client/api/legacy/location_filters.py +112 -0
  41. cognite_toolkit/_cdf_tk/client/api/legacy/robotics/__init__.py +8 -0
  42. cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/capabilities.py +1 -1
  43. cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/data_postprocessing.py +1 -1
  44. cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/frames.py +1 -1
  45. cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/locations.py +1 -1
  46. cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/maps.py +1 -1
  47. cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/robots.py +2 -2
  48. cognite_toolkit/_cdf_tk/client/api/legacy/search_config.py +53 -0
  49. cognite_toolkit/_cdf_tk/client/api/location_filters.py +140 -75
  50. cognite_toolkit/_cdf_tk/client/api/migration.py +2 -3
  51. cognite_toolkit/_cdf_tk/client/api/project.py +9 -8
  52. cognite_toolkit/_cdf_tk/client/api/raw.py +204 -0
  53. cognite_toolkit/_cdf_tk/client/api/relationships.py +133 -0
  54. cognite_toolkit/_cdf_tk/client/api/robotics.py +19 -0
  55. cognite_toolkit/_cdf_tk/client/api/robotics_capabilities.py +127 -0
  56. cognite_toolkit/_cdf_tk/client/api/robotics_data_postprocessing.py +138 -0
  57. cognite_toolkit/_cdf_tk/client/api/robotics_frames.py +122 -0
  58. cognite_toolkit/_cdf_tk/client/api/robotics_locations.py +127 -0
  59. cognite_toolkit/_cdf_tk/client/api/robotics_maps.py +122 -0
  60. cognite_toolkit/_cdf_tk/client/api/robotics_robots.py +122 -0
  61. cognite_toolkit/_cdf_tk/client/api/search.py +2 -2
  62. cognite_toolkit/_cdf_tk/client/api/search_config.py +83 -31
  63. cognite_toolkit/_cdf_tk/client/api/security_categories.py +94 -0
  64. cognite_toolkit/_cdf_tk/client/api/sequences.py +133 -0
  65. cognite_toolkit/_cdf_tk/client/api/simulator_models.py +154 -0
  66. cognite_toolkit/_cdf_tk/client/api/simulators.py +8 -0
  67. cognite_toolkit/_cdf_tk/client/api/spaces.py +117 -0
  68. cognite_toolkit/_cdf_tk/client/api/streams.py +68 -56
  69. cognite_toolkit/_cdf_tk/client/api/three_d.py +385 -34
  70. cognite_toolkit/_cdf_tk/client/api/timeseries.py +137 -0
  71. cognite_toolkit/_cdf_tk/client/api/token.py +1 -1
  72. cognite_toolkit/_cdf_tk/client/api/transformations.py +146 -0
  73. cognite_toolkit/_cdf_tk/client/api/views.py +139 -0
  74. cognite_toolkit/_cdf_tk/client/api/workflow_triggers.py +128 -0
  75. cognite_toolkit/_cdf_tk/client/api/workflow_versions.py +138 -0
  76. cognite_toolkit/_cdf_tk/client/api/workflows.py +119 -0
  77. cognite_toolkit/_cdf_tk/client/cdf_client/__init__.py +10 -0
  78. cognite_toolkit/_cdf_tk/client/cdf_client/api.py +358 -0
  79. cognite_toolkit/_cdf_tk/client/cdf_client/responses.py +38 -0
  80. cognite_toolkit/_cdf_tk/{utils → client}/http_client/__init__.py +30 -0
  81. cognite_toolkit/_cdf_tk/{utils → client}/http_client/_client.py +26 -16
  82. cognite_toolkit/_cdf_tk/{utils → client}/http_client/_data_classes.py +18 -2
  83. cognite_toolkit/_cdf_tk/client/http_client/_data_classes2.py +151 -0
  84. cognite_toolkit/_cdf_tk/client/http_client/_exception.py +13 -0
  85. cognite_toolkit/_cdf_tk/client/http_client/_item_classes.py +118 -0
  86. cognite_toolkit/_cdf_tk/{utils → client}/http_client/_tracker.py +5 -2
  87. cognite_toolkit/_cdf_tk/client/request_classes/base.py +19 -0
  88. cognite_toolkit/_cdf_tk/client/request_classes/filters.py +113 -0
  89. cognite_toolkit/_cdf_tk/client/request_classes/graphql.py +28 -0
  90. cognite_toolkit/_cdf_tk/client/resource_classes/__init__.py +0 -0
  91. cognite_toolkit/_cdf_tk/client/resource_classes/agent.py +130 -0
  92. cognite_toolkit/_cdf_tk/client/resource_classes/annotation.py +79 -0
  93. cognite_toolkit/_cdf_tk/client/resource_classes/apm_config.py +128 -0
  94. cognite_toolkit/_cdf_tk/client/resource_classes/asset.py +47 -0
  95. cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/charts_data.py +1 -1
  96. cognite_toolkit/_cdf_tk/client/resource_classes/cognite_file.py +53 -0
  97. cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/__init__.py +168 -0
  98. cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_constraints.py +37 -0
  99. cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_container.py +50 -0
  100. cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_data_model.py +73 -0
  101. cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_data_types.py +116 -0
  102. cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_indexes.py +26 -0
  103. cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_instance.py +154 -0
  104. cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_references.py +86 -0
  105. cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_space.py +26 -0
  106. cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_view.py +143 -0
  107. cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_view_property.py +152 -0
  108. cognite_toolkit/_cdf_tk/client/resource_classes/dataset.py +35 -0
  109. cognite_toolkit/_cdf_tk/client/resource_classes/event.py +40 -0
  110. cognite_toolkit/_cdf_tk/client/resource_classes/extraction_pipeline.py +59 -0
  111. cognite_toolkit/_cdf_tk/client/resource_classes/filemetadata.py +52 -0
  112. cognite_toolkit/_cdf_tk/client/resource_classes/function.py +53 -0
  113. cognite_toolkit/_cdf_tk/client/resource_classes/function_schedule.py +65 -0
  114. cognite_toolkit/_cdf_tk/client/resource_classes/graphql_data_model.py +40 -0
  115. cognite_toolkit/_cdf_tk/client/resource_classes/group/__init__.py +187 -0
  116. cognite_toolkit/_cdf_tk/client/resource_classes/group/_constants.py +2 -0
  117. cognite_toolkit/_cdf_tk/client/resource_classes/group/acls.py +653 -0
  118. cognite_toolkit/_cdf_tk/client/resource_classes/group/capability.py +56 -0
  119. cognite_toolkit/_cdf_tk/client/resource_classes/group/group.py +63 -0
  120. cognite_toolkit/_cdf_tk/client/resource_classes/group/scopes.py +166 -0
  121. cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_destination.py +34 -0
  122. cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_job.py +134 -0
  123. cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_mapping.py +72 -0
  124. cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/__init__.py +63 -0
  125. cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/_auth.py +63 -0
  126. cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/_base.py +26 -0
  127. cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/_certificate.py +20 -0
  128. cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/_eventhub.py +31 -0
  129. cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/_kafka.py +53 -0
  130. cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/_mqtt.py +36 -0
  131. cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/_rest.py +49 -0
  132. cognite_toolkit/_cdf_tk/client/resource_classes/identifiers.py +59 -0
  133. cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/infield.py +1 -1
  134. cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/instance_api.py +53 -14
  135. cognite_toolkit/_cdf_tk/client/resource_classes/label.py +27 -0
  136. cognite_toolkit/_cdf_tk/client/resource_classes/legacy/__init__.py +0 -0
  137. cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/canvas.py +48 -15
  138. cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/charts.py +1 -1
  139. cognite_toolkit/_cdf_tk/client/resource_classes/location_filter.py +84 -0
  140. cognite_toolkit/_cdf_tk/client/resource_classes/raw.py +44 -0
  141. cognite_toolkit/_cdf_tk/client/resource_classes/relationship.py +49 -0
  142. cognite_toolkit/_cdf_tk/client/resource_classes/resource_view_mapping.py +38 -0
  143. cognite_toolkit/_cdf_tk/client/resource_classes/robotics/__init__.py +37 -0
  144. cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_capability.py +53 -0
  145. cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_common.py +34 -0
  146. cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_data_post_processing.py +49 -0
  147. cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_frame.py +46 -0
  148. cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_location.py +36 -0
  149. cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_map.py +65 -0
  150. cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_robot.py +58 -0
  151. cognite_toolkit/_cdf_tk/client/resource_classes/search_config.py +54 -0
  152. cognite_toolkit/_cdf_tk/client/resource_classes/securitycategory.py +24 -0
  153. cognite_toolkit/_cdf_tk/client/resource_classes/sequence.py +45 -0
  154. cognite_toolkit/_cdf_tk/client/resource_classes/sequence_rows.py +56 -0
  155. cognite_toolkit/_cdf_tk/client/resource_classes/simulator_model.py +50 -0
  156. cognite_toolkit/_cdf_tk/client/resource_classes/streamlit_.py +71 -0
  157. cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/streams.py +9 -26
  158. cognite_toolkit/_cdf_tk/client/resource_classes/three_d.py +135 -0
  159. cognite_toolkit/_cdf_tk/client/resource_classes/timeseries.py +52 -0
  160. cognite_toolkit/_cdf_tk/client/resource_classes/transformation.py +140 -0
  161. cognite_toolkit/_cdf_tk/client/resource_classes/workflow.py +27 -0
  162. cognite_toolkit/_cdf_tk/client/resource_classes/workflow_trigger.py +63 -0
  163. cognite_toolkit/_cdf_tk/client/resource_classes/workflow_version.py +155 -0
  164. cognite_toolkit/_cdf_tk/client/testing.py +54 -17
  165. cognite_toolkit/_cdf_tk/commands/__init__.py +1 -0
  166. cognite_toolkit/_cdf_tk/commands/_migrate/command.py +103 -108
  167. cognite_toolkit/_cdf_tk/commands/_migrate/conversion.py +29 -16
  168. cognite_toolkit/_cdf_tk/commands/_migrate/creators.py +1 -1
  169. cognite_toolkit/_cdf_tk/commands/_migrate/data_classes.py +38 -6
  170. cognite_toolkit/_cdf_tk/commands/_migrate/data_mapper.py +262 -36
  171. cognite_toolkit/_cdf_tk/commands/_migrate/data_model.py +1 -0
  172. cognite_toolkit/_cdf_tk/commands/_migrate/default_mappings.py +1 -1
  173. cognite_toolkit/_cdf_tk/commands/_migrate/issues.py +39 -38
  174. cognite_toolkit/_cdf_tk/commands/_migrate/migration_io.py +227 -8
  175. cognite_toolkit/_cdf_tk/commands/_profile.py +1 -1
  176. cognite_toolkit/_cdf_tk/commands/_purge.py +14 -16
  177. cognite_toolkit/_cdf_tk/commands/_upload.py +1 -1
  178. cognite_toolkit/_cdf_tk/commands/build_cmd.py +12 -2
  179. cognite_toolkit/_cdf_tk/commands/build_v2/__init__.py +0 -0
  180. cognite_toolkit/_cdf_tk/commands/build_v2/_module_parser.py +138 -0
  181. cognite_toolkit/_cdf_tk/commands/build_v2/_modules_parser.py +163 -0
  182. cognite_toolkit/_cdf_tk/commands/build_v2/build_cmd.py +228 -0
  183. cognite_toolkit/_cdf_tk/commands/build_v2/build_parameters.py +71 -0
  184. cognite_toolkit/_cdf_tk/commands/build_v2/data_classes/_modules.py +27 -0
  185. cognite_toolkit/_cdf_tk/commands/build_v2/data_classes/_resource.py +22 -0
  186. cognite_toolkit/_cdf_tk/commands/dump_resource.py +4 -4
  187. cognite_toolkit/_cdf_tk/commands/pull.py +97 -2
  188. cognite_toolkit/_cdf_tk/commands/run.py +1 -1
  189. cognite_toolkit/_cdf_tk/cruds/__init__.py +16 -6
  190. cognite_toolkit/_cdf_tk/cruds/_data_cruds.py +9 -5
  191. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/__init__.py +2 -0
  192. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/auth.py +6 -2
  193. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/classic.py +70 -89
  194. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/configuration.py +1 -1
  195. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/datamodel.py +1 -1
  196. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/extraction_pipeline.py +1 -1
  197. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/fieldops.py +34 -25
  198. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/file.py +50 -59
  199. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/function.py +14 -2
  200. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/industrial_tool.py +1 -1
  201. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/location.py +4 -3
  202. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/migration.py +1 -1
  203. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/raw.py +6 -1
  204. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/relationship.py +5 -4
  205. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/robotics.py +1 -1
  206. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/simulators.py +122 -0
  207. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/streams.py +15 -31
  208. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/timeseries.py +42 -47
  209. cognite_toolkit/_cdf_tk/cruds/_resource_cruds/transformation.py +49 -14
  210. cognite_toolkit/_cdf_tk/data_classes/__init__.py +3 -0
  211. cognite_toolkit/_cdf_tk/data_classes/_issues.py +36 -0
  212. cognite_toolkit/_cdf_tk/data_classes/_module_directories.py +2 -1
  213. cognite_toolkit/_cdf_tk/data_classes/_module_toml.py +1 -0
  214. cognite_toolkit/_cdf_tk/data_classes/_tracking_info.py +4 -0
  215. cognite_toolkit/_cdf_tk/feature_flags.py +8 -0
  216. cognite_toolkit/_cdf_tk/resource_classes/__init__.py +2 -0
  217. cognite_toolkit/_cdf_tk/resource_classes/capabilities.py +6 -0
  218. cognite_toolkit/_cdf_tk/resource_classes/search_config.py +1 -1
  219. cognite_toolkit/_cdf_tk/resource_classes/simulator_model.py +17 -0
  220. cognite_toolkit/_cdf_tk/resource_classes/workflow_version.py +173 -5
  221. cognite_toolkit/_cdf_tk/storageio/_applications.py +53 -15
  222. cognite_toolkit/_cdf_tk/storageio/_asset_centric.py +117 -107
  223. cognite_toolkit/_cdf_tk/storageio/_base.py +3 -1
  224. cognite_toolkit/_cdf_tk/storageio/_datapoints.py +7 -7
  225. cognite_toolkit/_cdf_tk/storageio/_file_content.py +65 -56
  226. cognite_toolkit/_cdf_tk/storageio/_instances.py +1 -1
  227. cognite_toolkit/_cdf_tk/storageio/_raw.py +1 -1
  228. cognite_toolkit/_cdf_tk/storageio/logger.py +162 -0
  229. cognite_toolkit/_cdf_tk/storageio/selectors/__init__.py +10 -1
  230. cognite_toolkit/_cdf_tk/storageio/selectors/_three_d.py +34 -0
  231. cognite_toolkit/_cdf_tk/tk_warnings/__init__.py +2 -0
  232. cognite_toolkit/_cdf_tk/tk_warnings/fileread.py +20 -0
  233. cognite_toolkit/_cdf_tk/utils/__init__.py +11 -1
  234. cognite_toolkit/_cdf_tk/utils/cdf.py +1 -1
  235. cognite_toolkit/_cdf_tk/utils/interactive_select.py +53 -4
  236. cognite_toolkit/_cdf_tk/utils/modules.py +7 -0
  237. cognite_toolkit/_cdf_tk/utils/pip_validator.py +96 -0
  238. cognite_toolkit/_cdf_tk/utils/useful_types.py +4 -7
  239. cognite_toolkit/_cdf_tk/utils/useful_types2.py +14 -0
  240. cognite_toolkit/_cdf_tk/validation.py +4 -0
  241. cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml +1 -1
  242. cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml +1 -1
  243. cognite_toolkit/_resources/cdf.toml +1 -1
  244. cognite_toolkit/_version.py +1 -1
  245. {cognite_toolkit-0.7.30.dist-info → cognite_toolkit-0.7.51.dist-info}/METADATA +13 -3
  246. cognite_toolkit-0.7.51.dist-info/RECORD +445 -0
  247. {cognite_toolkit-0.7.30.dist-info → cognite_toolkit-0.7.51.dist-info}/WHEEL +2 -2
  248. cognite_toolkit/_cdf_tk/client/api/robotics/__init__.py +0 -3
  249. cognite_toolkit/_cdf_tk/client/data_classes/api_classes.py +0 -17
  250. cognite_toolkit/_cdf_tk/client/data_classes/base.py +0 -87
  251. cognite_toolkit/_cdf_tk/client/data_classes/three_d.py +0 -47
  252. cognite_toolkit/_cdf_tk/prototypes/import_app.py +0 -41
  253. cognite_toolkit/_cdf_tk/utils/http_client/_data_classes2.py +0 -187
  254. cognite_toolkit/_cdf_tk/utils/http_client/_exception.py +0 -4
  255. cognite_toolkit-0.7.30.dist-info/RECORD +0 -316
  256. /cognite_toolkit/_cdf_tk/client/{data_classes → api/legacy}/__init__.py +0 -0
  257. /cognite_toolkit/_cdf_tk/client/api/{dml.py → legacy/dml.py} +0 -0
  258. /cognite_toolkit/_cdf_tk/client/api/{fixed_transformations.py → legacy/fixed_transformations.py} +0 -0
  259. /cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/api.py +0 -0
  260. /cognite_toolkit/_cdf_tk/client/api/{robotics → legacy/robotics}/utlis.py +0 -0
  261. /cognite_toolkit/_cdf_tk/{prototypes/commands → client/request_classes}/__init__.py +0 -0
  262. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/capabilities.py +0 -0
  263. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/apm_config_v1.py +0 -0
  264. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/extendable_cognite_file.py +0 -0
  265. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/extended_filemetadata.py +0 -0
  266. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/extended_filemetdata.py +0 -0
  267. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/extended_timeseries.py +0 -0
  268. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/functions.py +0 -0
  269. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/graphql_data_models.py +0 -0
  270. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/instances.py +0 -0
  271. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/location_filters.py +0 -0
  272. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/migration.py +0 -0
  273. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/pending_instances_ids.py +0 -0
  274. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/project.py +0 -0
  275. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/raw.py +0 -0
  276. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/robotics.py +0 -0
  277. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/search_config.py +0 -0
  278. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/sequences.py +0 -0
  279. /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes/legacy}/streamlit_.py +0 -0
  280. /cognite_toolkit/_cdf_tk/{prototypes/commands/import_.py → commands/_import_cmd.py} +0 -0
  281. {cognite_toolkit-0.7.30.dist-info → cognite_toolkit-0.7.51.dist-info}/entry_points.txt +0 -0
@@ -1,4 +1,5 @@
1
- from typing import Literal
1
+ from abc import ABC
2
+ from typing import Annotated, Literal
2
3
 
3
4
  from cognite.client.data_classes import WorkflowVersionUpsert
4
5
  from pydantic import Field, JsonValue
@@ -6,18 +7,150 @@ from pydantic import Field, JsonValue
6
7
  from .base import BaseModelResource, ToolkitResource
7
8
 
8
9
 
10
+ class WorkflowVersionId(BaseModelResource):
11
+ workflow_external_id: str = Field(
12
+ max_length=255,
13
+ description="Identifier for a workflow. Must be unique for the project. No trailing or leading whitespace and no null characters allowed.",
14
+ )
15
+ version: str = Field(
16
+ max_length=255,
17
+ description="Identifier for a version. Must be unique for the workflow. No trailing or leading whitespace and no null characters allowed.",
18
+ )
19
+
20
+
21
+ class CogniteFunctionRef(BaseModelResource):
22
+ external_id: str = Field(
23
+ description="The external id of the Cognite Function in the project. This can be either a function external ID or a reference like ${myTaskExternalId.output.someKey}"
24
+ )
25
+ data: str | JsonValue | None = Field(
26
+ None, description="Input data that will be passed to the Cognite Function. Limited to 100KB in size."
27
+ )
28
+
29
+
30
+ class FunctionTaskParameters(BaseModelResource):
31
+ function: CogniteFunctionRef
32
+ is_async_complete: bool = Field(
33
+ False, description="Defines if the execution of the task should be completed asynchronously."
34
+ )
35
+
36
+
37
+ class TransformationRef(BaseModelResource):
38
+ external_id: str = Field(
39
+ description="The external id of the Transformation in the project. This can be either a transformation external ID or a reference like ${myTaskExternalId.output.someKey}"
40
+ )
41
+ concurrency_policy: Literal["fail", "waitForCurrent", "restartAfterCurrent"] = Field(
42
+ "fail",
43
+ description="""Determines the behavior of the task if the Transformation is already running.
44
+
45
+ fail: The task fails if another instance of the Transformation is currently running.
46
+ waitForCurrent: The task will pause and wait for the already running Transformation to complete. Once completed, the task is completed. This mode is useful for preventing redundant Transformation runs.
47
+ restartAfterCurrent: The task waits for the ongoing Transformation to finish. After completion, the task restarts the Transformation. This mode ensures that the most recent data can be used by following tasks.""",
48
+ )
49
+ use_transformation_credentials: bool = Field(
50
+ False,
51
+ description="If set to true, the transformation will run using the client credentials configured on the transformation. If set to false, the transformation will run using the client credentials used to trigger the workflow.",
52
+ )
53
+
54
+
55
+ class TransformationTaskParameters(BaseModelResource):
56
+ transformation: TransformationRef
57
+
58
+
59
+ class CDFRequest(BaseModelResource):
60
+ resource_path: str = Field(
61
+ description="The path of the request. The path should be prefixed by {cluster}.cognitedata.com/api/v1/project/{project} based on the relevant cluster and project. It can also contain references like ${myTaskExternalId.output.someKey}"
62
+ )
63
+ method: Literal["POST", "GET", "PUT"] | str = Field(
64
+ description="The HTTP method of the request. It can also be a reference like ${myTaskExternalId.output.someKey}"
65
+ )
66
+ query_parameters: dict[str, JsonValue] | str | None = Field(
67
+ None,
68
+ description="The query parameters of the request. It can also be a reference like ${myTaskExternalId.output.someKey}",
69
+ )
70
+ body: JsonValue | str | None = Field(
71
+ None, description="The body of the request. It can also be a reference like ${myTaskExternalId.output.someKey}"
72
+ )
73
+ request_timeout_in_millis: float | str | None = Field(
74
+ None,
75
+ description="The timeout for the request in milliseconds. It can also be a reference like ${myTaskExternalId.output.someKey}",
76
+ )
77
+ cdf_version_header: Literal["alpha", "beta"] | str | None = Field(
78
+ None, description="The Cognite Data Fusion version header to use for the request."
79
+ )
80
+
81
+
82
+ class CDFTaskParameters(BaseModelResource):
83
+ cdf_request: CDFRequest
84
+
85
+
86
+ class DynamicRef(BaseModelResource):
87
+ tasks: str = Field(
88
+ description="A Reference is an expression that allows dynamically injecting input to a task during execution. References can be used to reference the input of the Workflow, the output of a previous task in the Workflow, or the input of a previous task in the Workflow. Note that the injected value must be valid in the context of the property it is injected into. Example Task reference: ${myTaskExternalId.output.someKey} Example Workflow input reference: ${workflow.input.myKey}"
89
+ )
90
+
91
+
92
+ class DynamicTaskParameters(BaseModelResource):
93
+ dynamic: DynamicRef = Field(description="Reference to another task to use as the definition for this task.")
94
+
95
+
96
+ class SubworkflowInlineTasks(BaseModelResource):
97
+ """Inline definition of tasks for a subworkflow."""
98
+
99
+ tasks: "list[Task]" = Field(description="Inline definition of tasks for the subworkflow.")
100
+
101
+
102
+ # SubworkflowRef can be either a reference to an existing workflow version OR an inline definition of tasks
103
+ SubworkflowRef = Annotated[
104
+ WorkflowVersionId | SubworkflowInlineTasks,
105
+ Field(
106
+ description="Reference to the subworkflow to execute. This can be either a reference to an existing workflow version (with workflowExternalId and version) or an inline definition of tasks."
107
+ ),
108
+ ]
109
+
110
+
111
+ class SubworkflowTaskParameters(BaseModelResource):
112
+ subworkflow: SubworkflowRef = Field(description="Reference to the subworkflow to execute.")
113
+
114
+
115
+ class SimulatorInputUnit(BaseModelResource):
116
+ name: str = Field(description="Name of the unit.")
117
+
118
+
119
+ class SimulatorInput(BaseModelResource):
120
+ reference_id: str = Field(description="Reference id of the value to override.")
121
+ value: str | int | float | list[str] | list[int] | list[float] = Field(
122
+ description="Override the value used for a simulation run."
123
+ )
124
+ unit: SimulatorInputUnit | None = Field(None, description="Override the unit of the value")
125
+
126
+
127
+ class SimulationRef(BaseModelResource):
128
+ routine_external_id: str = Field(description="The external id of the routine to be executed.")
129
+ run_time: int | None = Field(
130
+ None,
131
+ description="Run time in milliseconds. Reference timestamp used for data pre-processing and data sampling.",
132
+ )
133
+ inputs: list[SimulatorInput] | None = Field(
134
+ None, description="List of inputs to be provided to the simulation.", max_length=200
135
+ )
136
+
137
+
138
+ class SimulationTaskParameters(BaseModelResource):
139
+ simulation: SimulationRef = Field(description="Reference to the simulation to execute.")
140
+
141
+
9
142
  class TaskId(BaseModelResource):
10
143
  external_id: str = Field(
11
144
  max_length=255, description="The external ID provided by the client. Must be unique for the resource type."
12
145
  )
13
146
 
14
147
 
15
- class TaskDefinition(BaseModelResource):
148
+ class TaskDefinition(BaseModelResource, ABC):
16
149
  external_id: str = Field(
17
150
  max_length=255,
18
151
  description="Identifier for the task. Must be unique within the version. No trailing or leading whitespace and no null characters allowed.",
19
152
  )
20
- type: Literal["function", "transformation", "cdf", "dynamic", "subworkflow", "simulation"]
153
+ type: str
21
154
  name: str | None = Field(
22
155
  default=None,
23
156
  max_length=255,
@@ -28,7 +161,6 @@ class TaskDefinition(BaseModelResource):
28
161
  max_length=500,
29
162
  description="Description of the intention of the task",
30
163
  )
31
- parameters: JsonValue = Field()
32
164
  retries: int = Field(
33
165
  3,
34
166
  ge=0,
@@ -52,13 +184,49 @@ class TaskDefinition(BaseModelResource):
52
184
  )
53
185
 
54
186
 
187
+ class FunctionTask(TaskDefinition):
188
+ type: Literal["function"] = "function"
189
+ parameters: FunctionTaskParameters
190
+
191
+
192
+ class TransformationTask(TaskDefinition):
193
+ type: Literal["transformation"] = "transformation"
194
+ parameters: TransformationTaskParameters
195
+
196
+
197
+ class CDFTask(TaskDefinition):
198
+ type: Literal["cdfRequest"] = "cdfRequest"
199
+ parameters: CDFTaskParameters
200
+
201
+
202
+ class DynamicTask(TaskDefinition):
203
+ type: Literal["dynamic"] = "dynamic"
204
+ parameters: DynamicTaskParameters
205
+
206
+
207
+ class SubworkflowTask(TaskDefinition):
208
+ type: Literal["subworkflow"] = "subworkflow"
209
+ parameters: SubworkflowTaskParameters
210
+
211
+
212
+ class SimulationTask(TaskDefinition):
213
+ type: Literal["simulation"] = "simulation"
214
+ parameters: SimulationTaskParameters
215
+
216
+
217
+ Task = Annotated[
218
+ FunctionTask | TransformationTask | CDFTask | DynamicTask | SubworkflowTask | SimulationTask,
219
+ Field(discriminator="type"),
220
+ ]
221
+
222
+
55
223
  class WorkflowDefinition(BaseModelResource):
56
224
  description: str | None = Field(
57
225
  default=None,
58
226
  max_length=500,
59
227
  description="The description of the workflow version.",
60
228
  )
61
- tasks: list[TaskDefinition]
229
+ tasks: list[Task]
62
230
 
63
231
 
64
232
  class WorkflowVersionYAML(ToolkitResource):
@@ -1,16 +1,25 @@
1
1
  from collections.abc import Iterable, Sequence
2
+ from itertools import zip_longest
2
3
  from typing import Any
3
4
 
5
+ from pydantic import JsonValue
6
+
4
7
  from cognite_toolkit._cdf_tk.client import ToolkitClient
5
- from cognite_toolkit._cdf_tk.client.data_classes.canvas import (
8
+ from cognite_toolkit._cdf_tk.client.http_client import (
9
+ HTTPClient,
10
+ HTTPMessage,
11
+ HTTPResult2,
12
+ RequestMessage2,
13
+ SuccessResponse2,
14
+ )
15
+ from cognite_toolkit._cdf_tk.client.resource_classes.legacy.canvas import (
6
16
  IndustrialCanvas,
7
17
  IndustrialCanvasApply,
8
18
  )
9
- from cognite_toolkit._cdf_tk.client.data_classes.charts import Chart, ChartList, ChartWrite
19
+ from cognite_toolkit._cdf_tk.client.resource_classes.legacy.charts import Chart, ChartList, ChartWrite
10
20
  from cognite_toolkit._cdf_tk.exceptions import ToolkitNotImplementedError
11
21
  from cognite_toolkit._cdf_tk.tk_warnings import HighSeverityWarning, MediumSeverityWarning
12
22
  from cognite_toolkit._cdf_tk.utils.collection import chunker_sequence
13
- from cognite_toolkit._cdf_tk.utils.http_client import HTTPClient, HTTPMessage, SimpleBodyRequest
14
23
  from cognite_toolkit._cdf_tk.utils.useful_types import JsonVal
15
24
 
16
25
  from ._base import Page, UploadableStorageIO, UploadItem
@@ -185,23 +194,52 @@ class CanvasIO(UploadableStorageIO[CanvasSelector, IndustrialCanvas, IndustrialC
185
194
  results: list[HTTPMessage] = []
186
195
  for item in data_chunk:
187
196
  instances = item.item.as_instances()
188
- items: list[dict[str, JsonVal]] = []
197
+ upsert_items: list[dict[str, JsonValue]] = []
189
198
  for instance in instances:
190
199
  dumped = instance.dump()
191
200
  if self.exclude_existing_version:
192
201
  dumped.pop("existingVersion", None)
193
- items.append(dumped)
194
-
195
- responses = http_client.request_with_retries(
196
- message=SimpleBodyRequest(
197
- endpoint_url=config.create_api_url("/models/instances"),
198
- method="POST",
199
- # MyPy does not understand that .dump is valid json
200
- body_content={"items": items}, # type: ignore[dict-item]
201
- )
202
- )
203
- results.extend(responses.as_item_responses(item.source_id))
202
+ upsert_items.append(dumped)
203
+
204
+ canvas = item.item.canvas
205
+ existing = self.client.canvas.industrial.retrieve(canvas.external_id)
206
+ if existing is not None:
207
+ existing_instance_ids = existing.as_write().as_instance_ids(include_solution_tags=False)
208
+ delete_set = set(existing_instance_ids) - set(item.item.as_instance_ids())
209
+ to_delete: list[Any] = [
210
+ {
211
+ "space": instance_id.space,
212
+ "externalId": instance_id.external_id,
213
+ "instanceType": instance_id.instance_type,
214
+ }
215
+ for instance_id in delete_set
216
+ ]
217
+ else:
218
+ to_delete = []
204
219
 
220
+ last_response: HTTPResult2 | None = None
221
+ for upsert_chunk, delete_chunk in zip_longest(
222
+ chunker_sequence(upsert_items, 1000), chunker_sequence(to_delete, 1000), fillvalue=None
223
+ ):
224
+ body_content: dict[str, JsonValue] = {}
225
+ if upsert_chunk:
226
+ # MyPy fails do understand that list[dict[str, JsonValue]] is a subtype of JsonValue
227
+ body_content["items"] = upsert_chunk # type: ignore[assignment]
228
+ if delete_chunk:
229
+ body_content["delete"] = delete_chunk
230
+
231
+ response = http_client.request_single_retries(
232
+ message=RequestMessage2(
233
+ endpoint_url=config.create_api_url("/models/instances"),
234
+ method="POST",
235
+ body_content=body_content,
236
+ )
237
+ )
238
+ if not isinstance(response, SuccessResponse2):
239
+ results.append(response.as_item_response(item.source_id))
240
+ last_response = response
241
+ if last_response is not None:
242
+ results.append(last_response.as_item_response(item.source_id))
205
243
  return results
206
244
 
207
245
  def data_to_json_chunk(