@molecule/api-resource-user 1.9.0 → 1.10.1
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 +53 -4
- package/dist/authorization.d.ts +2 -1
- package/dist/authorization.d.ts.map +1 -1
- package/dist/authorization.js +7 -12
- package/dist/authorization.js.map +1 -1
- package/dist/handlers/create.d.ts.map +1 -1
- package/dist/handlers/create.js +6 -2
- package/dist/handlers/create.js.map +1 -1
- package/dist/handlers/del.d.ts.map +1 -1
- package/dist/handlers/del.js +3 -1
- package/dist/handlers/del.js.map +1 -1
- package/dist/handlers/forgotPassword.d.ts.map +1 -1
- package/dist/handlers/forgotPassword.js +6 -1
- package/dist/handlers/forgotPassword.js.map +1 -1
- package/dist/handlers/logIn.d.ts.map +1 -1
- package/dist/handlers/logIn.js +39 -9
- package/dist/handlers/logIn.js.map +1 -1
- package/dist/handlers/logInOAuth.d.ts.map +1 -1
- package/dist/handlers/logInOAuth.js +12 -4
- package/dist/handlers/logInOAuth.js.map +1 -1
- package/dist/handlers/payments/billingPortal.d.ts.map +1 -1
- package/dist/handlers/payments/billingPortal.js +3 -1
- package/dist/handlers/payments/billingPortal.js.map +1 -1
- package/dist/handlers/payments/handlePaymentNotification.d.ts.map +1 -1
- package/dist/handlers/payments/handlePaymentNotification.js +36 -6
- package/dist/handlers/payments/handlePaymentNotification.js.map +1 -1
- package/dist/handlers/payments/verifyPayment.d.ts.map +1 -1
- package/dist/handlers/payments/verifyPayment.js +45 -8
- package/dist/handlers/payments/verifyPayment.js.map +1 -1
- package/dist/handlers/resetPassword.d.ts.map +1 -1
- package/dist/handlers/resetPassword.js +3 -1
- package/dist/handlers/resetPassword.js.map +1 -1
- package/dist/handlers/update.d.ts.map +1 -1
- package/dist/handlers/update.js +3 -1
- package/dist/handlers/update.js.map +1 -1
- package/dist/handlers/updatePassword.d.ts.map +1 -1
- package/dist/handlers/updatePassword.js +3 -1
- package/dist/handlers/updatePassword.js.map +1 -1
- package/dist/handlers/verifyTwoFactor.d.ts.map +1 -1
- package/dist/handlers/verifyTwoFactor.js +15 -5
- package/dist/handlers/verifyTwoFactor.js.map +1 -1
- package/dist/index.d.ts +11 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -2
- package/dist/index.js.map +1 -1
- package/dist/profiles.d.ts +32 -0
- package/dist/profiles.d.ts.map +1 -0
- package/dist/profiles.js +37 -0
- package/dist/profiles.js.map +1 -0
- package/dist/utilities/notify.d.ts.map +1 -1
- package/dist/utilities/notify.js +3 -1
- package/dist/utilities/notify.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifyTwoFactor.js","sourceRoot":"","sources":["../../src/handlers/verifyTwoFactor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC5D,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAuB,MAAM,wBAAwB,CAAA;AAC9F,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAA;AAKtC,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;AAChC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;AAU1B;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAC9B,IAAI,EAAE,KAAK,EACX,SAAS,EACT,MAAM,EAAE,OAAO,GACO,EAAE,EAAE;IAC1B,OAAO,KAAK,EAAE,GAA2B,EAAE,EAAE;QAC3C,IAAI,CAAC;YACH,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,EAAY,CAAA;YAClC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,IAAI,CAAA;YAElC,oBAAoB;YACpB,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAoB,GAAG,SAAS,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GAAG;gBACf,IAAI,EAAE;oBACJ,KAAK,EAAE,CAAC,CAAC,qCAAqC,CAAC;oBAC/C,QAAQ,EAAE,qCAAqC;iBAChD;aACF,CAAA;QACH,CAAC;IACH,CAAC,CAAA;AACH,CAAC,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -44,8 +44,6 @@
|
|
|
44
44
|
* revokes every OTHER device but keeps the
|
|
45
45
|
* caller's own session.
|
|
46
46
|
*
|
|
47
|
-
* **Generated full-stack apps:** mlcl derives the app-auth composition root from this API contract; keep that bond and use its shared HTTP client.
|
|
48
|
-
*
|
|
49
47
|
* **`handlers.*` return `{ statusCode, headers?, body }` and never write to `res`** — not through
|
|
50
48
|
* `res.json`, not through `res.send`, not through `res.end`. The mounted routes apply that object
|
|
51
49
|
* for you (`createRequestHandler` does `res.set(headers)`, `res.status(statusCode)`,
|
|
@@ -60,6 +58,10 @@
|
|
|
60
58
|
* Monkey-patching `res.json` to re-shape a handler's answer intercepts nothing the handler
|
|
61
59
|
* produces, so the request it was meant to answer is left unanswered and hangs.
|
|
62
60
|
*
|
|
61
|
+
* **Generated full-stack apps:** mlcl derives the app-auth composition root from this API contract; keep that bond and use its shared HTTP client.
|
|
62
|
+
* Header-only mounts discard a session inherited from a cookie-enabled mount before
|
|
63
|
+
* verifying the header, including when that header is invalid or its device was revoked.
|
|
64
|
+
*
|
|
63
65
|
* **Adapt envelopes with `createRequestHandler(handler, options)` from
|
|
64
66
|
* `@molecule/api-resource` 1.1 or newer.** Keep `handlers.create(resource)` and
|
|
65
67
|
* `handlers.logIn(resource)` as the handler. `mapRequest: (req) =>
|
|
@@ -326,6 +328,12 @@
|
|
|
326
328
|
* login or an explicit denial — never a blank page).
|
|
327
329
|
* - [ ] A profile/account edit (e.g. display name) persists across a reload.
|
|
328
330
|
*
|
|
331
|
+
* **Public profiles for a list:** call `getPublicProfiles(userIds)` once for the page,
|
|
332
|
+
* then join its map by canonical id. It reads only public display columns in one query,
|
|
333
|
+
* deduplicates repeated ids, omits missing users and does no I/O for an empty page.
|
|
334
|
+
* Never serialize a complete account row beside public content: email, OAuth and plan fields
|
|
335
|
+
* are not public profile data. A renamed users table uses `getPublicProfiles(ids, { tableName })`.
|
|
336
|
+
*
|
|
329
337
|
* @module
|
|
330
338
|
*/
|
|
331
339
|
export * from './accounts.js';
|
|
@@ -334,6 +342,7 @@ export * as authorizers from './authorizers/index.js';
|
|
|
334
342
|
export * from './browser-guard.js';
|
|
335
343
|
export * as handlers from './handlers/index.js';
|
|
336
344
|
export * from './i18n.js';
|
|
345
|
+
export * from './profiles.js';
|
|
337
346
|
export * from './provisioning.js';
|
|
338
347
|
export * from './requestHandlerMap.js';
|
|
339
348
|
export * from './resource.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiVG;AAEH,cAAc,eAAe,CAAA;AAC7B,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAA;AACnD,OAAO,KAAK,WAAW,MAAM,wBAAwB,CAAA;AACrD,cAAc,oBAAoB,CAAA;AAClC,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAA;AAC/C,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,wBAAwB,CAAA;AACtC,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -44,8 +44,6 @@
|
|
|
44
44
|
* revokes every OTHER device but keeps the
|
|
45
45
|
* caller's own session.
|
|
46
46
|
*
|
|
47
|
-
* **Generated full-stack apps:** mlcl derives the app-auth composition root from this API contract; keep that bond and use its shared HTTP client.
|
|
48
|
-
*
|
|
49
47
|
* **`handlers.*` return `{ statusCode, headers?, body }` and never write to `res`** — not through
|
|
50
48
|
* `res.json`, not through `res.send`, not through `res.end`. The mounted routes apply that object
|
|
51
49
|
* for you (`createRequestHandler` does `res.set(headers)`, `res.status(statusCode)`,
|
|
@@ -60,6 +58,10 @@
|
|
|
60
58
|
* Monkey-patching `res.json` to re-shape a handler's answer intercepts nothing the handler
|
|
61
59
|
* produces, so the request it was meant to answer is left unanswered and hangs.
|
|
62
60
|
*
|
|
61
|
+
* **Generated full-stack apps:** mlcl derives the app-auth composition root from this API contract; keep that bond and use its shared HTTP client.
|
|
62
|
+
* Header-only mounts discard a session inherited from a cookie-enabled mount before
|
|
63
|
+
* verifying the header, including when that header is invalid or its device was revoked.
|
|
64
|
+
*
|
|
63
65
|
* **Adapt envelopes with `createRequestHandler(handler, options)` from
|
|
64
66
|
* `@molecule/api-resource` 1.1 or newer.** Keep `handlers.create(resource)` and
|
|
65
67
|
* `handlers.logIn(resource)` as the handler. `mapRequest: (req) =>
|
|
@@ -326,6 +328,12 @@
|
|
|
326
328
|
* login or an explicit denial — never a blank page).
|
|
327
329
|
* - [ ] A profile/account edit (e.g. display name) persists across a reload.
|
|
328
330
|
*
|
|
331
|
+
* **Public profiles for a list:** call `getPublicProfiles(userIds)` once for the page,
|
|
332
|
+
* then join its map by canonical id. It reads only public display columns in one query,
|
|
333
|
+
* deduplicates repeated ids, omits missing users and does no I/O for an empty page.
|
|
334
|
+
* Never serialize a complete account row beside public content: email, OAuth and plan fields
|
|
335
|
+
* are not public profile data. A renamed users table uses `getPublicProfiles(ids, { tableName })`.
|
|
336
|
+
*
|
|
329
337
|
* @module
|
|
330
338
|
*/
|
|
331
339
|
export * from './accounts.js';
|
|
@@ -334,6 +342,7 @@ export * as authorizers from './authorizers/index.js';
|
|
|
334
342
|
export * from './browser-guard.js';
|
|
335
343
|
export * as handlers from './handlers/index.js';
|
|
336
344
|
export * from './i18n.js';
|
|
345
|
+
export * from './profiles.js';
|
|
337
346
|
export * from './provisioning.js';
|
|
338
347
|
export * from './requestHandlerMap.js';
|
|
339
348
|
export * from './resource.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiVG;AAEH,cAAc,eAAe,CAAA;AAC7B,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAA;AACnD,OAAO,KAAK,WAAW,MAAM,wBAAwB,CAAA;AACrD,cAAc,oBAAoB,CAAA;AAClC,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAA;AAC/C,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,wBAAwB,CAAA;AACtC,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public user profiles loaded once for a collection, through the bonded store.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
5
|
+
import type { HandlerResource } from './types.js';
|
|
6
|
+
/** User columns safe to display beside content. Account and credential fields are excluded. */
|
|
7
|
+
export interface PublicProfile {
|
|
8
|
+
/** The user's canonical id. */
|
|
9
|
+
id: string;
|
|
10
|
+
/** The public username, when set. */
|
|
11
|
+
username: string | null;
|
|
12
|
+
/** The public display name, when set. */
|
|
13
|
+
name: string | null;
|
|
14
|
+
/** The public biography, when set. */
|
|
15
|
+
bio: string | null;
|
|
16
|
+
/** The public avatar URL, when set. */
|
|
17
|
+
avatar: string | null;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Load the public profiles for a collection in one database query.
|
|
21
|
+
*
|
|
22
|
+
* Pass every user id from the page once, then join by id while projecting the response.
|
|
23
|
+
* Repeated ids are deduplicated; absent users have no map entry. An empty input does no I/O.
|
|
24
|
+
* Nothing is cached between calls, so a later profile update is visible immediately.
|
|
25
|
+
* The resource option supports an application's renamed users table with the same columns.
|
|
26
|
+
*
|
|
27
|
+
* @param userIds - Canonical user ids referenced by the collection.
|
|
28
|
+
* @param resource - Users resource; defaults to the package's `users` table.
|
|
29
|
+
* @returns Public profiles keyed by id, without email, plan, OAuth or secret fields.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getPublicProfiles(userIds: readonly string[], resource?: Pick<HandlerResource, 'tableName'>): Promise<Map<string, PublicProfile>>;
|
|
32
|
+
//# sourceMappingURL=profiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../src/profiles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD,+FAA+F;AAC/F,MAAM,WAAW,aAAa;IAC5B,+BAA+B;IAC/B,EAAE,EAAE,MAAM,CAAA;IACV,qCAAqC;IACrC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,yCAAyC;IACzC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,sCAAsC;IACtC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,uCAAuC;IACvC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CACtB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,QAAQ,GAAE,IAAI,CAAC,eAAe,EAAE,WAAW,CAA0B,GACpE,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAmBrC"}
|
package/dist/profiles.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public user profiles loaded once for a collection, through the bonded store.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
5
|
+
import { findMany } from '@molecule/api-database';
|
|
6
|
+
/**
|
|
7
|
+
* Load the public profiles for a collection in one database query.
|
|
8
|
+
*
|
|
9
|
+
* Pass every user id from the page once, then join by id while projecting the response.
|
|
10
|
+
* Repeated ids are deduplicated; absent users have no map entry. An empty input does no I/O.
|
|
11
|
+
* Nothing is cached between calls, so a later profile update is visible immediately.
|
|
12
|
+
* The resource option supports an application's renamed users table with the same columns.
|
|
13
|
+
*
|
|
14
|
+
* @param userIds - Canonical user ids referenced by the collection.
|
|
15
|
+
* @param resource - Users resource; defaults to the package's `users` table.
|
|
16
|
+
* @returns Public profiles keyed by id, without email, plan, OAuth or secret fields.
|
|
17
|
+
*/
|
|
18
|
+
export async function getPublicProfiles(userIds, resource = { tableName: 'users' }) {
|
|
19
|
+
const ids = [...new Set(userIds)];
|
|
20
|
+
if (ids.length === 0)
|
|
21
|
+
return new Map();
|
|
22
|
+
const rows = await findMany(resource.tableName, {
|
|
23
|
+
where: [{ field: 'id', operator: 'in', value: ids }],
|
|
24
|
+
select: ['id', 'username', 'name', 'bio', 'avatar'],
|
|
25
|
+
});
|
|
26
|
+
return new Map(rows.map((row) => [
|
|
27
|
+
row.id,
|
|
28
|
+
{
|
|
29
|
+
id: row.id,
|
|
30
|
+
username: row.username ?? null,
|
|
31
|
+
name: row.name ?? null,
|
|
32
|
+
bio: row.bio ?? null,
|
|
33
|
+
avatar: row.avatar ?? null,
|
|
34
|
+
},
|
|
35
|
+
]));
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=profiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles.js","sourceRoot":"","sources":["../src/profiles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAkBjD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,OAA0B,EAC1B,WAA+C,EAAE,SAAS,EAAE,OAAO,EAAE;IAErE,MAAM,GAAG,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;IACjC,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,GAAG,EAAE,CAAA;IACtC,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAgB,QAAQ,CAAC,SAAS,EAAE;QAC7D,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;QACpD,MAAM,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC;KACpD,CAAC,CAAA;IACF,OAAO,IAAI,GAAG,CACZ,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC;QAChB,GAAG,CAAC,EAAE;QACN;YACE,EAAE,EAAE,GAAG,CAAC,EAAE;YACV,QAAQ,EAAE,GAAG,CAAC,QAAQ,IAAI,IAAI;YAC9B,IAAI,EAAE,GAAG,CAAC,IAAI,IAAI,IAAI;YACtB,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,IAAI;YACpB,MAAM,EAAE,GAAG,CAAC,MAAM,IAAI,IAAI;SAC3B;KACF,CAAC,CACH,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notify.d.ts","sourceRoot":"","sources":["../../src/utilities/notify.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,MAAM,GAAU,uDAO1B;IACD,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,KAAG,OAAO,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"notify.d.ts","sourceRoot":"","sources":["../../src/utilities/notify.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,MAAM,GAAU,uDAO1B;IACD,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,KAAG,OAAO,CAAC,IAAI,CAiCf,CAAA"}
|
package/dist/utilities/notify.js
CHANGED
|
@@ -14,7 +14,9 @@ const logger = getLogger();
|
|
|
14
14
|
*/
|
|
15
15
|
export const notify = async ({ userId, deviceId, title, titleKey, body, bodyKey, }) => {
|
|
16
16
|
try {
|
|
17
|
-
|
|
17
|
+
// Optional module: absence is the designed degradation path (the
|
|
18
|
+
// no-op below), not a failure to report.
|
|
19
|
+
const pushNotifications = await import('@molecule/api-push-notifications').catch((_error) => null);
|
|
18
20
|
if (!pushNotifications)
|
|
19
21
|
return;
|
|
20
22
|
const deviceService = get('device');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notify.js","sourceRoot":"","sources":["../../src/utilities/notify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAEnD,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;AAE1B;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,EAAE,EAC3B,MAAM,EACN,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,OAAO,GAQR,EAAiB,EAAE;IAClB,IAAI,CAAC;QACH,MAAM,iBAAiB,GAAG,MAAM,MAAM,CAAC,kCAAkC,CAAC,CAAC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"notify.js","sourceRoot":"","sources":["../../src/utilities/notify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAEnD,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;AAE1B;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,M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