@elevasis/core 0.8.3 → 0.10.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,312 +1,8 @@
1
- import { FunctionsClient } from '@supabase/functions-js';
2
- import { PostgrestClient, PostgrestQueryBuilder, PostgrestFilterBuilder } from '@supabase/postgrest-js';
3
- import { RealtimeClientOptions, RealtimeClient, RealtimeChannelOptions, RealtimeChannel } from '@supabase/realtime-js';
4
- import { StorageClientOptions, StorageClient } from '@supabase/storage-js';
5
- import { GoTrueClientOptions, AuthClient } from '@supabase/auth-js';
6
-
7
- type GenericRelationship = {
8
- foreignKeyName: string;
9
- columns: string[];
10
- isOneToOne?: boolean;
11
- referencedRelation: string;
12
- referencedColumns: string[];
13
- };
14
- type GenericTable = {
15
- Row: Record<string, unknown>;
16
- Insert: Record<string, unknown>;
17
- Update: Record<string, unknown>;
18
- Relationships: GenericRelationship[];
19
- };
20
- type GenericUpdatableView = {
21
- Row: Record<string, unknown>;
22
- Insert: Record<string, unknown>;
23
- Update: Record<string, unknown>;
24
- Relationships: GenericRelationship[];
25
- };
26
- type GenericNonUpdatableView = {
27
- Row: Record<string, unknown>;
28
- Relationships: GenericRelationship[];
29
- };
30
- type GenericView = GenericUpdatableView | GenericNonUpdatableView;
31
- type GenericSetofOption = {
32
- isSetofReturn?: boolean | undefined;
33
- isOneToOne?: boolean | undefined;
34
- isNotNullable?: boolean | undefined;
35
- to: string;
36
- from: string;
37
- };
38
- type GenericFunction = {
39
- Args: Record<string, unknown> | never;
40
- Returns: unknown;
41
- SetofOptions?: GenericSetofOption;
42
- };
43
- type GenericSchema = {
44
- Tables: Record<string, GenericTable>;
45
- Views: Record<string, GenericView>;
46
- Functions: Record<string, GenericFunction>;
47
- };
48
-
49
- interface SupabaseAuthClientOptions extends GoTrueClientOptions {
50
- }
51
- type Fetch = typeof fetch;
52
- type SupabaseClientOptions<SchemaName> = {
53
- /**
54
- * The Postgres schema which your tables belong to. Must be on the list of exposed schemas in Supabase. Defaults to `public`.
55
- */
56
- db?: {
57
- schema?: SchemaName;
58
- };
59
- auth?: {
60
- /**
61
- * Automatically refreshes the token for logged-in users. Defaults to true.
62
- */
63
- autoRefreshToken?: boolean;
64
- /**
65
- * Optional key name used for storing tokens in local storage.
66
- */
67
- storageKey?: string;
68
- /**
69
- * Whether to persist a logged-in session to storage. Defaults to true.
70
- */
71
- persistSession?: boolean;
72
- /**
73
- * Detect a session from the URL. Used for OAuth login callbacks. Defaults to true.
74
- */
75
- detectSessionInUrl?: boolean;
76
- /**
77
- * A storage provider. Used to store the logged-in session.
78
- */
79
- storage?: SupabaseAuthClientOptions['storage'];
80
- /**
81
- * A storage provider to store the user profile separately from the session.
82
- * Useful when you need to store the session information in cookies,
83
- * without bloating the data with the redundant user object.
84
- *
85
- * @experimental
86
- */
87
- userStorage?: SupabaseAuthClientOptions['userStorage'];
88
- /**
89
- * OAuth flow to use - defaults to implicit flow. PKCE is recommended for mobile and server-side applications.
90
- */
91
- flowType?: SupabaseAuthClientOptions['flowType'];
92
- /**
93
- * If debug messages for authentication client are emitted. Can be used to inspect the behavior of the library.
94
- */
95
- debug?: SupabaseAuthClientOptions['debug'];
96
- /**
97
- * Provide your own locking mechanism based on the environment. By default no locking is done at this time.
98
- *
99
- * @experimental
100
- */
101
- lock?: SupabaseAuthClientOptions['lock'];
102
- /**
103
- * If there is an error with the query, throwOnError will reject the promise by
104
- * throwing the error instead of returning it as part of a successful response.
105
- */
106
- throwOnError?: SupabaseAuthClientOptions['throwOnError'];
107
- };
108
- /**
109
- * Options passed to the realtime-js instance
110
- */
111
- realtime?: RealtimeClientOptions;
112
- storage?: StorageClientOptions;
113
- global?: {
114
- /**
115
- * A custom `fetch` implementation.
116
- */
117
- fetch?: Fetch;
118
- /**
119
- * Optional headers for initializing the client.
120
- */
121
- headers?: Record<string, string>;
122
- };
123
- /**
124
- * Optional function for using a third-party authentication system with
125
- * Supabase. The function should return an access token or ID token (JWT) by
126
- * obtaining it from the third-party auth SDK. Note that this
127
- * function may be called concurrently and many times. Use memoization and
128
- * locking techniques if this is not supported by the SDKs.
129
- *
130
- * When set, the `auth` namespace of the Supabase client cannot be used.
131
- * Create another client if you wish to use Supabase Auth and third-party
132
- * authentications concurrently in the same application.
133
- */
134
- accessToken?: () => Promise<string | null>;
135
- };
136
-
137
- declare class SupabaseAuthClient extends AuthClient {
138
- constructor(options: SupabaseAuthClientOptions);
139
- }
140
-
141
- /**
142
- * AUTO-GENERATED FILE - DO NOT EDIT
143
- *
144
- * This file is automatically synchronized from @supabase/postgrest-js
145
- * Source: packages/core/postgrest-js/src/types/common/
146
- *
147
- * To update this file, modify the source in postgrest-js and run:
148
- * npm run codegen
149
- */
150
-
151
- type IsMatchingArgs<FnArgs extends GenericFunction['Args'], PassedArgs extends GenericFunction['Args']> = [FnArgs] extends [Record<PropertyKey, never>] ? PassedArgs extends Record<PropertyKey, never> ? true : false : keyof PassedArgs extends keyof FnArgs ? PassedArgs extends FnArgs ? true : false : false;
152
- type MatchingFunctionArgs<Fn extends GenericFunction, Args extends GenericFunction['Args']> = Fn extends {
153
- Args: infer A extends GenericFunction['Args'];
154
- } ? IsMatchingArgs<A, Args> extends true ? Fn : never : false;
155
- type FindMatchingFunctionByArgs<FnUnion, Args extends GenericFunction['Args']> = FnUnion extends infer Fn extends GenericFunction ? MatchingFunctionArgs<Fn, Args> : false;
156
- type TablesAndViews<Schema extends GenericSchema> = Schema['Tables'] & Exclude<Schema['Views'], ''>;
157
- type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
158
- type LastOf<T> = UnionToIntersection<T extends any ? () => T : never> extends () => infer R ? R : never;
159
- type IsAny<T> = 0 extends 1 & T ? true : false;
160
- type ExactMatch<T, S> = [T] extends [S] ? ([S] extends [T] ? true : false) : false;
161
- type ExtractExactFunction<Fns, Args> = Fns extends infer F ? F extends GenericFunction ? ExactMatch<F['Args'], Args> extends true ? F : never : never : never;
162
- type IsNever<T> = [T] extends [never] ? true : false;
163
- type RpcFunctionNotFound<FnName> = {
164
- Row: any;
165
- Result: {
166
- error: true;
167
- } & "Couldn't infer function definition matching provided arguments";
168
- RelationName: FnName;
169
- Relationships: null;
170
- };
171
- type GetRpcFunctionFilterBuilderByArgs<Schema extends GenericSchema, FnName extends string & keyof Schema['Functions'], Args> = {
172
- 0: Schema['Functions'][FnName];
173
- 1: IsAny<Schema> extends true ? any : IsNever<Args> extends true ? IsNever<ExtractExactFunction<Schema['Functions'][FnName], Args>> extends true ? LastOf<Schema['Functions'][FnName]> : ExtractExactFunction<Schema['Functions'][FnName], Args> : Args extends Record<PropertyKey, never> ? LastOf<Schema['Functions'][FnName]> : Args extends GenericFunction['Args'] ? IsNever<LastOf<FindMatchingFunctionByArgs<Schema['Functions'][FnName], Args>>> extends true ? LastOf<Schema['Functions'][FnName]> : LastOf<FindMatchingFunctionByArgs<Schema['Functions'][FnName], Args>> : ExtractExactFunction<Schema['Functions'][FnName], Args> extends GenericFunction ? ExtractExactFunction<Schema['Functions'][FnName], Args> : any;
174
- }[1] extends infer Fn ? IsAny<Fn> extends true ? {
175
- Row: any;
176
- Result: any;
177
- RelationName: FnName;
178
- Relationships: null;
179
- } : Fn extends GenericFunction ? {
180
- Row: Fn['SetofOptions'] extends GenericSetofOption ? Fn['SetofOptions']['isSetofReturn'] extends true ? TablesAndViews<Schema>[Fn['SetofOptions']['to']]['Row'] : TablesAndViews<Schema>[Fn['SetofOptions']['to']]['Row'] : Fn['Returns'] extends any[] ? Fn['Returns'][number] extends Record<string, unknown> ? Fn['Returns'][number] : never : Fn['Returns'] extends Record<string, unknown> ? Fn['Returns'] : never;
181
- Result: Fn['SetofOptions'] extends GenericSetofOption ? Fn['SetofOptions']['isSetofReturn'] extends true ? Fn['SetofOptions']['isOneToOne'] extends true ? Fn['Returns'][] : Fn['Returns'] : Fn['Returns'] : Fn['Returns'];
182
- RelationName: Fn['SetofOptions'] extends GenericSetofOption ? Fn['SetofOptions']['to'] : FnName;
183
- Relationships: Fn['SetofOptions'] extends GenericSetofOption ? Fn['SetofOptions']['to'] extends keyof Schema['Tables'] ? Schema['Tables'][Fn['SetofOptions']['to']]['Relationships'] : Schema['Views'][Fn['SetofOptions']['to']]['Relationships'] : null;
184
- } : Fn extends false ? RpcFunctionNotFound<FnName> : RpcFunctionNotFound<FnName> : RpcFunctionNotFound<FnName>;
185
-
186
- /**
187
- * Supabase Client.
188
- *
189
- * An isomorphic Javascript client for interacting with Postgres.
190
- */
191
- declare class SupabaseClient<Database = any, SchemaNameOrClientOptions extends (string & keyof Omit<Database, '__InternalSupabase'>) | {
192
- PostgrestVersion: string;
193
- } = 'public' extends keyof Omit<Database, '__InternalSupabase'> ? 'public' : string & keyof Omit<Database, '__InternalSupabase'>, SchemaName extends string & keyof Omit<Database, '__InternalSupabase'> = SchemaNameOrClientOptions extends string & keyof Omit<Database, '__InternalSupabase'> ? SchemaNameOrClientOptions : 'public' extends keyof Omit<Database, '__InternalSupabase'> ? 'public' : string & keyof Omit<Omit<Database, '__InternalSupabase'>, '__InternalSupabase'>, Schema extends Omit<Database, '__InternalSupabase'>[SchemaName] extends GenericSchema ? Omit<Database, '__InternalSupabase'>[SchemaName] : never = Omit<Database, '__InternalSupabase'>[SchemaName] extends GenericSchema ? Omit<Database, '__InternalSupabase'>[SchemaName] : never, ClientOptions extends {
194
- PostgrestVersion: string;
195
- } = SchemaNameOrClientOptions extends string & keyof Omit<Database, '__InternalSupabase'> ? Database extends {
196
- __InternalSupabase: {
197
- PostgrestVersion: string;
198
- };
199
- } ? Database['__InternalSupabase'] : {
200
- PostgrestVersion: '12';
201
- } : SchemaNameOrClientOptions extends {
202
- PostgrestVersion: string;
203
- } ? SchemaNameOrClientOptions : never> {
204
- protected supabaseUrl: string;
205
- protected supabaseKey: string;
206
- /**
207
- * Supabase Auth allows you to create and manage user sessions for access to data that is secured by access policies.
208
- */
209
- auth: SupabaseAuthClient;
210
- realtime: RealtimeClient;
211
- /**
212
- * Supabase Storage allows you to manage user-generated content, such as photos or videos.
213
- */
214
- storage: StorageClient;
215
- protected realtimeUrl: URL;
216
- protected authUrl: URL;
217
- protected storageUrl: URL;
218
- protected functionsUrl: URL;
219
- protected rest: PostgrestClient<Database, ClientOptions, SchemaName>;
220
- protected storageKey: string;
221
- protected fetch?: Fetch;
222
- protected changedAccessToken?: string;
223
- protected accessToken?: () => Promise<string | null>;
224
- protected headers: Record<string, string>;
225
- /**
226
- * Create a new client for use in the browser.
227
- * @param supabaseUrl The unique Supabase URL which is supplied when you create a new project in your project dashboard.
228
- * @param supabaseKey The unique Supabase Key which is supplied when you create a new project in your project dashboard.
229
- * @param options.db.schema You can switch in between schemas. The schema needs to be on the list of exposed schemas inside Supabase.
230
- * @param options.auth.autoRefreshToken Set to "true" if you want to automatically refresh the token before expiring.
231
- * @param options.auth.persistSession Set to "true" if you want to automatically save the user session into local storage.
232
- * @param options.auth.detectSessionInUrl Set to "true" if you want to automatically detects OAuth grants in the URL and signs in the user.
233
- * @param options.realtime Options passed along to realtime-js constructor.
234
- * @param options.storage Options passed along to the storage-js constructor.
235
- * @param options.global.fetch A custom fetch implementation.
236
- * @param options.global.headers Any additional headers to send with each network request.
237
- */
238
- constructor(supabaseUrl: string, supabaseKey: string, options?: SupabaseClientOptions<SchemaName>);
239
- /**
240
- * Supabase Functions allows you to deploy and invoke edge functions.
241
- */
242
- get functions(): FunctionsClient;
243
- from<TableName extends string & keyof Schema['Tables'], Table extends Schema['Tables'][TableName]>(relation: TableName): PostgrestQueryBuilder<ClientOptions, Schema, Table, TableName>;
244
- from<ViewName extends string & keyof Schema['Views'], View extends Schema['Views'][ViewName]>(relation: ViewName): PostgrestQueryBuilder<ClientOptions, Schema, View, ViewName>;
245
- /**
246
- * Select a schema to query or perform an function (rpc) call.
247
- *
248
- * The schema needs to be on the list of exposed schemas inside Supabase.
249
- *
250
- * @param schema - The schema to query
251
- */
252
- schema<DynamicSchema extends string & keyof Omit<Database, '__InternalSupabase'>>(schema: DynamicSchema): PostgrestClient<Database, ClientOptions, DynamicSchema, Database[DynamicSchema] extends GenericSchema ? Database[DynamicSchema] : any>;
253
- /**
254
- * Perform a function call.
255
- *
256
- * @param fn - The function name to call
257
- * @param args - The arguments to pass to the function call
258
- * @param options - Named parameters
259
- * @param options.head - When set to `true`, `data` will not be returned.
260
- * Useful if you only need the count.
261
- * @param options.get - When set to `true`, the function will be called with
262
- * read-only access mode.
263
- * @param options.count - Count algorithm to use to count rows returned by the
264
- * function. Only applicable for [set-returning
265
- * functions](https://www.postgresql.org/docs/current/functions-srf.html).
266
- *
267
- * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
268
- * hood.
269
- *
270
- * `"planned"`: Approximated but fast count algorithm. Uses the Postgres
271
- * statistics under the hood.
272
- *
273
- * `"estimated"`: Uses exact count for low numbers and planned count for high
274
- * numbers.
275
- */
276
- rpc<FnName extends string & keyof Schema['Functions'], Args extends Schema['Functions'][FnName]['Args'] = never, FilterBuilder extends GetRpcFunctionFilterBuilderByArgs<Schema, FnName, Args> = GetRpcFunctionFilterBuilderByArgs<Schema, FnName, Args>>(fn: FnName, args?: Args, options?: {
277
- head?: boolean;
278
- get?: boolean;
279
- count?: 'exact' | 'planned' | 'estimated';
280
- }): PostgrestFilterBuilder<ClientOptions, Schema, FilterBuilder['Row'], FilterBuilder['Result'], FilterBuilder['RelationName'], FilterBuilder['Relationships'], 'RPC'>;
281
- /**
282
- * Creates a Realtime channel with Broadcast, Presence, and Postgres Changes.
283
- *
284
- * @param {string} name - The name of the Realtime channel.
285
- * @param {Object} opts - The options to pass to the Realtime channel.
286
- *
287
- */
288
- channel(name: string, opts?: RealtimeChannelOptions): RealtimeChannel;
289
- /**
290
- * Returns all Realtime channels.
291
- */
292
- getChannels(): RealtimeChannel[];
293
- /**
294
- * Unsubscribes and removes Realtime channel from Realtime client.
295
- *
296
- * @param {RealtimeChannel} channel - The name of the Realtime channel.
297
- *
298
- */
299
- removeChannel(channel: RealtimeChannel): Promise<'ok' | 'timed out' | 'error'>;
300
- /**
301
- * Unsubscribes and removes all Realtime channels from Realtime client.
302
- */
303
- removeAllChannels(): Promise<('ok' | 'timed out' | 'error')[]>;
304
- private _getAccessToken;
305
- private _initSupabaseAuthClient;
306
- private _initRealtimeClient;
307
- private _listenForAuthEvents;
308
- private _handleTokenChanged;
309
- }
1
+ import * as _supabase_supabase_js from '@supabase/supabase-js';
2
+ import { SupabaseClient as SupabaseClient$1 } from '@supabase/supabase-js';
3
+ import * as vitest from 'vitest';
4
+ import { vi } from 'vitest';
5
+ import { z } from 'zod';
310
6
 
