@akanjs/signal 0.9.48 → 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.
@@ -0,0 +1,106 @@
1
+ import { isGqlScalar } from "@akanjs/base";
2
+ import { capitalize, lowerlize } from "@akanjs/common";
3
+ import { constantInfo, getFieldMetaMap, getFieldMetas, getGqlTypeStr } from "@akanjs/constant";
4
+ class FragmentStorage {
5
+ }
6
+ const getPredefinedFragment = (refName) => {
7
+ const fragment = Reflect.getMetadata(refName, FragmentStorage.prototype);
8
+ return fragment;
9
+ };
10
+ const setPredefinedFragment = (refName, fragment) => {
11
+ Reflect.defineMetadata(refName, fragment, FragmentStorage.prototype);
12
+ };
13
+ const makeArgStr = (args) => {
14
+ return args.length ? `(${args.map((arg) => {
15
+ const argRef = constantInfo.getModelRef(arg.refName, arg.modelType);
16
+ const argRefType = isGqlScalar(argRef) ? "gqlScalar" : "class";
17
+ const gqlTypeStr = "[".repeat(arg.arrDepth) + `${getGqlTypeStr(argRef)}${argRefType === "class" ? "Input" : ""}` + "!]".repeat(arg.arrDepth);
18
+ return `$${arg.name}: ` + gqlTypeStr + (arg.argsOption.nullable ? "" : "!");
19
+ }).join(", ")})` : "";
20
+ };
21
+ const makeArgAssignStr = (args) => {
22
+ return args.length ? `(${args.map((arg) => `${arg.name}: $${arg.name}`).join(", ")})` : "";
23
+ };
24
+ const makeReturnStr = (returnRef, partial) => {
25
+ const isScalar = isGqlScalar(returnRef);
26
+ if (isScalar)
27
+ return "";
28
+ const refName = constantInfo.getRefName(returnRef);
29
+ const fragmentName = `${constantInfo.isLight(returnRef) ? "Light" : ""}${capitalize(refName)}${constantInfo.isInsight(returnRef) ? "Insight" : ""}`;
30
+ if (!partial?.length)
31
+ return ` {
32
+ ...${lowerlize(fragmentName)}Fragment
33
+ }`;
34
+ const targetKeys = constantInfo.isScalar(returnRef) ? partial : [.../* @__PURE__ */ new Set(["id", ...partial, "updatedAt"])];
35
+ const fieldMetaMap = getFieldMetaMap(returnRef);
36
+ return ` {
37
+ ${targetKeys.map((key) => fieldMetaMap.get(key)).filter((metadata) => metadata && metadata.fieldType !== "hidden").map(
38
+ (fieldMeta) => fieldMeta.isClass ? ` ${fieldMeta.key} {
39
+ ...${lowerlize(getGqlTypeStr(fieldMeta.modelRef))}Fragment
40
+ }` : ` ${fieldMeta.key}`
41
+ ).join("\n")}
42
+ }`;
43
+ };
44
+ const fragmentize = (modelRef, fragMap = /* @__PURE__ */ new Map(), partial) => {
45
+ const refName = constantInfo.getRefName(modelRef);
46
+ const fragmentName = `${constantInfo.isLight(modelRef) ? "Light" : ""}${capitalize(refName)}${constantInfo.isInsight(modelRef) ? "Insight" : ""}`;
47
+ const gqlName = `${capitalize(refName)}${constantInfo.isInsight(modelRef) ? "Insight" : ""}`;
48
+ const metadatas = getFieldMetas(modelRef);
49
+ const selectKeys = partial ? ["id", ...partial, "updatedAt"] : metadatas.map((metadata) => metadata.key);
50
+ const selectKeySet = new Set(selectKeys);
51
+ const fragment = `fragment ${lowerlize(fragmentName)}Fragment on ${gqlName} {
52
+ ` + metadatas.filter((metadata) => metadata.fieldType !== "hidden" && selectKeySet.has(metadata.key)).map((metadata) => {
53
+ return metadata.isClass ? ` ${metadata.key} {
54
+ ...${lowerlize(`${constantInfo.isLight(metadata.modelRef) ? "Light" : ""}${capitalize(constantInfo.getRefName(metadata.modelRef))}${constantInfo.isInsight(metadata.modelRef) ? "Insight" : ""}`)}Fragment
55
+ }` : ` ${metadata.key}`;
56
+ }).join(`
57
+ `) + `
58
+ }`;
59
+ fragMap.set(fragmentName, fragment);
60
+ metadatas.filter((metadata) => metadata.fieldType !== "hidden" && selectKeySet.has(metadata.key) && metadata.isClass).forEach((metadata) => fragmentize(metadata.modelRef, fragMap));
61
+ return fragMap;
62
+ };
63
+ const makeFragment = (modelRef, option = {}) => {
64
+ const refName = constantInfo.getRefName(modelRef);
65
+ const fragmentName = `${constantInfo.isLight(modelRef) ? "Light" : ""}${capitalize(refName)}${constantInfo.isInsight(modelRef) ? "Insight" : ""}`;
66
+ const fragment = getPredefinedFragment(fragmentName);
67
+ if (fragment && !option.overwrite && !option.excludeSelf && !option.partial?.length)
68
+ return fragment;
69
+ const fragMap = new Map(fragmentize(modelRef, /* @__PURE__ */ new Map(), option.partial));
70
+ if (option.excludeSelf)
71
+ fragMap.delete(fragmentName);
72
+ const gqlStr = [...fragMap.values()].join("\n");
73
+ if (!option.excludeSelf)
74
+ setPredefinedFragment(fragmentName, gqlStr);
75
+ return gqlStr;
76
+ };
77
+ const getGqlStr = (modelRef, key, endpoint, returnRef, partial) => {
78
+ const isScalar = isGqlScalar(modelRef);
79
+ const argStr = makeArgStr(endpoint.args);
80
+ const argAssignStr = makeArgAssignStr(endpoint.args);
81
+ const returnStr = makeReturnStr(returnRef, partial);
82
+ const gqlStr = `${isScalar ? "" : makeFragment(returnRef, { excludeSelf: !!partial?.length, partial })}
83
+ ${endpoint.type + " " + key + argStr}{
84
+ ${key}${argAssignStr}${returnStr}
85
+ }
86
+ `;
87
+ return gqlStr;
88
+ };
89
+ function graphql(literals, ...args) {
90
+ if (typeof literals === "string")
91
+ literals = [literals];
92
+ let result = literals[0];
93
+ args.forEach((arg, i) => {
94
+ if (arg && arg.kind === "Document")
95
+ result += arg.loc.source.body;
96
+ else
97
+ result += arg;
98
+ result += literals[i + 1];
99
+ });
100
+ return result;
101
+ }
102
+ export {
103
+ getGqlStr,
104
+ graphql,
105
+ makeFragment
106
+ };
package/esm/src/index.js CHANGED
@@ -6,6 +6,11 @@ export * from "./doc";
6
6
  export * from "./baseFetch";
