@cubicweb/client 1.2.2 → 1.5.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.
- package/lib/api/Api.d.ts +87 -3
- package/lib/api/Api.d.ts.map +1 -1
- package/lib/api/Api.js +99 -10
- package/lib/api/Api.js.map +1 -1
- package/lib/api/Client.d.ts +39 -1
- package/lib/api/Client.d.ts.map +1 -1
- package/lib/api/Client.js +41 -1
- package/lib/api/Client.js.map +1 -1
- package/lib/api/Transaction.d.ts +42 -0
- package/lib/api/Transaction.d.ts.map +1 -1
- package/lib/api/Transaction.js +42 -0
- package/lib/api/Transaction.js.map +1 -1
- package/lib/index.d.ts +9 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +13 -9
- package/lib/index.js.map +1 -1
- package/lib/schema/classes/EntitySchema.d.ts +71 -0
- package/lib/schema/classes/EntitySchema.d.ts.map +1 -0
- package/lib/schema/classes/EntitySchema.js +83 -0
- package/lib/schema/classes/EntitySchema.js.map +1 -0
- package/lib/schema/classes/RelationDefinitionSchema.d.ts +87 -0
- package/lib/schema/classes/RelationDefinitionSchema.d.ts.map +1 -0
- package/lib/schema/classes/RelationDefinitionSchema.js +128 -0
- package/lib/schema/classes/RelationDefinitionSchema.js.map +1 -0
- package/lib/schema/classes/Schema.d.ts +54 -0
- package/lib/schema/classes/Schema.d.ts.map +1 -0
- package/lib/schema/classes/Schema.js +75 -0
- package/lib/schema/classes/Schema.js.map +1 -0
- package/lib/schema/classes/Utils.d.ts +30 -0
- package/lib/schema/classes/Utils.d.ts.map +1 -0
- package/lib/schema/classes/Utils.js +25 -0
- package/lib/schema/classes/Utils.js.map +1 -0
- package/lib/schema/raw/Constraints.d.ts +58 -0
- package/lib/schema/raw/Constraints.d.ts.map +1 -0
- package/lib/schema/raw/Constraints.js +3 -0
- package/lib/schema/raw/Constraints.js.map +1 -0
- package/lib/schema/raw/Entities.d.ts +13 -0
- package/lib/schema/raw/Entities.d.ts.map +1 -0
- package/lib/schema/{SchemaJSON.js → raw/Entities.js} +1 -1
- package/lib/schema/raw/Entities.js.map +1 -0
- package/lib/schema/raw/RelationDefinitions.d.ts +113 -0
- package/lib/schema/raw/RelationDefinitions.d.ts.map +1 -0
- package/lib/schema/raw/RelationDefinitions.js +3 -0
- package/lib/schema/raw/RelationDefinitions.js.map +1 -0
- package/lib/schema/raw/Schema.d.ts +13 -0
- package/lib/schema/raw/Schema.d.ts.map +1 -0
- package/lib/schema/raw/Schema.js +3 -0
- package/lib/schema/raw/Schema.js.map +1 -0
- package/lib/schema/raw/Utils.d.ts +22 -0
- package/lib/schema/raw/Utils.d.ts.map +1 -0
- package/lib/schema/raw/Utils.js +3 -0
- package/lib/schema/raw/Utils.js.map +1 -0
- package/package.json +1 -1
- package/src/api/Api.ts +128 -15
- package/src/api/Client.ts +42 -1
- package/src/api/Transaction.ts +42 -0
- package/src/index.ts +15 -8
- package/src/schema/classes/EntitySchema.ts +125 -0
- package/src/schema/classes/RelationDefinitionSchema.ts +156 -0
- package/src/schema/classes/Schema.ts +122 -0
- package/src/schema/classes/Utils.ts +52 -0
- package/src/schema/raw/Constraints.ts +77 -0
- package/src/schema/raw/Entities.ts +13 -0
- package/src/schema/raw/RelationDefinitions.ts +157 -0
- package/src/schema/raw/Schema.ts +16 -0
- package/src/schema/raw/Utils.ts +33 -0
- package/lib/schema/Schema.d.ts +0 -147
- package/lib/schema/Schema.d.ts.map +0 -1
- package/lib/schema/Schema.js +0 -240
- package/lib/schema/Schema.js.map +0 -1
- package/lib/schema/SchemaJSON.d.ts +0 -121
- package/lib/schema/SchemaJSON.d.ts.map +0 -1
- package/lib/schema/SchemaJSON.js.map +0 -1
- package/src/schema/Schema.ts +0 -352
- package/src/schema/SchemaJSON.ts +0 -195
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { AttributeConstraint, RelationConstraint } from "./Constraints";
|
|
2
|
+
import { EntityRawSchema, EntityRawSchemaArray } from "./Entities";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Type representing all the possible cardinalities in CubicWeb.
|
|
6
|
+
*/
|
|
7
|
+
export type Cardinality = "*" | "1" | "?" | "+";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Type representing a cardinality pair as used in relation definitions.
|
|
11
|
+
*/
|
|
12
|
+
export type CardinalityPair = `${Cardinality}${Cardinality}`;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Type used as a base to build final relation definitions with primitive types (Int, String, ...).
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
type BuildObjBase<T extends string> = {
|
|
20
|
+
object: T;
|
|
21
|
+
final: true;
|
|
22
|
+
required?: boolean;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
interface StringBuildObj extends BuildObjBase<"String"> {
|
|
26
|
+
default: string | null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface PasswordBuildObj extends BuildObjBase<"Password"> {
|
|
30
|
+
default: string | null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface BytesBuildObj extends BuildObjBase<"Bytes"> {
|
|
34
|
+
default: string | null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface IntBuildObj extends BuildObjBase<"Int"> {
|
|
38
|
+
default: number | null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface BigIntBuildObj extends BuildObjBase<"BigInt"> {
|
|
42
|
+
default: number | null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface FloatBuildObj extends BuildObjBase<"Float"> {
|
|
46
|
+
default: number | null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
interface BooleanBuildObj extends BuildObjBase<"Boolean"> {
|
|
50
|
+
default: boolean | null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
interface DecimalBuildObj extends BuildObjBase<"Decimal"> {
|
|
54
|
+
default: number | null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
interface DateBuildObj extends BuildObjBase<"Date"> {
|
|
58
|
+
default: unknown;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
interface TimeBuildObj extends BuildObjBase<"Time"> {
|
|
62
|
+
default: unknown;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
interface DatetimeBuildObj extends BuildObjBase<"Datetime"> {
|
|
66
|
+
default: Date | "NOW" | "TODAY" | null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
interface TZTimeBuildObj extends BuildObjBase<"TZTime"> {
|
|
70
|
+
default: unknown;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
interface TZDatetimeBuildObj extends BuildObjBase<"TZDatetime"> {
|
|
74
|
+
default: unknown;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
interface IntervalBuildObj extends BuildObjBase<"Interval"> {
|
|
78
|
+
default: unknown;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Type allowing to link the type of an object to the type of their default values in a
|
|
83
|
+
* relation definition. It only works for final relations using primitive types.
|
|
84
|
+
*
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
export type BuildObj = Readonly<
|
|
88
|
+
| StringBuildObj
|
|
89
|
+
| PasswordBuildObj
|
|
90
|
+
| BytesBuildObj
|
|
91
|
+
| IntBuildObj
|
|
92
|
+
| BigIntBuildObj
|
|
93
|
+
| FloatBuildObj
|
|
94
|
+
| BooleanBuildObj
|
|
95
|
+
| DecimalBuildObj
|
|
96
|
+
| DateBuildObj
|
|
97
|
+
| TimeBuildObj
|
|
98
|
+
| DatetimeBuildObj
|
|
99
|
+
| TZTimeBuildObj
|
|
100
|
+
| TZDatetimeBuildObj
|
|
101
|
+
| IntervalBuildObj
|
|
102
|
+
>;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Type representing the possible options for an attribute.
|
|
106
|
+
*/
|
|
107
|
+
export type AttributeOptions = {
|
|
108
|
+
indexed?: boolean;
|
|
109
|
+
fulltextindexed?: boolean;
|
|
110
|
+
internationalizable?: boolean;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Type representing the possible options for a relation definition.
|
|
115
|
+
*/
|
|
116
|
+
export type RelationOptions = {
|
|
117
|
+
symmetric?: boolean;
|
|
118
|
+
inlined?: boolean;
|
|
119
|
+
fulltext_container?: "subject" | "object";
|
|
120
|
+
composite?: "subject" | "object";
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Type representing a relation definition schema.
|
|
125
|
+
* It can represent both attributes and relations depending on the value of Final.
|
|
126
|
+
*
|
|
127
|
+
* It can infer default values type depending on the object type if the relation is final.
|
|
128
|
+
*/
|
|
129
|
+
export type RelationDefinitionRawSchema<
|
|
130
|
+
ESchemas extends EntityRawSchemaArray,
|
|
131
|
+
Final extends boolean = boolean
|
|
132
|
+
> = Readonly<
|
|
133
|
+
{
|
|
134
|
+
type: string;
|
|
135
|
+
description: string;
|
|
136
|
+
cardinality: CardinalityPair;
|
|
137
|
+
subject: ESchemas[number]["type"];
|
|
138
|
+
} & (Final extends true
|
|
139
|
+
? BuildObj & {
|
|
140
|
+
final: true;
|
|
141
|
+
constraints: AttributeConstraint[];
|
|
142
|
+
options: AttributeOptions;
|
|
143
|
+
}
|
|
144
|
+
: {
|
|
145
|
+
object: EntityRawSchema["type"];
|
|
146
|
+
final: false;
|
|
147
|
+
constraints: RelationConstraint[];
|
|
148
|
+
options: RelationOptions;
|
|
149
|
+
})
|
|
150
|
+
>;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Type representing a list of relation definitions.
|
|
154
|
+
*/
|
|
155
|
+
export type RelationDefinitionRawSchemaArray<
|
|
156
|
+
ESchemas extends EntityRawSchemaArray
|
|
157
|
+
> = ReadonlyArray<RelationDefinitionRawSchema<ESchemas, boolean>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EntityRawSchemaArray } from "./Entities";
|
|
2
|
+
import { RelationDefinitionRawSchemaArray } from "./RelationDefinitions";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The full raw JSON schema type as returned by the API.
|
|
6
|
+
* You can export this schema from your CubicWeb instance using the command:
|
|
7
|
+
*
|
|
8
|
+
* `cubicweb-ctl export-schema -f typescript <YOUR_INSTANCE_NAME>`
|
|
9
|
+
*/
|
|
10
|
+
export type RawSchema<
|
|
11
|
+
E extends EntityRawSchemaArray = EntityRawSchemaArray,
|
|
12
|
+
R extends RelationDefinitionRawSchemaArray<E> = RelationDefinitionRawSchemaArray<E>
|
|
13
|
+
> = {
|
|
14
|
+
entities: E;
|
|
15
|
+
relations_definitions: R;
|
|
16
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { EntityRawSchemaArray } from "./Entities";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Type used to check if a schema is loosely typed.
|
|
5
|
+
* Use this to create conditional types.
|
|
6
|
+
*
|
|
7
|
+
* In the given EntityRawSchemaArray, if the entities type is a string, the schema is loosely typed.
|
|
8
|
+
* If the schema is strongly typed, the entities type would be a word (which is stricter than string).
|
|
9
|
+
*/
|
|
10
|
+
export type IsLooseSchema<E extends EntityRawSchemaArray> =
|
|
11
|
+
string extends E[number]["type"] ? true : false;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Checks if the given entity type is present in the EntityRawSchemaArray.
|
|
15
|
+
* Use this to create conditional types.
|
|
16
|
+
*/
|
|
17
|
+
export type IsETypeInStrictSchema<
|
|
18
|
+
E extends EntityRawSchemaArray,
|
|
19
|
+
EType extends string
|
|
20
|
+
> = EType extends E[number]["type"] ? true : false;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Type representing the entity's raw schema matching this type.
|
|
24
|
+
* This type only works for EntityRawSchemaArray with literals as "type" property.
|
|
25
|
+
*/
|
|
26
|
+
export type EntityRawSchemaByType<
|
|
27
|
+
E extends EntityRawSchemaArray,
|
|
28
|
+
T extends string
|
|
29
|
+
> = E[number] extends infer ESchema
|
|
30
|
+
? ESchema extends { type: T }
|
|
31
|
+
? ESchema
|
|
32
|
+
: never
|
|
33
|
+
: never; // Will never happen E[number] always has a type
|
package/lib/schema/Schema.d.ts
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { Cardinality } from "..";
|
|
2
|
-
import { RawSchema, RelationDefinitionRawSchema, RelationDefinitionRawSchemaArray, EntityRawSchemaArray, EntityRawSchemaByType, IsLooseSchema, IsETypeInStrictSchema } from "./SchemaJSON";
|
|
3
|
-
declare const rawSchemaKey: unique symbol;
|
|
4
|
-
/**
|
|
5
|
-
* Returns the given schema using loose typing.
|
|
6
|
-
* Can be useful when working for generic schemas
|
|
7
|
-
*
|
|
8
|
-
* @param schema The schema to create a loose type for
|
|
9
|
-
* @returns
|
|
10
|
-
*/
|
|
11
|
-
export declare const getLooseSchema: <E extends EntityRawSchemaArray = EntityRawSchemaArray, R extends RelationDefinitionRawSchemaArray<E> = RelationDefinitionRawSchemaArray<E>>(schema: Schema<E, R>) => Schema<EntityRawSchemaArray, RelationDefinitionRawSchemaArray<EntityRawSchemaArray>>;
|
|
12
|
-
/**
|
|
13
|
-
* Wrapper around the raw JSON Schema
|
|
14
|
-
*/
|
|
15
|
-
export declare class Schema<E extends EntityRawSchemaArray = EntityRawSchemaArray, // List of all entities
|
|
16
|
-
R extends RelationDefinitionRawSchemaArray<E> = RelationDefinitionRawSchemaArray<E>> {
|
|
17
|
-
[rawSchemaKey]: RawSchema<E, R>;
|
|
18
|
-
constructor(rawSchema: RawSchema<E, R>);
|
|
19
|
-
get entities(): EntitySchema<E, R, E[number]>[];
|
|
20
|
-
get relationsDefinitions(): RelationDefinitionSchema<E, R, R[number]>[];
|
|
21
|
-
/**
|
|
22
|
-
* Returns the entity schema for the given entity type if it exists.
|
|
23
|
-
* When using TypeScript, this method can detect if the given type does not exist
|
|
24
|
-
* in the schema.
|
|
25
|
-
*
|
|
26
|
-
* @param entityType The entity type string
|
|
27
|
-
* @returns A new EntitySchema or null if the type does not exist
|
|
28
|
-
*/
|
|
29
|
-
getEntity<EType extends string>(entityType: EType): IsLooseSchema<E> extends true ? EntitySchema<E, R, E[number]> | null : IsETypeInStrictSchema<E, EType> extends true ? EntitySchema<E, R, EntityRawSchemaByType<E, EType>> : null;
|
|
30
|
-
/**
|
|
31
|
-
* Finds relations in the Schema matching the partial relation given
|
|
32
|
-
*
|
|
33
|
-
* @param matcher Partial relation definition to match against
|
|
34
|
-
* @returns Matched relation schema classes
|
|
35
|
-
*/
|
|
36
|
-
matchRelationDefinitions<M extends RelationDefinitionMatcher<E>>(matcher: M): RelationDefinitionSchema<E, R, MatchedRelationDefinition<E, R, {
|
|
37
|
-
subject: E[number]["type"];
|
|
38
|
-
}>>[];
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Wrapper around raw entities from the Schema
|
|
42
|
-
*/
|
|
43
|
-
export declare class EntitySchema<E extends EntityRawSchemaArray = EntityRawSchemaArray, // List of all entities
|
|
44
|
-
R extends RelationDefinitionRawSchemaArray<E> = RelationDefinitionRawSchemaArray<E>, // List of all relation defintions
|
|
45
|
-
ERawSchema extends E[number] = E[number]> {
|
|
46
|
-
private schema;
|
|
47
|
-
private entityRawSchema;
|
|
48
|
-
constructor(schema: Schema<E, R>, entityRawSchema: ERawSchema);
|
|
49
|
-
/**
|
|
50
|
-
* The type of the entity. This can also be referred to as the entity' name.
|
|
51
|
-
*/
|
|
52
|
-
get type(): ERawSchema["type"];
|
|
53
|
-
/**
|
|
54
|
-
* A short description which can be used as documentation for the entity.
|
|
55
|
-
*/
|
|
56
|
-
get description(): ERawSchema["description"];
|
|
57
|
-
/**
|
|
58
|
-
* True if the current entity is a primitive type such as string or int
|
|
59
|
-
*/
|
|
60
|
-
get final(): ERawSchema["final"];
|
|
61
|
-
/**
|
|
62
|
-
* Gets the list of relation definitions with this entity as subject
|
|
63
|
-
*/
|
|
64
|
-
get subjectRelationDefinitions(): RelationDefinitionSchema<E, R, MatchedRelationDefinition<E, R, {
|
|
65
|
-
subject: ERawSchema["type"];
|
|
66
|
-
}>>[];
|
|
67
|
-
/**
|
|
68
|
-
* Gets the list of relation definitions with this entity as object
|
|
69
|
-
*/
|
|
70
|
-
get objectRelationsDefinitions(): RelationDefinitionSchema<E, R, MatchedRelationDefinition<E, R, {
|
|
71
|
-
object: ERawSchema["type"];
|
|
72
|
-
}>>[];
|
|
73
|
-
/**
|
|
74
|
-
* Finds relations in the Schema matching the partial relation given
|
|
75
|
-
*
|
|
76
|
-
* @param matcher Partial relation definition to match against
|
|
77
|
-
* @returns Matched relation schema classes
|
|
78
|
-
*/
|
|
79
|
-
matchRelationDefinitions<M extends RelationDefinitionMatcher<E>>(matcher: M): RelationDefinitionSchema<E, R, MatchedRelationDefinition<E, R, {
|
|
80
|
-
subject: ERawSchema["type"];
|
|
81
|
-
}>>[];
|
|
82
|
-
/**
|
|
83
|
-
* Gets the list of attributes names for this entity
|
|
84
|
-
*/
|
|
85
|
-
get attributes(): RelationDefinitionSchema<E, R, R[number]>[];
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Wrapper around raw relation definitions from the Schema
|
|
89
|
-
*/
|
|
90
|
-
export declare class RelationDefinitionSchema<E extends EntityRawSchemaArray = EntityRawSchemaArray, // List of all entities
|
|
91
|
-
R extends RelationDefinitionRawSchemaArray<E> = RelationDefinitionRawSchemaArray<E>, // List of all relation defintions
|
|
92
|
-
RDef extends R[number] = R[number]> {
|
|
93
|
-
private schema;
|
|
94
|
-
private relDef;
|
|
95
|
-
constructor(schema: Schema<E, R>, relDef: RDef);
|
|
96
|
-
/**
|
|
97
|
-
* The type of the relation. This can also be referred to as the relation's name.
|
|
98
|
-
*/
|
|
99
|
-
get type(): RDef["type"];
|
|
100
|
-
/**
|
|
101
|
-
* A short description which can be used as documentation for the relation.
|
|
102
|
-
*/
|
|
103
|
-
get description(): RDef["description"];
|
|
104
|
-
/**
|
|
105
|
-
* True if the object of the relation is a primitive type.
|
|
106
|
-
* In this case the relation iscalled an "attribute"
|
|
107
|
-
*/
|
|
108
|
-
get final(): RDef["final"];
|
|
109
|
-
/**
|
|
110
|
-
* The list of constraints if any. Only attributes (relations with final = true) have constraints.
|
|
111
|
-
* In other cases this returns null.
|
|
112
|
-
*/
|
|
113
|
-
get constraints(): RDef["constraints"];
|
|
114
|
-
/**
|
|
115
|
-
* The default value for this relation.
|
|
116
|
-
* It can be used when creating new relations if user did not enter a value (even if required).
|
|
117
|
-
*/
|
|
118
|
-
get default(): RDef extends {
|
|
119
|
-
default: infer V;
|
|
120
|
-
} ? V : undefined;
|
|
121
|
-
get cardinality(): RDef["cardinality"];
|
|
122
|
-
get subjectCardinality(): Cardinality;
|
|
123
|
-
get objectCardinality(): Cardinality;
|
|
124
|
-
/**
|
|
125
|
-
* Gets the entity associated to this relation's subject
|
|
126
|
-
*
|
|
127
|
-
* @throws InconsistentSchemaError if the relation's subject is not a valid entity
|
|
128
|
-
*/
|
|
129
|
-
get subject(): IsLooseSchema<E> extends true ? EntitySchema<E, R, E[number]> : EntitySchema<E, R, EntityRawSchemaByType<E, RDef["subject"]>>;
|
|
130
|
-
/**
|
|
131
|
-
* Gets the entity associated to this relation's object
|
|
132
|
-
*
|
|
133
|
-
* @throws InconsistentSchemaError if the relation's object is not a valid entity
|
|
134
|
-
*/
|
|
135
|
-
get object(): IsLooseSchema<E> extends true ? EntitySchema<E, R, E[number]> : EntitySchema<E, R, EntityRawSchemaByType<E, RDef["object"]>>;
|
|
136
|
-
/**
|
|
137
|
-
* Checks if the relation is required when using the subject or object pointof view
|
|
138
|
-
*
|
|
139
|
-
* @param role The point of view to use
|
|
140
|
-
* @returns
|
|
141
|
-
*/
|
|
142
|
-
isRequired(role: "subject" | "object"): boolean;
|
|
143
|
-
}
|
|
144
|
-
export declare type RelationDefinitionMatcher<E extends EntityRawSchemaArray> = Partial<RelationDefinitionRawSchema<E>>;
|
|
145
|
-
export declare type MatchedRelationDefinition<E extends EntityRawSchemaArray, R extends RelationDefinitionRawSchemaArray<EntityRawSchemaArray>, M extends RelationDefinitionMatcher<E>> = R[number] extends infer RDef ? (RDef extends M ? RDef : never) : never;
|
|
146
|
-
export {};
|
|
147
|
-
//# sourceMappingURL=Schema.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../../src/schema/Schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAEjC,OAAO,EACL,SAAS,EACT,2BAA2B,EAC3B,gCAAgC,EAChC,oBAAoB,EACpB,qBAAqB,EACrB,aAAa,EACb,qBAAqB,EACtB,MAAM,cAAc,CAAC;AAEtB,QAAA,MAAM,YAAY,EAAE,OAAO,MAA2C,CAAC;AAEvE;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,4PAU1B,CAAC;AAEF;;GAEG;AACH,qBAAa,MAAM,CACjB,CAAC,SAAS,oBAAoB,GAAG,oBAAoB,EAAE,uBAAuB;AAC9E,CAAC,SAAS,gCAAgC,CAAC,CAAC,CAAC,GAAG,gCAAgC,CAAC,CAAC,CAAC;IAEnF,CAAC,YAAY,CAAC,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBAEpB,SAAS,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;IAItC,IAAI,QAAQ,IAAI,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAI9C;IAED,IAAI,oBAAoB,IAAI,wBAAwB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAItE;IAED;;;;;;;OAOG;IACH,SAAS,CAAC,KAAK,SAAS,MAAM,EAC5B,UAAU,EAAE,KAAK,GAChB,aAAa,CAAC,CAAC,CAAC,SAAS,IAAI,GAC5B,YAAY,CAAC,CAAC,E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lib/schema/Schema.js
DELETED
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RelationDefinitionSchema = exports.EntitySchema = exports.Schema = exports.getLooseSchema = void 0;
|
|
4
|
-
const Errors_1 = require("../Errors");
|
|
5
|
-
const rawSchemaKey = Symbol("Indexer of the rawSchema");
|
|
6
|
-
/**
|
|
7
|
-
* Returns the given schema using loose typing.
|
|
8
|
-
* Can be useful when working for generic schemas
|
|
9
|
-
*
|
|
10
|
-
* @param schema The schema to create a loose type for
|
|
11
|
-
* @returns
|
|
12
|
-
*/
|
|
13
|
-
const getLooseSchema = (schema) => {
|
|
14
|
-
return schema;
|
|
15
|
-
};
|
|
16
|
-
exports.getLooseSchema = getLooseSchema;
|
|
17
|
-
/**
|
|
18
|
-
* Wrapper around the raw JSON Schema
|
|
19
|
-
*/
|
|
20
|
-
class Schema {
|
|
21
|
-
constructor(rawSchema) {
|
|
22
|
-
this[rawSchemaKey] = rawSchema;
|
|
23
|
-
}
|
|
24
|
-
get entities() {
|
|
25
|
-
return this[rawSchemaKey].entities.map((eSchema) => new EntitySchema(this, eSchema));
|
|
26
|
-
}
|
|
27
|
-
get relationsDefinitions() {
|
|
28
|
-
return this[rawSchemaKey].relations_definitions.map((rdefSchema) => new RelationDefinitionSchema(this, rdefSchema));
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Returns the entity schema for the given entity type if it exists.
|
|
32
|
-
* When using TypeScript, this method can detect if the given type does not exist
|
|
33
|
-
* in the schema.
|
|
34
|
-
*
|
|
35
|
-
* @param entityType The entity type string
|
|
36
|
-
* @returns A new EntitySchema or null if the type does not exist
|
|
37
|
-
*/
|
|
38
|
-
getEntity(entityType) {
|
|
39
|
-
const entityRawSchema = this[rawSchemaKey].entities.filter((eSchema) => eSchema.type === entityType)[0];
|
|
40
|
-
if (!entityRawSchema) {
|
|
41
|
-
// Is only null when the given type is not in the schema.
|
|
42
|
-
// Thus the return type will be (EntitySchema | null)
|
|
43
|
-
// but TypeScript does not understand this
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
45
|
-
// @ts-ignore
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
49
|
-
// @ts-ignore
|
|
50
|
-
return new EntitySchema(this, entityRawSchema);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Finds relations in the Schema matching the partial relation given
|
|
54
|
-
*
|
|
55
|
-
* @param matcher Partial relation definition to match against
|
|
56
|
-
* @returns Matched relation schema classes
|
|
57
|
-
*/
|
|
58
|
-
matchRelationDefinitions(matcher) {
|
|
59
|
-
const matchArray = this[rawSchemaKey].relations_definitions.filter((relDef) => {
|
|
60
|
-
for (const key of Object.keys(matcher)) {
|
|
61
|
-
if (matcher[key] !== relDef[key]) {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return true;
|
|
66
|
-
});
|
|
67
|
-
return matchArray.map((m) => new RelationDefinitionSchema(this, m));
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
exports.Schema = Schema;
|
|
71
|
-
/**
|
|
72
|
-
* Wrapper around raw entities from the Schema
|
|
73
|
-
*/
|
|
74
|
-
class EntitySchema {
|
|
75
|
-
constructor(schema, entityRawSchema) {
|
|
76
|
-
this.schema = schema;
|
|
77
|
-
this.entityRawSchema = entityRawSchema;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* The type of the entity. This can also be referred to as the entity' name.
|
|
81
|
-
*/
|
|
82
|
-
get type() {
|
|
83
|
-
return this.entityRawSchema.type;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* A short description which can be used as documentation for the entity.
|
|
87
|
-
*/
|
|
88
|
-
get description() {
|
|
89
|
-
return this.entityRawSchema.description;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* True if the current entity is a primitive type such as string or int
|
|
93
|
-
*/
|
|
94
|
-
get final() {
|
|
95
|
-
return this.entityRawSchema.final;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Gets the list of relation definitions with this entity as subject
|
|
99
|
-
*/
|
|
100
|
-
get subjectRelationDefinitions() {
|
|
101
|
-
return this.schema.matchRelationDefinitions({
|
|
102
|
-
subject: this.type,
|
|
103
|
-
final: false,
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Gets the list of relation definitions with this entity as object
|
|
108
|
-
*/
|
|
109
|
-
get objectRelationsDefinitions() {
|
|
110
|
-
return this.schema.matchRelationDefinitions({
|
|
111
|
-
object: this.type,
|
|
112
|
-
final: false,
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Finds relations in the Schema matching the partial relation given
|
|
117
|
-
*
|
|
118
|
-
* @param matcher Partial relation definition to match against
|
|
119
|
-
* @returns Matched relation schema classes
|
|
120
|
-
*/
|
|
121
|
-
matchRelationDefinitions(matcher) {
|
|
122
|
-
return this.schema.matchRelationDefinitions(matcher);
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Gets the list of attributes names for this entity
|
|
126
|
-
*/
|
|
127
|
-
get attributes() {
|
|
128
|
-
return this.schema.matchRelationDefinitions({
|
|
129
|
-
final: true,
|
|
130
|
-
subject: this.type,
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
exports.EntitySchema = EntitySchema;
|
|
135
|
-
/**
|
|
136
|
-
* Wrapper around raw relation definitions from the Schema
|
|
137
|
-
*/
|
|
138
|
-
class RelationDefinitionSchema {
|
|
139
|
-
constructor(schema, relDef) {
|
|
140
|
-
this.schema = schema;
|
|
141
|
-
this.relDef = relDef;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* The type of the relation. This can also be referred to as the relation's name.
|
|
145
|
-
*/
|
|
146
|
-
get type() {
|
|
147
|
-
return this.relDef.type;
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* A short description which can be used as documentation for the relation.
|
|
151
|
-
*/
|
|
152
|
-
get description() {
|
|
153
|
-
return this.relDef.description;
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* True if the object of the relation is a primitive type.
|
|
157
|
-
* In this case the relation iscalled an "attribute"
|
|
158
|
-
*/
|
|
159
|
-
get final() {
|
|
160
|
-
return this.relDef.final;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* The list of constraints if any. Only attributes (relations with final = true) have constraints.
|
|
164
|
-
* In other cases this returns null.
|
|
165
|
-
*/
|
|
166
|
-
get constraints() {
|
|
167
|
-
return this.relDef.constraints;
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* The default value for this relation.
|
|
171
|
-
* It can be used when creating new relations if user did not enter a value (even if required).
|
|
172
|
-
*/
|
|
173
|
-
get default() {
|
|
174
|
-
return ("default" in this.relDef ? this.relDef.default : undefined);
|
|
175
|
-
}
|
|
176
|
-
get cardinality() {
|
|
177
|
-
return this.relDef.cardinality;
|
|
178
|
-
}
|
|
179
|
-
get subjectCardinality() {
|
|
180
|
-
return this.relDef.cardinality[0];
|
|
181
|
-
}
|
|
182
|
-
get objectCardinality() {
|
|
183
|
-
return this.relDef.cardinality[1];
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Gets the entity associated to this relation's subject
|
|
187
|
-
*
|
|
188
|
-
* @throws InconsistentSchemaError if the relation's subject is not a valid entity
|
|
189
|
-
*/
|
|
190
|
-
get subject() {
|
|
191
|
-
const subjectSchema = this.schema.getEntity(this.relDef.subject);
|
|
192
|
-
if (subjectSchema === null) {
|
|
193
|
-
throw new Errors_1.InconsistentSchemaError(`entity type ${this.relDef.subject} used as subject of relation ${this.type} is not declared`);
|
|
194
|
-
}
|
|
195
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
196
|
-
// @ts-ignore
|
|
197
|
-
return subjectSchema;
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Gets the entity associated to this relation's object
|
|
201
|
-
*
|
|
202
|
-
* @throws InconsistentSchemaError if the relation's object is not a valid entity
|
|
203
|
-
*/
|
|
204
|
-
get object() {
|
|
205
|
-
const objectSchema = this.schema.getEntity(this.relDef.object);
|
|
206
|
-
if (objectSchema === null) {
|
|
207
|
-
throw new Errors_1.InconsistentSchemaError(`entity type ${this.relDef.object} used as object of relation ${this.type} is not declared`);
|
|
208
|
-
}
|
|
209
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
210
|
-
// @ts-ignore
|
|
211
|
-
return objectSchema;
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Checks if the relation is required when using the subject or object pointof view
|
|
215
|
-
*
|
|
216
|
-
* @param role The point of view to use
|
|
217
|
-
* @returns
|
|
218
|
-
*/
|
|
219
|
-
isRequired(role) {
|
|
220
|
-
let cardinality;
|
|
221
|
-
if (role === "subject") {
|
|
222
|
-
cardinality = this.cardinality[0];
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
225
|
-
cardinality = this.cardinality[1];
|
|
226
|
-
}
|
|
227
|
-
return cardinalityRequired(cardinality);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
exports.RelationDefinitionSchema = RelationDefinitionSchema;
|
|
231
|
-
/**
|
|
232
|
-
* Checks if the given cardinality requires at least one entity to be present
|
|
233
|
-
*
|
|
234
|
-
* @param cardinality The cardinality to check
|
|
235
|
-
* @returns
|
|
236
|
-
*/
|
|
237
|
-
function cardinalityRequired(cardinality) {
|
|
238
|
-
return cardinality === "1" || cardinality === "+";
|
|
239
|
-
}
|
|
240
|
-
//# sourceMappingURL=Schema.js.map
|
package/lib/schema/Schema.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Schema.js","sourceRoot":"","sources":["../../src/schema/Schema.ts"],"names":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