@relyio/sdk 0.10.0 → 0.11.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,52 @@
1
1
  # @relyio/sdk
2
2
 
3
+ ## 0.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 84f4acb: **A `dateTime` field reads back in UTC.** A `dateTime` is stored as its instant in UTC at millisecond precision, whatever offset it was written in, and every read returns it that way: write `2026-09-30T23:30:00-05:00` and you read back `2026-10-01T04:30:00.000Z`. The offset you sent is not kept. A `date` field is unchanged: `YYYY-MM-DD`.
8
+
9
+ Comparing two values is now comparing two instants, and a `where` on a date field compares the way you would expect across offsets:
10
+
11
+ - `{ dried: { $lt: '2026-10-01' } }` keeps the instants before the UTC day of 1 October. It used to compare text, so `2026-09-30T23:30:00-05:00` — which is 04:30 UTC on the 1st — was listed.
12
+ - A day compares with an instant's UTC day: `{ dried: { $lte: '2026-10-01' } }` keeps every instant of that day, and `{ dried: '2026-10-01' }` matches any of them.
13
+ - An instant you compare with is read with its offset: `{ dried: { $gte: '2026-10-01T06:30:00+02:00' } }` is 04:30 UTC.
14
+ - `$inTheLast` and `$inTheNext` on a `dateTime` or `date` field match, counted in UTC from the moment of the read. They matched nothing before.
15
+
16
+ A value that names no date — a word, or a time with no offset such as `2026-10-01T10:00` — is refused with `400 REQUEST_INVALID`, as is `$inTheLast` on a field that holds no date. If you compared a stored `dateTime` with the text you wrote, compare instants instead:
17
+
18
+ ```ts
19
+ const sameInstant = Date.parse(entry.dried) === Date.parse('2026-09-30T23:30:00-05:00')
20
+ ```
21
+
22
+ - 8c5b215: **A change to shared fields is reported as `hasDraft`, not as the default locale's draft.** A read's `_metadata` reports unpublished work in two kinds, apart: `draftLocales` names the locales with unpublished edits of their own, and `hasDraft` says the shared (non-localized) fields have unpublished changes. Publishing any locale makes a shared change live, so it is pending in every locale, and no locale code is listed for it.
23
+
24
+ `draftLocales` used to list the default locale's code for a shared-field draft. It no longer does: an entry whose only pending change is a shared field now reads `draftLocales: []` with `hasDraft: true`, in every locale you read it in. A locale has unpublished work when `draftLocales` names it or `hasDraft` is `true`:
25
+
26
+ ```ts
27
+ const { draftLocales, hasDraft } = entry._metadata
28
+ const frenchHasPendingWork = hasDraft || draftLocales.includes('fr')
29
+ ```
30
+
31
+ A settings group's `_metadata` — on `GET /v1/settings/{groupId}` and on each written group of `GET /v1/settings` — now carries `hasDraft` too, as an entry's, a singleton's and a search hit's already did, and so does each entry a query returns. `LocalePublicationFields` includes it.
32
+
33
+ - 4614003: **A view filter names its field as the Studio's entry list does.** A field your schema declares is `fields.<id>` — `fields.featured`, `fields.seo.title` for a component's sub-field — and a system field is `_metadata.<id>`: `_metadata.status`, `_metadata.createdAt`, `_metadata.updatedAt`, the name the Content API already gives those values in an entry's `_metadata`. A field called `status` and the entry's own lifecycle are now both filterable on one schema, where deploy used to refuse a filter on either:
34
+
35
+ ```ts
36
+ defineView('openTickets', {
37
+ name: 'Open tickets',
38
+ scope: { type: 'contentType', contentType: 'ticket' },
39
+ filters: [
40
+ { field: 'fields.status', operator: 'is', value: 'open' },
41
+ { field: '_metadata.status', operator: 'is', value: 'active' },
42
+ ],
43
+ })
44
+ ```
45
+
46
+ A filter on a bare field id — `{ field: 'featured', … }` — is refused at `relyio deploy` and `relyio status` as a field the view's entries cannot be filtered by, at `views.<n>.filters.<n>.field`. Write `fields.featured`. A YAML schema's `views[].filters` take the same names.
47
+
48
+ **A view's `sort` names its field the same way**, because the Studio puts a view's order in the entries read beside its filters: `sort: { field: '_metadata.updatedAt', direction: 'desc' }`, or `fields.title`. Deploy now refuses a sort whose field is a bare id, or one the view's entries cannot be sorted by (a long text, for example), at `views.<n>.sort.field`. A view's `columns` and `metadataFields` are display settings and still name field ids as written.
49
+
3
50
  ## 0.10.0
4
51
 
5
52
  ### Minor Changes