wjx-api-sdk 0.1.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/LICENSE +21 -0
- package/README.md +300 -0
- package/dist/core/api-client.d.ts +13 -0
- package/dist/core/api-client.js +141 -0
- package/dist/core/api-client.js.map +1 -0
- package/dist/core/constants.d.ts +61 -0
- package/dist/core/constants.js +82 -0
- package/dist/core/constants.js.map +1 -0
- package/dist/core/types.d.ts +26 -0
- package/dist/core/types.js +2 -0
- package/dist/core/types.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/modules/analytics/compute.d.ts +14 -0
- package/dist/modules/analytics/compute.js +205 -0
- package/dist/modules/analytics/compute.js.map +1 -0
- package/dist/modules/analytics/push-decode.d.ts +12 -0
- package/dist/modules/analytics/push-decode.js +46 -0
- package/dist/modules/analytics/push-decode.js.map +1 -0
- package/dist/modules/analytics/types.d.ts +61 -0
- package/dist/modules/analytics/types.js +3 -0
- package/dist/modules/analytics/types.js.map +1 -0
- package/dist/modules/contacts/client.d.ts +16 -0
- package/dist/modules/contacts/client.js +129 -0
- package/dist/modules/contacts/client.js.map +1 -0
- package/dist/modules/contacts/types.d.ts +62 -0
- package/dist/modules/contacts/types.js +2 -0
- package/dist/modules/contacts/types.js.map +1 -0
- package/dist/modules/multi-user/client.d.ts +7 -0
- package/dist/modules/multi-user/client.js +70 -0
- package/dist/modules/multi-user/client.js.map +1 -0
- package/dist/modules/multi-user/types.d.ts +31 -0
- package/dist/modules/multi-user/types.js +2 -0
- package/dist/modules/multi-user/types.js.map +1 -0
- package/dist/modules/response/client.d.ts +12 -0
- package/dist/modules/response/client.js +169 -0
- package/dist/modules/response/client.js.map +1 -0
- package/dist/modules/response/types.d.ts +83 -0
- package/dist/modules/response/types.js +2 -0
- package/dist/modules/response/types.js.map +1 -0
- package/dist/modules/sso/client.d.ts +22 -0
- package/dist/modules/sso/client.js +101 -0
- package/dist/modules/sso/client.js.map +1 -0
- package/dist/modules/sso/types.d.ts +75 -0
- package/dist/modules/sso/types.js +2 -0
- package/dist/modules/sso/types.js.map +1 -0
- package/dist/modules/survey/client.d.ts +13 -0
- package/dist/modules/survey/client.js +140 -0
- package/dist/modules/survey/client.js.map +1 -0
- package/dist/modules/survey/survey-to-text.d.ts +17 -0
- package/dist/modules/survey/survey-to-text.js +237 -0
- package/dist/modules/survey/survey-to-text.js.map +1 -0
- package/dist/modules/survey/text-to-survey.d.ts +9 -0
- package/dist/modules/survey/text-to-survey.js +175 -0
- package/dist/modules/survey/text-to-survey.js.map +1 -0
- package/dist/modules/survey/types.d.ts +170 -0
- package/dist/modules/survey/types.js +2 -0
- package/dist/modules/survey/types.js.map +1 -0
- package/dist/modules/user-system/client.d.ts +8 -0
- package/dist/modules/user-system/client.js +76 -0
- package/dist/modules/user-system/client.js.map +1 -0
- package/dist/modules/user-system/types.d.ts +41 -0
- package/dist/modules/user-system/types.js +2 -0
- package/dist/modules/user-system/types.js.map +1 -0
- package/package.json +38 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { getWjxBaseUrl, getWjxApiUrl, getWjxUserSystemApiUrl, getWjxSubuserApiUrl, getWjxContactsApiUrl, getWjxSsoSubaccountUrl, getWjxSsoUserSystemUrl, getWjxSsoPartnerUrl, getWjxSurveyCreateUrl, getWjxSurveyEditUrl, Action, DEFAULT_TIMEOUT_MS, DEFAULT_MAX_RETRIES, RETRY_DELAY_MS, } from "./core/constants.js";
|
|
2
|
+
export type { WjxCredentials, WjxApiSuccess, WjxApiFailure, WjxApiResponse, FetchLike, RequestOptions, Logger, } from "./core/types.js";
|
|
3
|
+
export { setCredentialProvider, getWjxCredentials, validateQuestionsJson, callWjxApi, callWjxUserSystemApi, callWjxSubuserApi, callWjxContactsApi, getCorpId, } from "./core/api-client.js";
|
|
4
|
+
export { createSurvey, getSurvey, listSurveys, updateSurveyStatus, getSurveySettings, updateSurveySettings, deleteSurvey, getQuestionTags, getTagDetails, clearRecycleBin, uploadFile, } from "./modules/survey/client.js";
|
|
5
|
+
export { surveyToText, typeToLabel, stripHtml } from "./modules/survey/survey-to-text.js";
|
|
6
|
+
export { textToSurvey } from "./modules/survey/text-to-survey.js";
|
|
7
|
+
export type { CreateSurveyInput, GetSurveyInput, ListSurveysInput, UpdateSurveyStatusInput, GetSurveySettingsInput, UpdateSurveySettingsInput, DeleteSurveyInput, GetQuestionTagsInput, GetTagDetailsInput, ClearRecycleBinInput, UploadFileInput, SurveyQuestionItem, SurveyQuestion, SurveyDetail, ParsedQuestion, ParsedSurvey, } from "./modules/survey/types.js";
|
|
8
|
+
export { queryResponses, queryResponsesRealtime, downloadResponses, getReport, submitResponse, getFileLinks, getWinners, modifyResponse, get360Report, clearResponses, } from "./modules/response/client.js";
|
|
9
|
+
export type { QueryResponsesInput, QueryResponsesRealtimeInput, DownloadResponsesInput, GetReportInput, SubmitResponseInput, GetFileLinksInput, GetWinnersInput, ModifyResponseInput, Get360ReportInput, ClearResponsesInput, } from "./modules/response/types.js";
|
|
10
|
+
export { queryContacts, addContacts, deleteContacts, addAdmin, deleteAdmin, restoreAdmin, listDepartments, addDepartment, modifyDepartment, deleteDepartment, listTags, addTag, modifyTag, deleteTag, } from "./modules/contacts/client.js";
|
|
11
|
+
export type { QueryContactsInput, AddContactsInput, DeleteContactsInput, AddAdminInput, DeleteAdminInput, RestoreAdminInput, ListDepartmentsInput, AddDepartmentInput, ModifyDepartmentInput, DeleteDepartmentInput, ListTagsInput, AddTagInput, ModifyTagInput, DeleteTagInput, } from "./modules/contacts/types.js";
|
|
12
|
+
export { addParticipants, modifyParticipants, deleteParticipants, bindActivity, querySurveyBinding, queryUserSurveys, } from "./modules/user-system/client.js";
|
|
13
|
+
export type { AddParticipantsInput, ModifyParticipantsInput, DeleteParticipantsInput, BindActivityInput, QuerySurveyBindingInput, QueryUserSurveysInput, } from "./modules/user-system/types.js";
|
|
14
|
+
export { addSubAccount, modifySubAccount, deleteSubAccount, restoreSubAccount, querySubAccounts, } from "./modules/multi-user/client.js";
|
|
15
|
+
export type { AddSubAccountInput, ModifySubAccountInput, DeleteSubAccountInput, RestoreSubAccountInput, QuerySubAccountsInput, } from "./modules/multi-user/types.js";
|
|
16
|
+
export { buildSsoSubaccountUrl, buildSsoUserSystemUrl, buildSsoPartnerUrl, buildSurveyUrl, buildPreviewUrl, } from "./modules/sso/client.js";
|
|
17
|
+
export type { SsoSubaccountInput, SsoUserSystemInput, SsoPartnerInput, BuildSurveyUrlInput, BuildPreviewUrlInput, } from "./modules/sso/types.js";
|
|
18
|
+
export { decodeResponses, calculateNps, calculateCsat, detectAnomalies, compareMetrics, } from "./modules/analytics/compute.js";
|
|
19
|
+
export { decodePushPayload } from "./modules/analytics/push-decode.js";
|
|
20
|
+
export type { DecodedAnswer, DecodeResponsesResult, NpsResult, CsatResult, AnomalyFlag, AnomalyResult, MetricComparison, CompareResult, PushDecodeResult, } from "./modules/analytics/types.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Core exports
|
|
2
|
+
export { getWjxBaseUrl, getWjxApiUrl, getWjxUserSystemApiUrl, getWjxSubuserApiUrl, getWjxContactsApiUrl, getWjxSsoSubaccountUrl, getWjxSsoUserSystemUrl, getWjxSsoPartnerUrl, getWjxSurveyCreateUrl, getWjxSurveyEditUrl, Action, DEFAULT_TIMEOUT_MS, DEFAULT_MAX_RETRIES, RETRY_DELAY_MS, } from "./core/constants.js";
|
|
3
|
+
export { setCredentialProvider, getWjxCredentials, validateQuestionsJson, callWjxApi, callWjxUserSystemApi, callWjxSubuserApi, callWjxContactsApi, getCorpId, } from "./core/api-client.js";
|
|
4
|
+
// Survey module
|
|
5
|
+
export { createSurvey, getSurvey, listSurveys, updateSurveyStatus, getSurveySettings, updateSurveySettings, deleteSurvey, getQuestionTags, getTagDetails, clearRecycleBin, uploadFile, } from "./modules/survey/client.js";
|
|
6
|
+
export { surveyToText, typeToLabel, stripHtml } from "./modules/survey/survey-to-text.js";
|
|
7
|
+
export { textToSurvey } from "./modules/survey/text-to-survey.js";
|
|
8
|
+
// Response module
|
|
9
|
+
export { queryResponses, queryResponsesRealtime, downloadResponses, getReport, submitResponse, getFileLinks, getWinners, modifyResponse, get360Report, clearResponses, } from "./modules/response/client.js";
|
|
10
|
+
// Contacts module
|
|
11
|
+
export { queryContacts, addContacts, deleteContacts, addAdmin, deleteAdmin, restoreAdmin, listDepartments, addDepartment, modifyDepartment, deleteDepartment, listTags, addTag, modifyTag, deleteTag, } from "./modules/contacts/client.js";
|
|
12
|
+
// User System module
|
|
13
|
+
export { addParticipants, modifyParticipants, deleteParticipants, bindActivity, querySurveyBinding, queryUserSurveys, } from "./modules/user-system/client.js";
|
|
14
|
+
// Multi-User module
|
|
15
|
+
export { addSubAccount, modifySubAccount, deleteSubAccount, restoreSubAccount, querySubAccounts, } from "./modules/multi-user/client.js";
|
|
16
|
+
// SSO module
|
|
17
|
+
export { buildSsoSubaccountUrl, buildSsoUserSystemUrl, buildSsoPartnerUrl, buildSurveyUrl, buildPreviewUrl, } from "./modules/sso/client.js";
|
|
18
|
+
// Analytics module
|
|
19
|
+
export { decodeResponses, calculateNps, calculateCsat, detectAnomalies, compareMetrics, } from "./modules/analytics/compute.js";
|
|
20
|
+
export { decodePushPayload } from "./modules/analytics/push-decode.js";
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EACL,aAAa,EACb,YAAY,EACZ,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,MAAM,EACN,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,GACf,MAAM,qBAAqB,CAAC;AAU7B,O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EACL,eAAe,EACf,YAAY,EACZ,aAAa,EACb,eAAe,EACf,cAAc,GACf,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DecodeResponsesResult, NpsResult, CsatResult, AnomalyResult, CompareResult } from "./types.js";
|
|
2
|
+
export declare function decodeResponses(submitdata: string): DecodeResponsesResult;
|
|
3
|
+
export declare function calculateNps(scores: number[]): NpsResult;
|
|
4
|
+
export declare function calculateCsat(scores: number[], scaleType?: "5-point" | "7-point"): CsatResult;
|
|
5
|
+
interface ResponseRecord {
|
|
6
|
+
id: string | number;
|
|
7
|
+
answers?: (string | number)[];
|
|
8
|
+
duration_seconds?: number;
|
|
9
|
+
ip?: string;
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
}
|
|
12
|
+
export declare function detectAnomalies(responses: ResponseRecord[]): AnomalyResult;
|
|
13
|
+
export declare function compareMetrics(setA: Record<string, number>, setB: Record<string, number>): CompareResult;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
// ─── decodeResponses ─────────────────────────────────────────────────────────
|
|
2
|
+
// Format: "题号$答案}题号$答案"
|
|
3
|
+
// Multi-choice answers use pipe separator: "1|2|3"
|
|
4
|
+
// Matrix answers use comma-separated sub-answers: "row1_col1,row1_col2"
|
|
5
|
+
// Fill-in answers are plain text
|
|
6
|
+
//
|
|
7
|
+
// NOTE: Without question metadata, type detection is heuristic-based.
|
|
8
|
+
// Pure numeric fill-in answers (e.g. "42") will be classified as "single"
|
|
9
|
+
// (single-choice) since we cannot distinguish them from option indices.
|
|
10
|
+
export function decodeResponses(submitdata) {
|
|
11
|
+
if (!submitdata || submitdata.trim() === "") {
|
|
12
|
+
return { answers: [], count: 0 };
|
|
13
|
+
}
|
|
14
|
+
const segments = submitdata.split("}");
|
|
15
|
+
const answers = [];
|
|
16
|
+
for (const seg of segments) {
|
|
17
|
+
const trimmed = seg.trim();
|
|
18
|
+
if (!trimmed)
|
|
19
|
+
continue;
|
|
20
|
+
const dollarIdx = trimmed.indexOf("$");
|
|
21
|
+
if (dollarIdx === -1)
|
|
22
|
+
continue;
|
|
23
|
+
const qIdx = parseInt(trimmed.substring(0, dollarIdx), 10);
|
|
24
|
+
if (Number.isNaN(qIdx))
|
|
25
|
+
continue;
|
|
26
|
+
const rawValue = trimmed.substring(dollarIdx + 1);
|
|
27
|
+
// Detect type based on content patterns
|
|
28
|
+
if (rawValue.includes("|")) {
|
|
29
|
+
// Multi-choice: values separated by pipe
|
|
30
|
+
answers.push({
|
|
31
|
+
questionIndex: qIdx,
|
|
32
|
+
type: "multi",
|
|
33
|
+
value: rawValue.split("|"),
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
else if (rawValue.includes(",") && rawValue.split(",").every((p) => p.includes("_"))) {
|
|
37
|
+
// Matrix: "row_col,row_col" pattern
|
|
38
|
+
const pairs = {};
|
|
39
|
+
for (const pair of rawValue.split(",")) {
|
|
40
|
+
const underIdx = pair.indexOf("_");
|
|
41
|
+
if (underIdx !== -1) {
|
|
42
|
+
pairs[pair.substring(0, underIdx)] = pair.substring(underIdx + 1);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
answers.push({
|
|
46
|
+
questionIndex: qIdx,
|
|
47
|
+
type: "matrix",
|
|
48
|
+
value: pairs,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
else if (/^\d+$/.test(rawValue)) {
|
|
52
|
+
// Single choice: numeric answer
|
|
53
|
+
answers.push({
|
|
54
|
+
questionIndex: qIdx,
|
|
55
|
+
type: "single",
|
|
56
|
+
value: rawValue,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
// Fill-in: everything else
|
|
61
|
+
answers.push({
|
|
62
|
+
questionIndex: qIdx,
|
|
63
|
+
type: "fill",
|
|
64
|
+
value: rawValue,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return { answers, count: answers.length };
|
|
69
|
+
}
|
|
70
|
+
// ─── calculateNps ────────────────────────────────────────────────────────────
|
|
71
|
+
// NPS = %Promoters - %Detractors (scale 0-10)
|
|
72
|
+
// Promoters: 9-10, Passives: 7-8, Detractors: 0-6
|
|
73
|
+
export function calculateNps(scores) {
|
|
74
|
+
if (scores.length === 0) {
|
|
75
|
+
return {
|
|
76
|
+
score: 0,
|
|
77
|
+
promoters: { count: 0, ratio: 0 },
|
|
78
|
+
passives: { count: 0, ratio: 0 },
|
|
79
|
+
detractors: { count: 0, ratio: 0 },
|
|
80
|
+
total: 0,
|
|
81
|
+
rating: "一般",
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
const total = scores.length;
|
|
85
|
+
let promoters = 0;
|
|
86
|
+
let passives = 0;
|
|
87
|
+
let detractors = 0;
|
|
88
|
+
for (const s of scores) {
|
|
89
|
+
if (s >= 9)
|
|
90
|
+
promoters++;
|
|
91
|
+
else if (s >= 7)
|
|
92
|
+
passives++;
|
|
93
|
+
else
|
|
94
|
+
detractors++;
|
|
95
|
+
}
|
|
96
|
+
const score = Math.round(((promoters - detractors) / total) * 100);
|
|
97
|
+
let rating;
|
|
98
|
+
if (score > 70)
|
|
99
|
+
rating = "优秀";
|
|
100
|
+
else if (score >= 50)
|
|
101
|
+
rating = "良好";
|
|
102
|
+
else if (score >= 0)
|
|
103
|
+
rating = "一般";
|
|
104
|
+
else
|
|
105
|
+
rating = "较差";
|
|
106
|
+
return {
|
|
107
|
+
score,
|
|
108
|
+
promoters: { count: promoters, ratio: round4(promoters / total) },
|
|
109
|
+
passives: { count: passives, ratio: round4(passives / total) },
|
|
110
|
+
detractors: { count: detractors, ratio: round4(detractors / total) },
|
|
111
|
+
total,
|
|
112
|
+
rating,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
// ─── calculateCsat ───────────────────────────────────────────────────────────
|
|
116
|
+
// 5-point: satisfied = 4-5; 7-point: satisfied = 5-7
|
|
117
|
+
export function calculateCsat(scores, scaleType = "5-point") {
|
|
118
|
+
if (scores.length === 0) {
|
|
119
|
+
return { csat: 0, satisfiedCount: 0, total: 0, distribution: {} };
|
|
120
|
+
}
|
|
121
|
+
const total = scores.length;
|
|
122
|
+
const distribution = {};
|
|
123
|
+
let satisfiedCount = 0;
|
|
124
|
+
const satisfiedMin = scaleType === "5-point" ? 4 : 5;
|
|
125
|
+
for (const s of scores) {
|
|
126
|
+
const key = String(s);
|
|
127
|
+
distribution[key] = (distribution[key] || 0) + 1;
|
|
128
|
+
if (s >= satisfiedMin)
|
|
129
|
+
satisfiedCount++;
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
csat: round4(satisfiedCount / total),
|
|
133
|
+
satisfiedCount,
|
|
134
|
+
total,
|
|
135
|
+
distribution,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
export function detectAnomalies(responses) {
|
|
139
|
+
const flagged = [];
|
|
140
|
+
// Compute median duration for speed anomaly detection
|
|
141
|
+
const durations = responses
|
|
142
|
+
.map((r) => r.duration_seconds)
|
|
143
|
+
.filter((d) => typeof d === "number" && d > 0);
|
|
144
|
+
const medianDuration = durations.length > 0 ? median(durations) : 0;
|
|
145
|
+
const speedThreshold = medianDuration * 0.3; // < 30% of median is suspicious
|
|
146
|
+
// Build IP+content map for duplicate detection
|
|
147
|
+
const ipContentMap = new Map();
|
|
148
|
+
for (const r of responses) {
|
|
149
|
+
const reasons = [];
|
|
150
|
+
// 1. Straight-lining: all answers identical
|
|
151
|
+
if (r.answers && r.answers.length > 2) {
|
|
152
|
+
const unique = new Set(r.answers.map(String));
|
|
153
|
+
if (unique.size === 1) {
|
|
154
|
+
reasons.push("straight-lining");
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// 2. Speed anomaly: completed too fast
|
|
158
|
+
if (typeof r.duration_seconds === "number" &&
|
|
159
|
+
medianDuration > 0 &&
|
|
160
|
+
r.duration_seconds > 0 &&
|
|
161
|
+
r.duration_seconds < speedThreshold) {
|
|
162
|
+
reasons.push("speed-anomaly");
|
|
163
|
+
}
|
|
164
|
+
// 3. IP + content duplicate
|
|
165
|
+
if (r.ip && r.answers) {
|
|
166
|
+
const contentKey = `${r.ip}:${r.answers.map(String).join(",")}`;
|
|
167
|
+
const existing = ipContentMap.get(contentKey);
|
|
168
|
+
if (existing) {
|
|
169
|
+
existing.push(r.id);
|
|
170
|
+
reasons.push("ip-content-duplicate");
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
ipContentMap.set(contentKey, [r.id]);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
if (reasons.length > 0) {
|
|
177
|
+
flagged.push({ responseId: r.id, reasons });
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return { flagged, totalChecked: responses.length };
|
|
181
|
+
}
|
|
182
|
+
// ─── compareMetrics ──────────────────────────────────────────────────────────
|
|
183
|
+
export function compareMetrics(setA, setB) {
|
|
184
|
+
const allKeys = new Set([...Object.keys(setA), ...Object.keys(setB)]);
|
|
185
|
+
const comparisons = [];
|
|
186
|
+
for (const metric of allKeys) {
|
|
187
|
+
const valueA = setA[metric] ?? 0;
|
|
188
|
+
const valueB = setB[metric] ?? 0;
|
|
189
|
+
const delta = valueB - valueA;
|
|
190
|
+
const changeRate = valueA === 0 ? (valueB === 0 ? 0 : 1) : round4(delta / Math.abs(valueA));
|
|
191
|
+
const significant = Math.abs(changeRate) > 0.1;
|
|
192
|
+
comparisons.push({ metric, valueA, valueB, delta, changeRate, significant });
|
|
193
|
+
}
|
|
194
|
+
return { comparisons };
|
|
195
|
+
}
|
|
196
|
+
// ─── Helpers ─────────────────────────────────────────────────────────────────
|
|
197
|
+
function round4(n) {
|
|
198
|
+
return Math.round(n * 10000) / 10000;
|
|
199
|
+
}
|
|
200
|
+
function median(arr) {
|
|
201
|
+
const sorted = [...arr].sort((a, b) => a - b);
|
|
202
|
+
const mid = Math.floor(sorted.length / 2);
|
|
203
|
+
return sorted.length % 2 === 0 ? (sorted[mid - 1] + sorted[mid]) / 2 : sorted[mid];
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=compute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compute.js","sourceRoot":"","sources":["../../../src/modules/analytics/compute.ts"],"names":[],"mappings":"AAWA,gFAAgF;AAChF,wBAAwB;AACxB,mDAAmD;AACnD,wEAAwE;AACxE,iCAAiC;AACjC,EAAE;AACF,sEAAsE;AACtE,0EAA0E;AAC1E,wEAAwE;AAExE,MAAM,UAAU,eAAe,CAAC,UAAkB;IAChD,IAAI,CAAC,UAAU,IAAI,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QAC5C,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IACnC,CAAC;IAED,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACvC,MAAM,OAAO,GAAoB,EAAE,CAAC;IAEpC,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC3B,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;QAC3B,IAAI,CAAC,OAAO;YAAE,SAAS;QAEvB,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,SAAS,KAAK,CAAC,CAAC;YAAE,SAAS;QAE/B,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC;QAC3D,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;YAAE,SAAS;QAEjC,MAAM,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;QAElD,wCAAwC;QACxC,IAAI,QAAQ,CAAC,QAAQ,CAAC,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,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AACrF,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PushDecodeResult } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Decode an AES-128-CBC encrypted push payload from WJX.
|
|
4
|
+
*
|
|
5
|
+
* - key = MD5(appKey).substring(0, 16)
|
|
6
|
+
* - encrypted_data is base64-encoded
|
|
7
|
+
* - IV is the first 16 bytes of the ciphertext
|
|
8
|
+
* - PKCS7 padding
|
|
9
|
+
*
|
|
10
|
+
* Optional: verify SHA1(rawBody + appKey) signature if signature + rawBody provided.
|
|
11
|
+
*/
|
|
12
|
+
export declare function decodePushPayload(encryptedData: string, appKey: string, signature?: string, rawBody?: string): PushDecodeResult;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { createDecipheriv, createHash, timingSafeEqual } from "node:crypto";
|
|
2
|
+
/**
|
|
3
|
+
* Decode an AES-128-CBC encrypted push payload from WJX.
|
|
4
|
+
*
|
|
5
|
+
* - key = MD5(appKey).substring(0, 16)
|
|
6
|
+
* - encrypted_data is base64-encoded
|
|
7
|
+
* - IV is the first 16 bytes of the ciphertext
|
|
8
|
+
* - PKCS7 padding
|
|
9
|
+
*
|
|
10
|
+
* Optional: verify SHA1(rawBody + appKey) signature if signature + rawBody provided.
|
|
11
|
+
*/
|
|
12
|
+
export function decodePushPayload(encryptedData, appKey, signature, rawBody) {
|
|
13
|
+
// Derive AES key: MD5(appKey) first 16 chars → 16-byte key
|
|
14
|
+
const md5Hex = createHash("md5").update(appKey, "utf-8").digest("hex");
|
|
15
|
+
const aesKey = Buffer.from(md5Hex.substring(0, 16), "utf-8");
|
|
16
|
+
// Decode base64 ciphertext
|
|
17
|
+
const ciphertext = Buffer.from(encryptedData, "base64");
|
|
18
|
+
if (ciphertext.length < 16) {
|
|
19
|
+
throw new Error("Encrypted data too short — must be at least 16 bytes for IV");
|
|
20
|
+
}
|
|
21
|
+
// IV = first 16 bytes
|
|
22
|
+
const iv = ciphertext.subarray(0, 16);
|
|
23
|
+
const encrypted = ciphertext.subarray(16);
|
|
24
|
+
// Decrypt with AES-128-CBC + PKCS7 (Node default)
|
|
25
|
+
const decipher = createDecipheriv("aes-128-cbc", aesKey, iv);
|
|
26
|
+
const decrypted = Buffer.concat([decipher.update(encrypted), decipher.final()]);
|
|
27
|
+
const plaintext = decrypted.toString("utf-8");
|
|
28
|
+
// Parse JSON
|
|
29
|
+
let parsed;
|
|
30
|
+
try {
|
|
31
|
+
parsed = JSON.parse(plaintext);
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
parsed = plaintext;
|
|
35
|
+
}
|
|
36
|
+
// Optional signature verification (timing-safe)
|
|
37
|
+
let signatureValid;
|
|
38
|
+
if (signature && rawBody) {
|
|
39
|
+
const expected = createHash("sha1").update(rawBody + appKey, "utf-8").digest("hex");
|
|
40
|
+
signatureValid =
|
|
41
|
+
expected.length === signature.length &&
|
|
42
|
+
timingSafeEqual(Buffer.from(expected), Buffer.from(signature));
|
|
43
|
+
}
|
|
44
|
+
return { decrypted: parsed, signatureValid };
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=push-decode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-decode.js","sourceRoot":"","sources":["../../../src/modules/analytics/push-decode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG5E;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB,CAC/B,aAAqB,EACrB,MAAc,EACd,SAAkB,EAClB,OAAgB;IAEhB,2DAA2D;IAC3D,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACv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,MAAM,KAAK,SAAS,CAAC,MAAM;gBACpC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACnE,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/** Single decoded answer entry */
|
|
2
|
+
export interface DecodedAnswer {
|
|
3
|
+
questionIndex: number;
|
|
4
|
+
type: "single" | "multi" | "fill" | "matrix";
|
|
5
|
+
value: string | string[] | Record<string, string>;
|
|
6
|
+
}
|
|
7
|
+
export interface DecodeResponsesResult {
|
|
8
|
+
answers: DecodedAnswer[];
|
|
9
|
+
count: number;
|
|
10
|
+
}
|
|
11
|
+
/** NPS categories */
|
|
12
|
+
export interface NpsResult {
|
|
13
|
+
score: number;
|
|
14
|
+
promoters: {
|
|
15
|
+
count: number;
|
|
16
|
+
ratio: number;
|
|
17
|
+
};
|
|
18
|
+
passives: {
|
|
19
|
+
count: number;
|
|
20
|
+
ratio: number;
|
|
21
|
+
};
|
|
22
|
+
detractors: {
|
|
23
|
+
count: number;
|
|
24
|
+
ratio: number;
|
|
25
|
+
};
|
|
26
|
+
total: number;
|
|
27
|
+
rating: string;
|
|
28
|
+
}
|
|
29
|
+
/** CSAT result */
|
|
30
|
+
export interface CsatResult {
|
|
31
|
+
csat: number;
|
|
32
|
+
satisfiedCount: number;
|
|
33
|
+
total: number;
|
|
34
|
+
distribution: Record<string, number>;
|
|
35
|
+
}
|
|
36
|
+
/** Anomaly detection */
|
|
37
|
+
export interface AnomalyFlag {
|
|
38
|
+
responseId: string | number;
|
|
39
|
+
reasons: string[];
|
|
40
|
+
}
|
|
41
|
+
export interface AnomalyResult {
|
|
42
|
+
flagged: AnomalyFlag[];
|
|
43
|
+
totalChecked: number;
|
|
44
|
+
}
|
|
45
|
+
/** Metric comparison */
|
|
46
|
+
export interface MetricComparison {
|
|
47
|
+
metric: string;
|
|
48
|
+
valueA: number;
|
|
49
|
+
valueB: number;
|
|
50
|
+
delta: number;
|
|
51
|
+
changeRate: number;
|
|
52
|
+
significant: boolean;
|
|
53
|
+
}
|
|
54
|
+
export interface CompareResult {
|
|
55
|
+
comparisons: MetricComparison[];
|
|
56
|
+
}
|
|
57
|
+
/** Push decode result */
|
|
58
|
+
export interface PushDecodeResult {
|
|
59
|
+
decrypted: unknown;
|
|
60
|
+
signatureValid?: boolean;
|
|
61
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/modules/analytics/types.ts"],"names":[],"mappings":"AAAA,gFAAgF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { WjxApiResponse, WjxCredentials, FetchLike } from "../../core/types.js";
|
|
2
|
+
import type { QueryContactsInput, AddContactsInput, DeleteContactsInput, AddAdminInput, DeleteAdminInput, RestoreAdminInput, ListDepartmentsInput, AddDepartmentInput, ModifyDepartmentInput, DeleteDepartmentInput, ListTagsInput, AddTagInput, ModifyTagInput, DeleteTagInput } from "./types.js";
|
|
3
|
+
export declare function queryContacts<T = unknown>(input: QueryContactsInput, credentials?: WjxCredentials, fetchImpl?: FetchLike): Promise<WjxApiResponse<T>>;
|
|
4
|
+
export declare function addContacts<T = unknown>(input: AddContactsInput, credentials?: WjxCredentials, fetchImpl?: FetchLike): Promise<WjxApiResponse<T>>;
|
|
5
|
+
export declare function deleteContacts<T = unknown>(input: DeleteContactsInput, credentials?: WjxCredentials, fetchImpl?: FetchLike): Promise<WjxApiResponse<T>>;
|
|
6
|
+
export declare function addAdmin<T = unknown>(input: AddAdminInput, credentials?: WjxCredentials, fetchImpl?: FetchLike): Promise<WjxApiResponse<T>>;
|
|
7
|
+
export declare function deleteAdmin<T = unknown>(input: DeleteAdminInput, credentials?: WjxCredentials, fetchImpl?: FetchLike): Promise<WjxApiResponse<T>>;
|
|
8
|
+
export declare function restoreAdmin<T = unknown>(input: RestoreAdminInput, credentials?: WjxCredentials, fetchImpl?: FetchLike): Promise<WjxApiResponse<T>>;
|
|
9
|
+
export declare function listDepartments<T = unknown>(input: ListDepartmentsInput, credentials?: WjxCredentials, fetchImpl?: FetchLike): Promise<WjxApiResponse<T>>;
|
|
10
|
+
export declare function addDepartment<T = unknown>(input: AddDepartmentInput, credentials?: WjxCredentials, fetchImpl?: FetchLike): Promise<WjxApiResponse<T>>;
|
|
11
|
+
export declare function modifyDepartment<T = unknown>(input: ModifyDepartmentInput, credentials?: WjxCredentials, fetchImpl?: FetchLike): Promise<WjxApiResponse<T>>;
|
|
12
|
+
export declare function deleteDepartment<T = unknown>(input: DeleteDepartmentInput, credentials?: WjxCredentials, fetchImpl?: FetchLike): Promise<WjxApiResponse<T>>;
|
|
13
|
+
export declare function listTags<T = unknown>(input: ListTagsInput, credentials?: WjxCredentials, fetchImpl?: FetchLike): Promise<WjxApiResponse<T>>;
|
|
14
|
+
export declare function addTag<T = unknown>(input: AddTagInput, credentials?: WjxCredentials, fetchImpl?: FetchLike): Promise<WjxApiResponse<T>>;
|
|
15
|
+
export declare function modifyTag<T = unknown>(input: ModifyTagInput, credentials?: WjxCredentials, fetchImpl?: FetchLike): Promise<WjxApiResponse<T>>;
|
|
16
|
+
export declare function deleteTag<T = unknown>(input: DeleteTagInput, credentials?: WjxCredentials, fetchImpl?: FetchLike): Promise<WjxApiResponse<T>>;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { Action } from "../../core/constants.js";
|
|
2
|
+
import { callWjxContactsApi, getWjxCredentials, getCorpId } from "../../core/api-client.js";
|
|
3
|
+
function resolveCorpId(input) {
|
|
4
|
+
const corpid = input.corpid || getCorpId();
|
|
5
|
+
if (!corpid) {
|
|
6
|
+
throw new Error("corpid is required: set WJX_CORP_ID env var or pass corpid parameter");
|
|
7
|
+
}
|
|
8
|
+
return corpid;
|
|
9
|
+
}
|
|
10
|
+
export async function queryContacts(input, credentials = getWjxCredentials(), fetchImpl = fetch) {
|
|
11
|
+
const params = {
|
|
12
|
+
action: Action.QUERY_CONTACTS,
|
|
13
|
+
corpid: resolveCorpId(input),
|
|
14
|
+
uid: input.uid,
|
|
15
|
+
};
|
|
16
|
+
return callWjxContactsApi(params, { credentials, fetchImpl });
|
|
17
|
+
}
|
|
18
|
+
export async function addContacts(input, credentials = getWjxCredentials(), fetchImpl = fetch) {
|
|
19
|
+
const params = {
|
|
20
|
+
action: Action.ADD_CONTACTS,
|
|
21
|
+
corpid: resolveCorpId(input),
|
|
22
|
+
users: input.users,
|
|
23
|
+
};
|
|
24
|
+
if (input.auto_create_udept !== undefined)
|
|
25
|
+
params.auto_create_udept = input.auto_create_udept ? "1" : "0";
|
|
26
|
+
if (input.auto_create_tag !== undefined)
|
|
27
|
+
params.auto_create_tag = input.auto_create_tag ? "1" : "0";
|
|
28
|
+
return callWjxContactsApi(params, { credentials, fetchImpl, maxRetries: 0 });
|
|
29
|
+
}
|
|
30
|
+
export async function deleteContacts(input, credentials = getWjxCredentials(), fetchImpl = fetch) {
|
|
31
|
+
return callWjxContactsApi({
|
|
32
|
+
action: Action.MANAGE_CONTACTS,
|
|
33
|
+
corpid: resolveCorpId(input),
|
|
34
|
+
uids: input.uids,
|
|
35
|
+
}, { credentials, fetchImpl, maxRetries: 0 });
|
|
36
|
+
}
|
|
37
|
+
// ─── Admin ───────────────────────────────────────────────────────────
|
|
38
|
+
export async function addAdmin(input, credentials = getWjxCredentials(), fetchImpl = fetch) {
|
|
39
|
+
return callWjxContactsApi({
|
|
40
|
+
action: Action.ADD_ADMIN,
|
|
41
|
+
corpid: resolveCorpId(input),
|
|
42
|
+
users: input.users,
|
|
43
|
+
}, { credentials, fetchImpl, maxRetries: 0 });
|
|
44
|
+
}
|
|
45
|
+
export async function deleteAdmin(input, credentials = getWjxCredentials(), fetchImpl = fetch) {
|
|
46
|
+
return callWjxContactsApi({
|
|
47
|
+
action: Action.DELETE_ADMIN,
|
|
48
|
+
corpid: resolveCorpId(input),
|
|
49
|
+
uids: input.uids,
|
|
50
|
+
}, { credentials, fetchImpl, maxRetries: 0 });
|
|
51
|
+
}
|
|
52
|
+
export async function restoreAdmin(input, credentials = getWjxCredentials(), fetchImpl = fetch) {
|
|
53
|
+
return callWjxContactsApi({
|
|
54
|
+
action: Action.RESTORE_ADMIN,
|
|
55
|
+
corpid: resolveCorpId(input),
|
|
56
|
+
uids: input.uids,
|
|
57
|
+
}, { credentials, fetchImpl, maxRetries: 0 });
|
|
58
|
+
}
|
|
59
|
+
// ─── Department ──────────────────────────────────────────────────────
|
|
60
|
+
export async function listDepartments(input, credentials = getWjxCredentials(), fetchImpl = fetch) {
|
|
61
|
+
const params = {
|
|
62
|
+
action: Action.LIST_DEPARTMENTS,
|
|
63
|
+
corpid: resolveCorpId(input),
|
|
64
|
+
};
|
|
65
|
+
return callWjxContactsApi(params, { credentials, fetchImpl });
|
|
66
|
+
}
|
|
67
|
+
export async function addDepartment(input, credentials = getWjxCredentials(), fetchImpl = fetch) {
|
|
68
|
+
return callWjxContactsApi({
|
|
69
|
+
action: Action.ADD_DEPARTMENT,
|
|
70
|
+
corpid: resolveCorpId(input),
|
|
71
|
+
depts: input.depts,
|
|
72
|
+
}, { credentials, fetchImpl, maxRetries: 0 });
|
|
73
|
+
}
|
|
74
|
+
export async function modifyDepartment(input, credentials = getWjxCredentials(), fetchImpl = fetch) {
|
|
75
|
+
return callWjxContactsApi({
|
|
76
|
+
action: Action.MODIFY_DEPARTMENT,
|
|
77
|
+
corpid: resolveCorpId(input),
|
|
78
|
+
depts: input.depts,
|
|
79
|
+
}, { credentials, fetchImpl, maxRetries: 0 });
|
|
80
|
+
}
|
|
81
|
+
export async function deleteDepartment(input, credentials = getWjxCredentials(), fetchImpl = fetch) {
|
|
82
|
+
const params = {
|
|
83
|
+
action: Action.DELETE_DEPARTMENT,
|
|
84
|
+
corpid: resolveCorpId(input),
|
|
85
|
+
type: input.type,
|
|
86
|
+
depts: input.depts,
|
|
87
|
+
};
|
|
88
|
+
if (input.del_child !== undefined)
|
|
89
|
+
params.del_child = input.del_child ? "1" : "0";
|
|
90
|
+
return callWjxContactsApi(params, { credentials, fetchImpl, maxRetries: 0 });
|
|
91
|
+
}
|
|
92
|
+
// ─── Tag ─────────────────────────────────────────────────────────────
|
|
93
|
+
export async function listTags(input, credentials = getWjxCredentials(), fetchImpl = fetch) {
|
|
94
|
+
return callWjxContactsApi({
|
|
95
|
+
action: Action.LIST_TAGS,
|
|
96
|
+
corpid: resolveCorpId(input),
|
|
97
|
+
}, { credentials, fetchImpl });
|
|
98
|
+
}
|
|
99
|
+
export async function addTag(input, credentials = getWjxCredentials(), fetchImpl = fetch) {
|
|
100
|
+
const params = {
|
|
101
|
+
action: Action.ADD_TAG,
|
|
102
|
+
corpid: resolveCorpId(input),
|
|
103
|
+
child_names: input.child_names,
|
|
104
|
+
};
|
|
105
|
+
if (input.is_radio !== undefined)
|
|
106
|
+
params.is_radio = input.is_radio ? "1" : "0";
|
|
107
|
+
return callWjxContactsApi(params, { credentials, fetchImpl, maxRetries: 0 });
|
|
108
|
+
}
|
|
109
|
+
export async function modifyTag(input, credentials = getWjxCredentials(), fetchImpl = fetch) {
|
|
110
|
+
const params = {
|
|
111
|
+
action: Action.MODIFY_TAG,
|
|
112
|
+
corpid: resolveCorpId(input),
|
|
113
|
+
tp_id: input.tp_id,
|
|
114
|
+
};
|
|
115
|
+
if (input.tp_name !== undefined)
|
|
116
|
+
params.tp_name = input.tp_name;
|
|
117
|
+
if (input.child_names !== undefined)
|
|
118
|
+
params.child_names = input.child_names;
|
|
119
|
+
return callWjxContactsApi(params, { credentials, fetchImpl, maxRetries: 0 });
|
|
120
|
+
}
|
|
121
|
+
export async function deleteTag(input, credentials = getWjxCredentials(), fetchImpl = fetch) {
|
|
122
|
+
return callWjxContactsApi({
|
|
123
|
+
action: Action.DELETE_TAG,
|
|
124
|
+
corpid: resolveCorpId(input),
|
|
125
|
+
type: input.type,
|
|
126
|
+
tags: input.tags,
|
|
127
|
+
}, { credentials, fetchImpl, maxRetries: 0 });
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/modules/contacts/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAkB5F,SAAS,aAAa,CAAC,KAA0B;IAC/C,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,IAAI,SAAS,EAAE,CAAC;IAC3C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;IAC1F,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,KAAyB,EACzB,cAA8B,iBAAiB,EAAE,EACjD,YAAuB,KAAK;IAE5B,MAAM,MAAM,GAA4B;QACtC,MAAM,EAAE,MAAM,CAAC,cAAc;QAC7B,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC;QAC5B,GAAG,EAAE,KAAK,CAAC,GAAG;KACf,CAAC;IAEF,OAAO,kBAAkB,CAAI,MAAM,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC;AACnE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,KAAuB,EACvB,cAA8B,iBAAiB,EAAE,EACjD,YAAuB,KAAK;IAE5B,MAAM,MAAM,GAA4B;QACtC,MAAM,EAAE,MAAM,CAAC,YAAY;QAC3B,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC;QAC5B,KAAK,EAAE,KAAK,CAAC,KAAK;KACnB,CAAC;IACF,IAAI,KAAK,CAAC,iBAAiB,KAAK,SAAS;QAAE,MAAM,CAAC,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AAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export interface QueryContactsInput {
|
|
2
|
+
corpid?: string;
|
|
3
|
+
uid: string;
|
|
4
|
+
}
|
|
5
|
+
export interface AddContactsInput {
|
|
6
|
+
corpid?: string;
|
|
7
|
+
users: string;
|
|
8
|
+
auto_create_udept?: boolean;
|
|
9
|
+
auto_create_tag?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface DeleteContactsInput {
|
|
12
|
+
corpid?: string;
|
|
13
|
+
uids: string;
|
|
14
|
+
}
|
|
15
|
+
export interface AddAdminInput {
|
|
16
|
+
corpid?: string;
|
|
17
|
+
users: string;
|
|
18
|
+
}
|
|
19
|
+
export interface DeleteAdminInput {
|
|
20
|
+
corpid?: string;
|
|
21
|
+
uids: string;
|
|
22
|
+
}
|
|
23
|
+
export interface RestoreAdminInput {
|
|
24
|
+
corpid?: string;
|
|
25
|
+
uids: string;
|
|
26
|
+
}
|
|
27
|
+
export interface ListDepartmentsInput {
|
|
28
|
+
corpid?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface AddDepartmentInput {
|
|
31
|
+
corpid?: string;
|
|
32
|
+
depts: string;
|
|
33
|
+
}
|
|
34
|
+
export interface ModifyDepartmentInput {
|
|
35
|
+
corpid?: string;
|
|
36
|
+
depts: string;
|
|
37
|
+
}
|
|
38
|
+
export interface DeleteDepartmentInput {
|
|
39
|
+
corpid?: string;
|
|
40
|
+
type: string;
|
|
41
|
+
depts: string;
|
|
42
|
+
del_child?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface ListTagsInput {
|
|
45
|
+
corpid?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface AddTagInput {
|
|
48
|
+
corpid?: string;
|
|
49
|
+
child_names: string;
|
|
50
|
+
is_radio?: boolean;
|
|
51
|
+
}
|
|
52
|
+
export interface ModifyTagInput {
|
|
53
|
+
corpid?: string;
|
|
54
|
+
tp_id: string;
|
|
55
|
+
tp_name?: string;
|
|
56
|
+
child_names?: string;
|
|
57
|
+
}
|
|
58
|
+
export interface DeleteTagInput {
|
|
59
|
+
corpid?: string;
|
|
60
|
+
type: string;
|
|
61
|
+
tags: string;
|
|
62
|
+
}
|