@hot-updater/firebase 1.0.0-rc.2 → 1.0.0-rc.4

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.
@@ -6,7 +6,7 @@ let firebase_admin_firestore = require("firebase-admin/firestore");
6
6
  let firebase_admin_storage = require("firebase-admin/storage");
7
7
  //#endregion
8
8
  //#region ../../packages/server/dist/version.mjs
9
- const HOT_UPDATER_SERVER_VERSION = "1.0.0-rc.2";
9
+ const HOT_UPDATER_SERVER_VERSION = "1.0.0-rc.3";
10
10
  //#endregion
11
11
  //#region ../../packages/server/dist/handlerVersionRoutes.mjs
12
12
  const createVersionRouteHandlers = () => ({ version: async () => Response.json({
@@ -809,7 +809,7 @@ const modelValidators = {
809
809
  },
810
810
  bundle_events: {
811
811
  id: (value) => typeof value === "string",
812
- type: (value) => value === "UPDATE_APPLIED" || value === "RECOVERED" || value === "RELEASE_ADOPTED" || value === "UNCHANGED",
812
+ type: (value) => value === "UPDATE_APPLIED" || value === "RECOVERED" || value === "UNCHANGED",
813
813
  install_id: isInsightsIdentityText,
814
814
  user_id: isNullableInsightsIdentityText,
815
815
  username: (value) => value === null || typeof value === "string",
@@ -832,7 +832,7 @@ const modelValidators = {
832
832
  user_id: isNullableInsightsIdentityText,
833
833
  username: (value) => value === null || typeof value === "string",
834
834
  to_bundle_id: (value) => typeof value === "string",
835
- type: (value) => value === "UPDATE_APPLIED" || value === "RECOVERED" || value === "RELEASE_ADOPTED" || value === "UNCHANGED",
835
+ type: (value) => value === "UPDATE_APPLIED" || value === "RECOVERED" || value === "UNCHANGED",
836
836
  platform: (value) => value === "ios" || value === "android",
837
837
  app_version: (value) => typeof value === "string",
838
838
  channel: (value) => typeof value === "string",
@@ -1035,7 +1035,7 @@ const hasValidReleaseInvariants = (data) => {
1035
1035
  const fingerprintHash = data.fingerprint_hash;
1036
1036
  return (kind === "BUNDLE" && typeof bundleId === "string" || kind === "EMBEDDED" && bundleId === null) && (strategy === "APP_VERSION" && typeof targetAppVersion === "string" && fingerprintHash === null || strategy === "FINGERPRINT" && targetAppVersion === null && typeof fingerprintHash === "string");
1037
1037
  };
1038
- const hasValidBundleEventInvariants = (data) => (data.type === "UPDATE_APPLIED" || data.type === "RECOVERED" || data.type === "RELEASE_ADOPTED") && typeof data.from_bundle_id === "string" && (data.update_strategy === "fingerprint" || data.update_strategy === "appVersion") || data.type === "UNCHANGED" && data.from_bundle_id === null && data.update_strategy === null;
1038
+ const hasValidBundleEventInvariants = (data) => (data.type === "UPDATE_APPLIED" || data.type === "RECOVERED") && typeof data.from_bundle_id === "string" && (data.update_strategy === "fingerprint" || data.update_strategy === "appVersion") || data.type === "UNCHANGED" && data.from_bundle_id === null && data.update_strategy === null;
1039
1039
  const validateCreateData = (model, data) => {
1040
1040
  if (!isRecord$3(data)) throw new DatabasePluginInputError("invalid-data");
1041
1041
  validateFields(model, Object.keys(data));
@@ -1105,7 +1105,7 @@ const isBundleFilter = (value, withKind = false) => {
1105
1105
  "type",
1106
1106
  ...withKind ? ["kind"] : []
1107
1107
  ];
1108
- return value.type === "RECOVERED" ? isText(value.fromBundleId) && hasOnlyKeys$1(value, [...keys, "fromBundleId"]) : (value.type === "UPDATE_APPLIED" || value.type === "RELEASE_ADOPTED") && isText(value.toBundleId) && hasOnlyKeys$1(value, [...keys, "toBundleId"]);
1108
+ return value.type === "RECOVERED" ? isText(value.fromBundleId) && hasOnlyKeys$1(value, [...keys, "fromBundleId"]) : (value.type === "UPDATE_APPLIED" || value.type === "UNCHANGED") && isText(value.toBundleId) && hasOnlyKeys$1(value, [...keys, "toBundleId"]);
1109
1109
  };
1110
1110
  const isEventFilter = (value) => {
1111
1111
  if (!isRecord$3(value)) return false;
@@ -1139,7 +1139,7 @@ const toInsightsInstallationRow = (event) => {
1139
1139
  received_at_ms: event.received_at_ms
1140
1140
  };
1141
1141
  };
1142
- /** Release adoption and unchanged lifecycle reports are not bundle movements. */
1142
+ /** Unchanged reports are not bundle movements. */
1143
1143
  const isInsightsMovementEvent = (event) => event.type === "UPDATE_APPLIED" || event.type === "RECOVERED";
1144
1144
  const matchesInsightsEventFilter = (event, filter) => {
1145
1145
  if (filter.kind === "all") return true;
@@ -4172,8 +4172,7 @@ function requireEvent(payload) {
4172
4172
  const type = requireStringField(payload, "type");
4173
4173
  switch (type) {
4174
4174
  case "UPDATE_APPLIED":
4175
- case "RECOVERED":
4176
- case "RELEASE_ADOPTED": {
4175
+ case "RECOVERED": {
4177
4176
  const updateStrategy = requireStringField(payload, "updateStrategy");
4178
4177
  if (updateStrategy !== "fingerprint" && updateStrategy !== "appVersion") throw new InsightsBadRequestError("Invalid event field: updateStrategy");
4179
4178
  return {
@@ -4217,8 +4216,7 @@ function createBundleEventRow(input) {
4217
4216
  };
4218
4217
  switch (input.type) {
4219
4218
  case "UPDATE_APPLIED":
4220
- case "RECOVERED":
4221
- case "RELEASE_ADOPTED": return {
4219
+ case "RECOVERED": return {
4222
4220
  ...base,
4223
4221
  from_bundle_id: input.fromBundleId,
4224
4222
  type: input.type,
@@ -4285,7 +4283,7 @@ const parseEventPageInput = (request) => {
4285
4283
  let bundle;
4286
4284
  if (bundleFields.some((key) => url.searchParams.has(key))) {
4287
4285
  const outcome = readSingle(url, "outcome");
4288
- if (outcome !== "applied" && outcome !== "recovered" && outcome !== "adopted") throw new InsightsBadRequestError("Invalid 'outcome' query parameter.");
4286
+ if (outcome !== "applied" && outcome !== "recovered" && outcome !== "unchanged") throw new InsightsBadRequestError("Invalid 'outcome' query parameter.");
4289
4287
  bundle = {
4290
4288
  ...readScope$1(url),
4291
4289
  bundleId: readId(url, "bundleId", 1024),
@@ -4606,9 +4604,9 @@ const bundleFilter = (input) => {
4606
4604
  type: "RECOVERED",
4607
4605
  fromBundleId: bundleId
4608
4606
  };
4609
- case "adopted": return {
4607
+ case "unchanged": return {
4610
4608
  ...scope,
4611
- type: "RELEASE_ADOPTED",
4609
+ type: "UNCHANGED",
4612
4610
  toBundleId: bundleId
4613
4611
  };
4614
4612
  default: throw new InsightsBadRequestError("Invalid Insights outcome.");
@@ -4815,7 +4813,7 @@ const createInsightsProvider = (model) => Object.freeze({
4815
4813
  sinceMs,
4816
4814
  beforeReceivedAtMs
4817
4815
  }));
4818
- const [reportingInstallations, bundleInstallations, appliedReports, recoveredReports, adoptedReports] = await Promise.all([
4816
+ const [reportingInstallations, bundleInstallations, appliedReports, recoveredReports, unchangedReports] = await Promise.all([
4819
4817
  reporting,
4820
4818
  measure(model.countInstallations({
4821
4819
  ...scope,
@@ -4824,7 +4822,7 @@ const createInsightsProvider = (model) => Object.freeze({
4824
4822
  })),
4825
4823
  countOutcome("applied"),
4826
4824
  countOutcome("recovered"),
4827
- countOutcome("adopted")
4825
+ countOutcome("unchanged")
4828
4826
  ]);
4829
4827
  return {
4830
4828
  ...scope,
@@ -4837,7 +4835,7 @@ const createInsightsProvider = (model) => Object.freeze({
4837
4835
  reportingInstallations: bundleInstallations,
4838
4836
  appliedReports,
4839
4837
  recoveredReports,
4840
- adoptedReports
4838
+ unchangedReports
4841
4839
  }
4842
4840
  };
4843
4841
  }
@@ -5635,7 +5633,7 @@ const parseFirebaseBundleEventRow = (value, source) => {
5635
5633
  const type = string(property(input, "type"), source);
5636
5634
  const fromBundleId = requiredNullableString(input, "from_bundle_id", source);
5637
5635
  const updateStrategy = requiredNullableString(input, "update_strategy", source);
5638
- if (!((type === "UPDATE_APPLIED" || type === "RECOVERED" || type === "RELEASE_ADOPTED") && typeof fromBundleId === "string" && (updateStrategy === "fingerprint" || updateStrategy === "appVersion") || type === "UNCHANGED" && fromBundleId === null && updateStrategy === null)) throw new FirebaseDatabaseDataError(source);
5636
+ if (!((type === "UPDATE_APPLIED" || type === "RECOVERED") && typeof fromBundleId === "string" && (updateStrategy === "fingerprint" || updateStrategy === "appVersion") || type === "UNCHANGED" && fromBundleId === null && updateStrategy === null)) throw new FirebaseDatabaseDataError(source);
5639
5637
  return {
5640
5638
  id: string(property(input, "id"), source),
5641
5639
  type,
@@ -5659,7 +5657,7 @@ const parseFirebaseBundleEventRow = (value, source) => {
5659
5657
  const parseFirebaseInsightsInstallationRow = (value, source) => {
5660
5658
  const input = record(value, source);
5661
5659
  const type = string(property(input, "type"), source);
5662
- if (type !== "UPDATE_APPLIED" && type !== "RECOVERED" && type !== "RELEASE_ADOPTED" && type !== "UNCHANGED") throw new FirebaseDatabaseDataError(source);
5660
+ if (type !== "UPDATE_APPLIED" && type !== "RECOVERED" && type !== "UNCHANGED") throw new FirebaseDatabaseDataError(source);
5663
5661
  return {
5664
5662
  id: string(property(input, "id"), source),
5665
5663
  type,
@@ -6866,7 +6866,7 @@ const parseFirebaseBundleEventRow = (value, source) => {
6866
6866
  const type = string(property(input, "type"), source);
6867
6867
  const fromBundleId = requiredNullableString(input, "from_bundle_id", source);
6868
6868
  const updateStrategy = requiredNullableString(input, "update_strategy", source);
6869
- if (!((type === "UPDATE_APPLIED" || type === "RECOVERED" || type === "RELEASE_ADOPTED") && typeof fromBundleId === "string" && (updateStrategy === "fingerprint" || updateStrategy === "appVersion") || type === "UNCHANGED" && fromBundleId === null && updateStrategy === null)) throw new FirebaseDatabaseDataError(source);
6869
+ if (!((type === "UPDATE_APPLIED" || type === "RECOVERED") && typeof fromBundleId === "string" && (updateStrategy === "fingerprint" || updateStrategy === "appVersion") || type === "UNCHANGED" && fromBundleId === null && updateStrategy === null)) throw new FirebaseDatabaseDataError(source);
6870
6870
  return {
6871
6871
  id: string(property(input, "id"), source),
6872
6872
  type,
@@ -6890,7 +6890,7 @@ const parseFirebaseBundleEventRow = (value, source) => {
6890
6890
  const parseFirebaseInsightsInstallationRow = (value, source) => {
6891
6891
  const input = record(value, source);
6892
6892
  const type = string(property(input, "type"), source);
6893
- if (type !== "UPDATE_APPLIED" && type !== "RECOVERED" && type !== "RELEASE_ADOPTED" && type !== "UNCHANGED") throw new FirebaseDatabaseDataError(source);
6893
+ if (type !== "UPDATE_APPLIED" && type !== "RECOVERED" && type !== "UNCHANGED") throw new FirebaseDatabaseDataError(source);
6894
6894
  return {
6895
6895
  id: string(property(input, "id"), source),
6896
6896
  type,
@@ -7971,7 +7971,7 @@ const prepareFirebaseTemplate = async (firebaseRootDir) => {
7971
7971
  };
7972
7972
  };
7973
7973
  //#endregion
7974
- //#region iac/select.ts
7974
+ //#region iac/configTemplate.ts
7975
7975
  const getConfigScaffold = (build) => {
7976
7976
  const storageConfig = {
7977
7977
  imports: [{
@@ -7999,9 +7999,9 @@ const getConfigScaffold = (build) => {
7999
7999
  strategy: "preserve-existing",
8000
8000
  code: `
8001
8001
  // https://firebase.google.com/docs/admin/setup?hl=en#initialize_the_sdk_in_non-google_environments
8002
- // Check your .env.hotupdater file and add the credentials
8003
- // Set the GOOGLE_APPLICATION_CREDENTIALS environment variable to your credentials file path
8004
- // Example: GOOGLE_APPLICATION_CREDENTIALS=./firebase-adminsdk-credentials.json
8002
+ // Reuse working application-default credentials (ADC).
8003
+ // Only when a credential file is needed, set its private local path in .env.hotupdater:
8004
+ // GOOGLE_APPLICATION_CREDENTIALS=./firebase-adminsdk-credentials.json
8005
8005
  const credential = applicationDefault();`.trim()
8006
8006
  }];
8007
8007
  const builder = new _hot_updater_cli_tools.ConfigBuilder().setBuildType(build).setStorage(storageConfig).setDatabase(databaseConfig).addImport({
@@ -8010,6 +8010,8 @@ const credential = applicationDefault();`.trim()
8010
8010
  }).setIntermediateCode(helperStatements.map((statement) => statement.code.trim()).join("\n\n"));
8011
8011
  return (0, _hot_updater_cli_tools.createHotUpdaterConfigScaffoldFromBuilder)(builder, { helperStatements });
8012
8012
  };
8013
+ //#endregion
8014
+ //#region iac/select.ts
8013
8015
  const setEnv = async ({ applicationCredentials, projectId, storageBucket, build, region }) => {
8014
8016
  await (0, _hot_updater_cli_tools.makeEnv)({
8015
8017
  [initProvider.inputs.applicationCredentials.envKey]: {
@@ -6859,7 +6859,7 @@ const parseFirebaseBundleEventRow = (value, source) => {
6859
6859
  const type = string(property(input, "type"), source);
6860
6860
  const fromBundleId = requiredNullableString(input, "from_bundle_id", source);
6861
6861
  const updateStrategy = requiredNullableString(input, "update_strategy", source);
6862
- if (!((type === "UPDATE_APPLIED" || type === "RECOVERED" || type === "RELEASE_ADOPTED") && typeof fromBundleId === "string" && (updateStrategy === "fingerprint" || updateStrategy === "appVersion") || type === "UNCHANGED" && fromBundleId === null && updateStrategy === null)) throw new FirebaseDatabaseDataError(source);
6862
+ if (!((type === "UPDATE_APPLIED" || type === "RECOVERED") && typeof fromBundleId === "string" && (updateStrategy === "fingerprint" || updateStrategy === "appVersion") || type === "UNCHANGED" && fromBundleId === null && updateStrategy === null)) throw new FirebaseDatabaseDataError(source);
6863
6863
  return {
6864
6864
  id: string(property(input, "id"), source),
6865
6865
  type,
@@ -6883,7 +6883,7 @@ const parseFirebaseBundleEventRow = (value, source) => {
6883
6883
  const parseFirebaseInsightsInstallationRow = (value, source) => {
6884
6884
  const input = record(value, source);
6885
6885
  const type = string(property(input, "type"), source);
6886
- if (type !== "UPDATE_APPLIED" && type !== "RECOVERED" && type !== "RELEASE_ADOPTED" && type !== "UNCHANGED") throw new FirebaseDatabaseDataError(source);
6886
+ if (type !== "UPDATE_APPLIED" && type !== "RECOVERED" && type !== "UNCHANGED") throw new FirebaseDatabaseDataError(source);
6887
6887
  return {
6888
6888
  id: string(property(input, "id"), source),
6889
6889
  type,
@@ -7964,7 +7964,7 @@ const prepareFirebaseTemplate = async (firebaseRootDir) => {
7964
7964
  };
7965
7965
  };
7966
7966
  //#endregion
7967
- //#region iac/select.ts
7967
+ //#region iac/configTemplate.ts
7968
7968
  const getConfigScaffold = (build) => {
7969
7969
  const storageConfig = {
7970
7970
  imports: [{
@@ -7992,9 +7992,9 @@ const getConfigScaffold = (build) => {
7992
7992
  strategy: "preserve-existing",
7993
7993
  code: `
7994
7994
  // https://firebase.google.com/docs/admin/setup?hl=en#initialize_the_sdk_in_non-google_environments
7995
- // Check your .env.hotupdater file and add the credentials
7996
- // Set the GOOGLE_APPLICATION_CREDENTIALS environment variable to your credentials file path
7997
- // Example: GOOGLE_APPLICATION_CREDENTIALS=./firebase-adminsdk-credentials.json
7995
+ // Reuse working application-default credentials (ADC).
7996
+ // Only when a credential file is needed, set its private local path in .env.hotupdater:
7997
+ // GOOGLE_APPLICATION_CREDENTIALS=./firebase-adminsdk-credentials.json
7998
7998
  const credential = applicationDefault();`.trim()
7999
7999
  }];
8000
8000
  const builder = new ConfigBuilder().setBuildType(build).setStorage(storageConfig).setDatabase(databaseConfig).addImport({
@@ -8003,6 +8003,8 @@ const credential = applicationDefault();`.trim()
8003
8003
  }).setIntermediateCode(helperStatements.map((statement) => statement.code.trim()).join("\n\n"));
8004
8004
  return createHotUpdaterConfigScaffoldFromBuilder(builder, { helperStatements });
8005
8005
  };
8006
+ //#endregion
8007
+ //#region iac/select.ts
8006
8008
  const setEnv = async ({ applicationCredentials, projectId, storageBucket, build, region }) => {
8007
8009
  await makeEnv({
8008
8010
  [initProvider.inputs.applicationCredentials.envKey]: {
package/dist/index.cjs CHANGED
@@ -97,7 +97,7 @@ const parseFirebaseBundleEventRow = (value, source) => {
97
97
  const type = string(property(input, "type"), source);
98
98
  const fromBundleId = requiredNullableString(input, "from_bundle_id", source);
99
99
  const updateStrategy = requiredNullableString(input, "update_strategy", source);
100
- if (!((type === "UPDATE_APPLIED" || type === "RECOVERED" || type === "RELEASE_ADOPTED") && typeof fromBundleId === "string" && (updateStrategy === "fingerprint" || updateStrategy === "appVersion") || type === "UNCHANGED" && fromBundleId === null && updateStrategy === null)) throw new FirebaseDatabaseDataError(source);
100
+ if (!((type === "UPDATE_APPLIED" || type === "RECOVERED") && typeof fromBundleId === "string" && (updateStrategy === "fingerprint" || updateStrategy === "appVersion") || type === "UNCHANGED" && fromBundleId === null && updateStrategy === null)) throw new FirebaseDatabaseDataError(source);
101
101
  return {
102
102
  id: string(property(input, "id"), source),
103
103
  type,
@@ -121,7 +121,7 @@ const parseFirebaseBundleEventRow = (value, source) => {
121
121
  const parseFirebaseInsightsInstallationRow = (value, source) => {
122
122
  const input = record(value, source);
123
123
  const type = string(property(input, "type"), source);
124
- if (type !== "UPDATE_APPLIED" && type !== "RECOVERED" && type !== "RELEASE_ADOPTED" && type !== "UNCHANGED") throw new FirebaseDatabaseDataError(source);
124
+ if (type !== "UPDATE_APPLIED" && type !== "RECOVERED" && type !== "UNCHANGED") throw new FirebaseDatabaseDataError(source);
125
125
  return {
126
126
  id: string(property(input, "id"), source),
127
127
  type,
package/dist/index.mjs CHANGED
@@ -96,7 +96,7 @@ const parseFirebaseBundleEventRow = (value, source) => {
96
96
  const type = string(property(input, "type"), source);
97
97
  const fromBundleId = requiredNullableString(input, "from_bundle_id", source);
98
98
  const updateStrategy = requiredNullableString(input, "update_strategy", source);
99
- if (!((type === "UPDATE_APPLIED" || type === "RECOVERED" || type === "RELEASE_ADOPTED") && typeof fromBundleId === "string" && (updateStrategy === "fingerprint" || updateStrategy === "appVersion") || type === "UNCHANGED" && fromBundleId === null && updateStrategy === null)) throw new FirebaseDatabaseDataError(source);
99
+ if (!((type === "UPDATE_APPLIED" || type === "RECOVERED") && typeof fromBundleId === "string" && (updateStrategy === "fingerprint" || updateStrategy === "appVersion") || type === "UNCHANGED" && fromBundleId === null && updateStrategy === null)) throw new FirebaseDatabaseDataError(source);
100
100
  return {
101
101
  id: string(property(input, "id"), source),
102
102
  type,
@@ -120,7 +120,7 @@ const parseFirebaseBundleEventRow = (value, source) => {
120
120
  const parseFirebaseInsightsInstallationRow = (value, source) => {
121
121
  const input = record(value, source);
122
122
  const type = string(property(input, "type"), source);
123
- if (type !== "UPDATE_APPLIED" && type !== "RECOVERED" && type !== "RELEASE_ADOPTED" && type !== "UNCHANGED") throw new FirebaseDatabaseDataError(source);
123
+ if (type !== "UPDATE_APPLIED" && type !== "RECOVERED" && type !== "UNCHANGED") throw new FirebaseDatabaseDataError(source);
124
124
  return {
125
125
  id: string(property(input, "id"), source),
126
126
  type,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/firebase",
3
3
  "type": "module",
4
- "version": "1.0.0-rc.2",
4
+ "version": "1.0.0-rc.4",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "main": "dist/index.cjs",
7
7
  "types": "dist/index.d.cts",
@@ -43,10 +43,10 @@
43
43
  ],
44
44
  "dependencies": {
45
45
  "hono": "4.12.34",
46
- "@hot-updater/cli-tools": "1.0.0-rc.2",
46
+ "@hot-updater/cli-tools": "1.0.0-rc.3",
47
+ "@hot-updater/plugin-core": "1.0.0-rc.3",
47
48
  "@hot-updater/core": "1.0.0-rc.0",
48
- "@hot-updater/plugin-core": "1.0.0-rc.2",
49
- "@hot-updater/server": "1.0.0-rc.2"
49
+ "@hot-updater/server": "1.0.0-rc.3"
50
50
  },
51
51
  "publishConfig": {
52
52
  "access": "public"
@@ -61,8 +61,8 @@
61
61
  "firebase-tools": "^13.32.0",
62
62
  "fkill": "^9.0.0",
63
63
  "mime": "^4.0.4",
64
- "@hot-updater/mock": "1.0.0-rc.2",
65
- "@hot-updater/test-utils": "1.0.0-rc.2"
64
+ "@hot-updater/mock": "1.0.0-rc.3",
65
+ "@hot-updater/test-utils": "1.0.0-rc.3"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "firebase-admin": "*",