salesforce-data-customcode 6.0.1.dev1__py3-none-any.whl → 6.0.2__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.
datacustomcode/cli.py CHANGED
@@ -198,6 +198,7 @@ def zip(path: str, network: str):
198
198
  default=None,
199
199
  help="SF CLI org alias or username. Fetches credentials via `sf org display`.",
200
200
  )
201
+ @click.option("--use-in-feature", default=None, hidden=True, deprecated=True)
201
202
  def deploy(
202
203
  path: str,
203
204
  name: str,
@@ -207,6 +208,7 @@ def deploy(
207
208
  profile: str,
208
209
  network: str,
209
210
  sf_cli_org: Optional[str],
211
+ use_in_feature: Optional[str],
210
212
  ):
211
213
  from datacustomcode.constants import USE_IN_FEATURE_MAPPING_FOR_CONNECT_API
212
214
  from datacustomcode.deploy import (
@@ -249,13 +251,14 @@ def deploy(
249
251
  logger.info(f"Inferred use_in_feature: {use_in_feature}")
250
252
  else:
251
253
  click.secho(
252
- "Error: Could not infer function invoke options. "
253
- "Please provide --use-in-feature",
254
+ "Error: Function signature does not match a supported type. "
255
+ "Use SearchIndexChunkingV1Request and "
256
+ "SearchIndexChunkingV1Response in function signature.",
254
257
  fg="red",
255
258
  )
256
259
  raise click.Abort()
257
260
 
258
- # Map user-provided feature names to API names
261
+ # Map feature names to Connect API names
259
262
  mapped_feature = USE_IN_FEATURE_MAPPING_FOR_CONNECT_API.get(
260
263
  use_in_feature, use_in_feature
261
264
  )
@@ -27,11 +27,21 @@ if TYPE_CHECKING:
27
27
  class WriteMode(str, Enum):
28
28
  APPEND = "append"
29
29
  OVERWRITE = "overwrite"
30
- OVERWRITE_PARTITIONS = "overwrite_partitions"
30
+ OVERWRITE_PARTITIONS = "overwrite_partitions" # Deprecated: raises error if used
31
31
  MERGE = "merge"
32
32
  MERGE_UPSERT_DELETE = "merge_upsert_delete"
33
33
 
34
34
 
35
+ class MergeRecordType(str, Enum):
36
+ """Values for the _merge_record_type column used by MERGE_UPSERT_DELETE."""
37
+
38
+ UPSERT = "UPSERT"
39
+ DELETE = "DELETE"
40
+
41
+
42
+ MERGE_RECORD_TYPE_COLUMN = "_merge_record_type"
43
+
44
+
35
45
  class BaseDataCloudWriter(BaseDataAccessLayer):
36
46
  """Base class for Data Cloud writers."""
37
47
 
@@ -5,6 +5,6 @@
5
5
  "dockerfile": "../Dockerfile"
6
6
  },
7
7
  "features": {
8
- "ghcr.io/devcontainers/features/git:1": {},
8
+ "ghcr.io/devcontainers/features/git:1": {}
9
9
  }
10
10
  }
@@ -5,6 +5,6 @@
5
5
  "dockerfile": "../Dockerfile"
6
6
  },
7
7
  "features": {
8
- "ghcr.io/devcontainers/features/git:1": {},
8
+ "ghcr.io/devcontainers/features/git:1": {}
9
9
  }
10
10
  }
@@ -140,37 +140,44 @@ class SFCLITokenProvider(TokenProvider):
140
140
  )
141
141
  return dict(data)
142
142
 
143
- # Get instanceUrl from sf org display
143
+ # Get org info from sf org display
144
144
  display_data = _run_sf_command(
145
145
  ["sf", "org", "display", "--target-org", self.sf_cli_org, "--json"],
146
146
  "sf org display",
147
147
  )
148
- instance_url = display_data.get("result", {}).get("instanceUrl")
148
+ result_data = display_data.get("result", {})
149
+ instance_url = result_data.get("instanceUrl")
149
150
  if not instance_url:
150
151
  raise RuntimeError(
151
152
  f"'sf org display' did not return an instance URL "
152
153
  f"for org '{self.sf_cli_org}'"
153
154
  )
154
155
 
155
- # Get access token via show-access-token (newer SF CLI versions
156
- # redact the token in sf org display)
157
- token_data = _run_sf_command(
158
- [
159
- "sf",
160
- "org",
161
- "auth",
162
- "show-access-token",
163
- "--target-org",
164
- self.sf_cli_org,
165
- "--json",
166
- ],
167
- "sf org auth show-access-token",
168
- )
169
- access_token = token_data.get("result", {}).get("accessToken")
156
+ # Try show-access-token first (SF CLI >= 2.136.6); fall back to the
157
+ # token from sf org display (older CLIs don't redact it).
158
+ access_token = None
159
+ try:
160
+ token_data = _run_sf_command(
161
+ [
162
+ "sf",
163
+ "org",
164
+ "auth",
165
+ "show-access-token",
166
+ "--target-org",
167
+ self.sf_cli_org,
168
+ "--json",
169
+ ],
170
+ "sf org auth show-access-token",
171
+ )
172
+ access_token = token_data.get("result", {}).get("accessToken")
173
+ except RuntimeError:
174
+ # Command not available on older SF CLI versions
175
+ access_token = result_data.get("accessToken")
176
+
170
177
  if not access_token:
