@cubicweb/client 3.0.0-alpha.10 → 3.0.0-alpha.11
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/Errors.js +3 -9
- package/lib/Errors.js.map +1 -1
- package/lib/api/Api.d.ts +2 -2
- package/lib/api/Api.d.ts.map +1 -1
- package/lib/api/Api.js +128 -147
- package/lib/api/Api.js.map +1 -1
- package/lib/api/Client.d.ts +4 -4
- package/lib/api/Client.d.ts.map +1 -1
- package/lib/api/Client.js +25 -53
- package/lib/api/Client.js.map +1 -1
- package/lib/api/Transaction.d.ts +2 -2
- package/lib/api/Transaction.d.ts.map +1 -1
- package/lib/api/Transaction.js +15 -18
- package/lib/api/Transaction.js.map +1 -1
- package/lib/index.d.ts +13 -13
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +12 -33
- package/lib/index.js.map +1 -1
- package/lib/schema/classes/EntitySchema.d.ts +5 -5
- package/lib/schema/classes/EntitySchema.d.ts.map +1 -1
- package/lib/schema/classes/EntitySchema.js +3 -5
- package/lib/schema/classes/EntitySchema.js.map +1 -1
- package/lib/schema/classes/RelationDefinitionSchema.d.ts +6 -6
- package/lib/schema/classes/RelationDefinitionSchema.d.ts.map +1 -1
- package/lib/schema/classes/RelationDefinitionSchema.js +8 -10
- package/lib/schema/classes/RelationDefinitionSchema.js.map +1 -1
- package/lib/schema/classes/Schema.d.ts +7 -7
- package/lib/schema/classes/Schema.d.ts.map +1 -1
- package/lib/schema/classes/Schema.js +8 -11
- package/lib/schema/classes/Schema.js.map +1 -1
- package/lib/schema/classes/Utils.d.ts +10 -10
- package/lib/schema/classes/Utils.d.ts.map +1 -1
- package/lib/schema/classes/Utils.js +19 -35
- package/lib/schema/classes/Utils.js.map +1 -1
- package/lib/schema/raw/Constraints.js +1 -2
- package/lib/schema/raw/Entities.js +1 -2
- package/lib/schema/raw/RelationDefinitions.d.ts +3 -3
- package/lib/schema/raw/RelationDefinitions.d.ts.map +1 -1
- package/lib/schema/raw/RelationDefinitions.js +1 -2
- package/lib/schema/raw/Schema.d.ts +2 -2
- package/lib/schema/raw/Schema.d.ts.map +1 -1
- package/lib/schema/raw/Schema.js +1 -2
- package/lib/schema/raw/Utils.d.ts +1 -1
- package/lib/schema/raw/Utils.d.ts.map +1 -1
- package/lib/schema/raw/Utils.js +1 -2
- package/package.json +6 -5
- package/src/api/Api.ts +3 -3
- package/src/api/Client.ts +7 -3
- package/src/api/Transaction.ts +1 -1
- package/src/index.ts +13 -13
- package/src/schema/classes/EntitySchema.ts +8 -5
- package/src/schema/classes/RelationDefinitionSchema.ts +7 -7
- package/src/schema/classes/Schema.ts +10 -7
- package/src/schema/classes/Utils.ts +4 -4
- package/src/schema/raw/RelationDefinitions.ts +3 -3
- package/src/schema/raw/Schema.ts +2 -2
- package/src/schema/raw/Utils.ts +1 -1
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isAttributeRichString = exports.hasAttributeWithName = exports.getRelationDefinition = exports.getRelationType = exports.getRawRelationType = exports.getReverseRelationType = exports.getRoleFromRelationType = exports.isRelationTypeReversed = exports.getOppositeRelationRole = exports.isCardinalityOptional = exports.isCardinalityMultiple = exports.isCardinalityRequired = exports.getLooseSchema = void 0;
|
|
4
1
|
// This prefix is often applied to relation types as convention
|
|
5
2
|
// indicating a relation is viewed from the object's point of view
|
|
6
3
|
// We do not export it and instead encourage users to use the utility functions
|
|
@@ -14,10 +11,9 @@ const REVERSE_INDICATOR = "reverse_";
|
|
|
14
11
|
*
|
|
15
12
|
* @category Utils
|
|
16
13
|
*/
|
|
17
|
-
const getLooseSchema = (schema) => {
|
|
14
|
+
export const getLooseSchema = (schema) => {
|
|
18
15
|
return schema;
|
|
19
16
|
};
|
|
20
|
-
exports.getLooseSchema = getLooseSchema;
|
|
21
17
|
/**
|
|
22
18
|
* Checks if the given cardinality requires at least one entity to be present
|
|
23
19
|
*
|
|
@@ -26,10 +22,9 @@ exports.getLooseSchema = getLooseSchema;
|
|
|
26
22
|
*
|
|
27
23
|
* @category Utils
|
|
28
24
|
*/
|
|
29
|
-
function isCardinalityRequired(cardinality) {
|
|
25
|
+
export function isCardinalityRequired(cardinality) {
|
|
30
26
|
return cardinality === "1" || cardinality === "+";
|
|
31
27
|
}
|
|
32
|
-
exports.isCardinalityRequired = isCardinalityRequired;
|
|
33
28
|
/**
|
|
34
29
|
* Checks if the cardinality allows multiple entities to be present
|
|
35
30
|
*
|
|
@@ -38,10 +33,9 @@ exports.isCardinalityRequired = isCardinalityRequired;
|
|
|
38
33
|
*
|
|
39
34
|
* @category Utils
|
|
40
35
|
*/
|
|
41
|
-
const isCardinalityMultiple = (cardinality) => {
|
|
36
|
+
export const isCardinalityMultiple = (cardinality) => {
|
|
42
37
|
return cardinality === "*" || cardinality === "+";
|
|
43
38
|
};
|
|
44
|
-
exports.isCardinalityMultiple = isCardinalityMultiple;
|
|
45
39
|
/**
|
|
46
40
|
* Checks if the cardinality allows entities to be absent
|
|
47
41
|
*
|
|
@@ -50,10 +44,9 @@ exports.isCardinalityMultiple = isCardinalityMultiple;
|
|
|
50
44
|
*
|
|
51
45
|
* @category Utils
|
|
52
46
|
*/
|
|
53
|
-
const isCardinalityOptional = (cardinality) => {
|
|
47
|
+
export const isCardinalityOptional = (cardinality) => {
|
|
54
48
|
return cardinality === "?" || cardinality === "*";
|
|
55
49
|
};
|
|
56
|
-
exports.isCardinalityOptional = isCardinalityOptional;
|
|
57
50
|
/**
|
|
58
51
|
* Reverses the given role name
|
|
59
52
|
*
|
|
@@ -62,10 +55,9 @@ exports.isCardinalityOptional = isCardinalityOptional;
|
|
|
62
55
|
*
|
|
63
56
|
* @category Utils
|
|
64
57
|
*/
|
|
65
|
-
function getOppositeRelationRole(role) {
|
|
58
|
+
export function getOppositeRelationRole(role) {
|
|
66
59
|
return role === "subject" ? "object" : "subject";
|
|
67
60
|
}
|
|
68
|
-
exports.getOppositeRelationRole = getOppositeRelationRole;
|
|
69
61
|
/**
|
|
70
62
|
* Checks if the given relation type is reversed.
|
|
71
63
|
*
|
|
@@ -78,10 +70,9 @@ exports.getOppositeRelationRole = getOppositeRelationRole;
|
|
|
78
70
|
*
|
|
79
71
|
* @category Utils
|
|
80
72
|
*/
|
|
81
|
-
const isRelationTypeReversed = (relationType) => {
|
|
73
|
+
export const isRelationTypeReversed = (relationType) => {
|
|
82
74
|
return relationType.startsWith(REVERSE_INDICATOR);
|
|
83
75
|
};
|
|
84
|
-
exports.isRelationTypeReversed = isRelationTypeReversed;
|
|
85
76
|
/**
|
|
86
77
|
* Gets the entity role in the given relation type by
|
|
87
78
|
* checking for the reverse indicator
|
|
@@ -95,10 +86,9 @@ exports.isRelationTypeReversed = isRelationTypeReversed;
|
|
|
95
86
|
*
|
|
96
87
|
* @category Utils
|
|
97
88
|
*/
|
|
98
|
-
const getRoleFromRelationType = (relationType) => {
|
|
99
|
-
return
|
|
89
|
+
export const getRoleFromRelationType = (relationType) => {
|
|
90
|
+
return isRelationTypeReversed(relationType) ? "object" : "subject";
|
|
100
91
|
};
|
|
101
|
-
exports.getRoleFromRelationType = getRoleFromRelationType;
|
|
102
92
|
/**
|
|
103
93
|
* Adds the reverse indicator from the relation type if it is not already present.
|
|
104
94
|
*
|
|
@@ -111,15 +101,14 @@ exports.getRoleFromRelationType = getRoleFromRelationType;
|
|
|
111
101
|
*
|
|
112
102
|
* @category Utils
|
|
113
103
|
*/
|
|
114
|
-
const getReverseRelationType = (relationType) => {
|
|
115
|
-
if (!
|
|
104
|
+
export const getReverseRelationType = (relationType) => {
|
|
105
|
+
if (!isRelationTypeReversed(relationType)) {
|
|
116
106
|
return `${REVERSE_INDICATOR}${relationType}`;
|
|
117
107
|
}
|
|
118
108
|
else {
|
|
119
109
|
return relationType;
|
|
120
110
|
}
|
|
121
111
|
};
|
|
122
|
-
exports.getReverseRelationType = getReverseRelationType;
|
|
123
112
|
/**
|
|
124
113
|
* Clears the reverse indicator from the relation type if it is present.
|
|
125
114
|
*
|
|
@@ -132,15 +121,14 @@ exports.getReverseRelationType = getReverseRelationType;
|
|
|
132
121
|
*
|
|
133
122
|
* @category Utils
|
|
134
123
|
*/
|
|
135
|
-
const getRawRelationType = (relationType) => {
|
|
136
|
-
if (
|
|
124
|
+
export const getRawRelationType = (relationType) => {
|
|
125
|
+
if (isRelationTypeReversed(relationType)) {
|
|
137
126
|
return relationType.replace(REVERSE_INDICATOR, "");
|
|
138
127
|
}
|
|
139
128
|
else {
|
|
140
129
|
return relationType;
|
|
141
130
|
}
|
|
142
131
|
};
|
|
143
|
-
exports.getRawRelationType = getRawRelationType;
|
|
144
132
|
/**
|
|
145
133
|
* Returns the relation type with the reverse indicator added if necessary.
|
|
146
134
|
*
|
|
@@ -154,12 +142,11 @@ exports.getRawRelationType = getRawRelationType;
|
|
|
154
142
|
*
|
|
155
143
|
* @category Utils
|
|
156
144
|
*/
|
|
157
|
-
const getRelationType = (relationType, role) => {
|
|
145
|
+
export const getRelationType = (relationType, role) => {
|
|
158
146
|
return role === "subject"
|
|
159
147
|
? relationType
|
|
160
|
-
:
|
|
148
|
+
: getReverseRelationType(relationType);
|
|
161
149
|
};
|
|
162
|
-
exports.getRelationType = getRelationType;
|
|
163
150
|
/**
|
|
164
151
|
* Finds the relation matching the provided source, relation typ and target
|
|
165
152
|
*
|
|
@@ -171,11 +158,11 @@ exports.getRelationType = getRelationType;
|
|
|
171
158
|
*
|
|
172
159
|
* @category Utils
|
|
173
160
|
*/
|
|
174
|
-
const getRelationDefinition = (entitySchema, sourceType, relationType, targetType) => {
|
|
175
|
-
const role =
|
|
161
|
+
export const getRelationDefinition = (entitySchema, sourceType, relationType, targetType) => {
|
|
162
|
+
const role = getRoleFromRelationType(relationType);
|
|
176
163
|
const match = entitySchema.matchRelationDefinitions({
|
|
177
164
|
[role]: sourceType,
|
|
178
|
-
type:
|
|
165
|
+
type: getRawRelationType(relationType),
|
|
179
166
|
[getOppositeRelationRole(role)]: targetType,
|
|
180
167
|
});
|
|
181
168
|
if (match.length > 0) {
|
|
@@ -183,8 +170,7 @@ const getRelationDefinition = (entitySchema, sourceType, relationType, targetTyp
|
|
|
183
170
|
}
|
|
184
171
|
return undefined;
|
|
185
172
|
};
|
|
186
|
-
|
|
187
|
-
function hasAttributeWithName(entitySchema, attributeNameSearched) {
|
|
173
|
+
export function hasAttributeWithName(entitySchema, attributeNameSearched) {
|
|
188
174
|
for (const entityAttribute of entitySchema.attributes) {
|
|
189
175
|
if (entityAttribute.type == attributeNameSearched) {
|
|
190
176
|
return true;
|
|
@@ -192,9 +178,7 @@ function hasAttributeWithName(entitySchema, attributeNameSearched) {
|
|
|
192
178
|
}
|
|
193
179
|
return false;
|
|
194
180
|
}
|
|
195
|
-
|
|
196
|
-
function isAttributeRichString(entitySchema, attributeNameSearched) {
|
|
181
|
+
export function isAttributeRichString(entitySchema, attributeNameSearched) {
|
|
197
182
|
return hasAttributeWithName(entitySchema, attributeNameSearched + "_format");
|
|
198
183
|
}
|
|
199
|
-
exports.isAttributeRichString = isAttributeRichString;
|
|
200
184
|
//# sourceMappingURL=Utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/schema/classes/Utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/schema/classes/Utils.ts"],"names":[],"mappings":"AASA,+DAA+D;AAC/D,kEAAkE;AAClE,+EAA+E;AAC/E,MAAM,iBAAiB,GAAG,UAAU,CAAC;AASrC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAI5B,MAAoB,EACpB,EAAE;IACF,OAAO,MAA2B,CAAC;AACrC,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CAAC,WAAwB;IAC5D,OAAO,WAAW,KAAK,GAAG,IAAI,WAAW,KAAK,GAAG,CAAC;AACpD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|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EntityRole } from "../classes/Utils";
|
|
2
|
-
import { AttributeConstraint, RelationConstraint } from "./Constraints";
|
|
3
|
-
import { EntityRawSchema, EntityRawSchemaArray } from "./Entities";
|
|
1
|
+
import { EntityRole } from "../classes/Utils.js";
|
|
2
|
+
import { AttributeConstraint, RelationConstraint } from "./Constraints.js";
|
|
3
|
+
import { EntityRawSchema, EntityRawSchemaArray } from "./Entities.js";
|
|
4
4
|
/**
|
|
5
5
|
* Type representing all the possible cardinalities in CubicWeb.
|
|
6
6
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelationDefinitions.d.ts","sourceRoot":"","sources":["../../../src/schema/raw/RelationDefinitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"RelationDefinitions.d.ts","sourceRoot":"","sources":["../../../src/schema/raw/RelationDefinitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAEtE;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAEhD;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,GAAG,WAAW,GAAG,WAAW,EAAE,CAAC;AAE7D;;;;GAIG;AACH,KAAK,YAAY,CAAC,CAAC,SAAS,MAAM,IAAI;IACpC,MAAM,EAAE,CAAC,CAAC;IACV,KAAK,EAAE,IAAI,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,UAAU,cAAe,SAAQ,YAAY,CAAC,QAAQ,CAAC;IACrD,OAAO,EAAE,MAAM,GAAG,IA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B,CAAC;CAC3B,GACD;IACE,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAChC,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,EAAE,kBAAkB,EAAE,CAAC;IAClC,OAAO,EAAE,eAAe,CAAC;CAC1B,CAAC,CACP,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,gCAAgC,CAC1C,QAAQ,SAAS,oBAAoB,IACnC,aAAa,CAAC,2BAA2B,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EntityRawSchemaArray } from "./Entities";
|
|
2
|
-
import { RelationDefinitionRawSchemaArray } from "./RelationDefinitions";
|
|
1
|
+
import { EntityRawSchemaArray } from "./Entities.js";
|
|
2
|
+
import { RelationDefinitionRawSchemaArray } from "./RelationDefinitions.js";
|
|
3
3
|
/**
|
|
4
4
|
* The full raw JSON schema type as returned by the API.
|
|
5
5
|
* You can export this schema from your CubicWeb instance using the command:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../../../src/schema/raw/Schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../../../src/schema/raw/Schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,gCAAgC,EAAE,MAAM,0BAA0B,CAAC;AAE5E;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,CACnB,CAAC,SAAS,oBAAoB,GAAG,oBAAoB,EACrD,CAAC,SAAS,gCAAgC,CAAC,CAAC,CAAC,GAAG,gCAAgC,CAAC,CAAC,CAAC,IACjF;IACF,QAAQ,EAAE,CAAC,CAAC;IACZ,qBAAqB,EAAE,CAAC,CAAC;CAC1B,CAAC"}
|
package/lib/schema/raw/Schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../../../src/schema/raw/Utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../../../src/schema/raw/Utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD;;;;;;;;GAQG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,oBAAoB,IACtD,MAAM,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC;AAElD;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,CAC/B,CAAC,SAAS,oBAAoB,EAC9B,KAAK,SAAS,MAAM,IAClB,KAAK,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,CAC/B,CAAC,SAAS,oBAAoB,EAC9B,CAAC,SAAS,MAAM,IACd,CAAC,CAAC,MAAM,CAAC,SAAS,MAAM,OAAO,GAC/B,OAAO,SAAS;IAAE,IAAI,EAAE,CAAC,CAAA;CAAE,GACzB,OAAO,GACP,KAAK,GACP,KAAK,CAAC"}
|
package/lib/schema/raw/Utils.js
CHANGED
package/package.json
CHANGED
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
"name": "@cubicweb/client",
|
|
3
3
|
"description": "Official JS client for CubicWeb API",
|
|
4
4
|
"author": "Logilab",
|
|
5
|
-
"version": "3.0.0-alpha.
|
|
5
|
+
"version": "3.0.0-alpha.11",
|
|
6
6
|
"license": "LGPL-3.0-or-later",
|
|
7
|
-
"main": "lib/index.js",
|
|
8
|
-
"types": "lib/index.d.ts",
|
|
9
7
|
"scripts": {
|
|
10
|
-
"build": "run -T tsc
|
|
8
|
+
"build": "run -T tsc --project tsconfig.build.json",
|
|
11
9
|
"docs": "run -T typedoc"
|
|
12
10
|
},
|
|
13
11
|
"repository": {
|
|
@@ -23,5 +21,8 @@
|
|
|
23
21
|
"lib/**",
|
|
24
22
|
"src/**",
|
|
25
23
|
"!**/__tests__/**"
|
|
26
|
-
]
|
|
24
|
+
],
|
|
25
|
+
"type": "module",
|
|
26
|
+
"exports": "./lib/index.js",
|
|
27
|
+
"types": "./lib/index.d.ts"
|
|
27
28
|
}
|
package/src/api/Api.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ValidationError } from "../Errors";
|
|
2
|
-
import { RawSchema } from "../schema/raw/Schema";
|
|
1
|
+
import { ValidationError } from "../Errors.js";
|
|
2
|
+
import { RawSchema } from "../schema/raw/Schema.js";
|
|
3
3
|
import {
|
|
4
4
|
TransactionResult,
|
|
5
5
|
Transaction,
|
|
6
6
|
TransactionQueryScalarRef,
|
|
7
7
|
TransactionQueryBinaryRef,
|
|
8
|
-
} from "./Transaction";
|
|
8
|
+
} from "./Transaction.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Type representing an RQL request and its associated parameters.
|
package/src/api/Client.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { Schema } from "../schema/classes/Schema";
|
|
2
|
-
import Api, { RQLParams, ResultSet, CurrentUser } from "./Api";
|
|
3
|
-
import {
|
|
1
|
+
import { Schema } from "../schema/classes/Schema.js";
|
|
2
|
+
import Api, { RQLParams, ResultSet, CurrentUser } from "./Api.js";
|
|
3
|
+
import {
|
|
4
|
+
BinariesParam,
|
|
5
|
+
Transaction,
|
|
6
|
+
TransactionResult,
|
|
7
|
+
} from "./Transaction.js";
|
|
4
8
|
|
|
5
9
|
/**
|
|
6
10
|
* Class used to communicate with a CubicWeb instance's API.
|
package/src/api/Transaction.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
// Raw Schema
|
|
2
|
-
export * from "./schema/raw/Constraints";
|
|
3
|
-
export * from "./schema/raw/Entities";
|
|
4
|
-
export * from "./schema/raw/RelationDefinitions";
|
|
5
|
-
export * from "./schema/raw/Schema";
|
|
6
|
-
export * from "./schema/raw/Utils";
|
|
2
|
+
export * from "./schema/raw/Constraints.js";
|
|
3
|
+
export * from "./schema/raw/Entities.js";
|
|
4
|
+
export * from "./schema/raw/RelationDefinitions.js";
|
|
5
|
+
export * from "./schema/raw/Schema.js";
|
|
6
|
+
export * from "./schema/raw/Utils.js";
|
|
7
7
|
|
|
8
8
|
// Schema Abstraction class
|
|
9
|
-
export * from "./schema/classes/EntitySchema";
|
|
10
|
-
export * from "./schema/classes/RelationDefinitionSchema";
|
|
11
|
-
export * from "./schema/classes/Schema";
|
|
12
|
-
export * from "./schema/classes/Utils";
|
|
9
|
+
export * from "./schema/classes/EntitySchema.js";
|
|
10
|
+
export * from "./schema/classes/RelationDefinitionSchema.js";
|
|
11
|
+
export * from "./schema/classes/Schema.js";
|
|
12
|
+
export * from "./schema/classes/Utils.js";
|
|
13
13
|
|
|
14
|
-
export * from "./Errors";
|
|
14
|
+
export * from "./Errors.js";
|
|
15
15
|
|
|
16
16
|
// API
|
|
17
|
-
export { default as Client } from "./api/Client";
|
|
18
|
-
export * from "./api/Transaction";
|
|
17
|
+
export { default as Client } from "./api/Client.js";
|
|
18
|
+
export * from "./api/Transaction.js";
|
|
19
19
|
export {
|
|
20
20
|
RQLQuery,
|
|
21
21
|
RQLParams,
|
|
22
22
|
RqlRow,
|
|
23
23
|
ResultSet,
|
|
24
24
|
ApiErrorResponse,
|
|
25
|
-
} from "./api/Api";
|
|
25
|
+
} from "./api/Api.js";
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { EntityRawSchemaArray } from "../raw/Entities";
|
|
2
|
-
import { RelationDefinitionRawSchemaArray } from "../raw/RelationDefinitions";
|
|
3
|
-
import { RelationDefinitionSchema } from "./RelationDefinitionSchema";
|
|
4
|
-
import { Schema } from "./Schema";
|
|
5
|
-
import {
|
|
1
|
+
import { EntityRawSchemaArray } from "../raw/Entities.js";
|
|
2
|
+
import { RelationDefinitionRawSchemaArray } from "../raw/RelationDefinitions.js";
|
|
3
|
+
import { RelationDefinitionSchema } from "./RelationDefinitionSchema.js";
|
|
4
|
+
import { Schema } from "./Schema.js";
|
|
5
|
+
import {
|
|
6
|
+
MatchedRelationDefinition,
|
|
7
|
+
RelationDefinitionMatcher,
|
|
8
|
+
} from "./Utils.js";
|
|
6
9
|
|
|
7
10
|
/**
|
|
8
11
|
* Wrapper around raw entity schemas from the Schema.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { InconsistentSchemaError } from "../../Errors";
|
|
2
|
-
import { EntityRawSchemaArray } from "../raw/Entities";
|
|
1
|
+
import { InconsistentSchemaError } from "../../Errors.js";
|
|
2
|
+
import { EntityRawSchemaArray } from "../raw/Entities.js";
|
|
3
3
|
import {
|
|
4
4
|
RelationDefinitionRawSchemaArray,
|
|
5
5
|
Cardinality,
|
|
6
|
-
} from "../raw/RelationDefinitions";
|
|
7
|
-
import { IsLooseSchema, EntityRawSchemaByType } from "../raw/Utils";
|
|
8
|
-
import { EntitySchema } from "./EntitySchema";
|
|
9
|
-
import { Schema } from "./Schema";
|
|
10
|
-
import { EntityRole, isCardinalityRequired } from "./Utils";
|
|
6
|
+
} from "../raw/RelationDefinitions.js";
|
|
7
|
+
import { IsLooseSchema, EntityRawSchemaByType } from "../raw/Utils.js";
|
|
8
|
+
import { EntitySchema } from "./EntitySchema.js";
|
|
9
|
+
import { Schema } from "./Schema.js";
|
|
10
|
+
import { EntityRole, isCardinalityRequired } from "./Utils.js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Wrapper around raw relation definition schemas from the Schema.
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import { EntityRawSchemaArray } from "../raw/Entities";
|
|
1
|
+
import { EntityRawSchemaArray } from "../raw/Entities.js";
|
|
2
2
|
import {
|
|
3
3
|
RelationDefinitionRawSchema,
|
|
4
4
|
RelationDefinitionRawSchemaArray,
|
|
5
|
-
} from "../raw/RelationDefinitions";
|
|
6
|
-
import { RawSchema } from "../raw/Schema";
|
|
5
|
+
} from "../raw/RelationDefinitions.js";
|
|
6
|
+
import { RawSchema } from "../raw/Schema.js";
|
|
7
7
|
import {
|
|
8
8
|
EntityRawSchemaByType,
|
|
9
9
|
IsETypeInStrictSchema,
|
|
10
10
|
IsLooseSchema,
|
|
11
|
-
} from "../raw/Utils";
|
|
12
|
-
import { EntitySchema } from "./EntitySchema";
|
|
13
|
-
import { RelationDefinitionSchema } from "./RelationDefinitionSchema";
|
|
14
|
-
import {
|
|
11
|
+
} from "../raw/Utils.js";
|
|
12
|
+
import { EntitySchema } from "./EntitySchema.js";
|
|
13
|
+
import { RelationDefinitionSchema } from "./RelationDefinitionSchema.js";
|
|
14
|
+
import {
|
|
15
|
+
RelationDefinitionMatcher,
|
|
16
|
+
MatchedRelationDefinition,
|
|
17
|
+
} from "./Utils.js";
|
|
15
18
|
|
|
16
19
|
const rawSchemaKey: unique symbol = Symbol("Indexer of the rawSchema");
|
|
17
20
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { EntityRawSchemaArray } from "../raw/Entities";
|
|
1
|
+
import { EntityRawSchemaArray } from "../raw/Entities.js";
|
|
2
2
|
import {
|
|
3
3
|
Cardinality,
|
|
4
4
|
RelationDefinitionRawSchema,
|
|
5
5
|
RelationDefinitionRawSchemaArray,
|
|
6
|
-
} from "../raw/RelationDefinitions";
|
|
7
|
-
import { Schema } from "./Schema";
|
|
8
|
-
import { EntitySchema } from "./EntitySchema";
|
|
6
|
+
} from "../raw/RelationDefinitions.js";
|
|
7
|
+
import { Schema } from "./Schema.js";
|
|
8
|
+
import { EntitySchema } from "./EntitySchema.js";
|
|
9
9
|
|
|
10
10
|
// This prefix is often applied to relation types as convention
|
|
11
11
|
// indicating a relation is viewed from the object's point of view
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EntityRole } from "../classes/Utils";
|
|
2
|
-
import { AttributeConstraint, RelationConstraint } from "./Constraints";
|
|
3
|
-
import { EntityRawSchema, EntityRawSchemaArray } from "./Entities";
|
|
1
|
+
import { EntityRole } from "../classes/Utils.js";
|
|
2
|
+
import { AttributeConstraint, RelationConstraint } from "./Constraints.js";
|
|
3
|
+
import { EntityRawSchema, EntityRawSchemaArray } from "./Entities.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Type representing all the possible cardinalities in CubicWeb.
|
package/src/schema/raw/Schema.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EntityRawSchemaArray } from "./Entities";
|
|
2
|
-
import { RelationDefinitionRawSchemaArray } from "./RelationDefinitions";
|
|
1
|
+
import { EntityRawSchemaArray } from "./Entities.js";
|
|
2
|
+
import { RelationDefinitionRawSchemaArray } from "./RelationDefinitions.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The full raw JSON schema type as returned by the API.
|
package/src/schema/raw/Utils.ts
CHANGED