@loopback/metadata 4.0.0-alpha.9 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +273 -150
  3. package/dist/decorator-factory.d.ts +297 -0
  4. package/{dist6/src → dist}/decorator-factory.js +197 -90
  5. package/dist/decorator-factory.js.map +1 -0
  6. package/dist/index.d.ts +22 -1
  7. package/dist/index.js +24 -7
  8. package/dist/index.js.map +1 -0
  9. package/dist/inspector.d.ts +120 -0
  10. package/dist/inspector.js +186 -0
  11. package/dist/inspector.js.map +1 -0
  12. package/dist/{src/reflect.d.ts → reflect.d.ts} +16 -15
  13. package/dist/{src/reflect.js → reflect.js} +7 -8
  14. package/dist/reflect.js.map +1 -0
  15. package/dist/types.d.ts +70 -0
  16. package/dist/types.js +32 -0
  17. package/dist/types.js.map +1 -0
  18. package/package.json +43 -44
  19. package/src/decorator-factory.ts +289 -140
  20. package/src/index.ts +22 -2
  21. package/src/inspector.ts +118 -126
  22. package/src/reflect.ts +32 -21
  23. package/src/types.ts +94 -0
  24. package/CHANGELOG.md +0 -99
  25. package/api-docs/apple-touch-icon-114x114-precomposed.png +0 -0
  26. package/api-docs/apple-touch-icon-144x144-precomposed.png +0 -0
  27. package/api-docs/apple-touch-icon-57x57-precomposed.png +0 -0
  28. package/api-docs/apple-touch-icon-72x72-precomposed.png +0 -0
  29. package/api-docs/apple-touch-icon-precomposed.png +0 -0
  30. package/api-docs/apple-touch-icon.png +0 -0
  31. package/api-docs/css/bootstrap.min.css +0 -9
  32. package/api-docs/css/code-themes/arta.css +0 -158
  33. package/api-docs/css/code-themes/ascetic.css +0 -50
  34. package/api-docs/css/code-themes/brown_paper.css +0 -104
  35. package/api-docs/css/code-themes/brown_papersq.png +0 -0
  36. package/api-docs/css/code-themes/dark.css +0 -103
  37. package/api-docs/css/code-themes/default.css +0 -135
  38. package/api-docs/css/code-themes/far.css +0 -111
  39. package/api-docs/css/code-themes/github.css +0 -127
  40. package/api-docs/css/code-themes/googlecode.css +0 -144
  41. package/api-docs/css/code-themes/idea.css +0 -121
  42. package/api-docs/css/code-themes/ir_black.css +0 -104
  43. package/api-docs/css/code-themes/magula.css +0 -121
  44. package/api-docs/css/code-themes/monokai.css +0 -114
  45. package/api-docs/css/code-themes/pojoaque.css +0 -104
  46. package/api-docs/css/code-themes/pojoaque.jpg +0 -0
  47. package/api-docs/css/code-themes/rainbow.css +0 -114
  48. package/api-docs/css/code-themes/school_book.css +0 -111
  49. package/api-docs/css/code-themes/school_book.png +0 -0
  50. package/api-docs/css/code-themes/sl-theme.css +0 -45
  51. package/api-docs/css/code-themes/solarized_dark.css +0 -88
  52. package/api-docs/css/code-themes/solarized_light.css +0 -88
  53. package/api-docs/css/code-themes/sunburst.css +0 -158
  54. package/api-docs/css/code-themes/tomorrow-night-blue.css +0 -52
  55. package/api-docs/css/code-themes/tomorrow-night-bright.css +0 -51
  56. package/api-docs/css/code-themes/tomorrow-night-eighties.css +0 -51
  57. package/api-docs/css/code-themes/tomorrow-night.css +0 -52
  58. package/api-docs/css/code-themes/tomorrow.css +0 -49
  59. package/api-docs/css/code-themes/vs.css +0 -86
  60. package/api-docs/css/code-themes/xcode.css +0 -154
  61. package/api-docs/css/code-themes/zenburn.css +0 -115
  62. package/api-docs/css/main.css +0 -139
  63. package/api-docs/favicon.ico +0 -0
  64. package/api-docs/fonts/0ihfXUL2emPh0ROJezvraLO3LdcAZYWl9Si6vvxL-qU.woff +0 -0
  65. package/api-docs/fonts/OsJ2DjdpjqFRVUSto6IffLO3LdcAZYWl9Si6vvxL-qU.woff +0 -0
  66. package/api-docs/fonts/_aijTyevf54tkVDLy-dlnLO3LdcAZYWl9Si6vvxL-qU.woff +0 -0
  67. package/api-docs/index.html +0 -53
  68. package/api-docs/js/main.js +0 -19
  69. package/api-docs/js/vendor/bootstrap.min.js +0 -6
  70. package/api-docs/js/vendor/jquery-1.10.1.min.js +0 -6
  71. package/api-docs/js/vendor/jquery.scrollTo-1.4.3.1.js +0 -218
  72. package/api-docs/js/vendor/modernizr-2.6.2-respond-1.1.0.min.js +0 -11
  73. package/dist/src/decorator-factory.d.ts +0 -252
  74. package/dist/src/decorator-factory.js +0 -468
  75. package/dist/src/decorator-factory.js.map +0 -1
  76. package/dist/src/index.d.ts +0 -3
  77. package/dist/src/index.js +0 -13
  78. package/dist/src/index.js.map +0 -1
  79. package/dist/src/inspector.d.ts +0 -150
  80. package/dist/src/inspector.js +0 -163
  81. package/dist/src/inspector.js.map +0 -1
  82. package/dist/src/reflect.js.map +0 -1
  83. package/dist6/index.d.ts +0 -1
  84. package/dist6/index.js +0 -13
  85. package/dist6/src/decorator-factory.d.ts +0 -252
  86. package/dist6/src/decorator-factory.js.map +0 -1
  87. package/dist6/src/index.d.ts +0 -3
  88. package/dist6/src/index.js +0 -13
  89. package/dist6/src/index.js.map +0 -1
  90. package/dist6/src/inspector.d.ts +0 -150
  91. package/dist6/src/inspector.js +0 -163
  92. package/dist6/src/inspector.js.map +0 -1
  93. package/dist6/src/reflect.d.ts +0 -38
  94. package/dist6/src/reflect.js +0 -143
  95. package/dist6/src/reflect.js.map +0 -1
  96. package/index.d.ts +0 -6
  97. package/index.js +0 -7
