@appthen/sdk-core 0.0.3 → 0.0.4
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/dist/index.d.ts +34 -0
- package/dist/index.js +11 -0
- package/dist-cjs/index.d.ts +34 -0
- package/dist-cjs/index.js +11 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -273,8 +273,17 @@ export interface CreateMessageInput {
|
|
|
273
273
|
status?: string;
|
|
274
274
|
metadata?: Record<string, unknown>;
|
|
275
275
|
}
|
|
276
|
+
/** 入口客户端信号:网关只认白名单 kind 与短 deviceId,用于运行时路由。 */
|
|
277
|
+
export interface ChatHubEntryClientSignal {
|
|
278
|
+
kind: 'web' | 'desktop' | 'mobile';
|
|
279
|
+
deviceId?: string;
|
|
280
|
+
}
|
|
281
|
+
/** 运行偏好:auto = 服务端按入口策略决定;cloud = 用户显式选择云端执行。 */
|
|
282
|
+
export type ChatHubRuntimePreference = 'auto' | 'cloud';
|
|
276
283
|
export interface CreateInternalMessageInput extends CreateMessageInput {
|
|
277
284
|
tenantId: string;
|
|
285
|
+
client?: ChatHubEntryClientSignal;
|
|
286
|
+
runtimePreference?: ChatHubRuntimePreference;
|
|
278
287
|
}
|
|
279
288
|
export interface QueryMessagesInput {
|
|
280
289
|
tenantId?: string;
|
|
@@ -440,6 +449,10 @@ export interface SendTextMessageOptions {
|
|
|
440
449
|
mentionedSubjectIds?: string[];
|
|
441
450
|
metadata?: Record<string, unknown>;
|
|
442
451
|
status?: string;
|
|
452
|
+
/** 这条消息从哪种客户端发出(运行时路由信号)。 */
|
|
453
|
+
client?: ChatHubEntryClientSignal;
|
|
454
|
+
/** 仅显式选择云端执行时传 `cloud`;默认不传 = 服务端按 auto 处理。 */
|
|
455
|
+
runtimePreference?: ChatHubRuntimePreference;
|
|
443
456
|
}
|
|
444
457
|
export interface SendChatHubMessageOptions {
|
|
445
458
|
conversationId: string;
|
|
@@ -450,6 +463,8 @@ export interface SendChatHubMessageOptions {
|
|
|
450
463
|
mentionedSubjectIds?: string[];
|
|
451
464
|
metadata?: Record<string, unknown>;
|
|
452
465
|
status?: string;
|
|
466
|
+
client?: ChatHubEntryClientSignal;
|
|
467
|
+
runtimePreference?: ChatHubRuntimePreference;
|
|
453
468
|
}
|
|
454
469
|
export interface ListChatHubMessagesOptions {
|
|
455
470
|
conversationId: string;
|
|
@@ -608,6 +623,12 @@ export interface PlatformProvisionTenantInput {
|
|
|
608
623
|
externalCorrelationId: string;
|
|
609
624
|
/** 该租户被授予的 platform scope,缺省 ['platform:subject:sync']。 */
|
|
610
625
|
grantScopes?: string[];
|
|
626
|
+
adminIdentifiers?: PlatformAdminIdentifier[];
|
|
627
|
+
adminDisplayName?: string;
|
|
628
|
+
}
|
|
629
|
+
export interface PlatformAdminIdentifier {
|
|
630
|
+
type: 'phone' | 'email';
|
|
631
|
+
value: string;
|
|
611
632
|
}
|
|
612
633
|
export interface PlatformProvisionTenantResult {
|
|
613
634
|
tenantId: string;
|
|
@@ -616,6 +637,8 @@ export interface PlatformProvisionTenantResult {
|
|
|
616
637
|
grantId: string;
|
|
617
638
|
/** 仅首次开通返回(7d 有效);认领激活时提交。 */
|
|
618
639
|
claimToken?: string;
|
|
640
|
+
inviteId?: string;
|
|
641
|
+
inviteUrl?: string;
|
|
619
642
|
/** false = 幂等命中(同 platformId + externalCorrelationId 已开通过)。 */
|
|
620
643
|
created: boolean;
|
|
621
644
|
[key: string]: unknown;
|
|
@@ -687,10 +710,21 @@ export interface PlatformResolveTenantResult {
|
|
|
687
710
|
status: string;
|
|
688
711
|
}>;
|
|
689
712
|
}
|
|
713
|
+
export interface PlatformAdminInviteInput {
|
|
714
|
+
adminIdentifiers: PlatformAdminIdentifier[];
|
|
715
|
+
adminDisplayName?: string;
|
|
716
|
+
}
|
|
717
|
+
export interface PlatformAdminInviteResult {
|
|
718
|
+
tenantId: string;
|
|
719
|
+
status: string;
|
|
720
|
+
inviteId: string;
|
|
721
|
+
inviteUrl: string;
|
|
722
|
+
}
|
|
690
723
|
export declare class PlatformApi extends BaseApi {
|
|
691
724
|
provisionTenant(input: PlatformProvisionTenantInput): Promise<PlatformProvisionTenantResult>;
|
|
692
725
|
syncSubject(targetTenantId: string, input: PlatformSyncSubjectInput): Promise<PlatformSyncSubjectResult>;
|
|
693
726
|
resolveTenant(externalCorrelationId: string): Promise<PlatformResolveTenantResult>;
|
|
727
|
+
createAdminInvite(tenantId: string, input: PlatformAdminInviteInput): Promise<PlatformAdminInviteResult>;
|
|
694
728
|
toggleGrant(grantId: string, status: 'active' | 'revoked'): Promise<Record<string, unknown>>;
|
|
695
729
|
/**
|
|
696
730
|
* 按标签/条件圈人并直接触达(声明式,调用方无 subjectId 概念):
|
package/dist/index.js
CHANGED
|
@@ -657,6 +657,8 @@ export class ChatHubAppRuntime {
|
|
|
657
657
|
mentionedSubjectIds: input.mentionedSubjectIds,
|
|
658
658
|
metadata: input.metadata,
|
|
659
659
|
status: input.status,
|
|
660
|
+
client: input.client,
|
|
661
|
+
runtimePreference: input.runtimePreference,
|
|
660
662
|
});
|
|
661
663
|
}
|
|
662
664
|
async sendMessage(input) {
|
|
@@ -671,6 +673,8 @@ export class ChatHubAppRuntime {
|
|
|
671
673
|
content: input.content,
|
|
672
674
|
mentionedSubjectIds: input.mentionedSubjectIds,
|
|
673
675
|
metadata: input.metadata,
|
|
676
|
+
client: input.client,
|
|
677
|
+
runtimePreference: input.runtimePreference,
|
|
674
678
|
});
|
|
675
679
|
}
|
|
676
680
|
async updateMessage(input) {
|
|
@@ -828,6 +832,13 @@ export class PlatformApi extends BaseApi {
|
|
|
828
832
|
query: { externalCorrelationId },
|
|
829
833
|
});
|
|
830
834
|
}
|
|
835
|
+
async createAdminInvite(tenantId, input) {
|
|
836
|
+
return this.request({
|
|
837
|
+
method: 'POST',
|
|
838
|
+
path: `/open-platform/platform/tenants/${encodeURIComponent(tenantId)}/admin-invites`,
|
|
839
|
+
body: input,
|
|
840
|
+
});
|
|
841
|
+
}
|
|
831
842
|
async toggleGrant(grantId, status) {
|
|
832
843
|
return this.request({
|
|
833
844
|
method: 'POST',
|
package/dist-cjs/index.d.ts
CHANGED
|
@@ -273,8 +273,17 @@ export interface CreateMessageInput {
|
|
|
273
273
|
status?: string;
|
|
274
274
|
metadata?: Record<string, unknown>;
|
|
275
275
|
}
|
|
276
|
+
/** 入口客户端信号:网关只认白名单 kind 与短 deviceId,用于运行时路由。 */
|
|
277
|
+
export interface ChatHubEntryClientSignal {
|
|
278
|
+
kind: 'web' | 'desktop' | 'mobile';
|
|
279
|
+
deviceId?: string;
|
|
280
|
+
}
|
|
281
|
+
/** 运行偏好:auto = 服务端按入口策略决定;cloud = 用户显式选择云端执行。 */
|
|
282
|
+
export type ChatHubRuntimePreference = 'auto' | 'cloud';
|
|
276
283
|
export interface CreateInternalMessageInput extends CreateMessageInput {
|
|
277
284
|
tenantId: string;
|
|
285
|
+
client?: ChatHubEntryClientSignal;
|
|
286
|
+
runtimePreference?: ChatHubRuntimePreference;
|
|
278
287
|
}
|
|
279
288
|
export interface QueryMessagesInput {
|
|
280
289
|
tenantId?: string;
|
|
@@ -440,6 +449,10 @@ export interface SendTextMessageOptions {
|
|
|
440
449
|
mentionedSubjectIds?: string[];
|
|
441
450
|
metadata?: Record<string, unknown>;
|
|
442
451
|
status?: string;
|
|
452
|
+
/** 这条消息从哪种客户端发出(运行时路由信号)。 */
|
|
453
|
+
client?: ChatHubEntryClientSignal;
|
|
454
|
+
/** 仅显式选择云端执行时传 `cloud`;默认不传 = 服务端按 auto 处理。 */
|
|
455
|
+
runtimePreference?: ChatHubRuntimePreference;
|
|
443
456
|
}
|
|
444
457
|
export interface SendChatHubMessageOptions {
|
|
445
458
|
conversationId: string;
|
|
@@ -450,6 +463,8 @@ export interface SendChatHubMessageOptions {
|
|
|
450
463
|
mentionedSubjectIds?: string[];
|
|
451
464
|
metadata?: Record<string, unknown>;
|
|
452
465
|
status?: string;
|
|
466
|
+
client?: ChatHubEntryClientSignal;
|
|
467
|
+
runtimePreference?: ChatHubRuntimePreference;
|
|
453
468
|
}
|
|
454
469
|
export interface ListChatHubMessagesOptions {
|
|
455
470
|
conversationId: string;
|
|
@@ -608,6 +623,12 @@ export interface PlatformProvisionTenantInput {
|
|
|
608
623
|
externalCorrelationId: string;
|
|
609
624
|
/** 该租户被授予的 platform scope,缺省 ['platform:subject:sync']。 */
|
|
610
625
|
grantScopes?: string[];
|
|
626
|
+
adminIdentifiers?: PlatformAdminIdentifier[];
|
|
627
|
+
adminDisplayName?: string;
|
|
628
|
+
}
|
|
629
|
+
export interface PlatformAdminIdentifier {
|
|
630
|
+
type: 'phone' | 'email';
|
|
631
|
+
value: string;
|
|
611
632
|
}
|
|
612
633
|
export interface PlatformProvisionTenantResult {
|
|
613
634
|
tenantId: string;
|
|
@@ -616,6 +637,8 @@ export interface PlatformProvisionTenantResult {
|
|
|
616
637
|
grantId: string;
|
|
617
638
|
/** 仅首次开通返回(7d 有效);认领激活时提交。 */
|
|
618
639
|
claimToken?: string;
|
|
640
|
+
inviteId?: string;
|
|
641
|
+
inviteUrl?: string;
|
|
619
642
|
/** false = 幂等命中(同 platformId + externalCorrelationId 已开通过)。 */
|
|
620
643
|
created: boolean;
|
|
621
644
|
[key: string]: unknown;
|
|
@@ -687,10 +710,21 @@ export interface PlatformResolveTenantResult {
|
|
|
687
710
|
status: string;
|
|
688
711
|
}>;
|
|
689
712
|
}
|
|
713
|
+
export interface PlatformAdminInviteInput {
|
|
714
|
+
adminIdentifiers: PlatformAdminIdentifier[];
|
|
715
|
+
adminDisplayName?: string;
|
|
716
|
+
}
|
|
717
|
+
export interface PlatformAdminInviteResult {
|
|
718
|
+
tenantId: string;
|
|
719
|
+
status: string;
|
|
720
|
+
inviteId: string;
|
|
721
|
+
inviteUrl: string;
|
|
722
|
+
}
|
|
690
723
|
export declare class PlatformApi extends BaseApi {
|
|
691
724
|
provisionTenant(input: PlatformProvisionTenantInput): Promise<PlatformProvisionTenantResult>;
|
|
692
725
|
syncSubject(targetTenantId: string, input: PlatformSyncSubjectInput): Promise<PlatformSyncSubjectResult>;
|
|
693
726
|
resolveTenant(externalCorrelationId: string): Promise<PlatformResolveTenantResult>;
|
|
727
|
+
createAdminInvite(tenantId: string, input: PlatformAdminInviteInput): Promise<PlatformAdminInviteResult>;
|
|
694
728
|
toggleGrant(grantId: string, status: 'active' | 'revoked'): Promise<Record<string, unknown>>;
|
|
695
729
|
/**
|
|
696
730
|
* 按标签/条件圈人并直接触达(声明式,调用方无 subjectId 概念):
|
package/dist-cjs/index.js
CHANGED
|
@@ -670,6 +670,8 @@ class ChatHubAppRuntime {
|
|
|
670
670
|
mentionedSubjectIds: input.mentionedSubjectIds,
|
|
671
671
|
metadata: input.metadata,
|
|
672
672
|
status: input.status,
|
|
673
|
+
client: input.client,
|
|
674
|
+
runtimePreference: input.runtimePreference,
|
|
673
675
|
});
|
|
674
676
|
}
|
|
675
677
|
async sendMessage(input) {
|
|
@@ -684,6 +686,8 @@ class ChatHubAppRuntime {
|
|
|
684
686
|
content: input.content,
|
|
685
687
|
mentionedSubjectIds: input.mentionedSubjectIds,
|
|
686
688
|
metadata: input.metadata,
|
|
689
|
+
client: input.client,
|
|
690
|
+
runtimePreference: input.runtimePreference,
|
|
687
691
|
});
|
|
688
692
|
}
|
|
689
693
|
async updateMessage(input) {
|
|
@@ -842,6 +846,13 @@ class PlatformApi extends BaseApi {
|
|
|
842
846
|
query: { externalCorrelationId },
|
|
843
847
|
});
|
|
844
848
|
}
|
|
849
|
+
async createAdminInvite(tenantId, input) {
|
|
850
|
+
return this.request({
|
|
851
|
+
method: 'POST',
|
|
852
|
+
path: `/open-platform/platform/tenants/${encodeURIComponent(tenantId)}/admin-invites`,
|
|
853
|
+
body: input,
|
|
854
|
+
});
|
|
855
|
+
}
|
|
845
856
|
async toggleGrant(grantId, status) {
|
|
846
857
|
return this.request({
|
|
847
858
|
method: 'POST',
|