@adobe/data 0.9.70 → 0.9.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/data",
3
- "version": "0.9.70",
3
+ "version": "0.9.72",
4
4
  "description": "Adobe data oriented programming library",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/data-lit",
3
- "version": "0.9.70",
3
+ "version": "0.9.72",
4
4
  "description": "Adobe data Lit bindings - hooks, elements, decorators",
5
5
  "type": "module",
6
6
  "private": false,
@@ -10,22 +10,32 @@ import { attachDecorator, withHooks } from '../index.js';
10
10
  export abstract class DatabaseElement<P extends Database.Plugin> extends LitElement {
11
11
 
12
12
  /**
13
- * The live database, fully typed. Set by an ancestor via DI (`.database=…`)
14
- * or created from `plugin` on connect. Bootstrap containers those that own
15
- * a controller or drive a streaming (async-generator) transaction read
16
- * this directly; pure widgets use the restricted `service` view below.
13
+ * Internal DI seam prefer `service`. Set by an ancestor via injection or
14
+ * created from `plugin` on connect. Bootstrap containers (those that own a
15
+ * controller or drive a streaming async-generator transaction) and ancestor
16
+ * injection use this; ordinary consumers inject and read through `service`
17
+ * instead.
18
+ *
19
+ * Deliberately documented in prose rather than with the internal JSDoc tag:
20
+ * this package emits with `stripInternal`, so that tag would erase this
21
+ * declaration from the public `.d.ts`. It must survive because
22
+ * `findAncestorDatabase` duck-types `element.database` across instances and
23
+ * bootstrap subclasses read it directly.
17
24
  */
18
25
  @property({ type: Object, reflect: false })
19
26
  database!: Database.Plugin.ToDatabase<P>;
20
27
 
21
28
  /**
22
- * UI-restricted view of {@link database} for pure-widget rendering: every
23
- * transaction / mutator is rewritten to fire-and-forget `void` so a widget
24
- * can never await on or read back a mutation; reads go through `observe`.
29
+ * UI-restricted view of the database for rendering. Inject the full database by
30
+ * assigning here (`element.service = db`); reads return the restricted view where
31
+ * every mutator is fire-and-forget `void`.
25
32
  */
26
33
  get service(): UIService.FromService<Database.Plugin.ToDatabase<P>> {
27
34
  return UIService.restrict(this.database);
28
35
  }
36
+ set service(db: Database.Plugin.ToDatabase<P>) {
37
+ this.database = db;
38
+ }
29
39
 
30
40
  constructor() {
31
41
  super();
@@ -37,6 +37,19 @@ class _CountElement extends DatabaseElement<typeof plugin> {
37
37
  type ServiceType = _CountElement["service"];
38
38
  type RawDatabase = Database.Plugin.ToDatabase<typeof plugin>;
39
39
 
40
+ // 0. `service` is a read/write accessor: the getter returns the restricted view,
41
+ // while the setter accepts the full database (injection). The divergent
42
+ // get/set types are intentional (legal since TS 5.1).
43
+ const _injectFullDatabase = (el: _CountElement, db: RawDatabase): void => {
44
+ el.service = db;
45
+ };
46
+ // A side effect of the divergence: `el.service = el.service` is a type error,
47
+ // since the restricted getter type is not assignable to the full setter type.
48
+ const _rejectRestrictedAssignment = (el: _CountElement): void => {
49
+ // @ts-expect-error restricted view is not assignable back to the full database
50
+ el.service = el.service;
51
+ };
52
+
40
53
  // 1. The exposed service type is the UIService-restricted view of the database.
41
54
  type _CheckRestricted = Assert<Equal<ServiceType, UIService.FromService<RawDatabase>>>;
42
55
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "data-lit-tictactoe",
3
- "version": "0.9.70",
3
+ "version": "0.9.72",
4
4
  "description": "Tic-Tac-Toe sample - Lit web components with @adobe/data-lit and AgenticService",
5
5
  "type": "module",
6
6
  "private": true,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/data-react",
3
- "version": "0.9.70",
3
+ "version": "0.9.72",
4
4
  "description": "Adobe data React bindings — hooks and context for ECS database",
5
5
  "type": "module",
6
6
  "private": false,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "data-react-hello",
3
- "version": "0.9.70",
3
+ "version": "0.9.72",
4
4
  "description": "Hello World sample - click counter using @adobe/data-react",
5
5
  "type": "module",
6
6
  "private": true,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "data-react-pixie",
3
- "version": "0.9.70",
3
+ "version": "0.9.72",
4
4
  "description": "PixiJS React sample - ECS sprites (bunny, fox) with @adobe/data-react",
5
5
  "type": "module",
6
6
  "private": true,