@akanjs/signal 0.9.43 → 0.9.44

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.
@@ -34,6 +34,9 @@ var import_base = require("@akanjs/base");
34
34
  var import_constant = require("@akanjs/constant");
35
35
  var import_signalDecorators = require("./signalDecorators");
36
36
  let BaseSignal = class extends (0, import_signalDecorators.LogSignal)(import_constant.Srvs) {
37
+ publishPing() {
38
+ this.baseService.publishPing();
39
+ }
37
40
  ping() {
38
41
  return (0, import_signalDecorators.resolve)("ping");
39
42
  }
@@ -67,7 +70,14 @@ let BaseSignal = class extends (0, import_signalDecorators.LogSignal)(import_con
67
70
  pubsubPing() {
68
71
  return (0, import_signalDecorators.subscribe)();
69
72
  }
73
+ getDictionary(lang) {
74
+ const dictionary = this.baseService.getDictionary(lang);
75
+ return (0, import_signalDecorators.resolve)(dictionary);
76
+ }
70
77
  };
78
+ __decorateClass([
79
+ import_signalDecorators.Schedule.Interval(3e3)
80
+ ], BaseSignal.prototype, "publishPing", 1);
71
81
  __decorateClass([
72
82
  import_signalDecorators.Query.Public(() => String, { cache: 3e3 })
73
83
  ], BaseSignal.prototype, "ping", 1);
@@ -102,6 +112,10 @@ __decorateClass([
102
112
  __decorateClass([
103
113
  import_signalDecorators.Pubsub.Public(() => String)
104
114
  ], BaseSignal.prototype, "pubsubPing", 1);
115
+ __decorateClass([
116
+ import_signalDecorators.Query.Public(() => import_base.JSON),
117
+ __decorateParam(0, import_signalDecorators.Arg.Param("lang", () => String))
118
+ ], BaseSignal.prototype, "getDictionary", 1);
105
119
  BaseSignal = __decorateClass([
106
120
  (0, import_signalDecorators.Signal)({ name: "Base" })
107
121
  ], BaseSignal);
package/cjs/src/client.js CHANGED
@@ -38,6 +38,9 @@ class SocketIo {
38
38
  on(event, callback) {
39
39
  this.socket.on(event, callback);
40
40
  }
41
+ once(event, callback) {
42
+ this.socket.once(event, callback);
43
+ }
41
44
  removeListener(event, callback) {
42
45
  this.socket.removeListener(event, callback);
43
46
  }
@@ -284,7 +284,7 @@ const getScheduleCron = () => function(cron, signalOption = {}) {
284
284
  const metadataMap = getGqlMetaMapOnPrototype(prototype);
285
285
  metadataMap.set(key, {
286
286
  returns: () => import_base.JSON,
287
- signalOption: { enabled: true, ...signalOption, scheduleType: "cron", scheduleCron: cron },
287
+ signalOption: { enabled: true, lock: true, ...signalOption, scheduleType: "cron", scheduleCron: cron },
288
288
  key,
289
289
  descriptor,
290
290
  guards: ["None"],
@@ -298,7 +298,7 @@ const getScheduleInterval = () => function(interval, signalOption = {}) {
298
298
  const metadataMap = getGqlMetaMapOnPrototype(prototype);
299
299
  metadataMap.set(key, {
300
300
  returns: () => import_base.JSON,
301
- signalOption: { enabled: true, ...signalOption, scheduleType: "interval", scheduleTime: interval },
301
+ signalOption: { enabled: true, lock: true, ...signalOption, scheduleType: "interval", scheduleTime: interval },
302
302
  key,
303
303
  descriptor,
304
304
  guards: ["None"],
@@ -312,7 +312,7 @@ const getScheduleTimeout = () => function(timeout, signalOption = {}) {
312
312
  const metadataMap = getGqlMetaMapOnPrototype(prototype);
313
313
  metadataMap.set(key, {
314
314
  returns: () => import_base.JSON,
315
- signalOption: { enabled: true, ...signalOption, scheduleType: "timeout", scheduleTime: timeout },
315
+ signalOption: { enabled: true, lock: true, ...signalOption, scheduleType: "timeout", scheduleTime: timeout },
316
316
  key,
317
317
  descriptor,
318
318
  guards: ["None"],
@@ -12,8 +12,23 @@ var __decorateClass = (decorators, target, key, kind) => {
12
12
  var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
13
13
  import { JSON } from "@akanjs/base";
14
14
  import { Srvs } from "@akanjs/constant";
15
- import { Arg, emit, LogSignal, Message, Mutation, Pubsub, Query, resolve, Signal, subscribe } from "./signalDecorators";
15
+ import {
16
+ Arg,
17
+ emit,
18
+ LogSignal,
19
+ Message,
20
+ Mutation,
21
+ Pubsub,
22
+ Query,
23
+ resolve,
24
+ Schedule,
25
+ Signal,
26
+ subscribe
27
+ } from "./signalDecorators";
16
28
  let BaseSignal = class extends LogSignal(Srvs) {
29
+ publishPing() {
30
+ this.baseService.publishPing();
31
+ }
17
32
  ping() {
18
33
  return resolve("ping");
19
34
  }
@@ -47,7 +62,14 @@ let BaseSignal = class extends LogSignal(Srvs) {
47
62
  pubsubPing() {
48
63
  return subscribe();
49
64
  }
65
+ getDictionary(lang) {
66
+ const dictionary = this.baseService.getDictionary(lang);
67
+ return resolve(dictionary);
68
+ }
50
69
  };
70
+ __decorateClass([
71
+ Schedule.Interval(3e3)
72
+ ], BaseSignal.prototype, "publishPing", 1);
51
73
  __decorateClass([
52
74
  Query.Public(() => String, { cache: 3e3 })
53
75
  ], BaseSignal.prototype, "ping", 1);
@@ -82,6 +104,10 @@ __decorateClass([
82
104
  __decorateClass([
83
105
  Pubsub.Public(() => String)
84
106
  ], BaseSignal.prototype, "pubsubPing", 1);
107
+ __decorateClass([
108
+ Query.Public(() => JSON),
109
+ __decorateParam(0, Arg.Param("lang", () => String))
110
+ ], BaseSignal.prototype, "getDictionary", 1);
85
111
  BaseSignal = __decorateClass([
86
112
  Signal({ name: "Base" })
87
113
  ], BaseSignal);
package/esm/src/client.js CHANGED
@@ -16,6 +16,9 @@ class SocketIo {
16
16
  on(event, callback) {
17
17
  this.socket.on(event, callback);
18
18
  }
19
+ once(event, callback) {
20
+ this.socket.once(event, callback);
21
+ }
19
22
  removeListener(event, callback) {
20
23
  this.socket.removeListener(event, callback);
21
24
  }
@@ -224,7 +224,7 @@ const getScheduleCron = () => function(cron, signalOption = {}) {
224
224
  const metadataMap = getGqlMetaMapOnPrototype(prototype);
225
225
  metadataMap.set(key, {
226
226
  returns: () => JSON,
227
- signalOption: { enabled: true, ...signalOption, scheduleType: "cron", scheduleCron: cron },
227
+ signalOption: { enabled: true, lock: true, ...signalOption, scheduleType: "cron", scheduleCron: cron },
228
228
  key,
229
229
  descriptor,
230
230
  guards: ["None"],
@@ -238,7 +238,7 @@ const getScheduleInterval = () => function(interval, signalOption = {}) {
238
238
  const metadataMap = getGqlMetaMapOnPrototype(prototype);
239
239
  metadataMap.set(key, {
240
240
  returns: () => JSON,
241
- signalOption: { enabled: true, ...signalOption, scheduleType: "interval", scheduleTime: interval },
241
+ signalOption: { enabled: true, lock: true, ...signalOption, scheduleType: "interval", scheduleTime: interval },
242
242
  key,
243
243
  descriptor,
244
244
  guards: ["None"],
@@ -252,7 +252,7 @@ const getScheduleTimeout = () => function(timeout, signalOption = {}) {
252
252
  const metadataMap = getGqlMetaMapOnPrototype(prototype);
253
253
  metadataMap.set(key, {
254
254
  returns: () => JSON,
255
- signalOption: { enabled: true, ...signalOption, scheduleType: "timeout", scheduleTime: timeout },
255
+ signalOption: { enabled: true, lock: true, ...signalOption, scheduleType: "timeout", scheduleTime: timeout },
256
256
  key,
257
257
  descriptor,
258
258
  guards: ["None"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/signal",
3
- "version": "0.9.43",
3
+ "version": "0.9.44",
4
4
  "sourceType": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -2,6 +2,7 @@ declare const BaseSignal_base: import("@akanjs/base").Type<{
2
2
  readonly baseService: import("@akanjs/service").BaseService;
3
3
  }>;
4
4
  export declare class BaseSignal extends BaseSignal_base {
5
+ publishPing(): void;
5
6
  ping(): string;
6
7
  pingBody(data: string): string;
7
8
  pingParam(id: string): string;
@@ -16,5 +17,6 @@ export declare class BaseSignal extends BaseSignal_base {
16
17
  pubsubPing(): string & {
17
18
  __Returns__: "Subscribe";
18
19
  };
20
+ getDictionary(lang: string): Record<string, Record<string, string>>;
19
21
  }
20
22
  export {};
package/src/client.d.ts CHANGED
@@ -13,6 +13,7 @@ declare class SocketIo {
13
13
  roomSubscribeMap: Map<string, SubscribeOption>;
14
14
  constructor(uri: string);
15
15
  on(event: string, callback: (data: any) => void): void;
16
+ once(event: string, callback: (data: any) => void): void;
16
17
  removeListener(event: string, callback?: (data: any) => void): void;
17
18
  removeAllListeners(): void;
18
19
  hasListeners(event: string): boolean;
package/src/fetch.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export declare const fetch: {
2
+ publishPing: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<void>;
2
3
  ping: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
3
4
  pingBody: (args_0: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
4
5
  pingParam: (args_0: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
@@ -8,6 +9,7 @@ export declare const fetch: {
8
9
  pingAdmin: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
9
10
  cleanup: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
10
11
  wsPing: (args_0: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => void;
12
+ getDictionary: (args_0: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<Record<string, Record<string, string>>>;
11
13
  listenWsPing: (handleEvent: (data: string & {
12
14
  __Returns__: "Emit";
13
15
  }) => any, options?: import("@akanjs/common").FetchPolicy) => () => void;
@@ -25,6 +27,7 @@ export declare const fetch: {
25
27
  subscribePubsubPing: (onData: (data: Omit<string & {
26
28
  __Returns__: "Subscribe";
27
29
  }, "__Returns__">) => void, fetchPolicy?: import("@akanjs/common").FetchPolicy<any> | undefined) => () => void;
30
+ publishPing: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<void>;
28
31
  ping: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
29
32
  pingBody: (args_0: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
30
33
  pingParam: (args_0: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
@@ -33,6 +36,7 @@ export declare const fetch: {
33
36
  pingUser: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
34
37
  pingAdmin: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
35
38
  cleanup: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
39
+ getDictionary: (args_0: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<Record<string, Record<string, string>>>;
36
40
  } & typeof globalThis.fetch & {
37
41
  client: import("./client").Client;
38
42
  clone: (option?: {
package/src/gql.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { DataList, type MergeAll, type MergedValues, type Prettify, type PromiseOrObject, Type, Upload } from "@akanjs/base";
1
+ import { DataList, type GetActionObject, type GetStateObject, type MergeAll, type MergedValues, type Prettify, type PromiseOrObject, Type, Upload } from "@akanjs/base";
2
2
  import { FetchPolicy } from "@akanjs/common";
3
- import { ConstantModel, DefaultOf, DocumentModel, FilterType, type GetActionObject, GetStateObject, ProtoFile, QueryOf, type ScalarConstantModel, SortOf } from "@akanjs/constant";
3
+ import { ConstantModel, DefaultOf, DocumentModel, FilterType, ProtoFile, QueryOf, type ScalarConstantModel, SortOf } from "@akanjs/constant";
4
4
  import { type Client } from ".";
5
5
  import { type ArgMeta, type DefaultSignal, type GqlMeta, type SliceMeta } from "./signalDecorators";
6
6
  export declare class GqlStorage {
@@ -116,13 +116,13 @@ type InitMethods<T extends string, Input, Full, Light extends {
116
116
  type DynamicListMethodsOfKey<T extends string, Input, Full, Light extends {
117
117
  id: string;
118
118
  }, Insight, Filter extends FilterType, Suffix extends string, QueryArgs extends any[], _CapitalizedT extends string = Capitalize<T>, _DefaultInput = DefaultOf<Input>, _Sort = SortOf<Filter>> = {
119
- [Key in `init${_CapitalizedT}${Suffix}`]: (...args: [...queryArgs: QueryArgs, option?: FetchOption<Input, Full, Filter, _DefaultInput, _Sort>]) => {
119
+ [Key in `init${_CapitalizedT}${Suffix}`]: (...args: [...queryArgs: QueryArgs, option?: FetchOption<Input, Full, Filter, _DefaultInput, _Sort>]) => Promise<{
120
120
  [P in `${T}Init${Suffix}`]: ServerInit<T, Light, Insight, QueryArgs, Filter, _CapitalizedT, _Sort>;
121
121
  } & {
122
122
  [P in `${T}List${Suffix}`]: DataList<Light>;
123
123
  } & {
124
124
  [P in `${T}Insight${Suffix}`]: Insight;
125
- };
125
+ }>;
126
126
  } & {
127
127
  [Key in `get${_CapitalizedT}Init${Suffix}`]: (...args: [...queryArgs: QueryArgs, option?: FetchOption<Input, Full, Filter, _DefaultInput, _Sort>]) => ClientInit<T, Light, Insight, QueryArgs, Filter, _CapitalizedT, _Sort>;
128
128
  };
@@ -188,7 +188,7 @@ export declare const gqlOf: <T extends string, Input, Full extends {
188
188
  id: string;
189
189
  }, Light extends {
190
190
  id: string;
191
- }, Insight, Summary, Filter extends FilterType, Signal, _CapitalizedT extends string, _Default, _DefaultInput, _DefaultState, _DefaultStateInput, _Doc, _DocInput, _QueryOfDoc, _Query, _Sort, _SignalAction = GetActionObject<Signal>>(constant: ConstantModel<T, Input, Full, Light, Insight, Filter, Summary, _CapitalizedT, _Default, _DefaultInput, _DefaultState, _DefaultStateInput, _Doc, _DocInput, _QueryOfDoc, _Query, _Sort>, sigRef: Type<Signal>, option?: {
191
+ }, Insight, Filter extends FilterType, Signal, _CapitalizedT extends string, _Default, _DefaultInput, _DefaultState, _DefaultStateInput, _Doc, _DocInput, _QueryOfDoc, _Query, _Sort, _SignalAction = GetActionObject<Signal>>(constant: ConstantModel<T, Input, Full, Light, Insight, Filter, _CapitalizedT, _Default, _DefaultInput, _DefaultState, _DefaultStateInput, _Doc, _DocInput, _QueryOfDoc, _Query, _Sort>, sigRef: Type<Signal>, option?: {
192
192
  overwrite?: {
193
193
  [key: string]: any;
194
194
  };