311
7
  type Json = string | number | boolean | null | {
312
8
  [key: string]: Json | undefined;
@@ -2944,6 +2640,19 @@ type Database = {
2944
2640
  };
2945
2641
  };
2946
2642
  };
2643
+ type DatabaseWithoutInternals = Omit<Database, "__InternalSupabase">;
2644
+ type DefaultSchema = DatabaseWithoutInternals[Extract<keyof Database, "public">];
2645
+ type Tables<DefaultSchemaTableNameOrOptions extends keyof (DefaultSchema["Tables"] & DefaultSchema["Views"]) | {
2646
+ schema: keyof DatabaseWithoutInternals;
2647
+ }, TableName extends DefaultSchemaTableNameOrOptions extends {
2648
+ schema: keyof DatabaseWithoutInternals;
2649
+ } ? keyof (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] & DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Views"]) : never = never> = DefaultSchemaTableNameOrOptions extends {
2650
+ schema: keyof DatabaseWithoutInternals;
2651
+ } ? (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] & DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Views"])[TableName] extends {
2652
+ Row: infer R;
2653
+ } ? R : never : DefaultSchemaTableNameOrOptions extends keyof (DefaultSchema["Tables"] & DefaultSchema["Views"]) ? (DefaultSchema["Tables"] & DefaultSchema["Views"])[DefaultSchemaTableNameOrOptions] extends {
2654
+ Row: infer R;
2655
+ } ? R : never : never;
2947
2656
 
