@jobsearch-works/firestore-models 1.1.11 → 1.1.13

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/README.md CHANGED
@@ -75,7 +75,9 @@ Client
75
75
  ├── questions (ClientQuestion)
76
76
  ├── preferences/targetPreferences (TargetPreferences)
77
77
  ├── vacancySuggestions (VacancySuggestion)
78
- └── clientEmails/{clientId}/messages (GmailMessage)
78
+ ├── emails (GmailMessage)
79
+ ├── logins (ClientLogin)
80
+ └── resumeLinks (ResumeLink)
79
81
 
80
82
  Vacancy
81
83
  └── Referenced by Application and VacancySuggestion
@@ -88,9 +90,6 @@ User
88
90
 
89
91
  ClientData
90
92
  └── Root collection
91
-
92
- ClientLogin
93
- └── clientLogins/{userId}/logins/{domain}
94
93
  ```
95
94
 
96
95
  | Entity | References / Path | Description |
@@ -107,8 +106,8 @@ ClientLogin
107
106
  | Agent | Root collection | Standalone entity |
108
107
  | AuthUser | Root collection | Standalone entity |
109
108
  | ClientData | Root collection | Standalone entity |
110
- | ClientLogin | clientLogins/{userId}/logins/{domain} | References `userId` |
111
- | GmailMessage | clientEmails/{clientId}/messages/{messageId} | References `clientId` |
109
+ | ClientLogin | clients/{clientId}/logins/{domain} | References `clientId` |
110
+ | GmailMessage | clients/{clientId}/emails/{messageId} | References `clientId` |
112
111
  | ResumeLink | clients/{clientId}/resumeLinks/{linkId} | References `clientId`, stores PDF resume URLs |
113
112
 
114
113
  **Notes:**
@@ -122,7 +121,7 @@ ClientLogin
122
121
 
123
122
  ## ✅ Usage
124
123
 
125
- This library is intentionally SDK-free. All Firebase logic — including `Timestamp`, `doc()`, and `onSnapshot()` — is handled in your apps service layer. This ensures portability across React apps, Firebase functions, and testing environments.
124
+ This library is intentionally SDK-free. All Firebase logic — including `Timestamp`, `doc()`, and `onSnapshot()` — is handled in your app's service layer. This ensures portability across React apps, Firebase functions, and testing environments.
126
125
 
127
126
  ### Importing Models and Paths
128
127
 
@@ -304,11 +303,11 @@ All Firestore document schemas are defined as TypeScript interfaces in `src/type
304
303
 
