@enonic-types/lib-admin 8.0.4-B2 → 8.1.0-B1

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.
Files changed (2) hide show
  1. package/admin.d.ts +37 -0
  2. package/package.json +2 -2
package/admin.d.ts CHANGED
@@ -73,3 +73,40 @@ export interface ExtensionUrlParams {
73
73
  * @returns {string} URL.
74
74
  */
75
75
  export declare function extensionUrl(params: ExtensionUrlParams): string;
76
+ export interface SetTopicParams {
77
+ name: string;
78
+ allow: string | string[];
79
+ }
80
+ /**
81
+ * Sets the state of an admin events topic owned by this application.
82
+ *
83
+ * The topic's canonical name is `<application-key>:<name>`. Subscribers address the topic by the
84
+ * canonical name over the `admin:events` websocket API. A non-empty `allow` registers the topic
85
+ * or updates its `allow`; the principals in `allow` and `role:system.admin` may subscribe, and
86
+ * updating re-evaluates current subscribers against the new list. An empty `allow` clears the
87
+ * registration, with the same
88
+ * effect as the application stopping: publishing fails and new subscriptions are denied, while
89
+ * existing subscriptions persist and resume when the topic is set again.
90
+ *
91
+ * @param {object} params JSON with the parameters.
92
+ * @param {string} params.name Local topic name: 1-255 characters, no `:`, no whitespace.
93
+ * @param {string|string[]} params.allow Principal key, or keys, allowed to subscribe, in addition
94
+ * to `role:system.admin`. An empty array clears the topic registration.
95
+ *
96
+ * @returns {string} The canonical topic name.
97
+ */
98
+ export declare function setTopic(params: SetTopicParams): string;
99
+ /**
100
+ * Publishes a message to an admin events topic owned by this application.
101
+ *
102
+ * The message is delivered to the sockets on this node holding an acknowledged subscription to the
103
+ * topic, stamped with a per-topic sequence number. Delivery is best effort.
104
+ *
105
+ * The message is not distributed over the cluster. Subscribers on other nodes receive it only if
106
+ * the application publishes on those nodes too.
107
+ *
108
+ * @param {string} name Local topic name, as passed to `setTopic`.
109
+ * @param {*} [message] Message data: an object, an array or a primitive value. Must be
110
+ * serializable to JSON and must not contain null values.
111
+ */
112
+ export declare function sendToTopic(name: string, message?: object | string | number | boolean): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enonic-types/lib-admin",
3
- "version": "8.0.4-B2",
3
+ "version": "8.1.0-B1",
4
4
  "description": "Type definitions for lib-admin.",
5
5
  "types": "admin.d.ts",
6
6
  "files": [
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "homepage": "https://github.com/enonic/xp/tree/master#readme",
29
29
  "dependencies": {
30
- "@enonic-types/core": "8.0.4-B2"
30
+ "@enonic-types/core": "8.1.0-B1"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"