@powerlines/plugin-prisma 0.2.268 → 0.3.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/api/client/client.gen.mjs.map +1 -1
- package/dist/api/client/index.cjs +2 -2
- package/dist/api/client/index.mjs +2 -2
- package/dist/api/client/types.gen.d.cts.map +1 -1
- package/dist/api/client/utils.gen.cjs +1 -1
- package/dist/api/client/utils.gen.mjs +1 -1
- package/dist/api/client/utils.gen.mjs.map +1 -1
- package/dist/api/client.gen.cjs +8 -0
- package/dist/api/client.gen.mjs +8 -0
- package/dist/api/client.gen.mjs.map +1 -1
- package/dist/api/core/auth.gen.mjs.map +1 -1
- package/dist/api/core/bodySerializer.gen.mjs.map +1 -1
- package/dist/api/core/params.gen.mjs.map +1 -1
- package/dist/api/core/pathSerializer.gen.d.cts.map +1 -1
- package/dist/api/core/pathSerializer.gen.mjs.map +1 -1
- package/dist/api/core/queryKeySerializer.gen.cjs +3 -0
- package/dist/api/core/queryKeySerializer.gen.d.cts.map +1 -1
- package/dist/api/core/queryKeySerializer.gen.mjs +3 -0
- package/dist/api/core/queryKeySerializer.gen.mjs.map +1 -1
- package/dist/api/core/serverSentEvents.gen.mjs.map +1 -1
- package/dist/api/core/utils.gen.mjs.map +1 -1
- package/dist/api/sdk.gen.cjs +0 -1
- package/dist/api/sdk.gen.mjs +0 -1
- package/dist/api/sdk.gen.mjs.map +1 -1
- package/dist/components/index.cjs +3 -0
- package/dist/components/index.d.cts +2 -0
- package/dist/components/index.d.mts +2 -0
- package/dist/components/index.mjs +3 -0
- package/dist/components/infrastructure-file.cjs +76 -0
- package/dist/components/infrastructure-file.d.cts +13 -0
- package/dist/components/infrastructure-file.d.cts.map +1 -0
- package/dist/components/infrastructure-file.d.mts +13 -0
- package/dist/components/infrastructure-file.d.mts.map +1 -0
- package/dist/components/infrastructure-file.mjs +75 -0
- package/dist/components/infrastructure-file.mjs.map +1 -0
- package/dist/helpers/get-schema.mjs.map +1 -1
- package/dist/helpers/index.cjs +1 -1
- package/dist/helpers/index.mjs +1 -1
- package/dist/helpers/prisma-postgres.mjs.map +1 -1
- package/dist/helpers/schema-creator.mjs.map +1 -1
- package/dist/index.cjs +20 -31
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +19 -30
- package/dist/index.mjs.map +1 -1
- package/dist/node_modules/.pnpm/@stryke_string-format@0.14.8/node_modules/@stryke/string-format/dist/get-words.cjs +38 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.14.8/node_modules/@stryke/string-format/dist/get-words.mjs +38 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.14.8/node_modules/@stryke/string-format/dist/get-words.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.14.8/node_modules/@stryke/string-format/dist/kebab-case.cjs +33 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.14.8/node_modules/@stryke/string-format/dist/kebab-case.mjs +34 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.14.8/node_modules/@stryke/string-format/dist/kebab-case.mjs.map +1 -0
- package/dist/types/prisma.d.cts.map +1 -1
- package/dist/types/prisma.d.mts.map +1 -1
- package/package.json +57 -26
package/dist/api/sdk.gen.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.gen.mjs","names":[],"sources":["../../src/api/sdk.gen.ts"],"sourcesContent":["// This file is auto-generated by @hey-api/openapi-ts\n\nimport type { Client, Options as Options2, TDataShape } from './client';\nimport { client } from './client.gen';\nimport type { CreateConnectionData, CreateConnectionErrors, CreateConnectionResponses, CreateDatabase2Data, CreateDatabase2Errors, CreateDatabase2Responses, CreateDatabaseConnectionStringData, CreateDatabaseConnectionStringErrors, CreateDatabaseConnectionStringResponses, CreateDatabaseData, CreateDatabaseErrors, CreateDatabaseResponses, CreateProjectWithPostgresDatabaseData, CreateProjectWithPostgresDatabaseErrors, CreateProjectWithPostgresDatabaseResponses, DeleteConnectionData, DeleteConnectionErrors, DeleteConnectionResponses, DeleteDatabaseData, DeleteDatabaseErrors, DeleteDatabaseResponses, DeleteIntegrationData, DeleteIntegrationErrors, DeleteIntegrationResponses, DeleteProjectData, DeleteProjectErrors, DeleteProjectResponses, GetAllRegionsData, GetAllRegionsErrors, GetAllRegionsResponses, GetConnectionData, GetConnectionErrors, GetConnectionResponses, GetDatabaseData, GetDatabaseErrors, GetDatabaseResponses, GetDatabaseUsageMetricsData, GetDatabaseUsageMetricsErrors, GetDatabaseUsageMetricsResponses, GetIntegrationByIdData, GetIntegrationByIdErrors, GetIntegrationByIdResponses, GetPrismaAccelerateRegionsData, GetPrismaAccelerateRegionsErrors, GetPrismaAccelerateRegionsResponses, GetPrismaPostgresRegionsData, GetPrismaPostgresRegionsErrors, GetPrismaPostgresRegionsResponses, GetProjectData, GetProjectErrors, GetProjectResponses, GetWorkspaceData, GetWorkspaceErrors, GetWorkspaceResponses, ListBackupsData, ListBackupsErrors, ListBackupsResponses, ListConnectionsData, ListConnectionsErrors, ListConnectionsResponses, ListDatabaseConnectionsData, ListDatabaseConnectionsErrors, ListDatabaseConnectionsResponses, ListDatabases2Data, ListDatabases2Errors, ListDatabases2Responses, ListDatabasesData, ListDatabasesErrors, ListDatabasesResponses, ListIntegrations2Data, ListIntegrations2Errors, ListIntegrations2Responses, ListIntegrationsData, ListIntegrationsErrors, ListIntegrationsResponses, ListProjectsData, ListProjectsErrors, ListProjectsResponses, ListWorkspacesData, ListWorkspacesErrors, ListWorkspacesResponses, RevokeIntegrationTokensData, RevokeIntegrationTokensErrors, RevokeIntegrationTokensResponses, TransferProjectData, TransferProjectErrors, TransferProjectResponses, UpdateDatabaseData, UpdateDatabaseErrors, UpdateDatabaseResponses, UpdateProjectData, UpdateProjectErrors, UpdateProjectResponses } from './types.gen';\n\nexport type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & {\n /**\n * You can provide a client instance returned by `createClient()` instead of\n * individual options. This might be also useful if you want to implement a\n * custom client.\n */\n client?: Client;\n /**\n * You can pass arbitrary values through the `meta` object. This can be\n * used to access values that aren't defined as part of the SDK function.\n */\n meta?: Record<string, unknown>;\n};\n\nclass HeyApiClient {\n protected client: Client;\n \n constructor(args?: {\n client?: Client;\n }) {\n this.client = args?.client ?? client;\n }\n}\n\nclass HeyApiRegistry<T> {\n private readonly defaultKey = 'default';\n \n private readonly instances: Map<string, T> = new Map();\n \n get(key?: string): T {\n const instance = this.instances.get(key ?? this.defaultKey);\n if (!instance) {\n throw new Error(`No SDK client found. Create one with \"new PrismaClient()\" to fix this error.`);\n }\n return instance;\n }\n \n set(value: T, key?: string): void {\n this.instances.set(key ?? this.defaultKey, value);\n }\n}\n\nexport class PrismaClient extends HeyApiClient {\n public static readonly __registry = new HeyApiRegistry<PrismaClient>();\n \n constructor(args?: {\n client?: Client;\n key?: string;\n }) {\n super(args);\n PrismaClient.__registry.set(this, args?.key);\n }\n \n /**\n * List connections\n *\n * Returns all connections the actor has access to, with optional database filter.\n */\n public listConnections<ThrowOnError extends boolean = true>(options?: Options<ListConnectionsData, ThrowOnError>) {\n return (options?.client ?? this.client).get<ListConnectionsResponses, ListConnectionsErrors, ThrowOnError>({ url: '/v1/connections', ...options });\n }\n \n /**\n * Create connection\n *\n * Creates a new connection for the specified database.\n */\n public createConnection<ThrowOnError extends boolean = true>(options?: Options<CreateConnectionData, ThrowOnError>) {\n return (options?.client ?? this.client).post<CreateConnectionResponses, CreateConnectionErrors, ThrowOnError>({\n url: '/v1/connections',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n });\n }\n \n /**\n * Delete connection\n *\n * Deletes the connection with the given ID.\n */\n public deleteConnection<ThrowOnError extends boolean = true>(options: Options<DeleteConnectionData, ThrowOnError>) {\n return (options.client ?? this.client).delete<DeleteConnectionResponses, DeleteConnectionErrors, ThrowOnError>({ url: '/v1/connections/{id}', ...options });\n }\n \n /**\n * Get connection\n *\n * Returns the connection with the given ID.\n */\n public getConnection<ThrowOnError extends boolean = true>(options: Options<GetConnectionData, ThrowOnError>) {\n return (options.client ?? this.client).get<GetConnectionResponses, GetConnectionErrors, ThrowOnError>({ url: '/v1/connections/{id}', ...options });\n }\n \n /**\n * List databases\n *\n * Returns all databases the token has access to. Optionally filter by project ID.\n */\n public listDatabases<ThrowOnError extends boolean = true>(options?: Options<ListDatabasesData, ThrowOnError>) {\n return (options?.client ?? this.client).get<ListDatabasesResponses, ListDatabasesErrors, ThrowOnError>({ url: '/v1/databases', ...options });\n }\n \n /**\n * Create database\n *\n * Creates a new database in the specified project.\n */\n public createDatabase<ThrowOnError extends boolean = true>(options?: Options<CreateDatabaseData, ThrowOnError>) {\n return (options?.client ?? this.client).post<CreateDatabaseResponses, CreateDatabaseErrors, ThrowOnError>({\n url: '/v1/databases',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n });\n }\n \n /**\n * Delete database\n *\n * Deletes the database with the given ID.\n */\n public deleteDatabase<ThrowOnError extends boolean = true>(options: Options<DeleteDatabaseData, ThrowOnError>) {\n return (options.client ?? this.client).delete<DeleteDatabaseResponses, DeleteDatabaseErrors, ThrowOnError>({ url: '/v1/databases/{databaseId}', ...options });\n }\n \n /**\n * Get database\n *\n * Returns the database with the given ID.\n */\n public getDatabase<ThrowOnError extends boolean = true>(options: Options<GetDatabaseData, ThrowOnError>) {\n return (options.client ?? this.client).get<GetDatabaseResponses, GetDatabaseErrors, ThrowOnError>({ url: '/v1/databases/{databaseId}', ...options });\n }\n \n /**\n * Update database\n *\n * Updates the database with the given ID.\n */\n public updateDatabase<ThrowOnError extends boolean = true>(options: Options<UpdateDatabaseData, ThrowOnError>) {\n return (options.client ?? this.client).patch<UpdateDatabaseResponses, UpdateDatabaseErrors, ThrowOnError>({\n url: '/v1/databases/{databaseId}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n });\n }\n \n /**\n * Get list of database connections\n *\n * Returns all connections for the given database.\n */\n public listDatabaseConnections<ThrowOnError extends boolean = true>(options: Options<ListDatabaseConnectionsData, ThrowOnError>) {\n return (options.client ?? this.client).get<ListDatabaseConnectionsResponses, ListDatabaseConnectionsErrors, ThrowOnError>({ url: '/v1/databases/{databaseId}/connections', ...options });\n }\n \n /**\n * Create database connection string\n *\n * Creates a new connection string for the given database.\n */\n public createDatabaseConnectionString<ThrowOnError extends boolean = true>(options: Options<CreateDatabaseConnectionStringData, ThrowOnError>) {\n return (options.client ?? this.client).post<CreateDatabaseConnectionStringResponses, CreateDatabaseConnectionStringErrors, ThrowOnError>({\n url: '/v1/databases/{databaseId}/connections',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n });\n }\n \n /**\n * Get list of backups\n *\n * Returns backups for the specified database.\n */\n public listBackups<ThrowOnError extends boolean = true>(options: Options<ListBackupsData, ThrowOnError>) {\n return (options.client ?? this.client).get<ListBackupsResponses, ListBackupsErrors, ThrowOnError>({ url: '/v1/databases/{databaseId}/backups', ...options });\n }\n \n /**\n * Get database usage metrics\n *\n * Returns usage metrics for the specified database.\n */\n public getDatabaseUsageMetrics<ThrowOnError extends boolean = true>(options: Options<GetDatabaseUsageMetricsData, ThrowOnError>) {\n return (options.client ?? this.client).get<GetDatabaseUsageMetricsResponses, GetDatabaseUsageMetricsErrors, ThrowOnError>({ url: '/v1/databases/{databaseId}/usage', ...options });\n }\n \n /**\n * Get list of projects\n *\n * Returns the list of projects the token has access to.\n */\n public listProjects<ThrowOnError extends boolean = true>(options?: Options<ListProjectsData, ThrowOnError>) {\n return (options?.client ?? this.client).get<ListProjectsResponses, ListProjectsErrors, ThrowOnError>({ url: '/v1/projects', ...options });\n }\n \n /**\n * Create project with a postgres database\n *\n * Creates a new project with a postgres database.\n */\n public createProjectWithPostgresDatabase<ThrowOnError extends boolean = true>(options?: Options<CreateProjectWithPostgresDatabaseData, ThrowOnError>) {\n return (options?.client ?? this.client).post<CreateProjectWithPostgresDatabaseResponses, CreateProjectWithPostgresDatabaseErrors, ThrowOnError>({\n url: '/v1/projects',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n });\n }\n \n /**\n * Delete project\n *\n * Deletes the project with the given ID.\n */\n public deleteProject<ThrowOnError extends boolean = true>(options: Options<DeleteProjectData, ThrowOnError>) {\n return (options.client ?? this.client).delete<DeleteProjectResponses, DeleteProjectErrors, ThrowOnError>({ url: '/v1/projects/{id}', ...options });\n }\n \n /**\n * Get project\n *\n * Returns the project with the given ID.\n */\n public getProject<ThrowOnError extends boolean = true>(options: Options<GetProjectData, ThrowOnError>) {\n return (options.client ?? this.client).get<GetProjectResponses, GetProjectErrors, ThrowOnError>({ url: '/v1/projects/{id}', ...options });\n }\n \n /**\n * Update project\n *\n * Updates the project with the given ID.\n */\n public updateProject<ThrowOnError extends boolean = true>(options: Options<UpdateProjectData, ThrowOnError>) {\n return (options.client ?? this.client).patch<UpdateProjectResponses, UpdateProjectErrors, ThrowOnError>({\n url: '/v1/projects/{id}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n });\n }\n \n /**\n * Transfer project\n *\n * Transfer the project with the given ID to the new owner's workspace\n */\n public transferProject<ThrowOnError extends boolean = true>(options: Options<TransferProjectData, ThrowOnError>) {\n return (options.client ?? this.client).post<TransferProjectResponses, TransferProjectErrors, ThrowOnError>({\n url: '/v1/projects/{id}/transfer',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n });\n }\n \n /**\n * Get list of databases\n *\n * Returns databases for the given project.\n */\n public listDatabases2<ThrowOnError extends boolean = true>(options: Options<ListDatabases2Data, ThrowOnError>) {\n return (options.client ?? this.client).get<ListDatabases2Responses, ListDatabases2Errors, ThrowOnError>({ url: '/v1/projects/{projectId}/databases', ...options });\n }\n \n /**\n * Create database\n *\n * Creates a new database for the given project.\n */\n public createDatabase2<ThrowOnError extends boolean = true>(options: Options<CreateDatabase2Data, ThrowOnError>) {\n return (options.client ?? this.client).post<CreateDatabase2Responses, CreateDatabase2Errors, ThrowOnError>({\n url: '/v1/projects/{projectId}/databases',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n });\n }\n \n /**\n * Get list of integrations\n *\n * Returns integrations filtered by workspace ID.\n */\n public listIntegrations<ThrowOnError extends boolean = true>(options: Options<ListIntegrationsData, ThrowOnError>) {\n return (options.client ?? this.client).get<ListIntegrationsResponses, ListIntegrationsErrors, ThrowOnError>({ url: '/v1/integrations', ...options });\n }\n \n /**\n * Delete integration\n *\n * Revokes the integration tokens by integration ID.\n */\n public deleteIntegration<ThrowOnError extends boolean = true>(options: Options<DeleteIntegrationData, ThrowOnError>) {\n return (options.client ?? this.client).delete<DeleteIntegrationResponses, DeleteIntegrationErrors, ThrowOnError>({ url: '/v1/integrations/{id}', ...options });\n }\n \n /**\n * Get integration by ID\n *\n * Returns a single integration by its ID.\n */\n public getIntegrationById<ThrowOnError extends boolean = true>(options: Options<GetIntegrationByIdData, ThrowOnError>) {\n return (options.client ?? this.client).get<GetIntegrationByIdResponses, GetIntegrationByIdErrors, ThrowOnError>({ url: '/v1/integrations/{id}', ...options });\n }\n \n /**\n * Get list of integrations\n *\n * Returns integrations for the given workspace.\n */\n public listIntegrations2<ThrowOnError extends boolean = true>(options: Options<ListIntegrations2Data, ThrowOnError>) {\n return (options.client ?? this.client).get<ListIntegrations2Responses, ListIntegrations2Errors, ThrowOnError>({ url: '/v1/workspaces/{workspaceId}/integrations', ...options });\n }\n \n /**\n * Revoke integration tokens\n *\n * Revokes the integration tokens with the given client ID.\n */\n public revokeIntegrationTokens<ThrowOnError extends boolean = true>(options: Options<RevokeIntegrationTokensData, ThrowOnError>) {\n return (options.client ?? this.client).delete<RevokeIntegrationTokensResponses, RevokeIntegrationTokensErrors, ThrowOnError>({ url: '/v1/workspaces/{workspaceId}/integrations/{clientId}', ...options });\n }\n \n /**\n * Get all regions\n *\n * Returns all available regions across products. Optionally filter by product.\n */\n public getAllRegions<ThrowOnError extends boolean = true>(options?: Options<GetAllRegionsData, ThrowOnError>) {\n return (options?.client ?? this.client).get<GetAllRegionsResponses, GetAllRegionsErrors, ThrowOnError>({ url: '/v1/regions', ...options });\n }\n \n /**\n * Get Prisma Postgres regions\n *\n * Returns all available regions for Prisma Postgres.\n */\n public getPrismaPostgresRegions<ThrowOnError extends boolean = true>(options?: Options<GetPrismaPostgresRegionsData, ThrowOnError>) {\n return (options?.client ?? this.client).get<GetPrismaPostgresRegionsResponses, GetPrismaPostgresRegionsErrors, ThrowOnError>({ url: '/v1/regions/postgres', ...options });\n }\n \n /**\n * Get Prisma Accelerate regions\n *\n * Returns all available regions for Prisma Accelerate.\n */\n public getPrismaAccelerateRegions<ThrowOnError extends boolean = true>(options?: Options<GetPrismaAccelerateRegionsData, ThrowOnError>) {\n return (options?.client ?? this.client).get<GetPrismaAccelerateRegionsResponses, GetPrismaAccelerateRegionsErrors, ThrowOnError>({ url: '/v1/regions/accelerate', ...options });\n }\n \n /**\n * Get list of workspaces\n *\n * Returns the list of workspaces the current token can access.\n */\n public listWorkspaces<ThrowOnError extends boolean = true>(options?: Options<ListWorkspacesData, ThrowOnError>) {\n return (options?.client ?? this.client).get<ListWorkspacesResponses, ListWorkspacesErrors, ThrowOnError>({ url: '/v1/workspaces', ...options });\n }\n \n /**\n * Get workspace\n *\n * Returns the workspace with the given ID.\n */\n public getWorkspace<ThrowOnError extends boolean = true>(options: Options<GetWorkspaceData, ThrowOnError>) {\n return (options.client ?? this.client).get<GetWorkspaceResponses, GetWorkspaceErrors, ThrowOnError>({ url: '/v1/workspaces/{id}', ...options });\n }\n}\n"],"mappings":";;;AAoBA,IAAM,eAAN,MAAmB;CACf,AAAU;CAEV,YAAY,MAET;AACC,OAAK,SAAS,MAAM,UAAU;;;AAItC,IAAM,iBAAN,MAAwB;CACpB,AAAiB,aAAa;CAE9B,AAAiB,4BAA4B,IAAI,KAAK;CAEtD,IAAI,KAAiB;EACjB,MAAM,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AS,CAAC;;;;;;;CAQnL,AAAO,wBAA6D,SAA6D;AAC7H,UAAQ,QAAQ,UAAU,KAAK,QAAQ,OAAsF;GAAE,KAAK;GAAwD,GAAG;GAAS,CAAC;;;;;;;CAQ7M,AAAO,cAAmD,SAAoD;AAC1G,UAAQ,SAAS,UAAU,KAAK,QAAQ,IAA+D;GAAE,KAAK;GAAe,GAAG;GAAS,CAAC;;;;;;;CAQ9I,AAAO,yBAA8D,SAA+D;AAChI,UAAQ,SAAS,UAAU,KAAK,QAAQ,IAAqF;GAAE,KAAK;GAAwB,GAAG;GAAS,CAAC;;;;;;;CAQ7K,AAAO,2BAAgE,SAAiE;AACpI,UAAQ,SAAS,UAAU,KAAK,QAAQ,IAAyF;GAAE,KAAK;GAA0B,GAAG;GAAS,CAAC;;;;;;;CAQnL,AAAO,eAAoD,SAAqD;AAC5G,UAAQ,SAAS,UAAU,KAAK,QAAQ,IAAiE;GAAE,KAAK;GAAkB,GAAG;GAAS,CAAC;;;;;;;CAQnJ,AAAO,aAAkD,SAAkD;AACvG,UAAQ,QAAQ,UAAU,KAAK,QAAQ,IAA6D;GAAE,KAAK;GAAuB,GAAG;GAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"sdk.gen.mjs","names":["client","HeyApiClient","constructor","args","HeyApiRegistry","defaultKey","instances","Map","get","key","instance","Error","set","value","PrismaClient","__registry","listConnections","options","url","createConnection","post","headers","deleteConnection","delete","getConnection","listDatabases","createDatabase","deleteDatabase","getDatabase","updateDatabase","patch","listDatabaseConnections","createDatabaseConnectionString","listBackups","getDatabaseUsageMetrics","listProjects","createProjectWithPostgresDatabase","deleteProject","getProject","updateProject","transferProject","listDatabases2","createDatabase2","listIntegrations","deleteIntegration","getIntegrationById","listIntegrations2","revokeIntegrationTokens","getAllRegions","getPrismaPostgresRegions","getPrismaAccelerateRegions","listWorkspaces","getWorkspace"],"sources":["../../src/api/sdk.gen.ts"],"sourcesContent":["// This file is auto-generated by @hey-api/openapi-ts\n\nimport type { Client, Options as Options2, TDataShape } from './client';\nimport { client } from './client.gen';\nimport type { CreateConnectionData, CreateConnectionErrors, CreateConnectionResponses, CreateDatabase2Data, CreateDatabase2Errors, CreateDatabase2Responses, CreateDatabaseConnectionStringData, CreateDatabaseConnectionStringErrors, CreateDatabaseConnectionStringResponses, CreateDatabaseData, CreateDatabaseErrors, CreateDatabaseResponses, CreateProjectWithPostgresDatabaseData, CreateProjectWithPostgresDatabaseErrors, CreateProjectWithPostgresDatabaseResponses, DeleteConnectionData, DeleteConnectionErrors, DeleteConnectionResponses, DeleteDatabaseData, DeleteDatabaseErrors, DeleteDatabaseResponses, DeleteIntegrationData, DeleteIntegrationErrors, DeleteIntegrationResponses, DeleteProjectData, DeleteProjectErrors, DeleteProjectResponses, GetAllRegionsData, GetAllRegionsErrors, GetAllRegionsResponses, GetConnectionData, GetConnectionErrors, GetConnectionResponses, GetDatabaseData, GetDatabaseErrors, GetDatabaseResponses, GetDatabaseUsageMetricsData, GetDatabaseUsageMetricsErrors, GetDatabaseUsageMetricsResponses, GetIntegrationByIdData, GetIntegrationByIdErrors, GetIntegrationByIdResponses, GetPrismaAccelerateRegionsData, GetPrismaAccelerateRegionsErrors, GetPrismaAccelerateRegionsResponses, GetPrismaPostgresRegionsData, GetPrismaPostgresRegionsErrors, GetPrismaPostgresRegionsResponses, GetProjectData, GetProjectErrors, GetProjectResponses, GetWorkspaceData, GetWorkspaceErrors, GetWorkspaceResponses, ListBackupsData, ListBackupsErrors, ListBackupsResponses, ListConnectionsData, ListConnectionsErrors, ListConnectionsResponses, ListDatabaseConnectionsData, ListDatabaseConnectionsErrors, ListDatabaseConnectionsResponses, ListDatabases2Data, ListDatabases2Errors, ListDatabases2Responses, ListDatabasesData, ListDatabasesErrors, ListDatabasesResponses, ListIntegrations2Data, ListIntegrations2Errors, ListIntegrations2Responses, ListIntegrationsData, ListIntegrationsErrors, ListIntegrationsResponses, ListProjectsData, ListProjectsErrors, ListProjectsResponses, ListWorkspacesData, ListWorkspacesErrors, ListWorkspacesResponses, RevokeIntegrationTokensData, RevokeIntegrationTokensErrors, RevokeIntegrationTokensResponses, TransferProjectData, TransferProjectErrors, TransferProjectResponses, UpdateDatabaseData, UpdateDatabaseErrors, UpdateDatabaseResponses, UpdateProjectData, UpdateProjectErrors, UpdateProjectResponses } from './types.gen';\n\nexport type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & {\n /**\n * You can provide a client instance returned by `createClient()` instead of\n * individual options. This might be also useful if you want to implement a\n * custom client.\n */\n client?: Client;\n /**\n * You can pass arbitrary values through the `meta` object. This can be\n * used to access values that aren't defined as part of the SDK function.\n */\n meta?: Record<string, unknown>;\n};\n\nclass HeyApiClient {\n protected client: Client;\n \n constructor(args?: {\n client?: Client;\n }) {\n this.client = args?.client ?? client;\n }\n}\n\nclass HeyApiRegistry<T> {\n private readonly defaultKey = 'default';\n \n private readonly instances: Map<string, T> = new Map();\n \n get(key?: string): T {\n const instance = this.instances.get(key ?? this.defaultKey);\n if (!instance) {\n throw new Error(`No SDK client found. Create one with \"new PrismaClient()\" to fix this error.`);\n }\n return instance;\n }\n \n set(value: T, key?: string): void {\n this.instances.set(key ?? this.defaultKey, value);\n }\n}\n\nexport class PrismaClient extends HeyApiClient {\n public static readonly __registry = new HeyApiRegistry<PrismaClient>();\n \n constructor(args?: {\n client?: Client;\n key?: string;\n }) {\n super(args);\n PrismaClient.__registry.set(this, args?.key);\n }\n \n /**\n * List connections\n *\n * Returns all connections the actor has access to, with optional database filter.\n */\n public listConnections<ThrowOnError extends boolean = true>(options?: Options<ListConnectionsData, ThrowOnError>) {\n return (options?.client ?? this.client).get<ListConnectionsResponses, ListConnectionsErrors, ThrowOnError>({ url: '/v1/connections', ...options });\n }\n \n /**\n * Create connection\n *\n * Creates a new connection for the specified database.\n */\n public createConnection<ThrowOnError extends boolean = true>(options?: Options<CreateConnectionData, ThrowOnError>) {\n return (options?.client ?? this.client).post<CreateConnectionResponses, CreateConnectionErrors, ThrowOnError>({\n url: '/v1/connections',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n });\n }\n \n /**\n * Delete connection\n *\n * Deletes the connection with the given ID.\n */\n public deleteConnection<ThrowOnError extends boolean = true>(options: Options<DeleteConnectionData, ThrowOnError>) {\n return (options.client ?? this.client).delete<DeleteConnectionResponses, DeleteConnectionErrors, ThrowOnError>({ url: '/v1/connections/{id}', ...options });\n }\n \n /**\n * Get connection\n *\n * Returns the connection with the given ID.\n */\n public getConnection<ThrowOnError extends boolean = true>(options: Options<GetConnectionData, ThrowOnError>) {\n return (options.client ?? this.client).get<GetConnectionResponses, GetConnectionErrors, ThrowOnError>({ url: '/v1/connections/{id}', ...options });\n }\n \n /**\n * List databases\n *\n * Returns all databases the token has access to. Optionally filter by project ID.\n */\n public listDatabases<ThrowOnError extends boolean = true>(options?: Options<ListDatabasesData, ThrowOnError>) {\n return (options?.client ?? this.client).get<ListDatabasesResponses, ListDatabasesErrors, ThrowOnError>({ url: '/v1/databases', ...options });\n }\n \n /**\n * Create database\n *\n * Creates a new database in the specified project.\n */\n public createDatabase<ThrowOnError extends boolean = true>(options?: Options<CreateDatabaseData, ThrowOnError>) {\n return (options?.client ?? this.client).post<CreateDatabaseResponses, CreateDatabaseErrors, ThrowOnError>({\n url: '/v1/databases',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n });\n }\n \n /**\n * Delete database\n *\n * Deletes the database with the given ID.\n */\n public deleteDatabase<ThrowOnError extends boolean = true>(options: Options<DeleteDatabaseData, ThrowOnError>) {\n return (options.client ?? this.client).delete<DeleteDatabaseResponses, DeleteDatabaseErrors, ThrowOnError>({ url: '/v1/databases/{databaseId}', ...options });\n }\n \n /**\n * Get database\n *\n * Returns the database with the given ID.\n */\n public getDatabase<ThrowOnError extends boolean = true>(options: Options<GetDatabaseData, ThrowOnError>) {\n return (options.client ?? this.client).get<GetDatabaseResponses, GetDatabaseErrors, ThrowOnError>({ url: '/v1/databases/{databaseId}', ...options });\n }\n \n /**\n * Update database\n *\n * Updates the database with the given ID.\n */\n public updateDatabase<ThrowOnError extends boolean = true>(options: Options<UpdateDatabaseData, ThrowOnError>) {\n return (options.client ?? this.client).patch<UpdateDatabaseResponses, UpdateDatabaseErrors, ThrowOnError>({\n url: '/v1/databases/{databaseId}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n });\n }\n \n /**\n * Get list of database connections\n *\n * Returns all connections for the given database.\n */\n public listDatabaseConnections<ThrowOnError extends boolean = true>(options: Options<ListDatabaseConnectionsData, ThrowOnError>) {\n return (options.client ?? this.client).get<ListDatabaseConnectionsResponses, ListDatabaseConnectionsErrors, ThrowOnError>({ url: '/v1/databases/{databaseId}/connections', ...options });\n }\n \n /**\n * Create database connection string\n *\n * Creates a new connection string for the given database.\n */\n public createDatabaseConnectionString<ThrowOnError extends boolean = true>(options: Options<CreateDatabaseConnectionStringData, ThrowOnError>) {\n return (options.client ?? this.client).post<CreateDatabaseConnectionStringResponses, CreateDatabaseConnectionStringErrors, ThrowOnError>({\n url: '/v1/databases/{databaseId}/connections',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n });\n }\n \n /**\n * Get list of backups\n *\n * Returns backups for the specified database.\n */\n public listBackups<ThrowOnError extends boolean = true>(options: Options<ListBackupsData, ThrowOnError>) {\n return (options.client ?? this.client).get<ListBackupsResponses, ListBackupsErrors, ThrowOnError>({ url: '/v1/databases/{databaseId}/backups', ...options });\n }\n \n /**\n * Get database usage metrics\n *\n * Returns usage metrics for the specified database.\n */\n public getDatabaseUsageMetrics<ThrowOnError extends boolean = true>(options: Options<GetDatabaseUsageMetricsData, ThrowOnError>) {\n return (options.client ?? this.client).get<GetDatabaseUsageMetricsResponses, GetDatabaseUsageMetricsErrors, ThrowOnError>({ url: '/v1/databases/{databaseId}/usage', ...options });\n }\n \n /**\n * Get list of projects\n *\n * Returns the list of projects the token has access to.\n */\n public listProjects<ThrowOnError extends boolean = true>(options?: Options<ListProjectsData, ThrowOnError>) {\n return (options?.client ?? this.client).get<ListProjectsResponses, ListProjectsErrors, ThrowOnError>({ url: '/v1/projects', ...options });\n }\n \n /**\n * Create project with a postgres database\n *\n * Creates a new project with a postgres database.\n */\n public createProjectWithPostgresDatabase<ThrowOnError extends boolean = true>(options?: Options<CreateProjectWithPostgresDatabaseData, ThrowOnError>) {\n return (options?.client ?? this.client).post<CreateProjectWithPostgresDatabaseResponses, CreateProjectWithPostgresDatabaseErrors, ThrowOnError>({\n url: '/v1/projects',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options?.headers\n }\n });\n }\n \n /**\n * Delete project\n *\n * Deletes the project with the given ID.\n */\n public deleteProject<ThrowOnError extends boolean = true>(options: Options<DeleteProjectData, ThrowOnError>) {\n return (options.client ?? this.client).delete<DeleteProjectResponses, DeleteProjectErrors, ThrowOnError>({ url: '/v1/projects/{id}', ...options });\n }\n \n /**\n * Get project\n *\n * Returns the project with the given ID.\n */\n public getProject<ThrowOnError extends boolean = true>(options: Options<GetProjectData, ThrowOnError>) {\n return (options.client ?? this.client).get<GetProjectResponses, GetProjectErrors, ThrowOnError>({ url: '/v1/projects/{id}', ...options });\n }\n \n /**\n * Update project\n *\n * Updates the project with the given ID.\n */\n public updateProject<ThrowOnError extends boolean = true>(options: Options<UpdateProjectData, ThrowOnError>) {\n return (options.client ?? this.client).patch<UpdateProjectResponses, UpdateProjectErrors, ThrowOnError>({\n url: '/v1/projects/{id}',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n });\n }\n \n /**\n * Transfer project\n *\n * Transfer the project with the given ID to the new owner's workspace\n */\n public transferProject<ThrowOnError extends boolean = true>(options: Options<TransferProjectData, ThrowOnError>) {\n return (options.client ?? this.client).post<TransferProjectResponses, TransferProjectErrors, ThrowOnError>({\n url: '/v1/projects/{id}/transfer',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n });\n }\n \n /**\n * Get list of databases\n *\n * Returns databases for the given project.\n */\n public listDatabases2<ThrowOnError extends boolean = true>(options: Options<ListDatabases2Data, ThrowOnError>) {\n return (options.client ?? this.client).get<ListDatabases2Responses, ListDatabases2Errors, ThrowOnError>({ url: '/v1/projects/{projectId}/databases', ...options });\n }\n \n /**\n * Create database\n *\n * Creates a new database for the given project.\n */\n public createDatabase2<ThrowOnError extends boolean = true>(options: Options<CreateDatabase2Data, ThrowOnError>) {\n return (options.client ?? this.client).post<CreateDatabase2Responses, CreateDatabase2Errors, ThrowOnError>({\n url: '/v1/projects/{projectId}/databases',\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n });\n }\n \n /**\n * Get list of integrations\n *\n * Returns integrations filtered by workspace ID.\n */\n public listIntegrations<ThrowOnError extends boolean = true>(options: Options<ListIntegrationsData, ThrowOnError>) {\n return (options.client ?? this.client).get<ListIntegrationsResponses, ListIntegrationsErrors, ThrowOnError>({ url: '/v1/integrations', ...options });\n }\n \n /**\n * Delete integration\n *\n * Revokes the integration tokens by integration ID.\n */\n public deleteIntegration<ThrowOnError extends boolean = true>(options: Options<DeleteIntegrationData, ThrowOnError>) {\n return (options.client ?? this.client).delete<DeleteIntegrationResponses, DeleteIntegrationErrors, ThrowOnError>({ url: '/v1/integrations/{id}', ...options });\n }\n \n /**\n * Get integration by ID\n *\n * Returns a single integration by its ID.\n */\n public getIntegrationById<ThrowOnError extends boolean = true>(options: Options<GetIntegrationByIdData, ThrowOnError>) {\n return (options.client ?? this.client).get<GetIntegrationByIdResponses, GetIntegrationByIdErrors, ThrowOnError>({ url: '/v1/integrations/{id}', ...options });\n }\n \n /**\n * Get list of integrations\n *\n * Returns integrations for the given workspace.\n */\n public listIntegrations2<ThrowOnError extends boolean = true>(options: Options<ListIntegrations2Data, ThrowOnError>) {\n return (options.client ?? this.client).get<ListIntegrations2Responses, ListIntegrations2Errors, ThrowOnError>({ url: '/v1/workspaces/{workspaceId}/integrations', ...options });\n }\n \n /**\n * Revoke integration tokens\n *\n * Revokes the integration tokens with the given client ID.\n */\n public revokeIntegrationTokens<ThrowOnError extends boolean = true>(options: Options<RevokeIntegrationTokensData, ThrowOnError>) {\n return (options.client ?? this.client).delete<RevokeIntegrationTokensResponses, RevokeIntegrationTokensErrors, ThrowOnError>({ url: '/v1/workspaces/{workspaceId}/integrations/{clientId}', ...options });\n }\n \n /**\n * Get all regions\n *\n * Returns all available regions across products. Optionally filter by product.\n */\n public getAllRegions<ThrowOnError extends boolean = true>(options?: Options<GetAllRegionsData, ThrowOnError>) {\n return (options?.client ?? this.client).get<GetAllRegionsResponses, GetAllRegionsErrors, ThrowOnError>({ url: '/v1/regions', ...options });\n }\n \n /**\n * Get Prisma Postgres regions\n *\n * Returns all available regions for Prisma Postgres.\n */\n public getPrismaPostgresRegions<ThrowOnError extends boolean = true>(options?: Options<GetPrismaPostgresRegionsData, ThrowOnError>) {\n return (options?.client ?? this.client).get<GetPrismaPostgresRegionsResponses, GetPrismaPostgresRegionsErrors, ThrowOnError>({ url: '/v1/regions/postgres', ...options });\n }\n \n /**\n * Get Prisma Accelerate regions\n *\n * Returns all available regions for Prisma Accelerate.\n */\n public getPrismaAccelerateRegions<ThrowOnError extends boolean = true>(options?: Options<GetPrismaAccelerateRegionsData, ThrowOnError>) {\n return (options?.client ?? this.client).get<GetPrismaAccelerateRegionsResponses, GetPrismaAccelerateRegionsErrors, ThrowOnError>({ url: '/v1/regions/accelerate', ...options });\n }\n \n /**\n * Get list of workspaces\n *\n * Returns the list of workspaces the current token can access.\n */\n public listWorkspaces<ThrowOnError extends boolean = true>(options?: Options<ListWorkspacesData, ThrowOnError>) {\n return (options?.client ?? this.client).get<ListWorkspacesResponses, ListWorkspacesErrors, ThrowOnError>({ url: '/v1/workspaces', ...options });\n }\n \n /**\n * Get workspace\n *\n * Returns the workspace with the given ID.\n */\n public getWorkspace<ThrowOnError extends boolean = true>(options: Options<GetWorkspaceData, ThrowOnError>) {\n return (options.client ??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1
|
+
import { PrismaPostgresInfrastructureFile, PrismaPostgresInfrastructureFileProps, __ΩPrismaPostgresInfrastructureFileProps } from "./infrastructure-file.cjs";
|
|
2
|
+
export { PrismaPostgresInfrastructureFile, PrismaPostgresInfrastructureFileProps, __ΩPrismaPostgresInfrastructureFileProps };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { PrismaPostgresInfrastructureFile, PrismaPostgresInfrastructureFileProps, __ΩPrismaPostgresInfrastructureFileProps } from "./infrastructure-file.mjs";
|
|
2
|
+
export { PrismaPostgresInfrastructureFile, PrismaPostgresInfrastructureFileProps, __ΩPrismaPostgresInfrastructureFileProps };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_kebab_case = require('../node_modules/.pnpm/@stryke_string-format@0.14.8/node_modules/@stryke/string-format/dist/kebab-case.cjs');
|
|
3
|
+
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
4
|
+
let __alloy_js_core = require("@alloy-js/core");
|
|
5
|
+
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
6
|
+
let __powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
7
|
+
let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
8
|
+
let __powerlines_plugin_alloy_typescript_components_infrastructure_file = require("@powerlines/plugin-alloy/typescript/components/infrastructure-file");
|
|
9
|
+
let defu = require("defu");
|
|
10
|
+
defu = require_rolldown_runtime.__toESM(defu);
|
|
11
|
+
|
|
12
|
+
//#region src/components/infrastructure-file.tsx
|
|
13
|
+
/**
|
|
14
|
+
* Generates the Prisma Postgres infrastructure configuration module for the Powerlines project.
|
|
15
|
+
*/
|
|
16
|
+
function PrismaPostgresInfrastructureFile(props) {
|
|
17
|
+
const [{ children, imports }, rest] = (0, __alloy_js_core.splitProps)(props, ["children", "imports"]);
|
|
18
|
+
const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
19
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_infrastructure_file.InfrastructureFile, (0, __alloy_js_core_jsx_runtime.mergeProps)({ id: "prisma-postgres" }, rest, {
|
|
20
|
+
get imports() {
|
|
21
|
+
return (0, defu.default)({
|
|
22
|
+
"@pulumi/pulumi": "pulumi",
|
|
23
|
+
"@pulumi/prisma-postgres": "prismaPostgres"
|
|
24
|
+
}, imports ?? {});
|
|
25
|
+
},
|
|
26
|
+
get children() {
|
|
27
|
+
return [
|
|
28
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
29
|
+
"export": true,
|
|
30
|
+
"const": true,
|
|
31
|
+
name: "project",
|
|
32
|
+
get initializer() {
|
|
33
|
+
return __alloy_js_core.code`new prismaPostgres.Project("project", {
|
|
34
|
+
name: "${context.config.prisma.prismaPostgres?.projectId}",
|
|
35
|
+
}); `;
|
|
36
|
+
}
|
|
37
|
+
}),
|
|
38
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
39
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
40
|
+
"export": true,
|
|
41
|
+
"const": true,
|
|
42
|
+
name: "database",
|
|
43
|
+
get initializer() {
|
|
44
|
+
return __alloy_js_core.code`prismaPostgres.Database("database", {
|
|
45
|
+
projectId: project.id,
|
|
46
|
+
name: "${context.config.prisma.prismaPostgres?.databaseName || `${require_kebab_case.kebabCase(context.config.name)}.${context.config.mode}.${context.config.prisma.prismaPostgres?.region}`}",
|
|
47
|
+
region: "${context.config.prisma.prismaPostgres?.region}",
|
|
48
|
+
}); `;
|
|
49
|
+
}
|
|
50
|
+
}),
|
|
51
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
52
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
53
|
+
"export": true,
|
|
54
|
+
"const": true,
|
|
55
|
+
name: "connection",
|
|
56
|
+
get initializer() {
|
|
57
|
+
return __alloy_js_core.code`new prismaPostgres.Connection("connection", {
|
|
58
|
+
databaseId: database.id,
|
|
59
|
+
name: "${require_kebab_case.kebabCase(context.config.name)}-api-key",
|
|
60
|
+
}); `;
|
|
61
|
+
}
|
|
62
|
+
}),
|
|
63
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
64
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
65
|
+
get when() {
|
|
66
|
+
return Boolean(children);
|
|
67
|
+
},
|
|
68
|
+
children
|
|
69
|
+
})
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
//#endregion
|
|
76
|
+
exports.PrismaPostgresInfrastructureFile = PrismaPostgresInfrastructureFile;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import { InfrastructureFileProps } from "@powerlines/plugin-alloy/typescript/components/infrastructure-file";
|
|
3
|
+
|
|
4
|
+
//#region src/components/infrastructure-file.d.ts
|
|
5
|
+
type PrismaPostgresInfrastructureFileProps = Omit<InfrastructureFileProps, "id">;
|
|
6
|
+
/**
|
|
7
|
+
* Generates the Prisma Postgres infrastructure configuration module for the Powerlines project.
|
|
8
|
+
*/
|
|
9
|
+
declare function PrismaPostgresInfrastructureFile(props: PrismaPostgresInfrastructureFileProps): _alloy_js_core0.Children;
|
|
10
|
+
declare type __ΩPrismaPostgresInfrastructureFileProps = any[];
|
|
11
|
+
//#endregion
|
|
12
|
+
export { PrismaPostgresInfrastructureFile, PrismaPostgresInfrastructureFileProps, __ΩPrismaPostgresInfrastructureFileProps };
|
|
13
|
+
//# sourceMappingURL=infrastructure-file.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infrastructure-file.d.cts","names":[],"sources":["../../src/components/infrastructure-file.tsx"],"sourcesContent":[],"mappings":";;;;KA8BY,qCAAA,GAAwC,KAClD;;;AADF;AAQgB,iBAAA,gCAAA,CACP,KAAA,EAAA,qCAAqC,CAAA,EAAA,eAAA,CAAA,QAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import { InfrastructureFileProps } from "@powerlines/plugin-alloy/typescript/components/infrastructure-file";
|
|
3
|
+
|
|
4
|
+
//#region src/components/infrastructure-file.d.ts
|
|
5
|
+
type PrismaPostgresInfrastructureFileProps = Omit<InfrastructureFileProps, "id">;
|
|
6
|
+
/**
|
|
7
|
+
* Generates the Prisma Postgres infrastructure configuration module for the Powerlines project.
|
|
8
|
+
*/
|
|
9
|
+
declare function PrismaPostgresInfrastructureFile(props: PrismaPostgresInfrastructureFileProps): _alloy_js_core0.Children;
|
|
10
|
+
declare type __ΩPrismaPostgresInfrastructureFileProps = any[];
|
|
11
|
+
//#endregion
|
|
12
|
+
export { PrismaPostgresInfrastructureFile, PrismaPostgresInfrastructureFileProps, __ΩPrismaPostgresInfrastructureFileProps };
|
|
13
|
+
//# sourceMappingURL=infrastructure-file.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infrastructure-file.d.mts","names":[],"sources":["../../src/components/infrastructure-file.tsx"],"sourcesContent":[],"mappings":";;;;KA8BY,qCAAA,GAAwC,KAClD;;;AADF;AAQgB,iBAAA,gCAAA,CACP,KAAA,EAAA,qCAAqC,CAAA,EAAA,eAAA,CAAA,QAAA"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { kebabCase } from "../node_modules/.pnpm/@stryke_string-format@0.14.8/node_modules/@stryke/string-format/dist/kebab-case.mjs";
|
|
2
|
+
import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
import { Show, code, splitProps } from "@alloy-js/core";
|
|
4
|
+
import { VarDeclaration } from "@alloy-js/typescript";
|
|
5
|
+
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
6
|
+
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
7
|
+
import { InfrastructureFile } from "@powerlines/plugin-alloy/typescript/components/infrastructure-file";
|
|
8
|
+
import defu from "defu";
|
|
9
|
+
|
|
10
|
+
//#region src/components/infrastructure-file.tsx
|
|
11
|
+
/**
|
|
12
|
+
* Generates the Prisma Postgres infrastructure configuration module for the Powerlines project.
|
|
13
|
+
*/
|
|
14
|
+
function PrismaPostgresInfrastructureFile(props) {
|
|
15
|
+
const [{ children, imports }, rest] = splitProps(props, ["children", "imports"]);
|
|
16
|
+
const context = usePowerlines();
|
|
17
|
+
return createComponent(InfrastructureFile, mergeProps({ id: "prisma-postgres" }, rest, {
|
|
18
|
+
get imports() {
|
|
19
|
+
return defu({
|
|
20
|
+
"@pulumi/pulumi": "pulumi",
|
|
21
|
+
"@pulumi/prisma-postgres": "prismaPostgres"
|
|
22
|
+
}, imports ?? {});
|
|
23
|
+
},
|
|
24
|
+
get children() {
|
|
25
|
+
return [
|
|
26
|
+
createComponent(VarDeclaration, {
|
|
27
|
+
"export": true,
|
|
28
|
+
"const": true,
|
|
29
|
+
name: "project",
|
|
30
|
+
get initializer() {
|
|
31
|
+
return code`new prismaPostgres.Project("project", {
|
|
32
|
+
name: "${context.config.prisma.prismaPostgres?.projectId}",
|
|
33
|
+
}); `;
|
|
34
|
+
}
|
|
35
|
+
}),
|
|
36
|
+
createComponent(Spacing, {}),
|
|
37
|
+
createComponent(VarDeclaration, {
|
|
38
|
+
"export": true,
|
|
39
|
+
"const": true,
|
|
40
|
+
name: "database",
|
|
41
|
+
get initializer() {
|
|
42
|
+
return code`prismaPostgres.Database("database", {
|
|
43
|
+
projectId: project.id,
|
|
44
|
+
name: "${context.config.prisma.prismaPostgres?.databaseName || `${kebabCase(context.config.name)}.${context.config.mode}.${context.config.prisma.prismaPostgres?.region}`}",
|
|
45
|
+
region: "${context.config.prisma.prismaPostgres?.region}",
|
|
46
|
+
}); `;
|
|
47
|
+
}
|
|
48
|
+
}),
|
|
49
|
+
createComponent(Spacing, {}),
|
|
50
|
+
createComponent(VarDeclaration, {
|
|
51
|
+
"export": true,
|
|
52
|
+
"const": true,
|
|
53
|
+
name: "connection",
|
|
54
|
+
get initializer() {
|
|
55
|
+
return code`new prismaPostgres.Connection("connection", {
|
|
56
|
+
databaseId: database.id,
|
|
57
|
+
name: "${kebabCase(context.config.name)}-api-key",
|
|
58
|
+
}); `;
|
|
59
|
+
}
|
|
60
|
+
}),
|
|
61
|
+
createComponent(Spacing, {}),
|
|
62
|
+
createComponent(Show, {
|
|
63
|
+
get when() {
|
|
64
|
+
return Boolean(children);
|
|
65
|
+
},
|
|
66
|
+
children
|
|
67
|
+
})
|
|
68
|
+
];
|
|
69
|
+
}
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
//#endregion
|
|
74
|
+
export { PrismaPostgresInfrastructureFile };
|
|
75
|
+
//# sourceMappingURL=infrastructure-file.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infrastructure-file.mjs","names":["code","Show","splitProps","VarDeclaration","Spacing","usePowerlines","InfrastructureFile","kebabCase","defu","PrismaPostgresInfrastructureFile","props","children","imports","rest","context","_$createComponent","_$mergeProps","id","name","initializer","config","prisma","prismaPostgres","projectId","databaseName","mode","region","when","Boolean"],"sources":["../../src/components/infrastructure-file.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, Show, splitProps } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n InfrastructureFile,\n InfrastructureFileProps\n} from \"@powerlines/plugin-alloy/typescript/components/infrastructure-file\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport defu from \"defu\";\nimport { PrismaPluginContext } from \"../types\";\n\nexport type PrismaPostgresInfrastructureFileProps = Omit<\n InfrastructureFileProps,\n \"id\"\n>;\n\n/**\n * Generates the Prisma Postgres infrastructure configuration module for the Powerlines project.\n */\nexport function PrismaPostgresInfrastructureFile(\n props: PrismaPostgresInfrastructureFileProps\n) {\n const [{ children, imports }, rest] = splitProps(props, [\n \"children\",\n \"imports\"\n ]);\n\n const context = usePowerlines<PrismaPluginContext>();\n\n return (\n <InfrastructureFile\n id=\"prisma-postgres\"\n {...rest}\n imports={defu(\n {\n \"@pulumi/pulumi\": \"pulumi\",\n \"@pulumi/prisma-postgres\": \"prismaPostgres\"\n },\n imports ?? {}\n )}>\n <VarDeclaration\n export\n const\n name=\"project\"\n initializer={code`new prismaPostgres.Project(\"project\", {\n name: \"${context.config.prisma.prismaPostgres?.projectId}\",\n }); `}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"database\"\n initializer={code`prismaPostgres.Database(\"database\", {\n projectId: project.id,\n name: \"${\n context.config.prisma.prismaPostgres?.databaseName ||\n `${kebabCase(context.config.name)}.${\n context.config.mode\n }.${context.config.prisma.prismaPostgres?.region}`\n }\",\n region: \"${context.config.prisma.prismaPostgres?.region}\",\n }); `}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"connection\"\n initializer={code`new prismaPostgres.Connection(\"connection\", {\n databaseId: database.id,\n name: \"${kebabCase(context.config.name)}-api-key\",\n }); `}\n />\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </InfrastructureFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAsCA,SAAgBS,iCACdC,OACA;CACA,MAAM,CAAC,EAAEC,UAAUC,WAAWC,QAAQX,WAAWQ,OAAO,CACtD,YACA,UACD,CAAC;CAEF,MAAMI,UAAUT,eAAoC;AAEpD,QAAAU,gBACGT,oBAAkBU,WAAA,EACjBC,IAAE,mBAAA,EACEJ,MAAI;EAAA,IACRD,UAAO;AAAA,UAAEJ,KACP;IACE,kBAAkB;IAClB,2BAA2B;IAC5B,EACDI,WAAW,EACb,CAAC;;EAAA,IAAAD,WAAA;AAAA,UAAA;IAAAI,gBACAZ,gBAAc;KAAA,UAAA;KAAA,SAAA;KAGbe,MAAI;KAAA,IACJC,cAAW;AAAA,aAAEnB,IAAI;mBACNc,QAAQM,OAAOC,OAAOC,gBAAgBC,UAAS;;;KACrD,CAAA;IAAAR,gBAENX,SAAO,EAAA,CAAA;IAAAW,gBACPZ,gBAAc;KAAA,UAAA;KAAA,SAAA;KAGbe,MAAI;KAAA,IACJC,cAAW;AAAA,aAAEnB,IAAI;;mBAGbc,QAAQM,OAAOC,OAAOC,gBAAgBE,gBACtC,GAAGjB,UAAUO,QAAQM,OAAOF,KAAK,CAAA,GAC/BJ,QAAQM,OAAOK,KAAI,GACjBX,QAAQM,OAAOC,OAAOC,gBAAgBI,SAAQ;qBAEzCZ,QAAQM,OAAOC,OAAOC,gBAAgBI,OAAM;;;KACpD,CAAA;IAAAX,gBAENX,SAAO,EAAA,CAAA;IAAAW,gBACPZ,gBAAc;KAAA,UAAA;KAAA,SAAA;KAGbe,MAAI;KAAA,IACJC,cAAW;AAAA,aAAEnB,IAAI;;mBAENO,UAAUO,QAAQM,OAAOF,KAAK,CAAA;;;KACpC,CAAA;IAAAH,gBAENX,SAAO,EAAA,CAAA;IAAAW,gBACPd,MAAI;KAAA,IAAC0B,OAAI;AAAA,aAAEC,QAAQjB,SAAS;;KAAGA;KAAQ,CAAA;IAAA;;EAAA,CAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-schema.mjs","names":[],"sources":["../../src/helpers/get-schema.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { getBinaryTargetForCurrentPlatform } from \"@prisma/get-platform\";\nimport prismaSchemaWasm from \"@prisma/prisma-schema-wasm\";\nimport * as E from \"fp-ts/Either\";\nimport { pipe } from \"fp-ts/lib/function\";\nimport { match } from \"ts-pattern\";\nimport {\n GeneratorConfig,\n GetSchemaOptions,\n GetSchemaResponse,\n PrismaSchema\n} from \"../types/prisma\";\n\nasync function resolveBinaryTargets(generator: GeneratorConfig) {\n for (const binaryTarget of generator.binaryTargets) {\n // load the binaryTargets from the env var\n if (binaryTarget.fromEnvVar && process.env[binaryTarget.fromEnvVar]) {\n const value = JSON.parse(process.env[binaryTarget.fromEnvVar]!);\n\n if (Array.isArray(value)) {\n generator.binaryTargets = value.map(v => ({\n fromEnvVar: null,\n value: v\n }));\n await resolveBinaryTargets(generator); // resolve again if we have native\n } else {\n binaryTarget.value = value;\n }\n }\n\n // resolve native to the current platform\n if (binaryTarget.value === \"native\") {\n binaryTarget.value = await getBinaryTargetForCurrentPlatform();\n binaryTarget.native = true;\n }\n }\n\n if (generator.binaryTargets.length === 0) {\n generator.binaryTargets = [\n {\n fromEnvVar: null,\n value: await getBinaryTargetForCurrentPlatform(),\n native: true\n }\n ];\n }\n}\n\n/**\n * Retrieves the Prisma schema using the provided options.\n *\n * @param options - The options to customize the schema retrieval.\n * @returns The Prisma schema.\n */\nexport async function getSchema(\n options: GetSchemaOptions\n): Promise<PrismaSchema> {\n const configEither = pipe(\n E.tryCatch(\n () => {\n if (process.env.FORCE_PANIC_QUERY_ENGINE_GET_CONFIG) {\n prismaSchemaWasm.debug_panic();\n }\n\n const params = JSON.stringify({\n prismaSchema: options.datamodel,\n datasourceOverrides: {},\n ignoreEnvVarErrors: options.ignoreEnvVarErrors ?? false,\n env: process.env\n });\n\n const data = prismaSchemaWasm.get_config(params);\n\n return data;\n },\n e => ({\n type: \"wasm-error\" as const,\n reason: \"(get-config wasm)\",\n error: e as Error\n })\n ),\n E.map(result => ({ result })),\n E.chainW(({ result }) =>\n // NOTE: this should never fail, as we expect returned values to be valid JSON-serializable strings\n E.tryCatch(\n () => JSON.parse(result) as GetSchemaResponse,\n e => ({\n type: \"parse-json\" as const,\n reason: \"Unable to parse JSON\",\n error: e as Error\n })\n )\n ),\n E.chainW(response => {\n if (response.errors.length > 0) {\n return E.left({\n type: \"validation-error\" as const,\n reason: \"(get-config wasm)\",\n error: response.errors\n });\n }\n return E.right(response.config);\n })\n );\n\n if (E.isRight(configEither)) {\n const { right: data } = configEither;\n\n for (const generator of data.generators) {\n await resolveBinaryTargets(generator);\n }\n\n return Promise.resolve(data);\n }\n\n throw match(configEither.left)\n .with({ type: \"wasm-error\" }, e => {\n return new Error(\n `Prisma get-config Wasm runtime error: ${e.error.message}`\n );\n })\n .with({ type: \"validation-error\" }, e => {\n return new Error(\n `Prisma get-config validation error: ${e.error\n .map(err => err.message)\n .join(\", \")}`\n );\n })\n .otherwise(e => {\n return new Error(\n `Prisma get-config unknown error: ${e.reason} - ${e.error.message}`\n );\n });\n}\n"],"mappings":";;;;;;;AA8BA,
|
|
1
|
+
{"version":3,"file":"get-schema.mjs","names":["getBinaryTargetForCurrentPlatform","prismaSchemaWasm","E","pipe","match","resolveBinaryTargets","generator","binaryTarget","binaryTargets","fromEnvVar","process","env","value","JSON","parse","Array","isArray","map","v","native","length","getSchema","options","configEither","tryCatch","FORCE_PANIC_QUERY_ENGINE_GET_CONFIG","debug_panic","params","stringify","prismaSchema","datamodel","datasourceOverrides","ignoreEnvVarErrors","data","get_config","e","type","reason","error","result","chainW","response","errors","left","right","config","isRight","generators","Promise","resolve","with","Error","message","err","join","otherwise"],"sources":["../../src/helpers/get-schema.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { getBinaryTargetForCurrentPlatform } from \"@prisma/get-platform\";\nimport prismaSchemaWasm from \"@prisma/prisma-schema-wasm\";\nimport * as E from \"fp-ts/Either\";\nimport { pipe } from \"fp-ts/lib/function\";\nimport { match } from \"ts-pattern\";\nimport {\n GeneratorConfig,\n GetSchemaOptions,\n GetSchemaResponse,\n PrismaSchema\n} from \"../types/prisma\";\n\nasync function resolveBinaryTargets(generator: GeneratorConfig) {\n for (const binaryTarget of generator.binaryTargets) {\n // load the binaryTargets from the env var\n if (binaryTarget.fromEnvVar && process.env[binaryTarget.fromEnvVar]) {\n const value = JSON.parse(process.env[binaryTarget.fromEnvVar]!);\n\n if (Array.isArray(value)) {\n generator.binaryTargets = value.map(v => ({\n fromEnvVar: null,\n value: v\n }));\n await resolveBinaryTargets(generator); // resolve again if we have native\n } else {\n binaryTarget.value = value;\n }\n }\n\n // resolve native to the current platform\n if (binaryTarget.value === \"native\") {\n binaryTarget.value = await getBinaryTargetForCurrentPlatform();\n binaryTarget.native = true;\n }\n }\n\n if (generator.binaryTargets.length === 0) {\n generator.binaryTargets = [\n {\n fromEnvVar: null,\n value: await getBinaryTargetForCurrentPlatform(),\n native: true\n }\n ];\n }\n}\n\n/**\n * Retrieves the Prisma schema using the provided options.\n *\n * @param options - The options to customize the schema retrieval.\n * @returns The Prisma schema.\n */\nexport async function getSchema(\n options: GetSchemaOptions\n): Promise<PrismaSchema> {\n const configEither = pipe(\n E.tryCatch(\n () => {\n if (process.env.FORCE_PANIC_QUERY_ENGINE_GET_CONFIG) {\n prismaSchemaWasm.debug_panic();\n }\n\n const params = JSON.stringify({\n prismaSchema: options.datamodel,\n datasourceOverrides: {},\n ignoreEnvVarErrors: options.ignoreEnvVarErrors ?? false,\n env: process.env\n });\n\n const data = prismaSchemaWasm.get_config(params);\n\n return data;\n },\n e => ({\n type: \"wasm-error\" as const,\n reason: \"(get-config wasm)\",\n error: e as Error\n })\n ),\n E.map(result => ({ result })),\n E.chainW(({ result }) =>\n // NOTE: this should never fail, as we expect returned values to be valid JSON-serializable strings\n E.tryCatch(\n () => JSON.parse(result) as GetSchemaResponse,\n e => ({\n type: \"parse-json\" as const,\n reason: \"Unable to parse JSON\",\n error: e as Error\n })\n )\n ),\n E.chainW(response => {\n if (response.errors.length > 0) {\n return E.left({\n type: \"validation-error\" as const,\n reason: \"(get-config wasm)\",\n error: response.errors\n });\n }\n return E.right(response.config);\n })\n );\n\n if (E.isRight(configEither)) {\n const { right: data } = configEither;\n\n for (const generator of data.generators) {\n await resolveBinaryTargets(generator);\n }\n\n return Promise.resolve(data);\n }\n\n throw match(configEither.left)\n .with({ type: \"wasm-error\" }, e => {\n return new Error(\n `Prisma get-config Wasm runtime error: ${e.error.message}`\n );\n })\n .with({ type: \"validation-error\" }, e => {\n return new Error(\n `Prisma get-config validation error: ${e.error\n .map(err => err.message)\n .join(\", \")}`\n );\n })\n .otherwise(e => {\n return new Error(\n `Prisma get-config unknown error: ${e.reason} - ${e.error.message}`\n );\n });\n}\n"],"mappings":";;;;;;;AA8BA,eAAeK,qBAAqBC,WAA4B;AAC9D,MAAK,MAAMC,gBAAgBD,UAAUE,eAAe;AAElD,MAAID,aAAaE,cAAcC,QAAQC,IAAIJ,aAAaE,aAAa;GACnE,MAAMG,QAAQC,KAAKC,MAAMJ,QAAQC,IAAIJ,aAAaE,YAAa;AAE/D,OAAIM,MAAMC,QAAQJ,MAAM,EAAE;AACxBN,cAAUE,gBAAgBI,MAAMK,KAAIC,OAAM;KACxCT,YAAY;KACZG,OAAOM;KACR,EAAE;AACH,UAAMb,qBAAqBC,UAAU;SAErCC,cAAaK,QAAQA;;AAKzB,MAAIL,aAAaK,UAAU,UAAU;AACnCL,gBAAaK,QAAQ,MAAMZ,mCAAmC;AAC9DO,gBAAaY,SAAS;;;AAI1B,KAAIb,UAAUE,cAAcY,WAAW,EACrCd,WAAUE,gBAAgB,CACxB;EACEC,YAAY;EACZG,OAAO,MAAMZ,mCAAmC;EAChDmB,QAAQ;EACT,CACF;;;;;;;;AAUL,eAAsBE,UACpBC,SACuB;CACvB,MAAMC,eAAepB,KACnBD,EAAEsB,eACM;AACJ,MAAId,QAAQC,IAAIc,oCACdxB,kBAAiByB,aAAa;EAGhC,MAAMC,SAASd,KAAKe,UAAU;GAC5BC,cAAcP,QAAQQ;GACtBC,qBAAqB,EAAE;GACvBC,oBAAoBV,QAAQU,sBAAsB;GAClDrB,KAAKD,QAAQC;GACd,CAAC;AAIF,SAFaV,iBAAiBiC,WAAWP,OAAO;KAIlDQ,OAAM;EACJC,MAAM;EACNC,QAAQ;EACRC,OAAOH;EACR,EACF,EACDjC,EAAEe,KAAIsB,YAAW,EAAEA,QAAQ,EAAE,EAC7BrC,EAAEsC,QAAQ,EAAED,aAEVrC,EAAEsB,eACMX,KAAKC,MAAMyB,OAA4B,GAC7CJ,OAAM;EACJC,MAAM;EACNC,QAAQ;EACRC,OAAOH;EACR,EAEL,CAAC,EACDjC,EAAEsC,QAAOC,aAAY;AACnB,MAAIA,SAASC,OAAOtB,SAAS,EAC3B,QAAOlB,EAAEyC,KAAK;GACZP,MAAM;GACNC,QAAQ;GACRC,OAAOG,SAASC;GACjB,CAAC;AAEJ,SAAOxC,EAAE0C,MAAMH,SAASI,OAAO;GAEnC,CAAC;AAED,KAAI3C,EAAE4C,QAAQvB,aAAa,EAAE;EAC3B,MAAM,EAAEqB,OAAOX,SAASV;AAExB,OAAK,MAAMjB,aAAa2B,KAAKc,WAC3B,OAAM1C,qBAAqBC,UAAU;AAGvC,SAAO0C,QAAQC,QAAQhB,KAAK;;AAG9B,OAAM7B,MAAMmB,aAAaoB,KAAK,CAC3BO,KAAK,EAAEd,MAAM,cAAc,GAAED,MAAK;AACjC,yBAAO,IAAIgB,MACT,yCAAyChB,EAAEG,MAAMc,UAClD;GACD,CACDF,KAAK,EAAEd,MAAM,oBAAoB,GAAED,MAAK;AACvC,yBAAO,IAAIgB,MACT,uCAAuChB,EAAEG,MACtCrB,KAAIoC,QAAOA,IAAID,QAAQ,CACvBE,KAAK,KAAK,GACd;GACD,CACDC,WAAUpB,MAAK;AACd,yBAAO,IAAIgB,MACT,oCAAoChB,EAAEE,OAAM,KAAMF,EAAEG,MAAMc,UAC3D;GACD"}
|
package/dist/helpers/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_helpers_get_schema = require('./get-schema.cjs');
|
|
2
1
|
const require_helpers_schema_creator = require('./schema-creator.cjs');
|
|
3
2
|
const require_helpers_prisma_postgres = require('./prisma-postgres.cjs');
|
|
3
|
+
const require_helpers_get_schema = require('./get-schema.cjs');
|
|
4
4
|
|
|
5
5
|
exports.PrismaSchemaCreator = require_helpers_schema_creator.PrismaSchemaCreator;
|
|
6
6
|
exports.findDatabaseByName = require_helpers_prisma_postgres.findDatabaseByName;
|
package/dist/helpers/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getSchema } from "./get-schema.mjs";
|
|
2
1
|
import { PrismaSchemaCreator } from "./schema-creator.mjs";
|
|
3
2
|
import { findDatabaseByName } from "./prisma-postgres.mjs";
|
|
3
|
+
import { getSchema } from "./get-schema.mjs";
|
|
4
4
|
|
|
5
5
|
export { PrismaSchemaCreator, findDatabaseByName, getSchema };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prisma-postgres.mjs","names":[],"sources":["../../src/helpers/prisma-postgres.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { PrismaPluginContext } from \"../types/plugin\";\n\n/**\n * Find a Postgres database by name.\n *\n * @param context - The Prisma plugin context.\n * @param name - The name of the database to find.\n * @returns The database object if found, otherwise undefined.\n */\nexport async function findDatabaseByName(\n context: PrismaPluginContext,\n name: string\n) {\n if (!context.config.prisma.prismaPostgres?.projectId) {\n throw new Error(\n `Prisma Postgres project ID is not configured. Please set \"prisma.prismaPostgres.projectId\" in your Powerlines configuration.`\n );\n }\n\n const databases = await context.prisma.api.listDatabases({\n path: {\n projectId: context.config.prisma.prismaPostgres.projectId\n }\n });\n\n return databases.data.data.find(db => db.name === name);\n}\n"],"mappings":";;;;;;;;AA2BA,
|
|
1
|
+
{"version":3,"file":"prisma-postgres.mjs","names":["findDatabaseByName","context","name","config","prisma","prismaPostgres","projectId","Error","databases","api","listDatabases","path","data","find","db"],"sources":["../../src/helpers/prisma-postgres.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { PrismaPluginContext } from \"../types/plugin\";\n\n/**\n * Find a Postgres database by name.\n *\n * @param context - The Prisma plugin context.\n * @param name - The name of the database to find.\n * @returns The database object if found, otherwise undefined.\n */\nexport async function findDatabaseByName(\n context: PrismaPluginContext,\n name: string\n) {\n if (!context.config.prisma.prismaPostgres?.projectId) {\n throw new Error(\n `Prisma Postgres project ID is not configured. Please set \"prisma.prismaPostgres.projectId\" in your Powerlines configuration.`\n );\n }\n\n const databases = await context.prisma.api.listDatabases({\n path: {\n projectId: context.config.prisma.prismaPostgres.projectId\n }\n });\n\n return databases.data.data.find(db => db.name === name);\n}\n"],"mappings":";;;;;;;;AA2BA,eAAsBA,mBACpBC,SACAC,MACA;AACA,KAAI,CAACD,QAAQE,OAAOC,OAAOC,gBAAgBC,UACzC,OAAM,IAAIC,MACR,+HACD;AASH,SANkB,MAAMN,QAAQG,OAAOK,IAAIC,cAAc,EACvDC,MAAM,EACJL,WAAWL,QAAQE,OAAOC,OAAOC,eAAeC,WAClD,EACD,CAAC,EAEeM,KAAKA,KAAKC,MAAKC,OAAMA,GAAGZ,SAASA,KAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-creator.mjs","names":["
|
|
1
|
+
{"version":3,"file":"schema-creator.mjs","names":["SchemaCreator","PrismaSchemaCreator","context","generators","prisma","schema","value","constructor","datasources","warnings","forEach","generator","pushGenerator","some","gen","name","filter","push","build","provider","output","previewFeatures","length","map","feature","join","config","Object","keys","entries","key","Array","isArray","v","binaryTargets","bt","envPaths","rootEnvPath","schemaEnvPath","write","fs"],"sources":["../../src/helpers/schema-creator.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { SchemaCreator } from \"prisma-util/schema-creator\";\nimport { PrismaPluginContext } from \"../types/plugin\";\nimport { GeneratorConfig } from \"../types/prisma\";\n\n/**\n * Prisma schema creator that allows building a schema via code.\n */\nexport class PrismaSchemaCreator extends SchemaCreator {\n /** Prisma plugin context */\n #context: PrismaPluginContext;\n\n private get generators(): GeneratorConfig[] {\n return this.#context.prisma.schema.generators;\n }\n\n private set generators(value: GeneratorConfig[]) {\n this.#context.prisma.schema.generators = value;\n }\n\n public constructor(context: PrismaPluginContext) {\n super();\n\n this.#context = context;\n this.#context.prisma ??= {} as PrismaPluginContext[\"prisma\"];\n this.#context.prisma.schema ??= {\n generators: [],\n datasources: [],\n warnings: []\n };\n\n this.#context.prisma.schema.generators.forEach(generator => {\n this.pushGenerator(generator);\n });\n }\n\n public pushGenerator(generator: GeneratorConfig): this {\n if (this.generators.some(gen => gen.name === generator.name)) {\n this.generators = [\n ...this.generators.filter(gen => gen.name !== generator.name),\n generator\n ];\n } else {\n this.generators.push(generator);\n }\n\n return this;\n }\n\n public override build(): string {\n let schema = super.build();\n\n for (const generator of this.generators) {\n schema = `\ngenerator ${generator.name} {\n provider = \"${generator.provider.value}\"\n output = \"${generator.output?.value}\"${\n generator.previewFeatures && generator.previewFeatures.length > 0\n ? `\n previewFeatures = [${generator.previewFeatures\n .map(feature => `\"${feature}\"`)\n .join(\", \")}]`\n : \"\"\n }${\n generator.config && Object.keys(generator.config).length > 0\n ? Object.entries(generator.config)\n .map(([key, value]) => {\n if (Array.isArray(value)) {\n return `${key} = [${value.map(v => `\"${v}\"`).join(\", \")}]`;\n } else {\n return `${key} = \"${value}\"`;\n }\n })\n .join(\"\\n \")\n : \"\"\n }${\n generator.binaryTargets && generator.binaryTargets.length > 0\n ? `\n binaryTargets = [${generator.binaryTargets\n .map(bt => `\"${bt.value}\"`)\n .join(\", \")}]`\n : \"\"\n }${\n generator.envPaths?.rootEnvPath || generator.envPaths?.schemaEnvPath\n ? `\n env = {${\n generator.envPaths?.rootEnvPath\n ? `\n root = \"${generator.envPaths.rootEnvPath}\"`\n : \"\"\n }${\n generator.envPaths?.schemaEnvPath\n ? `\n schema = \"${generator.envPaths.schemaEnvPath}\"`\n : \"\"\n }\n }`\n : \"\"\n }\n}\n\n${schema}`;\n }\n\n return schema;\n }\n\n public async write(): Promise<void> {\n await this.#context.fs.write(\n this.#context.config.prisma.schema,\n this.build()\n );\n }\n}\n"],"mappings":";;;;;;AAyBA,IAAaC,sBAAb,cAAyCD,cAAc;;CAErD;CAEA,IAAYG,aAAgC;AAC1C,SAAO,MAAK,QAASC,OAAOC,OAAOF;;CAGrC,IAAYA,WAAWG,OAA0B;AAC/C,QAAK,QAASF,OAAOC,OAAOF,aAAaG;;CAGpCC,YAAYL,SAA8B;AAC/C,SAAO;AAEP,QAAK,UAAWA;AAChB,QAAK,QAASE,WAAW,EAAmC;AAC5D,QAAK,QAASA,OAAOC,WAAW;GAC9BF,YAAY,EAAE;GACdK,aAAa,EAAE;GACfC,UAAU,EAAA;GACX;AAED,QAAK,QAASL,OAAOC,OAAOF,WAAWO,SAAQC,cAAa;AAC1D,QAAKC,cAAcD,UAAU;IAC7B;;CAGGC,cAAcD,WAAkC;AACrD,MAAI,KAAKR,WAAWU,MAAKC,QAAOA,IAAIC,SAASJ,UAAUI,KAAK,CAC1D,MAAKZ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,MACrB,MAAK,QAASb,OAAOtB,OAAOC,QAC5B,KAAKa,OACP,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
3
|
-
const
|
|
4
|
-
const
|
|
3
|
+
const require_helpers_schema_creator = require('./helpers/schema-creator.cjs');
|
|
4
|
+
const require_helpers_get_schema = require('./helpers/get-schema.cjs');
|
|
5
|
+
const require_components_infrastructure_file = require('./components/infrastructure-file.cjs');
|
|
5
6
|
const require_api_client_gen = require('./api/client.gen.cjs');
|
|
6
7
|
const require_api_sdk_gen = require('./api/sdk.gen.cjs');
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
9
|
+
let defu = require("defu");
|
|
10
|
+
defu = require_rolldown_runtime.__toESM(defu);
|
|
11
|
+
let __powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
|
|
9
12
|
let __stryke_cli_execute = require("@stryke/cli/execute");
|
|
10
13
|
let __stryke_fs_exists = require("@stryke/fs/exists");
|
|
11
14
|
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
12
|
-
let defu = require("defu");
|
|
13
|
-
defu = require_rolldown_runtime.__toESM(defu);
|
|
14
15
|
let powerlines_plugin_utils = require("powerlines/plugin-utils");
|
|
15
16
|
|
|
16
|
-
//#region src/index.
|
|
17
|
+
//#region src/index.tsx
|
|
17
18
|
/**
|
|
18
19
|
* A Powerlines plugin to integrate Prisma for code generation.
|
|
19
20
|
*
|
|
@@ -35,33 +36,10 @@ const plugin = (options = {}) => {
|
|
|
35
36
|
}) };
|
|
36
37
|
},
|
|
37
38
|
async configResolved() {
|
|
38
|
-
this.dependencies["@prisma/
|
|
39
|
+
this.dependencies["@prisma/ppg"] = "latest";
|
|
39
40
|
this.config.prisma.configFile = (0, powerlines_plugin_utils.replacePathTokens)(this, this.config.prisma.configFile);
|
|
40
41
|
if (!this.config.prisma.schema) throw new Error(`Prisma schema path is not defined. Please specify a valid path in the plugin configuration.`);
|
|
41
42
|
this.config.prisma.schema = (0, powerlines_plugin_utils.replacePathTokens)(this, this.config.prisma.schema);
|
|
42
|
-
if (this.config.prisma.prismaPostgres) {
|
|
43
|
-
let serviceToken = process.env.PRISMA_SERVICE_TOKEN;
|
|
44
|
-
if (!serviceToken) {
|
|
45
|
-
serviceToken = options.serviceToken;
|
|
46
|
-
if (serviceToken) this.warn("If possible, please use the `PRISMA_SERVICE_TOKEN` environment variable instead of using the `serviceToken` option directly. The `serviceToken` option will work; however, this is a less secure method of configuration.");
|
|
47
|
-
else throw new Error("Unable to determine the Prisma service token. Please set the `PRISMA_SERVICE_TOKEN` environment variable.");
|
|
48
|
-
}
|
|
49
|
-
const client$1 = require_api_client_client_gen.createClient(require_api_client_utils_gen.createConfig({
|
|
50
|
-
baseUrl: "https://api.prisma.io",
|
|
51
|
-
throwOnError: true,
|
|
52
|
-
headers: {
|
|
53
|
-
Authorization: `Bearer ${serviceToken}`,
|
|
54
|
-
"User-Agent": "powerlines/1.0"
|
|
55
|
-
}
|
|
56
|
-
}));
|
|
57
|
-
this.prisma.api = new require_api_sdk_gen.PrismaClient({ client: client$1 });
|
|
58
|
-
await this.prisma.api.createDatabase({ body: {
|
|
59
|
-
isDefault: false,
|
|
60
|
-
name: this.config.prisma.prismaPostgres.databaseName || `${this.config.prisma.prismaPostgres.region}.${this.config.mode}.${this.config.name}`,
|
|
61
|
-
projectId: this.config.prisma.prismaPostgres.projectId,
|
|
62
|
-
region: this.config.prisma.prismaPostgres.region
|
|
63
|
-
} }).then((response) => response.data?.data);
|
|
64
|
-
}
|
|
65
43
|
if (!this.config.prisma.outputPath) throw new Error(`Prisma generated path is not defined. Please specify a valid path in the plugin configuration.`);
|
|
66
44
|
this.config.prisma.outputPath = (0, powerlines_plugin_utils.replacePathTokens)(this, this.config.prisma.outputPath);
|
|
67
45
|
this.prisma ??= {};
|
|
@@ -109,6 +87,17 @@ const plugin = (options = {}) => {
|
|
|
109
87
|
const result = await (0, __stryke_cli_execute.execute)(args.join(" "), this.config.root);
|
|
110
88
|
if (result.failed) throw new Error(`Prisma process exited with code ${result.exitCode}.`);
|
|
111
89
|
}
|
|
90
|
+
if (this.config.prisma.prismaPostgres) await (0, __powerlines_plugin_alloy_render.render)(this, (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_infrastructure_file.PrismaPostgresInfrastructureFile, {}));
|
|
91
|
+
},
|
|
92
|
+
async deploy() {
|
|
93
|
+
if (this.config.prisma.prismaPostgres) {
|
|
94
|
+
let serviceToken = process.env.PRISMA_SERVICE_TOKEN;
|
|
95
|
+
if (!serviceToken) {
|
|
96
|
+
serviceToken = options.serviceToken;
|
|
97
|
+
if (serviceToken) this.warn("If possible, please use the `PRISMA_SERVICE_TOKEN` environment variable instead of using the `serviceToken` option directly. The `serviceToken` option will work; however, this is a less secure method of configuration.");
|
|
98
|
+
else throw new Error("Unable to determine the Prisma service token. Please set the `PRISMA_SERVICE_TOKEN` environment variable.");
|
|
99
|
+
}
|
|
100
|
+
}
|
|
112
101
|
}
|
|
113
102
|
};
|
|
114
103
|
};
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;;;aAyCa;EAJW;;;;;AAcxB;;;AAGW,cAHE,MAGF,EAAA,CAAA,iBAFQ,mBAER,GAF8B,mBAE9B,CAAA,CAAA,OAAA,CAAA,EAAA,mBAAA,EAAA,GACR,MADQ,CACD,QADC,CAAA"}
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;;;aAyCa;EAJW;;;;;AAcxB;;;AAGW,cAHE,MAGF,EAAA,CAAA,iBAFQ,mBAER,GAF8B,mBAE9B,CAAA,CAAA,OAAA,CAAA,EAAA,mBAAA,EAAA,GACR,MADQ,CACD,QADC,CAAA"}
|