@akanjs/signal 0.0.149 → 0.0.151
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/cjs/src/base.signal.js +107 -0
- package/cjs/src/fetch.js +28 -0
- package/cjs/src/index.js +2 -0
- package/esm/src/base.signal.js +90 -0
- package/esm/src/fetch.js +9 -0
- package/esm/src/index.js +2 -0
- package/package.json +1 -1
- package/src/base.signal.d.ts +20 -0
- package/src/fetch.d.ts +53 -0
- package/src/index.d.ts +2 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
19
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
20
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
21
|
+
if (decorator = decorators[i])
|
|
22
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
23
|
+
if (kind && result)
|
|
24
|
+
__defProp(target, key, result);
|
|
25
|
+
return result;
|
|
26
|
+
};
|
|
27
|
+
var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
|
|
28
|
+
var base_signal_exports = {};
|
|
29
|
+
__export(base_signal_exports, {
|
|
30
|
+
BaseSignal: () => BaseSignal
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(base_signal_exports);
|
|
33
|
+
var import_base = require("@akanjs/base");
|
|
34
|
+
var import_constant = require("@akanjs/constant");
|
|
35
|
+
var import_signalDecorators = require("./signalDecorators");
|
|
36
|
+
let BaseSignal = class extends (0, import_signalDecorators.LogSignal)(import_constant.Srvs) {
|
|
37
|
+
ping() {
|
|
38
|
+
return (0, import_signalDecorators.resolve)("ping");
|
|
39
|
+
}
|
|
40
|
+
pingBody(data) {
|
|
41
|
+
return (0, import_signalDecorators.resolve)(global.JSON.stringify(data));
|
|
42
|
+
}
|
|
43
|
+
pingParam(id) {
|
|
44
|
+
return (0, import_signalDecorators.resolve)(id);
|
|
45
|
+
}
|
|
46
|
+
pingQuery(id) {
|
|
47
|
+
return (0, import_signalDecorators.resolve)(id);
|
|
48
|
+
}
|
|
49
|
+
pingEvery() {
|
|
50
|
+
return (0, import_signalDecorators.resolve)("pingEvery");
|
|
51
|
+
}
|
|
52
|
+
pingUser() {
|
|
53
|
+
return (0, import_signalDecorators.resolve)("pingUser");
|
|
54
|
+
}
|
|
55
|
+
pingAdmin() {
|
|
56
|
+
return (0, import_signalDecorators.resolve)("pingAdmin");
|
|
57
|
+
}
|
|
58
|
+
async cleanup() {
|
|
59
|
+
if (process.env.NODE_ENV !== "test")
|
|
60
|
+
throw new Error("cleanup is only available in test environment");
|
|
61
|
+
await this.baseService.cleanup();
|
|
62
|
+
return (0, import_signalDecorators.resolve)(true);
|
|
63
|
+
}
|
|
64
|
+
wsPing(data) {
|
|
65
|
+
return (0, import_signalDecorators.emit)(data);
|
|
66
|
+
}
|
|
67
|
+
pubsubPing() {
|
|
68
|
+
return (0, import_signalDecorators.subscribe)();
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
__decorateClass([
|
|
72
|
+
import_signalDecorators.Query.Public(() => String, { cache: 3e3 })
|
|
73
|
+
], BaseSignal.prototype, "ping", 1);
|
|
74
|
+
__decorateClass([
|
|
75
|
+
import_signalDecorators.Query.Public(() => String, { cache: 1e4 }),
|
|
76
|
+
__decorateParam(0, import_signalDecorators.Arg.Body("data", () => import_base.JSON))
|
|
77
|
+
], BaseSignal.prototype, "pingBody", 1);
|
|
78
|
+
__decorateClass([
|
|
79
|
+
import_signalDecorators.Query.Public(() => String, { cache: 1e4 }),
|
|
80
|
+
__decorateParam(0, import_signalDecorators.Arg.Param("id", () => String))
|
|
81
|
+
], BaseSignal.prototype, "pingParam", 1);
|
|
82
|
+
__decorateClass([
|
|
83
|
+
import_signalDecorators.Query.Public(() => String),
|
|
84
|
+
__decorateParam(0, import_signalDecorators.Arg.Query("id", () => String))
|
|
85
|
+
], BaseSignal.prototype, "pingQuery", 1);
|
|
86
|
+
__decorateClass([
|
|
87
|
+
import_signalDecorators.Query.Every(() => String)
|
|
88
|
+
], BaseSignal.prototype, "pingEvery", 1);
|
|
89
|
+
__decorateClass([
|
|
90
|
+
import_signalDecorators.Query.User(() => String)
|
|
91
|
+
], BaseSignal.prototype, "pingUser", 1);
|
|
92
|
+
__decorateClass([
|
|
93
|
+
import_signalDecorators.Query.Admin(() => String)
|
|
94
|
+
], BaseSignal.prototype, "pingAdmin", 1);
|
|
95
|
+
__decorateClass([
|
|
96
|
+
import_signalDecorators.Mutation.Public(() => Boolean)
|
|
97
|
+
], BaseSignal.prototype, "cleanup", 1);
|
|
98
|
+
__decorateClass([
|
|
99
|
+
import_signalDecorators.Message.Public(() => String),
|
|
100
|
+
__decorateParam(0, import_signalDecorators.Arg.Msg("data", () => String))
|
|
101
|
+
], BaseSignal.prototype, "wsPing", 1);
|
|
102
|
+
__decorateClass([
|
|
103
|
+
import_signalDecorators.Pubsub.Public(() => String)
|
|
104
|
+
], BaseSignal.prototype, "pubsubPing", 1);
|
|
105
|
+
BaseSignal = __decorateClass([
|
|
106
|
+
(0, import_signalDecorators.Signal)({ name: "Base" })
|
|
107
|
+
], BaseSignal);
|
package/cjs/src/fetch.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var fetch_exports = {};
|
|
19
|
+
__export(fetch_exports, {
|
|
20
|
+
fetch: () => fetch
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(fetch_exports);
|
|
23
|
+
var import_base = require("./base.signal");
|
|
24
|
+
var import_baseFetch = require("./baseFetch");
|
|
25
|
+
var import_gql = require("./gql");
|
|
26
|
+
const fetch = (0, import_gql.makeFetch)(import_baseFetch.baseFetch, {
|
|
27
|
+
...(0, import_gql.fetchOf)(import_base.BaseSignal)
|
|
28
|
+
});
|
package/cjs/src/index.js
CHANGED
|
@@ -28,3 +28,5 @@ __reExport(src_exports, require("./gql"), module.exports);
|
|
|
28
28
|
__reExport(src_exports, require("./signalDecorators"), module.exports);
|
|
29
29
|
__reExport(src_exports, require("./doc"), module.exports);
|
|
30
30
|
__reExport(src_exports, require("./baseFetch"), module.exports);
|
|
31
|
+
__reExport(src_exports, require("./base.signal"), module.exports);
|
|
32
|
+
__reExport(src_exports, require("./fetch"), module.exports);
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
4
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
5
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
|
+
if (decorator = decorators[i])
|
|
7
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
+
if (kind && result)
|
|
9
|
+
__defProp(target, key, result);
|
|
10
|
+
return result;
|
|
11
|
+
};
|
|
12
|
+
var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
|
|
13
|
+
import { JSON } from "@akanjs/base";
|
|
14
|
+
import { Srvs } from "@akanjs/constant";
|
|
15
|
+
import { Arg, emit, LogSignal, Message, Mutation, Pubsub, Query, resolve, Signal, subscribe } from "./signalDecorators";
|
|
16
|
+
let BaseSignal = class extends LogSignal(Srvs) {
|
|
17
|
+
ping() {
|
|
18
|
+
return resolve("ping");
|
|
19
|
+
}
|
|
20
|
+
pingBody(data) {
|
|
21
|
+
return resolve(global.JSON.stringify(data));
|
|
22
|
+
}
|
|
23
|
+
pingParam(id) {
|
|
24
|
+
return resolve(id);
|
|
25
|
+
}
|
|
26
|
+
pingQuery(id) {
|
|
27
|
+
return resolve(id);
|
|
28
|
+
}
|
|
29
|
+
pingEvery() {
|
|
30
|
+
return resolve("pingEvery");
|
|
31
|
+
}
|
|
32
|
+
pingUser() {
|
|
33
|
+
return resolve("pingUser");
|
|
34
|
+
}
|
|
35
|
+
pingAdmin() {
|
|
36
|
+
return resolve("pingAdmin");
|
|
37
|
+
}
|
|
38
|
+
async cleanup() {
|
|
39
|
+
if (process.env.NODE_ENV !== "test")
|
|
40
|
+
throw new Error("cleanup is only available in test environment");
|
|
41
|
+
await this.baseService.cleanup();
|
|
42
|
+
return resolve(true);
|
|
43
|
+
}
|
|
44
|
+
wsPing(data) {
|
|
45
|
+
return emit(data);
|
|
46
|
+
}
|
|
47
|
+
pubsubPing() {
|
|
48
|
+
return subscribe();
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
__decorateClass([
|
|
52
|
+
Query.Public(() => String, { cache: 3e3 })
|
|
53
|
+
], BaseSignal.prototype, "ping", 1);
|
|
54
|
+
__decorateClass([
|
|
55
|
+
Query.Public(() => String, { cache: 1e4 }),
|
|
56
|
+
__decorateParam(0, Arg.Body("data", () => JSON))
|
|
57
|
+
], BaseSignal.prototype, "pingBody", 1);
|
|
58
|
+
__decorateClass([
|
|
59
|
+
Query.Public(() => String, { cache: 1e4 }),
|
|
60
|
+
__decorateParam(0, Arg.Param("id", () => String))
|
|
61
|
+
], BaseSignal.prototype, "pingParam", 1);
|
|
62
|
+
__decorateClass([
|
|
63
|
+
Query.Public(() => String),
|
|
64
|
+
__decorateParam(0, Arg.Query("id", () => String))
|
|
65
|
+
], BaseSignal.prototype, "pingQuery", 1);
|
|
66
|
+
__decorateClass([
|
|
67
|
+
Query.Every(() => String)
|
|
68
|
+
], BaseSignal.prototype, "pingEvery", 1);
|
|
69
|
+
__decorateClass([
|
|
70
|
+
Query.User(() => String)
|
|
71
|
+
], BaseSignal.prototype, "pingUser", 1);
|
|
72
|
+
__decorateClass([
|
|
73
|
+
Query.Admin(() => String)
|
|
74
|
+
], BaseSignal.prototype, "pingAdmin", 1);
|
|
75
|
+
__decorateClass([
|
|
76
|
+
Mutation.Public(() => Boolean)
|
|
77
|
+
], BaseSignal.prototype, "cleanup", 1);
|
|
78
|
+
__decorateClass([
|
|
79
|
+
Message.Public(() => String),
|
|
80
|
+
__decorateParam(0, Arg.Msg("data", () => String))
|
|
81
|
+
], BaseSignal.prototype, "wsPing", 1);
|
|
82
|
+
__decorateClass([
|
|
83
|
+
Pubsub.Public(() => String)
|
|
84
|
+
], BaseSignal.prototype, "pubsubPing", 1);
|
|
85
|
+
BaseSignal = __decorateClass([
|
|
86
|
+
Signal({ name: "Base" })
|
|
87
|
+
], BaseSignal);
|
|
88
|
+
export {
|
|
89
|
+
BaseSignal
|
|
90
|
+
};
|
package/esm/src/fetch.js
ADDED
package/esm/src/index.js
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare const BaseSignal_base: import("@akanjs/base").Type<{
|
|
2
|
+
readonly baseService: import("@akanjs/service").BaseService;
|
|
3
|
+
}>;
|
|
4
|
+
export declare class BaseSignal extends BaseSignal_base {
|
|
5
|
+
ping(): string;
|
|
6
|
+
pingBody(data: string): string;
|
|
7
|
+
pingParam(id: string): string;
|
|
8
|
+
pingQuery(id: string): string;
|
|
9
|
+
pingEvery(): string;
|
|
10
|
+
pingUser(): string;
|
|
11
|
+
pingAdmin(): string;
|
|
12
|
+
cleanup(): Promise<string>;
|
|
13
|
+
wsPing(data: string): string & {
|
|
14
|
+
__Returns__: "Emit";
|
|
15
|
+
};
|
|
16
|
+
pubsubPing(): string & {
|
|
17
|
+
__Returns__: "Subscribe";
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export {};
|
package/src/fetch.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export declare const fetch: {
|
|
2
|
+
baseService: never;
|
|
3
|
+
ping: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
|
|
4
|
+
pingBody: (arg: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
|
|
5
|
+
pingParam: (arg: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
|
|
6
|
+
pingQuery: (arg: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
|
|
7
|
+
pingEvery: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
|
|
8
|
+
pingUser: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
|
|
9
|
+
pingAdmin: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
|
|
10
|
+
cleanup: import("./gql").RemoveInternalArgs<() => Promise<string>, Promise<string>>;
|
|
11
|
+
wsPing: ((arg: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => void) & ((arg: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string & {
|
|
12
|
+
__Returns__: "Emit";
|
|
13
|
+
}>);
|
|
14
|
+
pubsubPing: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string & {
|
|
15
|
+
__Returns__: "Subscribe";
|
|
16
|
+
}>;
|
|
17
|
+
listenWsPing: (handleEvent: (data: string & {
|
|
18
|
+
__Returns__: "Emit";
|
|
19
|
+
}) => any, options?: import("@akanjs/common").FetchPolicy) => () => void;
|
|
20
|
+
subscribePubsubPing: (onData: (data: string) => void, fetchPolicy?: import("@akanjs/common").FetchPolicy<any> | undefined) => () => void;
|
|
21
|
+
client: import("./client").Client;
|
|
22
|
+
clone: (option?: {
|
|
23
|
+
jwt: string | null;
|
|
24
|
+
}) => Omit<object & {
|
|
25
|
+
wsPing: ((arg: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => void) & ((arg: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string & {
|
|
26
|
+
__Returns__: "Emit";
|
|
27
|
+
}>);
|
|
28
|
+
listenWsPing: (handleEvent: (data: string & {
|
|
29
|
+
__Returns__: "Emit";
|
|
30
|
+
}) => any, options?: import("@akanjs/common").FetchPolicy) => () => void;
|
|
31
|
+
subscribePubsubPing: (onData: (data: string) => void, fetchPolicy?: import("@akanjs/common").FetchPolicy<any> | undefined) => () => void;
|
|
32
|
+
ping: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
|
|
33
|
+
pingBody: (arg: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
|
|
34
|
+
pingParam: (arg: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
|
|
35
|
+
pingQuery: (arg: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
|
|
36
|
+
pingEvery: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
|
|
37
|
+
pingUser: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
|
|
38
|
+
pingAdmin: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
|
|
39
|
+
cleanup: import("./gql").RemoveInternalArgs<() => Promise<string>, Promise<string>>;
|
|
40
|
+
pubsubPing: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string & {
|
|
41
|
+
__Returns__: "Subscribe";
|
|
42
|
+
}>;
|
|
43
|
+
baseService: never;
|
|
44
|
+
} & typeof globalThis.fetch & {
|
|
45
|
+
client: import("./client").Client;
|
|
46
|
+
clone: (option?: {
|
|
47
|
+
jwt?: string | null;
|
|
48
|
+
}) => any;
|
|
49
|
+
}, "client" | "clone"> & {
|
|
50
|
+
client: import("./client").Client;
|
|
51
|
+
clone: /*elided*/ any;
|
|
52
|
+
};
|
|
53
|
+
};
|