@edifice.io/aifalc-nest-client 0.0.0-stage → 0.2.2

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,44 @@
1
+ var l = Object.defineProperty;
2
+ var d = (r, e, t) => e in r ? l(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var i = (r, e, t) => (d(r, typeof e != "symbol" ? e + "" : e, t), t);
4
+ import { Injectable as u, Logger as v } from "@nestjs/common";
5
+ import { firstValueFrom as g } from "rxjs";
6
+ var w = Object.getOwnPropertyDescriptor, f = (r, e, t, s) => {
7
+ for (var n = s > 1 ? void 0 : s ? w(e, t) : e, a = r.length - 1, c; a >= 0; a--)
8
+ (c = r[a]) && (n = c(n) || n);
9
+ return n;
10
+ };
11
+ let o = class {
12
+ constructor(r) {
13
+ i(this, "logger", new v(o.name));
14
+ this.natsClient = r, this.logger.log("Creating events service AifalcNatsServiceClient");
15
+ }
16
+ /**
17
+ * Simplifies a text.
18
+ */
19
+ async createFalc(r) {
20
+ const e = "ia.falc.v1.create";
21
+ this.logger.debug({ messageAddress: e }, "Sending request to NATS subject");
22
+ const t = Date.now(), s = await g(this.natsClient.send(e, r)), n = Date.now() - t;
23
+ if (this.logger.debug({ brokerAddress: e, duration: n }, "[nats][mttr]"), !s)
24
+ throw this.logger.warn({ messageAddress: e }, "No reply received for subject"), new Error("No reply received");
25
+ return s;
26
+ }
27
+ /**
28
+ * Simplifies a text. Kept for the platforms that still call the subject without version.
29
+ */
30
+ async createFalcLegacy(r) {
31
+ const e = "ia.falc.create";
32
+ this.logger.debug({ messageAddress: e }, "Sending request to NATS subject");
33
+ const t = Date.now(), s = await g(this.natsClient.send(e, r)), n = Date.now() - t;
34
+ if (this.logger.debug({ brokerAddress: e, duration: n }, "[nats][mttr]"), !s)
35
+ throw this.logger.warn({ messageAddress: e }, "No reply received for subject"), new Error("No reply received");
36
+ return s;
37
+ }
38
+ };
39
+ o = f([
40
+ u()
41
+ ], o);
42
+ export {
43
+ o as AifalcNatsServiceClient
44
+ };
@@ -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/aifalc-nest-client"]={}),e.NestjsCommon,e.rxjs))})(this,function(e,t,i){"use strict";var u=Object.defineProperty;var v=(e,t,i)=>t in e?u(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var l=(e,t,i)=>(v(e,typeof t!="symbol"?t+"":t,i),i);var f=Object.getOwnPropertyDescriptor,g=(o,n,s,c)=>{for(var r=c>1?void 0:c?f(n,s):n,a=o.length-1,d;a>=0;a--)(d=o[a])&&(r=d(r)||r);return r};e.AifalcNatsServiceClient=class{constructor(n){l(this,"logger",new t.Logger(e.AifalcNatsServiceClient.name));this.natsClient=n,this.logger.log("Creating events service AifalcNatsServiceClient")}async createFalc(n){const s="ia.falc.v1.create";this.logger.debug({messageAddress:s},"Sending request to NATS subject");const c=Date.now(),r=await i.firstValueFrom(this.natsClient.send(s,n)),a=Date.now()-c;if(this.logger.debug({brokerAddress:s,duration:a},"[nats][mttr]"),!r)throw this.logger.warn({messageAddress:s},"No reply received for subject"),new Error("No reply received");return r}async createFalcLegacy(n){const s="ia.falc.create";this.logger.debug({messageAddress:s},"Sending request to NATS subject");const c=Date.now(),r=await i.firstValueFrom(this.natsClient.send(s,n)),a=Date.now()-c;if(this.logger.debug({brokerAddress:s,duration:a},"[nats][mttr]"),!r)throw this.logger.warn({messageAddress:s},"No reply received for subject"),new Error("No reply received");return r}},e.AifalcNatsServiceClient=g([t.Injectable()],e.AifalcNatsServiceClient),Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
@@ -0,0 +1,16 @@
1
+ import { ClientProxy } from '@nestjs/microservices';
2
+ import { ContentRequest, ContentResponse } from '@edifice.io/aifalc-nest-api';
3
+ export declare class AifalcNatsServiceClient {
4
+ private readonly natsClient;
5
+ private readonly logger;
6
+ constructor(natsClient: ClientProxy);
7
+ /**
8
+ * Simplifies a text.
9
+ */
10
+ createFalc(request: ContentRequest): Promise<ContentResponse>;
11
+ /**
12
+ * Simplifies a text. Kept for the platforms that still call the subject without version.
13
+ */
14
+ createFalcLegacy(request: ContentRequest): Promise<ContentResponse>;
15
+ }
16
+ //# 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,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAElE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAGnE,qBACa,uBAAuB;IAItB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAFvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4C;gBAEtC,UAAU,EAAE,WAAW;IAMpD;;OAEG;IACG,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IAgBnE;;OAEG;IACG,gBAAgB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;CAgB1E"}
package/package.json CHANGED
@@ -1,6 +1,58 @@
1
1
  {
2
2
  "name": "@edifice.io/aifalc-nest-client",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.2.2",
4
+ "description": "Clients to interact with aifalc-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/aifalc-nest-api": "0.2.2"
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.