@midwayjs/core 3.0.0-alpha.36 → 3.0.0-alpha.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,17 +4,17 @@ exports.MidwayContainer = void 0;
4
4
  const decorator_1 = require("@midwayjs/decorator");
5
5
  const configuration_1 = require("../functional/configuration");
6
6
  const util = require("util");
7
- const definitionRegistry_1 = require("./definitionRegistry");
7
+ const applicationContext_1 = require("./applicationContext");
8
8
  const interface_1 = require("../interface");
9
+ const reflectTool_1 = require("../common/reflectTool");
9
10
  const constants_1 = require("../common/constants");
10
11
  const objectDefinition_1 = require("../definitions/objectDefinition");
11
12
  const functionDefinition_1 = require("../definitions/functionDefinition");
13
+ const managed_1 = require("./managed");
12
14
  const resolverHandler_1 = require("./resolverHandler");
13
15
  const environmentService_1 = require("../service/environmentService");
14
16
  const configService_1 = require("../service/configService");
15
17
  const aspectService_1 = require("../service/aspectService");
16
- const managedResolverFactory_1 = require("./managedResolverFactory");
17
- const notFoundError_1 = require("../common/notFoundError");
18
18
  const debug = util.debuglog('midway:container:configuration');
19
19
  const globalDebugLogger = util.debuglog('midway:container');
20
20
  class ContainerConfiguration {
@@ -44,14 +44,19 @@ class ContainerConfiguration {
44
44
  configurationOptions.namespace !== undefined) {
45
45
  this.namespace = configurationOptions.namespace;
46
46
  }
47
+ // if (i === 0 && this.namespace === MAIN_MODULE_KEY) {
48
+ // // set conflictCheck
49
+ // if (configurationOptions.conflictCheck === undefined) {
50
+ // configurationOptions.conflictCheck = false;
51
+ // }
52
+ // this.container.disableConflictCheck =
53
+ // !configurationOptions.conflictCheck;
54
+ // }
47
55
  this.addImports(configurationOptions.imports);
48
- this.addImportObjects(configurationOptions.importObjects);
49
56
  this.addImportConfigs(configurationOptions.importConfigs);
50
57
  this.bindConfigurationClass(configurationExport);
51
58
  }
52
59
  }
53
- // bind module
54
- this.container.bindClass(module, this.namespace);
55
60
  }
