@didit-protocol/mcp-server 3.0.3 → 5.1.33
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 +582 -178
- package/dist/audit-log.d.ts +22 -0
- package/dist/audit-log.d.ts.map +1 -0
- package/dist/audit-log.js +77 -0
- package/dist/audit-log.js.map +1 -0
- package/dist/auth/introspection-verifier.d.ts +16 -0
- package/dist/auth/introspection-verifier.d.ts.map +1 -0
- package/dist/auth/introspection-verifier.js +77 -0
- package/dist/auth/introspection-verifier.js.map +1 -0
- package/dist/auth/verifier.d.ts +19 -0
- package/dist/auth/verifier.d.ts.map +1 -0
- package/dist/auth/verifier.js +88 -0
- package/dist/auth/verifier.js.map +1 -0
- package/dist/blank-args.d.ts +10 -0
- package/dist/blank-args.d.ts.map +1 -0
- package/dist/blank-args.js +34 -0
- package/dist/blank-args.js.map +1 -0
- package/dist/chatgpt-app.d.ts +44 -0
- package/dist/chatgpt-app.d.ts.map +1 -0
- package/dist/chatgpt-app.js +52 -0
- package/dist/chatgpt-app.js.map +1 -0
- package/dist/config.d.ts +115 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +251 -15
- package/dist/config.js.map +1 -1
- package/dist/dates.d.ts +2 -0
- package/dist/dates.d.ts.map +1 -0
- package/dist/dates.js +23 -0
- package/dist/dates.js.map +1 -0
- package/dist/feature-config-schema.d.ts +66 -0
- package/dist/feature-config-schema.d.ts.map +1 -0
- package/dist/feature-config-schema.js +192 -0
- package/dist/feature-config-schema.js.map +1 -0
- package/dist/http.d.ts +4 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +230 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +20 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2986 -440
- package/dist/index.js.map +1 -1
- package/dist/internal-tools.d.ts +17 -0
- package/dist/internal-tools.d.ts.map +1 -0
- package/dist/internal-tools.js +26 -0
- package/dist/internal-tools.js.map +1 -0
- package/dist/mcp-modern.d.ts +36 -0
- package/dist/mcp-modern.d.ts.map +1 -0
- package/dist/mcp-modern.js +152 -0
- package/dist/mcp-modern.js.map +1 -0
- package/dist/orgapp.d.ts +34 -0
- package/dist/orgapp.d.ts.map +1 -0
- package/dist/orgapp.js +93 -0
- package/dist/orgapp.js.map +1 -0
- package/dist/permissions.d.ts +24 -0
- package/dist/permissions.d.ts.map +1 -0
- package/dist/permissions.js +210 -0
- package/dist/permissions.js.map +1 -0
- package/dist/privileged-tools.d.ts +14 -0
- package/dist/privileged-tools.d.ts.map +1 -0
- package/dist/privileged-tools.js +21 -0
- package/dist/privileged-tools.js.map +1 -0
- package/dist/schema/feature-config-schema.json +4446 -0
- package/dist/security.d.ts +168 -0
- package/dist/security.d.ts.map +1 -0
- package/dist/security.js +858 -0
- package/dist/security.js.map +1 -0
- package/dist/session-pdf-download.d.ts +8 -0
- package/dist/session-pdf-download.d.ts.map +1 -0
- package/dist/session-pdf-download.js +91 -0
- package/dist/session-pdf-download.js.map +1 -0
- package/dist/tools/analytics.d.ts +13 -0
- package/dist/tools/analytics.d.ts.map +1 -0
- package/dist/tools/analytics.js +171 -0
- package/dist/tools/analytics.js.map +1 -0
- package/dist/tools/auth.d.ts +11 -2
- package/dist/tools/auth.d.ts.map +1 -1
- package/dist/tools/auth.js +93 -19
- package/dist/tools/auth.js.map +1 -1
- package/dist/tools/billing.d.ts +2 -2
- package/dist/tools/billing.d.ts.map +1 -1
- package/dist/tools/billing.js +38 -12
- package/dist/tools/billing.js.map +1 -1
- package/dist/tools/blocklist.d.ts +2 -1
- package/dist/tools/blocklist.d.ts.map +1 -1
- package/dist/tools/blocklist.js +10 -19
- package/dist/tools/blocklist.js.map +1 -1
- package/dist/tools/businesses.d.ts +7 -0
- package/dist/tools/businesses.d.ts.map +1 -0
- package/dist/tools/businesses.js +57 -0
- package/dist/tools/businesses.js.map +1 -0
- package/dist/tools/cases.d.ts +6 -0
- package/dist/tools/cases.d.ts.map +1 -0
- package/dist/tools/cases.js +63 -0
- package/dist/tools/cases.js.map +1 -0
- package/dist/tools/compliance.d.ts +8 -0
- package/dist/tools/compliance.d.ts.map +1 -0
- package/dist/tools/compliance.js +95 -0
- package/dist/tools/compliance.js.map +1 -0
- package/dist/tools/context.d.ts +2 -0
- package/dist/tools/context.d.ts.map +1 -0
- package/dist/tools/context.js +37 -0
- package/dist/tools/context.js.map +1 -0
- package/dist/tools/customization.d.ts +18 -0
- package/dist/tools/customization.d.ts.map +1 -0
- package/dist/tools/customization.js +35 -0
- package/dist/tools/customization.js.map +1 -0
- package/dist/tools/feature-config.d.ts +53 -0
- package/dist/tools/feature-config.d.ts.map +1 -0
- package/dist/tools/feature-config.js +432 -0
- package/dist/tools/feature-config.js.map +1 -0
- package/dist/tools/lists.d.ts +3 -0
- package/dist/tools/lists.d.ts.map +1 -1
- package/dist/tools/lists.js +29 -26
- package/dist/tools/lists.js.map +1 -1
- package/dist/tools/members.d.ts +7 -0
- package/dist/tools/members.d.ts.map +1 -0
- package/dist/tools/members.js +60 -0
- package/dist/tools/members.js.map +1 -0
- package/dist/tools/observability.d.ts +4 -0
- package/dist/tools/observability.d.ts.map +1 -0
- package/dist/tools/observability.js +17 -0
- package/dist/tools/observability.js.map +1 -0
- package/dist/tools/questionnaires.d.ts +61 -3
- package/dist/tools/questionnaires.d.ts.map +1 -1
- package/dist/tools/questionnaires.js +128 -24
- package/dist/tools/questionnaires.js.map +1 -1
- package/dist/tools/reports.d.ts +5 -0
- package/dist/tools/reports.d.ts.map +1 -0
- package/dist/tools/reports.js +89 -0
- package/dist/tools/reports.js.map +1 -0
- package/dist/tools/search.d.ts +30 -0
- package/dist/tools/search.d.ts.map +1 -0
- package/dist/tools/search.js +317 -0
- package/dist/tools/search.js.map +1 -0
- package/dist/tools/session-explain-levers.d.ts +17 -0
- package/dist/tools/session-explain-levers.d.ts.map +1 -0
- package/dist/tools/session-explain-levers.js +139 -0
- package/dist/tools/session-explain-levers.js.map +1 -0
- package/dist/tools/session-explain.d.ts +3 -0
- package/dist/tools/session-explain.d.ts.map +1 -0
- package/dist/tools/session-explain.js +180 -0
- package/dist/tools/session-explain.js.map +1 -0
- package/dist/tools/sessions.d.ts +16 -3
- package/dist/tools/sessions.d.ts.map +1 -1
- package/dist/tools/sessions.js +150 -64
- package/dist/tools/sessions.js.map +1 -1
- package/dist/tools/settings.d.ts +15 -1
- package/dist/tools/settings.d.ts.map +1 -1
- package/dist/tools/settings.js +141 -22
- package/dist/tools/settings.js.map +1 -1
- package/dist/tools/standalone.d.ts +9 -6
- package/dist/tools/standalone.d.ts.map +1 -1
- package/dist/tools/standalone.js +47 -102
- package/dist/tools/standalone.js.map +1 -1
- package/dist/tools/transactions.d.ts +14 -0
- package/dist/tools/transactions.d.ts.map +1 -0
- package/dist/tools/transactions.js +93 -0
- package/dist/tools/transactions.js.map +1 -0
- package/dist/tools/users.d.ts +3 -1
- package/dist/tools/users.d.ts.map +1 -1
- package/dist/tools/users.js +35 -22
- package/dist/tools/users.js.map +1 -1
- package/dist/tools/webhooks.d.ts +6 -0
- package/dist/tools/webhooks.d.ts.map +1 -0
- package/dist/tools/webhooks.js +41 -0
- package/dist/tools/webhooks.js.map +1 -0
- package/dist/tools/workflow-graph.d.ts +65 -0
- package/dist/tools/workflow-graph.d.ts.map +1 -0
- package/dist/tools/workflow-graph.js +686 -0
- package/dist/tools/workflow-graph.js.map +1 -0
- package/package.json +23 -6
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listMembers = listMembers;
|
|
4
|
+
exports.inviteMember = inviteMember;
|
|
5
|
+
exports.updateMember = updateMember;
|
|
6
|
+
exports.removeMember = removeMember;
|
|
7
|
+
exports.listRoles = listRoles;
|
|
8
|
+
exports.listApiKeys = listApiKeys;
|
|
9
|
+
const config_1 = require("../config");
|
|
10
|
+
const security_1 = require("../security");
|
|
11
|
+
// Org members / roles / API keys — served by service-didit-auth (apx/auth/v2), org-level,
|
|
12
|
+
// with the user Bearer. org resolves from the tool arg / token context (resolveOrganizationId).
|
|
13
|
+
function authPath(org, resource) {
|
|
14
|
+
return `/organizations/${org}${resource}`;
|
|
15
|
+
}
|
|
16
|
+
async function listMembers(organizationId, params) {
|
|
17
|
+
const org = (0, config_1.resolveOrganizationId)(organizationId);
|
|
18
|
+
return (0, config_1.apiRequest)(authPath(org, "/members/"), { baseUrl: config_1.DIDIT_AUTH_BASE_URL, params });
|
|
19
|
+
}
|
|
20
|
+
async function inviteMember(data, organizationId) {
|
|
21
|
+
const org = (0, config_1.resolveOrganizationId)(organizationId);
|
|
22
|
+
// POST /members/invite/ — the collection route above is GET-only, so an invite sent there
|
|
23
|
+
// answers 405. InviteMemberSerializer takes exactly emails (1-5), role and app_ids; build
|
|
24
|
+
// the body from those fields rather than forwarding the tool args verbatim.
|
|
25
|
+
return (0, config_1.apiRequest)(authPath(org, "/members/invite/"), {
|
|
26
|
+
baseUrl: config_1.DIDIT_AUTH_BASE_URL,
|
|
27
|
+
method: "POST",
|
|
28
|
+
json: { emails: data.emails, role: data.role, app_ids: data.app_ids },
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
async function updateMember(memberId, data, organizationId) {
|
|
32
|
+
const org = (0, config_1.resolveOrganizationId)(organizationId);
|
|
33
|
+
// The detail route is declared WITHOUT a trailing slash (APPEND_SLASH only adds one), and
|
|
34
|
+
// OrganizationMemberUpdateSerializer takes role + accessible_applications — member_id is a
|
|
35
|
+
// path segment, not a body field.
|
|
36
|
+
return (0, config_1.apiRequest)(authPath(org, `/members/${memberId}`), {
|
|
37
|
+
baseUrl: config_1.DIDIT_AUTH_BASE_URL,
|
|
38
|
+
method: "PATCH",
|
|
39
|
+
json: { role: data.role, accessible_applications: data.accessible_applications },
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
async function removeMember(memberId, organizationId) {
|
|
43
|
+
const org = (0, config_1.resolveOrganizationId)(organizationId);
|
|
44
|
+
// Same detail route, no trailing slash.
|
|
45
|
+
return (0, config_1.apiRequest)(authPath(org, `/members/${memberId}`), { baseUrl: config_1.DIDIT_AUTH_BASE_URL, method: "DELETE" });
|
|
46
|
+
}
|
|
47
|
+
async function listRoles(organizationId) {
|
|
48
|
+
const org = (0, config_1.resolveOrganizationId)(organizationId);
|
|
49
|
+
return (0, config_1.apiRequest)(authPath(org, "/roles/"), { baseUrl: config_1.DIDIT_AUTH_BASE_URL });
|
|
50
|
+
}
|
|
51
|
+
async function listApiKeys(organizationId, applicationId) {
|
|
52
|
+
const org = (0, config_1.resolveOrganizationId)(organizationId);
|
|
53
|
+
// Console api-keys are nested under the application; if an app id is given use it.
|
|
54
|
+
const path = applicationId
|
|
55
|
+
? `/organizations/${org}/applications/${(0, security_1.pathSegment)(applicationId, "application_id")}/api-keys/`
|
|
56
|
+
: authPath(org, "/api-keys/");
|
|
57
|
+
const res = await (0, config_1.apiRequest)(path, { baseUrl: config_1.DIDIT_AUTH_BASE_URL });
|
|
58
|
+
return (0, security_1.redactCollection)(res, security_1.redactApiKey);
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=members.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"members.js","sourceRoot":"","sources":["../../src/tools/members.ts"],"names":[],"mappings":";;AAUA,kCAGC;AAED,oCAUC;AAED,oCAUC;AAED,oCAIC;AAED,8BAGC;AAED,kCAQC;AA1DD,sCAAmF;AACnF,0CAA0E;AAE1E,0FAA0F;AAC1F,gGAAgG;AAEhG,SAAS,QAAQ,CAAC,GAAW,EAAE,QAAgB;IAC7C,OAAO,kBAAkB,GAAG,GAAG,QAAQ,EAAE,CAAC;AAC5C,CAAC;AAEM,KAAK,UAAU,WAAW,CAAC,cAAuB,EAAE,MAA4B;IACrF,MAAM,GAAG,GAAG,IAAA,8BAAqB,EAAC,cAAc,CAAC,CAAC;IAClD,OAAO,IAAA,mBAAU,EAAC,QAA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,4BAAmB,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;AAC/G,CAAC;AAEM,KAAK,UAAU,SAAS,CAAC,cAAuB;IACrD,MAAM,GAAG,GAAG,IAAA,8BAAqB,EAAC,cAAc,CAAC,CAAC;IAClD,OAAO,IAAA,mBAAU,EAAC,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,4BAAmB,EAAE,CAAC,CAAC;AAChF,CAAC;AAEM,KAAK,UAAU,WAAW,CAAC,cAAuB,EAAE,aAAsB;IAC/E,MAAM,GAAG,GAAG,IAAA,8BAAqB,EAAC,cAAc,CAAC,CAAC;IAClD,mFAAmF;IACnF,MAAM,IAAI,GAAG,aAAa;QACxB,CAAC,CAAC,kBAAkB,GAAG,iBAAiB,IAAA,sBAAW,EAAC,aAAa,EAAE,gBAAgB,CAAC,YAAY;QAChG,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IAChC,MAAM,GAAG,GAAG,MAAM,IAAA,mBAAU,EAAC,IAAI,EAAE,EAAE,OAAO,EAAE,4BAAmB,EAAE,CAAC,CAAC;IACrE,OAAO,IAAA,2BAAgB,EAAC,GAAG,EAAE,uBAAY,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function listAuditLogs(params?: Record<string, any>): Promise<any>;
|
|
2
|
+
export declare function listAlerts(params?: Record<string, any>): Promise<any>;
|
|
3
|
+
export declare function configureAlert(alertType: string, data: Record<string, any>): Promise<any>;
|
|
4
|
+
//# sourceMappingURL=observability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observability.d.ts","sourceRoot":"","sources":["../../src/tools/observability.ts"],"names":[],"mappings":"AAIA,wBAAsB,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAE9E;AAED,wBAAsB,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAE3E;AAED,wBAAsB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAE/F"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listAuditLogs = listAuditLogs;
|
|
4
|
+
exports.listAlerts = listAlerts;
|
|
5
|
+
exports.configureAlert = configureAlert;
|
|
6
|
+
const config_1 = require("../config");
|
|
7
|
+
// Audit logs + alerts — org/app-scoped console resources.
|
|
8
|
+
async function listAuditLogs(params) {
|
|
9
|
+
return (0, config_1.apiRequest)((0, config_1.orgAppPath)("/audit-logs/"), { params });
|
|
10
|
+
}
|
|
11
|
+
async function listAlerts(params) {
|
|
12
|
+
return (0, config_1.apiRequest)((0, config_1.orgAppPath)("/alerts/"), { params });
|
|
13
|
+
}
|
|
14
|
+
async function configureAlert(alertType, data) {
|
|
15
|
+
return (0, config_1.apiRequest)((0, config_1.orgAppPath)(`/alerts/${alertType}/`), { method: "PATCH", json: data });
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=observability.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observability.js","sourceRoot":"","sources":["../../src/tools/observability.ts"],"names":[],"mappings":";;AAIA,sCAEC;AAED,gCAEC;AAED,wCAEC;AAdD,sCAAmD;AAEnD,0DAA0D;AAEnD,KAAK,UAAU,aAAa,CAAC,MAA4B;IAC9D,OAAO,IAAA,mBAAU,EAAC,IAAA,mBAAU,EAAC,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AAC5D,CAAC;AAEM,KAAK,UAAU,UAAU,CAAC,MAA4B;IAC3D,OAAO,IAAA,mBAAU,EAAC,IAAA,mBAAU,EAAC,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AACxD,CAAC;AAEM,KAAK,UAAU,cAAc,CAAC,SAAiB,EAAE,IAAyB;IAC/E,OAAO,IAAA,mBAAU,EAAC,IAAA,mBAAU,EAAC,WAAW,SAAS,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAC1F,CAAC"}
|
|
@@ -1,6 +1,64 @@
|
|
|
1
|
+
type Translatable = Record<string, string>;
|
|
2
|
+
export type FormElementInput = {
|
|
3
|
+
element_type: string;
|
|
4
|
+
title?: string | Translatable;
|
|
5
|
+
placeholder?: string | Translatable;
|
|
6
|
+
description?: string | Translatable;
|
|
7
|
+
is_required?: boolean;
|
|
8
|
+
choices?: Array<{
|
|
9
|
+
value?: string;
|
|
10
|
+
label?: string | Translatable;
|
|
11
|
+
requires_text_input?: boolean;
|
|
12
|
+
}>;
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
};
|
|
15
|
+
export type QuestionnaireWrite = {
|
|
16
|
+
title?: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
form_elements?: FormElementInput[];
|
|
19
|
+
languages?: string[];
|
|
20
|
+
default_language?: string;
|
|
21
|
+
status?: string;
|
|
22
|
+
[key: string]: unknown;
|
|
23
|
+
};
|
|
24
|
+
/** `{start_node, nodes}` from an ordered list of questions: node ids are positional and each
|
|
25
|
+
* node points at the next one, which is exactly the linear form the questions describe. */
|
|
26
|
+
export declare function buildQuestionnaireGraph(elements: FormElementInput[], languages: string[]): {
|
|
27
|
+
start_node: string;
|
|
28
|
+
nodes: {
|
|
29
|
+
[k: string]: {
|
|
30
|
+
next: string;
|
|
31
|
+
choices?: {
|
|
32
|
+
value: string;
|
|
33
|
+
label: Translatable | undefined;
|
|
34
|
+
}[] | undefined;
|
|
35
|
+
description?: Translatable | undefined;
|
|
36
|
+
placeholder?: Translatable | undefined;
|
|
37
|
+
title?: Translatable | undefined;
|
|
38
|
+
is_required: boolean;
|
|
39
|
+
element_type: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
};
|
|
1
43
|
export declare function listQuestionnaires(): Promise<any>;
|
|
2
|
-
export declare function createQuestionnaire(data:
|
|
3
|
-
export declare function getQuestionnaire(uuid: string): Promise<any>;
|
|
4
|
-
export declare function updateQuestionnaire(uuid: string, data:
|
|
44
|
+
export declare function createQuestionnaire(data: QuestionnaireWrite): Promise<any>;
|
|
45
|
+
export declare function getQuestionnaire(uuid: string, includeTranslations?: boolean): Promise<any>;
|
|
46
|
+
export declare function updateQuestionnaire(uuid: string, data: QuestionnaireWrite): Promise<any>;
|
|
47
|
+
type ChoiceInput = NonNullable<FormElementInput["choices"]>[number];
|
|
48
|
+
/** Append ONE batch of choices to a stored question. A long option list cannot travel in a
|
|
49
|
+
* single create/update call — the model emits the call token by token and the step's output
|
|
50
|
+
* budget cuts it off mid-JSON, silently keeping only the first ~100 options — so the batches
|
|
51
|
+
* arrive here one call at a time. Dedup by value makes a retried batch safe, and the compact
|
|
52
|
+
* result spares the model the full graph it would otherwise re-read after every batch.
|
|
53
|
+
*
|
|
54
|
+
* Draft discipline: a PATCH that omits `status` PUBLISHES a draft, and a published
|
|
55
|
+
* questionnaire rejects every further edit — so intermediate batches pin `status: "draft"`
|
|
56
|
+
* and only a `publish: true` batch (the last one) lets the PATCH publish. */
|
|
57
|
+
export declare function appendQuestionnaireChoices(uuid: string, data: {
|
|
58
|
+
node_id?: string;
|
|
59
|
+
choices?: ChoiceInput[];
|
|
60
|
+
publish?: boolean;
|
|
61
|
+
}): Promise<any>;
|
|
5
62
|
export declare function deleteQuestionnaire(uuid: string): Promise<any>;
|
|
63
|
+
export {};
|
|
6
64
|
//# sourceMappingURL=questionnaires.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"questionnaires.d.ts","sourceRoot":"","sources":["../../src/tools/questionnaires.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"questionnaires.d.ts","sourceRoot":"","sources":["../../src/tools/questionnaires.ts"],"names":[],"mappings":"AAeA,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE3C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IACpC,WAAW,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IACpC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;QAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAClG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAkBF;2FAC2F;AAC3F,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE;;;;;;;;;;;;;0BArCzE,MAAM;;;EAiErB;AAiBD,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,GAAG,CAAC,CAEvD;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC,CAEhF;AAeD,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,mBAAmB,UAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAQ9F;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC,CAK9F;AAED,KAAK,WAAW,GAAG,WAAW,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAiBpE;;;;;;;;6EAQ6E;AAC7E,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GACrE,OAAO,CAAC,GAAG,CAAC,CA4Bd;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAEpE"}
|
|
@@ -1,44 +1,148 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildQuestionnaireGraph = buildQuestionnaireGraph;
|
|
3
4
|
exports.listQuestionnaires = listQuestionnaires;
|
|
4
5
|
exports.createQuestionnaire = createQuestionnaire;
|
|
5
6
|
exports.getQuestionnaire = getQuestionnaire;
|
|
6
7
|
exports.updateQuestionnaire = updateQuestionnaire;
|
|
8
|
+
exports.appendQuestionnaireChoices = appendQuestionnaireChoices;
|
|
7
9
|
exports.deleteQuestionnaire = deleteQuestionnaire;
|
|
8
10
|
const config_1 = require("../config");
|
|
11
|
+
/** A translatable field must carry EVERY declared language or the backend rejects it, so a
|
|
12
|
+
* plain string is broadcast to all of them (one language is the overwhelmingly common case). */
|
|
13
|
+
function translatable(value, languages) {
|
|
14
|
+
if (value && typeof value === "object")
|
|
15
|
+
return value;
|
|
16
|
+
const text = typeof value === "string" ? value : "";
|
|
17
|
+
return text ? Object.fromEntries(languages.map((lang) => [lang, text])) : undefined;
|
|
18
|
+
}
|
|
19
|
+
function toChoice(choice, languages) {
|
|
20
|
+
const label = translatable(choice.label ?? choice.value, languages);
|
|
21
|
+
const value = String(choice.value ?? "").trim() || Object.values(label ?? {})[0] || "";
|
|
22
|
+
return { ...choice, value, label };
|
|
23
|
+
}
|
|
24
|
+
/** `{start_node, nodes}` from an ordered list of questions: node ids are positional and each
|
|
25
|
+
* node points at the next one, which is exactly the linear form the questions describe. */
|
|
26
|
+
function buildQuestionnaireGraph(elements, languages) {
|
|
27
|
+
const ids = elements.map((_, index) => `q${index + 1}`);
|
|
28
|
+
const nodes = Object.fromEntries(elements.map((element, index) => {
|
|
29
|
+
const { title, placeholder, description, choices, ...rest } = element;
|
|
30
|
+
return [
|
|
31
|
+
ids[index],
|
|
32
|
+
{
|
|
33
|
+
...rest,
|
|
34
|
+
is_required: element.is_required ?? false,
|
|
35
|
+
...(translatable(title, languages) && { title: translatable(title, languages) }),
|
|
36
|
+
...(translatable(placeholder, languages) && {
|
|
37
|
+
placeholder: translatable(placeholder, languages),
|
|
38
|
+
}),
|
|
39
|
+
...(translatable(description, languages) && {
|
|
40
|
+
description: translatable(description, languages),
|
|
41
|
+
}),
|
|
42
|
+
...(Array.isArray(choices) && {
|
|
43
|
+
choices: choices.map((choice) => toChoice(choice, languages)),
|
|
44
|
+
}),
|
|
45
|
+
next: ids[index + 1] ?? null,
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
}));
|
|
49
|
+
return { start_node: ids[0], nodes };
|
|
50
|
+
}
|
|
51
|
+
/** The wire payload: `form_elements` become the graph, everything else passes through. The
|
|
52
|
+
* org/app selectors are routing, not content — they are already in the path. */
|
|
53
|
+
function toGraphPayload(data) {
|
|
54
|
+
const { form_elements, languages, organization_id, application_id, ...rest } = data;
|
|
55
|
+
const langs = languages?.length ? languages : ["en"];
|
|
56
|
+
if (!form_elements)
|
|
57
|
+
return { ...rest, ...(languages && { languages }) };
|
|
58
|
+
return {
|
|
59
|
+
...rest,
|
|
60
|
+
languages: langs,
|
|
61
|
+
default_language: data.default_language ?? langs[0],
|
|
62
|
+
graph: buildQuestionnaireGraph(form_elements, langs),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
9
65
|
async function listQuestionnaires() {
|
|
10
|
-
|
|
11
|
-
return res.json();
|
|
66
|
+
return (0, config_1.apiRequest)((0, config_1.orgAppPath)("/questionnaires/"));
|
|
12
67
|
}
|
|
13
68
|
async function createQuestionnaire(data) {
|
|
14
|
-
|
|
15
|
-
method: "POST",
|
|
16
|
-
headers: (0, config_1.getHeaders)(),
|
|
17
|
-
body: JSON.stringify(data),
|
|
18
|
-
});
|
|
19
|
-
return res.json();
|
|
69
|
+
return (0, config_1.apiRequest)((0, config_1.orgAppPath)("/questionnaires/"), { method: "POST", json: toGraphPayload(data) });
|
|
20
70
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
71
|
+
function compactTranslations(value) {
|
|
72
|
+
if (Array.isArray(value))
|
|
73
|
+
return value.map(compactTranslations);
|
|
74
|
+
if (!value || typeof value !== "object")
|
|
75
|
+
return value;
|
|
76
|
+
const entries = Object.entries(value);
|
|
77
|
+
if (entries.length > 1 && entries.every(([key]) => /^[a-z]{2}(?:-[A-Z]{2})?$/.test(key))) {
|
|
78
|
+
const [locale, text] = Object.prototype.hasOwnProperty.call(value, "en")
|
|
79
|
+
? ["en", value.en]
|
|
80
|
+
: entries[0];
|
|
81
|
+
return { [locale]: compactTranslations(text) };
|
|
82
|
+
}
|
|
83
|
+
return Object.fromEntries(entries.map(([key, nested]) => [key, compactTranslations(nested)]));
|
|
84
|
+
}
|
|
85
|
+
async function getQuestionnaire(uuid, includeTranslations = false) {
|
|
86
|
+
const result = await (0, config_1.apiRequest)((0, config_1.orgAppPath)(`/questionnaires/${uuid}/`));
|
|
87
|
+
if (includeTranslations)
|
|
88
|
+
return result;
|
|
89
|
+
return {
|
|
90
|
+
...compactTranslations(result),
|
|
91
|
+
translations_summarized: true,
|
|
92
|
+
hint: "Translations are limited to English (or the first available locale). Pass include_translations:true for every locale.",
|
|
93
|
+
};
|
|
26
94
|
}
|
|
27
95
|
async function updateQuestionnaire(uuid, data) {
|
|
28
|
-
|
|
96
|
+
return (0, config_1.apiRequest)((0, config_1.orgAppPath)(`/questionnaires/${uuid}/`), {
|
|
29
97
|
method: "PATCH",
|
|
30
|
-
|
|
31
|
-
body: JSON.stringify(data),
|
|
98
|
+
json: toGraphPayload(data),
|
|
32
99
|
});
|
|
33
|
-
|
|
100
|
+
}
|
|
101
|
+
/** The node a choice batch targets: the explicit id when given, otherwise the only node that
|
|
102
|
+
* carries choices — with several candidates the caller must name one. */
|
|
103
|
+
function resolveChoiceNode(nodes, nodeId) {
|
|
104
|
+
const candidates = Object.keys(nodes).filter((id) => Array.isArray(nodes[id]?.choices));
|
|
105
|
+
const target = nodeId ?? (candidates.length === 1 ? candidates[0] : undefined);
|
|
106
|
+
if (!target || !candidates.includes(target)) {
|
|
107
|
+
throw new Error(`node_id must be one of the question nodes with choices: [${candidates.join(", ")}]`);
|
|
108
|
+
}
|
|
109
|
+
return target;
|
|
110
|
+
}
|
|
111
|
+
/** Append ONE batch of choices to a stored question. A long option list cannot travel in a
|
|
112
|
+
* single create/update call — the model emits the call token by token and the step's output
|
|
113
|
+
* budget cuts it off mid-JSON, silently keeping only the first ~100 options — so the batches
|
|
114
|
+
* arrive here one call at a time. Dedup by value makes a retried batch safe, and the compact
|
|
115
|
+
* result spares the model the full graph it would otherwise re-read after every batch.
|
|
116
|
+
*
|
|
117
|
+
* Draft discipline: a PATCH that omits `status` PUBLISHES a draft, and a published
|
|
118
|
+
* questionnaire rejects every further edit — so intermediate batches pin `status: "draft"`
|
|
119
|
+
* and only a `publish: true` batch (the last one) lets the PATCH publish. */
|
|
120
|
+
async function appendQuestionnaireChoices(uuid, data) {
|
|
121
|
+
// This is a read-modify-write path. Fetch the complete locale maps so the
|
|
122
|
+
// PATCH cannot overwrite a multilingual questionnaire with the compact
|
|
123
|
+
// read-only representation returned by the public get tool.
|
|
124
|
+
const current = await getQuestionnaire(uuid, true);
|
|
125
|
+
const graph = current?.graph ?? { nodes: {} };
|
|
126
|
+
const languages = current?.languages?.length ? current.languages : ["en"];
|
|
127
|
+
const nodeId = resolveChoiceNode(graph.nodes ?? {}, data.node_id);
|
|
128
|
+
const node = graph.nodes[nodeId];
|
|
129
|
+
const stored = new Set((node.choices ?? []).map((choice) => choice?.value));
|
|
130
|
+
const incoming = (data.choices ?? []).map((choice) => toChoice(choice, languages));
|
|
131
|
+
const fresh = incoming.filter((choice) => !stored.has(choice.value));
|
|
132
|
+
node.choices = [...(node.choices ?? []), ...fresh];
|
|
133
|
+
if (fresh.length || data.publish) {
|
|
134
|
+
await updateQuestionnaire(uuid, data.publish ? { graph } : { graph, status: "draft" });
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
questionnaire_id: uuid,
|
|
138
|
+
node_id: nodeId,
|
|
139
|
+
appended: fresh.length,
|
|
140
|
+
skipped_existing: incoming.length - fresh.length,
|
|
141
|
+
total_choices: node.choices.length,
|
|
142
|
+
status: data.publish ? "published" : (current?.status ?? "draft"),
|
|
143
|
+
};
|
|
34
144
|
}
|
|
35
145
|
async function deleteQuestionnaire(uuid) {
|
|
36
|
-
|
|
37
|
-
method: "DELETE",
|
|
38
|
-
headers: (0, config_1.getHeaders)(),
|
|
39
|
-
});
|
|
40
|
-
if (res.status === 204)
|
|
41
|
-
return { success: true };
|
|
42
|
-
return res.json();
|
|
146
|
+
return (0, config_1.apiRequest)((0, config_1.orgAppPath)(`/questionnaires/${uuid}/`), { method: "DELETE" });
|
|
43
147
|
}
|
|
44
148
|
//# sourceMappingURL=questionnaires.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"questionnaires.js","sourceRoot":"","sources":["../../src/tools/questionnaires.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"questionnaires.js","sourceRoot":"","sources":["../../src/tools/questionnaires.ts"],"names":[],"mappings":";;AAuDA,0DA4BC;AAiBD,gDAEC;AAED,kDAEC;AAeD,4CAQC;AAED,kDAKC;AA4BD,gEA+BC;AAED,kDAEC;AAvMD,sCAAmD;AAqCnD;gGACgG;AAChG,SAAS,YAAY,CAAC,KAAc,EAAE,SAAmB;IACvD,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAqB,CAAC;IACrE,MAAM,IAAI,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAEpD,OAAO,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACtF,CAAC;AAED,SAAS,QAAQ,CAAC,MAA+B,EAAE,SAAmB;IACpE,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IACpE,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAEvF,OAAO,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AACrC,CAAC;AAED;2FAC2F;AAC3F,SAAgB,uBAAuB,CAAC,QAA4B,EAAE,SAAmB;IACvF,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CA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M,EAAE,QAAQ,EAAE,CAAC,CAAC;AAClF,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function listReports(params?: Record<string, any>): Promise<any>;
|
|
2
|
+
export declare function getReport(reportId: string): Promise<any>;
|
|
3
|
+
export declare function getReportDownloadUrl(reportId: string): Promise<any>;
|
|
4
|
+
export declare function exportReport(kind: string, data?: Record<string, any>): Promise<any>;
|
|
5
|
+
//# sourceMappingURL=reports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reports.d.ts","sourceRoot":"","sources":["../../src/tools/reports.ts"],"names":[],"mappings":"AAuDA,wBAAsB,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAE5E;AAED,wBAAsB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAE9D;AAED,wBAAsB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAEzE;AAGD,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAkB7F"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listReports = listReports;
|
|
4
|
+
exports.getReport = getReport;
|
|
5
|
+
exports.getReportDownloadUrl = getReportDownloadUrl;
|
|
6
|
+
exports.exportReport = exportReport;
|
|
7
|
+
const config_1 = require("../config");
|
|
8
|
+
const security_1 = require("../security");
|
|
9
|
+
// Async export reports — org/app-scoped console resource.
|
|
10
|
+
// The `columns` schema the backend enforces per export `kind` (400 "Invalid columns" on
|
|
11
|
+
// a miss) — mirrored from service-didit-verification's src/applications/serializers/csv.py
|
|
12
|
+
// (BASE/PHONE/KYC/POA_COLUMNS for sessions, VENDOR_USER_EXPORT_COLUMNS,
|
|
13
|
+
// VENDOR_BUSINESS_EXPORT_COLUMNS). `transactions` and `businesses` are NOT listed here —
|
|
14
|
+
// their views accept any column string (unknown ones just render blank), so there's no
|
|
15
|
+
// finite schema to validate against.
|
|
16
|
+
const SESSION_EXPORT_COLUMNS = [
|
|
17
|
+
"session_id", "session_number", "vendor_data", "session_status", "original_status", "tags",
|
|
18
|
+
"ip_location_country", "workflow_type", "ip_address", "device_brand", "device_model", "platform",
|
|
19
|
+
"browser", "is_vpn_or_tor", "is_datacenter", "liveness_status", "face_match_status", "face_match_score",
|
|
20
|
+
"aml_status", "aml_matches_count", "aml_monitoring_enabled", "created_at", "warnings", "email", "total_cost",
|
|
21
|
+
"mobile_country_code", "mobile",
|
|
22
|
+
"full_name", "first_name", "middle_name", "last_name", "document_type", "issuing_state", "nationality",
|
|
23
|
+
"document_number", "personal_number", "date_of_birth", "expiration_date", "date_of_issue", "gender",
|
|
24
|
+
"address_line_1", "address_line_2", "address_city", "address_state", "address_country", "address_zip_code",
|
|
25
|
+
"poa_name_on_document", "poa_issuing_state", "poa_document_type", "poa_document_language", "poa_issuer",
|
|
26
|
+
"poa_issue_date", "poa_address_line_1", "poa_address_line_2", "poa_address_city", "poa_address_state",
|
|
27
|
+
"poa_address_country", "poa_address_zip_code",
|
|
28
|
+
];
|
|
29
|
+
const VENDOR_USER_EXPORT_COLUMNS = [
|
|
30
|
+
"didit_internal_id", "vendor_data", "display_name", "full_name", "date_of_birth", "status", "session_count",
|
|
31
|
+
"approved_count", "declined_count", "in_review_count", "last_session_at", "first_session_at", "created_at",
|
|
32
|
+
"updated_at", "tags", "approved_emails", "approved_phones", "issuing_states", "id_document_types",
|
|
33
|
+
"id_document_countries", "poa_document_types", "poa_document_countries", "payment_method_types",
|
|
34
|
+
"payment_method_account_ids", "payment_method_countries", "payment_method_owner_names", "location_countries",
|
|
35
|
+
"location_cities", "device_brands", "device_models", "platforms", "has_vpn_or_tor", "has_datacenter",
|
|
36
|
+
"metadata", "email", "phone_number", "address_line_1", "address_line_2", "address_city", "address_state",
|
|
37
|
+
"address_country", "address_zip_code",
|
|
38
|
+
];
|
|
39
|
+
const VENDOR_BUSINESS_EXPORT_COLUMNS = [
|
|
40
|
+
"didit_internal_id", "vendor_data", "display_name", "legal_name", "registration_number", "country_code",
|
|
41
|
+
"status", "session_count", "approved_count", "declined_count", "in_review_count", "last_session_at",
|
|
42
|
+
"first_session_at", "last_activity_at", "created_at", "updated_at", "tags", "metadata", "email",
|
|
43
|
+
"phone_number", "address_line_1", "address_line_2", "address_city", "address_state", "address_country",
|
|
44
|
+
"address_zip_code",
|
|
45
|
+
"latest_session_id", "latest_workflow_type", "company_type", "incorporation_date", "jurisdiction",
|
|
46
|
+
"registry_status", "verification_status", "tax_number", "risk_level", "is_from_registry", "registered_address",
|
|
47
|
+
"kyb_status", "kyb_registry_status", "kyb_documents_status", "kyb_key_people_status", "officers_count",
|
|
48
|
+
"officers_names", "officers_designations", "officers_nationalities", "beneficial_owners_count",
|
|
49
|
+
"beneficial_owners_names", "beneficial_owners_emails", "beneficial_owners_nationalities",
|
|
50
|
+
"beneficial_owners_ownership_shares", "aml_status", "aml_matches_count", "aml_risk_level",
|
|
51
|
+
"aml_last_screened", "aml_monitoring_enabled", "documents_count", "documents_verified_count",
|
|
52
|
+
"documents_pending_count", "documents_declined_count", "documents_types",
|
|
53
|
+
];
|
|
54
|
+
const KNOWN_COLUMN_SCHEMAS = {
|
|
55
|
+
sessions: SESSION_EXPORT_COLUMNS,
|
|
56
|
+
"vendor-users": VENDOR_USER_EXPORT_COLUMNS,
|
|
57
|
+
"vendor-businesses": VENDOR_BUSINESS_EXPORT_COLUMNS,
|
|
58
|
+
};
|
|
59
|
+
async function listReports(params) {
|
|
60
|
+
return (0, config_1.apiRequest)((0, config_1.orgAppPath)("/reports/"), { params });
|
|
61
|
+
}
|
|
62
|
+
async function getReport(reportId) {
|
|
63
|
+
return (0, config_1.apiRequest)((0, config_1.orgAppPath)(`/reports/${reportId}/`));
|
|
64
|
+
}
|
|
65
|
+
async function getReportDownloadUrl(reportId) {
|
|
66
|
+
return (0, config_1.apiRequest)((0, config_1.orgAppPath)(`/reports/${reportId}/download-url/`));
|
|
67
|
+
}
|
|
68
|
+
// kind ∈ sessions | transactions | businesses | vendor-users | vendor-businesses
|
|
69
|
+
async function exportReport(kind, data = {}) {
|
|
70
|
+
try {
|
|
71
|
+
return await (0, config_1.apiRequest)((0, config_1.orgAppPath)(`/reports/${kind}/`), { method: "POST", json: data });
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
// The backend's "Invalid columns" 400 never lists what IS valid, so `sessions` /
|
|
75
|
+
// `vendor-users` / `vendor-businesses` exports were undiscoverable without reading
|
|
76
|
+
// the backend source. Attach the real schema so the agent can retry from the error
|
|
77
|
+
// alone, the same way `allowed` already works for rejected enum values.
|
|
78
|
+
const schema = KNOWN_COLUMN_SCHEMAS[kind];
|
|
79
|
+
if (error instanceof security_1.DiditError && schema && error.shape.field === "columns" && !error.shape.allowed?.length) {
|
|
80
|
+
throw new security_1.DiditError({
|
|
81
|
+
...error.shape,
|
|
82
|
+
allowed: schema,
|
|
83
|
+
hint: `Retry with only values from \`allowed\` (the valid columns for kind="${kind}"). Session KYC/phone/POA columns also accept a numbered suffix for multi-instance data, e.g. full_name_2.`,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
throw error;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=reports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reports.js","sourceRoot":"","sources":["../../src/tools/reports.ts"],"names":[],"mappings":";;AAuDA,kCAEC;AAED,8BAEC;AAED,oDAEC;AAGD,oCAkBC;AAtFD,sCAAmD;AACnD,0CAAyC;AAEzC,0DAA0D;AAE1D,wFAAwF;AACxF,2FAA2F;AAC3F,wEAAwE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
2
|
+
organization_id?: string;
|
|
3
|
+
application_id?: string;
|
|
4
|
+
limit?: number;
|
|
5
|
+
[filter: string]: any;
|
|
6
|
+
}
|
|
7
|
+
export declare function searchSessions(args: SearchArgs): Promise<any>;
|
|
8
|
+
export declare function searchTransactions(args: SearchArgs): Promise<any>;
|
|
9
|
+
export declare function searchCases(args: SearchArgs): Promise<any>;
|
|
10
|
+
export declare function searchVendorUsers(args: SearchArgs): Promise<any>;
|
|
11
|
+
export declare function searchVendorBusinesses(args: SearchArgs): Promise<any>;
|
|
12
|
+
/** Find workflows (verification-settings) ACROSS every (org, app) in one call. Optionally filter
|
|
13
|
+
* by `workflow_id` (matches the version uuid OR the stable workflow_id) or `search` (label
|
|
14
|
+
* substring). Each row is tagged with its org/app — so an agent can locate a workflow by id
|
|
15
|
+
* without walking dozens of apps. Workflows have no org-level endpoint → per-app fan-out. */
|
|
16
|
+
export declare function searchWorkflows(args: SearchArgs): Promise<any>;
|
|
17
|
+
export interface WorkflowScope {
|
|
18
|
+
organizationId: string;
|
|
19
|
+
applicationId: string;
|
|
20
|
+
workflow: any;
|
|
21
|
+
/** Set when `workflow_id` was a label/slug that resolved to exactly one workflow. */
|
|
22
|
+
resolved_from?: string;
|
|
23
|
+
}
|
|
24
|
+
/** Tag a tool result with how a label was resolved, so the model sees which workflow it got. */
|
|
25
|
+
export declare function withWorkflowResolution<R>(result: R, scope: WorkflowScope): R;
|
|
26
|
+
/** Resolve the (org, app) + version row that owns a workflow id, for the graph tools. When the
|
|
27
|
+
* caller already knows the org/app, a single scoped list avoids the cross-app fan-out. */
|
|
28
|
+
export declare function resolveWorkflowScope(workflowId: string, organizationId?: string, applicationId?: string): Promise<WorkflowScope>;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AAoCA,UAAU,UAAU;IACl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