@akanjs/constant 0.0.40 → 0.0.42
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/index.d.ts +1 -13
- package/index.js +891 -20
- package/package.json +6 -2
- package/src/baseGql.d.ts +8 -14
- package/src/classMeta.d.ts +19 -22
- package/src/constantDecorator.d.ts +6 -12
- package/src/fieldMeta.d.ts +2 -12
- package/src/filterMeta.d.ts +18 -26
- package/src/index.d.ts +7 -13
- package/src/scalar.d.ts +28 -34
- package/src/types.d.ts +92 -6
- package/base-D8mO_G-C.d.ts +0 -15
- package/src/baseGql.js +0 -275
- package/src/classMeta.js +0 -187
- package/src/constantDecorator.js +0 -56
- package/src/fieldMeta.js +0 -104
- package/src/filterMeta.js +0 -291
- package/src/index.js +0 -33
- package/src/scalar.js +0 -141
- package/src/types.js +0 -34
- package/types-DdO4B_Um.d.ts +0 -126
- package/types-b-U-yQib.d.ts +0 -33
package/src/filterMeta.js
DELETED
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var filterMeta_exports = {};
|
|
20
|
-
__export(filterMeta_exports, {
|
|
21
|
-
BaseFilter: () => BaseFilter,
|
|
22
|
-
Filter: () => Filter,
|
|
23
|
-
getFilterArgMetas: () => getFilterArgMetas,
|
|
24
|
-
getFilterKeyMetaMapOnPrototype: () => getFilterKeyMetaMapOnPrototype,
|
|
25
|
-
getFilterMeta: () => getFilterMeta,
|
|
26
|
-
getFilterQuery: () => getFilterQuery,
|
|
27
|
-
getFilterQueryMap: () => getFilterQueryMap,
|
|
28
|
-
getFilterSort: () => getFilterSort,
|
|
29
|
-
getFilterSortMap: () => getFilterSortMap,
|
|
30
|
-
isFilterModel: () => isFilterModel,
|
|
31
|
-
setFilterArgMetasOnPrototype: () => setFilterArgMetasOnPrototype,
|
|
32
|
-
setFilterKeyMetaMapOnPrototype: () => setFilterKeyMetaMapOnPrototype,
|
|
33
|
-
setFilterMeta: () => setFilterMeta,
|
|
34
|
-
sortOf: () => sortOf
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(filterMeta_exports);
|
|
37
|
-
var import_base = require("@akanjs/base");
|
|
38
|
-
var import_scalar = require("./scalar");
|
|
39
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
40
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
41
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
42
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
43
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
44
|
-
}
|
|
45
|
-
__name(_ts_decorate, "_ts_decorate");
|
|
46
|
-
function _ts_metadata(k, v) {
|
|
47
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
48
|
-
}
|
|
49
|
-
__name(_ts_metadata, "_ts_metadata");
|
|
50
|
-
function _ts_param(paramIndex, decorator) {
|
|
51
|
-
return function(target, key) {
|
|
52
|
-
decorator(target, key, paramIndex);
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
__name(_ts_param, "_ts_param");
|
|
56
|
-
const isFilterModel = /* @__PURE__ */ __name((filterRef) => {
|
|
57
|
-
return Reflect.getMetadata("filter", filterRef.prototype) !== void 0;
|
|
58
|
-
}, "isFilterModel");
|
|
59
|
-
const getFilterMeta = /* @__PURE__ */ __name((filterRef) => {
|
|
60
|
-
const filterMeta = Reflect.getMetadata("filter", filterRef.prototype);
|
|
61
|
-
if (!filterMeta) throw new Error("filterMeta is not defined");
|
|
62
|
-
return filterMeta;
|
|
63
|
-
}, "getFilterMeta");
|
|
64
|
-
const setFilterMeta = /* @__PURE__ */ __name((filterRef, filterMeta) => {
|
|
65
|
-
const existingFilterMeta = Reflect.getMetadata("filter", filterRef.prototype);
|
|
66
|
-
if (existingFilterMeta) Object.assign(filterMeta.sort, existingFilterMeta.sort);
|
|
67
|
-
Reflect.defineMetadata("filter", filterMeta, filterRef.prototype);
|
|
68
|
-
}, "setFilterMeta");
|
|
69
|
-
const getFilterKeyMetaMapOnPrototype = /* @__PURE__ */ __name((prototype) => {
|
|
70
|
-
const metadataMap = Reflect.getMetadata("filterKey", prototype) ?? /* @__PURE__ */ new Map();
|
|
71
|
-
return new Map(metadataMap);
|
|
72
|
-
}, "getFilterKeyMetaMapOnPrototype");
|
|
73
|
-
const setFilterKeyMetaMapOnPrototype = /* @__PURE__ */ __name((prototype, metadataMap) => {
|
|
74
|
-
Reflect.defineMetadata("filterKey", new Map(metadataMap), prototype);
|
|
75
|
-
}, "setFilterKeyMetaMapOnPrototype");
|
|
76
|
-
const applyFilterKeyMeta = /* @__PURE__ */ __name((option) => {
|
|
77
|
-
return (prototype, key, descriptor) => {
|
|
78
|
-
const metadata = {
|
|
79
|
-
key,
|
|
80
|
-
...option,
|
|
81
|
-
descriptor
|
|
82
|
-
};
|
|
83
|
-
const metadataMap = getFilterKeyMetaMapOnPrototype(prototype);
|
|
84
|
-
metadataMap.set(key, metadata);
|
|
85
|
-
setFilterKeyMetaMapOnPrototype(prototype, metadataMap);
|
|
86
|
-
};
|
|
87
|
-
}, "applyFilterKeyMeta");
|
|
88
|
-
const makeFilter = /* @__PURE__ */ __name((customOption) => (fieldOption) => {
|
|
89
|
-
return applyFilterKeyMeta({
|
|
90
|
-
...customOption,
|
|
91
|
-
...fieldOption
|
|
92
|
-
});
|
|
93
|
-
}, "makeFilter");
|
|
94
|
-
const getFilterArgMetasOnPrototype = /* @__PURE__ */ __name((prototype, key) => {
|
|
95
|
-
const filterArgMetas = Reflect.getMetadata("filterArg", prototype, key) ?? [];
|
|
96
|
-
return filterArgMetas;
|
|
97
|
-
}, "getFilterArgMetasOnPrototype");
|
|
98
|
-
const setFilterArgMetasOnPrototype = /* @__PURE__ */ __name((prototype, key, filterArgMetas) => {
|
|
99
|
-
Reflect.defineMetadata("filterArg", filterArgMetas, prototype, key);
|
|
100
|
-
}, "setFilterArgMetasOnPrototype");
|
|
101
|
-
const getFilterArgMetas = /* @__PURE__ */ __name((filterRef, key) => {
|
|
102
|
-
const filterArgMetas = getFilterArgMetasOnPrototype(filterRef.prototype, key);
|
|
103
|
-
return filterArgMetas;
|
|
104
|
-
}, "getFilterArgMetas");
|
|
105
|
-
const applyFilterArgMeta = /* @__PURE__ */ __name((name, returns, argOption) => {
|
|
106
|
-
return (prototype, key, idx) => {
|
|
107
|
-
const [modelRef, arrDepth] = (0, import_base.getNonArrayModel)(returns());
|
|
108
|
-
const [opt, optArrDepth] = (0, import_base.getNonArrayModel)(argOption ?? {});
|
|
109
|
-
const filterArgMeta = {
|
|
110
|
-
name,
|
|
111
|
-
...opt,
|
|
112
|
-
modelRef,
|
|
113
|
-
arrDepth,
|
|
114
|
-
isArray: arrDepth > 0,
|
|
115
|
-
optArrDepth
|
|
116
|
-
};
|
|
117
|
-
const filterArgMetas = getFilterArgMetasOnPrototype(prototype, key);
|
|
118
|
-
filterArgMetas[idx] = filterArgMeta;
|
|
119
|
-
setFilterArgMetasOnPrototype(prototype, key, filterArgMetas);
|
|
120
|
-
};
|
|
121
|
-
}, "applyFilterArgMeta");
|
|
122
|
-
const getFilterQuery = /* @__PURE__ */ __name((filterRef, key) => {
|
|
123
|
-
const filterKeyMetaMap = getFilterKeyMetaMapOnPrototype(filterRef.prototype);
|
|
124
|
-
const filterKeyMeta = filterKeyMetaMap.get(key);
|
|
125
|
-
if (!filterKeyMeta?.descriptor.value) throw new Error(`filterKeyMeta is not defined for key: ${key}`);
|
|
126
|
-
return filterKeyMeta.descriptor.value;
|
|
127
|
-
}, "getFilterQuery");
|
|
128
|
-
const getFilterQueryMap = /* @__PURE__ */ __name((filterRef) => {
|
|
129
|
-
const filterKeyMetaMap = getFilterKeyMetaMapOnPrototype(filterRef.prototype);
|
|
130
|
-
return filterKeyMetaMap;
|
|
131
|
-
}, "getFilterQueryMap");
|
|
132
|
-
const getFilterSort = /* @__PURE__ */ __name((filterRef, key) => {
|
|
133
|
-
const filterMeta = getFilterMeta(filterRef);
|
|
134
|
-
const sort = filterMeta.sort[key];
|
|
135
|
-
return sort;
|
|
136
|
-
}, "getFilterSort");
|
|
137
|
-
const getFilterSortMap = /* @__PURE__ */ __name((filterRef) => {
|
|
138
|
-
const filterMeta = getFilterMeta(filterRef);
|
|
139
|
-
return filterMeta.sort;
|
|
140
|
-
}, "getFilterSortMap");
|
|
141
|
-
const Filter = {
|
|
142
|
-
Mongo: makeFilter({
|
|
143
|
-
type: "mongo"
|
|
144
|
-
}),
|
|
145
|
-
// Meili: makeFilter({ fieldType: "hidden", nullable: true }),
|
|
146
|
-
Arg: applyFilterArgMeta
|
|
147
|
-
};
|
|
148
|
-
const sortOf = /* @__PURE__ */ __name((modelRef, sort) => {
|
|
149
|
-
const fieldMetaMap = (0, import_scalar.getFieldMetaMap)(modelRef);
|
|
150
|
-
const statusFieldMeta = fieldMetaMap.get("status");
|
|
151
|
-
if (!statusFieldMeta) throw new Error(`No status field meta fount in ${modelRef.name}`);
|
|
152
|
-
let BaseFilter2 = class BaseFilter {
|
|
153
|
-
static {
|
|
154
|
-
__name(this, "BaseFilter");
|
|
155
|
-
}
|
|
156
|
-
latest = {
|
|
157
|
-
createdAt: -1
|
|
158
|
-
};
|
|
159
|
-
oldest = {
|
|
160
|
-
createdAt: 1
|
|
161
|
-
};
|
|
162
|
-
any() {
|
|
163
|
-
return {
|
|
164
|
-
removedAt: {
|
|
165
|
-
$exists: false
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
byStatuses(statuses) {
|
|
170
|
-
return statuses?.length ? {
|
|
171
|
-
status: {
|
|
172
|
-
$in: statuses
|
|
173
|
-
}
|
|
174
|
-
} : {};
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
_ts_decorate([
|
|
178
|
-
Filter.Mongo(),
|
|
179
|
-
_ts_metadata("design:type", Function),
|
|
180
|
-
_ts_metadata("design:paramtypes", []),
|
|
181
|
-
_ts_metadata("design:returntype", void 0)
|
|
182
|
-
], BaseFilter2.prototype, "any", null);
|
|
183
|
-
_ts_decorate([
|
|
184
|
-
Filter.Mongo(),
|
|
185
|
-
_ts_param(0, Filter.Arg("statuses", () => [
|
|
186
|
-
String
|
|
187
|
-
], {
|
|
188
|
-
nullable: true,
|
|
189
|
-
enum: statusFieldMeta?.enum
|
|
190
|
-
})),
|
|
191
|
-
_ts_metadata("design:type", Function),
|
|
192
|
-
_ts_metadata("design:paramtypes", [
|
|
193
|
-
Object
|
|
194
|
-
]),
|
|
195
|
-
_ts_metadata("design:returntype", void 0)
|
|
196
|
-
], BaseFilter2.prototype, "byStatuses", null);
|
|
197
|
-
Object.assign(BaseFilter2.prototype, sort);
|
|
198
|
-
setFilterMeta(BaseFilter2, {
|
|
199
|
-
refName: "BaseFilter",
|
|
200
|
-
sort: Object.assign({
|
|
201
|
-
latest: {
|
|
202
|
-
createdAt: -1
|
|
203
|
-
},
|
|
204
|
-
oldest: {
|
|
205
|
-
createdAt: 1
|
|
206
|
-
}
|
|
207
|
-
}, sort)
|
|
208
|
-
});
|
|
209
|
-
return BaseFilter2;
|
|
210
|
-
}, "sortOf");
|
|
211
|
-
function BaseFilter(modelRef, sort) {
|
|
212
|
-
const fieldMetaMap = (0, import_scalar.getFieldMetaMap)(modelRef);
|
|
213
|
-
const statusFieldMeta = fieldMetaMap.get("status");
|
|
214
|
-
if (!statusFieldMeta) throw new Error(`No status field meta fount in ${modelRef.name}`);
|
|
215
|
-
let BaseFilter2 = class BaseFilter {
|
|
216
|
-
static {
|
|
217
|
-
__name(this, "BaseFilter");
|
|
218
|
-
}
|
|
219
|
-
latest = {
|
|
220
|
-
createdAt: -1
|
|
221
|
-
};
|
|
222
|
-
oldest = {
|
|
223
|
-
createdAt: 1
|
|
224
|
-
};
|
|
225
|
-
any() {
|
|
226
|
-
return {
|
|
227
|
-
removedAt: {
|
|
228
|
-
$exists: false
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
byStatuses(statuses) {
|
|
233
|
-
return statuses?.length ? {
|
|
234
|
-
status: {
|
|
235
|
-
$in: statuses
|
|
236
|
-
}
|
|
237
|
-
} : {};
|
|
238
|
-
}
|
|
239
|
-
};
|
|
240
|
-
_ts_decorate([
|
|
241
|
-
Filter.Mongo(),
|
|
242
|
-
_ts_metadata("design:type", Function),
|
|
243
|
-
_ts_metadata("design:paramtypes", []),
|
|
244
|
-
_ts_metadata("design:returntype", void 0)
|
|
245
|
-
], BaseFilter2.prototype, "any", null);
|
|
246
|
-
_ts_decorate([
|
|
247
|
-
Filter.Mongo(),
|
|
248
|
-
_ts_param(0, Filter.Arg("statuses", () => [
|
|
249
|
-
String
|
|
250
|
-
], {
|
|
251
|
-
nullable: true,
|
|
252
|
-
enum: statusFieldMeta?.enum
|
|
253
|
-
})),
|
|
254
|
-
_ts_metadata("design:type", Function),
|
|
255
|
-
_ts_metadata("design:paramtypes", [
|
|
256
|
-
Object
|
|
257
|
-
]),
|
|
258
|
-
_ts_metadata("design:returntype", void 0)
|
|
259
|
-
], BaseFilter2.prototype, "byStatuses", null);
|
|
260
|
-
Object.assign(BaseFilter2.prototype, sort);
|
|
261
|
-
setFilterMeta(BaseFilter2, {
|
|
262
|
-
refName: "BaseFilter",
|
|
263
|
-
sort: Object.assign({
|
|
264
|
-
latest: {
|
|
265
|
-
createdAt: -1
|
|
266
|
-
},
|
|
267
|
-
oldest: {
|
|
268
|
-
createdAt: 1
|
|
269
|
-
}
|
|
270
|
-
}, sort)
|
|
271
|
-
});
|
|
272
|
-
return BaseFilter2;
|
|
273
|
-
}
|
|
274
|
-
__name(BaseFilter, "BaseFilter");
|
|
275
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
276
|
-
0 && (module.exports = {
|
|
277
|
-
BaseFilter,
|
|
278
|
-
Filter,
|
|
279
|
-
getFilterArgMetas,
|
|
280
|
-
getFilterKeyMetaMapOnPrototype,
|
|
281
|
-
getFilterMeta,
|
|
282
|
-
getFilterQuery,
|
|
283
|
-
getFilterQueryMap,
|
|
284
|
-
getFilterSort,
|
|
285
|
-
getFilterSortMap,
|
|
286
|
-
isFilterModel,
|
|
287
|
-
setFilterArgMetasOnPrototype,
|
|
288
|
-
setFilterKeyMetaMapOnPrototype,
|
|
289
|
-
setFilterMeta,
|
|
290
|
-
sortOf
|
|
291
|
-
});
|
package/src/index.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var src_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(src_exports);
|
|
17
|
-
__reExport(src_exports, require("./types"), module.exports);
|
|
18
|
-
__reExport(src_exports, require("./fieldMeta"), module.exports);
|
|
19
|
-
__reExport(src_exports, require("./scalar"), module.exports);
|
|
20
|
-
__reExport(src_exports, require("./constantDecorator"), module.exports);
|
|
21
|
-
__reExport(src_exports, require("./filterMeta"), module.exports);
|
|
22
|
-
__reExport(src_exports, require("./baseGql"), module.exports);
|
|
23
|
-
__reExport(src_exports, require("./classMeta"), module.exports);
|
|
24
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
25
|
-
0 && (module.exports = {
|
|
26
|
-
...require("./types"),
|
|
27
|
-
...require("./fieldMeta"),
|
|
28
|
-
...require("./scalar"),
|
|
29
|
-
...require("./constantDecorator"),
|
|
30
|
-
...require("./filterMeta"),
|
|
31
|
-
...require("./baseGql"),
|
|
32
|
-
...require("./classMeta")
|
|
33
|
-
});
|
package/src/scalar.js
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var scalar_exports = {};
|
|
20
|
-
__export(scalar_exports, {
|
|
21
|
-
fieldTypes: () => fieldTypes,
|
|
22
|
-
getClassMeta: () => getClassMeta,
|
|
23
|
-
getFieldMetaMap: () => getFieldMetaMap,
|
|
24
|
-
getFieldMetaMapOnPrototype: () => getFieldMetaMapOnPrototype,
|
|
25
|
-
getFieldMetas: () => getFieldMetas,
|
|
26
|
-
getGqlTypeStr: () => getGqlTypeStr,
|
|
27
|
-
getQueryMap: () => getQueryMap,
|
|
28
|
-
getScalarExample: () => getScalarExample,
|
|
29
|
-
isConstantModel: () => isConstantModel,
|
|
30
|
-
scalarExampleMap: () => scalarExampleMap,
|
|
31
|
-
setFieldMetaMap: () => setFieldMetaMap,
|
|
32
|
-
setFieldMetaMapOnPrototype: () => setFieldMetaMapOnPrototype
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(scalar_exports);
|
|
35
|
-
var import_reflect_metadata = require("reflect-metadata");
|
|
36
|
-
var import_base = require("@akanjs/base");
|
|
37
|
-
const scalarExampleMap = /* @__PURE__ */ new Map([
|
|
38
|
-
[
|
|
39
|
-
import_base.ID,
|
|
40
|
-
"1234567890abcdef12345678"
|
|
41
|
-
],
|
|
42
|
-
[
|
|
43
|
-
import_base.Int,
|
|
44
|
-
0
|
|
45
|
-
],
|
|
46
|
-
[
|
|
47
|
-
import_base.Float,
|
|
48
|
-
0
|
|
49
|
-
],
|
|
50
|
-
[
|
|
51
|
-
String,
|
|
52
|
-
"String"
|
|
53
|
-
],
|
|
54
|
-
[
|
|
55
|
-
Boolean,
|
|
56
|
-
true
|
|
57
|
-
],
|
|
58
|
-
[
|
|
59
|
-
Date,
|
|
60
|
-
(/* @__PURE__ */ new Date()).toISOString()
|
|
61
|
-
],
|
|
62
|
-
[
|
|
63
|
-
import_base.Upload,
|
|
64
|
-
"FileUpload"
|
|
65
|
-
],
|
|
66
|
-
[
|
|
67
|
-
import_base.JSON,
|
|
68
|
-
{}
|
|
69
|
-
],
|
|
70
|
-
[
|
|
71
|
-
Map,
|
|
72
|
-
{}
|
|
73
|
-
]
|
|
74
|
-
]);
|
|
75
|
-
const getScalarExample = /* @__PURE__ */ __name((ref) => scalarExampleMap.get(ref) ?? null, "getScalarExample");
|
|
76
|
-
const getGqlTypeStr = /* @__PURE__ */ __name((ref) => import_base.scalarNameMap.get(ref) ?? getClassMeta(ref).refName, "getGqlTypeStr");
|
|
77
|
-
const fieldTypes = [
|
|
78
|
-
"email",
|
|
79
|
-
"password",
|
|
80
|
-
"url"
|
|
81
|
-
];
|
|
82
|
-
const getClassMeta = /* @__PURE__ */ __name((modelRef) => {
|
|
83
|
-
const [target] = (0, import_base.getNonArrayModel)(modelRef);
|
|
84
|
-
const classMeta = Reflect.getMetadata("class", target.prototype);
|
|
85
|
-
if (!classMeta) throw new Error(`No ClassMeta for this target ${target.name}`);
|
|
86
|
-
return classMeta;
|
|
87
|
-
}, "getClassMeta");
|
|
88
|
-
const getFieldMetas = /* @__PURE__ */ __name((modelRef) => {
|
|
89
|
-
const [target] = (0, import_base.getNonArrayModel)(modelRef);
|
|
90
|
-
const metadataMap = Reflect.getMetadata("fields", target.prototype) ?? /* @__PURE__ */ new Map();
|
|
91
|
-
const keySortMap = {
|
|
92
|
-
id: -1,
|
|
93
|
-
createdAt: 1,
|
|
94
|
-
updatedAt: 2,
|
|
95
|
-
removedAt: 3
|
|
96
|
-
};
|
|
97
|
-
return [
|
|
98
|
-
...metadataMap.values()
|
|
99
|
-
].sort((a, b) => (keySortMap[a.key] ?? 0) - (keySortMap[b.key] ?? 0));
|
|
100
|
-
}, "getFieldMetas");
|
|
101
|
-
const isConstantModel = /* @__PURE__ */ __name((modelRef) => {
|
|
102
|
-
return Reflect.getMetadata("class", modelRef.prototype) !== void 0;
|
|
103
|
-
}, "isConstantModel");
|
|
104
|
-
const getFieldMetaMap = /* @__PURE__ */ __name((modelRef) => {
|
|
105
|
-
const [target] = (0, import_base.getNonArrayModel)(modelRef);
|
|
106
|
-
const metadataMap = Reflect.getMetadata("fields", target.prototype) ?? /* @__PURE__ */ new Map();
|
|
107
|
-
return new Map(metadataMap);
|
|
108
|
-
}, "getFieldMetaMap");
|
|
109
|
-
const setFieldMetaMap = /* @__PURE__ */ __name((modelRef, metadataMap) => {
|
|
110
|
-
const [target] = (0, import_base.getNonArrayModel)(modelRef);
|
|
111
|
-
Reflect.defineMetadata("fields", new Map(metadataMap), target.prototype);
|
|
112
|
-
}, "setFieldMetaMap");
|
|
113
|
-
const getFieldMetaMapOnPrototype = /* @__PURE__ */ __name((prototype) => {
|
|
114
|
-
const metadataMap = Reflect.getMetadata("fields", prototype) ?? /* @__PURE__ */ new Map();
|
|
115
|
-
return new Map(metadataMap);
|
|
116
|
-
}, "getFieldMetaMapOnPrototype");
|
|
117
|
-
const setFieldMetaMapOnPrototype = /* @__PURE__ */ __name((prototype, metadataMap) => {
|
|
118
|
-
Reflect.defineMetadata("fields", new Map(metadataMap), prototype);
|
|
119
|
-
}, "setFieldMetaMapOnPrototype");
|
|
120
|
-
const getQueryMap = /* @__PURE__ */ __name((modelRef) => {
|
|
121
|
-
const fieldMetas = getFieldMetas(modelRef);
|
|
122
|
-
return Object.fromEntries(fieldMetas.filter((fieldMeta) => !!fieldMeta.query).map((fieldMeta) => [
|
|
123
|
-
fieldMeta.key,
|
|
124
|
-
fieldMeta.query
|
|
125
|
-
]));
|
|
126
|
-
}, "getQueryMap");
|
|
127
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
128
|
-
0 && (module.exports = {
|
|
129
|
-
fieldTypes,
|
|
130
|
-
getClassMeta,
|
|
131
|
-
getFieldMetaMap,
|
|
132
|
-
getFieldMetaMapOnPrototype,
|
|
133
|
-
getFieldMetas,
|
|
134
|
-
getGqlTypeStr,
|
|
135
|
-
getQueryMap,
|
|
136
|
-
getScalarExample,
|
|
137
|
-
isConstantModel,
|
|
138
|
-
scalarExampleMap,
|
|
139
|
-
setFieldMetaMap,
|
|
140
|
-
setFieldMetaMapOnPrototype
|
|
141
|
-
});
|
package/src/types.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
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 types_exports = {};
|
|
19
|
-
__export(types_exports, {
|
|
20
|
-
DEFAULT_PAGE_SIZE: () => DEFAULT_PAGE_SIZE,
|
|
21
|
-
defaultListOption: () => defaultListOption
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(types_exports);
|
|
24
|
-
const defaultListOption = {
|
|
25
|
-
limit: 20,
|
|
26
|
-
skip: 0,
|
|
27
|
-
sort: "latest"
|
|
28
|
-
};
|
|
29
|
-
const DEFAULT_PAGE_SIZE = 20;
|
|
30
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
-
0 && (module.exports = {
|
|
32
|
-
DEFAULT_PAGE_SIZE,
|
|
33
|
-
defaultListOption
|
|
34
|
-
});
|
package/types-DdO4B_Um.d.ts
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { Dayjs } from 'dayjs';
|
|
2
|
-
import { ReadStream } from 'fs';
|
|
3
|
-
import { Readable } from 'stream';
|
|
4
|
-
import { T as Type, G as GraphQLJSON, a as GraphQLUpload } from './types-b-U-yQib.js';
|
|
5
|
-
import { ProjectionType, HydratedDocument } from 'mongoose';
|
|
6
|
-
|
|
7
|
-
declare class BaseObject {
|
|
8
|
-
id: string;
|
|
9
|
-
createdAt: Dayjs;
|
|
10
|
-
updatedAt: Dayjs;
|
|
11
|
-
removedAt: Dayjs | null;
|
|
12
|
-
}
|
|
13
|
-
declare class Int {
|
|
14
|
-
__Scalar__: "int";
|
|
15
|
-
}
|
|
16
|
-
declare class Upload {
|
|
17
|
-
__Scalar__: "upload";
|
|
18
|
-
filename: string;
|
|
19
|
-
mimetype: string;
|
|
20
|
-
encoding: string;
|
|
21
|
-
createReadStream: () => ReadStream | Readable;
|
|
22
|
-
}
|
|
23
|
-
declare class Float {
|
|
24
|
-
__Scalar__: "float";
|
|
25
|
-
}
|
|
26
|
-
declare class ID {
|
|
27
|
-
__Scalar__: "id";
|
|
28
|
-
}
|
|
29
|
-
declare class JSON {
|
|
30
|
-
__Scalar__: "json";
|
|
31
|
-
}
|
|
32
|
-
type SingleFieldType = Int | Float | StringConstructor | BooleanConstructor | ID | DateConstructor | JSON | Type | GraphQLJSON | GraphQLUpload;
|
|
33
|
-
declare const gqlScalars: readonly [StringConstructor, BooleanConstructor, DateConstructor, typeof ID, typeof Int, typeof Float, typeof Upload, typeof JSON, MapConstructor];
|
|
34
|
-
type GqlScalar = (typeof gqlScalars)[number];
|
|
35
|
-
|
|
36
|
-
type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
|
|
37
|
-
type OptionalKeys<T> = T extends {
|
|
38
|
-
[key: string]: any;
|
|
39
|
-
} ? {
|
|
40
|
-
[K in keyof T]-?: null extends T[K] ? K : never;
|
|
41
|
-
}[keyof T] : never;
|
|
42
|
-
type ObjectToId<O, D = Dayjs> = O extends BaseObject ? string : O extends BaseObject[] ? string[] : O extends Dayjs ? D : O extends {
|
|
43
|
-
[key: string]: any;
|
|
44
|
-
} ? DocumentModel<O> : O;
|
|
45
|
-
interface SortType {
|
|
46
|
-
[key: string]: {
|
|
47
|
-
[key: string]: number;
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
type SortOf<Filter> = keyof GetStateObject<Filter>;
|
|
51
|
-
type FilterType = Record<string, any>;
|
|
52
|
-
interface ListQueryOption<Sort, Obj> {
|
|
53
|
-
skip?: number | null;
|
|
54
|
-
limit?: number | null;
|
|
55
|
-
sort?: Sort | null;
|
|
56
|
-
sample?: number;
|
|
57
|
-
select?: ProjectionType<Obj>;
|
|
58
|
-
}
|
|
59
|
-
interface FindQueryOption<Sort, Obj> {
|
|
60
|
-
skip?: number | null;
|
|
61
|
-
sort?: Sort | null;
|
|
62
|
-
sample?: boolean;
|
|
63
|
-
select?: ProjectionType<Obj>;
|
|
64
|
-
}
|
|
65
|
-
type DocumentModel<T, D = Dayjs> = T extends (infer S)[] ? DocumentModel<S>[] : T extends string ? T : T extends number ? T : T extends boolean ? T : T extends Dayjs ? T : T extends Map<infer K, infer V> ? Map<K, DocumentModel<V, D>> : Optional<{
|
|
66
|
-
[K in keyof GetStateObject<T>]: T[K] extends infer S ? S extends null ? undefined : ObjectToId<T[K], D> : never;
|
|
67
|
-
}, OptionalKeys<GetStateObject<T>>>;
|
|
68
|
-
interface ListOption {
|
|
69
|
-
limit?: number;
|
|
70
|
-
skip?: number;
|
|
71
|
-
sort?: string;
|
|
72
|
-
}
|
|
73
|
-
declare const defaultListOption: ListOption;
|
|
74
|
-
type GetPlainObject<T, O extends string> = Omit<{
|
|
75
|
-
[K in keyof T as T[K] extends (...args: any) => any ? never : K extends keyof HydratedDocument<any> ? never : K]: T[K];
|
|
76
|
-
}, O>;
|
|
77
|
-
type GetStateObject<T> = Omit<{
|
|
78
|
-
[K in keyof T as T[K] extends (...args: any) => any ? never : K]: T[K];
|
|
79
|
-
}, "prototype">;
|
|
80
|
-
type GetActionObject<T> = Omit<{
|
|
81
|
-
[K in keyof T as T[K] extends (...args: any) => any ? K : never]: T[K];
|
|
82
|
-
}, "prototype">;
|
|
83
|
-
interface ProtoFile {
|
|
84
|
-
id: string;
|
|
85
|
-
filename: string;
|
|
86
|
-
abstractData: string | null;
|
|
87
|
-
imageSize: [number, number];
|
|
88
|
-
progress: number | null;
|
|
89
|
-
url: string;
|
|
90
|
-
size: number;
|
|
91
|
-
status: string;
|
|
92
|
-
createdAt: Dayjs;
|
|
93
|
-
updatedAt: Dayjs;
|
|
94
|
-
removedAt: Dayjs | null;
|
|
95
|
-
mimetype: string;
|
|
96
|
-
encoding: string;
|
|
97
|
-
origin: string | null;
|
|
98
|
-
lastModifiedAt: Dayjs;
|
|
99
|
-
}
|
|
100
|
-
interface ProtoAppInfo {
|
|
101
|
-
appId: string | null;
|
|
102
|
-
appName: string;
|
|
103
|
-
deviceId: string | null;
|
|
104
|
-
platform: "ios" | "android" | null;
|
|
105
|
-
major: number;
|
|
106
|
-
minor: number;
|
|
107
|
-
patch: number;
|
|
108
|
-
branch: string;
|
|
109
|
-
buildNum: string | null;
|
|
110
|
-
versionOs: string | null;
|
|
111
|
-
isEmulator: boolean | null;
|
|
112
|
-
}
|
|
113
|
-
interface ProtoPatch {
|
|
114
|
-
source: ProtoFile;
|
|
115
|
-
build: ProtoFile;
|
|
116
|
-
appBuild: ProtoFile | null;
|
|
117
|
-
status: "active" | "expired";
|
|
118
|
-
at: Dayjs;
|
|
119
|
-
}
|
|
120
|
-
declare const DEFAULT_PAGE_SIZE = 20;
|
|
121
|
-
interface TextDoc {
|
|
122
|
-
[key: string]: string | TextDoc;
|
|
123
|
-
}
|
|
124
|
-
type NonFunctionalKeys<T> = keyof T extends (...any: any[]) => any ? never : keyof T;
|
|
125
|
-
|
|
126
|
-
export { BaseObject as B, type DocumentModel as D, type FilterType as F, type GetPlainObject as G, Int as I, JSON as J, type ListQueryOption as L, type NonFunctionalKeys as N, type ProtoFile as P, type SortType as S, type TextDoc as T, Upload as U, type SortOf as a, type FindQueryOption as b, type ListOption as c, defaultListOption as d, type GetStateObject as e, type GetActionObject as f, type ProtoAppInfo as g, type ProtoPatch as h, DEFAULT_PAGE_SIZE as i, type SingleFieldType as j, type GqlScalar as k, Float as l, ID as m };
|
package/types-b-U-yQib.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
type Type<T = any> = new (...args: any[]) => T;
|
|
2
|
-
interface GraphQLUpload {
|
|
3
|
-
name: string;
|
|
4
|
-
description: string;
|
|
5
|
-
specifiedByUrl: string;
|
|
6
|
-
serialize: any;
|
|
7
|
-
parseValue: any;
|
|
8
|
-
parseLiteral: any;
|
|
9
|
-
extensions: any;
|
|
10
|
-
astNode: any;
|
|
11
|
-
extensionASTNodes: any;
|
|
12
|
-
toConfig(): any;
|
|
13
|
-
toString(): string;
|
|
14
|
-
toJSON(): string;
|
|
15
|
-
inspect(): string;
|
|
16
|
-
}
|
|
17
|
-
interface GraphQLJSON<TInternal = unknown, TExternal = TInternal> {
|
|
18
|
-
name: string;
|
|
19
|
-
description: string;
|
|
20
|
-
specifiedByURL: string;
|
|
21
|
-
serialize: any;
|
|
22
|
-
parseValue: any;
|
|
23
|
-
parseLiteral: any;
|
|
24
|
-
extensions: any;
|
|
25
|
-
astNode: any;
|
|
26
|
-
extensionASTNodes: any;
|
|
27
|
-
get [Symbol.toStringTag](): string;
|
|
28
|
-
toConfig(): any;
|
|
29
|
-
toString(): string;
|
|
30
|
-
toJSON(): string;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export type { GraphQLJSON as G, Type as T, GraphQLUpload as a };
|