@cubicweb/client 2.1.1 → 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.
Files changed (64) hide show
  1. package/README.md +28 -16
  2. package/lib/Errors.js +3 -9
  3. package/lib/Errors.js.map +1 -1
  4. package/lib/api/Api.d.ts +35 -15
  5. package/lib/api/Api.d.ts.map +1 -1
  6. package/lib/api/Api.js +152 -133
  7. package/lib/api/Api.js.map +1 -1
  8. package/lib/api/Client.d.ts +20 -9
  9. package/lib/api/Client.d.ts.map +1 -1
  10. package/lib/api/Client.js +40 -49
  11. package/lib/api/Client.js.map +1 -1
  12. package/lib/api/Transaction.d.ts +33 -20
  13. package/lib/api/Transaction.d.ts.map +1 -1
  14. package/lib/api/Transaction.js +50 -46
  15. package/lib/api/Transaction.js.map +1 -1
  16. package/lib/index.d.ts +13 -13
  17. package/lib/index.d.ts.map +1 -1
  18. package/lib/index.js +12 -33
  19. package/lib/index.js.map +1 -1
  20. package/lib/schema/classes/EntitySchema.d.ts +21 -27
  21. package/lib/schema/classes/EntitySchema.d.ts.map +1 -1
  22. package/lib/schema/classes/EntitySchema.js +20 -30
  23. package/lib/schema/classes/EntitySchema.js.map +1 -1
  24. package/lib/schema/classes/RelationDefinitionSchema.d.ts +13 -15
  25. package/lib/schema/classes/RelationDefinitionSchema.d.ts.map +1 -1
  26. package/lib/schema/classes/RelationDefinitionSchema.js +14 -30
  27. package/lib/schema/classes/RelationDefinitionSchema.js.map +1 -1
  28. package/lib/schema/classes/Schema.d.ts +9 -7
  29. package/lib/schema/classes/Schema.d.ts.map +1 -1
  30. package/lib/schema/classes/Schema.js +10 -11
  31. package/lib/schema/classes/Schema.js.map +1 -1
  32. package/lib/schema/classes/Utils.d.ts +139 -5
  33. package/lib/schema/classes/Utils.d.ts.map +1 -1
  34. package/lib/schema/classes/Utils.js +157 -11
  35. package/lib/schema/classes/Utils.js.map +1 -1
  36. package/lib/schema/raw/Constraints.d.ts +17 -9
  37. package/lib/schema/raw/Constraints.d.ts.map +1 -1
  38. package/lib/schema/raw/Constraints.js +1 -2
  39. package/lib/schema/raw/Entities.d.ts +4 -0
  40. package/lib/schema/raw/Entities.d.ts.map +1 -1
  41. package/lib/schema/raw/Entities.js +1 -2
  42. package/lib/schema/raw/RelationDefinitions.d.ts +17 -4
  43. package/lib/schema/raw/RelationDefinitions.d.ts.map +1 -1
  44. package/lib/schema/raw/RelationDefinitions.js +1 -2
  45. package/lib/schema/raw/Schema.d.ts +4 -2
  46. package/lib/schema/raw/Schema.d.ts.map +1 -1
  47. package/lib/schema/raw/Schema.js +1 -2
  48. package/lib/schema/raw/Utils.d.ts +7 -1
  49. package/lib/schema/raw/Utils.d.ts.map +1 -1
  50. package/lib/schema/raw/Utils.js +1 -2
  51. package/package.json +6 -9
  52. package/src/api/Api.ts +110 -57
  53. package/src/api/Client.ts +36 -19
  54. package/src/api/Transaction.ts +56 -37
  55. package/src/index.ts +13 -13
  56. package/src/schema/classes/EntitySchema.ts +43 -46
  57. package/src/schema/classes/RelationDefinitionSchema.ts +16 -31
  58. package/src/schema/classes/Schema.ts +12 -7
  59. package/src/schema/classes/Utils.ts +182 -5
  60. package/src/schema/raw/Constraints.ts +20 -8
  61. package/src/schema/raw/Entities.ts +4 -0
  62. package/src/schema/raw/RelationDefinitions.ts +17 -4
  63. package/src/schema/raw/Schema.ts +4 -2
  64. package/src/schema/raw/Utils.ts +7 -1
