@gravity-rail/cli 0.5.1 → 0.7.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/lib.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ApiClient } from '@gravity-rail/client';
2
2
  import { E as EnvironmentConfig, C as CredentialsManager } from './cli-client-context-9KRUt6O-.js';
3
3
  export { a as ConciergeAppContextPayload, b as buildCliConciergeAppContext } from './cli-client-context-9KRUt6O-.js';
4
- import { GravityRailClient } from '@gravity-rail/sdk';
4
+ import { GravityRailClient, PhoneCall } from '@gravity-rail/sdk';
5
5
 
6
6
  /** Metadata extracted from a paginated API response */
7
7
  interface PaginationMeta {
@@ -132,6 +132,8 @@ declare function stderr(msg: string): void;
132
132
  interface GlobalOptions {
133
133
  env: string;
134
134
  realm?: string;
135
+ /** Override API base URL (also: GRAVITY_RAIL_API_URL env var). */
136
+ apiUrl?: string;
135
137
  outputFormat?: string;
136
138
  verbose?: boolean;
137
139
  allowWrite?: boolean;
@@ -242,9 +244,33 @@ declare class AuthRequiredError extends CLIError {
242
244
  }
243
245
  declare function handleError(err: unknown): never;
244
246
 
247
+ /**
248
+ * Whether the CLI should read --data / --file / stdin for this command.
249
+ *
250
+ * CRUD create/update handlers rely on COMMON_ARGS for --data, but those flags are
251
+ * not listed on cmd.args — without this helper, `gr members update --data …` silently
252
+ * skips the body.
253
+ */
254
+ declare function commandNeedsJsonBody(cmd: CommandDef, parsedArgs: ParsedArgs): boolean;
245
255
  /** Read JSON input from --data string, --file path, or stdin (if piped) */
246
256
  declare function readJsonInput(args: ParsedArgs): Promise<unknown | undefined>;
247
257
 
258
+ /** True when the number is a provisioned test placeholder, not a real handset. */
259
+ declare function isLikelySeedPhoneNumber(phone: string): boolean;
260
+ /**
261
+ * Poll until the outbound PhoneCall for a chat reaches a terminal or connected state.
262
+ * Throws CLIError when Twilio reports failure (often within 1–2s).
263
+ */
264
+ declare function waitForOutboundPhoneCallOutcome(client: GravityRailClient, workspaceUuid: string, chatId: number, memberId: number, options?: {
265
+ timeoutMs?: number;
266
+ intervalMs?: number;
267
+ }): Promise<PhoneCall>;
268
+ /**
269
+ * Resolve the workspace PhoneNumber id to use for outbound voice.
270
+ * Order: explicit flag → workspace defaults → first voice-enabled line.
271
+ */
272
+ declare function resolveVoicePhoneNumberId(client: GravityRailClient, workspaceUuid: string, explicitId?: number): Promise<number>;
273
+
248
274
  /**
249
275
  * @deprecated Use `SimpleCrudConfig` with `simpleCrudCommands()` for new code.
250
276
  *
@@ -271,6 +297,8 @@ interface CrudConfig<T = unknown> {
271
297
  extra?: CommandDef[];
272
298
  /** Example lines shown in help for the create command */
273
299
  createExamples?: string[];
300
+ /** Example lines shown in help for the update command */
301
+ updateExamples?: string[];
274
302
  /**
275
303
  * Controls how the CRUD list handler interacts with pagination.
276
304
  *
@@ -301,7 +329,7 @@ declare function crudCommands<T>(config: CrudConfig<T>): CommandDef[];
301
329
  * Typed CRUD config for simple, top-level resources.
302
330
  *
303
331
  * Unlike the stringly-typed `CrudConfig`, operations are typed functions that
304
- * receive the real `GravityRailClient`. TypeScript validates the call at the definition
332
+ * receive the real `ApiClient`. TypeScript validates the call at the definition
305
333
  * site, eliminating the string-dispatch + positional-argument blind spot.
306
334
  *
307
335
  * Use this for resources that fit the simple CRUD contract:
@@ -333,16 +361,16 @@ interface SimpleCrudConfig<T = unknown> {
333
361
  extra?: CommandDef[];
334
362
  createExamples?: string[];
335
363
  paginationSupport?: 'full' | 'client-only' | false;
336
- list?: (client: GravityRailClient, workspace: string, opts?: Record<string, unknown>) => Promise<unknown>;
337
- get?: (client: GravityRailClient, workspace: string, id: string) => Promise<unknown>;
338
- create?: (client: GravityRailClient, workspace: string, data: unknown) => Promise<unknown>;
339
- update?: (client: GravityRailClient, workspace: string, id: string, data: unknown) => Promise<unknown>;
340
- delete?: (client: GravityRailClient, workspace: string, id: string) => Promise<unknown>;
341
- archive?: (client: GravityRailClient, workspace: string, id: string) => Promise<unknown>;
342
- unarchive?: (client: GravityRailClient, workspace: string, id: string) => Promise<unknown>;
364
+ list?: (client: ApiClient, workspace: string, opts?: Record<string, unknown>) => Promise<unknown>;
365
+ get?: (client: ApiClient, workspace: string, id: string) => Promise<unknown>;
366
+ create?: (client: ApiClient, workspace: string, data: unknown) => Promise<unknown>;
367
+ update?: (client: ApiClient, workspace: string, id: string, data: unknown) => Promise<unknown>;
368
+ delete?: (client: ApiClient, workspace: string, id: string) => Promise<unknown>;
369
+ archive?: (client: ApiClient, workspace: string, id: string) => Promise<unknown>;
370
+ unarchive?: (client: ApiClient, workspace: string, id: string) => Promise<unknown>;
343
371
  /** When true, adds a --cascade flag to the delete command. */
344
372
  supportsCascade?: boolean;
345
- deleteFn?: (client: GravityRailClient, workspace: string, id: string, cascade: boolean) => Promise<unknown>;
373
+ deleteFn?: (client: ApiClient, workspace: string, id: string, cascade: boolean) => Promise<unknown>;
346
374
  }
347
375
  /**
348
376
  * Generate CRUD commands from typed callable functions.
@@ -406,6 +434,18 @@ interface ConciergeMessage {
406
434
  declare function listConciergeChats(ctx: AuthenticatedContext): Promise<ConciergeChat[]>;
407
435
  declare function createConciergeChat(ctx: AuthenticatedContext, title?: string): Promise<ConciergeChat>;
408
436
  declare function getConciergeChat(ctx: AuthenticatedContext, chatId: number): Promise<ConciergeChat>;
437
+ interface ConciergeCallResult {
438
+ callSid: string;
439
+ startedAt: string;
440
+ }
441
+ interface ConciergeSmsResult {
442
+ messageSid: string;
443
+ conversationId: string;
444
+ }
445
+ declare function originateConciergeCall(ctx: AuthenticatedContext, kind?: string): Promise<ConciergeCallResult>;
446
+ declare function originateConciergeSms(ctx: AuthenticatedContext, kind?: string): Promise<ConciergeSmsResult>;
447
+ declare function startAccountPhoneVerify(ctx: AuthenticatedContext, phone: string): Promise<void>;
448
+ declare function confirmAccountPhoneVerify(ctx: AuthenticatedContext, code: string): Promise<void>;
409
449
  declare function getConciergeChatMessages(ctx: AuthenticatedContext, chatId: number): Promise<ConciergeMessage[]>;
410
450
 
411
451
  /**
@@ -425,6 +465,7 @@ declare function authBrowserCommand(ctx: AuthenticatedContext, args: Record<stri
425
465
  * but without requiring a workspace.
426
466
  */
427
467
 
468
+ declare function conciergeOutboundCommand(hctx: CommandHandlerContext): Promise<void>;
428
469
  declare function conciergeCommand(hctx: CommandHandlerContext): Promise<void>;
429
470
 
430
471
  /**
@@ -459,4 +500,4 @@ declare function organizationsListCommand(ctx: AuthenticatedContext): Promise<vo
459
500
 
460
501
  declare function whoamiCommand(ctx: AuthenticatedContext): Promise<void>;
461
502
 
462
- export { type ArgDef, AuthRequiredError, type AuthenticatedContext, CLIError, COL, type CommandContext, type CommandDef, type CommandHandlerContext, CommandRegistry, type ConciergeChat, type ConciergeMessage, type DomainDef, type GlobalOptions, LIST_PAGINATION_ARGS, type OutputFormat, type OutputOptions, PAGINATION_ARGS, type PaginationMeta, type ParsedArgs, type PublicGlobalOptions, type TableColumn, authBrowserCommand, chatCommand, conciergeCommand, createAuthenticatedContext, createConciergeChat, createContext, createPublicAuthenticatedContext, createPublicContext, crudCommands, detectOutputFormat, devImportLocalCommand, extractPaginationMeta, fetchAllCursorPages, fetchAllPages, formatPaginationWarning, getConciergeChat, getConciergeChatMessages, getStartedCommand, handleError, isCursorPaginatedResponse, isDirectoryTrusted, isListResult, isPagePaginatedResponse, isPaginatedResponse, listConciergeChats, listResult, loginCommand, logoutCommand, manageCommand, organizationsListCommand, outputData, outputSingle, parseArgs, parsePaginationArgs, readJsonInput, registerPublicDomains, requireAuth, requireDirectoryTrust, requireNumber, requireString, simpleCrudCommands, stderr, unwrapItems, whoamiCommand };
503
+ export { type ArgDef, AuthRequiredError, type AuthenticatedContext, CLIError, COL, type CommandContext, type CommandDef, type CommandHandlerContext, CommandRegistry, type ConciergeChat, type ConciergeMessage, type DomainDef, type GlobalOptions, LIST_PAGINATION_ARGS, type OutputFormat, type OutputOptions, PAGINATION_ARGS, type PaginationMeta, type ParsedArgs, type PublicGlobalOptions, type TableColumn, authBrowserCommand, chatCommand, commandNeedsJsonBody, conciergeCommand, conciergeOutboundCommand, confirmAccountPhoneVerify, createAuthenticatedContext, createConciergeChat, createContext, createPublicAuthenticatedContext, createPublicContext, crudCommands, detectOutputFormat, devImportLocalCommand, extractPaginationMeta, fetchAllCursorPages, fetchAllPages, formatPaginationWarning, getConciergeChat, getConciergeChatMessages, getStartedCommand, handleError, isCursorPaginatedResponse, isDirectoryTrusted, isLikelySeedPhoneNumber, isListResult, isPagePaginatedResponse, isPaginatedResponse, listConciergeChats, listResult, loginCommand, logoutCommand, manageCommand, organizationsListCommand, originateConciergeCall, originateConciergeSms, outputData, outputSingle, parseArgs, parsePaginationArgs, readJsonInput, registerPublicDomains, requireAuth, requireDirectoryTrust, requireNumber, requireString, resolveVoicePhoneNumberId, simpleCrudCommands, startAccountPhoneVerify, stderr, unwrapItems, waitForOutboundPhoneCallOutcome, whoamiCommand };