packages start...
This commit is contained in:
parent
3dcd4dd093
commit
de71e679ec
@ -24,7 +24,7 @@ fields:
|
||||
- !include fields/isEmployed.yml
|
||||
- !include fields/profilePic.yml
|
||||
- !include fields/skills.yml
|
||||
- !include fields/supervisor.yml
|
||||
- !include fields/image.yml
|
||||
- !include fields/tags.yml
|
||||
- !include fields/gender.yml
|
||||
- !include fields/emplymentDetails.yml
|
||||
|
@ -10,7 +10,7 @@ muiIcon: web
|
||||
defaultSort:
|
||||
# Nach welchem Feld soll sortiert werden?
|
||||
field: updatedTime
|
||||
# ASC für aufsteigend oder DESC für absteigend
|
||||
# ASC für aufsteigend oder DESC für absteigend oder MANUALLY um manuell sortieren zu können
|
||||
order: DESC
|
||||
|
||||
# Ist ein Javascript Message-Object-Empfänger implementiert, der empfangene
|
||||
|
@ -25,7 +25,7 @@ tabs:
|
||||
- source: isEmployed
|
||||
- source: profilePic
|
||||
- source: skills
|
||||
- source: supervisor
|
||||
- source: image
|
||||
- source: tags
|
||||
- name: content
|
||||
label:
|
||||
|
@ -1,7 +1,7 @@
|
||||
name: supervisor # Name des Eingabefelds.
|
||||
name: image # Name des Eingabefelds.
|
||||
type: string # Datentyp des Eingabefelds.
|
||||
meta:
|
||||
label: { de: "Vorgesetzter", en: "Supervisor" } # Feldlabel.
|
||||
label: { de: "Bild", en: "Image" } # Feldlabel.
|
||||
widget: foreignKey # Verwendetes Widget.
|
||||
foreign:
|
||||
collection: medialib # Name der Sammlung, in der die ausgewählten Daten gespeichert sind.
|
@ -3,40 +3,14 @@
|
||||
name: medialib
|
||||
uploadPath: ../media/medialib
|
||||
|
||||
fields:
|
||||
- !include fields/title.yml
|
||||
|
||||
# Ein Feld vom Typ "file" wird für die Mediathek natürlich
|
||||
# benötigt.
|
||||
- name: file
|
||||
type: file
|
||||
meta:
|
||||
label:
|
||||
de: Datei
|
||||
en: File
|
||||
|
||||
permissions:
|
||||
public:
|
||||
methods:
|
||||
get: true
|
||||
post: false
|
||||
put: false
|
||||
delete: false
|
||||
user:
|
||||
methods:
|
||||
get: true
|
||||
post: true
|
||||
put: true
|
||||
delete: true
|
||||
|
||||
meta:
|
||||
label:
|
||||
de: Medienbibliothek
|
||||
en: Media Library
|
||||
muiIcon: multimedia
|
||||
defaultSort:
|
||||
field: title
|
||||
order: ASC
|
||||
field: sort
|
||||
order: MANUALLY #alternativ auch ASC und DESC möglich
|
||||
|
||||
# "defaultImageFilter" dient auch hier nur zur Reduzierung der
|
||||
# Bildgröße bei der Anzeige im tibi-admin (Listen).
|
||||
@ -48,15 +22,51 @@ meta:
|
||||
# "subNavigation" Index definiert, werden auch folgende "views"
|
||||
# verwendet.
|
||||
views:
|
||||
- type: table
|
||||
mediaQuery: "(min-width: 0px)"
|
||||
- type: simpleList
|
||||
mediaQuery: "(max-width: 767px)"
|
||||
primaryText: path
|
||||
columns:
|
||||
- source: file
|
||||
- source: updateTime
|
||||
label: letztes Update
|
||||
type: datetime
|
||||
label: letztes Update
|
||||
- source: title
|
||||
filter: true
|
||||
- source: description
|
||||
filter: true
|
||||
- type: table
|
||||
mediaQuery: "(min-width: 768px) and (max-width: 1199px)"
|
||||
columns:
|
||||
- source: file
|
||||
- source: updateTime
|
||||
type: datetime
|
||||
label: letztes Update
|
||||
- source: title
|
||||
filter: true
|
||||
- source: description
|
||||
filter: true
|
||||
|
||||
- type: cardList
|
||||
mediaQuery: "(min-width: 1200px)"
|
||||
fileDropArea:
|
||||
label:
|
||||
{
|
||||
de: "Ziehen Sie Dateien per Drag and Drop hierher oder klicken Sie, um Dateien auszuwählen.",
|
||||
en: "Drag and drop some files here, or click to upload.",
|
||||
}
|
||||
helperText: { de: "Maximale Uploadgröße: 1,54 MB", en: "Maximum upload size: 1.54MB" }
|
||||
targetField: file
|
||||
pageAsDropArea: false
|
||||
|
||||
fields:
|
||||
- source: file
|
||||
- source: updateTime
|
||||
type: datetime
|
||||
label: letztes Update
|
||||
- source: title
|
||||
filter: true
|
||||
- source: description
|
||||
filter: true
|
||||
|
||||
# Wird ein "subNavigation" Index für "image-/file-/videoSelect" definiert,
|
||||
# wird die entsprechende Navigation aus folgender Liste angesprochen.
|
||||
@ -72,12 +82,17 @@ meta:
|
||||
# Folgende Ansicht wird für unsere Auswahl der Datei im ContentBuilder
|
||||
# angeboten.
|
||||
views:
|
||||
- type: table
|
||||
- type: cards
|
||||
mediaQuery: "(min-width: 0px)"
|
||||
columns:
|
||||
fields:
|
||||
- source: file
|
||||
- source: updateTime
|
||||
type: datetime
|
||||
label: letztes Update
|
||||
- source: title
|
||||
filter: true
|
||||
- source: file
|
||||
- source: description
|
||||
filter: true
|
||||
|
||||
# Damit der ContentBuilder weiß, welche Datei ausgewählt wurde, ist
|
||||
# ist folgender "defaultCallback" notwendig.
|
||||
@ -96,7 +111,7 @@ meta:
|
||||
(entry) => {
|
||||
parent.selectAsset("medialib/" + entry.id + "/" + entry.file?.src + "?filter=l")
|
||||
parent.focus()
|
||||
}s
|
||||
}
|
||||
//!js
|
||||
|
||||
- name: modalForeign # Name des Eingabefelds oder der Ansicht.
|
||||
@ -115,5 +130,61 @@ meta:
|
||||
}
|
||||
//!js
|
||||
|
||||
openapi:
|
||||
disabled: true
|
||||
permissions:
|
||||
public:
|
||||
methods:
|
||||
get: true
|
||||
post: false
|
||||
put: false
|
||||
delete: false
|
||||
user:
|
||||
methods:
|
||||
get: true
|
||||
post: true
|
||||
put: true
|
||||
delete: true
|
||||
|
||||
projections:
|
||||
dashboard:
|
||||
select:
|
||||
hooks:
|
||||
delete:
|
||||
return:
|
||||
type: javascript
|
||||
file: hooks/medialib/delete_return.js
|
||||
|
||||
fields:
|
||||
# Ein Feld vom Typ "file" wird für die Mediathek natürlich
|
||||
# benötigt.
|
||||
- name: file
|
||||
type: file
|
||||
meta:
|
||||
label:
|
||||
de: Datei
|
||||
en: File
|
||||
- name: title
|
||||
type: string
|
||||
meta:
|
||||
label:
|
||||
de: Titel
|
||||
en: Title
|
||||
- name: description
|
||||
type: string
|
||||
meta:
|
||||
widget: richtext
|
||||
label:
|
||||
de: Kurzbeschreibung
|
||||
en: Short Description
|
||||
|
||||
- name: sort
|
||||
type: number
|
||||
|
||||
meta:
|
||||
label:
|
||||
de: Manuelle Sortierung
|
||||
en: Manual Sorting
|
||||
inputProps:
|
||||
{ readonly: true, placeholder: { de: "Wert wird automatisch gesetzt", en: "Value is set automatically" } }
|
||||
helperText:
|
||||
de: Dieses Feld wird für die manuelle Sortierung benötigt. Sobald ein Eintrag per Drag&Drop verschoben wurde, wird die neue Position innerhalb der Liste eingetragen.
|
||||
en: This field is required for manual sorting. As soon as an entry is moved using Drag&Drop, the new position is entered in the list.
|
||||
|
18
api/hooks/medialib/delete_return.js
Normal file
18
api/hooks/medialib/delete_return.js
Normal file
@ -0,0 +1,18 @@
|
||||
;(function () {
|
||||
const request = context.request()
|
||||
//get id of deleted image entry (delete request URL is : .../api/_/demo/medialib/id)
|
||||
const id = request.param("id")
|
||||
|
||||
//find all entrys where there is an image field with the id of this deleted one (image is an foreignKey widget, so stores the id as a string internally)
|
||||
const referencingElements = context.db.find("democol", {
|
||||
filter: {
|
||||
image: id,
|
||||
},
|
||||
})
|
||||
referencingElements.forEach((e) => {
|
||||
//update all those entries to remove the image id from them, since its deleted...
|
||||
context.db.update("democol", e.id, {
|
||||
image: "",
|
||||
})
|
||||
})
|
||||
})()
|
@ -0,0 +1,26 @@
|
||||
## bcrypt
|
||||
|
||||
```ts
|
||||
interface BcryptPackage {
|
||||
/**
|
||||
* hash password via bcrypt algo
|
||||
*
|
||||
* @param password clear text password
|
||||
* @param options hashing options
|
||||
*/
|
||||
hash(
|
||||
password: string,
|
||||
options?: {
|
||||
cost?: number
|
||||
}
|
||||
): string
|
||||
|
||||
/**
|
||||
* check password against hashed password via bcrypt algo
|
||||
*
|
||||
* @param password clear text password
|
||||
* @param hash hashed password
|
||||
*/
|
||||
check(password: string, hash: string): boolean
|
||||
}
|
||||
```
|
@ -0,0 +1,12 @@
|
||||
## charset
|
||||
|
||||
```ts
|
||||
interface CharsetPackage {
|
||||
/**
|
||||
* convert iso8859 to utf8
|
||||
*
|
||||
* @param iso8859 iso string
|
||||
*/
|
||||
iso8859ToUtf8(iso8859: string): string
|
||||
}
|
||||
```
|
@ -0,0 +1,33 @@
|
||||
## cookie
|
||||
|
||||
Das Cookie-Paket stellt Funktionen bereit, um HTTP-Cookies aus den Anfragen zu lesen und in den Antworten zu setzen. Mit der Methode get(name: string): string kann der Wert eines bestimmten Cookies ausgelesen werden. Der Name des Cookies wird als Parameter übergeben. Die Methode set(name: string, value: string, options?: {maxAge?: number, path?: string, domain?: string, secure?: boolean, httpOnly?: boolean}): void ermöglicht das Setzen eines Cookies. Der Name und Wert des Cookies, sowie optionale Parameter wie maximales Alter (maxAge), Pfad (path), Domain, Secure- und HttpOnly-Flag können übergeben werden. Cookies sind ein essentieller Bestandteil für das Session-Management und personalisierte Nutzererfahrungen im Web.
|
||||
|
||||
```ts
|
||||
interface CookiePackage {
|
||||
/**
|
||||
* get cookie from http header
|
||||
*
|
||||
* @param name cookie name
|
||||
*/
|
||||
get(name: string): string
|
||||
|
||||
/**
|
||||
* set cookie via http header
|
||||
*
|
||||
* @param name cookie name
|
||||
* @param value cookie value
|
||||
* @param options cookie options
|
||||
*/
|
||||
set(
|
||||
name: string,
|
||||
value: string,
|
||||
options?: {
|
||||
maxAge?: number
|
||||
path?: string
|
||||
domain?: string
|
||||
secure?: boolean
|
||||
httpOnly?: boolean
|
||||
}
|
||||
): void
|
||||
}
|
||||
```
|
@ -0,0 +1,82 @@
|
||||
## db
|
||||
|
||||
Das Database (Db) Paket stellt Methoden bereit, um Operationen auf einer Datenbank auszuführen. Es umfasst die folgenden Hauptmethoden:
|
||||
|
||||
- find(collection: string, query: object, options?: object): Diese Methode ermöglicht das Suchen von Dokumenten in einer bestimmten Sammlung basierend auf einer Query. Optional können Sie auch Optionen wie Limit, Skip, Sort, usw. angeben.
|
||||
|
||||
- findOne(collection: string, query: object, options?: object): Ähnlich wie die find Methode, aber sie gibt nur das erste Dokument zurück, das die Query erfüllt.
|
||||
|
||||
- insert(collection: string, document: object): Diese Methode fügt ein neues Dokument in eine bestimmte Sammlung ein.
|
||||
|
||||
- update(collection: string, query: object, update: object, options?: object): Diese Methode aktualisiert Dokumente in einer bestimmten Sammlung, die eine Query erfüllt. Sie können auch optionale Parameter wie upsert und multi verwenden.
|
||||
|
||||
- remove(collection: string, query: object, options?: object): Diese Methode entfernt Dokumente aus einer bestimmten Sammlung, die eine Query erfüllen. Optionale Parameter wie justOne können verwendet werden.
|
||||
|
||||
- count(collection: string, query: object): Diese Methode gibt die Anzahl der Dokumente in einer bestimmten Sammlung zurück, die eine Query erfüllen.
|
||||
|
||||
```ts
|
||||
interface DbPackage {
|
||||
/**
|
||||
* read results from a collection
|
||||
*
|
||||
* @param colName collection name
|
||||
* @param options options map
|
||||
*/
|
||||
find(colName: string, options?: DbReadOptions): CollectionDocument[]
|
||||
|
||||
/**
|
||||
* read count of documents for filter from a collection
|
||||
*
|
||||
* @param colName collection name
|
||||
* @param options options map (only filter is valid)
|
||||
*/
|
||||
count(colName: string, options?: DbReadOptions): number
|
||||
|
||||
/**
|
||||
* create a document in a collection
|
||||
*
|
||||
* @param colName collection name
|
||||
* @param data data map
|
||||
*/
|
||||
create(colName: string, data: CollectionDocument): CollectionDocument
|
||||
|
||||
/**
|
||||
* update a document in a collection
|
||||
*
|
||||
* @param colName collection name
|
||||
* @param id id of entry
|
||||
* @param data new/changed data
|
||||
*/
|
||||
update(colName: string, id: string, data: CollectionDocument): CollectionDocument
|
||||
|
||||
/**
|
||||
* deletes one document by id from collection
|
||||
*
|
||||
* @param colName collection name
|
||||
* @param id id of entry
|
||||
*/
|
||||
delete(colName: string, id: string): { message: "ok" }
|
||||
|
||||
/**
|
||||
* deletes documents by filter from collection
|
||||
*
|
||||
* @param colName collection name
|
||||
* @param options options map, only filter valid
|
||||
*/
|
||||
deleteMany(colName: string, options?: DbReadOptions): { message: "ok"; removed: number }
|
||||
}
|
||||
|
||||
interface DbReadOptions {
|
||||
filter?: {
|
||||
[key: string]: any
|
||||
}
|
||||
selector?: {
|
||||
[key: string]: any
|
||||
}
|
||||
projection?: string
|
||||
offset?: number
|
||||
limit?: number
|
||||
sort?: string[]
|
||||
pipelineMod?: (pipe: { [key: string]: any }[]) => { [key: string]: any }[]
|
||||
}
|
||||
```
|
@ -0,0 +1,17 @@
|
||||
## debug
|
||||
|
||||
```ts
|
||||
interface DebugPackage {
|
||||
/**
|
||||
* dumps data to header and server log
|
||||
*
|
||||
* @param toDump data to dump
|
||||
*/
|
||||
dump(...toDump: any): void
|
||||
|
||||
/**
|
||||
* get Sentry trace id
|
||||
*/
|
||||
sentryTraceId(): string
|
||||
}
|
||||
```
|
@ -0,0 +1,70 @@
|
||||
## fs
|
||||
|
||||
```ts
|
||||
interface FsPackage {
|
||||
/**
|
||||
* get directory path of api config file
|
||||
*
|
||||
*/
|
||||
configDir(): string
|
||||
|
||||
/**
|
||||
* read a file relative to config dir and return its content
|
||||
*
|
||||
* @param path relative file path
|
||||
* @param options optional options
|
||||
*/
|
||||
readFile(
|
||||
path: string,
|
||||
options?: {
|
||||
bytes: boolean // if true return []byte instead of string
|
||||
}
|
||||
): string | any
|
||||
|
||||
/**
|
||||
* write data to a file relative to config dir
|
||||
*
|
||||
* @param path relative file path
|
||||
* @param data string or []byte data
|
||||
*/
|
||||
writeFile(path: string, data: string | any): null
|
||||
|
||||
/**
|
||||
* stat file or directory
|
||||
*
|
||||
* @param path
|
||||
*/
|
||||
stat(path: string): {
|
||||
name: string
|
||||
size: number
|
||||
isDir: boolean
|
||||
modTime: string
|
||||
}
|
||||
|
||||
/**
|
||||
* list directory entries
|
||||
*
|
||||
* @param path
|
||||
*/
|
||||
readDir(path: string): {
|
||||
name: string
|
||||
size: number
|
||||
isDir: boolean
|
||||
modTime: string
|
||||
}[]
|
||||
|
||||
/**
|
||||
* make directory and all missing sub directories, no error if directory already exists
|
||||
*
|
||||
* @param path
|
||||
*/
|
||||
mkDir(path: string): void
|
||||
|
||||
/**
|
||||
* remove file or empty directory
|
||||
*
|
||||
* @param path
|
||||
*/
|
||||
remove(path: string): void
|
||||
}
|
||||
```
|
@ -0,0 +1,34 @@
|
||||
## http
|
||||
|
||||
Das Http-Paket stellt eine fetch Methode zur Verfügung, die eine HTTP-Anfrage ausführt und eine Antwort zurückgibt. Sie nimmt eine URL und optionale Parameter wie Methode (GET, POST, usw.), Header, Körper und Timeout als Argumente entgegen.
|
||||
|
||||
```ts
|
||||
interface HttpPackage {
|
||||
/**
|
||||
* http request
|
||||
*
|
||||
* @param url url for request
|
||||
* @param options request options
|
||||
*/
|
||||
fetch(
|
||||
url: string,
|
||||
options?: {
|
||||
method?: string
|
||||
headers?: { [key: string]: string }
|
||||
body?: string
|
||||
// timeout in seconds
|
||||
timeout?: number
|
||||
}
|
||||
): {
|
||||
status: number
|
||||
statusText: string
|
||||
headers: { [key: string]: string }
|
||||
trailer: { [key: string]: string }
|
||||
url: string
|
||||
body: {
|
||||
text(): string
|
||||
json(): any
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
@ -0,0 +1,32 @@
|
||||
## image
|
||||
|
||||
```ts
|
||||
interface ImagePackage {
|
||||
/**
|
||||
* convert image from source file to target file with filters
|
||||
*
|
||||
* @param sourceFile
|
||||
* @param targetFile
|
||||
* @param filters
|
||||
*/
|
||||
filter(
|
||||
sourceFile: string,
|
||||
targetFile: string,
|
||||
filters: {
|
||||
fit?: boolean
|
||||
fill?: boolean
|
||||
width?: number
|
||||
height?: number
|
||||
brightness?: number
|
||||
saturation?: number
|
||||
contrast?: number
|
||||
gamma?: number
|
||||
blur?: number
|
||||
sharpen?: number
|
||||
invert?: boolean
|
||||
grayscale?: boolean
|
||||
quality?: number
|
||||
}[]
|
||||
): void
|
||||
}
|
||||
```
|
@ -0,0 +1,49 @@
|
||||
## jwt
|
||||
|
||||
```ts
|
||||
interface JwtPackage {
|
||||
/**
|
||||
* create a jwt signed token string
|
||||
*
|
||||
* @param claims data object
|
||||
* @param options options (secret, validityDuration = expiry in X seconds)
|
||||
*/
|
||||
create(
|
||||
claims: {
|
||||
[key: string]: any
|
||||
},
|
||||
options?: {
|
||||
secret?: string
|
||||
validityDuration?: number
|
||||
}
|
||||
): string
|
||||
|
||||
/**
|
||||
* parse jwt token string
|
||||
*
|
||||
* @param token token string
|
||||
* @param options options (secret)
|
||||
*/
|
||||
parse(
|
||||
token: string,
|
||||
options?: {
|
||||
secret?: string
|
||||
}
|
||||
): {
|
||||
error?: string
|
||||
valid: boolean
|
||||
method: {
|
||||
Name: string
|
||||
Hash: number
|
||||
}
|
||||
header: {
|
||||
alg: string
|
||||
typ: string
|
||||
}
|
||||
claims: {
|
||||
exp?: number
|
||||
[key: string]: any
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
@ -0,0 +1,95 @@
|
||||
## jwt
|
||||
|
||||
```ts
|
||||
interface PdfPackage {
|
||||
/**
|
||||
* generate pdf from html
|
||||
*
|
||||
* @param html html string
|
||||
* @param options options
|
||||
*
|
||||
* @returns []byte of pdf data
|
||||
*/
|
||||
fromHTML(
|
||||
html: string,
|
||||
options?: {
|
||||
copies?: number // Number of copies to print into the pdf file (default 1)
|
||||
dpi?: number // Change the dpi explicitly (this has no effect on X11 based systems)
|
||||
grayscale?: boolean // PDF will be generated in grayscale
|
||||
imageDpi?: number // When embedding images scale them down to this dpi (default 600)
|
||||
imageQuality?: number // When jpeg compressing images use this quality (default 94)
|
||||
lowQuality?: boolean // Generates lower quality pdf/ps. Useful to shrink the result document space
|
||||
marginBottom?: number // Set the page bottom margin
|
||||
marginLeft?: number // Set the page left margin (default 10mm)
|
||||
marginRight?: number // Set the page right margin (default 10mm)
|
||||
marginTop?: number // Set the page top margin
|
||||
noCollate?: boolean // Do not collate when printing multiple copies (default collate)
|
||||
noPdfCompression?: boolean // Do not use lossless compression on pdf objects
|
||||
orientation?: "Portrait" | "Landscape" // Set orientation to Landscape or Portrait (default Portrait)
|
||||
pageHeight?: number // Page height
|
||||
pageSize?: string // Set paper size to: A4, Letter, etc. (default A4)
|
||||
pageWidth?: number // Page width
|
||||
title?: string // The title of the generated pdf file (The title of the first document is used if not specified)
|
||||
// page settings
|
||||
printMediaType?: boolean // Use print media-type instead of screen
|
||||
footerCenter?: string // Centered footer text
|
||||
footerFontName?: string // Set footer font name (default Arial)
|
||||
footerFontSize?: number // Set footer font size (default 12)
|
||||
footerLeft?: string // Left aligned footer text
|
||||
footerLine?: boolean // Display line above the footer
|
||||
footerRight?: string // Right aligned footer text
|
||||
footerSpacing?: number // Spacing between footer and content in mm (default 0)
|
||||
footerHTML?: string // URL to footer html
|
||||
headerCenter?: string // Centered header text
|
||||
headerFontName?: string // Set header font name (default Arial)
|
||||
headerFontSize?: number // Set header font size (default 12)
|
||||
headerLeft?: string // Left aligned header text
|
||||
headerLine?: boolean // Display line below the header
|
||||
headerRight?: string // Right aligned header text
|
||||
headerSpacing?: number // Spacing between header and content in mm (default 0)
|
||||
headerHTML?: string // URL to header html
|
||||
}
|
||||
): any
|
||||
|
||||
/**
|
||||
* process existing pdf data
|
||||
*
|
||||
* @param command pdfcpu command
|
||||
* @param pdfData []byte of pdf data, multiple []byte as array of pdf's to merge or object with description to create
|
||||
* @param options options
|
||||
*
|
||||
* @returns []byte of new pdf data
|
||||
*/
|
||||
cpu(
|
||||
command: "watermark" | "stamp" | "merge" | "rotate" | "create",
|
||||
pdfData: any | any[],
|
||||
options?: {
|
||||
pages?: (string | number)[]
|
||||
description?: {
|
||||
fontname?: string
|
||||
points?: number
|
||||
rtl?: boolean
|
||||
position?: "full" | "tl" | "tc" | "tr" | "l" | "c" | "r" | "bl" | "bc" | "br"
|
||||
offset?: string
|
||||
scalefactor?: number | string
|
||||
aligntext?: "left" | "center" | "right" | "justified"
|
||||
strokecolor?: string
|
||||
fillcolor?: string
|
||||
backgroundcolor?: string
|
||||
rotation?: number
|
||||
diagonal?: 1 | 2
|
||||
opacity?: number
|
||||
rendermode?: 0 | 1 | 2
|
||||
margins?: number | string
|
||||
border?: number | string
|
||||
url?: string
|
||||
}
|
||||
mode?: "text" | "image" | "pdf"
|
||||
bytes?: any // []byte of watermark image
|
||||
file?: string // file for pdf watermark
|
||||
text?: string // text for text watermark
|
||||
rotation?: number
|
||||
}
|
||||
): any
|
||||
}
|
||||
```
|
@ -0,0 +1,15 @@
|
||||
## image
|
||||
|
||||
Das Response-Paket ermöglicht das Manipulieren der HTTP-Antwort-Header. Mit der Methode header(name: string, value: any): void können individuelle Header in der HTTP-Antwort gesetzt werden. Der Name des Headers und sein Wert werden als Parameter übergeben. Das Manipulieren von HTTP-Headern kann für verschiedene Zwecke verwendet werden, beispielsweise zum Setzen von Cookies, Steuern von Caching-Verhalten oder Hinzufügen von sicherheitsrelevanten Informationen.
|
||||
|
||||
```ts
|
||||
interface ResponsePackage {
|
||||
/**
|
||||
* set response header
|
||||
*
|
||||
* @param name header name
|
||||
* @param value value
|
||||
*/
|
||||
header(name: string, value: any): void
|
||||
}
|
||||
```
|
@ -0,0 +1,28 @@
|
||||
## smtp
|
||||
|
||||
Das Smtp-Paket ermöglicht das Senden von E-Mails. Es stellt eine sendMail Methode zur Verfügung, die eine E-Mail an einen oder mehrere Empfänger sendet. Die Methode nimmt eine Reihe von Parametern, einschließlich des SMTP-Hosts, des Benutzernamens und Passworts für die Authentifizierung, der Empfängeradressen, des Betreffs, des Absenders und der Nachricht, sowie optionaler Anhänge, entgegen.
|
||||
|
||||
```ts
|
||||
interface SmtpPackage {
|
||||
/**
|
||||
* send an email
|
||||
*
|
||||
* @param options email options map
|
||||
*/
|
||||
sendMail(options: {
|
||||
host?: string
|
||||
username?: string
|
||||
password?: string
|
||||
to: string | string[]
|
||||
cc?: string | string[]
|
||||
bcc?: string | string[]
|
||||
subject?: string
|
||||
from: string
|
||||
fromName?: string
|
||||
replyTo?: string
|
||||
plain?: string
|
||||
html?: string
|
||||
attach?: string | string[]
|
||||
}): void
|
||||
}
|
||||
```
|
@ -0,0 +1,18 @@
|
||||
## tpl
|
||||
|
||||
```ts
|
||||
interface TplPackage {
|
||||
/**
|
||||
* execute a template code and return result
|
||||
*
|
||||
* @param code template code
|
||||
* @param contextData template context map
|
||||
*/
|
||||
execute(
|
||||
code: string,
|
||||
contextData?: {
|
||||
[key: string]: any
|
||||
}
|
||||
): string
|
||||
}
|
||||
```
|
@ -0,0 +1,17 @@
|
||||
## user
|
||||
|
||||
Das User-Paket stellt eine Schnittstelle bereit, um Informationen über den derzeit authentifizierten Benutzer zu erhalten. Hier ist selbstverständlich die authentizierung im TibiAdmin und nicht auf der Kunden Website gemeint. Es beinhaltet die Methode auth(), die die Benutzer-Identifikation (ID), den Benutzernamen, die Rolle und die Berechtigungen des Benutzers zurückgibt. Die Benutzer-ID und der Benutzername sind einzigartige Identifizierungsmerkmale für jeden Benutzer. Die Rolle definiert das Berechtigungslevel des Benutzers und die Berechtigungen sind eine Liste von Aktionen, die der Benutzer ausführen darf. Es ist wichtig zu beachten, dass diese Informationen nur dann verfügbar sind, wenn der Benutzer authentifiziert ist.
|
||||
|
||||
```ts
|
||||
interface UserPackage {
|
||||
/**
|
||||
* get JWT authentication
|
||||
*/
|
||||
auth(): {
|
||||
id: string
|
||||
username: string
|
||||
role: number
|
||||
permissions: string[]
|
||||
}
|
||||
}
|
||||
```
|
@ -0,0 +1,21 @@
|
||||
## xml
|
||||
|
||||
```ts
|
||||
interface XmlPackage {
|
||||
/**
|
||||
* create xml string
|
||||
*
|
||||
* @param data object or array
|
||||
* @param options options
|
||||
*/
|
||||
create(data: any, options?: {}): string
|
||||
|
||||
/**
|
||||
* parse xml string to json
|
||||
*
|
||||
* @param xml xml string
|
||||
* @param options options
|
||||
*/
|
||||
parse(xml: string, options?: {}): any
|
||||
}
|
||||
```
|
Loading…
Reference in New Issue
Block a user