adaptive-extender 0.10.4 → 0.10.5
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/CHANGELOG.md +4 -1
- package/dist/core/portable.js +12 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
## 0.10.
|
|
1
|
+
## 0.10.5 (13.06.2026)
|
|
2
|
+
- Bugfix at [portable](./src/core/portable.ts).
|
|
3
|
+
|
|
4
|
+
## 0.10.3 (05.06.2026)
|
|
2
5
|
- Added `Function.empty` constant — a shared no-op function available via `Function.empty`.
|
|
3
6
|
- Added [function](./src/core/function.ts) module to the core package.
|
|
4
7
|
- Added [metadata-injector](./src/web/metadata-injector.ts) module to the web package. Provides `MetadataInjector.inject()` for one-shot injection of structured JSON-LD metadata, Open Graph meta tags, and `rel=me` links into the document head. Supports `Person`, `Application`, and `Organization` entity types.
|
package/dist/core/portable.js
CHANGED
|
@@ -75,6 +75,14 @@ class PortabilityMetadata {
|
|
|
75
75
|
}
|
|
76
76
|
return metadata;
|
|
77
77
|
}
|
|
78
|
+
static descendantsOf(model) {
|
|
79
|
+
if (!Object.hasOwn(model, Symbol.metadata))
|
|
80
|
+
return [];
|
|
81
|
+
const object = model[Symbol.metadata];
|
|
82
|
+
if (object === null || object === undefined)
|
|
83
|
+
return [];
|
|
84
|
+
return PortabilityMetadata.for(object).#descendants;
|
|
85
|
+
}
|
|
78
86
|
get fields() {
|
|
79
87
|
return this.#fields;
|
|
80
88
|
}
|
|
@@ -103,8 +111,9 @@ export class Model {
|
|
|
103
111
|
*/
|
|
104
112
|
static import(source, name) {
|
|
105
113
|
const model = this;
|
|
106
|
-
const
|
|
114
|
+
const descendants = PortabilityMetadata.descendantsOf(model);
|
|
107
115
|
if (descendants.length > 0) {
|
|
116
|
+
const { discriminator: key } = PortabilityMetadata.read(model);
|
|
108
117
|
const object = Object.import(source, name);
|
|
109
118
|
const value = Reflect.get(object, key);
|
|
110
119
|
if (value === undefined)
|
|
@@ -131,8 +140,9 @@ export class Model {
|
|
|
131
140
|
*/
|
|
132
141
|
static export(source) {
|
|
133
142
|
const model = this;
|
|
134
|
-
const
|
|
143
|
+
const descendants = PortabilityMetadata.descendantsOf(model);
|
|
135
144
|
if (descendants.length > 0) {
|
|
145
|
+
const { discriminator: key } = PortabilityMetadata.read(model);
|
|
136
146
|
const descriptor = descendants.find(descriptor => source instanceof descriptor.type);
|
|
137
147
|
if (descriptor === undefined)
|
|
138
148
|
throw new TypeError(`Invalid '${typename(source)}' type for source`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adaptive-extender",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.5",
|
|
4
4
|
"description": "Adaptive library for JS/TS development environments",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/core/index.js",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"build:web": "tsc -p ./src/web/tsconfig.json",
|
|
58
58
|
"build:worker": "tsc -p ./src/worker/tsconfig.json",
|
|
59
59
|
"build": "npm run build:core && npm run build:node && npm run build:web && npm run build:worker",
|
|
60
|
-
"test": "vitest run",
|
|
60
|
+
"test": "npm run build & vitest run",
|
|
61
61
|
"coverage": "vitest run --coverage"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|