enonic-types
Advanced tools
Comparing version 0.0.5 to 0.0.6
import { ByteSource, Content, Site } from "./content"; | ||
export interface Component<A> { | ||
readonly path: string; | ||
readonly type: string; | ||
readonly descriptor: string; | ||
readonly config: A; | ||
readonly regions: { | ||
[key: string]: { | ||
components: Array<Component<any>>; | ||
name: string; | ||
}; | ||
}; | ||
} | ||
export interface PortalLibrary { | ||
getComponent<A>(): Component<A> | null; | ||
getContent<A>(): Content<A> | null; | ||
@@ -4,0 +17,0 @@ getIdProviderKey(): string | null; |
{ | ||
"name": "enonic-types", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "TypeScript types for Enonic XP", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -5,1 +5,26 @@ # TypeScript types for Enonic XP | ||
## Example | ||
```typescript | ||
import { Request, Response } from "enonic-types/lib/common"; | ||
import { ContentLibrary } from "enonic-types/lib/content"; | ||
const contentLib: ContentLibrary = __non_webpack_require__("/lib/xp/content"); | ||
export function get(req: Request): Response { | ||
const content = contentLib.get<Article>({ key: req.params.id! }); | ||
if (content !== null) { | ||
const article: Article = content.data; | ||
return { status: 200, body: article } | ||
} else { | ||
return { status: 404 }; | ||
} | ||
} | ||
interface Article { | ||
readonly title: string; | ||
readonly test: string; | ||
} | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29864
859
30