305
304
  ```ts
306
305
  export interface ResumeLink {
307
- id: string;
306
+ id?: string;
308
307
  title: string;
309
308
  url: string;
310
309
  description: string;
311
- createdAt: any; // Timestamp from firebase/firestore
310
+ createdAt?: Date | string;
312
311
  createdBy: string;
313
312
  clientId: string;
314
313
  }
@@ -447,9 +446,17 @@ export function withId<T>(snap: DocumentSnapshot): T & { id: string } {
447
446
  - `firestorePaths.clients.doc(clientId)` → "clients/{clientId}"
448
447
  - `firestorePaths.clients.applications.collection(clientId)` → "clients/{clientId}/applications"
449
448
  - `firestorePaths.clients.applications.doc(clientId, applicationId)` → "clients/{clientId}/applications/{applicationId}"
449
+ - `firestorePaths.clients.applications.questions.collection(clientId, applicationId)` → "clients/{clientId}/applications/{applicationId}/questions"
450
+ - `firestorePaths.clients.applications.questions.doc(clientId, applicationId, questionId)` → "clients/{clientId}/applications/{applicationId}/questions/{questionId}"
451
+ - `firestorePaths.clients.emails.collection(clientId)` → "clients/{clientId}/emails"
452
+ - `firestorePaths.clients.emails.doc(clientId, messageId)` → "clients/{clientId}/emails/{messageId}"
453
+ - `firestorePaths.clients.logins.collection(clientId)` → "clients/{clientId}/logins"
454
+ - `firestorePaths.clients.logins.doc(clientId, domain)` → "clients/{clientId}/logins/{domain}"
455
+ - `firestorePaths.clients.preferences.target(clientId)` → "clients/{clientId}/preferences/targetPreferences"
450
456
  - `firestorePaths.clients.questions.collection(clientId)` → "clients/{clientId}/questions"
451
457
  - `firestorePaths.clients.questions.doc(clientId, questionId)` → "clients/{clientId}/questions/{questionId}"
452
- - `firestorePaths.clients.preferences.target(clientId)` → "clients/{clientId}/preferences/targetPreferences"
458
+ - `firestorePaths.clients.resumeLinks.collection(clientId)` → "clients/{clientId}/resumeLinks"
459
+ - `firestorePaths.clients.resumeLinks.doc(clientId, resumeLinkId)` → "clients/{clientId}/resumeLinks/{resumeLinkId}"
453
460
  - `firestorePaths.clients.vacancySuggestions.collection(clientId)` → "clients/{clientId}/vacancySuggestions"
454
461
  - `firestorePaths.clients.vacancySuggestions.doc(clientId, suggestionId)` → "clients/{clientId}/vacancySuggestions/{suggestionId}"
455
462
  - `firestorePaths.users.collection()` → "users"
@@ -460,10 +467,6 @@ export function withId<T>(snap: DocumentSnapshot): T & { id: string } {
460
467
  - `firestorePaths.agents.doc(agentId)` → "agents/{agentId}"
461
468
  - `firestorePaths.clientData.collection()` → "clientData"
462
469
  - `firestorePaths.clientData.doc(clientDataId)` → "clientData/{clientDataId}"
463
- - `firestorePaths.clientLogins.collection(userId)` → "clientLogins/{userId}"
464
- - `firestorePaths.clientLogins.doc(userId, domain)` → "clientLogins/{userId}/logins/{domain}"
465
- - `firestorePaths.gmailMessages.collection(clientId)` → "clientEmails/{clientId}/messages"
466
- - `firestorePaths.gmailMessages.doc(clientId, messageId)` → "clientEmails/{clientId}/messages/{messageId}"
467
470
 
468
471
  ---
469
472
 
package/dist/index.d.mts CHANGED
@@ -261,21 +261,29 @@ declare const firestorePaths: {
261
261
  readonly doc: (clientId: string, applicationId: string, questionId: string) => string;
262
262
  };
263
263
  };
264
- readonly questions: {
264
+ readonly emails: {
265
265
  readonly collection: (clientId: string) => string;
266
- readonly doc: (clientId: string, questionId: string) => string;
266
+ readonly doc: (clientId: string, messageId: string) => string;
267
+ };
268
+ readonly logins: {
269
+ readonly collection: (clientId: string) => string;
270
+ readonly doc: (clientId: string, domain: string) => string;
267
271
  };
268
272
  readonly preferences: {
269
273
  readonly target: (clientId: string) => string;
270
274
  };
271
- readonly vacancySuggestions: {
275
+ readonly questions: {
272
276
  readonly collection: (clientId: string) => string;
273
- readonly doc: (clientId: string, suggestionId: string) => string;
277
+ readonly doc: (clientId: string, questionId: string) => string;
274
278
  };
275
279
  readonly resumeLinks: {
276
280
  readonly collection: (clientId: string) => string;
277
281
  readonly doc: (clientId: string, resumeLinkId: string) => string;
278
282
  };
283
+ readonly vacancySuggestions: {
284
+ readonly collection: (clientId: string) => string;
285
+ readonly doc: (clientId: string, suggestionId: string) => string;
286
+ };
279
287
  };
280
288
  readonly users: {
281
289
  readonly collection: () => string;
@@ -294,10 +302,10 @@ declare const firestorePaths: {
294
302
  readonly doc: (clientDataId: string) => string;
295
303
  };
296
304
  readonly clientLogins: {
297
- readonly collection: (userId: string) => string;
298
- readonly doc: (userId: string, domain: string) => string;
305
+ readonly collection: (clientId: string) => string;
306
+ readonly doc: (clientId: string, domain: string) => string;
299
307
  };
300
- readonly gmailMessages: {
308
+ readonly clientEmails: {
301
309
  readonly collection: (clientId: string) => string;
302
310
  readonly doc: (clientId: string, messageId: string) => string;
303
311
  };
package/dist/index.d.ts CHANGED
@@ -261,21 +261,29 @@ declare const firestorePaths: {
261
261
  readonly doc: (clientId: string, applicationId: string, questionId: string) => string;
262
262
  };
263
263
  };
264
- readonly questions: {
264
+ readonly emails: {
265
265
  readonly collection: (clientId: string) => string;
266
- readonly doc: (clientId: string, questionId: string) => string;
266
+ readonly doc: (clientId: string, messageId: string) => string;
267
+ };
268
+ readonly logins: {
269
+ readonly collection: (clientId: string) => string;
270
+ readonly doc: (clientId: string, domain: string) => string;
267
271
  };
268
272
  readonly preferences: {
269
273
  readonly target: (clientId: string) => string;
270
274
  };
271
- readonly vacancySuggestions: {
275
+ readonly questions: {
272
276
  readonly collection: (clientId: string) => string;
273
- readonly doc: (clientId: string, suggestionId: string) => string;
277
+ readonly doc: (clientId: string, questionId: string) => string;
274
278
  };
275
279
  readonly resumeLinks: {
276
280
  readonly collection: (clientId: string) => string;
277
281
  readonly doc: (clientId: string, resumeLinkId: string) => string;
278
282
  };
283
+ readonly vacancySuggestions: {
284
+ readonly collection: (clientId: string) => string;
285
+ readonly doc: (clientId: string, suggestionId: string) => string;
286
+ };
279
287
  };
280
288
  readonly users: {
281
289
  readonly collection: () => string;
@@ -294,10 +302,10 @@ declare const firestorePaths: {
294
302
  readonly doc: (clientDataId: string) => string;
295
303
  };
296
304
  readonly clientLogins: {
297
- readonly collection: (userId: string) => string;
298
- readonly doc: (userId: string, domain: string) => string;
305
+ readonly collection: (clientId: string) => string;
306
+ readonly doc: (clientId: string, domain: string) => string;
299
307
  };
300
- readonly gmailMessages: {
308
+ readonly clientEmails: {
301
309
  readonly collection: (clientId: string) => string;
302
310
  readonly doc: (clientId: string, messageId: string) => string;
303
311
  };
package/dist/index.js CHANGED
@@ -97,20 +97,28 @@ var firestorePaths = {
97
97
  doc: (clientId, applicationId, questionId) => `clients/${clientId}/applications/${applicationId}/questions/${questionId}`
98
98
  }
99
99
  },
100
- questions: {
101
- collection: (clientId) => `clients/${clientId}/questions`,
102
- doc: (clientId, questionId) => `clients/${clientId}/questions/${questionId}`
100
+ emails: {
101
+ collection: (clientId) => `clients/${clientId}/emails`,
102
+ doc: (clientId, messageId) => `clients/${clientId}/emails/${messageId}`
103
+ },
104
+ logins: {
105
+ collection: (clientId) => `clients/${clientId}/logins`,
106
+ doc: (clientId, domain) => `clients/${clientId}/logins/${domain}`
103
107
  },
104
108
  preferences: {
105
109
  target: (clientId) => `clients/${clientId}/preferences/targetPreferences`
106
110
  },
107
- vacancySuggestions: {
108
- collection: (clientId) => `clients/${clientId}/vacancySuggestions`,
109
- doc: (clientId, suggestionId) => `clients/${clientId}/vacancySuggestions/${suggestionId}`
111
+ questions: {
112
+ collection: (clientId) => `clients/${clientId}/questions`,
113
+ doc: (clientId, questionId) => `clients/${clientId}/questions/${questionId}`
110
114
  },
111
115
  resumeLinks: {
112
116
  collection: (clientId) => `clients/${clientId}/resumeLinks`,
113
117
  doc: (clientId, resumeLinkId) => `clients/${clientId}/resumeLinks/${resumeLinkId}`
118
+ },
119
+ vacancySuggestions: {
120
+ collection: (clientId) => `clients/${clientId}/vacancySuggestions`,
121
+ doc: (clientId, suggestionId) => `clients/${clientId}/vacancySuggestions/${suggestionId}`
114
122
  }
115
123
  },
116
124
  users: {
@@ -130,12 +138,12 @@ var firestorePaths = {
130
138
  doc: (clientDataId) => `clientData/${clientDataId}`
131
139
  },
132
140
  clientLogins: {
133
- collection: (userId) => `clientLogins/${userId}/logins`,
134
- doc: (userId, domain) => `clientLogins/${userId}/logins/${domain}`
141
+ collection: (clientId) => `clients/${clientId}/logins`,
142
+ doc: (clientId, domain) => `clients/${clientId}/logins/${domain}`
135
143
  },
136
- gmailMessages: {
137
- collection: (clientId) => `clientEmails/${clientId}/messages`,
138
- doc: (clientId, messageId) => `clientEmails/${clientId}/messages/${messageId}`
144
+ clientEmails: {
145
+ collection: (clientId) => `clients/${clientId}/emails`,
146
+ doc: (clientId, messageId) => `clients/${clientId}/emails/${messageId}`
139
147
  }
140
148
  };
141
149
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -67,20 +67,28 @@ var firestorePaths = {
67
67
  doc: (clientId, applicationId, questionId) => `clients/${clientId}/applications/${applicationId}/questions/${questionId}`
68
68
  }
69
69
  },
70
- questions: {
71
- collection: (clientId) => `clients/${clientId}/questions`,
72
- doc: (clientId, questionId) => `clients/${clientId}/questions/${questionId}`
70
+ emails: {
71
+ collection: (clientId) => `clients/${clientId}/emails`,
72
+ doc: (clientId, messageId) => `clients/${clientId}/emails/${messageId}`
73
+ },
74
+ logins: {
75
+ collection: (clientId) => `clients/${clientId}/logins`,
76
+ doc: (clientId, domain) => `clients/${clientId}/logins/${domain}`
73
77
  },
74
78
  preferences: {
75
79
  target: (clientId) => `clients/${clientId}/preferences/targetPreferences`
76
80
  },
77
- vacancySuggestions: {
78
- collection: (clientId) => `clients/${clientId}/vacancySuggestions`,
79
- doc: (clientId, suggestionId) => `clients/${clientId}/vacancySuggestions/${suggestionId}`
81
+ questions: {
82
+ collection: (clientId) => `clients/${clientId}/questions`,
83
+ doc: (clientId, questionId) => `clients/${clientId}/questions/${questionId}`
80
84
  },
81
85
  resumeLinks: {
82
86
  collection: (clientId) => `clients/${clientId}/resumeLinks`,
83
87
  doc: (clientId, resumeLinkId) => `clients/${clientId}/resumeLinks/${resumeLinkId}`
88
+ },
89
+ vacancySuggestions: {
90
+ collection: (clientId) => `clients/${clientId}/vacancySuggestions`,
91
+ doc: (clientId, suggestionId) => `clients/${clientId}/vacancySuggestions/${suggestionId}`
84
92
  }
85
93
  },
86
94
  users: {
@@ -100,12 +108,12 @@ var firestorePaths = {
100
108
  doc: (clientDataId) => `clientData/${clientDataId}`
101
109
  },
102
110
  clientLogins: {
103
- collection: (userId) => `clientLogins/${userId}/logins`,
104
- doc: (userId, domain) => `clientLogins/${userId}/logins/${domain}`
111
+ collection: (clientId) => `clients/${clientId}/logins`,
112
+ doc: (clientId, domain) => `clients/${clientId}/logins/${domain}`
105
113
  },
106
- gmailMessages: {
107
- collection: (clientId) => `clientEmails/${clientId}/messages`,
108
- doc: (clientId, messageId) => `clientEmails/${clientId}/messages/${messageId}`
114
+ clientEmails: {
115
+ collection: (clientId) => `clients/${clientId}/emails`,
116
+ doc: (clientId, messageId) => `clients/${clientId}/emails/${messageId}`
109
117
  }
110
118
  };
111
119
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobsearch-works/firestore-models",
3
- "version": "1.1.11",
3
+ "version": "1.1.13",
4
4
  "description": "A shared library for standardizing Firestore document schemas and paths across multiple projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",