@southwind-ai/shared 0.1.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/index.ts +19 -0
- package/package.json +20 -0
- package/src/audit.ts +258 -0
- package/src/correlation.ts +11 -0
- package/src/data-governance.ts +89 -0
- package/src/database.ts +67 -0
- package/src/feature.ts +104 -0
- package/src/license-catalog.ts +33 -0
- package/src/license-legacy.ts +153 -0
- package/src/license.ts +267 -0
- package/src/migration.ts +39 -0
- package/src/module-configuration.ts +50 -0
- package/src/notification.ts +46 -0
- package/src/password.ts +4 -0
- package/src/platform-settings.ts +5 -0
- package/src/primitives.ts +47 -0
- package/src/profile.ts +13 -0
- package/src/rbac.ts +117 -0
- package/src/ruoyi.ts +98 -0
- package/src/scheduler.ts +108 -0
- package/src/search-provider.ts +24 -0
- package/src/workflow.ts +307 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import type { EntityId, ISODateTime } from "./primitives.js";
|
|
2
|
+
|
|
3
|
+
/** 仅供迁移前原型签发服务和 JSON.stringify 验签链路使用。 */
|
|
4
|
+
export type LegacyPrototypeLicenseEdition =
|
|
5
|
+
| "community"
|
|
6
|
+
| "standard"
|
|
7
|
+
| "professional"
|
|
8
|
+
| "enterprise";
|
|
9
|
+
export type LegacyPrototypeLicenseStatus =
|
|
10
|
+
| "valid"
|
|
11
|
+
| "invalid"
|
|
12
|
+
| "expired"
|
|
13
|
+
| "clock-rollback";
|
|
14
|
+
|
|
15
|
+
export interface LegacyPrototypeMachineFingerprint {
|
|
16
|
+
machineCode: string;
|
|
17
|
+
hostname?: string;
|
|
18
|
+
os?: string;
|
|
19
|
+
arch?: string;
|
|
20
|
+
cpuSerial?: string;
|
|
21
|
+
diskSerial?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface LegacyPrototypeLicenseLimits {
|
|
25
|
+
maxUsers: number;
|
|
26
|
+
maxTenants?: number;
|
|
27
|
+
expiresAt?: ISODateTime;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface LegacyPrototypeModuleGrant {
|
|
31
|
+
module: string;
|
|
32
|
+
enabled: boolean;
|
|
33
|
+
expiresAt?: ISODateTime;
|
|
34
|
+
maxRecords?: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface LegacyPrototypeLicenseClaims {
|
|
38
|
+
licenseId: EntityId;
|
|
39
|
+
subject: string;
|
|
40
|
+
edition: LegacyPrototypeLicenseEdition;
|
|
41
|
+
issuedAt: ISODateTime;
|
|
42
|
+
expiresAt?: ISODateTime;
|
|
43
|
+
machineCode: string;
|
|
44
|
+
limits: LegacyPrototypeLicenseLimits;
|
|
45
|
+
modules: LegacyPrototypeModuleGrant[];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface LegacyPrototypeSignedLicense {
|
|
49
|
+
claims: LegacyPrototypeLicenseClaims;
|
|
50
|
+
signature: string;
|
|
51
|
+
publicKeyId: string;
|
|
52
|
+
algorithm: "ED25519";
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export type LegacyPrototypeLicenseFailureReason =
|
|
56
|
+
| "invalid-signature"
|
|
57
|
+
| "expired"
|
|
58
|
+
| "machine-mismatch"
|
|
59
|
+
| "clock-rollback"
|
|
60
|
+
| "module-not-granted"
|
|
61
|
+
| "user-limit-exceeded";
|
|
62
|
+
|
|
63
|
+
export interface LegacyPrototypeLicenseVerificationResult {
|
|
64
|
+
valid: boolean;
|
|
65
|
+
claims?: LegacyPrototypeLicenseClaims;
|
|
66
|
+
failures: LegacyPrototypeLicenseFailureReason[];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface LegacyPrototypeLicenseKeyPair {
|
|
70
|
+
keyId: string;
|
|
71
|
+
publicKeyPem: string;
|
|
72
|
+
privateKeyPem: string;
|
|
73
|
+
createdAt: ISODateTime;
|
|
74
|
+
rotatedFromKeyId?: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface LegacyPrototypeLicenseIssueRequest {
|
|
78
|
+
projectId?: EntityId;
|
|
79
|
+
subject: string;
|
|
80
|
+
edition: LegacyPrototypeLicenseEdition;
|
|
81
|
+
machineCode: string;
|
|
82
|
+
modules: LegacyPrototypeModuleGrant[];
|
|
83
|
+
limits: LegacyPrototypeLicenseLimits;
|
|
84
|
+
expiresAt?: ISODateTime;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface LegacyPrototypeLicenseIssueResult {
|
|
88
|
+
license: LegacyPrototypeSignedLicense;
|
|
89
|
+
issuedAt: ISODateTime;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export type LegacyPrototypeLicenseOperatorPermission =
|
|
93
|
+
| "license.issue"
|
|
94
|
+
| "license.project.manage"
|
|
95
|
+
| "license.record.read"
|
|
96
|
+
| "license.key.rotate"
|
|
97
|
+
| "license.operator.manage";
|
|
98
|
+
|
|
99
|
+
export interface LegacyPrototypeLicenseOperator {
|
|
100
|
+
id: EntityId;
|
|
101
|
+
username: string;
|
|
102
|
+
displayName: string;
|
|
103
|
+
tokenHash: string;
|
|
104
|
+
permissions: LegacyPrototypeLicenseOperatorPermission[];
|
|
105
|
+
status: "active" | "disabled";
|
|
106
|
+
createdAt: ISODateTime;
|
|
107
|
+
lastUsedAt?: ISODateTime;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface LegacyPrototypeLicenseOperatorCreateResult {
|
|
111
|
+
operator: LegacyPrototypeLicenseOperator;
|
|
112
|
+
token: string;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface LegacyPrototypeLicenseProject {
|
|
116
|
+
id: EntityId;
|
|
117
|
+
code: string;
|
|
118
|
+
name: string;
|
|
119
|
+
customerName: string;
|
|
120
|
+
contactName?: string;
|
|
121
|
+
notes?: string;
|
|
122
|
+
status: "active" | "archived";
|
|
123
|
+
createdAt: ISODateTime;
|
|
124
|
+
updatedAt: ISODateTime;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface LegacyPrototypeLicenseIssueRecord {
|
|
128
|
+
id: EntityId;
|
|
129
|
+
projectId: EntityId;
|
|
130
|
+
operatorId: EntityId;
|
|
131
|
+
subject: string;
|
|
132
|
+
machineCode: string;
|
|
133
|
+
edition: LegacyPrototypeLicenseEdition;
|
|
134
|
+
publicKeyId: string;
|
|
135
|
+
licenseId: EntityId;
|
|
136
|
+
issuedAt: ISODateTime;
|
|
137
|
+
expiresAt?: ISODateTime;
|
|
138
|
+
modules: LegacyPrototypeModuleGrant[];
|
|
139
|
+
limits: LegacyPrototypeLicenseLimits;
|
|
140
|
+
license: LegacyPrototypeSignedLicense;
|
|
141
|
+
status: "issued" | "revoked" | "superseded";
|
|
142
|
+
revokedAt?: ISODateTime;
|
|
143
|
+
revokedBy?: EntityId;
|
|
144
|
+
revokeReason?: string;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export interface LegacyPrototypeLicenseUsageRecord {
|
|
148
|
+
machineCode: string;
|
|
149
|
+
openedAt: ISODateTime;
|
|
150
|
+
previousOpenedAt?: ISODateTime;
|
|
151
|
+
status: LegacyPrototypeLicenseStatus;
|
|
152
|
+
reason?: LegacyPrototypeLicenseFailureReason;
|
|
153
|
+
}
|
package/src/license.ts
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import type { EntityId, ISODateTime } from "./primitives.js";
|
|
2
|
+
|
|
3
|
+
export * from "./license-legacy.js";
|
|
4
|
+
|
|
5
|
+
declare const entitlementKeyBrand: unique symbol;
|
|
6
|
+
declare const licenseVersionKeyBrand: unique symbol;
|
|
7
|
+
|
|
8
|
+
/** @deprecated 业务应用的新功能授权请改用 LicenseVersionKey。 */
|
|
9
|
+
export type EntitlementKey = string & {
|
|
10
|
+
readonly [entitlementKeyBrand]: "EntitlementKey";
|
|
11
|
+
};
|
|
12
|
+
export type LicenseAlgorithm = "ED25519";
|
|
13
|
+
export type LicenseVersionKey = string & {
|
|
14
|
+
readonly [licenseVersionKeyBrand]: "LicenseVersionKey";
|
|
15
|
+
};
|
|
16
|
+
export type LicenseFormatVersion = 1;
|
|
17
|
+
export type LicenseLifecycleStatus = "active" | "archived";
|
|
18
|
+
|
|
19
|
+
export function licenseVersionKey(value: string): LicenseVersionKey {
|
|
20
|
+
return value as LicenseVersionKey;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** @deprecated 仅供尚未迁移的业务配置读取。 */
|
|
24
|
+
export function entitlementKey(value: string): EntitlementKey {
|
|
25
|
+
return value as EntitlementKey;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface LicenseCustomerReference {
|
|
29
|
+
id: EntityId;
|
|
30
|
+
code: string;
|
|
31
|
+
name: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface LicenseProjectReference {
|
|
35
|
+
id: EntityId;
|
|
36
|
+
code: string;
|
|
37
|
+
name: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface LicenseContractReference {
|
|
41
|
+
id: EntityId;
|
|
42
|
+
contractNumber: string;
|
|
43
|
+
version: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface LicenseVersionReference {
|
|
47
|
+
key: LicenseVersionKey;
|
|
48
|
+
name: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface LicenseV1Claims {
|
|
52
|
+
licenseId: EntityId;
|
|
53
|
+
productCode: string;
|
|
54
|
+
customer: LicenseCustomerReference;
|
|
55
|
+
project: LicenseProjectReference;
|
|
56
|
+
contract: LicenseContractReference;
|
|
57
|
+
machineCode: string;
|
|
58
|
+
issuedAt: ISODateTime;
|
|
59
|
+
expiresAt: ISODateTime;
|
|
60
|
+
licenseVersion: LicenseVersionReference;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface SignedLicenseV1 {
|
|
64
|
+
formatVersion: 1;
|
|
65
|
+
claims: LicenseV1Claims;
|
|
66
|
+
signature: string;
|
|
67
|
+
publicKeyId: string;
|
|
68
|
+
algorithm: LicenseAlgorithm;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export type LicenseClaims = LicenseV1Claims;
|
|
72
|
+
export type SignedLicense = SignedLicenseV1;
|
|
73
|
+
|
|
74
|
+
export type LicenseStatus = "valid" | "invalid" | "expired" | "clock-rollback";
|
|
75
|
+
export type LicenseFailureReason =
|
|
76
|
+
| "invalid-format"
|
|
77
|
+
| "unsupported-format"
|
|
78
|
+
| "invalid-signature"
|
|
79
|
+
| "unknown-public-key"
|
|
80
|
+
| "expired"
|
|
81
|
+
| "product-mismatch"
|
|
82
|
+
| "machine-mismatch"
|
|
83
|
+
| "clock-rollback"
|
|
84
|
+
| "license-version-not-allowed";
|
|
85
|
+
|
|
86
|
+
export interface LicenseVerificationResult {
|
|
87
|
+
valid: boolean;
|
|
88
|
+
claims?: LicenseClaims;
|
|
89
|
+
failures: LicenseFailureReason[];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface LicenseVersion {
|
|
93
|
+
id: EntityId;
|
|
94
|
+
projectId: EntityId;
|
|
95
|
+
key: LicenseVersionKey;
|
|
96
|
+
name: string;
|
|
97
|
+
description?: string;
|
|
98
|
+
status: LicenseLifecycleStatus;
|
|
99
|
+
createdAt: ISODateTime;
|
|
100
|
+
createdBy: EntityId;
|
|
101
|
+
updatedAt: ISODateTime;
|
|
102
|
+
updatedBy: EntityId;
|
|
103
|
+
archivedAt?: ISODateTime;
|
|
104
|
+
archivedBy?: EntityId;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface LicenseCustomer {
|
|
108
|
+
id: EntityId;
|
|
109
|
+
code: string;
|
|
110
|
+
name: string;
|
|
111
|
+
status: LicenseLifecycleStatus;
|
|
112
|
+
createdAt: ISODateTime;
|
|
113
|
+
createdBy: EntityId;
|
|
114
|
+
updatedAt: ISODateTime;
|
|
115
|
+
updatedBy: EntityId;
|
|
116
|
+
archivedAt?: ISODateTime;
|
|
117
|
+
archivedBy?: EntityId;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface LicenseProject {
|
|
121
|
+
id: EntityId;
|
|
122
|
+
customerId: EntityId;
|
|
123
|
+
code: string;
|
|
124
|
+
name: string;
|
|
125
|
+
status: LicenseLifecycleStatus;
|
|
126
|
+
createdAt: ISODateTime;
|
|
127
|
+
createdBy: EntityId;
|
|
128
|
+
updatedAt: ISODateTime;
|
|
129
|
+
updatedBy: EntityId;
|
|
130
|
+
archivedAt?: ISODateTime;
|
|
131
|
+
archivedBy?: EntityId;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface LicenseContractVersion {
|
|
135
|
+
id: EntityId;
|
|
136
|
+
projectId: EntityId;
|
|
137
|
+
contractNumber: string;
|
|
138
|
+
version: string;
|
|
139
|
+
licenseVersionId: EntityId;
|
|
140
|
+
status: LicenseLifecycleStatus;
|
|
141
|
+
createdAt: ISODateTime;
|
|
142
|
+
createdBy: EntityId;
|
|
143
|
+
updatedAt: ISODateTime;
|
|
144
|
+
updatedBy: EntityId;
|
|
145
|
+
archivedAt?: ISODateTime;
|
|
146
|
+
archivedBy?: EntityId;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface LicenseNode {
|
|
150
|
+
id: EntityId;
|
|
151
|
+
projectId: EntityId;
|
|
152
|
+
code: string;
|
|
153
|
+
name: string;
|
|
154
|
+
purpose?: string;
|
|
155
|
+
machineCode: string;
|
|
156
|
+
status: LicenseLifecycleStatus;
|
|
157
|
+
createdAt: ISODateTime;
|
|
158
|
+
createdBy: EntityId;
|
|
159
|
+
updatedAt: ISODateTime;
|
|
160
|
+
updatedBy: EntityId;
|
|
161
|
+
archivedAt?: ISODateTime;
|
|
162
|
+
archivedBy?: EntityId;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export interface LicenseIssueRequest {
|
|
166
|
+
productCode: string;
|
|
167
|
+
customerId: EntityId;
|
|
168
|
+
projectId: EntityId;
|
|
169
|
+
contractVersionId: EntityId;
|
|
170
|
+
nodeId: EntityId;
|
|
171
|
+
machineCode: string;
|
|
172
|
+
expiresAt: ISODateTime;
|
|
173
|
+
softwareVersion: string;
|
|
174
|
+
replacementOfLicenseId?: EntityId;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export interface LicenseIssueResult {
|
|
178
|
+
license: SignedLicenseV1;
|
|
179
|
+
issuedAt: ISODateTime;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export interface LicenseIssueRecord {
|
|
183
|
+
id: EntityId;
|
|
184
|
+
customerId: EntityId;
|
|
185
|
+
projectId: EntityId;
|
|
186
|
+
contractVersionId: EntityId;
|
|
187
|
+
nodeId: EntityId;
|
|
188
|
+
operatorId: EntityId;
|
|
189
|
+
license: SignedLicense;
|
|
190
|
+
signedPayload: string;
|
|
191
|
+
payloadDigest: string;
|
|
192
|
+
targetSoftwareVersion?: string;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export type LicenseOperatorRole =
|
|
196
|
+
| "readonly"
|
|
197
|
+
| "issuer"
|
|
198
|
+
| "super-admin"
|
|
199
|
+
| "developer";
|
|
200
|
+
|
|
201
|
+
export type LicenseOperatorPermission =
|
|
202
|
+
| "license.record.read"
|
|
203
|
+
| "license.issue"
|
|
204
|
+
| "license.project.manage"
|
|
205
|
+
| "license.key.rotate"
|
|
206
|
+
| "license.operator.manage"
|
|
207
|
+
| "license.session.revoke";
|
|
208
|
+
|
|
209
|
+
export interface LicenseOperator {
|
|
210
|
+
id: EntityId;
|
|
211
|
+
username: string;
|
|
212
|
+
displayName: string;
|
|
213
|
+
role: LicenseOperatorRole;
|
|
214
|
+
status: "active" | "disabled";
|
|
215
|
+
createdAt: ISODateTime;
|
|
216
|
+
lastLoginAt?: ISODateTime;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export interface LicenseOperatorSession {
|
|
220
|
+
id: EntityId;
|
|
221
|
+
operatorId: EntityId;
|
|
222
|
+
status: "active" | "revoked";
|
|
223
|
+
issuedAt: ISODateTime;
|
|
224
|
+
expiresAt: ISODateTime;
|
|
225
|
+
revokedAt?: ISODateTime;
|
|
226
|
+
lastSeenAt?: ISODateTime;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export interface LicenseReplacement {
|
|
230
|
+
id: EntityId;
|
|
231
|
+
replacedLicenseId: EntityId;
|
|
232
|
+
replacementLicenseId: EntityId;
|
|
233
|
+
reason?: string;
|
|
234
|
+
createdAt: ISODateTime;
|
|
235
|
+
createdBy: EntityId;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export type LicenseEventType =
|
|
239
|
+
| "license.issued"
|
|
240
|
+
| "license.downloaded"
|
|
241
|
+
| "license.replaced"
|
|
242
|
+
| "license.revocation-marked"
|
|
243
|
+
| "license.note-corrected";
|
|
244
|
+
|
|
245
|
+
export type LicenseGovernanceEventType =
|
|
246
|
+
| LicenseEventType
|
|
247
|
+
| "license.superseded"
|
|
248
|
+
| "license.key.rotated"
|
|
249
|
+
| "license.operator.created"
|
|
250
|
+
| "license.operator.updated";
|
|
251
|
+
|
|
252
|
+
export interface LicenseEvent {
|
|
253
|
+
id: EntityId;
|
|
254
|
+
licenseId: EntityId;
|
|
255
|
+
type: LicenseEventType;
|
|
256
|
+
actorId: EntityId;
|
|
257
|
+
occurredAt: ISODateTime;
|
|
258
|
+
payload: Record<string, unknown>;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export interface LicenseUsageRecord {
|
|
262
|
+
machineCode: string;
|
|
263
|
+
openedAt: ISODateTime;
|
|
264
|
+
previousOpenedAt?: ISODateTime;
|
|
265
|
+
status: LicenseStatus;
|
|
266
|
+
reason?: LicenseFailureReason;
|
|
267
|
+
}
|
package/src/migration.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { MigrationExecutionContext } from "./database.js";
|
|
2
|
+
|
|
3
|
+
export const MIGRATION_BUNDLE_FORMAT_VERSION = "1" as const;
|
|
4
|
+
|
|
5
|
+
export type MigrationDirection = "up" | "down";
|
|
6
|
+
|
|
7
|
+
export interface MigrationDefinition {
|
|
8
|
+
id: string;
|
|
9
|
+
module: string;
|
|
10
|
+
description: string;
|
|
11
|
+
direction: MigrationDirection;
|
|
12
|
+
checksum?: string;
|
|
13
|
+
dependsOn?: readonly string[];
|
|
14
|
+
run(context: MigrationExecutionContext): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface BundleMigrationDefinition extends MigrationDefinition {
|
|
18
|
+
checksum: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface MigrationBundle {
|
|
22
|
+
formatVersion: typeof MIGRATION_BUNDLE_FORMAT_VERSION;
|
|
23
|
+
module: string;
|
|
24
|
+
version: string;
|
|
25
|
+
dependencies?: readonly string[];
|
|
26
|
+
migrations: readonly BundleMigrationDefinition[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface MigrationManifestSource {
|
|
30
|
+
name: string;
|
|
31
|
+
version: string;
|
|
32
|
+
dependencies?: readonly string[];
|
|
33
|
+
migrations: readonly MigrationDefinition[];
|
|
34
|
+
schemaExports?: readonly {
|
|
35
|
+
key: string;
|
|
36
|
+
migrationIds: readonly string[];
|
|
37
|
+
}[];
|
|
38
|
+
migrationBundle?: MigrationBundle;
|
|
39
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export type ModuleConfigValue = string | number | boolean | null;
|
|
2
|
+
export type ModuleConfigValues = Record<string, ModuleConfigValue>;
|
|
3
|
+
|
|
4
|
+
export type ModuleConfigApplyStatus =
|
|
5
|
+
| "applying"
|
|
6
|
+
| "effective"
|
|
7
|
+
| "failed"
|
|
8
|
+
| "superseded";
|
|
9
|
+
|
|
10
|
+
export interface ModuleConfigDiffEntry {
|
|
11
|
+
path: string;
|
|
12
|
+
before?: ModuleConfigValue;
|
|
13
|
+
after?: ModuleConfigValue;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface ModuleConfigFieldDescriptor {
|
|
17
|
+
path: string;
|
|
18
|
+
label: string;
|
|
19
|
+
description: string;
|
|
20
|
+
input: "boolean" | "integer" | "text";
|
|
21
|
+
minimum?: number;
|
|
22
|
+
maximum?: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface ModuleConfigVersion {
|
|
26
|
+
id: string;
|
|
27
|
+
moduleKey: string;
|
|
28
|
+
version: number;
|
|
29
|
+
values: ModuleConfigValues;
|
|
30
|
+
diff: ModuleConfigDiffEntry[];
|
|
31
|
+
applyStatus: ModuleConfigApplyStatus;
|
|
32
|
+
applyError?: string;
|
|
33
|
+
rollbackOfVersion?: number;
|
|
34
|
+
reason?: string;
|
|
35
|
+
createdAt: string;
|
|
36
|
+
createdBy: string;
|
|
37
|
+
appliedAt?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface ModuleConfigSummary {
|
|
41
|
+
moduleKey: string;
|
|
42
|
+
label: string;
|
|
43
|
+
fields: ModuleConfigFieldDescriptor[];
|
|
44
|
+
effectiveValues: ModuleConfigValues;
|
|
45
|
+
effectiveSource: "environment" | "version";
|
|
46
|
+
effectiveVersion?: number;
|
|
47
|
+
latestVersion?: number;
|
|
48
|
+
latestStatus?: ModuleConfigApplyStatus;
|
|
49
|
+
latestApplyError?: string;
|
|
50
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ISODateTime } from "./primitives.js";
|
|
2
|
+
import type { TargetRef } from "./workflow.js";
|
|
3
|
+
|
|
4
|
+
export type NotificationStatus = "published" | "archived";
|
|
5
|
+
|
|
6
|
+
export interface PlatformNotification {
|
|
7
|
+
id: string;
|
|
8
|
+
title: string;
|
|
9
|
+
summary: string;
|
|
10
|
+
content: string;
|
|
11
|
+
category: string;
|
|
12
|
+
status: NotificationStatus;
|
|
13
|
+
publishedAt: ISODateTime;
|
|
14
|
+
createdAt: ISODateTime;
|
|
15
|
+
createdBy: string;
|
|
16
|
+
updatedAt: ISODateTime;
|
|
17
|
+
updatedBy: string;
|
|
18
|
+
archivedAt?: ISODateTime;
|
|
19
|
+
archivedBy?: string;
|
|
20
|
+
target?: TargetRef;
|
|
21
|
+
recipientUserId?: string;
|
|
22
|
+
recipientRoleCodes?: string[];
|
|
23
|
+
sourceKey?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface NotificationInboxItem extends PlatformNotification {
|
|
27
|
+
read: boolean;
|
|
28
|
+
readAt?: ISODateTime;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface PublishNotificationInput {
|
|
32
|
+
title: string;
|
|
33
|
+
summary: string;
|
|
34
|
+
content: string;
|
|
35
|
+
category: string;
|
|
36
|
+
target?: TargetRef;
|
|
37
|
+
recipientUserId?: string;
|
|
38
|
+
recipientRoleCodes?: string[];
|
|
39
|
+
sourceKey?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface MarkNotificationReadResult {
|
|
43
|
+
success: true;
|
|
44
|
+
alreadyRead: boolean;
|
|
45
|
+
readAt: ISODateTime;
|
|
46
|
+
}
|
package/src/password.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export type EntityId = string;
|
|
2
|
+
export type ISODateTime = string;
|
|
3
|
+
|
|
4
|
+
export type LifecycleStatus = "draft" | "active" | "disabled" | "archived";
|
|
5
|
+
|
|
6
|
+
export interface EntityAuditFields {
|
|
7
|
+
createdAt: ISODateTime;
|
|
8
|
+
createdBy: EntityId;
|
|
9
|
+
updatedAt: ISODateTime;
|
|
10
|
+
updatedBy: EntityId;
|
|
11
|
+
deletedAt?: ISODateTime;
|
|
12
|
+
deletedBy?: EntityId;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type SortOrder = "asc" | "desc";
|
|
16
|
+
|
|
17
|
+
export const DEFAULT_PAGE_SIZE = 10;
|
|
18
|
+
export const MAX_PAGE_SIZE = 100;
|
|
19
|
+
|
|
20
|
+
export interface SortRule {
|
|
21
|
+
field: string;
|
|
22
|
+
order: SortOrder;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface PageRequest {
|
|
26
|
+
page: number;
|
|
27
|
+
pageSize: number;
|
|
28
|
+
sort?: SortRule[];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface PageResult<T> {
|
|
32
|
+
items: T[];
|
|
33
|
+
total: number;
|
|
34
|
+
page: number;
|
|
35
|
+
pageSize: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface FieldMapping {
|
|
39
|
+
source: string;
|
|
40
|
+
target: string;
|
|
41
|
+
transform?: string;
|
|
42
|
+
required?: boolean;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function assertUnreachable(value: never): never {
|
|
46
|
+
throw new Error(`Unhandled value reached: ${String(value)}`);
|
|
47
|
+
}
|
package/src/profile.ts
ADDED