@fluojs/core 1.0.0-beta.1

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 (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.ko.md +165 -0
  3. package/README.md +167 -0
  4. package/dist/decorators.d.ts +51 -0
  5. package/dist/decorators.d.ts.map +1 -0
  6. package/dist/decorators.js +79 -0
  7. package/dist/errors.d.ts +60 -0
  8. package/dist/errors.d.ts.map +1 -0
  9. package/dist/errors.js +89 -0
  10. package/dist/index.d.ts +5 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +3 -0
  13. package/dist/internal.d.ts +3 -0
  14. package/dist/internal.d.ts.map +1 -0
  15. package/dist/internal.js +2 -0
  16. package/dist/metadata/class-di.d.ts +30 -0
  17. package/dist/metadata/class-di.d.ts.map +1 -0
  18. package/dist/metadata/class-di.js +72 -0
  19. package/dist/metadata/controller-route.d.ts +7 -0
  20. package/dist/metadata/controller-route.d.ts.map +1 -0
  21. package/dist/metadata/controller-route.js +109 -0
  22. package/dist/metadata/injection.d.ts +5 -0
  23. package/dist/metadata/injection.d.ts.map +1 -0
  24. package/dist/metadata/injection.js +31 -0
  25. package/dist/metadata/module.d.ts +16 -0
  26. package/dist/metadata/module.d.ts.map +1 -0
  27. package/dist/metadata/module.js +57 -0
  28. package/dist/metadata/shared.d.ts +128 -0
  29. package/dist/metadata/shared.d.ts.map +1 -0
  30. package/dist/metadata/shared.js +231 -0
  31. package/dist/metadata/store.d.ts +16 -0
  32. package/dist/metadata/store.d.ts.map +1 -0
  33. package/dist/metadata/store.js +25 -0
  34. package/dist/metadata/symbol-metadata-polyfill.d.ts +2 -0
  35. package/dist/metadata/symbol-metadata-polyfill.d.ts.map +1 -0
  36. package/dist/metadata/symbol-metadata-polyfill.js +4 -0
  37. package/dist/metadata/types.d.ts +210 -0
  38. package/dist/metadata/types.d.ts.map +1 -0
  39. package/dist/metadata/types.js +1 -0
  40. package/dist/metadata/validation.d.ts +11 -0
  41. package/dist/metadata/validation.d.ts.map +1 -0
  42. package/dist/metadata/validation.js +93 -0
  43. package/dist/metadata.d.ts +9 -0
  44. package/dist/metadata.d.ts.map +1 -0
  45. package/dist/metadata.js +7 -0
  46. package/dist/types.d.ts +43 -0
  47. package/dist/types.d.ts.map +1 -0
  48. package/dist/types.js +1 -0
  49. package/dist/utils.d.ts +19 -0
  50. package/dist/utils.d.ts.map +1 -0
  51. package/dist/utils.js +103 -0
  52. package/package.json +52 -0
@@ -0,0 +1,30 @@
1
+ import type { ClassDiMetadata } from './types.js';
2
+ /**
3
+ * Defines class-level DI metadata while preserving previously written fields for split decorator passes.
4
+ *
5
+ * @param target Class receiving DI metadata.
6
+ * @param metadata Partial or complete DI metadata payload.
7
+ */
8
+ export declare function defineClassDiMetadata(target: Function, metadata: ClassDiMetadata): void;
9
+ /**
10
+ * Reads only the DI metadata defined directly on a class.
11
+ *
12
+ * @param target Class being inspected.
13
+ * @returns A defensive clone of the class's own DI metadata, or `undefined` when absent.
14
+ */
15
+ export declare function getOwnClassDiMetadata(target: Function): ClassDiMetadata | undefined;
16
+ /**
17
+ * Resolves inherited DI metadata by walking the constructor lineage from base to leaf.
18
+ *
19
+ * @param target Class being inspected.
20
+ * @returns The effective inherited DI metadata, or `undefined` when no lineage metadata exists.
21
+ */
22
+ export declare function getInheritedClassDiMetadata(target: Function): ClassDiMetadata | undefined;
23
+ /**
24
+ * Reads the effective DI metadata visible to a class, including inherited fallback values.
25
+ *
26
+ * @param target Class being inspected.
27
+ * @returns The effective DI metadata for the class, or `undefined` when none exists.
28
+ */
29
+ export declare function getClassDiMetadata(target: Function): ClassDiMetadata | undefined;
30
+ //# sourceMappingURL=class-di.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"class-di.d.ts","sourceRoot":"","sources":["../../src/metadata/class-di.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAyBlD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,GAAG,IAAI,CAKvF;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,QAAQ,GAAG,eAAe,GAAG,SAAS,CAEnF;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,QAAQ,GAAG,eAAe,GAAG,SAAS,CAiBzF;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,QAAQ,GAAG,eAAe,GAAG,SAAS,CAEhF"}
@@ -0,0 +1,72 @@
1
+ import { createClonedWeakMapStore } from './store.js';
2
+ const classDiMetadataStore = createClonedWeakMapStore(cloneClassDiMetadata);
3
+ function cloneClassDiMetadata(metadata) {
4
+ return {
5
+ inject: metadata.inject ? [...metadata.inject] : undefined,
6
+ scope: metadata.scope
7
+ };
8
+ }
9
+ function getClassMetadataLineage(target) {
10
+ const lineage = [];
11
+ let current = target;
12
+ while (typeof current === 'function' && current !== Function.prototype) {
13
+ lineage.push(current);
14
+ current = Object.getPrototypeOf(current);
15
+ }
16
+ lineage.reverse();
17
+ return lineage;
18
+ }
19
+
20
+ /**
21
+ * Defines class-level DI metadata while preserving previously written fields for split decorator passes.
22
+ *
23
+ * @param target Class receiving DI metadata.
24
+ * @param metadata Partial or complete DI metadata payload.
25
+ */
26
+ export function defineClassDiMetadata(target, metadata) {
27
+ classDiMetadataStore.update(target, existing => ({
28
+ inject: metadata.inject !== undefined ? metadata.inject : existing?.inject,
29
+ scope: metadata.scope ?? existing?.scope
30
+ }));
31
+ }
32
+
33
+ /**
34
+ * Reads only the DI metadata defined directly on a class.
35
+ *
36
+ * @param target Class being inspected.
37
+ * @returns A defensive clone of the class's own DI metadata, or `undefined` when absent.
38
+ */
39
+ export function getOwnClassDiMetadata(target) {
40
+ return classDiMetadataStore.read(target);
41
+ }
42
+
43
+ /**
44
+ * Resolves inherited DI metadata by walking the constructor lineage from base to leaf.
45
+ *
46
+ * @param target Class being inspected.
47
+ * @returns The effective inherited DI metadata, or `undefined` when no lineage metadata exists.
48
+ */
49
+ export function getInheritedClassDiMetadata(target) {
50
+ let effective;
51
+ for (const constructor of getClassMetadataLineage(target)) {
52
+ const metadata = classDiMetadataStore.read(constructor);
53
+ if (!metadata) {
54
+ continue;
55
+ }
56
+ effective = {
57
+ inject: metadata.inject ?? effective?.inject,
58
+ scope: metadata.scope ?? effective?.scope
59
+ };
60
+ }
61
+ return effective ? cloneClassDiMetadata(effective) : undefined;
62
+ }
63
+
64
+ /**
65
+ * Reads the effective DI metadata visible to a class, including inherited fallback values.
66
+ *
67
+ * @param target Class being inspected.
68
+ * @returns The effective DI metadata for the class, or `undefined` when none exists.
69
+ */
70
+ export function getClassDiMetadata(target) {
71
+ return getInheritedClassDiMetadata(target);
72
+ }
@@ -0,0 +1,7 @@
1
+ import type { ControllerMetadata, RouteMetadata } from './types.js';
2
+ import type { MetadataPropertyKey } from '../types.js';
3
+ export declare function defineControllerMetadata(target: Function, metadata: ControllerMetadata): void;
4
+ export declare function getControllerMetadata(target: Function): ControllerMetadata | undefined;
5
+ export declare function defineRouteMetadata(target: object, propertyKey: MetadataPropertyKey, metadata: RouteMetadata): void;
6
+ export declare function getRouteMetadata(target: object, propertyKey: MetadataPropertyKey): RouteMetadata | undefined;
7
+ //# sourceMappingURL=controller-route.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller-route.d.ts","sourceRoot":"","sources":["../../src/metadata/controller-route.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAA+B,MAAM,YAAY,CAAC;AACjG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AA8DvD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,GAAG,IAAI,CAE7F;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,QAAQ,GAAG,kBAAkB,GAAG,SAAS,CActF;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,mBAAmB,EAChC,QAAQ,EAAE,aAAa,GACtB,IAAI,CAEN;AAsCD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,mBAAmB,GAAG,aAAa,GAAG,SAAS,CAW5G"}
@@ -0,0 +1,109 @@
1
+ import { cloneMutableValue, cloneCollection, getOrCreatePropertyMap, getStandardConstructorMetadataMap, getStandardMetadataBag, mergeUnique, standardMetadataKeys } from './shared.js';
2
+ import { createClonedWeakMapStore } from './store.js';
3
+ const controllerMetadataStore = createClonedWeakMapStore(cloneControllerMetadata);
4
+ const routeMetadataStore = new WeakMap();
5
+ function cloneRouteHeaders(headers) {
6
+ return headers?.map(header => ({
7
+ ...header
8
+ }));
9
+ }
10
+ function cloneRouteRedirect(redirect) {
11
+ return redirect ? {
12
+ ...redirect
13
+ } : undefined;
14
+ }
15
+ function cloneControllerMetadata(metadata) {
16
+ return {
17
+ ...metadata,
18
+ guards: cloneCollection(metadata.guards),
19
+ interceptors: cloneCollection(metadata.interceptors)
20
+ };
21
+ }
22
+ function cloneRouteMetadata(metadata) {
23
+ return {
24
+ ...metadata,
25
+ headers: cloneRouteHeaders(metadata.headers),
26
+ redirect: cloneRouteRedirect(metadata.redirect),
27
+ guards: cloneCollection(metadata.guards),
28
+ interceptors: cloneCollection(metadata.interceptors)
29
+ };
30
+ }
31
+ function getStandardControllerMetadata(target) {
32
+ const metadata = getStandardMetadataBag(target)?.[standardMetadataKeys.controller];
33
+ if (!metadata) {
34
+ return undefined;
35
+ }
36
+ return cloneControllerMetadata(metadata);
37
+ }
38
+ function getStandardRouteMetadata(target, propertyKey) {
39
+ const routeMap = getStandardConstructorMetadataMap(target, standardMetadataKeys.route);
40
+ const metadata = routeMap?.get(propertyKey);
41
+ if (!metadata?.method || metadata.path === undefined) {
42
+ return undefined;
43
+ }
44
+ return cloneRouteMetadata({
45
+ guards: metadata.guards,
46
+ headers: metadata.headers,
47
+ interceptors: metadata.interceptors,
48
+ method: metadata.method,
49
+ path: metadata.path,
50
+ redirect: metadata.redirect,
51
+ request: metadata.request,
52
+ successStatus: metadata.successStatus,
53
+ version: metadata.version
54
+ });
55
+ }
56
+ export function defineControllerMetadata(target, metadata) {
57
+ controllerMetadataStore.write(target, metadata);
58
+ }
59
+ export function getControllerMetadata(target) {
60
+ const stored = controllerMetadataStore.read(target);
61
+ const standard = getStandardControllerMetadata(target);
62
+ if (!stored && !standard) {
63
+ return undefined;
64
+ }
65
+ return {
66
+ basePath: stored?.basePath ?? standard?.basePath ?? '',
67
+ guards: mergeUnique(stored?.guards, standard?.guards),
68
+ interceptors: mergeUnique(stored?.interceptors, standard?.interceptors),
69
+ version: stored?.version ?? standard?.version
70
+ };
71
+ }
72
+ export function defineRouteMetadata(target, propertyKey, metadata) {
73
+ getOrCreatePropertyMap(routeMetadataStore, target).set(propertyKey, cloneRouteMetadata(metadata));
74
+ }
75
+ function resolveRequiredRouteFields(stored, standard, propertyKey) {
76
+ const method = stored?.method ?? standard?.method;
77
+ const path = stored?.path ?? standard?.path;
78
+ if (method === undefined || path === undefined) {
79
+ throw new Error(`Route metadata for property key "${String(propertyKey)}" is missing required "method" or "path".`);
80
+ }
81
+ return {
82
+ method,
83
+ path
84
+ };
85
+ }
86
+ function mergeRouteMetadata(stored, standard, required) {
87
+ const mergedHeaders = stored?.headers ?? standard?.headers;
88
+ const mergedRedirect = stored?.redirect ?? standard?.redirect;
89
+ return {
90
+ guards: mergeUnique(stored?.guards, standard?.guards),
91
+ headers: cloneMutableValue(mergedHeaders),
92
+ interceptors: mergeUnique(stored?.interceptors, standard?.interceptors),
93
+ method: required.method,
94
+ path: required.path,
95
+ redirect: cloneMutableValue(mergedRedirect),
96
+ request: stored?.request ?? standard?.request,
97
+ successStatus: stored?.successStatus ?? standard?.successStatus,
98
+ version: stored?.version ?? standard?.version
99
+ };
100
+ }
101
+ export function getRouteMetadata(target, propertyKey) {
102
+ const stored = routeMetadataStore.get(target)?.get(propertyKey);
103
+ const standard = getStandardRouteMetadata(target, propertyKey);
104
+ if (!stored && !standard) {
105
+ return undefined;
106
+ }
107
+ const required = resolveRequiredRouteFields(stored, standard, propertyKey);
108
+ return mergeRouteMetadata(stored, standard, required);
109
+ }
@@ -0,0 +1,5 @@
1
+ import type { InjectionMetadata, InjectionSchemaEntry } from './types.js';
2
+ import type { MetadataPropertyKey } from '../types.js';
3
+ export declare function defineInjectionMetadata(target: object, propertyKey: MetadataPropertyKey, metadata: InjectionMetadata): void;
4
+ export declare function getInjectionSchema(target: object): InjectionSchemaEntry[];
5
+ //# sourceMappingURL=injection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"injection.d.ts","sourceRoot":"","sources":["../../src/metadata/injection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAA2B,MAAM,YAAY,CAAC;AACnG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAQvD,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,mBAAmB,EAChC,QAAQ,EAAE,iBAAiB,GAC1B,IAAI,CAEN;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,EAAE,CAwBzE"}
@@ -0,0 +1,31 @@
1
+ import { getOrCreatePropertyMap, getStandardConstructorMetadataMap, mergeMetadataPropertyKeys, standardMetadataKeys } from './shared.js';
2
+ const injectionMetadataStore = new WeakMap();
3
+ function getStandardInjectionMap(target) {
4
+ return getStandardConstructorMetadataMap(target, standardMetadataKeys.injection);
5
+ }
6
+ export function defineInjectionMetadata(target, propertyKey, metadata) {
7
+ getOrCreatePropertyMap(injectionMetadataStore, target).set(propertyKey, {
8
+ ...metadata
9
+ });
10
+ }
11
+ export function getInjectionSchema(target) {
12
+ const stored = injectionMetadataStore.get(target) ?? new Map();
13
+ const standard = getStandardInjectionMap(target) ?? new Map();
14
+ const keys = mergeMetadataPropertyKeys(stored, standard);
15
+ const schema = [];
16
+ for (const propertyKey of keys) {
17
+ const metadata = stored.get(propertyKey);
18
+ const standardMetadata = standard.get(propertyKey);
19
+ if (!metadata && standardMetadata?.token == null) {
20
+ continue;
21
+ }
22
+ schema.push({
23
+ propertyKey,
24
+ metadata: {
25
+ optional: metadata?.optional ?? standardMetadata?.optional,
26
+ token: metadata?.token ?? standardMetadata?.token
27
+ }
28
+ });
29
+ }
30
+ return schema;
31
+ }
@@ -0,0 +1,16 @@
1
+ import type { ModuleMetadata } from './types.js';
2
+ /**
3
+ * Defines module metadata while preserving previously written fields for partial decorator passes.
4
+ *
5
+ * @param target Module class receiving metadata.
6
+ * @param metadata Partial or complete module metadata payload.
7
+ */
8
+ export declare function defineModuleMetadata(target: Function, metadata: ModuleMetadata): void;
9
+ /**
10
+ * Reads cloned module metadata for the provided module class.
11
+ *
12
+ * @param target Module class being inspected.
13
+ * @returns A defensive clone of module metadata, or `undefined` when none was defined.
14
+ */
15
+ export declare function getModuleMetadata(target: Function): ModuleMetadata | undefined;
16
+ //# sourceMappingURL=module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/metadata/module.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAkCjD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,GAAG,IAAI,CASrF;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,QAAQ,GAAG,cAAc,GAAG,SAAS,CAE9E"}
@@ -0,0 +1,57 @@
1
+ import { cloneCollection, cloneMutableValue } from './shared.js';
2
+ import { createClonedWeakMapStore } from './store.js';
3
+ const moduleMetadataStore = createClonedWeakMapStore(cloneModuleMetadata);
4
+ function isValueProvider(provider) {
5
+ return typeof provider === 'object' && provider !== null && 'useValue' in provider;
6
+ }
7
+ function cloneProvider(provider) {
8
+ if (isValueProvider(provider)) {
9
+ // Shallow-copy the provider descriptor but preserve the useValue reference.
10
+ // Deep-cloning useValue would sever object identity for externally supplied
11
+ // instances (e.g. transport adapters) that callers hold references to.
12
+ return {
13
+ ...provider
14
+ };
15
+ }
16
+ return cloneMutableValue(provider);
17
+ }
18
+ function cloneProviders(providers) {
19
+ return providers ? providers.map(cloneProvider) : undefined;
20
+ }
21
+ function cloneModuleMetadata(metadata) {
22
+ return {
23
+ controllers: cloneCollection(metadata.controllers),
24
+ exports: cloneCollection(metadata.exports),
25
+ global: metadata.global,
26
+ imports: cloneCollection(metadata.imports),
27
+ middleware: cloneCollection(metadata.middleware),
28
+ providers: cloneProviders(metadata.providers)
29
+ };
30
+ }
31
+
32
+ /**
33
+ * Defines module metadata while preserving previously written fields for partial decorator passes.
34
+ *
35
+ * @param target Module class receiving metadata.
36
+ * @param metadata Partial or complete module metadata payload.
37
+ */
38
+ export function defineModuleMetadata(target, metadata) {
39
+ moduleMetadataStore.update(target, existing => ({
40
+ controllers: metadata.controllers ?? existing?.controllers,
41
+ exports: metadata.exports ?? existing?.exports,
42
+ global: metadata.global !== undefined ? metadata.global : existing?.global,
43
+ imports: metadata.imports ?? existing?.imports,
44
+ middleware: metadata.middleware ?? existing?.middleware,
45
+ providers: metadata.providers ?? existing?.providers
46
+ }));
47
+ }
48
+
49
+ /**
50
+ * Reads cloned module metadata for the provided module class.
51
+ *
52
+ * @param target Module class being inspected.
53
+ * @returns A defensive clone of module metadata, or `undefined` when none was defined.
54
+ */
55
+ export function getModuleMetadata(target) {
56
+ return moduleMetadataStore.read(target);
57
+ }
@@ -0,0 +1,128 @@
1
+ import type { MetadataPropertyKey } from '../types.js';
2
+ /**
3
+ * Generic metadata bag shape used by the TC39 `Symbol.metadata` integration points.
4
+ */
5
+ export type StandardMetadataBag = Record<PropertyKey, unknown>;
6
+ /**
7
+ * Active symbol key used to read and write standard metadata bags.
8
+ */
9
+ export declare let metadataSymbol: symbol;
10
+ /**
11
+ * Ensures `Symbol.metadata` exists and returns the symbol used by Fluo metadata helpers.
12
+ *
13
+ * @returns The resolved metadata symbol.
14
+ */
15
+ export declare function ensureMetadataSymbol(): symbol;
16
+ /**
17
+ * Clones mutable metadata payloads before storing or returning them from shared metadata helpers.
18
+ *
19
+ * @param value Metadata value to clone defensively.
20
+ * @returns A detached clone for supported mutable shapes, or the original value for immutable references.
21
+ */
22
+ export declare function cloneMutableValue<T>(value: T): T;
23
+ /**
24
+ * Canonical symbol keys for metadata emitted through the standard decorator metadata bag.
25
+ */
26
+ export declare const standardMetadataKeys: {
27
+ readonly classValidation: symbol;
28
+ readonly controller: symbol;
29
+ readonly dtoFieldBinding: symbol;
30
+ readonly dtoFieldValidation: symbol;
31
+ readonly injection: symbol;
32
+ readonly route: symbol;
33
+ };
34
+ /**
35
+ * Canonical symbol keys for Fluo-owned metadata stores.
36
+ */
37
+ export declare const metadataKeys: {
38
+ readonly module: symbol;
39
+ readonly controller: symbol;
40
+ readonly route: symbol;
41
+ readonly dtoFieldBinding: symbol;
42
+ readonly dtoFieldValidation: symbol;
43
+ readonly injection: symbol;
44
+ readonly classDi: symbol;
45
+ readonly classValidation: symbol;
46
+ };
47
+ /**
48
+ * Clones a readonly collection into a mutable array for defensive metadata reads and writes.
49
+ *
50
+ * @param collection Collection to clone.
51
+ * @returns A cloned mutable array, or `undefined` when the collection is absent.
52
+ */
53
+ export declare function cloneCollection<T>(collection: readonly T[] | undefined): T[] | undefined;
54
+ /**
55
+ * Looks up or creates a property-keyed metadata map for a target object.
56
+ *
57
+ * @param store WeakMap-backed metadata store.
58
+ * @param target Target object that owns the metadata map.
59
+ * @returns The existing or newly created metadata map for the target.
60
+ */
61
+ export declare function getOrCreatePropertyMap<T>(store: WeakMap<object, Map<MetadataPropertyKey, T>>, target: object): Map<MetadataPropertyKey, T>;
62
+ /**
63
+ * Merges two arrays into a single deduplicated array, preserving insertion order.
64
+ * Deduplication uses reference equality (===), so two objects with identical shapes
65
+ * are treated as distinct entries unless they are the exact same reference.
66
+ * Returns `undefined` when both inputs are empty or absent.
67
+ *
68
+ * @param existing Existing values in insertion order.
69
+ * @param values Additional values to merge.
70
+ * @returns A deduplicated merged array, or `undefined` when both inputs are empty.
71
+ */
72
+ export declare function mergeUnique<T>(existing: readonly T[] | undefined, values: readonly T[] | undefined): T[] | undefined;
73
+ /**
74
+ * Reads the standard metadata bag stored directly on a target.
75
+ *
76
+ * @param target Target object that may own standard metadata.
77
+ * @returns The metadata bag when present, otherwise `undefined`.
78
+ */
79
+ export declare function getStandardMetadataBag(target: object): StandardMetadataBag | undefined;
80
+ /**
81
+ * Reads the standard metadata bag stored on a target's constructor.
82
+ *
83
+ * @param target Instance or prototype whose constructor metadata should be inspected.
84
+ * @returns The constructor metadata bag when present, otherwise `undefined`.
85
+ */
86
+ export declare function getStandardConstructorMetadataBag(target: object): StandardMetadataBag | undefined;
87
+ /**
88
+ * Reads a constructor-level metadata record from the standard metadata bag.
89
+ *
90
+ * @param target Instance or prototype whose constructor metadata should be inspected.
91
+ * @param key Symbol key of the stored metadata record.
92
+ * @returns The stored record when present, otherwise `undefined`.
93
+ */
94
+ export declare function getStandardConstructorMetadataRecord<T>(target: object, key: symbol): T | undefined;
95
+ /**
96
+ * Reads a constructor-level property map from the standard metadata bag.
97
+ *
98
+ * @param target Instance or prototype whose constructor metadata should be inspected.
99
+ * @param key Symbol key of the stored metadata map.
100
+ * @returns The stored property map when present, otherwise `undefined`.
101
+ */
102
+ export declare function getStandardConstructorMetadataMap<T>(target: object, key: symbol): Map<MetadataPropertyKey, T> | undefined;
103
+ /**
104
+ * Merges stored and standard metadata property keys while preserving first-seen order.
105
+ *
106
+ * @param stored Property keys from the explicit Fluo store.
107
+ * @param standard Property keys from the standard metadata bag.
108
+ * @returns A deduplicated ordered list of metadata property keys.
109
+ */
110
+ export declare function mergeMetadataPropertyKeys<TStored, TStandard>(stored: ReadonlyMap<MetadataPropertyKey, TStored> | undefined, standard: ReadonlyMap<MetadataPropertyKey, TStandard> | undefined): MetadataPropertyKey[];
111
+ /**
112
+ * Appends a value into a property-keyed array store, creating the array on first write.
113
+ *
114
+ * @param store WeakMap-backed property store.
115
+ * @param target Target object that owns the property map.
116
+ * @param propertyKey Property key associated with the array entry.
117
+ * @param value Value to append.
118
+ */
119
+ export declare function appendPropertyMapValue<T>(store: WeakMap<object, Map<MetadataPropertyKey, T[]>>, target: object, propertyKey: MetadataPropertyKey, value: T): void;
120
+ /**
121
+ * Appends a value into a WeakMap-backed array store, creating the array on first write.
122
+ *
123
+ * @param store WeakMap-backed array store.
124
+ * @param target Target function used as the WeakMap key.
125
+ * @param value Value to append.
126
+ */
127
+ export declare function appendWeakMapValue<T>(store: WeakMap<Function, T[]>, target: Function, value: T): void;
128
+ //# sourceMappingURL=shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/metadata/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGvD;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AAG/D;;GAEG;AACH,eAAO,IAAI,cAAc,QAAoE,CAAC;AAE9F;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAY7C;AAcD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAMhD;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;;CAOvB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;CASf,CAAC;AAEX;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS,GAAG,CAAC,EAAE,GAAG,SAAS,CAExF;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC,EACnD,MAAM,EAAE,MAAM,GACb,GAAG,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAS7B;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS,GAAG,CAAC,EAAE,GAAG,SAAS,CAgBpH;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAQtF;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAIjG;AAED;;;;;;GAMG;AACH,wBAAgB,oCAAoC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAElG;AAED;;;;;;GAMG;AACH,wBAAgB,iCAAiC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC,mBAAmB,EAAE,CAAC,CAAC,GAAG,SAAS,CAEzH;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,SAAS,EAC1D,MAAM,EAAE,WAAW,CAAC,mBAAmB,EAAE,OAAO,CAAC,GAAG,SAAS,EAC7D,QAAQ,EAAE,WAAW,CAAC,mBAAmB,EAAE,SAAS,CAAC,GAAG,SAAS,GAChE,mBAAmB,EAAE,CAkBvB;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,mBAAmB,EAAE,CAAC,EAAE,CAAC,CAAC,EACrD,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,mBAAmB,EAChC,KAAK,EAAE,CAAC,GACP,IAAI,CAUN;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CASrG"}