burnless 0.1.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.
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'node:module';
3
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
4
+ import { dirname as __pathDirname } from 'node:path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import {
9
+ LOCAL_VERBS,
10
+ buildRemoteProgram,
11
+ delegateToArtifact,
12
+ topVerb
13
+ } from "./chunk-L24B5MJD.js";
14
+ import "./chunk-BN3QFA6Z.js";
15
+ import "./chunk-VKDF3OUE.js";
16
+ import "./chunk-BMDIVUSL.js";
17
+
18
+ // src/index.thin.ts
19
+ async function main() {
20
+ const verb = topVerb(process.argv);
21
+ if (verb !== void 0 && LOCAL_VERBS.has(verb)) {
22
+ const code = await delegateToArtifact(process.argv);
23
+ process.exit(code);
24
+ }
25
+ const program = buildRemoteProgram();
26
+ program.exitOverride((err) => process.exit(err.exitCode === 0 ? 0 : 2));
27
+ program.addHelpText(
28
+ "after",
29
+ `
30
+ Local-instance commands (download the app on first use): ${[...LOCAL_VERBS].sort().join(", ")}`
31
+ );
32
+ if (verb === void 0 && !process.argv.includes("-V") && !process.argv.includes("--version")) {
33
+ program.outputHelp();
34
+ process.exit(0);
35
+ }
36
+ await program.parseAsync(process.argv);
37
+ }
38
+ main().catch((err) => {
39
+ process.stderr.write(`Error: ${err instanceof Error ? err.message : String(err)}
40
+ `);
41
+ process.exit(2);
42
+ });
@@ -0,0 +1,222 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'node:module';
3
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
4
+ import { dirname as __pathDirname } from 'node:path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import {
9
+ DefaultLogger,
10
+ NoopLogger,
11
+ PgDatabase,
12
+ PgDialect,
13
+ PgPreparedQuery,
14
+ PgSession,
15
+ PgTransaction,
16
+ createTableRelationsHelpers,
17
+ entityKind,
18
+ extractTablesRelationalConfig,
19
+ fillPlaceholders,
20
+ isConfig,
21
+ mapResultRow,
22
+ sql
23
+ } from "./chunk-RDP4RLLI.js";
24
+ import "./chunk-BMDIVUSL.js";
25
+
26
+ // ../../node_modules/.pnpm/drizzle-orm@0.38.4_@electric-sql+pglite@0.5.2_@opentelemetry+api@1.9.0_@types+pg@8.15.6_75139cca41f10c6d94ac9ad65d4511ab/node_modules/drizzle-orm/pglite/driver.js
27
+ import { PGlite } from "@electric-sql/pglite";
28
+
29
+ // ../../node_modules/.pnpm/drizzle-orm@0.38.4_@electric-sql+pglite@0.5.2_@opentelemetry+api@1.9.0_@types+pg@8.15.6_75139cca41f10c6d94ac9ad65d4511ab/node_modules/drizzle-orm/pglite/session.js
30
+ import { types } from "@electric-sql/pglite";
31
+ var PglitePreparedQuery = class extends PgPreparedQuery {
32
+ constructor(client, queryString, params, logger, fields, name, _isResponseInArrayMode, customResultMapper) {
33
+ super({ sql: queryString, params });
34
+ this.client = client;
35
+ this.queryString = queryString;
36
+ this.params = params;
37
+ this.logger = logger;
38
+ this.fields = fields;
39
+ this._isResponseInArrayMode = _isResponseInArrayMode;
40
+ this.customResultMapper = customResultMapper;
41
+ this.rawQueryConfig = {
42
+ rowMode: "object",
43
+ parsers: {
44
+ [types.TIMESTAMP]: (value) => value,
45
+ [types.TIMESTAMPTZ]: (value) => value,
46
+ [types.INTERVAL]: (value) => value,
47
+ [types.DATE]: (value) => value
48
+ }
49
+ };
50
+ this.queryConfig = {
51
+ rowMode: "array",
52
+ parsers: {
53
+ [types.TIMESTAMP]: (value) => value,
54
+ [types.TIMESTAMPTZ]: (value) => value,
55
+ [types.INTERVAL]: (value) => value,
56
+ [types.DATE]: (value) => value
57
+ }
58
+ };
59
+ }
60
+ static [entityKind] = "PglitePreparedQuery";
61
+ rawQueryConfig;
62
+ queryConfig;
63
+ async execute(placeholderValues = {}) {
64
+ const params = fillPlaceholders(this.params, placeholderValues);
65
+ this.logger.logQuery(this.queryString, params);
66
+ const { fields, rawQueryConfig, client, queryConfig, joinsNotNullableMap, customResultMapper, queryString } = this;
67
+ if (!fields && !customResultMapper) {
68
+ return client.query(queryString, params, rawQueryConfig);
69
+ }
70
+ const result = await client.query(queryString, params, queryConfig);
71
+ return customResultMapper ? customResultMapper(result.rows) : result.rows.map((row) => mapResultRow(fields, row, joinsNotNullableMap));
72
+ }
73
+ all(placeholderValues = {}) {
74
+ const params = fillPlaceholders(this.params, placeholderValues);
75
+ this.logger.logQuery(this.queryString, params);
76
+ return this.client.query(this.queryString, params, this.rawQueryConfig).then((result) => result.rows);
77
+ }
78
+ /** @internal */
79
+ isResponseInArrayMode() {
80
+ return this._isResponseInArrayMode;
81
+ }
82
+ };
83
+ var PgliteSession = class _PgliteSession extends PgSession {
84
+ constructor(client, dialect, schema, options = {}) {
85
+ super(dialect);
86
+ this.client = client;
87
+ this.schema = schema;
88
+ this.options = options;
89
+ this.logger = options.logger ?? new NoopLogger();
90
+ }
91
+ static [entityKind] = "PgliteSession";
92
+ logger;
93
+ prepareQuery(query, fields, name, isResponseInArrayMode, customResultMapper) {
94
+ return new PglitePreparedQuery(
95
+ this.client,
96
+ query.sql,
97
+ query.params,
98
+ this.logger,
99
+ fields,
100
+ name,
101
+ isResponseInArrayMode,
102
+ customResultMapper
103
+ );
104
+ }
105
+ async transaction(transaction, config) {
106
+ return this.client.transaction(async (client) => {
107
+ const session = new _PgliteSession(
108
+ client,
109
+ this.dialect,
110
+ this.schema,
111
+ this.options
112
+ );
113
+ const tx = new PgliteTransaction(this.dialect, session, this.schema);
114
+ if (config) {
115
+ await tx.setTransaction(config);
116
+ }
117
+ return transaction(tx);
118
+ });
119
+ }
120
+ async count(sql2) {
121
+ const res = await this.execute(sql2);
122
+ return Number(
123
+ res["rows"][0]["count"]
124
+ );
125
+ }
126
+ };
127
+ var PgliteTransaction = class _PgliteTransaction extends PgTransaction {
128
+ static [entityKind] = "PgliteTransaction";
129
+ async transaction(transaction) {
130
+ const savepointName = `sp${this.nestedIndex + 1}`;
131
+ const tx = new _PgliteTransaction(
132
+ this.dialect,
133
+ this.session,
134
+ this.schema,
135
+ this.nestedIndex + 1
136
+ );
137
+ await tx.execute(sql.raw(`savepoint ${savepointName}`));
138
+ try {
139
+ const result = await transaction(tx);
140
+ await tx.execute(sql.raw(`release savepoint ${savepointName}`));
141
+ return result;
142
+ } catch (err) {
143
+ await tx.execute(sql.raw(`rollback to savepoint ${savepointName}`));
144
+ throw err;
145
+ }
146
+ }
147
+ };
148
+
149
+ // ../../node_modules/.pnpm/drizzle-orm@0.38.4_@electric-sql+pglite@0.5.2_@opentelemetry+api@1.9.0_@types+pg@8.15.6_75139cca41f10c6d94ac9ad65d4511ab/node_modules/drizzle-orm/pglite/driver.js
150
+ var PgliteDriver = class {
151
+ constructor(client, dialect, options = {}) {
152
+ this.client = client;
153
+ this.dialect = dialect;
154
+ this.options = options;
155
+ }
156
+ static [entityKind] = "PgliteDriver";
157
+ createSession(schema) {
158
+ return new PgliteSession(this.client, this.dialect, schema, { logger: this.options.logger });
159
+ }
160
+ };
161
+ var PgliteDatabase = class extends PgDatabase {
162
+ static [entityKind] = "PgliteDatabase";
163
+ };
164
+ function construct(client, config = {}) {
165
+ const dialect = new PgDialect({ casing: config.casing });
166
+ let logger;
167
+ if (config.logger === true) {
168
+ logger = new DefaultLogger();
169
+ } else if (config.logger !== false) {
170
+ logger = config.logger;
171
+ }
172
+ let schema;
173
+ if (config.schema) {
174
+ const tablesConfig = extractTablesRelationalConfig(
175
+ config.schema,
176
+ createTableRelationsHelpers
177
+ );
178
+ schema = {
179
+ fullSchema: config.schema,
180
+ schema: tablesConfig.tables,
181
+ tableNamesMap: tablesConfig.tableNamesMap
182
+ };
183
+ }
184
+ const driver = new PgliteDriver(client, dialect, { logger });
185
+ const session = driver.createSession(schema);
186
+ const db = new PgliteDatabase(dialect, session, schema);
187
+ db.$client = client;
188
+ return db;
189
+ }
190
+ function drizzle(...params) {
191
+ if (params[0] === void 0 || typeof params[0] === "string") {
192
+ const instance = new PGlite(params[0]);
193
+ return construct(instance, params[1]);
194
+ }
195
+ if (isConfig(params[0])) {
196
+ const { connection, client, ...drizzleConfig } = params[0];
197
+ if (client)
198
+ return construct(client, drizzleConfig);
199
+ if (typeof connection === "object") {
200
+ const { dataDir, ...options } = connection;
201
+ const instance2 = new PGlite(dataDir, options);
202
+ return construct(instance2, drizzleConfig);
203
+ }
204
+ const instance = new PGlite(connection);
205
+ return construct(instance, drizzleConfig);
206
+ }
207
+ return construct(params[0], params[1]);
208
+ }
209
+ ((drizzle2) => {
210
+ function mock(config) {
211
+ return construct({}, config);
212
+ }
213
+ drizzle2.mock = mock;
214
+ })(drizzle || (drizzle = {}));
215
+ export {
216
+ PgliteDatabase,
217
+ PgliteDriver,
218
+ PglitePreparedQuery,
219
+ PgliteSession,
220
+ PgliteTransaction,
221
+ drizzle
222
+ };
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'node:module';
3
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
4
+ import { dirname as __pathDirname } from 'node:path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import {
9
+ PostgresJsDatabase,
10
+ PostgresJsPreparedQuery,
11
+ PostgresJsSession,
12
+ PostgresJsTransaction,
13
+ drizzle
14
+ } from "./chunk-IBT7EFKB.js";
15
+ import "./chunk-MHVBJUPX.js";
16
+ import "./chunk-RDP4RLLI.js";
17
+ import "./chunk-BMDIVUSL.js";
18
+ export {
19
+ PostgresJsDatabase,
20
+ PostgresJsPreparedQuery,
21
+ PostgresJsSession,
22
+ PostgresJsTransaction,
23
+ drizzle
24
+ };
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'node:module';
3
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
4
+ import { dirname as __pathDirname } from 'node:path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import {
9
+ readSecret
10
+ } from "./chunk-M7YWG4WP.js";
11
+ import "./chunk-BMDIVUSL.js";
12
+ export {
13
+ readSecret
14
+ };
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'node:module';
3
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
4
+ import { dirname as __pathDirname } from 'node:path';
5
+ const require = __createRequire(import.meta.url);
6
+ const __filename = __fileURLToPath(import.meta.url);
7
+ const __dirname = __pathDirname(__filename);
8
+ import {
9
+ PUBLIC_RELEASE_REPO,
10
+ downloadAndVerify,
11
+ ensureArtifact,
12
+ extractArtifact,
13
+ flipCurrent,
14
+ installedVersions,
15
+ publicReleaseBaseFor,
16
+ resolveReleaseSource,
17
+ versionsDir
18
+ } from "./chunk-N7IP6VPJ.js";
19
+ import "./chunk-BN3QFA6Z.js";
20
+ import "./chunk-VKDF3OUE.js";
21
+ import "./chunk-BMDIVUSL.js";
22
+ export {
23
+ PUBLIC_RELEASE_REPO,
24
+ downloadAndVerify,
25
+ ensureArtifact,
26
+ extractArtifact,
27
+ flipCurrent,
28
+ installedVersions,
29
+ publicReleaseBaseFor,
30
+ resolveReleaseSource,
31
+ versionsDir
32
+ };