@fonderie/client 1.4.0 → 1.6.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.
package/dist/index.d.cts CHANGED
@@ -506,6 +506,60 @@ interface IAdminIssueTokenInput {
506
506
  interface IAdminIssuedToken extends IAdminTokenRecord {
507
507
  token: string;
508
508
  }
509
+ interface IAdminOperator {
510
+ id: string;
511
+ email: string;
512
+ name: string | null;
513
+ scopes: AdminScope[];
514
+ enrolled: boolean;
515
+ backupCodesLeft: number;
516
+ locked: boolean;
517
+ createdBy: string;
518
+ createdAt: string;
519
+ lastLoginAt: string | null;
520
+ disabledAt: string | null;
521
+ }
522
+ interface IAdminOperatorLink {
523
+ id: string;
524
+ kind: 'invite' | 'recovery';
525
+ email: string;
526
+ scopes: AdminScope[];
527
+ createdBy: string;
528
+ createdAt: string;
529
+ expiresAt: string;
530
+ }
531
+ interface IAdminOperatorsReport {
532
+ operators: IAdminOperator[];
533
+ links: IAdminOperatorLink[];
534
+ }
535
+ interface IAdminCreatedLink {
536
+ id: string;
537
+ email: string;
538
+ scopes?: AdminScope[];
539
+ expiresAt: string;
540
+ token: string;
541
+ url: string;
542
+ }
543
+ type AdminSessionState = 'signed-out' | 'needs-2fa' | 'needs-enrollment' | 'signed-in';
544
+ interface IAdminSession {
545
+ state: AdminSessionState;
546
+ operator: IAdminOperator | null;
547
+ claimable?: boolean;
548
+ stepUpFresh?: boolean;
549
+ backupCodes?: string[];
550
+ backupCodesLeft?: number;
551
+ }
552
+ interface IAdminEnrollment {
553
+ secret: string;
554
+ uri: string;
555
+ account: string;
556
+ issuer: string;
557
+ }
558
+ type IAdminSecondFactor = {
559
+ code: string;
560
+ } | {
561
+ backupCode: string;
562
+ };
509
563
  interface IAdminLogEntry {
510
564
  id: string;
511
565
  at: string;
@@ -1404,6 +1458,9 @@ interface ISetConfigInput {
1404
1458
  description?: string;
1405
1459
  active?: boolean;
1406
1460
  ifVersion?: number;
1461
+ /** Required to change an existing key's value kind (on/off → text, list → object);
1462
+ * without it the server answers 409 CONFIG_TYPE_CHANGE. */
1463
+ allowTypeChange?: boolean;
1407
1464
  }
1408
1465
  interface ISetSecretInput {
1409
1466
  value: string;
@@ -1444,7 +1501,7 @@ declare class ConfigAdminClient {
1444
1501
 
1445
1502
  interface IAdminClientOptions {
1446
1503
  baseUrl: string;
1447
- adminToken: string;
1504
+ adminToken?: string;
1448
1505
  prefix?: string;
1449
1506
  actor?: string;
1450
1507
  }
@@ -1479,6 +1536,55 @@ declare class AdminClient {
1479
1536
  * module is behind, and 422 when any pending file deletes data.
1480
1537
  */
1481
1538
  applyMigrations(module: string, expect: readonly string[]): Promise<IApiResponse<IAdminMigrationModule>>;
1539
+ /** Who is signed in, and whether the console can still be claimed. */
1540
+ session(): Promise<IApiResponse<IAdminSession>>;
1541
+ /** The one-time claim. Needs the ROOT token as this client's adminToken. */
1542
+ claim(input: {
1543
+ email: string;
1544
+ password: string;
1545
+ name?: string;
1546
+ }): Promise<IApiResponse<IAdminSession>>;
1547
+ login(input: {
1548
+ email: string;
1549
+ password: string;
1550
+ }): Promise<IApiResponse<IAdminSession>>;
1551
+ /** The authenticator secret and otpauth URI to scan while enrolling. */
1552
+ enrollment(): Promise<IApiResponse<IAdminEnrollment>>;
1553
+ /** Confirms the first code. The response carries the backup codes, once. */
1554
+ confirmEnrollment(code: string): Promise<IApiResponse<IAdminSession>>;
1555
+ /** The second factor after the password: an authenticator code or a backup code. */
1556
+ verify(factor: IAdminSecondFactor): Promise<IApiResponse<IAdminSession>>;
1557
+ /** A fresh code for the next five minutes of dangerous actions. */
1558
+ stepUp(factor: IAdminSecondFactor): Promise<IApiResponse<{
1559
+ stepUpFresh: boolean;
1560
+ backupCodesLeft?: number;
1561
+ }>>;
1562
+ logout(): Promise<IApiResponse<undefined>>;
1563
+ /** What an invite or recovery link is for, before setting a password. */
1564
+ inspectLink(token: string): Promise<IApiResponse<{
1565
+ kind: "invite" | "recovery";
1566
+ email: string;
1567
+ }>>;
1568
+ redeemLink(input: {
1569
+ token: string;
1570
+ password: string;
1571
+ name?: string;
1572
+ }): Promise<IApiResponse<IAdminSession>>;
1573
+ operators(): Promise<IApiResponse<IAdminOperatorsReport>>;
1574
+ /** An invite link, shown once. Needs the highest scope and a fresh code. */
1575
+ inviteOperator(input: {
1576
+ email: string;
1577
+ scopes: AdminScope[];
1578
+ expiresInHours?: number;
1579
+ }): Promise<IApiResponse<IAdminCreatedLink>>;
1580
+ /** Lost password or authenticator: a single-use link; signs them out everywhere. */
1581
+ recoverOperator(id: string): Promise<IApiResponse<IAdminCreatedLink>>;
1582
+ updateOperator(id: string, input: {
1583
+ scopes?: AdminScope[];
1584
+ name?: string;
1585
+ disabled?: boolean;
1586
+ }): Promise<IApiResponse<IAdminOperator>>;
1587
+ revokeOperatorLink(id: string): Promise<IApiResponse<undefined>>;
1482
1588
  }
1483
1589
 
1484
1590
  interface IAuthAdminClientOptions {
@@ -1643,5 +1749,25 @@ declare function castConfigValue(type: ConfigValueType, raw: string): CastResult
1643
1749
  */
1644
1750
  declare const CONFIG_KEY_PATTERN: RegExp;
1645
1751
  declare function configKeyProblem(key: string): string | null;
1752
+ interface IInferredConfigValue {
1753
+ type: ConfigValueType;
1754
+ value: unknown;
1755
+ /** Human label for the detected shape: Text, Number, On/off, Object, List. */
1756
+ label: string;
1757
+ /**
1758
+ * True when the input could equally be meant as text — "true", "42". The
1759
+ * editor offers "save as text instead" for exactly these, and never needs
1760
+ * to ask about anything else.
1761
+ */
1762
+ ambiguous: boolean;
1763
+ }
1764
+ /** Human label for a stored value's shape. */
1765
+ declare function configValueLabel(value: unknown): string;
1766
+ /**
1767
+ * Work out what an operator typed, without asking. Objects and lists (JSON
1768
+ * starting with { or [), on/off (true/false), plain numbers, and text for
1769
+ * everything else — including anything that merely resembles a number.
1770
+ */
1771
+ declare function inferConfigValue(raw: string): IInferredConfigValue;
1646
1772
 
1647
- export { AdminClient, type AdminRouteGuard, type AdminScope, AuditAdminClient, AuditClient, AuthAdminClient, AuthClient, BillingAdminClient, BillingClient, CONFIG_KEY_PATTERN, CONFIG_VALUE_TYPES, type CastResult, ConfigAdminClient, ConfigClient, type ConfigValueType, CourierAdminClient, type CustomerLabelType, type CustomerSex, type CustomerType, CustomersClient, FonderieApiError, FonderieClient, type IAcceptInvitationResult, type IAddAddressInput, type IAddEmailInput, type IAddPhoneInput, type IAddRelationshipInput, type IAddressDTO, type IAdminAttention, type IAdminAttentionItem, type IAdminAuditQuery, type IAdminCatalog, type IAdminCheckResult, type IAdminClientOptions, type IAdminDoctorReport, type IAdminEnvironmentReport, type IAdminGrantInput, type IAdminIssueTokenInput, type IAdminIssuedToken, type IAdminLedgerQuery, type IAdminLogEntry, type IAdminLogPage, type IAdminLogQuery, type IAdminLoginHistoryQuery, type IAdminManifest, type IAdminMigrationModule, type IAdminMigrationsReport, type IAdminModuleEntry, type IAdminPendingMigration, type IAdminPlanInput, type IAdminReadiness, type IAdminReadinessProblem, type IAdminRouteEntry, type IAdminRoutesReport, type IAdminSubscriptionDTO, type IAdminSubscriptionPage, type IAdminSubscriptionsQuery, type IAdminTokenRecord, type IAdminTokensReport, type IAdminUserDTO, type IAdminUserPageResult, type IAdminUsersQuery, type IAdminWalletDTO, type IAdminWalletLedgerPage, type IApiError, type IApiResponse, type IAppleNativeInput, type IAuditAdminClientOptions, type IAuditEventDTO, type IAuditPageResult, type IAuthAdminClientOptions, type IBillingAdminClientOptions, type IBlacklistCustomerInput, type ICache, type ICancelSubscriptionInput, type IChangePasswordInput, type ICheckoutInput, type ICheckoutUrlResult, type IClientAuthConfig, type IConfigAdminClientOptions, type IConfigEntry, type IConfigRevision, type ICourierAdminClientOptions, type ICreateCustomerInput, type ICreatePlanInput, type ICreateRoleInput, type ICreateWebhookEndpointInput, type ICreateWorkspaceInput, type ICustomerAddressDTO, type ICustomerAddressListResult, type ICustomerAddressResult, type ICustomerDTO, type ICustomerDetailD2DTO, type ICustomerDetailDTO, type ICustomerEmailDTO, type ICustomerEmailListResult, type ICustomerEmailResult, type ICustomerLabelDTO, type ICustomerLabelListResult, type ICustomerListResult, type ICustomerNoteDTO, type ICustomerNoteListResult, type ICustomerNoteResult, type ICustomerPhoneDTO, type ICustomerPhoneListResult, type ICustomerPhoneResult, type ICustomerRelationshipDTO, type ICustomerRelationshipExpandedD2DTO, type ICustomerRelationshipExpandedDTO, type ICustomerRelationshipListResult, type ICustomerRelationshipResult, type ICustomerResult, type ICustomerShallowDTO, type ICustomerTagListResult, type IFonderieClientOptions, type IGetCustomerInput, type IGetLoginHistoryInput, type IInvitationDTO, type IInvitationListResult, type IInviteEntry, type IInviteResult, type IInvoiceDTO, type IInvoicesResult, type IListAuditEventsInput, type IListCustomersInput, type ILoginEventDTO, type ILoginHistoryPageResult, type ILoginInput, type ILoginResult, type IMeResult, type IMediaAssetDTO, type IMediaAssetResult, type IMemberDTO, type IMemberListResult, type IMemoryCacheOptions, type IMfaEnabledResult, type IMfaRequiredResult, type IMfaSetupResult, type IPaymentMethodDTO, type IPaymentMethodResult, type IPlanDTO, type IPlanFeature, type IPlanListResult, type IPlanResult, type IPortalUrlResult, type IPreviewTemplateInput, type IReadOptions, type IRecordUsageInput, type IRefreshResult, type IRegisterInput, type IRegisterResult, type IRemoteConfigState, type IRenderedTemplateResult, type IRequestConfig, type IRequestLocationDTO, type IResendVerificationResult, type IResetPasswordInput, type IRevealSecretResult, type IRoleDTO, type IRoleListResult, type IRolePermission, type IRolePermissionInput, type IRolePermissionsResult, type IRoleResult, type IRollbackInput, type IRollbackTemplateInput, type ISecretEntry, type ISecretRevision, type ISessionDTO, type ISessionsResult, type ISetConfigInput, type ISetSecretInput, type ISetTemplateInput, type ISubscriptionChangeResult, type ISubscriptionDTO, type ISubscriptionResult, type ITemplateEntry, type ITemplateRevision, type ITestWebhookResult, type ITokens, type IUpdateCustomerInput, type IUpdatePlanInput, type IUpdatePreferencesInput, type IUpdateProfileInput, type IUpdateRoleInput, type IUpdateSettingsInput, type IUpdateWebhookEndpointInput, type IUpdateWorkspaceInput, type IUploadMediaInput, type IUsageResult, type IUserDTO, type IUserPreferences, type IVerifyEmailResult, type IWalletCheckoutInput, type IWalletDTO, type IWalletPreferencesInput, type IWalletPurchaseInput, type IWalletPurchaseResult, type IWalletResult, type IWalletTransactionDTO, type IWalletTransactionsResult, type IWebhookDeliveryDTO, type IWebhookDeliveryListResult, type IWebhookEndpointCreatedDTO, type IWebhookEndpointDTO, type IWebhookEndpointListResult, type IWorkspaceAddressDTO, type IWorkspaceDTO, type IWorkspaceListResult, type IWorkspaceResult, type IWorkspaceSettingsDTO, type IWorkspaceSettingsResult, MediaClient, type MigrationImpact, type SubscriberType, WebhooksClient, WorkspacesClient, castConfigValue, configKeyProblem, configValueType, createMemoryCache, describeLocation, formatConfigValue, isMfaRequired };
1773
+ export { AdminClient, type AdminRouteGuard, type AdminScope, type AdminSessionState, AuditAdminClient, AuditClient, AuthAdminClient, AuthClient, BillingAdminClient, BillingClient, CONFIG_KEY_PATTERN, CONFIG_VALUE_TYPES, type CastResult, ConfigAdminClient, ConfigClient, type ConfigValueType, CourierAdminClient, type CustomerLabelType, type CustomerSex, type CustomerType, CustomersClient, FonderieApiError, FonderieClient, type IAcceptInvitationResult, type IAddAddressInput, type IAddEmailInput, type IAddPhoneInput, type IAddRelationshipInput, type IAddressDTO, type IAdminAttention, type IAdminAttentionItem, type IAdminAuditQuery, type IAdminCatalog, type IAdminCheckResult, type IAdminClientOptions, type IAdminCreatedLink, type IAdminDoctorReport, type IAdminEnrollment, type IAdminEnvironmentReport, type IAdminGrantInput, type IAdminIssueTokenInput, type IAdminIssuedToken, type IAdminLedgerQuery, type IAdminLogEntry, type IAdminLogPage, type IAdminLogQuery, type IAdminLoginHistoryQuery, type IAdminManifest, type IAdminMigrationModule, type IAdminMigrationsReport, type IAdminModuleEntry, type IAdminOperator, type IAdminOperatorLink, type IAdminOperatorsReport, type IAdminPendingMigration, type IAdminPlanInput, type IAdminReadiness, type IAdminReadinessProblem, type IAdminRouteEntry, type IAdminRoutesReport, type IAdminSecondFactor, type IAdminSession, type IAdminSubscriptionDTO, type IAdminSubscriptionPage, type IAdminSubscriptionsQuery, type IAdminTokenRecord, type IAdminTokensReport, type IAdminUserDTO, type IAdminUserPageResult, type IAdminUsersQuery, type IAdminWalletDTO, type IAdminWalletLedgerPage, type IApiError, type IApiResponse, type IAppleNativeInput, type IAuditAdminClientOptions, type IAuditEventDTO, type IAuditPageResult, type IAuthAdminClientOptions, type IBillingAdminClientOptions, type IBlacklistCustomerInput, type ICache, type ICancelSubscriptionInput, type IChangePasswordInput, type ICheckoutInput, type ICheckoutUrlResult, type IClientAuthConfig, type IConfigAdminClientOptions, type IConfigEntry, type IConfigRevision, type ICourierAdminClientOptions, type ICreateCustomerInput, type ICreatePlanInput, type ICreateRoleInput, type ICreateWebhookEndpointInput, type ICreateWorkspaceInput, type ICustomerAddressDTO, type ICustomerAddressListResult, type ICustomerAddressResult, type ICustomerDTO, type ICustomerDetailD2DTO, type ICustomerDetailDTO, type ICustomerEmailDTO, type ICustomerEmailListResult, type ICustomerEmailResult, type ICustomerLabelDTO, type ICustomerLabelListResult, type ICustomerListResult, type ICustomerNoteDTO, type ICustomerNoteListResult, type ICustomerNoteResult, type ICustomerPhoneDTO, type ICustomerPhoneListResult, type ICustomerPhoneResult, type ICustomerRelationshipDTO, type ICustomerRelationshipExpandedD2DTO, type ICustomerRelationshipExpandedDTO, type ICustomerRelationshipListResult, type ICustomerRelationshipResult, type ICustomerResult, type ICustomerShallowDTO, type ICustomerTagListResult, type IFonderieClientOptions, type IGetCustomerInput, type IGetLoginHistoryInput, type IInferredConfigValue, type IInvitationDTO, type IInvitationListResult, type IInviteEntry, type IInviteResult, type IInvoiceDTO, type IInvoicesResult, type IListAuditEventsInput, type IListCustomersInput, type ILoginEventDTO, type ILoginHistoryPageResult, type ILoginInput, type ILoginResult, type IMeResult, type IMediaAssetDTO, type IMediaAssetResult, type IMemberDTO, type IMemberListResult, type IMemoryCacheOptions, type IMfaEnabledResult, type IMfaRequiredResult, type IMfaSetupResult, type IPaymentMethodDTO, type IPaymentMethodResult, type IPlanDTO, type IPlanFeature, type IPlanListResult, type IPlanResult, type IPortalUrlResult, type IPreviewTemplateInput, type IReadOptions, type IRecordUsageInput, type IRefreshResult, type IRegisterInput, type IRegisterResult, type IRemoteConfigState, type IRenderedTemplateResult, type IRequestConfig, type IRequestLocationDTO, type IResendVerificationResult, type IResetPasswordInput, type IRevealSecretResult, type IRoleDTO, type IRoleListResult, type IRolePermission, type IRolePermissionInput, type IRolePermissionsResult, type IRoleResult, type IRollbackInput, type IRollbackTemplateInput, type ISecretEntry, type ISecretRevision, type ISessionDTO, type ISessionsResult, type ISetConfigInput, type ISetSecretInput, type ISetTemplateInput, type ISubscriptionChangeResult, type ISubscriptionDTO, type ISubscriptionResult, type ITemplateEntry, type ITemplateRevision, type ITestWebhookResult, type ITokens, type IUpdateCustomerInput, type IUpdatePlanInput, type IUpdatePreferencesInput, type IUpdateProfileInput, type IUpdateRoleInput, type IUpdateSettingsInput, type IUpdateWebhookEndpointInput, type IUpdateWorkspaceInput, type IUploadMediaInput, type IUsageResult, type IUserDTO, type IUserPreferences, type IVerifyEmailResult, type IWalletCheckoutInput, type IWalletDTO, type IWalletPreferencesInput, type IWalletPurchaseInput, type IWalletPurchaseResult, type IWalletResult, type IWalletTransactionDTO, type IWalletTransactionsResult, type IWebhookDeliveryDTO, type IWebhookDeliveryListResult, type IWebhookEndpointCreatedDTO, type IWebhookEndpointDTO, type IWebhookEndpointListResult, type IWorkspaceAddressDTO, type IWorkspaceDTO, type IWorkspaceListResult, type IWorkspaceResult, type IWorkspaceSettingsDTO, type IWorkspaceSettingsResult, MediaClient, type MigrationImpact, type SubscriberType, WebhooksClient, WorkspacesClient, castConfigValue, configKeyProblem, configValueLabel, configValueType, createMemoryCache, describeLocation, formatConfigValue, inferConfigValue, isMfaRequired };
package/dist/index.d.ts CHANGED
@@ -506,6 +506,60 @@ interface IAdminIssueTokenInput {
506
506
  interface IAdminIssuedToken extends IAdminTokenRecord {
507
507
  token: string;
508
508
  }
509
+ interface IAdminOperator {
510
+ id: string;
511
+ email: string;
512
+ name: string | null;
513
+ scopes: AdminScope[];
514
+ enrolled: boolean;
515
+ backupCodesLeft: number;
516
+ locked: boolean;
517
+ createdBy: string;
518
+ createdAt: string;
519
+ lastLoginAt: string | null;
520
+ disabledAt: string | null;
521
+ }
522
+ interface IAdminOperatorLink {
523
+ id: string;
524
+ kind: 'invite' | 'recovery';
525
+ email: string;
526
+ scopes: AdminScope[];
527
+ createdBy: string;
528
+ createdAt: string;
529
+ expiresAt: string;
530
+ }
531
+ interface IAdminOperatorsReport {
532
+ operators: IAdminOperator[];
533
+ links: IAdminOperatorLink[];
534
+ }
535
+ interface IAdminCreatedLink {
536
+ id: string;
537
+ email: string;
538
+ scopes?: AdminScope[];
539
+ expiresAt: string;
540
+ token: string;
541
+ url: string;
542
+ }
543
+ type AdminSessionState = 'signed-out' | 'needs-2fa' | 'needs-enrollment' | 'signed-in';
544
+ interface IAdminSession {
545
+ state: AdminSessionState;
546
+ operator: IAdminOperator | null;
547
+ claimable?: boolean;
548
+ stepUpFresh?: boolean;
549
+ backupCodes?: string[];
550
+ backupCodesLeft?: number;
551
+ }
552
+ interface IAdminEnrollment {
553
+ secret: string;
554
+ uri: string;
555
+ account: string;
556
+ issuer: string;
557
+ }
558
+ type IAdminSecondFactor = {
559
+ code: string;
560
+ } | {
561
+ backupCode: string;
562
+ };
509
563
  interface IAdminLogEntry {
510
564
  id: string;
511
565
  at: string;
@@ -1404,6 +1458,9 @@ interface ISetConfigInput {
1404
1458
  description?: string;
1405
1459
  active?: boolean;
1406
1460
  ifVersion?: number;
1461
+ /** Required to change an existing key's value kind (on/off → text, list → object);
1462
+ * without it the server answers 409 CONFIG_TYPE_CHANGE. */
1463
+ allowTypeChange?: boolean;
1407
1464
  }
1408
1465
  interface ISetSecretInput {
1409
1466
  value: string;
@@ -1444,7 +1501,7 @@ declare class ConfigAdminClient {
1444
1501
 
1445
1502
  interface IAdminClientOptions {
1446
1503
  baseUrl: string;
1447
- adminToken: string;
1504
+ adminToken?: string;
1448
1505
  prefix?: string;
1449
1506
  actor?: string;
1450
1507
  }
@@ -1479,6 +1536,55 @@ declare class AdminClient {
1479
1536
  * module is behind, and 422 when any pending file deletes data.
1480
1537
  */
1481
1538
  applyMigrations(module: string, expect: readonly string[]): Promise<IApiResponse<IAdminMigrationModule>>;
1539
+ /** Who is signed in, and whether the console can still be claimed. */
1540
+ session(): Promise<IApiResponse<IAdminSession>>;
1541
+ /** The one-time claim. Needs the ROOT token as this client's adminToken. */
1542
+ claim(input: {
1543
+ email: string;
1544
+ password: string;
1545
+ name?: string;
1546
+ }): Promise<IApiResponse<IAdminSession>>;
1547
+ login(input: {
1548
+ email: string;
1549
+ password: string;
1550
+ }): Promise<IApiResponse<IAdminSession>>;
1551
+ /** The authenticator secret and otpauth URI to scan while enrolling. */
1552
+ enrollment(): Promise<IApiResponse<IAdminEnrollment>>;
1553
+ /** Confirms the first code. The response carries the backup codes, once. */
1554
+ confirmEnrollment(code: string): Promise<IApiResponse<IAdminSession>>;
1555
+ /** The second factor after the password: an authenticator code or a backup code. */
1556
+ verify(factor: IAdminSecondFactor): Promise<IApiResponse<IAdminSession>>;
1557
+ /** A fresh code for the next five minutes of dangerous actions. */
1558
+ stepUp(factor: IAdminSecondFactor): Promise<IApiResponse<{
1559
+ stepUpFresh: boolean;
1560
+ backupCodesLeft?: number;
1561
+ }>>;
1562
+ logout(): Promise<IApiResponse<undefined>>;
1563
+ /** What an invite or recovery link is for, before setting a password. */
1564
+ inspectLink(token: string): Promise<IApiResponse<{
1565
+ kind: "invite" | "recovery";
1566
+ email: string;
1567
+ }>>;
1568
+ redeemLink(input: {
1569
+ token: string;
1570
+ password: string;
1571
+ name?: string;
1572
+ }): Promise<IApiResponse<IAdminSession>>;
1573
+ operators(): Promise<IApiResponse<IAdminOperatorsReport>>;
1574
+ /** An invite link, shown once. Needs the highest scope and a fresh code. */
1575
+ inviteOperator(input: {
1576
+ email: string;
1577
+ scopes: AdminScope[];
1578
+ expiresInHours?: number;
1579
+ }): Promise<IApiResponse<IAdminCreatedLink>>;
1580
+ /** Lost password or authenticator: a single-use link; signs them out everywhere. */
1581
+ recoverOperator(id: string): Promise<IApiResponse<IAdminCreatedLink>>;
1582
+ updateOperator(id: string, input: {
1583
+ scopes?: AdminScope[];
1584
+ name?: string;
1585
+ disabled?: boolean;
1586
+ }): Promise<IApiResponse<IAdminOperator>>;
1587
+ revokeOperatorLink(id: string): Promise<IApiResponse<undefined>>;
1482
1588
  }
1483
1589
 
1484
1590
  interface IAuthAdminClientOptions {
@@ -1643,5 +1749,25 @@ declare function castConfigValue(type: ConfigValueType, raw: string): CastResult
1643
1749
  */
1644
1750
  declare const CONFIG_KEY_PATTERN: RegExp;
1645
1751
  declare function configKeyProblem(key: string): string | null;
1752
+ interface IInferredConfigValue {
1753
+ type: ConfigValueType;
1754
+ value: unknown;
1755
+ /** Human label for the detected shape: Text, Number, On/off, Object, List. */
1756
+ label: string;
1757
+ /**
1758
+ * True when the input could equally be meant as text — "true", "42". The
1759
+ * editor offers "save as text instead" for exactly these, and never needs
1760
+ * to ask about anything else.
1761
+ */
1762
+ ambiguous: boolean;
1763
+ }
1764
+ /** Human label for a stored value's shape. */
1765
+ declare function configValueLabel(value: unknown): string;
1766
+ /**
1767
+ * Work out what an operator typed, without asking. Objects and lists (JSON
1768
+ * starting with { or [), on/off (true/false), plain numbers, and text for
1769
+ * everything else — including anything that merely resembles a number.
1770
+ */
1771
+ declare function inferConfigValue(raw: string): IInferredConfigValue;
1646
1772
 
1647
- export { AdminClient, type AdminRouteGuard, type AdminScope, AuditAdminClient, AuditClient, AuthAdminClient, AuthClient, BillingAdminClient, BillingClient, CONFIG_KEY_PATTERN, CONFIG_VALUE_TYPES, type CastResult, ConfigAdminClient, ConfigClient, type ConfigValueType, CourierAdminClient, type CustomerLabelType, type CustomerSex, type CustomerType, CustomersClient, FonderieApiError, FonderieClient, type IAcceptInvitationResult, type IAddAddressInput, type IAddEmailInput, type IAddPhoneInput, type IAddRelationshipInput, type IAddressDTO, type IAdminAttention, type IAdminAttentionItem, type IAdminAuditQuery, type IAdminCatalog, type IAdminCheckResult, type IAdminClientOptions, type IAdminDoctorReport, type IAdminEnvironmentReport, type IAdminGrantInput, type IAdminIssueTokenInput, type IAdminIssuedToken, type IAdminLedgerQuery, type IAdminLogEntry, type IAdminLogPage, type IAdminLogQuery, type IAdminLoginHistoryQuery, type IAdminManifest, type IAdminMigrationModule, type IAdminMigrationsReport, type IAdminModuleEntry, type IAdminPendingMigration, type IAdminPlanInput, type IAdminReadiness, type IAdminReadinessProblem, type IAdminRouteEntry, type IAdminRoutesReport, type IAdminSubscriptionDTO, type IAdminSubscriptionPage, type IAdminSubscriptionsQuery, type IAdminTokenRecord, type IAdminTokensReport, type IAdminUserDTO, type IAdminUserPageResult, type IAdminUsersQuery, type IAdminWalletDTO, type IAdminWalletLedgerPage, type IApiError, type IApiResponse, type IAppleNativeInput, type IAuditAdminClientOptions, type IAuditEventDTO, type IAuditPageResult, type IAuthAdminClientOptions, type IBillingAdminClientOptions, type IBlacklistCustomerInput, type ICache, type ICancelSubscriptionInput, type IChangePasswordInput, type ICheckoutInput, type ICheckoutUrlResult, type IClientAuthConfig, type IConfigAdminClientOptions, type IConfigEntry, type IConfigRevision, type ICourierAdminClientOptions, type ICreateCustomerInput, type ICreatePlanInput, type ICreateRoleInput, type ICreateWebhookEndpointInput, type ICreateWorkspaceInput, type ICustomerAddressDTO, type ICustomerAddressListResult, type ICustomerAddressResult, type ICustomerDTO, type ICustomerDetailD2DTO, type ICustomerDetailDTO, type ICustomerEmailDTO, type ICustomerEmailListResult, type ICustomerEmailResult, type ICustomerLabelDTO, type ICustomerLabelListResult, type ICustomerListResult, type ICustomerNoteDTO, type ICustomerNoteListResult, type ICustomerNoteResult, type ICustomerPhoneDTO, type ICustomerPhoneListResult, type ICustomerPhoneResult, type ICustomerRelationshipDTO, type ICustomerRelationshipExpandedD2DTO, type ICustomerRelationshipExpandedDTO, type ICustomerRelationshipListResult, type ICustomerRelationshipResult, type ICustomerResult, type ICustomerShallowDTO, type ICustomerTagListResult, type IFonderieClientOptions, type IGetCustomerInput, type IGetLoginHistoryInput, type IInvitationDTO, type IInvitationListResult, type IInviteEntry, type IInviteResult, type IInvoiceDTO, type IInvoicesResult, type IListAuditEventsInput, type IListCustomersInput, type ILoginEventDTO, type ILoginHistoryPageResult, type ILoginInput, type ILoginResult, type IMeResult, type IMediaAssetDTO, type IMediaAssetResult, type IMemberDTO, type IMemberListResult, type IMemoryCacheOptions, type IMfaEnabledResult, type IMfaRequiredResult, type IMfaSetupResult, type IPaymentMethodDTO, type IPaymentMethodResult, type IPlanDTO, type IPlanFeature, type IPlanListResult, type IPlanResult, type IPortalUrlResult, type IPreviewTemplateInput, type IReadOptions, type IRecordUsageInput, type IRefreshResult, type IRegisterInput, type IRegisterResult, type IRemoteConfigState, type IRenderedTemplateResult, type IRequestConfig, type IRequestLocationDTO, type IResendVerificationResult, type IResetPasswordInput, type IRevealSecretResult, type IRoleDTO, type IRoleListResult, type IRolePermission, type IRolePermissionInput, type IRolePermissionsResult, type IRoleResult, type IRollbackInput, type IRollbackTemplateInput, type ISecretEntry, type ISecretRevision, type ISessionDTO, type ISessionsResult, type ISetConfigInput, type ISetSecretInput, type ISetTemplateInput, type ISubscriptionChangeResult, type ISubscriptionDTO, type ISubscriptionResult, type ITemplateEntry, type ITemplateRevision, type ITestWebhookResult, type ITokens, type IUpdateCustomerInput, type IUpdatePlanInput, type IUpdatePreferencesInput, type IUpdateProfileInput, type IUpdateRoleInput, type IUpdateSettingsInput, type IUpdateWebhookEndpointInput, type IUpdateWorkspaceInput, type IUploadMediaInput, type IUsageResult, type IUserDTO, type IUserPreferences, type IVerifyEmailResult, type IWalletCheckoutInput, type IWalletDTO, type IWalletPreferencesInput, type IWalletPurchaseInput, type IWalletPurchaseResult, type IWalletResult, type IWalletTransactionDTO, type IWalletTransactionsResult, type IWebhookDeliveryDTO, type IWebhookDeliveryListResult, type IWebhookEndpointCreatedDTO, type IWebhookEndpointDTO, type IWebhookEndpointListResult, type IWorkspaceAddressDTO, type IWorkspaceDTO, type IWorkspaceListResult, type IWorkspaceResult, type IWorkspaceSettingsDTO, type IWorkspaceSettingsResult, MediaClient, type MigrationImpact, type SubscriberType, WebhooksClient, WorkspacesClient, castConfigValue, configKeyProblem, configValueType, createMemoryCache, describeLocation, formatConfigValue, isMfaRequired };
1773
+ export { AdminClient, type AdminRouteGuard, type AdminScope, type AdminSessionState, AuditAdminClient, AuditClient, AuthAdminClient, AuthClient, BillingAdminClient, BillingClient, CONFIG_KEY_PATTERN, CONFIG_VALUE_TYPES, type CastResult, ConfigAdminClient, ConfigClient, type ConfigValueType, CourierAdminClient, type CustomerLabelType, type CustomerSex, type CustomerType, CustomersClient, FonderieApiError, FonderieClient, type IAcceptInvitationResult, type IAddAddressInput, type IAddEmailInput, type IAddPhoneInput, type IAddRelationshipInput, type IAddressDTO, type IAdminAttention, type IAdminAttentionItem, type IAdminAuditQuery, type IAdminCatalog, type IAdminCheckResult, type IAdminClientOptions, type IAdminCreatedLink, type IAdminDoctorReport, type IAdminEnrollment, type IAdminEnvironmentReport, type IAdminGrantInput, type IAdminIssueTokenInput, type IAdminIssuedToken, type IAdminLedgerQuery, type IAdminLogEntry, type IAdminLogPage, type IAdminLogQuery, type IAdminLoginHistoryQuery, type IAdminManifest, type IAdminMigrationModule, type IAdminMigrationsReport, type IAdminModuleEntry, type IAdminOperator, type IAdminOperatorLink, type IAdminOperatorsReport, type IAdminPendingMigration, type IAdminPlanInput, type IAdminReadiness, type IAdminReadinessProblem, type IAdminRouteEntry, type IAdminRoutesReport, type IAdminSecondFactor, type IAdminSession, type IAdminSubscriptionDTO, type IAdminSubscriptionPage, type IAdminSubscriptionsQuery, type IAdminTokenRecord, type IAdminTokensReport, type IAdminUserDTO, type IAdminUserPageResult, type IAdminUsersQuery, type IAdminWalletDTO, type IAdminWalletLedgerPage, type IApiError, type IApiResponse, type IAppleNativeInput, type IAuditAdminClientOptions, type IAuditEventDTO, type IAuditPageResult, type IAuthAdminClientOptions, type IBillingAdminClientOptions, type IBlacklistCustomerInput, type ICache, type ICancelSubscriptionInput, type IChangePasswordInput, type ICheckoutInput, type ICheckoutUrlResult, type IClientAuthConfig, type IConfigAdminClientOptions, type IConfigEntry, type IConfigRevision, type ICourierAdminClientOptions, type ICreateCustomerInput, type ICreatePlanInput, type ICreateRoleInput, type ICreateWebhookEndpointInput, type ICreateWorkspaceInput, type ICustomerAddressDTO, type ICustomerAddressListResult, type ICustomerAddressResult, type ICustomerDTO, type ICustomerDetailD2DTO, type ICustomerDetailDTO, type ICustomerEmailDTO, type ICustomerEmailListResult, type ICustomerEmailResult, type ICustomerLabelDTO, type ICustomerLabelListResult, type ICustomerListResult, type ICustomerNoteDTO, type ICustomerNoteListResult, type ICustomerNoteResult, type ICustomerPhoneDTO, type ICustomerPhoneListResult, type ICustomerPhoneResult, type ICustomerRelationshipDTO, type ICustomerRelationshipExpandedD2DTO, type ICustomerRelationshipExpandedDTO, type ICustomerRelationshipListResult, type ICustomerRelationshipResult, type ICustomerResult, type ICustomerShallowDTO, type ICustomerTagListResult, type IFonderieClientOptions, type IGetCustomerInput, type IGetLoginHistoryInput, type IInferredConfigValue, type IInvitationDTO, type IInvitationListResult, type IInviteEntry, type IInviteResult, type IInvoiceDTO, type IInvoicesResult, type IListAuditEventsInput, type IListCustomersInput, type ILoginEventDTO, type ILoginHistoryPageResult, type ILoginInput, type ILoginResult, type IMeResult, type IMediaAssetDTO, type IMediaAssetResult, type IMemberDTO, type IMemberListResult, type IMemoryCacheOptions, type IMfaEnabledResult, type IMfaRequiredResult, type IMfaSetupResult, type IPaymentMethodDTO, type IPaymentMethodResult, type IPlanDTO, type IPlanFeature, type IPlanListResult, type IPlanResult, type IPortalUrlResult, type IPreviewTemplateInput, type IReadOptions, type IRecordUsageInput, type IRefreshResult, type IRegisterInput, type IRegisterResult, type IRemoteConfigState, type IRenderedTemplateResult, type IRequestConfig, type IRequestLocationDTO, type IResendVerificationResult, type IResetPasswordInput, type IRevealSecretResult, type IRoleDTO, type IRoleListResult, type IRolePermission, type IRolePermissionInput, type IRolePermissionsResult, type IRoleResult, type IRollbackInput, type IRollbackTemplateInput, type ISecretEntry, type ISecretRevision, type ISessionDTO, type ISessionsResult, type ISetConfigInput, type ISetSecretInput, type ISetTemplateInput, type ISubscriptionChangeResult, type ISubscriptionDTO, type ISubscriptionResult, type ITemplateEntry, type ITemplateRevision, type ITestWebhookResult, type ITokens, type IUpdateCustomerInput, type IUpdatePlanInput, type IUpdatePreferencesInput, type IUpdateProfileInput, type IUpdateRoleInput, type IUpdateSettingsInput, type IUpdateWebhookEndpointInput, type IUpdateWorkspaceInput, type IUploadMediaInput, type IUsageResult, type IUserDTO, type IUserPreferences, type IVerifyEmailResult, type IWalletCheckoutInput, type IWalletDTO, type IWalletPreferencesInput, type IWalletPurchaseInput, type IWalletPurchaseResult, type IWalletResult, type IWalletTransactionDTO, type IWalletTransactionsResult, type IWebhookDeliveryDTO, type IWebhookDeliveryListResult, type IWebhookEndpointCreatedDTO, type IWebhookEndpointDTO, type IWebhookEndpointListResult, type IWorkspaceAddressDTO, type IWorkspaceDTO, type IWorkspaceListResult, type IWorkspaceResult, type IWorkspaceSettingsDTO, type IWorkspaceSettingsResult, MediaClient, type MigrationImpact, type SubscriberType, WebhooksClient, WorkspacesClient, castConfigValue, configKeyProblem, configValueLabel, configValueType, createMemoryCache, describeLocation, formatConfigValue, inferConfigValue, isMfaRequired };
package/dist/index.js CHANGED
@@ -1865,6 +1865,75 @@ var AdminClient = class {
1865
1865
  { expect }
1866
1866
  );
1867
1867
  }
1868
+ // ── operator sign-in (the served console's gate) ──────────────────────
1869
+ // Cookie-based: the server sets an HttpOnly session cookie; nothing here
1870
+ // ever holds it. Omit adminToken on this client — except for claim().
1871
+ /** Who is signed in, and whether the console can still be claimed. */
1872
+ session() {
1873
+ return this.get("/session");
1874
+ }
1875
+ /** The one-time claim. Needs the ROOT token as this client's adminToken. */
1876
+ claim(input) {
1877
+ return this.call("POST", "/session/claim", input);
1878
+ }
1879
+ login(input) {
1880
+ return this.call("POST", "/session/login", input);
1881
+ }
1882
+ /** The authenticator secret and otpauth URI to scan while enrolling. */
1883
+ enrollment() {
1884
+ return this.get("/session/enrollment");
1885
+ }
1886
+ /** Confirms the first code. The response carries the backup codes, once. */
1887
+ confirmEnrollment(code) {
1888
+ return this.call("POST", "/session/enrollment", { code });
1889
+ }
1890
+ /** The second factor after the password: an authenticator code or a backup code. */
1891
+ verify(factor) {
1892
+ return this.call("POST", "/session/verify", factor);
1893
+ }
1894
+ /** A fresh code for the next five minutes of dangerous actions. */
1895
+ stepUp(factor) {
1896
+ return this.call(
1897
+ "POST",
1898
+ "/session/step-up",
1899
+ factor
1900
+ );
1901
+ }
1902
+ logout() {
1903
+ return this.call("DELETE", "/session");
1904
+ }
1905
+ /** What an invite or recovery link is for, before setting a password. */
1906
+ inspectLink(token) {
1907
+ return this.call(
1908
+ "POST",
1909
+ "/session/link/inspect",
1910
+ { token }
1911
+ );
1912
+ }
1913
+ redeemLink(input) {
1914
+ return this.call("POST", "/session/link", input);
1915
+ }
1916
+ // ── managing operators ─────────────────────────────────────────────────
1917
+ operators() {
1918
+ return this.get("/access/operators");
1919
+ }
1920
+ /** An invite link, shown once. Needs the highest scope and a fresh code. */
1921
+ inviteOperator(input) {
1922
+ return this.call("POST", "/access/operators/invites", input);
1923
+ }
1924
+ /** Lost password or authenticator: a single-use link; signs them out everywhere. */
1925
+ recoverOperator(id) {
1926
+ return this.call(
1927
+ "POST",
1928
+ `/access/operators/${encodeURIComponent(id)}/recovery`
1929
+ );
1930
+ }
1931
+ updateOperator(id, input) {
1932
+ return this.call("PUT", `/access/operators/${encodeURIComponent(id)}`, input);
1933
+ }
1934
+ revokeOperatorLink(id) {
1935
+ return this.call("DELETE", `/access/operators/links/${encodeURIComponent(id)}`);
1936
+ }
1868
1937
  };
1869
1938
 
1870
1939
  // src/modules/auth-admin.ts
@@ -2180,6 +2249,35 @@ function configKeyProblem(key) {
2180
2249
  if (!key) return "Enter a key.";
2181
2250
  return CONFIG_KEY_PATTERN.test(key) ? null : 'Start with a letter; use letters, digits, ".", "_" or "-" (max 128).';
2182
2251
  }
2252
+ var PLAIN_NUMBER = /^-?(0|[1-9]\d*)(\.\d+)?$/;
2253
+ function configValueLabel(value) {
2254
+ if (typeof value === "string") return "Text";
2255
+ if (typeof value === "number") return "Number";
2256
+ if (typeof value === "boolean") return "On/off";
2257
+ if (Array.isArray(value)) return "List";
2258
+ if (value === null) return "Empty";
2259
+ return "Object";
2260
+ }
2261
+ function inferConfigValue(raw) {
2262
+ const t = raw.trim();
2263
+ if (t === "true" || t === "false") {
2264
+ return { type: "boolean", value: t === "true", label: "On/off", ambiguous: true };
2265
+ }
2266
+ if (PLAIN_NUMBER.test(t)) {
2267
+ const n = Number(t);
2268
+ if (Number.isFinite(n) && String(n) === t) return { type: "number", value: n, label: "Number", ambiguous: true };
2269
+ }
2270
+ if (t.startsWith("{") || t.startsWith("[")) {
2271
+ try {
2272
+ const parsed = JSON.parse(t);
2273
+ if (parsed !== null && typeof parsed === "object") {
2274
+ return { type: "json", value: parsed, label: Array.isArray(parsed) ? "List" : "Object", ambiguous: false };
2275
+ }
2276
+ } catch {
2277
+ }
2278
+ }
2279
+ return { type: "string", value: raw, label: "Text", ambiguous: false };
2280
+ }
2183
2281
  export {
2184
2282
  AdminClient,
2185
2283
  AuditAdminClient,
@@ -2201,10 +2299,12 @@ export {
2201
2299
  WorkspacesClient,
2202
2300
  castConfigValue,
2203
2301
  configKeyProblem,
2302
+ configValueLabel,
2204
2303
  configValueType,
2205
2304
  createMemoryCache,
2206
2305
  describeLocation,
2207
2306
  formatConfigValue,
2307
+ inferConfigValue,
2208
2308
  isMfaRequired
2209
2309
  };
2210
2310
  //# sourceMappingURL=index.js.map