@mosaicast/plugin-sdk 0.6.0 → 0.7.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/README.md +76 -6
- package/dist/index.d.ts +242 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/testing.d.ts +72 -5
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +137 -6
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,8 +31,8 @@ The contract version is a **single SemVer anchor** mirrored in four places that
|
|
|
31
31
|
(CI enforces it): `build.gradle.kts` · `package.json` · `PlatformApi.VERSION` · `PLATFORM_API_VERSION`.
|
|
32
32
|
|
|
33
33
|
**How the host matches it:** core compares `major.minor` **exactly**. A plugin declaring `0.3.x` is
|
|
34
|
-
rejected the moment the host runs `0.
|
|
35
|
-
is pre-1.0 a breaking change is therefore a **minor** bump (`0.
|
|
34
|
+
rejected the moment the host runs `0.7.0` — with the reason shown in the admin log viewer. While the SDK
|
|
35
|
+
is pre-1.0 a breaking change is therefore a **minor** bump (`0.6.0` → `0.7.0`), not a major one; from
|
|
36
36
|
`1.0.0` on, normal SemVer applies and breaking means major.
|
|
37
37
|
|
|
38
38
|
## Build & test
|
|
@@ -49,8 +49,8 @@ npm ci && npm run build # TypeScript: src → dist (.js + .d.ts)
|
|
|
49
49
|
- Released: from **GitHub Packages** (see below).
|
|
50
50
|
```kotlin
|
|
51
51
|
dependencies {
|
|
52
|
-
compileOnly("dev.mosaicast:plugin-api:0.
|
|
53
|
-
testImplementation("dev.mosaicast:plugin-testkit:0.
|
|
52
|
+
compileOnly("dev.mosaicast:plugin-api:0.7.0") // contract, provided by the host
|
|
53
|
+
testImplementation("dev.mosaicast:plugin-testkit:0.7.0") // test doubles only
|
|
54
54
|
}
|
|
55
55
|
```
|
|
56
56
|
Sources + Javadoc JARs give IDE hover docs automatically.
|
|
@@ -79,7 +79,7 @@ This is the part plugin authors most often guess wrong, so it is stated plainly.
|
|
|
79
79
|
|
|
80
80
|
**Backend.** A plugin persists *everything* through `ctx.store()` — the hard-scoped `DocStore`, addressed by `(Scope, key)` — and does any aggregation in `ctx.onSchedule(...)`. (The only alternative is a relational schema *declared in the manifest* and reached via `ctx.schema()`; still not a route.)
|
|
81
81
|
|
|
82
|
-
**Frontend.** A Web Component reaches plugin data through `ctx.api` (`PluginApiClient`).
|
|
82
|
+
**Frontend.** A Web Component reaches plugin data through `ctx.api` (`PluginApiClient`), or — for a plugin that declares a relational schema — through `ctx.schema` (see [below](#relational-storage--ctxschema-since-040-frontend-since-070)). Neither hits plugin-authored routes: both hit fixed, generic surfaces the **host** exposes, namespaced per plugin. `ctx.api` mirrors `DocStore` one-to-one — `get` / `put` / `list` / `delete`, and no more:
|
|
83
83
|
|
|
84
84
|
```text
|
|
85
85
|
GET /api/plugins/{id}/data/{scopeType}/{scopeId}/{key}
|
|
@@ -164,7 +164,7 @@ If your backend authors a key, **declare it**:
|
|
|
164
164
|
|
|
165
165
|
> Roadmap: custom plugin-defined server routes may arrive in a later `platformApi` version; plugins use the doc store.
|
|
166
166
|
|
|
167
|
-
## Relational storage — `ctx.schema
|
|
167
|
+
## Relational storage — `ctx.schema` (since 0.4.0; frontend since 0.7.0)
|
|
168
168
|
|
|
169
169
|
The doc store is the default and covers nearly everything. Declare a **schema** when you need what a JSON
|
|
170
170
|
document cannot give you: full-text search, revisions, backlinks. Any plugin may; most declare nothing.
|
|
@@ -211,6 +211,76 @@ Test it with `FakeSchemaStore`, declaring the same entities your manifest does.
|
|
|
211
211
|
substring match, **not** Postgres full-text: no stemming, no ranking. Assert on which rows come back, not
|
|
212
212
|
on their order.
|
|
213
213
|
|
|
214
|
+
### From the frontend — `ctx.schema` (since 0.7.0)
|
|
215
|
+
|
|
216
|
+
Provisioning without access was half a feature: the search box lives in the browser. `ctx.schema` is the
|
|
217
|
+
frontend counterpart, and it is **`null`** unless the manifest declares a schema — the same shape as the
|
|
218
|
+
Java call, so a doc-store plugin gets `null` rather than a client that 404s on everything.
|
|
219
|
+
|
|
220
|
+
```ts
|
|
221
|
+
if (!ctx.schema) return; // doc-store plugin: nothing to query
|
|
222
|
+
|
|
223
|
+
interface Page { id: number; slug: string; title: string; markdown: string; updatedAt: string }
|
|
224
|
+
|
|
225
|
+
const hits = await ctx.schema.search<Page>('page', 'markdown', term, {
|
|
226
|
+
where: [{ field: 'published', op: 'eq', value: true }],
|
|
227
|
+
orderBy: [{ field: 'updatedAt', direction: 'desc' }],
|
|
228
|
+
size: 20,
|
|
229
|
+
}); // → { items, page, size, totalElements, totalPages }
|
|
230
|
+
|
|
231
|
+
const one = await ctx.schema.find<Page>('page', 42); // null when there is no such row
|
|
232
|
+
const n = await ctx.schema.count('page');
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
| Operation | Backend (Java) | Frontend (TS) |
|
|
236
|
+
|---|---|---|
|
|
237
|
+
| rows by criteria | `schema.select(entity, criteria, T.class)` | `ctx.schema.select<T>(entity, query)` |
|
|
238
|
+
| full-text | `schema.search(entity, field, text, criteria, T.class)` | `ctx.schema.search<T>(entity, field, text, query)` |
|
|
239
|
+
| one by id | `schema.find(entity, id, T.class)` → `Optional<T>` | `ctx.schema.find<T>(entity, id)` → `T \| null` |
|
|
240
|
+
| how many | `schema.count(entity, criteria)` | `ctx.schema.count(entity, query)` |
|
|
241
|
+
|
|
242
|
+
- A `SchemaQuery` describes the same thing `Criteria` does — declared field names, an op from a closed
|
|
243
|
+
vocabulary, values bound by the host — with `page`/`size` instead of `limit`/`offset` because it crosses
|
|
244
|
+
HTTP (`page` from 0, `size` 50 by default, capped at 200).
|
|
245
|
+
- **Reads only.** There is no write half, deliberately: a v1 plugin authors no HTTP routes, so no plugin
|
|
246
|
+
code runs at request time to enforce slug uniqueness or append a revision atomically. Your backend stays
|
|
247
|
+
the only writer — a frontend that must write puts a document in the doc store and the backend ingests it
|
|
248
|
+
on its schedule, which makes such a write eventually consistent.
|
|
249
|
+
- An undeclared entity is a 404, an undeclared field or a `search` on a field that is not `:fulltext` a
|
|
250
|
+
400. Access is the same `data.readableBy` floor as the doc surface — one rule, both surfaces.
|
|
251
|
+
|
|
252
|
+
Test it with `makeMockSchema({ page: [...] })` from `/testing`, which records every query. Its `search` is
|
|
253
|
+
a substring match with the same caveat as `FakeSchemaStore`'s.
|
|
254
|
+
|
|
255
|
+
## Deep links & navigation — `ctx.route` (navigate since 0.7.0)
|
|
256
|
+
|
|
257
|
+
A plugin declaring a `page` slot owns the URL subtree `/p/<pluginId>/*`. The host hands it the subpath
|
|
258
|
+
below that prefix as `ctx.route.path`, which is what makes plugin content linkable and shareable at all.
|
|
259
|
+
|
|
260
|
+
```ts
|
|
261
|
+
const slug = ctx.route.path || 'index'; // '' when not rendered as a page
|
|
262
|
+
|
|
263
|
+
link.addEventListener('click', (e) => {
|
|
264
|
+
e.preventDefault();
|
|
265
|
+
ctx.route.navigate(`glossary/${target}`); // → /p/wiki/glossary/<target>
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
ctx.route.navigate('index', { replace: true }); // no back-button step (tab/filter state)
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
- `navigate` is **SPA navigation**: a history entry, a working back button, and no re-fetch of the shell or
|
|
272
|
+
of any plugin bundle. An `<a href>` to your own page is a full document load, which on a densely
|
|
273
|
+
cross-linked page set is the common path, not an edge case.
|
|
274
|
+
- `subpath` is relative to `/p/<pluginId>/`, the same coordinate `path` gives you. The host prefixes your
|
|
275
|
+
namespace and drops any attempt to climb out of it, so another plugin's route or a core one is not
|
|
276
|
+
blocked so much as **unnameable** — the same property `ctx.schema` has.
|
|
277
|
+
- Keep the real `href` on your anchors. Middle-click, "open in new tab" and crawlers need it; `navigate`
|
|
278
|
+
only takes over the plain-click path.
|
|
279
|
+
- **Do not reach past this handle.** `history.pushState` plus a synthetic `popstate` happens to work
|
|
280
|
+
against the host's current router and is not part of the contract.
|
|
281
|
+
- Pair it with `ShareMetadataProvider` (OpenGraph per subpath) and `SitemapProvider` on the backend so the
|
|
282
|
+
URLs you navigate to also preview and index properly.
|
|
283
|
+
|
|
214
284
|
## Logging — `ctx.logger()` / `ctx.log()` (since 0.4.0)
|
|
215
285
|
|
|
216
286
|
```java
|
package/dist/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* rejects a mismatch at startup (ARCHITECTURE §7.2). While the SDK is pre-1.0 a breaking change is
|
|
18
18
|
* therefore a *minor* bump; from `1.0.0` on, breaking means major.
|
|
19
19
|
*/
|
|
20
|
-
export declare const PLATFORM_API_VERSION: '0.
|
|
20
|
+
export declare const PLATFORM_API_VERSION: '0.7.0';
|
|
21
21
|
/** A user's role (ARCHITECTURE §8.5). Anonymous visitors have no role (`user` is `null`). */
|
|
22
22
|
export type Role = 'admin' | 'podcaster' | 'fan';
|
|
23
23
|
/**
|
|
@@ -159,7 +159,11 @@ export interface PagedDocs<T = unknown> {
|
|
|
159
159
|
* **These are not plugin-authored routes.** A v1 plugin cannot declare HTTP endpoints — its server side
|
|
160
160
|
* is `register(ctx)` and nothing else (see the Java `PluginBackend`). What this client talks to is a
|
|
161
161
|
* fixed, generic surface the host exposes over the plugin's hard-scoped doc store, mirroring the Java
|
|
162
|
-
* `DocStore` one-to-one — get / put / list / delete, nothing more
|
|
162
|
+
* `DocStore` one-to-one — get / put / list / delete, nothing more.
|
|
163
|
+
*
|
|
164
|
+
* A plugin that declares `storage.schema` reads its provisioned tables through {@link SchemaClient}
|
|
165
|
+
* (`ctx.schema`), a second host surface with its own paths and its own rules — read-only, since writing
|
|
166
|
+
* those tables stays with the plugin's backend. This client is the doc store's:
|
|
163
167
|
*
|
|
164
168
|
* ```text
|
|
165
169
|
* GET /api/plugins/{id}/data/{scopeType}/{scopeId}/{key}
|
|
@@ -264,6 +268,228 @@ export interface PluginApiClient {
|
|
|
264
268
|
/** DELETE a path, resolving to the parsed JSON response. */
|
|
265
269
|
delete<T = unknown>(path: string): Promise<T>;
|
|
266
270
|
}
|
|
271
|
+
/**
|
|
272
|
+
* How a declared field is compared to a value in a {@link SchemaQuery}.
|
|
273
|
+
*
|
|
274
|
+
* The same closed vocabulary as the Java `Criteria.Op`, lower-cased — the two halves of one plugin
|
|
275
|
+
* describe a query the same way. `isNull` / `isNotNull` take no value; `in` takes an array.
|
|
276
|
+
*
|
|
277
|
+
* `like` matches a pattern with `%` as the wildcard and is **case-sensitive**. For finding text inside a
|
|
278
|
+
* `text:fulltext` field use {@link SchemaClient.search}, which reads the index the platform provisioned —
|
|
279
|
+
* a leading-wildcard `like` cannot.
|
|
280
|
+
*
|
|
281
|
+
* @since 0.7.0
|
|
282
|
+
*/
|
|
283
|
+
export type SchemaOp = 'eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte' | 'like' | 'in' | 'isNull' | 'isNotNull';
|
|
284
|
+
/**
|
|
285
|
+
* One `field op value` condition over a declared field.
|
|
286
|
+
*
|
|
287
|
+
* The field name is the one your **manifest** declares; the host resolves it against that declaration and
|
|
288
|
+
* answers 400 if it is not there. Values are bound as parameters, never interpolated — a query is
|
|
289
|
+
* described, never written.
|
|
290
|
+
*
|
|
291
|
+
* @since 0.7.0
|
|
292
|
+
*/
|
|
293
|
+
export interface SchemaPredicate {
|
|
294
|
+
/** The declared field name. */
|
|
295
|
+
field: string;
|
|
296
|
+
/** The comparison. */
|
|
297
|
+
op: SchemaOp;
|
|
298
|
+
/**
|
|
299
|
+
* The value to compare against: an array for `in`, omitted for `isNull` / `isNotNull`.
|
|
300
|
+
*
|
|
301
|
+
* Give it in the field's declared type — a `boolean` for `boolean`, a number for `integer`/`number`,
|
|
302
|
+
* an ISO-8601 instant string (or a `Date`) for `timestamp`. The host coerces against the declaration
|
|
303
|
+
* and answers 400 on a value it cannot read as that type.
|
|
304
|
+
*/
|
|
305
|
+
value?: unknown;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Which rows, in what order, on which page — the query half of {@link SchemaClient}.
|
|
309
|
+
*
|
|
310
|
+
* Mirrors the Java `Criteria`, with one difference: paging here is `page`/`size` rather than
|
|
311
|
+
* `limit`/`offset`, because it crosses HTTP and shares the doc surface's conventions (`page` from 0,
|
|
312
|
+
* `size` 50 by default, capped at 200 by the host).
|
|
313
|
+
*
|
|
314
|
+
* **Predicates combine with AND.** There is no `or` in this version, exactly as in `Criteria`: model it
|
|
315
|
+
* as two queries and merge.
|
|
316
|
+
*
|
|
317
|
+
* @since 0.7.0
|
|
318
|
+
*/
|
|
319
|
+
export interface SchemaQuery {
|
|
320
|
+
/** Conditions, combined with AND. Omit to match every row. */
|
|
321
|
+
where?: SchemaPredicate[];
|
|
322
|
+
/** Sort terms, applied in order. Omit for the store's unspecified order. */
|
|
323
|
+
orderBy?: {
|
|
324
|
+
field: string;
|
|
325
|
+
direction: 'asc' | 'desc';
|
|
326
|
+
}[];
|
|
327
|
+
/** Zero-based page index; defaults to 0. */
|
|
328
|
+
page?: number;
|
|
329
|
+
/** Page size; defaults to 50, and the host caps it at 200. */
|
|
330
|
+
size?: number;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* One page of rows, in the same envelope the doc surface uses ({@link PagedDocs}).
|
|
334
|
+
*
|
|
335
|
+
* @typeParam T the row shape — name its properties for the fields your manifest declares
|
|
336
|
+
* @since 0.7.0
|
|
337
|
+
*/
|
|
338
|
+
export interface SchemaPage<T = Record<string, unknown>> {
|
|
339
|
+
/** The rows on this page. */
|
|
340
|
+
items: T[];
|
|
341
|
+
/** The zero-based page index. */
|
|
342
|
+
page: number;
|
|
343
|
+
/** The effective page size (the host's cap may have lowered what you asked for). */
|
|
344
|
+
size: number;
|
|
345
|
+
/** Total number of matching rows across all pages. */
|
|
346
|
+
totalElements: number;
|
|
347
|
+
/** Total number of pages. */
|
|
348
|
+
totalPages: number;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Read access to the relational tables the platform provisioned for a plugin that declares
|
|
352
|
+
* `storage.schema` (ARCHITECTURE §7.6) — the frontend counterpart of the Java `SchemaStore`.
|
|
353
|
+
*
|
|
354
|
+
* `ctx.schema` is **`null`** unless the manifest declares a schema, mirroring the Java
|
|
355
|
+
* `PluginContext.schema()`. The manifest is the one place a plugin says which store it uses, so a
|
|
356
|
+
* doc-store plugin finds `null` here rather than a client that would 404 on every call.
|
|
357
|
+
*
|
|
358
|
+
* ## Why reads only
|
|
359
|
+
*
|
|
360
|
+
* A v1 plugin authors no HTTP routes, so there is no request-time hook where plugin code could validate a
|
|
361
|
+
* write — no place to enforce slug uniqueness, append a revision atomically, or reject malformed input.
|
|
362
|
+
* Exposing writes here would hand clients direct row access with no plugin code in the path. So the
|
|
363
|
+
* plugin's **backend stays the only writer** of relational truth: a frontend that needs to write puts a
|
|
364
|
+
* document in the doc store and the backend ingests it on its schedule. That makes such a write eventually
|
|
365
|
+
* consistent — a deliberate consequence of the v1 contract, not an oversight.
|
|
366
|
+
*
|
|
367
|
+
* ## What the host enforces
|
|
368
|
+
*
|
|
369
|
+
* The same `data.readableBy` floor as the doc surface — one rule to learn, and a plugin that already
|
|
370
|
+
* declares one is already covered. Beyond that, **a plugin cannot express the wrong question**: entity and
|
|
371
|
+
* field names are resolved against your own manifest and the host builds the statement, so another
|
|
372
|
+
* plugin's tables (or core's) are not so much blocked as unnameable. An entity you did not declare is a
|
|
373
|
+
* 404; a field you did not declare, an unreadable value, or `search` on a field that is not `:fulltext` is
|
|
374
|
+
* a 400.
|
|
375
|
+
*
|
|
376
|
+
* The endpoints, if you ever need them through {@link PluginApiClient} directly:
|
|
377
|
+
*
|
|
378
|
+
* ```text
|
|
379
|
+
* GET /api/plugins/{id}/schema/{entity}?where=&orderBy=&page=&size=
|
|
380
|
+
* GET /api/plugins/{id}/schema/{entity}/search?field=&q=&where=&orderBy=&page=&size=
|
|
381
|
+
* GET /api/plugins/{id}/schema/{entity}/count?where=
|
|
382
|
+
* GET /api/plugins/{id}/schema/{entity}/{rowId}
|
|
383
|
+
* ```
|
|
384
|
+
*
|
|
385
|
+
* @example Search, then read one page
|
|
386
|
+
* ```ts
|
|
387
|
+
* if (!ctx.schema) return; // doc-store plugin: nothing to query
|
|
388
|
+
*
|
|
389
|
+
* interface Page { id: number; slug: string; title: string; markdown: string; updatedAt: string }
|
|
390
|
+
*
|
|
391
|
+
* const hits = await ctx.schema.search<Page>('page', 'markdown', term, {
|
|
392
|
+
* where: [{ field: 'published', op: 'eq', value: true }],
|
|
393
|
+
* size: 20,
|
|
394
|
+
* });
|
|
395
|
+
* hits.items.forEach((p) => renderHit(p.title, p.slug));
|
|
396
|
+
*
|
|
397
|
+
* const [page] = (await ctx.schema.select<Page>('page', {
|
|
398
|
+
* where: [{ field: 'slug', op: 'eq', value: ctx.route.path }],
|
|
399
|
+
* size: 1,
|
|
400
|
+
* })).items;
|
|
401
|
+
* ```
|
|
402
|
+
*
|
|
403
|
+
* @since 0.7.0
|
|
404
|
+
*/
|
|
405
|
+
export interface SchemaClient {
|
|
406
|
+
/**
|
|
407
|
+
* Rows of one declared entity, filtered and ordered by `query`.
|
|
408
|
+
*
|
|
409
|
+
* @param entity the entity name your manifest declares
|
|
410
|
+
* @param query the filter; omit to page through everything
|
|
411
|
+
* @returns one page of rows
|
|
412
|
+
*/
|
|
413
|
+
select<T = Record<string, unknown>>(entity: string, query?: SchemaQuery): Promise<SchemaPage<T>>;
|
|
414
|
+
/**
|
|
415
|
+
* Full-text search over a field declared `:fulltext`, on the index the platform provisioned.
|
|
416
|
+
*
|
|
417
|
+
* `text` is taken as a person would type it — quotes, `OR`, a leading minus — and a stray operator
|
|
418
|
+
* never throws. An **empty** `text` matches nothing rather than everything, the same rule the Java
|
|
419
|
+
* `SchemaStore.search` follows. Results come back best-match first unless `query.orderBy` replaces that
|
|
420
|
+
* ordering.
|
|
421
|
+
*
|
|
422
|
+
* @param entity the entity name your manifest declares
|
|
423
|
+
* @param field the field declared `:fulltext`; anything else is a 400
|
|
424
|
+
* @param text what the user typed
|
|
425
|
+
* @param query extra filtering/paging, applied on top of the match
|
|
426
|
+
* @returns one page of rows, ranked unless you ordered them yourself
|
|
427
|
+
*/
|
|
428
|
+
search<T = Record<string, unknown>>(entity: string, field: string, text: string, query?: SchemaQuery): Promise<SchemaPage<T>>;
|
|
429
|
+
/**
|
|
430
|
+
* One row by its platform-assigned `id`.
|
|
431
|
+
*
|
|
432
|
+
* Resolves **`null`** when there is no such row, rather than rejecting: a row that is not there is an
|
|
433
|
+
* answer to this question, and every caller would otherwise wrap it in a try/catch. This differs from
|
|
434
|
+
* {@link PluginApiClient.get}, which rejects on a 404.
|
|
435
|
+
*
|
|
436
|
+
* @param entity the entity name your manifest declares
|
|
437
|
+
* @param id the platform-assigned row id
|
|
438
|
+
* @returns the row, or `null` if it does not exist
|
|
439
|
+
*/
|
|
440
|
+
find<T = Record<string, unknown>>(entity: string, id: number): Promise<T | null>;
|
|
441
|
+
/**
|
|
442
|
+
* How many rows match — without fetching them.
|
|
443
|
+
*
|
|
444
|
+
* @param entity the entity name your manifest declares
|
|
445
|
+
* @param query the filter; ordering and paging are ignored, as in the Java `SchemaStore.count`
|
|
446
|
+
* @returns the number of matching rows
|
|
447
|
+
*/
|
|
448
|
+
count(entity: string, query?: Pick<SchemaQuery, 'where'>): Promise<number>;
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* The plugin's own URL subtree (ARCHITECTURE §6.4): where it is, when that changes, and how to move
|
|
452
|
+
* within it.
|
|
453
|
+
*
|
|
454
|
+
* The host reserves `/p/<pluginId>/*` for a plugin with a `page` slot and hands it the subpath below
|
|
455
|
+
* that prefix — which is what makes a wiki page, or anything else a plugin renders, linkable and
|
|
456
|
+
* shareable at all.
|
|
457
|
+
*
|
|
458
|
+
* @since 0.7.0 — `navigate`; `path` and `onChange` have been here since 0.1.0
|
|
459
|
+
*/
|
|
460
|
+
export interface PluginRoute {
|
|
461
|
+
/** The subpath below `/p/<pluginId>/`; empty when the plugin is not rendered as a page. */
|
|
462
|
+
path: string;
|
|
463
|
+
/**
|
|
464
|
+
* Subscribes to subpath changes — a back button, a shared link, your own {@link navigate}.
|
|
465
|
+
*
|
|
466
|
+
* Returns an {@link Unsubscribe}. Note that the host also re-renders your element on a route change,
|
|
467
|
+
* so a component that reads {@link path} at render time often needs no subscription at all.
|
|
468
|
+
*/
|
|
469
|
+
onChange(cb: (p: string) => void): Unsubscribe;
|
|
470
|
+
/**
|
|
471
|
+
* Navigates within this plugin's subtree, without reloading the page.
|
|
472
|
+
*
|
|
473
|
+
* `subpath` is relative to `/p/<pluginId>/`, the same coordinate {@link path} hands you — so
|
|
474
|
+
* `navigate('glossary/kraken')` lands on `/p/wiki/glossary/kraken`. A plugin **cannot name another
|
|
475
|
+
* plugin's route or a core one**: the host prefixes its namespace and drops any attempt to climb out of
|
|
476
|
+
* it, the same "cannot express the question" property {@link SchemaClient} has.
|
|
477
|
+
*
|
|
478
|
+
* This is real SPA navigation: a history entry, a working back button, and no re-fetch of the shell or
|
|
479
|
+
* of any plugin bundle. Which is the point — an `<a href>` to your own page costs a full document load,
|
|
480
|
+
* and on a densely cross-linked page set that is the common path rather than an edge case.
|
|
481
|
+
*
|
|
482
|
+
* **Do not reach past this handle.** `history.pushState` plus a synthetic `popstate` happens to work
|
|
483
|
+
* against the host's current router and will break when it changes; it is not part of the contract.
|
|
484
|
+
*
|
|
485
|
+
* @param subpath the target below `/p/<pluginId>/`; may carry `?query` and `#hash`
|
|
486
|
+
* @param opts `replace: true` swaps the current history entry instead of adding one — for state
|
|
487
|
+
* that should not become a back-button step, like an in-page tab or filter
|
|
488
|
+
*/
|
|
489
|
+
navigate(subpath: string, opts?: {
|
|
490
|
+
replace?: boolean;
|
|
491
|
+
}): void;
|
|
492
|
+
}
|
|
267
493
|
/**
|
|
268
494
|
* The presentation layer of an episode — the feed-derived snapshot the core UI shows (ARCHITECTURE §4.2),
|
|
269
495
|
* mirrored from the Java `dev.mosaicast.plugin.api.DisplaySnapshot` record.
|
|
@@ -589,6 +815,17 @@ export interface PluginContext {
|
|
|
589
815
|
* uses via `ctx.store()`. See {@link PluginApiClient} for the endpoint shape and access rules.
|
|
590
816
|
*/
|
|
591
817
|
api: PluginApiClient;
|
|
818
|
+
/**
|
|
819
|
+
* Read access to this plugin's provisioned relational tables, or **`null`** when the manifest declares
|
|
820
|
+
* no `storage.schema` (ARCHITECTURE §7.6).
|
|
821
|
+
*
|
|
822
|
+
* The frontend half of the Java `ctx.schema()`, and `null` for the same reason it is: a doc-store
|
|
823
|
+
* plugin has no tables, and the manifest is the single place that is decided. Check it before use —
|
|
824
|
+
* TypeScript will make you. See {@link SchemaClient} for why it is read-only.
|
|
825
|
+
*
|
|
826
|
+
* @since 0.7.0
|
|
827
|
+
*/
|
|
828
|
+
schema: SchemaClient | null;
|
|
592
829
|
/**
|
|
593
830
|
* Writes one line to the host's log, attributed to this plugin.
|
|
594
831
|
*
|
|
@@ -636,12 +873,10 @@ export interface PluginContext {
|
|
|
636
873
|
/**
|
|
637
874
|
* The subpath under `/p/<pluginId>/`, for deep-linkable plugin content (ARCHITECTURE §6.4).
|
|
638
875
|
*
|
|
639
|
-
* `onChange` returns an {@link Unsubscribe}.
|
|
876
|
+
* `onChange` returns an {@link Unsubscribe}. `navigate` moves within that subtree — see
|
|
877
|
+
* {@link PluginRoute}.
|
|
640
878
|
*/
|
|
641
|
-
route:
|
|
642
|
-
path: string;
|
|
643
|
-
onChange(cb: (p: string) => void): Unsubscribe;
|
|
644
|
-
};
|
|
879
|
+
route: PluginRoute;
|
|
645
880
|
/**
|
|
646
881
|
* The active UI locale (ARCHITECTURE §12.7).
|
|
647
882
|
*
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,EAAG,OAAgB,CAAC;AAErD,6FAA6F;AAC7F,MAAM,MAA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;;;OAMG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB;AAaD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,YAAY,EACtB,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,GAC9B,UAAU,CAqBZ"}
|
package/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* rejects a mismatch at startup (ARCHITECTURE §7.2). While the SDK is pre-1.0 a breaking change is
|
|
20
20
|
* therefore a *minor* bump; from `1.0.0` on, breaking means major.
|
|
21
21
|
*/
|
|
22
|
-
export const PLATFORM_API_VERSION = '0.
|
|
22
|
+
export const PLATFORM_API_VERSION = '0.7.0';
|
|
23
23
|
/**
|
|
24
24
|
* The id every `user` data path carries: the literal `me`, mirroring the Java `Scope.SELF_ID`.
|
|
25
25
|
*
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,qDAAqD;AAErD;;;;;;;;GAQG;AAEH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,OAAgB,CAAC;AA0DrD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,IAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,qDAAqD;AAErD;;;;;;;;GAQG;AAEH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,OAAgB,CAAC;AA0DrD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,IAAa,CAAC;AAqc3C;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc,CAAC,QAAyB;IACtD,OAAO,QAAQ,CAAC,QAAQ,IAAI,QAAQ,CAAC,YAAY,CAAC;AACpD,CAAC;AAyXD,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okens } from './index.js';
|
|
9
|
+
import type { ConsentApi, LogLevel, PluginApiClient, PluginContext, SchemaClient, SchemaQuery, ThemeTokens } from './index.js';
|
|
10
10
|
/** One recorded {@link PluginContext.log} call. */
|
|
11
11
|
export interface LogRecord {
|
|
12
12
|
/** The severity it was logged at. */
|
|
@@ -14,6 +14,28 @@ export interface LogRecord {
|
|
|
14
14
|
/** The logged message. */
|
|
15
15
|
message: string;
|
|
16
16
|
}
|
|
17
|
+
/** One recorded {@link PluginRoute.navigate} call. */
|
|
18
|
+
export interface NavigationRecord {
|
|
19
|
+
/** The subpath the component asked for, verbatim — the mock does not normalise it. */
|
|
20
|
+
subpath: string;
|
|
21
|
+
/** Whether the call asked to replace the current history entry. */
|
|
22
|
+
replace: boolean;
|
|
23
|
+
}
|
|
24
|
+
/** One recorded {@link MockSchemaClient} query. */
|
|
25
|
+
export interface SchemaQueryRecord {
|
|
26
|
+
/** Which method was called. */
|
|
27
|
+
method: 'select' | 'search' | 'find' | 'count';
|
|
28
|
+
/** The entity it was called on. */
|
|
29
|
+
entity: string;
|
|
30
|
+
/** The query, for `select` / `search` / `count`. */
|
|
31
|
+
query?: SchemaQuery;
|
|
32
|
+
/** The searched field, for `search`. */
|
|
33
|
+
field?: string;
|
|
34
|
+
/** The search text, for `search`. */
|
|
35
|
+
text?: string;
|
|
36
|
+
/** The row id, for `find`. */
|
|
37
|
+
id?: number;
|
|
38
|
+
}
|
|
17
39
|
/** One recorded {@link MockApiClient} call. */
|
|
18
40
|
export interface RecordedCall {
|
|
19
41
|
/** HTTP method, lowercase. */
|
|
@@ -80,6 +102,43 @@ export interface MockConsent extends ConsentApi {
|
|
|
80
102
|
* ```
|
|
81
103
|
*/
|
|
82
104
|
export declare function makeMockConsent(initial?: string[]): MockConsent;
|
|
105
|
+
/** A {@link SchemaClient} that answers from in-memory rows and records every query. */
|
|
106
|
+
export interface MockSchemaClient extends SchemaClient {
|
|
107
|
+
/** Every query made through this client, in order. */
|
|
108
|
+
readonly queries: SchemaQueryRecord[];
|
|
109
|
+
/** The rows it answers from, keyed by entity — mutable, so a test can change them mid-run. */
|
|
110
|
+
rows: Record<string, Record<string, unknown>[]>;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Builds a {@link SchemaClient} for tests, answering from plain arrays of rows.
|
|
114
|
+
*
|
|
115
|
+
* Pass the entities your **manifest** declares; an entity that is not there rejects, the way the host
|
|
116
|
+
* answers 404 for one you never declared — so a typo in a test fails as a typo rather than as an empty
|
|
117
|
+
* result.
|
|
118
|
+
*
|
|
119
|
+
* **`search` is a case-insensitive substring match, not Postgres full-text search.** The double cannot
|
|
120
|
+
* reproduce stemming, `websearch_to_tsquery` operators or `ts_rank` ordering, and pretending otherwise
|
|
121
|
+
* would let a test assert a ranking the host does not produce. Use it to prove your component *renders*
|
|
122
|
+
* hits and handles none; prove the searching itself against the host.
|
|
123
|
+
*
|
|
124
|
+
* Comparisons are JavaScript's: fine for numbers, booleans and strings, and correct for `timestamp`
|
|
125
|
+
* fields as long as the rows carry ISO-8601 strings, which sort lexicographically.
|
|
126
|
+
*
|
|
127
|
+
* @param rows entity name → its rows; each row should carry the platform-assigned `id`
|
|
128
|
+
* @returns a schema double with `queries` recorded and mutable `rows`
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```ts
|
|
132
|
+
* const schema = makeMockSchema({
|
|
133
|
+
* page: [{ id: 1, slug: 'kraken', title: 'The Kraken', markdown: 'a big squid' }],
|
|
134
|
+
* });
|
|
135
|
+
* const ctx = makeMockCtx({ schema });
|
|
136
|
+
*
|
|
137
|
+
* await mount(ctx);
|
|
138
|
+
* expect(schema.queries[0]).toMatchObject({ method: 'search', entity: 'page' });
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
export declare function makeMockSchema(rows?: Record<string, Record<string, unknown>[]>): MockSchemaClient;
|
|
83
142
|
/** Default theme tokens (neutral light values) used when a test does not override them. */
|
|
84
143
|
export declare const DEFAULT_THEME: ThemeTokens;
|
|
85
144
|
/** A {@link PluginContext} wired for tests: the mock `api` and the recorded `log` calls are reachable. */
|
|
@@ -92,6 +151,12 @@ export type MockPluginContext = PluginContext & {
|
|
|
92
151
|
* Stays empty if you override `log` yourself — the recording lives in the default implementation.
|
|
93
152
|
*/
|
|
94
153
|
logs: LogRecord[];
|
|
154
|
+
/**
|
|
155
|
+
* Every `ctx.route.navigate(...)` call, in order.
|
|
156
|
+
*
|
|
157
|
+
* Stays empty if you pass your own `route` — like {@link logs}, the recording lives in the default.
|
|
158
|
+
*/
|
|
159
|
+
navigations: NavigationRecord[];
|
|
95
160
|
};
|
|
96
161
|
/** Overrides accepted by {@link makeMockCtx}. */
|
|
97
162
|
export interface MockCtxOverrides extends Partial<Omit<PluginContext, 'api'>> {
|
|
@@ -109,12 +174,14 @@ export interface MockCtxOverrides extends Partial<Omit<PluginContext, 'api'>> {
|
|
|
109
174
|
* change any field; the returned `api` is a {@link MockApiClient} recording every call, and `logs`
|
|
110
175
|
* collects every `ctx.log(...)`.
|
|
111
176
|
*
|
|
112
|
-
* `episodeLabels` is deliberately **absent** by default
|
|
113
|
-
*
|
|
114
|
-
* makes you face that unless you pass
|
|
177
|
+
* `episodeLabels` is deliberately **absent** by default, and `schema` is **`null`**. Both are optional on
|
|
178
|
+
* the real context — the host supplies labels partially, and gives a doc-store plugin no schema at all — so
|
|
179
|
+
* a component that needs either has to survive its absence. The mock makes you face that unless you pass
|
|
180
|
+
* one in ({@link makeMockSchema} for the schema).
|
|
115
181
|
*
|
|
116
182
|
* @param overrides partial context plus optional `apiResponses`
|
|
117
|
-
* @returns a full context whose `api` is a {@link MockApiClient}
|
|
183
|
+
* @returns a full context whose `api` is a {@link MockApiClient}, whose `log` calls are recorded in
|
|
184
|
+
* `logs`, and whose `route.navigate` calls are recorded in `navigations`
|
|
118
185
|
*/
|
|
119
186
|
export declare function makeMockCtx(overrides?: MockCtxOverrides): MockPluginContext;
|
|
120
187
|
//# sourceMappingURL=testing.d.ts.map
|
package/dist/testing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,UAAU,EAEV,QAAQ,EACR,eAAe,EACf,aAAa,
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,UAAU,EAEV,QAAQ,EACR,eAAe,EACf,aAAa,EAEb,YAAY,EAGZ,WAAW,EACX,WAAW,EACZ,MAAM,YAAY,CAAC;AAEpB,mDAAmD;AACnD,MAAM,WAAW,SAAS;IACxB,qCAAqC;IACrC,KAAK,EAAE,QAAQ,CAAC;IAChB,0BAA0B;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,sDAAsD;AACtD,MAAM,WAAW,gBAAgB;IAC/B,sFAAsF;IACtF,OAAO,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,mDAAmD;AACnD,MAAM,WAAW,iBAAiB;IAChC,+BAA+B;IAC/B,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;IAC/C,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,+CAA+C;AAC/C,MAAM,WAAW,YAAY;IAC3B,8BAA8B;IAC9B,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC;IAC1C,wDAAwD;IACxD,IAAI,EAAE,MAA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A0D;IAC1D,GAAG,EAAE,aAAa,CAAC;IACnB;;;;OAIG;IACH,IAAI,EAAE,SAAS,EAAE,CAAC;IAClB;;;;OAIG;IACH,WAAW,EAAE,gBAAgB,EAAE,CAAC;CACjC,CAAC;AAEF,iDAAiD;AACjD,MAAM,WAAW,gBAAiB,SAAQ,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;IAC3E,kGAAkG;IAClG,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,kFAAkF;IAClF,GAAG,CAAC,EAAE,aAAa,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CAAC,SAAS,GAAE,gBAAqB,GAAG,iBAAiB,CAwC/E"}
|
package/dist/testing.js
CHANGED
|
@@ -85,6 +85,122 @@ export function makeMockConsent(initial = []) {
|
|
|
85
85
|
},
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Builds a {@link SchemaClient} for tests, answering from plain arrays of rows.
|
|
90
|
+
*
|
|
91
|
+
* Pass the entities your **manifest** declares; an entity that is not there rejects, the way the host
|
|
92
|
+
* answers 404 for one you never declared — so a typo in a test fails as a typo rather than as an empty
|
|
93
|
+
* result.
|
|
94
|
+
*
|
|
95
|
+
* **`search` is a case-insensitive substring match, not Postgres full-text search.** The double cannot
|
|
96
|
+
* reproduce stemming, `websearch_to_tsquery` operators or `ts_rank` ordering, and pretending otherwise
|
|
97
|
+
* would let a test assert a ranking the host does not produce. Use it to prove your component *renders*
|
|
98
|
+
* hits and handles none; prove the searching itself against the host.
|
|
99
|
+
*
|
|
100
|
+
* Comparisons are JavaScript's: fine for numbers, booleans and strings, and correct for `timestamp`
|
|
101
|
+
* fields as long as the rows carry ISO-8601 strings, which sort lexicographically.
|
|
102
|
+
*
|
|
103
|
+
* @param rows entity name → its rows; each row should carry the platform-assigned `id`
|
|
104
|
+
* @returns a schema double with `queries` recorded and mutable `rows`
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* const schema = makeMockSchema({
|
|
109
|
+
* page: [{ id: 1, slug: 'kraken', title: 'The Kraken', markdown: 'a big squid' }],
|
|
110
|
+
* });
|
|
111
|
+
* const ctx = makeMockCtx({ schema });
|
|
112
|
+
*
|
|
113
|
+
* await mount(ctx);
|
|
114
|
+
* expect(schema.queries[0]).toMatchObject({ method: 'search', entity: 'page' });
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
export function makeMockSchema(rows = {}) {
|
|
118
|
+
const queries = [];
|
|
119
|
+
const entity = (name) => {
|
|
120
|
+
const found = client.rows[name];
|
|
121
|
+
if (!found) {
|
|
122
|
+
throw new Error(`Entity '${name}' is not declared by this plugin; declared: [${Object.keys(client.rows).join(', ')}]`);
|
|
123
|
+
}
|
|
124
|
+
return found;
|
|
125
|
+
};
|
|
126
|
+
const matches = (row, predicate) => {
|
|
127
|
+
const actual = row[predicate.field];
|
|
128
|
+
const expected = predicate.value;
|
|
129
|
+
switch (predicate.op) {
|
|
130
|
+
case 'eq':
|
|
131
|
+
return actual === expected;
|
|
132
|
+
case 'ne':
|
|
133
|
+
return actual !== expected;
|
|
134
|
+
case 'lt':
|
|
135
|
+
return actual < expected;
|
|
136
|
+
case 'lte':
|
|
137
|
+
return actual <= expected;
|
|
138
|
+
case 'gt':
|
|
139
|
+
return actual > expected;
|
|
140
|
+
case 'gte':
|
|
141
|
+
return actual >= expected;
|
|
142
|
+
case 'like':
|
|
143
|
+
// `%` is the host's wildcard; anchor the rest so `abc%` does not match `xabc`.
|
|
144
|
+
return new RegExp(`^${String(expected).split('%').map(escapeRegExp).join('.*')}$`).test(String(actual));
|
|
145
|
+
case 'in':
|
|
146
|
+
return Array.isArray(expected) && expected.includes(actual);
|
|
147
|
+
case 'isNull':
|
|
148
|
+
return actual == null;
|
|
149
|
+
case 'isNotNull':
|
|
150
|
+
return actual != null;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
const apply = (name, query, extra) => {
|
|
154
|
+
let result = entity(name).filter((row) => (query?.where ?? []).every((p) => matches(row, p)) && (extra?.(row) ?? true));
|
|
155
|
+
for (const order of [...(query?.orderBy ?? [])].reverse()) {
|
|
156
|
+
// Applied last-to-first so the first term ends up dominant, as a multi-column sort is read.
|
|
157
|
+
result = [...result].sort((a, b) => {
|
|
158
|
+
const [x, y] = [a[order.field], b[order.field]];
|
|
159
|
+
const sign = x < y ? -1 : x > y ? 1 : 0;
|
|
160
|
+
return order.direction === 'desc' ? -sign : sign;
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
const size = query?.size ?? 50;
|
|
164
|
+
const page = query?.page ?? 0;
|
|
165
|
+
return {
|
|
166
|
+
items: result.slice(page * size, page * size + size),
|
|
167
|
+
page,
|
|
168
|
+
size,
|
|
169
|
+
totalElements: result.length,
|
|
170
|
+
totalPages: Math.ceil(result.length / size),
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
const client = {
|
|
174
|
+
queries,
|
|
175
|
+
rows,
|
|
176
|
+
// Every method is `async` so an undeclared entity comes back as a *rejection*, the way the host's 404
|
|
177
|
+
// reaches a component — a synchronous throw would be caught somewhere the real thing never is.
|
|
178
|
+
async select(name, query) {
|
|
179
|
+
queries.push({ method: 'select', entity: name, query });
|
|
180
|
+
return apply(name, query);
|
|
181
|
+
},
|
|
182
|
+
async search(name, field, text, query) {
|
|
183
|
+
queries.push({ method: 'search', entity: name, query, field, text });
|
|
184
|
+
// An empty query matches nothing rather than everything — the one search rule the double does share
|
|
185
|
+
// with the host, because a component that renders "everything" on an empty box is a real bug.
|
|
186
|
+
const needle = text.toLowerCase();
|
|
187
|
+
return apply(name, query, (row) => needle !== '' && String(row[field] ?? '').toLowerCase().includes(needle));
|
|
188
|
+
},
|
|
189
|
+
async find(name, id) {
|
|
190
|
+
queries.push({ method: 'find', entity: name, id });
|
|
191
|
+
return (entity(name).find((row) => row.id === id) ?? null);
|
|
192
|
+
},
|
|
193
|
+
async count(name, query) {
|
|
194
|
+
queries.push({ method: 'count', entity: name, query });
|
|
195
|
+
return apply(name, query).totalElements;
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
return client;
|
|
199
|
+
}
|
|
200
|
+
/** Escapes a string for literal use inside a `RegExp` — the non-wildcard parts of a `like` pattern. */
|
|
201
|
+
function escapeRegExp(literal) {
|
|
202
|
+
return literal.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
203
|
+
}
|
|
88
204
|
/** Default theme tokens (neutral light values) used when a test does not override them. */
|
|
89
205
|
export const DEFAULT_THEME = {
|
|
90
206
|
bg: '#ffffff',
|
|
@@ -105,24 +221,31 @@ export const DEFAULT_THEME = {
|
|
|
105
221
|
* change any field; the returned `api` is a {@link MockApiClient} recording every call, and `logs`
|
|
106
222
|
* collects every `ctx.log(...)`.
|
|
107
223
|
*
|
|
108
|
-
* `episodeLabels` is deliberately **absent** by default
|
|
109
|
-
*
|
|
110
|
-
* makes you face that unless you pass
|
|
224
|
+
* `episodeLabels` is deliberately **absent** by default, and `schema` is **`null`**. Both are optional on
|
|
225
|
+
* the real context — the host supplies labels partially, and gives a doc-store plugin no schema at all — so
|
|
226
|
+
* a component that needs either has to survive its absence. The mock makes you face that unless you pass
|
|
227
|
+
* one in ({@link makeMockSchema} for the schema).
|
|
111
228
|
*
|
|
112
229
|
* @param overrides partial context plus optional `apiResponses`
|
|
113
|
-
* @returns a full context whose `api` is a {@link MockApiClient}
|
|
230
|
+
* @returns a full context whose `api` is a {@link MockApiClient}, whose `log` calls are recorded in
|
|
231
|
+
* `logs`, and whose `route.navigate` calls are recorded in `navigations`
|
|
114
232
|
*/
|
|
115
233
|
export function makeMockCtx(overrides = {}) {
|
|
116
234
|
const { apiResponses, api, ...rest } = overrides;
|
|
117
235
|
const mockApi = api ?? makeMockApi(apiResponses ?? {});
|
|
118
236
|
const filter = rest.filter?.current() ?? {};
|
|
119
237
|
const logs = [];
|
|
238
|
+
const navigations = [];
|
|
120
239
|
const base = {
|
|
121
240
|
scope: { type: 'site', id: 'main' },
|
|
122
241
|
episodes: [],
|
|
123
242
|
user: null,
|
|
124
243
|
api: mockApi,
|
|
244
|
+
// Null, not a client: a plugin only has one if its manifest declares `storage.schema`, and a
|
|
245
|
+
// component written against a schema that is always there never handles the doc-store case.
|
|
246
|
+
schema: null,
|
|
125
247
|
logs,
|
|
248
|
+
navigations,
|
|
126
249
|
log: (level, message) => {
|
|
127
250
|
logs.push({ level, message });
|
|
128
251
|
},
|
|
@@ -131,11 +254,19 @@ export function makeMockCtx(overrides = {}) {
|
|
|
131
254
|
// behaves the same against the mock as against the host.
|
|
132
255
|
filter: { current: () => filter, onChange: () => noop },
|
|
133
256
|
player: { currentTime: () => 0, seekTo: () => { }, on: () => noop },
|
|
134
|
-
route: {
|
|
257
|
+
route: {
|
|
258
|
+
path: '',
|
|
259
|
+
onChange: () => noop,
|
|
260
|
+
// Recorded rather than applied: the double has no router and no URL, so `path` does not move.
|
|
261
|
+
// Assert on `navigations`; drive a route change by rendering again with a different `path`.
|
|
262
|
+
navigate: (subpath, opts) => {
|
|
263
|
+
navigations.push({ subpath, replace: opts?.replace ?? false });
|
|
264
|
+
},
|
|
265
|
+
},
|
|
135
266
|
locale: { current: () => 'en', onChange: () => noop },
|
|
136
267
|
progress: { get: () => Promise.resolve(null) },
|
|
137
268
|
theme: DEFAULT_THEME,
|
|
138
269
|
};
|
|
139
|
-
return { ...base, ...rest, api: mockApi, logs };
|
|
270
|
+
return { ...base, ...rest, api: mockApi, logs, navigations };
|
|
140
271
|
}
|
|
141
272
|
//# sourceMappingURL=testing.js.map
|
package/dist/testing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.js","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,qDAAqD;
|
|
1
|
+
{"version":3,"file":"testing.js","sourceRoot":"","sources":["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C,OAAO,EAAE,IAAI,EAAE,EAAE;gBAC1B,WAAW,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,IAAI,KAAK,EAAE,CAAC,CAAC;YACjE,CAAC;SACF;QACD,MAAM,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE;QACrD,QAAQ,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAC9C,KAAK,EAAE,aAAa;KACrB,CAAC;IAEF,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;AAC/D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mosaicast/plugin-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Versioned plugin contract for Mosaicast: the frontend PluginContext types, a Web Component base helper, an i18n helper, plus a test kit under the /testing subpath.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|