From 12db276c11593c7e41030bd5ac9707b24c73083a Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Sun, 21 Apr 2024 17:26:03 +0200 Subject: [PATCH] upgrades --- cli/Cli.res | 8 +++--- cli/EdgeDbGenerator.res | 8 +++--- cli/EdgeDbGenerator__Utils.res | 4 +-- cli/UnusedSelections.res | 4 +-- dbTestProject/bsconfig.json | 25 ------------------ package-lock.json | 48 +++++++++++++++++----------------- package.json | 12 ++++----- bsconfig.json => rescript.json | 2 +- src/EdgeDB.res | 2 +- 9 files changed, 44 insertions(+), 69 deletions(-) delete mode 100644 dbTestProject/bsconfig.json rename bsconfig.json => rescript.json (94%) diff --git a/cli/Cli.res b/cli/Cli.res index bc385fa..88ca26c 100644 --- a/cli/Cli.res +++ b/cli/Cli.res @@ -137,7 +137,7 @@ let main = async () => { panic( `Invalid value for --tls-security. Must be one of: ${validTlsSecurityValues ->Array.map(x => `"${x}"`) - ->Array.joinWith(" | ")}`, + ->Array.join(" | ")}`, ) } else { switch tlsSec { @@ -184,7 +184,7 @@ let main = async () => { let connectionConfig = await getNormalizedConfig(config.client) - let url = `http://${connectionConfig["address"]->Array.joinWith( + let url = `http://${connectionConfig["address"]->Array.join( ":", )}/ui/${connectionConfig["database"]}` url->JSON.stringifyAny->Console.log @@ -330,7 +330,7 @@ let main = async () => { fileOutput->Array.push( `let queryText = \`${queryText}\` -${types.distinctTypes->Set.values->Iterator.toArray->Array.joinWith("\n\n")} +${types.distinctTypes->Set.values->Iterator.toArray->Array.join("\n\n")} @live let query = (client: EdgeDB.Client.t${hasArgs @@ -348,7 +348,7 @@ let transaction = (transaction: EdgeDB.Transaction.t${hasArgs : ""}${extraInFnApply}) }`, ) - let content = fileOutput->Array.joinWith("") + let content = fileOutput->Array.join("") // Sync errors syncErrors()->Promise.done diff --git a/cli/EdgeDbGenerator.res b/cli/EdgeDbGenerator.res index 33bef28..a0ea59f 100644 --- a/cli/EdgeDbGenerator.res +++ b/cli/EdgeDbGenerator.res @@ -214,7 +214,7 @@ module AnalyzeQuery = { }, )->generateSetType(field.cardinality)},` }) - ->Array.joinWith("\n")}\n}` + ->Array.join("\n")}\n}` ctx.distinctTypes->Set.add(recordDef) name @@ -231,11 +231,11 @@ module AnalyzeQuery = { let name = polyVariantNameNeedsEscapingRegex->RegExp.test(v) ? v : `"${v}"` `#${name}` }) - ->Array.joinWith(" | ")}]` + ->Array.join(" | ")}]` } else if codec->is(int16Codec) || codec->is(int32Codec) { "int" } else if codec->is(bigintCodec) { - "BigInt.t" + "bigint" } else if codec->is(jsonCodec) { "JSON.t" } else { @@ -277,7 +277,7 @@ module AnalyzeQuery = { `(${codec ->getSubcodecs ->Array.map(subCodec => walkCodec(subCodec, ctx)) - ->Array.joinWith(", ")})` + ->Array.join(", ")})` } else if codec->is(rangeCodec) { let subCodec = codec->getSubcodecs->Array.getUnsafe(0) if !(subCodec->is(scalarCodec)) { diff --git a/cli/EdgeDbGenerator__Utils.res b/cli/EdgeDbGenerator__Utils.res index 97eebe6..a0eeb63 100644 --- a/cli/EdgeDbGenerator__Utils.res +++ b/cli/EdgeDbGenerator__Utils.res @@ -55,7 +55,7 @@ let uncapitalizeString = str => `${str->String.slice(~start=0, ~end=1)->String.toLowerCase}${str->String.sliceToEnd(~start=1)}` let pathToName = path => { - let name = path->Array.joinWith("__") + let name = path->Array.join("__") // Make valid ReScript record name. uncapitalizeString(name) @@ -122,7 +122,7 @@ module Errors = { ->Array.length Some({ - text: text->Array.filter(l => l->String.trim !== "")->Array.joinWith("\n"), + text: text->Array.filter(l => l->String.trim !== "")->Array.join("\n"), start: { line, col: colStart, diff --git a/cli/UnusedSelections.res b/cli/UnusedSelections.res index 55c3631..380dd81 100644 --- a/cli/UnusedSelections.res +++ b/cli/UnusedSelections.res @@ -17,7 +17,7 @@ type extractedLineInfo = { let extractLineInfo = line => { switch line->String.trim->String.split(" ")->List.fromArray { | list{info, ...rest} => - let restText = rest->List.toArray->Array.joinWith(" ")->String.trim + let restText = rest->List.toArray->Array.join(" ")->String.trim switch (info->String.split("."), restText) { | ([queryName, recordName, fieldName], "is a record label never used to read a value") if !(recordName->String.startsWith("args")) => @@ -131,7 +131,7 @@ let reportResults = results => { fileInfo => { let contextMessage = switch fileInfo.recordPath { | None | Some([]) => "" - | Some(path) => `${path->Array.joinWith(".")}` + | Some(path) => `${path->Array.join(".")}` } Console.log(` - ${contextMessage}.${fileInfo.fieldName}`) }, diff --git a/dbTestProject/bsconfig.json b/dbTestProject/bsconfig.json deleted file mode 100644 index 158bf5c..0000000 --- a/dbTestProject/bsconfig.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "res", - "uncurried": true, - "sources": [ - { - "dir": "src", - "subdirs": true - }, - { - "dir": "test", - "type": "dev" - }, - { - "dir": "../src" - } - ], - "package-specs": { - "module": "es6", - "in-source": true - }, - "suffix": ".mjs", - "bs-dependencies": ["@rescript/core", "rescript-edgedb"], - "bsc-flags": ["-open RescriptCore"], - "ppx-flags": ["rescript-embed-lang/ppx"] -} diff --git a/package-lock.json b/package-lock.json index 54dbc36..5a946b6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,16 +16,16 @@ "rescript-edgedb": "dist/Cli.js" }, "devDependencies": { - "@rescript/core": "1.0.0", + "@rescript/core": "1.3.0", "esbuild": "^0.19.3", - "rescript": "^11.0.0", + "rescript": "^11.1.0", "rescript-embed-lang": "0.4.0", - "rescript-nodejs": "^16.0.0" + "rescript-nodejs": "^16.1.0" }, "peerDependencies": { - "@rescript/core": ">= 1.0.0", + "@rescript/core": ">= 1.3.0", "edgedb": ">= 1.3.6", - "rescript": "^11.0.0 || ^11.1.0-rc.2", + "rescript": "^11.1.0", "rescript-embed-lang": ">= 0.4.0" } }, @@ -414,12 +414,12 @@ } }, "node_modules/@rescript/core": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@rescript/core/-/core-1.0.0.tgz", - "integrity": "sha512-F5HURYYx8Kp6h1KBiri2nFwGKR16o9/XTCNl2TEWfCwqR+MTzf/lpuPuB6ajnaYytsU0kTUBIFI0DOoLgkDxSg==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@rescript/core/-/core-1.3.0.tgz", + "integrity": "sha512-wNZOZ63sYcaIYZCmTZeIPCeLa3HCGgPbIOR8zjyNkoBYUlxNV8Nb2ZyqlXR5Mb9ttvv8fTV56JbKhyVEZEYo8g==", "dev": true, "peerDependencies": { - "rescript": ">=11.0.0 || ^11.1.0-rc.2" + "rescript": "^11.1.0-rc.7" } }, "node_modules/anymatch": { @@ -694,9 +694,9 @@ } }, "node_modules/rescript": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/rescript/-/rescript-11.0.1.tgz", - "integrity": "sha512-7T4PRp/d0+CBNnY6PYKffFqo9tGZlvnZpboF/n+8SKS+JZ6VvXJO7W538VPZXf3EYx1COGAWWvkF9e/HgSAqHg==", + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/rescript/-/rescript-11.1.0.tgz", + "integrity": "sha512-9la2Dv+ACylQ77I8s4spPu1JnLZXbH5WgxcLHLLUBWgFFSiv0wXqgzWztrBIZqwFgVX5BYcwldUqUVcEzdCyHg==", "dev": true, "hasInstallScript": true, "bin": { @@ -716,9 +716,9 @@ "hasInstallScript": true }, "node_modules/rescript-nodejs": { - "version": "16.0.0", - "resolved": "https://registry.npmjs.org/rescript-nodejs/-/rescript-nodejs-16.0.0.tgz", - "integrity": "sha512-1/SJmjH06xdeq1IFIIcKV6QKnidrav/gIc0Rw4GCUD0ceYPPZ5wDB51UFyk98in5N4gv8X/bTg6dVBMyRsC9tw==", + "version": "16.1.0", + "resolved": "https://registry.npmjs.org/rescript-nodejs/-/rescript-nodejs-16.1.0.tgz", + "integrity": "sha512-RyXGIEsb8UhuShf5PwKcTkYNPz+cPQ0CZq74lbYCbCa5YFidbmiIWpQhCMtpsgP1PkLClhKGDkfZfmwwNOil4Q==", "dev": true }, "node_modules/reusify": { @@ -943,9 +943,9 @@ } }, "@rescript/core": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@rescript/core/-/core-1.0.0.tgz", - "integrity": "sha512-F5HURYYx8Kp6h1KBiri2nFwGKR16o9/XTCNl2TEWfCwqR+MTzf/lpuPuB6ajnaYytsU0kTUBIFI0DOoLgkDxSg==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@rescript/core/-/core-1.3.0.tgz", + "integrity": "sha512-wNZOZ63sYcaIYZCmTZeIPCeLa3HCGgPbIOR8zjyNkoBYUlxNV8Nb2ZyqlXR5Mb9ttvv8fTV56JbKhyVEZEYo8g==", "dev": true, "requires": {} }, @@ -1128,9 +1128,9 @@ } }, "rescript": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/rescript/-/rescript-11.0.1.tgz", - "integrity": "sha512-7T4PRp/d0+CBNnY6PYKffFqo9tGZlvnZpboF/n+8SKS+JZ6VvXJO7W538VPZXf3EYx1COGAWWvkF9e/HgSAqHg==", + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/rescript/-/rescript-11.1.0.tgz", + "integrity": "sha512-9la2Dv+ACylQ77I8s4spPu1JnLZXbH5WgxcLHLLUBWgFFSiv0wXqgzWztrBIZqwFgVX5BYcwldUqUVcEzdCyHg==", "dev": true }, "rescript-embed-lang": { @@ -1140,9 +1140,9 @@ "dev": true }, "rescript-nodejs": { - "version": "16.0.0", - "resolved": "https://registry.npmjs.org/rescript-nodejs/-/rescript-nodejs-16.0.0.tgz", - "integrity": "sha512-1/SJmjH06xdeq1IFIIcKV6QKnidrav/gIc0Rw4GCUD0ceYPPZ5wDB51UFyk98in5N4gv8X/bTg6dVBMyRsC9tw==", + "version": "16.1.0", + "resolved": "https://registry.npmjs.org/rescript-nodejs/-/rescript-nodejs-16.1.0.tgz", + "integrity": "sha512-RyXGIEsb8UhuShf5PwKcTkYNPz+cPQ0CZq74lbYCbCa5YFidbmiIWpQhCMtpsgP1PkLClhKGDkfZfmwwNOil4Q==", "dev": true }, "reusify": { diff --git a/package.json b/package.json index d4521ac..eff0ce8 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "files": [ "README.md", "CHANGELOG.md", - "bsconfig.json", + "rescript.json", "dist", "src" ], @@ -30,16 +30,16 @@ "fast-glob": "^3.3.1" }, "devDependencies": { - "@rescript/core": "1.0.0", + "@rescript/core": "1.3.0", "esbuild": "^0.19.3", - "rescript": "^11.0.0", + "rescript": "^11.1.0", "rescript-embed-lang": "0.4.0", - "rescript-nodejs": "^16.0.0" + "rescript-nodejs": "^16.1.0" }, "peerDependencies": { - "@rescript/core": ">= 1.0.0", + "@rescript/core": ">= 1.3.0", "edgedb": ">= 1.3.6", - "rescript": "^11.0.0 || ^11.1.0-rc.2", + "rescript": "^11.1.0", "rescript-embed-lang": ">= 0.4.0" } } diff --git a/bsconfig.json b/rescript.json similarity index 94% rename from bsconfig.json rename to rescript.json index 8eaffb2..777f9a6 100644 --- a/bsconfig.json +++ b/rescript.json @@ -15,7 +15,7 @@ } ], "package-specs": { - "module": "es6", + "module": "esmodule", "in-source": true }, "suffix": ".mjs", diff --git a/src/EdgeDB.res b/src/EdgeDB.res index a31d5a4..009294d 100644 --- a/src/EdgeDB.res +++ b/src/EdgeDB.res @@ -657,7 +657,7 @@ module DataTypes = { type t @get external bytes: t => float = "bytes" - @get external bytesBigInt: t => BigInt.t = "bytesBigInt" + @get external bytesBigInt: t => bigint = "bytesBigInt" @get external kibibytes: t => float = "kibibytes" @get external mebibytes: t => float = "mebibytes" @get external gibibytes: t => float = "gibibytes"