@acorex/connectivity 21.0.0-next.42 → 21.0.0-next.44
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/fesm2022/acorex-connectivity-api.mjs +89 -3
- package/fesm2022/acorex-connectivity-api.mjs.map +1 -1
- package/fesm2022/{acorex-connectivity-mock-acorex-connectivity-mock-BTiDjsTG.mjs → acorex-connectivity-mock-acorex-connectivity-mock-QxKVNQo9.mjs} +3374 -1490
- package/fesm2022/acorex-connectivity-mock-acorex-connectivity-mock-QxKVNQo9.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-assign-to-manager.activity-Cbm3SNXn.mjs → acorex-connectivity-mock-assign-to-manager.activity-GtNzTHWI.mjs} +2 -2
- package/fesm2022/{acorex-connectivity-mock-assign-to-manager.activity-Cbm3SNXn.mjs.map → acorex-connectivity-mock-assign-to-manager.activity-GtNzTHWI.mjs.map} +1 -1
- package/fesm2022/{acorex-connectivity-mock-chat-generate-image.command-OImAZbUq.mjs → acorex-connectivity-mock-chat-generate-image.command-BAMTtIN_.mjs} +2 -2
- package/fesm2022/{acorex-connectivity-mock-chat-generate-image.command-OImAZbUq.mjs.map → acorex-connectivity-mock-chat-generate-image.command-BAMTtIN_.mjs.map} +1 -1
- package/fesm2022/{acorex-connectivity-mock-chat-synthesize-speech.command-Dieqfce2.mjs → acorex-connectivity-mock-chat-synthesize-speech.command-C0pQvhMF.mjs} +2 -2
- package/fesm2022/{acorex-connectivity-mock-chat-synthesize-speech.command-Dieqfce2.mjs.map → acorex-connectivity-mock-chat-synthesize-speech.command-C0pQvhMF.mjs.map} +1 -1
- package/fesm2022/{acorex-connectivity-mock-chat-transcribe-speech.command-BvZwDms4.mjs → acorex-connectivity-mock-chat-transcribe-speech.command-BRDl6roP.mjs} +2 -2
- package/fesm2022/{acorex-connectivity-mock-chat-transcribe-speech.command-BvZwDms4.mjs.map → acorex-connectivity-mock-chat-transcribe-speech.command-BRDl6roP.mjs.map} +1 -1
- package/fesm2022/acorex-connectivity-mock-notification-management-email-send.command-DAQfIWoD.mjs +73 -0
- package/fesm2022/acorex-connectivity-mock-notification-management-email-send.command-DAQfIWoD.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-user-roles-for-list-column.query-DZlsdoZn.mjs → acorex-connectivity-mock-user-roles-for-list-column.query-DOAMknK8.mjs} +2 -3
- package/fesm2022/acorex-connectivity-mock-user-roles-for-list-column.query-DOAMknK8.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock.mjs +2 -1
- package/fesm2022/acorex-connectivity-mock.mjs.map +1 -1
- package/package.json +2 -2
- package/types/acorex-connectivity-api.d.ts +12 -1
- package/types/acorex-connectivity-mock.d.ts +205 -97
- package/fesm2022/acorex-connectivity-mock-acorex-connectivity-mock-BTiDjsTG.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-user-roles-for-list-column.query-DZlsdoZn.mjs.map +0 -1
|
@@ -5,7 +5,7 @@ import { RootConfig as RootConfig$2 } from '@acorex/modules/organization-managem
|
|
|
5
5
|
import { RootConfig as RootConfig$1 } from '@acorex/modules/person-core';
|
|
6
6
|
import { AXPSessionService } from '@acorex/platform/auth';
|
|
7
7
|
import { AXPEntityStorageService } from '@acorex/platform/layout/entity';
|
|
8
|
-
import { c as axcSyncSingleEmployeeDenormalizedOrgFields } from './acorex-connectivity-mock-acorex-connectivity-mock-
|
|
8
|
+
import { c as axcSyncSingleEmployeeDenormalizedOrgFields } from './acorex-connectivity-mock-acorex-connectivity-mock-QxKVNQo9.mjs';
|
|
9
9
|
|
|
10
10
|
const LEAVE_REQUEST_ENTITY = RootConfig.entities.leaveRequest.source;
|
|
11
11
|
const EMPLOYEE_ENTITY = RootConfig.entities.employee.source;
|
|
@@ -209,4 +209,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
209
209
|
}] });
|
|
210
210
|
|
|
211
211
|
export { AssignToManagerActivity };
|
|
212
|
-
//# sourceMappingURL=acorex-connectivity-mock-assign-to-manager.activity-
|
|
212
|
+
//# sourceMappingURL=acorex-connectivity-mock-assign-to-manager.activity-GtNzTHWI.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-connectivity-mock-assign-to-manager.activity-Cbm3SNXn.mjs","sources":["../../../../libs/connectivity/mock/src/lib/workflow-management/activities/assign-to-manager.activity.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { RootConfig as HcmRootConfig } from '@acorex/modules/human-capital-management';\nimport { RootConfig as OrgRootConfig } from '@acorex/modules/organization-management';\nimport { RootConfig as PersonRootConfig } from '@acorex/modules/person-core';\nimport { AXPSessionService } from '@acorex/platform/auth';\nimport { AXPExecuteCommandResult } from '@acorex/platform/core';\nimport { AXPEntityStorageService } from '@acorex/platform/layout/entity';\nimport { AXPCommand } from '@acorex/platform/runtime';\nimport { axcSyncSingleEmployeeDenormalizedOrgFields } from '../../organization-management/org-chart/employee-manager-resolution';\n\nconst LEAVE_REQUEST_ENTITY = HcmRootConfig.entities.leaveRequest.source;\nconst EMPLOYEE_ENTITY = HcmRootConfig.entities.employee.source;\nconst PERSON_ENTITY = `${PersonRootConfig.module.name}.${PersonRootConfig.entities.person.name}`;\n\n//#region ---- Helpers ----\n\n/**\n * Resolves a persisted FK or lookup snapshot to a scalar id (avoids `String([object Object])` from expanded rows).\n */\nfunction axcScalarEntityId(value: unknown): string | null {\n if (value == null || value === '') {\n return null;\n }\n if (typeof value === 'string' || typeof value === 'number') {\n const s = String(value).trim();\n return s.length > 0 ? s : null;\n }\n if (typeof value === 'object' && value !== null && 'id' in value) {\n const id = (value as { id: unknown }).id;\n if (id == null || id === '') {\n return null;\n }\n const s = String(id).trim();\n return s.length > 0 ? s : null;\n }\n return null;\n}\n\n/** Non-empty trimmed string or undefined (for optional workflow command inputs). */\nfunction axcOptionalTrimmedString(raw: unknown): string | undefined {\n if (raw == null || raw === '') {\n return undefined;\n }\n const s = typeof raw === 'string' ? raw.trim() : String(raw).trim();\n return s.length > 0 ? s : undefined;\n}\n\n//#endregion\n\nexport interface AssignToManagerInput {\n /** When set, resolves the subject employee from HumanCapitalManagement.LeaveRequest. */\n leaveRequestId?: string;\n /** When set (scalar or `{ id }`), resolves manager for this employee directly (takes precedence over `leaveRequestId`). */\n employeeId?: unknown;\n /** When org manager cannot be resolved, this platform user id is returned as `managerId` (e.g. initiator for review fallback). */\n fallbackUserId?: unknown;\n}\n\nexport interface AssignToManagerOutput {\n managerId: string | null;\n employee: { displayName: string; [key: string]: unknown };\n leaveRequestId?: string;\n}\n\n/**\n * Assign To Manager Activity (Backend - Mock)\n *\n * Resolves the manager from `employeeId`, or from a leave request, or from the current user's employee when neither is set,\n * recomputing `managerId` from position assignments / org chart in storage when the denormalized field is stale.\n * Outputs the manager's **login user id** (from Employee or Person) for cartable `candidateUserIds` / human-task assignment.\n *\n * Execution Mode: backend\n * Activity Type: workflow-activity:assign-to-manager\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class AssignToManagerActivity implements AXPCommand<AssignToManagerInput, AssignToManagerOutput> {\n private readonly entityStorage = inject(AXPEntityStorageService);\n private readonly sessionService = inject(AXPSessionService);\n\n /**\n * Resolves login user id for an employee row (storage may omit `userId` while Person still links the account).\n */\n private async resolveLoginUserIdForEmployeeRow(\n managerEmp: { userId?: string | null; personId?: string | null } | null,\n ): Promise<string | null> {\n const direct =\n managerEmp?.userId != null && String(managerEmp.userId).trim() !== '' ? String(managerEmp.userId).trim() : null;\n if (direct) {\n return direct;\n }\n const personId =\n managerEmp?.personId != null && String(managerEmp.personId).trim() !== ''\n ? String(managerEmp.personId).trim()\n : null;\n if (!personId) {\n return null;\n }\n try {\n const person = (await this.entityStorage.getOne(PERSON_ENTITY, personId)) as { userId?: string | null } | null;\n const uid =\n person?.userId != null && String(person.userId).trim() !== '' ? String(person.userId).trim() : null;\n return uid;\n } catch {\n return null;\n }\n }\n\n /**\n * Persists org-derived manager + primary position for one employee, then returns the manager's user id when set.\n */\n private async resolveManagerUserId(employeeId: string): Promise<string | null> {\n await axcSyncSingleEmployeeDenormalizedOrgFields(\n this.entityStorage,\n OrgRootConfig,\n HcmRootConfig,\n String(employeeId),\n true,\n );\n const emp = (await this.entityStorage.getOne(EMPLOYEE_ENTITY, String(employeeId))) as {\n managerId?: string | null;\n } | null;\n const managerEmployeeId = emp?.managerId != null ? String(emp.managerId).trim() : '';\n if (!managerEmployeeId) {\n return null;\n }\n const managerEmp = (await this.entityStorage.getOne(EMPLOYEE_ENTITY, managerEmployeeId)) as {\n userId?: string | null;\n personId?: string | null;\n } | null;\n return this.resolveLoginUserIdForEmployeeRow(managerEmp);\n }\n\n private async findEmployeeIdByUserId(userId: string): Promise<string | null> {\n try {\n const result = await this.entityStorage.query(EMPLOYEE_ENTITY, {\n skip: 0,\n take: 1,\n filter: {\n field: 'userId',\n operator: { type: 'equal' },\n value: userId,\n },\n });\n const row = result.items?.[0] as { id?: string } | undefined;\n return row?.id != null ? String(row.id) : null;\n } catch {\n return null;\n }\n }\n\n async execute(input: AssignToManagerInput): Promise<AXPExecuteCommandResult<AssignToManagerOutput>> {\n const leaveRequestId = axcOptionalTrimmedString(input.leaveRequestId);\n\n let managerId: string | null = null;\n let employee: AssignToManagerOutput['employee'] = { displayName: '' };\n\n let subjectEmployeeId: string | null = null;\n\n const employeeIdFromInput = axcScalarEntityId(input.employeeId);\n\n if (employeeIdFromInput) {\n subjectEmployeeId = employeeIdFromInput;\n try {\n const emp = (await this.entityStorage.getOne(EMPLOYEE_ENTITY, subjectEmployeeId)) as {\n managerId?: string;\n userId?: string;\n displayName?: string;\n person?: { displayName?: string };\n } | null;\n if (emp) {\n employee = {\n displayName: emp.person?.displayName ?? emp.displayName ?? '',\n ...emp,\n };\n }\n managerId = await this.resolveManagerUserId(subjectEmployeeId);\n } catch {\n // keep defaults\n }\n } else if (leaveRequestId) {\n try {\n const leaveRequest = (await this.entityStorage.getOne(LEAVE_REQUEST_ENTITY, leaveRequestId)) as {\n employeeId?: string;\n employee?: unknown;\n employeeName?: string;\n } | null;\n\n subjectEmployeeId =\n axcScalarEntityId(leaveRequest?.employeeId) ??\n axcScalarEntityId((leaveRequest as { employee?: unknown }).employee) ??\n null;\n\n if (subjectEmployeeId) {\n const emp = (await this.entityStorage.getOne(EMPLOYEE_ENTITY, subjectEmployeeId)) as {\n managerId?: string;\n userId?: string;\n displayName?: string;\n person?: { displayName?: string };\n } | null;\n if (emp) {\n employee = {\n displayName: emp.person?.displayName ?? emp.displayName ?? '',\n ...emp,\n };\n }\n managerId = await this.resolveManagerUserId(subjectEmployeeId);\n }\n\n if (!employee.displayName && leaveRequest) {\n employee = {\n displayName:\n (leaveRequest as { employeeName?: string }).employeeName ??\n (leaveRequest as { employee?: { person?: { displayName?: string }; displayName?: string } }).employee\n ?.person?.displayName ??\n (leaveRequest as { employee?: { displayName?: string } }).employee?.displayName ??\n '',\n ...((leaveRequest as { employee?: object }).employee ?? {}),\n };\n }\n } catch {\n // keep defaults\n }\n }\n\n const sessionUserId = this.sessionService.user?.id;\n if (managerId == null && sessionUserId && !subjectEmployeeId) {\n const initiatorEmployeeId = await this.findEmployeeIdByUserId(String(sessionUserId));\n if (initiatorEmployeeId) {\n try {\n const emp = (await this.entityStorage.getOne(EMPLOYEE_ENTITY, initiatorEmployeeId)) as {\n displayName?: string;\n person?: { displayName?: string };\n } | null;\n if (emp) {\n employee = {\n displayName: emp.person?.displayName ?? emp.displayName ?? '',\n ...emp,\n };\n }\n } catch {\n // ignore\n }\n managerId = await this.resolveManagerUserId(initiatorEmployeeId);\n }\n }\n\n const fallbackUserId = axcScalarEntityId(input.fallbackUserId);\n if (managerId == null && fallbackUserId) {\n managerId = fallbackUserId;\n }\n\n return {\n success: true,\n data: {\n managerId,\n employee,\n leaveRequestId: leaveRequestId ?? undefined,\n },\n metadata: {\n outcome: 'done',\n },\n };\n }\n}\n"],"names":["HcmRootConfig","PersonRootConfig","OrgRootConfig"],"mappings":";;;;;;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AAS,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,mBAAmB,CAAC;YAClE;QACF;QAEA,MAAM,cAAc,GAAG,iBAAiB,CAAC,KAAK,CAAC,cAAc,CAAC;AAC9D,QAAA,IAAI,SAAS,IAAI,IAAI,IAAI,cAAc,EAAE;YACvC,SAAS,GAAG,cAAc;QAC5B;QAEA,OAAO;AACL,YAAA,OAAO,EAAE,IAAI;AACb,YAAA,IAAI,EAAE;gBACJ,SAAS;gBACT,QAAQ;gBACR,cAAc,EAAE,cAAc,IAAI,SAAS;AAC5C,aAAA;AACD,YAAA,QAAQ,EAAE;AACR,gBAAA,OAAO,EAAE,MAAM;AAChB,aAAA;SACF;IACH;8GA3LW,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAvB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uBAAuB,cAFtB,MAAM,EAAA,CAAA,CAAA;;2FAEP,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAHnC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;;;"}
|
|
1
|
+
{"version":3,"file":"acorex-connectivity-mock-assign-to-manager.activity-GtNzTHWI.mjs","sources":["../../../../libs/connectivity/mock/src/lib/workflow-management/activities/assign-to-manager.activity.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { RootConfig as HcmRootConfig } from '@acorex/modules/human-capital-management';\nimport { RootConfig as OrgRootConfig } from '@acorex/modules/organization-management';\nimport { RootConfig as PersonRootConfig } from '@acorex/modules/person-core';\nimport { AXPSessionService } from '@acorex/platform/auth';\nimport { AXPExecuteCommandResult } from '@acorex/platform/core';\nimport { AXPEntityStorageService } from '@acorex/platform/layout/entity';\nimport { AXPCommand } from '@acorex/platform/runtime';\nimport { axcSyncSingleEmployeeDenormalizedOrgFields } from '../../organization-management/org-chart/employee-manager-resolution';\n\nconst LEAVE_REQUEST_ENTITY = HcmRootConfig.entities.leaveRequest.source;\nconst EMPLOYEE_ENTITY = HcmRootConfig.entities.employee.source;\nconst PERSON_ENTITY = `${PersonRootConfig.module.name}.${PersonRootConfig.entities.person.name}`;\n\n//#region ---- Helpers ----\n\n/**\n * Resolves a persisted FK or lookup snapshot to a scalar id (avoids `String([object Object])` from expanded rows).\n */\nfunction axcScalarEntityId(value: unknown): string | null {\n if (value == null || value === '') {\n return null;\n }\n if (typeof value === 'string' || typeof value === 'number') {\n const s = String(value).trim();\n return s.length > 0 ? s : null;\n }\n if (typeof value === 'object' && value !== null && 'id' in value) {\n const id = (value as { id: unknown }).id;\n if (id == null || id === '') {\n return null;\n }\n const s = String(id).trim();\n return s.length > 0 ? s : null;\n }\n return null;\n}\n\n/** Non-empty trimmed string or undefined (for optional workflow command inputs). */\nfunction axcOptionalTrimmedString(raw: unknown): string | undefined {\n if (raw == null || raw === '') {\n return undefined;\n }\n const s = typeof raw === 'string' ? raw.trim() : String(raw).trim();\n return s.length > 0 ? s : undefined;\n}\n\n//#endregion\n\nexport interface AssignToManagerInput {\n /** When set, resolves the subject employee from HumanCapitalManagement.LeaveRequest. */\n leaveRequestId?: string;\n /** When set (scalar or `{ id }`), resolves manager for this employee directly (takes precedence over `leaveRequestId`). */\n employeeId?: unknown;\n /** When org manager cannot be resolved, this platform user id is returned as `managerId` (e.g. initiator for review fallback). */\n fallbackUserId?: unknown;\n}\n\nexport interface AssignToManagerOutput {\n managerId: string | null;\n employee: { displayName: string; [key: string]: unknown };\n leaveRequestId?: string;\n}\n\n/**\n * Assign To Manager Activity (Backend - Mock)\n *\n * Resolves the manager from `employeeId`, or from a leave request, or from the current user's employee when neither is set,\n * recomputing `managerId` from position assignments / org chart in storage when the denormalized field is stale.\n * Outputs the manager's **login user id** (from Employee or Person) for cartable `candidateUserIds` / human-task assignment.\n *\n * Execution Mode: backend\n * Activity Type: workflow-activity:assign-to-manager\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class AssignToManagerActivity implements AXPCommand<AssignToManagerInput, AssignToManagerOutput> {\n private readonly entityStorage = inject(AXPEntityStorageService);\n private readonly sessionService = inject(AXPSessionService);\n\n /**\n * Resolves login user id for an employee row (storage may omit `userId` while Person still links the account).\n */\n private async resolveLoginUserIdForEmployeeRow(\n managerEmp: { userId?: string | null; personId?: string | null } | null,\n ): Promise<string | null> {\n const direct =\n managerEmp?.userId != null && String(managerEmp.userId).trim() !== '' ? String(managerEmp.userId).trim() : null;\n if (direct) {\n return direct;\n }\n const personId =\n managerEmp?.personId != null && String(managerEmp.personId).trim() !== ''\n ? String(managerEmp.personId).trim()\n : null;\n if (!personId) {\n return null;\n }\n try {\n const person = (await this.entityStorage.getOne(PERSON_ENTITY, personId)) as { userId?: string | null } | null;\n const uid =\n person?.userId != null && String(person.userId).trim() !== '' ? String(person.userId).trim() : null;\n return uid;\n } catch {\n return null;\n }\n }\n\n /**\n * Persists org-derived manager + primary position for one employee, then returns the manager's user id when set.\n */\n private async resolveManagerUserId(employeeId: string): Promise<string | null> {\n await axcSyncSingleEmployeeDenormalizedOrgFields(\n this.entityStorage,\n OrgRootConfig,\n HcmRootConfig,\n String(employeeId),\n true,\n );\n const emp = (await this.entityStorage.getOne(EMPLOYEE_ENTITY, String(employeeId))) as {\n managerId?: string | null;\n } | null;\n const managerEmployeeId = emp?.managerId != null ? String(emp.managerId).trim() : '';\n if (!managerEmployeeId) {\n return null;\n }\n const managerEmp = (await this.entityStorage.getOne(EMPLOYEE_ENTITY, managerEmployeeId)) as {\n userId?: string | null;\n personId?: string | null;\n } | null;\n return this.resolveLoginUserIdForEmployeeRow(managerEmp);\n }\n\n private async findEmployeeIdByUserId(userId: string): Promise<string | null> {\n try {\n const result = await this.entityStorage.query(EMPLOYEE_ENTITY, {\n skip: 0,\n take: 1,\n filter: {\n field: 'userId',\n operator: { type: 'equal' },\n value: userId,\n },\n });\n const row = result.items?.[0] as { id?: string } | undefined;\n return row?.id != null ? String(row.id) : null;\n } catch {\n return null;\n }\n }\n\n async execute(input: AssignToManagerInput): Promise<AXPExecuteCommandResult<AssignToManagerOutput>> {\n const leaveRequestId = axcOptionalTrimmedString(input.leaveRequestId);\n\n let managerId: string | null = null;\n let employee: AssignToManagerOutput['employee'] = { displayName: '' };\n\n let subjectEmployeeId: string | null = null;\n\n const employeeIdFromInput = axcScalarEntityId(input.employeeId);\n\n if (employeeIdFromInput) {\n subjectEmployeeId = employeeIdFromInput;\n try {\n const emp = (await this.entityStorage.getOne(EMPLOYEE_ENTITY, subjectEmployeeId)) as {\n managerId?: string;\n userId?: string;\n displayName?: string;\n person?: { displayName?: string };\n } | null;\n if (emp) {\n employee = {\n displayName: emp.person?.displayName ?? emp.displayName ?? '',\n ...emp,\n };\n }\n managerId = await this.resolveManagerUserId(subjectEmployeeId);\n } catch {\n // keep defaults\n }\n } else if (leaveRequestId) {\n try {\n const leaveRequest = (await this.entityStorage.getOne(LEAVE_REQUEST_ENTITY, leaveRequestId)) as {\n employeeId?: string;\n employee?: unknown;\n employeeName?: string;\n } | null;\n\n subjectEmployeeId =\n axcScalarEntityId(leaveRequest?.employeeId) ??\n axcScalarEntityId((leaveRequest as { employee?: unknown }).employee) ??\n null;\n\n if (subjectEmployeeId) {\n const emp = (await this.entityStorage.getOne(EMPLOYEE_ENTITY, subjectEmployeeId)) as {\n managerId?: string;\n userId?: string;\n displayName?: string;\n person?: { displayName?: string };\n } | null;\n if (emp) {\n employee = {\n displayName: emp.person?.displayName ?? emp.displayName ?? '',\n ...emp,\n };\n }\n managerId = await this.resolveManagerUserId(subjectEmployeeId);\n }\n\n if (!employee.displayName && leaveRequest) {\n employee = {\n displayName:\n (leaveRequest as { employeeName?: string }).employeeName ??\n (leaveRequest as { employee?: { person?: { displayName?: string }; displayName?: string } }).employee\n ?.person?.displayName ??\n (leaveRequest as { employee?: { displayName?: string } }).employee?.displayName ??\n '',\n ...((leaveRequest as { employee?: object }).employee ?? {}),\n };\n }\n } catch {\n // keep defaults\n }\n }\n\n const sessionUserId = this.sessionService.user?.id;\n if (managerId == null && sessionUserId && !subjectEmployeeId) {\n const initiatorEmployeeId = await this.findEmployeeIdByUserId(String(sessionUserId));\n if (initiatorEmployeeId) {\n try {\n const emp = (await this.entityStorage.getOne(EMPLOYEE_ENTITY, initiatorEmployeeId)) as {\n displayName?: string;\n person?: { displayName?: string };\n } | null;\n if (emp) {\n employee = {\n displayName: emp.person?.displayName ?? emp.displayName ?? '',\n ...emp,\n };\n }\n } catch {\n // ignore\n }\n managerId = await this.resolveManagerUserId(initiatorEmployeeId);\n }\n }\n\n const fallbackUserId = axcScalarEntityId(input.fallbackUserId);\n if (managerId == null && fallbackUserId) {\n managerId = fallbackUserId;\n }\n\n return {\n success: true,\n data: {\n managerId,\n employee,\n leaveRequestId: leaveRequestId ?? undefined,\n },\n metadata: {\n outcome: 'done',\n },\n };\n }\n}\n"],"names":["HcmRootConfig","PersonRootConfig","OrgRootConfig"],"mappings":";;;;;;;;;AAUA,MAAM,oBAAoB,GAAGA,UAAa,CAAC,QAAQ,CAAC,YAAY,CAAC,MAAM;AACvE,MAAM,eAAe,GAAGA,UAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM;AAC9D,MAAM,aAAa,GAAG,CAAA,EAAGC,YAAgB,CAAC,MAAM,CAAC,IAAI,CAAA,CAAA,EAAIA,YAAgB,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE;AAEhG;AAEA;;AAEG;AACH,SAAS,iBAAiB,CAAC,KAAc,EAAA;IACvC,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,EAAE,EAAE;AACjC,QAAA,OAAO,IAAI;IACb;IACA,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,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CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAvB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uBAAuB,cAFtB,MAAM,EAAA,CAAA,CAAA;;2FAEP,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAHnC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;;;"}
|
|
@@ -3,7 +3,7 @@ import * as i0 from '@angular/core';
|
|
|
3
3
|
import { inject, Injectable } from '@angular/core';
|
|
4
4
|
import { AXPFileStorageService } from '@acorex/platform/common';
|
|
5
5
|
import { AXPEntityService } from '@acorex/platform/layout/entity';
|
|
6
|
-
import { A as AXCAiChatRouterService, r as resolveDelegatedAssistOptionModel, a as AXMAiModelStableIds } from './acorex-connectivity-mock-acorex-connectivity-mock-
|
|
6
|
+
import { A as AXCAiChatRouterService, r as resolveDelegatedAssistOptionModel, a as AXMAiModelStableIds } from './acorex-connectivity-mock-acorex-connectivity-mock-QxKVNQo9.mjs';
|
|
7
7
|
|
|
8
8
|
//#region ---- Imports ----
|
|
9
9
|
function parseGenerateImageInput(args) {
|
|
@@ -105,4 +105,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
105
105
|
}] });
|
|
106
106
|
|
|
107
107
|
export { AiManagementChatGenerateImageCommand };
|
|
108
|
-
//# sourceMappingURL=acorex-connectivity-mock-chat-generate-image.command-
|
|
108
|
+
//# sourceMappingURL=acorex-connectivity-mock-chat-generate-image.command-BAMTtIN_.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-connectivity-mock-chat-generate-image.command-
|
|
1
|
+
{"version":3,"file":"acorex-connectivity-mock-chat-generate-image.command-BAMTtIN_.mjs","sources":["../../../../libs/connectivity/mock/src/lib/ai-management/commands/chat-generate-image.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport {\n AI_CHAT_GENERATED_IMAGE_REF_TYPE,\n AI_GENERATED_IMAGE_MAX_REMOTE_URL_IN_TOOL,\n AXPAiChatToolRunContextService,\n blobOrFileFromImageResult,\n persistAiGeneratedImage,\n RootConfig,\n} from '@acorex/modules/ai-management';\nimport { Injectable, inject } from '@angular/core';\nimport { AXPExecuteCommandResult } from '@acorex/platform/core';\nimport { AXPCommand } from '@acorex/platform/runtime';\nimport { AXPFileStorageService } from '@acorex/platform/common';\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\n\nimport type { AXMAiAssistRow } from '../ai-agent-engine.types';\nimport { resolveDelegatedAssistOptionModel } from '../ai-delegated-agent-parameters.util';\nimport { AXCAiChatRouterService } from '../chat/ai-chat-router.service';\nimport { AXMAiModelStableIds } from '../model/model.mock';\n\n//#endregion\n\n//#region ---- Command: AiManagement:ChatGenerateImage ----\n\nexport interface AiManagementChatGenerateImageInput {\n /**\n * Catalog `AiModel` row id for an image-purpose model. When omitted, uses\n * `delegatedAgents[].options.model` for the active delegated specialist (`agentId` in run context),\n * then falls back to the mock catalog default (OpenAI gpt-image-1).\n */\n model?: string;\n prompt?: string;\n size?: string;\n style?: string;\n}\n\nfunction parseGenerateImageInput(args: unknown):\n | { ok: true; model?: string; prompt: string; size?: string; style?: string }\n | { ok: false; error: string } {\n const obj =\n args != null && typeof args === 'object' && !Array.isArray(args)\n ? (args as Record<string, unknown>)\n : null;\n if (!obj) {\n return { ok: false, error: 'Invalid arguments: expected an object.' };\n }\n const prompt = typeof obj['prompt'] === 'string' ? obj['prompt'].trim() : '';\n if (!prompt) {\n return { ok: false, error: 'Invalid arguments: \"prompt\" is required and must be non-empty.' };\n }\n const model = typeof obj['model'] === 'string' ? obj['model'].trim() : undefined;\n const size = typeof obj['size'] === 'string' ? obj['size'].trim() : undefined;\n const style = typeof obj['style'] === 'string' ? obj['style'].trim() : undefined;\n return {\n ok: true,\n prompt,\n ...(model ? { model } : {}),\n ...(size ? { size } : {}),\n ...(style ? { style } : {}),\n };\n}\n\n@Injectable()\nexport class AiManagementChatGenerateImageCommand\n implements AXPCommand<AiManagementChatGenerateImageInput, { fileId?: string; prompt: string; imageUrl?: string }>\n{\n private readonly aiChatRouter = inject(AXCAiChatRouterService);\n private readonly runContext = inject(AXPAiChatToolRunContextService);\n private readonly fileStorage = inject(AXPFileStorageService);\n private readonly entityService = inject(AXPEntityService);\n\n private readonly assistData = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assist.name)\n .data<string, AXMAiAssistRow, AXMAiAssistRow, AXMAiAssistRow, AXMAiAssistRow>();\n\n async execute(\n input: AiManagementChatGenerateImageInput,\n ): Promise<AXPExecuteCommandResult<{ fileId?: string; prompt: string; imageUrl?: string }>> {\n const ctx = this.runContext.getContext();\n if (!ctx?.assistId?.trim()) {\n return {\n success: false,\n message: {\n text: 'Image generation requires an active AI chat run context (assist id).',\n },\n };\n }\n\n const parsed = parseGenerateImageInput(input);\n if (!parsed.ok) {\n return { success: false, message: { text: parsed.error } };\n }\n\n try {\n const assist = await this.assistData.byKey(ctx.assistId.trim());\n if (!assist) {\n return {\n success: false,\n message: { text: `Assist row was not found (id: ${ctx.assistId.trim()}).` },\n };\n }\n\n const modelEntityId =\n parsed.model?.trim() ||\n resolveDelegatedAssistOptionModel(assist, ctx.agentId) ||\n AXMAiModelStableIds.openaiGptImage1;\n\n let composedPrompt = parsed.prompt;\n if (parsed.style?.trim()) {\n composedPrompt = `${composedPrompt}\\nStyle: ${parsed.style.trim()}`;\n }\n\n const { imageUrl } = await this.aiChatRouter.generateImage({\n modelEntityId,\n prompt: composedPrompt,\n size: parsed.size?.trim() || undefined,\n });\n\n try {\n const file = await blobOrFileFromImageResult(imageUrl);\n const { fileId } = await persistAiGeneratedImage(this.fileStorage, file, {\n refId: assist.id,\n refType: AI_CHAT_GENERATED_IMAGE_REF_TYPE,\n });\n return { success: true, data: { fileId, prompt: parsed.prompt } };\n } catch (persistErr) {\n const u = imageUrl.trim();\n if (u.startsWith('https://') && u.length <= AI_GENERATED_IMAGE_MAX_REMOTE_URL_IN_TOOL) {\n return {\n success: true,\n data: { prompt: parsed.prompt, imageUrl: u },\n };\n }\n const pmsg = persistErr instanceof Error ? persistErr.message : String(persistErr);\n throw new Error(`Could not store generated image for chat replay. ${pmsg}`);\n }\n } catch (e) {\n const msg = e instanceof Error ? e.message : String(e);\n return { success: false, message: { text: msg } };\n }\n }\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;AAAA;AAqCA,SAAS,uBAAuB,CAAC,IAAa,EAAA;AAG5C,IAAA,MAAM,GAAG,GACP,IAAI,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI;AAC7D,UAAG;UACD,IAAI;IACV,IAAI,CAAC,GAAG,EAAE;QACR,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,wCAAwC,EAAE;IACvE;IACA,MAAM,MAAM,GAAG,OAAO,GAAG,CAAC,QAAQ,CAAC,KAAK,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE;IAC5E,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,gEAAgE,EAAE;IAC/F;IACA,MAAM,KAAK,GAAG,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,GAAG,SAAS;IAChF,MAAM,IAAI,GAAG,OAAO,GAAG,CAAC,MAAM,CAAC,KAAK,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,GAAG,SAAS;IAC7E,MAAM,KAAK,GAAG,OAAO,GAAG,CAAC,OAAO,CAAC,KAA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AChB,oBAAA,OAAO,EAAE,gCAAgC;AAC1C,iBAAA,CAAC;AACF,gBAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE;YACnE;YAAE,OAAO,UAAU,EAAE;AACnB,gBAAA,MAAM,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE;AACzB,gBAAA,IAAI,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,yCAAyC,EAAE;oBACrF,OAAO;AACL,wBAAA,OAAO,EAAE,IAAI;wBACb,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,EAAE;qBAC7C;gBACH;AACA,gBAAA,MAAM,IAAI,GAAG,UAAU,YAAY,KAAK,GAAG,UAAU,CAAC,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC;AAClF,gBAAA,MAAM,IAAI,KAAK,CAAC,oDAAoD,IAAI,CAAA,CAAE,CAAC;YAC7E;QACF;QAAE,OAAO,CAAC,EAAE;AACV,YAAA,MAAM,GAAG,GAAG,CAAC,YAAY,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC;AACtD,YAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;QACnD;IACF;8GA7EW,oCAAoC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAApC,oCAAoC,EAAA,CAAA,CAAA;;2FAApC,oCAAoC,EAAA,UAAA,EAAA,CAAA;kBADhD;;;;;"}
|
|
@@ -3,7 +3,7 @@ import * as i0 from '@angular/core';
|
|
|
3
3
|
import { inject, Injectable } from '@angular/core';
|
|
4
4
|
import { AXPFileStorageService } from '@acorex/platform/common';
|
|
5
5
|
import { AXPEntityService } from '@acorex/platform/layout/entity';
|
|
6
|
-
import { A as AXCAiChatRouterService, r as resolveDelegatedAssistOptionModel, b as resolveDelegatedAssistOptionString } from './acorex-connectivity-mock-acorex-connectivity-mock-
|
|
6
|
+
import { A as AXCAiChatRouterService, r as resolveDelegatedAssistOptionModel, b as resolveDelegatedAssistOptionString } from './acorex-connectivity-mock-acorex-connectivity-mock-QxKVNQo9.mjs';
|
|
7
7
|
|
|
8
8
|
//#region ---- Imports ----
|
|
9
9
|
function extForMime(mime) {
|
|
@@ -127,4 +127,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
127
127
|
}] });
|
|
128
128
|
|
|
129
129
|
export { AiManagementChatSynthesizeSpeechCommand };
|
|
130
|
-
//# sourceMappingURL=acorex-connectivity-mock-chat-synthesize-speech.command-
|
|
130
|
+
//# sourceMappingURL=acorex-connectivity-mock-chat-synthesize-speech.command-C0pQvhMF.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-connectivity-mock-chat-synthesize-speech.command-Dieqfce2.mjs","sources":["../../../../libs/connectivity/mock/src/lib/ai-management/commands/chat-synthesize-speech.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport {\n AI_CHAT_GENERATED_SPEECH_REF_TYPE,\n AXPAiChatToolRunContextService,\n persistAiGeneratedSpeech,\n RootConfig,\n} from '@acorex/modules/ai-management';\nimport { Injectable, inject } from '@angular/core';\nimport { AXPExecuteCommandResult } from '@acorex/platform/core';\nimport { AXPCommand } from '@acorex/platform/runtime';\nimport { AXPFileStorageService } from '@acorex/platform/common';\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\n\nimport type { AXMAiAssistRow } from '../ai-agent-engine.types';\nimport {\n resolveDelegatedAssistOptionModel,\n resolveDelegatedAssistOptionString,\n} from '../ai-delegated-agent-parameters.util';\nimport { AXCAiChatRouterService } from '../chat/ai-chat-router.service';\n\n//#endregion\n\n//#region ---- Command: AiManagement:ChatSynthesizeSpeech ----\n\nexport interface AiManagementChatSynthesizeSpeechInput {\n /** Catalog `AiModel` row id (purpose `tts`). When omitted, uses `delegatedAgents[].options.model` for the active delegated specialist. */\n model?: string;\n text?: string;\n voice?: string;\n responseFormat?: string;\n}\n\nfunction extForMime(mime: string): string {\n const m = mime.toLowerCase();\n if (m.includes('mpeg') || m.includes('mp3')) {\n return 'mp3';\n }\n if (m.includes('wav')) {\n return 'wav';\n }\n if (m.includes('opus')) {\n return 'opus';\n }\n if (m.includes('ogg')) {\n return 'ogg';\n }\n if (m.includes('aac')) {\n return 'aac';\n }\n if (m.includes('flac')) {\n return 'flac';\n }\n return 'bin';\n}\n\nfunction parseSynthesizeInput(args: unknown):\n | { ok: true; model?: string; text: string; voice?: string; responseFormat?: string }\n | { ok: false; error: string } {\n const obj =\n args != null && typeof args === 'object' && !Array.isArray(args)\n ? (args as Record<string, unknown>)\n : null;\n if (!obj) {\n return { ok: false, error: 'Invalid arguments: expected an object.' };\n }\n const text = typeof obj['text'] === 'string' ? obj['text'].trim() : '';\n if (!text) {\n return { ok: false, error: 'Invalid arguments: \"text\" is required and must be non-empty.' };\n }\n const model = typeof obj['model'] === 'string' ? obj['model'].trim() : undefined;\n const voice = typeof obj['voice'] === 'string' ? obj['voice'].trim() : undefined;\n const responseFormat =\n typeof obj['responseFormat'] === 'string' ? obj['responseFormat'].trim() : undefined;\n return {\n ok: true,\n text,\n ...(model ? { model } : {}),\n ...(voice ? { voice } : {}),\n ...(responseFormat ? { responseFormat } : {}),\n };\n}\n\n@Injectable()\nexport class AiManagementChatSynthesizeSpeechCommand\n implements\n AXPCommand<\n AiManagementChatSynthesizeSpeechInput,\n { fileId?: string; text: string; mimeType?: string }\n >\n{\n private readonly aiChatRouter = inject(AXCAiChatRouterService);\n private readonly runContext = inject(AXPAiChatToolRunContextService);\n private readonly fileStorage = inject(AXPFileStorageService);\n private readonly entityService = inject(AXPEntityService);\n\n private readonly assistData = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assist.name)\n .data<string, AXMAiAssistRow, AXMAiAssistRow, AXMAiAssistRow, AXMAiAssistRow>();\n\n async execute(\n input: AiManagementChatSynthesizeSpeechInput,\n ): Promise<AXPExecuteCommandResult<{ fileId?: string; text: string; mimeType?: string }>> {\n const ctx = this.runContext.getContext();\n if (!ctx?.assistId?.trim()) {\n return {\n success: false,\n message: {\n text: 'Text-to-speech requires an active AI chat run context (assist id).',\n },\n };\n }\n\n const parsed = parseSynthesizeInput(input);\n if (!parsed.ok) {\n return { success: false, message: { text: parsed.error } };\n }\n\n try {\n const assist = await this.assistData.byKey(ctx.assistId.trim());\n if (!assist) {\n return {\n success: false,\n message: { text: `Assist row was not found (id: ${ctx.assistId.trim()}).` },\n };\n }\n\n const modelEntityId =\n parsed.model?.trim() || resolveDelegatedAssistOptionModel(assist, ctx.agentId) || '';\n if (!modelEntityId) {\n return {\n success: false,\n message: {\n text:\n 'No TTS model: pass \"model\" (catalog id) or set options.model on the text-to-speech delegated specialist row for this assist.',\n },\n };\n }\n\n const voiceFromAssist =\n resolveDelegatedAssistOptionString(assist, ctx.agentId, 'voice') || undefined;\n const voice = parsed.voice?.trim() || voiceFromAssist || 'alloy';\n\n const { audioBytes, mimeType } = await this.aiChatRouter.synthesizeSpeech({\n modelEntityId,\n text: parsed.text,\n voice,\n ...(parsed.responseFormat?.trim() ? { responseFormat: parsed.responseFormat.trim() } : {}),\n });\n\n const mt = mimeType?.trim() || 'application/octet-stream';\n const ext = extForMime(mt);\n const file = new File([audioBytes], `ai-tts.${ext}`, { type: mt });\n\n try {\n const { fileId } = await persistAiGeneratedSpeech(this.fileStorage, file, {\n refId: assist.id,\n refType: AI_CHAT_GENERATED_SPEECH_REF_TYPE,\n });\n return { success: true, data: { fileId, text: parsed.text, mimeType: mt } };\n } catch (persistErr) {\n const pmsg = persistErr instanceof Error ? persistErr.message : String(persistErr);\n throw new Error(`Could not store synthesized speech for chat replay. ${pmsg}`);\n }\n } catch (e) {\n const msg = e instanceof Error ? e.message : String(e);\n return { success: false, message: { text: msg } };\n }\n }\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;AAAA;AAiCA,SAAS,UAAU,CAAC,IAAY,EAAA;AAC9B,IAAA,MAAM,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE;AAC5B,IAAA,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AAC3C,QAAA,OAAO,KAAK;IACd;AACA,IAAA,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AACrB,QAAA,OAAO,KAAK;IACd;AACA,IAAA,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;AACtB,QAAA,OAAO,MAAM;IACf;AACA,IAAA,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AACrB,QAAA,OAAO,KAAK;IACd;AACA,IAAA,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AACrB,QAAA,OAAO,KAAK;IACd;AACA,IAAA,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;AACtB,QAAA,OAAO,MAAM;IACf;AACA,IAAA,OAAO,KAAK;AACd;AAEA,SAAS,oBAAoB,CAAC,IAAa,EAAA;AAGzC,IAAA,MAAM,GAAG,GACP,IAAI,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI;AAC7D,UAAG;UACD,IAAI;IACV,IAAI,CAAC,GAAG,EAAE;QACR,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,wCAAwC,EAAE;IACvE;IACA,MAAM,IAAI,GAAG,OAAO,GAAG,CAAC,MAAM,CAAC,KAAK,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE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AE,CAAC;YAChF;QACF;QAAE,OAAO,CAAC,EAAE;AACV,YAAA,MAAM,GAAG,GAAG,CAAC,YAAY,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC;AACtD,YAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;QACnD;IACF;8GApFW,uCAAuC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAAvC,uCAAuC,EAAA,CAAA,CAAA;;2FAAvC,uCAAuC,EAAA,UAAA,EAAA,CAAA;kBADnD;;;;;"}
|
|
1
|
+
{"version":3,"file":"acorex-connectivity-mock-chat-synthesize-speech.command-C0pQvhMF.mjs","sources":["../../../../libs/connectivity/mock/src/lib/ai-management/commands/chat-synthesize-speech.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport {\n AI_CHAT_GENERATED_SPEECH_REF_TYPE,\n AXPAiChatToolRunContextService,\n persistAiGeneratedSpeech,\n RootConfig,\n} from '@acorex/modules/ai-management';\nimport { Injectable, inject } from '@angular/core';\nimport { AXPExecuteCommandResult } from '@acorex/platform/core';\nimport { AXPCommand } from '@acorex/platform/runtime';\nimport { AXPFileStorageService } from '@acorex/platform/common';\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\n\nimport type { AXMAiAssistRow } from '../ai-agent-engine.types';\nimport {\n resolveDelegatedAssistOptionModel,\n resolveDelegatedAssistOptionString,\n} from '../ai-delegated-agent-parameters.util';\nimport { AXCAiChatRouterService } from '../chat/ai-chat-router.service';\n\n//#endregion\n\n//#region ---- Command: AiManagement:ChatSynthesizeSpeech ----\n\nexport interface AiManagementChatSynthesizeSpeechInput {\n /** Catalog `AiModel` row id (purpose `tts`). When omitted, uses `delegatedAgents[].options.model` for the active delegated specialist. */\n model?: string;\n text?: string;\n voice?: string;\n responseFormat?: string;\n}\n\nfunction extForMime(mime: string): string {\n const m = mime.toLowerCase();\n if (m.includes('mpeg') || m.includes('mp3')) {\n return 'mp3';\n }\n if (m.includes('wav')) {\n return 'wav';\n }\n if (m.includes('opus')) {\n return 'opus';\n }\n if (m.includes('ogg')) {\n return 'ogg';\n }\n if (m.includes('aac')) {\n return 'aac';\n }\n if (m.includes('flac')) {\n return 'flac';\n }\n return 'bin';\n}\n\nfunction parseSynthesizeInput(args: unknown):\n | { ok: true; model?: string; text: string; voice?: string; responseFormat?: string }\n | { ok: false; error: string } {\n const obj =\n args != null && typeof args === 'object' && !Array.isArray(args)\n ? (args as Record<string, unknown>)\n : null;\n if (!obj) {\n return { ok: false, error: 'Invalid arguments: expected an object.' };\n }\n const text = typeof obj['text'] === 'string' ? obj['text'].trim() : '';\n if (!text) {\n return { ok: false, error: 'Invalid arguments: \"text\" is required and must be non-empty.' };\n }\n const model = typeof obj['model'] === 'string' ? obj['model'].trim() : undefined;\n const voice = typeof obj['voice'] === 'string' ? obj['voice'].trim() : undefined;\n const responseFormat =\n typeof obj['responseFormat'] === 'string' ? obj['responseFormat'].trim() : undefined;\n return {\n ok: true,\n text,\n ...(model ? { model } : {}),\n ...(voice ? { voice } : {}),\n ...(responseFormat ? { responseFormat } : {}),\n };\n}\n\n@Injectable()\nexport class AiManagementChatSynthesizeSpeechCommand\n implements\n AXPCommand<\n AiManagementChatSynthesizeSpeechInput,\n { fileId?: string; text: string; mimeType?: string }\n >\n{\n private readonly aiChatRouter = inject(AXCAiChatRouterService);\n private readonly runContext = inject(AXPAiChatToolRunContextService);\n private readonly fileStorage = inject(AXPFileStorageService);\n private readonly entityService = inject(AXPEntityService);\n\n private readonly assistData = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assist.name)\n .data<string, AXMAiAssistRow, AXMAiAssistRow, AXMAiAssistRow, AXMAiAssistRow>();\n\n async execute(\n input: AiManagementChatSynthesizeSpeechInput,\n ): Promise<AXPExecuteCommandResult<{ fileId?: string; text: string; mimeType?: string }>> {\n const ctx = this.runContext.getContext();\n if (!ctx?.assistId?.trim()) {\n return {\n success: false,\n message: {\n text: 'Text-to-speech requires an active AI chat run context (assist id).',\n },\n };\n }\n\n const parsed = parseSynthesizeInput(input);\n if (!parsed.ok) {\n return { success: false, message: { text: parsed.error } };\n }\n\n try {\n const assist = await this.assistData.byKey(ctx.assistId.trim());\n if (!assist) {\n return {\n success: false,\n message: { text: `Assist row was not found (id: ${ctx.assistId.trim()}).` },\n };\n }\n\n const modelEntityId =\n parsed.model?.trim() || resolveDelegatedAssistOptionModel(assist, ctx.agentId) || '';\n if (!modelEntityId) {\n return {\n success: false,\n message: {\n text:\n 'No TTS model: pass \"model\" (catalog id) or set options.model on the text-to-speech delegated specialist row for this assist.',\n },\n };\n }\n\n const voiceFromAssist =\n resolveDelegatedAssistOptionString(assist, ctx.agentId, 'voice') || undefined;\n const voice = parsed.voice?.trim() || voiceFromAssist || 'alloy';\n\n const { audioBytes, mimeType } = await this.aiChatRouter.synthesizeSpeech({\n modelEntityId,\n text: parsed.text,\n voice,\n ...(parsed.responseFormat?.trim() ? { responseFormat: parsed.responseFormat.trim() } : {}),\n });\n\n const mt = mimeType?.trim() || 'application/octet-stream';\n const ext = extForMime(mt);\n const file = new File([audioBytes], `ai-tts.${ext}`, { type: mt });\n\n try {\n const { fileId } = await persistAiGeneratedSpeech(this.fileStorage, file, {\n refId: assist.id,\n refType: AI_CHAT_GENERATED_SPEECH_REF_TYPE,\n });\n return { success: true, data: { fileId, text: parsed.text, mimeType: mt } };\n } catch (persistErr) {\n const pmsg = persistErr instanceof Error ? persistErr.message : String(persistErr);\n throw new Error(`Could not store synthesized speech for chat replay. ${pmsg}`);\n }\n } catch (e) {\n const msg = e instanceof Error ? e.message : String(e);\n return { success: false, message: { text: msg } };\n }\n }\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;AAAA;AAiCA,SAAS,UAAU,CAAC,IAAY,EAAA;AAC9B,IAAA,MAAM,CAAC,GAAG,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EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;QACnD;IACF;8GApFW,uCAAuC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAAvC,uCAAuC,EAAA,CAAA,CAAA;;2FAAvC,uCAAuC,EAAA,UAAA,EAAA,CAAA;kBADnD;;;;;"}
|
|
@@ -3,7 +3,7 @@ import * as i0 from '@angular/core';
|
|
|
3
3
|
import { inject, Injectable } from '@angular/core';
|
|
4
4
|
import { AXPFileStorageService } from '@acorex/platform/common';
|
|
5
5
|
import { AXPEntityService } from '@acorex/platform/layout/entity';
|
|
6
|
-
import { A as AXCAiChatRouterService, r as resolveDelegatedAssistOptionModel, b as resolveDelegatedAssistOptionString } from './acorex-connectivity-mock-acorex-connectivity-mock-
|
|
6
|
+
import { A as AXCAiChatRouterService, r as resolveDelegatedAssistOptionModel, b as resolveDelegatedAssistOptionString } from './acorex-connectivity-mock-acorex-connectivity-mock-QxKVNQo9.mjs';
|
|
7
7
|
|
|
8
8
|
//#region ---- Imports ----
|
|
9
9
|
function parseTranscribeInput(args) {
|
|
@@ -107,4 +107,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
107
107
|
}] });
|
|
108
108
|
|
|
109
109
|
export { AiManagementChatTranscribeSpeechCommand };
|
|
110
|
-
//# sourceMappingURL=acorex-connectivity-mock-chat-transcribe-speech.command-
|
|
110
|
+
//# sourceMappingURL=acorex-connectivity-mock-chat-transcribe-speech.command-BRDl6roP.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-connectivity-mock-chat-transcribe-speech.command-
|
|
1
|
+
{"version":3,"file":"acorex-connectivity-mock-chat-transcribe-speech.command-BRDl6roP.mjs","sources":["../../../../libs/connectivity/mock/src/lib/ai-management/commands/chat-transcribe-speech.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPAiChatToolRunContextService, RootConfig } from '@acorex/modules/ai-management';\nimport { Injectable, inject } from '@angular/core';\nimport { AXPExecuteCommandResult } from '@acorex/platform/core';\nimport { AXPCommand } from '@acorex/platform/runtime';\nimport { AXPFileStorageService } from '@acorex/platform/common';\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\n\nimport type { AXMAiAssistRow } from '../ai-agent-engine.types';\nimport {\n resolveDelegatedAssistOptionModel,\n resolveDelegatedAssistOptionString,\n} from '../ai-delegated-agent-parameters.util';\nimport { AXCAiChatRouterService } from '../chat/ai-chat-router.service';\n\n//#endregion\n\n//#region ---- Command: AiManagement:ChatTranscribeSpeech ----\n\nexport interface AiManagementChatTranscribeSpeechInput {\n /** Catalog `AiModel` row id for a speech-purpose model. When omitted, uses `delegatedAgents[].options.model` for the active delegated specialist (`agentId` in run context). */\n model?: string;\n fileId?: string;\n language?: string;\n}\n\nfunction parseTranscribeInput(args: unknown):\n | { ok: true; model?: string; fileId: string; language?: string }\n | { ok: false; error: string } {\n const obj =\n args != null && typeof args === 'object' && !Array.isArray(args)\n ? (args as Record<string, unknown>)\n : null;\n if (!obj) {\n return { ok: false, error: 'Invalid arguments: expected an object.' };\n }\n const fileId = typeof obj['fileId'] === 'string' ? obj['fileId'].trim() : '';\n if (!fileId) {\n return { ok: false, error: 'Invalid arguments: \"fileId\" is required and must be non-empty.' };\n }\n const model = typeof obj['model'] === 'string' ? obj['model'].trim() : undefined;\n const language = typeof obj['language'] === 'string' ? obj['language'].trim() : undefined;\n return {\n ok: true,\n fileId,\n ...(model ? { model } : {}),\n ...(language ? { language } : {}),\n };\n}\n\n@Injectable()\nexport class AiManagementChatTranscribeSpeechCommand\n implements AXPCommand<AiManagementChatTranscribeSpeechInput, { text: string }>\n{\n private readonly aiChatRouter = inject(AXCAiChatRouterService);\n private readonly runContext = inject(AXPAiChatToolRunContextService);\n private readonly fileStorage = inject(AXPFileStorageService);\n private readonly entityService = inject(AXPEntityService);\n\n private readonly assistData = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assist.name)\n .data<string, AXMAiAssistRow, AXMAiAssistRow, AXMAiAssistRow, AXMAiAssistRow>();\n\n async execute(\n input: AiManagementChatTranscribeSpeechInput,\n ): Promise<AXPExecuteCommandResult<{ text: string }>> {\n const ctx = this.runContext.getContext();\n if (!ctx?.assistId?.trim()) {\n return {\n success: false,\n message: {\n text: 'Speech transcription requires an active AI chat run context (assist id).',\n },\n };\n }\n\n const parsed = parseTranscribeInput(input);\n if (!parsed.ok) {\n return { success: false, message: { text: parsed.error } };\n }\n\n try {\n const assist = await this.assistData.byKey(ctx.assistId.trim());\n if (!assist) {\n return {\n success: false,\n message: { text: `Assist row was not found (id: ${ctx.assistId.trim()}).` },\n };\n }\n\n const modelEntityId =\n parsed.model?.trim() || resolveDelegatedAssistOptionModel(assist, ctx.agentId) || '';\n if (!modelEntityId) {\n return {\n success: false,\n message: {\n text:\n 'No speech model: pass \"model\" (catalog id) or set options.model on the speech-to-text delegated specialist row for this assist.',\n },\n };\n }\n\n let mimeType = 'application/octet-stream';\n let audioBytes: ArrayBuffer;\n try {\n const info = await this.fileStorage.getInfo(parsed.fileId);\n const file = info.binary;\n mimeType = info.mimeType?.trim() || file.type?.trim() || mimeType;\n audioBytes = await file.arrayBuffer();\n } catch (e) {\n const msg = e instanceof Error ? e.message : String(e);\n return {\n success: false,\n message: { text: `Could not read audio file (fileId: ${parsed.fileId}). ${msg}` },\n };\n }\n\n const language =\n parsed.language?.trim() ||\n resolveDelegatedAssistOptionString(assist, ctx.agentId, 'language') ||\n undefined;\n\n const { text } = await this.aiChatRouter.transcribeSpeech({\n modelEntityId,\n audioBytes,\n mimeType,\n fileName: parsed.fileId,\n ...(language ? { language } : {}),\n });\n\n return { success: true, data: { text } };\n } catch (e) {\n const msg = e instanceof Error ? e.message : String(e);\n return { success: false, message: { text: msg } };\n }\n }\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;AAAA;AA2BA,SAAS,oBAAo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AAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE;QAC1C;QAAE,OAAO,CAAC,EAAE;AACV,YAAA,MAAM,GAAG,GAAG,CAAC,YAAY,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC;AACtD,YAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;QACnD;IACF;8GApFW,uCAAuC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAAvC,uCAAuC,EAAA,CAAA,CAAA;;2FAAvC,uCAAuC,EAAA,UAAA,EAAA,CAAA;kBADnD;;;;;"}
|
package/fesm2022/acorex-connectivity-mock-notification-management-email-send.command-DAQfIWoD.mjs
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { AXPDataGenerator } from '@acorex/platform/core';
|
|
2
|
+
import { AXToastService } from '@acorex/components/toast';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { inject, Injectable } from '@angular/core';
|
|
5
|
+
|
|
6
|
+
//#region ---- Imports ----
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region ---- Input parsing ----
|
|
9
|
+
function parseSendInput(raw) {
|
|
10
|
+
const obj = raw != null && typeof raw === 'object' && !Array.isArray(raw) ? raw : null;
|
|
11
|
+
if (!obj) {
|
|
12
|
+
return { ok: false, error: 'Invalid arguments: expected an object.' };
|
|
13
|
+
}
|
|
14
|
+
const to = typeof obj['to'] === 'string' ? obj['to'].trim() : '';
|
|
15
|
+
const subject = typeof obj['subject'] === 'string' ? obj['subject'].trim() : '';
|
|
16
|
+
const body = typeof obj['body'] === 'string' ? obj['body'].trim() : '';
|
|
17
|
+
if (!to) {
|
|
18
|
+
return { ok: false, error: 'Invalid arguments: "to" is required.' };
|
|
19
|
+
}
|
|
20
|
+
if (!subject) {
|
|
21
|
+
return { ok: false, error: 'Invalid arguments: "subject" is required.' };
|
|
22
|
+
}
|
|
23
|
+
if (!body) {
|
|
24
|
+
return { ok: false, error: 'Invalid arguments: "body" is required.' };
|
|
25
|
+
}
|
|
26
|
+
const cc = typeof obj['cc'] === 'string' ? obj['cc'].trim() : '';
|
|
27
|
+
const bcc = typeof obj['bcc'] === 'string' ? obj['bcc'].trim() : '';
|
|
28
|
+
const tid = typeof obj['textTemplateId'] === 'string' ? obj['textTemplateId'].trim() : '';
|
|
29
|
+
return {
|
|
30
|
+
ok: true,
|
|
31
|
+
value: {
|
|
32
|
+
to,
|
|
33
|
+
subject,
|
|
34
|
+
body,
|
|
35
|
+
...(cc ? { cc } : {}),
|
|
36
|
+
...(bcc ? { bcc } : {}),
|
|
37
|
+
...(tid ? { textTemplateId: tid } : {}),
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region ---- Mock send command ----
|
|
43
|
+
const MOCK_SEND_LATENCY_MS = 120;
|
|
44
|
+
class NotificationManagementEmailSendMockCommand {
|
|
45
|
+
constructor() {
|
|
46
|
+
this.toastService = inject(AXToastService);
|
|
47
|
+
}
|
|
48
|
+
async execute(input) {
|
|
49
|
+
await new Promise((resolve) => setTimeout(resolve, MOCK_SEND_LATENCY_MS));
|
|
50
|
+
const parsed = parseSendInput(input);
|
|
51
|
+
if (!parsed.ok) {
|
|
52
|
+
return { success: false, message: { text: parsed.error } };
|
|
53
|
+
}
|
|
54
|
+
// Mock transport: surface as UI toast only; replace with HTTP when backend exists.
|
|
55
|
+
this.toastService.show({
|
|
56
|
+
color: 'warning',
|
|
57
|
+
title: 'Email send (simulation)',
|
|
58
|
+
content: `No email was delivered — mock only.\n To: ${parsed.value.to}.\n Subject: ${parsed.value.subject}.`,
|
|
59
|
+
});
|
|
60
|
+
return {
|
|
61
|
+
success: true,
|
|
62
|
+
data: { messageId: AXPDataGenerator.uuid() },
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: NotificationManagementEmailSendMockCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
66
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: NotificationManagementEmailSendMockCommand }); }
|
|
67
|
+
}
|
|
68
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: NotificationManagementEmailSendMockCommand, decorators: [{
|
|
69
|
+
type: Injectable
|
|
70
|
+
}] });
|
|
71
|
+
|
|
72
|
+
export { NotificationManagementEmailSendMockCommand };
|
|
73
|
+
//# sourceMappingURL=acorex-connectivity-mock-notification-management-email-send.command-DAQfIWoD.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-connectivity-mock-notification-management-email-send.command-DAQfIWoD.mjs","sources":["../../../../libs/connectivity/mock/src/lib/notification-management/commands/notification-management-email-send.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPDataGenerator } from '@acorex/platform/core';\nimport { AXPExecuteCommandResult } from '@acorex/platform/core';\nimport { AXPCommand } from '@acorex/platform/runtime';\nimport type {\n NotificationManagementEmailSendInput,\n NotificationManagementEmailSendResult,\n} from '@acorex/modules/notification-management';\nimport { AXToastService } from '@acorex/components/toast';\nimport { inject, Injectable } from '@angular/core';\n\n//#endregion\n\n//#region ---- Input parsing ----\n\nfunction parseSendInput(\n raw: unknown,\n): { ok: true; value: NotificationManagementEmailSendInput } | { ok: false; error: string } {\n const obj =\n raw != null && typeof raw === 'object' && !Array.isArray(raw) ? (raw as Record<string, unknown>) : null;\n if (!obj) {\n return { ok: false, error: 'Invalid arguments: expected an object.' };\n }\n const to = typeof obj['to'] === 'string' ? obj['to'].trim() : '';\n const subject = typeof obj['subject'] === 'string' ? obj['subject'].trim() : '';\n const body = typeof obj['body'] === 'string' ? obj['body'].trim() : '';\n if (!to) {\n return { ok: false, error: 'Invalid arguments: \"to\" is required.' };\n }\n if (!subject) {\n return { ok: false, error: 'Invalid arguments: \"subject\" is required.' };\n }\n if (!body) {\n return { ok: false, error: 'Invalid arguments: \"body\" is required.' };\n }\n const cc = typeof obj['cc'] === 'string' ? obj['cc'].trim() : '';\n const bcc = typeof obj['bcc'] === 'string' ? obj['bcc'].trim() : '';\n const tid = typeof obj['textTemplateId'] === 'string' ? obj['textTemplateId'].trim() : '';\n return {\n ok: true,\n value: {\n to,\n subject,\n body,\n ...(cc ? { cc } : {}),\n ...(bcc ? { bcc } : {}),\n ...(tid ? { textTemplateId: tid } : {}),\n },\n };\n}\n\n//#endregion\n\n//#region ---- Mock send command ----\n\nconst MOCK_SEND_LATENCY_MS = 120;\n\n@Injectable()\nexport class NotificationManagementEmailSendMockCommand\n implements AXPCommand<NotificationManagementEmailSendInput, NotificationManagementEmailSendResult> {\n private readonly toastService = inject(AXToastService);\n\n async execute(\n input: NotificationManagementEmailSendInput,\n ): Promise<AXPExecuteCommandResult<NotificationManagementEmailSendResult>> {\n await new Promise<void>((resolve) => setTimeout(resolve, MOCK_SEND_LATENCY_MS));\n const parsed = parseSendInput(input);\n if (!parsed.ok) {\n return { success: false, message: { text: parsed.error } };\n }\n // Mock transport: surface as UI toast only; replace with HTTP when backend exists.\n this.toastService.show({\n color: 'warning',\n title: 'Email send (simulation)',\n content: `No email was delivered — mock only.\\n To: ${parsed.value.to}.\\n Subject: ${parsed.value.subject}.`,\n });\n return {\n success: true,\n data: { messageId: AXPDataGenerator.uuid() },\n };\n }\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;AAAA;AAYA;AAEA;AAEA,SAAS,cAAc,CACrB,GAAY,EAAA;IAEZ,MAAM,GAAG,GACP,GAAG,IAAI,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CA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;8GAtBW,0CAA0C,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAA1C,0CAA0C,EAAA,CAAA,CAAA;;2FAA1C,0CAA0C,EAAA,UAAA,EAAA,CAAA;kBADtD;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Injectable } from '@angular/core';
|
|
3
|
-
import { m as mockUsers } from './acorex-connectivity-mock-acorex-connectivity-mock-
|
|
3
|
+
import { m as mockUsers } from './acorex-connectivity-mock-acorex-connectivity-mock-QxKVNQo9.mjs';
|
|
4
4
|
|
|
5
5
|
//#endregion
|
|
6
6
|
/**
|
|
@@ -8,7 +8,6 @@ import { m as mockUsers } from './acorex-connectivity-mock-acorex-connectivity-m
|
|
|
8
8
|
*/
|
|
9
9
|
class UserRolesForListColumnQuery {
|
|
10
10
|
async fetch(input) {
|
|
11
|
-
debugger;
|
|
12
11
|
const userId = input?.userId?.trim();
|
|
13
12
|
if (!userId) {
|
|
14
13
|
return { items: [] };
|
|
@@ -28,4 +27,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
28
27
|
}] });
|
|
29
28
|
|
|
30
29
|
export { UserRolesForListColumnQuery };
|
|
31
|
-
//# sourceMappingURL=acorex-connectivity-mock-user-roles-for-list-column.query-
|
|
30
|
+
//# sourceMappingURL=acorex-connectivity-mock-user-roles-for-list-column.query-DOAMknK8.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-connectivity-mock-user-roles-for-list-column.query-DOAMknK8.mjs","sources":["../../../../libs/connectivity/mock/src/lib/security-management/user/user-roles-for-list-column.query.ts"],"sourcesContent":["import { AXPQuery } from '@acorex/platform/runtime';\nimport { Injectable } from '@angular/core';\nimport { mockUsers } from './user.mock';\n\n//#region ---- Types ----\n\nexport interface UserRolesForListColumnQueryInput {\n userId?: string;\n}\n\nexport interface UserRolesForListColumnQueryResult {\n items: { id: string; title: unknown }[];\n}\n\n//#endregion\n\n/**\n * Resolves role rows for the user list lookup column when using {@link countOnly} column resolve.\n */\n@Injectable({ providedIn: 'root' })\nexport class UserRolesForListColumnQuery implements AXPQuery<UserRolesForListColumnQueryInput, UserRolesForListColumnQueryResult> {\n async fetch(input: UserRolesForListColumnQueryInput): Promise<UserRolesForListColumnQueryResult> {\n const userId = input?.userId?.trim();\n if (!userId) {\n return { items: [] };\n }\n const user = mockUsers.find((u) => u.id === userId);\n if (!user?.roles?.length) {\n return { items: [] };\n }\n return { items: user.roles };\n }\n}\n"],"names":[],"mappings":";;;;AAcA;AAEA;;AAEG;MAEU,2BAA2B,CAAA;IACtC,MAAM,KAAK,CAAC,KAAuC,EAAA;QACjD,MAAM,MAAM,GAAG,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE;QACpC,IAAI,CAAC,MAAM,EAAE;AACX,YAAA,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;QACtB;AACA,QAAA,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC;AACnD,QAAA,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE;AACxB,YAAA,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;QACtB;AACA,QAAA,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE;IAC9B;8GAXW,2BAA2B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA3B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,2BAA2B,cADd,MAAM,EAAA,CAAA,CAAA;;2FACnB,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBADvC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { d as ACTIVITY_CATEGORIES, e as ACTIVITY_CATEGORY_ID_BY_KEY, f as ACTIVITY_DEFINITIONS, g as AI_ASSIST_MOCK, h as AI_MODEL_MOCK, i as APPLICATIONS, j as AXCActivityCategorySeeder, k as AXCActivityDefinitionSeeder, l as AXCAiAssistSeeder, n as AXCAiManagementMockModule, o as AXCAiModelSeeder, p as AXCAppTermDataSeeder, q as AXCAppVersionDataSeeder, s as AXCApplicationDataSeeder, t as AXCApplicationManagementMockModule, u as AXCAssessmentManagementMockModule, v as AXCAssetManagementMockModule, w as AXCAuthMockModule, x as AXCCalendarDataSeeder, y as AXCCalendarEventDataSeeder, z as AXCCalendarManagementMockModule, B as AXCCommandRegistryDataSeeder, C as AXCCommonMockModule, D as AXCContactCoreMockModule, E as AXCContentManagementMockModule, F as AXCConversationDataSeeder, G as AXCConversationMockConversationApi, H as AXCConversationMockMessageApi, I as AXCConversationMockModule, J as AXCConversationMockRealtimeApi, K as AXCConversationMockUserApi, L as AXCCustomerManagementMockModule, M as AXCDashboardManagementMockModule, N as AXCDataManagementMockModule, O as AXCDexieEntityStorageService, P as AXCDocumentManagementMockModule, Q as AXCEditionDataSeeder, R as AXCEntityDefinitionSeederService, S as AXCEntityDefinitionsModule, T as AXCEntityStorageInsertCommand, U as AXCEntityStorageModule, V as AXCEntityStorageQueryQuery, W as AXCFileStorageServiceDexie, X as AXCFileStorageServiceFirestore, Y as AXCFinancialCoreMockModule, Z as AXCFirestoreEntityStorageService, _ as AXCFormTemplateManagementMockModule, $ as AXCGoogleStrategyMock, a0 as AXCHealthCoreMockModule, a1 as AXCHelpDeskMockModule, a2 as AXCHumanCapitalManagementMockModule, a3 as AXCIdentifierManagementMockModule, a4 as AXCImageCaptchaChallengeProviderMock, a5 as AXCLearningManagementMockModule, a6 as AXCLocaleManagementMockModule, a7 as AXCLocationManagementMockModule, a8 as AXCLockService, a9 as AXCMeasurementCoreMockModule, aa as AXCMeetingManagementMockModule, ab as AXCMetaDataDefinitionDataSeeder, ac as AXCMetadataCategorySeeder, ad as AXCMiddlewaresModule, ae as AXCMockCaptchaChallengeComponent, af as AXCMockEntityLogListener, ag as AXCMockModule, ah as AXCMockShowMetaDataFormPopupCommand, ai as AXCNotificationManagementMockModule, aj as AXCOrderManagementMockModule, ak as AXCOrganizationManagementMockModule, al as AXCPersonCoreMockModule, am as AXCPlatformManagementMockModule, an as AXCProcurementManagementMockModule, ao as AXCProductCatalogMockModule, ap as AXCProjectManagementMockModule, aq as AXCQueryRegistryDataSeeder, ar as AXCReportManagementMockModule, as as AXCSecurityManagementMockModule, at as AXCStoredEntityDefinitionLoader, au as AXCSubscriptionManagementMockModule, av as AXCSupplierManagementMockModule, aw as AXCTaskManagementMockModule, ax as AXCTenantManagementMockModule, ay as AXCTenantSeeder, az as AXCTokensDataSeeder, aA as AXCUserPassStrategyMock, aB as AXCVersionDB, aC as AXCVersioningService, aD as AXCWidgetCatalogDataSeeder, aE as AXCWorkflowCategorySeeder, aF as AXCWorkflowDefinitionDataSeeder, aG as AXCWorkflowEngine, aH as AXCWorkflowExecutionDB, aI as AXCWorkflowExecutionStoreDexie, aJ as AXCWorkflowExecutionStoreFirestore, aK as AXCWorkflowInstanceCartableDemoSeeder, aL as AXCWorkflowManagementMockModule, aM as AXC_ENTITY_STORAGE_BACKEND_TYPE, aN as AXC_FIRESTORE_CONFIG, aO as AXC_FIRESTORE_DB, aP as AXC_WORKFLOW_EXECUTION_STORE, aQ as AXMAiDemisDefaultAssistId, a as AXMAiModelStableIds, aR as AXMAiPlatformDefaultAssistId, aS as AXMAutomationDataSeeder, aT as AXMBusinessUnitDataSeeder, aU as AXMCalendarEventTypeSeeder, aV as AXMDashboardChartDataSourceDefinition, aW as AXMEmployeeDataSeeder, aX as AXMEmploymentTypeDataSeeder, aY as AXMFormDataSourcesProvider, aZ as AXMJobDefinitionDataSeeder, a_ as AXMJobLevelDataSeeder, a$ as AXMLeaveRequestDataSeeder, b0 as AXMMeetingDataSeeder, b1 as AXMMeetingFilesDataSeeder, b2 as AXMMeetingParticipantDataSeeder, b3 as AXMMeetingRoleTypeDataSeeder, b4 as AXMMeetingSessionDataSeeder, b5 as AXMMeetingTypeDataSeeder, b6 as AXMMeetingTypeFileTemplateDataSeeder, b7 as AXMPositionAssignmentDataSeeder, b8 as AXMPositionDataSeeder, b9 as AXMQuestionBankItemCategoryDataSeeder, ba as AXMQuestionBankItemDataSeeder, bb as AXMQuestionnaireCalculationDataSeeder, bc as AXMQuestionnaireCategoryDataSeeder, bd as AXMQuestionnaireDataSeeder, be as AXMResponsibilityDataSeeder, bf as AXMTagDataSeeder, bg as AXMTeamBusinessUnitDataSeeder, bh as AXMTeamDataSeeder, bi as AXMTeamMemberDataSeeder, bj as AXMTeamMemberRoleDataSeeder, bk as AXMWorkflowDashboardChartDataSourceDefinition, bl as AXM_AI_REGISTRY_COMMAND_NAME, bm as AXM_AI_REGISTRY_QUERY_NAME, bn as AXM_CORPORATE_BUSINESS_UNIT_ID, bo as AXPDashboardDataSeeder, bp as AXPIdentifierDB, bq as AXPMessageDataSeeder, br as AXPMockChecksumProvider, bs as AXPMockClockProvider, bt as AXPMockIdentifierService, bu as AXPMockLookupProvider, bv as AXPMockPolicyProvider, bw as AXPMockSequenceProvider, bx as AXPRoomDataSeeder, by as AXPSecurityManagementRoleDataSeeder, bz as AXPSecurityManagementUserDataSeeder, bA as AXPTaskBoardPlatformManagementTaskProvider, bB as AXPTaskBoardProjectManagementTaskProvider, bC as AXVChangeType, bD as BCC, bE as BOC, bF as BUSINESS_UNITS_MOCK, bG as CHAT_LAST_MESSAGE_IDS, bH as COSTMANAGER_ENTERPRISE, bI as COSTMANAGER_PROFESSIONAL, bJ as COSTMANAGER_STANDARD, bK as CP, bL as CRM_ENTERPRISE, bM as DASHBOARDS, bN as EDITIONS, bO as EMPLOYEES_MOCK, bP as EMPLOYMENT_TYPES_MOCK, bQ as ENTITY_DEFINITION_MAP, bR as ENTITY_REGISTRY, bS as FINANCE_BASIC, bT as FINANCE_ENTERPRISE, bU as FINANCE_PRO, bV as G, bW as HR_ENTERPRISE, bX as HW, bY as JOB_DEFINITIONS_CATEGORY_MOCK, bZ as JOB_DEFINITIONS_MOCK, b_ as JOB_DEFINITION_CATEGORY_KEY_TO_ID, b$ as JOB_LEVELS_MOCK, c0 as LASER_PLUMBING_TENANT_ID, c1 as LEAVE_REQUESTS_MOCK, c2 as METADATA_CATEGORY_IDS, c3 as METADATA_GENERAL_CATEGORY_REFS, c4 as METADATA_SYSTEM_CATEGORY_REFS, c5 as MLC, c6 as OHR, c7 as ORDERING_BASIC, c8 as ORDERING_ENTERPRISE, c9 as ORDERING_STANDARD, ca as OWNERSHIP_FILTER_BYPASS, cb as PLATFORM_CONSOLE, cc as PLATFORM_TENANT_ID, cd as PM, ce as POSITIONS_CATEGORY_MOCK, cf as POSITIONS_MOCK, cg as POSITION_ASSIGNMENTS_MOCK, ch as QCP, ci as QGEN, cj as QHW, ck as QOHR, cl as QPM, cm as QTLE, cn as QUESTIONNAIRE_CATEGORY_MOCK, co as QUESTION_BANK_ITEM_CATEGORY_MOCK, cp as QWS, cq as RESPONSIBILITIES_CATEGORY_MOCK, cr as RESPONSIBILITIES_MOCK, cs as RESPONSIBILITY_CATEGORY_KEY_TO_ID, ct as SAFETYMINDER_BASIC, cu as SAFETYMINDER_ENTERPRISE, cv as SAFETYMINDER_PROFESSIONAL, cw as SHOP_BASIC, cx as SHOP_ENTERPRISE, cy as SHOP_PRO, cz as TAGS_MOCK, cA as TASKS, cB as TASK_STATUSES, cC as TASK_TEMPLATES, cD as TASK_TYPES, cE as TEAMS_MOCK, cF as TEAM_BUSINESS_UNITS_MOCK, cG as TEAM_MEMBERS_MOCK, cH as TEAM_MEMBER_ROLES_MOCK, cI as TIMEPLICITY_TENANT_ID, cJ as TLA, cK as TOKENS, cL as TPC, cM as VISIBILITY_FILTER_BYPASS, cN as WORKFLOW_CATEGORIES, cO as WS, cP as activityCategoryMocks, cQ as activityDefinitionEntityMock, cR as applyEntityDefinitionFirestoreSnapshot, cS as automationCommandMiddleware, cT as automationMock, cU as avatarInterface, cV as axVersionDB, cW as axWorkflowExecutionDB, cX as axcPatchEmployeeActivePrimaryBusinessUnitRefsFromRows, cY as axcPatchEmployeeActivePrimaryPositionRefsFromRows, cZ as axcPatchEmployeeManagerRefsFromRows, c_ as axcResolveCommandRegistrySeedId, c$ as axcResolveQueryRegistrySeedId, d0 as axcResolveWidgetCatalogSeedId, d1 as bankCategory, d2 as buildEntityStorageQuickSearchFilter, d3 as buildWorkflowInstanceCartableDemoRows, d4 as bypassAllFilters, d5 as bypassOwnershipFilter, d6 as bypassVisibilityFilter, d7 as calendarEventMock, d8 as calendarEventTypeMockData, d9 as calendarMock, da as chatMessageMock, db as chatMock, dc as checkboxInterface, dd as childCountMiddleware, de as clearEntityDefinitionFirestoreCollections, df as collectQuickSearchFieldPathsFromEntityDefinition, dg as colorInterface, dh as computeDiff, di as contactInterface, dj as conversationDemoSeedUserIds, dk as createFileCastMiddleware, dl as createWidgetLayoutConfig, dm as dateInterface, dn as dateTimeInterface, dp as descriptionInterface, dq as documentFolderSyncMiddleware, dr as emailInterface, ds as entityDefDb, dt as entityValidationMiddleware, du as fileUploaderInterface, dv as finalizeActivityCategoryItemCounts, dw as findEmployeeById, dx as folderStorageMiddleware, dy as groupOrderItemCalculatorMiddleware, dz as historyMiddleware, dA as identifierCommitMiddleware, dB as imageInterface, dC as inspectionOkXNaInterface, dD as loadMockPropertyDefinitions, dE as lockGuardMiddleware, dF as longTextAnswerInterface, dG as lookupInterface, dH as lookupResolverMiddleware, dI as mapInterface, dJ as meetingFilesMock, dK as meetingIds, dL as meetingMock, dM as meetingParticipantMock, dN as meetingRoleTypeMock, dO as meetingSessionMock, dP as meetingTimeSlotMock, dQ as meetingTypeFileTemplateMock, dR as meetingTypeMock, dS as mergeDetailRelationMiddleware, dT as mergeQuickSearchIntoRequest, dU as metadataCategoryMocks, dV as mockParticipantIndexForSecurityUserId, dW as mockQuestionBankItemByName, dX as mockRoleDefinitions, m as mockUsers, dY as multipleChoiceInterface, dZ as multipleSelectInterface, d_ as normalizeAnyFileArrayForView, d$ as normalizeSnapshotFileFieldsForView, e0 as numberInterface, e1 as parseEntityStorageInsertData, e2 as parseEntityStorageQueryRequest, e3 as participantIds, e4 as participantMock, e5 as passwordInterface, e6 as personIdentifierTypeMock, e7 as personIds, e8 as personLegalIds, e9 as personMock, ea as personNaturalIds, eb as phoneInterface, ec as primaryMiddleware, ed as provideMockPropertySetups, ee as qrcodeInterface, ef as questionBankItemMock, eg as questionnaireCalculationMock, eh as questionnaireMock, ei as ratingInterface, ej as richTextInterface, ek as scaleInterface, el as selectInterface, em as selectionListInterface, en as sexAtBirthInterface, eo as signatureInterface, ep as signatureLoaderMiddleware, eq as statusDefaultMiddleware, er as tagInterface, es as tenantMocks, et as textAreaInterface, eu as textInterface, ev as timeDurationInterface, ew as titleInterface, ex as toUiRows, ey as toggleInterface, ez as tokenCategoryIds, eA as tokenCategoryMocks, eB as urlInterface, eC as versionInterface, eD as visibilityFilterMiddleware, eE as workflowDefinitionEntityMock, eF as workflowDefinitionIds, eG as workflowDefinitionMock, eH as yesNoInterface } from './acorex-connectivity-mock-acorex-connectivity-mock-BTiDjsTG.mjs';
|
|
1
|
+
export { d as ACTIVITY_CATEGORIES, e as ACTIVITY_CATEGORY_ID_BY_KEY, f as ACTIVITY_DEFINITIONS, g as AI_ASSIST_MOCK, h as AI_MODEL_MOCK, i as APPLICATIONS, j as APPLICATION_CATEGORY_IDS, k as APPLICATION_CATEGORY_MOCKS, l as AXCActivityCategorySeeder, n as AXCActivityDefinitionSeeder, o as AXCAiAssistSeeder, p as AXCAiManagementMockModule, q as AXCAiModelSeeder, s as AXCAppTermDataSeeder, t as AXCAppVersionDataSeeder, u as AXCApplicationCategoryDataSeeder, v as AXCApplicationDataSeeder, w as AXCApplicationManagementMockModule, x as AXCAssessmentManagementMockModule, y as AXCAssetManagementMockModule, z as AXCAuthMockModule, B as AXCCalendarDataSeeder, C as AXCCalendarEventDataSeeder, D as AXCCalendarManagementMockModule, E as AXCCommandRegistryDataSeeder, F as AXCCommonMockModule, G as AXCContactCoreMockModule, H as AXCContentManagementMockModule, I as AXCConversationDataSeeder, J as AXCConversationMockConversationApi, K as AXCConversationMockMessageApi, L as AXCConversationMockModule, M as AXCConversationMockRealtimeApi, N as AXCConversationMockUserApi, O as AXCCustomerManagementMockModule, P as AXCDashboardManagementMockModule, Q as AXCDataManagementMockModule, R as AXCDexieEntityStorageService, S as AXCDocumentManagementMockModule, T as AXCEditionDataSeeder, U as AXCEntityDefinitionSeederService, V as AXCEntityDefinitionsModule, W as AXCEntityStorageInsertCommand, X as AXCEntityStorageModule, Y as AXCEntityStorageQueryQuery, Z as AXCFileStorageServiceDexie, _ as AXCFileStorageServiceFirestore, $ as AXCFinancialCoreMockModule, a0 as AXCFirestoreEntityStorageService, a1 as AXCFormTemplateManagementMockModule, a2 as AXCGoogleStrategyMock, a3 as AXCHealthCoreMockModule, a4 as AXCHelpDeskMockModule, a5 as AXCHumanCapitalManagementMockModule, a6 as AXCIdentifierManagementMockModule, a7 as AXCImageCaptchaChallengeProviderMock, a8 as AXCLearningManagementMockModule, a9 as AXCLocaleManagementMockModule, aa as AXCLocationManagementMockModule, ab as AXCLockService, ac as AXCMeasurementCoreMockModule, ad as AXCMeetingManagementMockModule, ae as AXCMetaDataDefinitionDataSeeder, af as AXCMetadataCategorySeeder, ag as AXCMiddlewaresModule, ah as AXCMockCaptchaChallengeComponent, ai as AXCMockEntityLogListener, aj as AXCMockModule, ak as AXCMockShowMetaDataFormPopupCommand, al as AXCNotificationManagementMockModule, am as AXCOrderManagementMockModule, an as AXCOrganizationManagementMockModule, ao as AXCPersonCoreMockModule, ap as AXCPlatformManagementMockModule, aq as AXCProcurementManagementMockModule, ar as AXCProductCatalogMockModule, as as AXCProjectManagementMockModule, at as AXCQueryRegistryDataSeeder, au as AXCReportManagementMockModule, av as AXCSecurityManagementMockModule, aw as AXCStoredEntityDefinitionLoader, ax as AXCSubscriptionManagementMockModule, ay as AXCSupplierManagementMockModule, az as AXCTaskManagementMockModule, aA as AXCTenantManagementMockModule, aB as AXCTenantSeeder, aC as AXCTextTemplateRenderBackend, aD as AXCTokensDataSeeder, aE as AXCUserPassStrategyMock, aF as AXCVersionDB, aG as AXCVersioningService, aH as AXCWidgetCatalogDataSeeder, aI as AXCWorkflowCategorySeeder, aJ as AXCWorkflowDefinitionDataSeeder, aK as AXCWorkflowEngine, aL as AXCWorkflowExecutionDB, aM as AXCWorkflowExecutionStoreDexie, aN as AXCWorkflowExecutionStoreFirestore, aO as AXCWorkflowInstanceCartableDemoSeeder, aP as AXCWorkflowManagementMockModule, aQ as AXC_ENTITY_STORAGE_BACKEND_TYPE, aR as AXC_FIRESTORE_CONFIG, aS as AXC_FIRESTORE_DB, aT as AXC_WORKFLOW_EXECUTION_STORE, aU as AXMAiDemisAssistantAssistId, a as AXMAiModelStableIds, aV as AXMAiPlatformAssistantAssistId, aW as AXMAutomationDataSeeder, aX as AXMBusinessUnitDataSeeder, aY as AXMCalendarEventTypeSeeder, aZ as AXMDashboardChartDataSourceDefinition, a_ as AXMEmployeeDataSeeder, a$ as AXMEmploymentTypeDataSeeder, b0 as AXMFormDataSourcesProvider, b1 as AXMJobDefinitionDataSeeder, b2 as AXMJobLevelDataSeeder, b3 as AXMLeaveRequestDataSeeder, b4 as AXMMeetingDataSeeder, b5 as AXMMeetingFilesDataSeeder, b6 as AXMMeetingParticipantDataSeeder, b7 as AXMMeetingRoleTypeDataSeeder, b8 as AXMMeetingSessionDataSeeder, b9 as AXMMeetingTypeDataSeeder, ba as AXMMeetingTypeFileTemplateDataSeeder, bb as AXMPositionAssignmentDataSeeder, bc as AXMPositionDataSeeder, bd as AXMQuestionBankItemCategoryDataSeeder, be as AXMQuestionBankItemDataSeeder, bf as AXMQuestionnaireCalculationDataSeeder, bg as AXMQuestionnaireCategoryDataSeeder, bh as AXMQuestionnaireDataSeeder, bi as AXMResponsibilityDataSeeder, bj as AXMTagDataSeeder, bk as AXMTeamBusinessUnitDataSeeder, bl as AXMTeamDataSeeder, bm as AXMTeamMemberDataSeeder, bn as AXMTeamMemberRoleDataSeeder, bo as AXMWorkflowDashboardChartDataSourceDefinition, bp as AXM_AI_REGISTRY_COMMAND_NAME, bq as AXM_AI_REGISTRY_QUERY_NAME, br as AXM_CORPORATE_BUSINESS_UNIT_ID, bs as AXPDashboardDataSeeder, bt as AXPIdentifierDB, bu as AXPMessageDataSeeder, bv as AXPMockChecksumProvider, bw as AXPMockClockProvider, bx as AXPMockIdentifierService, by as AXPMockLookupProvider, bz as AXPMockPolicyProvider, bA as AXPMockSequenceProvider, bB as AXPRoomDataSeeder, bC as AXPSecurityManagementRoleDataSeeder, bD as AXPSecurityManagementUserDataSeeder, bE as AXPTaskBoardPlatformManagementTaskProvider, bF as AXPTaskBoardProjectManagementTaskProvider, bG as AXVChangeType, bH as BCC, bI as BOC, bJ as BUSINESS_UNITS_MOCK, bK as CHAT_LAST_MESSAGE_IDS, bL as COSTMANAGER_ENTERPRISE, bM as COSTMANAGER_PROFESSIONAL, bN as COSTMANAGER_STANDARD, bO as CP, bP as CRM_ENTERPRISE, bQ as DASHBOARDS, bR as EDITIONS, bS as EMPLOYEES_MOCK, bT as EMPLOYMENT_TYPES_MOCK, bU as ENTITY_DEFINITION_MAP, bV as ENTITY_REGISTRY, bW as FINANCE_BASIC, bX as FINANCE_ENTERPRISE, bY as FINANCE_PRO, bZ as G, b_ as HR_ENTERPRISE, b$ as HW, c0 as JOB_DEFINITIONS_CATEGORY_MOCK, c1 as JOB_DEFINITIONS_MOCK, c2 as JOB_DEFINITION_CATEGORY_KEY_TO_ID, c3 as JOB_LEVELS_MOCK, c4 as LASER_PLUMBING_TENANT_ID, c5 as LEAVE_REQUESTS_MOCK, c6 as METADATA_CATEGORY_IDS, c7 as METADATA_GENERAL_CATEGORY_REFS, c8 as METADATA_SYSTEM_CATEGORY_REFS, c9 as MLC, ca as OHR, cb as ORDERING_BASIC, cc as ORDERING_ENTERPRISE, cd as ORDERING_STANDARD, ce as OWNERSHIP_FILTER_BYPASS, cf as PLATFORM_CONSOLE, cg as PLATFORM_TENANT_ID, ch as PM, ci as POSITIONS_CATEGORY_MOCK, cj as POSITIONS_MOCK, ck as POSITION_ASSIGNMENTS_MOCK, cl as QCP, cm as QGEN, cn as QHW, co as QOHR, cp as QPM, cq as QTLE, cr as QUESTIONNAIRE_CATEGORY_MOCK, cs as QUESTION_BANK_ITEM_CATEGORY_MOCK, ct as QWS, cu as RESPONSIBILITIES_CATEGORY_MOCK, cv as RESPONSIBILITIES_MOCK, cw as RESPONSIBILITY_CATEGORY_KEY_TO_ID, cx as SAFETYMINDER_BASIC, cy as SAFETYMINDER_ENTERPRISE, cz as SAFETYMINDER_PROFESSIONAL, cA as SHOP_BASIC, cB as SHOP_ENTERPRISE, cC as SHOP_PRO, cD as TAGS_MOCK, cE as TASKS, cF as TASK_STATUSES, cG as TASK_TEMPLATES, cH as TASK_TYPES, cI as TEAMS_CATEGORY_MOCK, cJ as TEAMS_MOCK, cK as TEAM_BUSINESS_UNITS_MOCK, cL as TEAM_CATEGORY_KEY_TO_ID, cM as TEAM_MEMBERS_MOCK, cN as TEAM_MEMBER_ROLES_MOCK, cO as TIMEPLICITY_TENANT_ID, cP as TLA, cQ as TOKENS, cR as TPC, cS as VISIBILITY_FILTER_BYPASS, cT as WORKFLOW_CATEGORIES, cU as WS, cV as activityCategoryMocks, cW as activityDefinitionEntityMock, cX as applyEntityDefinitionFirestoreSnapshot, cY as automationCommandMiddleware, cZ as automationMock, c_ as avatarInterface, c$ as awaitConversationMockSharedStorage, d0 as axVersionDB, d1 as axWorkflowExecutionDB, d2 as axcPatchEmployeeActivePrimaryBusinessUnitRefsFromRows, d3 as axcPatchEmployeeActivePrimaryPositionRefsFromRows, d4 as axcPatchEmployeeManagerRefsFromRows, d5 as axcResolveCommandRegistrySeedId, d6 as axcResolveQueryRegistrySeedId, d7 as axcResolveWidgetCatalogSeedId, d8 as bankCategory, d9 as buildEntityStorageQuickSearchFilter, da as buildWorkflowInstanceCartableDemoRows, db as bypassAllFilters, dc as bypassOwnershipFilter, dd as bypassVisibilityFilter, de as calendarEventMock, df as calendarEventTypeMockData, dg as calendarMock, dh as chatMessageMock, di as chatMock, dj as checkboxInterface, dk as childCountMiddleware, dl as clearEntityDefinitionFirestoreCollections, dm as colorInterface, dn as computeDiff, dp as contactInterface, dq as conversationDemoSeedUserIds, dr as createFileCastMiddleware, ds as createWidgetLayoutConfig, dt as dateInterface, du as dateTimeInterface, dv as descriptionInterface, dw as documentFolderSyncMiddleware, dx as emailInterface, dy as entityDefDb, dz as entityValidationMiddleware, dA as fileUploaderInterface, dB as finalizeActivityCategoryItemCounts, dC as findEmployeeById, dD as folderStorageMiddleware, dE as groupOrderItemCalculatorMiddleware, dF as historyMiddleware, dG as identifierCommitMiddleware, dH as imageInterface, dI as inspectionOkXNaInterface, dJ as loadMockPropertyDefinitions, dK as lockGuardMiddleware, dL as longTextAnswerInterface, dM as lookupInterface, dN as lookupResolverMiddleware, dO as mapInterface, dP as meetingFilesMock, dQ as meetingIds, dR as meetingMock, dS as meetingParticipantMock, dT as meetingRoleTypeMock, dU as meetingSessionMock, dV as meetingTimeSlotMock, dW as meetingTypeFileTemplateMock, dX as meetingTypeMock, dY as mergeDetailRelationMiddleware, dZ as mergeQuickSearchIntoRequest, d_ as metadataCategoryMocks, d$ as mockParticipantIndexForSecurityUserId, e0 as mockQuestionBankItemByName, e1 as mockRoleDefinitions, m as mockUsers, e2 as multipleChoiceInterface, e3 as multipleSelectInterface, e4 as normalizeAnyFileArrayForView, e5 as normalizeSnapshotFileFieldsForView, e6 as numberInterface, e7 as parseEntityStorageInsertData, e8 as parseEntityStorageQueryRequest, e9 as participantIds, ea as participantMock, eb as passwordInterface, ec as personIdentifierTypeMock, ed as personIds, ee as personLegalIds, ef as personMock, eg as personNaturalIds, eh as phoneInterface, ei as primaryMiddleware, ej as provideMockPropertySetups, ek as qrcodeInterface, el as questionBankItemMock, em as questionnaireCalculationMock, en as questionnaireMock, eo as ratingInterface, ep as richTextInterface, eq as scaleInterface, er as selectInterface, es as selectionListInterface, et as sexAtBirthInterface, eu as signatureInterface, ev as signatureLoaderMiddleware, ew as statusDefaultMiddleware, ex as tagInterface, ey as tenantMocks, ez as textAreaInterface, eA as textInterface, eB as timeDurationInterface, eC as titleInterface, eD as toUiRows, eE as toggleInterface, eF as tokenCategoryIds, eG as tokenCategoryMocks, eH as urlInterface, eI as versionInterface, eJ as visibilityFilterMiddleware, eK as workflowDefinitionEntityMock, eL as workflowDefinitionIds, eM as workflowDefinitionMock, eN as yesNoInterface } from './acorex-connectivity-mock-acorex-connectivity-mock-QxKVNQo9.mjs';
|
|
2
|
+
export { AXC_TEXT_TEMPLATE_RENDER_COMMAND_KEY } from '@acorex/modules/content-management';
|
|
2
3
|
//# sourceMappingURL=acorex-connectivity-mock.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-connectivity-mock.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"acorex-connectivity-mock.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acorex/connectivity",
|
|
3
|
-
"version": "21.0.0-next.
|
|
3
|
+
"version": "21.0.0-next.44",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@acorex/modules": "21.0.0-next.
|
|
5
|
+
"@acorex/modules": "21.0.0-next.44"
|
|
6
6
|
},
|
|
7
7
|
"sideEffects": false,
|
|
8
8
|
"module": "fesm2022/acorex-connectivity.mjs",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AXPQueryRequest, AXPPagedListResult } from '@acorex/platform/core';
|
|
2
|
-
import { AXPEntityStorageService } from '@acorex/platform/layout/entity';
|
|
2
|
+
import { AXPEntityStorageService, AXPEntityQueryAllOptions, AXPEntityQueryAllResult, AXPEntityAggregateRequest, AXPEntityAggregateOptions, AXPEntityAggregateResult } from '@acorex/platform/layout/entity';
|
|
3
3
|
import { HttpClient } from '@angular/common/http';
|
|
4
4
|
import * as i0 from '@angular/core';
|
|
5
5
|
import * as i1$1 from 'angular-oauth2-oidc';
|
|
@@ -18,6 +18,9 @@ declare class AXCApiEntityStorageService implements AXPEntityStorageService<stri
|
|
|
18
18
|
private mainUrl;
|
|
19
19
|
private readonly API_VERSION;
|
|
20
20
|
private readonly DEFAULT_AREA;
|
|
21
|
+
private readonly defaultQueryAllPageSize;
|
|
22
|
+
private readonly defaultQueryAllMaxRows;
|
|
23
|
+
private readonly defaultAggregateMaxRows;
|
|
21
24
|
constructor(http: HttpClient);
|
|
22
25
|
get dbName(): string;
|
|
23
26
|
getConfigEntity(entityName: string): {
|
|
@@ -35,6 +38,14 @@ declare class AXCApiEntityStorageService implements AXPEntityStorageService<stri
|
|
|
35
38
|
insertOne<T = any>(entityName: string, entityItem: T): Promise<string>;
|
|
36
39
|
getAll<T = any>(entityName: string): Promise<T[]>;
|
|
37
40
|
query<T = any>(entityName: string, request: AXPQueryRequest): Promise<AXPPagedListResult<T>>;
|
|
41
|
+
count(entityName: string, request: Pick<AXPQueryRequest, 'filter' | 'sort'>): Promise<number>;
|
|
42
|
+
queryAll(entityName: string, request: Pick<AXPQueryRequest, 'filter' | 'sort'>, options?: AXPEntityQueryAllOptions): Promise<AXPEntityQueryAllResult<any>>;
|
|
43
|
+
getMany(entityName: string, ids: string[]): Promise<(any | null)[]>;
|
|
44
|
+
exists(entityName: string, id: string): Promise<boolean>;
|
|
45
|
+
upsertOne(entityName: string, entity: any, options?: {
|
|
46
|
+
merge?: boolean;
|
|
47
|
+
}): Promise<string>;
|
|
48
|
+
aggregate(entityName: string, request: AXPEntityAggregateRequest, options?: AXPEntityAggregateOptions): Promise<AXPEntityAggregateResult>;
|
|
38
49
|
static ɵfac: i0.ɵɵFactoryDeclaration<AXCApiEntityStorageService, never>;
|
|
39
50
|
static ɵprov: i0.ɵɵInjectableDeclaration<AXCApiEntityStorageService>;
|
|
40
51
|
}
|