171
178
  raise RuntimeError(
172
- f"'sf org auth show-access-token' did not return an access token "
173
- f"for org '{self.sf_cli_org}'"
179
+ f"Could not obtain an access token for org '{self.sf_cli_org}'. "
180
+ f"Upgrade SF CLI to 2.136.6+ or ensure the org is authenticated."
174
181
  )
175
182
 
176
183
  return AccessTokenResponse(access_token=access_token, instance_url=instance_url)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: salesforce-data-customcode
3
- Version: 6.0.1.dev1
3
+ Version: 6.0.2
4
4
  Summary: Data Cloud Custom Code SDK
5
5
  License-Expression: Apache-2.0
6
6
  License-File: LICENSE.txt
@@ -1,6 +1,6 @@
1
1
  datacustomcode/__init__.py,sha256=Fj2pIYQqLV_kQrMywrYPj0NsMtHjx4tkvwyqSt-m0E0,1530
2
2
  datacustomcode/auth.py,sha256=fpSjhIBdv9trC8yq2vuljAix_Euu-4Ah7HDCGhYjOxI,8309
3
- datacustomcode/cli.py,sha256=ObqhOasZSZ8ZNFP6pywV3FpsUOz45_KaZdMNT4BHOKs,13069
3
+ datacustomcode/cli.py,sha256=i7hPoQqJskTmx3Odz2wVgkxBnf_PFaIawI12FXhaRUE,13264
4
4
  datacustomcode/client.py,sha256=TO9TkIsJjCEMlQMnD-NBGF26fk2K9jpOZjOT_XWKJ0g,9340
5
5
  datacustomcode/cmd.py,sha256=ZMs46aydJw2EaU26JgCtZmnqESQFHvvaJz10hnjZTBk,3537
6
6
  datacustomcode/common_config.py,sha256=SAUnxj3kqmOeWwPmFoYq4tuxokMgURVm4QwcGi-avL4,1928
@@ -34,7 +34,7 @@ datacustomcode/io/reader/query_api.py,sha256=eVrohrcnTnhSMsGfPRHu5XltjFtGG0hyHt1
34
34
  datacustomcode/io/reader/sf_cli.py,sha256=x5QacVqRZaZSyph1_wwxo67s8r29wsOcUsOaiF9cDWE,6324
35
35
  datacustomcode/io/reader/utils.py,sha256=HlHhPZoHfmWA3mF8kTnd3m4Nd2exaz4NsOJJfQY7Pew,1656
36
36
  datacustomcode/io/writer/__init__.py,sha256=gamfOD1VnAtEslRBpqh-yKiVjkG_wYWYdSatGIfsN-w,621
37
- datacustomcode/io/writer/base.py,sha256=RHafJ-Xmh_TnYcN4QfSh0VdIZeIevKmz9sf05adMgxA,1540
37
+ datacustomcode/io/writer/base.py,sha256=6e2Yszb6BiuN1zCV2rjvZ5CQ0YikQdUgdYAkutoy9pE,1787
38
38
  datacustomcode/io/writer/csv.py,sha256=asty5teBpNQ1fMGHZ7wA3suLhq0sk0lVQPN5x7TOSRk,1555
39
39
  datacustomcode/io/writer/print.py,sha256=0g2sP_1Wb95UIyEELWJt3dqM18Iv_CWhDW3mDxcIhns,5105
40
40
  datacustomcode/llm_gateway/__init__.py,sha256=xT7J9qZByD80WWk-835JcJSvQx8_NiX6qsBPhq7mU6k,800
@@ -59,7 +59,7 @@ datacustomcode/spark/base.py,sha256=tlGqM4LxuLoDa7OxJF5nVeb7phO5uvD1DHBQeH7NMMs,
59
59
  datacustomcode/spark/default.py,sha256=aMB8CaTPYwHbQE_7XqBLQUZPGRdDJcRL72qTVh0aG7M,1433
60
60
  datacustomcode/template.py,sha256=FNNi8YPfd-JB-hUt1DDWSFK5AqwKnTnRSy_KpqYluaU,3282
61
61
  datacustomcode/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
62
- datacustomcode/templates/function/.devcontainer/devcontainer.json,sha256=lWMFk-SdTKBlQt_VJrMn8gZPmvT4tfcjRpCNhLdElZc,167
62
+ datacustomcode/templates/function/.devcontainer/devcontainer.json,sha256=21RNTadhC-rynON2-VOtr5U174Hxnr_MA4RQ4592rsg,166
63
63
  datacustomcode/templates/function/Dockerfile.dependencies,sha256=AfHRddm5l3ujv4vdrf0d-SMB-qxPCOa0XQm6ptP2Euw,174
