@lemonadecms/client 0.2.1 → 0.2.3
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 +12 -0
- package/README.md +71 -11
- package/package.json +1 -9
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.2.3
|
|
6
|
+
|
|
7
|
+
- Remove the private CMS repository and Issues metadata from the public package.
|
|
8
|
+
Replace npm README GitHub links with public Lemonade documentation. No SDK,
|
|
9
|
+
CLI, declaration or dependency changes from 0.2.2.
|
|
10
|
+
|
|
11
|
+
## 0.2.2
|
|
12
|
+
|
|
13
|
+
- Correct the npm-specific README with global/collection defaults, direct
|
|
14
|
+
reference-ID filtering, authorization limits and accurate 0.2.1 feature
|
|
15
|
+
availability. No SDK runtime, CLI or dependency changes from 0.2.1.
|
|
16
|
+
|
|
5
17
|
## 0.2.1
|
|
6
18
|
|
|
7
19
|
- Filter top-level Reference fields by linked entry UUID with eq/ne/in/not_in,
|
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ runtime library or framework dependency is required.
|
|
|
30
30
|
|
|
31
31
|
## Configure and read content
|
|
32
32
|
|
|
33
|
-
Version 0.2.0 connects to `https://api.lemonadecms.com` automatically. Strict hostname routing returns 404 for API URLs on `https://lemonadecms.com`. Upgrade earlier clients to 0.2.
|
|
33
|
+
Version 0.2.0 connects to `https://api.lemonadecms.com` automatically. Strict hostname routing returns 404 for API URLs on `https://lemonadecms.com`. Upgrade earlier clients to 0.2.3 and change explicit CLI/configured-target URLs to `https://api.lemonadecms.com`. Explicit CLI settings still take precedence; no redirect or fallback is attempted. Configure your
|
|
34
34
|
workspace and delivery key; there is no URL or local CMS option. Your website
|
|
35
35
|
can run locally while reading content from Lemonade production. Installing the
|
|
36
36
|
package does not create an account, workspace or delivery key.
|
|
@@ -85,6 +85,64 @@ environment override. Ask your Owner for a credential belonging to the intended
|
|
|
85
85
|
environment. The server rechecks current access, expiry and revocation on every
|
|
86
86
|
request.
|
|
87
87
|
|
|
88
|
+
## Global and collection defaults (0.2.1+)
|
|
89
|
+
|
|
90
|
+
Use `defaults` for shared locale, limit, filters, sort, includeRemote and maxPages.
|
|
91
|
+
Use `collections` for typed per-model settings. Request values override collection
|
|
92
|
+
values, then global values. Global, collection and request filters combine with
|
|
93
|
+
AND; `filters: []` does not remove configured predicates. Configuration is copied
|
|
94
|
+
at client construction. No schema fetch, retry or runtime dependency is added.
|
|
95
|
+
|
|
96
|
+
The example assumes generated `article` and `product` models, each with a top-level
|
|
97
|
+
Reference field named `tenant`. Filter directly by the linked entry UUID; a
|
|
98
|
+
separate `tenant_id` text field is unnecessary. Regenerate your model types after
|
|
99
|
+
adding the relation. Relation predicates require the matching CMS backend.
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
import { createCMSClient } from '@lemonadecms/client';
|
|
103
|
+
import type { Models } from './cms-models';
|
|
104
|
+
|
|
105
|
+
type TenantContent = Pick<Models, 'article' | 'product'>;
|
|
106
|
+
const tenantId = 'YOUR_TENANT_ENTRY_UUID';
|
|
107
|
+
const cms = createCMSClient<TenantContent>({
|
|
108
|
+
projectId: 'YOUR_WORKSPACE_UUID',
|
|
109
|
+
publicKey: 'YOUR_PUBLIC_DELIVERY_KEY',
|
|
110
|
+
defaults: {
|
|
111
|
+
locale: 'en',
|
|
112
|
+
limit: 25,
|
|
113
|
+
filters: [{ field: 'tenant', op: 'eq', value: tenantId }],
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
const articles = await cms.content('article').list({ limit: 10 });
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
`tenantId` must come from your application's intended tenant entry UUID. Global
|
|
120
|
+
fields must exist on every queried model; use collection defaults when only some
|
|
121
|
+
models have the relation. Use another client for the tenant directory itself.
|
|
122
|
+
|
|
123
|
+
| Field | Operators | Values |
|
|
124
|
+
| --- | --- | --- |
|
|
125
|
+
| Reference | `eq`, `ne` | Linked entry UUID or `null` |
|
|
126
|
+
| Reference | `in`, `not_in` | 1–100 UUIDs |
|
|
127
|
+
| References | `contains_any`, `contains_all` | 1–100 unique UUIDs |
|
|
128
|
+
|
|
129
|
+
IDs are compared case-insensitively in the requested published or saved-draft
|
|
130
|
+
snapshot. These filters do not fetch or traverse target fields. Both source and
|
|
131
|
+
target models must be accessible in the requested language. Dotted `tenant.id`,
|
|
132
|
+
nested relations, reverse-list predicates and relation sorting are unsupported.
|
|
133
|
+
Existing ten-leaf, depth-four, 31-node and 4 KiB filter limits still apply.
|
|
134
|
+
|
|
135
|
+
Defaults are query conveniences, **not tenant authorization**. `get()`/`getMany()`
|
|
136
|
+
inherit locale/includeRemote only and do not inherit filters. Reference expansion
|
|
137
|
+
is not constrained by defaults. A shared public key can read every record it
|
|
138
|
+
permits. Use separate workspace credentials for hard isolation, or trusted server
|
|
139
|
+
authorization for every entry and referenced resource. Never rely on a caller's
|
|
140
|
+
unverified tenant ID as authorization.
|
|
141
|
+
|
|
142
|
+
Statistics inherit locale/filters; `findOne()` keeps limit 1. Related reads inherit
|
|
143
|
+
global defaults only, never the parent collection's settings. Traversal snapshots
|
|
144
|
+
its effective query and honors maxPages (default 1,000; maximum 10,000).
|
|
145
|
+
|
|
88
146
|
## Find one entry
|
|
89
147
|
|
|
90
148
|
In the updated source build, `findOne()` returns the first matching complete
|
|
@@ -202,14 +260,14 @@ resources. Unavailable embeds are omitted; entry routes are never invented.
|
|
|
202
260
|
Plain text retains authored text with block/list/hard-break newlines. Plain text
|
|
203
261
|
is not escaped HTML: use text interpolation.
|
|
204
262
|
|
|
205
|
-
|
|
263
|
+
SDK 0.2.1 and later support opt-in v2 quotations, escaped code blocks, accessible
|
|
206
264
|
rectangular tables and external-media cards. Configure the field's
|
|
207
265
|
`document_version: 2` and enabled features, then set `richTextVersion: 2` on the
|
|
208
266
|
published or server preview client. This explicitly sends
|
|
209
267
|
`Lemonade-Accept-Content: rich-text.v2`; default reads remain v1. The updated type
|
|
210
268
|
generator requests `relationships.v1,rich-text.v2,unique-identifiers.v1` schema extensions.
|
|
211
|
-
These additions require the updated backend
|
|
212
|
-
0.2.
|
|
269
|
+
These additions require the updated backend and website renderer, together with
|
|
270
|
+
SDK 0.2.1 or later. Earlier packages do not contain these advanced formats.
|
|
213
271
|
|
|
214
272
|
External-media HTML stays static: no iframe, autoplay or provider request is
|
|
215
273
|
created by these helpers. `externalMediaDescriptor(node)` returns validated,
|
|
@@ -314,7 +372,6 @@ fetch client.
|
|
|
314
372
|
- [Getting started](https://lemonadecms.com/guides)
|
|
315
373
|
- [SDK reference and examples](https://lemonadecms.com/guides/sdk)
|
|
316
374
|
- [Troubleshooting](https://lemonadecms.com/guides/troubleshooting)
|
|
317
|
-
- [Repository](https://github.com/ilara-booqself/lemonadecms)
|
|
318
375
|
|
|
319
376
|
## License
|
|
320
377
|
|
|
@@ -332,21 +389,24 @@ each language keeps its live tree until explicitly published. Existing form and
|
|
|
332
389
|
saved-draft previews remain supported. The browser helper is the dependency-free
|
|
333
390
|
`@lemonadecms/client/composer` export.
|
|
334
391
|
|
|
335
|
-
|
|
392
|
+
For credential handling and the saved-draft workflow, see
|
|
393
|
+
[server preview](https://lemonadecms.com/guides/sdk#preview) and
|
|
394
|
+
[website preview](https://lemonadecms.com/guides/editing#editing-site-preview).
|
|
336
395
|
|
|
337
396
|
|
|
338
|
-
##
|
|
397
|
+
## Reverse relationships (0.2.1+)
|
|
339
398
|
|
|
340
|
-
|
|
399
|
+
SDK 0.2.1 adds opt-in rich-text v2 (described above) and on-demand
|
|
341
400
|
reverse collections through
|
|
342
401
|
`cms.content('author').related(authorId, 'articles', {limit: 10})`. Updated
|
|
343
402
|
`lemonade types generate` negotiates the relationship extension and generates a
|
|
344
403
|
separate `Relationships` map for `createCMSClient<Models, Relationships>`.
|
|
345
404
|
Ordinary entries and `fields` retain their shape. This requires the updated
|
|
346
|
-
backend and
|
|
347
|
-
|
|
405
|
+
backend and SDK 0.2.1 or later. Installing npm does not deploy the backend.
|
|
406
|
+
The SDK retains zero runtime dependencies.
|
|
348
407
|
|
|
349
408
|
Management migrations configuring a reverse list need both source and target
|
|
350
409
|
model keys and actions in the management credential, independently of the
|
|
351
410
|
actor's grants. Existing targets require `model.update`; targets created in the
|
|
352
|
-
same migration require `model.create`. See the
|
|
411
|
+
same migration require `model.create`. See the
|
|
412
|
+
[reviewed migration workflow](https://lemonadecms.com/guides/operations#operations-cli).
|
package/package.json
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lemonadecms/client",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Framework-independent content delivery and developer tooling for Lemonade CMS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://lemonadecms.com/guides/sdk",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "https://github.com/ilara-booqself/lemonadecms.git",
|
|
10
|
-
"directory": "packages/cms-client"
|
|
11
|
-
},
|
|
12
|
-
"bugs": {
|
|
13
|
-
"url": "https://github.com/ilara-booqself/lemonadecms/issues"
|
|
14
|
-
},
|
|
15
7
|
"publishConfig": {
|
|
16
8
|
"access": "public",
|
|
17
9
|
"registry": "https://registry.npmjs.org/"
|