taon 21.0.52 → 21.0.53
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/bin/taon +5 -5
- package/bin/taon-debug +5 -5
- package/bin/taon-debug-brk +4 -4
- package/browser/package.json +1 -1
- package/browser-prod/package.json +1 -1
- package/icon-menu-taon.svg +15 -15
- package/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib/build-info._auto-generated_.js +1 -1
- package/lib/package.json +1 -1
- package/lib/ui/index.js +2 -2
- package/lib/ui/taon-admin-mode-configuration/index.js +2 -2
- package/lib-prod/base-classes/base-abstract-entity.js +33 -0
- package/lib-prod/base-classes/base-angular-service.js +56 -0
- package/lib-prod/base-classes/base-class.js +37 -0
- package/lib-prod/base-classes/base-context.js +21 -0
- package/lib-prod/base-classes/base-controller.js +162 -0
- package/lib-prod/base-classes/base-crud-controller.js +235 -0
- package/lib-prod/base-classes/base-custom-repository.js +20 -0
- package/lib-prod/base-classes/base-electron-service.js +0 -0
- package/lib-prod/base-classes/base-entity.js +32 -0
- package/lib-prod/base-classes/base-file-upload.middleware.js +78 -0
- package/lib-prod/base-classes/base-injector.js +202 -0
- package/lib-prod/base-classes/base-middleware.js +6 -0
- package/lib-prod/base-classes/base-migration.js +23 -0
- package/lib-prod/base-classes/base-provider.js +6 -0
- package/lib-prod/base-classes/base-repository.js +589 -0
- package/lib-prod/base-classes/base-subscriber-for-entity.js +154 -0
- package/lib-prod/base-classes/base.js +0 -0
- package/lib-prod/build-info._auto-generated_.js +14 -0
- package/lib-prod/config/controller-config.js +28 -0
- package/lib-prod/config/controller-options.js +6 -0
- package/lib-prod/config/method-config.js +9 -0
- package/lib-prod/config/param-config.js +9 -0
- package/lib-prod/constants.js +29 -0
- package/lib-prod/context-db-migrations.js +339 -0
- package/lib-prod/create-context.js +152 -0
- package/lib-prod/decorators/classes/controller-decorator.js +21 -0
- package/lib-prod/decorators/classes/entity-decorator.js +49 -0
- package/lib-prod/decorators/classes/middleware-decorator.js +26 -0
- package/lib-prod/decorators/classes/migration-decorator.js +24 -0
- package/lib-prod/decorators/classes/provider-decorator.js +25 -0
- package/lib-prod/decorators/classes/repository-decorator.js +24 -0
- package/lib-prod/decorators/classes/subscriber-decorator.js +25 -0
- package/lib-prod/decorators/decorator-abstract-opt.js +5 -0
- package/lib-prod/decorators/http/http-decorators.js +5 -0
- package/lib-prod/decorators/http/http-methods-decorators.js +144 -0
- package/lib-prod/decorators/http/http-params-decorators.js +68 -0
- package/lib-prod/dependency-injection/di-container.js +31 -0
- package/lib-prod/endpoint-context-storage.js +36 -0
- package/lib-prod/endpoint-context.js +2033 -0
- package/lib-prod/entity-process.js +214 -0
- package/lib-prod/env/env.angular-node-app.js +130 -0
- package/lib-prod/env/env.docs-webapp.js +130 -0
- package/lib-prod/env/env.electron-app.js +130 -0
- package/lib-prod/env/env.mobile-app.js +130 -0
- package/lib-prod/env/env.npm-lib-and-cli-tool.js +130 -0
- package/lib-prod/env/env.vscode-plugin.js +130 -0
- package/lib-prod/env/index.js +6 -0
- package/lib-prod/express-types.js +0 -0
- package/lib-prod/formly/formly.models.js +0 -0
- package/lib-prod/formly/fromly.js +184 -0
- package/lib-prod/formly/type-from-entity.js +58 -0
- package/lib-prod/get-response-value.js +19 -0
- package/lib-prod/global-state/taon-global-state/index.js +5 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.abstract.context.js +20 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.constants.js +10 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.controller.js +48 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.entity.js +48 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.middleware.js +22 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.models.js +34 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.provider.js +22 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.repository.js +47 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.subscriber.js +29 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.utils.js +11 -0
- package/lib-prod/global-state/taon-transaction-registry/index.js +10 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.js +22 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.constants.js +8 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.controller.js +41 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.entity.js +56 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.middleware.js +22 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.models.js +10 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.provider.js +22 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.repository.js +36 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.subscriber.js +29 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.utils.js +6 -0
- package/lib-prod/helpers/class-helpers.js +195 -0
- package/lib-prod/helpers/clone-obj.js +21 -0
- package/lib-prod/helpers/taon-helpers.js +129 -0
- package/lib-prod/index._auto-generated_.js +0 -0
- package/lib-prod/index.js +231 -0
- package/lib-prod/inject.js +34 -0
- package/lib-prod/migrations/index.js +1 -0
- package/lib-prod/migrations/migrations_index._auto-generated_.js +0 -0
- package/lib-prod/models.js +109 -0
- package/lib-prod/orm/columns.js +124 -0
- package/lib-prod/orm/index.js +1 -0
- package/lib-prod/package.json +1 -1
- package/lib-prod/realtime/realtime-client.js +196 -0
- package/lib-prod/realtime/realtime-core.js +82 -0
- package/lib-prod/realtime/realtime-server.js +252 -0
- package/lib-prod/realtime/realtime-strategy/index.js +4 -0
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-ipc.js +226 -0
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-mock.js +262 -0
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-socket-io.js +21 -0
- package/lib-prod/realtime/realtime-strategy/realtime-strategy.js +14 -0
- package/lib-prod/realtime/realtime-subs-manager.js +96 -0
- package/lib-prod/realtime/realtime.models.js +0 -0
- package/lib-prod/symbols.js +109 -0
- package/lib-prod/ui/index.js +5 -0
- package/lib-prod/ui/taon-admin-mode-configuration/index.js +5 -0
- package/lib-prod/validators.js +74 -0
- package/package.json +1 -1
- package/websql/package.json +1 -1
- package/websql-prod/package.json +1 -1
- package/lib-prod/base-classes/base-abstract-entity.ts +0 -34
- package/lib-prod/base-classes/base-angular-service.ts +0 -107
- package/lib-prod/base-classes/base-class.ts +0 -46
- package/lib-prod/base-classes/base-context.ts +0 -21
- package/lib-prod/base-classes/base-controller.ts +0 -240
- package/lib-prod/base-classes/base-crud-controller.ts +0 -298
- package/lib-prod/base-classes/base-custom-repository.ts +0 -10
- package/lib-prod/base-classes/base-electron-service.ts +0 -60
- package/lib-prod/base-classes/base-entity.ts +0 -28
- package/lib-prod/base-classes/base-file-upload.middleware.ts +0 -92
- package/lib-prod/base-classes/base-injector.ts +0 -278
- package/lib-prod/base-classes/base-middleware.ts +0 -71
- package/lib-prod/base-classes/base-migration.ts +0 -26
- package/lib-prod/base-classes/base-provider.ts +0 -8
- package/lib-prod/base-classes/base-repository.ts +0 -942
- package/lib-prod/base-classes/base-subscriber-for-entity.ts +0 -196
- package/lib-prod/base-classes/base.ts +0 -31
- package/lib-prod/build-info._auto-generated_.ts +0 -27
- package/lib-prod/config/controller-config.ts +0 -58
- package/lib-prod/config/controller-options.ts +0 -19
- package/lib-prod/config/method-config.ts +0 -55
- package/lib-prod/config/param-config.ts +0 -16
- package/lib-prod/constants.ts +0 -63
- package/lib-prod/context-db-migrations.ts +0 -488
- package/lib-prod/create-context.ts +0 -345
- package/lib-prod/decorators/classes/controller-decorator.ts +0 -25
- package/lib-prod/decorators/classes/entity-decorator.ts +0 -57
- package/lib-prod/decorators/classes/middleware-decorator.ts +0 -29
- package/lib-prod/decorators/classes/migration-decorator.ts +0 -27
- package/lib-prod/decorators/classes/provider-decorator.ts +0 -28
- package/lib-prod/decorators/classes/repository-decorator.ts +0 -26
- package/lib-prod/decorators/classes/subscriber-decorator.ts +0 -28
- package/lib-prod/decorators/decorator-abstract-opt.ts +0 -4
- package/lib-prod/decorators/http/http-decorators.ts +0 -26
- package/lib-prod/decorators/http/http-methods-decorators.ts +0 -275
- package/lib-prod/decorators/http/http-params-decorators.ts +0 -105
- package/lib-prod/dependency-injection/di-container.ts +0 -39
- package/lib-prod/endpoint-context-storage.ts +0 -47
- package/lib-prod/endpoint-context.ts +0 -3110
- package/lib-prod/entity-process.ts +0 -286
- package/lib-prod/env/env.angular-node-app.ts +0 -66
- package/lib-prod/env/env.docs-webapp.ts +0 -66
- package/lib-prod/env/env.electron-app.ts +0 -66
- package/lib-prod/env/env.mobile-app.ts +0 -66
- package/lib-prod/env/env.npm-lib-and-cli-tool.ts +0 -66
- package/lib-prod/env/env.vscode-plugin.ts +0 -66
- package/lib-prod/env/index.ts +0 -6
- package/lib-prod/express-types.ts +0 -4
- package/lib-prod/formly/formly.models.ts +0 -7
- package/lib-prod/formly/fromly.ts +0 -261
- package/lib-prod/formly/type-from-entity.ts +0 -80
- package/lib-prod/get-response-value.ts +0 -30
- package/lib-prod/global-state/taon-global-state/index.ts +0 -6
- package/lib-prod/global-state/taon-global-state/taon-global-state.abstract.context.ts +0 -21
- package/lib-prod/global-state/taon-global-state/taon-global-state.constants.ts +0 -9
- package/lib-prod/global-state/taon-global-state/taon-global-state.controller.ts +0 -44
- package/lib-prod/global-state/taon-global-state/taon-global-state.entity.ts +0 -40
- package/lib-prod/global-state/taon-global-state/taon-global-state.middleware.ts +0 -12
- package/lib-prod/global-state/taon-global-state/taon-global-state.models.ts +0 -48
- package/lib-prod/global-state/taon-global-state/taon-global-state.provider.ts +0 -16
- package/lib-prod/global-state/taon-global-state/taon-global-state.repository.ts +0 -47
- package/lib-prod/global-state/taon-global-state/taon-global-state.subscriber.ts +0 -18
- package/lib-prod/global-state/taon-global-state/taon-global-state.utils.ts +0 -21
- package/lib-prod/global-state/taon-transaction-registry/index.ts +0 -11
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.ts +0 -23
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.constants.ts +0 -7
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.controller.ts +0 -38
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.entity.ts +0 -54
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.middleware.ts +0 -12
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.models.ts +0 -6
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.provider.ts +0 -16
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.repository.ts +0 -29
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.subscriber.ts +0 -20
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.utils.ts +0 -9
- package/lib-prod/helpers/class-helpers.ts +0 -315
- package/lib-prod/helpers/clone-obj.ts +0 -24
- package/lib-prod/helpers/taon-helpers.ts +0 -181
- package/lib-prod/index._auto-generated_.ts +0 -5
- package/lib-prod/index.ts +0 -323
- package/lib-prod/inject.ts +0 -111
- package/lib-prod/lib-info.md +0 -8
- package/lib-prod/migrations/index.ts +0 -2
- package/lib-prod/migrations/migrations-info.md +0 -6
- package/lib-prod/migrations/migrations_index._auto-generated_.ts +0 -5
- package/lib-prod/models.ts +0 -427
- package/lib-prod/orm/columns.ts +0 -121
- package/lib-prod/orm/index.ts +0 -62
- package/lib-prod/realtime/realtime-client.ts +0 -288
- package/lib-prod/realtime/realtime-core.ts +0 -134
- package/lib-prod/realtime/realtime-server.ts +0 -398
- package/lib-prod/realtime/realtime-strategy/index.ts +0 -4
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-ipc.ts +0 -344
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-mock.ts +0 -349
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-socket-io.ts +0 -30
- package/lib-prod/realtime/realtime-strategy/realtime-strategy.ts +0 -21
- package/lib-prod/realtime/realtime-subs-manager.ts +0 -127
- package/lib-prod/realtime/realtime.models.ts +0 -33
- package/lib-prod/symbols.ts +0 -136
- package/lib-prod/ui/index.ts +0 -1
- package/lib-prod/ui/taon-admin-mode-configuration/index.ts +0 -1
- package/lib-prod/validators.ts +0 -103
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { EndpointContext } from '../../endpoint-context';
|
|
2
|
-
import type { Server, ServerOptions } from 'socket.io';
|
|
3
|
-
import type { io } from 'socket.io-client';
|
|
4
|
-
import { DefaultEventsMap } from 'socket.io';
|
|
5
|
-
|
|
6
|
-
export abstract class RealtimeStrategy {
|
|
7
|
-
constructor(protected ctx: EndpointContext) {}
|
|
8
|
-
|
|
9
|
-
get ioClient(): typeof io {
|
|
10
|
-
throw new Error('Not implemented');
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
ioServer(
|
|
14
|
-
url: string,
|
|
15
|
-
opt: ServerOptions,
|
|
16
|
-
): Server<DefaultEventsMap, DefaultEventsMap, DefaultEventsMap, any> {
|
|
17
|
-
throw new Error('Not implemented');
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
abstract toString(): string;
|
|
21
|
-
}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
//#region imports
|
|
2
|
-
//#region @backend
|
|
3
|
-
import { URL } from 'url';
|
|
4
|
-
//#endregion
|
|
5
|
-
import { ___NS__add, ___NS__after, ___NS__ary, ___NS__assign, ___NS__assignIn, ___NS__assignInWith, ___NS__assignWith, ___NS__at, ___NS__attempt, ___NS__before, ___NS__bind, ___NS__bindAll, ___NS__bindKey, ___NS__camelCase, ___NS__capitalize, ___NS__castArray, ___NS__ceil, ___NS__chain, ___NS__chunk, ___NS__clamp, ___NS__clone, ___NS__cloneDeep, ___NS__cloneDeepWith, ___NS__cloneWith, ___NS__compact, ___NS__concat, ___NS__cond, ___NS__conforms, ___NS__conformsTo, ___NS__constant, ___NS__countBy, ___NS__create, ___NS__curry, ___NS__curryRight, ___NS__debounce, ___NS__deburr, ___NS__defaults, ___NS__defaultsDeep, ___NS__defaultTo, ___NS__defer, ___NS__delay, ___NS__difference, ___NS__differenceBy, ___NS__differenceWith, ___NS__divide, ___NS__drop, ___NS__dropRight, ___NS__dropRightWhile, ___NS__dropWhile, ___NS__each, ___NS__eachRight, ___NS__endsWith, ___NS__entries, ___NS__entriesIn, ___NS__eq, ___NS__escape, ___NS__escapeRegExp, ___NS__every, ___NS__extend, ___NS__extendWith, ___NS__fill, ___NS__filter, ___NS__find, ___NS__findIndex, ___NS__findKey, ___NS__findLast, ___NS__findLastIndex, ___NS__findLastKey, ___NS__first, ___NS__flatMap, ___NS__flatMapDeep, ___NS__flatMapDepth, ___NS__flatten, ___NS__flattenDeep, ___NS__flattenDepth, ___NS__flip, ___NS__floor, ___NS__flow, ___NS__flowRight, ___NS__forEach, ___NS__forEachRight, ___NS__forIn, ___NS__forInRight, ___NS__forOwn, ___NS__forOwnRight, ___NS__fromPairs, ___NS__functions, ___NS__functionsIn, ___NS__get, ___NS__groupBy, ___NS__gt, ___NS__gte, ___NS__has, ___NS__hasIn, ___NS__head, ___NS__identity, ___NS__includes, ___NS__indexOf, ___NS__initial, ___NS__inRange, ___NS__intersection, ___NS__intersectionBy, ___NS__intersectionWith, ___NS__invert, ___NS__invertBy, ___NS__invoke, ___NS__invokeMap, ___NS__isArguments, ___NS__isArray, ___NS__isArrayBuffer, ___NS__isArrayLike, ___NS__isArrayLikeObject, ___NS__isBoolean, ___NS__isBuffer, ___NS__isDate, ___NS__isElement, ___NS__isEmpty, ___NS__isEqual, ___NS__isEqualWith, ___NS__isError, ___NS__isFinite, ___NS__isFunction, ___NS__isInteger, ___NS__isLength, ___NS__isMap, ___NS__isMatch, ___NS__isMatchWith, ___NS__isNaN, ___NS__isNative, ___NS__isNil, ___NS__isNull, ___NS__isNumber, ___NS__isObject, ___NS__isObjectLike, ___NS__isPlainObject, ___NS__isRegExp, ___NS__isSafeInteger, ___NS__isSet, ___NS__isString, ___NS__isSymbol, ___NS__isTypedArray, ___NS__isUndefined, ___NS__isWeakMap, ___NS__isWeakSet, ___NS__iteratee, ___NS__join, ___NS__kebabCase, ___NS__keyBy, ___NS__keys, ___NS__keysIn, ___NS__last, ___NS__lastIndexOf, ___NS__lowerCase, ___NS__lowerFirst, ___NS__lt, ___NS__lte, ___NS__map, ___NS__mapKeys, ___NS__mapValues, ___NS__matches, ___NS__matchesProperty, ___NS__max, ___NS__maxBy, ___NS__mean, ___NS__meanBy, ___NS__memoize, ___NS__merge, ___NS__mergeWith, ___NS__method, ___NS__methodOf, ___NS__min, ___NS__minBy, ___NS__mixin, ___NS__multiply, ___NS__negate, ___NS__noop, ___NS__now, ___NS__nth, ___NS__nthArg, ___NS__omit, ___NS__omitBy, ___NS__once, ___NS__orderBy, ___NS__over, ___NS__overArgs, ___NS__overEvery, ___NS__overSome, ___NS__pad, ___NS__padEnd, ___NS__padStart, ___NS__parseInt, ___NS__partial, ___NS__partialRight, ___NS__partition, ___NS__pick, ___NS__pickBy, ___NS__property, ___NS__propertyOf, ___NS__pull, ___NS__pullAll, ___NS__pullAllBy, ___NS__pullAllWith, ___NS__pullAt, ___NS__random, ___NS__range, ___NS__rangeRight, ___NS__rearg, ___NS__reduce, ___NS__reduceRight, ___NS__reject, ___NS__remove, ___NS__repeat, ___NS__replace, ___NS__rest, ___NS__result, ___NS__reverse, ___NS__round, ___NS__sample, ___NS__sampleSize, ___NS__set, ___NS__setWith, ___NS__shuffle, ___NS__size, ___NS__slice, ___NS__snakeCase, ___NS__some, ___NS__sortBy, ___NS__sortedIndex, ___NS__sortedIndexBy, ___NS__sortedIndexOf, ___NS__sortedLastIndex, ___NS__sortedLastIndexBy, ___NS__sortedLastIndexOf, ___NS__sortedUniq, ___NS__sortedUniqBy, ___NS__split, ___NS__spread, ___NS__startCase, ___NS__startsWith, ___NS__stubArray, ___NS__stubFalse, ___NS__stubObject, ___NS__stubString, ___NS__stubTrue, ___NS__subtract, ___NS__sum, ___NS__sumBy, ___NS__tail, ___NS__take, ___NS__takeRight, ___NS__takeRightWhile, ___NS__takeWhile, ___NS__tap, ___NS__template, ___NS__templateSettings, ___NS__throttle, ___NS__thru, ___NS__times, ___NS__toArray, ___NS__toFinite, ___NS__toInteger, ___NS__toLength, ___NS__toLower, ___NS__toNumber, ___NS__toPairs, ___NS__toPairsIn, ___NS__toPath, ___NS__toPlainObject, ___NS__toSafeInteger, ___NS__toString, ___NS__toUpper, ___NS__transform, ___NS__trim, ___NS__trimEnd, ___NS__trimStart, ___NS__truncate, ___NS__unary, ___NS__unescape, ___NS__union, ___NS__unionBy, ___NS__unionWith, ___NS__uniq, ___NS__uniqBy, ___NS__uniqueId, ___NS__uniqWith, ___NS__unset, ___NS__unzip, ___NS__unzipWith, ___NS__update, ___NS__updateWith, ___NS__upperCase, ___NS__upperFirst, ___NS__values, ___NS__valuesIn, ___NS__without, ___NS__words, ___NS__wrap, ___NS__xor, ___NS__xorBy, ___NS__xorWith, ___NS__zip, ___NS__zipObject, ___NS__zipObjectDeep, ___NS__zipWith } from 'tnp-core/lib-prod';
|
|
6
|
-
import { Subscriber } from 'rxjs';
|
|
7
|
-
import { Symbols__NS__classMethodsNames, Symbols__NS__classNameStaticProperty, Symbols__NS__ctxInClassOrClassObj, Symbols__NS__fullClassNameStaticProperty, Symbols__NS__metadata, Symbols__NS__old, Symbols__NS__orignalClass, Symbols__NS__orignalClassClonesObj, Symbols__NS__REALTIME } from '../symbols';
|
|
8
|
-
import { Socket as SocketClient } from 'socket.io-client';
|
|
9
|
-
import { DefaultEventsMap } from 'socket.io';
|
|
10
|
-
import { RealtimeModels__NS__ChangeOption, RealtimeModels__NS__EventHandler, RealtimeModels__NS__SubsManagerOpt } from './realtime.models';
|
|
11
|
-
//#endregion
|
|
12
|
-
|
|
13
|
-
export class RealtimeSubsManager {
|
|
14
|
-
private isListening = false;
|
|
15
|
-
private observers: Subscriber<any>[] = [];
|
|
16
|
-
constructor(private options: RealtimeModels__NS__SubsManagerOpt) {}
|
|
17
|
-
|
|
18
|
-
//#region methods & getters / start listen if not started
|
|
19
|
-
startListenIfNotStarted(
|
|
20
|
-
realtime: SocketClient<DefaultEventsMap, DefaultEventsMap>,
|
|
21
|
-
) {
|
|
22
|
-
if (this.options.core.ctx.disabledRealtime) {
|
|
23
|
-
console.warn(`[Taon][startListenIfNotStarted] sockets are disabled`);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (!realtime) {
|
|
28
|
-
console.warn(`[Taon][startListenIfNotStarted] invalid socket connection`);
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (!this.isListening) {
|
|
33
|
-
// console.info(`[BROWSER]][IPC] subscribe to "${this.options?.roomName}" by sending event: "${subscribeEvent}"`, this.options);
|
|
34
|
-
this.isListening = true;
|
|
35
|
-
|
|
36
|
-
if (this.options.customEvent) {
|
|
37
|
-
const subscribeEvent = Symbols__NS__REALTIME.ROOM_SUBSCRIBE_CUSTOM(
|
|
38
|
-
this.options.core.ctx.contextName,
|
|
39
|
-
);
|
|
40
|
-
// this means: send to current client custom event notification
|
|
41
|
-
realtime.emit(subscribeEvent, this.options.roomName);
|
|
42
|
-
} else {
|
|
43
|
-
if (___NS__isString(this.options.property)) {
|
|
44
|
-
const subscribeEvent =
|
|
45
|
-
Symbols__NS__REALTIME.ROOM_SUBSCRIBE_ENTITY_PROPERTY_UPDATE_EVENTS(
|
|
46
|
-
this.options.core.ctx.contextName,
|
|
47
|
-
);
|
|
48
|
-
// this means: send to current client entity property events updates
|
|
49
|
-
realtime.emit(subscribeEvent, this.options.roomName);
|
|
50
|
-
} else {
|
|
51
|
-
const subscribeEvent =
|
|
52
|
-
Symbols__NS__REALTIME.ROOM_SUBSCRIBE_ENTITY_UPDATE_EVENTS(
|
|
53
|
-
this.options.core.ctx.contextName,
|
|
54
|
-
);
|
|
55
|
-
// this means: send to current client entity update events
|
|
56
|
-
realtime.emit(subscribeEvent, this.options.roomName);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// subPath -> SYMBOL - (customevnet|entityupdatebyid){..}{..}
|
|
61
|
-
realtime.on(this.options.roomName, data => {
|
|
62
|
-
this.update(data);
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
//#endregion
|
|
67
|
-
|
|
68
|
-
//#region methods & getters / add observer
|
|
69
|
-
add(observer: Subscriber<any>) {
|
|
70
|
-
// log.info('Add observer')
|
|
71
|
-
this.observers.push(observer);
|
|
72
|
-
}
|
|
73
|
-
//#endregion
|
|
74
|
-
|
|
75
|
-
//#region methods & getters / remove observer
|
|
76
|
-
remove(observer: Subscriber<any>) {
|
|
77
|
-
// log.info('Remove observer')
|
|
78
|
-
this.observers = this.observers.filter(obs => obs !== observer);
|
|
79
|
-
if (this.observers.length === 0) {
|
|
80
|
-
// log.info('Emit unsubscribe to server SERVER')
|
|
81
|
-
this.isListening = false;
|
|
82
|
-
const { core, customEvent, roomName, property } = this.options;
|
|
83
|
-
|
|
84
|
-
const realtime = core.socketFE;
|
|
85
|
-
|
|
86
|
-
if (customEvent) {
|
|
87
|
-
realtime.emit(
|
|
88
|
-
Symbols__NS__REALTIME.ROOM_UNSUBSCRIBE_CUSTOM(
|
|
89
|
-
this.options.core.ctx.contextName,
|
|
90
|
-
),
|
|
91
|
-
roomName,
|
|
92
|
-
);
|
|
93
|
-
} else {
|
|
94
|
-
if (___NS__isString(property)) {
|
|
95
|
-
realtime.emit(
|
|
96
|
-
Symbols__NS__REALTIME.ROOM_UNSUBSCRIBE_ENTITY_PROPERTY_UPDATE_EVENTS(
|
|
97
|
-
this.options.core.ctx.contextName,
|
|
98
|
-
),
|
|
99
|
-
roomName,
|
|
100
|
-
);
|
|
101
|
-
} else {
|
|
102
|
-
realtime.emit(
|
|
103
|
-
Symbols__NS__REALTIME.ROOM_UNSUBSCRIBE_ENTITY_UPDATE_EVENTS(
|
|
104
|
-
this.options.core.ctx.contextName,
|
|
105
|
-
),
|
|
106
|
-
roomName,
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
//#endregion
|
|
113
|
-
|
|
114
|
-
//#region methods & getters / update
|
|
115
|
-
private update(data: any) {
|
|
116
|
-
// log.data(`realtime update!!!!! observers=${this.observers?.length} `)
|
|
117
|
-
|
|
118
|
-
// console.log('updating', data);
|
|
119
|
-
this.observers.forEach(observer => {
|
|
120
|
-
// console.log(`observer closed: ${observer.closed}`,observer);
|
|
121
|
-
if (!observer.closed) {
|
|
122
|
-
observer.next(data);
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
//#endregion
|
|
127
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { EndpointContext } from '../endpoint-context';
|
|
2
|
-
import type { RealtimeCore } from './realtime-core';
|
|
3
|
-
|
|
4
|
-
//namespace RealtimeModels
|
|
5
|
-
|
|
6
|
-
export type RealtimeModels__NS__SubsManagerOpt = {
|
|
7
|
-
core: RealtimeCore;
|
|
8
|
-
customEvent: string;
|
|
9
|
-
roomName: string;
|
|
10
|
-
property: string;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export interface RealtimeModels__NS__ChangeOption {
|
|
14
|
-
/**
|
|
15
|
-
* Specify property name to listen changes on that property only;
|
|
16
|
-
*/
|
|
17
|
-
property?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Override custom event name to listen
|
|
20
|
-
*/
|
|
21
|
-
customEvent?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Value from entity object.
|
|
24
|
-
* Key for this value is usually id or unique key
|
|
25
|
-
* property defined in entity decorator.
|
|
26
|
-
* TODO @LAST IMPLEMENT unique key support
|
|
27
|
-
*/
|
|
28
|
-
idOrUniqValue?: any;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export type RealtimeModels__NS__EventHandler = (...args: any[]) => void;
|
|
32
|
-
|
|
33
|
-
//end of namespace RealtimeModels
|
package/lib-prod/symbols.ts
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { OrignalClassKey } from 'taon-typeorm/lib-prod';
|
|
2
|
-
import { ___NS__add, ___NS__after, ___NS__ary, ___NS__assign, ___NS__assignIn, ___NS__assignInWith, ___NS__assignWith, ___NS__at, ___NS__attempt, ___NS__before, ___NS__bind, ___NS__bindAll, ___NS__bindKey, ___NS__camelCase, ___NS__capitalize, ___NS__castArray, ___NS__ceil, ___NS__chain, ___NS__chunk, ___NS__clamp, ___NS__clone, ___NS__cloneDeep, ___NS__cloneDeepWith, ___NS__cloneWith, ___NS__compact, ___NS__concat, ___NS__cond, ___NS__conforms, ___NS__conformsTo, ___NS__constant, ___NS__countBy, ___NS__create, ___NS__curry, ___NS__curryRight, ___NS__debounce, ___NS__deburr, ___NS__defaults, ___NS__defaultsDeep, ___NS__defaultTo, ___NS__defer, ___NS__delay, ___NS__difference, ___NS__differenceBy, ___NS__differenceWith, ___NS__divide, ___NS__drop, ___NS__dropRight, ___NS__dropRightWhile, ___NS__dropWhile, ___NS__each, ___NS__eachRight, ___NS__endsWith, ___NS__entries, ___NS__entriesIn, ___NS__eq, ___NS__escape, ___NS__escapeRegExp, ___NS__every, ___NS__extend, ___NS__extendWith, ___NS__fill, ___NS__filter, ___NS__find, ___NS__findIndex, ___NS__findKey, ___NS__findLast, ___NS__findLastIndex, ___NS__findLastKey, ___NS__first, ___NS__flatMap, ___NS__flatMapDeep, ___NS__flatMapDepth, ___NS__flatten, ___NS__flattenDeep, ___NS__flattenDepth, ___NS__flip, ___NS__floor, ___NS__flow, ___NS__flowRight, ___NS__forEach, ___NS__forEachRight, ___NS__forIn, ___NS__forInRight, ___NS__forOwn, ___NS__forOwnRight, ___NS__fromPairs, ___NS__functions, ___NS__functionsIn, ___NS__get, ___NS__groupBy, ___NS__gt, ___NS__gte, ___NS__has, ___NS__hasIn, ___NS__head, ___NS__identity, ___NS__includes, ___NS__indexOf, ___NS__initial, ___NS__inRange, ___NS__intersection, ___NS__intersectionBy, ___NS__intersectionWith, ___NS__invert, ___NS__invertBy, ___NS__invoke, ___NS__invokeMap, ___NS__isArguments, ___NS__isArray, ___NS__isArrayBuffer, ___NS__isArrayLike, ___NS__isArrayLikeObject, ___NS__isBoolean, ___NS__isBuffer, ___NS__isDate, ___NS__isElement, ___NS__isEmpty, ___NS__isEqual, ___NS__isEqualWith, ___NS__isError, ___NS__isFinite, ___NS__isFunction, ___NS__isInteger, ___NS__isLength, ___NS__isMap, ___NS__isMatch, ___NS__isMatchWith, ___NS__isNaN, ___NS__isNative, ___NS__isNil, ___NS__isNull, ___NS__isNumber, ___NS__isObject, ___NS__isObjectLike, ___NS__isPlainObject, ___NS__isRegExp, ___NS__isSafeInteger, ___NS__isSet, ___NS__isString, ___NS__isSymbol, ___NS__isTypedArray, ___NS__isUndefined, ___NS__isWeakMap, ___NS__isWeakSet, ___NS__iteratee, ___NS__join, ___NS__kebabCase, ___NS__keyBy, ___NS__keys, ___NS__keysIn, ___NS__last, ___NS__lastIndexOf, ___NS__lowerCase, ___NS__lowerFirst, ___NS__lt, ___NS__lte, ___NS__map, ___NS__mapKeys, ___NS__mapValues, ___NS__matches, ___NS__matchesProperty, ___NS__max, ___NS__maxBy, ___NS__mean, ___NS__meanBy, ___NS__memoize, ___NS__merge, ___NS__mergeWith, ___NS__method, ___NS__methodOf, ___NS__min, ___NS__minBy, ___NS__mixin, ___NS__multiply, ___NS__negate, ___NS__noop, ___NS__now, ___NS__nth, ___NS__nthArg, ___NS__omit, ___NS__omitBy, ___NS__once, ___NS__orderBy, ___NS__over, ___NS__overArgs, ___NS__overEvery, ___NS__overSome, ___NS__pad, ___NS__padEnd, ___NS__padStart, ___NS__parseInt, ___NS__partial, ___NS__partialRight, ___NS__partition, ___NS__pick, ___NS__pickBy, ___NS__property, ___NS__propertyOf, ___NS__pull, ___NS__pullAll, ___NS__pullAllBy, ___NS__pullAllWith, ___NS__pullAt, ___NS__random, ___NS__range, ___NS__rangeRight, ___NS__rearg, ___NS__reduce, ___NS__reduceRight, ___NS__reject, ___NS__remove, ___NS__repeat, ___NS__replace, ___NS__rest, ___NS__result, ___NS__reverse, ___NS__round, ___NS__sample, ___NS__sampleSize, ___NS__set, ___NS__setWith, ___NS__shuffle, ___NS__size, ___NS__slice, ___NS__snakeCase, ___NS__some, ___NS__sortBy, ___NS__sortedIndex, ___NS__sortedIndexBy, ___NS__sortedIndexOf, ___NS__sortedLastIndex, ___NS__sortedLastIndexBy, ___NS__sortedLastIndexOf, ___NS__sortedUniq, ___NS__sortedUniqBy, ___NS__split, ___NS__spread, ___NS__startCase, ___NS__startsWith, ___NS__stubArray, ___NS__stubFalse, ___NS__stubObject, ___NS__stubString, ___NS__stubTrue, ___NS__subtract, ___NS__sum, ___NS__sumBy, ___NS__tail, ___NS__take, ___NS__takeRight, ___NS__takeRightWhile, ___NS__takeWhile, ___NS__tap, ___NS__template, ___NS__templateSettings, ___NS__throttle, ___NS__thru, ___NS__times, ___NS__toArray, ___NS__toFinite, ___NS__toInteger, ___NS__toLength, ___NS__toLower, ___NS__toNumber, ___NS__toPairs, ___NS__toPairsIn, ___NS__toPath, ___NS__toPlainObject, ___NS__toSafeInteger, ___NS__toString, ___NS__toUpper, ___NS__transform, ___NS__trim, ___NS__trimEnd, ___NS__trimStart, ___NS__truncate, ___NS__unary, ___NS__unescape, ___NS__union, ___NS__unionBy, ___NS__unionWith, ___NS__uniq, ___NS__uniqBy, ___NS__uniqueId, ___NS__uniqWith, ___NS__unset, ___NS__unzip, ___NS__unzipWith, ___NS__update, ___NS__updateWith, ___NS__upperCase, ___NS__upperFirst, ___NS__values, ___NS__valuesIn, ___NS__without, ___NS__words, ___NS__wrap, ___NS__xor, ___NS__xorBy, ___NS__xorWith, ___NS__zip, ___NS__zipObject, ___NS__zipObjectDeep, ___NS__zipWith } from 'tnp-core/lib-prod';
|
|
3
|
-
import { SYMBOL } from 'typescript-class-helpers/lib-prod';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* for backendSocket.in(ROOM_NAME).emit(EVENT)
|
|
7
|
-
*
|
|
8
|
-
* Room names are uniqe..
|
|
9
|
-
* here I am limiting number of event for clients.
|
|
10
|
-
*/
|
|
11
|
-
class Realtime {
|
|
12
|
-
NAMESPACE(contextName: string) {
|
|
13
|
-
return `${contextName}-taonRealtimeNsp`;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
TABLE_CHANGE(contextName: string, tableName: string) {
|
|
17
|
-
return `${contextName}:listentablename${tableName}`;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
readonly KEYroomSubscribe = `roomSubscribe`;
|
|
21
|
-
|
|
22
|
-
readonly KEYroomUnsubscribe = `roomUnsubscribe`;
|
|
23
|
-
|
|
24
|
-
// /**
|
|
25
|
-
// * TODO use it or not?
|
|
26
|
-
// * @deprecated
|
|
27
|
-
// */
|
|
28
|
-
// ROOM_NAME_SUBSCRIBER_EVENT(
|
|
29
|
-
// contextName: string,
|
|
30
|
-
// className: string,
|
|
31
|
-
// propertyName: string,
|
|
32
|
-
// ) {
|
|
33
|
-
// return `${contextName}:room${___NS__camelCase(className)}${propertyName}`.toLowerCase();
|
|
34
|
-
// }
|
|
35
|
-
|
|
36
|
-
//#region custom events in rooms
|
|
37
|
-
ROOM_NAME_CUSTOM(contextName: string, customEvent: string) {
|
|
38
|
-
return `${contextName}:CustomRoomEvent${customEvent}`;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
ROOM_SUBSCRIBE_CUSTOM(contextName: string) {
|
|
42
|
-
return `${contextName}:${this.KEYroomSubscribe}CustomRoomEvent`;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
ROOM_UNSUBSCRIBE_CUSTOM(contextName: string) {
|
|
46
|
-
return `${contextName}:${this.KEYroomUnsubscribe}CustomRoomEvent`;
|
|
47
|
-
}
|
|
48
|
-
//#endregion
|
|
49
|
-
|
|
50
|
-
//#region entity events
|
|
51
|
-
ROOM_NAME_UPDATE_ENTITY(
|
|
52
|
-
contextName: string,
|
|
53
|
-
className: string,
|
|
54
|
-
entityId: number | string,
|
|
55
|
-
) {
|
|
56
|
-
return `${contextName}:room${___NS__camelCase(className)}${entityId}`.toLowerCase();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
ROOM_SUBSCRIBE_ENTITY_UPDATE_EVENTS(contextName: string) {
|
|
60
|
-
return `${contextName}:${this.KEYroomSubscribe}EntityEvents`;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
ROOM_UNSUBSCRIBE_ENTITY_UPDATE_EVENTS(contextName: string) {
|
|
64
|
-
return `${contextName}:${this.KEYroomUnsubscribe}EntityEvents`;
|
|
65
|
-
}
|
|
66
|
-
//#endregion
|
|
67
|
-
|
|
68
|
-
//#region entity property events
|
|
69
|
-
ROOM_NAME_UPDATE_ENTITY_PROPERTY(
|
|
70
|
-
contextName: string,
|
|
71
|
-
className: string,
|
|
72
|
-
property: string,
|
|
73
|
-
entityId: number | string,
|
|
74
|
-
) {
|
|
75
|
-
return `${contextName}:room${___NS__camelCase(className)}${___NS__camelCase(property)}${entityId}`.toLowerCase();
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
ROOM_SUBSCRIBE_ENTITY_PROPERTY_UPDATE_EVENTS(contextName: string) {
|
|
79
|
-
return `${contextName}:${this.KEYroomSubscribe}EntityPropertyEvents`;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
ROOM_UNSUBSCRIBE_ENTITY_PROPERTY_UPDATE_EVENTS(contextName: string) {
|
|
83
|
-
return `${contextName}:${this.KEYroomUnsubscribe}EntityPropertyEvents`;
|
|
84
|
-
}
|
|
85
|
-
//#endregion
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
//namespace Symbols
|
|
89
|
-
|
|
90
|
-
export const Symbols__NS__ctxInClassOrClassObj = Symbol();
|
|
91
|
-
export const Symbols__NS__classNameStaticProperty: string = SYMBOL.ClassNameStaticProperty;
|
|
92
|
-
export const Symbols__NS__fullClassNameStaticProperty: string = `$$fullclassName$$`;
|
|
93
|
-
export const Symbols__NS__orignalClass: string = OrignalClassKey;
|
|
94
|
-
export const Symbols__NS__orignalClassClonesObj: string = `$$originalClassClonesObj$$`;
|
|
95
|
-
export const Symbols__NS__classMethodsNames: string = `$$classMethodsNames$$`;
|
|
96
|
-
|
|
97
|
-
export const Symbols__NS__REALTIME = new Realtime();
|
|
98
|
-
|
|
99
|
-
export const Symbols__NS__metadata = {
|
|
100
|
-
className: `class:realname`,
|
|
101
|
-
options: {
|
|
102
|
-
controller: `controller:options`,
|
|
103
|
-
entity: `entity:options`,
|
|
104
|
-
repository: `repository:options`,
|
|
105
|
-
provider: `provider:options`,
|
|
106
|
-
subscriber: `subscriber:options`,
|
|
107
|
-
migration: `migration:options`,
|
|
108
|
-
},
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
export const Symbols__NS__old = {
|
|
112
|
-
HAS_TABLE_IN_DB: Symbol(),
|
|
113
|
-
MDC_KEY: `modeldataconfig`,
|
|
114
|
-
WEBSQL_REST_PROGRESS_FUN: Symbol(),
|
|
115
|
-
WEBSQL_REST_PROGRESS_FUN_START: Symbol(),
|
|
116
|
-
WEBSQL_REST_PROGRESS_FUN_DONE: Symbol(),
|
|
117
|
-
WEBSQL_REST_PROGRESS_TIMEOUT: Symbol(),
|
|
118
|
-
|
|
119
|
-
X_TOTAL_COUNT: `x-total-count`,
|
|
120
|
-
CIRCURAL_OBJECTS_MAP_BODY: `circuralmapbody`,
|
|
121
|
-
CIRCURAL_OBJECTS_MAP_QUERY_PARAM: `circuralmapbody`,
|
|
122
|
-
MAPPING_CONFIG_HEADER: `mappingheader`,
|
|
123
|
-
MAPPING_CONFIG_HEADER_BODY_PARAMS: `mhbodyparams`,
|
|
124
|
-
MAPPING_CONFIG_HEADER_QUERY_PARAMS: `mhqueryparams`,
|
|
125
|
-
ENDPOINT_META_CONFIG: `ng2_rest_endpoint_config`,
|
|
126
|
-
CLASS_DECORATOR_CONTEXT: `$$ng2_rest_class_context`,
|
|
127
|
-
SOCKET_MSG: `socketmessageng2rest`,
|
|
128
|
-
ANGULAR: {
|
|
129
|
-
INPUT_NAMES: Symbol(),
|
|
130
|
-
},
|
|
131
|
-
ERROR_MESSAGES: {
|
|
132
|
-
CLASS_NAME_MATCH: `Please check if your "class name" matches @Controller( className ) or @Entity( className )`,
|
|
133
|
-
},
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
//end of namespace Symbols
|
package/lib-prod/ui/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function dummy1769562912643() { }
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function dummy1769562926649() { }
|
package/lib-prod/validators.ts
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { ___NS__add, ___NS__after, ___NS__ary, ___NS__assign, ___NS__assignIn, ___NS__assignInWith, ___NS__assignWith, ___NS__at, ___NS__attempt, ___NS__before, ___NS__bind, ___NS__bindAll, ___NS__bindKey, ___NS__camelCase, ___NS__capitalize, ___NS__castArray, ___NS__ceil, ___NS__chain, ___NS__chunk, ___NS__clamp, ___NS__clone, ___NS__cloneDeep, ___NS__cloneDeepWith, ___NS__cloneWith, ___NS__compact, ___NS__concat, ___NS__cond, ___NS__conforms, ___NS__conformsTo, ___NS__constant, ___NS__countBy, ___NS__create, ___NS__curry, ___NS__curryRight, ___NS__debounce, ___NS__deburr, ___NS__defaults, ___NS__defaultsDeep, ___NS__defaultTo, ___NS__defer, ___NS__delay, ___NS__difference, ___NS__differenceBy, ___NS__differenceWith, ___NS__divide, ___NS__drop, ___NS__dropRight, ___NS__dropRightWhile, ___NS__dropWhile, ___NS__each, ___NS__eachRight, ___NS__endsWith, ___NS__entries, ___NS__entriesIn, ___NS__eq, ___NS__escape, ___NS__escapeRegExp, ___NS__every, ___NS__extend, ___NS__extendWith, ___NS__fill, ___NS__filter, ___NS__find, ___NS__findIndex, ___NS__findKey, ___NS__findLast, ___NS__findLastIndex, ___NS__findLastKey, ___NS__first, ___NS__flatMap, ___NS__flatMapDeep, ___NS__flatMapDepth, ___NS__flatten, ___NS__flattenDeep, ___NS__flattenDepth, ___NS__flip, ___NS__floor, ___NS__flow, ___NS__flowRight, ___NS__forEach, ___NS__forEachRight, ___NS__forIn, ___NS__forInRight, ___NS__forOwn, ___NS__forOwnRight, ___NS__fromPairs, ___NS__functions, ___NS__functionsIn, ___NS__get, ___NS__groupBy, ___NS__gt, ___NS__gte, ___NS__has, ___NS__hasIn, ___NS__head, ___NS__identity, ___NS__includes, ___NS__indexOf, ___NS__initial, ___NS__inRange, ___NS__intersection, ___NS__intersectionBy, ___NS__intersectionWith, ___NS__invert, ___NS__invertBy, ___NS__invoke, ___NS__invokeMap, ___NS__isArguments, ___NS__isArray, ___NS__isArrayBuffer, ___NS__isArrayLike, ___NS__isArrayLikeObject, ___NS__isBoolean, ___NS__isBuffer, ___NS__isDate, ___NS__isElement, ___NS__isEmpty, ___NS__isEqual, ___NS__isEqualWith, ___NS__isError, ___NS__isFinite, ___NS__isFunction, ___NS__isInteger, ___NS__isLength, ___NS__isMap, ___NS__isMatch, ___NS__isMatchWith, ___NS__isNaN, ___NS__isNative, ___NS__isNil, ___NS__isNull, ___NS__isNumber, ___NS__isObject, ___NS__isObjectLike, ___NS__isPlainObject, ___NS__isRegExp, ___NS__isSafeInteger, ___NS__isSet, ___NS__isString, ___NS__isSymbol, ___NS__isTypedArray, ___NS__isUndefined, ___NS__isWeakMap, ___NS__isWeakSet, ___NS__iteratee, ___NS__join, ___NS__kebabCase, ___NS__keyBy, ___NS__keys, ___NS__keysIn, ___NS__last, ___NS__lastIndexOf, ___NS__lowerCase, ___NS__lowerFirst, ___NS__lt, ___NS__lte, ___NS__map, ___NS__mapKeys, ___NS__mapValues, ___NS__matches, ___NS__matchesProperty, ___NS__max, ___NS__maxBy, ___NS__mean, ___NS__meanBy, ___NS__memoize, ___NS__merge, ___NS__mergeWith, ___NS__method, ___NS__methodOf, ___NS__min, ___NS__minBy, ___NS__mixin, ___NS__multiply, ___NS__negate, ___NS__noop, ___NS__now, ___NS__nth, ___NS__nthArg, ___NS__omit, ___NS__omitBy, ___NS__once, ___NS__orderBy, ___NS__over, ___NS__overArgs, ___NS__overEvery, ___NS__overSome, ___NS__pad, ___NS__padEnd, ___NS__padStart, ___NS__parseInt, ___NS__partial, ___NS__partialRight, ___NS__partition, ___NS__pick, ___NS__pickBy, ___NS__property, ___NS__propertyOf, ___NS__pull, ___NS__pullAll, ___NS__pullAllBy, ___NS__pullAllWith, ___NS__pullAt, ___NS__random, ___NS__range, ___NS__rangeRight, ___NS__rearg, ___NS__reduce, ___NS__reduceRight, ___NS__reject, ___NS__remove, ___NS__repeat, ___NS__replace, ___NS__rest, ___NS__result, ___NS__reverse, ___NS__round, ___NS__sample, ___NS__sampleSize, ___NS__set, ___NS__setWith, ___NS__shuffle, ___NS__size, ___NS__slice, ___NS__snakeCase, ___NS__some, ___NS__sortBy, ___NS__sortedIndex, ___NS__sortedIndexBy, ___NS__sortedIndexOf, ___NS__sortedLastIndex, ___NS__sortedLastIndexBy, ___NS__sortedLastIndexOf, ___NS__sortedUniq, ___NS__sortedUniqBy, ___NS__split, ___NS__spread, ___NS__startCase, ___NS__startsWith, ___NS__stubArray, ___NS__stubFalse, ___NS__stubObject, ___NS__stubString, ___NS__stubTrue, ___NS__subtract, ___NS__sum, ___NS__sumBy, ___NS__tail, ___NS__take, ___NS__takeRight, ___NS__takeRightWhile, ___NS__takeWhile, ___NS__tap, ___NS__template, ___NS__templateSettings, ___NS__throttle, ___NS__thru, ___NS__times, ___NS__toArray, ___NS__toFinite, ___NS__toInteger, ___NS__toLength, ___NS__toLower, ___NS__toNumber, ___NS__toPairs, ___NS__toPairsIn, ___NS__toPath, ___NS__toPlainObject, ___NS__toSafeInteger, ___NS__toString, ___NS__toUpper, ___NS__transform, ___NS__trim, ___NS__trimEnd, ___NS__trimStart, ___NS__truncate, ___NS__unary, ___NS__unescape, ___NS__union, ___NS__unionBy, ___NS__unionWith, ___NS__uniq, ___NS__uniqBy, ___NS__uniqueId, ___NS__uniqWith, ___NS__unset, ___NS__unzip, ___NS__unzipWith, ___NS__update, ___NS__updateWith, ___NS__upperCase, ___NS__upperFirst, ___NS__values, ___NS__valuesIn, ___NS__without, ___NS__words, ___NS__wrap, ___NS__xor, ___NS__xorBy, ___NS__xorWith, ___NS__zip, ___NS__zipObject, ___NS__zipObjectDeep, ___NS__zipWith } from 'tnp-core/lib-prod';
|
|
2
|
-
|
|
3
|
-
import { MethodConfig } from './config/method-config';
|
|
4
|
-
import { Models__NS__ClassType, Models__NS__ClassTypeKey, Models__NS__ConnectionOptionsLogs, Models__NS__ContextOptions, Models__NS__DatabaseConfig, Models__NS__DatabaseConfigTypeOrm, Models__NS__DatabasesFolder, Models__NS__DBRecreateMode, Models__NS__FrameworkMode, Models__NS__Http__NS__AsyncResponse, Models__NS__Http__NS__AuthCallBack, Models__NS__Http__NS__ClientAction, Models__NS__Http__NS__ContextENDPOINT, Models__NS__Http__NS__ExpressContext, Models__NS__Http__NS__FormlyFromType, Models__NS__Http__NS__MixResponse, Models__NS__Http__NS__Response, Models__NS__Http__NS__ResponseFuncOpt, Models__NS__Http__NS__SyncResponse, Models__NS__Http__NS__SyncResponseFunc, Models__NS__ISession, Models__NS__MiddlewareType, Models__NS__StartParams, Models__NS__TaonCtxCloneParams, Models__NS__TaonInitializeParams } from './models';
|
|
5
|
-
|
|
6
|
-
//namespace Validators
|
|
7
|
-
|
|
8
|
-
//#region vlidate class name
|
|
9
|
-
export const Validators__NS__classNameVlidation = (className, target: Function) => {
|
|
10
|
-
setTimeout(() => {
|
|
11
|
-
// console.log(`check after timeout ${className} , production mode: ${FrameworkContext.isProductionMode}`)
|
|
12
|
-
if (___NS__isUndefined(className)) {
|
|
13
|
-
throw `[Taon]
|
|
14
|
-
Please provide "className" property for each Controller and Entity:
|
|
15
|
-
|
|
16
|
-
@Taon.Controller({ className: 'MyExampleCtrl' })
|
|
17
|
-
class MyExampleCtrl {
|
|
18
|
-
...
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
@Taon.Entity({ className: 'MyExampleEntity' })
|
|
22
|
-
class MyExampleEntity {
|
|
23
|
-
...
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
Notice that minified javascript code does not preserve
|
|
27
|
-
Functions/Classes names -this is only solution to preserve classes names.
|
|
28
|
-
|
|
29
|
-
`;
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
return ___NS__isUndefined(className) ? target.name : className;
|
|
34
|
-
};
|
|
35
|
-
//#endregion
|
|
36
|
-
|
|
37
|
-
//#region validate method config
|
|
38
|
-
export const Validators__NS__checkIfMethodsWithReponseTYpeAlowed = (
|
|
39
|
-
methods: MethodConfig[],
|
|
40
|
-
current: MethodConfig,
|
|
41
|
-
) => {
|
|
42
|
-
const defaultResponseType = 'text or JSON';
|
|
43
|
-
if (!current.responseType) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
for (let index = 0; index < methods.length; index++) {
|
|
47
|
-
const m = methods[index];
|
|
48
|
-
if (m.path === current.path && m.responseType !== current.responseType) {
|
|
49
|
-
throw new Error(`
|
|
50
|
-
[taon] you can have 2 methods with same path but differetn reponseType-s
|
|
51
|
-
|
|
52
|
-
${m.methodName}( ... path: ${m.path} ) -> responseType: ${m.responseType || defaultResponseType}
|
|
53
|
-
${current.methodName}( ... path: ${current.path} ) -> responseType: ${current.responseType}
|
|
54
|
-
|
|
55
|
-
Please change path name on of the methods.
|
|
56
|
-
|
|
57
|
-
`);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
//#endregion
|
|
62
|
-
|
|
63
|
-
//#region validate class functions
|
|
64
|
-
// TODO
|
|
65
|
-
export const Validators__NS__validateClassFunctions = (
|
|
66
|
-
controllers: any[],
|
|
67
|
-
entities: any[],
|
|
68
|
-
proviers: any[],
|
|
69
|
-
repositories: any[],
|
|
70
|
-
) => {
|
|
71
|
-
if (
|
|
72
|
-
___NS__isArray(controllers) &&
|
|
73
|
-
controllers.filter(f => !___NS__isFunction(f)).length > 0
|
|
74
|
-
) {
|
|
75
|
-
console.error('controllers', controllers);
|
|
76
|
-
throw `
|
|
77
|
-
|
|
78
|
-
Incorect value for property "controllers" inside Taon.Init(...)
|
|
79
|
-
|
|
80
|
-
`;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (
|
|
84
|
-
___NS__isArray(entities) &&
|
|
85
|
-
entities.filter(f => !___NS__isFunction(f)).length > 0
|
|
86
|
-
) {
|
|
87
|
-
console.error('entites', entities);
|
|
88
|
-
throw `
|
|
89
|
-
|
|
90
|
-
Incorect value for property "entities" inside Taon.Init(...)
|
|
91
|
-
|
|
92
|
-
`;
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
//#endregion
|
|
96
|
-
|
|
97
|
-
export const Validators__NS__preventUndefinedModel = (model, id) => {
|
|
98
|
-
if (___NS__isUndefined(model)) {
|
|
99
|
-
throw `Bad update by id, config, id: ${id}`;
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
//end of namespace Validators
|