Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

enonic-types

Package Overview
Dependencies
Maintainers
1
Versions
179
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

enonic-types - npm Package Compare versions

Comparing version 0.1.28 to 0.1.29

155

content.d.ts
import { Region } from "./portal";
declare type EmptyObject = Record<string, never>;
export interface ContentLibrary {
get<Data extends object, PageConfig extends object = never, XData extends object = object>(params: GetContentParams): Content<Data, PageConfig, XData> | null;
/**
* This function fetches a content
*/
get<Data extends object, XData extends object = object>(params: GetContentParams): Content<Data, EmptyObject, XData> | null;
/**
* This command queries content
*/
query<Data extends object, AggregationKeys extends string = never>(params: QueryContentParams<AggregationKeys>): QueryResponse<Data, AggregationKeys, QueryResponseMetaDataScore>;
query<Data extends object, AggregationKeys extends string = never>(params: QueryContentParamsWithSort<AggregationKeys>): QueryResponse<Data, AggregationKeys, QueryResponseMetaDataSort>;
/**
* This function creates a content.
*/
create<Data extends object>(params: CreateContentParams<Data>): Content<Data>;
/**
* Modifies properties of a content
*/
modify<Data extends object, PageConfig extends object = object, XData extends object = object>(params: ModifyContentParams<Data, PageConfig, XData>): Content<Data, PageConfig, XData>;
/**
* This function deletes a content
*/
delete(params: DeleteContentParams): boolean;
/**
* This function checks if a content exists for the current context.
*/
exists(params: ExistsParams): boolean;
/**
* This function publishes content to a branch
*/
publish(params: PublishContentParams): PublishResponse;
/**
* This function unpublishes content that had been published to the master branch
*/
unpublish(params: UnpublishContentParams): ReadonlyArray<string>;
/**
* This function fetches children of a content
*/
getChildren<Data extends object>(params: GetChildrenParams): QueryResponse<Data>;
/**
* This function returns the list of content items that are outbound dependencies of specified content.
*/
getOutboundDependencies(params: GetOutboundDependenciesParams): ReadonlyArray<string>;
/**
* Rename a content or move it to a new path
*/
move<Data extends object>(params: MoveParams): Content<Data>;
/**
* This function returns the parent site of a content
*/
getSite<Config extends object, PageConfig extends object = never>(params: GetSiteParams): Site<Config, PageConfig>;
/**
* This function returns the site configuration for this app in the parent site of a content
*/
getSiteConfig<Config extends object>(params: GetSiteConfigParams): Config;
/**
* Creates a media content
*/
createMedia<Data extends object>(params: CreateMediaParams): Content<Data>;
/**
* Adds an attachment to an existing content.
*/
addAttachment(params: AddAttachmentParams): void;
/**
* This function returns a content attachments
*/
getAttachments(key: string): Attachments | null;
/**
* This function returns a data-stream for the specified content attachment
*/
getAttachmentStream(params: AttachmentStreamParams): ByteSource | null;
/**
* Removes an attachment from an existing content
*/
removeAttachment(params: RemoveAttachmentParams): void;

@@ -28,5 +83,17 @@ /**

resetInheritance(params: ResetInheritanceParams): void;
/**
* Gets permissions on a content
*/
getPermissions(params: GetPermissionsParams): GetPermissionsResult;
/**
* Sets permissions on a content
*/
setPermissions(params: SetPermissionsParams): GetPermissionsResult;
/**
* Returns the properties and icon of the specified content type
*/
getType(name: string): ContentType | null;
/**
* Returns the list of all the content types currently registered in the system
*/
getTypes(): ReadonlyArray<ContentType>;

@@ -149,4 +216,4 @@ }

readonly count: number;
readonly query: string;
readonly filters?: object;
readonly query?: string;
readonly filters?: BasicFilters | BooleanFilter;
readonly aggregations?: Record<AggregationKeys, Aggregation>;

