heartraite 1.0.6 → 1.0.8

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.
@@ -0,0 +1,4 @@
1
+ export declare class FirebaseAuthException extends Error {
2
+ code: string;
3
+ constructor(code: string);
4
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FirebaseAuthException = void 0;
4
+ class FirebaseAuthException extends Error {
5
+ constructor(code) {
6
+ super();
7
+ this.code = code;
8
+ this.name = "FirebaseAuthException";
9
+ // Mapping of Firebase error codes to human-readable messages
10
+ const errorMapping = {
11
+ "auth/invalid-email": "The email address is invalid.",
12
+ "auth/email-already-exists": "This email is already in use.",
13
+ "auth/invalid-password": "The password is invalid. Please ensure it meets the requirements.",
14
+ "auth/operation-not-allowed": "Email/password accounts are disabled. Please contact support.",
15
+ "auth/user-not-found": "No user found with the provided credentials.",
16
+ "auth/wrong-password": "The password provided is incorrect.",
17
+ "auth/too-many-requests": "Too many requests have been made. Please try again later.",
18
+ };
19
+ // Set default message for unknown codes
20
+ this.message = errorMapping[code] || "An unexpected error occurred.";
21
+ }
22
+ }
23
+ exports.FirebaseAuthException = FirebaseAuthException;
@@ -0,0 +1 @@
1
+ export * from "./auth.exceptions";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./auth.exceptions"), exports);
@@ -110,7 +110,9 @@ export type GetUserRequest = undefined;
110
110
  export type UpdateUserRequest = {
111
111
  profile?: DeepPartial<UserProfile>;
112
112
  preferences?: DeepPartial<DatingPreferences>;
113
- notifications?: DeepPartial<UserNotifications>;
113
+ notifications?: DeepPartial<UserNotifications & {
114
+ expoPushToken?: Partial<string>;
115
+ }>;
114
116
  };
115
117
  export type AddImagesRequest = {
116
118
  images: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "heartraite",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "Heartraite npm package for common functionality",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,7 +8,7 @@
8
8
  "scripts": {
9
9
  "test": "jest",
10
10
  "build": "tsc",
11
- "prepublishOnly": "npm run build"
11
+ "prepublishOnly": "node version-bump.js && npm run build"
12
12
  },
13
13
  "repository": {
14
14
  "type": "git",
@@ -28,4 +28,4 @@
28
28
  "typescript": "^5.6.3",
29
29
  "firebase": "^11.0.1"
30
30
  }
31
- }
31
+ }
@@ -112,7 +112,9 @@ export type GetUserRequest = undefined;
112
112
  export type UpdateUserRequest = {
113
113
  profile?: DeepPartial<UserProfile>;
114
114
  preferences?: DeepPartial<DatingPreferences>;
115
- notifications?: DeepPartial<UserNotifications>;
115
+ notifications?: DeepPartial<
116
+ UserNotifications & { expoPushToken?: Partial<string> }
117
+ >;
116
118
  };
117
119
 
118
120
  // storage
package/version-bump.js CHANGED
@@ -1,21 +1,65 @@
1
1
  const fs = require("fs");
2
2
  const execSync = require("child_process").execSync;
3
3
 
4
- // Get the current version from package.json
5
- const packageJson = require("./package.json");
6
- const currentVersion = packageJson.version;
4
+ try {
5
+ // Load current version from package.json
6
+ const packageJson = JSON.parse(fs.readFileSync("package.json", "utf8"));
7
+ const currentVersion = packageJson.version;
7
8
 
8
- // Get the latest published version from npm registry
9
- const latestVersion = execSync("npm show heartraite version").toString().trim();
9
+ // Fetch the latest version from the registry
10
+ let latestVersion;
11
+ try {
12
+ latestVersion = execSync("npm show heartraite version", {
13
+ encoding: "utf8",
14
+ }).trim();
15
+ } catch (error) {
16
+ console.warn(
17
+ "Could not fetch latest version from npm. Defaulting to current version."
18
+ );
19
+ latestVersion = currentVersion;
20
+ }
10
21
 
11
- // Increment the version based on the latest version
12
- const versionParts = latestVersion.split(".");
13
- versionParts[2] = (parseInt(versionParts[2]) + 1).toString(); // Increment patch version
14
- const newVersion = versionParts.join(".");
22
+ console.log(`Current version: ${currentVersion}`);
23
+ console.log(`Latest published version: ${latestVersion}`);
15
24
 
16
- packageJson.version = newVersion;
25
+ // Determine the base version to increment
26
+ const baseVersion =
27
+ compareVersions(currentVersion, latestVersion) >= 0
28
+ ? currentVersion
29
+ : latestVersion;
17
30
 
18
- // Update the package.json with the new version
19
- fs.writeFileSync("package.json", JSON.stringify(packageJson, null, 2));
31
+ // Increment the patch version
32
+ const versionParts = baseVersion.split(".");
33
+ versionParts[2] = (parseInt(versionParts[2], 10) + 1).toString();
34
+ const newVersion = versionParts.join(".");
20
35
 
21
- console.log(`Version bumped from ${currentVersion} to ${newVersion}`);
36
+ if (newVersion === currentVersion) {
37
+ console.log("Version is already up-to-date. No changes made.");
38
+ process.exit(0);
39
+ }
40
+
41
+ // Update package.json with the new version
42
+ packageJson.version = newVersion;
43
+ fs.writeFileSync(
44
+ "package.json",
45
+ JSON.stringify(packageJson, null, 2) + "\n",
46
+ "utf8"
47
+ );
48
+
49
+ console.log(`Version bumped from ${currentVersion} to ${newVersion}`);
50
+ } catch (error) {
51
+ console.error("Error bumping version:", error.message);
52
+ process.exit(1);
53
+ }
54
+
55
+ // Compare two version strings (semver)
56
+ function compareVersions(v1, v2) {
57
+ const parts1 = v1.split(".").map(Number);
58
+ const parts2 = v2.split(".").map(Number);
59
+
60
+ for (let i = 0; i < parts1.length; i++) {
61
+ if (parts1[i] > parts2[i]) return 1;
62
+ if (parts1[i] < parts2[i]) return -1;
63
+ }
64
+ return 0;
65
+ }