@appthen/sdk-core 0.0.0 → 0.0.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/dist/index.d.ts +51 -0
- package/dist/index.js +13 -0
- package/dist-cjs/index.d.ts +51 -0
- package/dist-cjs/index.js +13 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -612,5 +612,56 @@ export declare class PlatformApi extends BaseApi {
|
|
|
612
612
|
syncSubject(targetTenantId: string, input: PlatformSyncSubjectInput): Promise<PlatformSyncSubjectResult>;
|
|
613
613
|
resolveTenant(externalCorrelationId: string): Promise<PlatformResolveTenantResult>;
|
|
614
614
|
toggleGrant(grantId: string, status: 'active' | 'revoked'): Promise<Record<string, unknown>>;
|
|
615
|
+
/**
|
|
616
|
+
* 按标签/条件圈人并直接触达(声明式,调用方无 subjectId 概念):
|
|
617
|
+
* 发送者/收件人按 {source, externalKey, displayName, avatarUrl?} 声明,
|
|
618
|
+
* 服务端 lazily create-or-get(幂等键 = externalIdentity,与成员同步同一内核);
|
|
619
|
+
* 收件人二选一:标签圈人(selector)或单点声明(receive,如微信客服消息迁移)。
|
|
620
|
+
*/
|
|
621
|
+
notify(targetTenantId: string, request: PlatformNotifyRequest, notify: PlatformNotifyInput): Promise<PlatformNotifyResult>;
|
|
622
|
+
}
|
|
623
|
+
/** 声明式主体引用:调用方只需本地维护 id/昵称/头像,服务端 lazily create-or-get。 */
|
|
624
|
+
export interface PlatformLazySubject {
|
|
625
|
+
source: string;
|
|
626
|
+
externalKey: string;
|
|
627
|
+
displayName: string;
|
|
628
|
+
avatarUrl?: string;
|
|
629
|
+
}
|
|
630
|
+
export interface PlatformNotifySelector {
|
|
631
|
+
/** 圈人标签(多个取交集)。命名须带来源前缀,如 lims:role:admin。 */
|
|
632
|
+
tags: string[];
|
|
633
|
+
/** 限定主体类(可选)。 */
|
|
634
|
+
classId?: string;
|
|
635
|
+
}
|
|
636
|
+
export interface PlatformNotifyRequest {
|
|
637
|
+
/** 标签圈人(与 receive 二选一)。 */
|
|
638
|
+
selector?: PlatformNotifySelector;
|
|
639
|
+
/** 单点声明收件人(与 selector 二选一)。 */
|
|
640
|
+
receive?: PlatformLazySubject;
|
|
641
|
+
}
|
|
642
|
+
export interface PlatformNotifyInput {
|
|
643
|
+
/** 本次触达涉及的外部主体类(lazy 创建 sender/receiver 所用)。 */
|
|
644
|
+
classId: string;
|
|
645
|
+
/** 消息发送者(声明式,lazily create-or-get)。 */
|
|
646
|
+
sender: PlatformLazySubject;
|
|
647
|
+
/** 通知会话类型(须已存在;AppThen 侧预建或经 open/types 创建)。 */
|
|
648
|
+
typeId: string;
|
|
649
|
+
/** 消息类型('text' 起,语音播报后续走 kind 扩展)。 */
|
|
650
|
+
kind: string;
|
|
651
|
+
content: Record<string, unknown>;
|
|
652
|
+
/** 通知会话标题(首次创建时使用,默认「LIMS 通知」)。 */
|
|
653
|
+
title?: string;
|
|
654
|
+
metadata?: Record<string, unknown>;
|
|
655
|
+
}
|
|
656
|
+
export interface PlatformNotifyResult {
|
|
657
|
+
/** 圈中人数。 */
|
|
658
|
+
matched: number;
|
|
659
|
+
/** 成功送达人数。 */
|
|
660
|
+
delivered: number;
|
|
661
|
+
/** 失败明细(含原因,不中断整体)。 */
|
|
662
|
+
failed: Array<{
|
|
663
|
+
subjectId: string;
|
|
664
|
+
reason: string;
|
|
665
|
+
}>;
|
|
615
666
|
}
|
|
616
667
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -786,4 +786,17 @@ export class PlatformApi extends BaseApi {
|
|
|
786
786
|
body: { status },
|
|
787
787
|
});
|
|
788
788
|
}
|
|
789
|
+
/**
|
|
790
|
+
* 按标签/条件圈人并直接触达(声明式,调用方无 subjectId 概念):
|
|
791
|
+
* 发送者/收件人按 {source, externalKey, displayName, avatarUrl?} 声明,
|
|
792
|
+
* 服务端 lazily create-or-get(幂等键 = externalIdentity,与成员同步同一内核);
|
|
793
|
+
* 收件人二选一:标签圈人(selector)或单点声明(receive,如微信客服消息迁移)。
|
|
794
|
+
*/
|
|
795
|
+
async notify(targetTenantId, request, notify) {
|
|
796
|
+
return this.request({
|
|
797
|
+
method: 'POST',
|
|
798
|
+
path: '/open-platform/platform/messages:send',
|
|
799
|
+
body: { ...notify, ...request, targetTenantId },
|
|
800
|
+
});
|
|
801
|
+
}
|
|
789
802
|
}
|
package/dist-cjs/index.d.ts
CHANGED
|
@@ -612,5 +612,56 @@ export declare class PlatformApi extends BaseApi {
|
|
|
612
612
|
syncSubject(targetTenantId: string, input: PlatformSyncSubjectInput): Promise<PlatformSyncSubjectResult>;
|
|
613
613
|
resolveTenant(externalCorrelationId: string): Promise<PlatformResolveTenantResult>;
|
|
614
614
|
toggleGrant(grantId: string, status: 'active' | 'revoked'): Promise<Record<string, unknown>>;
|
|
615
|
+
/**
|
|
616
|
+
* 按标签/条件圈人并直接触达(声明式,调用方无 subjectId 概念):
|
|
617
|
+
* 发送者/收件人按 {source, externalKey, displayName, avatarUrl?} 声明,
|
|
618
|
+
* 服务端 lazily create-or-get(幂等键 = externalIdentity,与成员同步同一内核);
|
|
619
|
+
* 收件人二选一:标签圈人(selector)或单点声明(receive,如微信客服消息迁移)。
|
|
620
|
+
*/
|
|
621
|
+
notify(targetTenantId: string, request: PlatformNotifyRequest, notify: PlatformNotifyInput): Promise<PlatformNotifyResult>;
|
|
622
|
+
}
|
|
623
|
+
/** 声明式主体引用:调用方只需本地维护 id/昵称/头像,服务端 lazily create-or-get。 */
|
|
624
|
+
export interface PlatformLazySubject {
|
|
625
|
+
source: string;
|
|
626
|
+
externalKey: string;
|
|
627
|
+
displayName: string;
|
|
628
|
+
avatarUrl?: string;
|
|
629
|
+
}
|
|
630
|
+
export interface PlatformNotifySelector {
|
|
631
|
+
/** 圈人标签(多个取交集)。命名须带来源前缀,如 lims:role:admin。 */
|
|
632
|
+
tags: string[];
|
|
633
|
+
/** 限定主体类(可选)。 */
|
|
634
|
+
classId?: string;
|
|
635
|
+
}
|
|
636
|
+
export interface PlatformNotifyRequest {
|
|
637
|
+
/** 标签圈人(与 receive 二选一)。 */
|
|
638
|
+
selector?: PlatformNotifySelector;
|
|
639
|
+
/** 单点声明收件人(与 selector 二选一)。 */
|
|
640
|
+
receive?: PlatformLazySubject;
|
|
641
|
+
}
|
|
642
|
+
export interface PlatformNotifyInput {
|
|
643
|
+
/** 本次触达涉及的外部主体类(lazy 创建 sender/receiver 所用)。 */
|
|
644
|
+
classId: string;
|
|
645
|
+
/** 消息发送者(声明式,lazily create-or-get)。 */
|
|
646
|
+
sender: PlatformLazySubject;
|
|
647
|
+
/** 通知会话类型(须已存在;AppThen 侧预建或经 open/types 创建)。 */
|
|
648
|
+
typeId: string;
|
|
649
|
+
/** 消息类型('text' 起,语音播报后续走 kind 扩展)。 */
|
|
650
|
+
kind: string;
|
|
651
|
+
content: Record<string, unknown>;
|
|
652
|
+
/** 通知会话标题(首次创建时使用,默认「LIMS 通知」)。 */
|
|
653
|
+
title?: string;
|
|
654
|
+
metadata?: Record<string, unknown>;
|
|
655
|
+
}
|
|
656
|
+
export interface PlatformNotifyResult {
|
|
657
|
+
/** 圈中人数。 */
|
|
658
|
+
matched: number;
|
|
659
|
+
/** 成功送达人数。 */
|
|
660
|
+
delivered: number;
|
|
661
|
+
/** 失败明细(含原因,不中断整体)。 */
|
|
662
|
+
failed: Array<{
|
|
663
|
+
subjectId: string;
|
|
664
|
+
reason: string;
|
|
665
|
+
}>;
|
|
615
666
|
}
|
|
616
667
|
export {};
|
package/dist-cjs/index.js
CHANGED
|
@@ -798,5 +798,18 @@ class PlatformApi extends BaseApi {
|
|
|
798
798
|
body: { status },
|
|
799
799
|
});
|
|
800
800
|
}
|
|
801
|
+
/**
|
|
802
|
+
* 按标签/条件圈人并直接触达(声明式,调用方无 subjectId 概念):
|
|
803
|
+
* 发送者/收件人按 {source, externalKey, displayName, avatarUrl?} 声明,
|
|
804
|
+
* 服务端 lazily create-or-get(幂等键 = externalIdentity,与成员同步同一内核);
|
|
805
|
+
* 收件人二选一:标签圈人(selector)或单点声明(receive,如微信客服消息迁移)。
|
|
806
|
+
*/
|
|
807
|
+
async notify(targetTenantId, request, notify) {
|
|
808
|
+
return this.request({
|
|
809
|
+
method: 'POST',
|
|
810
|
+
path: '/open-platform/platform/messages:send',
|
|
811
|
+
body: { ...notify, ...request, targetTenantId },
|
|
812
|
+
});
|
|
813
|
+
}
|
|
801
814
|
}
|
|
802
815
|
exports.PlatformApi = PlatformApi;
|