@@ -156,2 +223,31 @@ readonly contentTypes?: ReadonlyArray<string>;

}
export interface ExistsFilter {
readonly exists: {
readonly field: string;
};
}
export interface NotExistsFilter {
readonly notExists: {
readonly field: string;
};
}
export interface HasValueFilter {
readonly hasValue: {
readonly field: string;
readonly values: ReadonlyArray<unknown>;
};
}
export interface IdsFilter {
readonly ids: {
readonly values: ReadonlyArray<string>;
};
}
export declare type BasicFilters = ExistsFilter | NotExistsFilter | HasValueFilter | IdsFilter;
export interface BooleanFilter {
readonly boolean: {
readonly must?: BasicFilters | ReadonlyArray<BasicFilters>;
readonly mustNot?: BasicFilters | ReadonlyArray<BasicFilters>;
readonly should?: BasicFilters | ReadonlyArray<BasicFilters>;
};
}
export declare type QueryContentParamsWithSort<AggregationKeys extends string = never> = QueryContentParams<AggregationKeys> & {

@@ -162,3 +258,3 @@ readonly sort: string;

readonly count: number;
readonly hits: ReadonlyArray<Content<Data> & QueryMetaData>;
readonly hits: ReadonlyArray<Content<Data, EmptyObject> & QueryMetaData>;
readonly total: number;

@@ -299,16 +395,64 @@ readonly aggregations: AggregationsResponse<AggregationKeys>;

export interface CreateContentParams<Data> {
readonly name: string;
/**
* Name of content
*
* The parameter name is optional, but if it is not set then displayName must be specified.
* When name is not set, the system will auto-generate a name based on the displayName,
* by lower-casing and replacing certain characters. If there is already a content with the
* auto-generated name, a suffix will be added to the name in order to make it unique.
*/
readonly name?: string;
/**
* Path to place content under
*/
readonly parentPath: string;
/**
* Display name. Default is same as name
*/
readonly displayName?: string;
/**
* The content has to be valid, according to the content type, to be created.
* If requireValid=true and the content is not strictly valid, an error will be thrown
*/
readonly requireValid?: boolean;
/**
* If refresh is true, the created content will to be searchable through queries immediately,
* else within 1 second. Since there is a performance penalty doing this refresh,
* refresh should be set to false for bulk operations
*/
readonly refresh?: boolean;
/**
* Content type to use
*/
readonly contentType: string;
/**
* The language tag representing the content’s locale
*/
readonly language?: string;
/**
* Default ordering of children when doing getChildren if no order is given in query
*/
readonly childOrder?: string;
/**
* Actual content data
*/
readonly data: Data;
/**
* eXtra data to use
*/
readonly x?: Record<string, any>;
}
export interface ModifyContentParams<Data extends object, PageConfig extends object = object, XData extends object = object> {
/**
* Path or id to the content
*/
readonly key: string;
/**
* Editor callback function
*/
readonly editor: (c: Content<Data, PageConfig, XData>) => Content<Data, PageConfig, XData>;
/**
* The content has to be valid, according to the content type, to be updated.
* If requireValid=true and the content is not strictly valid, an error will be thrown
*/
readonly requireValid?: boolean;

@@ -459,1 +603,2 @@ }

}
export {};

6

node.d.ts

@@ -25,7 +25,7 @@ import { Aggregation, AggregationsResponse, ByteSource, Highlight, PermissionsParams } from "./content";

}
export interface NodeQueryResponse<B extends string = never> {
export interface NodeQueryResponse<AggregationKeys extends string = never> {
readonly total: number;
readonly count: number;
readonly hits: ReadonlyArray<NodeQueryHit>;
readonly aggregations: AggregationsResponse<B>;
readonly aggregations: AggregationsResponse<AggregationKeys>;
}

@@ -256,3 +256,3 @@ export interface GetBinaryParams {

*/
query<NodeData extends string = never>(params: NodeQueryParams<NodeData>): NodeQueryResponse<NodeData>;
query<AggregationKeys extends string = never>(params: NodeQueryParams<AggregationKeys>): NodeQueryResponse<AggregationKeys>;
/**

@@ -259,0 +259,0 @@ * Refresh the index for the current repoConnection

{
"name": "enonic-types",
"sideEffects": false,
"version": "0.1.28",
"version": "0.1.29",
"description": "TypeScript types for Enonic XP",

@@ -27,5 +27,5 @@ "typings": "index.d.ts",

"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.18.0",
"eslint": "^7.22.0",
"@typescript-eslint/eslint-plugin": "^4.20.0",
"@typescript-eslint/parser": "^4.20.0",
"eslint": "^7.23.0",
"rimraf": "^3.0.2",

@@ -32,0 +32,0 @@ "typescript": "^4.2.3"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc