@better-update/cli 0.15.1 → 0.15.2

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.
package/dist/index.mjs CHANGED
@@ -28,7 +28,7 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
28
28
 
29
29
  //#endregion
30
30
  //#region package.json
31
- var version = "0.15.1";
31
+ var version = "0.15.2";
32
32
 
33
33
  //#endregion
34
34
  //#region src/lib/interactive-mode.ts
@@ -5905,6 +5905,50 @@ const generateAndUploadProvisioningProfileViaAppleId = (api, input) => Effect.ge
5905
5905
  };
5906
5906
  });
5907
5907
 
5908
+ //#endregion
5909
+ //#region src/lib/ios-bundle-config-upsert.ts
5910
+ /**
5911
+ * Idempotent bind for an iOS bundle configuration. When the row already exists
5912
+ * (e.g. orphaned after a cert was deleted, since the FK is `ON DELETE SET NULL`),
5913
+ * rebind cert + profile in place instead of failing on the unique constraint.
5914
+ * Mirrors EAS's setup behavior where the setup step is rerunnable.
5915
+ */
5916
+ const upsertIosBundleConfiguration = (api, input) => Effect.gen(function* () {
5917
+ const existing = (yield* api.iosBundleConfigurations.list({ path: { projectId: input.projectId } })).items.find((item) => item.bundleIdentifier === input.bundleIdentifier && item.distributionType === input.distributionType);
5918
+ if (existing === void 0) {
5919
+ yield* api.iosBundleConfigurations.create({
5920
+ path: { projectId: input.projectId },
5921
+ payload: {
5922
+ bundleIdentifier: input.bundleIdentifier,
5923
+ distributionType: input.distributionType,
5924
+ appleTeamId: input.appleTeamId,
5925
+ appleDistributionCertificateId: input.appleDistributionCertificateId,
5926
+ appleProvisioningProfileId: input.appleProvisioningProfileId,
5927
+ ...input.ascApiKeyId === void 0 ? {} : { ascApiKeyId: input.ascApiKeyId }
5928
+ }
5929
+ });
5930
+ yield* Console.log("iOS bundle configuration saved.");
5931
+ return { action: "created" };
5932
+ }
5933
+ if (existing.appleTeamId !== input.appleTeamId) return yield* new MissingCredentialsError({
5934
+ message: `Bundle "${input.bundleIdentifier}" (${input.distributionType}) is already bound to a different Apple team than the new credentials.`,
5935
+ hint: "Delete the existing bundle configuration via the dashboard before retrying with a different team."
5936
+ });
5937
+ yield* api.iosBundleConfigurations.update({
5938
+ path: { id: existing.id },
5939
+ payload: {
5940
+ appleDistributionCertificateId: input.appleDistributionCertificateId,
5941
+ appleProvisioningProfileId: input.appleProvisioningProfileId,
5942
+ ...input.ascApiKeyId === void 0 ? {} : { ascApiKeyId: input.ascApiKeyId }
5943
+ }
5944
+ });
5945
+ yield* Console.log("iOS bundle configuration rebound.");
5946
+ return {
5947
+ action: "updated",
5948
+ id: existing.id
5949
+ };
5950
+ });
5951
+
5908
5952
  //#endregion
5909
5953
  //#region src/application/credentials-interactive-apple-id.ts
5910
5954
  const chooseIosSetupPath = (api) => Effect.gen(function* () {
@@ -5987,17 +6031,14 @@ const setupIosViaAppleId = (api, input) => Effect.gen(function* () {
5987
6031
  bundleIdentifier: input.bundleIdentifier,
5988
6032
  distributionType
5989
6033
  });
5990
- yield* api.iosBundleConfigurations.create({
5991
- path: { projectId: input.projectId },
5992
- payload: {
5993
- bundleIdentifier: input.bundleIdentifier,
5994
- distributionType,
5995
- appleTeamId: cert.appleTeamId,
5996
- appleDistributionCertificateId: cert.id,
5997
- appleProvisioningProfileId: profile.id
5998
- }
6034
+ yield* upsertIosBundleConfiguration(api, {
6035
+ projectId: input.projectId,
6036
+ bundleIdentifier: input.bundleIdentifier,
6037
+ distributionType,
6038
+ appleTeamId: cert.appleTeamId,
6039
+ appleDistributionCertificateId: cert.id,
6040
+ appleProvisioningProfileId: profile.id
5999
6041
  });
6000
- yield* Console.log("iOS bundle configuration saved.");
6001
6042
  });
6002
6043
  const regenerateProvisioningProfileViaAppleId = (api, input) => Effect.gen(function* () {
6003
6044
  const auth = yield* AppleAuth;
@@ -6130,18 +6171,15 @@ const setupIosViaAscKey = (api, input) => Effect.gen(function* () {
6130
6171
  ascKeyId,
6131
6172
  distributionType
6132
6173
  });
6133
- yield* api.iosBundleConfigurations.create({
6134
- path: { projectId: input.projectId },
6135
- payload: {
6136
- bundleIdentifier: input.bundleIdentifier,
6137
- distributionType,
6138
- appleTeamId: cert.appleTeamId,
6139
- appleDistributionCertificateId: certId,
6140
- appleProvisioningProfileId: profileId,
6141
- ascApiKeyId: ascKeyId
6142
- }
6174
+ yield* upsertIosBundleConfiguration(api, {
6175
+ projectId: input.projectId,
6176
+ bundleIdentifier: input.bundleIdentifier,
6177
+ distributionType,
6178
+ appleTeamId: cert.appleTeamId,
6179
+ appleDistributionCertificateId: certId,
6180
+ appleProvisioningProfileId: profileId,
6181
+ ascApiKeyId: ascKeyId
6143
6182
  });
6144
- yield* Console.log("iOS bundle configuration saved.");
6145
6183
  });
6146
6184
 
6147
6185
  //#endregion