@orion-js/dogs 4.0.0-alpha.2 → 4.0.0-next.0
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/dist/index.cjs +7 -7
- package/dist/index.d.ts +4 -537
- package/dist/index.js +7 -7
- package/package.json +7 -7
package/dist/index.cjs
CHANGED
|
@@ -6916,7 +6916,7 @@ __export(exports_src, {
|
|
|
6916
6916
|
});
|
|
6917
6917
|
module.exports = __toCommonJS(exports_src);
|
|
6918
6918
|
|
|
6919
|
-
//
|
|
6919
|
+
// node_modules/@orion-js/services/dist/index.js
|
|
6920
6920
|
var __create2 = Object.create;
|
|
6921
6921
|
var __getProtoOf2 = Object.getPrototypeOf;
|
|
6922
6922
|
var __defProp2 = Object.defineProperty;
|
|
@@ -8178,7 +8178,7 @@ var Reflect2;
|
|
|
8178
8178
|
var import_typedi = __toESM2(require_cjs(), 1);
|
|
8179
8179
|
var import_typedi2 = __toESM2(require_cjs(), 1);
|
|
8180
8180
|
function getInstance(service) {
|
|
8181
|
-
return import_typedi.
|
|
8181
|
+
return import_typedi.Container.get(service);
|
|
8182
8182
|
}
|
|
8183
8183
|
var export_Service = import_typedi2.Service;
|
|
8184
8184
|
var export_Inject = import_typedi2.Inject;
|
|
@@ -8194,7 +8194,7 @@ var defineJob = (options) => {
|
|
|
8194
8194
|
return options;
|
|
8195
8195
|
};
|
|
8196
8196
|
|
|
8197
|
-
//
|
|
8197
|
+
// node_modules/@orion-js/logger/dist/index.js
|
|
8198
8198
|
var import_node_module = require("node:module");
|
|
8199
8199
|
var import_node_util = __toESM(require("node:util"));
|
|
8200
8200
|
var __create3 = Object.create;
|
|
@@ -24861,7 +24861,7 @@ var improveFileName = (path) => {
|
|
|
24861
24861
|
return path;
|
|
24862
24862
|
};
|
|
24863
24863
|
var transports2 = [
|
|
24864
|
-
|
|
24864
|
+
textConsoleTransport
|
|
24865
24865
|
];
|
|
24866
24866
|
var winstonLogger = import_winston2.createLogger({
|
|
24867
24867
|
levels: import_winston2.config.npm.levels,
|
|
@@ -24903,7 +24903,7 @@ var createLogger = (logger) => {
|
|
|
24903
24903
|
var logger = createLogger(winstonLogger);
|
|
24904
24904
|
var export_winston = import_winston3.default;
|
|
24905
24905
|
|
|
24906
|
-
//
|
|
24906
|
+
// node_modules/@orion-js/helpers/dist/index.js
|
|
24907
24907
|
var import_node_module2 = require("node:module");
|
|
24908
24908
|
var import_crypto = __toESM(require("crypto"));
|
|
24909
24909
|
var __create4 = Object.create;
|
|
@@ -25634,7 +25634,7 @@ var v3 = import_dist.default.v3;
|
|
|
25634
25634
|
var v4 = import_dist.default.v4;
|
|
25635
25635
|
var v5 = import_dist.default.v5;
|
|
25636
25636
|
|
|
25637
|
-
//
|
|
25637
|
+
// node_modules/@orion-js/mongodb/dist/index.js
|
|
25638
25638
|
var import_node_module3 = require("node:module");
|
|
25639
25639
|
var import_node_module4 = require("node:module");
|
|
25640
25640
|
var import_crypto2 = __toESM(require("crypto"));
|
|
@@ -106660,7 +106660,7 @@ var export_Container2 = import_typedi22.Container;
|
|
|
106660
106660
|
// src/repos/JobsRepo.ts
|
|
106661
106661
|
var import_lodash4 = __toESM(require_lodash3());
|
|
106662
106662
|
|
|
106663
|
-
//
|
|
106663
|
+
// node_modules/@orion-js/typed-model/dist/index.js
|
|
106664
106664
|
var import_node_module7 = require("node:module");
|
|
106665
106665
|
var import_crypto3 = __toESM(require("crypto"));
|
|
106666
106666
|
var __create7 = Object.create;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
// Generated by dts-bundle-generator v9.5.1
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
3
|
+
import { OrionLogger } from '@orion-js/logger';
|
|
4
|
+
import { ModelToDocumentTypeWithoutId } from '@orion-js/mongodb';
|
|
5
5
|
|
|
6
6
|
export type Blackbox = {
|
|
7
7
|
[name: string]: any;
|
|
8
8
|
};
|
|
9
|
-
export type LogFunction = (message: string, metadata?: any) => void;
|
|
10
|
-
export interface OrionLogger {
|
|
11
|
-
debug: LogFunction;
|
|
12
|
-
info: LogFunction;
|
|
13
|
-
warn: LogFunction;
|
|
14
|
-
error: LogFunction;
|
|
15
|
-
addContext: (module: NodeJS.Module) => OrionLogger;
|
|
16
|
-
addMetadata: (metadata: any) => OrionLogger;
|
|
17
|
-
}
|
|
18
9
|
export interface JobToRun {
|
|
19
10
|
jobId: string;
|
|
20
11
|
executionId: string;
|
|
@@ -157,530 +148,6 @@ export interface ScheduleJobRecordOptions {
|
|
|
157
148
|
priority: number;
|
|
158
149
|
uniqueIdentifier?: string;
|
|
159
150
|
}
|
|
160
|
-
// Generated by dts-bundle-generator v9.5.1
|
|
161
|
-
// Generated by dts-bundle-generator v9.5.1
|
|
162
|
-
// Generated by dts-bundle-generator v9.5.1
|
|
163
|
-
export interface StoredCacheData {
|
|
164
|
-
value: any;
|
|
165
|
-
expires?: Date;
|
|
166
|
-
}
|
|
167
|
-
export interface SetCacheOptions {
|
|
168
|
-
ttl?: number;
|
|
169
|
-
}
|
|
170
|
-
export interface GetCacheOptions {
|
|
171
|
-
ttl?: number;
|
|
172
|
-
fallback?(): Promise<any>;
|
|
173
|
-
}
|
|
174
|
-
export interface OrionCache {
|
|
175
|
-
/**
|
|
176
|
-
* Save data in the cache
|
|
177
|
-
*/
|
|
178
|
-
set(key: string, value: any, options?: SetCacheOptions): Promise<void> | void;
|
|
179
|
-
/**
|
|
180
|
-
* Get data from the cache
|
|
181
|
-
*/
|
|
182
|
-
get(key: string, options?: GetCacheOptions): Promise<StoredCacheData>;
|
|
183
|
-
/**
|
|
184
|
-
* Removes data from the cache
|
|
185
|
-
*/
|
|
186
|
-
invalidate(key: string): Promise<void> | void;
|
|
187
|
-
}
|
|
188
|
-
type Blackbox$1 = {
|
|
189
|
-
[name: string]: any;
|
|
190
|
-
};
|
|
191
|
-
export type ModelResolverResolve = (item: any, params: any, viewer: any, info?: any) => Promise<any>;
|
|
192
|
-
export type GlobalCheckPermissions = (params: any, viewer: any, info?: any) => Promise<string | void>;
|
|
193
|
-
export type ModelCheckPermissions = (parent: any, params: any, viewer: any, info?: any) => Promise<string | void>;
|
|
194
|
-
export type GlobalGetCacheKey = (params: any, viewer: any, info: any) => Promise<any>;
|
|
195
|
-
export type ModelGetCacheKey = (parent: any, params: any, viewer: any, info: any) => Promise<any>;
|
|
196
|
-
export interface ExecuteOptions {
|
|
197
|
-
params: Blackbox$1;
|
|
198
|
-
viewer: any;
|
|
199
|
-
parent?: any;
|
|
200
|
-
info?: any;
|
|
201
|
-
options: ResolverOptions;
|
|
202
|
-
}
|
|
203
|
-
export type Parameters$1<T> = T extends (...args: infer P) => any ? P : never;
|
|
204
|
-
export type ReturnType$1<T> = T extends (...args: any) => infer R ? R : any;
|
|
205
|
-
export type ResolverParams<Resolve, IsModel> = IsModel extends undefined ? Parameters$1<Resolve>[0] : Parameters$1<Resolve>[1];
|
|
206
|
-
export interface ExecuteParams<Resolve = Function, IsModel = undefined> {
|
|
207
|
-
params?: ResolverParams<Resolve, IsModel>;
|
|
208
|
-
viewer?: any;
|
|
209
|
-
parent?: IsModel extends undefined ? undefined : Parameters$1<Resolve>[0];
|
|
210
|
-
info?: any;
|
|
211
|
-
}
|
|
212
|
-
export type Execute<Resolve = Function, IsModel = undefined> = (executeOptions: ExecuteParams<Resolve, IsModel>) => ReturnType$1<Resolve>;
|
|
213
|
-
export interface SharedResolverOptions {
|
|
214
|
-
resolverId?: string;
|
|
215
|
-
params?: any;
|
|
216
|
-
returns?: any;
|
|
217
|
-
mutation?: boolean;
|
|
218
|
-
private?: boolean;
|
|
219
|
-
checkPermission?: GlobalCheckPermissions | ModelCheckPermissions;
|
|
220
|
-
getCacheKey?: GlobalGetCacheKey | ModelGetCacheKey;
|
|
221
|
-
cache?: number;
|
|
222
|
-
cacheProvider?: OrionCache;
|
|
223
|
-
permissionsOptions?: any;
|
|
224
|
-
middlewares?: ResolverMiddleware[];
|
|
225
|
-
}
|
|
226
|
-
export interface ResolverOptions<Resolve = Function> extends SharedResolverOptions {
|
|
227
|
-
resolve: Resolve;
|
|
228
|
-
}
|
|
229
|
-
export type OmitFirstArg<F> = F extends (x: any, ...args: infer P) => infer R ? (...args: P) => R : never;
|
|
230
|
-
export interface Resolver<Resolve = Function, IsModel = undefined> extends SharedResolverOptions {
|
|
231
|
-
execute: Execute<Resolve, IsModel>;
|
|
232
|
-
resolve: Resolve;
|
|
233
|
-
modelResolve: IsModel extends undefined ? undefined : OmitFirstArg<Resolve>;
|
|
234
|
-
}
|
|
235
|
-
export type ModelResolver<Resolve = Function> = Resolver<Resolve, true>;
|
|
236
|
-
export type ResolverMiddleware = (executeOptions: ExecuteOptions, next: () => Promise<any>) => Promise<any>;
|
|
237
|
-
export interface FieldType {
|
|
238
|
-
name: string;
|
|
239
|
-
validate: ValidateFunction;
|
|
240
|
-
clean: CleanFunction;
|
|
241
|
-
meta?: any;
|
|
242
|
-
toGraphQLType?: (GraphQL: any) => any;
|
|
243
|
-
_isFieldType: boolean;
|
|
244
|
-
}
|
|
245
|
-
export type Constructor<T> = new (...args: any[]) => T;
|
|
246
|
-
export type FieldTypesList = "string" | "date" | "integer" | "number" | "ID" | "boolean" | "email" | "blackbox" | "any";
|
|
247
|
-
export type TypedModelOnSchema = Function;
|
|
248
|
-
export type ConstructorsTypesList = Constructor<String> | Constructor<Number> | Constructor<Boolean> | Constructor<Date>;
|
|
249
|
-
export type SchemaRecursiveNodeTypeExtras = {
|
|
250
|
-
_isFieldType?: boolean;
|
|
251
|
-
__clean?: CleanFunction;
|
|
252
|
-
__validate?: ValidateFunction;
|
|
253
|
-
__skipChildValidation?: (value: any, info: CurrentNodeInfo) => Promise<boolean>;
|
|
254
|
-
};
|
|
255
|
-
export interface Schema {
|
|
256
|
-
[key: string]: SchemaNode | Function;
|
|
257
|
-
}
|
|
258
|
-
export type SchemaRecursiveNodeType = Schema & SchemaRecursiveNodeTypeExtras;
|
|
259
|
-
export type SchemaMetaFieldTypeSingle = FieldTypesList | ConstructorsTypesList | SchemaRecursiveNodeType | FieldType | TypedModelOnSchema;
|
|
260
|
-
export type SchemaMetaFieldType = SchemaMetaFieldTypeSingle | SchemaMetaFieldTypeSingle[];
|
|
261
|
-
export type ValidateFunction = (value: any, info?: Partial<CurrentNodeInfo>, ...args: any[]) => object | string | void | Promise<object | string | void>;
|
|
262
|
-
export type CleanFunction = (value: any, info?: Partial<CurrentNodeInfo>, ...args: any[]) => any | Promise<any>;
|
|
263
|
-
export interface SchemaNode {
|
|
264
|
-
/**
|
|
265
|
-
* The type of the field. Used for type validations. Can also contain a subschema.
|
|
266
|
-
*/
|
|
267
|
-
type: SchemaMetaFieldType;
|
|
268
|
-
/**
|
|
269
|
-
* Defaults to false
|
|
270
|
-
*/
|
|
271
|
-
optional?: boolean;
|
|
272
|
-
allowedValues?: Array<any>;
|
|
273
|
-
defaultValue?: ((info: CurrentNodeInfo, ...args: any[]) => any | Promise<any>) | any;
|
|
274
|
-
/**
|
|
275
|
-
* Function that takes a value and returns an error message if there are any errors. Must return null or undefined otherwise.
|
|
276
|
-
*/
|
|
277
|
-
validate?: ValidateFunction;
|
|
278
|
-
/**
|
|
279
|
-
* Function that preprocesses a value before it is set.
|
|
280
|
-
*/
|
|
281
|
-
clean?: CleanFunction;
|
|
282
|
-
autoValue?: (value: any, info: CurrentNodeInfo, ...args: any[]) => any | Promise<any>;
|
|
283
|
-
/**
|
|
284
|
-
* The minimum value if it's a number, the minimum length if it's a string or array.
|
|
285
|
-
*/
|
|
286
|
-
min?: number;
|
|
287
|
-
/**
|
|
288
|
-
* The maximum value if it's a number, the maximum length if it's a string or array.
|
|
289
|
-
*/
|
|
290
|
-
max?: number;
|
|
291
|
-
/**
|
|
292
|
-
* Internal use only.
|
|
293
|
-
*/
|
|
294
|
-
isBlackboxChild?: boolean;
|
|
295
|
-
/**
|
|
296
|
-
* @deprecated
|
|
297
|
-
*/
|
|
298
|
-
custom?: ValidateFunction;
|
|
299
|
-
/**
|
|
300
|
-
* Used in GraphQL. If true, the field will be omitted from the schema.
|
|
301
|
-
*/
|
|
302
|
-
private?: boolean;
|
|
303
|
-
/**
|
|
304
|
-
* Used in GraphQL. When in GraphQL, this resolver will replace the static field.
|
|
305
|
-
*/
|
|
306
|
-
graphQLResolver?: (...args: any) => any;
|
|
307
|
-
/**
|
|
308
|
-
* Used in GraphQL. Sets the key of the field in the GraphQL schema. You must set this value when building your schema.
|
|
309
|
-
*/
|
|
310
|
-
key?: string;
|
|
311
|
-
/**
|
|
312
|
-
* The name that would be displayed in a front-end form
|
|
313
|
-
*/
|
|
314
|
-
label?: string;
|
|
315
|
-
/**
|
|
316
|
-
* The description that would be displayed in a front-end form
|
|
317
|
-
*/
|
|
318
|
-
description?: string;
|
|
319
|
-
/**
|
|
320
|
-
* The placeholder that would be displayed in a front-end form
|
|
321
|
-
*/
|
|
322
|
-
placeholder?: string;
|
|
323
|
-
/**
|
|
324
|
-
* The field type that would be used in a front-end form
|
|
325
|
-
*/
|
|
326
|
-
fieldType?: string;
|
|
327
|
-
/**
|
|
328
|
-
* The field options that will be passed as props to the front-end field
|
|
329
|
-
*/
|
|
330
|
-
fieldOptions?: any;
|
|
331
|
-
}
|
|
332
|
-
export interface CurrentNodeInfoOptions {
|
|
333
|
-
autoConvert?: boolean;
|
|
334
|
-
filter?: boolean;
|
|
335
|
-
trimStrings?: boolean;
|
|
336
|
-
removeEmptyStrings?: boolean;
|
|
337
|
-
forceDoc?: any;
|
|
338
|
-
omitRequired?: boolean;
|
|
339
|
-
}
|
|
340
|
-
export interface CurrentNodeInfo {
|
|
341
|
-
/**
|
|
342
|
-
* The global schema, prefaced by {type: {...}} to be compatible with subschemas
|
|
343
|
-
* Sometimes it's given without {type: {...}}. TODO: Normalize this.
|
|
344
|
-
*/
|
|
345
|
-
schema?: SchemaNode | Schema;
|
|
346
|
-
/**
|
|
347
|
-
* The current node subschema
|
|
348
|
-
*/
|
|
349
|
-
currentSchema?: Partial<SchemaNode>;
|
|
350
|
-
value: any;
|
|
351
|
-
doc?: any;
|
|
352
|
-
currentDoc?: any;
|
|
353
|
-
options?: CurrentNodeInfoOptions;
|
|
354
|
-
args?: any[];
|
|
355
|
-
type?: SchemaMetaFieldType;
|
|
356
|
-
keys?: string[];
|
|
357
|
-
addError?: (keys: string[], code: string | object) => void;
|
|
358
|
-
}
|
|
359
|
-
export interface ModelResolversMap {
|
|
360
|
-
[key: string]: ModelResolver<ModelResolverResolve>;
|
|
361
|
-
}
|
|
362
|
-
export interface CloneOptions {
|
|
363
|
-
name: string;
|
|
364
|
-
omitFields?: string[];
|
|
365
|
-
pickFields?: string[];
|
|
366
|
-
mapFields?: (field: any, key: string) => any;
|
|
367
|
-
extendSchema?: Schema;
|
|
368
|
-
extendResolvers?: ModelResolversMap;
|
|
369
|
-
}
|
|
370
|
-
export interface Model<TSchema = any> {
|
|
371
|
-
__isModel: boolean;
|
|
372
|
-
/**
|
|
373
|
-
* The name of the model, used for example for GraphQL
|
|
374
|
-
*/
|
|
375
|
-
name: string;
|
|
376
|
-
/**
|
|
377
|
-
* Returns the schema of the model
|
|
378
|
-
*/
|
|
379
|
-
getSchema: () => Schema & {
|
|
380
|
-
__model: Model;
|
|
381
|
-
};
|
|
382
|
-
/**
|
|
383
|
-
* Returns the schema without adding __model to the schema
|
|
384
|
-
*/
|
|
385
|
-
getCleanSchema: () => Schema;
|
|
386
|
-
/**
|
|
387
|
-
* Returns the model resolvers
|
|
388
|
-
*/
|
|
389
|
-
getResolvers: () => ModelResolversMap;
|
|
390
|
-
/**
|
|
391
|
-
* Adds the model resolvers to a item
|
|
392
|
-
*/
|
|
393
|
-
initItem: (item: any) => any;
|
|
394
|
-
/**
|
|
395
|
-
* Validates an item using @orion-js/schema
|
|
396
|
-
*/
|
|
397
|
-
validate: (item: any) => Promise<any>;
|
|
398
|
-
/**
|
|
399
|
-
* Cleans an item using @orion-js/schema
|
|
400
|
-
*/
|
|
401
|
-
clean: (item: any) => Promise<TSchema>;
|
|
402
|
-
/**
|
|
403
|
-
* Cleans and validates an item using @orion-js/schema
|
|
404
|
-
*/
|
|
405
|
-
cleanAndValidate: (item: any) => Promise<TSchema>;
|
|
406
|
-
/**
|
|
407
|
-
* Creates a new model using this one as a base
|
|
408
|
-
*/
|
|
409
|
-
clone: (cloneOptions: CloneOptions) => Model;
|
|
410
|
-
/**
|
|
411
|
-
* The type of the model. Only use this in typescript
|
|
412
|
-
*/
|
|
413
|
-
type: TSchema;
|
|
414
|
-
}
|
|
415
|
-
export interface FieldType$1 {
|
|
416
|
-
name: string;
|
|
417
|
-
validate: ValidateFunction$1;
|
|
418
|
-
clean: CleanFunction$1;
|
|
419
|
-
meta?: any;
|
|
420
|
-
toGraphQLType?: (GraphQL: any) => any;
|
|
421
|
-
_isFieldType: boolean;
|
|
422
|
-
}
|
|
423
|
-
export type Constructor$1<T> = new (...args: any[]) => T;
|
|
424
|
-
export type Blackbox$1 = {
|
|
425
|
-
[name: string]: any;
|
|
426
|
-
};
|
|
427
|
-
export type FieldTypesList$1 = "string" | "date" | "integer" | "number" | "ID" | "boolean" | "email" | "blackbox" | "any";
|
|
428
|
-
export type TypedModelOnSchema$1 = Function;
|
|
429
|
-
export type ConstructorsTypesList$1 = Constructor$1<String> | Constructor$1<Number> | Constructor$1<Boolean> | Constructor$1<Date>;
|
|
430
|
-
export type SchemaRecursiveNodeTypeExtras$1 = {
|
|
431
|
-
_isFieldType?: boolean;
|
|
432
|
-
__clean?: CleanFunction$1;
|
|
433
|
-
__validate?: ValidateFunction$1;
|
|
434
|
-
__skipChildValidation?: (value: any, info: CurrentNodeInfo$1) => Promise<boolean>;
|
|
435
|
-
};
|
|
436
|
-
export interface Schema$1 {
|
|
437
|
-
[key: string]: SchemaNode$1 | Function;
|
|
438
|
-
}
|
|
439
|
-
export type SchemaRecursiveNodeType$1 = Schema$1 & SchemaRecursiveNodeTypeExtras$1;
|
|
440
|
-
export type SchemaMetaFieldTypeSingle$1 = FieldTypesList$1 | ConstructorsTypesList$1 | SchemaRecursiveNodeType$1 | FieldType$1 | TypedModelOnSchema$1;
|
|
441
|
-
export type SchemaMetaFieldType$1 = SchemaMetaFieldTypeSingle$1 | SchemaMetaFieldTypeSingle$1[];
|
|
442
|
-
export type ValidateFunction$1 = (value: any, info?: Partial<CurrentNodeInfo$1>, ...args: any[]) => object | string | void | Promise<object | string | void>;
|
|
443
|
-
export type CleanFunction$1 = (value: any, info?: Partial<CurrentNodeInfo$1>, ...args: any[]) => any | Promise<any>;
|
|
444
|
-
export interface SchemaNode$1 {
|
|
445
|
-
/**
|
|
446
|
-
* The type of the field. Used for type validations. Can also contain a subschema.
|
|
447
|
-
*/
|
|
448
|
-
type: SchemaMetaFieldType$1;
|
|
449
|
-
/**
|
|
450
|
-
* Defaults to false
|
|
451
|
-
*/
|
|
452
|
-
optional?: boolean;
|
|
453
|
-
allowedValues?: Array<any>;
|
|
454
|
-
defaultValue?: ((info: CurrentNodeInfo$1, ...args: any[]) => any | Promise<any>) | any;
|
|
455
|
-
/**
|
|
456
|
-
* Function that takes a value and returns an error message if there are any errors. Must return null or undefined otherwise.
|
|
457
|
-
*/
|
|
458
|
-
validate?: ValidateFunction$1;
|
|
459
|
-
/**
|
|
460
|
-
* Function that preprocesses a value before it is set.
|
|
461
|
-
*/
|
|
462
|
-
clean?: CleanFunction$1;
|
|
463
|
-
autoValue?: (value: any, info: CurrentNodeInfo$1, ...args: any[]) => any | Promise<any>;
|
|
464
|
-
/**
|
|
465
|
-
* The minimum value if it's a number, the minimum length if it's a string or array.
|
|
466
|
-
*/
|
|
467
|
-
min?: number;
|
|
468
|
-
/**
|
|
469
|
-
* The maximum value if it's a number, the maximum length if it's a string or array.
|
|
470
|
-
*/
|
|
471
|
-
max?: number;
|
|
472
|
-
/**
|
|
473
|
-
* Internal use only.
|
|
474
|
-
*/
|
|
475
|
-
isBlackboxChild?: boolean;
|
|
476
|
-
/**
|
|
477
|
-
* @deprecated
|
|
478
|
-
*/
|
|
479
|
-
custom?: ValidateFunction$1;
|
|
480
|
-
/**
|
|
481
|
-
* Used in GraphQL. If true, the field will be omitted from the schema.
|
|
482
|
-
*/
|
|
483
|
-
private?: boolean;
|
|
484
|
-
/**
|
|
485
|
-
* Used in GraphQL. When in GraphQL, this resolver will replace the static field.
|
|
486
|
-
*/
|
|
487
|
-
graphQLResolver?: (...args: any) => any;
|
|
488
|
-
/**
|
|
489
|
-
* Used in GraphQL. Sets the key of the field in the GraphQL schema. You must set this value when building your schema.
|
|
490
|
-
*/
|
|
491
|
-
key?: string;
|
|
492
|
-
/**
|
|
493
|
-
* The name that would be displayed in a front-end form
|
|
494
|
-
*/
|
|
495
|
-
label?: string;
|
|
496
|
-
/**
|
|
497
|
-
* The description that would be displayed in a front-end form
|
|
498
|
-
*/
|
|
499
|
-
description?: string;
|
|
500
|
-
/**
|
|
501
|
-
* The placeholder that would be displayed in a front-end form
|
|
502
|
-
*/
|
|
503
|
-
placeholder?: string;
|
|
504
|
-
/**
|
|
505
|
-
* The field type that would be used in a front-end form
|
|
506
|
-
*/
|
|
507
|
-
fieldType?: string;
|
|
508
|
-
/**
|
|
509
|
-
* The field options that will be passed as props to the front-end field
|
|
510
|
-
*/
|
|
511
|
-
fieldOptions?: any;
|
|
512
|
-
}
|
|
513
|
-
export interface CurrentNodeInfoOptions$1 {
|
|
514
|
-
autoConvert?: boolean;
|
|
515
|
-
filter?: boolean;
|
|
516
|
-
trimStrings?: boolean;
|
|
517
|
-
removeEmptyStrings?: boolean;
|
|
518
|
-
forceDoc?: any;
|
|
519
|
-
omitRequired?: boolean;
|
|
520
|
-
}
|
|
521
|
-
export interface CurrentNodeInfo$1 {
|
|
522
|
-
/**
|
|
523
|
-
* The global schema, prefaced by {type: {...}} to be compatible with subschemas
|
|
524
|
-
* Sometimes it's given without {type: {...}}. TODO: Normalize this.
|
|
525
|
-
*/
|
|
526
|
-
schema?: SchemaNode$1 | Schema$1;
|
|
527
|
-
/**
|
|
528
|
-
* The current node subschema
|
|
529
|
-
*/
|
|
530
|
-
currentSchema?: Partial<SchemaNode$1>;
|
|
531
|
-
value: any;
|
|
532
|
-
doc?: any;
|
|
533
|
-
currentDoc?: any;
|
|
534
|
-
options?: CurrentNodeInfoOptions$1;
|
|
535
|
-
args?: any[];
|
|
536
|
-
type?: SchemaMetaFieldType$1;
|
|
537
|
-
keys?: string[];
|
|
538
|
-
addError?: (keys: string[], code: string | object) => void;
|
|
539
|
-
}
|
|
540
|
-
export interface OrionMongoClient {
|
|
541
|
-
client: MongoClient;
|
|
542
|
-
db: Db;
|
|
543
|
-
uri: string;
|
|
544
|
-
dbName: string;
|
|
545
|
-
connectionPromise: Promise<MongoClient>;
|
|
546
|
-
connectionName: string;
|
|
547
|
-
}
|
|
548
|
-
export type RemoveFunctions<T extends ModelClassBase> = Pick<T, {
|
|
549
|
-
[Key in keyof T]-?: T[Key] extends Function ? never : Key;
|
|
550
|
-
}[keyof T]> & {
|
|
551
|
-
_id: ModelClassBase["_id"];
|
|
552
|
-
};
|
|
553
|
-
export type ModelClassBase = {
|
|
554
|
-
_id: string;
|
|
555
|
-
} & Blackbox$1;
|
|
556
|
-
export type DocumentWithIdOptional<T extends ModelClassBase> = Omit<T, "_id"> & {
|
|
557
|
-
/**
|
|
558
|
-
* The ID of the document
|
|
559
|
-
*/
|
|
560
|
-
_id?: T["_id"];
|
|
561
|
-
};
|
|
562
|
-
export type DocumentWithoutId<T> = Omit<T, "_id">;
|
|
563
|
-
export type ModelToDocumentType<ModelClass extends ModelClassBase> = RemoveFunctions<ModelClass>;
|
|
564
|
-
export type ModelToDocumentTypeWithoutId<ModelClass extends ModelClassBase> = DocumentWithoutId<ModelToDocumentType<ModelClass>>;
|
|
565
|
-
export type ModelToDocumentTypeWithIdOptional<ModelClass extends ModelClassBase> = DocumentWithIdOptional<ModelToDocumentType<ModelClass>>;
|
|
566
|
-
export type ModelToMongoSelector<ModelClass extends ModelClassBase> = MongoSelector<ModelToDocumentType<ModelClass>>;
|
|
567
|
-
export type ModelToUpdateFilter<ModelClass extends ModelClassBase> = MongoDB.UpdateFilter<ModelToDocumentTypeWithoutId<ModelClass>> | Partial<ModelToDocumentTypeWithoutId<ModelClass>>;
|
|
568
|
-
export interface CollectionIndex {
|
|
569
|
-
keys: MongoDB.IndexSpecification;
|
|
570
|
-
options?: MongoDB.CreateIndexesOptions;
|
|
571
|
-
}
|
|
572
|
-
declare namespace DataLoader {
|
|
573
|
-
interface LoadDataOptionsBase<ModelClass extends ModelClassBase> {
|
|
574
|
-
key: keyof ModelClass;
|
|
575
|
-
match?: MongoFilter<ModelClass>;
|
|
576
|
-
sort?: MongoDB.Sort;
|
|
577
|
-
project?: MongoDB.Document;
|
|
578
|
-
timeout?: number;
|
|
579
|
-
debug?: boolean;
|
|
580
|
-
}
|
|
581
|
-
export interface LoadDataOptions<ModelClass extends ModelClassBase> extends LoadDataOptionsBase<ModelClass> {
|
|
582
|
-
value?: any;
|
|
583
|
-
values?: Array<any>;
|
|
584
|
-
}
|
|
585
|
-
export interface LoadOneOptions<ModelClass extends ModelClassBase> extends LoadDataOptionsBase<ModelClass> {
|
|
586
|
-
value: any;
|
|
587
|
-
}
|
|
588
|
-
export type LoadData<ModelClass extends ModelClassBase> = (options: LoadDataOptions<ModelClass>) => Promise<Array<ModelClass>>;
|
|
589
|
-
export type LoadOne<ModelClass extends ModelClassBase> = (options: LoadOneOptions<ModelClass>) => Promise<ModelClass>;
|
|
590
|
-
export type LoadMany<ModelClass extends ModelClassBase> = (options: LoadDataOptions<ModelClass>) => Promise<Array<ModelClass>>;
|
|
591
|
-
export type LoadById<ModelClass extends ModelClassBase> = (id: ModelClass["_id"]) => Promise<ModelClass>;
|
|
592
|
-
export {};
|
|
593
|
-
}
|
|
594
|
-
export type MongoFilter<ModelClass extends ModelClassBase = ModelClassBase> = MongoDB.Filter<ModelClass> & ({
|
|
595
|
-
_id?: ModelClass["_id"];
|
|
596
|
-
} | {
|
|
597
|
-
_id?: {
|
|
598
|
-
$in: ModelClass["_id"][];
|
|
599
|
-
};
|
|
600
|
-
});
|
|
601
|
-
export type MongoSelector<ModelClass extends ModelClassBase = ModelClassBase> = ModelClass["_id"] | MongoFilter<ModelClass>;
|
|
602
|
-
export interface FindCursor<ModelClass> extends MongoDB.FindCursor {
|
|
603
|
-
toArray: () => Promise<Array<ModelClass>>;
|
|
604
|
-
}
|
|
605
|
-
export interface UpdateOptions {
|
|
606
|
-
clean?: boolean;
|
|
607
|
-
validate?: boolean;
|
|
608
|
-
mongoOptions?: MongoDB.UpdateOptions;
|
|
609
|
-
}
|
|
610
|
-
export interface FindOneAndUpdateUpdateOptions {
|
|
611
|
-
clean?: boolean;
|
|
612
|
-
validate?: boolean;
|
|
613
|
-
mongoOptions?: MongoDB.FindOneAndUpdateOptions;
|
|
614
|
-
}
|
|
615
|
-
export interface InsertOptions {
|
|
616
|
-
clean?: boolean;
|
|
617
|
-
validate?: boolean;
|
|
618
|
-
mongoOptions?: MongoDB.InsertOneOptions;
|
|
619
|
-
}
|
|
620
|
-
export type InitItem<ModelClass extends ModelClassBase> = (doc: any) => ModelClass;
|
|
621
|
-
export type FindOne<ModelClass extends ModelClassBase> = (selector?: ModelToMongoSelector<ModelClass>, options?: MongoDB.FindOptions) => Promise<ModelClass>;
|
|
622
|
-
export type Find<ModelClass extends ModelClassBase> = (selector?: ModelToMongoSelector<ModelClass>, options?: MongoDB.FindOptions) => FindCursor<ModelClass>;
|
|
623
|
-
export type FindOneAndUpdate<ModelClass extends ModelClassBase> = (selector: ModelToMongoSelector<ModelClass>, modifier: ModelToUpdateFilter<ModelClass>, options?: FindOneAndUpdateUpdateOptions) => Promise<ModelClass>;
|
|
624
|
-
export type UpdateAndFind<ModelClass extends ModelClassBase> = (selector: ModelToMongoSelector<ModelClass>, modifier: ModelToUpdateFilter<ModelClass>, options?: FindOneAndUpdateUpdateOptions) => Promise<ModelClass>;
|
|
625
|
-
export type UpdateItem<ModelClass extends ModelClassBase> = (item: ModelClass, modifier: ModelToUpdateFilter<ModelClass>, options?: FindOneAndUpdateUpdateOptions) => Promise<void>;
|
|
626
|
-
export type InsertOne<ModelClass extends ModelClassBase> = (doc: ModelToDocumentTypeWithIdOptional<ModelClass>, options?: InsertOptions) => Promise<ModelClass["_id"]>;
|
|
627
|
-
export type InsertMany<ModelClass extends ModelClassBase> = (doc: Array<ModelToDocumentTypeWithIdOptional<ModelClass>>, options?: InsertOptions) => Promise<Array<ModelClass["_id"]>>;
|
|
628
|
-
export type InsertAndFind<ModelClass extends ModelClassBase> = (doc: ModelToDocumentTypeWithIdOptional<ModelClass>, options?: InsertOptions) => Promise<ModelClass>;
|
|
629
|
-
export type DeleteMany<ModelClass extends ModelClassBase> = (selector: ModelToMongoSelector<ModelClass>, options?: MongoDB.DeleteOptions) => Promise<MongoDB.DeleteResult>;
|
|
630
|
-
export type DeleteOne<ModelClass extends ModelClassBase> = (selector: ModelToMongoSelector<ModelClass>, options?: MongoDB.DeleteOptions) => Promise<MongoDB.DeleteResult>;
|
|
631
|
-
export type UpdateOne<ModelClass extends ModelClassBase> = (selector: ModelToMongoSelector<ModelClass>, modifier: ModelToUpdateFilter<ModelClass>, options?: UpdateOptions) => Promise<MongoDB.UpdateResult>;
|
|
632
|
-
export type UpdateMany<ModelClass extends ModelClassBase> = (selector: ModelToMongoSelector<ModelClass>, modifier: ModelToUpdateFilter<ModelClass>, options?: UpdateOptions) => Promise<MongoDB.UpdateResult | MongoDB.Document>;
|
|
633
|
-
export type Upsert<ModelClass extends ModelClassBase> = (selector: ModelToMongoSelector<ModelClass>, modifier: ModelToUpdateFilter<ModelClass>, options?: UpdateOptions) => Promise<MongoDB.UpdateResult>;
|
|
634
|
-
export type EstimatedDocumentCount<ModelClass extends ModelClassBase> = (options?: MongoDB.EstimatedDocumentCountOptions) => Promise<number>;
|
|
635
|
-
export type CountDocuments<ModelClass extends ModelClassBase> = (selector: ModelToMongoSelector<ModelClass>, options?: MongoDB.CountDocumentsOptions) => Promise<number>;
|
|
636
|
-
export interface Collection<ModelClass extends ModelClassBase = ModelClassBase> {
|
|
637
|
-
name: string;
|
|
638
|
-
connectionName?: string;
|
|
639
|
-
schema?: Schema$1;
|
|
640
|
-
/**
|
|
641
|
-
* @deprecated Use schema instead. If you use model, all items will be initialized with the model to add resolvers (which are also deprecated)
|
|
642
|
-
*/
|
|
643
|
-
model?: Model;
|
|
644
|
-
indexes: Array<CollectionIndex>;
|
|
645
|
-
generateId: () => ModelClass["_id"];
|
|
646
|
-
getSchema: () => Schema$1;
|
|
647
|
-
db: MongoDB.Db;
|
|
648
|
-
client: OrionMongoClient;
|
|
649
|
-
rawCollection: MongoDB.Collection<ModelClass>;
|
|
650
|
-
initItem: InitItem<ModelClass>;
|
|
651
|
-
findOne: FindOne<ModelClass>;
|
|
652
|
-
find: Find<ModelClass>;
|
|
653
|
-
insertOne: InsertOne<ModelClass>;
|
|
654
|
-
insertMany: InsertMany<ModelClass>;
|
|
655
|
-
insertAndFind: InsertAndFind<ModelClass>;
|
|
656
|
-
deleteMany: DeleteMany<ModelClass>;
|
|
657
|
-
deleteOne: DeleteOne<ModelClass>;
|
|
658
|
-
updateOne: UpdateOne<ModelClass>;
|
|
659
|
-
updateMany: UpdateMany<ModelClass>;
|
|
660
|
-
upsert: Upsert<ModelClass>;
|
|
661
|
-
findOneAndUpdate: FindOneAndUpdate<ModelClass>;
|
|
662
|
-
/**
|
|
663
|
-
* Updates a document and returns the updated document with the changes
|
|
664
|
-
*/
|
|
665
|
-
updateAndFind: UpdateAndFind<ModelClass>;
|
|
666
|
-
updateItem: UpdateItem<ModelClass>;
|
|
667
|
-
estimatedDocumentCount: EstimatedDocumentCount<ModelClass>;
|
|
668
|
-
countDocuments: CountDocuments<ModelClass>;
|
|
669
|
-
aggregate: <T = MongoDB.Document>(pipeline?: MongoDB.Document[], options?: MongoDB.AggregateOptions) => MongoDB.AggregationCursor<T>;
|
|
670
|
-
watch: <T = MongoDB.Document>(pipeline?: MongoDB.Document[], options?: MongoDB.ChangeStreamOptions) => MongoDB.ChangeStream<T>;
|
|
671
|
-
loadData: DataLoader.LoadData<ModelClass>;
|
|
672
|
-
loadOne: DataLoader.LoadOne<ModelClass>;
|
|
673
|
-
loadMany: DataLoader.LoadMany<ModelClass>;
|
|
674
|
-
loadById: DataLoader.LoadById<ModelClass>;
|
|
675
|
-
/**
|
|
676
|
-
* Use this function if you are using tests and you pass the
|
|
677
|
-
* env var DONT_CREATE_INDEXES_AUTOMATICALLY and you need to
|
|
678
|
-
* create the indexes for this collection
|
|
679
|
-
*/
|
|
680
|
-
createIndexes: () => Promise<string[]>;
|
|
681
|
-
createIndexesPromise: Promise<string[]>;
|
|
682
|
-
connectionPromise: Promise<MongoDB.MongoClient>;
|
|
683
|
-
}
|
|
684
151
|
export declare class HistoryRecord {
|
|
685
152
|
_id: string;
|
|
686
153
|
jobId: string;
|
|
@@ -700,7 +167,7 @@ export declare class HistoryRecord {
|
|
|
700
167
|
result?: Blackbox;
|
|
701
168
|
}
|
|
702
169
|
declare class JobsHistoryRepo {
|
|
703
|
-
history: () => Collection<HistoryRecord>;
|
|
170
|
+
history: () => import("@orion-js/mongodb").Collection<HistoryRecord>;
|
|
704
171
|
saveExecution(record: ModelToDocumentTypeWithoutId<HistoryRecord>): Promise<void>;
|
|
705
172
|
getExecutions(jobName: string, limit?: number, skip?: number): Promise<HistoryRecord[]>;
|
|
706
173
|
}
|
|
@@ -717,7 +184,7 @@ export declare class JobRecord {
|
|
|
717
184
|
params?: any;
|
|
718
185
|
}
|
|
719
186
|
declare class JobsRepo {
|
|
720
|
-
jobs: () => Collection<JobRecord>;
|
|
187
|
+
jobs: () => import("@orion-js/mongodb").Collection<JobRecord>;
|
|
721
188
|
getJobAndLock(jobNames: string[], lockTime: number): Promise<JobToRun>;
|
|
722
189
|
setJobRecordPriority(jobId: string, priority: number): Promise<void>;
|
|
723
190
|
scheduleNextRun(options: {
|
package/dist/index.js
CHANGED
|
@@ -6877,7 +6877,7 @@ var require_src6 = __commonJS((exports) => {
|
|
|
6877
6877
|
};
|
|
6878
6878
|
});
|
|
6879
6879
|
|
|
6880
|
-
//
|
|
6880
|
+
// node_modules/@orion-js/services/dist/index.js
|
|
6881
6881
|
var __create2 = Object.create;
|
|
6882
6882
|
var __getProtoOf2 = Object.getPrototypeOf;
|
|
6883
6883
|
var __defProp2 = Object.defineProperty;
|
|
@@ -8139,7 +8139,7 @@ var Reflect2;
|
|
|
8139
8139
|
var import_typedi = __toESM2(require_cjs(), 1);
|
|
8140
8140
|
var import_typedi2 = __toESM2(require_cjs(), 1);
|
|
8141
8141
|
function getInstance(service) {
|
|
8142
|
-
return import_typedi.
|
|
8142
|
+
return import_typedi.Container.get(service);
|
|
8143
8143
|
}
|
|
8144
8144
|
var export_Service = import_typedi2.Service;
|
|
8145
8145
|
var export_Inject = import_typedi2.Inject;
|
|
@@ -8155,7 +8155,7 @@ var defineJob = (options) => {
|
|
|
8155
8155
|
return options;
|
|
8156
8156
|
};
|
|
8157
8157
|
|
|
8158
|
-
//
|
|
8158
|
+
// node_modules/@orion-js/logger/dist/index.js
|
|
8159
8159
|
import { createRequire as createRequire2 } from "node:module";
|
|
8160
8160
|
import util from "node:util";
|
|
8161
8161
|
var __create3 = Object.create;
|
|
@@ -24822,7 +24822,7 @@ var improveFileName = (path) => {
|
|
|
24822
24822
|
return path;
|
|
24823
24823
|
};
|
|
24824
24824
|
var transports2 = [
|
|
24825
|
-
|
|
24825
|
+
textConsoleTransport
|
|
24826
24826
|
];
|
|
24827
24827
|
var winstonLogger = import_winston2.createLogger({
|
|
24828
24828
|
levels: import_winston2.config.npm.levels,
|
|
@@ -24864,7 +24864,7 @@ var createLogger = (logger) => {
|
|
|
24864
24864
|
var logger = createLogger(winstonLogger);
|
|
24865
24865
|
var export_winston = import_winston3.default;
|
|
24866
24866
|
|
|
24867
|
-
//
|
|
24867
|
+
// node_modules/@orion-js/helpers/dist/index.js
|
|
24868
24868
|
import { createRequire as createRequire3 } from "node:module";
|
|
24869
24869
|
import crypto2 from "crypto";
|
|
24870
24870
|
var __create4 = Object.create;
|
|
@@ -25595,7 +25595,7 @@ var v3 = import_dist.default.v3;
|
|
|
25595
25595
|
var v4 = import_dist.default.v4;
|
|
25596
25596
|
var v5 = import_dist.default.v5;
|
|
25597
25597
|
|
|
25598
|
-
//
|
|
25598
|
+
// node_modules/@orion-js/mongodb/dist/index.js
|
|
25599
25599
|
import { createRequire as createRequire4 } from "node:module";
|
|
25600
25600
|
import { createRequire as createRequire22 } from "node:module";
|
|
25601
25601
|
import crypto22 from "crypto";
|
|
@@ -106621,7 +106621,7 @@ var export_Container2 = import_typedi22.Container;
|
|
|
106621
106621
|
// src/repos/JobsRepo.ts
|
|
106622
106622
|
var import_lodash4 = __toESM(require_lodash3(), 1);
|
|
106623
106623
|
|
|
106624
|
-
//
|
|
106624
|
+
// node_modules/@orion-js/typed-model/dist/index.js
|
|
106625
106625
|
import { createRequire as createRequire5 } from "node:module";
|
|
106626
106626
|
import crypto23 from "crypto";
|
|
106627
106627
|
var __create7 = Object.create;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orion-js/dogs",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-next.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -23,17 +23,17 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@opentelemetry/api": "^1.9.0",
|
|
26
|
-
"@orion-js/helpers": "^4.0.0-
|
|
27
|
-
"@orion-js/mongodb": "^4.0.0-
|
|
28
|
-
"@orion-js/services": "^4.0.0-
|
|
29
|
-
"@orion-js/typed-model": "^4.0.0-
|
|
26
|
+
"@orion-js/helpers": "^4.0.0-next.0",
|
|
27
|
+
"@orion-js/mongodb": "^4.0.0-next.0",
|
|
28
|
+
"@orion-js/services": "^4.0.0-next.0",
|
|
29
|
+
"@orion-js/typed-model": "^4.0.0-next.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@orion-js/logger": "
|
|
32
|
+
"@orion-js/logger": "4.0.0-next.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/bun": "^1.2.4",
|
|
36
|
-
"@orion-js/logger": "^4.0.0-
|
|
36
|
+
"@orion-js/logger": "^4.0.0-next.0",
|
|
37
37
|
"@types/lodash": "4.14.176",
|
|
38
38
|
"reflect-metadata": "^0.1.13",
|
|
39
39
|
"typescript": "^5.4.5"
|