@@ -1,163 +0,0 @@
1
- "use strict";
2
- // Copyright IBM Corp. 2017,2018. All Rights Reserved.
3
- // Node module: @loopback/metadata
4
- // This file is licensed under the MIT License.
5
- // License text available at https://opensource.org/licenses/MIT
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const reflect_1 = require("./reflect");
8
- /**
9
- * TypeScript reflector without a namespace. The TypeScript compiler can be
10
- * configured to add design time metadata.
11
- *
12
- * See https://www.typescriptlang.org/docs/handbook/decorators.html
13
- */
14
- const TSReflector = new reflect_1.NamespacedReflect();
15
- /**
16
- * Inspector for metadata applied by decorators
17
- */
18
- class MetadataInspector {
19
- /**
20
- * Get the metadata associated with the given key for a given class
21
- * @param key Metadata key
22
- * @param target Class that contains the metadata
23
- * @param options Options for inspection
24
- */
25
- static getClassMetadata(key, target, options) {
26
- return options && options.ownMetadataOnly
27
- ? reflect_1.Reflector.getOwnMetadata(key, target)
28
- : reflect_1.Reflector.getMetadata(key, target);
29
- }
30
- /**
31
- * Define metadata for the given target
32
- * @param key Metadata key
33
- * @param value Metadata value
34
- * @param target Target for the metadata
35
- * @param member Optional property or method name
36
- */
37
- static defineMetadata(key, value, target, member) {
38
- reflect_1.Reflector.defineMetadata(key, value, target, member);
39
- }
40
- /**
41
- * Get the metadata associated with the given key for all methods of the
42
- * target class or prototype
43
- * @param key Metadata key
44
- * @param target Class for static methods or prototype for instance methods
45
- * @param options Options for inspection
46
- */
47
- static getAllMethodMetadata(key, target, options) {
48
- return options && options.ownMetadataOnly
49
- ? reflect_1.Reflector.getOwnMetadata(key, target)
50
- : reflect_1.Reflector.getMetadata(key, target);
51
- }
52
- /**
53
- * Get the metadata associated with the given key for a given method of the
54
- * target class or prototype
55
- * @param key Metadata key
56
- * @param target Class for static methods or prototype for instance methods
57
- * @param methodName Method name. If not present, default to '' to use
58
- * the constructor
59
- * @param options Options for inspection
60
- */
61
- static getMethodMetadata(key, target, methodName, options) {
62
- methodName = methodName || '';
63
- const meta = options && options.ownMetadataOnly
64
- ? reflect_1.Reflector.getOwnMetadata(key, target)
65
- : reflect_1.Reflector.getMetadata(key, target);
66
- return meta && meta[methodName];
67
- }
68
- /**
69
- * Get the metadata associated with the given key for all properties of the
70
- * target class or prototype
71
- * @param key Metadata key
72
- * @param target Class for static methods or prototype for instance methods
73
- * @param options Options for inspection
74
- */
75
- static getAllPropertyMetadata(key, target, options) {
76
- return options && options.ownMetadataOnly
77
- ? reflect_1.Reflector.getOwnMetadata(key, target)
78
- : reflect_1.Reflector.getMetadata(key, target);
79
- }
80
- /**
81
- * Get the metadata associated with the given key for a given property of the
82
- * target class or prototype
83
- * @param key Metadata key
84
- * @param target Class for static properties or prototype for instance
85
- * properties
86
- * @param propertyName Property name
87
- * @param options Options for inspection
88
- */
89
- static getPropertyMetadata(key, target, propertyName, options) {
90
- const meta = options && options.ownMetadataOnly
91
- ? reflect_1.Reflector.getOwnMetadata(key, target)
92
- : reflect_1.Reflector.getMetadata(key, target);
93
- return meta && meta[propertyName];
94
- }
95
- /**
96
- * Get the metadata associated with the given key for all parameters of a
97
- * given method
98
- * @param key Metadata key
99
- * @param target Class for static methods or prototype for instance methods
100
- * @param methodName Method name. If not present, default to '' to use
101
- * the constructor
102
- * @param options Options for inspection
103
- */
104
- static getAllParameterMetadata(key, target, methodName, options) {
105
- methodName = methodName || '';
106
- const meta = options && options.ownMetadataOnly
107
- ? reflect_1.Reflector.getOwnMetadata(key, target)
108
- : reflect_1.Reflector.getMetadata(key, target);
109
- return meta && meta[methodName];
110
- }
111
- /**
112
- * Get the metadata associated with the given key for a parameter of a given
113
- * method by index
114
- * @param key Metadata key
115
- * @param target Class for static methods or prototype for instance methods
116
- * @param methodName Method name. If not present, default to '' to use
117
- * the constructor
118
- * @param index Index of the parameter, starting with 0
119
- * @param options Options for inspection
120
- */
121
- static getParameterMetadata(key, target, methodName, index, options) {
122
- methodName = methodName || '';
123
- const meta = options && options.ownMetadataOnly
124
- ? reflect_1.Reflector.getOwnMetadata(key, target)
125
- : reflect_1.Reflector.getMetadata(key, target);
126
- const params = meta && meta[methodName];
127
- return params && params[index];
128
- }
129
- /**
130
- * Get TypeScript design time type for a property
131
- * @param target Class or prototype
132
- * @param propertyName Property name
133
- */
134
- static getDesignTypeForProperty(target, propertyName) {
135
- return TSReflector.getMetadata('design:type', target, propertyName);
136
- }
137
- /**
138
- * Get TypeScript design time type for a method
139
- * @param target Class or prototype
140
- * @param methodName Method name
141
- */
142
- static getDesignTypeForMethod(target, methodName) {
143
- const type = TSReflector.getMetadata('design:type', target, methodName);
144
- const parameterTypes = TSReflector.getMetadata('design:paramtypes', target, methodName);
145
- const returnType = TSReflector.getMetadata('design:returntype', target, methodName);
146
- return {
147
- type,
148
- parameterTypes,
149
- returnType,
150
- };
151
- }
152
- }
153
- /**
154
- * Expose Reflector, which is a wrapper of `Reflect` and it uses `loopback`
155
- * as the namespace prefix for all metadata keys
156
- */
157
- MetadataInspector.Reflector = reflect_1.Reflector;
158
- /**
159
- * Expose the reflector for TypeScript design-time metadata
160
- */
161
- MetadataInspector.DesignTimeReflector = TSReflector;
162
- exports.MetadataInspector = MetadataInspector;
163
- //# sourceMappingURL=inspector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inspector.js","sourceRoot":"","sources":["../../src/inspector.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,kCAAkC;AAClC,+CAA+C;AAC/C,gEAAgE;;AAEhE,uCAAuD;AAGvD;;;;;GAKG;AACH,MAAM,WAAW,GAAG,IAAI,2BAAiB,EAAE,CAAC;AAsD5C;;GAEG;AACH;IAWE;;;;;OAKG;IACH,MAAM,CAAC,gBAAgB,CACrB,GAAW,EACX,MAAgB,EAChB,OAA2B;QAE3B,MAAM,CAAC,OAAO,IAAI,OAAO,CAAC,eAAe;YACvC,CAAC,CAAC,mBAAS,CAAC,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC;YACvC,CAAC,CAAC,mBAAS,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACzC,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,cAAc,CACnB,GAAW,EACX,KAAQ,EACR,MAAc,EACd,MAAwB;QAExB,mBAAS,CAAC,cAAc,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACvD,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,oBAAoB,CACzB,GAAW,EACX,MAAc,EACd,OAA2B;QAE3B,MAAM,CAAC,OAAO,IAAI,OAAO,CAAC,eAAe;YACvC,CAAC,CAAC,mBAAS,CAAC,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC;YACvC,CAAC,CAAC,mBAAS,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,CA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CAAC;YACL,IAAI;YACJ,cAAc;YACd,UAAU;SACX,CAAC;IACJ,CAAC;;AA/MD;;;GAGG;AACa,2BAAS,GAAG,mBAAS,CAAC;AACtC;;GAEG;AACa,qCAAmB,GAAG,WAAW,CAAC;AATpD,8CAiNC"}
@@ -1,38 +0,0 @@
1
- import 'reflect-metadata';
2
- export declare class NamespacedReflect {
3
- private namespace;
4
- /**
5
- * @param namespace : namespace to bind this reflect context
6
- */
7
- constructor(namespace?: string | undefined);
8
- private getMetadataKey(metadataKey);
9
- /**
10
- * define metadata for a target class or it's property/method
11
- */
12
- defineMetadata(metadataKey: string, metadataValue: any, target: Object, propertyKey?: string | symbol): void;
13
- /**
14
- * lookup metadata from a target object and its prototype chain
15
- */
16
- getMetadata(metadataKey: string, target: Object, propertyKey?: string | symbol): any;
17
- /**
18
- * get own metadata for a target object or it's property/method
19
- */
20
- getOwnMetadata(metadataKey: string, target: Object, propertyKey?: string | symbol): any;
21
- /**
22
- * Check if the target has corresponding metadata
23
- * @param metadataKey Key
24
- * @param target Target
25
- * @param propertyKey Optional property key
26
- */
27
- hasMetadata(metadataKey: string, target: Object, propertyKey?: string | symbol): boolean;
28
- hasOwnMetadata(metadataKey: string, target: Object, propertyKey?: string | symbol): boolean;
29
- deleteMetadata(metadataKey: string, target: Object, propertyKey?: string | symbol): boolean;
30
- getMetadataKeys(target: Object, propertyKey?: string | symbol): string[];
31
- getOwnMetadataKeys(target: Object, propertyKey?: string | symbol): string[];
32
- decorate(decorators: (PropertyDecorator | MethodDecorator)[] | ClassDecorator[], target: Object, targetKey?: string | symbol, descriptor?: PropertyDescriptor): PropertyDescriptor | Function;
33
- metadata(metadataKey: string, metadataValue: any): {
34
- (target: Function): void;
35
- (target: Object, targetKey: string | symbol): void;
36
- };
37
- }
38
- export declare const Reflector: NamespacedReflect;
@@ -1,143 +0,0 @@
1
- "use strict";
2
- // Copyright IBM Corp. 2017. All Rights Reserved.
3
- // Node module: @loopback/metadata
4
- // This file is licensed under the MIT License.
5
- // License text available at https://opensource.org/licenses/MIT
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- require("reflect-metadata");
8
- /* tslint:disable:no-any */
9
- /*
10
- * namespaced wrapper to handle reflect api
11
- */
12
- class NamespacedReflect {
13
- /**
14
- * @param namespace : namespace to bind this reflect context
15
- */
16
- constructor(namespace) {
17
- this.namespace = namespace;
18
- }
19
- getMetadataKey(metadataKey) {
20
- // prefix namespace, if provided, to the metadata key
21
- return this.namespace ? this.namespace + ':' + metadataKey : metadataKey;
22
- }
23
- /**
24
- * define metadata for a target class or it's property/method
25
- */
26
- defineMetadata(metadataKey, metadataValue, target, propertyKey) {
27
- metadataKey = this.getMetadataKey(metadataKey);
28
- if (propertyKey) {
29
- Reflect.defineMetadata(metadataKey, metadataValue, target, propertyKey);
30
- }
31
- else {
32
- Reflect.defineMetadata(metadataKey, metadataValue, target);
33
- }
34
- }
35
- /**
36
- * lookup metadata from a target object and its prototype chain
37
- */
38
- getMetadata(metadataKey, target, propertyKey) {
39
- metadataKey = this.getMetadataKey(metadataKey);
40
- if (propertyKey) {
41
- return Reflect.getMetadata(metadataKey, target, propertyKey);
42
- }
43
- return Reflect.getMetadata(metadataKey, target);
44
- }
45
- /**
46
- * get own metadata for a target object or it's property/method
47
- */
48
- getOwnMetadata(metadataKey, target, propertyKey) {
49
- metadataKey = this.getMetadataKey(metadataKey);
50
- if (propertyKey) {
51
- return Reflect.getOwnMetadata(metadataKey, target, propertyKey);
52
- }
53
- return Reflect.getOwnMetadata(metadataKey, target);
54
- }
55
- /**
56
- * Check if the target has corresponding metadata
57
- * @param metadataKey Key
58
- * @param target Target
59
- * @param propertyKey Optional property key
60
- */
61
- hasMetadata(metadataKey, target, propertyKey) {
62
- metadataKey = this.getMetadataKey(metadataKey);
63
- if (propertyKey) {
64
- return Reflect.hasMetadata(metadataKey, target, propertyKey);
65
- }
66
- return Reflect.hasMetadata(metadataKey, target);
67
- }
68
- hasOwnMetadata(metadataKey, target, propertyKey) {
69
- metadataKey = this.getMetadataKey(metadataKey);
70
- if (propertyKey) {
71
- return Reflect.hasOwnMetadata(metadataKey, target, propertyKey);
72
- }
73
- return Reflect.hasOwnMetadata(metadataKey, target);
74
- }
75
- deleteMetadata(metadataKey, target, propertyKey) {
76
- metadataKey = this.getMetadataKey(metadataKey);
77
- if (propertyKey) {
78
- return Reflect.deleteMetadata(metadataKey, target, propertyKey);
79
- }
80
- return Reflect.deleteMetadata(metadataKey, target);
81
- }
82
- getMetadataKeys(target, propertyKey) {
83
- let keys;
84
- if (propertyKey) {
85
- keys = Reflect.getMetadataKeys(target, propertyKey);
86
- }
87
- else {
88
- keys = Reflect.getMetadataKeys(target);
89
- }
90
- const metaKeys = [];
91
- if (keys) {
92
- if (!this.namespace)
93
- return keys; // No normalization is needed
94
- const prefix = this.namespace + ':';
95
- for (const key of keys) {
96
- if (key.indexOf(prefix) === 0) {
97
- // Only add keys with the namespace prefix
98
- metaKeys.push(key.substr(prefix.length));
99
- }
100
- }
101
- }
102
- return metaKeys;
103
- }
104
- getOwnMetadataKeys(target, propertyKey) {
105
- let keys;
106
- if (propertyKey) {
107
- keys = Reflect.getOwnMetadataKeys(target, propertyKey);
108
- }
109
- else {
110
- keys = Reflect.getOwnMetadataKeys(target);
111
- }
112
- const metaKeys = [];
113
- if (keys) {
114
- if (!this.namespace)
115
- return keys; // No normalization is needed
116
- const prefix = this.namespace + ':';
117
- for (const key of keys) {
118
- if (key.indexOf(prefix) === 0) {
119
- // Only add keys with the namespace prefix
120
- metaKeys.push(key.substr(prefix.length));
121
- }
122
- }
123
- }
124
- return metaKeys;
125
- }
126
- decorate(decorators, target, targetKey, descriptor) {
127
- if (targetKey) {
128
- return Reflect.decorate(decorators, target, targetKey, descriptor);
129
- }
130
- else {
131
- return Reflect.decorate(decorators, target);
132
- }
133
- }
134
- /* tslint:disable-next-line:no-any */
135
- metadata(metadataKey, metadataValue) {
136
- metadataKey = this.getMetadataKey(metadataKey);
137
- return Reflect.metadata(metadataKey, metadataValue);
138
- }
139
- }
140
- exports.NamespacedReflect = NamespacedReflect;
141
- /* tslint:disable-next-line:variable-name */
142
- exports.Reflector = new NamespacedReflect('loopback');
143
- //# sourceMappingURL=reflect.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reflect.js","sourceRoot":"","sources":["../../src/reflect.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,kCAAkC;AAClC,+CAA+C;AAC/C,gEAAgE;;AAEhE,4BAA0B;AAE1B,2BAA2B;AAE3B;;GAEG;AACH;IACE;;OAEG;IACH,YAAoB,SAAkB;QAAlB,cAAS,GAAT,SAAS,CAAS;IAAG,CAAC;IAElC,cAAc,CAAC,WAAmB;QACxC,qDAAqD;QACrD,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,GAAG,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC;IAC3E,CAAC;IAED;;OAEG;IACH,cAAc,CACZ,WAAmB,EACnB,aAAkB,EAClB,MAAc,EACd,WAA6B;QAE7B,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QAC/C,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;YAChB,OAAO,CAAC,cAAc,CAAC,WAAW,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QAC1E,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,OAAO,CAAC,cAAc,CAAC,WAAW,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;IAED;;OAEG;IACH,WAAW,CACT,WAAmB,EACnB,MAAc,EACd,WAA6B;QAE7B,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QAC/C,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;YAChB,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,CAAC,C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,CAAC;QAC/C,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IACtD,CAAC;CACF;AAtKD,8CAsKC;AAED,4CAA4C;AAC/B,QAAA,SAAS,GAAG,IAAI,iBAAiB,CAAC,UAAU,CAAC,CAAC"}
package/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- // Copyright IBM Corp. 2017. All Rights Reserved.
2
- // Node module: @loopback/metadata
3
- // This file is licensed under the MIT License.
4
- // License text available at https://opensource.org/licenses/MIT
5
-
6
- export * from './dist';
package/index.js DELETED
@@ -1,7 +0,0 @@
1
- // Copyright IBM Corp. 2017,2018. All Rights Reserved.
2
- // Node module: @loopback/metadata
3
- // This file is licensed under the MIT License.
4
- // License text available at https://opensource.org/licenses/MIT
5
-
6
- const nodeMajorVersion = +process.versions.node.split('.')[0];
7
- module.exports = nodeMajorVersion >= 7 ? require('./dist') : require('./dist6');