@opra/sqb 1.27.1 → 1.27.2

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.
@@ -1,4 +1,4 @@
1
- import { classes, cloneObject, } from '@opra/common';
1
+ import { classes, cloneObject, ComplexType, DocumentElement, OpraSchema, } from '@opra/common';
2
2
  import { DataType as SqbDataType, EntityMetadata, isAssociationField, isColumnField, } from '@sqb/connect';
3
3
  var DataTypeFactory = classes.DataTypeFactory;
4
4
  const _prepareComplexTypeArgs = DataTypeFactory
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/sqb",
3
- "version": "1.27.1",
3
+ "version": "1.27.2",
4
4
  "description": "Opra SQB adapter package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -10,10 +10,10 @@
10
10
  "valgen": "^6.0.3"
11
11
  },
12
12
  "peerDependencies": {
13
- "@opra/core": "^1.27.1",
14
- "@opra/http": "^1.27.1",
15
- "@sqb/builder": ">4.0.0 <6",
16
- "@sqb/connect": ">4.0.0 <6"
13
+ "@opra/core": "^1.27.2",
14
+ "@opra/http": "^1.27.2",
15
+ "@sqb/builder": ">=5.0.1 <6",
16
+ "@sqb/connect": ">=5.0.1 <6"
17
17
  },
18
18
  "type": "module",
19
19
  "module": "./index.js",
@@ -1,3 +1,4 @@
1
+ import type { SqlElement } from '@sqb/builder';
1
2
  import type { DTO, PartialDTO, PatchDTO, RequiredSome, Type } from 'ts-gems';
2
3
  import { SQBAdapter } from './sqb-adapter.js';
3
4
  import { SqbEntityService } from './sqb-entity-service.js';
@@ -195,7 +196,7 @@ export declare class SqbCollectionService<T extends object = object> extends Sqb
195
196
  * @param options - Options including a required `projection`.
196
197
  * @returns The updated record as a partial DTO, or `undefined` if not found.
197
198
  */
198
- update(id: SQBAdapter.IdOrIds, input: PatchDTO<T>, options?: RequiredSome<SqbEntityService.UpdateOneOptions, 'projection'>): Promise<PartialDTO<T> | undefined>;
199
+ update(id: SQBAdapter.IdOrIds, input: PatchDTO<T, SqlElement>, options?: RequiredSome<SqbEntityService.UpdateOneOptions, 'projection'>): Promise<PartialDTO<T> | undefined>;
199
200
  /**
200
201
  * Updates a record by ID and returns the full updated DTO.
201
202
  *
@@ -204,7 +205,7 @@ export declare class SqbCollectionService<T extends object = object> extends Sqb
204
205
  * @param options - Optional update options.
205
206
  * @returns The updated record as a full DTO, or `undefined` if not found.
206
207
  */
207
- update(id: SQBAdapter.IdOrIds, input: PatchDTO<T>, options?: SqbEntityService.UpdateOneOptions): Promise<DTO<T> | undefined>;
208
+ update(id: SQBAdapter.IdOrIds, input: PatchDTO<T, SqlElement>, options?: SqbEntityService.UpdateOneOptions): Promise<DTO<T> | undefined>;
208
209
  /**
209
210
  * Updates a record by ID without returning it.
210
211
  *
@@ -213,7 +214,7 @@ export declare class SqbCollectionService<T extends object = object> extends Sqb
213
214
  * @param options - Optional update options.
214
215
  * @returns The number of records modified.
215
216
  */
216
- updateOnly(id: SQBAdapter.IdOrIds, input: PatchDTO<T>, options?: SqbEntityService.UpdateOneOptions): Promise<number>;
217
+ updateOnly(id: SQBAdapter.IdOrIds, input: PatchDTO<T, SqlElement>, options?: SqbEntityService.UpdateOneOptions): Promise<number>;
217
218
  /**
218
219
  * Updates all records matching the given options.
219
220
  *
@@ -221,5 +222,5 @@ export declare class SqbCollectionService<T extends object = object> extends Sqb
221
222
  * @param options - Options including filter criteria.
222
223
  * @returns The number of records modified.
223
224
  */
224
- updateMany(input: PatchDTO<T>, options?: SqbEntityService.UpdateManyOptions): Promise<number>;
225
+ updateMany(input: PatchDTO<T, SqlElement>, options?: SqbEntityService.UpdateManyOptions): Promise<number>;
225
226
  }