2948
2657
  /**
2949
2658
  * RLS Test Context Manager
@@ -2989,7 +2698,7 @@ interface Membership {
2989
2698
  role_slug: Role;
2990
2699
  }
2991
2700
  declare class RLSTestContext {
2992
- adminClient: SupabaseClient<Database>;
2701
+ adminClient: SupabaseClient$1<Database>;
2993
2702
  testPrefix: string;
2994
2703
  createdIds: {
2995
2704
  users: string[];
@@ -3039,19 +2748,19 @@ declare class RLSTestContext {
3039
2748
  * Create a Supabase client for a specific user (respects RLS)
3040
2749
  * This client will have the user's JWT token, so RLS policies will apply
3041
2750
  */
3042
- createUserClient(workosUserId: string): SupabaseClient<Database>;
2751
+ createUserClient(workosUserId: string): SupabaseClient$1<Database>;
3043
2752
  /**
3044
2753
  * Create a Supabase client for a pre-provisioned user (respects RLS)
3045
2754
  * Uses a dummy workos_user_id but includes the email claim for RLS matching
3046
2755
  * The email claim is what matters for pre-provisioned user RLS policies
3047
2756
  */
3048
- createPreProvisionedUserClient(email: string): SupabaseClient<Database>;
2757
+ createPreProvisionedUserClient(email: string): SupabaseClient$1<Database>;
3049
2758
  /** Create an organization with an admin user and authenticated client. */