@@ -1,12 +1,13 @@
1
- import { Schema } from "../schema/classes/Schema";
2
- import { RQLParams, ResultSet, CurrentUser } from "./Api";
3
- import { Transaction, TransactionBackend, TransactionResult } from "./Transaction";
1
+ import { Schema } from "../schema/classes/Schema.js";
2
+ import { RQLParams, ResultSet, CurrentUser } from "./Api.js";
3
+ import { BinariesParam, Transaction, TransactionResult } from "./Transaction.js";
4
4
  /**
5
5
  * Class used to communicate with a CubicWeb instance's API.
6
+ *
7
+ * @category Api
6
8
  */
7
9
  export default class Client {
8
10
  private api;
9
- private transactionBackend;
10
11
  /**
11
12
  * Class used to communicate with a CubicWeb instance's API.
12
13
  *
@@ -14,9 +15,7 @@ export default class Client {
14
15
  * Example: if you can retrieve the schema with https://example.com/api/v1/schema,
15
16
  * use https://example.com/api as `apiUrl`.
16
17
  */
17
- constructor(apiUrl: string, options?: {
18
- transactionBackend?: TransactionBackend;
19
- });
18
+ constructor(apiUrl: string);
20
19
  get apiUrl(): string;
21
20
  /**
22
21
  * Executes the given query and waits for the response.
@@ -25,13 +24,13 @@ export default class Client {
25
24
  * @param params The additional parameters for the request
26
25
  * @returns A promise with the request's result set
27
26
  */
28
- execute(query: string, params?: RQLParams): Promise<ResultSet>;
27
+ execute(query: string, params?: RQLParams, binaries?: BinariesParam): Promise<ResultSet>;
29
28
  /**
30
29
  * Retrieves the CubicWeb instance's JSON schema.
31
30
  *
32
31
  * @returns The CubicWeb instance's JSON schema.
33
32
  */
34
- schema(): Promise<Schema<import("..").EntityRawSchemaArray, import("..").RelationDefinitionRawSchemaArray<import("..").EntityRawSchemaArray>>>;
33
+ schema(): Promise<Schema<import("../index.js").EntityRawSchemaArray, import("../index.js").RelationDefinitionRawSchemaArray<import("../index.js").EntityRawSchemaArray>>>;
35
34
  /**
36
35
  * Tries to log in the user on the configured CubicWeb instance with the given credentials.
37
36
  *
@@ -40,6 +39,12 @@ export default class Client {
40
39
  * @returns A promise returning true if the login was successful, false otherwise
41
40
  */
42
41
  login(login: string, password: string): Promise<boolean>;
42
+ /**
43
+ * Logs out the current user. Will invalidate any authentication cookie active.
44
+ *
45
+ * @returns A promise which will resolve when the user is properly logged out
46
+ */
47
+ logout(): Promise<void>;
43
48
  /**
44
49
  * Get the user associated to this client
45
50
  *
@@ -51,5 +56,11 @@ export default class Client {
51
56
  * @returns A promise fulfilled when the transaction is completed
52
57
  */
53
58
  executeTransaction(transaction: Transaction): Promise<TransactionResult>;
59
+ /**
60
+ * Get the binary for the given entity attribute
61
+ *
62
+ * @returns A promise resolving to the binary
63
+ */
64
+ getBinary(eid: number, attribute: string): Promise<Blob>;
54
65
  }
55
66
  //# sourceMappingURL=Client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Client.d.ts","sourceRoot":"","sources":["../../src/api/Client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAY,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,EAEL,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,MAAM;IACzB,OAAO,CAAC,GAAG,CAAM;IACjB,OAAO,CAAC,kBAAkB,CAAqB;IAE/C;;;;;;OAMG;gBAED,MAAM,EAAE,MAAM,EACd,OAAO,GAAE;QAAE,kBAAkB,CAAC,EAAE,kBAAkB,CAAA;KAAO;IAW3D,IAAI,MAAM,WAET;IAED;;;;;;OAMG;IACG,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,GAAE,SAAc,GAAG,OAAO,CAAC,SAAS,CAAC;IAIxE;;;;OAIG;IACG,MAAM;IAKZ;;;;;;OAMG;IACG,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAI3C;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC;IAIzC;;;OAGG;IACG,kBAAkB,CACtB,WAAW,EAAE,WAAW,GACvB,OAAO,CAAC,iBAAiB,CAAC;CAG9B"}
