@eggjs/tegg-types 4.0.2-beta.16 → 4.0.2-beta.17
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.d.ts +2 -1
- package/dist/index.js +3 -1
- package/dist/scope/TeggScope.d.ts +82 -0
- package/dist/scope/TeggScope.js +162 -0
- package/dist/scope/index.d.ts +2 -0
- package/dist/scope/index.js +3 -0
- package/package.json +5 -3
package/dist/index.d.ts
CHANGED
|
@@ -77,6 +77,7 @@ import { EggObjectLifecycle, LifecycleHookName } from "./lifecycle/EggObjectLife
|
|
|
77
77
|
import { Id, IdenticalObject } from "./lifecycle/IdenticalObject.js";
|
|
78
78
|
import { LifecycleContext, LifecycleHook, LifecycleObject } from "./lifecycle/LifecycleHook.js";
|
|
79
79
|
import { AttributeOptions, IS_MODEL, IndexOptions, MODEL_DATA_ATTRIBUTES, MODEL_DATA_INDICES, MODEL_DATA_SOURCE, MODEL_DATA_TABLE_NAME, MODEL_PROTO_IMPL_TYPE, ModelAttributeInfo, ModelIndexInfo, ModelParams } from "./orm.js";
|
|
80
|
+
import { TeggScope, TeggScopeBag } from "./scope/TeggScope.js";
|
|
80
81
|
import { CronParams, CronScheduleParams, IS_SCHEDULE, IntervalParams, IntervalScheduleParams, SCHEDULE_METADATA, SCHEDULE_OPTIONS, SCHEDULE_PARAMS, ScheduleOptions, ScheduleParams, ScheduleSubscriber, ScheduleType, ScheduleTypeLike } from "./schedule.js";
|
|
81
82
|
import { IS_TRANSACTION_CLAZZ, PropagationType, TRANSACTION_META_DATA, TransactionMetadata, TransactionalParams } from "./transaction.js";
|
|
82
|
-
export { AGENT_CONTROLLER_PROTO_IMPL_TYPE, ASPECT_LIST, AccessLevel, AdviceContext, AdviceInfo, AgentConflictError, AgentErrorCode, AgentInvalidRequestError, AgentMessage, AgentNotFoundError, AgentObjectType, AgentRunConfig, AgentStore, AgentTimeoutError, AspectAdvice, AttributeOptions, BaseDaoType, BaseMultiInstancePrototypeCallbackParams, BaseSpatialParams, BaseSqlMap, BigIntParams, BinaryParams, BitParams, BlobParams, BlockSqlMap, BoolParams, CONSTRUCTOR_QUALIFIER_META_DATA, CONTROLLER_ACL, CONTROLLER_AGENT_CONTROLLER, CONTROLLER_AGENT_ENHANCED, CONTROLLER_AGENT_NOT_IMPLEMENTED, CONTROLLER_AOP_MIDDLEWARES, CONTROLLER_HOST, CONTROLLER_HTTP_PATH, CONTROLLER_MCP_CONTROLLER_PARAMS_MAP, CONTROLLER_MCP_EXTRA_INDEX, CONTROLLER_MCP_NAME, CONTROLLER_MCP_PROMPT_ARGS_INDEX, CONTROLLER_MCP_PROMPT_MAP, CONTROLLER_MCP_PROMPT_PARAMS_MAP, CONTROLLER_MCP_RESOURCE_MAP, CONTROLLER_MCP_RESOURCE_PARAMS_MAP, CONTROLLER_MCP_TOOL_ARGS_INDEX, CONTROLLER_MCP_TOOL_MAP, CONTROLLER_MCP_TOOL_PARAMS_MAP, CONTROLLER_MCP_VERSION, CONTROLLER_META_DATA, CONTROLLER_METHOD_METHOD_MAP, CONTROLLER_METHOD_PARAM_NAME_MAP, CONTROLLER_METHOD_PARAM_TYPE_MAP, CONTROLLER_METHOD_PATH_MAP, CONTROLLER_METHOD_PRIORITY, CONTROLLER_MIDDLEWARES, CONTROLLER_NAME, CONTROLLER_TIMEOUT_METADATA, CONTROLLER_TYPE, CROSSCUT_INFO_LIST, CharParams, ClassCrosscutParam, CodeGeneratorOptions, ColumnFormat, ColumnParams, ColumnTsType, ColumnType, ColumnTypeParams, CompressionType, ConfigSourceQualifierAttribute, ContainerGetMethod, ContextProtoParams, ControllerMetaBuilder, ControllerMetaBuilderCreator, ControllerMetadata, ControllerType, ControllerTypeLike, CreateObjectMethod, CreateRunInput, CreateThreadOptions, CronParams, CronScheduleParams, CrosscutInfo, CrosscutOptions, CrosscutParam, CustomCrosscutParam, CustomPointcutCallback, DAL_COLUMN_INFO_MAP, DAL_COLUMN_TYPE_MAP, DAL_INDEX_LIST, DAL_IS_DAO, DAL_IS_TABLE, DAL_TABLE_PARAMS, DEFAULT_PROTO_IMPL_TYPE, DataSource, DataSourceInjectName, DataSourceQualifierAttribute, DateParams, DateTimeParams, DecimalParams, DoubleParams, EggAbstractClazz, EggContainer, EggContext, EggContextLifecycleContext, EggLoadUnitType, EggLoadUnitTypeLike, EggMultiInstanceCallbackPrototypeInfo, EggMultiInstancePrototypeInfo, EggObject, EggObjectFactory, EggObjectLifeCycleContext, EggObjectLifecycle, EggObjectName, EggObjectStatus, EggProtoImplClass, EggPrototype, EggPrototypeClass, EggPrototypeCreator, EggPrototypeInfo, EggPrototypeLifecycleContext, EggPrototypeName, EggPrototypeWithClazz, EggQualifierAttribute, EggRuntimeContext, EggType, EnumParams, EnvType, ErrorCodes, FloatParams, FullSqlMap, GenerateSqlMap, GenericInputContentPart, Geometry, GeometryCollection, GeometryCollectionParams, GeometryParams, GetThreadOptions, GraphNodeObj, HTTPControllerParams, HTTPMethodEnum, HTTPMethodParams, HTTPParamParams, HTTPParamType, HTTPQueriesParams, HTTPQueryParams, HostType, IAdvice, IColumnTypeParams, INIT_TYPE_TRY_ORDER, IS_CROSSCUT_ADVICE, IS_MODEL, IS_SCHEDULE, IS_TRANSACTION_CLAZZ, Id, IdenticalObject, ImplDecorator, ImplTypeEnum, IncomingHttpHeaders, IndexOptions, IndexParams, IndexStoreType, IndexType, InitTypeQualifierAttribute, InjectConstructor, InjectConstructorInfo, InjectConstructorProto, InjectObject, InjectObjectDescriptor, InjectObjectInfo, InjectObjectProto, InjectParams, InjectType, InlineModuleReferenceConfig, InputContentPart, InputMessage, InsertMethod, IntParams, IntervalParams, IntervalScheduleParams, InvalidRunStateTransitionError, JsonParams, LifecycleContext, LifecycleHook, LifecycleHookName, LifecycleObject, Line, LinestringParams, LoadUnit, LoadUnitCreator, LoadUnitInstance, LoadUnitInstanceLifecycleContext, LoadUnitLifecycleContext, LoadUnitNameQualifierAttribute, LoadUnitPair, Loader, Logger, LongBlobParams, LongTextParams, MCPControllerParams, MCPPromptParams, MCPPromptResponse, MCPProtocols, MCPResourceParams, MCPResourceResponse, MCPResourceTemplateParams, MCPResourceUriParams, MCPToolParams, MCPToolResponse, METHOD_ACL, METHOD_AOP_MIDDLEWARES, METHOD_AOP_REGISTER_MAP, METHOD_CONTEXT_INDEX, METHOD_CONTROLLER_HOST, METHOD_CONTROLLER_TYPE_MAP, METHOD_MIDDLEWARES, METHOD_TIMEOUT_METADATA, MODEL_DATA_ATTRIBUTES, MODEL_DATA_INDICES, MODEL_DATA_SOURCE, MODEL_DATA_TABLE_NAME, MODEL_PROTO_IMPL_TYPE, MediumBlobParams, MediumIntParams, MediumTextParams, MetaDataKey, MethodMeta, MethodType, MethodTypeLike, MiddlewareFunc, ModelAttributeInfo, ModelIndexInfo, ModelParams, ModuleConfig, ModuleConfigHolder, ModuleReference, ModuleReferenceConfig, MultiInstancePrototypeCallbackParams, MultiInstancePrototypeGetObjectsContext, MultiInstancePrototypeParams, MultiInstancePrototypeStaticParams, MultiInstanceType, MultiLine, MultiLinestringParams, MultiPoint, MultiPointParams, MultiPolygon, MultiPolygonParams, NameCrosscutParam, Next, NpmModuleReferenceConfig, ObjectInfo, ObjectInitType, ObjectInitTypeLike, ObjectStorageClient, POINTCUT_ADVICE_INFO_LIAR, PROPERTY_QUALIFIER_META_DATA, PaginateData, Point, PointParams, PointcutInfo, PointcutOptions, PointcutType, Polygon, PolygonParams, PromptArgs, PromptExtra, PropagationType, ProtoDescriptor, ProtoDescriptorType, ProtoDescriptorTypeLike, PrototypeParams, QUALIFIER_IMPL_MAP, QUALIFIER_META_DATA, QualifierAttribute, QualifierInfo, QualifierValue, ReadModuleReferenceOptions, ResourceExtra, ResourceVariables, RowFormat, RunObject, RunRecord, RunStatus, RuntimeConfig, SCHEDULE_METADATA, SCHEDULE_OPTIONS, SCHEDULE_PARAMS, SDKAssistantMessage, SDKGenericMessage, SDKResultMessage, SDKStreamEvent, SDKSystemMessage, SDKUserMessage, ScheduleOptions, ScheduleParams, ScheduleSubscriber, ScheduleType, ScheduleTypeLike, SetParams, SingletonProtoParams, SmallIntParams, SqlMap, SqlType, StreamEvent, TRANSACTION_META_DATA, TableParams, Templates, TextInputContentPart, TextParams, ThreadObject, ThreadObjectWithMessages, ThreadRecord, TimeParams, TimestampParams, TinyBlobParams, TinyIntParams, TinyTextParams, ToolArgs, ToolExtra, ToolResultInputContentPart, ToolUseInputContentPart, TransactionMetadata, TransactionalParams, VarBinaryParams, VarCharParams, YearParams };
|
|
83
|
+
export { AGENT_CONTROLLER_PROTO_IMPL_TYPE, ASPECT_LIST, AccessLevel, AdviceContext, AdviceInfo, AgentConflictError, AgentErrorCode, AgentInvalidRequestError, AgentMessage, AgentNotFoundError, AgentObjectType, AgentRunConfig, AgentStore, AgentTimeoutError, AspectAdvice, AttributeOptions, BaseDaoType, BaseMultiInstancePrototypeCallbackParams, BaseSpatialParams, BaseSqlMap, BigIntParams, BinaryParams, BitParams, BlobParams, BlockSqlMap, BoolParams, CONSTRUCTOR_QUALIFIER_META_DATA, CONTROLLER_ACL, CONTROLLER_AGENT_CONTROLLER, CONTROLLER_AGENT_ENHANCED, CONTROLLER_AGENT_NOT_IMPLEMENTED, CONTROLLER_AOP_MIDDLEWARES, CONTROLLER_HOST, CONTROLLER_HTTP_PATH, CONTROLLER_MCP_CONTROLLER_PARAMS_MAP, CONTROLLER_MCP_EXTRA_INDEX, CONTROLLER_MCP_NAME, CONTROLLER_MCP_PROMPT_ARGS_INDEX, CONTROLLER_MCP_PROMPT_MAP, CONTROLLER_MCP_PROMPT_PARAMS_MAP, CONTROLLER_MCP_RESOURCE_MAP, CONTROLLER_MCP_RESOURCE_PARAMS_MAP, CONTROLLER_MCP_TOOL_ARGS_INDEX, CONTROLLER_MCP_TOOL_MAP, CONTROLLER_MCP_TOOL_PARAMS_MAP, CONTROLLER_MCP_VERSION, CONTROLLER_META_DATA, CONTROLLER_METHOD_METHOD_MAP, CONTROLLER_METHOD_PARAM_NAME_MAP, CONTROLLER_METHOD_PARAM_TYPE_MAP, CONTROLLER_METHOD_PATH_MAP, CONTROLLER_METHOD_PRIORITY, CONTROLLER_MIDDLEWARES, CONTROLLER_NAME, CONTROLLER_TIMEOUT_METADATA, CONTROLLER_TYPE, CROSSCUT_INFO_LIST, CharParams, ClassCrosscutParam, CodeGeneratorOptions, ColumnFormat, ColumnParams, ColumnTsType, ColumnType, ColumnTypeParams, CompressionType, ConfigSourceQualifierAttribute, ContainerGetMethod, ContextProtoParams, ControllerMetaBuilder, ControllerMetaBuilderCreator, ControllerMetadata, ControllerType, ControllerTypeLike, CreateObjectMethod, CreateRunInput, CreateThreadOptions, CronParams, CronScheduleParams, CrosscutInfo, CrosscutOptions, CrosscutParam, CustomCrosscutParam, CustomPointcutCallback, DAL_COLUMN_INFO_MAP, DAL_COLUMN_TYPE_MAP, DAL_INDEX_LIST, DAL_IS_DAO, DAL_IS_TABLE, DAL_TABLE_PARAMS, DEFAULT_PROTO_IMPL_TYPE, DataSource, DataSourceInjectName, DataSourceQualifierAttribute, DateParams, DateTimeParams, DecimalParams, DoubleParams, EggAbstractClazz, EggContainer, EggContext, EggContextLifecycleContext, EggLoadUnitType, EggLoadUnitTypeLike, EggMultiInstanceCallbackPrototypeInfo, EggMultiInstancePrototypeInfo, EggObject, EggObjectFactory, EggObjectLifeCycleContext, EggObjectLifecycle, EggObjectName, EggObjectStatus, EggProtoImplClass, EggPrototype, EggPrototypeClass, EggPrototypeCreator, EggPrototypeInfo, EggPrototypeLifecycleContext, EggPrototypeName, EggPrototypeWithClazz, EggQualifierAttribute, EggRuntimeContext, EggType, EnumParams, EnvType, ErrorCodes, FloatParams, FullSqlMap, GenerateSqlMap, GenericInputContentPart, Geometry, GeometryCollection, GeometryCollectionParams, GeometryParams, GetThreadOptions, GraphNodeObj, HTTPControllerParams, HTTPMethodEnum, HTTPMethodParams, HTTPParamParams, HTTPParamType, HTTPQueriesParams, HTTPQueryParams, HostType, IAdvice, IColumnTypeParams, INIT_TYPE_TRY_ORDER, IS_CROSSCUT_ADVICE, IS_MODEL, IS_SCHEDULE, IS_TRANSACTION_CLAZZ, Id, IdenticalObject, ImplDecorator, ImplTypeEnum, IncomingHttpHeaders, IndexOptions, IndexParams, IndexStoreType, IndexType, InitTypeQualifierAttribute, InjectConstructor, InjectConstructorInfo, InjectConstructorProto, InjectObject, InjectObjectDescriptor, InjectObjectInfo, InjectObjectProto, InjectParams, InjectType, InlineModuleReferenceConfig, InputContentPart, InputMessage, InsertMethod, IntParams, IntervalParams, IntervalScheduleParams, InvalidRunStateTransitionError, JsonParams, LifecycleContext, LifecycleHook, LifecycleHookName, LifecycleObject, Line, LinestringParams, LoadUnit, LoadUnitCreator, LoadUnitInstance, LoadUnitInstanceLifecycleContext, LoadUnitLifecycleContext, LoadUnitNameQualifierAttribute, LoadUnitPair, Loader, Logger, LongBlobParams, LongTextParams, MCPControllerParams, MCPPromptParams, MCPPromptResponse, MCPProtocols, MCPResourceParams, MCPResourceResponse, MCPResourceTemplateParams, MCPResourceUriParams, MCPToolParams, MCPToolResponse, METHOD_ACL, METHOD_AOP_MIDDLEWARES, METHOD_AOP_REGISTER_MAP, METHOD_CONTEXT_INDEX, METHOD_CONTROLLER_HOST, METHOD_CONTROLLER_TYPE_MAP, METHOD_MIDDLEWARES, METHOD_TIMEOUT_METADATA, MODEL_DATA_ATTRIBUTES, MODEL_DATA_INDICES, MODEL_DATA_SOURCE, MODEL_DATA_TABLE_NAME, MODEL_PROTO_IMPL_TYPE, MediumBlobParams, MediumIntParams, MediumTextParams, MetaDataKey, MethodMeta, MethodType, MethodTypeLike, MiddlewareFunc, ModelAttributeInfo, ModelIndexInfo, ModelParams, ModuleConfig, ModuleConfigHolder, ModuleReference, ModuleReferenceConfig, MultiInstancePrototypeCallbackParams, MultiInstancePrototypeGetObjectsContext, MultiInstancePrototypeParams, MultiInstancePrototypeStaticParams, MultiInstanceType, MultiLine, MultiLinestringParams, MultiPoint, MultiPointParams, MultiPolygon, MultiPolygonParams, NameCrosscutParam, Next, NpmModuleReferenceConfig, ObjectInfo, ObjectInitType, ObjectInitTypeLike, ObjectStorageClient, POINTCUT_ADVICE_INFO_LIAR, PROPERTY_QUALIFIER_META_DATA, PaginateData, Point, PointParams, PointcutInfo, PointcutOptions, PointcutType, Polygon, PolygonParams, PromptArgs, PromptExtra, PropagationType, ProtoDescriptor, ProtoDescriptorType, ProtoDescriptorTypeLike, PrototypeParams, QUALIFIER_IMPL_MAP, QUALIFIER_META_DATA, QualifierAttribute, QualifierInfo, QualifierValue, ReadModuleReferenceOptions, ResourceExtra, ResourceVariables, RowFormat, RunObject, RunRecord, RunStatus, RuntimeConfig, SCHEDULE_METADATA, SCHEDULE_OPTIONS, SCHEDULE_PARAMS, SDKAssistantMessage, SDKGenericMessage, SDKResultMessage, SDKStreamEvent, SDKSystemMessage, SDKUserMessage, ScheduleOptions, ScheduleParams, ScheduleSubscriber, ScheduleType, ScheduleTypeLike, SetParams, SingletonProtoParams, SmallIntParams, SqlMap, SqlType, StreamEvent, TRANSACTION_META_DATA, TableParams, TeggScope, TeggScopeBag, Templates, TextInputContentPart, TextParams, ThreadObject, ThreadObjectWithMessages, ThreadRecord, TimeParams, TimestampParams, TinyBlobParams, TinyIntParams, TinyTextParams, ToolArgs, ToolExtra, ToolResultInputContentPart, ToolUseInputContentPart, TransactionMetadata, TransactionalParams, VarBinaryParams, VarCharParams, YearParams };
|
package/dist/index.js
CHANGED
|
@@ -32,10 +32,12 @@ import { ProtoDescriptorType } from "./metadata/enum/ProtoDescriptorType.js";
|
|
|
32
32
|
import "./metadata/index.js";
|
|
33
33
|
import { IS_MODEL, MODEL_DATA_ATTRIBUTES, MODEL_DATA_INDICES, MODEL_DATA_SOURCE, MODEL_DATA_TABLE_NAME, MODEL_PROTO_IMPL_TYPE } from "./orm.js";
|
|
34
34
|
import { EggObjectStatus } from "./runtime/model/EggObject.js";
|
|
35
|
+
import { TeggScope } from "./scope/TeggScope.js";
|
|
36
|
+
import "./scope/index.js";
|
|
35
37
|
import { IS_SCHEDULE, SCHEDULE_METADATA, SCHEDULE_OPTIONS, SCHEDULE_PARAMS, ScheduleType } from "./schedule.js";
|
|
36
38
|
import { IS_TRANSACTION_CLAZZ, PropagationType, TRANSACTION_META_DATA } from "./transaction.js";
|
|
37
39
|
import { AgentObjectType, RunStatus } from "./agent-runtime/AgentStore.js";
|
|
38
40
|
import { AgentErrorCode } from "./agent-runtime/AgentRuntime.js";
|
|
39
41
|
import { AgentConflictError, AgentInvalidRequestError, AgentNotFoundError, AgentTimeoutError, InvalidRunStateTransitionError } from "./agent-runtime/errors.js";
|
|
40
42
|
|
|
41
|
-
export { AGENT_CONTROLLER_PROTO_IMPL_TYPE, ASPECT_LIST, AccessLevel, AgentConflictError, AgentErrorCode, AgentInvalidRequestError, AgentNotFoundError, AgentObjectType, AgentTimeoutError, CONSTRUCTOR_QUALIFIER_META_DATA, CONTROLLER_ACL, CONTROLLER_AGENT_CONTROLLER, CONTROLLER_AGENT_ENHANCED, CONTROLLER_AGENT_NOT_IMPLEMENTED, CONTROLLER_AOP_MIDDLEWARES, CONTROLLER_HOST, CONTROLLER_HTTP_PATH, CONTROLLER_MCP_CONTROLLER_PARAMS_MAP, CONTROLLER_MCP_EXTRA_INDEX, CONTROLLER_MCP_NAME, CONTROLLER_MCP_PROMPT_ARGS_INDEX, CONTROLLER_MCP_PROMPT_MAP, CONTROLLER_MCP_PROMPT_PARAMS_MAP, CONTROLLER_MCP_RESOURCE_MAP, CONTROLLER_MCP_RESOURCE_PARAMS_MAP, CONTROLLER_MCP_TOOL_ARGS_INDEX, CONTROLLER_MCP_TOOL_MAP, CONTROLLER_MCP_TOOL_PARAMS_MAP, CONTROLLER_MCP_VERSION, CONTROLLER_META_DATA, CONTROLLER_METHOD_METHOD_MAP, CONTROLLER_METHOD_PARAM_NAME_MAP, CONTROLLER_METHOD_PARAM_TYPE_MAP, CONTROLLER_METHOD_PATH_MAP, CONTROLLER_METHOD_PRIORITY, CONTROLLER_MIDDLEWARES, CONTROLLER_NAME, CONTROLLER_TIMEOUT_METADATA, CONTROLLER_TYPE, CROSSCUT_INFO_LIST, ColumnFormat, ColumnType, CompressionType, ConfigSourceQualifierAttribute, ControllerType, DAL_COLUMN_INFO_MAP, DAL_COLUMN_TYPE_MAP, DAL_INDEX_LIST, DAL_IS_DAO, DAL_IS_TABLE, DAL_TABLE_PARAMS, DEFAULT_PROTO_IMPL_TYPE, DataSourceInjectName, DataSourceQualifierAttribute, EggLoadUnitType, EggObjectStatus, EggQualifierAttribute, EggType, ErrorCodes, HTTPMethodEnum, HTTPParamType, INIT_TYPE_TRY_ORDER, IS_CROSSCUT_ADVICE, IS_MODEL, IS_SCHEDULE, IS_TRANSACTION_CLAZZ, IndexStoreType, IndexType, InitTypeQualifierAttribute, InjectType, InsertMethod, InvalidRunStateTransitionError, LoadUnitNameQualifierAttribute, MCPProtocols, METHOD_ACL, METHOD_AOP_MIDDLEWARES, METHOD_AOP_REGISTER_MAP, METHOD_CONTEXT_INDEX, METHOD_CONTROLLER_HOST, METHOD_CONTROLLER_TYPE_MAP, METHOD_MIDDLEWARES, METHOD_TIMEOUT_METADATA, MODEL_DATA_ATTRIBUTES, MODEL_DATA_INDICES, MODEL_DATA_SOURCE, MODEL_DATA_TABLE_NAME, MODEL_PROTO_IMPL_TYPE, MethodType, MultiInstanceType, ObjectInitType, POINTCUT_ADVICE_INFO_LIAR, PROPERTY_QUALIFIER_META_DATA, PointcutType, PropagationType, ProtoDescriptorType, QUALIFIER_IMPL_MAP, QUALIFIER_META_DATA, RowFormat, RunStatus, SCHEDULE_METADATA, SCHEDULE_OPTIONS, SCHEDULE_PARAMS, ScheduleType, SqlType, TRANSACTION_META_DATA, Templates };
|
|
43
|
+
export { AGENT_CONTROLLER_PROTO_IMPL_TYPE, ASPECT_LIST, AccessLevel, AgentConflictError, AgentErrorCode, AgentInvalidRequestError, AgentNotFoundError, AgentObjectType, AgentTimeoutError, CONSTRUCTOR_QUALIFIER_META_DATA, CONTROLLER_ACL, CONTROLLER_AGENT_CONTROLLER, CONTROLLER_AGENT_ENHANCED, CONTROLLER_AGENT_NOT_IMPLEMENTED, CONTROLLER_AOP_MIDDLEWARES, CONTROLLER_HOST, CONTROLLER_HTTP_PATH, CONTROLLER_MCP_CONTROLLER_PARAMS_MAP, CONTROLLER_MCP_EXTRA_INDEX, CONTROLLER_MCP_NAME, CONTROLLER_MCP_PROMPT_ARGS_INDEX, CONTROLLER_MCP_PROMPT_MAP, CONTROLLER_MCP_PROMPT_PARAMS_MAP, CONTROLLER_MCP_RESOURCE_MAP, CONTROLLER_MCP_RESOURCE_PARAMS_MAP, CONTROLLER_MCP_TOOL_ARGS_INDEX, CONTROLLER_MCP_TOOL_MAP, CONTROLLER_MCP_TOOL_PARAMS_MAP, CONTROLLER_MCP_VERSION, CONTROLLER_META_DATA, CONTROLLER_METHOD_METHOD_MAP, CONTROLLER_METHOD_PARAM_NAME_MAP, CONTROLLER_METHOD_PARAM_TYPE_MAP, CONTROLLER_METHOD_PATH_MAP, CONTROLLER_METHOD_PRIORITY, CONTROLLER_MIDDLEWARES, CONTROLLER_NAME, CONTROLLER_TIMEOUT_METADATA, CONTROLLER_TYPE, CROSSCUT_INFO_LIST, ColumnFormat, ColumnType, CompressionType, ConfigSourceQualifierAttribute, ControllerType, DAL_COLUMN_INFO_MAP, DAL_COLUMN_TYPE_MAP, DAL_INDEX_LIST, DAL_IS_DAO, DAL_IS_TABLE, DAL_TABLE_PARAMS, DEFAULT_PROTO_IMPL_TYPE, DataSourceInjectName, DataSourceQualifierAttribute, EggLoadUnitType, EggObjectStatus, EggQualifierAttribute, EggType, ErrorCodes, HTTPMethodEnum, HTTPParamType, INIT_TYPE_TRY_ORDER, IS_CROSSCUT_ADVICE, IS_MODEL, IS_SCHEDULE, IS_TRANSACTION_CLAZZ, IndexStoreType, IndexType, InitTypeQualifierAttribute, InjectType, InsertMethod, InvalidRunStateTransitionError, LoadUnitNameQualifierAttribute, MCPProtocols, METHOD_ACL, METHOD_AOP_MIDDLEWARES, METHOD_AOP_REGISTER_MAP, METHOD_CONTEXT_INDEX, METHOD_CONTROLLER_HOST, METHOD_CONTROLLER_TYPE_MAP, METHOD_MIDDLEWARES, METHOD_TIMEOUT_METADATA, MODEL_DATA_ATTRIBUTES, MODEL_DATA_INDICES, MODEL_DATA_SOURCE, MODEL_DATA_TABLE_NAME, MODEL_PROTO_IMPL_TYPE, MethodType, MultiInstanceType, ObjectInitType, POINTCUT_ADVICE_INFO_LIAR, PROPERTY_QUALIFIER_META_DATA, PointcutType, PropagationType, ProtoDescriptorType, QUALIFIER_IMPL_MAP, QUALIFIER_META_DATA, RowFormat, RunStatus, SCHEDULE_METADATA, SCHEDULE_OPTIONS, SCHEDULE_PARAMS, ScheduleType, SqlType, TRANSACTION_META_DATA, TeggScope, Templates };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
//#region src/scope/TeggScope.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The per-app scope "bag": a type-free container keyed by per-package symbols.
|
|
4
|
+
*
|
|
5
|
+
* Each tegg package defines its own slot {@link symbol} and its own concrete
|
|
6
|
+
* fallback, and reads/writes ONLY its own slot. No package imports another
|
|
7
|
+
* package's slot — the bag is the single shared, type-agnostic carrier. The
|
|
8
|
+
* aggregating "TeggRuntime" convenience that knows the concrete types lives in a
|
|
9
|
+
* higher layer (plugin/tegg, standalone Runner) where importing metadata +
|
|
10
|
+
* runtime is legal; it builds the bag and wraps boot/request in
|
|
11
|
+
* {@link TeggScope.run}.
|
|
12
|
+
*/
|
|
13
|
+
type TeggScopeBag = Map<symbol, unknown>;
|
|
14
|
+
/**
|
|
15
|
+
* Type-free, lowest-level async scope container for tegg multi-app isolation.
|
|
16
|
+
*
|
|
17
|
+
* It owns ONLY the AsyncLocalStorage, the scope counter, and the strict-mode
|
|
18
|
+
* escape fuse. It knows nothing about concrete factories/managers — those are
|
|
19
|
+
* resolved by each package via {@link TeggScope.resolve} / {@link TeggScope.getOr}
|
|
20
|
+
* against its own slot.
|
|
21
|
+
*/
|
|
22
|
+
declare class TeggScope {
|
|
23
|
+
#private;
|
|
24
|
+
/** The bag for the currently active async scope, if any. */
|
|
25
|
+
static current(): TeggScopeBag | undefined;
|
|
26
|
+
/** Run `fn` with `bag` as the active scope. Synchronous or async `fn`. */
|
|
27
|
+
static run<R>(bag: TeggScopeBag, fn: () => R): R;
|
|
28
|
+
/**
|
|
29
|
+
* Run `fn` in `bag`'s scope when a bag is provided, otherwise run it directly
|
|
30
|
+
* in whatever scope is already active (the bag may not be established yet during
|
|
31
|
+
* very early boot). Centralizes the per-app `bag ? run(bag, fn) : fn()` idiom.
|
|
32
|
+
*/
|
|
33
|
+
static runMaybe<R>(bag: TeggScopeBag | undefined, fn: () => R): R;
|
|
34
|
+
/** Create a fresh, empty per-app bag. */
|
|
35
|
+
static createBag(): TeggScopeBag;
|
|
36
|
+
/**
|
|
37
|
+
* Mark that an explicit per-app scope has been established (boot), tracking the
|
|
38
|
+
* app's bag so that — while it is the sole live app — no-scope access resolves
|
|
39
|
+
* to it instead of a separate process-default bag.
|
|
40
|
+
*/
|
|
41
|
+
static registerScope(bag: TeggScopeBag): void;
|
|
42
|
+
/** Mark that a previously-established per-app scope has been torn down (close). */
|
|
43
|
+
static unregisterScope(bag: TeggScopeBag): void;
|
|
44
|
+
/** True when more than one app scope is alive — genuine multi-app mode. */
|
|
45
|
+
static get isMultiApp(): boolean;
|
|
46
|
+
/** Number of live explicit app scopes. */
|
|
47
|
+
static get scopeCount(): number;
|
|
48
|
+
/**
|
|
49
|
+
* Resolve a lazily-materialized per-app singleton (factory / manager / cache).
|
|
50
|
+
*
|
|
51
|
+
* - inside a scope: lazily create via `create()` and memoize in the active bag;
|
|
52
|
+
* - no scope: lazily create+memoize in the single process-default bag
|
|
53
|
+
* (single-app lazy default). Under multi-app, hitting the default bag is
|
|
54
|
+
* reported as an escape (dev throw / prod warn).
|
|
55
|
+
*
|
|
56
|
+
* `create()` may reference sibling slots' static facades (e.g. `X.instance`);
|
|
57
|
+
* because they resolve against the SAME bag, cross-slot dependencies stay
|
|
58
|
+
* consistent in both scoped and default modes.
|
|
59
|
+
*/
|
|
60
|
+
static resolve<T>(slot: symbol, create: () => T, desc: string): T;
|
|
61
|
+
/**
|
|
62
|
+
* Read a "set later, may be undefined" slot (e.g. globalGraph, context
|
|
63
|
+
* callbacks). The active bag (scoped, or the single process-default bag) is the
|
|
64
|
+
* source of truth; `legacy()` only supplies the initial value before any set.
|
|
65
|
+
*/
|
|
66
|
+
static getOr<T>(slot: symbol, legacy: () => T | undefined, desc: string): T | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Write a slot into the active bag (scoped, or the single process-default bag).
|
|
69
|
+
* Always succeeds; returns true for symmetry with earlier call sites.
|
|
70
|
+
*
|
|
71
|
+
* Like {@link TeggScope.resolve} / {@link TeggScope.getOr}, a write that escapes
|
|
72
|
+
* to the process-default bag under multi-app mode is reported, so a missed
|
|
73
|
+
* scope wrap that silently mutates shared state is caught instead of leaking.
|
|
74
|
+
*/
|
|
75
|
+
static set(slot: symbol, value: unknown): boolean;
|
|
76
|
+
/** @internal Reset the process-default bag (e.g. between tests). */
|
|
77
|
+
static _resetDefaultBag(): void;
|
|
78
|
+
/** @internal The current process-default bag, if any. */
|
|
79
|
+
static _getDefaultBag(): TeggScopeBag | undefined;
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
export { TeggScope, TeggScopeBag };
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
|
|
3
|
+
//#region src/scope/TeggScope.ts
|
|
4
|
+
const als = new AsyncLocalStorage();
|
|
5
|
+
/**
|
|
6
|
+
* Bags of the app scopes currently alive in the process. Each tegg app/Runner
|
|
7
|
+
* adds its bag at boot ({@link TeggScope.registerScope}) and removes it at close
|
|
8
|
+
* ({@link TeggScope.unregisterScope}).
|
|
9
|
+
*
|
|
10
|
+
* The set size is the live-app count that drives the strict-mode escape fuse:
|
|
11
|
+
* while MORE THAN ONE app is alive (true multi-app), falling back to the
|
|
12
|
+
* process-default bag is treated as a scope escape bug. When EXACTLY ONE app is
|
|
13
|
+
* alive, that app's bag is also the no-scope fallback (see {@link
|
|
14
|
+
* TeggScope.#fallbackBag}) — single-app code running outside an explicit
|
|
15
|
+
* {@link TeggScope.run} (direct singleton/ContextProto calls, detached loggers)
|
|
16
|
+
* resolves the very slots the app populated at boot, matching the pre-scoping
|
|
17
|
+
* process-global behavior. With a single app (or none) the silent lazy default
|
|
18
|
+
* is kept so existing single-app code and tests are unaffected.
|
|
19
|
+
*/
|
|
20
|
+
const liveScopeBags = /* @__PURE__ */ new Set();
|
|
21
|
+
/**
|
|
22
|
+
* Process-wide default bag, used when NO app scope is the active/sole storage,
|
|
23
|
+
* i.e. zero apps alive (pure tegg-core unit tests / standalone helpers) or, under
|
|
24
|
+
* multi-app, the escape path. Created on demand so every fallback slot lands in
|
|
25
|
+
* the SAME bag and stays cross-consistent (e.g. a factory created in the default
|
|
26
|
+
* bag references the lifecycle util also in the default bag). Tests may
|
|
27
|
+
* install/reset it explicitly.
|
|
28
|
+
*/
|
|
29
|
+
let defaultBag;
|
|
30
|
+
function isProduction() {
|
|
31
|
+
const serverEnv = process.env.EGG_SERVER_ENV;
|
|
32
|
+
if (serverEnv) return serverEnv === "prod";
|
|
33
|
+
return process.env.NODE_ENV === "production";
|
|
34
|
+
}
|
|
35
|
+
function reportEscape(desc) {
|
|
36
|
+
const err = /* @__PURE__ */ new Error(`[tegg] TeggScope escaped to the process-default bag under multi-app mode (${desc}). A per-app scope was expected but none is active — the access likely happened outside TeggScope.run(app scope, ...). This would cross-talk between apps.`);
|
|
37
|
+
if (!isProduction()) throw err;
|
|
38
|
+
console.warn(err.stack);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Type-free, lowest-level async scope container for tegg multi-app isolation.
|
|
42
|
+
*
|
|
43
|
+
* It owns ONLY the AsyncLocalStorage, the scope counter, and the strict-mode
|
|
44
|
+
* escape fuse. It knows nothing about concrete factories/managers — those are
|
|
45
|
+
* resolved by each package via {@link TeggScope.resolve} / {@link TeggScope.getOr}
|
|
46
|
+
* against its own slot.
|
|
47
|
+
*/
|
|
48
|
+
var TeggScope = class TeggScope {
|
|
49
|
+
/** The bag for the currently active async scope, if any. */
|
|
50
|
+
static current() {
|
|
51
|
+
return als.getStore();
|
|
52
|
+
}
|
|
53
|
+
/** Run `fn` with `bag` as the active scope. Synchronous or async `fn`. */
|
|
54
|
+
static run(bag, fn) {
|
|
55
|
+
return als.run(bag, fn);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Run `fn` in `bag`'s scope when a bag is provided, otherwise run it directly
|
|
59
|
+
* in whatever scope is already active (the bag may not be established yet during
|
|
60
|
+
* very early boot). Centralizes the per-app `bag ? run(bag, fn) : fn()` idiom.
|
|
61
|
+
*/
|
|
62
|
+
static runMaybe(bag, fn) {
|
|
63
|
+
return bag ? als.run(bag, fn) : fn();
|
|
64
|
+
}
|
|
65
|
+
/** Create a fresh, empty per-app bag. */
|
|
66
|
+
static createBag() {
|
|
67
|
+
return /* @__PURE__ */ new Map();
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Mark that an explicit per-app scope has been established (boot), tracking the
|
|
71
|
+
* app's bag so that — while it is the sole live app — no-scope access resolves
|
|
72
|
+
* to it instead of a separate process-default bag.
|
|
73
|
+
*/
|
|
74
|
+
static registerScope(bag) {
|
|
75
|
+
liveScopeBags.add(bag);
|
|
76
|
+
}
|
|
77
|
+
/** Mark that a previously-established per-app scope has been torn down (close). */
|
|
78
|
+
static unregisterScope(bag) {
|
|
79
|
+
liveScopeBags.delete(bag);
|
|
80
|
+
}
|
|
81
|
+
/** True when more than one app scope is alive — genuine multi-app mode. */
|
|
82
|
+
static get isMultiApp() {
|
|
83
|
+
return liveScopeBags.size > 1;
|
|
84
|
+
}
|
|
85
|
+
/** Number of live explicit app scopes. */
|
|
86
|
+
static get scopeCount() {
|
|
87
|
+
return liveScopeBags.size;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The bag used when NO ALS scope is active. With exactly one app alive, that
|
|
91
|
+
* app's bag is the single-app effective storage, so out-of-scope access sees
|
|
92
|
+
* the slots boot populated. Zero apps (pure unit tests / standalone helpers) —
|
|
93
|
+
* or, under multi-app, the reported escape path — use the process-default bag.
|
|
94
|
+
*/
|
|
95
|
+
static #fallbackBag() {
|
|
96
|
+
if (liveScopeBags.size === 1) for (const bag of liveScopeBags) return bag;
|
|
97
|
+
return defaultBag ??= /* @__PURE__ */ new Map();
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Resolve a lazily-materialized per-app singleton (factory / manager / cache).
|
|
101
|
+
*
|
|
102
|
+
* - inside a scope: lazily create via `create()` and memoize in the active bag;
|
|
103
|
+
* - no scope: lazily create+memoize in the single process-default bag
|
|
104
|
+
* (single-app lazy default). Under multi-app, hitting the default bag is
|
|
105
|
+
* reported as an escape (dev throw / prod warn).
|
|
106
|
+
*
|
|
107
|
+
* `create()` may reference sibling slots' static facades (e.g. `X.instance`);
|
|
108
|
+
* because they resolve against the SAME bag, cross-slot dependencies stay
|
|
109
|
+
* consistent in both scoped and default modes.
|
|
110
|
+
*/
|
|
111
|
+
static resolve(slot, create, desc) {
|
|
112
|
+
const bag = als.getStore();
|
|
113
|
+
if (bag) return TeggScope.#getOrCreate(bag, slot, create);
|
|
114
|
+
if (TeggScope.isMultiApp) reportEscape(desc);
|
|
115
|
+
return TeggScope.#getOrCreate(TeggScope.#fallbackBag(), slot, create);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Read a "set later, may be undefined" slot (e.g. globalGraph, context
|
|
119
|
+
* callbacks). The active bag (scoped, or the single process-default bag) is the
|
|
120
|
+
* source of truth; `legacy()` only supplies the initial value before any set.
|
|
121
|
+
*/
|
|
122
|
+
static getOr(slot, legacy, desc) {
|
|
123
|
+
const bag = als.getStore();
|
|
124
|
+
if (bag) return bag.has(slot) ? bag.get(slot) : legacy();
|
|
125
|
+
if (TeggScope.isMultiApp) reportEscape(desc);
|
|
126
|
+
const d = TeggScope.#fallbackBag();
|
|
127
|
+
return d.has(slot) ? d.get(slot) : legacy();
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Write a slot into the active bag (scoped, or the single process-default bag).
|
|
131
|
+
* Always succeeds; returns true for symmetry with earlier call sites.
|
|
132
|
+
*
|
|
133
|
+
* Like {@link TeggScope.resolve} / {@link TeggScope.getOr}, a write that escapes
|
|
134
|
+
* to the process-default bag under multi-app mode is reported, so a missed
|
|
135
|
+
* scope wrap that silently mutates shared state is caught instead of leaking.
|
|
136
|
+
*/
|
|
137
|
+
static set(slot, value) {
|
|
138
|
+
const bag = als.getStore();
|
|
139
|
+
if (bag) {
|
|
140
|
+
bag.set(slot, value);
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
if (TeggScope.isMultiApp) reportEscape(slot.toString());
|
|
144
|
+
TeggScope.#fallbackBag().set(slot, value);
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
/** @internal Reset the process-default bag (e.g. between tests). */
|
|
148
|
+
static _resetDefaultBag() {
|
|
149
|
+
defaultBag = void 0;
|
|
150
|
+
}
|
|
151
|
+
/** @internal The current process-default bag, if any. */
|
|
152
|
+
static _getDefaultBag() {
|
|
153
|
+
return defaultBag;
|
|
154
|
+
}
|
|
155
|
+
static #getOrCreate(bag, slot, create) {
|
|
156
|
+
if (!bag.has(slot)) bag.set(slot, create());
|
|
157
|
+
return bag.get(slot);
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
//#endregion
|
|
162
|
+
export { TeggScope };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eggjs/tegg-types",
|
|
3
|
-
"version": "4.0.2-beta.
|
|
3
|
+
"version": "4.0.2-beta.17",
|
|
4
4
|
"description": "tegg types",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"egg",
|
|
@@ -124,6 +124,8 @@
|
|
|
124
124
|
"./runtime/model/EggObject": "./dist/runtime/model/EggObject.js",
|
|
125
125
|
"./runtime/model/LoadUnitInstance": "./dist/runtime/model/LoadUnitInstance.js",
|
|
126
126
|
"./schedule": "./dist/schedule.js",
|
|
127
|
+
"./scope": "./dist/scope/index.js",
|
|
128
|
+
"./scope/TeggScope": "./dist/scope/TeggScope.js",
|
|
127
129
|
"./transaction": "./dist/transaction.js",
|
|
128
130
|
"./package.json": "./package.json"
|
|
129
131
|
},
|
|
@@ -136,10 +138,10 @@
|
|
|
136
138
|
"devDependencies": {
|
|
137
139
|
"@types/node": "^24.10.2",
|
|
138
140
|
"typescript": "^5.9.3",
|
|
139
|
-
"egg": "4.1.2-beta.
|
|
141
|
+
"egg": "4.1.2-beta.17"
|
|
140
142
|
},
|
|
141
143
|
"peerDependencies": {
|
|
142
|
-
"egg": "4.1.2-beta.
|
|
144
|
+
"egg": "4.1.2-beta.17"
|
|
143
145
|
},
|
|
144
146
|
"engines": {
|
|
145
147
|
"node": ">=22.18.0"
|