@certik/skynet 0.19.3 → 0.20.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/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.20.0
4
+
5
+ - Fix databricks with bun (extra step needed for projects using the lib):
6
+
7
+ - Copy the patch file `patches/@databricks%2Fsql@1.9.0.patch`
8
+ - Add the following configs to your `package.json`:
9
+
10
+ ```json
11
+ "patchedDependencies": {
12
+ "@databricks/sql@1.9.0": "patches/@databricks%2Fsql@1.9.0.patch"
13
+ }
14
+ ```
15
+
16
+ - BREAKING: Remove support for snowflake
17
+
3
18
  ## 0.19.3
4
19
 
5
20
  - Fix elastic search not working in bun
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@certik/skynet",
3
- "version": "0.19.3",
3
+ "version": "0.20.0",
4
4
  "description": "Skynet Shared JS library",
5
5
  "type": "module",
6
6
  "main": "index.ts",
@@ -27,7 +27,6 @@
27
27
  "express": "^4.21.2",
28
28
  "md5": "^2.3.0",
29
29
  "meow": "^13.2.0",
30
- "snowflake-sdk": "^1.15.0",
31
30
  "type-fest": "^4.35.0",
32
31
  "web3": "^4.16.0",
33
32
  "which": "^5.0.0"
@@ -49,5 +48,8 @@
49
48
  "license": "MIT",
50
49
  "publishConfig": {
51
50
  "access": "public"
51
+ },
52
+ "patchedDependencies": {
53
+ "@databricks/sql@1.9.0": "patches/@databricks%2Fsql@1.9.0.patch"
52
54
  }
53
55
  }
@@ -0,0 +1,21 @@
1
+ diff --git a/dist/utils/lz4.js b/dist/utils/lz4.js
2
+ index d61c9bce9bfd4a85e1eec1c03070e6fdbc9771e5..fe440516e86f428446afe3c78ab0211a5a5b139c 100644
3
+ --- a/dist/utils/lz4.js
4
+ +++ b/dist/utils/lz4.js
5
+ @@ -1,15 +1,7 @@
6
+ "use strict";
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ function tryLoadLZ4Module() {
9
+ - try {
10
+ - return require('lz4'); // eslint-disable-line global-require
11
+ - }
12
+ - catch (err) {
13
+ - const isModuleNotFoundError = err instanceof Error && 'code' in err && err.code === 'MODULE_NOT_FOUND';
14
+ - if (!isModuleNotFoundError) {
15
+ - throw err;
16
+ - }
17
+ - }
18
+ + return undefined;
19
+ }
20
+ exports.default = tryLoadLZ4Module();
21
+ //# sourceMappingURL=lz4.js.map
package/snowflake.ts DELETED
@@ -1,51 +0,0 @@
1
- import snowflake from "snowflake-sdk";
2
- import type { ConnectionOptions, Connection, Binds } from "snowflake-sdk";
3
- import { ensureAndGet } from "./env.js";
4
-
5
- async function getConnection(options: Partial<ConnectionOptions>) {
6
- const account = ensureAndGet("SKYNET_SNOWFLAKE_ACCOUNT");
7
- const username = ensureAndGet("SKYNET_SNOWFLAKE_USERNAME");
8
- const password = ensureAndGet("SKYNET_SNOWFLAKE_PASSWORD");
9
-
10
- if (!account || !username || !password) {
11
- throw new Error("missing snowflake credentials");
12
- }
13
-
14
- const connection = snowflake.createConnection({
15
- account,
16
- username,
17
- password,
18
- ...options,
19
- });
20
-
21
- return new Promise<Connection>((resolve, reject) => {
22
- connection.connect((err, conn) => {
23
- if (err) {
24
- reject(err);
25
- } else {
26
- resolve(conn);
27
- }
28
- });
29
- });
30
- }
31
-
32
- async function executeSql<T>(options: ConnectionOptions, sql: string, binds?: Binds) {
33
- const connection = await getConnection(options);
34
-
35
- return await new Promise<T[] | undefined>((resolve, reject) => {
36
- connection.execute({
37
- sqlText: sql,
38
- binds: binds,
39
- complete: (err, statement, rows) => {
40
- // console.log(statement.getSqlText());
41
- if (err) {
42
- reject(err);
43
- } else {
44
- resolve(rows);
45
- }
46
- },
47
- });
48
- });
49
- }
50
-
51
- export { getConnection, executeSql };