@skyiro/sky-client 0.1.0 → 0.1.1

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,33 @@
1
+ /**
2
+ * Mirrors Prisma `ProductKey` on the notifier service.
3
+ * Use these values when publishing events so callers stay aligned with server configuration.
4
+ */
5
+ export declare const ProductKey: {
6
+ readonly SkyPeople: "SkyPeople";
7
+ readonly SkyOnelogin: "SkyOnelogin";
8
+ readonly SkyPaper: "SkyPaper";
9
+ readonly SkyBill: "SkyBill";
10
+ };
11
+ export type ProductKey = (typeof ProductKey)[keyof typeof ProductKey];
12
+ /**
13
+ * Known notifier `Event.key` values from seed data (`prisma/data/events.yml`).
14
+ * Add entries here when new events are introduced on the server.
15
+ */
16
+ export declare const EventKey: {
17
+ readonly LOGIN: "LOGIN";
18
+ readonly PASSWORD_RESET: "PASSWORD_RESET";
19
+ readonly DOC_SIGN_REQUEST: "DOC_SIGN_REQUEST";
20
+ readonly DOC_SIGN_OTP: "DOC_SIGN_OTP";
21
+ readonly DOC_SIGN_COMPLETED: "DOC_SIGN_COMPLETED";
22
+ readonly DOC_SIGN_REJECTED: "DOC_SIGN_REJECTED";
23
+ readonly DOC_OVERDUE_NOTIFICATION: "DOC_OVERDUE_NOTIFICATION";
24
+ };
25
+ export type EventKey = (typeof EventKey)[keyof typeof EventKey];
26
+ /** Channels accepted by notifier `PublishEvent` (matches Prisma `NotificationChannel`). */
27
+ export declare const NotificationChannel: {
28
+ readonly SMS: "SMS";
29
+ readonly EMAIL: "EMAIL";
30
+ readonly PUSH: "PUSH";
31
+ readonly WHATSAPP: "WHATSAPP";
32
+ };
33
+ export type NotificationChannel = (typeof NotificationChannel)[keyof typeof NotificationChannel];
package/dist/enums.js CHANGED
@@ -31,3 +31,4 @@ exports.NotificationChannel = {
31
31
  PUSH: "PUSH",
32
32
  WHATSAPP: "WHATSAPP",
33
33
  };
34
+ //# sourceMappingURL=enums.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enums.js","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACU,QAAA,UAAU,GAAG;IACxB,SAAS,EAAE,WAAW;IACtB,WAAW,EAAE,aAAa;IAC1B,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;CACV,CAAC;AAIX;;;GAGG;AACU,QAAA,QAAQ,GAAG;IACtB,KAAK,EAAE,OAAO;IACd,cAAc,EAAE,gBAAgB;IAChC,gBAAgB,EAAE,kBAAkB;IACpC,YAAY,EAAE,cAAc;IAC5B,kBAAkB,EAAE,oBAAoB;IACxC,iBAAiB,EAAE,mBAAmB;IACtC,wBAAwB,EAAE,0BAA0B;CAC5C,CAAC;AAIX,2FAA2F;AAC9E,QAAA,mBAAmB,GAAG;IACjC,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,UAAU;CACZ,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from "./enums";
2
+ export * from "./types";
3
+ export { NotifierClient } from "./notifier-client";
4
+ export { ShortenerClient } from "./shortener-client";
package/dist/index.js CHANGED
@@ -21,3 +21,4 @@ var notifier_client_1 = require("./notifier-client");
21
21
  Object.defineProperty(exports, "NotifierClient", { enumerable: true, get: function () { return notifier_client_1.NotifierClient; } });
22
22
  var shortener_client_1 = require("./shortener-client");
