@ruiapp/rapid-core 0.1.73 → 0.1.75

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.
@@ -2,6 +2,78 @@ declare const _default: {
2
2
  code: string;
3
3
  name: string;
4
4
  models: ({
5
+ maintainedBy: string;
6
+ namespace: string;
7
+ name: string;
8
+ singularCode: string;
9
+ pluralCode: string;
10
+ schema: string;
11
+ tableName: string;
12
+ properties: ({
13
+ name: string;
14
+ code: string;
15
+ columnName: string;
16
+ type: "integer";
17
+ required: true;
18
+ autoIncrement: true;
19
+ relation?: undefined;
20
+ targetSingularCode?: undefined;
21
+ selfIdColumnName?: undefined;
22
+ } | {
23
+ name: string;
24
+ code: string;
25
+ columnName: string;
26
+ type: "text";
27
+ required: true;
28
+ autoIncrement?: undefined;
29
+ relation?: undefined;
30
+ targetSingularCode?: undefined;
31
+ selfIdColumnName?: undefined;
32
+ } | {
33
+ name: string;
34
+ code: string;
35
+ columnName: string;
36
+ type: "text";
37
+ required: false;
38
+ autoIncrement?: undefined;
39
+ relation?: undefined;
40
+ targetSingularCode?: undefined;
41
+ selfIdColumnName?: undefined;
42
+ } | {
43
+ name: string;
44
+ code: string;
45
+ type: "relation[]";
46
+ relation: "many";
47
+ targetSingularCode: string;
48
+ selfIdColumnName: string;
49
+ columnName?: undefined;
50
+ required?: undefined;
51
+ autoIncrement?: undefined;
52
+ } | {
53
+ name: string;
54
+ code: string;
55
+ columnName: string;
56
+ type: "json";
57
+ required: false;
58
+ autoIncrement?: undefined;
59
+ relation?: undefined;
60
+ targetSingularCode?: undefined;
61
+ selfIdColumnName?: undefined;
62
+ })[];
63
+ indexes: ({
64
+ name: string;
65
+ properties: {
66
+ code: string;
67
+ }[];
68
+ unique: true;
69
+ } | {
70
+ name: string;
71
+ properties: {
72
+ code: string;
73
+ }[];
74
+ unique: false;
75
+ })[];
76
+ } | {
5
77
  maintainedBy: string;
6
78
  namespace: string;
7
79
  name: string;
@@ -87,6 +159,13 @@ declare const _default: {
87
159
  targetIdColumnName?: undefined;
88
160
  defaultValue?: undefined;
89
161
  })[];
162
+ indexes: {
163
+ name: string;
164
+ properties: {
165
+ code: string;
166
+ }[];
167
+ unique: true;
168
+ }[];
90
169
  } | {
91
170
  maintainedBy: string;
92
171
  namespace: string;
@@ -162,6 +241,7 @@ declare const _default: {
162
241
  autoIncrement?: undefined;
163
242
  defaultValue?: undefined;
164
243
  })[];
244
+ indexes?: undefined;
165
245
  } | {
166
246
  maintainedBy: string;
167
247
  namespace: string;
@@ -237,6 +317,7 @@ declare const _default: {
237
317
  targetIdColumnName?: undefined;
238
318
  defaultValue?: undefined;
239
319
  })[];
320
+ indexes?: undefined;
240
321
  } | {
241
322
  maintainedBy: string;
242
323
  namespace: string;
@@ -274,6 +355,7 @@ declare const _default: {
274
355
  required: true;
275
356
  autoIncrement?: undefined;
276
357
  })[];
358
+ indexes?: undefined;
277
359
  })[];
