Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@rrweb/types
Advanced tools
@rrweb/types is a TypeScript type definition package for rrweb, a library for recording and replaying user interactions on web pages. This package provides type definitions for various events and data structures used in rrweb, making it easier to work with rrweb in TypeScript projects.
Event Types
Defines the structure of an event with time, which includes the type of event, data associated with the event, timestamp, and delay.
import { eventWithTime } from '@rrweb/types';
const event: eventWithTime = {
type: 1,
data: {},
timestamp: Date.now(),
delay: 0
};
Incremental Snapshot Event
Defines the structure of an incremental snapshot event, which includes the type of event, data related to the snapshot, timestamp, and delay.
import { incrementalSnapshotEvent } from '@rrweb/types';
const snapshotEvent: incrementalSnapshotEvent = {
type: 2,
data: {
source: 1,
positions: [{ x: 0, y: 0, id: 1 }]
},
timestamp: Date.now(),
delay: 0
};
Full Snapshot Event
Defines the structure of a full snapshot event, which includes the type of event, data related to the full snapshot, timestamp, and delay.
import { fullSnapshotEvent } from '@rrweb/types';
const fullSnapshot: fullSnapshotEvent = {
type: 3,
data: {
node: {
id: 1,
type: 1,
childNodes: []
}
},
timestamp: Date.now(),
delay: 0
};
TypeScript is a superset of JavaScript that adds static types. While it doesn't provide specific types for rrweb, it allows you to define your own types and interfaces, offering flexibility and type safety in your projects.
io-ts is a runtime type system for IO decoding/encoding in TypeScript. It allows you to define types and validate data at runtime, which can be useful for ensuring the correctness of data structures similar to those used in rrweb.
Zod is a TypeScript-first schema declaration and validation library. It provides a way to define and validate data structures, similar to the type definitions provided by @rrweb/types, but with additional runtime validation capabilities.
FAQs
This package contains the shared types used across rrweb packages. See the [guide](../../guide.md) for more info on rrweb.
We found that @rrweb/types demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.