@mindstudio-ai/agent 0.1.36 → 0.1.38

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.ts CHANGED
@@ -223,8 +223,8 @@ interface AppRoleAssignment {
223
223
  }
224
224
  /** Auth context for an app. */
225
225
  interface AppAuthContext {
226
- /** The authenticated user ID. */
227
- userId: string;
226
+ /** The authenticated user ID, or null for unauthenticated users. */
227
+ userId: string | null;
228
228
  /** All role assignments for this app (all users, all roles). */
229
229
  roleAssignments: AppRoleAssignment[];
230
230
  }
@@ -477,8 +477,8 @@ interface HttpClientConfig {
477
477
  * context hydration time.
478
478
  */
479
479
  declare class AuthContext {
480
- /** The current user's ID. */
481
- readonly userId: string;
480
+ /** The current user's ID, or null for unauthenticated users. */
481
+ readonly userId: string | null;
482
482
  /** The current user's roles in this app. */
483
483
  readonly roles: readonly string[];
484
484
  /** All role assignments for this app (all users, all roles). */
@@ -732,6 +732,9 @@ declare class Query<T, TResult = T[]> implements PromiseLike<TResult> {
732
732
  private readonly _limit;
733
733
  private readonly _offset;
734
734
  private readonly _config;
735
+ /** @internal Pre-compiled WHERE clause (bypasses predicate compiler). Used by Table.get(). */
736
+ private readonly _rawWhere;
737
+ private readonly _rawWhereParams;
735
738
  /** @internal Post-process transform applied after row deserialization. */
736
739
  readonly _postProcess: ((rows: T[]) => TResult) | undefined;
737
740
  constructor(config: TableConfig, options?: {
@@ -741,6 +744,8 @@ declare class Query<T, TResult = T[]> implements PromiseLike<TResult> {
741
744
  limit?: number;
742
745
  offset?: number;
743
746
  postProcess?: (rows: T[]) => TResult;
747
+ rawWhere?: string;
748
+ rawWhereParams?: unknown[];
744
749
  });
745
750
  private _clone;
746
751
  filter(predicate: Predicate<T>): Query<T>;
@@ -750,12 +755,12 @@ declare class Query<T, TResult = T[]> implements PromiseLike<TResult> {
750
755
  skip(n: number): Query<T>;
751
756
  first(): Query<T, T | null>;
752
757
  last(): Query<T, T | null>;
753
- count(): Promise<number>;
754
- some(): Promise<boolean>;
758
+ count(): Query<T, number>;
759
+ some(): Query<T, boolean>;
755
760
  every(): Promise<boolean>;
756
761
  min(accessor: Accessor<T, number>): Query<T, T | null>;
757
762
  max(accessor: Accessor<T, number>): Query<T, T | null>;
758
- groupBy<K extends string | number>(accessor: Accessor<T, K>): Promise<Map<K, T[]>>;
763
+ groupBy<K extends string | number>(accessor: Accessor<T, K>): Query<T, Map<K, T[]>>;
759
764
  /**
760
765
  * @internal Compile this query into a SqlQuery for batch execution.
761
766
  *
@@ -890,16 +895,30 @@ declare class Table<T> {
890
895
  /** @internal */
891
896
  private readonly _config;
892
897
  constructor(config: TableConfig);
893
- get(id: string): Promise<T | null>;
894
- findOne(predicate: Predicate<T>): Promise<T | null>;
895
- count(predicate?: Predicate<T>): Promise<number>;
896
- some(predicate: Predicate<T>): Promise<boolean>;
898
+ /** Get a single row by ID. Returns null if not found. */
899
+ get(id: string): Query<T, T | null>;
900
+ /** Find the first row matching a predicate. Returns null if none match. */
901
+ findOne(predicate: Predicate<T>): Query<T, T | null>;
902
+ /** Count all rows, or rows matching a predicate. */
903
+ count(): Query<T, number>;
904
+ count(predicate: Predicate<T>): Query<T, number>;
905
+ /** True if any row matches the predicate. */
906
+ some(predicate: Predicate<T>): Query<T, boolean>;
907
+ /** True if all rows match the predicate. */
897
908
  every(predicate: Predicate<T>): Promise<boolean>;
909
+ /** True if the table has zero rows. */
898
910
  isEmpty(): Promise<boolean>;
899
- min(accessor: Accessor<T, number>): Promise<T | null>;
900
- max(accessor: Accessor<T, number>): Promise<T | null>;
901
- groupBy<K extends string | number>(accessor: Accessor<T, K>): Promise<Map<K, T[]>>;
911
+ /** Row with the minimum value for a field, or null if table is empty. */
912
+ min(accessor: Accessor<T, number>): Query<T, T | null>;
913
+ /** Row with the maximum value for a field, or null if table is empty. */
914
+ max(accessor: Accessor<T, number>): Query<T, T | null>;
915
+ /** Group rows by a field. Returns a Map. */
916
+ groupBy<K extends string | number>(accessor: Accessor<T, K>): Query<T, Map<K, T[]>>;
917
+ /** Get all rows as an array. */
918
+ toArray(): Query<T>;
919
+ /** Filter rows by a predicate. Returns a chainable Query. */
902
920
  filter(predicate: Predicate<T>): Query<T>;
921
+ /** Sort rows by a field. Returns a chainable Query. */
903
922
  sortBy(accessor: Accessor<T>): Query<T>;
904
923
  /**
905
924
  * Insert one or more rows. Returns the created row(s) with system fields
@@ -915,12 +934,14 @@ declare class Table<T> {
915
934
  * Returns the updated row via `UPDATE ... RETURNING *`.
916
935
  */
917
936
  update(id: string, data: UpdateInput<T>): Mutation<T>;
918
- remove(id: string): Mutation<void>;
937
+ remove(id: string): Mutation<{
938
+ deleted: boolean;
939
+ }>;
919
940
  /**
920
941
  * Remove all rows matching a predicate. Returns the count removed.
921
942
  */
922
943
  removeAll(predicate: Predicate<T>): Mutation<number>;
923
- clear(): Mutation<void>;
944
+ clear(): Mutation<number>;
924
945
  /**
925
946
  * Insert a row, or update it if a row with the same unique key already
926
947
  * exists. The conflict key must match a `unique` constraint declared in
@@ -4452,6 +4473,8 @@ interface SendEmailStepInput {
4452
4473
  subject: string;
4453
4474
  /** Email body content (plain text, markdown, HTML, or a CDN URL to an HTML file) */
4454
4475
  body: string;
4476
+ /** Direct recipient email address(es). For v2 apps, must be verified app users. */
4477
+ to?: string | string[];
4455
4478
  /** OAuth connection ID(s) for the recipient(s), comma-separated for multiple */
4456
4479
  connectionId?: string;
4457
4480
  /** When true, auto-convert the body text into a styled HTML email using AI */
@@ -7382,10 +7405,11 @@ interface StepMethods {
7382
7405
  */
7383
7406
  searchYoutubeTrends(step: SearchYoutubeTrendsStepInput, options?: StepExecutionOptions): Promise<StepExecutionResult<SearchYoutubeTrendsStepOutput>>;
7384
7407
  /**
7385
- * Send an email to one or more configured recipient addresses.
7408
+ * Send an email to one or more recipient addresses.
7386
7409
  *
7387
7410
  * @remarks
7388
- * - Recipient email addresses are resolved from OAuth connections configured by the app creator. The user running the workflow does not specify the recipient directly.
7411
+ * - Use the "to" field to send to specific email addresses directly. For v2 apps, recipients must be verified users in the app's user table.
7412
+ * - Alternatively, recipient email addresses can be resolved from OAuth connections configured by the app creator via connectionId. The user running the workflow does not specify the recipient directly.
7389
7413
  * - If the body is a URL to a hosted HTML file on the CDN, the HTML is fetched and used as the email body.
7390
7414
  * - When generateHtml is enabled, the body text is converted to a styled HTML email using an AI model.
7391
7415
  * - connectionId can be a comma-separated list to send to multiple recipients.
@@ -7903,6 +7927,8 @@ declare class MindStudioError extends Error {
7903
7927
  status: number,
7904
7928
  /** Raw error body from the API, if available. */
7905
7929
  details?: unknown | undefined);
7930
+ toString(): string;
7931
+ toJSON(): Record<string, unknown>;
7906
7932
  }
7907
7933
 
7908
7934
  type MonacoSnippetFieldType = 'string' | 'number' | 'boolean' | 'array' | 'object' | string[];