7
7
  export * from "./base.signal";
8
8
  export * from "./fetch";
9
+ export * from "./signalInfo";
10
+ export * from "./apiInfo";
11
+ export * from "./sliceInfo";
12
+ export * from "./fetchInfo";
13
+ export * from "./graphql";
9
14
  export {
10
15
  client,
11
16
  immerify
@@ -0,0 +1,137 @@
1
+ import { Enum, JSON } from "@akanjs/base";
2
+ import {
3
+ getGqlMetaMapOnPrototype,
4
+ getResolveFieldMetaMapOnPrototype,
5
+ setArgMetas,
6
+ setGqlMetaMapOnPrototype
7
+ } from "./signalDecorators";
8
+ class InternalApiInfo {
9
+ type;
10
+ args = [];
11
+ internalArgs = [];
12
+ returnRef;
13
+ signalOption;
14
+ execFn = null;
15
+ constructor(type, returnRef, signalOption = {}) {
16
+ this.type = type;
17
+ this.returnRef = returnRef;
18
+ this.signalOption = signalOption;
19
+ }
20
+ msg(name, argRef, option) {
21
+ if (this.execFn)
22
+ throw new Error("Query function is already set");
23
+ else if (this.args.at(-1)?.option?.nullable)
24
+ throw new Error("Last argument is nullable");
25
+ this.args.push({ type: "Msg", name, argRef, option });
26
+ return this;
27
+ }
28
+ with(argType, option) {
29
+ if (this.execFn)
30
+ throw new Error("Query function is already set");
31
+ this.internalArgs.push({ type: argType, option });
32
+ return this;
33
+ }
34
+ exec(query) {
35
+ if (this.execFn)
36
+ throw new Error("Query function is already set");
37
+ this.execFn = query;
38
+ return this;
39
+ }
40
+ static #typeTempMap = {
41
+ resolveField: "ResolveField",
42
+ interval: "Schedule",
43
+ cron: "Schedule",
44
+ timeout: "Schedule",
45
+ init: "Schedule",
46
+ destroy: "Schedule",
47
+ process: "Process"
48
+ };
49
+ applyApiMeta(sigRef, key) {
50
+ if (this.type === "resolveField") {
51
+ const metadataMap2 = getResolveFieldMetaMapOnPrototype(sigRef.prototype);
52
+ metadataMap2.set(key, {
53
+ returns: () => this.returnRef,
54
+ argsOption: this.signalOption,
55
+ key,
56
+ descriptor: { value: this.execFn, writable: true, enumerable: false, configurable: true }
57
+ });
58
+ sigRef.prototype[key] = this.execFn;
59
+ Reflect.defineMetadata("resolveField", metadataMap2, sigRef.prototype);
60
+ return;
61
+ }
62
+ const internalApiMeta = {
63
+ returns: () => this.returnRef instanceof Enum ? this.returnRef.type : this.returnRef,
64
+ signalOption: this.signalOption,
65
+ key,
66
+ descriptor: { value: this.execFn, writable: true, enumerable: false, configurable: true },
67
+ guards: ["None"],
68
+ type: InternalApiInfo.#typeTempMap[this.type]
69
+ };
70
+ sigRef.prototype[key] = this.execFn;
71
+ const metadataMap = getGqlMetaMapOnPrototype(sigRef.prototype);
72
+ metadataMap.set(key, internalApiMeta);
73
+ setGqlMetaMapOnPrototype(sigRef.prototype, metadataMap);
74
+ const argMetas = this.args.map((arg, idx) => ({
75
+ name: arg.name,
76
+ returns: () => arg.argRef,
77
+ argsOption: { ...arg.option, enum: arg.argRef instanceof Enum ? arg.argRef : void 0 },
78
+ key,
79
+ idx,
80
+ type: arg.type
81
+ }));
82
+ const internalArgMetas = this.internalArgs.map((arg, idx) => ({
83
+ type: arg.type,
84
+ key,
85
+ idx,
86
+ option: arg.option
87
+ }));
88
+ setArgMetas(sigRef, key, argMetas, internalArgMetas);
89
+ }
90
+ }
91
+ const makeInternalApiBuilder = () => ({
92
+ resolveField: (returnRef, signalOption) => new InternalApiInfo(
93
+ "resolveField",
94
+ returnRef,
95
+ signalOption
96
+ ),
97
+ interval: (scheduleTime, signalOption) => new InternalApiInfo("interval", JSON, {
98
+ enabled: true,
99
+ lock: true,
100
+ scheduleType: "interval",
101
+ scheduleTime,
102
+ ...signalOption
103
+ }),
104
+ cron: (scheduleCron, signalOption) => new InternalApiInfo("cron", JSON, {
105
+ enabled: true,
106
+ lock: true,
107
+ scheduleType: "cron",
108
+ scheduleCron,
109
+ ...signalOption
110
+ }),
111
+ timeout: (timeout, signalOption) => new InternalApiInfo("timeout", JSON, {
112
+ enabled: true,
113
+ lock: true,
114
+ scheduleType: "timeout",
115
+ scheduleTime: timeout,
116
+ ...signalOption
117
+ }),
118
+ initialize: (signalOption) => new InternalApiInfo("init", JSON, {
119
+ enabled: true,
120
+ scheduleType: "init",
121
+ ...signalOption
122
+ }),
123
+ destroy: (signalOption) => new InternalApiInfo("destroy", JSON, {
124
+ enabled: true,
125
+ lock: true,
126
+ scheduleType: "destroy",
127
+ ...signalOption
128
+ }),
129
+ process: (returnRef, signalOption) => new InternalApiInfo("process", returnRef, {
130
+ serverMode: "all",
131
+ ...signalOption
132
+ })
133
+ });
134
+ export {
135
+ InternalApiInfo,
136
+ makeInternalApiBuilder
137
+ };
@@ -1,27 +1,17 @@
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
1
  import "reflect-metadata";