3050
2759
  createOrgWithAdmin(name: string, email: string): Promise<{
3051
2760
  org: Organization;
3052
2761
  user: UserWithWorkosId;
3053
2762
  membership: Membership;
3054
- client: SupabaseClient<Database>;
2763
+ client: SupabaseClient$1<Database>;
3055
2764
  }>;
3056
2765
  /** Create two isolated organizations with admin users for cross-org isolation tests. */
3057
2766
  createCrossOrgFixture(nameA?: string, nameB?: string): Promise<{
@@ -3061,8 +2770,8 @@ declare class RLSTestContext {
3061
2770
  userB: UserWithWorkosId;
3062
2771
  membershipA: Membership;
3063
2772
  membershipB: Membership;
3064
- clientA: SupabaseClient<Database>;
3065
- clientB: SupabaseClient<Database>;
2773
+ clientA: SupabaseClient$1<Database>;
2774
+ clientB: SupabaseClient$1<Database>;
3066
2775
  }>;
3067
2776
  /**
3068
2777
  * Clean up all test data created during the test run
@@ -3119,4 +2828,622 @@ declare function setupResizeObserver(): void;
3119
2828
  */
3120
2829
  declare function setupBrowserMocks(): void;
3121
2830
 
3122
- export { RLSTestContext, setupBrowserMocks, setupMatchMedia, setupResizeObserver };
2831
+ type SupabaseClient = _supabase_supabase_js.SupabaseClient<Database>;
2832
+ type SupabaseUserProfile = Tables<'users'>;
2833
+ type SupabaseOrganization = Tables<'organizations'>;
2834
+ type SupabaseOrgMembership = Tables<'org_memberships'>;
2835
+ type SupabaseApiKey = Tables<'api_keys'>;
2836
+ type SupabaseMembershipWithOrganization = SupabaseOrgMembership & {
2837
+ organization: SupabaseOrganization | null;
2838
+ };
2839
+
2840
+ /**
2841
+ * Test user fixtures using actual Supabase types
2842
+ * All timestamps use ISO 8601 format matching Supabase defaults
2843
+ */
2844
+ declare const TEST_USERS: Record<string, SupabaseUserProfile>;
2845
+ /**
2846
+ * Helper to create custom user fixture
2847
+ */
2848
+ declare function createTestUser(overrides: Partial<SupabaseUserProfile>): SupabaseUserProfile;
2849
+
2850
+ /**
2851
+ * Test organization fixtures using actual Supabase types
2852
+ */
2853
+ declare const TEST_ORGS: Record<string, SupabaseOrganization>;
2854
+ /**
2855
+ * Helper to create custom organization fixture
2856
+ */
2857
+ declare function createTestOrg(overrides: Partial<SupabaseOrganization>): SupabaseOrganization;
2858
+
2859
+ /**
2860
+ * Test membership fixtures using actual Supabase types
2861
+ */
2862
+ declare const TEST_MEMBERSHIPS: Record<string, SupabaseOrgMembership>;
2863
+ /**
2864
+ * Composite memberships with organization data (for joined queries)
2865
+ */
2866
+ declare const TEST_MEMBERSHIPS_WITH_ORG: Record<string, SupabaseMembershipWithOrganization>;
2867
+ /**
2868
+ * Helper to create custom membership fixture
2869
+ */
2870
+ declare function createTestMembership(overrides: Partial<SupabaseOrgMembership>): SupabaseOrgMembership;
2871
+
2872
+ /**
2873
+ * Test API key fixtures using actual Supabase types
2874
+ * Note: key_hash is bcrypt hash of the plaintext key shown in comments
2875
+ */
2876
+ declare const TEST_API_KEYS: Record<string, SupabaseApiKey>;
2877
+ /**
2878
+ * Plaintext API keys for testing (matches hashes above conceptually)
2879
+ * In real tests, use these for Authorization: Bearer headers
2880
+ */
2881
+ declare const TEST_API_KEY_PLAINTEXTS: Record<string, string>;
2882
+ /**
2883
+ * Helper to create custom API key fixture
2884
+ */
2885
+ declare function createTestApiKey(overrides: Partial<SupabaseApiKey>): SupabaseApiKey;
2886
+
2887
+ /**
2888
+ * Fixture data structure for mock Supabase client
2889
+ */
2890
+ interface MockSupabaseFixtures {
2891
+ users?: SupabaseUserProfile[];
2892
+ organizations?: SupabaseOrganization[];
2893
+ org_memberships?: SupabaseOrgMembership[];
2894
+ api_keys?: SupabaseApiKey[];
2895
+ }
2896
+ /**
2897
+ * Mock Supabase client with query builder pattern
2898
+ *
2899
+ * Supports common query patterns:
2900
+ * - .from(table).select().eq(column, value).single()
2901
+ * - .from(table).select().eq(column, value).maybeSingle()
2902
+ * - .from(table).select().eq(column1, value1).eq(column2, value2).single()
2903
+ *
2904
+ * Usage:
2905
+ * ```typescript
2906
+ * import { createMockSupabaseClient, TEST_USERS, TEST_ORGS } from '@repo/core/test-utils'
2907
+ *
2908
+ * const mockClient = createMockSupabaseClient({
2909
+ * users: [TEST_USERS.admin, TEST_USERS.regularUser],
2910
+ * organizations: [TEST_ORGS.acme]
2911
+ * })
2912
+ *
2913
+ * vi.mock('../lib/supabase', () => ({ supabaseClient: mockClient }))
2914
+ * ```
2915
+ */
2916
+ declare function createMockSupabaseClient(fixtures?: MockSupabaseFixtures): Partial<SupabaseClient>;
2917
+ /**
2918
+ * Helper to create a mock that returns specific data for a query
2919
+ *
2920
+ * Usage:
2921
+ * ```typescript
2922
+ * const mockClient = createMockSupabaseResponse('users', TEST_USERS.admin)
2923
+ * ```
2924
+ */
2925
+ declare function createMockSupabaseResponse<T>(_tableName: string, data: T | null, error?: unknown): {
2926
+ from: vitest.Mock<() => {
2927
+ select: vitest.Mock<() => {
2928
+ eq: vitest.Mock<() => {
2929
+ single: vitest.Mock<() => Promise<{
2930
+ data: T | null;
2931
+ error: unknown;
2932
+ }>>;
2933
+ maybeSingle: vitest.Mock<() => Promise<{
2934
+ data: T | null;
2935
+ error: unknown;
2936
+ }>>;
2937
+ }>;
2938
+ }>;
2939
+ }>;
2940
+ };
2941
+
2942
+ /**
2943
+ * UserContext type for WorkOS JWT verification
2944
+ * Matches the structure from apps/api/src/identity/auth/jwt-verifier.ts
2945
+ */
2946
+ interface UserContext {
2947
+ workosId: string;
2948
+ supabaseId: string;
2949
+ email: string;
2950
+ firstName?: string;
2951
+ lastName?: string;
2952
+ isPlatformAdmin?: boolean;
2953
+ }
2954
+ /**
2955
+ * Mock WorkOS client for testing
2956
+ *
2957
+ * Usage:
2958
+ * ```typescript
2959
+ * import { createMockWorkOSClient, TEST_USERS } from '@repo/core/test-utils'
2960
+ *
2961
+ * const mockWorkOS = createMockWorkOSClient({
2962
+ * validTokens: {
2963
+ * 'valid-token': {
2964
+ * workosId: TEST_USERS.admin.workos_user_id,
2965
+ * supabaseId: TEST_USERS.admin.id,
2966
+ * email: TEST_USERS.admin.email
2967
+ * }
2968
+ * }
2969
+ * })
2970
+ *
2971
+ * vi.mock('../identity/auth/workos-client', () => ({ workos: mockWorkOS }))
2972
+ * ```
2973
+ */
2974
+ declare function createMockWorkOSClient(options?: {
2975
+ validTokens?: Record<string, UserContext>;
2976
+ shouldFail?: boolean;
2977
+ }): {
2978
+ userManagement: {
2979
+ authenticateWithSessionCookie: vitest.Mock<({ sessionData }: {
2980
+ sessionData: string;
2981
+ cookiePassword?: string;
2982
+ }) => Promise<{
2983
+ user: {
2984
+ id: string;
2985
+ email: string;
2986
+ firstName: string | undefined;
2987
+ lastName: string | undefined;
2988
+ };
2989
+ sessionId: string;
2990
+ organizationId: null;
2991
+ } | null>>;
2992
+ };
2993
+ };
2994
+ /**
2995
+ * Helper to create mock verifyJWT function
2996
+ * This mocks the actual verifyJWT function from jwt-verifier.ts
2997
+ *
2998
+ * Usage:
2999
+ * ```typescript
3000
+ * import { createMockVerifyJWT, TEST_USERS } from '@repo/core/test-utils'
3001
+ *
3002
+ * const mockVerifyJWT = createMockVerifyJWT({
3003
+ * 'valid-token': {
3004
+ * workosId: TEST_USERS.admin.workos_user_id,
3005
+ * supabaseId: TEST_USERS.admin.id,
3006
+ * email: TEST_USERS.admin.email
3007
+ * }
3008
+ * })
3009
+ *
3010
+ * vi.mock('../identity/auth/jwt-verifier', () => ({
3011
+ * verifyJWT: mockVerifyJWT,
3012
+ * extractToken: vi.fn((header) => header?.replace('Bearer ', ''))
3013
+ * }))
3014
+ * ```
3015
+ */
3016
+ declare function createMockVerifyJWT(validTokens?: Record<string, UserContext>): ReturnType<typeof vi.fn>;
3017
+ /**
3018
+ * Pre-configured mock for extractToken helper
3019
+ */
3020
+ declare const mockExtractToken: vitest.Mock<(authHeader?: string) => string | null>;
3021
+
3022
+ /**
3023
+ * Base Zod schema for a project record.
3024
+ * Extend with `BaseProjectSchema.extend({ metadata: ProjectMetaSchema })`.
3025
+ */
3026
+ declare const BaseProjectSchema: z.ZodObject<{
3027
+ id: z.ZodString;
3028
+ organizationId: z.ZodString;
3029
+ name: z.ZodString;
3030
+ kind: z.ZodString;
3031
+ status: z.ZodString;
3032
+ description: z.ZodNullable<z.ZodString>;
3033
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3034
+ createdAt: z.ZodString;
3035
+ updatedAt: z.ZodString;
3036
+ }, z.core.$strip>;
3037
+ /**
3038
+ * Base Zod schema for a milestone record.
3039
+ * Extend with `BaseMilestoneSchema.extend({ metadata: MilestoneMetaSchema })`.
3040
+ */
3041
+ declare const BaseMilestoneSchema: z.ZodObject<{
3042
+ id: z.ZodString;
3043
+ organizationId: z.ZodString;
3044
+ projectId: z.ZodString;
3045
+ name: z.ZodString;
3046
+ status: z.ZodString;
3047
+ description: z.ZodNullable<z.ZodString>;
3048
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3049
+ createdAt: z.ZodString;
3050
+ updatedAt: z.ZodString;
3051
+ }, z.core.$strip>;
3052
+ /**
3053
+ * Base Zod schema for a task record.
3054
+ * Extend with `BaseTaskSchema.extend({ metadata: TaskMetaSchema })`.
3055
+ */
3056
+ declare const BaseTaskSchema: z.ZodObject<{
3057
+ id: z.ZodString;
3058
+ organizationId: z.ZodString;
3059
+ projectId: z.ZodString;
3060
+ name: z.ZodString;
3061
+ status: z.ZodString;
3062
+ type: z.ZodString;
3063
+ description: z.ZodNullable<z.ZodString>;
3064
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3065
+ createdAt: z.ZodString;
3066
+ updatedAt: z.ZodString;
3067
+ }, z.core.$strip>;
3068
+ /**
3069
+ * Base Zod schema for a deal record.
3070
+ * Extend with `BaseDealSchema.extend({ metadata: DealMetaSchema })`.
3071
+ */
3072
+ declare const BaseDealSchema: z.ZodObject<{
3073
+ id: z.ZodString;
3074
+ organizationId: z.ZodString;
3075
+ contactEmail: z.ZodString;
3076
+ stage: z.ZodNullable<z.ZodString>;
3077
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3078
+ createdAt: z.ZodString;
3079
+ updatedAt: z.ZodString;
3080
+ }, z.core.$strip>;
3081
+ /**
3082
+ * Base Zod schema for a company record.
3083
+ * Extend with `BaseCompanySchema.extend({ metadata: CompanyMetaSchema })`.
3084
+ */
3085
+ declare const BaseCompanySchema: z.ZodObject<{
3086
+ id: z.ZodString;
3087
+ organizationId: z.ZodString;
3088
+ name: z.ZodString;
3089
+ domain: z.ZodNullable<z.ZodString>;
3090
+ status: z.ZodString;
3091
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3092
+ createdAt: z.ZodString;
3093
+ updatedAt: z.ZodString;
3094
+ }, z.core.$strip>;
3095
+ /**
3096
+ * Base Zod schema for a contact record.
3097
+ * Extend with `BaseContactSchema.extend({ metadata: ContactMetaSchema })`.
3098
+ */
3099
+ declare const BaseContactSchema: z.ZodObject<{
3100
+ id: z.ZodString;
3101
+ organizationId: z.ZodString;
3102
+ email: z.ZodString;
3103
+ firstName: z.ZodNullable<z.ZodString>;
3104
+ lastName: z.ZodNullable<z.ZodString>;
3105
+ status: z.ZodString;
3106
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3107
+ createdAt: z.ZodString;
3108
+ updatedAt: z.ZodString;
3109
+ }, z.core.$strip>;
3110
+
3111
+ type BaseProjectFixture = z.infer<typeof BaseProjectSchema>;
3112
+ type BaseDealFixture = z.infer<typeof BaseDealSchema>;
3113
+ type BaseCompanyFixture = z.infer<typeof BaseCompanySchema>;
3114
+ type BaseContactFixture = z.infer<typeof BaseContactSchema>;
3115
+ type BaseMilestoneFixture = z.infer<typeof BaseMilestoneSchema>;
3116
+ type BaseTaskFixture = z.infer<typeof BaseTaskSchema>;
3117
+ declare function makeProject(overrides?: Partial<BaseProjectFixture>): BaseProjectFixture;
3118
+ declare function makeDeal(overrides?: Partial<BaseDealFixture>): BaseDealFixture;
3119
+ declare function makeCompany(overrides?: Partial<BaseCompanyFixture>): BaseCompanyFixture;
3120
+ declare function makeContact(overrides?: Partial<BaseContactFixture>): BaseContactFixture;
3121
+ declare function makeMilestone(overrides?: Partial<BaseMilestoneFixture>): BaseMilestoneFixture;
3122
+ declare function makeTask(overrides?: Partial<BaseTaskFixture>): BaseTaskFixture;
3123
+
3124
+ declare const OrganizationModelSchema: z.ZodObject<{
3125
+ version: z.ZodDefault<z.ZodLiteral<1>>;
3126
+ features: z.ZodDefault<z.ZodArray<z.ZodObject<{
3127
+ id: z.ZodString;
3128
+ label: z.ZodString;
3129
+ description: z.ZodOptional<z.ZodString>;
3130
+ enabled: z.ZodDefault<z.ZodBoolean>;
3131
+ color: z.ZodOptional<z.ZodString>;
3132
+ icon: z.ZodOptional<z.ZodString>;
3133
+ entityIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
3134
+ surfaceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
3135
+ resourceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
3136
+ capabilityIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
3137
+ }, z.core.$strip>>>;
3138
+ branding: z.ZodObject<{
3139
+ organizationName: z.ZodString;
3140
+ productName: z.ZodString;
3141
+ shortName: z.ZodString;
3142
+ description: z.ZodOptional<z.ZodString>;
3143
+ logos: z.ZodDefault<z.ZodObject<{
3144
+ light: z.ZodOptional<z.ZodString>;
3145
+ dark: z.ZodOptional<z.ZodString>;
3146
+ }, z.core.$strip>>;
3147
+ }, z.core.$strip>;
3148
+ navigation: z.ZodObject<{
3149
+ defaultSurfaceId: z.ZodOptional<z.ZodString>;
3150
+ surfaces: z.ZodDefault<z.ZodArray<z.ZodObject<{
3151
+ id: z.ZodString;
3152
+ label: z.ZodString;
3153
+ path: z.ZodString;
3154
+ surfaceType: z.ZodEnum<{
3155
+ list: "list";
3156
+ settings: "settings";
3157
+ page: "page";
3158
+ dashboard: "dashboard";
3159
+ graph: "graph";
3160
+ detail: "detail";
3161
+ }>;
3162
+ description: z.ZodOptional<z.ZodString>;
3163
+ enabled: z.ZodDefault<z.ZodBoolean>;
3164
+ icon: z.ZodOptional<z.ZodString>;
3165
+ featureId: z.ZodOptional<z.ZodString>;
3166
+ featureIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
3167
+ entityIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
3168
+ resourceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
3169
+ capabilityIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
3170
+ parentId: z.ZodOptional<z.ZodString>;
3171
+ }, z.core.$strip>>>;
3172
+ groups: z.ZodDefault<z.ZodArray<z.ZodObject<{
3173
+ id: z.ZodString;
3174
+ label: z.ZodString;
3175
+ placement: z.ZodString;
3176
+ surfaceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
3177
+ }, z.core.$strip>>>;
3178
+ }, z.core.$strip>;
3179
+ sales: z.ZodObject<{
3180
+ entityId: z.ZodString;
3181
+ defaultPipelineId: z.ZodString;
3182
+ pipelines: z.ZodArray<z.ZodObject<{
3183
+ id: z.ZodString;
3184
+ label: z.ZodString;
3185
+ description: z.ZodOptional<z.ZodString>;
3186
+ entityId: z.ZodString;
3187
+ stages: z.ZodArray<z.ZodObject<{
3188
+ label: z.ZodString;
3189
+ description: z.ZodOptional<z.ZodString>;
3190
+ color: z.ZodOptional<z.ZodString>;
3191
+ icon: z.ZodOptional<z.ZodString>;
3192
+ id: z.ZodString;
3193
+ order: z.ZodNumber;
3194
+ semanticClass: z.ZodEnum<{
3195
+ open: "open";
3196
+ active: "active";
3197
+ closed_won: "closed_won";
3198
+ closed_lost: "closed_lost";
3199
+ nurturing: "nurturing";
3200
+ }>;
3201
+ surfaceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
3202
+ resourceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
3203
+ }, z.core.$strip>>;
3204
+ }, z.core.$strip>>;
3205
+ }, z.core.$strip>;
3206
+ prospecting: z.ZodObject<{
3207
+ listEntityId: z.ZodString;
3208
+ companyEntityId: z.ZodString;
3209
+ contactEntityId: z.ZodString;
3210
+ description: z.ZodOptional<z.ZodString>;
3211
+ companyStages: z.ZodArray<z.ZodObject<{
3212
+ label: z.ZodString;
3213
+ description: z.ZodOptional<z.ZodString>;
3214
+ color: z.ZodOptional<z.ZodString>;
3215
+ icon: z.ZodOptional<z.ZodString>;
3216
+ id: z.ZodString;
3217
+ order: z.ZodNumber;
3218
+ }, z.core.$strip>>;
3219
+ contactStages: z.ZodArray<z.ZodObject<{
3220
+ label: z.ZodString;
3221
+ description: z.ZodOptional<z.ZodString>;
3222
+ color: z.ZodOptional<z.ZodString>;
3223
+ icon: z.ZodOptional<z.ZodString>;
3224
+ id: z.ZodString;
3225
+ order: z.ZodNumber;
3226
+ }, z.core.$strip>>;
3227
+ }, z.core.$strip>;
3228
+ projects: z.ZodObject<{
3229
+ projectEntityId: z.ZodString;
3230
+ milestoneEntityId: z.ZodString;
3231
+ taskEntityId: z.ZodString;
3232
+ projectStatuses: z.ZodArray<z.ZodObject<{
3233
+ label: z.ZodString;
3234
+ description: z.ZodOptional<z.ZodString>;
3235
+ color: z.ZodOptional<z.ZodString>;
3236
+ icon: z.ZodOptional<z.ZodString>;
3237
+ id: z.ZodString;
3238
+ order: z.ZodNumber;
3239
+ }, z.core.$strip>>;
3240
+ milestoneStatuses: z.ZodArray<z.ZodObject<{
3241
+ label: z.ZodString;
3242
+ description: z.ZodOptional<z.ZodString>;
3243
+ color: z.ZodOptional<z.ZodString>;
3244
+ icon: z.ZodOptional<z.ZodString>;
3245
+ id: z.ZodString;
3246
+ order: z.ZodNumber;
3247
+ }, z.core.$strip>>;
3248
+ taskStatuses: z.ZodArray<z.ZodObject<{
3249
+ label: z.ZodString;
3250
+ description: z.ZodOptional<z.ZodString>;
3251
+ color: z.ZodOptional<z.ZodString>;
3252
+ icon: z.ZodOptional<z.ZodString>;
3253
+ id: z.ZodString;
3254
+ order: z.ZodNumber;
3255
+ }, z.core.$strip>>;
3256
+ }, z.core.$strip>;
3257
+ identity: z.ZodDefault<z.ZodObject<{
3258
+ mission: z.ZodDefault<z.ZodString>;
3259
+ vision: z.ZodDefault<z.ZodString>;
3260
+ legalName: z.ZodDefault<z.ZodString>;
3261
+ entityType: z.ZodDefault<z.ZodString>;
3262
+ jurisdiction: z.ZodDefault<z.ZodString>;
3263
+ industryCategory: z.ZodDefault<z.ZodString>;
3264
+ geographicFocus: z.ZodDefault<z.ZodString>;
3265
+ timeZone: z.ZodDefault<z.ZodString>;
3266
+ businessHours: z.ZodDefault<z.ZodObject<{
3267
+ monday: z.ZodOptional<z.ZodObject<{
3268
+ open: z.ZodString;
3269
+ close: z.ZodString;
3270
+ }, z.core.$strip>>;
3271
+ tuesday: z.ZodOptional<z.ZodObject<{
3272
+ open: z.ZodString;
3273
+ close: z.ZodString;
3274
+ }, z.core.$strip>>;
3275
+ wednesday: z.ZodOptional<z.ZodObject<{
3276
+ open: z.ZodString;
3277
+ close: z.ZodString;
3278
+ }, z.core.$strip>>;
3279
+ thursday: z.ZodOptional<z.ZodObject<{
3280
+ open: z.ZodString;
3281
+ close: z.ZodString;
3282
+ }, z.core.$strip>>;
3283
+ friday: z.ZodOptional<z.ZodObject<{
3284
+ open: z.ZodString;
3285
+ close: z.ZodString;
3286
+ }, z.core.$strip>>;
3287
+ saturday: z.ZodOptional<z.ZodObject<{
3288
+ open: z.ZodString;
3289
+ close: z.ZodString;
3290
+ }, z.core.$strip>>;
3291
+ sunday: z.ZodOptional<z.ZodObject<{
3292
+ open: z.ZodString;
3293
+ close: z.ZodString;
3294
+ }, z.core.$strip>>;
3295
+ }, z.core.$strip>>;
3296
+ clientBrief: z.ZodDefault<z.ZodString>;
3297
+ }, z.core.$strip>>;
3298
+ customers: z.ZodDefault<z.ZodObject<{
3299
+ segments: z.ZodDefault<z.ZodArray<z.ZodObject<{
3300
+ id: z.ZodString;
3301
+ name: z.ZodDefault<z.ZodString>;
3302
+ description: z.ZodDefault<z.ZodString>;
3303
+ jobsToBeDone: z.ZodDefault<z.ZodString>;
3304
+ pains: z.ZodDefault<z.ZodArray<z.ZodString>>;
3305
+ gains: z.ZodDefault<z.ZodArray<z.ZodString>>;
3306
+ firmographics: z.ZodDefault<z.ZodObject<{
3307
+ industry: z.ZodOptional<z.ZodString>;
3308
+ companySize: z.ZodOptional<z.ZodString>;
3309
+ region: z.ZodOptional<z.ZodString>;
3310
+ }, z.core.$strip>>;
3311
+ valueProp: z.ZodDefault<z.ZodString>;
3312
+ }, z.core.$strip>>>;
3313
+ }, z.core.$strip>>;
3314
+ offerings: z.ZodDefault<z.ZodObject<{
3315
+ products: z.ZodDefault<z.ZodArray<z.ZodObject<{
3316
+ id: z.ZodString;
3317
+ name: z.ZodDefault<z.ZodString>;
3318
+ description: z.ZodDefault<z.ZodString>;
3319
+ pricingModel: z.ZodDefault<z.ZodEnum<{
3320
+ custom: "custom";
3321
+ "one-time": "one-time";
3322
+ subscription: "subscription";
3323
+ "usage-based": "usage-based";
3324
+ }>>;
3325
+ price: z.ZodDefault<z.ZodNumber>;
3326
+ currency: z.ZodDefault<z.ZodString>;
3327
+ targetSegmentIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
3328
+ deliveryFeatureId: z.ZodOptional<z.ZodString>;
3329
+ }, z.core.$strip>>>;
3330
+ }, z.core.$strip>>;
3331
+ roles: z.ZodDefault<z.ZodObject<{
3332
+ roles: z.ZodDefault<z.ZodArray<z.ZodObject<{
3333
+ id: z.ZodString;
3334
+ title: z.ZodString;
3335
+ responsibilities: z.ZodDefault<z.ZodArray<z.ZodString>>;
3336
+ reportsToId: z.ZodOptional<z.ZodString>;
3337
+ heldBy: z.ZodOptional<z.ZodString>;
3338
+ }, z.core.$strip>>>;
3339
+ }, z.core.$strip>>;
3340
+ goals: z.ZodDefault<z.ZodObject<{
3341
+ objectives: z.ZodDefault<z.ZodArray<z.ZodObject<{
3342
+ id: z.ZodString;
3343
+ description: z.ZodString;
3344
+ periodStart: z.ZodString;
3345
+ periodEnd: z.ZodString;
3346
+ keyResults: z.ZodDefault<z.ZodArray<z.ZodObject<{
3347
+ id: z.ZodString;
3348
+ description: z.ZodString;
3349
+ targetMetric: z.ZodString;
3350
+ currentValue: z.ZodDefault<z.ZodNumber>;
3351
+ targetValue: z.ZodOptional<z.ZodNumber>;
3352
+ }, z.core.$strip>>>;
3353
+ }, z.core.$strip>>>;
3354
+ }, z.core.$strip>>;
3355
+ statuses: z.ZodDefault<z.ZodObject<{
3356
+ entries: z.ZodDefault<z.ZodArray<z.ZodObject<{
3357
+ id: z.ZodString;
3358
+ label: z.ZodString;
3359
+ semanticClass: z.ZodEnum<{
3360
+ execution: "execution";
3361
+ schedule: "schedule";
3362
+ queue: "queue";
3363
+ "delivery.project": "delivery.project";
3364
+ "delivery.milestone": "delivery.milestone";
3365
+ "delivery.task": "delivery.task";
3366
+ "schedule.run": "schedule.run";
3367
+ request: "request";
3368
+ }>;
3369
+ category: z.ZodOptional<z.ZodString>;
3370
+ }, z.core.$strip>>>;
3371
+ }, z.core.$strip>>;
3372
+ operations: z.ZodDefault<z.ZodObject<{
3373
+ entries: z.ZodDefault<z.ZodArray<z.ZodObject<{
3374
+ id: z.ZodString;
3375
+ label: z.ZodString;
3376
+ semanticClass: z.ZodEnum<{
3377
+ sessions: "sessions";
3378
+ notifications: "notifications";
3379
+ schedules: "schedules";
3380
+ executions: "executions";
3381
+ queue: "queue";
3382
+ }>;
3383
+ featureId: z.ZodOptional<z.ZodString>;
3384
+ supportedStatusSemanticClass: z.ZodOptional<z.ZodArray<z.ZodString>>;
3385
+ }, z.core.$strip>>>;
3386
+ }, z.core.$strip>>;
3387
+ resourceMappings: z.ZodDefault<z.ZodArray<z.ZodObject<{
3388
+ label: z.ZodString;
3389
+ description: z.ZodOptional<z.ZodString>;
3390
+ color: z.ZodOptional<z.ZodString>;
3391
+ icon: z.ZodOptional<z.ZodString>;
3392
+ id: z.ZodString;
3393
+ resourceId: z.ZodString;
3394
+ resourceType: z.ZodEnum<{
3395
+ agent: "agent";
3396
+ workflow: "workflow";
3397
+ trigger: "trigger";
3398
+ integration: "integration";
3399
+ external: "external";
3400
+ human_checkpoint: "human_checkpoint";
3401
+ }>;
3402
+ featureIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
3403
+ entityIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
3404
+ surfaceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
3405
+ capabilityIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
3406
+ techStack: z.ZodOptional<z.ZodObject<{
3407
+ platform: z.ZodString;
3408
+ purpose: z.ZodString;
3409
+ credentialStatus: z.ZodEnum<{
3410
+ pending: "pending";
3411
+ configured: "configured";
3412
+ expired: "expired";
3413
+ missing: "missing";
3414
+ }>;
3415
+ isSystemOfRecord: z.ZodDefault<z.ZodBoolean>;
3416
+ }, z.core.$strip>>;
3417
+ }, z.core.$strip>>>;
3418
+ }, z.core.$strip>;
3419
+
3420
+ type OrganizationModel = z.infer<typeof OrganizationModelSchema>;
3421
+ type DeepPartial<T> = T extends Array<infer U> ? Array<DeepPartial<U>> : T extends object ? {
3422
+ [K in keyof T]?: DeepPartial<T[K]>;
3423
+ } : T;
3424
+
3425
+ interface TestInitializationError {
3426
+ layer: 'auth' | 'profile' | 'organization';
3427
+ message: string;
3428
+ originalError?: Error;
3429
+ }
3430
+ interface TestInitializationState {
3431
+ userReady: boolean;
3432
+ organizationReady: boolean;
3433
+ allReady: boolean;
3434
+ isInitializing: boolean;
3435
+ error: TestInitializationError | null;
3436
+ retry: () => void;
3437
+ profile: SupabaseUserProfile | null;
3438
+ }
3439
+ type TestInitializationStateOverrides = Partial<Omit<TestInitializationState, 'error' | 'profile' | 'retry'>> & {
3440
+ error?: TestInitializationError | null;
3441
+ profile?: Partial<SupabaseUserProfile> | SupabaseUserProfile | null;
3442
+ retry?: () => void;
3443
+ };
3444
+ declare function makeOrganizationModel(overrides?: DeepPartial<OrganizationModel>): OrganizationModel;
3445
+ declare function makeUserProfile(overrides?: Partial<SupabaseUserProfile>): SupabaseUserProfile;
3446
+ declare function makeInitializationState(overrides?: TestInitializationStateOverrides): TestInitializationState;
3447
+
3448
+ export { RLSTestContext, TEST_API_KEYS, TEST_API_KEY_PLAINTEXTS, TEST_MEMBERSHIPS, TEST_MEMBERSHIPS_WITH_ORG, TEST_ORGS, TEST_USERS, createMockSupabaseClient, createMockSupabaseResponse, createMockVerifyJWT, createMockWorkOSClient, createTestApiKey, createTestMembership, createTestOrg, createTestUser, makeCompany, makeContact, makeDeal, makeInitializationState, makeMilestone, makeOrganizationModel, makeProject, makeTask, makeUserProfile, mockExtractToken, setupBrowserMocks, setupMatchMedia, setupResizeObserver };
3449
+ export type { MockSupabaseFixtures, TestInitializationError, TestInitializationState, TestInitializationStateOverrides, UserContext };