654b297e2e
- Connexion API via proxy Angular (résolution CORS, base path /api) - Import CSS ng-zorro global pour les modales et composants - Filtres Camion/Show câblés sur l'affichage de la grille - Camions affichés via TrucksService (linkés au show du même créneau) - Panneau de détails : spectacles + camions du jour sélectionné - Modale de création de spectacle stylisée avec fond et centrage - Positionnement précis des events à la minute dans leur créneau - Auto-scroll vers l'heure courante au chargement - Ligne "maintenant" sur la colonne du jour actuel - Régénération des services OpenAPI (nouveaux noms de types) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
58 lines
1.3 KiB
JavaScript
58 lines
1.3 KiB
JavaScript
import { Transform } from 'stream'
|
|
import { Packr } from './pack.js'
|
|
import { Unpackr } from './unpack.js'
|
|
var DEFAULT_OPTIONS = {objectMode: true}
|
|
|
|
export class PackrStream extends Transform {
|
|
constructor(options) {
|
|
if (!options)
|
|
options = {}
|
|
options.writableObjectMode = true
|
|
super(options)
|
|
options.sequential = true
|
|
this.packr = options.packr || new Packr(options)
|
|
}
|
|
_transform(value, encoding, callback) {
|
|
this.push(this.packr.pack(value))
|
|
callback()
|
|
}
|
|
}
|
|
|
|
export class UnpackrStream extends Transform {
|
|
constructor(options) {
|
|
if (!options)
|
|
options = {}
|
|
options.objectMode = true
|
|
super(options)
|
|
options.structures = []
|
|
this.unpackr = options.unpackr || new Unpackr(options)
|
|
}
|
|
_transform(chunk, encoding, callback) {
|
|
if (this.incompleteBuffer) {
|
|
chunk = Buffer.concat([this.incompleteBuffer, chunk])
|
|
this.incompleteBuffer = null
|
|
}
|
|
let values
|
|
try {
|
|
values = this.unpackr.unpackMultiple(chunk)
|
|
} catch(error) {
|
|
if (error.incomplete) {
|
|
this.incompleteBuffer = chunk.slice(error.lastPosition)
|
|
values = error.values
|
|
}
|
|
else
|
|
throw error
|
|
} finally {
|
|
for (let value of values || []) {
|
|
if (value === null)
|
|
value = this.getNullValue()
|
|
this.push(value)
|
|
}
|
|
}
|
|
if (callback) callback()
|
|
}
|
|
getNullValue() {
|
|
return Symbol.for(null)
|
|
}
|
|
}
|