14
2
  import {
15
3
  baseEnv,
16
4
  getNonArrayModel,
17
5
  ID,
18
- Int,
19
6
  JSON,
20
7
  scalarArgMap
21
8
  } from "@akanjs/base";
22
9
  import { applyMixins, capitalize, lowerlize } from "@akanjs/common";
23
- import { getClassMeta } from "@akanjs/constant";
24
- import { makeDefault } from "./gql";
10
+ import { constantInfo } from "@akanjs/constant";
11
+ import { sliceInit } from ".";
12
+ import { makeApiBuilder } from "./apiInfo";
13
+ import { makeInternalApiBuilder } from "./internalApiInfo";
14
+ import { signalInfo } from "./signalInfo";
25
15
  const ssoTypes = ["github", "google", "facebook", "apple", "naver", "kakao"];
26
16
  class SignalStorage {
27
17
  }
@@ -42,7 +32,7 @@ const emit = (data) => data;
42
32
  const done = (data) => data;
43
33
  const subscribe = () => void 0;
44
34
  const signalTypes = ["graphql", "restapi"];
45
- const endpointTypes = ["Query", "Mutation", "Message", "Pubsub", "Process", "Schedule"];
35
+ const endpointTypes = ["Query", "Mutation", "Message", "Pubsub", "Process", "Schedule", "ResolveField"];
46
36
  const guardTypes = ["Public", "None", "User", "Admin", "SuperAdmin", "Every", "Owner"];