56
61
  addImportConfigs(importConfigs) {
57
62
  if (importConfigs && importConfigs.length) {
@@ -69,7 +74,7 @@ class ContainerConfiguration {
69
74
  importPackage = require(importPackage);
70
75
  }
71
76
  // for package
72
- const subContainerConfiguration = new ContainerConfiguration(this.container);
77
+ const subContainerConfiguration = this.container.createConfiguration();
73
78
  if ('Configuration' in importPackage) {
74
79
  // component is object
75
80
  debug('\n---------- start load configuration from submodule" ----------');
@@ -86,28 +91,15 @@ class ContainerConfiguration {
86
91
  }
87
92
  }
88
93
  }
89
- /**
90
- * 注册 importObjects
91
- * @param objs configuration 中的 importObjects
92
- */
93
- addImportObjects(objs) {
94
- if (objs) {
95
- const keys = Object.keys(objs);
96
- for (const key of keys) {
97
- if (typeof objs[key] !== undefined) {
98
- this.container.registerObject(key, objs[key]);
99
- }
100
- }
101
- }
102
- }
103
94
  bindConfigurationClass(clzz, filePath) {
104
95
  if (clzz instanceof configuration_1.FunctionalConfiguration) {
105
96
  // 函数式写法不需要绑定到容器
106
97
  }
107
98
  else {
108
99
  // 普通类写法
109
- (0, decorator_1.saveProviderId)(undefined, clzz);
110
- const id = (0, decorator_1.getProviderUUId)(clzz);
100
+ const clzzName = `${decorator_1.LIFECYCLE_IDENTIFIER_PREFIX}${(0, decorator_1.classNamed)(clzz.name)}`;
101
+ const id = (0, decorator_1.generateProvideId)(clzzName, this.namespace);
102
+ (0, decorator_1.saveProviderId)(id, clzz, true);
111
103
  this.container.bind(id, clzz, {
112
104
  namespace: this.namespace,
113
105
  srcPath: filePath,
@@ -146,48 +138,23 @@ class ContainerConfiguration {
146
138
  return mods;
147
139
  }
148
140
  }
149
- class MidwayContainer {
150
- constructor(parent) {
151
- this._resolverFactory = null;
152
- this._registry = null;
153
- this._identifierMapping = null;
154
- this.parent = null;
141
+ class MidwayContainer extends applicationContext_1.BaseApplicationContext {
142
+ constructor() {
143
+ super(...arguments);
155
144
  this.debugLogger = globalDebugLogger;
145
+ this.definitionMetadataList = [];
156
146
  // 仅仅用于兼容requestContainer的ctx
157
147
  this.ctx = {};
158
148
  this.attrMap = new Map();
159
149
  this.isLoad = false;
160
- this.parent = parent;
161
- this.init();
162
150
  }
163
151
  init() {
164
152
  this.initService();
165
- this.resolverHandler = new resolverHandler_1.ResolverHandler(this, this.managedResolverFactory);
153
+ this.resolverHandler = new resolverHandler_1.ResolverHandler(this, this.getManagedResolverFactory());
166
154
  // 防止直接从applicationContext.getAsync or get对象实例时依赖当前上下文信息出错
167
155
  // ctx is in requestContainer
168
156
  this.registerObject(interface_1.REQUEST_CTX_KEY, this.ctx);
169
157
  }
170
- get registry() {
171
- if (!this._registry) {
172
- this._registry = new definitionRegistry_1.ObjectDefinitionRegistry();
173
- }
174
- return this._registry;
175
- }
176
- set registry(registry) {
177
- this._registry = registry;
178
- }
179
- get managedResolverFactory() {
180
- if (!this._resolverFactory) {
181
- this._resolverFactory = new managedResolverFactory_1.ManagedResolverFactory(this);
182
- }
183
- return this._resolverFactory;
184
- }
185
- get identifierMapping() {
186
- if (!this._identifierMapping) {
187
- this._identifierMapping = this.registry.getIdentifierRelation();
188
- }
189
- return this._identifierMapping;
190
- }
191
158
  initService() {
192
159
  this.environmentService = new environmentService_1.MidwayEnvironmentService();
193
160
  this.configService = new configService_1.MidwayConfigService(this);
@@ -197,7 +164,7 @@ class MidwayContainer {
197
164
  this.isLoad = true;
198
165
  if (module) {
199
166
  // load configuration
200
- const configuration = new ContainerConfiguration(this);
167
+ const configuration = this.createConfiguration();
201
168
  configuration.load(module);
202
169
  }
203
170
  // register base config hook
@@ -222,91 +189,206 @@ class MidwayContainer {
222
189
  // init config service
223
190
  this.configService.load();
224
191
  }
192
+ createConfiguration() {
193
+ return new ContainerConfiguration(this);
194
+ }
225
195
  bindClass(exports, namespace = '', filePath) {
226
196
  if ((0, decorator_1.isClass)(exports) || (0, decorator_1.isFunction)(exports)) {
227
- this.bindModule(exports, {
228
- namespace,
229
- srcPath: filePath,
230
- });
197
+ this.bindModule(exports, namespace, filePath);
231
198
  }
232
199
  else {
233
200
  for (const m in exports) {
234
201
  const module = exports[m];
235
202
  if ((0, decorator_1.isClass)(module) || (0, decorator_1.isFunction)(module)) {
236
- this.bindModule(module, {
237
- namespace,
238
- srcPath: filePath,
239
- });
203
+ this.bindModule(module, namespace, filePath);
240
204
  }
241
205
  }
242
206
  }
243
207
  }
244
208
  bind(identifier, target, options) {
245
209
  var _a;
210
+ const definitionMeta = {};
211
+ this.definitionMetadataList.push(definitionMeta);
246
212
  if ((0, decorator_1.isClass)(identifier) || (0, decorator_1.isFunction)(identifier)) {
247
- return this.bindModule(identifier, target);
213
+ options = target;
214
+ target = identifier;
215
+ identifier = (0, decorator_1.getProviderId)(target);
248
216
  }
249
- if (this.registry.hasDefinition(identifier)) {
250
- // 如果 definition 存在就不再重复 bind
251
- return;
252
- }
253
- let definition;
254
217
  if ((0, decorator_1.isClass)(target)) {
255
- definition = new objectDefinition_1.ObjectDefinition();
218
+ definitionMeta.definitionType = 'object';
256
219
  }
257
220
  else {
258
- definition = new functionDefinition_1.FunctionDefinition();
221
+ definitionMeta.definitionType = 'function';
259
222
  if (!(0, decorator_1.isAsyncFunction)(target)) {
260
- definition.asynchronous = false;
223
+ definitionMeta.asynchronous = false;
261
224
  }
262
225
  }
263
- definition.path = target;
264
- definition.id = identifier;
265
- definition.srcPath = (options === null || options === void 0 ? void 0 : options.srcPath) || null;
266
- definition.namespace = (options === null || options === void 0 ? void 0 : options.namespace) || '';
267
- definition.scope = (options === null || options === void 0 ? void 0 : options.scope) || decorator_1.ScopeEnum.Request;
268
- this.debugLogger(` bind id => [${definition.id}]`);
269
- // inject properties
270
- const props = (0, decorator_1.getPropertyInject)(target);
271
- for (const p in props) {
272
- const propertyMeta = props[p];
273
- this.debugLogger(` inject properties => [${propertyMeta}]`);
274
- const refManaged = new managedResolverFactory_1.ManagedReference();
275
- refManaged.args = propertyMeta.args;
276
- refManaged.name = propertyMeta.value;
277
- definition.properties.set(propertyMeta['targetKey'], refManaged);
226
+ definitionMeta.path = target;
227
+ definitionMeta.id = identifier;
228
+ definitionMeta.srcPath = (options === null || options === void 0 ? void 0 : options.srcPath) || null;
229
+ definitionMeta.namespace = (options === null || options === void 0 ? void 0 : options.namespace) || '';
230
+ definitionMeta.scope = (options === null || options === void 0 ? void 0 : options.scope) || decorator_1.ScopeEnum.Request;
231
+ definitionMeta.autowire = (options === null || options === void 0 ? void 0 : options.isAutowire) !== false;
232
+ this.debugLogger(` bind id => [${definitionMeta.id}]`);
233
+ // inject constructArgs
234
+ const constructorMetaData = (0, decorator_1.getConstructorInject)(target);
235
+ if (constructorMetaData) {
236
+ this.debugLogger(`inject constructor => length = ${target['length']}`);
237
+ definitionMeta.constructorArgs = [];
238
+ const maxLength = Math.max.apply(null, Object.keys(constructorMetaData));
239
+ for (let i = 0; i < maxLength + 1; i++) {
240
+ const propertyMeta = constructorMetaData[i];
241
+ if (propertyMeta) {
242
+ definitionMeta.constructorArgs.push({
243
+ type: 'ref',
244
+ value: propertyMeta[0].value,
245
+ args: propertyMeta[0].args,
246
+ });
247
+ }
248
+ else {
249
+ definitionMeta.constructorArgs.push({
250
+ type: 'value',
251
+ value: propertyMeta === null || propertyMeta === void 0 ? void 0 : propertyMeta[0].value,
252
+ });
253
+ }
254
+ }
278
255
  }
279
- // inject custom properties
280
- const customProps = (0, decorator_1.getClassExtendedMetadata)(decorator_1.INJECT_CUSTOM_TAG, target);
281
- for (const p in customProps) {
282
- const propertyMeta = customProps[p];
283
- definition.handlerProps.push({
284
- handlerKey: propertyMeta.key,
285
- prop: propertyMeta,
286
- });
256
+ // inject properties
257
+ const props = (0, reflectTool_1.recursiveGetPrototypeOf)(target);
258
+ props.push(target);
259
+ definitionMeta.properties = [];
260
+ definitionMeta.handlerProps = [];
261
+ for (const p of props) {
262
+ const metaData = (0, reflectTool_1.getOwnMetadata)(decorator_1.TAGGED_PROP, p);
263
+ if (metaData) {
264
+ this.debugLogger(` inject properties => [${Object.keys(metaData)}]`);
265
+ for (const metaKey in metaData) {
266
+ for (const propertyMeta of metaData[metaKey]) {
267
+ definitionMeta.properties.push({
268
+ metaKey,
269
+ args: propertyMeta.args,
270
+ value: propertyMeta.value,
271
+ });
272
+ }
273
+ }
274
+ }
275
+ const meta = (0, reflectTool_1.getOwnMetadata)(decorator_1.INJECT_CLASS_KEY_PREFIX, p);
276
+ if (meta) {
277
+ for (const [key, vals] of meta) {
278
+ if (Array.isArray(vals)) {
279
+ for (const val of vals) {
280
+ if (val.key !== undefined &&
281
+ val.key !== null &&
282
+ typeof val.propertyName === 'string') {
283
+ definitionMeta.handlerProps.push({
284
+ handlerKey: decorator_1.DecoratorManager.removeDecoratorClassKeySuffix(key),
285
+ prop: val,
286
+ });
287
+ }
288
+ }
289
+ }
290
+ }
291
+ }
287
292
  }
288
293
  // @async, @init, @destroy @scope
289
- const objDefOptions = (_a = (0, decorator_1.getObjectDefinition)(target)) !== null && _a !== void 0 ? _a : {};
294
+ const objDefOptions = (_a = (0, decorator_1.getObjectDefProps)(target)) !== null && _a !== void 0 ? _a : {};
290
295
  if (objDefOptions.initMethod) {
291
296
  this.debugLogger(` register initMethod = ${objDefOptions.initMethod}`);
292
- definition.initMethod = objDefOptions.initMethod;
297
+ definitionMeta.initMethod = objDefOptions.initMethod;
293
298
  }
294
299
  if (objDefOptions.destroyMethod) {
295
300
  this.debugLogger(` register destroyMethod = ${objDefOptions.destroyMethod}`);
296
- definition.destroyMethod = objDefOptions.destroyMethod;
301
+ definitionMeta.destroyMethod = objDefOptions.destroyMethod;
297
302
  }
298
303
  if (objDefOptions.scope) {
299
304
  this.debugLogger(` register scope = ${objDefOptions.scope}`);
300
- definition.scope = objDefOptions.scope;
305
+ definitionMeta.scope = objDefOptions.scope;
306
+ }
307
+ // 把源信息变成真正的对象定义
308
+ this.restoreDefinition(definitionMeta);
309
+ }
310
+ restoreDefinition(definitionMeta) {
311
+ let definition;
312
+ if (definitionMeta.definitionType === 'object') {
313
+ definition = new objectDefinition_1.ObjectDefinition();
314
+ }
315
+ else {
316
+ definition = new functionDefinition_1.FunctionDefinition();
317
+ if (!definitionMeta.asynchronous) {
318
+ definition.asynchronous = false;
319
+ }
320
+ }
321
+ definition.path = definitionMeta.path;
322
+ definition.id = definitionMeta.id;
323
+ definition.srcPath = definitionMeta.srcPath;
324
+ definition.namespace = definitionMeta.namespace;
325
+ this.debugLogger(` bind id => [${definition.id}]`);
326
+ // inject constructArgs
327
+ if (definitionMeta.constructorArgs &&
328
+ definitionMeta.constructorArgs.length) {
329
+ for (const constructorInfo of definitionMeta.constructorArgs) {
330
+ if (constructorInfo.type === 'ref') {
331
+ const refManagedIns = new managed_1.ManagedReference();
332
+ const name = constructorInfo.value;
333
+ refManagedIns.args = constructorInfo.args;
334
+ if (this.midwayIdentifiers.includes(name)) {
335
+ refManagedIns.name = name;
336
+ }
337
+ else {
338
+ refManagedIns.name = (0, decorator_1.generateProvideId)(name, definition.namespace);
339
+ }
340
+ definition.constructorArgs.push(refManagedIns);
341
+ }
342
+ else {
343
+ // inject empty value
344
+ const valueManagedIns = new managed_1.ManagedValue();
345
+ valueManagedIns.valueType = constructorInfo.type;
346
+ valueManagedIns.value = constructorInfo.value;
347
+ definition.constructorArgs.push(valueManagedIns);
348
+ }
349
+ }
350
+ }
351
+ // inject properties
352
+ for (const propertyMeta of definitionMeta.properties) {
353
+ const refManaged = new managed_1.ManagedReference();
354
+ refManaged.args = propertyMeta.args;
355
+ if (this.midwayIdentifiers.includes(propertyMeta.value)) {
356
+ refManaged.name = propertyMeta.value;
357
+ }
358
+ else {
359
+ refManaged.name = (0, decorator_1.generateProvideId)(propertyMeta.value, definition.namespace);
360
+ }
361
+ definition.properties.set(propertyMeta.metaKey, refManaged);
362
+ }
363
+ definition.asynchronous = definitionMeta.asynchronous;
364
+ definition.initMethod = definitionMeta.initMethod;
365
+ definition.destroyMethod = definitionMeta.destroyMethod;
366
+ definition.scope = definitionMeta.scope;
367
+ definition.autowire = definitionMeta.autowire;
368
+ definition.handlerProps = definitionMeta.handlerProps;
369
+ this.registerDefinition(definitionMeta.id, definition);
370
+ }
371
+ restoreDefinitions(definitionMetadataList) {
372
+ if (definitionMetadataList && definitionMetadataList.length) {
373
+ for (const definitionMeta of definitionMetadataList) {
374
+ this.restoreDefinition(definitionMeta);
375
+ }
301
376
  }
302
- this.registry.registerDefinition(definition.id, definition);
303
377
  }
304
- bindModule(module, options = {}) {
378
+ getDefinitionMetaList() {
379
+ return this.definitionMetadataList;
380
+ }
381
+ bindModule(module, namespace = '', filePath) {
305
382
  if ((0, decorator_1.isClass)(module)) {
306
- const providerId = (0, decorator_1.getProviderUUId)(module);
383
+ const providerId = (0, decorator_1.isProvide)(module) ? (0, decorator_1.getProviderId)(module) : null;
307
384
  if (providerId) {
308
- this.identifierMapping.saveClassRelation(module, options.namespace);
309
- this.bind(providerId, module, options);
385
+ if (namespace) {
386
+ (0, decorator_1.saveClassMetadata)(decorator_1.PRIVATE_META_DATA_KEY, { namespace, providerId, srcPath: filePath }, module);
387
+ }
388
+ this.bind((0, decorator_1.generateProvideId)(providerId, namespace), module, {
389
+ namespace,
390
+ srcPath: filePath,
391
+ });
310
392
  }
311
393
  else {
312
394
  // no provide or js class must be skip
@@ -318,12 +400,11 @@ class MidwayContainer {
318
400
  if (!info.scope) {
319
401
  info.scope = decorator_1.ScopeEnum.Request;
320
402
  }
321
- const uuid = (0, decorator_1.generateRandomId)();
322
- this.identifierMapping.saveFunctionRelation(info.id, uuid);
323
- this.bind(uuid, module, {
403
+ this.bind((0, decorator_1.generateProvideId)(info.id, namespace), module, {
324
404
  scope: info.scope,
325
- namespace: options.namespace,
326
- srcPath: options.srcPath,
405
+ isAutowire: info.isAutowire,
406
+ namespace,
407
+ srcPath: filePath,
327
408
  });
328
409
  }
329
410
  }
@@ -335,7 +416,7 @@ class MidwayContainer {
335
416
  this.fileDetector = fileDetector;
336
417
  }
337
418
  createChild() {
338
- return new MidwayContainer(this);
419
+ return new MidwayContainer('', this);
339
420
  }
340
421
  registerDataHandler(handlerType, handler) {
341
422
  this.resolverHandler.registerHandler(handlerType, handler);
@@ -367,80 +448,6 @@ class MidwayContainer {
367
448
  getAttr(key) {
368
449
  return this.attrMap.get(key);
369
450
  }
370
- getIdentifier(target) {
371
- return (0, decorator_1.getProviderUUId)(target);
372
- }
373
- findRegisterObject(identifier) {
374
- const ins = this.registry.getObject(identifier);
375
- return this.aspectService.wrapperAspectToInstance(ins);
376
- }
377
- getManagedResolverFactory() {
378
- if (!this._resolverFactory) {
379
- this._resolverFactory = new managedResolverFactory_1.ManagedResolverFactory(this);
380
- }
381
- return this._resolverFactory;
382
- }
383
- async stop() {
384
- await this.getManagedResolverFactory().destroyCache();
385
- this.registry.clearAll();
386
- }
387
- async ready() {
388
- await this.loadDefinitions();
389
- }
390
- get(identifier, args) {
391
- if (typeof identifier !== 'string') {
392
- identifier = this.getIdentifier(identifier);
393
- }
394
- if (this.registry.hasObject(identifier)) {
395
- return this.registry.getObject(identifier);
396
- }
397
- const definition = this.registry.getDefinition(identifier);
398
- if (!definition && this.parent) {
399
- return this.parent.get(identifier, args);
400
- }
401
- if (!definition) {
402
- throw new notFoundError_1.NotFoundError(identifier);
403
- }
404
- return this.getManagedResolverFactory().create({ definition, args });
405
- }
406
- async getAsync(identifier, args) {
407
- if (typeof identifier !== 'string') {
408
- identifier = this.getIdentifier(identifier);
409
- }
410
- if (this.registry.hasObject(identifier)) {
411
- return this.registry.getObject(identifier);
412
- }
413
- const definition = this.registry.getDefinition(identifier);
414
- if (!definition && this.parent) {
415
- return this.parent.getAsync(identifier, args);
416
- }
417
- if (!definition) {
418
- throw new notFoundError_1.NotFoundError(identifier);
419
- }
420
- return this.getManagedResolverFactory().createAsync({ definition, args });
421
- }
422
- /**
423
- * proxy registry.registerObject
424
- * @param {ObjectIdentifier} identifier
425
- * @param target
426
- */
427
- registerObject(identifier, target) {
428
- this.registry.registerObject(identifier, target);
429
- }
430
- /**
431
- * register handler after instance create
432
- * @param fn
433
- */
434
- afterEachCreated(fn) {
435
- this.managedResolverFactory.afterEachCreated(fn);
436
- }
437
- /**
438
- * register handler before instance create
439
- * @param fn
440
- */
441
- beforeEachCreated(fn) {
442
- this.managedResolverFactory.beforeEachCreated(fn);
443
- }
444
451
  }
445
452
  exports.MidwayContainer = MidwayContainer;
446
453
  //# sourceMappingURL=container.js.map
@@ -0,0 +1,45 @@
1
+ /**
2
+ * 用于抽象描述的属性、json、ref、set、map等内容
3
+ */
4
+ import { IManagedInstance } from '@midwayjs/decorator';
5
+ import { IObjectDefinition } from '../interface';
6
+ import { ObjectProperties } from '../definitions/properties';
7
+ export declare class ManagedValue implements IManagedInstance {
8
+ type: string;
9
+ value: any;
10
+ valueType: string;
11
+ constructor(value?: any, valueType?: string);
12
+ }
13
+ export declare class ManagedReference implements IManagedInstance {
14
+ type: string;
15
+ name: string;
16
+ args?: any;
17
+ }
18
+ export declare class ManagedJSON implements IManagedInstance {
19
+ type: string;
20
+ value: string;
21
+ }
22
+ export declare class ManagedList extends Array implements IManagedInstance {
23
+ type: string;
24
+ }
25
+ export declare class ManagedSet extends Set implements IManagedInstance {
26
+ type: string;
27
+ }
28
+ export declare class ManagedMap extends Map implements IManagedInstance {
29
+ type: string;
30
+ }
31
+ export declare class ManagedProperties extends ObjectProperties implements IManagedInstance {
32
+ type: string;
33
+ }
34
+ export declare class ManagedProperty implements IManagedInstance {
35
+ type: string;
36
+ name: string;
37
+ value: any;
38
+ valueType: string;
39
+ }
40
+ export declare class ManagedObject implements IManagedInstance {
41
+ type: string;
42
+ name: string;
43
+ definition: IObjectDefinition;
44
+ }
45
+ //# sourceMappingURL=managed.d.ts.map
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ /**
3
+ * 用于抽象描述的属性、json、ref、set、map等内容
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ManagedObject = exports.ManagedProperty = exports.ManagedProperties = exports.ManagedMap = exports.ManagedSet = exports.ManagedList = exports.ManagedJSON = exports.ManagedReference = exports.ManagedValue = void 0;
7
+ const properties_1 = require("../definitions/properties");
8
+ const constants_1 = require("../common/constants");
9
+ class ManagedValue {
10
+ constructor(value, valueType) {
11
+ this.type = constants_1.KEYS.VALUE_ELEMENT;
12
+ this.value = value;
13
+ this.valueType = valueType || constants_1.VALUE_TYPE.STRING;
14
+ }
15
+ }
16
+ exports.ManagedValue = ManagedValue;
17
+ class ManagedReference {
18
+ constructor() {
19
+ this.type = constants_1.KEYS.REF_ELEMENT;
20
+ }
21
+ }
22
+ exports.ManagedReference = ManagedReference;
23
+ class ManagedJSON {
24
+ constructor() {
25
+ this.type = constants_1.KEYS.JSON_ELEMENT;
26
+ }
27
+ }
28
+ exports.ManagedJSON = ManagedJSON;
29
+ class ManagedList extends Array {
30
+ constructor() {
31
+ super(...arguments);
32
+ this.type = constants_1.KEYS.LIST_ELEMENT;
33
+ }
34
+ }
35
+ exports.ManagedList = ManagedList;
36
+ class ManagedSet extends Set {
37
+ constructor() {
38
+ super(...arguments);
39
+ this.type = constants_1.KEYS.SET_ELEMENT;
40
+ }
41
+ }
42
+ exports.ManagedSet = ManagedSet;
43
+ class ManagedMap extends Map {
44
+ constructor() {
45
+ super(...arguments);
46
+ this.type = constants_1.KEYS.MAP_ELEMENT;
47
+ }
48
+ }
49
+ exports.ManagedMap = ManagedMap;
50
+ class ManagedProperties extends properties_1.ObjectProperties {
51
+ constructor() {
52
+ super(...arguments);
53
+ this.type = constants_1.KEYS.PROPS_ELEMENT;
54
+ }
55
+ }
56
+ exports.ManagedProperties = ManagedProperties;
57
+ class ManagedProperty {
58
+ constructor() {
59
+ this.type = constants_1.KEYS.PROPERTY_ELEMENT;
60
+ }
61
+ }
62
+ exports.ManagedProperty = ManagedProperty;
63
+ class ManagedObject {
64
+ constructor() {
65
+ this.type = constants_1.KEYS.OBJECT_ELEMENT;
66
+ }
67
+ }
68
+ exports.ManagedObject = ManagedObject;
69
+ //# sourceMappingURL=managed.js.map