278
360
  routes: {
279
361
  namespace: string;
@@ -0,0 +1,3 @@
1
+ import { RpdDataPropertyTypes } from "../types";
2
+ import { DataAccessPgColumnTypes } from "./dataAccessTypes";
3
+ export declare const pgPropertyTypeColumnMap: Record<Exclude<RpdDataPropertyTypes, "relation" | "relation[]">, DataAccessPgColumnTypes>;
@@ -1,11 +1,13 @@
1
+ export type DataAccessPgColumnTypes = "int4" | "int8" | "float4" | "float8" | "decimal" | "text" | "text[]" | "bool" | "date" | "time" | "timestamptz" | "jsonb";
1
2
  export type RowFilterRelationalOperators = "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "contains" | "notContains" | "containsCS" | "notContainsCS" | "startsWith" | "notStartsWith" | "endsWith" | "notEndsWith";
3
+ export type RowFilterArrayOperators = "arrayContains" | "arrayOverlap";
2
4
  export type RowFilterSetOperators = "in" | "notIn";
3
5
  export type RowFilterLogicalOperators = "or" | "and";
4
6
  export type RowFilterUnaryOperators = "null" | "notNull";
5
7
  export type RowFilterExistenceOperators = "exists" | "notExists";
6
- export type RowFilterOperators = RowFilterRelationalOperators | RowFilterSetOperators | RowFilterLogicalOperators | RowFilterUnaryOperators | RowFilterExistenceOperators;
7
- export type RowFilterOptions = FindRowRelationalFilterOptions | FindRowSetFilterOptions | FindRowLogicalFilterOptions | FindRowUnaryFilterOptions | FindRowExistenceFilterOptions;
8
- export type RowNonRelationPropertyFilterOptions = FindRowRelationalFilterOptions | FindRowSetFilterOptions | FindRowUnaryFilterOptions;
8
+ export type RowFilterOperators = RowFilterRelationalOperators | RowFilterArrayOperators | RowFilterSetOperators | RowFilterLogicalOperators | RowFilterUnaryOperators | RowFilterExistenceOperators;
9
+ export type RowFilterOptions = FindRowRelationalFilterOptions | FindRowArrayFilterOptions | FindRowSetFilterOptions | FindRowLogicalFilterOptions | FindRowUnaryFilterOptions | FindRowExistenceFilterOptions;
10
+ export type RowNonRelationPropertyFilterOptions = FindRowRelationalFilterOptions | FindRowArrayFilterOptions | FindRowSetFilterOptions | FindRowUnaryFilterOptions;
9
11
  export type ColumnSelectOptions = string | ColumnNameWithTableName;
10
12
  export type ColumnNameWithTableName = {
11
13
  name: string;
@@ -24,6 +26,12 @@ export interface FindRowRelationalFilterOptions {
24
26
  operator: RowFilterRelationalOperators;
25
27
  value: any;
26
28
  }
29
+ export interface FindRowArrayFilterOptions {
30
+ field: ColumnSelectOptions;
31
+ operator: RowFilterArrayOperators;
32
+ value: any[];
33
+ itemType?: string;
34
+ }
27
35
  export interface FindRowSetFilterOptions {
28
36
  field: ColumnSelectOptions;
29
37
  operator: RowFilterSetOperators;
@@ -1,5 +1,6 @@
1
- import { AddEntityRelationsOptions, CountEntityOptions, CountEntityResult, CreateEntityOptions, DeleteEntityByIdOptions, FindEntityByIdOptions, FindEntityOptions, FindEntitySelectRelationOptions, IRpdDataAccessor, RemoveEntityRelationsOptions, RpdDataModel, RpdDataModelProperty, UpdateEntityByIdOptions } from "../types";
1
+ import { AddEntityRelationsOptions, CountEntityOptions, CountEntityResult, CreateEntityOptions, DeleteEntityByIdOptions, FindEntityByIdOptions, FindEntityOptions, FindEntitySelectRelationOptions, IRpdDataAccessor, RemoveEntityRelationsOptions, RpdDataModel, RpdDataModelIndex, RpdDataModelProperty, UpdateEntityByIdOptions } from "../types";
2
2
  import { IRpdServer, RapidPlugin } from "../core/server";
3
+ import { RouteContext } from "../core/routeContext";
3
4
  export type FindOneRelationEntitiesOptions = {
4
5
  server: IRpdServer;
5
6
  mainModel: RpdDataModel;
@@ -14,6 +15,12 @@ export type FindManyRelationEntitiesOptions = {
14
15
  mainEntityIds: any[];
15
16
  selectRelationOptions?: FindEntitySelectRelationOptions;
16
17
  };
18
+ export type CheckEntityDuplicatedOptions = {
19
+ routeContext?: RouteContext;
20
+ entityId?: number;
21
+ entityToSave: any;
22
+ indexConfig: RpdDataModelIndex;
23
+ };
17
24
  export default class EntityManager<TEntity = any> {
18
25
  #private;
19
26
  constructor(server: IRpdServer, dataAccessor: IRpdDataAccessor);