@cubicweb/client
Advanced tools
Comparing version 3.0.0-alpha.12 to 3.0.0-alpha.14
import { ValidationError } from "../errors.js"; | ||
import { getBinariesFromTransaction, serializeQueryParams } from "../utils.js"; | ||
import { ResultSet } from "./ResultSet.js"; | ||
import { TransactionResult } from "./transaction/TransactionResult.js"; | ||
@@ -160,3 +161,3 @@ /** | ||
}); | ||
return new TransactionResult(transaction, resultSets); | ||
return new TransactionResult(transaction, resultSets.map((r) => new ResultSet(r))); | ||
} | ||
@@ -169,3 +170,3 @@ async jsonTransaction(transaction) { | ||
}); | ||
return new TransactionResult(transaction, resultSets); | ||
return new TransactionResult(transaction, resultSets.map((r) => new ResultSet(r))); | ||
} | ||
@@ -172,0 +173,0 @@ handleUserErrors(error) { |
@@ -1,3 +0,3 @@ | ||
import { RQLQueryCellRef, RQLQueryRowRef } from "./references"; | ||
import { RQLQueryParams } from "../Api"; | ||
import { RQLQueryCellRef, RQLQueryRowRef } from "./references.js"; | ||
import { RQLQueryParams } from "../Api.js"; | ||
/** | ||
@@ -4,0 +4,0 @@ * Class representing a RQL query to be sent to the API. |
import { v4 as uuidv4 } from "uuid"; | ||
import { RQLQueryCellRef, RQLQueryRowRef } from "./references"; | ||
import { RQLQueryCellRef, RQLQueryRowRef } from "./references.js"; | ||
/** | ||
@@ -4,0 +4,0 @@ * Class representing a RQL query to be sent to the API. |
@@ -22,5 +22,5 @@ /** | ||
export declare class ResultSet<T extends ReadonlyArray<ResultSetCell> = ReadonlyArray<ResultSetCell>> { | ||
readonly rows: T[]; | ||
constructor(rows: T[]); | ||
readonly rows: ReadonlyArray<T>; | ||
constructor(rows: ReadonlyArray<T>); | ||
} | ||
//# sourceMappingURL=ResultSet.d.ts.map |
@@ -1,5 +0,5 @@ | ||
import { ResultSet, ResultSetCell, ResultSetRow } from "../ResultSet"; | ||
import { RQLQuery } from "../query/RQLQuery"; | ||
import { RQLQueryCellRef, RQLQueryRowRef } from "../query/references"; | ||
import { Transaction } from "./Transaction"; | ||
import { ResultSet, ResultSetCell, ResultSetRow } from "../ResultSet.js"; | ||
import { RQLQuery } from "../query/RQLQuery.js"; | ||
import { RQLQueryCellRef, RQLQueryRowRef } from "../query/references.js"; | ||
import { Transaction } from "./Transaction.js"; | ||
/** | ||
@@ -6,0 +6,0 @@ * Class representing the result of a transaction. |
@@ -1,2 +0,2 @@ | ||
import { getQueryIndexInTransaction } from "../../utils"; | ||
import { getQueryIndexInTransaction } from "../../utils.js"; | ||
/** | ||
@@ -3,0 +3,0 @@ * Class representing the result of a transaction. |
@@ -1,5 +0,5 @@ | ||
import { RQLQueryParams, RQLQueryParamValue } from "./api/Api"; | ||
import { RQLBinary } from "./api/binary/RQLBinary"; | ||
import { RQLQuery } from "./api/query/RQLQuery"; | ||
import { Transaction } from "./api/transaction/Transaction"; | ||
import { RQLQueryParams, RQLQueryParamValue } from "./api/Api.js"; | ||
import { RQLBinary } from "./api/binary/RQLBinary.js"; | ||
import { RQLQuery } from "./api/query/RQLQuery.js"; | ||
import { Transaction } from "./api/transaction/Transaction.js"; | ||
type SerializedRQLParams = Record<string, RQLQueryParamValue | SerializedRqlQueryCellRef | SerializedRqlQueryBinaryRef>; | ||
@@ -6,0 +6,0 @@ interface SerializedRqlQueryCellRef { |
@@ -1,3 +0,3 @@ | ||
import { RQLBinary } from "./api/binary/RQLBinary"; | ||
import { RQLQueryCellRef } from "./api/query/references"; | ||
import { RQLBinary } from "./api/binary/RQLBinary.js"; | ||
import { RQLQueryCellRef } from "./api/query/references.js"; | ||
/** | ||
@@ -47,3 +47,3 @@ * Retrieves the query index in the given transaction from its eid | ||
else { | ||
newParams[k] = k; | ||
newParams[k] = v; | ||
} | ||
@@ -50,0 +50,0 @@ }); |
@@ -5,3 +5,3 @@ { | ||
"author": "Logilab", | ||
"version": "3.0.0-alpha.12", | ||
"version": "3.0.0-alpha.14", | ||
"license": "LGPL-3.0-or-later", | ||
@@ -8,0 +8,0 @@ "scripts": { |
import { ValidationError } from "../errors.js"; | ||
import { RawSchema } from "../schema/raw/Schema.js"; | ||
import { getBinariesFromTransaction, serializeQueryParams } from "../utils.js"; | ||
import { ResultSet } from "./ResultSet.js"; | ||
import { ResultSet, ResultSetCell } from "./ResultSet.js"; | ||
import { RQLBinary } from "./binary/RQLBinary.js"; | ||
@@ -65,2 +65,6 @@ import { RQLQueryCellRef } from "./query/references.js"; | ||
type RawTransactionResult = ReadonlyArray< | ||
ReadonlyArray<ReadonlyArray<ResultSetCell>> | ||
>; | ||
/** | ||
@@ -229,3 +233,3 @@ * Class used to handle requests to the CubicWeb API. | ||
const resultSets = await nonNullFetchApi<ReadonlyArray<ResultSet>>( | ||
const resultSets = await nonNullFetchApi<RawTransactionResult>( | ||
this._rqlApiUrl, | ||
@@ -238,7 +242,10 @@ { | ||
); | ||
return new TransactionResult(transaction, resultSets); | ||
return new TransactionResult( | ||
transaction, | ||
resultSets.map((r) => new ResultSet(r)) | ||
); | ||
} | ||
private async jsonTransaction(transaction: Transaction) { | ||
const resultSets = await nonNullFetchApi<ReadonlyArray<ResultSet>>( | ||
const resultSets = await nonNullFetchApi<RawTransactionResult>( | ||
this._rqlApiUrl, | ||
@@ -251,3 +258,6 @@ { | ||
); | ||
return new TransactionResult(transaction, resultSets); | ||
return new TransactionResult( | ||
transaction, | ||
resultSets.map((r) => new ResultSet(r)) | ||
); | ||
} | ||
@@ -254,0 +264,0 @@ |
import { v4 as uuidv4 } from "uuid"; | ||
import { RQLQueryCellRef, RQLQueryRowRef } from "./references"; | ||
import { RQLQueryParams } from "../Api"; | ||
import { RQLQueryCellRef, RQLQueryRowRef } from "./references.js"; | ||
import { RQLQueryParams } from "../Api.js"; | ||
@@ -5,0 +5,0 @@ /** |
@@ -28,3 +28,3 @@ /** | ||
> { | ||
constructor(public readonly rows: T[]) {} | ||
constructor(public readonly rows: ReadonlyArray<T>) {} | ||
} |
@@ -1,6 +0,6 @@ | ||
import { getQueryIndexInTransaction } from "../../utils"; | ||
import { ResultSet, ResultSetCell, ResultSetRow } from "../ResultSet"; | ||
import { RQLQuery } from "../query/RQLQuery"; | ||
import { RQLQueryCellRef, RQLQueryRowRef } from "../query/references"; | ||
import { Transaction } from "./Transaction"; | ||
import { getQueryIndexInTransaction } from "../../utils.js"; | ||
import { ResultSet, ResultSetCell, ResultSetRow } from "../ResultSet.js"; | ||
import { RQLQuery } from "../query/RQLQuery.js"; | ||
import { RQLQueryCellRef, RQLQueryRowRef } from "../query/references.js"; | ||
import { Transaction } from "./Transaction.js"; | ||
@@ -7,0 +7,0 @@ /** |
@@ -1,6 +0,6 @@ | ||
import { RQLQueryParams, RQLQueryParamValue } from "./api/Api"; | ||
import { RQLBinary } from "./api/binary/RQLBinary"; | ||
import { RQLQuery } from "./api/query/RQLQuery"; | ||
import { RQLQueryCellRef } from "./api/query/references"; | ||
import { Transaction } from "./api/transaction/Transaction"; | ||
import { RQLQueryParams, RQLQueryParamValue } from "./api/Api.js"; | ||
import { RQLBinary } from "./api/binary/RQLBinary.js"; | ||
import { RQLQuery } from "./api/query/RQLQuery.js"; | ||
import { RQLQueryCellRef } from "./api/query/references.js"; | ||
import { Transaction } from "./api/transaction/Transaction.js"; | ||
@@ -75,3 +75,3 @@ type SerializedRQLParams = Record< | ||
} else { | ||
newParams[k] = k; | ||
newParams[k] = v; | ||
} | ||
@@ -78,0 +78,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
182068
3951