@@ -1,5 +1,6 @@
1
1
  import { ComplexType } from '@opra/common';
2
2
  import { ExecutionContext, ServiceBase } from '@opra/core';
3
+ import { type SqlElement } from '@sqb/builder';
3
4
  import { EntityMetadata, Repository } from '@sqb/connect';
4
5
  import type { Nullish, PartialDTO, PatchDTO, RequiredSome, StrictOmit, Type } from 'ts-gems';
5
6
  import { type vg } from 'valgen';
@@ -112,12 +113,12 @@ export declare namespace SqbEntityService {
112
113
  }
113
114
  interface UpdateOneCommand<T> extends CommandInfo {
114
115
  crud: 'update';
115
- input: PatchDTO<T>;
116
+ input: PatchDTO<T, SqlElement>;
116
117
  options?: UpdateOneOptions;
117
118
  }
118
119
  interface UpdateManyCommand<T> extends CommandInfo {
119
120
  crud: 'update';
120
- input: PatchDTO<T>;
121
+ input: PatchDTO<T, SqlElement>;
121
122
  options?: UpdateManyOptions;
122
123
  }
123
124
  }
@@ -1,6 +1,7 @@
1
- import { InternalServerError } from '@opra/common';
1
+ import { ComplexType, DataType, InternalServerError } from '@opra/common';
2
+ import { ExecutionContext, ServiceBase } from '@opra/core';
2
3
  import { sql } from '@sqb/builder';
3
- import { EntityMetadata } from '@sqb/connect';
4
+ import { EntityMetadata, Repository } from '@sqb/connect';
4
5
  import { isNotNullish } from 'valgen';
5
6
  import { SQBAdapter } from './sqb-adapter.js';
6
7
  import { SqbServiceBase } from './sqb-service-base.js';
@@ -1,5 +1,5 @@
1
1
  import { ServiceBase } from '@opra/core';
2
- import { SqbConnection } from '@sqb/connect';
2
+ import { SqbClient, SqbConnection } from '@sqb/connect';
3
3
  const transactionKey = Symbol.for('transaction');
4
4
  /**
5
5
  * Base class for services using SQB (SQL Builder) for database operations.
@@ -1,3 +1,4 @@
1
+ import type { SqlElement } from '@sqb/builder';
1
2
  import type { PartialDTO, PatchDTO, RequiredSome, Type } from 'ts-gems';
2
3
  import { SQBAdapter } from './sqb-adapter.js';
3
4
  import { SqbEntityService } from './sqb-entity-service.js';
@@ -109,7 +110,7 @@ export declare class SqbSingletonService<T extends object = object> extends SqbE
109
110
  * @param options - Options including a required `projection`.
110
111
  * @returns The updated record as a partial DTO, or `undefined` if not found.
111
112
  */
112
- update(input: PatchDTO<T>, options: RequiredSome<SqbEntityService.UpdateOneOptions, 'projection'>): Promise<PartialDTO<T> | undefined>;
113
+ update(input: PatchDTO<T, SqlElement>, options: RequiredSome<SqbEntityService.UpdateOneOptions, 'projection'>): Promise<PartialDTO<T> | undefined>;
113
114
  /**
114
115
  * Updates the singleton record and returns the full DTO.
115
116
  *
@@ -117,7 +118,7 @@ export declare class SqbSingletonService<T extends object = object> extends SqbE
117
118
  * @param options - Optional update options.
118
119
  * @returns The updated record as a full DTO, or `undefined` if not found.
119
120
  */
120
- update(input: PatchDTO<T>, options?: SqbEntityService.UpdateOneOptions): Promise<T | undefined>;
121
+ update(input: PatchDTO<T, SqlElement>, options?: SqbEntityService.UpdateOneOptions): Promise<T | undefined>;
121
122
  /**
122
123
  * Updates the singleton record without returning it.
123
124
  *
@@ -125,5 +126,5 @@ export declare class SqbSingletonService<T extends object = object> extends SqbE
125
126
  * @param options - Optional update options.
126
127
  * @returns The number of records modified.
127
128
  */
128
- updateOnly(input: PatchDTO<T>, options?: SqbEntityService.UpdateOneOptions): Promise<number>;
129
+ updateOnly(input: PatchDTO<T, SqlElement>, options?: SqbEntityService.UpdateOneOptions): Promise<number>;
129
130
  }