@harperfast/template-react-ts-studio 1.12.0 → 1.12.2

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.
@@ -1988,26 +1988,22 @@ await fetch('http://localhost:9926/JokeCache/1', {
1988
1988
 
1989
1989
  ### 4.1 Deploying to Harper Fabric
1990
1990
 
1991
- Instructions for the agent to follow when deploying a Harper application to a remote Harper Fabric cloud instance.
1991
+ Instructions for the agent to follow when deploying a Harper application to a remote Harper Fabric cluster.
1992
1992
 
1993
1993
  #### When to Use
1994
1994
 
1995
- Apply this rule when deploying a Harper application to a remote Harper Fabric cluster or any remote Harper instance. Use it when setting up CI/CD pipelines that push application packages to a target environment, or when deploying from a local directory or external package source to a remote cluster.
1995
+ Apply this rule when deploying a Harper application to a remote Harper Fabric cluster or any remote Harper instance. This includes first-time deploys, redeployments, rollbacks, and CI/CD pipeline deployments. See [creating-a-fabric-account-and-cluster.md](creating-a-fabric-account-and-cluster.md) to set up a cluster before deploying.
1996
1996
 
1997
1997
  #### How It Works
1998
1998
 
1999
- 1. **Obtain the target URL**: Get the cluster's **Application URL** from the cluster's **Config → Overview** page. This is the hostname passed to all CLI commands as `target`.
2000
-
2001
- 2. **Authenticate with `harper login`**: Run `harper login` once to store an authentication token locally. The CLI also writes `HARPER_CLI_TARGET` to a local `.env` for subsequent commands.
1999
+ 1. **Authenticate against the remote cluster**: Run `harper login` once, pointing at the cluster's Application URL (found on the cluster's **Config → Overview** page). The CLI stores the token and writes `HARPER_CLI_TARGET` to a local `.env`.
2002
2000
 
2003
2001
  ```bash
2004
2002
  harper login <Application URL>
2005
2003
  # Provide cluster username and password when prompted
2006
2004
  ```
2007
2005
 
2008
- See [creating-a-fabric-account-and-cluster.md](creating-a-fabric-account-and-cluster.md) for setting up a cluster before this step.
2009
-
2010
- 3. **Deploy with `harper deploy`**: After logging in, deploy without repeating credentials.
2006
+ 2. **Deploy the application**: Run `harper deploy` with the required parameters. After logging in, no credentials need to be repeated.
2011
2007
 
2012
2008
  ```bash
2013
2009
  harper deploy \
@@ -2018,7 +2014,50 @@ Apply this rule when deploying a Harper application to a remote Harper Fabric cl
2018
2014
  replicated=true
2019
2015
  ```
2020
2016
 
2021
- 4. **Use environment variables for CI/CD**: Instead of `harper login`, export credentials as environment variables before running `harper deploy`.
2017
+ 3. **Choose a package source**: Set the `package` parameter to any valid npm dependency value, or omit it to package and upload the current local directory.
2018
+
2019
+ | Value | Effect |
2020
+ | ---------------------------------------------------- | ------------------------------------------------ |
2021
+ | _(omitted)_ | Packages and deploys the current local directory |
2022
+ | `"@harperdb/status-check"` | npm package |
2023
+ | `"HarperDB/status-check"` | GitHub shorthand |
2024
+ | `"https://github.com/HarperDB/status-check"` | GitHub URL |
2025
+ | `"git+ssh://git@github.com:HarperDB/secret-app.git"` | Private repo via SSH |
2026
+ | `"https://example.com/application.tar.gz"` | Tarball URL |
2027
+
2028
+ For git tags, use the `semver` directive:
2029
+
2030
+ ```
2031
+ HarperDB/application-template#semver:v1.0.0
2032
+ ```
2033
+
2034
+ 4. **Deploy by reference (optional)**: Instead of uploading a snapshot, send a pinned git reference so the cluster fetches and builds that exact commit. Use `by_ref=true` to resolve the current commit from the local repository automatically.
2035
+
2036
+ ```bash
2037
+ harper deploy by_ref=true restart=true replicated=true
2038
+ ```
2039
+
2040
+ Use `ref` to deploy a specific commit, tag, or branch (resolved to a full SHA before sending):
2041
+
2042
+ ```bash
2043
+ # Deploy a specific tag
2044
+ harper deploy ref=v1.2.0 restart=true replicated=true
2045
+
2046
+ # Roll back by deploying an older commit
2047
+ harper deploy ref=9f8c2a1 restart=true replicated=true
2048
+ ```
2049
+
2050
+ **Key `by_ref` parameters:**
2051
+
2052
+ | Parameter | Required | Description |
2053
+ | ------------ | -------- | --------------------------------------------------------------------------------------------------------------------------- |
2054
+ | `by_ref` | — | Build the package reference from the local repository |
2055
+ | `ref` | optional | Deploy a specific commit, tag, or branch instead of `HEAD`. Implies `by_ref`. |
2056
+ | `credential` | optional | Set to `true` to authenticate the clone with the stored credential for the repository's host. Omit for public repositories. |
2057
+
2058
+ > Commit and push before deploying by reference. The cluster clones from the remote and only sees pushed commits. Run `git fetch` if the unpushed-commit check fires for a commit you know you pushed.
2059
+
2060
+ 5. **Authenticate for CI/CD**: Use environment variables instead of `harper login` for automated pipelines.
2022
2061
 
2023
2062
  ```bash
2024
2063
  export HARPER_CLI_USERNAME=<username>
@@ -2031,7 +2070,19 @@ Apply this rule when deploying a Harper application to a remote Harper Fabric cl
2031
2070
  replicated=true
2032
2071
  ```
2033
2072
 
2034
- 5. **Use inline auth parameters for one-off commands**: Pass `auth_username` and `auth_password` directly. These take precedence over environment variables and saved login tokens. Not recommended for production.
2073
+ 6. **Provision credentials for private repositories**: Run `harper deploy setup=true` once per component and source to provision a deploy credential. Run this with an administrative credential, not the CI identity.
2074
+
2075
+ ```bash
2076
+ harper deploy setup=true
2077
+ ```
2078
+
2079
+ Then pass `credential=true` on subsequent deploys:
2080
+
2081
+ ```bash
2082
+ harper deploy by_ref=true credential=true restart=true replicated=true
2083
+ ```
2084
+
2085
+ 7. **Use inline auth for one-off commands (not recommended for production)**: Pass `auth_username` and `auth_password` directly. These take precedence over environment variables and saved login tokens.
2035
2086
 
2036
2087
  ```bash
2037
2088
  harper deploy \
@@ -2044,59 +2095,56 @@ Apply this rule when deploying a Harper application to a remote Harper Fabric cl
2044
2095
  replicated=true
2045
2096
  ```
2046
2097
 
2047
- 6. **Choose a package source**: Set the `package` parameter to any valid npm dependency value, or omit it to package and deploy the current local directory.
2048
-
2049
- | Value | Meaning |
2050
- | ---------------------------------------------------- | ---------------------------------------------- |
2051
- | _(omitted)_ | Package and deploy the current local directory |
2052
- | `"@harperdb/status-check"` | npm package |
2053
- | `"HarperDB/status-check"` | GitHub shorthand |
2054
- | `"https://github.com/HarperDB/status-check"` | GitHub full URL |
2055
- | `"git+ssh://git@github.com:HarperDB/secret-app.git"` | Private repo via SSH |
2056
- | `"https://example.com/application.tar.gz"` | Remote tarball |
2057
-
2058
- For pinned git tags, use the `semver` directive:
2059
-
2060
- ```
2061
- HarperDB/application-template#semver:v1.0.0
2062
- ```
2063
-
2064
- For SSH-based private repos, register keys with the `Add SSH Key` operation before deploying.
2065
-
2066
2098
  #### Examples
2067
2099
 
2068
- **Interactive login then deploy:**
2100
+ **Standard deploy after login:**
2069
2101
 
2070
2102
  ```bash
2071
2103
  harper login https://my-cluster.harperdbcloud.com
2072
- # Enter username and password when prompted
2073
-
2074
2104
  harper deploy \
2075
2105
  project=my-app \
2076
- package="HarperDB/application-template#semver:v1.0.0" \
2106
+ package="@myorg/my-app" \
2077
2107
  target=https://my-cluster.harperdbcloud.com \
2078
2108
  restart=true \
2079
2109
  replicated=true
2080
2110
  ```
2081
2111
 
2082
- **CI/CD pipeline deploy using environment variables:**
2112
+ **Deploy current directory as a snapshot:**
2083
2113
 
2084
2114
  ```bash
2085
- export HARPER_CLI_USERNAME=admin
2086
- export HARPER_CLI_PASSWORD=secret
2087
2115
  harper deploy \
2088
2116
  project=my-app \
2089
- package="@harperdb/status-check" \
2090
2117
  target=https://my-cluster.harperdbcloud.com \
2091
2118
  restart=true \
2092
2119
  replicated=true
2093
2120
  ```
2094
2121
 
2095
- **Deploy current local directory:**
2122
+ **Deploy a pinned tag by reference:**
2123
+
2124
+ ```bash
2125
+ harper deploy ref=v1.2.0 restart=true replicated=true
2126
+ ```
2127
+
2128
+ **Deploy a private repository by reference with a stored credential:**
2096
2129
 
2097
2130
  ```bash
2131
+ harper deploy by_ref=true credential=true restart=true replicated=true
2132
+ ```
2133
+
2134
+ **GitHub Actions — deploy the pull request head commit explicitly:**
2135
+
2136
+ ```bash
2137
+ harper deploy ref=${{ github.event.pull_request.head.sha }} restart=true replicated=true
2138
+ ```
2139
+
2140
+ **CI/CD deploy using environment variables:**
2141
+
2142
+ ```bash
2143
+ export HARPER_CLI_USERNAME=<username>
2144
+ export HARPER_CLI_PASSWORD=<password>
2098
2145
  harper deploy \
2099
2146
  project=my-app \
2147
+ package="HarperDB/my-app#semver:v1.0.0" \
2100
2148
  target=https://my-cluster.harperdbcloud.com \
2101
2149
  restart=true \
2102
2150
  replicated=true
@@ -2104,10 +2152,14 @@ harper deploy \
2104
2152
 
2105
2153
  #### Notes
2106
2154
 
2107
- - Authentication precedence (highest to lowest): inline `auth_username`/`auth_password` parameters → environment variables (`HARPER_CLI_USERNAME`/`HARPER_CLI_PASSWORD`) → saved login token from `harper login`.
2108
- - `harper login` writes `HARPER_CLI_TARGET` to a local `.env`, so subsequent commands do not need `target` repeated if that file is present.
2109
- - Harper generates a `package.json` from component configurations and resolves packages via `npm install`. A local file path creates a symlink, so changes are picked up between restarts without redeploying.
2110
- - For SSH-based private repos, register the SSH key with the `Add SSH Key` operation before running `harper deploy`.
2155
+ - `harper login` stores an authentication token so subsequent `harper deploy` commands do not require credentials to be repeated.
2156
+ - Inline `auth_username`/`auth_password` parameters take precedence over environment variables, which take precedence over saved login tokens.
2157
+ - For SSH-based private repos, register keys with the `add_ssh_key` operation before deploying.
2158
+ - `by_ref` deploys build from source on each cluster node. If your application requires a build step that cannot run on the node, deploy a built payload (omit `by_ref`) instead.
2159
+ - `harper deploy setup=true` requires **super_user** privileges. Provision credentials with an administrative account, not the CI identity.
2160
+ - Tags and branches passed to `ref` are resolved to a full commit SHA locally before the deploy is sent. If resolution fails, run `git fetch` and retry, or pass a full commit SHA directly.
2161
+ - The `refs/pull/<n>/head` style refs are rejected; use `ref=${{ github.event.pull_request.head.sha }}` in GitHub Actions pull request workflows instead.
2162
+ - Deploy credentials provisioned via `harper deploy setup=true` are stored scoped to the component and reused on every subsequent deploy, including rollbacks.
2111
2163
 
2112
2164
  ### 4.2 Creating a Harper Fabric Account and Cluster
2113
2165
 
@@ -2546,15 +2598,15 @@ myApp:
2546
2598
 
2547
2599
  ### 4.7 v5 Upgrade: Breaking Changes and Migration Guide
2548
2600
 
2549
- Instructions for the agent to apply when migrating a Harper application to v5, covering all breaking changes and required code updates.
2601
+ Instructions for the agent to apply all required breaking-change fixes and recommended updates when migrating a Harper application to v5.
2550
2602
 
2551
2603
  #### When to Use
2552
2604
 
2553
- Apply this rule when upgrading an existing Harper application to v5, when encountering runtime errors related to renamed packages, changed APIs, or security restrictions introduced in v5, or when reviewing application code for v5 compatibility before deployment.
2605
+ Apply this rule whenever upgrading an existing Harper application to v5, encountering v5 runtime errors related to module imports, `Table.get` return values, transaction context, process spawning, or VM module loading. Also apply when configuring `harperdb-config.yaml` for a v5 deployment.
2554
2606
 
2555
2607
  #### How It Works
2556
2608
 
2557
- 1. **Update the package import from `harperdb` to `harper`**: All application code must import from `harper` instead of `harperdb`.
2609
+ 1. **Update the package import from `harperdb` to `harper`**: All application code must import from `harper`, not `harperdb`.
2558
2610
 
2559
2611
  ```javascript
2560
2612
  import { tables } from 'harper';
@@ -2562,74 +2614,160 @@ Apply this rule when upgrading an existing Harper application to v5, when encoun
2562
2614
 
2563
2615
  2. **Enable `allowInstallScripts` if packages require install scripts**: Harper v5 uses `--ignore-scripts` by default when installing packages. If your application requires installation scripts (e.g., to install additional binaries), set the `allowInstallScripts` option when deploying.
2564
2616
 
2565
- 3. **Update `Table.get` usage — return value is now a frozen record object**: `Table.get` now returns a plain record object, not a table class instance. The record is frozen; you cannot mutate it directly.
2617
+ 3. **Update `Table.get` usage — return value is now a plain frozen record object**: `Table.get` no longer returns an instance of the table class. The returned object is frozen and does not have table instance methods.
2566
2618
  - Replace `wasLoadedFromSource()` with `target.loadedFromSource`:
2567
2619
 
2568
2620
  ```javascript
2569
- // Old — remove this pattern:
2621
+ // OLD — no longer works
2570
2622
  const record = await Table.get(id);
2571
- if (record.wasLoadedFromSource()) { ... }
2623
+ if (record.wasLoadedFromSource()) {
2624
+ // record was loaded from origin (not cache)
2625
+ }
2626
+ ```
2572
2627
 
2573
- // New — use loadedFromSource on the target:
2574
- const target = new RequestTarget();
2628
+ ```javascript
2629
+ // NEW
2630
+ const target = new RequestTarget(); // note that this is passed in if you are overriding the `get` method
2575
2631
  target.id = id;
2576
2632
  const record = await Table.get(target);
2577
2633
  if (target.loadedFromSource) {
2578
- // record was loaded from origin (not cache)
2634
+ // record was loaded from origin (not cache)
2579
2635
  }
2580
2636
  ```
2581
2637
 
2582
- - Replace in-place mutation with object spread, since records are frozen:
2638
+ - The record object still has `getUpdatedTime` and `getExpiresAt` methods available.
2639
+
2640
+ - **Handle frozen records**: The record object is frozen — you cannot add or remove properties directly. Copy and spread instead:
2583
2641
 
2584
2642
  ```javascript
2585
- // Old — throws in v5:
2643
+ // OLD — throws in v5
2586
2644
  const record = await Table.get(id);
2587
2645
  record.property = 'changed';
2646
+ ```
2588
2647
 
2589
- // New — copy instead of mutate:
2648
+ ```javascript
2649
+ // NEW
2590
2650
  let record = await Table.get(id);
2591
2651
  record = { ...record, property: 'changed' };
2592
2652
  ```
2593
2653
 
2594
- - `getUpdatedTime` and `getExpiresAt` methods remain available on the record object.
2654
+ 4. **Update transaction and context handling**: Harper v5 uses asynchronous context tracking. Context and the current transaction are automatically carried to all calls, including `Table.get`. Code that previously omitted context to escape a transaction must now explicitly commit or start a new transaction.
2655
+ - Import `getContext` and `transaction` from `harper`:
2595
2656
 
2596
- 4. **Update transaction and context handling**: Harper v5 uses asynchronous context tracking. `Table.get` and other table calls now automatically inherit the current transaction context. Code that previously omitted context to bypass a transaction will no longer work as expected. Use `getContext` (imported from `harper`) to access and commit the current transaction explicitly when you need to see updated data.
2657
+ ```javascript
2658
+ import { getContext, transaction } from 'harper';
2659
+ ```
2597
2660
 
2598
- ```javascript
2599
- import { setTimeout as delay } from 'node:timers/promises';
2600
- import { getContext, transaction } from 'harper';
2661
+ - Explicitly commit the current transaction before reading updated data:
2601
2662
 
2602
- class MyResource {
2603
- static async get(target) {
2604
- // Commit the current transaction to read latest data:
2605
- await getContext().transaction.commit();
2606
- // Optionally wrap each poll in a new transaction:
2607
- while ((await transaction(() => Table.get(target))).status !== 'ready') {
2608
- await delay(100);
2609
- }
2610
- return Table.get(target);
2611
- }
2612
- }
2613
- ```
2663
+ ```javascript
2664
+ import { setTimeout as delay } from 'node:timers/promises';
2665
+ import { getContext, transaction } from 'harper';
2666
+ class MyResource {
2667
+ static async get(target) {
2668
+ await getContext().transaction.commit();
2669
+ while ((await transaction(() => Table.get(target))).status !== 'ready') {
2670
+ await delay(100);
2671
+ }
2672
+ return Table.get(target);
2673
+ }
2674
+ }
2675
+ ```
2614
2676
 
2615
- 5. **Register allowed spawn commands via `allowedSpawnCommands`**: Any use of `spawn`, `exec`, or `execFile` from `node:child_process` must reference executables listed in `applications.allowedSpawnCommands` in `harperdb-config.yaml`. Provide a `name` property in the options argument to ensure only a single named process is started across threads.
2677
+ 5. **Register allowed spawn commands via `allowedSpawnCommands`**: Any `spawn` or `execFile` call may only launch executables listed in `applications.allowedSpawnCommands` in `harperdb-config.yaml`. The `exec` function is not usable through the substituted module, and `execSync` always throws. The `spawn`, `execFile`, and `fork` functions also require a `name` property in the `options` argument to prevent process multiplication across threads.
2616
2678
 
2617
2679
  6. **Replace `blob.save()` with `saveBeforeCommit`**: The `blob.save()` method has been removed. Use the `saveBeforeCommit` flag in the options passed to the `Blob` constructor instead.
2618
2680
 
2619
- 7. **Configure the `moduleLoader` and `lockdown` settings**: Harper v5 loads application modules through Node.js's VM module API. Control this behavior in `harperdb-config.yaml` under the `applications` key.
2681
+ 7. **Configure the `moduleLoader` and `lockdown` settings**: Harper v5 loads application modules through Node.js's VM module API. Control all behavior in the `applications` section of `harperdb-config.yaml`:
2620
2682
 
2621
- | Setting | Default | Options |
2622
- | ------------------ | -------------------- | --------------------------------------------------- |
2623
- | `moduleLoader` | `vm-current-context` | `vm-current-context`, `vm`, `native`, `compartment` |
2624
- | `lockdown` | `freeze-after-load` | `freeze-after-load`, `freeze`, `ses`, `none` |
2625
- | `dependencyLoader` | `auto` | `auto`, `app`, `native` |
2626
- | `allowedDirectory` | `app` | `app`, `any` |
2627
- - Use `moduleLoader: native` to disable the VM loader entirely and restore pre-v5 behavior (application-specific context such as tagged logging and per-app `config` will not be available).
2628
- - Use `lockdown: none` as a temporary workaround if a dependency modifies intrinsic prototypes at runtime and throws a `TypeError`.
2683
+ ```yaml
2684
+ applications:
2685
+ lockdown: freeze-after-load # default; see below
2686
+ moduleLoader: vm-current-context # vm-current-context (default) | vm | native | compartment
2687
+ dependencyLoader: auto # auto (default) | app | native
2688
+ allowedDirectory: app # app (default) | any
2689
+ allowedSpawnCommands: # see "Spawning new processes" above
2690
+ - npm
2691
+ - node
2692
+ # allowedBuiltinModules: [] # if omitted, all Node.js built-ins are allowed
2693
+ ```
2694
+
2695
+ **`moduleLoader` options:**
2696
+
2697
+ | Value | Behavior |
2698
+ | -------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
2699
+ | `vm-current-context` | Default. VM loader in Harper's own context; shares intrinsics with Harper for best compatibility. |
2700
+ | `vm` | VM loader in a separate per-application context with its own intrinsics; stronger isolation but can cause `instanceof` failures. |
2701
+ | `native` | Standard Node.js `import()` with no VM loader; application-specific context (tagged logging, per-app `config`) not available. |
2702
+ | `compartment` | SES Compartment-based loading; for specialized sandboxing only. |
2703
+
2704
+ **`lockdown` options:**
2705
+
2706
+ | Value | Behavior |
2707
+ | ------------------- | ------------------------------------------------------------- |
2708
+ | `freeze-after-load` | Default. Freezes intrinsics after all components have loaded. |
2709
+ | `freeze` | Freezes intrinsics before loading any application code. |
2710
+ | `ses` | Full SES lockdown via the `ses` package; strictest. |
2711
+ | `none` | No lockdown. Use as a temporary workaround only. |
2712
+ - To disable the VM loader entirely and restore pre-v5 behavior:
2713
+
2714
+ ```yaml
2715
+ applications:
2716
+ moduleLoader: native
2717
+ ```
2718
+
2719
+ - To restrict which Node.js built-ins are accessible:
2720
+
2721
+ ```yaml
2722
+ applications:
2723
+ allowedBuiltinModules:
2724
+ - fs
2725
+ - path
2726
+ - http
2727
+ ```
2728
+
2729
+ - To allow loading modules from outside the application directory:
2730
+
2731
+ ```yaml
2732
+ applications:
2733
+ allowedDirectory: any
2734
+ ```
2629
2735
 
2630
2736
  #### Examples
2631
2737
 
2632
- ##### Full `harperdb-config.yaml` `applications` block
2738
+ **Full transaction context migration:**
2739
+
2740
+ ```javascript
2741
+ import { setTimeout as delay } from 'node:timers/promises';
2742
+ import { getContext, transaction } from 'harper';
2743
+
2744
+ class MyResource {
2745
+ static async get(target) {
2746
+ // Explicitly commit the transaction to see updated data
2747
+ await getContext().transaction.commit();
2748
+ // Start a new transaction for each get to see the latest data
2749
+ while ((await transaction(() => Table.get(target))).status !== 'ready') {
2750
+ await delay(100);
2751
+ }
2752
+ return Table.get(target);
2753
+ }
2754
+ }
2755
+ ```
2756
+
2757
+ **`Table.get` with `loadedFromSource` check:**
2758
+
2759
+ ```javascript
2760
+ import { tables } from 'harper';
2761
+
2762
+ const target = new RequestTarget();
2763
+ target.id = id;
2764
+ const record = await Table.get(target);
2765
+ if (target.loadedFromSource) {
2766
+ // record was loaded from origin (not cache)
2767
+ }
2768
+ ```
2769
+
2770
+ **Full `harperdb-config.yaml` `applications` block:**
2633
2771
 
2634
2772
  ```yaml
2635
2773
  applications:
@@ -2642,38 +2780,14 @@ applications:
2642
2780
  - node
2643
2781
  ```
2644
2782
 
2645
- ##### Restricting allowed built-in modules
2646
-
2647
- ```yaml
2648
- applications:
2649
- allowedBuiltinModules:
2650
- - fs
2651
- - path
2652
- - http
2653
- ```
2654
-
2655
- ##### Disabling the VM loader for package compatibility
2656
-
2657
- ```yaml
2658
- applications:
2659
- moduleLoader: native
2660
- ```
2661
-
2662
- ##### Accessing context and committing a transaction
2663
-
2664
- ```javascript
2665
- import { getContext } from 'harper';
2666
-
2667
- await getContext().transaction.commit();
2668
- ```
2669
-
2670
2783
  #### Notes
2671
2784
 
2672
- - The `lockdown: freeze-after-load` default freezes `Object`, `Array`, `Promise`, `Map`, `Set`, and other intrinsics after all application code loads. Any code or dependency that mutates intrinsic prototypes after startup will throw a `TypeError`.
2673
- - Under `lockdown: ses`, the constrained `fetch` (https-only) is applied only in `vm` mode. In `vm-current-context` and `native` modes, application code uses the standard global `fetch`.
2674
- - In production, `allowedDirectory: app` prevents loading modules from outside the application's own directory tree. Set `allowedDirectory: any` only if your application legitimately requires it.
2675
- - `dependencyLoader: native` is a narrower alternative to `moduleLoader: native` — it uses native loading only for npm packages while keeping the VM loader for first-party application source files.
2676
- - Access Harper functions and APIs through the `harper` package rather than through global variables. Use `getContext` from `harper` to access request context without passing it explicitly through every call.
2785
+ - Use `getContext` (imported from `harper`) to access the current transaction anywhere in application code without passing context explicitly through every call.
2786
+ - Harper functions and APIs should be accessed through the `harper` package rather than through global variables.
2787
+ - Use `static` methods on Resources/Tables to implement endpoints, and access request information from the request `target` argument or via `getContext`.
2788
+ - `lockdown: none` is only a temporary workaround for dependencies that mutate intrinsic prototypes at runtime; do not leave it set in production.
2789
+ - Under `lockdown: ses`, the constrained (https-only) `fetch` is applied only in `vm` mode. In `vm-current-context` and `native` modes, application code uses the standard global `fetch`.
2790
+ - In production, `allowedDirectory: app` is the default; dev mode installs default to `allowedDirectory: any`.
2677
2791
 
2678
2792
  ### 4.8 Delegating to the Built-in Agent
2679
2793