@southwind-ai/shared 0.1.2 → 0.2.1

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/index.ts CHANGED
@@ -4,8 +4,10 @@ export * from "./src/data-governance.js";
4
4
  export * from "./src/feature.js";
5
5
  export * from "./src/license.js";
6
6
  export * from "./src/license-catalog.js";
7
+ export * from "./src/json.js";
7
8
  export * from "./src/migration.js";
8
9
  export * from "./src/migration-bundle-validation.js";
10
+ export * from "./src/mcp.js";
9
11
  export * from "./src/module-configuration.js";
10
12
  export * from "./src/correlation.js";
11
13
  export * from "./src/notification.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@southwind-ai/shared",
3
- "version": "0.1.2",
3
+ "version": "0.2.1",
4
4
  "license": "UNLICENSED",
5
5
  "type": "module",
6
6
  "engines": {
package/src/audit.ts CHANGED
@@ -145,11 +145,36 @@ export const AUDIT_ACTION_DEFINITIONS = [
145
145
  label: "通知发布",
146
146
  description: "发布站内通知。",
147
147
  },
148
+ {
149
+ key: "notification.schedule",
150
+ label: "通知定时发布",
151
+ description: "创建等待调度器发布的通知。",
152
+ },
153
+ {
154
+ key: "notification.preference.update",
155
+ label: "通知偏好更新",
156
+ description: "用户更新外部通知渠道和分类偏好。",
157
+ },
158
+ {
159
+ key: "notification.update",
160
+ label: "通知修改",
161
+ description: "修改已发布通知并保留版本历史。",
162
+ },
148
163
  {
149
164
  key: "notification.read",
150
165
  label: "通知已读",
151
166
  description: "用户阅读站内通知。",
152
167
  },
168
+ {
169
+ key: "notification.favorite",
170
+ label: "收藏通知",
171
+ description: "用户收藏可见的站内通知。",
172
+ },
173
+ {
174
+ key: "notification.unfavorite",
175
+ label: "取消收藏通知",
176
+ description: "用户取消收藏可见的站内通知。",
177
+ },
153
178
  {
154
179
  key: "notification.archive",
155
180
  label: "通知归档",
package/src/json.ts ADDED
@@ -0,0 +1,8 @@
1
+ export type JsonPrimitive = string | number | boolean | null;
2
+
3
+ export type JsonValue =
4
+ | JsonPrimitive
5
+ | JsonValue[]
6
+ | { [key: string]: JsonValue };
7
+
8
+ export type JsonObject = { [key: string]: JsonValue };
package/src/mcp.ts ADDED
@@ -0,0 +1,7 @@
1
+ export const MCP_ROUTE_PATH = "/mcp";
2
+ export const MCP_API_PATH = `/api${MCP_ROUTE_PATH}`;
3
+
4
+ export const MCP_SERVER_INFO = {
5
+ name: "windy-platform",
6
+ version: "0.1.0",
7
+ } as const;
@@ -5,8 +5,11 @@ export type ModuleConfigApplyStatus =
5
5
  | "applying"
6
6
  | "effective"
7
7
  | "failed"
8
+ | "pending-restart"
8
9
  | "superseded";
9
10
 
11
+ export type ModuleConfigApplyMode = "live" | "restart";
12
+
10
13
  export interface ModuleConfigDiffEntry {
11
14
  path: string;
12
15
  before?: ModuleConfigValue;
@@ -18,6 +21,7 @@ export interface ModuleConfigFieldDescriptor {
18
21
  label: string;
19
22
  description: string;
20
23
  input: "boolean" | "integer" | "text";
24
+ applyMode?: ModuleConfigApplyMode;
21
25
  minimum?: number;
22
26
  maximum?: number;
23
27
  }
@@ -42,6 +46,7 @@ export interface ModuleConfigSummary {
42
46
  label: string;
43
47
  fields: ModuleConfigFieldDescriptor[];
44
48
  effectiveValues: ModuleConfigValues;
49
+ pendingValues?: ModuleConfigValues;
45
50
  effectiveSource: "environment" | "version";
46
51
  effectiveVersion?: number;
47
52
  latestVersion?: number;
@@ -1,7 +1,14 @@
1
1
  import type { ISODateTime } from "./primitives.js";
2
2
  import type { TargetRef } from "./workflow.js";
3
3
 
4
- export type NotificationStatus = "published" | "archived";
4
+ export type NotificationStatus = "scheduled" | "published" | "archived";
5
+ export type ExternalNotificationChannel = "email" | "sms";
6
+ export type NotificationDeliveryStatus =
7
+ | "pending"
8
+ | "processing"
9
+ | "retrying"
10
+ | "delivered"
11
+ | "dead";
5
12
 
6
13
  export interface PlatformNotification {
7
14
  id: string;
@@ -11,6 +18,7 @@ export interface PlatformNotification {
11
18
  category: string;
12
19
  status: NotificationStatus;
13
20
  publishedAt: ISODateTime;
21
+ scheduledFor?: ISODateTime;
14
22
  createdAt: ISODateTime;
15
23
  createdBy: string;
16
24
  updatedAt: ISODateTime;
@@ -19,13 +27,29 @@ export interface PlatformNotification {
19
27
  archivedBy?: string;
20
28
  target?: TargetRef;
21
29
  recipientUserId?: string;
30
+ recipientUserIds?: string[];
22
31
  recipientRoleCodes?: string[];
32
+ recipientDepartmentIds?: string[];
33
+ includeChildDepartments?: boolean;
34
+ deliveryChannels?: ExternalNotificationChannel[];
23
35
  sourceKey?: string;
36
+ revision: number;
24
37
  }
25
38
 
26
39
  export interface NotificationInboxItem extends PlatformNotification {
27
40
  read: boolean;
28
41
  readAt?: ISODateTime;
42
+ favorite: boolean;
43
+ favoritedAt?: ISODateTime;
44
+ }
45
+
46
+ export type NotificationReadFilter = "read" | "unread";
47
+
48
+ export interface NotificationInboxFilters {
49
+ q?: string;
50
+ category?: string;
51
+ read?: NotificationReadFilter;
52
+ favorite?: boolean;
29
53
  }
30
54
 
31
55
  export interface PublishNotificationInput {
@@ -35,12 +59,79 @@ export interface PublishNotificationInput {
35
59
  category: string;
36
60
  target?: TargetRef;
37
61
  recipientUserId?: string;
62
+ recipientUserIds?: string[];
38
63
  recipientRoleCodes?: string[];
64
+ recipientDepartmentIds?: string[];
65
+ includeChildDepartments?: boolean;
66
+ deliveryChannels?: ExternalNotificationChannel[];
67
+ scheduledFor?: ISODateTime;
39
68
  sourceKey?: string;
40
69
  }
41
70
 
71
+ export interface NotificationPreference {
72
+ userId: string;
73
+ enabledChannels: ExternalNotificationChannel[];
74
+ disabledCategories: string[];
75
+ updatedAt?: ISODateTime;
76
+ }
77
+
78
+ export type UpdateNotificationPreferenceInput = Pick<
79
+ NotificationPreference,
80
+ "enabledChannels" | "disabledCategories"
81
+ >;
82
+
83
+ export interface NotificationAudienceOption {
84
+ id: string;
85
+ label: string;
86
+ code?: string;
87
+ }
88
+
89
+ export interface NotificationAudienceOptions {
90
+ users: NotificationAudienceOption[];
91
+ roles: NotificationAudienceOption[];
92
+ departments: NotificationAudienceOption[];
93
+ }
94
+
95
+ export interface NotificationDelivery {
96
+ id: string;
97
+ notificationId: string;
98
+ userId: string;
99
+ channel: ExternalNotificationChannel;
100
+ status: NotificationDeliveryStatus;
101
+ attemptCount: number;
102
+ nextAttemptAt: ISODateTime;
103
+ deliveredAt?: ISODateTime;
104
+ lastErrorCode?: string;
105
+ createdAt: ISODateTime;
106
+ updatedAt: ISODateTime;
107
+ }
108
+
109
+ export type UpdateNotificationInput = Pick<
110
+ PublishNotificationInput,
111
+ "title" | "summary" | "content" | "category"
112
+ >;
113
+
114
+ export interface NotificationRevision extends UpdateNotificationInput {
115
+ notificationId: string;
116
+ revision: number;
117
+ editedAt: ISODateTime;
118
+ editedBy: string;
119
+ }
120
+
121
+ export interface UpdateNotificationResult {
122
+ notification: PlatformNotification;
123
+ changed: boolean;
124
+ }
125
+
42
126
  export interface MarkNotificationReadResult {
43
127
  success: true;
44
128
  alreadyRead: boolean;
45
129
  readAt: ISODateTime;
46
130
  }
131
+
132
+ export interface SetNotificationFavoriteResult {
133
+ success: true;
134
+ favorite: boolean;
135
+ changed: boolean;
136
+ favoritedAt?: ISODateTime;
137
+ }
package/src/password.ts CHANGED
@@ -1,4 +1,9 @@
1
- export const PASSWORD_POLICY = {
1
+ export interface PasswordPolicy {
2
+ minLength: number;
3
+ maxLength: number;
4
+ }
5
+
6
+ export const PASSWORD_POLICY: Readonly<PasswordPolicy> = {
2
7
  minLength: 12,
3
8
  maxLength: 128,
4
- } as const;
9
+ };
@@ -2,17 +2,35 @@ export interface PlatformBrandingSettings {
2
2
  softwareName: string;
3
3
  logoUrl?: string;
4
4
  description?: string;
5
+ /** Runtime display timezone. It is managed by platform.runtime, not branding storage. */
6
+ timeZone?: string;
5
7
  }
6
8
 
9
+ export const WATERMARK_DENSITIES = ["low", "medium", "high"] as const;
10
+ export type WatermarkDensity = (typeof WATERMARK_DENSITIES)[number];
11
+
12
+ export const WATERMARK_CONTENT_FIELDS = [
13
+ "username",
14
+ "displayName",
15
+ "phone",
16
+ "email",
17
+ "custom",
18
+ ] as const;
19
+ export type WatermarkContentField = (typeof WATERMARK_CONTENT_FIELDS)[number];
20
+
7
21
  export interface PlatformWatermarkPolicy {
8
22
  enabled: boolean;
9
23
  businessPagesEnabled: boolean;
24
+ density: WatermarkDensity;
25
+ contentFields: WatermarkContentField[];
10
26
  customContent: string;
11
27
  }
12
28
 
13
29
  export const DEFAULT_PLATFORM_WATERMARK_POLICY: Readonly<PlatformWatermarkPolicy> =
14
30
  {
15
31
  enabled: true,
16
- businessPagesEnabled: false,
32
+ businessPagesEnabled: true,
33
+ density: "medium",
34
+ contentFields: ["username", "displayName"],
17
35
  customContent: "",
18
36
  };