@burdenoff/microfe-buildmyiq 2026.1107.2 → 2026.1107.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/buildmyiq/hooks/useBuiMigration.d.ts +3 -3
- package/dist/buildmyiq/hooks/useBuiMigration.d.ts.map +1 -1
- package/dist/buildmyiq/hooks/useBuiMigration.js.map +1 -1
- package/dist/buildmyiq/hooks/useHrisDirectorySync.d.ts +21 -0
- package/dist/buildmyiq/hooks/useHrisDirectorySync.d.ts.map +1 -0
- package/dist/buildmyiq/hooks/useHrisDirectorySync.js +141 -0
- package/dist/buildmyiq/hooks/useHrisDirectorySync.js.map +1 -0
- package/dist/buildmyiq/pages/migration/MigrationCenterPage.d.ts.map +1 -1
- package/dist/buildmyiq/pages/migration/MigrationCenterPage.js +37 -37
- package/dist/buildmyiq/pages/migration/MigrationCenterPage.js.map +1 -1
- package/dist/buildmyiq/pages/provisioning/HrisConnectorsCard.d.ts +3 -0
- package/dist/buildmyiq/pages/provisioning/HrisConnectorsCard.d.ts.map +1 -0
- package/dist/buildmyiq/pages/provisioning/HrisConnectorsCard.js +428 -0
- package/dist/buildmyiq/pages/provisioning/HrisConnectorsCard.js.map +1 -0
- package/dist/buildmyiq/pages/provisioning/ProvisioningPage.d.ts.map +1 -1
- package/dist/buildmyiq/pages/provisioning/ProvisioningPage.js +110 -108
- package/dist/buildmyiq/pages/provisioning/ProvisioningPage.js.map +1 -1
- package/dist/buildmyiq/pages/provisioning/hrisModel.d.ts +100 -0
- package/dist/buildmyiq/pages/provisioning/hrisModel.d.ts.map +1 -0
- package/dist/buildmyiq/pages/provisioning/hrisModel.js +193 -0
- package/dist/buildmyiq/pages/provisioning/hrisModel.js.map +1 -0
- package/dist/buildmyiq/pages/provisioning/provisioningModel.d.ts.map +1 -1
- package/dist/buildmyiq/pages/provisioning/provisioningModel.js +4 -0
- package/dist/buildmyiq/pages/provisioning/provisioningModel.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* @module buildmyiq/hooks/useBuiMigration
|
|
4
4
|
*
|
|
5
5
|
* Transport for the Migration Center:
|
|
6
|
-
* - `buiPreviewCourseImport(fileId)` — what
|
|
7
|
-
* would create, with every skipped or converted item. Writes nothing.
|
|
6
|
+
* - `buiPreviewCourseImport(fileId)` — what importing a Common Cartridge or Moodle
|
|
7
|
+
* backup would create, with every skipped or converted item. Writes nothing.
|
|
8
8
|
* - `buiImportCourse(input)` — imports the package as a new DRAFT course.
|
|
9
9
|
* - `buiExportCourse(courseId, format)` / `buiExportCourseGradebook(courseId)`
|
|
10
10
|
* — open-standards exports, returned inline as base64.
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export type BuiMigrationIssueSeverity = 'INFO' | 'WARNING' | 'ERROR';
|
|
17
17
|
export type BuiMigrationJobKind = 'COURSE_IMPORT' | 'COURSE_EXPORT' | 'GRADEBOOK_EXPORT';
|
|
18
|
-
export type BuiMigrationFormat = 'COMMON_CARTRIDGE' | 'BUILDMYIQ_JSON' | 'GRADEBOOK_CSV';
|
|
18
|
+
export type BuiMigrationFormat = 'COMMON_CARTRIDGE' | 'MOODLE_BACKUP' | 'BUILDMYIQ_JSON' | 'GRADEBOOK_CSV';
|
|
19
19
|
export type BuiCourseExportFormat = 'COMMON_CARTRIDGE' | 'BUILDMYIQ_JSON';
|
|
20
20
|
export interface BuiMigrationIssue {
|
|
21
21
|
severity: BuiMigrationIssueSeverity;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBuiMigration.d.ts","sourceRoot":"","sources":["../../../src/buildmyiq/hooks/useBuiMigration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH,MAAM,MAAM,yBAAyB,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AACrE,MAAM,MAAM,mBAAmB,GAAG,eAAe,GAAG,eAAe,GAAG,kBAAkB,CAA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AAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,iDAAiD;AACjD,eAAO,MAAM,kBAAkB;SAOhB,eAAe;YACZ;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE;wCAmB5D,CAAC;AAEF,8DAA8D;AAC9D,eAAO,MAAM,kBAAkB;cAIU,MAAM;YAAU,qBAAqB;WAY7E,CAAC;AAEF,2CAA2C;AAC3C,eAAO,MAAM,qBAAqB,qGAgBjC,CAAC;AAEF,2CAA2C;AAC3C,eAAO,MAAM,YAAY,GACvB,UAAU,IAAI,CAAC,kBAAkB,EAAE,eAAe,GAAG,UAAU,CAAC,KAC/D,IAKF,CAAC;AAEF,kDAAkD;AAClD,eAAO,MAAM,UAAU,GACrB,UAAU,IAAI,CAAC,kBAAkB,EAAE,eAAe,GAAG,UAAU,GAAG,UAAU,CAAC,KAC5E,IAcF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBuiMigration.js","names":[],"sources":["../../../src/buildmyiq/hooks/useBuiMigration.ts"],"sourcesContent":["/**\n * Buildmyiq — course migration hooks (BOFF-4437).\n * @module buildmyiq/hooks/useBuiMigration\n *\n * Transport for the Migration Center:\n * - `buiPreviewCourseImport(fileId)` — what an IMS Common Cartridge import\n * would create, with every skipped or converted item. Writes nothing.\n * - `buiImportCourse(input)` — imports the package as a new DRAFT course.\n * - `buiExportCourse(courseId, format)` / `buiExportCourseGradebook(courseId)`\n * — open-standards exports, returned inline as base64.\n * - `buiMigrationJobs` — the migration audit trail.\n *\n * Packages are uploaded PRIVATE through the platform file flow\n * (`useBuiFileUpload`), so only the uploader can import them.\n */\n\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\n\nimport { useBuiRequestScope } from './requestScope';\nimport { wspaceFetch } from './useBuiFiles';\n\nexport type BuiMigrationIssueSeverity = 'INFO' | 'WARNING' | 'ERROR';\nexport type BuiMigrationJobKind = 'COURSE_IMPORT' | 'COURSE_EXPORT' | 'GRADEBOOK_EXPORT';\nexport type BuiMigrationFormat = 'COMMON_CARTRIDGE' | 'BUILDMYIQ_JSON' | 'GRADEBOOK_CSV';\nexport type BuiCourseExportFormat = 'COMMON_CARTRIDGE' | 'BUILDMYIQ_JSON';\n\nexport interface BuiMigrationIssue {\n severity: BuiMigrationIssueSeverity;\n code: string;\n message: string;\n ref: string | null;\n}\n\nexport interface BuiMigrationStats {\n moduleCount: number;\n lessonCount: number;\n assessmentCount: number;\n questionCount: number;\n skippedCount: number;\n rowCount: number;\n byteSize: number;\n}\n\nexport interface BuiMigrationJob {\n id: string;\n kind: BuiMigrationJobKind;\n status: 'COMPLETED' | 'FAILED';\n format: BuiMigrationFormat;\n sourceSystem: string | null;\n fileId: string | null;\n fileName: string | null;\n courseId: string | null;\n courseTitle: string | null;\n stats: BuiMigrationStats;\n issues: BuiMigrationIssue[];\n createdAt: string;\n createdBy: string;\n}\n\nexport interface BuiCourseImportPreview {\n fileName: string;\n format: BuiMigrationFormat;\n sourceSystem: string | null;\n standardVersion: string | null;\n title: string;\n description: string | null;\n stats: BuiMigrationStats;\n modules: Array<{ title: string; items: Array<{ title: string; kind: string; detail: string }> }>;\n issues: BuiMigrationIssue[];\n canImport: boolean;\n}\n\nexport interface BuiMigrationExport {\n job: BuiMigrationJob;\n fileName: string;\n mimeType: string;\n contentBase64: string;\n byteSize: number;\n}\n\nconst STATS_FIELDS = `stats { moduleCount lessonCount assessmentCount questionCount skippedCount rowCount byteSize }`;\nconst ISSUE_FIELDS = `issues { severity code message ref }`;\nconst JOB_FIELDS = `\n id kind status format sourceSystem fileId fileName courseId courseTitle createdAt createdBy\n ${STATS_FIELDS}\n ${ISSUE_FIELDS}\n`;\nconst EXPORT_FIELDS = `fileName mimeType contentBase64 byteSize job { ${JOB_FIELDS} }`;\n\nexport const migrationKeys = {\n jobs: (offset: number) => ['buildmyiq', 'migrationJobs', offset] as const,\n allJobs: ['buildmyiq', 'migrationJobs'] as const,\n};\n\nexport const MIGRATION_JOBS_PAGE_SIZE = 20;\n\n/** The migration audit trail, newest first, one page at a time. */\nexport const useBuiMigrationJobs = (offset = 0) => {\n const apiGatewayUrl = useBuiRequestScope();\n return useQuery({\n queryKey: migrationKeys.jobs(offset),\n queryFn: async () => {\n const pagination =\n offset > 0\n ? { limit: MIGRATION_JOBS_PAGE_SIZE, offset }\n : { limit: MIGRATION_JOBS_PAGE_SIZE };\n const data = await wspaceFetch<{\n buiMigrationJobs: { items: BuiMigrationJob[]; pageInfo: { hasMore: boolean } };\n }>(\n `query BuiMigrationJobs($pagination: PaginationInput) {\n buiMigrationJobs(pagination: $pagination) { items { ${JOB_FIELDS} } pageInfo { hasMore } }\n }`,\n { pagination },\n apiGatewayUrl\n );\n return data.buiMigrationJobs;\n },\n });\n};\n\n/** Reads an uploaded package and describes the import. Read-only on the server. */\nexport const useBuiPreviewCourseImport = () => {\n const apiGatewayUrl = useBuiRequestScope();\n return useMutation({\n mutationFn: async (fileId: string) => {\n const data = await wspaceFetch<{ buiPreviewCourseImport: BuiCourseImportPreview }>(\n `query BuiPreviewCourseImport($fileId: ID!) {\n buiPreviewCourseImport(fileId: $fileId) {\n fileName format sourceSystem standardVersion title description canImport\n ${STATS_FIELDS}\n modules { title items { title kind detail } }\n ${ISSUE_FIELDS}\n }\n }`,\n { fileId },\n apiGatewayUrl\n );\n return data.buiPreviewCourseImport;\n },\n });\n};\n\nexport interface BuiImportCourseInput {\n fileId: string;\n title?: string;\n}\n\n/** Imports the package as a new draft course. */\nexport const useBuiImportCourse = () => {\n const apiGatewayUrl = useBuiRequestScope();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (input: BuiImportCourseInput) => {\n const data = await wspaceFetch<{\n buiImportCourse: {\n job: BuiMigrationJob;\n course: { id: string; title: string; slug: string };\n };\n }>(\n `mutation BuiImportCourse($input: BuiImportCourseInput!) {\n buiImportCourse(input: $input) { job { ${JOB_FIELDS} } course { id title slug } }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.buiImportCourse;\n },\n onSettled: async () => {\n // A failed import is recorded too, so the audit trail changes either way.\n await Promise.all([\n qc.invalidateQueries({ queryKey: migrationKeys.allJobs }),\n qc.invalidateQueries({ queryKey: ['buildmyiq', 'courses'] }),\n ]);\n },\n });\n};\n\n/** Exports a course as Common Cartridge or BuildMyIQ JSON. */\nexport const useBuiExportCourse = () => {\n const apiGatewayUrl = useBuiRequestScope();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (args: { courseId: string; format: BuiCourseExportFormat }) => {\n const data = await wspaceFetch<{ buiExportCourse: BuiMigrationExport }>(\n `mutation BuiExportCourse($courseId: ID!, $format: BuiCourseExportFormat!) {\n buiExportCourse(courseId: $courseId, format: $format) { ${EXPORT_FIELDS} }\n }`,\n args,\n apiGatewayUrl\n );\n return data.buiExportCourse;\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: migrationKeys.allJobs }),\n });\n};\n\n/** Exports a course's gradebook as CSV. */\nexport const useBuiExportGradebook = () => {\n const apiGatewayUrl = useBuiRequestScope();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (courseId: string) => {\n const data = await wspaceFetch<{ buiExportCourseGradebook: BuiMigrationExport }>(\n `mutation BuiExportCourseGradebook($courseId: ID!) {\n buiExportCourseGradebook(courseId: $courseId) { ${EXPORT_FIELDS} }\n }`,\n { courseId },\n apiGatewayUrl\n );\n return data.buiExportCourseGradebook;\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: migrationKeys.allJobs }),\n });\n};\n\n/** Decode an inline export into a Blob. */\nexport const exportToBlob = (\n exported: Pick<BuiMigrationExport, 'contentBase64' | 'mimeType'>\n): Blob => {\n const binary = atob(exported.contentBase64);\n const bytes = new Uint8Array(binary.length);\n for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);\n return new Blob([bytes], { type: exported.mimeType });\n};\n\n/** Save an inline export to the user's device. */\nexport const saveExport = (\n exported: Pick<BuiMigrationExport, 'contentBase64' | 'mimeType' | 'fileName'>\n): void => {\n const url = URL.createObjectURL(exportToBlob(exported));\n try {\n const anchor = document.createElement('a');\n anchor.href = url;\n anchor.download = exported.fileName;\n anchor.rel = 'noopener';\n document.body.appendChild(anchor);\n anchor.click();\n anchor.remove();\n } finally {\n // Give the browser a moment to start the download before revoking.\n window.setTimeout(() => URL.revokeObjectURL(url), 10_000);\n }\n};\n"],"mappings":";;;;AAgFA,IAAM,IAAe,kGACf,IAAe,wCACf,IAAa;;IAEf,EAAa;IACb,EAAa;GAEX,IAAgB,kDAAkD,EAAW,KAEtE,IAAgB;CAC3B,OAAO,MAAmB;EAAC;EAAa;EAAiB;CAAM;CAC/D,SAAS,CAAC,aAAa,eAAe;AACxC,GAKa,KAAuB,IAAS,MAAM;CACjD,IAAM,IAAgB,EAAmB;CACzC,OAAO,EAAS;EACd,UAAU,EAAc,KAAK,CAAM;EACnC,SAAS,YAAY;GACnB,IAAM,IACJ,IAAS,IACL;IAAE,OAAA;IAAiC;GAAO,IAC1C,EAAE,OAAA,GAAgC;GAUxC,QAAO,MATY,EAGjB;gEACwD,EAAW;YAEnE,EAAE,cAAW,GACb,CACF,EAAA,CACY;EACd;CACF,CAAC;AACH,GAGa,UAAkC;CAC7C,IAAM,IAAgB,EAAmB;CACzC,OAAO,EAAY,EACjB,YAAY,OAAO,OAaV,MAZY,EACjB;;;cAGM,EAAa;;cAEb,EAAa;;YAGnB,EAAE,UAAO,GACT,CACF,EAAA,CACY,uBAEhB,CAAC;AACH,GAQa,UAA2B;CACtC,IAAM,IAAgB,EAAmB,GACnC,IAAK,EAAe;CAC1B,OAAO,EAAY;EACjB,YAAY,OAAO,OAaV,MAZY,EAMjB;mDAC2C,EAAW;YAEtD,EAAE,SAAM,GACR,CACF,EAAA,CACY;EAEd,WAAW,YAAY;GAErB,MAAM,QAAQ,IAAI,CAChB,EAAG,kBAAkB,EAAE,UAAU,EAAc,QAAQ,CAAC,GACxD,E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**\n * Buildmyiq — course migration hooks (BOFF-4437).\n * @module buildmyiq/hooks/useBuiMigration\n *\n * Transport for the Migration Center:\n * - `buiPreviewCourseImport(fileId)` — what importing a Common Cartridge or Moodle\n * backup would create, with every skipped or converted item. Writes nothing.\n * - `buiImportCourse(input)` — imports the package as a new DRAFT course.\n * - `buiExportCourse(courseId, format)` / `buiExportCourseGradebook(courseId)`\n * — open-standards exports, returned inline as base64.\n * - `buiMigrationJobs` — the migration audit trail.\n *\n * Packages are uploaded PRIVATE through the platform file flow\n * (`useBuiFileUpload`), so only the uploader can import them.\n */\n\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\n\nimport { useBuiRequestScope } from './requestScope';\nimport { wspaceFetch } from './useBuiFiles';\n\nexport type BuiMigrationIssueSeverity = 'INFO' | 'WARNING' | 'ERROR';\nexport type BuiMigrationJobKind = 'COURSE_IMPORT' | 'COURSE_EXPORT' | 'GRADEBOOK_EXPORT';\nexport type BuiMigrationFormat =\n 'COMMON_CARTRIDGE' | 'MOODLE_BACKUP' | 'BUILDMYIQ_JSON' | 'GRADEBOOK_CSV';\nexport type BuiCourseExportFormat = 'COMMON_CARTRIDGE' | 'BUILDMYIQ_JSON';\n\nexport interface BuiMigrationIssue {\n severity: BuiMigrationIssueSeverity;\n code: string;\n message: string;\n ref: string | null;\n}\n\nexport interface BuiMigrationStats {\n moduleCount: number;\n lessonCount: number;\n assessmentCount: number;\n questionCount: number;\n skippedCount: number;\n rowCount: number;\n byteSize: number;\n}\n\nexport interface BuiMigrationJob {\n id: string;\n kind: BuiMigrationJobKind;\n status: 'COMPLETED' | 'FAILED';\n format: BuiMigrationFormat;\n sourceSystem: string | null;\n fileId: string | null;\n fileName: string | null;\n courseId: string | null;\n courseTitle: string | null;\n stats: BuiMigrationStats;\n issues: BuiMigrationIssue[];\n createdAt: string;\n createdBy: string;\n}\n\nexport interface BuiCourseImportPreview {\n fileName: string;\n format: BuiMigrationFormat;\n sourceSystem: string | null;\n standardVersion: string | null;\n title: string;\n description: string | null;\n stats: BuiMigrationStats;\n modules: Array<{ title: string; items: Array<{ title: string; kind: string; detail: string }> }>;\n issues: BuiMigrationIssue[];\n canImport: boolean;\n}\n\nexport interface BuiMigrationExport {\n job: BuiMigrationJob;\n fileName: string;\n mimeType: string;\n contentBase64: string;\n byteSize: number;\n}\n\nconst STATS_FIELDS = `stats { moduleCount lessonCount assessmentCount questionCount skippedCount rowCount byteSize }`;\nconst ISSUE_FIELDS = `issues { severity code message ref }`;\nconst JOB_FIELDS = `\n id kind status format sourceSystem fileId fileName courseId courseTitle createdAt createdBy\n ${STATS_FIELDS}\n ${ISSUE_FIELDS}\n`;\nconst EXPORT_FIELDS = `fileName mimeType contentBase64 byteSize job { ${JOB_FIELDS} }`;\n\nexport const migrationKeys = {\n jobs: (offset: number) => ['buildmyiq', 'migrationJobs', offset] as const,\n allJobs: ['buildmyiq', 'migrationJobs'] as const,\n};\n\nexport const MIGRATION_JOBS_PAGE_SIZE = 20;\n\n/** The migration audit trail, newest first, one page at a time. */\nexport const useBuiMigrationJobs = (offset = 0) => {\n const apiGatewayUrl = useBuiRequestScope();\n return useQuery({\n queryKey: migrationKeys.jobs(offset),\n queryFn: async () => {\n const pagination =\n offset > 0\n ? { limit: MIGRATION_JOBS_PAGE_SIZE, offset }\n : { limit: MIGRATION_JOBS_PAGE_SIZE };\n const data = await wspaceFetch<{\n buiMigrationJobs: { items: BuiMigrationJob[]; pageInfo: { hasMore: boolean } };\n }>(\n `query BuiMigrationJobs($pagination: PaginationInput) {\n buiMigrationJobs(pagination: $pagination) { items { ${JOB_FIELDS} } pageInfo { hasMore } }\n }`,\n { pagination },\n apiGatewayUrl\n );\n return data.buiMigrationJobs;\n },\n });\n};\n\n/** Reads an uploaded package and describes the import. Read-only on the server. */\nexport const useBuiPreviewCourseImport = () => {\n const apiGatewayUrl = useBuiRequestScope();\n return useMutation({\n mutationFn: async (fileId: string) => {\n const data = await wspaceFetch<{ buiPreviewCourseImport: BuiCourseImportPreview }>(\n `query BuiPreviewCourseImport($fileId: ID!) {\n buiPreviewCourseImport(fileId: $fileId) {\n fileName format sourceSystem standardVersion title description canImport\n ${STATS_FIELDS}\n modules { title items { title kind detail } }\n ${ISSUE_FIELDS}\n }\n }`,\n { fileId },\n apiGatewayUrl\n );\n return data.buiPreviewCourseImport;\n },\n });\n};\n\nexport interface BuiImportCourseInput {\n fileId: string;\n title?: string;\n}\n\n/** Imports the package as a new draft course. */\nexport const useBuiImportCourse = () => {\n const apiGatewayUrl = useBuiRequestScope();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (input: BuiImportCourseInput) => {\n const data = await wspaceFetch<{\n buiImportCourse: {\n job: BuiMigrationJob;\n course: { id: string; title: string; slug: string };\n };\n }>(\n `mutation BuiImportCourse($input: BuiImportCourseInput!) {\n buiImportCourse(input: $input) { job { ${JOB_FIELDS} } course { id title slug } }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.buiImportCourse;\n },\n onSettled: async () => {\n // A failed import is recorded too, so the audit trail changes either way.\n await Promise.all([\n qc.invalidateQueries({ queryKey: migrationKeys.allJobs }),\n qc.invalidateQueries({ queryKey: ['buildmyiq', 'courses'] }),\n ]);\n },\n });\n};\n\n/** Exports a course as Common Cartridge or BuildMyIQ JSON. */\nexport const useBuiExportCourse = () => {\n const apiGatewayUrl = useBuiRequestScope();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (args: { courseId: string; format: BuiCourseExportFormat }) => {\n const data = await wspaceFetch<{ buiExportCourse: BuiMigrationExport }>(\n `mutation BuiExportCourse($courseId: ID!, $format: BuiCourseExportFormat!) {\n buiExportCourse(courseId: $courseId, format: $format) { ${EXPORT_FIELDS} }\n }`,\n args,\n apiGatewayUrl\n );\n return data.buiExportCourse;\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: migrationKeys.allJobs }),\n });\n};\n\n/** Exports a course's gradebook as CSV. */\nexport const useBuiExportGradebook = () => {\n const apiGatewayUrl = useBuiRequestScope();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (courseId: string) => {\n const data = await wspaceFetch<{ buiExportCourseGradebook: BuiMigrationExport }>(\n `mutation BuiExportCourseGradebook($courseId: ID!) {\n buiExportCourseGradebook(courseId: $courseId) { ${EXPORT_FIELDS} }\n }`,\n { courseId },\n apiGatewayUrl\n );\n return data.buiExportCourseGradebook;\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: migrationKeys.allJobs }),\n });\n};\n\n/** Decode an inline export into a Blob. */\nexport const exportToBlob = (\n exported: Pick<BuiMigrationExport, 'contentBase64' | 'mimeType'>\n): Blob => {\n const binary = atob(exported.contentBase64);\n const bytes = new Uint8Array(binary.length);\n for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);\n return new Blob([bytes], { type: exported.mimeType });\n};\n\n/** Save an inline export to the user's device. */\nexport const saveExport = (\n exported: Pick<BuiMigrationExport, 'contentBase64' | 'mimeType' | 'fileName'>\n): void => {\n const url = URL.createObjectURL(exportToBlob(exported));\n try {\n const anchor = document.createElement('a');\n anchor.href = url;\n anchor.download = exported.fileName;\n anchor.rel = 'noopener';\n document.body.appendChild(anchor);\n anchor.click();\n anchor.remove();\n } finally {\n // Give the browser a moment to start the download before revoking.\n window.setTimeout(() => URL.revokeObjectURL(url), 10_000);\n }\n};\n"],"mappings":";;;;AAiFA,IAAM,IAAe,kGACf,IAAe,wCACf,IAAa;;IAEf,EAAa;IACb,EAAa;GAEX,IAAgB,kDAAkD,EAAW,KAEtE,IAAgB;CAC3B,OAAO,MAAmB;EAAC;EAAa;EAAiB;CAAM;CAC/D,SAAS,CAAC,aAAa,eAAe;AACxC,GAKa,KAAuB,IAAS,MAAM;CACjD,IAAM,IAAgB,EAAmB;CACzC,OAAO,EAAS;EACd,UAAU,EAAc,KAAK,CAAM;EACnC,SAAS,YAAY;GACnB,IAAM,IACJ,IAAS,IACL;IAAE,OAAA;IAAiC;GAAO,IAC1C,EAAE,OAAA,GAAgC;GAUxC,QAAO,MATY,EA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Q,KAAK,EAAM,KAAK,EAAO,WAAW,CAAC;CACtE,OAAO,IAAI,KAAK,CAAC,CAAK,GAAG,EAAE,MAAM,EAAS,SAAS,CAAC;AACtD,GAGa,KACX,MACS;CACT,IAAM,IAAM,IAAI,gBAAgB,EAAa,CAAQ,CAAC;CACtD,IAAI;EACF,IAAM,IAAS,SAAS,cAAc,GAAG;EAMzC,AALA,EAAO,OAAO,GACd,EAAO,WAAW,EAAS,UAC3B,EAAO,MAAM,YACb,SAAS,KAAK,YAAY,CAAM,GAChC,EAAO,MAAM,GACb,EAAO,OAAO;CAChB,UAAU;EAER,OAAO,iBAAiB,IAAI,gBAAgB,CAAG,GAAG,GAAM;CAC1D;AACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { HrisConnectionSummary, HrisDirectorySyncStatus, HrisProviderKey, HrisSyncRun } from '../pages/provisioning/hrisModel';
|
|
2
|
+
/** The workspace's connections for one HR system (null when the provider is not available). */
|
|
3
|
+
export declare function useHrisConnections(key: HrisProviderKey): import('@tanstack/react-query').UseQueryResult<HrisConnectionSummary[] | null, unknown>;
|
|
4
|
+
export declare function useHrisStatus(connectionId: string): import('@tanstack/react-query').UseQueryResult<HrisDirectorySyncStatus, unknown>;
|
|
5
|
+
/** Creates the connection and saves its credentials; removes the connection again if they are refused. */
|
|
6
|
+
export declare function useConnectHris(key: HrisProviderKey): import('@tanstack/react-query').UseMutationResult<string, Error, {
|
|
7
|
+
name: string;
|
|
8
|
+
values: Record<string, string>;
|
|
9
|
+
}, unknown>;
|
|
10
|
+
/** Replaces the credentials of an existing connection. A new preview is needed afterwards. */
|
|
11
|
+
export declare function useUpdateHrisCredentials(connectionId: string): import('@tanstack/react-query').UseMutationResult<void, Error, Record<string, string>, unknown>;
|
|
12
|
+
export declare function useDeleteHrisConnection(key: HrisProviderKey): import('@tanstack/react-query').UseMutationResult<void, Error, string, unknown>;
|
|
13
|
+
export declare function useStartHrisSync(connectionId: string): import('@tanstack/react-query').UseMutationResult<HrisSyncRun, Error, {
|
|
14
|
+
mode: "PREVIEW" | "APPLY";
|
|
15
|
+
allowMassDeactivation?: boolean;
|
|
16
|
+
}, unknown>;
|
|
17
|
+
export declare function useSetHrisSchedule(connectionId: string): import('@tanstack/react-query').UseMutationResult<void, Error, {
|
|
18
|
+
enabled: boolean;
|
|
19
|
+
intervalHours: number;
|
|
20
|
+
}, unknown>;
|
|
21
|
+
//# sourceMappingURL=useHrisDirectorySync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHrisDirectorySync.d.ts","sourceRoot":"","sources":["../../../src/buildmyiq/hooks/useHrisDirectorySync.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAQH,OAAO,KAAK,EACV,qBAAqB,EACrB,uBAAuB,EACvB,eAAe,EACf,WAAW,EACZ,MAAM,iCAAiC,CAAC;AAgDzC,+FAA+F;AAC/F,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,eAAe,2FAsBtD;AAED,wBAAgB,aAAa,CAAC,YAAY,EAAE,MAAM,oFAgBjD;AAED,0GAA0G;AAC1G,wBAAgB,cAAc,CAAC,GAAG,EAAE,eAAe;UAIZ,MAAM;YAAU,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;YAyB5E;AAED,8FAA8F;AAC9F,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,MAAM,mGAc5D;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,eAAe,mFAa3D;AAED,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM;UAId,SAAS,GAAG,OAAO;4BAA0B,OAAO;YAiB1F;AAED,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM;aAIb,OAAO;mBAAiB,MAAM;YAYvE"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { useBuildmyiq as e } from "../context/BuildmyiqContext.js";
|
|
2
|
+
import "../context/index.js";
|
|
3
|
+
import { clearGraphqlReadCaches as t } from "./useBuildmyiqApi.js";
|
|
4
|
+
import { ProvisioningApiError as n, isPermissionError as r } from "../pages/provisioning/provisioningModel.js";
|
|
5
|
+
import { useMutation as i, useQuery as a, useQueryClient as o } from "@tanstack/react-query";
|
|
6
|
+
import { graphqlFetch as s } from "@burdenoff/fe-libs/shared/graphql";
|
|
7
|
+
//#region src/buildmyiq/hooks/useHrisDirectorySync.ts
|
|
8
|
+
var c = "id connectionId mode trigger status workersFetched created updated deactivated reactivated\n unchanged skipped conflicts errors errorCode errorMessage startedBy startedAt finishedAt\n items { externalId email action userId detail }", l = `connectionId providerKey connectionStatus credentialsUpdatedAt scheduleEnabled intervalHours
|
|
9
|
+
nextRunAt canApply lastPreview { ${c} } lastApply { ${c} } running { ${c} }`, u = async (e, r) => {
|
|
10
|
+
let i = await s({
|
|
11
|
+
gateway: "workspace",
|
|
12
|
+
query: e,
|
|
13
|
+
variables: r,
|
|
14
|
+
suppressGlobalErrorEvent: !0
|
|
15
|
+
});
|
|
16
|
+
if (i.errors?.length) {
|
|
17
|
+
let e = i.errors[0], t = e?.extensions?.code;
|
|
18
|
+
throw new n(e?.message ?? "GraphQL request failed", typeof t == "string" ? t : void 0);
|
|
19
|
+
}
|
|
20
|
+
if (!i.data) throw new n("GraphQL response did not include data");
|
|
21
|
+
return /^\s*mutation\b/.test(e) && t(), i.data;
|
|
22
|
+
}, d = (e, t) => [
|
|
23
|
+
"buildmyiq",
|
|
24
|
+
"hrisConnections",
|
|
25
|
+
e,
|
|
26
|
+
t
|
|
27
|
+
], f = (e, t) => [
|
|
28
|
+
"buildmyiq",
|
|
29
|
+
"hrisStatus",
|
|
30
|
+
e,
|
|
31
|
+
t
|
|
32
|
+
], p = (e, t) => !r(t) && e < 2;
|
|
33
|
+
async function m(e) {
|
|
34
|
+
let t = await u("query BuiHrisProvider($key: String!) { getProviderByKey(key: $key) { id isEnabled } }", { key: e });
|
|
35
|
+
return t.getProviderByKey?.isEnabled ? t.getProviderByKey.id : null;
|
|
36
|
+
}
|
|
37
|
+
function h(t) {
|
|
38
|
+
let { workspaceId: n } = e();
|
|
39
|
+
return a({
|
|
40
|
+
queryKey: d(n ?? "", t),
|
|
41
|
+
enabled: !!n,
|
|
42
|
+
retry: p,
|
|
43
|
+
queryFn: async () => {
|
|
44
|
+
let e = await m(t);
|
|
45
|
+
return e ? (await u("query BuiHrisConnections($providerId: ID!) {\n getConnectionsByProvider(providerId: $providerId, pagination: { limit: 20 }) {\n items { id name status createdAt }\n }\n }", { providerId: e })).getConnectionsByProvider.items : null;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function g(t) {
|
|
50
|
+
let { workspaceId: n } = e();
|
|
51
|
+
return a({
|
|
52
|
+
queryKey: f(n ?? "", t),
|
|
53
|
+
enabled: !!n,
|
|
54
|
+
retry: p,
|
|
55
|
+
refetchInterval: (e) => e.state.data?.running ? 3e3 : !1,
|
|
56
|
+
queryFn: async () => (await u(`query BuiHrisStatus($connectionId: ID!) { hrisDirectorySync(connectionId: $connectionId) { ${l} } }`, { connectionId: t })).hrisDirectorySync
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function _(t) {
|
|
60
|
+
let { workspaceId: r } = e(), a = o();
|
|
61
|
+
return i({
|
|
62
|
+
mutationFn: async (e) => {
|
|
63
|
+
let r = await m(t);
|
|
64
|
+
if (!r) throw new n("This HR system is not available in this workspace.");
|
|
65
|
+
let i = (await u("mutation BuiHrisCreate($input: CreateConnectionInput!) { createConnection(input: $input) { id } }", { input: {
|
|
66
|
+
name: e.name,
|
|
67
|
+
providerId: r,
|
|
68
|
+
visibility: "WORKSPACE"
|
|
69
|
+
} })).createConnection.id;
|
|
70
|
+
try {
|
|
71
|
+
await u("mutation BuiHrisAuth($input: AuthenticateConnectionInput!) { authenticateConnection(input: $input) { id status } }", { input: {
|
|
72
|
+
connectionId: i,
|
|
73
|
+
values: e.values
|
|
74
|
+
} });
|
|
75
|
+
} catch (e) {
|
|
76
|
+
throw await u("mutation BuiHrisUndo($id: ID!) { deleteConnection(id: $id) }", { id: i }).catch(() => void 0), e;
|
|
77
|
+
}
|
|
78
|
+
return i;
|
|
79
|
+
},
|
|
80
|
+
onSuccess: () => {
|
|
81
|
+
a.invalidateQueries({ queryKey: d(r ?? "", t) });
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function v(t) {
|
|
86
|
+
let { workspaceId: n } = e(), r = o();
|
|
87
|
+
return i({
|
|
88
|
+
mutationFn: async (e) => {
|
|
89
|
+
await u("mutation BuiHrisReauth($input: AuthenticateConnectionInput!) { authenticateConnection(input: $input) { id status } }", { input: {
|
|
90
|
+
connectionId: t,
|
|
91
|
+
values: e
|
|
92
|
+
} });
|
|
93
|
+
},
|
|
94
|
+
onSuccess: () => {
|
|
95
|
+
r.invalidateQueries({ queryKey: f(n ?? "", t) });
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function y(t) {
|
|
100
|
+
let { workspaceId: n } = e(), r = o();
|
|
101
|
+
return i({
|
|
102
|
+
mutationFn: async (e) => {
|
|
103
|
+
await u("mutation BuiHrisDelete($id: ID!) { deleteConnection(id: $id) }", { id: e });
|
|
104
|
+
},
|
|
105
|
+
onSuccess: () => {
|
|
106
|
+
r.invalidateQueries({ queryKey: d(n ?? "", t) });
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function b(t) {
|
|
111
|
+
let { workspaceId: n } = e(), r = o();
|
|
112
|
+
return i({
|
|
113
|
+
mutationFn: async (e) => (await u(`mutation BuiHrisStart($input: StartHrisSyncInput!) { startHrisSync(input: $input) { ${c} } }`, { input: {
|
|
114
|
+
connectionId: t,
|
|
115
|
+
mode: e.mode,
|
|
116
|
+
allowMassDeactivation: e.allowMassDeactivation ?? !1
|
|
117
|
+
} })).startHrisSync,
|
|
118
|
+
onSuccess: () => {
|
|
119
|
+
r.invalidateQueries({ queryKey: f(n ?? "", t) });
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function x(t) {
|
|
124
|
+
let { workspaceId: n } = e(), r = o();
|
|
125
|
+
return i({
|
|
126
|
+
mutationFn: async (e) => {
|
|
127
|
+
await u("mutation BuiHrisSchedule($input: SetHrisSyncScheduleInput!) {\n setHrisSyncSchedule(input: $input) { connectionId scheduleEnabled intervalHours nextRunAt }\n }", { input: {
|
|
128
|
+
connectionId: t,
|
|
129
|
+
enabled: e.enabled,
|
|
130
|
+
intervalHours: e.intervalHours
|
|
131
|
+
} });
|
|
132
|
+
},
|
|
133
|
+
onSuccess: () => {
|
|
134
|
+
r.invalidateQueries({ queryKey: f(n ?? "", t) });
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
//#endregion
|
|
139
|
+
export { _ as useConnectHris, y as useDeleteHrisConnection, h as useHrisConnections, g as useHrisStatus, x as useSetHrisSchedule, b as useStartHrisSync, v as useUpdateHrisCredentials };
|
|
140
|
+
|
|
141
|
+
//# sourceMappingURL=useHrisDirectorySync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHrisDirectorySync.js","names":[],"sources":["../../../src/buildmyiq/hooks/useHrisDirectorySync.ts"],"sourcesContent":["/**\n * Direct HR-system connector hooks (BOFF-10564)\n * @module buildmyiq/hooks\n *\n * Workday and SAP SuccessFactors connections live in wspace-integrations-svc\n * (workspace gateway). Credentials are submitted once with\n * `authenticateConnection` and encrypted server side; this page never reads\n * them back. Preview, sync and schedule are `hrisDirectorySync`,\n * `startHrisSync` and `setHrisSyncSchedule`, all gated to workspace\n * administrators by `@rbac(action: \"administer\", resource: \"integration-connection\")`.\n */\n\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\nimport { graphqlFetch } from '@burdenoff/fe-libs/shared/graphql';\n\nimport { useBuildmyiq } from '../context';\nimport { clearGraphqlReadCaches } from './useBuildmyiqApi';\nimport { ProvisioningApiError, isPermissionError } from '../pages/provisioning/provisioningModel';\nimport type {\n HrisConnectionSummary,\n HrisDirectorySyncStatus,\n HrisProviderKey,\n HrisSyncRun,\n} from '../pages/provisioning/hrisModel';\n\nconst RUN_FIELDS = `id connectionId mode trigger status workersFetched created updated deactivated reactivated\n unchanged skipped conflicts errors errorCode errorMessage startedBy startedAt finishedAt\n items { externalId email action userId detail }`;\n\nconst STATUS_FIELDS = `connectionId providerKey connectionStatus credentialsUpdatedAt scheduleEnabled intervalHours\n nextRunAt canApply lastPreview { ${RUN_FIELDS} } lastApply { ${RUN_FIELDS} } running { ${RUN_FIELDS} }`;\n\nconst wspaceRequest = async <TData>(\n query: string,\n variables: Record<string, unknown>\n): Promise<TData> => {\n const response = await graphqlFetch<TData>({\n gateway: 'workspace',\n query,\n variables,\n suppressGlobalErrorEvent: true,\n });\n if (response.errors?.length) {\n const first = response.errors[0];\n const code = first?.extensions?.code;\n throw new ProvisioningApiError(\n first?.message ?? 'GraphQL request failed',\n typeof code === 'string' ? code : undefined\n );\n }\n if (!response.data) throw new ProvisioningApiError('GraphQL response did not include data');\n if (/^\\s*mutation\\b/.test(query)) clearGraphqlReadCaches();\n return response.data;\n};\n\nconst connectionsKey = (workspaceId: string, key: HrisProviderKey) =>\n ['buildmyiq', 'hrisConnections', workspaceId, key] as const;\nconst statusKey = (workspaceId: string, connectionId: string) =>\n ['buildmyiq', 'hrisStatus', workspaceId, connectionId] as const;\n\nconst retry = (failureCount: number, error: unknown) =>\n !isPermissionError(error) && failureCount < 2;\n\nasync function providerId(key: HrisProviderKey): Promise<string | null> {\n const data = await wspaceRequest<{ getProviderByKey: { id: string; isEnabled: boolean } | null }>(\n `query BuiHrisProvider($key: String!) { getProviderByKey(key: $key) { id isEnabled } }`,\n { key }\n );\n return data.getProviderByKey?.isEnabled ? data.getProviderByKey.id : null;\n}\n\n/** The workspace's connections for one HR system (null when the provider is not available). */\nexport function useHrisConnections(key: HrisProviderKey) {\n const { workspaceId } = useBuildmyiq();\n return useQuery({\n queryKey: connectionsKey(workspaceId ?? '', key),\n enabled: !!workspaceId,\n retry,\n queryFn: async (): Promise<HrisConnectionSummary[] | null> => {\n const id = await providerId(key);\n if (!id) return null;\n const data = await wspaceRequest<{\n getConnectionsByProvider: { items: HrisConnectionSummary[] };\n }>(\n `query BuiHrisConnections($providerId: ID!) {\n getConnectionsByProvider(providerId: $providerId, pagination: { limit: 20 }) {\n items { id name status createdAt }\n }\n }`,\n { providerId: id }\n );\n return data.getConnectionsByProvider.items;\n },\n });\n}\n\nexport function useHrisStatus(connectionId: string) {\n const { workspaceId } = useBuildmyiq();\n return useQuery({\n queryKey: statusKey(workspaceId ?? '', connectionId),\n enabled: !!workspaceId,\n retry,\n // Poll while a preview or sync runs in the background.\n refetchInterval: (query) => (query.state.data?.running ? 3_000 : false),\n queryFn: async () => {\n const data = await wspaceRequest<{ hrisDirectorySync: HrisDirectorySyncStatus }>(\n `query BuiHrisStatus($connectionId: ID!) { hrisDirectorySync(connectionId: $connectionId) { ${STATUS_FIELDS} } }`,\n { connectionId }\n );\n return data.hrisDirectorySync;\n },\n });\n}\n\n/** Creates the connection and saves its credentials; removes the connection again if they are refused. */\nexport function useConnectHris(key: HrisProviderKey) {\n const { workspaceId } = useBuildmyiq();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (params: { name: string; values: Record<string, string> }) => {\n const id = await providerId(key);\n if (!id) throw new ProvisioningApiError('This HR system is not available in this workspace.');\n const created = await wspaceRequest<{ createConnection: { id: string } }>(\n `mutation BuiHrisCreate($input: CreateConnectionInput!) { createConnection(input: $input) { id } }`,\n { input: { name: params.name, providerId: id, visibility: 'WORKSPACE' } }\n );\n const connectionId = created.createConnection.id;\n try {\n await wspaceRequest(\n `mutation BuiHrisAuth($input: AuthenticateConnectionInput!) { authenticateConnection(input: $input) { id status } }`,\n { input: { connectionId, values: params.values } }\n );\n } catch (error) {\n await wspaceRequest(`mutation BuiHrisUndo($id: ID!) { deleteConnection(id: $id) }`, {\n id: connectionId,\n }).catch(() => undefined);\n throw error;\n }\n return connectionId;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: connectionsKey(workspaceId ?? '', key) });\n },\n });\n}\n\n/** Replaces the credentials of an existing connection. A new preview is needed afterwards. */\nexport function useUpdateHrisCredentials(connectionId: string) {\n const { workspaceId } = useBuildmyiq();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (values: Record<string, string>) => {\n await wspaceRequest(\n `mutation BuiHrisReauth($input: AuthenticateConnectionInput!) { authenticateConnection(input: $input) { id status } }`,\n { input: { connectionId, values } }\n );\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: statusKey(workspaceId ?? '', connectionId) });\n },\n });\n}\n\nexport function useDeleteHrisConnection(key: HrisProviderKey) {\n const { workspaceId } = useBuildmyiq();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (connectionId: string) => {\n await wspaceRequest(`mutation BuiHrisDelete($id: ID!) { deleteConnection(id: $id) }`, {\n id: connectionId,\n });\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: connectionsKey(workspaceId ?? '', key) });\n },\n });\n}\n\nexport function useStartHrisSync(connectionId: string) {\n const { workspaceId } = useBuildmyiq();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (params: { mode: 'PREVIEW' | 'APPLY'; allowMassDeactivation?: boolean }) => {\n const data = await wspaceRequest<{ startHrisSync: HrisSyncRun }>(\n `mutation BuiHrisStart($input: StartHrisSyncInput!) { startHrisSync(input: $input) { ${RUN_FIELDS} } }`,\n {\n input: {\n connectionId,\n mode: params.mode,\n allowMassDeactivation: params.allowMassDeactivation ?? false,\n },\n }\n );\n return data.startHrisSync;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: statusKey(workspaceId ?? '', connectionId) });\n },\n });\n}\n\nexport function useSetHrisSchedule(connectionId: string) {\n const { workspaceId } = useBuildmyiq();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (params: { enabled: boolean; intervalHours: number }) => {\n await wspaceRequest(\n `mutation BuiHrisSchedule($input: SetHrisSyncScheduleInput!) {\n setHrisSyncSchedule(input: $input) { connectionId scheduleEnabled intervalHours nextRunAt }\n }`,\n { input: { connectionId, enabled: params.enabled, intervalHours: params.intervalHours } }\n );\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: statusKey(workspaceId ?? '', connectionId) });\n },\n });\n}\n"],"mappings":";;;;;;;AAyBA,IAAM,IAAa,6OAIb,IAAgB;qCACe,EAAW,iBAAiB,EAAW,eAAe,EAAW,KAEhG,IAAgB,OACpB,GACA,MACmB;CACnB,IAAM,IAAW,MAAM,EAAoB;EACzC,SAAS;EACT;EACA;EACA,0BAA0B;CAC5B,CAAC;CACD,IAAI,EAAS,QAAQ,QAAQ;EAC3B,IAAM,IAAQ,EAAS,OAAO,IACxB,IAAO,GAAO,YAAY;EAChC,MAAM,IAAI,EACR,GAAO,WAAW,0BAClB,OAAO,KAAS,WAAW,IAAO,KAAA,CACpC;CACF;CACA,IAAI,CAAC,EAAS,MAAM,MAAM,IAAI,EAAqB,uCAAuC;CAE1F,OADI,iBAAiB,KAAK,CAAK,KAAG,EAAuB,GAClD,EAAS;AAClB,GAEM,KAAkB,GAAqB,MAC3C;CAAC;CAAa;CAAmB;CAAa;AAAG,GAC7C,KAAa,GAAqB,MACtC;CAAC;CAAa;CAAc;CAAa;AAAY,GAEjD,KAAS,GAAsB,MACnC,CAAC,EAAkB,CAAK,KAAK,IAAe;AAE9C,eAAe,EAAW,GAA8C;CACtE,IAAM,IAAO,MAAM,EACjB,yFACA,EAAE,OAAI,CACR;CACA,OAAO,EAAK,kBAAkB,YAAY,EAAK,iBAAiB,KAAK;AACvE;AAGA,SAAgB,EAAmB,GAAsB;CACvD,IAAM,EAAE,mBAAgB,EAAa;CACrC,OAAO,EAAS;EACd,UAAU,EAAe,KAAe,IAAI,CAAG;EAC/C,SAAS,CAAC,CAAC;EACX;EACA,SAAS,YAAqD;GAC5D,IAAM,IAAK,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wHACA,EAAE,OAAO;IAAE;IAAc;GAAO,EAAE,CACpC;EACF;EACA,iBAAiB;GACf,EAAiB,kBAAkB,EAAE,UAAU,EAAU,KAAe,IAAI,CAAY,EAAE,CAAC;EAC7F;CACF,CAAC;AACH;AAEA,SAAgB,EAAwB,GAAsB;CAC5D,IAAM,EAAE,mBAAgB,EAAa,GAC/B,IAAc,EAAe;CACnC,OAAO,EAAY;EACjB,YAAY,OAAO,MAAyB;GAC1C,MAAM,EAAc,kEAAkE,EACpF,IAAI,EACN,CAAC;EACH;EACA,iBAAiB;GACf,EAAiB,kBAAkB,EAAE,UAAU,EAAe,KAAe,IAAI,CAAG,EAAE,CAAC;EACzF;CACF,CAAC;AACH;AAEA,SAAgB,EAAiB,GAAsB;CACrD,IAAM,EAAE,mBAAgB,EAAa,GAC/B,IAAc,EAAe;CACnC,OAAO,EAAY;EACjB,YAAY,OAAO,OAWV,MAVY,EACjB,uFAAuF,EAAW,OAClG,EACE,OAAO;GACL;GACA,MAAM,EAAO;GACb,uBAAuB,EAAO,yBAAyB;EACzD,EACF,CACF,EAAA,CACY;EAEd,iBAAiB;GACf,EAAiB,kBAAkB,EAAE,UAAU,EAAU,KAAe,IAAI,CAAY,EAAE,CAAC;EAC7F;CACF,CAAC;AACH;AAEA,SAAgB,EAAmB,GAAsB;CACvD,IAAM,EAAE,mBAAgB,EAAa,GAC/B,IAAc,EAAe;CACnC,OAAO,EAAY;EACjB,YAAY,OAAO,MAAwD;GACzE,MAAM,EACJ,mLAGA,EAAE,OAAO;IAAE;IAAc,SAAS,EAAO;IAAS,eAAe,EAAO;GAAc,EAAE,CAC1F;EACF;EACA,iBAAiB;GACf,EAAiB,kBAAkB,EAAE,UAAU,EAAU,KAAe,IAAI,CAAY,EAAE,CAAC;EAC7F;CACF,CAAC;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationCenterPage.d.ts","sourceRoot":"","sources":["../../../../src/buildmyiq/pages/migration/MigrationCenterPage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAe,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"MigrationCenterPage.d.ts","sourceRoot":"","sources":["../../../../src/buildmyiq/pages/migration/MigrationCenterPage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAe,EAAE,EAAE,MAAM,OAAO,CAAC;AA4lB7C,eAAO,MAAM,mBAAmB,EAAE,EA0BjC,CAAC"}
|
|
@@ -18,7 +18,7 @@ import { AlertTriangle as C, ArrowRightLeft as w, CheckCircle2 as T, Download as
|
|
|
18
18
|
import { jsx as M, jsxs as N } from "react/jsx-runtime";
|
|
19
19
|
import { Button as P, GlassCard as F, Input as I } from "@burdenoff/fe-libs/ui";
|
|
20
20
|
//#region src/buildmyiq/pages/migration/MigrationCenterPage.tsx
|
|
21
|
-
var L = ".imscc,.zip,application/zip", R = [
|
|
21
|
+
var L = ".imscc,.zip,.mbz,application/zip,application/gzip,application/x-gzip,application/vnd.moodle.backup", R = [
|
|
22
22
|
{
|
|
23
23
|
lms: "Canvas",
|
|
24
24
|
steps: "Settings → Export Course Content → Course → Create Export, then download the .imscc file."
|
|
@@ -29,13 +29,13 @@ var L = ".imscc,.zip,application/zip", R = [
|
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
lms: "Moodle",
|
|
32
|
-
steps: "
|
|
32
|
+
steps: "Course → Backup, keep the defaults (no user data needed), then download the .mbz file. A Common Cartridge export works too."
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
lms: "Brightspace (D2L)",
|
|
36
36
|
steps: "Course Admin → Import/Export/Copy Components → Export as Common Cartridge."
|
|
37
37
|
}
|
|
38
|
-
], z = (e) => e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1024 / 1024).toFixed(1)} MB`, B = (e, t) => e instanceof Error && e.message ? e.message : t,
|
|
38
|
+
], z = (e) => e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1024 / 1024).toFixed(1)} MB`, B = (e) => e.format === "MOODLE_BACKUP" ? e.standardVersion ? `Moodle backup (Moodle ${e.standardVersion})` : "Moodle backup" : e.standardVersion ? `Common Cartridge ${e.standardVersion}` : "Common Cartridge", V = (e, t) => e instanceof Error && e.message ? e.message : t, H = (e) => e === "ERROR" ? /* @__PURE__ */ M(j, {
|
|
39
39
|
"aria-hidden": "true",
|
|
40
40
|
className: "h-4 w-4 shrink-0 text-status-error-text"
|
|
41
41
|
}) : e === "WARNING" ? /* @__PURE__ */ M(C, {
|
|
@@ -44,19 +44,19 @@ var L = ".imscc,.zip,application/zip", R = [
|
|
|
44
44
|
}) : /* @__PURE__ */ M(k, {
|
|
45
45
|
"aria-hidden": "true",
|
|
46
46
|
className: "h-4 w-4 shrink-0 text-text-tertiary"
|
|
47
|
-
}),
|
|
47
|
+
}), U = {
|
|
48
48
|
ERROR: 0,
|
|
49
49
|
WARNING: 1,
|
|
50
50
|
INFO: 2
|
|
51
|
-
},
|
|
51
|
+
}, W = ({ issues: e, emptyText: t }) => e.length === 0 ? t ? /* @__PURE__ */ M("p", {
|
|
52
52
|
className: "text-sm text-text-secondary",
|
|
53
53
|
children: t
|
|
54
54
|
}) : null : /* @__PURE__ */ M("ul", {
|
|
55
55
|
className: "flex flex-col gap-2",
|
|
56
56
|
"aria-label": "Migration issues",
|
|
57
|
-
children: [...e].sort((e, t) =>
|
|
57
|
+
children: [...e].sort((e, t) => U[e.severity] - U[t.severity]).map((e, t) => /* @__PURE__ */ N("li", {
|
|
58
58
|
className: "flex items-start gap-2 text-sm",
|
|
59
|
-
children: [
|
|
59
|
+
children: [H(e.severity), /* @__PURE__ */ N("span", {
|
|
60
60
|
className: "min-w-0",
|
|
61
61
|
children: [
|
|
62
62
|
/* @__PURE__ */ N("span", {
|
|
@@ -78,7 +78,7 @@ var L = ".imscc,.zip,application/zip", R = [
|
|
|
78
78
|
]
|
|
79
79
|
})]
|
|
80
80
|
}, `${e.code}-${t}`))
|
|
81
|
-
}),
|
|
81
|
+
}), G = ({ label: e, value: t }) => /* @__PURE__ */ N("div", {
|
|
82
82
|
className: "rounded-lg border border-border-seam bg-bg-sunken px-3 py-2",
|
|
83
83
|
children: [/* @__PURE__ */ M("dt", {
|
|
84
84
|
className: "text-xs text-text-tertiary",
|
|
@@ -87,7 +87,7 @@ var L = ".imscc,.zip,application/zip", R = [
|
|
|
87
87
|
className: "text-lg font-semibold text-text-primary",
|
|
88
88
|
children: t
|
|
89
89
|
})]
|
|
90
|
-
}),
|
|
90
|
+
}), K = ({ preview: t, fileId: n, onReset: i }) => {
|
|
91
91
|
let { navigateTo: a } = e(), o = m(), [s, c] = S(t.title), [l, u] = S(null), d = b(), f = async () => {
|
|
92
92
|
u(null);
|
|
93
93
|
try {
|
|
@@ -96,7 +96,7 @@ var L = ".imscc,.zip,application/zip", R = [
|
|
|
96
96
|
title: s.trim() || void 0
|
|
97
97
|
});
|
|
98
98
|
} catch (e) {
|
|
99
|
-
u(
|
|
99
|
+
u(V(e, "The course could not be imported."));
|
|
100
100
|
}
|
|
101
101
|
}, p = o.data;
|
|
102
102
|
return p ? /* @__PURE__ */ N(F, {
|
|
@@ -161,7 +161,7 @@ var L = ".imscc,.zip,application/zip", R = [
|
|
|
161
161
|
children: [
|
|
162
162
|
t.fileName,
|
|
163
163
|
t.sourceSystem ? ` · exported from ${t.sourceSystem}` : "",
|
|
164
|
-
|
|
164
|
+
` · ${B(t)}`,
|
|
165
165
|
` · ${z(t.stats.byteSize)}`
|
|
166
166
|
]
|
|
167
167
|
})]
|
|
@@ -175,23 +175,23 @@ var L = ".imscc,.zip,application/zip", R = [
|
|
|
175
175
|
/* @__PURE__ */ N("dl", {
|
|
176
176
|
className: "grid grid-cols-2 gap-2 sm:grid-cols-5",
|
|
177
177
|
children: [
|
|
178
|
-
/* @__PURE__ */ M(
|
|
178
|
+
/* @__PURE__ */ M(G, {
|
|
179
179
|
label: "Modules",
|
|
180
180
|
value: t.stats.moduleCount
|
|
181
181
|
}),
|
|
182
|
-
/* @__PURE__ */ M(
|
|
182
|
+
/* @__PURE__ */ M(G, {
|
|
183
183
|
label: "Lessons",
|
|
184
184
|
value: t.stats.lessonCount
|
|
185
185
|
}),
|
|
186
|
-
/* @__PURE__ */ M(
|
|
186
|
+
/* @__PURE__ */ M(G, {
|
|
187
187
|
label: "Quizzes",
|
|
188
188
|
value: t.stats.assessmentCount
|
|
189
189
|
}),
|
|
190
|
-
/* @__PURE__ */ M(
|
|
190
|
+
/* @__PURE__ */ M(G, {
|
|
191
191
|
label: "Questions",
|
|
192
192
|
value: t.stats.questionCount
|
|
193
193
|
}),
|
|
194
|
-
/* @__PURE__ */ M(
|
|
194
|
+
/* @__PURE__ */ M(G, {
|
|
195
195
|
label: "Skipped items",
|
|
196
196
|
value: t.stats.skippedCount
|
|
197
197
|
})
|
|
@@ -234,7 +234,7 @@ var L = ".imscc,.zip,application/zip", R = [
|
|
|
234
234
|
id: `${d}-issues`,
|
|
235
235
|
className: "text-sm font-semibold text-text-primary",
|
|
236
236
|
children: "What will not come across as-is"
|
|
237
|
-
}), /* @__PURE__ */ M(
|
|
237
|
+
}), /* @__PURE__ */ M(W, {
|
|
238
238
|
issues: t.issues,
|
|
239
239
|
emptyText: "Everything in the package can be imported."
|
|
240
240
|
})]
|
|
@@ -275,7 +275,7 @@ var L = ".imscc,.zip,application/zip", R = [
|
|
|
275
275
|
})
|
|
276
276
|
]
|
|
277
277
|
});
|
|
278
|
-
},
|
|
278
|
+
}, q = () => {
|
|
279
279
|
let e = x(null), { upload: t, isUploading: n, progress: r } = u({ visibility: "PRIVATE" }), i = g(), [a, o] = S(null), [s, c] = S(null), l = b(), d = () => {
|
|
280
280
|
o(null), c(null), i.reset(), e.current && (e.current.value = "");
|
|
281
281
|
}, f = async (e) => {
|
|
@@ -286,7 +286,7 @@ var L = ".imscc,.zip,application/zip", R = [
|
|
|
286
286
|
let e = await t(n);
|
|
287
287
|
o(e.fileId), await i.mutateAsync(e.fileId);
|
|
288
288
|
} catch (e) {
|
|
289
|
-
c(
|
|
289
|
+
c(V(e, "The package could not be read."));
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
}, p = n || i.isPending;
|
|
@@ -301,7 +301,7 @@ var L = ".imscc,.zip,application/zip", R = [
|
|
|
301
301
|
children: "Import a course from another LMS"
|
|
302
302
|
}), /* @__PURE__ */ M("p", {
|
|
303
303
|
className: "text-sm text-text-secondary",
|
|
304
|
-
children: "Upload an IMS Common Cartridge (.imscc) package. Pages, links, discussions, assignments and quizzes become a draft course; nothing is published until you choose to."
|
|
304
|
+
children: "Upload an IMS Common Cartridge (.imscc) package or a Moodle course backup (.mbz). Pages, links, discussions, assignments and quizzes become a draft course; nothing is published until you choose to."
|
|
305
305
|
})] }),
|
|
306
306
|
/* @__PURE__ */ M("ul", {
|
|
307
307
|
className: "grid gap-2 sm:grid-cols-2",
|
|
@@ -338,7 +338,7 @@ var L = ".imscc,.zip,application/zip", R = [
|
|
|
338
338
|
children: [/* @__PURE__ */ M(A, {
|
|
339
339
|
"aria-hidden": "true",
|
|
340
340
|
className: "me-1.5 h-4 w-4"
|
|
341
|
-
}), n ? `Uploading… ${r}%` : i.isPending ? "Reading package…" : "Choose a .imscc
|
|
341
|
+
}), n ? `Uploading… ${r}%` : i.isPending ? "Reading package…" : "Choose a .imscc or .mbz file"]
|
|
342
342
|
})
|
|
343
343
|
}),
|
|
344
344
|
/* @__PURE__ */ M("label", {
|
|
@@ -354,19 +354,19 @@ var L = ".imscc,.zip,application/zip", R = [
|
|
|
354
354
|
children: s
|
|
355
355
|
})
|
|
356
356
|
]
|
|
357
|
-
}), i.data && a && /* @__PURE__ */ M(
|
|
357
|
+
}), i.data && a && /* @__PURE__ */ M(K, {
|
|
358
358
|
preview: i.data,
|
|
359
359
|
fileId: a,
|
|
360
360
|
onReset: d
|
|
361
361
|
}, a)]
|
|
362
362
|
});
|
|
363
|
-
},
|
|
363
|
+
}, J = [{
|
|
364
364
|
value: "COMMON_CARTRIDGE",
|
|
365
365
|
label: "IMS Common Cartridge 1.1 (.imscc)"
|
|
366
366
|
}, {
|
|
367
367
|
value: "BUILDMYIQ_JSON",
|
|
368
368
|
label: "BuildMyIQ course JSON (.json)"
|
|
369
|
-
}],
|
|
369
|
+
}], Y = () => {
|
|
370
370
|
let e = l({ limit: 100 }), t = f(), n = p(), [r, i] = S(""), [c, u] = S("COMMON_CARTRIDGE"), [m, h] = S(null), g = b(), x = b(), C = e.data?.items ?? [], w = t.isPending || n.isPending, T = async (e) => {
|
|
371
371
|
if (r) {
|
|
372
372
|
h(null);
|
|
@@ -382,7 +382,7 @@ var L = ".imscc,.zip,application/zip", R = [
|
|
|
382
382
|
} catch (e) {
|
|
383
383
|
h({
|
|
384
384
|
kind: "error",
|
|
385
|
-
text:
|
|
385
|
+
text: V(e, "The export failed.")
|
|
386
386
|
});
|
|
387
387
|
}
|
|
388
388
|
}
|
|
@@ -429,7 +429,7 @@ var L = ".imscc,.zip,application/zip", R = [
|
|
|
429
429
|
id: x,
|
|
430
430
|
value: c,
|
|
431
431
|
onChange: (e) => u(e),
|
|
432
|
-
options:
|
|
432
|
+
options: J
|
|
433
433
|
})
|
|
434
434
|
})]
|
|
435
435
|
}),
|
|
@@ -469,11 +469,11 @@ var L = ".imscc,.zip,application/zip", R = [
|
|
|
469
469
|
})
|
|
470
470
|
]
|
|
471
471
|
});
|
|
472
|
-
},
|
|
472
|
+
}, X = {
|
|
473
473
|
COURSE_IMPORT: "Course import",
|
|
474
474
|
COURSE_EXPORT: "Course export",
|
|
475
475
|
GRADEBOOK_EXPORT: "Gradebook export"
|
|
476
|
-
},
|
|
476
|
+
}, Z = ({ job: e }) => {
|
|
477
477
|
let [t, a] = S(!1), o = b(), s = e.kind === "GRADEBOOK_EXPORT" ? `${e.stats.rowCount} rows` : `${e.stats.moduleCount} modules · ${e.stats.lessonCount} lessons · ${e.stats.assessmentCount} quizzes`;
|
|
478
478
|
return /* @__PURE__ */ N("li", {
|
|
479
479
|
className: "rounded-lg border border-border-seam p-3",
|
|
@@ -486,7 +486,7 @@ var L = ".imscc,.zip,application/zip", R = [
|
|
|
486
486
|
/* @__PURE__ */ N("p", {
|
|
487
487
|
className: "flex flex-wrap items-center gap-2 text-sm font-medium text-text-primary",
|
|
488
488
|
children: [
|
|
489
|
-
|
|
489
|
+
X[e.kind],
|
|
490
490
|
/* @__PURE__ */ M(i, { status: e.status }),
|
|
491
491
|
/* @__PURE__ */ M("span", {
|
|
492
492
|
className: "text-xs font-normal text-text-tertiary",
|
|
@@ -525,10 +525,10 @@ var L = ".imscc,.zip,application/zip", R = [
|
|
|
525
525
|
}), t && /* @__PURE__ */ M("div", {
|
|
526
526
|
id: o,
|
|
527
527
|
className: "mt-3 border-t border-border-seam pt-3",
|
|
528
|
-
children: /* @__PURE__ */ M(
|
|
528
|
+
children: /* @__PURE__ */ M(W, { issues: e.issues })
|
|
529
529
|
})]
|
|
530
530
|
});
|
|
531
|
-
},
|
|
531
|
+
}, Q = () => {
|
|
532
532
|
let [e, t] = S(0), n = h(e);
|
|
533
533
|
if (n.isLoading) return /* @__PURE__ */ M(s, { label: "Loading migration history…" });
|
|
534
534
|
if (n.isError) return /* @__PURE__ */ M(o, {
|
|
@@ -546,7 +546,7 @@ var L = ".imscc,.zip,application/zip", R = [
|
|
|
546
546
|
children: [/* @__PURE__ */ M("ul", {
|
|
547
547
|
className: "flex flex-col gap-2",
|
|
548
548
|
"aria-label": "Migration history",
|
|
549
|
-
children: r.map((e) => /* @__PURE__ */ M(
|
|
549
|
+
children: r.map((e) => /* @__PURE__ */ M(Z, { job: e }, e.id))
|
|
550
550
|
}), /* @__PURE__ */ N("div", {
|
|
551
551
|
className: "flex justify-between",
|
|
552
552
|
children: [/* @__PURE__ */ M(P, {
|
|
@@ -564,7 +564,7 @@ var L = ".imscc,.zip,application/zip", R = [
|
|
|
564
564
|
})]
|
|
565
565
|
})]
|
|
566
566
|
});
|
|
567
|
-
},
|
|
567
|
+
}, $ = () => {
|
|
568
568
|
let [e, n] = S("import");
|
|
569
569
|
return /* @__PURE__ */ M(t, {
|
|
570
570
|
title: "Migration",
|
|
@@ -596,15 +596,15 @@ var L = ".imscc,.zip,application/zip", R = [
|
|
|
596
596
|
role: "tabpanel",
|
|
597
597
|
"aria-label": r(e),
|
|
598
598
|
children: [
|
|
599
|
-
e === "import" && /* @__PURE__ */ M(
|
|
600
|
-
e === "export" && /* @__PURE__ */ M(
|
|
601
|
-
e === "history" && /* @__PURE__ */ M(
|
|
599
|
+
e === "import" && /* @__PURE__ */ M(q, {}),
|
|
600
|
+
e === "export" && /* @__PURE__ */ M(Y, {}),
|
|
601
|
+
e === "history" && /* @__PURE__ */ M(Q, {})
|
|
602
602
|
]
|
|
603
603
|
})]
|
|
604
604
|
})
|
|
605
605
|
});
|
|
606
606
|
};
|
|
607
607
|
//#endregion
|
|
608
|
-
export {
|
|
608
|
+
export { $ as MigrationCenterPage };
|
|
609
609
|
|
|
610
610
|
//# sourceMappingURL=MigrationCenterPage.js.map
|