1
+ {"version":3,"file":"Client.d.ts","sourceRoot":"","sources":["../../src/api/Client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAY,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,EACL,aAAa,EACb,WAAW,EACX,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAE1B;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,MAAM;IACzB,OAAO,CAAC,GAAG,CAAM;IAEjB;;;;;;OAMG;gBACS,MAAM,EAAE,MAAM;IAI1B,IAAI,MAAM,WAET;IAED;;;;;;OAMG;IACG,OAAO,CACX,KAAK,EAAE,MAAM,EACb,MAAM,GAAE,SAAc,EACtB,QAAQ,CAAC,EAAE,aAAa,GACvB,OAAO,CAAC,SAAS,CAAC;IAQrB;;;;OAIG;IACG,MAAM;IAKZ;;;;;;OAMG;IACG,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAI3C;;;;OAIG;IACG,MAAM;IAIZ;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC;IAIzC;;;OAGG;IACG,kBAAkB,CACtB,WAAW,EAAE,WAAW,GACvB,OAAO,CAAC,iBAAiB,CAAC;IAI7B;;;;OAIG;IACG,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAG/C"}
package/lib/api/Client.js CHANGED
@@ -1,24 +1,13 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const Schema_1 = require("../schema/classes/Schema");
16
- const Api_1 = __importDefault(require("./Api"));
17
- const Transaction_1 = require("./Transaction");
1
+ import { Schema } from "../schema/classes/Schema.js";
2
+ import Api from "./Api.js";
3
+ import { Transaction, } from "./Transaction.js";
18
4
  /**
19
5
  * Class used to communicate with a CubicWeb instance's API.
6
+ *
7
+ * @category Api
20
8
  */
21
- class Client {
9
+ export default class Client {
10
+ api;
22
11
  /**
23
12
  * Class used to communicate with a CubicWeb instance's API.
24
13
  *
@@ -26,15 +15,8 @@ class Client {
26
15
  * Example: if you can retrieve the schema with https://example.com/api/v1/schema,
27
16
  * use https://example.com/api as `apiUrl`.
28
17
  */
29
- constructor(apiUrl, options = {}) {
30
- this.api = new Api_1.default(apiUrl);
31
- const { transactionBackend } = options;
32
- if (transactionBackend === undefined) {
33
- this.transactionBackend = new Transaction_1.NativeTransactionBackend(this.api);
34
- }
35
- else {
36
- this.transactionBackend = transactionBackend;
37
- }
18
+ constructor(apiUrl) {
19
+ this.api = new Api(apiUrl);
38
20
  }
39
21
  get apiUrl() {
40
22
  return this.api.apiUrl;
@@ -46,21 +28,21 @@ class Client {
46
28
  * @param params The additional parameters for the request
47
29
  * @returns A promise with the request's result set
48
30
  */
49
- execute(query, params = {}) {
50
- return __awaiter(this, void 0, void 0, function* () {
51
- return yield this.api.execute(query, params);
52
- });
31
+ async execute(query, params = {}, binaries) {
32
+ const transaction = new Transaction();
33
+ const transactionQuery = transaction.push(query, params);
34
+ transaction.setBinaries(binaries);
35
+ const result = await this.executeTransaction(transaction);
36
+ return result.resolveQuery(transactionQuery.ref());
53
37
  }
54
38
  /**
55
39
  * Retrieves the CubicWeb instance's JSON schema.
56
40
  *
57
41
  * @returns The CubicWeb instance's JSON schema.
58
42
  */
59
- schema() {
60
- return __awaiter(this, void 0, void 0, function* () {
61
- const schema = yield this.api.schema();
62
- return new Schema_1.Schema(schema);
63
- });
43
+ async schema() {
44
+ const schema = await this.api.schema();
45
+ return new Schema(schema);
64
46
  }
65
47
  /**
66
48
  * Tries to log in the user on the configured CubicWeb instance with the given credentials.
@@ -69,30 +51,39 @@ class Client {
69
51
  * @param password THe user password
70
52
  * @returns A promise returning true if the login was successful, false otherwise
71
53
  */
72
- login(login, password) {
73
- return __awaiter(this, void 0, void 0, function* () {
74
- return yield this.api.login(login, password);
75
- });
54
+ async login(login, password) {
55
+ return await this.api.login(login, password);
56
+ }
57
+ /**
58
+ * Logs out the current user. Will invalidate any authentication cookie active.
59
+ *
60
+ * @returns A promise which will resolve when the user is properly logged out
61
+ */
62
+ async logout() {
63
+ return await this.api.logout();
76
64
  }
77
65
  /**
78
66
  * Get the user associated to this client
79
67
  *
80
68
  * @returns A promise resolving to the current user
81
69
  */
82
- currentUser() {
83
- return __awaiter(this, void 0, void 0, function* () {
84
- return yield this.api.currentUser();
85
- });
70
+ async currentUser() {
71
+ return await this.api.currentUser();
86
72
  }
87
73
  /**
88
74
  * @param transaction Transaction to execute
89
75
  * @returns A promise fulfilled when the transaction is completed
90
76
  */
91
- executeTransaction(transaction) {
92
- return __awaiter(this, void 0, void 0, function* () {
93
- return yield this.transactionBackend.execute(transaction);
94
- });
77
+ async executeTransaction(transaction) {
78
+ return await this.api.rql(transaction);
79
+ }
80
+ /**
81
+ * Get the binary for the given entity attribute
82
+ *
83
+ * @returns A promise resolving to the binary
84
+ */
85
+ async getBinary(eid, attribute) {
86
+ return await this.api.binary(eid, attribute);
95
87
  }
96
88
  }
97
- exports.default = Client;
98
89
  //# sourceMappingURL=Client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Client.js","sourceRoot":"","sources":["../../src/api/Client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qDAAkD;AAClD,gDAA+D;AAC/D,+CAKuB;AAEvB;;GAEG;AACH,MAAqB,MAAM;IAIzB;;;;;;OAMG;IACH,YACE,MAAc,EACd,UAAuD,EAAE;QAEzD,IAAI,CAAC,GAAG,GAAG,IAAI,aAAG,CAAC,MAAM,CAAC,CAAC;QAC3B,MAAM,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC;QACvC,IAAI,kBAAkB,KAAK,SAAS,EAA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CACtB,WAAwB;QAExB,OAAO,MAAM,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACzC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,SAAS,CAAC,GAAW,EAAE,SAAiB;QAC5C,OAAO,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAC/C,CAAC;CACF"}
@@ -1,33 +1,46 @@
1
- import Api, { ResultSet, RQLParamValue } from "./Api";
1
+ import { RQLParams, ResultSet } from "./Api.js";
2
+ export type BinariesParam = Record<string, Blob>;
2
3
  export declare class Transaction {
3
4
  private _queries;
4
- push(query: string, params: Record<string, RQLParamValue | TransactionQueryRef>): TransactionQuery;
5
+ private _binaries;
6
+ push(query: string, params: RQLParams): TransactionQuery;
7
+ setBinaries(binaries?: BinariesParam): void;
8
+ get binaries(): BinariesParam;
5
9
  get queries(): ReadonlyArray<TransactionQuery>;
6
10
  }
11
+ export declare class TransactionQuery {
12
+ readonly query: string;
13
+ readonly params: RQLParams;
14
+ readonly index: number;
15
+ constructor(query: string, params: RQLParams, index: number);
16
+ ref(): TransactionQueryRef;
17
+ }
7
18
  export declare class TransactionResult {
8
19
  private resultSets;
9
20
  constructor(resultSets: ReadonlyArray<ResultSet>);
10
- resolve(ref: TransactionQueryRef): string | number | boolean | null;
21
+ resolveQuery(ref: TransactionQueryRef): ResultSet;
22
+ resolveRow(ref: TransactionQueryRowRef): import("./Api.js").RqlRow;
23
+ resolveScalar(ref: TransactionQueryScalarRef): string | number | boolean | null;
11
24
  }
12
- export interface TransactionQueryRef {
13
- queryIndex: number;
14
- row: number;
15
- column: number;
25
+ export declare class TransactionQueryRef {
26
+ readonly queryIndex: number;
27
+ constructor(queryIndex: number);
28
+ row(r: number): TransactionQueryRowRef;
16
29
  }
17
- export declare class TransactionQuery {
18
- readonly query: string;
19
- readonly params: Record<string, RQLParamValue | TransactionQueryRef>;
20
- readonly index: number;
21
- constructor(query: string, params: Record<string, RQLParamValue | TransactionQueryRef>, index: number);
22
- ref(row?: number, column?: number): TransactionQueryRef;
30
+ export declare class TransactionQueryRowRef {
31
+ readonly queryIndex: number;
32
+ readonly row: number;
33
+ constructor(queryIndex: number, row: number);
34
+ column(c: number): TransactionQueryScalarRef;
23
35
  }
24
- export declare function isTransactionQueryRef(value: RQLParamValue | TransactionQueryRef): value is TransactionQueryRef;
25
- export interface TransactionBackend {
26
- execute(transaction: Transaction): Promise<TransactionResult>;
36
+ export interface TransactionQueryScalarRef {
37
+ readonly queryIndex: number;
38
+ readonly row: number;
39
+ readonly column: number;
40
+ readonly type: "query_reference";
27
41
  }
28
- export declare class NativeTransactionBackend implements TransactionBackend {
29
- private _api;
30
- constructor(_api: Api);
31
- execute(transaction: Transaction): Promise<TransactionResult>;
42
+ export interface TransactionQueryBinaryRef {
43
+ readonly ref: string;
44
+ readonly type: "binary_reference";
32
45
  }
33
46
  //# sourceMappingURL=Transaction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Transaction.d.ts","sourceRoot":"","sources":["../../src/api/Transaction.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtD,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAA+B;IAE/C,IAAI,CACF,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG,mBAAmB,CAAC,GAC1D,gBAAgB;IAUnB,IAAI,OAAO,IAAI,aAAa,CAAC,gBAAgB,CAAC,CAE7C;CACF;AAED,qBAAa,iBAAiB;IAChB,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,aAAa,CAAC,SAAS,CAAC;IAExD,OAAO,CAAC,GAAG,EAAE,mBAAmB;CAGjC;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,MA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F;AAED,qBAAa,gBAAgB;aAET,KAAK,EAAE,MAAM;aACb,MAAM,EAAE,SAAS;aACjB,KAAK,EAAE,MAAM;gBAFb,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,MAAM;IAG/B,GAAG,IAAI,mBAAmB;CAG3B;AAED,qBAAa,iBAAiB;IAChB,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,aAAa,CAAC,SAAS,CAAC;IAExD,YAAY,CAAC,GAAG,EAAE,mBAAmB;IAIrC,UAAU,CAAC,GAAG,EAAE,sBAAsB;IAItC,aAAa,CAAC,GAAG,EAAE,yBAAyB;CAG7C;AAED,qBAAa,mBAAmB;aACF,UAAU,EAAE,MAAM;gBAAlB,UAAU,EAAE,MAAM;IAE9C,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,sBAAsB;CAGvC;AAED,qBAAa,sBAAsB;aAEf,UAAU,EAAE,MAAM;aAClB,GAAG,EAAE,MAAM;gBADX,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM;IAG7B,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,yBAAyB;CAQ7C;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;CAClC;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;CACnC"}
@@ -1,68 +1,72 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.NativeTransactionBackend = exports.isTransactionQueryRef = exports.TransactionQuery = exports.TransactionResult = exports.Transaction = void 0;
13
- class Transaction {
14
- constructor() {
15
- this._queries = [];
16
- }
1
+ export class Transaction {
2
+ _queries = [];
3
+ _binaries = {};
17
4
  push(query, params) {
18
5
  const stackedQuery = new TransactionQuery(query, params, this._queries.length);
19
6
  this._queries.push(stackedQuery);
20
7
  return stackedQuery;
21
8
  }
9
+ setBinaries(binaries) {
10
+ this._binaries = binaries ?? {};
11
+ }
12
+ get binaries() {
13
+ return this._binaries;
14
+ }
22
15
  get queries() {
23
16
  return this._queries;
24
17
  }
25
18
  }
26
- exports.Transaction = Transaction;
27
- class TransactionResult {
19
+ export class TransactionQuery {
20
+ query;
21
+ params;
22
+ index;
23
+ constructor(query, params, index) {
24
+ this.query = query;
25
+ this.params = params;
26
+ this.index = index;
27
+ }
28
+ ref() {
29
+ return new TransactionQueryRef(this.index);
30
+ }
31
+ }
32
+ export class TransactionResult {
33
+ resultSets;
28
34
  constructor(resultSets) {
29
35
  this.resultSets = resultSets;
30
36
  }
31
- resolve(ref) {
37
+ resolveQuery(ref) {
38
+ return this.resultSets[ref.queryIndex];
39
+ }
40
+ resolveRow(ref) {
41
+ return this.resultSets[ref.queryIndex][ref.row];
42
+ }
43
+ resolveScalar(ref) {
32
44
  return this.resultSets[ref.queryIndex][ref.row][ref.column];
33
45
  }
34
46
  }
35
- exports.TransactionResult = TransactionResult;
36
- class TransactionQuery {
37
- constructor(query, params, index) {
38
- this.query = query;
39
- this.params = params;
40
- this.index = index;
47
+ export class TransactionQueryRef {
48
+ queryIndex;
49
+ constructor(queryIndex) {
50
+ this.queryIndex = queryIndex;
41
51
  }
42
- ref(row = 0, column = 0) {
43
- return {
44
- queryIndex: this.index,
45
- row,
46
- column,
47
- };
52
+ row(r) {
53
+ return new TransactionQueryRowRef(this.queryIndex, r);
48
54
  }
49
55
  }
50
- exports.TransactionQuery = TransactionQuery;
51
- function isTransactionQueryRef(value) {
52
- return (typeof value === "object" &&
53
- value !== null &&
54
- ["queryIndex", "row", "column"].every((key) => Object.keys(value).includes(key)));
55
- }
56
- exports.isTransactionQueryRef = isTransactionQueryRef;
57
- class NativeTransactionBackend {
58
- constructor(_api) {
59
- this._api = _api;
56
+ export class TransactionQueryRowRef {
57
+ queryIndex;
58
+ row;
59
+ constructor(queryIndex, row) {
60
+ this.queryIndex = queryIndex;
61
+ this.row = row;
60
62
  }
61
- execute(transaction) {
62
- return __awaiter(this, void 0, void 0, function* () {
63
- return this._api.executeTransaction(transaction);
64
- });
63
+ column(c) {
64
+ return {
65
+ type: "query_reference",
66
+ queryIndex: this.queryIndex,
67
+ row: this.row,
68
+ column: c,
69
+ };
65
70
  }
66
71
  }
67
- exports.NativeTransactionBackend = NativeTransactionBackend;
68
72
  //# sourceMappingURL=Transaction.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../../src/api/Transaction.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAa,WAAW;IAAxB;QACU,aAAQ,GAA4B,EAAE,CAAC;IAkBjD,CAAC;IAhBC,IAAI,CACF,KAAa,EACb,MAA2D;QAE3D,MAAM,YAAY,GAAG,IAAI,gBAAgB,CACvC,KAAK,EACL,MAAM,EACN,IAAI,CAAC,QAAQ,CAAC,MAAM,CACrB,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACjC,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF;AAnBD,kCAmBC;AAED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,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9D,CAAC;CACF;AAED,MAAM,OAAO,mBAAmB;IACF;IAA5B,YAA4B,UAAkB;QAAlB,eAAU,GAAV,UAAU,CAAQ;IAAG,CAAC;IAElD,GAAG,CAAC,CAAS;QACX,OAAO,IAAI,sBAAsB,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IACxD,CAAC;CACF;AAED,MAAM,OAAO,sBAAsB;IAEf;IACA;IAFlB,YACkB,UAAkB,EAClB,GAAW;QADX,eAAU,GAAV,UAAU,CAAQ;QAClB,QAAG,GAAH,GAAG,CAAQ;IAC1B,CAAC;IAEJ,MAAM,CAAC,CAAS;QACd,OAAO;YACL,IAAI,EAAE,iBAAiB;YACvB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,MAAM,EAAE,CAAC;SACV,CAAC;IACJ,CAAC;CACF"}
package/lib/index.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- export * from "./schema/raw/Constraints";
2
- export * from "./schema/raw/Entities";
3
- export * from "./schema/raw/RelationDefinitions";
4
- export * from "./schema/raw/Schema";
5
- export * from "./schema/raw/Utils";
6
- export * from "./schema/classes/EntitySchema";
7
- export * from "./schema/classes/RelationDefinitionSchema";
8
- export * from "./schema/classes/Schema";
9
- export * from "./schema/classes/Utils";
10
- export * from "./Errors";
11
- export { default as Client } from "./api/Client";
12
- export * from "./api/Transaction";
13
- export { RQLQuery, RQLParams, RqlRow, ResultSet, ApiErrorResponse, } from "./api/Api";
1
+ export * from "./schema/raw/Constraints.js";
2
+ export * from "./schema/raw/Entities.js";
3
+ export * from "./schema/raw/RelationDefinitions.js";
4
+ export * from "./schema/raw/Schema.js";
5
+ export * from "./schema/raw/Utils.js";
6
+ export * from "./schema/classes/EntitySchema.js";
7
+ export * from "./schema/classes/RelationDefinitionSchema.js";
8
+ export * from "./schema/classes/Schema.js";
9
+ export * from "./schema/classes/Utils.js";
10
+ export * from "./Errors.js";
11
+ export { default as Client } from "./api/Client.js";
12
+ export * from "./api/Transaction.js";
13
+ export { RQLQuery, RQLParams, RqlRow, ResultSet, ApiErrorResponse, } from "./api/Api.js";
14
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kCAAkC,CAAC;AACjD,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2CAA2C,CAAC;AAC1D,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AAEvC,cAAc,UAAU,CAAC;AAGzB,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,cAAc,CAAC;AACjD,cAAc,mBAAmB,CAAC;AAClC,OAAO,EACL,QAAQ,EACR,SAAS,EACT,MAAM,EACN,SAAS,EACT,gBAAgB,GACjB,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,qCAAqC,CAAC;AACpD,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AAGtC,cAAc,kCAAkC,CAAC;AACjD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAE1C,cAAc,aAAa,CAAC;AAG5B,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACpD,cAAc,sBAAsB,CAAC;AACrC,OAAO,EACL,QAAQ,EACR,SAAS,EACT,MAAM,EACN,SAAS,EACT,gBAAgB,GACjB,MAAM,cAAc,CAAC"}
package/lib/index.js CHANGED
@@ -1,37 +1,16 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
18
- };
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.Client = void 0;
21
1
  // Raw Schema
22
- __exportStar(require("./schema/raw/Constraints"), exports);
23
- __exportStar(require("./schema/raw/Entities"), exports);
24
- __exportStar(require("./schema/raw/RelationDefinitions"), exports);
25
- __exportStar(require("./schema/raw/Schema"), exports);
26
- __exportStar(require("./schema/raw/Utils"), exports);
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";
27
7
  // Schema Abstraction class
28
- __exportStar(require("./schema/classes/EntitySchema"), exports);
29
- __exportStar(require("./schema/classes/RelationDefinitionSchema"), exports);
30
- __exportStar(require("./schema/classes/Schema"), exports);
31
- __exportStar(require("./schema/classes/Utils"), exports);
32
- __exportStar(require("./Errors"), exports);
8
+ export * from "./schema/classes/EntitySchema.js";
9
+ export * from "./schema/classes/RelationDefinitionSchema.js";
10
+ export * from "./schema/classes/Schema.js";
11
+ export * from "./schema/classes/Utils.js";
12
+ export * from "./Errors.js";
33
13
  // API
34
- var Client_1 = require("./api/Client");
35
- Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return __importDefault(Client_1).default; } });
36
- __exportStar(require("./api/Transaction"), exports);
14
+ export { default as Client } from "./api/Client.js";
15
+ export * from "./api/Transaction.js";
37
16
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,aAAa;AACb,2DAAyC;AACzC,wDAAsC;AACtC,mEAAiD;AACjD,sDAAoC;AACpC,qDAAmC;AAEnC,2BAA2B;AAC3B,gEAA8C;AAC9C,4EAA0D;AAC1D,0DAAwC;AACxC,yDAAuC;AAEvC,2CAAyB;AAEzB,MAAM;AACN,uCAAiD;AAAxC,iHAAA,OAAO,OAAU;AAC1B,oDAAkC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,qCAAqC,CAAC;AACpD,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AAEtC,2BAA2B;AAC3B,cAAc,kCAAkC,CAAC;AACjD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAE1C,cAAc,aAAa,CAAC;AAE5B,MAAM;AACN,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACpD,cAAc,sBAAsB,CAAC"}
@@ -1,12 +1,14 @@
1
- import { EntityRawSchemaArray } from "../raw/Entities";
2
- import { RelationDefinitionRawSchemaArray } from "../raw/RelationDefinitions";
3
- import { RelationDefinitionSchema } from "./RelationDefinitionSchema";
4
- import { Schema } from "./Schema";
5
- import { MatchedRelationDefinition, RelationDefinitionMatcher } from "./Utils";
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 { MatchedRelationDefinition, RelationDefinitionMatcher } from "./Utils.js";
6
6
  /**
7
7
  * Wrapper around raw entity schemas from the Schema.
8
8
  * You should never have to create this object yourself.
9
9
  * Instead, retrieve these objects from the methods in the `Schema` class.
10
+ *
11
+ * @category Schema
10
12
  */
11
13
  export declare class EntitySchema<E extends EntityRawSchemaArray = EntityRawSchemaArray, R extends RelationDefinitionRawSchemaArray<E> = RelationDefinitionRawSchemaArray<E>, ERawSchema extends E[number] = E[number]> {
12
14
  private schema;
@@ -33,23 +35,23 @@ export declare class EntitySchema<E extends EntityRawSchemaArray = EntityRawSche
33
35
  */
34
36
  get final(): ERawSchema["final"];
35
37
  /**
36
- * Gets the list of relation definitions schemas with this entity as subject.
37
- * In case a relation definition schema has this entity as both object and subject,
38
- * there will be dupicates when used along with `objectRelationsDefinitions`.
38
+ * Gets the list of attribute schemas (relation definition schemas with final at false)
39
+ * for this entity schema.
39
40
  */
40
- get subjectRelationDefinitions(): RelationDefinitionSchema<E, R, MatchedRelationDefinition<E, R, {
41
+ get attributes(): RelationDefinitionSchema<E, R, MatchedRelationDefinition<E, R, {
41
42
  subject: ERawSchema["type"];
42
- final: false;
43
- }>>[];
44
- /**
45
- * Gets the list of relation definitions schemas with this entity as object.
46
- * In case a relation definition schema has this entity as both object and subject,
47
- * there will be dupicates when used along with `subjectRelationDefinitions`.
48
- */
49
- get objectRelationsDefinitions(): RelationDefinitionSchema<E, R, MatchedRelationDefinition<E, R, {
50
- object: ERawSchema["type"];
51
- final: false;
43
+ final: true;
52
44
  }>>[];
45
+ get relationDefinitions(): {
46
+ subject: RelationDefinitionSchema<E, R, MatchedRelationDefinition<E, R, {
47
+ subject: ERawSchema["type"];
48
+ final: false;
49
+ }>>[];
50
+ object: RelationDefinitionSchema<E, R, MatchedRelationDefinition<E, R, {
51
+ object: ERawSchema["type"];
52
+ final: false;
53
+ }>>[];
54
+ };
53
55
  /**
54
56
  * Finds relations in the Schema matching the partial relation given.
55
57
  *
@@ -59,13 +61,5 @@ export declare class EntitySchema<E extends EntityRawSchemaArray = EntityRawSche
59
61
  matchRelationDefinitions<M extends RelationDefinitionMatcher<E>>(matcher: M): RelationDefinitionSchema<E, R, MatchedRelationDefinition<E, R, {
60
62
  subject: ERawSchema["type"];
61
63
  }>>[];
62
- /**
63
- * Gets the list of attribute schemas (relation definition schemas with final at false)
64
- * for this entity schema.
65
- */
66
- get attributes(): RelationDefinitionSchema<E, R, MatchedRelationDefinition<E, R, {
67
- subject: ERawSchema["type"];
68
- final: true;
69
- }>>[];
70
64
  }
71
65
  //# sourceMappingURL=EntitySchema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EntitySchema.d.ts","sourceRoot":"","sources":["../../../src/schema/classes/EntitySchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,gCAAgC,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAE/E;;;;GAIG;AACH,qBAAa,YAAY,CACvB,CAAC,SAAS,oBAAoB,GAAG,oBAAoB,EACrD,CAAC,SAAS,gCAAgC,CAAC,CAAC,CAAC,GAAG,gCAAgC,CAAC,CAAC,CAAC,EACnF,UAAU,SAAS,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;IAWtC,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,eAAe;IAVzB;;;;;;;OAOG;gBAEO,MAAM,EAAE,MAAM,CA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