@edifice.io/event-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,34 @@
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 v, Logger as d } from "@nestjs/common";
5
+ import { firstValueFrom as u } from "rxjs";
6
+ var m = Object.getOwnPropertyDescriptor, p = (t, e, r, n) => {
7
+ for (var s = n > 1 ? void 0 : n ? m(e, r) : e, o = t.length - 1, i; o >= 0; o--)
8
+ (i = t[o]) && (s = i(s) || s);
9
+ return s;
10
+ };
11
+ let a = class {
12
+ constructor(t) {
13
+ g(this, "logger", new d(a.name));
14
+ this.natsClient = t, this.logger.log("Creating events service EventNatsServiceClient");
15
+ }
16
+ /**
17
+ * Creates and stores an event in the event store.
18
+ * This method can be called remotely via the broker messaging system.
19
+ */
20
+ async createAndStoreEvent(t) {
21
+ const e = "event.store.create";
22
+ this.logger.debug({ messageAddress: e }, "Sending request to NATS subject");
23
+ const r = Date.now(), n = await u(this.natsClient.send(e, t)), s = Date.now() - r;
24
+ if (this.logger.debug({ brokerAddress: e, duration: s }, "[nats][mttr]"), !n)
25
+ throw this.logger.warn({ messageAddress: e }, "No reply received for subject"), new Error("No reply received");
26
+ return n;
27
+ }
28
+ };
29
+ a = p([
30
+ v()
31
+ ], a);
32
+ export {
33
+ a as EventNatsServiceClient
34
+ };
@@ -0,0 +1 @@
1
+ (function(e,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("@nestjs/common"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@nestjs/common","rxjs"],t):(e=typeof globalThis<"u"?globalThis:e||self,t((e["@edifice"]=e["@edifice"]||{},e["@edifice"]["io/event-nest-client"]={}),e.NestjsCommon,e.rxjs))})(this,function(e,t,n){"use strict";var f=Object.defineProperty;var g=(e,t,n)=>t in e?f(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var v=(e,t,n)=>(g(e,typeof t!="symbol"?t+"":t,n),n);var u=Object.getOwnPropertyDescriptor,l=(d,r,i,c)=>{for(var s=c>1?void 0:c?u(r,i):r,o=d.length-1,a;o>=0;o--)(a=d[o])&&(s=a(s)||s);return s};e.EventNatsServiceClient=class{constructor(r){v(this,"logger",new t.Logger(e.EventNatsServiceClient.name));this.natsClient=r,this.logger.log("Creating events service EventNatsServiceClient")}async createAndStoreEvent(r){const i="event.store.create";this.logger.debug({messageAddress:i},"Sending request to NATS subject");const c=Date.now(),s=await n.firstValueFrom(this.natsClient.send(i,r)),o=Date.now()-c;if(this.logger.debug({brokerAddress:i,duration:o},"[nats][mttr]"),!s)throw this.logger.warn({messageAddress:i},"No reply received for subject"),new Error("No reply received");return s}},e.EventNatsServiceClient=l([t.Injectable()],e.EventNatsServiceClient),Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
@@ -0,0 +1,13 @@
1
+ import { ClientProxy } from '@nestjs/microservices';
2
+ import { CreateEventRequest, CreateEventResponse } from '@edifice.io/event-nest-api';
3
+ export declare class EventNatsServiceClient {
4
+ private readonly natsClient;
5
+ private readonly logger;
6
+ constructor(natsClient: ClientProxy);
7
+ /**
8
+ * Creates and stores an event in the event store.
9
+ * This method can be called remotely via the broker messaging system.
10
+ */
11
+ createAndStoreEvent(request: CreateEventRequest): Promise<CreateEventResponse>;
12
+ }
13
+ //# 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,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGtE,qBACa,sBAAsB;IAIrB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAFvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2C;gBAErC,UAAU,EAAE,WAAW;IAMpD;;;OAGG;IACG,mBAAmB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAgBrF"}
package/package.json CHANGED
@@ -1,6 +1,58 @@
1
1
  {
2
2
  "name": "@edifice.io/event-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 event-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/event-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.