47
37
  const roleTypes = ["Public", "User", "Admin", "SuperAdmin"];
48
38
  const argTypes = ["Body", "Param", "Query", "Upload", "Msg", "Room"];
@@ -68,50 +58,6 @@ const getDefaultArg = (argRef) => {
68
58
  else
69
59
  return {};
70
60
  };
71
- function Signal(returnsOrObj) {
72
- const returns = typeof returnsOrObj === "function" ? returnsOrObj : void 0;
73
- const prefix = typeof returnsOrObj === "object" ? returnsOrObj.prefix : void 0;
74
- return function(target) {
75
- if (returns) {
76
- const modelRef = returns();
77
- const classMeta = getClassMeta(modelRef);
78
- const gqlMetas = getGqlMetas(target);
79
- const modelName = lowerlize(classMeta.refName);
80
- const listName = `${modelName}ListIn`;
81
- const slices = [
82
- { refName: modelName, sliceName: modelName, argLength: 1, defaultArgs: [{}] },
83
- ...gqlMetas.filter((gqlMeta) => {
84
- const name = gqlMeta.signalOption.name ?? gqlMeta.key;
85
- if (!name.includes(listName))
86
- return false;
87
- const [retRef, arrDepth] = getNonArrayModel(gqlMeta.returns());
88
- return retRef.prototype === modelRef.prototype && arrDepth === 1;
89
- }).map((gqlMeta) => {
90
- const name = gqlMeta.signalOption.name ?? gqlMeta.key;
91
- const sliceName = name.replace(listName, `${modelName}In`);
92
- const [argMetas] = getArgMetas(target, gqlMeta.key);
93
- const skipIdx = argMetas.findIndex((argMeta) => argMeta.name === "skip");
94
- if (skipIdx === -1)
95
- throw new Error(`Invalid Args for ${sliceName}`);
96
- const argLength = skipIdx;
97
- const queryArgRefs = argMetas.slice(0, skipIdx).map((argMeta) => argMeta.returns());
98
- const defaultArgs = queryArgRefs.map(
99
- (queryArgRef, idx) => argMetas[idx].argsOption.nullable ? null : getDefaultArg(queryArgRef)
100
- );
101
- return { refName: modelName, sliceName, argLength, defaultArgs };
102
- })
103
- ];
104
- setSigMeta(target, { returns, prefix, slices, refName: modelName });
105
- setSignalRefOnStorage(modelName, target);
106
- } else {
107
- const refName = typeof returnsOrObj === "object" ? lowerlize(returnsOrObj.name) : void 0;
108
- if (!refName)
109
- throw new Error("Signal name is required");
110
- setSigMeta(target, { returns, prefix, slices: [], refName });
111
- setSignalRefOnStorage(refName, target);
112
- }
113
- };
114
- }
115
61
  const createArgMetaDecorator = (type) => {
116
62
  return function(option = {}) {
117
63
  return function(prototype, key, idx) {
@@ -338,106 +284,118 @@ function Parent() {
338
284
  setArgMetasOnPrototype(prototype, key, argMetas);
339
285
  };
340
286
  }
341
- function LogSignal(srv) {
342
- class BaseSignal {
343
- }
344
- return BaseSignal;
287
+ function internal(srv, internalBuilder, ...libInternals) {
288
+ const sigRef = libInternals.at(0) ?? class Internal {
289
+ };
290
+ signalInfo.setRefNameTemp(sigRef, srv.refName);
291
+ const buildInternal = internalBuilder(makeInternalApiBuilder());
292
+ Object.entries(buildInternal).forEach(([key, internal2]) => {
293
+ internal2.applyApiMeta(sigRef, key);
294
+ });
295
+ return sigRef;
345
296
  }
346
- function DbSignal(constant, srv, option) {
347
- var _a, _b, _c, _d, _e, _f, _g, _h;
348
- const meta = getClassMeta(constant.Full);
349
- const serviceName = `${lowerlize(meta.refName)}Service`;
350
- const [modelName, className] = [lowerlize(meta.refName), capitalize(meta.refName)];
297
+ function slice(srv, option, sliceBuilder, ...libSlices) {
298
+ if (!srv.cnst)
299
+ throw new Error("cnst is required");
300
+ const sigRef = libSlices.at(0) ?? class Slice {
301
+ };
302
+ signalInfo.setRefNameTemp(sigRef, srv.refName);
303
+ const [modelName, className] = [srv.cnst.refName, capitalize(srv.cnst.refName)];
351
304
  const names = {
352
305
  modelId: `${modelName}Id`,
353
306
  model: modelName,
354
307
  lightModel: `light${className}`,
355
- modelList: `${modelName}List`,
356
- modelInsight: `${modelName}Insight`,
357
- modelExists: `${modelName}Exists`,
308
+ modelService: `${modelName}Service`,
358
309
  getModel: `get${className}`,
359
310
  createModel: `create${className}`,
360
311
  updateModel: `update${className}`,
361
312
  removeModel: `remove${className}`
362
313
  };
314
+ const getGuard = option.guards?.get ?? "Public";
315
+ const cruGuard = option.guards?.cru ?? "Public";
316
+ const init = sliceInit(srv.cnst.full, srv.cnst.light, srv.cnst.insight);
317
+ const { query, mutation } = makeApiBuilder();
318
+ const buildSlice = {
319
+ [""]: init("Admin").search("query", JSON).exec(function(query2) {
320
+ return query2 ?? {};
321
+ }),
322
+ ...sliceBuilder(init)
323
+ };
324
+ const buildEndpoint = {
325
+ [names.model]: query(srv.cnst.full, getGuard).param(names.modelId, ID).exec(async function(modelId) {
326
+ const service = this[names.modelService];
327
+ return await service[names.getModel](modelId);
328
+ }),
329
+ [names.lightModel]: query(srv.cnst.light, getGuard).param(names.modelId, ID).exec(async function(modelId) {
330
+ const service = this[names.modelService];
331
+ return await service[names.getModel](modelId);
332
+ }),
333
+ [names.createModel]: mutation(srv.cnst.full, cruGuard).body("data", srv.cnst.input).exec(async function(data) {
334
+ const service = this[names.modelService];
335
+ return await service[names.createModel](data);
336
+ }),
337
+ [names.updateModel]: mutation(srv.cnst.full, cruGuard).param(names.modelId, ID).body("data", srv.cnst.input).exec(async function(modelId, data) {
338
+ const service = this[names.modelService];
339
+ return await service[names.updateModel](modelId, data);
340
+ }),
341
+ [names.removeModel]: mutation(srv.cnst.full, { partial: ["removedAt"] }, cruGuard).param(names.modelId, ID).exec(async function(modelId) {
342
+ const service = this[names.modelService];
343
+ return await service[names.removeModel](modelId);
344
+ })
345
+ };
346
+ Object.entries(buildSlice).forEach(([key, slice2]) => {
347
+ if (!srv.cnst)
348
+ return;
349
+ slice2.applySliceMeta(srv.cnst.refName, sigRef, key);
350
+ });
351
+ Object.entries(buildEndpoint).forEach(([key, endpoint2]) => {
352
+ endpoint2.applyApiMeta(sigRef, key);
353
+ });
354
+ return sigRef;
355
+ }
356
+ function endpoint(srv, builder, ...libSignals) {
357
+ const sigRef = libSignals.at(0) ?? class Signal {
358
+ };
359
+ signalInfo.setRefNameTemp(sigRef, srv.refName);
360
+ const apiInfoMap = builder(makeApiBuilder());
361
+ Object.entries(apiInfoMap).forEach(([key, apiInfo]) => {
362
+ apiInfo.applyApiMeta(sigRef, key);
363
+ });
364
+ return sigRef;
365
+ }
366
+ const mergeSignals = (signalRef, internalRef, sliceRef) => {
367
+ applyMixins(signalRef, [internalRef, ...sliceRef ? [sliceRef] : []]);
368
+ const gqlMetaMap = getGqlMetaMapOnPrototype(signalRef.prototype);
369
+ const resolveFieldMetaMap = getResolveFieldMetaMapOnPrototype(signalRef.prototype);
370
+ setResolveFieldMetaMapOnPrototype(signalRef.prototype, resolveFieldMetaMap);
371
+ const internalGqlMetaMap = getGqlMetaMapOnPrototype(internalRef.prototype);
372
+ const internalResolveFieldMetaMap = getResolveFieldMetaMapOnPrototype(internalRef.prototype);
373
+ internalGqlMetaMap.forEach((value, key) => {
374
+ gqlMetaMap.set(key, value);
375
+ const [argMetas, internalArgMetas] = getArgMetas(internalRef, key);
376
+ setArgMetas(signalRef, key, argMetas, internalArgMetas);
377
+ });
378
+ internalResolveFieldMetaMap.forEach((value, key) => {
379
+ resolveFieldMetaMap.set(key, value);
380
+ });
381
+ if (sliceRef) {
382
+ const sliceGqlMetaMap = getGqlMetaMapOnPrototype(sliceRef.prototype);
383
+ sliceGqlMetaMap.forEach((value, key) => {
384
+ if (gqlMetaMap.has(key))
385
+ return;
386
+ gqlMetaMap.set(key, value);
387
+ const [argMetas, internalArgMetas] = getArgMetas(sliceRef, key);
388
+ setArgMetas(signalRef, key, argMetas, internalArgMetas);
389
+ });
390
+ }
391
+ setGqlMetaMapOnPrototype(signalRef.prototype, gqlMetaMap);
392
+ return signalRef;
393
+ };
394
+ function LogSignal(refName, srv, option) {
363
395
  class BaseSignal {
364
- async [_a = names.lightModel](id) {
365
- const service = this[serviceName];
366
- const model = await service[names.getModel](id);
367
- return resolve(model);
368
- }
369
- async [_b = names.model](id) {
370
- const service = this[serviceName];
371
- const model = await service[names.getModel](id);
372
- return resolve(model);
373
- }
374
- async [_c = names.modelList](query, skip, limit, sort) {
375
- const service = this[serviceName];
376
- const models = query?.$search ? await service.__searchDocs(query.$search, { skip, limit, sort }) : await service.__list(query, { skip, limit, sort });
377
- return resolve(models);
378
- }
379
- async [_d = names.modelInsight](query) {
380
- const service = this[serviceName];
381
- const insight = query.$search ? { ...makeDefault(constant.Insight), count: await service.__searchCount(query.$search) } : await service.__insight(query);
382
- return resolve(insight);
383
- }
384
- async [_e = names.modelExists](query) {
385
- const service = this[serviceName];
386
- const exists = await service.__exists(query);
387
- return resolve(exists);
388
- }
389
- async [_f = names.createModel](data) {
390
- const service = this[serviceName];
391
- const model = await service[names.createModel](data);
392
- return resolve(model);
393
- }
394
- async [_g = names.updateModel](id, data) {
395
- const service = this[serviceName];
396
- const model = await service[names.updateModel](id, data);
397
- return resolve(model);
398
- }
399
- async [_h = names.removeModel](id) {
400
- const service = this[serviceName];
401
- const model = await service[names.removeModel](id);
402
- return resolve(model);
403
- }
404
396
  }
405
- __decorateClass([
406
- option.guards.get(() => constant.Light),
407
- __decorateParam(0, Arg.Param(names.modelId, () => ID))
408
- ], BaseSignal.prototype, _a, 1);
409
- __decorateClass([
410
- option.guards.get(() => constant.Full),
411
- __decorateParam(0, Arg.Param(names.modelId, () => ID))
412
- ], BaseSignal.prototype, _b, 1);
413
- __decorateClass([
414
- Query.Admin(() => [constant.Full]),
415
- __decorateParam(0, Arg.Query("query", () => JSON)),
416
- __decorateParam(1, Arg.Query("skip", () => Int, { nullable: true, example: 0 })),
417
- __decorateParam(2, Arg.Query("limit", () => Int, { nullable: true, example: 20 })),
418
- __decorateParam(3, Arg.Query("sort", () => String, { nullable: true, example: "latest" }))
419
- ], BaseSignal.prototype, _c, 1);
420
- __decorateClass([
421
- Query.Admin(() => constant.Insight),
422
- __decorateParam(0, Arg.Query("query", () => JSON))
423
- ], BaseSignal.prototype, _d, 1);
424
- __decorateClass([
425
- Query.Admin(() => Boolean),
426
- __decorateParam(0, Arg.Query("query", () => JSON))
427
- ], BaseSignal.prototype, _e, 1);
428
- __decorateClass([
429
- option.guards.cru(() => constant.Full),
430
- __decorateParam(0, Arg.Body(`data`, () => constant.Input))
431
- ], BaseSignal.prototype, _f, 1);
432
- __decorateClass([
433
- option.guards.cru(() => constant.Full),
434
- __decorateParam(0, Arg.Param(names.modelId, () => ID)),
435
- __decorateParam(1, Arg.Body("data", () => constant.Input))
436
- ], BaseSignal.prototype, _g, 1);
437
- __decorateClass([
438
- option.guards.cru(() => constant.Full, { partial: ["status", "removedAt"] }),
439
- __decorateParam(0, Arg.Param(names.modelId, () => ID))
440
- ], BaseSignal.prototype, _h, 1);
397
+ signalInfo.setRefNameTemp(BaseSignal, refName);
398
+ signalInfo.setPrefixTemp(BaseSignal, option?.prefix ?? "");
441
399
  return BaseSignal;
442
400
  }
443
401
  const getSigMeta = (sigRef) => {
@@ -496,7 +454,7 @@ const setResolveFieldMetaMapOnPrototype = (prototype, resolveFieldMetaMap) => {
496
454
  Reflect.defineMetadata("resolveField", resolveFieldMetaMap, prototype);
497
455
  };
498
456
  const getControllerPrefix = (sigMeta) => {
499
- return sigMeta.returns ? lowerlize(getClassMeta(sigMeta.returns()).refName) : sigMeta.prefix;
457
+ return sigMeta.returns ? constantInfo.getRefName(sigMeta.returns()) : sigMeta.prefix;
500
458
  };
501
459
  const getControllerPath = (gqlMeta, paramArgMetas) => {
502
460
  return gqlMeta.signalOption.path ?? [gqlMeta.signalOption.name ?? gqlMeta.key, ...paramArgMetas.map((argMeta) => `:${argMeta.name}`)].join("/");
@@ -526,9 +484,7 @@ export {
526
484
  Access,
527
485
  Account,
528
486
  Arg,
529
- DbSignal,
530
487
  Job,
531
- LogSignal,
532
488
  Me,
533
489
  Message,
534
490
  Mutation,
@@ -541,7 +497,6 @@ export {
541
497
  ResolveField,
542
498
  Schedule,
543
499
  Self,
544
- Signal,
545
500
  SignalStorage,
546
501
  UserIp,
547
502
  Ws,
@@ -551,24 +506,32 @@ export {
551
506
  defaultAccount,
552
507
  done,
553
508
  emit,
509
+ endpoint,
554
510
  endpointTypes,
555
511
  getAllSignalRefs,
556
512
  getArgMetas,
557
513
  getControllerPath,
558
514
  getControllerPrefix,
515
+ getDefaultArg,
559
516
  getGqlMeta,
560
517
  getGqlMetaMapOnPrototype,
561
518
  getGqlMetas,
519
+ getResolveFieldMetaMapOnPrototype,
562
520
  getResolveFieldMetas,
563
521
  getSigMeta,
564
522
  getSignalRefsOnStorage,
565
523
  guardTypes,
524
+ internal,
566
525
  internalArgTypes,
526
+ mergeSignals,
567
527
  resolve,
568
528
  roleTypes,
569
529
  setArgMetas,
570
530
  setGqlMetaMapOnPrototype,
531
+ setSigMeta,
532
+ setSignalRefOnStorage,
571
533
  signalTypes,
534
+ slice,
572
535
  ssoTypes,
573
536
  subscribe
574
537
  };