arcane-os 0.31.0 → 0.32.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.32.0
4
+
5
+ - Export `profileUpdateFromSearchParams(searchParams)` from
6
+ `arcane-os/entities/User.js` for purchase-link profile updates. It maps
7
+ `subscription` (otherwise `subscription_key`), exact `TWiN`, `name`, `email`,
8
+ and `phone` to the existing User profile fields and omits empty or missing
9
+ selected values. A present `subscription` takes precedence even when empty.
10
+ - Preserve normal `URLSearchParams` decoding, first repeated values, Unicode,
11
+ spaces, literal plus signs and leading zeros without further conversion.
12
+ Ignore `zipcode` and unrelated keys. The helper neither mutates the URL nor
13
+ saves; apps retain hydration, draft protection and `updateExplicit` ownership.
14
+ - Keep the standalone root/direct npm path behavior released in `0.31.0` and
15
+ all existing User setters, persistence and browser singleton lifecycle.
16
+
3
17
  ## 0.31.0
4
18
 
5
19
  - Standalone applications use their repository root and installed npm package
package/README.md CHANGED
@@ -19,7 +19,7 @@ version-locked SDK runtime, while an integrated Arcane checkout uses its live
19
19
  `arcane/` runtime. Both profiles share the theme, packaging, event, cancellation,
20
20
  and browser run contracts while retaining their selected application layout.
21
21
 
22
- This checkout defines the `0.31.0` SDK contract. Applications pin one exact npm
22
+ This checkout defines the `0.32.0` SDK contract. Applications pin one exact npm
23
23
  version and lockfile; registry state is deliberately not baked into application
24
24
  artifacts.
25
25
 
@@ -85,7 +85,7 @@ Create one browser application, install its pinned SDK, and start its source
85
85
  server:
86
86
 
87
87
  ```bash
88
- npx arcane-os@0.31.0 new hello-speech --path ./hello-speech --target browser
88
+ npx arcane-os@0.32.0 new hello-speech --path ./hello-speech --target browser
89
89
  cd hello-speech
90
90
  npm install
91
91
  ```
@@ -5,7 +5,7 @@
5
5
  "bundleVersion": "0.8.12"
6
6
  },
7
7
  "moduleCount": 14,
8
- "exportCount": 29,
8
+ "exportCount": 30,
9
9
  "modules": [
10
10
  {"file":"runtime/arcane/entities/ApiModelRecord.js","exports":["default"],"availability":"cross-host","normalization":"normalized"},
11
11
  {"file":"runtime/arcane/entities/Calculation.js","exports":["default"],"availability":"cross-host","normalization":"normalized"},
@@ -19,7 +19,7 @@
19
19
  {"file":"runtime/arcane/entities/Preference.js","exports":["default","preferenceSchema"],"availability":"cross-host","normalization":"normalized"},
20
20
  {"file":"runtime/arcane/entities/TerminalSession.js","exports":["default","terminalShells"],"availability":"cross-host","normalization":"normalized"},
21
21
  {"file":"runtime/arcane/entities/Theme.js","exports":["arcaneDarkThemeTokens","arcaneLightThemeTokens","default","themeColorToHex","themeTokens"],"availability":"cross-host/dom-when-applied","normalization":"normalized/mixed"},
22
- {"file":"runtime/arcane/entities/User.js","exports":["default"],"availability":"browser/native-webview","normalization":"mixed"},
22
+ {"file":"runtime/arcane/entities/User.js","exports":["default","profileUpdateFromSearchParams"],"availability":"browser/native-webview","normalization":"Existing User lifecycle is unchanged; profileUpdateFromSearchParams purely maps nonempty supplied URLSearchParams values without further decoding, trimming, or persistence."},
23
23
  {"file":"runtime/arcane/entities/Weather.js","exports":["WeatherDay","WeatherLocation","WeatherObservation","WeatherSnapshot"],"availability":"cross-host","normalization":"normalized"}
24
24
  ]
25
25
  }
@@ -1,9 +1,11 @@
1
1
  # Arcane runtime entity modules
2
2
 
3
- The synchronized runtime ships 14 entity modules with 29 public ESM bindings.
3
+ The synchronized runtime ships 14 entity modules with 30 public ESM bindings.
4
4
  This page explains each module's capability and host assumptions. The exact
5
5
  constructor/function/value contracts are canonical in the
6
- [Arcane shared entity inventory](core/arcane-entities.md).
6
+ [Arcane shared entity inventory](core/arcane-entities.md), with later SDK
7
+ additions documented below and in the current
8
+ [runtime entity inventory](inventory/runtime-entities.json).
7
9
 
8
10
  Entity creation and serialization are usually cross-host. Methods that touch
9
11
  DOM, DBOPFS, local storage, AI, or object URLs require the corresponding browser
