@soonspacejs/plugin-cps-soonmanager 2.11.38 → 2.11.40

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/README.md CHANGED
@@ -1,5 +1,5 @@
1
- # @soonspacejs/plugin-cps-soonmanager
2
-
3
- > Sync cps soonmanager data plugin for SoonSpace.js
4
-
5
-
1
+ # @soonspacejs/plugin-cps-soonmanager
2
+
3
+ > Sync cps soonmanager data plugin for SoonSpace.js
4
+
5
+
@@ -0,0 +1,2 @@
1
+ import { Decrypt } from './types';
2
+ export declare const decryptV1: Decrypt;
@@ -0,0 +1,3 @@
1
+ import { Decrypt } from './types';
2
+ export declare const decryptV2: Decrypt;
3
+ export declare function decodeToBytes(input: string): Int8Array;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * BI编辑器中的SDK配置如下:
3
+ * - 内置调试公钥,并将其作为SDK的应用公钥
4
+ * - 关闭水印
5
+ BI桌面软件中的SDK配置如下:
6
+ * - 内置应用公钥
7
+ */
8
+ /**
9
+ * 动态注入
10
+ */
11
+ declare const _default: {
12
+ verifyKey: string;
13
+ debugKey: string;
14
+ key: string;
15
+ };
16
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import NodeRSA from 'node-rsa';
2
+ import { ITreeData, TLicense } from '../types';
3
+ export interface EncryptInfo {
4
+ verifyKey: string;
5
+ debugKey: string;
6
+ key: string;
7
+ }
8
+ export type Decrypt = (license: TLicense, nodeRsa: NodeRSA) => ITreeData[];
@@ -0,0 +1,31 @@
1
+ import { Object3D, OrthographicCamera, Vector4, Vector2 } from 'three';
2
+ import Viewport from 'soonspacejs/types/Viewport';
3
+ declare class WaterMark extends Object3D {
4
+ readonly viewport: Viewport;
5
+ fontSize: number;
6
+ imageWidth: number;
7
+ protected _size?: Vector2 | null;
8
+ get size(): Vector2;
9
+ set size(value: Vector2);
10
+ camera: OrthographicCamera;
11
+ direction: Vector2;
12
+ speed: number;
13
+ protected _velocity?: Vector2 | null;
14
+ get velocity(): Vector2;
15
+ set velocity(value: Vector2);
16
+ currViewport: Vector4;
17
+ constructor(viewport: Viewport);
18
+ lastRenderTime: number;
19
+ autoRender: (time: number) => void;
20
+ _generateMark(str?: number[] | string): void;
21
+ _generateMarkForString(str?: number[] | string): void;
22
+ _generateMarkForImage(url?: string, width?: number, height?: number): void;
23
+ _calculateImageSize(canvasWidth: number, canvasHeight: number, imgWidth: number, imgHeight: number): {
24
+ renderWidth: number;
25
+ renderHeight: number;
26
+ };
27
+ render(): void;
28
+ addToViewport(): void;
29
+ removeFromViewport(): void;
30
+ }
31
+ export { WaterMark, };
@@ -0,0 +1,15 @@
1
+ import PoiRendererPlugin from '@soonspacejs/plugin-poi-renderer';
2
+ import CpsManagerPlugin from '../';
3
+ import { ITreeData } from '../types';
4
+ import { SourceApiListInterface } from '../data-source/request-types';
5
+ import { PoiList } from './types';
6
+ declare class BatchUpdatePoi {
7
+ #private;
8
+ treeList: ITreeData[] | null;
9
+ poiList: PoiList[] | null;
10
+ plugin: PoiRendererPlugin;
11
+ cpsPlugin: CpsManagerPlugin;
12
+ constructor(treeList: ITreeData[] | null, poiList: PoiList[] | null, plugin: PoiRendererPlugin, cpsPlugin: CpsManagerPlugin);
13
+ batchPoi(api: SourceApiListInterface, data: any): void;
14
+ }
15
+ export default BatchUpdatePoi;
@@ -0,0 +1,16 @@
1
+ /// <reference types="node" />
2
+ import { IPublishPacket } from 'mqtt';
3
+ import { IPoiData, ITreeData, PoiContent } from '../types';
4
+ export type TFlatTreeNode = Record<ITreeData['id'], ITreeData>;
5
+ export type PoiList = IPoiData & {
6
+ contentData?: PoiContent;
7
+ };
8
+ export type ResponseMqttType = {
9
+ topic: string;
10
+ payload: Buffer;
11
+ packet: IPublishPacket;
12
+ };
13
+ export type ResponseSocketType = {
14
+ event: string;
15
+ message: any;
16
+ };
@@ -0,0 +1,18 @@
1
+ import { ITreeData } from '../types';
2
+ import { PoiList, TFlatTreeNode } from './types';
3
+ /**
4
+ * 重新生成树节点
5
+ * @param modelTree
6
+ */
7
+ export declare const regenerateNodes: (modelTree: ITreeData[]) => {
8
+ treeNodes: ITreeData[];
9
+ flatNodes: TFlatTreeNode;
10
+ };
11
+ export declare const getPoiByNodeId: (id: string, poiList: PoiList[]) => PoiList[];
12
+ /**
13
+ * 捕获 JSON.parse 错误
14
+ * @param str
15
+ * @returns
16
+ */
17
+ export declare const safeParseJSON: <T = any>(str: string) => T | null;
18
+ export declare const subjectTopicMqtt: (subject: string, topic: string) => boolean;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * 场景元数据
3
+ */
4
+ export declare const META_DATA_FILE_PATH = "/SceneMetadata.json";
5
+ /**
6
+ * 签名文件
7
+ */
8
+ export declare const SIGN_PATH = "/db/sign";
9
+ /**
10
+ * 模型树
11
+ */
12
+ export declare const TREE_DATA_FILE_PATH = "/db/tree_models.json";
13
+ /**
14
+ * poi
15
+ */
16
+ export declare const POI_DATA_FILE_PATH = "/db/pois.json";
17
+ /**
18
+ * poi
19
+ */
20
+ export declare const DATA_SOURCE_FILE_PATH = "/db/data_source.json";
21
+ /**
22
+ * 拓扑路径
23
+ */
24
+ export declare const TOPOLOGY_DATA_FILE_PATH = "/db/topology_paths.json";
25
+ /**
26
+ * 自定义属性
27
+ */
28
+ export declare const PROPERTIES_DATA_FLEE_PATH = "/db/properties.json";
29
+ /**
30
+ * 帧动画
31
+ */
32
+ export declare const ANIMATIONS_DATA_FILE_PATH = "/db/animations.json";
33
+ /**
34
+ * 模型视角
35
+ */
36
+ export declare const MODEL_VISIONS_DATA_FILE_PATH = "/db/model_visions.json";
37
+ /**
38
+ * 自定义属性 key
39
+ */
40
+ export declare const PROPERTIES_KEY = "properties";
41
+ /**
42
+ * 自定义属性 key
43
+ */
44
+ export declare const POI_PLUGIN_NAME = "poiRenderer";
@@ -0,0 +1,15 @@
1
+ import { ClientType, SourceOnEventType } from './types';
2
+ import { SourceApiListInterface, SourceEnvListInterface } from './request-types';
3
+ declare class DataSource {
4
+ #private;
5
+ sourceEnv: SourceEnvListInterface[];
6
+ sourceApi: SourceApiListInterface[];
7
+ constructor(sourceEnv: SourceEnvListInterface[], sourceApi: SourceApiListInterface[]);
8
+ on<T extends keyof SourceOnEventType>(eventName: T, callback: SourceOnEventType[T]): void;
9
+ getClientById(id: string): ClientType;
10
+ requestAll(): void;
11
+ requestById(ids: string[]): void;
12
+ closeAll(): void;
13
+ closeById(ids: string[]): void;
14
+ }
15
+ export default DataSource;
@@ -0,0 +1,193 @@
1
+ /**
2
+ * @description: 请求参数类型
3
+ */
4
+ export declare enum RequestParamsTypeEnum {
5
+ PARAMS = "params",
6
+ BODY = "body",
7
+ HEADERS = "headers"
8
+ }
9
+ /**
10
+ * @description: 协议
11
+ */
12
+ export declare enum ProtocolEnum {
13
+ HTTP = "HTTP",
14
+ MQTT = "MQTT",
15
+ WEBSOCKET = "WebSocket"
16
+ }
17
+ /**
18
+ * @description: 协议值
19
+ */
20
+ export declare enum ProtocolValueEnum {
21
+ HTTPS = "https://",
22
+ HTTP = "http://",
23
+ MQTTS = "wss://",
24
+ MQTT = "ws://",
25
+ WSS = "wss://",
26
+ WS = "ws://"
27
+ }
28
+ /**
29
+ * @description: 请求参数主体
30
+ */
31
+ export type RequestParamsObjType = {
32
+ [T: string]: string;
33
+ };
34
+ /**
35
+ * @description: 请求头部类型
36
+ */
37
+ export declare enum RequestBodyEnum {
38
+ NONE = "none",
39
+ FORM_DATA = "form-data",
40
+ X_WWW_FORM_URLENCODED = "x-www-form-urlencoded",
41
+ JSON = "json",
42
+ XML = "xml"
43
+ }
44
+ /**
45
+ * @description: 请求方法
46
+ */
47
+ export declare enum RequestHttpEnum {
48
+ GET = "GET",
49
+ POST = "POST",
50
+ PATCH = "PATCH",
51
+ PUT = "PUT",
52
+ OPTIONS = "OPTIONS",
53
+ DELETE = "DELETE"
54
+ }
55
+ /**
56
+ * @description: 请求间隔
57
+ */
58
+ export declare enum RequestHttpIntervalEnum {
59
+ SECOND = "second",
60
+ MINUTE = "minute",
61
+ HOUR = "hour",
62
+ DAY = "day"
63
+ }
64
+ /**
65
+ * @description: 导出包json文件类型
66
+ */
67
+ export type DataSourceType = {
68
+ dataSources: SourceEnvListInterface[];
69
+ dataSourceApis: SourceApiListInterface[];
70
+ };
71
+ /**
72
+ * @description: 数据源基础字段
73
+ */
74
+ export interface SourceBaseConfigInterface {
75
+ id: string;
76
+ url: string;
77
+ name: string;
78
+ [RequestParamsTypeEnum.HEADERS]: RequestParamsObjType;
79
+ protocol: ProtocolEnum;
80
+ protocolValue: ProtocolValueEnum;
81
+ modules: 'SOON_MANAGER';
82
+ }
83
+ /**
84
+ * @description: 环境
85
+ */
86
+ export interface SourceEnvListInterface extends SourceBaseConfigInterface {
87
+ apiNumber: number;
88
+ port?: number;
89
+ }
90
+ /**
91
+ * @description: 接口
92
+ */
93
+ export interface SourceApiListInterface extends SourceBaseConfigInterface {
94
+ sid: string;
95
+ componentsId?: string[];
96
+ configureJson: RequestConfigType;
97
+ method?: RequestHttpEnum;
98
+ nodeArray?: SourceApiRelation[];
99
+ fullUrl?: string;
100
+ }
101
+ export type RequestConfigType = HttpConfigInterface | WssConfigInterface | MqttConfigInterface;
102
+ /**
103
+ * @description: Http连接配置
104
+ */
105
+ export interface HttpConfigInterface {
106
+ [RequestParamsTypeEnum.PARAMS]: RequestParamsObjType;
107
+ [RequestParamsTypeEnum.BODY]: {
108
+ [RequestBodyEnum.FORM_DATA]: RequestParamsObjType;
109
+ [RequestBodyEnum.X_WWW_FORM_URLENCODED]: RequestParamsObjType;
110
+ [RequestBodyEnum.JSON]: string;
111
+ [RequestBodyEnum.XML]: string;
112
+ };
113
+ filter: string;
114
+ interval: number;
115
+ unit: RequestHttpIntervalEnum;
116
+ bodyType: RequestBodyEnum;
117
+ method: RequestHttpEnum;
118
+ }
119
+ /**
120
+ * @description: 长连接事件处理
121
+ */
122
+ export interface ConnectionEventInterface {
123
+ successCallback?: string;
124
+ errorCallback?: string;
125
+ }
126
+ /**
127
+ * @description: websocket连接配置
128
+ */
129
+ export interface WssConfigInterface extends ConnectionEventInterface {
130
+ nameSpace?: string;
131
+ subProtocols?: string;
132
+ eventList: WssEventList[];
133
+ query: RequestParamsObjType;
134
+ }
135
+ /**
136
+ * @description: websocket-事件
137
+ */
138
+ export interface WssEventList {
139
+ event: string;
140
+ remark?: string;
141
+ filter?: string;
142
+ }
143
+ /**
144
+ * @description: mqtt连接配置
145
+ */
146
+ export interface MqttConfigInterface extends ConnectionEventInterface {
147
+ baseConfig: MqttBaseConfig;
148
+ willMessage: MqttLastWillMessage;
149
+ subscription: MqttSubscription[];
150
+ }
151
+ export interface MqttBaseConfig {
152
+ version: 3 | 4 | 5;
153
+ clientId?: string;
154
+ username?: string;
155
+ password?: string;
156
+ keepAlive?: number;
157
+ }
158
+ export type QoS = 0 | 1 | 2;
159
+ export interface MqttLastWillMessage {
160
+ topic: string;
161
+ qos: QoS;
162
+ retain: boolean;
163
+ message: string;
164
+ }
165
+ export interface MqttSubscription {
166
+ topic: string;
167
+ qos: QoS;
168
+ remark?: string;
169
+ filter?: string;
170
+ }
171
+ export type OptionType = {
172
+ label: string;
173
+ value: string;
174
+ };
175
+ /**
176
+ * @description: 节点和接口的关联关系
177
+ */
178
+ export type SourceApiRelation = {
179
+ id: string;
180
+ apiId: string;
181
+ eventList?: string[];
182
+ nodeId: string;
183
+ projectId: string;
184
+ matchParams?: string;
185
+ };
186
+ export declare const ProtocolOption: OptionType[];
187
+ export declare enum ContentTypeEnum {
188
+ JSON = "application/json;charset=UTF-8",
189
+ TEXT = "text/plain;charset=UTF-8",
190
+ XML = "application/xml;charset=UTF-8",
191
+ FORM_URLENCODED = "application/x-www-form-urlencoded;charset=UTF-8",
192
+ FORM_DATA = "multipart/form-data"
193
+ }
@@ -0,0 +1,37 @@
1
+ import { MqttClient } from 'mqtt';
2
+ import { Socket } from 'socket.io-client';
3
+ import { HttpRequest } from './utils/http-request';
4
+ import { SourceApiListInterface } from './request-types';
5
+ export type ClientType = HttpRequest | MqttClient | Socket | undefined;
6
+ export type SourceClientListType = {
7
+ [T: string]: ClientType;
8
+ };
9
+ /**
10
+ * @description: 连接状态
11
+ */
12
+ export declare enum RequestStatusEnum {
13
+ SUCCESS = "success",
14
+ ERROR = "error",
15
+ CONNECT = "connect",
16
+ CLOSE = "close"
17
+ }
18
+ export type SourceOnEventType = {
19
+ onStatus: SourceStatusCallbackType;
20
+ onMessage: SourceMessageCallbackType;
21
+ };
22
+ export type SourceOnEventNameType = 'onMessage' | 'onStatus';
23
+ export type SourceStatusCallbackType = (info: SourceStatusType) => void;
24
+ export type SourceMessageCallbackType = (info: SourceMessageType) => void;
25
+ export type SourceCallBackBaseType = {
26
+ api: SourceApiListInterface;
27
+ client: ClientType;
28
+ };
29
+ export type SourceStatusType = SourceCallBackBaseType & InfoStatusType;
30
+ export type SourceMessageType = SourceCallBackBaseType & InfoMessageType;
31
+ export type InfoStatusType = {
32
+ status: RequestStatusEnum;
33
+ message?: Error;
34
+ };
35
+ export type InfoMessageType = {
36
+ data: any;
37
+ };
@@ -0,0 +1,72 @@
1
+ export interface HttpRequesttOptionInterface {
2
+ method?: string;
3
+ protocol?: string;
4
+ headers?: RequestParamsObjType;
5
+ params?: RequestParamsObjType;
6
+ body?: string | FormData | RequestParamsObjType | null;
7
+ interval?: number;
8
+ timeout?: number;
9
+ responseType?: XMLHttpRequestResponseType;
10
+ filter?: ((response: any) => any) | string;
11
+ }
12
+ /**
13
+ * @description: 请求参数主体
14
+ */
15
+ type RequestParamsObjType = {
16
+ [T: string]: string;
17
+ };
18
+ export type RequestEventNameType = 'onSuccess' | 'onError' | 'onStatus';
19
+ export declare class HttpRequest {
20
+ url: string;
21
+ method: string;
22
+ protocol: string;
23
+ params?: RequestParamsObjType;
24
+ headers?: RequestParamsObjType;
25
+ body: any | string | FormData | RequestParamsObjType | null;
26
+ filter?: any;
27
+ interval: number;
28
+ timeout: number;
29
+ responseType: XMLHttpRequestResponseType;
30
+ responseData: any;
31
+ filteredData: any | null;
32
+ option?: HttpRequesttOptionInterface;
33
+ XHR: XMLHttpRequest | undefined;
34
+ private isInterval;
35
+ private successCallback;
36
+ private errorCallback;
37
+ private statusCallback;
38
+ constructor(url: string, option?: HttpRequesttOptionInterface);
39
+ get getUrl(): string;
40
+ get getOption(): {
41
+ url: string;
42
+ method?: string | undefined;
43
+ protocol?: string | undefined;
44
+ headers?: RequestParamsObjType | undefined;
45
+ params?: RequestParamsObjType | undefined;
46
+ body?: string | RequestParamsObjType | FormData | null | undefined;
47
+ interval?: number | undefined;
48
+ timeout?: number | undefined;
49
+ responseType?: XMLHttpRequestResponseType | undefined;
50
+ filter?: string | ((response: any) => any) | undefined;
51
+ };
52
+ get getStatus(): number | undefined;
53
+ get getRequesting(): boolean;
54
+ get getResponseData(): any;
55
+ get getFilterData(): any;
56
+ send(): void;
57
+ abort(): void;
58
+ onceSend(): void;
59
+ listen(successCallback: (response: any, filteredData: any) => void, errorCallback?: (error: Error) => void): void;
60
+ on(eventName: RequestEventNameType, callback: any): void;
61
+ private onStatusCallback;
62
+ private onErrorCallback;
63
+ private onSuccessCallback;
64
+ private request;
65
+ private circulateRequest;
66
+ private onTimeout;
67
+ private onLoad;
68
+ private onError;
69
+ private paramsUrl;
70
+ private toObject;
71
+ }
72
+ export {};
@@ -0,0 +1,4 @@
1
+ import { HttpRequest } from './http-request';
2
+ import { SourceApiListInterface, SourceEnvListInterface } from '../request-types';
3
+ import { SourceMessageCallbackType, SourceStatusCallbackType } from '../types';
4
+ export declare function requestHttp(api: SourceApiListInterface, env: SourceEnvListInterface, onStatus: SourceStatusCallbackType, onMessage: SourceMessageCallbackType): HttpRequest;
@@ -0,0 +1,4 @@
1
+ export * from './http';
2
+ export * from './mqtt';
3
+ export * from './socket';
4
+ export * from './utils';
@@ -0,0 +1,4 @@
1
+ import mqtt from 'mqtt';
2
+ import { SourceApiListInterface, SourceEnvListInterface } from '../request-types';
3
+ import { SourceMessageCallbackType, SourceStatusCallbackType } from '../types';
4
+ export declare function requestMqtt(api: SourceApiListInterface, env: SourceEnvListInterface, onStatus: SourceStatusCallbackType, onMessage: SourceMessageCallbackType): mqtt.MqttClient;
@@ -0,0 +1,4 @@
1
+ import { Socket } from 'socket.io-client';
2
+ import { SourceApiListInterface, SourceEnvListInterface } from '../request-types';
3
+ import { SourceMessageCallbackType, SourceStatusCallbackType } from '../types';
4
+ export declare function requestSocket(api: SourceApiListInterface, env: SourceEnvListInterface, onStatus: SourceStatusCallbackType, onMessage: SourceMessageCallbackType): Socket<import("@socket.io/component-emitter").DefaultEventsMap, import("@socket.io/component-emitter").DefaultEventsMap>;
@@ -0,0 +1,18 @@
1
+ import { RequestHttpIntervalEnum, RequestParamsObjType, SourceEnvListInterface } from '../request-types';
2
+ export declare function has<T>(object: T, key: string): boolean;
3
+ export declare function isNumber(value: any): boolean;
4
+ export declare function isObject(value: any): boolean;
5
+ export declare function getEnvUrl(env: SourceEnvListInterface): string;
6
+ export declare function intervalUnitHandle(num: number, unit: RequestHttpIntervalEnum): number;
7
+ export declare function encodeFormData(data: RequestParamsObjType): string;
8
+ export declare function toString(str: any): any;
9
+ /**
10
+ * * 函数过滤器
11
+ * @param data 数据值
12
+ * @param funcStr 函数字符串
13
+ * @param toString 转为字符串
14
+ * @param errorCallBack 错误回调函数
15
+ * @param successCallBack 成功回调函数
16
+ * @returns
17
+ */
18
+ export declare function newFunctionHandle(data: any, funcStr: string, extractData?: boolean, isToString?: boolean, errorCallBack?: (s: any) => void, successCallBack?: (s: any) => void): any;