5htp-core 0.5.1-5 → 0.5.1-6

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "5htp-core",
3
3
  "description": "Convenient TypeScript framework designed for Performance and Productivity.",
4
- "version": "0.5.1-5",
4
+ "version": "0.5.1-6",
5
5
  "author": "Gaetan Le Gac (https://github.com/gaetanlegac)",
6
6
  "repository": "git://github.com/gaetanlegac/5htp-core.git",
7
7
  "license": "MIT",
@@ -170,11 +170,11 @@ export default function Liste<TRow extends TDonneeInconnue>({
170
170
 
171
171
  render = (
172
172
  <div class="row sp-05">
173
- {cell.map((item, i) => (
173
+ {cell.map((item, i) => typeof item === 'string' ? (
174
174
  <span class={"badge bg light" + ((i % 7) + 1)}>
175
175
  {item}
176
176
  </span>
177
- ))}
177
+ ) : item)}
178
178
  </div>
179
179
  )
180
180
 
@@ -255,8 +255,9 @@ export default class SQL extends Service<Config, Hooks, Application, Services> {
255
255
  }).join(' ').trim();
256
256
  }
257
257
 
258
- public equalities = (data: TObjetDonnees, keys = Object.keys(data)) =>
259
- keys.map(k => '' + k + ' = ' + this.esc( data[k] ))
258
+ public equalities = (data: TObjetDonnees, forStorage: boolean = false) => {
259
+ return Object.keys(data).map(k => '' + k + ' = ' + this.esc( data[k], forStorage ))
260
+ }
260
261
 
261
262
  /*----------------------------------
262
263
  - OPERATIONS: LOW LEVELf
@@ -380,7 +381,7 @@ export default class SQL extends Service<Config, Hooks, Application, Services> {
380
381
  }
381
382
 
382
383
  // Create equalities
383
- const egalitesData = this.equalities(data).join(', ')
384
+ const egalitesData = this.equalities(data, true).join(', ')
384
385
  const egalitesWhere = this.equalities(where).join(' AND ')
385
386
 
386
387
  // Build query
@@ -71,7 +71,7 @@ export default abstract class FsDriver<
71
71
  bucketName: TBucketName,
72
72
  filename: string,
73
73
  options: TReadFileOptions
74
- ): Promise<string>;
74
+ ): Promise<Buffer>;
75
75
 
76
76
  public abstract createReadStream( bucketName: TBucketName, filename: string );
77
77
 
@@ -76,7 +76,9 @@ export default class LocalFS<
76
76
  bucketName: TBucketName,
77
77
  filename: string
78
78
  ) {
79
- throw new Error("Method not available for local files.");
79
+ const bucketDir = this.config.buckets[bucketName];
80
+ const fullPath = path.join( this.rootDir, bucketDir, filename || '.' );
81
+ return fullPath;
80
82
  }
81
83
 
82
84
  public async readDir( bucketName: TBucketName, dirname?: string ) {
@@ -135,7 +137,7 @@ export default class LocalFS<
135
137
  const fullPath = path.join( this.rootDir, bucketDir, filename );
136
138
 
137
139
  this.config.debug && console.log(`readFile ${fullPath}`);
138
- return fs.readFileSync( fullPath ).toString();
140
+ return fs.readFileSync( fullPath );
139
141
  }
140
142
 
141
143
  public createReadStream( bucketName: TBucketName, filename: string ) {
@@ -605,8 +605,8 @@ declare type Routes = {
605
605
  } else {
606
606
 
607
607
  // For debugging HTTP errors
608
- if (this.app.env.profile === "dev")
609
- console.warn(e);
608
+ /*if (this.app.env.profile === "dev")
609
+ console.warn(e);*/
610
610
 
611
611
  await this.app.runHook('error.' + code, e, request);
612
612
  }
@@ -146,9 +146,6 @@ export default class ServerRequest<
146
146
  'EN'
147
147
  )
148
148
 
149
- console.log("locale", this.req.acceptsLanguages(), locale);
150
-
151
-
152
149
  return locale ? locale.toUpperCase() : 'EN'
153
150
  }
154
151
 
@@ -310,8 +310,15 @@ export default class ServerResponse<
310
310
  }
311
311
 
312
312
  // envoi filename
313
- const file = await disk.readFile('data', filename, {});
313
+ const file = await disk.readFile('data', filename, {
314
+ encoding: 'buffer'
315
+ });
314
316
  this.data = file;
317
+
318
+
319
+ // Mimetype
320
+ this.headers['Content-Type'] = 'image/jpeg';
321
+
315
322
  return this.end();
316
323
  }
317
324