@edifice.io/share-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,46 @@
1
+ var c = Object.defineProperty;
2
+ var l = (r, s, e) => s in r ? c(r, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[s] = e;
3
+ var i = (r, s, e) => (l(r, typeof s != "symbol" ? s + "" : s, e), e);
4
+ import { Injectable as u, Logger as h } from "@nestjs/common";
5
+ import { firstValueFrom as d } from "rxjs";
6
+ var p = Object.getOwnPropertyDescriptor, v = (r, s, e, n) => {
7
+ for (var t = n > 1 ? void 0 : n ? p(s, e) : s, o = r.length - 1, g; o >= 0; o--)
8
+ (g = r[o]) && (t = g(t) || t);
9
+ return t;
10
+ };
11
+ let a = class {
12
+ constructor(r) {
13
+ i(this, "logger", new h(a.name));
14
+ this.natsClient = r, this.logger.log("Creating events service ShareNatsServiceClient");
15
+ }
16
+ /**
17
+ * Removes shares of a group.
18
+ * The 'application' parameter of the subject is provided when the client is instantiated.
19
+ */
20
+ async removeGroupShares(r, s) {
21
+ const e = "share.group.remove." + s;
22
+ this.logger.debug({ messageAddress: e }, "Sending request to NATS subject");
23
+ const n = Date.now(), t = await d(this.natsClient.send(e, r)), o = Date.now() - n;
24
+ if (this.logger.debug({ brokerAddress: e, duration: o }, "[nats][mttr]"), !t)
25
+ throw this.logger.warn({ messageAddress: e }, "No reply received for subject"), new Error("No reply received");
26
+ return t;
27
+ }
28
+ /**
29
+ * Upserts shares of a group.
30
+ * The 'application' parameter of the subject is provided when the client is instantiated.
31
+ */
32
+ async upsertGroupShares(r, s) {
33
+ const e = "share.group.upsert." + s;
34
+ this.logger.debug({ messageAddress: e }, "Sending request to NATS subject");
35
+ const n = Date.now(), t = await d(this.natsClient.send(e, r)), o = Date.now() - n;
36
+ if (this.logger.debug({ brokerAddress: e, duration: o }, "[nats][mttr]"), !t)
37
+ throw this.logger.warn({ messageAddress: e }, "No reply received for subject"), new Error("No reply received");
38
+ return t;
39
+ }
40
+ };
41
+ a = v([
42
+ u()
43
+ ], a);
44
+ export {
45
+ a as ShareNatsServiceClient
46
+ };
@@ -0,0 +1 @@
1
+ (function(e,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):(e=typeof globalThis<"u"?globalThis:e||self,r((e["@edifice"]=e["@edifice"]||{},e["@edifice"]["io/share-nest-client"]={}),e.NestjsCommon,e.rxjs))})(this,function(e,r,n){"use strict";var h=Object.defineProperty;var f=(e,r,n)=>r in e?h(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n;var u=(e,r,n)=>(f(e,typeof r!="symbol"?r+"":r,n),n);var g=Object.getOwnPropertyDescriptor,l=(c,i,d,t)=>{for(var o=t>1?void 0:t?g(i,d):i,s=c.length-1,a;s>=0;s--)(a=c[s])&&(o=a(o)||o);return o};e.ShareNatsServiceClient=class{constructor(i){u(this,"logger",new r.Logger(e.ShareNatsServiceClient.name));this.natsClient=i,this.logger.log("Creating events service ShareNatsServiceClient")}async removeGroupShares(i,d){const t="share.group.remove."+d;this.logger.debug({messageAddress:t},"Sending request to NATS subject");const o=Date.now(),s=await n.firstValueFrom(this.natsClient.send(t,i)),a=Date.now()-o;if(this.logger.debug({brokerAddress:t,duration:a},"[nats][mttr]"),!s)throw this.logger.warn({messageAddress:t},"No reply received for subject"),new Error("No reply received");return s}async upsertGroupShares(i,d){const t="share.group.upsert."+d;this.logger.debug({messageAddress:t},"Sending request to NATS subject");const o=Date.now(),s=await n.firstValueFrom(this.natsClient.send(t,i)),a=Date.now()-o;if(this.logger.debug({brokerAddress:t,duration:a},"[nats][mttr]"),!s)throw this.logger.warn({messageAddress:t},"No reply received for subject"),new Error("No reply received");return s}},e.ShareNatsServiceClient=l([r.Injectable()],e.ShareNatsServiceClient),Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
@@ -0,0 +1,18 @@
1
+ import { ClientProxy } from '@nestjs/microservices';
2
+ import { RemoveGroupSharesRequest, RemoveGroupSharesResponse, UpsertGroupSharesRequest, UpsertGroupSharesResponse } from '@edifice.io/share-nest-api';
3
+ export declare class ShareNatsServiceClient {
4
+ private readonly natsClient;
5
+ private readonly logger;
6
+ constructor(natsClient: ClientProxy);
7
+ /**
8
+ * Removes shares of a group.
9
+ * The 'application' parameter of the subject is provided when the client is instantiated.
10
+ */
11
+ removeGroupShares(request: RemoveGroupSharesRequest, application: string): Promise<RemoveGroupSharesResponse>;
12
+ /**
13
+ * Upserts shares of a group.
14
+ * The 'application' parameter of the subject is provided when the client is instantiated.
15
+ */
16
+ upsertGroupShares(request: UpsertGroupSharesRequest, application: string): Promise<UpsertGroupSharesResponse>;
17
+ }
18
+ //# 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,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAE3E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAE5E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAE3E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAG5E,qBACa,sBAAsB;IAIrB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAFvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2C;gBAErC,UAAU,EAAE,WAAW;IAMpD;;;OAGG;IACG,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAgBnH;;;OAGG;IACG,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAgBpH"}
package/package.json CHANGED
@@ -1,6 +1,58 @@
1
1
  {
2
2
  "name": "@edifice.io/share-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 share-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/share-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.