@powerportalspro/core 5.0.0-beta.3 → 5.0.0

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/routes.ts","../src/errors.ts","../src/transport.ts","../src/auth-client.ts","../src/powerportalspro-client.ts","../src/generated/result-codes.ts","../src/record-id.ts","../src/index.ts"],"names":[],"mappings":";;;AAWA,IAAM,OAAA,GAAU,MAAA;AAChB,IAAM,QAAA,GAAW,GAAG,OAAO,CAAA,KAAA,CAAA;AAC3B,IAAM,UAAA,GAAa,GAAG,QAAQ,CAAA,OAAA,CAAA;AAE9B,IAAM,MAAA,GAAS;AAAA;AAAA,EAEb,WAAA,EAAa,GAAG,OAAO,CAAA,yBAAA,CAAA;AAAA;AAAA,EAGvB,qBAAA,EAAuB,GAAG,OAAO,CAAA,oCAAA,CAAA;AAAA;AAAA,EAGjC,gBAAgB,CAAC,gBAAA,KACf,CAAA,EAAG,OAAO,UAAU,gBAAgB,CAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMtC,gBAAA,EAAkB,CAChB,gBAAA,EACA,QAAA,EACA,OAAA,KACW;AACX,IAAA,MAAM,OAAO,CAAA,EAAG,OAAO,CAAA,OAAA,EAAU,gBAAgB,IAAI,QAAQ,CAAA,CAAA;AAC7D,IAAA,OAAO,OAAA,IAAW,OAAA,CAAQ,MAAA,GAAS,CAAA,GAAI,CAAA,EAAG,IAAI,CAAA,SAAA,EAAY,OAAA,CAAQ,IAAA,CAAK,GAAG,CAAC,CAAA,CAAA,GAAK,IAAA;AAAA,EAClF,CAAA;AAAA;AAAA,EAGA,cAAA,EAAgB,CAAC,gBAAA,EAA0B,QAAA,KACzC,GAAG,OAAO,CAAA,OAAA,EAAU,gBAAgB,CAAA,CAAA,EAAI,QAAQ,CAAA,CAAA;AAAA;AAAA,EAGlD,cAAA,EAAgB,CAAC,gBAAA,EAA0B,QAAA,KACzC,GAAG,OA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,EACvB,QAAA,EAAU,CAAA;AAAA,EACV,iBAAA,EAAmB;AACrB;AAeO,IAAM,sBAAA,GAAyB;AAAA,EACpC,sBAAA,EAAwB,CAAA;AAAA,EACxB,sBAAA,EAAwB;AAC1B;AAMO,IAAM,aAAA,GAAgB;AAAA,EAC3B,IAAA,EAAM,CAAA;AAAA,EACN,cAAA,EAAgB,CAAA;AAAA,EAChB,mBAAA,EAAqB,CAAA;AAAA,EACrB,WAAA,EAAa;AACf;AAQO,IAAM,mBAAA,GAAsB;AAAA,EACjC,OAAA,EAAS,CAAA;AAAA,EACT,qBAAA,EAAuB,CAAA;AAAA,EACvB,eAAA,EAAiB;AACnB;AAQO,IAAM,oBAAA,GAAuB;AAAA,EAClC,QAAA,EAAU,CAAA;AAAA,EACV,aAAA,EAAe,CAAA;AAAA,EACf,mBAAA,EAAqB,CAAA;AAAA,EACrB,gBAAA,EAAkB;AACpB;AAMO,IAAM,uBAAA,GAA0B;AAAA,EACrC,IAAA,EAAM,CAAA;AAAA,EACN,IAAA,EAAM,CAAA;AAAA,EACN,MAAA,EAAQ,CAAA;AAAA,EACR,KAAA,EAAO,CAAA;AAAA,EACP,MAAA,EAAQ,CAAA;AAAA,EACR,MAAA,EAAQ,EAAA;AAAA,EACR,QAAA,EAAU,EAAA;AAAA,EACV,GAAA,EAAK;AACP;;;AC/QA,IAAM,UAAA,GAAa,sCAAA;AAiBZ,SAAS,qBACd,MAAA,EACoB;AACpB,EAAA,IAAI,CAAC,QAAQ,OAAO,MAAA;AACpB,EAAA,IAAI,OAAO,EAAA,IAAM,MAAA,CAAO,EAAA,KAAO,UAAA,SAAmB,MAAA,CAAO,EAAA;AACzD,EAAA,OAAO,OAAO,YAAA,IAAgB,MAAA;AAChC;;;AChCO,IAAM,OAAA,GAAU","file":"index.cjs","sourcesContent":["/**\n * URL builders for the framework's `/api/*` and UI endpoints. Mirrors the C# static\n * `Routes` class in `PowerPortalsPro.Web.Common` so the React side and the Blazor side\n * agree on URL shape without either codebase owning the templates.\n *\n * The C# version uses Pascal-cased property names (`Routes.Api.Auth.Login`); this\n * port uses camelCase per JS convention (`Routes.api.auth.login`). Path-segment\n * encoding matches the C# `Uri.EscapeDataString` calls verbatim — segments that the\n * C# leaves unencoded (table logical names, culture codes) are also unencoded here.\n */\n\nconst apiRoot = '/api';\nconst authRoot = `${apiRoot}/auth`;\nconst manageRoot = `${authRoot}/manage`;\n\nconst tables = {\n /** Template: `/api/table/{tableLogicalName}`. POST creates a record. */\n createRoute: `${apiRoot}/table/{tableLogicalName}`,\n\n /** Template: `/api/table/{tableLogicalName}/{recordId}`. GET reads, PATCH updates, DELETE removes. */\n readUpdateDeleteRoute: `${apiRoot}/table/{tableLogicalName}/{recordId}`,\n\n /** Resolved URL for creating a record of the given table. */\n getCreateRoute: (tableLogicalName: string): string =>\n `${apiRoot}/table/${tableLogicalName}`,\n\n /**\n * Resolved URL for retrieving a specific record, optionally with a column allow-list.\n * @param columns Optional list of column logical names — joined with `,` and sent as `?columns=`.\n */\n getRetrieveRoute: (\n tableLogicalName: string,\n recordId: string,\n columns?: readonly string[],\n ): string => {\n const base = `${apiRoot}/table/${tableLogicalName}/${recordId}`;\n return columns && columns.length > 0 ? `${base}?columns=${columns.join(',')}` : base;\n },\n\n /** Resolved URL for updating a record (PATCH). */\n getUpdateRoute: (tableLogicalName: string, recordId: string): string =>\n `${apiRoot}/table/${tableLogicalName}/${recordId}`,\n\n /** Resolved URL for deleting a record (DELETE). */\n getDeleteRoute: (tableLogicalName: string, recordId: string): string =>\n `${apiRoot}/table/${tableLogicalName}/${recordId}`,\n} as const;\n\nconst manage = {\n /** Base path under which all manage endpoints live (`/api/auth/manage`). */\n root: manageRoot,\n\n /** GET — read first/last/mobile from the linked Dataverse contact + Identity status flags. */\n profile: `${manageRoot}/profile`,\n /** POST — update first/last/mobile on the linked Dataverse contact. */\n updateProfile: `${manageRoot}/profile`,\n\n /** POST — add a local password to an account that doesn't have one. */\n setPassword: `${manageRoot}/password/set`,\n /** POST — change the local password (requires the current password). */\n changePassword: `${manageRoot}/password/change`,\n\n /** POST — start a change-email flow by emailing the new address a confirmation link. */\n changeEmail: `${manageRoot}/email/change`,\n /** POST — re-send the confirmation link to the user's current email. */\n sendEmailConfirmation: `${manageRoot}/email/send-confirmation`,\n\n /** GET — read 2FA status. */\n twoFactorStatus: `${manageRoot}/2fa`,\n /** GET — shared key + otpauth URI for the QR-code enrollment screen. */\n authenticatorSetup: `${manageRoot}/authenticator/setup`,\n /** POST — verify a code from the authenticator app. */\n verifyAuthenticator: `${manageRoot}/authenticator/verify`,\n /** POST — rotate the authenticator key (also disables 2FA). */\n resetAuthenticator: `${manageRoot}/authenticator/reset`,\n /** POST — disable 2FA on the account. */\n disable2fa: `${manageRoot}/2fa/disable`,\n /** POST — regenerate the user's recovery codes. */\n generateRecoveryCodes: `${manageRoot}/2fa/recovery-codes/generate`,\n /** POST — clear this browser's \"trust this device\" 2FA cookie. */\n forget2faClient: `${manageRoot}/2fa/forget-browser`,\n\n /** GET — list the signed-in user's linked external logins + available providers to add. */\n externalLogins: `${manageRoot}/external-logins`,\n /** GET — combined snapshot of sign-in paths (linked external logins + whether a local password exists). */\n loginInfo: `${manageRoot}/login-info`,\n /** GET — kicks off the OAuth flow that links an additional external login. Full-page navigate, do not fetch. */\n linkExternalLogin: `${manageRoot}/external-logins/link`,\n /** GET — OAuth callback target for {@link linkExternalLogin}. */\n linkExternalLoginCallback: `${manageRoot}/external-logins/link/callback`,\n /** POST — remove one external login by provider + key. */\n removeExternalLogin: `${manageRoot}/external-logins/remove`,\n\n /** GET — dump every `[PersonalData]` property + linked external logins. */\n personalData: `${manageRoot}/personal-data`,\n /** POST — permanently delete the user's account. */\n deletePersonalData: `${manageRoot}/personal-data/delete`,\n\n /** Resolved URL for {@link linkExternalLogin} with the provider + return URL pre-encoded. */\n getLinkExternalLoginRoute: (provider: string, returnUrl?: string): string => {\n const query = `?provider=${encodeURIComponent(provider)}`;\n return returnUrl\n ? `${manageRoot}/external-logins/link${query}&returnUrl=${encodeURIComponent(returnUrl)}`\n : `${manageRoot}/external-logins/link${query}`;\n },\n} as const;\n\nconst auth = {\n /** Base path under which all auth endpoints live (`/api/auth`). */\n root: authRoot,\n\n /** POST — submit credentials. */\n login: `${authRoot}/login`,\n /** POST — submit the second-factor code after a Login that returned RequiresTwoFactor. */\n loginTwoFactor: `${authRoot}/login/2fa`,\n /** POST — clear the auth cookie. */\n logout: `${authRoot}/logout`,\n /** POST — create a new user account. */\n register: `${authRoot}/register`,\n /** POST — send a password-reset email. */\n forgotPassword: `${authRoot}/forgot-password`,\n /** POST — complete a password reset with the email-link token. */\n resetPassword: `${authRoot}/reset-password`,\n /** POST — confirm a registered user's email with the email-link token. */\n confirmEmail: `${authRoot}/confirm-email`,\n /** POST — send a fresh confirmation email. */\n resendEmailConfirmation: `${authRoot}/resend-email-confirmation`,\n /** GET — list of configured external (OAuth) login providers. */\n externalProviders: `${authRoot}/external-providers`,\n /** GET — kicks off the OAuth flow for the named external provider. Full-page navigate, do not fetch. */\n externalLogin: `${authRoot}/external-login`,\n /** GET — snapshot the in-flight external-login cookie set by the OAuth callback. */\n externalLoginPending: `${authRoot}/external-login/pending`,\n /** POST — complete an in-flight external login by registering / linking the account. */\n externalLoginConfirm: `${authRoot}/external-login/confirm`,\n /** POST — complete an in-flight external login when the user has chosen between multiple matching identities. */\n externalLoginSelect: `${authRoot}/external-login/select`,\n /** GET — write the chooser's \"remember my choice\" cookie + redirect to `returnUrl`. */\n externalLoginRememberChoice: `${authRoot}/external-login/remember-choice`,\n /** POST — swap the current cookie for the user's alt identity (the contact↔systemuser sibling). */\n switchIdentity: `${authRoot}/switch-identity`,\n /** GET — snapshot of the current user (or anonymous shape). */\n me: `${authRoot}/me`,\n\n /** Account-management endpoints under `/api/auth/manage/*`. */\n manage,\n\n /** Resolved URL for {@link externalLogin} with the provider + return URL pre-encoded. */\n getExternalLoginRoute: (provider: string, returnUrl?: string): string => {\n const query = `?provider=${encodeURIComponent(provider)}`;\n return returnUrl\n ? `${authRoot}/external-login${query}&returnUrl=${encodeURIComponent(returnUrl)}`\n : `${authRoot}/external-login${query}`;\n },\n} as const;\n\nconst api = {\n /** Base path for the API (`/api`). */\n root: apiRoot,\n\n /** Template — POST a FetchXML query to retrieve multiple records. */\n retrieveMultiple: `${apiRoot}/retrieveMultiple`,\n /** Template — GET table metadata. */\n retrieveTableMetadata: `${apiRoot}/tableMetadata/{tableLogicalName}`,\n /** Template — GET view metadata by view id (Guid-constrained route). */\n retrieveViewMetadata: `${apiRoot}/viewMetadata/{viewId}`,\n /** Template — GET every view metadata record for a table. */\n retrieveViewsForTable: `${apiRoot}/viewMetadata/{tableLogicalName}`,\n /** Template — GET localized strings for a culture. */\n retrieveLocalizedStrings: `${apiRoot}/localizedStrings/{culture}`,\n /** Template — POST a batch of OrganizationRequest payloads. */\n executeMultiple: `${apiRoot}/executeMultiple`,\n /** GET — environment-wide file upload settings (blocked extensions, max upload size). */\n environmentFileSettings: `${apiRoot}/environmentFileSettings`,\n /** POST — clear all server-side caches. SystemAdmin-only. */\n clearAllCaches: `${apiRoot}/caches/clear`,\n /** GET — every server-side cache name. SystemAdmin-only. */\n cacheNames: `${apiRoot}/caches`,\n /** Template — POST to clear a single named cache. SystemAdmin-only. */\n clearCache: `${apiRoot}/caches/{cacheName}/clear`,\n /** Template — GET file metadata + (optionally) content for one record/column. */\n retrieveFileInfo: `${apiRoot}/files/{tableLogicalName}/{recordId}/{columnName}`,\n /** Template — POST record ids; returns file info + content for many records of one column. */\n retrieveFilesBatch: `${apiRoot}/files/{tableLogicalName}/{columnName}/batch`,\n /**\n * POST — builds an archive containing the file payload of every supplied\n * record id for the named table/column. Server returns the binary archive\n * bytes (default) or a JSON envelope when `responseFormat` is `Json`.\n */\n createFileArchive: `${apiRoot}/files/createFileArchive`,\n\n /** Resolved URL for retrieving multiple records via FetchXML. */\n getRetrieveMultipleRoute: (fetchXml: string): string =>\n `${apiRoot}/retrieveMultiple?fetchXml=${encodeURIComponent(fetchXml)}`,\n\n /**\n * Template — POST a GridDataRequest (viewId / fetchXml input modes,\n * searchText, sorts, paging, filters) and get back a shaped\n * GridDataResponse. Server-side IGridService builds the FetchXML via\n * the shared IFetchXmlQueryComposer and runs the query so the client\n * never composes FetchXML directly.\n */\n gridData: `${apiRoot}/grids/data`,\n\n /**\n * Template — POST a ChartDataRequest (Aggregate / ViewId / FetchXml\n * input modes) and get back a shaped ChartDataResponse. Server-side\n * IChartService builds the FetchXML and runs the query so the\n * client never composes FetchXML directly.\n */\n chartData: `${apiRoot}/charts/data`,\n\n /** Resolved URL for retrieving metadata for one view. */\n getRetrieveViewMetadataRoute: (viewId: string): string =>\n `${apiRoot}/viewMetadata/${viewId}`,\n\n /** Resolved URL for retrieving every view metadata record for a table. */\n getRetrieveViewsForTableRoute: (tableLogicalName: string): string =>\n `${apiRoot}/viewMetadata/${encodeURIComponent(tableLogicalName)}`,\n\n /** Resolved URL for retrieving metadata for one table. Mirrors C# behavior of not encoding the segment. */\n getRetrieveTableMetadataRoute: (tableLogicalName: string): string =>\n `${apiRoot}/tableMetadata/${tableLogicalName}`,\n\n /**\n * Resolved URL for retrieving the current user's combined\n * `TableSecurityPermission` mask for a single table. Mirrors the\n * server-side `ITablePermissionCache.GetPermissionForUserAsync` lookup\n * the Blazor grid buttons already use via DI — exposed so the React\n * client can read the same answer without firing a grid query.\n * `GridDataResponse.tablePermissions` carries the same value when a\n * grid query happens to be in flight; this endpoint covers the other\n * cases (custom toolbars, conditional UI elsewhere on the page).\n */\n getRetrieveTablePermissionsRoute: (tableLogicalName: string): string =>\n `${apiRoot}/permissions/table/${tableLogicalName}`,\n\n /** Resolved URL for retrieving localized strings for a culture. */\n getRetrieveLocalizedStringsRoute: (culture: string): string =>\n `${apiRoot}/localizedStrings/${culture}`,\n\n /** Resolved URL for the localization-bundle manifest endpoint (version + supported locales). */\n getLocalizationBundleManifestRoute: (): string => `/localizations/version`,\n\n /**\n * Resolved URL for the per-locale thumbprints endpoint. Returns the\n * content-derived thumbprint for the default bundle plus every loaded\n * table / view at the requested locale. Mirrors C#\n * `Routes.Localizations.GetThumbprintsRoute`.\n */\n getLocalizationThumbprintsRoute: (locale: string): string =>\n `/localizations/${encodeURIComponent(locale)}/thumbprints`,\n\n /**\n * Resolved URL for the default localization-bundle file (everything outside\n * `tables.*` / `choices.*`) for a given locale + thumbprint. The thumbprint\n * is purely for cache-busting — the server returns the current bundle for\n * the locale regardless of what thumbprint is in the URL. Mirrors C#\n * `Routes.Localizations.GetDefaultBundleRoute`.\n */\n getLocalizationBundleRoute: (locale: string, thumbprint: string): string =>\n `/localizations/default/${locale}.${thumbprint}.json`,\n\n /**\n * Resolved URL for the per-table localization-bundle file. Returns every\n * `tables.{name}.*` string for the table plus the global `choices.*`\n * strings any of its columns reference. Mirrors C#\n * `Routes.Localizations.GetTableBundleRoute`.\n */\n getLocalizationTableBundleRoute: (\n tableName: string,\n locale: string,\n thumbprint: string,\n ): string =>\n `/localizations/tables/${encodeURIComponent(tableName)}/${locale}.${thumbprint}.json`,\n\n /**\n * Resolved URL for the per-view localization-bundle file. Returns every\n * `tables.{owningTable}.views.{viewId}.*` string. Owning table is resolved\n * server-side from the view id. Mirrors C# `Routes.Localizations.GetViewBundleRoute`.\n */\n getLocalizationViewBundleRoute: (\n viewId: string,\n locale: string,\n thumbprint: string,\n ): string =>\n `/localizations/views/${viewId}/${locale}.${thumbprint}.json`,\n\n /** Resolved URL for executing multiple requests. */\n getExecuteMultipleRoute: (returnResponses: boolean): string =>\n `${apiRoot}/executeMultiple?returnResponses=${returnResponses}`,\n\n /** Resolved URL for retrieving file info on one record/column. */\n getRetrieveFileInfoRoute: (\n tableLogicalName: string,\n recordId: string,\n columnName: string,\n includeData: boolean,\n ): string =>\n `${apiRoot}/files/${encodeURIComponent(tableLogicalName)}/${recordId}/${encodeURIComponent(columnName)}?includeData=${includeData}`,\n\n /** Resolved URL for the batch retrieve-files endpoint. Body is a JSON array of record ids. */\n getRetrieveFilesBatchRoute: (\n tableLogicalName: string,\n columnName: string,\n includeData: boolean,\n ): string =>\n `${apiRoot}/files/${encodeURIComponent(tableLogicalName)}/${encodeURIComponent(columnName)}/batch?includeData=${includeData}`,\n\n /** Resolved URL for clearing one named cache. */\n getClearCacheRoute: (cacheName: string): string =>\n `${apiRoot}/caches/${encodeURIComponent(cacheName)}/clear`,\n\n /** Table-scoped CRUD routes. */\n tables,\n\n /** SPA-facing authentication endpoints. */\n auth,\n} as const;\n\nconst ui = {\n localization: {\n /** Template — POST to set the culture cookie + redirect. */\n culture: 'Culture/{culture}',\n\n /** Resolved URL for setting the culture cookie. Mirrors C# behavior of not encoding either segment. */\n getCultureRoute: (culture: string, returnUrl: string): string =>\n `Culture/${culture}?redirectUri=${returnUrl}`,\n },\n} as const;\n\n/**\n * Static accessors for the framework's API and UI route groups. Mirrors the C#\n * `Routes` class — `Routes.api.auth.login` corresponds to `Routes.Api.Auth.Login`.\n */\nexport const Routes = {\n api,\n ui,\n} as const;\n","/**\r\n * Mirrors the C# `ProblemDetailsExceptionHandler` contract: SPA callers receive an\r\n * RFC 9457 `application/problem+json` body whose `exceptionType` extension carries\r\n * the original CLR type's full name. The transport rehydrates that into one of the\r\n * subclasses below so consumers can pattern-match on `instanceof` instead of on\r\n * an opaque HTTP error.\r\n */\r\nexport interface ProblemDetails {\r\n type: string | undefined;\r\n title: string | undefined;\r\n status: number | undefined;\r\n detail: string | undefined;\r\n instance: string | undefined;\r\n /** The original CLR exception's `Type.FullName` (e.g. `System.UnauthorizedAccessException`). */\r\n exceptionType: string | undefined;\r\n [extensionMember: string]: unknown;\r\n}\r\n\r\nexport interface PowerPortalsProErrorInit {\r\n status: number;\r\n url: string | undefined;\r\n title: string | undefined;\r\n detail: string | undefined;\r\n /** The original CLR exception's `Type.FullName` from the server. */\r\n clrType: string | undefined;\r\n /** The full problem+json body as received, when available. */\r\n problem: ProblemDetails | undefined;\r\n}\r\n\r\n/**\r\n * Base error thrown by `Transport` for every non-2xx response. Subclasses\r\n * (`UnauthorizedAccessError`, `ArgumentError`, `ArgumentNullError`,\r\n * `InvalidOperationError`) are constructed when the server's `exceptionType`\r\n * extension matches a known CLR type, mirroring the in-process Blazor experience.\r\n */\r\nexport class PowerPortalsProError extends Error {\r\n readonly status: number;\r\n readonly url: string | undefined;\r\n readonly title: string | undefined;\r\n readonly detail: string | undefined;\r\n readonly clrType: string | undefined;\r\n readonly problem: ProblemDetails | undefined;\r\n\r\n constructor(message: string, init: PowerPortalsProErrorInit) {\r\n super(message);\r\n this.name = 'PowerPortalsProError';\r\n this.status = init.status;\r\n this.url = init.url;\r\n this.title = init.title;\r\n this.detail = init.detail;\r\n this.clrType = init.clrType;\r\n this.problem = init.problem;\r\n }\r\n}\r\n\r\nexport class UnauthorizedAccessError extends PowerPortalsProError {\r\n constructor(message: string, init: PowerPortalsProErrorInit) {\r\n super(message, init);\r\n this.name = 'UnauthorizedAccessError';\r\n }\r\n}\r\n\r\nexport class ArgumentError extends PowerPortalsProError {\r\n constructor(message: string, init: PowerPortalsProErrorInit) {\r\n super(message, init);\r\n this.name = 'ArgumentError';\r\n }\r\n}\r\n\r\nexport class ArgumentNullError extends ArgumentError {\r\n constructor(message: string, init: PowerPortalsProErrorInit) {\r\n super(message, init);\r\n this.name = 'ArgumentNullError';\r\n }\r\n}\r\n\r\nexport class InvalidOperationError extends PowerPortalsProError {\r\n constructor(message: string, init: PowerPortalsProErrorInit) {\r\n super(message, init);\r\n this.name = 'InvalidOperationError';\r\n }\r\n}\r\n\r\n/**\r\n * Builds the right `PowerPortalsProError` subclass for a problem+json response.\r\n * Mirrors the C# `MapExceptionType` switch in `PowerPortalsProService`.\r\n */\r\nexport function mapProblemDetails(\r\n problem: ProblemDetails,\r\n fallbackStatus: number,\r\n url: string | undefined,\r\n): PowerPortalsProError {\r\n const message =\r\n problem.detail\r\n ?? problem.title\r\n ?? `${problem.status ?? fallbackStatus} ${problem.title ?? 'HTTP error'}${url ? ` on ${url}` : ''}`;\r\n\r\n const init: PowerPortalsProErrorInit = {\r\n status: problem.status ?? fallbackStatus,\r\n url,\r\n title: problem.title,\r\n detail: problem.detail,\r\n clrType: problem.exceptionType,\r\n problem,\r\n };\r\n\r\n switch (problem.exceptionType) {\r\n case 'System.UnauthorizedAccessException':\r\n return new UnauthorizedAccessError(message, init);\r\n case 'System.ArgumentNullException':\r\n return new ArgumentNullError(message, init);\r\n case 'System.ArgumentException':\r\n return new ArgumentError(message, init);\r\n case 'System.InvalidOperationException':\r\n return new InvalidOperationError(message, init);\r\n default:\r\n return new PowerPortalsProError(message, init);\r\n }\r\n}\r\n","import {\r\n type ProblemDetails,\r\n PowerPortalsProError,\r\n mapProblemDetails,\r\n} from './errors.js';\r\n\r\n/**\r\n * Configuration for {@link Transport}. Most consumers leave the defaults: same-origin\r\n * fetch with the auth cookie included.\r\n */\r\nexport interface TransportOptions {\r\n /**\r\n * Base URL prepended to every request path. Defaults to the empty string, which\r\n * sends requests relative to the current origin (the typical case when the React\r\n * app is served by the same ASP.NET host that backs `/api/*`). Set this only when\r\n * the API lives on a different origin — and configure CORS on the server to allow\r\n * `Access-Control-Allow-Credentials: true` so the auth cookie survives.\r\n */\r\n baseUrl?: string;\r\n\r\n /**\r\n * `fetch` implementation to use. Defaults to `globalThis.fetch`. Override for tests\r\n * or for environments that need a polyfill.\r\n */\r\n fetchImpl?: typeof fetch;\r\n}\r\n\r\n/**\r\n * Per-request options accepted by {@link Transport.send} / {@link Transport.sendJson}.\r\n */\r\nexport interface RequestOptions {\r\n /** JSON-serializable request body. Omit for GET / DELETE / no-body POST. */\r\n body?: unknown;\r\n\r\n /** AbortSignal to cancel the request. */\r\n signal?: AbortSignal;\r\n\r\n /** Extra request headers, merged onto the default `Content-Type: application/json` (when a body is present). */\r\n headers?: Record<string, string>;\r\n}\r\n\r\n/**\r\n * Thin `fetch` wrapper that owns the cross-cutting concerns the C# `HttpClient`-based\r\n * `PowerPortalsProService` handles for Blazor:\r\n *\r\n * 1. **Cookie auth.** Always sends `credentials: 'include'` so the ASP.NET Identity\r\n * cookie reaches `/api/*`, mirroring the Blazor WASM `CookieCredentialsHandler`.\r\n * 2. **JSON in / out.** Serializes the body as JSON (when present) and parses the\r\n * response as JSON. Sets the `Content-Type` and `Accept` headers accordingly.\r\n * 3. **Typed-error rehydration.** On non-2xx responses with `application/problem+json`,\r\n * maps the body's `exceptionType` extension to the matching\r\n * {@link PowerPortalsProError} subclass — `UnauthorizedAccessError`,\r\n * `ArgumentError`, `ArgumentNullError`, `InvalidOperationError`, or the base type\r\n * for unrecognized CLR exceptions. Non-problem-json failures throw the base type\r\n * with the raw response text as the detail.\r\n *\r\n * `Transport` is an implementation detail of the higher-level clients\r\n * (`AuthClient`, etc.) and is rarely consumed directly. It's exported so advanced\r\n * consumers can issue raw requests against endpoints not yet wrapped by a typed client.\r\n */\r\nexport class Transport {\r\n private readonly baseUrl: string;\r\n private readonly fetchImpl: typeof fetch;\r\n\r\n constructor(options: TransportOptions = {}) {\r\n this.baseUrl = (options.baseUrl ?? '').replace(/\\/+$/, '');\r\n this.fetchImpl = options.fetchImpl ?? globalThis.fetch.bind(globalThis);\r\n }\r\n\r\n /** Sends a request and returns the parsed JSON response body. */\r\n async sendJson<T>(method: string, path: string, options: RequestOptions = {}): Promise<T> {\r\n const response = await this.send(method, path, options);\r\n return (await response.json()) as T;\r\n }\r\n\r\n /**\r\n * Sends a request that may return 204 No Content. Returns `null` for the empty case\r\n * so the caller can branch without inspecting status codes.\r\n */\r\n async sendNullableJson<T>(method: string, path: string, options: RequestOptions = {}): Promise<T | null> {\r\n const response = await this.send(method, path, options);\r\n if (response.status === 204) return null;\r\n const text = await response.text();\r\n if (text.length === 0) return null;\r\n return JSON.parse(text) as T;\r\n }\r\n\r\n /** Sends a request and discards the response body. */\r\n async sendVoid(method: string, path: string, options: RequestOptions = {}): Promise<void> {\r\n const response = await this.send(method, path, options);\r\n // Drain the body so connection pooling can reuse the socket. Cheap; ignore content.\r\n await response.arrayBuffer().catch(() => undefined);\r\n }\r\n\r\n /**\r\n * Low-level send. Throws `PowerPortalsProError` (or a subclass) on non-2xx. Most\r\n * callers should use {@link sendJson}, {@link sendNullableJson}, or {@link sendVoid}.\r\n */\r\n async send(method: string, path: string, options: RequestOptions = {}): Promise<Response> {\r\n const url = this.baseUrl + path;\r\n const hasBody = options.body !== undefined;\r\n\r\n const headers: Record<string, string> = {\r\n Accept: 'application/json',\r\n ...(hasBody ? { 'Content-Type': 'application/json' } : {}),\r\n ...(options.headers ?? {}),\r\n };\r\n\r\n const init: RequestInit = {\r\n method,\r\n credentials: 'include',\r\n headers,\r\n ...(hasBody ? { body: JSON.stringify(options.body) } : {}),\r\n ...(options.signal ? { signal: options.signal } : {}),\r\n };\r\n\r\n const response = await this.fetchImpl(url, init);\r\n if (response.ok) return response;\r\n throw await this.errorFromResponse(response, url);\r\n }\r\n\r\n private async errorFromResponse(response: Response, url: string): Promise<PowerPortalsProError> {\r\n const contentType = response.headers.get('Content-Type') ?? '';\r\n if (contentType.toLowerCase().includes('application/problem+json')) {\r\n try {\r\n const problem = (await response.json()) as ProblemDetails;\r\n return mapProblemDetails(problem, response.status, url);\r\n } catch {\r\n // Body wasn't valid JSON — fall through to the generic shape below.\r\n }\r\n }\r\n\r\n let detail: string | undefined;\r\n try {\r\n const text = await response.text();\r\n if (text.length > 0) detail = text;\r\n } catch {\r\n // Body already consumed or unreadable; leave detail unset.\r\n }\r\n\r\n return new PowerPortalsProError(\r\n `${response.status} ${response.statusText} on ${url}`,\r\n {\r\n status: response.status,\r\n url,\r\n title: response.statusText,\r\n detail,\r\n clrType: undefined,\r\n problem: undefined,\r\n },\r\n );\r\n }\r\n}\r\n","import type { components } from './generated/api-schema.js';\r\nimport { Routes } from './routes.js';\r\nimport { Transport, type TransportOptions } from './transport.js';\r\n\r\ntype Schemas = components['schemas'];\r\n\r\n// Auth-flow request/response DTOs are pulled from the generated schema so\r\n// consumers see exactly the shape the server produces. Keep this list aligned\r\n// with the methods on AuthClient — adding a new method here means adding a\r\n// matching alias.\r\n\r\n// Login + registration\r\nexport type LoginRequest = Schemas['LoginRequest'];\r\nexport type LoginResponse = Schemas['LoginResponse'];\r\nexport type VerifyTwoFactorRequest = Schemas['VerifyTwoFactorRequest'];\r\nexport type VerifyTwoFactorResponse = Schemas['VerifyTwoFactorResponse'];\r\nexport type RegisterRequest = Schemas['RegisterRequest'];\r\nexport type RegisterResponse = Schemas['RegisterResponse'];\r\nexport type RequestPasswordResetRequest = Schemas['RequestPasswordResetRequest'];\r\nexport type ResetPasswordRequest = Schemas['ResetPasswordRequest'];\r\nexport type ResetPasswordResponse = Schemas['ResetPasswordResponse'];\r\nexport type ConfirmEmailRequest = Schemas['ConfirmEmailRequest'];\r\nexport type ConfirmEmailResponse = Schemas['ConfirmEmailResponse'];\r\nexport type ResendEmailConfirmationRequest = Schemas['ResendEmailConfirmationRequest'];\r\n\r\n// Session / external providers / current user\r\nexport type CurrentUserInfo = Schemas['CurrentUserInfo'];\r\nexport type ExternalLoginProviderInfo = Schemas['ExternalLoginProviderInfo'];\r\n\r\n// External login flow\r\nexport type PendingExternalLoginResponse = Schemas['PendingExternalLoginResponse'];\r\nexport type ConfirmExternalLoginRequest = Schemas['ConfirmExternalLoginRequest'];\r\nexport type ConfirmExternalLoginResponse = Schemas['ConfirmExternalLoginResponse'];\r\nexport type SelectExternalLoginRequest = Schemas['SelectExternalLoginRequest'];\r\nexport type SwitchIdentityResponse = Schemas['SwitchIdentityResponse'];\r\n\r\n// Profile + password + email\r\nexport type ProfileResponse = Schemas['ProfileResponse'];\r\nexport type UpdateProfileRequest = Schemas['UpdateProfileRequest'];\r\nexport type SetPasswordRequest = Schemas['SetPasswordRequest'];\r\nexport type SetPasswordResponse = Schemas['SetPasswordResponse'];\r\nexport type ChangePasswordRequest = Schemas['ChangePasswordRequest'];\r\nexport type ChangePasswordResponse = Schemas['ChangePasswordResponse'];\r\nexport type ChangeEmailRequest = Schemas['ChangeEmailRequest'];\r\nexport type ChangeEmailResponse = Schemas['ChangeEmailResponse'];\r\nexport type SendEmailConfirmationResponse = Schemas['SendEmailConfirmationResponse'];\r\n\r\n// 2FA management\r\nexport type TwoFactorStatusResponse = Schemas['TwoFactorStatusResponse'];\r\nexport type AuthenticatorSetupResponse = Schemas['AuthenticatorSetupResponse'];\r\nexport type VerifyAuthenticatorRequest = Schemas['VerifyAuthenticatorRequest'];\r\nexport type VerifyAuthenticatorResponse = Schemas['VerifyAuthenticatorResponse'];\r\nexport type ResetAuthenticatorResponse = Schemas['ResetAuthenticatorResponse'];\r\nexport type Disable2faResponse = Schemas['Disable2faResponse'];\r\nexport type RecoveryCodesResponse = Schemas['RecoveryCodesResponse'];\r\nexport type Forget2faResponse = Schemas['Forget2faResponse'];\r\n\r\n// External logins management\r\nexport type ExternalLoginsResponse = Schemas['ExternalLoginsResponse'];\r\nexport type CurrentLoginInfo = Schemas['CurrentLoginInfo'];\r\nexport type RemoveExternalLoginRequest = Schemas['RemoveExternalLoginRequest'];\r\nexport type RemoveExternalLoginResponse = Schemas['RemoveExternalLoginResponse'];\r\n\r\n// Personal data\r\nexport type PersonalDataResponse = Schemas['PersonalDataResponse'];\r\nexport type DeletePersonalDataRequest = Schemas['DeletePersonalDataRequest'];\r\nexport type DeletePersonalDataResponse = Schemas['DeletePersonalDataResponse'];\r\n\r\n// Helper for the body+signal envelope passed to Transport.send*. Single source of\r\n// truth for the \"optional body / optional cancellation\" pattern repeated by every\r\n// method below — keeps the call sites readable and avoids the verbose conditional\r\n// spread that exactOptionalPropertyTypes requires.\r\nfunction bodyAndSignal(body: unknown, signal: AbortSignal | undefined) {\r\n return {\r\n ...(body !== undefined ? { body } : {}),\r\n ...(signal ? { signal } : {}),\r\n };\r\n}\r\n\r\n/**\r\n * SPA-facing wrapper over the framework's `/api/auth/*` endpoints — the React equivalent\r\n * of `IAuthService` from `PowerPortalsPro.Web.Common.Auth`. Method names mirror the C#\r\n * interface so a Blazor dev reading both sides finds the same vocabulary.\r\n *\r\n * Cookie auth flows automatically (the underlying {@link Transport} sends\r\n * `credentials: 'include'`), so a successful `loginAsync` leaves subsequent calls\r\n * authenticated without any token wiring on the React side.\r\n *\r\n * Mid-flow steps (`login → 2FA`, `register → confirm email`, `forgot → reset`) each\r\n * surface as their own method so the consuming SPA owns its routing/UX between steps —\r\n * same design as the C# interface.\r\n */\r\nexport class AuthClient {\r\n /**\r\n * The underlying transport. Exposed so advanced consumers can hit auth endpoints not\r\n * yet wrapped by a typed method, or share a single transport with a sibling\r\n * {@link PowerPortalsProClient}.\r\n */\r\n readonly transport: Transport;\r\n\r\n constructor(transportOrOptions?: Transport | TransportOptions) {\r\n this.transport =\r\n transportOrOptions instanceof Transport\r\n ? transportOrOptions\r\n : new Transport(transportOrOptions);\r\n }\r\n\r\n // --- Login + 2FA + logout --------------------------------------------------------\r\n\r\n /**\r\n * Submits credentials. On success the auth cookie is set and the next\r\n * {@link getCurrentUserAsync} will report the user as signed in. The returned\r\n * `result` enum tells the caller whether to navigate (Success), prompt for 2FA\r\n * (RequiresTwoFactor), or show a generic error (others).\r\n */\r\n loginAsync(request: LoginRequest, signal?: AbortSignal): Promise<LoginResponse> {\r\n return this.transport.sendJson<LoginResponse>('POST', Routes.api.auth.login, bodyAndSignal(request, signal));\r\n }\r\n\r\n /** Submits the 2FA code after a {@link loginAsync} that returned `RequiresTwoFactor`. */\r\n verifyTwoFactorAsync(request: VerifyTwoFactorRequest, signal?: AbortSignal): Promise<VerifyTwoFactorResponse> {\r\n return this.transport.sendJson<VerifyTwoFactorResponse>('POST', Routes.api.auth.loginTwoFactor, bodyAndSignal(request, signal));\r\n }\r\n\r\n /** Clears the auth cookie. Idempotent — calling on an already-anonymous session is a no-op. */\r\n logoutAsync(signal?: AbortSignal): Promise<void> {\r\n return this.transport.sendVoid('POST', Routes.api.auth.logout, bodyAndSignal(undefined, signal));\r\n }\r\n\r\n // --- Registration + email confirmation -------------------------------------------\r\n\r\n /**\r\n * Creates a new user. When the host configured `RequireConfirmedAccount` (the default),\r\n * the response carries `RegisterResult.ConfirmationEmailSent` and the user is NOT\r\n * signed in yet — the client should surface \"check your email.\"\r\n */\r\n registerAsync(request: RegisterRequest, signal?: AbortSignal): Promise<RegisterResponse> {\r\n return this.transport.sendJson<RegisterResponse>('POST', Routes.api.auth.register, bodyAndSignal(request, signal));\r\n }\r\n\r\n /** Confirms a registered email via the registration-link token. */\r\n confirmEmailAsync(request: ConfirmEmailRequest, signal?: AbortSignal): Promise<ConfirmEmailResponse> {\r\n return this.transport.sendJson<ConfirmEmailResponse>('POST', Routes.api.auth.confirmEmail, bodyAndSignal(request, signal));\r\n }\r\n\r\n /** Sends a fresh confirmation email. Always 200 — the server doesn't reveal whether the email exists. */\r\n resendEmailConfirmationAsync(request: ResendEmailConfirmationRequest, signal?: AbortSignal): Promise<void> {\r\n return this.transport.sendVoid('POST', Routes.api.auth.resendEmailConfirmation, bodyAndSignal(request, signal));\r\n }\r\n\r\n // --- Password reset --------------------------------------------------------------\r\n\r\n /** Requests a password-reset email. Always 200 — no enumeration. */\r\n requestPasswordResetAsync(request: RequestPasswordResetRequest, signal?: AbortSignal): Promise<void> {\r\n return this.transport.sendVoid('POST', Routes.api.auth.forgotPassword, bodyAndSignal(request, signal));\r\n }\r\n\r\n /** Completes a password reset using the token from the reset email link. */\r\n resetPasswordAsync(request: ResetPasswordRequest, signal?: AbortSignal): Promise<ResetPasswordResponse> {\r\n return this.transport.sendJson<ResetPasswordResponse>('POST', Routes.api.auth.resetPassword, bodyAndSignal(request, signal));\r\n }\r\n\r\n // --- Session ---------------------------------------------------------------------\r\n\r\n /**\r\n * Snapshot of the current user. Anonymous requests get a non-null `CurrentUserInfo`\r\n * with `isAuthenticated: false` and the rest of the fields empty — call this on app\r\n * startup to decide whether to render signed-in UI vs. the login flow.\r\n */\r\n getCurrentUserAsync(signal?: AbortSignal): Promise<CurrentUserInfo> {\r\n return this.transport.sendJson<CurrentUserInfo>('GET', Routes.api.auth.me, bodyAndSignal(undefined, signal));\r\n }\r\n\r\n /** Lists the configured external (OAuth) login providers (Microsoft, Google, …). */\r\n getExternalLoginProvidersAsync(signal?: AbortSignal): Promise<readonly ExternalLoginProviderInfo[]> {\r\n return this.transport.sendJson<readonly ExternalLoginProviderInfo[]>(\r\n 'GET', Routes.api.auth.externalProviders, bodyAndSignal(undefined, signal),\r\n );\r\n }\r\n\r\n // --- External login flow ---------------------------------------------------------\r\n\r\n /**\r\n * Reads the in-flight external-login cookie set by an OAuth callback. Returns\r\n * `null` when no callback is in flight (the endpoint replies 204) — the client\r\n * should redirect back to login in that case.\r\n */\r\n getPendingExternalLoginAsync(signal?: AbortSignal): Promise<PendingExternalLoginResponse | null> {\r\n return this.transport.sendNullableJson<PendingExternalLoginResponse>(\r\n 'GET', Routes.api.auth.externalLoginPending, bodyAndSignal(undefined, signal),\r\n );\r\n }\r\n\r\n /**\r\n * Completes an in-flight external login: registers a new local account (or links\r\n * the external login to an existing account with the same email) and signs the\r\n * user in.\r\n */\r\n confirmExternalLoginAsync(request: ConfirmExternalLoginRequest, signal?: AbortSignal): Promise<ConfirmExternalLoginResponse> {\r\n return this.transport.sendJson<ConfirmExternalLoginResponse>(\r\n 'POST', Routes.api.auth.externalLoginConfirm, bodyAndSignal(request, signal),\r\n );\r\n }\r\n\r\n /**\r\n * Completes an in-flight external login when the OAuth identity matched more than\r\n * one portal user (typically a `systemuser` AND a `contact`). Body carries only\r\n * the `ExternalLoginCandidateKind` the user picked from the chooser; the server\r\n * re-resolves the underlying record so a malicious caller can't supply an arbitrary id.\r\n */\r\n selectExternalLoginAsync(request: SelectExternalLoginRequest, signal?: AbortSignal): Promise<ConfirmExternalLoginResponse> {\r\n return this.transport.sendJson<ConfirmExternalLoginResponse>(\r\n 'POST', Routes.api.auth.externalLoginSelect, bodyAndSignal(request, signal),\r\n );\r\n }\r\n\r\n /**\r\n * Swaps the current auth cookie for the user's alt identity (the contact↔systemuser\r\n * sibling). The alt id is read from the cookie's claims server-side, so the client\r\n * supplies no parameters.\r\n */\r\n switchIdentityAsync(signal?: AbortSignal): Promise<SwitchIdentityResponse> {\r\n return this.transport.sendJson<SwitchIdentityResponse>(\r\n 'POST', Routes.api.auth.switchIdentity, bodyAndSignal(undefined, signal),\r\n );\r\n }\r\n\r\n // --- Profile ---------------------------------------------------------------------\r\n\r\n /** Reads the signed-in user's manage-profile snapshot (Identity status + linked contact fields). */\r\n getProfileAsync(signal?: AbortSignal): Promise<ProfileResponse> {\r\n return this.transport.sendJson<ProfileResponse>('GET', Routes.api.auth.manage.profile, bodyAndSignal(undefined, signal));\r\n }\r\n\r\n /** Updates first/last/mobile on the signed-in user's linked Dataverse contact. */\r\n updateProfileAsync(request: UpdateProfileRequest, signal?: AbortSignal): Promise<void> {\r\n return this.transport.sendVoid('POST', Routes.api.auth.manage.updateProfile, bodyAndSignal(request, signal));\r\n }\r\n\r\n // --- Password (set + change) -----------------------------------------------------\r\n\r\n /** Adds a local password to an account that doesn't have one (typically external-login-only). */\r\n setPasswordAsync(request: SetPasswordRequest, signal?: AbortSignal): Promise<SetPasswordResponse> {\r\n return this.transport.sendJson<SetPasswordResponse>('POST', Routes.api.auth.manage.setPassword, bodyAndSignal(request, signal));\r\n }\r\n\r\n /**\r\n * Changes the local password (requires the current password). On success the auth\r\n * cookie is refreshed so other sessions are invalidated by the security stamp rotation.\r\n */\r\n changePasswordAsync(request: ChangePasswordRequest, signal?: AbortSignal): Promise<ChangePasswordResponse> {\r\n return this.transport.sendJson<ChangePasswordResponse>(\r\n 'POST', Routes.api.auth.manage.changePassword, bodyAndSignal(request, signal),\r\n );\r\n }\r\n\r\n // --- Email (change + resend confirmation) ----------------------------------------\r\n\r\n /** Starts a change-email flow by sending a confirmation link to the new address. */\r\n changeEmailAsync(request: ChangeEmailRequest, signal?: AbortSignal): Promise<ChangeEmailResponse> {\r\n return this.transport.sendJson<ChangeEmailResponse>('POST', Routes.api.auth.manage.changeEmail, bodyAndSignal(request, signal));\r\n }\r\n\r\n /** Re-sends the confirmation link to the user's current (unconfirmed) email. */\r\n sendEmailConfirmationAsync(signal?: AbortSignal): Promise<SendEmailConfirmationResponse> {\r\n return this.transport.sendJson<SendEmailConfirmationResponse>(\r\n 'POST', Routes.api.auth.manage.sendEmailConfirmation, bodyAndSignal(undefined, signal),\r\n );\r\n }\r\n\r\n // --- 2FA management --------------------------------------------------------------\r\n\r\n /** Reads the user's two-factor configuration snapshot (enabled, has authenticator, recovery codes left). */\r\n getTwoFactorStatusAsync(signal?: AbortSignal): Promise<TwoFactorStatusResponse> {\r\n return this.transport.sendJson<TwoFactorStatusResponse>(\r\n 'GET', Routes.api.auth.manage.twoFactorStatus, bodyAndSignal(undefined, signal),\r\n );\r\n }\r\n\r\n /** Reads (and creates if missing) the authenticator key + QR-code URI for TOTP enrollment. */\r\n getAuthenticatorSetupAsync(signal?: AbortSignal): Promise<AuthenticatorSetupResponse> {\r\n return this.transport.sendJson<AuthenticatorSetupResponse>(\r\n 'GET', Routes.api.auth.manage.authenticatorSetup, bodyAndSignal(undefined, signal),\r\n );\r\n }\r\n\r\n /**\r\n * Verifies a code from the authenticator app to finish enabling 2FA. On success and\r\n * when the user has zero existing recovery codes, a fresh batch is returned in\r\n * `recoveryCodes`.\r\n */\r\n verifyAuthenticatorAsync(request: VerifyAuthenticatorRequest, signal?: AbortSignal): Promise<VerifyAuthenticatorResponse> {\r\n return this.transport.sendJson<VerifyAuthenticatorResponse>(\r\n 'POST', Routes.api.auth.manage.verifyAuthenticator, bodyAndSignal(request, signal),\r\n );\r\n }\r\n\r\n /** Rotates the authenticator key and disables 2FA — the user must re-enroll to re-enable. */\r\n resetAuthenticatorAsync(signal?: AbortSignal): Promise<ResetAuthenticatorResponse> {\r\n return this.transport.sendJson<ResetAuthenticatorResponse>(\r\n 'POST', Routes.api.auth.manage.resetAuthenticator, bodyAndSignal(undefined, signal),\r\n );\r\n }\r\n\r\n /** Disables 2FA on the account. */\r\n disable2faAsync(signal?: AbortSignal): Promise<Disable2faResponse> {\r\n return this.transport.sendJson<Disable2faResponse>('POST', Routes.api.auth.manage.disable2fa, bodyAndSignal(undefined, signal));\r\n }\r\n\r\n /** Regenerates recovery codes — invalidates the previous set. The new codes are returned once and only here. */\r\n generateRecoveryCodesAsync(signal?: AbortSignal): Promise<RecoveryCodesResponse> {\r\n return this.transport.sendJson<RecoveryCodesResponse>(\r\n 'POST', Routes.api.auth.manage.generateRecoveryCodes, bodyAndSignal(undefined, signal),\r\n );\r\n }\r\n\r\n /** Clears this browser's \"remember this machine\" 2FA cookie. */\r\n forget2faClientAsync(signal?: AbortSignal): Promise<Forget2faResponse> {\r\n return this.transport.sendJson<Forget2faResponse>(\r\n 'POST', Routes.api.auth.manage.forget2faClient, bodyAndSignal(undefined, signal),\r\n );\r\n }\r\n\r\n // --- External logins management --------------------------------------------------\r\n\r\n /** Lists the user's linked external logins plus available providers to add. */\r\n getExternalLoginsAsync(signal?: AbortSignal): Promise<ExternalLoginsResponse> {\r\n return this.transport.sendJson<ExternalLoginsResponse>(\r\n 'GET', Routes.api.auth.manage.externalLogins, bodyAndSignal(undefined, signal),\r\n );\r\n }\r\n\r\n /**\r\n * Reads the combined sign-in-paths snapshot (linked external logins + whether the\r\n * account has a local password). Used by the manage-external-logins UI to decide\r\n * whether unlinking a given external login would lock the user out.\r\n */\r\n getCurrentLoginInfoAsync(signal?: AbortSignal): Promise<CurrentLoginInfo> {\r\n return this.transport.sendJson<CurrentLoginInfo>(\r\n 'GET', Routes.api.auth.manage.loginInfo, bodyAndSignal(undefined, signal),\r\n );\r\n }\r\n\r\n /** Removes one external login from the signed-in user. */\r\n removeExternalLoginAsync(request: RemoveExternalLoginRequest, signal?: AbortSignal): Promise<RemoveExternalLoginResponse> {\r\n return this.transport.sendJson<RemoveExternalLoginResponse>(\r\n 'POST', Routes.api.auth.manage.removeExternalLogin, bodyAndSignal(request, signal),\r\n );\r\n }\r\n\r\n // --- Personal data ---------------------------------------------------------------\r\n\r\n /** Returns every `[PersonalData]`-marked Identity property + linked external logins. */\r\n getPersonalDataAsync(signal?: AbortSignal): Promise<PersonalDataResponse> {\r\n return this.transport.sendJson<PersonalDataResponse>(\r\n 'GET', Routes.api.auth.manage.personalData, bodyAndSignal(undefined, signal),\r\n );\r\n }\r\n\r\n /**\r\n * Permanently deletes the user's account. When the account has a local password,\r\n * `request.password` is required — `RequireLocalPassword` in the response means\r\n * the client should prompt and retry.\r\n */\r\n deletePersonalDataAsync(request: DeletePersonalDataRequest, signal?: AbortSignal): Promise<DeletePersonalDataResponse> {\r\n return this.transport.sendJson<DeletePersonalDataResponse>(\r\n 'POST', Routes.api.auth.manage.deletePersonalData, bodyAndSignal(request, signal),\r\n );\r\n }\r\n}\r\n","import type { components } from './generated/api-schema.js';\nimport type { TableSecurityPermission } from './generated/result-codes.js';\nimport { Routes } from './routes.js';\nimport { Transport, type TransportOptions } from './transport.js';\n\ntype Schemas = components['schemas'];\n\n// Records\nexport type TableRecord = Schemas['TableRecord'];\nexport type TableRecordReference = Schemas['TableRecordReference'];\nexport type CreateResponse = Schemas['CreateResponse'];\nexport type UpdateResponse = Schemas['UpdateResponse'];\nexport type DeleteResponse = Schemas['DeleteResponse'];\nexport type RetrieveRecordsResponse = Schemas['RetrieveRecordsResponse'];\nexport type GridDataRequest = Schemas['GridDataRequest'];\nexport type GridDataResponse = Schemas['GridDataResponse'];\nexport type ResolvedColumn = Schemas['ResolvedColumn'];\nexport type ColumnSort = Schemas['ColumnSort'];\n\n// Filter shapes — discriminated union under `GridDataRequest.filters`.\n// `GridFilterBase` is the union itself; the per-variant type is the\n// `$type`-narrowed shape that callers construct directly. The relationship\n// filter covers both one-to-many (SubGrid) and many-to-many (SubGrid +\n// ManyToManyLookupEdit pool) — the server resolves the arity from the\n// parent's table metadata at apply time, so clients don't have to predict\n// or fetch parent metadata up front. The generator names the variant\n// `GridFilterBaseRelationshipFilter`; aliased to a friendlier name so\n// consumer code reads naturally.\nexport type GridFilterBase = Schemas['GridFilterBase'];\nexport type RelationshipFilter = Schemas['GridFilterBaseRelationshipFilter'];\n\n// Batched operations. `OrganizationRequest` / `OrganizationResponse` are\n// discriminated unions over Create/Update/Delete/Associate/Disassociate +\n// the base shape — same wire shape Blazor uses. The MainContext save flow\n// collects these across the descendant tree and ships them in one\n// executeMultiple round-trip for transactional save semantics.\nexport type OrganizationRequest = Schemas['OrganizationRequest'];\nexport type OrganizationResponse = Schemas['OrganizationResponse'];\nexport type CreateRequest = Schemas['OrganizationRequestCreateRequest'];\nexport type UpdateRequest = Schemas['OrganizationRequestUpdateRequest'];\nexport type DeleteRequest = Schemas['OrganizationRequestDeleteRequest'];\nexport type AssociateRequest = Schemas['OrganizationRequestAssociateRequest'];\nexport type DisassociateRequest = Schemas['OrganizationRequestDisassociateRequest'];\n\n// Metadata\nexport type TableMetadata = Schemas['TableMetadata'];\nexport type ViewMetadata = Schemas['ViewMetadata'];\n\n// Charts. Wire shapes shared with the Blazor side via\n// PowerPortalsPro.Common.Models. The server's IChartService owns\n// FetchXML construction + record shaping; the client just sends the\n// typed request and consumes the typed response.\n//\n// `DataPoint` is a polymorphic union: a bare data point or a\n// `DataverseDataPoint` (carries the originating TableRecord). The\n// openapi-typescript generator names the variants\n// `DataPointDataverseDataPoint` / `DataPointBase`; we alias them to\n// friendlier names so consumer code reads naturally.\nexport type ChartDataRequest = Schemas['ChartDataRequest'];\nexport type ChartDataResponse = Schemas['ChartDataResponse'];\nexport type AggregateChartConfig = Schemas['AggregateChartConfig'];\nexport type ChartAggregation = Schemas['ChartAggregation'];\nexport type ChartGrouping = Schemas['ChartGrouping'];\nexport type ChartData = Schemas['ChartData'];\nexport type ChartDataset = Schemas['ChartDataset'];\nexport type DataPoint = Schemas['DataPoint'];\nexport type BaseDataPoint = Schemas['DataPointBase'];\nexport type DataverseDataPoint = Schemas['DataPointDataverseDataPoint'];\nexport type ChartLinkedEntity = Schemas['ChartLinkedEntity'];\n\n// Files\nexport type FileInfo = Schemas['FileInfo'];\nexport type EnvironmentFileSettings = Schemas['EnvironmentFileSettings'];\nexport type CreateFileArchiveRequest = Schemas['CreateFileArchiveRequest'];\nexport type FileArchiveJsonResponse = Schemas['FileArchiveJsonResponse'];\n\n/**\n * Client-side result of {@link PowerPortalsProClient.createFileArchiveAsync}.\n * Carries the archive bytes plus the metadata derived from the server's\n * `Content-Disposition` / `Content-Type` headers (binary path) or from the\n * JSON envelope (JSON path). Matches the C# `FileArchiveResult` shape so\n * the two stacks have a single mental model for the operation.\n */\nexport interface FileArchiveResult {\n /** Suggested download filename (e.g. `\"ppp_file-files.zip\"`). */\n readonly fileName: string;\n /** MIME type for the archive bytes. */\n readonly contentType: string;\n /** Archive bytes — empty when no source record produced a usable file. */\n readonly data: Uint8Array;\n}\n\n// Localization\n//\n// Both records are emitted by the OpenAPI generator from their C# definitions\n// (`PowerPortalsPro.Web.Common.Models.LocalizationBundleManifest` /\n// `LocalizationManifestForLocale`). Re-exported here as the canonical names\n// so callers can `import { LocalizationBundleManifest } from '@powerportalspro/core'`\n// without spelunking through the generated schema namespace.\nexport type LocalizationBundleManifest = Schemas['LocalizationBundleManifest'];\nexport type LocalizationManifestForLocale = Schemas['LocalizationManifestForLocale'];\n\n/**\n * SPA-facing wrapper over the framework's record / metadata / file endpoints under\n * `/api/*` — the React equivalent of `IPowerPortalsProService` from\n * `PowerPortalsPro.Web.Common`. Method names mirror the C# interface verbatim\n * (camel-cased) so a Blazor dev reading both languages finds the same vocabulary.\n *\n * Flat surface, no sub-namespacing — `IPowerPortalsProService` exposes everything\n * (CRUD, metadata, files, …) at the root in C#; this class follows the same shape.\n *\n * Authentication is a separate concern handled by {@link AuthClient}, mirroring the\n * `IAuthService` / `IPowerPortalsProService` split on the Blazor side.\n *\n * @example\n * ```ts\n * const ppp = new PowerPortalsProClient();\n * const account = await ppp.retrieveRecordAsync('account', accountId, ['name']);\n * const cols = await ppp.retrieveTableMetadataAsync('account');\n * ```\n */\nexport class PowerPortalsProClient {\n /**\n * The underlying transport. Exposed so advanced consumers can hit endpoints not yet\n * wrapped by a typed method (caches, executeMultiple, associate/disassociate, …).\n * Cookie auth, JSON in/out, and problem+json error rehydration apply automatically\n * because the transport owns those concerns.\n */\n readonly transport: Transport;\n\n constructor(transportOrOptions?: Transport | TransportOptions) {\n this.transport =\n transportOrOptions instanceof Transport\n ? transportOrOptions\n : new Transport(transportOrOptions);\n }\n\n // --- Records (CRUD + FetchXML) ---------------------------------------------------\n\n /**\n * Creates a new record. URL is derived from `record.tableName`. Server marks all\n * properties as modified before applying so column values arriving from JSON\n * (which carry no dirty flags) round-trip the same way they do from Blazor's\n * dirty-tracked records.\n */\n createRecordAsync(record: TableRecord, signal?: AbortSignal): Promise<CreateResponse> {\n return this.transport.sendJson<CreateResponse>(\n 'POST',\n Routes.api.tables.getCreateRoute(record.tableName),\n { body: record, ...(signal ? { signal } : {}) },\n );\n }\n\n /**\n * Reads a single record. `columns` (logical names) narrows the projection to a subset;\n * omit it for the table's full set of columns visible to the caller.\n */\n retrieveRecordAsync(\n tableLogicalName: string,\n recordId: string,\n columns?: readonly string[],\n signal?: AbortSignal,\n ): Promise<TableRecord> {\n return this.transport.sendJson<TableRecord>(\n 'GET',\n Routes.api.tables.getRetrieveRoute(tableLogicalName, recordId, columns),\n signal ? { signal } : {},\n );\n }\n\n /**\n * Runs a FetchXML query and returns the matching records plus paging info.\n * The query is the FetchXML XML literal — the same format Dataverse natively accepts.\n */\n retrieveRecordsAsync(fetchXml: string, signal?: AbortSignal): Promise<RetrieveRecordsResponse> {\n return this.transport.sendJson<RetrieveRecordsResponse>(\n 'GET',\n Routes.api.getRetrieveMultipleRoute(fetchXml),\n signal ? { signal } : {},\n );\n }\n\n /**\n * Loads grid data via the server-side <c>IGridService</c>. The request\n * picks a base query — a stored Dataverse view (<c>viewId</c>) or a\n * caller-supplied FetchXML (<c>fetchXml</c>) — and the server applies\n * the framework's <c>*</c>/<c>%</c> wildcard convention, AND-merges\n * the search filter into the source's existing filter, dispatches to\n * per-column-type search semantics (string <c>like</c>, choice label\n * match → integer <c>in</c>, lookup link-entity + primary-name match,\n * etc.), and projects each column to a {@link ResolvedColumn} so the\n * client can render headers + dispatch cells without a separate\n * metadata round-trip.\n *\n * Exactly one of <c>request.viewId</c> or <c>request.fetchXml</c> must\n * be supplied; sending both or neither returns a 400.\n *\n * Mirrors how the Blazor `IGridService` is consumed —\n * `@powerportalspro/react`'s `useGridData` hook calls this method\n * internally, so most consumers don't invoke it directly.\n */\n loadGridAsync(\n request: GridDataRequest,\n signal?: AbortSignal,\n ): Promise<GridDataResponse> {\n return this.transport.sendJson<GridDataResponse>(\n 'POST',\n Routes.api.gridData,\n { body: request, ...(signal ? { signal } : {}) },\n );\n }\n\n /**\n * Updates an existing record. URL is derived from `record.tableName` and `record.id` —\n * `record.id` must be set. For a new record, use {@link createRecordAsync} instead.\n */\n updateRecordAsync(record: TableRecord, signal?: AbortSignal): Promise<UpdateResponse> {\n if (!record.id) {\n throw new Error(\n 'PowerPortalsProClient.updateRecordAsync requires record.id. Use createRecordAsync for new records.',\n );\n }\n return this.transport.sendJson<UpdateResponse>(\n 'PATCH',\n Routes.api.tables.getUpdateRoute(record.tableName, record.id),\n { body: record, ...(signal ? { signal } : {}) },\n );\n }\n\n /**\n * Executes a batch of {@link OrganizationRequest}s as a single round-trip,\n * matching Blazor's `IPowerPortalsProService.ExecuteMultipleAsync`. The\n * MainContext save flow uses this to ship every dirty descendant's\n * requests in one shot so a multi-record save lands transactionally\n * server-side.\n *\n * When `returnResponses` is `true` (default), the response array carries\n * one `OrganizationResponse` per request in submission order — useful for\n * `CreateRequest` cases that need the newly-allocated record id. Pass\n * `false` for fire-and-forget batches to skip the response payload.\n */\n executeMultipleAsync(\n requests: readonly OrganizationRequest[],\n options?: { returnResponses?: boolean; signal?: AbortSignal },\n ): Promise<OrganizationResponse[]> {\n const returnResponses = options?.returnResponses ?? true;\n return this.transport.sendJson<OrganizationResponse[]>(\n 'POST',\n Routes.api.getExecuteMultipleRoute(returnResponses),\n {\n body: requests as OrganizationRequest[],\n ...(options?.signal ? { signal: options.signal } : {}),\n },\n );\n }\n\n /** Deletes the record with the given id from the given table. */\n deleteRecordAsync(\n tableLogicalName: string,\n recordId: string,\n signal?: AbortSignal,\n ): Promise<DeleteResponse> {\n return this.transport.sendJson<DeleteResponse>(\n 'DELETE',\n Routes.api.tables.getDeleteRoute(tableLogicalName, recordId),\n signal ? { signal } : {},\n );\n }\n\n // --- Charts ----------------------------------------------------------------------\n\n /**\n * Loads chart data via the server-side <c>IChartService</c>. The\n * request body picks one of three input modes — typed aggregate\n * config, saved-view id, or raw FetchXML — plus the label/value\n * columns to shape the response. Server builds the FetchXML, runs the\n * query, performs the multi-series pivot, and applies combined\n * date-label formatting using the request culture.\n *\n * Mirrors how the Blazor `IChartService` is consumed —\n * `@powerportalspro/react-charts`'s `DataverseChartDataSource` family\n * calls this method internally, so most consumers don't invoke it\n * directly.\n */\n loadChartAsync(\n request: ChartDataRequest,\n signal?: AbortSignal,\n ): Promise<ChartDataResponse> {\n return this.transport.sendJson<ChartDataResponse>(\n 'POST',\n Routes.api.chartData,\n { body: request, ...(signal ? { signal } : {}) },\n );\n }\n\n // --- Metadata --------------------------------------------------------------------\n\n /** Reads the metadata describing the columns and relationships of a single Dataverse table. */\n retrieveTableMetadataAsync(\n tableLogicalName: string,\n signal?: AbortSignal,\n ): Promise<TableMetadata> {\n return this.transport.sendJson<TableMetadata>(\n 'GET',\n Routes.api.getRetrieveTableMetadataRoute(tableLogicalName),\n signal ? { signal } : {},\n );\n }\n\n /**\n * Returns the current user's combined table-level `TableSecurityPermission`\n * bitmask for `tableLogicalName` — the bitwise union of Read / Create /\n * Write / Delete / Append / AppendTo flags any registered\n * `ITablePermissionHandler` allows for that user on that table. Mirrors\n * the cached `ITablePermissionCache.GetPermissionForUserAsync` lookup\n * Blazor's grid buttons already use directly via DI. Wrapped client-side\n * by the `useTablePermissions(tableName)` React hook with in-flight-promise\n * dedup; reach for the raw client only when you're outside React (e.g.\n * a sample stand-alone script) or need an imperative one-off check.\n *\n * Returns `0` (`TableSecurityPermission.None`) when the user has no\n * permissions on the table; consumers compare via bit math (e.g.\n * `(permissions & TableSecurityPermission.Create) === TableSecurityPermission.Create`).\n */\n retrieveTablePermissionsAsync(\n tableLogicalName: string,\n signal?: AbortSignal,\n ): Promise<TableSecurityPermission> {\n return this.transport.sendJson<TableSecurityPermission>(\n 'GET',\n Routes.api.getRetrieveTablePermissionsRoute(tableLogicalName),\n signal ? { signal } : {},\n );\n }\n\n /** Reads metadata for a single view by its Dataverse view id (a GUID). */\n retrieveViewMetadataAsync(viewId: string, signal?: AbortSignal): Promise<ViewMetadata> {\n return this.transport.sendJson<ViewMetadata>(\n 'GET',\n Routes.api.getRetrieveViewMetadataRoute(viewId),\n signal ? { signal } : {},\n );\n }\n\n /**\n * Lists every view metadata record for a table — used by view-pickers and default-view\n * resolution. Server-side caching means this is a single Dataverse hit per table per\n * server lifetime.\n */\n retrieveViewsForTableAsync(\n tableLogicalName: string,\n signal?: AbortSignal,\n ): Promise<readonly ViewMetadata[]> {\n return this.transport.sendJson<readonly ViewMetadata[]>(\n 'GET',\n Routes.api.getRetrieveViewsForTableRoute(tableLogicalName),\n signal ? { signal } : {},\n );\n }\n\n // --- Localization ----------------------------------------------------------------\n\n /**\n * Retrieves the version manifest — just the supported-locale codes.\n * Clients fetch this on app startup, resolve which locale to use, then\n * call {@link retrieveLocalizationThumbprintsAsync} for the per-resource\n * thumbprints at that locale. Cached `no-cache` server-side so a new\n * release is detected on next page load.\n */\n retrieveLocalizationBundleManifestAsync(\n signal?: AbortSignal,\n ): Promise<LocalizationBundleManifest> {\n return this.transport.sendJson<LocalizationBundleManifest>(\n 'GET',\n Routes.api.getLocalizationBundleManifestRoute(),\n signal ? { signal } : {},\n );\n }\n\n /**\n * Retrieves the per-resource thumbprints for a single locale — the\n * default-bundle thumbprint plus thumbprints for every loaded table / view.\n * Returned from a separate endpoint (vs being baked into the version\n * manifest) so the manifest stays small even at large environment scale.\n * Cached `no-cache` server-side; the per-resource immutable URLs do the\n * heavy caching once these are read.\n */\n retrieveLocalizationThumbprintsAsync(\n locale: string,\n signal?: AbortSignal,\n ): Promise<LocalizationManifestForLocale> {\n return this.transport.sendJson<LocalizationManifestForLocale>(\n 'GET',\n Routes.api.getLocalizationThumbprintsRoute(locale),\n signal ? { signal } : {},\n );\n }\n\n /**\n * Resolved URL for the default localization-bundle file at the given\n * locale + thumbprint. Convenience wrapper around the {@link Routes}\n * helper.\n */\n getLocalizationBundleUrl(locale: string, thumbprint: string): string {\n return Routes.api.getLocalizationBundleRoute(locale, thumbprint);\n }\n\n /**\n * Fetches the default localization-bundle file (everything outside\n * `tables.*` / `choices.*`) for the given locale + thumbprint. Returns\n * the nested-object shape the source JSON files use\n * (`{ app: { buttons: { … } } }`).\n *\n * Per-table and per-view strings come from\n * {@link retrieveLocalizationTableBundleAsync} and\n * {@link retrieveLocalizationViewBundleAsync} — fetched in parallel by the\n * runtime when source-generator-emitted `tables.{name}` / `views.{viewId}`\n * tokens are passed to the localizer's prefix-load hook.\n *\n * The thumbprint is purely cosmetic (server doesn't validate it). Pass\n * the thumbprint from the manifest so the URL is unique per release and\n * the browser's HTTP cache serves subsequent loads from disk.\n */\n retrieveLocalizationBundleAsync(\n locale: string,\n thumbprint: string,\n signal?: AbortSignal,\n ): Promise<Record<string, unknown>> {\n return this.transport.sendJson<Record<string, unknown>>(\n 'GET',\n Routes.api.getLocalizationBundleRoute(locale, thumbprint),\n signal ? { signal } : {},\n );\n }\n\n /**\n * Fetches a per-table localization bundle. Returns every `tables.{name}.*`\n * string for the table plus the global `choices.*` strings any of its\n * columns reference. Owning-side resolution: the server reads the table's\n * column metadata to find which global option sets to include.\n *\n * Pass the thumbprint from the matching locale entry of the manifest so\n * the URL is unique per release; the browser caches the response under\n * `Cache-Control: immutable, max-age=31536000`.\n */\n retrieveLocalizationTableBundleAsync(\n tableName: string,\n locale: string,\n thumbprint: string,\n signal?: AbortSignal,\n ): Promise<Record<string, unknown>> {\n return this.transport.sendJson<Record<string, unknown>>(\n 'GET',\n Routes.api.getLocalizationTableBundleRoute(tableName, locale, thumbprint),\n signal ? { signal } : {},\n );\n }\n\n /**\n * Fetches a per-view localization bundle. Returns every\n * `tables.{owningTable}.views.{viewId}.*` string. The owning table is\n * resolved server-side from the view id, so the client only needs to pass\n * the id (lowercased GUID, no braces).\n *\n * Pass the thumbprint from the matching locale entry of the manifest so\n * the URL is unique per release; the browser caches the response under\n * `Cache-Control: immutable, max-age=31536000`.\n */\n retrieveLocalizationViewBundleAsync(\n viewId: string,\n locale: string,\n thumbprint: string,\n signal?: AbortSignal,\n ): Promise<Record<string, unknown>> {\n return this.transport.sendJson<Record<string, unknown>>(\n 'GET',\n Routes.api.getLocalizationViewBundleRoute(viewId, locale, thumbprint),\n signal ? { signal } : {},\n );\n }\n\n /**\n * Retrieves the FULL localized-strings catalog for a culture. The server\n * already merges Dataverse-metadata-derived strings (table / column /\n * choice-option labels) with the framework JSON files and any consumer\n * override files (last-wins). Use this to seed the React-side localizer\n * with one round-trip.\n *\n * Returned shape is a nested object that mirrors the source JSON files —\n * `{ app: { buttons: { save: { label: \"Save\" } } }, tables: { contact: ... } }`.\n * The client typically flattens this to dotted-key form for `t()` lookup\n * (see {@link flattenStrings} in `@powerportalspro/react`).\n *\n * @param culture culture code matching what server-side ASP.NET request\n * localization recognizes — e.g. `\"en\"`, `\"es\"`, `\"fr-CA\"`. Falls back\n * to the default culture server-side when the value isn't supported.\n */\n retrieveLocalizedStringsAsync(\n culture: string,\n signal?: AbortSignal,\n ): Promise<Record<string, unknown>> {\n return this.transport.sendJson<Record<string, unknown>>(\n 'GET',\n Routes.api.getRetrieveLocalizedStringsRoute(culture),\n signal ? { signal } : {},\n );\n }\n\n // --- Files -----------------------------------------------------------------------\n\n /**\n * Reads file metadata for one record/column pair, optionally including the binary\n * payload. When `includeData` is false (the default), the response carries name,\n * size, and content type but not the bytes — useful for rendering a download link\n * that fetches lazily on click.\n */\n getFileInfoAsync(\n tableLogicalName: string,\n recordId: string,\n columnName: string,\n includeData = false,\n signal?: AbortSignal,\n ): Promise<FileInfo> {\n return this.transport.sendJson<FileInfo>(\n 'GET',\n Routes.api.getRetrieveFileInfoRoute(tableLogicalName, recordId, columnName, includeData),\n signal ? { signal } : {},\n );\n }\n\n /**\n * Batched read for many records of the same table/column — feeds the FileGrid's\n * \"Download All\" / \"Download Selected\" flows in one round-trip. Permission checks\n * still apply per-record server-side, so dropped rows (deleted, unauthorized,\n * file-missing) just don't appear in the response.\n */\n getFileInfosAsync(\n tableLogicalName: string,\n recordIds: readonly string[],\n columnName: string,\n includeData = false,\n signal?: AbortSignal,\n ): Promise<readonly FileInfo[]> {\n return this.transport.sendJson<readonly FileInfo[]>(\n 'POST',\n Routes.api.getRetrieveFilesBatchRoute(tableLogicalName, columnName, includeData),\n { body: recordIds, ...(signal ? { signal } : {}) },\n );\n }\n\n /**\n * Builds an archive containing the file payload of every supplied record id for the\n * named table/column. Replaces the older client-side \"fetch each file + zip in the\n * browser\" path with a single server-side step — no base64 round-trip on the wire.\n *\n * Two response shapes, selected by `request.responseFormat`:\n *\n * - **BinaryStream** (default): the server returns the raw archive bytes; this\n * method reads them via `response.arrayBuffer()` and wraps the result in a\n * {@link FileArchiveResult}, deriving `fileName` from the `Content-Disposition`\n * header and `contentType` from `Content-Type`. Most consumers want this path.\n * - **Json**: the server returns a {@link FileArchiveJsonResponse} envelope with\n * the archive bytes base64-encoded. Useful for test harnesses, service workers,\n * or callers that need to inspect filename/size before triggering a download.\n *\n * Either way, the returned `data` is empty (`Uint8Array(0)`) when none of the\n * supplied records produced a usable file — the caller can surface a \"nothing to\n * download\" message instead of streaming an empty archive.\n */\n async createFileArchiveAsync(\n request: CreateFileArchiveRequest,\n signal?: AbortSignal,\n ): Promise<FileArchiveResult> {\n if (request.responseFormat === 1 /* FileArchiveResponseFormat.Json */) {\n const json = await this.transport.sendJson<FileArchiveJsonResponse>(\n 'POST',\n Routes.api.createFileArchive,\n { body: request, ...(signal ? { signal } : {}) },\n );\n return {\n fileName: json.fileName,\n contentType: json.contentType,\n data: base64ToUint8Array(json.data),\n };\n }\n\n const response = await this.transport.send(\n 'POST',\n Routes.api.createFileArchive,\n { body: request, ...(signal ? { signal } : {}) },\n );\n\n const fileName =\n parseContentDispositionFileName(response.headers.get('Content-Disposition')) ??\n `${request.tableName}-files.zip`;\n const contentType =\n response.headers.get('Content-Type')?.split(';')[0]?.trim() ?? 'application/octet-stream';\n const buffer = await response.arrayBuffer();\n return { fileName, contentType, data: new Uint8Array(buffer) };\n }\n\n /**\n * Reads the environment-wide file upload settings (blocked extension list, max\n * upload size in KB). UI consumers use this to validate uploads client-side before\n * the round-trip, mirroring what the server enforces.\n */\n getEnvironmentFileSettingsAsync(signal?: AbortSignal): Promise<EnvironmentFileSettings> {\n return this.transport.sendJson<EnvironmentFileSettings>(\n 'GET',\n Routes.api.environmentFileSettings,\n signal ? { signal } : {},\n );\n }\n}\n\n// ---------------------------------------------------------------------------\n// Helpers used by createFileArchiveAsync. Kept at module scope (not on the\n// class) — they don't read any client state, so making them static methods\n// adds noise without buying anything.\n// ---------------------------------------------------------------------------\n\n/**\n * Decodes a base64 string into a `Uint8Array`. Matches the helper in\n * `@powerportalspro/react-fluent/edits/base/file-helpers.ts` but duplicated\n * here to avoid a layering dependency from `@powerportalspro/core` upward.\n */\nfunction base64ToUint8Array(base64: string): Uint8Array {\n const binary = atob(base64);\n const bytes = new Uint8Array(binary.length);\n for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);\n return bytes;\n}\n\n/**\n * Picks the filename out of a `Content-Disposition` response header. Honors\n * RFC 5987's `filename*=UTF-8''…` form (preferred when present — it carries\n * non-ASCII names correctly) before falling back to the plain `filename=\"…\"`\n * parameter. Returns `null` when the header is missing or unparseable so\n * the caller can supply its own default.\n */\nfunction parseContentDispositionFileName(header: string | null): string | null {\n if (!header) return null;\n // RFC 5987 — `filename*=UTF-8''<percent-encoded>` overrides the legacy\n // `filename=` parameter, which can only carry ASCII.\n const star = /filename\\*=(?:UTF-8'')?([^;]+)/i.exec(header);\n if (star?.[1]) {\n try {\n return decodeURIComponent(star[1]);\n } catch {\n /* fall through to legacy form */\n }\n }\n const plain = /filename=\"?([^\";]+)\"?/i.exec(header);\n return plain?.[1] ?? null;\n}\n","// AUTO-GENERATED by scripts/generate-openapi-types.mjs — do not edit.\n//\n// Const-object + type-alias for each C# enum schema in artifacts/openapi.json.\n// The schema transformer in PowerPortalsProWebServer.AddOpenApi emits the parallel\n// 'enum' (integer values) and 'x-enum-varnames' (member names) arrays; this file\n// zips them into runtime-usable constants. Wire format is unchanged (integers).\n//\n// To regenerate: `pnpm --filter @powerportalspro/core run generate:types`.\n\n/**\n * Aggregate function applied to a column in an aggregate FetchXML query.\n */\nexport const AggregateType = {\n None: 0,\n Count: 1,\n CountColumn: 2,\n Sum: 3,\n Avg: 4,\n Min: 5,\n Max: 6,\n} as const;\nexport type AggregateType = (typeof AggregateType)[keyof typeof AggregateType];\n\n/**\n * Compression format for the archive produced by\n * <see cref=\"!:Services.IPowerPortalsProService.CreateFileArchiveAsync\" />.\n * Currently only ArchiveFormat.Zip is supported; the enum is open-ended so\n * future formats can land without breaking the wire schema.\n */\nexport const ArchiveFormat = {\n Zip: 0,\n} as const;\nexport type ArchiveFormat = (typeof ArchiveFormat)[keyof typeof ArchiveFormat];\n\n/**\n * Outcome of `POST /api/auth/manage/email/change`. Members carry explicit\n * integer values so non-Blazor consumers comparing against the JSON wire form\n * get a stable contract across reorderings.\n */\nexport const ChangeEmailResult = {\n ConfirmationEmailSent: 0,\n SameAsCurrentEmail: 1,\n} as const;\nexport type ChangeEmailResult = (typeof ChangeEmailResult)[keyof typeof ChangeEmailResult];\n\n/**\n * Outcome of `POST /api/auth/manage/password/change`. Members carry\n * explicit integer values so non-Blazor consumers comparing against the JSON\n * wire form get a stable contract across reorderings.\n */\nexport const ChangePasswordResult = {\n Success: 0,\n IncorrectOldPassword: 1,\n InvalidPassword: 2,\n} as const;\nexport type ChangePasswordResult = (typeof ChangePasswordResult)[keyof typeof ChangePasswordResult];\n\n/**\n * Date bucketing intervals for grouping a datetime column in an\n * aggregate chart query. Simple values map directly to a single\n * FetchXML `dategrouping`. Combined values\n * (e.g. ChartDateGrouping.MonthAndYear) cause the server to emit multiple\n * `groupby` attributes on the same column and merge the results\n * into a formatted label like `\"Jan 2024\"` using the request's\n * current culture.\n */\nexport const ChartDateGrouping = {\n None: 0,\n Day: 1,\n Week: 2,\n Month: 3,\n Quarter: 4,\n Year: 5,\n MonthAndYear: 6,\n DayAndMonth: 7,\n DayAndMonthAndYear: 8,\n WeekAndYear: 9,\n QuarterAndYear: 10,\n} as const;\nexport type ChartDateGrouping = (typeof ChartDateGrouping)[keyof typeof ChartDateGrouping];\n\n/**\n * Identifies the data type of a Dataverse column. Values 0–20 mirror the Dataverse SDK's `AttributeTypeCode`; values 40+ are PowerPortalsPro-specific column types not present in Dataverse.\n */\nexport const ColumnType = {\n Boolean: 0,\n Customer: 1,\n DateTime: 2,\n Decimal: 3,\n Double: 4,\n Integer: 5,\n Lookup: 6,\n Memo: 7,\n Money: 8,\n Owner: 9,\n PartyList: 10,\n Choice: 11,\n State: 12,\n Status: 13,\n String: 14,\n Uniqueidentifier: 15,\n CalendarRules: 16,\n Virtual: 17,\n BigInt: 18,\n ManagedProperty: 19,\n EntityName: 20,\n MultiSelectChoice: 40,\n File: 41,\n Image: 42,\n} as const;\nexport type ColumnType = (typeof ColumnType)[keyof typeof ColumnType];\n\n/**\n * Outcome of `POST /api/auth/external-login/confirm`. Members carry\n * explicit integer values so non-Blazor consumers comparing against the JSON\n * wire form get a stable contract across reorderings.\n */\nexport const ConfirmExternalLoginResult = {\n SignedIn: 0,\n ConfirmationEmailSent: 1,\n NoPendingExternalLogin: 2,\n Failure: 3,\n} as const;\nexport type ConfirmExternalLoginResult = (typeof ConfirmExternalLoginResult)[keyof typeof ConfirmExternalLoginResult];\n\n/**\n * Specifies the date/time behavior of a DateTime column.\n */\nexport const DateTimeBehavior = {\n DateOnly: 1,\n UserLocal: 2,\n TimeZoneIndependent: 3,\n} as const;\nexport type DateTimeBehavior = (typeof DateTimeBehavior)[keyof typeof DateTimeBehavior];\n\n/**\n * Outcome of `POST /api/auth/manage/personal-data/delete`. Members carry\n * explicit integer values so non-Blazor consumers comparing against the JSON\n * wire form get a stable contract across reorderings.\n */\nexport const DeletePersonalDataResult = {\n Success: 0,\n IncorrectPassword: 1,\n RequireLocalPassword: 2,\n} as const;\nexport type DeletePersonalDataResult = (typeof DeletePersonalDataResult)[keyof typeof DeletePersonalDataResult];\n\n/**\n * Which Dataverse table backs an external-login candidate. Members carry\n * explicit integer values so non-Blazor consumers comparing against the JSON\n * wire form get a stable contract across reorderings.\n */\nexport const ExternalLoginCandidateKind = {\n Contact: 0,\n SystemUser: 1,\n} as const;\nexport type ExternalLoginCandidateKind = (typeof ExternalLoginCandidateKind)[keyof typeof ExternalLoginCandidateKind];\n\n/**\n * Determines how the server returns the archive bytes to the caller.\n */\nexport const FileArchiveResponseFormat = {\n BinaryStream: 0,\n Json: 1,\n} as const;\nexport type FileArchiveResponseFormat = (typeof FileArchiveResponseFormat)[keyof typeof FileArchiveResponseFormat];\n\n/**\n * Join type used on a FetchXML link-entity.\n */\nexport const JoinOperator = {\n Inner: 0,\n LeftOuter: 1,\n Natural: 2,\n MatchFirstRowUsingCrossApply: 3,\n In: 4,\n Exists: 5,\n Any: 6,\n NotAny: 7,\n All: 8,\n NotAll: 9,\n} as const;\nexport type JoinOperator = (typeof JoinOperator)[keyof typeof JoinOperator];\n\n/**\n * Outcome of a LoginRequest attempt. Returned in LoginResult LoginResponse.Result\n * so the client can branch UI behavior without inspecting HTTP status codes.\n * \n * Members carry explicit integer values: this enum ships in JSON wire payloads, so\n * non-Blazor consumers (React, Vue, mobile clients) compare against the numeric\n * representation. Pinning the values prevents accidental drift if a future\n * refactor reorders or inserts members.\n */\nexport const LoginResult = {\n Success: 0,\n RequiresTwoFactor: 1,\n InvalidCredentials: 2,\n EmailNotConfirmed: 3,\n LockedOut: 4,\n} as const;\nexport type LoginResult = (typeof LoginResult)[keyof typeof LoginResult];\n\n/**\n * Outcome of a RegisterRequest. Members carry explicit integer\n * values so non-Blazor consumers comparing against the JSON wire form get a\n * stable contract across reorderings.\n */\nexport const RegisterResult = {\n ConfirmationEmailSent: 0,\n SignedIn: 1,\n EmailAlreadyInUse: 2,\n} as const;\nexport type RegisterResult = (typeof RegisterResult)[keyof typeof RegisterResult];\n\n/**\n * Whether a RelationshipFilter returns records that ARE related\n * to the parent (the typical SubGrid / initial-selection load) or records\n * that are NOT related (the autocomplete pool a `ManyToManyLookupEdit`\n * picks from).\n * \n * RelationshipFilterMode.ExcludeExistingRecords is only meaningful for many-to-many\n * relationships — for one-to-many, \"records not related to this parent\" is\n * just \"records of the child table with a different FK\", which isn't a\n * shape any current consumer needs. Combining Exclude with a one-to-many\n * relationship is rejected by the server at filter-apply time.\n */\nexport const RelationshipFilterMode = {\n IncludeExistingRecords: 0,\n ExcludeExistingRecords: 1,\n} as const;\nexport type RelationshipFilterMode = (typeof RelationshipFilterMode)[keyof typeof RelationshipFilterMode];\n\n/**\n * Specifies whether a column value is required.\n */\nexport const RequiredLevel = {\n None: 0,\n SystemRequired: 1,\n ApplicationRequired: 2,\n Recommended: 3,\n} as const;\nexport type RequiredLevel = (typeof RequiredLevel)[keyof typeof RequiredLevel];\n\n/**\n * Outcome of `POST /api/auth/reset-password`. Members carry explicit\n * integer values so non-Blazor consumers comparing against the JSON wire form\n * get a stable contract across reorderings.\n */\nexport const ResetPasswordResult = {\n Success: 0,\n InvalidOrExpiredToken: 1,\n InvalidPassword: 2,\n} as const;\nexport type ResetPasswordResult = (typeof ResetPasswordResult)[keyof typeof ResetPasswordResult];\n\n/**\n * Outcome of `POST /api/auth/switch-identity`. Members carry explicit\n * integer values so non-Blazor consumers comparing against the JSON wire form\n * get a stable contract across reorderings.\n */\nexport const SwitchIdentityResult = {\n Switched: 0,\n NoAltIdentity: 1,\n AltIdentityNotFound: 2,\n NotAuthenticated: 3,\n} as const;\nexport type SwitchIdentityResult = (typeof SwitchIdentityResult)[keyof typeof SwitchIdentityResult];\n\n/**\n * Bit flags describing the security operations the current user can perform on a record.\n */\nexport const TableSecurityPermission = {\n None: 0,\n Read: 1,\n Create: 2,\n Write: 4,\n Delete: 8,\n Append: 16,\n AppendTo: 32,\n All: 63,\n} as const;\nexport type TableSecurityPermission = (typeof TableSecurityPermission)[keyof typeof TableSecurityPermission];\n","import type { components } from './generated/api-schema.js';\r\n\r\ntype TableRecord = components['schemas']['TableRecord'];\r\n\r\n/**\r\n * The empty-GUID sentinel Dataverse round-trips for \"no value\" — equivalent\r\n * to `Guid.Empty` on the .NET side. A record whose `id` is this sentinel is\r\n * semantically unsaved.\r\n */\r\nconst EMPTY_GUID = '00000000-0000-0000-0000-000000000000';\r\n\r\n/**\r\n * Resolves the id to use when building a `TableRecordReference` (or any\r\n * cross-record wire reference) for a `TableRecord`. Returns the record's\r\n * server-assigned `id` for saved records, falling back to `_idForCreate`\r\n * — a client-side temp GUID assigned in create mode by `<RecordContext>`\r\n * so AssociateRequest / parent-FK pre-fill in the same `ExecuteMultiple`\r\n * batch can reference the record before its real id is minted.\r\n *\r\n * Returns `undefined` when neither field carries a usable value (record\r\n * still loading, or a never-seeded create-mode record).\r\n *\r\n * Mirrors Blazor's `TableRecord -> TableRecordReference` implicit conversion\r\n * (`Id == Guid.Empty ? _idForCreate : Id`). The server resolves either\r\n * shape via `ResolveAssociateRecordAsync` — both flows interoperate.\r\n */\r\nexport function getRecordReferenceId(\r\n record: Pick<TableRecord, 'id' | '_idForCreate'> | null | undefined,\r\n): string | undefined {\r\n if (!record) return undefined;\r\n if (record.id && record.id !== EMPTY_GUID) return record.id;\r\n return record._idForCreate ?? undefined;\r\n}\r\n","export const VERSION = '0.1.0';\n\nexport { Routes } from './routes.js';\n\nexport {\n PowerPortalsProError,\n UnauthorizedAccessError,\n ArgumentError,\n ArgumentNullError,\n InvalidOperationError,\n mapProblemDetails,\n type ProblemDetails,\n type PowerPortalsProErrorInit,\n} from './errors.js';\n\nexport {\n Transport,\n type TransportOptions,\n type RequestOptions,\n} from './transport.js';\n\n// Two top-level clients matching the C# Blazor split:\n// AuthClient ↔ IAuthService (sign-in, profile, 2FA, external login, …)\n// PowerPortalsProClient ↔ IPowerPortalsProService (CRUD, metadata, files, …)\n// Construct either independently — they share the browser's cookie jar via fetch,\n// not via a parent client. Pass a Transport instance to share configuration.\n\nexport {\n AuthClient,\n type LoginRequest,\n type LoginResponse,\n type VerifyTwoFactorRequest,\n type VerifyTwoFactorResponse,\n type RegisterRequest,\n type RegisterResponse,\n type RequestPasswordResetRequest,\n type ResetPasswordRequest,\n type ResetPasswordResponse,\n type ConfirmEmailRequest,\n type ConfirmEmailResponse,\n type ResendEmailConfirmationRequest,\n type CurrentUserInfo,\n type ExternalLoginProviderInfo,\n type PendingExternalLoginResponse,\n type ConfirmExternalLoginRequest,\n type ConfirmExternalLoginResponse,\n type SelectExternalLoginRequest,\n type SwitchIdentityResponse,\n type ProfileResponse,\n type UpdateProfileRequest,\n type SetPasswordRequest,\n type SetPasswordResponse,\n type ChangePasswordRequest,\n type ChangePasswordResponse,\n type ChangeEmailRequest,\n type ChangeEmailResponse,\n type SendEmailConfirmationResponse,\n type TwoFactorStatusResponse,\n type AuthenticatorSetupResponse,\n type VerifyAuthenticatorRequest,\n type VerifyAuthenticatorResponse,\n type ResetAuthenticatorResponse,\n type Disable2faResponse,\n type RecoveryCodesResponse,\n type Forget2faResponse,\n type ExternalLoginsResponse,\n type CurrentLoginInfo,\n type RemoveExternalLoginRequest,\n type RemoveExternalLoginResponse,\n type PersonalDataResponse,\n type DeletePersonalDataRequest,\n type DeletePersonalDataResponse,\n} from './auth-client.js';\n\nexport {\n PowerPortalsProClient,\n type TableRecord,\n type TableRecordReference,\n type CreateResponse,\n type UpdateResponse,\n type DeleteResponse,\n type RetrieveRecordsResponse,\n type GridDataRequest,\n type GridDataResponse,\n type ResolvedColumn,\n type ColumnSort,\n type GridFilterBase,\n type RelationshipFilter,\n type TableMetadata,\n type ViewMetadata,\n type FileInfo,\n type EnvironmentFileSettings,\n type ChartDataRequest,\n type ChartDataResponse,\n type AggregateChartConfig,\n type ChartAggregation,\n type ChartGrouping,\n type ChartData,\n type ChartDataset,\n type DataPoint,\n type BaseDataPoint,\n type DataverseDataPoint,\n type ChartLinkedEntity,\n type OrganizationRequest,\n type OrganizationResponse,\n type CreateRequest,\n type UpdateRequest,\n type DeleteRequest,\n type AssociateRequest,\n type DisassociateRequest,\n} from './powerportalspro-client.js';\n\n// Result-code const-objects are auto-generated from the OpenAPI document — every\n// C# enum schema with the x-enum-varnames extension produces a const-object + type\n// alias in src/generated/result-codes.ts. Forward the whole module so consumers can\n// `import { LoginResult, RegisterResult, ColumnType, ... } from '@powerportalspro/core'`\n// without us maintaining an explicit per-enum re-export list.\nexport * from './generated/result-codes.js';\n\n// Resolves a TableRecord's effective reference id — `id` when saved,\n// `_idForCreate` when still in create mode — so cross-record wire\n// references (AssociateRequest, parent-FK pre-fill) work in both states.\nexport { getRecordReferenceId } from './record-id.js';\n\n// The full generated OpenAPI schema, in case consumers need a type that isn't already\n// re-exported above (column metadata, organization request/response polymorphism, etc.).\n// Prefer the named exports — components is here as an escape hatch.\nexport type { components, paths } from './generated/api-schema.js';\n"]}
1
+ {"version":3,"sources":["../src/routes.ts","../src/errors.ts","../src/transport.ts","../src/auth-client.ts","../src/powerportalspro-client.ts","../src/generated/result-codes.ts","../src/record-id.ts","../src/index.ts"],"names":[],"mappings":";;;AAOA,IAAM,OAAA,GAAU,MAAA;AAChB,IAAM,QAAA,GAAW,GAAG,OAAO,CAAA,KAAA,CAAA;AAC3B,IAAM,UAAA,GAAa,GAAG,QAAQ,CAAA,OAAA,CAAA;AAE9B,IAAM,MAAA,GAAS;AAAA;AAAA,EAEb,WAAA,EAAa,GAAG,OAAO,CAAA,yBAAA,CAAA;AAAA;AAAA,EAGvB,qBAAA,EAAuB,GAAG,OAAO,CAAA,oCAAA,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AO,EAAA,KAAO,UAAA,SAAmB,MAAA,CAAO,EAAA;AACzD,EAAA,OAAO,OAAO,YAAA,IAAgB,MAAA;AAChC;;;AChCO,IAAM,OAAA,GAAU","file":"index.cjs","sourcesContent":["/**\n * URL builders for the framework's `/api/*` and UI endpoints. Path segments\n * use `encodeURIComponent` where they're parameterised (record ids, view ids,\n * table logical names that may contain user-supplied characters); known-safe\n * segments (culture codes, fixed enum values) are unencoded.\n */\n\nconst apiRoot = '/api';\nconst authRoot = `${apiRoot}/auth`;\nconst manageRoot = `${authRoot}/manage`;\n\nconst tables = {\n /** Template: `/api/table/{tableLogicalName}`. POST creates a record. */\n createRoute: `${apiRoot}/table/{tableLogicalName}`,\n\n /** Template: `/api/table/{tableLogicalName}/{recordId}`. GET reads, PATCH updates, DELETE removes. */\n readUpdateDeleteRoute: `${apiRoot}/table/{tableLogicalName}/{recordId}`,\n\n /** Resolved URL for creating a record of the given table. */\n getCreateRoute: (tableLogicalName: string): string =>\n `${apiRoot}/table/${tableLogicalName}`,\n\n /**\n * Resolved URL for retrieving a specific record, optionally with a column allow-list.\n * @param columns Optional list of column logical names — joined with `,` and sent as `?columns=`.\n */\n getRetrieveRoute: (\n tableLogicalName: string,\n recordId: string,\n columns?: readonly string[],\n ): string => {\n const base = `${apiRoot}/table/${tableLogicalName}/${recordId}`;\n return columns && columns.length > 0 ? `${base}?columns=${columns.join(',')}` : base;\n },\n\n /** Resolved URL for updating a record (PATCH). */\n getUpdateRoute: (tableLogicalName: string, recordId: string): string =>\n `${apiRoot}/table/${tableLogicalName}/${recordId}`,\n\n /** Resolved URL for deleting a record (DELETE). */\n getDeleteRoute: (tableLogicalName: string, recordId: string): string =>\n `${apiRoot}/table/${tableLogicalName}/${recordId}`,\n} as const;\n\nconst manage = {\n /** Base path under which all manage endpoints live (`/api/auth/manage`). */\n root: manageRoot,\n\n /** GET — read first/last/mobile from the linked Dataverse contact + Identity status flags. */\n profile: `${manageRoot}/profile`,\n /** POST — update first/last/mobile on the linked Dataverse contact. */\n updateProfile: `${manageRoot}/profile`,\n\n /** POST — add a local password to an account that doesn't have one. */\n setPassword: `${manageRoot}/password/set`,\n /** POST — change the local password (requires the current password). */\n changePassword: `${manageRoot}/password/change`,\n\n /** POST — start a change-email flow by emailing the new address a confirmation link. */\n changeEmail: `${manageRoot}/email/change`,\n /** POST — re-send the confirmation link to the user's current email. */\n sendEmailConfirmation: `${manageRoot}/email/send-confirmation`,\n\n /** GET — read 2FA status. */\n twoFactorStatus: `${manageRoot}/2fa`,\n /** GET — shared key + otpauth URI for the QR-code enrollment screen. */\n authenticatorSetup: `${manageRoot}/authenticator/setup`,\n /** POST — verify a code from the authenticator app. */\n verifyAuthenticator: `${manageRoot}/authenticator/verify`,\n /** POST — rotate the authenticator key (also disables 2FA). */\n resetAuthenticator: `${manageRoot}/authenticator/reset`,\n /** POST — disable 2FA on the account. */\n disable2fa: `${manageRoot}/2fa/disable`,\n /** POST — regenerate the user's recovery codes. */\n generateRecoveryCodes: `${manageRoot}/2fa/recovery-codes/generate`,\n /** POST — clear this browser's \"trust this device\" 2FA cookie. */\n forget2faClient: `${manageRoot}/2fa/forget-browser`,\n\n /** GET — list the signed-in user's linked external logins + available providers to add. */\n externalLogins: `${manageRoot}/external-logins`,\n /** GET — combined snapshot of sign-in paths (linked external logins + whether a local password exists). */\n loginInfo: `${manageRoot}/login-info`,\n /** GET — kicks off the OAuth flow that links an additional external login. Full-page navigate, do not fetch. */\n linkExternalLogin: `${manageRoot}/external-logins/link`,\n /** GET — OAuth callback target for {@link linkExternalLogin}. */\n linkExternalLoginCallback: `${manageRoot}/external-logins/link/callback`,\n /** POST — remove one external login by provider + key. */\n removeExternalLogin: `${manageRoot}/external-logins/remove`,\n\n /** GET — dump every `[PersonalData]` property + linked external logins. */\n personalData: `${manageRoot}/personal-data`,\n /** POST — permanently delete the user's account. */\n deletePersonalData: `${manageRoot}/personal-data/delete`,\n\n /** Resolved URL for {@link linkExternalLogin} with the provider + return URL pre-encoded. */\n getLinkExternalLoginRoute: (provider: string, returnUrl?: string): string => {\n const query = `?provider=${encodeURIComponent(provider)}`;\n return returnUrl\n ? `${manageRoot}/external-logins/link${query}&returnUrl=${encodeURIComponent(returnUrl)}`\n : `${manageRoot}/external-logins/link${query}`;\n },\n} as const;\n\nconst auth = {\n /** Base path under which all auth endpoints live (`/api/auth`). */\n root: authRoot,\n\n /** POST — submit credentials. */\n login: `${authRoot}/login`,\n /** POST — submit the second-factor code after a Login that returned RequiresTwoFactor. */\n loginTwoFactor: `${authRoot}/login/2fa`,\n /** POST — clear the auth cookie. */\n logout: `${authRoot}/logout`,\n /** POST — create a new user account. */\n register: `${authRoot}/register`,\n /** POST — send a password-reset email. */\n forgotPassword: `${authRoot}/forgot-password`,\n /** POST — complete a password reset with the email-link token. */\n resetPassword: `${authRoot}/reset-password`,\n /** POST — confirm a registered user's email with the email-link token. */\n confirmEmail: `${authRoot}/confirm-email`,\n /** POST — send a fresh confirmation email. */\n resendEmailConfirmation: `${authRoot}/resend-email-confirmation`,\n /** GET — anonymous auth options for the sign-in UI: the local-accounts flag plus the configured external (OAuth) providers. */\n options: `${authRoot}/options`,\n /** GET — kicks off the OAuth flow for the named external provider. Full-page navigate, do not fetch. */\n externalLogin: `${authRoot}/external-login`,\n /** GET — snapshot the in-flight external-login cookie set by the OAuth callback. */\n externalLoginPending: `${authRoot}/external-login/pending`,\n /** POST — complete an in-flight external login by registering / linking the account. */\n externalLoginConfirm: `${authRoot}/external-login/confirm`,\n /** POST — complete an in-flight external login when the user has chosen between multiple matching identities. */\n externalLoginSelect: `${authRoot}/external-login/select`,\n /** GET — write the chooser's \"remember my choice\" cookie + redirect to `returnUrl`. */\n externalLoginRememberChoice: `${authRoot}/external-login/remember-choice`,\n /** POST — swap the current cookie for the user's alt identity (the contact↔systemuser sibling). */\n switchIdentity: `${authRoot}/switch-identity`,\n /** GET — snapshot of the current user (or anonymous shape). */\n me: `${authRoot}/me`,\n\n /** Account-management endpoints under `/api/auth/manage/*`. */\n manage,\n\n /** Resolved URL for {@link externalLogin} with the provider + return URL pre-encoded. */\n getExternalLoginRoute: (provider: string, returnUrl?: string): string => {\n const query = `?provider=${encodeURIComponent(provider)}`;\n return returnUrl\n ? `${authRoot}/external-login${query}&returnUrl=${encodeURIComponent(returnUrl)}`\n : `${authRoot}/external-login${query}`;\n },\n} as const;\n\nconst api = {\n /** Base path for the API (`/api`). */\n root: apiRoot,\n\n /** Template — POST a FetchXML query to retrieve multiple records. */\n retrieveMultiple: `${apiRoot}/retrieveMultiple`,\n /** Template — GET table metadata. */\n retrieveTableMetadata: `${apiRoot}/tableMetadata/{tableLogicalName}`,\n /** Template — GET view metadata by view id (Guid-constrained route). */\n retrieveViewMetadata: `${apiRoot}/viewMetadata/{viewId}`,\n /** Template — GET every view metadata record for a table. */\n retrieveViewsForTable: `${apiRoot}/viewMetadata/{tableLogicalName}`,\n /** Template — GET localized strings for a culture. */\n retrieveLocalizedStrings: `${apiRoot}/localizedStrings/{culture}`,\n /** Template — POST a batch of OrganizationRequest payloads. */\n executeMultiple: `${apiRoot}/executeMultiple`,\n /**\n * GET — organization-wide settings sourced from the Dataverse `organization` record:\n * default currency plus file-upload constraints (blocked extensions, max upload size).\n * Replaces the legacy `/api/environmentFileSettings` endpoint.\n */\n organizationSettings: `${apiRoot}/organizationSettings`,\n /** POST — clear all server-side caches. SystemAdmin-only. */\n clearAllCaches: `${apiRoot}/caches/clear`,\n /** GET — every server-side cache name. SystemAdmin-only. */\n cacheNames: `${apiRoot}/caches`,\n /** Template — POST to clear a single named cache. SystemAdmin-only. */\n clearCache: `${apiRoot}/caches/{cacheName}/clear`,\n /**\n * GET — admin localization overview: configured sources plus the per-source\n * load records produced by the most recent warmup. SystemAdmin-only. Backs\n * the LocalizationAdmin component (Blazor-only today; React mirror TBD).\n */\n localizationOverview: `${apiRoot}/localizations/overview`,\n /**\n * GET — JSON of the keys one source contributed to one culture during the most\n * recent warmup. `sourceId` + `culture` are query-string parameters (a sourceId\n * can contain colons/slashes, so they're not path segments). SystemAdmin-only.\n */\n localizationSourceDownload: `${apiRoot}/localizations/sources/download`,\n /**\n * GET — JSON of every key the cache will serve for a culture (post-merge winning\n * values across all sources). `culture` is a query-string parameter. SystemAdmin-only.\n */\n localizationMergedDownload: `${apiRoot}/localizations/merged/download`,\n /** GET — whether translation is configured, the managed solution is installed, and the candidate target languages. SystemAdmin-only. */\n localizationTranslationAvailability: `${apiRoot}/localizations/translation/availability`,\n /** POST — translate an uploaded localization file into one or more target languages. SystemAdmin-only. */\n localizationTranslate: `${apiRoot}/localizations/translation`,\n /** Template — GET file metadata + (optionally) content for one record/column. */\n retrieveFileInfo: `${apiRoot}/files/{tableLogicalName}/{recordId}/{columnName}`,\n /** Template — POST record ids; returns file info + content for many records of one column. */\n retrieveFilesBatch: `${apiRoot}/files/{tableLogicalName}/{columnName}/batch`,\n /**\n * POST — builds an archive containing the file payload of every supplied\n * record id for the named table/column. Server returns the binary archive\n * bytes (default) or a JSON envelope when `responseFormat` is `Json`.\n */\n createFileArchive: `${apiRoot}/files/createFileArchive`,\n\n /** Resolved URL for retrieving multiple records via FetchXML. */\n getRetrieveMultipleRoute: (fetchXml: string): string =>\n `${apiRoot}/retrieveMultiple?fetchXml=${encodeURIComponent(fetchXml)}`,\n\n /**\n * Template — POST a GridDataRequest (viewId / fetchXml input modes,\n * searchText, sorts, paging, filters) and get back a shaped\n * GridDataResponse. Server-side IGridService builds the FetchXML via\n * the shared IFetchXmlQueryComposer and runs the query so the client\n * never composes FetchXML directly.\n */\n gridData: `${apiRoot}/grids/data`,\n\n /**\n * Template — POST a ChartDataRequest (Aggregate / ViewId / FetchXml\n * input modes) and get back a shaped ChartDataResponse. Server-side\n * IChartService builds the FetchXML and runs the query so the\n * client never composes FetchXML directly.\n */\n chartData: `${apiRoot}/charts/data`,\n\n /** Resolved URL for retrieving metadata for one view. */\n getRetrieveViewMetadataRoute: (viewId: string): string =>\n `${apiRoot}/viewMetadata/${viewId}`,\n\n /** Resolved URL for retrieving every view metadata record for a table. */\n getRetrieveViewsForTableRoute: (tableLogicalName: string): string =>\n `${apiRoot}/viewMetadata/${encodeURIComponent(tableLogicalName)}`,\n\n /** Resolved URL for retrieving metadata for one table. Mirrors C# behavior of not encoding the segment. */\n getRetrieveTableMetadataRoute: (tableLogicalName: string): string =>\n `${apiRoot}/tableMetadata/${tableLogicalName}`,\n\n /**\n * Resolved URL for retrieving the current user's combined\n * `TableSecurityPermission` mask for a single table. Routes through\n * the server-side `ITablePermissionCache.GetPermissionForUserAsync`\n * lookup so the client can read the table-level answer without firing\n * a grid query.\n * `GridDataResponse.tablePermissions` carries the same value when a\n * grid query happens to be in flight; this endpoint covers the other\n * cases (custom toolbars, conditional UI elsewhere on the page).\n */\n getRetrieveTablePermissionsRoute: (tableLogicalName: string): string =>\n `${apiRoot}/permissions/table/${tableLogicalName}`,\n\n /** Resolved URL for retrieving localized strings for a culture. */\n getRetrieveLocalizedStringsRoute: (culture: string): string =>\n `${apiRoot}/localizedStrings/${culture}`,\n\n /** Resolved URL for the localization-bundle manifest endpoint (version + supported locales). */\n getLocalizationBundleManifestRoute: (): string => `/localizations/version`,\n\n /**\n * Resolved URL for the per-locale thumbprints endpoint. Returns the\n * content-derived thumbprint for the default bundle plus every loaded\n * table / view at the requested locale. Mirrors C#\n * `Routes.Localizations.GetThumbprintsRoute`.\n */\n getLocalizationThumbprintsRoute: (locale: string): string =>\n `/localizations/${encodeURIComponent(locale)}/thumbprints`,\n\n /**\n * Resolved URL for the default localization-bundle file (everything outside\n * `tables.*` / `choices.*`) for a given locale + thumbprint. The thumbprint\n * is purely for cache-busting — the server returns the current bundle for\n * the locale regardless of what thumbprint is in the URL. Mirrors C#\n * `Routes.Localizations.GetDefaultBundleRoute`.\n */\n getLocalizationBundleRoute: (locale: string, thumbprint: string): string =>\n `/localizations/default/${locale}.${thumbprint}.json`,\n\n /**\n * Resolved URL for the per-table localization-bundle file. Returns every\n * `tables.{name}.*` string for the table plus the global `choices.*`\n * strings any of its columns reference. Mirrors C#\n * `Routes.Localizations.GetTableBundleRoute`.\n */\n getLocalizationTableBundleRoute: (\n tableName: string,\n locale: string,\n thumbprint: string,\n ): string =>\n `/localizations/tables/${encodeURIComponent(tableName)}/${locale}.${thumbprint}.json`,\n\n /**\n * Resolved URL for the per-view localization-bundle file. Returns every\n * `tables.{owningTable}.views.{viewId}.*` string. Owning table is resolved\n * server-side from the view id. Mirrors C# `Routes.Localizations.GetViewBundleRoute`.\n */\n getLocalizationViewBundleRoute: (\n viewId: string,\n locale: string,\n thumbprint: string,\n ): string =>\n `/localizations/views/${viewId}/${locale}.${thumbprint}.json`,\n\n /** Resolved URL for executing multiple requests. */\n getExecuteMultipleRoute: (returnResponses: boolean): string =>\n `${apiRoot}/executeMultiple?returnResponses=${returnResponses}`,\n\n /** Resolved URL for retrieving file info on one record/column. */\n getRetrieveFileInfoRoute: (\n tableLogicalName: string,\n recordId: string,\n columnName: string,\n includeData: boolean,\n ): string =>\n `${apiRoot}/files/${encodeURIComponent(tableLogicalName)}/${recordId}/${encodeURIComponent(columnName)}?includeData=${includeData}`,\n\n /** Resolved URL for the batch retrieve-files endpoint. Body is a JSON array of record ids. */\n getRetrieveFilesBatchRoute: (\n tableLogicalName: string,\n columnName: string,\n includeData: boolean,\n ): string =>\n `${apiRoot}/files/${encodeURIComponent(tableLogicalName)}/${encodeURIComponent(columnName)}/batch?includeData=${includeData}`,\n\n /** Resolved URL for clearing one named cache. */\n getClearCacheRoute: (cacheName: string): string =>\n `${apiRoot}/caches/${encodeURIComponent(cacheName)}/clear`,\n\n /** Table-scoped CRUD routes. */\n tables,\n\n /** SPA-facing authentication endpoints. */\n auth,\n} as const;\n\nconst ui = {\n localization: {\n /** Template — POST to set the culture cookie + redirect. */\n culture: 'Culture/{culture}',\n\n /** Resolved URL for setting the culture cookie. Mirrors C# behavior of not encoding either segment. */\n getCultureRoute: (culture: string, returnUrl: string): string =>\n `Culture/${culture}?redirectUri=${returnUrl}`,\n },\n} as const;\n\n/**\n * Static accessors for the framework's API and UI route groups. Mirrors the C#\n * `Routes` class — `Routes.api.auth.login` corresponds to `Routes.Api.Auth.Login`.\n */\nexport const Routes = {\n api,\n ui,\n} as const;\n","/**\n * Mirrors the C# `ProblemDetailsExceptionHandler` contract: SPA callers receive an\n * RFC 9457 `application/problem+json` body whose `exceptionType` extension carries\n * the original CLR type's full name. The transport rehydrates that into one of the\n * subclasses below so consumers can pattern-match on `instanceof` instead of on\n * an opaque HTTP error.\n */\nexport interface ProblemDetails {\n type: string | undefined;\n title: string | undefined;\n status: number | undefined;\n detail: string | undefined;\n instance: string | undefined;\n /** The original CLR exception's `Type.FullName` (e.g. `System.UnauthorizedAccessException`). */\n exceptionType: string | undefined;\n [extensionMember: string]: unknown;\n}\n\nexport interface PowerPortalsProErrorInit {\n status: number;\n url: string | undefined;\n title: string | undefined;\n detail: string | undefined;\n /** The original CLR exception's `Type.FullName` from the server. */\n clrType: string | undefined;\n /** The full problem+json body as received, when available. */\n problem: ProblemDetails | undefined;\n}\n\n/**\n * Base error thrown by `Transport` for every non-2xx response. Subclasses\n * (`UnauthorizedAccessError`, `ArgumentError`, `ArgumentNullError`,\n * `InvalidOperationError`) are constructed when the server's\n * `exceptionType` extension matches a known CLR type.\n */\nexport class PowerPortalsProError extends Error {\n readonly status: number;\n readonly url: string | undefined;\n readonly title: string | undefined;\n readonly detail: string | undefined;\n readonly clrType: string | undefined;\n readonly problem: ProblemDetails | undefined;\n\n constructor(message: string, init: PowerPortalsProErrorInit) {\n super(message);\n this.name = 'PowerPortalsProError';\n this.status = init.status;\n this.url = init.url;\n this.title = init.title;\n this.detail = init.detail;\n this.clrType = init.clrType;\n this.problem = init.problem;\n }\n}\n\nexport class UnauthorizedAccessError extends PowerPortalsProError {\n constructor(message: string, init: PowerPortalsProErrorInit) {\n super(message, init);\n this.name = 'UnauthorizedAccessError';\n }\n}\n\nexport class ArgumentError extends PowerPortalsProError {\n constructor(message: string, init: PowerPortalsProErrorInit) {\n super(message, init);\n this.name = 'ArgumentError';\n }\n}\n\nexport class ArgumentNullError extends ArgumentError {\n constructor(message: string, init: PowerPortalsProErrorInit) {\n super(message, init);\n this.name = 'ArgumentNullError';\n }\n}\n\nexport class InvalidOperationError extends PowerPortalsProError {\n constructor(message: string, init: PowerPortalsProErrorInit) {\n super(message, init);\n this.name = 'InvalidOperationError';\n }\n}\n\n/**\n * Builds the right `PowerPortalsProError` subclass for a problem+json response.\n * Mirrors the C# `MapExceptionType` switch in `PowerPortalsProService`.\n */\nexport function mapProblemDetails(\n problem: ProblemDetails,\n fallbackStatus: number,\n url: string | undefined,\n): PowerPortalsProError {\n const message =\n problem.detail\n ?? problem.title\n ?? `${problem.status ?? fallbackStatus} ${problem.title ?? 'HTTP error'}${url ? ` on ${url}` : ''}`;\n\n const init: PowerPortalsProErrorInit = {\n status: problem.status ?? fallbackStatus,\n url,\n title: problem.title,\n detail: problem.detail,\n clrType: problem.exceptionType,\n problem,\n };\n\n switch (problem.exceptionType) {\n case 'System.UnauthorizedAccessException':\n return new UnauthorizedAccessError(message, init);\n case 'System.ArgumentNullException':\n return new ArgumentNullError(message, init);\n case 'System.ArgumentException':\n return new ArgumentError(message, init);\n case 'System.InvalidOperationException':\n return new InvalidOperationError(message, init);\n default:\n return new PowerPortalsProError(message, init);\n }\n}\n","import {\n type ProblemDetails,\n PowerPortalsProError,\n mapProblemDetails,\n} from './errors.js';\n\n/**\n * Configuration for {@link Transport}. Most consumers leave the defaults: same-origin\n * fetch with the auth cookie included.\n */\nexport interface TransportOptions {\n /**\n * Base URL prepended to every request path. Defaults to the empty string, which\n * sends requests relative to the current origin (the typical case when the React\n * app is served by the same ASP.NET host that backs `/api/*`). Set this only when\n * the API lives on a different origin — and configure CORS on the server to allow\n * `Access-Control-Allow-Credentials: true` so the auth cookie survives.\n */\n baseUrl?: string;\n\n /**\n * `fetch` implementation to use. Defaults to `globalThis.fetch`. Override for tests\n * or for environments that need a polyfill.\n */\n fetchImpl?: typeof fetch;\n}\n\n/**\n * Per-request options accepted by {@link Transport.send} / {@link Transport.sendJson}.\n */\nexport interface RequestOptions {\n /** JSON-serializable request body. Omit for GET / DELETE / no-body POST. */\n body?: unknown;\n\n /** AbortSignal to cancel the request. */\n signal?: AbortSignal;\n\n /** Extra request headers, merged onto the default `Content-Type: application/json` (when a body is present). */\n headers?: Record<string, string>;\n}\n\n/**\n * Thin `fetch` wrapper that owns the cross-cutting concerns of the typed\n * client:\n *\n * 1. **Cookie auth.** Always sends `credentials: 'include'` so the ASP.NET\n * Identity cookie reaches `/api/*`.\n * 2. **JSON in / out.** Serializes the body as JSON (when present) and parses the\n * response as JSON. Sets the `Content-Type` and `Accept` headers accordingly.\n * 3. **Typed-error rehydration.** On non-2xx responses with `application/problem+json`,\n * maps the body's `exceptionType` extension to the matching\n * {@link PowerPortalsProError} subclass — `UnauthorizedAccessError`,\n * `ArgumentError`, `ArgumentNullError`, `InvalidOperationError`, or the base type\n * for unrecognized CLR exceptions. Non-problem-json failures throw the base type\n * with the raw response text as the detail.\n *\n * `Transport` is an implementation detail of the higher-level clients\n * (`AuthClient`, etc.) and is rarely consumed directly. It's exported so advanced\n * consumers can issue raw requests against endpoints not yet wrapped by a typed client.\n */\nexport class Transport {\n private readonly baseUrl: string;\n private readonly fetchImpl: typeof fetch;\n\n constructor(options: TransportOptions = {}) {\n this.baseUrl = (options.baseUrl ?? '').replace(/\\/+$/, '');\n this.fetchImpl = options.fetchImpl ?? globalThis.fetch.bind(globalThis);\n }\n\n /** Sends a request and returns the parsed JSON response body. */\n async sendJson<T>(method: string, path: string, options: RequestOptions = {}): Promise<T> {\n const response = await this.send(method, path, options);\n return (await response.json()) as T;\n }\n\n /**\n * Sends a request that may return 204 No Content. Returns `null` for the empty case\n * so the caller can branch without inspecting status codes.\n */\n async sendNullableJson<T>(method: string, path: string, options: RequestOptions = {}): Promise<T | null> {\n const response = await this.send(method, path, options);\n if (response.status === 204) return null;\n const text = await response.text();\n if (text.length === 0) return null;\n return JSON.parse(text) as T;\n }\n\n /** Sends a request and discards the response body. */\n async sendVoid(method: string, path: string, options: RequestOptions = {}): Promise<void> {\n const response = await this.send(method, path, options);\n // Drain the body so connection pooling can reuse the socket. Cheap; ignore content.\n await response.arrayBuffer().catch(() => undefined);\n }\n\n /**\n * Low-level send. Throws `PowerPortalsProError` (or a subclass) on non-2xx. Most\n * callers should use {@link sendJson}, {@link sendNullableJson}, or {@link sendVoid}.\n */\n async send(method: string, path: string, options: RequestOptions = {}): Promise<Response> {\n const url = this.baseUrl + path;\n const hasBody = options.body !== undefined;\n\n const headers: Record<string, string> = {\n Accept: 'application/json',\n ...(hasBody ? { 'Content-Type': 'application/json' } : {}),\n ...(options.headers ?? {}),\n };\n\n const init: RequestInit = {\n method,\n credentials: 'include',\n headers,\n ...(hasBody ? { body: JSON.stringify(options.body) } : {}),\n ...(options.signal ? { signal: options.signal } : {}),\n };\n\n const response = await this.fetchImpl(url, init);\n if (response.ok) return response;\n throw await this.errorFromResponse(response, url);\n }\n\n private async errorFromResponse(response: Response, url: string): Promise<PowerPortalsProError> {\n const contentType = response.headers.get('Content-Type') ?? '';\n if (contentType.toLowerCase().includes('application/problem+json')) {\n try {\n const problem = (await response.json()) as ProblemDetails;\n return mapProblemDetails(problem, response.status, url);\n } catch {\n // Body wasn't valid JSON — fall through to the generic shape below.\n }\n }\n\n let detail: string | undefined;\n try {\n const text = await response.text();\n if (text.length > 0) detail = text;\n } catch {\n // Body already consumed or unreadable; leave detail unset.\n }\n\n return new PowerPortalsProError(\n `${response.status} ${response.statusText} on ${url}`,\n {\n status: response.status,\n url,\n title: response.statusText,\n detail,\n clrType: undefined,\n problem: undefined,\n },\n );\n }\n}\n","import type { components } from './generated/api-schema.js';\nimport { Routes } from './routes.js';\nimport { Transport, type TransportOptions } from './transport.js';\n\ntype Schemas = components['schemas'];\n\n// Auth-flow request/response DTOs are pulled from the generated schema so\n// consumers see exactly the shape the server produces. Keep this list aligned\n// with the methods on AuthClient — adding a new method here means adding a\n// matching alias.\n\n// Login + registration\nexport type LoginRequest = Schemas['LoginRequest'];\nexport type LoginResponse = Schemas['LoginResponse'];\nexport type VerifyTwoFactorRequest = Schemas['VerifyTwoFactorRequest'];\nexport type VerifyTwoFactorResponse = Schemas['VerifyTwoFactorResponse'];\nexport type RegisterRequest = Schemas['RegisterRequest'];\nexport type RegisterResponse = Schemas['RegisterResponse'];\nexport type RequestPasswordResetRequest = Schemas['RequestPasswordResetRequest'];\nexport type ResetPasswordRequest = Schemas['ResetPasswordRequest'];\nexport type ResetPasswordResponse = Schemas['ResetPasswordResponse'];\nexport type ConfirmEmailRequest = Schemas['ConfirmEmailRequest'];\nexport type ConfirmEmailResponse = Schemas['ConfirmEmailResponse'];\nexport type ResendEmailConfirmationRequest = Schemas['ResendEmailConfirmationRequest'];\n\n// Session / external providers / current user\nexport type CurrentUserInfo = Schemas['CurrentUserInfo'];\nexport type ExternalLoginProviderInfo = Schemas['ExternalLoginProviderInfo'];\nexport type AuthOptionsResponse = Schemas['AuthOptionsResponse'];\n\n// External login flow\nexport type PendingExternalLoginResponse = Schemas['PendingExternalLoginResponse'];\nexport type ConfirmExternalLoginRequest = Schemas['ConfirmExternalLoginRequest'];\nexport type ConfirmExternalLoginResponse = Schemas['ConfirmExternalLoginResponse'];\nexport type SelectExternalLoginRequest = Schemas['SelectExternalLoginRequest'];\nexport type SwitchIdentityResponse = Schemas['SwitchIdentityResponse'];\n\n// Profile + password + email\nexport type ProfileResponse = Schemas['ProfileResponse'];\nexport type UpdateProfileRequest = Schemas['UpdateProfileRequest'];\nexport type SetPasswordRequest = Schemas['SetPasswordRequest'];\nexport type SetPasswordResponse = Schemas['SetPasswordResponse'];\nexport type ChangePasswordRequest = Schemas['ChangePasswordRequest'];\nexport type ChangePasswordResponse = Schemas['ChangePasswordResponse'];\nexport type ChangeEmailRequest = Schemas['ChangeEmailRequest'];\nexport type ChangeEmailResponse = Schemas['ChangeEmailResponse'];\nexport type SendEmailConfirmationResponse = Schemas['SendEmailConfirmationResponse'];\n\n// 2FA management\nexport type TwoFactorStatusResponse = Schemas['TwoFactorStatusResponse'];\nexport type AuthenticatorSetupResponse = Schemas['AuthenticatorSetupResponse'];\nexport type VerifyAuthenticatorRequest = Schemas['VerifyAuthenticatorRequest'];\nexport type VerifyAuthenticatorResponse = Schemas['VerifyAuthenticatorResponse'];\nexport type ResetAuthenticatorResponse = Schemas['ResetAuthenticatorResponse'];\nexport type Disable2faResponse = Schemas['Disable2faResponse'];\nexport type RecoveryCodesResponse = Schemas['RecoveryCodesResponse'];\nexport type Forget2faResponse = Schemas['Forget2faResponse'];\n\n// External logins management\nexport type ExternalLoginsResponse = Schemas['ExternalLoginsResponse'];\nexport type CurrentLoginInfo = Schemas['CurrentLoginInfo'];\nexport type RemoveExternalLoginRequest = Schemas['RemoveExternalLoginRequest'];\nexport type RemoveExternalLoginResponse = Schemas['RemoveExternalLoginResponse'];\n\n// Personal data\nexport type PersonalDataResponse = Schemas['PersonalDataResponse'];\nexport type DeletePersonalDataRequest = Schemas['DeletePersonalDataRequest'];\nexport type DeletePersonalDataResponse = Schemas['DeletePersonalDataResponse'];\n\n// Helper for the body+signal envelope passed to Transport.send*. Single source of\n// truth for the \"optional body / optional cancellation\" pattern repeated by every\n// method below — keeps the call sites readable and avoids the verbose conditional\n// spread that exactOptionalPropertyTypes requires.\nfunction bodyAndSignal(body: unknown, signal: AbortSignal | undefined) {\n return {\n ...(body !== undefined ? { body } : {}),\n ...(signal ? { signal } : {}),\n };\n}\n\n/**\n * SPA-facing wrapper over the framework's `/api/auth/*` endpoints — sign-\n * in, profile, 2FA, external login, forgot-password, registration, and\n * confirmation flows.\n *\n * Cookie auth flows automatically (the underlying {@link Transport} sends\n * `credentials: 'include'`), so a successful `loginAsync` leaves subsequent calls\n * authenticated without any token wiring on the React side.\n *\n * Mid-flow steps (`login → 2FA`, `register → confirm email`, `forgot → reset`) each\n * surface as their own method so the consuming SPA owns its routing/UX between steps\n * same design as the C# interface.\n */\nexport class AuthClient {\n /**\n * The underlying transport. Exposed so advanced consumers can hit auth endpoints not\n * yet wrapped by a typed method, or share a single transport with a sibling\n * {@link PowerPortalsProClient}.\n */\n readonly transport: Transport;\n\n constructor(transportOrOptions?: Transport | TransportOptions) {\n this.transport =\n transportOrOptions instanceof Transport\n ? transportOrOptions\n : new Transport(transportOrOptions);\n }\n\n // --- Login + 2FA + logout --------------------------------------------------------\n\n /**\n * Submits credentials. On success the auth cookie is set and the next\n * {@link getCurrentUserAsync} will report the user as signed in. The returned\n * `result` enum tells the caller whether to navigate (Success), prompt for 2FA\n * (RequiresTwoFactor), or show a generic error (others).\n */\n loginAsync(request: LoginRequest, signal?: AbortSignal): Promise<LoginResponse> {\n return this.transport.sendJson<LoginResponse>('POST', Routes.api.auth.login, bodyAndSignal(request, signal));\n }\n\n /** Submits the 2FA code after a {@link loginAsync} that returned `RequiresTwoFactor`. */\n verifyTwoFactorAsync(request: VerifyTwoFactorRequest, signal?: AbortSignal): Promise<VerifyTwoFactorResponse> {\n return this.transport.sendJson<VerifyTwoFactorResponse>('POST', Routes.api.auth.loginTwoFactor, bodyAndSignal(request, signal));\n }\n\n /** Clears the auth cookie. Idempotent — calling on an already-anonymous session is a no-op. */\n logoutAsync(signal?: AbortSignal): Promise<void> {\n return this.transport.sendVoid('POST', Routes.api.auth.logout, bodyAndSignal(undefined, signal));\n }\n\n // --- Registration + email confirmation -------------------------------------------\n\n /**\n * Creates a new user. When the host configured `RequireConfirmedAccount` (the default),\n * the response carries `RegisterResult.ConfirmationEmailSent` and the user is NOT\n * signed in yet — the client should surface \"check your email.\"\n */\n registerAsync(request: RegisterRequest, signal?: AbortSignal): Promise<RegisterResponse> {\n return this.transport.sendJson<RegisterResponse>('POST', Routes.api.auth.register, bodyAndSignal(request, signal));\n }\n\n /** Confirms a registered email via the registration-link token. */\n confirmEmailAsync(request: ConfirmEmailRequest, signal?: AbortSignal): Promise<ConfirmEmailResponse> {\n return this.transport.sendJson<ConfirmEmailResponse>('POST', Routes.api.auth.confirmEmail, bodyAndSignal(request, signal));\n }\n\n /** Sends a fresh confirmation email. Always 200 — the server doesn't reveal whether the email exists. */\n resendEmailConfirmationAsync(request: ResendEmailConfirmationRequest, signal?: AbortSignal): Promise<void> {\n return this.transport.sendVoid('POST', Routes.api.auth.resendEmailConfirmation, bodyAndSignal(request, signal));\n }\n\n // --- Password reset --------------------------------------------------------------\n\n /** Requests a password-reset email. Always 200 — no enumeration. */\n requestPasswordResetAsync(request: RequestPasswordResetRequest, signal?: AbortSignal): Promise<void> {\n return this.transport.sendVoid('POST', Routes.api.auth.forgotPassword, bodyAndSignal(request, signal));\n }\n\n /** Completes a password reset using the token from the reset email link. */\n resetPasswordAsync(request: ResetPasswordRequest, signal?: AbortSignal): Promise<ResetPasswordResponse> {\n return this.transport.sendJson<ResetPasswordResponse>('POST', Routes.api.auth.resetPassword, bodyAndSignal(request, signal));\n }\n\n // --- Session ---------------------------------------------------------------------\n\n /**\n * Snapshot of the current user. Anonymous requests get a non-null `CurrentUserInfo`\n * with `isAuthenticated: false` and the rest of the fields empty — call this on app\n * startup to decide whether to render signed-in UI vs. the login flow.\n */\n getCurrentUserAsync(signal?: AbortSignal): Promise<CurrentUserInfo> {\n return this.transport.sendJson<CurrentUserInfo>('GET', Routes.api.auth.me, bodyAndSignal(undefined, signal));\n }\n\n /**\n * Anonymous auth options for the sign-in UI: whether the portal accepts local\n * username/password accounts (`localAccountsEnabled`) plus the configured external\n * providers — one round-trip the login page uses to decide whether to render the\n * local form / register + reset links and which provider buttons to show.\n */\n getAuthOptionsAsync(signal?: AbortSignal): Promise<AuthOptionsResponse> {\n return this.transport.sendJson<AuthOptionsResponse>(\n 'GET', Routes.api.auth.options, bodyAndSignal(undefined, signal),\n );\n }\n\n // --- External login flow ---------------------------------------------------------\n\n /**\n * Reads the in-flight external-login cookie set by an OAuth callback. Returns\n * `null` when no callback is in flight (the endpoint replies 204) — the client\n * should redirect back to login in that case.\n */\n getPendingExternalLoginAsync(signal?: AbortSignal): Promise<PendingExternalLoginResponse | null> {\n return this.transport.sendNullableJson<PendingExternalLoginResponse>(\n 'GET', Routes.api.auth.externalLoginPending, bodyAndSignal(undefined, signal),\n );\n }\n\n /**\n * Completes an in-flight external login: registers a new local account (or links\n * the external login to an existing account with the same email) and signs the\n * user in.\n */\n confirmExternalLoginAsync(request: ConfirmExternalLoginRequest, signal?: AbortSignal): Promise<ConfirmExternalLoginResponse> {\n return this.transport.sendJson<ConfirmExternalLoginResponse>(\n 'POST', Routes.api.auth.externalLoginConfirm, bodyAndSignal(request, signal),\n );\n }\n\n /**\n * Completes an in-flight external login when the OAuth identity matched more than\n * one portal user (typically a `systemuser` AND a `contact`). Body carries only\n * the `ExternalLoginCandidateKind` the user picked from the chooser; the server\n * re-resolves the underlying record so a malicious caller can't supply an arbitrary id.\n */\n selectExternalLoginAsync(request: SelectExternalLoginRequest, signal?: AbortSignal): Promise<ConfirmExternalLoginResponse> {\n return this.transport.sendJson<ConfirmExternalLoginResponse>(\n 'POST', Routes.api.auth.externalLoginSelect, bodyAndSignal(request, signal),\n );\n }\n\n /**\n * Swaps the current auth cookie for the user's alt identity (the contact↔systemuser\n * sibling). The alt id is read from the cookie's claims server-side, so the client\n * supplies no parameters.\n */\n switchIdentityAsync(signal?: AbortSignal): Promise<SwitchIdentityResponse> {\n return this.transport.sendJson<SwitchIdentityResponse>(\n 'POST', Routes.api.auth.switchIdentity, bodyAndSignal(undefined, signal),\n );\n }\n\n // --- Profile ---------------------------------------------------------------------\n\n /** Reads the signed-in user's manage-profile snapshot (Identity status + linked contact fields). */\n getProfileAsync(signal?: AbortSignal): Promise<ProfileResponse> {\n return this.transport.sendJson<ProfileResponse>('GET', Routes.api.auth.manage.profile, bodyAndSignal(undefined, signal));\n }\n\n /** Updates first/last/mobile on the signed-in user's linked Dataverse contact. */\n updateProfileAsync(request: UpdateProfileRequest, signal?: AbortSignal): Promise<void> {\n return this.transport.sendVoid('POST', Routes.api.auth.manage.updateProfile, bodyAndSignal(request, signal));\n }\n\n // --- Password (set + change) -----------------------------------------------------\n\n /** Adds a local password to an account that doesn't have one (typically external-login-only). */\n setPasswordAsync(request: SetPasswordRequest, signal?: AbortSignal): Promise<SetPasswordResponse> {\n return this.transport.sendJson<SetPasswordResponse>('POST', Routes.api.auth.manage.setPassword, bodyAndSignal(request, signal));\n }\n\n /**\n * Changes the local password (requires the current password). On success the auth\n * cookie is refreshed so other sessions are invalidated by the security stamp rotation.\n */\n changePasswordAsync(request: ChangePasswordRequest, signal?: AbortSignal): Promise<ChangePasswordResponse> {\n return this.transport.sendJson<ChangePasswordResponse>(\n 'POST', Routes.api.auth.manage.changePassword, bodyAndSignal(request, signal),\n );\n }\n\n // --- Email (change + resend confirmation) ----------------------------------------\n\n /** Starts a change-email flow by sending a confirmation link to the new address. */\n changeEmailAsync(request: ChangeEmailRequest, signal?: AbortSignal): Promise<ChangeEmailResponse> {\n return this.transport.sendJson<ChangeEmailResponse>('POST', Routes.api.auth.manage.changeEmail, bodyAndSignal(request, signal));\n }\n\n /** Re-sends the confirmation link to the user's current (unconfirmed) email. */\n sendEmailConfirmationAsync(signal?: AbortSignal): Promise<SendEmailConfirmationResponse> {\n return this.transport.sendJson<SendEmailConfirmationResponse>(\n 'POST', Routes.api.auth.manage.sendEmailConfirmation, bodyAndSignal(undefined, signal),\n );\n }\n\n // --- 2FA management --------------------------------------------------------------\n\n /** Reads the user's two-factor configuration snapshot (enabled, has authenticator, recovery codes left). */\n getTwoFactorStatusAsync(signal?: AbortSignal): Promise<TwoFactorStatusResponse> {\n return this.transport.sendJson<TwoFactorStatusResponse>(\n 'GET', Routes.api.auth.manage.twoFactorStatus, bodyAndSignal(undefined, signal),\n );\n }\n\n /** Reads (and creates if missing) the authenticator key + QR-code URI for TOTP enrollment. */\n getAuthenticatorSetupAsync(signal?: AbortSignal): Promise<AuthenticatorSetupResponse> {\n return this.transport.sendJson<AuthenticatorSetupResponse>(\n 'GET', Routes.api.auth.manage.authenticatorSetup, bodyAndSignal(undefined, signal),\n );\n }\n\n /**\n * Verifies a code from the authenticator app to finish enabling 2FA. On success and\n * when the user has zero existing recovery codes, a fresh batch is returned in\n * `recoveryCodes`.\n */\n verifyAuthenticatorAsync(request: VerifyAuthenticatorRequest, signal?: AbortSignal): Promise<VerifyAuthenticatorResponse> {\n return this.transport.sendJson<VerifyAuthenticatorResponse>(\n 'POST', Routes.api.auth.manage.verifyAuthenticator, bodyAndSignal(request, signal),\n );\n }\n\n /** Rotates the authenticator key and disables 2FA — the user must re-enroll to re-enable. */\n resetAuthenticatorAsync(signal?: AbortSignal): Promise<ResetAuthenticatorResponse> {\n return this.transport.sendJson<ResetAuthenticatorResponse>(\n 'POST', Routes.api.auth.manage.resetAuthenticator, bodyAndSignal(undefined, signal),\n );\n }\n\n /** Disables 2FA on the account. */\n disable2faAsync(signal?: AbortSignal): Promise<Disable2faResponse> {\n return this.transport.sendJson<Disable2faResponse>('POST', Routes.api.auth.manage.disable2fa, bodyAndSignal(undefined, signal));\n }\n\n /** Regenerates recovery codes — invalidates the previous set. The new codes are returned once and only here. */\n generateRecoveryCodesAsync(signal?: AbortSignal): Promise<RecoveryCodesResponse> {\n return this.transport.sendJson<RecoveryCodesResponse>(\n 'POST', Routes.api.auth.manage.generateRecoveryCodes, bodyAndSignal(undefined, signal),\n );\n }\n\n /** Clears this browser's \"remember this machine\" 2FA cookie. */\n forget2faClientAsync(signal?: AbortSignal): Promise<Forget2faResponse> {\n return this.transport.sendJson<Forget2faResponse>(\n 'POST', Routes.api.auth.manage.forget2faClient, bodyAndSignal(undefined, signal),\n );\n }\n\n // --- External logins management --------------------------------------------------\n\n /** Lists the user's linked external logins plus available providers to add. */\n getExternalLoginsAsync(signal?: AbortSignal): Promise<ExternalLoginsResponse> {\n return this.transport.sendJson<ExternalLoginsResponse>(\n 'GET', Routes.api.auth.manage.externalLogins, bodyAndSignal(undefined, signal),\n );\n }\n\n /**\n * Reads the combined sign-in-paths snapshot (linked external logins + whether the\n * account has a local password). Used by the manage-external-logins UI to decide\n * whether unlinking a given external login would lock the user out.\n */\n getCurrentLoginInfoAsync(signal?: AbortSignal): Promise<CurrentLoginInfo> {\n return this.transport.sendJson<CurrentLoginInfo>(\n 'GET', Routes.api.auth.manage.loginInfo, bodyAndSignal(undefined, signal),\n );\n }\n\n /** Removes one external login from the signed-in user. */\n removeExternalLoginAsync(request: RemoveExternalLoginRequest, signal?: AbortSignal): Promise<RemoveExternalLoginResponse> {\n return this.transport.sendJson<RemoveExternalLoginResponse>(\n 'POST', Routes.api.auth.manage.removeExternalLogin, bodyAndSignal(request, signal),\n );\n }\n\n // --- Personal data ---------------------------------------------------------------\n\n /** Returns every `[PersonalData]`-marked Identity property + linked external logins. */\n getPersonalDataAsync(signal?: AbortSignal): Promise<PersonalDataResponse> {\n return this.transport.sendJson<PersonalDataResponse>(\n 'GET', Routes.api.auth.manage.personalData, bodyAndSignal(undefined, signal),\n );\n }\n\n /**\n * Permanently deletes the user's account. When the account has a local password,\n * `request.password` is required — `RequireLocalPassword` in the response means\n * the client should prompt and retry.\n */\n deletePersonalDataAsync(request: DeletePersonalDataRequest, signal?: AbortSignal): Promise<DeletePersonalDataResponse> {\n return this.transport.sendJson<DeletePersonalDataResponse>(\n 'POST', Routes.api.auth.manage.deletePersonalData, bodyAndSignal(request, signal),\n );\n }\n}\n","import { PowerPortalsProError } from './errors.js';\nimport type { components } from './generated/api-schema.js';\nimport type { TableSecurityPermission } from './generated/result-codes.js';\nimport { Routes } from './routes.js';\nimport { Transport, type TransportOptions } from './transport.js';\n\ntype Schemas = components['schemas'];\n\n// Records\nexport type TableRecord = Schemas['TableRecord'];\nexport type TableRecordReference = Schemas['TableRecordReference'];\nexport type CreateResponse = Schemas['CreateResponse'];\nexport type UpdateResponse = Schemas['UpdateResponse'];\nexport type DeleteResponse = Schemas['DeleteResponse'];\nexport type RetrieveRecordsResponse = Schemas['RetrieveRecordsResponse'];\nexport type GridDataRequest = Schemas['GridDataRequest'];\nexport type GridDataResponse = Schemas['GridDataResponse'];\nexport type ResolvedColumn = Schemas['ResolvedColumn'];\nexport type ColumnSort = Schemas['ColumnSort'];\n\n// Filter shapes — discriminated union under `GridDataRequest.filters`.\n// `GridFilterBase` is the union itself; the per-variant type is the\n// `$type`-narrowed shape that callers construct directly. The relationship\n// filter covers both one-to-many (SubGrid) and many-to-many (SubGrid +\n// ManyToManyLookupEdit pool) — the server resolves the arity from the\n// parent's table metadata at apply time, so clients don't have to predict\n// or fetch parent metadata up front. The generator names the variant\n// `GridFilterBaseRelationshipFilter`; aliased to a friendlier name so\n// consumer code reads naturally.\nexport type GridFilterBase = Schemas['GridFilterBase'];\nexport type RelationshipFilter = Schemas['GridFilterBaseRelationshipFilter'];\n\n// Batched operations. `OrganizationRequest` / `OrganizationResponse` are\n// discriminated unions over Create / Update / Delete / Associate /\n// Disassociate plus the base shape. The MainContext save flow collects\n// these across the descendant tree and ships them in one\n// executeMultiple round-trip for transactional save semantics.\nexport type OrganizationRequest = Schemas['OrganizationRequest'];\nexport type OrganizationResponse = Schemas['OrganizationResponse'];\nexport type CreateRequest = Schemas['OrganizationRequestCreateRequest'];\nexport type UpdateRequest = Schemas['OrganizationRequestUpdateRequest'];\nexport type DeleteRequest = Schemas['OrganizationRequestDeleteRequest'];\nexport type AssociateRequest = Schemas['OrganizationRequestAssociateRequest'];\nexport type DisassociateRequest = Schemas['OrganizationRequestDisassociateRequest'];\n\n// Metadata\nexport type TableMetadata = Schemas['TableMetadata'];\nexport type ViewMetadata = Schemas['ViewMetadata'];\n\n// Charts. The server's IChartService owns FetchXML construction +\n// record shaping; the client just sends the typed request and consumes\n// the typed response.\n// `DataPoint` is a polymorphic union: a bare data point or a\n// `DataverseDataPoint` (carries the originating TableRecord). The\n// openapi-typescript generator names the variants\n// `DataPointDataverseDataPoint` / `DataPointBase`; we alias them to\n// friendlier names so consumer code reads naturally.\nexport type ChartDataRequest = Schemas['ChartDataRequest'];\nexport type ChartDataResponse = Schemas['ChartDataResponse'];\nexport type AggregateChartConfig = Schemas['AggregateChartConfig'];\nexport type ChartAggregation = Schemas['ChartAggregation'];\nexport type ChartGrouping = Schemas['ChartGrouping'];\nexport type ChartData = Schemas['ChartData'];\nexport type ChartDataset = Schemas['ChartDataset'];\nexport type DataPoint = Schemas['DataPoint'];\nexport type BaseDataPoint = Schemas['DataPointBase'];\nexport type DataverseDataPoint = Schemas['DataPointDataverseDataPoint'];\nexport type ChartLinkedEntity = Schemas['ChartLinkedEntity'];\n\n// Files\nexport type FileInfo = Schemas['FileInfo'];\nexport type CreateFileArchiveRequest = Schemas['CreateFileArchiveRequest'];\n\n// Organization-wide settings sourced from the Dataverse `organization`\n// record — currently exposes the org's default currency plus the\n// file-upload constraints (blockedFileExtensions, maxUploadFileSizeInBytes).\n// Replaces the legacy `EnvironmentFileSettings` surface.\nexport type OrganizationSettings = Schemas['OrganizationSettings'];\nexport type Currency = Schemas['Currency'];\nexport type FileArchiveJsonResponse = Schemas['FileArchiveJsonResponse'];\n\n/**\n * Client-side result of {@link PowerPortalsProClient.createFileArchiveAsync}.\n * Carries the archive bytes plus the metadata derived from the server's\n * `Content-Disposition` / `Content-Type` headers (binary path) or from the\n * JSON envelope (JSON path). Matches the C# `FileArchiveResult` shape so\n * the two stacks have a single mental model for the operation.\n */\nexport interface FileArchiveResult {\n /** Suggested download filename (e.g. `\"ppp_file-files.zip\"`). */\n readonly fileName: string;\n /** MIME type for the archive bytes. */\n readonly contentType: string;\n /** Archive bytes — empty when no source record produced a usable file. */\n readonly data: Uint8Array;\n}\n\n// Localization\n// Both records are emitted by the OpenAPI generator from their C# definitions\n// (`PowerPortalsPro.Web.Common.Models.LocalizationBundleManifest` /\n// `LocalizationManifestForLocale`). Re-exported here as the canonical names\n// so callers can `import { LocalizationBundleManifest } from '@powerportalspro/core'`\n// without spelunking through the generated schema namespace.\nexport type LocalizationBundleManifest = Schemas['LocalizationBundleManifest'];\nexport type LocalizationManifestForLocale = Schemas['LocalizationManifestForLocale'];\n\n// Localization translation — the admin upload→translate→download workflow. Byte payloads\n// (`sourceContent` on the request; `content` / `zipContent` on the result) are base64\n// strings on the wire.\nexport type TranslationAvailability = Schemas['TranslationAvailability'];\nexport type TranslationLanguageOption = Schemas['TranslationLanguageOption'];\nexport type TranslationRequest = Schemas['TranslationRequest'];\nexport type TranslationResult = Schemas['TranslationResult'];\nexport type TranslatedFile = Schemas['TranslatedFile'];\n\n// Localization admin overview — the configured pipeline plus the per-source load\n// records from the most recent warmup. Backs the `<LocalizationAdmin />` panel.\nexport type LocalizationOverview = Schemas['LocalizationOverview'];\nexport type LocalizationPipelineConfiguration = Schemas['LocalizationPipelineConfiguration'];\nexport type LocalizationSourceLoad = Schemas['LocalizationSourceLoad'];\nexport type LocalizationSourceKind = Schemas['LocalizationSourceKind'];\nexport type LocalizationSourceStatus = Schemas['LocalizationSourceStatus'];\n\n/**\n * A localization file pulled from the per-source or merged download endpoint:\n * the UTF-8 JSON bytes plus the server-suggested filename (parsed from the\n * `Content-Disposition` header). Mirrors the C# `LocalizationDownload` shape so\n * both stacks share one mental model. The download methods return `null` (not\n * this) when the server has nothing for the requested source/culture (404).\n */\nexport interface LocalizationFileDownload {\n /** Server-suggested download filename (already includes the culture + `.json`). */\n readonly fileName: string;\n /** UTF-8-encoded JSON body. */\n readonly data: Uint8Array;\n}\n\n// Cache administration — one report row per registered server-side cache. `elapsedMs`\n// is `number | string` on the wire because it maps from a C# `long` (int64), which\n// openapi-typescript widens to allow the JSON-number-precision-safe string form.\nexport type CacheClearResult = Schemas['CacheClearResult'];\n\n/**\n * SPA-facing wrapper over the framework's record / metadata / file endpoints\n * under `/api/*`. Flat surface, no sub-namespacing — CRUD, metadata, files,\n * and aggregate-chart calls all live at the root.\n *\n * Authentication is a separate concern handled by {@link AuthClient}, which\n * sits beside this class with its own surface.\n *\n * @example\n * ```ts\n * const ppp = new PowerPortalsProClient();\n * const account = await ppp.retrieveRecordAsync('account', accountId, ['name']);\n * const cols = await ppp.retrieveTableMetadataAsync('account');\n * ```\n */\nexport class PowerPortalsProClient {\n /**\n * The underlying transport. Exposed so advanced consumers can hit endpoints not yet\n * wrapped by a typed method (caches, executeMultiple, associate/disassociate, …).\n * Cookie auth, JSON in/out, and problem+json error rehydration apply automatically\n * because the transport owns those concerns.\n */\n readonly transport: Transport;\n\n constructor(transportOrOptions?: Transport | TransportOptions) {\n this.transport =\n transportOrOptions instanceof Transport\n ? transportOrOptions\n : new Transport(transportOrOptions);\n }\n\n // --- Records (CRUD + FetchXML) ---------------------------------------------------\n\n /**\n * Creates a new record. URL is derived from `record.tableName`. The server\n * marks every property as modified before applying so column values\n * arriving from JSON (which carry no dirty flags) round-trip correctly.\n */\n createRecordAsync(record: TableRecord, signal?: AbortSignal): Promise<CreateResponse> {\n return this.transport.sendJson<CreateResponse>(\n 'POST',\n Routes.api.tables.getCreateRoute(record.tableName),\n { body: record, ...(signal ? { signal } : {}) },\n );\n }\n\n /**\n * Reads a single record. `columns` (logical names) narrows the projection to a subset;\n * omit it for the table's full set of columns visible to the caller.\n */\n retrieveRecordAsync(\n tableLogicalName: string,\n recordId: string,\n columns?: readonly string[],\n signal?: AbortSignal,\n ): Promise<TableRecord> {\n return this.transport.sendJson<TableRecord>(\n 'GET',\n Routes.api.tables.getRetrieveRoute(tableLogicalName, recordId, columns),\n signal ? { signal } : {},\n );\n }\n\n // --- Localization translation (admin) --------------------------------------------\n\n /**\n * Probes whether the localization-translation feature is usable: whether a translation\n * provider is configured, whether the managed solution is installed, and the candidate\n * target languages (the portal's cultures annotated with provider-translatability).\n * SystemAdmin-gated.\n */\n getTranslationAvailabilityAsync(signal?: AbortSignal): Promise<TranslationAvailability> {\n return this.transport.sendJson<TranslationAvailability>(\n 'GET',\n Routes.api.localizationTranslationAvailability,\n signal ? { signal } : {},\n );\n }\n\n /**\n * Translates an uploaded localization file into one or more target languages, reusing the\n * Dataverse translation memory. Returns one file per language (base64 `content`) plus a zip\n * of all and translated-vs-reused counts. SystemAdmin-gated.\n */\n translateLocalizationFileAsync(\n request: TranslationRequest,\n signal?: AbortSignal,\n ): Promise<TranslationResult> {\n return this.transport.sendJson<TranslationResult>(\n 'POST',\n Routes.api.localizationTranslate,\n { body: request, ...(signal ? { signal } : {}) },\n );\n }\n\n // --- Localization admin overview (admin) -----------------------------------------\n\n /**\n * Reads the admin localization overview: the configured warmup pipeline plus the\n * per-source load records (load order, source kind, cultures touched, key counts,\n * how many keys overrode an earlier source, duration, status) from the most recent\n * warmup. Backs the `<LocalizationAdmin />` panel. SystemAdmin-gated.\n */\n getLocalizationOverviewAsync(signal?: AbortSignal): Promise<LocalizationOverview> {\n return this.transport.sendJson<LocalizationOverview>(\n 'GET',\n Routes.api.localizationOverview,\n signal ? { signal } : {},\n );\n }\n\n /**\n * Downloads the JSON one source contributed to one culture during the most recent\n * warmup — a translation-handoff snapshot. Returns `null` when the source/culture\n * pair isn't tracked (the server answers 404 — cache cleared, source removed, or\n * the culture has no entries for that source). SystemAdmin-gated.\n */\n downloadLocalizationSourceAsync(\n sourceId: string,\n culture: string,\n signal?: AbortSignal,\n ): Promise<LocalizationFileDownload | null> {\n const query = new URLSearchParams({ sourceId, culture }).toString();\n return this.downloadLocalizationFile(\n `${Routes.api.localizationSourceDownload}?${query}`,\n signal,\n );\n }\n\n /**\n * Downloads the merged JSON of every key the cache will serve for a culture (the\n * post-merge winning value across all sources) — a complete-snapshot reference.\n * Returns `null` when the culture has no entries (404). SystemAdmin-gated.\n */\n downloadMergedLocalizationsAsync(\n culture: string,\n signal?: AbortSignal,\n ): Promise<LocalizationFileDownload | null> {\n const query = new URLSearchParams({ culture }).toString();\n return this.downloadLocalizationFile(\n `${Routes.api.localizationMergedDownload}?${query}`,\n signal,\n );\n }\n\n /**\n * Shared binary-download path for the two localization download endpoints. Reads\n * the raw bytes via `response.arrayBuffer()` and derives the filename from the\n * `Content-Disposition` header (matching {@link createFileArchiveAsync}). Maps a\n * 404 to `null` so callers can show a \"nothing to download\" message instead of\n * surfacing it as an error.\n */\n private async downloadLocalizationFile(\n path: string,\n signal?: AbortSignal,\n ): Promise<LocalizationFileDownload | null> {\n try {\n const response = await this.transport.send('GET', path, signal ? { signal } : {});\n const fileName =\n parseContentDispositionFileName(response.headers.get('Content-Disposition')) ??\n 'localization.json';\n const buffer = await response.arrayBuffer();\n return { fileName, data: new Uint8Array(buffer) };\n } catch (error) {\n if (error instanceof PowerPortalsProError && error.status === 404) return null;\n throw error;\n }\n }\n\n // --- Cache administration (admin) ------------------------------------------------\n\n /**\n * Lists every registered server-side cache by name — the values that\n * {@link clearCacheAsync} accepts. Backs the per-cache buttons on an admin\n * \"clear caches\" page; render them sorted client-side for a stable order.\n * SystemAdmin-gated.\n */\n getCacheNamesAsync(signal?: AbortSignal): Promise<readonly string[]> {\n return this.transport.sendJson<readonly string[]>(\n 'GET',\n Routes.api.cacheNames,\n signal ? { signal } : {},\n );\n }\n\n /**\n * Clears every registered server-side cache and returns one\n * {@link CacheClearResult} per cache (name, success flag, error, elapsed ms).\n * Per-cache failures are reported in the result rows rather than thrown, so a\n * single misbehaving cache doesn't abort the rest — inspect `succeeded` on each\n * row. SystemAdmin-gated.\n */\n clearAllCachesAsync(signal?: AbortSignal): Promise<readonly CacheClearResult[]> {\n return this.transport.sendJson<readonly CacheClearResult[]>(\n 'POST',\n Routes.api.clearAllCaches,\n signal ? { signal } : {},\n );\n }\n\n /**\n * Clears a single named cache (case-insensitive match against\n * {@link getCacheNamesAsync}). Returns the {@link CacheClearResult}, or `null`\n * when no cache by that name is registered (the server answers 404). A clear\n * that runs but throws internally comes back as a result row with\n * `succeeded: false` — that's distinct from the not-found `null`.\n * SystemAdmin-gated.\n */\n async clearCacheAsync(name: string, signal?: AbortSignal): Promise<CacheClearResult | null> {\n try {\n return await this.transport.sendJson<CacheClearResult>(\n 'POST',\n Routes.api.getClearCacheRoute(name),\n signal ? { signal } : {},\n );\n } catch (error) {\n // 404 → the cache name isn't registered; mirror the C# service contract\n // (ClearCacheAsync returns null) instead of surfacing it as an error.\n if (error instanceof PowerPortalsProError && error.status === 404) return null;\n throw error;\n }\n }\n\n /**\n * Runs a FetchXML query and returns the matching records plus paging info.\n * The query is the FetchXML XML literal — the same format Dataverse natively accepts.\n */\n retrieveRecordsAsync(fetchXml: string, signal?: AbortSignal): Promise<RetrieveRecordsResponse> {\n return this.transport.sendJson<RetrieveRecordsResponse>(\n 'GET',\n Routes.api.getRetrieveMultipleRoute(fetchXml),\n signal ? { signal } : {},\n );\n }\n\n /**\n * Loads grid data via the server-side <c>IGridService</c>. The request\n * picks a base query — a stored Dataverse view (<c>viewId</c>) or a\n * caller-supplied FetchXML (<c>fetchXml</c>) — and the server applies\n * the framework's <c>*</c>/<c>%</c> wildcard convention, AND-merges\n * the search filter into the source's existing filter, dispatches to\n * per-column-type search semantics (string <c>like</c>, choice label\n * match → integer <c>in</c>, lookup link-entity + primary-name match,\n * etc.), and projects each column to a {@link ResolvedColumn} so the\n * client can render headers + dispatch cells without a separate\n * metadata round-trip.\n *\n * At least one of <c>request.viewId</c> or <c>request.fetchXml</c> must\n * be supplied (neither returns a 400). Both may be supplied together — the\n * <c>fetchXml</c> is the query and the <c>viewId</c> names the view for\n * localized column-title resolution.\n *\n * Mirrors how the is consumed\n * `@powerportalspro/react`'s `useGridData` hook calls this method\n * internally, so most consumers don't invoke it directly.\n */\n loadGridAsync(\n request: GridDataRequest,\n signal?: AbortSignal,\n ): Promise<GridDataResponse> {\n return this.transport.sendJson<GridDataResponse>(\n 'POST',\n Routes.api.gridData,\n { body: request, ...(signal ? { signal } : {}) },\n );\n }\n\n /**\n * Updates an existing record. URL is derived from `record.tableName` and `record.id`\n * `record.id` must be set. For a new record, use {@link createRecordAsync} instead.\n */\n updateRecordAsync(record: TableRecord, signal?: AbortSignal): Promise<UpdateResponse> {\n if (!record.id) {\n throw new Error(\n 'PowerPortalsProClient.updateRecordAsync requires record.id. Use createRecordAsync for new records.',\n );\n }\n return this.transport.sendJson<UpdateResponse>(\n 'PATCH',\n Routes.api.tables.getUpdateRoute(record.tableName, record.id),\n { body: record, ...(signal ? { signal } : {}) },\n );\n }\n\n /**\n * Executes a batch of {@link OrganizationRequest}s as a single round-trip.\n * The MainContext save flow uses this to ship every dirty descendant's\n * requests in one shot so a multi-record save lands transactionally\n * server-side.\n *\n * When `returnResponses` is `true` (default), the response array carries\n * one `OrganizationResponse` per request in submission order — useful for\n * `CreateRequest` cases that need the newly-allocated record id. Pass\n * `false` for fire-and-forget batches to skip the response payload.\n */\n executeMultipleAsync(\n requests: readonly OrganizationRequest[],\n options?: { returnResponses?: boolean; signal?: AbortSignal },\n ): Promise<OrganizationResponse[]> {\n const returnResponses = options?.returnResponses ?? true;\n return this.transport.sendJson<OrganizationResponse[]>(\n 'POST',\n Routes.api.getExecuteMultipleRoute(returnResponses),\n {\n body: requests as OrganizationRequest[],\n ...(options?.signal ? { signal: options.signal } : {}),\n },\n );\n }\n\n /** Deletes the record with the given id from the given table. */\n deleteRecordAsync(\n tableLogicalName: string,\n recordId: string,\n signal?: AbortSignal,\n ): Promise<DeleteResponse> {\n return this.transport.sendJson<DeleteResponse>(\n 'DELETE',\n Routes.api.tables.getDeleteRoute(tableLogicalName, recordId),\n signal ? { signal } : {},\n );\n }\n\n // --- Charts ----------------------------------------------------------------------\n\n /**\n * Loads chart data via the server-side <c>IChartService</c>. The\n * request body picks one of three input modes — typed aggregate\n * config, saved-view id, or raw FetchXML — plus the label/value\n * columns to shape the response. Server builds the FetchXML, runs the\n * query, performs the multi-series pivot, and applies combined\n * date-label formatting using the request culture.\n *\n * Mirrors how the is consumed\n * `@powerportalspro/react-charts`'s `DataverseChartDataSource` family\n * calls this method internally, so most consumers don't invoke it\n * directly.\n */\n loadChartAsync(\n request: ChartDataRequest,\n signal?: AbortSignal,\n ): Promise<ChartDataResponse> {\n return this.transport.sendJson<ChartDataResponse>(\n 'POST',\n Routes.api.chartData,\n { body: request, ...(signal ? { signal } : {}) },\n );\n }\n\n // --- Metadata --------------------------------------------------------------------\n\n /** Reads the metadata describing the columns and relationships of a single Dataverse table. */\n retrieveTableMetadataAsync(\n tableLogicalName: string,\n signal?: AbortSignal,\n ): Promise<TableMetadata> {\n return this.transport.sendJson<TableMetadata>(\n 'GET',\n Routes.api.getRetrieveTableMetadataRoute(tableLogicalName),\n signal ? { signal } : {},\n );\n }\n\n /**\n * Returns the current user's combined table-level `TableSecurityPermission`\n * bitmask for `tableLogicalName` — the bitwise union of Read / Create /\n * Write / Delete / Append / AppendTo flags any registered\n * `ITablePermissionHandler` allows for that user on that table. Routed\n * server-side through the cached `ITablePermissionCache` lookup.\n *\n * Wrapped by the `useTablePermissions(tableName)` React hook with\n * in-flight-promise dedup; reach for the raw client only when you're\n * outside React (e.g. a stand-alone script) or need an imperative\n * one-off check.\n *\n * Returns `0` (`TableSecurityPermission.None`) when the user has no\n * permissions on the table; consumers compare via bit math (e.g.\n * `(permissions & TableSecurityPermission.Create) === TableSecurityPermission.Create`).\n */\n retrieveTablePermissionsAsync(\n tableLogicalName: string,\n signal?: AbortSignal,\n ): Promise<TableSecurityPermission> {\n return this.transport.sendJson<TableSecurityPermission>(\n 'GET',\n Routes.api.getRetrieveTablePermissionsRoute(tableLogicalName),\n signal ? { signal } : {},\n );\n }\n\n /** Reads metadata for a single view by its Dataverse view id (a GUID). */\n retrieveViewMetadataAsync(viewId: string, signal?: AbortSignal): Promise<ViewMetadata> {\n return this.transport.sendJson<ViewMetadata>(\n 'GET',\n Routes.api.getRetrieveViewMetadataRoute(viewId),\n signal ? { signal } : {},\n );\n }\n\n /**\n * Lists every view metadata record for a table — used by view-pickers and default-view\n * resolution. Server-side caching means this is a single Dataverse hit per table per\n * server lifetime.\n */\n retrieveViewsForTableAsync(\n tableLogicalName: string,\n signal?: AbortSignal,\n ): Promise<readonly ViewMetadata[]> {\n return this.transport.sendJson<readonly ViewMetadata[]>(\n 'GET',\n Routes.api.getRetrieveViewsForTableRoute(tableLogicalName),\n signal ? { signal } : {},\n );\n }\n\n // --- Localization ----------------------------------------------------------------\n\n /**\n * Retrieves the version manifest — just the supported-locale codes.\n * Clients fetch this on app startup, resolve which locale to use, then\n * call {@link retrieveLocalizationThumbprintsAsync} for the per-resource\n * thumbprints at that locale. Cached `no-cache` server-side so a new\n * release is detected on next page load.\n */\n retrieveLocalizationBundleManifestAsync(\n signal?: AbortSignal,\n ): Promise<LocalizationBundleManifest> {\n return this.transport.sendJson<LocalizationBundleManifest>(\n 'GET',\n Routes.api.getLocalizationBundleManifestRoute(),\n signal ? { signal } : {},\n );\n }\n\n /**\n * Retrieves the per-resource thumbprints for a single locale — the\n * default-bundle thumbprint plus thumbprints for every loaded table / view.\n * Returned from a separate endpoint (vs being baked into the version\n * manifest) so the manifest stays small even at large environment scale.\n * Cached `no-cache` server-side; the per-resource immutable URLs do the\n * heavy caching once these are read.\n */\n retrieveLocalizationThumbprintsAsync(\n locale: string,\n signal?: AbortSignal,\n ): Promise<LocalizationManifestForLocale> {\n return this.transport.sendJson<LocalizationManifestForLocale>(\n 'GET',\n Routes.api.getLocalizationThumbprintsRoute(locale),\n signal ? { signal } : {},\n );\n }\n\n /**\n * Resolved URL for the default localization-bundle file at the given\n * locale + thumbprint. Convenience wrapper around the {@link Routes}\n * helper.\n */\n getLocalizationBundleUrl(locale: string, thumbprint: string): string {\n return Routes.api.getLocalizationBundleRoute(locale, thumbprint);\n }\n\n /**\n * Fetches the default localization-bundle file (everything outside\n * `tables.*` / `choices.*`) for the given locale + thumbprint. Returns\n * the nested-object shape the source JSON files use\n * (`{ app: { buttons: { … } } }`).\n *\n * Per-table and per-view strings come from\n * {@link retrieveLocalizationTableBundleAsync} and\n * {@link retrieveLocalizationViewBundleAsync} — fetched in parallel by the\n * runtime when source-generator-emitted `tables.{name}` / `views.{viewId}`\n * tokens are passed to the localizer's prefix-load hook.\n *\n * The thumbprint is purely cosmetic (server doesn't validate it). Pass\n * the thumbprint from the manifest so the URL is unique per release and\n * the browser's HTTP cache serves subsequent loads from disk.\n */\n retrieveLocalizationBundleAsync(\n locale: string,\n thumbprint: string,\n signal?: AbortSignal,\n ): Promise<Record<string, unknown>> {\n return this.transport.sendJson<Record<string, unknown>>(\n 'GET',\n Routes.api.getLocalizationBundleRoute(locale, thumbprint),\n signal ? { signal } : {},\n );\n }\n\n /**\n * Fetches a per-table localization bundle. Returns every `tables.{name}.*`\n * string for the table plus the global `choices.*` strings any of its\n * columns reference. Owning-side resolution: the server reads the table's\n * column metadata to find which global option sets to include.\n *\n * Pass the thumbprint from the matching locale entry of the manifest so\n * the URL is unique per release; the browser caches the response under\n * `Cache-Control: immutable, max-age=31536000`.\n */\n retrieveLocalizationTableBundleAsync(\n tableName: string,\n locale: string,\n thumbprint: string,\n signal?: AbortSignal,\n ): Promise<Record<string, unknown>> {\n return this.transport.sendJson<Record<string, unknown>>(\n 'GET',\n Routes.api.getLocalizationTableBundleRoute(tableName, locale, thumbprint),\n signal ? { signal } : {},\n );\n }\n\n /**\n * Fetches a per-view localization bundle. Returns every\n * `tables.{owningTable}.views.{viewId}.*` string. The owning table is\n * resolved server-side from the view id, so the client only needs to pass\n * the id (lowercased GUID, no braces).\n *\n * Pass the thumbprint from the matching locale entry of the manifest so\n * the URL is unique per release; the browser caches the response under\n * `Cache-Control: immutable, max-age=31536000`.\n */\n retrieveLocalizationViewBundleAsync(\n viewId: string,\n locale: string,\n thumbprint: string,\n signal?: AbortSignal,\n ): Promise<Record<string, unknown>> {\n return this.transport.sendJson<Record<string, unknown>>(\n 'GET',\n Routes.api.getLocalizationViewBundleRoute(viewId, locale, thumbprint),\n signal ? { signal } : {},\n );\n }\n\n /**\n * Retrieves the FULL localized-strings catalog for a culture. The server\n * already merges Dataverse-metadata-derived strings (table / column /\n * choice-option labels) with the framework JSON files and any consumer\n * override files (last-wins). Use this to seed the React-side localizer\n * with one round-trip.\n *\n * Returned shape is a nested object that mirrors the source JSON files\n * `{ app: { buttons: { save: { label: \"Save\" } } }, tables: { contact: ... } }`.\n * The client typically flattens this to dotted-key form for `t()` lookup\n * (see {@link flattenStrings} in `@powerportalspro/react`).\n *\n * @param culture culture code matching what server-side ASP.NET request\n * localization recognizes — e.g. `\"en\"`, `\"es\"`, `\"fr-CA\"`. Falls back\n * to the default culture server-side when the value isn't supported.\n */\n retrieveLocalizedStringsAsync(\n culture: string,\n signal?: AbortSignal,\n ): Promise<Record<string, unknown>> {\n return this.transport.sendJson<Record<string, unknown>>(\n 'GET',\n Routes.api.getRetrieveLocalizedStringsRoute(culture),\n signal ? { signal } : {},\n );\n }\n\n // --- Files -----------------------------------------------------------------------\n\n /**\n * Reads file metadata for one record/column pair, optionally including the binary\n * payload. When `includeData` is false (the default), the response carries name,\n * size, and content type but not the bytes — useful for rendering a download link\n * that fetches lazily on click.\n */\n getFileInfoAsync(\n tableLogicalName: string,\n recordId: string,\n columnName: string,\n includeData = false,\n signal?: AbortSignal,\n ): Promise<FileInfo> {\n return this.transport.sendJson<FileInfo>(\n 'GET',\n Routes.api.getRetrieveFileInfoRoute(tableLogicalName, recordId, columnName, includeData),\n signal ? { signal } : {},\n );\n }\n\n /**\n * Batched read for many records of the same table/column — feeds the FileGrid's\n * \"Download All\" / \"Download Selected\" flows in one round-trip. Permission checks\n * still apply per-record server-side, so dropped rows (deleted, unauthorized,\n * file-missing) just don't appear in the response.\n */\n getFileInfosAsync(\n tableLogicalName: string,\n recordIds: readonly string[],\n columnName: string,\n includeData = false,\n signal?: AbortSignal,\n ): Promise<readonly FileInfo[]> {\n return this.transport.sendJson<readonly FileInfo[]>(\n 'POST',\n Routes.api.getRetrieveFilesBatchRoute(tableLogicalName, columnName, includeData),\n { body: recordIds, ...(signal ? { signal } : {}) },\n );\n }\n\n /**\n * Builds an archive containing the file payload of every supplied record id for the\n * named table/column. Replaces the older client-side \"fetch each file + zip in the\n * browser\" path with a single server-side step — no base64 round-trip on the wire.\n *\n * Two response shapes, selected by `request.responseFormat`:\n *\n * - **BinaryStream** (default): the server returns the raw archive bytes; this\n * method reads them via `response.arrayBuffer()` and wraps the result in a\n * {@link FileArchiveResult}, deriving `fileName` from the `Content-Disposition`\n * header and `contentType` from `Content-Type`. Most consumers want this path.\n * - **Json**: the server returns a {@link FileArchiveJsonResponse} envelope with\n * the archive bytes base64-encoded. Useful for test harnesses, service workers,\n * or callers that need to inspect filename/size before triggering a download.\n *\n * Either way, the returned `data` is empty (`Uint8Array(0)`) when none of the\n * supplied records produced a usable file — the caller can surface a \"nothing to\n * download\" message instead of streaming an empty archive.\n */\n async createFileArchiveAsync(\n request: CreateFileArchiveRequest,\n signal?: AbortSignal,\n ): Promise<FileArchiveResult> {\n if (request.responseFormat === 1 /* FileArchiveResponseFormat.Json */) {\n const json = await this.transport.sendJson<FileArchiveJsonResponse>(\n 'POST',\n Routes.api.createFileArchive,\n { body: request, ...(signal ? { signal } : {}) },\n );\n return {\n fileName: json.fileName,\n contentType: json.contentType,\n data: base64ToUint8Array(json.data),\n };\n }\n\n const response = await this.transport.send(\n 'POST',\n Routes.api.createFileArchive,\n { body: request, ...(signal ? { signal } : {}) },\n );\n\n const fileName =\n parseContentDispositionFileName(response.headers.get('Content-Disposition')) ??\n `${request.tableName}-files.zip`;\n const contentType =\n response.headers.get('Content-Type')?.split(';')[0]?.trim() ?? 'application/octet-stream';\n const buffer = await response.arrayBuffer();\n return { fileName, contentType, data: new Uint8Array(buffer) };\n }\n\n /**\n * Reads the environment-wide file upload settings (blocked extension list, max\n * upload size in KB). UI consumers use this to validate uploads client-side before\n * the round-trip, mirroring what the server enforces.\n */\n /**\n * Reads the org-wide settings sourced from the Dataverse `organization`\n * record: default currency plus file-upload constraints\n * (`blockedFileExtensions`, `maxUploadFileSizeInBytes`). Replaces the legacy\n * `getEnvironmentFileSettingsAsync` — file fields now live on this combined\n * response.\n * <para>\n * Primary consumers:\n * </para>\n * - Create-mode `<MoneyEdit>` reads `defaultCurrency` to render the right\n * symbol on brand-new records before save.\n * - File editors / FileGrid read the two file fields to reject invalid\n * uploads client-side before the round-trip.\n */\n getOrganizationSettingsAsync(signal?: AbortSignal): Promise<OrganizationSettings> {\n return this.transport.sendJson<OrganizationSettings>(\n 'GET',\n Routes.api.organizationSettings,\n signal ? { signal } : {},\n );\n }\n}\n\n// ---------------------------------------------------------------------------\n// Helpers used by createFileArchiveAsync. Kept at module scope (not on the\n// class) — they don't read any client state, so making them static methods\n// adds noise without buying anything.\n// ---------------------------------------------------------------------------\n\n/**\n * Decodes a base64 string into a `Uint8Array`. Matches the helper in\n * `@powerportalspro/react-fluent/edits/base/file-helpers.ts` but duplicated\n * here to avoid a layering dependency from `@powerportalspro/core` upward.\n */\nfunction base64ToUint8Array(base64: string): Uint8Array {\n const binary = atob(base64);\n const bytes = new Uint8Array(binary.length);\n for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);\n return bytes;\n}\n\n/**\n * Picks the filename out of a `Content-Disposition` response header. Honors\n * RFC 5987's `filename*=UTF-8''…` form (preferred when present — it carries\n * non-ASCII names correctly) before falling back to the plain `filename=\"…\"`\n * parameter. Returns `null` when the header is missing or unparseable so\n * the caller can supply its own default.\n */\nfunction parseContentDispositionFileName(header: string | null): string | null {\n if (!header) return null;\n // RFC 5987 — `filename*=UTF-8''<percent-encoded>` overrides the legacy\n // `filename=` parameter, which can only carry ASCII.\n const star = /filename\\*=(?:UTF-8'')?([^;]+)/i.exec(header);\n if (star?.[1]) {\n try {\n return decodeURIComponent(star[1]);\n } catch {\n /* fall through to legacy form */\n }\n }\n const plain = /filename=\"?([^\";]+)\"?/i.exec(header);\n return plain?.[1] ?? null;\n}\n","// AUTO-GENERATED by scripts/generate-openapi-types.mjs — do not edit.\n//\n// Const-object + type-alias for each C# enum schema in artifacts/openapi.json.\n// The schema transformer in PowerPortalsProWebServer.AddOpenApi emits the parallel\n// 'enum' (integer values) and 'x-enum-varnames' (member names) arrays; this file\n// zips them into runtime-usable constants. Wire format is unchanged (integers).\n//\n// To regenerate: `pnpm --filter @powerportalspro/core run generate:types`.\n\n/**\n * Aggregate function applied to a column in an aggregate FetchXML query.\n */\nexport const AggregateType = {\n /** No aggregation. */\n None: 0,\n /** Count of rows (including nulls). */\n Count: 1,\n /** Count of rows where the column is not null. */\n CountColumn: 2,\n /** Sum of values. */\n Sum: 3,\n /** Arithmetic mean of values. */\n Avg: 4,\n /** Minimum value. */\n Min: 5,\n /** Maximum value. */\n Max: 6,\n} as const;\nexport type AggregateType = (typeof AggregateType)[keyof typeof AggregateType];\n\n/**\n * Compression format for the archive produced by\n * `IPowerPortalsProService.CreateFileArchiveAsync`.\n * Currently only ArchiveFormat.Zip is supported; the enum is open-ended so\n * future formats can land without breaking the wire schema.\n */\nexport const ArchiveFormat = {\n /** Standard ZIP archive (application/zip, .zip extension). Built via ZipArchive with Optimal. */\n Zip: 0,\n} as const;\nexport type ArchiveFormat = (typeof ArchiveFormat)[keyof typeof ArchiveFormat];\n\n/**\n * Outcome of `POST /api/auth/manage/email/change`. Members carry explicit\n * integer values so the JSON wire form is a stable contract across\n * reorderings.\n */\nexport const ChangeEmailResult = {\n /** A confirmation email was sent to the new address. The change does not take effect until the user clicks the link. */\n ConfirmationEmailSent: 0,\n /** The submitted email matches the user's current email. Nothing was sent. The client should show a \"this is already your email\" message. */\n SameAsCurrentEmail: 1,\n} as const;\nexport type ChangeEmailResult = (typeof ChangeEmailResult)[keyof typeof ChangeEmailResult];\n\n/**\n * Outcome of `POST /api/auth/manage/password/change`. Members carry\n * explicit integer values so the JSON wire form is a stable contract\n * across reorderings.\n */\nexport const ChangePasswordResult = {\n /** The password was changed. The auth cookie has been refreshed to pick up the new security stamp so other sessions are invalidated. */\n Success: 0,\n /** The supplied old password did not match the current password. The client should show an \"incorrect current password\" error and allow retry. */\n IncorrectOldPassword: 1,\n /** The new password did not satisfy the host's IdentityOptions.Password rules. Errors carries the per-rule messages so the client can show actionable feedback. */\n InvalidPassword: 2,\n} as const;\nexport type ChangePasswordResult = (typeof ChangePasswordResult)[keyof typeof ChangePasswordResult];\n\n/**\n * Date bucketing intervals for grouping a datetime column in an\n * aggregate chart query. Simple values map directly to a single\n * FetchXML `dategrouping`. Combined values\n * (e.g. ChartDateGrouping.MonthAndYear) cause the server to emit multiple\n * `groupby` attributes on the same column and merge the results\n * into a formatted label like `\"Jan 2024\"` using the request's\n * current culture.\n */\nexport const ChartDateGrouping = {\n /** No date grouping — the column is grouped by its raw value. */\n None: 0,\n /** Group by day (dategrouping=\"day\"). Label: day number. */\n Day: 1,\n /** Group by ISO week (dategrouping=\"week\"). Label: week number. */\n Week: 2,\n /** Group by calendar month (dategrouping=\"month\"). Label: abbreviated month name (Jan, Feb, …) in the current culture. */\n Month: 3,\n /** Group by calendar quarter (dategrouping=\"quarter\"). Label: quarter number. */\n Quarter: 4,\n /** Group by calendar year (dategrouping=\"year\"). Label: year. */\n Year: 5,\n /** Group by month + year. Label: \"Jan 2024\". */\n MonthAndYear: 6,\n /** Group by day + month. Label: \"15 Jan\". */\n DayAndMonth: 7,\n /** Group by day + month + year. Label: \"15 Jan 2024\". */\n DayAndMonthAndYear: 8,\n /** Group by ISO week + year. Label: \"W15 2024\". */\n WeekAndYear: 9,\n /** Group by quarter + year. Label: \"Q1 2024\". */\n QuarterAndYear: 10,\n} as const;\nexport type ChartDateGrouping = (typeof ChartDateGrouping)[keyof typeof ChartDateGrouping];\n\n/**\n * Identifies the data type of a Dataverse column. Values 0–20 mirror the Dataverse SDK's `AttributeTypeCode`; values 40+ are PowerPortalsPro-specific column types not present in Dataverse.\n */\nexport const ColumnType = {\n /** A Boolean attribute. Value = 0. */\n Boolean: 0,\n /** An attribute that represents a customer. Value = 1. */\n Customer: 1,\n /** A date/time attribute. Value = 2. */\n DateTime: 2,\n /** A decimal attribute. Value = 3. */\n Decimal: 3,\n /** A double attribute. Value = 4. */\n Double: 4,\n /** An integer attribute. Value = 5. */\n Integer: 5,\n /** A lookup attribute. Value = 6. */\n Lookup: 6,\n /** A memo attribute. Value = 7. */\n Memo: 7,\n /** A money attribute. Value = 8. */\n Money: 8,\n /** An owner attribute. Value = 9. */\n Owner: 9,\n /** A partylist attribute. Value = 10. */\n PartyList: 10,\n /** A picklist (single-select choice) attribute. Value = 11. */\n Choice: 11,\n /** A state attribute. Value = 12. */\n State: 12,\n /** A status attribute. Value = 13. */\n Status: 13,\n /** A string attribute. Value = 14. */\n String: 14,\n /** A unique identifier (GUID) attribute. Value = 15. */\n Uniqueidentifier: 15,\n /** An attribute that contains calendar rules. Value = 16. */\n CalendarRules: 16,\n /** An attribute that is created by the system at run time. Value = 17. */\n Virtual: 17,\n /** A big integer (long) attribute. Value = 18. */\n BigInt: 18,\n /** A managed property attribute. Value = 19. */\n ManagedProperty: 19,\n /** An entity name attribute. Value = 20. */\n EntityName: 20,\n /** A multi-select choice attribute. Value = 40. PowerPortalsPro-specific (not present in Dataverse AttributeTypeCode). */\n MultiSelectChoice: 40,\n /** A file attachment attribute. Value = 41. PowerPortalsPro-specific (not present in Dataverse AttributeTypeCode). */\n File: 41,\n /** An image attribute. Value = 42. PowerPortalsPro-specific (not present in Dataverse AttributeTypeCode). */\n Image: 42,\n} as const;\nexport type ColumnType = (typeof ColumnType)[keyof typeof ColumnType];\n\n/**\n * Outcome of `POST /api/auth/external-login/confirm`. Members carry\n * explicit integer values so the JSON wire form is a stable contract\n * across reorderings.\n */\nexport const ConfirmExternalLoginResult = {\n /** The external login was linked (creating a new local account if needed) and the user has been signed in. The auth cookie is set on the response. */\n SignedIn: 0,\n /** The account was created but the host requires email confirmation. A confirmation link has been sent; the user is NOT signed in yet. */\n ConfirmationEmailSent: 1,\n /** No external-login cookie was found — the user landed on the confirm endpoint without a fresh OAuth callback. The client should redirect back to the login page. */\n NoPendingExternalLogin: 2,\n /** Identity rejected the create / add-login operation (e.g. duplicate email already linked to a different account). Errors carries the per-rule messages. */\n Failure: 3,\n} as const;\nexport type ConfirmExternalLoginResult = (typeof ConfirmExternalLoginResult)[keyof typeof ConfirmExternalLoginResult];\n\n/**\n * Specifies the date/time behavior of a DateTime column.\n */\nexport const DateTimeBehavior = {\n /** Only the date portion is stored; no time component. */\n DateOnly: 1,\n /** The value is stored in UTC and converted to the user's local time zone for display. */\n UserLocal: 2,\n /** The value is stored and displayed exactly as entered, without time zone conversion. */\n TimeZoneIndependent: 3,\n} as const;\nexport type DateTimeBehavior = (typeof DateTimeBehavior)[keyof typeof DateTimeBehavior];\n\n/**\n * Outcome of `POST /api/auth/manage/personal-data/delete`. Members carry\n * explicit integer values so the JSON wire form is a stable contract\n * across reorderings.\n */\nexport const DeletePersonalDataResult = {\n /** The account was deleted and the auth cookie has been cleared. */\n Success: 0,\n /** The user has a local password set, and one was supplied, but it did not match. The client should show an \"incorrect password\" error and allow retry. */\n IncorrectPassword: 1,\n /** The user has a local password set but the request body's password field was empty. The client should prompt for the password and resubmit. Distinct from IncorrectPassword so the UI can choose between \"please enter your password\" and \"that password is wrong.\" */\n RequireLocalPassword: 2,\n} as const;\nexport type DeletePersonalDataResult = (typeof DeletePersonalDataResult)[keyof typeof DeletePersonalDataResult];\n\n/**\n * Which Dataverse table backs an external-login candidate. Members carry\n * explicit integer values so the JSON wire form is a stable contract\n * across reorderings.\n */\nexport const ExternalLoginCandidateKind = {\n /** The candidate is a Dataverse contact record. */\n Contact: 0,\n /** The candidate is a Dataverse systemuser record. */\n SystemUser: 1,\n} as const;\nexport type ExternalLoginCandidateKind = (typeof ExternalLoginCandidateKind)[keyof typeof ExternalLoginCandidateKind];\n\n/**\n * Determines how the server returns the archive bytes to the caller.\n */\nexport const FileArchiveResponseFormat = {\n /** Returns the raw archive bytes as the response body, with Content-Type: application/zip (or the matching MIME for the chosen ArchiveFormat) and a Content-Disposition: attachment; filename=… header. The caller hands the response directly to the browser's download path — no base64 round-trip. Default mode. */\n BinaryStream: 0,\n /** Returns a JSON envelope (FileArchiveJsonResponse) that wraps the archive's bytes as base64. Useful when the consumer wants to inspect headers / filename / size programmatically before triggering a download, or when the host environment can't stream binary responses (some test harnesses, some service workers). Trades ~33% wire-size overhead for the JSON wrapper. */\n Json: 1,\n} as const;\nexport type FileArchiveResponseFormat = (typeof FileArchiveResponseFormat)[keyof typeof FileArchiveResponseFormat];\n\n/**\n * Join type used on a FetchXML link-entity.\n */\nexport const JoinOperator = {\n /** Inner join — only matching rows are returned. */\n Inner: 0,\n /** Left outer join — unmatched parent rows are returned with null link columns. */\n LeftOuter: 1,\n /** Natural join. */\n Natural: 2,\n /** Match first row using cross apply. */\n MatchFirstRowUsingCrossApply: 3,\n /** In join — semi-join used for subqueries. */\n In: 4,\n /** Exists join — semi-join evaluating existence. */\n Exists: 5,\n /** Any-match semi-join. */\n Any: 6,\n /** Inverse of Any. */\n NotAny: 7,\n /** All-match semi-join. */\n All: 8,\n /** Inverse of All. */\n NotAll: 9,\n} as const;\nexport type JoinOperator = (typeof JoinOperator)[keyof typeof JoinOperator];\n\n/**\n * Discriminates the three localization source kinds the cache pulls from at warmup.\n * Underlying integer values are pinned so JSON / numeric serialization is stable\n * across releases — append new members with the next unused number and never\n * renumber existing entries.\n */\nexport const LocalizationSourceKind = {\n /** Strings derived from Dataverse table metadata — display names, descriptions, choice option labels, and view names, drawn from whatever language packs are installed in the environment. Loads first in the warmup. */\n TableMetadata: 0,\n /** JSON files stored in Dataverse as web resources under the /PowerPortalsPro/Localization/ path prefix. Loads after table metadata. */\n WebResource: 1,\n /** JSON or HTML files loaded from a directory or explicit path registered via String) / String). Loads LAST, so its values override anything an earlier source supplied for the same key. */\n FolderFile: 2,\n} as const;\nexport type LocalizationSourceKind = (typeof LocalizationSourceKind)[keyof typeof LocalizationSourceKind];\n\n/**\n * Terminal status of a single source's load. Underlying integer values are pinned\n * so JSON / numeric serialization is stable across releases — append new members\n * with the next unused number and never renumber existing entries.\n */\nexport const LocalizationSourceStatus = {\n /** Load completed successfully; key counts and cultures are populated. */\n Loaded: 0,\n /** Load threw an exception; Error captures the message. */\n Failed: 1,\n /** Source was discovered but produced no strings (empty file, no matching metadata, etc.). */\n Skipped: 2,\n} as const;\nexport type LocalizationSourceStatus = (typeof LocalizationSourceStatus)[keyof typeof LocalizationSourceStatus];\n\n/**\n * Outcome of a LoginRequest attempt. Returned in LoginResult LoginResponse.Result\n * so the client can branch UI behavior without inspecting HTTP status codes.\n * \n * Members carry explicit integer values: this enum ships in JSON wire payloads, so\n * the JSON numeric representation is a stable contract. Pinning the\n * values prevents accidental drift if a future refactor reorders or\n * inserts members.\n */\nexport const LoginResult = {\n /** Credentials were accepted and the auth cookie has been set. The client should navigate to the post-login destination (typically ReturnUrl). */\n Success: 0,\n /** Credentials were accepted but the account requires a second factor. The server has sent the 2FA code (e.g., via email) and is waiting for a follow-up call to POST /api/auth/login/2fa. No auth cookie is set yet. */\n RequiresTwoFactor: 1,\n /** The email/password pair did not match any account, or the password was wrong. The client should show a generic \"invalid credentials\" message — the server deliberately does not distinguish between \"no such email\" and \"wrong password\" to avoid account-enumeration attacks. */\n InvalidCredentials: 2,\n /** The account exists and the password matched, but the email address has not been confirmed and the host configured SignIn.RequireConfirmedAccount. The client should redirect to the registration-confirmation flow. */\n EmailNotConfirmed: 3,\n /** The account is locked out (too many failed attempts, manual lockout, etc.). The client should show the lockout page. */\n LockedOut: 4,\n} as const;\nexport type LoginResult = (typeof LoginResult)[keyof typeof LoginResult];\n\n/**\n * Outcome of a RegisterRequest. Members carry explicit integer\n * values so the JSON wire form is a stable contract across reorderings.\n */\nexport const RegisterResult = {\n /** The account was created and a confirmation email has been sent. The user is NOT signed in yet — they must click the confirmation link first. */\n ConfirmationEmailSent: 0,\n /** The account was created and the user has been signed in directly (the host did not configure SignIn.RequireConfirmedAccount). */\n SignedIn: 1,\n /** An account with the same email already exists. The server returns this rather than silently succeeding to give the client an opportunity to surface a clear error, at the cost of allowing email enumeration. Hosts that prefer the enumeration- resistant path should treat this as success client-side. */\n EmailAlreadyInUse: 2,\n} as const;\nexport type RegisterResult = (typeof RegisterResult)[keyof typeof RegisterResult];\n\n/**\n * Whether a RelationshipFilter returns records that ARE related\n * to the parent (the typical SubGrid / initial-selection load) or records\n * that are NOT related (the autocomplete pool a `ManyToManyLookupEdit`\n * picks from).\n * \n * RelationshipFilterMode.ExcludeExistingRecords is only meaningful for many-to-many\n * relationships — for one-to-many, \"records not related to this parent\" is\n * just \"records of the child table with a different FK\", which isn't a\n * shape any current consumer needs. Combining Exclude with a one-to-many\n * relationship is rejected by the server at filter-apply time.\n */\nexport const RelationshipFilterMode = {\n /** Return records currently associated with ParentRecord via the named relationship. For one-to-many, AND-merges a referencingColumn == parentRecord.Id condition. For many-to-many, AND-merges an intersect link-entity plus a condition on the parent-side intersect column. */\n IncludeExistingRecords: 0,\n /** Return records that are NOT currently associated with ParentRecord. Many-to-many only — AND-merges a LEFT OUTER intersect link-entity (filtered to the parent's intersect rows) and an outer null-check on the parent-side intersect column, so unrelated records survive but related records get filtered out. */\n ExcludeExistingRecords: 1,\n} as const;\nexport type RelationshipFilterMode = (typeof RelationshipFilterMode)[keyof typeof RelationshipFilterMode];\n\n/**\n * Specifies whether a column value is required.\n */\nexport const RequiredLevel = {\n /** No requirements are specified. */\n None: 0,\n /** The column is required by the system and cannot be null. */\n SystemRequired: 1,\n /** The column is required by the application and should have a value. */\n ApplicationRequired: 2,\n /** It is recommended that the column has a value, but it is not enforced. */\n Recommended: 3,\n} as const;\nexport type RequiredLevel = (typeof RequiredLevel)[keyof typeof RequiredLevel];\n\n/**\n * Outcome of `POST /api/auth/reset-password`. Members carry explicit\n * integer values so the JSON wire form is a stable contract across\n * reorderings.\n */\nexport const ResetPasswordResult = {\n /** The password was reset and the user can now sign in with the new password. */\n Success: 0,\n /** The token was missing, malformed, expired, or already used. The client should redirect the user to the \"request a new reset link\" flow. */\n InvalidOrExpiredToken: 1,\n /** The new password did not satisfy the host's password rules. The accompanying ProblemDetails (in the failed-validation HTTP 400) carries the per-rule error messages from IdentityResult.Errors. */\n InvalidPassword: 2,\n} as const;\nexport type ResetPasswordResult = (typeof ResetPasswordResult)[keyof typeof ResetPasswordResult];\n\n/**\n * Outcome of `POST /api/auth/switch-identity`. Members carry explicit\n * integer values so the JSON wire form is a stable contract across\n * reorderings.\n */\nexport const SwitchIdentityResult = {\n /** The alt identity was signed in and the auth cookie has been swapped. */\n Switched: 0,\n /** The current principal has no alt-identity claim — there is nothing to switch to. */\n NoAltIdentity: 1,\n /** The alt identity referenced by the claim no longer exists in Dataverse (or is disabled). */\n AltIdentityNotFound: 2,\n /** The current request is unauthenticated. */\n NotAuthenticated: 3,\n} as const;\nexport type SwitchIdentityResult = (typeof SwitchIdentityResult)[keyof typeof SwitchIdentityResult];\n\n/**\n * Bit flags describing the security operations the current user can perform on a record.\n */\nexport const TableSecurityPermission = {\n /** No permissions. */\n None: 0,\n /** The record can be read. */\n Read: 1,\n /** The record (or table) can have new records created. */\n Create: 2,\n /** The record can be modified. */\n Write: 4,\n /** The record can be deleted. */\n Delete: 8,\n /** The record can be appended to other records (used as the child of a relationship). */\n Append: 16,\n /** Other records can be appended to this record (used as the parent of a relationship). */\n AppendTo: 32,\n /** All permissions except Create. */\n All: 63,\n} as const;\nexport type TableSecurityPermission = (typeof TableSecurityPermission)[keyof typeof TableSecurityPermission];\n","import type { components } from './generated/api-schema.js';\n\ntype TableRecord = components['schemas']['TableRecord'];\n\n/**\n * The empty-GUID sentinel Dataverse round-trips for \"no value\" — equivalent\n * to `Guid.Empty` on the .NET side. A record whose `id` is this sentinel is\n * semantically unsaved.\n */\nconst EMPTY_GUID = '00000000-0000-0000-0000-000000000000';\n\n/**\n * Resolves the id to use when building a `TableRecordReference` (or any\n * cross-record wire reference) for a `TableRecord`. Returns the record's\n * server-assigned `id` for saved records, falling back to `_idForCreate`\n * — a client-side temp GUID assigned in create mode by `<RecordContext>`\n * so AssociateRequest / parent-FK pre-fill in the same `ExecuteMultiple`\n * batch can reference the record before its real id is minted.\n *\n * Returns `undefined` when neither field carries a usable value (record\n * still loading, or a never-seeded create-mode record).\n *\n * Mirrors implicit conversion\n * (`Id == Guid.Empty ? _idForCreate : Id`). The server resolves either\n * shape via `ResolveAssociateRecordAsync` — both flows interoperate.\n */\nexport function getRecordReferenceId(\n record: Pick<TableRecord, 'id' | '_idForCreate'> | null | undefined,\n): string | undefined {\n if (!record) return undefined;\n if (record.id && record.id !== EMPTY_GUID) return record.id;\n return record._idForCreate ?? undefined;\n}\n","export const VERSION = '0.1.0';\n\nexport { Routes } from './routes.js';\n\nexport {\n PowerPortalsProError,\n UnauthorizedAccessError,\n ArgumentError,\n ArgumentNullError,\n InvalidOperationError,\n mapProblemDetails,\n type ProblemDetails,\n type PowerPortalsProErrorInit,\n} from './errors.js';\n\nexport {\n Transport,\n type TransportOptions,\n type RequestOptions,\n} from './transport.js';\n\n// Two top-level clients:\n// AuthClient — sign-in, profile, 2FA, external login, …\n// PowerPortalsProClient — CRUD, metadata, files, …\n// Construct either independently — they share the browser's cookie jar via fetch,\n// not via a parent client. Pass a Transport instance to share configuration.\n\nexport {\n AuthClient,\n type LoginRequest,\n type LoginResponse,\n type VerifyTwoFactorRequest,\n type VerifyTwoFactorResponse,\n type RegisterRequest,\n type RegisterResponse,\n type RequestPasswordResetRequest,\n type ResetPasswordRequest,\n type ResetPasswordResponse,\n type ConfirmEmailRequest,\n type ConfirmEmailResponse,\n type ResendEmailConfirmationRequest,\n type CurrentUserInfo,\n type ExternalLoginProviderInfo,\n type AuthOptionsResponse,\n type PendingExternalLoginResponse,\n type ConfirmExternalLoginRequest,\n type ConfirmExternalLoginResponse,\n type SelectExternalLoginRequest,\n type SwitchIdentityResponse,\n type ProfileResponse,\n type UpdateProfileRequest,\n type SetPasswordRequest,\n type SetPasswordResponse,\n type ChangePasswordRequest,\n type ChangePasswordResponse,\n type ChangeEmailRequest,\n type ChangeEmailResponse,\n type SendEmailConfirmationResponse,\n type TwoFactorStatusResponse,\n type AuthenticatorSetupResponse,\n type VerifyAuthenticatorRequest,\n type VerifyAuthenticatorResponse,\n type ResetAuthenticatorResponse,\n type Disable2faResponse,\n type RecoveryCodesResponse,\n type Forget2faResponse,\n type ExternalLoginsResponse,\n type CurrentLoginInfo,\n type RemoveExternalLoginRequest,\n type RemoveExternalLoginResponse,\n type PersonalDataResponse,\n type DeletePersonalDataRequest,\n type DeletePersonalDataResponse,\n} from './auth-client.js';\n\nexport {\n PowerPortalsProClient,\n type TableRecord,\n type TableRecordReference,\n type CreateResponse,\n type UpdateResponse,\n type DeleteResponse,\n type RetrieveRecordsResponse,\n type GridDataRequest,\n type GridDataResponse,\n type ResolvedColumn,\n type ColumnSort,\n type GridFilterBase,\n type RelationshipFilter,\n type TableMetadata,\n type ViewMetadata,\n type FileInfo,\n type OrganizationSettings,\n type Currency,\n type ChartDataRequest,\n type ChartDataResponse,\n type AggregateChartConfig,\n type ChartAggregation,\n type ChartGrouping,\n type ChartData,\n type ChartDataset,\n type DataPoint,\n type BaseDataPoint,\n type DataverseDataPoint,\n type ChartLinkedEntity,\n type OrganizationRequest,\n type OrganizationResponse,\n type CreateRequest,\n type UpdateRequest,\n type DeleteRequest,\n type AssociateRequest,\n type DisassociateRequest,\n type TranslationAvailability,\n type TranslationLanguageOption,\n type TranslationRequest,\n type TranslationResult,\n type TranslatedFile,\n type LocalizationOverview,\n type LocalizationPipelineConfiguration,\n type LocalizationSourceLoad,\n type LocalizationSourceKind,\n type LocalizationSourceStatus,\n type LocalizationFileDownload,\n type CacheClearResult,\n} from './powerportalspro-client.js';\n\n// Result-code const-objects are auto-generated from the OpenAPI document — every\n// C# enum schema with the x-enum-varnames extension produces a const-object + type\n// alias in src/generated/result-codes.ts. Forward the whole module so consumers can\n// `import { LoginResult, RegisterResult, ColumnType, ... } from '@powerportalspro/core'`\n// without us maintaining an explicit per-enum re-export list.\nexport * from './generated/result-codes.js';\n\n// Resolves a TableRecord's effective reference id — `id` when saved,\n// `_idForCreate` when still in create mode — so cross-record wire\n// references (AssociateRequest, parent-FK pre-fill) work in both states.\nexport { getRecordReferenceId } from './record-id.js';\n\n// The full generated OpenAPI schema, in case consumers need a type that isn't already\n// re-exported above (column metadata, organization request/response polymorphism, etc.).\n// Prefer the named exports — components is here as an escape hatch.\nexport type { components, paths } from './generated/api-schema.js';\n"]}