@helpio/common 1.0.1 → 1.0.3

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,5 @@
1
+ import { CountryCreatedEvent } from "../types/country-events";
2
+ /**
3
+ * Publish country.created event
4
+ */
5
+ export declare const publishCountryCreated: (data: CountryCreatedEvent) => Promise<void>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.publishCountryCreated = void 0;
13
+ const producer_1 = require("../producer");
14
+ /**
15
+ * Publish country.created event
16
+ */
17
+ const publishCountryCreated = (data) => __awaiter(void 0, void 0, void 0, function* () {
18
+ yield (0, producer_1.publishEvent)("country.created", data);
19
+ });
20
+ exports.publishCountryCreated = publishCountryCreated;
@@ -0,0 +1,5 @@
1
+ import { CountryStatusChangedEvent } from "../types/country-events";
2
+ /**
3
+ * Publish country.status.changed event
4
+ */
5
+ export declare const publishCountryStatusChanged: (data: CountryStatusChangedEvent) => Promise<void>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.publishCountryStatusChanged = void 0;
13
+ const producer_1 = require("../producer");
14
+ /**
15
+ * Publish country.status.changed event
16
+ */
17
+ const publishCountryStatusChanged = (data) => __awaiter(void 0, void 0, void 0, function* () {
18
+ yield (0, producer_1.publishEvent)("country.status.changed", data);
19
+ });
20
+ exports.publishCountryStatusChanged = publishCountryStatusChanged;
@@ -0,0 +1,5 @@
1
+ import { CountryUpdatedEvent } from "../types/country-events";
2
+ /**
3
+ * Publish country.updated event
4
+ */
5
+ export declare const publishCountryUpdated: (data: CountryUpdatedEvent) => Promise<void>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.publishCountryUpdated = void 0;
13
+ const producer_1 = require("../producer");
14
+ /**
15
+ * Publish country.updated event
16
+ */
17
+ const publishCountryUpdated = (data) => __awaiter(void 0, void 0, void 0, function* () {
18
+ yield (0, producer_1.publishEvent)("country.updated", data);
19
+ });
20
+ exports.publishCountryUpdated = publishCountryUpdated;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Geo Config (Country) Event Types
3
+ * Emitted by geo-config-service when country configuration changes.
4
+ */
5
+ export interface CountryCreatedEvent {
6
+ id: string;
7
+ code: string;
8
+ name: string;
9
+ phoneCode: string;
10
+ defaultCurrency: string;
11
+ isLive: boolean;
12
+ isPilot: boolean;
13
+ notes?: string;
14
+ createdAt: Date;
15
+ updatedAt: Date;
16
+ }
17
+ export interface CountryUpdatedEvent {
18
+ id: string;
19
+ code: string;
20
+ name: string;
21
+ phoneCode: string;
22
+ defaultCurrency: string;
23
+ isLive: boolean;
24
+ isPilot: boolean;
25
+ notes?: string;
26
+ updatedAt: Date;
27
+ }
28
+ export interface CountryStatusChangedEvent {
29
+ id: string;
30
+ code: string;
31
+ name: string;
32
+ isLive: boolean;
33
+ previousStatus: boolean;
34
+ changedBy?: string;
35
+ changedAt: Date;
36
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ /**
3
+ * Geo Config (Country) Event Types
4
+ * Emitted by geo-config-service when country configuration changes.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,11 @@
1
1
  import { UserCreatedEvent, UserUpdatedEvent } from "./user-events";
2
+ import { CountryCreatedEvent, CountryStatusChangedEvent, CountryUpdatedEvent } from "./country-events";
2
3
  export interface EventMap {
3
4
  "user.created": UserCreatedEvent;
4
5
  "user.updated": UserUpdatedEvent;
6
+ "country.created": CountryCreatedEvent;
7
+ "country.updated": CountryUpdatedEvent;
8
+ "country.status.changed": CountryStatusChangedEvent;
5
9
  }
6
10
  export * from "./user-events";
11
+ export * from "./country-events";
@@ -12,3 +12,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  // Export all event types
14
14
  __exportStar(require("./user-events"), exports);
15
+ __exportStar(require("./country-events"), exports);
@@ -1,12 +1,50 @@
1
1
  /**
2
- * User Event Types for Property Marketplace
3
- * Updated to match auth-service User model schema
2
+ * User Event Types
3
+ * Kept in sync with auth-service User model schema.
4
4
  */
5
- export declare type UserRole = "tenant" | "landlord" | "property_agent" | "support_agent" | "city_admin" | "super_admin";
5
+ export declare type UserRole = "employer" | "worker" | "agent" | "admin" | "super_admin";
6
6
  export declare type UserStatus = "active" | "suspended" | "banned" | "deleted";
7
7
  export declare type KycStatus = "unverified" | "pending" | "verified" | "needs_info" | "rejected";
8
8
  export declare type VerificationLevel = "none" | "basic" | "verified" | "super_verified";
9
- export declare type UserActiveMode = "tenant" | "landlord" | "admin";
9
+ export declare type AccountCreatedVia = "self" | "agent" | "admin";
10
+ export declare type WorkerCategory = "maid" | "gardener" | "nanny" | "cook" | "laundry_assistant" | "caretaker" | "personal_driver" | "family_driver" | "school_transport_driver" | "security_guard" | "elderly_caregiver" | "disability_caregiver" | "nurse_aide" | "registered_nurse" | "physiotherapy_assistant" | "home_health_aide";
11
+ export declare type Gender = "male" | "female" | "other" | "prefer_not_to_say";
12
+ export declare type OAuthProvider = "google" | "facebook" | "apple";
13
+ export interface UserEventBase {
14
+ id: string;
15
+ accountNumber: number;
16
+ firstName: string;
17
+ lastName: string;
18
+ email?: string;
19
+ phoneNumber: string;
20
+ role: UserRole;
21
+ createdVia: AccountCreatedVia;
22
+ createdByUser?: string;
23
+ gender?: Gender;
24
+ dateOfBirth?: Date;
25
+ address?: string;
26
+ city?: string;
27
+ country?: string;
28
+ countryCode?: string;
29
+ languagePreference: string;
30
+ avatarUrl?: string;
31
+ workerCategories?: WorkerCategory[];
32
+ isWorkerProfileComplete: boolean;
33
+ isEmployerProfileComplete: boolean;
34
+ kycStatus: KycStatus;
35
+ verificationLevel: VerificationLevel;
36
+ emailVerifiedAt?: Date;
37
+ phoneVerifiedAt?: Date;
38
+ trustScore: number;
39
+ oauthProvider?: OAuthProvider;
40
+ oauthId?: string;
41
+ biometricEnabled?: boolean;
42
+ biometricPublicKey?: string;
43
+ biometricDeviceId?: string;
44
+ status: UserStatus;
45
+ createdAt: Date;
46
+ updatedAt: Date;
47
+ }
10
48
  export interface UserCreatedEvent {
11
49
  id: string;
12
50
  accountNumber: number;
@@ -14,28 +52,26 @@ export interface UserCreatedEvent {
14
52
  lastName: string;
15
53
  email?: string;
16
54
  phoneNumber: string;
17
- roles: UserRole[];
18
- activeMode: UserActiveMode;
55
+ role: UserRole;
56
+ createdVia: AccountCreatedVia;
57
+ createdByUser?: string;
58
+ gender?: Gender;
59
+ dateOfBirth?: Date;
19
60
  address?: string;
20
61
  city?: string;
21
62
  country?: string;
22
63
  countryCode?: string;
23
64
  languagePreference: string;
24
65
  avatarUrl?: string;
66
+ workerCategories?: WorkerCategory[];
67
+ isWorkerProfileComplete: boolean;
68
+ isEmployerProfileComplete: boolean;
25
69
  kycStatus: KycStatus;
26
70
  verificationLevel: VerificationLevel;
27
71
  emailVerifiedAt?: Date;
28
72
  phoneVerifiedAt?: Date;
29
73
  trustScore: number;
30
- cancellationCount: number;
31
- cancellationStrikes: number;
32
- totalPropertiesListed?: number;
33
- totalPropertiesRented?: number;
34
- landlordRating?: number;
35
- tenantRating?: number;
36
- landlordRatingCount?: number;
37
- tenantRatingCount?: number;
38
- oauthProvider?: "google" | "facebook" | "github" | "apple";
74
+ oauthProvider?: OAuthProvider;
39
75
  oauthId?: string;
40
76
  biometricEnabled?: boolean;
41
77
  biometricPublicKey?: string;
@@ -51,28 +87,26 @@ export interface UserUpdatedEvent {
51
87
  lastName: string;
52
88
  email?: string;
53
89
  phoneNumber: string;
54
- roles: UserRole[];
55
- activeMode: UserActiveMode;
90
+ role: UserRole;
91
+ createdVia: AccountCreatedVia;
92
+ createdByUser?: string;
93
+ gender?: Gender;
94
+ dateOfBirth?: Date;
56
95
  address?: string;
57
96
  city?: string;
58
97
  country?: string;
59
98
  countryCode?: string;
60
99
  languagePreference: string;
61
100
  avatarUrl?: string;
101
+ workerCategories?: WorkerCategory[];
102
+ isWorkerProfileComplete: boolean;
103
+ isEmployerProfileComplete: boolean;
62
104
  kycStatus: KycStatus;
63
105
  verificationLevel: VerificationLevel;
64
106
  emailVerifiedAt?: Date;
65
107
  phoneVerifiedAt?: Date;
66
108
  trustScore: number;
67
- cancellationCount: number;
68
- cancellationStrikes: number;
69
- totalPropertiesListed?: number;
70
- totalPropertiesRented?: number;
71
- landlordRating?: number;
72
- tenantRating?: number;
73
- landlordRatingCount?: number;
74
- tenantRatingCount?: number;
75
- oauthProvider?: "google" | "facebook" | "github" | "apple";
109
+ oauthProvider?: OAuthProvider;
76
110
  oauthId?: string;
77
111
  biometricEnabled?: boolean;
78
112
  biometricPublicKey?: string;
@@ -101,18 +135,11 @@ export interface UserStatusChangedEvent {
101
135
  export interface UserRolesUpdatedEvent {
102
136
  id: string;
103
137
  accountNumber: number;
104
- oldRoles: UserRole[];
105
- newRoles: UserRole[];
138
+ oldRole: UserRole;
139
+ newRole: UserRole;
106
140
  updatedBy?: string;
107
141
  updatedAt: Date;
108
142
  }
109
- export interface UserModeChangedEvent {
110
- id: string;
111
- accountNumber: number;
112
- oldMode: UserActiveMode;
113
- newMode: UserActiveMode;
114
- changedAt: Date;
115
- }
116
143
  export interface UserVerifiedEvent {
117
144
  id: string;
118
145
  accountNumber: number;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * User Event Types for Property Marketplace
4
- * Updated to match auth-service User model schema
3
+ * User Event Types
4
+ * Kept in sync with auth-service User model schema.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
package/build/index.d.ts CHANGED
@@ -18,3 +18,6 @@ export * from "./events/types/user-events";
18
18
  export * from "./events/types";
19
19
  export * from "./events/publishers/user-created-publisher";
20
20
  export * from "./events/publishers/user-updated-publisher";
21
+ export * from "./events/publishers/country-created-publisher";
22
+ export * from "./events/publishers/country-updated-publisher";
23
+ export * from "./events/publishers/country-status-changed-publisher";
package/build/index.js CHANGED
@@ -32,3 +32,7 @@ __exportStar(require("./events/types"), exports);
32
32
  // User event publishers
33
33
  __exportStar(require("./events/publishers/user-created-publisher"), exports);
34
34
  __exportStar(require("./events/publishers/user-updated-publisher"), exports);
35
+ // Country (geo-config) event publishers
36
+ __exportStar(require("./events/publishers/country-created-publisher"), exports);
37
+ __exportStar(require("./events/publishers/country-updated-publisher"), exports);
38
+ __exportStar(require("./events/publishers/country-status-changed-publisher"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helpio/common",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "common library for Helpio ",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",