@combinedk/plugin-host 0.0.0-stage → 3.4.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.
@@ -0,0 +1,72 @@
1
+ /** Lifecycle status carried by entries in `Versioned` collections. */
2
+ export type EntityStatus = 'Draft' | 'Published' | 'Archived';
3
+ /**
4
+ * A row returned by the host's plugin-entity endpoints. The wrapper carries
5
+ * lifecycle + audit metadata; `data` is the plugin-author-defined entity body.
6
+ */
7
+ export interface PluginEntityRow<TData = unknown> {
8
+ id: string;
9
+ parentId?: string | null;
10
+ data: TData;
11
+ status?: EntityStatus | null;
12
+ createdAt: string;
13
+ updatedAt: string;
14
+ /**
15
+ * Publish-time scope-exists warning. Present only on
16
+ * an Api publish response whose required scopes have no matching Keycloak
17
+ * realm role yet — advisory, never a block (publish still succeeded). The
18
+ * designer publish flow surfaces these so the author can create the missing
19
+ * realm role(s); absent/null when every scope exists or the lookup degraded.
20
+ */
21
+ scopeWarnings?: string[] | null;
22
+ }
23
+ export interface ListEntityOptions {
24
+ parentId?: string;
25
+ status?: EntityStatus | string;
26
+ skip?: number;
27
+ take?: number;
28
+ }
29
+ /**
30
+ * Typed entity client built by the host against
31
+ * `/api/plugins/{assemblyId}/entities/{collection}`. Plugin frontends never
32
+ * compose URLs themselves — they call methods on this client.
33
+ *
34
+ * `publish` and `archive` apply only to `Versioned` collections and return
35
+ * 404 when invoked against a `Live` collection.
36
+ */
37
+ export interface PluginEntityClient {
38
+ list<T = unknown>(collection: string, options?: ListEntityOptions): Promise<PluginEntityRow<T>[]>;
39
+ get<T = unknown>(collection: string, id: string): Promise<PluginEntityRow<T>>;
40
+ create<T = unknown>(collection: string, body: unknown): Promise<PluginEntityRow<T>>;
41
+ update<T = unknown>(collection: string, id: string, body: unknown): Promise<PluginEntityRow<T>>;
42
+ delete(collection: string, id: string): Promise<void>;
43
+ publish<T = unknown>(collection: string, id: string): Promise<PluginEntityRow<T>>;
44
+ archive<T = unknown>(collection: string, id: string): Promise<PluginEntityRow<T>>;
45
+ }
46
+ /**
47
+ * Authentication context for a plugin's own direct API calls (calls it makes
48
+ * itself, not through the entity client — which authenticates per request).
49
+ */
50
+ export interface PluginAuthContext {
51
+ /**
52
+ * Bearer token snapshot resolved at mount time. Null when signed out.
53
+ * Convenient for short-lived calls; prefer `getToken()` in long-lived
54
+ * sessions where this snapshot may expire before the call is made.
55
+ */
56
+ token: string | null;
57
+ /** Resolves a fresh bearer token per call (null when signed out). */
58
+ getToken(): Promise<string | null>;
59
+ }
60
+ /**
61
+ * Everything a plugin frontend receives at mount-time. The host calls
62
+ * `mount(container, context)` exactly once per route entry; plugins should
63
+ * not retain the context across remounts.
64
+ */
65
+ export interface PluginMountContext {
66
+ assemblyId: string;
67
+ apiBaseUrl: string;
68
+ entities: PluginEntityClient;
69
+ auth: PluginAuthContext;
70
+ }
71
+ /** The shape of the export that the host imports from a plugin's `mount.ts`. */
72
+ export type PluginMountFn = (container: HTMLElement, context: PluginMountContext) => () => void;
package/package.json CHANGED
@@ -1,6 +1,26 @@
1
1
  {
2
2
  "name": "@combinedk/plugin-host",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "3.4.0",
4
+ "description": "Types and contracts for plugin frontends mounted into the Combine DataController host shell.",
5
+ "type": "module",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts"
10
+ }
11
+ },
12
+ "files": [
13
+ "dist"
14
+ ],
15
+ "scripts": {
16
+ "build": "tsc",
17
+ "typecheck": "tsc --noEmit"
18
+ },
19
+ "devDependencies": {
20
+ "typescript": "~6.0.2"
21
+ },
22
+ "publishConfig": {
23
+ "registry": "https://npm.pkg.github.com",
24
+ "access": "restricted"
25
+ }
26
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.