23
23
  Object.defineProperty(exports, "ShortenerClient", { enumerable: true, get: function () { return shortener_client_1.ShortenerClient; } });
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,0CAAwB;AACxB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,uDAAqD;AAA5C,mHAAA,eAAe,OAAA"}
@@ -0,0 +1,11 @@
1
+ import type { ProductKey } from "./enums";
2
+ import type { PublishEmailEventRequest, PublishEventRequest, PublishEventResponse, PublishNotificationEventRequest } from "./types";
3
+ export declare class NotifierClient {
4
+ private readonly client;
5
+ private readonly defaultProductKey;
6
+ constructor(address: string, defaultProductKey: ProductKey);
7
+ publishEvent(data: PublishEventRequest): Promise<PublishEventResponse>;
8
+ publishEmailEvent(data: PublishEmailEventRequest): Promise<PublishEventResponse>;
9
+ publishNotificationEvent(data: PublishNotificationEventRequest): Promise<PublishEventResponse>;
10
+ close(): void;
11
+ }
@@ -1,41 +1,41 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NotifierClient = void 0;
4
- var grpc_js_1 = require("@grpc/grpc-js");
5
- var proto_loader_1 = require("@grpc/proto-loader");
6
- var node_path_1 = require("node:path");
4
+ const grpc_js_1 = require("@grpc/grpc-js");
5
+ const proto_loader_1 = require("@grpc/proto-loader");
6
+ const node_path_1 = require("node:path");
7
7
  function loadNotifierGrpc(address) {
8
- var protoPath = (0, node_path_1.resolve)(__dirname, "../proto/notifier.proto");
9
- var packageDefinition = (0, proto_loader_1.loadSync)(protoPath, {
8
+ const protoPath = (0, node_path_1.resolve)(__dirname, "../proto/notifier.proto");
9
+ const packageDefinition = (0, proto_loader_1.loadSync)(protoPath, {
10
10
  keepCase: false,
11
11
  longs: String,
12
12
  enums: String,
13
13
  defaults: true,
14
14
  oneofs: true,
15
15
  });
16
- var loaded = (0, grpc_js_1.loadPackageDefinition)(packageDefinition);
16
+ const loaded = (0, grpc_js_1.loadPackageDefinition)(packageDefinition);
17
17
  return new loaded.notifier.v1.NotifierService(address, grpc_js_1.ChannelCredentials.createInsecure());
18
18
  }
19
- var NotifierClient = /** @class */ (function () {
20
- function NotifierClient(address, defaultProductKey) {
19
+ class NotifierClient {
20
+ client;
21
+ defaultProductKey;
22
+ constructor(address, defaultProductKey) {
21
23
  this.client = loadNotifierGrpc(address);
22
24
  this.defaultProductKey = defaultProductKey;
23
25
  }
24
- NotifierClient.prototype.publishEvent = function (data) {
25
- var _this = this;
26
- var _a, _b, _c, _d;
27
- var productKey = (_a = data.productKey) !== null && _a !== void 0 ? _a : this.defaultProductKey;
28
- var grpcReq = {
26
+ publishEvent(data) {
27
+ const productKey = data.productKey ?? this.defaultProductKey;
28
+ const grpcReq = {
29
29
  tenantId: data.tenantId,
30
- productKey: productKey,
30
+ productKey,
31
31
  eventKey: data.eventKey,
32
32
  destinationAddress: data.destinationAddress,
33
- channel: (_b = data.channel) !== null && _b !== void 0 ? _b : "",
34
- payload: (_c = data.payload) !== null && _c !== void 0 ? _c : {},
35
- idempotencyKey: (_d = data.idempotencyKey) !== null && _d !== void 0 ? _d : "",
33
+ channel: data.channel ?? "",
34
+ payload: data.payload ?? {},
35
+ idempotencyKey: data.idempotencyKey ?? "",
36
36
  };
37
- return new Promise(function (resolvePromise, rejectPromise) {
38
- _this.client.PublishEvent(grpcReq, function (error, response) {
37
+ return new Promise((resolvePromise, rejectPromise) => {
38
+ this.client.PublishEvent(grpcReq, (error, response) => {
39
39
  if (error) {
40
40
  rejectPromise(error);
41
41
  return;
@@ -43,21 +43,19 @@ var NotifierClient = /** @class */ (function () {
43
43
  resolvePromise(response);
44
44
  });
45
45
  });
46
- };
47
- NotifierClient.prototype.publishEmailEvent = function (data) {
48
- var _this = this;
49
- var _a, _b, _c;
50
- var productKey = (_a = data.productKey) !== null && _a !== void 0 ? _a : this.defaultProductKey;
51
- var grpcReq = {
46
+ }
47
+ publishEmailEvent(data) {
48
+ const productKey = data.productKey ?? this.defaultProductKey;
49
+ const grpcReq = {
52
50
  tenantId: data.tenantId,
53
51
  recipient: data.recipient,
54
52
  templateKey: data.templateKey,
55
- payload: (_b = data.payload) !== null && _b !== void 0 ? _b : {},
56
- idempotencyKey: (_c = data.idempotencyKey) !== null && _c !== void 0 ? _c : "",
57
- productKey: productKey,
53
+ payload: data.payload ?? {},
54
+ idempotencyKey: data.idempotencyKey ?? "",
55
+ productKey,
58
56
  };
59
- return new Promise(function (resolvePromise, rejectPromise) {
60
- _this.client.PublishEmailEvent(grpcReq, function (error, response) {
57
+ return new Promise((resolvePromise, rejectPromise) => {
58
+ this.client.PublishEmailEvent(grpcReq, (error, response) => {
61
59
  if (error) {
62
60
  rejectPromise(error);
63
61
  return;
@@ -65,21 +63,19 @@ var NotifierClient = /** @class */ (function () {
65
63
  resolvePromise(response);
66
64
  });
67
65
  });
68
- };
69
- NotifierClient.prototype.publishNotificationEvent = function (data) {
70
- var _this = this;
71
- var _a, _b;
72
- var grpcReq = {
66
+ }
67
+ publishNotificationEvent(data) {
68
+ const grpcReq = {
73
69
  tenantId: data.tenantId,
74
70
  userId: data.userId,
75
71
  channel: data.channel,
76
72
  title: data.title,
77
73
  body: data.body,
78
- payload: (_a = data.payload) !== null && _a !== void 0 ? _a : {},
79
- idempotencyKey: (_b = data.idempotencyKey) !== null && _b !== void 0 ? _b : "",
74
+ payload: data.payload ?? {},
75
+ idempotencyKey: data.idempotencyKey ?? "",
80
76
  };
81
- return new Promise(function (resolvePromise, rejectPromise) {
82
- _this.client.PublishNotificationEvent(grpcReq, function (error, response) {
77
+ return new Promise((resolvePromise, rejectPromise) => {
78
+ this.client.PublishNotificationEvent(grpcReq, (error, response) => {
83
79
  if (error) {
84
80
  rejectPromise(error);
85
81
  return;
@@ -87,10 +83,10 @@ var NotifierClient = /** @class */ (function () {
87
83
  resolvePromise(response);
88
84
  });
89
85
  });
90
- };
91
- NotifierClient.prototype.close = function () {
86
+ }
87
+ close() {
92
88
  this.client.close();
93
- };
94
- return NotifierClient;
95
- }());
89
+ }
90
+ }
96
91
  exports.NotifierClient = NotifierClient;
92
+ //# sourceMappingURL=notifier-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notifier-client.js","sourceRoot":"","sources":["../src/notifier-client.ts"],"names":[],"mappings":";;;AAAA,2CAMuB;AACvB,qDAA8C;AAC9C,yCAAoC;AAqEpC,SAAS,gBAAgB,CAAC,OAAe;IACvC,MAAM,SAAS,GAAG,I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AAC;QAEF,OAAO,IAAI,OAAO,CAAC,CAAC,cAAc,EAAE,aAAa,EAAE,EAAE;YACnD,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;gBAChE,IAAI,KAAK,EAAE,CAAC;oBACV,aAAa,CAAC,KAAK,CAAC,CAAC;oBACrB,OAAO;gBACT,CAAC;gBACD,cAAc,CAAC,QAAQ,CAAC,CAAC;YAC3B,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED,KAAK;QACF,IAAI,CAAC,MAAiB,CAAC,KAAK,EAAE,CAAC;IAClC,CAAC;CACF;AAnFD,wCAmFC"}
@@ -0,0 +1,8 @@
1
+ import type { CreateShortUrlRequest, CreateShortUrlResponse, RetrieveShortUrlRequest, RetrieveShortUrlResponse } from "./types";
2
+ export declare class ShortenerClient {
3
+ private readonly client;
4
+ constructor(address: string);
5
+ createShortUrl(data: CreateShortUrlRequest): Promise<CreateShortUrlResponse>;
6
+ retrieveShortUrl(data: RetrieveShortUrlRequest): Promise<RetrieveShortUrlResponse>;
7
+ close(): void;
8
+ }
@@ -1,36 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ShortenerClient = void 0;
4
- var grpc_js_1 = require("@grpc/grpc-js");
5
- var proto_loader_1 = require("@grpc/proto-loader");
6
- var node_path_1 = require("node:path");
4
+ const grpc_js_1 = require("@grpc/grpc-js");
5
+ const proto_loader_1 = require("@grpc/proto-loader");
6
+ const node_path_1 = require("node:path");
7
7
  function loadShortenerGrpc(address) {
8
- var protoPath = (0, node_path_1.resolve)(__dirname, "../proto/shortener.proto");
9
- var packageDefinition = (0, proto_loader_1.loadSync)(protoPath, {
8
+ const protoPath = (0, node_path_1.resolve)(__dirname, "../proto/shortener.proto");
9
+ const packageDefinition = (0, proto_loader_1.loadSync)(protoPath, {
10
10
  keepCase: false,
11
11
  longs: String,
12
12
  enums: String,
13
13
  defaults: true,
14
14
  oneofs: true,
15
15
  });
16
- var loaded = (0, grpc_js_1.loadPackageDefinition)(packageDefinition);
16
+ const loaded = (0, grpc_js_1.loadPackageDefinition)(packageDefinition);
17
17
  return new loaded.shortener.Shortener(address, grpc_js_1.ChannelCredentials.createInsecure());
18
18
  }
19
- var ShortenerClient = /** @class */ (function () {
20
- function ShortenerClient(address) {
19
+ class ShortenerClient {
20
+ client;
21
+ constructor(address) {
21
22
  this.client = loadShortenerGrpc(address);
22
23
  }
23
- ShortenerClient.prototype.createShortUrl = function (data) {
24
- var _this = this;
25
- return new Promise(function (resolvePromise, rejectPromise) {
26
- var _a, _b, _c;
27
- _this.client.CreateShortUrl({
24
+ createShortUrl(data) {
25
+ return new Promise((resolvePromise, rejectPromise) => {
26
+ this.client.CreateShortUrl({
28
27
  url: data.url,
29
- customCode: (_a = data.customCode) !== null && _a !== void 0 ? _a : "",
28
+ customCode: data.customCode ?? "",
30
29
  ttlSeconds: data.ttlSeconds,
31
- expiresIn: (_b = data.expiresIn) !== null && _b !== void 0 ? _b : "",
32
- expiresAt: (_c = data.expiresAt) !== null && _c !== void 0 ? _c : "",
33
- }, function (error, response) {
30
+ expiresIn: data.expiresIn ?? "",
31
+ expiresAt: data.expiresAt ?? "",
32
+ }, (error, response) => {
34
33
  if (error) {
35
34
  rejectPromise(error);
36
35
  return;
@@ -38,11 +37,10 @@ var ShortenerClient = /** @class */ (function () {
38
37
  resolvePromise(response);
39
38
  });
40
39
  });
41
- };
42
- ShortenerClient.prototype.retrieveShortUrl = function (data) {
43
- var _this = this;
44
- return new Promise(function (resolvePromise, rejectPromise) {
45
- _this.client.RetrieveShortUrl(data, function (error, response) {
40
+ }
41
+ retrieveShortUrl(data) {
42
+ return new Promise((resolvePromise, rejectPromise) => {
43
+ this.client.RetrieveShortUrl(data, (error, response) => {
46
44
  if (error) {
47
45
  rejectPromise(error);
48
46
  return;
@@ -50,10 +48,10 @@ var ShortenerClient = /** @class */ (function () {
50
48
  resolvePromise(response);
51
49
  });
52
50
  });
53
- };
54
- ShortenerClient.prototype.close = function () {
51
+ }
52
+ close() {
55
53
  this.client.close();
56
- };
57
- return ShortenerClient;
58
- }());
54
+ }
55
+ }
59
56
  exports.ShortenerClient = ShortenerClient;
57
+ //# sourceMappingURL=shortener-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shortener-client.js","sourceRoot":"","sources":["../src/shortener-client.ts"],"names":[],"mappings":";;;AAAA,2CAMuB;AACvB,qDAA8C;AAC9C,yCAAoC;AAgCpC,SAAS,iBAAiB,CAAC,OAAe;IACxC,MAAM,SAAS,GAAG,IAAA,mBAAO,EAAC,SAAS,EAAE,0BAA0B,CAAC,CAAC;IACjE,MAAM,iBAAiB,GAAG,IAAA,uBAAQ,EAAC,SAAS,EAAE;QAC5C,QAAQ,EAAE,KAAK;QACf,KAAK,EAAE,MAAM;QACb,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,IAAI;KACb,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,IAAA,+BAAqB,EAClC,iBAAiB,CACoB,CAAC;IACxC,OAAO,IAAI,MAAM,CAAC,SAAS,CAAC,SAAS,CACnC,OAAO,EACP,4BAAkB,CAAC,cAAc,EAAE,CACpC,CAAC;AACJ,CAAC;AAED,MAAa,eAAe;IACT,MAAM,CAA4B;IAEnD,YAAY,OAAe;QACzB,IAAI,CAAC,MAAM,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;IAED,cAAc,CAAC,IAA2B;QACxC,OAAO,IAAI,OAAO,CAAC,CAAC,cAAc,EAAE,aAAa,EAAE,EAAE;YACnD,IAAI,CAAC,MAAM,CAAC,cAAc,CACxB;gBACE,GAAG,EAAE,IAAI,CAAC,GAAG;gBACb,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,EAAE;gBACjC,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,EAAE;gBAC/B,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,EAAE;aAChC,EACD,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;gBAClB,IAAI,KAAK,EAAE,CAAC;oBACV,aAAa,CAAC,KAAK,CAAC,CAAC;oBACrB,OAAO;gBACT,CAAC;gBACD,cAAc,CAAC,QAAQ,CAAC,CAAC;YAC3B,CAAC,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAED,gBAAgB,CACd,IAA6B;QAE7B,OAAO,IAAI,OAAO,CAAC,CAAC,cAAc,EAAE,aAAa,EAAE,EAAE;YACnD,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;gBACrD,IAAI,KAAK,EAAE,CAAC;oBACV,aAAa,CAAC,KAAK,CAAC,CAAC;oBACrB,OAAO;gBACT,CAAC;gBACD,cAAc,CAAC,QAAQ,CAAC,CAAC;YAC3B,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED,KAAK;QACF,IAAI,CAAC,MAAiB,CAAC,KAAK,EAAE,CAAC;IAClC,CAAC;CACF;AA7CD,0CA6CC"}
@@ -0,0 +1,59 @@
1
+ import type { EventKey, NotificationChannel, ProductKey } from "./enums";
2
+ export type PayloadMap = Record<string, string>;
3
+ export interface PublishEventRequest {
4
+ tenantId: string;
5
+ /** Defaults to the client’s constructor `defaultProductKey` when omitted. */
6
+ productKey?: ProductKey;
7
+ eventKey: EventKey;
8
+ destinationAddress: string[];
9
+ channel?: NotificationChannel;
10
+ payload?: PayloadMap;
11
+ idempotencyKey?: string;
12
+ }
13
+ export interface PublishEmailEventRequest {
14
+ tenantId: string;
15
+ recipient: string;
16
+ templateKey: string;
17
+ payload?: PayloadMap;
18
+ idempotencyKey?: string;
19
+ productKey?: ProductKey;
20
+ }
21
+ export interface PublishNotificationEventRequest {
22
+ tenantId: string;
23
+ userId: string;
24
+ channel: NotificationChannel;
25
+ title: string;
26
+ body: string;
27
+ payload?: PayloadMap;
28
+ idempotencyKey?: string;
29
+ }
30
+ export interface PublishEventResponse {
31
+ eventId: string;
32
+ queueJobId: string;
33
+ status: string;
34
+ }
35
+ export type CreateShortUrlRequest = {
36
+ url: string;
37
+ customCode?: string;
38
+ ttlSeconds?: number;
39
+ expiresIn?: string;
40
+ expiresAt?: string;
41
+ };
42
+ export type CreateShortUrlResponse = {
43
+ code: string;
44
+ shortUrl: string;
45
+ targetUrl: string;
46
+ expiresAt: string;
47
+ };
48
+ export type RetrieveShortUrlRequest = {
49
+ code: string;
50
+ };
51
+ export type RetrieveShortUrlResponse = {
52
+ found: boolean;
53
+ code: string;
54
+ targetUrl: string;
55
+ shortUrl: string;
56
+ createdAt: string;
57
+ expiresAt: string;
58
+ ttlSeconds: number;
59
+ };
package/dist/types.js CHANGED
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyiro/sky-client",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Skyiro internal gRPC clients: Notifier + URL shortener, with typed product and event keys",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",