@duplojs/utils 1.5.6 → 1.5.8
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/clean/entity/index.cjs +94 -0
- package/dist/clean/entity/index.d.ts +217 -0
- package/dist/clean/entity/index.mjs +85 -0
- package/dist/clean/entity/property.cjs +66 -0
- package/dist/clean/entity/property.d.ts +43 -0
- package/dist/clean/entity/property.mjs +59 -0
- package/dist/clean/entity/unwrap.cjs +58 -0
- package/dist/clean/{unwrapEntity.d.ts → entity/unwrap.d.ts} +13 -10
- package/dist/clean/entity/unwrap.mjs +55 -0
- package/dist/clean/index.cjs +14 -6
- package/dist/clean/index.d.ts +0 -1
- package/dist/clean/index.mjs +3 -2
- package/dist/clean/maybe.cjs +3 -3
- package/dist/clean/maybe.mjs +1 -1
- package/dist/dataParser/extended/tuple.d.ts +6 -2
- package/dist/date/computeTime.cjs +23 -0
- package/dist/date/computeTime.d.ts +41 -0
- package/dist/date/computeTime.mjs +21 -0
- package/dist/date/getDifference.cjs +17 -0
- package/dist/date/getDifference.d.ts +44 -0
- package/dist/date/getDifference.mjs +15 -0
- package/dist/date/index.cjs +4 -0
- package/dist/date/index.d.ts +2 -0
- package/dist/date/index.mjs +2 -0
- package/dist/date/theTime.d.ts +3 -2
- package/dist/date/toNative.cjs +11 -5
- package/dist/date/toNative.d.ts +21 -7
- package/dist/date/toNative.mjs +11 -5
- package/dist/date/types/serializedTheTime.d.ts +2 -1
- package/dist/metadata.json +50 -18
- package/package.json +2 -2
- package/dist/clean/entity.cjs +0 -145
- package/dist/clean/entity.d.ts +0 -234
- package/dist/clean/entity.mjs +0 -141
- package/dist/clean/unwrapEntity.cjs +0 -36
- package/dist/clean/unwrapEntity.mjs +0 -34
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var kind = require('../kind.cjs');
|
|
4
|
+
var newType = require('../newType.cjs');
|
|
5
|
+
var property = require('./property.cjs');
|
|
6
|
+
var kind$1 = require('../../common/kind.cjs');
|
|
7
|
+
var pipe = require('../../common/pipe.cjs');
|
|
8
|
+
var map = require('../../array/map.cjs');
|
|
9
|
+
var entry = require('../../object/entry.cjs');
|
|
10
|
+
var fromEntries = require('../../object/fromEntries.cjs');
|
|
11
|
+
var transform = require('../../dataParser/parsers/transform.cjs');
|
|
12
|
+
var entries = require('../../object/entries.cjs');
|
|
13
|
+
var forward = require('../../common/forward.cjs');
|
|
14
|
+
var errorKindNamespace = require('../../common/errorKindNamespace.cjs');
|
|
15
|
+
var index = require('../../dataParser/parsers/object/index.cjs');
|
|
16
|
+
var base = require('../constraint/base.cjs');
|
|
17
|
+
var wrapValue = require('../../common/wrapValue.cjs');
|
|
18
|
+
var override = require('../../common/override.cjs');
|
|
19
|
+
var is = require('../../either/left/is.cjs');
|
|
20
|
+
var unwrap$1 = require('../../common/unwrap.cjs');
|
|
21
|
+
var create = require('../../either/left/create.cjs');
|
|
22
|
+
var create$1 = require('../../either/right/create.cjs');
|
|
23
|
+
|
|
24
|
+
const entityKind = kind.createCleanKind("entity");
|
|
25
|
+
const entityHandlerKind = kind.createCleanKind("entity-handler");
|
|
26
|
+
class CreateEntityError extends kind$1.kindHeritage("create-entity-error", errorKindNamespace.createErrorKind("create-entity-error"), Error) {
|
|
27
|
+
rawProperties;
|
|
28
|
+
dataParserError;
|
|
29
|
+
constructor(rawProperties, dataParserError) {
|
|
30
|
+
super({}, ["Error when create entity."]);
|
|
31
|
+
this.rawProperties = rawProperties;
|
|
32
|
+
this.dataParserError = dataParserError;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* {@include clean/createEntity/index.md}
|
|
37
|
+
*/
|
|
38
|
+
function createEntity(name, getPropertiesDefinition) {
|
|
39
|
+
function theNew(properties) {
|
|
40
|
+
return entityKind.addTo(properties, name);
|
|
41
|
+
}
|
|
42
|
+
const propertiesDefinition = getPropertiesDefinition(property.entityPropertyDefinitionTools);
|
|
43
|
+
const mapDataParser = pipe.pipe(forward.forward(propertiesDefinition), entries.entries, map.map(([key, property$1]) => entry.entry(key, property.entityPropertyDefinitionToDataParser(property$1, (newTypeHandler) => {
|
|
44
|
+
const constraintKindValue = pipe.pipe(newTypeHandler.constraints, map.map(({ name }) => entry.entry(name, null)), fromEntries.fromEntries);
|
|
45
|
+
return transform.transform(newTypeHandler.dataParser, (value) => base.constrainedTypeKind.setTo(newType.newTypeKind.setTo(wrapValue.wrapValue(value), newTypeHandler.name), constraintKindValue));
|
|
46
|
+
}))), fromEntries.fromEntries, index.object, (dataParser) => transform.transform(dataParser, (value) => entityKind.setTo(value, name)));
|
|
47
|
+
function map$1(rawProperties) {
|
|
48
|
+
const result = mapDataParser.parse(rawProperties);
|
|
49
|
+
if (is.isLeft(result)) {
|
|
50
|
+
return create.left("createEntityError", unwrap$1.unwrap(result));
|
|
51
|
+
}
|
|
52
|
+
return create$1.right("createEntity", unwrap$1.unwrap(result));
|
|
53
|
+
}
|
|
54
|
+
function mapOrThrow(rawProperties) {
|
|
55
|
+
const result = mapDataParser.parse(rawProperties);
|
|
56
|
+
if (is.isLeft(result)) {
|
|
57
|
+
throw new CreateEntityError(rawProperties, unwrap$1.unwrap(result));
|
|
58
|
+
}
|
|
59
|
+
return unwrap$1.unwrap(result);
|
|
60
|
+
}
|
|
61
|
+
function is$1(input) {
|
|
62
|
+
return entityKind.has(input) && entityKind.getValue(input) === name;
|
|
63
|
+
}
|
|
64
|
+
function update(entity, newProperties) {
|
|
65
|
+
const updatedEntity = {};
|
|
66
|
+
for (const key in propertiesDefinition) {
|
|
67
|
+
updatedEntity[key] = newProperties[key] !== undefined
|
|
68
|
+
? newProperties[key]
|
|
69
|
+
: entity[key];
|
|
70
|
+
}
|
|
71
|
+
return entityKind.setTo(updatedEntity, name);
|
|
72
|
+
}
|
|
73
|
+
return pipe.pipe({
|
|
74
|
+
name,
|
|
75
|
+
propertiesDefinition,
|
|
76
|
+
mapDataParser,
|
|
77
|
+
new: theNew,
|
|
78
|
+
map: map$1,
|
|
79
|
+
mapOrThrow,
|
|
80
|
+
is: is$1,
|
|
81
|
+
update,
|
|
82
|
+
}, entityHandlerKind.setTo, createEntity.overrideHandler.apply);
|
|
83
|
+
}
|
|
84
|
+
createEntity.overrideHandler = override.createOverride("@duplojs/utils/clean/entity");
|
|
85
|
+
|
|
86
|
+
exports.entityPropertyArrayKind = property.entityPropertyArrayKind;
|
|
87
|
+
exports.entityPropertyDefinitionToDataParser = property.entityPropertyDefinitionToDataParser;
|
|
88
|
+
exports.entityPropertyDefinitionTools = property.entityPropertyDefinitionTools;
|
|
89
|
+
exports.entityPropertyNullableKind = property.entityPropertyNullableKind;
|
|
90
|
+
exports.entityPropertyStructureKind = property.entityPropertyStructureKind;
|
|
91
|
+
exports.entityPropertyUnionKind = property.entityPropertyUnionKind;
|
|
92
|
+
exports.CreateEntityError = CreateEntityError;
|
|
93
|
+
exports.createEntity = createEntity;
|
|
94
|
+
exports.entityKind = entityKind;
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { type SimplifyTopLevel, type Kind, type RemoveKind } from "../../common";
|
|
2
|
+
import * as DEither from "../../either";
|
|
3
|
+
import * as DDataParser from "../../dataParser";
|
|
4
|
+
import * as DObject from "../../object";
|
|
5
|
+
import { type EntityPropertyDefinition, type EntityProperty, type EntityRawProperty, type EntityInputRawProperty, entityPropertyDefinitionTools } from "./property";
|
|
6
|
+
export * from "./property";
|
|
7
|
+
export * from "./unwrap";
|
|
8
|
+
export type EntityPropertiesDefinition = Readonly<Record<string, EntityPropertyDefinition>>;
|
|
9
|
+
export type EntityProperties<GenericPropertiesDefinition extends EntityPropertiesDefinition = EntityPropertiesDefinition> = SimplifyTopLevel<{
|
|
10
|
+
readonly [Prop in keyof GenericPropertiesDefinition]: EntityProperty<GenericPropertiesDefinition[Prop]>;
|
|
11
|
+
}>;
|
|
12
|
+
export type EntityRawProperties<GenericPropertiesDefinition extends EntityPropertiesDefinition = EntityPropertiesDefinition> = SimplifyTopLevel<{
|
|
13
|
+
readonly [Prop in keyof GenericPropertiesDefinition]: EntityRawProperty<GenericPropertiesDefinition[Prop]>;
|
|
14
|
+
}>;
|
|
15
|
+
export type PropertiesToMapOfEntity<GenericPropertiesDefinition extends EntityPropertiesDefinition = EntityPropertiesDefinition> = SimplifyTopLevel<{
|
|
16
|
+
readonly [Prop in keyof GenericPropertiesDefinition]: EntityInputRawProperty<GenericPropertiesDefinition[Prop]>;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const entityKind: import("../../common").KindHandler<import("../../common").KindDefinition<"@DuplojsUtilsClean/entity", string>>;
|
|
19
|
+
export interface Entity<GenericName extends string = string> extends Kind<typeof entityKind.definition, GenericName> {
|
|
20
|
+
}
|
|
21
|
+
declare const entityHandlerKind: import("../../common").KindHandler<import("../../common").KindDefinition<"@DuplojsUtilsClean/entity-handler", unknown>>;
|
|
22
|
+
export interface EntityHandler<GenericName extends string = string, GenericPropertiesDefinition extends EntityPropertiesDefinition = EntityPropertiesDefinition> extends Kind<typeof entityHandlerKind.definition> {
|
|
23
|
+
/**
|
|
24
|
+
* The entity name used as a runtime identifier (for example "User").
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
readonly name: GenericName;
|
|
28
|
+
/**
|
|
29
|
+
* The properties schema returned by the definition callback.
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
readonly propertiesDefinition: GenericPropertiesDefinition;
|
|
33
|
+
readonly mapDataParser: DDataParser.Contract<EntityProperties<GenericPropertiesDefinition>, unknown>;
|
|
34
|
+
/**
|
|
35
|
+
* Builds an entity from already typed properties.
|
|
36
|
+
*
|
|
37
|
+
* ```ts
|
|
38
|
+
* preferences: structure({
|
|
39
|
+
* theme: PreferencesTheme,
|
|
40
|
+
* pinnedNick: nullable(Name),
|
|
41
|
+
* }),
|
|
42
|
+
* }));
|
|
43
|
+
* export type Entity = C.GetEntity<typeof Entity>;
|
|
44
|
+
*
|
|
45
|
+
* const defaultRole = Role.createOrThrow("client");
|
|
46
|
+
*
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
*/
|
|
50
|
+
"new"<const GenericProperties extends EntityProperties<GenericPropertiesDefinition>>(properties: GenericProperties): Entity<GenericName> & GenericProperties;
|
|
51
|
+
/**
|
|
52
|
+
* Validates permissive raw properties and returns an Either with the typed entity.
|
|
53
|
+
*
|
|
54
|
+
* ```ts
|
|
55
|
+
* });
|
|
56
|
+
* }
|
|
57
|
+
* }
|
|
58
|
+
*
|
|
59
|
+
* const mapped = User.Entity.mapOrThrow({
|
|
60
|
+
* id: 2,
|
|
61
|
+
* name: "Bob",
|
|
62
|
+
* roles: ["client"],
|
|
63
|
+
* nick: "Bobby",
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
*/
|
|
67
|
+
map(rawProperties: PropertiesToMapOfEntity<GenericPropertiesDefinition>): (DEither.Right<"createEntity", Entity<GenericName> & EntityProperties<GenericPropertiesDefinition>> | DEither.Left<"createEntityError", DDataParser.DataParserError>);
|
|
68
|
+
/**
|
|
69
|
+
* Validates permissive raw properties and throws on error.
|
|
70
|
+
*
|
|
71
|
+
* ```ts
|
|
72
|
+
* }) {
|
|
73
|
+
* return Entity.new({
|
|
74
|
+
* ...params,
|
|
75
|
+
* nick: null,
|
|
76
|
+
* roles: [defaultRole],
|
|
77
|
+
* preferences: {
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
*/
|
|
81
|
+
mapOrThrow(rawProperties: PropertiesToMapOfEntity<GenericPropertiesDefinition>): Entity<GenericName> & EntityProperties<GenericPropertiesDefinition>;
|
|
82
|
+
/**
|
|
83
|
+
* Checks if a value is an entity of this handler (type guard).
|
|
84
|
+
*
|
|
85
|
+
* ```ts
|
|
86
|
+
* pinnedNick: null,
|
|
87
|
+
* },
|
|
88
|
+
* });
|
|
89
|
+
* }
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
*/
|
|
93
|
+
is<GenericInput extends unknown>(input: GenericInput): input is Extract<GenericInput, Entity<GenericName>>;
|
|
94
|
+
/**
|
|
95
|
+
* Updates an entity by merging typed properties into an existing entity.
|
|
96
|
+
*
|
|
97
|
+
* ```ts
|
|
98
|
+
* const result = true ? mapped : null;
|
|
99
|
+
*
|
|
100
|
+
* if (User.Entity.is(result)) {
|
|
101
|
+
* // result: C.Entity<"User">
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
*/
|
|
105
|
+
update<const GenericEntity extends Entity<GenericName>, const GenericProperties extends Partial<EntityProperties<GenericPropertiesDefinition>>>(entity: GenericEntity, properties: GenericProperties): Entity<GenericName> & DObject.AssignObjects<RemoveKind<GenericEntity>, GenericProperties>;
|
|
106
|
+
}
|
|
107
|
+
declare const CreateEntityError_base: new (params: {
|
|
108
|
+
"@DuplojsUtilsError/create-entity-error"?: unknown;
|
|
109
|
+
}, parentParams: readonly [message?: string | undefined, options?: ErrorOptions | undefined]) => Error & Kind<import("../../common").KindDefinition<"create-entity-error", unknown>, unknown> & Kind<import("../../common").KindDefinition<"@DuplojsUtilsError/create-entity-error", unknown>, unknown>;
|
|
110
|
+
export declare class CreateEntityError extends CreateEntityError_base {
|
|
111
|
+
rawProperties: PropertiesToMapOfEntity;
|
|
112
|
+
dataParserError: DDataParser.DataParserError;
|
|
113
|
+
constructor(rawProperties: PropertiesToMapOfEntity, dataParserError: DDataParser.DataParserError);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Creates an entity handler from a property definition.
|
|
117
|
+
*
|
|
118
|
+
* **Supported call styles:**
|
|
119
|
+
* - Classic: `createEntity(name, getPropertiesDefinition)` -> returns a handler
|
|
120
|
+
*
|
|
121
|
+
* Entities model business structures by composing NewTypes. The handler builds entities from typed properties or from raw inputs with validation.
|
|
122
|
+
*
|
|
123
|
+
* ```ts
|
|
124
|
+
* namespace User {
|
|
125
|
+
* export const Id = C.createNewType("user-id", DP.number(), C.Positive);
|
|
126
|
+
* export type Id = C.GetNewType<typeof Id>;
|
|
127
|
+
* export const Name = C.createNewType("user-name", DP.string());
|
|
128
|
+
* export type Name = C.GetNewType<typeof Name>;
|
|
129
|
+
* export const Role = C.createNewType("UserRole", DP.literal(["admin", "client", "manager"]));
|
|
130
|
+
*
|
|
131
|
+
* export const PreferencesTheme = C.createNewType(
|
|
132
|
+
* "user-preferences-theme",
|
|
133
|
+
* DP.literal(["light", "dark"]),
|
|
134
|
+
* );
|
|
135
|
+
*
|
|
136
|
+
* export const Entity = C.createEntity("User", ({ array, nullable, structure }) => ({
|
|
137
|
+
* id: Id,
|
|
138
|
+
* name: Name,
|
|
139
|
+
* roles: array(Role, { min: 1 }),
|
|
140
|
+
* nick: nullable(Name),
|
|
141
|
+
* preferences: structure({
|
|
142
|
+
* theme: PreferencesTheme,
|
|
143
|
+
* pinnedNick: nullable(Name),
|
|
144
|
+
* }),
|
|
145
|
+
* }));
|
|
146
|
+
* export type Entity = C.GetEntity<typeof Entity>;
|
|
147
|
+
*
|
|
148
|
+
* const defaultRole = Role.createOrThrow("client");
|
|
149
|
+
*
|
|
150
|
+
* export function create(params: {
|
|
151
|
+
* id: Id;
|
|
152
|
+
* name: Name;
|
|
153
|
+
* }) {
|
|
154
|
+
* return Entity.new({
|
|
155
|
+
* ...params,
|
|
156
|
+
* nick: null,
|
|
157
|
+
* roles: [defaultRole],
|
|
158
|
+
* preferences: {
|
|
159
|
+
* theme: PreferencesTheme.createOrThrow("light"),
|
|
160
|
+
* pinnedNick: null,
|
|
161
|
+
* },
|
|
162
|
+
* });
|
|
163
|
+
* }
|
|
164
|
+
* }
|
|
165
|
+
*
|
|
166
|
+
* const mapped = User.Entity.mapOrThrow({
|
|
167
|
+
* id: 2,
|
|
168
|
+
* name: "Bob",
|
|
169
|
+
* roles: ["client"],
|
|
170
|
+
* nick: "Bobby",
|
|
171
|
+
* preferences: {
|
|
172
|
+
* theme: "dark",
|
|
173
|
+
* pinnedNick: null,
|
|
174
|
+
* },
|
|
175
|
+
* });
|
|
176
|
+
*
|
|
177
|
+
* const result = true ? mapped : null;
|
|
178
|
+
*
|
|
179
|
+
* if (User.Entity.is(result)) {
|
|
180
|
+
* // result: C.Entity<"User">
|
|
181
|
+
* }
|
|
182
|
+
*
|
|
183
|
+
* const mappedResult = User.Entity.map({
|
|
184
|
+
* id: 3,
|
|
185
|
+
* name: "Eve",
|
|
186
|
+
* roles: ["manager"],
|
|
187
|
+
* nick: null,
|
|
188
|
+
* preferences: {
|
|
189
|
+
* theme: "light",
|
|
190
|
+
* pinnedNick: "Evy",
|
|
191
|
+
* },
|
|
192
|
+
* });
|
|
193
|
+
*
|
|
194
|
+
* if (E.isRight(mappedResult)) {
|
|
195
|
+
* // mappedResult: E.Right<"createEntity", C.Entity<"User">>
|
|
196
|
+
* }
|
|
197
|
+
*
|
|
198
|
+
* const updated = User.Entity.update(mapped, {
|
|
199
|
+
* name: User.Name.createOrThrow("Bobby"),
|
|
200
|
+
* nick: null,
|
|
201
|
+
* });
|
|
202
|
+
* ```
|
|
203
|
+
*
|
|
204
|
+
* @remarks
|
|
205
|
+
* - The definition callback can use helpers like `array`, `nullable`, `union`, and `structure` to enrich properties.
|
|
206
|
+
* - Use `map`/`mapOrThrow` to build from raw inputs (with runtime constraint checks); `new` expects already typed values.
|
|
207
|
+
*
|
|
208
|
+
* @see https://utils.duplojs.dev/en/v1/api/clean/entity
|
|
209
|
+
*
|
|
210
|
+
* @namespace C
|
|
211
|
+
*
|
|
212
|
+
*/
|
|
213
|
+
export declare function createEntity<GenericName extends string, const GenericPropertiesDefinition extends EntityPropertiesDefinition>(name: GenericName, getPropertiesDefinition: (params: typeof entityPropertyDefinitionTools) => GenericPropertiesDefinition & DObject.ForbiddenKey<GenericPropertiesDefinition, "_entityName" | "_flags">): EntityHandler<GenericName, GenericPropertiesDefinition>;
|
|
214
|
+
export declare namespace createEntity {
|
|
215
|
+
var overrideHandler: import("../../common").OverrideHandler<EntityHandler<string, Readonly<Record<string, EntityPropertyDefinition>>>>;
|
|
216
|
+
}
|
|
217
|
+
export type GetEntity<GenericEntityHandler extends EntityHandler<string, any>> = Extract<ReturnType<GenericEntityHandler["new"]>, any>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { createCleanKind } from '../kind.mjs';
|
|
2
|
+
import { newTypeKind } from '../newType.mjs';
|
|
3
|
+
import { entityPropertyDefinitionTools, entityPropertyDefinitionToDataParser } from './property.mjs';
|
|
4
|
+
export { entityPropertyArrayKind, entityPropertyNullableKind, entityPropertyStructureKind, entityPropertyUnionKind } from './property.mjs';
|
|
5
|
+
import { kindHeritage } from '../../common/kind.mjs';
|
|
6
|
+
import { pipe } from '../../common/pipe.mjs';
|
|
7
|
+
import { map } from '../../array/map.mjs';
|
|
8
|
+
import { entry } from '../../object/entry.mjs';
|
|
9
|
+
import { fromEntries } from '../../object/fromEntries.mjs';
|
|
10
|
+
import { transform } from '../../dataParser/parsers/transform.mjs';
|
|
11
|
+
import { entries } from '../../object/entries.mjs';
|
|
12
|
+
import { forward } from '../../common/forward.mjs';
|
|
13
|
+
import { createErrorKind } from '../../common/errorKindNamespace.mjs';
|
|
14
|
+
import { object } from '../../dataParser/parsers/object/index.mjs';
|
|
15
|
+
import { constrainedTypeKind } from '../constraint/base.mjs';
|
|
16
|
+
import { wrapValue } from '../../common/wrapValue.mjs';
|
|
17
|
+
import { createOverride } from '../../common/override.mjs';
|
|
18
|
+
import { isLeft } from '../../either/left/is.mjs';
|
|
19
|
+
import { unwrap } from '../../common/unwrap.mjs';
|
|
20
|
+
import { left } from '../../either/left/create.mjs';
|
|
21
|
+
import { right } from '../../either/right/create.mjs';
|
|
22
|
+
|
|
23
|
+
const entityKind = createCleanKind("entity");
|
|
24
|
+
const entityHandlerKind = createCleanKind("entity-handler");
|
|
25
|
+
class CreateEntityError extends kindHeritage("create-entity-error", createErrorKind("create-entity-error"), Error) {
|
|
26
|
+
rawProperties;
|
|
27
|
+
dataParserError;
|
|
28
|
+
constructor(rawProperties, dataParserError) {
|
|
29
|
+
super({}, ["Error when create entity."]);
|
|
30
|
+
this.rawProperties = rawProperties;
|
|
31
|
+
this.dataParserError = dataParserError;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* {@include clean/createEntity/index.md}
|
|
36
|
+
*/
|
|
37
|
+
function createEntity(name, getPropertiesDefinition) {
|
|
38
|
+
function theNew(properties) {
|
|
39
|
+
return entityKind.addTo(properties, name);
|
|
40
|
+
}
|
|
41
|
+
const propertiesDefinition = getPropertiesDefinition(entityPropertyDefinitionTools);
|
|
42
|
+
const mapDataParser = pipe(forward(propertiesDefinition), entries, map(([key, property]) => entry(key, entityPropertyDefinitionToDataParser(property, (newTypeHandler) => {
|
|
43
|
+
const constraintKindValue = pipe(newTypeHandler.constraints, map(({ name }) => entry(name, null)), fromEntries);
|
|
44
|
+
return transform(newTypeHandler.dataParser, (value) => constrainedTypeKind.setTo(newTypeKind.setTo(wrapValue(value), newTypeHandler.name), constraintKindValue));
|
|
45
|
+
}))), fromEntries, object, (dataParser) => transform(dataParser, (value) => entityKind.setTo(value, name)));
|
|
46
|
+
function map$1(rawProperties) {
|
|
47
|
+
const result = mapDataParser.parse(rawProperties);
|
|
48
|
+
if (isLeft(result)) {
|
|
49
|
+
return left("createEntityError", unwrap(result));
|
|
50
|
+
}
|
|
51
|
+
return right("createEntity", unwrap(result));
|
|
52
|
+
}
|
|
53
|
+
function mapOrThrow(rawProperties) {
|
|
54
|
+
const result = mapDataParser.parse(rawProperties);
|
|
55
|
+
if (isLeft(result)) {
|
|
56
|
+
throw new CreateEntityError(rawProperties, unwrap(result));
|
|
57
|
+
}
|
|
58
|
+
return unwrap(result);
|
|
59
|
+
}
|
|
60
|
+
function is(input) {
|
|
61
|
+
return entityKind.has(input) && entityKind.getValue(input) === name;
|
|
62
|
+
}
|
|
63
|
+
function update(entity, newProperties) {
|
|
64
|
+
const updatedEntity = {};
|
|
65
|
+
for (const key in propertiesDefinition) {
|
|
66
|
+
updatedEntity[key] = newProperties[key] !== undefined
|
|
67
|
+
? newProperties[key]
|
|
68
|
+
: entity[key];
|
|
69
|
+
}
|
|
70
|
+
return entityKind.setTo(updatedEntity, name);
|
|
71
|
+
}
|
|
72
|
+
return pipe({
|
|
73
|
+
name,
|
|
74
|
+
propertiesDefinition,
|
|
75
|
+
mapDataParser,
|
|
76
|
+
new: theNew,
|
|
77
|
+
map: map$1,
|
|
78
|
+
mapOrThrow,
|
|
79
|
+
is,
|
|
80
|
+
update,
|
|
81
|
+
}, entityHandlerKind.setTo, createEntity.overrideHandler.apply);
|
|
82
|
+
}
|
|
83
|
+
createEntity.overrideHandler = createOverride("@duplojs/utils/clean/entity");
|
|
84
|
+
|
|
85
|
+
export { CreateEntityError, createEntity, entityKind, entityPropertyDefinitionToDataParser, entityPropertyDefinitionTools };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var newType = require('../newType.cjs');
|
|
4
|
+
var kind = require('../kind.cjs');
|
|
5
|
+
var pipe = require('../../common/pipe.cjs');
|
|
6
|
+
var wrapValue = require('../../common/wrapValue.cjs');
|
|
7
|
+
var when = require('../../pattern/when.cjs');
|
|
8
|
+
var unwrap = require('../../common/unwrap.cjs');
|
|
9
|
+
var entries = require('../../object/entries.cjs');
|
|
10
|
+
var map = require('../../array/map.cjs');
|
|
11
|
+
var entry = require('../../object/entry.cjs');
|
|
12
|
+
var fromEntries = require('../../object/fromEntries.cjs');
|
|
13
|
+
var index = require('../../dataParser/parsers/object/index.cjs');
|
|
14
|
+
var index$1 = require('../../dataParser/parsers/array/index.cjs');
|
|
15
|
+
var min = require('../../dataParser/parsers/array/checkers/min.cjs');
|
|
16
|
+
var max = require('../../dataParser/parsers/array/checkers/max.cjs');
|
|
17
|
+
var nullable = require('../../dataParser/parsers/nullable.cjs');
|
|
18
|
+
var union = require('../../dataParser/parsers/union.cjs');
|
|
19
|
+
var exhaustive = require('../../pattern/exhaustive.cjs');
|
|
20
|
+
|
|
21
|
+
const entityPropertyUnionKind = kind.createCleanKind("entity-property-union");
|
|
22
|
+
const entityPropertyNullableKind = kind.createCleanKind("entity-property-nullable");
|
|
23
|
+
const entityPropertyArrayKind = kind.createCleanKind("entity-property-array");
|
|
24
|
+
const entityPropertyStructureKind = kind.createCleanKind("entity-property-structure");
|
|
25
|
+
const entityPropertyDefinitionTools = {
|
|
26
|
+
union(...definitions) {
|
|
27
|
+
return pipe.pipe(definitions, wrapValue.wrapValue, entityPropertyUnionKind.setTo);
|
|
28
|
+
},
|
|
29
|
+
nullable(definition) {
|
|
30
|
+
return pipe.pipe(definition, wrapValue.wrapValue, entityPropertyNullableKind.setTo);
|
|
31
|
+
},
|
|
32
|
+
array(definition, params = {}) {
|
|
33
|
+
return pipe.pipe(definition, wrapValue.wrapValue, (value) => entityPropertyArrayKind.setTo(value, params));
|
|
34
|
+
},
|
|
35
|
+
structure(definition) {
|
|
36
|
+
return pipe.pipe(definition, wrapValue.wrapValue, entityPropertyStructureKind.setTo);
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
function entityPropertyDefinitionToDataParser(propertyDefinition, treatNewTypeHandler) {
|
|
40
|
+
return pipe.pipe(propertyDefinition, when.when(newType.newTypeHandlerKind.has, treatNewTypeHandler), when.when(entityPropertyUnionKind.has, (union$1) => {
|
|
41
|
+
const [firstInnerProperty, ...restInnerProperty] = unwrap.unwrap(union$1);
|
|
42
|
+
return union.union([
|
|
43
|
+
entityPropertyDefinitionToDataParser(firstInnerProperty, treatNewTypeHandler),
|
|
44
|
+
...map.map(restInnerProperty, (innerProperty) => entityPropertyDefinitionToDataParser(innerProperty, treatNewTypeHandler)),
|
|
45
|
+
]);
|
|
46
|
+
}), when.when(entityPropertyNullableKind.has, (nullable$1) => nullable.nullable(entityPropertyDefinitionToDataParser(unwrap.unwrap(nullable$1), treatNewTypeHandler))), when.when(entityPropertyArrayKind.has, (array) => {
|
|
47
|
+
const params = entityPropertyArrayKind.getValue(array);
|
|
48
|
+
return index$1.array(entityPropertyDefinitionToDataParser(unwrap.unwrap(array), treatNewTypeHandler), {
|
|
49
|
+
checkers: [
|
|
50
|
+
...(params.min !== undefined
|
|
51
|
+
? [min.checkerArrayMin(params.min)]
|
|
52
|
+
: []),
|
|
53
|
+
...(params.max !== undefined
|
|
54
|
+
? [max.checkerArrayMax(params.max)]
|
|
55
|
+
: []),
|
|
56
|
+
],
|
|
57
|
+
});
|
|
58
|
+
}), when.when(entityPropertyStructureKind.has, (structure) => pipe.pipe(structure, unwrap.unwrap, entries.entries, map.map(([key, value]) => entry.entry(key, entityPropertyDefinitionToDataParser(value, treatNewTypeHandler))), fromEntries.fromEntries, index.object)), exhaustive.exhaustive);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
exports.entityPropertyArrayKind = entityPropertyArrayKind;
|
|
62
|
+
exports.entityPropertyDefinitionToDataParser = entityPropertyDefinitionToDataParser;
|
|
63
|
+
exports.entityPropertyDefinitionTools = entityPropertyDefinitionTools;
|
|
64
|
+
exports.entityPropertyNullableKind = entityPropertyNullableKind;
|
|
65
|
+
exports.entityPropertyStructureKind = entityPropertyStructureKind;
|
|
66
|
+
exports.entityPropertyUnionKind = entityPropertyUnionKind;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type GetNewType, type NewTypeHandler } from "../newType";
|
|
2
|
+
import { type WrappedValue, type Kind, type AnyTuple, type Unwrap, type GetKindValue, type IsEqual } from "../../common";
|
|
3
|
+
import * as DDataParser from "../../dataParser";
|
|
4
|
+
import * as DArray from "../../array";
|
|
5
|
+
export type EntityPropertyDefinition = (NewTypeHandler | EntityPropertyDefinitionUnion | EntityPropertyDefinitionNullable | EntityPropertyDefinitionArray | EntityPropertyDefinitionStructure);
|
|
6
|
+
export declare const entityPropertyUnionKind: import("../../common").KindHandler<import("../../common").KindDefinition<"@DuplojsUtilsClean/entity-property-union", unknown>>;
|
|
7
|
+
export interface EntityPropertyDefinitionUnion<GenericPropertyDefinition extends AnyTuple<EntityPropertyDefinition> = AnyTuple<EntityPropertyDefinition>> extends Kind<typeof entityPropertyUnionKind.definition>, WrappedValue<GenericPropertyDefinition> {
|
|
8
|
+
}
|
|
9
|
+
export declare const entityPropertyNullableKind: import("../../common").KindHandler<import("../../common").KindDefinition<"@DuplojsUtilsClean/entity-property-nullable", unknown>>;
|
|
10
|
+
export interface EntityPropertyDefinitionNullable<GenericPropertyDefinition extends EntityPropertyDefinition = EntityPropertyDefinition> extends Kind<typeof entityPropertyNullableKind.definition>, WrappedValue<GenericPropertyDefinition> {
|
|
11
|
+
}
|
|
12
|
+
export interface EntityPropertyDefinitionArrayParams {
|
|
13
|
+
readonly min?: number;
|
|
14
|
+
readonly max?: number;
|
|
15
|
+
}
|
|
16
|
+
export declare const entityPropertyArrayKind: import("../../common").KindHandler<import("../../common").KindDefinition<"@DuplojsUtilsClean/entity-property-array", EntityPropertyDefinitionArrayParams>>;
|
|
17
|
+
export interface EntityPropertyDefinitionArray<GenericPropertyDefinition extends EntityPropertyDefinition = EntityPropertyDefinition, GenericParams extends EntityPropertyDefinitionArrayParams = EntityPropertyDefinitionArrayParams> extends Kind<typeof entityPropertyArrayKind.definition, GenericParams>, WrappedValue<GenericPropertyDefinition> {
|
|
18
|
+
}
|
|
19
|
+
export declare const entityPropertyStructureKind: import("../../common").KindHandler<import("../../common").KindDefinition<"@DuplojsUtilsClean/entity-property-structure", unknown>>;
|
|
20
|
+
export interface EntityPropertyDefinitionStructure<GenericPropertyDefinition extends Record<string, EntityPropertyDefinition> = Record<string, EntityPropertyDefinition>> extends Kind<typeof entityPropertyStructureKind.definition>, WrappedValue<GenericPropertyDefinition> {
|
|
21
|
+
}
|
|
22
|
+
export type EntityProperty<GenericProperty extends EntityPropertyDefinition = EntityPropertyDefinition> = IsEqual<GenericProperty, EntityPropertyDefinition> extends true ? unknown : GenericProperty extends NewTypeHandler ? GetNewType<GenericProperty> : GenericProperty extends EntityPropertyDefinitionUnion ? EntityProperty<Unwrap<GenericProperty>[number]> : GenericProperty extends EntityPropertyDefinitionNullable ? EntityProperty<Unwrap<GenericProperty>> | null : GenericProperty extends EntityPropertyDefinitionArray ? GetKindValue<typeof entityPropertyArrayKind, GenericProperty>["min"] extends number ? EntityProperty<Unwrap<GenericProperty>> extends infer InferredEntityProperty ? readonly [
|
|
23
|
+
...DArray.CreateTuple<InferredEntityProperty, GetKindValue<typeof entityPropertyArrayKind, GenericProperty>["min"]>,
|
|
24
|
+
...InferredEntityProperty[]
|
|
25
|
+
] : never : readonly EntityProperty<Unwrap<GenericProperty>>[] : GenericProperty extends EntityPropertyDefinitionStructure ? Unwrap<GenericProperty> extends infer InferredShape extends Record<string, any> ? {
|
|
26
|
+
readonly [Prop in keyof InferredShape]: EntityProperty<InferredShape[Prop]>;
|
|
27
|
+
} : never : never;
|
|
28
|
+
export type EntityRawProperty<GenericProperty extends EntityPropertyDefinition = EntityPropertyDefinition> = IsEqual<GenericProperty, EntityPropertyDefinition> extends true ? any : GenericProperty extends NewTypeHandler ? Unwrap<GetNewType<GenericProperty>> : GenericProperty extends EntityPropertyDefinitionUnion ? EntityRawProperty<Unwrap<GenericProperty>[number]> : GenericProperty extends EntityPropertyDefinitionNullable ? EntityRawProperty<Unwrap<GenericProperty>> | null : GenericProperty extends EntityPropertyDefinitionArray ? GetKindValue<typeof entityPropertyArrayKind, GenericProperty>["min"] extends number ? EntityRawProperty<Unwrap<GenericProperty>> extends infer InferredEntityProperty ? readonly [
|
|
29
|
+
...DArray.CreateTuple<InferredEntityProperty, GetKindValue<typeof entityPropertyArrayKind, GenericProperty>["min"]>,
|
|
30
|
+
...InferredEntityProperty[]
|
|
31
|
+
] : never : readonly EntityRawProperty<Unwrap<GenericProperty>>[] : GenericProperty extends EntityPropertyDefinitionStructure ? Unwrap<GenericProperty> extends infer InferredEntityShape extends Record<string, any> ? {
|
|
32
|
+
readonly [Prop in keyof InferredEntityShape]: EntityRawProperty<InferredEntityShape[Prop]>;
|
|
33
|
+
} : never : never;
|
|
34
|
+
export type EntityInputRawProperty<GenericProperty extends EntityPropertyDefinition = EntityPropertyDefinition> = IsEqual<GenericProperty, EntityPropertyDefinition> extends true ? any : GenericProperty extends NewTypeHandler<any, infer InferredValue, any, infer InferredInput> ? IsEqual<InferredInput, never> extends true ? InferredValue : InferredInput : GenericProperty extends EntityPropertyDefinitionUnion ? EntityInputRawProperty<Unwrap<GenericProperty>[number]> : GenericProperty extends EntityPropertyDefinitionNullable ? EntityInputRawProperty<Unwrap<GenericProperty>> | null : GenericProperty extends EntityPropertyDefinitionArray ? readonly EntityInputRawProperty<Unwrap<GenericProperty>>[] : GenericProperty extends EntityPropertyDefinitionStructure ? Unwrap<GenericProperty> extends infer InferredShape extends Record<string, any> ? {
|
|
35
|
+
readonly [Prop in keyof InferredShape]: EntityInputRawProperty<InferredShape[Prop]>;
|
|
36
|
+
} : never : never;
|
|
37
|
+
export declare const entityPropertyDefinitionTools: {
|
|
38
|
+
union<const GenericDefinitionValue extends AnyTuple<EntityPropertyDefinition>>(...definitions: GenericDefinitionValue): EntityPropertyDefinitionUnion<GenericDefinitionValue>;
|
|
39
|
+
nullable<const GenericDefinitionValue extends EntityPropertyDefinition>(definition: GenericDefinitionValue): EntityPropertyDefinitionNullable<GenericDefinitionValue>;
|
|
40
|
+
array<const GenericDefinitionValue extends EntityPropertyDefinition, const GenericParams extends EntityPropertyDefinitionArrayParams = {}>(definition: GenericDefinitionValue, params?: GenericParams): EntityPropertyDefinitionArray<GenericDefinitionValue, GenericParams>;
|
|
41
|
+
structure<const GenericDefinitionValue extends Record<string, EntityPropertyDefinition>>(definition: GenericDefinitionValue): EntityPropertyDefinitionStructure<GenericDefinitionValue>;
|
|
42
|
+
};
|
|
43
|
+
export declare function entityPropertyDefinitionToDataParser(propertyDefinition: EntityPropertyDefinition, treatNewTypeHandler: (newTypeHandler: NewTypeHandler) => DDataParser.DataParser): DDataParser.DataParser;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { newTypeHandlerKind } from '../newType.mjs';
|
|
2
|
+
import { createCleanKind } from '../kind.mjs';
|
|
3
|
+
import { pipe } from '../../common/pipe.mjs';
|
|
4
|
+
import { wrapValue } from '../../common/wrapValue.mjs';
|
|
5
|
+
import { when } from '../../pattern/when.mjs';
|
|
6
|
+
import { unwrap } from '../../common/unwrap.mjs';
|
|
7
|
+
import { entries } from '../../object/entries.mjs';
|
|
8
|
+
import { map } from '../../array/map.mjs';
|
|
9
|
+
import { entry } from '../../object/entry.mjs';
|
|
10
|
+
import { fromEntries } from '../../object/fromEntries.mjs';
|
|
11
|
+
import { object } from '../../dataParser/parsers/object/index.mjs';
|
|
12
|
+
import { array } from '../../dataParser/parsers/array/index.mjs';
|
|
13
|
+
import { checkerArrayMin } from '../../dataParser/parsers/array/checkers/min.mjs';
|
|
14
|
+
import { checkerArrayMax } from '../../dataParser/parsers/array/checkers/max.mjs';
|
|
15
|
+
import { nullable } from '../../dataParser/parsers/nullable.mjs';
|
|
16
|
+
import { union } from '../../dataParser/parsers/union.mjs';
|
|
17
|
+
import { exhaustive } from '../../pattern/exhaustive.mjs';
|
|
18
|
+
|
|
19
|
+
const entityPropertyUnionKind = createCleanKind("entity-property-union");
|
|
20
|
+
const entityPropertyNullableKind = createCleanKind("entity-property-nullable");
|
|
21
|
+
const entityPropertyArrayKind = createCleanKind("entity-property-array");
|
|
22
|
+
const entityPropertyStructureKind = createCleanKind("entity-property-structure");
|
|
23
|
+
const entityPropertyDefinitionTools = {
|
|
24
|
+
union(...definitions) {
|
|
25
|
+
return pipe(definitions, wrapValue, entityPropertyUnionKind.setTo);
|
|
26
|
+
},
|
|
27
|
+
nullable(definition) {
|
|
28
|
+
return pipe(definition, wrapValue, entityPropertyNullableKind.setTo);
|
|
29
|
+
},
|
|
30
|
+
array(definition, params = {}) {
|
|
31
|
+
return pipe(definition, wrapValue, (value) => entityPropertyArrayKind.setTo(value, params));
|
|
32
|
+
},
|
|
33
|
+
structure(definition) {
|
|
34
|
+
return pipe(definition, wrapValue, entityPropertyStructureKind.setTo);
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
function entityPropertyDefinitionToDataParser(propertyDefinition, treatNewTypeHandler) {
|
|
38
|
+
return pipe(propertyDefinition, when(newTypeHandlerKind.has, treatNewTypeHandler), when(entityPropertyUnionKind.has, (union$1) => {
|
|
39
|
+
const [firstInnerProperty, ...restInnerProperty] = unwrap(union$1);
|
|
40
|
+
return union([
|
|
41
|
+
entityPropertyDefinitionToDataParser(firstInnerProperty, treatNewTypeHandler),
|
|
42
|
+
...map(restInnerProperty, (innerProperty) => entityPropertyDefinitionToDataParser(innerProperty, treatNewTypeHandler)),
|
|
43
|
+
]);
|
|
44
|
+
}), when(entityPropertyNullableKind.has, (nullable$1) => nullable(entityPropertyDefinitionToDataParser(unwrap(nullable$1), treatNewTypeHandler))), when(entityPropertyArrayKind.has, (array$1) => {
|
|
45
|
+
const params = entityPropertyArrayKind.getValue(array$1);
|
|
46
|
+
return array(entityPropertyDefinitionToDataParser(unwrap(array$1), treatNewTypeHandler), {
|
|
47
|
+
checkers: [
|
|
48
|
+
...(params.min !== undefined
|
|
49
|
+
? [checkerArrayMin(params.min)]
|
|
50
|
+
: []),
|
|
51
|
+
...(params.max !== undefined
|
|
52
|
+
? [checkerArrayMax(params.max)]
|
|
53
|
+
: []),
|
|
54
|
+
],
|
|
55
|
+
});
|
|
56
|
+
}), when(entityPropertyStructureKind.has, (structure) => pipe(structure, unwrap, entries, map(([key, value]) => entry(key, entityPropertyDefinitionToDataParser(value, treatNewTypeHandler))), fromEntries, object)), exhaustive);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { entityPropertyArrayKind, entityPropertyDefinitionToDataParser, entityPropertyDefinitionTools, entityPropertyNullableKind, entityPropertyStructureKind, entityPropertyUnionKind };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index.cjs');
|
|
4
|
+
var flag = require('../flag.cjs');
|
|
5
|
+
var wrapValue = require('../../common/wrapValue.cjs');
|
|
6
|
+
var unwrap = require('../../common/unwrap.cjs');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* {@include clean/unwrapEntity/index.md}
|
|
10
|
+
*/
|
|
11
|
+
function unwrapEntityProperty(property, params) {
|
|
12
|
+
if (wrapValue.isWrappedValue(property)) {
|
|
13
|
+
return params?.transformer
|
|
14
|
+
? params.transformer(unwrap.unwrap(property))
|
|
15
|
+
: unwrap.unwrap(property);
|
|
16
|
+
}
|
|
17
|
+
else if (property === null) {
|
|
18
|
+
return property;
|
|
19
|
+
}
|
|
20
|
+
else if (property instanceof Array) {
|
|
21
|
+
const length = property.length;
|
|
22
|
+
const result = [];
|
|
23
|
+
for (let index = 0; index < length; index++) {
|
|
24
|
+
result[index] = unwrapEntityProperty(property[index], params);
|
|
25
|
+
}
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
else if (typeof property === "object"
|
|
29
|
+
&& (!property.constructor
|
|
30
|
+
|| property.constructor.name === "Object")) {
|
|
31
|
+
const result = {};
|
|
32
|
+
for (const key in property) {
|
|
33
|
+
result[key] = unwrapEntityProperty(property[key], params);
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
return property;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function unwrapEntity(entity, params) {
|
|
42
|
+
const unwrapEntity = {};
|
|
43
|
+
for (const prop in entity) {
|
|
44
|
+
if (prop === index.entityKind.runTimeKey) {
|
|
45
|
+
unwrapEntity._entityName = entity[prop];
|
|
46
|
+
}
|
|
47
|
+
else if (prop === flag.flagKind.runTimeKey) {
|
|
48
|
+
unwrapEntity._flags = entity[prop];
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
unwrapEntity[prop] = unwrapEntityProperty(entity[prop], params);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return unwrapEntity;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
exports.unwrapEntity = unwrapEntity;
|
|
58
|
+
exports.unwrapEntityProperty = unwrapEntityProperty;
|