@ronin/compiler 0.17.14 → 0.17.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +5 -3
- package/dist/index.js +9 -7
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
/** Query types used for reading data. */
|
2
|
-
declare const
|
2
|
+
declare const DML_QUERY_TYPES_READ: readonly ["get", "count"];
|
3
3
|
/** Query types used for writing data. */
|
4
|
-
declare const
|
4
|
+
declare const DML_QUERY_TYPES_WRITE: readonly ["set", "add", "remove"];
|
5
5
|
/** Query types used for interacting with data. */
|
6
6
|
declare const DML_QUERY_TYPES: readonly ["get", "count", "set", "add", "remove"];
|
7
7
|
/** Query types used for interacting with the database schema. */
|
8
8
|
declare const DDL_QUERY_TYPES: readonly ["create", "alter", "drop"];
|
9
|
+
/** All query types. */
|
10
|
+
declare const QUERY_TYPES: readonly ["get", "count", "set", "add", "remove", "create", "alter", "drop"];
|
9
11
|
/**
|
10
12
|
* A list of placeholders that can be located inside queries after those queries were
|
11
13
|
* serialized into JSON objects.
|
@@ -473,4 +475,4 @@ declare class Transaction {
|
|
473
475
|
|
474
476
|
declare const CLEAN_ROOT_MODEL: PublicModel;
|
475
477
|
|
476
|
-
export { type AddInstructions, type AddQuery, type AddInstructions as AddQueryInstructions, type AlterQuery, type CombinedInstructions, type CountInstructions, type CountQuery, type CountInstructions as CountQueryInstructions, type CreateQuery, DDL_QUERY_TYPES, DML_QUERY_TYPES,
|
478
|
+
export { type AddInstructions, type AddQuery, type AddInstructions as AddQueryInstructions, type AlterQuery, type CombinedInstructions, type CountInstructions, type CountQuery, type CountInstructions as CountQueryInstructions, type CreateQuery, DDL_QUERY_TYPES, DML_QUERY_TYPES, DML_QUERY_TYPES_READ, DML_QUERY_TYPES_WRITE, type DropQuery, type ExpandedResult, type GetInstructions, type GetQuery, type GetInstructions as GetQueryInstructions, type PublicModel as Model, type ModelField, type ModelIndex, type ModelPreset, type ModelTrigger, QUERY_SYMBOLS, QUERY_TYPES, type Query, type QueryInstructionType as QueryInstruction, type QuerySchemaType, type QueryType, CLEAN_ROOT_MODEL as ROOT_MODEL, type RegularResult, type RemoveInstructions, type RemoveQuery, type RemoveInstructions as RemoveQueryInstructions, type Result, type ResultRecord, RoninError, type SetInstructions, type SetQuery, type SetInstructions as SetQueryInstructions, type Statement, type StoredObject, Transaction, type WithInstruction, getQuerySymbol };
|
package/dist/index.js
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
// src/utils/constants.ts
|
2
|
-
var
|
3
|
-
var
|
2
|
+
var DML_QUERY_TYPES_READ = ["get", "count"];
|
3
|
+
var DML_QUERY_TYPES_WRITE = ["set", "add", "remove"];
|
4
4
|
var DML_QUERY_TYPES = [
|
5
|
-
...
|
6
|
-
...
|
5
|
+
...DML_QUERY_TYPES_READ,
|
6
|
+
...DML_QUERY_TYPES_WRITE
|
7
7
|
];
|
8
8
|
var DDL_QUERY_TYPES = ["create", "alter", "drop"];
|
9
|
+
var QUERY_TYPES = [...DML_QUERY_TYPES, ...DDL_QUERY_TYPES];
|
9
10
|
var QUERY_SYMBOLS = {
|
10
11
|
// Represents a sub query.
|
11
12
|
QUERY: "__RONIN_QUERY",
|
@@ -1201,7 +1202,7 @@ var compileQueryInput = (defaultQuery, models, statementParams, options) => {
|
|
1201
1202
|
if (queryType === "get" && !isJoiningMultipleRows && (single || instructions?.limitedTo)) {
|
1202
1203
|
statement += handleLimitedTo(single, instructions?.limitedTo);
|
1203
1204
|
}
|
1204
|
-
if (
|
1205
|
+
if (DML_QUERY_TYPES_WRITE.includes(queryType) && returning) {
|
1205
1206
|
statement += `RETURNING ${columns}`;
|
1206
1207
|
}
|
1207
1208
|
const mainStatement = {
|
@@ -2378,9 +2379,10 @@ var CLEAN_ROOT_MODEL = omit(ROOT_MODEL, ["system"]);
|
|
2378
2379
|
export {
|
2379
2380
|
DDL_QUERY_TYPES,
|
2380
2381
|
DML_QUERY_TYPES,
|
2381
|
-
|
2382
|
-
|
2382
|
+
DML_QUERY_TYPES_READ,
|
2383
|
+
DML_QUERY_TYPES_WRITE,
|
2383
2384
|
QUERY_SYMBOLS,
|
2385
|
+
QUERY_TYPES,
|
2384
2386
|
CLEAN_ROOT_MODEL as ROOT_MODEL,
|
2385
2387
|
RoninError,
|
2386
2388
|
Transaction,
|