64
64
  datacustomcode/templates/function/README.md,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
65
65
  datacustomcode/templates/function/build_native_dependencies.sh,sha256=dk9vhzlObdsFAO5BtxP7ioOGDBM8JVwJHp_W0712Nlk,222
@@ -77,7 +77,7 @@ datacustomcode/templates/function/payload/config.json,sha256=RBNvo1WzZ4oRRq0W9-h
77
77
  datacustomcode/templates/function/payload/entrypoint.py,sha256=DrH73aAkU_ua6IHBRYr9SkMtX5pEFvNJYew8zXQL5TQ,5705
78
78
  datacustomcode/templates/function/requirements-dev.txt,sha256=qT2-m2FOgiYPTvqaNy0yRzIAXqHgR5b8stccYXsXVi8,88
79
79
  datacustomcode/templates/function/requirements.txt,sha256=qJbqzs5z0Hrx590U3T7dHq_m8UQEx2TdhgrJSz-QHIQ,40
80
- datacustomcode/templates/script/.devcontainer/devcontainer.json,sha256=lWMFk-SdTKBlQt_VJrMn8gZPmvT4tfcjRpCNhLdElZc,167
80
+ datacustomcode/templates/script/.devcontainer/devcontainer.json,sha256=21RNTadhC-rynON2-VOtr5U174Hxnr_MA4RQ4592rsg,166
81
81
  datacustomcode/templates/script/Dockerfile,sha256=l8HEy5X7BsW9Gi7rBYM6G2czwk-1832RRIos7xyFzpI,463
82
82
  datacustomcode/templates/script/Dockerfile.dependencies,sha256=vBbTfgcBkVQVCnrJZE_QEx89ddTQrLZGeyVTZXU8TI8,206
83
83
  datacustomcode/templates/script/README.md,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -90,10 +90,10 @@ datacustomcode/templates/script/payload/config.json,sha256=0d2mEMt4NHIeOUTsgiPMu
90
90
  datacustomcode/templates/script/payload/entrypoint.py,sha256=qpFA-jkhaYYF2CFNQ7_7MZVefU7SxnoMQIQYi7ox2dY,691
91
91
  datacustomcode/templates/script/requirements-dev.txt,sha256=OWwuy1awesqOZOS3Zizmdd6BDnSePpGFN5bq5IrALvc,176
92
92
  datacustomcode/templates/script/requirements.txt,sha256=qJbqzs5z0Hrx590U3T7dHq_m8UQEx2TdhgrJSz-QHIQ,40
93
- datacustomcode/token_provider.py,sha256=a16r5xYeCOPR3M3JKvEV7JVIG7DOzDswObRBI33MQOk,6461
93
+ datacustomcode/token_provider.py,sha256=kGPxdxGZEr6VFknW7jFb9P6wOvRaRo-sfdBN2cUjEZY,6792
94
94
  datacustomcode/version.py,sha256=9LlbVrzwBvut1L308QbwNBgxdQk5CrghH39JARVSxms,989
95
- salesforce_data_customcode-6.0.1.dev1.dist-info/METADATA,sha256=hY9RnrRP1waD27SGNUEOts2s7D4vpgm8M9a-Mvp9d_8,20167
96
- salesforce_data_customcode-6.0.1.dev1.dist-info/WHEEL,sha256=eY7nduwzv-ldUxpzbRlxwvC693Hg6PX8bWDjEHjZ_dk,88
97
- salesforce_data_customcode-6.0.1.dev1.dist-info/entry_points.txt,sha256=WpQ94UB7UuRCYGOLtJV3vAgm1tl7iVf43VYRWIuNu5Y,74
98
- salesforce_data_customcode-6.0.1.dev1.dist-info/licenses/LICENSE.txt,sha256=iOi8EmQpfkFhMENi7VYtkl2EqS14pEOccoXHiW2dyPU,11443
99
- salesforce_data_customcode-6.0.1.dev1.dist-info/RECORD,,
95
+ salesforce_data_customcode-6.0.2.dist-info/METADATA,sha256=5VE2LhqzlGE8-BNLoPZM5qqtYnteWP776xC2XK7GGFE,20162
96
+ salesforce_data_customcode-6.0.2.dist-info/WHEEL,sha256=eY7nduwzv-ldUxpzbRlxwvC693Hg6PX8bWDjEHjZ_dk,88
97
+ salesforce_data_customcode-6.0.2.dist-info/entry_points.txt,sha256=WpQ94UB7UuRCYGOLtJV3vAgm1tl7iVf43VYRWIuNu5Y,74
98
+ salesforce_data_customcode-6.0.2.dist-info/licenses/LICENSE.txt,sha256=iOi8EmQpfkFhMENi7VYtkl2EqS14pEOccoXHiW2dyPU,11443
99
+ salesforce_data_customcode-6.0.2.dist-info/RECORD,,