Skip to content

Commit 32613f8

Browse files
gitKrystanrunspiredrenovate[bot]jrjohnsonMehulKChaudhari
authored
Bulk backports to v4-main (3/20 edition) (#9775)
* feat: schema type utils (#9757) * minor type improvements * chore: fixup types * add api docs * nice things * account for schema presence * cleanup test * chore: update contributing docs (#9758) * chore: Improve contributing experience (#9759) * chore: improve developing experience on local * more * temporarily deactivate some scenarios * deactivate more lints * deactivate more prod tests * another * chore: reduce simple Map/Set ops (#9761) * perf: faster iteration of relationship payloads (#9762) faster iteration of payloads * chore: restructure SchemaRecord test file layout to make it easier to navigate (#9763) * chore: simplify test file layout * chore: move polaris test files to new structure * docs: LinksMode and Polymorphic Relationship Guide, stubs out guide for LegacyMode vs PolarisMode (#9764) * docs: stub out guides for SchemaRecord, LinksMode, PolarisMode etc. * add linksmode guide * fix annotation * Update guides/relationships/features/links-mode.md Co-authored-by: Krystan HuffMenne <kmenne+github@gmail.com> * Update guides/relationships/features/links-mode.md Co-authored-by: Krystan HuffMenne <kmenne+github@gmail.com> * Update guides/relationships/features/links-mode.md Co-authored-by: Krystan HuffMenne <kmenne+github@gmail.com> * Update guides/relationships/features/links-mode.md Co-authored-by: Krystan HuffMenne <kmenne+github@gmail.com> * Update guides/relationships/features/links-mode.md Co-authored-by: Krystan HuffMenne <kmenne+github@gmail.com> * Update guides/relationships/features/links-mode.md Co-authored-by: Krystan HuffMenne <kmenne+github@gmail.com> * Update guides/relationships/features/links-mode.md Co-authored-by: Krystan HuffMenne <kmenne+github@gmail.com> * Update guides/relationships/features/links-mode.md Co-authored-by: Krystan HuffMenne <kmenne+github@gmail.com> * Update guides/relationships/features/links-mode.md Co-authored-by: Krystan HuffMenne <kmenne+github@gmail.com> * Update guides/relationships/features/links-mode.md Co-authored-by: Krystan HuffMenne <kmenne+github@gmail.com> * Update guides/relationships/features/links-mode.md Co-authored-by: Krystan HuffMenne <kmenne+github@gmail.com> * Update guides/relationships/features/links-mode.md Co-authored-by: Krystan HuffMenne <kmenne+github@gmail.com> * cleanup op * rewrite future thoughts * stub out more of the guide * add docs on polymorphism * stub out guide * add note on interop * add reactivity overview --------- Co-authored-by: Krystan HuffMenne <kmenne+github@gmail.com> * feat: improve debuggability of SchemaRecord, RecordArray and Identifier (#9766) * feat: improve debuggability of SchemaRecord, RecordArray and Identifier * fix configurability * fix keys * feat: persist runtime config (#9767) * feat: persist runtime config * ensure fastboot works * Don't set isDirty to true in diff callbacks (#9765) * More overnotification fixes * Fix DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE case * feat: ensure objects behave amazeballs (#9768) * feat: ensure objects behave amazeballs * add tests for record iteration * add more tests * fix(deps): update dependency @babel/runtime to v7.26.10 [security] (#9760) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore: remove restriction on new field kinds being used with legacy mode * improve types * Revert "improve types" This reverts commit 84daef7. * Revert "chore: remove restriction on new field kinds being used with legacy mode" This reverts commit 3fd81bf. * Widen Peer Range for ember-inflector (#9770) * chore: remove restriction on new field kinds being used with legacy mode (#9769) * chore: remove restriction on new field kinds being used with legacy mode * chore: cleanup types * fix * fix test * fix docs * chore: cleanup @ember/service deprecation from shipped library code (#9773) * Add: tests verify behavior mutating a record (#9754) * add: tests verify behavior mutating a related record from a checked-out record * fix: lint * fix: test * fix: lint * fix: better reordering detection when remoteClearsLocal is true (#9771) * Fix DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE reordering detection * add failing test * notification tests * implement fix * cleanup console logs * fix spurrious type issue --------- Co-authored-by: Chris Thoburn <runspired@users.noreply.github.com> * Fix some lint --------- Co-authored-by: Chris Thoburn <runspired@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jon Johnson <jon.johnson@ucsf.edu> Co-authored-by: Mehul Kiran Chaudhari <55375534+MehulKChaudhari@users.noreply.github.com>
1 parent a18d356 commit 32613f8

File tree

125 files changed

+5468
-977
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+5468
-977
lines changed

.npmrc

-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ link-workspace-packages=false # deep
130130
## script to handle this.
131131
##
132132
sync-injected-deps-after-scripts[]=build:pkg
133-
sync-injected-deps-after-scripts[]=build:infra
134133
sync-injected-deps-after-scripts[]=build:glint
135134
sync-injected-deps-after-scripts[]=sync
136135

contributing/become-a-contributor.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Become A Contributor
22

3-
Anyone can contribute to EmberData. Contributing can be as simple as opening an issue or helping to track down the cause of one. Or as involved as contributing a fix, helping with routine maintenance, or implementing a big new feature.
3+
Anyone can contribute to WarpDrive. Contributing can be as simple as opening an issue or helping to track down the cause of one. Or as involved as contributing a fix, helping with routine maintenance, or implementing a big new feature.
44

55
In addition to holding discussions on individual [issues](https://github.com/emberjs/data/issues)
66
or [RFCs](https://github.com/emberjs/rfcs/labels/T-ember-data), we coordinate work when needed in the `#dev-ember-data` channel on [Ember's Discord Server](https://discord.gg/zT3asNS).

contributing/key-concepts.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ const identifier = recordIdentifierFor(record);
3333
unloadRecord(identifier);
3434
```
3535

36-
Any identifier supplied by an EmberData API will always be the stable variant. APIs which are operating based on identity and which can reasonably presume that the data exists expect stable identifiers and should error if an unknown identifier is encountered to prevent potential system-correctness errors.
36+
Any identifier supplied by a WarpDrive API will always be the stable variant. APIs which are operating based on identity and which can reasonably presume that the data exists expect stable identifiers and should error if an unknown identifier is encountered to prevent potential system-correctness errors.

contributing/linking-to-applications.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#### Testing EmberData source directly in your Application
1+
#### Testing WarpDrive source directly in your Application
22

3-
You can use package linking to test checkouts of ember-data against your application locally. This applies to consuming ember-data directly within an ember application. It will not work in your application if you are consuming ember-data through an addon (transitive dependency problem). This approach also presumes consuming all of ember-data.
3+
You can use package linking to test checkouts of WarpDrive against your application locally. This applies to consuming WarpDrive directly within an ember application. It will not work in your application if you are consuming WarpDrive through an addon (transitive dependency problem). This approach also presumes consuming all of WarpDrive.
44

55
1. clone this repository or another fork
66
2. install dependencies: `pnpm install`
@@ -14,4 +14,4 @@ If using `pnpm`
1414

1515
If you don't use pnpm in your application, using the appropriate `yarn link` and `npm link` commands within the respective directories for the project and your app may work.
1616

17-
Once you have linked EmberData to your application, you can run `ember serve` as usual in your application.
17+
Once you have linked WarpDrive to your application, you can run `ember serve` as usual in your application.

contributing/rfc-process.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
### Requesting Features or Deprecations
22

3-
`ember-data` participates in the [RFC process (GitHub emberjs/rfcs)](https://github.com/emberjs/rfcs/).
3+
While WarpDrive is universal in nature, its development is managed by the EmberJS community.
4+
5+
WarpDrive participates in the [RFC process (GitHub emberjs/rfcs)](https://github.com/emberjs/rfcs/).
46
Most changes to the public API including new features, changes in behavior, or deprecations require
57
community discussion and must go through this process.
68

@@ -20,12 +22,12 @@ are narrowly scoped with clear understanding of alternatives, drawbacks, and the
2022
5. Open an [RFC issue](https://github.com/emberjs/rfcs/issues?q=is%3Aissue+is%3Aopen+label%3AT-ember-data)
2123
to broaden and record the discussion if the idea needs more time for discussion and iteration.
2224
- label your issue with `T-ember-data` (or ask someone in `#dev-ember-data` to add the label if you lack the permission)
23-
- announce your issue in `#dev-ember-data` and anywhere else desired such as `#news-and-announcements` and `twitter`.
25+
- announce your issue in `#dev-ember-data` and anywhere else desired such as `#news-and-announcements` and `bluesky`.
2426
6. [Draft an RFC](https://github.com/emberjs/rfcs#what-the-process-is) and share it with those you have
2527
been discussing the ideas with.
2628
7. Publish your RFC by opening a PR to [emberjs/rfcs/](https://github.com/emberjs/rfcs/pulls?q=is%3Apr+is%3Aopen+label%3AT-ember-data)
2729
- label your PR with `T-ember-data` (or ask someone in `#dev-ember-data` to add the label if you lack the permission)
28-
- announce your PR in `#dev-ember-data` and anywhere else desired such as `#news-and-announcements` and `twitter`.
30+
- announce your PR in `#dev-ember-data` and anywhere else desired such as `#news-and-announcements` and `bluesky`.
2931
8. Attend weekly team meetings to discuss the RFC, continue iterating on the RFC, and help shepherd it to completion.
3032
9. Build a proof-of-concept. Sometimes this is best if it occurs alongside drafting the RFC, as it often informs
3133
the RFC design, known drawbacks, and alternatives. Often it will become incorporated in the final implementation.

contributing/setting-up-the-project.md

+28-1
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,36 @@ Currently the install command is also what builds all of the individual packages
6868
## Create certificates
6969

7070
```sh
71-
pnpx @warp-drive/holodeck ensure-cert
71+
pnpm dlx @warp-drive/holodeck ensure-cert
7272
```
7373

74+
## Building the project
75+
76+
The project's packages will build whenever `pnpm install` is run. They can be rebuilt by running `pnpm prepare`.
77+
78+
Both `install` and `prepare` will ensure turbo cache is ignored so that pnpm will automatically update "hardlinks" for
79+
the build output files in the node_modules directory of the various other packages and test apps that depend upon the package.
80+
81+
However, this is pretty slow for development, so a fast albeit slightly manual approach is available for development
82+
by running the below commands in order:
83+
84+
From the project root:
85+
86+
- install: `pnpm install` - installs all dependencies and sets up initial hardlinks
87+
- start: `pnpm start` - starts the build for every public package in watch mode
88+
89+
Then, from an individual test app:
90+
91+
- `pnpm start` - starts the build for test assets in watch mode
92+
- `pnpm test:start` - launches a test server (and by opens a browser window for debugging them)
93+
94+
Because the project uses hardlinks, even though the packages are rebuilding, the test apps won't be able
95+
to see the results of the change in many scenarios unless the hardlinks are regenerated.
96+
97+
At anypoint, run `pnpm sync` from the root to regenerate the hardlinks. The test app server may
98+
pick up this change automatically, but if it does not saving any file (even without changing it)
99+
in the test app will trigger a rebuild.
100+
74101
## Run some commands
75102

76103
Generally test and lint commands can be found in the `"scripts"` section of the root `package.json` manifest. Individual packages or test packages have additional commands in the `"scripts"` section of their own `package.json` manifest as well.

contributing/submitting-prs.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,17 @@ All PRs should have accompanying tests. For bug-fixes, this should include tests
1919
the issue being fixed and test that the solution works.
2020

2121
- We do write tests for our deprecations and assertion messages, using the `assert.expectAssertion()` and `assert.expectDeprecation()` helpers.
22-
- Because we run tests in both development and `production` environments, assertions, deprecations and warnings may be stripped out. To avoid tests on failing for your PR in production environments, use the `testInDebug` function instead of `qunit` `test` to skip them in production when appropriate.
22+
- Because we run tests in both development and `production` environments, assertions, deprecations and warnings may be stripped out. To avoid tests of debug behaviors failing for your PR in production environments, use the `testInDebug` function instead of `qunit` `test` to skip them in production when appropriate.
23+
- alternatively wrap specific assertions in `if (DEBUG)` or `if (PRODUCTION)`
2324
- Update the documentation, examples, and guides when affected by your contribution
2425

2526
### Running Tests
2627

2728
- PRs will automatically run an extensive set of test scenarios for your work. In some cases a contributor
2829
may need to approve the workflow run if this is your first contribution.
29-
- `EmberData` is a collection of packages and comes with multiple test apps scoped to specific situations
30-
or parts of the codebase we want to test. Tests live in the test applications in `<project>/tests`. These should look like familiar ember app/addon tests, and to run them from within a specific test app use `pnpm test` or `pnpm test --serve`. For additional test commands see the list
30+
- `WarpDrive` is a collection of packages and comes with multiple test apps scoped to specific situations
31+
or parts of the codebase we want to test. These test applications can be found in `<project>/tests`.
32+
These should look like familiar ember app/addon tests, and to run them from within a specific test app use `pnpm test` or `pnpm test --serve`. For additional test commands see the list
3133
of commands in the respective `package.json` files.
3234

3335
### Pull Request Titles

guides/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Read [The Manual](./manual/0-index.md)
77

88
- [Relationships](./relationships/index.md)
99
- [Requests](./requests/index.md)
10+
- [Reactivity](./reactive-data/index.md)
1011
- [Typescript](./typescript/index.md)
1112
- [Terminology](./terminology.md)
1213
- [Cookbook](./cookbook/index.md)

guides/reactive-data/index.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Reactive Data
2+
3+
In addition to request and cache management, WarpDrive provides a reactive access
4+
layer for data in the cache.
5+
6+
Data in the cache is conceptualized as belonging to one of three forms
7+
8+
- **Documents** - the response to a request
9+
- **Resources** - a unique cacheable entity within the response to a request
10+
- **Fields** - the data for an individual property on a resource
11+
12+
Each form of data can be accessed and managed reactively through one of two modes
13+
14+
- *(upcoming, default in v6)* [PolarisMode](./polaris/overview.md)
15+
- *(current, default in v5)* [LegacyMode](./legacy/overview.md)
16+
17+
These modes are interopable. The reactive object (record) for a resource in PolarisMode can relate to
18+
a record in LegacyMode and vice-versa. This interopability is true whether the record in LegacyMode is
19+
a SchemaRecord or a Model.
20+
21+
These reactive primitives use fine-grained signals-based reactivity. Currently, we use
22+
glimmer's (Ember's) implementation of `Signal` (`@tracked`) and `Computed` (`@cached`);
23+
however, we've architected our use to be pluggable and will soon enable configuration
24+
of any desired implementation, thus making WarpDrive compatible with any signals compatible
25+
library or framework.
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# LegacyMode
2+
3+
-[ReactiveData](../index.md)
4+
5+
---
6+
7+
🚧 This guide is under active construction, it will talk about the below points 🚧
8+
9+
In LegacyMode records are:
10+
11+
- mutable
12+
- local changes immediately reflect app wide
13+
- all the APIs of Model (references, state props, currentState, methods etc)
14+
- limited reactivity for fields (same as Model)
15+
- requires continued use of the `model` and `legacy-compat` packages (though most imports from them can be removed)
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# PolarisMode
2+
3+
-[ReactiveData](../index.md)
4+
5+
---
6+
7+
🚧 This guide is under active construction, it will talk about the below points 🚧
8+
9+
In PolarisMode records are:
10+
11+
- immutable (unless creating or checking out for editing)
12+
- local changes only show where you want them to on the editable version
13+
- none of the APIs of Model (references, state props, currentState, methods etc)
14+
- deep reactivity for fields
15+
- advanced derivations, aliasing and transformations
16+
- [currently] limited support for relationships
17+
- no promise proxies for relationships

0 commit comments

Comments
 (0)