@akanjs/signal 0.9.47 → 0.9.49
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/apiInfo.js +167 -0
- package/cjs/src/base.signal.js +55 -93
- package/cjs/src/baseFetch.js +1 -2
- package/cjs/src/fetch.js +2 -0
- package/cjs/src/fetchInfo.js +364 -0
- package/cjs/src/gql.js +7 -762
- package/cjs/src/graphql.js +125 -0
- package/cjs/src/index.js +5 -0
- package/cjs/src/internalApiInfo.js +151 -0
- package/cjs/src/signalDecorators.js +114 -148
- package/cjs/src/signalInfo.js +185 -0
- package/cjs/src/sliceInfo.js +193 -0
- package/esm/src/apiInfo.js +152 -0
- package/esm/src/base.signal.js +56 -108
- package/esm/src/baseFetch.js +1 -2
- package/esm/src/fetch.js +2 -0
- package/esm/src/fetchInfo.js +345 -0
- package/esm/src/gql.js +7 -784
- package/esm/src/graphql.js +106 -0
- package/esm/src/index.js +5 -0
- package/esm/src/internalApiInfo.js +137 -0
- package/esm/src/signalDecorators.js +115 -152
- package/esm/src/signalInfo.js +174 -0
- package/esm/src/sliceInfo.js +178 -0
- package/package.json +1 -1
- package/src/apiInfo.d.ts +73 -0
- package/src/base.signal.d.ts +131 -19
- package/src/fetch.d.ts +10 -8
- package/src/fetchInfo.d.ts +19 -0
- package/src/gql.d.ts +12 -48
- package/src/graphql.d.ts +9 -0
- package/src/index.d.ts +5 -0
- package/src/internalApiInfo.d.ts +74 -0
- package/src/signalDecorators.d.ts +71 -42
- package/src/signalInfo.d.ts +78 -0
- package/src/sliceInfo.d.ts +68 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { baseClientEnv, getNonArrayModel, scalarNameMap } from "@akanjs/base";
|
|
2
|
+
import { lowerlize } from "@akanjs/common";
|
|
3
|
+
import { constantInfo } from "@akanjs/constant";
|
|
4
|
+
import { client } from "./client";
|
|
5
|
+
import { databaseFetchOf, serviceFetchOf } from "./fetchInfo";
|
|
6
|
+
import {
|
|
7
|
+
getArgMetas,
|
|
8
|
+
getDefaultArg,
|
|
9
|
+
getGqlMetaMapOnPrototype,
|
|
10
|
+
getGqlMetas,
|
|
11
|
+
getSigMeta,
|
|
12
|
+
setSigMeta,
|
|
13
|
+
setSignalRefOnStorage
|
|
14
|
+
} from "./signalDecorators";
|
|
15
|
+
const signalInfo = {
|
|
16
|
+
database: /* @__PURE__ */ new Map(),
|
|
17
|
+
service: /* @__PURE__ */ new Map(),
|
|
18
|
+
serializedSignals: [],
|
|
19
|
+
setDatabase(refName, signal) {
|
|
20
|
+
signalInfo.database.set(refName, signal);
|
|
21
|
+
},
|
|
22
|
+
getDatabase(refName) {
|
|
23
|
+
return signalInfo.database.get(refName);
|
|
24
|
+
},
|
|
25
|
+
setRefNameTemp(sigRef, refName) {
|
|
26
|
+
Reflect.defineMetadata("signal:refName", refName, sigRef.prototype);
|
|
27
|
+
},
|
|
28
|
+
getRefNameTemp(sigRef) {
|
|
29
|
+
const refName = Reflect.getMetadata("signal:refName", sigRef.prototype);
|
|
30
|
+
if (!refName)
|
|
31
|
+
throw new Error("RefName Not Found");
|
|
32
|
+
return refName;
|
|
33
|
+
},
|
|
34
|
+
setPrefixTemp(sigRef, prefix) {
|
|
35
|
+
Reflect.defineMetadata("signal:prefix", prefix, sigRef.prototype);
|
|
36
|
+
},
|
|
37
|
+
getPrefixTemp(sigRef) {
|
|
38
|
+
const prefix = Reflect.getMetadata("signal:prefix", sigRef.prototype);
|
|
39
|
+
return prefix;
|
|
40
|
+
},
|
|
41
|
+
setHandlerKey(execFn, key) {
|
|
42
|
+
Reflect.defineMetadata("signal:key", key, execFn);
|
|
43
|
+
},
|
|
44
|
+
getHandlerKey(execFn) {
|
|
45
|
+
const key = Reflect.getMetadata("signal:key", execFn);
|
|
46
|
+
if (!key)
|
|
47
|
+
throw new Error("Handler key not found");
|
|
48
|
+
return key;
|
|
49
|
+
},
|
|
50
|
+
setService(refName, signal) {
|
|
51
|
+
signalInfo.service.set(refName, signal);
|
|
52
|
+
},
|
|
53
|
+
getService(refName) {
|
|
54
|
+
return signalInfo.service.get(refName);
|
|
55
|
+
},
|
|
56
|
+
registerSignals(...signals) {
|
|
57
|
+
signals.forEach((sigRef) => {
|
|
58
|
+
const refName = signalInfo.getRefNameTemp(sigRef);
|
|
59
|
+
const signalType = constantInfo.database.has(refName) ? "database" : "service";
|
|
60
|
+
if (signalType === "database")
|
|
61
|
+
signalInfo.setDatabase(refName, sigRef);
|
|
62
|
+
else
|
|
63
|
+
signalInfo.setService(refName, sigRef);
|
|
64
|
+
});
|
|
65
|
+
signals.forEach((sigRef) => {
|
|
66
|
+
const refName = signalInfo.getRefNameTemp(sigRef);
|
|
67
|
+
const prefix = signalInfo.getPrefixTemp(sigRef);
|
|
68
|
+
const databaseCnst = constantInfo.getDatabase(refName, { allowEmpty: true });
|
|
69
|
+
const scalarCnst = constantInfo.getScalar(refName, { allowEmpty: true });
|
|
70
|
+
if (databaseCnst) {
|
|
71
|
+
const gqlMetas = getGqlMetas(sigRef);
|
|
72
|
+
const modelName = refName;
|
|
73
|
+
const listName = `${modelName}ListIn`;
|
|
74
|
+
const slices = [
|
|
75
|
+
{ refName: modelName, sliceName: modelName, argLength: 1, defaultArgs: [{}] },
|
|
76
|
+
...gqlMetas.filter((gqlMeta) => {
|
|
77
|
+
const name = gqlMeta.signalOption.name ?? gqlMeta.key;
|
|
78
|
+
if (!name.includes(listName))
|
|
79
|
+
return false;
|
|
80
|
+
const [retRef, arrDepth] = getNonArrayModel(gqlMeta.returns());
|
|
81
|
+
return constantInfo.getRefName(retRef) === refName && arrDepth === 1;
|
|
82
|
+
}).map((gqlMeta) => {
|
|
83
|
+
const name = gqlMeta.signalOption.name ?? gqlMeta.key;
|
|
84
|
+
const sliceName = name.replace(listName, `${modelName}In`);
|
|
85
|
+
const [argMetas] = getArgMetas(sigRef, gqlMeta.key);
|
|
86
|
+
const skipIdx = argMetas.findIndex((argMeta) => argMeta.name === "skip");
|
|
87
|
+
if (skipIdx === -1)
|
|
88
|
+
throw new Error(`Invalid Args for ${sliceName}`);
|
|
89
|
+
const argLength = skipIdx;
|
|
90
|
+
const queryArgRefs = argMetas.slice(0, skipIdx).map((argMeta) => argMeta.returns());
|
|
91
|
+
const defaultArgs = queryArgRefs.map(
|
|
92
|
+
(queryArgRef, idx) => argMetas[idx].argsOption.nullable ? null : getDefaultArg(queryArgRef)
|
|
93
|
+
);
|
|
94
|
+
return { refName: modelName, sliceName, argLength, defaultArgs };
|
|
95
|
+
})
|
|
96
|
+
];
|
|
97
|
+
setSigMeta(sigRef, { returns: () => databaseCnst.full, prefix, slices, refName: modelName, enabled: true });
|
|
98
|
+
setSignalRefOnStorage(modelName, sigRef);
|
|
99
|
+
} else if (scalarCnst) {
|
|
100
|
+
setSigMeta(sigRef, { returns: () => scalarCnst.model, prefix, slices: [], refName, enabled: true });
|
|
101
|
+
setSignalRefOnStorage(refName, sigRef);
|
|
102
|
+
} else {
|
|
103
|
+
setSigMeta(sigRef, { returns: void 0, prefix, slices: [], refName, enabled: true });
|
|
104
|
+
setSignalRefOnStorage(refName, sigRef);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
return signals;
|
|
108
|
+
},
|
|
109
|
+
serialize(sigRef) {
|
|
110
|
+
const refName = signalInfo.getRefNameTemp(sigRef);
|
|
111
|
+
const { slices, prefix } = getSigMeta(sigRef);
|
|
112
|
+
const gqlMetaMap = getGqlMetaMapOnPrototype(sigRef.prototype);
|
|
113
|
+
const serializedSignal = { refName, slices, prefix, endpoint: {} };
|
|
114
|
+
gqlMetaMap.forEach((gqlMeta, key) => {
|
|
115
|
+
if (!["Query", "Mutation", "Pubsub", "Message"].includes(gqlMeta.type))
|
|
116
|
+
return;
|
|
117
|
+
const [argMetas] = getArgMetas(sigRef, key);
|
|
118
|
+
const [returnRef, arrDepth] = getNonArrayModel(gqlMeta.returns());
|
|
119
|
+
const isGqlScalar = scalarNameMap.has(returnRef);
|
|
120
|
+
const modelType = isGqlScalar ? "scalar" : constantInfo.getModelType(returnRef);
|
|
121
|
+
if (!["input", "full", "light", "insight", "scalar"].includes(modelType))
|
|
122
|
+
throw new Error(`Invalid model type: ${modelType}`);
|
|
123
|
+
const refName2 = isGqlScalar ? scalarNameMap.get(returnRef) : constantInfo.getRefName(returnRef);
|
|
124
|
+
serializedSignal.endpoint[key] = {
|
|
125
|
+
type: lowerlize(gqlMeta.type),
|
|
126
|
+
signalOption: gqlMeta.signalOption,
|
|
127
|
+
returns: { refName: refName2, modelType, arrDepth },
|
|
128
|
+
args: argMetas.map((argMeta) => {
|
|
129
|
+
const [argRef, arrDepth2] = getNonArrayModel(argMeta.returns());
|
|
130
|
+
const isGqlScalar2 = scalarNameMap.has(argRef);
|
|
131
|
+
const modelType2 = isGqlScalar2 ? "scalar" : constantInfo.getModelType(argRef);
|
|
132
|
+
if (!["input", "insight", "scalar"].includes(modelType2))
|
|
133
|
+
throw new Error(`Invalid model type: ${modelType2}`);
|
|
134
|
+
const refName3 = isGqlScalar2 ? scalarNameMap.get(argRef) : constantInfo.getRefName(argRef);
|
|
135
|
+
return {
|
|
136
|
+
type: argMeta.type,
|
|
137
|
+
refName: refName3,
|
|
138
|
+
modelType: modelType2,
|
|
139
|
+
name: argMeta.name,
|
|
140
|
+
argsOption: argMeta.argsOption,
|
|
141
|
+
arrDepth: arrDepth2
|
|
142
|
+
};
|
|
143
|
+
})
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
return serializedSignal;
|
|
147
|
+
},
|
|
148
|
+
initialize() {
|
|
149
|
+
const databaseSignals = [...signalInfo.database.values()].map((sigRef) => signalInfo.serialize(sigRef));
|
|
150
|
+
const serviceSignals = [...signalInfo.service.values()].map((sigRef) => signalInfo.serialize(sigRef));
|
|
151
|
+
signalInfo.serializedSignals = [...databaseSignals, ...serviceSignals];
|
|
152
|
+
return signalInfo.buildFetch(signalInfo.serializedSignals);
|
|
153
|
+
},
|
|
154
|
+
buildFetch(signals = [], cnstInfo = constantInfo) {
|
|
155
|
+
const databaseSignals = signals.filter((signal) => cnstInfo.database.has(signal.refName));
|
|
156
|
+
const serviceSignals = signals.filter((signal) => !cnstInfo.database.has(signal.refName));
|
|
157
|
+
const fetchComponent = Object.assign(
|
|
158
|
+
{ client },
|
|
159
|
+
...databaseSignals.map((signal) => databaseFetchOf(signal)),
|
|
160
|
+
...serviceSignals.map((signal) => serviceFetchOf(signal))
|
|
161
|
+
);
|
|
162
|
+
return Object.assign(global.fetch, fetchComponent);
|
|
163
|
+
},
|
|
164
|
+
registerClient: async (cnst) => {
|
|
165
|
+
const [signals] = await Promise.all([
|
|
166
|
+
(async () => await (await global.fetch(`${baseClientEnv.serverHttpUri}/getSignals`)).json())()
|
|
167
|
+
]);
|
|
168
|
+
signalInfo.buildFetch(signals);
|
|
169
|
+
return { fetch, signals };
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
export {
|
|
173
|
+
signalInfo
|
|
174
|
+
};
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { arraiedModel, Enum, getNonArrayModel, Int } from "@akanjs/base";
|
|
2
|
+
import { capitalize } from "@akanjs/common";
|
|
3
|
+
import {
|
|
4
|
+
getGqlMetaMapOnPrototype,
|
|
5
|
+
setArgMetas,
|
|
6
|
+
setGqlMetaMapOnPrototype
|
|
7
|
+
} from "./signalDecorators";
|
|
8
|
+
import { signalInfo } from "./signalInfo";
|
|
9
|
+
class SliceInfo {
|
|
10
|
+
full;
|
|
11
|
+
light;
|
|
12
|
+
insight;
|
|
13
|
+
args = [];
|
|
14
|
+
internalArgs = [];
|
|
15
|
+
signalOption;
|
|
16
|
+
guards;
|
|
17
|
+
execFn = null;
|
|
18
|
+
constructor(full, light, insight, signalOptionOrGuard, ...guards) {
|
|
19
|
+
this.full = full;
|
|
20
|
+
this.light = light;
|
|
21
|
+
this.insight = insight;
|
|
22
|
+
this.signalOption = typeof signalOptionOrGuard === "string" ? {} : signalOptionOrGuard ?? {};
|
|
23
|
+
this.guards = [
|
|
24
|
+
.../* @__PURE__ */ new Set([
|
|
25
|
+
...guards,
|
|
26
|
+
...typeof signalOptionOrGuard === "string" ? [signalOptionOrGuard] : ["Public"]
|
|
27
|
+
])
|
|
28
|
+
];
|
|
29
|
+
}
|
|
30
|
+
param(name, argRef, option) {
|
|
31
|
+
if (this.execFn)
|
|
32
|
+
throw new Error("Query function is already set");
|
|
33
|
+
else if (this.args.at(-1)?.option?.nullable)
|
|
34
|
+
throw new Error("Last argument is nullable");
|
|
35
|
+
this.args.push({ type: "Param", name, argRef, option });
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
body(name, argRef, option) {
|
|
39
|
+
if (this.execFn)
|
|
40
|
+
throw new Error("Query function is already set");
|
|
41
|
+
else if (this.args.at(-1)?.option?.nullable)
|
|
42
|
+
throw new Error("Last argument is nullable");
|
|
43
|
+
this.args.push({ type: "Body", name, argRef, option });
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
search(name, argRef, option) {
|
|
47
|
+
if (this.execFn)
|
|
48
|
+
throw new Error("Query function is already set");
|
|
49
|
+
this.args.push({ type: "Query", name, argRef, option: { ...option, nullable: true } });
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
with(argType, option) {
|
|
53
|
+
if (this.execFn)
|
|
54
|
+
throw new Error("Query function is already set");
|
|
55
|
+
this.internalArgs.push({ type: argType, option });
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
exec(query) {
|
|
59
|
+
if (this.execFn)
|
|
60
|
+
throw new Error("Query function is already set");
|
|
61
|
+
this.execFn = query;
|
|
62
|
+
return this;
|
|
63
|
+
}
|
|
64
|
+
applySliceMeta(refName, sigRef, key) {
|
|
65
|
+
if (!this.execFn)
|
|
66
|
+
throw new Error("Query function is not set");
|
|
67
|
+
const execFn = this.execFn;
|
|
68
|
+
const serviceName = `${refName}Service`;
|
|
69
|
+
const argLength = this.args.length;
|
|
70
|
+
const gqlMetaMap = getGqlMetaMapOnPrototype(sigRef.prototype);
|
|
71
|
+
const argMetas = this.args.map((arg, idx) => {
|
|
72
|
+
const [singleArgRef, argArrDepth] = getNonArrayModel(arg.argRef);
|
|
73
|
+
const returnRef = arraiedModel(singleArgRef instanceof Enum ? singleArgRef.type : singleArgRef, argArrDepth);
|
|
74
|
+
return {
|
|
75
|
+
name: arg.name,
|
|
76
|
+
returns: () => returnRef,
|
|
77
|
+
argsOption: { ...arg.option, enum: arg.argRef instanceof Enum ? arg.argRef : void 0 },
|
|
78
|
+
key,
|
|
79
|
+
idx,
|
|
80
|
+
type: arg.type
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
const skipLimitSortArgMetas = [
|
|
84
|
+
{
|
|
85
|
+
name: "skip",
|
|
86
|
+
returns: () => Int,
|
|
87
|
+
argsOption: { nullable: true, example: 0 },
|
|
88
|
+
key,
|
|
89
|
+
idx: argLength,
|
|
90
|
+
type: "Query"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: "limit",
|
|
94
|
+
returns: () => Int,
|
|
95
|
+
argsOption: { nullable: true, example: 20 },
|
|
96
|
+
key,
|
|
97
|
+
idx: argLength + 1,
|
|
98
|
+
type: "Query"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: "sort",
|
|
102
|
+
returns: () => String,
|
|
103
|
+
argsOption: { nullable: true, example: "latest" },
|
|
104
|
+
key,
|
|
105
|
+
idx: argLength + 2,
|
|
106
|
+
type: "Query"
|
|
107
|
+
}
|
|
108
|
+
];
|
|
109
|
+
const internalArgMetas = this.internalArgs.map((arg, idx) => ({
|
|
110
|
+
type: arg.type,
|
|
111
|
+
key,
|
|
112
|
+
idx,
|
|
113
|
+
option: arg.option
|
|
114
|
+
}));
|
|
115
|
+
const listKey = `${refName}List${capitalize(key)}`;
|
|
116
|
+
const listFn = async function(...requestArgs) {
|
|
117
|
+
const args = requestArgs.slice(0, argLength);
|
|
118
|
+
const skipLimitSort = requestArgs.slice(argLength, argLength + 3);
|
|
119
|
+
const [skip = 0, limit = 20, sort = "latest"] = skipLimitSort;
|
|
120
|
+
const internalArgs = requestArgs.slice(argLength + 3);
|
|
121
|
+
const query = execFn.apply(this, [...args, ...internalArgs]);
|
|
122
|
+
return await this[serviceName].__list(query, {
|
|
123
|
+
skip,
|
|
124
|
+
limit,
|
|
125
|
+
sort
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
signalInfo.setHandlerKey(listFn, listKey);
|
|
129
|
+
sigRef.prototype[listKey] = listFn;
|
|
130
|
+
const listApiMeta = {
|
|
131
|
+
returns: () => [this.full],
|
|
132
|
+
signalOption: this.signalOption,
|
|
133
|
+
key: listKey,
|
|
134
|
+
descriptor: { value: listFn, writable: true, enumerable: false, configurable: true },
|
|
135
|
+
guards: this.guards,
|
|
136
|
+
type: "Query"
|
|
137
|
+
};
|
|
138
|
+
gqlMetaMap.set(listKey, listApiMeta);
|
|
139
|
+
setArgMetas(
|
|
140
|
+
sigRef,
|
|
141
|
+
listKey,
|
|
142
|
+
[...argMetas, ...skipLimitSortArgMetas],
|
|
143
|
+
internalArgMetas.map((argMeta, idx) => ({ ...argMeta, idx: argLength + 3 + idx }))
|
|
144
|
+
);
|
|
145
|
+
const insightKey = `${refName}Insight${capitalize(key)}`;
|
|
146
|
+
const insightFn = async function(...requestArgs) {
|
|
147
|
+
const args = requestArgs.slice(0, argLength);
|
|
148
|
+
const internalArgs = requestArgs.slice(argLength);
|
|
149
|
+
const query = execFn.apply(this, [...args, ...internalArgs]);
|
|
150
|
+
return await this[serviceName].__insight(
|
|
151
|
+
query
|
|
152
|
+
);
|
|
153
|
+
};
|
|
154
|
+
signalInfo.setHandlerKey(insightFn, insightKey);
|
|
155
|
+
sigRef.prototype[insightKey] = insightFn;
|
|
156
|
+
const insightApiMeta = {
|
|
157
|
+
returns: () => this.insight,
|
|
158
|
+
signalOption: this.signalOption,
|
|
159
|
+
key: insightKey,
|
|
160
|
+
descriptor: { value: insightFn, writable: true, enumerable: false, configurable: true },
|
|
161
|
+
guards: this.guards,
|
|
162
|
+
type: "Query"
|
|
163
|
+
};
|
|
164
|
+
gqlMetaMap.set(insightKey, insightApiMeta);
|
|
165
|
+
setArgMetas(
|
|
166
|
+
sigRef,
|
|
167
|
+
insightKey,
|
|
168
|
+
argMetas,
|
|
169
|
+
internalArgMetas.map((argMeta, idx) => ({ ...argMeta, idx: argLength + idx }))
|
|
170
|
+
);
|
|
171
|
+
setGqlMetaMapOnPrototype(sigRef.prototype, gqlMetaMap);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
const sliceInit = (full, light, insight) => (signalOptionOrGuard, ...guards) => new SliceInfo(full, light, insight, signalOptionOrGuard, ...guards);
|
|
175
|
+
export {
|
|
176
|
+
SliceInfo,
|
|
177
|
+
sliceInit
|
|
178
|
+
};
|
package/package.json
CHANGED
package/src/apiInfo.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Dayjs, JSON, PromiseOrObject, Type, UnType } from "@akanjs/base";
|
|
2
|
+
import { ConstantFieldTypeInput, DocumentModel, FieldToValue, ParamFieldType, PlainTypeToFieldType, PurifiedModel } from "@akanjs/constant";
|
|
3
|
+
import { Access, Account, ArgType, GuardType, InternalArgType, Job, Me, Req, Res, Self, SignalOption, UserIp, Ws } from "./signalDecorators";
|
|
4
|
+
type ApiType = "query" | "mutation" | "pubsub" | "message";
|
|
5
|
+
export type GetInternalArg<ArgType extends InternalArgType> = ArgType extends "Account" ? Account : ArgType extends "Me" ? Me : ArgType extends "Self" ? Self : ArgType extends "UserIp" ? UserIp : ArgType extends "Access" ? Access : ArgType extends "Req" ? Req : ArgType extends "Res" ? Res : ArgType extends "Ws" ? Ws : ArgType extends "Job" ? Job : never;
|
|
6
|
+
export interface ApiArgProps<Optional extends boolean = false> {
|
|
7
|
+
nullable?: Optional;
|
|
8
|
+
example?: string | number | boolean | Dayjs;
|
|
9
|
+
}
|
|
10
|
+
export declare class ApiInfo<ReqType extends ApiType, Srvs extends {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
} = {
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}, Args extends any[] = [], InternalArgs extends any[] = [], ServerArgs extends any[] = [], Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, ServerReturns = never, Nullable extends boolean = false> {
|
|
15
|
+
#private;
|
|
16
|
+
readonly type: ReqType;
|
|
17
|
+
readonly args: {
|
|
18
|
+
type: ArgType;
|
|
19
|
+
name: string;
|
|
20
|
+
argRef: any;
|
|
21
|
+
option?: ApiArgProps<boolean>;
|
|
22
|
+
}[];
|
|
23
|
+
readonly internalArgs: {
|
|
24
|
+
type: InternalArgType;
|
|
25
|
+
option?: ApiArgProps<boolean>;
|
|
26
|
+
}[];
|
|
27
|
+
readonly returnRef: Returns;
|
|
28
|
+
readonly signalOption: SignalOption<Returns, Nullable, any>;
|
|
29
|
+
readonly guards: GuardType[];
|
|
30
|
+
execFn: ((...args: [...ServerArgs, ...InternalArgs]) => any) | null;
|
|
31
|
+
constructor(type: ReqType, returnRef: Returns, signalOptionOrGuard?: SignalOption<Returns, Nullable> | GuardType, ...guards: GuardType[]);
|
|
32
|
+
param<Arg extends ParamFieldType, _ClientArg = FieldToValue<Arg>, _ServerArg = DocumentModel<_ClientArg>>(name: string, argRef: Arg, option?: Omit<ApiArgProps, "nullable">): ApiInfo<ReqType, Srvs, [...Args, arg: _ClientArg], InternalArgs, [...ServerArgs, arg: _ServerArg], Returns, ServerReturns, Nullable>;
|
|
33
|
+
body<ExplicitType = unknown, Arg extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, Optional extends boolean = false, _ArgType = unknown extends ExplicitType ? FieldToValue<Arg> : ExplicitType, _ClientArg = PurifiedModel<_ArgType>, _ServerArg = DocumentModel<_ArgType>>(name: string, argRef: Arg, option?: ApiArgProps<Optional>): ApiInfo<ReqType, Srvs, [...Args, arg: _ClientArg | (Optional extends true ? null : never)], InternalArgs, [...ServerArgs, arg: _ServerArg | (Optional extends true ? undefined : never)], Returns, ServerReturns, Nullable>;
|
|
34
|
+
room<ExplicitType = unknown, Arg extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, _ArgType = unknown extends ExplicitType ? FieldToValue<Arg> : ExplicitType, _ClientArg = PurifiedModel<_ArgType>, _ServerArg = DocumentModel<_ArgType>>(name: string, argRef: Arg, option?: Omit<ApiArgProps, "nullable">): ApiInfo<ReqType, Srvs, [...Args, arg: _ClientArg], InternalArgs, [...ServerArgs, arg: _ServerArg], Returns, ServerReturns, Nullable>;
|
|
35
|
+
msg<ExplicitType = unknown, Arg extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, Optional extends boolean = false, _ArgType = unknown extends ExplicitType ? FieldToValue<Arg> : ExplicitType, _ClientArg = PurifiedModel<_ArgType>, _ServerArg = DocumentModel<_ArgType>>(name: string, argRef: Arg, option?: ApiArgProps<Optional>): ApiInfo<ReqType, Srvs, [...Args, arg: _ClientArg | (Optional extends true ? null : never)], InternalArgs, [...ServerArgs, arg: _ServerArg | (Optional extends true ? undefined : never)], Returns, ServerReturns, Nullable>;
|
|
36
|
+
search<ExplicitType = unknown, Arg extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, _ArgType = unknown extends ExplicitType ? FieldToValue<Arg> : ExplicitType, _ClientArg = PurifiedModel<_ArgType>, _ServerArg = DocumentModel<_ArgType>>(name: string, argRef: Arg, option?: Omit<ApiArgProps, "nullable">): ApiInfo<ReqType, Srvs, [...Args, arg: _ClientArg | null], InternalArgs, [...ServerArgs, arg: _ServerArg | undefined], Returns, ServerReturns, Nullable>;
|
|
37
|
+
with<ArgType extends InternalArgType, Optional extends boolean = false>(argType: Exclude<ArgType, "Parent">, option?: ApiArgProps<Optional>): ApiInfo<ReqType, Srvs, Args, [...InternalArgs, arg: GetInternalArg<ArgType> | (Optional extends true ? undefined : never)], ServerArgs, Returns, ServerReturns, Nullable>;
|
|
38
|
+
exec<ExecFn extends (this: Srvs, ...args: [...ServerArgs, ...InternalArgs]) => ReqType extends "pubsub" ? Promise<void> | void : PromiseOrObject<DocumentModel<FieldToValue<Returns>> | (Nullable extends true ? null | undefined : never)>>(execFn: ExecFn): ApiInfo<ReqType, Srvs, Args, InternalArgs, ServerArgs, Returns, ReturnType<ExecFn>, Nullable>;
|
|
39
|
+
applyApiMeta(sigRef: Type, key: string): void;
|
|
40
|
+
}
|
|
41
|
+
type ApiInfoReturn<ReqType extends ApiType, Returns extends ConstantFieldTypeInput, ServerReturns, Nullable extends boolean, _ReturnValue = Returns extends typeof JSON ? Awaited<ServerReturns> : FieldToValue<Returns>> = ReqType extends "query" ? Promise<_ReturnValue | (Nullable extends true ? null : never)> : ReqType extends "mutation" ? Promise<_ReturnValue | (Nullable extends true ? null : never)> : ReqType extends "pubsub" ? (_ReturnValue | (Nullable extends true ? null : never)) & {
|
|
42
|
+
__Returns__: "Subscribe";
|
|
43
|
+
} : ReqType extends "message" ? (_ReturnValue | (Nullable extends true ? null : never)) & {
|
|
44
|
+
__Returns__: "Emit";
|
|
45
|
+
} : never;
|
|
46
|
+
export type BuildApiSignal<SigBuilder extends ApiBuilder<any>, _ApiMap = ReturnType<SigBuilder>> = {
|
|
47
|
+
[K in keyof _ApiMap]: _ApiMap[K] extends ApiInfo<infer ReqType, any, infer Args, any, any, infer Returns, infer ServerReturns, infer Nullable> ? (...args: Args) => ApiInfoReturn<ReqType, Returns, ServerReturns, Nullable> : never;
|
|
48
|
+
};
|
|
49
|
+
export declare const makeApiBuilder: <Srvs extends {
|
|
50
|
+
[key: string]: any;
|
|
51
|
+
}>() => {
|
|
52
|
+
query: <Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOptionOrGuard?: SignalOption<Returns, Nullable> | GuardType, ...guards: GuardType[]) => ApiInfo<"query", Srvs, [], [], [], Returns, never, Nullable>;
|
|
53
|
+
mutation: <Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, Nullable_1 extends boolean = false>(returnRef: Returns, signalOptionOrGuard?: SignalOption<Returns, Nullable_1> | GuardType, ...guards: GuardType[]) => ApiInfo<"mutation", Srvs, [], [], [], Returns, never, Nullable_1>;
|
|
54
|
+
pubsub: <Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, Nullable_2 extends boolean = false>(returnRef: Returns, signalOptionOrGuard?: SignalOption<Returns, Nullable_2> | GuardType, ...guards: GuardType[]) => ApiInfo<"pubsub", Srvs, [], [], [], Returns, never, Nullable_2>;
|
|
55
|
+
message: <Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, Nullable_3 extends boolean = false>(returnRef: Returns, signalOptionOrGuard?: SignalOption<Returns, Nullable_3> | GuardType, ...guards: GuardType[]) => ApiInfo<"message", Srvs, [], [], [], Returns, never, Nullable_3>;
|
|
56
|
+
};
|
|
57
|
+
export type ApiBuilder<Srvs extends {
|
|
58
|
+
[key: string]: any;
|
|
59
|
+
} = {
|
|
60
|
+
[key: string]: any;
|
|
61
|
+
}, _ThisSrvs extends {
|
|
62
|
+
[key: string]: any;
|
|
63
|
+
} = {
|
|
64
|
+
[K in keyof Srvs as K extends string ? Uncapitalize<K> : never]: UnType<Srvs[K]>;
|
|
65
|
+
}> = (builder: {
|
|
66
|
+
query: <Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOptionOrGuard?: SignalOption<Returns, Nullable> | GuardType, ...guards: GuardType[]) => ApiInfo<"query", _ThisSrvs, [], [], [], Returns, never, Nullable>;
|
|
67
|
+
mutation: <Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOptionOrGuard?: SignalOption<Returns, Nullable> | GuardType, ...guards: GuardType[]) => ApiInfo<"mutation", _ThisSrvs, [], [], [], Returns, never, Nullable>;
|
|
68
|
+
pubsub: <Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOptionOrGuard?: SignalOption<Returns, Nullable> | GuardType, ...guards: GuardType[]) => ApiInfo<"pubsub", _ThisSrvs, [], [], [], Returns, never, Nullable>;
|
|
69
|
+
message: <Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOptionOrGuard?: SignalOption<Returns, Nullable> | GuardType, ...guards: GuardType[]) => ApiInfo<"message", _ThisSrvs, [], [], [], Returns, never, Nullable>;
|
|
70
|
+
}) => {
|
|
71
|
+
[key: string]: ApiInfo<any, any, any, any, any, any, any, any>;
|
|
72
|
+
};
|
|
73
|
+
export {};
|
package/src/base.signal.d.ts
CHANGED
|
@@ -1,22 +1,134 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { JSON } from "@akanjs/base";
|
|
2
|
+
declare const BaseInternal_base: import("@akanjs/base").Type<import("./internalApiInfo").BuildInternalApiSignal<({ interval }: {
|
|
3
|
+
resolveField: <Returns extends import("@akanjs/constant").ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOption?: Pick<import("./signalDecorators").SignalOption<Returns, Nullable, keyof import("@akanjs/base").UnType<Returns>>, "nullable"> | undefined) => import("./internalApiInfo").InternalApiInfo<"resolveField", {
|
|
4
|
+
baseService: import("@akanjs/service").BaseService;
|
|
5
|
+
}, [], [], Returns, import("@akanjs/document").Doc<never>, Nullable>;
|
|
6
|
+
interval: <Nullable extends boolean = false>(scheduleTime: number, signalOption?: import("./signalDecorators").SignalOption<typeof JSON, Nullable, "__Scalar__"> | undefined) => import("./internalApiInfo").InternalApiInfo<"interval", {
|
|
7
|
+
baseService: import("@akanjs/service").BaseService;
|
|
8
|
+
}, [], [], typeof JSON, import("@akanjs/document").Doc<never>, Nullable>;
|
|
9
|
+
cron: <Nullable extends boolean = false>(scheduleCron: string, signalOption?: import("./signalDecorators").SignalOption<typeof JSON, Nullable, "__Scalar__"> | undefined) => import("./internalApiInfo").InternalApiInfo<"cron", {
|
|
10
|
+
baseService: import("@akanjs/service").BaseService;
|
|
11
|
+
}, [], [], typeof JSON, import("@akanjs/document").Doc<never>, Nullable>;
|
|
12
|
+
timeout: <Nullable extends boolean = false>(timeout: number, signalOption?: import("./signalDecorators").SignalOption<typeof JSON, Nullable, "__Scalar__"> | undefined) => import("./internalApiInfo").InternalApiInfo<"timeout", {
|
|
13
|
+
baseService: import("@akanjs/service").BaseService;
|
|
14
|
+
}, [], [], typeof JSON, import("@akanjs/document").Doc<never>, Nullable>;
|
|
15
|
+
initialize: <Nullable extends boolean = false>(signalOption?: import("./signalDecorators").SignalOption<typeof JSON, Nullable, "__Scalar__"> | undefined) => import("./internalApiInfo").InternalApiInfo<"init", {
|
|
16
|
+
baseService: import("@akanjs/service").BaseService;
|
|
17
|
+
}, [], [], typeof JSON, import("@akanjs/document").Doc<never>, Nullable>;
|
|
18
|
+
destroy: <Nullable extends boolean = false>(signalOption?: import("./signalDecorators").SignalOption<typeof JSON, Nullable, "__Scalar__"> | undefined) => import("./internalApiInfo").InternalApiInfo<"destroy", {
|
|
19
|
+
baseService: import("@akanjs/service").BaseService;
|
|
20
|
+
}, [], [], typeof JSON, import("@akanjs/document").Doc<never>, Nullable>;
|
|
21
|
+
process: <Returns extends import("@akanjs/constant").ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOption?: import("./signalDecorators").SignalOption<Returns, Nullable, keyof import("@akanjs/base").UnType<Returns>> | undefined) => import("./internalApiInfo").InternalApiInfo<"process", {
|
|
22
|
+
baseService: import("@akanjs/service").BaseService;
|
|
23
|
+
}, [], [], Returns, import("@akanjs/document").Doc<never>, Nullable>;
|
|
24
|
+
}) => {
|
|
25
|
+
publishPing: import("./internalApiInfo").InternalApiInfo<"interval", {
|
|
26
|
+
baseService: import("@akanjs/service").BaseService;
|
|
27
|
+
}, [], [], typeof JSON, import("@akanjs/document").Doc<never>, false>;
|
|
28
|
+
}, {
|
|
29
|
+
publishPing: import("./internalApiInfo").InternalApiInfo<"interval", {
|
|
30
|
+
baseService: import("@akanjs/service").BaseService;
|
|
31
|
+
}, [], [], typeof JSON, import("@akanjs/document").Doc<never>, false>;
|
|
32
|
+
}> & {}>;
|
|
33
|
+
export declare class BaseInternal extends BaseInternal_base {
|
|
34
|
+
}
|
|
35
|
+
declare const BaseEndpoint_base: import("@akanjs/base").Type<import("./apiInfo").BuildApiSignal<({ query, mutation, message, pubsub }: {
|
|
36
|
+
query: <Returns extends import("@akanjs/constant").ConstantFieldTypeInput = import("@akanjs/constant").ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOptionOrGuard?: "Public" | "None" | "User" | "Admin" | "SuperAdmin" | "Every" | "Owner" | import("./signalDecorators").SignalOption<Returns, Nullable, keyof import("@akanjs/base").UnType<Returns>> | undefined, ...guards: import("./signalDecorators").GuardType[]) => import("./apiInfo").ApiInfo<"query", {
|
|
37
|
+
baseService: import("@akanjs/service").BaseService;
|
|
38
|
+
}, [], [], [], Returns, never, Nullable>;
|
|
39
|
+
mutation: <Returns extends import("@akanjs/constant").ConstantFieldTypeInput = import("@akanjs/constant").ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOptionOrGuard?: "Public" | "None" | "User" | "Admin" | "SuperAdmin" | "Every" | "Owner" | import("./signalDecorators").SignalOption<Returns, Nullable, keyof import("@akanjs/base").UnType<Returns>> | undefined, ...guards: import("./signalDecorators").GuardType[]) => import("./apiInfo").ApiInfo<"mutation", {
|
|
40
|
+
baseService: import("@akanjs/service").BaseService;
|
|
41
|
+
}, [], [], [], Returns, never, Nullable>;
|
|
42
|
+
pubsub: <Returns extends import("@akanjs/constant").ConstantFieldTypeInput = import("@akanjs/constant").ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOptionOrGuard?: "Public" | "None" | "User" | "Admin" | "SuperAdmin" | "Every" | "Owner" | import("./signalDecorators").SignalOption<Returns, Nullable, keyof import("@akanjs/base").UnType<Returns>> | undefined, ...guards: import("./signalDecorators").GuardType[]) => import("./apiInfo").ApiInfo<"pubsub", {
|
|
43
|
+
baseService: import("@akanjs/service").BaseService;
|
|
44
|
+
}, [], [], [], Returns, never, Nullable>;
|
|
45
|
+
message: <Returns extends import("@akanjs/constant").ConstantFieldTypeInput = import("@akanjs/constant").ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOptionOrGuard?: "Public" | "None" | "User" | "Admin" | "SuperAdmin" | "Every" | "Owner" | import("./signalDecorators").SignalOption<Returns, Nullable, keyof import("@akanjs/base").UnType<Returns>> | undefined, ...guards: import("./signalDecorators").GuardType[]) => import("./apiInfo").ApiInfo<"message", {
|
|
46
|
+
baseService: import("@akanjs/service").BaseService;
|
|
47
|
+
}, [], [], [], Returns, never, Nullable>;
|
|
48
|
+
}) => {
|
|
49
|
+
ping: import("./apiInfo").ApiInfo<"query", {
|
|
50
|
+
baseService: import("@akanjs/service").BaseService;
|
|
51
|
+
}, [], [], [], StringConstructor, string, false>;
|
|
52
|
+
pingBody: import("./apiInfo").ApiInfo<"query", {
|
|
53
|
+
baseService: import("@akanjs/service").BaseService;
|
|
54
|
+
}, [arg: string], [], [arg: string], StringConstructor, string, false>;
|
|
55
|
+
pingParam: import("./apiInfo").ApiInfo<"query", {
|
|
56
|
+
baseService: import("@akanjs/service").BaseService;
|
|
57
|
+
}, [arg: string], [], [arg: string], StringConstructor, string, false>;
|
|
58
|
+
pingQuery: import("./apiInfo").ApiInfo<"query", {
|
|
59
|
+
baseService: import("@akanjs/service").BaseService;
|
|
60
|
+
}, [arg: string | null], [], [arg: string | undefined], StringConstructor, string | undefined, true>;
|
|
61
|
+
pingEvery: import("./apiInfo").ApiInfo<"query", {
|
|
62
|
+
baseService: import("@akanjs/service").BaseService;
|
|
63
|
+
}, [], [], [], StringConstructor, string, false>;
|
|
64
|
+
pingUser: import("./apiInfo").ApiInfo<"query", {
|
|
65
|
+
baseService: import("@akanjs/service").BaseService;
|
|
66
|
+
}, [], [], [], StringConstructor, string, false>;
|
|
67
|
+
pingAdmin: import("./apiInfo").ApiInfo<"query", {
|
|
68
|
+
baseService: import("@akanjs/service").BaseService;
|
|
69
|
+
}, [], [], [], StringConstructor, string, false>;
|
|
70
|
+
getDictionary: import("./apiInfo").ApiInfo<"query", {
|
|
71
|
+
baseService: import("@akanjs/service").BaseService;
|
|
72
|
+
}, [arg: string], [], [arg: string], typeof JSON, Record<string, Record<string, string>>, false>;
|
|
73
|
+
getAllDictionary: import("./apiInfo").ApiInfo<"query", {
|
|
74
|
+
baseService: import("@akanjs/service").BaseService;
|
|
75
|
+
}, [], [], [], typeof JSON, Record<string, Record<string, Record<string, string>>>, false>;
|
|
76
|
+
cleanup: import("./apiInfo").ApiInfo<"mutation", {
|
|
77
|
+
baseService: import("@akanjs/service").BaseService;
|
|
78
|
+
}, [], [], [], BooleanConstructor, Promise<boolean>, false>;
|
|
79
|
+
wsPing: import("./apiInfo").ApiInfo<"message", {
|
|
80
|
+
baseService: import("@akanjs/service").BaseService;
|
|
81
|
+
}, [], [], [], StringConstructor, string, false>;
|
|
82
|
+
pubsubPing: import("./apiInfo").ApiInfo<"pubsub", {
|
|
83
|
+
baseService: import("@akanjs/service").BaseService;
|
|
84
|
+
}, [], [], [], StringConstructor, void, false>;
|
|
85
|
+
getSignals: import("./apiInfo").ApiInfo<"query", {
|
|
86
|
+
baseService: import("@akanjs/service").BaseService;
|
|
87
|
+
}, [], [], [], typeof JSON, import("./signalInfo").SerializedSignal[], false>;
|
|
88
|
+
}, {
|
|
89
|
+
ping: import("./apiInfo").ApiInfo<"query", {
|
|
90
|
+
baseService: import("@akanjs/service").BaseService;
|
|
91
|
+
}, [], [], [], StringConstructor, string, false>;
|
|
92
|
+
pingBody: import("./apiInfo").ApiInfo<"query", {
|
|
93
|
+
baseService: import("@akanjs/service").BaseService;
|
|
94
|
+
}, [arg: string], [], [arg: string], StringConstructor, string, false>;
|
|
95
|
+
pingParam: import("./apiInfo").ApiInfo<"query", {
|
|
96
|
+
baseService: import("@akanjs/service").BaseService;
|
|
97
|
+
}, [arg: string], [], [arg: string], StringConstructor, string, false>;
|
|
98
|
+
pingQuery: import("./apiInfo").ApiInfo<"query", {
|
|
99
|
+
baseService: import("@akanjs/service").BaseService;
|
|
100
|
+
}, [arg: string | null], [], [arg: string | undefined], StringConstructor, string | undefined, true>;
|
|
101
|
+
pingEvery: import("./apiInfo").ApiInfo<"query", {
|
|
102
|
+
baseService: import("@akanjs/service").BaseService;
|
|
103
|
+
}, [], [], [], StringConstructor, string, false>;
|
|
104
|
+
pingUser: import("./apiInfo").ApiInfo<"query", {
|
|
105
|
+
baseService: import("@akanjs/service").BaseService;
|
|
106
|
+
}, [], [], [], StringConstructor, string, false>;
|
|
107
|
+
pingAdmin: import("./apiInfo").ApiInfo<"query", {
|
|
108
|
+
baseService: import("@akanjs/service").BaseService;
|
|
109
|
+
}, [], [], [], StringConstructor, string, false>;
|
|
110
|
+
getDictionary: import("./apiInfo").ApiInfo<"query", {
|
|
111
|
+
baseService: import("@akanjs/service").BaseService;
|
|
112
|
+
}, [arg: string], [], [arg: string], typeof JSON, Record<string, Record<string, string>>, false>;
|
|
113
|
+
getAllDictionary: import("./apiInfo").ApiInfo<"query", {
|
|
114
|
+
baseService: import("@akanjs/service").BaseService;
|
|
115
|
+
}, [], [], [], typeof JSON, Record<string, Record<string, Record<string, string>>>, false>;
|
|
116
|
+
cleanup: import("./apiInfo").ApiInfo<"mutation", {
|
|
117
|
+
baseService: import("@akanjs/service").BaseService;
|
|
118
|
+
}, [], [], [], BooleanConstructor, Promise<boolean>, false>;
|
|
119
|
+
wsPing: import("./apiInfo").ApiInfo<"message", {
|
|
120
|
+
baseService: import("@akanjs/service").BaseService;
|
|
121
|
+
}, [], [], [], StringConstructor, string, false>;
|
|
122
|
+
pubsubPing: import("./apiInfo").ApiInfo<"pubsub", {
|
|
123
|
+
baseService: import("@akanjs/service").BaseService;
|
|
124
|
+
}, [], [], [], StringConstructor, void, false>;
|
|
125
|
+
getSignals: import("./apiInfo").ApiInfo<"query", {
|
|
126
|
+
baseService: import("@akanjs/service").BaseService;
|
|
127
|
+
}, [], [], [], typeof JSON, import("./signalInfo").SerializedSignal[], false>;
|
|
128
|
+
}> & {}>;
|
|
129
|
+
export declare class BaseEndpoint extends BaseEndpoint_base {
|
|
130
|
+
}
|
|
131
|
+
declare const BaseSignal_base: import("@akanjs/base").Type<BaseEndpoint & BaseInternal>;
|
|
4
132
|
export declare class BaseSignal extends BaseSignal_base {
|
|
5
|
-
publishPing(): void;
|
|
6
|
-
ping(): string;
|
|
7
|
-
pingBody(data: string): string;
|
|
8
|
-
pingParam(id: string): string;
|
|
9
|
-
pingQuery(id: string): string;
|
|
10
|
-
pingEvery(): string;
|
|
11
|
-
pingUser(): string;
|
|
12
|
-
pingAdmin(): string;
|
|
13
|
-
cleanup(): Promise<string>;
|
|
14
|
-
wsPing(data: string): string & {
|
|
15
|
-
__Returns__: "Emit";
|
|
16
|
-
};
|
|
17
|
-
pubsubPing(): string & {
|
|
18
|
-
__Returns__: "Subscribe";
|
|
19
|
-
};
|
|
20
|
-
getDictionary(lang: string): Record<string, Record<string, string>>;
|
|
21
133
|
}
|
|
22
134
|
export {};
|
package/src/fetch.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
export declare const fetch: {
|
|
2
2
|
ping: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
|
|
3
|
-
publishPing: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<void>;
|
|
4
3
|
pingBody: (args_0: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
|
|
5
4
|
pingParam: (args_0: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
|
|
6
|
-
pingQuery: (args_0
|
|
5
|
+
pingQuery: (args_0?: string | null | undefined, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string | null>;
|
|
7
6
|
pingEvery: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
|
|
8
7
|
pingUser: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
|
|
9
8
|
pingAdmin: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
|
|
10
|
-
cleanup: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
|
|
11
|
-
wsPing: (args_0: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => void;
|
|
12
9
|
getDictionary: (args_0: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<Record<string, Record<string, string>>>;
|
|
10
|
+
getAllDictionary: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<Record<string, Record<string, Record<string, string>>>>;
|
|
11
|
+
cleanup: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<boolean>;
|
|
12
|
+
wsPing: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => void;
|
|
13
|
+
getSignals: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<import("./signalInfo").SerializedSignal[]>;
|
|
13
14
|
listenWsPing: (handleEvent: (data: string & {
|
|
14
15
|
__Returns__: "Emit";
|
|
15
16
|
}) => any, options?: import("@akanjs/common").FetchPolicy) => () => void;
|
|
@@ -20,23 +21,24 @@ export declare const fetch: {
|
|
|
20
21
|
clone: (option?: {
|
|
21
22
|
jwt: string | null;
|
|
22
23
|
}) => Omit<{
|
|
23
|
-
wsPing: (
|
|
24
|
+
wsPing: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => void;
|
|
24
25
|
listenWsPing: (handleEvent: (data: string & {
|
|
25
26
|
__Returns__: "Emit";
|
|
26
27
|
}) => any, options?: import("@akanjs/common").FetchPolicy) => () => void;
|
|
27
28
|
subscribePubsubPing: (onData: (data: string & {
|
|
28
29
|
__Returns__: "Subscribe";
|
|
29
30
|
}) => void, fetchPolicy?: import("@akanjs/common").FetchPolicy<any> | undefined) => () => void;
|
|
30
|
-
publishPing: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<void>;
|
|
31
31
|
ping: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
|
|
32
32
|
pingBody: (args_0: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
|
|
33
33
|
pingParam: (args_0: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
|
|
34
|
-
pingQuery: (args_0
|
|
34
|
+
pingQuery: (args_0?: string | null | undefined, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string | null>;
|
|
35
35
|
pingEvery: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
|
|
36
36
|
pingUser: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
|
|
37
37
|
pingAdmin: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
|
|
38
|
-
cleanup: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<string>;
|
|
39
38
|
getDictionary: (args_0: string, option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<Record<string, Record<string, string>>>;
|
|
39
|
+
getAllDictionary: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<Record<string, Record<string, Record<string, string>>>>;
|
|
40
|
+
cleanup: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<boolean>;
|
|
41
|
+
getSignals: (option?: import("@akanjs/common").FetchPolicy<any> | undefined) => Promise<import("./signalInfo").SerializedSignal[]>;
|
|
40
42
|
} & typeof globalThis.fetch & {
|
|
41
43
|
client: import("./client").Client;
|
|
42
44
|
clone: (option?: {
|