@edifice.io/aiwiki-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.
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.umd.cjs +1 -0
- package/dist/nats/client.d.ts +10 -0
- package/dist/nats/client.d.ts.map +1 -0
- package/package.json +56 -3
- package/README.md +0 -3
package/dist/index.d.ts
ADDED
|
@@ -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,38 @@
|
|
|
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 d = (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 g } from "rxjs";
|
|
6
|
+
var p = Object.getOwnPropertyDescriptor, v = (t, e, r, s) => {
|
|
7
|
+
for (var n = s > 1 ? void 0 : s ? p(e, r) : e, i = t.length - 1, a; i >= 0; i--)
|
|
8
|
+
(a = t[i]) && (n = a(n) || n);
|
|
9
|
+
return n;
|
|
10
|
+
};
|
|
11
|
+
let o = class {
|
|
12
|
+
constructor(t) {
|
|
13
|
+
d(this, "logger", new w(o.name));
|
|
14
|
+
this.natsClient = t, this.logger.log("Creating events service AiwikiNatsServiceClient");
|
|
15
|
+
}
|
|
16
|
+
async updateWikiContent(t) {
|
|
17
|
+
const e = "ai.wiki.content.updated";
|
|
18
|
+
this.logger.debug({ messageAddress: e }, "Sending request to NATS subject");
|
|
19
|
+
const r = Date.now(), s = await g(this.natsClient.send(e, t)), n = Date.now() - r;
|
|
20
|
+
if (this.logger.debug({ brokerAddress: e, duration: n }, "[nats][mttr]"), !s)
|
|
21
|
+
throw this.logger.warn({ messageAddress: e }, "No reply received for subject"), new Error("No reply received");
|
|
22
|
+
return s;
|
|
23
|
+
}
|
|
24
|
+
async updateWikiStructure(t) {
|
|
25
|
+
const e = "ai.wiki.structure.updated";
|
|
26
|
+
this.logger.debug({ messageAddress: e }, "Sending request to NATS subject");
|
|
27
|
+
const r = Date.now(), s = await g(this.natsClient.send(e, t)), n = Date.now() - r;
|
|
28
|
+
if (this.logger.debug({ brokerAddress: e, duration: n }, "[nats][mttr]"), !s)
|
|
29
|
+
throw this.logger.warn({ messageAddress: e }, "No reply received for subject"), new Error("No reply received");
|
|
30
|
+
return s;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
o = v([
|
|
34
|
+
u()
|
|
35
|
+
], o);
|
|
36
|
+
export {
|
|
37
|
+
o as AiwikiNatsServiceClient
|
|
38
|
+
};
|
|
@@ -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/aiwiki-nest-client"]={}),e.NestjsCommon,e.rxjs))})(this,function(e,t,r){"use strict";var w=Object.defineProperty;var f=(e,t,r)=>t in e?w(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var u=(e,t,r)=>(f(e,typeof t!="symbol"?t+"":t,r),r);var g=Object.getOwnPropertyDescriptor,l=(a,n,i,d)=>{for(var s=d>1?void 0:d?g(n,i):n,o=a.length-1,c;o>=0;o--)(c=a[o])&&(s=c(s)||s);return s};e.AiwikiNatsServiceClient=class{constructor(n){u(this,"logger",new t.Logger(e.AiwikiNatsServiceClient.name));this.natsClient=n,this.logger.log("Creating events service AiwikiNatsServiceClient")}async updateWikiContent(n){const i="ai.wiki.content.updated";this.logger.debug({messageAddress:i},"Sending request to NATS subject");const d=Date.now(),s=await r.firstValueFrom(this.natsClient.send(i,n)),o=Date.now()-d;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}async updateWikiStructure(n){const i="ai.wiki.structure.updated";this.logger.debug({messageAddress:i},"Sending request to NATS subject");const d=Date.now(),s=await r.firstValueFrom(this.natsClient.send(i,n)),o=Date.now()-d;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.AiwikiNatsServiceClient=l([t.Injectable()],e.AiwikiNatsServiceClient),Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ClientProxy } from '@nestjs/microservices';
|
|
2
|
+
import { BaseResponse } from '@edifice.io/aiwiki-nest-api';
|
|
3
|
+
export declare class AiwikiNatsServiceClient {
|
|
4
|
+
private readonly natsClient;
|
|
5
|
+
private readonly logger;
|
|
6
|
+
constructor(natsClient: ClientProxy);
|
|
7
|
+
updateWikiContent(request: BaseResponse): Promise<BaseResponse>;
|
|
8
|
+
updateWikiStructure(request: BaseResponse): Promise<BaseResponse>;
|
|
9
|
+
}
|
|
10
|
+
//# 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,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGhE,qBACa,uBAAuB;IAItB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAFvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4C;gBAEtC,UAAU,EAAE,WAAW;IAM9C,iBAAiB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;IAgB/D,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;CAgBxE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,59 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edifice.io/aiwiki-nest-client",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Clients to interact with aiwiki-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/aiwiki-nest-api": "0.1.0",
|
|
32
|
+
"@edifice.io/common-nest": "0.1.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"husky": "9.0.11",
|
|
36
|
+
"prettier": "3.2.5",
|
|
37
|
+
"semantic-release": "23.0.2",
|
|
38
|
+
"typescript": "5.2.2",
|
|
39
|
+
"vite": "5.1.4",
|
|
40
|
+
"vite-plugin-dts": "4.3.0",
|
|
41
|
+
"rxjs": "7.8.1",
|
|
42
|
+
"@nestjs/common": "11.0.20",
|
|
43
|
+
"@nestjs/microservices": "11.0.20"
|
|
44
|
+
},
|
|
45
|
+
"lint-staged": {
|
|
46
|
+
"*.{js,ts,jsx,tsx,json,css,md}": "pnpm format"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"dev": "vite",
|
|
50
|
+
"build": "tsc && vite build",
|
|
51
|
+
"build:types": "tsc --build",
|
|
52
|
+
"preview": "vite preview",
|
|
53
|
+
"clean": "rm -Rf dist",
|
|
54
|
+
"format": "pnpm run format:write && pnpm run format:check",
|
|
55
|
+
"format:check": "npx prettier --check \"src/**/*.ts\"",
|
|
56
|
+
"format:write": "npx prettier --write \"src/**/*.ts\"",
|
|
57
|
+
"pre-commit": "pnpm run format"
|
|
58
|
+
}
|
|
6
59
|
}
|
package/README.md
DELETED