@ductape/sdk 0.1.155 → 0.1.156

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.
@@ -2700,27 +2700,31 @@ class ProductsBuilderService {
2700
2700
  if (!appEnv) {
2701
2701
  throw new Error(`app_slug ${env.app_env_slug} not found`);
2702
2702
  }
2703
- // const updates = this.validateAppAuth(auth, version);
2703
+ const updates = auth ? this.validateAppAuth(auth, version) : null;
2704
2704
  this.validateVariablesSchema(env.variables, version.variables, appEnv.base_url_variables);
2705
2705
  this.validateVariablesValues(env.variables, version.variables);
2706
2706
  this.validateBaseUrlVariablesRequired(env.variables, appEnv.base_url_variables);
2707
- /*if (updates && updates.data) {
2708
- env.auth.data = updates.data;
2707
+ if (updates && updates.data && env.auth) {
2708
+ env.auth.data = updates.data;
2709
+ }
2710
+ if (updates && updates.values && env.auth) {
2711
+ env.auth.values = updates.values;
2709
2712
  }
2710
-
2711
- if (updates && updates.values) {
2712
- env.auth.values = updates.values;
2713
- }*/
2714
2713
  return env;
2715
2714
  });
2716
2715
  }
2717
2716
  validateAppAuth(auth, version) {
2717
+ var _a;
2718
2718
  const { auths: appAuth, actions } = version;
2719
2719
  const exists = appAuth.find((appAuth) => appAuth.tag === auth.auth_tag);
2720
2720
  if (!exists) {
2721
2721
  throw new Error(`app_auth ${auth.auth_tag} not found`);
2722
2722
  }
2723
2723
  const { data } = auth;
2724
+ // Existing mappings are already encrypted. Updates that do not replace auth
2725
+ // must preserve the ciphertext instead of attempting to validate/encrypt it again.
2726
+ if (typeof data === 'string')
2727
+ return { data, values: (_a = auth.values) !== null && _a !== void 0 ? _a : null };
2724
2728
  let bodySchema;
2725
2729
  let headerSchema;
2726
2730
  let paramsSchema;