@appsemble/sdk
Advanced tools
Comparing version 0.11.4 to 0.11.5
import { Promisable } from 'type-fest'; | ||
/** | ||
* Actions defined on a block. | ||
* | ||
* If a block uses actions, extend this interface using module augmentation. The keys are the names | ||
* of the events the block supports. | ||
* | ||
* @example | ||
* declare module '<at>appsemble/sdk' { | ||
* interface Actions { | ||
* onClick: {} | ||
* } | ||
* } | ||
*/ | ||
export interface Actions { | ||
} | ||
/** | ||
* Event emitters defined on a block. | ||
* | ||
* If a block emits events, extend this interface using module augmentation. The keys are the names | ||
* of the events the block can emit. | ||
* | ||
* @example | ||
* declare module '<at>appsemble/sdk' { | ||
* interface EventEmitters { | ||
* data: {} | ||
* } | ||
* } | ||
*/ | ||
export interface EventEmitters { | ||
} | ||
/** | ||
* Event listeners defined on a block. | ||
* | ||
* If a block listens on events, extend this interface using module augmentation. The keys are the | ||
* names of the events the block can emit. | ||
* | ||
* @example | ||
* declare module '<at>appsemble/sdk' { | ||
* interface EventListeners { | ||
* data: {} | ||
* } | ||
* } | ||
*/ | ||
export interface EventListeners { | ||
} | ||
/** | ||
* Custom free form parameters defined on a block. | ||
* | ||
* If a block listens on events, extend this interface using module augmentation. The keys are the | ||
* names of the events the block can emit. | ||
* | ||
* @example | ||
* declare module '<at>appsemble/sdk' { | ||
* interface Parameters { | ||
* param1: string; | ||
* param2: number; | ||
* param3: { | ||
* nested: boolean; | ||
* } | ||
* } | ||
* } | ||
*/ | ||
export interface Parameters { | ||
} | ||
export declare type BodyHTTPMethodsUpper = 'PATCH' | 'POST' | 'PUT'; | ||
@@ -73,3 +137,3 @@ /** | ||
*/ | ||
export interface Block<P = any, A = {}, E extends EventParams = Required<EventParams>> { | ||
export interface Block { | ||
/** | ||
@@ -105,3 +169,3 @@ * The type of the block. | ||
*/ | ||
parameters?: P; | ||
parameters?: Parameters; | ||
/** | ||
@@ -112,3 +176,3 @@ * A mapping of actions that can be fired by the block to action handlers. | ||
*/ | ||
actions?: A; | ||
actions?: Actions; | ||
/** | ||
@@ -120,4 +184,8 @@ * Mapping of the events the block can listen to and emit. | ||
events?: { | ||
listen: Record<E['listen'], string>; | ||
emit: Record<E['emit'], string>; | ||
listen: { | ||
[K in keyof EventListeners]: string; | ||
}; | ||
emit: { | ||
[K in keyof EventEmitters]: string; | ||
}; | ||
}; | ||
@@ -189,5 +257,2 @@ /** | ||
} | ||
export declare type Actions<A> = { | ||
[K in keyof A]: Action; | ||
}; | ||
export interface PageParameters { | ||
@@ -208,5 +273,3 @@ [parameter: string]: string; | ||
} | ||
export declare type EventEmitters<E extends EventParams> = Record<E['emit'], (data: any, error?: string) => void>; | ||
export declare type EventListeners<E extends EventParams> = Record<E['listen'], (callback: (data: any, error?: string) => void) => void>; | ||
export interface Events<E extends EventParams = {}> { | ||
export interface Events { | ||
/** | ||
@@ -218,3 +281,5 @@ * Emit an Appsemble event. | ||
*/ | ||
emit: EventEmitters<E>; | ||
emit: { | ||
[K in keyof EventEmitters]: (data: any, error?: string) => void; | ||
}; | ||
/** | ||
@@ -226,3 +291,5 @@ * Remove an event listener for an Appsemble event. | ||
*/ | ||
off: EventListeners<E>; | ||
off: { | ||
[K in keyof EventListeners]: (callback: (data: any, error?: string) => void) => void; | ||
}; | ||
/** | ||
@@ -234,3 +301,5 @@ * Add an event listener for an Appsemble event. | ||
*/ | ||
on: EventListeners<E>; | ||
on: { | ||
[K in keyof EventListeners]: (callback: (data: any, error?: string) => void) => void; | ||
}; | ||
} | ||
@@ -240,11 +309,13 @@ /** | ||
*/ | ||
export interface BootstrapParams<P = any, A = {}, E extends EventParams = {}> { | ||
export interface BootstrapParams { | ||
/** | ||
* The actions that may be dispatched by the block. | ||
*/ | ||
actions: Actions<A>; | ||
actions: { | ||
[K in keyof Actions]: Action; | ||
}; | ||
/** | ||
* The block as it is defined in the app definition. | ||
*/ | ||
block: Block<P, A, E>; | ||
block: Block; | ||
/** | ||
@@ -257,3 +328,3 @@ * Any kind of data that has been passed in by some context. | ||
*/ | ||
events: Events<E>; | ||
events: Events; | ||
/** | ||
@@ -284,3 +355,3 @@ * URL parameters of the current route. | ||
*/ | ||
export declare type BootstrapFunction<P = any, A = {}, E extends EventParams = {}> = (params: BootstrapParams<P, A, E>) => Promisable<void>; | ||
export declare type BootstrapFunction = (params: BootstrapParams) => Promisable<void>; | ||
/** | ||
@@ -300,3 +371,3 @@ * @private | ||
*/ | ||
export declare function bootstrap<P = any, A = {}, E extends EventParams = {}>(fn: BootstrapFunction<P, A, E>): void; | ||
export declare function bootstrap(fn: BootstrapFunction): void; | ||
/** | ||
@@ -310,2 +381,2 @@ * Attach the returned node to the shadow root. | ||
*/ | ||
export declare function attach<P = any, A = {}, E extends EventParams = {}>(fn: (params: BootstrapParams<P, A, E>) => Promisable<HTMLElement | void>): void; | ||
export declare function attach(fn: (params: BootstrapParams) => Promisable<HTMLElement | void>): void; |
{ | ||
"name": "@appsemble/sdk", | ||
"version": "0.11.4", | ||
"version": "0.11.5", | ||
"homepage": "https://appsemble.dev", | ||
"bugs": { | ||
"url": "https://gitlab.com/appsemble/appsemble/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://gitlab.com/appsemble/appsemble.git", | ||
"directory": "packages/sdk" | ||
}, | ||
"license": "LGPL-3.0-or-later", | ||
"author": "Appsemble <info@appsemble.com> (https://appsemble.com)", | ||
"files": [ | ||
"dist" | ||
], | ||
"main": "src", | ||
"browser": "dist", | ||
"types": "dist", | ||
"scripts": { | ||
@@ -9,0 +21,0 @@ "prepack": "tsc -p tsconfig.build.json" |
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
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
0
0
0
12678
4
2
70
402