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

@starbeam/interfaces

Package Overview
Dependencies
Maintainers
3
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@starbeam/interfaces - npm Package Compare versions

Comparing version 0.8.10-unstable.398c1bd to 0.8.10-unstable.3b6efdd

LICENSE.md

12

.eslintrc.json
{
"root": false,
"overrides": [
{
"extends": ["plugin:@starbeam/tight"],
"files": ["index.ts", "src/**/*.ts"],
"parserOptions": {
"project": "tsconfig.json"
}
}
]
"root": true,
"extends": ["plugin:@starbeam-dev/library:recommended"]
}
{
"name": "@starbeam/interfaces",
"version": "0.8.10-unstable.398c1bd",
"type": "module",
"main": "index.ts",
"types": "index.ts",
"version": "0.8.10-unstable.3b6efdd",
"main": "dist/index.cjs",
"types": "dist/index.d.ts",
"exports": {
"default": "./index.ts"
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"default": "./dist/index.cjs"
},
"publishConfig": {
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"default": "./dist/index.cjs"
}
},
"main": "dist/index.cjs",
"types": "dist/index.d.ts"
},
"starbeam": {

@@ -26,13 +17,14 @@ "source": "ts",

},
"scripts": {
"test:lint": "eslint \"index.ts\" \"src/**/*.ts\"",
"test:types": "tsc -b"
},
"dependencies": {
"@domtree/any": "workspace:^",
"@starbeam/shared": "1.3.8-unstable.398c1bd"
"@starbeam/shared": "1.3.8-unstable.3b6efdd",
"@domtree/any": "^0.9.3"
},
"devDependencies": {
"@starbeam-dev/build-support": "workspace:*"
"@starbeam-dev/eslint-plugin": "^1.0.6",
"@starbeam-dev/compile": "1.2.0"
},
"scripts": {
"test:lint": "eslint . --max-warnings 0",
"test:types": "tsc -b"
}
}
}

@@ -10,4 +10,4 @@ import type { PresentArray } from "@starbeam/core-utils";

| {
id: boolean | undefined;
}
id: boolean | undefined;
}
| undefined;

@@ -30,4 +30,4 @@

/**
* Mark the current function as a debug entry point. The immediate caller of a
* debug entry point becomes the call stack associated with any debug
* Mark the current function as a debug entry point. The immediate caller of
* a debug entry point becomes the call stack associated with any debug
* information generated for that entry point.

@@ -46,10 +46,10 @@ *

| {
caller?: CallStack | undefined;
description?: EntryPointDescriptionArg | string | undefined;
force?: boolean | undefined;
}
caller?: CallStack | undefined;
description?: EntryPointDescriptionArg | string | undefined;
force?: boolean | undefined;
}
| EntryPointDescriptionArg
| EntryPoint
| string
) => EntryPoint;
) => void;
getEntryPoint: () => EntryPoint | undefined;

@@ -74,34 +74,34 @@

| [
operation: "reactive:read" | "reactive:write" | "reactive:call",
entity: DescriptionDetails | string | undefined,
api?: PropertyKey
]
operation: "reactive:read" | "reactive:write" | "reactive:call",
entity: DescriptionDetails | string | undefined,
api?: PropertyKey
]
| [
operation:
| "object:get"
| "object:set"
| "object:has"
| "object:call"
| "object:define"
| "object:delete"
| "object:meta:get",
entity: DescriptionDetails | string | undefined,
target: PropertyKey
]
operation:
| "object:get"
| "object:set"
| "object:has"
| "object:call"
| "object:define"
| "object:delete"
| "object:meta:get",
entity: DescriptionDetails | string | undefined,
target: PropertyKey
]
| [
operation: "object:meta:keys",
entity: DescriptionDetails | string | undefined
]
operation: "object:meta:keys",
entity: DescriptionDetails | string | undefined
]
| [
operation: "function:call",
entity: DescriptionDetails | string | undefined
]
operation: "function:call",
entity: DescriptionDetails | string | undefined
]
| [
operation:
| "collection:has"
| "collection:get"
| "collection:insert"
| "collection:delete",
entity: DescriptionDetails | string | undefined,
key: unknown
];
operation:
| "collection:has"
| "collection:get"
| "collection:insert"
| "collection:delete",
entity: DescriptionDetails | string | undefined,
key: unknown
];

@@ -18,4 +18,5 @@ import type { TAG } from "@starbeam/shared";

/**
* Cell is the fundamental mutable reactive value. All subscriptions in Starbeam are ultimately
* subscriptions to cells, and all mutations in Starbeam are ultimately mutations to cells.
* Cell is the fundamental mutable reactive value. All subscriptions in
* Starbeam are ultimately subscriptions to cells, and all mutations in
* Starbeam are ultimately mutations to cells.
*/

