@allbluecn/kernel 0.2.0 → 0.2.2
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/LICENSE +661 -0
- package/dist/bin.js +89 -14
- package/dist/index.d.ts +545 -8
- package/dist/index.js +2 -2
- package/dist/src-B6_ZEkl9.js +316 -0
- package/package.json +12 -10
- package/dist/src-Dvcggyr-.js +0 -122
package/dist/index.d.ts
CHANGED
|
@@ -1,28 +1,529 @@
|
|
|
1
1
|
import { ComponentType } from "react";
|
|
2
|
+
import { StreamChunk } from "@tanstack/ai";
|
|
3
|
+
//#region src/pro-contract/billing.d.ts
|
|
4
|
+
interface SubscriptionInfo {
|
|
5
|
+
planId: string;
|
|
6
|
+
planName: 'free' | 'pro' | 'enterprise' | 'open-source';
|
|
7
|
+
status: 'trialing' | 'active' | 'past_due' | 'canceled' | 'expired' | 'unpaid';
|
|
8
|
+
seats: number;
|
|
9
|
+
addonSeats: number;
|
|
10
|
+
currentPeriodStart: Date | null;
|
|
11
|
+
currentPeriodEnd: Date | null;
|
|
12
|
+
cancelAtPeriodEnd: boolean;
|
|
13
|
+
trialEndsAt: Date | null;
|
|
14
|
+
features: Record<string, boolean>;
|
|
15
|
+
currency: 'usd' | 'cny';
|
|
16
|
+
}
|
|
17
|
+
interface CheckoutParams {
|
|
18
|
+
userId: string;
|
|
19
|
+
planId: string;
|
|
20
|
+
successUrl: string;
|
|
21
|
+
cancelUrl: string;
|
|
22
|
+
trialDays?: number;
|
|
23
|
+
currency: 'usd' | 'cny';
|
|
24
|
+
}
|
|
25
|
+
interface PortalSessionParams {
|
|
26
|
+
userId: string;
|
|
27
|
+
returnUrl: string;
|
|
28
|
+
}
|
|
29
|
+
interface InvoiceInfo {
|
|
30
|
+
id: string;
|
|
31
|
+
providerInvoiceId: string;
|
|
32
|
+
amountDue: number;
|
|
33
|
+
amountPaid: number;
|
|
34
|
+
currency: string;
|
|
35
|
+
status: string;
|
|
36
|
+
pdfUrl: string | null;
|
|
37
|
+
hostedInvoiceUrl: string | null;
|
|
38
|
+
periodStart: Date;
|
|
39
|
+
periodEnd: Date;
|
|
40
|
+
paidAt: Date | null;
|
|
41
|
+
}
|
|
42
|
+
interface PlanInfo {
|
|
43
|
+
id: string;
|
|
44
|
+
name: string;
|
|
45
|
+
displayName: string;
|
|
46
|
+
description: string | null;
|
|
47
|
+
priceMonthly: number;
|
|
48
|
+
priceYearly: number | null;
|
|
49
|
+
currency: 'usd' | 'cny';
|
|
50
|
+
maxSeats: number | null;
|
|
51
|
+
aiQuotaMonthly: number | null;
|
|
52
|
+
features: Record<string, boolean>;
|
|
53
|
+
isPublic: boolean;
|
|
54
|
+
providerPriceId: string | null;
|
|
55
|
+
seatPriceMonthly: number | null;
|
|
56
|
+
}
|
|
57
|
+
interface SeatUpdateParams {
|
|
58
|
+
userId: string;
|
|
59
|
+
/** 目标加购席位总数(非增量),取值 [0, 100] */
|
|
60
|
+
addonSeats: number;
|
|
61
|
+
/** 首次加购跳转 Creem Checkout 付款成功后的回跳 URL(仅路径①首次加购使用) */
|
|
62
|
+
successUrl?: string;
|
|
63
|
+
}
|
|
64
|
+
interface SeatCheckResult {
|
|
65
|
+
available: boolean;
|
|
66
|
+
current: number;
|
|
67
|
+
max: number | null;
|
|
68
|
+
reason?: 'max_seats_reached' | 'unknown_plan';
|
|
69
|
+
}
|
|
70
|
+
declare class BillingUnavailableError extends Error {
|
|
71
|
+
constructor(message?: string);
|
|
72
|
+
}
|
|
73
|
+
declare class WebhookSignatureError extends Error {
|
|
74
|
+
constructor(message?: string);
|
|
75
|
+
}
|
|
76
|
+
declare class SeatsExceededError extends Error {
|
|
77
|
+
current: number;
|
|
78
|
+
max: number;
|
|
79
|
+
constructor(current: number, max: number);
|
|
80
|
+
}
|
|
81
|
+
interface BillingService {
|
|
82
|
+
getSubscription(userId: string): Promise<SubscriptionInfo | null>;
|
|
83
|
+
listPublicPlans(currency: 'usd' | 'cny'): Promise<PlanInfo[]>;
|
|
84
|
+
createCheckoutSession(params: CheckoutParams): Promise<{
|
|
85
|
+
url: string;
|
|
86
|
+
}>;
|
|
87
|
+
createCustomerPortalSession(params: PortalSessionParams): Promise<{
|
|
88
|
+
url: string;
|
|
89
|
+
}>;
|
|
90
|
+
listInvoices(userId: string, limit?: number): Promise<InvoiceInfo[]>;
|
|
91
|
+
checkSeatAvailability(userId: string): Promise<SeatCheckResult>;
|
|
92
|
+
handleWebhookEvent(rawBody: string, signature: string): Promise<{
|
|
93
|
+
received: boolean;
|
|
94
|
+
}>;
|
|
95
|
+
syncSubscription(userId: string): Promise<SubscriptionInfo>;
|
|
96
|
+
getEffectivePlan(userId: string): Promise<{
|
|
97
|
+
planName: string;
|
|
98
|
+
features: Record<string, boolean>;
|
|
99
|
+
}>;
|
|
100
|
+
updateSeats(params: SeatUpdateParams): Promise<SubscriptionInfo & {
|
|
101
|
+
checkoutUrl?: string;
|
|
102
|
+
}>;
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/pro-contract/hosted-ai.d.ts
|
|
106
|
+
declare class HostedAiError extends Error {
|
|
107
|
+
readonly code: 'QUOTA_EXHAUSTED' | 'NO_SUBSCRIPTION' | 'NO_ACTIVE_WORKSPACE' | 'PROVIDER_MISCONFIGURED' | 'PROVIDER_ERROR';
|
|
108
|
+
readonly details?: {
|
|
109
|
+
used?: number;
|
|
110
|
+
limit?: number | null;
|
|
111
|
+
resetAt?: Date;
|
|
112
|
+
cause?: unknown;
|
|
113
|
+
} | undefined;
|
|
114
|
+
constructor(code: 'QUOTA_EXHAUSTED' | 'NO_SUBSCRIPTION' | 'NO_ACTIVE_WORKSPACE' | 'PROVIDER_MISCONFIGURED' | 'PROVIDER_ERROR', message: string, details?: {
|
|
115
|
+
used?: number;
|
|
116
|
+
limit?: number | null;
|
|
117
|
+
resetAt?: Date;
|
|
118
|
+
cause?: unknown;
|
|
119
|
+
} | undefined);
|
|
120
|
+
}
|
|
121
|
+
interface HostedAiChatParams {
|
|
122
|
+
workspaceId: string;
|
|
123
|
+
userId: string;
|
|
124
|
+
messages: Array<{
|
|
125
|
+
role: 'user' | 'assistant' | 'tool';
|
|
126
|
+
content: string;
|
|
127
|
+
}>;
|
|
128
|
+
systemPrompts?: string[];
|
|
129
|
+
model?: string;
|
|
130
|
+
threadId?: string;
|
|
131
|
+
runId?: string;
|
|
132
|
+
resume?: Array<unknown>;
|
|
133
|
+
webSearchEnabled?: boolean;
|
|
134
|
+
}
|
|
135
|
+
interface HostedAiChatResult {
|
|
136
|
+
content: string;
|
|
137
|
+
inputTokens: number;
|
|
138
|
+
outputTokens: number;
|
|
139
|
+
costUsd: number | null;
|
|
140
|
+
model: string;
|
|
141
|
+
}
|
|
142
|
+
interface AiQuota {
|
|
143
|
+
used: number;
|
|
144
|
+
limit: number | null;
|
|
145
|
+
resetAt: Date;
|
|
146
|
+
planName: string;
|
|
147
|
+
}
|
|
148
|
+
interface HostedAiModel {
|
|
149
|
+
id: string;
|
|
150
|
+
label: string;
|
|
151
|
+
provider: string;
|
|
152
|
+
streaming: boolean;
|
|
153
|
+
}
|
|
154
|
+
interface HostedAiService {
|
|
155
|
+
chatStream(params: HostedAiChatParams, signal?: AbortSignal): AsyncIterable<StreamChunk>;
|
|
156
|
+
chat(params: HostedAiChatParams, signal?: AbortSignal): Promise<HostedAiChatResult>;
|
|
157
|
+
getQuota(workspaceId: string): Promise<AiQuota>;
|
|
158
|
+
listAvailableModels(): Promise<HostedAiModel[]>;
|
|
159
|
+
}
|
|
160
|
+
//#endregion
|
|
161
|
+
//#region src/pro-contract/sso.d.ts
|
|
162
|
+
interface SsoProvider {
|
|
163
|
+
id: string;
|
|
164
|
+
type: 'saml' | 'oidc' | 'google' | 'okta' | 'azure';
|
|
165
|
+
name: string;
|
|
166
|
+
configured: boolean;
|
|
167
|
+
}
|
|
168
|
+
interface SsoService {
|
|
169
|
+
listProviders(workspaceId: string): Promise<SsoProvider[]>;
|
|
170
|
+
initiateLogin(providerId: string, returnUrl: string): Promise<{
|
|
171
|
+
url: string;
|
|
172
|
+
}>;
|
|
173
|
+
handleCallback(providerId: string, code: string, state: string): Promise<{
|
|
174
|
+
userId: string;
|
|
175
|
+
workspaceId: string;
|
|
176
|
+
}>;
|
|
177
|
+
}
|
|
178
|
+
//#endregion
|
|
179
|
+
//#region src/pro-contract/audit.d.ts
|
|
180
|
+
interface AuditLogEntry {
|
|
181
|
+
id: string;
|
|
182
|
+
workspaceId: string;
|
|
183
|
+
userId: string;
|
|
184
|
+
action: string;
|
|
185
|
+
resourceType: string;
|
|
186
|
+
resourceId: string;
|
|
187
|
+
metadata: Record<string, unknown>;
|
|
188
|
+
ip: string | null;
|
|
189
|
+
userAgent: string | null;
|
|
190
|
+
createdAt: Date;
|
|
191
|
+
}
|
|
192
|
+
interface AuditQuery {
|
|
193
|
+
workspaceId: string;
|
|
194
|
+
userId?: string;
|
|
195
|
+
action?: string;
|
|
196
|
+
startDate?: Date;
|
|
197
|
+
endDate?: Date;
|
|
198
|
+
limit?: number;
|
|
199
|
+
offset?: number;
|
|
200
|
+
}
|
|
201
|
+
interface AuditService {
|
|
202
|
+
log(entry: Omit<AuditLogEntry, 'id' | 'createdAt'>): Promise<void>;
|
|
203
|
+
query(q: AuditQuery): Promise<{
|
|
204
|
+
entries: AuditLogEntry[];
|
|
205
|
+
total: number;
|
|
206
|
+
}>;
|
|
207
|
+
export(workspaceId: string, format: 'csv' | 'json'): Promise<{
|
|
208
|
+
url: string;
|
|
209
|
+
}>;
|
|
210
|
+
}
|
|
211
|
+
//#endregion
|
|
212
|
+
//#region src/pro-contract/permissions.d.ts
|
|
213
|
+
type PermissionLevel = 'none' | 'read' | 'write' | 'admin';
|
|
214
|
+
interface RoleDefinition {
|
|
215
|
+
id: string;
|
|
216
|
+
name: string;
|
|
217
|
+
workspaceId: string;
|
|
218
|
+
permissions: Record<string, PermissionLevel>;
|
|
219
|
+
isSystem: boolean;
|
|
220
|
+
}
|
|
221
|
+
interface PermissionsService {
|
|
222
|
+
listRoles(workspaceId: string): Promise<RoleDefinition[]>;
|
|
223
|
+
createRole(workspaceId: string, name: string, permissions: Record<string, PermissionLevel>): Promise<RoleDefinition>;
|
|
224
|
+
updateRole(roleId: string, updates: Partial<RoleDefinition>): Promise<void>;
|
|
225
|
+
deleteRole(roleId: string): Promise<void>;
|
|
226
|
+
checkPermission(userId: string, resource: string, action: string): Promise<PermissionLevel>;
|
|
227
|
+
}
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/pro-contract/license.d.ts
|
|
230
|
+
interface LicenseInfo {
|
|
231
|
+
key: string;
|
|
232
|
+
customerName: string;
|
|
233
|
+
customerEmail: string;
|
|
234
|
+
plan: string;
|
|
235
|
+
seats: number;
|
|
236
|
+
features: Record<string, boolean>;
|
|
237
|
+
issuedAt: Date;
|
|
238
|
+
expiresAt: Date | null;
|
|
239
|
+
}
|
|
240
|
+
interface LicenseStatus {
|
|
241
|
+
valid: boolean;
|
|
242
|
+
reason: 'ok' | 'expired' | 'revoked' | 'invalid_signature' | 'not_activated' | 'fingerprint_mismatch';
|
|
243
|
+
license: LicenseInfo | null;
|
|
244
|
+
daysUntilExpiry: number | null;
|
|
245
|
+
inGracePeriod: boolean;
|
|
246
|
+
}
|
|
247
|
+
interface ActivationResult {
|
|
248
|
+
success: boolean;
|
|
249
|
+
message: string;
|
|
250
|
+
instanceId?: string;
|
|
251
|
+
}
|
|
252
|
+
interface LicenseIssueParams {
|
|
253
|
+
customerName: string;
|
|
254
|
+
customerEmail: string;
|
|
255
|
+
customerId: string;
|
|
256
|
+
plan: string;
|
|
257
|
+
seats: number;
|
|
258
|
+
features: Record<string, boolean>;
|
|
259
|
+
expiresAt: Date | null;
|
|
260
|
+
}
|
|
261
|
+
interface LicenseIssueResult {
|
|
262
|
+
/** 完整 license key(base64url(payload).base64url(signature),仅签发时返回一次) */
|
|
263
|
+
key: string;
|
|
264
|
+
signature: string;
|
|
265
|
+
payload: {
|
|
266
|
+
customerName: string;
|
|
267
|
+
customerEmail: string;
|
|
268
|
+
customerId: string;
|
|
269
|
+
plan: string;
|
|
270
|
+
seats: number;
|
|
271
|
+
features: Record<string, boolean>;
|
|
272
|
+
issuedAt: string;
|
|
273
|
+
expiresAt: string | null;
|
|
274
|
+
nonce: string;
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
interface LicenseService {
|
|
278
|
+
activate(key: string, instanceFingerprint: string): Promise<ActivationResult>;
|
|
279
|
+
verify(): Promise<LicenseStatus>;
|
|
280
|
+
revoke(instanceId: string): Promise<void>;
|
|
281
|
+
issue?(params: LicenseIssueParams): Promise<LicenseIssueResult>;
|
|
282
|
+
heartbeat?(instanceId: string): Promise<{
|
|
283
|
+
ok: boolean;
|
|
284
|
+
revoked: boolean;
|
|
285
|
+
}>;
|
|
286
|
+
}
|
|
287
|
+
//#endregion
|
|
288
|
+
//#region src/pro-contract/version-history.d.ts
|
|
289
|
+
interface DocumentVersion {
|
|
290
|
+
id: string;
|
|
291
|
+
documentId: string;
|
|
292
|
+
versionNumber: number;
|
|
293
|
+
content: string;
|
|
294
|
+
createdBy: string;
|
|
295
|
+
createdAt: Date;
|
|
296
|
+
changeSummary: string | null;
|
|
297
|
+
}
|
|
298
|
+
interface VersionHistoryService {
|
|
299
|
+
saveVersion(documentId: string, content: string, changeSummary?: string): Promise<DocumentVersion>;
|
|
300
|
+
listVersions(documentId: string, limit?: number): Promise<DocumentVersion[]>;
|
|
301
|
+
getVersion(versionId: string): Promise<DocumentVersion | null>;
|
|
302
|
+
restoreVersion(versionId: string): Promise<void>;
|
|
303
|
+
diffVersions(versionIdA: string, versionIdB: string): Promise<{
|
|
304
|
+
additions: number;
|
|
305
|
+
deletions: number;
|
|
306
|
+
content: string;
|
|
307
|
+
}>;
|
|
308
|
+
}
|
|
309
|
+
//#endregion
|
|
310
|
+
//#region src/pro-contract/automation.d.ts
|
|
311
|
+
interface AutomationRule {
|
|
312
|
+
id: string;
|
|
313
|
+
workspaceId: string;
|
|
314
|
+
name: string;
|
|
315
|
+
trigger: {
|
|
316
|
+
type: 'document_created' | 'status_changed' | 'schedule';
|
|
317
|
+
config: Record<string, unknown>;
|
|
318
|
+
};
|
|
319
|
+
action: {
|
|
320
|
+
type: 'ai_classify' | 'ai_summarize' | 'assign' | 'notify';
|
|
321
|
+
config: Record<string, unknown>;
|
|
322
|
+
};
|
|
323
|
+
enabled: boolean;
|
|
324
|
+
}
|
|
325
|
+
interface AutomationService {
|
|
326
|
+
listRules(workspaceId: string): Promise<AutomationRule[]>;
|
|
327
|
+
createRule(workspaceId: string, rule: Omit<AutomationRule, 'id' | 'workspaceId'>): Promise<AutomationRule>;
|
|
328
|
+
updateRule(ruleId: string, updates: Partial<AutomationRule>): Promise<void>;
|
|
329
|
+
deleteRule(ruleId: string): Promise<void>;
|
|
330
|
+
triggerRule(ruleId: string, context: Record<string, unknown>): Promise<{
|
|
331
|
+
success: boolean;
|
|
332
|
+
result: unknown;
|
|
333
|
+
}>;
|
|
334
|
+
}
|
|
335
|
+
//#endregion
|
|
336
|
+
//#region src/pro-contract/templates.d.ts
|
|
337
|
+
interface DocumentTemplate {
|
|
338
|
+
id: string;
|
|
339
|
+
workspaceId: string | null;
|
|
340
|
+
name: string;
|
|
341
|
+
description: string;
|
|
342
|
+
category: string;
|
|
343
|
+
content: string;
|
|
344
|
+
icon: string;
|
|
345
|
+
createdBy: string;
|
|
346
|
+
createdAt: Date;
|
|
347
|
+
}
|
|
348
|
+
interface TemplatesService {
|
|
349
|
+
listTemplates(workspaceId: string | null): Promise<DocumentTemplate[]>;
|
|
350
|
+
createTemplate(workspaceId: string | null, template: Omit<DocumentTemplate, 'id' | 'createdAt'>): Promise<DocumentTemplate>;
|
|
351
|
+
updateTemplate(templateId: string, updates: Partial<DocumentTemplate>): Promise<void>;
|
|
352
|
+
deleteTemplate(templateId: string): Promise<void>;
|
|
353
|
+
instantiate(templateId: string, name: string): Promise<{
|
|
354
|
+
documentId: string;
|
|
355
|
+
}>;
|
|
356
|
+
}
|
|
357
|
+
//#endregion
|
|
358
|
+
//#region src/pro-contract/analytics.d.ts
|
|
359
|
+
interface AnalyticsQuery {
|
|
360
|
+
workspaceId: string;
|
|
361
|
+
metric: string;
|
|
362
|
+
groupBy?: string;
|
|
363
|
+
startDate: Date;
|
|
364
|
+
endDate: Date;
|
|
365
|
+
}
|
|
366
|
+
interface AnalyticsResult {
|
|
367
|
+
metric: string;
|
|
368
|
+
dataPoints: Array<{
|
|
369
|
+
label: string;
|
|
370
|
+
value: number;
|
|
371
|
+
date: Date;
|
|
372
|
+
}>;
|
|
373
|
+
summary: {
|
|
374
|
+
total: number;
|
|
375
|
+
average: number;
|
|
376
|
+
trend: 'up' | 'down' | 'flat';
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
interface CustomDashboard {
|
|
380
|
+
id: string;
|
|
381
|
+
workspaceId: string;
|
|
382
|
+
name: string;
|
|
383
|
+
widgets: Array<{
|
|
384
|
+
id: string;
|
|
385
|
+
type: string;
|
|
386
|
+
query: AnalyticsQuery;
|
|
387
|
+
title: string;
|
|
388
|
+
}>;
|
|
389
|
+
}
|
|
390
|
+
interface AnalyticsService {
|
|
391
|
+
query(q: AnalyticsQuery): Promise<AnalyticsResult>;
|
|
392
|
+
listDashboards(workspaceId: string): Promise<CustomDashboard[]>;
|
|
393
|
+
createDashboard(workspaceId: string, dashboard: Omit<CustomDashboard, 'id'>): Promise<CustomDashboard>;
|
|
394
|
+
exportData(workspaceId: string, format: 'csv' | 'xlsx' | 'json'): Promise<{
|
|
395
|
+
url: string;
|
|
396
|
+
}>;
|
|
397
|
+
}
|
|
398
|
+
//#endregion
|
|
399
|
+
//#region src/pro-contract/global-search.d.ts
|
|
400
|
+
interface SearchResult {
|
|
401
|
+
id: string;
|
|
402
|
+
type: 'document' | 'project' | 'story' | 'comment' | 'user' | 'tag';
|
|
403
|
+
title: string;
|
|
404
|
+
snippet: string;
|
|
405
|
+
workspaceId: string;
|
|
406
|
+
url: string;
|
|
407
|
+
score: number;
|
|
408
|
+
highlightedAt: Date;
|
|
409
|
+
}
|
|
410
|
+
interface SearchParams {
|
|
411
|
+
query: string;
|
|
412
|
+
workspaceId?: string | null;
|
|
413
|
+
types?: Array<SearchResult['type']>;
|
|
414
|
+
limit?: number;
|
|
415
|
+
offset?: number;
|
|
416
|
+
}
|
|
417
|
+
interface GlobalSearchService {
|
|
418
|
+
search(params: SearchParams): Promise<{
|
|
419
|
+
results: SearchResult[];
|
|
420
|
+
total: number;
|
|
421
|
+
}>;
|
|
422
|
+
index(documentId: string, content: string, metadata: Record<string, unknown>): Promise<void>;
|
|
423
|
+
rebuildIndex(workspaceId?: string): Promise<{
|
|
424
|
+
indexed: number;
|
|
425
|
+
}>;
|
|
426
|
+
}
|
|
427
|
+
//#endregion
|
|
428
|
+
//#region src/pro-contract/compliance.d.ts
|
|
429
|
+
interface ComplianceJobSummary {
|
|
430
|
+
id: string;
|
|
431
|
+
type: 'export' | 'delete';
|
|
432
|
+
scope: 'user' | 'workspace';
|
|
433
|
+
targetId: string;
|
|
434
|
+
status: 'pending' | 'processing' | 'completed' | 'failed';
|
|
435
|
+
downloadUrl: string | null;
|
|
436
|
+
expiresAt: Date | null;
|
|
437
|
+
error: string | null;
|
|
438
|
+
requestedBy: string | null;
|
|
439
|
+
createdAt: Date;
|
|
440
|
+
completedAt: Date | null;
|
|
441
|
+
}
|
|
442
|
+
interface ComplianceService {
|
|
443
|
+
createExportJob(scope: 'user' | 'workspace', targetId: string, requestedBy?: string): Promise<{
|
|
444
|
+
id: string;
|
|
445
|
+
}>;
|
|
446
|
+
createDeleteJob(scope: 'user' | 'workspace', targetId: string, requestedBy?: string): Promise<{
|
|
447
|
+
id: string;
|
|
448
|
+
}>;
|
|
449
|
+
processJob(jobId: string): Promise<{
|
|
450
|
+
status: ComplianceJobSummary['status'];
|
|
451
|
+
error?: string;
|
|
452
|
+
}>;
|
|
453
|
+
listJobs(opts: {
|
|
454
|
+
status?: ComplianceJobSummary['status'];
|
|
455
|
+
page?: number;
|
|
456
|
+
pageSize?: number;
|
|
457
|
+
}): Promise<{
|
|
458
|
+
items: ComplianceJobSummary[];
|
|
459
|
+
total: number;
|
|
460
|
+
}>;
|
|
461
|
+
}
|
|
462
|
+
//#endregion
|
|
463
|
+
//#region src/pro-contract/module.d.ts
|
|
464
|
+
type ProEdition = 'oss' | 'pro';
|
|
465
|
+
type ProFeature = 'billing' | 'hostedAi' | 'sso' | 'audit' | 'permissions' | 'license' | 'versionHistory' | 'automation' | 'templates' | 'analytics' | 'globalSearch' | 'compliance';
|
|
466
|
+
interface ProModule {
|
|
467
|
+
readonly isAvailable: boolean;
|
|
468
|
+
readonly edition: ProEdition;
|
|
469
|
+
readonly version: string;
|
|
470
|
+
readonly billing: BillingService | null;
|
|
471
|
+
readonly hostedAi: HostedAiService | null;
|
|
472
|
+
readonly sso: SsoService | null;
|
|
473
|
+
readonly audit: AuditService | null;
|
|
474
|
+
readonly permissions: PermissionsService | null;
|
|
475
|
+
readonly license: LicenseService | null;
|
|
476
|
+
readonly versionHistory: VersionHistoryService | null;
|
|
477
|
+
readonly automation: AutomationService | null;
|
|
478
|
+
readonly templates: TemplatesService | null;
|
|
479
|
+
readonly analytics: AnalyticsService | null;
|
|
480
|
+
readonly globalSearch: GlobalSearchService | null;
|
|
481
|
+
readonly compliance: ComplianceService | null;
|
|
482
|
+
}
|
|
483
|
+
//#endregion
|
|
2
484
|
//#region src/contributions.d.ts
|
|
3
|
-
type
|
|
485
|
+
type Middleware = unknown;
|
|
486
|
+
type PluginRouteContext = {
|
|
487
|
+
params: Readonly<Record<string, string>>;
|
|
488
|
+
search?: unknown;
|
|
489
|
+
};
|
|
4
490
|
interface RouteContribution {
|
|
5
491
|
path: string;
|
|
6
|
-
|
|
492
|
+
beforeLoad?: (ctx: PluginRouteContext) => unknown;
|
|
493
|
+
loader?: (ctx: PluginRouteContext) => unknown;
|
|
494
|
+
component: ComponentType;
|
|
495
|
+
validateSearch?: (search: Record<string, unknown>) => Record<string, unknown>;
|
|
7
496
|
}
|
|
8
497
|
type QueryFactoryMap = Record<string, () => unknown>;
|
|
9
|
-
|
|
498
|
+
interface SettingsTabContribution {
|
|
499
|
+
labelKey: string;
|
|
500
|
+
path: string;
|
|
501
|
+
icon: ComponentType;
|
|
502
|
+
group?: string;
|
|
503
|
+
}
|
|
504
|
+
interface UiSlotContributions {
|
|
505
|
+
navItems?: Record<string, ComponentType>;
|
|
506
|
+
settingsTabs?: SettingsTabContribution[];
|
|
507
|
+
dashboardWidgets?: Record<string, ComponentType>;
|
|
508
|
+
}
|
|
10
509
|
interface FeatureContribution {
|
|
11
510
|
key: string;
|
|
12
|
-
tier:
|
|
13
|
-
module:
|
|
511
|
+
tier: 'oss' | 'paid' | 'enterprise';
|
|
512
|
+
module: ProFeature | null;
|
|
14
513
|
}
|
|
514
|
+
type ProServiceMap = Partial<Record<ProFeature, unknown>>;
|
|
15
515
|
interface PrismaContribution {
|
|
16
516
|
models: string[];
|
|
17
517
|
}
|
|
18
518
|
interface PluginContributions {
|
|
19
519
|
routes?: RouteContribution[];
|
|
20
|
-
serverMiddleware?:
|
|
520
|
+
serverMiddleware?: Middleware[];
|
|
21
521
|
queryOptions?: QueryFactoryMap;
|
|
22
|
-
uiSlots?:
|
|
522
|
+
uiSlots?: UiSlotContributions;
|
|
23
523
|
features?: FeatureContribution[];
|
|
24
524
|
aiTools?: unknown[];
|
|
25
525
|
prisma?: PrismaContribution;
|
|
526
|
+
services?: ProServiceMap;
|
|
26
527
|
}
|
|
27
528
|
//#endregion
|
|
28
529
|
//#region src/types.d.ts
|
|
@@ -50,6 +551,17 @@ interface ResolveResult {
|
|
|
50
551
|
}
|
|
51
552
|
declare function resolvePluginOrder(plugins: PluginDefinition[]): ResolveResult;
|
|
52
553
|
//#endregion
|
|
554
|
+
//#region src/assemble-input.d.ts
|
|
555
|
+
declare function parseProfileImports(source: string): Map<string, string>;
|
|
556
|
+
interface AssembleInput {
|
|
557
|
+
profileId: string;
|
|
558
|
+
profileModulePath: string;
|
|
559
|
+
resolved: ResolveResult;
|
|
560
|
+
imports: Map<string, string>;
|
|
561
|
+
pluginLocalNames: string[];
|
|
562
|
+
}
|
|
563
|
+
declare function resolveImportSpecifiers(input: AssembleInput): Map<string, string>;
|
|
564
|
+
//#endregion
|
|
53
565
|
//#region src/generate-assembly.d.ts
|
|
54
566
|
interface GenerateAssemblyInput {
|
|
55
567
|
profileId: string;
|
|
@@ -57,8 +569,33 @@ interface GenerateAssemblyInput {
|
|
|
57
569
|
resolved: ResolveResult;
|
|
58
570
|
}
|
|
59
571
|
declare function generateAssemblyCode(input: GenerateAssemblyInput): string;
|
|
572
|
+
interface AssemblyFiles {
|
|
573
|
+
pluginsGen: string;
|
|
574
|
+
modulesGen: string;
|
|
575
|
+
uiGen: string;
|
|
576
|
+
routeFiles: Map<string, string>;
|
|
577
|
+
}
|
|
578
|
+
declare function generateAssemblyFiles(input: AssembleInput): AssemblyFiles;
|
|
60
579
|
//#endregion
|
|
61
580
|
//#region src/dump-modules.d.ts
|
|
62
581
|
declare function dumpModules(profileId: string, resolved: ResolveResult): string;
|
|
63
582
|
//#endregion
|
|
64
|
-
|
|
583
|
+
//#region src/server-seam.d.ts
|
|
584
|
+
interface HostSession {
|
|
585
|
+
user?: {
|
|
586
|
+
id?: string;
|
|
587
|
+
role?: string | null;
|
|
588
|
+
[key: string]: unknown;
|
|
589
|
+
} | null;
|
|
590
|
+
[key: string]: unknown;
|
|
591
|
+
}
|
|
592
|
+
interface ServerSeam {
|
|
593
|
+
requireAuth: (request?: Request) => Promise<HostSession>;
|
|
594
|
+
requireUserInDb: (userId: string) => Promise<void>;
|
|
595
|
+
getCurrentSession: (request?: Request) => Promise<HostSession | null>;
|
|
596
|
+
isDesktop: () => boolean;
|
|
597
|
+
}
|
|
598
|
+
declare function registerServerSeam(impl: ServerSeam): void;
|
|
599
|
+
declare function getServerSeam(): ServerSeam;
|
|
600
|
+
//#endregion
|
|
601
|
+
export { type ActivationResult, type AiQuota, type AnalyticsQuery, type AnalyticsResult, type AnalyticsService, type AssembleInput, type AssemblyFiles, type AuditLogEntry, type AuditQuery, type AuditService, type AutomationRule, type AutomationService, type BillingService, BillingUnavailableError, type CheckoutParams, type ComplianceJobSummary, type ComplianceService, type CustomDashboard, type DocumentTemplate, type DocumentVersion, type FeatureContribution, type GlobalSearchService, type HostSession, type HostedAiChatParams, type HostedAiChatResult, HostedAiError, type HostedAiModel, type HostedAiService, type InvoiceInfo, type LicenseInfo, type LicenseIssueParams, type LicenseIssueResult, type LicenseService, type LicenseStatus, type Middleware, type PermissionLevel, type PermissionsService, type PlanInfo, type PluginContributions, type PluginDefinition, type PluginRouteContext, type PortalSessionParams, type PrismaContribution, type ProEdition, type ProFeature, type ProModule, type ProServiceMap, type ProfileDefinition, type QueryFactoryMap, type ResolveResult, type RoleDefinition, type RouteContribution, type SearchParams, type SearchResult, type SeatCheckResult, SeatsExceededError, type ServerSeam, type SettingsTabContribution, type SsoProvider, type SsoService, type SubscriptionInfo, type TemplatesService, type UiSlotContributions, type VersionHistoryService, WebhookSignatureError, definePlugin, defineProfile, dumpModules, generateAssemblyCode, generateAssemblyFiles, getServerSeam, parseProfileImports, registerServerSeam, resolveImportSpecifiers, resolvePluginOrder };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { definePlugin, defineProfile, dumpModules, generateAssemblyCode, resolvePluginOrder };
|
|
1
|
+
import { a as SeatsExceededError, c as generateAssemblyCode, d as resolveImportSpecifiers, f as resolvePluginOrder, i as BillingUnavailableError, l as generateAssemblyFiles, m as definePlugin, n as registerServerSeam, o as WebhookSignatureError, p as defineProfile, r as HostedAiError, s as dumpModules, t as getServerSeam, u as parseProfileImports } from "./src-B6_ZEkl9.js";
|
|
2
|
+
export { BillingUnavailableError, HostedAiError, SeatsExceededError, WebhookSignatureError, definePlugin, defineProfile, dumpModules, generateAssemblyCode, generateAssemblyFiles, getServerSeam, parseProfileImports, registerServerSeam, resolveImportSpecifiers, resolvePluginOrder };
|