@hot-updater/supabase 1.0.0-rc.18 → 1.0.0-rc.21

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,9 +1,24 @@
1
+ import { RunInitOptions } from "@hot-updater/cli-tools";
2
+ //#region iac/supabaseApi.d.ts
3
+ type SupabaseInfrastructureState = "fresh" | "incompatible" | "v1";
4
+ interface SupabaseApi {
5
+ getInfrastructureState: () => Promise<SupabaseInfrastructureState>;
6
+ listBuckets: () => Promise<{
7
+ id: string;
8
+ name: string;
9
+ isPublic: boolean;
10
+ createdAt: string;
11
+ }[]>;
12
+ createBucket: (bucketName: string, options: {
13
+ public: boolean;
14
+ }) => Promise<{
15
+ name: string;
16
+ }>;
17
+ }
18
+ //#endregion
1
19
  //#region iac/init/index.d.ts
2
- declare const SUPABASE_DATABASE_PASSWORD_PROJECT_ID_ENV_KEY = "HOT_UPDATER_SUPABASE_DB_PASSWORD_PROJECT_ID";
3
20
  declare const SUPABASE_REGION_VALUES: readonly ["ap-east-1", "ap-northeast-1", "ap-northeast-2", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ca-central-1", "eu-central-1", "eu-central-2", "eu-north-1", "eu-west-1", "eu-west-2", "eu-west-3", "sa-east-1", "us-east-1", "us-east-2", "us-west-1", "us-west-2"];
4
21
  type SupabaseRegion = (typeof SUPABASE_REGION_VALUES)[number];
5
- declare const isSupabaseRegion: (value: string | undefined) => value is SupabaseRegion;
6
- declare const isSupabaseFunctionName: (value: string | undefined) => value is string;
7
22
  declare const initProvider: {
8
23
  readonly label: "Supabase";
9
24
  readonly inputs: {
@@ -86,4 +101,82 @@ declare const initProvider: {
86
101
  };
87
102
  };
88
103
  //#endregion
89
- export { SUPABASE_DATABASE_PASSWORD_PROJECT_ID_ENV_KEY, SUPABASE_REGION_VALUES, SupabaseRegion, initProvider, isSupabaseFunctionName, isSupabaseRegion };
104
+ //#region iac/supabaseManagementApi.d.ts
105
+ type SupabaseOrganization = {
106
+ readonly id: string;
107
+ readonly name: string;
108
+ readonly slug: string;
109
+ };
110
+ type SupabaseProject = {
111
+ readonly id: string;
112
+ readonly name: string;
113
+ readonly region: string;
114
+ };
115
+ interface SupabaseManagementApi {
116
+ createProject: (input: {
117
+ readonly databasePassword: string;
118
+ readonly name: string;
119
+ readonly organizationSlug: string;
120
+ readonly region: SupabaseRegion;
121
+ }) => Promise<SupabaseProject>;
122
+ getProjectStatus: (projectId: string) => Promise<string>;
123
+ listFunctions: (projectId: string) => Promise<readonly string[]>;
124
+ listOrganizations: () => Promise<readonly SupabaseOrganization[]>;
125
+ }
126
+ //#endregion
127
+ //#region iac/index.d.ts
128
+ declare const getLegacySupabaseConfigReference: (configText: string) => "HOT_UPDATER_SUPABASE_ANON_KEY" | "supabaseAnonKey" | null;
129
+ /** The Edge Function URL an app sets as its baseURL. */
130
+ declare const getSupabaseFunctionUrl: ({ functionName, projectId }: {
131
+ readonly functionName: string;
132
+ readonly projectId: string;
133
+ }) => string;
134
+ declare const reportSupabaseOriginCatalogReady: () => void;
135
+ declare const resolveEdgeFunctionDenoConfig: (targetDir: string) => Promise<{
136
+ imports: Record<string, string>;
137
+ }>;
138
+ type SupabaseProjectSelection = {
139
+ readonly create: false;
140
+ readonly project: SupabaseProject;
141
+ } | {
142
+ readonly create: true;
143
+ };
144
+ declare const selectProject: (preferredProjectId?: string, nonInteractive?: boolean, accessToken?: string) => Promise<SupabaseProjectSelection>;
145
+ type SupabaseBucketSelection = {
146
+ readonly create: false;
147
+ readonly id: string;
148
+ readonly isPublic: boolean;
149
+ readonly name: string;
150
+ } | {
151
+ readonly create: true;
152
+ readonly name: string;
153
+ };
154
+ declare const selectBucket: (api: SupabaseApi, preferredBucketName?: string, nonInteractive?: boolean) => Promise<SupabaseBucketSelection>;
155
+ declare const createSelectedBucket: (api: SupabaseApi, selection: SupabaseBucketSelection) => Promise<{
156
+ readonly id: string;
157
+ readonly name: string;
158
+ }>;
159
+ declare const waitForSupabaseProjectReady: ({ getProjectStatus, maxAttempts, onLongWait, pollIntervalMs }: {
160
+ readonly getProjectStatus: () => Promise<string>;
161
+ readonly maxAttempts?: number;
162
+ readonly onLongWait: () => void;
163
+ readonly pollIntervalMs?: number;
164
+ }) => Promise<void>;
165
+ declare const waitForSupabaseSchemaReady: ({ getInfrastructureState, maxAttempts, pollIntervalMs }: {
166
+ readonly getInfrastructureState: SupabaseApi["getInfrastructureState"];
167
+ readonly maxAttempts?: number;
168
+ readonly pollIntervalMs?: number;
169
+ }) => Promise<void>;
170
+ declare const getSupabaseProjectAccess: ({ accessToken, managementApi, project, waitForProject }: {
171
+ readonly accessToken?: string;
172
+ readonly managementApi: SupabaseManagementApi;
173
+ readonly project: SupabaseProject;
174
+ readonly waitForProject: boolean;
175
+ }) => Promise<{
176
+ readonly api: SupabaseApi;
177
+ readonly serviceRoleApiKey: string;
178
+ }>;
179
+ declare const withSupabaseCliMetadataCleanup: <Result>(cwd: string, operation: () => Promise<Result>) => Promise<Result>;
180
+ declare const runInit: (options: RunInitOptions) => Promise<void>;
181
+ //#endregion
182
+ export { SupabaseBucketSelection, SupabaseProjectSelection, createSelectedBucket, getLegacySupabaseConfigReference, getSupabaseFunctionUrl, getSupabaseProjectAccess, initProvider, reportSupabaseOriginCatalogReady, resolveEdgeFunctionDenoConfig, runInit, selectBucket, selectProject, waitForSupabaseProjectReady, waitForSupabaseSchemaReady, withSupabaseCliMetadataCleanup };
@@ -1,9 +1,24 @@
1
+ import { RunInitOptions } from "@hot-updater/cli-tools";
2
+ //#region iac/supabaseApi.d.ts
3
+ type SupabaseInfrastructureState = "fresh" | "incompatible" | "v1";
4
+ interface SupabaseApi {
5
+ getInfrastructureState: () => Promise<SupabaseInfrastructureState>;
6
+ listBuckets: () => Promise<{
7
+ id: string;
8
+ name: string;
9
+ isPublic: boolean;
10
+ createdAt: string;
11
+ }[]>;
12
+ createBucket: (bucketName: string, options: {
13
+ public: boolean;
14
+ }) => Promise<{
15
+ name: string;
16
+ }>;
17
+ }
18
+ //#endregion
1
19
  //#region iac/init/index.d.ts
2
- declare const SUPABASE_DATABASE_PASSWORD_PROJECT_ID_ENV_KEY = "HOT_UPDATER_SUPABASE_DB_PASSWORD_PROJECT_ID";
3
20
  declare const SUPABASE_REGION_VALUES: readonly ["ap-east-1", "ap-northeast-1", "ap-northeast-2", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ca-central-1", "eu-central-1", "eu-central-2", "eu-north-1", "eu-west-1", "eu-west-2", "eu-west-3", "sa-east-1", "us-east-1", "us-east-2", "us-west-1", "us-west-2"];
4
21
  type SupabaseRegion = (typeof SUPABASE_REGION_VALUES)[number];
5
- declare const isSupabaseRegion: (value: string | undefined) => value is SupabaseRegion;
6
- declare const isSupabaseFunctionName: (value: string | undefined) => value is string;
7
22
  declare const initProvider: {
8
23
  readonly label: "Supabase";
9
24
  readonly inputs: {
@@ -86,4 +101,82 @@ declare const initProvider: {
86
101
  };
87
102
  };
88
103
  //#endregion
89
- export { SUPABASE_DATABASE_PASSWORD_PROJECT_ID_ENV_KEY, SUPABASE_REGION_VALUES, SupabaseRegion, initProvider, isSupabaseFunctionName, isSupabaseRegion };
104
+ //#region iac/supabaseManagementApi.d.ts
105
+ type SupabaseOrganization = {
106
+ readonly id: string;
107
+ readonly name: string;
108
+ readonly slug: string;
109
+ };
110
+ type SupabaseProject = {
111
+ readonly id: string;
112
+ readonly name: string;
113
+ readonly region: string;
114
+ };
115
+ interface SupabaseManagementApi {
116
+ createProject: (input: {
117
+ readonly databasePassword: string;
118
+ readonly name: string;
119
+ readonly organizationSlug: string;
120
+ readonly region: SupabaseRegion;
121
+ }) => Promise<SupabaseProject>;
122
+ getProjectStatus: (projectId: string) => Promise<string>;
123
+ listFunctions: (projectId: string) => Promise<readonly string[]>;
124
+ listOrganizations: () => Promise<readonly SupabaseOrganization[]>;
125
+ }
126
+ //#endregion
127
+ //#region iac/index.d.ts
128
+ declare const getLegacySupabaseConfigReference: (configText: string) => "HOT_UPDATER_SUPABASE_ANON_KEY" | "supabaseAnonKey" | null;
129
+ /** The Edge Function URL an app sets as its baseURL. */
130
+ declare const getSupabaseFunctionUrl: ({ functionName, projectId }: {
131
+ readonly functionName: string;
132
+ readonly projectId: string;
133
+ }) => string;
134
+ declare const reportSupabaseOriginCatalogReady: () => void;
135
+ declare const resolveEdgeFunctionDenoConfig: (targetDir: string) => Promise<{
136
+ imports: Record<string, string>;
137
+ }>;
138
+ type SupabaseProjectSelection = {
139
+ readonly create: false;
140
+ readonly project: SupabaseProject;
141
+ } | {
142
+ readonly create: true;
143
+ };
144
+ declare const selectProject: (preferredProjectId?: string, nonInteractive?: boolean, accessToken?: string) => Promise<SupabaseProjectSelection>;
145
+ type SupabaseBucketSelection = {
146
+ readonly create: false;
147
+ readonly id: string;
148
+ readonly isPublic: boolean;
149
+ readonly name: string;
150
+ } | {
151
+ readonly create: true;
152
+ readonly name: string;
153
+ };
154
+ declare const selectBucket: (api: SupabaseApi, preferredBucketName?: string, nonInteractive?: boolean) => Promise<SupabaseBucketSelection>;
155
+ declare const createSelectedBucket: (api: SupabaseApi, selection: SupabaseBucketSelection) => Promise<{
156
+ readonly id: string;
157
+ readonly name: string;
158
+ }>;
159
+ declare const waitForSupabaseProjectReady: ({ getProjectStatus, maxAttempts, onLongWait, pollIntervalMs }: {
160
+ readonly getProjectStatus: () => Promise<string>;
161
+ readonly maxAttempts?: number;
162
+ readonly onLongWait: () => void;
163
+ readonly pollIntervalMs?: number;
164
+ }) => Promise<void>;
165
+ declare const waitForSupabaseSchemaReady: ({ getInfrastructureState, maxAttempts, pollIntervalMs }: {
166
+ readonly getInfrastructureState: SupabaseApi["getInfrastructureState"];
167
+ readonly maxAttempts?: number;
168
+ readonly pollIntervalMs?: number;
169
+ }) => Promise<void>;
170
+ declare const getSupabaseProjectAccess: ({ accessToken, managementApi, project, waitForProject }: {
171
+ readonly accessToken?: string;
172
+ readonly managementApi: SupabaseManagementApi;
173
+ readonly project: SupabaseProject;
174
+ readonly waitForProject: boolean;
175
+ }) => Promise<{
176
+ readonly api: SupabaseApi;
177
+ readonly serviceRoleApiKey: string;
178
+ }>;
179
+ declare const withSupabaseCliMetadataCleanup: <Result>(cwd: string, operation: () => Promise<Result>) => Promise<Result>;
180
+ declare const runInit: (options: RunInitOptions) => Promise<void>;
181
+ //#endregion
182
+ export { SupabaseBucketSelection, SupabaseProjectSelection, createSelectedBucket, getLegacySupabaseConfigReference, getSupabaseFunctionUrl, getSupabaseProjectAccess, initProvider, reportSupabaseOriginCatalogReady, resolveEdgeFunctionDenoConfig, runInit, selectBucket, selectProject, waitForSupabaseProjectReady, waitForSupabaseSchemaReady, withSupabaseCliMetadataCleanup };