@@ -25,7 +27,7 @@ or native-WebView dependency.
25
27
  | `Preference.js` | `default`, `preferenceSchema` | Boolean, number, select, and text preference definitions. | Cross-host; normalized. |
26
28
  | `TerminalSession.js` | `default`, `terminalShells` | Frozen terminal session identity, shell, and state. | Cross-host; normalized. |
27
29
  | `Theme.js` | five exports | Semantic theme tokens, conversion, serialization, and DOM application. | Values cross-host; apply/clear need DOM; normalized/mixed. |
28
- | `User.js` | `default` | User preferences/profile state with DBLS/DBOPFS lifecycle. | Browser/native WebView; storage behavior mixed. |
30
+ | `User.js` | `default`, `profileUpdateFromSearchParams` | User preferences/profile state and pure URL-query profile mapping. | Browser/native WebView module; mapping itself has no side effects. |
29
31
  | `Weather.js` | four classes | Frozen location, observation, day, and snapshot weather entities. | Cross-host; normalized. |
30
32
 
31
33
  ## ApiModelRecord.js
@@ -272,12 +274,41 @@ Owns persisted user preference/profile fields, explicit-preference updates,
272
274
  fresh reads, saves, and JSON projection. It installs `window.user` after its
273
275
  DBLS/DBOPFS lifecycle and emits `user-entity-loaded`.
274
276
 
277
+ ### profileUpdateFromSearchParams(searchParams)
278
+
279
+ Named export from `arcane-os/entities/User.js`. Pass an existing
280
+ `URLSearchParams`; the helper returns a new ordinary profile-update record.
281
+
282
+ | Query parameter | Profile field |
283
+ | --- | --- |
284
+ | `subscription`, otherwise `subscription_key` | `subscription_key` |
285
+ | `TWiN` (exact case) | `license_key` |
286
+ | `name` | `username` |
287
+ | `email` | `email` |
288
+ | `phone` | `phone` |
289
+
290
+ Presence selects `subscription` over the fallback, even when its first value
291
+ is empty. Missing or empty selected values are omitted. Repeated parameters
292
+ use their first value, following `URLSearchParams.get()`. Normal URL decoding
293
+ occurs once when the caller creates the parameters; the helper preserves the
294
+ decoded strings, including spaces, Unicode, literal plus signs, and leading
295
+ zeros, without trimming, further decoding, or numeric conversion. Whitespace
296
+ is a supplied nonempty value. Unknown keys, including `zipcode`, are ignored;
297
+ no extra name fields are inferred.
298
+
299
+ The helper does not mutate the parameters, read or change the current URL,
300
+ hydrate, render, or save. Importing `User.js` still has its existing browser
301
+ singleton lifecycle. Applications own URL capture/removal, manual-draft
302
+ protection, readiness, and their awaited `user.updateExplicit(update)` call.
303
+
275
304
  ### Example
276
305
 
277
306
  ```javascript
278
- import UserEntity from '/arcane/entities/User.js';
307
+ import {profileUpdateFromSearchParams} from 'arcane-os/entities/User.js';
279
308
 
280
- console.log(typeof UserEntity.prototype.toJSON);
309
+ const params = new URLSearchParams('name=Captain+Moonboots&phone=00123');
310
+ const update = profileUpdateFromSearchParams(params);
311
+ // {username: 'Captain Moonboots', phone: '00123'}
281
312
  ```
282
313
 
283
314
  ## Weather.js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arcane-os",
3
- "version": "0.31.0",
3
+ "version": "0.32.0",
4
4
  "description": "Arcane OS JavaScript SDK, project-local CLI, browser runtime, and repository-portable application packager.",
5
5
  "type": "module",
6
6
  "main": "./src/index.mjs",
@@ -25,6 +25,34 @@ import {
25
25
  */
26
26
  import DBOPFS from '../modules/DBOPFS.js';
27
27
 
28
+ /**
29
+ * Maps supplied URL query values to an explicit profile update without saving.
30
+ * URLSearchParams owns decoding; preserve its first value exactly as returned.
31
+ * A present subscription, even empty, takes precedence over subscription_key.
32
+ *
33
+ * @param {URLSearchParams} searchParams
34
+ * @returns {Object<string,string>}
35
+ */
36
+ export function profileUpdateFromSearchParams(searchParams){
37
+ const update={
38
+ subscription_key:searchParams.get(
39
+ searchParams.has('subscription')?'subscription':'subscription_key'
40
+ ),
41
+ license_key:searchParams.get('TWiN'),
42
+ username:searchParams.get('name'),
43
+ email:searchParams.get('email'),
44
+ phone:searchParams.get('phone')
45
+ };
46
+
47
+ for(const key of Object.keys(update)){
48
+ if(update[key]===null||update[key]===''){
49
+ delete update[key];
50
+ }
51
+ }
52
+
53
+ return update;
54
+ }
55
+
28
56
  function createDefaultDashboard(){
29
57
  return { charts:{} };
30
58
  }