backend-plus 2.5.2-betha.21 → 2.5.2-betha.23

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.
@@ -179,7 +179,7 @@ export type SequenceMadMaxDefinition = {
179
179
  }
180
180
  export type ExportMetadataDefinition={ /* TODO: define */ }
181
181
  export type PostInputOptions='upperSpanish' | 'upperWithoutDiacritics' | 'parseDecimal'
182
- export type FieldDefinition = EditableDbDefinition & {
182
+ export interface FieldDefinition extends EditableDbDefinition {
183
183
  name:string
184
184
  typeName:PgKnownTypes|'ARRAY:text'
185
185
  label?:string
@@ -224,7 +224,7 @@ export type FieldDefinition = EditableDbDefinition & {
224
224
  postInput?:PostInputOptions
225
225
  sequence?: SequenceDefinition|SequenceMadMaxDefinition
226
226
  }
227
- export type EditableDbDefinition = {
227
+ export interface EditableDbDefinition {
228
228
  editable?:boolean
229
229
  allow?:{
230
230
  update?:boolean
@@ -241,7 +241,7 @@ export type FieldsForConnect = (string | {source:string, target:string})[]
241
241
  export type FieldsForConnectDetailTable = (string | {source:string, target:string, nullMeansAll?:boolean} | {value:any, target:string})[]
242
242
 
243
243
  export type FkActions = 'no action'|'restrict'|'cascade'|'set null'|'set default';
244
- export type ForeignKey = {
244
+ export interface ForeignKey {
245
245
  references:string,
246
246
  fields:FieldsForConnect,
247
247
  onUpdate?: FkActions,
@@ -1317,17 +1317,22 @@ AppBackend.prototype.checkDatabaseStructure = async function checkDatabaseStruct
1317
1317
  `;
1318
1318
  throw new Error(message);
1319
1319
  }
1320
- var {rows: sql_routines} = await client.query(`SELECT routine_name, routine_schema, routine_definition
1320
+ var {rows: sql_routines} = await client.query(`SELECT routine_name, routine_schema, routine_type, routine_definition
1321
1321
  FROM information_schema.routines
1322
1322
  WHERE routine_schema in (${be.config.db.search_path.map(path => be.db.quoteLiteral(path)).join(', ')})
1323
1323
  `).fetchAll();
1324
- var sqlRoutines = likeAr.toPlainObject(sql_routines, 'routine_name');
1324
+ var sqlRoutines = likeAr.createIndex(sql_routines, 'routine_name');
1325
+ console.log(sqlRoutines)
1326
+ var set_app_user_RoutineType = sqlRoutines.set_app_user?.routine_type || 'inexsistente';
1327
+ if (set_app_user_RoutineType != 'PROCEDURE') {
1328
+ throw new Error('ERROR en la DB: set_app_user no es un PROCEDURE es ' + set_app_user_RoutineType);
1329
+ }
1325
1330
  var message = ''
1326
1331
  likeAr(AppBackend.prototype.sql_routines).forEach((routine_name, def) => {
1327
1332
  if (sqlRoutines[routine_name] && def.dump.includes(sqlRoutines[routine_name].routine_definition)) {
1328
1333
  message += `
1329
1334
  ----- hay que crear o actualizar la rutina ${routine_name}:
1330
- ${dump}
1335
+ ${def.dump}
1331
1336
  `;
1332
1337
  }
1333
1338
  })
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "backend-plus",
3
3
  "description": "Backend for the anti Pareto rule",
4
- "version": "2.5.2-betha.21",
4
+ "version": "2.5.2-betha.23",
5
5
  "author": "Codenautas <codenautas@googlegroups.com>",
6
6
  "license": "MIT",
7
7
  "repository": "codenautas/backend-plus",
@@ -85,7 +85,7 @@
85
85
  "@types/js-yaml": "^4.0.9",
86
86
  "@types/mocha": "^10.0.10",
87
87
  "@types/multiparty": "~4.2.1",
88
- "@types/node": "^24.3.0",
88
+ "@types/node": "^24.4.0",
89
89
  "@types/nodemailer": "^7.0.1",
90
90
  "@types/numeral": "~2.0.5",
91
91
  "@types/session-file-store": "^1.2.5",
@@ -100,9 +100,9 @@
100
100
  "karma-ie-launcher": "^1.0.0",
101
101
  "karma-mocha": "^2.0.1",
102
102
  "kill-9": "~0.4.3",
103
- "mocha": "^11.7.1",
103
+ "mocha": "^11.7.2",
104
104
  "nyc": "^17.1.0",
105
- "puppeteer": "^24.17.1",
105
+ "puppeteer": "^24.20.0",
106
106
  "sinon": "^21.0.0",
107
107
  "supertest": "^7.1.4",
108
108
  "types.d.ts": "~0.6.22",