@@ -32,12 +33,15 @@ export interface CellTag extends TagMethods {

/**
* Formula is a reactive that has *dynamic* children. This means that you can't cache the children
* (or subscribe directly to them), because they may change. This is different from delegates, which
* are guaranteed to have the same set of children forever.
* Formula is a reactive that has *dynamic* children. This means that you can't
* cache the children (or subscribe directly to them), because they may change.
* This is different from delegates, which are guaranteed to have the same set
* of children forever.
*
* Composite reactives must notify the timeline when their children have changed.
* Composite reactives must notify the timeline when their children have
* changed.
*
* A subscription to a composite reactive is a subscription to its current children, as of the last
* time the timeline was notified of changes to the composite's children. Whenever the timeline is
* notified of a change to the composite's children, it removes subscriptions from any stale
* dependencies and adds subscriptions to any new dependencies.
* A subscription to a composite reactive is a subscription to its current
* children, as of the last time the timeline was notified of changes to the
* composite's children. Whenever the timeline is notified of a change to the
* composite's children, it removes subscriptions from any stale dependencies
* and adds subscriptions to any new dependencies.
*/

@@ -66,5 +70,5 @@ export interface FormulaTag extends TagMethods {

*
* Data structures built on `FormulaTag` should always read the formula before
* attempting to read the children if they plan to rely on the absence of
* children as a strong indicator of staticness.
* Data structures built on `FormulaTag` should always read the formula
* before attempting to read the children if they plan to rely on the absence
* of children as a strong indicator of staticness.
*/

@@ -75,9 +79,11 @@ children: () => ReadonlySet<Tag>;

/**
* Delegate is a reactive that represents one or more reactives, but that set of reactives cannot
* change. This allows you to cache the value of the `delegate` property, and it also allows you to
* subscribe directly to the delegate's targets.
* Delegate is a reactive that represents one or more reactives, but that set
* of reactives cannot change. This allows you to cache the value of the
* `delegate` property, and it also allows you to subscribe directly to the
* delegate's targets.
*
* In practice, when you subscribe to a delegate, the timeline subscribes directly to the delegate's
* targets. This means that delegates don't need to know when their value changes, and don't need to
* notify the timeline when their targets change.
* In practice, when you subscribe to a delegate, the timeline subscribes
* directly to the delegate's targets. This means that delegates don't need to
* know when their value changes, and don't need to notify the timeline when
* their targets change.
*/

@@ -91,12 +97,14 @@ export interface DelegateTag extends TagMethods {

/**
* Static is a reactive that is guaranteed not to change. This means that you can cache the value of
* the static reactive and don't need to include it in composite children. All validation semantics
* act as if static reactives were not present.
* Static is a reactive that is guaranteed not to change. This means that you
* can cache the value of the static reactive and don't need to include it in
* composite children. All validation semantics act as if static reactives were
* not present.
*
* If a formula or delegate has only static children, it is also static. Even though a formula's
* children can change, if the formula's *only* children are static, then the formula can never
* invalidate, and therefore it, itself, is treated as static.
* If a formula or delegate has only static children, it is also static. Even
* though a formula's children can change, if the formula's *only* children are
* static, then the formula can never invalidate, and therefore it, itself, is
* treated as static.
*
* TODO: Do we need a separate fundamental type for pollable formulas, which can get new
* dependencies even if they never invalidate?
* TODO: Do we need a separate fundamental type for pollable formulas, which
* can get new dependencies even if they never invalidate?
*/

@@ -109,9 +117,11 @@ export interface StaticTag extends TagMethods {

/**
* A tag validates a reactive value. The behavior of a tags is defined in relation to reads and
* writes of the reactive value they represent. Tags model **value composition** (and functional
* composition), not a more general algebra.
* A tag validates a reactive value. The behavior of a tags is defined in
* relation to reads and writes of the reactive value they represent. Tags
* model **value composition** (and functional composition), not a more general
* algebra.
*
* In other words, it doesn't make sense to think about the composition of tags abstracted from the
* values they represent. Attempting to think about tags this way makes them seem more general than
* they are, and that generality breaks system invariants derived from value composition.
* In other words, it doesn't make sense to think about the composition of tags
* abstracted from the values they represent. Attempting to think about tags
* this way makes them seem more general than they are, and that generality
* breaks system invariants derived from value composition.
*/

@@ -123,5 +133,6 @@ export type Tag = CellTag | FormulaTag | DelegateTag | StaticTag;

*
* A subscription to a formula is a dynamic subscription to its current dependencies.
* A subscription to a delegate is equivalent to subscribing to its (stable) targets.
* A subscription to a static is equivalent to subscribing to nothing.
* A subscription to a formula is a dynamic subscription to its current
* dependencies. A subscription to a delegate is equivalent to subscribing to
* its (stable) targets. A subscription to a static is equivalent to
* subscribing to nothing.
*/

@@ -136,4 +147,4 @@ export type SubscriptionTarget = CellTag | FormulaTag;

* the tagged object was initially created. However, this made it impossible to
* use an tagged object's tag as a key in a WeakMap, which meant that the tagged
* object itself had to be passed around even when it was semantically
* use an tagged object's tag as a key in a WeakMap, which meant that the
* tagged object itself had to be passed around even when it was semantically
* unimportant.

@@ -140,0 +151,0 @@ *

@@ -8,4 +8,4 @@ import type { CallStack } from "./debug/call-stack.js";

/**
* The runtime is the interface that defines the core operations of the reactive
* system.
* The runtime is the interface that defines the core operations of the
* reactive system.
*

@@ -28,4 +28,4 @@ * ## Cells and Formulas

*
* - `onFinalize(object, handler)`: Registers a finalizer handler for an object.
* - `finalize(object)`: Finalizes an object.
* - `onFinalize(object, handler)`: Registers a finalizer handler for an
* object. - `finalize(object)`: Finalizes an object.
* - `link(parent, child)`: Link two objects together: when the parent is

@@ -41,6 +41,3 @@ * finalized, the child will be finalized as well.

*/
readonly mark: (
cell: CellTag,
mark: (revision: Timestamp) => void
) => void;
readonly mark: (cell: CellTag, mark: (revision: Timestamp) => void) => void;
/**

@@ -59,4 +56,4 @@ * Indicate that the value associated with the given tag has been consumed.

/**
* Subscribe to notifications that the given tag has updates ready ("readiness
* notifications").
* Subscribe to notifications that the given tag has updates ready
* ("readiness notifications").
*

@@ -81,36 +78,2 @@ * The second parameter to `subscribe` is a callback that will be called

readonly start: () => () => TagSnapshot;
/**
* Register a finalization handler for the given object. The finalization
* handler will be called when the object is explicitly finalized, or when
* a linked parent object is finalized.
*
* The return value of `onFinalize` is a function that can be called to
* remove the finalization handler.
*
* A finalization handler will only ever be called at most once. If the
* finalization handler is removed before the object is finalized, it will
* not be called.
*/
readonly onFinalize: (object: object, callback: Unsubscribe) => Unsubscribe;
/**
* Link two objects together. When the parent object is finalized, the child
* object will also be finalized.
*
* The return value of `link` is a function that can be called to remove the
* link. This is useful for objects that can move between parents, but should
* still be automatically finalized when the final parent is finalized.
*/
readonly link: (parent: object, child: object) => Unsubscribe;
/**
* Explicitly finalize the given object. This will call any finalization
* handlers that have been registered for the object, and will also finalize
* any linked children (recursively).
*
* Finalization handlers run synchronously, so you can rely on them to run
* before replacing a finalized object with a new object.
*/
readonly finalize: (object: object) => void;
}

@@ -117,0 +80,0 @@

@@ -1,3 +0,1 @@

import type { UNINITIALIZED } from "@starbeam/shared";
import type { Description } from "./debug/description.js";

@@ -13,9 +11,9 @@ import type { Timestamp } from "./timestamp.js";

/**
* Cell is the fundamental mutable reactive value. All subscriptions in Starbeam
* are ultimately subscriptions to cells, and all mutations in Starbeam are
* ultimately mutations to cells.
* Cell is the fundamental mutable reactive value. All subscriptions in
* Starbeam are ultimately subscriptions to cells, and all mutations in
* Starbeam are ultimately mutations to cells.
*
* If a cell has `undefined` dependencies, that means that the cell cannot
* change anymore. This allows it to be removed from any formulas that depend on
* it.
* change anymore. This allows it to be removed from any formulas that depend
* on it.
*/

@@ -30,15 +28,18 @@ export interface CellTag {

/**
* Formula is a reactive that has *dynamic* children. This means that you can't cache the children
* (or subscribe directly to them), because they may change. This is different from delegates, which
* are guaranteed to have the same set of children forever.
* Formula is a reactive that has *dynamic* children. This means that you can't
* cache the children (or subscribe directly to them), because they may change.
* This is different from delegates, which are guaranteed to have the same set
* of children forever.
*
* Composite reactives must notify the timeline when their children have changed.
* Composite reactives must notify the timeline when their children have
* changed.
*
* A subscription to a composite reactive is a subscription to its current children, as of the last
* time the timeline was notified of changes to the composite's children. Whenever the timeline is
* notified of a change to the composite's children, it removes subscriptions from any stale
* dependencies and adds subscriptions to any new dependencies.
* A subscription to a composite reactive is a subscription to its current
* children, as of the last time the timeline was notified of changes to the
* composite's children. Whenever the timeline is notified of a change to the
* composite's children, it removes subscriptions from any stale dependencies
* and adds subscriptions to any new dependencies.
*
* TODO: Do we need a separate fundamental type for non-cached formulas, which can get new
* dependencies even if they never invalidate?
* TODO: Do we need a separate fundamental type for non-cached formulas, which
* can get new dependencies even if they never invalidate?
*/

@@ -48,14 +49,16 @@ export interface FormulaTag {

readonly description?: Description | undefined;
readonly dependencies: UNINITIALIZED | (() => readonly CellTag[]);
readonly dependencies: undefined | (() => readonly CellTag[]);
}
/**
* A tag validates a reactive value. The behavior of a tags is defined in relation to reads and
* writes of the reactive value they represent. Tags model **value composition** (and functional
* composition), not a more general algebra.
* A tag validates a reactive value. The behavior of a tags is defined in
* relation to reads and writes of the reactive value they represent. Tags
* model **value composition** (and functional composition), not a more general
* algebra.
*
* In other words, it doesn't make sense to think about the composition of tags abstracted from the
* values they represent. Attempting to think about tags this way makes them seem more general than
* they are, and that generality breaks system invariants derived from value composition.
* In other words, it doesn't make sense to think about the composition of tags
* abstracted from the values they represent. Attempting to think about tags
* this way makes them seem more general than they are, and that generality
* breaks system invariants derived from value composition.
*/
export type Tag = CellTag | FormulaTag;

@@ -17,4 +17,4 @@ import type { TAG } from "@starbeam/shared";

* the tagged object was initially created. However, this made it impossible to
* use an tagged object's tag as a key in a WeakMap, which meant that the tagged
* object itself had to be passed around even when it was semantically
* use an tagged object's tag as a key in a WeakMap, which meant that the
* tagged object itself had to be passed around even when it was semantically
* unimportant.

@@ -27,7 +27,7 @@ */

/**
* A `TaggedReactive` object is a reactive object that has a `Tag` (which is used
* to validate it) and a `read` function that can be used to read the current
* value of the object.
* A `TaggedReactive` object is a reactive object that has a `Tag` (which is
* used to validate it) and a `read` function that can be used to read the
* current value of the object.
*/
export interface TaggedReactive<T = unknown, I extends Tag = Tag>
export interface TaggedReactive<out T = unknown, I extends Tag = Tag>
extends Tagged<I> {

@@ -34,0 +34,0 @@ readonly read: () => T;

@@ -11,7 +11,1 @@ export interface Timestamp {

}
export interface TimestampStatics {
now: () => Timestamp;
max: (...timestamps: Timestamp[]) => Timestamp;
debug: (timestamp: Timestamp) => { at: number };
}

@@ -5,10 +5,10 @@ {

"composite": true,
"types": ["../../env.d.ts"],
"declaration": true,
"declarationDir": "../../../dist/types",
"declarationMap": true,
"outDir": "../../../dist/packages",
"types": ["../../env"]
"emitDeclarationOnly": true
},
"exclude": ["dist/**/*"],
"include": ["index.ts", "./src/**/*.ts", "./src/**/*.d.ts"]
"include": ["index.ts", "./src/**/*.ts", "./src/**/*.d.ts"],
"exclude": ["dist/**/*"]
}
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