@edifice.io/timeline-nest-client 0.0.0-stage → 0.1.0

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,2 @@
1
+ export * from './nats/client';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,70 @@
1
+ var c = Object.defineProperty;
2
+ var l = (t, e, r) => e in t ? c(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
+ var g = (t, e, r) => (l(t, typeof e != "symbol" ? e + "" : e, r), r);
4
+ import { Injectable as u, Logger as w } from "@nestjs/common";
5
+ import { firstValueFrom as i } from "rxjs";
6
+ var m = Object.getOwnPropertyDescriptor, h = (t, e, r, s) => {
7
+ for (var n = s > 1 ? void 0 : s ? m(e, r) : e, o = t.length - 1, d; o >= 0; o--)
8
+ (d = t[o]) && (n = d(n) || n);
9
+ return n;
10
+ };
11
+ let a = class {
12
+ constructor(t) {
13
+ g(this, "logger", new w(a.name));
14
+ this.natsClient = t, this.logger.log("Creating events service TimelineNatsServiceClient");
15
+ }
16
+ /**
17
+ * Registers a new notification template in the Timeline system.
18
+ * The notification will be stored in the notificationsMap and be available for use.
19
+ */
20
+ async registerNotification(t) {
21
+ const e = "timeline.notification.register";
22
+ this.logger.debug({ messageAddress: e }, "Sending request to NATS subject");
23
+ const r = Date.now(), s = await i(this.natsClient.send(e, t)), n = Date.now() - r;
24
+ if (this.logger.debug({ brokerAddress: e, duration: n }, "[nats][mttr]"), !s)
25
+ throw this.logger.warn({ messageAddress: e }, "No reply received for subject"), new Error("No reply received");
26
+ return s;
27
+ }
28
+ /**
29
+ * Registers multiple notification templates in the Timeline system.
30
+ * The notifications will be stored in the notificationsMap and be available for use.
31
+ */
32
+ async registerNotifications(t) {
33
+ const e = "timeline.notification.register.batch";
34
+ this.logger.debug({ messageAddress: e }, "Sending request to NATS subject");
35
+ const r = Date.now(), s = await i(this.natsClient.send(e, t)), n = Date.now() - r;
36
+ if (this.logger.debug({ brokerAddress: e, duration: n }, "[nats][mttr]"), !s)
37
+ throw this.logger.warn({ messageAddress: e }, "No reply received for subject"), new Error("No reply received");
38
+ return s;
39
+ }
40
+ /**
41
+ * Registers timeline i18n files for the Timeline system.
42
+ * The translations will be stored in the shared timelineEventsI18n map and be available for notifications.
43
+ */
44
+ async registerTimelineI18n(t) {
45
+ const e = "timeline.i18n.register";
46
+ this.logger.debug({ messageAddress: e }, "Sending request to NATS subject");
47
+ const r = Date.now(), s = await i(this.natsClient.send(e, t)), n = Date.now() - r;
48
+ if (this.logger.debug({ brokerAddress: e, duration: n }, "[nats][mttr]"), !s)
49
+ throw this.logger.warn({ messageAddress: e }, "No reply received for subject"), new Error("No reply received");
50
+ return s;
51
+ }
52
+ /**
53
+ * Sends a notification to specified recipients.
54
+ * The notification can be sent as a timeline notification, email, and/or push notification.
55
+ */
56
+ async sendNotification(t) {
57
+ const e = "timeline.notification.send";
58
+ this.logger.debug({ messageAddress: e }, "Sending request to NATS subject");
59
+ const r = Date.now(), s = await i(this.natsClient.send(e, t)), n = Date.now() - r;
60
+ if (this.logger.debug({ brokerAddress: e, duration: n }, "[nats][mttr]"), !s)
61
+ throw this.logger.warn({ messageAddress: e }, "No reply received for subject"), new Error("No reply received");
62
+ return s;
63
+ }
64
+ };
65
+ a = h([
66
+ u()
67
+ ], a);
68
+ export {
69
+ a as TimelineNatsServiceClient
70
+ };
@@ -0,0 +1 @@
1
+ (function(t,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("@nestjs/common"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@nestjs/common","rxjs"],r):(t=typeof globalThis<"u"?globalThis:t||self,r((t["@edifice"]=t["@edifice"]||{},t["@edifice"]["io/timeline-nest-client"]={}),t.NestjsCommon,t.rxjs))})(this,function(t,r,o){"use strict";var m=Object.defineProperty;var f=(t,r,o)=>r in t?m(t,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[r]=o;var g=(t,r,o)=>(f(t,typeof r!="symbol"?r+"":r,o),o);var l=Object.getOwnPropertyDescriptor,u=(a,i,e,d)=>{for(var s=d>1?void 0:d?l(i,e):i,n=a.length-1,c;n>=0;n--)(c=a[n])&&(s=c(s)||s);return s};t.TimelineNatsServiceClient=class{constructor(i){g(this,"logger",new r.Logger(t.TimelineNatsServiceClient.name));this.natsClient=i,this.logger.log("Creating events service TimelineNatsServiceClient")}async registerNotification(i){const e="timeline.notification.register";this.logger.debug({messageAddress:e},"Sending request to NATS subject");const d=Date.now(),s=await o.firstValueFrom(this.natsClient.send(e,i)),n=Date.now()-d;if(this.logger.debug({brokerAddress:e,duration:n},"[nats][mttr]"),!s)throw this.logger.warn({messageAddress:e},"No reply received for subject"),new Error("No reply received");return s}async registerNotifications(i){const e="timeline.notification.register.batch";this.logger.debug({messageAddress:e},"Sending request to NATS subject");const d=Date.now(),s=await o.firstValueFrom(this.natsClient.send(e,i)),n=Date.now()-d;if(this.logger.debug({brokerAddress:e,duration:n},"[nats][mttr]"),!s)throw this.logger.warn({messageAddress:e},"No reply received for subject"),new Error("No reply received");return s}async registerTimelineI18n(i){const e="timeline.i18n.register";this.logger.debug({messageAddress:e},"Sending request to NATS subject");const d=Date.now(),s=await o.firstValueFrom(this.natsClient.send(e,i)),n=Date.now()-d;if(this.logger.debug({brokerAddress:e,duration:n},"[nats][mttr]"),!s)throw this.logger.warn({messageAddress:e},"No reply received for subject"),new Error("No reply received");return s}async sendNotification(i){const e="timeline.notification.send";this.logger.debug({messageAddress:e},"Sending request to NATS subject");const d=Date.now(),s=await o.firstValueFrom(this.natsClient.send(e,i)),n=Date.now()-d;if(this.logger.debug({brokerAddress:e,duration:n},"[nats][mttr]"),!s)throw this.logger.warn({messageAddress:e},"No reply received for subject"),new Error("No reply received");return s}},t.TimelineNatsServiceClient=u([r.Injectable()],t.TimelineNatsServiceClient),Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
@@ -0,0 +1,28 @@
1
+ import { ClientProxy } from '@nestjs/microservices';
2
+ import { RegisterNotificationBatchRequest, RegisterNotificationRequest, RegisterNotificationResponse, RegisterTimelineI18nRequest, RegisterTimelineI18nResponse, SendNotificationRequest, SendNotificationResponse } from '@edifice.io/timeline-nest-api';
3
+ export declare class TimelineNatsServiceClient {
4
+ private readonly natsClient;
5
+ private readonly logger;
6
+ constructor(natsClient: ClientProxy);
7
+ /**
8
+ * Registers a new notification template in the Timeline system.
9
+ * The notification will be stored in the notificationsMap and be available for use.
10
+ */
11
+ registerNotification(request: RegisterNotificationRequest): Promise<RegisterNotificationResponse>;
12
+ /**
13
+ * Registers multiple notification templates in the Timeline system.
14
+ * The notifications will be stored in the notificationsMap and be available for use.
15
+ */
16
+ registerNotifications(request: RegisterNotificationBatchRequest): Promise<RegisterNotificationResponse>;
17
+ /**
18
+ * Registers timeline i18n files for the Timeline system.
19
+ * The translations will be stored in the shared timelineEventsI18n map and be available for notifications.
20
+ */
21
+ registerTimelineI18n(request: RegisterTimelineI18nRequest): Promise<RegisterTimelineI18nResponse>;
22
+ /**
23
+ * Sends a notification to specified recipients.
24
+ * The notification can be sent as a timeline notification, email, and/or push notification.
25
+ */
26
+ sendNotification(request: SendNotificationRequest): Promise<SendNotificationResponse>;
27
+ }
28
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/nats/client.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,+BAA+B,CAAC;AAEtF,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAEjF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAElF,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAEjF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAElF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAE7E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAG9E,qBACa,yBAAyB;IAIxB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAFvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA8C;gBAExC,UAAU,EAAE,WAAW;IAMpD;;;OAGG;IACG,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,4BAA4B,CAAC;IAgBvG;;;OAGG;IACG,qBAAqB,CAAC,OAAO,EAAE,gCAAgC,GAAG,OAAO,CAAC,4BAA4B,CAAC;IAgB7G;;;OAGG;IACG,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,4BAA4B,CAAC;IAgBvG;;;OAGG;IACG,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,wBAAwB,CAAC;CAgB5F"}
package/package.json CHANGED
@@ -1,6 +1,58 @@
1
1
  {
2
2
  "name": "@edifice.io/timeline-nest-client",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "Clients to interact with timeline-nats-service",
5
+ "private": false,
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "keywords": [],
10
+ "author": "Edifice",
11
+ "license": "AGPL-3.0",
12
+ "engines": {
13
+ "node": "22"
14
+ },
15
+ "engineStrict": true,
16
+ "type": "module",
17
+ "exports": {
18
+ ".": {
19
+ "require": "./dist/index.umd.cjs",
20
+ "import": "./dist/index.js",
21
+ "types": "./dist/index.d.ts"
22
+ }
23
+ },
24
+ "main": "dist/index.umd.cjs",
25
+ "module": "dist/index.js",
26
+ "types": "dist/index.d.ts",
27
+ "files": [
28
+ "dist"
29
+ ],
30
+ "dependencies": {
31
+ "@edifice.io/timeline-nest-api": "0.1.0"
32
+ },
33
+ "devDependencies": {
34
+ "husky": "9.0.11",
35
+ "prettier": "3.2.5",
36
+ "semantic-release": "23.0.2",
37
+ "typescript": "5.2.2",
38
+ "vite": "5.1.4",
39
+ "vite-plugin-dts": "4.3.0",
40
+ "rxjs": "7.8.1",
41
+ "@nestjs/common": "11.0.20",
42
+ "@nestjs/microservices": "11.0.20"
43
+ },
44
+ "lint-staged": {
45
+ "*.{js,ts,jsx,tsx,json,css,md}": "pnpm format"
46
+ },
47
+ "scripts": {
48
+ "dev": "vite",
49
+ "build": "tsc && vite build",
50
+ "build:types": "tsc --build",
51
+ "preview": "vite preview",
52
+ "clean": "rm -Rf dist",
53
+ "format": "pnpm run format:write && pnpm run format:check",
54
+ "format:check": "npx prettier --check \"src/**/*.ts\"",
55
+ "format:write": "npx prettier --write \"src/**/*.ts\"",
56
+ "pre-commit": "pnpm run format"
57
+ }
6
58
  }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.