From ac9671768ff17cdcfe14f86893a606140a284fe3 Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Wed, 1 May 2024 19:39:09 +0200 Subject: [PATCH] these files need changing too... --- packages/cli/src/generator.test.ts | 2 +- packages/cli/src/generator.ts | 6 ++-- .../example/src/books/BookService__sql.res | 4 +-- packages/example/src/books/books.queries.ts | 2 +- packages/example/src/books/books__sql.res | 28 +++++++++---------- .../example/src/comments/comments.queries.ts | 2 +- .../example/src/comments/comments__sql.res | 8 +++--- .../notifications/notifications.queries.ts | 2 +- .../src/notifications/notifications.ts | 2 +- .../src/notifications/notifications__sql.res | 6 ++-- packages/example/src/users/sample.ts | 2 +- packages/query/src/actions.ts | 5 +++- packages/query/src/index.ts | 2 +- 13 files changed, 37 insertions(+), 34 deletions(-) diff --git a/packages/cli/src/generator.test.ts b/packages/cli/src/generator.test.ts index f32d41dc..c58cce5c 100644 --- a/packages/cli/src/generator.test.ts +++ b/packages/cli/src/generator.test.ts @@ -1,4 +1,4 @@ -import { ParameterTransform } from '@pgtyped/runtime'; +import { ParameterTransform } from 'pgtyped-rescript-runtime'; import { parseSQLFile } from '@pgtyped/parser'; import { IQueryTypes } from 'pgtyped-rescript-query/lib/actions'; diff --git a/packages/cli/src/generator.ts b/packages/cli/src/generator.ts index d1626ea4..2af4fa58 100644 --- a/packages/cli/src/generator.ts +++ b/packages/cli/src/generator.ts @@ -2,7 +2,7 @@ import { ParameterTransform, processSQLQueryIR, processTSQueryAST, -} from '@pgtyped/runtime'; +} from 'pgtyped-rescript-runtime'; import { parseSQLFile, @@ -340,7 +340,7 @@ export async function generateDeclarationFile( if (mode === 'sql') { // Second parameter has no effect here, we could have used any value types.use( - { name: 'PreparedQuery', from: '@pgtyped/runtime' }, + { name: 'PreparedQuery', from: 'pgtyped-rescript-runtime' }, TypeScope.Return, ); } @@ -409,7 +409,7 @@ module ${ typeDec.query.name }Params) => promise } = { - @module("@pgtyped/runtime") @new external ${ + @module("pgtyped-rescript-runtime") @new external ${ typeDec.query.name }: IR.t => PreparedStatement.t<${typeDec.query.paramTypeAlias}, ${ typeDec.query.returnTypeAlias diff --git a/packages/example/src/books/BookService__sql.res b/packages/example/src/books/BookService__sql.res index d77d8231..1469903f 100644 --- a/packages/example/src/books/BookService__sql.res +++ b/packages/example/src/books/BookService__sql.res @@ -66,7 +66,7 @@ module FindBookById: { @gentype let execute: (PgTyped.Pg.Client.t, findBookByIdParams) => promise } = { - @module("@pgtyped/runtime") @new external findBookById: IR.t => PreparedStatement.t = "PreparedQuery"; + @module("pgtyped-rescript-runtime") @new external findBookById: IR.t => PreparedStatement.t = "PreparedQuery"; let query = findBookById(findBookByIdIR) let query = (params, ~client) => query->PreparedStatement.run(params, ~client) @@ -153,7 +153,7 @@ module BooksByAuthor: { @gentype let execute: (PgTyped.Pg.Client.t, booksByAuthorParams) => promise } = { - @module("@pgtyped/runtime") @new external booksByAuthor: IR.t => PreparedStatement.t = "PreparedQuery"; + @module("pgtyped-rescript-runtime") @new external booksByAuthor: IR.t => PreparedStatement.t = "PreparedQuery"; let query = booksByAuthor(booksByAuthorIR) let query = (params, ~client) => query->PreparedStatement.run(params, ~client) diff --git a/packages/example/src/books/books.queries.ts b/packages/example/src/books/books.queries.ts index 260f6ae5..04369b0c 100644 --- a/packages/example/src/books/books.queries.ts +++ b/packages/example/src/books/books.queries.ts @@ -1,7 +1,7 @@ /** Types generated for queries found in "src/books/books.sql" */ import { Category } from '../customTypes'; -import { PreparedQuery } from '@pgtyped/runtime'; +import { PreparedQuery } from 'pgtyped-rescript-runtime'; export type Iso31661Alpha2 = 'AD' | 'AE' | 'AF' | 'AG' | 'AI' | 'AL' | 'AM' | 'AO' | 'AQ' | 'AR' | 'AS' | 'AT' | 'AU' | 'AW' | 'AX' | 'AZ' | 'BA' | 'BB' | 'BD' | 'BE' | 'BF' | 'BG' | 'BH' | 'BI' | 'BJ' | 'BL' | 'BM' | 'BN' | 'BO' | 'BQ' | 'BR' | 'BS' | 'BT' | 'BV' | 'BW' | 'BY' | 'BZ' | 'CA' | 'CC' | 'CD' | 'CF' | 'CG' | 'CH' | 'CI' | 'CK' | 'CL' | 'CM' | 'CN' | 'CO' | 'CR' | 'CU' | 'CV' | 'CW' | 'CX' | 'CY' | 'CZ' | 'DE' | 'DJ' | 'DK' | 'DM' | 'DO' | 'DZ' | 'EC' | 'EE' | 'EG' | 'EH' | 'ER' | 'ES' | 'ET' | 'FI' | 'FJ' | 'FK' | 'FM' | 'FO' | 'FR' | 'GA' | 'GB' | 'GD' | 'GE' | 'GF' | 'GG' | 'GH' | 'GI' | 'GL' | 'GM' | 'GN' | 'GP' | 'GQ' | 'GR' | 'GS' | 'GT' | 'GU' | 'GW' | 'GY' | 'HK' | 'HM' | 'HN' | 'HR' | 'HT' | 'HU' | 'ID' | 'IE' | 'IL' | 'IM' | 'IN' | 'IO' | 'IQ' | 'IR' | 'IS' | 'IT' | 'JE' | 'JM' | 'JO' | 'JP' | 'KE' | 'KG' | 'KH' | 'KI' | 'KM' | 'KN' | 'KP' | 'KR' | 'KW' | 'KY' | 'KZ' | 'LA' | 'LB' | 'LC' | 'LI' | 'LK' | 'LR' | 'LS' | 'LT' | 'LU' | 'LV' | 'LY' | 'MA' | 'MC' | 'MD' | 'ME' | 'MF' | 'MG' | 'MH' | 'MK' | 'ML' | 'MM' | 'MN' | 'MO' | 'MP' | 'MQ' | 'MR' | 'MS' | 'MT' | 'MU' | 'MV' | 'MW' | 'MX' | 'MY' | 'MZ' | 'NA' | 'NC' | 'NE' | 'NF' | 'NG' | 'NI' | 'NL' | 'NO' | 'NP' | 'NR' | 'NU' | 'NZ' | 'OM' | 'PA' | 'PE' | 'PF' | 'PG' | 'PH' | 'PK' | 'PL' | 'PM' | 'PN' | 'PR' | 'PS' | 'PT' | 'PW' | 'PY' | 'QA' | 'RE' | 'RO' | 'RS' | 'RU' | 'RW' | 'SA' | 'SB' | 'SC' | 'SD' | 'SE' | 'SG' | 'SH' | 'SI' | 'SJ' | 'SK' | 'SL' | 'SM' | 'SN' | 'SO' | 'SR' | 'SS' | 'ST' | 'SV' | 'SX' | 'SY' | 'SZ' | 'TC' | 'TD' | 'TF' | 'TG' | 'TH' | 'TJ' | 'TK' | 'TL' | 'TM'; diff --git a/packages/example/src/books/books__sql.res b/packages/example/src/books/books__sql.res index b16a8369..f76cd487 100644 --- a/packages/example/src/books/books__sql.res +++ b/packages/example/src/books/books__sql.res @@ -75,7 +75,7 @@ module FindBookById: { @gentype let execute: (PgTyped.Pg.Client.t, findBookByIdParams) => promise } = { - @module("@pgtyped/runtime") @new external findBookById: IR.t => PreparedStatement.t = "PreparedQuery"; + @module("pgtyped-rescript-runtime") @new external findBookById: IR.t => PreparedStatement.t = "PreparedQuery"; let query = findBookById(findBookByIdIR) let query = (params, ~client) => query->PreparedStatement.run(params, ~client) @@ -160,7 +160,7 @@ module FindBookByCategory: { @gentype let execute: (PgTyped.Pg.Client.t, findBookByCategoryParams) => promise } = { - @module("@pgtyped/runtime") @new external findBookByCategory: IR.t => PreparedStatement.t = "PreparedQuery"; + @module("pgtyped-rescript-runtime") @new external findBookByCategory: IR.t => PreparedStatement.t = "PreparedQuery"; let query = findBookByCategory(findBookByCategoryIR) let query = (params, ~client) => query->PreparedStatement.run(params, ~client) @@ -243,7 +243,7 @@ module FindBookNameOrRank: { @gentype let execute: (PgTyped.Pg.Client.t, findBookNameOrRankParams) => promise } = { - @module("@pgtyped/runtime") @new external findBookNameOrRank: IR.t => PreparedStatement.t = "PreparedQuery"; + @module("pgtyped-rescript-runtime") @new external findBookNameOrRank: IR.t => PreparedStatement.t = "PreparedQuery"; let query = findBookNameOrRank(findBookNameOrRankIR) let query = (params, ~client) => query->PreparedStatement.run(params, ~client) @@ -326,7 +326,7 @@ module FindBookUnicode: { @gentype let execute: (PgTyped.Pg.Client.t, findBookUnicodeParams) => promise } = { - @module("@pgtyped/runtime") @new external findBookUnicode: IR.t => PreparedStatement.t = "PreparedQuery"; + @module("pgtyped-rescript-runtime") @new external findBookUnicode: IR.t => PreparedStatement.t = "PreparedQuery"; let query = findBookUnicode(findBookUnicodeIR) let query = (params, ~client) => query->PreparedStatement.run(params, ~client) @@ -413,7 +413,7 @@ module InsertBooks: { @gentype let execute: (PgTyped.Pg.Client.t, insertBooksParams) => promise } = { - @module("@pgtyped/runtime") @new external insertBooks: IR.t => PreparedStatement.t = "PreparedQuery"; + @module("pgtyped-rescript-runtime") @new external insertBooks: IR.t => PreparedStatement.t = "PreparedQuery"; let query = insertBooks(insertBooksIR) let query = (params, ~client) => query->PreparedStatement.run(params, ~client) @@ -496,7 +496,7 @@ module InsertBook: { @gentype let execute: (PgTyped.Pg.Client.t, insertBookParams) => promise } = { - @module("@pgtyped/runtime") @new external insertBook: IR.t => PreparedStatement.t = "PreparedQuery"; + @module("pgtyped-rescript-runtime") @new external insertBook: IR.t => PreparedStatement.t = "PreparedQuery"; let query = insertBook(insertBookIR) let query = (params, ~client) => query->PreparedStatement.run(params, ~client) @@ -582,7 +582,7 @@ module UpdateBooksCustom: { @gentype let execute: (PgTyped.Pg.Client.t, updateBooksCustomParams) => promise } = { - @module("@pgtyped/runtime") @new external updateBooksCustom: IR.t => PreparedStatement.t = "PreparedQuery"; + @module("pgtyped-rescript-runtime") @new external updateBooksCustom: IR.t => PreparedStatement.t = "PreparedQuery"; let query = updateBooksCustom(updateBooksCustomIR) let query = (params, ~client) => query->PreparedStatement.run(params, ~client) @@ -666,7 +666,7 @@ module UpdateBooks: { @gentype let execute: (PgTyped.Pg.Client.t, updateBooksParams) => promise } = { - @module("@pgtyped/runtime") @new external updateBooks: IR.t => PreparedStatement.t = "PreparedQuery"; + @module("pgtyped-rescript-runtime") @new external updateBooks: IR.t => PreparedStatement.t = "PreparedQuery"; let query = updateBooks(updateBooksIR) let query = (params, ~client) => query->PreparedStatement.run(params, ~client) @@ -749,7 +749,7 @@ module UpdateBooksRankNotNull: { @gentype let execute: (PgTyped.Pg.Client.t, updateBooksRankNotNullParams) => promise } = { - @module("@pgtyped/runtime") @new external updateBooksRankNotNull: IR.t => PreparedStatement.t = "PreparedQuery"; + @module("pgtyped-rescript-runtime") @new external updateBooksRankNotNull: IR.t => PreparedStatement.t = "PreparedQuery"; let query = updateBooksRankNotNull(updateBooksRankNotNullIR) let query = (params, ~client) => query->PreparedStatement.run(params, ~client) @@ -836,7 +836,7 @@ module GetBooksByAuthorName: { @gentype let execute: (PgTyped.Pg.Client.t, getBooksByAuthorNameParams) => promise } = { - @module("@pgtyped/runtime") @new external getBooksByAuthorName: IR.t => PreparedStatement.t = "PreparedQuery"; + @module("pgtyped-rescript-runtime") @new external getBooksByAuthorName: IR.t => PreparedStatement.t = "PreparedQuery"; let query = getBooksByAuthorName(getBooksByAuthorNameIR) let query = (params, ~client) => query->PreparedStatement.run(params, ~client) @@ -916,7 +916,7 @@ module AggregateEmailsAndTest: { @gentype let execute: (PgTyped.Pg.Client.t, aggregateEmailsAndTestParams) => promise } = { - @module("@pgtyped/runtime") @new external aggregateEmailsAndTest: IR.t => PreparedStatement.t = "PreparedQuery"; + @module("pgtyped-rescript-runtime") @new external aggregateEmailsAndTest: IR.t => PreparedStatement.t = "PreparedQuery"; let query = aggregateEmailsAndTest(aggregateEmailsAndTestIR) let query = (params, ~client) => query->PreparedStatement.run(params, ~client) @@ -994,7 +994,7 @@ module GetBooks: { @gentype let execute: (PgTyped.Pg.Client.t, getBooksParams) => promise } = { - @module("@pgtyped/runtime") @new external getBooks: IR.t => PreparedStatement.t = "PreparedQuery"; + @module("pgtyped-rescript-runtime") @new external getBooks: IR.t => PreparedStatement.t = "PreparedQuery"; let query = getBooks(getBooksIR) let query = (params, ~client) => query->PreparedStatement.run(params, ~client) @@ -1071,7 +1071,7 @@ module CountBooks: { @gentype let execute: (PgTyped.Pg.Client.t, countBooksParams) => promise } = { - @module("@pgtyped/runtime") @new external countBooks: IR.t => PreparedStatement.t = "PreparedQuery"; + @module("pgtyped-rescript-runtime") @new external countBooks: IR.t => PreparedStatement.t = "PreparedQuery"; let query = countBooks(countBooksIR) let query = (params, ~client) => query->PreparedStatement.run(params, ~client) @@ -1149,7 +1149,7 @@ module GetBookCountries: { @gentype let execute: (PgTyped.Pg.Client.t, getBookCountriesParams) => promise } = { - @module("@pgtyped/runtime") @new external getBookCountries: IR.t => PreparedStatement.t = "PreparedQuery"; + @module("pgtyped-rescript-runtime") @new external getBookCountries: IR.t => PreparedStatement.t = "PreparedQuery"; let query = getBookCountries(getBookCountriesIR) let query = (params, ~client) => query->PreparedStatement.run(params, ~client) diff --git a/packages/example/src/comments/comments.queries.ts b/packages/example/src/comments/comments.queries.ts index 3ded9279..237ff958 100644 --- a/packages/example/src/comments/comments.queries.ts +++ b/packages/example/src/comments/comments.queries.ts @@ -1,5 +1,5 @@ /** Types generated for queries found in "src/comments/comments.sql" */ -import { PreparedQuery } from '@pgtyped/runtime'; +import { PreparedQuery } from 'pgtyped-rescript-runtime'; /** 'GetAllComments' parameters type */ export interface IGetAllCommentsParams { diff --git a/packages/example/src/comments/comments__sql.res b/packages/example/src/comments/comments__sql.res index a98ebd66..d3141bc1 100644 --- a/packages/example/src/comments/comments__sql.res +++ b/packages/example/src/comments/comments__sql.res @@ -54,7 +54,7 @@ module GetAllComments: { @gentype let execute: (PgTyped.Pg.Client.t, getAllCommentsParams) => promise } = { - @module("@pgtyped/runtime") @new external getAllComments: IR.t => PreparedStatement.t = "PreparedQuery"; + @module("pgtyped-rescript-runtime") @new external getAllComments: IR.t => PreparedStatement.t = "PreparedQuery"; let query = getAllComments(getAllCommentsIR) let query = (params, ~client) => query->PreparedStatement.run(params, ~client) @@ -136,7 +136,7 @@ module GetAllCommentsByIds: { @gentype let execute: (PgTyped.Pg.Client.t, getAllCommentsByIdsParams) => promise } = { - @module("@pgtyped/runtime") @new external getAllCommentsByIds: IR.t => PreparedStatement.t = "PreparedQuery"; + @module("pgtyped-rescript-runtime") @new external getAllCommentsByIds: IR.t => PreparedStatement.t = "PreparedQuery"; let query = getAllCommentsByIds(getAllCommentsByIdsIR) let query = (params, ~client) => query->PreparedStatement.run(params, ~client) @@ -225,7 +225,7 @@ module InsertComment: { @gentype let execute: (PgTyped.Pg.Client.t, insertCommentParams) => promise } = { - @module("@pgtyped/runtime") @new external insertComment: IR.t => PreparedStatement.t = "PreparedQuery"; + @module("pgtyped-rescript-runtime") @new external insertComment: IR.t => PreparedStatement.t = "PreparedQuery"; let query = insertComment(insertCommentIR) let query = (params, ~client) => query->PreparedStatement.run(params, ~client) @@ -302,7 +302,7 @@ module SelectExistsTest: { @gentype let execute: (PgTyped.Pg.Client.t, selectExistsTestParams) => promise } = { - @module("@pgtyped/runtime") @new external selectExistsTest: IR.t => PreparedStatement.t = "PreparedQuery"; + @module("pgtyped-rescript-runtime") @new external selectExistsTest: IR.t => PreparedStatement.t = "PreparedQuery"; let query = selectExistsTest(selectExistsTestIR) let query = (params, ~client) => query->PreparedStatement.run(params, ~client) diff --git a/packages/example/src/notifications/notifications.queries.ts b/packages/example/src/notifications/notifications.queries.ts index c0c8491a..8074ca0b 100644 --- a/packages/example/src/notifications/notifications.queries.ts +++ b/packages/example/src/notifications/notifications.queries.ts @@ -1,5 +1,5 @@ /** Types generated for queries found in "src/notifications/notifications.sql" */ -import { PreparedQuery } from '@pgtyped/runtime'; +import { PreparedQuery } from 'pgtyped-rescript-runtime'; export type notification_type = 'deadline' | 'notification' | 'reminder'; diff --git a/packages/example/src/notifications/notifications.ts b/packages/example/src/notifications/notifications.ts index bd51f42d..ea61752f 100644 --- a/packages/example/src/notifications/notifications.ts +++ b/packages/example/src/notifications/notifications.ts @@ -1,4 +1,4 @@ -import { sql } from '@pgtyped/runtime'; +import { sql } from 'pgtyped-rescript-runtime'; import { IInsertNotificationQuery, IInsertNotificationsQuery, diff --git a/packages/example/src/notifications/notifications__sql.res b/packages/example/src/notifications/notifications__sql.res index eeabae57..ad6666a5 100644 --- a/packages/example/src/notifications/notifications__sql.res +++ b/packages/example/src/notifications/notifications__sql.res @@ -61,7 +61,7 @@ module SendNotifications: { @gentype let execute: (PgTyped.Pg.Client.t, sendNotificationsParams) => promise } = { - @module("@pgtyped/runtime") @new external sendNotifications: IR.t => PreparedStatement.t = "PreparedQuery"; + @module("pgtyped-rescript-runtime") @new external sendNotifications: IR.t => PreparedStatement.t = "PreparedQuery"; let query = sendNotifications(sendNotificationsIR) let query = (params, ~client) => query->PreparedStatement.run(params, ~client) @@ -148,7 +148,7 @@ module GetNotifications: { @gentype let execute: (PgTyped.Pg.Client.t, getNotificationsParams) => promise } = { - @module("@pgtyped/runtime") @new external getNotifications: IR.t => PreparedStatement.t = "PreparedQuery"; + @module("pgtyped-rescript-runtime") @new external getNotifications: IR.t => PreparedStatement.t = "PreparedQuery"; let query = getNotifications(getNotificationsIR) let query = (params, ~client) => query->PreparedStatement.run(params, ~client) @@ -232,7 +232,7 @@ module ThresholdFrogs: { @gentype let execute: (PgTyped.Pg.Client.t, thresholdFrogsParams) => promise } = { - @module("@pgtyped/runtime") @new external thresholdFrogs: IR.t => PreparedStatement.t = "PreparedQuery"; + @module("pgtyped-rescript-runtime") @new external thresholdFrogs: IR.t => PreparedStatement.t = "PreparedQuery"; let query = thresholdFrogs(thresholdFrogsIR) let query = (params, ~client) => query->PreparedStatement.run(params, ~client) diff --git a/packages/example/src/users/sample.ts b/packages/example/src/users/sample.ts index 41514f5d..936023cd 100644 --- a/packages/example/src/users/sample.ts +++ b/packages/example/src/users/sample.ts @@ -1,4 +1,4 @@ -import { sql } from '@pgtyped/runtime'; +import { sql } from 'pgtyped-rescript-runtime'; import { IGetUsersWithCommentsQuery } from './sample.types.js'; import { Client } from 'pg'; diff --git a/packages/query/src/actions.ts b/packages/query/src/actions.ts index bda184cf..38af9beb 100644 --- a/packages/query/src/actions.ts +++ b/packages/query/src/actions.ts @@ -2,7 +2,10 @@ import { AsyncQueue, messages, PreparedObjectType } from '@pgtyped/wire'; import crypto from 'crypto'; import debugBase from 'debug'; import * as tls from 'tls'; -import type { InterpolatedQuery, QueryParameter } from '@pgtyped/runtime'; +import type { + InterpolatedQuery, + QueryParameter, +} from 'pgtyped-rescript-runtime'; import { checkServerFinalMessage, createClientSASLContinueResponse, diff --git a/packages/query/src/index.ts b/packages/query/src/index.ts index 20ac0f40..c95afb62 100644 --- a/packages/query/src/index.ts +++ b/packages/query/src/index.ts @@ -1,4 +1,4 @@ -import { InterpolatedQuery } from '@pgtyped/runtime'; +import { InterpolatedQuery } from 'pgtyped-rescript-runtime'; import { IParseError, IQueryTypes } from './actions.js'; export { getTypes, startup, IParseError, IQueryTypes } from './actions.js';